gsd-pi 2.71.0-dev.e17e0ce → 2.72.0-dev.de4c4b3

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 (159) hide show
  1. package/README.md +34 -1
  2. package/dist/cli.js +17 -0
  3. package/dist/mcp-server.js +37 -14
  4. package/dist/resources/agents/debugger.md +58 -0
  5. package/dist/resources/agents/doc-writer.md +43 -0
  6. package/dist/resources/agents/git-ops.md +56 -0
  7. package/dist/resources/agents/javascript-pro.md +46 -271
  8. package/dist/resources/agents/planner.md +55 -0
  9. package/dist/resources/agents/refactorer.md +47 -0
  10. package/dist/resources/agents/reviewer.md +48 -0
  11. package/dist/resources/agents/security.md +59 -0
  12. package/dist/resources/agents/tester.md +50 -0
  13. package/dist/resources/agents/typescript-pro.md +41 -235
  14. package/dist/resources/extensions/claude-code-cli/stream-adapter.js +103 -6
  15. package/dist/resources/extensions/gsd/auto/phases.js +4 -0
  16. package/dist/resources/extensions/gsd/auto-prompts.js +88 -33
  17. package/dist/resources/extensions/gsd/auto-start.js +24 -4
  18. package/dist/resources/extensions/gsd/auto.js +4 -0
  19. package/dist/resources/extensions/gsd/bootstrap/db-tools.js +3 -3
  20. package/dist/resources/extensions/gsd/bootstrap/register-shortcuts.js +2 -5
  21. package/dist/resources/extensions/gsd/doctor-providers.js +23 -0
  22. package/dist/resources/extensions/gsd/error-classifier.js +4 -1
  23. package/dist/resources/extensions/gsd/gate-registry.js +208 -0
  24. package/dist/resources/extensions/gsd/gsd-db.js +41 -0
  25. package/dist/resources/extensions/gsd/milestone-validation-gates.js +11 -12
  26. package/dist/resources/extensions/gsd/notification-overlay.js +26 -12
  27. package/dist/resources/extensions/gsd/notification-store.js +5 -4
  28. package/dist/resources/extensions/gsd/prompt-validation.js +126 -0
  29. package/dist/resources/extensions/gsd/prompts/complete-slice.md +3 -1
  30. package/dist/resources/extensions/gsd/prompts/execute-task.md +2 -0
  31. package/dist/resources/extensions/gsd/prompts/validate-milestone.md +2 -0
  32. package/dist/resources/extensions/gsd/shortcut-defs.js +7 -1
  33. package/dist/resources/extensions/gsd/state.js +9 -2
  34. package/dist/resources/extensions/gsd/tools/complete-slice.js +52 -1
  35. package/dist/resources/extensions/gsd/tools/complete-task.js +51 -1
  36. package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +4 -1
  37. package/dist/resources/extensions/ollama/index.js +13 -5
  38. package/dist/resources/extensions/shared/gsd-phase-state.js +35 -0
  39. package/dist/resources/extensions/subagent/agents.js +8 -0
  40. package/dist/resources/extensions/subagent/index.js +17 -0
  41. package/dist/startup-model-validation.d.ts +0 -1
  42. package/dist/startup-model-validation.js +6 -2
  43. package/dist/web/standalone/.next/BUILD_ID +1 -1
  44. package/dist/web/standalone/.next/app-path-routes-manifest.json +8 -8
  45. package/dist/web/standalone/.next/build-manifest.json +2 -2
  46. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  47. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  48. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  49. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  50. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  51. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  52. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  53. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  54. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  55. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  56. package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
  57. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  58. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  59. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  60. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  61. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  62. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  63. package/dist/web/standalone/.next/server/app/index.html +1 -1
  64. package/dist/web/standalone/.next/server/app/index.rsc +1 -1
  65. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  66. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  67. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  68. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  69. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  70. package/dist/web/standalone/.next/server/app-paths-manifest.json +8 -8
  71. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  72. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  73. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  74. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  75. package/package.json +1 -1
  76. package/packages/mcp-server/dist/server.d.ts +12 -1
  77. package/packages/mcp-server/dist/server.d.ts.map +1 -1
  78. package/packages/mcp-server/dist/server.js +90 -42
  79. package/packages/mcp-server/dist/server.js.map +1 -1
  80. package/packages/mcp-server/dist/workflow-tools.js +1 -1
  81. package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
  82. package/packages/mcp-server/src/server.ts +110 -38
  83. package/packages/mcp-server/src/workflow-tools.ts +1 -1
  84. package/packages/pi-coding-agent/dist/core/model-resolver.test.d.ts +8 -0
  85. package/packages/pi-coding-agent/dist/core/model-resolver.test.d.ts.map +1 -0
  86. package/packages/pi-coding-agent/dist/core/model-resolver.test.js +75 -0
  87. package/packages/pi-coding-agent/dist/core/model-resolver.test.js.map +1 -0
  88. package/packages/pi-coding-agent/dist/core/retry-handler.d.ts +5 -0
  89. package/packages/pi-coding-agent/dist/core/retry-handler.d.ts.map +1 -1
  90. package/packages/pi-coding-agent/dist/core/retry-handler.js +55 -1
  91. package/packages/pi-coding-agent/dist/core/retry-handler.js.map +1 -1
  92. package/packages/pi-coding-agent/dist/core/retry-handler.test.js +57 -0
  93. package/packages/pi-coding-agent/dist/core/retry-handler.test.js.map +1 -1
  94. package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  95. package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.js +9 -2
  96. package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.js.map +1 -1
  97. package/packages/pi-coding-agent/dist/modes/interactive/controllers/model-controller.d.ts.map +1 -1
  98. package/packages/pi-coding-agent/dist/modes/interactive/controllers/model-controller.js +6 -1
  99. package/packages/pi-coding-agent/dist/modes/interactive/controllers/model-controller.js.map +1 -1
  100. package/packages/pi-coding-agent/package.json +1 -1
  101. package/packages/pi-coding-agent/src/core/model-resolver.test.ts +85 -0
  102. package/packages/pi-coding-agent/src/core/retry-handler.test.ts +83 -0
  103. package/packages/pi-coding-agent/src/core/retry-handler.ts +60 -1
  104. package/packages/pi-coding-agent/src/modes/interactive/components/model-selector.ts +15 -6
  105. package/packages/pi-coding-agent/src/modes/interactive/controllers/model-controller.ts +6 -1
  106. package/pkg/package.json +1 -1
  107. package/src/resources/agents/debugger.md +58 -0
  108. package/src/resources/agents/doc-writer.md +43 -0
  109. package/src/resources/agents/git-ops.md +56 -0
  110. package/src/resources/agents/javascript-pro.md +46 -271
  111. package/src/resources/agents/planner.md +55 -0
  112. package/src/resources/agents/refactorer.md +47 -0
  113. package/src/resources/agents/reviewer.md +48 -0
  114. package/src/resources/agents/security.md +59 -0
  115. package/src/resources/agents/tester.md +50 -0
  116. package/src/resources/agents/typescript-pro.md +41 -235
  117. package/src/resources/extensions/claude-code-cli/stream-adapter.ts +109 -3
  118. package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +133 -2
  119. package/src/resources/extensions/gsd/auto/phases.ts +4 -0
  120. package/src/resources/extensions/gsd/auto-prompts.ts +111 -33
  121. package/src/resources/extensions/gsd/auto-start.ts +31 -4
  122. package/src/resources/extensions/gsd/auto.ts +4 -0
  123. package/src/resources/extensions/gsd/bootstrap/db-tools.ts +3 -3
  124. package/src/resources/extensions/gsd/bootstrap/register-shortcuts.ts +2 -5
  125. package/src/resources/extensions/gsd/doctor-providers.ts +24 -0
  126. package/src/resources/extensions/gsd/error-classifier.ts +4 -1
  127. package/src/resources/extensions/gsd/gate-registry.ts +251 -0
  128. package/src/resources/extensions/gsd/gsd-db.ts +51 -0
  129. package/src/resources/extensions/gsd/milestone-validation-gates.ts +11 -13
  130. package/src/resources/extensions/gsd/notification-overlay.ts +27 -11
  131. package/src/resources/extensions/gsd/notification-store.ts +5 -4
  132. package/src/resources/extensions/gsd/prompt-validation.ts +157 -0
  133. package/src/resources/extensions/gsd/prompts/complete-slice.md +3 -1
  134. package/src/resources/extensions/gsd/prompts/execute-task.md +2 -0
  135. package/src/resources/extensions/gsd/prompts/validate-milestone.md +2 -0
  136. package/src/resources/extensions/gsd/shortcut-defs.ts +8 -1
  137. package/src/resources/extensions/gsd/state.ts +13 -2
  138. package/src/resources/extensions/gsd/tests/auto-start-model-capture.test.ts +14 -0
  139. package/src/resources/extensions/gsd/tests/complete-slice-gate-closure.test.ts +167 -0
  140. package/src/resources/extensions/gsd/tests/doctor-providers.test.ts +36 -0
  141. package/src/resources/extensions/gsd/tests/format-shortcut.test.ts +16 -0
  142. package/src/resources/extensions/gsd/tests/gate-dispatch.test.ts +27 -0
  143. package/src/resources/extensions/gsd/tests/gate-registry.test.ts +140 -0
  144. package/src/resources/extensions/gsd/tests/prompt-system-gate-coverage.test.ts +208 -0
  145. package/src/resources/extensions/gsd/tests/provider-errors.test.ts +9 -0
  146. package/src/resources/extensions/gsd/tests/register-shortcuts.test.ts +3 -2
  147. package/src/resources/extensions/gsd/tools/complete-slice.ts +63 -0
  148. package/src/resources/extensions/gsd/tools/complete-task.ts +63 -0
  149. package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +4 -1
  150. package/src/resources/extensions/gsd/types.ts +26 -0
  151. package/src/resources/extensions/ollama/index.ts +13 -3
  152. package/src/resources/extensions/ollama/ollama-status-indicator.test.ts +28 -0
  153. package/src/resources/extensions/shared/gsd-phase-state.ts +42 -0
  154. package/src/resources/extensions/shared/tests/gsd-phase-state.test.ts +48 -0
  155. package/src/resources/extensions/subagent/agents.ts +10 -0
  156. package/src/resources/extensions/subagent/index.ts +18 -0
  157. package/src/resources/extensions/subagent/tests/agents-conflicts.test.ts +33 -0
  158. /package/dist/web/standalone/.next/static/{cYPZv_bAhZk2ms-Pz6vsY → f-Gremw0nLxxFUySaHRPw}/_buildManifest.js +0 -0
  159. /package/dist/web/standalone/.next/static/{cYPZv_bAhZk2ms-Pz6vsY → f-Gremw0nLxxFUySaHRPw}/_ssgManifest.js +0 -0
