@nathapp/nax 0.50.3 → 0.51.2

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.
Files changed (353) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +177 -104
  3. package/dist/nax.js +417 -213
  4. package/package.json +1 -3
  5. package/bin/nax.ts +0 -1195
  6. package/src/acceptance/fix-generator.ts +0 -322
  7. package/src/acceptance/generator.ts +0 -415
  8. package/src/acceptance/index.ts +0 -42
  9. package/src/acceptance/refinement.ts +0 -224
  10. package/src/acceptance/templates/cli.ts +0 -47
  11. package/src/acceptance/templates/component.ts +0 -78
  12. package/src/acceptance/templates/e2e.ts +0 -43
  13. package/src/acceptance/templates/index.ts +0 -21
  14. package/src/acceptance/templates/snapshot.ts +0 -50
  15. package/src/acceptance/templates/unit.ts +0 -48
  16. package/src/acceptance/types.ts +0 -138
  17. package/src/agents/acp/adapter.ts +0 -888
  18. package/src/agents/acp/cost.ts +0 -9
  19. package/src/agents/acp/index.ts +0 -7
  20. package/src/agents/acp/interaction-bridge.ts +0 -126
  21. package/src/agents/acp/parser.ts +0 -119
  22. package/src/agents/acp/spawn-client.ts +0 -373
  23. package/src/agents/acp/types.ts +0 -22
  24. package/src/agents/aider/adapter.ts +0 -135
  25. package/src/agents/claude/adapter.ts +0 -258
  26. package/src/agents/claude/complete.ts +0 -80
  27. package/src/agents/claude/cost.ts +0 -16
  28. package/src/agents/claude/execution.ts +0 -215
  29. package/src/agents/claude/index.ts +0 -3
  30. package/src/agents/claude/interactive.ts +0 -77
  31. package/src/agents/claude/plan.ts +0 -179
  32. package/src/agents/codex/adapter.ts +0 -153
  33. package/src/agents/cost/calculate.ts +0 -154
  34. package/src/agents/cost/index.ts +0 -10
  35. package/src/agents/cost/parse.ts +0 -97
  36. package/src/agents/cost/pricing.ts +0 -59
  37. package/src/agents/cost/types.ts +0 -45
  38. package/src/agents/gemini/adapter.ts +0 -177
  39. package/src/agents/index.ts +0 -18
  40. package/src/agents/opencode/adapter.ts +0 -106
  41. package/src/agents/registry.ts +0 -136
  42. package/src/agents/shared/decompose.ts +0 -154
  43. package/src/agents/shared/model-resolution.ts +0 -43
  44. package/src/agents/shared/types-extended.ts +0 -164
  45. package/src/agents/shared/validation.ts +0 -69
  46. package/src/agents/shared/version-detection.ts +0 -109
  47. package/src/agents/types.ts +0 -205
  48. package/src/analyze/classifier.ts +0 -282
  49. package/src/analyze/index.ts +0 -16
  50. package/src/analyze/scanner.ts +0 -171
  51. package/src/analyze/types.ts +0 -51
  52. package/src/cli/accept.ts +0 -108
  53. package/src/cli/agents.ts +0 -87
  54. package/src/cli/analyze-parser.ts +0 -291
  55. package/src/cli/analyze.ts +0 -352
  56. package/src/cli/config-descriptions.ts +0 -219
  57. package/src/cli/config-diff.ts +0 -103
  58. package/src/cli/config-display.ts +0 -285
  59. package/src/cli/config-get.ts +0 -55
  60. package/src/cli/config.ts +0 -14
  61. package/src/cli/constitution.ts +0 -17
  62. package/src/cli/diagnose-analysis.ts +0 -159
  63. package/src/cli/diagnose-formatter.ts +0 -87
  64. package/src/cli/diagnose.ts +0 -203
  65. package/src/cli/generate.ts +0 -250
  66. package/src/cli/index.ts +0 -42
  67. package/src/cli/init-context.ts +0 -405
  68. package/src/cli/init-detect.ts +0 -303
  69. package/src/cli/init.ts +0 -296
  70. package/src/cli/interact.ts +0 -295
  71. package/src/cli/plan.ts +0 -509
  72. package/src/cli/plugins.ts +0 -122
  73. package/src/cli/prompts-export.ts +0 -58
  74. package/src/cli/prompts-init.ts +0 -200
  75. package/src/cli/prompts-main.ts +0 -183
  76. package/src/cli/prompts-shared.ts +0 -70
  77. package/src/cli/prompts-tdd.ts +0 -88
  78. package/src/cli/prompts.ts +0 -17
  79. package/src/cli/runs.ts +0 -174
  80. package/src/cli/status-cost.ts +0 -151
  81. package/src/cli/status-features.ts +0 -405
  82. package/src/cli/status.ts +0 -13
  83. package/src/commands/common.ts +0 -171
  84. package/src/commands/diagnose.ts +0 -17
  85. package/src/commands/index.ts +0 -9
  86. package/src/commands/logs-formatter.ts +0 -201
  87. package/src/commands/logs-reader.ts +0 -171
  88. package/src/commands/logs.ts +0 -103
  89. package/src/commands/precheck.ts +0 -86
  90. package/src/commands/runs.ts +0 -220
  91. package/src/commands/unlock.ts +0 -96
  92. package/src/config/defaults.ts +0 -218
  93. package/src/config/index.ts +0 -22
  94. package/src/config/loader.ts +0 -143
  95. package/src/config/merge.ts +0 -106
  96. package/src/config/merger.ts +0 -147
  97. package/src/config/path-security.ts +0 -121
  98. package/src/config/paths.ts +0 -27
  99. package/src/config/permissions.ts +0 -63
  100. package/src/config/runtime-types.ts +0 -522
  101. package/src/config/schema-types.ts +0 -53
  102. package/src/config/schema.ts +0 -60
  103. package/src/config/schemas.ts +0 -426
  104. package/src/config/test-strategy.ts +0 -71
  105. package/src/config/types.ts +0 -57
  106. package/src/config/validate.ts +0 -103
  107. package/src/constitution/generator.ts +0 -158
  108. package/src/constitution/generators/aider.ts +0 -41
  109. package/src/constitution/generators/claude.ts +0 -35
  110. package/src/constitution/generators/cursor.ts +0 -36
  111. package/src/constitution/generators/opencode.ts +0 -38
  112. package/src/constitution/generators/types.ts +0 -33
  113. package/src/constitution/generators/windsurf.ts +0 -36
  114. package/src/constitution/index.ts +0 -11
  115. package/src/constitution/loader.ts +0 -121
  116. package/src/constitution/types.ts +0 -31
  117. package/src/context/auto-detect.ts +0 -228
  118. package/src/context/builder.ts +0 -299
  119. package/src/context/elements.ts +0 -122
  120. package/src/context/formatter.ts +0 -107
  121. package/src/context/generator.ts +0 -343
  122. package/src/context/generators/aider.ts +0 -34
  123. package/src/context/generators/claude.ts +0 -28
  124. package/src/context/generators/codex.ts +0 -28
  125. package/src/context/generators/cursor.ts +0 -28
  126. package/src/context/generators/gemini.ts +0 -28
  127. package/src/context/generators/opencode.ts +0 -30
  128. package/src/context/generators/windsurf.ts +0 -28
  129. package/src/context/greenfield.ts +0 -114
  130. package/src/context/index.ts +0 -34
  131. package/src/context/injector.ts +0 -279
  132. package/src/context/parent-context.ts +0 -39
  133. package/src/context/test-scanner.ts +0 -370
  134. package/src/context/types.ts +0 -98
  135. package/src/decompose/apply.ts +0 -50
  136. package/src/decompose/builder.ts +0 -181
  137. package/src/decompose/index.ts +0 -8
  138. package/src/decompose/sections/codebase.ts +0 -26
  139. package/src/decompose/sections/constraints.ts +0 -32
  140. package/src/decompose/sections/index.ts +0 -4
  141. package/src/decompose/sections/sibling-stories.ts +0 -25
  142. package/src/decompose/sections/target-story.ts +0 -31
  143. package/src/decompose/types.ts +0 -55
  144. package/src/decompose/validators/complexity.ts +0 -45
  145. package/src/decompose/validators/coverage.ts +0 -134
  146. package/src/decompose/validators/dependency.ts +0 -91
  147. package/src/decompose/validators/index.ts +0 -35
  148. package/src/decompose/validators/overlap.ts +0 -128
  149. package/src/errors.ts +0 -67
  150. package/src/execution/batching.ts +0 -157
  151. package/src/execution/crash-heartbeat.ts +0 -77
  152. package/src/execution/crash-recovery.ts +0 -79
  153. package/src/execution/crash-signals.ts +0 -165
  154. package/src/execution/crash-writer.ts +0 -154
  155. package/src/execution/deferred-review.ts +0 -105
  156. package/src/execution/dry-run.ts +0 -81
  157. package/src/execution/escalation/escalation.ts +0 -46
  158. package/src/execution/escalation/index.ts +0 -13
  159. package/src/execution/escalation/tier-escalation.ts +0 -346
  160. package/src/execution/escalation/tier-outcome.ts +0 -143
  161. package/src/execution/executor-types.ts +0 -73
  162. package/src/execution/helpers.ts +0 -38
  163. package/src/execution/index.ts +0 -27
  164. package/src/execution/iteration-runner.ts +0 -160
  165. package/src/execution/lifecycle/acceptance-loop.ts +0 -309
  166. package/src/execution/lifecycle/headless-formatter.ts +0 -83
  167. package/src/execution/lifecycle/index.ts +0 -11
  168. package/src/execution/lifecycle/parallel-lifecycle.ts +0 -101
  169. package/src/execution/lifecycle/precheck-runner.ts +0 -140
  170. package/src/execution/lifecycle/run-cleanup.ts +0 -81
  171. package/src/execution/lifecycle/run-completion.ts +0 -247
  172. package/src/execution/lifecycle/run-initialization.ts +0 -187
  173. package/src/execution/lifecycle/run-regression.ts +0 -305
  174. package/src/execution/lifecycle/run-setup.ts +0 -240
  175. package/src/execution/lifecycle/story-size-prompts.ts +0 -123
  176. package/src/execution/lock.ts +0 -129
  177. package/src/execution/parallel-coordinator.ts +0 -281
  178. package/src/execution/parallel-executor-rectification-pass.ts +0 -117
  179. package/src/execution/parallel-executor-rectify.ts +0 -136
  180. package/src/execution/parallel-executor.ts +0 -330
  181. package/src/execution/parallel-worker.ts +0 -149
  182. package/src/execution/parallel.ts +0 -13
  183. package/src/execution/pid-registry.ts +0 -275
  184. package/src/execution/pipeline-result-handler.ts +0 -221
  185. package/src/execution/progress.ts +0 -27
  186. package/src/execution/queue-handler.ts +0 -109
  187. package/src/execution/runner-completion.ts +0 -171
  188. package/src/execution/runner-execution.ts +0 -243
  189. package/src/execution/runner-setup.ts +0 -86
  190. package/src/execution/runner.ts +0 -265
  191. package/src/execution/sequential-executor.ts +0 -219
  192. package/src/execution/status-file.ts +0 -264
  193. package/src/execution/status-writer.ts +0 -181
  194. package/src/execution/story-context.ts +0 -266
  195. package/src/execution/story-selector.ts +0 -76
  196. package/src/execution/test-output-parser.ts +0 -14
  197. package/src/execution/timeout-handler.ts +0 -100
  198. package/src/hooks/index.ts +0 -2
  199. package/src/hooks/runner.ts +0 -280
  200. package/src/hooks/types.ts +0 -79
  201. package/src/interaction/chain.ts +0 -170
  202. package/src/interaction/index.ts +0 -61
  203. package/src/interaction/init.ts +0 -84
  204. package/src/interaction/plugins/auto.ts +0 -243
  205. package/src/interaction/plugins/cli.ts +0 -300
  206. package/src/interaction/plugins/telegram.ts +0 -384
  207. package/src/interaction/plugins/webhook.ts +0 -286
  208. package/src/interaction/state.ts +0 -171
  209. package/src/interaction/triggers.ts +0 -250
  210. package/src/interaction/types.ts +0 -170
  211. package/src/logger/formatters.ts +0 -84
  212. package/src/logger/index.ts +0 -16
  213. package/src/logger/logger.ts +0 -296
  214. package/src/logger/types.ts +0 -48
  215. package/src/logging/formatter.ts +0 -355
  216. package/src/logging/index.ts +0 -22
  217. package/src/logging/types.ts +0 -93
  218. package/src/metrics/aggregator.ts +0 -191
  219. package/src/metrics/index.ts +0 -14
  220. package/src/metrics/tracker.ts +0 -200
  221. package/src/metrics/types.ts +0 -115
  222. package/src/optimizer/index.ts +0 -63
  223. package/src/optimizer/noop.optimizer.ts +0 -24
  224. package/src/optimizer/rule-based.optimizer.ts +0 -248
  225. package/src/optimizer/types.ts +0 -53
  226. package/src/pipeline/event-bus.ts +0 -297
  227. package/src/pipeline/events.ts +0 -130
  228. package/src/pipeline/index.ts +0 -19
  229. package/src/pipeline/runner.ts +0 -149
  230. package/src/pipeline/stages/acceptance-setup.ts +0 -144
  231. package/src/pipeline/stages/acceptance.ts +0 -215
  232. package/src/pipeline/stages/autofix.ts +0 -262
  233. package/src/pipeline/stages/completion.ts +0 -110
  234. package/src/pipeline/stages/constitution.ts +0 -63
  235. package/src/pipeline/stages/context.ts +0 -122
  236. package/src/pipeline/stages/execution.ts +0 -359
  237. package/src/pipeline/stages/index.ts +0 -86
  238. package/src/pipeline/stages/optimizer.ts +0 -74
  239. package/src/pipeline/stages/prompt.ts +0 -79
  240. package/src/pipeline/stages/queue-check.ts +0 -103
  241. package/src/pipeline/stages/rectify.ts +0 -101
  242. package/src/pipeline/stages/regression.ts +0 -99
  243. package/src/pipeline/stages/review.ts +0 -94
  244. package/src/pipeline/stages/routing.ts +0 -276
  245. package/src/pipeline/stages/verify.ts +0 -286
  246. package/src/pipeline/subscribers/events-writer.ts +0 -135
  247. package/src/pipeline/subscribers/hooks.ts +0 -179
  248. package/src/pipeline/subscribers/interaction.ts +0 -103
  249. package/src/pipeline/subscribers/registry.ts +0 -73
  250. package/src/pipeline/subscribers/reporters.ts +0 -174
  251. package/src/pipeline/types.ts +0 -220
  252. package/src/plugins/extensions.ts +0 -225
  253. package/src/plugins/index.ts +0 -33
  254. package/src/plugins/loader.ts +0 -352
  255. package/src/plugins/plugin-logger.ts +0 -41
  256. package/src/plugins/registry.ts +0 -168
  257. package/src/plugins/types.ts +0 -206
  258. package/src/plugins/validator.ts +0 -352
  259. package/src/prd/index.ts +0 -220
  260. package/src/prd/schema.ts +0 -268
  261. package/src/prd/types.ts +0 -273
  262. package/src/prd/validate.ts +0 -41
  263. package/src/precheck/checks-agents.ts +0 -63
  264. package/src/precheck/checks-blockers.ts +0 -23
  265. package/src/precheck/checks-cli.ts +0 -68
  266. package/src/precheck/checks-config.ts +0 -102
  267. package/src/precheck/checks-git.ts +0 -117
  268. package/src/precheck/checks-system.ts +0 -101
  269. package/src/precheck/checks-warnings.ts +0 -221
  270. package/src/precheck/checks.ts +0 -36
  271. package/src/precheck/index.ts +0 -374
  272. package/src/precheck/story-size-gate.ts +0 -144
  273. package/src/precheck/types.ts +0 -31
  274. package/src/prompts/builder.ts +0 -166
  275. package/src/prompts/index.ts +0 -2
  276. package/src/prompts/loader.ts +0 -43
  277. package/src/prompts/sections/conventions.ts +0 -19
  278. package/src/prompts/sections/hermetic.ts +0 -41
  279. package/src/prompts/sections/index.ts +0 -12
  280. package/src/prompts/sections/isolation.ts +0 -70
  281. package/src/prompts/sections/role-task.ts +0 -182
  282. package/src/prompts/sections/story.ts +0 -55
  283. package/src/prompts/sections/verdict.ts +0 -70
  284. package/src/prompts/types.ts +0 -21
  285. package/src/queue/index.ts +0 -2
  286. package/src/queue/manager.ts +0 -254
  287. package/src/queue/types.ts +0 -54
  288. package/src/review/index.ts +0 -8
  289. package/src/review/orchestrator.ts +0 -154
  290. package/src/review/runner.ts +0 -303
  291. package/src/review/types.ts +0 -70
  292. package/src/routing/batch-route.ts +0 -35
  293. package/src/routing/builder.ts +0 -81
  294. package/src/routing/chain.ts +0 -75
  295. package/src/routing/content-hash.ts +0 -25
  296. package/src/routing/index.ts +0 -20
  297. package/src/routing/loader.ts +0 -62
  298. package/src/routing/router.ts +0 -305
  299. package/src/routing/strategies/adaptive.ts +0 -215
  300. package/src/routing/strategies/index.ts +0 -8
  301. package/src/routing/strategies/keyword.ts +0 -180
  302. package/src/routing/strategies/llm-prompts.ts +0 -224
  303. package/src/routing/strategies/llm.ts +0 -320
  304. package/src/routing/strategies/manual.ts +0 -50
  305. package/src/routing/strategy.ts +0 -102
  306. package/src/tdd/cleanup.ts +0 -120
  307. package/src/tdd/index.ts +0 -22
  308. package/src/tdd/isolation.ts +0 -117
  309. package/src/tdd/orchestrator.ts +0 -406
  310. package/src/tdd/prompts.ts +0 -40
  311. package/src/tdd/rectification-gate.ts +0 -274
  312. package/src/tdd/session-runner.ts +0 -263
  313. package/src/tdd/types.ts +0 -84
  314. package/src/tdd/verdict-reader.ts +0 -266
  315. package/src/tdd/verdict.ts +0 -152
  316. package/src/tui/App.tsx +0 -265
  317. package/src/tui/components/AgentPanel.tsx +0 -75
  318. package/src/tui/components/CostOverlay.tsx +0 -118
  319. package/src/tui/components/HelpOverlay.tsx +0 -107
  320. package/src/tui/components/StatusBar.tsx +0 -63
  321. package/src/tui/components/StoriesPanel.tsx +0 -177
  322. package/src/tui/hooks/useKeyboard.ts +0 -142
  323. package/src/tui/hooks/useLayout.ts +0 -137
  324. package/src/tui/hooks/usePipelineEvents.ts +0 -183
  325. package/src/tui/hooks/usePty.ts +0 -189
  326. package/src/tui/index.tsx +0 -38
  327. package/src/tui/types.ts +0 -76
  328. package/src/utils/errors.ts +0 -12
  329. package/src/utils/git.ts +0 -245
  330. package/src/utils/json-file.ts +0 -72
  331. package/src/utils/log-test-output.ts +0 -25
  332. package/src/utils/path-security.ts +0 -73
  333. package/src/utils/queue-writer.ts +0 -54
  334. package/src/verification/crash-detector.ts +0 -34
  335. package/src/verification/executor.ts +0 -250
  336. package/src/verification/index.ts +0 -12
  337. package/src/verification/orchestrator-types.ts +0 -154
  338. package/src/verification/orchestrator.ts +0 -76
  339. package/src/verification/parser.ts +0 -220
  340. package/src/verification/rectification-loop.ts +0 -172
  341. package/src/verification/rectification.ts +0 -108
  342. package/src/verification/runners.ts +0 -129
  343. package/src/verification/smart-runner.ts +0 -307
  344. package/src/verification/strategies/acceptance.ts +0 -136
  345. package/src/verification/strategies/regression.ts +0 -90
  346. package/src/verification/strategies/scoped.ts +0 -154
  347. package/src/verification/types.ts +0 -117
  348. package/src/version.ts +0 -40
  349. package/src/worktree/dispatcher.ts +0 -6
  350. package/src/worktree/index.ts +0 -2
  351. package/src/worktree/manager.ts +0 -193
  352. package/src/worktree/merge.ts +0 -302
  353. package/src/worktree/types.ts +0 -4
