specweave 1.0.437 → 1.0.439
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/src/core/cicd/config-loader.d.ts.map +1 -1
- package/dist/src/core/cicd/config-loader.js +14 -1
- package/dist/src/core/cicd/config-loader.js.map +1 -1
- package/dist/src/core/cicd/monitor-service.d.ts +15 -0
- package/dist/src/core/cicd/monitor-service.d.ts.map +1 -1
- package/dist/src/core/cicd/monitor-service.js +2 -0
- package/dist/src/core/cicd/monitor-service.js.map +1 -1
- package/dist/src/core/config/types.d.ts +35 -0
- package/dist/src/core/config/types.d.ts.map +1 -1
- package/dist/src/core/config/types.js +5 -0
- package/dist/src/core/config/types.js.map +1 -1
- package/dist/src/core/increment/metadata-manager.d.ts +21 -1
- package/dist/src/core/increment/metadata-manager.d.ts.map +1 -1
- package/dist/src/core/increment/metadata-manager.js +34 -0
- package/dist/src/core/increment/metadata-manager.js.map +1 -1
- package/dist/src/core/types/increment-metadata.d.ts +37 -0
- package/dist/src/core/types/increment-metadata.d.ts.map +1 -1
- package/package.json +1 -1
- package/plugins/specweave/lib/vendor/core/increment/metadata-manager.d.ts +21 -1
- package/plugins/specweave/lib/vendor/core/increment/metadata-manager.js +34 -0
- package/plugins/specweave/lib/vendor/core/increment/metadata-manager.js.map +1 -1
- package/plugins/specweave/lib/vendor/core/types/increment-metadata.d.ts +37 -0
- package/plugins/specweave/skills/auto/SKILL.md +6 -0
- package/plugins/specweave/skills/do/SKILL.md +23 -1
- package/plugins/specweave/skills/done/SKILL.md +15 -0
- package/plugins/specweave/skills/e2e/SKILL.md +420 -0
- package/plugins/specweave/skills/e2e/evals/evals.json +122 -0
- package/plugins/specweave/skills/pr/SKILL.md +215 -0
- package/plugins/specweave/skills/team-build/SKILL.md +4 -4
- package/plugins/specweave/skills/team-lead/SKILL.md +2 -2
- package/plugins/specweave/skills/team-lead/agents/testing.md +3 -3
- package/plugins/specweave-github/skills/pr-review/SKILL.md +166 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Create pull request from increment feature branch. Use when increment is complete and push strategy is pr-based, or when explicitly saying "create PR", "open pull request", "make a PR".
|
|
3
|
+
argument-hint: "<increment-id>"
|
|
4
|
+
user-invokable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Create Pull Request
|
|
8
|
+
|
|
9
|
+
Creates a pull request for a completed increment. Automatically invoked by `sw:done` when `cicd.pushStrategy` is `"pr-based"`. Can also be invoked manually.
|
|
10
|
+
|
|
11
|
+
## When to Activate
|
|
12
|
+
|
|
13
|
+
**Do activate:**
|
|
14
|
+
- `sw:done` invokes this after quality gates pass (when `pushStrategy: "pr-based"`)
|
|
15
|
+
- User says "create PR", "open pull request", "make a PR for this increment"
|
|
16
|
+
- User says "push this as a PR"
|
|
17
|
+
|
|
18
|
+
**Do NOT activate:**
|
|
19
|
+
- `pushStrategy` is `"direct"` and user didn't explicitly ask for a PR
|
|
20
|
+
- Increment is not active or completed
|
|
21
|
+
- No changes exist to push
|
|
22
|
+
|
|
23
|
+
## Step 1: Read Configuration
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Read push strategy and git config
|
|
27
|
+
PUSH_STRATEGY=$(jq -r '.cicd.pushStrategy // "direct"' .specweave/config.json 2>/dev/null)
|
|
28
|
+
BRANCH_PREFIX=$(jq -r '.cicd.git.branchPrefix // "sw/"' .specweave/config.json 2>/dev/null)
|
|
29
|
+
TARGET_BRANCH=$(jq -r '.cicd.git.targetBranch // "main"' .specweave/config.json 2>/dev/null)
|
|
30
|
+
DELETE_ON_MERGE=$(jq -r '.cicd.git.deleteOnMerge // true' .specweave/config.json 2>/dev/null)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Read increment metadata to check if PR already exists:
|
|
34
|
+
```bash
|
|
35
|
+
jq -r '.prRefs // empty' .specweave/increments/{increment-id}/metadata.json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
If `prRefs` already has an entry with `state: "open"`, skip PR creation and report existing PR URL.
|
|
39
|
+
|
|
40
|
+
## Step 2: Determine Branch Name
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
BRANCH_NAME="${BRANCH_PREFIX}${INCREMENT_ID}"
|
|
44
|
+
# e.g., sw/0520-pr-based-increment-closure
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Check current branch:
|
|
48
|
+
```bash
|
|
49
|
+
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Step 3: Ensure on Feature Branch
|
|
53
|
+
|
|
54
|
+
**If already on the feature branch** (`CURRENT_BRANCH === BRANCH_NAME`):
|
|
55
|
+
- Skip branch creation, proceed to push.
|
|
56
|
+
|
|
57
|
+
**If on target branch** (main/develop):
|
|
58
|
+
- Check if feature branch exists locally: `git branch --list ${BRANCH_NAME}`
|
|
59
|
+
- If exists: `git checkout ${BRANCH_NAME}`
|
|
60
|
+
- If not: `git checkout -b ${BRANCH_NAME}`
|
|
61
|
+
|
|
62
|
+
**If on a different branch** (user created manually):
|
|
63
|
+
- Use the existing branch as-is. Set `BRANCH_NAME = CURRENT_BRANCH`.
|
|
64
|
+
- Do NOT force rename to match naming convention.
|
|
65
|
+
|
|
66
|
+
## Step 4: Push Branch
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
git push -u origin ${BRANCH_NAME}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
If push fails (e.g., no remote, auth issues), warn and exit gracefully. Do NOT block increment closure.
|
|
73
|
+
|
|
74
|
+
## Step 5: Build PR Description
|
|
75
|
+
|
|
76
|
+
Read spec.md to build the PR body. Use `--body-file` to avoid shell quoting issues:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Create temp file for PR body
|
|
80
|
+
cat > /tmp/sw-pr-body-${INCREMENT_ID}.md << 'PREOF'
|
|
81
|
+
## Summary
|
|
82
|
+
|
|
83
|
+
<!-- Auto-generated from SpecWeave increment {INCREMENT_ID} -->
|
|
84
|
+
|
|
85
|
+
{spec.md overview section — first paragraph}
|
|
86
|
+
|
|
87
|
+
## User Stories
|
|
88
|
+
|
|
89
|
+
{For each US in spec.md:}
|
|
90
|
+
- **US-001**: {title} ({AC count} acceptance criteria)
|
|
91
|
+
- **US-002**: {title} ({AC count} acceptance criteria)
|
|
92
|
+
|
|
93
|
+
## Acceptance Criteria
|
|
94
|
+
|
|
95
|
+
{Checklist of all ACs from spec.md:}
|
|
96
|
+
- [ ] AC-US1-01: {criterion}
|
|
97
|
+
- [ ] AC-US1-02: {criterion}
|
|
98
|
+
|
|
99
|
+
## Test Summary
|
|
100
|
+
|
|
101
|
+
{Summary of test plan from tasks.md — what was tested, coverage}
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
*Created by [SpecWeave](https://spec-weave.com) increment `{INCREMENT_ID}`*
|
|
106
|
+
PREOF
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Step 6: Create Pull Request
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
gh pr create \
|
|
113
|
+
--title "[${INCREMENT_ID}] {spec title}" \
|
|
114
|
+
--body-file /tmp/sw-pr-body-${INCREMENT_ID}.md \
|
|
115
|
+
--base ${TARGET_BRANCH} \
|
|
116
|
+
--head ${BRANCH_NAME}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Capture the PR URL and number:
|
|
120
|
+
```bash
|
|
121
|
+
PR_URL=$(gh pr create ... 2>&1)
|
|
122
|
+
PR_NUMBER=$(echo "$PR_URL" | grep -oE '[0-9]+$')
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Clean up temp file:
|
|
126
|
+
```bash
|
|
127
|
+
rm -f /tmp/sw-pr-body-${INCREMENT_ID}.md
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
If `deleteOnMerge` is true, add auto-delete label or note in PR description.
|
|
131
|
+
|
|
132
|
+
## Step 7: Update Metadata
|
|
133
|
+
|
|
134
|
+
Update increment metadata with PR reference. Edit `metadata.json` to add/update `prRefs`:
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"prRefs": [{
|
|
139
|
+
"branch": "sw/0520-pr-based-increment-closure",
|
|
140
|
+
"prNumber": 42,
|
|
141
|
+
"prUrl": "https://github.com/org/repo/pull/42",
|
|
142
|
+
"state": "open",
|
|
143
|
+
"createdAt": "2026-03-12T10:00:00Z"
|
|
144
|
+
}]
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Use `jq` or direct JSON edit to update metadata.json.
|
|
149
|
+
|
|
150
|
+
## Step 8: Multi-Repo / Umbrella Mode
|
|
151
|
+
|
|
152
|
+
Check if umbrella mode is enabled:
|
|
153
|
+
```bash
|
|
154
|
+
UMBRELLA=$(jq -r '.umbrella.enabled // false' .specweave/config.json 2>/dev/null)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
If umbrella mode:
|
|
158
|
+
|
|
159
|
+
1. **Scan for modified repos**: Check each `repositories/{org}/{repo}/` for changes relative to target branch:
|
|
160
|
+
```bash
|
|
161
|
+
for repo_dir in repositories/*/*; do
|
|
162
|
+
if [ -d "$repo_dir/.git" ]; then
|
|
163
|
+
cd "$repo_dir"
|
|
164
|
+
CHANGES=$(git log ${TARGET_BRANCH}..HEAD --oneline 2>/dev/null | wc -l)
|
|
165
|
+
if [ "$CHANGES" -gt 0 ]; then
|
|
166
|
+
# This repo has changes — create branch + PR
|
|
167
|
+
fi
|
|
168
|
+
cd -
|
|
169
|
+
fi
|
|
170
|
+
done
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
2. **Create branch + PR in each repo** with changes (Steps 3-6 per repo).
|
|
174
|
+
|
|
175
|
+
3. **Collect all PR refs** and store in metadata as array:
|
|
176
|
+
```json
|
|
177
|
+
{
|
|
178
|
+
"prRefs": [
|
|
179
|
+
{ "branch": "sw/0520-...", "prUrl": "...repo1/pull/42", "repoSlug": "org/repo1" },
|
|
180
|
+
{ "branch": "sw/0520-...", "prUrl": "...repo2/pull/15", "repoSlug": "org/repo2" }
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
4. **Continue on failure**: If one repo's PR fails, log the error and continue with others. Report all results at the end.
|
|
186
|
+
|
|
187
|
+
## Step 9: Output Summary
|
|
188
|
+
|
|
189
|
+
Display a summary table:
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
PR CREATION SUMMARY
|
|
193
|
+
═══════════════════════════════════════════════
|
|
194
|
+
Increment: 0520-pr-based-increment-closure
|
|
195
|
+
Strategy: pr-based
|
|
196
|
+
Target: main
|
|
197
|
+
|
|
198
|
+
Repo Branch PR
|
|
199
|
+
───────────── ───────────────────────────── ────────────────────────────
|
|
200
|
+
org/repo1 sw/0520-pr-based-closure https://github.com/.../42
|
|
201
|
+
org/repo2 sw/0520-pr-based-closure https://github.com/.../15
|
|
202
|
+
|
|
203
|
+
Status: 2/2 PRs created successfully
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Error Handling
|
|
207
|
+
|
|
208
|
+
| Error | Action |
|
|
209
|
+
|-------|--------|
|
|
210
|
+
| `gh` not installed | Warn: "Install GitHub CLI: brew install gh" |
|
|
211
|
+
| `gh auth` not configured | Warn: "Run: gh auth login" |
|
|
212
|
+
| Push rejected | Warn but don't block. Show error message. |
|
|
213
|
+
| PR already exists for branch | Skip creation, report existing PR URL |
|
|
214
|
+
| No changes to push | Skip PR creation, inform user |
|
|
215
|
+
| Merge conflicts with target | Create PR anyway (conflicts visible in PR UI) |
|
|
@@ -157,15 +157,15 @@ This spawns three parallel reviewers:
|
|
|
157
157
|
|
|
158
158
|
Generate comprehensive test coverage across all test levels simultaneously. Each agent focuses on a different testing layer and operates independently.
|
|
159
159
|
|
|
160
|
-
> **Note:**
|
|
160
|
+
> **Note:** SpecWeave testing skills (`sw:tdd-red`, `sw:e2e`, `sw:validate`) provide the testing workflows. This preset splits responsibilities into specialized agents for parallel execution.
|
|
161
161
|
|
|
162
162
|
#### Agent Composition
|
|
163
163
|
|
|
164
164
|
| # | Role | Skill(s) | Owns | Responsibility |
|
|
165
165
|
|---|------|----------|------|----------------|
|
|
166
|
-
| 1 | Unit | `
|
|
167
|
-
| 2 | E2E | `
|
|
168
|
-
| 3 | Coverage | `
|
|
166
|
+
| 1 | Unit | `sw:tdd-red` | `tests/unit/` | Write unit tests for individual functions, classes, and modules with proper mocking |
|
|
167
|
+
| 2 | E2E | `sw:e2e` | `tests/e2e/` | Write end-to-end tests for user flows, API sequences, and cross-service interactions |
|
|
168
|
+
| 3 | Coverage | `sw:validate` | `tests/` (analysis scope) | Analyze coverage gaps, generate missing test cases, ensure threshold compliance |
|
|
169
169
|
|
|
170
170
|
#### Execution Chain
|
|
171
171
|
|
|
@@ -164,7 +164,7 @@ Analyze the feature request and map affected domains to SpecWeave skills.
|
|
|
164
164
|
| **Backend** | `sw:architect` | `infra:devops` | API endpoints, services, business logic |
|
|
165
165
|
| **Database** | `sw:architect` | | Schema design, migrations, seed data |
|
|
166
166
|
| **Shared/Types** | `sw:architect` | `sw:code-simplifier` | TypeScript interfaces, shared constants, API contracts |
|
|
167
|
-
| **Testing** | `
|
|
167
|
+
| **Testing** | `sw:e2e` | `sw:tdd-red`, `sw:validate` | Test strategy, E2E suites, integration tests |
|
|
168
168
|
| **Security** | `sw:security` | `security:patterns` | Auth, authorization, threat modeling, OWASP |
|
|
169
169
|
| **DevOps** | `infra:devops` | `k8s:deployment-generate`, `infra:observability` | CI/CD, Docker, K8s, monitoring |
|
|
170
170
|
| **Mobile** | `mobile:react-native` | `mobile:screen-generate`, `mobile:expo` | Native/cross-platform mobile apps |
|
|
@@ -416,7 +416,7 @@ Agent definitions live as reusable `.md` files in the `agents/` subdirectory. Wh
|
|
|
416
416
|
| Frontend | `agents/frontend.md` | UI, components, pages | 2 (downstream) | `frontend:architect`, `frontend:design` |
|
|
417
417
|
| Backend | `agents/backend.md` | API, services, middleware | 2 (downstream) | `sw:architect`, `infra:devops` |
|
|
418
418
|
| Database | `agents/database.md` | Schema, migrations, seeds | 1 (upstream) | `sw:architect` |
|
|
419
|
-
| Testing | `agents/testing.md` | Unit, integration, E2E | 2 (downstream) | `
|
|
419
|
+
| Testing | `agents/testing.md` | Unit, integration, E2E | 2 (downstream) | `sw:e2e`, `sw:tdd-red` |
|
|
420
420
|
| Security | `agents/security.md` | Auth, validation, audit | 2 (downstream) | `sw:security` |
|
|
421
421
|
|
|
422
422
|
### How to Use Agent Files
|
|
@@ -7,9 +7,9 @@ MASTER SPEC (SOURCE OF TRUTH):
|
|
|
7
7
|
Read the master spec BEFORE planning any work.
|
|
8
8
|
|
|
9
9
|
SKILLS TO INVOKE:
|
|
10
|
-
Skill({ skill: "
|
|
11
|
-
Skill({ skill: "
|
|
12
|
-
Skill({ skill: "
|
|
10
|
+
Skill({ skill: "sw:e2e", args: "--generate [INCREMENT_ID]" }) // generate E2E tests from ACs
|
|
11
|
+
Skill({ skill: "sw:e2e", args: "--run [INCREMENT_ID]" }) // run E2E + produce e2e-report.json
|
|
12
|
+
Skill({ skill: "sw:e2e", args: "--a11y [INCREMENT_ID]" }) // E2E + accessibility audit
|
|
13
13
|
|
|
14
14
|
FILE OWNERSHIP (WRITE access):
|
|
15
15
|
tests/**
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: AI-powered pull request review against spec acceptance criteria. Use for "review PR", "check PR against spec", "review pull request". Enterprise feature.
|
|
3
|
+
argument-hint: "<increment-id|pr-url>"
|
|
4
|
+
user-invokable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# AI Pull Request Review
|
|
8
|
+
|
|
9
|
+
Reviews a pull request against the increment's spec.md acceptance criteria. Posts structured review comments on the PR via `gh pr review`.
|
|
10
|
+
|
|
11
|
+
This is an **enterprise feature** — optional, not part of the default flow. Invoke explicitly or configure for automatic invocation.
|
|
12
|
+
|
|
13
|
+
## When to Activate
|
|
14
|
+
|
|
15
|
+
**Do activate:**
|
|
16
|
+
- User says "review PR", "check PR against spec", "review pull request"
|
|
17
|
+
- User says "AI review for PR #42"
|
|
18
|
+
- Configured for automatic review after `sw:pr` creates a PR
|
|
19
|
+
|
|
20
|
+
**Do NOT activate:**
|
|
21
|
+
- User is doing manual code review (don't interfere)
|
|
22
|
+
- No increment context available
|
|
23
|
+
- PR is already merged
|
|
24
|
+
|
|
25
|
+
## Step 1: Resolve PR and Increment
|
|
26
|
+
|
|
27
|
+
**If given an increment ID:**
|
|
28
|
+
```bash
|
|
29
|
+
# Read PR refs from metadata
|
|
30
|
+
PR_URL=$(jq -r '.prRefs[0].prUrl // empty' .specweave/increments/{id}/metadata.json)
|
|
31
|
+
PR_NUMBER=$(jq -r '.prRefs[0].prNumber // empty' .specweave/increments/{id}/metadata.json)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**If given a PR URL or number:**
|
|
35
|
+
```bash
|
|
36
|
+
# Extract PR number from URL
|
|
37
|
+
PR_NUMBER=$(echo "$PR_URL" | grep -oE '[0-9]+$')
|
|
38
|
+
# Find increment by searching metadata for matching prRefs
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**If neither:** Check current branch for an associated PR:
|
|
42
|
+
```bash
|
|
43
|
+
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
44
|
+
PR_NUMBER=$(gh pr list --head "$CURRENT_BRANCH" --json number -q '.[0].number')
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Step 2: Load Spec Context
|
|
48
|
+
|
|
49
|
+
Read the increment spec.md to extract:
|
|
50
|
+
1. All acceptance criteria (AC-USXX-YY)
|
|
51
|
+
2. User stories overview
|
|
52
|
+
3. Non-functional requirements
|
|
53
|
+
4. Edge cases documented in the spec
|
|
54
|
+
|
|
55
|
+
Build a review checklist from ACs.
|
|
56
|
+
|
|
57
|
+
## Step 3: Get PR Diff
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
gh pr diff ${PR_NUMBER} > /tmp/sw-pr-diff-${PR_NUMBER}.diff
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Also get the list of changed files:
|
|
64
|
+
```bash
|
|
65
|
+
gh pr view ${PR_NUMBER} --json files -q '.files[].path'
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Step 4: Review Against Acceptance Criteria
|
|
69
|
+
|
|
70
|
+
For each AC in spec.md, analyze the diff to determine:
|
|
71
|
+
|
|
72
|
+
- **SATISFIED**: The diff clearly implements this criterion
|
|
73
|
+
- **PARTIALLY SATISFIED**: Some aspects are covered, others are missing
|
|
74
|
+
- **NOT SATISFIED**: No evidence of implementation in the diff
|
|
75
|
+
- **NOT APPLICABLE**: This AC is not relevant to the changed files
|
|
76
|
+
|
|
77
|
+
Build a structured review:
|
|
78
|
+
|
|
79
|
+
```markdown
|
|
80
|
+
## SpecWeave AC Review — Increment {INCREMENT_ID}
|
|
81
|
+
|
|
82
|
+
### Acceptance Criteria Coverage
|
|
83
|
+
|
|
84
|
+
| AC | Status | Evidence |
|
|
85
|
+
|----|--------|----------|
|
|
86
|
+
| AC-US1-01: User can log in | SATISFIED | `src/auth/login.ts` implements full flow |
|
|
87
|
+
| AC-US1-02: Invalid creds show error | PARTIALLY | Error handling exists but no user-facing message |
|
|
88
|
+
| AC-US2-01: Session persists | NOT SATISFIED | No session storage implementation found |
|
|
89
|
+
|
|
90
|
+
### Code Quality Observations
|
|
91
|
+
|
|
92
|
+
{List any code quality issues found in the diff — not bugs, but patterns that deviate from the spec or best practices}
|
|
93
|
+
|
|
94
|
+
### Summary
|
|
95
|
+
|
|
96
|
+
{Overall assessment: ready to merge / needs changes / needs discussion}
|
|
97
|
+
- {X}/{Y} ACs satisfied
|
|
98
|
+
- {Z} observations
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Step 5: Post Review
|
|
102
|
+
|
|
103
|
+
Determine review action based on AC coverage:
|
|
104
|
+
|
|
105
|
+
- **All ACs satisfied**: `--approve`
|
|
106
|
+
- **Any AC not satisfied**: `--request-changes`
|
|
107
|
+
- **Only observations, no blockers**: `--comment`
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
gh pr review ${PR_NUMBER} \
|
|
111
|
+
--body-file /tmp/sw-pr-review-${PR_NUMBER}.md \
|
|
112
|
+
--{approve|request-changes|comment}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Clean up:
|
|
116
|
+
```bash
|
|
117
|
+
rm -f /tmp/sw-pr-diff-${PR_NUMBER}.diff /tmp/sw-pr-review-${PR_NUMBER}.md
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Step 6: Post Inline Comments (Optional)
|
|
121
|
+
|
|
122
|
+
For specific issues found in the diff, post inline comments on the relevant lines:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# For each finding with a specific file + line:
|
|
126
|
+
gh api repos/{owner}/{repo}/pulls/${PR_NUMBER}/comments \
|
|
127
|
+
-f body="**AC-US1-02**: Error message is logged but not displayed to the user. The spec requires a user-facing error toast." \
|
|
128
|
+
-f commit_id="{latest_commit_sha}" \
|
|
129
|
+
-f path="src/auth/login.ts" \
|
|
130
|
+
-F line=42 \
|
|
131
|
+
-f side="RIGHT"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Scheduled Review Mode
|
|
135
|
+
|
|
136
|
+
For teams that want automated PR reviews, this skill can be triggered via Claude Code scheduled tasks:
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
// .claude/scheduled-tasks.json
|
|
140
|
+
{
|
|
141
|
+
"tasks": [{
|
|
142
|
+
"schedule": "*/30 * * * *",
|
|
143
|
+
"command": "/sw:pr-review --all-open",
|
|
144
|
+
"description": "Review all open PRs every 30 minutes"
|
|
145
|
+
}]
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
When invoked with `--all-open`:
|
|
150
|
+
1. List all open PRs: `gh pr list --state open --json number,headRefName`
|
|
151
|
+
2. For each PR, check if it has an associated increment (via branch naming convention or metadata scan)
|
|
152
|
+
3. Skip PRs already reviewed by this tool (check for existing SpecWeave review comments)
|
|
153
|
+
4. Review each PR against its increment spec
|
|
154
|
+
|
|
155
|
+
## Multi-Agent Review (Complex PRs)
|
|
156
|
+
|
|
157
|
+
For PRs spanning multiple domains (frontend + backend + infrastructure), consider using `sw:team-build` with the `review` preset to spawn domain-specialized review agents in parallel.
|
|
158
|
+
|
|
159
|
+
## Error Handling
|
|
160
|
+
|
|
161
|
+
| Error | Action |
|
|
162
|
+
|-------|--------|
|
|
163
|
+
| No spec.md found | Warn: "No increment spec found for this PR. Cannot perform AC review." |
|
|
164
|
+
| PR already merged | Skip: "PR #{N} is already merged." |
|
|
165
|
+
| `gh` auth issues | Warn: "Run: gh auth login" |
|
|
166
|
+
| Large diff (>5000 lines) | Summarize by file instead of line-by-line review |
|