@nathapp/nax 0.28.0 → 0.30.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/CHANGELOG.md +23 -2
- package/bin/nax.ts +2 -3
- package/dist/nax.js +72753 -0
- package/package.json +11 -3
- package/src/cli/analyze.ts +2 -7
- package/src/cli/config.ts +3 -1
- package/src/config/defaults.ts +1 -0
- package/src/config/schemas.ts +1 -0
- package/src/config/types.ts +1 -0
- package/src/context/builder.ts +10 -1
- package/src/execution/lifecycle/headless-formatter.ts +2 -4
- package/src/prompts/builder.ts +12 -69
- package/src/prompts/sections/isolation.ts +38 -8
- package/src/prompts/sections/role-task.ts +79 -17
- package/src/review/runner.ts +6 -1
- package/src/version.ts +2 -1
- package/.claude/rules/01-project-conventions.md +0 -34
- package/.claude/rules/02-test-architecture.md +0 -39
- package/.claude/rules/03-test-writing.md +0 -58
- package/.claude/rules/04-forbidden-patterns.md +0 -29
- package/.claude/settings.json +0 -15
- package/.githooks/pre-commit +0 -16
- package/.gitlab-ci.yml +0 -103
- package/.mcp.json +0 -8
- package/BRIEF.md +0 -140
- package/CLAUDE.md +0 -143
- package/US-007-IMPLEMENTATION.md +0 -139
- package/biome.json +0 -14
- package/bun.lock +0 -163
- package/bunfig.toml +0 -12
- package/docker-compose.test.yml +0 -15
- package/docs/20260216-fix-plan-context-review.md +0 -56
- package/docs/20260216-relentless-vs-ngent-comparison.md +0 -208
- package/docs/20260216-v02-plan.md +0 -136
- package/docs/20260216-v02-review.md +0 -685
- package/docs/20260217-dogfood-findings.md +0 -56
- package/docs/20260217-p2-plus-plan.md +0 -117
- package/docs/20260217-partial-fixes-plan.md +0 -62
- package/docs/20260217-plan-analyze-spec.md +0 -117
- package/docs/20260217-post-impl-review.md +0 -1137
- package/docs/20260217-quick-wins-plan.md +0 -66
- package/docs/20260217-split-runner-plan.md +0 -75
- package/docs/20260217-v03-impl-plan.md +0 -80
- package/docs/20260217-v03-post-impl-review.md +0 -589
- package/docs/20260217-v04-impl-plan.md +0 -86
- package/docs/20260217-v05-post-impl-review.md +0 -850
- package/docs/20260217-v06-post-impl-review.md +0 -817
- package/docs/20260218-adr003-port-plan.md +0 -151
- package/docs/20260218-review-adr003-verification.md +0 -175
- package/docs/20260219-fix-plan-bug16-19.md +0 -79
- package/docs/20260219-fix-plan-bug20-22.md +0 -114
- package/docs/20260219-plan-llm-routing.md +0 -116
- package/docs/20260219-review-bug20-22-fixes.md +0 -135
- package/docs/20260219-routing-baseline-keyword.md +0 -63
- package/docs/20260220-plan-structured-logging-p1.md +0 -80
- package/docs/20260220-plan-structured-logging-p2.md +0 -37
- package/docs/20260220-review-llm-routing.md +0 -180
- package/docs/20260220-review-post-fix-llm-routing.md +0 -70
- package/docs/20260221-fix-plan-relevantfiles-split.md +0 -101
- package/docs/20260221-fix-plan-routing-mode.md +0 -125
- package/docs/20260221-review-v0.9-implementation.md +0 -379
- package/docs/20260222-fix-plan-v091-routing-isolation.md +0 -197
- package/docs/20260223-fix-plan-prompt-audit.md +0 -62
- package/docs/20260224-nax-roadmap-phases.md +0 -189
- package/docs/20260225-phase2-llm-service-layer.md +0 -401
- package/docs/20260225-review-v0.10.1.md +0 -187
- package/docs/20260303-v010-implementation-plan.md +0 -165
- package/docs/20260304-review-nax.md +0 -492
- package/docs/CLAUDE.md.bak +0 -191
- package/docs/ROADMAP.md +0 -390
- package/docs/SPEC-rectification.md +0 -0
- package/docs/SPEC.md +0 -324
- package/docs/US-001-plugin-loading-verification.md +0 -152
- package/docs/adr/ADR-005-implementation-plan.md +0 -655
- package/docs/adr/ADR-005-pipeline-re-architecture.md +0 -464
- package/docs/architecture-analysis.md +0 -1076
- package/docs/bugs/BUG-21-escalation-null-attempts.md +0 -48
- package/docs/bugs-from-dogfood-run-c.md +0 -243
- package/docs/code-review-20260228.md +0 -612
- package/docs/code-review-v0.15.0.md +0 -629
- package/docs/hook-lifecycle-test-plan.md +0 -149
- package/docs/releases/v0.11.0-and-earlier.md +0 -20
- package/docs/releases/v0.12.0.md +0 -15
- package/docs/releases/v0.13.0.md +0 -14
- package/docs/releases/v0.14.0.md +0 -20
- package/docs/releases/v0.14.1.md +0 -36
- package/docs/releases/v0.14.2.md +0 -51
- package/docs/releases/v0.14.3.md +0 -174
- package/docs/releases/v0.14.4.md +0 -94
- package/docs/releases/v0.15.0.md +0 -502
- package/docs/releases/v0.15.1.md +0 -170
- package/docs/releases/v0.15.3.md +0 -193
- package/docs/specs/bug-039-orphan-processes.md +0 -131
- package/docs/specs/bug-040-review-rectification.md +0 -82
- package/docs/specs/bug-041-cross-story-test-isolation.md +0 -88
- package/docs/specs/bug-042-verifier-failure-capture.md +0 -117
- package/docs/specs/bun-pty-migration.md +0 -171
- package/docs/specs/central-run-registry.md +0 -116
- package/docs/specs/feat-010-smart-runner-git-history.md +0 -96
- package/docs/specs/feat-011-file-context-strategy.md +0 -73
- package/docs/specs/feat-012-tdd-writer-tier.md +0 -79
- package/docs/specs/feat-013-test-after-review.md +0 -89
- package/docs/specs/feat-014-heartbeat-observability.md +0 -127
- package/docs/specs/status-file-consolidation.md +0 -93
- package/docs/specs/status-file-v0.10.1.md +0 -812
- package/docs/specs/trigger-completion.md +0 -145
- package/docs/specs/verification-architecture-v2.md +0 -343
- package/docs/tdd/strategies.md +0 -97
- package/docs/v0.10-global-config.md +0 -206
- package/docs/v0.10-plugin-system.md +0 -415
- package/docs/v0.10-prompt-optimizer.md +0 -234
- package/docs/v0.3-spec.md +0 -244
- package/docs/v0.4-spec.md +0 -140
- package/docs/v0.5-spec.md +0 -237
- package/docs/v0.6-spec.md +0 -371
- package/docs/v0.7-spec.md +0 -177
- package/docs/v0.8-llm-routing.md +0 -206
- package/docs/v0.8-structured-logging.md +0 -132
- package/docs/v0.9.3-prompt-audit.md +0 -112
- package/examples/plugins/console-reporter/index.test.ts +0 -207
- package/examples/plugins/console-reporter/index.ts +0 -110
- package/memory/topic/feat-010-baseref.md +0 -28
- package/memory/topic/feat-013-test-after-deprecation.md +0 -22
- package/nax/config.json +0 -154
- package/nax/features/bug-039-medium/prd.json +0 -45
- package/nax/features/bugfix-v0171/prd.json +0 -52
- package/nax/features/central-run-registry/prd.json +0 -105
- package/nax/features/config-management/prd.json +0 -108
- package/nax/features/config-management/progress.txt +0 -5
- package/nax/features/diagnose/acceptance.test.ts +0 -414
- package/nax/features/diagnose/prd.json +0 -41
- package/nax/features/nax-compliance/prd.json +0 -52
- package/nax/features/nax-compliance/progress.txt +0 -1
- package/nax/features/orchestration-fixes/prd.json +0 -89
- package/nax/features/orchestration-fixes/progress.txt +0 -1
- package/nax/features/plugin-integration/US-007-VERIFICATION.md +0 -259
- package/nax/features/plugin-integration/prd.json +0 -208
- package/nax/features/plugin-integration/progress.txt +0 -5
- package/nax/features/post-rearch-bugfix/prd.json +0 -137
- package/nax/features/precheck/prd.json +0 -205
- package/nax/features/precheck/progress.txt +0 -15
- package/nax/features/prompt-builder/prd.json +0 -152
- package/nax/features/prompt-builder/progress.txt +0 -3
- package/nax/features/review-quality/prd.json +0 -55
- package/nax/features/routing-persistence/prd.json +0 -104
- package/nax/features/routing-persistence/progress.txt +0 -1
- package/nax/features/smart-test-runner/plan.md +0 -7
- package/nax/features/smart-test-runner/prd.json +0 -203
- package/nax/features/smart-test-runner/progress.txt +0 -13
- package/nax/features/smart-test-runner/spec.md +0 -7
- package/nax/features/smart-test-runner/tasks.md +0 -8
- package/nax/features/status-file-consolidation/prd.json +0 -106
- package/nax/features/structured-logging/prd.json +0 -199
- package/nax/features/trigger-completion/prd.json +0 -150
- package/nax/features/trigger-completion/progress.txt +0 -7
- package/nax/features/unlock/prd.json +0 -36
- package/nax/features/v0.18.3-execution-reliability/prd.json +0 -80
- package/nax/features/v0.18.3-execution-reliability/progress.txt +0 -3
- package/nax/features/v0.19.0-hardening/plan.md +0 -7
- package/nax/features/v0.19.0-hardening/prd.json +0 -84
- package/nax/features/v0.19.0-hardening/progress.txt +0 -7
- package/nax/features/v0.19.0-hardening/spec.md +0 -18
- package/nax/features/v0.19.0-hardening/tasks.md +0 -8
- package/nax/features/verify-v2/prd.json +0 -79
- package/nax/features/verify-v2/progress.txt +0 -3
- package/nax/status.json +0 -36
- package/src/prompts/templates/implementer.ts +0 -6
- package/src/prompts/templates/single-session.ts +0 -6
- package/src/prompts/templates/test-writer.ts +0 -6
- package/src/prompts/templates/verifier.ts +0 -6
- package/test/COVERAGE-GAPS.md +0 -333
- package/test/e2e/cm-003-default-view.test.ts +0 -195
- package/test/e2e/plan-analyze-run.test.ts +0 -902
- package/test/helpers/helpers.test.ts +0 -295
- package/test/helpers/timeout.ts +0 -42
- package/test/integration/US-002-TEST-SUMMARY.md +0 -107
- package/test/integration/US-003-TEST-SUMMARY.md +0 -149
- package/test/integration/US-004-TEST-SUMMARY.md +0 -106
- package/test/integration/US-005-TEST-SUMMARY.md +0 -138
- package/test/integration/US-007-TEST-SUMMARY.md +0 -100
- package/test/integration/cli/agent-validation.test.ts +0 -439
- package/test/integration/cli/cli-config-default-edge-cases.test.ts +0 -223
- package/test/integration/cli/cli-config-default-view.test.ts +0 -230
- package/test/integration/cli/cli-config-diff.test.ts +0 -461
- package/test/integration/cli/cli-config-prompts-explain.test.ts +0 -74
- package/test/integration/cli/cli-config.test.ts +0 -737
- package/test/integration/cli/cli-diagnose.test.ts +0 -595
- package/test/integration/cli/cli-logs.test.ts +0 -346
- package/test/integration/cli/cli-plugins.test.ts +0 -679
- package/test/integration/cli/cli-precheck.test.ts +0 -372
- package/test/integration/cli/cli-run-headless.test.ts +0 -174
- package/test/integration/cli/cli.test.ts +0 -76
- package/test/integration/cli/precheck-integration.test.ts +0 -476
- package/test/integration/cli/precheck-orchestrator.test.ts +0 -247
- package/test/integration/cli/precheck.test.ts +0 -806
- package/test/integration/config/config-loader.test.ts +0 -266
- package/test/integration/config/config.test.ts +0 -444
- package/test/integration/config/merger.test.ts +0 -466
- package/test/integration/config/paths.test.ts +0 -52
- package/test/integration/config/security-loader.test.ts +0 -83
- package/test/integration/context/context-integration.test.ts +0 -703
- package/test/integration/context/context-path-security.test.ts +0 -173
- package/test/integration/context/context-provider-injection.test.ts +0 -507
- package/test/integration/context/context-verification-integration.test.ts +0 -296
- package/test/integration/context/s5-greenfield-fallback.test.ts +0 -298
- package/test/integration/execution/execution-isolation.test.ts +0 -143
- package/test/integration/execution/execution.test.ts +0 -634
- package/test/integration/execution/feature-status-write.test.ts +0 -302
- package/test/integration/execution/parallel.test.ts +0 -251
- package/test/integration/execution/prd-pause.test.ts +0 -205
- package/test/integration/execution/prd-resolvers.test.ts +0 -186
- package/test/integration/execution/progress.test.ts +0 -34
- package/test/integration/execution/runner-batching.test.ts +0 -682
- package/test/integration/execution/runner-config-plugins.test.ts +0 -462
- package/test/integration/execution/runner-escalation.test.ts +0 -561
- package/test/integration/execution/runner-fixes.test.ts +0 -400
- package/test/integration/execution/runner-plugin-integration.test.ts +0 -544
- package/test/integration/execution/runner-queue-and-attempts.test.ts +0 -476
- package/test/integration/execution/status-file-integration.test.ts +0 -289
- package/test/integration/execution/status-file.test.ts +0 -380
- package/test/integration/execution/status-writer.test.ts +0 -447
- package/test/integration/execution/story-id-in-events.test.ts +0 -274
- package/test/integration/interaction/interaction-chain-pipeline.test.ts +0 -476
- package/test/integration/pipeline/hooks.test.ts +0 -363
- package/test/integration/pipeline/pipeline-acceptance.test.ts +0 -303
- package/test/integration/pipeline/pipeline-events.test.ts +0 -476
- package/test/integration/pipeline/pipeline.test.ts +0 -660
- package/test/integration/pipeline/reporter-lifecycle.test.ts +0 -862
- package/test/integration/pipeline/verify-stage.test.ts +0 -286
- package/test/integration/plan/analyze-integration.test.ts +0 -262
- package/test/integration/plan/analyze-scanner.test.ts +0 -132
- package/test/integration/plan/logger.test.ts +0 -461
- package/test/integration/plan/plan.test.ts +0 -157
- package/test/integration/plugins/config-integration.test.ts +0 -173
- package/test/integration/plugins/config-resolution.test.ts +0 -523
- package/test/integration/plugins/loader.test.ts +0 -644
- package/test/integration/plugins/plugins-registry.test.ts +0 -747
- package/test/integration/plugins/validator.test.ts +0 -564
- package/test/integration/prompts/pb-004-migration.test.ts +0 -523
- package/test/integration/review/review-config-commands.test.ts +0 -320
- package/test/integration/review/review-config-schema.test.ts +0 -117
- package/test/integration/review/review-plugin-integration.test.ts +0 -729
- package/test/integration/review/review.test.ts +0 -150
- package/test/integration/routing/plugin-routing-advanced.test.ts +0 -461
- package/test/integration/routing/plugin-routing-core.test.ts +0 -527
- package/test/integration/routing/routing-stage-bug-021.test.ts +0 -275
- package/test/integration/routing/routing-stage-greenfield.test.ts +0 -287
- package/test/integration/tdd/tdd-cleanup.test.ts +0 -246
- package/test/integration/tdd/tdd-orchestrator-core.test.ts +0 -565
- package/test/integration/tdd/tdd-orchestrator-failureCategory.test.ts +0 -355
- package/test/integration/tdd/tdd-orchestrator-fallback.test.ts +0 -311
- package/test/integration/tdd/tdd-orchestrator-lite.test.ts +0 -289
- package/test/integration/tdd/tdd-orchestrator-prompts.test.ts +0 -260
- package/test/integration/tdd/tdd-orchestrator-verdict.test.ts +0 -536
- package/test/integration/tmp/headless-test/test.jsonl +0 -30
- package/test/integration/verification/test-scanner.test.ts +0 -403
- package/test/integration/verification/verification-asset-check.test.ts +0 -143
- package/test/integration/worktree/manager.test.ts +0 -218
- package/test/integration/worktree/worktree-merge.test.ts +0 -341
- package/test/manual/logging-formatter-demo.ts +0 -158
- package/test/ui/tui-agent-panel.test.tsx +0 -99
- package/test/ui/tui-pty-integration.test.tsx +0 -146
- package/test/unit/acceptance.test.ts +0 -187
- package/test/unit/agent-stderr-capture.test.ts +0 -147
- package/test/unit/agents/claude.test.ts +0 -107
- package/test/unit/analyze-classifier.test.ts +0 -216
- package/test/unit/analyze.test.ts +0 -224
- package/test/unit/auto-detect.test.ts +0 -250
- package/test/unit/cli-status-project-level.test.ts +0 -283
- package/test/unit/cli-status.test.ts +0 -418
- package/test/unit/commands/common.test.ts +0 -321
- package/test/unit/commands/logs.test.ts +0 -458
- package/test/unit/commands/runs.test.ts +0 -303
- package/test/unit/commands/unlock.test.ts +0 -320
- package/test/unit/config/defaults.test.ts +0 -70
- package/test/unit/config/quality-commands-schema.test.ts +0 -72
- package/test/unit/config/regression-gate-schema.test.ts +0 -160
- package/test/unit/config/smart-runner-flag.test.ts +0 -250
- package/test/unit/constitution-generators.test.ts +0 -161
- package/test/unit/constitution.test.ts +0 -210
- package/test/unit/context/context-autodetect.test.ts +0 -297
- package/test/unit/context/context-build.test.ts +0 -575
- package/test/unit/context/context-coverage.test.ts +0 -236
- package/test/unit/context/context-error.test.ts +0 -93
- package/test/unit/context/context-estimate-tokens.test.ts +0 -201
- package/test/unit/context/context-format.test.ts +0 -302
- package/test/unit/context/context-isolation.test.ts +0 -267
- package/test/unit/context/context-sort.test.ts +0 -93
- package/test/unit/context/context-story.test.ts +0 -108
- package/test/unit/context/prior-failures.test.ts +0 -463
- package/test/unit/context.test.ts +0 -1726
- package/test/unit/cost.test.ts +0 -231
- package/test/unit/crash-recovery.test.ts +0 -309
- package/test/unit/escalation.test.ts +0 -127
- package/test/unit/execution/lifecycle/run-completion.test.ts +0 -240
- package/test/unit/execution/lifecycle/run-regression.test.ts +0 -420
- package/test/unit/execution/pid-registry.test.ts +0 -241
- package/test/unit/execution/sequential-executor.test.ts +0 -235
- package/test/unit/execution/sfc-004-dead-code-cleanup.test.ts +0 -89
- package/test/unit/execution/structured-failure.test.ts +0 -415
- package/test/unit/execution-logging-stderr.test.ts +0 -157
- package/test/unit/execution-stage.test.ts +0 -123
- package/test/unit/fix-generator.test.ts +0 -276
- package/test/unit/formatters.test.ts +0 -468
- package/test/unit/greenfield.test.ts +0 -180
- package/test/unit/hooks/shell-security.test.ts +0 -40
- package/test/unit/interaction/auto-plugin.test.ts +0 -162
- package/test/unit/interaction/human-review-trigger.test.ts +0 -165
- package/test/unit/interaction-network-failures.test.ts +0 -390
- package/test/unit/interaction-plugins.test.ts +0 -472
- package/test/unit/logging/formatter.test.ts +0 -456
- package/test/unit/merge.test.ts +0 -269
- package/test/unit/metrics/aggregator.test.ts +0 -164
- package/test/unit/metrics/tracker.test.ts +0 -186
- package/test/unit/metrics.test.ts +0 -276
- package/test/unit/optimizer/noop.optimizer.test.ts +0 -125
- package/test/unit/optimizer/rule-based.optimizer.test.ts +0 -358
- package/test/unit/pipeline/event-bus.test.ts +0 -105
- package/test/unit/pipeline/routing-partial-override.test.ts +0 -121
- package/test/unit/pipeline/runner-retry.test.ts +0 -89
- package/test/unit/pipeline/stages/autofix.test.ts +0 -97
- package/test/unit/pipeline/stages/completion-review-gate.test.ts +0 -218
- package/test/unit/pipeline/stages/execution-ambiguity.test.ts +0 -311
- package/test/unit/pipeline/stages/execution-merge-conflict.test.ts +0 -218
- package/test/unit/pipeline/stages/rectify.test.ts +0 -101
- package/test/unit/pipeline/stages/regression-stage.test.ts +0 -69
- package/test/unit/pipeline/stages/review.test.ts +0 -201
- package/test/unit/pipeline/stages/routing-idempotence.test.ts +0 -139
- package/test/unit/pipeline/stages/routing-initial-complexity.test.ts +0 -321
- package/test/unit/pipeline/stages/routing-persistence.test.ts +0 -380
- package/test/unit/pipeline/stages/verify.test.ts +0 -267
- package/test/unit/pipeline/subscribers/events-writer.test.ts +0 -227
- package/test/unit/pipeline/subscribers/hooks.test.ts +0 -84
- package/test/unit/pipeline/subscribers/interaction.test.ts +0 -313
- package/test/unit/pipeline/subscribers/registry.test.ts +0 -149
- package/test/unit/pipeline/subscribers/reporters.test.ts +0 -90
- package/test/unit/pipeline/verify-smart-runner.test.ts +0 -345
- package/test/unit/prd-auto-default.test.ts +0 -291
- package/test/unit/prd-failure-category.test.ts +0 -177
- package/test/unit/prd-get-next-story.test.ts +0 -215
- package/test/unit/precheck/checks-warnings.test.ts +0 -114
- package/test/unit/precheck-checks.test.ts +0 -841
- package/test/unit/precheck-story-size-gate.test.ts +0 -288
- package/test/unit/precheck-types.test.ts +0 -143
- package/test/unit/prompts/builder.test.ts +0 -258
- package/test/unit/prompts/loader.test.ts +0 -355
- package/test/unit/prompts/sections/conventions.test.ts +0 -30
- package/test/unit/prompts/sections/isolation.test.ts +0 -35
- package/test/unit/prompts/sections/role-task.test.ts +0 -40
- package/test/unit/prompts/sections/sections.test.ts +0 -238
- package/test/unit/prompts/sections/story.test.ts +0 -45
- package/test/unit/prompts/sections/verdict.test.ts +0 -58
- package/test/unit/prompts.test.ts +0 -476
- package/test/unit/queue.test.ts +0 -237
- package/test/unit/rectification.test.ts +0 -285
- package/test/unit/registry.test.ts +0 -288
- package/test/unit/review/runner.test.ts +0 -117
- package/test/unit/routing/content-hash.test.ts +0 -99
- package/test/unit/routing/routing-stability.test.ts +0 -208
- package/test/unit/routing/strategies/llm.test.ts +0 -306
- package/test/unit/routing-advanced.test.ts +0 -313
- package/test/unit/routing-core.test.ts +0 -341
- package/test/unit/routing-strategies.test.ts +0 -440
- package/test/unit/storyid-events.test.ts +0 -213
- package/test/unit/tdd-verdict.test.ts +0 -492
- package/test/unit/test-output-parser.test.ts +0 -377
- package/test/unit/ui/tui-controls.test.ts +0 -335
- package/test/unit/ui/tui-cost-and-pty.test.ts +0 -190
- package/test/unit/ui/tui-layout.test.ts +0 -379
- package/test/unit/ui/tui-stories.test.ts +0 -333
- package/test/unit/unit-isolation.test.ts +0 -135
- package/test/unit/utils/git.test.ts +0 -50
- package/test/unit/utils/path-security.test.ts +0 -47
- package/test/unit/utils-helpers.test.ts +0 -318
- package/test/unit/verdict.test.ts +0 -325
- package/test/unit/verification/orchestrator-types.test.ts +0 -54
- package/test/unit/verification/orchestrator.test.ts +0 -66
- package/test/unit/verification/smart-runner-config.test.ts +0 -163
- package/test/unit/verification/smart-runner-discovery.test.ts +0 -354
- package/test/unit/verification/smart-runner.test.ts +0 -262
- package/test/unit/verification/strategies/acceptance.test.ts +0 -33
- package/test/unit/verification/strategies/regression.test.ts +0 -87
- package/test/unit/verification/strategies/scoped.test.ts +0 -100
- package/test/unit/worktree-manager.test.ts +0 -159
- package/tsconfig.json +0 -27
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nathapp/nax",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"description": "AI Coding Agent Orchestrator \u2014 loops until done",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"nax": "./
|
|
7
|
+
"nax": "./dist/nax.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"prepare": "git config core.hooksPath .githooks",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"test:watch": "bun test --watch",
|
|
17
17
|
"test:unit": "bun test ./test/unit/ --timeout=60000",
|
|
18
18
|
"test:integration": "bun test ./test/integration/ --timeout=60000",
|
|
19
|
-
"test:ui": "bun test ./test/ui/ --timeout=60000"
|
|
19
|
+
"test:ui": "bun test ./test/ui/ --timeout=60000",
|
|
20
|
+
"prepublishOnly": "bun run build"
|
|
20
21
|
},
|
|
21
22
|
"dependencies": {
|
|
22
23
|
"@anthropic-ai/sdk": "^0.74.0",
|
|
@@ -43,5 +44,12 @@
|
|
|
43
44
|
"orchestrator",
|
|
44
45
|
"tdd",
|
|
45
46
|
"coding"
|
|
47
|
+
],
|
|
48
|
+
"files": [
|
|
49
|
+
"dist/",
|
|
50
|
+
"src/",
|
|
51
|
+
"bin/",
|
|
52
|
+
"README.md",
|
|
53
|
+
"CHANGELOG.md"
|
|
46
54
|
]
|
|
47
55
|
}
|
package/src/cli/analyze.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { resolveModel } from "../config/schema";
|
|
|
15
15
|
import { getLogger } from "../logger";
|
|
16
16
|
import type { PRD, UserStory } from "../prd";
|
|
17
17
|
import { routeTask } from "../routing";
|
|
18
|
+
import { NAX_VERSION } from "../version";
|
|
18
19
|
import {
|
|
19
20
|
applyKeywordClassification,
|
|
20
21
|
buildCodebaseContext,
|
|
@@ -63,13 +64,7 @@ export async function analyzeFeature(options: AnalyzeOptions): Promise<PRD> {
|
|
|
63
64
|
);
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
try {
|
|
68
|
-
const pkgPath = new URL("../../package.json", import.meta.url);
|
|
69
|
-
naxVersion = (await Bun.file(pkgPath).json()).version;
|
|
70
|
-
} catch {
|
|
71
|
-
/* version is metadata only */
|
|
72
|
-
}
|
|
67
|
+
const naxVersion = NAX_VERSION;
|
|
73
68
|
|
|
74
69
|
const now = new Date().toISOString();
|
|
75
70
|
const prd: PRD = {
|
package/src/cli/config.ts
CHANGED
|
@@ -143,6 +143,8 @@ const FIELD_DESCRIPTIONS: Record<string, string> = {
|
|
|
143
143
|
|
|
144
144
|
// Context
|
|
145
145
|
context: "Context injection configuration",
|
|
146
|
+
"context.fileInjection":
|
|
147
|
+
"Mode: 'disabled' (default, MCP-aware agents pull context on-demand) | 'keyword' (legacy git-grep injection for non-MCP agents). Set context.fileInjection in config.",
|
|
146
148
|
"context.testCoverage": "Test coverage context settings",
|
|
147
149
|
"context.testCoverage.enabled": "Enable test coverage context injection",
|
|
148
150
|
"context.testCoverage.detail": "Detail level: names-only | names-and-counts | describe-blocks",
|
|
@@ -517,7 +519,7 @@ function displayConfigWithDescriptions(
|
|
|
517
519
|
|
|
518
520
|
// Display description comment if available
|
|
519
521
|
if (description) {
|
|
520
|
-
// Include path
|
|
522
|
+
// Include path for prompts section (where tests expect "prompts.overrides" to appear)
|
|
521
523
|
const isPromptsSubSection = currentPathStr.startsWith("prompts.");
|
|
522
524
|
const comment = isPromptsSubSection ? `${currentPathStr}: ${description}` : description;
|
|
523
525
|
console.log(`${indentStr}# ${comment}`);
|
package/src/config/defaults.ts
CHANGED
package/src/config/schemas.ts
CHANGED
|
@@ -202,6 +202,7 @@ const ContextAutoDetectConfigSchema = z.object({
|
|
|
202
202
|
const ContextConfigSchema = z.object({
|
|
203
203
|
testCoverage: TestCoverageConfigSchema,
|
|
204
204
|
autoDetect: ContextAutoDetectConfigSchema,
|
|
205
|
+
fileInjection: z.enum(["keyword", "disabled"]).default("disabled"),
|
|
205
206
|
});
|
|
206
207
|
|
|
207
208
|
const AdaptiveRoutingConfigSchema = z.object({
|
package/src/config/types.ts
CHANGED
|
@@ -339,6 +339,7 @@ export interface ContextAutoDetectConfig {
|
|
|
339
339
|
export interface ContextConfig {
|
|
340
340
|
testCoverage: TestCoverageConfig;
|
|
341
341
|
autoDetect: ContextAutoDetectConfig;
|
|
342
|
+
fileInjection?: "keyword" | "disabled";
|
|
342
343
|
}
|
|
343
344
|
|
|
344
345
|
/** Story size gate thresholds (v0.16.0) */
|
package/src/context/builder.ts
CHANGED
|
@@ -23,6 +23,11 @@ import {
|
|
|
23
23
|
import { generateTestCoverageSummary } from "./test-scanner";
|
|
24
24
|
import type { BuiltContext, ContextBudget, ContextElement, StoryContext } from "./types";
|
|
25
25
|
|
|
26
|
+
// Dependency injection for testability
|
|
27
|
+
export const _deps = {
|
|
28
|
+
autoDetectContextFiles,
|
|
29
|
+
};
|
|
30
|
+
|
|
26
31
|
// Re-export for backward compatibility
|
|
27
32
|
export {
|
|
28
33
|
estimateTokens,
|
|
@@ -188,6 +193,10 @@ async function addFileElements(
|
|
|
188
193
|
const MAX_FILE_SIZE_BYTES = 10 * 1024;
|
|
189
194
|
const MAX_FILES = 5;
|
|
190
195
|
|
|
196
|
+
// Skip all file injection when fileInjection is 'disabled' or undefined (treat missing as disabled)
|
|
197
|
+
const fileInjection = storyContext.config?.context?.fileInjection;
|
|
198
|
+
if (fileInjection !== "keyword") return;
|
|
199
|
+
|
|
191
200
|
let contextFiles = getContextFiles(story);
|
|
192
201
|
|
|
193
202
|
// Auto-detect contextFiles if empty and enabled (BUG-006)
|
|
@@ -198,7 +207,7 @@ async function addFileElements(
|
|
|
198
207
|
) {
|
|
199
208
|
const autoDetectConfig = storyContext.config?.context?.autoDetect;
|
|
200
209
|
try {
|
|
201
|
-
const detected = await autoDetectContextFiles({
|
|
210
|
+
const detected = await _deps.autoDetectContextFiles({
|
|
202
211
|
workdir: storyContext.workdir,
|
|
203
212
|
storyTitle: story.title,
|
|
204
213
|
maxFiles: autoDetectConfig?.maxFiles ?? 5,
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* Extracts run header and footer formatting logic from runner.ts.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import path from "node:path";
|
|
9
8
|
import chalk from "chalk";
|
|
10
9
|
import type { RunSummary } from "../../logging";
|
|
11
10
|
import { formatRunSummary } from "../../logging";
|
|
11
|
+
import { NAX_VERSION } from "../../version";
|
|
12
12
|
|
|
13
13
|
export interface RunHeaderOptions {
|
|
14
14
|
feature: string;
|
|
@@ -42,11 +42,9 @@ export async function outputRunHeader(options: RunHeaderOptions): Promise<void>
|
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
const pkg = await Bun.file(path.join(import.meta.dir, "..", "..", "..", "package.json")).json();
|
|
46
|
-
|
|
47
45
|
console.log("");
|
|
48
46
|
console.log(chalk.bold(chalk.blue("═".repeat(60))));
|
|
49
|
-
console.log(chalk.bold(chalk.blue(` ▶ NAX v${
|
|
47
|
+
console.log(chalk.bold(chalk.blue(` ▶ NAX v${NAX_VERSION} — RUN STARTED`)));
|
|
50
48
|
console.log(chalk.blue("═".repeat(60)));
|
|
51
49
|
console.log(` ${chalk.gray("Feature:")} ${chalk.cyan(feature)}`);
|
|
52
50
|
console.log(` ${chalk.gray("Stories:")} ${chalk.cyan(`${totalStories} total, ${pendingStories} pending`)}`);
|
package/src/prompts/builder.ts
CHANGED
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
|
|
13
13
|
import type { NaxConfig } from "../config/types";
|
|
14
14
|
import type { UserStory } from "../prd";
|
|
15
|
+
import { buildConventionsSection } from "./sections/conventions";
|
|
16
|
+
import { buildIsolationSection } from "./sections/isolation";
|
|
17
|
+
import { buildRoleTaskSection } from "./sections/role-task";
|
|
18
|
+
import { buildStorySection } from "./sections/story";
|
|
15
19
|
import type { PromptOptions, PromptRole } from "./types";
|
|
16
20
|
|
|
17
21
|
const SECTION_SEP = "\n\n---\n\n";
|
|
@@ -69,16 +73,17 @@ export class PromptBuilder {
|
|
|
69
73
|
sections.push(`# CONSTITUTION (follow these rules strictly)\n\n${this._constitution}`);
|
|
70
74
|
}
|
|
71
75
|
|
|
72
|
-
// (2) Role task body — user override or default
|
|
76
|
+
// (2) Role task body — user override or default section
|
|
73
77
|
sections.push(await this._resolveRoleBody());
|
|
74
78
|
|
|
75
79
|
// (3) Story context — non-overridable
|
|
76
80
|
if (this._story) {
|
|
77
|
-
sections.push(
|
|
81
|
+
sections.push(buildStorySection(this._story));
|
|
78
82
|
}
|
|
79
83
|
|
|
80
84
|
// (4) Isolation rules — non-overridable
|
|
81
|
-
|
|
85
|
+
const isolation = this._options.isolation as string | undefined;
|
|
86
|
+
sections.push(buildIsolationSection(this._role, isolation as "strict" | "lite" | undefined));
|
|
82
87
|
|
|
83
88
|
// (5) Context markdown
|
|
84
89
|
if (this._contextMd) {
|
|
@@ -86,7 +91,7 @@ export class PromptBuilder {
|
|
|
86
91
|
}
|
|
87
92
|
|
|
88
93
|
// (6) Conventions footer — non-overridable, always last
|
|
89
|
-
sections.push(
|
|
94
|
+
sections.push(buildConventionsSection());
|
|
90
95
|
|
|
91
96
|
return sections.join(SECTION_SEP);
|
|
92
97
|
}
|
|
@@ -107,72 +112,10 @@ export class PromptBuilder {
|
|
|
107
112
|
return await file.text();
|
|
108
113
|
}
|
|
109
114
|
} catch {
|
|
110
|
-
// fall through to default
|
|
115
|
+
// fall through to default section
|
|
111
116
|
}
|
|
112
117
|
}
|
|
113
|
-
|
|
118
|
+
const variant = this._options.variant as "standard" | "lite" | undefined;
|
|
119
|
+
return buildRoleTaskSection(this._role, variant);
|
|
114
120
|
}
|
|
115
121
|
}
|
|
116
|
-
|
|
117
|
-
// ---------------------------------------------------------------------------
|
|
118
|
-
// Section builders (module-private)
|
|
119
|
-
// ---------------------------------------------------------------------------
|
|
120
|
-
|
|
121
|
-
function buildDefaultRoleBody(role: PromptRole, title = "", options: PromptOptions = {}): string {
|
|
122
|
-
const variant = options.variant as string | undefined;
|
|
123
|
-
switch (role) {
|
|
124
|
-
case "test-writer":
|
|
125
|
-
return `# Test Writer — "${title}"\n\nYour role: Write failing tests ONLY. Do NOT implement any source code.`;
|
|
126
|
-
case "implementer":
|
|
127
|
-
if (variant === "lite") {
|
|
128
|
-
return `# Implementer (Lite) — "${title}"\n\nYour role: Write tests AND implement the feature in a single session.`;
|
|
129
|
-
}
|
|
130
|
-
return `# Implementer — "${title}"\n\nYour role: Make all failing tests pass.`;
|
|
131
|
-
case "verifier":
|
|
132
|
-
return `# Verifier — "${title}"\n\nYour role: Verify the implementation and tests.`;
|
|
133
|
-
case "single-session":
|
|
134
|
-
return `# Task — "${title}"\n\nYour role: Write tests AND implement the feature in a single session.`;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function buildStoryContext(story: UserStory): string {
|
|
139
|
-
return `# Story Context
|
|
140
|
-
|
|
141
|
-
**Story:** ${story.title}
|
|
142
|
-
|
|
143
|
-
**Description:**
|
|
144
|
-
${story.description}
|
|
145
|
-
|
|
146
|
-
**Acceptance Criteria:**
|
|
147
|
-
${story.acceptanceCriteria.map((c, i) => `${i + 1}. ${c}`).join("\n")}`;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
const TEST_FILTER_RULE =
|
|
151
|
-
"When running tests, run ONLY test files related to your changes" +
|
|
152
|
-
" (e.g. `bun test ./test/specific.test.ts`). NEVER run `bun test` without a file filter" +
|
|
153
|
-
" — full suite output will flood your context window and cause failures.";
|
|
154
|
-
|
|
155
|
-
function buildIsolationRules(role: PromptRole, options: PromptOptions = {}): string {
|
|
156
|
-
const header = "# Isolation Rules\n\n";
|
|
157
|
-
const footer = `\n\n${TEST_FILTER_RULE}`;
|
|
158
|
-
const isolation = options.isolation as string | undefined;
|
|
159
|
-
|
|
160
|
-
switch (role) {
|
|
161
|
-
case "test-writer":
|
|
162
|
-
if (isolation === "lite") {
|
|
163
|
-
return `${header}isolation scope: Primarily create test files in the test/ directory. You MAY read source files and MAY import from source files to ensure correct types/interfaces. Stub-only src/ files are allowed (empty exports, no logic). Tests must fail for the right reasons (feature not implemented).${footer}`;
|
|
164
|
-
}
|
|
165
|
-
return `${header}isolation scope: Only create or modify files in the test/ directory. Tests must fail because the feature is not yet implemented. Do NOT modify any source files in src/.${footer}`;
|
|
166
|
-
case "implementer":
|
|
167
|
-
return `${header}isolation scope: Implement source code in src/ to make the tests pass. Do NOT modify test files. Run tests frequently to track progress.${footer}`;
|
|
168
|
-
case "verifier":
|
|
169
|
-
return `${header}isolation scope: Verify and fix only — do not change behaviour unless it violates acceptance criteria. Ensure all tests pass and all criteria are met.${footer}`;
|
|
170
|
-
case "single-session":
|
|
171
|
-
return `${header}isolation scope: Write tests first (test/ directory), then implement (src/ directory). All tests must pass by the end.${footer}`;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
const CONVENTIONS_FOOTER =
|
|
176
|
-
"# Conventions\n\n" +
|
|
177
|
-
"Follow existing code patterns and conventions. Write idiomatic, maintainable code." +
|
|
178
|
-
" Commit your changes when done.";
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Isolation Rules Section
|
|
3
3
|
*
|
|
4
|
-
* Generates isolation rules
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
4
|
+
* Generates isolation rules for all 4 roles:
|
|
5
|
+
* - test-writer: Strict/Lite modes for test-first TDD
|
|
6
|
+
* - implementer: Implement source while respecting test integrity
|
|
7
|
+
* - verifier: Read-only inspection
|
|
8
|
+
* - single-session: Both test/ and src/ modification allowed
|
|
9
|
+
*
|
|
10
|
+
* Backwards compatible: also accepts old API (mode only)
|
|
11
|
+
* - buildIsolationSection("strict") → test-writer, strict
|
|
12
|
+
* - buildIsolationSection("lite") → test-writer, lite
|
|
7
13
|
*/
|
|
8
14
|
|
|
9
15
|
const TEST_FILTER_RULE =
|
|
@@ -11,14 +17,38 @@ const TEST_FILTER_RULE =
|
|
|
11
17
|
"(e.g. `bun test ./test/specific.test.ts`). NEVER run `bun test` without a file filter " +
|
|
12
18
|
"— full suite output will flood your context window and cause failures.";
|
|
13
19
|
|
|
14
|
-
export function buildIsolationSection(
|
|
20
|
+
export function buildIsolationSection(
|
|
21
|
+
roleOrMode: "implementer" | "test-writer" | "verifier" | "single-session" | "strict" | "lite",
|
|
22
|
+
mode?: "strict" | "lite",
|
|
23
|
+
): string {
|
|
24
|
+
// Old API support: buildIsolationSection("strict") or buildIsolationSection("lite")
|
|
25
|
+
if ((roleOrMode === "strict" || roleOrMode === "lite") && mode === undefined) {
|
|
26
|
+
return buildIsolationSection("test-writer", roleOrMode);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const role = roleOrMode as "implementer" | "test-writer" | "verifier" | "single-session";
|
|
30
|
+
|
|
15
31
|
const header = "# Isolation Rules\n\n";
|
|
16
32
|
const footer = `\n\n${TEST_FILTER_RULE}`;
|
|
17
33
|
|
|
18
|
-
if (
|
|
19
|
-
|
|
34
|
+
if (role === "test-writer") {
|
|
35
|
+
const m = mode ?? "strict";
|
|
36
|
+
if (m === "strict") {
|
|
37
|
+
return `${header}isolation scope: Only create or modify files in the test/ directory. Tests must fail because the feature is not yet implemented. Do NOT modify any source files in src/.${footer}`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// lite mode for test-writer
|
|
41
|
+
return `${header}isolation scope: Create test files in test/. MAY read src/ files and MAY import from src/ to ensure correct types/interfaces. May create minimal stubs in src/ if needed to make imports work, but do NOT implement real logic.${footer}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (role === "implementer") {
|
|
45
|
+
return `${header}isolation scope: Implement source code in src/ to make tests pass. Do not modify test files. Run tests frequently to track progress.${footer}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (role === "verifier") {
|
|
49
|
+
return `${header}isolation scope: Read-only inspection. Review all test results, implementation code, and acceptance criteria compliance. You MAY write a verdict file (.nax-verifier-verdict.json) and apply legitimate fixes if needed.${footer}`;
|
|
20
50
|
}
|
|
21
51
|
|
|
22
|
-
//
|
|
23
|
-
return `${header}isolation scope: Create test files in test
|
|
52
|
+
// single-session role
|
|
53
|
+
return `${header}isolation scope: Create test files in test/ directory, then implement source code in src/ to make tests pass. Both directories are in scope for this session.${footer}`;
|
|
24
54
|
}
|
|
@@ -1,32 +1,94 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Role-Task Section
|
|
3
3
|
*
|
|
4
|
-
* Generates role definition for:
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
4
|
+
* Generates role definition for all 4 roles in nax prompt orchestration:
|
|
5
|
+
* - implementer: Make failing tests pass (standard/lite variants)
|
|
6
|
+
* - test-writer: Write tests first (RED phase)
|
|
7
|
+
* - verifier: Review and verify implementation
|
|
8
|
+
* - single-session: Write tests AND implement in one session
|
|
9
|
+
*
|
|
10
|
+
* Backwards compatible: also accepts old API (variant only)
|
|
11
|
+
* - buildRoleTaskSection("standard") → implementer, standard
|
|
12
|
+
* - buildRoleTaskSection("lite") → implementer, lite
|
|
7
13
|
*/
|
|
8
14
|
|
|
9
|
-
export function buildRoleTaskSection(
|
|
10
|
-
|
|
15
|
+
export function buildRoleTaskSection(
|
|
16
|
+
roleOrVariant: "implementer" | "test-writer" | "verifier" | "single-session" | "standard" | "lite",
|
|
17
|
+
variant?: "standard" | "lite",
|
|
18
|
+
): string {
|
|
19
|
+
// Old API support: buildRoleTaskSection("standard") or buildRoleTaskSection("lite")
|
|
20
|
+
if ((roleOrVariant === "standard" || roleOrVariant === "lite") && variant === undefined) {
|
|
21
|
+
return buildRoleTaskSection("implementer", roleOrVariant);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const role = roleOrVariant as "implementer" | "test-writer" | "verifier" | "single-session";
|
|
25
|
+
|
|
26
|
+
if (role === "implementer") {
|
|
27
|
+
const v = variant ?? "standard";
|
|
28
|
+
if (v === "standard") {
|
|
29
|
+
return (
|
|
30
|
+
"# Role: Implementer\n\n" +
|
|
31
|
+
"Your task: make failing tests pass.\n\n" +
|
|
32
|
+
"Instructions:\n" +
|
|
33
|
+
"- Implement source code in src/ to make tests pass\n" +
|
|
34
|
+
"- Do NOT modify test files\n" +
|
|
35
|
+
"- Run tests frequently to track progress\n" +
|
|
36
|
+
"- When all tests are green, stage and commit ALL changed files with: git commit -m 'feat: <description>'\n" +
|
|
37
|
+
"- Goal: all tests green, all changes committed"
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// lite variant
|
|
42
|
+
return (
|
|
43
|
+
"# Role: Implementer (Lite)\n\n" +
|
|
44
|
+
"Your task: Write tests AND implement the feature in a single session.\n\n" +
|
|
45
|
+
"Instructions:\n" +
|
|
46
|
+
"- Write tests first (test/ directory), then implement (src/ directory)\n" +
|
|
47
|
+
"- All tests must pass by the end\n" +
|
|
48
|
+
"- Use Bun test (describe/test/expect)\n" +
|
|
49
|
+
"- When all tests are green, stage and commit ALL changed files with: git commit -m 'feat: <description>'\n" +
|
|
50
|
+
"- Goal: all tests green, all criteria met, all changes committed"
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (role === "test-writer") {
|
|
55
|
+
return (
|
|
56
|
+
"# Role: Test-Writer\n\n" +
|
|
57
|
+
"Your task: Write comprehensive failing tests for the feature.\n\n" +
|
|
58
|
+
"Instructions:\n" +
|
|
59
|
+
"- Create test files in test/ directory that cover acceptance criteria\n" +
|
|
60
|
+
"- Tests must fail initially (RED phase) — the feature is not yet implemented\n" +
|
|
61
|
+
"- Use Bun test (describe/test/expect)\n" +
|
|
62
|
+
"- Write clear test names that document expected behavior\n" +
|
|
63
|
+
"- Focus on behavior, not implementation details\n" +
|
|
64
|
+
"- Goal: comprehensive test suite ready for implementation"
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (role === "verifier") {
|
|
11
69
|
return (
|
|
12
|
-
"# Role:
|
|
13
|
-
"Your task:
|
|
70
|
+
"# Role: Verifier\n\n" +
|
|
71
|
+
"Your task: Review and verify the implementation against acceptance criteria.\n\n" +
|
|
14
72
|
"Instructions:\n" +
|
|
15
|
-
"-
|
|
16
|
-
"-
|
|
17
|
-
"-
|
|
18
|
-
"-
|
|
73
|
+
"- Review all test results — verify tests pass\n" +
|
|
74
|
+
"- Check that implementation meets all acceptance criteria\n" +
|
|
75
|
+
"- Inspect code quality, error handling, and edge cases\n" +
|
|
76
|
+
"- Verify test modifications (if any) are legitimate fixes\n" +
|
|
77
|
+
"- Write a detailed verdict with reasoning\n" +
|
|
78
|
+
"- Goal: provide comprehensive verification and quality assurance"
|
|
19
79
|
);
|
|
20
80
|
}
|
|
21
81
|
|
|
22
|
-
//
|
|
82
|
+
// single-session role
|
|
23
83
|
return (
|
|
24
|
-
"# Role:
|
|
25
|
-
"Your task: Write tests AND implement the feature in a single session.\n\n" +
|
|
84
|
+
"# Role: Single-Session\n\n" +
|
|
85
|
+
"Your task: Write tests AND implement the feature in a single focused session.\n\n" +
|
|
26
86
|
"Instructions:\n" +
|
|
27
|
-
"- Write tests
|
|
28
|
-
"-
|
|
87
|
+
"- Phase 1: Write comprehensive tests (test/ directory)\n" +
|
|
88
|
+
"- Phase 2: Implement to make all tests pass (src/ directory)\n" +
|
|
29
89
|
"- Use Bun test (describe/test/expect)\n" +
|
|
30
|
-
"-
|
|
90
|
+
"- Run tests frequently throughout implementation\n" +
|
|
91
|
+
"- When all tests are green, stage and commit ALL changed files with: git commit -m 'feat: <description>'\n" +
|
|
92
|
+
"- Goal: all tests passing, all changes committed, full story complete"
|
|
31
93
|
);
|
|
32
94
|
}
|
package/src/review/runner.ts
CHANGED
|
@@ -208,7 +208,12 @@ export async function runReview(
|
|
|
208
208
|
let firstFailure: string | undefined;
|
|
209
209
|
|
|
210
210
|
// RQ-001: Check for uncommitted tracked files before running checks
|
|
211
|
-
const
|
|
211
|
+
const allUncommittedFiles = await _deps.getUncommittedFiles(workdir);
|
|
212
|
+
// Exclude nax runtime files — written by nax itself during the run, not by the agent
|
|
213
|
+
const NAX_RUNTIME_FILES = new Set(["nax/status.json", ".nax-verifier-verdict.json"]);
|
|
214
|
+
const uncommittedFiles = allUncommittedFiles.filter(
|
|
215
|
+
(f) => !NAX_RUNTIME_FILES.has(f) && !f.match(/^nax\/features\/.+\/prd\.json$/),
|
|
216
|
+
);
|
|
212
217
|
if (uncommittedFiles.length > 0) {
|
|
213
218
|
const fileList = uncommittedFiles.join(", ");
|
|
214
219
|
logger?.warn("review", `Uncommitted changes detected before review: ${fileList}`);
|
package/src/version.ts
CHANGED
|
@@ -36,4 +36,5 @@ export const NAX_COMMIT: string = (() => {
|
|
|
36
36
|
return "dev";
|
|
37
37
|
})();
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
/** Human-readable build info string — omits commit when unavailable. */
|
|
40
|
+
export const NAX_BUILD_INFO: string = NAX_COMMIT === "dev" ? `v${NAX_VERSION}` : `v${NAX_VERSION} (${NAX_COMMIT})`;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# Project Conventions
|
|
2
|
-
|
|
3
|
-
## Language & Runtime
|
|
4
|
-
|
|
5
|
-
- **Bun-native only.** Use `Bun.file()`, `Bun.write()`, `Bun.spawn()`, `Bun.sleep()`. Never use Node.js equivalents (`fs.readFile`, `child_process.spawn`, `setTimeout` for delays).
|
|
6
|
-
- TypeScript strict mode. No `any` unless unavoidable (document why).
|
|
7
|
-
- Target: Bun 1.3.7+.
|
|
8
|
-
|
|
9
|
-
## File Size
|
|
10
|
-
|
|
11
|
-
- **400-line hard limit** for all source and test files.
|
|
12
|
-
- If a file approaches 400 lines, split it before adding more code.
|
|
13
|
-
- Split by logical concern (one function/class per file when possible).
|
|
14
|
-
|
|
15
|
-
## Module Structure
|
|
16
|
-
|
|
17
|
-
- Every directory with 2+ exports gets a barrel `index.ts`.
|
|
18
|
-
- Types go in `types.ts` per module directory.
|
|
19
|
-
- Import from barrels (`src/routing`), **never from internal paths** (`src/routing/router`). This prevents singleton fragmentation in Bun's module registry.
|
|
20
|
-
|
|
21
|
-
## Logging
|
|
22
|
-
|
|
23
|
-
- Use the project logger (`src/logger`). Never use `console.log` / `console.error` in source code.
|
|
24
|
-
- Log format: no emojis. Use `[OK]`, `[WARN]`, `[FAIL]`, `->`. Machine-parseable.
|
|
25
|
-
|
|
26
|
-
## Commits
|
|
27
|
-
|
|
28
|
-
- Conventional commits: `feat:`, `fix:`, `refactor:`, `test:`, `docs:`, `chore:`.
|
|
29
|
-
- Atomic — one logical change per commit.
|
|
30
|
-
- Never include `[run-release]` unless explicitly told to.
|
|
31
|
-
|
|
32
|
-
## Formatting
|
|
33
|
-
|
|
34
|
-
- Biome handles formatting and linting. Run `bun run lint` before committing.
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# Test Architecture
|
|
2
|
-
|
|
3
|
-
## Directory Structure
|
|
4
|
-
|
|
5
|
-
Tests **must** mirror the `src/` directory structure:
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
src/routing/strategies/foo.ts → test/unit/routing/strategies/foo.test.ts
|
|
9
|
-
src/execution/runner.ts → test/unit/execution/runner.test.ts
|
|
10
|
-
src/pipeline/stages/verify.ts → test/unit/pipeline/stages/verify.test.ts
|
|
11
|
-
src/verification/smart-runner.ts → test/unit/verification/smart-runner.test.ts
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Test Categories
|
|
15
|
-
|
|
16
|
-
| Category | Location | Purpose |
|
|
17
|
-
|:---|:---|:---|
|
|
18
|
-
| Unit | `test/unit/<mirror-of-src>/` | Test individual functions/classes in isolation |
|
|
19
|
-
| Integration | `test/integration/<feature>.test.ts` | Test multiple modules working together |
|
|
20
|
-
| UI | `test/ui/` | TUI component tests |
|
|
21
|
-
|
|
22
|
-
## Placement Rules
|
|
23
|
-
|
|
24
|
-
1. **Never create test files in `test/` root.** Always place in the appropriate subdirectory.
|
|
25
|
-
2. **Never create standalone bug-fix test files** like `test/execution/post-verify-bug026.test.ts`. Add tests to the existing relevant test file instead. If the relevant file would exceed 400 lines, split the file by describe block — not by bug number.
|
|
26
|
-
3. **Never create `TEST_COVERAGE_*.md` or documentation files in `test/`.** Put docs in `docs/`.
|
|
27
|
-
4. **Unit test directories must exist under `test/unit/`**, mirroring `src/`. Do not create top-level test directories like `test/execution/` or `test/context/` — use `test/unit/execution/` and `test/unit/context/`.
|
|
28
|
-
|
|
29
|
-
## File Naming
|
|
30
|
-
|
|
31
|
-
- Test files: `<source-file-name>.test.ts` — must match the source file name exactly.
|
|
32
|
-
- One test file per source file (for unit tests).
|
|
33
|
-
- If a test file needs splitting, split by describe block into `<module>-<concern>.test.ts`.
|
|
34
|
-
|
|
35
|
-
## Temp Files & Fixtures
|
|
36
|
-
|
|
37
|
-
- Use `mkdtempSync(join(tmpdir(), "nax-test-"))` for temporary directories.
|
|
38
|
-
- Clean up in `afterAll()` — never leave files in `test/tmp/`.
|
|
39
|
-
- Integration tests needing git: always `git init` + `git add .` + `git commit` in the temp fixture before testing.
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# Test Writing Rules
|
|
2
|
-
|
|
3
|
-
## Mocking
|
|
4
|
-
|
|
5
|
-
### Never use `mock.module()`
|
|
6
|
-
|
|
7
|
-
`mock.module()` in Bun 1.x is **globally scoped and leaks between test files**. It poisons the ESM module registry for the entire test run. `mock.restore()` does NOT undo `mock.module()` overrides.
|
|
8
|
-
|
|
9
|
-
**Instead, use dependency injection:**
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
// In source file: export a swappable deps object
|
|
13
|
-
export const _deps = {
|
|
14
|
-
readConfig: () => loadConfig(),
|
|
15
|
-
runCommand: (cmd: string) => Bun.spawn(cmd.split(" ")),
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// In test file: override _deps directly
|
|
19
|
-
import { _deps } from "src/mymodule";
|
|
20
|
-
|
|
21
|
-
beforeEach(() => {
|
|
22
|
-
_deps.readConfig = mock(() => fakeConfig);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
afterEach(() => {
|
|
26
|
-
mock.restore(); // restores mock() spies (NOT mock.module)
|
|
27
|
-
_deps.readConfig = originalReadConfig;
|
|
28
|
-
});
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### General Mocking Rules
|
|
32
|
-
|
|
33
|
-
- Always call `mock.restore()` in `afterEach()`.
|
|
34
|
-
- Use `mock()` (function-level) freely — it's properly scoped.
|
|
35
|
-
- Never rely on test file execution order. Each file must be independently runnable.
|
|
36
|
-
- Store original function references before overriding `_deps` and restore in `afterEach`.
|
|
37
|
-
|
|
38
|
-
## CI Compatibility
|
|
39
|
-
|
|
40
|
-
- Tests requiring the `claude` binary: guard with `const skipInCI = process.env.CI ? test.skip : test;`
|
|
41
|
-
- Tests requiring specific OS features: guard with platform checks.
|
|
42
|
-
- Never send real signals (`process.kill`) — mock `process.on()` instead.
|
|
43
|
-
|
|
44
|
-
## Spawning & Subprocesses
|
|
45
|
-
|
|
46
|
-
- Never spawn full `nax` processes in tests — prechecks fail in temp dirs.
|
|
47
|
-
- Wrap `Bun.spawn()` in try/catch — throws `ENOENT` for missing binaries (not a failed exit code).
|
|
48
|
-
|
|
49
|
-
## Test Structure
|
|
50
|
-
|
|
51
|
-
- One `describe()` block per source function or class being tested.
|
|
52
|
-
- Keep test files under 400 lines. Split by `describe()` block if needed.
|
|
53
|
-
- Use `test/helpers/` for shared mock factories and fixtures. Don't copy-paste mocking setup between files.
|
|
54
|
-
|
|
55
|
-
## Imports
|
|
56
|
-
|
|
57
|
-
- **Import from barrels** (`src/routing`), not internal paths (`src/routing/router`).
|
|
58
|
-
- This matches the project convention and prevents Bun singleton fragmentation where the same module loaded via two different paths creates two separate instances.
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# Forbidden Patterns
|
|
2
|
-
|
|
3
|
-
These patterns are **banned** from the nax codebase. Violations must be caught during implementation, not after.
|
|
4
|
-
|
|
5
|
-
## Source Code
|
|
6
|
-
|
|
7
|
-
| ❌ Forbidden | ✅ Use Instead | Why |
|
|
8
|
-
|:---|:---|:---|
|
|
9
|
-
| `mock.module()` | Dependency injection (`_deps` pattern) | Leaks globally in Bun 1.x, poisons other test files |
|
|
10
|
-
| `console.log` / `console.error` in src/ | Project logger (`src/logger`) | Unstructured output breaks test capture and log parsing |
|
|
11
|
-
| `fs.readFileSync` / `fs.writeFileSync` | `Bun.file()` / `Bun.write()` | Bun-native project — no Node.js file APIs |
|
|
12
|
-
| `child_process.spawn` / `child_process.exec` | `Bun.spawn()` / `Bun.spawnSync()` | Bun-native project — no Node.js process APIs |
|
|
13
|
-
| `setTimeout` / `setInterval` for delays | `Bun.sleep()` | Bun-native equivalent |
|
|
14
|
-
| Hardcoded timeouts in logic | Config values from schema | Hardcoded values can't be tuned per-environment |
|
|
15
|
-
| `import from "src/module/internal-file"` | `import from "src/module"` (barrel) | Prevents singleton fragmentation (BUG-035) |
|
|
16
|
-
| Files > 400 lines | Split by concern | Unmaintainable; violates project convention |
|
|
17
|
-
|
|
18
|
-
## Test Files
|
|
19
|
-
|
|
20
|
-
| ❌ Forbidden | ✅ Use Instead | Why |
|
|
21
|
-
|:---|:---|:---|
|
|
22
|
-
| Test files in `test/` root | `test/unit/`, `test/integration/`, etc. | Orphaned files with no clear ownership |
|
|
23
|
-
| Standalone bug-fix test files (`*-bug026.test.ts`) | Add to existing relevant test file | Fragments test coverage, creates ownership confusion |
|
|
24
|
-
| `TEST_COVERAGE_*.md` in test/ | `docs/` directory | Test dir is for test code only |
|
|
25
|
-
| `rm -rf` in test cleanup | `mkdtempSync` + OS temp dir | Accidental deletion risk |
|
|
26
|
-
| Tests depending on alphabetical file execution order | Independent, self-contained test files | Cross-file coupling causes phantom failures |
|
|
27
|
-
| Copy-pasted mock setup across files | `test/helpers/` shared factories | DRY; single place to update when interfaces change |
|
|
28
|
-
| Spawning full `nax` process in tests | Mock the relevant module | Prechecks fail in temp dirs; slow; flaky |
|
|
29
|
-
| Real signal sending (`process.kill`) | Mock `process.on()` | Can kill the test runner |
|