rafcode 1.3.2 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (417) hide show
  1. package/.claude/settings.local.json +3 -1
  2. package/CLAUDE.md +118 -22
  3. package/RAF/aaaacu-worktree-weaver/decisions.md +88 -0
  4. package/RAF/aaaacu-worktree-weaver/input.md +27 -0
  5. package/RAF/aaaacu-worktree-weaver/outcomes/01-git-worktree-utilities.md +41 -0
  6. package/RAF/aaaacu-worktree-weaver/outcomes/02-worktree-plan-command.md +44 -0
  7. package/RAF/aaaacu-worktree-weaver/outcomes/03-worktree-do-command.md +58 -0
  8. package/RAF/aaaacu-worktree-weaver/outcomes/04-auto-merge-and-cleanup.md +40 -0
  9. package/RAF/aaaacu-worktree-weaver/outcomes/05-worktree-tests.md +43 -0
  10. package/RAF/aaaacu-worktree-weaver/outcomes/06-update-documentation.md +33 -0
  11. package/RAF/aaaacu-worktree-weaver/plans/01-git-worktree-utilities.md +51 -0
  12. package/RAF/aaaacu-worktree-weaver/plans/02-worktree-plan-command.md +93 -0
  13. package/RAF/aaaacu-worktree-weaver/plans/03-worktree-do-command.md +81 -0
  14. package/RAF/aaaacu-worktree-weaver/plans/04-auto-merge-and-cleanup.md +51 -0
  15. package/RAF/aaaacu-worktree-weaver/plans/05-worktree-tests.md +52 -0
  16. package/RAF/aaaacu-worktree-weaver/plans/06-update-documentation.md +55 -0
  17. package/RAF/aaaacv-trim-the-fat/decisions.md +34 -0
  18. package/RAF/aaaacv-trim-the-fat/input.md +5 -0
  19. package/RAF/aaaacv-trim-the-fat/outcomes/01-add-worktree-support-to-status.md +43 -0
  20. package/RAF/aaaacv-trim-the-fat/outcomes/02-remove-multi-project-from-do.md +50 -0
  21. package/RAF/aaaacv-trim-the-fat/outcomes/03-commit-artifacts-on-amend.md +35 -0
  22. package/RAF/aaaacv-trim-the-fat/outcomes/04-worktree-aware-exit-messages.md +36 -0
  23. package/RAF/aaaacv-trim-the-fat/plans/01-add-worktree-support-to-status.md +43 -0
  24. package/RAF/aaaacv-trim-the-fat/plans/02-remove-multi-project-from-do.md +44 -0
  25. package/RAF/aaaacv-trim-the-fat/plans/03-commit-artifacts-on-amend.md +38 -0
  26. package/RAF/aaaacv-trim-the-fat/plans/04-worktree-aware-exit-messages.md +38 -0
  27. package/RAF/aaaacw-prune-cycle/decisions.md +25 -0
  28. package/RAF/aaaacw-prune-cycle/input.md +5 -0
  29. package/RAF/aaaacw-prune-cycle/outcomes/01-create-worktree-from-branch.md +32 -0
  30. package/RAF/aaaacw-prune-cycle/outcomes/02-cleanup-worktree-on-success.md +33 -0
  31. package/RAF/aaaacw-prune-cycle/outcomes/03-amend-recreate-worktree.md +40 -0
  32. package/RAF/aaaacw-prune-cycle/plans/01-create-worktree-from-branch.md +31 -0
  33. package/RAF/aaaacw-prune-cycle/plans/02-cleanup-worktree-on-success.md +38 -0
  34. package/RAF/aaaacw-prune-cycle/plans/03-amend-recreate-worktree.md +50 -0
  35. package/RAF/aaaacx-epoch-shift/decisions.md +25 -0
  36. package/RAF/aaaacx-epoch-shift/input.md +1 -0
  37. package/RAF/aaaacx-epoch-shift/outcomes/01-epoch-id-generation.md +34 -0
  38. package/RAF/aaaacx-epoch-shift/outcomes/02-update-pattern-matching.md +32 -0
  39. package/RAF/aaaacx-epoch-shift/outcomes/03-update-tests.md +59 -0
  40. package/RAF/aaaacx-epoch-shift/outcomes/04-update-documentation.md +30 -0
  41. package/RAF/aaaacx-epoch-shift/plans/01-epoch-id-generation.md +40 -0
  42. package/RAF/aaaacx-epoch-shift/plans/02-update-pattern-matching.md +60 -0
  43. package/RAF/aaaacx-epoch-shift/plans/03-update-tests.md +48 -0
  44. package/RAF/aaaacx-epoch-shift/plans/04-update-documentation.md +44 -0
  45. package/RAF/ahmpro-merge-guardian/decisions.md +25 -0
  46. package/RAF/ahmpro-merge-guardian/input.md +4 -0
  47. package/RAF/ahmpro-merge-guardian/outcomes/001-fix-amend-worktree-commit.md +45 -0
  48. package/RAF/ahmpro-merge-guardian/outcomes/002-base36-task-ids.md +55 -0
  49. package/RAF/ahmpro-merge-guardian/outcomes/003-worktree-pr-creation.md +41 -0
  50. package/RAF/ahmpro-merge-guardian/outcomes/004-post-execution-picker.md +53 -0
  51. package/RAF/ahmpro-merge-guardian/plans/001-fix-amend-worktree-commit.md +39 -0
  52. package/RAF/ahmpro-merge-guardian/plans/002-base36-task-ids.md +43 -0
  53. package/RAF/ahmpro-merge-guardian/plans/003-worktree-pr-creation.md +43 -0
  54. package/RAF/ahmpro-merge-guardian/plans/004-post-execution-picker.md +51 -0
  55. package/RAF/ahnbcu-letterjam/decisions.md +13 -0
  56. package/RAF/ahnbcu-letterjam/input.md +3 -0
  57. package/RAF/ahnbcu-letterjam/outcomes/01-base26-encoding.md +42 -0
  58. package/RAF/ahnbcu-letterjam/outcomes/02-update-tests.md +38 -0
  59. package/RAF/ahnbcu-letterjam/outcomes/03-migrate-command.md +51 -0
  60. package/RAF/ahnbcu-letterjam/outcomes/04-update-documentation.md +29 -0
  61. package/RAF/ahnbcu-letterjam/plans/01-base26-encoding.md +36 -0
  62. package/RAF/ahnbcu-letterjam/plans/02-update-tests.md +37 -0
  63. package/RAF/ahnbcu-letterjam/plans/03-migrate-command.md +49 -0
  64. package/RAF/ahnbcu-letterjam/plans/04-update-documentation.md +39 -0
  65. package/RAF/ahnwrk-worktree-weaver/decisions.md +19 -0
  66. package/RAF/ahnwrk-worktree-weaver/input.md +4 -0
  67. package/RAF/ahnwrk-worktree-weaver/outcomes/01-remove-co-authored-by.md +20 -0
  68. package/RAF/ahnwrk-worktree-weaver/outcomes/02-update-task-status-format.md +21 -0
  69. package/RAF/ahnwrk-worktree-weaver/outcomes/03-worktree-auto-discovery.md +34 -0
  70. package/RAF/ahnwrk-worktree-weaver/outcomes/04-fix-pr-description.md +30 -0
  71. package/RAF/ahnwrk-worktree-weaver/plans/01-remove-co-authored-by.md +26 -0
  72. package/RAF/ahnwrk-worktree-weaver/plans/02-update-task-status-format.md +27 -0
  73. package/RAF/ahnwrk-worktree-weaver/plans/03-worktree-auto-discovery.md +37 -0
  74. package/RAF/ahnwrk-worktree-weaver/plans/04-fix-pr-description.md +50 -0
  75. package/RAF/ahrren-turbo-finder/decisions.md +19 -0
  76. package/RAF/ahrren-turbo-finder/input.md +2 -0
  77. package/RAF/ahrren-turbo-finder/outcomes/01-worktree-auto-detect.md +40 -0
  78. package/RAF/ahrren-turbo-finder/outcomes/02-medium-effort-do.md +34 -0
  79. package/RAF/ahrren-turbo-finder/plans/01-worktree-auto-detect.md +44 -0
  80. package/RAF/ahrren-turbo-finder/plans/02-medium-effort-do.md +39 -0
  81. package/RAF/ahrtxf-session-sentinel/decisions.md +19 -0
  82. package/RAF/ahrtxf-session-sentinel/input.md +1 -0
  83. package/RAF/ahrtxf-session-sentinel/outcomes/01-capture-session-id.md +37 -0
  84. package/RAF/ahrtxf-session-sentinel/outcomes/02-resume-flag.md +45 -0
  85. package/RAF/ahrtxf-session-sentinel/plans/01-capture-session-id.md +41 -0
  86. package/RAF/ahrtxf-session-sentinel/plans/02-resume-flag.md +51 -0
  87. package/README.md +56 -10
  88. package/dist/commands/do.d.ts +15 -0
  89. package/dist/commands/do.d.ts.map +1 -1
  90. package/dist/commands/do.js +431 -129
  91. package/dist/commands/do.js.map +1 -1
  92. package/dist/commands/migrate.d.ts +14 -0
  93. package/dist/commands/migrate.d.ts.map +1 -0
  94. package/dist/commands/migrate.js +228 -0
  95. package/dist/commands/migrate.js.map +1 -0
  96. package/dist/commands/plan.d.ts.map +1 -1
  97. package/dist/commands/plan.js +237 -40
  98. package/dist/commands/plan.js.map +1 -1
  99. package/dist/commands/status.d.ts.map +1 -1
  100. package/dist/commands/status.js +221 -47
  101. package/dist/commands/status.js.map +1 -1
  102. package/dist/core/claude-runner.d.ts +21 -2
  103. package/dist/core/claude-runner.d.ts.map +1 -1
  104. package/dist/core/claude-runner.js +199 -29
  105. package/dist/core/claude-runner.js.map +1 -1
  106. package/dist/core/git.d.ts +15 -6
  107. package/dist/core/git.d.ts.map +1 -1
  108. package/dist/core/git.js +53 -20
  109. package/dist/core/git.js.map +1 -1
  110. package/dist/core/project-manager.d.ts.map +1 -1
  111. package/dist/core/project-manager.js +2 -2
  112. package/dist/core/project-manager.js.map +1 -1
  113. package/dist/core/pull-request.d.ts +84 -0
  114. package/dist/core/pull-request.d.ts.map +1 -0
  115. package/dist/core/pull-request.js +414 -0
  116. package/dist/core/pull-request.js.map +1 -0
  117. package/dist/core/shutdown-handler.d.ts.map +1 -1
  118. package/dist/core/shutdown-handler.js +4 -0
  119. package/dist/core/shutdown-handler.js.map +1 -1
  120. package/dist/core/state-derivation.d.ts +3 -3
  121. package/dist/core/state-derivation.d.ts.map +1 -1
  122. package/dist/core/state-derivation.js +18 -14
  123. package/dist/core/state-derivation.js.map +1 -1
  124. package/dist/core/worktree.d.ts +138 -0
  125. package/dist/core/worktree.d.ts.map +1 -0
  126. package/dist/core/worktree.js +383 -0
  127. package/dist/core/worktree.js.map +1 -0
  128. package/dist/index.js +2 -0
  129. package/dist/index.js.map +1 -1
  130. package/dist/parsers/stream-renderer.d.ts +3 -0
  131. package/dist/parsers/stream-renderer.d.ts.map +1 -1
  132. package/dist/parsers/stream-renderer.js +1 -1
  133. package/dist/parsers/stream-renderer.js.map +1 -1
  134. package/dist/prompts/amend.d.ts +1 -0
  135. package/dist/prompts/amend.d.ts.map +1 -1
  136. package/dist/prompts/amend.js +14 -10
  137. package/dist/prompts/amend.js.map +1 -1
  138. package/dist/prompts/execution.d.ts.map +1 -1
  139. package/dist/prompts/execution.js +4 -2
  140. package/dist/prompts/execution.js.map +1 -1
  141. package/dist/prompts/planning.d.ts +1 -0
  142. package/dist/prompts/planning.d.ts.map +1 -1
  143. package/dist/prompts/planning.js +9 -8
  144. package/dist/prompts/planning.js.map +1 -1
  145. package/dist/types/config.d.ts +6 -0
  146. package/dist/types/config.d.ts.map +1 -1
  147. package/dist/ui/project-picker.d.ts +34 -3
  148. package/dist/ui/project-picker.d.ts.map +1 -1
  149. package/dist/ui/project-picker.js +78 -10
  150. package/dist/ui/project-picker.js.map +1 -1
  151. package/dist/utils/paths.d.ts +38 -43
  152. package/dist/utils/paths.d.ts.map +1 -1
  153. package/dist/utils/paths.js +123 -193
  154. package/dist/utils/paths.js.map +1 -1
  155. package/dist/utils/terminal-symbols.d.ts +2 -2
  156. package/dist/utils/terminal-symbols.js +3 -3
  157. package/dist/utils/terminal-symbols.js.map +1 -1
  158. package/dist/utils/validation.d.ts.map +1 -1
  159. package/dist/utils/validation.js +2 -8
  160. package/dist/utils/validation.js.map +1 -1
  161. package/package.json +1 -1
  162. package/src/commands/do.ts +505 -139
  163. package/src/commands/migrate.ts +269 -0
  164. package/src/commands/plan.ts +264 -40
  165. package/src/commands/status.ts +252 -45
  166. package/src/core/claude-runner.ts +246 -33
  167. package/src/core/git.ts +57 -21
  168. package/src/core/project-manager.ts +2 -1
  169. package/src/core/pull-request.ts +480 -0
  170. package/src/core/shutdown-handler.ts +5 -0
  171. package/src/core/state-derivation.ts +18 -14
  172. package/src/core/worktree.ts +434 -0
  173. package/src/index.ts +2 -0
  174. package/src/parsers/stream-renderer.ts +4 -1
  175. package/src/prompts/amend.ts +15 -9
  176. package/src/prompts/execution.ts +4 -2
  177. package/src/prompts/planning.ts +10 -8
  178. package/src/types/config.ts +7 -0
  179. package/src/ui/project-picker.ts +110 -10
  180. package/src/utils/paths.ts +129 -214
  181. package/src/utils/terminal-symbols.ts +3 -3
  182. package/src/utils/validation.ts +2 -9
  183. package/tests/unit/amend-prompt.test.ts +85 -0
  184. package/tests/unit/claude-runner-interactive.test.ts +24 -0
  185. package/tests/unit/claude-runner.test.ts +518 -64
  186. package/tests/unit/commit-planning-artifacts-worktree.test.ts +327 -0
  187. package/tests/unit/commit-planning-artifacts.test.ts +303 -35
  188. package/tests/unit/dependency-integration.test.ts +95 -95
  189. package/tests/unit/do-blocked-tasks.test.ts +53 -53
  190. package/tests/unit/do-command.test.ts +39 -132
  191. package/tests/unit/do-rerun.test.ts +65 -65
  192. package/tests/unit/do-worktree-cleanup.test.ts +151 -0
  193. package/tests/unit/execution-prompt.test.ts +71 -60
  194. package/tests/unit/failure-history.test.ts +19 -19
  195. package/tests/unit/git-commit-helpers.test.ts +5 -5
  196. package/tests/unit/git-stash.test.ts +4 -4
  197. package/tests/unit/migrate-command.test.ts +197 -0
  198. package/tests/unit/outcome-content.test.ts +20 -20
  199. package/tests/unit/paths.test.ts +269 -467
  200. package/tests/unit/plan-amend-worktree-recreate.test.ts +246 -0
  201. package/tests/unit/plan-command.test.ts +103 -103
  202. package/tests/unit/planning-prompt.test.ts +41 -4
  203. package/tests/unit/post-execution-picker.test.ts +252 -0
  204. package/tests/unit/project-manager.test.ts +20 -8
  205. package/tests/unit/project-picker.test.ts +425 -42
  206. package/tests/unit/pull-request.test.ts +852 -0
  207. package/tests/unit/state-derivation.test.ts +138 -137
  208. package/tests/unit/status-command.test.ts +344 -76
  209. package/tests/unit/stream-renderer.test.ts +30 -0
  210. package/tests/unit/terminal-symbols.test.ts +4 -4
  211. package/tests/unit/worktree-integration.test.ts +405 -0
  212. package/tests/unit/worktree.test.ts +625 -0
  213. package/tests/unit/do-multiproject.test.ts +0 -270
  214. /package/RAF/{001-raf-task-improvements → aaaaab-raf-task-improvements}/input.md +0 -0
  215. /package/RAF/{001-raf-task-improvements/outcomes/001-add-decisions-folder.md → aaaaab-raf-task-improvements/outcomes/01-add-decisions-folder.md} +0 -0
  216. /package/RAF/{001-raf-task-improvements/outcomes/002-fix-write-error-on-shutdown.md → aaaaab-raf-task-improvements/outcomes/02-fix-write-error-on-shutdown.md} +0 -0
  217. /package/RAF/{001-raf-task-improvements/outcomes/003-stash-changes-on-failure.md → aaaaab-raf-task-improvements/outcomes/03-stash-changes-on-failure.md} +0 -0
  218. /package/RAF/{001-raf-task-improvements/outcomes/004-add-project-name-to-commits.md → aaaaab-raf-task-improvements/outcomes/04-add-project-name-to-commits.md} +0 -0
  219. /package/RAF/{001-raf-task-improvements/outcomes/005-add-running-time-display.md → aaaaab-raf-task-improvements/outcomes/05-add-running-time-display.md} +0 -0
  220. /package/RAF/{001-raf-task-improvements/outcomes/006-add-task-name-to-logs.md → aaaaab-raf-task-improvements/outcomes/06-add-task-name-to-logs.md} +0 -0
  221. /package/RAF/{001-raf-task-improvements/outcomes/007-show-model-at-task-start.md → aaaaab-raf-task-improvements/outcomes/07-show-model-at-task-start.md} +0 -0
  222. /package/RAF/{001-raf-task-improvements/outcomes/009-remove-editor-placeholder-text.md → aaaaab-raf-task-improvements/outcomes/09-remove-editor-placeholder-text.md} +0 -0
  223. /package/RAF/{001-raf-task-improvements → aaaaab-raf-task-improvements}/outcomes/SUMMARY.md +0 -0
  224. /package/RAF/{001-raf-task-improvements/plans/001-add-decisions-folder.md → aaaaab-raf-task-improvements/plans/01-add-decisions-folder.md} +0 -0
  225. /package/RAF/{001-raf-task-improvements/plans/002-fix-write-error-on-shutdown.md → aaaaab-raf-task-improvements/plans/02-fix-write-error-on-shutdown.md} +0 -0
  226. /package/RAF/{001-raf-task-improvements/plans/003-stash-changes-on-failure.md → aaaaab-raf-task-improvements/plans/03-stash-changes-on-failure.md} +0 -0
  227. /package/RAF/{001-raf-task-improvements/plans/004-add-project-name-to-commits.md → aaaaab-raf-task-improvements/plans/04-add-project-name-to-commits.md} +0 -0
  228. /package/RAF/{001-raf-task-improvements/plans/005-add-running-time-display.md → aaaaab-raf-task-improvements/plans/05-add-running-time-display.md} +0 -0
  229. /package/RAF/{001-raf-task-improvements/plans/006-add-task-name-to-logs.md → aaaaab-raf-task-improvements/plans/06-add-task-name-to-logs.md} +0 -0
  230. /package/RAF/{001-raf-task-improvements/plans/009-remove-editor-placeholder-text.md → aaaaab-raf-task-improvements/plans/09-remove-editor-placeholder-text.md} +0 -0
  231. /package/RAF/{002-raf-task-improvements-execution → aaaaac-raf-task-improvements-execution}/decisions/DECISIONS.md +0 -0
  232. /package/RAF/{002-raf-task-improvements-execution → aaaaac-raf-task-improvements-execution}/input.md +0 -0
  233. /package/RAF/{002-raf-task-improvements-execution/outcomes/001-commit-show-model-at-task-start.md → aaaaac-raf-task-improvements-execution/outcomes/01-commit-show-model-at-task-start.md} +0 -0
  234. /package/RAF/{002-raf-task-improvements-execution/outcomes/002-delete-skipped-plan.md → aaaaac-raf-task-improvements-execution/outcomes/02-delete-skipped-plan.md} +0 -0
  235. /package/RAF/{002-raf-task-improvements-execution → aaaaac-raf-task-improvements-execution}/outcomes/SUMMARY.md +0 -0
  236. /package/RAF/{002-raf-task-improvements-execution/plans/001-commit-show-model-at-task-start.md → aaaaac-raf-task-improvements-execution/plans/01-commit-show-model-at-task-start.md} +0 -0
  237. /package/RAF/{002-raf-task-improvements-execution/plans/002-delete-skipped-plan.md → aaaaac-raf-task-improvements-execution/plans/02-delete-skipped-plan.md} +0 -0
  238. /package/RAF/{003-multi-project-execution → aaaaad-multi-project-execution}/decisions/DECISIONS.md +0 -0
  239. /package/RAF/{003-multi-project-execution → aaaaad-multi-project-execution}/input.md +0 -0
  240. /package/RAF/{003-multi-project-execution/outcomes/001-remove-state-json.md → aaaaad-multi-project-execution/outcomes/01-remove-state-json.md} +0 -0
  241. /package/RAF/{003-multi-project-execution/outcomes/002-update-raf-status.md → aaaaad-multi-project-execution/outcomes/02-update-raf-status.md} +0 -0
  242. /package/RAF/{003-multi-project-execution/outcomes/003-simplify-git-logic.md → aaaaad-multi-project-execution/outcomes/03-simplify-git-logic.md} +0 -0
  243. /package/RAF/{003-multi-project-execution/outcomes/004-auto-commit-planning.md → aaaaad-multi-project-execution/outcomes/04-auto-commit-planning.md} +0 -0
  244. /package/RAF/{003-multi-project-execution/outcomes/005-rerun-failed-tasks.md → aaaaad-multi-project-execution/outcomes/05-rerun-failed-tasks.md} +0 -0
  245. /package/RAF/{003-multi-project-execution/outcomes/006-multi-project-execution.md → aaaaad-multi-project-execution/outcomes/06-multi-project-execution.md} +0 -0
  246. /package/RAF/{003-multi-project-execution/outcomes/007-verify-timeout.md → aaaaad-multi-project-execution/outcomes/07-verify-timeout.md} +0 -0
  247. /package/RAF/{003-multi-project-execution/outcomes/008-move-decisions-file.md → aaaaad-multi-project-execution/outcomes/08-move-decisions-file.md} +0 -0
  248. /package/RAF/{003-multi-project-execution → aaaaad-multi-project-execution}/outcomes/SUMMARY.md +0 -0
  249. /package/RAF/{003-multi-project-execution/plans/001-remove-state-json.md → aaaaad-multi-project-execution/plans/01-remove-state-json.md} +0 -0
  250. /package/RAF/{003-multi-project-execution/plans/002-update-raf-status.md → aaaaad-multi-project-execution/plans/02-update-raf-status.md} +0 -0
  251. /package/RAF/{003-multi-project-execution/plans/003-simplify-git-logic.md → aaaaad-multi-project-execution/plans/03-simplify-git-logic.md} +0 -0
  252. /package/RAF/{003-multi-project-execution/plans/004-auto-commit-planning.md → aaaaad-multi-project-execution/plans/04-auto-commit-planning.md} +0 -0
  253. /package/RAF/{003-multi-project-execution/plans/005-rerun-failed-tasks.md → aaaaad-multi-project-execution/plans/05-rerun-failed-tasks.md} +0 -0
  254. /package/RAF/{003-multi-project-execution/plans/006-multi-project-execution.md → aaaaad-multi-project-execution/plans/06-multi-project-execution.md} +0 -0
  255. /package/RAF/{003-multi-project-execution/plans/007-verify-timeout.md → aaaaad-multi-project-execution/plans/07-verify-timeout.md} +0 -0
  256. /package/RAF/{003-multi-project-execution/plans/008-move-decisions-file.md → aaaaad-multi-project-execution/plans/08-move-decisions-file.md} +0 -0
  257. /package/RAF/{004-task-naming-optimization → aaaaae-task-naming-optimization}/decisions.md +0 -0
  258. /package/RAF/{004-task-naming-optimization → aaaaae-task-naming-optimization}/input.md +0 -0
  259. /package/RAF/{004-task-naming-optimization/outcomes/001-remove-summary-file.md → aaaaae-task-naming-optimization/outcomes/01-remove-summary-file.md} +0 -0
  260. /package/RAF/{004-task-naming-optimization/outcomes/002-base36-project-numbering.md → aaaaae-task-naming-optimization/outcomes/02-base36-project-numbering.md} +0 -0
  261. /package/RAF/{004-task-naming-optimization/outcomes/003-improve-haiku-prompt.md → aaaaae-task-naming-optimization/outcomes/03-improve-haiku-prompt.md} +0 -0
  262. /package/RAF/{004-task-naming-optimization → aaaaae-task-naming-optimization}/outcomes/SUMMARY.md +0 -0
  263. /package/RAF/{004-task-naming-optimization/plans/001-remove-summary-file.md → aaaaae-task-naming-optimization/plans/01-remove-summary-file.md} +0 -0
  264. /package/RAF/{004-task-naming-optimization/plans/002-base36-project-numbering.md → aaaaae-task-naming-optimization/plans/02-base36-project-numbering.md} +0 -0
  265. /package/RAF/{004-task-naming-optimization/plans/003-improve-haiku-prompt.md → aaaaae-task-naming-optimization/plans/03-improve-haiku-prompt.md} +0 -0
  266. /package/RAF/{005-task-naming-improvements → aaaaaf-task-naming-improvements}/decisions.md +0 -0
  267. /package/RAF/{005-task-naming-improvements → aaaaaf-task-naming-improvements}/input.md +0 -0
  268. /package/RAF/{005-task-naming-improvements/outcomes/001-enhance-identifier-resolution.md → aaaaaf-task-naming-improvements/outcomes/01-enhance-identifier-resolution.md} +0 -0
  269. /package/RAF/{005-task-naming-improvements/outcomes/002-add-identifier-support-to-status.md → aaaaaf-task-naming-improvements/outcomes/02-add-identifier-support-to-status.md} +0 -0
  270. /package/RAF/{005-task-naming-improvements/outcomes/003-update-do-for-full-folder-names.md → aaaaaf-task-naming-improvements/outcomes/03-update-do-for-full-folder-names.md} +0 -0
  271. /package/RAF/{005-task-naming-improvements/outcomes/004-implement-amend-flag-for-plan.md → aaaaaf-task-naming-improvements/outcomes/04-implement-amend-flag-for-plan.md} +0 -0
  272. /package/RAF/{005-task-naming-improvements/outcomes/005-commit-outcomes-on-complete.md → aaaaaf-task-naming-improvements/outcomes/05-commit-outcomes-on-complete.md} +0 -0
  273. /package/RAF/{005-task-naming-improvements/outcomes/006-update-execution-prompt-commit-schema.md → aaaaaf-task-naming-improvements/outcomes/06-update-execution-prompt-commit-schema.md} +0 -0
  274. /package/RAF/{005-task-naming-improvements/outcomes/007-allow-pending-task-amendments.md → aaaaaf-task-naming-improvements/outcomes/07-allow-pending-task-amendments.md} +0 -0
  275. /package/RAF/{005-task-naming-improvements/outcomes/008-fix-timeout-label.md → aaaaaf-task-naming-improvements/outcomes/08-fix-timeout-label.md} +0 -0
  276. /package/RAF/{005-task-naming-improvements/plans/001-enhance-identifier-resolution.md → aaaaaf-task-naming-improvements/plans/01-enhance-identifier-resolution.md} +0 -0
  277. /package/RAF/{005-task-naming-improvements/plans/002-add-identifier-support-to-status.md → aaaaaf-task-naming-improvements/plans/02-add-identifier-support-to-status.md} +0 -0
  278. /package/RAF/{005-task-naming-improvements/plans/003-update-do-for-full-folder-names.md → aaaaaf-task-naming-improvements/plans/03-update-do-for-full-folder-names.md} +0 -0
  279. /package/RAF/{005-task-naming-improvements/plans/004-implement-amend-flag-for-plan.md → aaaaaf-task-naming-improvements/plans/04-implement-amend-flag-for-plan.md} +0 -0
  280. /package/RAF/{005-task-naming-improvements/plans/005-commit-outcomes-on-complete.md → aaaaaf-task-naming-improvements/plans/05-commit-outcomes-on-complete.md} +0 -0
  281. /package/RAF/{005-task-naming-improvements/plans/006-update-execution-prompt-commit-schema.md → aaaaaf-task-naming-improvements/plans/06-update-execution-prompt-commit-schema.md} +0 -0
  282. /package/RAF/{005-task-naming-improvements/plans/007-allow-pending-task-amendments.md → aaaaaf-task-naming-improvements/plans/07-allow-pending-task-amendments.md} +0 -0
  283. /package/RAF/{005-task-naming-improvements/plans/008-fix-timeout-label.md → aaaaaf-task-naming-improvements/plans/08-fix-timeout-label.md} +0 -0
  284. /package/RAF/{006-fix-double-summary-headers → aaaaag-fix-double-summary-headers}/decisions.md +0 -0
  285. /package/RAF/{006-fix-double-summary-headers → aaaaag-fix-double-summary-headers}/input.md +0 -0
  286. /package/RAF/{006-fix-double-summary-headers/outcomes/001-fix-double-summary-headers.md → aaaaag-fix-double-summary-headers/outcomes/01-fix-double-summary-headers.md} +0 -0
  287. /package/RAF/{006-fix-double-summary-headers/outcomes/002-update-readme-for-npm.md → aaaaag-fix-double-summary-headers/outcomes/02-update-readme-for-npm.md} +0 -0
  288. /package/RAF/{006-fix-double-summary-headers/outcomes/003-npm-publish-instructions.md → aaaaag-fix-double-summary-headers/outcomes/03-npm-publish-instructions.md} +0 -0
  289. /package/RAF/{006-fix-double-summary-headers/outcomes/004-flexible-project-lookup.md → aaaaag-fix-double-summary-headers/outcomes/04-flexible-project-lookup.md} +0 -0
  290. /package/RAF/{006-fix-double-summary-headers/plans/001-fix-double-summary-headers.md → aaaaag-fix-double-summary-headers/plans/01-fix-double-summary-headers.md} +0 -0
  291. /package/RAF/{006-fix-double-summary-headers/plans/002-update-readme-for-npm.md → aaaaag-fix-double-summary-headers/plans/02-update-readme-for-npm.md} +0 -0
  292. /package/RAF/{006-fix-double-summary-headers/plans/003-npm-publish-instructions.md → aaaaag-fix-double-summary-headers/plans/03-npm-publish-instructions.md} +0 -0
  293. /package/RAF/{006-fix-double-summary-headers/plans/004-flexible-project-lookup.md → aaaaag-fix-double-summary-headers/plans/04-flexible-project-lookup.md} +0 -0
  294. /package/RAF/{007-improve-outcome-format → aaaaah-improve-outcome-format}/decisions.md +0 -0
  295. /package/RAF/{007-improve-outcome-format → aaaaah-improve-outcome-format}/input.md +0 -0
  296. /package/RAF/{007-improve-outcome-format/outcomes/001-update-execution-prompt.md → aaaaah-improve-outcome-format/outcomes/01-update-execution-prompt.md} +0 -0
  297. /package/RAF/{007-improve-outcome-format/outcomes/002-update-state-derivation.md → aaaaah-improve-outcome-format/outcomes/02-update-state-derivation.md} +0 -0
  298. /package/RAF/{007-improve-outcome-format/outcomes/003-update-do-command-outcome-handling.md → aaaaah-improve-outcome-format/outcomes/03-update-do-command-outcome-handling.md} +0 -0
  299. /package/RAF/{007-improve-outcome-format/outcomes/004-implement-failure-analysis.md → aaaaah-improve-outcome-format/outcomes/04-implement-failure-analysis.md} +0 -0
  300. /package/RAF/{007-improve-outcome-format/outcomes/005-update-documentation.md → aaaaah-improve-outcome-format/outcomes/05-update-documentation.md} +0 -0
  301. /package/RAF/{007-improve-outcome-format/plans/001-update-execution-prompt.md → aaaaah-improve-outcome-format/plans/01-update-execution-prompt.md} +0 -0
  302. /package/RAF/{007-improve-outcome-format/plans/002-update-state-derivation.md → aaaaah-improve-outcome-format/plans/02-update-state-derivation.md} +0 -0
  303. /package/RAF/{007-improve-outcome-format/plans/003-update-do-command-outcome-handling.md → aaaaah-improve-outcome-format/plans/03-update-do-command-outcome-handling.md} +0 -0
  304. /package/RAF/{007-improve-outcome-format/plans/004-implement-failure-analysis.md → aaaaah-improve-outcome-format/plans/04-implement-failure-analysis.md} +0 -0
  305. /package/RAF/{007-improve-outcome-format/plans/005-update-documentation.md → aaaaah-improve-outcome-format/plans/05-update-documentation.md} +0 -0
  306. /package/RAF/{008-beautiful-do → aaaaai-beautiful-do}/decisions.md +0 -0
  307. /package/RAF/{008-beautiful-do → aaaaai-beautiful-do}/input.md +0 -0
  308. /package/RAF/{008-beautiful-do/outcomes/001-terminal-symbols.md → aaaaai-beautiful-do/outcomes/01-terminal-symbols.md} +0 -0
  309. /package/RAF/{008-beautiful-do/outcomes/002-refactor-do-output.md → aaaaai-beautiful-do/outcomes/02-refactor-do-output.md} +0 -0
  310. /package/RAF/{008-beautiful-do/outcomes/003-refactor-status-output.md → aaaaai-beautiful-do/outcomes/03-refactor-status-output.md} +0 -0
  311. /package/RAF/{008-beautiful-do/outcomes/004-simplify-logger.md → aaaaai-beautiful-do/outcomes/04-simplify-logger.md} +0 -0
  312. /package/RAF/{008-beautiful-do/outcomes/005-add-tests.md → aaaaai-beautiful-do/outcomes/05-add-tests.md} +0 -0
  313. /package/RAF/{008-beautiful-do/plans/001-terminal-symbols.md → aaaaai-beautiful-do/plans/01-terminal-symbols.md} +0 -0
  314. /package/RAF/{008-beautiful-do/plans/002-refactor-do-output.md → aaaaai-beautiful-do/plans/02-refactor-do-output.md} +0 -0
  315. /package/RAF/{008-beautiful-do/plans/003-refactor-status-output.md → aaaaai-beautiful-do/plans/03-refactor-status-output.md} +0 -0
  316. /package/RAF/{008-beautiful-do/plans/004-simplify-logger.md → aaaaai-beautiful-do/plans/04-simplify-logger.md} +0 -0
  317. /package/RAF/{008-beautiful-do/plans/005-add-tests.md → aaaaai-beautiful-do/plans/05-add-tests.md} +0 -0
  318. /package/RAF/{009-system-promt-ammend → aaaaaj-system-promt-ammend}/decisions.md +0 -0
  319. /package/RAF/{009-system-promt-ammend → aaaaaj-system-promt-ammend}/input.md +0 -0
  320. /package/RAF/{009-system-promt-ammend/outcomes/001-model-override.md → aaaaaj-system-promt-ammend/outcomes/01-model-override.md} +0 -0
  321. /package/RAF/{009-system-promt-ammend/outcomes/002-system-prompt-append.md → aaaaaj-system-promt-ammend/outcomes/02-system-prompt-append.md} +0 -0
  322. /package/RAF/{009-system-promt-ammend/outcomes/003-retry-context.md → aaaaaj-system-promt-ammend/outcomes/03-retry-context.md} +0 -0
  323. /package/RAF/{009-system-promt-ammend/plans/001-model-override.md → aaaaaj-system-promt-ammend/plans/01-model-override.md} +0 -0
  324. /package/RAF/{009-system-promt-ammend/plans/002-system-prompt-append.md → aaaaaj-system-promt-ammend/plans/02-system-prompt-append.md} +0 -0
  325. /package/RAF/{009-system-promt-ammend/plans/003-retry-context.md → aaaaaj-system-promt-ammend/plans/03-retry-context.md} +0 -0
  326. /package/RAF/{010-outcome-marker-fallback → aaaabk-outcome-marker-fallback}/decisions.md +0 -0
  327. /package/RAF/{010-outcome-marker-fallback → aaaabk-outcome-marker-fallback}/input.md +0 -0
  328. /package/RAF/{010-outcome-marker-fallback/outcomes/001-outcome-file-marker-fallback.md → aaaabk-outcome-marker-fallback/outcomes/01-outcome-file-marker-fallback.md} +0 -0
  329. /package/RAF/{010-outcome-marker-fallback/outcomes/002-creative-project-naming.md → aaaabk-outcome-marker-fallback/outcomes/02-creative-project-naming.md} +0 -0
  330. /package/RAF/{010-outcome-marker-fallback/plans/001-outcome-file-marker-fallback.md → aaaabk-outcome-marker-fallback/plans/01-outcome-file-marker-fallback.md} +0 -0
  331. /package/RAF/{010-outcome-marker-fallback/plans/002-creative-project-naming.md → aaaabk-outcome-marker-fallback/plans/02-creative-project-naming.md} +0 -0
  332. /package/RAF/{011-do-task-in-commit → aaaabl-do-task-in-commit}/decisions.md +0 -0
  333. /package/RAF/{011-do-task-in-commit → aaaabl-do-task-in-commit}/input.md +0 -0
  334. /package/RAF/{011-do-task-in-commit/outcomes/001-update-execution-prompt.md → aaaabl-do-task-in-commit/outcomes/01-update-execution-prompt.md} +0 -0
  335. /package/RAF/{011-do-task-in-commit/outcomes/002-update-tests.md → aaaabl-do-task-in-commit/outcomes/02-update-tests.md} +0 -0
  336. /package/RAF/{011-do-task-in-commit/outcomes/003-update-documentation.md → aaaabl-do-task-in-commit/outcomes/03-update-documentation.md} +0 -0
  337. /package/RAF/{011-do-task-in-commit/plans/001-update-execution-prompt.md → aaaabl-do-task-in-commit/plans/01-update-execution-prompt.md} +0 -0
  338. /package/RAF/{011-do-task-in-commit/plans/002-update-tests.md → aaaabl-do-task-in-commit/plans/02-update-tests.md} +0 -0
  339. /package/RAF/{011-do-task-in-commit/plans/003-update-documentation.md → aaaabl-do-task-in-commit/plans/03-update-documentation.md} +0 -0
  340. /package/RAF/{012-name-picker-buffet → aaaabm-name-picker-buffet}/decisions.md +0 -0
  341. /package/RAF/{012-name-picker-buffet → aaaabm-name-picker-buffet}/input.md +0 -0
  342. /package/RAF/{012-name-picker-buffet/outcomes/001-name-picker-for-raf-plan.md → aaaabm-name-picker-buffet/outcomes/01-name-picker-for-raf-plan.md} +0 -0
  343. /package/RAF/{012-name-picker-buffet/outcomes/002-interactive-project-picker-for-raf-do.md → aaaabm-name-picker-buffet/outcomes/02-interactive-project-picker-for-raf-do.md} +0 -0
  344. /package/RAF/{012-name-picker-buffet/outcomes/003-raf-status-truncation.md → aaaabm-name-picker-buffet/outcomes/03-raf-status-truncation.md} +0 -0
  345. /package/RAF/{012-name-picker-buffet/outcomes/004-failure-reason-details.md → aaaabm-name-picker-buffet/outcomes/04-failure-reason-details.md} +0 -0
  346. /package/RAF/{012-name-picker-buffet/outcomes/005-remove-raf-commits.md → aaaabm-name-picker-buffet/outcomes/05-remove-raf-commits.md} +0 -0
  347. /package/RAF/{012-name-picker-buffet/outcomes/006-update-execution-prompt-for-commits.md → aaaabm-name-picker-buffet/outcomes/06-update-execution-prompt-for-commits.md} +0 -0
  348. /package/RAF/{012-name-picker-buffet/outcomes/007-fix-plan-mode-user-prompt.md → aaaabm-name-picker-buffet/outcomes/07-fix-plan-mode-user-prompt.md} +0 -0
  349. /package/RAF/{012-name-picker-buffet/outcomes/008-add-auto-flag-for-plan-mode.md → aaaabm-name-picker-buffet/outcomes/08-add-auto-flag-for-plan-mode.md} +0 -0
  350. /package/RAF/{012-name-picker-buffet/plans/001-name-picker-for-raf-plan.md → aaaabm-name-picker-buffet/plans/01-name-picker-for-raf-plan.md} +0 -0
  351. /package/RAF/{012-name-picker-buffet/plans/002-interactive-project-picker-for-raf-do.md → aaaabm-name-picker-buffet/plans/02-interactive-project-picker-for-raf-do.md} +0 -0
  352. /package/RAF/{012-name-picker-buffet/plans/003-raf-status-truncation.md → aaaabm-name-picker-buffet/plans/03-raf-status-truncation.md} +0 -0
  353. /package/RAF/{012-name-picker-buffet/plans/004-failure-reason-details.md → aaaabm-name-picker-buffet/plans/04-failure-reason-details.md} +0 -0
  354. /package/RAF/{012-name-picker-buffet/plans/005-remove-raf-commits.md → aaaabm-name-picker-buffet/plans/05-remove-raf-commits.md} +0 -0
  355. /package/RAF/{012-name-picker-buffet/plans/006-update-execution-prompt-for-commits.md → aaaabm-name-picker-buffet/plans/06-update-execution-prompt-for-commits.md} +0 -0
  356. /package/RAF/{012-name-picker-buffet/plans/007-fix-plan-mode-user-prompt.md → aaaabm-name-picker-buffet/plans/07-fix-plan-mode-user-prompt.md} +0 -0
  357. /package/RAF/{012-name-picker-buffet/plans/008-add-auto-flag-for-plan-mode.md → aaaabm-name-picker-buffet/plans/08-add-auto-flag-for-plan-mode.md} +0 -0
  358. /package/RAF/{013-dependencies-watchdog → aaaabn-dependencies-watchdog}/decisions.md +0 -0
  359. /package/RAF/{013-dependencies-watchdog → aaaabn-dependencies-watchdog}/input.md +0 -0
  360. /package/RAF/{013-dependencies-watchdog/outcomes/001-define-dependency-syntax.md → aaaabn-dependencies-watchdog/outcomes/01-define-dependency-syntax.md} +0 -0
  361. /package/RAF/{013-dependencies-watchdog/outcomes/002-update-planning-prompts.md → aaaabn-dependencies-watchdog/outcomes/02-update-planning-prompts.md} +0 -0
  362. /package/RAF/{013-dependencies-watchdog/outcomes/003-parse-dependencies-update-state.md → aaaabn-dependencies-watchdog/outcomes/03-parse-dependencies-update-state.md} +0 -0
  363. /package/RAF/{013-dependencies-watchdog/outcomes/004-implement-dependency-checking-in-do.md → aaaabn-dependencies-watchdog/outcomes/04-implement-dependency-checking-in-do.md} +0 -0
  364. /package/RAF/{013-dependencies-watchdog/outcomes/005-update-execution-prompts.md → aaaabn-dependencies-watchdog/outcomes/05-update-execution-prompts.md} +0 -0
  365. /package/RAF/{013-dependencies-watchdog/outcomes/006-add-tests.md → aaaabn-dependencies-watchdog/outcomes/06-add-tests.md} +0 -0
  366. /package/RAF/{013-dependencies-watchdog/outcomes/007-add-act-alias.md → aaaabn-dependencies-watchdog/outcomes/07-add-act-alias.md} +0 -0
  367. /package/RAF/{013-dependencies-watchdog/outcomes/008-add-exit-message.md → aaaabn-dependencies-watchdog/outcomes/08-add-exit-message.md} +0 -0
  368. /package/RAF/{013-dependencies-watchdog/plans/001-define-dependency-syntax.md → aaaabn-dependencies-watchdog/plans/01-define-dependency-syntax.md} +0 -0
  369. /package/RAF/{013-dependencies-watchdog/plans/002-update-planning-prompts.md → aaaabn-dependencies-watchdog/plans/02-update-planning-prompts.md} +0 -0
  370. /package/RAF/{013-dependencies-watchdog/plans/003-parse-dependencies-update-state.md → aaaabn-dependencies-watchdog/plans/03-parse-dependencies-update-state.md} +0 -0
  371. /package/RAF/{013-dependencies-watchdog/plans/004-implement-dependency-checking-in-do.md → aaaabn-dependencies-watchdog/plans/04-implement-dependency-checking-in-do.md} +0 -0
  372. /package/RAF/{013-dependencies-watchdog/plans/005-update-execution-prompts.md → aaaabn-dependencies-watchdog/plans/05-update-execution-prompts.md} +0 -0
  373. /package/RAF/{013-dependencies-watchdog/plans/006-add-tests.md → aaaabn-dependencies-watchdog/plans/06-add-tests.md} +0 -0
  374. /package/RAF/{013-dependencies-watchdog/plans/007-add-act-alias.md → aaaabn-dependencies-watchdog/plans/07-add-act-alias.md} +0 -0
  375. /package/RAF/{013-dependencies-watchdog/plans/008-add-exit-message.md → aaaabn-dependencies-watchdog/plans/08-add-exit-message.md} +0 -0
  376. /package/RAF/{014-watchdog → aaaabo-watchdog}/decisions.md +0 -0
  377. /package/RAF/{014-watchdog → aaaabo-watchdog}/input.md +0 -0
  378. /package/RAF/{014-watchdog/outcomes/001-amend-flag-position.md → aaaabo-watchdog/outcomes/01-amend-flag-position.md} +0 -0
  379. /package/RAF/{014-watchdog/outcomes/002-details-only-on-failure.md → aaaabo-watchdog/outcomes/02-details-only-on-failure.md} +0 -0
  380. /package/RAF/{014-watchdog/plans/001-amend-flag-position.md → aaaabo-watchdog/plans/01-amend-flag-position.md} +0 -0
  381. /package/RAF/{014-watchdog/plans/002-details-only-on-failure.md → aaaabo-watchdog/plans/02-details-only-on-failure.md} +0 -0
  382. /package/RAF/{015-name-lottery → aaaabp-name-lottery}/decisions.md +0 -0
  383. /package/RAF/{015-name-lottery → aaaabp-name-lottery}/input.md +0 -0
  384. /package/RAF/{015-name-lottery/outcomes/001-auto-pick-project-name.md → aaaabp-name-lottery/outcomes/01-auto-pick-project-name.md} +0 -0
  385. /package/RAF/{015-name-lottery/outcomes/002-mention-plan-files-in-commit.md → aaaabp-name-lottery/outcomes/02-mention-plan-files-in-commit.md} +0 -0
  386. /package/RAF/{015-name-lottery/outcomes/003-fix-input-md-in-amend-flow.md → aaaabp-name-lottery/outcomes/03-fix-input-md-in-amend-flow.md} +0 -0
  387. /package/RAF/{015-name-lottery/plans/001-auto-pick-project-name.md → aaaabp-name-lottery/plans/01-auto-pick-project-name.md} +0 -0
  388. /package/RAF/{015-name-lottery/plans/002-mention-plan-files-in-commit.md → aaaabp-name-lottery/plans/02-mention-plan-files-in-commit.md} +0 -0
  389. /package/RAF/{015-name-lottery/plans/003-fix-input-md-in-amend-flow.md → aaaabp-name-lottery/plans/03-fix-input-md-in-amend-flow.md} +0 -0
  390. /package/RAF/{016-planning-scalpel → aaaabq-planning-scalpel}/decisions.md +0 -0
  391. /package/RAF/{016-planning-scalpel → aaaabq-planning-scalpel}/input.md +0 -0
  392. /package/RAF/{016-planning-scalpel/outcomes/001-update-git-commit-instructions.md → aaaabq-planning-scalpel/outcomes/01-update-git-commit-instructions.md} +0 -0
  393. /package/RAF/{016-planning-scalpel/plans/001-update-git-commit-instructions.md → aaaabq-planning-scalpel/plans/01-update-git-commit-instructions.md} +0 -0
  394. /package/RAF/{017-decision-vault → aaaabr-decision-vault}/decisions.md +0 -0
  395. /package/RAF/{017-decision-vault → aaaabr-decision-vault}/input.md +0 -0
  396. /package/RAF/{017-decision-vault/outcomes/001-create-git-commit-utility.md → aaaabr-decision-vault/outcomes/01-create-git-commit-utility.md} +0 -0
  397. /package/RAF/{017-decision-vault/outcomes/002-integrate-commit-into-plan.md → aaaabr-decision-vault/outcomes/02-integrate-commit-into-plan.md} +0 -0
  398. /package/RAF/{017-decision-vault/outcomes/003-add-tests-for-planning-commit.md → aaaabr-decision-vault/outcomes/03-add-tests-for-planning-commit.md} +0 -0
  399. /package/RAF/{017-decision-vault/plans/001-create-git-commit-utility.md → aaaabr-decision-vault/plans/01-create-git-commit-utility.md} +0 -0
  400. /package/RAF/{017-decision-vault/plans/002-integrate-commit-into-plan.md → aaaabr-decision-vault/plans/02-integrate-commit-into-plan.md} +0 -0
  401. /package/RAF/{017-decision-vault/plans/003-add-tests-for-planning-commit.md → aaaabr-decision-vault/plans/03-add-tests-for-planning-commit.md} +0 -0
  402. /package/RAF/{018-workflow-forge → aaaabs-workflow-forge}/decisions.md +0 -0
  403. /package/RAF/{018-workflow-forge → aaaabs-workflow-forge}/input.md +0 -0
  404. /package/RAF/{018-workflow-forge/outcomes/001-add-task-number-progress.md → aaaabs-workflow-forge/outcomes/01-add-task-number-progress.md} +0 -0
  405. /package/RAF/{018-workflow-forge/outcomes/002-update-plan-do-prompts.md → aaaabs-workflow-forge/outcomes/02-update-plan-do-prompts.md} +0 -0
  406. /package/RAF/{018-workflow-forge/plans/001-add-task-number-progress.md → aaaabs-workflow-forge/plans/01-add-task-number-progress.md} +0 -0
  407. /package/RAF/{018-workflow-forge/plans/002-update-plan-do-prompts.md → aaaabs-workflow-forge/plans/02-update-plan-do-prompts.md} +0 -0
  408. /package/RAF/{019-verbose-chronicle → aaaabt-verbose-chronicle}/decisions.md +0 -0
  409. /package/RAF/{019-verbose-chronicle → aaaabt-verbose-chronicle}/input.md +0 -0
  410. /package/RAF/{019-verbose-chronicle/outcomes/001-amend-iteration-references.md → aaaabt-verbose-chronicle/outcomes/01-amend-iteration-references.md} +0 -0
  411. /package/RAF/{019-verbose-chronicle/outcomes/002-verbose-task-name-display.md → aaaabt-verbose-chronicle/outcomes/02-verbose-task-name-display.md} +0 -0
  412. /package/RAF/{019-verbose-chronicle/outcomes/003-verbose-streaming-fix.md → aaaabt-verbose-chronicle/outcomes/03-verbose-streaming-fix.md} +0 -0
  413. /package/RAF/{019-verbose-chronicle/outcomes/004-commit-verification-before-halt.md → aaaabt-verbose-chronicle/outcomes/04-commit-verification-before-halt.md} +0 -0
  414. /package/RAF/{019-verbose-chronicle/plans/001-amend-iteration-references.md → aaaabt-verbose-chronicle/plans/01-amend-iteration-references.md} +0 -0
  415. /package/RAF/{019-verbose-chronicle/plans/002-verbose-task-name-display.md → aaaabt-verbose-chronicle/plans/02-verbose-task-name-display.md} +0 -0
  416. /package/RAF/{019-verbose-chronicle/plans/003-verbose-streaming-fix.md → aaaabt-verbose-chronicle/plans/03-verbose-streaming-fix.md} +0 -0
  417. /package/RAF/{019-verbose-chronicle/plans/004-commit-verification-before-halt.md → aaaabt-verbose-chronicle/plans/04-commit-verification-before-halt.md} +0 -0
