gsd-pi 2.29.0 → 2.30.0-dev.54ac83b
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/aws-auth/index.ts +144 -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 +25 -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 +11 -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/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +14 -0
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +17 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.js +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +7 -0
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.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/agent-session.ts +14 -0
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +18 -0
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +1 -0
- package/packages/pi-coding-agent/src/core/extensions/types.ts +8 -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/aws-auth/index.ts +144 -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 +25 -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 +11 -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
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AWS Auth Refresh Extension
|
|
3
|
+
*
|
|
4
|
+
* Automatically refreshes AWS credentials when Bedrock API requests fail
|
|
5
|
+
* with authentication/token errors, then retries the user's message.
|
|
6
|
+
*
|
|
7
|
+
* ## How it works
|
|
8
|
+
*
|
|
9
|
+
* Hooks into `agent_end` to check if the last assistant message failed with
|
|
10
|
+
* an AWS auth error (expired SSO token, missing credentials, etc.). If so:
|
|
11
|
+
*
|
|
12
|
+
* 1. Runs the configured `awsAuthRefresh` command (e.g. `aws sso login`)
|
|
13
|
+
* 2. Streams the SSO auth URL and verification code to the TUI so users
|
|
14
|
+
* can copy/paste if the browser doesn't auto-open
|
|
15
|
+
* 3. Calls `retryLastTurn()` which removes the failed assistant response
|
|
16
|
+
* and re-runs the agent from the user's original message
|
|
17
|
+
*
|
|
18
|
+
* ## Activation
|
|
19
|
+
*
|
|
20
|
+
* This extension is completely inert unless BOTH conditions are met:
|
|
21
|
+
* 1. A Bedrock API request fails with a recognized AWS auth error
|
|
22
|
+
* 2. `awsAuthRefresh` is configured in settings.json
|
|
23
|
+
*
|
|
24
|
+
* Non-Bedrock users and Bedrock users without `awsAuthRefresh` configured
|
|
25
|
+
* are not affected in any way.
|
|
26
|
+
*
|
|
27
|
+
* ## Setup
|
|
28
|
+
*
|
|
29
|
+
* Add to ~/.gsd/agent/settings.json (or project-level .gsd/settings.json):
|
|
30
|
+
*
|
|
31
|
+
* { "awsAuthRefresh": "aws sso login --profile my-profile" }
|
|
32
|
+
*
|
|
33
|
+
* ## Matched error patterns
|
|
34
|
+
*
|
|
35
|
+
* The extension recognizes errors from the AWS SDK, Bedrock, and SSO
|
|
36
|
+
* credential providers including:
|
|
37
|
+
* - ExpiredTokenException / ExpiredToken
|
|
38
|
+
* - The security token included in the request is expired
|
|
39
|
+
* - The SSO session associated with this profile has expired or is invalid
|
|
40
|
+
* - Unable to locate credentials / Could not load credentials
|
|
41
|
+
* - UnrecognizedClientException
|
|
42
|
+
* - Error loading SSO Token / Token does not exist
|
|
43
|
+
* - SSOTokenProviderFailure
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
import { exec } from "node:child_process";
|
|
47
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
48
|
+
import { join } from "node:path";
|
|
49
|
+
import { homedir } from "node:os";
|
|
50
|
+
import type { ExtensionAPI } from "@gsd/pi-coding-agent";
|
|
51
|
+
|
|
52
|
+
/** Matches AWS SDK / Bedrock / SSO credential and token errors. */
|
|
53
|
+
const AWS_AUTH_ERROR_RE =
|
|
54
|
+
/ExpiredToken|security token.*expired|unable to locate credentials|SSO.*(?:session|token).*(?:expired|not found|invalid)|UnrecognizedClient|Could not load credentials|Invalid identity token|token is expired|credentials.*(?:could not|cannot|failed to).*(?:load|resolve|find)|The.*token.*is.*not.*valid|token has expired|SSOTokenProviderFailure|Error loading SSO Token|Token.*does not exist/i;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Reads the `awsAuthRefresh` command from settings.json.
|
|
58
|
+
* Checks project-level first, then global (~/.gsd/agent/settings.json).
|
|
59
|
+
*/
|
|
60
|
+
function getAwsAuthRefreshCommand(): string | undefined {
|
|
61
|
+
const configDir = process.env.PI_CONFIG_DIR || ".gsd";
|
|
62
|
+
const paths = [
|
|
63
|
+
join(process.cwd(), configDir, "settings.json"),
|
|
64
|
+
join(homedir(), configDir, "agent", "settings.json"),
|
|
65
|
+
];
|
|
66
|
+
for (const settingsPath of paths) {
|
|
67
|
+
if (!existsSync(settingsPath)) continue;
|
|
68
|
+
try {
|
|
69
|
+
const settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
|
|
70
|
+
if (settings.awsAuthRefresh) return settings.awsAuthRefresh;
|
|
71
|
+
} catch {}
|
|
72
|
+
}
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Runs the refresh command with a 2-minute timeout (for SSO browser flows).
|
|
78
|
+
* Streams stdout/stderr to capture and display the SSO auth URL and
|
|
79
|
+
* verification code in real-time via TUI notifications.
|
|
80
|
+
*/
|
|
81
|
+
async function runRefresh(
|
|
82
|
+
command: string,
|
|
83
|
+
notify: (msg: string, level: "info" | "warning" | "error") => void,
|
|
84
|
+
): Promise<boolean> {
|
|
85
|
+
notify("Refreshing AWS credentials...", "info");
|
|
86
|
+
try {
|
|
87
|
+
await new Promise<void>((resolve, reject) => {
|
|
88
|
+
const child = exec(command, { timeout: 120_000, env: { ...process.env } });
|
|
89
|
+
const onData = (data: Buffer | string) => {
|
|
90
|
+
const text = data.toString();
|
|
91
|
+
const urlMatch = text.match(/https?:\/\/\S+/);
|
|
92
|
+
if (urlMatch) {
|
|
93
|
+
notify(`Open this URL if the browser didn't launch: ${urlMatch[0]}`, "warning");
|
|
94
|
+
}
|
|
95
|
+
const codeMatch = text.match(/code[:\s]+([A-Z]{4}-[A-Z]{4})/i);
|
|
96
|
+
if (codeMatch) {
|
|
97
|
+
notify(`Verification code: ${codeMatch[1]}`, "info");
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
child.stdout?.on("data", onData);
|
|
101
|
+
child.stderr?.on("data", onData);
|
|
102
|
+
child.on("close", (code) => {
|
|
103
|
+
if (code === 0) resolve();
|
|
104
|
+
else reject(new Error(`Refresh command exited with code ${code}`));
|
|
105
|
+
});
|
|
106
|
+
child.on("error", reject);
|
|
107
|
+
});
|
|
108
|
+
notify("AWS credentials refreshed successfully ✓", "info");
|
|
109
|
+
return true;
|
|
110
|
+
} catch (error) {
|
|
111
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
112
|
+
const isTimeout = /timed out|ETIMEDOUT|killed/i.test(msg);
|
|
113
|
+
if (isTimeout) {
|
|
114
|
+
notify("AWS credential refresh timed out. The SSO login may have been cancelled or the browser window was closed.", "error");
|
|
115
|
+
} else {
|
|
116
|
+
notify(`AWS credential refresh failed: ${msg}`, "error");
|
|
117
|
+
}
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export default function (pi: ExtensionAPI) {
|
|
123
|
+
pi.on("agent_end", async (event, ctx) => {
|
|
124
|
+
const refreshCommand = getAwsAuthRefreshCommand();
|
|
125
|
+
if (!refreshCommand) return;
|
|
126
|
+
|
|
127
|
+
const messages = event.messages;
|
|
128
|
+
const lastAssistant = messages[messages.length - 1];
|
|
129
|
+
if (
|
|
130
|
+
!lastAssistant ||
|
|
131
|
+
lastAssistant.role !== "assistant" ||
|
|
132
|
+
!("errorMessage" in lastAssistant) ||
|
|
133
|
+
!lastAssistant.errorMessage ||
|
|
134
|
+
!AWS_AUTH_ERROR_RE.test(lastAssistant.errorMessage)
|
|
135
|
+
) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const refreshed = await runRefresh(refreshCommand, (m, level) => ctx.ui.notify(m, level));
|
|
140
|
+
if (!refreshed) return;
|
|
141
|
+
|
|
142
|
+
pi.retryLastTurn();
|
|
143
|
+
});
|
|
144
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "bg-shell",
|
|
3
|
+
"name": "Background Shell",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "Run and manage background shell processes with interactive monitoring",
|
|
6
|
+
"tier": "bundled",
|
|
7
|
+
"requires": { "platform": ">=2.29.0" },
|
|
8
|
+
"provides": {
|
|
9
|
+
"tools": ["bg_shell"],
|
|
10
|
+
"commands": ["bg"],
|
|
11
|
+
"hooks": ["session_shutdown"],
|
|
12
|
+
"shortcuts": ["Ctrl+Alt+B"]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -375,6 +375,19 @@ export function cleanupAll(): void {
|
|
|
375
375
|
processes.clear();
|
|
376
376
|
}
|
|
377
377
|
|
|
378
|
+
/**
|
|
379
|
+
* Kill all alive, non-persistent bg processes.
|
|
380
|
+
* Called between auto-mode units to prevent orphaned servers from
|
|
381
|
+
* keeping ports bound across task boundaries (#1209).
|
|
382
|
+
*/
|
|
383
|
+
export function killSessionProcesses(): void {
|
|
384
|
+
for (const [id, bg] of processes) {
|
|
385
|
+
if (bg.alive && !bg.persistAcrossSessions) {
|
|
386
|
+
killProcess(id, "SIGTERM");
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
378
391
|
async function waitForProcessExit(bg: BgProcess, timeoutMs: number): Promise<boolean> {
|
|
379
392
|
if (!bg.alive) return true;
|
|
380
393
|
await new Promise<void>((resolve) => {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "browser-tools",
|
|
3
|
+
"name": "Browser Tools",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "Playwright-based web automation, screenshots, and analysis",
|
|
6
|
+
"tier": "bundled",
|
|
7
|
+
"requires": { "platform": ">=2.29.0" },
|
|
8
|
+
"provides": {
|
|
9
|
+
"tools": [
|
|
10
|
+
"browser_navigate", "browser_go_back", "browser_go_forward", "browser_reload",
|
|
11
|
+
"browser_click", "browser_drag", "browser_type", "browser_upload_file",
|
|
12
|
+
"browser_scroll", "browser_hover", "browser_key_press", "browser_select_option",
|
|
13
|
+
"browser_set_checked", "browser_screenshot", "browser_wait_for",
|
|
14
|
+
"browser_get_console_logs", "browser_get_network_logs", "browser_get_dialog_logs",
|
|
15
|
+
"browser_evaluate", "browser_get_accessibility_tree", "browser_find",
|
|
16
|
+
"browser_get_page_source", "browser_close",
|
|
17
|
+
"browser_trace_start", "browser_trace_stop", "browser_export_har",
|
|
18
|
+
"browser_timeline", "browser_session_summary", "browser_debug_bundle",
|
|
19
|
+
"browser_assert", "browser_diff", "browser_batch",
|
|
20
|
+
"browser_snapshot_refs", "browser_get_ref", "browser_click_ref",
|
|
21
|
+
"browser_hover_ref", "browser_fill_ref",
|
|
22
|
+
"browser_list_pages", "browser_switch_page", "browser_close_page",
|
|
23
|
+
"browser_list_frames", "browser_select_frame",
|
|
24
|
+
"browser_analyze_form", "browser_fill_form",
|
|
25
|
+
"browser_find_best", "browser_act",
|
|
26
|
+
"browser_save_pdf", "browser_save_state", "browser_restore_state",
|
|
27
|
+
"browser_mock_route", "browser_block_urls", "browser_clear_routes",
|
|
28
|
+
"browser_emulate_device", "browser_extract",
|
|
29
|
+
"browser_visual_diff", "browser_zoom_region",
|
|
30
|
+
"browser_generate_test", "browser_action_cache", "browser_check_injection"
|
|
31
|
+
],
|
|
32
|
+
"hooks": ["session_shutdown"]
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"runtime": ["playwright"]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "context7",
|
|
3
|
+
"name": "Context7",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "Fetch up-to-date library documentation and code examples from Context7",
|
|
6
|
+
"tier": "bundled",
|
|
7
|
+
"requires": { "platform": ">=2.29.0" },
|
|
8
|
+
"provides": {
|
|
9
|
+
"tools": ["resolve_library", "get_library_docs"],
|
|
10
|
+
"hooks": ["session_start"]
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "google-search",
|
|
3
|
+
"name": "Google Search",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "Web search via Google with AI-synthesized answers and source citations",
|
|
6
|
+
"tier": "bundled",
|
|
7
|
+
"requires": { "platform": ">=2.29.0" },
|
|
8
|
+
"provides": {
|
|
9
|
+
"tools": ["google_search"],
|
|
10
|
+
"hooks": ["session_start"]
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -11,6 +11,7 @@ import type { GSDState } from "./types.js";
|
|
|
11
11
|
import { getCurrentBranch } from "./worktree.js";
|
|
12
12
|
import { getActiveHook } from "./post-unit-hooks.js";
|
|
13
13
|
import { getLedger, getProjectTotals, formatCost, formatTokenCount, formatTierSavings } from "./metrics.js";
|
|
14
|
+
import { getHealthTrend, getConsecutiveErrorUnits } from "./doctor-proactive.js";
|
|
14
15
|
import {
|
|
15
16
|
resolveMilestoneFile,
|
|
16
17
|
resolveSliceFile,
|
|
@@ -535,6 +536,31 @@ export function updateProgressWidget(
|
|
|
535
536
|
* Build a compact string-array representation of the progress widget.
|
|
536
537
|
* Used as a fallback when the factory-based widget cannot render (RPC mode).
|
|
537
538
|
*/
|
|
539
|
+
// ─── Model Health Indicator ───────────────────────────────────────────────────
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Compute a traffic-light health indicator from observable signals.
|
|
543
|
+
* 🟢 progressing well — no errors, trend stable/improving
|
|
544
|
+
* 🟡 struggling — some errors or degrading trend
|
|
545
|
+
* 🔴 stuck — consecutive errors, likely needs attention
|
|
546
|
+
*/
|
|
547
|
+
export function getModelHealthIndicator(): { emoji: string; label: string } {
|
|
548
|
+
const trend = getHealthTrend();
|
|
549
|
+
const consecutiveErrors = getConsecutiveErrorUnits();
|
|
550
|
+
|
|
551
|
+
if (consecutiveErrors >= 3) {
|
|
552
|
+
return { emoji: "🔴", label: "stuck" };
|
|
553
|
+
}
|
|
554
|
+
if (consecutiveErrors >= 1 || trend === "degrading") {
|
|
555
|
+
return { emoji: "🟡", label: "struggling" };
|
|
556
|
+
}
|
|
557
|
+
if (trend === "improving") {
|
|
558
|
+
return { emoji: "🟢", label: "progressing well" };
|
|
559
|
+
}
|
|
560
|
+
// stable or unknown
|
|
561
|
+
return { emoji: "🟢", label: "progressing" };
|
|
562
|
+
}
|
|
563
|
+
|
|
538
564
|
function buildProgressTextLines(
|
|
539
565
|
verb: string,
|
|
540
566
|
phaseLabel: string,
|
|
@@ -583,6 +609,11 @@ function buildProgressTextLines(
|
|
|
583
609
|
}
|
|
584
610
|
|
|
585
611
|
if (next) lines.push(` Next: ${next}`);
|
|
612
|
+
|
|
613
|
+
// Model health indicator
|
|
614
|
+
const health = getModelHealthIndicator();
|
|
615
|
+
lines.push(` Health: ${health.emoji} ${health.label}`);
|
|
616
|
+
|
|
586
617
|
lines.push(` ${widgetPwd}`);
|
|
587
618
|
|
|
588
619
|
return lines;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import type { GSDState } from "./types.js";
|
|
13
13
|
import type { GSDPreferences } from "./preferences.js";
|
|
14
14
|
import type { UatType } from "./files.js";
|
|
15
|
-
import { loadFile, extractUatType, loadActiveOverrides } from "./files.js";
|
|
15
|
+
import { loadFile, extractUatType, loadActiveOverrides, parseRoadmap } from "./files.js";
|
|
16
16
|
import {
|
|
17
17
|
resolveMilestoneFile, resolveMilestonePath, resolveSliceFile, resolveTaskFile,
|
|
18
18
|
relSliceFile, buildMilestoneFileName,
|
|
@@ -123,11 +123,40 @@ const DISPATCH_RULES: DispatchRule[] = [
|
|
|
123
123
|
};
|
|
124
124
|
},
|
|
125
125
|
},
|
|
126
|
+
{
|
|
127
|
+
name: "uat-verdict-gate (non-PASS blocks progression)",
|
|
128
|
+
match: async ({ mid, basePath, prefs }) => {
|
|
129
|
+
// Only applies when UAT dispatch is enabled
|
|
130
|
+
if (!prefs?.uat_dispatch) return null;
|
|
131
|
+
|
|
132
|
+
const roadmapFile = resolveMilestoneFile(basePath, mid, "ROADMAP");
|
|
133
|
+
const roadmapContent = roadmapFile ? await loadFile(roadmapFile) : null;
|
|
134
|
+
if (!roadmapContent) return null;
|
|
135
|
+
|
|
136
|
+
const roadmap = parseRoadmap(roadmapContent);
|
|
137
|
+
for (const slice of roadmap.slices.filter(s => s.done)) {
|
|
138
|
+
const resultFile = resolveSliceFile(basePath, mid, slice.id, "UAT-RESULT");
|
|
139
|
+
if (!resultFile) continue;
|
|
140
|
+
const content = await loadFile(resultFile);
|
|
141
|
+
if (!content) continue;
|
|
142
|
+
const verdictMatch = content.match(/verdict:\s*([\w-]+)/i);
|
|
143
|
+
const verdict = verdictMatch?.[1]?.toLowerCase();
|
|
144
|
+
if (verdict && verdict !== "pass" && verdict !== "passed") {
|
|
145
|
+
return {
|
|
146
|
+
action: "stop" as const,
|
|
147
|
+
reason: `UAT verdict for ${slice.id} is "${verdict}" — blocking progression until resolved.\nReview the UAT result and update the verdict to PASS, or re-run /gsd auto after fixing.`,
|
|
148
|
+
level: "warning" as const,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return null;
|
|
153
|
+
},
|
|
154
|
+
},
|
|
126
155
|
{
|
|
127
156
|
name: "reassess-roadmap (post-completion)",
|
|
128
157
|
match: async ({ state, mid, midTitle, basePath, prefs }) => {
|
|
129
|
-
//
|
|
130
|
-
if (prefs?.phases?.
|
|
158
|
+
// Reassess is opt-in: only fire when explicitly enabled
|
|
159
|
+
if (!prefs?.phases?.reassess_after_slice) return null;
|
|
131
160
|
const needsReassess = await checkNeedsReassessment(basePath, mid, state);
|
|
132
161
|
if (!needsReassess) return null;
|
|
133
162
|
return {
|
|
@@ -37,7 +37,6 @@ import { resolveAutoSupervisorConfig, loadEffectiveGSDPreferences } from "./pref
|
|
|
37
37
|
import { runGSDDoctor, rebuildState, summarizeDoctorIssues } from "./doctor.js";
|
|
38
38
|
import { COMPLETION_TRANSITION_CODES } from "./doctor-types.js";
|
|
39
39
|
import { recordHealthSnapshot, checkHealEscalation } from "./doctor-proactive.js";
|
|
40
|
-
import { syncStateToProjectRoot } from "./auto-worktree-sync.js";
|
|
41
40
|
import { resetRewriteCircuitBreaker } from "./auto-dispatch.js";
|
|
42
41
|
import { isDbAvailable } from "./gsd-db.js";
|
|
43
42
|
import { consumeSignal } from "./session-status-io.js";
|
|
@@ -176,7 +175,7 @@ export async function postUnitPreVerification(pctx: PostUnitContext): Promise<"d
|
|
|
176
175
|
);
|
|
177
176
|
try {
|
|
178
177
|
const { formatDoctorIssuesForPrompt, formatDoctorReport } = await import("./doctor.js");
|
|
179
|
-
const { dispatchDoctorHeal } = await import("./commands.js");
|
|
178
|
+
const { dispatchDoctorHeal } = await import("./commands-handlers.js");
|
|
180
179
|
const actionable = report.issues.filter(i => i.severity === "error");
|
|
181
180
|
const reportText = formatDoctorReport(report, { scope: doctorScope, includeWarnings: true });
|
|
182
181
|
const structuredIssues = formatDoctorIssuesForPrompt(actionable);
|
|
@@ -202,23 +201,17 @@ export async function postUnitPreVerification(pctx: PostUnitContext): Promise<"d
|
|
|
202
201
|
}
|
|
203
202
|
}
|
|
204
203
|
|
|
205
|
-
// Prune dead bg-shell processes
|
|
204
|
+
// Prune dead bg-shell processes and kill non-persistent live ones.
|
|
205
|
+
// Without killing live processes between units, dev servers spawned during
|
|
206
|
+
// one task keep ports bound, causing conflicts in subsequent tasks (#1209).
|
|
206
207
|
try {
|
|
207
|
-
const { pruneDeadProcesses } = await import("../bg-shell/process-manager.js");
|
|
208
|
+
const { pruneDeadProcesses, killSessionProcesses } = await import("../bg-shell/process-manager.js");
|
|
208
209
|
pruneDeadProcesses();
|
|
210
|
+
killSessionProcesses();
|
|
209
211
|
} catch {
|
|
210
212
|
// Non-fatal
|
|
211
213
|
}
|
|
212
214
|
|
|
213
|
-
// Sync worktree state back to project root
|
|
214
|
-
if (s.originalBasePath && s.originalBasePath !== s.basePath) {
|
|
215
|
-
try {
|
|
216
|
-
syncStateToProjectRoot(s.basePath, s.originalBasePath, s.currentMilestoneId);
|
|
217
|
-
} catch {
|
|
218
|
-
// Non-fatal
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
215
|
// Rewrite-docs completion
|
|
223
216
|
if (s.currentUnit.type === "rewrite-docs") {
|
|
224
217
|
try {
|
|
@@ -328,6 +321,45 @@ export async function postUnitPostVerification(pctx: PostUnitContext): Promise<"
|
|
|
328
321
|
}
|
|
329
322
|
}
|
|
330
323
|
|
|
324
|
+
// ── Mechanical completion (ADR-003) ──
|
|
325
|
+
// After task execution, attempt mechanical slice and milestone completion
|
|
326
|
+
// instead of dispatching LLM sessions for complete-slice / validate-milestone.
|
|
327
|
+
if (s.currentUnit?.type === "execute-task" && !s.stepMode) {
|
|
328
|
+
try {
|
|
329
|
+
const [mid, sid] = s.currentUnit.id.split("/");
|
|
330
|
+
if (mid && sid) {
|
|
331
|
+
const state = await deriveState(s.basePath);
|
|
332
|
+
if (state.phase === "summarizing" && state.activeSlice?.id === sid) {
|
|
333
|
+
const { mechanicalSliceCompletion } = await import("./mechanical-completion.js");
|
|
334
|
+
const ok = await mechanicalSliceCompletion(s.basePath, mid, sid);
|
|
335
|
+
if (ok) {
|
|
336
|
+
invalidateAllCaches();
|
|
337
|
+
autoCommitCurrentBranch(s.basePath, "mechanical-completion", `${mid}/${sid}`);
|
|
338
|
+
ctx.ui.notify(`Mechanical completion: ${sid} summary + roadmap updated.`, "info");
|
|
339
|
+
|
|
340
|
+
// Re-derive state — check if milestone is now ready for validation
|
|
341
|
+
invalidateAllCaches();
|
|
342
|
+
const postSliceState = await deriveState(s.basePath);
|
|
343
|
+
if (postSliceState.phase === "validating-milestone" || postSliceState.phase === "completing-milestone") {
|
|
344
|
+
const { aggregateMilestoneVerification, generateMilestoneSummary } = await import("./mechanical-completion.js");
|
|
345
|
+
const validation = await aggregateMilestoneVerification(s.basePath, mid);
|
|
346
|
+
if (validation.verdict !== "failed") {
|
|
347
|
+
await generateMilestoneSummary(s.basePath, mid);
|
|
348
|
+
invalidateAllCaches();
|
|
349
|
+
autoCommitCurrentBranch(s.basePath, "mechanical-milestone-completion", mid);
|
|
350
|
+
ctx.ui.notify(`Mechanical completion: ${mid} validation + summary written.`, "info");
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
// If !ok, summarizing phase persists → dispatch rule fires as LLM fallback
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
} catch (err) {
|
|
358
|
+
process.stderr.write(`gsd-mechanical: completion failed: ${(err as Error).message}\n`);
|
|
359
|
+
// Non-fatal — fall through to normal dispatch
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
331
363
|
// ── Post-unit hooks ──
|
|
332
364
|
if (s.currentUnit && !s.stepMode) {
|
|
333
365
|
const hookUnit = checkPostUnitHooks(s.currentUnit.type, s.currentUnit.id, s.basePath);
|
|
@@ -530,11 +530,21 @@ export async function checkNeedsRunUat(
|
|
|
530
530
|
const uatContent = await loadFile(uatFile);
|
|
531
531
|
if (!uatContent) return null;
|
|
532
532
|
|
|
533
|
-
// If UAT result already exists, skip (idempotent)
|
|
533
|
+
// If UAT result already exists with a PASS verdict, skip (idempotent).
|
|
534
|
+
// Non-PASS verdicts (FAIL, surfaced-for-human-review) should block slice
|
|
535
|
+
// progression — return the slice for re-evaluation (#1231).
|
|
534
536
|
const uatResultFile = resolveSliceFile(base, mid, sid, "UAT-RESULT");
|
|
535
537
|
if (uatResultFile) {
|
|
536
|
-
const
|
|
537
|
-
if (
|
|
538
|
+
const resultContent = await loadFile(uatResultFile);
|
|
539
|
+
if (resultContent) {
|
|
540
|
+
const verdictMatch = resultContent.match(/verdict:\s*([\w-]+)/i);
|
|
541
|
+
const verdict = verdictMatch?.[1]?.toLowerCase();
|
|
542
|
+
if (verdict === "pass" || verdict === "passed") return null; // PASS — skip
|
|
543
|
+
// Non-PASS verdict exists — don't re-run UAT, but don't advance either.
|
|
544
|
+
// Return null here since the UAT already ran; the dispatch table's
|
|
545
|
+
// complete-slice rule should check the verdict before advancing.
|
|
546
|
+
// For now, returning the slice signals it still needs attention.
|
|
547
|
+
}
|
|
538
548
|
}
|
|
539
549
|
|
|
540
550
|
// Classify UAT type; unknown type → treat as human-experience (human review)
|
|
@@ -589,14 +599,18 @@ export async function buildPlanMilestonePrompt(mid: string, midTitle: string, ba
|
|
|
589
599
|
const { inlinePriorMilestoneSummary } = await import("./files.js");
|
|
590
600
|
const priorSummaryInline = await inlinePriorMilestoneSummary(mid, base);
|
|
591
601
|
if (priorSummaryInline) inlined.push(priorSummaryInline);
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
602
|
+
// Build source file paths for the planner to read on demand (reduces inlining)
|
|
603
|
+
const sourcePaths: string[] = [];
|
|
604
|
+
if (existsSync(resolveGsdRootFile(base, "PROJECT")))
|
|
605
|
+
sourcePaths.push(`- **Project**: \`${relGsdRootFile("PROJECT")}\``);
|
|
606
|
+
if (existsSync(resolveGsdRootFile(base, "REQUIREMENTS")))
|
|
607
|
+
sourcePaths.push(`- **Requirements**: \`${relGsdRootFile("REQUIREMENTS")}\``);
|
|
608
|
+
if (existsSync(resolveGsdRootFile(base, "DECISIONS")))
|
|
609
|
+
sourcePaths.push(`- **Decisions**: \`${relGsdRootFile("DECISIONS")}\``);
|
|
610
|
+
const sourceFilePaths = sourcePaths.length > 0
|
|
611
|
+
? sourcePaths.join("\n")
|
|
612
|
+
: "_No project/requirements/decisions files found._";
|
|
613
|
+
|
|
600
614
|
const knowledgeInlinePM = await inlineGsdRootFile(base, "knowledge.md", "Project Knowledge");
|
|
601
615
|
if (knowledgeInlinePM) inlined.push(knowledgeInlinePM);
|
|
602
616
|
inlined.push(inlineTemplate("roadmap", "Roadmap"));
|
|
@@ -615,6 +629,7 @@ export async function buildPlanMilestonePrompt(mid: string, midTitle: string, ba
|
|
|
615
629
|
|
|
616
630
|
const outputRelPath = relMilestoneFile(base, mid, "ROADMAP");
|
|
617
631
|
const secretsOutputPath = join(base, relMilestoneFile(base, mid, "SECRETS"));
|
|
632
|
+
const researchOutputRelPath = relMilestoneFile(base, mid, "RESEARCH");
|
|
618
633
|
return loadPrompt("plan-milestone", {
|
|
619
634
|
workingDirectory: base,
|
|
620
635
|
milestoneId: mid, milestoneTitle: midTitle,
|
|
@@ -624,6 +639,9 @@ export async function buildPlanMilestonePrompt(mid: string, midTitle: string, ba
|
|
|
624
639
|
outputPath: join(base, outputRelPath),
|
|
625
640
|
secretsOutputPath,
|
|
626
641
|
inlinedContext,
|
|
642
|
+
sourceFilePaths,
|
|
643
|
+
researchOutputPath: join(base, researchOutputRelPath),
|
|
644
|
+
...buildSkillDiscoveryVars(),
|
|
627
645
|
});
|
|
628
646
|
}
|
|
629
647
|
|
|
@@ -686,12 +704,16 @@ export async function buildPlanSlicePrompt(
|
|
|
686
704
|
inlined.push(await inlineFile(roadmapPath, roadmapRel, "Milestone Roadmap"));
|
|
687
705
|
const researchInline = await inlineFileOptional(researchPath, researchRel, "Slice Research");
|
|
688
706
|
if (researchInline) inlined.push(researchInline);
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
707
|
+
// Build source file paths for the planner to read on demand (reduces inlining)
|
|
708
|
+
const sliceSourcePaths: string[] = [];
|
|
709
|
+
if (existsSync(resolveGsdRootFile(base, "REQUIREMENTS")))
|
|
710
|
+
sliceSourcePaths.push(`- **Requirements**: \`${relGsdRootFile("REQUIREMENTS")}\``);
|
|
711
|
+
if (existsSync(resolveGsdRootFile(base, "DECISIONS")))
|
|
712
|
+
sliceSourcePaths.push(`- **Decisions**: \`${relGsdRootFile("DECISIONS")}\``);
|
|
713
|
+
const sliceSourceFilePaths = sliceSourcePaths.length > 0
|
|
714
|
+
? sliceSourcePaths.join("\n")
|
|
715
|
+
: "_No requirements/decisions files found._";
|
|
716
|
+
|
|
695
717
|
const knowledgeInlinePS = await inlineGsdRootFile(base, "knowledge.md", "Project Knowledge");
|
|
696
718
|
if (knowledgeInlinePS) inlined.push(knowledgeInlinePS);
|
|
697
719
|
inlined.push(inlineTemplate("plan", "Slice Plan"));
|
|
@@ -726,6 +748,7 @@ export async function buildPlanSlicePrompt(
|
|
|
726
748
|
dependencySummaries: depContent,
|
|
727
749
|
executorContextConstraints,
|
|
728
750
|
commitInstruction,
|
|
751
|
+
sourceFilePaths: sliceSourceFilePaths,
|
|
729
752
|
});
|
|
730
753
|
}
|
|
731
754
|
|
|
@@ -35,10 +35,12 @@ import {
|
|
|
35
35
|
resolveMilestoneFile,
|
|
36
36
|
clearPathCache,
|
|
37
37
|
resolveGsdRootFile,
|
|
38
|
+
gsdRoot,
|
|
38
39
|
} from "./paths.js";
|
|
39
40
|
import { isValidationTerminal } from "./state.js";
|
|
40
41
|
import { existsSync, mkdirSync, readFileSync, writeFileSync, unlinkSync } from "node:fs";
|
|
41
42
|
import { atomicWriteSync } from "./atomic-write.js";
|
|
43
|
+
import { loadJsonFileOrNull } from "./json-persistence.js";
|
|
42
44
|
import { dirname, join } from "node:path";
|
|
43
45
|
|
|
44
46
|
// ─── Artifact Resolution & Verification ───────────────────────────────────────
|
|
@@ -354,20 +356,19 @@ export function skipExecuteTask(
|
|
|
354
356
|
|
|
355
357
|
// ─── Disk-backed completed-unit helpers ───────────────────────────────────────
|
|
356
358
|
|
|
359
|
+
function isStringArray(data: unknown): data is string[] {
|
|
360
|
+
return Array.isArray(data) && data.every(item => typeof item === "string");
|
|
361
|
+
}
|
|
362
|
+
|
|
357
363
|
/** Path to the persisted completed-unit keys file. */
|
|
358
364
|
export function completedKeysPath(base: string): string {
|
|
359
|
-
return join(base, "
|
|
365
|
+
return join(gsdRoot(base), "completed-units.json");
|
|
360
366
|
}
|
|
361
367
|
|
|
362
368
|
/** Write a completed unit key to disk (read-modify-write append to set). */
|
|
363
369
|
export function persistCompletedKey(base: string, key: string): void {
|
|
364
370
|
const file = completedKeysPath(base);
|
|
365
|
-
|
|
366
|
-
try {
|
|
367
|
-
if (existsSync(file)) {
|
|
368
|
-
keys = JSON.parse(readFileSync(file, "utf-8"));
|
|
369
|
-
}
|
|
370
|
-
} catch (e) { /* corrupt file — start fresh */ void e; }
|
|
371
|
+
const keys = loadJsonFileOrNull(file, isStringArray) ?? [];
|
|
371
372
|
const keySet = new Set(keys);
|
|
372
373
|
if (!keySet.has(key)) {
|
|
373
374
|
keys.push(key);
|
|
@@ -378,27 +379,21 @@ export function persistCompletedKey(base: string, key: string): void {
|
|
|
378
379
|
/** Remove a stale completed unit key from disk. */
|
|
379
380
|
export function removePersistedKey(base: string, key: string): void {
|
|
380
381
|
const file = completedKeysPath(base);
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
atomicWriteSync(file, JSON.stringify(filtered));
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
} catch (e) { /* non-fatal: removePersistedKey failure */ void e; }
|
|
382
|
+
const keys = loadJsonFileOrNull(file, isStringArray);
|
|
383
|
+
if (!keys) return;
|
|
384
|
+
const filtered = keys.filter(k => k !== key);
|
|
385
|
+
if (filtered.length !== keys.length) {
|
|
386
|
+
atomicWriteSync(file, JSON.stringify(filtered));
|
|
387
|
+
}
|
|
391
388
|
}
|
|
392
389
|
|
|
393
390
|
/** Load all completed unit keys from disk into the in-memory set. */
|
|
394
391
|
export function loadPersistedKeys(base: string, target: Set<string>): void {
|
|
395
392
|
const file = completedKeysPath(base);
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
}
|
|
401
|
-
} catch (e) { /* non-fatal: loadPersistedKeys failure */ void e; }
|
|
393
|
+
const keys = loadJsonFileOrNull(file, isStringArray);
|
|
394
|
+
if (keys) {
|
|
395
|
+
for (const k of keys) target.add(k);
|
|
396
|
+
}
|
|
402
397
|
}
|
|
403
398
|
|
|
404
399
|
// ─── Merge State Reconciliation ───────────────────────────────────────────────
|