@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.
Files changed (383) hide show
  1. package/CHANGELOG.md +13 -2
  2. package/dist/nax.js +72691 -0
  3. package/package.json +12 -4
  4. package/src/cli/config.ts +42 -1
  5. package/src/cli/prompts.ts +18 -6
  6. package/src/config/defaults.ts +2 -0
  7. package/src/config/schemas.ts +11 -0
  8. package/src/config/types.ts +8 -0
  9. package/src/context/builder.ts +10 -1
  10. package/src/pipeline/stages/execution.ts +5 -0
  11. package/src/pipeline/stages/prompt.ts +13 -4
  12. package/src/precheck/checks-warnings.ts +37 -0
  13. package/src/precheck/checks.ts +1 -0
  14. package/src/precheck/index.ts +14 -7
  15. package/src/prompts/builder.ts +178 -0
  16. package/src/prompts/index.ts +2 -0
  17. package/src/prompts/loader.ts +43 -0
  18. package/src/prompts/sections/conventions.ts +15 -0
  19. package/src/prompts/sections/index.ts +11 -0
  20. package/src/prompts/sections/isolation.ts +24 -0
  21. package/src/prompts/sections/role-task.ts +34 -0
  22. package/src/prompts/sections/story.ts +13 -0
  23. package/src/prompts/sections/verdict.ts +70 -0
  24. package/src/prompts/templates/implementer.ts +6 -0
  25. package/src/prompts/templates/single-session.ts +6 -0
  26. package/src/prompts/templates/test-writer.ts +6 -0
  27. package/src/prompts/templates/verifier.ts +6 -0
  28. package/src/prompts/types.ts +21 -0
  29. package/src/review/runner.ts +6 -1
  30. package/src/tdd/session-runner.ts +12 -12
  31. package/src/version.ts +2 -1
  32. package/.claude/rules/01-project-conventions.md +0 -34
  33. package/.claude/rules/02-test-architecture.md +0 -39
  34. package/.claude/rules/03-test-writing.md +0 -58
  35. package/.claude/rules/04-forbidden-patterns.md +0 -29
  36. package/.claude/settings.json +0 -15
  37. package/.githooks/pre-commit +0 -16
  38. package/.gitlab-ci.yml +0 -103
  39. package/.mcp.json +0 -8
  40. package/BRIEF.md +0 -140
  41. package/CLAUDE.md +0 -143
  42. package/US-007-IMPLEMENTATION.md +0 -139
  43. package/biome.json +0 -14
  44. package/bun.lock +0 -163
  45. package/bunfig.toml +0 -12
  46. package/docker-compose.test.yml +0 -15
  47. package/docs/20260216-fix-plan-context-review.md +0 -56
  48. package/docs/20260216-relentless-vs-ngent-comparison.md +0 -208
  49. package/docs/20260216-v02-plan.md +0 -136
  50. package/docs/20260216-v02-review.md +0 -685
  51. package/docs/20260217-dogfood-findings.md +0 -56
  52. package/docs/20260217-p2-plus-plan.md +0 -117
  53. package/docs/20260217-partial-fixes-plan.md +0 -62
  54. package/docs/20260217-plan-analyze-spec.md +0 -117
  55. package/docs/20260217-post-impl-review.md +0 -1137
  56. package/docs/20260217-quick-wins-plan.md +0 -66
  57. package/docs/20260217-split-runner-plan.md +0 -75
  58. package/docs/20260217-v03-impl-plan.md +0 -80
  59. package/docs/20260217-v03-post-impl-review.md +0 -589
  60. package/docs/20260217-v04-impl-plan.md +0 -86
  61. package/docs/20260217-v05-post-impl-review.md +0 -850
  62. package/docs/20260217-v06-post-impl-review.md +0 -817
  63. package/docs/20260218-adr003-port-plan.md +0 -151
  64. package/docs/20260218-review-adr003-verification.md +0 -175
  65. package/docs/20260219-fix-plan-bug16-19.md +0 -79
  66. package/docs/20260219-fix-plan-bug20-22.md +0 -114
  67. package/docs/20260219-plan-llm-routing.md +0 -116
  68. package/docs/20260219-review-bug20-22-fixes.md +0 -135
  69. package/docs/20260219-routing-baseline-keyword.md +0 -63
  70. package/docs/20260220-plan-structured-logging-p1.md +0 -80
  71. package/docs/20260220-plan-structured-logging-p2.md +0 -37
  72. package/docs/20260220-review-llm-routing.md +0 -180
  73. package/docs/20260220-review-post-fix-llm-routing.md +0 -70
  74. package/docs/20260221-fix-plan-relevantfiles-split.md +0 -101
  75. package/docs/20260221-fix-plan-routing-mode.md +0 -125
  76. package/docs/20260221-review-v0.9-implementation.md +0 -379
  77. package/docs/20260222-fix-plan-v091-routing-isolation.md +0 -197
  78. package/docs/20260223-fix-plan-prompt-audit.md +0 -62
  79. package/docs/20260224-nax-roadmap-phases.md +0 -189
  80. package/docs/20260225-phase2-llm-service-layer.md +0 -401
  81. package/docs/20260225-review-v0.10.1.md +0 -187
  82. package/docs/20260303-v010-implementation-plan.md +0 -165
  83. package/docs/20260304-review-nax.md +0 -492
  84. package/docs/CLAUDE.md.bak +0 -191
  85. package/docs/ROADMAP.md +0 -364
  86. package/docs/SPEC-rectification.md +0 -0
  87. package/docs/SPEC.md +0 -324
  88. package/docs/US-001-plugin-loading-verification.md +0 -152
  89. package/docs/adr/ADR-005-implementation-plan.md +0 -655
  90. package/docs/adr/ADR-005-pipeline-re-architecture.md +0 -464
  91. package/docs/architecture-analysis.md +0 -1076
  92. package/docs/bugs/BUG-21-escalation-null-attempts.md +0 -48
  93. package/docs/bugs-from-dogfood-run-c.md +0 -243
  94. package/docs/code-review-20260228.md +0 -612
  95. package/docs/code-review-v0.15.0.md +0 -629
  96. package/docs/hook-lifecycle-test-plan.md +0 -149
  97. package/docs/releases/v0.11.0-and-earlier.md +0 -20
  98. package/docs/releases/v0.12.0.md +0 -15
  99. package/docs/releases/v0.13.0.md +0 -14
  100. package/docs/releases/v0.14.0.md +0 -20
  101. package/docs/releases/v0.14.1.md +0 -36
  102. package/docs/releases/v0.14.2.md +0 -51
  103. package/docs/releases/v0.14.3.md +0 -174
  104. package/docs/releases/v0.14.4.md +0 -94
  105. package/docs/releases/v0.15.0.md +0 -502
  106. package/docs/releases/v0.15.1.md +0 -170
  107. package/docs/releases/v0.15.3.md +0 -193
  108. package/docs/specs/bug-039-orphan-processes.md +0 -131
  109. package/docs/specs/bug-040-review-rectification.md +0 -82
  110. package/docs/specs/bug-041-cross-story-test-isolation.md +0 -88
  111. package/docs/specs/bug-042-verifier-failure-capture.md +0 -117
  112. package/docs/specs/bun-pty-migration.md +0 -171
  113. package/docs/specs/central-run-registry.md +0 -116
  114. package/docs/specs/feat-010-smart-runner-git-history.md +0 -96
  115. package/docs/specs/feat-011-file-context-strategy.md +0 -73
  116. package/docs/specs/feat-012-tdd-writer-tier.md +0 -79
  117. package/docs/specs/feat-013-test-after-review.md +0 -89
  118. package/docs/specs/feat-014-heartbeat-observability.md +0 -127
  119. package/docs/specs/status-file-consolidation.md +0 -93
  120. package/docs/specs/status-file-v0.10.1.md +0 -812
  121. package/docs/specs/trigger-completion.md +0 -145
  122. package/docs/specs/verification-architecture-v2.md +0 -343
  123. package/docs/tdd/strategies.md +0 -97
  124. package/docs/v0.10-global-config.md +0 -206
  125. package/docs/v0.10-plugin-system.md +0 -415
  126. package/docs/v0.10-prompt-optimizer.md +0 -234
  127. package/docs/v0.3-spec.md +0 -244
  128. package/docs/v0.4-spec.md +0 -140
  129. package/docs/v0.5-spec.md +0 -237
  130. package/docs/v0.6-spec.md +0 -371
  131. package/docs/v0.7-spec.md +0 -177
  132. package/docs/v0.8-llm-routing.md +0 -206
  133. package/docs/v0.8-structured-logging.md +0 -132
  134. package/docs/v0.9.3-prompt-audit.md +0 -112
  135. package/examples/plugins/console-reporter/index.test.ts +0 -207
  136. package/examples/plugins/console-reporter/index.ts +0 -110
  137. package/memory/topic/feat-010-baseref.md +0 -28
  138. package/memory/topic/feat-013-test-after-deprecation.md +0 -22
  139. package/nax/config.json +0 -154
  140. package/nax/features/bug-039-medium/prd.json +0 -45
  141. package/nax/features/bugfix-v0171/prd.json +0 -52
  142. package/nax/features/central-run-registry/prd.json +0 -105
  143. package/nax/features/config-management/prd.json +0 -108
  144. package/nax/features/config-management/progress.txt +0 -5
  145. package/nax/features/diagnose/acceptance.test.ts +0 -414
  146. package/nax/features/diagnose/prd.json +0 -41
  147. package/nax/features/nax-compliance/prd.json +0 -52
  148. package/nax/features/nax-compliance/progress.txt +0 -1
  149. package/nax/features/orchestration-fixes/prd.json +0 -89
  150. package/nax/features/orchestration-fixes/progress.txt +0 -1
  151. package/nax/features/plugin-integration/US-007-VERIFICATION.md +0 -259
  152. package/nax/features/plugin-integration/prd.json +0 -208
  153. package/nax/features/plugin-integration/progress.txt +0 -5
  154. package/nax/features/post-rearch-bugfix/prd.json +0 -137
  155. package/nax/features/precheck/prd.json +0 -205
  156. package/nax/features/precheck/progress.txt +0 -15
  157. package/nax/features/review-quality/prd.json +0 -55
  158. package/nax/features/routing-persistence/prd.json +0 -104
  159. package/nax/features/routing-persistence/progress.txt +0 -1
  160. package/nax/features/smart-test-runner/plan.md +0 -7
  161. package/nax/features/smart-test-runner/prd.json +0 -203
  162. package/nax/features/smart-test-runner/progress.txt +0 -13
  163. package/nax/features/smart-test-runner/spec.md +0 -7
  164. package/nax/features/smart-test-runner/tasks.md +0 -8
  165. package/nax/features/status-file-consolidation/prd.json +0 -106
  166. package/nax/features/structured-logging/prd.json +0 -199
  167. package/nax/features/trigger-completion/prd.json +0 -150
  168. package/nax/features/trigger-completion/progress.txt +0 -7
  169. package/nax/features/unlock/prd.json +0 -36
  170. package/nax/features/v0.18.3-execution-reliability/prd.json +0 -80
  171. package/nax/features/v0.18.3-execution-reliability/progress.txt +0 -3
  172. package/nax/features/v0.19.0-hardening/plan.md +0 -7
  173. package/nax/features/v0.19.0-hardening/prd.json +0 -84
  174. package/nax/features/v0.19.0-hardening/progress.txt +0 -7
  175. package/nax/features/v0.19.0-hardening/spec.md +0 -18
  176. package/nax/features/v0.19.0-hardening/tasks.md +0 -8
  177. package/nax/features/verify-v2/prd.json +0 -79
  178. package/nax/features/verify-v2/progress.txt +0 -3
  179. package/nax/status.json +0 -36
  180. package/test/COVERAGE-GAPS.md +0 -333
  181. package/test/e2e/cm-003-default-view.test.ts +0 -195
  182. package/test/e2e/plan-analyze-run.test.ts +0 -902
  183. package/test/helpers/helpers.test.ts +0 -295
  184. package/test/helpers/timeout.ts +0 -42
  185. package/test/integration/US-002-TEST-SUMMARY.md +0 -107
  186. package/test/integration/US-003-TEST-SUMMARY.md +0 -149
  187. package/test/integration/US-004-TEST-SUMMARY.md +0 -106
  188. package/test/integration/US-005-TEST-SUMMARY.md +0 -138
  189. package/test/integration/US-007-TEST-SUMMARY.md +0 -100
  190. package/test/integration/cli/agent-validation.test.ts +0 -439
  191. package/test/integration/cli/cli-config-default-edge-cases.test.ts +0 -223
  192. package/test/integration/cli/cli-config-default-view.test.ts +0 -230
  193. package/test/integration/cli/cli-config-diff.test.ts +0 -461
  194. package/test/integration/cli/cli-config.test.ts +0 -737
  195. package/test/integration/cli/cli-diagnose.test.ts +0 -595
  196. package/test/integration/cli/cli-logs.test.ts +0 -346
  197. package/test/integration/cli/cli-plugins.test.ts +0 -679
  198. package/test/integration/cli/cli-precheck.test.ts +0 -372
  199. package/test/integration/cli/cli-run-headless.test.ts +0 -174
  200. package/test/integration/cli/cli.test.ts +0 -76
  201. package/test/integration/cli/precheck-integration.test.ts +0 -476
  202. package/test/integration/cli/precheck-orchestrator.test.ts +0 -247
  203. package/test/integration/cli/precheck.test.ts +0 -806
  204. package/test/integration/config/config-loader.test.ts +0 -266
  205. package/test/integration/config/config.test.ts +0 -444
  206. package/test/integration/config/merger.test.ts +0 -466
  207. package/test/integration/config/paths.test.ts +0 -52
  208. package/test/integration/config/security-loader.test.ts +0 -83
  209. package/test/integration/context/context-integration.test.ts +0 -703
  210. package/test/integration/context/context-path-security.test.ts +0 -173
  211. package/test/integration/context/context-provider-injection.test.ts +0 -507
  212. package/test/integration/context/context-verification-integration.test.ts +0 -296
  213. package/test/integration/context/s5-greenfield-fallback.test.ts +0 -298
  214. package/test/integration/execution/execution-isolation.test.ts +0 -143
  215. package/test/integration/execution/execution.test.ts +0 -634
  216. package/test/integration/execution/feature-status-write.test.ts +0 -302
  217. package/test/integration/execution/parallel.test.ts +0 -251
  218. package/test/integration/execution/prd-pause.test.ts +0 -205
  219. package/test/integration/execution/prd-resolvers.test.ts +0 -186
  220. package/test/integration/execution/progress.test.ts +0 -34
  221. package/test/integration/execution/runner-batching.test.ts +0 -682
  222. package/test/integration/execution/runner-config-plugins.test.ts +0 -462
  223. package/test/integration/execution/runner-escalation.test.ts +0 -561
  224. package/test/integration/execution/runner-fixes.test.ts +0 -400
  225. package/test/integration/execution/runner-plugin-integration.test.ts +0 -544
  226. package/test/integration/execution/runner-queue-and-attempts.test.ts +0 -476
  227. package/test/integration/execution/status-file-integration.test.ts +0 -289
  228. package/test/integration/execution/status-file.test.ts +0 -380
  229. package/test/integration/execution/status-writer.test.ts +0 -447
  230. package/test/integration/execution/story-id-in-events.test.ts +0 -274
  231. package/test/integration/interaction/interaction-chain-pipeline.test.ts +0 -476
  232. package/test/integration/pipeline/hooks.test.ts +0 -363
  233. package/test/integration/pipeline/pipeline-acceptance.test.ts +0 -303
  234. package/test/integration/pipeline/pipeline-events.test.ts +0 -476
  235. package/test/integration/pipeline/pipeline.test.ts +0 -660
  236. package/test/integration/pipeline/reporter-lifecycle.test.ts +0 -862
  237. package/test/integration/pipeline/verify-stage.test.ts +0 -286
  238. package/test/integration/plan/analyze-integration.test.ts +0 -262
  239. package/test/integration/plan/analyze-scanner.test.ts +0 -132
  240. package/test/integration/plan/logger.test.ts +0 -461
  241. package/test/integration/plan/plan.test.ts +0 -157
  242. package/test/integration/plugins/config-integration.test.ts +0 -173
  243. package/test/integration/plugins/config-resolution.test.ts +0 -523
  244. package/test/integration/plugins/loader.test.ts +0 -644
  245. package/test/integration/plugins/plugins-registry.test.ts +0 -747
  246. package/test/integration/plugins/validator.test.ts +0 -564
  247. package/test/integration/review/review-config-commands.test.ts +0 -320
  248. package/test/integration/review/review-config-schema.test.ts +0 -117
  249. package/test/integration/review/review-plugin-integration.test.ts +0 -729
  250. package/test/integration/review/review.test.ts +0 -150
  251. package/test/integration/routing/plugin-routing-advanced.test.ts +0 -461
  252. package/test/integration/routing/plugin-routing-core.test.ts +0 -527
  253. package/test/integration/routing/routing-stage-bug-021.test.ts +0 -275
  254. package/test/integration/routing/routing-stage-greenfield.test.ts +0 -287
  255. package/test/integration/tdd/tdd-cleanup.test.ts +0 -246
  256. package/test/integration/tdd/tdd-orchestrator-core.test.ts +0 -565
  257. package/test/integration/tdd/tdd-orchestrator-failureCategory.test.ts +0 -355
  258. package/test/integration/tdd/tdd-orchestrator-fallback.test.ts +0 -311
  259. package/test/integration/tdd/tdd-orchestrator-lite.test.ts +0 -289
  260. package/test/integration/tdd/tdd-orchestrator-prompts.test.ts +0 -260
  261. package/test/integration/tdd/tdd-orchestrator-verdict.test.ts +0 -536
  262. package/test/integration/tmp/headless-test/test.jsonl +0 -30
  263. package/test/integration/verification/test-scanner.test.ts +0 -403
  264. package/test/integration/verification/verification-asset-check.test.ts +0 -143
  265. package/test/integration/worktree/manager.test.ts +0 -218
  266. package/test/integration/worktree/worktree-merge.test.ts +0 -341
  267. package/test/manual/logging-formatter-demo.ts +0 -158
  268. package/test/ui/tui-agent-panel.test.tsx +0 -99
  269. package/test/ui/tui-pty-integration.test.tsx +0 -146
  270. package/test/unit/acceptance.test.ts +0 -187
  271. package/test/unit/agent-stderr-capture.test.ts +0 -147
  272. package/test/unit/agents/claude.test.ts +0 -107
  273. package/test/unit/analyze-classifier.test.ts +0 -216
  274. package/test/unit/analyze.test.ts +0 -224
  275. package/test/unit/auto-detect.test.ts +0 -250
  276. package/test/unit/cli-status-project-level.test.ts +0 -283
  277. package/test/unit/cli-status.test.ts +0 -418
  278. package/test/unit/commands/common.test.ts +0 -321
  279. package/test/unit/commands/logs.test.ts +0 -458
  280. package/test/unit/commands/runs.test.ts +0 -303
  281. package/test/unit/commands/unlock.test.ts +0 -320
  282. package/test/unit/config/defaults.test.ts +0 -70
  283. package/test/unit/config/quality-commands-schema.test.ts +0 -72
  284. package/test/unit/config/regression-gate-schema.test.ts +0 -160
  285. package/test/unit/config/smart-runner-flag.test.ts +0 -250
  286. package/test/unit/constitution-generators.test.ts +0 -161
  287. package/test/unit/constitution.test.ts +0 -210
  288. package/test/unit/context/context-autodetect.test.ts +0 -297
  289. package/test/unit/context/context-build.test.ts +0 -575
  290. package/test/unit/context/context-coverage.test.ts +0 -236
  291. package/test/unit/context/context-error.test.ts +0 -93
  292. package/test/unit/context/context-estimate-tokens.test.ts +0 -201
  293. package/test/unit/context/context-format.test.ts +0 -302
  294. package/test/unit/context/context-isolation.test.ts +0 -267
  295. package/test/unit/context/context-sort.test.ts +0 -93
  296. package/test/unit/context/context-story.test.ts +0 -108
  297. package/test/unit/context/prior-failures.test.ts +0 -463
  298. package/test/unit/context.test.ts +0 -1726
  299. package/test/unit/cost.test.ts +0 -231
  300. package/test/unit/crash-recovery.test.ts +0 -309
  301. package/test/unit/escalation.test.ts +0 -127
  302. package/test/unit/execution/lifecycle/run-completion.test.ts +0 -240
  303. package/test/unit/execution/lifecycle/run-regression.test.ts +0 -420
  304. package/test/unit/execution/pid-registry.test.ts +0 -241
  305. package/test/unit/execution/sequential-executor.test.ts +0 -235
  306. package/test/unit/execution/sfc-004-dead-code-cleanup.test.ts +0 -89
  307. package/test/unit/execution/structured-failure.test.ts +0 -415
  308. package/test/unit/execution-logging-stderr.test.ts +0 -157
  309. package/test/unit/execution-stage.test.ts +0 -123
  310. package/test/unit/fix-generator.test.ts +0 -276
  311. package/test/unit/formatters.test.ts +0 -468
  312. package/test/unit/greenfield.test.ts +0 -180
  313. package/test/unit/hooks/shell-security.test.ts +0 -40
  314. package/test/unit/interaction/auto-plugin.test.ts +0 -162
  315. package/test/unit/interaction/human-review-trigger.test.ts +0 -165
  316. package/test/unit/interaction-network-failures.test.ts +0 -390
  317. package/test/unit/interaction-plugins.test.ts +0 -472
  318. package/test/unit/logging/formatter.test.ts +0 -456
  319. package/test/unit/merge.test.ts +0 -269
  320. package/test/unit/metrics/aggregator.test.ts +0 -164
  321. package/test/unit/metrics/tracker.test.ts +0 -186
  322. package/test/unit/metrics.test.ts +0 -276
  323. package/test/unit/optimizer/noop.optimizer.test.ts +0 -125
  324. package/test/unit/optimizer/rule-based.optimizer.test.ts +0 -358
  325. package/test/unit/pipeline/event-bus.test.ts +0 -105
  326. package/test/unit/pipeline/routing-partial-override.test.ts +0 -121
  327. package/test/unit/pipeline/runner-retry.test.ts +0 -89
  328. package/test/unit/pipeline/stages/autofix.test.ts +0 -97
  329. package/test/unit/pipeline/stages/completion-review-gate.test.ts +0 -218
  330. package/test/unit/pipeline/stages/execution-ambiguity.test.ts +0 -311
  331. package/test/unit/pipeline/stages/execution-merge-conflict.test.ts +0 -218
  332. package/test/unit/pipeline/stages/rectify.test.ts +0 -101
  333. package/test/unit/pipeline/stages/regression-stage.test.ts +0 -69
  334. package/test/unit/pipeline/stages/review.test.ts +0 -201
  335. package/test/unit/pipeline/stages/routing-idempotence.test.ts +0 -139
  336. package/test/unit/pipeline/stages/routing-initial-complexity.test.ts +0 -321
  337. package/test/unit/pipeline/stages/routing-persistence.test.ts +0 -380
  338. package/test/unit/pipeline/stages/verify.test.ts +0 -267
  339. package/test/unit/pipeline/subscribers/events-writer.test.ts +0 -227
  340. package/test/unit/pipeline/subscribers/hooks.test.ts +0 -84
  341. package/test/unit/pipeline/subscribers/interaction.test.ts +0 -313
  342. package/test/unit/pipeline/subscribers/registry.test.ts +0 -149
  343. package/test/unit/pipeline/subscribers/reporters.test.ts +0 -90
  344. package/test/unit/pipeline/verify-smart-runner.test.ts +0 -345
  345. package/test/unit/prd-auto-default.test.ts +0 -291
  346. package/test/unit/prd-failure-category.test.ts +0 -177
  347. package/test/unit/prd-get-next-story.test.ts +0 -215
  348. package/test/unit/precheck-checks.test.ts +0 -841
  349. package/test/unit/precheck-story-size-gate.test.ts +0 -288
  350. package/test/unit/precheck-types.test.ts +0 -143
  351. package/test/unit/prompts.test.ts +0 -476
  352. package/test/unit/queue.test.ts +0 -237
  353. package/test/unit/rectification.test.ts +0 -285
  354. package/test/unit/registry.test.ts +0 -288
  355. package/test/unit/review/runner.test.ts +0 -117
  356. package/test/unit/routing/content-hash.test.ts +0 -99
  357. package/test/unit/routing/routing-stability.test.ts +0 -208
  358. package/test/unit/routing/strategies/llm.test.ts +0 -306
  359. package/test/unit/routing-advanced.test.ts +0 -313
  360. package/test/unit/routing-core.test.ts +0 -341
  361. package/test/unit/routing-strategies.test.ts +0 -440
  362. package/test/unit/storyid-events.test.ts +0 -213
  363. package/test/unit/tdd-verdict.test.ts +0 -492
  364. package/test/unit/test-output-parser.test.ts +0 -377
  365. package/test/unit/ui/tui-controls.test.ts +0 -335
  366. package/test/unit/ui/tui-cost-and-pty.test.ts +0 -190
  367. package/test/unit/ui/tui-layout.test.ts +0 -379
  368. package/test/unit/ui/tui-stories.test.ts +0 -333
  369. package/test/unit/unit-isolation.test.ts +0 -135
  370. package/test/unit/utils/git.test.ts +0 -50
  371. package/test/unit/utils/path-security.test.ts +0 -47
  372. package/test/unit/utils-helpers.test.ts +0 -318
  373. package/test/unit/verdict.test.ts +0 -325
  374. package/test/unit/verification/orchestrator-types.test.ts +0 -54
  375. package/test/unit/verification/orchestrator.test.ts +0 -66
  376. package/test/unit/verification/smart-runner-config.test.ts +0 -163
  377. package/test/unit/verification/smart-runner-discovery.test.ts +0 -354
  378. package/test/unit/verification/smart-runner.test.ts +0 -262
  379. package/test/unit/verification/strategies/acceptance.test.ts +0 -33
  380. package/test/unit/verification/strategies/regression.test.ts +0 -87
  381. package/test/unit/verification/strategies/scoped.test.ts +0 -100
  382. package/test/unit/worktree-manager.test.ts +0 -159
  383. package/tsconfig.json +0 -27
