sequant 2.10.0 → 2.12.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.
Files changed (108) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +19 -2
  4. package/dist/bin/cli.js +47 -2
  5. package/dist/marketplace/external_plugins/sequant/.claude-plugin/plugin.json +1 -1
  6. package/dist/marketplace/external_plugins/sequant/.mcp.json +1 -1
  7. package/dist/marketplace/external_plugins/sequant/hooks/pre-tool.sh +331 -12
  8. package/dist/marketplace/external_plugins/sequant/skills/_shared/references/subagent-types.md +7 -18
  9. package/dist/marketplace/external_plugins/sequant/skills/assess/SKILL.md +5 -1
  10. package/dist/marketplace/external_plugins/sequant/skills/exec/SKILL.md +62 -8
  11. package/dist/marketplace/external_plugins/sequant/skills/fullsolve/SKILL.md +187 -28
  12. package/dist/marketplace/external_plugins/sequant/skills/loop/SKILL.md +127 -23
  13. package/dist/marketplace/external_plugins/sequant/skills/merger/SKILL.md +130 -13
  14. package/dist/marketplace/external_plugins/sequant/skills/qa/SKILL.md +306 -8
  15. package/dist/marketplace/external_plugins/sequant/skills/release/SKILL.md +79 -0
  16. package/dist/marketplace/external_plugins/sequant/skills/spec/SKILL.md +40 -20
  17. package/dist/marketplace/external_plugins/sequant/skills/spec/references/recommended-workflow.md +14 -1
  18. package/dist/marketplace/external_plugins/sequant/skills/test/SKILL.md +1 -1
  19. package/dist/marketplace/external_plugins/sequant/skills/testgen/SKILL.md +23 -6
  20. package/dist/src/commands/doctor.js +20 -18
  21. package/dist/src/commands/locks.d.ts +20 -1
  22. package/dist/src/commands/locks.js +206 -4
  23. package/dist/src/commands/ready.d.ts +6 -0
  24. package/dist/src/commands/ready.js +19 -1
  25. package/dist/src/commands/run-display.js +1 -0
  26. package/dist/src/commands/worktree.d.ts +31 -0
  27. package/dist/src/commands/worktree.js +95 -0
  28. package/dist/src/lib/ac-linter.js +26 -0
  29. package/dist/src/lib/ac-parser.d.ts +40 -0
  30. package/dist/src/lib/ac-parser.js +202 -16
  31. package/dist/src/lib/cli-flags.d.ts +23 -0
  32. package/dist/src/lib/cli-flags.js +43 -0
  33. package/dist/src/lib/cli-ui/run-renderer-types.d.ts +2 -0
  34. package/dist/src/lib/cli-ui/run-renderer.js +7 -1
  35. package/dist/src/lib/locks/checkout-lock.d.ts +193 -0
  36. package/dist/src/lib/locks/checkout-lock.js +389 -0
  37. package/dist/src/lib/locks/index.d.ts +6 -3
  38. package/dist/src/lib/locks/index.js +4 -2
  39. package/dist/src/lib/locks/lock-manager.d.ts +81 -1
  40. package/dist/src/lib/locks/lock-manager.js +230 -5
  41. package/dist/src/lib/locks/types.d.ts +72 -0
  42. package/dist/src/lib/locks/types.js +28 -0
  43. package/dist/src/lib/markdown-fence.d.ts +24 -0
  44. package/dist/src/lib/markdown-fence.js +51 -0
  45. package/dist/src/lib/mcp-config.d.ts +24 -0
  46. package/dist/src/lib/mcp-config.js +51 -0
  47. package/dist/src/lib/scope/analyzer.d.ts +4 -0
  48. package/dist/src/lib/scope/analyzer.js +7 -1
  49. package/dist/src/lib/settings.d.ts +111 -1
  50. package/dist/src/lib/settings.js +59 -0
  51. package/dist/src/lib/system.d.ts +7 -3
  52. package/dist/src/lib/system.js +7 -3
  53. package/dist/src/lib/test-tautology-detector.d.ts +4 -3
  54. package/dist/src/lib/test-tautology-detector.js +147 -40
  55. package/dist/src/lib/workflow/batch-executor.d.ts +20 -1
  56. package/dist/src/lib/workflow/batch-executor.js +154 -23
  57. package/dist/src/lib/workflow/config-resolver.d.ts +25 -0
  58. package/dist/src/lib/workflow/config-resolver.js +90 -0
  59. package/dist/src/lib/workflow/drivers/agent-driver.d.ts +22 -0
  60. package/dist/src/lib/workflow/drivers/claude-code.js +14 -3
  61. package/dist/src/lib/workflow/effort-escalation.d.ts +73 -0
  62. package/dist/src/lib/workflow/effort-escalation.js +82 -0
  63. package/dist/src/lib/workflow/error-classifier.d.ts +4 -1
  64. package/dist/src/lib/workflow/error-classifier.js +4 -0
  65. package/dist/src/lib/workflow/log-writer.d.ts +10 -1
  66. package/dist/src/lib/workflow/log-writer.js +20 -0
  67. package/dist/src/lib/workflow/metrics-schema.d.ts +49 -6
  68. package/dist/src/lib/workflow/metrics-schema.js +33 -0
  69. package/dist/src/lib/workflow/metrics-writer.d.ts +11 -0
  70. package/dist/src/lib/workflow/mutation-marker.d.ts +86 -0
  71. package/dist/src/lib/workflow/mutation-marker.js +97 -0
  72. package/dist/src/lib/workflow/phase-detection.d.ts +12 -0
  73. package/dist/src/lib/workflow/phase-detection.js +5 -1
  74. package/dist/src/lib/workflow/phase-executor.d.ts +17 -0
  75. package/dist/src/lib/workflow/phase-executor.js +60 -4
  76. package/dist/src/lib/workflow/qa-gaps-marker.d.ts +38 -0
  77. package/dist/src/lib/workflow/qa-gaps-marker.js +66 -0
  78. package/dist/src/lib/workflow/ready-gate.d.ts +53 -1
  79. package/dist/src/lib/workflow/ready-gate.js +105 -14
  80. package/dist/src/lib/workflow/run-log-schema.d.ts +175 -0
  81. package/dist/src/lib/workflow/run-log-schema.js +71 -1
  82. package/dist/src/lib/workflow/run-orchestrator.js +27 -0
  83. package/dist/src/lib/workflow/spec-recommendation.d.ts +71 -0
  84. package/dist/src/lib/workflow/spec-recommendation.js +142 -0
  85. package/dist/src/lib/workflow/state-schema.d.ts +5 -1
  86. package/dist/src/lib/workflow/state-schema.js +8 -1
  87. package/dist/src/lib/workflow/types.d.ts +78 -0
  88. package/dist/src/lib/workflow/worktree-manager.d.ts +8 -1
  89. package/dist/src/lib/workflow/worktree-manager.js +9 -1
  90. package/dist/src/lib/workflow/worktree-resolver.d.ts +73 -0
  91. package/dist/src/lib/workflow/worktree-resolver.js +126 -0
  92. package/package.json +4 -3
  93. package/templates/hooks/pre-tool.sh +331 -12
  94. package/templates/scripts/cleanup-worktree.sh +36 -15
  95. package/templates/scripts/new-feature.sh +25 -19
  96. package/templates/skills/_shared/references/subagent-types.md +7 -18
  97. package/templates/skills/assess/SKILL.md +5 -1
  98. package/templates/skills/exec/SKILL.md +62 -8
  99. package/templates/skills/fullsolve/SKILL.md +187 -28
  100. package/templates/skills/loop/SKILL.md +127 -23
  101. package/templates/skills/merger/SKILL.md +130 -13
  102. package/templates/skills/qa/SKILL.md +306 -8
  103. package/templates/skills/release/SKILL.md +79 -0
  104. package/templates/skills/spec/SKILL.md +40 -20
  105. package/templates/skills/spec/references/recommended-workflow.md +14 -1
  106. package/templates/skills/test/SKILL.md +1 -1
  107. package/templates/skills/testgen/SKILL.md +23 -6
  108. package/templates/agents/sequant-explorer.md +0 -24