package/README.md CHANGED
@@ -40,12 +40,34 @@ One command. Walk away. Come back to a built project with clean git history.
40
40
  - **isError flag propagation** — workflow tool execution failures now correctly return `isError: true`, so MCP clients can distinguish success from failure.
41
41
  - **Multi-round discuss questions** — new-project discuss phase supports multi-round questioning with structured question gates.
42
42
 
43
- ### TUI Fixes
43
+ ### Model Selection Hardening
44
44
 
45
+ - **Unconfigured models blocked** — models without a configured provider are filtered from selection surfaces, preventing dispatch failures.
46
+ - **Provider readiness required** — saved default model selection now verifies the provider is ready before accepting it.
47
+ - **Session override honored** — `/gsd model` selection persists as a session override across all dispatch phases.
48
+ - **Minimal context guard** — model override logic is skipped in minimal command contexts where it doesn't apply.
49
+
50
+ ### Auto-Mode Resilience
51
+
52
+ - **Credential cooldown recovery** — auto-mode survives transient 429 rate-limit responses with structured cooldown errors and a bounded retry budget.
53
+ - **Fire-and-forget auto start** — auto start is detached from active turns to prevent blocking.
54
+ - **Scoped forensics** — stuck-loop forensics are now scoped to auto sessions only, preventing false positives in interactive use.
55
+
56
+ ### TUI Improvements
57
+
58
+ - **Overlay subscription fix** — resolved overlay subscription lifecycle and `Ctrl+Shift+P` shortcut conflict.
59
+ - **Improved overlays and shortcuts** — GSD overlays, keyboard shortcuts, and notification flows redesigned for consistency.
45
60
  - **Pinned output restored** — pinned output bar displays above the editor during tool execution again.
