@nathapp/nax 0.33.0 → 0.35.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 +191 -6
- package/dist/nax.js +5054 -4698
- package/package.json +1 -2
- package/src/agents/adapters/codex.ts +153 -0
- package/src/agents/claude-plan.ts +22 -5
- package/src/agents/claude.ts +102 -11
- package/src/agents/index.ts +2 -1
- package/src/agents/model-resolution.ts +43 -0
- package/src/agents/registry.ts +2 -1
- package/src/agents/types-extended.ts +5 -1
- package/src/agents/types.ts +31 -0
- package/src/analyze/classifier.ts +30 -50
- package/src/cli/analyze-parser.ts +8 -1
- package/src/cli/analyze.ts +1 -1
- package/src/cli/plan.ts +1 -0
- package/src/config/types.ts +3 -1
- package/src/execution/crash-recovery.ts +8 -0
- package/src/execution/iteration-runner.ts +2 -0
- package/src/execution/lifecycle/run-completion.ts +100 -15
- package/src/execution/parallel-executor.ts +20 -1
- package/src/execution/pipeline-result-handler.ts +5 -1
- package/src/execution/runner.ts +20 -0
- package/src/execution/sequential-executor.ts +1 -11
- package/src/hooks/types.ts +20 -10
- package/src/interaction/init.ts +8 -7
- package/src/interaction/plugins/auto.ts +41 -25
- package/src/metrics/tracker.ts +7 -0
- package/src/metrics/types.ts +2 -0
- package/src/pipeline/stages/routing.ts +4 -1
- package/src/plugins/index.ts +2 -0
- package/src/plugins/loader.ts +4 -2
- package/src/plugins/plugin-logger.ts +41 -0
- package/src/plugins/types.ts +50 -1
- package/src/prd/index.ts +2 -1
- package/src/prd/types.ts +6 -1
- package/src/precheck/checks-blockers.ts +37 -1
- package/src/precheck/checks.ts +1 -0
- package/src/precheck/index.ts +2 -2
- package/src/routing/router.ts +1 -0
- package/src/routing/strategies/llm.ts +53 -36
- package/src/routing/strategy.ts +3 -0
- package/src/tdd/rectification-gate.ts +68 -0
- package/src/tdd/session-runner.ts +16 -0
- package/src/tdd/verdict.ts +1 -0
- package/src/verification/rectification-loop.ts +14 -1
package/README.md
CHANGED
|
@@ -25,14 +25,15 @@ nax run -f my-feature
|
|
|
25
25
|
## How It Works
|
|
26
26
|
|
|
27
27
|
```
|
|
28
|
-
analyze → route → execute (loop until all stories pass)
|
|
28
|
+
analyze → route → execute → verify → (loop until all stories pass) → regression gate
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
1. **Analyze** each user story — classify complexity, select test strategy
|
|
32
32
|
2. **Route** to the right model tier (cheap → standard → premium)
|
|
33
33
|
3. **Execute** an agent session (Claude Code by default)
|
|
34
|
-
4. **Verify** tests pass; escalate model on failure
|
|
34
|
+
4. **Verify** tests pass; escalate model tier on failure
|
|
35
35
|
5. **Loop** until all stories are complete or a cost/iteration limit is hit
|
|
36
|
+
6. **Regression gate** — deferred full-suite verification after all stories pass
|
|
36
37
|
|
|
37
38
|
---
|
|
38
39
|
|
|
@@ -77,12 +78,19 @@ nax features list
|
|
|
77
78
|
|
|
78
79
|
### `nax analyze -f <name>`
|
|
79
80
|
|
|
80
|
-
Parse a `spec.md` file into a structured `prd.json`.
|
|
81
|
+
Parse a `spec.md` file into a structured `prd.json`. Uses an LLM to decompose the spec into classified user stories.
|
|
81
82
|
|
|
82
83
|
```bash
|
|
83
84
|
nax analyze -f my-feature
|
|
84
85
|
```
|
|
85
86
|
|
|
87
|
+
**Flags:**
|
|
88
|
+
|
|
89
|
+
| Flag | Description |
|
|
90
|
+
|:-----|:------------|
|
|
91
|
+
| `--from <path>` | Explicit spec path (overrides default `spec.md`) |
|
|
92
|
+
| `--reclassify` | Re-classify existing `prd.json` without re-decomposing |
|
|
93
|
+
|
|
86
94
|
---
|
|
87
95
|
|
|
88
96
|
### `nax run -f <name>`
|
|
@@ -191,6 +199,45 @@ Output sections:
|
|
|
191
199
|
|
|
192
200
|
---
|
|
193
201
|
|
|
202
|
+
### `nax prompts -f <name>`
|
|
203
|
+
|
|
204
|
+
Assemble and display the prompt that would be sent to the agent for each story role.
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
nax prompts -f my-feature
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Flags:**
|
|
211
|
+
|
|
212
|
+
| Flag | Description |
|
|
213
|
+
|:-----|:------------|
|
|
214
|
+
| `--init` | Export default role templates to `nax/templates/` for customization |
|
|
215
|
+
| `--role <role>` | Show prompt for a specific role (`implementer`, `test-writer`, `verifier`, `tdd-simple`) |
|
|
216
|
+
|
|
217
|
+
After running `--init`, edit the templates and nax will use them automatically via `prompts.overrides` config.
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
### `nax unlock`
|
|
222
|
+
|
|
223
|
+
Release a stale `nax.lock` from a crashed process.
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
nax unlock -f my-feature
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
### `nax runs`
|
|
232
|
+
|
|
233
|
+
Show all registered runs from the central registry (`~/.nax/runs/`).
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
nax runs
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
194
241
|
### `nax agents`
|
|
195
242
|
|
|
196
243
|
List installed coding agents and which models they support.
|
|
@@ -201,6 +248,16 @@ nax agents
|
|
|
201
248
|
|
|
202
249
|
---
|
|
203
250
|
|
|
251
|
+
### `nax config --explain`
|
|
252
|
+
|
|
253
|
+
Display the effective merged configuration with inline explanations for every field.
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
nax config -f my-feature --explain
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
204
261
|
## Configuration
|
|
205
262
|
|
|
206
263
|
Config is layered — project overrides global:
|
|
@@ -260,6 +317,35 @@ If `testScoped` is not configured, nax falls back to a heuristic that replaces t
|
|
|
260
317
|
|
|
261
318
|
---
|
|
262
319
|
|
|
320
|
+
## Test Strategies
|
|
321
|
+
|
|
322
|
+
nax selects a test strategy per story based on complexity and tags:
|
|
323
|
+
|
|
324
|
+
| Strategy | Sessions | When | Description |
|
|
325
|
+
|:---------|:---------|:-----|:------------|
|
|
326
|
+
| `test-after` | 1 | Refactors, deletions, config, docs | Single session, no TDD discipline |
|
|
327
|
+
| `tdd-simple` | 1 | Simple stories | Single session with TDD prompt (red-green-refactor) |
|
|
328
|
+
| `three-session-tdd-lite` | 3 | Medium stories | Three sessions, relaxed isolation rules |
|
|
329
|
+
| `three-session-tdd` | 3 | Complex/security stories | Three sessions, strict file isolation |
|
|
330
|
+
|
|
331
|
+
Configure the default TDD behavior in `nax/config.json`:
|
|
332
|
+
|
|
333
|
+
```json
|
|
334
|
+
{
|
|
335
|
+
"tdd": {
|
|
336
|
+
"strategy": "auto"
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
| Value | Behaviour |
|
|
342
|
+
|:------|:----------|
|
|
343
|
+
| `auto` | nax decides based on complexity and tags (default) |
|
|
344
|
+
| `lite` | Prefer `three-session-tdd-lite` for complex stories |
|
|
345
|
+
| `strict` | Always use full `three-session-tdd` for complex stories |
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
263
349
|
## Three-Session TDD
|
|
264
350
|
|
|
265
351
|
For complex or security-critical stories, nax enforces strict role separation:
|
|
@@ -274,6 +360,66 @@ Isolation is verified automatically via `git diff` between sessions. Violations
|
|
|
274
360
|
|
|
275
361
|
---
|
|
276
362
|
|
|
363
|
+
## Story Decomposition
|
|
364
|
+
|
|
365
|
+
When a story is too large (complex/expert with >6 acceptance criteria), nax can automatically decompose it into smaller sub-stories. This runs during the routing stage.
|
|
366
|
+
|
|
367
|
+
**Trigger:** The `story-oversized` interaction trigger fires when a story exceeds the configured thresholds. You can approve decomposition, skip the story, or continue as-is.
|
|
368
|
+
|
|
369
|
+
**How it works:**
|
|
370
|
+
|
|
371
|
+
1. The `DecomposeBuilder` constructs a prompt with the target story, sibling stories (to prevent overlap), and codebase context
|
|
372
|
+
2. An LLM generates sub-stories with IDs, titles, descriptions, acceptance criteria, and dependency ordering
|
|
373
|
+
3. Post-decompose validators check:
|
|
374
|
+
- **Overlap** — sub-stories must not duplicate scope of existing stories
|
|
375
|
+
- **Coverage** — sub-stories must cover all parent acceptance criteria
|
|
376
|
+
- **Complexity** — each sub-story must be simpler than the parent
|
|
377
|
+
- **Dependencies** — dependency graph must be acyclic with valid references
|
|
378
|
+
4. The parent story is replaced in the PRD with the validated sub-stories
|
|
379
|
+
|
|
380
|
+
**Configuration:**
|
|
381
|
+
|
|
382
|
+
```json
|
|
383
|
+
{
|
|
384
|
+
"decompose": {
|
|
385
|
+
"enabled": true,
|
|
386
|
+
"maxSubStories": 5,
|
|
387
|
+
"minAcceptanceCriteria": 6,
|
|
388
|
+
"complexityThreshold": ["complex", "expert"]
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
## Regression Gate
|
|
396
|
+
|
|
397
|
+
After all stories pass their individual verification, nax can run a deferred full-suite regression gate to catch cross-story regressions.
|
|
398
|
+
|
|
399
|
+
```json
|
|
400
|
+
{
|
|
401
|
+
"execution": {
|
|
402
|
+
"regressionGate": {
|
|
403
|
+
"mode": "deferred",
|
|
404
|
+
"acceptOnTimeout": true,
|
|
405
|
+
"maxRectificationAttempts": 2
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
| Mode | Behaviour |
|
|
412
|
+
|:-----|:----------|
|
|
413
|
+
| `disabled` | No regression gate |
|
|
414
|
+
| `per-story` | Full suite after each story (expensive) |
|
|
415
|
+
| `deferred` | Full suite once after all stories pass (recommended) |
|
|
416
|
+
|
|
417
|
+
If the regression gate detects failures, nax maps them to the responsible story via git blame and attempts automated rectification. If rectification fails, affected stories are marked as `regression-failed`.
|
|
418
|
+
|
|
419
|
+
> **Smart skip (v0.34.0):** When all stories used `three-session-tdd` or `three-session-tdd-lite` in sequential mode, each story already ran the full suite gate. nax will skip the redundant deferred regression in this case.
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
277
423
|
## Hooks
|
|
278
424
|
|
|
279
425
|
Integrate notifications, CI triggers, or custom scripts via lifecycle hooks.
|
|
@@ -306,9 +452,22 @@ Integrate notifications, CI triggers, or custom scripts via lifecycle hooks.
|
|
|
306
452
|
| `on-pause` | Run paused (awaiting human input) |
|
|
307
453
|
| `on-resume` | Run resumed after pause |
|
|
308
454
|
| `on-session-end` | An agent session ends (per-session teardown) |
|
|
309
|
-
| `on-complete` | All stories
|
|
455
|
+
| `on-all-stories-complete` | All stories passed — regression gate pending *(v0.34.0)* |
|
|
456
|
+
| `on-final-regression-fail` | Deferred regression failed after rectification *(v0.34.0)* |
|
|
457
|
+
| `on-complete` | Everything finished and verified (including regression gate) |
|
|
310
458
|
| `on-error` | Unhandled error terminates the run |
|
|
311
459
|
|
|
460
|
+
**Hook lifecycle:**
|
|
461
|
+
|
|
462
|
+
```
|
|
463
|
+
on-start
|
|
464
|
+
└─ on-story-start → on-story-complete (or on-story-fail) ← per story
|
|
465
|
+
└─ on-all-stories-complete ← all stories done
|
|
466
|
+
└─ deferred regression gate (if enabled)
|
|
467
|
+
└─ on-final-regression-fail ← if regression fails
|
|
468
|
+
└─ on-complete ← everything verified
|
|
469
|
+
```
|
|
470
|
+
|
|
312
471
|
Each hook receives context via `NAX_*` environment variables and full JSON on stdin.
|
|
313
472
|
|
|
314
473
|
**Environment variables passed to hooks:**
|
|
@@ -348,6 +507,7 @@ nax can pause execution and prompt you for decisions at critical points. Configu
|
|
|
348
507
|
"max-retries": true,
|
|
349
508
|
"human-review": true,
|
|
350
509
|
"story-ambiguity": true,
|
|
510
|
+
"story-oversized": true,
|
|
351
511
|
"review-gate": true,
|
|
352
512
|
"pre-merge": false,
|
|
353
513
|
"merge-conflict": true
|
|
@@ -367,6 +527,7 @@ nax can pause execution and prompt you for decisions at critical points. Configu
|
|
|
367
527
|
| `max-retries` | 🟡 Yellow | `skip` | Story exhausted all retry attempts — skip and continue? |
|
|
368
528
|
| `pre-merge` | 🟡 Yellow | `escalate` | Checkpoint before merging to main branch |
|
|
369
529
|
| `human-review` | 🟡 Yellow | `skip` | Human review required on critical failure |
|
|
530
|
+
| `story-oversized` | 🟡 Yellow | `continue` | Story too complex — decompose into sub-stories? |
|
|
370
531
|
| `story-ambiguity` | 🟢 Green | `continue` | Story requirements unclear — continue with best effort? |
|
|
371
532
|
| `review-gate` | 🟢 Green | `continue` | Code review checkpoint before proceeding |
|
|
372
533
|
|
|
@@ -394,7 +555,9 @@ nax can pause execution and prompt you for decisions at critical points. Configu
|
|
|
394
555
|
|
|
395
556
|
## Plugins
|
|
396
557
|
|
|
397
|
-
Extend nax with custom reporters or integrations.
|
|
558
|
+
Extend nax with custom reviewers, reporters, or integrations.
|
|
559
|
+
|
|
560
|
+
**Project plugins** (`nax/config.json`):
|
|
398
561
|
|
|
399
562
|
```json
|
|
400
563
|
{
|
|
@@ -404,7 +567,29 @@ Extend nax with custom reporters or integrations. Configure in `nax/config.json`
|
|
|
404
567
|
}
|
|
405
568
|
```
|
|
406
569
|
|
|
407
|
-
Global plugin directory
|
|
570
|
+
**Global plugin directory:** `~/.nax/plugins/` — plugins here are loaded for all projects.
|
|
571
|
+
|
|
572
|
+
### Reviewer Plugins
|
|
573
|
+
|
|
574
|
+
Reviewer plugins run during the review pipeline stage and return structured `ReviewFinding` objects:
|
|
575
|
+
|
|
576
|
+
```typescript
|
|
577
|
+
interface ReviewFinding {
|
|
578
|
+
ruleId: string; // e.g. "javascript.express.security.audit.xss"
|
|
579
|
+
severity: "critical" | "error" | "warning" | "info" | "low";
|
|
580
|
+
file: string;
|
|
581
|
+
line: number;
|
|
582
|
+
column?: number;
|
|
583
|
+
message: string;
|
|
584
|
+
url?: string; // Link to rule documentation
|
|
585
|
+
source: string; // e.g. "semgrep", "eslint", "snyk"
|
|
586
|
+
category?: string; // e.g. "security", "performance"
|
|
587
|
+
}
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
Findings are threaded through the escalation pipeline — if a story fails review, the retry agent receives the exact file, line, and rule to fix.
|
|
591
|
+
|
|
592
|
+
**Example:** The built-in Semgrep reviewer plugin scans for security issues using `semgrep scan --config auto` and returns structured findings.
|
|
408
593
|
|
|
409
594
|
---
|
|
410
595
|
|