sequant 1.18.0 → 1.19.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/plugin.json +1 -1
- package/dist/bin/cli.js +7 -0
- package/dist/src/commands/conventions.d.ts +9 -0
- package/dist/src/commands/conventions.js +61 -0
- package/dist/src/commands/init.js +12 -0
- package/dist/src/lib/conventions-detector.d.ts +62 -0
- package/dist/src/lib/conventions-detector.js +510 -0
- package/dist/src/lib/settings.d.ts +8 -0
- package/dist/src/lib/settings.js +1 -0
- package/dist/src/lib/stacks.d.ts +4 -2
- package/dist/src/lib/stacks.js +43 -3
- package/dist/src/lib/workflow/state-schema.d.ts +5 -5
- package/package.json +1 -1
- package/templates/skills/exec/SKILL.md +1086 -29
- package/templates/skills/qa/SKILL.md +1732 -156
- package/templates/skills/test/SKILL.md +246 -1
|
@@ -42,10 +42,127 @@ The `/test` phase is invoked by `/fullsolve` based on issue labels:
|
|
|
42
42
|
2. **Execution Phase:** Run tests systematically with browser automation
|
|
43
43
|
3. **Reporting Phase:** Generate test results and GitHub comment
|
|
44
44
|
|
|
45
|
+
## Orchestration Context
|
|
46
|
+
|
|
47
|
+
When running as part of an orchestrated workflow (e.g., `sequant run` or `/fullsolve`), this skill receives environment variables that indicate the orchestration context:
|
|
48
|
+
|
|
49
|
+
| Environment Variable | Description | Example Value |
|
|
50
|
+
|---------------------|-------------|---------------|
|
|
51
|
+
| `SEQUANT_ORCHESTRATOR` | The orchestrator invoking this skill | `sequant-run` |
|
|
52
|
+
| `SEQUANT_PHASE` | Current phase in the workflow | `test` |
|
|
53
|
+
| `SEQUANT_ISSUE` | Issue number being processed | `123` |
|
|
54
|
+
| `SEQUANT_WORKTREE` | Path to the feature worktree | `/path/to/worktrees/feature/...` |
|
|
55
|
+
|
|
56
|
+
**Behavior when orchestrated (SEQUANT_ORCHESTRATOR is set):**
|
|
57
|
+
|
|
58
|
+
1. **Skip issue fetch** - Use `SEQUANT_ISSUE` directly, orchestrator has context
|
|
59
|
+
2. **Use provided worktree** - Work in `SEQUANT_WORKTREE` path
|
|
60
|
+
3. **Reduce GitHub comment frequency** - Defer progress updates to orchestrator
|
|
61
|
+
4. **Trust dev server status** - Orchestrator may have started it already
|
|
62
|
+
|
|
63
|
+
**Behavior when standalone (SEQUANT_ORCHESTRATOR is NOT set):**
|
|
64
|
+
|
|
65
|
+
- Fetch fresh issue context from GitHub
|
|
66
|
+
- Locate or prompt for worktree
|
|
67
|
+
- Post progress updates to GitHub
|
|
68
|
+
- Start dev server if needed
|
|
69
|
+
|
|
70
|
+
## Pre-flight: Stale Branch Detection
|
|
71
|
+
|
|
72
|
+
**Skip this section if `SEQUANT_ORCHESTRATOR` is set** - the orchestrator handles branch freshness checks.
|
|
73
|
+
|
|
74
|
+
**Purpose:** Detect when the feature branch is significantly behind main before running browser tests. Testing stale code is wasteful because:
|
|
75
|
+
- Test results may not apply to the merged state
|
|
76
|
+
- Features may have conflicts that need resolution first
|
|
77
|
+
- Time spent on testing is lost if rebase is required
|
|
78
|
+
|
|
79
|
+
**Detection:**
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Ensure we have latest remote state
|
|
83
|
+
git fetch origin 2>/dev/null || true
|
|
84
|
+
|
|
85
|
+
# Count commits behind main
|
|
86
|
+
behind=$(git rev-list --count HEAD..origin/main 2>/dev/null || echo "0")
|
|
87
|
+
echo "Feature branch is $behind commits behind main"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Threshold Configuration:**
|
|
91
|
+
|
|
92
|
+
The stale branch threshold is configurable in `.sequant/settings.json`:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"run": {
|
|
97
|
+
"staleBranchThreshold": 5
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Default: 5 commits
|
|
103
|
+
|
|
104
|
+
**Behavior:**
|
|
105
|
+
|
|
106
|
+
| Commits Behind | Action |
|
|
107
|
+
|----------------|--------|
|
|
108
|
+
| 0 | ✅ Proceed normally |
|
|
109
|
+
| 1 to threshold | ⚠️ **Warning:** "Feature branch is N commits behind main. Consider rebasing before testing." |
|
|
110
|
+
| > threshold | ❌ **Block:** "STALE_BRANCH: Feature branch is N commits behind main (threshold: T). Rebase required before testing." |
|
|
111
|
+
|
|
112
|
+
**Implementation:**
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Read threshold from settings (default: 5)
|
|
116
|
+
threshold=$(jq -r '.run.staleBranchThreshold // 5' .sequant/settings.json 2>/dev/null || echo "5")
|
|
117
|
+
|
|
118
|
+
behind=$(git rev-list --count HEAD..origin/main 2>/dev/null || echo "0")
|
|
119
|
+
|
|
120
|
+
if [[ $behind -gt $threshold ]]; then
|
|
121
|
+
echo "❌ STALE_BRANCH: Feature branch is $behind commits behind main (threshold: $threshold)"
|
|
122
|
+
echo " Rebase required before testing:"
|
|
123
|
+
echo " git fetch origin && git rebase origin/main"
|
|
124
|
+
# Exit with error - testing should not proceed
|
|
125
|
+
exit 1
|
|
126
|
+
elif [[ $behind -gt 0 ]]; then
|
|
127
|
+
echo "⚠️ Warning: Feature branch is $behind commits behind main."
|
|
128
|
+
echo " Consider rebasing before testing: git fetch origin && git rebase origin/main"
|
|
129
|
+
# Continue with warning
|
|
130
|
+
fi
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Output Format:**
|
|
134
|
+
|
|
135
|
+
```markdown
|
|
136
|
+
### Stale Branch Check
|
|
137
|
+
|
|
138
|
+
| Check | Value |
|
|
139
|
+
|-------|-------|
|
|
140
|
+
| Commits behind main | N |
|
|
141
|
+
| Threshold | T |
|
|
142
|
+
| Status | ✅ OK / ⚠️ Warning / ❌ Blocked |
|
|
143
|
+
|
|
144
|
+
[Warning/blocking message if applicable]
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Verdict Impact:**
|
|
148
|
+
|
|
149
|
+
| Status | Verdict Impact |
|
|
150
|
+
|--------|----------------|
|
|
151
|
+
| OK (0 behind) | No impact |
|
|
152
|
+
| Warning (1 to threshold) | Note in test output, recommend rebase |
|
|
153
|
+
| Blocked (> threshold) | **Cannot proceed** - rebase first |
|
|
154
|
+
|
|
45
155
|
## Phase 1: Setup
|
|
46
156
|
|
|
47
157
|
### 1.1 Fetch Issue Context
|
|
48
158
|
|
|
159
|
+
**If orchestrated (SEQUANT_ORCHESTRATOR is set):**
|
|
160
|
+
- Use `SEQUANT_ISSUE` for the issue number
|
|
161
|
+
- Skip fetching issue context (orchestrator has already done this)
|
|
162
|
+
- Parse any context passed in the orchestrator's prompt
|
|
163
|
+
|
|
164
|
+
**If standalone:**
|
|
165
|
+
|
|
49
166
|
```bash
|
|
50
167
|
gh issue view <issue-number> --json title,body,labels
|
|
51
168
|
gh issue view <issue-number> --comments
|
|
@@ -132,7 +249,99 @@ Wait for server ready before proceeding.
|
|
|
132
249
|
|
|
133
250
|
**Note:** If `{{DEV_URL}}` or `{{PM_RUN}}` are not replaced with actual values, the defaults are:
|
|
134
251
|
- DEV_URL: `http://localhost:3000` (Next.js), `http://localhost:4321` (Astro), `http://localhost:5173` (Vite-based)
|
|
135
|
-
- PM_RUN: `npm run` (or `bun run`, `yarn`, `pnpm run` based on lockfile)
|
|
252
|
+
- PM_RUN: `npm run` (or `bun run`, `yarn`, `pnpm run`, `poetry run`, `uv run`, `python -m` based on lockfile)
|
|
253
|
+
|
|
254
|
+
### 1.5 Test Coverage Analysis (REQUIRED)
|
|
255
|
+
|
|
256
|
+
**Purpose:** Warn when new/modified source files lack corresponding test files.
|
|
257
|
+
|
|
258
|
+
**Before executing tests**, analyze coverage for changed files:
|
|
259
|
+
|
|
260
|
+
1. **Get changed source files:**
|
|
261
|
+
```bash
|
|
262
|
+
# Get changed source files (excluding tests themselves)
|
|
263
|
+
changed=$(git diff main...HEAD --name-only | grep -E '\.(ts|tsx|js|jsx)$' | grep -v -E '\.test\.|\.spec\.|__tests__' || true)
|
|
264
|
+
echo "Changed source files:"
|
|
265
|
+
echo "$changed"
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
2. **Check for corresponding test files:**
|
|
269
|
+
```bash
|
|
270
|
+
# For each changed file, check if a test file exists
|
|
271
|
+
for file in $changed; do
|
|
272
|
+
base=$(basename "$file" | sed -E 's/\.(ts|tsx|js|jsx)$//')
|
|
273
|
+
dir=$(dirname "$file")
|
|
274
|
+
|
|
275
|
+
# Look for test files in common locations
|
|
276
|
+
test_found=false
|
|
277
|
+
|
|
278
|
+
# Check co-located test file
|
|
279
|
+
if ls "$dir/$base.test."* 2>/dev/null | grep -q .; then
|
|
280
|
+
test_found=true
|
|
281
|
+
fi
|
|
282
|
+
|
|
283
|
+
# Check __tests__ directory
|
|
284
|
+
if ls "$dir/__tests__/$base.test."* 2>/dev/null | grep -q .; then
|
|
285
|
+
test_found=true
|
|
286
|
+
fi
|
|
287
|
+
|
|
288
|
+
# Check root __tests__ with path structure
|
|
289
|
+
if ls "__tests__/${file%.ts*}.test."* 2>/dev/null | grep -q .; then
|
|
290
|
+
test_found=true
|
|
291
|
+
fi
|
|
292
|
+
|
|
293
|
+
if [ "$test_found" = false ]; then
|
|
294
|
+
echo "⚠️ NO TEST: $file"
|
|
295
|
+
fi
|
|
296
|
+
done
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
3. **Generate Coverage Warning Report:**
|
|
300
|
+
|
|
301
|
+
```markdown
|
|
302
|
+
### Test Coverage Analysis
|
|
303
|
+
|
|
304
|
+
| Source File | Has Test? | Notes |
|
|
305
|
+
|-------------|-----------|-------|
|
|
306
|
+
| `src/lib/feature.ts` | ⚠️ No | New file, no test coverage |
|
|
307
|
+
| `src/lib/utils.ts` | ✅ Yes | `src/lib/utils.test.ts` |
|
|
308
|
+
| `app/admin/page.tsx` | - | UI component (browser tested) |
|
|
309
|
+
|
|
310
|
+
**Coverage:** X/Y changed source files have corresponding tests
|
|
311
|
+
|
|
312
|
+
**Warning:** The following new/modified files lack test coverage:
|
|
313
|
+
- `src/lib/feature.ts` - Consider adding `src/lib/feature.test.ts`
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
4. **Coverage Tier Classification:**
|
|
317
|
+
|
|
318
|
+
| Tier | File Pattern | Coverage Recommendation |
|
|
319
|
+
|------|--------------|------------------------|
|
|
320
|
+
| **Critical** | `auth/*`, `payment/*`, `security/*`, `middleware/*` | ⚠️ Flag prominently if missing |
|
|
321
|
+
| **Standard** | `lib/*`, `utils/*`, `api/*`, `server/*` | Note if missing |
|
|
322
|
+
| **UI/Browser** | `app/**/page.tsx`, `components/*` | Browser testing covers these |
|
|
323
|
+
| **Config/Types** | `*.config.*`, `types/*`, `*.d.ts` | No test required |
|
|
324
|
+
|
|
325
|
+
5. **Detection Heuristic for Critical Paths:**
|
|
326
|
+
```bash
|
|
327
|
+
# Flag critical path changes without tests
|
|
328
|
+
critical=$(echo "$changed" | grep -E 'auth|payment|security|middleware|server-action' || true)
|
|
329
|
+
if [[ -n "$critical" ]]; then
|
|
330
|
+
echo "⚠️ CRITICAL PATH CHANGES - test coverage strongly recommended:"
|
|
331
|
+
echo "$critical"
|
|
332
|
+
fi
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
6. **Behavior:**
|
|
336
|
+
- **Warning-only**: Does NOT block test execution
|
|
337
|
+
- Include coverage analysis in test results report
|
|
338
|
+
- Recommend adding tests for uncovered critical paths
|
|
339
|
+
- Note UI files are covered by browser testing (this skill)
|
|
340
|
+
|
|
341
|
+
**Why this matters:** Catching missing test coverage early:
|
|
342
|
+
- Prevents regressions from shipping untested code
|
|
343
|
+
- Ensures new logic has corresponding test validation
|
|
344
|
+
- Highlights critical paths that need extra scrutiny
|
|
136
345
|
|
|
137
346
|
## Decision Point: Feature Implemented or Not?
|
|
138
347
|
|
|
@@ -369,6 +578,13 @@ Create structured test results:
|
|
|
369
578
|
|
|
370
579
|
### 3.2 GitHub Comment
|
|
371
580
|
|
|
581
|
+
**If orchestrated (SEQUANT_ORCHESTRATOR is set):**
|
|
582
|
+
- Skip posting GitHub comment (orchestrator handles summary)
|
|
583
|
+
- Include test summary in output for orchestrator to capture
|
|
584
|
+
- Let orchestrator aggregate results across phases
|
|
585
|
+
|
|
586
|
+
**If standalone:**
|
|
587
|
+
|
|
372
588
|
Draft comment for Issue #<N>:
|
|
373
589
|
|
|
374
590
|
```markdown
|
|
@@ -436,6 +652,8 @@ If no explicit tests, use AC as test cases:
|
|
|
436
652
|
|
|
437
653
|
## Browser Testing Best Practices
|
|
438
654
|
|
|
655
|
+
**Reference:** See [Browser Testing Patterns](references/browser-testing-patterns.md) for comprehensive patterns including forms, modals, grids, async content, and troubleshooting.
|
|
656
|
+
|
|
439
657
|
### Snapshots vs. Screenshots
|
|
440
658
|
|
|
441
659
|
**Use `take_snapshot()` when:**
|
|
@@ -587,6 +805,33 @@ Both can be used together:
|
|
|
587
805
|
|
|
588
806
|
---
|
|
589
807
|
|
|
808
|
+
## State Tracking
|
|
809
|
+
|
|
810
|
+
**IMPORTANT:** Update workflow state when running standalone (not orchestrated).
|
|
811
|
+
|
|
812
|
+
### State Updates (Standalone Only)
|
|
813
|
+
|
|
814
|
+
When NOT orchestrated (`SEQUANT_ORCHESTRATOR` is not set):
|
|
815
|
+
|
|
816
|
+
**At skill start:**
|
|
817
|
+
```bash
|
|
818
|
+
npx tsx scripts/state/update.ts start <issue-number> test
|
|
819
|
+
```
|
|
820
|
+
|
|
821
|
+
**On successful completion:**
|
|
822
|
+
```bash
|
|
823
|
+
npx tsx scripts/state/update.ts complete <issue-number> test
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
**On failure:**
|
|
827
|
+
```bash
|
|
828
|
+
npx tsx scripts/state/update.ts fail <issue-number> test "X/Y tests failed"
|
|
829
|
+
```
|
|
830
|
+
|
|
831
|
+
**Why this matters:** State tracking enables dashboard visibility, resume capability, and workflow orchestration. Skills update state when standalone; orchestrators handle state when running workflows.
|
|
832
|
+
|
|
833
|
+
---
|
|
834
|
+
|
|
590
835
|
## Output Verification
|
|
591
836
|
|
|
592
837
|
**Before responding, verify your output includes ALL of these:**
|