@@ -1,522 +0,0 @@
1
- /**
2
- * Runtime Configuration Type Definitions
3
- *
4
- * All configuration interfaces for nax runtime behavior,
5
- * including execution limits, quality gates, and feature settings.
6
- */
7
-
8
- import type { Complexity, LlmRoutingMode, ModelMap, ModelTier, RoutingStrategyName, TddStrategy } from "./schema-types";
9
-
10
- export interface EscalationEntry {
11
- from: string;
12
- to: string;
13
- }
14
-
15
- /** Auto mode configuration */
16
- export interface AutoModeConfig {
17
- enabled: boolean;
18
- /** Default agent to use */
19
- defaultAgent: string;
20
- /** Fallback order when agent is rate-limited */
21
- fallbackOrder: string[];
22
- /** Model tier per complexity */
23
- complexityRouting: Record<Complexity, ModelTier>;
24
- /** Escalation config */
25
- escalation: {
26
- enabled: boolean;
27
- /** Ordered tier escalation with per-tier attempt budgets */
28
- tierOrder: Array<{ tier: string; attempts: number }>;
29
- /** When a batch fails, escalate all stories in the batch (default: true) */
30
- escalateEntireBatch?: boolean;
31
- };
32
- }
33
-
34
- /** Rectification config (v0.11) */
35
- export interface RectificationConfig {
36
- /** Enable rectification loop (retry failed tests with failure context) */
37
- enabled: boolean;
38
- /** Max retry attempts per story (default: 2) */
39
- maxRetries: number;
40
- /** Timeout for full test suite run in seconds (default: 120) */
41
- fullSuiteTimeoutSeconds: number;
42
- /** Max characters in failure summary sent to agent (default: 2000) */
43
- maxFailureSummaryChars: number;
44
- /** Abort rectification if failure count increases (default: true) */
45
- abortOnIncreasingFailures: boolean;
46
- }
47
-
48
- /** Regression gate config (BUG-009, BUG-026) */
49
- export interface RegressionGateConfig {
50
- /** Enable full-suite regression gate after scoped verification (default: true) */
51
- enabled: boolean;
52
- /** Timeout for full-suite regression run in seconds (default: 120) */
53
- timeoutSeconds: number;
54
- /** Accept timeout as pass instead of failing (BUG-026, default: true) */
55
- acceptOnTimeout?: boolean;
56
- /** Mode of regression gate: 'deferred' (run once after all stories), 'per-story' (run after each story), 'disabled' (default: 'deferred') */
57
- mode?: "deferred" | "per-story" | "disabled";
58
- /** Max rectification attempts for deferred regression gate (default: 2) */
59
- maxRectificationAttempts?: number;
60
- }
61
-
62
- /** Smart test runner configuration (STR-007) */
63
- export interface SmartTestRunnerConfig {
64
- /** Enable smart test runner (default: true) */
65
- enabled: boolean;
66
- /** Glob patterns to scan for test files during import-grep fallback */
67
- testFilePatterns: string[];
68
- /** Fallback strategy when path-convention mapping yields no results */
69
- fallback: "import-grep" | "full-suite";
70
- }
71
-
72
- /** Execution limits */
73
- export interface ExecutionConfig {
74
- /** Max iterations per feature run (auto-calculated from tierOrder sum if not set) */
75
- maxIterations: number;
76
- /** Delay between iterations (ms) */
77
- iterationDelayMs: number;
78
- /** Max cost (USD) before pausing */
79
- costLimit: number;
80
- /** Timeout per agent coding session (seconds) */
81
- sessionTimeoutSeconds: number;
82
- /** Verification subprocess timeout in seconds (ADR-003 Decision 4) */
83
- verificationTimeoutSeconds: number;
84
- /** Max stories per feature (prevents memory exhaustion) */
85
- maxStoriesPerFeature: number;
86
- /** Rectification loop settings (v0.11) */
87
- rectification: RectificationConfig;
88
- /** Regression gate settings (BUG-009) */
89
- regressionGate: RegressionGateConfig;
90
- /** Token budget for plugin context providers (default: 2000) */
91
- contextProviderTokenBudget: number;
92
- /** Test command override (null = disabled, undefined = auto-detect from package.json) */
93
- testCommand?: string | null;
94
- /** Lint command override (null = disabled, undefined = auto-detect from package.json) */
95
- lintCommand?: string | null;
96
- /** Typecheck command override (null = disabled, undefined = auto-detect from package.json) */
97
- typecheckCommand?: string | null;
98
- /** Use --dangerously-skip-permissions flag for agent (default: true for backward compat, SEC-1 fix) */
99
- dangerouslySkipPermissions?: boolean;
100
- /** Permission profile — takes precedence over dangerouslySkipPermissions (Phase 1) */
101
- permissionProfile?: "unrestricted" | "safe" | "scoped";
102
- /** Per-stage permission overrides — only read when permissionProfile = "scoped" (Phase 2) */
103
- permissions?: Record<
104
- string,
105
- {
106
- mode: "approve-all" | "approve-reads" | "scoped";
107
- allowedTools?: string[];
108
- inherit?: string;
109
- }
110
- >;
111
- /** Enable smart test runner to scope test runs to changed files (default: true).
112
- * Accepts boolean for backward compat or a SmartTestRunnerConfig object. */
113
- smartTestRunner?: boolean | SmartTestRunnerConfig;
114
- /** Configured agent binary: claude, codex, opencode, gemini, aider (default: claude) */
115
- agent?: string;
116
- /** Git HEAD ref captured before agent ran — passed through pipeline for plugin reviewers (FEAT-010) */
117
- storyGitRef?: string;
118
- }
119
-
120
- /** Quality gate config */
121
- export interface QualityConfig {
122
- /** Require typecheck to pass */
123
- requireTypecheck: boolean;
124
- /** Require lint to pass */
125
- requireLint: boolean;
126
- /** Require tests to pass */
127
- requireTests: boolean;
128
- /** Custom quality commands */
129
- commands: {
130
- typecheck?: string;
131
- lint?: string;
132
- test?: string;
133
- /** Scoped test command template with {{files}} placeholder (e.g., "bun test --timeout=60000 {{files}}") */
134
- testScoped?: string;
135
- /** Auto-fix lint errors (e.g., "biome check --fix") */
136
- lintFix?: string;
137
- /** Auto-fix formatting (e.g., "biome format --write") */
138
- formatFix?: string;
139
- };
140
- /** Auto-fix configuration (Phase 2) */
141
- autofix?: {
142
- /** Whether to auto-fix lint/format errors before escalating (default: true) */
143
- enabled?: boolean;
144
- /** Max auto-fix attempts (default: 2) */
145
- maxAttempts?: number;
146
- };
147
- /** Append --forceExit to test command to prevent open handle hangs (default: false) */
148
- forceExit: boolean;
149
- /** Append --detectOpenHandles on timeout retry to diagnose hangs (default: true) */
150
- detectOpenHandles: boolean;
151
- /** Max retries with --detectOpenHandles before falling back to --forceExit (default: 1) */
152
- detectOpenHandlesRetries: number;
153
- /** Grace period in ms after SIGTERM before sending SIGKILL (default: 5000) */
154
- gracePeriodMs: number;
155
- /** Deadline in ms to drain stdout/stderr after killing process (Bun stream workaround, default: 2000) */
156
- drainTimeoutMs: number;
157
- /** Shell to use for running verification commands (default: /bin/sh) */
158
- shell: string;
159
- /** Environment variables to strip during verification (prevents AI-optimized output) */
160
- stripEnvVars: string[];
161
- /** Divisor for environmental failure early escalation (default: 2 = half the tier budget) */
162
- environmentalEscalationDivisor: number;
163
- /** Hermetic test enforcement settings (ENH-010). Supports per-package override. */
164
- testing?: TestingConfig;
165
- }
166
-
167
- /** TDD config */
168
- export interface TddConfig {
169
- /** Max retries for each session before escalating */
170
- maxRetries: number;
171
- /** Auto-verify isolation between sessions */
172
- autoVerifyIsolation: boolean;
173
- /** TDD strategy override (default: 'auto') */
174
- strategy: TddStrategy;
175
- /** Session 3 verifier: auto-approve legitimate fixes */
176
- autoApproveVerifier: boolean;
177
- /** Per-session model tier overrides. Defaults: test-writer=balanced, implementer=story tier, verifier=fast */
178
- sessionTiers?: {
179
- /** Model tier for test-writer session (default: "balanced") */
180
- testWriter?: ModelTier;
181
- /** Model tier for implementer session (default: uses story's routed tier) */
182
- implementer?: ModelTier;
183
- /** Model tier for verifier session (default: "fast") */
184
- verifier?: ModelTier;
185
- };
186
- /** Glob patterns for files test-writer can modify (soft violations, logged as warnings) */
187
- testWriterAllowedPaths?: string[];
188
- /** Rollback git changes when TDD fails (default: true). Prevents partial commits when TDD fails. */
189
- rollbackOnFailure?: boolean;
190
- /** Enable greenfield detection to force test-after on projects with no test files (default: true, BUG-010) */
191
- greenfieldDetection?: boolean;
192
- }
193
-
194
- /** Constitution config */
195
- export interface ConstitutionConfig {
196
- /** Enable constitution loading and injection */
197
- enabled: boolean;
198
- /** Path to constitution file relative to nax/ directory */
199
- path: string;
200
- /** Maximum tokens allowed for constitution content */
201
- maxTokens: number;
202
- /** Skip loading global constitution (default: false) */
203
- skipGlobal?: boolean;
204
- }
205
-
206
- /** Analyze config */
207
- export interface AnalyzeConfig {
208
- /** Enable LLM-enhanced analysis */
209
- llmEnhanced: boolean;
210
- /** Model tier for decompose+classify (default: balanced) */
211
- model: ModelTier;
212
- /** Fall back to keyword matching on LLM failure */
213
- fallbackToKeywords: boolean;
214
- /** Max tokens for codebase summary */
215
- maxCodebaseSummaryTokens: number;
216
- }
217
-
218
- /** Review config */
219
- export interface ReviewConfig {
220
- /** Enable review phase */
221
- enabled: boolean;
222
- /** List of checks to run */
223
- checks: Array<"typecheck" | "lint" | "test">;
224
- /** Custom commands per check */
225
- commands: {
226
- typecheck?: string;
227
- lint?: string;
228
- test?: string;
229
- };
230
- /** Plugin reviewer mode: "per-story" (run after each story) or "deferred" (run once at end of run, default: "per-story") */
231
- pluginMode?: "per-story" | "deferred";
232
- }
233
-
234
- /** Plan config */
235
- export interface PlanConfig {
236
- /** Model tier for planning (default: balanced) */
237
- model: ModelTier;
238
- /** Output path for generated spec (relative to nax/ directory) */
239
- outputPath: string;
240
- }
241
-
242
- /** Valid test strategy values for acceptance testing */
243
- export type AcceptanceTestStrategy = "unit" | "component" | "cli" | "e2e" | "snapshot";
244
-
245
- /** Acceptance validation config */
246
- export interface AcceptanceConfig {
247
- /** Enable acceptance test generation and validation */
248
- enabled: boolean;
249
- /** Maximum retry loops for fix stories (default: 2) */
250
- maxRetries: number;
251
- /** Generate acceptance tests during analyze (default: true) */
252
- generateTests: boolean;
253
- /** Path to acceptance test file (relative to feature directory) */
254
- testPath: string;
255
- /** Model tier for AC refinement LLM calls (default: "fast") */
256
- model: ModelTier;
257
- /** Whether to LLM-refine acceptance criteria before generating tests (default: true) */
258
- refinement: boolean;
259
- /** Whether to run RED gate check after generating acceptance tests (default: true) */
260
- redGate: boolean;
261
- /** Test strategy for acceptance tests (default: auto-detect) */
262
- testStrategy?: AcceptanceTestStrategy;
263
- /** Test framework for acceptance tests (default: auto-detect) */
264
- testFramework?: string;
265
- /** Timeout for acceptance test generation in milliseconds (default: 1800000 = 30 min) */
266
- timeoutMs: number;
267
- }
268
-
269
- /** Optimizer config (v0.10) */
270
- export interface OptimizerConfig {
271
- /** Enable prompt optimizer */
272
- enabled: boolean;
273
- /** Optimization strategy: "rule-based" | "llm" | "noop" */
274
- strategy?: "rule-based" | "llm" | "noop";
275
- /** Strategy-specific configurations */
276
- strategies?: {
277
- "rule-based"?: {
278
- stripWhitespace?: boolean;
279
- compactCriteria?: boolean;
280
- deduplicateContext?: boolean;
281
- maxPromptTokens?: number;
282
- };
283
- llm?: {
284
- model?: ModelTier;
285
- targetReduction?: number;
286
- minPromptTokens?: number;
287
- };
288
- custom?: {
289
- module?: string;
290
- options?: Record<string, unknown>;
291
- };
292
- };
293
- }
294
-
295
- export interface PluginConfigEntry {
296
- module: string;
297
- config?: Record<string, unknown>;
298
- enabled?: boolean;
299
- }
300
-
301
- export interface HooksConfig {
302
- skipGlobal?: boolean;
303
- hooks: Record<string, unknown>;
304
- }
305
-
306
- /** Interaction config (v0.15.0) */
307
- export interface InteractionConfig {
308
- /** Plugin to use for interactions (default: "cli") */
309
- plugin: string;
310
- /** Plugin-specific configuration */
311
- config?: Record<string, unknown>;
312
- /** Default settings */
313
- defaults: {
314
- /** Default timeout in milliseconds (default: 600000 = 10 minutes) */
315
- timeout: number;
316
- /** Default fallback behavior (default: "escalate") */
317
- fallback: "continue" | "skip" | "escalate" | "abort";
318
- };
319
- /** Enable/disable built-in triggers */
320
- triggers: Partial<
321
- Record<string, boolean | { enabled: boolean; fallback?: string; timeout?: number; threshold?: number }>
322
- >;
323
- }
324
-
325
- /** Test coverage context config */
326
- export interface TestCoverageConfig {
327
- /** Enable test coverage context injection (default: true) */
328
- enabled: boolean;
329
- /** Detail level for test summary */
330
- detail: "names-only" | "names-and-counts" | "describe-blocks";
331
- /** Max tokens for the summary (default: 500) */
332
- maxTokens: number;
333
- /** Test directory relative to workdir (default: auto-detect) */
334
- testDir?: string;
335
- /** Glob pattern for test files */
336
- testPattern: string;
337
- /** Scope test coverage to story-relevant files only (default: true) */
338
- scopeToStory: boolean;
339
- }
340
-
341
- export interface ContextAutoDetectConfig {
342
- enabled: boolean;
343
- maxFiles: number;
344
- traceImports: boolean;
345
- }
346
-
347
- export interface ContextConfig {
348
- testCoverage: TestCoverageConfig;
349
- autoDetect: ContextAutoDetectConfig;
350
- fileInjection?: "keyword" | "disabled";
351
- }
352
-
353
- /** Story size gate thresholds (v0.16.0) */
354
- export interface StorySizeGateConfig {
355
- /** Enable story size gate (default: true) */
356
- enabled: boolean;
357
- /** Max acceptance criteria count before flagging (default: 6) */
358
- maxAcCount: number;
359
- /** Max description character length before flagging (default: 2000) */
360
- maxDescriptionLength: number;
361
- /** Max bullet point count before flagging (default: 8) */
362
- maxBulletPoints: number;
363
- }
364
-
365
- /** Precheck configuration (v0.16.0) */
366
- export interface PrecheckConfig {
367
- /** Story size gate settings */
368
- storySizeGate: StorySizeGateConfig;
369
- }
370
-
371
- export interface AdaptiveRoutingConfig {
372
- minSamples: number;
373
- costThreshold: number;
374
- fallbackStrategy: "keyword" | "llm" | "manual";
375
- }
376
-
377
- /** LLM routing config */
378
- export interface LlmRoutingConfig {
379
- /** Model tier for routing call (default: "fast") */
380
- model?: string;
381
- /** Fall back to keyword strategy on LLM failure (default: true) */
382
- fallbackToKeywords?: boolean;
383
- /** Max input tokens for story context (default: 2000) */
384
- /** Cache routing decisions per story ID (default: true) */
385
- cacheDecisions?: boolean;
386
- /** Routing mode (default: "hybrid")
387
- * - "one-shot": batch-route ALL pending stories once at run start, use keyword fallback on cache miss
388
- * - "per-story": route each story individually just before execution (max LLM calls = N stories)
389
- * - "hybrid": batch-route upfront, re-route individually on retry/failure (best quality + cost balance)
390
- */
391
- mode?: LlmRoutingMode;
392
- /** @deprecated Use mode instead. Will be removed in v1.0 */
393
- batchMode?: boolean;
394
- /** Timeout for LLM call in milliseconds (default: 30000) */
395
- timeoutMs?: number;
396
- /** Number of retries on LLM timeout or transient failure (default: 1) */
397
- retries?: number;
398
- /** Delay between retries in milliseconds (default: 1000) */
399
- retryDelayMs?: number;
400
- }
401
-
402
- /** Routing config */
403
- export interface RoutingConfig {
404
- /** Strategy to use (default: "keyword") */
405
- strategy: RoutingStrategyName;
406
- /** Path to custom strategy file (required if strategy = "custom") */
407
- customStrategyPath?: string;
408
- /** Adaptive routing settings (used when strategy = "adaptive") */
409
- adaptive?: AdaptiveRoutingConfig;
410
- /** LLM routing settings (used when strategy = "llm") */
411
- llm?: LlmRoutingConfig;
412
- }
413
-
414
- /** Prompt overrides config (PB-003) */
415
- export interface PromptsConfig {
416
- overrides?: Partial<
417
- Record<"test-writer" | "implementer" | "verifier" | "single-session" | "tdd-simple" | "batch", string>
418
- >;
419
- }
420
-
421
- /** Decompose config (SD-003) */
422
- export interface DecomposeConfig {
423
- /** Trigger mode: 'auto' = decompose automatically, 'confirm' = ask user, 'disabled' = skip */
424
- trigger: "auto" | "confirm" | "disabled";
425
- /** Max acceptance criteria before flagging a story as oversized (default: 6) */
426
- maxAcceptanceCriteria: number;
427
- /** Max number of substories to generate (default: 5) */
428
- maxSubstories: number;
429
- /** Max complexity for any generated substory (default: 'medium') */
430
- maxSubstoryComplexity: Complexity;
431
- /** Max retries on decomposition validation failure (default: 2) */
432
- maxRetries: number;
433
- /** Model tier for decomposition LLM calls (default: 'balanced') */
434
- model: ModelTier;
435
- }
436
-
437
- /** Hermetic test enforcement configuration (ENH-010) */
438
- export interface TestingConfig {
439
- /**
440
- * When true (default), nax injects a hermetic test requirement into all code-writing prompts.
441
- * Instructs the AI to mock all I/O boundaries and never call real external services in tests.
442
- */
443
- hermetic: boolean;
444
- /**
445
- * Project-specific external boundaries to mock (e.g. ["claude", "acpx", "redis", "grpc"]).
446
- * Injected into the hermetic requirement section so the AI knows which project tools to mock.
447
- */
448
- externalBoundaries?: string[];
449
- /**
450
- * Project-specific mocking guidance injected verbatim into the prompt.
451
- * E.g. "Use injectable deps for CLI spawning, ioredis-mock for Redis"
452
- */
453
- mockGuidance?: string;
454
- }
455
-
456
- /** Full nax configuration */
457
- export interface NaxConfig {
458
- /** Schema version */
459
- version: 1;
460
- /** Model mapping — abstract tiers to actual model identifiers */
461
- models: ModelMap;
462
- /** Auto mode / routing config */
463
- autoMode: AutoModeConfig;
464
- /** Routing strategy config */
465
- routing: RoutingConfig;
466
- /** Execution limits */
467
- execution: ExecutionConfig;
468
- /** Quality gates */
469
- quality: QualityConfig;
470
- /** TDD settings */
471
- tdd: TddConfig;
472
- /** Constitution settings */
473
- constitution: ConstitutionConfig;
474
- /** Analyze settings */
475
- analyze: AnalyzeConfig;
476
- /** Review settings */
477
- review: ReviewConfig;
478
- /** Plan settings */
479
- plan: PlanConfig;
480
- /** Acceptance validation settings */
481
- acceptance: AcceptanceConfig;
482
- /** Context injection settings */
483
- context: ContextConfig;
484
- /** Optimizer settings (v0.10) */
485
- optimizer?: OptimizerConfig;
486
- /** Plugin configurations (v0.10) */
487
- plugins?: PluginConfigEntry[];
488
- /** Disabled plugin names (v0.38.2) */
489
- disabledPlugins?: string[];
490
- /** Hooks configuration (v0.10) */
491
- hooks?: HooksConfig;
492
- /** Interaction settings (v0.15.0) */
493
- interaction?: InteractionConfig;
494
- /** Precheck settings (v0.16.0) */
495
- precheck?: PrecheckConfig;
496
- /** Prompt override settings (PB-003) */
497
- prompts?: PromptsConfig;
498
- /** Decompose settings (SD-003) */
499
- decompose?: DecomposeConfig;
500
- /** Agent protocol settings (ACP-003) */
501
- agent?: AgentConfig;
502
- /** Generate settings */
503
- generate?: GenerateConfig;
504
- }
505
-
506
- /** Generate command configuration */
507
- export interface GenerateConfig {
508
- /**
509
- * Agents to generate config files for (default: all).
510
- * Restricts `nax generate` to only the listed agents.
511
- * @example ["claude", "opencode"]
512
- */
513
- agents?: Array<"claude" | "codex" | "opencode" | "cursor" | "windsurf" | "aider" | "gemini">;
514
- }
515
-
516
- /** Agent protocol configuration (ACP-003) */
517
- export interface AgentConfig {
518
- /** Protocol to use for agent communication (default: 'acp') */
519
- protocol?: "acp" | "cli";
520
- /** Max interaction turns when interactionBridge is active (default: 10) */
521
- maxInteractionTurns?: number;
522
- }
@@ -1,53 +0,0 @@
1
- /**
2
- * JSON Schema Type Definitions
3
- *
4
- * Fundamental types used to define the nax configuration schema,
5
- * including model tier definitions and basic enumerations.
6
- */
7
-
8
- export type Complexity = "simple" | "medium" | "complex" | "expert";
9
- export type TestStrategy = "test-after" | "tdd-simple" | "three-session-tdd" | "three-session-tdd-lite";
10
- export type TddStrategy = "auto" | "strict" | "lite" | "simple" | "off";
11
-
12
- /** Model tier names — extensible (TYPE-3 fix: preserve autocomplete for known tiers) */
13
- export type ModelTier = "fast" | "balanced" | "powerful" | (string & {});
14
-
15
- export interface TokenPricing {
16
- inputPer1M: number;
17
- outputPer1M: number;
18
- }
19
-
20
- export interface ModelDef {
21
- provider: string;
22
- model: string;
23
- pricing?: TokenPricing;
24
- env?: Record<string, string>;
25
- }
26
-
27
- export type ModelEntry = ModelDef | string;
28
- export type ModelMap = Record<ModelTier, ModelEntry>;
29
-
30
- export interface TierConfig {
31
- tier: string;
32
- attempts: number;
33
- }
34
-
35
- export type RoutingStrategyName = "keyword" | "llm" | "manual" | "adaptive" | "custom";
36
-
37
- export type LlmRoutingMode = "one-shot" | "per-story" | "hybrid";
38
-
39
- /** Resolve a ModelEntry (string shorthand or full object) into a ModelDef */
40
- export function resolveModel(entry: ModelEntry): ModelDef {
41
- if (typeof entry === "string") {
42
- // Infer provider from model name
43
- const provider = entry.startsWith("claude")
44
- ? "anthropic"
45
- : entry.startsWith("gpt") || entry.startsWith("o1") || entry.startsWith("o3")
46
- ? "openai"
47
- : entry.startsWith("gemini")
48
- ? "google"
49
- : "unknown";
50
- return { provider, model: entry };
51
- }
52
- return entry;
53
- }
@@ -1,60 +0,0 @@
1
- /**
2
- * Configuration Schema — Re-export Barrel
3
- *
4
- * Backward-compatible re-exports from split modules:
5
- * - types.ts: All TypeScript interfaces, type aliases, resolveModel
6
- * - schemas.ts: Zod validation schemas
7
- * - defaults.ts: DEFAULT_CONFIG constant
8
- */
9
-
10
- // Types and resolveModel
11
- export type {
12
- Complexity,
13
- TestStrategy,
14
- TddStrategy,
15
- EscalationEntry,
16
- ModelTier,
17
- TokenPricing,
18
- ModelDef,
19
- ModelEntry,
20
- ModelMap,
21
- TierConfig,
22
- AutoModeConfig,
23
- RectificationConfig,
24
- RegressionGateConfig,
25
- ExecutionConfig,
26
- QualityConfig,
27
- TddConfig,
28
- ConstitutionConfig,
29
- AnalyzeConfig,
30
- ReviewConfig,
31
- PlanConfig,
32
- AcceptanceConfig,
33
- AcceptanceTestStrategy,
34
- OptimizerConfig,
35
- PluginConfigEntry,
36
- HooksConfig,
37
- InteractionConfig,
38
- TestCoverageConfig,
39
- ContextAutoDetectConfig,
40
- ContextConfig,
41
- RoutingStrategyName,
42
- AdaptiveRoutingConfig,
43
- LlmRoutingMode,
44
- LlmRoutingConfig,
45
- RoutingConfig,
46
- StorySizeGateConfig,
47
- PrecheckConfig,
48
- SmartTestRunnerConfig,
49
- DecomposeConfig,
50
- NaxConfig,
51
- AgentConfig,
52
- } from "./types";
53
-
54
- export { resolveModel } from "./types";
55
-
56
- // Zod schemas
57
- export { NaxConfigSchema, AcceptanceConfigSchema } from "./schemas";
58
-
59
- // Default config
60
- export { DEFAULT_CONFIG } from "./defaults";