gsd-pi 2.29.0-dev.49d972f → 2.29.0-dev.4c155ee
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/headless.js +4 -0
- package/dist/resources/extensions/bg-shell/process-manager.ts +13 -0
- package/dist/resources/extensions/gsd/auto-dashboard.ts +217 -65
- package/dist/resources/extensions/gsd/auto-dispatch.ts +32 -3
- package/dist/resources/extensions/gsd/auto-post-unit.ts +44 -12
- package/dist/resources/extensions/gsd/auto-prompts.ts +40 -17
- package/dist/resources/extensions/gsd/auto-recovery.ts +2 -1
- 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 -9
- package/dist/resources/extensions/gsd/captures.ts +4 -10
- package/dist/resources/extensions/gsd/commands-handlers.ts +2 -1
- 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 +55 -2
- 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/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 +3 -3
- 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/repo-identity.ts +148 -0
- package/dist/resources/extensions/gsd/resource-version.ts +99 -0
- package/dist/resources/extensions/gsd/session-forensics.ts +4 -3
- package/dist/resources/extensions/gsd/tests/activity-log.test.ts +2 -2
- package/dist/resources/extensions/gsd/tests/auto-recovery.test.ts +3 -3
- 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/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/mcp-client/index.ts +459 -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/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/src/core/extensions/loader.ts +13 -0
- package/packages/pi-coding-agent/src/core/lsp/client.ts +3 -0
- package/src/resources/extensions/bg-shell/process-manager.ts +13 -0
- package/src/resources/extensions/gsd/auto-dashboard.ts +217 -65
- package/src/resources/extensions/gsd/auto-dispatch.ts +32 -3
- package/src/resources/extensions/gsd/auto-post-unit.ts +44 -12
- package/src/resources/extensions/gsd/auto-prompts.ts +40 -17
- package/src/resources/extensions/gsd/auto-recovery.ts +2 -1
- 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 -9
- package/src/resources/extensions/gsd/captures.ts +4 -10
- package/src/resources/extensions/gsd/commands-handlers.ts +2 -1
- 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 +55 -2
- 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/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 +3 -3
- 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/repo-identity.ts +148 -0
- package/src/resources/extensions/gsd/resource-version.ts +99 -0
- package/src/resources/extensions/gsd/session-forensics.ts +4 -3
- package/src/resources/extensions/gsd/tests/activity-log.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +3 -3
- 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/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/mcp-client/index.ts +459 -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 -199
- 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 -199
- 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,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"templates": {
|
|
4
|
+
"full-project": {
|
|
5
|
+
"name": "Full Project",
|
|
6
|
+
"description": "Complete GSD workflow with roadmap, milestones, slices, and full ceremony",
|
|
7
|
+
"file": "full-project.md",
|
|
8
|
+
"phases": ["init", "discuss", "plan", "execute", "verify"],
|
|
9
|
+
"triggers": ["new project", "greenfield", "from scratch", "build an app", "create a new"],
|
|
10
|
+
"artifact_dir": ".gsd/",
|
|
11
|
+
"estimated_complexity": "high",
|
|
12
|
+
"requires_project": true
|
|
13
|
+
},
|
|
14
|
+
"bugfix": {
|
|
15
|
+
"name": "Bug Fix",
|
|
16
|
+
"description": "Triage, reproduce, fix, test, and ship a bug fix",
|
|
17
|
+
"file": "bugfix.md",
|
|
18
|
+
"phases": ["triage", "fix", "verify", "ship"],
|
|
19
|
+
"triggers": ["bug", "issue", "fix", "broken", "regression", "error", "crash", "failing", "github.com/*/issues/*"],
|
|
20
|
+
"artifact_dir": ".gsd/workflows/bugfixes/",
|
|
21
|
+
"estimated_complexity": "low",
|
|
22
|
+
"requires_project": false
|
|
23
|
+
},
|
|
24
|
+
"small-feature": {
|
|
25
|
+
"name": "Small Feature",
|
|
26
|
+
"description": "Lightweight feature development with optional discussion and research",
|
|
27
|
+
"file": "small-feature.md",
|
|
28
|
+
"phases": ["scope", "plan", "implement", "verify"],
|
|
29
|
+
"triggers": ["add", "feature", "implement", "build", "create", "new command", "new endpoint"],
|
|
30
|
+
"artifact_dir": ".gsd/workflows/features/",
|
|
31
|
+
"estimated_complexity": "medium",
|
|
32
|
+
"requires_project": false
|
|
33
|
+
},
|
|
34
|
+
"refactor": {
|
|
35
|
+
"name": "Refactor / Migration",
|
|
36
|
+
"description": "Systematic code transformation with inventory and wave-based execution",
|
|
37
|
+
"file": "refactor.md",
|
|
38
|
+
"phases": ["inventory", "plan", "migrate", "verify"],
|
|
39
|
+
"triggers": ["refactor", "migrate", "rename", "restructure", "move", "reorganize", "clean up"],
|
|
40
|
+
"artifact_dir": ".gsd/workflows/refactors/",
|
|
41
|
+
"estimated_complexity": "medium",
|
|
42
|
+
"requires_project": false
|
|
43
|
+
},
|
|
44
|
+
"spike": {
|
|
45
|
+
"name": "Research Spike",
|
|
46
|
+
"description": "Investigate a question, prototype, and document findings",
|
|
47
|
+
"file": "spike.md",
|
|
48
|
+
"phases": ["scope", "research", "synthesize"],
|
|
49
|
+
"triggers": ["research", "investigate", "explore", "spike", "compare", "evaluate", "should we", "what if", "how does"],
|
|
50
|
+
"artifact_dir": ".gsd/workflows/spikes/",
|
|
51
|
+
"estimated_complexity": "low",
|
|
52
|
+
"requires_project": false
|
|
53
|
+
},
|
|
54
|
+
"hotfix": {
|
|
55
|
+
"name": "Hotfix",
|
|
56
|
+
"description": "Minimal ceremony: fix the thing, test it, ship it",
|
|
57
|
+
"file": "hotfix.md",
|
|
58
|
+
"phases": ["fix", "ship"],
|
|
59
|
+
"triggers": ["hotfix", "urgent", "critical", "asap", "production down", "p0"],
|
|
60
|
+
"artifact_dir": null,
|
|
61
|
+
"estimated_complexity": "minimal",
|
|
62
|
+
"requires_project": false
|
|
63
|
+
},
|
|
64
|
+
"security-audit": {
|
|
65
|
+
"name": "Security Audit",
|
|
66
|
+
"description": "Scan for vulnerabilities, triage findings, remediate, and verify",
|
|
67
|
+
"file": "security-audit.md",
|
|
68
|
+
"phases": ["scan", "triage", "remediate", "re-scan"],
|
|
69
|
+
"triggers": ["security", "audit", "vulnerability", "owasp", "cve", "penetration", "hardening"],
|
|
70
|
+
"artifact_dir": ".gsd/workflows/audits/",
|
|
71
|
+
"estimated_complexity": "medium",
|
|
72
|
+
"requires_project": false
|
|
73
|
+
},
|
|
74
|
+
"dep-upgrade": {
|
|
75
|
+
"name": "Dependency Upgrade",
|
|
76
|
+
"description": "Assess impact, upgrade dependencies, fix breaking changes",
|
|
77
|
+
"file": "dep-upgrade.md",
|
|
78
|
+
"phases": ["assess", "upgrade", "fix", "verify"],
|
|
79
|
+
"triggers": ["upgrade", "update", "dependency", "deps", "bump", "outdated", "npm update", "renovate"],
|
|
80
|
+
"artifact_dir": ".gsd/workflows/upgrades/",
|
|
81
|
+
"estimated_complexity": "medium",
|
|
82
|
+
"requires_project": false
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Security Audit Workflow
|
|
2
|
+
|
|
3
|
+
<template_meta>
|
|
4
|
+
name: security-audit
|
|
5
|
+
version: 1
|
|
6
|
+
requires_project: false
|
|
7
|
+
artifact_dir: .gsd/workflows/audits/
|
|
8
|
+
</template_meta>
|
|
9
|
+
|
|
10
|
+
<purpose>
|
|
11
|
+
Systematic security review of the codebase. Scan for vulnerabilities, triage
|
|
12
|
+
findings by severity, remediate issues, and verify fixes. Covers OWASP Top 10,
|
|
13
|
+
dependency vulnerabilities, and project-specific security concerns.
|
|
14
|
+
</purpose>
|
|
15
|
+
|
|
16
|
+
<phases>
|
|
17
|
+
1. scan — Identify potential vulnerabilities
|
|
18
|
+
2. triage — Prioritize findings by severity and exploitability
|
|
19
|
+
3. remediate — Fix critical and high-severity issues
|
|
20
|
+
4. re-scan — Verify fixes and document remaining items
|
|
21
|
+
</phases>
|
|
22
|
+
|
|
23
|
+
<process>
|
|
24
|
+
|
|
25
|
+
## Phase 1: Scan
|
|
26
|
+
|
|
27
|
+
**Goal:** Identify potential security issues across the codebase.
|
|
28
|
+
|
|
29
|
+
1. **Dependency audit:** Run `npm audit` / `pip audit` / equivalent
|
|
30
|
+
2. **Code review for common vulnerabilities:**
|
|
31
|
+
- Injection (SQL, command, XSS)
|
|
32
|
+
- Authentication/authorization flaws
|
|
33
|
+
- Sensitive data exposure (hardcoded secrets, logs)
|
|
34
|
+
- Insecure configuration
|
|
35
|
+
- Missing input validation at boundaries
|
|
36
|
+
3. **Check security headers and CORS** (if web application)
|
|
37
|
+
4. **Review secrets management:** .env files, config, environment variables
|
|
38
|
+
5. **Produce:** Write `SCAN-RESULTS.md` with all findings
|
|
39
|
+
|
|
40
|
+
## Phase 2: Triage
|
|
41
|
+
|
|
42
|
+
**Goal:** Prioritize what to fix now vs later.
|
|
43
|
+
|
|
44
|
+
1. **Rate each finding:**
|
|
45
|
+
- Critical: exploitable, high impact, fix immediately
|
|
46
|
+
- High: likely exploitable, fix in this workflow
|
|
47
|
+
- Medium: lower risk, fix if time allows
|
|
48
|
+
- Low: informational, document for later
|
|
49
|
+
2. **Assess exploitability:** Is this theoretical or practically exploitable?
|
|
50
|
+
3. **Produce:** Update `SCAN-RESULTS.md` with severity ratings and triage decisions
|
|
51
|
+
|
|
52
|
+
4. **Gate:** Review triage with user. Agree on what to remediate now.
|
|
53
|
+
|
|
54
|
+
## Phase 3: Remediate
|
|
55
|
+
|
|
56
|
+
**Goal:** Fix critical and high-severity issues.
|
|
57
|
+
|
|
58
|
+
1. Fix each issue with proper testing
|
|
59
|
+
2. Commit each fix individually: `fix(security): <description>`
|
|
60
|
+
3. Don't introduce new functionality — security fixes only
|
|
61
|
+
|
|
62
|
+
## Phase 4: Re-scan
|
|
63
|
+
|
|
64
|
+
**Goal:** Verify fixes and document the final state.
|
|
65
|
+
|
|
66
|
+
1. Re-run the scans from Phase 1
|
|
67
|
+
2. Verify all targeted issues are resolved
|
|
68
|
+
3. **Produce:** Write `AUDIT-REPORT.md` with:
|
|
69
|
+
- Summary of findings and fixes
|
|
70
|
+
- Remaining medium/low items for future attention
|
|
71
|
+
- Recommendations for ongoing security practices
|
|
72
|
+
|
|
73
|
+
</process>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Small Feature Workflow
|
|
2
|
+
|
|
3
|
+
<template_meta>
|
|
4
|
+
name: small-feature
|
|
5
|
+
version: 1
|
|
6
|
+
requires_project: false
|
|
7
|
+
artifact_dir: .gsd/workflows/features/
|
|
8
|
+
</template_meta>
|
|
9
|
+
|
|
10
|
+
<purpose>
|
|
11
|
+
Build a small-to-medium feature with lightweight planning. Designed for work that
|
|
12
|
+
needs more structure than /gsd quick but doesn't warrant full milestone ceremony.
|
|
13
|
+
Typical scope: a new command, endpoint, component, or module.
|
|
14
|
+
</purpose>
|
|
15
|
+
|
|
16
|
+
<phases>
|
|
17
|
+
1. scope — Define what we're building and confirm boundaries
|
|
18
|
+
2. plan — Break into 2-5 implementable tasks
|
|
19
|
+
3. implement — Execute the plan with atomic commits
|
|
20
|
+
4. verify — Run tests, build, and validate
|
|
21
|
+
</phases>
|
|
22
|
+
|
|
23
|
+
<process>
|
|
24
|
+
|
|
25
|
+
## Phase 1: Scope
|
|
26
|
+
|
|
27
|
+
**Goal:** Align on what to build and what's out of scope.
|
|
28
|
+
|
|
29
|
+
1. **Understand the request:** Clarify the feature's purpose and user-facing behavior
|
|
30
|
+
2. **Identify gray areas:** Surface 3-4 design decisions that need answers:
|
|
31
|
+
- API shape / interface design
|
|
32
|
+
- Where in the codebase this fits
|
|
33
|
+
- What existing patterns to follow
|
|
34
|
+
- Edge cases to handle (or explicitly skip)
|
|
35
|
+
3. **Define boundaries:** What's in scope vs out of scope for this workflow
|
|
36
|
+
4. **Produce:** Write a brief `CONTEXT.md` in the artifact directory with:
|
|
37
|
+
- Feature description
|
|
38
|
+
- Key decisions made
|
|
39
|
+
- Scope boundaries
|
|
40
|
+
|
|
41
|
+
5. **Gate:** Confirm scope with user before planning.
|
|
42
|
+
|
|
43
|
+
## Phase 2: Plan
|
|
44
|
+
|
|
45
|
+
**Goal:** Create a clear, executable plan.
|
|
46
|
+
|
|
47
|
+
1. **Research (if needed):** Read relevant existing code to understand patterns
|
|
48
|
+
2. **Break into tasks:** 2-5 tasks, each independently committable:
|
|
49
|
+
- Each task should take ~10-30 minutes of AI work
|
|
50
|
+
- Include file paths and specific changes
|
|
51
|
+
- Include verification steps per task
|
|
52
|
+
3. **Produce:** Write `PLAN.md` in the artifact directory
|
|
53
|
+
|
|
54
|
+
4. **Gate:** Present plan to user for approval. Adjust if needed.
|
|
55
|
+
|
|
56
|
+
## Phase 3: Implement
|
|
57
|
+
|
|
58
|
+
**Goal:** Build the feature following the plan.
|
|
59
|
+
|
|
60
|
+
1. Execute tasks in order
|
|
61
|
+
2. After each task:
|
|
62
|
+
- Verify the specific task's acceptance criteria
|
|
63
|
+
- Commit with message: `feat(<scope>): <description>`
|
|
64
|
+
3. If a task reveals the plan needs adjustment, note the deviation and adapt
|
|
65
|
+
4. Run incremental tests as you go (don't wait until the end)
|
|
66
|
+
|
|
67
|
+
## Phase 4: Verify
|
|
68
|
+
|
|
69
|
+
**Goal:** Ensure everything works together.
|
|
70
|
+
|
|
71
|
+
1. Run the full test suite
|
|
72
|
+
2. Run the build
|
|
73
|
+
3. Run the linter
|
|
74
|
+
4. Manual smoke check if applicable
|
|
75
|
+
5. **Produce:** Write a brief `SUMMARY.md` with:
|
|
76
|
+
- What was built
|
|
77
|
+
- Files changed
|
|
78
|
+
- How to test/use the feature
|
|
79
|
+
6. Present summary to user
|
|
80
|
+
|
|
81
|
+
</process>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Research Spike Workflow
|
|
2
|
+
|
|
3
|
+
<template_meta>
|
|
4
|
+
name: spike
|
|
5
|
+
version: 1
|
|
6
|
+
requires_project: false
|
|
7
|
+
artifact_dir: .gsd/workflows/spikes/
|
|
8
|
+
</template_meta>
|
|
9
|
+
|
|
10
|
+
<purpose>
|
|
11
|
+
Investigate a question, evaluate options, prototype if needed, and produce a
|
|
12
|
+
clear recommendation. No production code is shipped — the output is knowledge.
|
|
13
|
+
Use for: technology evaluation, architecture decisions, "should we X?" questions.
|
|
14
|
+
</purpose>
|
|
15
|
+
|
|
16
|
+
<phases>
|
|
17
|
+
1. scope — Define the question and success criteria
|
|
18
|
+
2. research — Investigate from multiple angles
|
|
19
|
+
3. synthesize — Combine findings into a recommendation
|
|
20
|
+
</phases>
|
|
21
|
+
|
|
22
|
+
<process>
|
|
23
|
+
|
|
24
|
+
## Phase 1: Scope
|
|
25
|
+
|
|
26
|
+
**Goal:** Define exactly what we're investigating and what a good answer looks like.
|
|
27
|
+
|
|
28
|
+
1. **Frame the question:** What specific question(s) need answering?
|
|
29
|
+
2. **Define success criteria:** What would a useful answer include?
|
|
30
|
+
- Comparison criteria (performance, DX, maintenance, ecosystem, etc.)
|
|
31
|
+
- Constraints (must integrate with X, must support Y)
|
|
32
|
+
- Decision format (go/no-go, pick from options, tradeoff matrix)
|
|
33
|
+
3. **Identify research angles:** 2-3 distinct approaches to investigate:
|
|
34
|
+
- e.g., "evaluate library A", "evaluate library B", "evaluate building our own"
|
|
35
|
+
- e.g., "performance implications", "DX implications", "migration path"
|
|
36
|
+
4. **Produce:** Write `SCOPE.md` in the artifact directory
|
|
37
|
+
|
|
38
|
+
5. **Gate:** Confirm scope and research angles with user.
|
|
39
|
+
|
|
40
|
+
## Phase 2: Research
|
|
41
|
+
|
|
42
|
+
**Goal:** Investigate each angle thoroughly.
|
|
43
|
+
|
|
44
|
+
1. For each research angle:
|
|
45
|
+
- Search for relevant documentation, benchmarks, comparisons
|
|
46
|
+
- Read relevant source code in the project
|
|
47
|
+
- Build small prototypes or proof-of-concepts if needed
|
|
48
|
+
- Note pros, cons, risks, and unknowns
|
|
49
|
+
2. **Produce:** Write a research doc per angle in `research/` subdirectory:
|
|
50
|
+
- `research/ANGLE-1.md`, `research/ANGLE-2.md`, etc.
|
|
51
|
+
- Each doc: findings, evidence, pros/cons, confidence level
|
|
52
|
+
|
|
53
|
+
## Phase 3: Synthesize
|
|
54
|
+
|
|
55
|
+
**Goal:** Combine findings into a clear recommendation.
|
|
56
|
+
|
|
57
|
+
1. **Compare across angles:** Build a comparison matrix or summary table
|
|
58
|
+
2. **Make a recommendation:** Based on the evidence, what should we do?
|
|
59
|
+
- Primary recommendation with rationale
|
|
60
|
+
- Alternative if the primary doesn't work out
|
|
61
|
+
- What would change the recommendation (risk factors)
|
|
62
|
+
3. **Produce:** Write `RECOMMENDATION.md` with:
|
|
63
|
+
- Executive summary (1-2 paragraphs)
|
|
64
|
+
- Comparison matrix
|
|
65
|
+
- Recommendation with rationale
|
|
66
|
+
- Next steps if the recommendation is accepted
|
|
67
|
+
4. **Present** the recommendation to the user for discussion
|
|
68
|
+
|
|
69
|
+
</process>
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GSD Workflow Templates — Registry & Resolution
|
|
3
|
+
*
|
|
4
|
+
* Loads the workflow template registry and resolves templates by name,
|
|
5
|
+
* alias, or trigger-keyword matching against user input.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { readFileSync, existsSync } from "node:fs";
|
|
9
|
+
import { join, dirname } from "node:path";
|
|
10
|
+
import { fileURLToPath } from "node:url";
|
|
11
|
+
|
|
12
|
+
const __extensionDir = dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
const registryPath = join(__extensionDir, "workflow-templates", "registry.json");
|
|
14
|
+
|
|
15
|
+
// ─── Types ───────────────────────────────────────────────────────────────────
|
|
16
|
+
|
|
17
|
+
export interface TemplateEntry {
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
file: string;
|
|
21
|
+
phases: string[];
|
|
22
|
+
triggers: string[];
|
|
23
|
+
artifact_dir: string | null;
|
|
24
|
+
estimated_complexity: string;
|
|
25
|
+
requires_project: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface TemplateRegistry {
|
|
29
|
+
version: number;
|
|
30
|
+
templates: Record<string, TemplateEntry>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface TemplateMatch {
|
|
34
|
+
id: string;
|
|
35
|
+
template: TemplateEntry;
|
|
36
|
+
confidence: "exact" | "high" | "medium" | "low";
|
|
37
|
+
matchedTrigger?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// ─── Registry Cache ──────────────────────────────────────────────────────────
|
|
41
|
+
|
|
42
|
+
let cachedRegistry: TemplateRegistry | null = null;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Load and cache the workflow template registry.
|
|
46
|
+
*/
|
|
47
|
+
export function loadRegistry(): TemplateRegistry {
|
|
48
|
+
if (cachedRegistry) return cachedRegistry;
|
|
49
|
+
|
|
50
|
+
const content = readFileSync(registryPath, "utf-8");
|
|
51
|
+
cachedRegistry = JSON.parse(content) as TemplateRegistry;
|
|
52
|
+
return cachedRegistry;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Resolve a template by exact name or alias.
|
|
57
|
+
* Returns null if no match found.
|
|
58
|
+
*/
|
|
59
|
+
export function resolveByName(nameOrAlias: string): TemplateMatch | null {
|
|
60
|
+
const registry = loadRegistry();
|
|
61
|
+
const normalized = nameOrAlias.toLowerCase().trim();
|
|
62
|
+
|
|
63
|
+
// Exact key match
|
|
64
|
+
if (registry.templates[normalized]) {
|
|
65
|
+
return {
|
|
66
|
+
id: normalized,
|
|
67
|
+
template: registry.templates[normalized],
|
|
68
|
+
confidence: "exact",
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Match by template name (case-insensitive)
|
|
73
|
+
for (const [id, entry] of Object.entries(registry.templates)) {
|
|
74
|
+
if (entry.name.toLowerCase() === normalized) {
|
|
75
|
+
return { id, template: entry, confidence: "exact" };
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Fuzzy: prefix match on id
|
|
80
|
+
for (const [id, entry] of Object.entries(registry.templates)) {
|
|
81
|
+
if (id.startsWith(normalized) || normalized.startsWith(id)) {
|
|
82
|
+
return { id, template: entry, confidence: "high" };
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Common aliases
|
|
87
|
+
const aliases: Record<string, string> = {
|
|
88
|
+
"bug": "bugfix",
|
|
89
|
+
"fix": "bugfix",
|
|
90
|
+
"feature": "small-feature",
|
|
91
|
+
"feat": "small-feature",
|
|
92
|
+
"research": "spike",
|
|
93
|
+
"investigate": "spike",
|
|
94
|
+
"hot": "hotfix",
|
|
95
|
+
"urgent": "hotfix",
|
|
96
|
+
"security": "security-audit",
|
|
97
|
+
"audit": "security-audit",
|
|
98
|
+
"upgrade": "dep-upgrade",
|
|
99
|
+
"deps": "dep-upgrade",
|
|
100
|
+
"update-deps": "dep-upgrade",
|
|
101
|
+
"migration": "refactor",
|
|
102
|
+
"project": "full-project",
|
|
103
|
+
"full": "full-project",
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const aliasMatch = aliases[normalized];
|
|
107
|
+
if (aliasMatch && registry.templates[aliasMatch]) {
|
|
108
|
+
return {
|
|
109
|
+
id: aliasMatch,
|
|
110
|
+
template: registry.templates[aliasMatch],
|
|
111
|
+
confidence: "high",
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Auto-detect the best template based on user description text.
|
|
120
|
+
* Returns ranked matches sorted by confidence.
|
|
121
|
+
*/
|
|
122
|
+
export function autoDetect(description: string): TemplateMatch[] {
|
|
123
|
+
const registry = loadRegistry();
|
|
124
|
+
const lower = description.toLowerCase();
|
|
125
|
+
const words = lower.split(/\s+/);
|
|
126
|
+
const matches: TemplateMatch[] = [];
|
|
127
|
+
|
|
128
|
+
for (const [id, entry] of Object.entries(registry.templates)) {
|
|
129
|
+
let bestScore = 0;
|
|
130
|
+
let bestTrigger = "";
|
|
131
|
+
|
|
132
|
+
for (const trigger of entry.triggers) {
|
|
133
|
+
const triggerLower = trigger.toLowerCase();
|
|
134
|
+
|
|
135
|
+
// Exact phrase match in description
|
|
136
|
+
if (lower.includes(triggerLower)) {
|
|
137
|
+
const score = triggerLower.split(/\s+/).length * 2; // multi-word triggers score higher
|
|
138
|
+
if (score > bestScore) {
|
|
139
|
+
bestScore = score;
|
|
140
|
+
bestTrigger = trigger;
|
|
141
|
+
}
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Single-word trigger match against description words
|
|
146
|
+
if (!triggerLower.includes(" ") && words.includes(triggerLower)) {
|
|
147
|
+
if (1 > bestScore) {
|
|
148
|
+
bestScore = 1;
|
|
149
|
+
bestTrigger = trigger;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (bestScore > 0) {
|
|
155
|
+
const confidence = bestScore >= 4 ? "high" : bestScore >= 2 ? "medium" : "low";
|
|
156
|
+
matches.push({
|
|
157
|
+
id,
|
|
158
|
+
template: entry,
|
|
159
|
+
confidence,
|
|
160
|
+
matchedTrigger: bestTrigger,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Sort by confidence (high > medium > low), then alphabetically
|
|
166
|
+
const order = { exact: 0, high: 1, medium: 2, low: 3 };
|
|
167
|
+
matches.sort((a, b) => order[a.confidence] - order[b.confidence] || a.id.localeCompare(b.id));
|
|
168
|
+
|
|
169
|
+
return matches;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* List all templates as formatted text for display.
|
|
174
|
+
*/
|
|
175
|
+
export function listTemplates(): string {
|
|
176
|
+
const registry = loadRegistry();
|
|
177
|
+
const lines: string[] = ["Workflow Templates\n"];
|
|
178
|
+
|
|
179
|
+
for (const [id, entry] of Object.entries(registry.templates)) {
|
|
180
|
+
const phases = entry.phases.join(" → ");
|
|
181
|
+
const complexity = entry.estimated_complexity;
|
|
182
|
+
lines.push(` ${id.padEnd(16)} ${entry.name}`);
|
|
183
|
+
lines.push(` ${"".padEnd(16)} ${entry.description}`);
|
|
184
|
+
lines.push(` ${"".padEnd(16)} Phases: ${phases} | Complexity: ${complexity}`);
|
|
185
|
+
lines.push("");
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
lines.push("Usage: /gsd start <template> [description]");
|
|
189
|
+
lines.push(" /gsd templates info <name>");
|
|
190
|
+
|
|
191
|
+
return lines.join("\n");
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Get detailed info about a specific template.
|
|
196
|
+
*/
|
|
197
|
+
export function getTemplateInfo(name: string): string | null {
|
|
198
|
+
const match = resolveByName(name);
|
|
199
|
+
if (!match) return null;
|
|
200
|
+
|
|
201
|
+
const { id, template: t } = match;
|
|
202
|
+
const lines = [
|
|
203
|
+
`Template: ${t.name} (${id})`,
|
|
204
|
+
"",
|
|
205
|
+
`Description: ${t.description}`,
|
|
206
|
+
`Complexity: ${t.estimated_complexity}`,
|
|
207
|
+
`Requires .gsd/: ${t.requires_project ? "yes" : "no"}`,
|
|
208
|
+
"",
|
|
209
|
+
"Phases:",
|
|
210
|
+
...t.phases.map((p, i) => ` ${i + 1}. ${p}`),
|
|
211
|
+
"",
|
|
212
|
+
"Triggers:",
|
|
213
|
+
` ${t.triggers.join(", ")}`,
|
|
214
|
+
];
|
|
215
|
+
|
|
216
|
+
if (t.artifact_dir) {
|
|
217
|
+
lines.push("", `Artifacts: ${t.artifact_dir}`);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const templateFilePath = join(__extensionDir, "workflow-templates", t.file);
|
|
221
|
+
if (existsSync(templateFilePath)) {
|
|
222
|
+
lines.push("", "Template file: loaded");
|
|
223
|
+
} else {
|
|
224
|
+
lines.push("", "Template file: not yet created");
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return lines.join("\n");
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Load the raw content of a workflow template .md file.
|
|
232
|
+
*/
|
|
233
|
+
export function loadWorkflowTemplate(templateId: string): string | null {
|
|
234
|
+
const match = resolveByName(templateId);
|
|
235
|
+
if (!match) return null;
|
|
236
|
+
|
|
237
|
+
const filePath = join(__extensionDir, "workflow-templates", match.template.file);
|
|
238
|
+
if (!existsSync(filePath)) return null;
|
|
239
|
+
|
|
240
|
+
return readFileSync(filePath, "utf-8");
|
|
241
|
+
}
|
|
@@ -50,7 +50,7 @@ export function getWorktreeOriginalCwd(): string | null {
|
|
|
50
50
|
export function getActiveWorktreeName(): string | null {
|
|
51
51
|
if (!originalCwd) return null;
|
|
52
52
|
const cwd = process.cwd();
|
|
53
|
-
const wtDir = join(originalCwd, "
|
|
53
|
+
const wtDir = join(gsdRoot(originalCwd), "worktrees");
|
|
54
54
|
if (!cwd.startsWith(wtDir)) return null;
|
|
55
55
|
const rel = cwd.slice(wtDir.length + 1);
|
|
56
56
|
const name = rel.split("/")[0] ?? rel.split("\\")[0];
|
|
@@ -633,16 +633,6 @@ async function handleMerge(
|
|
|
633
633
|
const commitType = inferCommitType(name);
|
|
634
634
|
const commitMessage = `${commitType}(${name}): merge worktree ${name}`;
|
|
635
635
|
|
|
636
|
-
// Reconcile worktree DB into main DB before squash merge
|
|
637
|
-
const wtDbPath = join(worktreePath(basePath, name), ".gsd", "gsd.db");
|
|
638
|
-
const mainDbPath = join(basePath, ".gsd", "gsd.db");
|
|
639
|
-
if (existsSync(wtDbPath) && existsSync(mainDbPath)) {
|
|
640
|
-
try {
|
|
641
|
-
const { reconcileWorktreeDb } = await import("./gsd-db.js");
|
|
642
|
-
reconcileWorktreeDb(mainDbPath, wtDbPath);
|
|
643
|
-
} catch { /* non-fatal */ }
|
|
644
|
-
}
|
|
645
|
-
|
|
646
636
|
try {
|
|
647
637
|
mergeWorktreeToMain(basePath, name, commitMessage);
|
|
648
638
|
ctx.ui.notify(
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import { existsSync, mkdirSync, readFileSync, realpathSync } from "node:fs";
|
|
19
19
|
import { join, resolve, sep } from "node:path";
|
|
20
|
+
import { gsdRoot } from "./paths.js";
|
|
20
21
|
import { GSDError, GSD_PARSE_ERROR, GSD_STALE_STATE, GSD_LOCK_HELD, GSD_GIT_ERROR, GSD_MERGE_CONFLICT } from "./errors.js";
|
|
21
22
|
import {
|
|
22
23
|
nativeBranchDelete,
|
|
@@ -100,7 +101,7 @@ export function resolveGitDir(basePath: string): string {
|
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
export function worktreesDir(basePath: string): string {
|
|
103
|
-
return join(basePath, "
|
|
104
|
+
return join(gsdRoot(basePath), "worktrees");
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
export function worktreePath(basePath: string, name: string): string {
|
|
@@ -193,7 +194,7 @@ export function listWorktrees(basePath: string): WorktreeInfo[] {
|
|
|
193
194
|
const seenRoots = new Set<string>();
|
|
194
195
|
const worktreeRoots = baseVariants
|
|
195
196
|
.map(baseVariant => {
|
|
196
|
-
const path = join(baseVariant, "
|
|
197
|
+
const path = join(gsdRoot(baseVariant), "worktrees");
|
|
197
198
|
return {
|
|
198
199
|
normalized: normalizePathForComparison(path),
|
|
199
200
|
};
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* SLICE_BRANCH_RE) remain for backwards compatibility with legacy branches.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { existsSync, readFileSync, utimesSync } from "node:fs";
|
|
15
|
+
import { existsSync, lstatSync, readFileSync, utimesSync } from "node:fs";
|
|
16
16
|
import { join, resolve, sep } from "node:path";
|
|
17
17
|
|
|
18
18
|
import { GitServiceImpl, writeIntegrationBranch, type TaskCommitContext } from "./git-service.js";
|
|
@@ -72,6 +72,25 @@ export function captureIntegrationBranch(basePath: string, milestoneId: string,
|
|
|
72
72
|
* Returns null if not inside a GSD worktree (.gsd/worktrees/<name>/).
|
|
73
73
|
*/
|
|
74
74
|
export function detectWorktreeName(basePath: string): string | null {
|
|
75
|
+
// Primary: use git metadata — .git file with gitdir: pointer
|
|
76
|
+
const gitPath = join(basePath, ".git");
|
|
77
|
+
try {
|
|
78
|
+
const stat = lstatSync(gitPath);
|
|
79
|
+
if (stat.isFile()) {
|
|
80
|
+
const content = readFileSync(gitPath, "utf-8").trim();
|
|
81
|
+
if (content.startsWith("gitdir:")) {
|
|
82
|
+
const gitdir = content.slice(7).trim();
|
|
83
|
+
// Git worktree gitdir format: <repo>/.git/worktrees/<name>
|
|
84
|
+
const parts = gitdir.replace(/\\/g, "/").split("/");
|
|
85
|
+
const wtIdx = parts.lastIndexOf("worktrees");
|
|
86
|
+
if (wtIdx !== -1 && wtIdx < parts.length - 1) {
|
|
87
|
+
return parts[wtIdx + 1] || null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
} catch { /* fall through */ }
|
|
92
|
+
|
|
93
|
+
// Fallback: path-based detection for legacy setups
|
|
75
94
|
const normalizedPath = basePath.replaceAll("\\", "/");
|
|
76
95
|
const marker = "/.gsd/worktrees/";
|
|
77
96
|
const idx = normalizedPath.indexOf(marker);
|
|
@@ -90,14 +109,32 @@ export function detectWorktreeName(basePath: string): string | null {
|
|
|
90
109
|
* operate against the real project root, not a worktree subdirectory.
|
|
91
110
|
*/
|
|
92
111
|
export function resolveProjectRoot(basePath: string): string {
|
|
112
|
+
// Primary: use git metadata to resolve the main worktree root
|
|
113
|
+
const gitPath = join(basePath, ".git");
|
|
114
|
+
try {
|
|
115
|
+
const stat = lstatSync(gitPath);
|
|
116
|
+
if (stat.isFile()) {
|
|
117
|
+
const content = readFileSync(gitPath, "utf-8").trim();
|
|
118
|
+
if (content.startsWith("gitdir:")) {
|
|
119
|
+
const gitdir = resolve(basePath, content.slice(7).trim());
|
|
120
|
+
// Git worktree gitdir: <repo>/.git/worktrees/<name>
|
|
121
|
+
// Walk up to <repo>
|
|
122
|
+
const parts = gitdir.replace(/\\/g, "/").split("/");
|
|
123
|
+
const wtIdx = parts.lastIndexOf("worktrees");
|
|
124
|
+
if (wtIdx >= 2 && parts[wtIdx - 1] === ".git") {
|
|
125
|
+
return parts.slice(0, wtIdx - 1).join("/");
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
} catch { /* fall through */ }
|
|
130
|
+
|
|
131
|
+
// Fallback: legacy path-based detection
|
|
93
132
|
const normalizedPath = basePath.replaceAll("\\", "/");
|
|
94
133
|
const marker = "/.gsd/worktrees/";
|
|
95
134
|
const idx = normalizedPath.indexOf(marker);
|
|
96
135
|
if (idx === -1) return basePath;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const sep = basePath.includes("\\") ? "\\" : "/";
|
|
100
|
-
const markerOs = `${sep}.gsd${sep}worktrees${sep}`;
|
|
136
|
+
const osSep = basePath.includes("\\") ? "\\" : "/";
|
|
137
|
+
const markerOs = `${osSep}.gsd${osSep}worktrees${osSep}`;
|
|
101
138
|
const idxOs = basePath.indexOf(markerOs);
|
|
102
139
|
if (idxOs !== -1) return basePath.slice(0, idxOs);
|
|
103
140
|
return basePath.slice(0, idx);
|