gsd-pi 2.29.0 → 2.30.0-dev.7e1bbce
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/README.md +24 -17
- package/dist/cli.js +51 -0
- package/dist/extension-registry.d.ts +63 -0
- package/dist/extension-registry.js +166 -0
- package/dist/headless.js +4 -0
- package/dist/help-text.js +35 -0
- package/dist/loader.js +10 -1
- package/dist/resource-loader.js +11 -1
- package/dist/resources/extensions/async-jobs/extension-manifest.json +13 -0
- package/dist/resources/extensions/bg-shell/extension-manifest.json +14 -0
- package/dist/resources/extensions/bg-shell/process-manager.ts +13 -0
- package/dist/resources/extensions/browser-tools/extension-manifest.json +37 -0
- package/dist/resources/extensions/context7/extension-manifest.json +12 -0
- package/dist/resources/extensions/google-search/extension-manifest.json +12 -0
- package/dist/resources/extensions/gsd/auto-dashboard.ts +31 -0
- package/dist/resources/extensions/gsd/auto-dispatch.ts +32 -3
- package/dist/resources/extensions/gsd/auto-post-unit.ts +45 -13
- package/dist/resources/extensions/gsd/auto-prompts.ts +40 -17
- package/dist/resources/extensions/gsd/auto-recovery.ts +18 -23
- package/dist/resources/extensions/gsd/auto-start.ts +18 -32
- package/dist/resources/extensions/gsd/auto-worktree.ts +21 -182
- package/dist/resources/extensions/gsd/auto.ts +2 -24
- package/dist/resources/extensions/gsd/captures.ts +4 -10
- package/dist/resources/extensions/gsd/commands-extensions.ts +328 -0
- package/dist/resources/extensions/gsd/commands-handlers.ts +22 -2
- package/dist/resources/extensions/gsd/commands-logs.ts +13 -14
- package/dist/resources/extensions/gsd/commands-prefs-wizard.ts +44 -14
- package/dist/resources/extensions/gsd/commands-workflow-templates.ts +544 -0
- package/dist/resources/extensions/gsd/commands.ts +108 -24
- package/dist/resources/extensions/gsd/dashboard-overlay.ts +2 -1
- package/dist/resources/extensions/gsd/detection.ts +2 -1
- package/dist/resources/extensions/gsd/doctor-checks.ts +49 -1
- package/dist/resources/extensions/gsd/doctor-types.ts +3 -1
- package/dist/resources/extensions/gsd/extension-manifest.json +18 -0
- package/dist/resources/extensions/gsd/forensics.ts +2 -2
- package/dist/resources/extensions/gsd/git-service.ts +3 -2
- package/dist/resources/extensions/gsd/gitignore.ts +9 -63
- package/dist/resources/extensions/gsd/gsd-db.ts +1 -165
- package/dist/resources/extensions/gsd/guided-flow.ts +8 -5
- package/dist/resources/extensions/gsd/index.ts +16 -3
- package/dist/resources/extensions/gsd/json-persistence.ts +16 -1
- package/dist/resources/extensions/gsd/md-importer.ts +3 -2
- package/dist/resources/extensions/gsd/mechanical-completion.ts +430 -0
- package/dist/resources/extensions/gsd/migrate/command.ts +3 -2
- package/dist/resources/extensions/gsd/migrate/writer.ts +2 -1
- package/dist/resources/extensions/gsd/migrate-external.ts +123 -0
- package/dist/resources/extensions/gsd/paths.ts +24 -2
- package/dist/resources/extensions/gsd/post-unit-hooks.ts +6 -5
- package/dist/resources/extensions/gsd/preferences-models.ts +7 -1
- package/dist/resources/extensions/gsd/preferences-validation.ts +2 -1
- package/dist/resources/extensions/gsd/preferences.ts +10 -5
- package/dist/resources/extensions/gsd/prompts/discuss-headless.md +4 -2
- package/dist/resources/extensions/gsd/prompts/guided-discuss-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/plan-milestone.md +26 -2
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +15 -1
- package/dist/resources/extensions/gsd/prompts/workflow-start.md +28 -0
- package/dist/resources/extensions/gsd/queue-order.ts +10 -11
- package/dist/resources/extensions/gsd/repo-identity.ts +148 -0
- package/dist/resources/extensions/gsd/resource-version.ts +99 -0
- package/dist/resources/extensions/gsd/roadmap-slices.ts +22 -7
- package/dist/resources/extensions/gsd/session-forensics.ts +4 -3
- package/dist/resources/extensions/gsd/session-lock.ts +53 -4
- package/dist/resources/extensions/gsd/session-status-io.ts +23 -41
- package/dist/resources/extensions/gsd/tests/activity-log.test.ts +2 -2
- package/dist/resources/extensions/gsd/tests/auto-budget-alerts.test.ts +1 -1
- package/dist/resources/extensions/gsd/tests/auto-recovery.test.ts +3 -3
- package/dist/resources/extensions/gsd/tests/auto-skip-loop.test.ts +1 -1
- package/dist/resources/extensions/gsd/tests/auto-worktree.test.ts +0 -58
- package/dist/resources/extensions/gsd/tests/doctor-runtime.test.ts +3 -4
- package/dist/resources/extensions/gsd/tests/extension-selector-separator.test.ts +60 -38
- package/dist/resources/extensions/gsd/tests/feature-branch-lifecycle-integration.test.ts +5 -18
- package/dist/resources/extensions/gsd/tests/git-service.test.ts +10 -37
- package/dist/resources/extensions/gsd/tests/knowledge.test.ts +4 -4
- package/dist/resources/extensions/gsd/tests/mechanical-completion.test.ts +356 -0
- package/dist/resources/extensions/gsd/tests/parallel-workers-multi-milestone-e2e.test.ts +1 -1
- package/dist/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +1 -0
- package/dist/resources/extensions/gsd/tests/token-profile.test.ts +14 -16
- package/dist/resources/extensions/gsd/tests/workflow-templates.test.ts +173 -0
- package/dist/resources/extensions/gsd/triage-resolution.ts +2 -1
- package/dist/resources/extensions/gsd/types.ts +2 -0
- package/dist/resources/extensions/gsd/workflow-templates/bugfix.md +87 -0
- package/dist/resources/extensions/gsd/workflow-templates/dep-upgrade.md +74 -0
- package/dist/resources/extensions/gsd/workflow-templates/full-project.md +41 -0
- package/dist/resources/extensions/gsd/workflow-templates/hotfix.md +45 -0
- package/dist/resources/extensions/gsd/workflow-templates/refactor.md +83 -0
- package/dist/resources/extensions/gsd/workflow-templates/registry.json +85 -0
- package/dist/resources/extensions/gsd/workflow-templates/security-audit.md +73 -0
- package/dist/resources/extensions/gsd/workflow-templates/small-feature.md +81 -0
- package/dist/resources/extensions/gsd/workflow-templates/spike.md +69 -0
- package/dist/resources/extensions/gsd/workflow-templates.ts +241 -0
- package/dist/resources/extensions/gsd/worktree-command.ts +1 -11
- package/dist/resources/extensions/gsd/worktree-manager.ts +3 -2
- package/dist/resources/extensions/gsd/worktree.ts +42 -5
- package/dist/resources/extensions/mac-tools/extension-manifest.json +16 -0
- package/dist/resources/extensions/mcp-client/index.ts +459 -0
- package/dist/resources/extensions/mcporter/extension-manifest.json +12 -0
- package/dist/resources/extensions/remote-questions/discord-adapter.ts +8 -19
- package/dist/resources/extensions/remote-questions/extension-manifest.json +11 -0
- package/dist/resources/extensions/remote-questions/http-client.ts +76 -0
- package/dist/resources/extensions/remote-questions/slack-adapter.ts +11 -17
- package/dist/resources/extensions/remote-questions/telegram-adapter.ts +8 -19
- package/dist/resources/extensions/search-the-web/extension-manifest.json +13 -0
- package/dist/resources/extensions/slash-commands/extension-manifest.json +11 -0
- package/dist/resources/extensions/subagent/extension-manifest.json +13 -0
- package/dist/resources/extensions/ttsr/extension-manifest.json +11 -0
- package/dist/resources/extensions/universal-config/extension-manifest.json +13 -0
- package/dist/resources/extensions/voice/extension-manifest.json +12 -0
- package/dist/resources/skills/create-gsd-extension/SKILL.md +87 -0
- package/dist/resources/skills/create-gsd-extension/references/compaction-session-control.md +77 -0
- package/dist/resources/skills/create-gsd-extension/references/custom-commands.md +139 -0
- package/dist/resources/skills/create-gsd-extension/references/custom-rendering.md +108 -0
- package/dist/resources/skills/create-gsd-extension/references/custom-tools.md +183 -0
- package/dist/resources/skills/create-gsd-extension/references/custom-ui.md +490 -0
- package/dist/resources/skills/create-gsd-extension/references/events-reference.md +126 -0
- package/dist/resources/skills/create-gsd-extension/references/extension-lifecycle.md +64 -0
- package/dist/resources/skills/create-gsd-extension/references/extensionapi-reference.md +75 -0
- package/dist/resources/skills/create-gsd-extension/references/extensioncontext-reference.md +53 -0
- package/dist/resources/skills/create-gsd-extension/references/key-rules-gotchas.md +36 -0
- package/dist/resources/skills/create-gsd-extension/references/mode-behavior.md +32 -0
- package/dist/resources/skills/create-gsd-extension/references/model-provider-management.md +89 -0
- package/dist/resources/skills/create-gsd-extension/references/packaging-distribution.md +55 -0
- package/dist/resources/skills/create-gsd-extension/references/remote-execution-overrides.md +90 -0
- package/dist/resources/skills/create-gsd-extension/references/state-management.md +70 -0
- package/dist/resources/skills/create-gsd-extension/references/system-prompt-modification.md +52 -0
- package/dist/resources/skills/create-gsd-extension/templates/extension-skeleton.ts +51 -0
- package/dist/resources/skills/create-gsd-extension/templates/stateful-tool-skeleton.ts +143 -0
- package/dist/resources/skills/create-gsd-extension/workflows/add-capability.md +57 -0
- package/dist/resources/skills/create-gsd-extension/workflows/create-extension.md +156 -0
- package/dist/resources/skills/create-gsd-extension/workflows/debug-extension.md +74 -0
- package/dist/resources/skills/create-skill/SKILL.md +184 -0
- package/dist/resources/skills/create-skill/references/api-security.md +226 -0
- package/dist/resources/skills/create-skill/references/be-clear-and-direct.md +531 -0
- package/dist/resources/skills/create-skill/references/common-patterns.md +595 -0
- package/dist/resources/skills/create-skill/references/core-principles.md +437 -0
- package/dist/resources/skills/create-skill/references/executable-code.md +175 -0
- package/dist/resources/skills/create-skill/references/gsd-skill-ecosystem.md +68 -0
- package/dist/resources/skills/create-skill/references/iteration-and-testing.md +474 -0
- package/dist/resources/skills/create-skill/references/recommended-structure.md +168 -0
- package/dist/resources/skills/create-skill/references/skill-structure.md +372 -0
- package/dist/resources/skills/create-skill/references/use-xml-tags.md +466 -0
- package/dist/resources/skills/create-skill/references/using-scripts.md +113 -0
- package/dist/resources/skills/create-skill/references/using-templates.md +112 -0
- package/dist/resources/skills/create-skill/references/workflows-and-validation.md +510 -0
- package/dist/resources/skills/create-skill/templates/router-skill.md +73 -0
- package/dist/resources/skills/create-skill/templates/simple-skill.md +33 -0
- package/dist/resources/skills/create-skill/workflows/add-reference.md +96 -0
- package/dist/resources/skills/create-skill/workflows/add-script.md +93 -0
- package/dist/resources/skills/create-skill/workflows/add-template.md +74 -0
- package/dist/resources/skills/create-skill/workflows/add-workflow.md +120 -0
- package/dist/resources/skills/create-skill/workflows/audit-skill.md +148 -0
- package/dist/resources/skills/create-skill/workflows/create-new-skill.md +196 -0
- package/dist/resources/skills/create-skill/workflows/get-guidance.md +121 -0
- package/dist/resources/skills/create-skill/workflows/upgrade-to-router.md +161 -0
- package/dist/resources/skills/create-skill/workflows/verify-skill.md +204 -0
- package/dist/resources/skills/react-best-practices/SKILL.md +1 -1
- package/dist/worktree-cli.d.ts +34 -0
- package/dist/worktree-cli.js +294 -0
- package/dist/worktree-name-gen.d.ts +7 -0
- package/dist/worktree-name-gen.js +44 -0
- package/package.json +1 -1
- package/packages/native/dist/native.d.ts +2 -0
- package/packages/native/dist/native.js +19 -5
- package/packages/native/src/native.ts +23 -9
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +13 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/client.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/client.js +3 -0
- package/packages/pi-coding-agent/dist/core/lsp/client.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +13 -0
- package/packages/pi-coding-agent/src/core/lsp/client.ts +3 -0
- package/pkg/package.json +1 -1
- package/src/resources/extensions/async-jobs/extension-manifest.json +13 -0
- package/src/resources/extensions/bg-shell/extension-manifest.json +14 -0
- package/src/resources/extensions/bg-shell/process-manager.ts +13 -0
- package/src/resources/extensions/browser-tools/extension-manifest.json +37 -0
- package/src/resources/extensions/context7/extension-manifest.json +12 -0
- package/src/resources/extensions/google-search/extension-manifest.json +12 -0
- package/src/resources/extensions/gsd/auto-dashboard.ts +31 -0
- package/src/resources/extensions/gsd/auto-dispatch.ts +32 -3
- package/src/resources/extensions/gsd/auto-post-unit.ts +45 -13
- package/src/resources/extensions/gsd/auto-prompts.ts +40 -17
- package/src/resources/extensions/gsd/auto-recovery.ts +18 -23
- package/src/resources/extensions/gsd/auto-start.ts +18 -32
- package/src/resources/extensions/gsd/auto-worktree.ts +21 -182
- package/src/resources/extensions/gsd/auto.ts +2 -24
- package/src/resources/extensions/gsd/captures.ts +4 -10
- package/src/resources/extensions/gsd/commands-extensions.ts +328 -0
- package/src/resources/extensions/gsd/commands-handlers.ts +22 -2
- package/src/resources/extensions/gsd/commands-logs.ts +13 -14
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +44 -14
- package/src/resources/extensions/gsd/commands-workflow-templates.ts +544 -0
- package/src/resources/extensions/gsd/commands.ts +108 -24
- package/src/resources/extensions/gsd/dashboard-overlay.ts +2 -1
- package/src/resources/extensions/gsd/detection.ts +2 -1
- package/src/resources/extensions/gsd/doctor-checks.ts +49 -1
- package/src/resources/extensions/gsd/doctor-types.ts +3 -1
- package/src/resources/extensions/gsd/extension-manifest.json +18 -0
- package/src/resources/extensions/gsd/forensics.ts +2 -2
- package/src/resources/extensions/gsd/git-service.ts +3 -2
- package/src/resources/extensions/gsd/gitignore.ts +9 -63
- package/src/resources/extensions/gsd/gsd-db.ts +1 -165
- package/src/resources/extensions/gsd/guided-flow.ts +8 -5
- package/src/resources/extensions/gsd/index.ts +16 -3
- package/src/resources/extensions/gsd/json-persistence.ts +16 -1
- package/src/resources/extensions/gsd/md-importer.ts +3 -2
- package/src/resources/extensions/gsd/mechanical-completion.ts +430 -0
- package/src/resources/extensions/gsd/migrate/command.ts +3 -2
- package/src/resources/extensions/gsd/migrate/writer.ts +2 -1
- package/src/resources/extensions/gsd/migrate-external.ts +123 -0
- package/src/resources/extensions/gsd/paths.ts +24 -2
- package/src/resources/extensions/gsd/post-unit-hooks.ts +6 -5
- package/src/resources/extensions/gsd/preferences-models.ts +7 -1
- package/src/resources/extensions/gsd/preferences-validation.ts +2 -1
- package/src/resources/extensions/gsd/preferences.ts +10 -5
- package/src/resources/extensions/gsd/prompts/discuss-headless.md +4 -2
- package/src/resources/extensions/gsd/prompts/guided-discuss-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/plan-milestone.md +26 -2
- package/src/resources/extensions/gsd/prompts/plan-slice.md +15 -1
- package/src/resources/extensions/gsd/prompts/workflow-start.md +28 -0
- package/src/resources/extensions/gsd/queue-order.ts +10 -11
- package/src/resources/extensions/gsd/repo-identity.ts +148 -0
- package/src/resources/extensions/gsd/resource-version.ts +99 -0
- package/src/resources/extensions/gsd/roadmap-slices.ts +22 -7
- package/src/resources/extensions/gsd/session-forensics.ts +4 -3
- package/src/resources/extensions/gsd/session-lock.ts +53 -4
- package/src/resources/extensions/gsd/session-status-io.ts +23 -41
- package/src/resources/extensions/gsd/tests/activity-log.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/auto-budget-alerts.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/auto-skip-loop.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/auto-worktree.test.ts +0 -58
- package/src/resources/extensions/gsd/tests/doctor-runtime.test.ts +3 -4
- package/src/resources/extensions/gsd/tests/extension-selector-separator.test.ts +60 -38
- package/src/resources/extensions/gsd/tests/feature-branch-lifecycle-integration.test.ts +5 -18
- package/src/resources/extensions/gsd/tests/git-service.test.ts +10 -37
- package/src/resources/extensions/gsd/tests/knowledge.test.ts +4 -4
- package/src/resources/extensions/gsd/tests/mechanical-completion.test.ts +356 -0
- package/src/resources/extensions/gsd/tests/parallel-workers-multi-milestone-e2e.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/token-profile.test.ts +14 -16
- package/src/resources/extensions/gsd/tests/workflow-templates.test.ts +173 -0
- package/src/resources/extensions/gsd/triage-resolution.ts +2 -1
- package/src/resources/extensions/gsd/types.ts +2 -0
- package/src/resources/extensions/gsd/workflow-templates/bugfix.md +87 -0
- package/src/resources/extensions/gsd/workflow-templates/dep-upgrade.md +74 -0
- package/src/resources/extensions/gsd/workflow-templates/full-project.md +41 -0
- package/src/resources/extensions/gsd/workflow-templates/hotfix.md +45 -0
- package/src/resources/extensions/gsd/workflow-templates/refactor.md +83 -0
- package/src/resources/extensions/gsd/workflow-templates/registry.json +85 -0
- package/src/resources/extensions/gsd/workflow-templates/security-audit.md +73 -0
- package/src/resources/extensions/gsd/workflow-templates/small-feature.md +81 -0
- package/src/resources/extensions/gsd/workflow-templates/spike.md +69 -0
- package/src/resources/extensions/gsd/workflow-templates.ts +241 -0
- package/src/resources/extensions/gsd/worktree-command.ts +1 -11
- package/src/resources/extensions/gsd/worktree-manager.ts +3 -2
- package/src/resources/extensions/gsd/worktree.ts +42 -5
- package/src/resources/extensions/mac-tools/extension-manifest.json +16 -0
- package/src/resources/extensions/mcp-client/index.ts +459 -0
- package/src/resources/extensions/mcporter/extension-manifest.json +12 -0
- package/src/resources/extensions/remote-questions/discord-adapter.ts +8 -19
- package/src/resources/extensions/remote-questions/extension-manifest.json +11 -0
- package/src/resources/extensions/remote-questions/http-client.ts +76 -0
- package/src/resources/extensions/remote-questions/slack-adapter.ts +11 -17
- package/src/resources/extensions/remote-questions/telegram-adapter.ts +8 -19
- package/src/resources/extensions/search-the-web/extension-manifest.json +13 -0
- package/src/resources/extensions/slash-commands/extension-manifest.json +11 -0
- package/src/resources/extensions/subagent/extension-manifest.json +13 -0
- package/src/resources/extensions/ttsr/extension-manifest.json +11 -0
- package/src/resources/extensions/universal-config/extension-manifest.json +13 -0
- package/src/resources/extensions/voice/extension-manifest.json +12 -0
- package/src/resources/skills/create-gsd-extension/SKILL.md +87 -0
- package/src/resources/skills/create-gsd-extension/references/compaction-session-control.md +77 -0
- package/src/resources/skills/create-gsd-extension/references/custom-commands.md +139 -0
- package/src/resources/skills/create-gsd-extension/references/custom-rendering.md +108 -0
- package/src/resources/skills/create-gsd-extension/references/custom-tools.md +183 -0
- package/src/resources/skills/create-gsd-extension/references/custom-ui.md +490 -0
- package/src/resources/skills/create-gsd-extension/references/events-reference.md +126 -0
- package/src/resources/skills/create-gsd-extension/references/extension-lifecycle.md +64 -0
- package/src/resources/skills/create-gsd-extension/references/extensionapi-reference.md +75 -0
- package/src/resources/skills/create-gsd-extension/references/extensioncontext-reference.md +53 -0
- package/src/resources/skills/create-gsd-extension/references/key-rules-gotchas.md +36 -0
- package/src/resources/skills/create-gsd-extension/references/mode-behavior.md +32 -0
- package/src/resources/skills/create-gsd-extension/references/model-provider-management.md +89 -0
- package/src/resources/skills/create-gsd-extension/references/packaging-distribution.md +55 -0
- package/src/resources/skills/create-gsd-extension/references/remote-execution-overrides.md +90 -0
- package/src/resources/skills/create-gsd-extension/references/state-management.md +70 -0
- package/src/resources/skills/create-gsd-extension/references/system-prompt-modification.md +52 -0
- package/src/resources/skills/create-gsd-extension/templates/extension-skeleton.ts +51 -0
- package/src/resources/skills/create-gsd-extension/templates/stateful-tool-skeleton.ts +143 -0
- package/src/resources/skills/create-gsd-extension/workflows/add-capability.md +57 -0
- package/src/resources/skills/create-gsd-extension/workflows/create-extension.md +156 -0
- package/src/resources/skills/create-gsd-extension/workflows/debug-extension.md +74 -0
- package/src/resources/skills/create-skill/SKILL.md +184 -0
- package/src/resources/skills/create-skill/references/api-security.md +226 -0
- package/src/resources/skills/create-skill/references/be-clear-and-direct.md +531 -0
- package/src/resources/skills/create-skill/references/common-patterns.md +595 -0
- package/src/resources/skills/create-skill/references/core-principles.md +437 -0
- package/src/resources/skills/create-skill/references/executable-code.md +175 -0
- package/src/resources/skills/create-skill/references/gsd-skill-ecosystem.md +68 -0
- package/src/resources/skills/create-skill/references/iteration-and-testing.md +474 -0
- package/src/resources/skills/create-skill/references/recommended-structure.md +168 -0
- package/src/resources/skills/create-skill/references/skill-structure.md +372 -0
- package/src/resources/skills/create-skill/references/use-xml-tags.md +466 -0
- package/src/resources/skills/create-skill/references/using-scripts.md +113 -0
- package/src/resources/skills/create-skill/references/using-templates.md +112 -0
- package/src/resources/skills/create-skill/references/workflows-and-validation.md +510 -0
- package/src/resources/skills/create-skill/templates/router-skill.md +73 -0
- package/src/resources/skills/create-skill/templates/simple-skill.md +33 -0
- package/src/resources/skills/create-skill/workflows/add-reference.md +96 -0
- package/src/resources/skills/create-skill/workflows/add-script.md +93 -0
- package/src/resources/skills/create-skill/workflows/add-template.md +74 -0
- package/src/resources/skills/create-skill/workflows/add-workflow.md +120 -0
- package/src/resources/skills/create-skill/workflows/audit-skill.md +148 -0
- package/src/resources/skills/create-skill/workflows/create-new-skill.md +196 -0
- package/src/resources/skills/create-skill/workflows/get-guidance.md +121 -0
- package/src/resources/skills/create-skill/workflows/upgrade-to-router.md +161 -0
- package/src/resources/skills/create-skill/workflows/verify-skill.md +204 -0
- package/src/resources/skills/react-best-practices/SKILL.md +1 -1
- package/dist/resources/extensions/gsd/auto-worktree-sync.ts +0 -198
- package/dist/resources/extensions/gsd/tests/worktree-db-integration.test.ts +0 -205
- package/dist/resources/extensions/gsd/tests/worktree-db.test.ts +0 -442
- package/dist/resources/extensions/mcporter/index.ts +0 -525
- package/src/resources/extensions/gsd/auto-worktree-sync.ts +0 -198
- package/src/resources/extensions/gsd/tests/worktree-db-integration.test.ts +0 -205
- package/src/resources/extensions/gsd/tests/worktree-db.test.ts +0 -442
- package/src/resources/extensions/mcporter/index.ts +0 -525
|
@@ -6,14 +6,17 @@
|
|
|
6
6
|
|
|
7
7
|
import type { ExtensionAPI, ExtensionCommandContext } from "@gsd/pi-coding-agent";
|
|
8
8
|
import type { GSDState } from "./types.js";
|
|
9
|
-
import { existsSync, readFileSync, unlinkSync } from "node:fs";
|
|
9
|
+
import { existsSync, readFileSync, readdirSync, unlinkSync } from "node:fs";
|
|
10
|
+
import { homedir } from "node:os";
|
|
10
11
|
import { join } from "node:path";
|
|
12
|
+
import { gsdRoot } from "./paths.js";
|
|
11
13
|
import { enableDebug } from "./debug-logger.js";
|
|
12
14
|
import { deriveState } from "./state.js";
|
|
13
15
|
import { GSDDashboardOverlay } from "./dashboard-overlay.js";
|
|
14
16
|
import { GSDVisualizerOverlay } from "./visualizer-overlay.js";
|
|
15
17
|
import { showQueue, showDiscuss, showHeadlessMilestoneCreation } from "./guided-flow.js";
|
|
16
|
-
import { startAuto, stopAuto, pauseAuto, isAutoActive, isAutoPaused, isStepMode, stopAutoRemote
|
|
18
|
+
import { startAuto, stopAuto, pauseAuto, isAutoActive, isAutoPaused, isStepMode, stopAutoRemote } from "./auto.js";
|
|
19
|
+
import { dispatchDirectPhase } from "./auto-direct-dispatch.js";
|
|
17
20
|
import { resolveProjectRoot } from "./worktree.js";
|
|
18
21
|
import { assertSafeDirectory } from "./validate-directory.js";
|
|
19
22
|
import {
|
|
@@ -21,8 +24,6 @@ import {
|
|
|
21
24
|
getProjectGSDPreferencesPath,
|
|
22
25
|
loadEffectiveGSDPreferences,
|
|
23
26
|
} from "./preferences.js";
|
|
24
|
-
import { loadPrompt } from "./prompt-loader.js";
|
|
25
|
-
|
|
26
27
|
import { handleRemote } from "../remote-questions/mod.js";
|
|
27
28
|
import { handleQuick } from "./quick.js";
|
|
28
29
|
import { handleHistory } from "./history.js";
|
|
@@ -44,26 +45,9 @@ import { handleInspect } from "./commands-inspect.js";
|
|
|
44
45
|
import { handleCleanupBranches, handleCleanupSnapshots, handleSkip, handleDryRun } from "./commands-maintenance.js";
|
|
45
46
|
import { handleDoctor, handleSteer, handleCapture, handleTriage, handleKnowledge, handleRunHook, handleUpdate, handleSkillHealth } from "./commands-handlers.js";
|
|
46
47
|
import { handleLogs } from "./commands-logs.js";
|
|
48
|
+
import { handleStart, handleTemplates, getTemplateCompletions } from "./commands-workflow-templates.js";
|
|
47
49
|
|
|
48
50
|
|
|
49
|
-
export function dispatchDoctorHeal(pi: ExtensionAPI, scope: string | undefined, reportText: string, structuredIssues: string): void {
|
|
50
|
-
const workflowPath = process.env.GSD_WORKFLOW_PATH ?? join(process.env.HOME ?? "~", ".pi", "GSD-WORKFLOW.md");
|
|
51
|
-
const workflow = readFileSync(workflowPath, "utf-8");
|
|
52
|
-
const prompt = loadPrompt("doctor-heal", {
|
|
53
|
-
doctorSummary: reportText,
|
|
54
|
-
structuredIssues,
|
|
55
|
-
scopeLabel: scope ?? "active milestone / blocking scope",
|
|
56
|
-
doctorCommandSuffix: scope ? ` ${scope}` : "",
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
const content = `Read the following GSD workflow protocol and execute exactly.\n\n${workflow}\n\n## Your Task\n\n${prompt}`;
|
|
60
|
-
|
|
61
|
-
pi.sendMessage(
|
|
62
|
-
{ customType: "gsd-doctor-heal", content, display: false },
|
|
63
|
-
{ triggerTurn: true },
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
51
|
/** Resolve the effective project root, accounting for worktree paths. */
|
|
68
52
|
export function projectRoot(): string {
|
|
69
53
|
const root = resolveProjectRoot(process.cwd());
|
|
@@ -73,7 +57,7 @@ export function projectRoot(): string {
|
|
|
73
57
|
|
|
74
58
|
export function registerGSDCommand(pi: ExtensionAPI): void {
|
|
75
59
|
pi.registerCommand("gsd", {
|
|
76
|
-
description: "GSD — Get Shit Done: /gsd help|next|auto|stop|pause|status|visualize|queue|quick|capture|triage|dispatch|history|undo|skip|export|cleanup|mode|prefs|config|keys|hooks|run-hook|skill-health|doctor|forensics|migrate|remote|steer|knowledge|new-milestone|parallel|update",
|
|
60
|
+
description: "GSD — Get Shit Done: /gsd help|start|templates|next|auto|stop|pause|status|visualize|queue|quick|capture|triage|dispatch|history|undo|skip|export|cleanup|mode|prefs|config|keys|hooks|run-hook|skill-health|doctor|forensics|migrate|remote|steer|knowledge|new-milestone|parallel|update",
|
|
77
61
|
getArgumentCompletions: (prefix: string) => {
|
|
78
62
|
const subcommands = [
|
|
79
63
|
{ cmd: "help", desc: "Categorized command reference with descriptions" },
|
|
@@ -116,6 +100,9 @@ export function registerGSDCommand(pi: ExtensionAPI): void {
|
|
|
116
100
|
{ cmd: "park", desc: "Park a milestone — skip without deleting" },
|
|
117
101
|
{ cmd: "unpark", desc: "Reactivate a parked milestone" },
|
|
118
102
|
{ cmd: "update", desc: "Update GSD to the latest version" },
|
|
103
|
+
{ cmd: "start", desc: "Start a workflow template (bugfix, spike, feature, etc.)" },
|
|
104
|
+
{ cmd: "templates", desc: "List available workflow templates" },
|
|
105
|
+
{ cmd: "extensions", desc: "Manage extensions (list, enable, disable, info)" },
|
|
119
106
|
];
|
|
120
107
|
const parts = prefix.trim().split(/\s+/);
|
|
121
108
|
|
|
@@ -301,6 +288,83 @@ export function registerGSDCommand(pi: ExtensionAPI): void {
|
|
|
301
288
|
.map((s) => ({ value: `knowledge ${s.cmd}`, label: s.cmd, description: s.desc }));
|
|
302
289
|
}
|
|
303
290
|
|
|
291
|
+
if (parts[0] === "start" && parts.length <= 2) {
|
|
292
|
+
const subPrefix = parts[1] ?? "";
|
|
293
|
+
const subs = [
|
|
294
|
+
{ cmd: "bugfix", desc: "Triage, fix, test, and ship a bug fix" },
|
|
295
|
+
{ cmd: "small-feature", desc: "Lightweight feature with optional discussion" },
|
|
296
|
+
{ cmd: "spike", desc: "Research, prototype, and document findings" },
|
|
297
|
+
{ cmd: "hotfix", desc: "Minimal: fix it, test it, ship it" },
|
|
298
|
+
{ cmd: "refactor", desc: "Inventory, plan waves, migrate, verify" },
|
|
299
|
+
{ cmd: "security-audit", desc: "Scan, triage, remediate, re-scan" },
|
|
300
|
+
{ cmd: "dep-upgrade", desc: "Assess, upgrade, fix breaks, verify" },
|
|
301
|
+
{ cmd: "full-project", desc: "Complete GSD workflow with full ceremony" },
|
|
302
|
+
{ cmd: "resume", desc: "Resume an in-progress workflow" },
|
|
303
|
+
{ cmd: "--list", desc: "List all available templates" },
|
|
304
|
+
{ cmd: "--dry-run", desc: "Preview workflow without executing" },
|
|
305
|
+
];
|
|
306
|
+
return subs
|
|
307
|
+
.filter((s) => s.cmd.startsWith(subPrefix))
|
|
308
|
+
.map((s) => ({ value: `start ${s.cmd}`, label: s.cmd, description: s.desc }));
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
if (parts[0] === "templates" && parts.length <= 2) {
|
|
312
|
+
const subPrefix = parts[1] ?? "";
|
|
313
|
+
const subs = [
|
|
314
|
+
{ cmd: "info", desc: "Show detailed template info" },
|
|
315
|
+
];
|
|
316
|
+
return subs
|
|
317
|
+
.filter((s) => s.cmd.startsWith(subPrefix))
|
|
318
|
+
.map((s) => ({ value: `templates ${s.cmd}`, label: s.cmd, description: s.desc }));
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
if (parts[0] === "templates" && parts[1] === "info" && parts.length <= 3) {
|
|
322
|
+
const namePrefix = parts[2] ?? "";
|
|
323
|
+
return getTemplateCompletions(namePrefix)
|
|
324
|
+
.map((c) => ({ value: `templates ${c.value}`, label: c.label, description: c.description }));
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if (parts[0] === "extensions") {
|
|
328
|
+
if (parts.length <= 2) {
|
|
329
|
+
const subPrefix = parts[1] ?? "";
|
|
330
|
+
const subs = [
|
|
331
|
+
{ cmd: "list", desc: "List all extensions and their status" },
|
|
332
|
+
{ cmd: "enable", desc: "Enable a disabled extension" },
|
|
333
|
+
{ cmd: "disable", desc: "Disable an extension" },
|
|
334
|
+
{ cmd: "info", desc: "Show extension details" },
|
|
335
|
+
];
|
|
336
|
+
return subs
|
|
337
|
+
.filter((s) => s.cmd.startsWith(subPrefix))
|
|
338
|
+
.map((s) => ({ value: `extensions ${s.cmd}`, label: s.cmd, description: s.desc }));
|
|
339
|
+
}
|
|
340
|
+
if (parts.length === 3 && ["enable", "disable", "info"].includes(parts[1])) {
|
|
341
|
+
const idPrefix = parts[2] ?? "";
|
|
342
|
+
try {
|
|
343
|
+
const extDir = join(homedir(), ".gsd", "agent", "extensions");
|
|
344
|
+
const ids: { id: string; name: string }[] = [];
|
|
345
|
+
for (const entry of readdirSync(extDir, { withFileTypes: true })) {
|
|
346
|
+
if (!entry.isDirectory()) continue;
|
|
347
|
+
const mPath = join(extDir, entry.name, "extension-manifest.json");
|
|
348
|
+
if (!existsSync(mPath)) continue;
|
|
349
|
+
try {
|
|
350
|
+
const m = JSON.parse(readFileSync(mPath, "utf-8"));
|
|
351
|
+
if (typeof m?.id === "string") ids.push({ id: m.id, name: m.name ?? m.id });
|
|
352
|
+
} catch { /* skip malformed */ }
|
|
353
|
+
}
|
|
354
|
+
return ids
|
|
355
|
+
.filter((e) => e.id.startsWith(idPrefix))
|
|
356
|
+
.map((e) => ({
|
|
357
|
+
value: `extensions ${parts[1]} ${e.id}`,
|
|
358
|
+
label: e.id,
|
|
359
|
+
description: e.name,
|
|
360
|
+
}));
|
|
361
|
+
} catch {
|
|
362
|
+
return [];
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return [];
|
|
366
|
+
}
|
|
367
|
+
|
|
304
368
|
if (parts[0] === "doctor") {
|
|
305
369
|
const modePrefix = parts[1] ?? "";
|
|
306
370
|
const modes = [
|
|
@@ -678,7 +742,7 @@ export function registerGSDCommand(pi: ExtensionAPI): void {
|
|
|
678
742
|
|
|
679
743
|
if (trimmed === "new-milestone") {
|
|
680
744
|
const basePath = projectRoot();
|
|
681
|
-
const headlessContextPath = join(basePath, "
|
|
745
|
+
const headlessContextPath = join(gsdRoot(basePath), "runtime", "headless-context.md");
|
|
682
746
|
if (existsSync(headlessContextPath)) {
|
|
683
747
|
const seedContext = readFileSync(headlessContextPath, "utf-8");
|
|
684
748
|
try { unlinkSync(headlessContextPath); } catch { /* non-fatal */ }
|
|
@@ -792,12 +856,29 @@ Examples:
|
|
|
792
856
|
return;
|
|
793
857
|
}
|
|
794
858
|
|
|
859
|
+
// ─── Workflow Templates ────────────────────────────────────────
|
|
860
|
+
if (trimmed === "start" || trimmed.startsWith("start ")) {
|
|
861
|
+
await handleStart(trimmed.replace(/^start\s*/, "").trim(), ctx, pi);
|
|
862
|
+
return;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
if (trimmed === "templates" || trimmed.startsWith("templates ")) {
|
|
866
|
+
await handleTemplates(trimmed.replace(/^templates\s*/, "").trim(), ctx);
|
|
867
|
+
return;
|
|
868
|
+
}
|
|
869
|
+
|
|
795
870
|
if (trimmed === "") {
|
|
796
871
|
// Bare /gsd defaults to step mode
|
|
797
872
|
await startAuto(ctx, pi, projectRoot(), false, { step: true });
|
|
798
873
|
return;
|
|
799
874
|
}
|
|
800
875
|
|
|
876
|
+
if (trimmed === "extensions" || trimmed.startsWith("extensions ")) {
|
|
877
|
+
const { handleExtensions } = await import("./commands-extensions.js");
|
|
878
|
+
await handleExtensions(trimmed.replace(/^extensions\s*/, "").trim(), ctx);
|
|
879
|
+
return;
|
|
880
|
+
}
|
|
881
|
+
|
|
801
882
|
ctx.ui.notify(
|
|
802
883
|
`Unknown: /gsd ${trimmed}. Run /gsd help for available commands.`,
|
|
803
884
|
"warning",
|
|
@@ -810,6 +891,8 @@ function showHelp(ctx: ExtensionCommandContext): void {
|
|
|
810
891
|
const lines = [
|
|
811
892
|
"GSD — Get Shit Done\n",
|
|
812
893
|
"WORKFLOW",
|
|
894
|
+
" /gsd start <tpl> Start a workflow template (bugfix, spike, feature, hotfix, etc.)",
|
|
895
|
+
" /gsd templates List available workflow templates [info <name>]",
|
|
813
896
|
" /gsd Run next unit in step mode (same as /gsd next)",
|
|
814
897
|
" /gsd next Execute next task, then pause [--dry-run] [--verbose]",
|
|
815
898
|
" /gsd auto Run all queued units continuously [--verbose]",
|
|
@@ -844,6 +927,7 @@ function showHelp(ctx: ExtensionCommandContext): void {
|
|
|
844
927
|
" /gsd config Set API keys for external tools",
|
|
845
928
|
" /gsd keys API key manager [list|add|remove|test|rotate|doctor]",
|
|
846
929
|
" /gsd hooks Show post-unit hook configuration",
|
|
930
|
+
" /gsd extensions Manage extensions [list|enable|disable|info]",
|
|
847
931
|
"",
|
|
848
932
|
"MAINTENANCE",
|
|
849
933
|
" /gsd doctor Diagnose and repair .gsd/ state [audit|fix|heal] [scope]",
|
|
@@ -11,7 +11,8 @@ import { truncateToWidth, visibleWidth, matchesKey, Key } from "@gsd/pi-tui";
|
|
|
11
11
|
import { deriveState } from "./state.js";
|
|
12
12
|
import { loadFile, parseRoadmap, parsePlan } from "./files.js";
|
|
13
13
|
import { resolveMilestoneFile, resolveSliceFile } from "./paths.js";
|
|
14
|
-
import { getAutoDashboardData
|
|
14
|
+
import { getAutoDashboardData } from "./auto.js";
|
|
15
|
+
import type { AutoDashboardData } from "./auto-dashboard.js";
|
|
15
16
|
import {
|
|
16
17
|
getLedger, getProjectTotals, aggregateByPhase, aggregateBySlice,
|
|
17
18
|
aggregateByModel, aggregateCacheHitRate, formatCost, formatTokenCount, formatCostProjection,
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
10
10
|
import { join } from "node:path";
|
|
11
11
|
import { homedir } from "node:os";
|
|
12
|
+
import { gsdRoot } from "./paths.js";
|
|
12
13
|
|
|
13
14
|
// ─── Types ──────────────────────────────────────────────────────────────────────
|
|
14
15
|
|
|
@@ -214,7 +215,7 @@ export function detectV1Planning(basePath: string): V1Detection | null {
|
|
|
214
215
|
// ─── V2 GSD Detection ──────────────────────────────────────────────────────────
|
|
215
216
|
|
|
216
217
|
function detectV2Gsd(basePath: string): V2Detection | null {
|
|
217
|
-
const gsdPath =
|
|
218
|
+
const gsdPath = gsdRoot(basePath);
|
|
218
219
|
|
|
219
220
|
if (!existsSync(gsdPath)) return null;
|
|
220
221
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
1
|
+
import { existsSync, lstatSync, readdirSync, readFileSync, realpathSync, statSync } from "node:fs";
|
|
2
2
|
import { join, sep } from "node:path";
|
|
3
3
|
|
|
4
4
|
import type { DoctorIssue, DoctorIssueCode } from "./doctor-types.js";
|
|
@@ -13,6 +13,7 @@ import { nativeIsRepo, nativeWorktreeRemove, nativeBranchList, nativeBranchDelet
|
|
|
13
13
|
import { readCrashLock, isLockProcessAlive, clearLock } from "./crash-recovery.js";
|
|
14
14
|
import { ensureGitignore } from "./gitignore.js";
|
|
15
15
|
import { readAllSessionStatuses, isSessionStale, removeSessionStatus } from "./session-status-io.js";
|
|
16
|
+
import { recoverFailedMigration } from "./migrate-external.js";
|
|
16
17
|
|
|
17
18
|
export async function checkGitHealth(
|
|
18
19
|
basePath: string,
|
|
@@ -508,6 +509,53 @@ export async function checkRuntimeHealth(
|
|
|
508
509
|
} catch {
|
|
509
510
|
// Non-fatal — gitignore check failed
|
|
510
511
|
}
|
|
512
|
+
|
|
513
|
+
// ── External state symlink health ──────────────────────────────────────
|
|
514
|
+
try {
|
|
515
|
+
const localGsd = join(basePath, ".gsd");
|
|
516
|
+
if (existsSync(localGsd)) {
|
|
517
|
+
const stat = lstatSync(localGsd);
|
|
518
|
+
|
|
519
|
+
// Check for .gsd.migrating (failed migration)
|
|
520
|
+
const migratingPath = join(basePath, ".gsd.migrating");
|
|
521
|
+
if (existsSync(migratingPath)) {
|
|
522
|
+
issues.push({
|
|
523
|
+
severity: "error",
|
|
524
|
+
code: "failed_migration",
|
|
525
|
+
scope: "project",
|
|
526
|
+
unitId: "project",
|
|
527
|
+
message: "Found .gsd.migrating — a previous external state migration failed. State may be incomplete.",
|
|
528
|
+
file: ".gsd.migrating",
|
|
529
|
+
fixable: true,
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
if (shouldFix("failed_migration")) {
|
|
533
|
+
if (recoverFailedMigration(basePath)) {
|
|
534
|
+
fixesApplied.push("recovered failed migration (.gsd.migrating → .gsd)");
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// Check symlink target exists
|
|
540
|
+
if (stat.isSymbolicLink()) {
|
|
541
|
+
try {
|
|
542
|
+
realpathSync(localGsd);
|
|
543
|
+
} catch {
|
|
544
|
+
issues.push({
|
|
545
|
+
severity: "error",
|
|
546
|
+
code: "broken_symlink",
|
|
547
|
+
scope: "project",
|
|
548
|
+
unitId: "project",
|
|
549
|
+
message: ".gsd symlink target does not exist. External state directory may have been deleted.",
|
|
550
|
+
file: ".gsd",
|
|
551
|
+
fixable: false,
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
} catch {
|
|
557
|
+
// Non-fatal — external state check failed
|
|
558
|
+
}
|
|
511
559
|
}
|
|
512
560
|
|
|
513
561
|
/**
|
|
@@ -30,7 +30,9 @@ export type DoctorIssueCode =
|
|
|
30
30
|
| "state_file_stale"
|
|
31
31
|
| "state_file_missing"
|
|
32
32
|
| "gitignore_missing_patterns"
|
|
33
|
-
| "unresolvable_dependency"
|
|
33
|
+
| "unresolvable_dependency"
|
|
34
|
+
| "failed_migration"
|
|
35
|
+
| "broken_symlink";
|
|
34
36
|
|
|
35
37
|
/**
|
|
36
38
|
* Issue codes that represent expected completion-transition states.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "gsd",
|
|
3
|
+
"name": "GSD Workflow",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "Core GSD workflow engine — milestone planning, execution, and tracking",
|
|
6
|
+
"tier": "core",
|
|
7
|
+
"requires": { "platform": ">=2.29.0" },
|
|
8
|
+
"provides": {
|
|
9
|
+
"tools": [
|
|
10
|
+
"bash", "write", "read", "edit",
|
|
11
|
+
"gsd_save_decision", "gsd_save_summary",
|
|
12
|
+
"gsd_update_requirement", "gsd_generate_milestone_id"
|
|
13
|
+
],
|
|
14
|
+
"commands": ["gsd", "kill", "worktree", "exit"],
|
|
15
|
+
"hooks": ["session_start"],
|
|
16
|
+
"shortcuts": ["Ctrl+Alt+G"]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -268,7 +268,7 @@ function resolveActivityDirs(basePath: string, activeMilestone?: string | null):
|
|
|
268
268
|
if (activeMilestone) {
|
|
269
269
|
const wtPath = getAutoWorktreePath(basePath, activeMilestone);
|
|
270
270
|
if (wtPath) {
|
|
271
|
-
const wtActivityDir = join(wtPath, "
|
|
271
|
+
const wtActivityDir = join(gsdRoot(wtPath), "activity");
|
|
272
272
|
if (existsSync(wtActivityDir)) {
|
|
273
273
|
dirs.push(wtActivityDir);
|
|
274
274
|
}
|
|
@@ -285,7 +285,7 @@ function resolveActivityDirs(basePath: string, activeMilestone?: string | null):
|
|
|
285
285
|
// ─── Completed Keys Loader ────────────────────────────────────────────────────
|
|
286
286
|
|
|
287
287
|
function loadCompletedKeys(basePath: string): string[] {
|
|
288
|
-
const file = join(basePath, "
|
|
288
|
+
const file = join(gsdRoot(basePath), "completed-units.json");
|
|
289
289
|
try {
|
|
290
290
|
if (existsSync(file)) {
|
|
291
291
|
return JSON.parse(readFileSync(file, "utf-8"));
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import { execFileSync, execSync } from "node:child_process";
|
|
12
12
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
13
13
|
import { join } from "node:path";
|
|
14
|
+
import { gsdRoot } from "./paths.js";
|
|
14
15
|
import { GIT_NO_PROMPT_ENV } from "./git-constants.js";
|
|
15
16
|
|
|
16
17
|
import {
|
|
@@ -193,7 +194,7 @@ export const RUNTIME_EXCLUSION_PATHS: readonly string[] = [
|
|
|
193
194
|
* Format: .gsd/milestones/<MID>/<MID>-META.json
|
|
194
195
|
*/
|
|
195
196
|
function milestoneMetaPath(basePath: string, milestoneId: string): string {
|
|
196
|
-
return join(basePath, "
|
|
197
|
+
return join(gsdRoot(basePath), "milestones", milestoneId, `${milestoneId}-META.json`);
|
|
197
198
|
}
|
|
198
199
|
|
|
199
200
|
/**
|
|
@@ -237,7 +238,7 @@ export function writeIntegrationBranch(basePath: string, milestoneId: string, br
|
|
|
237
238
|
if (existingBranch === branch) return;
|
|
238
239
|
|
|
239
240
|
const metaFile = milestoneMetaPath(basePath, milestoneId);
|
|
240
|
-
mkdirSync(join(basePath, "
|
|
241
|
+
mkdirSync(join(gsdRoot(basePath), "milestones", milestoneId), { recursive: true });
|
|
241
242
|
|
|
242
243
|
// Merge with existing metadata if present
|
|
243
244
|
let existing: Record<string, unknown> = {};
|
|
@@ -9,10 +9,12 @@
|
|
|
9
9
|
import { join } from "node:path";
|
|
10
10
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
11
11
|
import { nativeRmCached } from "./native-git-bridge.js";
|
|
12
|
+
import { gsdRoot } from "./paths.js";
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
15
|
+
* GSD runtime patterns for git index cleanup.
|
|
16
|
+
* With external state (symlink), these are a no-op in most cases,
|
|
17
|
+
* but retained for backwards compatibility during migration.
|
|
16
18
|
*/
|
|
17
19
|
const GSD_RUNTIME_PATTERNS = [
|
|
18
20
|
".gsd/activity/",
|
|
@@ -31,8 +33,8 @@ const GSD_RUNTIME_PATTERNS = [
|
|
|
31
33
|
] as const;
|
|
32
34
|
|
|
33
35
|
const BASELINE_PATTERNS = [
|
|
34
|
-
// ── GSD
|
|
35
|
-
|
|
36
|
+
// ── GSD state directory (symlink to external storage) ──
|
|
37
|
+
".gsd",
|
|
36
38
|
|
|
37
39
|
// ── OS junk ──
|
|
38
40
|
".DS_Store",
|
|
@@ -90,41 +92,12 @@ export function ensureGitignore(basePath: string, options?: { commitDocs?: boole
|
|
|
90
92
|
if (options?.manageGitignore === false) return false;
|
|
91
93
|
|
|
92
94
|
const gitignorePath = join(basePath, ".gitignore");
|
|
93
|
-
const commitDocs = options?.commitDocs !== false; // default true
|
|
94
95
|
|
|
95
96
|
let existing = "";
|
|
96
97
|
if (existsSync(gitignorePath)) {
|
|
97
98
|
existing = readFileSync(gitignorePath, "utf-8");
|
|
98
99
|
}
|
|
99
100
|
|
|
100
|
-
// When commit_docs is false, ensure blanket ".gsd/" is in .gitignore
|
|
101
|
-
// and skip the self-heal that would remove it.
|
|
102
|
-
if (!commitDocs) {
|
|
103
|
-
return ensureBlanketGsdIgnore(gitignorePath, existing);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Self-heal: remove blanket ".gsd/" lines from pre-v2.14.0 projects.
|
|
107
|
-
// The blanket ignore prevented planning artifacts (.gsd/milestones/) from
|
|
108
|
-
// being tracked in git, causing artifacts to vanish in worktrees and
|
|
109
|
-
// triggering loop detection failures. Replace with explicit runtime-only
|
|
110
|
-
// ignores so planning files are tracked naturally.
|
|
111
|
-
let modified = false;
|
|
112
|
-
const lines = existing.split("\n");
|
|
113
|
-
const filteredLines = lines.filter(line => {
|
|
114
|
-
const trimmed = line.trim();
|
|
115
|
-
// Remove standalone ".gsd/" lines (blanket ignore) but keep specific
|
|
116
|
-
// .gsd/ subpath patterns like ".gsd/activity/" or ".gsd/auto.lock"
|
|
117
|
-
if (trimmed === ".gsd/" || trimmed === ".gsd") {
|
|
118
|
-
modified = true;
|
|
119
|
-
return false;
|
|
120
|
-
}
|
|
121
|
-
return true;
|
|
122
|
-
});
|
|
123
|
-
if (modified) {
|
|
124
|
-
existing = filteredLines.join("\n");
|
|
125
|
-
writeFileSync(gitignorePath, existing, "utf-8");
|
|
126
|
-
}
|
|
127
|
-
|
|
128
101
|
// Parse existing lines (trimmed, ignoring comments and blanks)
|
|
129
102
|
const existingLines = new Set(
|
|
130
103
|
existing
|
|
@@ -136,7 +109,7 @@ export function ensureGitignore(basePath: string, options?: { commitDocs?: boole
|
|
|
136
109
|
// Find patterns not yet present
|
|
137
110
|
const missing = BASELINE_PATTERNS.filter((p) => !existingLines.has(p));
|
|
138
111
|
|
|
139
|
-
if (missing.length === 0) return
|
|
112
|
+
if (missing.length === 0) return false;
|
|
140
113
|
|
|
141
114
|
// Build the block to append
|
|
142
115
|
const block = [
|
|
@@ -184,8 +157,8 @@ export function untrackRuntimeFiles(basePath: string): void {
|
|
|
184
157
|
* creating a duplicate when an uppercase file already exists.
|
|
185
158
|
*/
|
|
186
159
|
export function ensurePreferences(basePath: string): boolean {
|
|
187
|
-
const preferencesPath = join(basePath, "
|
|
188
|
-
const legacyPath = join(basePath, "
|
|
160
|
+
const preferencesPath = join(gsdRoot(basePath), "preferences.md");
|
|
161
|
+
const legacyPath = join(gsdRoot(basePath), "PREFERENCES.md");
|
|
189
162
|
|
|
190
163
|
if (existsSync(preferencesPath) || existsSync(legacyPath)) {
|
|
191
164
|
return false;
|
|
@@ -240,31 +213,4 @@ custom_instructions:
|
|
|
240
213
|
return true;
|
|
241
214
|
}
|
|
242
215
|
|
|
243
|
-
/**
|
|
244
|
-
* When commit_docs is false, ensure `.gsd/` is in .gitignore as a blanket
|
|
245
|
-
* pattern. This keeps all GSD artifacts local-only.
|
|
246
|
-
* Returns true if the file was modified, false if already complete.
|
|
247
|
-
*/
|
|
248
|
-
function ensureBlanketGsdIgnore(gitignorePath: string, existing: string): boolean {
|
|
249
|
-
const existingLines = new Set(
|
|
250
|
-
existing
|
|
251
|
-
.split("\n")
|
|
252
|
-
.map((l) => l.trim())
|
|
253
|
-
.filter((l) => l && !l.startsWith("#")),
|
|
254
|
-
);
|
|
255
|
-
|
|
256
|
-
// Already has blanket .gsd/ ignore
|
|
257
|
-
if (existingLines.has(".gsd/") || existingLines.has(".gsd")) return false;
|
|
258
|
-
|
|
259
|
-
const block = [
|
|
260
|
-
"",
|
|
261
|
-
"# ── GSD (local-only, commit_docs: false) ──",
|
|
262
|
-
".gsd/",
|
|
263
|
-
"",
|
|
264
|
-
].join("\n");
|
|
265
|
-
|
|
266
|
-
const prefix = existing && !existing.endsWith("\n") ? "\n" : "";
|
|
267
|
-
writeFileSync(gitignorePath, existing + prefix + block, "utf-8");
|
|
268
|
-
return true;
|
|
269
|
-
}
|
|
270
216
|
|