Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .iloom/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"agents": {
"iloom-issue-analyzer": { "model": "opus" },
"iloom-issue-planner": { "model": "opus", "review": true },
"iloom-issue-analyze-and-plan": { "model": "opus" },
"iloom-issue-analyze-and-plan": { "model": "opus", "review": true },
"iloom-issue-implementer": { "model": "opus" },
"iloom-code-reviewer": { "providers": { "gemini": "gemini-3-pro-preview" } },
"iloom-artifact-reviewer": { "enabled": true, "providers": { "gemini": "gemini-3-pro-preview" } }
Expand Down
7 changes: 6 additions & 1 deletion src/lib/LoomManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,15 @@ vi.mock('./LoomLauncher.js', () => ({
// Shared mock functions for verification in tests
const mockCreateDraftPR = vi.fn()
const mockCheckForExistingPR = vi.fn()
let mockIssuePrefix = '#'
vi.mock('./PRManager.js', () => {
// Use a class-like factory that creates fresh instances
// This avoids issues with mockReset clearing the constructor implementation
return {
PRManager: class MockPRManager {
createDraftPR = mockCreateDraftPR
checkForExistingPR = mockCheckForExistingPR
get issuePrefix() { return mockIssuePrefix }
},
}
})
Expand All @@ -146,6 +148,7 @@ describe('LoomManager', () => {
let mockSettings: vi.Mocked<SettingsManager>

beforeEach(() => {
mockIssuePrefix = '#' // Reset to GitHub default
mockGitWorktree = new GitWorktreeManager() as vi.Mocked<GitWorktreeManager>
mockGitHub = new GitHubService() as vi.Mocked<GitHubService>
mockBranchNaming = new DefaultBranchNamingService() as vi.Mocked<DefaultBranchNamingService>
Expand Down Expand Up @@ -492,6 +495,7 @@ describe('LoomManager', () => {
// Configure Linear provider (doesn't support PRs natively)
mockGitHub.supportsPullRequests = false
mockGitHub.providerName = 'linear'
mockIssuePrefix = '' // Linear issues use empty prefix (identifier already includes team key)

// Mock settings with github-draft-pr mode
// (Issue #464: Linear + github-draft-pr should work since PRs go through GitHub CLI)
Expand Down Expand Up @@ -527,10 +531,11 @@ describe('LoomManager', () => {
expect(result.type).toBe('issue')

// Verify draft PR was created via PRManager (not Linear's issue tracker)
// Linear identifier is 123 with empty prefix, so body contains "Fixes 123"
expect(mockCreateDraftPR).toHaveBeenCalledWith(
expect.any(String), // branch name
'Test Linear Issue', // PR title from issue
expect.stringContaining('PR for issue'), // PR body
expect.stringContaining('Fixes 123'), // PR body with Fixes keyword (no prefix for Linear)
expectedPath // worktree path
)

Expand Down
10 changes: 7 additions & 3 deletions src/lib/LoomManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,13 @@ export class LoomManager {
// For issue mode: use issue title and reference issue number
// For branch mode: use branch name and generic description
const prTitle = issueData?.title ?? `Work on ${branchName}`
const prBody = input.type === 'issue'
? `PR for issue #${input.identifier}\n\nThis PR was created automatically by iloom.`
: `Branch: ${branchName}\n\nThis PR was created automatically by iloom.`
let prBody: string
if (input.type === 'issue') {
const issueBody = issueData?.body ? `\n\n## ${issueData.title}\n\n${issueData.body}` : ''
prBody = `Fixes ${prManager.issuePrefix}${input.identifier}${issueBody}\n\n---\n*This PR was created automatically by iloom.*`
} else {
prBody = `Branch: ${branchName}\n\n---\n*This PR was created automatically by iloom.*`
}

// Create draft PR
getLogger().info('Creating draft PR...')
Expand Down
2 changes: 1 addition & 1 deletion src/lib/PRManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class PRManager {
/**
* Get the issue prefix from the configured provider
*/
private get issuePrefix(): string {
public get issuePrefix(): string {
const providerType = this.settings.issueManagement?.provider ?? 'github'
const provider = IssueManagementProviderFactory.create(providerType)
return provider.issuePrefix
Expand Down