rafcode 1.2.0 → 2.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.
- package/CLAUDE.md +118 -22
- package/RAF/aaaabt-verbose-chronicle/decisions.md +25 -0
- package/RAF/aaaabt-verbose-chronicle/input.md +3 -0
- package/RAF/aaaabt-verbose-chronicle/outcomes/01-amend-iteration-references.md +25 -0
- package/RAF/aaaabt-verbose-chronicle/outcomes/02-verbose-task-name-display.md +31 -0
- package/RAF/aaaabt-verbose-chronicle/outcomes/03-verbose-streaming-fix.md +48 -0
- package/RAF/aaaabt-verbose-chronicle/outcomes/04-commit-verification-before-halt.md +56 -0
- package/RAF/aaaabt-verbose-chronicle/plans/01-amend-iteration-references.md +35 -0
- package/RAF/aaaabt-verbose-chronicle/plans/02-verbose-task-name-display.md +38 -0
- package/RAF/aaaabt-verbose-chronicle/plans/03-verbose-streaming-fix.md +45 -0
- package/RAF/aaaabt-verbose-chronicle/plans/04-commit-verification-before-halt.md +62 -0
- package/RAF/aaaacu-worktree-weaver/decisions.md +88 -0
- package/RAF/aaaacu-worktree-weaver/input.md +27 -0
- package/RAF/aaaacu-worktree-weaver/outcomes/01-git-worktree-utilities.md +41 -0
- package/RAF/aaaacu-worktree-weaver/outcomes/02-worktree-plan-command.md +44 -0
- package/RAF/aaaacu-worktree-weaver/outcomes/03-worktree-do-command.md +58 -0
- package/RAF/aaaacu-worktree-weaver/outcomes/04-auto-merge-and-cleanup.md +40 -0
- package/RAF/aaaacu-worktree-weaver/outcomes/05-worktree-tests.md +43 -0
- package/RAF/aaaacu-worktree-weaver/outcomes/06-update-documentation.md +33 -0
- package/RAF/aaaacu-worktree-weaver/plans/01-git-worktree-utilities.md +51 -0
- package/RAF/aaaacu-worktree-weaver/plans/02-worktree-plan-command.md +93 -0
- package/RAF/aaaacu-worktree-weaver/plans/03-worktree-do-command.md +81 -0
- package/RAF/aaaacu-worktree-weaver/plans/04-auto-merge-and-cleanup.md +51 -0
- package/RAF/aaaacu-worktree-weaver/plans/05-worktree-tests.md +52 -0
- package/RAF/aaaacu-worktree-weaver/plans/06-update-documentation.md +55 -0
- package/RAF/aaaacv-trim-the-fat/decisions.md +34 -0
- package/RAF/aaaacv-trim-the-fat/input.md +5 -0
- package/RAF/aaaacv-trim-the-fat/outcomes/01-add-worktree-support-to-status.md +43 -0
- package/RAF/aaaacv-trim-the-fat/outcomes/02-remove-multi-project-from-do.md +50 -0
- package/RAF/aaaacv-trim-the-fat/outcomes/03-commit-artifacts-on-amend.md +35 -0
- package/RAF/aaaacv-trim-the-fat/outcomes/04-worktree-aware-exit-messages.md +36 -0
- package/RAF/aaaacv-trim-the-fat/plans/01-add-worktree-support-to-status.md +43 -0
- package/RAF/aaaacv-trim-the-fat/plans/02-remove-multi-project-from-do.md +44 -0
- package/RAF/aaaacv-trim-the-fat/plans/03-commit-artifacts-on-amend.md +38 -0
- package/RAF/aaaacv-trim-the-fat/plans/04-worktree-aware-exit-messages.md +38 -0
- package/RAF/aaaacw-prune-cycle/decisions.md +25 -0
- package/RAF/aaaacw-prune-cycle/input.md +5 -0
- package/RAF/aaaacw-prune-cycle/outcomes/01-create-worktree-from-branch.md +32 -0
- package/RAF/aaaacw-prune-cycle/outcomes/02-cleanup-worktree-on-success.md +33 -0
- package/RAF/aaaacw-prune-cycle/outcomes/03-amend-recreate-worktree.md +40 -0
- package/RAF/aaaacw-prune-cycle/plans/01-create-worktree-from-branch.md +31 -0
- package/RAF/aaaacw-prune-cycle/plans/02-cleanup-worktree-on-success.md +38 -0
- package/RAF/aaaacw-prune-cycle/plans/03-amend-recreate-worktree.md +50 -0
- package/RAF/aaaacx-epoch-shift/decisions.md +25 -0
- package/RAF/aaaacx-epoch-shift/input.md +1 -0
- package/RAF/aaaacx-epoch-shift/outcomes/01-epoch-id-generation.md +34 -0
- package/RAF/aaaacx-epoch-shift/outcomes/02-update-pattern-matching.md +32 -0
- package/RAF/aaaacx-epoch-shift/outcomes/03-update-tests.md +59 -0
- package/RAF/aaaacx-epoch-shift/outcomes/04-update-documentation.md +30 -0
- package/RAF/aaaacx-epoch-shift/plans/01-epoch-id-generation.md +40 -0
- package/RAF/aaaacx-epoch-shift/plans/02-update-pattern-matching.md +60 -0
- package/RAF/aaaacx-epoch-shift/plans/03-update-tests.md +48 -0
- package/RAF/aaaacx-epoch-shift/plans/04-update-documentation.md +44 -0
- package/RAF/ahmpro-merge-guardian/decisions.md +25 -0
- package/RAF/ahmpro-merge-guardian/input.md +4 -0
- package/RAF/ahmpro-merge-guardian/outcomes/001-fix-amend-worktree-commit.md +45 -0
- package/RAF/ahmpro-merge-guardian/outcomes/002-base36-task-ids.md +55 -0
- package/RAF/ahmpro-merge-guardian/outcomes/003-worktree-pr-creation.md +41 -0
- package/RAF/ahmpro-merge-guardian/outcomes/004-post-execution-picker.md +53 -0
- package/RAF/ahmpro-merge-guardian/plans/001-fix-amend-worktree-commit.md +39 -0
- package/RAF/ahmpro-merge-guardian/plans/002-base36-task-ids.md +43 -0
- package/RAF/ahmpro-merge-guardian/plans/003-worktree-pr-creation.md +43 -0
- package/RAF/ahmpro-merge-guardian/plans/004-post-execution-picker.md +51 -0
- package/RAF/ahnbcu-letterjam/decisions.md +13 -0
- package/RAF/ahnbcu-letterjam/input.md +3 -0
- package/RAF/ahnbcu-letterjam/outcomes/01-base26-encoding.md +42 -0
- package/RAF/ahnbcu-letterjam/outcomes/02-update-tests.md +38 -0
- package/RAF/ahnbcu-letterjam/outcomes/03-migrate-command.md +51 -0
- package/RAF/ahnbcu-letterjam/outcomes/04-update-documentation.md +29 -0
- package/RAF/ahnbcu-letterjam/plans/01-base26-encoding.md +36 -0
- package/RAF/ahnbcu-letterjam/plans/02-update-tests.md +37 -0
- package/RAF/ahnbcu-letterjam/plans/03-migrate-command.md +49 -0
- package/RAF/ahnbcu-letterjam/plans/04-update-documentation.md +39 -0
- package/RAF/ahnwrk-worktree-weaver/decisions.md +19 -0
- package/RAF/ahnwrk-worktree-weaver/input.md +4 -0
- package/RAF/ahnwrk-worktree-weaver/outcomes/01-remove-co-authored-by.md +20 -0
- package/RAF/ahnwrk-worktree-weaver/outcomes/02-update-task-status-format.md +21 -0
- package/RAF/ahnwrk-worktree-weaver/outcomes/03-worktree-auto-discovery.md +34 -0
- package/RAF/ahnwrk-worktree-weaver/outcomes/04-fix-pr-description.md +30 -0
- package/RAF/ahnwrk-worktree-weaver/plans/01-remove-co-authored-by.md +26 -0
- package/RAF/ahnwrk-worktree-weaver/plans/02-update-task-status-format.md +27 -0
- package/RAF/ahnwrk-worktree-weaver/plans/03-worktree-auto-discovery.md +37 -0
- package/RAF/ahnwrk-worktree-weaver/plans/04-fix-pr-description.md +50 -0
- package/README.md +56 -10
- package/dist/commands/do.d.ts +15 -0
- package/dist/commands/do.d.ts.map +1 -1
- package/dist/commands/do.js +400 -131
- package/dist/commands/do.js.map +1 -1
- package/dist/commands/migrate.d.ts +14 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +228 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/plan.d.ts.map +1 -1
- package/dist/commands/plan.js +237 -40
- package/dist/commands/plan.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +221 -47
- package/dist/commands/status.js.map +1 -1
- package/dist/core/claude-runner.d.ts +52 -1
- package/dist/core/claude-runner.d.ts.map +1 -1
- package/dist/core/claude-runner.js +195 -17
- package/dist/core/claude-runner.js.map +1 -1
- package/dist/core/git.d.ts +29 -5
- package/dist/core/git.d.ts.map +1 -1
- package/dist/core/git.js +95 -18
- package/dist/core/git.js.map +1 -1
- package/dist/core/project-manager.d.ts.map +1 -1
- package/dist/core/project-manager.js +2 -2
- package/dist/core/project-manager.js.map +1 -1
- package/dist/core/pull-request.d.ts +84 -0
- package/dist/core/pull-request.d.ts.map +1 -0
- package/dist/core/pull-request.js +414 -0
- package/dist/core/pull-request.js.map +1 -0
- package/dist/core/state-derivation.d.ts +3 -3
- package/dist/core/state-derivation.d.ts.map +1 -1
- package/dist/core/state-derivation.js +18 -14
- package/dist/core/state-derivation.js.map +1 -1
- package/dist/core/worktree.d.ts +120 -0
- package/dist/core/worktree.d.ts.map +1 -0
- package/dist/core/worktree.js +322 -0
- package/dist/core/worktree.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/parsers/stream-renderer.d.ts +42 -0
- package/dist/parsers/stream-renderer.d.ts.map +1 -0
- package/dist/parsers/stream-renderer.js +100 -0
- package/dist/parsers/stream-renderer.js.map +1 -0
- package/dist/prompts/amend.d.ts +1 -0
- package/dist/prompts/amend.d.ts.map +1 -1
- package/dist/prompts/amend.js +25 -10
- package/dist/prompts/amend.js.map +1 -1
- package/dist/prompts/execution.js +5 -5
- package/dist/prompts/execution.js.map +1 -1
- package/dist/prompts/planning.d.ts +1 -0
- package/dist/prompts/planning.d.ts.map +1 -1
- package/dist/prompts/planning.js +11 -10
- package/dist/prompts/planning.js.map +1 -1
- package/dist/types/config.d.ts +5 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/ui/project-picker.d.ts +34 -3
- package/dist/ui/project-picker.d.ts.map +1 -1
- package/dist/ui/project-picker.js +78 -10
- package/dist/ui/project-picker.js.map +1 -1
- package/dist/utils/paths.d.ts +38 -43
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +123 -193
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/terminal-symbols.d.ts +2 -2
- package/dist/utils/terminal-symbols.js +3 -3
- package/dist/utils/terminal-symbols.js.map +1 -1
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +2 -8
- package/dist/utils/validation.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/do.ts +471 -142
- package/src/commands/migrate.ts +269 -0
- package/src/commands/plan.ts +264 -40
- package/src/commands/status.ts +252 -45
- package/src/core/claude-runner.ts +270 -17
- package/src/core/git.ts +99 -19
- package/src/core/project-manager.ts +2 -1
- package/src/core/pull-request.ts +480 -0
- package/src/core/state-derivation.ts +18 -14
- package/src/core/worktree.ts +357 -0
- package/src/index.ts +2 -0
- package/src/parsers/stream-renderer.ts +139 -0
- package/src/prompts/amend.ts +27 -9
- package/src/prompts/execution.ts +5 -5
- package/src/prompts/planning.ts +12 -10
- package/src/types/config.ts +6 -0
- package/src/ui/project-picker.ts +110 -10
- package/src/utils/paths.ts +129 -214
- package/src/utils/terminal-symbols.ts +3 -3
- package/src/utils/validation.ts +2 -9
- package/tests/unit/amend-prompt.test.ts +85 -0
- package/tests/unit/claude-runner.test.ts +567 -1
- package/tests/unit/commit-planning-artifacts-worktree.test.ts +327 -0
- package/tests/unit/commit-planning-artifacts.test.ts +303 -35
- package/tests/unit/dependency-integration.test.ts +95 -95
- package/tests/unit/do-blocked-tasks.test.ts +53 -53
- package/tests/unit/do-command.test.ts +39 -132
- package/tests/unit/do-rerun.test.ts +65 -65
- package/tests/unit/do-worktree-cleanup.test.ts +151 -0
- package/tests/unit/execution-prompt.test.ts +71 -60
- package/tests/unit/failure-history.test.ts +19 -19
- package/tests/unit/git-commit-helpers.test.ts +103 -0
- package/tests/unit/git-stash.test.ts +4 -4
- package/tests/unit/migrate-command.test.ts +197 -0
- package/tests/unit/outcome-content.test.ts +20 -20
- package/tests/unit/paths.test.ts +269 -467
- package/tests/unit/plan-amend-worktree-recreate.test.ts +246 -0
- package/tests/unit/plan-command.test.ts +144 -93
- package/tests/unit/planning-prompt.test.ts +41 -4
- package/tests/unit/post-execution-picker.test.ts +251 -0
- package/tests/unit/project-manager.test.ts +20 -8
- package/tests/unit/project-picker.test.ts +425 -42
- package/tests/unit/pull-request.test.ts +852 -0
- package/tests/unit/state-derivation.test.ts +138 -137
- package/tests/unit/status-command.test.ts +344 -76
- package/tests/unit/stream-renderer.test.ts +286 -0
- package/tests/unit/terminal-symbols.test.ts +4 -4
- package/tests/unit/worktree-integration.test.ts +405 -0
- package/tests/unit/worktree.test.ts +523 -0
- package/tests/unit/do-multiproject.test.ts +0 -270
- /package/RAF/{001-raf-task-improvements → aaaaab-raf-task-improvements}/input.md +0 -0
- /package/RAF/{001-raf-task-improvements/outcomes/001-add-decisions-folder.md → aaaaab-raf-task-improvements/outcomes/01-add-decisions-folder.md} +0 -0
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /package/RAF/{001-raf-task-improvements → aaaaab-raf-task-improvements}/outcomes/SUMMARY.md +0 -0
- /package/RAF/{001-raf-task-improvements/plans/001-add-decisions-folder.md → aaaaab-raf-task-improvements/plans/01-add-decisions-folder.md} +0 -0
- /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
- /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
- /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
- /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
- /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
- /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
- /package/RAF/{002-raf-task-improvements-execution → aaaaac-raf-task-improvements-execution}/decisions/DECISIONS.md +0 -0
- /package/RAF/{002-raf-task-improvements-execution → aaaaac-raf-task-improvements-execution}/input.md +0 -0
- /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
- /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
- /package/RAF/{002-raf-task-improvements-execution → aaaaac-raf-task-improvements-execution}/outcomes/SUMMARY.md +0 -0
- /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
- /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
- /package/RAF/{003-multi-project-execution → aaaaad-multi-project-execution}/decisions/DECISIONS.md +0 -0
- /package/RAF/{003-multi-project-execution → aaaaad-multi-project-execution}/input.md +0 -0
- /package/RAF/{003-multi-project-execution/outcomes/001-remove-state-json.md → aaaaad-multi-project-execution/outcomes/01-remove-state-json.md} +0 -0
- /package/RAF/{003-multi-project-execution/outcomes/002-update-raf-status.md → aaaaad-multi-project-execution/outcomes/02-update-raf-status.md} +0 -0
- /package/RAF/{003-multi-project-execution/outcomes/003-simplify-git-logic.md → aaaaad-multi-project-execution/outcomes/03-simplify-git-logic.md} +0 -0
- /package/RAF/{003-multi-project-execution/outcomes/004-auto-commit-planning.md → aaaaad-multi-project-execution/outcomes/04-auto-commit-planning.md} +0 -0
- /package/RAF/{003-multi-project-execution/outcomes/005-rerun-failed-tasks.md → aaaaad-multi-project-execution/outcomes/05-rerun-failed-tasks.md} +0 -0
- /package/RAF/{003-multi-project-execution/outcomes/006-multi-project-execution.md → aaaaad-multi-project-execution/outcomes/06-multi-project-execution.md} +0 -0
- /package/RAF/{003-multi-project-execution/outcomes/007-verify-timeout.md → aaaaad-multi-project-execution/outcomes/07-verify-timeout.md} +0 -0
- /package/RAF/{003-multi-project-execution/outcomes/008-move-decisions-file.md → aaaaad-multi-project-execution/outcomes/08-move-decisions-file.md} +0 -0
- /package/RAF/{003-multi-project-execution → aaaaad-multi-project-execution}/outcomes/SUMMARY.md +0 -0
- /package/RAF/{003-multi-project-execution/plans/001-remove-state-json.md → aaaaad-multi-project-execution/plans/01-remove-state-json.md} +0 -0
- /package/RAF/{003-multi-project-execution/plans/002-update-raf-status.md → aaaaad-multi-project-execution/plans/02-update-raf-status.md} +0 -0
- /package/RAF/{003-multi-project-execution/plans/003-simplify-git-logic.md → aaaaad-multi-project-execution/plans/03-simplify-git-logic.md} +0 -0
- /package/RAF/{003-multi-project-execution/plans/004-auto-commit-planning.md → aaaaad-multi-project-execution/plans/04-auto-commit-planning.md} +0 -0
- /package/RAF/{003-multi-project-execution/plans/005-rerun-failed-tasks.md → aaaaad-multi-project-execution/plans/05-rerun-failed-tasks.md} +0 -0
- /package/RAF/{003-multi-project-execution/plans/006-multi-project-execution.md → aaaaad-multi-project-execution/plans/06-multi-project-execution.md} +0 -0
- /package/RAF/{003-multi-project-execution/plans/007-verify-timeout.md → aaaaad-multi-project-execution/plans/07-verify-timeout.md} +0 -0
- /package/RAF/{003-multi-project-execution/plans/008-move-decisions-file.md → aaaaad-multi-project-execution/plans/08-move-decisions-file.md} +0 -0
- /package/RAF/{004-task-naming-optimization → aaaaae-task-naming-optimization}/decisions.md +0 -0
- /package/RAF/{004-task-naming-optimization → aaaaae-task-naming-optimization}/input.md +0 -0
- /package/RAF/{004-task-naming-optimization/outcomes/001-remove-summary-file.md → aaaaae-task-naming-optimization/outcomes/01-remove-summary-file.md} +0 -0
- /package/RAF/{004-task-naming-optimization/outcomes/002-base36-project-numbering.md → aaaaae-task-naming-optimization/outcomes/02-base36-project-numbering.md} +0 -0
- /package/RAF/{004-task-naming-optimization/outcomes/003-improve-haiku-prompt.md → aaaaae-task-naming-optimization/outcomes/03-improve-haiku-prompt.md} +0 -0
- /package/RAF/{004-task-naming-optimization → aaaaae-task-naming-optimization}/outcomes/SUMMARY.md +0 -0
- /package/RAF/{004-task-naming-optimization/plans/001-remove-summary-file.md → aaaaae-task-naming-optimization/plans/01-remove-summary-file.md} +0 -0
- /package/RAF/{004-task-naming-optimization/plans/002-base36-project-numbering.md → aaaaae-task-naming-optimization/plans/02-base36-project-numbering.md} +0 -0
- /package/RAF/{004-task-naming-optimization/plans/003-improve-haiku-prompt.md → aaaaae-task-naming-optimization/plans/03-improve-haiku-prompt.md} +0 -0
- /package/RAF/{005-task-naming-improvements → aaaaaf-task-naming-improvements}/decisions.md +0 -0
- /package/RAF/{005-task-naming-improvements → aaaaaf-task-naming-improvements}/input.md +0 -0
- /package/RAF/{005-task-naming-improvements/outcomes/001-enhance-identifier-resolution.md → aaaaaf-task-naming-improvements/outcomes/01-enhance-identifier-resolution.md} +0 -0
- /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
- /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
- /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
- /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
- /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
- /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
- /package/RAF/{005-task-naming-improvements/outcomes/008-fix-timeout-label.md → aaaaaf-task-naming-improvements/outcomes/08-fix-timeout-label.md} +0 -0
- /package/RAF/{005-task-naming-improvements/plans/001-enhance-identifier-resolution.md → aaaaaf-task-naming-improvements/plans/01-enhance-identifier-resolution.md} +0 -0
- /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
- /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
- /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
- /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
- /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
- /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
- /package/RAF/{005-task-naming-improvements/plans/008-fix-timeout-label.md → aaaaaf-task-naming-improvements/plans/08-fix-timeout-label.md} +0 -0
- /package/RAF/{006-fix-double-summary-headers → aaaaag-fix-double-summary-headers}/decisions.md +0 -0
- /package/RAF/{006-fix-double-summary-headers → aaaaag-fix-double-summary-headers}/input.md +0 -0
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /package/RAF/{007-improve-outcome-format → aaaaah-improve-outcome-format}/decisions.md +0 -0
- /package/RAF/{007-improve-outcome-format → aaaaah-improve-outcome-format}/input.md +0 -0
- /package/RAF/{007-improve-outcome-format/outcomes/001-update-execution-prompt.md → aaaaah-improve-outcome-format/outcomes/01-update-execution-prompt.md} +0 -0
- /package/RAF/{007-improve-outcome-format/outcomes/002-update-state-derivation.md → aaaaah-improve-outcome-format/outcomes/02-update-state-derivation.md} +0 -0
- /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
- /package/RAF/{007-improve-outcome-format/outcomes/004-implement-failure-analysis.md → aaaaah-improve-outcome-format/outcomes/04-implement-failure-analysis.md} +0 -0
- /package/RAF/{007-improve-outcome-format/outcomes/005-update-documentation.md → aaaaah-improve-outcome-format/outcomes/05-update-documentation.md} +0 -0
- /package/RAF/{007-improve-outcome-format/plans/001-update-execution-prompt.md → aaaaah-improve-outcome-format/plans/01-update-execution-prompt.md} +0 -0
- /package/RAF/{007-improve-outcome-format/plans/002-update-state-derivation.md → aaaaah-improve-outcome-format/plans/02-update-state-derivation.md} +0 -0
- /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
- /package/RAF/{007-improve-outcome-format/plans/004-implement-failure-analysis.md → aaaaah-improve-outcome-format/plans/04-implement-failure-analysis.md} +0 -0
- /package/RAF/{007-improve-outcome-format/plans/005-update-documentation.md → aaaaah-improve-outcome-format/plans/05-update-documentation.md} +0 -0
- /package/RAF/{008-beautiful-do → aaaaai-beautiful-do}/decisions.md +0 -0
- /package/RAF/{008-beautiful-do → aaaaai-beautiful-do}/input.md +0 -0
- /package/RAF/{008-beautiful-do/outcomes/001-terminal-symbols.md → aaaaai-beautiful-do/outcomes/01-terminal-symbols.md} +0 -0
- /package/RAF/{008-beautiful-do/outcomes/002-refactor-do-output.md → aaaaai-beautiful-do/outcomes/02-refactor-do-output.md} +0 -0
- /package/RAF/{008-beautiful-do/outcomes/003-refactor-status-output.md → aaaaai-beautiful-do/outcomes/03-refactor-status-output.md} +0 -0
- /package/RAF/{008-beautiful-do/outcomes/004-simplify-logger.md → aaaaai-beautiful-do/outcomes/04-simplify-logger.md} +0 -0
- /package/RAF/{008-beautiful-do/outcomes/005-add-tests.md → aaaaai-beautiful-do/outcomes/05-add-tests.md} +0 -0
- /package/RAF/{008-beautiful-do/plans/001-terminal-symbols.md → aaaaai-beautiful-do/plans/01-terminal-symbols.md} +0 -0
- /package/RAF/{008-beautiful-do/plans/002-refactor-do-output.md → aaaaai-beautiful-do/plans/02-refactor-do-output.md} +0 -0
- /package/RAF/{008-beautiful-do/plans/003-refactor-status-output.md → aaaaai-beautiful-do/plans/03-refactor-status-output.md} +0 -0
- /package/RAF/{008-beautiful-do/plans/004-simplify-logger.md → aaaaai-beautiful-do/plans/04-simplify-logger.md} +0 -0
- /package/RAF/{008-beautiful-do/plans/005-add-tests.md → aaaaai-beautiful-do/plans/05-add-tests.md} +0 -0
- /package/RAF/{009-system-promt-ammend → aaaaaj-system-promt-ammend}/decisions.md +0 -0
- /package/RAF/{009-system-promt-ammend → aaaaaj-system-promt-ammend}/input.md +0 -0
- /package/RAF/{009-system-promt-ammend/outcomes/001-model-override.md → aaaaaj-system-promt-ammend/outcomes/01-model-override.md} +0 -0
- /package/RAF/{009-system-promt-ammend/outcomes/002-system-prompt-append.md → aaaaaj-system-promt-ammend/outcomes/02-system-prompt-append.md} +0 -0
- /package/RAF/{009-system-promt-ammend/outcomes/003-retry-context.md → aaaaaj-system-promt-ammend/outcomes/03-retry-context.md} +0 -0
- /package/RAF/{009-system-promt-ammend/plans/001-model-override.md → aaaaaj-system-promt-ammend/plans/01-model-override.md} +0 -0
- /package/RAF/{009-system-promt-ammend/plans/002-system-prompt-append.md → aaaaaj-system-promt-ammend/plans/02-system-prompt-append.md} +0 -0
- /package/RAF/{009-system-promt-ammend/plans/003-retry-context.md → aaaaaj-system-promt-ammend/plans/03-retry-context.md} +0 -0
- /package/RAF/{010-outcome-marker-fallback → aaaabk-outcome-marker-fallback}/decisions.md +0 -0
- /package/RAF/{010-outcome-marker-fallback → aaaabk-outcome-marker-fallback}/input.md +0 -0
- /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
- /package/RAF/{010-outcome-marker-fallback/outcomes/002-creative-project-naming.md → aaaabk-outcome-marker-fallback/outcomes/02-creative-project-naming.md} +0 -0
- /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
- /package/RAF/{010-outcome-marker-fallback/plans/002-creative-project-naming.md → aaaabk-outcome-marker-fallback/plans/02-creative-project-naming.md} +0 -0
- /package/RAF/{011-do-task-in-commit → aaaabl-do-task-in-commit}/decisions.md +0 -0
- /package/RAF/{011-do-task-in-commit → aaaabl-do-task-in-commit}/input.md +0 -0
- /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
- /package/RAF/{011-do-task-in-commit/outcomes/002-update-tests.md → aaaabl-do-task-in-commit/outcomes/02-update-tests.md} +0 -0
- /package/RAF/{011-do-task-in-commit/outcomes/003-update-documentation.md → aaaabl-do-task-in-commit/outcomes/03-update-documentation.md} +0 -0
- /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
- /package/RAF/{011-do-task-in-commit/plans/002-update-tests.md → aaaabl-do-task-in-commit/plans/02-update-tests.md} +0 -0
- /package/RAF/{011-do-task-in-commit/plans/003-update-documentation.md → aaaabl-do-task-in-commit/plans/03-update-documentation.md} +0 -0
- /package/RAF/{012-name-picker-buffet → aaaabm-name-picker-buffet}/decisions.md +0 -0
- /package/RAF/{012-name-picker-buffet → aaaabm-name-picker-buffet}/input.md +0 -0
- /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
- /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
- /package/RAF/{012-name-picker-buffet/outcomes/003-raf-status-truncation.md → aaaabm-name-picker-buffet/outcomes/03-raf-status-truncation.md} +0 -0
- /package/RAF/{012-name-picker-buffet/outcomes/004-failure-reason-details.md → aaaabm-name-picker-buffet/outcomes/04-failure-reason-details.md} +0 -0
- /package/RAF/{012-name-picker-buffet/outcomes/005-remove-raf-commits.md → aaaabm-name-picker-buffet/outcomes/05-remove-raf-commits.md} +0 -0
- /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
- /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
- /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
- /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
- /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
- /package/RAF/{012-name-picker-buffet/plans/003-raf-status-truncation.md → aaaabm-name-picker-buffet/plans/03-raf-status-truncation.md} +0 -0
- /package/RAF/{012-name-picker-buffet/plans/004-failure-reason-details.md → aaaabm-name-picker-buffet/plans/04-failure-reason-details.md} +0 -0
- /package/RAF/{012-name-picker-buffet/plans/005-remove-raf-commits.md → aaaabm-name-picker-buffet/plans/05-remove-raf-commits.md} +0 -0
- /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
- /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
- /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
- /package/RAF/{013-dependencies-watchdog → aaaabn-dependencies-watchdog}/decisions.md +0 -0
- /package/RAF/{013-dependencies-watchdog → aaaabn-dependencies-watchdog}/input.md +0 -0
- /package/RAF/{013-dependencies-watchdog/outcomes/001-define-dependency-syntax.md → aaaabn-dependencies-watchdog/outcomes/01-define-dependency-syntax.md} +0 -0
- /package/RAF/{013-dependencies-watchdog/outcomes/002-update-planning-prompts.md → aaaabn-dependencies-watchdog/outcomes/02-update-planning-prompts.md} +0 -0
- /package/RAF/{013-dependencies-watchdog/outcomes/003-parse-dependencies-update-state.md → aaaabn-dependencies-watchdog/outcomes/03-parse-dependencies-update-state.md} +0 -0
- /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
- /package/RAF/{013-dependencies-watchdog/outcomes/005-update-execution-prompts.md → aaaabn-dependencies-watchdog/outcomes/05-update-execution-prompts.md} +0 -0
- /package/RAF/{013-dependencies-watchdog/outcomes/006-add-tests.md → aaaabn-dependencies-watchdog/outcomes/06-add-tests.md} +0 -0
- /package/RAF/{013-dependencies-watchdog/outcomes/007-add-act-alias.md → aaaabn-dependencies-watchdog/outcomes/07-add-act-alias.md} +0 -0
- /package/RAF/{013-dependencies-watchdog/outcomes/008-add-exit-message.md → aaaabn-dependencies-watchdog/outcomes/08-add-exit-message.md} +0 -0
- /package/RAF/{013-dependencies-watchdog/plans/001-define-dependency-syntax.md → aaaabn-dependencies-watchdog/plans/01-define-dependency-syntax.md} +0 -0
- /package/RAF/{013-dependencies-watchdog/plans/002-update-planning-prompts.md → aaaabn-dependencies-watchdog/plans/02-update-planning-prompts.md} +0 -0
- /package/RAF/{013-dependencies-watchdog/plans/003-parse-dependencies-update-state.md → aaaabn-dependencies-watchdog/plans/03-parse-dependencies-update-state.md} +0 -0
- /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
- /package/RAF/{013-dependencies-watchdog/plans/005-update-execution-prompts.md → aaaabn-dependencies-watchdog/plans/05-update-execution-prompts.md} +0 -0
- /package/RAF/{013-dependencies-watchdog/plans/006-add-tests.md → aaaabn-dependencies-watchdog/plans/06-add-tests.md} +0 -0
- /package/RAF/{013-dependencies-watchdog/plans/007-add-act-alias.md → aaaabn-dependencies-watchdog/plans/07-add-act-alias.md} +0 -0
- /package/RAF/{013-dependencies-watchdog/plans/008-add-exit-message.md → aaaabn-dependencies-watchdog/plans/08-add-exit-message.md} +0 -0
- /package/RAF/{014-watchdog → aaaabo-watchdog}/decisions.md +0 -0
- /package/RAF/{014-watchdog → aaaabo-watchdog}/input.md +0 -0
- /package/RAF/{014-watchdog/outcomes/001-amend-flag-position.md → aaaabo-watchdog/outcomes/01-amend-flag-position.md} +0 -0
- /package/RAF/{014-watchdog/outcomes/002-details-only-on-failure.md → aaaabo-watchdog/outcomes/02-details-only-on-failure.md} +0 -0
- /package/RAF/{014-watchdog/plans/001-amend-flag-position.md → aaaabo-watchdog/plans/01-amend-flag-position.md} +0 -0
- /package/RAF/{014-watchdog/plans/002-details-only-on-failure.md → aaaabo-watchdog/plans/02-details-only-on-failure.md} +0 -0
- /package/RAF/{015-name-lottery → aaaabp-name-lottery}/decisions.md +0 -0
- /package/RAF/{015-name-lottery → aaaabp-name-lottery}/input.md +0 -0
- /package/RAF/{015-name-lottery/outcomes/001-auto-pick-project-name.md → aaaabp-name-lottery/outcomes/01-auto-pick-project-name.md} +0 -0
- /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
- /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
- /package/RAF/{015-name-lottery/plans/001-auto-pick-project-name.md → aaaabp-name-lottery/plans/01-auto-pick-project-name.md} +0 -0
- /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
- /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
- /package/RAF/{016-planning-scalpel → aaaabq-planning-scalpel}/decisions.md +0 -0
- /package/RAF/{016-planning-scalpel → aaaabq-planning-scalpel}/input.md +0 -0
- /package/RAF/{016-planning-scalpel/outcomes/001-update-git-commit-instructions.md → aaaabq-planning-scalpel/outcomes/01-update-git-commit-instructions.md} +0 -0
- /package/RAF/{016-planning-scalpel/plans/001-update-git-commit-instructions.md → aaaabq-planning-scalpel/plans/01-update-git-commit-instructions.md} +0 -0
- /package/RAF/{017-decision-vault → aaaabr-decision-vault}/decisions.md +0 -0
- /package/RAF/{017-decision-vault → aaaabr-decision-vault}/input.md +0 -0
- /package/RAF/{017-decision-vault/outcomes/001-create-git-commit-utility.md → aaaabr-decision-vault/outcomes/01-create-git-commit-utility.md} +0 -0
- /package/RAF/{017-decision-vault/outcomes/002-integrate-commit-into-plan.md → aaaabr-decision-vault/outcomes/02-integrate-commit-into-plan.md} +0 -0
- /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
- /package/RAF/{017-decision-vault/plans/001-create-git-commit-utility.md → aaaabr-decision-vault/plans/01-create-git-commit-utility.md} +0 -0
- /package/RAF/{017-decision-vault/plans/002-integrate-commit-into-plan.md → aaaabr-decision-vault/plans/02-integrate-commit-into-plan.md} +0 -0
- /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
- /package/RAF/{018-workflow-forge → aaaabs-workflow-forge}/decisions.md +0 -0
- /package/RAF/{018-workflow-forge → aaaabs-workflow-forge}/input.md +0 -0
- /package/RAF/{018-workflow-forge/outcomes/001-add-task-number-progress.md → aaaabs-workflow-forge/outcomes/01-add-task-number-progress.md} +0 -0
- /package/RAF/{018-workflow-forge/outcomes/002-update-plan-do-prompts.md → aaaabs-workflow-forge/outcomes/02-update-plan-do-prompts.md} +0 -0
- /package/RAF/{018-workflow-forge/plans/001-add-task-number-progress.md → aaaabs-workflow-forge/plans/01-add-task-number-progress.md} +0 -0
- /package/RAF/{018-workflow-forge/plans/002-update-plan-do-prompts.md → aaaabs-workflow-forge/plans/02-update-plan-do-prompts.md} +0 -0
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import { execSync } from 'node:child_process';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import * as os from 'node:os';
|
|
4
|
+
import * as path from 'node:path';
|
|
5
|
+
import { logger } from '../utils/logger.js';
|
|
6
|
+
|
|
7
|
+
export interface WorktreeCreateResult {
|
|
8
|
+
success: boolean;
|
|
9
|
+
worktreePath: string;
|
|
10
|
+
branch: string;
|
|
11
|
+
error?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface WorktreeMergeResult {
|
|
15
|
+
success: boolean;
|
|
16
|
+
merged: boolean;
|
|
17
|
+
fastForward: boolean;
|
|
18
|
+
error?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface WorktreeValidation {
|
|
22
|
+
exists: boolean;
|
|
23
|
+
isValidWorktree: boolean;
|
|
24
|
+
hasProjectFolder: boolean;
|
|
25
|
+
hasPlans: boolean;
|
|
26
|
+
projectPath: string | null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get the git toplevel directory (repo root).
|
|
31
|
+
* Returns null if not in a git repo.
|
|
32
|
+
*/
|
|
33
|
+
export function getRepoRoot(): string | null {
|
|
34
|
+
try {
|
|
35
|
+
return execSync('git rev-parse --show-toplevel', { encoding: 'utf-8', stdio: 'pipe' }).trim() || null;
|
|
36
|
+
} catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Get the basename of the repo root directory.
|
|
43
|
+
* E.g., "/Users/me/projects/myapp" -> "myapp"
|
|
44
|
+
* Returns null if not in a git repo.
|
|
45
|
+
*/
|
|
46
|
+
export function getRepoBasename(): string | null {
|
|
47
|
+
const root = getRepoRoot();
|
|
48
|
+
if (!root) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
return path.basename(root);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Get the current branch name.
|
|
56
|
+
* Returns null if not in a git repo or in detached HEAD state.
|
|
57
|
+
*/
|
|
58
|
+
export function getCurrentBranch(): string | null {
|
|
59
|
+
try {
|
|
60
|
+
const branch = execSync('git branch --show-current', { encoding: 'utf-8', stdio: 'pipe' }).trim();
|
|
61
|
+
return branch || null;
|
|
62
|
+
} catch {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Compute the worktree path for a project.
|
|
69
|
+
* Returns `~/.raf/worktrees/<repo-basename>/<project-id>`.
|
|
70
|
+
*
|
|
71
|
+
* @param repoBasename - The basename of the repo root directory
|
|
72
|
+
* @param projectId - The full project folder name (e.g., "020-worktree-weaver")
|
|
73
|
+
*/
|
|
74
|
+
export function computeWorktreePath(repoBasename: string, projectId: string): string {
|
|
75
|
+
return path.join(os.homedir(), '.raf', 'worktrees', repoBasename, projectId);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Compute the worktree base directory for a repo.
|
|
80
|
+
* Returns `~/.raf/worktrees/<repo-basename>/`.
|
|
81
|
+
*
|
|
82
|
+
* @param repoBasename - The basename of the repo root directory
|
|
83
|
+
*/
|
|
84
|
+
export function computeWorktreeBaseDir(repoBasename: string): string {
|
|
85
|
+
return path.join(os.homedir(), '.raf', 'worktrees', repoBasename);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Get the project path inside a worktree.
|
|
90
|
+
* The project folder is at the same relative path from repo root as in the main repo.
|
|
91
|
+
*
|
|
92
|
+
* @param worktreePath - The worktree root directory
|
|
93
|
+
* @param projectRelativePath - The relative path from repo root to the project folder (e.g., "RAF/020-worktree-weaver")
|
|
94
|
+
*/
|
|
95
|
+
export function getWorktreeProjectPath(worktreePath: string, projectRelativePath: string): string {
|
|
96
|
+
return path.join(worktreePath, projectRelativePath);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Create a git worktree at the computed path with a new branch.
|
|
101
|
+
*
|
|
102
|
+
* @param repoBasename - The basename of the repo root directory
|
|
103
|
+
* @param projectId - The full project folder name (used as both directory name and branch name)
|
|
104
|
+
*/
|
|
105
|
+
export function createWorktree(repoBasename: string, projectId: string): WorktreeCreateResult {
|
|
106
|
+
const worktreePath = computeWorktreePath(repoBasename, projectId);
|
|
107
|
+
const branch = projectId;
|
|
108
|
+
|
|
109
|
+
// Ensure parent directory exists
|
|
110
|
+
const baseDir = computeWorktreeBaseDir(repoBasename);
|
|
111
|
+
try {
|
|
112
|
+
fs.mkdirSync(baseDir, { recursive: true });
|
|
113
|
+
} catch (error) {
|
|
114
|
+
return {
|
|
115
|
+
success: false,
|
|
116
|
+
worktreePath,
|
|
117
|
+
branch,
|
|
118
|
+
error: `Failed to create parent directory ${baseDir}: ${error}`,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
try {
|
|
123
|
+
execSync(`git worktree add "${worktreePath}" -b "${branch}"`, {
|
|
124
|
+
encoding: 'utf-8',
|
|
125
|
+
stdio: 'pipe',
|
|
126
|
+
});
|
|
127
|
+
return { success: true, worktreePath, branch };
|
|
128
|
+
} catch (error) {
|
|
129
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
130
|
+
return {
|
|
131
|
+
success: false,
|
|
132
|
+
worktreePath,
|
|
133
|
+
branch,
|
|
134
|
+
error: `Failed to create worktree: ${msg}`,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Validate that a worktree exists, is a valid git worktree, and contains the expected project content.
|
|
141
|
+
*
|
|
142
|
+
* @param worktreePath - The worktree root directory
|
|
143
|
+
* @param projectRelativePath - The relative path from repo root to the project folder
|
|
144
|
+
*/
|
|
145
|
+
export function validateWorktree(worktreePath: string, projectRelativePath: string): WorktreeValidation {
|
|
146
|
+
const result: WorktreeValidation = {
|
|
147
|
+
exists: false,
|
|
148
|
+
isValidWorktree: false,
|
|
149
|
+
hasProjectFolder: false,
|
|
150
|
+
hasPlans: false,
|
|
151
|
+
projectPath: null,
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// Check directory exists
|
|
155
|
+
if (!fs.existsSync(worktreePath)) {
|
|
156
|
+
return result;
|
|
157
|
+
}
|
|
158
|
+
result.exists = true;
|
|
159
|
+
|
|
160
|
+
// Check it appears in git worktree list
|
|
161
|
+
try {
|
|
162
|
+
const listOutput = execSync('git worktree list --porcelain', { encoding: 'utf-8', stdio: 'pipe' });
|
|
163
|
+
const normalizedWorktreePath = path.resolve(worktreePath);
|
|
164
|
+
const isListed = listOutput.split('\n').some(line => {
|
|
165
|
+
if (line.startsWith('worktree ')) {
|
|
166
|
+
const listedPath = path.resolve(line.slice('worktree '.length).trim());
|
|
167
|
+
return listedPath === normalizedWorktreePath;
|
|
168
|
+
}
|
|
169
|
+
return false;
|
|
170
|
+
});
|
|
171
|
+
result.isValidWorktree = isListed;
|
|
172
|
+
} catch {
|
|
173
|
+
return result;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Check project folder exists in worktree
|
|
177
|
+
const projectPath = getWorktreeProjectPath(worktreePath, projectRelativePath);
|
|
178
|
+
if (fs.existsSync(projectPath)) {
|
|
179
|
+
result.hasProjectFolder = true;
|
|
180
|
+
result.projectPath = projectPath;
|
|
181
|
+
|
|
182
|
+
// Check for plans directory
|
|
183
|
+
const plansDir = path.join(projectPath, 'plans');
|
|
184
|
+
if (fs.existsSync(plansDir)) {
|
|
185
|
+
result.hasPlans = true;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return result;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Merge a worktree branch into the current branch.
|
|
194
|
+
* Attempts fast-forward first; falls back to merge commit.
|
|
195
|
+
* On conflicts, aborts merge and returns failure.
|
|
196
|
+
*
|
|
197
|
+
* MUST be called from the original repo (not the worktree).
|
|
198
|
+
*
|
|
199
|
+
* @param branch - The branch name to merge (typically the project folder name)
|
|
200
|
+
* @param originalBranch - The branch to merge into (the branch that was active when worktree was created)
|
|
201
|
+
*/
|
|
202
|
+
export function mergeWorktreeBranch(branch: string, originalBranch: string): WorktreeMergeResult {
|
|
203
|
+
// Switch to the original branch
|
|
204
|
+
try {
|
|
205
|
+
execSync(`git checkout "${originalBranch}"`, { encoding: 'utf-8', stdio: 'pipe' });
|
|
206
|
+
} catch (error) {
|
|
207
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
208
|
+
return {
|
|
209
|
+
success: false,
|
|
210
|
+
merged: false,
|
|
211
|
+
fastForward: false,
|
|
212
|
+
error: `Failed to checkout ${originalBranch}: ${msg}`,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Try fast-forward merge first
|
|
217
|
+
try {
|
|
218
|
+
execSync(`git merge --ff-only "${branch}"`, { encoding: 'utf-8', stdio: 'pipe' });
|
|
219
|
+
return { success: true, merged: true, fastForward: true };
|
|
220
|
+
} catch {
|
|
221
|
+
// Fast-forward not possible, try regular merge
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Try regular merge
|
|
225
|
+
try {
|
|
226
|
+
execSync(`git merge "${branch}"`, { encoding: 'utf-8', stdio: 'pipe' });
|
|
227
|
+
return { success: true, merged: true, fastForward: false };
|
|
228
|
+
} catch {
|
|
229
|
+
// Merge conflicts - abort
|
|
230
|
+
try {
|
|
231
|
+
execSync('git merge --abort', { encoding: 'utf-8', stdio: 'pipe' });
|
|
232
|
+
} catch {
|
|
233
|
+
logger.warn('Failed to abort merge - repo may be in an inconsistent state');
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return {
|
|
237
|
+
success: false,
|
|
238
|
+
merged: false,
|
|
239
|
+
fastForward: false,
|
|
240
|
+
error: `Merge conflicts detected. Please merge branch "${branch}" into "${originalBranch}" manually.`,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Remove a single worktree.
|
|
247
|
+
* Used for failed-plan cleanup and post-completion cleanup.
|
|
248
|
+
* The git branch is preserved — only the worktree directory is removed.
|
|
249
|
+
*
|
|
250
|
+
* @param worktreePath - The worktree directory to remove
|
|
251
|
+
* @returns true if removal succeeded, false otherwise
|
|
252
|
+
*/
|
|
253
|
+
export function removeWorktree(worktreePath: string): { success: boolean; error?: string } {
|
|
254
|
+
try {
|
|
255
|
+
execSync(`git worktree remove "${worktreePath}"`, { encoding: 'utf-8', stdio: 'pipe' });
|
|
256
|
+
return { success: true };
|
|
257
|
+
} catch (error) {
|
|
258
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
259
|
+
return {
|
|
260
|
+
success: false,
|
|
261
|
+
error: `Failed to remove worktree at ${worktreePath}: ${msg}`,
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Check if a local branch exists.
|
|
268
|
+
*
|
|
269
|
+
* @param branchName - The branch name to check
|
|
270
|
+
* @returns true if the branch exists locally
|
|
271
|
+
*/
|
|
272
|
+
export function branchExists(branchName: string): boolean {
|
|
273
|
+
try {
|
|
274
|
+
const output = execSync(`git branch --list "${branchName}"`, { encoding: 'utf-8', stdio: 'pipe' }).trim();
|
|
275
|
+
return output.length > 0;
|
|
276
|
+
} catch {
|
|
277
|
+
return false;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Create a git worktree at the computed path from an existing branch.
|
|
283
|
+
* Unlike `createWorktree()`, this does NOT create a new branch — it attaches
|
|
284
|
+
* to a branch that already exists locally.
|
|
285
|
+
*
|
|
286
|
+
* @param repoBasename - The basename of the repo root directory
|
|
287
|
+
* @param projectId - The full project folder name (used as both directory name and branch name)
|
|
288
|
+
*/
|
|
289
|
+
export function createWorktreeFromBranch(repoBasename: string, projectId: string): WorktreeCreateResult {
|
|
290
|
+
const worktreePath = computeWorktreePath(repoBasename, projectId);
|
|
291
|
+
const branch = projectId;
|
|
292
|
+
|
|
293
|
+
// Check branch exists
|
|
294
|
+
if (!branchExists(branch)) {
|
|
295
|
+
return {
|
|
296
|
+
success: false,
|
|
297
|
+
worktreePath,
|
|
298
|
+
branch,
|
|
299
|
+
error: `Branch "${branch}" does not exist locally`,
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// Ensure parent directory exists
|
|
304
|
+
const baseDir = computeWorktreeBaseDir(repoBasename);
|
|
305
|
+
try {
|
|
306
|
+
fs.mkdirSync(baseDir, { recursive: true });
|
|
307
|
+
} catch (error) {
|
|
308
|
+
return {
|
|
309
|
+
success: false,
|
|
310
|
+
worktreePath,
|
|
311
|
+
branch,
|
|
312
|
+
error: `Failed to create parent directory ${baseDir}: ${error}`,
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
try {
|
|
317
|
+
execSync(`git worktree add "${worktreePath}" "${branch}"`, {
|
|
318
|
+
encoding: 'utf-8',
|
|
319
|
+
stdio: 'pipe',
|
|
320
|
+
});
|
|
321
|
+
return { success: true, worktreePath, branch };
|
|
322
|
+
} catch (error) {
|
|
323
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
324
|
+
return {
|
|
325
|
+
success: false,
|
|
326
|
+
worktreePath,
|
|
327
|
+
branch,
|
|
328
|
+
error: `Failed to create worktree: ${msg}`,
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* List all worktree project directories for the current repo.
|
|
335
|
+
* Scans `~/.raf/worktrees/<repo-basename>/` and returns the list of project folder names.
|
|
336
|
+
*
|
|
337
|
+
* @param repoBasename - The basename of the repo root directory
|
|
338
|
+
* @returns Sorted array of project folder names (e.g., ['020-worktree-weaver', '021-another-feature'])
|
|
339
|
+
*/
|
|
340
|
+
export function listWorktreeProjects(repoBasename: string): string[] {
|
|
341
|
+
const baseDir = computeWorktreeBaseDir(repoBasename);
|
|
342
|
+
|
|
343
|
+
if (!fs.existsSync(baseDir)) {
|
|
344
|
+
return [];
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
try {
|
|
348
|
+
const entries = fs.readdirSync(baseDir, { withFileTypes: true });
|
|
349
|
+
const projects = entries
|
|
350
|
+
.filter(entry => entry.isDirectory())
|
|
351
|
+
.map(entry => entry.name)
|
|
352
|
+
.sort();
|
|
353
|
+
return projects;
|
|
354
|
+
} catch {
|
|
355
|
+
return [];
|
|
356
|
+
}
|
|
357
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { Command } from 'commander';
|
|
|
4
4
|
import { createPlanCommand } from './commands/plan.js';
|
|
5
5
|
import { createDoCommand } from './commands/do.js';
|
|
6
6
|
import { createStatusCommand } from './commands/status.js';
|
|
7
|
+
import { createMigrateCommand } from './commands/migrate.js';
|
|
7
8
|
import { getVersion } from './utils/version.js';
|
|
8
9
|
|
|
9
10
|
const program = new Command();
|
|
@@ -16,5 +17,6 @@ program
|
|
|
16
17
|
program.addCommand(createPlanCommand());
|
|
17
18
|
program.addCommand(createDoCommand());
|
|
18
19
|
program.addCommand(createStatusCommand());
|
|
20
|
+
program.addCommand(createMigrateCommand());
|
|
19
21
|
|
|
20
22
|
program.parse();
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renders stream-json events from Claude CLI into human-readable verbose output.
|
|
3
|
+
*
|
|
4
|
+
* Event types from `claude -p --output-format stream-json --verbose`:
|
|
5
|
+
* - system (init): Session initialization info
|
|
6
|
+
* - assistant: Claude's response with text or tool_use content blocks
|
|
7
|
+
* - user: Tool results (tool_result content blocks)
|
|
8
|
+
* - result: Final result with success/failure status
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export interface StreamEvent {
|
|
12
|
+
type: string;
|
|
13
|
+
subtype?: string;
|
|
14
|
+
message?: {
|
|
15
|
+
content?: ContentBlock[];
|
|
16
|
+
};
|
|
17
|
+
result?: string;
|
|
18
|
+
tool_use_result?: {
|
|
19
|
+
type?: string;
|
|
20
|
+
file?: {
|
|
21
|
+
filePath?: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface ContentBlock {
|
|
27
|
+
type: string;
|
|
28
|
+
text?: string;
|
|
29
|
+
name?: string;
|
|
30
|
+
input?: Record<string, unknown>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Describes what a tool is doing in human-readable form.
|
|
35
|
+
*/
|
|
36
|
+
function describeToolUse(name: string, input: Record<string, unknown>): string {
|
|
37
|
+
switch (name) {
|
|
38
|
+
case 'Read':
|
|
39
|
+
return `Reading ${input.file_path ?? 'file'}`;
|
|
40
|
+
case 'Write':
|
|
41
|
+
return `Writing ${input.file_path ?? 'file'}`;
|
|
42
|
+
case 'Edit':
|
|
43
|
+
return `Editing ${input.file_path ?? 'file'}`;
|
|
44
|
+
case 'Bash':
|
|
45
|
+
return `Running: ${truncate(String(input.command ?? ''), 120)}`;
|
|
46
|
+
case 'Glob':
|
|
47
|
+
return `Searching files: ${input.pattern ?? ''}`;
|
|
48
|
+
case 'Grep':
|
|
49
|
+
return `Searching for: ${truncate(String(input.pattern ?? ''), 80)}`;
|
|
50
|
+
case 'WebFetch':
|
|
51
|
+
return `Fetching: ${input.url ?? ''}`;
|
|
52
|
+
case 'WebSearch':
|
|
53
|
+
return `Searching web: ${input.query ?? ''}`;
|
|
54
|
+
case 'TodoWrite':
|
|
55
|
+
return 'Updating task list';
|
|
56
|
+
case 'Task':
|
|
57
|
+
return `Launching agent: ${truncate(String(input.description ?? input.prompt ?? ''), 80)}`;
|
|
58
|
+
case 'NotebookEdit':
|
|
59
|
+
return `Editing notebook: ${input.notebook_path ?? ''}`;
|
|
60
|
+
default:
|
|
61
|
+
return `Using tool: ${name}`;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function truncate(text: string, maxLen: number): string {
|
|
66
|
+
if (text.length <= maxLen) return text;
|
|
67
|
+
return text.substring(0, maxLen - 3) + '...';
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface RenderResult {
|
|
71
|
+
/** Text to display to stdout (may be empty if no display needed) */
|
|
72
|
+
display: string;
|
|
73
|
+
/** Text content to accumulate for output parsing (completion markers, etc.) */
|
|
74
|
+
textContent: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Parse and render a single NDJSON line from stream-json output.
|
|
79
|
+
* Returns display text for stdout and text content for output accumulation.
|
|
80
|
+
*/
|
|
81
|
+
export function renderStreamEvent(line: string): RenderResult {
|
|
82
|
+
if (!line.trim()) {
|
|
83
|
+
return { display: '', textContent: '' };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
let event: StreamEvent;
|
|
87
|
+
try {
|
|
88
|
+
event = JSON.parse(line) as StreamEvent;
|
|
89
|
+
} catch {
|
|
90
|
+
// Not valid JSON - pass through raw
|
|
91
|
+
return { display: line + '\n', textContent: line };
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
switch (event.type) {
|
|
95
|
+
case 'system':
|
|
96
|
+
return { display: '', textContent: '' };
|
|
97
|
+
|
|
98
|
+
case 'assistant':
|
|
99
|
+
return renderAssistant(event);
|
|
100
|
+
|
|
101
|
+
case 'user':
|
|
102
|
+
// Tool results — skip verbose display (the tool_use already described what's happening)
|
|
103
|
+
return { display: '', textContent: '' };
|
|
104
|
+
|
|
105
|
+
case 'result':
|
|
106
|
+
return renderResult(event);
|
|
107
|
+
|
|
108
|
+
default:
|
|
109
|
+
return { display: '', textContent: '' };
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function renderAssistant(event: StreamEvent): RenderResult {
|
|
114
|
+
const content = event.message?.content;
|
|
115
|
+
if (!content || !Array.isArray(content)) {
|
|
116
|
+
return { display: '', textContent: '' };
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
let display = '';
|
|
120
|
+
let textContent = '';
|
|
121
|
+
|
|
122
|
+
for (const block of content) {
|
|
123
|
+
if (block.type === 'text' && block.text) {
|
|
124
|
+
textContent += block.text;
|
|
125
|
+
display += block.text + '\n';
|
|
126
|
+
} else if (block.type === 'tool_use' && block.name) {
|
|
127
|
+
const description = describeToolUse(block.name, block.input ?? {});
|
|
128
|
+
display += ` → ${description}\n`;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return { display, textContent };
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function renderResult(_event: StreamEvent): RenderResult {
|
|
136
|
+
// The result event's text duplicates the last assistant message,
|
|
137
|
+
// which is already captured. Skip to avoid double-counting.
|
|
138
|
+
return { display: '', textContent: '' };
|
|
139
|
+
}
|
package/src/prompts/amend.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { DerivedTask } from '../core/state-derivation.js';
|
|
2
|
+
import { encodeTaskId } from '../utils/paths.js';
|
|
2
3
|
|
|
3
4
|
export interface AmendPromptParams {
|
|
4
5
|
projectPath: string;
|
|
5
6
|
existingTasks: Array<DerivedTask & { taskName: string }>;
|
|
6
7
|
nextTaskNumber: number;
|
|
7
8
|
newTaskDescription: string;
|
|
9
|
+
worktreeMode?: boolean;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
export interface AmendPromptResult {
|
|
@@ -23,7 +25,9 @@ export function getAmendPrompt(params: AmendPromptParams): AmendPromptResult {
|
|
|
23
25
|
existingTasks,
|
|
24
26
|
nextTaskNumber,
|
|
25
27
|
newTaskDescription,
|
|
28
|
+
worktreeMode,
|
|
26
29
|
} = params;
|
|
30
|
+
const worktreeFlag = worktreeMode ? ' --worktree' : '';
|
|
27
31
|
|
|
28
32
|
const existingTasksSummary = existingTasks
|
|
29
33
|
.map((task) => {
|
|
@@ -35,7 +39,11 @@ export function getAmendPrompt(params: AmendPromptParams): AmendPromptResult {
|
|
|
35
39
|
: '[PENDING]';
|
|
36
40
|
const modifiability =
|
|
37
41
|
task.status === 'completed' ? '[PROTECTED]' : '[MODIFIABLE]';
|
|
38
|
-
|
|
42
|
+
const outcomeRef =
|
|
43
|
+
task.status === 'completed'
|
|
44
|
+
? `\n Outcome: ${projectPath}/outcomes/${task.planFile.replace('plans/', '').replace(/\.md$/, '')}.md`
|
|
45
|
+
: '';
|
|
46
|
+
return `- Task ${task.id}: ${task.taskName} ${status} ${modifiability}${outcomeRef}`;
|
|
39
47
|
})
|
|
40
48
|
.join('\n');
|
|
41
49
|
|
|
@@ -59,7 +67,7 @@ You are in AMENDMENT MODE. This means:
|
|
|
59
67
|
- You MAY modify [MODIFIABLE] tasks (pending/failed) if the user requests changes
|
|
60
68
|
- NEVER modify [PROTECTED] tasks (completed) - their outcomes depend on the original plan
|
|
61
69
|
- DO NOT renumber existing tasks
|
|
62
|
-
- You can create NEW tasks starting from number ${nextTaskNumber
|
|
70
|
+
- You can create NEW tasks starting from number ${encodeTaskId(nextTaskNumber)}
|
|
63
71
|
|
|
64
72
|
## Project Location
|
|
65
73
|
|
|
@@ -94,6 +102,13 @@ Read the user's description of new tasks and identify what needs to be added. Co
|
|
|
94
102
|
- Dependencies on completed tasks (check the ## Dependencies section in existing plan files)
|
|
95
103
|
- Whether new tasks should reference existing task outcomes
|
|
96
104
|
|
|
105
|
+
**Identifying Follow-up Tasks**: When a new task is a follow-up, fix, or iteration of a previously completed task, you MUST reference the previous task's outcome in the new plan's Context section. This gives the executing agent full context about what was done before.
|
|
106
|
+
|
|
107
|
+
Use this format in the Context section:
|
|
108
|
+
\`This is a follow-up to task NN. See outcome: {projectPath}/outcomes/NN-task-name.md\`
|
|
109
|
+
|
|
110
|
+
The outcome file paths for completed tasks are listed above in the Existing Tasks section.
|
|
111
|
+
|
|
97
112
|
### Step 3: Interview the User
|
|
98
113
|
|
|
99
114
|
For EACH new task you identify, use the AskUserQuestion tool to gather:
|
|
@@ -109,15 +124,15 @@ After EACH interview question is answered, append the Q&A pair to the existing d
|
|
|
109
124
|
|
|
110
125
|
Use this format:
|
|
111
126
|
\`\`\`markdown
|
|
112
|
-
## [
|
|
127
|
+
## [Question asked]
|
|
113
128
|
[User's answer]
|
|
114
129
|
\`\`\`
|
|
115
130
|
|
|
116
131
|
### Step 4: Create New Plan Files
|
|
117
132
|
|
|
118
133
|
After interviewing the user about all NEW tasks, create plan files starting from the next available number:
|
|
119
|
-
- ${projectPath}/plans/${nextTaskNumber
|
|
120
|
-
- ${projectPath}/plans/${(nextTaskNumber + 1)
|
|
134
|
+
- ${projectPath}/plans/${encodeTaskId(nextTaskNumber)}-task-name.md
|
|
135
|
+
- ${projectPath}/plans/${encodeTaskId(nextTaskNumber + 1)}-task-name.md
|
|
121
136
|
- etc.
|
|
122
137
|
|
|
123
138
|
Each plan file should follow this structure:
|
|
@@ -131,10 +146,11 @@ Each plan file should follow this structure:
|
|
|
131
146
|
## Context
|
|
132
147
|
[Why this task is needed, how it fits into the larger project]
|
|
133
148
|
[Reference relevant existing tasks if applicable]
|
|
149
|
+
[For follow-up/fix tasks: "This is a follow-up to task NN. See outcome: {projectPath}/outcomes/NN-task-name.md"]
|
|
134
150
|
|
|
135
151
|
## Dependencies
|
|
136
152
|
[Optional section - omit if task has no dependencies]
|
|
137
|
-
[Comma-separated list of task IDs this task depends on, e.g., "
|
|
153
|
+
[Comma-separated list of task IDs this task depends on, e.g., "01, 02"]
|
|
138
154
|
[If a dependency fails, this task will be automatically blocked]
|
|
139
155
|
|
|
140
156
|
## Requirements
|
|
@@ -169,7 +185,9 @@ After creating all new plan files:
|
|
|
169
185
|
2. Display this exit message to the user:
|
|
170
186
|
|
|
171
187
|
\`\`\`
|
|
172
|
-
Planning complete!
|
|
188
|
+
Planning complete! To exit this session and run your tasks:
|
|
189
|
+
1. Press Ctrl-C twice to exit
|
|
190
|
+
2. Then run: raf do <project>${worktreeFlag}
|
|
173
191
|
\`\`\`
|
|
174
192
|
|
|
175
193
|
## Important Rules
|
|
@@ -177,10 +195,10 @@ Planning complete! Press Ctrl-C twice to exit to exit this session
|
|
|
177
195
|
1. NEVER modify COMPLETED task plans - they are [PROTECTED] because their outcomes depend on the original plan
|
|
178
196
|
2. You MAY modify non-completed task plans (pending/failed) if the user requests changes - they are [MODIFIABLE]
|
|
179
197
|
3. ALWAYS interview the user before creating or modifying plans
|
|
180
|
-
4. New tasks start from number ${nextTaskNumber
|
|
198
|
+
4. New tasks start from number ${encodeTaskId(nextTaskNumber)}
|
|
181
199
|
5. Use descriptive, kebab-case names for plan files
|
|
182
200
|
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., "
|
|
201
|
+
7. Specify task dependencies using the ## Dependencies section with task IDs only (e.g., "01, 02")
|
|
184
202
|
8. Tasks without dependencies should omit the Dependencies section entirely
|
|
185
203
|
9. Be specific - vague plans lead to poor execution
|
|
186
204
|
|
package/src/prompts/execution.ts
CHANGED
|
@@ -83,8 +83,8 @@ ${previousOutcomes.map((o) => `### Task ${o.taskId}\n${o.content}`).join('\n\n')
|
|
|
83
83
|
`;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
//
|
|
87
|
-
const paddedTaskNumber = taskNumber.toString().padStart(
|
|
86
|
+
// Encode task number to 2-char base36
|
|
87
|
+
const paddedTaskNumber = taskNumber.toString(36).padStart(2, '0');
|
|
88
88
|
|
|
89
89
|
const commitInstructions = autoCommit
|
|
90
90
|
? `
|
|
@@ -98,6 +98,8 @@ After successfully completing the task:
|
|
|
98
98
|
2. Commit with message: "RAF[${projectNumber}:${paddedTaskNumber}] <description>"
|
|
99
99
|
- Write a concise description of what was accomplished
|
|
100
100
|
- Focus on the actual change, not the task name
|
|
101
|
+
- The commit message must be a SINGLE LINE — no body, no trailers
|
|
102
|
+
- Do NOT add Co-Authored-By or any other trailers to the commit message
|
|
101
103
|
|
|
102
104
|
**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.
|
|
103
105
|
`
|
|
@@ -164,12 +166,10 @@ First, read the plan file to understand exactly what needs to be done.
|
|
|
164
166
|
### Step 2: Execute the Task
|
|
165
167
|
|
|
166
168
|
Follow the implementation steps in the plan. Key guidelines:
|
|
167
|
-
- **Use the Task tool to delegate work to subagents** - Split complex work into subtasks and use specialized agents (Explore for codebase investigation, Plan for design decisions, general-purpose for implementation)
|
|
168
169
|
- Write clean, maintainable code
|
|
169
170
|
- Follow existing code patterns in the project
|
|
170
171
|
- Add appropriate error handling
|
|
171
|
-
-
|
|
172
|
-
- Follow any CLAUDE.md instructions if present
|
|
172
|
+
- Follow any CLAUDE.md instructions
|
|
173
173
|
${dependencyContextSection}${outcomesSection}
|
|
174
174
|
### Step 3: Verify Completion
|
|
175
175
|
|