@@ -3,7 +3,7 @@
3
3
  # Create a new feature worktree from a GitHub issue
4
4
  # Usage: ./scripts/new-feature.sh <issue-number> [--base <branch>] [--stash]
5
5
  # Example: ./scripts/new-feature.sh 4
6
- # Example: ./scripts/new-feature.sh 4 --stash # Auto-stash uncommitted changes
6
+ # Example: ./scripts/new-feature.sh 4 --stash # Deprecated no-op (kept for compatibility)
7
7
  # Example: ./scripts/new-feature.sh 4 --base feature/dashboard # Branch from feature branch
8
8
 
9
9
  set -e
@@ -108,18 +108,14 @@ echo -e "${BLUE}Base: ${BASE_BRANCH}${NC}"
108
108
  echo -e "${BLUE}Worktree: ${WORKTREE_DIR}${NC}"
109
109
  echo ""
110
110
 
111
- # Check for uncommitted changes before switching branches
112
- if ! git diff-index --quiet HEAD -- 2>/dev/null; then
113
- if [ "$STASH_FLAG" = true ]; then
114
- echo -e "${YELLOW}📦 Stashing uncommitted changes...${NC}"
115
- git stash push --include-untracked -m "WIP before issue #${ISSUE_NUMBER}"
116
- echo -e "${GREEN} Changes stashed successfully${NC}"
117
- else
118
- echo -e "${RED} Working tree has uncommitted changes${NC}"
119
- echo -e "${YELLOW} Use --stash to auto-stash, or manually:${NC}"
120
- echo -e " git stash push -m 'WIP before issue #${ISSUE_NUMBER}'"
121
- exit 1
122
- fi
111
+ # The main checkout is no longer switched or updated by this script (#910), so
112
+ # an uncommitted main working tree can no longer block or endanger worktree
113
+ # creation the worktree is branched directly off the fetched remote ref
114
+ # below, and `git fetch` / `git worktree add` both operate happily on a dirty
115
+ # main tree. `--stash` is therefore obsolete: still accepted for backward
116
+ # compatibility, but a no-op, since there is nothing to move out of the way.
117
+ if [ "$STASH_FLAG" = true ]; then
118
+ echo -e "${YELLOW}ℹ️ --stash is deprecated and now does nothing: new-feature.sh no longer touches the main checkout, so its uncommitted changes are left in place.${NC}"
123
119
  fi
