sequant 1.5.5 → 1.6.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/README.md +104 -330
- package/dist/bin/cli.js +0 -0
- package/dist/src/commands/run.js +12 -2
- package/package.json +1 -1
- package/templates/hooks/pre-tool.sh +104 -13
package/README.md
CHANGED
|
@@ -1,410 +1,184 @@
|
|
|
1
1
|
# Sequant
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**Workflow automation for [Claude Code](https://claude.ai/code).**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Solve GitHub issues with structured phases and quality gates — from issue to merge-ready PR.
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/sequant)
|
|
8
8
|
[](https://opensource.org/licenses/MIT)
|
|
9
9
|
|
|
10
|
-
## Why Sequant?
|
|
11
|
-
|
|
12
|
-
When using AI coding assistants, work can become scattered and quality inconsistent. Sequant solves this by:
|
|
13
|
-
|
|
14
|
-
- **Consistent quality** — Every issue goes through the same review gates
|
|
15
|
-
- **Traceable decisions** — Plans and progress documented in GitHub issues
|
|
16
|
-
- **Isolated work** — Git worktrees prevent half-finished features from polluting main
|
|
17
|
-
- **AI-assisted** — Claude Code handles implementation while you review and approve
|
|
18
|
-
|
|
19
|
-
## How It Works
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
|
|
23
|
-
│ /spec │───▶│ /exec │───▶│ /test │───▶│ /qa │───▶ Merge
|
|
24
|
-
└─────────┘ └─────────┘ └─────────┘ └─────────┘
|
|
25
|
-
│ │ │ │
|
|
26
|
-
▼ ▼ ▼ ▼
|
|
27
|
-
Plan Build Verify Review
|
|
28
|
-
(drafts AC) (worktree) (optional) (vs criteria)
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
1. **`/spec`** — Reads issue, drafts implementation plan, posts to GitHub for your approval
|
|
32
|
-
2. **`/exec`** — Creates isolated git worktree, implements changes, runs tests
|
|
33
|
-
3. **`/test`** — Optional browser/CLI verification
|
|
34
|
-
4. **`/qa`** — Reviews code against acceptance criteria, suggests fixes
|
|
35
|
-
|
|
36
10
|
## Quick Start
|
|
37
11
|
|
|
38
|
-
### Prerequisites
|
|
39
|
-
|
|
40
|
-
| Requirement | Check Command | Notes |
|
|
41
|
-
|------------|---------------|-------|
|
|
42
|
-
| [Claude Code](https://claude.ai/code) | `claude --version` | Required |
|
|
43
|
-
| [GitHub CLI](https://cli.github.com/) | `gh auth status` | Required, must be authenticated |
|
|
44
|
-
| Node.js 18+ | `node --version` | Required |
|
|
45
|
-
| Git | `git --version` | Required |
|
|
46
|
-
| [jq](https://jqlang.github.io/jq/) | `jq --version` | Optional, improves hook performance |
|
|
47
|
-
|
|
48
|
-
> **Note:** Sequant currently requires GitHub for issue tracking. GitLab and Bitbucket support is planned for a future release. See [Platform Requirements](docs/platform-requirements.md) for workarounds if you use a different platform.
|
|
49
|
-
|
|
50
|
-
### Setup
|
|
51
|
-
|
|
52
12
|
```bash
|
|
53
|
-
#
|
|
13
|
+
# In your project directory
|
|
54
14
|
npx sequant init
|
|
55
|
-
|
|
56
|
-
# Verify installation and prerequisites
|
|
57
|
-
npx sequant doctor
|
|
15
|
+
npx sequant doctor # Verify setup
|
|
58
16
|
```
|
|
59
17
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
### First Workflow
|
|
18
|
+
Then in Claude Code:
|
|
63
19
|
|
|
64
|
-
Open Claude Code in your project, then:
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
/spec 123 # Plan implementation for GitHub issue #123
|
|
68
|
-
/exec 123 # Implement the feature in a worktree
|
|
69
|
-
/qa 123 # Quality review before merge
|
|
70
20
|
```
|
|
71
|
-
|
|
72
|
-
> Replace `123` with an actual GitHub issue number from your repository.
|
|
73
|
-
|
|
74
|
-
## Installation
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
npm install -g sequant
|
|
78
|
-
# or use npx
|
|
79
|
-
npx sequant init
|
|
21
|
+
/fullsolve 123 # Solve issue #123 end-to-end
|
|
80
22
|
```
|
|
81
23
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
- **🔢 Quantized** - Each issue is an atomic unit of work
|
|
85
|
-
- **🔄 Sequential** - Phases execute in order with gates
|
|
86
|
-
- **🚦 Gated** - Quality checks before progression
|
|
87
|
-
- **🌳 Isolated** - Git worktrees prevent cross-contamination
|
|
88
|
-
- **📦 Stack Adapters** - Pre-configured for Next.js, Rust, Python, Go
|
|
89
|
-
- **🔄 Update-Safe** - Customize without losing updates
|
|
24
|
+
Or step-by-step:
|
|
90
25
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|------------|--------|---------|---------|
|
|
97
|
-
| [Chrome DevTools](https://github.com/anthropics/anthropic-quickstarts/tree/main/mcp-chrome-devtools) | `/test`, `/testgen`, `/loop` | Browser automation for UI testing | See [setup guide](https://github.com/anthropics/anthropic-quickstarts/tree/main/mcp-chrome-devtools#setup) |
|
|
98
|
-
| [Context7](https://github.com/upstash/context7) | `/exec`, `/fullsolve` | External library documentation lookup | `npx -y @anthropic/mcp-cli add upstash/context7` |
|
|
99
|
-
| [Sequential Thinking](https://github.com/anthropics/anthropic-quickstarts/tree/main/mcp-sequential-thinking) | `/fullsolve` | Complex multi-step reasoning | See [setup guide](https://github.com/anthropics/anthropic-quickstarts/tree/main/mcp-sequential-thinking#setup) |
|
|
100
|
-
|
|
101
|
-
**What happens without MCPs:**
|
|
102
|
-
- `/test` and `/testgen` fall back to manual testing instructions
|
|
103
|
-
- `/exec` uses codebase search instead of library docs lookup
|
|
104
|
-
- `/fullsolve` uses standard reasoning (no extended thinking)
|
|
26
|
+
```
|
|
27
|
+
/spec 123 # Plan implementation
|
|
28
|
+
/exec 123 # Build in isolated worktree
|
|
29
|
+
/qa 123 # Review before merge
|
|
30
|
+
```
|
|
105
31
|
|
|
106
|
-
|
|
32
|
+
### Prerequisites
|
|
107
33
|
|
|
108
|
-
|
|
34
|
+
- [Claude Code](https://claude.ai/code) — AI coding assistant
|
|
35
|
+
- [GitHub CLI](https://cli.github.com/) — run `gh auth login`
|
|
36
|
+
- Node.js 18+ and Git
|
|
109
37
|
|
|
110
|
-
|
|
38
|
+
---
|
|
111
39
|
|
|
112
|
-
|
|
113
|
-
npx sequant init # Initialize in your project
|
|
114
|
-
npx sequant update # Update templates from package
|
|
115
|
-
npx sequant doctor # Check installation health
|
|
116
|
-
npx sequant status # Show version and config
|
|
117
|
-
npx sequant run <issues...> # Execute workflow for issues
|
|
118
|
-
```
|
|
40
|
+
## How It Works
|
|
119
41
|
|
|
120
|
-
|
|
42
|
+
Sequant adds slash commands to Claude Code that enforce a structured workflow:
|
|
121
43
|
|
|
122
|
-
```bash
|
|
123
|
-
npx sequant run 123 # Single issue
|
|
124
|
-
npx sequant run 1 2 3 # Multiple issues in parallel
|
|
125
|
-
npx sequant run 1 2 3 --sequential # Run in order
|
|
126
|
-
npx sequant run 123 --phases spec,qa # Custom phases
|
|
127
|
-
npx sequant run 123 --quality-loop # Auto-retry on failures
|
|
128
|
-
npx sequant run 123 --dry-run # Preview without execution
|
|
129
44
|
```
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
npx sequant run 123 --quality-loop # Enable for any issue
|
|
137
|
-
npx sequant run 123 --quality-loop --max-iterations 5 # Custom limit
|
|
45
|
+
┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
|
|
46
|
+
│ /spec │───▶│ /exec │───▶│ /test │───▶│ /qa │───▶ Merge
|
|
47
|
+
└─────────┘ └─────────┘ └─────────┘ └─────────┘
|
|
48
|
+
│ │ │ │
|
|
49
|
+
▼ ▼ ▼ ▼
|
|
50
|
+
Plan Build Verify (UI) Review
|
|
138
51
|
```
|
|
139
52
|
|
|
140
|
-
|
|
141
|
-
1. Runs phases normally (spec → exec → qa)
|
|
142
|
-
2. If a phase fails, runs `/loop` to fix issues
|
|
143
|
-
3. Re-runs failed phases after fixes
|
|
144
|
-
4. Iterates up to 3 times (default)
|
|
145
|
-
|
|
146
|
-
**Smart defaults:** Quality loop auto-enables for issues with `complex`, `refactor`, `breaking`, or `major` labels—no flag needed.
|
|
53
|
+
> `/test` is optional — used for UI features when Chrome DevTools MCP is available.
|
|
147
54
|
|
|
148
|
-
|
|
55
|
+
### Quality Gates
|
|
149
56
|
|
|
150
|
-
|
|
57
|
+
Every `/qa` runs automated checks:
|
|
151
58
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
59
|
+
- **AC Adherence** — Code verified against acceptance criteria
|
|
60
|
+
- **Type Safety** — Detects `any`, `as any`, missing types
|
|
61
|
+
- **Security Scans** — OWASP-style vulnerability detection
|
|
62
|
+
- **Scope Analysis** — Flags changes outside issue scope
|
|
155
63
|
|
|
156
|
-
|
|
64
|
+
When checks fail, `/loop` automatically fixes and re-runs (up to 3x).
|
|
157
65
|
|
|
158
|
-
|
|
159
|
-
|--------|--------|-------|
|
|
160
|
-
| `bug`, `fix`, `hotfix`, `patch` | `exec → qa` | Skip spec for simple fixes |
|
|
161
|
-
| `docs`, `documentation`, `readme` | `exec → qa` | Skip spec for docs changes |
|
|
162
|
-
| `ui`, `frontend`, `admin`, `web`, `browser` | `spec → exec → test → qa` | Add browser testing |
|
|
163
|
-
| `complex`, `refactor`, `breaking`, `major` | (default phases) | Enable quality loop |
|
|
66
|
+
---
|
|
164
67
|
|
|
165
|
-
|
|
68
|
+
## Two Ways to Use
|
|
166
69
|
|
|
167
|
-
|
|
70
|
+
### Interactive (Claude Code)
|
|
168
71
|
|
|
169
|
-
|
|
170
|
-
## Recommended Workflow
|
|
72
|
+
Type commands directly in Claude Code chat:
|
|
171
73
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
74
|
+
```
|
|
75
|
+
/fullsolve 123 # Complete pipeline
|
|
76
|
+
/spec 123 → /exec → /qa # Step by step
|
|
175
77
|
```
|
|
176
78
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
```bash
|
|
180
|
-
# Phases auto-detected (default)
|
|
181
|
-
npx sequant run 123
|
|
182
|
-
|
|
183
|
-
# Explicit phases (skip auto-detection)
|
|
184
|
-
npx sequant run 123 --phases exec,qa
|
|
79
|
+
### Headless (CLI)
|
|
185
80
|
|
|
186
|
-
|
|
187
|
-
npx sequant run 123 --no-log
|
|
81
|
+
Run without Claude Code UI:
|
|
188
82
|
|
|
189
|
-
|
|
83
|
+
```bash
|
|
84
|
+
npx sequant run 123 # Single issue
|
|
85
|
+
npx sequant run 1 2 3 # Batch (parallel)
|
|
190
86
|
npx sequant run 123 --quality-loop
|
|
191
87
|
```
|
|
192
88
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
| Command | Phase | Purpose |
|
|
196
|
-
|---------|-------|---------|
|
|
197
|
-
| `/assess` | 0 | Issue triage and status assessment |
|
|
198
|
-
| `/spec` | 1 | Plan implementation vs acceptance criteria |
|
|
199
|
-
| `/exec` | 2 | Implement in feature worktree |
|
|
200
|
-
| `/test` | 2.5 | Browser-based UI testing (optional) |
|
|
201
|
-
| `/verify` | 2.5 | CLI/script verification (optional) |
|
|
202
|
-
| `/qa` | 3 | Code review and quality gate |
|
|
203
|
-
| `/docs` | 4 | Generate feature documentation |
|
|
204
|
-
| `/loop` | * | Fix iteration when tests fail |
|
|
205
|
-
| `/fullsolve` | 1-4 | Complete pipeline in one command |
|
|
89
|
+
---
|
|
206
90
|
|
|
207
|
-
##
|
|
208
|
-
|
|
209
|
-
| Platform | Status | Notes |
|
|
210
|
-
|----------|--------|-------|
|
|
211
|
-
| macOS | ✅ Tested | Full support with Claude Code, Cursor, VS Code |
|
|
212
|
-
| Linux | ✅ Supported | Bash required for shell scripts |
|
|
213
|
-
| Windows WSL | ✅ Supported | Use WSL2 with bash |
|
|
214
|
-
| Windows Native | ⚠️ Limited | CLI works, but shell scripts require WSL |
|
|
215
|
-
|
|
216
|
-
### Windows Users
|
|
217
|
-
|
|
218
|
-
**WSL is recommended** for the full Sequant experience on Windows. Here's why:
|
|
219
|
-
|
|
220
|
-
| Feature | Native Windows | Windows + WSL |
|
|
221
|
-
|---------|----------------|---------------|
|
|
222
|
-
| CLI commands (`init`, `doctor`, `status`) | ✅ Works | ✅ Works |
|
|
223
|
-
| Workflow hooks (pre-tool, post-tool) | ❌ Requires bash | ✅ Works |
|
|
224
|
-
| Shell scripts (`new-feature.sh`, etc.) | ❌ Requires bash | ✅ Works |
|
|
225
|
-
| Git worktree workflows | ✅ Works | ✅ Works |
|
|
226
|
-
|
|
227
|
-
**Quick WSL Setup:**
|
|
228
|
-
|
|
229
|
-
1. Install WSL (run in PowerShell as Administrator): `wsl --install`
|
|
230
|
-
2. Restart your computer when prompted
|
|
231
|
-
3. Open Ubuntu from Start menu and complete setup
|
|
232
|
-
4. Install Node.js: See [NodeSource distributions](https://github.com/nodesource/distributions)
|
|
233
|
-
5. Install GitHub CLI: `apt install gh` then `gh auth login`
|
|
234
|
-
6. Use Sequant: `npx sequant init`
|
|
235
|
-
|
|
236
|
-
For detailed instructions, see [Microsoft's WSL documentation](https://learn.microsoft.com/en-us/windows/wsl/install).
|
|
91
|
+
## Commands
|
|
237
92
|
|
|
238
|
-
###
|
|
93
|
+
### Core Workflow
|
|
239
94
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
-
|
|
95
|
+
| Command | Purpose |
|
|
96
|
+
|---------|---------|
|
|
97
|
+
| `/spec` | Plan implementation, draft acceptance criteria |
|
|
98
|
+
| `/exec` | Implement in isolated git worktree |
|
|
99
|
+
| `/test` | Browser-based UI testing (optional) |
|
|
100
|
+
| `/qa` | Code review and quality gate |
|
|
245
101
|
|
|
246
|
-
###
|
|
102
|
+
### Automation
|
|
247
103
|
|
|
248
|
-
|
|
|
249
|
-
|
|
250
|
-
|
|
|
251
|
-
|
|
|
252
|
-
|
|
|
104
|
+
| Command | Purpose |
|
|
105
|
+
|---------|---------|
|
|
106
|
+
| `/fullsolve` | Complete pipeline in one command |
|
|
107
|
+
| `/solve` | Recommend optimal workflow for issue |
|
|
108
|
+
| `/loop` | Fix iteration when checks fail |
|
|
253
109
|
|
|
254
|
-
|
|
110
|
+
### Integration
|
|
255
111
|
|
|
256
|
-
|
|
112
|
+
| Command | Purpose |
|
|
113
|
+
|---------|---------|
|
|
114
|
+
| `/merger` | Multi-issue integration and merge |
|
|
115
|
+
| `/testgen` | Generate test stubs from spec |
|
|
116
|
+
| `/verify` | CLI/script execution verification |
|
|
257
117
|
|
|
258
|
-
|
|
259
|
-
|-------|-----------|------|-------|------|
|
|
260
|
-
| Next.js | `next.config.*` | `npm test` | `npm run build` | `npm run lint` |
|
|
261
|
-
| Rust | `Cargo.toml` | `cargo test` | `cargo build --release` | `cargo clippy` |
|
|
262
|
-
| Python | `pyproject.toml` | `pytest` | `python -m build` | `ruff check .` |
|
|
263
|
-
| Go | `go.mod` | `go test ./...` | `go build ./...` | `golangci-lint run` |
|
|
118
|
+
### Utilities
|
|
264
119
|
|
|
265
|
-
|
|
120
|
+
| Command | Purpose |
|
|
121
|
+
|---------|---------|
|
|
122
|
+
| `/assess` | Issue triage and status assessment |
|
|
123
|
+
| `/docs` | Generate feature documentation |
|
|
124
|
+
| `/clean` | Repository cleanup |
|
|
125
|
+
| `/security-review` | Deep security analysis |
|
|
126
|
+
| `/reflect` | Workflow improvement analysis |
|
|
266
127
|
|
|
267
|
-
|
|
128
|
+
---
|
|
268
129
|
|
|
269
|
-
|
|
130
|
+
## CLI Commands
|
|
270
131
|
|
|
132
|
+
```bash
|
|
133
|
+
npx sequant init # Initialize in project
|
|
134
|
+
npx sequant update # Update skill templates
|
|
135
|
+
npx sequant doctor # Check installation
|
|
136
|
+
npx sequant status # Show version and config
|
|
137
|
+
npx sequant run <issues...> # Execute workflow
|
|
271
138
|
```
|
|
272
|
-
.claude/
|
|
273
|
-
├── skills/ # Package-provided (updated by sequant update)
|
|
274
|
-
├── skills.local/ # Your overrides (never modified)
|
|
275
|
-
├── hooks/ # Package-provided
|
|
276
|
-
├── hooks.local/ # Your overrides
|
|
277
|
-
└── memory/ # Your project context (never modified)
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
### Constitution
|
|
281
|
-
|
|
282
|
-
Edit `.claude/memory/constitution.md` to define project-specific principles:
|
|
283
139
|
|
|
284
|
-
|
|
285
|
-
# My Project Constitution
|
|
286
|
-
|
|
287
|
-
## Core Principles
|
|
288
|
-
1. Always use TypeScript strict mode
|
|
289
|
-
2. Test coverage must exceed 80%
|
|
290
|
-
3. All PRs require security review
|
|
291
|
-
|
|
292
|
-
## Naming Conventions
|
|
293
|
-
- Components: PascalCase
|
|
294
|
-
- Utilities: camelCase
|
|
295
|
-
- Constants: SCREAMING_SNAKE_CASE
|
|
296
|
-
```
|
|
140
|
+
See [Run Command Options](docs/run-command.md) for advanced usage.
|
|
297
141
|
|
|
298
|
-
|
|
142
|
+
---
|
|
299
143
|
|
|
300
|
-
|
|
144
|
+
## Configuration
|
|
301
145
|
|
|
302
146
|
```json
|
|
147
|
+
// .sequant/settings.json
|
|
303
148
|
{
|
|
304
|
-
"version": "1.0",
|
|
305
149
|
"run": {
|
|
306
|
-
"logJson": true,
|
|
307
|
-
"logPath": ".sequant/logs",
|
|
308
|
-
"autoDetectPhases": true,
|
|
309
|
-
"timeout": 300,
|
|
310
|
-
"sequential": false,
|
|
311
150
|
"qualityLoop": false,
|
|
312
|
-
"maxIterations": 3
|
|
313
|
-
"smartTests": true
|
|
314
|
-
},
|
|
315
|
-
"agents": {
|
|
316
|
-
"parallel": false,
|
|
317
|
-
"model": "haiku"
|
|
151
|
+
"maxIterations": 3
|
|
318
152
|
}
|
|
319
153
|
}
|
|
320
154
|
```
|
|
321
155
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
| Option | Default | Description |
|
|
325
|
-
|--------|---------|-------------|
|
|
326
|
-
| `logJson` | `true` | Enable JSON logging for run sessions |
|
|
327
|
-
| `logPath` | `.sequant/logs` | Directory for log files |
|
|
328
|
-
| `autoDetectPhases` | `true` | Auto-detect phases from labels/spec output |
|
|
329
|
-
| `timeout` | `300` | Timeout per phase in seconds |
|
|
330
|
-
| `sequential` | `false` | Run issues sequentially (vs parallel) |
|
|
331
|
-
| `qualityLoop` | `false` | Enable quality loop by default |
|
|
332
|
-
| `maxIterations` | `3` | Max quality loop iterations |
|
|
333
|
-
| `smartTests` | `true` | Auto-detect test commands |
|
|
334
|
-
|
|
335
|
-
#### Agent Settings
|
|
336
|
-
|
|
337
|
-
| Option | Default | Description |
|
|
338
|
-
|--------|---------|-------------|
|
|
339
|
-
| `parallel` | `false` | Run sub-agents in parallel (faster but higher token usage) |
|
|
340
|
-
| `model` | `"haiku"` | Default model for sub-agents (`haiku`, `sonnet`, or `opus`) |
|
|
341
|
-
|
|
342
|
-
##### Cost vs Speed Trade-offs
|
|
343
|
-
|
|
344
|
-
Skills like `/qa`, `/merger`, and `/fullsolve` spawn sub-agents for quality checks. The `agents` settings control how these agents execute:
|
|
156
|
+
See [Customization Guide](docs/customization.md) for all options.
|
|
345
157
|
|
|
346
|
-
|
|
347
|
-
|------|-------------|-------|----------|
|
|
348
|
-
| Sequential (`parallel: false`) | 1x (baseline) | Slower | Limited API plans, cost-conscious users |
|
|
349
|
-
| Parallel (`parallel: true`) | ~2-3x | ~50% faster | Unlimited plans, batch operations |
|
|
158
|
+
---
|
|
350
159
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
```bash
|
|
354
|
-
/qa 123 --parallel # Force parallel (faster)
|
|
355
|
-
/qa 123 --sequential # Force sequential (cheaper)
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
CLI flags override settings file values.
|
|
160
|
+
## Platform Support
|
|
359
161
|
|
|
360
|
-
|
|
162
|
+
| Platform | Status |
|
|
163
|
+
|----------|--------|
|
|
164
|
+
| macOS | ✅ Full support |
|
|
165
|
+
| Linux | ✅ Full support |
|
|
166
|
+
| Windows WSL | ✅ Full support |
|
|
167
|
+
| Windows Native | ⚠️ CLI only |
|
|
361
168
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
```
|
|
365
|
-
.claude/
|
|
366
|
-
├── skills/ # Workflow commands
|
|
367
|
-
│ ├── spec/SKILL.md
|
|
368
|
-
│ ├── exec/SKILL.md
|
|
369
|
-
│ ├── qa/SKILL.md
|
|
370
|
-
│ └── ...
|
|
371
|
-
├── hooks/ # Pre/post tool hooks
|
|
372
|
-
│ ├── pre-tool.sh
|
|
373
|
-
│ └── post-tool.sh
|
|
374
|
-
├── memory/ # Project context
|
|
375
|
-
│ └── constitution.md
|
|
376
|
-
└── settings.json # Hooks configuration
|
|
377
|
-
|
|
378
|
-
.sequant-manifest.json # Version tracking
|
|
379
|
-
```
|
|
169
|
+
---
|
|
380
170
|
|
|
381
171
|
## Documentation
|
|
382
172
|
|
|
383
|
-
- [
|
|
384
|
-
- [
|
|
385
|
-
- [
|
|
386
|
-
- [
|
|
387
|
-
- [Troubleshooting](docs/troubleshooting.md)
|
|
388
|
-
- [Testing Guide](docs/testing.md) — Cross-platform testing matrix
|
|
389
|
-
- [Git Patterns](docs/git-patterns.md) — Worktree and merge workflows
|
|
390
|
-
- [Release Checklist](docs/release-checklist.md) — Pre-release verification
|
|
391
|
-
- Stack Guides: [Next.js](docs/stacks/nextjs.md) | [Rust](docs/stacks/rust.md) | [Python](docs/stacks/python.md) | [Go](docs/stacks/go.md)
|
|
392
|
-
|
|
393
|
-
## Philosophy
|
|
394
|
-
|
|
395
|
-
Sequant is built on these principles:
|
|
396
|
-
|
|
397
|
-
1. **Explicit over implicit** — Every phase has clear inputs and outputs
|
|
398
|
-
2. **Quality gates** — No phase completes without validation
|
|
399
|
-
3. **Isolation** — Work happens in dedicated worktrees
|
|
400
|
-
4. **Traceability** — All decisions recorded in GitHub issues
|
|
401
|
-
5. **Composability** — Use phases individually or combine them
|
|
173
|
+
- [Getting Started](docs/getting-started/installation.md)
|
|
174
|
+
- [Workflow Concepts](docs/concepts/workflow-phases.md)
|
|
175
|
+
- [Run Command](docs/run-command.md)
|
|
176
|
+
- [Customization](docs/customization.md)
|
|
177
|
+
- [Troubleshooting](docs/troubleshooting.md)
|
|
402
178
|
|
|
403
|
-
|
|
179
|
+
Stack guides: [Next.js](docs/stacks/nextjs.md) · [Rust](docs/stacks/rust.md) · [Python](docs/stacks/python.md) · [Go](docs/stacks/go.md)
|
|
404
180
|
|
|
405
|
-
|
|
406
|
-
- [Agent Skills](https://agentskills.io) — Open standard for cross-platform skills
|
|
407
|
-
- [BMAD Method](https://github.com/bmad-code-org/BMAD-METHOD) — Update-safe directories
|
|
181
|
+
---
|
|
408
182
|
|
|
409
183
|
## License
|
|
410
184
|
|
package/dist/bin/cli.js
CHANGED
|
File without changes
|
package/dist/src/commands/run.js
CHANGED
|
@@ -135,6 +135,16 @@ async function ensureWorktree(issueNumber, title, verbose, packageManager) {
|
|
|
135
135
|
if (verbose) {
|
|
136
136
|
console.log(chalk.gray(` 🌿 Creating worktree for #${issueNumber}...`));
|
|
137
137
|
}
|
|
138
|
+
// Fetch latest main to ensure worktree starts from fresh baseline
|
|
139
|
+
if (verbose) {
|
|
140
|
+
console.log(chalk.gray(` 🔄 Fetching latest main...`));
|
|
141
|
+
}
|
|
142
|
+
const fetchResult = spawnSync("git", ["fetch", "origin", "main"], {
|
|
143
|
+
stdio: "pipe",
|
|
144
|
+
});
|
|
145
|
+
if (fetchResult.status !== 0 && verbose) {
|
|
146
|
+
console.log(chalk.yellow(` ⚠️ Could not fetch origin/main, using local state`));
|
|
147
|
+
}
|
|
138
148
|
// Ensure worktrees directory exists
|
|
139
149
|
if (!existsSync(worktreesDir)) {
|
|
140
150
|
spawnSync("mkdir", ["-p", worktreesDir], { stdio: "pipe" });
|
|
@@ -148,8 +158,8 @@ async function ensureWorktree(issueNumber, title, verbose, packageManager) {
|
|
|
148
158
|
});
|
|
149
159
|
}
|
|
150
160
|
else {
|
|
151
|
-
// Create new branch from main
|
|
152
|
-
createResult = spawnSync("git", ["worktree", "add", worktreePath, "-b", branch], { stdio: "pipe" });
|
|
161
|
+
// Create new branch from origin/main (fresh baseline)
|
|
162
|
+
createResult = spawnSync("git", ["worktree", "add", worktreePath, "-b", branch, "origin/main"], { stdio: "pipe" });
|
|
153
163
|
}
|
|
154
164
|
if (createResult.status !== 0) {
|
|
155
165
|
const error = createResult.stderr.toString();
|
package/package.json
CHANGED
|
@@ -108,6 +108,50 @@ if echo "$TOOL_INPUT" | grep -qE 'git push.*(--force| -f($| ))'; then
|
|
|
108
108
|
exit 2
|
|
109
109
|
fi
|
|
110
110
|
|
|
111
|
+
# --- Hard Reset Protection (Issue #85, enhanced) ---
|
|
112
|
+
# Block git reset --hard when there is local work that would be lost:
|
|
113
|
+
# - Unpushed commits on main/master
|
|
114
|
+
# - Uncommitted changes (staged or unstaged)
|
|
115
|
+
# - Unfinished merge in progress
|
|
116
|
+
if echo "$TOOL_INPUT" | grep -qE 'git reset.*(--hard|origin)'; then
|
|
117
|
+
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")
|
|
118
|
+
BLOCK_REASONS=""
|
|
119
|
+
|
|
120
|
+
# Check 1: Unpushed commits (only on main/master)
|
|
121
|
+
if [[ "$CURRENT_BRANCH" == "main" || "$CURRENT_BRANCH" == "master" ]]; then
|
|
122
|
+
UNPUSHED=$(git log origin/$CURRENT_BRANCH..HEAD --oneline 2>/dev/null | wc -l | tr -d ' ')
|
|
123
|
+
if [[ "$UNPUSHED" -gt 0 ]]; then
|
|
124
|
+
BLOCK_REASONS="${BLOCK_REASONS} - $UNPUSHED unpushed commit(s) on $CURRENT_BRANCH\n"
|
|
125
|
+
fi
|
|
126
|
+
fi
|
|
127
|
+
|
|
128
|
+
# Check 2: Uncommitted changes (staged or unstaged)
|
|
129
|
+
UNCOMMITTED=$(git status --porcelain 2>/dev/null | wc -l | tr -d ' ')
|
|
130
|
+
if [[ "$UNCOMMITTED" -gt 0 ]]; then
|
|
131
|
+
BLOCK_REASONS="${BLOCK_REASONS} - $UNCOMMITTED uncommitted file(s)\n"
|
|
132
|
+
fi
|
|
133
|
+
|
|
134
|
+
# Check 3: Unfinished merge
|
|
135
|
+
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null || echo ".git")
|
|
136
|
+
if [[ -f "$GIT_DIR/MERGE_HEAD" ]]; then
|
|
137
|
+
BLOCK_REASONS="${BLOCK_REASONS} - Unfinished merge in progress\n"
|
|
138
|
+
fi
|
|
139
|
+
|
|
140
|
+
# Block if any reasons found
|
|
141
|
+
if [[ -n "$BLOCK_REASONS" ]]; then
|
|
142
|
+
{
|
|
143
|
+
echo "HOOK_BLOCKED: git reset --hard would lose local work:"
|
|
144
|
+
echo -e "$BLOCK_REASONS"
|
|
145
|
+
echo " Resolve with:"
|
|
146
|
+
echo " git push origin $CURRENT_BRANCH # push commits"
|
|
147
|
+
echo " git stash # save changes"
|
|
148
|
+
echo " git merge --abort # cancel merge"
|
|
149
|
+
echo " Or run directly in terminal (outside Claude Code) to bypass"
|
|
150
|
+
} | tee -a /tmp/claude-hook.log >&2
|
|
151
|
+
exit 2
|
|
152
|
+
fi
|
|
153
|
+
fi
|
|
154
|
+
|
|
111
155
|
# CI/CD triggers (automation shouldn't trigger more automation)
|
|
112
156
|
if echo "$TOOL_INPUT" | grep -qE 'gh workflow run'; then
|
|
113
157
|
echo "HOOK_BLOCKED: Workflow trigger" | tee -a /tmp/claude-hook.log >&2
|
|
@@ -273,22 +317,33 @@ if [[ "$TOOL_NAME" == "Bash" ]] && echo "$TOOL_INPUT" | grep -qE 'git commit'; t
|
|
|
273
317
|
fi
|
|
274
318
|
fi
|
|
275
319
|
|
|
276
|
-
# === WORKTREE PATH ENFORCEMENT
|
|
277
|
-
#
|
|
320
|
+
# === WORKTREE PATH ENFORCEMENT ===
|
|
321
|
+
# Enforces that file operations stay within the designated worktree
|
|
322
|
+
# Sources for worktree path (in priority order):
|
|
323
|
+
# 1. SEQUANT_WORKTREE env var - set by `sequant run` for isolated issue execution
|
|
324
|
+
# 2. Parallel marker file - for parallel agent execution
|
|
278
325
|
# This prevents agents from accidentally editing the main repo instead of the worktree
|
|
279
|
-
# Marker file format: First line contains the expected worktree path
|
|
280
326
|
if [[ "$TOOL_NAME" == "Edit" || "$TOOL_NAME" == "Write" ]]; then
|
|
281
327
|
EXPECTED_WORKTREE=""
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
328
|
+
|
|
329
|
+
# Priority 1: Check SEQUANT_WORKTREE environment variable (set by sequant run)
|
|
330
|
+
if [[ -n "${SEQUANT_WORKTREE:-}" ]]; then
|
|
331
|
+
EXPECTED_WORKTREE="$SEQUANT_WORKTREE"
|
|
332
|
+
fi
|
|
333
|
+
|
|
334
|
+
# Priority 2: Fall back to parallel marker file
|
|
335
|
+
if [[ -z "$EXPECTED_WORKTREE" ]]; then
|
|
336
|
+
for marker in "${PARALLEL_MARKER_PREFIX}"*.marker; do
|
|
337
|
+
if [[ -f "$marker" ]]; then
|
|
338
|
+
# Read expected worktree path from marker file (first line)
|
|
339
|
+
EXPECTED_WORKTREE=$(head -1 "$marker" 2>/dev/null || true)
|
|
340
|
+
break
|
|
341
|
+
fi
|
|
342
|
+
done
|
|
343
|
+
fi
|
|
289
344
|
|
|
290
345
|
if [[ -n "$EXPECTED_WORKTREE" ]]; then
|
|
291
|
-
# AC-
|
|
346
|
+
# AC-4 (Issue #31): Check worktree directory exists before path validation
|
|
292
347
|
# Prevents Write tool from creating non-existent worktree directories
|
|
293
348
|
if [[ ! -d "$EXPECTED_WORKTREE" ]]; then
|
|
294
349
|
echo "HOOK_BLOCKED: Worktree does not exist: $EXPECTED_WORKTREE" | tee -a /tmp/claude-hook.log >&2
|
|
@@ -304,12 +359,23 @@ if [[ "$TOOL_NAME" == "Edit" || "$TOOL_NAME" == "Write" ]]; then
|
|
|
304
359
|
fi
|
|
305
360
|
|
|
306
361
|
if [[ -n "$FILE_PATH" ]]; then
|
|
362
|
+
# Resolve to absolute path for consistent comparison
|
|
363
|
+
REAL_FILE_PATH=$(realpath "$FILE_PATH" 2>/dev/null || echo "$FILE_PATH")
|
|
364
|
+
REAL_WORKTREE=$(realpath "$EXPECTED_WORKTREE" 2>/dev/null || echo "$EXPECTED_WORKTREE")
|
|
365
|
+
|
|
307
366
|
# Check if file path is within the expected worktree
|
|
308
|
-
if
|
|
367
|
+
if [[ "$REAL_FILE_PATH" != "$REAL_WORKTREE"* ]]; then
|
|
309
368
|
echo "$(date +%H:%M:%S) WORKTREE_BLOCKED: Edit outside expected worktree" >> "$QUALITY_LOG"
|
|
310
369
|
echo " Expected: $EXPECTED_WORKTREE" >> "$QUALITY_LOG"
|
|
311
370
|
echo " Got: $FILE_PATH" >> "$QUALITY_LOG"
|
|
312
|
-
|
|
371
|
+
{
|
|
372
|
+
echo "HOOK_BLOCKED: File operation must be within worktree"
|
|
373
|
+
echo " Worktree: $EXPECTED_WORKTREE"
|
|
374
|
+
echo " File: $FILE_PATH"
|
|
375
|
+
if [[ -n "${SEQUANT_ISSUE:-}" ]]; then
|
|
376
|
+
echo " Issue: #$SEQUANT_ISSUE"
|
|
377
|
+
fi
|
|
378
|
+
} | tee -a /tmp/claude-hook.log >&2
|
|
313
379
|
exit 2
|
|
314
380
|
fi
|
|
315
381
|
fi
|
|
@@ -357,6 +423,31 @@ if [[ "${CLAUDE_HOOKS_FILE_LOCKING:-true}" == "true" ]]; then
|
|
|
357
423
|
fi
|
|
358
424
|
fi
|
|
359
425
|
|
|
426
|
+
# === PRE-MERGE WORKTREE CLEANUP ===
|
|
427
|
+
# Auto-remove worktree before `gh pr merge` to prevent --delete-branch failure
|
|
428
|
+
# The worktree locks the branch, causing merge to partially fail
|
|
429
|
+
if [[ "$TOOL_NAME" == "Bash" ]] && echo "$TOOL_INPUT" | grep -qE 'gh pr merge'; then
|
|
430
|
+
# Extract PR number from command
|
|
431
|
+
PR_NUM=$(echo "$TOOL_INPUT" | grep -oE 'gh pr merge [0-9]+' | grep -oE '[0-9]+')
|
|
432
|
+
|
|
433
|
+
if [[ -n "$PR_NUM" ]]; then
|
|
434
|
+
# Get the branch name for this PR
|
|
435
|
+
BRANCH_NAME=$(gh pr view "$PR_NUM" --json headRefName --jq '.headRefName' 2>/dev/null || true)
|
|
436
|
+
|
|
437
|
+
if [[ -n "$BRANCH_NAME" ]]; then
|
|
438
|
+
# Check if a worktree exists for this branch
|
|
439
|
+
# Note: worktree line is 2 lines before branch line in porcelain output
|
|
440
|
+
WORKTREE_PATH=$(git worktree list --porcelain 2>/dev/null | grep -B2 "branch refs/heads/$BRANCH_NAME" | grep "^worktree " | sed 's/^worktree //' || true)
|
|
441
|
+
|
|
442
|
+
if [[ -n "$WORKTREE_PATH" && -d "$WORKTREE_PATH" ]]; then
|
|
443
|
+
# Remove the worktree before merge proceeds
|
|
444
|
+
git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || true
|
|
445
|
+
echo "PRE-MERGE: Removed worktree $WORKTREE_PATH for branch $BRANCH_NAME" >> /tmp/claude-hook.log
|
|
446
|
+
fi
|
|
447
|
+
fi
|
|
448
|
+
fi
|
|
449
|
+
fi
|
|
450
|
+
|
|
360
451
|
# === ALLOW EVERYTHING ELSE ===
|
|
361
452
|
# Slash commands need: git, npm, file edits, gh pr/issue, MCP tools
|
|
362
453
|
exit 0
|