@nathapp/nax 0.49.1 → 0.49.6
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/CHANGELOG.md +14 -0
- package/README.md +282 -10
- package/dist/nax.js +257 -136
- package/package.json +1 -1
- package/src/agents/acp/adapter.ts +53 -23
- package/src/agents/acp/spawn-client.ts +0 -2
- package/src/agents/claude/execution.ts +14 -0
- package/src/agents/types.ts +7 -0
- package/src/cli/prompts-main.ts +4 -59
- package/src/cli/prompts-shared.ts +70 -0
- package/src/cli/prompts-tdd.ts +1 -1
- package/src/config/merge.ts +18 -0
- package/src/config/test-strategy.ts +4 -4
- package/src/execution/iteration-runner.ts +1 -1
- package/src/execution/pipeline-result-handler.ts +4 -1
- package/src/execution/story-selector.ts +2 -1
- package/src/interaction/plugins/webhook.ts +44 -25
- package/src/pipeline/stages/autofix.ts +26 -7
- package/src/pipeline/stages/routing.ts +1 -1
- package/src/review/runner.ts +15 -0
- package/src/tdd/cleanup.ts +15 -6
- package/src/tdd/isolation.ts +9 -2
- package/src/tdd/rectification-gate.ts +41 -10
- package/src/tdd/session-runner.ts +71 -38
- package/src/verification/executor.ts +4 -1
- package/src/verification/strategies/acceptance.ts +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.49.3] - 2026-03-18
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **Autofix `recheckReview` bug:** `reviewStage.execute()` returns `action:"continue"` for both pass AND built-in-check-failure (to hand off to autofix). Using `result.action === "continue"` always returned `true`, causing "Mechanical autofix succeeded" to log every cycle and looping until `MAX_STAGE_RETRIES` with no real fix. Fix: check `ctx.reviewResult?.success` directly after execute.
|
|
12
|
+
- **Autofix selective mechanical fix:** `lintFix`/`formatFix` cannot fix typecheck errors. Phase 1 now only runs when the `lint` check actually failed. Typecheck-only failures skip straight to agent rectification (Phase 2).
|
|
13
|
+
- **Review command logging:** `runner.ts` now logs the resolved command and workdir for every check at info level, and full output on failure at warn level — eliminates phantom failure mystery.
|
|
14
|
+
- **Re-decompose on second run:** Batch-mode story selector was missing `"decomposed"` in its status skip list (single-story path already excluded it). Stories with `status: "decomposed"` were being picked up again, triggering unnecessary LLM decompose calls. Added `"decomposed"` to batch filter and a guard in routing SD-004 block.
|
|
15
|
+
- **totalCost always 0:** `handlePipelineFailure` returned no `costDelta`; `iteration-runner` hardcoded `costDelta: 0` for failures. Agent cost for failed stories was silently dropped. Fix: extract `agentResult?.estimatedCost` in failure path same as success path.
|
|
16
|
+
|
|
17
|
+
## [0.49.2] - 2026-03-18
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
- **Test strategy descriptions:** `TEST_STRATEGY_GUIDE` (used in plan and decompose prompts) had incorrect descriptions for `three-session-tdd` and `three-session-tdd-lite`. Both strategies use 3 sessions. Key distinction: `three-session-tdd` (strict) — test-writer makes no src/ changes, implementer makes no test changes; `three-session-tdd-lite` (lite) — test-writer may add minimal src/ stubs, implementer may expand coverage and replace stubs. Updated in `src/config/test-strategy.ts`, `docs/specs/test-strategy-ssot.md`, and `docs/architecture/ARCHITECTURE.md`.
|
|
21
|
+
|
|
8
22
|
## [0.49.1] - 2026-03-18
|
|
9
23
|
|
|
10
24
|
### Fixed
|
package/README.md
CHANGED
|
@@ -18,8 +18,16 @@ bun install -g @nathapp/nax
|
|
|
18
18
|
cd your-project
|
|
19
19
|
nax init
|
|
20
20
|
nax features create my-feature
|
|
21
|
-
|
|
21
|
+
|
|
22
|
+
# Option A: write prd.json manually, then run
|
|
23
|
+
nax run -f my-feature
|
|
24
|
+
|
|
25
|
+
# Option B: generate prd.json from a spec file, then run
|
|
26
|
+
nax plan -f my-feature --from spec.md
|
|
22
27
|
nax run -f my-feature
|
|
28
|
+
|
|
29
|
+
# Option C: plan + run in one command
|
|
30
|
+
nax run -f my-feature --plan --from spec.md
|
|
23
31
|
```
|
|
24
32
|
|
|
25
33
|
## How It Works
|
|
@@ -54,6 +62,14 @@ nax/
|
|
|
54
62
|
└── features/ # One folder per feature
|
|
55
63
|
```
|
|
56
64
|
|
|
65
|
+
**Monorepo — scaffold a package:**
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
nax init --package packages/api
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Creates `packages/api/nax/context.md` for per-package agent context.
|
|
72
|
+
|
|
57
73
|
---
|
|
58
74
|
|
|
59
75
|
### `nax features create <name>`
|
|
@@ -76,20 +92,33 @@ nax features list
|
|
|
76
92
|
|
|
77
93
|
---
|
|
78
94
|
|
|
79
|
-
### `nax
|
|
95
|
+
### `nax plan -f <name> --from <spec>`
|
|
80
96
|
|
|
81
|
-
|
|
97
|
+
Generate a `prd.json` from a spec file using an LLM. Replaces the deprecated `nax analyze`.
|
|
82
98
|
|
|
83
99
|
```bash
|
|
84
|
-
nax
|
|
100
|
+
nax plan -f my-feature --from spec.md
|
|
85
101
|
```
|
|
86
102
|
|
|
87
103
|
**Flags:**
|
|
88
104
|
|
|
89
105
|
| Flag | Description |
|
|
90
106
|
|:-----|:------------|
|
|
91
|
-
|
|
|
92
|
-
| `--
|
|
107
|
+
| `-f, --feature <name>` | Feature name (required) |
|
|
108
|
+
| `--from <spec-path>` | Path to spec file (required) |
|
|
109
|
+
| `--auto` / `--one-shot` | Skip interactive Q&A — single LLM call, no back-and-forth |
|
|
110
|
+
| `-b, --branch <branch>` | Override default branch name |
|
|
111
|
+
| `-d, --dir <path>` | Project directory |
|
|
112
|
+
|
|
113
|
+
**Interactive vs one-shot:**
|
|
114
|
+
- Default (no flag): interactive planning session — nax asks clarifying questions, refines the plan iteratively
|
|
115
|
+
- `--auto` / `--one-shot`: single LLM call, faster but less precise
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
### `nax analyze` *(deprecated)*
|
|
120
|
+
|
|
121
|
+
> ⚠️ **Deprecated.** Use `nax plan` instead. `nax analyze` remains available for backward compatibility but will be removed in a future version.
|
|
93
122
|
|
|
94
123
|
---
|
|
95
124
|
|
|
@@ -105,10 +134,23 @@ nax run -f my-feature
|
|
|
105
134
|
|
|
106
135
|
| Flag | Description |
|
|
107
136
|
|:-----|:------------|
|
|
108
|
-
| `-f, --feature <name>` | Feature name
|
|
137
|
+
| `-f, --feature <name>` | Feature name |
|
|
138
|
+
| `-a, --agent <name>` | Force a specific agent (`claude`, `opencode`, `codex`, etc.) |
|
|
139
|
+
| `--plan` | Run plan phase first (requires `--from`) |
|
|
140
|
+
| `--from <spec-path>` | Spec file for `--plan` |
|
|
141
|
+
| `--one-shot` | Skip interactive Q&A during planning (ACP only) |
|
|
142
|
+
| `--force` | Overwrite existing `prd.json` when using `--plan` |
|
|
143
|
+
| `--parallel <n>` | Max parallel sessions (`0` = auto based on CPU cores; omit = sequential) |
|
|
109
144
|
| `--dry-run` | Preview story routing without running agents |
|
|
110
145
|
| `--headless` | Non-interactive output (structured logs, no TUI) |
|
|
111
|
-
|
|
|
146
|
+
| `--verbose` | Debug-level logging |
|
|
147
|
+
| `--quiet` | Warnings and errors only |
|
|
148
|
+
| `--silent` | Errors only |
|
|
149
|
+
| `--json` | Raw JSONL output to stdout (for scripting) |
|
|
150
|
+
| `--skip-precheck` | Skip precheck validations (advanced users only) |
|
|
151
|
+
| `--no-context` | Disable context builder (skip file context in prompts) |
|
|
152
|
+
| `--no-batch` | Execute all stories individually (disable batching) |
|
|
153
|
+
| `-d, --dir <path>` | Working directory |
|
|
112
154
|
|
|
113
155
|
**Examples:**
|
|
114
156
|
|
|
@@ -116,11 +158,23 @@ nax run -f my-feature
|
|
|
116
158
|
# Preview what would run (no agents spawned)
|
|
117
159
|
nax run -f user-auth --dry-run
|
|
118
160
|
|
|
119
|
-
#
|
|
120
|
-
nax run -f user-auth
|
|
161
|
+
# Plan from spec then run — one command
|
|
162
|
+
nax run -f user-auth --plan --from spec.md
|
|
163
|
+
|
|
164
|
+
# Run with parallel execution (auto concurrency)
|
|
165
|
+
nax run -f user-auth --parallel 0
|
|
166
|
+
|
|
167
|
+
# Run with up to 3 parallel worktree sessions
|
|
168
|
+
nax run -f user-auth --parallel 3
|
|
169
|
+
|
|
170
|
+
# Force a specific agent
|
|
171
|
+
nax run -f user-auth --agent opencode
|
|
121
172
|
|
|
122
173
|
# Run in CI/CD (structured output)
|
|
123
174
|
nax run -f user-auth --headless
|
|
175
|
+
|
|
176
|
+
# Raw JSONL for scripting
|
|
177
|
+
nax run -f user-auth --json
|
|
124
178
|
```
|
|
125
179
|
|
|
126
180
|
---
|
|
@@ -199,6 +253,58 @@ Output sections:
|
|
|
199
253
|
|
|
200
254
|
---
|
|
201
255
|
|
|
256
|
+
### `nax generate`
|
|
257
|
+
|
|
258
|
+
Generate agent config files from `nax/context.md`. Supports Claude Code, OpenCode, Codex, Cursor, Windsurf, Aider, and Gemini.
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
nax generate
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**Flags:**
|
|
265
|
+
|
|
266
|
+
| Flag | Description |
|
|
267
|
+
|:-----|:------------|
|
|
268
|
+
| `-c, --context <path>` | Context file path (default: `nax/context.md`) |
|
|
269
|
+
| `-o, --output <dir>` | Output directory (default: project root) |
|
|
270
|
+
| `-a, --agent <name>` | Generate for a specific agent only (`claude`, `opencode`, `cursor`, `windsurf`, `aider`, `codex`, `gemini`) |
|
|
271
|
+
| `--dry-run` | Preview without writing files |
|
|
272
|
+
| `--no-auto-inject` | Disable auto-injection of project metadata |
|
|
273
|
+
| `--package <dir>` | Generate for a specific monorepo package (e.g. `packages/api`) |
|
|
274
|
+
| `--all-packages` | Generate for all discovered packages |
|
|
275
|
+
|
|
276
|
+
**What it generates:**
|
|
277
|
+
|
|
278
|
+
| Agent | File |
|
|
279
|
+
|:------|:-----|
|
|
280
|
+
| Claude Code | `CLAUDE.md` |
|
|
281
|
+
| OpenCode | `AGENTS.md` |
|
|
282
|
+
| Codex | `AGENTS.md` |
|
|
283
|
+
| Cursor | `.cursorrules` |
|
|
284
|
+
| Windsurf | `.windsurfrules` |
|
|
285
|
+
| Aider | `.aider.md` |
|
|
286
|
+
| Gemini | `GEMINI.md` |
|
|
287
|
+
|
|
288
|
+
**Workflow:**
|
|
289
|
+
|
|
290
|
+
1. Create `nax/context.md` — describe your project's architecture, conventions, and coding standards
|
|
291
|
+
2. Run `nax generate` — writes agent config files to the project root (and per-package if configured)
|
|
292
|
+
3. Commit the generated files — your agents will automatically pick them up
|
|
293
|
+
|
|
294
|
+
**Monorepo (per-package):**
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
# Generate CLAUDE.md for a single package
|
|
298
|
+
nax generate --package packages/api
|
|
299
|
+
|
|
300
|
+
# Generate for all packages (auto-discovers workspace packages)
|
|
301
|
+
nax generate --all-packages
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Each package can have its own `nax/context.md` at `<package>/nax/context.md` for package-specific agent instructions.
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
202
308
|
### `nax prompts -f <name>`
|
|
203
309
|
|
|
204
310
|
Assemble and display the prompt that would be sent to the agent for each story role.
|
|
@@ -439,6 +545,172 @@ If the regression gate detects failures, nax maps them to the responsible story
|
|
|
439
545
|
|
|
440
546
|
---
|
|
441
547
|
|
|
548
|
+
## Parallel Execution
|
|
549
|
+
|
|
550
|
+
nax can run multiple stories concurrently using git worktrees — each story gets an isolated worktree so agents don't step on each other.
|
|
551
|
+
|
|
552
|
+
```bash
|
|
553
|
+
# Auto concurrency (based on CPU cores)
|
|
554
|
+
nax run -f my-feature --parallel 0
|
|
555
|
+
|
|
556
|
+
# Fixed concurrency
|
|
557
|
+
nax run -f my-feature --parallel 3
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
**How it works:**
|
|
561
|
+
|
|
562
|
+
1. Stories are grouped by dependency order (dependent stories wait for their prerequisites)
|
|
563
|
+
2. Each batch of independent stories gets its own git worktree
|
|
564
|
+
3. Agent sessions run concurrently inside those worktrees
|
|
565
|
+
4. Once a batch completes, changes are merged back in dependency order
|
|
566
|
+
5. Merge conflicts are automatically rectified by re-running the conflicted story on the updated base
|
|
567
|
+
|
|
568
|
+
**Config:**
|
|
569
|
+
|
|
570
|
+
```json
|
|
571
|
+
{
|
|
572
|
+
"execution": {
|
|
573
|
+
"maxParallelSessions": 4
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
> Sequential mode (no `--parallel`) is the safe default. Use parallel for large feature sets with independent stories.
|
|
579
|
+
|
|
580
|
+
---
|
|
581
|
+
|
|
582
|
+
## Agents
|
|
583
|
+
|
|
584
|
+
nax supports multiple coding agents. By default it uses Claude Code via the ACP protocol.
|
|
585
|
+
|
|
586
|
+
```bash
|
|
587
|
+
# List installed agents and their capabilities
|
|
588
|
+
nax agents
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
**Supported agents:**
|
|
592
|
+
|
|
593
|
+
| Agent | Protocol | Notes |
|
|
594
|
+
|:------|:---------|:------|
|
|
595
|
+
| `claude` | ACP (default) | Claude Code via acpx |
|
|
596
|
+
| `opencode` | ACP | OpenCode via acpx |
|
|
597
|
+
| `codex` | ACP | Codex via acpx |
|
|
598
|
+
| `cursor` | ACP | Cursor via acpx |
|
|
599
|
+
| `windsurf` | ACP | Windsurf via acpx |
|
|
600
|
+
| `aider` | ACP | Aider via acpx |
|
|
601
|
+
| `gemini` | ACP | Gemini CLI via acpx |
|
|
602
|
+
|
|
603
|
+
**ACP protocol (default):**
|
|
604
|
+
|
|
605
|
+
nax uses [acpx](https://github.com/nathapp/acpx) as the ACP transport. All agents run as persistent sessions — nax sends prompts and receives structured JSON-RPC responses including token counts and exact USD cost per session.
|
|
606
|
+
|
|
607
|
+
> **Known issue — `acpx` ≤ 0.3.1:** The `--model` flag is not supported. Model selection via `execution.model` or per-package `model` overrides has no effect when using acpx as the ACP transport. This is a limitation in the underlying `@zed-industries/claude-agent-acp` adapter, which ignores runtime model requests and always uses the model configured in Claude Code settings. A fix is being tracked in [openclaw/acpx#49](https://github.com/openclaw/acpx/issues/49). As a workaround, set your preferred model directly in Claude Code settings before running nax.
|
|
608
|
+
|
|
609
|
+
**Configuring agents:**
|
|
610
|
+
|
|
611
|
+
```json
|
|
612
|
+
{
|
|
613
|
+
"execution": {
|
|
614
|
+
"defaultAgent": "claude",
|
|
615
|
+
"protocol": "acp",
|
|
616
|
+
"fallbackOrder": ["claude", "codex", "opencode", "gemini"]
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
**Force a specific agent at runtime:**
|
|
622
|
+
|
|
623
|
+
```bash
|
|
624
|
+
nax run -f my-feature --agent opencode
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
---
|
|
628
|
+
|
|
629
|
+
## Monorepo Support
|
|
630
|
+
|
|
631
|
+
nax supports monorepos with workspace-level and per-package configuration.
|
|
632
|
+
|
|
633
|
+
### Setup
|
|
634
|
+
|
|
635
|
+
```bash
|
|
636
|
+
# Initialize nax at the repo root
|
|
637
|
+
nax init
|
|
638
|
+
|
|
639
|
+
# Scaffold per-package context for a specific package
|
|
640
|
+
nax init --package packages/api
|
|
641
|
+
nax init --package packages/web
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
### Per-Package Config
|
|
645
|
+
|
|
646
|
+
Each package can override specific config fields by placing a `nax/config.json` inside the package directory:
|
|
647
|
+
|
|
648
|
+
```
|
|
649
|
+
repo-root/
|
|
650
|
+
├── nax/
|
|
651
|
+
│ └── config.json # root config
|
|
652
|
+
├── packages/
|
|
653
|
+
│ ├── api/
|
|
654
|
+
│ │ └── nax/
|
|
655
|
+
│ │ ├── config.json # overrides for api package
|
|
656
|
+
│ │ └── context.md # agent context for api
|
|
657
|
+
│ └── web/
|
|
658
|
+
│ └── nax/
|
|
659
|
+
│ ├── config.json # overrides for web package
|
|
660
|
+
│ └── context.md # agent context for web
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
**Overridable fields per package:** `execution`, `review`, `acceptance`, `quality`, `context`
|
|
664
|
+
|
|
665
|
+
```json
|
|
666
|
+
// packages/api/nax/config.json
|
|
667
|
+
{
|
|
668
|
+
"quality": {
|
|
669
|
+
"commands": {
|
|
670
|
+
"test": "turbo test --filter=@myapp/api",
|
|
671
|
+
"lint": "turbo lint --filter=@myapp/api"
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
### Per-Package Stories
|
|
678
|
+
|
|
679
|
+
In your `prd.json`, set `workdir` on each story to point to the package:
|
|
680
|
+
|
|
681
|
+
```json
|
|
682
|
+
{
|
|
683
|
+
"userStories": [
|
|
684
|
+
{
|
|
685
|
+
"id": "US-001",
|
|
686
|
+
"title": "Add auth endpoint",
|
|
687
|
+
"workdir": "packages/api",
|
|
688
|
+
"status": "pending"
|
|
689
|
+
}
|
|
690
|
+
]
|
|
691
|
+
}
|
|
692
|
+
```
|
|
693
|
+
|
|
694
|
+
nax will run the agent inside that package's directory and apply its config overrides automatically.
|
|
695
|
+
|
|
696
|
+
### Workspace Detection
|
|
697
|
+
|
|
698
|
+
When `nax plan` generates stories for a monorepo, it auto-discovers packages from:
|
|
699
|
+
- `turbo.json` → `packages` field
|
|
700
|
+
- `package.json` → `workspaces`
|
|
701
|
+
- `pnpm-workspace.yaml` → `packages`
|
|
702
|
+
- Existing `*/nax/context.md` files
|
|
703
|
+
|
|
704
|
+
### Generate Agent Files for All Packages
|
|
705
|
+
|
|
706
|
+
```bash
|
|
707
|
+
nax generate --all-packages
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
Generates a `CLAUDE.md` (or agent-specific file) in each discovered package directory, using the package's own `nax/context.md` if present.
|
|
711
|
+
|
|
712
|
+
---
|
|
713
|
+
|
|
442
714
|
## Hooks
|
|
443
715
|
|
|
444
716
|
Integrate notifications, CI triggers, or custom scripts via lifecycle hooks.
|