rafcode 1.0.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 (370) hide show
  1. package/.claude/settings.local.json +32 -0
  2. package/CLAUDE.md +187 -0
  3. package/LICENSE +21 -0
  4. package/RAF/001-raf-task-improvements/input.md +9 -0
  5. package/RAF/001-raf-task-improvements/outcomes/001-add-decisions-folder.md +21 -0
  6. package/RAF/001-raf-task-improvements/outcomes/002-fix-write-error-on-shutdown.md +22 -0
  7. package/RAF/001-raf-task-improvements/outcomes/003-stash-changes-on-failure.md +34 -0
  8. package/RAF/001-raf-task-improvements/outcomes/004-add-project-name-to-commits.md +28 -0
  9. package/RAF/001-raf-task-improvements/outcomes/005-add-running-time-display.md +36 -0
  10. package/RAF/001-raf-task-improvements/outcomes/006-add-task-name-to-logs.md +22 -0
  11. package/RAF/001-raf-task-improvements/outcomes/007-show-model-at-task-start.md +52 -0
  12. package/RAF/001-raf-task-improvements/outcomes/009-remove-editor-placeholder-text.md +20 -0
  13. package/RAF/001-raf-task-improvements/outcomes/SUMMARY.md +83 -0
  14. package/RAF/001-raf-task-improvements/plans/001-add-decisions-folder.md +38 -0
  15. package/RAF/001-raf-task-improvements/plans/002-fix-write-error-on-shutdown.md +33 -0
  16. package/RAF/001-raf-task-improvements/plans/003-stash-changes-on-failure.md +37 -0
  17. package/RAF/001-raf-task-improvements/plans/004-add-project-name-to-commits.md +34 -0
  18. package/RAF/001-raf-task-improvements/plans/005-add-running-time-display.md +39 -0
  19. package/RAF/001-raf-task-improvements/plans/006-add-task-name-to-logs.md +37 -0
  20. package/RAF/001-raf-task-improvements/plans/009-remove-editor-placeholder-text.md +34 -0
  21. package/RAF/002-raf-task-improvements-execution/decisions/DECISIONS.md +13 -0
  22. package/RAF/002-raf-task-improvements-execution/input.md +3 -0
  23. package/RAF/002-raf-task-improvements-execution/outcomes/001-commit-show-model-at-task-start.md +17 -0
  24. package/RAF/002-raf-task-improvements-execution/outcomes/002-delete-skipped-plan.md +23 -0
  25. package/RAF/002-raf-task-improvements-execution/outcomes/SUMMARY.md +32 -0
  26. package/RAF/002-raf-task-improvements-execution/plans/001-commit-show-model-at-task-start.md +37 -0
  27. package/RAF/002-raf-task-improvements-execution/plans/002-delete-skipped-plan.md +23 -0
  28. package/RAF/003-multi-project-execution/decisions/DECISIONS.md +68 -0
  29. package/RAF/003-multi-project-execution/input.md +6 -0
  30. package/RAF/003-multi-project-execution/outcomes/001-remove-state-json.md +52 -0
  31. package/RAF/003-multi-project-execution/outcomes/002-update-raf-status.md +50 -0
  32. package/RAF/003-multi-project-execution/outcomes/003-simplify-git-logic.md +35 -0
  33. package/RAF/003-multi-project-execution/outcomes/004-auto-commit-planning.md +43 -0
  34. package/RAF/003-multi-project-execution/outcomes/005-rerun-failed-tasks.md +43 -0
  35. package/RAF/003-multi-project-execution/outcomes/006-multi-project-execution.md +42 -0
  36. package/RAF/003-multi-project-execution/outcomes/007-verify-timeout.md +54 -0
  37. package/RAF/003-multi-project-execution/outcomes/008-move-decisions-file.md +38 -0
  38. package/RAF/003-multi-project-execution/outcomes/SUMMARY.md +79 -0
  39. package/RAF/003-multi-project-execution/plans/001-remove-state-json.md +71 -0
  40. package/RAF/003-multi-project-execution/plans/002-update-raf-status.md +65 -0
  41. package/RAF/003-multi-project-execution/plans/003-simplify-git-logic.md +74 -0
  42. package/RAF/003-multi-project-execution/plans/004-auto-commit-planning.md +57 -0
  43. package/RAF/003-multi-project-execution/plans/005-rerun-failed-tasks.md +69 -0
  44. package/RAF/003-multi-project-execution/plans/006-multi-project-execution.md +81 -0
  45. package/RAF/003-multi-project-execution/plans/007-verify-timeout.md +63 -0
  46. package/RAF/003-multi-project-execution/plans/008-move-decisions-file.md +78 -0
  47. package/RAF/004-task-naming-optimization/decisions.md +22 -0
  48. package/RAF/004-task-naming-optimization/input.md +6 -0
  49. package/RAF/004-task-naming-optimization/outcomes/001-remove-summary-file.md +17 -0
  50. package/RAF/004-task-naming-optimization/outcomes/002-base36-project-numbering.md +32 -0
  51. package/RAF/004-task-naming-optimization/outcomes/003-improve-haiku-prompt.md +20 -0
  52. package/RAF/004-task-naming-optimization/outcomes/SUMMARY.md +28 -0
  53. package/RAF/004-task-naming-optimization/plans/001-remove-summary-file.md +34 -0
  54. package/RAF/004-task-naming-optimization/plans/002-base36-project-numbering.md +56 -0
  55. package/RAF/004-task-naming-optimization/plans/003-improve-haiku-prompt.md +50 -0
  56. package/RAF/005-task-naming-improvements/decisions.md +60 -0
  57. package/RAF/005-task-naming-improvements/input.md +2 -0
  58. package/RAF/005-task-naming-improvements/outcomes/001-enhance-identifier-resolution.md +42 -0
  59. package/RAF/005-task-naming-improvements/outcomes/002-add-identifier-support-to-status.md +38 -0
  60. package/RAF/005-task-naming-improvements/outcomes/003-update-do-for-full-folder-names.md +44 -0
  61. package/RAF/005-task-naming-improvements/outcomes/004-implement-amend-flag-for-plan.md +55 -0
  62. package/RAF/005-task-naming-improvements/outcomes/005-commit-outcomes-on-complete.md +47 -0
  63. package/RAF/005-task-naming-improvements/outcomes/006-update-execution-prompt-commit-schema.md +40 -0
  64. package/RAF/005-task-naming-improvements/outcomes/007-allow-pending-task-amendments.md +38 -0
  65. package/RAF/005-task-naming-improvements/outcomes/008-fix-timeout-label.md +24 -0
  66. package/RAF/005-task-naming-improvements/plans/001-enhance-identifier-resolution.md +46 -0
  67. package/RAF/005-task-naming-improvements/plans/002-add-identifier-support-to-status.md +36 -0
  68. package/RAF/005-task-naming-improvements/plans/003-update-do-for-full-folder-names.md +38 -0
  69. package/RAF/005-task-naming-improvements/plans/004-implement-amend-flag-for-plan.md +67 -0
  70. package/RAF/005-task-naming-improvements/plans/005-commit-outcomes-on-complete.md +86 -0
  71. package/RAF/005-task-naming-improvements/plans/006-update-execution-prompt-commit-schema.md +60 -0
  72. package/RAF/005-task-naming-improvements/plans/007-allow-pending-task-amendments.md +60 -0
  73. package/RAF/005-task-naming-improvements/plans/008-fix-timeout-label.md +31 -0
  74. package/RAF/006-fix-double-summary-headers/decisions.md +28 -0
  75. package/RAF/006-fix-double-summary-headers/input.md +3 -0
  76. package/RAF/006-fix-double-summary-headers/outcomes/001-fix-double-summary-headers.md +29 -0
  77. package/RAF/006-fix-double-summary-headers/outcomes/002-update-readme-for-npm.md +31 -0
  78. package/RAF/006-fix-double-summary-headers/outcomes/003-npm-publish-instructions.md +30 -0
  79. package/RAF/006-fix-double-summary-headers/outcomes/004-flexible-project-lookup.md +47 -0
  80. package/RAF/006-fix-double-summary-headers/plans/001-fix-double-summary-headers.md +42 -0
  81. package/RAF/006-fix-double-summary-headers/plans/002-update-readme-for-npm.md +44 -0
  82. package/RAF/006-fix-double-summary-headers/plans/003-npm-publish-instructions.md +45 -0
  83. package/RAF/006-fix-double-summary-headers/plans/004-flexible-project-lookup.md +40 -0
  84. package/RAF/007-improve-outcome-format/decisions.md +28 -0
  85. package/RAF/007-improve-outcome-format/input.md +2 -0
  86. package/RAF/007-improve-outcome-format/outcomes/001-update-execution-prompt.md +10 -0
  87. package/RAF/007-improve-outcome-format/outcomes/002-update-state-derivation.md +17 -0
  88. package/RAF/007-improve-outcome-format/outcomes/003-update-do-command-outcome-handling.md +16 -0
  89. package/RAF/007-improve-outcome-format/outcomes/004-implement-failure-analysis.md +16 -0
  90. package/RAF/007-improve-outcome-format/outcomes/005-update-documentation.md +15 -0
  91. package/RAF/007-improve-outcome-format/plans/001-update-execution-prompt.md +36 -0
  92. package/RAF/007-improve-outcome-format/plans/002-update-state-derivation.md +35 -0
  93. package/RAF/007-improve-outcome-format/plans/003-update-do-command-outcome-handling.md +37 -0
  94. package/RAF/007-improve-outcome-format/plans/004-implement-failure-analysis.md +44 -0
  95. package/RAF/007-improve-outcome-format/plans/005-update-documentation.md +33 -0
  96. package/RAF/008-beautiful-do/decisions.md +31 -0
  97. package/RAF/008-beautiful-do/input.md +1 -0
  98. package/RAF/008-beautiful-do/outcomes/001-terminal-symbols.md +55 -0
  99. package/RAF/008-beautiful-do/outcomes/002-refactor-do-output.md +95 -0
  100. package/RAF/008-beautiful-do/outcomes/003-refactor-status-output.md +71 -0
  101. package/RAF/008-beautiful-do/outcomes/004-simplify-logger.md +53 -0
  102. package/RAF/008-beautiful-do/outcomes/005-add-tests.md +41 -0
  103. package/RAF/008-beautiful-do/plans/001-terminal-symbols.md +41 -0
  104. package/RAF/008-beautiful-do/plans/002-refactor-do-output.md +44 -0
  105. package/RAF/008-beautiful-do/plans/003-refactor-status-output.md +37 -0
  106. package/RAF/008-beautiful-do/plans/004-simplify-logger.md +32 -0
  107. package/RAF/008-beautiful-do/plans/005-add-tests.md +40 -0
  108. package/RAF/009-system-promt-ammend/decisions.md +13 -0
  109. package/RAF/009-system-promt-ammend/input.md +9 -0
  110. package/RAF/009-system-promt-ammend/outcomes/001-model-override.md +79 -0
  111. package/RAF/009-system-promt-ammend/outcomes/002-system-prompt-append.md +51 -0
  112. package/RAF/009-system-promt-ammend/outcomes/003-retry-context.md +60 -0
  113. package/RAF/009-system-promt-ammend/plans/001-model-override.md +61 -0
  114. package/RAF/009-system-promt-ammend/plans/002-system-prompt-append.md +56 -0
  115. package/RAF/009-system-promt-ammend/plans/003-retry-context.md +76 -0
  116. package/RAF/010-outcome-marker-fallback/decisions.md +19 -0
  117. package/RAF/010-outcome-marker-fallback/input.md +1 -0
  118. package/RAF/010-outcome-marker-fallback/outcomes/001-outcome-file-marker-fallback.md +35 -0
  119. package/RAF/010-outcome-marker-fallback/outcomes/002-creative-project-naming.md +47 -0
  120. package/RAF/010-outcome-marker-fallback/plans/001-outcome-file-marker-fallback.md +58 -0
  121. package/RAF/010-outcome-marker-fallback/plans/002-creative-project-naming.md +68 -0
  122. package/RAF/011-do-task-in-commit/decisions.md +22 -0
  123. package/RAF/011-do-task-in-commit/input.md +1 -0
  124. package/RAF/011-do-task-in-commit/outcomes/001-update-execution-prompt.md +54 -0
  125. package/RAF/011-do-task-in-commit/outcomes/002-update-tests.md +61 -0
  126. package/RAF/011-do-task-in-commit/outcomes/003-update-documentation.md +51 -0
  127. package/RAF/011-do-task-in-commit/plans/001-update-execution-prompt.md +46 -0
  128. package/RAF/011-do-task-in-commit/plans/002-update-tests.md +51 -0
  129. package/RAF/011-do-task-in-commit/plans/003-update-documentation.md +45 -0
  130. package/RAF/012-name-picker-buffet/decisions.md +40 -0
  131. package/RAF/012-name-picker-buffet/input.md +6 -0
  132. package/RAF/012-name-picker-buffet/outcomes/001-name-picker-for-raf-plan.md +49 -0
  133. package/RAF/012-name-picker-buffet/outcomes/002-interactive-project-picker-for-raf-do.md +49 -0
  134. package/RAF/012-name-picker-buffet/outcomes/003-raf-status-truncation.md +55 -0
  135. package/RAF/012-name-picker-buffet/outcomes/004-failure-reason-details.md +65 -0
  136. package/RAF/012-name-picker-buffet/outcomes/005-remove-raf-commits.md +57 -0
  137. package/RAF/012-name-picker-buffet/outcomes/006-update-execution-prompt-for-commits.md +47 -0
  138. package/RAF/012-name-picker-buffet/outcomes/007-fix-plan-mode-user-prompt.md +83 -0
  139. package/RAF/012-name-picker-buffet/outcomes/008-add-auto-flag-for-plan-mode.md +77 -0
  140. package/RAF/012-name-picker-buffet/plans/001-name-picker-for-raf-plan.md +47 -0
  141. package/RAF/012-name-picker-buffet/plans/002-interactive-project-picker-for-raf-do.md +43 -0
  142. package/RAF/012-name-picker-buffet/plans/003-raf-status-truncation.md +36 -0
  143. package/RAF/012-name-picker-buffet/plans/004-failure-reason-details.md +46 -0
  144. package/RAF/012-name-picker-buffet/plans/005-remove-raf-commits.md +42 -0
  145. package/RAF/012-name-picker-buffet/plans/006-update-execution-prompt-for-commits.md +47 -0
  146. package/RAF/012-name-picker-buffet/plans/007-fix-plan-mode-user-prompt.md +55 -0
  147. package/RAF/012-name-picker-buffet/plans/008-add-auto-flag-for-plan-mode.md +49 -0
  148. package/RAF/013-dependencies-watchdog/decisions.md +37 -0
  149. package/RAF/013-dependencies-watchdog/input.md +1 -0
  150. package/RAF/013-dependencies-watchdog/outcomes/001-define-dependency-syntax.md +56 -0
  151. package/RAF/013-dependencies-watchdog/outcomes/002-update-planning-prompts.md +60 -0
  152. package/RAF/013-dependencies-watchdog/outcomes/003-parse-dependencies-update-state.md +81 -0
  153. package/RAF/013-dependencies-watchdog/outcomes/004-implement-dependency-checking-in-do.md +116 -0
  154. package/RAF/013-dependencies-watchdog/outcomes/005-update-execution-prompts.md +75 -0
  155. package/RAF/013-dependencies-watchdog/outcomes/006-add-tests.md +100 -0
  156. package/RAF/013-dependencies-watchdog/outcomes/007-add-act-alias.md +46 -0
  157. package/RAF/013-dependencies-watchdog/outcomes/008-add-exit-message.md +52 -0
  158. package/RAF/013-dependencies-watchdog/plans/001-define-dependency-syntax.md +32 -0
  159. package/RAF/013-dependencies-watchdog/plans/002-update-planning-prompts.md +38 -0
  160. package/RAF/013-dependencies-watchdog/plans/003-parse-dependencies-update-state.md +46 -0
  161. package/RAF/013-dependencies-watchdog/plans/004-implement-dependency-checking-in-do.md +48 -0
  162. package/RAF/013-dependencies-watchdog/plans/005-update-execution-prompts.md +44 -0
  163. package/RAF/013-dependencies-watchdog/plans/006-add-tests.md +54 -0
  164. package/RAF/013-dependencies-watchdog/plans/007-add-act-alias.md +26 -0
  165. package/RAF/013-dependencies-watchdog/plans/008-add-exit-message.md +31 -0
  166. package/RAF/014-watchdog/decisions.md +16 -0
  167. package/RAF/014-watchdog/input.md +2 -0
  168. package/RAF/014-watchdog/outcomes/001-amend-flag-position.md +50 -0
  169. package/RAF/014-watchdog/outcomes/002-details-only-on-failure.md +58 -0
  170. package/RAF/014-watchdog/plans/001-amend-flag-position.md +34 -0
  171. package/RAF/014-watchdog/plans/002-details-only-on-failure.md +46 -0
  172. package/RAF/015-name-lottery/decisions.md +14 -0
  173. package/RAF/015-name-lottery/input.md +3 -0
  174. package/RAF/015-name-lottery/outcomes/001-auto-pick-project-name.md +31 -0
  175. package/RAF/015-name-lottery/outcomes/002-mention-plan-files-in-commit.md +23 -0
  176. package/RAF/015-name-lottery/outcomes/003-fix-input-md-in-amend-flow.md +44 -0
  177. package/RAF/015-name-lottery/plans/001-auto-pick-project-name.md +38 -0
  178. package/RAF/015-name-lottery/plans/002-mention-plan-files-in-commit.md +32 -0
  179. package/RAF/015-name-lottery/plans/003-fix-input-md-in-amend-flow.md +44 -0
  180. package/README.md +116 -0
  181. package/dist/commands/do.d.ts +12 -0
  182. package/dist/commands/do.d.ts.map +1 -0
  183. package/dist/commands/do.js +684 -0
  184. package/dist/commands/do.js.map +1 -0
  185. package/dist/commands/plan.d.ts +3 -0
  186. package/dist/commands/plan.d.ts.map +1 -0
  187. package/dist/commands/plan.js +345 -0
  188. package/dist/commands/plan.js.map +1 -0
  189. package/dist/commands/status.d.ts +3 -0
  190. package/dist/commands/status.d.ts.map +1 -0
  191. package/dist/commands/status.js +117 -0
  192. package/dist/commands/status.js.map +1 -0
  193. package/dist/core/claude-runner.d.ts +78 -0
  194. package/dist/core/claude-runner.d.ts.map +1 -0
  195. package/dist/core/claude-runner.js +297 -0
  196. package/dist/core/claude-runner.js.map +1 -0
  197. package/dist/core/editor.d.ts +10 -0
  198. package/dist/core/editor.d.ts.map +1 -0
  199. package/dist/core/editor.js +77 -0
  200. package/dist/core/editor.js.map +1 -0
  201. package/dist/core/failure-analyzer.d.ts +28 -0
  202. package/dist/core/failure-analyzer.d.ts.map +1 -0
  203. package/dist/core/failure-analyzer.js +305 -0
  204. package/dist/core/failure-analyzer.js.map +1 -0
  205. package/dist/core/git.d.ts +42 -0
  206. package/dist/core/git.d.ts.map +1 -0
  207. package/dist/core/git.js +148 -0
  208. package/dist/core/git.js.map +1 -0
  209. package/dist/core/project-manager.d.ts +72 -0
  210. package/dist/core/project-manager.d.ts.map +1 -0
  211. package/dist/core/project-manager.js +193 -0
  212. package/dist/core/project-manager.js.map +1 -0
  213. package/dist/core/retry-handler.d.ts +19 -0
  214. package/dist/core/retry-handler.d.ts.map +1 -0
  215. package/dist/core/retry-handler.js +51 -0
  216. package/dist/core/retry-handler.js.map +1 -0
  217. package/dist/core/shutdown-handler.d.ts +30 -0
  218. package/dist/core/shutdown-handler.d.ts.map +1 -0
  219. package/dist/core/shutdown-handler.js +79 -0
  220. package/dist/core/shutdown-handler.js.map +1 -0
  221. package/dist/core/state-derivation.d.ts +82 -0
  222. package/dist/core/state-derivation.d.ts.map +1 -0
  223. package/dist/core/state-derivation.js +271 -0
  224. package/dist/core/state-derivation.js.map +1 -0
  225. package/dist/core/state-manager.d.ts +54 -0
  226. package/dist/core/state-manager.d.ts.map +1 -0
  227. package/dist/core/state-manager.js +198 -0
  228. package/dist/core/state-manager.js.map +1 -0
  229. package/dist/index.d.ts +3 -0
  230. package/dist/index.d.ts.map +1 -0
  231. package/dist/index.js +16 -0
  232. package/dist/index.js.map +1 -0
  233. package/dist/parsers/output-parser.d.ts +19 -0
  234. package/dist/parsers/output-parser.d.ts.map +1 -0
  235. package/dist/parsers/output-parser.js +137 -0
  236. package/dist/parsers/output-parser.js.map +1 -0
  237. package/dist/prompts/amend.d.ts +20 -0
  238. package/dist/prompts/amend.d.ts.map +1 -0
  239. package/dist/prompts/amend.js +166 -0
  240. package/dist/prompts/amend.js.map +1 -0
  241. package/dist/prompts/execution.d.ts +30 -0
  242. package/dist/prompts/execution.d.ts.map +1 -0
  243. package/dist/prompts/execution.js +179 -0
  244. package/dist/prompts/execution.js.map +1 -0
  245. package/dist/prompts/planning.d.ts +15 -0
  246. package/dist/prompts/planning.d.ts.map +1 -0
  247. package/dist/prompts/planning.js +163 -0
  248. package/dist/prompts/planning.js.map +1 -0
  249. package/dist/types/config.d.ts +26 -0
  250. package/dist/types/config.d.ts.map +1 -0
  251. package/dist/types/config.js +7 -0
  252. package/dist/types/config.js.map +1 -0
  253. package/dist/types/state.d.ts +33 -0
  254. package/dist/types/state.d.ts.map +1 -0
  255. package/dist/types/state.js +28 -0
  256. package/dist/types/state.js.map +1 -0
  257. package/dist/ui/name-picker-subprocess.d.ts +11 -0
  258. package/dist/ui/name-picker-subprocess.d.ts.map +1 -0
  259. package/dist/ui/name-picker-subprocess.js +83 -0
  260. package/dist/ui/name-picker-subprocess.js.map +1 -0
  261. package/dist/ui/name-picker.d.ts +19 -0
  262. package/dist/ui/name-picker.d.ts.map +1 -0
  263. package/dist/ui/name-picker.js +173 -0
  264. package/dist/ui/name-picker.js.map +1 -0
  265. package/dist/ui/project-picker.d.ts +27 -0
  266. package/dist/ui/project-picker.d.ts.map +1 -0
  267. package/dist/ui/project-picker.js +58 -0
  268. package/dist/ui/project-picker.js.map +1 -0
  269. package/dist/utils/config.d.ts +24 -0
  270. package/dist/utils/config.d.ts.map +1 -0
  271. package/dist/utils/config.js +63 -0
  272. package/dist/utils/config.js.map +1 -0
  273. package/dist/utils/logger.d.ts +32 -0
  274. package/dist/utils/logger.d.ts.map +1 -0
  275. package/dist/utils/logger.js +60 -0
  276. package/dist/utils/logger.js.map +1 -0
  277. package/dist/utils/name-generator.d.ts +20 -0
  278. package/dist/utils/name-generator.d.ts.map +1 -0
  279. package/dist/utils/name-generator.js +183 -0
  280. package/dist/utils/name-generator.js.map +1 -0
  281. package/dist/utils/paths.d.ts +132 -0
  282. package/dist/utils/paths.d.ts.map +1 -0
  283. package/dist/utils/paths.js +412 -0
  284. package/dist/utils/paths.js.map +1 -0
  285. package/dist/utils/status-line.d.ts +14 -0
  286. package/dist/utils/status-line.d.ts.map +1 -0
  287. package/dist/utils/status-line.js +36 -0
  288. package/dist/utils/status-line.js.map +1 -0
  289. package/dist/utils/terminal-symbols.d.ts +50 -0
  290. package/dist/utils/terminal-symbols.d.ts.map +1 -0
  291. package/dist/utils/terminal-symbols.js +97 -0
  292. package/dist/utils/terminal-symbols.js.map +1 -0
  293. package/dist/utils/timer.d.ts +17 -0
  294. package/dist/utils/timer.d.ts.map +1 -0
  295. package/dist/utils/timer.js +56 -0
  296. package/dist/utils/timer.js.map +1 -0
  297. package/dist/utils/validation.d.ts +17 -0
  298. package/dist/utils/validation.d.ts.map +1 -0
  299. package/dist/utils/validation.js +106 -0
  300. package/dist/utils/validation.js.map +1 -0
  301. package/dist/utils/version.d.ts +2 -0
  302. package/dist/utils/version.d.ts.map +1 -0
  303. package/dist/utils/version.js +12 -0
  304. package/dist/utils/version.js.map +1 -0
  305. package/jest.config.ts +30 -0
  306. package/package.json +55 -0
  307. package/src/commands/do.ts +829 -0
  308. package/src/commands/plan.ts +422 -0
  309. package/src/commands/status.ts +146 -0
  310. package/src/core/claude-runner.ts +374 -0
  311. package/src/core/editor.ts +85 -0
  312. package/src/core/failure-analyzer.ts +372 -0
  313. package/src/core/git.ts +166 -0
  314. package/src/core/project-manager.ts +243 -0
  315. package/src/core/retry-handler.ts +72 -0
  316. package/src/core/shutdown-handler.ts +93 -0
  317. package/src/core/state-derivation.ts +343 -0
  318. package/src/index.ts +20 -0
  319. package/src/parsers/output-parser.ts +164 -0
  320. package/src/prompts/amend.ts +194 -0
  321. package/src/prompts/execution.ts +223 -0
  322. package/src/prompts/planning.ts +175 -0
  323. package/src/types/config.ts +35 -0
  324. package/src/ui/name-picker-subprocess.ts +96 -0
  325. package/src/ui/name-picker.ts +198 -0
  326. package/src/ui/project-picker.ts +80 -0
  327. package/src/utils/config.ts +69 -0
  328. package/src/utils/logger.ts +81 -0
  329. package/src/utils/name-generator.ts +211 -0
  330. package/src/utils/paths.ts +497 -0
  331. package/src/utils/status-line.ts +45 -0
  332. package/src/utils/terminal-symbols.ts +124 -0
  333. package/src/utils/timer.ts +64 -0
  334. package/src/utils/validation.ts +132 -0
  335. package/src/utils/version.ts +12 -0
  336. package/tests/unit/claude-runner-interactive.test.ts +343 -0
  337. package/tests/unit/claude-runner.test.ts +629 -0
  338. package/tests/unit/command-output.test.ts +295 -0
  339. package/tests/unit/config.test.ts +72 -0
  340. package/tests/unit/dependency-integration.test.ts +559 -0
  341. package/tests/unit/do-blocked-tasks.test.ts +323 -0
  342. package/tests/unit/do-command.test.ts +198 -0
  343. package/tests/unit/do-multiproject.test.ts +270 -0
  344. package/tests/unit/do-rerun.test.ts +270 -0
  345. package/tests/unit/execution-prompt.test.ts +406 -0
  346. package/tests/unit/failure-analyzer.test.ts +276 -0
  347. package/tests/unit/failure-history.test.ts +143 -0
  348. package/tests/unit/git-stash.test.ts +138 -0
  349. package/tests/unit/git.test.ts +80 -0
  350. package/tests/unit/logger.test.ts +132 -0
  351. package/tests/unit/name-generator.test.ts +283 -0
  352. package/tests/unit/name-picker.test.ts +179 -0
  353. package/tests/unit/outcome-content.test.ts +166 -0
  354. package/tests/unit/output-parser.test.ts +178 -0
  355. package/tests/unit/paths.test.ts +741 -0
  356. package/tests/unit/plan-command-amend-flag.test.ts +115 -0
  357. package/tests/unit/plan-command-amend-input.test.ts +156 -0
  358. package/tests/unit/plan-command-auto-flag.test.ts +112 -0
  359. package/tests/unit/plan-command.test.ts +580 -0
  360. package/tests/unit/planning-prompt.test.ts +137 -0
  361. package/tests/unit/project-manager.test.ts +265 -0
  362. package/tests/unit/project-picker.test.ts +338 -0
  363. package/tests/unit/retry-handler.test.ts +89 -0
  364. package/tests/unit/state-derivation.test.ts +714 -0
  365. package/tests/unit/status-command.test.ts +271 -0
  366. package/tests/unit/status-line.test.ts +92 -0
  367. package/tests/unit/terminal-symbols.test.ts +214 -0
  368. package/tests/unit/timer.test.ts +102 -0
  369. package/tests/unit/validation.test.ts +118 -0
  370. package/tsconfig.json +26 -0
