create-quiver 0.9.1 → 0.12.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/BACKLOG.md +16 -17
- package/CHANGELOG.md +34 -0
- package/README.md +419 -330
- package/README_FOR_AI.md +93 -56
- package/ROADMAP.md +22 -11
- package/docs/AI_CONTEXT.md.template +2 -0
- package/docs/AI_ONBOARDING_PROMPT.md.template +36 -19
- package/docs/COMMANDS.md.template +73 -1
- package/docs/CONTEXTO.md.template +2 -0
- package/docs/DECISIONS.md.template +1 -0
- package/docs/GITFLOW_PR_GUIDE.md.template +11 -0
- package/docs/INDEX.md.template +20 -18
- package/docs/STANDARD.md.template +1 -1
- package/docs/STATUS.md.template +1 -0
- package/docs/SUPPORT_MATRIX.md.template +6 -2
- package/docs/TROUBLESHOOTING.md.template +79 -1
- package/docs/WORKFLOW.md.template +26 -18
- package/package.json +24 -2
- package/package.template.json +24 -7
- package/scripts/check-pr-readiness.sh +1 -1
- package/scripts/check-scope.sh +0 -1
- package/scripts/check-slice-readiness.sh +3 -4
- package/scripts/init-docs.sh +53 -6
- package/scripts/package-quiver.sh +18 -2
- package/specs/quiver-v20-ai-cli-orchestration/EVIDENCE_REPORT.md +23 -0
- package/specs/quiver-v20-ai-cli-orchestration/EXECUTION_PLAN.md +57 -0
- package/specs/quiver-v20-ai-cli-orchestration/SPEC.md +202 -0
- package/specs/quiver-v20-ai-cli-orchestration/STATUS.md +35 -0
- package/specs/quiver-v20-ai-cli-orchestration/pr.md +100 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-00-spec-foundation/CLOSURE_BRIEF.md +30 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-00-spec-foundation/EXECUTION_BRIEF.md +61 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-00-spec-foundation/slice.json +54 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-01-ai-provider-runner/CLOSURE_BRIEF.md +39 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-01-ai-provider-runner/EXECUTION_BRIEF.md +63 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-01-ai-provider-runner/slice.json +55 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-02-context-packs-token-budget/CLOSURE_BRIEF.md +40 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-02-context-packs-token-budget/EXECUTION_BRIEF.md +60 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-02-context-packs-token-budget/slice.json +54 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-03-ai-phase-gated-planner/CLOSURE_BRIEF.md +43 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-03-ai-phase-gated-planner/EXECUTION_BRIEF.md +62 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-03-ai-phase-gated-planner/slice.json +62 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-04-spec-slice-handoff-pr-generation/CLOSURE_BRIEF.md +36 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-04-spec-slice-handoff-pr-generation/EXECUTION_BRIEF.md +63 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-04-spec-slice-handoff-pr-generation/slice.json +59 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-05-execution-plan-parallel-worktrees/CLOSURE_BRIEF.md +32 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-05-execution-plan-parallel-worktrees/EXECUTION_BRIEF.md +61 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-05-execution-plan-parallel-worktrees/slice.json +59 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-06-ai-execute-slice-scope-enforcement/CLOSURE_BRIEF.md +36 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-06-ai-execute-slice-scope-enforcement/EXECUTION_BRIEF.md +64 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-06-ai-execute-slice-scope-enforcement/slice.json +65 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-07-github-pr-preflight/CLOSURE_BRIEF.md +36 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-07-github-pr-preflight/EXECUTION_BRIEF.md +66 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-07-github-pr-preflight/slice.json +63 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-08-docs-smokes-release-readiness/CLOSURE_BRIEF.md +35 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-08-docs-smokes-release-readiness/EXECUTION_BRIEF.md +64 -0
- package/specs/quiver-v20-ai-cli-orchestration/slices/slice-08-docs-smokes-release-readiness/slice.json +77 -0
- package/specs/quiver-v21-ai-first-layout/EVIDENCE_REPORT.md +31 -0
- package/specs/quiver-v21-ai-first-layout/EXECUTION_PLAN.md +185 -0
- package/specs/quiver-v21-ai-first-layout/SPEC.md +212 -0
- package/specs/quiver-v21-ai-first-layout/STATUS.md +37 -0
- package/specs/quiver-v21-ai-first-layout/pr.md +110 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-00-spec-foundation/CLOSURE_BRIEF.md +30 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-00-spec-foundation/EXECUTION_BRIEF.md +63 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-00-spec-foundation/slice.json +45 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-01-init-profiles-dry-run/CLOSURE_BRIEF.md +31 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-01-init-profiles-dry-run/EXECUTION_BRIEF.md +59 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-01-init-profiles-dry-run/slice.json +57 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-02-internal-layout-template-resolver/CLOSURE_BRIEF.md +32 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-02-internal-layout-template-resolver/EXECUTION_BRIEF.md +60 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-02-internal-layout-template-resolver/slice.json +58 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-03-generation-profiles-visible-contract/CLOSURE_BRIEF.md +34 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-03-generation-profiles-visible-contract/EXECUTION_BRIEF.md +61 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-03-generation-profiles-visible-contract/slice.json +64 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-04-analyze-scan-relocation/CLOSURE_BRIEF.md +32 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-04-analyze-scan-relocation/EXECUTION_BRIEF.md +58 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-04-analyze-scan-relocation/slice.json +64 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-05-empty-specs-layout-doctor/CLOSURE_BRIEF.md +32 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-05-empty-specs-layout-doctor/EXECUTION_BRIEF.md +60 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-05-empty-specs-layout-doctor/slice.json +65 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-06-legacy-migration-optional-assets/CLOSURE_BRIEF.md +31 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-06-legacy-migration-optional-assets/EXECUTION_BRIEF.md +62 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-06-legacy-migration-optional-assets/slice.json +66 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-07-docs-guidance-alignment/CLOSURE_BRIEF.md +33 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-07-docs-guidance-alignment/EXECUTION_BRIEF.md +61 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-07-docs-guidance-alignment/slice.json +67 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-08-smokes-release-readiness/CLOSURE_BRIEF.md +35 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-08-smokes-release-readiness/EXECUTION_BRIEF.md +66 -0
- package/specs/quiver-v21-ai-first-layout/slices/slice-08-smokes-release-readiness/slice.json +62 -0
- package/specs/quiver-v22-guided-ai-workflow/EVIDENCE_REPORT.md +58 -0
- package/specs/quiver-v22-guided-ai-workflow/EXECUTION_PLAN.md +88 -0
- package/specs/quiver-v22-guided-ai-workflow/SPEC.md +228 -0
- package/specs/quiver-v22-guided-ai-workflow/STATUS.md +42 -0
- package/specs/quiver-v22-guided-ai-workflow/pr.md +104 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-00-spec-foundation/CLOSURE_BRIEF.md +35 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-00-spec-foundation/EXECUTION_BRIEF.md +61 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-00-spec-foundation/slice.json +51 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-01-docs-source-of-truth-sync/CLOSURE_BRIEF.md +31 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-01-docs-source-of-truth-sync/EXECUTION_BRIEF.md +58 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-01-docs-source-of-truth-sync/slice.json +55 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-02-prepare-command-diagnostics/CLOSURE_BRIEF.md +30 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-02-prepare-command-diagnostics/EXECUTION_BRIEF.md +57 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-02-prepare-command-diagnostics/slice.json +57 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-03-context-doc-refresh/CLOSURE_BRIEF.md +32 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-03-context-doc-refresh/EXECUTION_BRIEF.md +56 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-03-context-doc-refresh/slice.json +56 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-04-planner-approval-state/CLOSURE_BRIEF.md +33 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-04-planner-approval-state/EXECUTION_BRIEF.md +56 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-04-planner-approval-state/slice.json +58 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-05-spec-worktree-lifecycle/CLOSURE_BRIEF.md +32 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-05-spec-worktree-lifecycle/EXECUTION_BRIEF.md +56 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-05-spec-worktree-lifecycle/slice.json +54 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-06-executor-commit-recovery/CLOSURE_BRIEF.md +32 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-06-executor-commit-recovery/EXECUTION_BRIEF.md +58 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-06-executor-commit-recovery/slice.json +57 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-07-execution-waves-delegation/CLOSURE_BRIEF.md +32 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-07-execution-waves-delegation/EXECUTION_BRIEF.md +58 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-07-execution-waves-delegation/slice.json +55 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-08-pr-create-gh-ssh/CLOSURE_BRIEF.md +32 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-08-pr-create-gh-ssh/EXECUTION_BRIEF.md +58 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-08-pr-create-gh-ssh/slice.json +53 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-09-post-merge-cleanup-release-safety/CLOSURE_BRIEF.md +33 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-09-post-merge-cleanup-release-safety/EXECUTION_BRIEF.md +59 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-09-post-merge-cleanup-release-safety/slice.json +59 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-10-docs-smokes-release-readiness/CLOSURE_BRIEF.md +34 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-10-docs-smokes-release-readiness/EXECUTION_BRIEF.md +58 -0
- package/specs/quiver-v22-guided-ai-workflow/slices/slice-10-docs-smokes-release-readiness/slice.json +60 -0
- package/specs/quiver-v23-guided-flow-productization/EVIDENCE_REPORT.md +80 -0
- package/specs/quiver-v23-guided-flow-productization/EXECUTION_PLAN.md +80 -0
- package/specs/quiver-v23-guided-flow-productization/SPEC.md +203 -0
- package/specs/quiver-v23-guided-flow-productization/STATUS.md +39 -0
- package/specs/quiver-v23-guided-flow-productization/pr.md +119 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-00-spec-foundation/CLOSURE_BRIEF.md +30 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-00-spec-foundation/EXECUTION_BRIEF.md +61 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-00-spec-foundation/slice.json +51 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-01-short-command-and-flow-entrypoint/CLOSURE_BRIEF.md +33 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-01-short-command-and-flow-entrypoint/EXECUTION_BRIEF.md +35 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-01-short-command-and-flow-entrypoint/slice.json +56 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-02-flow-status-wizard/CLOSURE_BRIEF.md +31 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-02-flow-status-wizard/EXECUTION_BRIEF.md +29 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-02-flow-status-wizard/slice.json +55 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-03-agent-profiles/CLOSURE_BRIEF.md +33 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-03-agent-profiles/EXECUTION_BRIEF.md +29 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-03-agent-profiles/slice.json +54 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-04-context-preparation-onboarding/CLOSURE_BRIEF.md +32 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-04-context-preparation-onboarding/EXECUTION_BRIEF.md +30 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-04-context-preparation-onboarding/slice.json +59 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-05-planner-iteration-history/CLOSURE_BRIEF.md +31 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-05-planner-iteration-history/EXECUTION_BRIEF.md +29 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-05-planner-iteration-history/slice.json +53 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-06-production-plan-review/CLOSURE_BRIEF.md +33 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-06-production-plan-review/EXECUTION_BRIEF.md +30 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-06-production-plan-review/slice.json +54 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-07-spec-create-experience/CLOSURE_BRIEF.md +33 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-07-spec-create-experience/EXECUTION_BRIEF.md +30 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-07-spec-create-experience/slice.json +55 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-08-executor-prompt-generation/CLOSURE_BRIEF.md +32 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-08-executor-prompt-generation/EXECUTION_BRIEF.md +30 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-08-executor-prompt-generation/slice.json +55 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-09-delegated-slice-execution/CLOSURE_BRIEF.md +33 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-09-delegated-slice-execution/EXECUTION_BRIEF.md +34 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-09-delegated-slice-execution/slice.json +57 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-10-docs-smokes-release-readiness/CLOSURE_BRIEF.md +33 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-10-docs-smokes-release-readiness/EXECUTION_BRIEF.md +32 -0
- package/specs/quiver-v23-guided-flow-productization/slices/slice-10-docs-smokes-release-readiness/slice.json +63 -0
- package/specs/quiver-v24-dx-onboarding-hardening/EVIDENCE_REPORT.md +55 -0
- package/specs/quiver-v24-dx-onboarding-hardening/EXECUTION_PLAN.md +43 -0
- package/specs/quiver-v24-dx-onboarding-hardening/SPEC.md +149 -0
- package/specs/quiver-v24-dx-onboarding-hardening/STATUS.md +31 -0
- package/specs/quiver-v24-dx-onboarding-hardening/pr.md +76 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-00-spec-foundation/CLOSURE_BRIEF.md +31 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-00-spec-foundation/EXECUTION_BRIEF.md +52 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-00-spec-foundation/slice.json +51 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-01-init-template-hygiene/CLOSURE_BRIEF.md +38 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-01-init-template-hygiene/EXECUTION_BRIEF.md +53 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-01-init-template-hygiene/slice.json +55 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-02-cli-command-routing-version-errors/CLOSURE_BRIEF.md +33 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-02-cli-command-routing-version-errors/EXECUTION_BRIEF.md +50 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-02-cli-command-routing-version-errors/slice.json +52 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-03-doctor-fix-doc-link-checks/CLOSURE_BRIEF.md +33 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-03-doctor-fix-doc-link-checks/EXECUTION_BRIEF.md +50 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-03-doctor-fix-doc-link-checks/slice.json +53 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-04-prepare-output-ai-context-drafts/CLOSURE_BRIEF.md +33 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-04-prepare-output-ai-context-drafts/EXECUTION_BRIEF.md +50 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-04-prepare-output-ai-context-drafts/slice.json +70 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-05-local-slice-validation-base-guidance/CLOSURE_BRIEF.md +36 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-05-local-slice-validation-base-guidance/EXECUTION_BRIEF.md +49 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-05-local-slice-validation-base-guidance/slice.json +52 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-06-plan-graph-next-history-views/CLOSURE_BRIEF.md +43 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-06-plan-graph-next-history-views/EXECUTION_BRIEF.md +53 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-06-plan-graph-next-history-views/slice.json +60 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-07-analyzer-command-map-hardening/CLOSURE_BRIEF.md +32 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-07-analyzer-command-map-hardening/EXECUTION_BRIEF.md +50 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-07-analyzer-command-map-hardening/slice.json +51 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-08-evidence-run-command/CLOSURE_BRIEF.md +34 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-08-evidence-run-command/EXECUTION_BRIEF.md +52 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-08-evidence-run-command/slice.json +54 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-09-spec-viewer-demo-scaffolding/CLOSURE_BRIEF.md +34 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-09-spec-viewer-demo-scaffolding/EXECUTION_BRIEF.md +51 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-09-spec-viewer-demo-scaffolding/slice.json +59 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-10-docs-smokes-release-readiness/CLOSURE_BRIEF.md +33 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-10-docs-smokes-release-readiness/EXECUTION_BRIEF.md +54 -0
- package/specs/quiver-v24-dx-onboarding-hardening/slices/slice-10-docs-smokes-release-readiness/slice.json +76 -0
- package/src/create-quiver/commands/ai.js +915 -0
- package/src/create-quiver/commands/demo.js +22 -0
- package/src/create-quiver/commands/evidence.js +37 -0
- package/src/create-quiver/commands/flow.js +561 -0
- package/src/create-quiver/commands/graph.js +14 -1
- package/src/create-quiver/commands/next.js +28 -0
- package/src/create-quiver/commands/plan.js +6 -3
- package/src/create-quiver/commands/prepare.js +236 -0
- package/src/create-quiver/commands/spec.js +133 -0
- package/src/create-quiver/index.js +1096 -96
- package/src/create-quiver/lib/agent-profiles.js +148 -0
- package/src/create-quiver/lib/ai/context-packs.js +170 -0
- package/src/create-quiver/lib/ai/execution-plan.js +614 -0
- package/src/create-quiver/lib/ai/executor.js +682 -0
- package/src/create-quiver/lib/ai/github.js +525 -0
- package/src/create-quiver/lib/ai/onboarding-template.js +365 -0
- package/src/create-quiver/lib/ai/phase-gates.js +72 -0
- package/src/create-quiver/lib/ai/plan-review.js +283 -0
- package/src/create-quiver/lib/ai/preflight.js +58 -0
- package/src/create-quiver/lib/ai/prompt-transport.js +81 -0
- package/src/create-quiver/lib/ai/prompts.js +39 -0
- package/src/create-quiver/lib/ai/providers.js +315 -0
- package/src/create-quiver/lib/ai/safety.js +156 -0
- package/src/create-quiver/lib/ai/spec-generator.js +314 -0
- package/src/create-quiver/lib/ai/spec-templates.js +715 -0
- package/src/create-quiver/lib/approvals.js +350 -0
- package/src/create-quiver/lib/demo.js +657 -0
- package/src/create-quiver/lib/doctor.js +348 -0
- package/src/create-quiver/lib/evidence.js +115 -0
- package/src/create-quiver/lib/git.js +21 -0
- package/src/create-quiver/lib/init-docs.js +545 -23
- package/src/create-quiver/lib/init-layout.js +451 -0
- package/src/create-quiver/lib/lifecycle.js +8 -2
- package/src/create-quiver/lib/package-safety.js +117 -0
- package/src/create-quiver/lib/paths.js +63 -2
- package/src/create-quiver/lib/project-scan.js +66 -0
- package/src/create-quiver/lib/readiness.js +87 -18
- package/src/create-quiver/lib/scope.js +125 -0
- package/src/create-quiver/lib/slice-graph.js +7 -0
- package/src/create-quiver/lib/slice.js +59 -16
- package/src/create-quiver/lib/spec-worktrees.js +349 -0
- package/src/create-quiver/lib/state.js +18 -1
- package/src/create-quiver/lib/template-resolver.js +74 -0
|
@@ -0,0 +1,614 @@
|
|
|
1
|
+
const fs = require('node:fs');
|
|
2
|
+
const path = require('node:path');
|
|
3
|
+
|
|
4
|
+
const { resolveProfileProvider } = require('../agent-profiles');
|
|
5
|
+
const { branchDelete, runGit, statusPorcelain, worktreeAdd, worktreePrune, worktreeRemove } = require('../git');
|
|
6
|
+
const { safeBranchName, worktreesRootForRepo } = require('../slice');
|
|
7
|
+
const { buildGraph, computeLevels, detectFileConflicts, isFoundationSliceId, readAllSlices, topoSort, SliceGraphError } = require('../slice-graph');
|
|
8
|
+
const { runExecuteSlice } = require('./executor');
|
|
9
|
+
|
|
10
|
+
const EXCLUDED_STATUSES = new Set(['completed', 'skipped', 'cancelled']);
|
|
11
|
+
const EXECUTION_MODES = new Set(['auto', 'manual', 'delegated']);
|
|
12
|
+
|
|
13
|
+
function formatError(message) {
|
|
14
|
+
return `create-quiver: ${message}`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function toRelativePath(repoRoot, filePath) {
|
|
18
|
+
return path.relative(repoRoot, filePath).split(path.sep).join('/');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function normalizeExecutionMode(mode) {
|
|
22
|
+
const value = String(mode || 'auto').trim().toLowerCase() || 'auto';
|
|
23
|
+
if (!EXECUTION_MODES.has(value)) {
|
|
24
|
+
throw new Error(formatError(`unsupported execution mode: ${mode}. Use auto, manual, or delegated.`));
|
|
25
|
+
}
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function summarizeSlice(node, repoRoot) {
|
|
30
|
+
return {
|
|
31
|
+
ref: node.ref,
|
|
32
|
+
spec_slug: node.specSlug,
|
|
33
|
+
slice_id: node.sliceId,
|
|
34
|
+
slice_path: node.slicePath ? toRelativePath(repoRoot, node.slicePath) : '',
|
|
35
|
+
title: node.title || node.sliceId,
|
|
36
|
+
status: node.status || 'draft',
|
|
37
|
+
files: Array.isArray(node.files) ? node.files : [],
|
|
38
|
+
depends_on: Array.isArray(node.depends_on) ? node.depends_on : [],
|
|
39
|
+
parallel_safe: node.parallel_safe || null,
|
|
40
|
+
parallel_safe_reason: node.parallel_safe_reason || null,
|
|
41
|
+
branch_name: node.json?.git?.branch_name || '',
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function buildPendingGraph(graph, options = {}) {
|
|
46
|
+
const specSlug = options.specSlug ? String(options.specSlug).trim() : '';
|
|
47
|
+
const pendingNodes = graph.nodes.filter((node) => {
|
|
48
|
+
if (specSlug && node.specSlug !== specSlug) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
return !EXCLUDED_STATUSES.has(String(node.status || '').toLowerCase());
|
|
52
|
+
});
|
|
53
|
+
const pendingRefs = new Set(pendingNodes.map((node) => node.ref));
|
|
54
|
+
const nodesBySpec = new Map();
|
|
55
|
+
const foundationRefsBySpec = new Map();
|
|
56
|
+
|
|
57
|
+
for (const node of pendingNodes) {
|
|
58
|
+
if (!nodesBySpec.has(node.specSlug)) {
|
|
59
|
+
nodesBySpec.set(node.specSlug, []);
|
|
60
|
+
}
|
|
61
|
+
nodesBySpec.get(node.specSlug).push(node);
|
|
62
|
+
|
|
63
|
+
if (isFoundationSliceId(node.sliceId)) {
|
|
64
|
+
if (!foundationRefsBySpec.has(node.specSlug)) {
|
|
65
|
+
foundationRefsBySpec.set(node.specSlug, []);
|
|
66
|
+
}
|
|
67
|
+
foundationRefsBySpec.get(node.specSlug).push(node.ref);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const edgeKey = (from, to) => `${from}::${to}`;
|
|
72
|
+
const edges = [];
|
|
73
|
+
const seenEdges = new Set();
|
|
74
|
+
|
|
75
|
+
for (const edge of graph.edges) {
|
|
76
|
+
if (!pendingRefs.has(edge.from) || !pendingRefs.has(edge.to)) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const key = edgeKey(edge.from, edge.to);
|
|
80
|
+
if (seenEdges.has(key)) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
seenEdges.add(key);
|
|
84
|
+
edges.push({ from: edge.from, to: edge.to });
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
for (const [specSlug, specNodes] of nodesBySpec.entries()) {
|
|
88
|
+
const foundationRefs = foundationRefsBySpec.get(specSlug) || [];
|
|
89
|
+
if (foundationRefs.length === 0) {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
for (const node of specNodes) {
|
|
94
|
+
if (isFoundationSliceId(node.sliceId)) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
for (const foundationRef of foundationRefs) {
|
|
99
|
+
const key = edgeKey(foundationRef, node.ref);
|
|
100
|
+
if (seenEdges.has(key)) {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
seenEdges.add(key);
|
|
104
|
+
edges.push({ from: foundationRef, to: node.ref, implicit: true, reason: 'slice-00 foundation barrier' });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return {
|
|
110
|
+
nodes: pendingNodes,
|
|
111
|
+
edges,
|
|
112
|
+
foundationRefs: Array.from(foundationRefsBySpec.values()).flat().sort((left, right) => String(left).localeCompare(String(right))),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function buildFallbackReason({ conflicts, unknownScopeSlices }) {
|
|
117
|
+
if (unknownScopeSlices.length > 0) {
|
|
118
|
+
return `Unknown file scope: ${unknownScopeSlices.join(', ')}`;
|
|
119
|
+
}
|
|
120
|
+
if (conflicts.length > 0) {
|
|
121
|
+
return `File conflicts: ${conflicts.map((conflict) => conflict.slices.join(', ')).join('; ')}`;
|
|
122
|
+
}
|
|
123
|
+
return '';
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function buildLevelStrategy(levelNodes, { parallelReady, conflicts, unknownScopeSlices }) {
|
|
127
|
+
if (parallelReady) {
|
|
128
|
+
return {
|
|
129
|
+
mode: 'temporary-per-slice',
|
|
130
|
+
temporary_worktrees: true,
|
|
131
|
+
reason: 'Run each ready slice in its own temporary worktree, then integrate the commits in stable level order.',
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (levelNodes.length > 1) {
|
|
136
|
+
return {
|
|
137
|
+
mode: 'sequential-fallback',
|
|
138
|
+
temporary_worktrees: false,
|
|
139
|
+
reason: buildFallbackReason({ conflicts, unknownScopeSlices }) || 'Run sequentially because this level is not parallel-ready.',
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return {
|
|
144
|
+
mode: 'shared-worktree',
|
|
145
|
+
temporary_worktrees: false,
|
|
146
|
+
reason: 'A single ready slice can reuse the active worktree.',
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function buildExecutionGroups(slices, parallelReady, fallbackReason) {
|
|
151
|
+
if (parallelReady) {
|
|
152
|
+
return [{
|
|
153
|
+
mode: 'parallel',
|
|
154
|
+
reason: 'No file-scope conflicts detected.',
|
|
155
|
+
slice_refs: slices.map((slice) => slice.ref),
|
|
156
|
+
}];
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return slices.map((slice) => ({
|
|
160
|
+
mode: 'sequential',
|
|
161
|
+
reason: fallbackReason || 'Sequential execution is the safe default.',
|
|
162
|
+
slice_refs: [slice.ref],
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function summarizeLevel(levelNodes, index, repoRoot) {
|
|
167
|
+
const slices = levelNodes.map((node) => summarizeSlice(node, repoRoot));
|
|
168
|
+
const sliceRefs = slices.map((slice) => slice.ref);
|
|
169
|
+
const conflicts = detectFileConflicts(levelNodes).map((group) => ({
|
|
170
|
+
files: group.files,
|
|
171
|
+
slices: group.slices,
|
|
172
|
+
}));
|
|
173
|
+
const unknownScopeSlices = slices
|
|
174
|
+
.filter((slice) => !Array.isArray(slice.files) || slice.files.length === 0)
|
|
175
|
+
.map((slice) => slice.ref);
|
|
176
|
+
const fallbackReason = buildFallbackReason({ conflicts, unknownScopeSlices });
|
|
177
|
+
const parallelReady = levelNodes.length > 1 && conflicts.length === 0 && unknownScopeSlices.length === 0;
|
|
178
|
+
|
|
179
|
+
return {
|
|
180
|
+
index,
|
|
181
|
+
slice_refs: sliceRefs,
|
|
182
|
+
parallel_ready: parallelReady,
|
|
183
|
+
requires_temporary_worktrees: parallelReady,
|
|
184
|
+
worktree_strategy: buildLevelStrategy(levelNodes, { parallelReady, conflicts, unknownScopeSlices }),
|
|
185
|
+
conflicts,
|
|
186
|
+
unknown_scope_slices: unknownScopeSlices,
|
|
187
|
+
fallback_reason: fallbackReason || null,
|
|
188
|
+
execution_groups: buildExecutionGroups(slices, parallelReady, fallbackReason),
|
|
189
|
+
slices,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function collectExecutionPlan(repoRoot, options = {}) {
|
|
194
|
+
try {
|
|
195
|
+
const allSlices = readAllSlices(repoRoot);
|
|
196
|
+
const graph = buildGraph(allSlices);
|
|
197
|
+
topoSort(graph);
|
|
198
|
+
|
|
199
|
+
const specSlug = options.specSlug ? String(options.specSlug).trim() : '';
|
|
200
|
+
const pendingGraph = buildPendingGraph(graph, { specSlug });
|
|
201
|
+
if (pendingGraph.nodes.length === 0) {
|
|
202
|
+
return {
|
|
203
|
+
root: repoRoot,
|
|
204
|
+
summary: {
|
|
205
|
+
total_slices: 0,
|
|
206
|
+
ready_levels: 0,
|
|
207
|
+
parallel_levels: 0,
|
|
208
|
+
foundation_refs: [],
|
|
209
|
+
},
|
|
210
|
+
ready_levels: [],
|
|
211
|
+
levels: [],
|
|
212
|
+
execution_order: [],
|
|
213
|
+
integration_order: [],
|
|
214
|
+
sequential_order: [],
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const readyLevels = computeLevels(pendingGraph);
|
|
219
|
+
const readyLevelReports = readyLevels.map((levelNodes, index) => summarizeLevel(levelNodes, index, repoRoot));
|
|
220
|
+
const executionOrder = topoSort(pendingGraph).map((node) => node.ref);
|
|
221
|
+
const integrationOrder = readyLevelReports.flatMap((level) => level.slice_refs);
|
|
222
|
+
const foundationRefs = pendingGraph.foundationRefs;
|
|
223
|
+
|
|
224
|
+
return {
|
|
225
|
+
root: repoRoot,
|
|
226
|
+
summary: {
|
|
227
|
+
total_slices: pendingGraph.nodes.length,
|
|
228
|
+
ready_levels: readyLevelReports.length,
|
|
229
|
+
parallel_levels: readyLevelReports.filter((level) => level.parallel_ready).length,
|
|
230
|
+
foundation_refs: foundationRefs,
|
|
231
|
+
},
|
|
232
|
+
ready_levels: readyLevelReports,
|
|
233
|
+
levels: readyLevelReports,
|
|
234
|
+
execution_order: executionOrder,
|
|
235
|
+
integration_order: integrationOrder,
|
|
236
|
+
sequential_order: executionOrder,
|
|
237
|
+
options: {
|
|
238
|
+
specSlug,
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
} catch (error) {
|
|
242
|
+
if (error instanceof SliceGraphError) {
|
|
243
|
+
throw error;
|
|
244
|
+
}
|
|
245
|
+
throw new Error(formatError(`unable to build execution plan: ${error.message || error}`));
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function formatHumanExecutionPlan(report) {
|
|
250
|
+
const lines = [
|
|
251
|
+
'Execution plan',
|
|
252
|
+
`Total slices: ${report.summary.total_slices}`,
|
|
253
|
+
`Ready levels: ${report.summary.ready_levels}`,
|
|
254
|
+
`Parallel levels: ${report.summary.parallel_levels}`,
|
|
255
|
+
`Foundation refs: ${report.summary.foundation_refs.length > 0 ? report.summary.foundation_refs.join(', ') : '-'}`,
|
|
256
|
+
'',
|
|
257
|
+
'Sequential order',
|
|
258
|
+
];
|
|
259
|
+
|
|
260
|
+
if (report.sequential_order.length === 0) {
|
|
261
|
+
lines.push('- none');
|
|
262
|
+
} else {
|
|
263
|
+
for (const [index, ref] of report.sequential_order.entries()) {
|
|
264
|
+
lines.push(`${index + 1}. ${ref}`);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
lines.push('', 'Ready levels');
|
|
269
|
+
|
|
270
|
+
if (report.ready_levels.length === 0) {
|
|
271
|
+
lines.push('- none');
|
|
272
|
+
return `${lines.join('\n')}\n`;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
for (const level of report.ready_levels) {
|
|
276
|
+
const modeLabel = level.parallel_ready ? 'parallel-ready' : 'sequential';
|
|
277
|
+
lines.push(`Level ${level.index} (${modeLabel})`);
|
|
278
|
+
lines.push(`Worktree strategy: ${level.worktree_strategy.mode}`);
|
|
279
|
+
if (level.fallback_reason) {
|
|
280
|
+
lines.push(`Fallback: ${level.fallback_reason}`);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
for (const slice of level.slices) {
|
|
284
|
+
lines.push(`- ${slice.ref} [${slice.status}]`);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
if (level.conflicts.length > 0) {
|
|
288
|
+
lines.push('Conflicts:');
|
|
289
|
+
for (const conflict of level.conflicts) {
|
|
290
|
+
lines.push(`- ${conflict.slices.join(', ')} :: ${conflict.files.join(', ')}`);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (level.unknown_scope_slices.length > 0) {
|
|
295
|
+
lines.push('Unknown scope:');
|
|
296
|
+
for (const ref of level.unknown_scope_slices) {
|
|
297
|
+
lines.push(`- ${ref}`);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
lines.push('');
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
lines.push('Integration order');
|
|
305
|
+
for (const [index, ref] of report.integration_order.entries()) {
|
|
306
|
+
lines.push(`${index + 1}. ${ref}`);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return `${lines.join('\n')}\n`;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function formatExecutePlanDryRun(report, options = {}) {
|
|
313
|
+
const provider = options.resolvedProvider || options.provider || 'codex';
|
|
314
|
+
const commitEnabled = options.commit === true;
|
|
315
|
+
const executionMode = normalizeExecutionMode(options.mode || options.executionMode);
|
|
316
|
+
const lines = [
|
|
317
|
+
'AI execute-plan dry-run',
|
|
318
|
+
`Execution mode: ${executionMode}`,
|
|
319
|
+
`Provider: ${provider}`,
|
|
320
|
+
`Commit after each slice: ${commitEnabled ? 'enabled' : 'disabled'}`,
|
|
321
|
+
`Total slices: ${report.summary.total_slices}`,
|
|
322
|
+
'',
|
|
323
|
+
'Waves',
|
|
324
|
+
];
|
|
325
|
+
|
|
326
|
+
const commandForSlice = (slice) => {
|
|
327
|
+
const parts = [
|
|
328
|
+
'npx create-quiver ai execute-slice',
|
|
329
|
+
`--slice ${JSON.stringify(slice.slice_path)}`,
|
|
330
|
+
`--provider ${provider}`,
|
|
331
|
+
];
|
|
332
|
+
if (commitEnabled) {
|
|
333
|
+
parts.push('--commit');
|
|
334
|
+
}
|
|
335
|
+
return parts.join(' ');
|
|
336
|
+
};
|
|
337
|
+
const promptCommandForSlice = (slice) => [
|
|
338
|
+
'npx create-quiver ai prompt-slice',
|
|
339
|
+
`--slice ${JSON.stringify(slice.slice_path)}`,
|
|
340
|
+
'--dry-run',
|
|
341
|
+
].join(' ');
|
|
342
|
+
|
|
343
|
+
for (const level of report.ready_levels) {
|
|
344
|
+
lines.push(`Wave ${level.index}: ${level.parallel_ready ? 'parallel-ready' : 'sequential'}`);
|
|
345
|
+
lines.push(`Workspace strategy: ${level.worktree_strategy.mode}`);
|
|
346
|
+
if (level.fallback_reason) {
|
|
347
|
+
lines.push(`Fallback: ${level.fallback_reason}`);
|
|
348
|
+
}
|
|
349
|
+
for (const group of level.execution_groups) {
|
|
350
|
+
lines.push(`Group: ${group.mode}`);
|
|
351
|
+
for (const ref of group.slice_refs) {
|
|
352
|
+
const slice = level.slices.find((item) => item.ref === ref);
|
|
353
|
+
lines.push(`- Prompt: ${promptCommandForSlice(slice)}`);
|
|
354
|
+
if (executionMode !== 'manual') {
|
|
355
|
+
lines.push(` Execute: ${commandForSlice(slice)}`);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
return `${lines.join('\n')}\n`;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
function buildRecoveryGuidance(ref, workspaces = []) {
|
|
365
|
+
const lines = [
|
|
366
|
+
'Recovery:',
|
|
367
|
+
`- Retry slice: npx create-quiver ai prompt-slice --slice <slice.json> --dry-run, then rerun only ${ref}.`,
|
|
368
|
+
'- Abort: inspect the active checkout and temporary worktrees before reverting, stashing, or removing anything.',
|
|
369
|
+
];
|
|
370
|
+
|
|
371
|
+
if (workspaces.length > 0) {
|
|
372
|
+
lines.push('- Temporary worktrees left for inspection:');
|
|
373
|
+
for (const workspace of workspaces) {
|
|
374
|
+
lines.push(` - ${workspace.worktreePath}`);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
return lines.join('\n');
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function appendRecovery(error, ref, workspaces = []) {
|
|
382
|
+
const message = error && error.message ? error.message : String(error);
|
|
383
|
+
if (message.includes('Recovery:')) {
|
|
384
|
+
return error;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
const wrapped = new Error(`${message}\n\n${buildRecoveryGuidance(ref, workspaces)}`);
|
|
388
|
+
wrapped.cause = error;
|
|
389
|
+
wrapped.code = error && error.code ? error.code : undefined;
|
|
390
|
+
wrapped.details = error && error.details ? error.details : undefined;
|
|
391
|
+
return wrapped;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
function ensureCleanIntegrationWorktree(repoRoot) {
|
|
395
|
+
const status = statusPorcelain(repoRoot);
|
|
396
|
+
if (status !== '') {
|
|
397
|
+
throw new Error(formatError(`delegated parallel execution requires a clean active worktree before integration. Dirty files: ${status.split('\n').join(', ')}`));
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
function buildDelegatedRunId() {
|
|
402
|
+
return new Date().toISOString().replace(/[^0-9A-Za-z]/g, '');
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
function buildDelegatedWorkspace(repoRoot, slice, runId, index, options = {}) {
|
|
406
|
+
const safeRef = safeBranchName(slice.ref).slice(0, 80);
|
|
407
|
+
const branchName = `quiver-exec-${runId}-${index + 1}-${safeRef}`;
|
|
408
|
+
const worktreesRoot = options.worktreesRoot || path.join(worktreesRootForRepo(repoRoot, branchName), 'execute-plan');
|
|
409
|
+
const worktreePath = path.join(worktreesRoot, runId, safeRef);
|
|
410
|
+
|
|
411
|
+
return {
|
|
412
|
+
branchName,
|
|
413
|
+
ref: slice.ref,
|
|
414
|
+
slice,
|
|
415
|
+
worktreePath,
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
function createDelegatedWorkspace(repoRoot, workspace, baseRef) {
|
|
420
|
+
if (fs.existsSync(workspace.worktreePath)) {
|
|
421
|
+
throw new Error(formatError(`temporary worktree path already exists: ${workspace.worktreePath}`));
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
fs.mkdirSync(path.dirname(workspace.worktreePath), { recursive: true });
|
|
425
|
+
worktreeAdd(repoRoot, workspace.worktreePath, baseRef, { branch: workspace.branchName });
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
function cleanupDelegatedWorkspace(repoRoot, workspace) {
|
|
429
|
+
try {
|
|
430
|
+
worktreeRemove(repoRoot, workspace.worktreePath);
|
|
431
|
+
} catch {
|
|
432
|
+
// Keep cleanup best-effort after successful integration.
|
|
433
|
+
}
|
|
434
|
+
try {
|
|
435
|
+
branchDelete(repoRoot, workspace.branchName, true);
|
|
436
|
+
} catch {
|
|
437
|
+
// The committed changes were already integrated; a leftover temp branch is non-blocking.
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
async function runSequentialGroup(repoRoot, level, group, options = {}) {
|
|
442
|
+
const runSlice = options.runExecuteSliceFn || runExecuteSlice;
|
|
443
|
+
const results = [];
|
|
444
|
+
|
|
445
|
+
for (const ref of group.slice_refs) {
|
|
446
|
+
const slice = level.slices.find((item) => item.ref === ref);
|
|
447
|
+
try {
|
|
448
|
+
const result = await runSlice(repoRoot, {
|
|
449
|
+
allowDirty: options.allowDirty === true,
|
|
450
|
+
commit: true,
|
|
451
|
+
context: options.context,
|
|
452
|
+
dryRun: false,
|
|
453
|
+
provider: options.provider,
|
|
454
|
+
providerExplicit: options.providerExplicit,
|
|
455
|
+
role: options.role,
|
|
456
|
+
slice: slice.slice_path,
|
|
457
|
+
timeout: options.timeout,
|
|
458
|
+
});
|
|
459
|
+
results.push({
|
|
460
|
+
level: level.index,
|
|
461
|
+
mode: 'sequential',
|
|
462
|
+
ref,
|
|
463
|
+
ok: true,
|
|
464
|
+
result,
|
|
465
|
+
workspace: repoRoot,
|
|
466
|
+
});
|
|
467
|
+
} catch (error) {
|
|
468
|
+
throw appendRecovery(error, ref);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
return results;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
async function runParallelGroupInWorktrees(repoRoot, level, group, options = {}) {
|
|
476
|
+
ensureCleanIntegrationWorktree(repoRoot);
|
|
477
|
+
|
|
478
|
+
const runSlice = options.runExecuteSliceFn || runExecuteSlice;
|
|
479
|
+
const baseRef = runGit(['rev-parse', 'HEAD'], repoRoot);
|
|
480
|
+
const runId = options.runId || buildDelegatedRunId();
|
|
481
|
+
const slices = group.slice_refs.map((ref) => level.slices.find((item) => item.ref === ref));
|
|
482
|
+
const workspaces = slices.map((slice, index) => buildDelegatedWorkspace(repoRoot, slice, runId, index, options));
|
|
483
|
+
|
|
484
|
+
let runResults;
|
|
485
|
+
try {
|
|
486
|
+
worktreePrune(repoRoot);
|
|
487
|
+
for (const workspace of workspaces) {
|
|
488
|
+
createDelegatedWorkspace(repoRoot, workspace, baseRef);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
runResults = await Promise.all(workspaces.map(async (workspace) => {
|
|
492
|
+
const result = await runSlice(workspace.worktreePath, {
|
|
493
|
+
allowDirty: false,
|
|
494
|
+
commit: true,
|
|
495
|
+
context: options.context,
|
|
496
|
+
dryRun: false,
|
|
497
|
+
provider: options.provider,
|
|
498
|
+
providerExplicit: options.providerExplicit,
|
|
499
|
+
role: options.role,
|
|
500
|
+
slice: workspace.slice.slice_path,
|
|
501
|
+
timeout: options.timeout,
|
|
502
|
+
});
|
|
503
|
+
const commit = runGit(['rev-parse', 'HEAD'], workspace.worktreePath);
|
|
504
|
+
if (commit === baseRef) {
|
|
505
|
+
throw new Error(formatError(`delegated slice ${workspace.ref} finished without creating a slice commit.`));
|
|
506
|
+
}
|
|
507
|
+
return {
|
|
508
|
+
commit,
|
|
509
|
+
level: level.index,
|
|
510
|
+
mode: 'parallel-worktree',
|
|
511
|
+
ok: true,
|
|
512
|
+
ref: workspace.ref,
|
|
513
|
+
result,
|
|
514
|
+
workspace,
|
|
515
|
+
};
|
|
516
|
+
}));
|
|
517
|
+
|
|
518
|
+
ensureCleanIntegrationWorktree(repoRoot);
|
|
519
|
+
for (const item of runResults) {
|
|
520
|
+
runGit(['cherry-pick', item.commit], repoRoot);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
for (const workspace of workspaces) {
|
|
524
|
+
cleanupDelegatedWorkspace(repoRoot, workspace);
|
|
525
|
+
}
|
|
526
|
+
} catch (error) {
|
|
527
|
+
throw appendRecovery(error, group.slice_refs.join(', '), workspaces);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
return runResults.map((item) => ({
|
|
531
|
+
level: item.level,
|
|
532
|
+
mode: item.mode,
|
|
533
|
+
ref: item.ref,
|
|
534
|
+
ok: item.ok,
|
|
535
|
+
result: item.result,
|
|
536
|
+
workspace: item.workspace.worktreePath,
|
|
537
|
+
integratedCommit: item.commit,
|
|
538
|
+
}));
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
async function runExecutePlan(repoRoot, options = {}) {
|
|
542
|
+
const report = collectExecutionPlan(repoRoot, options);
|
|
543
|
+
const execute = options.execute === true;
|
|
544
|
+
const executionMode = normalizeExecutionMode(options.mode || options.executionMode);
|
|
545
|
+
const provider = options.providerExplicit === true || (options.provider && options.providerExplicit !== false)
|
|
546
|
+
? options.provider
|
|
547
|
+
: resolveProfileProvider(repoRoot, options.role || 'executor', 'codex');
|
|
548
|
+
const resolvedOptions = {
|
|
549
|
+
...options,
|
|
550
|
+
mode: executionMode,
|
|
551
|
+
provider,
|
|
552
|
+
resolvedProvider: provider,
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
if (options.json && !execute) {
|
|
556
|
+
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
557
|
+
return { task: 'execute-plan', dryRun: true, report };
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
if (!execute || options.dryRun === true) {
|
|
561
|
+
process.stdout.write(formatExecutePlanDryRun(report, resolvedOptions));
|
|
562
|
+
return { task: 'execute-plan', dryRun: true, report };
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
if (executionMode === 'manual') {
|
|
566
|
+
throw new Error(formatError('ai execute-plan --execute does not support --mode manual. Use the printed prompt-slice commands, or choose --mode delegated.'));
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
if (options.commit !== true) {
|
|
570
|
+
throw new Error(formatError('ai execute-plan --execute requires --commit so each successful slice creates one commit.'));
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
const results = [];
|
|
574
|
+
|
|
575
|
+
for (const level of report.ready_levels) {
|
|
576
|
+
for (const group of level.execution_groups) {
|
|
577
|
+
try {
|
|
578
|
+
const groupResults = executionMode === 'delegated' && group.mode === 'parallel' && group.slice_refs.length > 1
|
|
579
|
+
? await runParallelGroupInWorktrees(repoRoot, level, group, resolvedOptions)
|
|
580
|
+
: await runSequentialGroup(repoRoot, level, group, resolvedOptions);
|
|
581
|
+
results.push(...groupResults);
|
|
582
|
+
} catch (error) {
|
|
583
|
+
const wrapped = new Error(formatError(`ai execute-plan stopped at wave ${level.index} group ${group.slice_refs.join(', ')}: ${error.message || error}`));
|
|
584
|
+
wrapped.cause = error;
|
|
585
|
+
wrapped.code = error.code || 'AI_EXECUTE_PLAN_FAILED';
|
|
586
|
+
wrapped.details = { level: level.index, group, results };
|
|
587
|
+
throw wrapped;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
process.stdout.write(`AI execute-plan completed\nSlices executed: ${results.length}\n`);
|
|
593
|
+
return { task: 'execute-plan', dryRun: false, report, results };
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
function runExecutionPlan(repoRoot, options = {}) {
|
|
597
|
+
const report = collectExecutionPlan(repoRoot, options);
|
|
598
|
+
if (options.json) {
|
|
599
|
+
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
600
|
+
return report;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
process.stdout.write(formatHumanExecutionPlan(report, options));
|
|
604
|
+
return report;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
module.exports = {
|
|
608
|
+
collectExecutionPlan,
|
|
609
|
+
formatExecutePlanDryRun,
|
|
610
|
+
formatHumanExecutionPlan,
|
|
611
|
+
normalizeExecutionMode,
|
|
612
|
+
runExecutePlan,
|
|
613
|
+
runExecutionPlan,
|
|
614
|
+
};
|