@@ -1,5 +1,7 @@
1
1
  import * as fs from 'node:fs';
2
+ import * as path from 'node:path';
2
3
  import { Command } from 'commander';
4
+ import { select } from '@inquirer/prompts';
3
5
  import { ProjectManager } from '../core/project-manager.js';
4
6
  import { ClaudeRunner } from '../core/claude-runner.js';
5
7
  import { shutdownHandler } from '../core/shutdown-handler.js';
@@ -7,20 +9,21 @@ import { stashChanges, hasUncommittedChanges, isGitRepo, getHeadCommitHash } fro
7
9
  import { getExecutionPrompt } from '../prompts/execution.js';
8
10
  import { parseOutput, isRetryableFailure } from '../parsers/output-parser.js';
9
11
  import { validatePlansExist, resolveModelOption } from '../utils/validation.js';
10
- import { getRafDir, extractProjectNumber, extractProjectName, extractTaskNameFromPlanFile, resolveProjectIdentifierWithDetails, getOutcomeFilePath } from '../utils/paths.js';
11
- import { pickPendingProject, getPendingProjects } from '../ui/project-picker.js';
12
+ import { getRafDir, extractProjectNumber, extractProjectName, extractTaskNameFromPlanFile, resolveProjectIdentifierWithDetails, getOutcomeFilePath, parseProjectPrefix } from '../utils/paths.js';
13
+ import { pickPendingProject, getPendingProjects, getPendingWorktreeProjects } from '../ui/project-picker.js';
14
+ import type { PendingProjectInfo } from '../ui/project-picker.js';
12
15
  import { logger } from '../utils/logger.js';
