@ai-support-agent/cli 0.1.32 → 0.1.33-beta.1
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/dist/alert-processor.d.ts +0 -8
- package/dist/alert-processor.d.ts.map +1 -1
- package/dist/alert-processor.js +5 -73
- package/dist/alert-processor.js.map +1 -1
- package/dist/api-client.d.ts +0 -4
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +0 -4
- package/dist/api-client.js.map +1 -1
- package/dist/commands/claude-code-args.d.ts +1 -0
- package/dist/commands/claude-code-args.d.ts.map +1 -1
- package/dist/commands/claude-code-args.js +3 -0
- package/dist/commands/claude-code-args.js.map +1 -1
- package/dist/commands/claude-code-runner.d.ts.map +1 -1
- package/dist/commands/claude-code-runner.js +2 -1
- package/dist/commands/claude-code-runner.js.map +1 -1
- package/dist/commands/plugin-dir.d.ts +20 -0
- package/dist/commands/plugin-dir.d.ts.map +1 -0
- package/dist/commands/plugin-dir.js +71 -0
- package/dist/commands/plugin-dir.js.map +1 -0
- package/dist/constants.d.ts +0 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +0 -1
- package/dist/constants.js.map +1 -1
- package/dist/plugin/.claude-plugin/plugin.json +9 -0
- package/dist/plugin/LICENSE +26 -0
- package/dist/plugin/README.md +86 -0
- package/dist/plugin/SYNC.md +113 -0
- package/dist/plugin/agents/build-error-resolver.md +159 -0
- package/dist/plugin/agents/code-reviewer.md +277 -0
- package/dist/plugin/agents/django-reviewer.md +159 -0
- package/dist/plugin/agents/infra-reviewer.md +172 -0
- package/dist/plugin/agents/investigator.md +75 -0
- package/dist/plugin/agents/nextjs-reviewer.md +191 -0
- package/dist/plugin/agents/php-reviewer.md +167 -0
- package/dist/plugin/agents/planner.md +184 -0
- package/dist/plugin/agents/python-reviewer.md +161 -0
- package/dist/plugin/agents/react-reviewer.md +150 -0
- package/dist/plugin/agents/silent-failure-hunter.md +158 -0
- package/dist/plugin/agents/typescript-reviewer.md +179 -0
- package/dist/plugin/agents/ui-reviewer.md +203 -0
- package/dist/plugin/commands/add-feature.md +301 -0
- package/dist/plugin/commands/build-fix.md +47 -0
- package/dist/plugin/commands/code-review.md +228 -0
- package/dist/plugin/commands/fix-defect.md +393 -0
- package/dist/plugin/commands/learn-eval.md +94 -0
- package/dist/plugin/commands/learn.md +84 -0
- package/dist/plugin/commands/plan.md +211 -0
- package/dist/plugin/commands/test-coverage.md +64 -0
- package/dist/plugin/commands/update-docs.md +98 -0
- package/dist/plugin/hooks/hooks.json +59 -0
- package/dist/plugin/hooks/scripts/auto-format.sh +63 -0
- package/dist/plugin/hooks/scripts/check-secrets-before-commit.sh +50 -0
- package/dist/plugin/hooks/scripts/guard-dangerous-commands.sh +55 -0
- package/dist/plugin/hooks/scripts/on-command-resume.sh +112 -0
- package/dist/plugin/hooks/scripts/on-command-stop.sh +200 -0
- package/dist/plugin/hooks/scripts/protect-sensitive-files.sh +58 -0
- package/dist/plugin/rules/common/coding-guidelines.md +73 -0
- package/dist/plugin/rules/documentation/api-docs.md +46 -0
- package/dist/plugin/rules/documentation/docs-site.md +60 -0
- package/dist/plugin/rules/documentation/source-docs.md +89 -0
- package/dist/plugin/rules/documentation/test-docs.md +39 -0
- package/dist/plugin/rules/logging/logging-rules.md +83 -0
- package/dist/plugin/rules/php/coding-rules.md +40 -0
- package/dist/plugin/rules/python/coding-rules.md +40 -0
- package/dist/plugin/rules/typescript/coding-rules.md +45 -0
- package/dist/plugin/skills/api-design/SKILL.md +269 -0
- package/dist/plugin/skills/backend-patterns/SKILL.md +312 -0
- package/dist/plugin/skills/database-migrations/SKILL.md +323 -0
- package/dist/plugin/skills/docker-patterns/SKILL.md +308 -0
- package/dist/plugin/skills/docs-site/SKILL.md +341 -0
- package/dist/plugin/skills/e2e-testing/SKILL.md +334 -0
- package/dist/plugin/skills/frontend-patterns/SKILL.md +318 -0
- package/dist/plugin/skills/integration-testing/SKILL.md +273 -0
- package/package.json +2 -2
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Implement a new feature through a disciplined, gated pipeline of plan approval and test-first development
|
|
3
|
+
argument-hint: "[feature description / requirements / issue number]"
|
|
4
|
+
resumable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Add-feature pipeline
|
|
8
|
+
|
|
9
|
+
Implement a new feature or a change in behavior through a disciplined, gated pipeline. Two things are non-negotiable:
|
|
10
|
+
|
|
11
|
+
1. **Not one line of implementation code gets written until the user approves the plan.**
|
|
12
|
+
2. **Every task is test-first (red → green → refactor).**
|
|
13
|
+
|
|
14
|
+
Target feature: $ARGUMENTS
|
|
15
|
+
|
|
16
|
+
## Scope
|
|
17
|
+
|
|
18
|
+
- In scope: adding new features, changing existing behavior.
|
|
19
|
+
- Out of scope: fixing broken behavior — use /fix-defect for that.
|
|
20
|
+
If partway through the work it turns out this is actually a bug fix rather than a feature addition,
|
|
21
|
+
report that to the user and switch commands.
|
|
22
|
+
|
|
23
|
+
## Two gates
|
|
24
|
+
|
|
25
|
+
This pipeline has two gates that must never be crossed early.
|
|
26
|
+
|
|
27
|
+
1. Plan-approval gate: don't write implementation code until the user has approved the plan.
|
|
28
|
+
Reads for investigation and planning are fine before approval; adding or changing production
|
|
29
|
+
or test code starts only after approval.
|
|
30
|
+
2. Commit gate: never commit without the user's confirmation, under any circumstances.
|
|
31
|
+
|
|
32
|
+
Even when it's tempting to push forward autonomously, always stop at the gate and get confirmation.
|
|
33
|
+
|
|
34
|
+
## Completion Marker Convention
|
|
35
|
+
|
|
36
|
+
This command runs under `claude -p` (non-interactive), which restarts as a fresh process every turn — past turn 1, this command body is not guaranteed to be re-expanded, so gate discipline (the two gates above) can silently erode across turns. To compensate, a hooks-based mechanism re-injects a digest of this command's must-obey constraints on the next turn whenever the pipeline is left incomplete.
|
|
37
|
+
|
|
38
|
+
If this command's flow is **not yet complete** (e.g. stopped at the plan-approval gate, mid-implementation, awaiting review fixes, or stopped at the commit gate), your response **MUST end** with a line that is an exact match of:
|
|
39
|
+
|
|
40
|
+
`<!-- ai-support-agent:resume name="add-feature" -->`
|
|
41
|
+
|
|
42
|
+
If the flow **is complete** (implementation finished, committed with user confirmation, and the post-commit options were handled), do **not** output this marker.
|
|
43
|
+
|
|
44
|
+
Never output this marker inside a code block or as an illustrative example — only emit it as the actual last line of real output when the flow is genuinely incomplete.
|
|
45
|
+
|
|
46
|
+
<!-- RESUME_DIGEST_START -->
|
|
47
|
+
When resuming this command on turn 2+ without the full command body re-expanded, obey these constraints:
|
|
48
|
+
|
|
49
|
+
- **Two gates, never crossed early**:
|
|
50
|
+
1. Plan-approval gate: no implementation or test code changes until the user has explicitly approved the plan. Reads/investigation are fine before approval.
|
|
51
|
+
2. Commit gate: never commit without the user's explicit confirmation, under any circumstances.
|
|
52
|
+
- Never self-interpret "roughly agreed to," silence, or an unrelated follow-up as approval or as commit confirmation.
|
|
53
|
+
- **Test-first is non-negotiable**: for every task, write the test before the implementation, run it, and confirm it fails (red) before writing any implementation code. Then implement the minimal code to go green, then refactor while staying green.
|
|
54
|
+
- **Do all work inside the dedicated worktree** created in Step 2 — never edit the main working tree directly.
|
|
55
|
+
- **Step 9 verification requires evidence, not speculation**: never claim "tests pass" / "build passes" / "should work" without having actually run the command in this conversation and read its output. A stale or previous run's result does not count as evidence.
|
|
56
|
+
- **Review gate (Step 8)**: every CRITICAL / HIGH finding from the code-reviewer / silent-failure-hunter review must be resolved, followed by a green re-run of the test suite, before moving on.
|
|
57
|
+
- Follow the Step 10 commit-gate flow exactly: present the diff + proposed commit message, wait for confirmation, commit only after confirmation, then present the four post-commit options and execute the chosen one in the correct order (never remove a worktree before merge/PR is settled).
|
|
58
|
+
<!-- RESUME_DIGEST_END -->
|
|
59
|
+
|
|
60
|
+
## Procedure
|
|
61
|
+
|
|
62
|
+
### 1. Declare the size classification
|
|
63
|
+
|
|
64
|
+
Before starting work, declare which of the following applies.
|
|
65
|
+
|
|
66
|
+
- Trivial: a small addition — one file, a handful of lines. The plan can be an abbreviated,
|
|
67
|
+
key-points-only version, but presenting it and getting approval is still not optional.
|
|
68
|
+
- Small: an addition spanning a few files, with a clear, easy-to-see-through path.
|
|
69
|
+
- Standard or larger: an addition touching multiple modules, or involving design decisions.
|
|
70
|
+
|
|
71
|
+
Regardless of size, changes touching authentication/authorization, input handling, databases,
|
|
72
|
+
external service integrations, or anything money-related always require a formal plan and approval.
|
|
73
|
+
|
|
74
|
+
### 2. Create a worktree
|
|
75
|
+
|
|
76
|
+
Create a dedicated branch and worktree for the work, and do everything from here on inside that worktree.
|
|
77
|
+
|
|
78
|
+
First check the existing isolation state.
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
MAIN_ROOT=$(git rev-parse --show-toplevel)
|
|
82
|
+
GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
|
|
83
|
+
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
|
|
84
|
+
SUPERPROJECT=$(git rev-parse --show-superproject-working-tree 2>/dev/null)
|
|
85
|
+
echo "MAIN_ROOT=$MAIN_ROOT"
|
|
86
|
+
echo "GIT_DIR=$GIT_DIR"
|
|
87
|
+
echo "GIT_COMMON=$GIT_COMMON"
|
|
88
|
+
echo "SUPERPROJECT=${SUPERPROJECT:-(none)}"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Use the output above to determine which of three states applies.
|
|
92
|
+
|
|
93
|
+
| Condition | State | Action |
|
|
94
|
+
|---|---|---|
|
|
95
|
+
| `SUPERPROJECT` has a value | Inside a submodule | Don't create a worktree — work directly |
|
|
96
|
+
| `SUPERPROJECT` is empty and `GIT_DIR != GIT_COMMON` | Already inside a worktree | Don't create a new one — keep working in the existing worktree |
|
|
97
|
+
| `SUPERPROJECT` is empty and `GIT_DIR == GIT_COMMON` | Regular repository | Create a worktree (steps below) |
|
|
98
|
+
|
|
99
|
+
Create the worktree.
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
git worktree add -b <branch-name> <path>
|
|
103
|
+
# e.g. git worktree add -b feature/add-user-auth ../worktrees/add-user-auth
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
- Name the branch after what the feature does.
|
|
107
|
+
- A sibling directory outside the repo is usually the most convenient path (e.g. `../worktrees/<name>`).
|
|
108
|
+
- If placing it inside the project (`.worktrees/`), confirm it's in `.gitignore` before creating it (`git check-ignore -q .worktrees`). If it's not listed, add it and commit that first.
|
|
109
|
+
- Working inside a worktree keeps the main working directory clean, and rolling back is as simple as deleting the whole directory.
|
|
110
|
+
|
|
111
|
+
Once created, run the test suite to confirm a clean baseline. If there are pre-existing failures, report them to the user and confirm whether to proceed. If proceeding, record those failures as pre-existing issues outside the scope of this work (so they aren't later mistakenly reported as a regression introduced here).
|
|
112
|
+
|
|
113
|
+
### 3. Investigate the existing code
|
|
114
|
+
|
|
115
|
+
Before settling on an implementation approach, investigate the codebase first.
|
|
116
|
+
|
|
117
|
+
- Look for reusable implementations: existing utilities, shared components,
|
|
118
|
+
similar features. Don't reinvent the wheel.
|
|
119
|
+
- Identify the patterns to follow: directory structure, naming conventions,
|
|
120
|
+
error-handling approach, testing conventions.
|
|
121
|
+
- If an existing mechanism already satisfies the requirement, use it instead of building something new.
|
|
122
|
+
|
|
123
|
+
### 4. Clarifying questions
|
|
124
|
+
|
|
125
|
+
**This step can be skipped for trivial changes. It is required for small and larger changes.**
|
|
126
|
+
|
|
127
|
+
Building on the codebase investigation, organize the ambiguities and open points left over from restating
|
|
128
|
+
the request using the perspectives below, and ask the user about them together in one batch. Don't re-ask
|
|
129
|
+
about anything already clear. Wait for the answer before moving to the next step.
|
|
130
|
+
|
|
131
|
+
| Perspective | What to confirm |
|
|
132
|
+
|---|---|
|
|
133
|
+
| Target users and permissions | Who will use this feature? What permissions/preconditions are needed to operate it? |
|
|
134
|
+
| Non-functional requirements | Are there performance, throughput, or scale targets? |
|
|
135
|
+
| Backward compatibility and constraints | Must existing APIs, data formats, or external integrations be preserved? Are any technologies off-limits? |
|
|
136
|
+
| Failure behavior | What should be returned to the user on failure? Is a rollback needed? |
|
|
137
|
+
| Definition of done | What state counts as "complete"? Are there acceptance criteria? |
|
|
138
|
+
|
|
139
|
+
If there's nothing unclear, declare "No clarifying questions" and move on.
|
|
140
|
+
Fold the user's answers directly into the plan.
|
|
141
|
+
|
|
142
|
+
### 5. Draft a plan and get it approved (plan-approval gate)
|
|
143
|
+
|
|
144
|
+
- Use the planner subagent or /plan to draft the plan. The plan should include
|
|
145
|
+
the implementation approach, what will change, a task breakdown, test strategy, and risks.
|
|
146
|
+
- Present the plan to the user and wait for approval. Don't start implementing before approval.
|
|
147
|
+
- If changes are requested, revise the plan and re-present it, and get approval again.
|
|
148
|
+
Never self-interpret "roughly agreed to" as approval and start implementing.
|
|
149
|
+
|
|
150
|
+
### 6. Write tests first and confirm red
|
|
151
|
+
|
|
152
|
+
Write tests before writing implementation code.
|
|
153
|
+
|
|
154
|
+
- Following the approved plan's task breakdown, write each task's tests first.
|
|
155
|
+
- Run the tests and **confirm they fail (red)**.
|
|
156
|
+
A test that doesn't go red proves nothing about the implementation — always watch the failure happen.
|
|
157
|
+
- Choose the test layer appropriate to what's being tested (tasks involving DB reads/writes should
|
|
158
|
+
include integration tests against a real database — see the integration-testing skill).
|
|
159
|
+
- For features touching critical UI flows (authentication, registration/updates, payments, etc.),
|
|
160
|
+
consider adding or updating E2E tests (see the e2e-testing skill).
|
|
161
|
+
|
|
162
|
+
### 7. Implement (green → refactor)
|
|
163
|
+
|
|
164
|
+
- Work in thin vertical slices. Build up small, working increments rather than
|
|
165
|
+
one large change that stays broken for a long time.
|
|
166
|
+
- For each task, write the minimal implementation that makes step 6's tests pass (green).
|
|
167
|
+
Once green, clean up the code (refactor) while staying green.
|
|
168
|
+
- If the build breaks, restore it with /build-fix before continuing.
|
|
169
|
+
- Include E2E tests (if `playwright.config.*` etc. exists) when running the test suite.
|
|
170
|
+
If they can't run due to environment constraints, report that to the user.
|
|
171
|
+
- If the change spans multiple repositories, run the test suite in every repository that was
|
|
172
|
+
changed and confirm there's no regression.
|
|
173
|
+
- Use /test-coverage if you want to check whether test coverage is adequate.
|
|
174
|
+
- If you need to deviate from the plan, don't just proceed — consult the user first.
|
|
175
|
+
|
|
176
|
+
#### Logging considerations (for projects that follow a logging convention)
|
|
177
|
+
|
|
178
|
+
Alongside implementation, check the following.
|
|
179
|
+
|
|
180
|
+
- **New entry points** (endpoints, jobs, workers) should set `request_id` / `user_id` / `tenant_code`
|
|
181
|
+
(or equivalent) in the logging context at the start of the request.
|
|
182
|
+
- **Business events** (state transitions, key start/completion points) should be logged at INFO level.
|
|
183
|
+
- **Public methods in the service/use-case layer** should emit DEBUG-level start/end, input/output,
|
|
184
|
+
and duration, ideally via a cross-cutting mechanism like a decorator.
|
|
185
|
+
- **ERROR logs** should include the exception, stack trace, `request_id`, and the ID of the affected resource.
|
|
186
|
+
- Passwords, tokens, and personal information must be masked even at DEBUG level.
|
|
187
|
+
- See your project's logging conventions doc for details.
|
|
188
|
+
|
|
189
|
+
### 8. Get a review
|
|
190
|
+
|
|
191
|
+
Run a review using the same parallel Workflow execution as `/code-review` (Mode A).
|
|
192
|
+
|
|
193
|
+
1. Identify the changed files with `git diff HEAD --name-only`, and select reviewers per `/code-review`'s
|
|
194
|
+
"Selecting reviewers" table (`code-reviewer` and `silent-failure-hunter` are always included).
|
|
195
|
+
2. Invoke the Workflow script described in `/code-review` and run the selected reviewers in parallel.
|
|
196
|
+
3. Review the returned `findings` and resolve every CRITICAL / HIGH finding.
|
|
197
|
+
After making the fixes, re-run the test suite and confirm it's green.
|
|
198
|
+
|
|
199
|
+
### 9. Verify before declaring done (no claims without evidence)
|
|
200
|
+
|
|
201
|
+
**Iron rule: run the verification commands and read the output before claiming completion.**
|
|
202
|
+
|
|
203
|
+
"Should pass," "probably fine," "I don't think there's a problem" are guesses, not claims.
|
|
204
|
+
Before crossing the commit gate, actually run the following **in this conversation** and confirm:
|
|
205
|
+
|
|
206
|
+
| Claim | Required evidence |
|
|
207
|
+
|---|---|
|
|
208
|
+
| TDD red was confirmed | Ran it right after writing the test and watched it fail (red) |
|
|
209
|
+
| Tests pass | Ran the test command and saw zero failures in the output |
|
|
210
|
+
| Build passes | Ran the build command and saw exit code 0 |
|
|
211
|
+
| Requirements are met | Re-read the plan's task breakdown and confirmed each item was achieved |
|
|
212
|
+
| No regressions | Ran the existing test suite and confirmed no failures |
|
|
213
|
+
|
|
214
|
+
All of the following are prohibited:
|
|
215
|
+
|
|
216
|
+
- Claiming completion with phrases like "should pass," "probably," "I believe"
|
|
217
|
+
- Claiming something "passes" based on a previous run (a stale result is not evidence)
|
|
218
|
+
- Trusting a subagent's "done successfully" report without verifying it yourself
|
|
219
|
+
- Reporting partial verification (only some tests) as complete verification
|
|
220
|
+
- Jumping from "tests pass" to "requirements are met" (test passage does not imply requirement satisfaction)
|
|
221
|
+
|
|
222
|
+
### 10. Commit and clean up the worktree (commit gate)
|
|
223
|
+
|
|
224
|
+
- Present a summary of the diff and a proposed commit message, and wait for the user's confirmation.
|
|
225
|
+
- Commit only once confirmation is given.
|
|
226
|
+
- Follow the project's existing conventions (commit log style, etc.) for message format and granularity.
|
|
227
|
+
|
|
228
|
+
After committing, present the user with these four options.
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
Implementation is complete. What would you like to do with this change?
|
|
232
|
+
|
|
233
|
+
1. Merge it into <base branch> locally
|
|
234
|
+
2. Push and open a Pull Request
|
|
235
|
+
3. Keep this branch as-is (handle it later)
|
|
236
|
+
4. Discard this work
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Handle each choice as follows.
|
|
240
|
+
|
|
241
|
+
**1. Local merge**
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
# Move out of the worktree (to the main repo root) before running this
|
|
245
|
+
cd "$MAIN_ROOT"
|
|
246
|
+
git checkout <base-branch>
|
|
247
|
+
git pull
|
|
248
|
+
git merge <feature-branch>
|
|
249
|
+
# Run the test suite after merging to confirm no regression
|
|
250
|
+
git worktree remove <worktree-path>
|
|
251
|
+
git worktree prune
|
|
252
|
+
git branch -d <feature-branch>
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
**2. Open a PR**
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
git push -u origin <feature-branch>
|
|
259
|
+
gh pr create --base <base-branch> --head <feature-branch> \
|
|
260
|
+
--title "<change title>" --body "<summary of the change>"
|
|
261
|
+
# Don't remove the worktree — it's needed for handling PR feedback
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**3. Keep as-is**
|
|
265
|
+
|
|
266
|
+
Leave both the worktree and the branch in place. Tell the user the path and stop.
|
|
267
|
+
|
|
268
|
+
**4. Discard**
|
|
269
|
+
|
|
270
|
+
Ask the user to type `discard` first, and only proceed once confirmed.
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
cd "$MAIN_ROOT"
|
|
274
|
+
git worktree remove <worktree-path>
|
|
275
|
+
git worktree prune
|
|
276
|
+
git branch -D <feature-branch>
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**Order and prohibitions to observe**
|
|
280
|
+
|
|
281
|
+
- Never run `git worktree remove` from inside the worktree (always move to the main repo root first).
|
|
282
|
+
- Run `git branch -d` **after** `git worktree remove` (the reverse order fails).
|
|
283
|
+
- Don't remove the worktree before the merge (confirm the merge succeeded first).
|
|
284
|
+
- Don't remove the worktree after creating a PR (option 2).
|
|
285
|
+
|
|
286
|
+
## Verification checklist
|
|
287
|
+
|
|
288
|
+
Before reporting completion, confirm all of the following.
|
|
289
|
+
|
|
290
|
+
- [ ] Created a worktree and ran the baseline tests to confirm a clean starting point (any pre-existing failures were recorded).
|
|
291
|
+
- [ ] Investigated existing implementations and patterns, and avoided unnecessary new implementation.
|
|
292
|
+
- [ ] For small/standard-or-larger changes, asked clarifying questions and resolved open points before drafting the plan.
|
|
293
|
+
- [ ] The plan was approved by the user, and no implementation code was written before approval.
|
|
294
|
+
- [ ] Wrote tests first for every task and confirmed red before implementing.
|
|
295
|
+
- [ ] No regressions in the existing test suite (including E2E tests, if present).
|
|
296
|
+
- [ ] If the change spans multiple repositories, ran the test suite in every changed repository and confirmed no regression.
|
|
297
|
+
- [ ] Resolved every CRITICAL / HIGH review finding.
|
|
298
|
+
- [ ] Ran verification commands and read the output before claiming completion (didn't guess "should pass").
|
|
299
|
+
- [ ] Committed only after the user's confirmation (left uncommitted if not yet confirmed).
|
|
300
|
+
- [ ] Presented the four-option worktree cleanup and executed it in the correct order (remove worktree → delete branch) for the chosen option.
|
|
301
|
+
- [ ] If a logging convention applies: added correlation-ID context to new entry points, logged business events at INFO, and masked sensitive information.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Fix build and type errors with the smallest possible diff to get the build green. Does not refactor or add features.
|
|
3
|
+
argument-hint: "[error message | leave empty to auto-diagnose]"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /build-fix command
|
|
7
|
+
|
|
8
|
+
**Input**: $ARGUMENTS
|
|
9
|
+
|
|
10
|
+
A command for getting a broken build back to green with the smallest possible change. This command is a thin entry point. Detecting the project type and deciding how to diagnose and fix it is delegated to the `build-error-resolver` subagent (bundled with this plugin) as a rule.
|
|
11
|
+
|
|
12
|
+
## Behavior
|
|
13
|
+
|
|
14
|
+
### 1. Handling the input
|
|
15
|
+
|
|
16
|
+
- If `$ARGUMENTS` contains an error message, use it as the starting point for the fix.
|
|
17
|
+
- If empty, start from auto-diagnosis. Detecting the project type, choosing diagnostic commands, and the discipline of minimal fixes are delegated to build-error-resolver.
|
|
18
|
+
- In a monorepo, scope the work to only the workspaces that changed.
|
|
19
|
+
|
|
20
|
+
### 2. Error-classification priority (overview)
|
|
21
|
+
|
|
22
|
+
1. **Build-breaking** (compilation failures, module resolution failures) — highest priority
|
|
23
|
+
2. **Type errors** — next
|
|
24
|
+
3. **Lint warnings, deprecated APIs** — only if time allows
|
|
25
|
+
|
|
26
|
+
### 3. Completion report
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
## Build fix complete
|
|
30
|
+
|
|
31
|
+
Before: <n> errors → After: 0 errors
|
|
32
|
+
Changed files: <list>
|
|
33
|
+
Lines changed: <n>
|
|
34
|
+
|
|
35
|
+
Key fixes:
|
|
36
|
+
- <file:line> <one-line description of the fix>
|
|
37
|
+
|
|
38
|
+
Verification:
|
|
39
|
+
- <diagnostic command run>: Pass
|
|
40
|
+
- Tests (if run): Pass / Warning (details)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Notes
|
|
44
|
+
|
|
45
|
+
- **Always confirm with the user before any destructive recovery** (clearing caches, rebuilding `node_modules`, etc.) before running it.
|
|
46
|
+
- If the same error survives 5 fix attempts, present a hypothesis and options and let the user decide (don't loop indefinitely).
|
|
47
|
+
- If the fix turns out to require an architectural change, stop and suggest switching to `/plan`.
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run a code review across your stack and post a report and verdict to the PR/MR
|
|
3
|
+
argument-hint: "[PR/MR number or URL] (omit to review local uncommitted changes)"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /code-review
|
|
7
|
+
|
|
8
|
+
This command lives in this plugin's namespace and is invoked as `/<plugin>:code-review` (which is distinct, by
|
|
9
|
+
namespace, from Claude Code's built-in `/code-review` and `/review` — an unprefixed `/code-review` may refer to
|
|
10
|
+
the built-in version). Where the built-in command does a general-purpose diff review, this command's added value
|
|
11
|
+
is applying review criteria specific to your stack (TypeScript / Python / PHP / React / Next.js / Vue / Django /
|
|
12
|
+
Laravel / CakePHP / IaC, etc.) and recording the review as a structured report that gets posted back. If a
|
|
13
|
+
general-purpose review is all you need, the built-in command works fine.
|
|
14
|
+
|
|
15
|
+
## Determining the mode
|
|
16
|
+
|
|
17
|
+
Check the `$ARGUMENTS` value to decide which mode to run in.
|
|
18
|
+
|
|
19
|
+
- No argument → Mode A (local review)
|
|
20
|
+
- A number (e.g. `123`) or a PR/MR URL → Mode B (PR/MR review)
|
|
21
|
+
|
|
22
|
+
## Selecting reviewers (both modes)
|
|
23
|
+
|
|
24
|
+
Look at the paths of the changed files and use the table below to decide which reviewers to run.
|
|
25
|
+
`code-reviewer` and `silent-failure-hunter` are always included.
|
|
26
|
+
|
|
27
|
+
| File-type condition | Reviewer to add |
|
|
28
|
+
|---|---|
|
|
29
|
+
| Includes `.ts` / `.tsx` / `.js` / `.jsx` / `.mjs` / `.cjs` | `typescript-reviewer` |
|
|
30
|
+
| `.tsx` / `.jsx` with component definitions | `react-reviewer` (alongside `typescript-reviewer`) |
|
|
31
|
+
| Touches `app/` / `pages/` / `next.config` / `middleware.ts` / a Server Action | `nextjs-reviewer` |
|
|
32
|
+
| Includes `.py` | `python-reviewer` |
|
|
33
|
+
| Touches Django-style files (`models.py` / `views.py` / `serializers.py` / `migrations/`, etc.) | `django-reviewer` (alongside `python-reviewer`) |
|
|
34
|
+
| Includes `.php` | `php-reviewer` |
|
|
35
|
+
| Touches UI components or layout | `ui-reviewer` |
|
|
36
|
+
| Includes `*.ts` (CDK) / `serverless.yml` / `template.yaml` / CloudFormation-style files | `infra-reviewer` |
|
|
37
|
+
|
|
38
|
+
This table matches the "delegating to other agents" routing table used by code-reviewer.
|
|
39
|
+
Treat the code-reviewer agent's routing table as the source of truth when adding or changing reviewers, and mirror the change here too.
|
|
40
|
+
|
|
41
|
+
## Workflow script (both modes)
|
|
42
|
+
|
|
43
|
+
Once the reviewer list is finalized, pass the script below to the Workflow tool's `script` parameter and run it in parallel.
|
|
44
|
+
Pass the selected reviewer names as `args.reviewers`, and the mode-specific review instructions (described below) as `args.reviewContext`.
|
|
45
|
+
|
|
46
|
+
```javascript
|
|
47
|
+
export const meta = {
|
|
48
|
+
name: 'code-review-parallel',
|
|
49
|
+
description: 'Run stack-specific reviewers in parallel to speed up code review',
|
|
50
|
+
phases: [
|
|
51
|
+
{ title: 'Review' },
|
|
52
|
+
{ title: 'Merge' }
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const SEVERITY_ORDER = { CRITICAL: 0, HIGH: 1, MEDIUM: 2, LOW: 3 }
|
|
57
|
+
|
|
58
|
+
const FINDINGS_SCHEMA = {
|
|
59
|
+
type: 'object',
|
|
60
|
+
properties: {
|
|
61
|
+
findings: {
|
|
62
|
+
type: 'array',
|
|
63
|
+
items: {
|
|
64
|
+
type: 'object',
|
|
65
|
+
properties: {
|
|
66
|
+
severity: { type: 'string', enum: ['CRITICAL', 'HIGH', 'MEDIUM', 'LOW'] },
|
|
67
|
+
file: { type: 'string' },
|
|
68
|
+
line: { type: 'string' },
|
|
69
|
+
description: { type: 'string' },
|
|
70
|
+
suggestion: { type: 'string' }
|
|
71
|
+
},
|
|
72
|
+
required: ['severity', 'description']
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
required: ['findings']
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
phase('Review')
|
|
80
|
+
const results = await parallel(args.reviewers.map(name => () =>
|
|
81
|
+
agent(args.reviewContext, {
|
|
82
|
+
label: name,
|
|
83
|
+
phase: 'Review',
|
|
84
|
+
agentType: name,
|
|
85
|
+
schema: FINDINGS_SCHEMA
|
|
86
|
+
})
|
|
87
|
+
))
|
|
88
|
+
|
|
89
|
+
phase('Merge')
|
|
90
|
+
const all = results.filter(Boolean).flatMap(r => r.findings || [])
|
|
91
|
+
const sorted = all.sort((a, b) =>
|
|
92
|
+
(SEVERITY_ORDER[a.severity] ?? 4) - (SEVERITY_ORDER[b.severity] ?? 4)
|
|
93
|
+
)
|
|
94
|
+
return { findings: sorted }
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Use the `findings` returned by the Workflow (already sorted by severity) in the steps that follow.
|
|
98
|
+
|
|
99
|
+
## Mode A: local review (no argument)
|
|
100
|
+
|
|
101
|
+
Review the uncommitted changes (both staged and unstaged).
|
|
102
|
+
|
|
103
|
+
1. Identify the changed files with `git diff HEAD --name-only` and select reviewers (see "Selecting reviewers" above).
|
|
104
|
+
2. Run the Workflow in parallel, passing the following as `args.reviewContext`:
|
|
105
|
+
```
|
|
106
|
+
Review the current uncommitted changes (git diff HEAD, or the combination of git diff --staged and git diff).
|
|
107
|
+
Read the full content of each changed file and its surrounding code (callers, type definitions, middleware,
|
|
108
|
+
etc.) and report issues from your area of expertise. Don't judge from the diff alone.
|
|
109
|
+
```
|
|
110
|
+
3. Group the `findings` returned by the Workflow by severity (CRITICAL / HIGH / MEDIUM / LOW) and report them to the user.
|
|
111
|
+
Don't post anything remotely in this mode.
|
|
112
|
+
|
|
113
|
+
## Mode B: PR/MR review (number or URL)
|
|
114
|
+
|
|
115
|
+
### Determining the host
|
|
116
|
+
|
|
117
|
+
Pick the CLI to use with the following rule.
|
|
118
|
+
|
|
119
|
+
- If the argument is a URL: use the `gh` CLI for `github.com`, the `glab` CLI for `gitlab.com`.
|
|
120
|
+
- If the argument is a bare number: check `git remote get-url origin` — use `gh` if it contains `github.com`, `glab` if it contains `gitlab.com`.
|
|
121
|
+
- For self-hosted setups that match neither, show the user the remote URL and ask which CLI to use.
|
|
122
|
+
|
|
123
|
+
### Steps
|
|
124
|
+
|
|
125
|
+
1. **Fetch metadata and changed files**
|
|
126
|
+
- GitHub: `gh pr view <number> --json title,body,author,baseRefName,headRefName,isDraft,files` to get the list of changed files.
|
|
127
|
+
- GitLab: `glab mr view <number>` to get the list of changed files.
|
|
128
|
+
2. **Build context**
|
|
129
|
+
- Read the project's CLAUDE.md (or equivalent) to understand coding conventions and background.
|
|
130
|
+
- If the PR/MR description references a plan file or an issue, read that too.
|
|
131
|
+
3. **Select reviewers and run the Workflow**
|
|
132
|
+
- Select reviewers from the changed-file list obtained in step 1 (see "Selecting reviewers" above).
|
|
133
|
+
- Run the Workflow in parallel, passing the following as `args.reviewContext` (substitute `<number>` and `<CLI>` with the actual values):
|
|
134
|
+
```
|
|
135
|
+
Review PR/MR #<number>. Fetch the diff with `<CLI> pr/mr diff <number>`, and read the full content of
|
|
136
|
+
each changed file along with its surrounding code (callers, type definitions, middleware, etc.). Don't
|
|
137
|
+
judge from the diff alone. Report issues from your area of expertise, and for each finding include the
|
|
138
|
+
severity, file, line, a description of the problem, and a suggested fix.
|
|
139
|
+
```
|
|
140
|
+
- Use the `findings` returned by the Workflow (already sorted by severity) for the verdict step below.
|
|
141
|
+
4. **Run verification**
|
|
142
|
+
- Detect the project type and run whatever applies.
|
|
143
|
+
- Node-based: type checking (tsc, etc.), lint, tests, build. Check `package.json` scripts to pick the right ones.
|
|
144
|
+
- Python-based: mypy / ruff / pytest, etc., for whichever config files are present. If a virtual environment exists (`.venv/` / `venv/`), use the tools inside it (e.g. `.venv/bin/pytest`; for poetry/uv-managed projects, run through `poetry run` / `uv run`).
|
|
145
|
+
- PHP-based: phpstan / php-cs-fixer / phpunit, etc., for whichever config files are present.
|
|
146
|
+
- E2E: if `playwright.config.*` (or `cypress.config.*`) exists, **always include E2E tests in the run**
|
|
147
|
+
(`npx playwright test`; if the config has a `webServer`, the app starts automatically). Skip only if the
|
|
148
|
+
environment can't support it, and always record why. On failure, distinguish code-caused failures from
|
|
149
|
+
environment-caused ones (external service not running, missing credentials, etc.); code-caused failures
|
|
150
|
+
count as a verification failure.
|
|
151
|
+
- Record the results (pass/fail/skip reason) for each check.
|
|
152
|
+
5. **Verdict**
|
|
153
|
+
|
|
154
|
+
Apply the shared verdict rule across all reviewers, evaluated top to bottom.
|
|
155
|
+
|
|
156
|
+
| Condition | Verdict |
|
|
157
|
+
|---|---|
|
|
158
|
+
| Any CRITICAL findings | Blocked (post as change request, with BLOCKING stated at the top) |
|
|
159
|
+
| Any HIGH findings, or verification failed | Changes requested |
|
|
160
|
+
| MEDIUM only (verification passed) | Approve with warnings |
|
|
161
|
+
| No findings / LOW only (verification passed) | Approve |
|
|
162
|
+
|
|
163
|
+
When posting remotely: both "approve" and "approve with warnings" post as an approval; for the latter, include
|
|
164
|
+
the MEDIUM findings and recommended follow-ups in the report body. If the target is a draft PR/MR, post a
|
|
165
|
+
comment only regardless of verdict — don't approve or request changes.
|
|
166
|
+
|
|
167
|
+
6. **Save the review record**
|
|
168
|
+
- Save it under `.claude/reviews/` as `<date>-<PR/MR number>.md` (template below).
|
|
169
|
+
7. **Post remotely**
|
|
170
|
+
- GitHub: `gh pr review <number> --approve | --request-changes | --comment --body "<report>"`
|
|
171
|
+
- GitLab: approve with `glab mr approve <number>`; post the report body with `glab mr note <number> --message "<report>"`.
|
|
172
|
+
GitLab has no direct equivalent of "request changes," so for a changes-requested or blocked verdict, skip
|
|
173
|
+
approval and instead state "Changes requested" or "Blocked" at the top of the note.
|
|
174
|
+
8. **Summarize for the user**
|
|
175
|
+
- Report the verdict, finding counts by severity, verification results, the link to where it was posted, and the record file path, concisely.
|
|
176
|
+
|
|
177
|
+
## Review record template
|
|
178
|
+
|
|
179
|
+
```markdown
|
|
180
|
+
# Review record: <PR/MR title or "local changes">
|
|
181
|
+
|
|
182
|
+
- Date: <YYYY-MM-DD HH:MM>
|
|
183
|
+
- Target: <PR/MR number and URL, or branch name>
|
|
184
|
+
- Verdict: <Approve | Approve with warnings | Changes requested | Blocked | Comment only (draft)>
|
|
185
|
+
|
|
186
|
+
## Summary
|
|
187
|
+
|
|
188
|
+
<2-3 sentence summary of the change>
|
|
189
|
+
|
|
190
|
+
## Findings
|
|
191
|
+
|
|
192
|
+
### CRITICAL
|
|
193
|
+
- <file:line> <description of the problem and suggested fix> (or "None")
|
|
194
|
+
|
|
195
|
+
### HIGH
|
|
196
|
+
- None
|
|
197
|
+
|
|
198
|
+
### MEDIUM
|
|
199
|
+
- None
|
|
200
|
+
|
|
201
|
+
### LOW
|
|
202
|
+
- None
|
|
203
|
+
|
|
204
|
+
## Verification results
|
|
205
|
+
|
|
206
|
+
| Item | Command | Result |
|
|
207
|
+
|---|---|---|
|
|
208
|
+
| Type check | <command run> | <Pass/Fail/Skipped> |
|
|
209
|
+
| Lint | <command run> | <Pass/Fail/Skipped> |
|
|
210
|
+
| Tests | <command run> | <Pass/Fail/Skipped> |
|
|
211
|
+
| E2E | <command run> | <Pass/Fail/Skipped (reason)> |
|
|
212
|
+
| Build | <command run> | <Pass/Fail/Skipped> |
|
|
213
|
+
|
|
214
|
+
## Notes
|
|
215
|
+
|
|
216
|
+
<rebase recommendation, scope limitations, any fallback used, etc.>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Edge cases
|
|
220
|
+
|
|
221
|
+
- **CLI unavailable**: if `gh` / `glab` isn't installed or authenticated, say so and fall back to a local review
|
|
222
|
+
(equivalent to Mode A — diff against the checked-out target branch if available) without posting anything.
|
|
223
|
+
- **Very large PR/MR**: if the changed files number roughly 30+ or the diff is roughly 3000+ lines, warn that
|
|
224
|
+
full coverage may not be possible, prioritize the highest-impact files (core logic, security-sensitive code,
|
|
225
|
+
public APIs), and record the actual scope covered in both the saved record and the summary.
|
|
226
|
+
- **Branch diverged from base**: if the base branch has moved on and the target branch is stale, flag the risk
|
|
227
|
+
of conflicts or inconsistent verification results and suggest a rebase (or merging in the latest base). Judge
|
|
228
|
+
the verdict against the code as it currently stands.
|