@@ -1,138 +0,0 @@
1
- # US-005: Plugin Routing Integration - Test Summary
2
-
3
- **Story:** Plugin routing strategies integrate into router chain
4
-
5
- **Test File:** `test/integration/plugin-routing.test.ts`
6
-
7
- **Status:** ✅ Tests written and failing (as expected)
8
-
9
- ---
10
-
11
- ## Test Coverage
12
-
13
- ### AC1: Plugin routers are tried before the built-in routing strategy
14
-
15
- **Tests (4):**
16
- - ✅ Plugin routers execute before built-in keyword strategy
17
- - ✅ Multiple plugin routers maintain load order
18
- - ✅ Plugin routers are inserted before manual strategy
19
- - ✅ Plugin routers are inserted before llm strategy
20
-
21
- **Coverage:** Validates that plugin routers are prepended to the strategy chain and execute in load order before any built-in strategies.
22
-
23
- ---
24
-
25
- ### AC2: First plugin router that returns a non-null result wins
26
-
27
- **Tests (5):**
28
- - ✅ First plugin router decision is used
29
- - ✅ Second plugin router is used when first returns null
30
- - ✅ Plugin router overrides built-in keyword strategy
31
- - ✅ Third plugin router is used when first two return null
32
- - ✅ Plugin router can delegate based on conditional logic (integration test)
33
-
34
- **Coverage:** Validates the chain precedence rules where the first non-null decision wins, and tests realistic scenarios where plugins selectively handle certain stories.
35
-
36
- ---
37
-
38
- ### AC3: If all plugin routers return null, built-in strategy is used as fallback
39
-
40
- **Tests (4):**
41
- - ✅ Keyword strategy is used when all plugin routers return null
42
- - ✅ Keyword strategy handles complex story when plugins return null
43
- - ✅ Manual strategy is used as fallback when plugins return null
44
- - ✅ Empty plugin registry falls back to keyword strategy
45
-
46
- **Coverage:** Validates that the chain properly falls through to built-in strategies (keyword, manual) when all plugin routers return null or when no plugins are loaded.
47
-
48
- ---
49
-
50
- ### AC4: Plugin routers receive the same story context as built-in routers
51
-
52
- **Tests (5):**
53
- - ✅ Plugin router receives story object
54
- - ✅ Plugin router receives routing context with config
55
- - ✅ Plugin router receives codebase context when available
56
- - ✅ Plugin router receives metrics when available
57
- - ✅ Multiple plugin routers receive same context
58
-
59
- **Coverage:** Validates that plugin routers receive the complete `UserStory` and `RoutingContext` objects, including optional fields like `codebaseContext` and `metrics`.
60
-
61
- ---
62
-
63
- ### AC5: Router errors are caught and logged; fallback to next router in chain
64
-
65
- **Tests (6):**
66
- - ❌ Error in plugin router is caught and next router is tried
67
- - ❌ Error in plugin router is logged
68
- - ❌ Multiple router errors are caught and keyword fallback succeeds
69
- - ❌ Async error in plugin router is caught
70
- - ❌ Error in last plugin router falls back to keyword strategy
71
- - ❌ Error message includes plugin name for debugging
72
-
73
- **Coverage:** Validates that errors thrown by plugin routers don't crash the routing system and that proper error logging occurs with router names for debugging.
74
-
75
- **Status:** Currently failing (expected) - error handling not yet implemented in `StrategyChain.route()`
76
-
77
- ---
78
-
79
- ## Integration Tests
80
-
81
- **Real-world scenarios (6):**
82
- - ✅ Premium plugin forces security stories to expert tier
83
- - ✅ Cost-optimization plugin downgrades simple docs to fast tier
84
- - ✅ Domain-specific plugin routes database migrations to expert tier
85
- - ✅ Multiple plugins: first matching plugin wins
86
- - ✅ Plugin router can delegate based on conditional logic (duplicate coverage)
87
-
88
- **Coverage:** Tests realistic plugin use cases that demonstrate the value of the plugin router system.
89
-
90
- ---
91
-
92
- ## Test Results
93
-
94
- ```
95
- 22 pass
96
- 6 fail
97
- 54 expect() calls
98
- Ran 28 tests across 1 file.
99
- ```
100
-
101
- **Passing Tests (22):** Plugin router chain integration, precedence, fallback, and context passing all work correctly with the current implementation.
102
-
103
- **Failing Tests (6):** All failures are in AC5 (error handling). The errors are propagating instead of being caught, logged, and triggering fallback to the next router.
104
-
105
- ---
106
-
107
- ## Implementation Gaps
108
-
109
- The tests reveal that the following needs to be implemented:
110
-
111
- 1. **Error handling in `StrategyChain.route()`** (`src/routing/chain.ts:38-44`)
112
- - Wrap each `strategy.route()` call in try-catch
113
- - Log errors with strategy name
114
- - Continue to next strategy on error
115
-
116
- 2. **Error logging with plugin context**
117
- - Include plugin router name in error logs
118
- - Use `getSafeLogger()` to log routing errors
119
- - Log at error level with category "routing"
120
-
121
- ---
122
-
123
- ## Next Steps for Implementer
124
-
125
- 1. Modify `src/routing/chain.ts` to wrap `strategy.route()` in try-catch
126
- 2. Add error logging that includes strategy name
127
- 3. Continue chain iteration on error (same as null return)
128
- 4. Run tests: `bun test ./test/integration/plugin-routing.test.ts`
129
- 5. All 28 tests should pass after implementation
130
-
131
- ---
132
-
133
- ## Notes
134
-
135
- - Tests use mock plugins with custom routing logic
136
- - Tests verify both sync and async router error handling
137
- - Tests validate error log messages include router names for debugging
138
- - Integration tests demonstrate realistic plugin use cases (security enforcement, cost optimization, domain-specific routing)
@@ -1,100 +0,0 @@
1
- # US-007 Test Coverage Summary
2
-
3
- ## Story
4
- Read plugin config entries from nax config.json
5
-
6
- ## Acceptance Criteria Coverage
7
-
8
- ### AC1: plugins[] from config.json are passed to loadPlugins() as configPlugins parameter
9
- **Tests:**
10
- - `test/integration/runner-config-plugins.test.ts`: "config.plugins[] entries are passed to loadPlugins() when runner initializes"
11
- - Verifies config.plugins is loaded via loadConfig()
12
- - Verifies config.plugins is passed to loadPlugins() with correct projectRoot
13
- - Verifies plugin is initialized with correct config
14
-
15
- ### AC2: Relative module paths in plugins[].module are resolved relative to project root
16
- **Tests:**
17
- - `test/integration/runner-config-plugins.test.ts`: "relative plugin paths in config.plugins[] are resolved relative to project root"
18
- - Tests `./lib/plugins/plugin.ts` resolves correctly from project root
19
- - Verifies plugin is loaded and initialized successfully
20
-
21
- ### AC3: Absolute module paths and npm package names work as-is
22
- **Tests:**
23
- - `test/integration/runner-config-plugins.test.ts`: "absolute plugin paths in config.plugins[] work without project root resolution"
24
- - Tests absolute paths are passed through without modification
25
- - Verifies plugin is loaded correctly
26
-
27
- ### AC4: If a plugin module cannot be found, a clear error message is logged with the path tried
28
- **Tests:**
29
- - `test/integration/runner-config-plugins.test.ts`: "missing plugin module from config.plugins[] logs clear error (does not crash runner)"
30
- - Verifies error message contains original path
31
- - Verifies error message contains attempted resolved path
32
- - Verifies runner doesn't crash (returns empty registry)
33
-
34
- ### AC5: Plugin-specific config (plugins[].config) is passed to the plugin's setup() function
35
- **Tests:**
36
- - `test/integration/runner-config-plugins.test.ts`: "config.plugins[] entries are passed to loadPlugins() when runner initializes"
37
- - Verifies config object is passed to plugin's setup()
38
- - Verifies config values match what was in config.json
39
-
40
- ## Additional Test Coverage
41
-
42
- ### Edge Cases
43
- 1. **Empty plugins[] array**: Verifies no plugins loaded
44
- 2. **Undefined plugins field**: Verifies runner's `config.plugins || []` fallback works
45
- 3. **Plugin name collision**: Verifies config plugins override auto-discovered plugins
46
-
47
- ## Test Files
48
-
49
- ### New Test File
50
- - `test/integration/runner-config-plugins.test.ts` (7 tests, 32 assertions)
51
- - Focuses on integration between loadConfig() and loadPlugins()
52
- - Simulates runner.ts initialization flow
53
- - All tests passing
54
-
55
- ### Existing Test Files (Already Exist)
56
- - `test/integration/config-loader.test.ts` (8 tests for plugin config loading)
57
- - Tests schema validation
58
- - Tests config merging (global + project)
59
- - `test/integration/plugins/config-resolution.test.ts` (20+ tests)
60
- - Comprehensive AC coverage at plugin loader level
61
- - `test/integration/plugins/config-integration.test.ts` (1 E2E test)
62
- - Realistic scenario with relative paths
63
-
64
- ## Test Strategy
65
-
66
- 1. **Unit level**: Plugin loader path resolution logic (existing tests)
67
- 2. **Integration level**: Config loader + plugin loader (NEW tests in runner-config-plugins.test.ts)
68
- 3. **E2E level**: Full runner initialization flow (existing test in config-integration.test.ts)
69
-
70
- ## Coverage Summary
71
-
72
- - ✅ All 5 acceptance criteria covered with multiple test cases
73
- - ✅ Edge cases covered (empty array, undefined, collisions)
74
- - ✅ Error handling verified (missing modules, invalid paths)
75
- - ✅ Integration verified (config → runner → plugins)
76
-
77
- ## Running Tests
78
-
79
- ```bash
80
- # Run new integration tests only
81
- bun test ./test/integration/runner-config-plugins.test.ts
82
-
83
- # Run all plugin-related tests
84
- bun test ./test/integration/plugins/
85
-
86
- # Run all config-related tests
87
- bun test ./test/integration/config-loader.test.ts
88
- ```
89
-
90
- ## Implementation Status
91
-
92
- **Status**: Tests written and passing ✅
93
-
94
- The implementation already exists in:
95
- - `src/config/loader.ts`: Loads plugins[] from config.json
96
- - `src/config/schema.ts`: Validates plugin config entries
97
- - `src/plugins/loader.ts`: Resolves paths and loads plugins
98
- - `src/execution/runner.ts:201-202`: Passes config.plugins to loadPlugins()
99
-
100
- These tests verify the integration works correctly end-to-end.
@@ -1,439 +0,0 @@
1
- import { describe, expect, mock, test } from "bun:test";
2
- import type { AgentAdapter, AgentRunOptions } from "../../../src/agents";
3
- import { ClaudeCodeAdapter } from "../../../src/agents/claude";
4
- import { describeAgentCapabilities, validateAgentFeature, validateAgentForTier } from "../../../src/agents/validation";
5
-
6
- describe("Agent Validation and Retry Logic", () => {
7
- describe("ClaudeCodeAdapter.isInstalled", () => {
8
- test("returns true when binary exists in PATH", async () => {
9
- const adapter = new ClaudeCodeAdapter();
10
- // Mock successful which command
11
- const originalSpawn = Bun.spawn;
12
- (Bun as any).spawn = mock((cmd: string[]) => {
13
- if (cmd[0] === "which" && cmd[1] === "claude") {
14
- return {
15
- exited: Promise.resolve(0),
16
- stdout: { getReader: () => ({ read: () => Promise.resolve({ done: true }) }) },
17
- stderr: { getReader: () => ({ read: () => Promise.resolve({ done: true }) }) },
18
- };
19
- }
20
- return originalSpawn(cmd);
21
- });
22
-
23
- const installed = await adapter.isInstalled();
24
- expect(installed).toBe(true);
25
-
26
- Bun.spawn = originalSpawn;
27
- });
28
-
29
- test("returns false when binary does not exist", async () => {
30
- const adapter = new ClaudeCodeAdapter();
31
- // Mock failed which command
32
- const originalSpawn = Bun.spawn;
33
- (Bun as any).spawn = mock((cmd: string[]) => {
34
- if (cmd[0] === "which" && cmd[1] === "claude") {
35
- return {
36
- exited: Promise.resolve(1),
37
- stdout: { getReader: () => ({ read: () => Promise.resolve({ done: true }) }) },
38
- stderr: { getReader: () => ({ read: () => Promise.resolve({ done: true }) }) },
39
- };
40
- }
41
- return originalSpawn(cmd);
42
- });
43
-
44
- const installed = await adapter.isInstalled();
45
- expect(installed).toBe(false);
46
-
47
- Bun.spawn = originalSpawn;
48
- });
49
-
50
- test("returns false on exception", async () => {
51
- const adapter = new ClaudeCodeAdapter();
52
- const originalSpawn = Bun.spawn;
53
- (Bun as any).spawn = mock(() => {
54
- throw new Error("Command not found");
55
- });
56
-
57
- const installed = await adapter.isInstalled();
58
- expect(installed).toBe(false);
59
-
60
- Bun.spawn = originalSpawn;
61
- });
62
- });
63
-
64
- describe("ClaudeCodeAdapter timeout handling", () => {
65
- test("distinguishes timeout from normal failure", async () => {
66
- const adapter = new ClaudeCodeAdapter();
67
- const originalSpawn = Bun.spawn;
68
-
69
- // Mock process that times out
70
- (Bun as any).spawn = mock(() => {
71
- let killed = false;
72
- return {
73
- exited: new Promise((resolve) => {
74
- setTimeout(() => resolve(killed ? 143 : 0), 100);
75
- }),
76
- kill: (signal: string) => {
77
- if (signal === "SIGTERM") killed = true;
78
- },
79
- stdout: new Response("").body,
80
- stderr: new Response("").body,
81
- };
82
- });
83
-
84
- const options: AgentRunOptions = {
85
- prompt: "test",
86
- workdir: "/tmp",
87
- modelTier: "balanced",
88
- modelDef: { provider: "anthropic", model: "claude-sonnet-4.5", env: {} },
89
- timeoutSeconds: 0.05, // 50ms timeout
90
- };
91
-
92
- const result = await adapter.run(options);
93
-
94
- // Should be marked as timeout (exit code 124)
95
- expect(result.exitCode).toBe(124);
96
- expect(result.success).toBe(false);
97
-
98
- Bun.spawn = originalSpawn;
99
- });
100
- });
101
-
102
- describe("ClaudeCodeAdapter retry logic", () => {
103
- test(
104
- "retries on rate limit with exponential backoff",
105
- async () => {
106
- const adapter = new ClaudeCodeAdapter();
107
- const originalSpawn = Bun.spawn;
108
- let attemptCount = 0;
109
-
110
- // Mock rate-limited response that succeeds on 3rd try
111
- (Bun as any).spawn = mock(() => {
112
- attemptCount++;
113
- const isRateLimited = attemptCount < 3;
114
-
115
- return {
116
- exited: Promise.resolve(isRateLimited ? 1 : 0),
117
- kill: () => {},
118
- stdout: new Response(isRateLimited ? "" : "success").body,
119
- stderr: new Response(isRateLimited ? "rate limit exceeded" : "").body,
120
- };
121
- });
122
-
123
- const options: AgentRunOptions = {
124
- prompt: "test",
125
- workdir: "/tmp",
126
- modelTier: "balanced",
127
- modelDef: { provider: "anthropic", model: "claude-sonnet-4.5", env: {} },
128
- timeoutSeconds: 60,
129
- };
130
-
131
- const startTime = Date.now();
132
- const result = await adapter.run(options);
133
- const duration = Date.now() - startTime;
134
-
135
- // Should succeed after retries
136
- expect(result.success).toBe(true);
137
- expect(attemptCount).toBe(3);
138
-
139
- // Should have backoff delays (2s + 4s = 6s, but we'll check for at least 3s)
140
- // Note: In real implementation, backoff is 2^attempt * 1000 = 2s, 4s
141
- expect(duration).toBeGreaterThanOrEqual(3000);
142
-
143
- Bun.spawn = originalSpawn;
144
- },
145
- { timeout: 15000 },
146
- );
147
-
148
- test(
149
- "fails immediately on agent execution errors (no retry)",
150
- async () => {
151
- const adapter = new ClaudeCodeAdapter();
152
- const originalSpawn = Bun.spawn;
153
- let attemptCount = 0;
154
-
155
- // Mock agent execution failure (exit code 1)
156
- // These are not retried because they're likely legitimate agent failures
157
- (Bun as any).spawn = mock(() => {
158
- attemptCount++;
159
- return {
160
- exited: Promise.resolve(1),
161
- kill: () => {},
162
- stdout: new Response("").body,
163
- stderr: new Response("agent error").body,
164
- };
165
- });
166
-
167
- const options: AgentRunOptions = {
168
- prompt: "test",
169
- workdir: "/tmp",
170
- modelTier: "balanced",
171
- modelDef: { provider: "anthropic", model: "claude-sonnet-4.5", env: {} },
172
- timeoutSeconds: 60,
173
- };
174
-
175
- const result = await adapter.run(options);
176
-
177
- // Should fail after 1 attempt (no retry for agent errors)
178
- expect(result.success).toBe(false);
179
- expect(attemptCount).toBe(1);
180
-
181
- Bun.spawn = originalSpawn;
182
- },
183
- { timeout: 15000 },
184
- );
185
-
186
- test("succeeds immediately on first attempt if no error", async () => {
187
- const adapter = new ClaudeCodeAdapter();
188
- const originalSpawn = Bun.spawn;
189
- let attemptCount = 0;
190
-
191
- // Mock successful execution
192
- (Bun as any).spawn = mock(() => {
193
- attemptCount++;
194
- return {
195
- exited: Promise.resolve(0),
196
- kill: () => {},
197
- stdout: new Response("success").body,
198
- stderr: new Response("").body,
199
- };
200
- });
201
-
202
- const options: AgentRunOptions = {
203
- prompt: "test",
204
- workdir: "/tmp",
205
- modelTier: "balanced",
206
- modelDef: { provider: "anthropic", model: "claude-sonnet-4.5", env: {} },
207
- timeoutSeconds: 60,
208
- };
209
-
210
- const result = await adapter.run(options);
211
-
212
- // Should succeed on first try
213
- expect(result.success).toBe(true);
214
- expect(attemptCount).toBe(1);
215
-
216
- Bun.spawn = originalSpawn;
217
- });
218
-
219
- test("does not retry on timeout (exit code 124)", async () => {
220
- const adapter = new ClaudeCodeAdapter();
221
- const originalSpawn = Bun.spawn;
222
- let attemptCount = 0;
223
-
224
- // Mock timeout
225
- (Bun as any).spawn = mock(() => {
226
- attemptCount++;
227
- let killed = false;
228
- return {
229
- exited: new Promise((resolve) => {
230
- setTimeout(() => resolve(killed ? 143 : 0), 100);
231
- }),
232
- kill: (signal: string) => {
233
- if (signal === "SIGTERM") killed = true;
234
- },
235
- stdout: new Response("").body,
236
- stderr: new Response("").body,
237
- };
238
- });
239
-
240
- const options: AgentRunOptions = {
241
- prompt: "test",
242
- workdir: "/tmp",
243
- modelTier: "balanced",
244
- modelDef: { provider: "anthropic", model: "claude-sonnet-4.5", env: {} },
245
- timeoutSeconds: 0.05, // 50ms timeout
246
- };
247
-
248
- const result = await adapter.run(options);
249
-
250
- // Should not retry on timeout
251
- expect(result.exitCode).toBe(124);
252
- expect(attemptCount).toBe(1);
253
-
254
- Bun.spawn = originalSpawn;
255
- });
256
- });
257
-
258
- describe("ClaudeCodeAdapter command building", () => {
259
- test("builds correct command with model and prompt", () => {
260
- const adapter = new ClaudeCodeAdapter();
261
- const options: AgentRunOptions = {
262
- prompt: "test prompt",
263
- workdir: "/tmp",
264
- modelTier: "balanced",
265
- modelDef: { provider: "anthropic", model: "claude-sonnet-4.5", env: {} },
266
- timeoutSeconds: 60,
267
- };
268
-
269
- const cmd = adapter.buildCommand(options);
270
-
271
- expect(cmd).toEqual([
272
- "claude",
273
- "--model",
274
- "claude-sonnet-4.5",
275
- "--dangerously-skip-permissions",
276
- "-p",
277
- "test prompt",
278
- ]);
279
- });
280
- });
281
-
282
- describe("Agent Capability Metadata", () => {
283
- const claudeAdapter = new ClaudeCodeAdapter();
284
-
285
- describe("ClaudeCodeAdapter capabilities", () => {
286
- test("declares all expected tiers", () => {
287
- const caps = claudeAdapter.capabilities;
288
- expect(caps.supportedTiers).toContain("fast");
289
- expect(caps.supportedTiers).toContain("balanced");
290
- expect(caps.supportedTiers).toContain("powerful");
291
- expect(caps.supportedTiers.length).toBe(3);
292
- });
293
-
294
- test("declares all expected features", () => {
295
- const caps = claudeAdapter.capabilities;
296
- expect(caps.features.has("tdd")).toBe(true);
297
- expect(caps.features.has("review")).toBe(true);
298
- expect(caps.features.has("refactor")).toBe(true);
299
- expect(caps.features.has("batch")).toBe(true);
300
- expect(caps.features.size).toBe(4);
301
- });
302
-
303
- test("declares 200k token context window", () => {
304
- expect(claudeAdapter.capabilities.maxContextTokens).toBe(200_000);
305
- });
306
- });
307
-
308
- describe("validateAgentForTier", () => {
309
- test("returns true for supported tiers", () => {
310
- expect(validateAgentForTier(claudeAdapter, "fast")).toBe(true);
311
- expect(validateAgentForTier(claudeAdapter, "balanced")).toBe(true);
312
- expect(validateAgentForTier(claudeAdapter, "powerful")).toBe(true);
313
- });
314
-
315
- test("returns false for unsupported tiers (custom agent)", () => {
316
- // Create a mock agent that only supports fast tier
317
- const limitedAgent: AgentAdapter = {
318
- name: "limited",
319
- displayName: "Limited Agent",
320
- binary: "limited",
321
- capabilities: {
322
- supportedTiers: ["fast"],
323
- maxContextTokens: 50_000,
324
- features: new Set(["review"]),
325
- },
326
- async isInstalled() {
327
- return true;
328
- },
329
- async run() {
330
- return {
331
- success: true,
332
- exitCode: 0,
333
- output: "",
334
- rateLimited: false,
335
- durationMs: 1000,
336
- estimatedCost: 0.01,
337
- };
338
- },
339
- buildCommand() {
340
- return ["limited"];
341
- },
342
- };
343
-
344
- expect(validateAgentForTier(limitedAgent, "fast")).toBe(true);
345
- expect(validateAgentForTier(limitedAgent, "balanced")).toBe(false);
346
- expect(validateAgentForTier(limitedAgent, "powerful")).toBe(false);
347
- });
348
- });
349
-
350
- describe("validateAgentFeature", () => {
351
- test("returns true for supported features", () => {
352
- expect(validateAgentFeature(claudeAdapter, "tdd")).toBe(true);
353
- expect(validateAgentFeature(claudeAdapter, "review")).toBe(true);
354
- expect(validateAgentFeature(claudeAdapter, "refactor")).toBe(true);
355
- expect(validateAgentFeature(claudeAdapter, "batch")).toBe(true);
356
- });
357
-
358
- test("returns false for unsupported features (custom agent)", () => {
359
- const reviewOnlyAgent: AgentAdapter = {
360
- name: "reviewer",
361
- displayName: "Review Agent",
362
- binary: "reviewer",
363
- capabilities: {
364
- supportedTiers: ["fast", "balanced"],
365
- maxContextTokens: 100_000,
366
- features: new Set(["review"]),
367
- },
368
- async isInstalled() {
369
- return true;
370
- },
371
- async run() {
372
- return {
373
- success: true,
374
- exitCode: 0,
375
- output: "",
376
- rateLimited: false,
377
- durationMs: 1000,
378
- estimatedCost: 0.01,
379
- };
380
- },
381
- buildCommand() {
382
- return ["reviewer"];
383
- },
384
- };
385
-
386
- expect(validateAgentFeature(reviewOnlyAgent, "review")).toBe(true);
387
- expect(validateAgentFeature(reviewOnlyAgent, "tdd")).toBe(false);
388
- expect(validateAgentFeature(reviewOnlyAgent, "refactor")).toBe(false);
389
- expect(validateAgentFeature(reviewOnlyAgent, "batch")).toBe(false);
390
- });
391
- });
392
-
393
- describe("describeAgentCapabilities", () => {
394
- test("formats Claude Code capabilities correctly", () => {
395
- const description = describeAgentCapabilities(claudeAdapter);
396
- expect(description).toContain("claude:");
397
- expect(description).toContain("tiers=[fast,balanced,powerful]");
398
- expect(description).toContain("maxTokens=200000");
399
- expect(description).toContain("features=");
400
- expect(description).toContain("tdd");
401
- expect(description).toContain("review");
402
- expect(description).toContain("refactor");
403
- expect(description).toContain("batch");
404
- });
405
-
406
- test("formats limited agent capabilities correctly", () => {
407
- const limitedAgent: AgentAdapter = {
408
- name: "tiny",
409
- displayName: "Tiny Agent",
410
- binary: "tiny",
411
- capabilities: {
412
- supportedTiers: ["fast"],
413
- maxContextTokens: 10_000,
414
- features: new Set(["review"]),
415
- },
416
- async isInstalled() {
417
- return true;
418
- },
419
- async run() {
420
- return {
421
- success: true,
422
- exitCode: 0,
423
- output: "",
424
- rateLimited: false,
425
- durationMs: 1000,
426
- estimatedCost: 0.01,
427
- };
428
- },
429
- buildCommand() {
430
- return ["tiny"];
431
- },
432
- };
433
-
434
- const description = describeAgentCapabilities(limitedAgent);
435
- expect(description).toBe("tiny: tiers=[fast], maxTokens=10000, features=[review]");
436
- });
437
- });
438
- });
439
- });