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,523 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import * as os from 'node:os';
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
|
|
5
|
+
// Mock execSync before importing the module
|
|
6
|
+
const mockExecSync = jest.fn();
|
|
7
|
+
jest.unstable_mockModule('node:child_process', () => ({
|
|
8
|
+
execSync: mockExecSync,
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
// Mock fs
|
|
12
|
+
const mockExistsSync = jest.fn();
|
|
13
|
+
const mockMkdirSync = jest.fn();
|
|
14
|
+
const mockReaddirSync = jest.fn();
|
|
15
|
+
jest.unstable_mockModule('node:fs', () => ({
|
|
16
|
+
existsSync: mockExistsSync,
|
|
17
|
+
mkdirSync: mockMkdirSync,
|
|
18
|
+
readdirSync: mockReaddirSync,
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
// Mock logger to prevent console output
|
|
22
|
+
jest.unstable_mockModule('../../src/utils/logger.js', () => ({
|
|
23
|
+
logger: {
|
|
24
|
+
debug: jest.fn(),
|
|
25
|
+
warn: jest.fn(),
|
|
26
|
+
error: jest.fn(),
|
|
27
|
+
},
|
|
28
|
+
}));
|
|
29
|
+
|
|
30
|
+
// Import after mocking
|
|
31
|
+
const {
|
|
32
|
+
getRepoRoot,
|
|
33
|
+
getRepoBasename,
|
|
34
|
+
getCurrentBranch,
|
|
35
|
+
computeWorktreePath,
|
|
36
|
+
computeWorktreeBaseDir,
|
|
37
|
+
getWorktreeProjectPath,
|
|
38
|
+
createWorktree,
|
|
39
|
+
createWorktreeFromBranch,
|
|
40
|
+
branchExists,
|
|
41
|
+
validateWorktree,
|
|
42
|
+
mergeWorktreeBranch,
|
|
43
|
+
removeWorktree,
|
|
44
|
+
listWorktreeProjects,
|
|
45
|
+
} = await import('../../src/core/worktree.js');
|
|
46
|
+
|
|
47
|
+
const HOME = os.homedir();
|
|
48
|
+
|
|
49
|
+
describe('worktree utilities', () => {
|
|
50
|
+
beforeEach(() => {
|
|
51
|
+
jest.clearAllMocks();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe('getRepoRoot', () => {
|
|
55
|
+
it('should return the repo root path', () => {
|
|
56
|
+
mockExecSync.mockReturnValue('/Users/me/projects/myapp\n');
|
|
57
|
+
expect(getRepoRoot()).toBe('/Users/me/projects/myapp');
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('should return null when not in a git repo', () => {
|
|
61
|
+
mockExecSync.mockImplementation(() => {
|
|
62
|
+
throw new Error('not a git repository');
|
|
63
|
+
});
|
|
64
|
+
expect(getRepoRoot()).toBeNull();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('should return null for empty output', () => {
|
|
68
|
+
mockExecSync.mockReturnValue('');
|
|
69
|
+
expect(getRepoRoot()).toBeNull();
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
describe('getRepoBasename', () => {
|
|
74
|
+
it('should return the basename of the repo root', () => {
|
|
75
|
+
mockExecSync.mockReturnValue('/Users/me/projects/myapp\n');
|
|
76
|
+
expect(getRepoBasename()).toBe('myapp');
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('should return null when not in a git repo', () => {
|
|
80
|
+
mockExecSync.mockImplementation(() => {
|
|
81
|
+
throw new Error('not a git repository');
|
|
82
|
+
});
|
|
83
|
+
expect(getRepoBasename()).toBeNull();
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
describe('getCurrentBranch', () => {
|
|
88
|
+
it('should return the current branch name', () => {
|
|
89
|
+
mockExecSync.mockReturnValue('main\n');
|
|
90
|
+
expect(getCurrentBranch()).toBe('main');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('should return null in detached HEAD state', () => {
|
|
94
|
+
mockExecSync.mockReturnValue('');
|
|
95
|
+
expect(getCurrentBranch()).toBeNull();
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('should return null when not in a git repo', () => {
|
|
99
|
+
mockExecSync.mockImplementation(() => {
|
|
100
|
+
throw new Error('not a git repository');
|
|
101
|
+
});
|
|
102
|
+
expect(getCurrentBranch()).toBeNull();
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
describe('computeWorktreePath', () => {
|
|
107
|
+
it('should compute the correct worktree path', () => {
|
|
108
|
+
const result = computeWorktreePath('myapp', 'abaaba-worktree-weaver');
|
|
109
|
+
expect(result).toBe(path.join(HOME, '.raf', 'worktrees', 'myapp', 'abaaba-worktree-weaver'));
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('should handle repo names with dots', () => {
|
|
113
|
+
const result = computeWorktreePath('my.app.v2', 'aaaaab-feature');
|
|
114
|
+
expect(result).toBe(path.join(HOME, '.raf', 'worktrees', 'my.app.v2', 'aaaaab-feature'));
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('should handle repo names with underscores', () => {
|
|
118
|
+
const result = computeWorktreePath('my_app', 'aaaaab-feature');
|
|
119
|
+
expect(result).toBe(path.join(HOME, '.raf', 'worktrees', 'my_app', 'aaaaab-feature'));
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('should handle repo names with hyphens', () => {
|
|
123
|
+
const result = computeWorktreePath('my-cool-app', 'abcdef-my-project');
|
|
124
|
+
expect(result).toBe(path.join(HOME, '.raf', 'worktrees', 'my-cool-app', 'abcdef-my-project'));
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('should handle base26 project IDs', () => {
|
|
128
|
+
const result = computeWorktreePath('myapp', 'abcdef-my-project');
|
|
129
|
+
expect(result).toBe(path.join(HOME, '.raf', 'worktrees', 'myapp', 'abcdef-my-project'));
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
describe('computeWorktreeBaseDir', () => {
|
|
134
|
+
it('should compute the correct base directory', () => {
|
|
135
|
+
const result = computeWorktreeBaseDir('myapp');
|
|
136
|
+
expect(result).toBe(path.join(HOME, '.raf', 'worktrees', 'myapp'));
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it('should handle repo names with special characters', () => {
|
|
140
|
+
const result = computeWorktreeBaseDir('my.app_v2');
|
|
141
|
+
expect(result).toBe(path.join(HOME, '.raf', 'worktrees', 'my.app_v2'));
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
describe('getWorktreeProjectPath', () => {
|
|
146
|
+
it('should return the project path inside the worktree', () => {
|
|
147
|
+
const result = getWorktreeProjectPath('/worktree/root', 'RAF/abaaba-worktree-weaver');
|
|
148
|
+
expect(result).toBe(path.join('/worktree/root', 'RAF/abaaba-worktree-weaver'));
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it('should handle nested relative paths', () => {
|
|
152
|
+
const result = getWorktreeProjectPath('/worktree/root', 'deep/nested/RAF/aaaaab-feature');
|
|
153
|
+
expect(result).toBe(path.join('/worktree/root', 'deep/nested/RAF/aaaaab-feature'));
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
describe('createWorktree', () => {
|
|
158
|
+
it('should create parent directory and worktree successfully', () => {
|
|
159
|
+
mockMkdirSync.mockReturnValue(undefined);
|
|
160
|
+
mockExecSync.mockReturnValue('');
|
|
161
|
+
|
|
162
|
+
const result = createWorktree('myapp', 'abaaba-worktree-weaver');
|
|
163
|
+
|
|
164
|
+
expect(result.success).toBe(true);
|
|
165
|
+
expect(result.branch).toBe('abaaba-worktree-weaver');
|
|
166
|
+
expect(result.worktreePath).toBe(
|
|
167
|
+
path.join(HOME, '.raf', 'worktrees', 'myapp', 'abaaba-worktree-weaver')
|
|
168
|
+
);
|
|
169
|
+
expect(mockMkdirSync).toHaveBeenCalledWith(
|
|
170
|
+
path.join(HOME, '.raf', 'worktrees', 'myapp'),
|
|
171
|
+
{ recursive: true }
|
|
172
|
+
);
|
|
173
|
+
expect(mockExecSync).toHaveBeenCalledWith(
|
|
174
|
+
expect.stringContaining('git worktree add'),
|
|
175
|
+
expect.any(Object)
|
|
176
|
+
);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
it('should return error when parent directory creation fails', () => {
|
|
180
|
+
mockMkdirSync.mockImplementation(() => {
|
|
181
|
+
throw new Error('permission denied');
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
const result = createWorktree('myapp', 'abaaba-worktree-weaver');
|
|
185
|
+
|
|
186
|
+
expect(result.success).toBe(false);
|
|
187
|
+
expect(result.error).toContain('Failed to create parent directory');
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
it('should return error when git worktree add fails', () => {
|
|
191
|
+
mockMkdirSync.mockReturnValue(undefined);
|
|
192
|
+
mockExecSync.mockImplementation(() => {
|
|
193
|
+
throw new Error('branch already exists');
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
const result = createWorktree('myapp', 'abaaba-worktree-weaver');
|
|
197
|
+
|
|
198
|
+
expect(result.success).toBe(false);
|
|
199
|
+
expect(result.error).toContain('Failed to create worktree');
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
describe('validateWorktree', () => {
|
|
204
|
+
const worktreePath = '/worktree/path';
|
|
205
|
+
const projectRelPath = 'RAF/abaaba-worktree-weaver';
|
|
206
|
+
|
|
207
|
+
it('should return exists=false when directory does not exist', () => {
|
|
208
|
+
mockExistsSync.mockReturnValue(false);
|
|
209
|
+
|
|
210
|
+
const result = validateWorktree(worktreePath, projectRelPath);
|
|
211
|
+
|
|
212
|
+
expect(result.exists).toBe(false);
|
|
213
|
+
expect(result.isValidWorktree).toBe(false);
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
it('should validate a fully valid worktree', () => {
|
|
217
|
+
const resolvedPath = path.resolve(worktreePath);
|
|
218
|
+
mockExistsSync.mockImplementation((p: unknown) => {
|
|
219
|
+
const pStr = p as string;
|
|
220
|
+
if (pStr === worktreePath) return true;
|
|
221
|
+
if (pStr === path.join(worktreePath, projectRelPath)) return true;
|
|
222
|
+
if (pStr === path.join(worktreePath, projectRelPath, 'plans')) return true;
|
|
223
|
+
return false;
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
mockExecSync.mockReturnValue(`worktree ${resolvedPath}\nHEAD abc123\nbranch refs/heads/abaaba-worktree-weaver\n\n`);
|
|
227
|
+
|
|
228
|
+
const result = validateWorktree(worktreePath, projectRelPath);
|
|
229
|
+
|
|
230
|
+
expect(result.exists).toBe(true);
|
|
231
|
+
expect(result.isValidWorktree).toBe(true);
|
|
232
|
+
expect(result.hasProjectFolder).toBe(true);
|
|
233
|
+
expect(result.hasPlans).toBe(true);
|
|
234
|
+
expect(result.projectPath).toBe(path.join(worktreePath, projectRelPath));
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
it('should detect worktree not in git worktree list', () => {
|
|
238
|
+
mockExistsSync.mockReturnValue(true);
|
|
239
|
+
mockExecSync.mockReturnValue('worktree /some/other/path\nHEAD abc123\n\n');
|
|
240
|
+
|
|
241
|
+
const result = validateWorktree(worktreePath, projectRelPath);
|
|
242
|
+
|
|
243
|
+
expect(result.exists).toBe(true);
|
|
244
|
+
expect(result.isValidWorktree).toBe(false);
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
it('should detect missing project folder', () => {
|
|
248
|
+
const resolvedPath = path.resolve(worktreePath);
|
|
249
|
+
mockExistsSync.mockImplementation((p: unknown) => {
|
|
250
|
+
const pStr = p as string;
|
|
251
|
+
if (pStr === worktreePath) return true;
|
|
252
|
+
return false;
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
mockExecSync.mockReturnValue(`worktree ${resolvedPath}\nHEAD abc123\n\n`);
|
|
256
|
+
|
|
257
|
+
const result = validateWorktree(worktreePath, projectRelPath);
|
|
258
|
+
|
|
259
|
+
expect(result.exists).toBe(true);
|
|
260
|
+
expect(result.isValidWorktree).toBe(true);
|
|
261
|
+
expect(result.hasProjectFolder).toBe(false);
|
|
262
|
+
expect(result.hasPlans).toBe(false);
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
it('should handle git worktree list failure', () => {
|
|
266
|
+
mockExistsSync.mockReturnValue(true);
|
|
267
|
+
mockExecSync.mockImplementation(() => {
|
|
268
|
+
throw new Error('not a git repository');
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
const result = validateWorktree(worktreePath, projectRelPath);
|
|
272
|
+
|
|
273
|
+
expect(result.exists).toBe(true);
|
|
274
|
+
expect(result.isValidWorktree).toBe(false);
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
describe('mergeWorktreeBranch', () => {
|
|
279
|
+
it('should succeed with fast-forward merge', () => {
|
|
280
|
+
mockExecSync.mockImplementation((cmd: unknown) => {
|
|
281
|
+
const cmdStr = cmd as string;
|
|
282
|
+
if (cmdStr.includes('checkout')) return '';
|
|
283
|
+
if (cmdStr.includes('--ff-only')) return '';
|
|
284
|
+
return '';
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
const result = mergeWorktreeBranch('abaaba-worktree-weaver', 'main');
|
|
288
|
+
|
|
289
|
+
expect(result.success).toBe(true);
|
|
290
|
+
expect(result.merged).toBe(true);
|
|
291
|
+
expect(result.fastForward).toBe(true);
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
it('should fall back to merge commit when ff not possible', () => {
|
|
295
|
+
let ffAttempted = false;
|
|
296
|
+
mockExecSync.mockImplementation((cmd: unknown) => {
|
|
297
|
+
const cmdStr = cmd as string;
|
|
298
|
+
if (cmdStr.includes('checkout')) return '';
|
|
299
|
+
if (cmdStr.includes('--ff-only')) {
|
|
300
|
+
ffAttempted = true;
|
|
301
|
+
throw new Error('Not possible to fast-forward');
|
|
302
|
+
}
|
|
303
|
+
if (cmdStr.includes('git merge') && !cmdStr.includes('--abort') && ffAttempted) return '';
|
|
304
|
+
return '';
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
const result = mergeWorktreeBranch('abaaba-worktree-weaver', 'main');
|
|
308
|
+
|
|
309
|
+
expect(result.success).toBe(true);
|
|
310
|
+
expect(result.merged).toBe(true);
|
|
311
|
+
expect(result.fastForward).toBe(false);
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
it('should abort and return failure on merge conflicts', () => {
|
|
315
|
+
mockExecSync.mockImplementation((cmd: unknown) => {
|
|
316
|
+
const cmdStr = cmd as string;
|
|
317
|
+
if (cmdStr.includes('checkout')) return '';
|
|
318
|
+
if (cmdStr.includes('--ff-only')) throw new Error('Not possible to fast-forward');
|
|
319
|
+
if (cmdStr.includes('--abort')) return '';
|
|
320
|
+
if (cmdStr.includes('git merge')) throw new Error('CONFLICT');
|
|
321
|
+
return '';
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
const result = mergeWorktreeBranch('abaaba-worktree-weaver', 'main');
|
|
325
|
+
|
|
326
|
+
expect(result.success).toBe(false);
|
|
327
|
+
expect(result.merged).toBe(false);
|
|
328
|
+
expect(result.error).toContain('manually');
|
|
329
|
+
expect(mockExecSync).toHaveBeenCalledWith(
|
|
330
|
+
'git merge --abort',
|
|
331
|
+
expect.any(Object)
|
|
332
|
+
);
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
it('should return failure when checkout fails', () => {
|
|
336
|
+
mockExecSync.mockImplementation(() => {
|
|
337
|
+
throw new Error('pathspec "main" did not match');
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
const result = mergeWorktreeBranch('abaaba-worktree-weaver', 'main');
|
|
341
|
+
|
|
342
|
+
expect(result.success).toBe(false);
|
|
343
|
+
expect(result.error).toContain('Failed to checkout');
|
|
344
|
+
});
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
describe('removeWorktree', () => {
|
|
348
|
+
it('should remove worktree successfully', () => {
|
|
349
|
+
mockExecSync.mockReturnValue('');
|
|
350
|
+
|
|
351
|
+
const result = removeWorktree('/path/to/worktree');
|
|
352
|
+
|
|
353
|
+
expect(result.success).toBe(true);
|
|
354
|
+
expect(mockExecSync).toHaveBeenCalledWith(
|
|
355
|
+
'git worktree remove "/path/to/worktree"',
|
|
356
|
+
expect.any(Object)
|
|
357
|
+
);
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
it('should return error when removal fails', () => {
|
|
361
|
+
mockExecSync.mockImplementation(() => {
|
|
362
|
+
throw new Error('worktree is dirty');
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
const result = removeWorktree('/path/to/worktree');
|
|
366
|
+
|
|
367
|
+
expect(result.success).toBe(false);
|
|
368
|
+
expect(result.error).toContain('Failed to remove worktree');
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
describe('branchExists', () => {
|
|
373
|
+
it('should return true when branch exists', () => {
|
|
374
|
+
mockExecSync.mockReturnValue(' abcabc-prune-cycle\n');
|
|
375
|
+
expect(branchExists('abcabc-prune-cycle')).toBe(true);
|
|
376
|
+
expect(mockExecSync).toHaveBeenCalledWith(
|
|
377
|
+
'git branch --list "abcabc-prune-cycle"',
|
|
378
|
+
expect.any(Object)
|
|
379
|
+
);
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
it('should return false when branch does not exist', () => {
|
|
383
|
+
mockExecSync.mockReturnValue('');
|
|
384
|
+
expect(branchExists('nonexistent-branch')).toBe(false);
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
it('should return false when git command fails', () => {
|
|
388
|
+
mockExecSync.mockImplementation(() => {
|
|
389
|
+
throw new Error('not a git repository');
|
|
390
|
+
});
|
|
391
|
+
expect(branchExists('any-branch')).toBe(false);
|
|
392
|
+
});
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
describe('createWorktreeFromBranch', () => {
|
|
396
|
+
it('should create worktree from existing branch successfully', () => {
|
|
397
|
+
mockExecSync.mockImplementation((cmd: unknown) => {
|
|
398
|
+
const cmdStr = cmd as string;
|
|
399
|
+
if (cmdStr.includes('git branch --list')) return ' abcabc-prune-cycle\n';
|
|
400
|
+
return '';
|
|
401
|
+
});
|
|
402
|
+
mockMkdirSync.mockReturnValue(undefined);
|
|
403
|
+
|
|
404
|
+
const result = createWorktreeFromBranch('myapp', 'abcabc-prune-cycle');
|
|
405
|
+
|
|
406
|
+
expect(result.success).toBe(true);
|
|
407
|
+
expect(result.branch).toBe('abcabc-prune-cycle');
|
|
408
|
+
expect(result.worktreePath).toBe(
|
|
409
|
+
path.join(HOME, '.raf', 'worktrees', 'myapp', 'abcabc-prune-cycle')
|
|
410
|
+
);
|
|
411
|
+
expect(mockExecSync).toHaveBeenCalledWith(
|
|
412
|
+
expect.stringContaining('git worktree add'),
|
|
413
|
+
expect.any(Object)
|
|
414
|
+
);
|
|
415
|
+
// Should NOT have -b flag
|
|
416
|
+
const worktreeCall = mockExecSync.mock.calls.find(
|
|
417
|
+
(call: unknown[]) => (call[0] as string).includes('git worktree add')
|
|
418
|
+
);
|
|
419
|
+
expect(worktreeCall).toBeDefined();
|
|
420
|
+
expect(worktreeCall![0]).not.toContain('-b');
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
it('should return error when branch does not exist', () => {
|
|
424
|
+
mockExecSync.mockReturnValue('');
|
|
425
|
+
|
|
426
|
+
const result = createWorktreeFromBranch('myapp', 'nonexistent-branch');
|
|
427
|
+
|
|
428
|
+
expect(result.success).toBe(false);
|
|
429
|
+
expect(result.error).toContain('does not exist locally');
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
it('should return error when parent directory creation fails', () => {
|
|
433
|
+
mockExecSync.mockImplementation((cmd: unknown) => {
|
|
434
|
+
const cmdStr = cmd as string;
|
|
435
|
+
if (cmdStr.includes('git branch --list')) return ' abcabc-prune-cycle\n';
|
|
436
|
+
return '';
|
|
437
|
+
});
|
|
438
|
+
mockMkdirSync.mockImplementation(() => {
|
|
439
|
+
throw new Error('permission denied');
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
const result = createWorktreeFromBranch('myapp', 'abcabc-prune-cycle');
|
|
443
|
+
|
|
444
|
+
expect(result.success).toBe(false);
|
|
445
|
+
expect(result.error).toContain('Failed to create parent directory');
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
it('should return error when git worktree add fails', () => {
|
|
449
|
+
let branchChecked = false;
|
|
450
|
+
mockExecSync.mockImplementation((cmd: unknown) => {
|
|
451
|
+
const cmdStr = cmd as string;
|
|
452
|
+
if (cmdStr.includes('git branch --list')) {
|
|
453
|
+
branchChecked = true;
|
|
454
|
+
return ' abcabc-prune-cycle\n';
|
|
455
|
+
}
|
|
456
|
+
if (cmdStr.includes('git worktree add') && branchChecked) {
|
|
457
|
+
throw new Error('worktree path already exists');
|
|
458
|
+
}
|
|
459
|
+
return '';
|
|
460
|
+
});
|
|
461
|
+
mockMkdirSync.mockReturnValue(undefined);
|
|
462
|
+
|
|
463
|
+
const result = createWorktreeFromBranch('myapp', 'abcabc-prune-cycle');
|
|
464
|
+
|
|
465
|
+
expect(result.success).toBe(false);
|
|
466
|
+
expect(result.error).toContain('Failed to create worktree');
|
|
467
|
+
});
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
describe('listWorktreeProjects', () => {
|
|
471
|
+
it('should return empty array when base directory does not exist', () => {
|
|
472
|
+
mockExistsSync.mockReturnValue(false);
|
|
473
|
+
|
|
474
|
+
const result = listWorktreeProjects('myapp');
|
|
475
|
+
|
|
476
|
+
expect(result).toEqual([]);
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
it('should return sorted list of project directories', () => {
|
|
480
|
+
mockExistsSync.mockReturnValue(true);
|
|
481
|
+
mockReaddirSync.mockReturnValue([
|
|
482
|
+
{ name: 'ababab-another-feature', isDirectory: () => true },
|
|
483
|
+
{ name: 'abaaba-worktree-weaver', isDirectory: () => true },
|
|
484
|
+
]);
|
|
485
|
+
|
|
486
|
+
const result = listWorktreeProjects('myapp');
|
|
487
|
+
|
|
488
|
+
expect(result).toEqual(['abaaba-worktree-weaver', 'ababab-another-feature']);
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
it('should filter out non-directory entries', () => {
|
|
492
|
+
mockExistsSync.mockReturnValue(true);
|
|
493
|
+
mockReaddirSync.mockReturnValue([
|
|
494
|
+
{ name: 'abaaba-worktree-weaver', isDirectory: () => true },
|
|
495
|
+
{ name: '.DS_Store', isDirectory: () => false },
|
|
496
|
+
]);
|
|
497
|
+
|
|
498
|
+
const result = listWorktreeProjects('myapp');
|
|
499
|
+
|
|
500
|
+
expect(result).toEqual(['abaaba-worktree-weaver']);
|
|
501
|
+
});
|
|
502
|
+
|
|
503
|
+
it('should return empty array when directory is empty', () => {
|
|
504
|
+
mockExistsSync.mockReturnValue(true);
|
|
505
|
+
mockReaddirSync.mockReturnValue([]);
|
|
506
|
+
|
|
507
|
+
const result = listWorktreeProjects('myapp');
|
|
508
|
+
|
|
509
|
+
expect(result).toEqual([]);
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
it('should handle readdir errors gracefully', () => {
|
|
513
|
+
mockExistsSync.mockReturnValue(true);
|
|
514
|
+
mockReaddirSync.mockImplementation(() => {
|
|
515
|
+
throw new Error('permission denied');
|
|
516
|
+
});
|
|
517
|
+
|
|
518
|
+
const result = listWorktreeProjects('myapp');
|
|
519
|
+
|
|
520
|
+
expect(result).toEqual([]);
|
|
521
|
+
});
|
|
522
|
+
});
|
|
523
|
+
});
|