124
120
 
125
121
  # Check if branch already exists
@@ -142,15 +138,25 @@ if git show-ref --verify --quiet "refs/heads/${BRANCH_NAME}"; then
142
138
  fi
143
139
  fi
144
140
 
145
- # Update base branch
146
- echo -e "${BLUE}📥 Updating ${BASE_BRANCH} branch...${NC}"
141
+ # Refresh the base branch's remote-tracking ref WITHOUT touching the main
142
+ # checkout. The old flow — `git checkout <base>` then `git pull` — switched the
143
+ # main checkout's branch and mutated its working tree, a global operation the
144
+ # #901 checkout lock exists to serialize. But the pre-tool guard inspects only
145
+ # the top-level Bash command the agent runs; that command is `new-feature.sh`,
146
+ # which carries no guarded git verb, so the inner `checkout`/`pull` sailed past
147
+ # the guard and a losing session could switch the holder's branch out from
148
+ # under it (#910). Reading the ref instead of checking it out closes the gap at
149
+ # its root: the main tree is never mutated, so no lock — and no guard — is
150
+ # needed here at all.
151
+ echo -e "${BLUE}📥 Fetching ${BASE_BRANCH} from origin...${NC}"
147
152
  git fetch origin "$BASE_BRANCH"
148
- git checkout "$BASE_BRANCH"
149
- git pull origin "$BASE_BRANCH"
150
153
 
