@opengsd/get-shit-done-redux 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.ja-JP.md +870 -0
- package/README.ko-KR.md +861 -0
- package/README.md +300 -0
- package/README.pt-BR.md +492 -0
- package/README.zh-CN.md +842 -0
- package/agents/gsd-advisor-researcher.md +127 -0
- package/agents/gsd-ai-researcher.md +133 -0
- package/agents/gsd-assumptions-analyzer.md +105 -0
- package/agents/gsd-code-fixer.md +668 -0
- package/agents/gsd-code-reviewer.md +387 -0
- package/agents/gsd-codebase-mapper.md +853 -0
- package/agents/gsd-debug-session-manager.md +314 -0
- package/agents/gsd-debugger.md +1452 -0
- package/agents/gsd-doc-classifier.md +168 -0
- package/agents/gsd-doc-synthesizer.md +204 -0
- package/agents/gsd-doc-verifier.md +217 -0
- package/agents/gsd-doc-writer.md +615 -0
- package/agents/gsd-domain-researcher.md +153 -0
- package/agents/gsd-eval-auditor.md +191 -0
- package/agents/gsd-eval-planner.md +154 -0
- package/agents/gsd-executor.md +774 -0
- package/agents/gsd-framework-selector.md +160 -0
- package/agents/gsd-integration-checker.md +470 -0
- package/agents/gsd-intel-updater.md +342 -0
- package/agents/gsd-nyquist-auditor.md +203 -0
- package/agents/gsd-pattern-mapper.md +335 -0
- package/agents/gsd-phase-researcher.md +928 -0
- package/agents/gsd-plan-checker.md +978 -0
- package/agents/gsd-planner.md +1278 -0
- package/agents/gsd-project-researcher.md +677 -0
- package/agents/gsd-research-synthesizer.md +247 -0
- package/agents/gsd-roadmapper.md +688 -0
- package/agents/gsd-security-auditor.md +155 -0
- package/agents/gsd-ui-auditor.md +495 -0
- package/agents/gsd-ui-checker.md +309 -0
- package/agents/gsd-ui-researcher.md +380 -0
- package/agents/gsd-user-profiler.md +171 -0
- package/agents/gsd-verifier.md +917 -0
- package/bin/gsd-sdk.js +37 -0
- package/bin/install.js +11468 -0
- package/bin/lib/ui-safety-gate.cjs +107 -0
- package/commands/gsd/add-tests.md +42 -0
- package/commands/gsd/ai-integration-phase.md +37 -0
- package/commands/gsd/audit-fix.md +34 -0
- package/commands/gsd/audit-milestone.md +37 -0
- package/commands/gsd/audit-uat.md +24 -0
- package/commands/gsd/autonomous.md +46 -0
- package/commands/gsd/capture.md +62 -0
- package/commands/gsd/cleanup.md +24 -0
- package/commands/gsd/code-review.md +59 -0
- package/commands/gsd/complete-milestone.md +143 -0
- package/commands/gsd/config.md +58 -0
- package/commands/gsd/debug.md +52 -0
- package/commands/gsd/discuss-phase.md +76 -0
- package/commands/gsd/docs-update.md +49 -0
- package/commands/gsd/eval-review.md +33 -0
- package/commands/gsd/execute-phase.md +64 -0
- package/commands/gsd/explore.md +27 -0
- package/commands/gsd/extract-learnings.md +23 -0
- package/commands/gsd/fast.md +31 -0
- package/commands/gsd/forensics.md +57 -0
- package/commands/gsd/graphify.md +199 -0
- package/commands/gsd/health.md +31 -0
- package/commands/gsd/help.md +28 -0
- package/commands/gsd/import.md +41 -0
- package/commands/gsd/inbox.md +39 -0
- package/commands/gsd/ingest-docs.md +42 -0
- package/commands/gsd/manager.md +45 -0
- package/commands/gsd/map-codebase.md +83 -0
- package/commands/gsd/milestone-summary.md +51 -0
- package/commands/gsd/mvp-phase.md +45 -0
- package/commands/gsd/new-milestone.md +45 -0
- package/commands/gsd/new-project.md +47 -0
- package/commands/gsd/ns-context.md +23 -0
- package/commands/gsd/ns-ideate.md +24 -0
- package/commands/gsd/ns-manage.md +29 -0
- package/commands/gsd/ns-project.md +22 -0
- package/commands/gsd/ns-review.md +26 -0
- package/commands/gsd/ns-workflow.md +28 -0
- package/commands/gsd/pause-work.md +43 -0
- package/commands/gsd/phase.md +56 -0
- package/commands/gsd/plan-phase.md +62 -0
- package/commands/gsd/plan-review-convergence.md +59 -0
- package/commands/gsd/pr-branch.md +26 -0
- package/commands/gsd/profile-user.md +46 -0
- package/commands/gsd/progress.md +46 -0
- package/commands/gsd/quick.md +174 -0
- package/commands/gsd/resume-work.md +30 -0
- package/commands/gsd/review-backlog.md +63 -0
- package/commands/gsd/review.md +41 -0
- package/commands/gsd/secure-phase.md +36 -0
- package/commands/gsd/settings.md +29 -0
- package/commands/gsd/ship.md +24 -0
- package/commands/gsd/sketch.md +60 -0
- package/commands/gsd/spec-phase.md +63 -0
- package/commands/gsd/spike.md +57 -0
- package/commands/gsd/stats.md +19 -0
- package/commands/gsd/surface.md +155 -0
- package/commands/gsd/thread.md +24 -0
- package/commands/gsd/ui-phase.md +35 -0
- package/commands/gsd/ui-review.md +33 -0
- package/commands/gsd/ultraplan-phase.md +34 -0
- package/commands/gsd/undo.md +35 -0
- package/commands/gsd/update.md +48 -0
- package/commands/gsd/validate-phase.md +36 -0
- package/commands/gsd/verify-work.md +39 -0
- package/commands/gsd/workspace.md +52 -0
- package/commands/gsd/workstreams.md +70 -0
- package/get-shit-done/bin/check-latest-version.cjs +104 -0
- package/get-shit-done/bin/gsd-tools.cjs +1630 -0
- package/get-shit-done/bin/lib/active-workstream-store.cjs +85 -0
- package/get-shit-done/bin/lib/adr-parser.cjs +394 -0
- package/get-shit-done/bin/lib/artifacts.cjs +53 -0
- package/get-shit-done/bin/lib/audit.cjs +755 -0
- package/get-shit-done/bin/lib/cjs-command-router-adapter.cjs +39 -0
- package/get-shit-done/bin/lib/cjs-sdk-bridge.cjs +136 -0
- package/get-shit-done/bin/lib/clusters.cjs +135 -0
- package/get-shit-done/bin/lib/code-review-flags.cjs +74 -0
- package/get-shit-done/bin/lib/command-aliases.generated.cjs +824 -0
- package/get-shit-done/bin/lib/command-routing-hub.cjs +239 -0
- package/get-shit-done/bin/lib/commands.cjs +1035 -0
- package/get-shit-done/bin/lib/config-schema.cjs +31 -0
- package/get-shit-done/bin/lib/config.cjs +704 -0
- package/get-shit-done/bin/lib/configuration.generated.cjs +253 -0
- package/get-shit-done/bin/lib/context-utilization.cjs +47 -0
- package/get-shit-done/bin/lib/core.cjs +1922 -0
- package/get-shit-done/bin/lib/decisions.cjs +19 -0
- package/get-shit-done/bin/lib/decisions.generated.cjs +121 -0
- package/get-shit-done/bin/lib/docs.cjs +270 -0
- package/get-shit-done/bin/lib/drift.cjs +388 -0
- package/get-shit-done/bin/lib/fallow-runner.cjs +109 -0
- package/get-shit-done/bin/lib/frontmatter.cjs +389 -0
- package/get-shit-done/bin/lib/gap-checker.cjs +205 -0
- package/get-shit-done/bin/lib/graphify.cjs +592 -0
- package/get-shit-done/bin/lib/gsd2-import.cjs +514 -0
- package/get-shit-done/bin/lib/init-command-router.cjs +174 -0
- package/get-shit-done/bin/lib/init.cjs +2096 -0
- package/get-shit-done/bin/lib/install-profiles.cjs +603 -0
- package/get-shit-done/bin/lib/installer-migration-authoring.cjs +117 -0
- package/get-shit-done/bin/lib/installer-migration-report.cjs +354 -0
- package/get-shit-done/bin/lib/installer-migrations/000-first-time-baseline.cjs +220 -0
- package/get-shit-done/bin/lib/installer-migrations/001-legacy-orphan-files.cjs +41 -0
- package/get-shit-done/bin/lib/installer-migrations/002-codex-legacy-hooks-json.cjs +80 -0
- package/get-shit-done/bin/lib/installer-migrations.cjs +776 -0
- package/get-shit-done/bin/lib/intel.cjs +643 -0
- package/get-shit-done/bin/lib/learnings.cjs +379 -0
- package/get-shit-done/bin/lib/milestone.cjs +314 -0
- package/get-shit-done/bin/lib/model-catalog.cjs +136 -0
- package/get-shit-done/bin/lib/model-profiles.cjs +25 -0
- package/get-shit-done/bin/lib/phase-command-router.cjs +226 -0
- package/get-shit-done/bin/lib/phase.cjs +1490 -0
- package/get-shit-done/bin/lib/phases-command-router.cjs +97 -0
- package/get-shit-done/bin/lib/plan-scan.cjs +26 -0
- package/get-shit-done/bin/lib/plan-scan.generated.cjs +97 -0
- package/get-shit-done/bin/lib/planning-workspace.cjs +415 -0
- package/get-shit-done/bin/lib/profile-output.cjs +1130 -0
- package/get-shit-done/bin/lib/profile-pipeline.cjs +539 -0
- package/get-shit-done/bin/lib/project-root.generated.cjs +117 -0
- package/get-shit-done/bin/lib/prompt-budget.cjs +399 -0
- package/get-shit-done/bin/lib/review-reviewer-selection.cjs +125 -0
- package/get-shit-done/bin/lib/roadmap-command-router.cjs +99 -0
- package/get-shit-done/bin/lib/roadmap.cjs +642 -0
- package/get-shit-done/bin/lib/runtime-artifact-layout.cjs +301 -0
- package/get-shit-done/bin/lib/runtime-homes.cjs +185 -0
- package/get-shit-done/bin/lib/runtime-slash.cjs +109 -0
- package/get-shit-done/bin/lib/schema-detect.cjs +21 -0
- package/get-shit-done/bin/lib/schema-detect.generated.cjs +170 -0
- package/get-shit-done/bin/lib/secrets.cjs +20 -0
- package/get-shit-done/bin/lib/secrets.generated.cjs +37 -0
- package/get-shit-done/bin/lib/security.cjs +504 -0
- package/get-shit-done/bin/lib/shell-command-projection.cjs +552 -0
- package/get-shit-done/bin/lib/state-command-router.cjs +346 -0
- package/get-shit-done/bin/lib/state-document.cjs +12 -0
- package/get-shit-done/bin/lib/state-document.generated.cjs +127 -0
- package/get-shit-done/bin/lib/state.cjs +1940 -0
- package/get-shit-done/bin/lib/surface.cjs +430 -0
- package/get-shit-done/bin/lib/template.cjs +228 -0
- package/get-shit-done/bin/lib/uat.cjs +289 -0
- package/get-shit-done/bin/lib/validate-command-router.cjs +129 -0
- package/get-shit-done/bin/lib/verify-command-router.cjs +122 -0
- package/get-shit-done/bin/lib/verify.cjs +1458 -0
- package/get-shit-done/bin/lib/workstream-inventory-builder.generated.cjs +79 -0
- package/get-shit-done/bin/lib/workstream-inventory.cjs +132 -0
- package/get-shit-done/bin/lib/workstream-name-policy.cjs +19 -0
- package/get-shit-done/bin/lib/workstream-name-policy.generated.cjs +61 -0
- package/get-shit-done/bin/lib/workstream.cjs +374 -0
- package/get-shit-done/bin/lib/worktree-safety.cjs +985 -0
- package/get-shit-done/bin/verify-reapply-patches.cjs +336 -0
- package/get-shit-done/contexts/dev.md +21 -0
- package/get-shit-done/contexts/research.md +22 -0
- package/get-shit-done/contexts/review.md +23 -0
- package/get-shit-done/references/agent-contracts.md +79 -0
- package/get-shit-done/references/ai-evals.md +156 -0
- package/get-shit-done/references/ai-frameworks.md +186 -0
- package/get-shit-done/references/artifact-types.md +131 -0
- package/get-shit-done/references/autonomous-smart-discuss.md +277 -0
- package/get-shit-done/references/checkpoints.md +814 -0
- package/get-shit-done/references/common-bug-patterns.md +114 -0
- package/get-shit-done/references/context-budget.md +85 -0
- package/get-shit-done/references/continuation-format.md +253 -0
- package/get-shit-done/references/debugger-philosophy.md +76 -0
- package/get-shit-done/references/decimal-phase-calculation.md +64 -0
- package/get-shit-done/references/doc-conflict-engine.md +91 -0
- package/get-shit-done/references/domain-probes.md +125 -0
- package/get-shit-done/references/execute-mvp-tdd.md +81 -0
- package/get-shit-done/references/executor-examples.md +110 -0
- package/get-shit-done/references/few-shot-examples/plan-checker.md +73 -0
- package/get-shit-done/references/few-shot-examples/verifier.md +109 -0
- package/get-shit-done/references/gate-prompts.md +100 -0
- package/get-shit-done/references/gates.md +70 -0
- package/get-shit-done/references/git-integration.md +298 -0
- package/get-shit-done/references/git-planning-commit.md +40 -0
- package/get-shit-done/references/ios-scaffold.md +123 -0
- package/get-shit-done/references/mandatory-initial-read.md +2 -0
- package/get-shit-done/references/model-profile-resolution.md +38 -0
- package/get-shit-done/references/model-profiles.md +245 -0
- package/get-shit-done/references/mvp-concepts.md +49 -0
- package/get-shit-done/references/phase-argument-parsing.md +61 -0
- package/get-shit-done/references/planner-antipatterns.md +89 -0
- package/get-shit-done/references/planner-chunked.md +49 -0
- package/get-shit-done/references/planner-gap-closure.md +62 -0
- package/get-shit-done/references/planner-graphify-auto-update.md +67 -0
- package/get-shit-done/references/planner-human-verify-mode.md +57 -0
- package/get-shit-done/references/planner-mvp-mode.md +53 -0
- package/get-shit-done/references/planner-reviews.md +39 -0
- package/get-shit-done/references/planner-revision.md +87 -0
- package/get-shit-done/references/planner-source-audit.md +73 -0
- package/get-shit-done/references/planning-config.md +471 -0
- package/get-shit-done/references/project-skills-discovery.md +19 -0
- package/get-shit-done/references/questioning.md +162 -0
- package/get-shit-done/references/revision-loop.md +97 -0
- package/get-shit-done/references/scout-codebase.md +51 -0
- package/get-shit-done/references/skeleton-template.md +48 -0
- package/get-shit-done/references/sketch-interactivity.md +41 -0
- package/get-shit-done/references/sketch-theme-system.md +94 -0
- package/get-shit-done/references/sketch-tooling.md +45 -0
- package/get-shit-done/references/sketch-variant-patterns.md +81 -0
- package/get-shit-done/references/spidr-splitting.md +69 -0
- package/get-shit-done/references/tdd.md +330 -0
- package/get-shit-done/references/thinking-models-debug.md +44 -0
- package/get-shit-done/references/thinking-models-execution.md +50 -0
- package/get-shit-done/references/thinking-models-planning.md +62 -0
- package/get-shit-done/references/thinking-models-research.md +50 -0
- package/get-shit-done/references/thinking-models-verification.md +55 -0
- package/get-shit-done/references/thinking-partner.md +96 -0
- package/get-shit-done/references/ui-brand.md +160 -0
- package/get-shit-done/references/universal-anti-patterns.md +63 -0
- package/get-shit-done/references/user-profiling.md +681 -0
- package/get-shit-done/references/user-story-template.md +58 -0
- package/get-shit-done/references/verification-overrides.md +227 -0
- package/get-shit-done/references/verification-patterns.md +612 -0
- package/get-shit-done/references/verify-mvp-mode.md +85 -0
- package/get-shit-done/references/workstream-flag.md +111 -0
- package/get-shit-done/references/worktree-path-safety.md +89 -0
- package/get-shit-done/templates/AI-SPEC.md +246 -0
- package/get-shit-done/templates/DEBUG.md +169 -0
- package/get-shit-done/templates/README.md +77 -0
- package/get-shit-done/templates/SECURITY.md +61 -0
- package/get-shit-done/templates/UAT.md +265 -0
- package/get-shit-done/templates/UI-SPEC.md +100 -0
- package/get-shit-done/templates/VALIDATION.md +76 -0
- package/get-shit-done/templates/claude-md.md +145 -0
- package/get-shit-done/templates/codebase/architecture.md +255 -0
- package/get-shit-done/templates/codebase/concerns.md +310 -0
- package/get-shit-done/templates/codebase/conventions.md +307 -0
- package/get-shit-done/templates/codebase/integrations.md +280 -0
- package/get-shit-done/templates/codebase/stack.md +186 -0
- package/get-shit-done/templates/codebase/structure.md +285 -0
- package/get-shit-done/templates/codebase/testing.md +480 -0
- package/get-shit-done/templates/config.json +62 -0
- package/get-shit-done/templates/context.md +352 -0
- package/get-shit-done/templates/continue-here.md +78 -0
- package/get-shit-done/templates/copilot-instructions.md +7 -0
- package/get-shit-done/templates/debug-subagent-prompt.md +91 -0
- package/get-shit-done/templates/dev-preferences.md +21 -0
- package/get-shit-done/templates/discovery.md +146 -0
- package/get-shit-done/templates/discussion-log.md +63 -0
- package/get-shit-done/templates/milestone-archive.md +123 -0
- package/get-shit-done/templates/milestone.md +115 -0
- package/get-shit-done/templates/phase-prompt.md +610 -0
- package/get-shit-done/templates/planner-subagent-prompt.md +117 -0
- package/get-shit-done/templates/project.md +186 -0
- package/get-shit-done/templates/requirements.md +231 -0
- package/get-shit-done/templates/research-project/ARCHITECTURE.md +204 -0
- package/get-shit-done/templates/research-project/FEATURES.md +147 -0
- package/get-shit-done/templates/research-project/PITFALLS.md +200 -0
- package/get-shit-done/templates/research-project/STACK.md +120 -0
- package/get-shit-done/templates/research-project/SUMMARY.md +170 -0
- package/get-shit-done/templates/research.md +592 -0
- package/get-shit-done/templates/retrospective.md +54 -0
- package/get-shit-done/templates/roadmap.md +202 -0
- package/get-shit-done/templates/spec.md +307 -0
- package/get-shit-done/templates/state.md +184 -0
- package/get-shit-done/templates/summary-complex.md +59 -0
- package/get-shit-done/templates/summary-minimal.md +41 -0
- package/get-shit-done/templates/summary-standard.md +48 -0
- package/get-shit-done/templates/summary.md +248 -0
- package/get-shit-done/templates/user-profile.md +146 -0
- package/get-shit-done/templates/user-setup.md +311 -0
- package/get-shit-done/templates/verification-report.md +322 -0
- package/get-shit-done/workflows/add-backlog.md +101 -0
- package/get-shit-done/workflows/add-phase.md +123 -0
- package/get-shit-done/workflows/add-tests.md +365 -0
- package/get-shit-done/workflows/add-todo.md +171 -0
- package/get-shit-done/workflows/ai-integration-phase.md +305 -0
- package/get-shit-done/workflows/analyze-dependencies.md +96 -0
- package/get-shit-done/workflows/audit-fix.md +188 -0
- package/get-shit-done/workflows/audit-milestone.md +368 -0
- package/get-shit-done/workflows/audit-uat.md +120 -0
- package/get-shit-done/workflows/autonomous.md +805 -0
- package/get-shit-done/workflows/check-todos.md +190 -0
- package/get-shit-done/workflows/cleanup.md +165 -0
- package/get-shit-done/workflows/code-review-fix.md +512 -0
- package/get-shit-done/workflows/code-review.md +666 -0
- package/get-shit-done/workflows/complete-milestone.md +865 -0
- package/get-shit-done/workflows/debug.md +242 -0
- package/get-shit-done/workflows/diagnose-issues.md +251 -0
- package/get-shit-done/workflows/discovery-phase.md +291 -0
- package/get-shit-done/workflows/discuss-phase/modes/advisor.md +175 -0
- package/get-shit-done/workflows/discuss-phase/modes/all.md +28 -0
- package/get-shit-done/workflows/discuss-phase/modes/analyze.md +44 -0
- package/get-shit-done/workflows/discuss-phase/modes/auto.md +56 -0
- package/get-shit-done/workflows/discuss-phase/modes/batch.md +52 -0
- package/get-shit-done/workflows/discuss-phase/modes/chain.md +97 -0
- package/get-shit-done/workflows/discuss-phase/modes/default.md +141 -0
- package/get-shit-done/workflows/discuss-phase/modes/power.md +44 -0
- package/get-shit-done/workflows/discuss-phase/modes/text.md +55 -0
- package/get-shit-done/workflows/discuss-phase/templates/checkpoint.json +18 -0
- package/get-shit-done/workflows/discuss-phase/templates/context.md +136 -0
- package/get-shit-done/workflows/discuss-phase/templates/discussion-log.md +50 -0
- package/get-shit-done/workflows/discuss-phase-assumptions.md +685 -0
- package/get-shit-done/workflows/discuss-phase-power.md +291 -0
- package/get-shit-done/workflows/discuss-phase.md +499 -0
- package/get-shit-done/workflows/do.md +122 -0
- package/get-shit-done/workflows/docs-update.md +1172 -0
- package/get-shit-done/workflows/edit-phase.md +305 -0
- package/get-shit-done/workflows/eval-review.md +166 -0
- package/get-shit-done/workflows/execute-phase/steps/codebase-drift-gate.md +81 -0
- package/get-shit-done/workflows/execute-phase/steps/per-plan-worktree-gate.md +94 -0
- package/get-shit-done/workflows/execute-phase/steps/post-merge-gate.md +116 -0
- package/get-shit-done/workflows/execute-phase.md +1717 -0
- package/get-shit-done/workflows/execute-plan.md +536 -0
- package/get-shit-done/workflows/explore.md +154 -0
- package/get-shit-done/workflows/extract-learnings.md +253 -0
- package/get-shit-done/workflows/fast.md +124 -0
- package/get-shit-done/workflows/forensics.md +289 -0
- package/get-shit-done/workflows/graduation.md +206 -0
- package/get-shit-done/workflows/health.md +234 -0
- package/get-shit-done/workflows/help/modes/brief.md +22 -0
- package/get-shit-done/workflows/help/modes/default.md +50 -0
- package/get-shit-done/workflows/help/modes/full.md +784 -0
- package/get-shit-done/workflows/help/modes/topic.md +74 -0
- package/get-shit-done/workflows/help.md +24 -0
- package/get-shit-done/workflows/import.md +264 -0
- package/get-shit-done/workflows/inbox.md +387 -0
- package/get-shit-done/workflows/ingest-docs.md +339 -0
- package/get-shit-done/workflows/insert-phase.md +162 -0
- package/get-shit-done/workflows/list-phase-assumptions.md +178 -0
- package/get-shit-done/workflows/list-workspaces.md +67 -0
- package/get-shit-done/workflows/manager.md +403 -0
- package/get-shit-done/workflows/map-codebase.md +454 -0
- package/get-shit-done/workflows/milestone-summary.md +234 -0
- package/get-shit-done/workflows/mvp-phase.md +232 -0
- package/get-shit-done/workflows/new-milestone.md +645 -0
- package/get-shit-done/workflows/new-project.md +1487 -0
- package/get-shit-done/workflows/new-workspace.md +250 -0
- package/get-shit-done/workflows/next.md +231 -0
- package/get-shit-done/workflows/node-repair.md +92 -0
- package/get-shit-done/workflows/note.md +158 -0
- package/get-shit-done/workflows/pause-work.md +254 -0
- package/get-shit-done/workflows/plan-milestone-gaps.md +291 -0
- package/get-shit-done/workflows/plan-phase.md +1800 -0
- package/get-shit-done/workflows/plan-review-convergence.md +340 -0
- package/get-shit-done/workflows/plant-seed.md +240 -0
- package/get-shit-done/workflows/pr-branch.md +157 -0
- package/get-shit-done/workflows/profile-user.md +463 -0
- package/get-shit-done/workflows/progress.md +660 -0
- package/get-shit-done/workflows/quick.md +1049 -0
- package/get-shit-done/workflows/reapply-patches.md +426 -0
- package/get-shit-done/workflows/remove-phase.md +166 -0
- package/get-shit-done/workflows/remove-workspace.md +118 -0
- package/get-shit-done/workflows/resume-project.md +342 -0
- package/get-shit-done/workflows/review.md +633 -0
- package/get-shit-done/workflows/scan.md +115 -0
- package/get-shit-done/workflows/secure-phase.md +190 -0
- package/get-shit-done/workflows/session-report.md +146 -0
- package/get-shit-done/workflows/settings-advanced.md +590 -0
- package/get-shit-done/workflows/settings-integrations.md +292 -0
- package/get-shit-done/workflows/settings.md +545 -0
- package/get-shit-done/workflows/ship.md +366 -0
- package/get-shit-done/workflows/sketch-wrap-up.md +296 -0
- package/get-shit-done/workflows/sketch.md +371 -0
- package/get-shit-done/workflows/spec-phase.md +262 -0
- package/get-shit-done/workflows/spike-wrap-up.md +317 -0
- package/get-shit-done/workflows/spike.md +463 -0
- package/get-shit-done/workflows/stats.md +90 -0
- package/get-shit-done/workflows/sync-skills.md +182 -0
- package/get-shit-done/workflows/thread.md +232 -0
- package/get-shit-done/workflows/transition.md +704 -0
- package/get-shit-done/workflows/ui-phase.md +338 -0
- package/get-shit-done/workflows/ui-review.md +203 -0
- package/get-shit-done/workflows/ultraplan-phase.md +209 -0
- package/get-shit-done/workflows/undo.md +314 -0
- package/get-shit-done/workflows/update.md +664 -0
- package/get-shit-done/workflows/validate-phase.md +189 -0
- package/get-shit-done/workflows/verify-phase.md +554 -0
- package/get-shit-done/workflows/verify-work.md +791 -0
- package/hooks/dist/gsd-check-update-worker.js +117 -0
- package/hooks/dist/gsd-check-update.js +64 -0
- package/hooks/dist/gsd-context-monitor.js +192 -0
- package/hooks/dist/gsd-graphify-update.sh +158 -0
- package/hooks/dist/gsd-phase-boundary.sh +47 -0
- package/hooks/dist/gsd-prompt-guard.js +97 -0
- package/hooks/dist/gsd-read-guard.js +101 -0
- package/hooks/dist/gsd-read-injection-scanner.js +152 -0
- package/hooks/dist/gsd-session-state.sh +59 -0
- package/hooks/dist/gsd-statusline.js +537 -0
- package/hooks/dist/gsd-update-banner.js +134 -0
- package/hooks/dist/gsd-validate-commit.sh +57 -0
- package/hooks/dist/gsd-workflow-guard.js +94 -0
- package/hooks/dist/lib/git-cmd.js +150 -0
- package/hooks/dist/lib/gsd-graphify-rebuild.sh +65 -0
- package/hooks/gsd-check-update-worker.js +117 -0
- package/hooks/gsd-check-update.js +64 -0
- package/hooks/gsd-context-monitor.js +192 -0
- package/hooks/gsd-graphify-update.sh +158 -0
- package/hooks/gsd-phase-boundary.sh +47 -0
- package/hooks/gsd-prompt-guard.js +97 -0
- package/hooks/gsd-read-guard.js +101 -0
- package/hooks/gsd-read-injection-scanner.js +152 -0
- package/hooks/gsd-session-state.sh +59 -0
- package/hooks/gsd-statusline.js +537 -0
- package/hooks/gsd-update-banner.js +134 -0
- package/hooks/gsd-validate-commit.sh +57 -0
- package/hooks/gsd-workflow-guard.js +94 -0
- package/hooks/lib/git-cmd.js +150 -0
- package/hooks/lib/gsd-graphify-rebuild.sh +65 -0
- package/package.json +98 -0
- package/scripts/audit-workflow-script-paths.cjs +73 -0
- package/scripts/base64-scan.sh +262 -0
- package/scripts/build-hooks.js +227 -0
- package/scripts/changeset/cli.cjs +408 -0
- package/scripts/changeset/github-release-notes.cjs +198 -0
- package/scripts/changeset/lint.cjs +110 -0
- package/scripts/changeset/new.cjs +137 -0
- package/scripts/changeset/parse.cjs +114 -0
- package/scripts/changeset/render.cjs +34 -0
- package/scripts/changeset/serialize.cjs +130 -0
- package/scripts/command-contract-helpers.cjs +64 -0
- package/scripts/diff-touches-shipped-paths.cjs +147 -0
- package/scripts/fix-slash-commands.cjs +147 -0
- package/scripts/gen-inventory-manifest.cjs +109 -0
- package/scripts/lint-command-contract.cjs +108 -0
- package/scripts/lint-descriptions.cjs +83 -0
- package/scripts/lint-docs-required.cjs +222 -0
- package/scripts/lint-no-source-grep-extras.cjs +81 -0
- package/scripts/lint-no-source-grep.cjs +174 -0
- package/scripts/lint-pr-check-project-dir.cjs +98 -0
- package/scripts/lint-shared-module-handsync.cjs +331 -0
- package/scripts/lint-shell-command-projection-drift.cjs +57 -0
- package/scripts/lint-skill-deps.cjs +180 -0
- package/scripts/lint-test-file-count.allowlist.json +35 -0
- package/scripts/lint-test-file-count.cjs +190 -0
- package/scripts/pr-template-policy.cjs +268 -0
- package/scripts/prompt-injection-scan.sh +203 -0
- package/scripts/release-tarball-smoke.cjs +677 -0
- package/scripts/run-tests.cjs +178 -0
- package/scripts/secret-scan.sh +229 -0
- package/scripts/shared-module-handsync-allowlist.json +145 -0
- package/scripts/strip-prose-atrefs.cjs +106 -0
- package/scripts/sync-rulesets.sh +34 -0
- package/scripts/verify-tarball-sdk-dist.sh +69 -0
- package/sdk/dist/cli-transport.d.ts +19 -0
- package/sdk/dist/cli-transport.d.ts.map +1 -0
- package/sdk/dist/cli-transport.js +104 -0
- package/sdk/dist/cli-transport.js.map +1 -0
- package/sdk/dist/cli.d.ts +46 -0
- package/sdk/dist/cli.d.ts.map +1 -0
- package/sdk/dist/cli.js +511 -0
- package/sdk/dist/cli.js.map +1 -0
- package/sdk/dist/config.d.ts +108 -0
- package/sdk/dist/config.d.ts.map +1 -0
- package/sdk/dist/config.js +116 -0
- package/sdk/dist/config.js.map +1 -0
- package/sdk/dist/configuration/index.d.ts +85 -0
- package/sdk/dist/configuration/index.d.ts.map +1 -0
- package/sdk/dist/configuration/index.js +257 -0
- package/sdk/dist/configuration/index.js.map +1 -0
- package/sdk/dist/context-engine.d.ts +49 -0
- package/sdk/dist/context-engine.d.ts.map +1 -0
- package/sdk/dist/context-engine.js +142 -0
- package/sdk/dist/context-engine.js.map +1 -0
- package/sdk/dist/context-truncation.d.ts +33 -0
- package/sdk/dist/context-truncation.d.ts.map +1 -0
- package/sdk/dist/context-truncation.js +197 -0
- package/sdk/dist/context-truncation.js.map +1 -0
- package/sdk/dist/errors.d.ts +46 -0
- package/sdk/dist/errors.d.ts.map +1 -0
- package/sdk/dist/errors.js +64 -0
- package/sdk/dist/errors.js.map +1 -0
- package/sdk/dist/event-stream.d.ts +53 -0
- package/sdk/dist/event-stream.d.ts.map +1 -0
- package/sdk/dist/event-stream.js +321 -0
- package/sdk/dist/event-stream.js.map +1 -0
- package/sdk/dist/golden/capture.d.ts +15 -0
- package/sdk/dist/golden/capture.d.ts.map +1 -0
- package/sdk/dist/golden/capture.js +67 -0
- package/sdk/dist/golden/capture.js.map +1 -0
- package/sdk/dist/golden/golden-integration-covered.d.ts +6 -0
- package/sdk/dist/golden/golden-integration-covered.d.ts.map +1 -0
- package/sdk/dist/golden/golden-integration-covered.js +30 -0
- package/sdk/dist/golden/golden-integration-covered.js.map +1 -0
- package/sdk/dist/golden/golden-mutation-covered.d.ts +7 -0
- package/sdk/dist/golden/golden-mutation-covered.d.ts.map +1 -0
- package/sdk/dist/golden/golden-mutation-covered.js +17 -0
- package/sdk/dist/golden/golden-mutation-covered.js.map +1 -0
- package/sdk/dist/golden/golden-policy.d.ts +10 -0
- package/sdk/dist/golden/golden-policy.d.ts.map +1 -0
- package/sdk/dist/golden/golden-policy.js +98 -0
- package/sdk/dist/golden/golden-policy.js.map +1 -0
- package/sdk/dist/golden/init-golden-normalize.d.ts +8 -0
- package/sdk/dist/golden/init-golden-normalize.d.ts.map +1 -0
- package/sdk/dist/golden/init-golden-normalize.js +14 -0
- package/sdk/dist/golden/init-golden-normalize.js.map +1 -0
- package/sdk/dist/golden/read-only-golden-rows.d.ts +20 -0
- package/sdk/dist/golden/read-only-golden-rows.d.ts.map +1 -0
- package/sdk/dist/golden/read-only-golden-rows.js +67 -0
- package/sdk/dist/golden/read-only-golden-rows.js.map +1 -0
- package/sdk/dist/golden/registry-canonical-commands.d.ts +6 -0
- package/sdk/dist/golden/registry-canonical-commands.d.ts.map +1 -0
- package/sdk/dist/golden/registry-canonical-commands.js +30 -0
- package/sdk/dist/golden/registry-canonical-commands.js.map +1 -0
- package/sdk/dist/gsd-tools-error.d.ts +23 -0
- package/sdk/dist/gsd-tools-error.d.ts.map +1 -0
- package/sdk/dist/gsd-tools-error.js +29 -0
- package/sdk/dist/gsd-tools-error.js.map +1 -0
- package/sdk/dist/gsd-tools.d.ts +97 -0
- package/sdk/dist/gsd-tools.d.ts.map +1 -0
- package/sdk/dist/gsd-tools.js +168 -0
- package/sdk/dist/gsd-tools.js.map +1 -0
- package/sdk/dist/gsd-transport-policy.d.ts +10 -0
- package/sdk/dist/gsd-transport-policy.d.ts.map +1 -0
- package/sdk/dist/gsd-transport-policy.js +32 -0
- package/sdk/dist/gsd-transport-policy.js.map +1 -0
- package/sdk/dist/gsd-transport.d.ts +39 -0
- package/sdk/dist/gsd-transport.d.ts.map +1 -0
- package/sdk/dist/gsd-transport.js +78 -0
- package/sdk/dist/gsd-transport.js.map +1 -0
- package/sdk/dist/index.d.ts +127 -0
- package/sdk/dist/index.d.ts.map +1 -0
- package/sdk/dist/index.js +300 -0
- package/sdk/dist/index.js.map +1 -0
- package/sdk/dist/init-runner.d.ts +90 -0
- package/sdk/dist/init-runner.d.ts.map +1 -0
- package/sdk/dist/init-runner.js +613 -0
- package/sdk/dist/init-runner.js.map +1 -0
- package/sdk/dist/logger.d.ts +50 -0
- package/sdk/dist/logger.d.ts.map +1 -0
- package/sdk/dist/logger.js +70 -0
- package/sdk/dist/logger.js.map +1 -0
- package/sdk/dist/model-catalog.d.ts +31 -0
- package/sdk/dist/model-catalog.d.ts.map +1 -0
- package/sdk/dist/model-catalog.js +31 -0
- package/sdk/dist/model-catalog.js.map +1 -0
- package/sdk/dist/phase-prompt.d.ts +72 -0
- package/sdk/dist/phase-prompt.d.ts.map +1 -0
- package/sdk/dist/phase-prompt.js +213 -0
- package/sdk/dist/phase-prompt.js.map +1 -0
- package/sdk/dist/phase-runner.d.ts +145 -0
- package/sdk/dist/phase-runner.d.ts.map +1 -0
- package/sdk/dist/phase-runner.js +1206 -0
- package/sdk/dist/phase-runner.js.map +1 -0
- package/sdk/dist/plan-parser.d.ts +55 -0
- package/sdk/dist/plan-parser.d.ts.map +1 -0
- package/sdk/dist/plan-parser.js +389 -0
- package/sdk/dist/plan-parser.js.map +1 -0
- package/sdk/dist/planning-journal.d.ts +64 -0
- package/sdk/dist/planning-journal.d.ts.map +1 -0
- package/sdk/dist/planning-journal.js +88 -0
- package/sdk/dist/planning-journal.js.map +1 -0
- package/sdk/dist/planning-runtime.d.ts +67 -0
- package/sdk/dist/planning-runtime.d.ts.map +1 -0
- package/sdk/dist/planning-runtime.js +58 -0
- package/sdk/dist/planning-runtime.js.map +1 -0
- package/sdk/dist/project-root/index.d.ts +46 -0
- package/sdk/dist/project-root/index.d.ts.map +1 -0
- package/sdk/dist/project-root/index.js +138 -0
- package/sdk/dist/project-root/index.js.map +1 -0
- package/sdk/dist/prompt-builder.d.ts +44 -0
- package/sdk/dist/prompt-builder.d.ts.map +1 -0
- package/sdk/dist/prompt-builder.js +180 -0
- package/sdk/dist/prompt-builder.js.map +1 -0
- package/sdk/dist/prompt-sanitizer.d.ts +35 -0
- package/sdk/dist/prompt-sanitizer.d.ts.map +1 -0
- package/sdk/dist/prompt-sanitizer.js +101 -0
- package/sdk/dist/prompt-sanitizer.js.map +1 -0
- package/sdk/dist/query/active-workstream-store.d.ts +7 -0
- package/sdk/dist/query/active-workstream-store.d.ts.map +1 -0
- package/sdk/dist/query/active-workstream-store.js +56 -0
- package/sdk/dist/query/active-workstream-store.js.map +1 -0
- package/sdk/dist/query/agent-failure-classifier.d.ts +38 -0
- package/sdk/dist/query/agent-failure-classifier.d.ts.map +1 -0
- package/sdk/dist/query/agent-failure-classifier.js +83 -0
- package/sdk/dist/query/agent-failure-classifier.js.map +1 -0
- package/sdk/dist/query/audit-open.d.ts +46 -0
- package/sdk/dist/query/audit-open.d.ts.map +1 -0
- package/sdk/dist/query/audit-open.js +662 -0
- package/sdk/dist/query/audit-open.js.map +1 -0
- package/sdk/dist/query/check-auto-mode.d.ts +13 -0
- package/sdk/dist/query/check-auto-mode.d.ts.map +1 -0
- package/sdk/dist/query/check-auto-mode.js +40 -0
- package/sdk/dist/query/check-auto-mode.js.map +1 -0
- package/sdk/dist/query/check-completion.d.ts +10 -0
- package/sdk/dist/query/check-completion.d.ts.map +1 -0
- package/sdk/dist/query/check-completion.js +157 -0
- package/sdk/dist/query/check-completion.js.map +1 -0
- package/sdk/dist/query/check-decision-coverage.d.ts +33 -0
- package/sdk/dist/query/check-decision-coverage.d.ts.map +1 -0
- package/sdk/dist/query/check-decision-coverage.js +472 -0
- package/sdk/dist/query/check-decision-coverage.js.map +1 -0
- package/sdk/dist/query/check-gates.d.ts +10 -0
- package/sdk/dist/query/check-gates.d.ts.map +1 -0
- package/sdk/dist/query/check-gates.js +89 -0
- package/sdk/dist/query/check-gates.js.map +1 -0
- package/sdk/dist/query/check-ship-ready.d.ts +17 -0
- package/sdk/dist/query/check-ship-ready.d.ts.map +1 -0
- package/sdk/dist/query/check-ship-ready.js +121 -0
- package/sdk/dist/query/check-ship-ready.js.map +1 -0
- package/sdk/dist/query/check-verification-status.d.ts +10 -0
- package/sdk/dist/query/check-verification-status.d.ts.map +1 -0
- package/sdk/dist/query/check-verification-status.js +142 -0
- package/sdk/dist/query/check-verification-status.js.map +1 -0
- package/sdk/dist/query/command-aliases.generated.d.ts +31 -0
- package/sdk/dist/query/command-aliases.generated.d.ts.map +1 -0
- package/sdk/dist/query/command-aliases.generated.js +133 -0
- package/sdk/dist/query/command-aliases.generated.js.map +1 -0
- package/sdk/dist/query/command-catalog.d.ts +9 -0
- package/sdk/dist/query/command-catalog.d.ts.map +1 -0
- package/sdk/dist/query/command-catalog.js +17 -0
- package/sdk/dist/query/command-catalog.js.map +1 -0
- package/sdk/dist/query/command-definition.d.ts +19 -0
- package/sdk/dist/query/command-definition.d.ts.map +1 -0
- package/sdk/dist/query/command-definition.js +44 -0
- package/sdk/dist/query/command-definition.js.map +1 -0
- package/sdk/dist/query/command-family-handlers.d.ts +3 -0
- package/sdk/dist/query/command-family-handlers.d.ts.map +1 -0
- package/sdk/dist/query/command-family-handlers.js +101 -0
- package/sdk/dist/query/command-family-handlers.js.map +1 -0
- package/sdk/dist/query/command-manifest.d.ts +2 -0
- package/sdk/dist/query/command-manifest.d.ts.map +1 -0
- package/sdk/dist/query/command-manifest.init.d.ts +6 -0
- package/sdk/dist/query/command-manifest.init.d.ts.map +1 -0
- package/sdk/dist/query/command-manifest.init.js +23 -0
- package/sdk/dist/query/command-manifest.init.js.map +1 -0
- package/sdk/dist/query/command-manifest.js +17 -0
- package/sdk/dist/query/command-manifest.js.map +1 -0
- package/sdk/dist/query/command-manifest.non-family.d.ts +9 -0
- package/sdk/dist/query/command-manifest.non-family.d.ts.map +1 -0
- package/sdk/dist/query/command-manifest.non-family.js +60 -0
- package/sdk/dist/query/command-manifest.non-family.js.map +1 -0
- package/sdk/dist/query/command-manifest.phase.d.ts +6 -0
- package/sdk/dist/query/command-manifest.phase.d.ts.map +1 -0
- package/sdk/dist/query/command-manifest.phase.js +16 -0
- package/sdk/dist/query/command-manifest.phase.js.map +1 -0
- package/sdk/dist/query/command-manifest.phases.d.ts +7 -0
- package/sdk/dist/query/command-manifest.phases.d.ts.map +1 -0
- package/sdk/dist/query/command-manifest.phases.js +10 -0
- package/sdk/dist/query/command-manifest.phases.js.map +1 -0
- package/sdk/dist/query/command-manifest.roadmap.d.ts +6 -0
- package/sdk/dist/query/command-manifest.roadmap.d.ts.map +1 -0
- package/sdk/dist/query/command-manifest.roadmap.js +10 -0
- package/sdk/dist/query/command-manifest.roadmap.js.map +1 -0
- package/sdk/dist/query/command-manifest.state.d.ts +9 -0
- package/sdk/dist/query/command-manifest.state.d.ts.map +1 -0
- package/sdk/dist/query/command-manifest.state.js +30 -0
- package/sdk/dist/query/command-manifest.state.js.map +1 -0
- package/sdk/dist/query/command-manifest.types.d.ts +12 -0
- package/sdk/dist/query/command-manifest.types.d.ts.map +1 -0
- package/sdk/dist/query/command-manifest.types.js +2 -0
- package/sdk/dist/query/command-manifest.types.js.map +1 -0
- package/sdk/dist/query/command-manifest.validate.d.ts +6 -0
- package/sdk/dist/query/command-manifest.validate.d.ts.map +1 -0
- package/sdk/dist/query/command-manifest.validate.js +10 -0
- package/sdk/dist/query/command-manifest.validate.js.map +1 -0
- package/sdk/dist/query/command-manifest.verify.d.ts +6 -0
- package/sdk/dist/query/command-manifest.verify.d.ts.map +1 -0
- package/sdk/dist/query/command-manifest.verify.js +16 -0
- package/sdk/dist/query/command-manifest.verify.js.map +1 -0
- package/sdk/dist/query/command-static-catalog-domain.d.ts +3 -0
- package/sdk/dist/query/command-static-catalog-domain.d.ts.map +1 -0
- package/sdk/dist/query/command-static-catalog-domain.js +110 -0
- package/sdk/dist/query/command-static-catalog-domain.js.map +1 -0
- package/sdk/dist/query/command-static-catalog-foundation.d.ts +7 -0
- package/sdk/dist/query/command-static-catalog-foundation.d.ts.map +1 -0
- package/sdk/dist/query/command-static-catalog-foundation.js +106 -0
- package/sdk/dist/query/command-static-catalog-foundation.js.map +1 -0
- package/sdk/dist/query/command-topology.d.ts +32 -0
- package/sdk/dist/query/command-topology.d.ts.map +1 -0
- package/sdk/dist/query/command-topology.js +66 -0
- package/sdk/dist/query/command-topology.js.map +1 -0
- package/sdk/dist/query/commands-list.d.ts +14 -0
- package/sdk/dist/query/commands-list.d.ts.map +1 -0
- package/sdk/dist/query/commands-list.js +18 -0
- package/sdk/dist/query/commands-list.js.map +1 -0
- package/sdk/dist/query/commit.d.ts +179 -0
- package/sdk/dist/query/commit.d.ts.map +1 -0
- package/sdk/dist/query/commit.js +632 -0
- package/sdk/dist/query/commit.js.map +1 -0
- package/sdk/dist/query/config-gates.d.ts +12 -0
- package/sdk/dist/query/config-gates.d.ts.map +1 -0
- package/sdk/dist/query/config-gates.js +66 -0
- package/sdk/dist/query/config-gates.js.map +1 -0
- package/sdk/dist/query/config-mutation.d.ts +86 -0
- package/sdk/dist/query/config-mutation.d.ts.map +1 -0
- package/sdk/dist/query/config-mutation.js +602 -0
- package/sdk/dist/query/config-mutation.js.map +1 -0
- package/sdk/dist/query/config-query.d.ts +57 -0
- package/sdk/dist/query/config-query.d.ts.map +1 -0
- package/sdk/dist/query/config-query.js +277 -0
- package/sdk/dist/query/config-query.js.map +1 -0
- package/sdk/dist/query/config-schema.d.ts +19 -0
- package/sdk/dist/query/config-schema.d.ts.map +1 -0
- package/sdk/dist/query/config-schema.js +26 -0
- package/sdk/dist/query/config-schema.js.map +1 -0
- package/sdk/dist/query/decisions.d.ts +58 -0
- package/sdk/dist/query/decisions.d.ts.map +1 -0
- package/sdk/dist/query/decisions.js +165 -0
- package/sdk/dist/query/decisions.js.map +1 -0
- package/sdk/dist/query/detect-custom-files.d.ts +11 -0
- package/sdk/dist/query/detect-custom-files.d.ts.map +1 -0
- package/sdk/dist/query/detect-custom-files.js +89 -0
- package/sdk/dist/query/detect-custom-files.js.map +1 -0
- package/sdk/dist/query/detect-phase-type.d.ts +9 -0
- package/sdk/dist/query/detect-phase-type.d.ts.map +1 -0
- package/sdk/dist/query/detect-phase-type.js +124 -0
- package/sdk/dist/query/detect-phase-type.js.map +1 -0
- package/sdk/dist/query/docs-init.d.ts +26 -0
- package/sdk/dist/query/docs-init.d.ts.map +1 -0
- package/sdk/dist/query/docs-init.js +231 -0
- package/sdk/dist/query/docs-init.js.map +1 -0
- package/sdk/dist/query/fallow-audit.d.ts +44 -0
- package/sdk/dist/query/fallow-audit.d.ts.map +1 -0
- package/sdk/dist/query/fallow-audit.js +44 -0
- package/sdk/dist/query/fallow-audit.js.map +1 -0
- package/sdk/dist/query/frontmatter-mutation.d.ts +77 -0
- package/sdk/dist/query/frontmatter-mutation.d.ts.map +1 -0
- package/sdk/dist/query/frontmatter-mutation.js +299 -0
- package/sdk/dist/query/frontmatter-mutation.js.map +1 -0
- package/sdk/dist/query/frontmatter.d.ts +93 -0
- package/sdk/dist/query/frontmatter.d.ts.map +1 -0
- package/sdk/dist/query/frontmatter.js +364 -0
- package/sdk/dist/query/frontmatter.js.map +1 -0
- package/sdk/dist/query/helpers.d.ts +194 -0
- package/sdk/dist/query/helpers.d.ts.map +1 -0
- package/sdk/dist/query/helpers.js +540 -0
- package/sdk/dist/query/helpers.js.map +1 -0
- package/sdk/dist/query/index.d.ts +8 -0
- package/sdk/dist/query/index.d.ts.map +1 -0
- package/sdk/dist/query/index.js +6 -0
- package/sdk/dist/query/index.js.map +1 -0
- package/sdk/dist/query/init-complex.d.ts +47 -0
- package/sdk/dist/query/init-complex.d.ts.map +1 -0
- package/sdk/dist/query/init-complex.js +735 -0
- package/sdk/dist/query/init-complex.js.map +1 -0
- package/sdk/dist/query/init.d.ts +106 -0
- package/sdk/dist/query/init.d.ts.map +1 -0
- package/sdk/dist/query/init.js +1228 -0
- package/sdk/dist/query/init.js.map +1 -0
- package/sdk/dist/query/intel.d.ts +43 -0
- package/sdk/dist/query/intel.d.ts.map +1 -0
- package/sdk/dist/query/intel.js +416 -0
- package/sdk/dist/query/intel.js.map +1 -0
- package/sdk/dist/query/mutation-event-decorator.d.ts +5 -0
- package/sdk/dist/query/mutation-event-decorator.d.ts.map +1 -0
- package/sdk/dist/query/mutation-event-decorator.js +28 -0
- package/sdk/dist/query/mutation-event-decorator.js.map +1 -0
- package/sdk/dist/query/mutation-event-mapper.d.ts +4 -0
- package/sdk/dist/query/mutation-event-mapper.d.ts.map +1 -0
- package/sdk/dist/query/mutation-event-mapper.js +70 -0
- package/sdk/dist/query/mutation-event-mapper.js.map +1 -0
- package/sdk/dist/query/mvp.d.ts +113 -0
- package/sdk/dist/query/mvp.d.ts.map +1 -0
- package/sdk/dist/query/mvp.js +225 -0
- package/sdk/dist/query/mvp.js.map +1 -0
- package/sdk/dist/query/phase-filesystem-adapter.d.ts +4 -0
- package/sdk/dist/query/phase-filesystem-adapter.d.ts.map +1 -0
- package/sdk/dist/query/phase-filesystem-adapter.js +33 -0
- package/sdk/dist/query/phase-filesystem-adapter.js.map +1 -0
- package/sdk/dist/query/phase-lifecycle-policy.d.ts +34 -0
- package/sdk/dist/query/phase-lifecycle-policy.d.ts.map +1 -0
- package/sdk/dist/query/phase-lifecycle-policy.js +138 -0
- package/sdk/dist/query/phase-lifecycle-policy.js.map +1 -0
- package/sdk/dist/query/phase-lifecycle.d.ts +116 -0
- package/sdk/dist/query/phase-lifecycle.d.ts.map +1 -0
- package/sdk/dist/query/phase-lifecycle.js +1823 -0
- package/sdk/dist/query/phase-lifecycle.js.map +1 -0
- package/sdk/dist/query/phase-list-queries.d.ts +20 -0
- package/sdk/dist/query/phase-list-queries.d.ts.map +1 -0
- package/sdk/dist/query/phase-list-queries.js +129 -0
- package/sdk/dist/query/phase-list-queries.js.map +1 -0
- package/sdk/dist/query/phase-ready.d.ts +9 -0
- package/sdk/dist/query/phase-ready.d.ts.map +1 -0
- package/sdk/dist/query/phase-ready.js +132 -0
- package/sdk/dist/query/phase-ready.js.map +1 -0
- package/sdk/dist/query/phase-roadmap-mutation.d.ts +25 -0
- package/sdk/dist/query/phase-roadmap-mutation.d.ts.map +1 -0
- package/sdk/dist/query/phase-roadmap-mutation.js +76 -0
- package/sdk/dist/query/phase-roadmap-mutation.js.map +1 -0
- package/sdk/dist/query/phase-uat-passed.d.ts +46 -0
- package/sdk/dist/query/phase-uat-passed.d.ts.map +1 -0
- package/sdk/dist/query/phase-uat-passed.js +238 -0
- package/sdk/dist/query/phase-uat-passed.js.map +1 -0
- package/sdk/dist/query/phase.d.ts +104 -0
- package/sdk/dist/query/phase.d.ts.map +1 -0
- package/sdk/dist/query/phase.js +617 -0
- package/sdk/dist/query/phase.js.map +1 -0
- package/sdk/dist/query/pipeline.d.ts +53 -0
- package/sdk/dist/query/pipeline.d.ts.map +1 -0
- package/sdk/dist/query/pipeline.js +198 -0
- package/sdk/dist/query/pipeline.js.map +1 -0
- package/sdk/dist/query/plan-scan.d.ts +14 -0
- package/sdk/dist/query/plan-scan.d.ts.map +1 -0
- package/sdk/dist/query/plan-scan.js +70 -0
- package/sdk/dist/query/plan-scan.js.map +1 -0
- package/sdk/dist/query/plan-task-structure.d.ts +9 -0
- package/sdk/dist/query/plan-task-structure.d.ts.map +1 -0
- package/sdk/dist/query/plan-task-structure.js +59 -0
- package/sdk/dist/query/plan-task-structure.js.map +1 -0
- package/sdk/dist/query/profile-extract-messages.d.ts +40 -0
- package/sdk/dist/query/profile-extract-messages.d.ts.map +1 -0
- package/sdk/dist/query/profile-extract-messages.js +195 -0
- package/sdk/dist/query/profile-extract-messages.js.map +1 -0
- package/sdk/dist/query/profile-output.d.ts +11 -0
- package/sdk/dist/query/profile-output.d.ts.map +1 -0
- package/sdk/dist/query/profile-output.js +873 -0
- package/sdk/dist/query/profile-output.js.map +1 -0
- package/sdk/dist/query/profile-questionnaire-data.d.ts +21 -0
- package/sdk/dist/query/profile-questionnaire-data.d.ts.map +1 -0
- package/sdk/dist/query/profile-questionnaire-data.js +171 -0
- package/sdk/dist/query/profile-questionnaire-data.js.map +1 -0
- package/sdk/dist/query/profile-sample.d.ts +22 -0
- package/sdk/dist/query/profile-sample.d.ts.map +1 -0
- package/sdk/dist/query/profile-sample.js +136 -0
- package/sdk/dist/query/profile-sample.js.map +1 -0
- package/sdk/dist/query/profile-scan-sessions.d.ts +49 -0
- package/sdk/dist/query/profile-scan-sessions.d.ts.map +1 -0
- package/sdk/dist/query/profile-scan-sessions.js +137 -0
- package/sdk/dist/query/profile-scan-sessions.js.map +1 -0
- package/sdk/dist/query/profile.d.ts +61 -0
- package/sdk/dist/query/profile.d.ts.map +1 -0
- package/sdk/dist/query/profile.js +307 -0
- package/sdk/dist/query/profile.js.map +1 -0
- package/sdk/dist/query/progress.d.ts +77 -0
- package/sdk/dist/query/progress.d.ts.map +1 -0
- package/sdk/dist/query/progress.js +481 -0
- package/sdk/dist/query/progress.js.map +1 -0
- package/sdk/dist/query/prompt-budget.d.ts +14 -0
- package/sdk/dist/query/prompt-budget.d.ts.map +1 -0
- package/sdk/dist/query/prompt-budget.js +417 -0
- package/sdk/dist/query/prompt-budget.js.map +1 -0
- package/sdk/dist/query/query-cli-adapter.d.ts +8 -0
- package/sdk/dist/query/query-cli-adapter.d.ts.map +1 -0
- package/sdk/dist/query/query-cli-adapter.js +32 -0
- package/sdk/dist/query/query-cli-adapter.js.map +1 -0
- package/sdk/dist/query/query-cli-output.d.ts +9 -0
- package/sdk/dist/query/query-cli-output.d.ts.map +1 -0
- package/sdk/dist/query/query-cli-output.js +28 -0
- package/sdk/dist/query/query-cli-output.js.map +1 -0
- package/sdk/dist/query/query-command-diagnosis.d.ts +6 -0
- package/sdk/dist/query/query-command-diagnosis.d.ts.map +1 -0
- package/sdk/dist/query/query-command-diagnosis.js +6 -0
- package/sdk/dist/query/query-command-diagnosis.js.map +1 -0
- package/sdk/dist/query/query-command-resolution-strategy.d.ts +29 -0
- package/sdk/dist/query/query-command-resolution-strategy.d.ts.map +1 -0
- package/sdk/dist/query/query-command-resolution-strategy.js +103 -0
- package/sdk/dist/query/query-command-resolution-strategy.js.map +1 -0
- package/sdk/dist/query/query-command-semantics.d.ts +7 -0
- package/sdk/dist/query/query-command-semantics.d.ts.map +1 -0
- package/sdk/dist/query/query-command-semantics.js +7 -0
- package/sdk/dist/query/query-command-semantics.js.map +1 -0
- package/sdk/dist/query/query-dispatch-contract.d.ts +21 -0
- package/sdk/dist/query/query-dispatch-contract.d.ts.map +1 -0
- package/sdk/dist/query/query-dispatch-contract.js +2 -0
- package/sdk/dist/query/query-dispatch-contract.js.map +1 -0
- package/sdk/dist/query/query-dispatch-error-mapper.d.ts +6 -0
- package/sdk/dist/query/query-dispatch-error-mapper.d.ts.map +1 -0
- package/sdk/dist/query/query-dispatch-error-mapper.js +6 -0
- package/sdk/dist/query/query-dispatch-error-mapper.js.map +1 -0
- package/sdk/dist/query/query-dispatch-formatting.d.ts +6 -0
- package/sdk/dist/query/query-dispatch-formatting.d.ts.map +1 -0
- package/sdk/dist/query/query-dispatch-formatting.js +6 -0
- package/sdk/dist/query/query-dispatch-formatting.js.map +1 -0
- package/sdk/dist/query/query-dispatch-observability.d.ts +2 -0
- package/sdk/dist/query/query-dispatch-observability.d.ts.map +1 -0
- package/sdk/dist/query/query-dispatch-observability.js +7 -0
- package/sdk/dist/query/query-dispatch-observability.js.map +1 -0
- package/sdk/dist/query/query-dispatch.d.ts +48 -0
- package/sdk/dist/query/query-dispatch.d.ts.map +1 -0
- package/sdk/dist/query/query-dispatch.js +175 -0
- package/sdk/dist/query/query-dispatch.js.map +1 -0
- package/sdk/dist/query/query-error-details-schema.d.ts +19 -0
- package/sdk/dist/query/query-error-details-schema.d.ts.map +1 -0
- package/sdk/dist/query/query-error-details-schema.js +10 -0
- package/sdk/dist/query/query-error-details-schema.js.map +1 -0
- package/sdk/dist/query/query-error-taxonomy.d.ts +38 -0
- package/sdk/dist/query/query-error-taxonomy.d.ts.map +1 -0
- package/sdk/dist/query/query-error-taxonomy.js +74 -0
- package/sdk/dist/query/query-error-taxonomy.js.map +1 -0
- package/sdk/dist/query/query-fallback-bridge-adapter.d.ts +14 -0
- package/sdk/dist/query/query-fallback-bridge-adapter.d.ts.map +1 -0
- package/sdk/dist/query/query-fallback-bridge-adapter.js +33 -0
- package/sdk/dist/query/query-fallback-bridge-adapter.js.map +1 -0
- package/sdk/dist/query/query-fallback-executor.d.ts +11 -0
- package/sdk/dist/query/query-fallback-executor.d.ts.map +1 -0
- package/sdk/dist/query/query-fallback-executor.js +31 -0
- package/sdk/dist/query/query-fallback-executor.js.map +1 -0
- package/sdk/dist/query/query-fallback-output-classifier.d.ts +6 -0
- package/sdk/dist/query/query-fallback-output-classifier.d.ts.map +1 -0
- package/sdk/dist/query/query-fallback-output-classifier.js +27 -0
- package/sdk/dist/query/query-fallback-output-classifier.js.map +1 -0
- package/sdk/dist/query/query-fallback-policy.d.ts +6 -0
- package/sdk/dist/query/query-fallback-policy.d.ts.map +1 -0
- package/sdk/dist/query/query-fallback-policy.js +7 -0
- package/sdk/dist/query/query-fallback-policy.js.map +1 -0
- package/sdk/dist/query/query-native-dispatch-adapter.d.ts +7 -0
- package/sdk/dist/query/query-native-dispatch-adapter.d.ts.map +1 -0
- package/sdk/dist/query/query-native-dispatch-adapter.js +6 -0
- package/sdk/dist/query/query-native-dispatch-adapter.js.map +1 -0
- package/sdk/dist/query/query-policy-capability.d.ts +10 -0
- package/sdk/dist/query/query-policy-capability.d.ts.map +1 -0
- package/sdk/dist/query/query-policy-capability.js +17 -0
- package/sdk/dist/query/query-policy-capability.js.map +1 -0
- package/sdk/dist/query/query-runtime-context.d.ts +19 -0
- package/sdk/dist/query/query-runtime-context.d.ts.map +1 -0
- package/sdk/dist/query/query-runtime-context.js +31 -0
- package/sdk/dist/query/query-runtime-context.js.map +1 -0
- package/sdk/dist/query/query-unknown-command-hints.d.ts +2 -0
- package/sdk/dist/query/query-unknown-command-hints.d.ts.map +1 -0
- package/sdk/dist/query/query-unknown-command-hints.js +6 -0
- package/sdk/dist/query/query-unknown-command-hints.js.map +1 -0
- package/sdk/dist/query/registry-assembly-descriptor.d.ts +12 -0
- package/sdk/dist/query/registry-assembly-descriptor.d.ts.map +1 -0
- package/sdk/dist/query/registry-assembly-descriptor.js +61 -0
- package/sdk/dist/query/registry-assembly-descriptor.js.map +1 -0
- package/sdk/dist/query/registry-assembly-invariants.d.ts +30 -0
- package/sdk/dist/query/registry-assembly-invariants.d.ts.map +1 -0
- package/sdk/dist/query/registry-assembly-invariants.js +77 -0
- package/sdk/dist/query/registry-assembly-invariants.js.map +1 -0
- package/sdk/dist/query/registry-assembly.d.ts +10 -0
- package/sdk/dist/query/registry-assembly.d.ts.map +1 -0
- package/sdk/dist/query/registry-assembly.js +53 -0
- package/sdk/dist/query/registry-assembly.js.map +1 -0
- package/sdk/dist/query/registry.d.ts +90 -0
- package/sdk/dist/query/registry.d.ts.map +1 -0
- package/sdk/dist/query/registry.js +129 -0
- package/sdk/dist/query/registry.js.map +1 -0
- package/sdk/dist/query/requirements-extract-from-plans.d.ts +9 -0
- package/sdk/dist/query/requirements-extract-from-plans.d.ts.map +1 -0
- package/sdk/dist/query/requirements-extract-from-plans.js +76 -0
- package/sdk/dist/query/requirements-extract-from-plans.js.map +1 -0
- package/sdk/dist/query/roadmap-update-plan-progress.d.ts +11 -0
- package/sdk/dist/query/roadmap-update-plan-progress.d.ts.map +1 -0
- package/sdk/dist/query/roadmap-update-plan-progress.js +124 -0
- package/sdk/dist/query/roadmap-update-plan-progress.js.map +1 -0
- package/sdk/dist/query/roadmap.d.ts +160 -0
- package/sdk/dist/query/roadmap.d.ts.map +1 -0
- package/sdk/dist/query/roadmap.js +982 -0
- package/sdk/dist/query/roadmap.js.map +1 -0
- package/sdk/dist/query/route-next-action.d.ts +9 -0
- package/sdk/dist/query/route-next-action.d.ts.map +1 -0
- package/sdk/dist/query/route-next-action.js +318 -0
- package/sdk/dist/query/route-next-action.js.map +1 -0
- package/sdk/dist/query/schema-detect.d.ts +21 -0
- package/sdk/dist/query/schema-detect.d.ts.map +1 -0
- package/sdk/dist/query/schema-detect.js +146 -0
- package/sdk/dist/query/schema-detect.js.map +1 -0
- package/sdk/dist/query/secrets.d.ts +27 -0
- package/sdk/dist/query/secrets.d.ts.map +1 -0
- package/sdk/dist/query/secrets.js +42 -0
- package/sdk/dist/query/secrets.js.map +1 -0
- package/sdk/dist/query/skill-manifest.d.ts +50 -0
- package/sdk/dist/query/skill-manifest.d.ts.map +1 -0
- package/sdk/dist/query/skill-manifest.js +171 -0
- package/sdk/dist/query/skill-manifest.js.map +1 -0
- package/sdk/dist/query/skills.d.ts +27 -0
- package/sdk/dist/query/skills.d.ts.map +1 -0
- package/sdk/dist/query/skills.js +137 -0
- package/sdk/dist/query/skills.js.map +1 -0
- package/sdk/dist/query/state-document.d.ts +14 -0
- package/sdk/dist/query/state-document.d.ts.map +1 -0
- package/sdk/dist/query/state-document.js +110 -0
- package/sdk/dist/query/state-document.js.map +1 -0
- package/sdk/dist/query/state-mutation.d.ts +224 -0
- package/sdk/dist/query/state-mutation.d.ts.map +1 -0
- package/sdk/dist/query/state-mutation.js +1635 -0
- package/sdk/dist/query/state-mutation.js.map +1 -0
- package/sdk/dist/query/state-project-load.d.ts +23 -0
- package/sdk/dist/query/state-project-load.d.ts.map +1 -0
- package/sdk/dist/query/state-project-load.js +75 -0
- package/sdk/dist/query/state-project-load.js.map +1 -0
- package/sdk/dist/query/state.d.ts +78 -0
- package/sdk/dist/query/state.d.ts.map +1 -0
- package/sdk/dist/query/state.js +443 -0
- package/sdk/dist/query/state.js.map +1 -0
- package/sdk/dist/query/summary.d.ts +18 -0
- package/sdk/dist/query/summary.d.ts.map +1 -0
- package/sdk/dist/query/summary.js +249 -0
- package/sdk/dist/query/summary.js.map +1 -0
- package/sdk/dist/query/template.d.ts +46 -0
- package/sdk/dist/query/template.d.ts.map +1 -0
- package/sdk/dist/query/template.js +210 -0
- package/sdk/dist/query/template.js.map +1 -0
- package/sdk/dist/query/uat.d.ts +42 -0
- package/sdk/dist/query/uat.d.ts.map +1 -0
- package/sdk/dist/query/uat.js +339 -0
- package/sdk/dist/query/uat.js.map +1 -0
- package/sdk/dist/query/utils.d.ts +59 -0
- package/sdk/dist/query/utils.d.ts.map +1 -0
- package/sdk/dist/query/utils.js +74 -0
- package/sdk/dist/query/utils.js.map +1 -0
- package/sdk/dist/query/validate.d.ts +67 -0
- package/sdk/dist/query/validate.d.ts.map +1 -0
- package/sdk/dist/query/validate.js +1001 -0
- package/sdk/dist/query/validate.js.map +1 -0
- package/sdk/dist/query/verify.d.ts +98 -0
- package/sdk/dist/query/verify.d.ts.map +1 -0
- package/sdk/dist/query/verify.js +593 -0
- package/sdk/dist/query/verify.js.map +1 -0
- package/sdk/dist/query/websearch.d.ts +24 -0
- package/sdk/dist/query/websearch.d.ts.map +1 -0
- package/sdk/dist/query/websearch.js +68 -0
- package/sdk/dist/query/websearch.js.map +1 -0
- package/sdk/dist/query/workspace.d.ts +62 -0
- package/sdk/dist/query/workspace.d.ts.map +1 -0
- package/sdk/dist/query/workspace.js +104 -0
- package/sdk/dist/query/workspace.js.map +1 -0
- package/sdk/dist/query/workstream-inventory.d.ts +24 -0
- package/sdk/dist/query/workstream-inventory.d.ts.map +1 -0
- package/sdk/dist/query/workstream-inventory.js +120 -0
- package/sdk/dist/query/workstream-inventory.js.map +1 -0
- package/sdk/dist/query/workstream.d.ts +35 -0
- package/sdk/dist/query/workstream.d.ts.map +1 -0
- package/sdk/dist/query/workstream.js +298 -0
- package/sdk/dist/query/workstream.js.map +1 -0
- package/sdk/dist/query/worktree.d.ts +9 -0
- package/sdk/dist/query/worktree.d.ts.map +1 -0
- package/sdk/dist/query/worktree.js +79 -0
- package/sdk/dist/query/worktree.js.map +1 -0
- package/sdk/dist/query-command-executor.d.ts +22 -0
- package/sdk/dist/query-command-executor.d.ts.map +1 -0
- package/sdk/dist/query-command-executor.js +22 -0
- package/sdk/dist/query-command-executor.js.map +1 -0
- package/sdk/dist/query-execution-policy.d.ts +24 -0
- package/sdk/dist/query-execution-policy.d.ts.map +1 -0
- package/sdk/dist/query-execution-policy.js +27 -0
- package/sdk/dist/query-execution-policy.js.map +1 -0
- package/sdk/dist/query-failure-classification.d.ts +9 -0
- package/sdk/dist/query-failure-classification.d.ts.map +1 -0
- package/sdk/dist/query-failure-classification.js +32 -0
- package/sdk/dist/query-failure-classification.js.map +1 -0
- package/sdk/dist/query-gsd-tools-path.d.ts +2 -0
- package/sdk/dist/query-gsd-tools-path.d.ts.map +1 -0
- package/sdk/dist/query-gsd-tools-path.js +2 -0
- package/sdk/dist/query-gsd-tools-path.js.map +1 -0
- package/sdk/dist/query-gsd-tools-runtime.d.ts +20 -0
- package/sdk/dist/query-gsd-tools-runtime.d.ts.map +1 -0
- package/sdk/dist/query-gsd-tools-runtime.js +47 -0
- package/sdk/dist/query-gsd-tools-runtime.js.map +1 -0
- package/sdk/dist/query-hotpath-methods.d.ts +19 -0
- package/sdk/dist/query-hotpath-methods.d.ts.map +1 -0
- package/sdk/dist/query-hotpath-methods.js +34 -0
- package/sdk/dist/query-hotpath-methods.js.map +1 -0
- package/sdk/dist/query-native-direct-adapter.d.ts +20 -0
- package/sdk/dist/query-native-direct-adapter.d.ts.map +1 -0
- package/sdk/dist/query-native-direct-adapter.js +52 -0
- package/sdk/dist/query-native-direct-adapter.js.map +1 -0
- package/sdk/dist/query-native-hotpath-adapter.d.ts +15 -0
- package/sdk/dist/query-native-hotpath-adapter.d.ts.map +1 -0
- package/sdk/dist/query-native-hotpath-adapter.js +32 -0
- package/sdk/dist/query-native-hotpath-adapter.js.map +1 -0
- package/sdk/dist/query-raw-output-projection.d.ts +6 -0
- package/sdk/dist/query-raw-output-projection.d.ts.map +1 -0
- package/sdk/dist/query-raw-output-projection.js +86 -0
- package/sdk/dist/query-raw-output-projection.js.map +1 -0
- package/sdk/dist/query-runtime-bridge.d.ts +61 -0
- package/sdk/dist/query-runtime-bridge.d.ts.map +1 -0
- package/sdk/dist/query-runtime-bridge.js +144 -0
- package/sdk/dist/query-runtime-bridge.js.map +1 -0
- package/sdk/dist/query-subprocess-adapter.d.ts +18 -0
- package/sdk/dist/query-subprocess-adapter.d.ts.map +1 -0
- package/sdk/dist/query-subprocess-adapter.js +92 -0
- package/sdk/dist/query-subprocess-adapter.js.map +1 -0
- package/sdk/dist/query-tools-error-factory.d.ts +16 -0
- package/sdk/dist/query-tools-error-factory.d.ts.map +1 -0
- package/sdk/dist/query-tools-error-factory.js +33 -0
- package/sdk/dist/query-tools-error-factory.js.map +1 -0
- package/sdk/dist/research-gate.d.ts +24 -0
- package/sdk/dist/research-gate.d.ts.map +1 -0
- package/sdk/dist/research-gate.js +70 -0
- package/sdk/dist/research-gate.js.map +1 -0
- package/sdk/dist/runtime-bridge-sync/index.d.ts +96 -0
- package/sdk/dist/runtime-bridge-sync/index.d.ts.map +1 -0
- package/sdk/dist/runtime-bridge-sync/index.js +109 -0
- package/sdk/dist/runtime-bridge-sync/index.js.map +1 -0
- package/sdk/dist/runtime-bridge-sync/worker.d.ts +2 -0
- package/sdk/dist/runtime-bridge-sync/worker.d.ts.map +1 -0
- package/sdk/dist/runtime-bridge-sync/worker.js +180 -0
- package/sdk/dist/runtime-bridge-sync/worker.js.map +1 -0
- package/sdk/dist/runtime-gate.d.ts +14 -0
- package/sdk/dist/runtime-gate.d.ts.map +1 -0
- package/sdk/dist/runtime-gate.js +48 -0
- package/sdk/dist/runtime-gate.js.map +1 -0
- package/sdk/dist/sdk-package-compatibility.d.ts +38 -0
- package/sdk/dist/sdk-package-compatibility.d.ts.map +1 -0
- package/sdk/dist/sdk-package-compatibility.js +90 -0
- package/sdk/dist/sdk-package-compatibility.js.map +1 -0
- package/sdk/dist/session-runner.d.ts +40 -0
- package/sdk/dist/session-runner.d.ts.map +1 -0
- package/sdk/dist/session-runner.js +274 -0
- package/sdk/dist/session-runner.js.map +1 -0
- package/sdk/dist/tool-scoping.d.ts +31 -0
- package/sdk/dist/tool-scoping.d.ts.map +1 -0
- package/sdk/dist/tool-scoping.js +54 -0
- package/sdk/dist/tool-scoping.js.map +1 -0
- package/sdk/dist/types.d.ts +794 -0
- package/sdk/dist/types.d.ts.map +1 -0
- package/sdk/dist/types.js +77 -0
- package/sdk/dist/types.js.map +1 -0
- package/sdk/dist/workstream-inventory/builder.d.ts +88 -0
- package/sdk/dist/workstream-inventory/builder.d.ts.map +1 -0
- package/sdk/dist/workstream-inventory/builder.js +84 -0
- package/sdk/dist/workstream-inventory/builder.js.map +1 -0
- package/sdk/dist/workstream-name-policy.d.ts +37 -0
- package/sdk/dist/workstream-name-policy.d.ts.map +1 -0
- package/sdk/dist/workstream-name-policy.js +53 -0
- package/sdk/dist/workstream-name-policy.js.map +1 -0
- package/sdk/dist/workstream-utils.d.ts +23 -0
- package/sdk/dist/workstream-utils.d.ts.map +1 -0
- package/sdk/dist/workstream-utils.js +34 -0
- package/sdk/dist/workstream-utils.js.map +1 -0
- package/sdk/dist/ws-transport.d.ts +32 -0
- package/sdk/dist/ws-transport.d.ts.map +1 -0
- package/sdk/dist/ws-transport.js +84 -0
- package/sdk/dist/ws-transport.js.map +1 -0
- package/sdk/package-lock.json +2530 -0
- package/sdk/package.json +77 -0
- package/sdk/prompts/templates/project.md +186 -0
- package/sdk/prompts/templates/requirements.md +231 -0
- package/sdk/prompts/templates/research-project/ARCHITECTURE.md +204 -0
- package/sdk/prompts/templates/research-project/FEATURES.md +147 -0
- package/sdk/prompts/templates/research-project/PITFALLS.md +200 -0
- package/sdk/prompts/templates/research-project/STACK.md +120 -0
- package/sdk/prompts/templates/research-project/SUMMARY.md +170 -0
- package/sdk/prompts/templates/roadmap.md +202 -0
- package/sdk/prompts/templates/state.md +175 -0
- package/sdk/shared/config-defaults.manifest.json +75 -0
- package/sdk/shared/config-schema.manifest.json +151 -0
- package/sdk/shared/model-catalog.json +122 -0
- package/sdk/src/assembled-prompts.test.ts +349 -0
- package/sdk/src/bug-3589-planning-paths-validation.test.ts +89 -0
- package/sdk/src/bug-3591-gsdtools-runtime-workstream.test.ts +179 -0
- package/sdk/src/cli-transport.test.ts +388 -0
- package/sdk/src/cli-transport.ts +130 -0
- package/sdk/src/cli.test.ts +426 -0
- package/sdk/src/cli.ts +589 -0
- package/sdk/src/config.test.ts +277 -0
- package/sdk/src/config.ts +202 -0
- package/sdk/src/configuration/index.test.ts +318 -0
- package/sdk/src/configuration/index.ts +325 -0
- package/sdk/src/context-engine.test.ts +295 -0
- package/sdk/src/context-engine.ts +170 -0
- package/sdk/src/context-truncation.test.ts +163 -0
- package/sdk/src/context-truncation.ts +233 -0
- package/sdk/src/e2e.integration.test.ts +181 -0
- package/sdk/src/errors.ts +72 -0
- package/sdk/src/event-stream.test.ts +661 -0
- package/sdk/src/event-stream.ts +441 -0
- package/sdk/src/golden/capture.ts +95 -0
- package/sdk/src/golden/fixtures/generate-slug.golden.json +1 -0
- package/sdk/src/golden/fixtures/profile-sample-sessions/demo-project/sample.jsonl +3 -0
- package/sdk/src/golden/fixtures/summary-extract-sample.md +26 -0
- package/sdk/src/golden/fixtures/uat-render-checkpoint-sample.md +15 -0
- package/sdk/src/golden/golden-integration-covered.ts +30 -0
- package/sdk/src/golden/golden-mutation-covered.ts +17 -0
- package/sdk/src/golden/golden-policy.test.ts +8 -0
- package/sdk/src/golden/golden-policy.ts +120 -0
- package/sdk/src/golden/golden.integration.test.ts +1031 -0
- package/sdk/src/golden/init-golden-normalize.ts +15 -0
- package/sdk/src/golden/read-only-golden-rows.ts +77 -0
- package/sdk/src/golden/read-only-parity.integration.test.ts +133 -0
- package/sdk/src/golden/registry-canonical-commands.ts +31 -0
- package/sdk/src/gsd-tools-error.test.ts +21 -0
- package/sdk/src/gsd-tools-error.ts +65 -0
- package/sdk/src/gsd-tools.test.ts +472 -0
- package/sdk/src/gsd-tools.ts +237 -0
- package/sdk/src/gsd-transport-policy.test.ts +34 -0
- package/sdk/src/gsd-transport-policy.ts +48 -0
- package/sdk/src/gsd-transport.test.ts +299 -0
- package/sdk/src/gsd-transport.ts +118 -0
- package/sdk/src/index.ts +366 -0
- package/sdk/src/init-e2e.integration.test.ts +138 -0
- package/sdk/src/init-runner.test.ts +740 -0
- package/sdk/src/init-runner.ts +734 -0
- package/sdk/src/lifecycle-e2e.integration.test.ts +258 -0
- package/sdk/src/logger.test.ts +149 -0
- package/sdk/src/logger.ts +113 -0
- package/sdk/src/milestone-runner.test.ts +421 -0
- package/sdk/src/model-catalog.ts +70 -0
- package/sdk/src/phase-prompt.ts +259 -0
- package/sdk/src/phase-runner.integration.test.ts +377 -0
- package/sdk/src/phase-runner.test.ts +3660 -0
- package/sdk/src/phase-runner.ts +1442 -0
- package/sdk/src/plan-parser.test.ts +579 -0
- package/sdk/src/plan-parser.ts +431 -0
- package/sdk/src/planning-journal.test.ts +70 -0
- package/sdk/src/planning-journal.ts +153 -0
- package/sdk/src/planning-runtime.test.ts +29 -0
- package/sdk/src/planning-runtime.ts +100 -0
- package/sdk/src/project-root/index.test.ts +186 -0
- package/sdk/src/project-root/index.ts +144 -0
- package/sdk/src/prompt-builder.test.ts +318 -0
- package/sdk/src/prompt-builder.ts +218 -0
- package/sdk/src/prompt-sanitizer.test.ts +260 -0
- package/sdk/src/prompt-sanitizer.ts +116 -0
- package/sdk/src/query/QUERY-HANDLERS.md +349 -0
- package/sdk/src/query/active-workstream-store.ts +50 -0
- package/sdk/src/query/agent-failure-classifier.test.ts +157 -0
- package/sdk/src/query/agent-failure-classifier.ts +105 -0
- package/sdk/src/query/audit-open.ts +722 -0
- package/sdk/src/query/check-auto-mode.test.ts +77 -0
- package/sdk/src/query/check-auto-mode.ts +49 -0
- package/sdk/src/query/check-completion.test.ts +113 -0
- package/sdk/src/query/check-completion.ts +182 -0
- package/sdk/src/query/check-decision-coverage.test.ts +519 -0
- package/sdk/src/query/check-decision-coverage.ts +554 -0
- package/sdk/src/query/check-gates.test.ts +103 -0
- package/sdk/src/query/check-gates.ts +112 -0
- package/sdk/src/query/check-ship-ready.test.ts +303 -0
- package/sdk/src/query/check-ship-ready.ts +136 -0
- package/sdk/src/query/check-verification-status.test.ts +143 -0
- package/sdk/src/query/check-verification-status.ts +160 -0
- package/sdk/src/query/command-aliases.generated.ts +154 -0
- package/sdk/src/query/command-catalog.ts +31 -0
- package/sdk/src/query/command-definition.test.ts +47 -0
- package/sdk/src/query/command-definition.ts +70 -0
- package/sdk/src/query/command-family-handlers.ts +123 -0
- package/sdk/src/query/command-manifest.init.ts +24 -0
- package/sdk/src/query/command-manifest.non-family.ts +86 -0
- package/sdk/src/query/command-manifest.phase.ts +17 -0
- package/sdk/src/query/command-manifest.phases.ts +11 -0
- package/sdk/src/query/command-manifest.roadmap.ts +11 -0
- package/sdk/src/query/command-manifest.state.ts +31 -0
- package/sdk/src/query/command-manifest.ts +17 -0
- package/sdk/src/query/command-manifest.types.ts +13 -0
- package/sdk/src/query/command-manifest.validate.ts +11 -0
- package/sdk/src/query/command-manifest.verify.ts +17 -0
- package/sdk/src/query/command-resolution.test.ts +70 -0
- package/sdk/src/query/command-seam-coverage.test.ts +118 -0
- package/sdk/src/query/command-static-catalog-domain.ts +111 -0
- package/sdk/src/query/command-static-catalog-foundation.ts +111 -0
- package/sdk/src/query/command-topology.test.ts +28 -0
- package/sdk/src/query/command-topology.ts +114 -0
- package/sdk/src/query/commands-list.test.ts +36 -0
- package/sdk/src/query/commands-list.ts +19 -0
- package/sdk/src/query/commit.test.ts +485 -0
- package/sdk/src/query/commit.ts +717 -0
- package/sdk/src/query/config-gates.test.ts +89 -0
- package/sdk/src/query/config-gates.ts +69 -0
- package/sdk/src/query/config-mutation.test.ts +598 -0
- package/sdk/src/query/config-mutation.ts +705 -0
- package/sdk/src/query/config-query.test.ts +472 -0
- package/sdk/src/query/config-query.ts +314 -0
- package/sdk/src/query/config-schema.ts +35 -0
- package/sdk/src/query/decisions.test.ts +221 -0
- package/sdk/src/query/decisions.ts +196 -0
- package/sdk/src/query/decomposed-handlers.test.ts +431 -0
- package/sdk/src/query/detect-custom-files.test.ts +115 -0
- package/sdk/src/query/detect-custom-files.ts +96 -0
- package/sdk/src/query/detect-phase-type.test.ts +105 -0
- package/sdk/src/query/detect-phase-type.ts +141 -0
- package/sdk/src/query/docs-init.ts +258 -0
- package/sdk/src/query/fallow-audit.ts +88 -0
- package/sdk/src/query/frontmatter-array.test.ts +14 -0
- package/sdk/src/query/frontmatter-mutation.test.ts +259 -0
- package/sdk/src/query/frontmatter-mutation.ts +328 -0
- package/sdk/src/query/frontmatter.test.ts +326 -0
- package/sdk/src/query/frontmatter.ts +395 -0
- package/sdk/src/query/helpers.test.ts +615 -0
- package/sdk/src/query/helpers.ts +566 -0
- package/sdk/src/query/index-thin-seam.test.ts +16 -0
- package/sdk/src/query/index.ts +9 -0
- package/sdk/src/query/init-complex.test.ts +788 -0
- package/sdk/src/query/init-complex.ts +815 -0
- package/sdk/src/query/init-workstream-milestone-op.test.ts +321 -0
- package/sdk/src/query/init.test.ts +791 -0
- package/sdk/src/query/init.ts +1335 -0
- package/sdk/src/query/intel.test.ts +90 -0
- package/sdk/src/query/intel.ts +404 -0
- package/sdk/src/query/mutation-event-decorator.test.ts +45 -0
- package/sdk/src/query/mutation-event-decorator.ts +37 -0
- package/sdk/src/query/mutation-event-mapper.test.ts +33 -0
- package/sdk/src/query/mutation-event-mapper.ts +102 -0
- package/sdk/src/query/mvp.test.ts +335 -0
- package/sdk/src/query/mvp.ts +292 -0
- package/sdk/src/query/normalize-query-command.test.ts +102 -0
- package/sdk/src/query/phase-filesystem-adapter.ts +35 -0
- package/sdk/src/query/phase-lifecycle-policy.ts +171 -0
- package/sdk/src/query/phase-lifecycle.test.ts +1971 -0
- package/sdk/src/query/phase-lifecycle.ts +2210 -0
- package/sdk/src/query/phase-list-queries.test.ts +88 -0
- package/sdk/src/query/phase-list-queries.ts +152 -0
- package/sdk/src/query/phase-ready.test.ts +65 -0
- package/sdk/src/query/phase-ready.ts +159 -0
- package/sdk/src/query/phase-roadmap-mutation.ts +82 -0
- package/sdk/src/query/phase-uat-passed.test.ts +593 -0
- package/sdk/src/query/phase-uat-passed.ts +297 -0
- package/sdk/src/query/phase.test.ts +693 -0
- package/sdk/src/query/phase.ts +741 -0
- package/sdk/src/query/pipeline.test.ts +169 -0
- package/sdk/src/query/pipeline.ts +243 -0
- package/sdk/src/query/plan-scan.test.ts +35 -0
- package/sdk/src/query/plan-scan.ts +82 -0
- package/sdk/src/query/plan-task-structure.test.ts +65 -0
- package/sdk/src/query/plan-task-structure.ts +63 -0
- package/sdk/src/query/policy-convergence.test.ts +28 -0
- package/sdk/src/query/profile-extract-messages.ts +247 -0
- package/sdk/src/query/profile-output.ts +929 -0
- package/sdk/src/query/profile-questionnaire-data.ts +181 -0
- package/sdk/src/query/profile-sample.ts +184 -0
- package/sdk/src/query/profile-scan-sessions.ts +174 -0
- package/sdk/src/query/profile.test.ts +136 -0
- package/sdk/src/query/profile.ts +337 -0
- package/sdk/src/query/progress.test.ts +156 -0
- package/sdk/src/query/progress.ts +566 -0
- package/sdk/src/query/prompt-budget.ts +556 -0
- package/sdk/src/query/query-cli-adapter.test.ts +79 -0
- package/sdk/src/query/query-cli-adapter.ts +39 -0
- package/sdk/src/query/query-cli-output.test.ts +33 -0
- package/sdk/src/query/query-cli-output.ts +35 -0
- package/sdk/src/query/query-command-diagnosis.test.ts +22 -0
- package/sdk/src/query/query-command-diagnosis.ts +5 -0
- package/sdk/src/query/query-command-resolution-strategy.test.ts +34 -0
- package/sdk/src/query/query-command-resolution-strategy.ts +121 -0
- package/sdk/src/query/query-command-semantics.test.ts +22 -0
- package/sdk/src/query/query-command-semantics.ts +22 -0
- package/sdk/src/query/query-dispatch-contract.ts +30 -0
- package/sdk/src/query/query-dispatch-error-mapper.ts +5 -0
- package/sdk/src/query/query-dispatch-formatting.ts +5 -0
- package/sdk/src/query/query-dispatch-observability.ts +6 -0
- package/sdk/src/query/query-dispatch.test.ts +699 -0
- package/sdk/src/query/query-dispatch.ts +243 -0
- package/sdk/src/query/query-error-details-schema.ts +29 -0
- package/sdk/src/query/query-error-taxonomy.test.ts +39 -0
- package/sdk/src/query/query-error-taxonomy.ts +117 -0
- package/sdk/src/query/query-fallback-bridge-adapter.test.ts +32 -0
- package/sdk/src/query/query-fallback-bridge-adapter.ts +54 -0
- package/sdk/src/query/query-fallback-executor.test.ts +82 -0
- package/sdk/src/query/query-fallback-executor.ts +44 -0
- package/sdk/src/query/query-fallback-output-classifier.test.ts +36 -0
- package/sdk/src/query/query-fallback-output-classifier.ts +31 -0
- package/sdk/src/query/query-fallback-policy.test.ts +13 -0
- package/sdk/src/query/query-fallback-policy.ts +11 -0
- package/sdk/src/query/query-native-dispatch-adapter.ts +16 -0
- package/sdk/src/query/query-policy-capability.test.ts +10 -0
- package/sdk/src/query/query-policy-capability.ts +26 -0
- package/sdk/src/query/query-policy-snapshot.test.ts +9 -0
- package/sdk/src/query/query-registry-capability.test.ts +14 -0
- package/sdk/src/query/query-runtime-context.ts +44 -0
- package/sdk/src/query/query-unknown-command-hints.test.ts +9 -0
- package/sdk/src/query/query-unknown-command-hints.ts +5 -0
- package/sdk/src/query/registry-assembly-descriptor.ts +87 -0
- package/sdk/src/query/registry-assembly-invariants.ts +127 -0
- package/sdk/src/query/registry-assembly.test.ts +138 -0
- package/sdk/src/query/registry-assembly.ts +78 -0
- package/sdk/src/query/registry.test.ts +208 -0
- package/sdk/src/query/registry.ts +142 -0
- package/sdk/src/query/requirements-extract-from-plans.test.ts +58 -0
- package/sdk/src/query/requirements-extract-from-plans.ts +86 -0
- package/sdk/src/query/roadmap-update-plan-progress.test.ts +233 -0
- package/sdk/src/query/roadmap-update-plan-progress.ts +159 -0
- package/sdk/src/query/roadmap.test.ts +1250 -0
- package/sdk/src/query/roadmap.ts +1131 -0
- package/sdk/src/query/route-next-action.test.ts +61 -0
- package/sdk/src/query/route-next-action.ts +345 -0
- package/sdk/src/query/schema-detect.ts +189 -0
- package/sdk/src/query/secrets.test.ts +66 -0
- package/sdk/src/query/secrets.ts +43 -0
- package/sdk/src/query/skill-manifest.test.ts +62 -0
- package/sdk/src/query/skill-manifest.ts +216 -0
- package/sdk/src/query/skills.test.ts +234 -0
- package/sdk/src/query/skills.ts +143 -0
- package/sdk/src/query/state-document.test.ts +197 -0
- package/sdk/src/query/state-document.ts +129 -0
- package/sdk/src/query/state-mutation.test.ts +1210 -0
- package/sdk/src/query/state-mutation.ts +1814 -0
- package/sdk/src/query/state-project-load.ts +80 -0
- package/sdk/src/query/state.test.ts +616 -0
- package/sdk/src/query/state.ts +476 -0
- package/sdk/src/query/sub-repos-root.integration.test.ts +79 -0
- package/sdk/src/query/summary.test.ts +95 -0
- package/sdk/src/query/summary.ts +296 -0
- package/sdk/src/query/template.test.ts +180 -0
- package/sdk/src/query/template.ts +242 -0
- package/sdk/src/query/uat.test.ts +77 -0
- package/sdk/src/query/uat.ts +365 -0
- package/sdk/src/query/utils.test.ts +82 -0
- package/sdk/src/query/utils.ts +106 -0
- package/sdk/src/query/validate.test.ts +924 -0
- package/sdk/src/query/validate.ts +1054 -0
- package/sdk/src/query/verify.test.ts +414 -0
- package/sdk/src/query/verify.ts +656 -0
- package/sdk/src/query/websearch.test.ts +31 -0
- package/sdk/src/query/websearch.ts +82 -0
- package/sdk/src/query/workspace.test.ts +120 -0
- package/sdk/src/query/workspace.ts +145 -0
- package/sdk/src/query/workstream-inventory.ts +143 -0
- package/sdk/src/query/workstream.test.ts +153 -0
- package/sdk/src/query/workstream.ts +324 -0
- package/sdk/src/query/worktree.ts +84 -0
- package/sdk/src/query-command-executor.ts +31 -0
- package/sdk/src/query-execution-policy.test.ts +52 -0
- package/sdk/src/query-execution-policy.ts +46 -0
- package/sdk/src/query-failure-classification.test.ts +23 -0
- package/sdk/src/query-failure-classification.ts +42 -0
- package/sdk/src/query-gsd-tools-path.ts +1 -0
- package/sdk/src/query-gsd-tools-runtime.ts +89 -0
- package/sdk/src/query-hotpath-methods.ts +48 -0
- package/sdk/src/query-native-direct-adapter.test.ts +35 -0
- package/sdk/src/query-native-direct-adapter.ts +70 -0
- package/sdk/src/query-native-hotpath-adapter.test.ts +43 -0
- package/sdk/src/query-native-hotpath-adapter.ts +45 -0
- package/sdk/src/query-raw-output-projection.test.ts +39 -0
- package/sdk/src/query-raw-output-projection.ts +93 -0
- package/sdk/src/query-runtime-bridge.test.ts +150 -0
- package/sdk/src/query-runtime-bridge.ts +215 -0
- package/sdk/src/query-runtime-seam-coverage.test.ts +20 -0
- package/sdk/src/query-subprocess-adapter.test.ts +84 -0
- package/sdk/src/query-subprocess-adapter.ts +146 -0
- package/sdk/src/query-tools-error-factory.test.ts +35 -0
- package/sdk/src/query-tools-error-factory.ts +76 -0
- package/sdk/src/research-gate.test.ts +190 -0
- package/sdk/src/research-gate.ts +94 -0
- package/sdk/src/runtime-bridge-options.test.ts +33 -0
- package/sdk/src/runtime-bridge-sync/index.test.ts +164 -0
- package/sdk/src/runtime-bridge-sync/index.ts +154 -0
- package/sdk/src/runtime-bridge-sync/projectdir-regression.test.ts +150 -0
- package/sdk/src/runtime-bridge-sync/worker.ts +224 -0
- package/sdk/src/runtime-gate.test.ts +84 -0
- package/sdk/src/runtime-gate.ts +52 -0
- package/sdk/src/sdk-package-compatibility.test.ts +97 -0
- package/sdk/src/sdk-package-compatibility.ts +141 -0
- package/sdk/src/session-runner.test.ts +164 -0
- package/sdk/src/session-runner.ts +327 -0
- package/sdk/src/tool-scoping.test.ts +160 -0
- package/sdk/src/tool-scoping.ts +61 -0
- package/sdk/src/types.ts +927 -0
- package/sdk/src/workflow-agent-skills-consistency.test.ts +98 -0
- package/sdk/src/workstream-inventory/builder.test.ts +241 -0
- package/sdk/src/workstream-inventory/builder.ts +170 -0
- package/sdk/src/workstream-name-policy.ts +57 -0
- package/sdk/src/workstream-utils.ts +36 -0
- package/sdk/src/ws-flag.test.ts +285 -0
- package/sdk/src/ws-transport.test.ts +161 -0
- package/sdk/src/ws-transport.ts +93 -0
- package/sdk/tsconfig.json +20 -0
|
@@ -0,0 +1,2096 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Init — Compound init commands for workflow bootstrapping
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const { execGit, platformWriteSync, platformReadSync } = require('./shell-command-projection.cjs');
|
|
8
|
+
const { loadConfig, resolveModelInternal, findPhaseInternal, getRoadmapPhaseInternal, pathExistsInternal, gitWorktreeInfoInternal, generateSlugInternal, getMilestoneInfo, getMilestonePhaseFilter, stripShippedMilestones, extractCurrentMilestone, normalizePhaseName, toPosixPath, output, error, checkAgentsInstalled, phaseTokenMatches } = require('./core.cjs');
|
|
9
|
+
const { planningPaths, planningDir, planningRoot, findContextMdIn } = require('./planning-workspace.cjs');
|
|
10
|
+
const { maskIfSecret } = require('./secrets.cjs');
|
|
11
|
+
const scanPhasePlans = require('./plan-scan.cjs');
|
|
12
|
+
const { stateExtractField } = require('./state-document.cjs');
|
|
13
|
+
const { formatGsdSlash, resolveRuntime } = require('./runtime-slash.cjs');
|
|
14
|
+
const { determinePhaseStatus } = require('./commands.cjs');
|
|
15
|
+
|
|
16
|
+
// Accept all bold/colon variants of the Requirements header (#2769):
|
|
17
|
+
// **Requirements:** / **Requirements**: / **Requirements** : render the
|
|
18
|
+
// same in markdown but differ textually.
|
|
19
|
+
const REQUIREMENTS_HEADER_RE = /^\*\*Requirements:?\*\*[^\S\n]*:?[^\S\n]*([^\n]*)$/m;
|
|
20
|
+
|
|
21
|
+
function listPhaseSummaryFiles(phaseDir) {
|
|
22
|
+
return scanPhasePlans(phaseDir).summaryFiles;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function listPhasePlanFiles(phaseDir) {
|
|
26
|
+
return scanPhasePlans(phaseDir).planFiles;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function getLatestCompletedMilestone(cwd) {
|
|
30
|
+
const milestonesPath = path.join(planningRoot(cwd), 'MILESTONES.md');
|
|
31
|
+
const content = platformReadSync(milestonesPath);
|
|
32
|
+
if (content === null) return null;
|
|
33
|
+
|
|
34
|
+
const match = content.match(/^##\s+(v[\d.]+)\s+(.+?)\s+\(Shipped:/m);
|
|
35
|
+
if (!match) return null;
|
|
36
|
+
return {
|
|
37
|
+
version: match[1],
|
|
38
|
+
name: match[2].trim(),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Inject `project_root` into an init result object.
|
|
44
|
+
* Workflows use this to prefix `.planning/` paths correctly when Claude's CWD
|
|
45
|
+
* differs from the project root (e.g., inside a sub-repo).
|
|
46
|
+
*/
|
|
47
|
+
function withProjectRoot(cwd, result) {
|
|
48
|
+
result.project_root = cwd;
|
|
49
|
+
// Inject agent installation status into all init outputs (#1371).
|
|
50
|
+
// Workflows that spawn named subagents use this to detect when agents
|
|
51
|
+
// are missing and would silently fall back to general-purpose.
|
|
52
|
+
const agentStatus = checkAgentsInstalled();
|
|
53
|
+
result.agents_installed = agentStatus.agents_installed;
|
|
54
|
+
result.missing_agents = agentStatus.missing_agents;
|
|
55
|
+
// Inject response_language into all init outputs (#1399).
|
|
56
|
+
// Workflows propagate this to subagent prompts so user-facing questions
|
|
57
|
+
// stay in the configured language across phase boundaries.
|
|
58
|
+
const config = loadConfig(cwd);
|
|
59
|
+
if (config.response_language) {
|
|
60
|
+
result.response_language = config.response_language;
|
|
61
|
+
}
|
|
62
|
+
// Inject project identity into all init outputs so handoff blocks
|
|
63
|
+
// can include project context for cross-session continuity.
|
|
64
|
+
if (config.project_code) {
|
|
65
|
+
result.project_code = config.project_code;
|
|
66
|
+
}
|
|
67
|
+
// Extract project title from PROJECT.md first H1 heading.
|
|
68
|
+
const projectMdPath = path.join(planningDir(cwd), 'PROJECT.md');
|
|
69
|
+
const content = platformReadSync(projectMdPath);
|
|
70
|
+
if (content) {
|
|
71
|
+
const h1Match = content.match(/^#\s+(.+)$/m);
|
|
72
|
+
if (h1Match) {
|
|
73
|
+
result.project_title = h1Match[1].trim();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Return git-worktree state for init payloads with robust nested-subdir
|
|
81
|
+
* detection across Windows short/long path forms and slash variants.
|
|
82
|
+
*/
|
|
83
|
+
function getInitGitState(cwd) {
|
|
84
|
+
const info = gitWorktreeInfoInternal(cwd);
|
|
85
|
+
const worktreeRoot = info.worktreeRoot;
|
|
86
|
+
const normalizeForCompare = (p) => {
|
|
87
|
+
if (typeof p !== 'string' || p.length === 0) return null;
|
|
88
|
+
let resolved;
|
|
89
|
+
try {
|
|
90
|
+
resolved = fs.realpathSync.native(p);
|
|
91
|
+
} catch {
|
|
92
|
+
resolved = path.resolve(p);
|
|
93
|
+
}
|
|
94
|
+
resolved = path.resolve(resolved);
|
|
95
|
+
if (process.platform === 'win32') {
|
|
96
|
+
return resolved.replace(/\//g, '\\').toLowerCase();
|
|
97
|
+
}
|
|
98
|
+
return resolved;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
let inNestedSubdir = false;
|
|
102
|
+
if (info.inside) {
|
|
103
|
+
let resolvedByGitPrefix = false;
|
|
104
|
+
try {
|
|
105
|
+
const prefixResult = execGit(['rev-parse', '--show-prefix'], { cwd, timeout: 5000 });
|
|
106
|
+
if (prefixResult.exitCode === 0) {
|
|
107
|
+
const prefix = String(prefixResult.stdout || '').trim().replace(/\\/g, '/');
|
|
108
|
+
inNestedSubdir = prefix.length > 0 && prefix !== '.' && prefix !== './';
|
|
109
|
+
resolvedByGitPrefix = true;
|
|
110
|
+
}
|
|
111
|
+
} catch {}
|
|
112
|
+
|
|
113
|
+
if (!resolvedByGitPrefix) {
|
|
114
|
+
const rootNorm = normalizeForCompare(worktreeRoot);
|
|
115
|
+
const cwdNorm = normalizeForCompare(cwd);
|
|
116
|
+
if (rootNorm && cwdNorm) {
|
|
117
|
+
if (rootNorm === cwdNorm) {
|
|
118
|
+
inNestedSubdir = false;
|
|
119
|
+
} else {
|
|
120
|
+
const rel = path.relative(rootNorm, cwdNorm);
|
|
121
|
+
const relNorm = process.platform === 'win32' ? rel.replace(/\//g, '\\') : rel;
|
|
122
|
+
inNestedSubdir =
|
|
123
|
+
relNorm !== '' &&
|
|
124
|
+
relNorm !== '.' &&
|
|
125
|
+
!relNorm.startsWith('..') &&
|
|
126
|
+
!path.isAbsolute(relNorm);
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
inNestedSubdir = worktreeRoot !== null;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Defensive final guard: if git reports the same root path as cwd (after
|
|
135
|
+
// slash/case normalization), we are at the worktree root, never nested.
|
|
136
|
+
if (inNestedSubdir && typeof worktreeRoot === 'string') {
|
|
137
|
+
const toComparableRaw = (p) => p.replace(/\\/g, '/').replace(/\/+$/g, '').toLowerCase();
|
|
138
|
+
if (toComparableRaw(worktreeRoot) === toComparableRaw(String(cwd))) {
|
|
139
|
+
inNestedSubdir = false;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return {
|
|
144
|
+
has_git: info.inside,
|
|
145
|
+
git_worktree_root: worktreeRoot,
|
|
146
|
+
in_nested_subdir: inNestedSubdir,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function cmdInitExecutePhase(cwd, phase, raw, options = {}) {
|
|
151
|
+
if (!phase) {
|
|
152
|
+
error('phase required for init execute-phase');
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const config = loadConfig(cwd);
|
|
156
|
+
let phaseInfo = findPhaseInternal(cwd, phase);
|
|
157
|
+
const milestone = getMilestoneInfo(cwd);
|
|
158
|
+
|
|
159
|
+
const roadmapPhase = getRoadmapPhaseInternal(cwd, phase);
|
|
160
|
+
|
|
161
|
+
// If findPhaseInternal matched an archived phase from a prior milestone, but
|
|
162
|
+
// the phase exists in the current milestone's ROADMAP.md, ignore the archive
|
|
163
|
+
// match — we are initializing a new phase in the current milestone that
|
|
164
|
+
// happens to share a number with an archived one. Without this, phase_dir,
|
|
165
|
+
// phase_slug and related fields would point at artifacts from a previous
|
|
166
|
+
// milestone.
|
|
167
|
+
if (phaseInfo?.archived && roadmapPhase?.found) {
|
|
168
|
+
phaseInfo = null;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Fallback to ROADMAP.md if no phase directory exists yet
|
|
172
|
+
if (!phaseInfo && roadmapPhase?.found) {
|
|
173
|
+
const phaseName = roadmapPhase.phase_name;
|
|
174
|
+
phaseInfo = {
|
|
175
|
+
found: true,
|
|
176
|
+
directory: null,
|
|
177
|
+
phase_number: roadmapPhase.phase_number,
|
|
178
|
+
phase_name: phaseName,
|
|
179
|
+
phase_slug: phaseName ? phaseName.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') : null,
|
|
180
|
+
plans: [],
|
|
181
|
+
summaries: [],
|
|
182
|
+
incomplete_plans: [],
|
|
183
|
+
has_research: false,
|
|
184
|
+
has_context: false,
|
|
185
|
+
has_verification: false,
|
|
186
|
+
has_reviews: false,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
const reqMatch = roadmapPhase?.section?.match(REQUIREMENTS_HEADER_RE);
|
|
190
|
+
const reqExtracted = reqMatch
|
|
191
|
+
? reqMatch[1].replace(/[\[\]]/g, '').split(',').map(s => s.trim()).filter(Boolean).join(', ')
|
|
192
|
+
: null;
|
|
193
|
+
const phase_req_ids = (reqExtracted && reqExtracted !== 'TBD') ? reqExtracted : null;
|
|
194
|
+
|
|
195
|
+
const result = {
|
|
196
|
+
// Models
|
|
197
|
+
executor_model: resolveModelInternal(cwd, 'gsd-executor'),
|
|
198
|
+
verifier_model: resolveModelInternal(cwd, 'gsd-verifier'),
|
|
199
|
+
|
|
200
|
+
// Config flags
|
|
201
|
+
tdd_mode: options.tdd || config.tdd_mode || false,
|
|
202
|
+
commit_docs: config.commit_docs,
|
|
203
|
+
sub_repos: config.sub_repos,
|
|
204
|
+
parallelization: config.parallelization,
|
|
205
|
+
context_window: config.context_window,
|
|
206
|
+
branching_strategy: config.branching_strategy,
|
|
207
|
+
phase_branch_template: config.phase_branch_template,
|
|
208
|
+
milestone_branch_template: config.milestone_branch_template,
|
|
209
|
+
verifier_enabled: config.verifier,
|
|
210
|
+
|
|
211
|
+
// Phase info
|
|
212
|
+
phase_found: !!phaseInfo,
|
|
213
|
+
phase_dir: phaseInfo?.directory || null,
|
|
214
|
+
phase_number: phaseInfo?.phase_number || null,
|
|
215
|
+
phase_name: phaseInfo?.phase_name || null,
|
|
216
|
+
phase_slug: phaseInfo?.phase_slug || null,
|
|
217
|
+
phase_req_ids,
|
|
218
|
+
|
|
219
|
+
// Plan inventory
|
|
220
|
+
plans: phaseInfo?.plans || [],
|
|
221
|
+
summaries: phaseInfo?.summaries || [],
|
|
222
|
+
incomplete_plans: phaseInfo?.incomplete_plans || [],
|
|
223
|
+
plan_count: phaseInfo?.plans?.length || 0,
|
|
224
|
+
incomplete_count: phaseInfo?.incomplete_plans?.length || 0,
|
|
225
|
+
|
|
226
|
+
// Branch name (pre-computed)
|
|
227
|
+
branch_name: config.branching_strategy === 'phase' && phaseInfo
|
|
228
|
+
? config.phase_branch_template
|
|
229
|
+
.replace('{project}', config.project_code || '')
|
|
230
|
+
.replace('{phase}', phaseInfo.phase_number)
|
|
231
|
+
.replace('{slug}', phaseInfo.phase_slug || 'phase')
|
|
232
|
+
: config.branching_strategy === 'milestone'
|
|
233
|
+
? config.milestone_branch_template
|
|
234
|
+
.replace('{milestone}', milestone.version)
|
|
235
|
+
.replace('{slug}', generateSlugInternal(milestone.name) || 'milestone')
|
|
236
|
+
: null,
|
|
237
|
+
|
|
238
|
+
// Milestone info
|
|
239
|
+
milestone_version: milestone.version,
|
|
240
|
+
milestone_name: milestone.name,
|
|
241
|
+
milestone_slug: generateSlugInternal(milestone.name),
|
|
242
|
+
|
|
243
|
+
// File existence
|
|
244
|
+
state_exists: fs.existsSync(path.join(planningDir(cwd), 'STATE.md')),
|
|
245
|
+
roadmap_exists: fs.existsSync(path.join(planningDir(cwd), 'ROADMAP.md')),
|
|
246
|
+
config_exists: fs.existsSync(path.join(planningDir(cwd), 'config.json')),
|
|
247
|
+
// File paths
|
|
248
|
+
state_path: toPosixPath(path.relative(cwd, path.join(planningDir(cwd), 'STATE.md'))),
|
|
249
|
+
roadmap_path: toPosixPath(path.relative(cwd, path.join(planningDir(cwd), 'ROADMAP.md'))),
|
|
250
|
+
config_path: toPosixPath(path.relative(cwd, path.join(planningDir(cwd), 'config.json'))),
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
// Optional --validate: run state validation and include warnings (#1627)
|
|
254
|
+
if (options.validate) {
|
|
255
|
+
try {
|
|
256
|
+
const statePath = path.join(planningDir(cwd), 'STATE.md');
|
|
257
|
+
const stateContent = platformReadSync(statePath);
|
|
258
|
+
if (stateContent !== null) {
|
|
259
|
+
const status = stateExtractField(stateContent, 'Status') || '';
|
|
260
|
+
result.state_validation_ran = true;
|
|
261
|
+
// Simple inline validation — check for obvious drift
|
|
262
|
+
const warnings = [];
|
|
263
|
+
const phasesPath = planningPaths(cwd).phases;
|
|
264
|
+
if (phaseInfo && phaseInfo.directory && fs.existsSync(path.join(cwd, phaseInfo.directory))) {
|
|
265
|
+
const diskPlans = listPhasePlanFiles(path.join(cwd, phaseInfo.directory)).length;
|
|
266
|
+
const totalPlansRaw = stateExtractField(stateContent, 'Total Plans in Phase');
|
|
267
|
+
const totalPlansInPhase = totalPlansRaw ? parseInt(totalPlansRaw, 10) : null;
|
|
268
|
+
if (totalPlansInPhase !== null && diskPlans !== totalPlansInPhase) {
|
|
269
|
+
warnings.push(`Plan count mismatch: STATE.md says ${totalPlansInPhase}, disk has ${diskPlans}`);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
result.state_warnings = warnings;
|
|
273
|
+
}
|
|
274
|
+
} catch { /* intentionally empty */ }
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
output(withProjectRoot(cwd, result), raw);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
function cmdInitPlanPhase(cwd, phase, raw, options = {}) {
|
|
281
|
+
if (!phase) {
|
|
282
|
+
error('phase required for init plan-phase');
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
const config = loadConfig(cwd);
|
|
286
|
+
let phaseInfo = findPhaseInternal(cwd, phase);
|
|
287
|
+
|
|
288
|
+
const roadmapPhase = getRoadmapPhaseInternal(cwd, phase);
|
|
289
|
+
|
|
290
|
+
// If findPhaseInternal matched an archived phase from a prior milestone, but
|
|
291
|
+
// the phase exists in the current milestone's ROADMAP.md, ignore the archive
|
|
292
|
+
// match — we are planning a new phase in the current milestone that happens
|
|
293
|
+
// to share a number with an archived one. Without this, phase_dir,
|
|
294
|
+
// phase_slug, has_context and has_research would point at artifacts from a
|
|
295
|
+
// previous milestone.
|
|
296
|
+
if (phaseInfo?.archived && roadmapPhase?.found) {
|
|
297
|
+
phaseInfo = null;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// Fallback to ROADMAP.md if no phase directory exists yet
|
|
301
|
+
if (!phaseInfo && roadmapPhase?.found) {
|
|
302
|
+
const phaseName = roadmapPhase.phase_name;
|
|
303
|
+
phaseInfo = {
|
|
304
|
+
found: true,
|
|
305
|
+
directory: null,
|
|
306
|
+
phase_number: roadmapPhase.phase_number,
|
|
307
|
+
phase_name: phaseName,
|
|
308
|
+
phase_slug: phaseName ? phaseName.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') : null,
|
|
309
|
+
plans: [],
|
|
310
|
+
summaries: [],
|
|
311
|
+
incomplete_plans: [],
|
|
312
|
+
has_research: false,
|
|
313
|
+
has_context: false,
|
|
314
|
+
has_verification: false,
|
|
315
|
+
has_reviews: false,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
const reqMatch = roadmapPhase?.section?.match(REQUIREMENTS_HEADER_RE);
|
|
319
|
+
const reqExtracted = reqMatch
|
|
320
|
+
? reqMatch[1].replace(/[\[\]]/g, '').split(',').map(s => s.trim()).filter(Boolean).join(', ')
|
|
321
|
+
: null;
|
|
322
|
+
const phase_req_ids = (reqExtracted && reqExtracted !== 'TBD') ? reqExtracted : null;
|
|
323
|
+
|
|
324
|
+
// #3287: compute the canonical directory name with project_code prefix so
|
|
325
|
+
// the first-touch mkdir in /gsd:plan-phase stays consistent with phase.add.
|
|
326
|
+
const phaseDirPlan = phaseInfo?.directory || null;
|
|
327
|
+
const phaseNumberPlan = phaseInfo?.phase_number || null;
|
|
328
|
+
const phaseNamePlan = phaseInfo?.phase_name || null;
|
|
329
|
+
const rawProjectCodePlan = config.project_code || '';
|
|
330
|
+
let expectedPhaseDirPlan = null;
|
|
331
|
+
if (!phaseDirPlan && phaseNumberPlan && phaseNamePlan) {
|
|
332
|
+
const paddedNum = normalizePhaseName(phaseNumberPlan);
|
|
333
|
+
const slug = generateSlugInternal(phaseNamePlan).substring(0, 60);
|
|
334
|
+
if (slug) {
|
|
335
|
+
const prefix = rawProjectCodePlan ? `${rawProjectCodePlan}-` : '';
|
|
336
|
+
const dirName = `${prefix}${paddedNum}-${slug}`;
|
|
337
|
+
expectedPhaseDirPlan = toPosixPath(path.relative(cwd, path.join(planningPaths(cwd).phases, dirName)));
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
const result = {
|
|
342
|
+
// Models
|
|
343
|
+
researcher_model: resolveModelInternal(cwd, 'gsd-phase-researcher'),
|
|
344
|
+
planner_model: resolveModelInternal(cwd, 'gsd-planner'),
|
|
345
|
+
checker_model: resolveModelInternal(cwd, 'gsd-plan-checker'),
|
|
346
|
+
|
|
347
|
+
// Workflow flags
|
|
348
|
+
tdd_mode: options.tdd || config.tdd_mode || false,
|
|
349
|
+
research_enabled: config.research,
|
|
350
|
+
plan_checker_enabled: config.plan_checker,
|
|
351
|
+
nyquist_validation_enabled: config.nyquist_validation,
|
|
352
|
+
commit_docs: config.commit_docs,
|
|
353
|
+
text_mode: config.text_mode,
|
|
354
|
+
// Auto-advance config — included so workflows don't need separate config-get
|
|
355
|
+
// calls for these values, which causes infinite config-read loops on some models
|
|
356
|
+
// (e.g. Kimi K2.5). See #2192.
|
|
357
|
+
auto_advance: !!(config.auto_advance),
|
|
358
|
+
auto_chain_active: !!(config._auto_chain_active),
|
|
359
|
+
mode: config.mode || 'interactive',
|
|
360
|
+
|
|
361
|
+
// Phase info
|
|
362
|
+
phase_found: !!phaseInfo,
|
|
363
|
+
phase_dir: phaseDirPlan,
|
|
364
|
+
expected_phase_dir: expectedPhaseDirPlan,
|
|
365
|
+
phase_number: phaseNumberPlan,
|
|
366
|
+
phase_name: phaseNamePlan,
|
|
367
|
+
phase_slug: phaseInfo?.phase_slug || null,
|
|
368
|
+
padded_phase: phaseNumberPlan ? normalizePhaseName(phaseNumberPlan) : null,
|
|
369
|
+
phase_req_ids,
|
|
370
|
+
|
|
371
|
+
// #3569: surface phase lifecycle status so /gsd:plan-phase can short-circuit
|
|
372
|
+
// on closed (Complete) phases instead of silently replanning over shipped
|
|
373
|
+
// code. Reuses determinePhaseStatus — the project-wide vocabulary
|
|
374
|
+
// (Pending | Planned | In Progress | Executed | Complete | Needs Review).
|
|
375
|
+
// No directory yet → Pending (phase has not been started).
|
|
376
|
+
phase_status: phaseDirPlan
|
|
377
|
+
? determinePhaseStatus(
|
|
378
|
+
phaseInfo?.plans?.length || 0,
|
|
379
|
+
phaseInfo?.summaries?.length || 0,
|
|
380
|
+
path.join(cwd, phaseDirPlan),
|
|
381
|
+
'Pending',
|
|
382
|
+
)
|
|
383
|
+
: 'Pending',
|
|
384
|
+
|
|
385
|
+
// Existing artifacts
|
|
386
|
+
has_research: phaseInfo?.has_research || false,
|
|
387
|
+
has_context: phaseInfo?.has_context || false,
|
|
388
|
+
has_reviews: phaseInfo?.has_reviews || false,
|
|
389
|
+
has_plans: (phaseInfo?.plans?.length || 0) > 0,
|
|
390
|
+
plan_count: phaseInfo?.plans?.length || 0,
|
|
391
|
+
|
|
392
|
+
// Environment
|
|
393
|
+
planning_exists: fs.existsSync(planningDir(cwd)),
|
|
394
|
+
roadmap_exists: fs.existsSync(path.join(planningDir(cwd), 'ROADMAP.md')),
|
|
395
|
+
|
|
396
|
+
// File paths
|
|
397
|
+
state_path: toPosixPath(path.relative(cwd, path.join(planningDir(cwd), 'STATE.md'))),
|
|
398
|
+
roadmap_path: toPosixPath(path.relative(cwd, path.join(planningDir(cwd), 'ROADMAP.md'))),
|
|
399
|
+
requirements_path: toPosixPath(path.relative(cwd, path.join(planningDir(cwd), 'REQUIREMENTS.md'))),
|
|
400
|
+
|
|
401
|
+
// Pattern mapper output (null until PATTERNS.md exists in phase dir)
|
|
402
|
+
patterns_path: null,
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
if (phaseInfo?.directory) {
|
|
406
|
+
// Find *-CONTEXT.md in phase directory
|
|
407
|
+
const phaseDirFull = path.join(cwd, phaseInfo.directory);
|
|
408
|
+
try {
|
|
409
|
+
const files = fs.readdirSync(phaseDirFull);
|
|
410
|
+
const contextFile = findContextMdIn(phaseDirFull);
|
|
411
|
+
if (contextFile) {
|
|
412
|
+
result.context_path = toPosixPath(path.join(phaseInfo.directory, contextFile));
|
|
413
|
+
}
|
|
414
|
+
const researchFile = files.find(f => f.endsWith('-RESEARCH.md') || f === 'RESEARCH.md');
|
|
415
|
+
if (researchFile) {
|
|
416
|
+
result.research_path = toPosixPath(path.join(phaseInfo.directory, researchFile));
|
|
417
|
+
}
|
|
418
|
+
const verificationFile = files.find(f => f.endsWith('-VERIFICATION.md') || f === 'VERIFICATION.md');
|
|
419
|
+
if (verificationFile) {
|
|
420
|
+
result.verification_path = toPosixPath(path.join(phaseInfo.directory, verificationFile));
|
|
421
|
+
}
|
|
422
|
+
const uatFile = files.find(f => f.endsWith('-UAT.md') || f === 'UAT.md');
|
|
423
|
+
if (uatFile) {
|
|
424
|
+
result.uat_path = toPosixPath(path.join(phaseInfo.directory, uatFile));
|
|
425
|
+
}
|
|
426
|
+
const reviewsFile = files.find(f => f.endsWith('-REVIEWS.md') || f === 'REVIEWS.md');
|
|
427
|
+
if (reviewsFile) {
|
|
428
|
+
result.reviews_path = toPosixPath(path.join(phaseInfo.directory, reviewsFile));
|
|
429
|
+
}
|
|
430
|
+
const patternsFile = files.find(f => f.endsWith('-PATTERNS.md') || f === 'PATTERNS.md');
|
|
431
|
+
if (patternsFile) {
|
|
432
|
+
result.patterns_path = toPosixPath(path.join(phaseInfo.directory, patternsFile));
|
|
433
|
+
}
|
|
434
|
+
} catch { /* intentionally empty */ }
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// Optional --validate: run state validation and include warnings (#1627)
|
|
438
|
+
if (options.validate) {
|
|
439
|
+
try {
|
|
440
|
+
const statePath = path.join(planningDir(cwd), 'STATE.md');
|
|
441
|
+
const stateContent = platformReadSync(statePath);
|
|
442
|
+
if (stateContent !== null) {
|
|
443
|
+
const warnings = [];
|
|
444
|
+
result.state_validation_ran = true;
|
|
445
|
+
const totalPlansRaw = stateExtractField(stateContent, 'Total Plans in Phase');
|
|
446
|
+
const totalPlansInPhase = totalPlansRaw ? parseInt(totalPlansRaw, 10) : null;
|
|
447
|
+
if (totalPlansInPhase !== null && phaseInfo && totalPlansInPhase !== (phaseInfo.plans?.length || 0)) {
|
|
448
|
+
warnings.push(`Plan count mismatch: STATE.md says ${totalPlansInPhase}, disk has ${phaseInfo.plans?.length || 0}`);
|
|
449
|
+
}
|
|
450
|
+
result.state_warnings = warnings;
|
|
451
|
+
}
|
|
452
|
+
} catch { /* intentionally empty */ }
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
output(withProjectRoot(cwd, result), raw);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
function cmdInitNewProject(cwd, raw) {
|
|
459
|
+
const config = loadConfig(cwd);
|
|
460
|
+
|
|
461
|
+
// Detect Brave Search API key availability
|
|
462
|
+
const homedir = require('os').homedir();
|
|
463
|
+
const braveKeyFile = path.join(homedir, '.gsd', 'brave_api_key');
|
|
464
|
+
const hasBraveSearch = !!(process.env.BRAVE_API_KEY || fs.existsSync(braveKeyFile));
|
|
465
|
+
|
|
466
|
+
// Detect Firecrawl API key availability
|
|
467
|
+
const firecrawlKeyFile = path.join(homedir, '.gsd', 'firecrawl_api_key');
|
|
468
|
+
const hasFirecrawl = !!(process.env.FIRECRAWL_API_KEY || fs.existsSync(firecrawlKeyFile));
|
|
469
|
+
|
|
470
|
+
// Detect Exa API key availability
|
|
471
|
+
const exaKeyFile = path.join(homedir, '.gsd', 'exa_api_key');
|
|
472
|
+
const hasExaSearch = !!(process.env.EXA_API_KEY || fs.existsSync(exaKeyFile));
|
|
473
|
+
|
|
474
|
+
// Detect existing code (cross-platform — no Unix `find` dependency)
|
|
475
|
+
let hasCode = false;
|
|
476
|
+
let hasPackageFile = false;
|
|
477
|
+
try {
|
|
478
|
+
const codeExtensions = new Set([
|
|
479
|
+
'.ts', '.js', '.py', '.go', '.rs', '.swift', '.java',
|
|
480
|
+
'.kt', '.kts', // Kotlin (Android, server-side)
|
|
481
|
+
'.c', '.cpp', '.h', // C/C++
|
|
482
|
+
'.cs', // C#
|
|
483
|
+
'.rb', // Ruby
|
|
484
|
+
'.php', // PHP
|
|
485
|
+
'.dart', // Dart (Flutter)
|
|
486
|
+
'.m', '.mm', // Objective-C / Objective-C++
|
|
487
|
+
'.scala', // Scala
|
|
488
|
+
'.groovy', // Groovy (Gradle build scripts)
|
|
489
|
+
'.lua', // Lua
|
|
490
|
+
'.r', '.R', // R
|
|
491
|
+
'.zig', // Zig
|
|
492
|
+
'.ex', '.exs', // Elixir
|
|
493
|
+
'.clj', // Clojure
|
|
494
|
+
]);
|
|
495
|
+
const skipDirs = new Set(['node_modules', '.git', '.planning', '.claude', '.codex', '__pycache__', 'target', 'dist', 'build']);
|
|
496
|
+
function findCodeFiles(dir, depth) {
|
|
497
|
+
if (depth > 3) return false;
|
|
498
|
+
let entries;
|
|
499
|
+
try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return false; }
|
|
500
|
+
for (const entry of entries) {
|
|
501
|
+
if (entry.isFile() && codeExtensions.has(path.extname(entry.name))) return true;
|
|
502
|
+
if (entry.isDirectory() && !skipDirs.has(entry.name)) {
|
|
503
|
+
if (findCodeFiles(path.join(dir, entry.name), depth + 1)) return true;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
return false;
|
|
507
|
+
}
|
|
508
|
+
hasCode = findCodeFiles(cwd, 0);
|
|
509
|
+
} catch { /* intentionally empty — best-effort detection */ }
|
|
510
|
+
|
|
511
|
+
hasPackageFile = pathExistsInternal(cwd, 'package.json') ||
|
|
512
|
+
pathExistsInternal(cwd, 'requirements.txt') ||
|
|
513
|
+
pathExistsInternal(cwd, 'Cargo.toml') ||
|
|
514
|
+
pathExistsInternal(cwd, 'go.mod') ||
|
|
515
|
+
pathExistsInternal(cwd, 'Package.swift') ||
|
|
516
|
+
pathExistsInternal(cwd, 'build.gradle') ||
|
|
517
|
+
pathExistsInternal(cwd, 'build.gradle.kts') ||
|
|
518
|
+
pathExistsInternal(cwd, 'pom.xml') ||
|
|
519
|
+
pathExistsInternal(cwd, 'Gemfile') ||
|
|
520
|
+
pathExistsInternal(cwd, 'composer.json') ||
|
|
521
|
+
pathExistsInternal(cwd, 'pubspec.yaml') ||
|
|
522
|
+
pathExistsInternal(cwd, 'CMakeLists.txt') ||
|
|
523
|
+
pathExistsInternal(cwd, 'Makefile') ||
|
|
524
|
+
pathExistsInternal(cwd, 'build.zig') ||
|
|
525
|
+
pathExistsInternal(cwd, 'mix.exs') ||
|
|
526
|
+
pathExistsInternal(cwd, 'project.clj');
|
|
527
|
+
|
|
528
|
+
const result = {
|
|
529
|
+
// Models
|
|
530
|
+
researcher_model: resolveModelInternal(cwd, 'gsd-project-researcher'),
|
|
531
|
+
synthesizer_model: resolveModelInternal(cwd, 'gsd-research-synthesizer'),
|
|
532
|
+
roadmapper_model: resolveModelInternal(cwd, 'gsd-roadmapper'),
|
|
533
|
+
|
|
534
|
+
// Config
|
|
535
|
+
commit_docs: config.commit_docs,
|
|
536
|
+
|
|
537
|
+
// Existing state
|
|
538
|
+
project_exists: pathExistsInternal(cwd, '.planning/PROJECT.md'),
|
|
539
|
+
has_codebase_map: pathExistsInternal(cwd, '.planning/codebase'),
|
|
540
|
+
planning_exists: pathExistsInternal(cwd, '.planning'),
|
|
541
|
+
|
|
542
|
+
// Brownfield detection
|
|
543
|
+
has_existing_code: hasCode,
|
|
544
|
+
has_package_file: hasPackageFile,
|
|
545
|
+
is_brownfield: hasCode || hasPackageFile,
|
|
546
|
+
needs_codebase_map: (hasCode || hasPackageFile) && !pathExistsInternal(cwd, '.planning/codebase'),
|
|
547
|
+
|
|
548
|
+
// Git state (Bug #3491: detect parent worktree to avoid nested .git init)
|
|
549
|
+
...getInitGitState(cwd),
|
|
550
|
+
|
|
551
|
+
// Enhanced search
|
|
552
|
+
brave_search_available: hasBraveSearch,
|
|
553
|
+
firecrawl_available: hasFirecrawl,
|
|
554
|
+
exa_search_available: hasExaSearch,
|
|
555
|
+
|
|
556
|
+
// File paths
|
|
557
|
+
project_path: '.planning/PROJECT.md',
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
output(withProjectRoot(cwd, result), raw);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
function cmdInitNewMilestone(cwd, raw) {
|
|
564
|
+
const config = loadConfig(cwd);
|
|
565
|
+
const milestone = getMilestoneInfo(cwd);
|
|
566
|
+
const latestCompleted = getLatestCompletedMilestone(cwd);
|
|
567
|
+
const phasesDir = path.join(planningDir(cwd), 'phases');
|
|
568
|
+
let phaseDirCount = 0;
|
|
569
|
+
|
|
570
|
+
try {
|
|
571
|
+
if (fs.existsSync(phasesDir)) {
|
|
572
|
+
// Bug #2445: filter phase dirs to current milestone only so stale dirs
|
|
573
|
+
// from a prior milestone that were not archived don't inflate the count.
|
|
574
|
+
const isDirInMilestone = getMilestonePhaseFilter(cwd);
|
|
575
|
+
phaseDirCount = fs.readdirSync(phasesDir, { withFileTypes: true })
|
|
576
|
+
.filter(entry => entry.isDirectory() && isDirInMilestone(entry.name))
|
|
577
|
+
.length;
|
|
578
|
+
}
|
|
579
|
+
} catch {}
|
|
580
|
+
|
|
581
|
+
const result = {
|
|
582
|
+
// Models
|
|
583
|
+
researcher_model: resolveModelInternal(cwd, 'gsd-project-researcher'),
|
|
584
|
+
synthesizer_model: resolveModelInternal(cwd, 'gsd-research-synthesizer'),
|
|
585
|
+
roadmapper_model: resolveModelInternal(cwd, 'gsd-roadmapper'),
|
|
586
|
+
|
|
587
|
+
// Config
|
|
588
|
+
commit_docs: config.commit_docs,
|
|
589
|
+
research_enabled: config.research,
|
|
590
|
+
|
|
591
|
+
// Current milestone
|
|
592
|
+
current_milestone: milestone.version,
|
|
593
|
+
current_milestone_name: milestone.name,
|
|
594
|
+
latest_completed_milestone: latestCompleted?.version || null,
|
|
595
|
+
latest_completed_milestone_name: latestCompleted?.name || null,
|
|
596
|
+
phase_dir_count: phaseDirCount,
|
|
597
|
+
phase_archive_path: latestCompleted ? toPosixPath(path.relative(cwd, path.join(planningRoot(cwd), 'milestones', `${latestCompleted.version}-phases`))) : null,
|
|
598
|
+
|
|
599
|
+
// File existence
|
|
600
|
+
project_exists: pathExistsInternal(cwd, '.planning/PROJECT.md'),
|
|
601
|
+
roadmap_exists: fs.existsSync(path.join(planningDir(cwd), 'ROADMAP.md')),
|
|
602
|
+
state_exists: fs.existsSync(path.join(planningDir(cwd), 'STATE.md')),
|
|
603
|
+
|
|
604
|
+
// File paths
|
|
605
|
+
project_path: '.planning/PROJECT.md',
|
|
606
|
+
roadmap_path: toPosixPath(path.relative(cwd, path.join(planningDir(cwd), 'ROADMAP.md'))),
|
|
607
|
+
state_path: toPosixPath(path.relative(cwd, path.join(planningDir(cwd), 'STATE.md'))),
|
|
608
|
+
};
|
|
609
|
+
|
|
610
|
+
output(withProjectRoot(cwd, result), raw);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
function cmdInitQuick(cwd, description, raw) {
|
|
614
|
+
const config = loadConfig(cwd);
|
|
615
|
+
const now = new Date();
|
|
616
|
+
const slug = description ? generateSlugInternal(description)?.substring(0, 40) : null;
|
|
617
|
+
|
|
618
|
+
// Generate collision-resistant quick task ID: YYMMDD-xxx
|
|
619
|
+
// xxx = 2-second precision blocks since midnight, encoded as 3-char Base36 (lowercase)
|
|
620
|
+
// Range: 000 (00:00:00) to xbz (23:59:58), guaranteed 3 chars for any time of day.
|
|
621
|
+
// Provides ~2s uniqueness window per user — practically collision-free across a team.
|
|
622
|
+
const yy = String(now.getFullYear()).slice(-2);
|
|
623
|
+
const mm = String(now.getMonth() + 1).padStart(2, '0');
|
|
624
|
+
const dd = String(now.getDate()).padStart(2, '0');
|
|
625
|
+
const dateStr = yy + mm + dd;
|
|
626
|
+
const secondsSinceMidnight = now.getHours() * 3600 + now.getMinutes() * 60 + now.getSeconds();
|
|
627
|
+
const timeBlocks = Math.floor(secondsSinceMidnight / 2);
|
|
628
|
+
const timeEncoded = timeBlocks.toString(36).padStart(3, '0');
|
|
629
|
+
const quickId = dateStr + '-' + timeEncoded;
|
|
630
|
+
const branchSlug = slug || 'quick';
|
|
631
|
+
const quickBranchName = config.quick_branch_template
|
|
632
|
+
? config.quick_branch_template
|
|
633
|
+
.replace('{num}', quickId)
|
|
634
|
+
.replace('{quick}', quickId)
|
|
635
|
+
.replace('{slug}', branchSlug)
|
|
636
|
+
: null;
|
|
637
|
+
|
|
638
|
+
const result = {
|
|
639
|
+
// Models
|
|
640
|
+
planner_model: resolveModelInternal(cwd, 'gsd-planner'),
|
|
641
|
+
executor_model: resolveModelInternal(cwd, 'gsd-executor'),
|
|
642
|
+
checker_model: resolveModelInternal(cwd, 'gsd-plan-checker'),
|
|
643
|
+
verifier_model: resolveModelInternal(cwd, 'gsd-verifier'),
|
|
644
|
+
|
|
645
|
+
// Config
|
|
646
|
+
commit_docs: config.commit_docs,
|
|
647
|
+
branch_name: quickBranchName,
|
|
648
|
+
|
|
649
|
+
// Quick task info
|
|
650
|
+
quick_id: quickId,
|
|
651
|
+
slug: slug,
|
|
652
|
+
description: description || null,
|
|
653
|
+
|
|
654
|
+
// Timestamps
|
|
655
|
+
date: now.toISOString().split('T')[0],
|
|
656
|
+
timestamp: now.toISOString(),
|
|
657
|
+
|
|
658
|
+
// Paths
|
|
659
|
+
quick_dir: '.planning/quick',
|
|
660
|
+
task_dir: slug ? `.planning/quick/${quickId}-${slug}` : null,
|
|
661
|
+
|
|
662
|
+
// File existence
|
|
663
|
+
roadmap_exists: fs.existsSync(path.join(planningDir(cwd), 'ROADMAP.md')),
|
|
664
|
+
planning_exists: fs.existsSync(planningRoot(cwd)),
|
|
665
|
+
|
|
666
|
+
};
|
|
667
|
+
|
|
668
|
+
output(withProjectRoot(cwd, result), raw);
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* Init handler for ingest-docs workflow (#2801).
|
|
673
|
+
*
|
|
674
|
+
* Returns the minimal set of fields that ingest-docs.md needs to detect
|
|
675
|
+
* whether a project/planning dir exists and choose new vs merge mode.
|
|
676
|
+
* Mirrors the initIngestDocs SDK handler in sdk/src/query/init.ts.
|
|
677
|
+
*/
|
|
678
|
+
function cmdInitIngestDocs(cwd, raw) {
|
|
679
|
+
const config = loadConfig(cwd);
|
|
680
|
+
const result = {
|
|
681
|
+
project_exists: pathExistsInternal(cwd, '.planning/PROJECT.md'),
|
|
682
|
+
planning_exists: fs.existsSync(planningRoot(cwd)),
|
|
683
|
+
...getInitGitState(cwd),
|
|
684
|
+
project_path: '.planning/PROJECT.md',
|
|
685
|
+
commit_docs: config.commit_docs,
|
|
686
|
+
};
|
|
687
|
+
output(withProjectRoot(cwd, result), raw);
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
function cmdInitResume(cwd, raw) {
|
|
691
|
+
const config = loadConfig(cwd);
|
|
692
|
+
|
|
693
|
+
// Check for interrupted agent
|
|
694
|
+
let interruptedAgentId = null;
|
|
695
|
+
const agentIdRaw = platformReadSync(path.join(planningRoot(cwd), 'current-agent-id.txt'));
|
|
696
|
+
if (agentIdRaw !== null) interruptedAgentId = agentIdRaw.trim();
|
|
697
|
+
|
|
698
|
+
const result = {
|
|
699
|
+
// File existence
|
|
700
|
+
state_exists: fs.existsSync(path.join(planningDir(cwd), 'STATE.md')),
|
|
701
|
+
roadmap_exists: fs.existsSync(path.join(planningDir(cwd), 'ROADMAP.md')),
|
|
702
|
+
project_exists: pathExistsInternal(cwd, '.planning/PROJECT.md'),
|
|
703
|
+
planning_exists: fs.existsSync(planningRoot(cwd)),
|
|
704
|
+
|
|
705
|
+
// File paths
|
|
706
|
+
state_path: toPosixPath(path.relative(cwd, path.join(planningDir(cwd), 'STATE.md'))),
|
|
707
|
+
roadmap_path: toPosixPath(path.relative(cwd, path.join(planningDir(cwd), 'ROADMAP.md'))),
|
|
708
|
+
project_path: '.planning/PROJECT.md',
|
|
709
|
+
|
|
710
|
+
// Agent state
|
|
711
|
+
has_interrupted_agent: !!interruptedAgentId,
|
|
712
|
+
interrupted_agent_id: interruptedAgentId,
|
|
713
|
+
|
|
714
|
+
// Config
|
|
715
|
+
commit_docs: config.commit_docs,
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
output(withProjectRoot(cwd, result), raw);
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
function cmdInitVerifyWork(cwd, phase, raw) {
|
|
722
|
+
if (!phase) {
|
|
723
|
+
error('phase required for init verify-work');
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
const config = loadConfig(cwd);
|
|
727
|
+
let phaseInfo = findPhaseInternal(cwd, phase);
|
|
728
|
+
|
|
729
|
+
// If findPhaseInternal matched an archived phase from a prior milestone, but
|
|
730
|
+
// the phase exists in the current milestone's ROADMAP.md, ignore the archive
|
|
731
|
+
// match — same pattern as cmdInitPhaseOp.
|
|
732
|
+
if (phaseInfo?.archived) {
|
|
733
|
+
const roadmapPhase = getRoadmapPhaseInternal(cwd, phase);
|
|
734
|
+
if (roadmapPhase?.found) {
|
|
735
|
+
phaseInfo = null;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
// Fallback to ROADMAP.md if no phase directory exists yet
|
|
740
|
+
if (!phaseInfo) {
|
|
741
|
+
const roadmapPhase = getRoadmapPhaseInternal(cwd, phase);
|
|
742
|
+
if (roadmapPhase?.found) {
|
|
743
|
+
const phaseName = roadmapPhase.phase_name;
|
|
744
|
+
phaseInfo = {
|
|
745
|
+
found: true,
|
|
746
|
+
directory: null,
|
|
747
|
+
phase_number: roadmapPhase.phase_number,
|
|
748
|
+
phase_name: phaseName,
|
|
749
|
+
phase_slug: phaseName ? phaseName.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') : null,
|
|
750
|
+
plans: [],
|
|
751
|
+
summaries: [],
|
|
752
|
+
incomplete_plans: [],
|
|
753
|
+
has_research: false,
|
|
754
|
+
has_context: false,
|
|
755
|
+
has_verification: false,
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
const result = {
|
|
761
|
+
// Models
|
|
762
|
+
planner_model: resolveModelInternal(cwd, 'gsd-planner'),
|
|
763
|
+
checker_model: resolveModelInternal(cwd, 'gsd-plan-checker'),
|
|
764
|
+
|
|
765
|
+
// Config
|
|
766
|
+
commit_docs: config.commit_docs,
|
|
767
|
+
|
|
768
|
+
// Phase info
|
|
769
|
+
phase_found: !!phaseInfo,
|
|
770
|
+
phase_dir: phaseInfo?.directory || null,
|
|
771
|
+
phase_number: phaseInfo?.phase_number || null,
|
|
772
|
+
phase_name: phaseInfo?.phase_name || null,
|
|
773
|
+
|
|
774
|
+
// Existing artifacts
|
|
775
|
+
has_verification: phaseInfo?.has_verification || false,
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
output(withProjectRoot(cwd, result), raw);
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
function cmdInitPhaseOp(cwd, phase, raw) {
|
|
782
|
+
const config = loadConfig(cwd);
|
|
783
|
+
let phaseInfo = findPhaseInternal(cwd, phase);
|
|
784
|
+
|
|
785
|
+
// If the only disk match comes from an archived milestone, prefer the
|
|
786
|
+
// current milestone's ROADMAP entry so discuss-phase and similar flows
|
|
787
|
+
// don't attach to shipped work that reused the same phase number.
|
|
788
|
+
if (phaseInfo?.archived) {
|
|
789
|
+
const roadmapPhase = getRoadmapPhaseInternal(cwd, phase);
|
|
790
|
+
if (roadmapPhase?.found) {
|
|
791
|
+
const phaseName = roadmapPhase.phase_name;
|
|
792
|
+
phaseInfo = {
|
|
793
|
+
found: true,
|
|
794
|
+
directory: null,
|
|
795
|
+
phase_number: roadmapPhase.phase_number,
|
|
796
|
+
phase_name: phaseName,
|
|
797
|
+
phase_slug: phaseName ? phaseName.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') : null,
|
|
798
|
+
plans: [],
|
|
799
|
+
summaries: [],
|
|
800
|
+
incomplete_plans: [],
|
|
801
|
+
has_research: false,
|
|
802
|
+
has_context: false,
|
|
803
|
+
has_verification: false,
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
// Fallback to ROADMAP.md if no directory exists (e.g., Plans: TBD)
|
|
809
|
+
if (!phaseInfo) {
|
|
810
|
+
const roadmapPhase = getRoadmapPhaseInternal(cwd, phase);
|
|
811
|
+
if (roadmapPhase?.found) {
|
|
812
|
+
const phaseName = roadmapPhase.phase_name;
|
|
813
|
+
phaseInfo = {
|
|
814
|
+
found: true,
|
|
815
|
+
directory: null,
|
|
816
|
+
phase_number: roadmapPhase.phase_number,
|
|
817
|
+
phase_name: phaseName,
|
|
818
|
+
phase_slug: phaseName ? phaseName.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') : null,
|
|
819
|
+
plans: [],
|
|
820
|
+
summaries: [],
|
|
821
|
+
incomplete_plans: [],
|
|
822
|
+
has_research: false,
|
|
823
|
+
has_context: false,
|
|
824
|
+
has_verification: false,
|
|
825
|
+
};
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
// #3287: compute the canonical directory name with project_code prefix so
|
|
830
|
+
// the first-touch mkdir in /gsd:discuss-phase stays consistent with phase.add.
|
|
831
|
+
const phaseDir = phaseInfo?.directory || null;
|
|
832
|
+
const phaseNumber = phaseInfo?.phase_number || null;
|
|
833
|
+
const phaseName = phaseInfo?.phase_name || null;
|
|
834
|
+
const rawProjectCode = config.project_code || '';
|
|
835
|
+
let expectedPhaseDir = null;
|
|
836
|
+
if (!phaseDir && phaseNumber && phaseName) {
|
|
837
|
+
const paddedNum = normalizePhaseName(phaseNumber);
|
|
838
|
+
const slug = generateSlugInternal(phaseName).substring(0, 60);
|
|
839
|
+
if (slug) {
|
|
840
|
+
const prefix = rawProjectCode ? `${rawProjectCode}-` : '';
|
|
841
|
+
const dirName = `${prefix}${paddedNum}-${slug}`;
|
|
842
|
+
expectedPhaseDir = toPosixPath(path.relative(cwd, path.join(planningPaths(cwd).phases, dirName)));
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
const result = {
|
|
847
|
+
// Config
|
|
848
|
+
commit_docs: config.commit_docs,
|
|
849
|
+
// #2997: secret config keys may be either booleans (availability flags) or
|
|
850
|
+
// string API keys (when user did `gsd-tools config-set brave_search XXX`).
|
|
851
|
+
// Pass booleans through; mask string values so the init bundle never echoes
|
|
852
|
+
// plaintext credentials. SDK init.ts mirrors this masking.
|
|
853
|
+
brave_search: typeof config.brave_search === 'string' ? maskIfSecret('brave_search', config.brave_search) : config.brave_search,
|
|
854
|
+
firecrawl: typeof config.firecrawl === 'string' ? maskIfSecret('firecrawl', config.firecrawl) : config.firecrawl,
|
|
855
|
+
exa_search: typeof config.exa_search === 'string' ? maskIfSecret('exa_search', config.exa_search) : config.exa_search,
|
|
856
|
+
|
|
857
|
+
// Phase info
|
|
858
|
+
phase_found: !!phaseInfo,
|
|
859
|
+
phase_dir: phaseDir,
|
|
860
|
+
expected_phase_dir: expectedPhaseDir,
|
|
861
|
+
phase_number: phaseNumber,
|
|
862
|
+
phase_name: phaseName,
|
|
863
|
+
phase_slug: phaseInfo?.phase_slug || null,
|
|
864
|
+
padded_phase: phaseNumber ? normalizePhaseName(phaseNumber) : null,
|
|
865
|
+
|
|
866
|
+
// Existing artifacts
|
|
867
|
+
has_research: phaseInfo?.has_research || false,
|
|
868
|
+
has_context: phaseInfo?.has_context || false,
|
|
869
|
+
has_plans: (phaseInfo?.plans?.length || 0) > 0,
|
|
870
|
+
has_verification: phaseInfo?.has_verification || false,
|
|
871
|
+
has_reviews: phaseInfo?.has_reviews || false,
|
|
872
|
+
plan_count: phaseInfo?.plans?.length || 0,
|
|
873
|
+
|
|
874
|
+
// File existence
|
|
875
|
+
roadmap_exists: fs.existsSync(path.join(planningDir(cwd), 'ROADMAP.md')),
|
|
876
|
+
planning_exists: fs.existsSync(planningDir(cwd)),
|
|
877
|
+
|
|
878
|
+
// File paths
|
|
879
|
+
state_path: toPosixPath(path.relative(cwd, path.join(planningDir(cwd), 'STATE.md'))),
|
|
880
|
+
roadmap_path: toPosixPath(path.relative(cwd, path.join(planningDir(cwd), 'ROADMAP.md'))),
|
|
881
|
+
requirements_path: toPosixPath(path.relative(cwd, path.join(planningDir(cwd), 'REQUIREMENTS.md'))),
|
|
882
|
+
};
|
|
883
|
+
|
|
884
|
+
if (phaseInfo?.directory) {
|
|
885
|
+
const phaseDirFull = path.join(cwd, phaseInfo.directory);
|
|
886
|
+
try {
|
|
887
|
+
const files = fs.readdirSync(phaseDirFull);
|
|
888
|
+
const contextFile = findContextMdIn(phaseDirFull);
|
|
889
|
+
if (contextFile) {
|
|
890
|
+
result.context_path = toPosixPath(path.join(phaseInfo.directory, contextFile));
|
|
891
|
+
}
|
|
892
|
+
const researchFile = files.find(f => f.endsWith('-RESEARCH.md') || f === 'RESEARCH.md');
|
|
893
|
+
if (researchFile) {
|
|
894
|
+
result.research_path = toPosixPath(path.join(phaseInfo.directory, researchFile));
|
|
895
|
+
}
|
|
896
|
+
const verificationFile = files.find(f => f.endsWith('-VERIFICATION.md') || f === 'VERIFICATION.md');
|
|
897
|
+
if (verificationFile) {
|
|
898
|
+
result.verification_path = toPosixPath(path.join(phaseInfo.directory, verificationFile));
|
|
899
|
+
}
|
|
900
|
+
const uatFile = files.find(f => f.endsWith('-UAT.md') || f === 'UAT.md');
|
|
901
|
+
if (uatFile) {
|
|
902
|
+
result.uat_path = toPosixPath(path.join(phaseInfo.directory, uatFile));
|
|
903
|
+
}
|
|
904
|
+
const reviewsFile = files.find(f => f.endsWith('-REVIEWS.md') || f === 'REVIEWS.md');
|
|
905
|
+
if (reviewsFile) {
|
|
906
|
+
result.reviews_path = toPosixPath(path.join(phaseInfo.directory, reviewsFile));
|
|
907
|
+
}
|
|
908
|
+
} catch { /* intentionally empty */ }
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
output(withProjectRoot(cwd, result), raw);
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
function cmdInitTodos(cwd, area, raw) {
|
|
915
|
+
const config = loadConfig(cwd);
|
|
916
|
+
const now = new Date();
|
|
917
|
+
|
|
918
|
+
// List todos (reuse existing logic)
|
|
919
|
+
const pendingDir = path.join(planningDir(cwd), 'todos', 'pending');
|
|
920
|
+
let count = 0;
|
|
921
|
+
const todos = [];
|
|
922
|
+
|
|
923
|
+
try {
|
|
924
|
+
const files = fs.readdirSync(pendingDir).filter(f => f.endsWith('.md'));
|
|
925
|
+
for (const file of files) {
|
|
926
|
+
const content = platformReadSync(path.join(pendingDir, file));
|
|
927
|
+
if (content === null) continue;
|
|
928
|
+
try {
|
|
929
|
+
const createdMatch = content.match(/^created:\s*(.+)$/m);
|
|
930
|
+
const titleMatch = content.match(/^title:\s*(.+)$/m);
|
|
931
|
+
const areaMatch = content.match(/^area:\s*(.+)$/m);
|
|
932
|
+
const todoArea = areaMatch ? areaMatch[1].trim() : 'general';
|
|
933
|
+
|
|
934
|
+
if (area && todoArea !== area) continue;
|
|
935
|
+
|
|
936
|
+
count++;
|
|
937
|
+
todos.push({
|
|
938
|
+
file,
|
|
939
|
+
created: createdMatch ? createdMatch[1].trim() : 'unknown',
|
|
940
|
+
title: titleMatch ? titleMatch[1].trim() : 'Untitled',
|
|
941
|
+
area: todoArea,
|
|
942
|
+
path: toPosixPath(path.relative(cwd, path.join(planningDir(cwd), 'todos', 'pending', file))),
|
|
943
|
+
});
|
|
944
|
+
} catch { /* intentionally empty */ }
|
|
945
|
+
}
|
|
946
|
+
} catch { /* intentionally empty */ }
|
|
947
|
+
|
|
948
|
+
const result = {
|
|
949
|
+
// Config
|
|
950
|
+
commit_docs: config.commit_docs,
|
|
951
|
+
|
|
952
|
+
// Timestamps
|
|
953
|
+
date: now.toISOString().split('T')[0],
|
|
954
|
+
timestamp: now.toISOString(),
|
|
955
|
+
|
|
956
|
+
// Todo inventory
|
|
957
|
+
todo_count: count,
|
|
958
|
+
todos,
|
|
959
|
+
area_filter: area || null,
|
|
960
|
+
|
|
961
|
+
// Paths
|
|
962
|
+
pending_dir: toPosixPath(path.relative(cwd, path.join(planningDir(cwd), 'todos', 'pending'))),
|
|
963
|
+
completed_dir: toPosixPath(path.relative(cwd, path.join(planningDir(cwd), 'todos', 'completed'))),
|
|
964
|
+
|
|
965
|
+
// File existence
|
|
966
|
+
planning_exists: fs.existsSync(planningDir(cwd)),
|
|
967
|
+
todos_dir_exists: fs.existsSync(path.join(planningDir(cwd), 'todos')),
|
|
968
|
+
pending_dir_exists: fs.existsSync(path.join(planningDir(cwd), 'todos', 'pending')),
|
|
969
|
+
};
|
|
970
|
+
|
|
971
|
+
output(withProjectRoot(cwd, result), raw);
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
function cmdInitMilestoneOp(cwd, raw) {
|
|
975
|
+
const config = loadConfig(cwd);
|
|
976
|
+
const milestone = getMilestoneInfo(cwd);
|
|
977
|
+
|
|
978
|
+
// Count phases
|
|
979
|
+
let phaseCount = 0;
|
|
980
|
+
let completedPhases = 0;
|
|
981
|
+
const phasesDir = path.join(planningDir(cwd), 'phases');
|
|
982
|
+
|
|
983
|
+
// Bug #2633 — ROADMAP.md (current milestone section) is the authority for
|
|
984
|
+
// phase counts, NOT the on-disk `.planning/phases/` directory. After
|
|
985
|
+
// `phases clear` between milestones, on-disk dirs will be a subset of the
|
|
986
|
+
// roadmap until each phase is materialized; reading from disk causes
|
|
987
|
+
// `all_phases_complete: true` to fire prematurely.
|
|
988
|
+
let roadmapPhaseNumbers = [];
|
|
989
|
+
try {
|
|
990
|
+
const roadmapPath = path.join(planningDir(cwd), 'ROADMAP.md');
|
|
991
|
+
const roadmapRaw = fs.readFileSync(roadmapPath, 'utf-8');
|
|
992
|
+
const currentSection = extractCurrentMilestone(roadmapRaw, cwd);
|
|
993
|
+
const phasePattern = /#{2,4}\s*Phase\s+(\d+[A-Z]?(?:\.\d+)*)\s*:/gi;
|
|
994
|
+
let m;
|
|
995
|
+
while ((m = phasePattern.exec(currentSection)) !== null) {
|
|
996
|
+
roadmapPhaseNumbers.push(m[1]);
|
|
997
|
+
}
|
|
998
|
+
} catch { /* intentionally empty */ }
|
|
999
|
+
|
|
1000
|
+
// Canonicalize a phase token by stripping leading zeros from the integer
|
|
1001
|
+
// head while preserving any [A-Z]? suffix and dotted segments. So "03" →
|
|
1002
|
+
// "3", "03A" → "3A", "03.1" → "3.1", "3A" → "3A". Disk dirs that pad
|
|
1003
|
+
// ("03-alpha") then match roadmap tokens ("Phase 3") without ever
|
|
1004
|
+
// collapsing distinct tokens like "3" / "3A" / "3.1" into the same bucket.
|
|
1005
|
+
const canonicalizePhase = (tok) => {
|
|
1006
|
+
const m = tok.match(/^(\d+)([A-Z]?(?:\.\d+)*)$/);
|
|
1007
|
+
return m ? String(parseInt(m[1], 10)) + m[2] : tok;
|
|
1008
|
+
};
|
|
1009
|
+
const diskPhaseDirs = new Map();
|
|
1010
|
+
try {
|
|
1011
|
+
const entries = fs.readdirSync(phasesDir, { withFileTypes: true });
|
|
1012
|
+
for (const e of entries) {
|
|
1013
|
+
if (!e.isDirectory()) continue;
|
|
1014
|
+
const m = e.name.match(/^(\d+[A-Z]?(?:\.\d+)*)/);
|
|
1015
|
+
if (!m) continue;
|
|
1016
|
+
diskPhaseDirs.set(canonicalizePhase(m[1]), e.name);
|
|
1017
|
+
}
|
|
1018
|
+
} catch { /* intentionally empty */ }
|
|
1019
|
+
|
|
1020
|
+
if (roadmapPhaseNumbers.length > 0) {
|
|
1021
|
+
phaseCount = roadmapPhaseNumbers.length;
|
|
1022
|
+
for (const num of roadmapPhaseNumbers) {
|
|
1023
|
+
const dirName = diskPhaseDirs.get(canonicalizePhase(num));
|
|
1024
|
+
if (!dirName) continue;
|
|
1025
|
+
try {
|
|
1026
|
+
const hasSummary = listPhaseSummaryFiles(path.join(phasesDir, dirName)).length > 0;
|
|
1027
|
+
if (hasSummary) completedPhases++;
|
|
1028
|
+
} catch { /* intentionally empty */ }
|
|
1029
|
+
}
|
|
1030
|
+
} else {
|
|
1031
|
+
// Fallback: no parseable ROADMAP — preserve legacy on-disk behavior.
|
|
1032
|
+
try {
|
|
1033
|
+
const entries = fs.readdirSync(phasesDir, { withFileTypes: true });
|
|
1034
|
+
const dirs = entries.filter(e => e.isDirectory()).map(e => e.name);
|
|
1035
|
+
phaseCount = dirs.length;
|
|
1036
|
+
for (const dir of dirs) {
|
|
1037
|
+
try {
|
|
1038
|
+
const hasSummary = listPhaseSummaryFiles(path.join(phasesDir, dir)).length > 0;
|
|
1039
|
+
if (hasSummary) completedPhases++;
|
|
1040
|
+
} catch { /* intentionally empty */ }
|
|
1041
|
+
}
|
|
1042
|
+
} catch { /* intentionally empty */ }
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
// Check archive
|
|
1046
|
+
const archiveDir = path.join(planningRoot(cwd), 'archive');
|
|
1047
|
+
let archivedMilestones = [];
|
|
1048
|
+
try {
|
|
1049
|
+
archivedMilestones = fs.readdirSync(archiveDir, { withFileTypes: true })
|
|
1050
|
+
.filter(e => e.isDirectory())
|
|
1051
|
+
.map(e => e.name);
|
|
1052
|
+
} catch { /* intentionally empty */ }
|
|
1053
|
+
|
|
1054
|
+
const result = {
|
|
1055
|
+
// Config
|
|
1056
|
+
commit_docs: config.commit_docs,
|
|
1057
|
+
|
|
1058
|
+
// Current milestone
|
|
1059
|
+
milestone_version: milestone.version,
|
|
1060
|
+
milestone_name: milestone.name,
|
|
1061
|
+
milestone_slug: generateSlugInternal(milestone.name),
|
|
1062
|
+
|
|
1063
|
+
// Phase counts
|
|
1064
|
+
phase_count: phaseCount,
|
|
1065
|
+
completed_phases: completedPhases,
|
|
1066
|
+
all_phases_complete: phaseCount > 0 && phaseCount === completedPhases,
|
|
1067
|
+
|
|
1068
|
+
// Archive
|
|
1069
|
+
archived_milestones: archivedMilestones,
|
|
1070
|
+
archive_count: archivedMilestones.length,
|
|
1071
|
+
|
|
1072
|
+
// File existence
|
|
1073
|
+
project_exists: pathExistsInternal(cwd, '.planning/PROJECT.md'),
|
|
1074
|
+
roadmap_exists: fs.existsSync(path.join(planningDir(cwd), 'ROADMAP.md')),
|
|
1075
|
+
state_exists: fs.existsSync(path.join(planningDir(cwd), 'STATE.md')),
|
|
1076
|
+
archive_exists: fs.existsSync(path.join(planningRoot(cwd), 'archive')),
|
|
1077
|
+
phases_dir_exists: fs.existsSync(path.join(planningDir(cwd), 'phases')),
|
|
1078
|
+
};
|
|
1079
|
+
|
|
1080
|
+
output(withProjectRoot(cwd, result), raw);
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
function cmdInitMapCodebase(cwd, raw) {
|
|
1084
|
+
const config = loadConfig(cwd);
|
|
1085
|
+
const now = new Date();
|
|
1086
|
+
|
|
1087
|
+
// Check for existing codebase maps
|
|
1088
|
+
const codebaseDir = path.join(planningRoot(cwd), 'codebase');
|
|
1089
|
+
let existingMaps = [];
|
|
1090
|
+
try {
|
|
1091
|
+
existingMaps = fs.readdirSync(codebaseDir).filter(f => f.endsWith('.md'));
|
|
1092
|
+
} catch { /* intentionally empty */ }
|
|
1093
|
+
|
|
1094
|
+
const result = {
|
|
1095
|
+
// Models
|
|
1096
|
+
mapper_model: resolveModelInternal(cwd, 'gsd-codebase-mapper'),
|
|
1097
|
+
|
|
1098
|
+
// Config
|
|
1099
|
+
commit_docs: config.commit_docs,
|
|
1100
|
+
search_gitignored: config.search_gitignored,
|
|
1101
|
+
parallelization: config.parallelization,
|
|
1102
|
+
subagent_timeout: config.subagent_timeout,
|
|
1103
|
+
|
|
1104
|
+
// Timestamps
|
|
1105
|
+
date: now.toISOString().split('T')[0],
|
|
1106
|
+
timestamp: now.toISOString(),
|
|
1107
|
+
|
|
1108
|
+
// Paths
|
|
1109
|
+
codebase_dir: '.planning/codebase',
|
|
1110
|
+
|
|
1111
|
+
// Existing maps
|
|
1112
|
+
existing_maps: existingMaps,
|
|
1113
|
+
has_maps: existingMaps.length > 0,
|
|
1114
|
+
|
|
1115
|
+
// File existence
|
|
1116
|
+
planning_exists: pathExistsInternal(cwd, '.planning'),
|
|
1117
|
+
codebase_dir_exists: pathExistsInternal(cwd, '.planning/codebase'),
|
|
1118
|
+
};
|
|
1119
|
+
|
|
1120
|
+
output(withProjectRoot(cwd, result), raw);
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
function cmdInitManager(cwd, raw) {
|
|
1124
|
+
const config = loadConfig(cwd);
|
|
1125
|
+
const milestone = getMilestoneInfo(cwd);
|
|
1126
|
+
// Resolve the runtime once so every emitted slash-command reference uses
|
|
1127
|
+
// the routable shape for this install (#3584). Hyphen form for skills-based
|
|
1128
|
+
// runtimes, $gsd-<cmd> shell-var for codex.
|
|
1129
|
+
const _slashRuntime = resolveRuntime(cwd);
|
|
1130
|
+
|
|
1131
|
+
// Use planningPaths for forward-compatibility with workstream scoping (#1268)
|
|
1132
|
+
const paths = planningPaths(cwd);
|
|
1133
|
+
|
|
1134
|
+
// Validate prerequisites
|
|
1135
|
+
if (!fs.existsSync(paths.roadmap)) {
|
|
1136
|
+
error(`No ROADMAP.md found. Run ${formatGsdSlash('new-milestone', _slashRuntime)} first.`);
|
|
1137
|
+
}
|
|
1138
|
+
if (!fs.existsSync(paths.state)) {
|
|
1139
|
+
error(`No STATE.md found. Run ${formatGsdSlash('new-milestone', _slashRuntime)} first.`);
|
|
1140
|
+
}
|
|
1141
|
+
const rawContent = fs.readFileSync(paths.roadmap, 'utf-8');
|
|
1142
|
+
const content = extractCurrentMilestone(rawContent, cwd);
|
|
1143
|
+
const phasesDir = paths.phases;
|
|
1144
|
+
const isDirInMilestone = getMilestonePhaseFilter(cwd);
|
|
1145
|
+
|
|
1146
|
+
// Pre-compute directory listing once (avoids O(N) readdirSync per phase)
|
|
1147
|
+
const _phaseDirEntries = (() => {
|
|
1148
|
+
try {
|
|
1149
|
+
return fs.readdirSync(phasesDir, { withFileTypes: true })
|
|
1150
|
+
.filter(e => e.isDirectory())
|
|
1151
|
+
.map(e => e.name);
|
|
1152
|
+
} catch { return []; }
|
|
1153
|
+
})();
|
|
1154
|
+
|
|
1155
|
+
// Pre-extract all checkbox states in a single pass (avoids O(N) regex per phase)
|
|
1156
|
+
const _checkboxStates = new Map();
|
|
1157
|
+
const _cbPattern = /-\s*\[(x| )\]\s*.*Phase\s+(\d+[A-Z]?(?:\.\d+)*)[:\s]/gi;
|
|
1158
|
+
let _cbMatch;
|
|
1159
|
+
while ((_cbMatch = _cbPattern.exec(content)) !== null) {
|
|
1160
|
+
_checkboxStates.set(_cbMatch[2], _cbMatch[1].toLowerCase() === 'x');
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
const phasePattern = /#{2,4}\s*Phase\s+(\d+[A-Z]?(?:\.\d+)*)\s*:\s*([^\n]+)/gi;
|
|
1164
|
+
const phases = [];
|
|
1165
|
+
let match;
|
|
1166
|
+
|
|
1167
|
+
while ((match = phasePattern.exec(content)) !== null) {
|
|
1168
|
+
const phaseNum = match[1];
|
|
1169
|
+
const phaseName = match[2].replace(/\(INSERTED\)/i, '').trim();
|
|
1170
|
+
|
|
1171
|
+
const sectionStart = match.index;
|
|
1172
|
+
const restOfContent = content.slice(sectionStart);
|
|
1173
|
+
// #3691: `\d` → `\d[\d.]*` so decimal phase headings (e.g. `### Phase 02.3:`) are
|
|
1174
|
+
// recognised as section boundaries.
|
|
1175
|
+
const nextHeader = restOfContent.match(/\n#{2,4}\s+Phase\s+\d[\d.]*/i);
|
|
1176
|
+
const sectionEnd = nextHeader ? sectionStart + nextHeader.index : content.length;
|
|
1177
|
+
const section = content.slice(sectionStart, sectionEnd);
|
|
1178
|
+
|
|
1179
|
+
const goalMatch = section.match(/\*\*Goal(?::\*\*|\*\*:)\s*([^\n]+)/i);
|
|
1180
|
+
const goal = goalMatch ? goalMatch[1].trim() : null;
|
|
1181
|
+
|
|
1182
|
+
const dependsMatch = section.match(/\*\*Depends on(?::\*\*|\*\*:)\s*([^\n]+)/i);
|
|
1183
|
+
const depends_on = dependsMatch ? dependsMatch[1].trim() : null;
|
|
1184
|
+
|
|
1185
|
+
const normalized = normalizePhaseName(phaseNum);
|
|
1186
|
+
let diskStatus = 'no_directory';
|
|
1187
|
+
let planCount = 0;
|
|
1188
|
+
let summaryCount = 0;
|
|
1189
|
+
let hasContext = false;
|
|
1190
|
+
let hasResearch = false;
|
|
1191
|
+
let lastActivity = null;
|
|
1192
|
+
let isActive = false;
|
|
1193
|
+
|
|
1194
|
+
try {
|
|
1195
|
+
const dirs = _phaseDirEntries.filter(isDirInMilestone);
|
|
1196
|
+
const dirMatch = dirs.find(d => phaseTokenMatches(d, normalized));
|
|
1197
|
+
|
|
1198
|
+
if (dirMatch) {
|
|
1199
|
+
const fullDir = path.join(phasesDir, dirMatch);
|
|
1200
|
+
const phaseFiles = fs.readdirSync(fullDir);
|
|
1201
|
+
planCount = listPhasePlanFiles(fullDir).length;
|
|
1202
|
+
summaryCount = listPhaseSummaryFiles(fullDir).length;
|
|
1203
|
+
hasContext = findContextMdIn(fullDir) !== null;
|
|
1204
|
+
hasResearch = phaseFiles.some(f => f.endsWith('-RESEARCH.md') || f === 'RESEARCH.md');
|
|
1205
|
+
|
|
1206
|
+
if (summaryCount >= planCount && planCount > 0) diskStatus = 'complete';
|
|
1207
|
+
else if (summaryCount > 0) diskStatus = 'partial';
|
|
1208
|
+
else if (planCount > 0) diskStatus = 'planned';
|
|
1209
|
+
else if (hasResearch) diskStatus = 'researched';
|
|
1210
|
+
else if (hasContext) diskStatus = 'discussed';
|
|
1211
|
+
else diskStatus = 'empty';
|
|
1212
|
+
|
|
1213
|
+
// Activity detection: check most recent file mtime
|
|
1214
|
+
const now = Date.now();
|
|
1215
|
+
let newestMtime = 0;
|
|
1216
|
+
for (const f of phaseFiles) {
|
|
1217
|
+
try {
|
|
1218
|
+
const stat = fs.statSync(path.join(fullDir, f));
|
|
1219
|
+
if (stat.mtimeMs > newestMtime) newestMtime = stat.mtimeMs;
|
|
1220
|
+
} catch { /* intentionally empty */ }
|
|
1221
|
+
}
|
|
1222
|
+
if (newestMtime > 0) {
|
|
1223
|
+
lastActivity = new Date(newestMtime).toISOString();
|
|
1224
|
+
isActive = (now - newestMtime) < 300000; // 5 minutes
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
} catch { /* intentionally empty */ }
|
|
1228
|
+
|
|
1229
|
+
// Check ROADMAP checkbox status (pre-extracted above the loop)
|
|
1230
|
+
const roadmapComplete = _checkboxStates.get(phaseNum) || false;
|
|
1231
|
+
if (roadmapComplete && diskStatus !== 'complete') {
|
|
1232
|
+
diskStatus = 'complete';
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
phases.push({
|
|
1236
|
+
number: phaseNum,
|
|
1237
|
+
name: phaseName,
|
|
1238
|
+
goal,
|
|
1239
|
+
depends_on,
|
|
1240
|
+
disk_status: diskStatus,
|
|
1241
|
+
has_context: hasContext,
|
|
1242
|
+
has_research: hasResearch,
|
|
1243
|
+
plan_count: planCount,
|
|
1244
|
+
summary_count: summaryCount,
|
|
1245
|
+
roadmap_complete: roadmapComplete,
|
|
1246
|
+
last_activity: lastActivity,
|
|
1247
|
+
is_active: isActive,
|
|
1248
|
+
});
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
// Compute display names: truncate to keep table aligned
|
|
1252
|
+
const MAX_NAME_WIDTH = 20;
|
|
1253
|
+
for (const phase of phases) {
|
|
1254
|
+
if (phase.name.length > MAX_NAME_WIDTH) {
|
|
1255
|
+
phase.display_name = phase.name.slice(0, MAX_NAME_WIDTH - 1) + '…';
|
|
1256
|
+
} else {
|
|
1257
|
+
phase.display_name = phase.name;
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
// Dependency satisfaction: check if all depends_on phases are complete
|
|
1262
|
+
const completedNums = new Set(phases.filter(p => p.disk_status === 'complete').map(p => p.number));
|
|
1263
|
+
|
|
1264
|
+
// Also include phases from previously shipped milestones — they are all
|
|
1265
|
+
// complete by definition (a milestone only ships when all phases are done).
|
|
1266
|
+
// rawContent is the full ROADMAP.md (including <details>-wrapped shipped
|
|
1267
|
+
// milestone sections that extractCurrentMilestone strips out).
|
|
1268
|
+
const _allCompletedPattern = /-\s*\[x\]\s*.*Phase\s+(\d+[A-Z]?(?:\.\d+)*)[:\s]/gi;
|
|
1269
|
+
let _allMatch;
|
|
1270
|
+
while ((_allMatch = _allCompletedPattern.exec(rawContent)) !== null) {
|
|
1271
|
+
completedNums.add(_allMatch[1]);
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
for (const phase of phases) {
|
|
1275
|
+
if (!phase.depends_on || /^none$/i.test(phase.depends_on.trim())) {
|
|
1276
|
+
phase.deps_satisfied = true;
|
|
1277
|
+
} else {
|
|
1278
|
+
// Parse "Phase 1, Phase 3" or "1, 3" formats
|
|
1279
|
+
const depNums = phase.depends_on.match(/\d+(?:\.\d+)*/g) || [];
|
|
1280
|
+
phase.deps_satisfied = depNums.every(n => completedNums.has(n));
|
|
1281
|
+
phase.dep_phases = depNums;
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
// Compact dependency display for dashboard
|
|
1286
|
+
for (const phase of phases) {
|
|
1287
|
+
phase.deps_display = (phase.dep_phases && phase.dep_phases.length > 0)
|
|
1288
|
+
? phase.dep_phases.join(',')
|
|
1289
|
+
: '—';
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
for (const phase of phases) {
|
|
1293
|
+
phase.is_next_to_discuss =
|
|
1294
|
+
(phase.disk_status === 'empty' || phase.disk_status === 'no_directory') &&
|
|
1295
|
+
phase.deps_satisfied;
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
// Check for WAITING.json signal
|
|
1299
|
+
let waitingSignal = null;
|
|
1300
|
+
try {
|
|
1301
|
+
const waitingPath = path.join(cwd, '.planning', 'WAITING.json');
|
|
1302
|
+
const waitingRaw = platformReadSync(waitingPath);
|
|
1303
|
+
if (waitingRaw !== null) {
|
|
1304
|
+
waitingSignal = JSON.parse(waitingRaw);
|
|
1305
|
+
}
|
|
1306
|
+
} catch { /* intentionally empty */ }
|
|
1307
|
+
|
|
1308
|
+
// Compute recommended actions (execute > plan > discuss)
|
|
1309
|
+
// Skip BACKLOG phases (999.x numbering) — they are parked ideas, not active work
|
|
1310
|
+
const recommendedActions = [];
|
|
1311
|
+
for (const phase of phases) {
|
|
1312
|
+
if (phase.disk_status === 'complete') continue;
|
|
1313
|
+
if (/^999(?:\.|$)/.test(phase.number)) continue;
|
|
1314
|
+
|
|
1315
|
+
if (phase.disk_status === 'planned' && phase.deps_satisfied) {
|
|
1316
|
+
recommendedActions.push({
|
|
1317
|
+
phase: phase.number,
|
|
1318
|
+
phase_name: phase.name,
|
|
1319
|
+
action: 'execute',
|
|
1320
|
+
reason: `${phase.plan_count} plans ready, dependencies met`,
|
|
1321
|
+
command: `${formatGsdSlash('execute-phase', _slashRuntime)} ${phase.number}`,
|
|
1322
|
+
});
|
|
1323
|
+
} else if (phase.disk_status === 'discussed' || phase.disk_status === 'researched') {
|
|
1324
|
+
recommendedActions.push({
|
|
1325
|
+
phase: phase.number,
|
|
1326
|
+
phase_name: phase.name,
|
|
1327
|
+
action: 'plan',
|
|
1328
|
+
reason: 'Context gathered, ready for planning',
|
|
1329
|
+
command: `${formatGsdSlash('plan-phase', _slashRuntime)} ${phase.number}`,
|
|
1330
|
+
});
|
|
1331
|
+
} else if ((phase.disk_status === 'empty' || phase.disk_status === 'no_directory') && phase.is_next_to_discuss) {
|
|
1332
|
+
recommendedActions.push({
|
|
1333
|
+
phase: phase.number,
|
|
1334
|
+
phase_name: phase.name,
|
|
1335
|
+
action: 'discuss',
|
|
1336
|
+
reason: 'Unblocked, ready to gather context',
|
|
1337
|
+
command: `${formatGsdSlash('discuss-phase', _slashRuntime)} ${phase.number}`,
|
|
1338
|
+
});
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
// Filter recommendations: no parallel execute/plan unless phases are independent
|
|
1343
|
+
// Two phases are "independent" if neither depends on the other (directly or transitively)
|
|
1344
|
+
const phaseMap = new Map(phases.map(p => [p.number, p]));
|
|
1345
|
+
|
|
1346
|
+
function reaches(from, to, visited = new Set()) {
|
|
1347
|
+
if (visited.has(from)) return false;
|
|
1348
|
+
visited.add(from);
|
|
1349
|
+
const p = phaseMap.get(from);
|
|
1350
|
+
if (!p || !p.dep_phases || p.dep_phases.length === 0) return false;
|
|
1351
|
+
if (p.dep_phases.includes(to)) return true;
|
|
1352
|
+
return p.dep_phases.some(dep => reaches(dep, to, visited));
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
function hasDepRelationship(numA, numB) {
|
|
1356
|
+
return reaches(numA, numB) || reaches(numB, numA);
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
// Detect phases with active work (file modified in last 5 min)
|
|
1360
|
+
const activeExecuting = phases.filter(p =>
|
|
1361
|
+
p.disk_status === 'partial' ||
|
|
1362
|
+
(p.disk_status === 'planned' && p.is_active)
|
|
1363
|
+
);
|
|
1364
|
+
const activePlanning = phases.filter(p =>
|
|
1365
|
+
p.is_active && (p.disk_status === 'discussed' || p.disk_status === 'researched')
|
|
1366
|
+
);
|
|
1367
|
+
|
|
1368
|
+
const filteredActions = recommendedActions.filter(action => {
|
|
1369
|
+
if (action.action === 'execute' && activeExecuting.length > 0) {
|
|
1370
|
+
// Only allow if independent of ALL actively-executing phases
|
|
1371
|
+
return activeExecuting.every(active => !hasDepRelationship(action.phase, active.number));
|
|
1372
|
+
}
|
|
1373
|
+
if (action.action === 'plan' && activePlanning.length > 0) {
|
|
1374
|
+
// Only allow if independent of ALL actively-planning phases
|
|
1375
|
+
return activePlanning.every(active => !hasDepRelationship(action.phase, active.number));
|
|
1376
|
+
}
|
|
1377
|
+
return true;
|
|
1378
|
+
});
|
|
1379
|
+
|
|
1380
|
+
// Exclude backlog phases (999.x) from completion accounting (#2129)
|
|
1381
|
+
const nonBacklogPhases = phases.filter(p => !/^999(?:\.|$)/.test(p.number));
|
|
1382
|
+
const completedCount = nonBacklogPhases.filter(p => p.disk_status === 'complete').length;
|
|
1383
|
+
|
|
1384
|
+
// Read manager flags from config (passthrough flags for each step)
|
|
1385
|
+
// Validate: flags must be CLI-safe (only --flags, alphanumeric, hyphens, spaces)
|
|
1386
|
+
const sanitizeFlags = (raw) => {
|
|
1387
|
+
const val = typeof raw === 'string' ? raw : '';
|
|
1388
|
+
if (!val) return '';
|
|
1389
|
+
// Allow only --flag patterns with alphanumeric/hyphen values separated by spaces
|
|
1390
|
+
const tokens = val.split(/\s+/).filter(Boolean);
|
|
1391
|
+
const safe = tokens.every(t => /^--[a-zA-Z0-9][-a-zA-Z0-9]*$/.test(t) || /^[a-zA-Z0-9][-a-zA-Z0-9_.]*$/.test(t));
|
|
1392
|
+
if (!safe) {
|
|
1393
|
+
process.stderr.write(`gsd-tools: warning: manager.flags contains invalid tokens, ignoring: ${val}\n`);
|
|
1394
|
+
return '';
|
|
1395
|
+
}
|
|
1396
|
+
return val;
|
|
1397
|
+
};
|
|
1398
|
+
const managerFlags = {
|
|
1399
|
+
discuss: sanitizeFlags(config.manager && config.manager.flags && config.manager.flags.discuss),
|
|
1400
|
+
plan: sanitizeFlags(config.manager && config.manager.flags && config.manager.flags.plan),
|
|
1401
|
+
execute: sanitizeFlags(config.manager && config.manager.flags && config.manager.flags.execute),
|
|
1402
|
+
};
|
|
1403
|
+
|
|
1404
|
+
const result = {
|
|
1405
|
+
milestone_version: milestone.version,
|
|
1406
|
+
milestone_name: milestone.name,
|
|
1407
|
+
phases,
|
|
1408
|
+
phase_count: phases.length,
|
|
1409
|
+
completed_count: completedCount,
|
|
1410
|
+
in_progress_count: phases.filter(p => ['partial', 'planned', 'discussed', 'researched'].includes(p.disk_status)).length,
|
|
1411
|
+
recommended_actions: filteredActions,
|
|
1412
|
+
waiting_signal: waitingSignal,
|
|
1413
|
+
all_complete: completedCount === nonBacklogPhases.length && nonBacklogPhases.length > 0,
|
|
1414
|
+
project_exists: pathExistsInternal(cwd, '.planning/PROJECT.md'),
|
|
1415
|
+
roadmap_exists: true,
|
|
1416
|
+
state_exists: true,
|
|
1417
|
+
manager_flags: managerFlags,
|
|
1418
|
+
};
|
|
1419
|
+
|
|
1420
|
+
output(withProjectRoot(cwd, result), raw);
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
function cmdInitProgress(cwd, raw) {
|
|
1424
|
+
try {
|
|
1425
|
+
const { pruneOrphanedWorktrees } = require('./core.cjs');
|
|
1426
|
+
pruneOrphanedWorktrees(cwd);
|
|
1427
|
+
} catch (_) {}
|
|
1428
|
+
const config = loadConfig(cwd);
|
|
1429
|
+
const milestone = getMilestoneInfo(cwd);
|
|
1430
|
+
|
|
1431
|
+
// Analyze phases — filter to current milestone and include ROADMAP-only phases
|
|
1432
|
+
const phasesDir = path.join(planningDir(cwd), 'phases');
|
|
1433
|
+
const phases = [];
|
|
1434
|
+
let currentPhase = null;
|
|
1435
|
+
let nextPhase = null;
|
|
1436
|
+
|
|
1437
|
+
// Build set of phases defined in ROADMAP for the current milestone
|
|
1438
|
+
const roadmapPhaseNums = new Set();
|
|
1439
|
+
const roadmapPhaseNames = new Map();
|
|
1440
|
+
const roadmapCheckboxStates = new Map();
|
|
1441
|
+
try {
|
|
1442
|
+
const roadmapContent = extractCurrentMilestone(
|
|
1443
|
+
fs.readFileSync(path.join(planningDir(cwd), 'ROADMAP.md'), 'utf-8'), cwd
|
|
1444
|
+
);
|
|
1445
|
+
const headingPattern = /#{2,4}\s*Phase\s+(\d+[A-Z]?(?:\.\d+)*)\s*:\s*([^\n]+)/gi;
|
|
1446
|
+
let hm;
|
|
1447
|
+
while ((hm = headingPattern.exec(roadmapContent)) !== null) {
|
|
1448
|
+
roadmapPhaseNums.add(hm[1]);
|
|
1449
|
+
roadmapPhaseNames.set(hm[1], hm[2].replace(/\(INSERTED\)/i, '').trim());
|
|
1450
|
+
}
|
|
1451
|
+
// #2646: parse `- [x] Phase N` checkbox states so ROADMAP-only phases
|
|
1452
|
+
// inherit completion from the ROADMAP when no phase directory exists.
|
|
1453
|
+
const cbPattern = /-\s*\[(x| )\]\s*.*Phase\s+(\d+[A-Z]?(?:\.\d+)*)[:\s]/gi;
|
|
1454
|
+
let cbm;
|
|
1455
|
+
while ((cbm = cbPattern.exec(roadmapContent)) !== null) {
|
|
1456
|
+
roadmapCheckboxStates.set(cbm[2], cbm[1].toLowerCase() === 'x');
|
|
1457
|
+
}
|
|
1458
|
+
} catch { /* intentionally empty */ }
|
|
1459
|
+
|
|
1460
|
+
const isDirInMilestone = getMilestonePhaseFilter(cwd);
|
|
1461
|
+
const seenPhaseNums = new Set();
|
|
1462
|
+
|
|
1463
|
+
try {
|
|
1464
|
+
const entries = fs.readdirSync(phasesDir, { withFileTypes: true });
|
|
1465
|
+
const dirs = entries.filter(e => e.isDirectory()).map(e => e.name)
|
|
1466
|
+
.filter(isDirInMilestone)
|
|
1467
|
+
.sort((a, b) => {
|
|
1468
|
+
const pa = a.match(/^(\d+[A-Z]?(?:\.\d+)*)/i);
|
|
1469
|
+
const pb = b.match(/^(\d+[A-Z]?(?:\.\d+)*)/i);
|
|
1470
|
+
if (!pa || !pb) return a.localeCompare(b);
|
|
1471
|
+
return parseInt(pa[1], 10) - parseInt(pb[1], 10);
|
|
1472
|
+
});
|
|
1473
|
+
|
|
1474
|
+
for (const dir of dirs) {
|
|
1475
|
+
const match = dir.match(/^(\d+[A-Z]?(?:\.\d+)*)-?(.*)/i);
|
|
1476
|
+
const phaseNumber = match ? match[1] : dir;
|
|
1477
|
+
const phaseName = match && match[2] ? match[2] : null;
|
|
1478
|
+
seenPhaseNums.add(phaseNumber.replace(/^0+/, '') || '0');
|
|
1479
|
+
|
|
1480
|
+
const phasePath = path.join(phasesDir, dir);
|
|
1481
|
+
const phaseFiles = fs.readdirSync(phasePath);
|
|
1482
|
+
|
|
1483
|
+
const plans = listPhasePlanFiles(phasePath);
|
|
1484
|
+
const summaries = listPhaseSummaryFiles(phasePath);
|
|
1485
|
+
const hasResearch = phaseFiles.some(f => f.endsWith('-RESEARCH.md') || f === 'RESEARCH.md');
|
|
1486
|
+
|
|
1487
|
+
const status = summaries.length >= plans.length && plans.length > 0 ? 'complete' :
|
|
1488
|
+
plans.length > 0 ? 'in_progress' :
|
|
1489
|
+
hasResearch ? 'researched' : 'pending';
|
|
1490
|
+
|
|
1491
|
+
const phaseInfo = {
|
|
1492
|
+
number: phaseNumber,
|
|
1493
|
+
name: phaseName,
|
|
1494
|
+
directory: toPosixPath(path.relative(cwd, path.join(planningDir(cwd), 'phases', dir))),
|
|
1495
|
+
status,
|
|
1496
|
+
plan_count: plans.length,
|
|
1497
|
+
summary_count: summaries.length,
|
|
1498
|
+
has_research: hasResearch,
|
|
1499
|
+
};
|
|
1500
|
+
|
|
1501
|
+
phases.push(phaseInfo);
|
|
1502
|
+
|
|
1503
|
+
// Find current (first incomplete with plans) and next (first pending)
|
|
1504
|
+
if (!currentPhase && (status === 'in_progress' || status === 'researched')) {
|
|
1505
|
+
currentPhase = phaseInfo;
|
|
1506
|
+
}
|
|
1507
|
+
if (!nextPhase && status === 'pending') {
|
|
1508
|
+
nextPhase = phaseInfo;
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
} catch { /* intentionally empty */ }
|
|
1512
|
+
|
|
1513
|
+
// Add phases defined in ROADMAP but not yet scaffolded to disk. When the
|
|
1514
|
+
// ROADMAP has a `- [x] Phase N` checkbox, honor it as 'complete' so
|
|
1515
|
+
// completed_count and status reflect the ROADMAP source of truth (#2646).
|
|
1516
|
+
for (const [num, name] of roadmapPhaseNames) {
|
|
1517
|
+
const stripped = num.replace(/^0+/, '') || '0';
|
|
1518
|
+
if (!seenPhaseNums.has(stripped)) {
|
|
1519
|
+
const checkboxComplete =
|
|
1520
|
+
roadmapCheckboxStates.get(num) === true ||
|
|
1521
|
+
roadmapCheckboxStates.get(stripped) === true;
|
|
1522
|
+
const status = checkboxComplete ? 'complete' : 'not_started';
|
|
1523
|
+
const phaseInfo = {
|
|
1524
|
+
number: num,
|
|
1525
|
+
name: name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, ''),
|
|
1526
|
+
directory: null,
|
|
1527
|
+
status,
|
|
1528
|
+
plan_count: 0,
|
|
1529
|
+
summary_count: 0,
|
|
1530
|
+
has_research: false,
|
|
1531
|
+
};
|
|
1532
|
+
phases.push(phaseInfo);
|
|
1533
|
+
if (!nextPhase && !currentPhase && status !== 'complete') {
|
|
1534
|
+
nextPhase = phaseInfo;
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
// Re-sort phases by number after adding ROADMAP-only phases
|
|
1540
|
+
phases.sort((a, b) => parseInt(a.number, 10) - parseInt(b.number, 10));
|
|
1541
|
+
|
|
1542
|
+
// Check for paused work
|
|
1543
|
+
let pausedAt = null;
|
|
1544
|
+
const state = platformReadSync(path.join(planningDir(cwd), 'STATE.md'));
|
|
1545
|
+
if (state !== null) {
|
|
1546
|
+
const pauseMatch = state.match(/\*\*Paused At:\*\*\s*(.+)/);
|
|
1547
|
+
if (pauseMatch) pausedAt = pauseMatch[1].trim();
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
const result = {
|
|
1551
|
+
// Models
|
|
1552
|
+
executor_model: resolveModelInternal(cwd, 'gsd-executor'),
|
|
1553
|
+
planner_model: resolveModelInternal(cwd, 'gsd-planner'),
|
|
1554
|
+
|
|
1555
|
+
// Config
|
|
1556
|
+
commit_docs: config.commit_docs,
|
|
1557
|
+
|
|
1558
|
+
// Milestone
|
|
1559
|
+
milestone_version: milestone.version,
|
|
1560
|
+
milestone_name: milestone.name,
|
|
1561
|
+
|
|
1562
|
+
// Phase overview
|
|
1563
|
+
phases,
|
|
1564
|
+
phase_count: phases.length,
|
|
1565
|
+
completed_count: phases.filter(p => p.status === 'complete').length,
|
|
1566
|
+
in_progress_count: phases.filter(p => p.status === 'in_progress').length,
|
|
1567
|
+
|
|
1568
|
+
// Current state
|
|
1569
|
+
current_phase: currentPhase,
|
|
1570
|
+
next_phase: nextPhase,
|
|
1571
|
+
paused_at: pausedAt,
|
|
1572
|
+
has_work_in_progress: !!currentPhase,
|
|
1573
|
+
|
|
1574
|
+
// File existence
|
|
1575
|
+
project_exists: pathExistsInternal(cwd, '.planning/PROJECT.md'),
|
|
1576
|
+
roadmap_exists: fs.existsSync(path.join(planningDir(cwd), 'ROADMAP.md')),
|
|
1577
|
+
state_exists: fs.existsSync(path.join(planningDir(cwd), 'STATE.md')),
|
|
1578
|
+
// File paths
|
|
1579
|
+
state_path: toPosixPath(path.relative(cwd, path.join(planningDir(cwd), 'STATE.md'))),
|
|
1580
|
+
roadmap_path: toPosixPath(path.relative(cwd, path.join(planningDir(cwd), 'ROADMAP.md'))),
|
|
1581
|
+
project_path: '.planning/PROJECT.md',
|
|
1582
|
+
config_path: toPosixPath(path.relative(cwd, path.join(planningDir(cwd), 'config.json'))),
|
|
1583
|
+
};
|
|
1584
|
+
|
|
1585
|
+
output(withProjectRoot(cwd, result), raw);
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
/**
|
|
1589
|
+
* Detect child git repos in a directory (one level deep).
|
|
1590
|
+
* Returns array of { name, path, has_uncommitted } objects.
|
|
1591
|
+
*/
|
|
1592
|
+
function detectChildRepos(dir) {
|
|
1593
|
+
const repos = [];
|
|
1594
|
+
let entries;
|
|
1595
|
+
try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return repos; }
|
|
1596
|
+
for (const entry of entries) {
|
|
1597
|
+
if (!entry.isDirectory()) continue;
|
|
1598
|
+
if (entry.name.startsWith('.')) continue;
|
|
1599
|
+
const fullPath = path.join(dir, entry.name);
|
|
1600
|
+
const gitDir = path.join(fullPath, '.git');
|
|
1601
|
+
if (fs.existsSync(gitDir)) {
|
|
1602
|
+
const statusResult = execGit(['status', '--porcelain'], { cwd: fullPath, timeout: 5000 });
|
|
1603
|
+
const hasUncommitted = statusResult.exitCode === 0 && statusResult.stdout.length > 0;
|
|
1604
|
+
repos.push({ name: entry.name, path: fullPath, has_uncommitted: hasUncommitted });
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
return repos;
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
function cmdInitNewWorkspace(cwd, raw) {
|
|
1611
|
+
const homedir = process.env.HOME || require('os').homedir();
|
|
1612
|
+
const defaultBase = path.join(homedir, 'gsd-workspaces');
|
|
1613
|
+
|
|
1614
|
+
// Detect child git repos for interactive selection
|
|
1615
|
+
const childRepos = detectChildRepos(cwd);
|
|
1616
|
+
|
|
1617
|
+
// Check if git worktree is available
|
|
1618
|
+
const gitVersion = execGit(['--version'], { timeout: 5000 });
|
|
1619
|
+
const worktreeAvailable = gitVersion.exitCode === 0;
|
|
1620
|
+
|
|
1621
|
+
const result = {
|
|
1622
|
+
default_workspace_base: defaultBase,
|
|
1623
|
+
child_repos: childRepos,
|
|
1624
|
+
child_repo_count: childRepos.length,
|
|
1625
|
+
worktree_available: worktreeAvailable,
|
|
1626
|
+
is_git_repo: pathExistsInternal(cwd, '.git'),
|
|
1627
|
+
cwd_repo_name: path.basename(cwd),
|
|
1628
|
+
};
|
|
1629
|
+
|
|
1630
|
+
output(withProjectRoot(cwd, result), raw);
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
function cmdInitListWorkspaces(cwd, raw) {
|
|
1634
|
+
const homedir = process.env.HOME || require('os').homedir();
|
|
1635
|
+
const defaultBase = path.join(homedir, 'gsd-workspaces');
|
|
1636
|
+
|
|
1637
|
+
const workspaces = [];
|
|
1638
|
+
if (fs.existsSync(defaultBase)) {
|
|
1639
|
+
let entries;
|
|
1640
|
+
try { entries = fs.readdirSync(defaultBase, { withFileTypes: true }); } catch { entries = []; }
|
|
1641
|
+
for (const entry of entries) {
|
|
1642
|
+
if (!entry.isDirectory()) continue;
|
|
1643
|
+
const wsPath = path.join(defaultBase, entry.name);
|
|
1644
|
+
const manifestPath = path.join(wsPath, 'WORKSPACE.md');
|
|
1645
|
+
if (!fs.existsSync(manifestPath)) continue;
|
|
1646
|
+
|
|
1647
|
+
let repoCount = 0;
|
|
1648
|
+
let hasProject = false;
|
|
1649
|
+
let strategy = 'unknown';
|
|
1650
|
+
const manifest = platformReadSync(manifestPath);
|
|
1651
|
+
if (manifest !== null) {
|
|
1652
|
+
const strategyMatch = manifest.match(/^Strategy:\s*(.+)$/m);
|
|
1653
|
+
if (strategyMatch) strategy = strategyMatch[1].trim();
|
|
1654
|
+
// Count table rows (lines starting with |, excluding header and separator)
|
|
1655
|
+
const tableRows = manifest.split('\n').filter(l => l.match(/^\|\s*\w/) && !l.includes('Repo') && !l.includes('---'));
|
|
1656
|
+
repoCount = tableRows.length;
|
|
1657
|
+
}
|
|
1658
|
+
hasProject = fs.existsSync(path.join(wsPath, '.planning', 'PROJECT.md'));
|
|
1659
|
+
|
|
1660
|
+
workspaces.push({
|
|
1661
|
+
name: entry.name,
|
|
1662
|
+
path: wsPath,
|
|
1663
|
+
repo_count: repoCount,
|
|
1664
|
+
strategy,
|
|
1665
|
+
has_project: hasProject,
|
|
1666
|
+
});
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
const result = {
|
|
1671
|
+
workspace_base: defaultBase,
|
|
1672
|
+
workspaces,
|
|
1673
|
+
workspace_count: workspaces.length,
|
|
1674
|
+
};
|
|
1675
|
+
|
|
1676
|
+
output(result, raw);
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
function cmdInitRemoveWorkspace(cwd, name, raw) {
|
|
1680
|
+
const homedir = process.env.HOME || require('os').homedir();
|
|
1681
|
+
const defaultBase = path.join(homedir, 'gsd-workspaces');
|
|
1682
|
+
|
|
1683
|
+
if (!name) {
|
|
1684
|
+
error('workspace name required for init remove-workspace');
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
const wsPath = path.join(defaultBase, name);
|
|
1688
|
+
const manifestPath = path.join(wsPath, 'WORKSPACE.md');
|
|
1689
|
+
|
|
1690
|
+
if (!fs.existsSync(wsPath)) {
|
|
1691
|
+
error(`Workspace not found: ${wsPath}`);
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
// Parse manifest for repo info
|
|
1695
|
+
const repos = [];
|
|
1696
|
+
let strategy = 'unknown';
|
|
1697
|
+
const manifestContent = platformReadSync(manifestPath);
|
|
1698
|
+
if (manifestContent !== null) {
|
|
1699
|
+
try {
|
|
1700
|
+
const manifest = manifestContent;
|
|
1701
|
+
const strategyMatch = manifest.match(/^Strategy:\s*(.+)$/m);
|
|
1702
|
+
if (strategyMatch) strategy = strategyMatch[1].trim();
|
|
1703
|
+
|
|
1704
|
+
// Parse table rows for repo names and source paths
|
|
1705
|
+
const lines = manifest.split('\n');
|
|
1706
|
+
for (const line of lines) {
|
|
1707
|
+
const match = line.match(/^\|\s*(\S+)\s*\|\s*(\S+)\s*\|\s*(\S+)\s*\|\s*(\S+)\s*\|$/);
|
|
1708
|
+
if (match && match[1] !== 'Repo' && !match[1].includes('---')) {
|
|
1709
|
+
repos.push({ name: match[1], source: match[2], branch: match[3], strategy: match[4] });
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
} catch { /* best-effort */ }
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
// Check for uncommitted changes in workspace repos
|
|
1716
|
+
const dirtyRepos = [];
|
|
1717
|
+
for (const repo of repos) {
|
|
1718
|
+
const repoPath = path.join(wsPath, repo.name);
|
|
1719
|
+
if (!fs.existsSync(repoPath)) continue;
|
|
1720
|
+
const statusResult = execGit(['status', '--porcelain'], { cwd: repoPath, timeout: 5000 });
|
|
1721
|
+
if (statusResult.exitCode === 0 && statusResult.stdout.length > 0) {
|
|
1722
|
+
dirtyRepos.push(repo.name);
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
const result = {
|
|
1727
|
+
workspace_name: name,
|
|
1728
|
+
workspace_path: wsPath,
|
|
1729
|
+
has_manifest: fs.existsSync(manifestPath),
|
|
1730
|
+
strategy,
|
|
1731
|
+
repos,
|
|
1732
|
+
repo_count: repos.length,
|
|
1733
|
+
dirty_repos: dirtyRepos,
|
|
1734
|
+
has_dirty_repos: dirtyRepos.length > 0,
|
|
1735
|
+
};
|
|
1736
|
+
|
|
1737
|
+
output(result, raw);
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
/**
|
|
1741
|
+
* Build a formatted agent skills block for injection into Task() prompts.
|
|
1742
|
+
*
|
|
1743
|
+
* Reads `config.agent_skills[agentType]` and validates each skill path exists
|
|
1744
|
+
* within the project root. Returns a formatted `<agent_skills>` block or empty
|
|
1745
|
+
* string if no skills are configured.
|
|
1746
|
+
*
|
|
1747
|
+
* @param {object} config - Loaded project config
|
|
1748
|
+
* @param {string} agentType - The agent type (e.g., 'gsd-executor', 'gsd-planner')
|
|
1749
|
+
* @param {string} projectRoot - Absolute path to project root (for path validation)
|
|
1750
|
+
* @returns {string} Formatted skills block or empty string
|
|
1751
|
+
*/
|
|
1752
|
+
function buildAgentSkillsBlock(config, agentType, projectRoot) {
|
|
1753
|
+
const { validatePath } = require('./security.cjs');
|
|
1754
|
+
const os = require('os');
|
|
1755
|
+
const { getGlobalSkillDir, getGlobalSkillDisplayPath } = require('./runtime-homes.cjs');
|
|
1756
|
+
const runtime = (config && config.runtime) || 'claude';
|
|
1757
|
+
const globalSkillsBase = require('./runtime-homes.cjs').getGlobalSkillsBase(runtime);
|
|
1758
|
+
|
|
1759
|
+
if (!config || !config.agent_skills || !agentType) return '';
|
|
1760
|
+
|
|
1761
|
+
let skillPaths = config.agent_skills[agentType];
|
|
1762
|
+
if (!skillPaths) return '';
|
|
1763
|
+
|
|
1764
|
+
// Normalize single string to array
|
|
1765
|
+
if (typeof skillPaths === 'string') skillPaths = [skillPaths];
|
|
1766
|
+
if (!Array.isArray(skillPaths) || skillPaths.length === 0) return '';
|
|
1767
|
+
|
|
1768
|
+
const validPaths = [];
|
|
1769
|
+
for (const skillPath of skillPaths) {
|
|
1770
|
+
if (typeof skillPath !== 'string') continue;
|
|
1771
|
+
|
|
1772
|
+
// Support global: prefix for skills installed at the runtime's global skills directory (#1992, #3126)
|
|
1773
|
+
if (skillPath.startsWith('global:')) {
|
|
1774
|
+
const skillName = skillPath.slice(7);
|
|
1775
|
+
// Explicit empty-name guard before regex for clearer error message
|
|
1776
|
+
if (!skillName) {
|
|
1777
|
+
process.stderr.write(`[agent-skills] WARNING: "global:" prefix with empty skill name — skipping\n`);
|
|
1778
|
+
continue;
|
|
1779
|
+
}
|
|
1780
|
+
// Sanitize: skill name must be alphanumeric, hyphens, or underscores only
|
|
1781
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(skillName)) {
|
|
1782
|
+
process.stderr.write(`[agent-skills] WARNING: Invalid global skill name "${skillName}" — skipping\n`);
|
|
1783
|
+
continue;
|
|
1784
|
+
}
|
|
1785
|
+
// Cline is rules-based and has no global skills directory
|
|
1786
|
+
if (globalSkillsBase === null) {
|
|
1787
|
+
process.stderr.write(`[agent-skills] WARNING: Runtime "${runtime}" does not use a skills directory — "global:${skillName}" is not supported on this runtime\n`);
|
|
1788
|
+
continue;
|
|
1789
|
+
}
|
|
1790
|
+
const globalSkillDir = getGlobalSkillDir(runtime, skillName);
|
|
1791
|
+
const globalSkillMd = path.join(globalSkillDir, 'SKILL.md');
|
|
1792
|
+
const displayPath = getGlobalSkillDisplayPath(runtime, skillName);
|
|
1793
|
+
if (!fs.existsSync(globalSkillMd)) {
|
|
1794
|
+
process.stderr.write(`[agent-skills] WARNING: Global skill not found at "${displayPath}/SKILL.md" — skipping\n`);
|
|
1795
|
+
continue;
|
|
1796
|
+
}
|
|
1797
|
+
// Symlink escape guard: validatePath resolves symlinks and enforces
|
|
1798
|
+
// containment within globalSkillsBase. Prevents a skill directory
|
|
1799
|
+
// symlinked to an arbitrary location from being injected (#1992).
|
|
1800
|
+
const pathCheck = validatePath(globalSkillMd, globalSkillsBase, { allowAbsolute: true });
|
|
1801
|
+
if (!pathCheck.safe) {
|
|
1802
|
+
process.stderr.write(`[agent-skills] WARNING: Global skill "${skillName}" failed path check (symlink escape?) — skipping\n`);
|
|
1803
|
+
continue;
|
|
1804
|
+
}
|
|
1805
|
+
validPaths.push({ ref: `${globalSkillDir}/SKILL.md`, display: displayPath });
|
|
1806
|
+
continue;
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
// Validate path safety — must resolve within project root
|
|
1810
|
+
const pathCheck = validatePath(skillPath, projectRoot);
|
|
1811
|
+
if (!pathCheck.safe) {
|
|
1812
|
+
process.stderr.write(`[agent-skills] WARNING: Skipping unsafe path "${skillPath}": ${pathCheck.error}\n`);
|
|
1813
|
+
continue;
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
// Check that the skill directory and SKILL.md exist
|
|
1817
|
+
const skillMdPath = path.join(projectRoot, skillPath, 'SKILL.md');
|
|
1818
|
+
if (!fs.existsSync(skillMdPath)) {
|
|
1819
|
+
process.stderr.write(`[agent-skills] WARNING: Skill not found at "${skillPath}/SKILL.md" — skipping\n`);
|
|
1820
|
+
continue;
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
validPaths.push({ ref: `${skillPath}/SKILL.md`, display: skillPath });
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
if (validPaths.length === 0) return '';
|
|
1827
|
+
|
|
1828
|
+
const lines = validPaths.map(p => `- @${p.ref}`).join('\n');
|
|
1829
|
+
return `<agent_skills>\nRead these user-configured skills:\n${lines}\n</agent_skills>`;
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
/**
|
|
1833
|
+
* Command: output the agent skills block for a given agent type.
|
|
1834
|
+
* Used by workflows: SKILLS=$(node "$TOOLS" agent-skills gsd-executor 2>/dev/null)
|
|
1835
|
+
*/
|
|
1836
|
+
function cmdAgentSkills(cwd, agentType, raw) {
|
|
1837
|
+
if (!agentType) {
|
|
1838
|
+
// No agent type — output empty string silently
|
|
1839
|
+
output('', raw, '');
|
|
1840
|
+
return;
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
const config = loadConfig(cwd);
|
|
1844
|
+
const block = buildAgentSkillsBlock(config, agentType, cwd);
|
|
1845
|
+
// Output raw text (not JSON) so workflows can embed it directly
|
|
1846
|
+
if (block) {
|
|
1847
|
+
process.stdout.write(block);
|
|
1848
|
+
}
|
|
1849
|
+
process.exit(0);
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
/**
|
|
1853
|
+
* Generate a skill manifest from a skills directory.
|
|
1854
|
+
*
|
|
1855
|
+
* Scans the canonical skill discovery roots and returns a normalized
|
|
1856
|
+
* inventory object with discovered skills, root metadata, and installation
|
|
1857
|
+
* summary flags. A legacy `skillsDir` override is still accepted for focused
|
|
1858
|
+
* scans, but the default mode is multi-root discovery.
|
|
1859
|
+
*
|
|
1860
|
+
* @param {string} cwd - Project root directory
|
|
1861
|
+
* @param {string|null} [skillsDir] - Optional absolute path to a specific skills directory
|
|
1862
|
+
* @returns {{
|
|
1863
|
+
* skills: Array<{name: string, description: string, triggers: string[], path: string, file_path: string, root: string, scope: string, installed: boolean, deprecated: boolean}>,
|
|
1864
|
+
* roots: Array<{root: string, path: string, scope: string, present: boolean, skill_count?: number, command_count?: number, deprecated?: boolean}>,
|
|
1865
|
+
* installation: { gsd_skills_installed: boolean, legacy_claude_commands_installed: boolean },
|
|
1866
|
+
* counts: { skills: number, roots: number }
|
|
1867
|
+
* }}
|
|
1868
|
+
*/
|
|
1869
|
+
function buildSkillManifest(cwd, skillsDir = null) {
|
|
1870
|
+
const { extractFrontmatter } = require('./frontmatter.cjs');
|
|
1871
|
+
const { getGlobalSkillsBase } = require('./runtime-homes.cjs');
|
|
1872
|
+
const os = require('os');
|
|
1873
|
+
|
|
1874
|
+
const canonicalRoots = skillsDir ? [{
|
|
1875
|
+
root: path.resolve(skillsDir),
|
|
1876
|
+
path: path.resolve(skillsDir),
|
|
1877
|
+
scope: 'custom',
|
|
1878
|
+
present: fs.existsSync(skillsDir),
|
|
1879
|
+
kind: 'skills',
|
|
1880
|
+
}] : [
|
|
1881
|
+
{
|
|
1882
|
+
root: '.claude/skills',
|
|
1883
|
+
path: path.join(cwd, '.claude', 'skills'),
|
|
1884
|
+
scope: 'project',
|
|
1885
|
+
kind: 'skills',
|
|
1886
|
+
},
|
|
1887
|
+
{
|
|
1888
|
+
root: '.agents/skills',
|
|
1889
|
+
path: path.join(cwd, '.agents', 'skills'),
|
|
1890
|
+
scope: 'project',
|
|
1891
|
+
kind: 'skills',
|
|
1892
|
+
},
|
|
1893
|
+
{
|
|
1894
|
+
root: '.cursor/skills',
|
|
1895
|
+
path: path.join(cwd, '.cursor', 'skills'),
|
|
1896
|
+
scope: 'project',
|
|
1897
|
+
kind: 'skills',
|
|
1898
|
+
},
|
|
1899
|
+
{
|
|
1900
|
+
root: '.github/skills',
|
|
1901
|
+
path: path.join(cwd, '.github', 'skills'),
|
|
1902
|
+
scope: 'project',
|
|
1903
|
+
kind: 'skills',
|
|
1904
|
+
},
|
|
1905
|
+
{
|
|
1906
|
+
root: '.codex/skills',
|
|
1907
|
+
path: path.join(cwd, '.codex', 'skills'),
|
|
1908
|
+
scope: 'project',
|
|
1909
|
+
kind: 'skills',
|
|
1910
|
+
},
|
|
1911
|
+
{
|
|
1912
|
+
root: '~/.claude/skills',
|
|
1913
|
+
path: getGlobalSkillsBase('claude'),
|
|
1914
|
+
scope: 'global',
|
|
1915
|
+
kind: 'skills',
|
|
1916
|
+
},
|
|
1917
|
+
{
|
|
1918
|
+
root: '~/.codex/skills',
|
|
1919
|
+
path: getGlobalSkillsBase('codex'),
|
|
1920
|
+
scope: 'global',
|
|
1921
|
+
kind: 'skills',
|
|
1922
|
+
},
|
|
1923
|
+
{
|
|
1924
|
+
root: '.claude/get-shit-done/skills',
|
|
1925
|
+
path: path.join(os.homedir(), '.claude', 'get-shit-done', 'skills'),
|
|
1926
|
+
scope: 'import-only',
|
|
1927
|
+
kind: 'skills',
|
|
1928
|
+
deprecated: true,
|
|
1929
|
+
},
|
|
1930
|
+
{
|
|
1931
|
+
root: '.claude/commands/gsd',
|
|
1932
|
+
path: path.join(os.homedir(), '.claude', 'commands', 'gsd'),
|
|
1933
|
+
scope: 'legacy-commands',
|
|
1934
|
+
kind: 'commands',
|
|
1935
|
+
deprecated: true,
|
|
1936
|
+
},
|
|
1937
|
+
];
|
|
1938
|
+
|
|
1939
|
+
const skills = [];
|
|
1940
|
+
const roots = [];
|
|
1941
|
+
let legacyClaudeCommandsInstalled = false;
|
|
1942
|
+
for (const rootInfo of canonicalRoots) {
|
|
1943
|
+
const rootPath = rootInfo.path;
|
|
1944
|
+
const rootSummary = {
|
|
1945
|
+
root: rootInfo.root,
|
|
1946
|
+
path: rootPath,
|
|
1947
|
+
scope: rootInfo.scope,
|
|
1948
|
+
present: fs.existsSync(rootPath),
|
|
1949
|
+
deprecated: !!rootInfo.deprecated,
|
|
1950
|
+
};
|
|
1951
|
+
|
|
1952
|
+
if (!rootSummary.present) {
|
|
1953
|
+
roots.push(rootSummary);
|
|
1954
|
+
continue;
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
if (rootInfo.kind === 'commands') {
|
|
1958
|
+
let entries = [];
|
|
1959
|
+
try {
|
|
1960
|
+
entries = fs.readdirSync(rootPath, { withFileTypes: true });
|
|
1961
|
+
} catch {
|
|
1962
|
+
roots.push(rootSummary);
|
|
1963
|
+
continue;
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
const commandFiles = entries.filter(entry => entry.isFile() && entry.name.endsWith('.md'));
|
|
1967
|
+
rootSummary.command_count = commandFiles.length;
|
|
1968
|
+
if (rootSummary.command_count > 0) legacyClaudeCommandsInstalled = true;
|
|
1969
|
+
roots.push(rootSummary);
|
|
1970
|
+
continue;
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
let entries;
|
|
1974
|
+
try {
|
|
1975
|
+
entries = fs.readdirSync(rootPath, { withFileTypes: true });
|
|
1976
|
+
} catch {
|
|
1977
|
+
roots.push(rootSummary);
|
|
1978
|
+
continue;
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
let skillCount = 0;
|
|
1982
|
+
for (const entry of entries) {
|
|
1983
|
+
if (!entry.isDirectory()) continue;
|
|
1984
|
+
|
|
1985
|
+
const skillMdPath = path.join(rootPath, entry.name, 'SKILL.md');
|
|
1986
|
+
const content = platformReadSync(skillMdPath);
|
|
1987
|
+
if (content === null) continue;
|
|
1988
|
+
|
|
1989
|
+
const frontmatter = extractFrontmatter(content);
|
|
1990
|
+
const name = frontmatter.name || entry.name;
|
|
1991
|
+
const description = frontmatter.description || '';
|
|
1992
|
+
|
|
1993
|
+
// Extract trigger lines from body text (after frontmatter)
|
|
1994
|
+
const triggers = [];
|
|
1995
|
+
const bodyMatch = content.match(/^---[\s\S]*?---\s*\n([\s\S]*)$/);
|
|
1996
|
+
if (bodyMatch) {
|
|
1997
|
+
const body = bodyMatch[1];
|
|
1998
|
+
const triggerLines = body.match(/^TRIGGER\s+when:\s*(.+)$/gmi);
|
|
1999
|
+
if (triggerLines) {
|
|
2000
|
+
for (const line of triggerLines) {
|
|
2001
|
+
const m = line.match(/^TRIGGER\s+when:\s*(.+)$/i);
|
|
2002
|
+
if (m) triggers.push(m[1].trim());
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
skills.push({
|
|
2008
|
+
name,
|
|
2009
|
+
description,
|
|
2010
|
+
triggers,
|
|
2011
|
+
path: entry.name,
|
|
2012
|
+
file_path: `${entry.name}/SKILL.md`,
|
|
2013
|
+
root: rootInfo.root,
|
|
2014
|
+
scope: rootInfo.scope,
|
|
2015
|
+
installed: rootInfo.scope !== 'import-only',
|
|
2016
|
+
deprecated: !!rootInfo.deprecated,
|
|
2017
|
+
});
|
|
2018
|
+
skillCount++;
|
|
2019
|
+
}
|
|
2020
|
+
|
|
2021
|
+
rootSummary.skill_count = skillCount;
|
|
2022
|
+
roots.push(rootSummary);
|
|
2023
|
+
}
|
|
2024
|
+
|
|
2025
|
+
skills.sort((a, b) => {
|
|
2026
|
+
const rootCmp = a.root.localeCompare(b.root);
|
|
2027
|
+
return rootCmp !== 0 ? rootCmp : a.name.localeCompare(b.name);
|
|
2028
|
+
});
|
|
2029
|
+
|
|
2030
|
+
const gsdSkillsInstalled = skills.some(skill => skill.name.startsWith('gsd-'));
|
|
2031
|
+
|
|
2032
|
+
return {
|
|
2033
|
+
skills,
|
|
2034
|
+
roots,
|
|
2035
|
+
installation: {
|
|
2036
|
+
gsd_skills_installed: gsdSkillsInstalled,
|
|
2037
|
+
legacy_claude_commands_installed: legacyClaudeCommandsInstalled,
|
|
2038
|
+
},
|
|
2039
|
+
counts: {
|
|
2040
|
+
skills: skills.length,
|
|
2041
|
+
roots: roots.length,
|
|
2042
|
+
},
|
|
2043
|
+
};
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
/**
|
|
2047
|
+
* Command: generate skill manifest JSON.
|
|
2048
|
+
*
|
|
2049
|
+
* Options:
|
|
2050
|
+
* --skills-dir <path> Optional absolute path to a single skills directory
|
|
2051
|
+
* --write Also write to .planning/skill-manifest.json
|
|
2052
|
+
*/
|
|
2053
|
+
function cmdSkillManifest(cwd, args, raw) {
|
|
2054
|
+
const skillsDirIdx = args.indexOf('--skills-dir');
|
|
2055
|
+
const skillsDir = skillsDirIdx >= 0 && args[skillsDirIdx + 1]
|
|
2056
|
+
? args[skillsDirIdx + 1]
|
|
2057
|
+
: null;
|
|
2058
|
+
|
|
2059
|
+
const manifest = buildSkillManifest(cwd, skillsDir);
|
|
2060
|
+
|
|
2061
|
+
// Optionally write to .planning/skill-manifest.json
|
|
2062
|
+
if (args.includes('--write')) {
|
|
2063
|
+
const planningDir = path.join(cwd, '.planning');
|
|
2064
|
+
if (fs.existsSync(planningDir)) {
|
|
2065
|
+
const manifestPath = path.join(planningDir, 'skill-manifest.json');
|
|
2066
|
+
platformWriteSync(manifestPath, JSON.stringify(manifest, null, 2));
|
|
2067
|
+
}
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
output(manifest, raw);
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
module.exports = {
|
|
2074
|
+
cmdInitExecutePhase,
|
|
2075
|
+
cmdInitPlanPhase,
|
|
2076
|
+
cmdInitNewProject,
|
|
2077
|
+
cmdInitNewMilestone,
|
|
2078
|
+
cmdInitQuick,
|
|
2079
|
+
cmdInitIngestDocs,
|
|
2080
|
+
cmdInitResume,
|
|
2081
|
+
cmdInitVerifyWork,
|
|
2082
|
+
cmdInitPhaseOp,
|
|
2083
|
+
cmdInitTodos,
|
|
2084
|
+
cmdInitMilestoneOp,
|
|
2085
|
+
cmdInitMapCodebase,
|
|
2086
|
+
cmdInitProgress,
|
|
2087
|
+
cmdInitManager,
|
|
2088
|
+
cmdInitNewWorkspace,
|
|
2089
|
+
cmdInitListWorkspaces,
|
|
2090
|
+
cmdInitRemoveWorkspace,
|
|
2091
|
+
detectChildRepos,
|
|
2092
|
+
buildAgentSkillsBlock,
|
|
2093
|
+
cmdAgentSkills,
|
|
2094
|
+
buildSkillManifest,
|
|
2095
|
+
cmdSkillManifest,
|
|
2096
|
+
};
|