13
16
  import { getConfig } from '../utils/config.js';
14
17
  import { createTaskTimer, formatElapsedTime } from '../utils/timer.js';
15
18
  import { createStatusLine } from '../utils/status-line.js';
16
19
  import {
17
- SYMBOLS,
18
20
  formatProjectHeader,
19
21
  formatSummary,
20
22
  formatTaskProgress,
21
23
  } from '../utils/terminal-symbols.js';
22
24
  import {
23
25
  deriveProjectState,
26
+ discoverProjects,
24
27
  getNextExecutableTask,
25
28
  getDerivedStats,
26
29
  getDerivedStatsForTasks,
@@ -31,8 +34,29 @@ import {
31
34
  type DerivedProjectState,
32
35
  } from '../core/state-derivation.js';
33
36
  import { analyzeFailure } from '../core/failure-analyzer.js';
37
+ import {
38
+ getRepoRoot,
39
+ getRepoBasename,
40
+ getCurrentBranch,
41
+ computeWorktreePath,
42
+ computeWorktreeBaseDir,
43
+ validateWorktree,
44
+ listWorktreeProjects,
45
+ mergeWorktreeBranch,
46
+ removeWorktree,
47
+ resolveWorktreeProjectByIdentifier,
48
+ } from '../core/worktree.js';
49
+ import { createPullRequest, prPreflight } from '../core/pull-request.js';
34
50
  import type { DoCommandOptions } from '../types/config.js';
35
51
 
52
+ /**
53
+ * Post-execution action chosen by the user before task execution begins.
54
+ * - 'merge': merge the worktree branch into the original branch
55
+ * - 'pr': push the branch and create a GitHub PR
56
+ * - 'leave': do nothing, keep the branch as-is
57
+ */
58
+ export type PostExecutionAction = 'merge' | 'pr' | 'leave';
59
+
36
60
  /**
37
61
  * Format failure history for console output.
38
62
  * Shows attempts that failed before eventual success or final failure.
@@ -90,25 +114,28 @@ interface ProjectExecutionResult {
90
114
 
91
115
  export function createDoCommand(): Command {
92
116
  const command = new Command('do')
93
- .description('Execute planned tasks for one or more projects')
117
+ .description('Execute planned tasks for a project')
94
118
  .alias('act')
95
- .argument('[projects...]', 'Project identifier(s): number (3), name (my-project), or folder (001-my-project)')
119
+ .argument('[project]', 'Project identifier: ID (00j3k1), name (my-project), or folder (00j3k1-my-project)')
96
120
  .option('-t, --timeout <minutes>', 'Timeout per task in minutes', '60')
97
121
  .option('-v, --verbose', 'Show full Claude output')
98
122
  .option('-d, --debug', 'Save all logs and show debug output')
99
123
  .option('-f, --force', 'Re-run all tasks regardless of status')
100
124
  .option('-m, --model <name>', 'Claude model to use (sonnet, haiku, opus)')
101
125
  .option('--sonnet', 'Use Sonnet model (shorthand for --model sonnet)')
102
- .action(async (projects: string[], options: DoCommandOptions) => {
103
- await runDoCommand(projects, options);
126
+ .option('-w, --worktree', 'Execute tasks in a git worktree')
127
+ .option('-r, --resume <session-id>', 'Resume an interrupted Claude session')
128
+ .action(async (project: string | undefined, options: DoCommandOptions) => {
129
+ await runDoCommand(project, options);
104
130
  });
105
131
 
106
132
  return command;
107
133
  }
108
134
 
109
- async function runDoCommand(projectIdentifiersArg: string[], options: DoCommandOptions): Promise<void> {
135
+ async function runDoCommand(projectIdentifierArg: string | undefined, options: DoCommandOptions): Promise<void> {
110
136
  const rafDir = getRafDir();
111
- let projectIdentifiers = projectIdentifiersArg;
137
+ let projectIdentifier = projectIdentifierArg;
138
+ let worktreeMode = options.worktree ?? false;
112
139
 
113
140
  // Validate and resolve model option
114
141
  let model: string;
@@ -119,28 +146,71 @@ async function runDoCommand(projectIdentifiersArg: string[], options: DoCommandO
119
146
  process.exit(1);
120
147
  }
121
148
 
122
- // Handle empty project list - show interactive picker
123
- if (projectIdentifiers.length === 0) {
124
- // Check if there are any pending projects
149
+ // Variables for worktree context (set when --worktree is used)
150
+ let worktreeRoot: string | undefined;
151
+ let originalBranch: string | undefined;
152
+
153
+ if (worktreeMode) {
154
+ // Validate git repo
155
+ const repoRoot = getRepoRoot();
156
+ if (!repoRoot) {
157
+ logger.error('--worktree requires a git repository');
158
+ process.exit(1);
159
+ }
160
+ const repoBasename = getRepoBasename()!;
161
+ const rafRelativePath = path.relative(repoRoot, rafDir);
162
+
163
+ // Record original branch before any worktree operations
164
+ originalBranch = getCurrentBranch() ?? undefined;
165
+
166
+ if (!projectIdentifier) {
167
+ // Auto-discovery flow
168
+ const selected = await discoverAndPickWorktreeProject(repoBasename, rafDir, rafRelativePath);
169
+ if (!selected) {
170
+ process.exit(0);
171
+ }
172
+ worktreeRoot = selected.worktreeRoot;
173
+ projectIdentifier = selected.projectFolder;
174
+ }
175
+ }
176
+
177
+ // Handle no project identifier (non-worktree mode) - show interactive picker
178
+ if (!projectIdentifier) {
179
+ // Discover worktree projects for the current repo (if in a git repo)
180
+ let worktreeProjects: PendingProjectInfo[] = [];
181
+ const repoRoot = getRepoRoot();
182
+ if (repoRoot) {
183
+ const repoBasename = getRepoBasename()!;
184
+ const rafRelativePath = path.relative(repoRoot, rafDir);
185
+ worktreeProjects = getPendingWorktreeProjects(repoBasename, rafRelativePath);
186
+ }
187
+
188
+ // Check if there are any pending projects (local or worktree)
125
189
  const pendingProjects = getPendingProjects(rafDir);
126
190
 
127
- if (pendingProjects.length === 0) {
191
+ if (pendingProjects.length === 0 && worktreeProjects.length === 0) {
128
192
  logger.info('No pending projects found.');
129
193
  logger.info("Run 'raf plan' to create a new project.");
130
194
  process.exit(0);
131
195
  }
132
196
 
133
197
  try {
134
- const selectedProject = await pickPendingProject(rafDir);
198
+ const selectedProject = await pickPendingProject(rafDir, worktreeProjects);
135
199
 
136
200
  if (!selectedProject) {
137
- // This shouldn't happen since we already checked pendingProjects.length
138
201
  logger.info('No pending projects found.');
139
202
  process.exit(0);
140
203
  }
141
204
 
142
205
  // Use the selected project
143
- projectIdentifiers = [selectedProject];
206
+ projectIdentifier = selectedProject.folder;
207
+
208
+ // If a worktree project was selected, auto-switch to worktree mode
209
+ if (selectedProject.source === 'worktree' && selectedProject.worktreeRoot) {
210
+ worktreeMode = true;
211
+ worktreeRoot = selectedProject.worktreeRoot;
212
+ originalBranch = getCurrentBranch() ?? undefined;
213
+ }
144
214
  } catch (error) {
145
215
  // Handle Ctrl+C (user cancellation)
146
216
  if (error instanceof Error && error.message.includes('User force closed')) {
@@ -150,51 +220,135 @@ async function runDoCommand(projectIdentifiersArg: string[], options: DoCommandO
150
220
  }
151
221
  }
152
222
 
153
- // Resolve all project identifiers and remove duplicates
154
- const resolvedProjects: Array<{ identifier: string; path: string; name: string }> = [];
155
- const seenPaths = new Set<string>();
156
- const errors: Array<{ identifier: string; error: string }> = [];
157
-
158
- for (const identifier of projectIdentifiers) {
159
- const result = resolveProjectIdentifierWithDetails(rafDir, identifier);
160
-
161
- if (!result.path) {
162
- if (result.error === 'ambiguous' && result.matches) {
163
- const matchList = result.matches
164
- .map((m) => ` - ${m.folder}`)
165
- .join('\n');
166
- errors.push({
167
- identifier,
168
- error: `Ambiguous project name. Multiple projects match:\n${matchList}\nPlease specify the project ID or full folder name.`,
169
- });
223
+ // Resolve project identifier
224
+ let resolvedProject: { identifier: string; path: string; name: string } | undefined;
225
+
226
+ if (worktreeMode) {
227
+ // Worktree mode: resolve project inside the worktree
228
+ const repoRoot = getRepoRoot()!;
229
+ const repoBasename = getRepoBasename()!;
230
+ const rafRelativePath = path.relative(repoRoot, rafDir);
231
+
232
+ // If worktreeRoot was set by auto-discovery, use it directly
233
+ if (worktreeRoot) {
234
+ const wtRafDir = path.join(worktreeRoot, rafRelativePath);
235
+ const result = resolveProjectIdentifierWithDetails(wtRafDir, projectIdentifier);
236
+ if (!result.path) {
237
+ logger.error(`Project not found in worktree: ${projectIdentifier}`);
238
+ process.exit(1);
239
+ }
240
+ const projectName = extractProjectName(result.path) ?? projectIdentifier;
241
+ resolvedProject = { identifier: projectIdentifier, path: result.path, name: projectName };
242
+ } else {
243
+ // Explicit identifier: resolve from main repo to get folder name, then validate worktree
244
+ const mainResult = resolveProjectIdentifierWithDetails(rafDir, projectIdentifier);
245
+
246
+ let projectFolderName: string;
247
+ if (mainResult.path) {
248
+ // Found in main repo - use its folder name
249
+ projectFolderName = path.basename(mainResult.path);
170
250
  } else {
171
- errors.push({ identifier, error: 'Project not found' });
251
+ // Not found in main repo - try to find it in worktrees directly
252
+ // This handles projects that only exist in worktrees
253
+ const worktreeBaseDir = computeWorktreeBaseDir(repoBasename);
254
+ if (!fs.existsSync(worktreeBaseDir)) {
255
+ logger.error(`No worktree found for project "${projectIdentifier}". Did you plan with --worktree?`);
256
+ process.exit(1);
257
+ }
258
+
259
+ // Search worktrees for the project
260
+ const wtProjects = listWorktreeProjects(repoBasename);
261
+ let found = false;
262
+ for (const wtProjectDir of wtProjects) {
263
+ const wtPath = computeWorktreePath(repoBasename, wtProjectDir);
264
+ const wtRafDir = path.join(wtPath, rafRelativePath);
265
+ if (!fs.existsSync(wtRafDir)) continue;
266
+
267
+ const resolution = resolveProjectIdentifierWithDetails(wtRafDir, projectIdentifier);
268
+ if (resolution.path) {
269
+ projectFolderName = path.basename(resolution.path);
270
+ worktreeRoot = wtPath;
271
+ found = true;
272
+ break;
273
+ }
274
+ }
275
+
276
+ if (!found) {
277
+ logger.error(`No worktree found for project "${projectIdentifier}". Did you plan with --worktree?`);
278
+ process.exit(1);
279
+ }
172
280
  }
173
- continue;
174
- }
175
281
 
176
- const projectPath = result.path;
282
+ // Compute worktree path if not already set
283
+ if (!worktreeRoot) {
284
+ worktreeRoot = computeWorktreePath(repoBasename, projectFolderName!);
285
+ }
177
286
 
178
- // Skip duplicates
179
- if (seenPaths.has(projectPath)) {
180
- logger.info(`Skipping duplicate: ${identifier}`);
181
- continue;
287
+ // Validate the worktree
288
+ const wtProjectRelPath = path.join(rafRelativePath, projectFolderName!);
289
+ const validation = validateWorktree(worktreeRoot, wtProjectRelPath);
290
+
291
+ if (!validation.exists || !validation.isValidWorktree) {
292
+ logger.error(`No worktree found for project "${projectIdentifier}". Did you plan with --worktree?`);
293
+ logger.error(`Expected worktree at: ${worktreeRoot}`);
294
+ process.exit(1);
295
+ }
296
+
297
+ if (!validation.hasProjectFolder || !validation.hasPlans) {
298
+ logger.error(`Worktree exists but project content is missing.`);
299
+ logger.error(`Expected project folder at: ${validation.projectPath ?? path.join(worktreeRoot, wtProjectRelPath)}`);
300
+ process.exit(1);
301
+ }
302
+
303
+ const projectPath = validation.projectPath!;
304
+ const projectName = extractProjectName(projectPath) ?? projectIdentifier;
305
+ resolvedProject = { identifier: projectIdentifier, path: projectPath, name: projectName };
306
+ }
307
+ } else {
308
+ // Standard mode: check worktrees first (worktree takes priority), then main repo
309
+ const repoRoot = getRepoRoot();
310
+ const repoBasename = repoRoot ? getRepoBasename() : null;
311
+
312
+ // Try worktree resolution first (preferred when project exists in both)
313
+ if (repoBasename) {
314
+ const wtResolution = resolveWorktreeProjectByIdentifier(repoBasename, projectIdentifier);
315
+ if (wtResolution) {
316
+ const rafRelativePath = path.relative(repoRoot!, rafDir);
317
+ const wtRafDir = path.join(wtResolution.worktreeRoot, rafRelativePath);
318
+ const wtProjectPath = path.join(wtRafDir, wtResolution.folder);
319
+
320
+ if (fs.existsSync(wtProjectPath)) {
321
+ // Auto-switch to worktree mode
322
+ worktreeMode = true;
323
+ worktreeRoot = wtResolution.worktreeRoot;
324
+ originalBranch = getCurrentBranch() ?? undefined;
325
+
326
+ const projectName = extractProjectName(wtResolution.folder) ?? projectIdentifier;
327
+ resolvedProject = { identifier: projectIdentifier, path: wtProjectPath, name: projectName };
328
+ }
329
+ }
182
330
  }
183
331
 
184
- seenPaths.add(projectPath);
185
- const projectName = extractProjectName(projectPath) ?? identifier;
186
- resolvedProjects.push({ identifier, path: projectPath, name: projectName });
187
- }
332
+ // Fall back to main repo if worktree didn't match
333
+ if (!resolvedProject) {
334
+ const result = resolveProjectIdentifierWithDetails(rafDir, projectIdentifier);
188
335
 
189
- // Report resolution errors
190
- for (const { identifier, error } of errors) {
191
- logger.error(`${identifier}: ${error}`);
192
- }
336
+ if (!result.path) {
337
+ if (result.error === 'ambiguous' && result.matches) {
338
+ const matchList = result.matches
339
+ .map((m) => ` - ${m.folder}`)
340
+ .join('\n');
341
+ logger.error(`${projectIdentifier}: Ambiguous project name. Multiple projects match:\n${matchList}\nPlease specify the project ID or full folder name.`);
342
+ } else {
343
+ logger.error(`${projectIdentifier}: Project not found`);
344
+ }
345
+ logger.info("Run 'raf status' to see available projects.");
346
+ process.exit(1);
347
+ }
193
348
 
194
- if (resolvedProjects.length === 0) {
195
- logger.error('No valid projects to execute.');
196
- logger.info("Run 'raf status' to see available projects.");
197
- process.exit(1);
349
+ const projectName = extractProjectName(result.path) ?? projectIdentifier;
350
+ resolvedProject = { identifier: projectIdentifier, path: result.path, name: projectName };
351
+ }
198
352
  }
199
353
 
200
354
  // Get configuration
@@ -203,72 +357,297 @@ async function runDoCommand(projectIdentifiersArg: string[], options: DoCommandO
203
357
  const verbose = options.verbose ?? false;
204
358
  const debug = options.debug ?? false;
205
359
  const force = options.force ?? false;
360
+ const resumeSessionId = options.resume;
206
361
  const maxRetries = config.maxRetries;
207
362
  const autoCommit = config.autoCommit;
208
363
 
209
364
  // Configure logger
210
365
  logger.configure({ verbose, debug });
211
366
 
212
- // Log Claude model name once (verbose mode only for multi-project)
213
- if (verbose && model && resolvedProjects.length > 1) {
214
- logger.info(`Using model: ${model}`);
215
- logger.newline();
367
+ // Show post-execution picker before task execution (worktree mode only)
368
+ let postAction: PostExecutionAction = 'leave';
369
+ if (worktreeMode && worktreeRoot) {
370
+ try {
371
+ postAction = await pickPostExecutionAction(worktreeRoot);
372
+ } catch (error) {
373
+ // Handle Ctrl+C (user cancellation)
374
+ if (error instanceof Error && error.message.includes('User force closed')) {
375
+ process.exit(0);
376
+ }
377
+ throw error;
378
+ }
216
379
  }
217
380
 
218
- // Execute projects
219
- const results: ProjectExecutionResult[] = [];
220
- const isMultiProject = resolvedProjects.length > 1;
381
+ // Execute project
382
+ let result: ProjectExecutionResult;
221
383
 
222
- for (const [i, project] of resolvedProjects.entries()) {
223
- if (isMultiProject && verbose) {
224
- logger.info(`=== Project ${i + 1}/${resolvedProjects.length}: ${project.name} ===`);
225
- logger.newline();
384
+ try {
385
+ result = await executeSingleProject(
386
+ resolvedProject.path,
387
+ resolvedProject.name,
388
+ {
389
+ timeout,
390
+ verbose,
391
+ debug,
392
+ force,
393
+ maxRetries,
394
+ autoCommit,
395
+ showModel: true,
396
+ model,
397
+ worktreeCwd: worktreeRoot,
398
+ resumeSessionId,
399
+ }
400
+ );
401
+ } catch (error) {
402
+ const errorMessage = error instanceof Error ? error.message : String(error);
403
+ logger.error(`Project ${resolvedProject.name} failed: ${errorMessage}`);
404
+ process.exit(1);
405
+ }
406
+
407
+ // Execute post-execution action based on picker choice
408
+ if (worktreeMode && worktreeRoot) {
409
+ const worktreeBranch = path.basename(worktreeRoot);
410
+
411
+ if (result.success) {
412
+ await executePostAction(postAction, worktreeRoot, worktreeBranch, originalBranch, resolvedProject.path);
413
+ } else {
414
+ if (postAction !== 'leave') {
415
+ logger.newline();
416
+ logger.info(`Skipping post-execution action — project has failures. Branch "${worktreeBranch}" is available for inspection.`);
417
+ }
226
418
  }
419
+ }
227
420
 
228
- try {
229
- const result = await executeSingleProject(
230
- project.path,
231
- project.name,
232
- {
233
- timeout,
234
- verbose,
235
- debug,
236
- force,
237
- maxRetries,
238
- autoCommit,
239
- showModel: !isMultiProject, // Only show model for single project
240
- model,
241
- }
242
- );
243
- results.push(result);
244
- } catch (error) {
245
- const errorMessage = error instanceof Error ? error.message : String(error);
246
- results.push({
247
- projectName: project.name,
248
- projectPath: project.path,
249
- success: false,
250
- tasksCompleted: 0,
251
- totalTasks: 0,
252
- error: errorMessage,
253
- });
254
- logger.error(`Project ${project.name} failed: ${errorMessage}`);
421
+ // Exit with appropriate code
422
+ if (!result.success) {
423
+ process.exit(1);
424
+ }
425
+ }
426
+
427
+ /**
428
+ * Show an interactive picker for the post-execution action in worktree mode.
429
+ * Presented before task execution so the user declares intent upfront.
430
+ *
431
+ * If "Create PR" is chosen, runs preflight checks immediately. If preflight fails,
432
+ * warns the user and falls back to re-prompting.
433
+ */
434
+ export async function pickPostExecutionAction(worktreeRoot: string): Promise<PostExecutionAction> {
435
+ const worktreeBranch = path.basename(worktreeRoot);
436
+
437
+ const chosen = await select<PostExecutionAction>({
438
+ message: `After tasks complete, what should happen with branch "${worktreeBranch}"?`,
439
+ choices: [
440
+ { name: 'Merge into current branch', value: 'merge' as const },
441
+ { name: 'Create a GitHub PR', value: 'pr' as const },
442
+ { name: 'Leave branch as-is', value: 'leave' as const },
443
+ ],
444
+ });
445
+
446
+ // Early preflight check for PR option
447
+ if (chosen === 'pr') {
448
+ const preflight = prPreflight(worktreeBranch, worktreeRoot);
449
+ if (!preflight.ready) {
450
+ logger.warn(`PR preflight failed: ${preflight.error}`);
451
+ logger.warn('Falling back to "Leave branch" — you can create a PR manually later.');
452
+ return 'leave';
453
+ }
454
+ }
455
+
456
+ return chosen;
457
+ }
458
+
459
+ /**
460
+ * Execute the chosen post-execution action.
461
+ * Called after all tasks succeed.
462
+ */
463
+ async function executePostAction(
464
+ action: PostExecutionAction,
465
+ worktreeRoot: string,
466
+ worktreeBranch: string,
467
+ originalBranch: string | undefined,
468
+ projectPath: string,
469
+ ): Promise<void> {
470
+ switch (action) {
471
+ case 'merge': {
472
+ // Clean up worktree before merge (merge uses branch, not directory)
473
+ const cleanupResult = removeWorktree(worktreeRoot);
474
+ if (cleanupResult.success) {
475
+ logger.info(`Cleaned up worktree: ${worktreeRoot}`);
476
+ } else {
477
+ logger.warn(`Could not clean up worktree: ${cleanupResult.error}`);
478
+ }
479
+
480
+ if (!originalBranch) {
481
+ logger.warn('Could not determine original branch for merge.');
482
+ return;
483
+ }
484
+
485
+ logger.newline();
486
+ logger.info(`Merging branch "${worktreeBranch}" into "${originalBranch}"...`);
487
+
488
+ const mergeResult = mergeWorktreeBranch(worktreeBranch, originalBranch);
489
+
490
+ if (mergeResult.success) {
491
+ const mergeType = mergeResult.fastForward ? 'fast-forward' : 'merge commit';
492
+ logger.success(`Merged "${worktreeBranch}" into "${originalBranch}" (${mergeType})`);
493
+ } else {
494
+ logger.warn(`Could not auto-merge: ${mergeResult.error}`);
495
+ logger.warn(`You can merge manually: git merge ${worktreeBranch}`);
496
+ }
497
+ break;
255
498
  }
256
499
 
257
- if (isMultiProject && i < resolvedProjects.length - 1) {
500
+ case 'pr': {
258
501
  logger.newline();
502
+ logger.info(`Creating PR for branch "${worktreeBranch}"...`);
503
+
504
+ const prResult = await createPullRequest(worktreeBranch, projectPath, { cwd: worktreeRoot });
505
+
506
+ if (prResult.success) {
507
+ logger.success(`PR created: ${prResult.prUrl}`);
508
+ } else {
509
+ logger.warn(`Could not create PR: ${prResult.error}`);
510
+ logger.warn(`Branch "${worktreeBranch}" has been pushed. You can create a PR manually.`);
511
+ }
512
+
513
+ // Clean up worktree directory (branch is preserved)
514
+ const prCleanupResult = removeWorktree(worktreeRoot);
515
+ if (prCleanupResult.success) {
516
+ logger.info(`Cleaned up worktree: ${worktreeRoot}`);
517
+ } else {
518
+ logger.warn(`Could not clean up worktree: ${prCleanupResult.error}`);
519
+ }
520
+ break;
259
521
  }
260
- }
261
522
 
262
- // Show multi-project summary
263
- if (isMultiProject) {
264
- printMultiProjectSummary(results, verbose);
523
+ case 'leave': {
524
+ // Clean up worktree directory (branch is preserved)
525
+ const cleanupResult = removeWorktree(worktreeRoot);
526
+ if (cleanupResult.success) {
527
+ logger.info(`Cleaned up worktree: ${worktreeRoot}`);
528
+ } else {
529
+ logger.warn(`Could not clean up worktree: ${cleanupResult.error}`);
530
+ }
531
+ break;
532
+ }
265
533
  }
534
+ }
266
535
 
267
- // Exit with appropriate code
268
- const anyFailed = results.some((r) => !r.success);
269
- if (anyFailed) {
536
+ /**
537
+ * Auto-discovery flow for `raf do --worktree` without a project identifier.
538
+ * Lists worktree projects, finds latest completed main-tree project, filters,
539
+ * and shows an interactive picker.
540
+ *
541
+ * @returns Selected project info or null if cancelled/no projects
542
+ */
543
+ async function discoverAndPickWorktreeProject(
544
+ repoBasename: string,
545
+ rafDir: string,
546
+ rafRelativePath: string,
547
+ ): Promise<{ worktreeRoot: string; projectFolder: string } | null> {
548
+ // List all worktree projects for this repo
549
+ const wtProjects = listWorktreeProjects(repoBasename);
550
+
551
+ if (wtProjects.length === 0) {
552
+ logger.error('No worktree projects found. Did you plan with --worktree?');
270
553
  process.exit(1);
271
554
  }
555
+
556
+ // Find the highest-numbered completed project in the MAIN tree
557
+ const mainProjects = discoverProjects(rafDir);
558
+ let highestCompletedNumber = 0;
559
+
560
+ for (const project of mainProjects) {
561
+ const state = deriveProjectState(project.path);
562
+ if (isProjectComplete(state) && state.tasks.length > 0) {
563
+ if (project.number > highestCompletedNumber) {
564
+ highestCompletedNumber = project.number;
565
+ }
566
+ }
567
+ }
568
+
569
+ // Filter threshold: highest completed - 3 (or 0 if none completed)
570
+ const threshold = highestCompletedNumber > 3 ? highestCompletedNumber - 3 : 0;
571
+
572
+ // Filter worktree projects by number threshold and completion status
573
+ const uncompletedProjects: Array<{
574
+ folder: string;
575
+ worktreeRoot: string;
576
+ projectPath: string;
577
+ completedTasks: number;
578
+ totalTasks: number;
579
+ projectNumber: number;
580
+ }> = [];
581
+
582
+ for (const wtProjectDir of wtProjects) {
583
+ // Extract project number from the worktree directory name
584
+ const numPrefix = extractProjectNumber(wtProjectDir);
585
+ if (!numPrefix) continue;
586
+ const projectNumber = parseProjectPrefix(numPrefix);
587
+ if (projectNumber === null) continue;
588
+
589
+ // Apply threshold filter
590
+ if (projectNumber < threshold) continue;
591
+
592
+ // Check if this worktree has a valid project
593
+ const wtPath = computeWorktreePath(repoBasename, wtProjectDir);
594
+ const wtProjectPath = path.join(wtPath, rafRelativePath, wtProjectDir);
595
+
596
+ if (!fs.existsSync(wtProjectPath)) continue;
597
+
598
+ // Derive project state from worktree
599
+ const state = deriveProjectState(wtProjectPath);
600
+ if (state.tasks.length === 0) continue;
601
+
602
+ // Keep only uncompleted projects
603
+ if (isProjectComplete(state)) continue;
604
+
605
+ const stats = getDerivedStats(state);
606
+ uncompletedProjects.push({
607
+ folder: wtProjectDir,
608
+ worktreeRoot: wtPath,
609
+ projectPath: wtProjectPath,
610
+ completedTasks: stats.completed,
611
+ totalTasks: stats.total,
612
+ projectNumber,
613
+ });
614
+ }
615
+
616
+ if (uncompletedProjects.length === 0) {
617
+ logger.info('All worktree projects are completed.');
618
+ return null;
619
+ }
620
+
621
+ // Sort by project number
622
+ uncompletedProjects.sort((a, b) => a.projectNumber - b.projectNumber);
623
+
624
+ // Show interactive picker (even if only one project)
625
+ const choices = uncompletedProjects.map((p) => {
626
+ const name = extractProjectName(p.folder) ?? p.folder;
627
+ const numPrefix = extractProjectNumber(p.folder) ?? '';
628
+ return {
629
+ name: `${numPrefix} ${name} (${p.completedTasks}/${p.totalTasks} tasks)`,
630
+ value: p,
631
+ };
632
+ });
633
+
634
+ try {
635
+ const selected = await select({
636
+ message: 'Select a worktree project to execute:',
637
+ choices,
638
+ });
639
+
640
+ return {
641
+ worktreeRoot: selected.worktreeRoot,
642
+ projectFolder: selected.folder,
643
+ };
644
+ } catch (error) {
645
+ // Handle Ctrl+C (user cancellation)
646
+ if (error instanceof Error && error.message.includes('User force closed')) {
647
+ return null;
648
+ }
649
+ throw error;
650
+ }
272
651
  }
273
652
 
274
653
  interface SingleProjectOptions {
@@ -280,6 +659,10 @@ interface SingleProjectOptions {
280
659
  autoCommit: boolean;
281
660
  showModel: boolean;
282
661
  model: string;
662
+ /** Worktree root directory. When set, Claude runs with cwd in the worktree. */
663
+ worktreeCwd?: string;
664
+ /** Session ID to resume an interrupted Claude session. Only applies to the first pending task. */
665
+ resumeSessionId?: string;
283
666
  }
284
667
 
285
668
  async function executeSingleProject(
@@ -287,7 +670,8 @@ async function executeSingleProject(
287
670
  projectName: string,
288
671
  options: SingleProjectOptions
289
672
  ): Promise<ProjectExecutionResult> {
290
- const { timeout, verbose, debug, force, maxRetries, autoCommit, showModel, model } = options;
673
+ const { timeout, verbose, debug, force, maxRetries, autoCommit, showModel, model, worktreeCwd, resumeSessionId } = options;
674
+ let activeResumeSessionId = resumeSessionId;
291
675
 
292
676
  if (!validatePlansExist(projectPath)) {
293
677
  return {
@@ -484,13 +868,17 @@ async function executeSingleProject(
484
868
  logger.setContext(taskContext);
485
869
 
486
870
  // Log task execution status
487
- if (task.status === 'failed') {
871
+ if (activeResumeSessionId) {
872
+ logger.info(`Resuming task ${taskLabel} with session ${activeResumeSessionId}`);
873
+ } else if (task.status === 'failed') {
488
874
  logger.info(`Retrying task ${taskLabel} (previously failed)...`);
489
875
  } else if (task.status === 'completed' && force) {
490
876
  logger.info(`Re-running task ${taskLabel} (force mode)...`);
491
877
  } else {
492
878
  logger.info(`Executing task ${taskLabel}...`);
493
879
  }
880
+ } else if (activeResumeSessionId) {
881
+ logger.info(`Resuming task ${task.id} with session ${activeResumeSessionId}`);
494
882
  }
495
883
 
496
884
  // Get previous outcomes for context
@@ -554,17 +942,23 @@ async function executeSingleProject(
554
942
  });
555
943
 
556
944
  // Capture HEAD hash before execution for commit verification
557
- const preExecutionHead = isGitRepo() ? getHeadCommitHash() : null;
945
+ const preExecutionHead = isGitRepo(worktreeCwd) ? getHeadCommitHash(worktreeCwd) : null;
558
946
  const commitContext = preExecutionHead ? {
559
947
  preExecutionHead,
560
948
  expectedPrefix: `RAF[${projectNumber}:${task.id}]`,
561
949
  outcomeFilePath,
562
950
  } : undefined;
563
951
 
564
- // Run Claude
565
- const result = verbose
566
- ? await claudeRunner.runVerbose(prompt, { timeout, outcomeFilePath, commitContext })
567
- : await claudeRunner.run(prompt, { timeout, outcomeFilePath, commitContext });
952
+ // Run Claude (use worktree root as cwd if in worktree mode)
953
+ let result;
954
+ if (activeResumeSessionId && attempts === 1) {
955
+ // Resume mode: use --resume flag instead of normal prompt execution
956
+ result = await claudeRunner.runResume(activeResumeSessionId, { timeout, outcomeFilePath, commitContext, cwd: worktreeCwd, effortLevel: 'medium' });
957
+ } else {
958
+ result = verbose
959
+ ? await claudeRunner.runVerbose(prompt, { timeout, outcomeFilePath, commitContext, cwd: worktreeCwd, effortLevel: 'medium' })
960
+ : await claudeRunner.run(prompt, { timeout, outcomeFilePath, commitContext, cwd: worktreeCwd, effortLevel: 'medium' });
961
+ }
568
962
 
569
963
  lastOutput = result.output;
570
964
 
@@ -685,10 +1079,10 @@ Task completed. No detailed report provided.
685
1079
  } else {
686
1080
  // Stash any uncommitted changes on complete failure
687
1081
  let stashName: string | undefined;
688
- if (hasUncommittedChanges()) {
1082
+ if (hasUncommittedChanges(worktreeCwd)) {
689
1083
  const projectNum = extractProjectNumber(projectPath) ?? '000';
690
1084
  stashName = `raf-${projectNum}-task-${task.id}-failed`;
691
- const stashed = stashChanges(stashName);
1085
+ const stashed = stashChanges(stashName, worktreeCwd);
692
1086
  if (verbose && stashed) {
693
1087
  logger.info(` Changes for task ${taskLabel} stashed as: ${stashName}`);
694
1088
  }
@@ -726,6 +1120,9 @@ ${stashName ? `- Stash: ${stashName}` : ''}
726
1120
  logger.newline();
727
1121
  }
728
1122
 
1123
+ // Clear resume flag after first task — subsequent tasks use normal execution
1124
+ activeResumeSessionId = undefined;
1125
+
729
1126
  // Clear context before next task
730
1127
  logger.clearContext();
731
1128
 
@@ -832,34 +1229,3 @@ ${stashName ? `- Stash: ${stashName}` : ''}
832
1229
  };
833
1230
  }
834
1231
 
835
- function printMultiProjectSummary(results: ProjectExecutionResult[], verbose: boolean): void {
836
- logger.newline();
837
-
838
- if (verbose) {
839
- logger.info('=== Multi-Project Summary ===');
840
- logger.newline();
841
-
842
- for (const result of results) {
843
- const statusSymbol = result.success ? SYMBOLS.completed : SYMBOLS.failed;
844
- const statusText = result.success
845
- ? `Completed (${result.tasksCompleted}/${result.totalTasks} tasks)`
846
- : result.error
847
- ? `Error: ${result.error}`
848
- : `Failed (${result.tasksCompleted}/${result.totalTasks} tasks)`;
849
-
850
- logger.info(`${statusSymbol} ${result.projectName}: ${statusText}`);
851
- }
852
-
853
- const completed = results.filter((r) => r.success).length;
854
- const failed = results.length - completed;
855
-
856
- logger.newline();
857
- logger.info(`Total: ${completed} completed, ${failed} failed`);
858
- } else {
859
- // Minimal multi-project summary: just show each project result
860
- for (const result of results) {
861
- const symbol = result.success ? SYMBOLS.completed : SYMBOLS.failed;
862
- logger.info(`${symbol} ${result.projectName}`);
863
- }
864
- }
865
- }