151
- # Create worktree from base branch
154
+ # Branch the worktree directly off the freshly fetched remote ref.
155
+ # `git worktree add -b <new> <path> <start-point>` resolves <start-point>
156
+ # without changing the main checkout, and `origin/<base>` is exactly the
157
+ # up-to-date commit the old `checkout`+`pull` used to land on.
152
158
  echo -e "${BLUE}🌿 Creating new worktree from ${BASE_BRANCH}...${NC}"
153
- git worktree add "$WORKTREE_DIR" -b "$BRANCH_NAME"
159
+ git worktree add "$WORKTREE_DIR" -b "$BRANCH_NAME" "origin/${BASE_BRANCH}"
154
160
 
155
161
  # Record the base branch on the new branch so downstream tooling
156
162
  # (e.g. phase-executor zero-diff guard, see #537) can resolve the
@@ -15,7 +15,7 @@ Claude Code supports exactly **4 built-in subagent types**:
15
15
 
16
16
  ## Custom Agents (Sequant)
17
17
 
18
- Sequant defines **4 custom agents** in `.claude/agents/`. These centralize model, permissions, effort, and tool restrictions that were previously duplicated inline.
18
+ Sequant defines **3 custom agents** in `.claude/agents/`. These centralize model, permissions, effort, and tool restrictions that were previously duplicated inline.
19
19
 
20
20
  > **Upstream caveat:** `Model` values below are *declared* in the agent files but
21
21
  > currently ignored at runtime per anthropics/claude-code#43869 — every subagent
@@ -24,20 +24,10 @@ Sequant defines **4 custom agents** in `.claude/agents/`. These centralize model
24
24
 
25
25
  | Agent Name | Based On | Model (declared) | Permission Mode | Used By |
26
26
  |------------|----------|------------------|-----------------|---------|
27
- | `sequant-explorer` | Explore | haiku | (default) | `/spec` |
28
27
  | `sequant-qa-checker` | general-purpose | sonnet | bypassPermissions | `/qa` |
29
28
  | `sequant-implementer` | general-purpose | (inherits) | bypassPermissions | `/exec` |
30
29
  | `sequant-testgen` | general-purpose | haiku | (default) | `/testgen` |
31
30
 
32
- ### sequant-explorer
33
-
34
- Read-only codebase exploration for the `/spec` phase. No Bash, Edit, or Write access.
35
-
36
- ```
37
- Agent(subagent_type="sequant-explorer",
38
- prompt="Find similar features in components/. Report patterns.")
39
- ```
40
-
41
31
  ### sequant-qa-checker
42
32
 
43
33
  Quality check agent for the `/qa` phase. Has `bypassPermissions` for Bash access (git diff, npm test). Effort: low.
