sequant 1.16.1 → 1.18.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 +14 -2
- package/README.md +2 -0
- package/dist/bin/cli.js +2 -1
- package/dist/marketplace/external_plugins/sequant/.claude-plugin/plugin.json +21 -0
- package/dist/marketplace/external_plugins/sequant/README.md +38 -0
- package/dist/marketplace/external_plugins/sequant/hooks/post-tool.sh +292 -0
- package/dist/marketplace/external_plugins/sequant/hooks/pre-tool.sh +463 -0
- package/dist/marketplace/external_plugins/sequant/skills/_shared/references/prompt-templates.md +350 -0
- package/dist/marketplace/external_plugins/sequant/skills/_shared/references/subagent-types.md +131 -0
- package/dist/marketplace/external_plugins/sequant/skills/assess/SKILL.md +474 -0
- package/dist/marketplace/external_plugins/sequant/skills/clean/SKILL.md +211 -0
- package/dist/marketplace/external_plugins/sequant/skills/docs/SKILL.md +337 -0
- package/dist/marketplace/external_plugins/sequant/skills/exec/SKILL.md +807 -0
- package/dist/marketplace/external_plugins/sequant/skills/fullsolve/SKILL.md +678 -0
- package/dist/marketplace/external_plugins/sequant/skills/improve/SKILL.md +668 -0
- package/dist/marketplace/external_plugins/sequant/skills/loop/SKILL.md +374 -0
- package/dist/marketplace/external_plugins/sequant/skills/qa/SKILL.md +570 -0
- package/dist/marketplace/external_plugins/sequant/skills/qa/references/code-quality-exemplars.md +107 -0
- package/dist/marketplace/external_plugins/sequant/skills/qa/references/code-review-checklist.md +65 -0
- package/dist/marketplace/external_plugins/sequant/skills/qa/references/quality-gates.md +179 -0
- package/dist/marketplace/external_plugins/sequant/skills/qa/references/semgrep-rules.md +207 -0
- package/dist/marketplace/external_plugins/sequant/skills/qa/references/testing-requirements.md +109 -0
- package/dist/marketplace/external_plugins/sequant/skills/qa/scripts/quality-checks.sh +622 -0
- package/dist/marketplace/external_plugins/sequant/skills/reflect/SKILL.md +175 -0
- package/dist/marketplace/external_plugins/sequant/skills/reflect/references/documentation-tiers.md +70 -0
- package/dist/marketplace/external_plugins/sequant/skills/reflect/references/phase-reflection.md +95 -0
- package/dist/marketplace/external_plugins/sequant/skills/security-review/SKILL.md +358 -0
- package/dist/marketplace/external_plugins/sequant/skills/security-review/references/security-checklists.md +432 -0
- package/dist/marketplace/external_plugins/sequant/skills/solve/SKILL.md +697 -0
- package/dist/marketplace/external_plugins/sequant/skills/spec/SKILL.md +754 -0
- package/dist/marketplace/external_plugins/sequant/skills/spec/references/parallel-groups.md +72 -0
- package/dist/marketplace/external_plugins/sequant/skills/spec/references/recommended-workflow.md +92 -0
- package/dist/marketplace/external_plugins/sequant/skills/spec/references/verification-criteria.md +104 -0
- package/dist/marketplace/external_plugins/sequant/skills/test/SKILL.md +600 -0
- package/dist/marketplace/external_plugins/sequant/skills/testgen/SKILL.md +576 -0
- package/dist/marketplace/external_plugins/sequant/skills/verify/SKILL.md +281 -0
- package/dist/src/commands/run.d.ts +13 -274
- package/dist/src/commands/run.js +43 -1958
- package/dist/src/commands/sync.js +3 -0
- package/dist/src/commands/update.js +3 -0
- package/dist/src/lib/plugin-version-sync.d.ts +2 -1
- package/dist/src/lib/plugin-version-sync.js +28 -7
- package/dist/src/lib/solve-comment-parser.d.ts +26 -0
- package/dist/src/lib/solve-comment-parser.js +63 -7
- package/dist/src/lib/upstream/assessment.js +6 -3
- package/dist/src/lib/upstream/relevance.d.ts +5 -0
- package/dist/src/lib/upstream/relevance.js +24 -0
- package/dist/src/lib/upstream/report.js +18 -46
- package/dist/src/lib/upstream/types.d.ts +2 -0
- package/dist/src/lib/workflow/batch-executor.d.ts +117 -0
- package/dist/src/lib/workflow/batch-executor.js +574 -0
- package/dist/src/lib/workflow/phase-executor.d.ts +40 -0
- package/dist/src/lib/workflow/phase-executor.js +381 -0
- package/dist/src/lib/workflow/phase-mapper.d.ts +65 -0
- package/dist/src/lib/workflow/phase-mapper.js +147 -0
- package/dist/src/lib/workflow/pr-operations.d.ts +86 -0
- package/dist/src/lib/workflow/pr-operations.js +326 -0
- package/dist/src/lib/workflow/pr-status.d.ts +49 -0
- package/dist/src/lib/workflow/pr-status.js +131 -0
- package/dist/src/lib/workflow/run-reflect.d.ts +32 -0
- package/dist/src/lib/workflow/run-reflect.js +191 -0
- package/dist/src/lib/workflow/run-summary.d.ts +36 -0
- package/dist/src/lib/workflow/run-summary.js +142 -0
- package/dist/src/lib/workflow/state-cleanup.d.ts +79 -0
- package/dist/src/lib/workflow/state-cleanup.js +250 -0
- package/dist/src/lib/workflow/state-rebuild.d.ts +38 -0
- package/dist/src/lib/workflow/state-rebuild.js +140 -0
- package/dist/src/lib/workflow/state-utils.d.ts +14 -162
- package/dist/src/lib/workflow/state-utils.js +10 -677
- package/dist/src/lib/workflow/worktree-discovery.d.ts +61 -0
- package/dist/src/lib/workflow/worktree-discovery.js +229 -0
- package/dist/src/lib/workflow/worktree-manager.d.ts +205 -0
- package/dist/src/lib/workflow/worktree-manager.js +918 -0
- package/package.json +4 -2
- package/templates/skills/exec/SKILL.md +2 -2
- package/templates/skills/fullsolve/SKILL.md +15 -5
- package/templates/skills/loop/SKILL.md +1 -1
- package/templates/skills/qa/SKILL.md +47 -7
- package/templates/skills/solve/SKILL.md +92 -6
- package/templates/skills/spec/SKILL.md +57 -4
- package/templates/skills/test/SKILL.md +10 -0
- package/templates/skills/testgen/SKILL.md +1 -1
|
@@ -0,0 +1,754 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spec
|
|
3
|
+
description: "Plan review vs Acceptance Criteria for a single GitHub issue, plus issue comment draft."
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
author: sequant
|
|
7
|
+
version: "1.0"
|
|
8
|
+
allowed-tools:
|
|
9
|
+
- Bash(npm test:*)
|
|
10
|
+
- Bash(gh issue view:*)
|
|
11
|
+
- Bash(gh issue comment:*)
|
|
12
|
+
- Bash(gh issue edit:*)
|
|
13
|
+
- Bash(gh label:*)
|
|
14
|
+
- Bash(git worktree:*)
|
|
15
|
+
- Bash(git -C:*)
|
|
16
|
+
- Task(Explore)
|
|
17
|
+
- AgentOutputTool
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# Planning Agent
|
|
21
|
+
|
|
22
|
+
You are the Phase 1 "Planning Agent" for the current repository.
|
|
23
|
+
|
|
24
|
+
## Purpose
|
|
25
|
+
|
|
26
|
+
When invoked as `/spec`, your job is to:
|
|
27
|
+
|
|
28
|
+
1. Understand the issue and Acceptance Criteria (AC).
|
|
29
|
+
2. Review or synthesize a clear plan to address the AC.
|
|
30
|
+
3. Identify ambiguities, gaps, or risks.
|
|
31
|
+
4. Draft a GitHub issue comment summarizing AC + the agreed plan.
|
|
32
|
+
|
|
33
|
+
## Phase Detection (Smart Resumption)
|
|
34
|
+
|
|
35
|
+
**Before executing**, check if this phase has already been completed by reading phase markers from issue comments:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Check for existing phase markers
|
|
39
|
+
phase_data=$(gh issue view <issue-number> --json comments --jq '[.comments[].body]' | \
|
|
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
|
+
```
|
|
54
|
+
|
|
55
|
+
**Behavior:**
|
|
56
|
+
- If `spec:completed` or a later phase is detected → Skip with message
|
|
57
|
+
- If `spec:failed` → Re-run spec (retry)
|
|
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:
|
|
64
|
+
|
|
65
|
+
```markdown
|
|
66
|
+
<!-- SEQUANT_PHASE: {"phase":"spec","status":"completed","timestamp":"<ISO-8601>"} -->
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Include this marker in every `gh issue comment` that represents phase completion.
|
|
70
|
+
|
|
71
|
+
## Behavior
|
|
72
|
+
|
|
73
|
+
When called like `/spec 123`:
|
|
74
|
+
1. Treat `123` as a GitHub issue number.
|
|
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.
|
|
81
|
+
|
|
82
|
+
**Flag:** `--skip-ac-lint`
|
|
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
|
|
86
|
+
|
|
87
|
+
### AC Extraction and Storage — REQUIRED
|
|
88
|
+
|
|
89
|
+
**After fetching the issue body**, extract and store acceptance criteria in workflow state:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Extract AC from issue body and store in state
|
|
93
|
+
npx tsx -e "
|
|
94
|
+
import { extractAcceptanceCriteria } from './src/lib/ac-parser.ts';
|
|
95
|
+
import { StateManager } from './src/lib/workflow/state-manager.ts';
|
|
96
|
+
|
|
97
|
+
const issueBody = \`<ISSUE_BODY_HERE>\`;
|
|
98
|
+
const issueNumber = <ISSUE_NUMBER>;
|
|
99
|
+
const issueTitle = '<ISSUE_TITLE>';
|
|
100
|
+
|
|
101
|
+
const ac = extractAcceptanceCriteria(issueBody);
|
|
102
|
+
console.log('Extracted AC:', JSON.stringify(ac, null, 2));
|
|
103
|
+
|
|
104
|
+
if (ac.items.length > 0) {
|
|
105
|
+
const manager = new StateManager();
|
|
106
|
+
(async () => {
|
|
107
|
+
const existing = await manager.getIssueState(issueNumber);
|
|
108
|
+
if (!existing) {
|
|
109
|
+
await manager.initializeIssue(issueNumber, issueTitle);
|
|
110
|
+
}
|
|
111
|
+
await manager.updateAcceptanceCriteria(issueNumber, ac);
|
|
112
|
+
console.log('AC stored in state for issue #' + issueNumber);
|
|
113
|
+
})();
|
|
114
|
+
}
|
|
115
|
+
"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Why this matters:** Storing AC in state enables:
|
|
119
|
+
- Dashboard visibility of AC progress per issue
|
|
120
|
+
- `/qa` skill to update AC status during review
|
|
121
|
+
- Cross-skill AC tracking throughout the workflow
|
|
122
|
+
|
|
123
|
+
**AC Format Detection:**
|
|
124
|
+
The parser supports multiple formats:
|
|
125
|
+
- `- [ ] **AC-1:** Description` (bold with hyphen)
|
|
126
|
+
- `- [ ] **B2:** Description` (letter + number)
|
|
127
|
+
- `- [ ] AC-1: Description` (no bold)
|
|
128
|
+
|
|
129
|
+
**If no AC found:**
|
|
130
|
+
- Log a warning but continue with planning
|
|
131
|
+
- The plan output should note that AC will need to be defined
|
|
132
|
+
|
|
133
|
+
### AC Quality Check — REQUIRED (unless --skip-ac-lint)
|
|
134
|
+
|
|
135
|
+
**After extracting AC**, run the AC linter to flag vague, untestable, or incomplete requirements:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
# Lint AC for quality issues (skip if --skip-ac-lint flag is set)
|
|
139
|
+
npx tsx -e "
|
|
140
|
+
import { parseAcceptanceCriteria } from './src/lib/ac-parser.ts';
|
|
141
|
+
import { lintAcceptanceCriteria, formatACLintResults } from './src/lib/ac-linter.ts';
|
|
142
|
+
|
|
143
|
+
const issueBody = \`<ISSUE_BODY_HERE>\`;
|
|
144
|
+
|
|
145
|
+
const criteria = parseAcceptanceCriteria(issueBody);
|
|
146
|
+
const lintResults = lintAcceptanceCriteria(criteria);
|
|
147
|
+
console.log(formatACLintResults(lintResults));
|
|
148
|
+
"
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Why this matters:** Vague AC lead to:
|
|
152
|
+
- Ambiguous implementations that don't match expectations
|
|
153
|
+
- Subjective /qa verdicts ("does it work properly?")
|
|
154
|
+
- Wasted iteration cycles when requirements are clarified late
|
|
155
|
+
|
|
156
|
+
**Pattern Detection:**
|
|
157
|
+
|
|
158
|
+
| Pattern Type | Examples | Issue |
|
|
159
|
+
|--------------|----------|-------|
|
|
160
|
+
| Vague | "should work", "properly", "correctly" | Subjective, no measurable outcome |
|
|
161
|
+
| Unmeasurable | "fast", "performant", "responsive" | No threshold defined |
|
|
162
|
+
| Incomplete | "handle errors", "edge cases" | Specific scenarios not enumerated |
|
|
163
|
+
| Open-ended | "etc.", "and more", "such as" | Scope is undefined |
|
|
164
|
+
|
|
165
|
+
**Example Output:**
|
|
166
|
+
|
|
167
|
+
```markdown
|
|
168
|
+
## AC Quality Check
|
|
169
|
+
|
|
170
|
+
⚠️ **AC-2:** "System should handle errors gracefully"
|
|
171
|
+
→ Incomplete: error types not specified
|
|
172
|
+
→ Suggest: List specific error types and expected responses (e.g., 400 for invalid input, 503 for service unavailable)
|
|
173
|
+
|
|
174
|
+
⚠️ **AC-4:** "Page loads quickly"
|
|
175
|
+
→ Unmeasurable: "quickly" has no threshold
|
|
176
|
+
→ Suggest: Specify time limit (e.g., completes in <5 seconds)
|
|
177
|
+
|
|
178
|
+
✅ AC-1, AC-3, AC-5: Clear and testable
|
|
179
|
+
|
|
180
|
+
**Summary:** 2/5 AC items flagged for review
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
**Behavior:**
|
|
184
|
+
- **Warning-only**: AC Quality Check does NOT block planning
|
|
185
|
+
- Issues are surfaced in the output but plan generation continues
|
|
186
|
+
- Include flagged AC in the issue comment draft with suggestions
|
|
187
|
+
- Recommend refining vague AC before implementation
|
|
188
|
+
|
|
189
|
+
**If `--skip-ac-lint` flag is set:**
|
|
190
|
+
- Output: `AC Quality Check: Skipped (--skip-ac-lint flag set)`
|
|
191
|
+
- Continue directly to plan generation
|
|
192
|
+
|
|
193
|
+
### Feature Worktree Workflow
|
|
194
|
+
|
|
195
|
+
**Planning Phase:** No worktree needed. Planning happens in the main repository directory. The worktree will be created during the execution phase (`/exec`).
|
|
196
|
+
|
|
197
|
+
### Parallel Context Gathering — REQUIRED
|
|
198
|
+
|
|
199
|
+
**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.
|
|
200
|
+
|
|
201
|
+
**Check agent execution mode first:**
|
|
202
|
+
Use the Read tool to check project settings:
|
|
203
|
+
```
|
|
204
|
+
Read(file_path=".sequant/settings.json")
|
|
205
|
+
# Parse JSON and extract agents.parallel (default: false)
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
#### If parallel mode enabled:
|
|
209
|
+
|
|
210
|
+
**Spawn ALL THREE agents in a SINGLE message:**
|
|
211
|
+
|
|
212
|
+
1. `Task(subagent_type="Explore", model="haiku", prompt="Find similar features for [FEATURE]. Check components/admin/, lib/queries/, docs/patterns/. Report: file paths, patterns, recommendations.")`
|
|
213
|
+
|
|
214
|
+
2. `Task(subagent_type="Explore", model="haiku", prompt="Explore [CODEBASE AREA] for [FEATURE]. Find: main components, data flow, key files. Report structure.")`
|
|
215
|
+
|
|
216
|
+
3. `Task(subagent_type="Explore", model="haiku", prompt="Inspect database for [FEATURE]. Check: table schema, RLS policies, existing queries. Report findings.")`
|
|
217
|
+
|
|
218
|
+
#### If sequential mode (default):
|
|
219
|
+
|
|
220
|
+
**Spawn each agent ONE AT A TIME, waiting for each to complete:**
|
|
221
|
+
|
|
222
|
+
1. **First:** `Task(subagent_type="Explore", model="haiku", prompt="Find similar features for [FEATURE]. Check components/admin/, lib/queries/, docs/patterns/. Report: file paths, patterns, recommendations.")`
|
|
223
|
+
|
|
224
|
+
2. **After #1 completes:** `Task(subagent_type="Explore", model="haiku", prompt="Explore [CODEBASE AREA] for [FEATURE]. Find: main components, data flow, key files. Report structure.")`
|
|
225
|
+
|
|
226
|
+
3. **After #2 completes:** `Task(subagent_type="Explore", model="haiku", prompt="Inspect database for [FEATURE]. Check: table schema, RLS policies, existing queries. Report findings.")`
|
|
227
|
+
|
|
228
|
+
### Feature Branch Context Detection
|
|
229
|
+
|
|
230
|
+
Before creating the implementation plan, check if a custom base branch should be recommended:
|
|
231
|
+
|
|
232
|
+
1. **Check for feature branch references in issue body**:
|
|
233
|
+
```bash
|
|
234
|
+
gh issue view <issue> --json body --jq '.body' | grep -iE "(feature/|branch from|based on|part of.*feature)" || true
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
2. **Check issue labels for feature context**:
|
|
238
|
+
```bash
|
|
239
|
+
gh issue view <issue> --json labels --jq '.labels[].name' | grep -iE "(dashboard|feature-|epic-)" || true
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
3. **Check if project has defaultBase configured**:
|
|
243
|
+
Use the Read tool to check settings:
|
|
244
|
+
```
|
|
245
|
+
Read(file_path=".sequant/settings.json")
|
|
246
|
+
# Extract .run.defaultBase from JSON
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
4. **If feature branch context detected**, include in plan output:
|
|
250
|
+
```markdown
|
|
251
|
+
## Feature Branch Context
|
|
252
|
+
|
|
253
|
+
**Detected base branch**: `feature/dashboard`
|
|
254
|
+
**Source**: Issue body mentions "Part of dashboard feature" / Project config / Label
|
|
255
|
+
|
|
256
|
+
**Recommended workflow**:
|
|
257
|
+
\`\`\`bash
|
|
258
|
+
npx sequant run <issue> --base feature/dashboard
|
|
259
|
+
\`\`\`
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### In-Flight Work Analysis (Conflict Detection)
|
|
263
|
+
|
|
264
|
+
Before creating the implementation plan, scan for potential conflicts with in-flight work:
|
|
265
|
+
|
|
266
|
+
1. **List open worktrees**:
|
|
267
|
+
```bash
|
|
268
|
+
git worktree list --porcelain
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
2. **For each worktree, get changed files** (use detected base branch or default to main):
|
|
272
|
+
```bash
|
|
273
|
+
git -C <worktree-path> diff --name-only <base-branch>...HEAD
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
3. **Analyze this issue's likely file touches** based on:
|
|
277
|
+
- Issue description and AC
|
|
278
|
+
- Similar past issues
|
|
279
|
+
- Codebase structure
|
|
280
|
+
|
|
281
|
+
4. **If overlap detected**, include in plan output:
|
|
282
|
+
```markdown
|
|
283
|
+
## Conflict Risk Analysis
|
|
284
|
+
|
|
285
|
+
**In-flight work detected**: Issue #<N> (feature/<branch-name>)
|
|
286
|
+
**Overlapping files**:
|
|
287
|
+
- `<file-path>`
|
|
288
|
+
|
|
289
|
+
**Recommended approach**:
|
|
290
|
+
- [ ] Option A: Use alternative file/approach (no conflict)
|
|
291
|
+
- [ ] Option B: Wait for #<N> to merge, then rebase
|
|
292
|
+
- [ ] Option C: Coordinate unified implementation via /merger
|
|
293
|
+
|
|
294
|
+
**Selected**: [To be decided during spec review]
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
5. **Check for explicit dependencies**:
|
|
298
|
+
```bash
|
|
299
|
+
# Look for "Depends on" or "depends-on" labels
|
|
300
|
+
gh issue view <issue> --json body,labels
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
If dependencies found:
|
|
304
|
+
```markdown
|
|
305
|
+
## Dependencies
|
|
306
|
+
|
|
307
|
+
**Depends on**: #<N>
|
|
308
|
+
**Reason**: [Why this issue depends on the other]
|
|
309
|
+
**Status**: [Open/Merged/Closed]
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### Using MCP Tools (Optional)
|
|
313
|
+
|
|
314
|
+
- **Sequential Thinking:** For complex analysis with multiple dependencies
|
|
315
|
+
- **Context7:** For understanding existing patterns and architecture
|
|
316
|
+
|
|
317
|
+
## Context Gathering Strategy
|
|
318
|
+
|
|
319
|
+
1. **Check the Patterns Catalog first**
|
|
320
|
+
- Read `docs/patterns/README.md` for quick lookup
|
|
321
|
+
- Check HELPERS.md, COMPONENTS.md, TYPES.md
|
|
322
|
+
- **Do NOT propose creating new utilities if similar ones exist**
|
|
323
|
+
|
|
324
|
+
2. **Look for similar features**
|
|
325
|
+
- Use `ls components/admin/[area]/` for existing components
|
|
326
|
+
- Read 1-2 examples to understand patterns
|
|
327
|
+
- Propose solutions matching established architecture
|
|
328
|
+
|
|
329
|
+
3. **Check existing dependencies**
|
|
330
|
+
- Review `package.json` for libraries
|
|
331
|
+
- Prefer existing dependencies over new ones
|
|
332
|
+
- For "solved problem" domains, recommend established packages in the plan:
|
|
333
|
+
| Domain | Recommended Packages |
|
|
334
|
+
|--------|---------------------|
|
|
335
|
+
| Date/time | `date-fns`, `dayjs` |
|
|
336
|
+
| Validation | `zod`, `yup`, `valibot` |
|
|
337
|
+
| HTTP with retry | `ky`, `got`, `axios` |
|
|
338
|
+
| Form state | `react-hook-form` |
|
|
339
|
+
| State management | `zustand`, `jotai` |
|
|
340
|
+
|
|
341
|
+
4. **For database-heavy features**
|
|
342
|
+
- Verify table schemas against TypeScript types
|
|
343
|
+
- Check proposed types match database columns
|
|
344
|
+
|
|
345
|
+
5. **For complex features (>5 AC items)**
|
|
346
|
+
- Use Sequential Thinking to break down systematically
|
|
347
|
+
- Document key decision points and trade-offs
|
|
348
|
+
|
|
349
|
+
## Output Structure
|
|
350
|
+
|
|
351
|
+
### 1. AC Checklist with Verification Criteria
|
|
352
|
+
|
|
353
|
+
Restate AC as a checklist with verification for each:
|
|
354
|
+
|
|
355
|
+
```markdown
|
|
356
|
+
### AC-1: [Description]
|
|
357
|
+
|
|
358
|
+
**Verification Method:** Unit Test | Integration Test | Manual Test | Browser Test
|
|
359
|
+
|
|
360
|
+
**Test Scenario:**
|
|
361
|
+
- Given: [Initial state]
|
|
362
|
+
- When: [Action taken]
|
|
363
|
+
- Then: [Expected outcome]
|
|
364
|
+
|
|
365
|
+
**Integration Points:**
|
|
366
|
+
- [External system or component]
|
|
367
|
+
|
|
368
|
+
**Assumptions to Validate:**
|
|
369
|
+
- [ ] [Assumption that must be true]
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
See [verification-criteria.md](references/verification-criteria.md) for detailed examples including the #452 hooks failure case.
|
|
373
|
+
|
|
374
|
+
### 2. Implementation Plan
|
|
375
|
+
|
|
376
|
+
Propose a concrete plan in 3–7 steps that:
|
|
377
|
+
- References specific codebase areas
|
|
378
|
+
- Respects existing architecture
|
|
379
|
+
- Groups related work into phases
|
|
380
|
+
- Identifies dependencies between steps
|
|
381
|
+
|
|
382
|
+
For each major decision:
|
|
383
|
+
- Present 2-3 options when relevant
|
|
384
|
+
- Recommend a default with rationale
|
|
385
|
+
- Note if decision should be deferred
|
|
386
|
+
|
|
387
|
+
**Open Questions Format:**
|
|
388
|
+
- Question: [Clear question]
|
|
389
|
+
- Recommendation: [Your suggested default]
|
|
390
|
+
- Impact: [What happens if we get this wrong]
|
|
391
|
+
|
|
392
|
+
See [parallel-groups.md](references/parallel-groups.md) for parallelization format.
|
|
393
|
+
|
|
394
|
+
### 3. Plan Review
|
|
395
|
+
|
|
396
|
+
Ask the user to confirm or adjust:
|
|
397
|
+
- The AC checklist (with verification criteria)
|
|
398
|
+
- The implementation plan
|
|
399
|
+
- The assumptions to validate
|
|
400
|
+
|
|
401
|
+
**Do NOT start implementation** - this is planning-only.
|
|
402
|
+
|
|
403
|
+
### 4. Content Analysis (AC-1, AC-2, AC-3, AC-4)
|
|
404
|
+
|
|
405
|
+
**Before** determining the recommended workflow, analyze the issue content for phase-relevant signals:
|
|
406
|
+
|
|
407
|
+
#### Step 1: Check for Solve Comment (AC-4)
|
|
408
|
+
|
|
409
|
+
First, check if a `/solve` comment already exists for this issue:
|
|
410
|
+
|
|
411
|
+
```bash
|
|
412
|
+
# Check issue comments for solve workflow
|
|
413
|
+
gh issue view <issue-number> --json comments --jq '.comments[].body' | grep -l "## Solve Workflow for Issues:" || true
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
**If solve comment found:**
|
|
417
|
+
- Extract phases from the solve workflow (e.g., `spec → exec → test → qa`)
|
|
418
|
+
- Use solve recommendations as the primary source (after labels)
|
|
419
|
+
- Skip content analysis for phases (solve already analyzed)
|
|
420
|
+
- Include in output: `"Solve comment found - using /solve workflow recommendations"`
|
|
421
|
+
|
|
422
|
+
#### Step 2: Analyze Title for Keywords (AC-1)
|
|
423
|
+
|
|
424
|
+
If no solve comment, analyze the issue title for phase-relevant keywords:
|
|
425
|
+
|
|
426
|
+
| Pattern | Detection | Suggested Phase |
|
|
427
|
+
|---------|-----------|-----------------|
|
|
428
|
+
| `extract`, `component` | UI work | Add `/test` |
|
|
429
|
+
| `refactor.*ui`, `ui refactor` | UI work | Add `/test` |
|
|
430
|
+
| `frontend`, `dashboard` | UI work | Add `/test` |
|
|
431
|
+
| `auth`, `permission`, `security` | Security-sensitive | Add `/security-review` |
|
|
432
|
+
| `password`, `credential`, `token` | Security-sensitive | Add `/security-review` |
|
|
433
|
+
| `refactor`, `migration`, `restructure` | Complex work | Enable quality loop |
|
|
434
|
+
| `breaking change` | Complex work | Enable quality loop |
|
|
435
|
+
|
|
436
|
+
#### Step 3: Analyze Body for Patterns (AC-2)
|
|
437
|
+
|
|
438
|
+
Analyze the issue body for file references and keywords:
|
|
439
|
+
|
|
440
|
+
| Pattern | Detection | Suggested Phase |
|
|
441
|
+
|---------|-----------|-----------------|
|
|
442
|
+
| References `.tsx` or `.jsx` files | UI work likely | Add `/test` |
|
|
443
|
+
| References `components/` directory | UI work | Add `/test` |
|
|
444
|
+
| References `scripts/` or `bin/` | CLI work | May need `/verify` |
|
|
445
|
+
| References `auth/` directory | Security-sensitive | Add `/security-review` |
|
|
446
|
+
| References `middleware.ts` | May be auth-related | Consider `/security-review` |
|
|
447
|
+
| Contains "breaking change" | Complex work | Enable quality loop |
|
|
448
|
+
|
|
449
|
+
#### Step 3a: Browser Testing Label Suggestion
|
|
450
|
+
|
|
451
|
+
**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:
|
|
452
|
+
|
|
453
|
+
```markdown
|
|
454
|
+
> **Component files detected** — Issue body references `.tsx`/`.jsx` files or `components/` directory, but no `ui`/`frontend`/`admin` label is present.
|
|
455
|
+
> - To enable browser testing: add the `ui` label → `gh issue edit <N> --add-label ui`
|
|
456
|
+
> - To explicitly skip browser testing: add `no-browser-test` label → `gh issue edit <N> --add-label no-browser-test`
|
|
457
|
+
> - Without either label, QA will note the missing browser test coverage.
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
**When NOT to show this warning:**
|
|
461
|
+
- Issue already has `ui`, `frontend`, or `admin` label (browser testing already enabled)
|
|
462
|
+
- Issue has `no-browser-test` label (explicit opt-out)
|
|
463
|
+
- No `.tsx`/`.jsx`/`components/` references detected
|
|
464
|
+
|
|
465
|
+
#### Step 4: Merge Signals (AC-3)
|
|
466
|
+
|
|
467
|
+
Content analysis **supplements** label detection - it can only ADD phases, never remove them.
|
|
468
|
+
|
|
469
|
+
**Priority order (highest first):**
|
|
470
|
+
1. **Labels** (explicit, highest priority)
|
|
471
|
+
2. **Solve comment** (if exists)
|
|
472
|
+
3. **Title keywords**
|
|
473
|
+
4. **Body patterns** (lowest priority)
|
|
474
|
+
|
|
475
|
+
**Output format:**
|
|
476
|
+
|
|
477
|
+
```markdown
|
|
478
|
+
## Content Analysis
|
|
479
|
+
|
|
480
|
+
### Signal Sources
|
|
481
|
+
|
|
482
|
+
| Phase | Source | Confidence | Reason |
|
|
483
|
+
|-------|--------|------------|--------|
|
|
484
|
+
| /test | title | high | "Extract component" detected |
|
|
485
|
+
| /security-review | body | medium | References auth/ directory |
|
|
486
|
+
|
|
487
|
+
### Merged Recommendations
|
|
488
|
+
|
|
489
|
+
**From labels:** /test (ui label)
|
|
490
|
+
**From content:** /security-review (added)
|
|
491
|
+
**Final phases:** spec → exec → test → security-review → qa
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
### 4.5. Solve Comment Detection (AC-4, AC-5)
|
|
495
|
+
|
|
496
|
+
**Before making your own phase recommendation**, check if `/solve` has already posted an analysis comment to this issue:
|
|
497
|
+
|
|
498
|
+
```bash
|
|
499
|
+
# Check for solve analysis comment on the issue
|
|
500
|
+
solve_comment=$(gh issue view <issue-number> --json comments \
|
|
501
|
+
--jq '[.comments[].body | select(test("## Solve Analysis|<!-- solve:phases="))] | last // empty')
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
**If a solve analysis comment exists:**
|
|
505
|
+
|
|
506
|
+
1. Parse the HTML comment markers to extract the recommended phases:
|
|
507
|
+
```
|
|
508
|
+
<!-- solve:phases=exec,qa --> → phases: ["exec", "qa"]
|
|
509
|
+
<!-- solve:skip-spec=true --> → skip spec phase
|
|
510
|
+
<!-- solve:browser-test=false --> → no browser testing needed
|
|
511
|
+
<!-- solve:quality-loop=true --> → enable quality loop
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
2. **Use the solve recommendation as your starting point** for the phase recommendation in step 5.
|
|
515
|
+
|
|
516
|
+
3. **You may override the solve recommendation**, but you MUST document why:
|
|
517
|
+
```markdown
|
|
518
|
+
## Recommended Workflow
|
|
519
|
+
|
|
520
|
+
**Phases:** spec → exec → test → qa
|
|
521
|
+
**Quality Loop:** enabled
|
|
522
|
+
**Reasoning:** Solve recommended `exec → qa`, but codebase analysis reveals UI components
|
|
523
|
+
are affected (found `.tsx` files in change scope), so browser testing is needed.
|
|
524
|
+
Overriding solve recommendation with explanation.
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
4. If the solve comment recommends `skip-spec=true`, acknowledge this in your output but proceed with spec since `/spec` was explicitly invoked.
|
|
528
|
+
|
|
529
|
+
**If no solve analysis comment exists:** Proceed with your own analysis as normal (step 5).
|
|
530
|
+
|
|
531
|
+
### 5. Recommended Workflow
|
|
532
|
+
|
|
533
|
+
Analyze the issue and recommend the optimal workflow phases:
|
|
534
|
+
|
|
535
|
+
```markdown
|
|
536
|
+
## Recommended Workflow
|
|
537
|
+
|
|
538
|
+
**Phases:** spec → exec → qa
|
|
539
|
+
**Quality Loop:** disabled
|
|
540
|
+
**Signal Sources:** [labels | solve | content]
|
|
541
|
+
**Reasoning:** [Brief explanation of why these phases were chosen]
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
**Phase Selection Logic:**
|
|
545
|
+
- **UI/Frontend changes** → Add `test` phase (browser testing)
|
|
546
|
+
- **Bug fixes** → Skip `spec` if already well-defined
|
|
547
|
+
- **Complex refactors** → Enable quality loop
|
|
548
|
+
- **Security-sensitive** → Add `security-review` phase
|
|
549
|
+
- **Documentation only** → Skip `spec`, just `exec → qa`
|
|
550
|
+
|
|
551
|
+
**Content Analysis Integration:**
|
|
552
|
+
- Include content-detected phases in the workflow
|
|
553
|
+
- Note signal source in reasoning (e.g., "Added /test based on title keyword 'extract component'")
|
|
554
|
+
|
|
555
|
+
### 6. Label Review
|
|
556
|
+
|
|
557
|
+
Analyze current labels vs implementation plan and suggest updates:
|
|
558
|
+
|
|
559
|
+
```markdown
|
|
560
|
+
## Label Review
|
|
561
|
+
|
|
562
|
+
**Current:** enhancement
|
|
563
|
+
**Recommended:** enhancement, refactor
|
|
564
|
+
**Reason:** Implementation plan involves structural changes to 5+ files
|
|
565
|
+
**Quality Loop:** Will auto-enable due to `refactor` label
|
|
566
|
+
|
|
567
|
+
→ `gh issue edit <N> --add-label refactor`
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
**Plan-Based Detection Logic:**
|
|
571
|
+
- If plan has 5+ file changes → suggest `refactor`
|
|
572
|
+
- If plan touches UI components → suggest `ui` or `frontend`
|
|
573
|
+
- If plan has breaking API changes → suggest `breaking`
|
|
574
|
+
- If plan involves database migrations → suggest `backend`, `complex`
|
|
575
|
+
- If plan involves CLI/scripts → suggest `cli`
|
|
576
|
+
- If plan is documentation-only → suggest `docs`
|
|
577
|
+
- If recommended workflow includes quality loop → ensure matching label exists (`complex`, `refactor`, or `breaking`)
|
|
578
|
+
|
|
579
|
+
**Label Inference from Plan Analysis:**
|
|
580
|
+
- Count files in implementation plan steps
|
|
581
|
+
- Identify component types being modified
|
|
582
|
+
- Check if API contracts are changing
|
|
583
|
+
- Match against quality loop trigger labels
|
|
584
|
+
|
|
585
|
+
### 7. Issue Comment Draft
|
|
586
|
+
|
|
587
|
+
Generate a Markdown snippet with:
|
|
588
|
+
- AC checklist with verification criteria
|
|
589
|
+
- Verification methods summary
|
|
590
|
+
- Consolidated assumptions checklist
|
|
591
|
+
- Implementation plan with phases
|
|
592
|
+
- Key decisions and rationale
|
|
593
|
+
- Open questions with recommendations
|
|
594
|
+
- Effort breakdown
|
|
595
|
+
|
|
596
|
+
Label clearly as:
|
|
597
|
+
```md
|
|
598
|
+
--- DRAFT GITHUB ISSUE COMMENT (PLAN) ---
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
### 8. Update GitHub Issue
|
|
602
|
+
|
|
603
|
+
Post the draft comment to GitHub:
|
|
604
|
+
```bash
|
|
605
|
+
gh issue comment <issue-number> --body "..."
|
|
606
|
+
gh issue edit <issue-number> --add-label "planned"
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
---
|
|
610
|
+
|
|
611
|
+
## State Tracking
|
|
612
|
+
|
|
613
|
+
**IMPORTANT:** Update workflow state when running standalone (not orchestrated).
|
|
614
|
+
|
|
615
|
+
### Check Orchestration Mode
|
|
616
|
+
|
|
617
|
+
At the start of the skill, check if running orchestrated:
|
|
618
|
+
```bash
|
|
619
|
+
# Check if orchestrated - if so, skip state updates
|
|
620
|
+
if [[ -n "$SEQUANT_ORCHESTRATOR" ]]; then
|
|
621
|
+
echo "Running orchestrated - state managed by orchestrator"
|
|
622
|
+
fi
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
### State Updates (Standalone Only)
|
|
626
|
+
|
|
627
|
+
When NOT orchestrated (`SEQUANT_ORCHESTRATOR` is not set):
|
|
628
|
+
|
|
629
|
+
**At skill start:**
|
|
630
|
+
```bash
|
|
631
|
+
npx tsx scripts/state/update.ts start <issue-number> spec
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
**On successful completion:**
|
|
635
|
+
```bash
|
|
636
|
+
npx tsx scripts/state/update.ts complete <issue-number> spec
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
**On failure:**
|
|
640
|
+
```bash
|
|
641
|
+
npx tsx scripts/state/update.ts fail <issue-number> spec "Error description"
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
**Why this matters:** State tracking enables dashboard visibility, resume capability, and workflow orchestration. Skills update state when standalone; orchestrators handle state when running workflows.
|
|
645
|
+
|
|
646
|
+
---
|
|
647
|
+
|
|
648
|
+
## Output Verification
|
|
649
|
+
|
|
650
|
+
**Before responding, verify your output includes ALL of these:**
|
|
651
|
+
|
|
652
|
+
- [ ] **AC Quality Check** - Lint results (or "Skipped" if --skip-ac-lint)
|
|
653
|
+
- [ ] **AC Checklist** - Numbered AC items (AC-1, AC-2, etc.) with descriptions
|
|
654
|
+
- [ ] **Verification Criteria** - Each AC has Verification Method and Test Scenario
|
|
655
|
+
- [ ] **Conflict Risk Analysis** - Check for in-flight work, include if conflicts found
|
|
656
|
+
- [ ] **Implementation Plan** - 3-7 concrete steps with codebase references
|
|
657
|
+
- [ ] **Content Analysis** - Title/body analysis results (or "Solve comment found" if using /solve)
|
|
658
|
+
- [ ] **Recommended Workflow** - Phases, Quality Loop setting, Signal Sources, and Reasoning
|
|
659
|
+
- [ ] **Label Review** - Current vs recommended labels based on plan analysis
|
|
660
|
+
- [ ] **Open Questions** - Any ambiguities with recommended defaults
|
|
661
|
+
- [ ] **Issue Comment Draft** - Formatted for GitHub posting
|
|
662
|
+
|
|
663
|
+
**DO NOT respond until all items are verified.**
|
|
664
|
+
|
|
665
|
+
## Output Template
|
|
666
|
+
|
|
667
|
+
You MUST include these sections in order:
|
|
668
|
+
|
|
669
|
+
```markdown
|
|
670
|
+
## AC Quality Check
|
|
671
|
+
|
|
672
|
+
[Output from AC linter, or "Skipped (--skip-ac-lint flag set)"]
|
|
673
|
+
|
|
674
|
+
---
|
|
675
|
+
|
|
676
|
+
## Acceptance Criteria
|
|
677
|
+
|
|
678
|
+
### AC-1: [Description]
|
|
679
|
+
|
|
680
|
+
**Verification Method:** [Unit Test | Integration Test | Browser Test | Manual Test]
|
|
681
|
+
|
|
682
|
+
**Test Scenario:**
|
|
683
|
+
- Given: [Initial state]
|
|
684
|
+
- When: [Action]
|
|
685
|
+
- Then: [Expected outcome]
|
|
686
|
+
|
|
687
|
+
### AC-2: [Description]
|
|
688
|
+
<!-- Continue for all AC items -->
|
|
689
|
+
|
|
690
|
+
---
|
|
691
|
+
|
|
692
|
+
## Implementation Plan
|
|
693
|
+
|
|
694
|
+
### Phase 1: [Phase Name]
|
|
695
|
+
1. [Step with specific file/component references]
|
|
696
|
+
2. [Step]
|
|
697
|
+
|
|
698
|
+
### Phase 2: [Phase Name]
|
|
699
|
+
<!-- Continue for all phases -->
|
|
700
|
+
|
|
701
|
+
---
|
|
702
|
+
|
|
703
|
+
## Open Questions
|
|
704
|
+
|
|
705
|
+
1. **[Question]**
|
|
706
|
+
- Recommendation: [Default choice]
|
|
707
|
+
- Impact: [What happens if wrong]
|
|
708
|
+
|
|
709
|
+
---
|
|
710
|
+
|
|
711
|
+
## Content Analysis
|
|
712
|
+
|
|
713
|
+
<!-- If solve comment found: -->
|
|
714
|
+
**Source:** Solve comment found - using /solve workflow recommendations
|
|
715
|
+
|
|
716
|
+
<!-- If no solve comment, show analysis: -->
|
|
717
|
+
### Signal Sources
|
|
718
|
+
|
|
719
|
+
| Phase | Source | Confidence | Reason |
|
|
720
|
+
|-------|--------|------------|--------|
|
|
721
|
+
| /test | title | high | "[matched keyword]" detected |
|
|
722
|
+
| /security-review | body | medium | References [pattern] |
|
|
723
|
+
|
|
724
|
+
### Merged Recommendations
|
|
725
|
+
|
|
726
|
+
**From labels:** [label-detected phases]
|
|
727
|
+
**From content:** [content-detected phases]
|
|
728
|
+
|
|
729
|
+
---
|
|
730
|
+
|
|
731
|
+
## Recommended Workflow
|
|
732
|
+
|
|
733
|
+
**Phases:** exec → qa
|
|
734
|
+
**Quality Loop:** disabled
|
|
735
|
+
**Signal Sources:** [labels | solve | content]
|
|
736
|
+
**Reasoning:** [Why these phases based on issue analysis]
|
|
737
|
+
|
|
738
|
+
---
|
|
739
|
+
|
|
740
|
+
## Label Review
|
|
741
|
+
|
|
742
|
+
**Current:** [current labels]
|
|
743
|
+
**Recommended:** [recommended labels]
|
|
744
|
+
**Reason:** [Why these labels based on plan analysis]
|
|
745
|
+
**Quality Loop:** [Will/Won't auto-enable and why]
|
|
746
|
+
|
|
747
|
+
→ `gh issue edit <N> --add-label [label]`
|
|
748
|
+
|
|
749
|
+
---
|
|
750
|
+
|
|
751
|
+
--- DRAFT GITHUB ISSUE COMMENT (PLAN) ---
|
|
752
|
+
|
|
753
|
+
[Complete formatted comment for GitHub]
|
|
754
|
+
```
|