gsd-pi 2.29.0-dev.49d972f → 2.29.0-dev.77f06e2

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.
Files changed (48) hide show
  1. package/README.md +24 -17
  2. package/dist/resources/extensions/bg-shell/process-manager.ts +13 -0
  3. package/dist/resources/extensions/gsd/auto-dashboard.ts +186 -65
  4. package/dist/resources/extensions/gsd/auto-post-unit.ts +5 -2
  5. package/dist/resources/extensions/gsd/commands-prefs-wizard.ts +44 -14
  6. package/dist/resources/extensions/gsd/commands-workflow-templates.ts +544 -0
  7. package/dist/resources/extensions/gsd/commands.ts +53 -1
  8. package/dist/resources/extensions/gsd/prompts/workflow-start.md +28 -0
  9. package/dist/resources/extensions/gsd/tests/extension-selector-separator.test.ts +60 -38
  10. package/dist/resources/extensions/gsd/tests/workflow-templates.test.ts +173 -0
  11. package/dist/resources/extensions/gsd/workflow-templates/bugfix.md +87 -0
  12. package/dist/resources/extensions/gsd/workflow-templates/dep-upgrade.md +74 -0
  13. package/dist/resources/extensions/gsd/workflow-templates/full-project.md +41 -0
  14. package/dist/resources/extensions/gsd/workflow-templates/hotfix.md +45 -0
  15. package/dist/resources/extensions/gsd/workflow-templates/refactor.md +83 -0
  16. package/dist/resources/extensions/gsd/workflow-templates/registry.json +85 -0
  17. package/dist/resources/extensions/gsd/workflow-templates/security-audit.md +73 -0
  18. package/dist/resources/extensions/gsd/workflow-templates/small-feature.md +81 -0
  19. package/dist/resources/extensions/gsd/workflow-templates/spike.md +69 -0
  20. package/dist/resources/extensions/gsd/workflow-templates.ts +241 -0
  21. package/dist/resources/extensions/mcp-client/index.ts +459 -0
  22. package/package.json +1 -1
  23. package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
  24. package/packages/pi-coding-agent/dist/core/extensions/loader.js +13 -0
  25. package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
  26. package/packages/pi-coding-agent/src/core/extensions/loader.ts +13 -0
  27. package/src/resources/extensions/bg-shell/process-manager.ts +13 -0
  28. package/src/resources/extensions/gsd/auto-dashboard.ts +186 -65
  29. package/src/resources/extensions/gsd/auto-post-unit.ts +5 -2
  30. package/src/resources/extensions/gsd/commands-prefs-wizard.ts +44 -14
  31. package/src/resources/extensions/gsd/commands-workflow-templates.ts +544 -0
  32. package/src/resources/extensions/gsd/commands.ts +53 -1
  33. package/src/resources/extensions/gsd/prompts/workflow-start.md +28 -0
  34. package/src/resources/extensions/gsd/tests/extension-selector-separator.test.ts +60 -38
  35. package/src/resources/extensions/gsd/tests/workflow-templates.test.ts +173 -0
  36. package/src/resources/extensions/gsd/workflow-templates/bugfix.md +87 -0
  37. package/src/resources/extensions/gsd/workflow-templates/dep-upgrade.md +74 -0
  38. package/src/resources/extensions/gsd/workflow-templates/full-project.md +41 -0
  39. package/src/resources/extensions/gsd/workflow-templates/hotfix.md +45 -0
  40. package/src/resources/extensions/gsd/workflow-templates/refactor.md +83 -0
  41. package/src/resources/extensions/gsd/workflow-templates/registry.json +85 -0
  42. package/src/resources/extensions/gsd/workflow-templates/security-audit.md +73 -0
  43. package/src/resources/extensions/gsd/workflow-templates/small-feature.md +81 -0
  44. package/src/resources/extensions/gsd/workflow-templates/spike.md +69 -0
  45. package/src/resources/extensions/gsd/workflow-templates.ts +241 -0
  46. package/src/resources/extensions/mcp-client/index.ts +459 -0
  47. package/dist/resources/extensions/mcporter/index.ts +0 -525
  48. package/src/resources/extensions/mcporter/index.ts +0 -525
@@ -43,6 +43,7 @@ import { handleInspect } from "./commands-inspect.js";
43
43
  import { handleCleanupBranches, handleCleanupSnapshots, handleSkip, handleDryRun } from "./commands-maintenance.js";
44
44
  import { handleDoctor, handleSteer, handleCapture, handleTriage, handleKnowledge, handleRunHook, handleUpdate, handleSkillHealth } from "./commands-handlers.js";
45
45
  import { handleLogs } from "./commands-logs.js";