@@ -175,12 +165,11 @@ Agent(subagent_type="sequant-qa-checker",
175
165
  ```
176
166
 
177
167
  ### Context Gathering (via /spec)
168
+
169
+ `/spec` defaults to targeted inline `Read`/`Grep`, not an agent spawn. It escalates to a single `Explore` agent only for open-ended discovery:
178
170
  ```
179
- Agent(subagent_type="sequant-explorer",
171
+ Agent(subagent_type="Explore",
180
172
  prompt="Find similar features in components/. Report patterns.")
181
-
182
- Agent(subagent_type="sequant-explorer",
183
- prompt="Explore database schema for user tables. Report structure.")
184
173
  ```
185
174
 
186
175
  ### Background Execution (via /exec)
@@ -215,7 +204,7 @@ inline when spawning them.
215
204
  | Task | Recommended Agent | Why |
216
205
  |------|-------------------|-----|
217
206
  | Quality checks (git diff, npm test) | `sequant-qa-checker` | bypassPermissions + effort:low (declared model: sonnet, inert per #43869) |
218
- | Codebase exploration | `sequant-explorer` | Read-only, focused tools (declared model: haiku, inert per #43869) |
207
+ | Codebase exploration (open-ended only) | `Explore` | Read-only, built-in; `/spec` prefers inline Read/Grep by default |
219
208
  | Implementation subtask | `sequant-implementer` | Full access, inherits model |
220
209
  | Test stub generation | `sequant-testgen` | Write access, no Bash (declared model: haiku, inert per #43869) |
221
210
  | One-off custom task | `general-purpose` | Flexible, specify model/mode inline |
@@ -239,8 +228,8 @@ inline when spawning them.
239
228
  These types do **not exist** and will cause silent failures:
240
229
 
241
230
  - ~~`quality-checker`~~ → Use `sequant-qa-checker` or `general-purpose`
242
- - ~~`pattern-scout`~~ → Use `sequant-explorer` or `Explore`
243
- - ~~`schema-inspector`~~ → Use `sequant-explorer` or `Explore`
231
+ - ~~`pattern-scout`~~ → Use `Explore`
232
+ - ~~`schema-inspector`~~ → Use `Explore`
244
233
  - ~~`code-reviewer`~~ → Use `sequant-qa-checker` or `general-purpose`
245
234
  - ~~`implementation`~~ → Use `sequant-implementer` or `general-purpose`
246
235
 
@@ -6,6 +6,7 @@ metadata:
6
6
  author: sequant
7
7
  version: "3.0"
8
8
  allowed-tools:
9
+ - Bash(npx sequant worktree:*)
9
10
  - Read
10
11
  - Glob
11
12
  - Grep
@@ -99,7 +100,10 @@ gh issue view <N> --json title,body,labels,state,comments,assignees
99
100
 
100
101
  ```bash
101
102
  git branch -a | grep <N> || true
102
- git worktree list | grep <N> || true
103
+ # Resolve by branch, not by grepping the printed path (#899/#904) — a bare
104
+ # number match is cross-issue (89 matches 899-...) and keys on the directory
105
+ # slug, which can diverge from the branch after a rename.
106
+ npx sequant worktree resolve <N> || true
103
107
  gh pr list --search "<N> in:title" --json number,title,state,headRefName,mergeable || true
104
108
  ```
105
109
 
@@ -29,6 +29,7 @@ allowed-tools:
29
29
  # Worktree management
30
30
  - Bash(./scripts/new-feature.sh:*)
31
31
  - Bash(./scripts/cleanup-worktree.sh:*)
32
+ - Bash(npx sequant worktree:*)
32
33
  # GitHub CLI
33
34
  - Bash(gh issue view:*)
34
35
  - Bash(gh issue comment:*)
@@ -136,7 +137,7 @@ When running as part of an orchestrated workflow (e.g., `sequant run` or `/fulls
136
137
 
137
138
  1. **Skip pre-flight git checks** - The orchestrator has already verified git state
138
139
  2. **Skip worktree creation** - Orchestrator creates worktrees before invoking skills
139
- 3. **Use provided worktree path** - Work in `SEQUANT_WORKTREE` instead of creating a new one
140
+ 3. **Verify, then use, the provided path** - `SEQUANT_WORKTREE` is authoritative *when valid*, but it is never trusted unchecked: run the existence guard in "Feature Worktree Workflow" below and halt if it fails (#899)
140
141
  4. **Reduce GitHub comment frequency** - Defer progress updates to the orchestrator
141
142
  5. **Trust issue context** - The orchestrator has already fetched and validated issue data
142
143
 
@@ -472,15 +473,68 @@ echo "Current branch: $CURRENT_BRANCH"
472
473
  **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.
473
474
 
474
475
  **If orchestrated (SEQUANT_WORKTREE is set):**
475
- - Use the provided worktree path directly: `cd $SEQUANT_WORKTREE`
476
- - Skip steps 1-2 below (worktree already created by orchestrator)
477
- - Continue with step 3 (Work in the worktree)
476
+
477
+ <!-- BEGIN: worktree-existence-guard (#899) -->
478
+
479
+ **Verify the path before you use it. Never `cd` into it unchecked.** An
480
+ orchestrator can hand over a path that was never created, or one that resolves
481
+ into a *different repository's* worktree — `../worktrees/` is one flat
482
+ namespace shared by every repo under the same parent, and issue numbers are
483
+ per-repo. A bare `cd` fails silently and leaves you implementing in the main
484
+ checkout, on whatever branch it happens to be on.
485
+
486
+ ```bash
487
+ npx sequant worktree verify "$SEQUANT_WORKTREE" --issue <issue-number> || {
488
+ echo "❌ HALT: SEQUANT_WORKTREE is not a usable worktree of this repository."
489
+ exit 1
490
+ }
491
+ cd "$SEQUANT_WORKTREE"
492
+ ```
493
+
494
+ `verify` exits non-zero with one of these named errors. **Every one of them is
495
+ a halt** — report it and stop; do not fall back to creating a worktree, and do
496
+ not continue in the current directory:
497
+
498
+ | Error | Meaning |
499
+ |-------|---------|
500
+ | `SEQUANT_WORKTREE_NOT_FOUND` | Path is empty, an unexpanded glob, or not an existing directory |
501
+ | `SEQUANT_WORKTREE_FOREIGN` | Real directory, but not a worktree of *this* repository (another project's, or stale) |
502
+ | `SEQUANT_WORKTREE_ISSUE_MISMATCH` | A worktree of this repo, but its branch belongs to a different issue |
503
+
504
+ Once verify passes, skip steps 1-2 below and continue with step 3 (Work in the
505
+ worktree).
506
+
507
+ <!-- END: worktree-existence-guard (#899) -->
478
508
 
479
509
  **If standalone:**
480
510
 
481
- 1. **Check if worktree already exists:**
482
- - Check if you're already in a worktree: `git worktree list` or check if `../worktrees/` contains a directory for this issue
483
- - If worktree exists, navigate to it and continue work there
511
+ <!-- BEGIN: worktree-standalone-lookup (#899) -->
512
+
513
+ 1. **Check if a worktree already exists for this issue:**
514
+
515
+ Resolve through git, not the filesystem. `sequant worktree resolve` reads
516
+ `git worktree list` in the current repository — which reports only *this*
517
+ repo's worktrees — and selects on the **branch** git reports, not on the
518
+ directory name. That matters twice over: a directory slug is shared across
519
+ repositories, and it can drift from its own branch after a rename
520
+ (`578-seo-expand-city-coverage` holding branch `feature/578-city-expansion-clean`),
521
+ so a name match proves nothing about which branch you would land on.
522
+
523
+ ```bash
524
+ if WORKTREE="$(npx sequant worktree resolve <issue-number>)"; then
525
+ echo "Existing worktree: $WORKTREE"
526
+ cd "$WORKTREE"
527
+ # Continue work there — skip step 2.
528
+ else
529
+ echo "No worktree for #<issue-number> in this repository — create one (step 2)."
530
+ fi
531
+ ```
532
+
533
+ **Do not glob `../worktrees/feature/<issue-number>-*` to find it.** That
534
+ directory is shared by every sibling repository, so the match may belong to
535
+ another project entirely.
536
+
537
+ <!-- END: worktree-standalone-lookup (#899) -->
484
538
 
485
539
  2. **Create worktree if needed (with parallel context gathering):**
486
540
 
@@ -1901,7 +1955,7 @@ The goal is to satisfy AC with the smallest, safest change possible.
1901
1955
  ### 6. Progress Summary and Draft Issue Update
1902
1956
 
1903
1957
  **If orchestrated (SEQUANT_ORCHESTRATOR is set):**
1904
- - Skip posting progress comments to GitHub (orchestrator handles summary)
1958
+ - Skip posting progress comments to GitHub no per-phase comment is posted under `sequant run`; progress surfaces through the run summary and the PR body (#964)
1905
1959
  - Still provide AC coverage summary in output for orchestrator to capture
1906
1960
  - Let orchestrator handle final GitHub update
1907
1961