specrails-core 4.9.1 → 4.10.0
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/bin/specrails-core.mjs +1 -1
- package/bin/tui-installer.mjs +0 -19
- package/commands/enrich.md +0 -2
- package/dist/installer/commands/framework.js +0 -2
- package/dist/installer/commands/framework.js.map +1 -1
- package/dist/installer/commands/init.js +25 -14
- package/dist/installer/commands/init.js.map +1 -1
- package/dist/installer/commands/update.js +19 -17
- package/dist/installer/commands/update.js.map +1 -1
- package/dist/installer/phases/install-config.js +2 -3
- package/dist/installer/phases/install-config.js.map +1 -1
- package/dist/installer/phases/scaffold.js +23 -97
- package/dist/installer/phases/scaffold.js.map +1 -1
- package/dist/installer/util/fs.js +21 -2
- package/dist/installer/util/fs.js.map +1 -1
- package/docs/installation.md +0 -1
- package/docs/testing/test-matrix-codex.md +1 -1
- package/integration-contract.json +1 -2
- package/package.json +1 -1
- package/templates/commands/specrails/enrich.md +0 -2
- package/templates/commands/specrails/team-debug.md +0 -286
- package/templates/commands/specrails/team-review.md +0 -341
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: "Team Review"
|
|
3
|
-
description: "Multi-perspective code review using Claude Code Agent Teams. Three specialized reviewers (security, performance, correctness) independently review changes, debate findings, and produce a consolidated report."
|
|
4
|
-
category: Workflow
|
|
5
|
-
tags: [workflow, review, agent-teams, security, performance]
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
Multi-perspective code review for **{{PROJECT_NAME}}** using Claude Code Agent Teams. Three specialized reviewers analyze changes independently, debate cross-cutting findings, and produce a consolidated report.
|
|
9
|
-
|
|
10
|
-
**Input:** $ARGUMENTS — required: a review target in one of these forms:
|
|
11
|
-
- `#123` — review a pull request by number
|
|
12
|
-
- `feat/my-feature` — review a branch diff against base
|
|
13
|
-
- `abc1234..def5678` — review a commit range
|
|
14
|
-
|
|
15
|
-
Optional flags:
|
|
16
|
-
- `--base <branch>` — override base branch for comparison (default: repository default branch)
|
|
17
|
-
- `--focus <areas>` — comma-separated focus areas to weight: `security`, `performance`, `correctness`, `tests`, `types`
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## Phase 0: Feature Flag Guard
|
|
22
|
-
|
|
23
|
-
**This check is mandatory and runs before anything else.**
|
|
24
|
-
|
|
25
|
-
Check whether Agent Teams is enabled:
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
echo "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-}"
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
If the variable is unset or not equal to `1`, print this message and **stop immediately**:
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
Error: Agent Teams is an experimental feature that requires opt-in.
|
|
35
|
-
|
|
36
|
-
To enable it, set the environment variable before starting Claude Code:
|
|
37
|
-
|
|
38
|
-
export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
|
|
39
|
-
|
|
40
|
-
Agent Teams requires Claude Code v2.1.32 or later.
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Do NOT proceed past this point if the guard fails.
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
## Phase 1: Input Parsing
|
|
48
|
-
|
|
49
|
-
Parse `$ARGUMENTS` to determine the review target and flags.
|
|
50
|
-
|
|
51
|
-
**Variables to set:**
|
|
52
|
-
|
|
53
|
-
- `REVIEW_TARGET` — the PR number, branch name, or commit range
|
|
54
|
-
- `REVIEW_TYPE` — `"pr"`, `"branch"`, or `"range"`
|
|
55
|
-
- `BASE_BRANCH` — from `--base` flag or detect via `gh repo view --json defaultBranchRef -q '.defaultBranchRef.name'` or fall back to `main`
|
|
56
|
-
- `FOCUS_AREAS` — array from `--focus` flag or `["all"]`
|
|
57
|
-
|
|
58
|
-
**Detection rules:**
|
|
59
|
-
|
|
60
|
-
1. If input starts with `#` or is a bare integer → `REVIEW_TYPE="pr"`, strip `#` prefix
|
|
61
|
-
2. If input contains `..` → `REVIEW_TYPE="range"`
|
|
62
|
-
3. Otherwise → `REVIEW_TYPE="branch"`
|
|
63
|
-
|
|
64
|
-
If `$ARGUMENTS` is empty, print usage and stop:
|
|
65
|
-
```
|
|
66
|
-
Usage: /specrails:team-review <target> [--base <branch>] [--focus <areas>]
|
|
67
|
-
|
|
68
|
-
Examples:
|
|
69
|
-
/specrails:team-review #42
|
|
70
|
-
/specrails:team-review feat/new-auth --focus security
|
|
71
|
-
/specrails:team-review abc123..def456
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## Phase 2: Gather Diff
|
|
77
|
-
|
|
78
|
-
Collect the code changes based on `REVIEW_TYPE`:
|
|
79
|
-
|
|
80
|
-
- **PR**: Run `gh pr diff <REVIEW_TARGET>` and `gh pr diff <REVIEW_TARGET> --name-only`
|
|
81
|
-
- **Branch**: Run `git diff ${BASE_BRANCH}...${REVIEW_TARGET}` and `git diff --name-only ${BASE_BRANCH}...${REVIEW_TARGET}`
|
|
82
|
-
- **Range**: Run `git diff ${REVIEW_TARGET}` and `git diff --name-only ${REVIEW_TARGET}`
|
|
83
|
-
|
|
84
|
-
Also collect file-level stats: `git diff --stat <appropriate-range>`
|
|
85
|
-
|
|
86
|
-
**Store these variables for Phase 3:**
|
|
87
|
-
- `DIFF_CONTENT` — full unified diff
|
|
88
|
-
- `CHANGED_FILES` — list of changed file paths
|
|
89
|
-
- `DIFF_STATS` — file-level line count changes
|
|
90
|
-
|
|
91
|
-
If the diff is empty, print `No changes found for the given review target.` and stop.
|
|
92
|
-
|
|
93
|
-
Print a summary:
|
|
94
|
-
```
|
|
95
|
-
## Review Target
|
|
96
|
-
Type: <PR / Branch / Range>
|
|
97
|
-
Target: <REVIEW_TARGET>
|
|
98
|
-
Base: <BASE_BRANCH>
|
|
99
|
-
Changed files: <N>
|
|
100
|
-
Focus: <FOCUS_AREAS or "all areas">
|
|
101
|
-
|
|
102
|
-
<DIFF_STATS output>
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
|
-
## Phase 3: Launch Team Review
|
|
108
|
-
|
|
109
|
-
Create three reviewer teammates using Agent Teams. Each teammate receives the full diff and file list.
|
|
110
|
-
|
|
111
|
-
**IMPORTANT:** Use the Agent Teams teammate mechanism — NOT the Agent tool's `subagent_type`. Teammates share a task list and can message each other via mailbox.
|
|
112
|
-
|
|
113
|
-
### Teammate 1: Security Reviewer
|
|
114
|
-
|
|
115
|
-
**Persona:** sr-security-reviewer (or sr-reviewer with security focus if persona not available)
|
|
116
|
-
|
|
117
|
-
**Prompt:**
|
|
118
|
-
```
|
|
119
|
-
You are the Security Reviewer on a team code review.
|
|
120
|
-
|
|
121
|
-
## Your Focus Areas
|
|
122
|
-
- Authentication and authorization flaws
|
|
123
|
-
- Input validation and injection vulnerabilities (SQL, XSS, command injection)
|
|
124
|
-
- Secrets or credentials in code
|
|
125
|
-
- OWASP Top 10 vulnerabilities
|
|
126
|
-
- Insecure dependencies or configurations
|
|
127
|
-
- Missing rate limiting or access controls
|
|
128
|
-
|
|
129
|
-
## Changed Files
|
|
130
|
-
<CHANGED_FILES>
|
|
131
|
-
|
|
132
|
-
## Diff
|
|
133
|
-
<DIFF_CONTENT>
|
|
134
|
-
|
|
135
|
-
## Instructions
|
|
136
|
-
1. Review every changed file through a security lens
|
|
137
|
-
2. Report findings using the format below — be specific about file, line, and fix
|
|
138
|
-
3. After completing your review, read the other reviewers' findings from the task list
|
|
139
|
-
4. If you have security-relevant context on their findings, send a mailbox message
|
|
140
|
-
|
|
141
|
-
## Report Format
|
|
142
|
-
Post your findings as a task list update:
|
|
143
|
-
|
|
144
|
-
### Security Review Findings
|
|
145
|
-
|
|
146
|
-
#### Summary
|
|
147
|
-
<1-2 sentences>
|
|
148
|
-
|
|
149
|
-
#### Findings
|
|
150
|
-
| # | Severity | File | Line(s) | Finding | Recommendation |
|
|
151
|
-
|---|----------|------|---------|---------|----------------|
|
|
152
|
-
|
|
153
|
-
#### Verdict
|
|
154
|
-
<APPROVE / REQUEST_CHANGES / COMMENT>
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
### Teammate 2: Performance Reviewer
|
|
158
|
-
|
|
159
|
-
**Persona:** sr-performance-reviewer (or sr-reviewer with performance focus if persona not available)
|
|
160
|
-
|
|
161
|
-
**Prompt:**
|
|
162
|
-
```
|
|
163
|
-
You are the Performance Reviewer on a team code review.
|
|
164
|
-
|
|
165
|
-
## Your Focus Areas
|
|
166
|
-
- Database query complexity and N+1 queries
|
|
167
|
-
- Missing or broken caching
|
|
168
|
-
- Memory leaks and excessive allocations
|
|
169
|
-
- Algorithmic complexity (O(n^2) or worse in hot paths)
|
|
170
|
-
- Bundle size and lazy loading concerns (frontend)
|
|
171
|
-
- Missing pagination or unbounded data fetching
|
|
172
|
-
|
|
173
|
-
## Changed Files
|
|
174
|
-
<CHANGED_FILES>
|
|
175
|
-
|
|
176
|
-
## Diff
|
|
177
|
-
<DIFF_CONTENT>
|
|
178
|
-
|
|
179
|
-
## Instructions
|
|
180
|
-
1. Review every changed file through a performance lens
|
|
181
|
-
2. Report findings using the format below — be specific about file, line, and fix
|
|
182
|
-
3. After completing your review, read the other reviewers' findings from the task list
|
|
183
|
-
4. If you have performance-relevant context on their findings, send a mailbox message
|
|
184
|
-
|
|
185
|
-
## Report Format
|
|
186
|
-
Post your findings as a task list update:
|
|
187
|
-
|
|
188
|
-
### Performance Review Findings
|
|
189
|
-
|
|
190
|
-
#### Summary
|
|
191
|
-
<1-2 sentences>
|
|
192
|
-
|
|
193
|
-
#### Findings
|
|
194
|
-
| # | Severity | File | Line(s) | Finding | Recommendation |
|
|
195
|
-
|---|----------|------|---------|---------|----------------|
|
|
196
|
-
|
|
197
|
-
#### Verdict
|
|
198
|
-
<APPROVE / REQUEST_CHANGES / COMMENT>
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
### Teammate 3: Correctness Reviewer
|
|
202
|
-
|
|
203
|
-
**Persona:** sr-reviewer
|
|
204
|
-
|
|
205
|
-
**Prompt:**
|
|
206
|
-
```
|
|
207
|
-
You are the Correctness Reviewer on a team code review.
|
|
208
|
-
|
|
209
|
-
## Your Focus Areas
|
|
210
|
-
- Logic errors and edge cases
|
|
211
|
-
- Missing or inadequate test coverage
|
|
212
|
-
- Type safety violations
|
|
213
|
-
- Error handling gaps (uncaught exceptions, missing error paths)
|
|
214
|
-
- API contract mismatches
|
|
215
|
-
- Race conditions and concurrency issues
|
|
216
|
-
|
|
217
|
-
## Changed Files
|
|
218
|
-
<CHANGED_FILES>
|
|
219
|
-
|
|
220
|
-
## Diff
|
|
221
|
-
<DIFF_CONTENT>
|
|
222
|
-
|
|
223
|
-
## Instructions
|
|
224
|
-
1. Review every changed file through a correctness and test coverage lens
|
|
225
|
-
2. Report findings using the format below — be specific about file, line, and fix
|
|
226
|
-
3. After completing your review, read the other reviewers' findings from the task list
|
|
227
|
-
4. If you have correctness-relevant context on their findings, send a mailbox message
|
|
228
|
-
|
|
229
|
-
## Report Format
|
|
230
|
-
Post your findings as a task list update:
|
|
231
|
-
|
|
232
|
-
### Correctness Review Findings
|
|
233
|
-
|
|
234
|
-
#### Summary
|
|
235
|
-
<1-2 sentences>
|
|
236
|
-
|
|
237
|
-
#### Findings
|
|
238
|
-
| # | Severity | File | Line(s) | Finding | Recommendation |
|
|
239
|
-
|---|----------|------|---------|---------|----------------|
|
|
240
|
-
|
|
241
|
-
#### Verdict
|
|
242
|
-
<APPROVE / REQUEST_CHANGES / COMMENT>
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
### Team Coordination
|
|
246
|
-
|
|
247
|
-
After launching all three teammates:
|
|
248
|
-
|
|
249
|
-
1. Wait for all three to complete their independent reviews (posted to the shared task list)
|
|
250
|
-
2. Allow one round of cross-review debate via mailbox — each reviewer may respond to findings from the other two
|
|
251
|
-
3. Collect all findings and debate outcomes
|
|
252
|
-
|
|
253
|
-
If any teammate fails to respond, proceed with available reviews and note the gap in the final report.
|
|
254
|
-
|
|
255
|
-
---
|
|
256
|
-
|
|
257
|
-
## Phase 4: Synthesize Consolidated Report
|
|
258
|
-
|
|
259
|
-
After all reviews and debate are complete, the team lead produces the final report.
|
|
260
|
-
|
|
261
|
-
### Step 1: Collect and Deduplicate
|
|
262
|
-
|
|
263
|
-
1. Read all three reviewer reports from the task list
|
|
264
|
-
2. Identify duplicate findings (same file + overlapping lines + similar issue)
|
|
265
|
-
3. For duplicates: keep the highest-severity version, note which reviewers flagged it
|
|
266
|
-
|
|
267
|
-
### Step 2: Apply Focus Weighting
|
|
268
|
-
|
|
269
|
-
If `FOCUS_AREAS` is not `["all"]`:
|
|
270
|
-
- Findings in focus areas get their severity preserved
|
|
271
|
-
- Findings outside focus areas: Critical stays Critical, but High→Medium, Medium→Low for display purposes
|
|
272
|
-
- Note the weighting in the report header
|
|
273
|
-
|
|
274
|
-
### Step 3: Render Report
|
|
275
|
-
|
|
276
|
-
```markdown
|
|
277
|
-
## Team Review Report
|
|
278
|
-
|
|
279
|
-
**Target:** <PR #N / branch-name / commit-range>
|
|
280
|
-
**Base:** <BASE_BRANCH>
|
|
281
|
-
**Reviewers:** Security, Performance, Correctness
|
|
282
|
-
**Changed files:** N files (+X/-Y lines)
|
|
283
|
-
**Focus:** <FOCUS_AREAS or "all areas equally weighted">
|
|
284
|
-
|
|
285
|
-
---
|
|
286
|
-
|
|
287
|
-
### Critical Findings (action required before merge)
|
|
288
|
-
|
|
289
|
-
| # | Severity | Domain | File | Line(s) | Finding | Recommendation | Flagged By |
|
|
290
|
-
|---|----------|--------|------|---------|---------|----------------|------------|
|
|
291
|
-
|
|
292
|
-
### High-Priority Findings
|
|
293
|
-
|
|
294
|
-
| # | Severity | Domain | File | Line(s) | Finding | Recommendation | Flagged By |
|
|
295
|
-
|---|----------|--------|------|---------|---------|----------------|------------|
|
|
296
|
-
|
|
297
|
-
### Medium & Low Findings
|
|
298
|
-
|
|
299
|
-
| # | Severity | Domain | File | Line(s) | Finding | Recommendation |
|
|
300
|
-
|---|----------|--------|------|---------|---------|----------------|
|
|
301
|
-
|
|
302
|
-
### Praise (things done well)
|
|
303
|
-
<positive observations from reviewers>
|
|
304
|
-
|
|
305
|
-
---
|
|
306
|
-
|
|
307
|
-
### Cross-Review Notes
|
|
308
|
-
<any points of debate or disagreement between reviewers, with resolution>
|
|
309
|
-
|
|
310
|
-
---
|
|
311
|
-
|
|
312
|
-
### Reviewer Verdicts
|
|
313
|
-
|
|
314
|
-
| Reviewer | Verdict | Critical | High | Medium | Low | Info |
|
|
315
|
-
|----------|---------|----------|------|--------|-----|------|
|
|
316
|
-
| Security | APPROVE/REQUEST_CHANGES | N | N | N | N | N |
|
|
317
|
-
| Performance | APPROVE/REQUEST_CHANGES | N | N | N | N | N |
|
|
318
|
-
| Correctness | APPROVE/REQUEST_CHANGES | N | N | N | N | N |
|
|
319
|
-
|
|
320
|
-
### Overall Verdict: <APPROVE / REQUEST_CHANGES>
|
|
321
|
-
|
|
322
|
-
<one-paragraph summary: key risks, recommended actions, and overall assessment>
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
### Step 4: Cost Notice
|
|
326
|
-
|
|
327
|
-
Print a brief cost notice after the report:
|
|
328
|
-
|
|
329
|
-
```
|
|
330
|
-
Note: Team review used ~3x the tokens of a single-reviewer run (3 parallel reviewers + debate round).
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
---
|
|
334
|
-
|
|
335
|
-
## Rules
|
|
336
|
-
|
|
337
|
-
- This command is **read-only** — it MUST NOT create, modify, or delete any files
|
|
338
|
-
- All three reviewers run as Agent Teams teammates, not as Agent tool subagents
|
|
339
|
-
- If Agent Teams is unavailable at runtime (API error, version mismatch), fall back to running three sequential Agent tool subagents with `subagent_type: sr-reviewer` and skip the debate phase. Print a warning about the fallback.
|
|
340
|
-
- The debate phase is limited to one round per reviewer to control token costs
|
|
341
|
-
- Findings MUST include file paths and line numbers — vague findings are not acceptable
|