46
61
  - **Turn completion cleanup** — pinned latest output is cleared on turn completion, preventing stale output from persisting.
47
62
  - **Secure input masking** — extension input values are masked in interactive mode when collecting secrets.
48
63
 
64
+ ### Provider Fixes
65
+
66
+ - **Full OAuth login URLs** — OAuth login URLs are now displayed in full instead of being truncated.
67
+ - **MiniMax bearer auth** — MiniMax Anthropic API requests use proper bearer authentication.
68
+ - **Case-insensitive tool rendering** — renderable tool matching is now case-insensitive, fixing missed tool output.
69
+ - **Headless idle timeout** — idle timeout is kept off during interactive tool execution in headless mode.
70
+
49
71
  ### Reliability & Internals
50
72
 
51
73
  - **TOCTOU file locking** — race conditions in event log and custom workflow graph file locking are fixed with proper atomic lock acquisition.
@@ -54,6 +76,9 @@ One command. Walk away. Come back to a built project with clean git history.
54
76
  - **Model routing transparency** — dynamic routing is skipped for interactive dispatches; model changes are always shown in the banner.
55
77
  - **Capability-aware routing (ADR-004)** — full implementation of capability scoring, `before_model_select` hook, and task metadata extraction.
56
78
  - **Multi-model provider strategy (ADR-005)** — infrastructure for multi-provider model selection wired into live paths.
