@@ -179,18 +179,23 @@ IMPORTANT CONSTRAINTS
179179
180180WHEN YOU ARE DONE
181181-----------------
182- Edit the file "automated_updates_data.json" in ${ REPO_ROOT } / and add a new
183- entry at the END of the "last_improved_things" array with this format:
182+ 1. Edit the file "automated_updates_data.json" in ${ REPO_ROOT } / and add a new
183+ entry at the END of the "last_improved_things" array with this format:
184184
185- { "date": "${ today } ", "summary": "<one-line description of what you improved>" }
185+ { "date": "${ today } ", "summary": "<one-line description of what you improved>" }
186186
187- For example, the file might look like:
188- {
189- "last_automated_updates_commit": null,
190- "last_improved_things": [
191- { "date": "${ today } ", "summary": "Improved objects/sprite/index.md — clarified animation looping behaviour" }
192- ]
193- }
187+ For example, the file might look like:
188+ {
189+ "last_automated_updates_commit": null,
190+ "last_improved_things": [
191+ { "date": "${ today } ", "summary": "Improved objects/sprite/index.md — clarified animation looping behaviour" }
192+ ]
193+ }
194+
195+ 2. Create a file at /tmp/ai_pr_title.txt containing ONLY a single line of
196+ 10–15 words that summarises the changes you made. This will be used as the
197+ pull-request title. Prefix it with "[Auto] [Improve]".
198+ Example: [Auto] [Improve] Clarified sprite animation looping and added missing tween parameters
194199
195200Make your changes now.` ;
196201}
@@ -204,17 +209,24 @@ function invokeAI(promptFile, cwd) {
204209
205210 if ( AI_PROVIDER === "claude" ) {
206211 // ── Claude Code ──────────────────────────────────────────────────────
207- cmd = `cat "${ promptFile } " | claude -p --dangerously-skip-permissions` ;
212+ cmd = `cat "${ promptFile } " | claude -p --verbose -- dangerously-skip-permissions 2>&1 ` ;
208213 // ── To use Codex instead, comment the block above and uncomment below.
209214 } else if ( AI_PROVIDER === "codex" ) {
210215 // ── OpenAI Codex ─────────────────────────────────────────────────────
211- cmd = `codex --full-auto -q "$(cat '${ promptFile } ')"` ;
216+ cmd = `codex --full-auto -q "$(cat '${ promptFile } ')" 2>&1 ` ;
212217 opts . shell = "/bin/bash" ;
213218 } else {
214219 throw new Error ( `Unknown AI_PROVIDER: "${ AI_PROVIDER } ". Use "claude" or "codex".` ) ;
215220 }
216221
217- const output = execSync ( cmd , { ...opts , encoding : "utf8" , stdio : [ "pipe" , "pipe" , "pipe" ] } ) ;
222+ let output ;
223+ try {
224+ output = execSync ( cmd , { ...opts , encoding : "utf8" , stdio : [ "pipe" , "pipe" , "pipe" ] } ) ;
225+ } catch ( err ) {
226+ console . error ( `AI command exited with code ${ err . status } ` ) ;
227+ output = ( err . stdout || "" ) + ( err . stderr || "" ) ;
228+ }
229+
218230 console . log ( "── AI agent output ─────────────────────────────────────────" ) ;
219231 console . log ( output ) ;
220232 console . log ( "── End of AI agent output ──────────────────────────────────" ) ;
0 commit comments