46
+ import { handleStart, handleTemplates, getTemplateCompletions } from "./commands-workflow-templates.js";
46
47
 
47
48
 
48
49
  /** Resolve the effective project root, accounting for worktree paths. */
@@ -54,7 +55,7 @@ export function projectRoot(): string {
54
55
 
55
56
  export function registerGSDCommand(pi: ExtensionAPI): void {
56
57
  pi.registerCommand("gsd", {
57
- description: "GSD — Get Shit Done: /gsd help|next|auto|stop|pause|status|visualize|queue|quick|capture|triage|dispatch|history|undo|skip|export|cleanup|mode|prefs|config|keys|hooks|run-hook|skill-health|doctor|forensics|migrate|remote|steer|knowledge|new-milestone|parallel|update",
58
+ description: "GSD — Get Shit Done: /gsd help|start|templates|next|auto|stop|pause|status|visualize|queue|quick|capture|triage|dispatch|history|undo|skip|export|cleanup|mode|prefs|config|keys|hooks|run-hook|skill-health|doctor|forensics|migrate|remote|steer|knowledge|new-milestone|parallel|update",
58
59
  getArgumentCompletions: (prefix: string) => {
59
60
  const subcommands = [
60
61
  { cmd: "help", desc: "Categorized command reference with descriptions" },
@@ -97,6 +98,8 @@ export function registerGSDCommand(pi: ExtensionAPI): void {
97
98
  { cmd: "park", desc: "Park a milestone — skip without deleting" },
98
99
  { cmd: "unpark", desc: "Reactivate a parked milestone" },
99
100
  { cmd: "update", desc: "Update GSD to the latest version" },
101
+ { cmd: "start", desc: "Start a workflow template (bugfix, spike, feature, etc.)" },
102
+ { cmd: "templates", desc: "List available workflow templates" },
100
103
  ];
101
104
  const parts = prefix.trim().split(/\s+/);
102
105
 
@@ -282,6 +285,42 @@ export function registerGSDCommand(pi: ExtensionAPI): void {
282
285
  .map((s) => ({ value: `knowledge ${s.cmd}`, label: s.cmd, description: s.desc }));
283
286
  }
284
287
 
288
+ if (parts[0] === "start" && parts.length <= 2) {
289
+ const subPrefix = parts[1] ?? "";
290
+ const subs = [
291
+ { cmd: "bugfix", desc: "Triage, fix, test, and ship a bug fix" },
292
+ { cmd: "small-feature", desc: "Lightweight feature with optional discussion" },
293
+ { cmd: "spike", desc: "Research, prototype, and document findings" },
294
+ { cmd: "hotfix", desc: "Minimal: fix it, test it, ship it" },
295
+ { cmd: "refactor", desc: "Inventory, plan waves, migrate, verify" },
296
+ { cmd: "security-audit", desc: "Scan, triage, remediate, re-scan" },
297
+ { cmd: "dep-upgrade", desc: "Assess, upgrade, fix breaks, verify" },
298
+ { cmd: "full-project", desc: "Complete GSD workflow with full ceremony" },
299
+ { cmd: "resume", desc: "Resume an in-progress workflow" },
300
+ { cmd: "--list", desc: "List all available templates" },
301
+ { cmd: "--dry-run", desc: "Preview workflow without executing" },
302
+ ];
303
+ return subs
304
+ .filter((s) => s.cmd.startsWith(subPrefix))
305
+ .map((s) => ({ value: `start ${s.cmd}`, label: s.cmd, description: s.desc }));
306
+ }
307
+
308
+ if (parts[0] === "templates" && parts.length <= 2) {
309
+ const subPrefix = parts[1] ?? "";
310
+ const subs = [
311
+ { cmd: "info", desc: "Show detailed template info" },
312
+ ];
313
+ return subs
314
+ .filter((s) => s.cmd.startsWith(subPrefix))
315
+ .map((s) => ({ value: `templates ${s.cmd}`, label: s.cmd, description: s.desc }));
316
+ }
317
+
318
+ if (parts[0] === "templates" && parts[1] === "info" && parts.length <= 3) {
319
+ const namePrefix = parts[2] ?? "";
320
+ return getTemplateCompletions(namePrefix)
321
+ .map((c) => ({ value: `templates ${c.value}`, label: c.label, description: c.description }));
322
+ }
323
+
285
324
  if (parts[0] === "doctor") {
286
325
  const modePrefix = parts[1] ?? "";
287
326
  const modes = [
@@ -773,6 +812,17 @@ Examples:
773
812
  return;
774
813
  }
775
814
 
815
+ // ─── Workflow Templates ────────────────────────────────────────
816
+ if (trimmed === "start" || trimmed.startsWith("start ")) {
817
+ await handleStart(trimmed.replace(/^start\s*/, "").trim(), ctx, pi);
818
+ return;
819
+ }
820
+
821
+ if (trimmed === "templates" || trimmed.startsWith("templates ")) {
822
+ await handleTemplates(trimmed.replace(/^templates\s*/, "").trim(), ctx);
823
+ return;
824
+ }
825
+
776
826
  if (trimmed === "") {
777
827
  // Bare /gsd defaults to step mode
778
828
  await startAuto(ctx, pi, projectRoot(), false, { step: true });
@@ -791,6 +841,8 @@ function showHelp(ctx: ExtensionCommandContext): void {
791
841
  const lines = [
792
842
  "GSD — Get Shit Done\n",
793
843
  "WORKFLOW",
844
+ " /gsd start <tpl> Start a workflow template (bugfix, spike, feature, hotfix, etc.)",
845
+ " /gsd templates List available workflow templates [info <name>]",
794
846
  " /gsd Run next unit in step mode (same as /gsd next)",
795
847
  " /gsd next Execute next task, then pause [--dry-run] [--verbose]",
796
848
  " /gsd auto Run all queued units continuously [--verbose]",
@@ -0,0 +1,28 @@
1
+ # Workflow Template: {{templateName}}
2
+
3
+ You are executing a **{{templateName}}** workflow (template: `{{templateId}}`).
4
+
5
+ ## Context
6
+
7
+ - **Description:** {{description}}
8
+ - **Issue reference:** {{issueRef}}
9
+ - **Date:** {{date}}
10
+ - **Branch:** {{branch}}
11
+ - **Artifact directory:** {{artifactDir}}
12
+ - **Phases:** {{phases}}
13
+ - **Complexity:** {{complexity}}
14
+
15
+ ## Workflow Definition
16
+
17
+ Follow the workflow defined below. Execute each phase in order, completing one before moving to the next. At each phase gate, confirm with the user before proceeding.
18
+
19
+ {{workflowContent}}
20
+
21
+ ## Execution Rules
22
+
23
+ 1. **Follow the phases in order.** Do not skip phases unless the workflow explicitly allows it.
24
+ 2. **Artifact discipline.** If an artifact directory is specified, write all planning/summary documents there.
25
+ 3. **Atomic commits.** Commit working code after each meaningful change. Use conventional commit format: `<type>(<scope>): <description>`.
26
+ 4. **Verify before shipping.** Run the project's test suite and build before marking the workflow complete.
27
+ 5. **Gate between phases.** After each phase, summarize what was done and ask the user to confirm before moving to the next phase.
28
+ 6. **Stay focused.** This is a {{complexity}}-complexity workflow. Match your ceremony level to the task — don't over-engineer or under-deliver.
@@ -1,4 +1,6 @@
1
- // Tests for the SEPARATOR_PREFIX convention used by ExtensionSelectorComponent.
1
+ // Tests for the SEPARATOR_PREFIX convention used by ExtensionSelectorComponent
2
+ // and the two-step provider→model picker in configureModels.
3
+ //
2
4
  // We cannot import the component directly in node:test because its transitive
3
5
  // dependency (countdown-timer.ts) uses TypeScript parameter properties which
4
6
  // are unsupported under --experimental-strip-types. Instead we duplicate the
@@ -69,16 +71,17 @@ describe("separator detection", () => {
69
71
  });
70
72
  });
71
73
 
72
- describe("model grouping", () => {
73
- test("groups models by provider with separator headers", () => {
74
- // Simulate the grouping logic from configureModels
75
- const availableModels = [
76
- { id: "claude-opus-4-6", provider: "anthropic" },
77
- { id: "gpt-4o", provider: "openai" },
78
- { id: "claude-sonnet-4-5", provider: "anthropic" },
79
- { id: "o3-mini", provider: "openai" },
80
- ];
74
+ describe("two-step provider→model picker", () => {
75
+ // Simulate the grouping logic from configureModels
76
+ const availableModels = [
77
+ { id: "claude-opus-4-6", provider: "anthropic" },
78
+ { id: "gpt-4o", provider: "openai" },
79
+ { id: "claude-sonnet-4-5", provider: "anthropic" },
80
+ { id: "o3-mini", provider: "openai" },
81
+ { id: "claude-haiku-4-5", provider: "anthropic" },
82
+ ];
81
83
 
84
+ function buildProviderGroups() {
82
85
  const byProvider = new Map<string, typeof availableModels>();
83
86
  for (const m of availableModels) {
84
87
  let group = byProvider.get(m.provider);
@@ -89,34 +92,53 @@ describe("model grouping", () => {
89
92
  group.push(m);
90
93
  }
91
94
  const providers = Array.from(byProvider.keys()).sort((a, b) => a.localeCompare(b));
92
-
93
- const modelOptions: string[] = [];
94
- for (const provider of providers) {
95
- const group = byProvider.get(provider)!;
96
- modelOptions.push(`${SEPARATOR_PREFIX} ${provider} (${group.length}) ${SEPARATOR_PREFIX}`);
97
- for (const m of group) {
98
- modelOptions.push(`${m.id} · ${m.provider}`);
99
- }
95
+ for (const group of byProvider.values()) {
96
+ group.sort((a, b) => a.id.localeCompare(b.id));
100
97
  }
101
- modelOptions.push("(keep current)", "(clear)");
102
-
103
- // Verify structure
104
- assert.strictEqual(modelOptions[0], `${SEPARATOR_PREFIX} anthropic (2) ${SEPARATOR_PREFIX}`);
105
- assert.strictEqual(modelOptions[1], "claude-opus-4-6 · anthropic");
106
- assert.strictEqual(modelOptions[2], "claude-sonnet-4-5 · anthropic");
107
- assert.strictEqual(modelOptions[3], `${SEPARATOR_PREFIX} openai (2) ${SEPARATOR_PREFIX}`);
108
- assert.strictEqual(modelOptions[4], "gpt-4o · openai");
109
- assert.strictEqual(modelOptions[5], "o3-mini · openai");
110
- assert.strictEqual(modelOptions[6], "(keep current)");
111
- assert.strictEqual(modelOptions[7], "(clear)");
112
-
113
- // Verify separators are correctly detected
114
- assert.ok(isSeparator(modelOptions, 0));
115
- assert.ok(!isSeparator(modelOptions, 1));
116
- assert.ok(isSeparator(modelOptions, 3));
117
- assert.ok(!isSeparator(modelOptions, 6));
118
-
119
- // Verify first selectable is index 1, not the separator at 0
120
- assert.strictEqual(nextSelectable(modelOptions, 0, 1), 1);
98
+ return { byProvider, providers };
99
+ }
100
+
101
+ test("provider menu lists providers with model counts", () => {
102
+ const { providers, byProvider } = buildProviderGroups();
103
+ const providerOptions = providers.map(p => {
104
+ const count = byProvider.get(p)!.length;
105
+ return `${p} (${count} models)`;
106
+ });
107
+ providerOptions.push("(keep current)", "(clear)", "(type manually)");
108
+
109
+ assert.strictEqual(providerOptions[0], "anthropic (3 models)");
110
+ assert.strictEqual(providerOptions[1], "openai (2 models)");
111
+ assert.strictEqual(providerOptions[2], "(keep current)");
112
+ assert.strictEqual(providerOptions[3], "(clear)");
113
+ assert.strictEqual(providerOptions[4], "(type manually)");
114
+ });
115
+
116
+ test("model menu for a provider is sorted alphabetically", () => {
117
+ const { byProvider } = buildProviderGroups();
118
+ const anthropicModels = byProvider.get("anthropic")!;
119
+ const modelOptions = anthropicModels.map(m => m.id);
120
+
121
+ assert.strictEqual(modelOptions[0], "claude-haiku-4-5");
122
+ assert.strictEqual(modelOptions[1], "claude-opus-4-6");
123
+ assert.strictEqual(modelOptions[2], "claude-sonnet-4-5");
124
+ });
125
+
126
+ test("provider name is extracted correctly from choice string", () => {
127
+ const choice = "anthropic (3 models)";
128
+ const providerName = choice.replace(/ \(\d+ models?\)$/, "");
129
+ assert.strictEqual(providerName, "anthropic");
130
+
131
+ const singleChoice = "ollama (1 model)";
132
+ const singleProvider = singleChoice.replace(/ \(\d+ models?\)$/, "");
133
+ assert.strictEqual(singleProvider, "ollama");
134
+ });
135
+
136
+ test("openai models are sorted within their group", () => {
137
+ const { byProvider } = buildProviderGroups();
138
+ const openaiModels = byProvider.get("openai")!;
139
+ const modelOptions = openaiModels.map(m => m.id);
140
+
141
+ assert.strictEqual(modelOptions[0], "gpt-4o");
142
+ assert.strictEqual(modelOptions[1], "o3-mini");
121
143
  });
122
144
  });
@@ -0,0 +1,173 @@
1
+ // GSD Workflow Templates — Unit Tests
2
+ //
3
+ // Tests registry loading, template resolution, auto-detection, and listing.
4
+
5
+ import { createTestContext } from './test-helpers.ts';
6
+ import {
7
+ loadRegistry,
8
+ resolveByName,
9
+ autoDetect,
10
+ listTemplates,
11
+ getTemplateInfo,
12
+ loadWorkflowTemplate,
13
+ } from '../workflow-templates.ts';
14
+
15
+ const { assertEq, assertTrue, assertMatch, report } = createTestContext();
16
+
17
+ // ═══════════════════════════════════════════════════════════════════════════
18
+ // Registry Loading
19
+ // ═══════════════════════════════════════════════════════════════════════════
20
+
21
+ console.log('\n── Registry Loading ──');
22
+
23
+ {
24
+ const registry = loadRegistry();
25
+ assertTrue(registry !== null, 'Registry should load');
26
+ assertEq(registry.version, 1, 'Registry version should be 1');
27
+ assertTrue(Object.keys(registry.templates).length >= 8, 'Should have at least 8 templates');
28
+
29
+ // Verify required template keys exist
30
+ const expectedIds = ['full-project', 'bugfix', 'small-feature', 'refactor', 'spike', 'hotfix', 'security-audit', 'dep-upgrade'];
31
+ for (const id of expectedIds) {
32
+ assertTrue(id in registry.templates, `Template "${id}" should exist in registry`);
33
+ }
34
+
35
+ // Verify each template has required fields
36
+ for (const [id, entry] of Object.entries(registry.templates)) {
37
+ assertTrue(typeof entry.name === 'string' && entry.name.length > 0, `${id}: name should be non-empty string`);
38
+ assertTrue(typeof entry.description === 'string' && entry.description.length > 0, `${id}: description should be non-empty`);
39
+ assertTrue(typeof entry.file === 'string' && entry.file.endsWith('.md'), `${id}: file should be a .md path`);
40
+ assertTrue(Array.isArray(entry.phases) && entry.phases.length > 0, `${id}: phases should be non-empty array`);
41
+ assertTrue(Array.isArray(entry.triggers) && entry.triggers.length > 0, `${id}: triggers should be non-empty array`);
42
+ }
43
+ }
44
+
45
+ // ═══════════════════════════════════════════════════════════════════════════
46
+ // Resolve by Name
47
+ // ═══════════════════════════════════════════════════════════════════════════
48
+
49
+ console.log('\n── Resolve by Name ──');
50
+
51
+ {
52
+ // Exact match
53
+ const bugfix = resolveByName('bugfix');
54
+ assertTrue(bugfix !== null, 'Should resolve "bugfix"');
55
+ assertEq(bugfix!.id, 'bugfix', 'ID should be "bugfix"');
56
+ assertEq(bugfix!.confidence, 'exact', 'Exact name should have exact confidence');
57
+
58
+ // Case-insensitive name match
59
+ const spike = resolveByName('Research Spike');
60
+ assertTrue(spike !== null, 'Should resolve "Research Spike" by name');
61
+ assertEq(spike!.id, 'spike', 'Should resolve to spike');
62
+
63
+ // Alias match
64
+ const bug = resolveByName('bug');
65
+ assertTrue(bug !== null, 'Should resolve "bug" alias');
66
+ assertEq(bug!.id, 'bugfix', 'Alias "bug" should map to bugfix');
67
+
68
+ const feat = resolveByName('feat');
69
+ assertTrue(feat !== null, 'Should resolve "feat" alias');
70
+ assertEq(feat!.id, 'small-feature', 'Alias "feat" should map to small-feature');
71
+
72
+ const deps = resolveByName('deps');
73
+ assertTrue(deps !== null, 'Should resolve "deps" alias');
74
+ assertEq(deps!.id, 'dep-upgrade', 'Alias "deps" should map to dep-upgrade');
75
+
76
+ // No match
77
+ const missing = resolveByName('nonexistent-template');
78
+ assertTrue(missing === null, 'Should return null for unknown template');
79
+ }
80
+
81
+ // ═══════════════════════════════════════════════════════════════════════════
82
+ // Auto-Detection
83
+ // ═══════════════════════════════════════════════════════════════════════════
84
+
85
+ console.log('\n── Auto-Detection ──');
86
+
87
+ {
88
+ // Should detect bugfix from "fix" keyword
89
+ const fixMatches = autoDetect('fix the login button');
90
+ assertTrue(fixMatches.length > 0, 'Should detect matches for "fix the login button"');
91
+ assertTrue(fixMatches.some(m => m.id === 'bugfix'), 'Should include bugfix in matches');
92
+
93
+ // Should detect spike from "research" keyword
94
+ const researchMatches = autoDetect('research authentication libraries');
95
+ assertTrue(researchMatches.length > 0, 'Should detect matches for "research"');
96
+ assertTrue(researchMatches.some(m => m.id === 'spike'), 'Should include spike in matches');
97
+
98
+ // Should detect hotfix from "urgent" keyword
99
+ const urgentMatches = autoDetect('urgent production is down');
100
+ assertTrue(urgentMatches.length > 0, 'Should detect matches for "urgent"');
101
+ assertTrue(urgentMatches.some(m => m.id === 'hotfix'), 'Should include hotfix in matches');
102
+
103
+ // Should detect dep-upgrade from "upgrade" keyword
104
+ const upgradeMatches = autoDetect('upgrade react to v19');
105
+ assertTrue(upgradeMatches.length > 0, 'Should detect matches for "upgrade"');
106
+ assertTrue(upgradeMatches.some(m => m.id === 'dep-upgrade'), 'Should include dep-upgrade in matches');
107
+
108
+ // Multi-word triggers should score higher
109
+ const projectMatches = autoDetect('create a new project from scratch');
110
+ const projectMatch = projectMatches.find(m => m.id === 'full-project');
111
+ assertTrue(projectMatch !== undefined, 'Should detect full-project for "from scratch"');
112
+
113
+ // Empty input should return no matches
114
+ const emptyMatches = autoDetect('');
115
+ assertEq(emptyMatches.length, 0, 'Empty input should return no matches');
116
+ }
117
+
118
+ // ═══════════════════════════════════════════════════════════════════════════
119
+ // List Templates
120
+ // ═══════════════════════════════════════════════════════════════════════════
121
+
122
+ console.log('\n── List Templates ──');
123
+
124
+ {
125
+ const output = listTemplates();
126
+ assertTrue(output.includes('Workflow Templates'), 'Should have header');
127
+ assertTrue(output.includes('bugfix'), 'Should list bugfix');
128
+ assertTrue(output.includes('spike'), 'Should list spike');
129
+ assertTrue(output.includes('hotfix'), 'Should list hotfix');
130
+ assertTrue(output.includes('/gsd start'), 'Should include usage hint');
131
+ }
132
+
133
+ // ═══════════════════════════════════════════════════════════════════════════
134
+ // Template Info
135
+ // ═══════════════════════════════════════════════════════════════════════════
136
+
137
+ console.log('\n── Template Info ──');
138
+
139
+ {
140
+ const info = getTemplateInfo('bugfix');
141
+ assertTrue(info !== null, 'Should return info for bugfix');
142
+ assertTrue(info!.includes('Bug Fix'), 'Should include template name');
143
+ assertTrue(info!.includes('triage'), 'Should include phase names');
144
+ assertTrue(info!.includes('Triggers'), 'Should include triggers section');
145
+
146
+ const missing = getTemplateInfo('nonexistent');
147
+ assertTrue(missing === null, 'Should return null for unknown template');
148
+ }
149
+
150
+ // ═══════════════════════════════════════════════════════════════════════════
151
+ // Load Workflow Template Content
152
+ // ═══════════════════════════════════════════════════════════════════════════
153
+
154
+ console.log('\n── Load Workflow Template ──');
155
+
156
+ {
157
+ const content = loadWorkflowTemplate('bugfix');
158
+ assertTrue(content !== null, 'Should load bugfix template');
159
+ assertTrue(content!.includes('Bugfix Workflow'), 'Should contain workflow title');
160
+ assertTrue(content!.includes('Phase 1: Triage'), 'Should contain triage phase');
161
+ assertTrue(content!.includes('Phase 4: Ship'), 'Should contain ship phase');
162
+
163
+ const hotfixContent = loadWorkflowTemplate('hotfix');
164
+ assertTrue(hotfixContent !== null, 'Should load hotfix template');
165
+ assertTrue(hotfixContent!.includes('Hotfix Workflow'), 'Should contain hotfix title');
166
+
167
+ const missingContent = loadWorkflowTemplate('nonexistent');
168
+ assertTrue(missingContent === null, 'Should return null for unknown template');
169
+ }
170
+
171
+ // ═══════════════════════════════════════════════════════════════════════════
172
+
173
+ report();
@@ -0,0 +1,87 @@
1
+ # Bugfix Workflow
2
+
3
+ <template_meta>
4
+ name: bugfix
5
+ version: 1
6
+ requires_project: false
7
+ artifact_dir: .gsd/workflows/bugfixes/
8
+ </template_meta>
9
+
10
+ <purpose>
11
+ Fix a bug from identification through to PR submission. Designed for issues reported
12
+ via GitHub, user reports, or developer discovery. Emphasizes root cause analysis
13
+ before jumping to fixes.
14
+ </purpose>
15
+
16
+ <phases>
17
+ 1. triage — Identify root cause, reproduce the bug
18
+ 2. fix — Implement the fix with tests
19
+ 3. verify — Run full test suite, check for regressions
20
+ 4. ship — Create PR with detailed explanation
21
+ </phases>
22
+
23
+ <process>
24
+
25
+ ## Phase 1: Triage
26
+
27
+ **Goal:** Understand the bug before touching any code.
28
+
29
+ 1. **Gather context:**
30
+ - If a GitHub issue was referenced, read the issue description, labels, and comments
31
+ - Identify the expected behavior vs actual behavior
32
+ - Note any error messages, stack traces, or reproduction steps provided
33
+
34
+ 2. **Reproduce:**
35
+ - Find the minimal reproduction path
36
+ - Identify the affected code paths (files, functions, lines)
37
+ - If the bug is intermittent, note the conditions that trigger it
38
+
39
+ 3. **Root cause analysis:**
40
+ - Trace the bug to its root cause (not just the symptom)
41
+ - Identify when the bug was introduced if possible (git blame/log)
42
+ - Assess blast radius: what else could be affected?
43
+
44
+ 4. **Produce:** Write a brief `TRIAGE.md` in the artifact directory with:
45
+ - Root cause explanation
46
+ - Reproduction steps
47
+ - Affected files/functions
48
+ - Proposed fix approach
49
+
50
+ 5. **Gate:** Present the triage findings and proposed fix to the user for confirmation.
51
+
52
+ ## Phase 2: Fix
53
+
54
+ **Goal:** Implement a clean, tested fix.
55
+
56
+ 1. **Plan the fix:** Write a brief plan (1-3 tasks max)
57
+ 2. **Write the fix:** Implement the code change
58
+ 3. **Write tests:** Add or update tests that:
59
+ - Reproduce the original bug (test fails without fix)
60
+ - Verify the fix works
61
+ - Cover edge cases
62
+ 4. **Commit:** Atomic commit with message: `fix(<scope>): <description>`
63
+
64
+ ## Phase 3: Verify
65
+
66
+ **Goal:** Ensure the fix doesn't break anything else.
67
+
68
+ 1. Run the project's full test suite
69
+ 2. Run the build (if applicable)
70
+ 3. Run the linter (if applicable)
71
+ 4. Check for regressions in related functionality
72
+ 5. If any failures, fix them before proceeding
73
+
74
+ ## Phase 4: Ship
75
+
76
+ **Goal:** Create a well-documented PR.
77
+
78
+ 1. Ensure all changes are committed on the workflow branch
79
+ 2. Build the PR body:
80
+ - Link to the original issue (if applicable)
81
+ - Explain the root cause
82
+ - Describe the fix approach
83
+ - List the test coverage added
84
+ 3. Present the PR details to the user for review
85
+ 4. Create the PR via `gh pr create` (with user approval)
86
+
87
+ </process>
@@ -0,0 +1,74 @@
1
+ # Dependency Upgrade Workflow
2
+
3
+ <template_meta>
4
+ name: dep-upgrade
5
+ version: 1
6
+ requires_project: false
7
+ artifact_dir: .gsd/workflows/upgrades/
8
+ </template_meta>
9
+
10
+ <purpose>
11
+ Upgrade project dependencies safely. Assess breaking changes before upgrading,
12
+ fix issues incrementally, and verify everything works. Handles both single-package
13
+ upgrades and bulk dependency refresh.
14
+ </purpose>
15
+
16
+ <phases>
17
+ 1. assess — Analyze what's outdated and what will break
18
+ 2. upgrade — Apply upgrades incrementally
19
+ 3. fix — Resolve breaking changes
20
+ 4. verify — Full test suite and build validation
21
+ </phases>
22
+
23
+ <process>
24
+
25
+ ## Phase 1: Assess
26
+
27
+ **Goal:** Know what you're getting into before changing versions.
28
+
29
+ 1. **List outdated dependencies:** Run `npm outdated` / equivalent
30
+ 2. **For each target upgrade:**
31
+ - Read the changelog / release notes
32
+ - Identify breaking changes
33
+ - Check for known migration guides
34
+ - Assess impact on the codebase (grep for affected APIs)
35
+ 3. **Prioritize:** Which upgrades to do now, which to defer
36
+ 4. **Produce:** Write `ASSESSMENT.md` with:
37
+ - Dependency list with current → target versions
38
+ - Breaking changes per dependency
39
+ - Upgrade order (dependencies before dependents)
40
+ - Risk assessment
41
+
42
+ 5. **Gate:** Review assessment with user. Confirm upgrade scope.
43
+
44
+ ## Phase 2: Upgrade
45
+
46
+ **Goal:** Apply version bumps incrementally.
47
+
48
+ 1. Upgrade one dependency (or one group of related dependencies) at a time
49
+ 2. Run tests after each upgrade
50
+ 3. Commit each upgrade: `chore(deps): upgrade <package> to <version>`
51
+ 4. If tests fail, move to Phase 3 for that dependency before continuing
52
+
53
+ ## Phase 3: Fix
54
+
55
+ **Goal:** Resolve any breaking changes from upgrades.
56
+
57
+ 1. Fix API changes, type errors, deprecations
58
+ 2. Update configuration if needed
59
+ 3. Commit fixes separately from the upgrade: `fix(deps): adapt to <package> v<version> changes`
60
+
61
+ ## Phase 4: Verify
62
+
63
+ **Goal:** Ensure everything works together.
64
+
65
+ 1. Run the full test suite
66
+ 2. Run the build
67
+ 3. Run the linter
68
+ 4. Check for deprecation warnings in output
69
+ 5. **Produce:** Write `SUMMARY.md` with:
70
+ - Dependencies upgraded (from → to)
71
+ - Breaking changes encountered and how they were resolved
72
+ - Any deferred upgrades and why
73
+
74
+ </process>
@@ -0,0 +1,41 @@
1
+ # Full Project Workflow
2
+
3
+ <template_meta>
4
+ name: full-project
5
+ version: 1
6
+ requires_project: true
7
+ artifact_dir: .gsd/
8
+ </template_meta>
9
+
10
+ <purpose>
11
+ The complete GSD workflow with full ceremony: roadmap, milestones, slices, tasks,
12
+ research, planning, execution, and verification. Use for greenfield projects or
13
+ major features that need the full planning apparatus.
14
+
15
+ This template wraps the existing GSD workflow for registry completeness.
16
+ When selected, it routes to the standard /gsd init → /gsd auto pipeline.
17
+ </purpose>
18
+
19
+ <phases>
20
+ 1. init — Initialize project, detect stack, create .gsd/
21
+ 2. discuss — Define requirements, decisions, and architecture
22
+ 3. plan — Create roadmap with milestones and slices
23
+ 4. execute — Execute slices: research → plan → implement → verify per slice
24
+ 5. verify — Milestone-level verification and completion
25
+ </phases>
26
+
27
+ <process>
28
+
29
+ ## Routing to Standard GSD
30
+
31
+ This template is a convenience entry point. When selected via `/gsd start full-project`,
32
+ it should route to the standard GSD workflow:
33
+
34
+ 1. If `.gsd/` doesn't exist: Run `/gsd init` to bootstrap the project
35
+ 2. If `.gsd/` exists but no milestones: Start the discuss phase via `/gsd discuss`
36
+ 3. If milestones exist: Resume via `/gsd auto` or `/gsd next`
37
+
38
+ The full GSD workflow protocol is defined in `GSD-WORKFLOW.md` and handles all
39
+ phases, state tracking, and agent orchestration.
40
+
41
+ </process>
@@ -0,0 +1,45 @@
1
+ # Hotfix Workflow
2
+
3
+ <template_meta>
4
+ name: hotfix
5
+ version: 1
6
+ requires_project: false
7
+ artifact_dir: null
8
+ </template_meta>
9
+
10
+ <purpose>
11
+ Minimal ceremony for urgent fixes. Fix it, test it, ship it. No planning artifacts,
12
+ no research phase, no lengthy documentation. For when production is broken and
13
+ speed matters.
14
+ </purpose>
15
+
16
+ <phases>
17
+ 1. fix — Identify and fix the issue
18
+ 2. ship — Test, commit, and create PR
19
+ </phases>
20
+
21
+ <process>
22
+
23
+ ## Phase 1: Fix
24
+
25
+ **Goal:** Find and fix the issue as fast as possible.
26
+
27
+ 1. Identify the broken behavior
28
+ 2. Locate the root cause
29
+ 3. Implement the minimal fix
30
+ 4. Add a regression test if possible (don't block on this if the fix is urgent)
31
+ 5. Commit: `fix(<scope>): <description>`
32
+
33
+ ## Phase 2: Ship
34
+
35
+ **Goal:** Get the fix deployed.
36
+
37
+ 1. Run tests — fix any failures
38
+ 2. Run the build
39
+ 3. Push and create PR with:
40
+ - What broke
41
+ - What the fix does
42
+ - How to verify
43
+ 4. Present PR to user for approval
44
+
45
+ </process>