@nathapp/nax 0.27.1 → 0.29.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 +13 -2
- package/dist/nax.js +72691 -0
- package/package.json +12 -4
- package/src/cli/config.ts +42 -1
- package/src/cli/prompts.ts +18 -6
- package/src/config/defaults.ts +2 -0
- package/src/config/schemas.ts +11 -0
- package/src/config/types.ts +8 -0
- package/src/context/builder.ts +10 -1
- package/src/pipeline/stages/execution.ts +5 -0
- package/src/pipeline/stages/prompt.ts +13 -4
- package/src/precheck/checks-warnings.ts +37 -0
- package/src/precheck/checks.ts +1 -0
- package/src/precheck/index.ts +14 -7
- package/src/prompts/builder.ts +178 -0
- package/src/prompts/index.ts +2 -0
- package/src/prompts/loader.ts +43 -0
- package/src/prompts/sections/conventions.ts +15 -0
- package/src/prompts/sections/index.ts +11 -0
- package/src/prompts/sections/isolation.ts +24 -0
- package/src/prompts/sections/role-task.ts +34 -0
- package/src/prompts/sections/story.ts +13 -0
- package/src/prompts/sections/verdict.ts +70 -0
- package/src/prompts/templates/implementer.ts +6 -0
- package/src/prompts/templates/single-session.ts +6 -0
- package/src/prompts/templates/test-writer.ts +6 -0
- package/src/prompts/templates/verifier.ts +6 -0
- package/src/prompts/types.ts +21 -0
- package/src/review/runner.ts +6 -1
- package/src/tdd/session-runner.ts +12 -12
- 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 -364
- 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/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/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.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/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.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.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
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
// RE-ARCH: keep
|
|
2
|
-
/**
|
|
3
|
-
* quality.commands schema — testScoped and other optional command fields
|
|
4
|
-
*
|
|
5
|
-
* Regression test for BUG-043: testScoped was present in types.ts but missing
|
|
6
|
-
* from schemas.ts, causing Zod to silently strip it during config parsing.
|
|
7
|
-
* Result: testScopedTemplate was always undefined at runtime, so the {{files}}
|
|
8
|
-
* template was never applied and scoped tests fell back to buildSmartTestCommand.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { describe, test, expect } from "bun:test";
|
|
12
|
-
import { NaxConfigSchema } from "../../../src/config/schemas";
|
|
13
|
-
import { DEFAULT_CONFIG } from "../../../src/config/defaults";
|
|
14
|
-
|
|
15
|
-
function buildConfigWithCommands(commands: Record<string, unknown>) {
|
|
16
|
-
return {
|
|
17
|
-
...DEFAULT_CONFIG,
|
|
18
|
-
quality: {
|
|
19
|
-
...DEFAULT_CONFIG.quality,
|
|
20
|
-
commands: {
|
|
21
|
-
...DEFAULT_CONFIG.quality.commands,
|
|
22
|
-
...commands,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
describe("quality.commands schema", () => {
|
|
29
|
-
test("testScoped is preserved after schema parse (BUG-043 regression)", () => {
|
|
30
|
-
const input = buildConfigWithCommands({
|
|
31
|
-
testScoped: "bun test --timeout=60000 {{files}}",
|
|
32
|
-
});
|
|
33
|
-
const result = NaxConfigSchema.parse(input);
|
|
34
|
-
expect(result.quality.commands.testScoped).toBe("bun test --timeout=60000 {{files}}");
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test("testScoped is optional — absent when not provided", () => {
|
|
38
|
-
const input = buildConfigWithCommands({});
|
|
39
|
-
const result = NaxConfigSchema.parse(input);
|
|
40
|
-
expect(result.quality.commands.testScoped).toBeUndefined();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test("lintFix is preserved after schema parse", () => {
|
|
44
|
-
const input = buildConfigWithCommands({ lintFix: "bun run lint --fix" });
|
|
45
|
-
const result = NaxConfigSchema.parse(input);
|
|
46
|
-
expect(result.quality.commands.lintFix).toBe("bun run lint --fix");
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
test("formatFix is preserved after schema parse", () => {
|
|
50
|
-
const input = buildConfigWithCommands({ formatFix: "bun run format --write" });
|
|
51
|
-
const result = NaxConfigSchema.parse(input);
|
|
52
|
-
expect(result.quality.commands.formatFix).toBe("bun run format --write");
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
test("all command fields coexist correctly", () => {
|
|
56
|
-
const input = buildConfigWithCommands({
|
|
57
|
-
test: "bun run test",
|
|
58
|
-
testScoped: "bun test --timeout=60000 {{files}}",
|
|
59
|
-
typecheck: "bun run typecheck",
|
|
60
|
-
lint: "bun run lint",
|
|
61
|
-
lintFix: "bun run lint --fix",
|
|
62
|
-
formatFix: "bun run format --write",
|
|
63
|
-
});
|
|
64
|
-
const result = NaxConfigSchema.parse(input);
|
|
65
|
-
expect(result.quality.commands.test).toBe("bun run test");
|
|
66
|
-
expect(result.quality.commands.testScoped).toBe("bun test --timeout=60000 {{files}}");
|
|
67
|
-
expect(result.quality.commands.typecheck).toBe("bun run typecheck");
|
|
68
|
-
expect(result.quality.commands.lint).toBe("bun run lint");
|
|
69
|
-
expect(result.quality.commands.lintFix).toBe("bun run lint --fix");
|
|
70
|
-
expect(result.quality.commands.formatFix).toBe("bun run format --write");
|
|
71
|
-
});
|
|
72
|
-
});
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
// RE-ARCH: keep
|
|
2
|
-
/**
|
|
3
|
-
* RegressionGateConfigSchema — mode and maxRectificationAttempts fields
|
|
4
|
-
*
|
|
5
|
-
* Tests that the Zod schema accepts the new 'mode' enum and
|
|
6
|
-
* 'maxRectificationAttempts' integer fields added in US-003.
|
|
7
|
-
*
|
|
8
|
-
* These tests FAIL until RegressionGateConfigSchema is updated in
|
|
9
|
-
* src/config/schemas.ts to add:
|
|
10
|
-
* mode: z.enum(["deferred", "per-story", "disabled"]).default("deferred")
|
|
11
|
-
* maxRectificationAttempts: z.number().int().min(1).default(2)
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import { describe, test, expect } from "bun:test";
|
|
15
|
-
import { NaxConfigSchema } from "../../../src/config/schemas";
|
|
16
|
-
import { DEFAULT_CONFIG } from "../../../src/config/defaults";
|
|
17
|
-
|
|
18
|
-
// ---------------------------------------------------------------------------
|
|
19
|
-
// Helper: build a full NaxConfig-shaped object with a custom regressionGate
|
|
20
|
-
// ---------------------------------------------------------------------------
|
|
21
|
-
|
|
22
|
-
function buildConfigWith(regressionGate: Record<string, unknown>) {
|
|
23
|
-
return {
|
|
24
|
-
...DEFAULT_CONFIG,
|
|
25
|
-
execution: {
|
|
26
|
-
...DEFAULT_CONFIG.execution,
|
|
27
|
-
regressionGate,
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const BASE_REGRESSION_GATE = {
|
|
33
|
-
enabled: true,
|
|
34
|
-
timeoutSeconds: 120,
|
|
35
|
-
acceptOnTimeout: true,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
// ---------------------------------------------------------------------------
|
|
39
|
-
// mode field
|
|
40
|
-
// ---------------------------------------------------------------------------
|
|
41
|
-
|
|
42
|
-
describe("RegressionGateConfigSchema - mode field", () => {
|
|
43
|
-
test("accepts mode: 'deferred'", () => {
|
|
44
|
-
const raw = buildConfigWith({ ...BASE_REGRESSION_GATE, mode: "deferred" });
|
|
45
|
-
const result = NaxConfigSchema.safeParse(raw);
|
|
46
|
-
expect(result.success).toBe(true);
|
|
47
|
-
if (result.success) {
|
|
48
|
-
// Cast needed until schema is updated (mode not yet in inferred type)
|
|
49
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
|
-
expect((result.data.execution.regressionGate as any).mode).toBe("deferred");
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
test("accepts mode: 'per-story'", () => {
|
|
55
|
-
const raw = buildConfigWith({ ...BASE_REGRESSION_GATE, mode: "per-story" });
|
|
56
|
-
const result = NaxConfigSchema.safeParse(raw);
|
|
57
|
-
expect(result.success).toBe(true);
|
|
58
|
-
if (result.success) {
|
|
59
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
60
|
-
expect((result.data.execution.regressionGate as any).mode).toBe("per-story");
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
test("accepts mode: 'disabled'", () => {
|
|
65
|
-
const raw = buildConfigWith({ ...BASE_REGRESSION_GATE, mode: "disabled" });
|
|
66
|
-
const result = NaxConfigSchema.safeParse(raw);
|
|
67
|
-
expect(result.success).toBe(true);
|
|
68
|
-
if (result.success) {
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
|
-
expect((result.data.execution.regressionGate as any).mode).toBe("disabled");
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
test("defaults mode to 'deferred' when field is omitted", () => {
|
|
75
|
-
const raw = buildConfigWith(BASE_REGRESSION_GATE);
|
|
76
|
-
const result = NaxConfigSchema.safeParse(raw);
|
|
77
|
-
expect(result.success).toBe(true);
|
|
78
|
-
if (result.success) {
|
|
79
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
80
|
-
expect((result.data.execution.regressionGate as any).mode).toBe("deferred");
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
test("rejects invalid mode value", () => {
|
|
85
|
-
const raw = buildConfigWith({ ...BASE_REGRESSION_GATE, mode: "always" });
|
|
86
|
-
const result = NaxConfigSchema.safeParse(raw);
|
|
87
|
-
// Schema must reject unknown enum values (currently strips them → FAILS)
|
|
88
|
-
expect(result.success).toBe(false);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
test("rejects numeric mode value", () => {
|
|
92
|
-
const raw = buildConfigWith({ ...BASE_REGRESSION_GATE, mode: 1 });
|
|
93
|
-
const result = NaxConfigSchema.safeParse(raw);
|
|
94
|
-
expect(result.success).toBe(false);
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
// ---------------------------------------------------------------------------
|
|
99
|
-
// maxRectificationAttempts field
|
|
100
|
-
// ---------------------------------------------------------------------------
|
|
101
|
-
|
|
102
|
-
describe("RegressionGateConfigSchema - maxRectificationAttempts field", () => {
|
|
103
|
-
test("accepts maxRectificationAttempts: 2", () => {
|
|
104
|
-
const raw = buildConfigWith({
|
|
105
|
-
...BASE_REGRESSION_GATE,
|
|
106
|
-
mode: "deferred",
|
|
107
|
-
maxRectificationAttempts: 2,
|
|
108
|
-
});
|
|
109
|
-
const result = NaxConfigSchema.safeParse(raw);
|
|
110
|
-
expect(result.success).toBe(true);
|
|
111
|
-
if (result.success) {
|
|
112
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
113
|
-
expect((result.data.execution.regressionGate as any).maxRectificationAttempts).toBe(2);
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
test("accepts maxRectificationAttempts: 1", () => {
|
|
118
|
-
const raw = buildConfigWith({
|
|
119
|
-
...BASE_REGRESSION_GATE,
|
|
120
|
-
mode: "deferred",
|
|
121
|
-
maxRectificationAttempts: 1,
|
|
122
|
-
});
|
|
123
|
-
const result = NaxConfigSchema.safeParse(raw);
|
|
124
|
-
expect(result.success).toBe(true);
|
|
125
|
-
if (result.success) {
|
|
126
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
127
|
-
expect((result.data.execution.regressionGate as any).maxRectificationAttempts).toBe(1);
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
test("defaults maxRectificationAttempts to 2 when omitted", () => {
|
|
132
|
-
const raw = buildConfigWith({ ...BASE_REGRESSION_GATE, mode: "deferred" });
|
|
133
|
-
const result = NaxConfigSchema.safeParse(raw);
|
|
134
|
-
expect(result.success).toBe(true);
|
|
135
|
-
if (result.success) {
|
|
136
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
137
|
-
expect((result.data.execution.regressionGate as any).maxRectificationAttempts).toBe(2);
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
test("rejects non-integer maxRectificationAttempts", () => {
|
|
142
|
-
const raw = buildConfigWith({
|
|
143
|
-
...BASE_REGRESSION_GATE,
|
|
144
|
-
mode: "deferred",
|
|
145
|
-
maxRectificationAttempts: 1.5,
|
|
146
|
-
});
|
|
147
|
-
const result = NaxConfigSchema.safeParse(raw);
|
|
148
|
-
expect(result.success).toBe(false);
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
test("rejects string maxRectificationAttempts", () => {
|
|
152
|
-
const raw = buildConfigWith({
|
|
153
|
-
...BASE_REGRESSION_GATE,
|
|
154
|
-
mode: "deferred",
|
|
155
|
-
maxRectificationAttempts: "two",
|
|
156
|
-
});
|
|
157
|
-
const result = NaxConfigSchema.safeParse(raw);
|
|
158
|
-
expect(result.success).toBe(false);
|
|
159
|
-
});
|
|
160
|
-
});
|
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
// RE-ARCH: keep
|
|
2
|
-
/**
|
|
3
|
-
* Smart Test Runner Config Flag Tests (STR-004)
|
|
4
|
-
*
|
|
5
|
-
* Verifies that execution.smartTestRunner is present in the ExecutionConfig
|
|
6
|
-
* interface, defaults to true in the Zod schema, and loads correctly.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
|
|
10
|
-
import { existsSync, mkdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
11
|
-
import { tmpdir } from "node:os";
|
|
12
|
-
import { join } from "node:path";
|
|
13
|
-
import { globalConfigPath, loadConfig } from "../../../src/config/loader";
|
|
14
|
-
import { DEFAULT_CONFIG } from "../../../src/config/defaults";
|
|
15
|
-
import { NaxConfigSchema } from "../../../src/config/schemas";
|
|
16
|
-
|
|
17
|
-
describe("execution.smartTestRunner config flag", () => {
|
|
18
|
-
let tempDir: string;
|
|
19
|
-
let globalBackup: string | null = null;
|
|
20
|
-
|
|
21
|
-
beforeEach(() => {
|
|
22
|
-
tempDir = join(tmpdir(), `nax-str-004-${Date.now()}`);
|
|
23
|
-
mkdirSync(join(tempDir, "nax"), { recursive: true });
|
|
24
|
-
|
|
25
|
-
const globalPath = globalConfigPath();
|
|
26
|
-
if (existsSync(globalPath)) {
|
|
27
|
-
globalBackup = `${globalPath}.test-backup-${Date.now()}`;
|
|
28
|
-
renameSync(globalPath, globalBackup);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
afterEach(() => {
|
|
33
|
-
if (tempDir) {
|
|
34
|
-
rmSync(tempDir, { recursive: true, force: true });
|
|
35
|
-
}
|
|
36
|
-
if (globalBackup && existsSync(globalBackup)) {
|
|
37
|
-
const globalPath = globalConfigPath();
|
|
38
|
-
if (existsSync(globalPath)) rmSync(globalPath);
|
|
39
|
-
renameSync(globalBackup, globalPath);
|
|
40
|
-
globalBackup = null;
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test("DEFAULT_CONFIG has smartTestRunner: true", () => {
|
|
45
|
-
expect(DEFAULT_CONFIG.execution.smartTestRunner).toBe(true);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
test("Zod schema defaults smartTestRunner to enabled object when field is absent", () => {
|
|
49
|
-
const minimal = {
|
|
50
|
-
version: 1,
|
|
51
|
-
models: {
|
|
52
|
-
fast: { provider: "anthropic", model: "haiku" },
|
|
53
|
-
balanced: { provider: "anthropic", model: "sonnet" },
|
|
54
|
-
powerful: { provider: "anthropic", model: "opus" },
|
|
55
|
-
},
|
|
56
|
-
autoMode: {
|
|
57
|
-
enabled: true,
|
|
58
|
-
defaultAgent: "claude",
|
|
59
|
-
fallbackOrder: [],
|
|
60
|
-
complexityRouting: { simple: "fast", medium: "balanced", complex: "powerful", expert: "powerful" },
|
|
61
|
-
escalation: { enabled: true, tierOrder: [{ tier: "fast", attempts: 1 }] },
|
|
62
|
-
},
|
|
63
|
-
routing: { strategy: "keyword" },
|
|
64
|
-
execution: {
|
|
65
|
-
maxIterations: 10,
|
|
66
|
-
iterationDelayMs: 0,
|
|
67
|
-
costLimit: 1,
|
|
68
|
-
sessionTimeoutSeconds: 60,
|
|
69
|
-
maxStoriesPerFeature: 10,
|
|
70
|
-
rectification: {
|
|
71
|
-
enabled: true,
|
|
72
|
-
maxRetries: 1,
|
|
73
|
-
fullSuiteTimeoutSeconds: 30,
|
|
74
|
-
maxFailureSummaryChars: 500,
|
|
75
|
-
abortOnIncreasingFailures: true,
|
|
76
|
-
},
|
|
77
|
-
regressionGate: { enabled: true, timeoutSeconds: 30 },
|
|
78
|
-
contextProviderTokenBudget: 100,
|
|
79
|
-
// smartTestRunner intentionally omitted
|
|
80
|
-
},
|
|
81
|
-
quality: {
|
|
82
|
-
requireTypecheck: true,
|
|
83
|
-
requireLint: true,
|
|
84
|
-
requireTests: true,
|
|
85
|
-
commands: {},
|
|
86
|
-
forceExit: false,
|
|
87
|
-
detectOpenHandles: true,
|
|
88
|
-
detectOpenHandlesRetries: 1,
|
|
89
|
-
gracePeriodMs: 500,
|
|
90
|
-
drainTimeoutMs: 0,
|
|
91
|
-
shell: "/bin/sh",
|
|
92
|
-
stripEnvVars: [],
|
|
93
|
-
environmentalEscalationDivisor: 2,
|
|
94
|
-
},
|
|
95
|
-
tdd: { maxRetries: 0, autoVerifyIsolation: false, autoApproveVerifier: false },
|
|
96
|
-
constitution: { enabled: false, path: "constitution.md", maxTokens: 100 },
|
|
97
|
-
analyze: { llmEnhanced: false, model: "balanced", fallbackToKeywords: true, maxCodebaseSummaryTokens: 100 },
|
|
98
|
-
review: { enabled: false, checks: [], commands: {} },
|
|
99
|
-
plan: { model: "balanced", outputPath: "spec.md" },
|
|
100
|
-
acceptance: { enabled: false, maxRetries: 0, generateTests: false, testPath: "acceptance.test.ts" },
|
|
101
|
-
context: {
|
|
102
|
-
testCoverage: { enabled: false, detail: "names-only", maxTokens: 50, testPattern: "**/*.test.ts", scopeToStory: false },
|
|
103
|
-
autoDetect: { enabled: false, maxFiles: 1, traceImports: false },
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const result = NaxConfigSchema.safeParse(minimal);
|
|
108
|
-
expect(result.success).toBe(true);
|
|
109
|
-
if (result.success) {
|
|
110
|
-
expect(result.data.execution.smartTestRunner).toEqual({
|
|
111
|
-
enabled: true,
|
|
112
|
-
testFilePatterns: ["test/**/*.test.ts"],
|
|
113
|
-
fallback: "import-grep",
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
test("Zod schema coerces smartTestRunner: false to disabled config object", () => {
|
|
119
|
-
const result = NaxConfigSchema.safeParse({
|
|
120
|
-
...buildMinimalConfig(),
|
|
121
|
-
execution: { ...buildMinimalConfig().execution, smartTestRunner: false },
|
|
122
|
-
});
|
|
123
|
-
expect(result.success).toBe(true);
|
|
124
|
-
if (result.success) {
|
|
125
|
-
expect(result.data.execution.smartTestRunner).toEqual({
|
|
126
|
-
enabled: false,
|
|
127
|
-
testFilePatterns: ["test/**/*.test.ts"],
|
|
128
|
-
fallback: "import-grep",
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
test("Zod schema coerces smartTestRunner: true to enabled config object", () => {
|
|
134
|
-
const result = NaxConfigSchema.safeParse({
|
|
135
|
-
...buildMinimalConfig(),
|
|
136
|
-
execution: { ...buildMinimalConfig().execution, smartTestRunner: true },
|
|
137
|
-
});
|
|
138
|
-
expect(result.success).toBe(true);
|
|
139
|
-
if (result.success) {
|
|
140
|
-
expect(result.data.execution.smartTestRunner).toEqual({
|
|
141
|
-
enabled: true,
|
|
142
|
-
testFilePatterns: ["test/**/*.test.ts"],
|
|
143
|
-
fallback: "import-grep",
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
test("loadConfig defaults smartTestRunner to enabled object when not in project config", async () => {
|
|
149
|
-
const configPath = join(tempDir, "nax", "config.json");
|
|
150
|
-
writeFileSync(configPath, JSON.stringify({ routing: { strategy: "keyword" } }, null, 2));
|
|
151
|
-
|
|
152
|
-
const config = await loadConfig(join(tempDir, "nax"));
|
|
153
|
-
expect(config.execution.smartTestRunner).toEqual({
|
|
154
|
-
enabled: true,
|
|
155
|
-
testFilePatterns: ["test/**/*.test.ts"],
|
|
156
|
-
fallback: "import-grep",
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
test("loadConfig coerces smartTestRunner: false to disabled config object", async () => {
|
|
161
|
-
const configPath = join(tempDir, "nax", "config.json");
|
|
162
|
-
writeFileSync(
|
|
163
|
-
configPath,
|
|
164
|
-
JSON.stringify({ execution: { smartTestRunner: false } }, null, 2),
|
|
165
|
-
);
|
|
166
|
-
|
|
167
|
-
const config = await loadConfig(join(tempDir, "nax"));
|
|
168
|
-
expect(config.execution.smartTestRunner).toEqual({
|
|
169
|
-
enabled: false,
|
|
170
|
-
testFilePatterns: ["test/**/*.test.ts"],
|
|
171
|
-
fallback: "import-grep",
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
test("loadConfig normalizes to enabled object when field is absent (backward compat)", async () => {
|
|
176
|
-
const configPath = join(tempDir, "nax", "config.json");
|
|
177
|
-
// Config without smartTestRunner field at all
|
|
178
|
-
writeFileSync(configPath, JSON.stringify({}, null, 2));
|
|
179
|
-
|
|
180
|
-
const config = await loadConfig(join(tempDir, "nax"));
|
|
181
|
-
expect(config.execution.smartTestRunner).toEqual({
|
|
182
|
-
enabled: true,
|
|
183
|
-
testFilePatterns: ["test/**/*.test.ts"],
|
|
184
|
-
fallback: "import-grep",
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
// ---------------------------------------------------------------------------
|
|
190
|
-
// Minimal valid config helper
|
|
191
|
-
// ---------------------------------------------------------------------------
|
|
192
|
-
|
|
193
|
-
function buildMinimalConfig() {
|
|
194
|
-
return {
|
|
195
|
-
version: 1,
|
|
196
|
-
models: {
|
|
197
|
-
fast: { provider: "anthropic", model: "haiku" },
|
|
198
|
-
balanced: { provider: "anthropic", model: "sonnet" },
|
|
199
|
-
powerful: { provider: "anthropic", model: "opus" },
|
|
200
|
-
},
|
|
201
|
-
autoMode: {
|
|
202
|
-
enabled: true,
|
|
203
|
-
defaultAgent: "claude",
|
|
204
|
-
fallbackOrder: [],
|
|
205
|
-
complexityRouting: { simple: "fast", medium: "balanced", complex: "powerful", expert: "powerful" },
|
|
206
|
-
escalation: { enabled: true, tierOrder: [{ tier: "fast", attempts: 1 }] },
|
|
207
|
-
},
|
|
208
|
-
routing: { strategy: "keyword" as const },
|
|
209
|
-
execution: {
|
|
210
|
-
maxIterations: 10,
|
|
211
|
-
iterationDelayMs: 0,
|
|
212
|
-
costLimit: 1,
|
|
213
|
-
sessionTimeoutSeconds: 60,
|
|
214
|
-
maxStoriesPerFeature: 10,
|
|
215
|
-
rectification: {
|
|
216
|
-
enabled: true,
|
|
217
|
-
maxRetries: 1,
|
|
218
|
-
fullSuiteTimeoutSeconds: 30,
|
|
219
|
-
maxFailureSummaryChars: 500,
|
|
220
|
-
abortOnIncreasingFailures: true,
|
|
221
|
-
},
|
|
222
|
-
regressionGate: { enabled: true, timeoutSeconds: 30 },
|
|
223
|
-
contextProviderTokenBudget: 100,
|
|
224
|
-
},
|
|
225
|
-
quality: {
|
|
226
|
-
requireTypecheck: true,
|
|
227
|
-
requireLint: true,
|
|
228
|
-
requireTests: true,
|
|
229
|
-
commands: {},
|
|
230
|
-
forceExit: false,
|
|
231
|
-
detectOpenHandles: true,
|
|
232
|
-
detectOpenHandlesRetries: 1,
|
|
233
|
-
gracePeriodMs: 500,
|
|
234
|
-
drainTimeoutMs: 0,
|
|
235
|
-
shell: "/bin/sh",
|
|
236
|
-
stripEnvVars: [],
|
|
237
|
-
environmentalEscalationDivisor: 2,
|
|
238
|
-
},
|
|
239
|
-
tdd: { maxRetries: 0, autoVerifyIsolation: false, autoApproveVerifier: false },
|
|
240
|
-
constitution: { enabled: false, path: "constitution.md", maxTokens: 100 },
|
|
241
|
-
analyze: { llmEnhanced: false, model: "balanced", fallbackToKeywords: true, maxCodebaseSummaryTokens: 100 },
|
|
242
|
-
review: { enabled: false, checks: [] as Array<"typecheck" | "lint" | "test">, commands: {} },
|
|
243
|
-
plan: { model: "balanced", outputPath: "spec.md" },
|
|
244
|
-
acceptance: { enabled: false, maxRetries: 0, generateTests: false, testPath: "acceptance.test.ts" },
|
|
245
|
-
context: {
|
|
246
|
-
testCoverage: { enabled: false, detail: "names-only" as const, maxTokens: 50, testPattern: "**/*.test.ts", scopeToStory: false },
|
|
247
|
-
autoDetect: { enabled: false, maxFiles: 1, traceImports: false },
|
|
248
|
-
},
|
|
249
|
-
};
|
|
250
|
-
}
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
// RE-ARCH: keep
|
|
2
|
-
/**
|
|
3
|
-
* Constitution Generators Tests
|
|
4
|
-
*
|
|
5
|
-
* Tests for generating agent-specific config files from constitution.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { describe, expect, test } from "bun:test";
|
|
9
|
-
import { aiderGenerator } from "../../src/constitution/generators/aider";
|
|
10
|
-
import { claudeGenerator } from "../../src/constitution/generators/claude";
|
|
11
|
-
import { cursorGenerator } from "../../src/constitution/generators/cursor";
|
|
12
|
-
import { opencodeGenerator } from "../../src/constitution/generators/opencode";
|
|
13
|
-
import type { ConstitutionContent } from "../../src/constitution/generators/types";
|
|
14
|
-
import { windsurfGenerator } from "../../src/constitution/generators/windsurf";
|
|
15
|
-
|
|
16
|
-
const sampleConstitution: ConstitutionContent = {
|
|
17
|
-
markdown: `# Project Constitution
|
|
18
|
-
|
|
19
|
-
## Coding Standards
|
|
20
|
-
- Follow TypeScript best practices
|
|
21
|
-
- Use strict typing
|
|
22
|
-
|
|
23
|
-
## Testing Requirements
|
|
24
|
-
- 80% minimum coverage
|
|
25
|
-
- Write tests first (TDD)
|
|
26
|
-
|
|
27
|
-
## Architecture Rules
|
|
28
|
-
- Single responsibility principle
|
|
29
|
-
- Dependency injection
|
|
30
|
-
`,
|
|
31
|
-
sections: {},
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
describe("Constitution Generators", () => {
|
|
35
|
-
describe("Claude Generator", () => {
|
|
36
|
-
test("should generate CLAUDE.md with correct format", () => {
|
|
37
|
-
const result = claudeGenerator.generate(sampleConstitution);
|
|
38
|
-
|
|
39
|
-
expect(result).toContain("# Project Constitution");
|
|
40
|
-
expect(result).toContain("auto-generated from `nax/constitution.md`");
|
|
41
|
-
expect(result).toContain("DO NOT EDIT MANUALLY");
|
|
42
|
-
expect(result).toContain("## Coding Standards");
|
|
43
|
-
expect(result).toContain("Follow TypeScript best practices");
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
test("should have correct output filename", () => {
|
|
47
|
-
expect(claudeGenerator.outputFile).toBe("CLAUDE.md");
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
test("should have correct generator name", () => {
|
|
51
|
-
expect(claudeGenerator.name).toBe("claude");
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
describe("OpenCode Generator", () => {
|
|
56
|
-
test("should generate AGENTS.md with correct format", () => {
|
|
57
|
-
const result = opencodeGenerator.generate(sampleConstitution);
|
|
58
|
-
|
|
59
|
-
expect(result).toContain("# Agent Instructions");
|
|
60
|
-
expect(result).toContain("auto-generated from `nax/constitution.md`");
|
|
61
|
-
expect(result).toContain("DO NOT EDIT MANUALLY");
|
|
62
|
-
expect(result).toContain("## Coding Standards");
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
test("should have correct output filename", () => {
|
|
66
|
-
expect(opencodeGenerator.outputFile).toBe("AGENTS.md");
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test("should have correct generator name", () => {
|
|
70
|
-
expect(opencodeGenerator.name).toBe("opencode");
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
describe("Cursor Generator", () => {
|
|
75
|
-
test("should generate .cursorrules with correct format", () => {
|
|
76
|
-
const result = cursorGenerator.generate(sampleConstitution);
|
|
77
|
-
|
|
78
|
-
expect(result).toContain("# Project Rules");
|
|
79
|
-
expect(result).toContain("Auto-generated from nax/constitution.md");
|
|
80
|
-
expect(result).toContain("DO NOT EDIT MANUALLY");
|
|
81
|
-
expect(result).toContain("## Coding Standards");
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
test("should have correct output filename", () => {
|
|
85
|
-
expect(cursorGenerator.outputFile).toBe(".cursorrules");
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
test("should have correct generator name", () => {
|
|
89
|
-
expect(cursorGenerator.name).toBe("cursor");
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
describe("Windsurf Generator", () => {
|
|
94
|
-
test("should generate .windsurfrules with correct format", () => {
|
|
95
|
-
const result = windsurfGenerator.generate(sampleConstitution);
|
|
96
|
-
|
|
97
|
-
expect(result).toContain("# Windsurf Project Rules");
|
|
98
|
-
expect(result).toContain("Auto-generated from nax/constitution.md");
|
|
99
|
-
expect(result).toContain("DO NOT EDIT MANUALLY");
|
|
100
|
-
expect(result).toContain("## Coding Standards");
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
test("should have correct output filename", () => {
|
|
104
|
-
expect(windsurfGenerator.outputFile).toBe(".windsurfrules");
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
test("should have correct generator name", () => {
|
|
108
|
-
expect(windsurfGenerator.name).toBe("windsurf");
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
describe("Aider Generator", () => {
|
|
113
|
-
test("should generate .aider.conf.yml with correct YAML format", () => {
|
|
114
|
-
const result = aiderGenerator.generate(sampleConstitution);
|
|
115
|
-
|
|
116
|
-
expect(result).toContain("# Aider Configuration");
|
|
117
|
-
expect(result).toContain("# Auto-generated from nax/constitution.md");
|
|
118
|
-
expect(result).toContain("# DO NOT EDIT MANUALLY");
|
|
119
|
-
expect(result).toContain("instructions: |");
|
|
120
|
-
// Check YAML indentation
|
|
121
|
-
expect(result).toContain(" # Project Constitution");
|
|
122
|
-
expect(result).toContain(" ## Coding Standards");
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
test("should have correct output filename", () => {
|
|
126
|
-
expect(aiderGenerator.outputFile).toBe(".aider.conf.yml");
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
test("should have correct generator name", () => {
|
|
130
|
-
expect(aiderGenerator.name).toBe("aider");
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
describe("All Generators", () => {
|
|
135
|
-
test("should preserve original constitution content", () => {
|
|
136
|
-
const generators = [claudeGenerator, opencodeGenerator, cursorGenerator, windsurfGenerator, aiderGenerator];
|
|
137
|
-
|
|
138
|
-
for (const generator of generators) {
|
|
139
|
-
const result = generator.generate(sampleConstitution);
|
|
140
|
-
expect(result).toContain("Follow TypeScript best practices");
|
|
141
|
-
expect(result).toContain("80% minimum coverage");
|
|
142
|
-
expect(result).toContain("Single responsibility principle");
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
test("should handle empty constitution", () => {
|
|
147
|
-
const emptyConstitution: ConstitutionContent = {
|
|
148
|
-
markdown: "",
|
|
149
|
-
sections: {},
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
const generators = [claudeGenerator, opencodeGenerator, cursorGenerator, windsurfGenerator, aiderGenerator];
|
|
153
|
-
|
|
154
|
-
for (const generator of generators) {
|
|
155
|
-
const result = generator.generate(emptyConstitution);
|
|
156
|
-
// Should still have header
|
|
157
|
-
expect(result.length).toBeGreaterThan(0);
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
});
|