@@ -0,0 +1,194 @@
1
+ import { DerivedTask } from '../core/state-derivation.js';
2
+
3
+ export interface AmendPromptParams {
4
+ projectPath: string;
5
+ existingTasks: Array<DerivedTask & { taskName: string }>;
6
+ nextTaskNumber: number;
7
+ newTaskDescription: string;
8
+ }
9
+
10
+ export interface AmendPromptResult {
11
+ systemPrompt: string;
12
+ userMessage: string;
13
+ }
14
+
15
+ /**
16
+ * Generate a prompt for amending an existing project with new tasks.
17
+ * - systemPrompt: Amendment mode conventions, existing tasks context (via --append-system-prompt)
18
+ * - userMessage: Reference to input.md and new task description (via positional argument, triggers Claude to start)
19
+ */
20
+ export function getAmendPrompt(params: AmendPromptParams): AmendPromptResult {
21
+ const {
22
+ projectPath,
23
+ existingTasks,
24
+ nextTaskNumber,
25
+ newTaskDescription,
26
+ } = params;
27
+
28
+ const existingTasksSummary = existingTasks
29
+ .map((task) => {
30
+ const status =
31
+ task.status === 'completed'
32
+ ? '[COMPLETED]'
33
+ : task.status === 'failed'
34
+ ? '[FAILED]'
35
+ : '[PENDING]';
36
+ const modifiability =
37
+ task.status === 'completed' ? '[PROTECTED]' : '[MODIFIABLE]';
38
+ return `- Task ${task.id}: ${task.taskName} ${status} ${modifiability}`;
39
+ })
40
+ .join('\n');
41
+
42
+ const protectedTasks = existingTasks.filter((t) => t.status === 'completed');
43
+ const modifiableTasks = existingTasks.filter((t) => t.status !== 'completed');
44
+
45
+ const protectedTasksList =
46
+ protectedTasks.length > 0
47
+ ? protectedTasks.map((t) => `- Task ${t.id}: ${t.taskName}`).join('\n')
48
+ : '(none)';
49
+ const modifiableTasksList =
50
+ modifiableTasks.length > 0
51
+ ? modifiableTasks.map((t) => `- Task ${t.id}: ${t.taskName}`).join('\n')
52
+ : '(none)';
53
+
54
+ const systemPrompt = `You are a project planning assistant for RAF (Ralph's Automation Framework). Your task is to ADD NEW TASKS or MODIFY PENDING tasks in an existing project.
55
+
56
+ ## IMPORTANT: Amendment Mode
57
+
58
+ You are in AMENDMENT MODE. This means:
59
+ - You MAY modify [MODIFIABLE] tasks (pending/failed) if the user requests changes
60
+ - NEVER modify [PROTECTED] tasks (completed) - their outcomes depend on the original plan
61
+ - DO NOT renumber existing tasks
62
+ - You can create NEW tasks starting from number ${nextTaskNumber.toString().padStart(3, '0')}
63
+
64
+ ## Project Location
65
+
66
+ Project folder: ${projectPath}
67
+
68
+ ## Existing Tasks
69
+
70
+ The following tasks already exist in this project:
71
+
72
+ ${existingTasksSummary}
73
+
74
+ ### Protected Tasks (COMPLETED - cannot be modified)
75
+ ${protectedTasksList}
76
+
77
+ ### Modifiable Tasks (PENDING/FAILED - can be modified if requested)
78
+ ${modifiableTasksList}
79
+
80
+ ## Instructions
81
+
82
+ ### Step 1: Read Context
83
+
84
+ First, read the original project description from:
85
+ - ${projectPath}/input.md
86
+
87
+ And review existing decisions from:
88
+ - ${projectPath}/decisions.md (if it exists)
89
+
90
+ ### Step 2: Analyze New Requirements
91
+
92
+ Read the user's description of new tasks and identify what needs to be added. Consider:
93
+ - How the new tasks relate to existing ones
94
+ - Dependencies on completed tasks (check the ## Dependencies section in existing plan files)
95
+ - Whether new tasks should reference existing task outcomes
96
+
97
+ ### Step 3: Interview the User
98
+
99
+ For EACH new task you identify, use the AskUserQuestion tool to gather:
100
+ - Specific requirements and constraints
101
+ - Technology preferences
102
+ - Any existing code or patterns to follow
103
+ - Edge cases to handle
104
+
105
+ ### Step 3.5: Record Decisions
106
+
107
+ After EACH interview question is answered, append the Q&A pair to the existing decisions file:
108
+ - ${projectPath}/decisions.md
109
+
110
+ Use this format:
111
+ \`\`\`markdown
112
+ ## [Amendment] [Question asked]
113
+ [User's answer]
114
+ \`\`\`
115
+
116
+ ### Step 4: Create New Plan Files
117
+
118
+ After interviewing the user about all NEW tasks, create plan files starting from the next available number:
119
+ - ${projectPath}/plans/${nextTaskNumber.toString().padStart(3, '0')}-task-name.md
120
+ - ${projectPath}/plans/${(nextTaskNumber + 1).toString().padStart(3, '0')}-task-name.md
121
+ - etc.
122
+
123
+ Each plan file should follow this structure:
124
+
125
+ \`\`\`markdown
126
+ # Task: [Task Name]
127
+
128
+ ## Objective
129
+ [Clear, one-sentence description of what this task accomplishes]
130
+
131
+ ## Context
132
+ [Why this task is needed, how it fits into the larger project]
133
+ [Reference relevant existing tasks if applicable]
134
+
135
+ ## Dependencies
136
+ [Optional section - omit if task has no dependencies]
137
+ [Comma-separated list of task IDs this task depends on, e.g., "001, 002"]
138
+ [If a dependency fails, this task will be automatically blocked]
139
+
140
+ ## Requirements
141
+ [Specific requirements gathered from the user interview]
142
+ - Requirement 1
143
+ - Requirement 2
144
+ - ...
145
+
146
+ ## Implementation Steps
147
+ 1. [Step 1]
148
+ 2. [Step 2]
149
+ 3. [Step 3]
150
+ ...
151
+
152
+ ## Acceptance Criteria
153
+ - [ ] Criterion 1
154
+ - [ ] Criterion 2
155
+ - [ ] All tests pass
156
+
157
+ ## Notes
158
+ [Any additional context, warnings, or considerations]
159
+ [Reference to existing task outcomes if relevant]
160
+ \`\`\`
161
+
162
+ ### Step 5: Confirm Completion
163
+
164
+ After creating all new plan files:
165
+ 1. Provide a summary of:
166
+ - The new tasks you've created
167
+ - How they relate to existing tasks
168
+ - Total task count in the project
169
+ 2. Display this exit message to the user:
170
+
171
+ \`\`\`
172
+ Planning complete! Press Ctrl-C twice to exit to exit this session
173
+ \`\`\`
174
+
175
+ ## Important Rules
176
+
177
+ 1. NEVER modify COMPLETED task plans - they are [PROTECTED] because their outcomes depend on the original plan
178
+ 2. You MAY modify non-completed task plans (pending/failed) if the user requests changes - they are [MODIFIABLE]
179
+ 3. ALWAYS interview the user before creating or modifying plans
180
+ 4. New tasks start from number ${nextTaskNumber.toString().padStart(3, '0')}
181
+ 5. Use descriptive, kebab-case names for plan files
182
+ 6. Each plan should be self-contained with all context needed
183
+ 7. Specify task dependencies using the ## Dependencies section with task IDs only (e.g., "001, 002")
184
+ 8. Tasks without dependencies should omit the Dependencies section entirely
185
+ 9. Be specific - vague plans lead to poor execution`;
186
+
187
+ const userMessage = `I want to add the following new tasks to this project:
188
+
189
+ ${newTaskDescription}
190
+
191
+ Please analyze this and start the planning interview for the new tasks.`;
192
+
193
+ return { systemPrompt, userMessage };
194
+ }
@@ -0,0 +1,223 @@
1
+ /**
2
+ * Maximum characters for a dependency outcome summary.
3
+ * Outcomes larger than this will be truncated to avoid context bloat.
4
+ */
5
+ const MAX_DEPENDENCY_OUTCOME_CHARS = 4000;
6
+
7
+ /**
8
+ * Summarize an outcome for dependency context.
9
+ * Extracts the key sections (Summary, Key Changes, Notes) and truncates if needed.
10
+ */
11
+ export function summarizeOutcome(content: string): string {
12
+ // If content is small enough, return as-is
13
+ if (content.length <= MAX_DEPENDENCY_OUTCOME_CHARS) {
14
+ return content;
15
+ }
16
+
17
+ // Try to extract just the Summary section
18
+ const summaryMatch = content.match(/^## Summary\s*\n([\s\S]*?)(?=\n## |$)/m);
19
+ if (summaryMatch && summaryMatch[1]) {
20
+ const summary = summaryMatch[1].trim();
21
+ if (summary.length > 0 && summary.length <= MAX_DEPENDENCY_OUTCOME_CHARS) {
22
+ return `## Summary\n\n${summary}\n\n*[Outcome truncated for context size]*`;
23
+ }
24
+ }
25
+
26
+ // Fallback: truncate the full content
27
+ const truncated = content.substring(0, MAX_DEPENDENCY_OUTCOME_CHARS);
28
+ // Find a good break point (newline or period)
29
+ const lastNewline = truncated.lastIndexOf('\n');
30
+ const lastPeriod = truncated.lastIndexOf('. ');
31
+ const breakPoint = Math.max(lastNewline, lastPeriod);
32
+
33
+ if (breakPoint > MAX_DEPENDENCY_OUTCOME_CHARS / 2) {
34
+ return truncated.substring(0, breakPoint + 1) + '\n\n*[Outcome truncated for context size]*';
35
+ }
36
+
37
+ return truncated + '\n\n*[Outcome truncated for context size]*';
38
+ }
39
+
40
+ export interface ExecutionPromptParams {
41
+ projectPath: string;
42
+ planPath: string;
43
+ taskId: string;
44
+ taskNumber: number;
45
+ totalTasks: number;
46
+ previousOutcomes: Array<{ taskId: string; content: string }>;
47
+ autoCommit: boolean;
48
+ projectNumber: string;
49
+ outcomeFilePath: string;
50
+ attemptNumber?: number;
51
+ previousOutcomeFile?: string;
52
+ /** Task IDs that this task depends on */
53
+ dependencyIds?: string[];
54
+ /** Outcomes of dependency tasks, keyed by task ID */
55
+ dependencyOutcomes?: Array<{ taskId: string; content: string }>;
56
+ }
57
+
58
+ export function getExecutionPrompt(params: ExecutionPromptParams): string {
59
+ const {
60
+ projectPath,
61
+ planPath,
62
+ taskId,
63
+ taskNumber,
64
+ totalTasks,
65
+ previousOutcomes,
66
+ autoCommit,
67
+ projectNumber,
68
+ outcomeFilePath,
69
+ attemptNumber = 1,
70
+ previousOutcomeFile,
71
+ dependencyIds = [],
72
+ dependencyOutcomes = [],
73
+ } = params;
74
+
75
+ let outcomesSection = '';
76
+ if (previousOutcomes.length > 0) {
77
+ outcomesSection = `
78
+ ## Previous Task Outcomes
79
+
80
+ The following tasks have already been completed. Review them for context and to avoid duplication:
81
+
82
+ ${previousOutcomes.map((o) => `### Task ${o.taskId}\n${o.content}`).join('\n\n')}
83
+ `;
84
+ }
85
+
86
+ // Zero-pad task number to 3 digits
87
+ const paddedTaskNumber = taskNumber.toString().padStart(3, '0');
88
+
89
+ const commitInstructions = autoCommit
90
+ ? `
91
+ ## Git Instructions
92
+
93
+ After successfully completing the task:
94
+ 1. Stage all changes with \`git add -A\`
95
+ - This includes any new plan files in the \`plans/\` folder
96
+ 2. Commit with message: "RAF[${projectNumber}:${paddedTaskNumber}] <description>"
97
+ - Write a concise description of what was accomplished
98
+ - Focus on the actual change, not the task name
99
+
100
+ **IMPORTANT - On Failure**: If the task fails, do NOT commit. Just write the outcome file with the \`<promise>FAILED</promise>\` marker and stop. Uncommitted changes will be preserved for debugging.
101
+ `
102
+ : '';
103
+
104
+ // Generate retry context section for attempt 2+
105
+ let retryContextSection = '';
106
+ if (attemptNumber > 1 && previousOutcomeFile) {
107
+ retryContextSection = `
108
+ ## Retry Context
109
+
110
+ This is attempt ${attemptNumber} at executing this task. The previous attempt produced an outcome file that you should review before starting.
111
+
112
+ **Previous outcome file**: ${previousOutcomeFile}
113
+
114
+ Please:
115
+ 1. Read the previous outcome file first
116
+ 2. Understand what was attempted and why it failed
117
+ 3. Account for the previous failure in your approach
118
+ 4. Avoid making the same mistakes
119
+ `;
120
+ }
121
+
122
+ // Generate dependency context section if task has dependencies
123
+ let dependencyContextSection = '';
124
+ if (dependencyIds.length > 0 && dependencyOutcomes.length > 0) {
125
+ const depOutcomesFormatted = dependencyOutcomes.map((o) => {
126
+ const summarized = summarizeOutcome(o.content);
127
+ return `### Task ${o.taskId}\n${summarized}`;
128
+ }).join('\n\n');
129
+
130
+ dependencyContextSection = `
131
+ ## Dependency Context
132
+
133
+ This task depends on the following completed tasks. Review their outcomes to understand what was accomplished and build upon their work:
134
+
135
+ **Dependencies**: ${dependencyIds.join(', ')}
136
+
137
+ ${depOutcomesFormatted}
138
+ `;
139
+ }
140
+
141
+ return `You are executing a planned task for RAF (Ralph's Automation Framework).
142
+
143
+ ## Task Information
144
+
145
+ - Task: ${taskNumber} of ${totalTasks}
146
+ - Task ID: ${taskId}
147
+ - Project folder: ${projectPath}
148
+
149
+ ## Your Mission
150
+
151
+ 1. Read the plan file at: ${planPath}
152
+ 2. Execute the task according to the plan
153
+ 3. Verify all acceptance criteria are met
154
+ 4. Signal completion with the appropriate marker
155
+
156
+ ## Instructions
157
+ ${retryContextSection}
158
+ ### Step 1: Read the Plan
159
+
160
+ First, read the plan file to understand exactly what needs to be done.
161
+
162
+ ### Step 2: Execute the Task
163
+
164
+ Follow the implementation steps in the plan. Key guidelines:
165
+ - Write clean, maintainable code
166
+ - Follow existing code patterns in the project
167
+ - Add appropriate error handling
168
+ - Write tests if specified in the plan
169
+ - Follow any CLAUDE.md instructions if present
170
+ ${dependencyContextSection}${outcomesSection}
171
+ ### Step 3: Verify Completion
172
+
173
+ Before marking the task complete:
174
+ - Check all acceptance criteria from the plan
175
+ - Run any relevant tests
176
+ - Ensure no regressions were introduced
177
+ ${commitInstructions}
178
+ ### Step 4: Write Outcome File
179
+
180
+ **CRITICAL**: You MUST write an outcome file to document what was accomplished.
181
+
182
+ **Outcome file path**: \`${outcomeFilePath}\`
183
+
184
+ The outcome file should contain:
185
+ 1. A summary of what was done
186
+ 2. Key changes made (files modified, features added, etc.)
187
+ 3. Any important notes or follow-up items
188
+ 4. The completion marker as the LAST line
189
+
190
+ **For code tasks**: Summarize what was changed and why
191
+ **For documentation/report tasks**: The outcome IS the deliverable - include the full content
192
+
193
+ **CRITICAL**: The outcome file MUST end with one of these markers:
194
+
195
+ If the task was completed successfully, end the file with:
196
+ \`\`\`
197
+ <promise>COMPLETE</promise>
198
+ \`\`\`
199
+
200
+ If the task failed and cannot be completed, end the file with:
201
+ \`\`\`
202
+ <promise>FAILED</promise>
203
+ Reason: [explain why the task failed]
204
+ \`\`\`
205
+
206
+ ## Important Rules
207
+
208
+ 1. ALWAYS read the plan file first
209
+ 2. Follow the plan precisely
210
+ 3. Do not skip any acceptance criteria
211
+ 4. If you encounter blockers, try to resolve them
212
+ 5. The outcome file MUST contain EXACTLY ONE completion marker
213
+ 6. The completion marker MUST be the LAST line in the outcome file
214
+ 7. On SUCCESS: Commit code changes AND outcome file together BEFORE you finish
215
+ 8. On FAILURE: Do NOT commit - just write the outcome file with FAILED marker
216
+
217
+ ## Error Handling
218
+
219
+ If you encounter errors:
220
+ - Try to fix them yourself first
221
+ - If an error prevents completion, write the outcome file with FAILED status and a clear reason
222
+ - Do not mark COMPLETE if there are failing tests or unmet criteria`;
223
+ }
@@ -0,0 +1,175 @@
1
+ export interface PlanningPromptParams {
2
+ projectPath: string;
3
+ inputContent: string;
4
+ }
5
+
6
+ export interface PlanningPromptResult {
7
+ systemPrompt: string;
8
+ userMessage: string;
9
+ }
10
+
11
+ /**
12
+ * Generate the planning prompt with system instructions and user message separated.
13
+ * - systemPrompt: RAF planning conventions, file structure, interview process (via --append-system-prompt)
14
+ * - userMessage: Reference to input.md file (via positional argument, triggers Claude to start)
15
+ */
16
+ export function getPlanningPrompt(params: PlanningPromptParams): PlanningPromptResult {
17
+ const { projectPath } = params;
18
+
19
+ const systemPrompt = `You are a project planning assistant for RAF (Ralph's Automation Framework). Your task is to analyze the user's project description and create detailed task plans.
20
+
21
+ ## Your Goals
22
+
23
+ 1. **Analyze the input** and identify 3-8 distinct, actionable tasks
24
+ 2. **Interview the user** about EACH task to gather specific requirements
25
+ 3. **Create plan files** for each task with clear instructions
26
+
27
+ ## Project Location
28
+
29
+ Project folder: ${projectPath}
30
+
31
+ ## Instructions
32
+
33
+ ### Step 1: Identify and Order Tasks
34
+
35
+ Based on the project description, identify 3-8 distinct tasks. Each task should:
36
+ - Be independently completable
37
+ - Have a clear outcome
38
+ - Take roughly 10-30 minutes of work for Claude
39
+
40
+ **CRITICAL: Order tasks by logical execution order.** Lower-numbered tasks should be completed before higher-numbered ones. Consider:
41
+ - Setup/foundation tasks come first (e.g., defining schemas, creating interfaces)
42
+ - Core implementation tasks come next
43
+ - Integration and extension tasks come later
44
+ - Testing and validation tasks typically come last
45
+
46
+ ### Step 2: Interview the User
47
+
48
+ For EACH task you identify, you MUST use the AskUserQuestion tool to gather:
49
+ - Specific requirements and constraints
50
+ - Technology preferences
51
+ - Any existing code or patterns to follow
52
+ - Edge cases to handle
53
+
54
+ DO NOT skip the interview step. The quality of your plans depends on understanding the user's exact needs.
55
+
56
+ ### Step 2.5: Record Decisions
57
+
58
+ After EACH interview question is answered, record the Q&A pair in the decisions file:
59
+ - ${projectPath}/decisions.md
60
+
61
+ Use this format:
62
+ \`\`\`markdown
63
+ # Project Decisions
64
+
65
+ ## [Question asked]
66
+ [User's answer]
67
+
68
+ ## [Question asked]
69
+ [User's answer]
70
+ \`\`\`
71
+
72
+ This file serves as documentation of design choices made during planning. Append each new Q&A pair as you conduct the interview.
73
+
74
+ ### Step 3: Create Plan Files
75
+
76
+ After interviewing the user about all tasks, create plan files in the plans folder:
77
+ - ${projectPath}/plans/001-task-name.md
78
+ - ${projectPath}/plans/002-task-name.md
79
+ - etc.
80
+
81
+ Each plan file should follow this structure:
82
+
83
+ \`\`\`markdown
84
+ # Task: [Task Name]
85
+
86
+ ## Objective
87
+ [Clear, one-sentence description of what this task accomplishes]
88
+
89
+ ## Context
90
+ [Why this task is needed, how it fits into the larger project]
91
+
92
+ ## Dependencies
93
+ [Optional section - omit if task has no dependencies]
94
+ [Comma-separated list of task IDs this task depends on, e.g., "001, 002"]
95
+ [If a dependency fails, this task will be automatically blocked]
96
+
97
+ ## Requirements
98
+ [Specific requirements gathered from the user interview]
99
+ - Requirement 1
100
+ - Requirement 2
101
+ - ...
102
+
103
+ ## Implementation Steps
104
+ 1. [Step 1]
105
+ 2. [Step 2]
106
+ 3. [Step 3]
107
+ ...
108
+
109
+ ## Acceptance Criteria
110
+ - [ ] Criterion 1
111
+ - [ ] Criterion 2
112
+ - [ ] All tests pass
113
+
114
+ ## Notes
115
+ [Any additional context, warnings, or considerations]
116
+ \`\`\`
117
+
118
+ ### Step 4: Infer Task Dependencies
119
+
120
+ For each task, analyze which other tasks must complete successfully before it can begin. Add a \`## Dependencies\` section to plan files that have prerequisites.
121
+
122
+ **How to identify dependencies:**
123
+ - If task B uses output/artifacts from task A → B depends on A
124
+ - If task B modifies code created by task A → B depends on A
125
+ - If task B tests functionality from task A → B depends on A
126
+ - If task B extends or builds upon task A → B depends on A
127
+
128
+ **Dependency format examples:**
129
+ \`\`\`markdown
130
+ ## Dependencies
131
+ 001
132
+ \`\`\`
133
+ or for multiple dependencies:
134
+ \`\`\`markdown
135
+ ## Dependencies
136
+ 001, 002
137
+ \`\`\`
138
+
139
+ **Rules for dependencies:**
140
+ - Only reference lower-numbered tasks (tasks are ordered by execution order)
141
+ - Omit the Dependencies section entirely if a task has no prerequisites
142
+ - Keep dependency lists minimal - only direct dependencies, not transitive ones
143
+ - Never create circular dependencies (impossible if you only reference lower-numbered tasks)
144
+
145
+ ### Step 5: Confirm Completion
146
+
147
+ After creating all plan files:
148
+ 1. Provide a summary of the tasks you've created
149
+ 2. Display this exit message to the user:
150
+
151
+ \`\`\`
152
+ Planning complete! To exit this session and run your tasks:
153
+ 1. Press Ctrl-C twice to exit
154
+ 2. Then run: raf do <project>
155
+ \`\`\`
156
+
157
+ ## Important Rules
158
+
159
+ 1. ALWAYS interview the user before creating plans
160
+ 2. Create plans in numbered order (001, 002, 003, etc.) reflecting logical execution order
161
+ 3. Use descriptive, kebab-case names for plan files
162
+ 4. Each plan should be self-contained with all context needed
163
+ 5. Infer dependencies automatically - analyze task relationships, don't ask the user about dependencies
164
+ 6. Only add Dependencies section when a task genuinely requires another to complete first
165
+ 7. Dependencies must only reference lower-numbered tasks to prevent circular dependencies
166
+ 8. Be specific - vague plans lead to poor execution`;
167
+
168
+ const userMessage = `Here is my project description:
169
+
170
+ ${params.inputContent}
171
+
172
+ Please analyze this and start the planning interview.`;
173
+
174
+ return { systemPrompt, userMessage };
175
+ }
@@ -0,0 +1,35 @@
1
+ export interface RafConfig {
2
+ defaultTimeout: number;
3
+ defaultMaxRetries: number;
4
+ autoCommit: boolean;
5
+ claudeCommand: string;
6
+ editor?: string;
7
+ }
8
+
9
+ export const DEFAULT_RAF_CONFIG: RafConfig = {
10
+ defaultTimeout: 60,
11
+ defaultMaxRetries: 3,
12
+ autoCommit: true,
13
+ claudeCommand: 'claude',
14
+ };
15
+
16
+ export type ClaudeModelName = 'sonnet' | 'haiku' | 'opus';
17
+
18
+ export interface PlanCommandOptions {
19
+ projectName?: string;
20
+ model?: ClaudeModelName;
21
+ sonnet?: boolean;
22
+ }
23
+
24
+ export interface DoCommandOptions {
25
+ timeout?: number;
26
+ verbose?: boolean;
27
+ debug?: boolean;
28
+ force?: boolean;
29
+ model?: ClaudeModelName;
30
+ sonnet?: boolean;
31
+ }
32
+
33
+ export interface StatusCommandOptions {
34
+ json?: boolean;
35
+ }