11import type { Workflow } from "./types" ;
22import type { IssueProvider } from "../providers/types" ;
33import type { Issue , WorkflowContext } from "../types" ;
4- import { log , logDebug , logWorkflow , logPrdEntryCount } from "../logger" ;
4+ import { logDebug , logWorkflow , logPrdEntryCount } from "../logger" ;
55import { ensureMainBranch , checkoutBranch , pushBranch } from "../git" ;
66import { createGitHubClient , getRepoInfo } from "../github/client" ;
7- import { createPr , postPrComment } from "../github/pr" ;
7+ import { createPr , postPrComment , findPrByBranch } from "../github/pr" ;
88import { readPrompt } from "../prompts" ;
99import { ClaudeCliRunner } from "../ai-runner" ;
1010import { join } from "node:path" ;
@@ -29,13 +29,13 @@ export class NewFeatureWorkflow implements Workflow {
2929 return null ;
3030 }
3131
32- log ( `[new-feature] Found ${ count } Todo issues to implement` ) ;
33- log ( `[new-feature] Found Todo issue: ${ issues [ 0 ] . identifier } ` ) ;
32+ logWorkflow ( "new-feature" , `[new-feature] Found ${ count } Todo issues to implement` ) ;
33+ logWorkflow ( "new-feature" , `[new-feature] Found Todo issue: ${ issues [ 0 ] . identifier } ` ) ;
3434 return issues [ 0 ] ;
3535 }
3636
3737 async prepare ( ctx : WorkflowContext , issue : Issue ) : Promise < void > {
38- log ( `[new-feature] Preparing new feature workflow for ${ issue . identifier } ` ) ;
38+ logWorkflow ( "new-feature" , `[new-feature] Preparing new feature workflow for ${ issue . identifier } ` ) ;
3939
4040 // Reset to main branch
4141 await ensureMainBranch ( ctx . workDir ) ;
@@ -66,11 +66,11 @@ export class NewFeatureWorkflow implements Workflow {
6666 const claudeMdContent = await readPrompt ( "ralph-claude-md.md" ) ;
6767 await Bun . write ( join ( ctx . ralphDir , "CLAUDE.md" ) , claudeMdContent ) ;
6868
69- log ( `[new-feature] Prepared feature PRD for ${ issue . identifier } ` ) ;
69+ logWorkflow ( "new-feature" , `[new-feature] Prepared feature PRD for ${ issue . identifier } ` ) ;
7070 }
7171
7272 async finalize ( ctx : WorkflowContext , issue : Issue , ralphExitCode : number ) : Promise < void > {
73- log ( `[new-feature] Finalizing new feature for ${ issue . identifier } (exit: ${ ralphExitCode } )` ) ;
73+ logWorkflow ( "new-feature" , `[new-feature] Finalizing new feature for ${ issue . identifier } (exit: ${ ralphExitCode } )` ) ;
7474
7575 const octokit = createGitHubClient ( ) ;
7676 const { owner, repo } = await getRepoInfo ( ctx . workDir ) ;
@@ -95,7 +95,7 @@ export class NewFeatureWorkflow implements Workflow {
9595 `🤖 **eternity-loop bot:** Feature implementation complete.\n\n<details><summary>Progress log</summary>\n\n${ progress } \n\n</details>` ,
9696 ) ;
9797
98- log ( `[new-feature] Created PR ${ pr . url } ` ) ;
98+ logWorkflow ( "new-feature" , `[new-feature] Created PR ${ pr . url } ` ) ;
9999 } else {
100100 // Create draft PR via AI runner
101101 const runner = new ClaudeCliRunner ( ) ;
@@ -108,7 +108,9 @@ export class NewFeatureWorkflow implements Workflow {
108108
109109 await runner . run ( fullPrompt , ctx . workDir ) ;
110110
111- log ( `[new-feature] Created draft PR for ${ issue . identifier } ` ) ;
111+ const draftPr = await findPrByBranch ( octokit , owner , repo , issue . branchName ) ;
112+ const draftUrl = draftPr ? draftPr . url : `https://github.com/${ owner } /${ repo } ` ;
113+ logWorkflow ( "new-feature" , `[new-feature] Created draft PR for ${ issue . identifier } — ${ draftUrl } ` ) ;
112114 }
113115 }
114116}
0 commit comments