sequant 2.1.2 → 2.3.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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +73 -0
- package/dist/bin/cli.js +95 -9
- package/dist/src/commands/doctor.d.ts +25 -0
- package/dist/src/commands/doctor.js +36 -1
- package/dist/src/commands/init.d.ts +1 -0
- package/dist/src/commands/init.js +118 -0
- package/dist/src/commands/locks.d.ts +67 -0
- package/dist/src/commands/locks.js +290 -0
- package/dist/src/commands/merge.js +11 -0
- package/dist/src/commands/prompt.d.ts +39 -0
- package/dist/src/commands/prompt.js +179 -0
- package/dist/src/commands/run-display.d.ts +26 -0
- package/dist/src/commands/run-display.js +150 -0
- package/dist/src/commands/run-progress.d.ts +32 -0
- package/dist/src/commands/run-progress.js +76 -0
- package/dist/src/commands/run.js +83 -73
- package/dist/src/commands/stats.d.ts +2 -0
- package/dist/src/commands/stats.js +94 -8
- package/dist/src/commands/status.js +27 -1
- package/dist/src/commands/watch.d.ts +16 -0
- package/dist/src/commands/watch.js +147 -0
- package/dist/src/lib/ac-linter.d.ts +1 -1
- package/dist/src/lib/ac-linter.js +81 -0
- package/dist/src/lib/assess-collision-detect.d.ts +91 -0
- package/dist/src/lib/assess-collision-detect.js +217 -0
- package/dist/src/lib/assess-comment-parser.d.ts +59 -1
- package/dist/src/lib/assess-comment-parser.js +124 -2
- package/dist/src/lib/cli-ui/format.d.ts +19 -0
- package/dist/src/lib/cli-ui/format.js +34 -0
- package/dist/src/lib/cli-ui/run-renderer-types.d.ts +181 -0
- package/dist/src/lib/cli-ui/run-renderer-types.js +7 -0
- package/dist/src/lib/cli-ui/run-renderer.d.ts +239 -0
- package/dist/src/lib/cli-ui/run-renderer.js +1173 -0
- package/dist/src/lib/heuristics/behavior-rule-detector.d.ts +94 -0
- package/dist/src/lib/heuristics/behavior-rule-detector.js +467 -0
- package/dist/src/lib/locks/index.d.ts +7 -0
- package/dist/src/lib/locks/index.js +5 -0
- package/dist/src/lib/locks/lock-manager.d.ts +168 -0
- package/dist/src/lib/locks/lock-manager.js +433 -0
- package/dist/src/lib/locks/types.d.ts +59 -0
- package/dist/src/lib/locks/types.js +31 -0
- package/dist/src/lib/qa/markdown-only-ci.d.ts +46 -0
- package/dist/src/lib/qa/markdown-only-ci.js +74 -0
- package/dist/src/lib/relay/activation.d.ts +60 -0
- package/dist/src/lib/relay/activation.js +122 -0
- package/dist/src/lib/relay/archive.d.ts +34 -0
- package/dist/src/lib/relay/archive.js +106 -0
- package/dist/src/lib/relay/frame.d.ts +20 -0
- package/dist/src/lib/relay/frame.js +76 -0
- package/dist/src/lib/relay/index.d.ts +13 -0
- package/dist/src/lib/relay/index.js +13 -0
- package/dist/src/lib/relay/paths.d.ts +43 -0
- package/dist/src/lib/relay/paths.js +59 -0
- package/dist/src/lib/relay/pid.d.ts +34 -0
- package/dist/src/lib/relay/pid.js +72 -0
- package/dist/src/lib/relay/reader.d.ts +35 -0
- package/dist/src/lib/relay/reader.js +115 -0
- package/dist/src/lib/relay/types.d.ts +68 -0
- package/dist/src/lib/relay/types.js +76 -0
- package/dist/src/lib/relay/writer.d.ts +48 -0
- package/dist/src/lib/relay/writer.js +113 -0
- package/dist/src/lib/settings.d.ts +31 -1
- package/dist/src/lib/settings.js +18 -3
- package/dist/src/lib/skill-version.d.ts +19 -0
- package/dist/src/lib/skill-version.js +68 -0
- package/dist/src/lib/templates.d.ts +1 -0
- package/dist/src/lib/templates.js +1 -1
- package/dist/src/lib/version-check.d.ts +60 -5
- package/dist/src/lib/version-check.js +97 -9
- package/dist/src/lib/workflow/batch-executor.d.ts +20 -1
- package/dist/src/lib/workflow/batch-executor.js +249 -176
- package/dist/src/lib/workflow/config-resolver.js +4 -0
- package/dist/src/lib/workflow/heartbeat.d.ts +71 -0
- package/dist/src/lib/workflow/heartbeat.js +194 -0
- package/dist/src/lib/workflow/phase-executor.d.ts +88 -3
- package/dist/src/lib/workflow/phase-executor.js +276 -52
- package/dist/src/lib/workflow/phase-mapper.d.ts +3 -2
- package/dist/src/lib/workflow/phase-mapper.js +17 -20
- package/dist/src/lib/workflow/platforms/github.d.ts +1 -1
- package/dist/src/lib/workflow/platforms/github.js +20 -3
- package/dist/src/lib/workflow/pr-status.d.ts +18 -2
- package/dist/src/lib/workflow/pr-status.js +41 -9
- package/dist/src/lib/workflow/qa-stagnation.d.ts +117 -0
- package/dist/src/lib/workflow/qa-stagnation.js +179 -0
- package/dist/src/lib/workflow/run-orchestrator.d.ts +76 -0
- package/dist/src/lib/workflow/run-orchestrator.js +382 -29
- package/dist/src/lib/workflow/run-reflect.js +1 -1
- package/dist/src/lib/workflow/run-state.d.ts +71 -0
- package/dist/src/lib/workflow/run-state.js +14 -0
- package/dist/src/lib/workflow/state-cleanup.d.ts +13 -5
- package/dist/src/lib/workflow/state-cleanup.js +17 -5
- package/dist/src/lib/workflow/state-manager.d.ts +12 -1
- package/dist/src/lib/workflow/state-manager.js +37 -0
- package/dist/src/lib/workflow/state-schema.d.ts +62 -0
- package/dist/src/lib/workflow/state-schema.js +35 -1
- package/dist/src/lib/workflow/types.d.ts +74 -1
- package/dist/src/lib/workflow/worktree-manager.d.ts +12 -4
- package/dist/src/lib/workflow/worktree-manager.js +76 -17
- package/dist/src/mcp/tools/run.d.ts +44 -0
- package/dist/src/mcp/tools/run.js +104 -13
- package/dist/src/ui/tui/App.d.ts +14 -0
- package/dist/src/ui/tui/App.js +41 -0
- package/dist/src/ui/tui/ElapsedTimer.d.ts +10 -0
- package/dist/src/ui/tui/ElapsedTimer.js +31 -0
- package/dist/src/ui/tui/Header.d.ts +6 -0
- package/dist/src/ui/tui/Header.js +15 -0
- package/dist/src/ui/tui/IssueBox.d.ts +16 -0
- package/dist/src/ui/tui/IssueBox.js +68 -0
- package/dist/src/ui/tui/Spinner.d.ts +9 -0
- package/dist/src/ui/tui/Spinner.js +18 -0
- package/dist/src/ui/tui/index.d.ts +15 -0
- package/dist/src/ui/tui/index.js +29 -0
- package/dist/src/ui/tui/theme.d.ts +29 -0
- package/dist/src/ui/tui/theme.js +52 -0
- package/dist/src/ui/tui/truncate.d.ts +11 -0
- package/dist/src/ui/tui/truncate.js +31 -0
- package/package.json +10 -3
- package/templates/agents/sequant-explorer.md +1 -0
- package/templates/agents/sequant-qa-checker.md +2 -1
- package/templates/agents/sequant-testgen.md +1 -0
- package/templates/hooks/post-tool.sh +11 -0
- package/templates/hooks/pre-tool.sh +18 -9
- package/templates/hooks/relay-check.sh +107 -0
- package/templates/relay/frame.txt +11 -0
- package/templates/scripts/cleanup-worktree.sh +25 -3
- package/templates/scripts/new-feature.sh +6 -0
- package/templates/skills/_shared/references/behavior-rule-detection.md +205 -0
- package/templates/skills/_shared/references/subagent-types.md +21 -8
- package/templates/skills/assess/SKILL.md +261 -94
- package/templates/skills/assess/references/predicted-collision-detection.md +109 -0
- package/templates/skills/docs/SKILL.md +141 -22
- package/templates/skills/exec/SKILL.md +10 -49
- package/templates/skills/fullsolve/SKILL.md +80 -32
- package/templates/skills/loop/SKILL.md +28 -0
- package/templates/skills/merger/SKILL.md +621 -0
- package/templates/skills/qa/SKILL.md +746 -8
- package/templates/skills/qa/scripts/quality-checks.sh +47 -1
- package/templates/skills/setup/SKILL.md +6 -0
- package/templates/skills/spec/SKILL.md +217 -964
- package/templates/skills/spec/references/parallel-groups.md +7 -0
- package/templates/skills/spec/references/quality-checklist.md +75 -0
- package/templates/skills/spec/references/recommended-workflow.md +4 -2
- package/templates/skills/test/SKILL.md +0 -27
- package/templates/skills/testgen/SKILL.md +24 -44
|
@@ -4,7 +4,7 @@ description: "Plan review vs Acceptance Criteria for a single GitHub issue, plus
|
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
6
|
author: sequant
|
|
7
|
-
version: "1
|
|
7
|
+
version: "2.1"
|
|
8
8
|
allowed-tools:
|
|
9
9
|
- Bash(npm test:*)
|
|
10
10
|
- Bash(gh issue view:*)
|
|
@@ -19,987 +19,212 @@ allowed-tools:
|
|
|
19
19
|
|
|
20
20
|
# Planning Agent
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
Phase 1 "Planning Agent." Understands the issue and AC, reviews or synthesizes a plan, identifies gaps and risks, and drafts a GitHub issue comment.
|
|
23
23
|
|
|
24
|
-
##
|
|
24
|
+
## Platform Detection — Run First
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
```bash
|
|
27
|
+
gh --version >/dev/null 2>&1 && GITHUB_AVAILABLE=true || GITHUB_AVAILABLE=false
|
|
28
|
+
SETTINGS_AVAILABLE=false; [ -f ".sequant/settings.json" ] && SETTINGS_AVAILABLE=true
|
|
29
|
+
```
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
3. Identify ambiguities, gaps, or risks.
|
|
31
|
-
4. Draft a GitHub issue comment summarizing AC + the agreed plan.
|
|
31
|
+
- **GitHub unavailable:** Skip phase detection, label review, auto-comment. Prompt user for AC from description text.
|
|
32
|
+
- **Settings unavailable:** Use defaults silently (sequential agents, no custom scope config).
|
|
32
33
|
|
|
33
|
-
## Phase Detection
|
|
34
|
+
## Phase Detection
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
If GitHub is available, check for prior phase completion:
|
|
36
37
|
|
|
37
38
|
```bash
|
|
38
|
-
# Check for existing phase markers
|
|
39
39
|
phase_data=$(gh issue view <issue-number> --json comments --jq '[.comments[].body]' | \
|
|
40
40
|
grep -o '{[^}]*}' | grep '"phase"' | tail -1 || true)
|
|
41
|
-
|
|
42
|
-
if [[ -n "$phase_data" ]]; then
|
|
43
|
-
phase=$(echo "$phase_data" | jq -r '.phase')
|
|
44
|
-
status=$(echo "$phase_data" | jq -r '.status')
|
|
45
|
-
|
|
46
|
-
# Skip if spec is already completed or a later phase is completed
|
|
47
|
-
if [[ "$phase" == "spec" && "$status" == "completed" ]] || \
|
|
48
|
-
[[ "$phase" == "exec" || "$phase" == "test" || "$phase" == "qa" ]]; then
|
|
49
|
-
echo "⏭️ Spec phase already completed (detected: $phase:$status). Skipping."
|
|
50
|
-
# Exit early — no work needed
|
|
51
|
-
fi
|
|
52
|
-
fi
|
|
53
41
|
```
|
|
54
42
|
|
|
55
|
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
- If no markers found → Normal execution (fresh start)
|
|
59
|
-
- If detection fails (API error) → Fall through to normal execution
|
|
60
|
-
|
|
61
|
-
**Phase Marker Emission:**
|
|
62
|
-
|
|
63
|
-
When posting the spec plan comment to GitHub, append a phase marker at the end:
|
|
43
|
+
- `spec:completed` or later phase detected → Skip with message
|
|
44
|
+
- `spec:failed` → Re-run
|
|
45
|
+
- No markers / API error → Normal execution
|
|
64
46
|
|
|
65
|
-
|
|
47
|
+
Append to every phase-completion comment:
|
|
48
|
+
```
|
|
66
49
|
<!-- SEQUANT_PHASE: {"phase":"spec","status":"completed","timestamp":"<ISO-8601>"} -->
|
|
67
50
|
```
|
|
68
51
|
|
|
69
|
-
Include this marker in every `gh issue comment` that represents phase completion.
|
|
70
|
-
|
|
71
52
|
## Behavior
|
|
72
53
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
2. **Read all GitHub issue comments** for complete context.
|
|
76
|
-
3. Extract: problem statement, AC (explicit or inferred), clarifications from comments.
|
|
77
|
-
|
|
78
|
-
When called like `/spec <freeform description>`:
|
|
79
|
-
1. Treat the text as the problem/AC source.
|
|
80
|
-
2. Ask clarifying questions if AC are ambiguous or conflicting.
|
|
54
|
+
**`/spec 123`** — GitHub issue number. Read all comments for full context. Extract AC.
|
|
55
|
+
**`/spec <text>`** — Freeform problem/AC source. Ask clarifying questions if ambiguous.
|
|
81
56
|
|
|
82
|
-
**
|
|
83
|
-
- Usage: `/spec 123 --skip-ac-lint`
|
|
84
|
-
- Effect: Skips the AC Quality Check step
|
|
85
|
-
- Use when: AC are intentionally high-level or you want to defer linting
|
|
57
|
+
**Flags:** `--skip-ac-lint` (skip AC quality check), `--skip-scope-check` (skip scope assessment).
|
|
86
58
|
|
|
87
|
-
|
|
88
|
-
- Usage: `/spec 123 --skip-scope-check`
|
|
89
|
-
- Effect: Skips the Scope Assessment step
|
|
90
|
-
- Use when: Issue scope is intentionally complex or you want to defer assessment
|
|
59
|
+
## Complexity Tier Determination
|
|
91
60
|
|
|
92
|
-
|
|
61
|
+
Determine the output tier **before** generating any output. Announce it as the first line.
|
|
93
62
|
|
|
94
|
-
|
|
63
|
+
| Tier | Criteria | Output Scope | Target |
|
|
64
|
+
|------|----------|--------------|--------|
|
|
65
|
+
| **Simple** | `simple-fix`/`typo`/`docs-only` label, or `bug` with ≤2 AC | AC list + plan + Design Review Q1/Q3 only | <4,000 chars |
|
|
66
|
+
| **Standard** | 3–8 AC, no complexity labels | Full output minus Polish, minus trivially-passing quality checks | <8,000 chars |
|
|
67
|
+
| **Complex** | `complex`/`refactor`/`breaking` label, or 9+ AC | Full output including all quality dimensions | <15,000 chars |
|
|
95
68
|
|
|
96
|
-
|
|
97
|
-
# Extract AC from issue body and store in state
|
|
98
|
-
npx tsx -e "
|
|
99
|
-
import { extractAcceptanceCriteria } from './src/lib/ac-parser.ts';
|
|
100
|
-
import { StateManager } from './src/lib/workflow/state-manager.ts';
|
|
101
|
-
|
|
102
|
-
const issueBody = \`<ISSUE_BODY_HERE>\`;
|
|
103
|
-
const issueNumber = <ISSUE_NUMBER>;
|
|
104
|
-
const issueTitle = '<ISSUE_TITLE>';
|
|
105
|
-
|
|
106
|
-
const ac = extractAcceptanceCriteria(issueBody);
|
|
107
|
-
console.log('Extracted AC:', JSON.stringify(ac, null, 2));
|
|
108
|
-
|
|
109
|
-
if (ac.items.length > 0) {
|
|
110
|
-
const manager = new StateManager();
|
|
111
|
-
(async () => {
|
|
112
|
-
const existing = await manager.getIssueState(issueNumber);
|
|
113
|
-
if (!existing) {
|
|
114
|
-
await manager.initializeIssue(issueNumber, issueTitle);
|
|
115
|
-
}
|
|
116
|
-
await manager.updateAcceptanceCriteria(issueNumber, ac);
|
|
117
|
-
console.log('AC stored in state for issue #' + issueNumber);
|
|
118
|
-
})();
|
|
119
|
-
}
|
|
120
|
-
"
|
|
121
|
-
```
|
|
69
|
+
First line of output: `**Complexity: [Tier]** ([N] ACs, [N] directories)`
|
|
122
70
|
|
|
123
|
-
|
|
124
|
-
- Dashboard visibility of AC progress per issue
|
|
125
|
-
- `/qa` skill to update AC status during review
|
|
126
|
-
- Cross-skill AC tracking throughout the workflow
|
|
71
|
+
Mark tier in HTML comment for downstream parsing: `<!-- SEQUANT_SPEC_TIER: [tier] -->`
|
|
127
72
|
|
|
128
|
-
|
|
129
|
-
The parser supports multiple formats:
|
|
130
|
-
- `- [ ] **AC-1:** Description` (bold with hyphen)
|
|
131
|
-
- `- [ ] **B2:** Description` (letter + number)
|
|
132
|
-
- `- [ ] AC-1: Description` (no bold)
|
|
73
|
+
## Programmatic Checks (Conditional)
|
|
133
74
|
|
|
134
|
-
**
|
|
135
|
-
- Log a warning but continue with planning
|
|
136
|
-
- The plan output should note that AC will need to be defined
|
|
75
|
+
**Guard:** Only run `npx tsx` blocks if `./src/lib/ac-parser.ts` exists (sequant repo). Otherwise, perform all analysis inline by reading the issue text directly.
|
|
137
76
|
|
|
138
|
-
###
|
|
77
|
+
### If guard passes:
|
|
139
78
|
|
|
140
|
-
**
|
|
79
|
+
1. **AC Extraction & Storage:** Use `extractAcceptanceCriteria` from `./src/lib/ac-parser.ts` and `StateManager` from `./src/lib/workflow/state-manager.ts` to parse and store AC in `.sequant/state.json`. Supports formats: `- [ ] **AC-1:** Desc`, `- [ ] AC-1: Desc`, `- [ ] **B2:** Desc`.
|
|
141
80
|
|
|
142
|
-
|
|
143
|
-
# Lint AC for quality issues (skip if --skip-ac-lint flag is set)
|
|
144
|
-
npx tsx -e "
|
|
145
|
-
import { parseAcceptanceCriteria } from './src/lib/ac-parser.ts';
|
|
146
|
-
import { lintAcceptanceCriteria, formatACLintResults } from './src/lib/ac-linter.ts';
|
|
81
|
+
2. **AC Quality Check** (unless `--skip-ac-lint`): Use `lintAcceptanceCriteria` from `./src/lib/ac-linter.ts`. Warning-only — does not block planning. Flag these patterns:
|
|
147
82
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
"
|
|
154
|
-
|
|
83
|
+
| Pattern | Examples | Issue |
|
|
84
|
+
|---------|----------|-------|
|
|
85
|
+
| Vague | "should work", "properly" | No measurable outcome |
|
|
86
|
+
| Unmeasurable | "fast", "performant" | No threshold defined |
|
|
87
|
+
| Incomplete | "handle errors", "edge cases" | Scenarios not enumerated |
|
|
88
|
+
| Open-ended | "etc.", "and more" | Scope undefined |
|
|
89
|
+
| Title/body tension | doc-noun title ("note", "comment", "snippet") + runtime-imperative body ("execute", "trigger", "capture", incl. inflections like `triggered`/`captured`, `run /<cmd>`); separators `.`/`\n`/`:`/`—` | Two different verification bars |
|
|
155
90
|
|
|
156
|
-
**
|
|
157
|
-
- Ambiguous implementations that don't match expectations
|
|
158
|
-
- Subjective /qa verdicts ("does it work properly?")
|
|
159
|
-
- Wasted iteration cycles when requirements are clarified late
|
|
91
|
+
3. **Scope Assessment** (unless `--skip-scope-check`): Use `performScopeAssessment` from `./src/lib/scope/index.ts` with settings from `getSettings()`. Verdicts: SCOPE_OK (green), SCOPE_WARNING (yellow, auto-enables quality loop), SCOPE_SPLIT_RECOMMENDED (red). Store results in state.
|
|
160
92
|
|
|
161
|
-
|
|
93
|
+
### If guard fails (consumer projects):
|
|
162
94
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
| Incomplete | "handle errors", "edge cases" | Specific scenarios not enumerated |
|
|
168
|
-
| Open-ended | "etc.", "and more", "such as" | Scope is undefined |
|
|
169
|
-
|
|
170
|
-
**Example Output:**
|
|
171
|
-
|
|
172
|
-
```markdown
|
|
173
|
-
## AC Quality Check
|
|
95
|
+
Perform the same analysis inline:
|
|
96
|
+
- Extract AC by pattern-matching the issue body
|
|
97
|
+
- Flag vague/unmeasurable AC in the AC Quality Check section
|
|
98
|
+
- Assess scope using the same green/yellow/red heuristics on feature count, AC count, directory spread
|
|
174
99
|
|
|
175
|
-
|
|
176
|
-
→ Incomplete: error types not specified
|
|
177
|
-
→ Suggest: List specific error types and expected responses (e.g., 400 for invalid input, 503 for service unavailable)
|
|
100
|
+
## Context Gathering
|
|
178
101
|
|
|
179
|
-
|
|
180
|
-
→ Unmeasurable: "quickly" has no threshold
|
|
181
|
-
→ Suggest: Specify time limit (e.g., completes in <5 seconds)
|
|
102
|
+
### Discover Project Structure — REQUIRED
|
|
182
103
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
**Summary:** 2/5 AC items flagged for review
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
**Behavior:**
|
|
189
|
-
- **Warning-only**: AC Quality Check does NOT block planning
|
|
190
|
-
- Issues are surfaced in the output but plan generation continues
|
|
191
|
-
- Include flagged AC in the issue comment draft with suggestions
|
|
192
|
-
- Recommend refining vague AC before implementation
|
|
193
|
-
|
|
194
|
-
**If `--skip-ac-lint` flag is set:**
|
|
195
|
-
- Output: `AC Quality Check: Skipped (--skip-ac-lint flag set)`
|
|
196
|
-
- Continue directly to plan generation
|
|
197
|
-
|
|
198
|
-
### Scope Assessment — REQUIRED (unless --skip-scope-check)
|
|
199
|
-
|
|
200
|
-
**After AC Quality Check**, run scope assessment to detect overscoped issues:
|
|
104
|
+
**Do NOT use hardcoded paths.** Discover what actually exists:
|
|
201
105
|
|
|
202
106
|
```bash
|
|
203
|
-
|
|
204
|
-
npx tsx -e "
|
|
205
|
-
import { parseAcceptanceCriteria } from './src/lib/ac-parser.ts';
|
|
206
|
-
import { performScopeAssessment, formatScopeAssessment, convertSettingsToConfig } from './src/lib/scope/index.ts';
|
|
207
|
-
import { getSettings } from './src/lib/settings.ts';
|
|
208
|
-
|
|
209
|
-
const issueBody = \`<ISSUE_BODY_HERE>\`;
|
|
210
|
-
const issueTitle = '<ISSUE_TITLE>';
|
|
211
|
-
|
|
212
|
-
(async () => {
|
|
213
|
-
const settings = await getSettings();
|
|
214
|
-
const config = convertSettingsToConfig(settings.scopeAssessment);
|
|
215
|
-
|
|
216
|
-
const criteria = parseAcceptanceCriteria(issueBody);
|
|
217
|
-
const assessment = performScopeAssessment(criteria, issueBody, issueTitle, config);
|
|
218
|
-
console.log(formatScopeAssessment(assessment));
|
|
219
|
-
})();
|
|
220
|
-
"
|
|
107
|
+
ls -d src/ app/ lib/ components/ pages/ routes/ docs/ 2>/dev/null || true
|
|
221
108
|
```
|
|
222
109
|
|
|
223
|
-
|
|
224
|
-
- Bundled features (3+ distinct features) should be separate issues
|
|
225
|
-
- Missing non-goals lead to scope creep during implementation
|
|
226
|
-
- High AC counts increase complexity and error rates
|
|
227
|
-
|
|
228
|
-
**Scope Metrics:**
|
|
229
|
-
|
|
230
|
-
| Metric | Green | Yellow | Red |
|
|
231
|
-
|--------|-------|--------|-----|
|
|
232
|
-
| Feature count | 1 | 2 | 3+ |
|
|
233
|
-
| AC items | 1-5 | 6-8 | 9+ |
|
|
234
|
-
| Directory spread | 1-2 | 3-4 | 5+ |
|
|
110
|
+
Use discovered paths in all agent prompts and search commands.
|
|
235
111
|
|
|
236
|
-
|
|
112
|
+
### Agent Spawn Rules
|
|
237
113
|
|
|
238
|
-
|
|
114
|
+
Determine agent count from issue content — do NOT always spawn 3:
|
|
239
115
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
- [ ] [Adjacent feature we're deferring]
|
|
247
|
-
- [ ] [Scope boundary we're respecting]
|
|
248
|
-
- [ ] [Future work that's out of scope]
|
|
249
|
-
```
|
|
116
|
+
| Issue Content | Agents | What to Spawn |
|
|
117
|
+
|---------------|--------|---------------|
|
|
118
|
+
| Database/SQL/migration keywords in AC or labels | 3 | Similar features + Codebase area + Database schema |
|
|
119
|
+
| UI/frontend (`.tsx`/`.jsx`/`components/` references) | 2 | Similar features + Codebase area |
|
|
120
|
+
| CLI/script changes | 2 | Similar features + Codebase area |
|
|
121
|
+
| Docs/config/`simple-fix` label | 1 | General context only |
|
|
250
122
|
|
|
251
|
-
**
|
|
123
|
+
**Execution mode:** Read `.sequant/settings.json` → `agents.parallel` (default: false).
|
|
124
|
+
- **Parallel:** Spawn all agents in a SINGLE message
|
|
125
|
+
- **Sequential:** Spawn one at a time, waiting for each to complete
|
|
252
126
|
|
|
253
|
-
|
|
254
|
-
|---------|---------|--------|
|
|
255
|
-
| ✅ SCOPE_OK | Single focused feature | Proceed normally |
|
|
256
|
-
| ⚠️ SCOPE_WARNING | Moderate complexity | Consider narrowing; quality loop auto-enabled |
|
|
257
|
-
| ❌ SCOPE_SPLIT_RECOMMENDED | Multiple features bundled | Strongly recommend splitting |
|
|
127
|
+
Agent prompts MUST reference discovered paths from the step above, not hardcoded ones like `components/admin/` or `lib/queries/`.
|
|
258
128
|
|
|
259
|
-
|
|
129
|
+
### In-Flight Work Analysis
|
|
260
130
|
|
|
261
|
-
|
|
262
|
-
- Quality loop is automatically enabled
|
|
263
|
-
- Include note in Recommended Workflow section:
|
|
264
|
-
```markdown
|
|
265
|
-
**Quality Loop:** enabled (auto-enabled due to scope concerns)
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
**If `--skip-scope-check` flag is set:**
|
|
269
|
-
- Output: `Scope Assessment: Skipped (--skip-scope-check flag set)`
|
|
270
|
-
- Continue to plan generation
|
|
271
|
-
|
|
272
|
-
**Store in State:**
|
|
273
|
-
|
|
274
|
-
After assessment, store results in workflow state for analytics:
|
|
131
|
+
Scan for potential conflicts before planning:
|
|
275
132
|
|
|
276
133
|
```bash
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
import { performScopeAssessment, convertSettingsToConfig } from './src/lib/scope/index.ts';
|
|
280
|
-
import { getSettings } from './src/lib/settings.ts';
|
|
281
|
-
|
|
282
|
-
(async () => {
|
|
283
|
-
const settings = await getSettings();
|
|
284
|
-
const config = convertSettingsToConfig(settings.scopeAssessment);
|
|
285
|
-
|
|
286
|
-
// ... perform assessment with config ...
|
|
287
|
-
// const assessment = performScopeAssessment(criteria, issueBody, issueTitle, config);
|
|
288
|
-
|
|
289
|
-
const manager = new StateManager();
|
|
290
|
-
await manager.updateScopeAssessment(issueNumber, assessment);
|
|
291
|
-
})();
|
|
292
|
-
"
|
|
134
|
+
git worktree list --porcelain
|
|
135
|
+
# For each worktree: git -C <path> diff --name-only origin/main...HEAD
|
|
293
136
|
```
|
|
294
137
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
**Planning Phase:** No worktree needed. Planning happens in the main repository directory. The worktree will be created during the execution phase (`/exec`).
|
|
298
|
-
|
|
299
|
-
### Parallel Context Gathering — REQUIRED
|
|
300
|
-
|
|
301
|
-
**You MUST spawn sub-agents for context gathering.** Do NOT explore the codebase inline with Glob/Grep commands. Sub-agents provide parallel execution, better context isolation, and consistent reporting.
|
|
302
|
-
|
|
303
|
-
**Check agent execution mode first:**
|
|
304
|
-
Use the Read tool to check project settings:
|
|
305
|
-
```
|
|
306
|
-
Read(file_path=".sequant/settings.json")
|
|
307
|
-
# Parse JSON and extract agents.parallel (default: false)
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
#### If parallel mode enabled:
|
|
311
|
-
|
|
312
|
-
**Spawn ALL THREE agents in a SINGLE message:**
|
|
313
|
-
|
|
314
|
-
1. `Agent(subagent_type="sequant-explorer", prompt="Find similar features for [FEATURE]. Check components/admin/, lib/queries/, docs/patterns/. Report: file paths, patterns, recommendations.")`
|
|
315
|
-
|
|
316
|
-
2. `Agent(subagent_type="sequant-explorer", prompt="Explore [CODEBASE AREA] for [FEATURE]. Find: main components, data flow, key files. Report structure.")`
|
|
317
|
-
|
|
318
|
-
3. `Agent(subagent_type="sequant-explorer", prompt="Inspect database for [FEATURE]. Check: table schema, RLS policies, existing queries. Report findings.")`
|
|
319
|
-
|
|
320
|
-
#### If sequential mode (default):
|
|
321
|
-
|
|
322
|
-
**Spawn each agent ONE AT A TIME, waiting for each to complete:**
|
|
323
|
-
|
|
324
|
-
1. **First:** `Agent(subagent_type="sequant-explorer", prompt="Find similar features for [FEATURE]. Check components/admin/, lib/queries/, docs/patterns/. Report: file paths, patterns, recommendations.")`
|
|
325
|
-
|
|
326
|
-
2. **After #1 completes:** `Agent(subagent_type="sequant-explorer", prompt="Explore [CODEBASE AREA] for [FEATURE]. Find: main components, data flow, key files. Report structure.")`
|
|
327
|
-
|
|
328
|
-
3. **After #2 completes:** `Agent(subagent_type="sequant-explorer", prompt="Inspect database for [FEATURE]. Check: table schema, RLS policies, existing queries. Report findings.")`
|
|
329
|
-
|
|
330
|
-
### Feature Branch Context Detection
|
|
331
|
-
|
|
332
|
-
Before creating the implementation plan, check if a custom base branch should be recommended:
|
|
333
|
-
|
|
334
|
-
1. **Check for feature branch references in issue body**:
|
|
335
|
-
```bash
|
|
336
|
-
gh issue view <issue> --json body --jq '.body' | grep -iE "(feature/|branch from|based on|part of.*feature)" || true
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
2. **Check issue labels for feature context**:
|
|
340
|
-
```bash
|
|
341
|
-
gh issue view <issue> --json labels --jq '.labels[].name' | grep -iE "(dashboard|feature-|epic-)" || true
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
3. **Check if project has defaultBase configured**:
|
|
345
|
-
Use the Read tool to check settings:
|
|
346
|
-
```
|
|
347
|
-
Read(file_path=".sequant/settings.json")
|
|
348
|
-
# Extract .run.defaultBase from JSON
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-
4. **If feature branch context detected**, include in plan output:
|
|
352
|
-
```markdown
|
|
353
|
-
## Feature Branch Context
|
|
354
|
-
|
|
355
|
-
**Detected base branch**: `feature/dashboard`
|
|
356
|
-
**Source**: Issue body mentions "Part of dashboard feature" / Project config / Label
|
|
357
|
-
|
|
358
|
-
**Recommended workflow**:
|
|
359
|
-
\`\`\`bash
|
|
360
|
-
npx sequant run <issue> --base feature/dashboard
|
|
361
|
-
\`\`\`
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
### In-Flight Work Analysis (Conflict Detection)
|
|
365
|
-
|
|
366
|
-
Before creating the implementation plan, scan for potential conflicts with in-flight work:
|
|
138
|
+
If overlap detected → include **Conflict Risk Analysis** section with options (alternative approach / wait for merge / coordinate via /merger).
|
|
367
139
|
|
|
368
|
-
|
|
369
|
-
```bash
|
|
370
|
-
git worktree list --porcelain
|
|
371
|
-
```
|
|
140
|
+
Check for explicit dependencies: `gh issue view <issue> --json body,labels`. If "Depends on" found → include **Dependencies** section with status.
|
|
372
141
|
|
|
373
|
-
|
|
374
|
-
```bash
|
|
375
|
-
git -C <worktree-path> diff --name-only <base-branch>...HEAD
|
|
376
|
-
```
|
|
142
|
+
### Feature Branch Context
|
|
377
143
|
|
|
378
|
-
|
|
379
|
-
- Issue description and AC
|
|
380
|
-
- Similar past issues
|
|
381
|
-
- Codebase structure
|
|
144
|
+
Check issue body/labels for feature branch references (`feature/`, `based on`, epic labels). If found, recommend `--base feature/<branch>` in the plan.
|
|
382
145
|
|
|
383
|
-
|
|
384
|
-
```markdown
|
|
385
|
-
## Conflict Risk Analysis
|
|
146
|
+
### Sibling-site Scan (Conditional)
|
|
386
147
|
|
|
387
|
-
|
|
388
|
-
**Overlapping files**:
|
|
389
|
-
- `<file-path>`
|
|
148
|
+
**When to apply:** Focused AC + a localized fix where the same root-cause pattern likely exists at sibling sites in the same file (≥3 instances of the affected pattern in the same file — e.g. the regex blocks in `pre-tool.sh`).
|
|
390
149
|
|
|
391
|
-
|
|
392
|
-
- [ ] Option A: Use alternative file/approach (no conflict)
|
|
393
|
-
- [ ] Option B: Wait for #<N> to merge, then rebase
|
|
394
|
-
- [ ] Option C: Coordinate unified implementation via /merger
|
|
150
|
+
**During planning**, scan the same file/module for sibling code matching the bug's root cause. If sibling sites are found, surface them as either: **(a)** an Open Question (in `## Open Questions`) proposing scope expansion (only when trivially co-located), or **(b)** a recommended follow-up issue (in `## Implementation Plan` or as a separate plan step). When findings mix trivial and non-trivial sites, surface each separately. **Don't silently widen scope — the user decides.**
|
|
395
151
|
|
|
396
|
-
|
|
397
|
-
```
|
|
152
|
+
This operationalizes the principle in `feedback_qa_second_look.md` (structured analysis biases positive on the literal AC; an adversarial re-read of adjacent code surfaces hidden scope) — `/spec` is the front line, `/qa` the safety net, so catching siblings here is strictly cheaper than at QA. Don't automate via grep — false-positive risk; this is a "look at adjacent code" planner prompt.
|
|
398
153
|
|
|
399
|
-
|
|
400
|
-
```bash
|
|
401
|
-
# Look for "Depends on" or "depends-on" labels
|
|
402
|
-
gh issue view <issue> --json body,labels
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
If dependencies found:
|
|
406
|
-
```markdown
|
|
407
|
-
## Dependencies
|
|
408
|
-
|
|
409
|
-
**Depends on**: #<N>
|
|
410
|
-
**Reason**: [Why this issue depends on the other]
|
|
411
|
-
**Status**: [Open/Merged/Closed]
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
### Using MCP Tools (Optional)
|
|
415
|
-
|
|
416
|
-
- **Sequential Thinking:** For complex analysis with multiple dependencies
|
|
417
|
-
- **Context7:** For understanding existing patterns and architecture
|
|
418
|
-
|
|
419
|
-
## Context Gathering Strategy
|
|
420
|
-
|
|
421
|
-
1. **Check the Patterns Catalog first**
|
|
422
|
-
- Read `docs/patterns/README.md` for quick lookup
|
|
423
|
-
- Check HELPERS.md, COMPONENTS.md, TYPES.md
|
|
424
|
-
- **Do NOT propose creating new utilities if similar ones exist**
|
|
425
|
-
|
|
426
|
-
2. **Look for similar features**
|
|
427
|
-
- Use `ls components/admin/[area]/` for existing components
|
|
428
|
-
- Read 1-2 examples to understand patterns
|
|
429
|
-
- Propose solutions matching established architecture
|
|
430
|
-
|
|
431
|
-
3. **Check existing dependencies**
|
|
432
|
-
- Review `package.json` for libraries
|
|
433
|
-
- Prefer existing dependencies over new ones
|
|
434
|
-
- For "solved problem" domains, recommend established packages in the plan:
|
|
435
|
-
| Domain | Recommended Packages |
|
|
436
|
-
|--------|---------------------|
|
|
437
|
-
| Date/time | `date-fns`, `dayjs` |
|
|
438
|
-
| Validation | `zod`, `yup`, `valibot` |
|
|
439
|
-
| HTTP with retry | `ky`, `got`, `axios` |
|
|
440
|
-
| Form state | `react-hook-form` |
|
|
441
|
-
| State management | `zustand`, `jotai` |
|
|
442
|
-
|
|
443
|
-
4. **For database-heavy features**
|
|
444
|
-
- Verify table schemas against TypeScript types
|
|
445
|
-
- Check proposed types match database columns
|
|
446
|
-
|
|
447
|
-
5. **For complex features (>5 AC items)**
|
|
448
|
-
- Use Sequential Thinking to break down systematically
|
|
449
|
-
- Document key decision points and trade-offs
|
|
450
|
-
|
|
451
|
-
## Output Structure
|
|
452
|
-
|
|
453
|
-
### 1. AC Checklist with Verification Criteria (REQUIRED)
|
|
454
|
-
|
|
455
|
-
**Every AC MUST have an explicit Verification Method.** Restate AC as a checklist with verification for each:
|
|
456
|
-
|
|
457
|
-
```markdown
|
|
458
|
-
### AC-1: [Description]
|
|
459
|
-
|
|
460
|
-
**Verification Method:** Unit Test | Integration Test | Manual Test | Browser Test
|
|
461
|
-
|
|
462
|
-
**Test Scenario:**
|
|
463
|
-
- Given: [Initial state]
|
|
464
|
-
- When: [Action taken]
|
|
465
|
-
- Then: [Expected outcome]
|
|
466
|
-
|
|
467
|
-
**Integration Points:**
|
|
468
|
-
- [External system or component]
|
|
469
|
-
|
|
470
|
-
**Assumptions to Validate:**
|
|
471
|
-
- [ ] [Assumption that must be true]
|
|
472
|
-
```
|
|
473
|
-
|
|
474
|
-
#### Verification Method Decision Framework
|
|
475
|
-
|
|
476
|
-
**REQUIRED:** Choose the most appropriate verification method for each AC:
|
|
477
|
-
|
|
478
|
-
| AC Type | Verification Method | When to Use |
|
|
479
|
-
|---------|---------------------|-------------|
|
|
480
|
-
| Pure logic/calculation | **Unit Test** | Functions with clear input/output, no side effects |
|
|
481
|
-
| API endpoint | **Integration Test** | HTTP handlers, database queries, external service calls |
|
|
482
|
-
| User workflow | **Browser Test** | Multi-step UI interactions, form submissions |
|
|
483
|
-
| Visual appearance | **Manual Test** | Styling, layout, animations (hard to automate) |
|
|
484
|
-
| CLI command | **Integration Test** | Script execution, file operations, stdout verification |
|
|
485
|
-
| Error handling | **Unit Test** + **Integration Test** | Both isolated behavior and realistic scenarios |
|
|
486
|
-
| Performance | **Manual Test** + **Integration Test** | Timing thresholds, load testing |
|
|
487
|
-
|
|
488
|
-
#### Verification Method Examples
|
|
489
|
-
|
|
490
|
-
**Good (specific and testable):**
|
|
491
|
-
```markdown
|
|
492
|
-
**AC-1:** User can submit the registration form
|
|
493
|
-
**Verification Method:** Browser Test
|
|
494
|
-
**Test Scenario:**
|
|
495
|
-
- Given: User on /register page
|
|
496
|
-
- When: Fill form fields, click Submit
|
|
497
|
-
- Then: Redirect to /dashboard, success toast appears
|
|
498
|
-
```
|
|
499
|
-
|
|
500
|
-
**Bad (vague, no clear verification):**
|
|
501
|
-
```markdown
|
|
502
|
-
**AC-1:** Registration should work properly
|
|
503
|
-
**Verification Method:** ??? (cannot determine)
|
|
504
|
-
```
|
|
505
|
-
|
|
506
|
-
#### Flags for Missing Verification Methods
|
|
507
|
-
|
|
508
|
-
If you cannot determine a verification method for an AC:
|
|
509
|
-
|
|
510
|
-
1. **Flag the AC as unclear:**
|
|
511
|
-
```markdown
|
|
512
|
-
**AC-3:** System handles errors gracefully
|
|
513
|
-
**Verification Method:** ⚠️ UNCLEAR - needs specific error scenarios
|
|
514
|
-
**Suggested Refinement:** List specific error types and expected responses
|
|
515
|
-
```
|
|
516
|
-
|
|
517
|
-
2. **Include in Open Questions:**
|
|
518
|
-
```markdown
|
|
519
|
-
## Open Questions
|
|
520
|
-
|
|
521
|
-
1. **AC-3 verification method unclear**
|
|
522
|
-
- Question: What specific error scenarios should be tested?
|
|
523
|
-
- Recommendation: Define 3-5 error types with expected behavior
|
|
524
|
-
- Impact: Without this, QA cannot objectively validate
|
|
525
|
-
```
|
|
526
|
-
|
|
527
|
-
**Why this matters:** AC without verification methods:
|
|
528
|
-
- Cannot be objectively validated in `/qa`
|
|
529
|
-
- Lead to subjective "does it work?" assessments
|
|
530
|
-
- Cause rework when expectations don't match implementation
|
|
531
|
-
|
|
532
|
-
See [verification-criteria.md](references/verification-criteria.md) for detailed examples including the #452 hooks failure case.
|
|
533
|
-
|
|
534
|
-
### 2. Implementation Plan
|
|
535
|
-
|
|
536
|
-
Propose a concrete plan in 3–7 steps that:
|
|
537
|
-
- References specific codebase areas
|
|
538
|
-
- Respects existing architecture
|
|
539
|
-
- Groups related work into phases
|
|
540
|
-
- Identifies dependencies between steps
|
|
541
|
-
|
|
542
|
-
For each major decision:
|
|
543
|
-
- Present 2-3 options when relevant
|
|
544
|
-
- Recommend a default with rationale
|
|
545
|
-
- Note if decision should be deferred
|
|
546
|
-
|
|
547
|
-
**Open Questions Format:**
|
|
548
|
-
- Question: [Clear question]
|
|
549
|
-
- Recommendation: [Your suggested default]
|
|
550
|
-
- Impact: [What happens if we get this wrong]
|
|
551
|
-
|
|
552
|
-
See [parallel-groups.md](references/parallel-groups.md) for parallelization format.
|
|
553
|
-
|
|
554
|
-
### 2.5. Design Review (REQUIRED)
|
|
555
|
-
|
|
556
|
-
**Purpose:** Make design decisions explicit before implementation starts. This forces evaluation of *how* to build, not just *what* to build — catching wrong-layer, over-engineered, or pattern-mismatched approaches before code is written.
|
|
557
|
-
|
|
558
|
-
**Why this matters:** Repeated pattern across issues: implementation passes QA functionally but uses the wrong design — wrong layer, hacky shortcut, over-engineered approach. The fix cycle is expensive. Making design explicit here prevents it.
|
|
559
|
-
|
|
560
|
-
**Complexity Scaling:**
|
|
561
|
-
- **Simple issues** (`simple-fix`, `typo`, `docs-only` labels): Abbreviated — answer Q1 and Q3 only
|
|
562
|
-
- **Standard issues**: Answer all 4 questions
|
|
563
|
-
- **Complex issues** (`complex`, `refactor`, `breaking` labels): Answer all 4 questions with detailed rationale
|
|
564
|
-
|
|
565
|
-
**Answer these questions:**
|
|
566
|
-
|
|
567
|
-
1. **Where does this logic belong?** — Which module/layer owns this change? Name the specific directory, file, or abstraction layer. If it spans layers, explain why.
|
|
568
|
-
|
|
569
|
-
2. **What's the simplest correct approach?** — Actively reject over-engineering. What's the minimum implementation that satisfies all AC? What alternatives did you consider and reject?
|
|
570
|
-
|
|
571
|
-
3. **What existing pattern does this follow?** — Name the specific pattern in the codebase. Confirm it fits this use case. If no existing pattern fits, explain why a new approach is needed.
|
|
572
|
-
|
|
573
|
-
4. **What would a senior reviewer challenge?** — Anticipate design pushback. What's the most likely "why didn't you just...?" or "this should be in X instead" feedback?
|
|
574
|
-
|
|
575
|
-
**Example (standard issue):**
|
|
576
|
-
|
|
577
|
-
```markdown
|
|
578
|
-
## Design Review
|
|
579
|
-
|
|
580
|
-
1. **Where does this logic belong?** Spec skill's SKILL.md prompt files — purely prompt engineering, not TypeScript. Same layer as Feature Quality Planning and AC Checklist sections.
|
|
581
|
-
|
|
582
|
-
2. **What's the simplest correct approach?** Add markdown prompt text to SKILL.md. Reuse the existing complexity scaling pattern from Feature Quality Planning. No code, no new files, no abstractions.
|
|
583
|
-
|
|
584
|
-
3. **What existing pattern does this follow?** Mirrors Feature Quality Planning exactly: required section, purpose statement, complexity scaling table, question format.
|
|
585
|
-
|
|
586
|
-
4. **What would a senior reviewer challenge?** (1) "Why after Implementation Plan, not before?" — Design review needs the plan as input to evaluate. (2) "Won't this bloat output?" — Adds ~15 lines for standard, ~5 for simple-fix.
|
|
587
|
-
```
|
|
588
|
-
|
|
589
|
-
**Example (simple-fix issue, abbreviated):**
|
|
590
|
-
|
|
591
|
-
```markdown
|
|
592
|
-
## Design Review
|
|
593
|
-
|
|
594
|
-
1. **Where does this logic belong?** `src/lib/utils.ts` — utility function, same layer as existing helpers.
|
|
595
|
-
|
|
596
|
-
3. **What existing pattern does this follow?** Same pattern as `formatDuration()` in the same file — pure function, no side effects, single responsibility.
|
|
597
|
-
```
|
|
154
|
+
### Rule Touchpoints (Conditional)
|
|
598
155
|
|
|
599
|
-
|
|
156
|
+
**When to apply:** Any AC whose description matches the behavior-rule heuristic — i.e. >= 2 distinct keywords from `default | always | never | rule | behavior | skip` (case-insensitive), OR an explicit pattern like `always X unless Y` / `never X unless Y` / `default X when Y`.
|
|
600
157
|
|
|
601
|
-
**
|
|
158
|
+
**Why:** Behavior-rule ACs are routinely implemented at multiple touchpoints — typically a skill prompt (LLM-interpreted) AND runtime TypeScript that duplicates the same rule. Without this check, edits land at one site and the other goes stale. Motivating miss: issue #533 (default /assess spec phase ON) where the runtime CLI's `BUG_LABELS`/`DOCS_LABELS` short-circuit survived the SKILL.md edit and was caught only by manual user follow-up. See [behavior-rule-detection.md](../_shared/references/behavior-rule-detection.md).
|
|
602
159
|
|
|
603
|
-
**
|
|
604
|
-
|
|
605
|
-
**Complexity Scaling:**
|
|
606
|
-
- **Simple issues** (`simple-fix`, `typo`, `docs-only` labels): Use abbreviated checklist (Completeness + one relevant section)
|
|
607
|
-
- **Standard issues**: Complete all applicable sections
|
|
608
|
-
- **Complex issues** (`complex`, `refactor`, `breaking` labels): Complete all sections with detailed items
|
|
609
|
-
|
|
610
|
-
```markdown
|
|
611
|
-
## Feature Quality Planning
|
|
612
|
-
|
|
613
|
-
### Completeness Check
|
|
614
|
-
- [ ] All AC items have corresponding implementation steps
|
|
615
|
-
- [ ] Integration points with existing features identified
|
|
616
|
-
- [ ] No partial implementations or TODOs planned
|
|
617
|
-
- [ ] State management considered (if applicable)
|
|
618
|
-
- [ ] Data flow is complete end-to-end
|
|
619
|
-
|
|
620
|
-
### Error Handling
|
|
621
|
-
- [ ] Invalid input scenarios identified
|
|
622
|
-
- [ ] API/external service failures handled
|
|
623
|
-
- [ ] Edge cases documented (empty, null, max values)
|
|
624
|
-
- [ ] Error messages are user-friendly
|
|
625
|
-
- [ ] Graceful degradation planned
|
|
626
|
-
|
|
627
|
-
### Code Quality
|
|
628
|
-
- [ ] Types fully defined (no `any` planned)
|
|
629
|
-
- [ ] Follows existing patterns in codebase
|
|
630
|
-
- [ ] Error boundaries where needed
|
|
631
|
-
- [ ] No magic strings/numbers
|
|
632
|
-
- [ ] Consistent naming conventions
|
|
633
|
-
|
|
634
|
-
### Test Coverage Plan
|
|
635
|
-
- [ ] Unit tests for business logic
|
|
636
|
-
- [ ] Integration tests for data flow
|
|
637
|
-
- [ ] Edge case tests identified
|
|
638
|
-
- [ ] Mocking strategy appropriate
|
|
639
|
-
- [ ] Critical paths have test coverage
|
|
640
|
-
|
|
641
|
-
### Best Practices
|
|
642
|
-
- [ ] Logging for debugging/observability
|
|
643
|
-
- [ ] Accessibility considerations (if UI)
|
|
644
|
-
- [ ] Performance implications considered
|
|
645
|
-
- [ ] Security reviewed (auth, validation, sanitization)
|
|
646
|
-
- [ ] Documentation updated (if behavior changes)
|
|
647
|
-
|
|
648
|
-
### Polish (UI features only)
|
|
649
|
-
- [ ] Loading states planned
|
|
650
|
-
- [ ] Error states have UI
|
|
651
|
-
- [ ] Empty states handled
|
|
652
|
-
- [ ] Responsive design considered
|
|
653
|
-
- [ ] Keyboard navigation works
|
|
654
|
-
|
|
655
|
-
### Derived ACs
|
|
656
|
-
|
|
657
|
-
Based on quality planning, identify additional ACs needed:
|
|
658
|
-
|
|
659
|
-
| Source | Derived AC | Priority |
|
|
660
|
-
|--------|-----------|----------|
|
|
661
|
-
| Error Handling | AC-N: Handle [specific error] with [specific response] | High/Medium/Low |
|
|
662
|
-
| Test Coverage | AC-N+1: Add tests for [specific scenario] | High/Medium/Low |
|
|
663
|
-
| Best Practices | AC-N+2: Add logging for [specific operation] | High/Medium/Low |
|
|
664
|
-
|
|
665
|
-
**Note:** Derived ACs are numbered sequentially after original ACs and follow the same format.
|
|
666
|
-
```
|
|
667
|
-
|
|
668
|
-
**Section Applicability:**
|
|
669
|
-
|
|
670
|
-
| Issue Type | Sections Required |
|
|
671
|
-
|------------|-------------------|
|
|
672
|
-
| Bug fix | Completeness, Error Handling, Test Coverage |
|
|
673
|
-
| New feature | All sections |
|
|
674
|
-
| Refactor | Completeness, Code Quality, Test Coverage |
|
|
675
|
-
| UI change | All sections including Polish |
|
|
676
|
-
| Backend/API | Completeness, Error Handling, Code Quality, Test Coverage, Best Practices |
|
|
677
|
-
| CLI/Script | Completeness, Error Handling, Test Coverage, Best Practices |
|
|
678
|
-
| Docs only | Completeness only |
|
|
679
|
-
|
|
680
|
-
**Example (API endpoint feature):**
|
|
681
|
-
|
|
682
|
-
```markdown
|
|
683
|
-
## Feature Quality Planning
|
|
684
|
-
|
|
685
|
-
### Completeness Check
|
|
686
|
-
- [x] All AC items have corresponding implementation steps
|
|
687
|
-
- [x] Integration points: Auth middleware, database queries, response serializer
|
|
688
|
-
- [x] No partial implementations planned
|
|
689
|
-
- [ ] State management: N/A (stateless API)
|
|
690
|
-
- [x] Data flow: Request → Validate → Query → Transform → Response
|
|
691
|
-
|
|
692
|
-
### Error Handling
|
|
693
|
-
- [x] Invalid input: Return 400 with validation errors
|
|
694
|
-
- [x] Auth failure: Return 401 with "Unauthorized" message
|
|
695
|
-
- [x] Not found: Return 404 with resource ID
|
|
696
|
-
- [x] Server error: Return 500, log full error, return generic message
|
|
697
|
-
- [x] Rate limit: Return 429 with retry-after header
|
|
698
|
-
|
|
699
|
-
### Code Quality
|
|
700
|
-
- [x] Types: Define RequestDTO, ResponseDTO, ErrorResponse
|
|
701
|
-
- [x] Patterns: Follow existing controller pattern in `src/api/`
|
|
702
|
-
- [ ] Error boundaries: N/A (API, not UI)
|
|
703
|
-
- [x] No magic strings: Use constants for error messages
|
|
704
|
-
|
|
705
|
-
### Test Coverage Plan
|
|
706
|
-
- [x] Unit: Validation logic, data transformation
|
|
707
|
-
- [x] Integration: Full request/response cycle
|
|
708
|
-
- [x] Edge cases: Empty results, max pagination, invalid IDs
|
|
709
|
-
- [x] Mocking: Mock database, not HTTP layer
|
|
710
|
-
|
|
711
|
-
### Best Practices
|
|
712
|
-
- [x] Logging: Log request ID, duration, status code
|
|
713
|
-
- [ ] Accessibility: N/A (API)
|
|
714
|
-
- [x] Performance: Add database index for query field
|
|
715
|
-
- [x] Security: Validate input, sanitize output, check auth
|
|
716
|
-
|
|
717
|
-
### Derived ACs
|
|
718
|
-
|
|
719
|
-
| Source | Derived AC | Priority |
|
|
720
|
-
|--------|-----------|----------|
|
|
721
|
-
| Error Handling | AC-6: Return 429 with retry-after header on rate limit | Medium |
|
|
722
|
-
| Best Practices | AC-7: Log request ID and duration for observability | High |
|
|
723
|
-
| Test Coverage | AC-8: Add integration test for auth failure path | High |
|
|
724
|
-
```
|
|
725
|
-
|
|
726
|
-
### 4. Plan Review
|
|
727
|
-
|
|
728
|
-
Ask the user to confirm or adjust:
|
|
729
|
-
- The AC checklist (with verification criteria)
|
|
730
|
-
- The implementation plan
|
|
731
|
-
- The assumptions to validate
|
|
732
|
-
|
|
733
|
-
**Do NOT start implementation** - this is planning-only.
|
|
734
|
-
|
|
735
|
-
### 4.5. Assess Comment Detection (AC-4, AC-5)
|
|
736
|
-
|
|
737
|
-
**Before making your own phase recommendation**, check if `/assess` has already posted an analysis comment to this issue:
|
|
160
|
+
**During context gathering**, run the detector on every AC. For each AC that triggers, list its touchpoints under a new `## Rule Touchpoints` section in the plan output.
|
|
738
161
|
|
|
739
162
|
```bash
|
|
740
|
-
#
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
**Phases:** spec → exec → test → qa
|
|
761
|
-
**Quality Loop:** enabled
|
|
762
|
-
**Reasoning:** Assess recommended `exec → qa`, but codebase analysis reveals UI components
|
|
763
|
-
are affected (found `.tsx` files in change scope), so browser testing is needed.
|
|
764
|
-
Overriding assess recommendation with explanation.
|
|
765
|
-
```
|
|
766
|
-
|
|
767
|
-
4. If the assess comment recommends phases that don't include `spec` (e.g., `phases=exec,qa`), acknowledge this in your output but proceed with spec since `/spec` was explicitly invoked.
|
|
768
|
-
|
|
769
|
-
**If no assess analysis comment exists:** Proceed with your own analysis as normal (step 5).
|
|
770
|
-
|
|
771
|
-
### 5. Recommended Workflow
|
|
772
|
-
|
|
773
|
-
Analyze the issue and recommend the optimal workflow phases:
|
|
774
|
-
|
|
775
|
-
```markdown
|
|
776
|
-
## Recommended Workflow
|
|
777
|
-
|
|
778
|
-
**Phases:** spec → exec → qa
|
|
779
|
-
**Quality Loop:** disabled
|
|
780
|
-
**Reasoning:** [Brief explanation of why these phases were chosen]
|
|
781
|
-
```
|
|
782
|
-
|
|
783
|
-
**Phase Selection Logic:**
|
|
784
|
-
- **UI/Frontend changes** → Add `test` phase (browser testing)
|
|
785
|
-
- **`no-browser-test` label** → Skip `test` phase (explicit opt-out, overrides UI labels)
|
|
786
|
-
- **Bug fixes** → Skip `spec` if already well-defined
|
|
787
|
-
- **Complex refactors** → Enable quality loop
|
|
788
|
-
- **Security-sensitive** → Add `security-review` phase
|
|
789
|
-
- **Documentation only** → Skip `spec`, just `exec → qa`
|
|
790
|
-
- **New features with testable ACs** → Add `testgen` phase after spec
|
|
791
|
-
- **Refactors needing regression tests** → Add `testgen` phase
|
|
792
|
-
|
|
793
|
-
#### Browser Testing Label Suggestion
|
|
794
|
-
|
|
795
|
-
**When `.tsx` or `.jsx` file references are detected** in the issue body AND the issue does NOT have `ui`, `frontend`, or `admin` labels, include this warning in the spec output:
|
|
796
|
-
|
|
797
|
-
```markdown
|
|
798
|
-
> **Component files detected** — Issue body references `.tsx`/`.jsx` files or `components/` directory, but no `ui`/`frontend`/`admin` label is present.
|
|
799
|
-
> - To enable browser testing: add the `ui` label → `gh issue edit <N> --add-label ui`
|
|
800
|
-
> - To explicitly skip browser testing: add `no-browser-test` label → `gh issue edit <N> --add-label no-browser-test`
|
|
801
|
-
> - Without either label, QA will note the missing browser test coverage.
|
|
802
|
-
```
|
|
803
|
-
|
|
804
|
-
**When NOT to show this warning:**
|
|
805
|
-
- Issue already has `ui`, `frontend`, or `admin` label (browser testing already enabled)
|
|
806
|
-
- Issue has `no-browser-test` label (explicit opt-out)
|
|
807
|
-
- No `.tsx`/`.jsx`/`components/` references detected
|
|
808
|
-
|
|
809
|
-
#### Testgen Phase Auto-Detection
|
|
810
|
-
|
|
811
|
-
**When to recommend `testgen` phase:**
|
|
812
|
-
|
|
813
|
-
| Condition | Recommend testgen? | Reasoning |
|
|
814
|
-
|-----------|-------------------|-----------|
|
|
815
|
-
| ACs have "Unit Test" verification method | ✅ Yes | Tests should be stubbed before implementation |
|
|
816
|
-
| ACs have "Integration Test" verification method | ✅ Yes | Complex integration tests benefit from early structure |
|
|
817
|
-
| Issue is a new feature (not bug fix) with >2 AC items | ✅ Yes | Features need test coverage |
|
|
818
|
-
| Issue has `enhancement` or `feature` label | ✅ Yes | New functionality needs tests |
|
|
819
|
-
| Project has test framework (Jest, Vitest, etc.) | ✅ Yes | Infrastructure exists to run tests |
|
|
820
|
-
| Issue is a simple bug fix (`bug` label only) | ❌ No | Bug fixes typically have targeted tests |
|
|
821
|
-
| Issue is docs-only (`docs` label) | ❌ No | Documentation doesn't need unit tests |
|
|
822
|
-
| All ACs have "Manual Test" or "Browser Test" verification | ❌ No | These don't generate code stubs |
|
|
823
|
-
|
|
824
|
-
**Detection Logic:**
|
|
825
|
-
|
|
826
|
-
1. **Check verification methods in AC items:**
|
|
827
|
-
- Count ACs with "Unit Test" → If >0, recommend testgen
|
|
828
|
-
- Count ACs with "Integration Test" → If >0, recommend testgen
|
|
829
|
-
|
|
830
|
-
2. **Check issue labels:**
|
|
831
|
-
```bash
|
|
832
|
-
gh issue view <issue> --json labels --jq '.labels[].name'
|
|
833
|
-
```
|
|
834
|
-
- If `bug` or `fix` is the ONLY label → Skip testgen
|
|
835
|
-
- If `docs` is present → Skip testgen
|
|
836
|
-
- If `enhancement`, `feature`, `refactor` → Consider testgen
|
|
837
|
-
|
|
838
|
-
3. **Check project test infrastructure:**
|
|
839
|
-
```bash
|
|
840
|
-
# Check for test framework in package.json
|
|
841
|
-
grep -E "jest|vitest|mocha" package.json || true
|
|
842
|
-
```
|
|
843
|
-
- If no test framework detected → Skip testgen (no infrastructure)
|
|
844
|
-
|
|
845
|
-
**Example output when testgen is recommended:**
|
|
846
|
-
|
|
847
|
-
```markdown
|
|
848
|
-
## Recommended Workflow
|
|
849
|
-
|
|
850
|
-
**Phases:** spec → testgen → exec → qa
|
|
851
|
-
**Quality Loop:** disabled
|
|
852
|
-
**Reasoning:** ACs include Unit Test verification methods; testgen will create stubs before implementation
|
|
853
|
-
```
|
|
854
|
-
|
|
855
|
-
**Example output when testgen is NOT recommended:**
|
|
856
|
-
|
|
857
|
-
```markdown
|
|
858
|
-
## Recommended Workflow
|
|
859
|
-
|
|
860
|
-
**Phases:** spec → exec → qa
|
|
861
|
-
**Quality Loop:** disabled
|
|
862
|
-
**Reasoning:** Bug fix with targeted scope; existing tests sufficient
|
|
163
|
+
# Per-AC touchpoint enumeration. Run once per AC in the issue body.
|
|
164
|
+
# Skip entirely when no AC triggers (cheap short-circuit).
|
|
165
|
+
SPEC_AC_ID="AC-1" \
|
|
166
|
+
SPEC_AC_TEXT="<verbatim AC description from the issue body>" \
|
|
167
|
+
npx tsx -e '
|
|
168
|
+
(async () => {
|
|
169
|
+
const m = await import("./src/lib/heuristics/behavior-rule-detector.ts");
|
|
170
|
+
const ac = {
|
|
171
|
+
id: process.env.SPEC_AC_ID,
|
|
172
|
+
description: process.env.SPEC_AC_TEXT,
|
|
173
|
+
verificationMethod: "manual",
|
|
174
|
+
status: "pending",
|
|
175
|
+
};
|
|
176
|
+
const detection = m.detectBehaviorRule(ac);
|
|
177
|
+
if (!detection.triggered) { console.log(JSON.stringify({ triggered: false })); return; }
|
|
178
|
+
const touchpoints = m.findTouchpoints(ac, process.cwd());
|
|
179
|
+
console.log(JSON.stringify({ triggered: true, keywords: detection.keywords, touchpoints }));
|
|
180
|
+
})();
|
|
181
|
+
'
|
|
863
182
|
```
|
|
864
183
|
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
Analyze current labels vs implementation plan and suggest updates:
|
|
184
|
+
**If any AC triggers and `touchpoints` is non-empty**, add this section to the plan output (between **Implementation Plan** and **Design Review**):
|
|
868
185
|
|
|
869
186
|
```markdown
|
|
870
|
-
##
|
|
871
|
-
|
|
872
|
-
**Current:** enhancement
|
|
873
|
-
**Recommended:** enhancement, refactor
|
|
874
|
-
**Reason:** Implementation plan involves structural changes to 5+ files
|
|
875
|
-
**Quality Loop:** Will auto-enable due to `refactor` label
|
|
876
|
-
|
|
877
|
-
→ `gh issue edit <N> --add-label refactor`
|
|
878
|
-
```
|
|
879
|
-
|
|
880
|
-
**Plan-Based Detection Logic:**
|
|
881
|
-
- If plan has 5+ file changes → suggest `refactor`
|
|
882
|
-
- If plan touches UI components → suggest `ui` or `frontend`
|
|
883
|
-
- If plan has breaking API changes → suggest `breaking`
|
|
884
|
-
- If plan involves database migrations → suggest `backend`, `complex`
|
|
885
|
-
- If plan involves CLI/scripts → suggest `cli`
|
|
886
|
-
- If plan is documentation-only → suggest `docs`
|
|
887
|
-
- If recommended workflow includes quality loop → ensure matching label exists (`complex`, `refactor`, or `breaking`)
|
|
888
|
-
|
|
889
|
-
**Label Inference from Plan Analysis:**
|
|
890
|
-
- Count files in implementation plan steps
|
|
891
|
-
- Identify component types being modified
|
|
892
|
-
- Check if API contracts are changing
|
|
893
|
-
- Match against quality loop trigger labels
|
|
894
|
-
|
|
895
|
-
### 7. Issue Comment Draft
|
|
896
|
-
|
|
897
|
-
Generate a Markdown snippet with:
|
|
898
|
-
- AC checklist with verification criteria
|
|
899
|
-
- Verification methods summary
|
|
900
|
-
- Consolidated assumptions checklist
|
|
901
|
-
- Implementation plan with phases
|
|
902
|
-
- Key decisions and rationale
|
|
903
|
-
- Open questions with recommendations
|
|
904
|
-
- Effort breakdown
|
|
905
|
-
|
|
906
|
-
Label clearly as:
|
|
907
|
-
```md
|
|
908
|
-
--- DRAFT GITHUB ISSUE COMMENT (PLAN) ---
|
|
909
|
-
```
|
|
910
|
-
|
|
911
|
-
### 8. Update GitHub Issue
|
|
912
|
-
|
|
913
|
-
Post the draft comment to GitHub:
|
|
914
|
-
```bash
|
|
915
|
-
gh issue comment <issue-number> --body "..."
|
|
916
|
-
gh issue edit <issue-number> --add-label "planned"
|
|
917
|
-
```
|
|
918
|
-
|
|
919
|
-
---
|
|
920
|
-
|
|
921
|
-
## State Tracking
|
|
922
|
-
|
|
923
|
-
**IMPORTANT:** Update workflow state when running standalone (not orchestrated).
|
|
187
|
+
## Rule Touchpoints
|
|
924
188
|
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
```bash
|
|
929
|
-
# Check if orchestrated - if so, skip state updates
|
|
930
|
-
if [[ -n "$SEQUANT_ORCHESTRATOR" ]]; then
|
|
931
|
-
echo "Running orchestrated - state managed by orchestrator"
|
|
932
|
-
fi
|
|
189
|
+
| AC | Touchpoint | Snippet |
|
|
190
|
+
|----|------------|---------|
|
|
191
|
+
| AC-N | path/to/file.ts:LINE | `<one-line snippet>` |
|
|
933
192
|
```
|
|
934
193
|
|
|
935
|
-
|
|
194
|
+
**If every AC short-circuits** (`triggered: false`) **or `touchpoints` is empty**, omit the section entirely — keeps cost cheap per the Performance budget in the reference doc.
|
|
936
195
|
|
|
937
|
-
When NOT orchestrated (`SEQUANT_ORCHESTRATOR` is not set):
|
|
938
196
|
|
|
939
|
-
|
|
940
|
-
```bash
|
|
941
|
-
npx tsx scripts/state/update.ts start <issue-number> spec
|
|
942
|
-
```
|
|
197
|
+
## Verification Method Decision Framework
|
|
943
198
|
|
|
944
|
-
|
|
945
|
-
```bash
|
|
946
|
-
npx tsx scripts/state/update.ts complete <issue-number> spec
|
|
947
|
-
```
|
|
199
|
+
Use this table when assigning verification methods to each AC:
|
|
948
200
|
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
201
|
+
| AC Type | Method | When to Use |
|
|
202
|
+
|---------|--------|-------------|
|
|
203
|
+
| Pure logic/calculation | Unit Test | Clear input/output, no side effects |
|
|
204
|
+
| API endpoint | Integration Test | HTTP handlers, DB queries, external calls |
|
|
205
|
+
| User workflow | Browser Test | Multi-step UI interactions, forms |
|
|
206
|
+
| Visual appearance | Manual Test | Styling, layout, animations |
|
|
207
|
+
| CLI command | Integration Test | Script execution, stdout verification |
|
|
208
|
+
| Error handling | Unit + Integration | Both isolated and realistic scenarios |
|
|
953
209
|
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
---
|
|
957
|
-
|
|
958
|
-
## Output Verification
|
|
959
|
-
|
|
960
|
-
**Before responding, verify your output includes ALL of these:**
|
|
961
|
-
|
|
962
|
-
- [ ] **AC Quality Check** - Lint results (or "Skipped" if --skip-ac-lint)
|
|
963
|
-
- [ ] **Scope Assessment** - Verdict and metrics (or "Skipped" if --skip-scope-check)
|
|
964
|
-
- [ ] **Non-Goals Section** - Listed or warning if missing
|
|
965
|
-
- [ ] **AC Checklist** - Numbered AC items (AC-1, AC-2, etc.) with descriptions
|
|
966
|
-
- [ ] **Verification Criteria (REQUIRED)** - Each AC MUST have:
|
|
967
|
-
- Explicit Verification Method (Unit Test, Integration Test, Browser Test, or Manual Test)
|
|
968
|
-
- Test Scenario with Given/When/Then format
|
|
969
|
-
- If unclear, flag as "⚠️ UNCLEAR" and add to Open Questions
|
|
970
|
-
- [ ] **Conflict Risk Analysis** - Check for in-flight work, include if conflicts found
|
|
971
|
-
- [ ] **Implementation Plan** - 3-7 concrete steps with codebase references
|
|
972
|
-
- [ ] **Design Review** - All 4 questions answered (abbreviated to Q1+Q3 for simple-fix/typo/docs-only labels)
|
|
973
|
-
- [ ] **Feature Quality Planning** - Quality dimensions checklist completed (abbreviated for simple-fix/typo/docs-only labels)
|
|
974
|
-
- [ ] **Recommended Workflow** - Phases, Quality Loop setting, and Reasoning (auto-enable quality loop if scope is yellow/red)
|
|
975
|
-
- [ ] **Label Review** - Current vs recommended labels based on plan analysis
|
|
976
|
-
- [ ] **Open Questions** - Any ambiguities with recommended defaults (including unclear verification methods)
|
|
977
|
-
- [ ] **Issue Comment Draft** - Formatted for GitHub posting
|
|
978
|
-
|
|
979
|
-
**CRITICAL:** Do NOT output AC items without verification methods. Either:
|
|
980
|
-
1. Assign a verification method from the decision framework, or
|
|
981
|
-
2. Flag as "⚠️ UNCLEAR" and include in Open Questions
|
|
982
|
-
|
|
983
|
-
**DO NOT respond until all items are verified.**
|
|
210
|
+
See [verification-criteria.md](references/verification-criteria.md) for detailed examples.
|
|
984
211
|
|
|
985
212
|
## Output Template
|
|
986
213
|
|
|
987
|
-
|
|
214
|
+
**Single authoritative template.** Include ALL sections in this order. Scale detail by complexity tier.
|
|
988
215
|
|
|
989
216
|
```markdown
|
|
217
|
+
**Complexity: [Simple|Standard|Complex]** ([N] ACs, [N] directories)
|
|
218
|
+
|
|
990
219
|
## AC Quality Check
|
|
991
220
|
|
|
992
|
-
[
|
|
221
|
+
[Inline analysis results, or "Skipped (--skip-ac-lint)"]
|
|
993
222
|
|
|
994
223
|
---
|
|
995
224
|
|
|
996
225
|
## Scope Assessment
|
|
997
226
|
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
[List non-goals from issue, or warning if missing]
|
|
1001
|
-
|
|
1002
|
-
### Scope Metrics
|
|
227
|
+
**Non-Goals:** [From issue body. If missing: "⚠️ Non-Goals section not found. Consider adding scope boundaries."]
|
|
1003
228
|
|
|
1004
229
|
| Metric | Value | Status |
|
|
1005
230
|
|--------|-------|--------|
|
|
@@ -1007,9 +232,9 @@ You MUST include these sections in order:
|
|
|
1007
232
|
| AC items | [N] | [✅/⚠️/❌] |
|
|
1008
233
|
| Directory spread | [N] | [✅/⚠️/❌] |
|
|
1009
234
|
|
|
1010
|
-
|
|
235
|
+
**Verdict:** [✅ SCOPE_OK | ⚠️ SCOPE_WARNING | ❌ SCOPE_SPLIT_RECOMMENDED]
|
|
1011
236
|
|
|
1012
|
-
[
|
|
237
|
+
[Or "Skipped (--skip-scope-check)"]
|
|
1013
238
|
|
|
1014
239
|
---
|
|
1015
240
|
|
|
@@ -1017,116 +242,93 @@ You MUST include these sections in order:
|
|
|
1017
242
|
|
|
1018
243
|
### AC-1: [Description]
|
|
1019
244
|
|
|
1020
|
-
**Verification
|
|
1021
|
-
|
|
1022
|
-
**
|
|
1023
|
-
- Given: [Initial state]
|
|
1024
|
-
- When: [Action]
|
|
1025
|
-
- Then: [Expected outcome]
|
|
1026
|
-
|
|
1027
|
-
### AC-2: [Description]
|
|
1028
|
-
|
|
1029
|
-
**Verification Method:** [Choose from decision framework]
|
|
245
|
+
**Verification:** [Unit Test | Integration Test | Browser Test | Manual Test]
|
|
246
|
+
**Scenario:** Given [state] → When [action] → Then [outcome]
|
|
247
|
+
**Assumptions:** [List any that need pre-coding validation]
|
|
1030
248
|
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
- When: [Action]
|
|
1034
|
-
- Then: [Expected outcome]
|
|
249
|
+
<!-- Repeat for all ACs. EVERY AC must have a Verification Method from the decision framework.
|
|
250
|
+
If unclear, flag as "⚠️ UNCLEAR" with suggested refinement. -->
|
|
1035
251
|
|
|
1036
|
-
|
|
252
|
+
<!-- Example of a completed AC entry:
|
|
1037
253
|
|
|
1038
|
-
|
|
254
|
+
### AC-3: User can submit the registration form
|
|
1039
255
|
|
|
1040
|
-
**
|
|
1041
|
-
|
|
1042
|
-
|
|
256
|
+
**Verification:** Browser Test
|
|
257
|
+
**Scenario:** Given user on /register → When fill fields and click Submit → Then redirect to /dashboard with success toast
|
|
258
|
+
**Assumptions:** Auth API returns 201 on valid input; email uniqueness enforced by DB constraint
|
|
259
|
+
-->
|
|
1043
260
|
|
|
1044
261
|
---
|
|
1045
262
|
|
|
1046
263
|
## Implementation Plan
|
|
1047
264
|
|
|
1048
|
-
### Phase 1: [
|
|
1049
|
-
1. [Step
|
|
265
|
+
### Phase 1: [Name]
|
|
266
|
+
1. [Step referencing specific files/components from context gathering]
|
|
1050
267
|
2. [Step]
|
|
1051
268
|
|
|
1052
|
-
### Phase 2: [
|
|
1053
|
-
<!--
|
|
269
|
+
### Phase 2: [Name]
|
|
270
|
+
<!-- 3-7 total steps. Group into phases. Note dependencies between steps.
|
|
271
|
+
For major decisions: present 2-3 options, recommend default with rationale.
|
|
272
|
+
See references/parallel-groups.md for parallel execution format (3+ independent tasks). -->
|
|
1054
273
|
|
|
1055
274
|
---
|
|
1056
275
|
|
|
1057
276
|
## Design Review
|
|
1058
277
|
|
|
1059
278
|
1. **Where does this logic belong?** [Module/layer that owns this change]
|
|
1060
|
-
|
|
1061
279
|
2. **What's the simplest correct approach?** [Minimum implementation, rejected alternatives]
|
|
280
|
+
3. **What existing pattern does this follow?** [Named pattern, confirm it fits]
|
|
281
|
+
4. **What would a senior reviewer challenge?** [Anticipated "why didn't you just...?" pushback]
|
|
1062
282
|
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
4. **What would a senior reviewer challenge?** [Anticipated pushback]
|
|
1066
|
-
|
|
1067
|
-
<!-- For simple-fix/typo/docs-only: only Q1 and Q3 required -->
|
|
283
|
+
<!-- Simple tier: Q1 and Q3 only. Standard/Complex: all four. -->
|
|
1068
284
|
|
|
1069
285
|
---
|
|
1070
286
|
|
|
1071
287
|
## Feature Quality Planning
|
|
1072
288
|
|
|
1073
|
-
|
|
1074
|
-
- [ ] All AC items have corresponding implementation steps
|
|
1075
|
-
- [ ] Integration points identified
|
|
1076
|
-
- [ ] No partial implementations planned
|
|
1077
|
-
|
|
1078
|
-
### Error Handling
|
|
1079
|
-
- [ ] Invalid input scenarios identified
|
|
1080
|
-
- [ ] External service failures handled
|
|
1081
|
-
- [ ] Edge cases documented
|
|
289
|
+
<!-- Exception-based: report only gaps and concerns. Full checklist in references/quality-checklist.md -->
|
|
1082
290
|
|
|
1083
|
-
|
|
1084
|
-
- [
|
|
1085
|
-
- [
|
|
1086
|
-
- [ ] No magic strings/numbers
|
|
291
|
+
**All standard checks pass.** Notable items:
|
|
292
|
+
- [Gap or concern requiring attention]
|
|
293
|
+
- [Another gap if applicable]
|
|
1087
294
|
|
|
1088
|
-
###
|
|
1089
|
-
- [ ] Unit tests for business logic
|
|
1090
|
-
- [ ] Edge case tests identified
|
|
1091
|
-
- [ ] Critical paths covered
|
|
295
|
+
### Derived ACs (if any)
|
|
1092
296
|
|
|
1093
|
-
### Best Practices
|
|
1094
|
-
- [ ] Logging for observability
|
|
1095
|
-
- [ ] Security reviewed
|
|
1096
|
-
- [ ] Documentation updated
|
|
1097
|
-
|
|
1098
|
-
### Polish (UI only)
|
|
1099
|
-
- [ ] Loading/error/empty states
|
|
1100
|
-
- [ ] Responsive design
|
|
1101
|
-
|
|
1102
|
-
### Derived ACs
|
|
1103
297
|
| Source | Derived AC | Priority |
|
|
1104
298
|
|--------|-----------|----------|
|
|
1105
|
-
| [
|
|
299
|
+
| [Quality dimension] | AC-N: [Description] | High/Medium/Low |
|
|
300
|
+
|
|
301
|
+
<!-- Complex tier: walk through full checklist from references/quality-checklist.md -->
|
|
1106
302
|
|
|
1107
303
|
---
|
|
1108
304
|
|
|
1109
305
|
## Open Questions
|
|
1110
306
|
|
|
1111
|
-
1. **[Question]**
|
|
1112
|
-
- Recommendation: [Default choice]
|
|
1113
|
-
- Impact: [What happens if wrong]
|
|
307
|
+
1. **[Question]** — Recommendation: [default]. Impact: [if wrong].
|
|
1114
308
|
|
|
1115
309
|
---
|
|
1116
310
|
|
|
1117
311
|
## Recommended Workflow
|
|
1118
312
|
|
|
1119
|
-
**Phases:** exec → qa
|
|
1120
|
-
**Quality Loop:** disabled
|
|
1121
|
-
**Reasoning:** [
|
|
313
|
+
**Phases:** [spec →] exec → qa
|
|
314
|
+
**Quality Loop:** [enabled/disabled]
|
|
315
|
+
**Reasoning:** [Brief explanation]
|
|
316
|
+
|
|
317
|
+
<!-- Decision logic:
|
|
318
|
+
- UI/frontend → add `test` phase
|
|
319
|
+
- `no-browser-test` label → skip `test` (overrides UI labels)
|
|
320
|
+
- Complex refactor → enable quality loop
|
|
321
|
+
- Security-sensitive → add `security-review` phase
|
|
322
|
+
- New features with Unit/Integration Test verification ACs → add `testgen` phase
|
|
323
|
+
- Docs-only → skip spec, just exec → qa -->
|
|
1122
324
|
|
|
1123
325
|
---
|
|
1124
326
|
|
|
1125
327
|
## Label Review
|
|
1126
328
|
|
|
1127
|
-
**Current:** [
|
|
1128
|
-
**Recommended:** [
|
|
1129
|
-
**Reason:** [Why
|
|
329
|
+
**Current:** [labels]
|
|
330
|
+
**Recommended:** [labels]
|
|
331
|
+
**Reason:** [Why, based on plan analysis]
|
|
1130
332
|
**Quality Loop:** [Will/Won't auto-enable and why]
|
|
1131
333
|
|
|
1132
334
|
→ `gh issue edit <N> --add-label [label]`
|
|
@@ -1135,5 +337,56 @@ You MUST include these sections in order:
|
|
|
1135
337
|
|
|
1136
338
|
--- DRAFT GITHUB ISSUE COMMENT (PLAN) ---
|
|
1137
339
|
|
|
1138
|
-
[
|
|
340
|
+
[AC checklist with verification + implementation plan + key decisions + open questions]
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
### Testgen Phase Auto-Detection
|
|
344
|
+
|
|
345
|
+
#### When to recommend `testgen` phase:
|
|
346
|
+
|
|
347
|
+
| Condition | Recommend testgen? | Reasoning |
|
|
348
|
+
|-----------|-------------------|-----------|
|
|
349
|
+
| ACs have "Unit Test" verification method | Yes | Tests should be stubbed before implementation |
|
|
350
|
+
| ACs have "Integration Test" verification method | Yes | Complex integration tests benefit from early structure |
|
|
351
|
+
| New feature (`enhancement`/`feature` label) with >2 ACs | Yes | Features need test coverage |
|
|
352
|
+
| Simple bug fix (`bug` label only) | No | Skip testgen — targeted tests sufficient |
|
|
353
|
+
| Docs-only (`docs` label) | No | Skip testgen — no unit tests needed |
|
|
354
|
+
| All ACs have "Manual Test" or "Browser Test" | No | Skip testgen — no code stubs to generate |
|
|
355
|
+
|
|
356
|
+
**Detection logic:**
|
|
357
|
+
1. Count ACs with "Unit Test" → If >0, recommend testgen
|
|
358
|
+
2. Count ACs with "Integration Test" → If >0, recommend testgen
|
|
359
|
+
3. Check labels: `bug`/`fix` only → Skip testgen. `docs` → Skip testgen.
|
|
360
|
+
|
|
361
|
+
**Example when testgen recommended:**
|
|
362
|
+
```markdown
|
|
363
|
+
**Phases:** spec → testgen → exec → qa
|
|
364
|
+
**Reasoning:** ACs include Unit Test verification methods; testgen will create stubs before implementation
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### Browser Testing Label Suggestion
|
|
368
|
+
|
|
369
|
+
When `.tsx`/`.jsx` references detected in issue body AND no `ui`/`frontend`/`admin` label present:
|
|
370
|
+
> **Component files detected** — add `ui` label for browser testing, or `no-browser-test` to explicitly skip.
|
|
371
|
+
|
|
372
|
+
### Assess Comment Integration
|
|
373
|
+
|
|
374
|
+
Before making phase recommendations, check for prior `/assess` analysis:
|
|
375
|
+
|
|
376
|
+
```bash
|
|
377
|
+
assess_comment=$(gh issue view <N> --json comments \
|
|
378
|
+
--jq '[.comments[].body | select(test("## Assess Analysis|<!-- assess:phases="))] | last // empty')
|
|
1139
379
|
```
|
|
380
|
+
|
|
381
|
+
If found, use assess recommendation as starting point. You may override, but MUST document why.
|
|
382
|
+
|
|
383
|
+
## Update GitHub Issue
|
|
384
|
+
|
|
385
|
+
Post the draft comment and add label:
|
|
386
|
+
|
|
387
|
+
```bash
|
|
388
|
+
gh issue comment <issue-number> --body "..."
|
|
389
|
+
gh issue edit <issue-number> --add-label "planned"
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
**Do NOT start implementation** — this is planning-only.
|