sequant 2.2.0 → 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 +94 -9
- package/dist/src/commands/doctor.d.ts +25 -0
- package/dist/src/commands/doctor.js +36 -1
- 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 +11 -2
- package/dist/src/commands/run-display.js +62 -28
- 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 +80 -18
- package/dist/src/commands/stats.d.ts +2 -0
- package/dist/src/commands/stats.js +94 -8
- package/dist/src/commands/status.js +12 -0
- 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/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 +248 -175
- 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 +62 -8
- package/dist/src/lib/workflow/phase-executor.js +157 -16
- 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 +39 -0
- package/dist/src/lib/workflow/run-orchestrator.js +340 -15
- 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 +8 -1
- package/dist/src/lib/workflow/worktree-manager.js +15 -6
- 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 +103 -49
- 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 -8
- package/templates/skills/fullsolve/SKILL.md +79 -5
- package/templates/skills/loop/SKILL.md +28 -0
- package/templates/skills/merger/SKILL.md +621 -0
- package/templates/skills/qa/SKILL.md +727 -8
- package/templates/skills/setup/SKILL.md +6 -0
- package/templates/skills/spec/SKILL.md +52 -0
- package/templates/skills/spec/references/parallel-groups.md +7 -0
- package/templates/skills/spec/references/recommended-workflow.md +4 -2
- package/templates/skills/testgen/SKILL.md +24 -17
|
@@ -55,13 +55,63 @@ gh pr list --search "head:feature/<issue-number>" --json number,headRefName
|
|
|
55
55
|
**Step 3:** Analyze the implementation diff:
|
|
56
56
|
```bash
|
|
57
57
|
# If PR exists:
|
|
58
|
-
gh pr diff <pr-number>
|
|
58
|
+
gh pr diff <pr-number>
|
|
59
59
|
|
|
60
60
|
# If no PR, use git diff from feature branch:
|
|
61
61
|
git diff main...HEAD --name-only
|
|
62
62
|
git diff main...HEAD
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
+
**Step 4:** Detect documentation-only changes:
|
|
66
|
+
```bash
|
|
67
|
+
# Count non-documentation files changed
|
|
68
|
+
non_doc_files=$(git diff main...HEAD --name-only | grep -vE '\.(md|mdx)$|^docs/' | wc -l | xargs || true)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Decision Logic:**
|
|
72
|
+
```
|
|
73
|
+
IF non_doc_files == 0 THEN
|
|
74
|
+
# Documentation-only issue detected
|
|
75
|
+
# Skip template generation, post confirmation comment instead
|
|
76
|
+
# See Section 2a: Documentation-Only Early Exit
|
|
77
|
+
ELSE
|
|
78
|
+
# Continue with normal documentation generation
|
|
79
|
+
END IF
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 2a. Documentation-Only Early Exit
|
|
83
|
+
|
|
84
|
+
When only documentation files (`.md`, `.mdx`, or files in `docs/`) were modified, skip template generation and post a confirmation comment instead.
|
|
85
|
+
|
|
86
|
+
**Detection criteria - ALL of these must be true:**
|
|
87
|
+
- `git diff main...HEAD --name-only` returns files
|
|
88
|
+
- All changed files match: `*.md`, `*.mdx`, or `docs/*`
|
|
89
|
+
|
|
90
|
+
**Early exit action:**
|
|
91
|
+
|
|
92
|
+
1. **Post confirmation comment to GitHub issue:**
|
|
93
|
+
```bash
|
|
94
|
+
gh issue comment <issue-number> --body "$(cat <<'EOF'
|
|
95
|
+
## Documentation Review Complete
|
|
96
|
+
|
|
97
|
+
This issue contains **documentation-only changes**. No additional documentation generation required.
|
|
98
|
+
|
|
99
|
+
### Files Modified:
|
|
100
|
+
[List of changed .md/.mdx/docs/ files]
|
|
101
|
+
|
|
102
|
+
### Status:
|
|
103
|
+
✅ Documentation changes are ready for review and merge.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
Ready to merge!
|
|
107
|
+
EOF
|
|
108
|
+
)"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
2. **Exit without generating template documentation.**
|
|
112
|
+
|
|
113
|
+
**Skip to end of workflow** - do not proceed to Section 2 (Auto-Detect Documentation Type) or beyond.
|
|
114
|
+
|
|
65
115
|
### 2. Auto-Detect Documentation Type
|
|
66
116
|
|
|
67
117
|
Determine documentation type based on changed files:
|
|
@@ -72,25 +122,45 @@ Determine documentation type based on changed files:
|
|
|
72
122
|
- Files in `lib/admin/`
|
|
73
123
|
- Admin-related API routes
|
|
74
124
|
|
|
75
|
-
**
|
|
76
|
-
- Files in `
|
|
77
|
-
-
|
|
78
|
-
-
|
|
125
|
+
**Developer Tool Documentation** (`docs/features/`):
|
|
126
|
+
- Files in `src/commands/`, `bin/`, `src/mcp/`
|
|
127
|
+
- CLI commands, MCP tools, scripts
|
|
128
|
+
- Configuration options, SDK integrations
|
|
129
|
+
|
|
130
|
+
**Infra / Scaffold Documentation** (`docs/features/`):
|
|
131
|
+
- Root config files (`package.json`, `*.config.{ts,js,mjs,cts,cjs,mts}`)
|
|
132
|
+
- TypeScript / JavaScript project config (`tsconfig.json`, `jsconfig.json`)
|
|
133
|
+
- Environment templates (`.env.example`)
|
|
134
|
+
- Next.js layout/page files (`src/app/**/layout.tsx`, `src/app/**/page.tsx`)
|
|
135
|
+
- Middleware (`src/middleware.ts`)
|
|
136
|
+
- Framework config (`payload.config.*`, `drizzle.config.*`, `next.config.*`, `vite.config.*`, `vitest.config.*`)
|
|
137
|
+
|
|
138
|
+
Everything else (user-facing pages, non-admin components, public-facing features) falls through to the default `developer-tool` template.
|
|
79
139
|
|
|
80
140
|
**Decision Logic:**
|
|
81
141
|
```
|
|
82
142
|
IF any file path contains "/admin/" THEN
|
|
83
143
|
type = "admin"
|
|
84
144
|
output_dir = "docs/admin/"
|
|
145
|
+
template = "admin" (Section 3a)
|
|
146
|
+
ELSE IF any file path matches "src/commands/|bin/|src/mcp/|scripts/" THEN
|
|
147
|
+
type = "developer-tool"
|
|
148
|
+
output_dir = "docs/features/"
|
|
149
|
+
template = "developer-tool" (Section 3b)
|
|
150
|
+
ELSE IF any file path matches "package\.json$|.*\.config\.(ts|js|mjs|cts|cjs|mts)$|(ts|js)config\.json$|\.env\.example$|^src/app/.*(layout|page)\.tsx$|^src/middleware\.ts$|^(payload|drizzle|next|vite|vitest)\.config\." THEN
|
|
151
|
+
type = "developer-tool"
|
|
152
|
+
output_dir = "docs/features/"
|
|
153
|
+
template = "developer-tool" (Section 3b)
|
|
85
154
|
ELSE
|
|
86
|
-
type = "
|
|
155
|
+
type = "developer-tool"
|
|
87
156
|
output_dir = "docs/features/"
|
|
157
|
+
template = "developer-tool" (Section 3b)
|
|
88
158
|
END IF
|
|
89
159
|
```
|
|
90
160
|
|
|
91
|
-
###
|
|
161
|
+
### 3a. Admin/UI Documentation Template
|
|
92
162
|
|
|
93
|
-
|
|
163
|
+
Use this template for admin pages and UI features:
|
|
94
164
|
|
|
95
165
|
```markdown
|
|
96
166
|
# [Feature Name]
|
|
@@ -130,11 +200,6 @@ Generate documentation using this template:
|
|
|
130
200
|
2. [Step 2]
|
|
131
201
|
3. [Step 3]
|
|
132
202
|
|
|
133
|
-
### [Workflow 2: e.g., "Bulk Edit Multiple Items"]
|
|
134
|
-
|
|
135
|
-
1. [Step 1]
|
|
136
|
-
2. [Step 2]
|
|
137
|
-
|
|
138
203
|
## Troubleshooting
|
|
139
204
|
|
|
140
205
|
### [Common Issue 1]
|
|
@@ -143,20 +208,69 @@ Generate documentation using this template:
|
|
|
143
208
|
|
|
144
209
|
**Solution:** [How to fix it]
|
|
145
210
|
|
|
146
|
-
|
|
211
|
+
---
|
|
147
212
|
|
|
148
|
-
|
|
213
|
+
*Generated for Issue #[number] on [date]*
|
|
214
|
+
```
|
|
149
215
|
|
|
150
|
-
|
|
216
|
+
### 3b. Developer Tool Documentation Template
|
|
217
|
+
|
|
218
|
+
Use this template for CLI commands, MCP tools, scripts, and developer-facing features. Structure around the user's journey, not the API surface.
|
|
219
|
+
|
|
220
|
+
```markdown
|
|
221
|
+
# [Feature Name]
|
|
222
|
+
|
|
223
|
+
[1-2 sentence summary: what it does and why you'd use it.]
|
|
224
|
+
|
|
225
|
+
## Prerequisites
|
|
226
|
+
|
|
227
|
+
[Everything needed before this works. Be exhaustive — list tools, auth, config. Include verification commands.]
|
|
228
|
+
|
|
229
|
+
1. **[Requirement 1]** — `verification command`
|
|
230
|
+
2. **[Requirement 2]** — `verification command`
|
|
231
|
+
|
|
232
|
+
## Setup
|
|
233
|
+
|
|
234
|
+
[Step-by-step to go from zero to working. If setup differs per environment/client/platform, show each separately with clear labels.]
|
|
235
|
+
|
|
236
|
+
## What You Can Do
|
|
237
|
+
|
|
238
|
+
[Real examples of usage in natural language or command form. Show the most common actions first.]
|
|
239
|
+
|
|
240
|
+
## What to Expect
|
|
241
|
+
|
|
242
|
+
[Set expectations: how long things take, what output looks like, where results go. Address "it looks like nothing is happening" if applicable.]
|
|
243
|
+
|
|
244
|
+
## [Command/Tool] Reference
|
|
245
|
+
|
|
246
|
+
[Parameter tables, flags, options. Put this AFTER the narrative sections — users need context before reference.]
|
|
247
|
+
|
|
248
|
+
| Parameter | Type | Required | Default | Description |
|
|
249
|
+
|-----------|------|----------|---------|-------------|
|
|
250
|
+
|
|
251
|
+
## Troubleshooting
|
|
252
|
+
|
|
253
|
+
[Real failure scenarios users will hit. Lead with what they see, then the fix.]
|
|
254
|
+
|
|
255
|
+
### [Problem user sees]
|
|
256
|
+
|
|
257
|
+
[Cause and solution]
|
|
151
258
|
|
|
152
259
|
---
|
|
153
260
|
|
|
154
261
|
*Generated for Issue #[number] on [date]*
|
|
155
262
|
```
|
|
156
263
|
|
|
264
|
+
**Key differences from admin template:**
|
|
265
|
+
- No "Access / URL / Menu / Permissions" section (not applicable to CLI tools)
|
|
266
|
+
- Prerequisites section is mandatory (CLI tools have more dependencies)
|
|
267
|
+
- "What to Expect" section addresses timing, output location, async behavior
|
|
268
|
+
- Setup may vary per environment — show each variant
|
|
269
|
+
- Reference tables come after narrative, not before
|
|
270
|
+
|
|
157
271
|
### 4. Content Guidelines
|
|
158
272
|
|
|
159
|
-
**
|
|
273
|
+
**For admin/UI features — focus on operational usage:**
|
|
160
274
|
|
|
161
275
|
- "Click the 'Approve' button to publish the item"
|
|
162
276
|
- NOT: "The `approveItem` function updates the database"
|
|
@@ -164,16 +278,19 @@ Generate documentation using this template:
|
|
|
164
278
|
- "Wait for the green success message"
|
|
165
279
|
- NOT: "The API returns a 200 status code"
|
|
166
280
|
|
|
281
|
+
**For developer tools — focus on the user's journey:**
|
|
282
|
+
|
|
283
|
+
- "Run `sequant serve` to start the MCP server"
|
|
284
|
+
- NOT: "The `serveCommand` function creates an MCP server instance"
|
|
285
|
+
|
|
286
|
+
- "This takes 10–20 minutes. Your editor will appear idle — that's normal."
|
|
287
|
+
- NOT: "The tool uses `spawnSync` with a 30-minute timeout"
|
|
288
|
+
|
|
167
289
|
**Be specific and actionable:**
|
|
168
290
|
|
|
169
291
|
- "Navigate to Admin → Items → Review Queue"
|
|
170
292
|
- NOT: "Go to the review page"
|
|
171
293
|
|
|
172
|
-
**Include visual cues when relevant:**
|
|
173
|
-
|
|
174
|
-
- "Look for the blue 'Edit' icon next to each row"
|
|
175
|
-
- NOT: "Click the edit button"
|
|
176
|
-
|
|
177
294
|
**Document common workflows end-to-end:**
|
|
178
295
|
|
|
179
296
|
- "To approve an item: 1. Open Review Queue, 2. Click item name, 3. Review details, 4. Click Approve"
|
|
@@ -239,6 +356,8 @@ Before completing, verify:
|
|
|
239
356
|
- [ ] Correct folder (`docs/admin/` vs `docs/features/`)
|
|
240
357
|
- [ ] Summary comment posted to issue
|
|
241
358
|
|
|
359
|
+
**Note:** For documentation-only issues (detected in Step 4), skip this checklist and use the simplified confirmation comment from Section 2a instead.
|
|
360
|
+
|
|
242
361
|
## Workflow Integration
|
|
243
362
|
|
|
244
363
|
The `/docs` command is the final step before merging:
|
|
@@ -27,8 +27,8 @@ allowed-tools:
|
|
|
27
27
|
- Bash(git push:*)
|
|
28
28
|
- Bash(git worktree:*)
|
|
29
29
|
# Worktree management
|
|
30
|
-
- Bash(./scripts/
|
|
31
|
-
- Bash(./scripts/
|
|
30
|
+
- Bash(./scripts/new-feature.sh:*)
|
|
31
|
+
- Bash(./scripts/cleanup-worktree.sh:*)
|
|
32
32
|
# GitHub CLI
|
|
33
33
|
- Bash(gh issue view:*)
|
|
34
34
|
- Bash(gh issue comment:*)
|
|
@@ -273,7 +273,7 @@ When worktree creation is needed (standalone mode, no existing worktree):
|
|
|
273
273
|
1. **Start worktree creation as background task:**
|
|
274
274
|
```bash
|
|
275
275
|
# From main repo, start worktree creation in background
|
|
276
|
-
./scripts/
|
|
276
|
+
./scripts/new-feature.sh <issue-number> &
|
|
277
277
|
WORKTREE_PID=$!
|
|
278
278
|
echo "Worktree creation started (PID: $WORKTREE_PID)"
|
|
279
279
|
```
|
|
@@ -461,8 +461,8 @@ echo "Current branch: $CURRENT_BRANCH"
|
|
|
461
461
|
|
|
462
462
|
**If on main/master branch:**
|
|
463
463
|
1. **STOP** - Do not implement directly on main
|
|
464
|
-
2. Create a feature worktree first: `./scripts/
|
|
465
|
-
- For custom base branch: `./scripts/
|
|
464
|
+
2. Create a feature worktree first: `./scripts/new-feature.sh <issue-number>`
|
|
465
|
+
- For custom base branch: `./scripts/new-feature.sh <issue-number> --base <branch>`
|
|
466
466
|
3. Navigate to the worktree before making any changes
|
|
467
467
|
|
|
468
468
|
**Why this matters:** Work done directly on main can be lost during sync operations (git reset, git pull --rebase, etc.). Worktrees provide isolation and safe recovery through branches.
|
|
@@ -484,9 +484,9 @@ echo "Current branch: $CURRENT_BRANCH"
|
|
|
484
484
|
```bash
|
|
485
485
|
# Step 1: Start worktree creation in background
|
|
486
486
|
# For default (main) base:
|
|
487
|
-
./scripts/
|
|
487
|
+
./scripts/new-feature.sh <issue-number> &
|
|
488
488
|
# For custom base branch (e.g., feature integration branch):
|
|
489
|
-
./scripts/
|
|
489
|
+
./scripts/new-feature.sh <issue-number> --base feature/dashboard &
|
|
490
490
|
WORKTREE_PID=$!
|
|
491
491
|
|
|
492
492
|
# Step 2: Gather context while worktree creates (see Section 2)
|
|
@@ -517,7 +517,7 @@ echo "Current branch: $CURRENT_BRANCH"
|
|
|
517
517
|
4. **After implementation is complete:**
|
|
518
518
|
- Push the branch: `git push -u origin feature/<branch-name>`
|
|
519
519
|
- Create PR (manually or via script)
|
|
520
|
-
- The worktree will be cleaned up after PR merge using `./scripts/
|
|
520
|
+
- The worktree will be cleaned up after PR merge using `./scripts/cleanup-worktree.sh <branch-name>`
|
|
521
521
|
|
|
522
522
|
**Important:** Always work in the worktree directory, not the main repository, once the worktree is created.
|
|
523
523
|
|
|
@@ -1536,6 +1536,8 @@ Look in the issue comments (especially from `/spec`) for:
|
|
|
1536
1536
|
|
|
1537
1537
|
2. **Determine model for each task:**
|
|
1538
1538
|
|
|
1539
|
+
<!-- Note: model param inert per anthropics/claude-code#43869; the parsing
|
|
1540
|
+
logic below reactivates automatically when the upstream fix ships. -->
|
|
1539
1541
|
Check for model annotations in the task line: `[model: haiku]` or `[model: sonnet]`
|
|
1540
1542
|
|
|
1541
1543
|
**Model Selection Priority:**
|
|
@@ -34,6 +34,9 @@ allowed-tools:
|
|
|
34
34
|
- Bash(git push:*)
|
|
35
35
|
- Bash(git worktree:*)
|
|
36
36
|
- Bash(./scripts/dev/*:*)
|
|
37
|
+
- Bash(./scripts/cleanup-worktree.sh:*)
|
|
38
|
+
- Bash(./scripts/new-feature.sh:*)
|
|
39
|
+
- Bash(./scripts/list-worktrees.sh:*)
|
|
37
40
|
---
|
|
38
41
|
|
|
39
42
|
# Full Solve Command
|
|
@@ -244,6 +247,29 @@ Before creating any files, check if they already exist:
|
|
|
244
247
|
|
|
245
248
|
**If work already exists:** Skip to the appropriate phase (e.g., if implementation is done, go to Phase 3 or 4).
|
|
246
249
|
|
|
250
|
+
### 0.3 Acquire Concurrency Lock (#625)
|
|
251
|
+
|
|
252
|
+
**Before invoking `/spec`**, claim the per-issue concurrency lock. This prevents a second session (another `/fullsolve`, an `npx sequant run`, or another `/fullsolve` in a different window) from racing on the same issue and producing zero-diff exec failures.
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
# Acquire lock for this issue. --skip-pid-check is required: the shell that
|
|
256
|
+
# runs this command exits immediately, so the lock's PID is dead by the time
|
|
257
|
+
# the next check runs. Stale recovery falls back to age-only (2h).
|
|
258
|
+
if ! npx sequant locks acquire <issue-number> \
|
|
259
|
+
--command="/fullsolve <issue-number>" \
|
|
260
|
+
--skip-pid-check; then
|
|
261
|
+
echo "❌ Another session is working on #<issue-number>. Run 'npx sequant locks list' for details."
|
|
262
|
+
echo " If you're sure the holder is dead, run: npx sequant locks clear <issue-number>"
|
|
263
|
+
exit 1
|
|
264
|
+
fi
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**Release contract:** Phase 5.5 releases the lock on the happy path. On ANY halt/abort branch (spec failure, exec exhausted, qa loop exhausted with AC_NOT_MET, unrecoverable error, stagnation halt), you MUST run `npx sequant locks release <issue-number> || true` **before** printing the halt message. The explicit release calls below cover the known branches; if you add a new abort path, add a release call there too.
|
|
268
|
+
|
|
269
|
+
**Backstop:** If a release is somehow missed, stale recovery clears the lock after 6h on the same host (`SEQUANT_SKILL_LOCK_TTL_MS` overrides). The user can also force-clear via `npx sequant locks clear <issue-number>`.
|
|
270
|
+
|
|
271
|
+
**Orchestrator/MCP mode:** When `SEQUANT_ORCHESTRATOR` is set, `locks acquire` and `locks release` are no-ops (exit 0, no file touched). Safe to call unconditionally.
|
|
272
|
+
|
|
247
273
|
## Phase 1: Planning (SPEC)
|
|
248
274
|
|
|
249
275
|
**Invoke the `/spec` skill** to plan implementation and extract acceptance criteria.
|
|
@@ -284,8 +310,14 @@ After `/spec` completes, extract and store:
|
|
|
284
310
|
If `/spec` fails:
|
|
285
311
|
- Check if issue exists and is readable
|
|
286
312
|
- Verify GitHub CLI authentication
|
|
313
|
+
- **Release the lock acquired in Phase 0.3** (so the user can retry without hitting the orphan window)
|
|
287
314
|
- Report failure and exit workflow
|
|
288
315
|
|
|
316
|
+
```bash
|
|
317
|
+
# Release before halting — see Phase 0.3 release contract.
|
|
318
|
+
npx sequant locks release <issue-number> || true
|
|
319
|
+
```
|
|
320
|
+
|
|
289
321
|
```markdown
|
|
290
322
|
## Spec Failed
|
|
291
323
|
|
|
@@ -355,6 +387,11 @@ while exec_iteration < MAX_EXEC_ITERATIONS:
|
|
|
355
387
|
```
|
|
356
388
|
|
|
357
389
|
**If all iterations exhausted:**
|
|
390
|
+
```bash
|
|
391
|
+
# Release before halting — see Phase 0.3 release contract.
|
|
392
|
+
npx sequant locks release <issue-number> || true
|
|
393
|
+
```
|
|
394
|
+
|
|
358
395
|
```markdown
|
|
359
396
|
## Exec Failed
|
|
360
397
|
|
|
@@ -446,7 +483,7 @@ while test_iteration < MAX_TEST_ITERATIONS:
|
|
|
446
483
|
break
|
|
447
484
|
|
|
448
485
|
# Use /loop to fix failures
|
|
449
|
-
Skill(skill: "loop", args: "<issue-number> --phase test")
|
|
486
|
+
Skill(skill: "sequant:loop", args: "<issue-number> --phase test")
|
|
450
487
|
test_iteration += 1
|
|
451
488
|
```
|
|
452
489
|
|
|
@@ -504,11 +541,29 @@ When `/qa` detects `SEQUANT_ORCHESTRATOR`, it:
|
|
|
504
541
|
|
|
505
542
|
### 4.3 QA Loop (Max 2 iterations)
|
|
506
543
|
|
|
507
|
-
If verdict is not `READY_FOR_MERGE`, invoke `/loop` to fix and re-run QA
|
|
544
|
+
If verdict is not `READY_FOR_MERGE`, invoke `/loop` to fix and re-run QA.
|
|
545
|
+
|
|
546
|
+
**Stagnation gate (issue #581):** Before each `/qa` re-invocation after iteration 1, run the stagnation detector. If it reports `stagnant: true` with reason `SAME_SHA_NO_PROGRESS`, the prior `/loop` made no commit and produced no diff — re-running `/qa` would yield the same verdict. Halt the loop and surface a hard blocker instead of wasting another cycle.
|
|
547
|
+
|
|
548
|
+
```bash
|
|
549
|
+
# Run before each /qa call after iteration 0 (skip on first call):
|
|
550
|
+
npx tsx scripts/qa-stagnation.ts detect <issue-number>
|
|
551
|
+
# Output (JSON): {"stagnant": true|false, "reason"?: "SAME_SHA_NO_PROGRESS", "message": "...", ...}
|
|
552
|
+
# When stagnant === true: record telemetry, then halt — do NOT call /qa again.
|
|
553
|
+
npx tsx scripts/qa-stagnation.ts record <issue-number> <iteration> SAME_SHA_NO_PROGRESS --verdict=AC_NOT_MET
|
|
554
|
+
```
|
|
508
555
|
|
|
509
556
|
```
|
|
510
557
|
qa_iteration = 0
|
|
511
558
|
while qa_iteration < MAX_QA_ITERATIONS:
|
|
559
|
+
if qa_iteration > 0:
|
|
560
|
+
# Stagnation gate — same-SHA same-verdict cycles are wasted.
|
|
561
|
+
decision = `npx tsx scripts/qa-stagnation.ts detect <issue-number>`
|
|
562
|
+
if decision.stagnant == true:
|
|
563
|
+
`npx tsx scripts/qa-stagnation.ts record <issue-number> {qa_iteration} SAME_SHA_NO_PROGRESS --verdict=AC_NOT_MET`
|
|
564
|
+
# Halt — no progress since last QA. Skip to 4.4 with stagnation note.
|
|
565
|
+
break
|
|
566
|
+
|
|
512
567
|
result = Skill(skill: "qa", args: "<issue-number>")
|
|
513
568
|
|
|
514
569
|
if result.verdict == "READY_FOR_MERGE":
|
|
@@ -524,7 +579,7 @@ while qa_iteration < MAX_QA_ITERATIONS:
|
|
|
524
579
|
break
|
|
525
580
|
|
|
526
581
|
# Use /loop to fix issues (AC_NOT_MET)
|
|
527
|
-
Skill(skill: "loop", args: "<issue-number> --phase qa")
|
|
582
|
+
Skill(skill: "sequant:loop", args: "<issue-number> --phase qa")
|
|
528
583
|
qa_iteration += 1
|
|
529
584
|
```
|
|
530
585
|
|
|
@@ -615,7 +670,7 @@ Post completion comment to issue with:
|
|
|
615
670
|
gh pr merge <N> --squash
|
|
616
671
|
|
|
617
672
|
# 2. Clean up worktree (removes local worktree + branch)
|
|
618
|
-
./scripts/
|
|
673
|
+
./scripts/cleanup-worktree.sh feature/<issue-number>-*
|
|
619
674
|
|
|
620
675
|
# 3. Issue auto-closes if commit message contains "Fixes #N"
|
|
621
676
|
```
|
|
@@ -639,6 +694,16 @@ npx sequant doctor
|
|
|
639
694
|
|
|
640
695
|
If any command fails, fix immediately on main before continuing. This catches issues like ESM compatibility bugs that unit tests may miss.
|
|
641
696
|
|
|
697
|
+
### 5.5 Release Concurrency Lock (#625)
|
|
698
|
+
|
|
699
|
+
After the PR is created (or earlier if the workflow exits gracefully), release the lock so other sessions can claim it:
|
|
700
|
+
|
|
701
|
+
```bash
|
|
702
|
+
npx sequant locks release <issue-number> || true
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
`|| true` is intentional — release is idempotent; the lock may already have been cleared (orchestrator mode, age-based recovery, or manual `locks clear`). The exit code is informational only.
|
|
706
|
+
|
|
642
707
|
## Iteration Tracking
|
|
643
708
|
|
|
644
709
|
Track iterations to prevent infinite loops:
|
|
@@ -737,15 +802,24 @@ Ready for human review and merge.
|
|
|
737
802
|
|
|
738
803
|
## Error Recovery
|
|
739
804
|
|
|
805
|
+
**Concurrency lock cleanup (#625, applies to every abort path below):**
|
|
806
|
+
|
|
807
|
+
```bash
|
|
808
|
+
npx sequant locks release <issue-number> || true
|
|
809
|
+
```
|
|
810
|
+
|
|
811
|
+
Run this BEFORE printing the halt/exit message in any of the branches below. The release call is idempotent (no-op when nothing is held, no-op in orchestrator mode), so calling it unconditionally on every error path is safe.
|
|
812
|
+
|
|
740
813
|
**If spec fails:**
|
|
741
814
|
- Check issue exists and is readable
|
|
742
815
|
- Verify GitHub CLI authentication
|
|
816
|
+
- Release lock (see top of section)
|
|
743
817
|
- Exit with clear error
|
|
744
818
|
|
|
745
819
|
**If exec fails (build/test):**
|
|
746
820
|
- Check error logs
|
|
747
821
|
- Attempt targeted fix
|
|
748
|
-
- If persistent, document and exit
|
|
822
|
+
- If persistent: release lock, document, and exit
|
|
749
823
|
|
|
750
824
|
**If test loop exhausted:**
|
|
751
825
|
- Document remaining failures
|
|
@@ -169,6 +169,34 @@ mcp__context7__query-docs({
|
|
|
169
169
|
- Maintain type safety (no `any`)
|
|
170
170
|
- Don't delete or modify unrelated tests
|
|
171
171
|
|
|
172
|
+
### Step 5.5: No-Diff Guard (issue #581)
|
|
173
|
+
|
|
174
|
+
Before yielding back to `/qa`, verify Step 5 actually produced a diff. If neither HEAD nor the working tree (excluding `.sequant/` state writes) changed, the fix attempt was a silent no-op — re-running `/qa` would produce the same verdict at the same SHA. Halt with `LOOP_NO_DIFF` so the orchestrator escalates to manual intervention rather than wasting another QA cycle.
|
|
175
|
+
|
|
176
|
+
**Take a baseline snapshot at the START of Step 5:**
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
BEFORE_SNAPSHOT=$(npx tsx scripts/qa-stagnation.ts snapshot)
|
|
180
|
+
# JSON: {"sha": "<HEAD>", "dirty": ["<path>", ...]} — .sequant/ paths excluded
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
**Compare AFTER Step 5 completes (before Step 6 re-validates):**
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
AFTER_SNAPSHOT=$(npx tsx scripts/qa-stagnation.ts snapshot)
|
|
187
|
+
DECISION=$(npx tsx scripts/qa-stagnation.ts compare-snapshot "$BEFORE_SNAPSHOT" "$AFTER_SNAPSHOT")
|
|
188
|
+
# JSON: {"progressed": true|false, "reason"?: "LOOP_NO_DIFF", "message": "..."}
|
|
189
|
+
|
|
190
|
+
if [[ $(echo "$DECISION" | jq -r '.progressed') == "false" ]]; then
|
|
191
|
+
# Record stagnation telemetry; halt — manual intervention required.
|
|
192
|
+
npx tsx scripts/qa-stagnation.ts record <issue-number> <iteration> LOOP_NO_DIFF --verdict=NO_LOOP_PROGRESS || true
|
|
193
|
+
echo "ERROR: /loop made no commit and no working-tree changes (excluding .sequant/) — manual intervention required."
|
|
194
|
+
exit 1
|
|
195
|
+
fi
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
State-file writes (anything under `.sequant/`) are deliberately excluded from the dirty comparison — `recordStagnation` writes there itself, and per issue #581's open question those writes are not progress.
|
|
199
|
+
|
|
172
200
|
### Step 6: Re-run Validation
|
|
173
201
|
|
|
174
202
|
After fixes are applied, re-run the phase that found issues:
|