specweave 1.0.438 → 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.
Files changed (27) hide show
  1. package/dist/src/core/cicd/config-loader.d.ts.map +1 -1
  2. package/dist/src/core/cicd/config-loader.js +14 -1
  3. package/dist/src/core/cicd/config-loader.js.map +1 -1
  4. package/dist/src/core/cicd/monitor-service.d.ts +15 -0
  5. package/dist/src/core/cicd/monitor-service.d.ts.map +1 -1
  6. package/dist/src/core/cicd/monitor-service.js +2 -0
  7. package/dist/src/core/cicd/monitor-service.js.map +1 -1
  8. package/dist/src/core/config/types.d.ts +35 -0
  9. package/dist/src/core/config/types.d.ts.map +1 -1
  10. package/dist/src/core/config/types.js +5 -0
  11. package/dist/src/core/config/types.js.map +1 -1
  12. package/dist/src/core/increment/metadata-manager.d.ts +21 -1
  13. package/dist/src/core/increment/metadata-manager.d.ts.map +1 -1
  14. package/dist/src/core/increment/metadata-manager.js +34 -0
  15. package/dist/src/core/increment/metadata-manager.js.map +1 -1
  16. package/dist/src/core/types/increment-metadata.d.ts +37 -0
  17. package/dist/src/core/types/increment-metadata.d.ts.map +1 -1
  18. package/package.json +1 -1
  19. package/plugins/specweave/lib/vendor/core/increment/metadata-manager.d.ts +21 -1
  20. package/plugins/specweave/lib/vendor/core/increment/metadata-manager.js +34 -0
  21. package/plugins/specweave/lib/vendor/core/increment/metadata-manager.js.map +1 -1
  22. package/plugins/specweave/lib/vendor/core/types/increment-metadata.d.ts +37 -0
  23. package/plugins/specweave/skills/auto/SKILL.md +6 -0
  24. package/plugins/specweave/skills/do/SKILL.md +23 -1
  25. package/plugins/specweave/skills/done/SKILL.md +15 -0
  26. package/plugins/specweave/skills/pr/SKILL.md +215 -0
  27. package/plugins/specweave-github/skills/pr-review/SKILL.md +166 -0
@@ -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 |