79
+ - **Anti-fabrication guardrails** — discuss prompts enforce turn-taking to prevent fabricated user responses.
80
+ - **Milestone worktree cleanup** — merged worktree cleanup uses the milestone branch instead of generic lookups.
81
+ - **Tool cache control** — `cache_control` breakpoints added to tool definitions for improved prompt caching.
57
82
 
58
83
  See the full [Changelog](./CHANGELOG.md) for details on every release.
59
84
 
@@ -732,6 +757,14 @@ Use expensive models where quality matters (planning, complex execution) and che
732
757
 
733
758
  ---
734
759
 
760
+ ## Ecosystem
761
+
762
+ | Project | Description |
763
+ | ------- | ----------- |
764
+ | [GSD2 Config Utility](https://github.com/jeremymcs/gsd2-config) | Standalone configuration tool for managing GSD preferences, providers, and API keys |
765
+
766
+ ---
767
+
735
768
  ## Star History
736
769
 
737
770
  <a href="https://star-history.com/#gsd-build/gsd-2&Date">
package/dist/cli.js CHANGED
@@ -234,6 +234,14 @@ if (cliFlags.messages[0] === 'sessions') {
234
234
  rl.question(chalk.bold(' Enter session number to resume (or q to quit): '), resolve);
235
235
  });
236
236
  rl.close();
237
+ // Clean up stdin state left by readline.createInterface().
238
+ // Without this, downstream TUI initialization gets corrupted listeners and exhibits
239
+ // duplicate terminal I/O. Match the pattern used after onboarding cleanup.
240
+ process.stdin.removeAllListeners('data');
241
+ process.stdin.removeAllListeners('keypress');
242
+ if (process.stdin.setRawMode)
243
+ process.stdin.setRawMode(false);
244
+ process.stdin.pause();
237
245
  const choice = parseInt(answer, 10);
