thachvd-kit 1.0.35 → 1.0.37
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 +11 -1
- package/THIRD_PARTY_NOTICES.md +49 -0
- package/bin/cli.js +74 -24
- package/bin/matt-skills.js +192 -191
- package/bin/native-skills.js +149 -0
- package/bin/upgrade.js +22 -17
- package/package.json +5 -3
- package/skills/finishing-a-development-branch/SKILL.md +240 -0
- package/skills/requesting-code-review/code-reviewer.md +198 -0
- package/skills/subagent-driven-development/SKILL.md +574 -0
- package/skills/subagent-driven-development/implementer-prompt.md +154 -0
- package/skills/subagent-driven-development/re-review-prompt.md +115 -0
- package/skills/subagent-driven-development/scripts/review-package +53 -0
- package/skills/subagent-driven-development/scripts/review-package.js +52 -0
- package/skills/subagent-driven-development/scripts/sdd-workspace +82 -0
- package/skills/subagent-driven-development/scripts/sdd-workspace-lib.js +62 -0
- package/skills/subagent-driven-development/scripts/sdd-workspace.js +15 -0
- package/skills/subagent-driven-development/scripts/task-brief +43 -0
- package/skills/subagent-driven-development/scripts/task-brief.js +46 -0
- package/skills/subagent-driven-development/task-reviewer-prompt.md +207 -0
- package/skills/upstream.json +30 -0
- package/skills/using-git-worktrees/SKILL.md +175 -0
package/bin/upgrade.js
CHANGED
|
@@ -116,23 +116,25 @@ function replaceLegacyLine(text, legacyLine, replacementLine) {
|
|
|
116
116
|
|
|
117
117
|
const AGENTS_WORKFLOW_SECTION = `## Workflow
|
|
118
118
|
|
|
119
|
-
Matt Pocock's promoted skills (installed under \`.agents/skills/\` by \`thachvd-kit setup\`) are the workflow layer. Use the matching skill when a specialized workflow is useful:
|
|
119
|
+
Matt Pocock's promoted skills plus thachvd-kit's native workflow skills (installed under \`.agents/skills/\` and \`.claude/skills/\` by \`thachvd-kit setup\`) are the workflow layer. Use the matching skill when a specialized workflow is useful:
|
|
120
120
|
|
|
121
121
|
- Clear, localized change: inspect -> edit -> focused verification. Do not force a heavyweight skill.
|
|
122
122
|
- Ambiguous feature or design: \`/grill-with-docs\`, then optionally \`/to-spec\` for a durable contract.
|
|
123
|
-
- Normal feature: \`/grill-with-docs\` -> \`/to-spec\` -> \`/implement\`.
|
|
124
|
-
- Large feature needing decomposition: add \`/to-tickets\`
|
|
123
|
+
- Normal feature: \`/grill-with-docs\` -> \`/to-spec\` -> choose workspace -> \`/implement\`.
|
|
124
|
+
- Large feature needing decomposition: add \`/to-tickets\`, choose workspace, then choose \`/implement\` or \`/subagent-driven-development\`.
|
|
125
125
|
- Huge, multi-session uncertainty: \`/wayfinder\`.
|
|
126
126
|
- Bug or failing behavior: \`/diagnosing-bugs\`.
|
|
127
127
|
- Test-driven implementation: \`/tdd\` (skip the ceremony for trivial config/text changes).
|
|
128
128
|
- Architecture survey: \`/improve-codebase-architecture\`; use \`/codebase-design\` as the design vocabulary.
|
|
129
129
|
- Pre-completion review: \`/code-review\` once when code risk warrants it.
|
|
130
|
+
- Workspace choice: stay on the current branch when explicitly requested; use \`/using-git-worktrees\` only when isolation is wanted.
|
|
131
|
+
- Branch handoff: \`/finishing-a-development-branch\` after verification and review.
|
|
130
132
|
|
|
131
133
|
If unsure which skill fits, use \`/ask-matt\`.
|
|
132
134
|
|
|
133
135
|
Questions and research do not edit product code. A fast path is allowed only when the change is localized, mechanically obvious, low-risk, and has focused verification; file count alone is not a gate. State the scope and verification before editing. If the task becomes ambiguous or its behavior, contract, or risk surface grows, use the matching planning skill above instead.
|
|
134
136
|
|
|
135
|
-
See \`.agent/docs/workflow.md\` for the full route matrix. This kit does not implement a second workflow engine; it
|
|
137
|
+
See \`.agent/docs/workflow.md\` for the full route matrix. This kit does not implement a second Matt workflow engine; it installs Matt's promoted skills plus thachvd-kit native skills (\`thachvd-kit skills install|check|update\`).`;
|
|
136
138
|
|
|
137
139
|
function migrateAgentsStyleMarkdown(content) {
|
|
138
140
|
let text = normalize(content);
|
|
@@ -146,7 +148,7 @@ function migrateAgentsStyleMarkdown(content) {
|
|
|
146
148
|
text = replaceLegacyLine(
|
|
147
149
|
text,
|
|
148
150
|
'Use Superpowers as the workflow backend. Use direct local evidence when it is sufficient and structural tooling such as codebase-memory MCP only when ownership, call paths, architecture, or impact need discovery.',
|
|
149
|
-
"Use Matt Pocock's promoted skills (`.agents/skills/`) as the workflow
|
|
151
|
+
"Use Matt Pocock's promoted and thachvd-kit native skills (`.agents/skills/` and `.claude/skills/`) as the workflow layer; run `/ask-matt` if unsure which one fits. Use direct local evidence when it is sufficient and structural tooling such as codebase-memory MCP only when ownership, call paths, architecture, or impact need discovery."
|
|
150
152
|
);
|
|
151
153
|
return text;
|
|
152
154
|
}
|
|
@@ -158,8 +160,8 @@ const WORKFLOW_ROUTE_MATRIX_SECTION = `## Route Matrix
|
|
|
158
160
|
| Question or research only | direct answer or research | no product-code edits |
|
|
159
161
|
| Clear, localized change | fast path (no skill) | inspect -> edit -> focused verify |
|
|
160
162
|
| Ambiguous feature or design | /grill-with-docs, then optionally /to-spec | durable contract before implementation when useful |
|
|
161
|
-
| Normal feature | /grill-with-docs -> /to-spec -> /implement | spec agreed before implementation |
|
|
162
|
-
| Large feature needing decomposition | /grill-with-docs -> /to-spec -> /to-tickets ->
|
|
163
|
+
| Normal feature | /grill-with-docs -> /to-spec -> choose workspace -> /implement | spec agreed before implementation |
|
|
164
|
+
| Large feature needing decomposition | /grill-with-docs -> /to-spec -> /to-tickets -> choose workspace -> executor | tickets agreed before implementation |
|
|
163
165
|
| Huge, multi-session uncertainty | /wayfinder | shared decision map before implementation |
|
|
164
166
|
| Bug or failing behavior | /diagnosing-bugs | reproduce -> root cause -> regression protection -> fix -> verify |
|
|
165
167
|
| Test-driven implementation | /tdd | red -> green -> refactor per slice |
|
|
@@ -170,14 +172,14 @@ Not sure which row applies? Run /ask-matt instead of guessing.`;
|
|
|
170
172
|
|
|
171
173
|
const WORKFLOW_STANDARD_FLOW_SECTION = `## Standard Feature Flow
|
|
172
174
|
|
|
173
|
-
/grill-with-docs -> /to-spec -> (/to-tickets for large work) -> /implement
|
|
175
|
+
/grill-with-docs -> /to-spec -> (/to-tickets for large work) -> choose workspace -> choose executor (/implement or /subagent-driven-development) -> /code-review -> /finishing-a-development-branch.`;
|
|
174
176
|
|
|
175
177
|
function migrateWorkflowMarkdown(content) {
|
|
176
178
|
let text = normalize(content);
|
|
177
179
|
text = replaceLegacyLine(
|
|
178
180
|
text,
|
|
179
181
|
'This project uses Superpowers as the workflow backend. thachvd-kit only provides project context and integration setup.',
|
|
180
|
-
"This project uses Matt Pocock's promoted skills (installed under .agents/skills/ by `thachvd-kit setup`) as the workflow layer.
|
|
182
|
+
"This project uses Matt Pocock's promoted skills plus thachvd-kit's native workflow skills (installed under .agents/skills/ and .claude/skills/ by `thachvd-kit setup`) as the workflow layer. Native skills add opt-in workspace isolation, subagent-driven execution, and branch finishing; they do not replace Matt's planning, implementation, testing, or review skills."
|
|
181
183
|
);
|
|
182
184
|
text = replaceLegacyLine(
|
|
183
185
|
text,
|
|
@@ -192,16 +194,18 @@ function migrateWorkflowMarkdown(content) {
|
|
|
192
194
|
return text;
|
|
193
195
|
}
|
|
194
196
|
|
|
195
|
-
const TOOLING_MATT_SKILLS_SECTION = `## Matt Pocock Skills
|
|
197
|
+
const TOOLING_MATT_SKILLS_SECTION = `## Matt Pocock Skills + Native Workflow Skills
|
|
196
198
|
|
|
197
|
-
Matt Pocock's promoted engineering and productivity skills are
|
|
199
|
+
Matt Pocock's promoted engineering and productivity skills are installed project-locally under \`.agents/skills/\` (never globally); thachvd-kit native workflow skills are installed under \`.agents/skills/\` and \`.claude/skills/\`:
|
|
198
200
|
|
|
199
201
|
- Install the promoted set: \`thachvd-kit skills install\` (\`--dry-run\` to preview the command without running it)
|
|
200
202
|
- Check what is installed: \`thachvd-kit skills check\` (read-only)
|
|
201
203
|
- Update the promoted set: \`thachvd-kit skills update\` (re-adds each skill individually for safety, so it is slower than install — one network clone per skill)
|
|
202
204
|
- The full manifest lives in \`bin/matt-skills.js\` (\`PROMOTED_SKILLS\`); it mirrors upstream's \`skills/engineering/\` + \`skills/productivity/\` catalog and never includes \`in-progress\`, \`misc\`, or \`deprecated\` skills.
|
|
203
205
|
- After the first install, run \`/setup-matt-pocock-skills\` once inside the AI client to configure the issue tracker, triage labels, and generated docs location. thachvd-kit does not simulate that skill.
|
|
204
|
-
- Unsure which skill fits a task? Run \`/ask-matt
|
|
206
|
+
- Unsure which skill fits a task? Run \`/ask-matt\`.
|
|
207
|
+
- Native skills: \`/using-git-worktrees\` (opt-in isolation), \`/subagent-driven-development\` (alternative executor for multi-task plans), and \`/finishing-a-development-branch\`.
|
|
208
|
+
- Native skills are refreshed from bundled copies; runtime updates never fetch upstream repositories.`;
|
|
205
209
|
|
|
206
210
|
function migrateToolingMarkdown(content) {
|
|
207
211
|
const text = normalize(content);
|
|
@@ -212,7 +216,7 @@ const GETTING_STARTED_SETUP_SECTION = `## Setup
|
|
|
212
216
|
|
|
213
217
|
1. Run \`thachvd-kit init\` in the repository.
|
|
214
218
|
2. Open or print \`.agent/docs/index-project-prompt.md\` with \`thachvd-kit prompt\`.
|
|
215
|
-
3. Run \`thachvd-kit setup\` (installs
|
|
219
|
+
3. Run \`thachvd-kit setup\` (installs promoted and native skill sets by default; add \`--no-install-skills\` to skip) and RTK.
|
|
216
220
|
4. Inside the AI client, run \`/setup-matt-pocock-skills\` once to configure the issue tracker, triage labels, and doc layout.
|
|
217
221
|
5. Run \`thachvd-kit doctor\` and restart the AI client.`;
|
|
218
222
|
|
|
@@ -221,8 +225,9 @@ const GETTING_STARTED_STANDARD_FLOW_SECTION = `## Standard Flow
|
|
|
221
225
|
1. \`/grill-with-docs\` for unclear requirements or design.
|
|
222
226
|
2. \`/to-spec\` when a durable implementation contract is useful.
|
|
223
227
|
3. \`/to-tickets\` for large work that benefits from decomposition.
|
|
224
|
-
4.
|
|
225
|
-
5. \`/
|
|
228
|
+
4. Choose the current branch/workspace or \`/using-git-worktrees\` when isolation is wanted.
|
|
229
|
+
5. Choose \`/implement\` (with \`/tdd\` where useful) or \`/subagent-driven-development\` for multiple relatively independent tasks.
|
|
230
|
+
6. \`/code-review\`, then \`/finishing-a-development-branch\` once verification is complete.
|
|
226
231
|
|
|
227
232
|
Not sure which skill fits? Run \`/ask-matt\`.`;
|
|
228
233
|
|
|
@@ -235,7 +240,7 @@ function migrateGettingStartedMarkdown(content) {
|
|
|
235
240
|
text = replaceLegacyLine(
|
|
236
241
|
text,
|
|
237
242
|
'thachvd-kit creates project context. Superpowers owns the development workflow.',
|
|
238
|
-
"thachvd-kit creates project context. Matt Pocock's promoted skills own the development workflow."
|
|
243
|
+
"thachvd-kit creates project context. Matt Pocock's promoted and thachvd-kit native skills own the development workflow."
|
|
239
244
|
);
|
|
240
245
|
text = replaceLegacySection(text, '## Setup', /Install Superpowers and RTK/, GETTING_STARTED_SETUP_SECTION);
|
|
241
246
|
text = replaceLegacySection(text, '## Standard Flow', /Use Superpowers native skills/, GETTING_STARTED_STANDARD_FLOW_SECTION);
|
|
@@ -249,7 +254,7 @@ function migrateIndexProjectPrompt(content) {
|
|
|
249
254
|
return replaceLegacyLine(
|
|
250
255
|
normalize(content),
|
|
251
256
|
'Use Superpowers for the workflow and use codebase-memory MCP for structural code discovery when available.',
|
|
252
|
-
'Use the project\'s Matt Pocock skills for workflow (see AGENTS.md; run /ask-matt if unsure which fits) and use codebase-memory MCP for structural code discovery when available.'
|
|
257
|
+
'Use the project\'s Matt Pocock skills plus thachvd-kit native skills for workflow (see AGENTS.md; run /ask-matt if unsure which fits) and use codebase-memory MCP for structural code discovery when available.'
|
|
253
258
|
);
|
|
254
259
|
}
|
|
255
260
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "thachvd-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.37",
|
|
4
4
|
"description": "Cross-agent project rules bootstrap kit for Codex, Antigravity, and Claude Code",
|
|
5
5
|
"bin": {
|
|
6
6
|
"thachvd-kit": "./bin/entry.js"
|
|
7
7
|
},
|
|
8
8
|
"files": [
|
|
9
9
|
"bin",
|
|
10
|
+
"skills",
|
|
11
|
+
"THIRD_PARTY_NOTICES.md",
|
|
10
12
|
"README.md",
|
|
11
13
|
"LICENSE"
|
|
12
14
|
],
|
|
@@ -15,8 +17,8 @@
|
|
|
15
17
|
"node": ">=16.7"
|
|
16
18
|
},
|
|
17
19
|
"scripts": {
|
|
18
|
-
"test": "node test/cli.test.js && node test/policy.test.js && node test/matt-skills.test.js && node test/upgrade.test.js && node test/global.test.js",
|
|
19
|
-
"release:verify": "npm test && node --check bin/cli.js && node --check bin/entry.js && node --check bin/policy.js && node --check bin/matt-skills.js && node --check bin/upgrade.js && node --check bin/global.js && npm pack --dry-run",
|
|
20
|
+
"test": "node test/cli.test.js && node test/policy.test.js && node test/matt-skills.test.js && node test/native-skills.test.js && node test/upgrade.test.js && node test/global.test.js",
|
|
21
|
+
"release:verify": "npm test && node --check bin/cli.js && node --check bin/entry.js && node --check bin/policy.js && node --check bin/matt-skills.js && node --check bin/native-skills.js && node --check bin/upgrade.js && node --check bin/global.js && node --check skills/subagent-driven-development/scripts/sdd-workspace-lib.js && node --check skills/subagent-driven-development/scripts/sdd-workspace.js && node --check skills/subagent-driven-development/scripts/task-brief.js && node --check skills/subagent-driven-development/scripts/review-package.js && npm pack --dry-run",
|
|
20
22
|
"preversion": "npm run release:verify",
|
|
21
23
|
"release:patch": "npm version patch",
|
|
22
24
|
"release:dry-run": "npm pack --dry-run",
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: finishing-a-development-branch
|
|
3
|
+
description: Use when implementation is complete, all tests pass, and you need to decide how to integrate the work
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Finishing a Development Branch
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
**Core principle:** Verify tests → Detect environment → Present options → Execute choice → Clean up.
|
|
11
|
+
|
|
12
|
+
**Announce at start:** "I'm using the finishing-a-development-branch skill to complete this work."
|
|
13
|
+
|
|
14
|
+
## Step 1: Verify Tests
|
|
15
|
+
|
|
16
|
+
Run the project's full test suite using the documented project command (for example, one of `npm test`, `cargo test`, `pytest`, or `go test ./...`).
|
|
17
|
+
|
|
18
|
+
**If tests fail**, report the failures and stop — the menu comes after a green suite:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
Tests failing (<N> failures). Must fix before completing:
|
|
22
|
+
|
|
23
|
+
[Show failures]
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**If tests pass:** continue to Step 2.
|
|
27
|
+
|
|
28
|
+
## Step 2: Determine Workspace Provenance
|
|
29
|
+
|
|
30
|
+
Determine whether implementation happened in-place or in a task-created isolated workspace. Use the implementation handoff, plan, or conversation as the source of truth:
|
|
31
|
+
|
|
32
|
+
- **In-place:** the user chose the current branch/workspace, or the existing workspace was reused without creating a branch/worktree for this task. This includes an explicitly requested direct change on `main` or another named branch.
|
|
33
|
+
- **Task-created isolated workspace:** this workflow or an explicitly requested `/using-git-worktrees` flow created the branch/worktree for this task.
|
|
34
|
+
- **Unknown:** do not infer task ownership from a named branch, a non-default branch, or Git topology alone. Treat it as in-place unless the human confirms that this task created the branch/worktree.
|
|
35
|
+
|
|
36
|
+
For an in-place workspace, after tests pass report the verified current branch/workspace and hand off. Do not determine a base branch, offer a self-merge, remove the current branch, or remove the current worktree. Pushing or opening a PR remains a separate explicit user decision.
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
Implementation complete in the current workspace on `<branch>`. Tests pass.
|
|
40
|
+
No merge or branch/worktree cleanup is needed. The current branch is ready for handoff.
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Only continue to the environment and integration menu below for a task-created isolated workspace.
|
|
44
|
+
|
|
45
|
+
## Step 3: Detect Environment
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
git rev-parse --git-dir
|
|
49
|
+
git rev-parse --git-common-dir
|
|
50
|
+
git rev-parse --show-toplevel
|
|
51
|
+
git rev-parse --show-superproject-working-tree
|
|
52
|
+
git branch --show-current
|
|
53
|
+
git worktree list --porcelain
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Compare the first two results rather than relying on Bash path normalization. Capture the repository root and worktree path before changing directories. This determines which menu to show and how cleanup works:
|
|
57
|
+
|
|
58
|
+
| State | Menu | Cleanup |
|
|
59
|
+
|-------|------|---------|
|
|
60
|
+
| `--git-dir` equals `--git-common-dir` (normal repo) | Standard 3 options | No worktree to clean up |
|
|
61
|
+
| Values differ, named branch, not a submodule | Standard 3 options | Provenance-based (see Step 7) |
|
|
62
|
+
| Values differ, detached HEAD | Reduced 2 options (no merge) | Externally managed — leave in place |
|
|
63
|
+
|
|
64
|
+
## Step 4: Determine Base Branch
|
|
65
|
+
|
|
66
|
+
The base branch is whatever this work forked from — usually named in the
|
|
67
|
+
plan, the conversation, or the branch's upstream. If it is not already
|
|
68
|
+
known, ask: "This branch split from <your best guess> - is that correct?"
|
|
69
|
+
Confirm before merging: merging into the wrong base is expensive to undo.
|
|
70
|
+
|
|
71
|
+
## Step 5: Present Options
|
|
72
|
+
|
|
73
|
+
**Normal repo and named-branch worktree — present exactly these 3 options:**
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
Implementation complete. What would you like to do?
|
|
77
|
+
|
|
78
|
+
1. Merge back to <base-branch> locally
|
|
79
|
+
2. Push and create a Pull Request
|
|
80
|
+
3. Keep the branch as-is (I'll handle it later)
|
|
81
|
+
|
|
82
|
+
Which option?
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Detached HEAD — present exactly these 2 options:**
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
Implementation complete. You're on a detached HEAD (externally managed workspace).
|
|
89
|
+
|
|
90
|
+
1. Push as new branch and create a Pull Request
|
|
91
|
+
2. Keep as-is (I'll handle it later)
|
|
92
|
+
|
|
93
|
+
Which option?
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Present the menu exactly as written — concise, with every option coming
|
|
97
|
+
from the list above. Discarding the work happens only in response to your
|
|
98
|
+
human partner explicitly asking for it (see "If your human partner asks to
|
|
99
|
+
discard the work" below). Wait for their answer; the integration decision
|
|
100
|
+
is theirs.
|
|
101
|
+
|
|
102
|
+
## Step 6: Execute Choice
|
|
103
|
+
|
|
104
|
+
### Option 1: Merge Locally
|
|
105
|
+
|
|
106
|
+
```text
|
|
107
|
+
# From the main repository root, after confirming the base branch:
|
|
108
|
+
git rev-parse --show-toplevel
|
|
109
|
+
git switch <base-branch>
|
|
110
|
+
git pull
|
|
111
|
+
git merge <feature-branch>
|
|
112
|
+
|
|
113
|
+
# Verify tests on merged result
|
|
114
|
+
<test command>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
If tests fail on the merged result: stop, leave the worktree and branch in
|
|
118
|
+
place, and investigate — nothing has been pushed, so the merge is local
|
|
119
|
+
and recoverable.
|
|
120
|
+
|
|
121
|
+
Once the merged result is green: clean up the worktree (Step 7), then
|
|
122
|
+
delete the branch:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
git branch -d <feature-branch>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Option 2: Push and Create PR
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
git push -u origin <feature-branch>
|
|
132
|
+
# From a detached HEAD, name the new branch on the remote:
|
|
133
|
+
# git push origin HEAD:refs/heads/<new-branch>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Then create the pull/merge request against <base-branch> with the forge's
|
|
137
|
+
tooling — its CLI if one is available, or the creation URL most forges
|
|
138
|
+
print when you push — following the repo's PR template and conventions if
|
|
139
|
+
present, and report the URL to your human partner.
|
|
140
|
+
|
|
141
|
+
Keep the worktree — your human partner iterates on PR feedback there.
|
|
142
|
+
|
|
143
|
+
### Option 3: Keep As-Is
|
|
144
|
+
|
|
145
|
+
Report: "Keeping branch <name>. Worktree preserved at <path>."
|
|
146
|
+
|
|
147
|
+
### If your human partner asks to discard the work
|
|
148
|
+
|
|
149
|
+
This path exists only as a response to an explicit request to throw the
|
|
150
|
+
work away. Confirm first:
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
This will permanently delete:
|
|
154
|
+
- Branch <name>
|
|
155
|
+
- All commits: <commit-list>
|
|
156
|
+
- Worktree at <path>
|
|
157
|
+
|
|
158
|
+
Type 'discard' to confirm.
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Wait for that exact confirmation. When it arrives:
|
|
162
|
+
|
|
163
|
+
```text
|
|
164
|
+
# From the main repository root, after explicit discard confirmation:
|
|
165
|
+
git rev-parse --show-toplevel
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Then clean up the worktree (Step 7) and force-delete the branch:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
git branch -D <feature-branch>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Step 7: Cleanup Workspace
|
|
175
|
+
|
|
176
|
+
**Runs for Option 1 and confirmed discards.** Options 2 and 3 always
|
|
177
|
+
preserve the worktree. Both callers have already changed directory to the
|
|
178
|
+
main repo root — worktree removal must run from outside the worktree —
|
|
179
|
+
and use the Git directory/common-directory comparison and worktree path captured
|
|
180
|
+
in Step 2, from before that directory change.
|
|
181
|
+
|
|
182
|
+
**If `--git-dir` equals `--git-common-dir`:** Normal repo, no worktree to clean up. Done.
|
|
183
|
+
|
|
184
|
+
**If the captured worktree path is under `.worktrees/` or `worktrees/`:** This
|
|
185
|
+
workflow owns the manually managed project-local worktree and may clean it up:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
git worktree remove "<captured-worktree-path>"
|
|
189
|
+
git worktree prune # Self-healing: clean up any stale registrations
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**If removal is refused** (`contains modified or untracked files`): the
|
|
193
|
+
worktree holds files that exist nowhere else — uncommitted plans, notes,
|
|
194
|
+
or scratch work. Never `--force` on your own initiative. Show your human
|
|
195
|
+
partner what is at stake and ask:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
git -C "<captured-worktree-path>" status --porcelain -uall
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
Worktree removal refused — these files were never committed:
|
|
203
|
+
|
|
204
|
+
<file list>
|
|
205
|
+
|
|
206
|
+
1. Commit them to <branch> before cleanup
|
|
207
|
+
2. Move them into <main repo root>
|
|
208
|
+
3. Delete them (unrecoverable)
|
|
209
|
+
|
|
210
|
+
Which?
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Carry out the choice, then remove the worktree.
|
|
214
|
+
|
|
215
|
+
**Otherwise:** The host environment owns this workspace — leave it in
|
|
216
|
+
place. If your platform provides a workspace-exit tool, use it.
|
|
217
|
+
|
|
218
|
+
## Quick Reference
|
|
219
|
+
|
|
220
|
+
| Option | Merge | Push | Keep Worktree | Cleanup Branch |
|
|
221
|
+
|--------|-------|------|---------------|----------------|
|
|
222
|
+
| 1. Merge locally | yes | - | - | yes |
|
|
223
|
+
| 2. Create PR | - | yes | yes | - |
|
|
224
|
+
| 3. Keep as-is | - | - | yes | - |
|
|
225
|
+
| Discard (explicit request only) | - | - | - | yes (force) |
|
|
226
|
+
|
|
227
|
+
## Common Rationalizations
|
|
228
|
+
|
|
229
|
+
| Excuse | Reality |
|
|
230
|
+
|--------|---------|
|
|
231
|
+
| "Tests passed earlier this session" | Run the suite on the tree you are about to integrate. A green run only proves the tree it ran on. |
|
|
232
|
+
| "They obviously want it merged" | Integration is your human partner's decision. Present the menu and wait. |
|
|
233
|
+
| "They seem done with this feature — I'll offer to discard it" | The menu is complete as written. Discard happens only when your human partner asks for it in so many words. |
|
|
234
|
+
| "'Yeah, get rid of it' counts as confirmation" | Only the typed word `discard` authorizes deletion. |
|
|
235
|
+
| "The PR is up, so the worktree is clutter now" | PR feedback gets fixed in that worktree. It stays until the work lands. |
|
|
236
|
+
| "This other worktree looks stale — I'll clean it too" | Clean up only worktrees under `.worktrees/` or `worktrees/`. Everything else belongs to the host. |
|
|
237
|
+
| "Removal refused — `--force` is just finishing the cleanup" | The refusal means files exist only in that worktree. `--force` destroys them permanently. Show your human partner and ask. |
|
|
238
|
+
| "The merged-result failure is probably flaky" | A failing merged result stops everything. Branch and worktree stay put while you investigate. |
|
|
239
|
+
| "The base branch is obviously main" | Confirm the fork point or ask. Merging into the wrong base is expensive to undo. |
|
|
240
|
+
| "The push was rejected — force-push will fix it" | A rejected push means the remote moved. Investigate; force-push only on your human partner's explicit request. |
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# Code Reviewer Prompt Template
|
|
2
|
+
|
|
3
|
+
Use this template when dispatching a code reviewer subagent.
|
|
4
|
+
|
|
5
|
+
**Purpose:** Review completed work against requirements and code quality standards before it cascades into more work.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Subagent (general-purpose):
|
|
9
|
+
description: "Review code changes"
|
|
10
|
+
prompt: |
|
|
11
|
+
You are a Senior Code Reviewer with expertise in software architecture,
|
|
12
|
+
design patterns, and best practices. Your job is to review completed work
|
|
13
|
+
against its plan or requirements and identify issues before they cascade.
|
|
14
|
+
|
|
15
|
+
## What Was Implemented
|
|
16
|
+
|
|
17
|
+
[DESCRIPTION]
|
|
18
|
+
|
|
19
|
+
## Requirements / Plan
|
|
20
|
+
|
|
21
|
+
[PLAN_OR_REQUIREMENTS]
|
|
22
|
+
|
|
23
|
+
## Git Range to Review
|
|
24
|
+
|
|
25
|
+
**Base:** [BASE_SHA]
|
|
26
|
+
**Head:** [HEAD_SHA]
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
git diff --stat [BASE_SHA]..[HEAD_SHA]
|
|
30
|
+
git diff [BASE_SHA]..[HEAD_SHA]
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## The spec is a vision document
|
|
34
|
+
|
|
35
|
+
The spec says what the software must do. It does not enumerate every
|
|
36
|
+
input, environment, or condition the software will meet. For behavior
|
|
37
|
+
the spec is silent on, judge by what a reasonable person using this
|
|
38
|
+
software would expect: a reasonable person's expectation is a
|
|
39
|
+
requirement, and a spec's silence is not permission. Grade such
|
|
40
|
+
findings by their effect on that person, not by whether the spec
|
|
41
|
+
mentions the trigger.
|
|
42
|
+
|
|
43
|
+
## Declined to judge
|
|
44
|
+
|
|
45
|
+
Before your verdict, list every behavior you considered and set aside
|
|
46
|
+
as outside the plan or spec, one line each, with the reason. The
|
|
47
|
+
executor rules on each line; nothing you set aside is dropped
|
|
48
|
+
silently. An empty list means you set nothing aside.
|
|
49
|
+
|
|
50
|
+
## Read-Only Review
|
|
51
|
+
|
|
52
|
+
Your review is read-only on this checkout. Do not mutate the working tree, the index, HEAD, or branch state in any way. Use tools like `git show`, `git diff`, and `git log` to inspect history. If you need a working copy of a different revision, check it out into a separate temporary directory (e.g. `git worktree add /tmp/review-[SHA] [SHA]`) — never move HEAD on this checkout.
|
|
53
|
+
|
|
54
|
+
## You Do Not Dispatch Subagents
|
|
55
|
+
|
|
56
|
+
Do all of this review yourself. Never spawn a subagent to review part
|
|
57
|
+
of the diff, and never spawn another reviewer for a second opinion.
|
|
58
|
+
This process already provides every review seat the work gets; a
|
|
59
|
+
reviewer you spawn duplicates one of them at full cost, and its
|
|
60
|
+
verdict counts for nothing. If the diff feels too large for one
|
|
61
|
+
pass, review it in passes yourself and say so in your report.
|
|
62
|
+
|
|
63
|
+
## What to Check
|
|
64
|
+
|
|
65
|
+
**Plan alignment:**
|
|
66
|
+
- Does the implementation match the plan / requirements?
|
|
67
|
+
- Are deviations justified improvements, or problematic departures?
|
|
68
|
+
- Is all planned functionality present?
|
|
69
|
+
|
|
70
|
+
**Code quality:**
|
|
71
|
+
- Clean separation of concerns?
|
|
72
|
+
- Proper error handling?
|
|
73
|
+
- Type safety where applicable?
|
|
74
|
+
- DRY without premature abstraction?
|
|
75
|
+
- Edge cases handled?
|
|
76
|
+
|
|
77
|
+
**Architecture:**
|
|
78
|
+
- Sound design decisions?
|
|
79
|
+
- Reasonable scalability and performance?
|
|
80
|
+
- Security concerns?
|
|
81
|
+
- Integrates cleanly with surrounding code?
|
|
82
|
+
|
|
83
|
+
**Testing:**
|
|
84
|
+
- Tests verify real behavior, not mocks?
|
|
85
|
+
- Edge cases covered?
|
|
86
|
+
- Integration tests where they matter?
|
|
87
|
+
- All tests passing?
|
|
88
|
+
|
|
89
|
+
**Production readiness:**
|
|
90
|
+
- Migration strategy if schema changed?
|
|
91
|
+
- Backward compatibility considered?
|
|
92
|
+
- Documentation complete?
|
|
93
|
+
- No obvious bugs?
|
|
94
|
+
|
|
95
|
+
## Calibration
|
|
96
|
+
|
|
97
|
+
Categorize issues by actual severity. Not everything is Critical.
|
|
98
|
+
Acknowledge what was done well before listing issues — accurate praise
|
|
99
|
+
helps the implementer trust the rest of the feedback.
|
|
100
|
+
|
|
101
|
+
If you find significant deviations from the plan, flag them specifically
|
|
102
|
+
so the implementer can confirm whether the deviation was intentional.
|
|
103
|
+
If you find issues with the plan itself rather than the implementation,
|
|
104
|
+
say so.
|
|
105
|
+
|
|
106
|
+
## Output Format
|
|
107
|
+
|
|
108
|
+
### Strengths
|
|
109
|
+
[What's well done? Be specific.]
|
|
110
|
+
|
|
111
|
+
### Issues
|
|
112
|
+
|
|
113
|
+
#### Critical (Must Fix)
|
|
114
|
+
[Bugs, security issues, data loss risks, broken functionality]
|
|
115
|
+
|
|
116
|
+
#### Important (Should Fix)
|
|
117
|
+
[Architecture problems, missing features, poor error handling, test gaps]
|
|
118
|
+
|
|
119
|
+
#### Minor (Nice to Have)
|
|
120
|
+
[Code style, optimization opportunities, documentation polish]
|
|
121
|
+
|
|
122
|
+
For each issue:
|
|
123
|
+
- File:line reference
|
|
124
|
+
- What's wrong
|
|
125
|
+
- Why it matters
|
|
126
|
+
- How to fix (if not obvious)
|
|
127
|
+
|
|
128
|
+
### Recommendations
|
|
129
|
+
[Improvements for code quality, architecture, or process]
|
|
130
|
+
|
|
131
|
+
### Assessment
|
|
132
|
+
|
|
133
|
+
**Ready to merge?** [Yes | No | With fixes]
|
|
134
|
+
|
|
135
|
+
**Reasoning:** [1-2 sentence technical assessment]
|
|
136
|
+
|
|
137
|
+
## Critical Rules
|
|
138
|
+
|
|
139
|
+
**DO:**
|
|
140
|
+
- Categorize by actual severity
|
|
141
|
+
- Be specific (file:line, not vague)
|
|
142
|
+
- Explain WHY each issue matters
|
|
143
|
+
- Acknowledge strengths
|
|
144
|
+
- Give a clear verdict
|
|
145
|
+
|
|
146
|
+
**DON'T:**
|
|
147
|
+
- Say "looks good" without checking
|
|
148
|
+
- Mark nitpicks as Critical
|
|
149
|
+
- Give feedback on code you didn't actually read
|
|
150
|
+
- Be vague ("improve error handling")
|
|
151
|
+
- Avoid giving a clear verdict
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Placeholders:**
|
|
155
|
+
- `[DESCRIPTION]` — brief summary of what was built
|
|
156
|
+
- `[PLAN_OR_REQUIREMENTS]` — what it should do (plan file path, task text, or requirements)
|
|
157
|
+
- `[BASE_SHA]` — starting commit
|
|
158
|
+
- `[HEAD_SHA]` — ending commit
|
|
159
|
+
|
|
160
|
+
**Reviewer returns:** Strengths, Issues (Critical / Important / Minor), Recommendations, Assessment
|
|
161
|
+
|
|
162
|
+
## Example Output
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
### Strengths
|
|
166
|
+
- Clean database schema with proper migrations (db.ts:15-42)
|
|
167
|
+
- Comprehensive test coverage (18 tests, all edge cases)
|
|
168
|
+
- Good error handling with fallbacks (summarizer.ts:85-92)
|
|
169
|
+
|
|
170
|
+
### Issues
|
|
171
|
+
|
|
172
|
+
#### Important
|
|
173
|
+
1. **Missing help text in CLI wrapper**
|
|
174
|
+
- File: index-conversations:1-31
|
|
175
|
+
- Issue: No --help flag, users won't discover --concurrency
|
|
176
|
+
- Fix: Add --help case with usage examples
|
|
177
|
+
|
|
178
|
+
2. **Date validation missing**
|
|
179
|
+
- File: search.ts:25-27
|
|
180
|
+
- Issue: Invalid dates silently return no results
|
|
181
|
+
- Fix: Validate ISO format, throw error with example
|
|
182
|
+
|
|
183
|
+
#### Minor
|
|
184
|
+
1. **Progress indicators**
|
|
185
|
+
- File: indexer.ts:130
|
|
186
|
+
- Issue: No "X of Y" counter for long operations
|
|
187
|
+
- Impact: Users don't know how long to wait
|
|
188
|
+
|
|
189
|
+
### Recommendations
|
|
190
|
+
- Add progress reporting for user experience
|
|
191
|
+
- Consider config file for excluded projects (portability)
|
|
192
|
+
|
|
193
|
+
### Assessment
|
|
194
|
+
|
|
195
|
+
**Ready to merge: With fixes**
|
|
196
|
+
|
|
197
|
+
**Reasoning:** Core implementation is solid with good architecture and tests. Important issues (help text, date validation) are easily fixed and don't affect core functionality.
|
|
198
|
+
```
|