238
246
  if (isNaN(choice) || choice < 1 || choice > toShow.length) {
239
247
  process.stderr.write(chalk.dim('Cancelled.\n'));
@@ -471,6 +479,15 @@ if (isPrintMode) {
471
479
  if (mode === 'mcp') {
472
480
  printStartupTimings();
473
481
  const { startMcpServer } = await import('./mcp-server.js');
482
+ // Activate every registered tool before starting the MCP transport.
483
+ // `session.agent.state.tools` is the *active* subset, not the full
484
+ // registry — if we expose only the active set, extension-registered
485
+ // tools (gsd workflow, browser-tools, mac-tools, search-the-web, …)
486
+ // are invisible to MCP clients. Flipping the active set to every
487
+ // known tool name makes `state.tools` mirror the full registry for
488
+ // this MCP session, which is what an external client expects.
489
+ const allToolNames = session.getAllTools().map((t) => t.name);
490
+ session.setActiveToolsByName(allToolNames);
474
491
  await startMcpServer({
475
492
  tools: session.agent.state.tools ?? [],
476
493
  version: process.env.GSD_VERSION || '0.0.0',
@@ -1,10 +1,15 @@
1
- // MCP SDK subpath imports use wildcard exports (./*) that NodeNext resolves
2
- // at runtime but TypeScript cannot statically type-check. We construct the
3
- // specifiers dynamically so tsc treats them as `any`.
1
+ // MCP SDK subpath imports use wildcard exports (./*) in @modelcontextprotocol/sdk's
2
+ // package.json export map. The wildcard maps "./foo" "./dist/cjs/foo" (no .js
3
+ // suffix), so bare subpath specifiers like `${MCP_PKG}/server/stdio` resolve to
4
+ // a non-existent file. Historically the workaround (#3603) used createRequire so
5
+ // the CJS resolver could auto-append `.js`; that no longer works with current
6
+ // Node + SDK releases (#3914) — `_require.resolve` also fails with
7
+ // "Cannot find module .../dist/cjs/server/stdio".
4
8
  //
5
- // Use explicit .js subpaths for modules that are loaded dynamically at runtime.
6
- // Recent Node / SDK combinations do not reliably resolve the extensionless
7
- // wildcard targets for `server/stdio` and `types` (#3914).
9
+ // The reliable convention (matching packages/mcp-server/{server,cli}.ts) is to
10
+ // write the `.js` suffix explicitly on every wildcard subpath. Specifiers are
11
+ // built via a template string so TypeScript's NodeNext resolver treats them as
12
+ // `any` and skips static checking.
8
13
  const MCP_PKG = '@modelcontextprotocol/sdk';
9
14
  /**
10
15
  * Starts a native MCP (Model Context Protocol) server over stdin/stdout.
@@ -22,7 +27,7 @@ const MCP_PKG = '@modelcontextprotocol/sdk';
22
27
  */
23
28
  export async function startMcpServer(options) {
24
29
  const { tools, version = '0.0.0' } = options;
25
- const serverMod = await import(`${MCP_PKG}/server`);
30
+ const serverMod = await import(`${MCP_PKG}/server/index.js`);
26
31
  const stdioMod = await import(`${MCP_PKG}/server/stdio.js`);
27
32
  const typesMod = await import(`${MCP_PKG}/types.js`);
28
33
  const Server = serverMod.Server;
@@ -42,8 +47,14 @@ export async function startMcpServer(options) {
42
47
  inputSchema: t.parameters,
43
48
  })),
44
49
  }));
45
- // tools/call — execute the requested tool and return content blocks
46
- server.setRequestHandler(CallToolRequestSchema, async (request) => {
50
+ // tools/call — execute the requested tool and return content blocks.
51
+ //
52
+ // The MCP SDK passes an `extra` argument to request handlers that includes
53
+ // an AbortSignal scoped to the RPC request (cancelled when the client
54
+ // cancels the tool call or the transport closes). Threading it into
55
+ // AgentTool.execute ensures long-running tools (Bash, WebFetch, grep on
56
+ // huge trees) actually stop when the client gives up on the result.
57
+ server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
47
58
  const { name, arguments: args } = request.params;
48
59
  const tool = toolMap.get(name);
49
60
  if (!tool) {
@@ -52,20 +63,32 @@ export async function startMcpServer(options) {
52
63
  content: [{ type: 'text', text: `Unknown tool: ${name}` }],
53
64
  };
54
65
  }
66
+ const signal = extra?.signal;
55
67
  try {
56
- const result = await tool.execute(`mcp-${Date.now()}`, args ?? {}, undefined, // no AbortSignal
57
- undefined);
58
- // Convert AgentToolResult content blocks to MCP content format
68
+ const result = await tool.execute(`mcp-${Date.now()}`, args ?? {}, signal, undefined);
69
+ // Convert AgentToolResult content blocks to MCP content format.
70
+ // text and image pass through; any other shape is serialized as text
71
+ // so the client sees the payload rather than an empty response.
59
72
  const content = result.content.map((block) => {
60
73
  if (block.type === 'text')
61
74
  return { type: 'text', text: block.text ?? '' };
62
- if (block.type === 'image')
63
- return { type: 'image', data: block.data ?? '', mimeType: block.mimeType ?? 'image/png' };
75
+ if (block.type === 'image') {
76
+ return {
77
+ type: 'image',
78
+ data: block.data ?? '',
79
+ mimeType: block.mimeType ?? 'image/png',
80
+ };
81
+ }
82
+ // Preserve unknown block types (resource, resource_link, audio, ...)
83
+ // by stringifying into a text block so clients see the payload.
64
84
  return { type: 'text', text: JSON.stringify(block) };
65
85
  });
66
86
  return { content };
67
87
  }
68
88
  catch (err) {
89
+ // AbortError from a cancelled tool surfaces as a normal error — MCP
90
+ // clients interpret `isError: true` as a failed call, which is the
91
+ // correct behaviour for a cancelled request.
69
92
  const message = err instanceof Error ? err.message : String(err);
70
93
  return { isError: true, content: [{ type: 'text', text: message }] };
71
94
  }
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: debugger
3
+ description: Hypothesis-driven bug investigation with root cause analysis
4
+ model: sonnet
5
+ ---
6
+
7
+ You are a debugger. Investigate bugs using a systematic, hypothesis-driven approach. Your goal is to find the root cause, not just suppress symptoms.
8
+
9
+ ## Process
10
+
11
+ 1. **Reproduce**: Understand the symptoms — what happens vs. what should happen
12
+ 2. **Hypothesize**: List 2-3 most likely causes based on symptoms
13
+ 3. **Investigate**: For each hypothesis, gather evidence (read code, check logs, trace execution)
14
+ 4. **Narrow**: Eliminate hypotheses that don't match the evidence
15
+ 5. **Root cause**: Identify the actual cause with file:line references
16
+ 6. **Fix**: Propose the minimal change that addresses the root cause
17
+
18
+ ## Investigation Tools
19
+
20
+ - Read source files at specific line ranges
21
+ - Grep for error messages, function names, variable usage
22
+ - Check git blame for recent changes to suspect areas
23
+ - Read test files to understand expected behavior
24
+ - Run tests to reproduce failures
25
+
26
+ ## Output Format
27
+
28
+ ## Symptoms
29
+
30
+ What's happening vs. what's expected.
31
+
32
+ ## Hypotheses
33
+
34
+ 1. **[hypothesis]** — why this could be the cause
35
+ 2. **[hypothesis]** — why this could be the cause
36
+
37
+ ## Investigation
38
+
39
+ ### Hypothesis 1: [name]
40
+
41
+ Evidence gathered, files read, what was found.
42
+ **Verdict:** Confirmed / Eliminated — reason.
43
+
44
+ ### Hypothesis 2: [name]
45
+
46
+ (same structure)
47
+
48
+ ## Root Cause
49
+
50
+ **File:** `path/to/file.ts:42`
51
+ **Cause:** Clear explanation of the bug.
52
+ **Why it wasn't caught:** Missing test, edge case, etc.
53
+
54
+ ## Recommended Fix
55
+
56
+ ```typescript
57
+ // minimal fix with explanation
58
+ ```
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: doc-writer
3
+ description: Documentation generation from code — API docs, inline comments, READMEs
4
+ model: sonnet
5
+ ---
6
+
7
+ You are a documentation specialist. You read code and produce clear, accurate documentation. You write for the reader, not the author — explain what they need to know to use or maintain the code.
8
+
9
+ ## Process
10
+
11
+ 1. Read the code thoroughly — understand what it does, not just how
12
+ 2. Identify the audience — users (API docs), maintainers (inline docs), or newcomers (guides)
13
+ 3. Write documentation that answers the reader's actual questions
14
+ 4. Verify accuracy — every code reference must match the current implementation
15
+
16
+ ## Documentation Types
17
+
18
+ - **API docs**: Function signatures, parameters, return values, examples, error cases
19
+ - **Inline comments**: Explain *why*, not *what* — the code shows what, comments explain intent
20
+ - **Module docs**: What this module does, its public API, and how it fits in the architecture
21
+ - **Guides**: Step-by-step instructions for common tasks with working examples
22
+
23
+ ## Quality Rules
24
+
25
+ - Every claim must be verifiable against the current code
26
+ - Examples must be working code, not pseudocode
27
+ - Don't document the obvious — focus on non-obvious behavior, gotchas, and edge cases
28
+ - Keep it concise — more docs isn't better docs
29
+ - Use the project's existing documentation style and format
30
+
31
+ ## Output Format
32
+
33
+ ## Documentation Plan
34
+
35
+ What to document and for whom.
36
+
37
+ ## Documentation
38
+
39
+ (The actual documentation content, formatted appropriately for its type)
40
+
41
+ ## Accuracy Check
42
+
43
+ Files referenced and verified against current implementation.
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: git-ops
3
+ description: Conflict resolution, rebase strategy, PR preparation, and changelog generation
4
+ model: sonnet
5
+ ---
6
+
7
+ You are a git operations specialist. You handle merge conflicts, plan rebase strategies, prepare pull requests, and generate changelogs. You understand git internals well enough to choose the right strategy for each situation.
8
+
9
+ ## Capabilities
10
+
11
+ ### Conflict Resolution
12
+ - Analyze conflict markers and understand both sides' intent
13
+ - Choose the correct resolution based on code context, not just recency
14
+ - Verify resolved code compiles and tests pass
15
+
16
+ ### Rebase Strategy
17
+ - Assess whether rebase or merge is appropriate for the situation
18
+ - Plan interactive rebase sequences (squash, reorder, edit)
19
+ - Handle complex rebase conflicts with minimal manual intervention
20
+
21
+ ### PR Preparation
22
+ - Write clear PR titles and descriptions from commit history
23
+ - Organize commits into logical, reviewable units
24
+ - Ensure CI checks will pass before pushing
25
+
26
+ ### Changelog Generation
27
+ - Extract user-facing changes from commit messages and code diffs
28
+ - Categorize changes (features, fixes, breaking changes)
29
+ - Write changelog entries for the target audience (users, not developers)
30
+
31
+ ## Process
32
+
33
+ 1. Assess the git state — branches, commits, conflicts, divergence
34
+ 2. Determine the goal — clean history, resolved conflicts, PR ready
35
+ 3. Plan the steps — in order, with rollback points
36
+ 4. Execute carefully — verify after each step
37
+ 5. Confirm the result — clean history, passing tests
38
+
39
+ ## Output Format
40
+
41
+ ## Git State
42
+
43
+ Current branch, commits, conflicts, or divergence summary.
44
+
45
+ ## Strategy
46
+
47
+ What to do and why this approach.
48
+
49
+ ## Steps
50
+
51
+ 1. Command or action — with expected outcome
52
+ 2. Command or action — with verification
53
+
54
+ ## Result
55
+
56
+ Final state after operations complete.