@delegance/claude-autopilot 5.0.0 → 5.0.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 (406) hide show
  1. package/dist/presets/go/rules/go-sql-injection.d.ts +4 -0
  2. package/dist/presets/nextjs-supabase/rules/supabase-rls-bypass.d.ts +4 -0
  3. package/dist/presets/python-fastapi/rules/fastapi-missing-auth.d.ts +4 -0
  4. package/dist/presets/rails-postgres/rules/rails-sql-injection.d.ts +4 -0
  5. package/dist/presets/t3/rules/t3-server-only.d.ts +4 -0
  6. package/dist/src/adapters/base.d.ts +11 -0
  7. package/dist/src/adapters/council/claude.d.ts +3 -0
  8. package/dist/src/adapters/council/openai.d.ts +3 -0
  9. package/dist/src/adapters/council/types.d.ts +5 -0
  10. package/dist/src/adapters/loader.d.ts +11 -0
  11. package/dist/src/adapters/migration-runner/supabase.d.ts +4 -0
  12. package/dist/src/adapters/migration-runner/types.d.ts +31 -0
  13. package/dist/src/adapters/review-bot-parser/cursor.d.ts +3 -0
  14. package/dist/src/adapters/review-bot-parser/declarative-base.d.ts +13 -0
  15. package/{src/adapters/review-bot-parser/types.ts → dist/src/adapters/review-bot-parser/types.d.ts} +4 -4
  16. package/dist/src/adapters/review-engine/auto.d.ts +4 -0
  17. package/dist/src/adapters/review-engine/claude.d.ts +4 -0
  18. package/dist/src/adapters/review-engine/codex.d.ts +4 -0
  19. package/dist/src/adapters/review-engine/gemini.d.ts +4 -0
  20. package/dist/src/adapters/review-engine/openai-compatible.d.ts +4 -0
  21. package/dist/src/adapters/review-engine/parse-output.d.ts +13 -0
  22. package/dist/src/adapters/review-engine/prompt-builder.d.ts +4 -0
  23. package/dist/src/adapters/review-engine/types.d.ts +28 -0
  24. package/dist/src/adapters/vcs-host/commit-status.d.ts +12 -0
  25. package/dist/src/adapters/vcs-host/github.d.ts +4 -0
  26. package/dist/src/adapters/vcs-host/types.d.ts +42 -0
  27. package/{src/cli/_pkg-root.ts → dist/src/cli/_pkg-root.d.ts} +4 -42
  28. package/dist/src/cli/autoregress-bridge.d.ts +3 -0
  29. package/dist/src/cli/baseline.d.ts +7 -0
  30. package/dist/src/cli/ci.d.ts +23 -0
  31. package/dist/src/cli/costs.d.ts +2 -0
  32. package/dist/src/cli/council.d.ts +8 -0
  33. package/dist/src/cli/detector.d.ts +8 -0
  34. package/dist/src/cli/explain.d.ts +8 -0
  35. package/dist/src/cli/fix.d.ts +10 -0
  36. package/dist/src/cli/hook.d.ts +9 -0
  37. package/dist/src/cli/ignore-helper.d.ts +7 -0
  38. package/dist/src/cli/index.d.ts +3 -0
  39. package/dist/src/cli/index.js +39 -1
  40. package/dist/src/cli/lsp.d.ts +29 -0
  41. package/dist/src/cli/mcp.d.ts +5 -0
  42. package/dist/src/cli/migrate-v4.d.ts +28 -0
  43. package/dist/src/cli/pr-comment.d.ts +13 -0
  44. package/dist/src/cli/pr-desc.d.ts +31 -0
  45. package/dist/src/cli/pr-review-comments.d.ts +12 -0
  46. package/dist/src/cli/pr.d.ts +9 -0
  47. package/dist/src/cli/preflight.d.ts +8 -0
  48. package/dist/src/cli/preflight.js +17 -4
  49. package/dist/src/cli/report.d.ts +7 -0
  50. package/dist/src/cli/run.d.ts +23 -0
  51. package/dist/src/cli/scan.d.ts +11 -0
  52. package/dist/src/cli/setup.d.ts +9 -0
  53. package/dist/src/cli/test-gen.d.ts +10 -0
  54. package/dist/src/cli/triage.d.ts +5 -0
  55. package/dist/src/cli/watch.d.ts +18 -0
  56. package/dist/src/cli/worker.d.ts +5 -0
  57. package/dist/src/core/cache/cached-engine.d.ts +8 -0
  58. package/dist/src/core/cache/review-cache.d.ts +21 -0
  59. package/dist/src/core/chunking/index.d.ts +18 -0
  60. package/dist/src/core/chunking/risk-ranker.d.ts +10 -0
  61. package/dist/src/core/config/loader.d.ts +3 -0
  62. package/dist/src/core/config/preset-resolver.d.ts +9 -0
  63. package/dist/src/core/config/schema.d.ts +342 -0
  64. package/dist/src/core/config/types.d.ts +115 -0
  65. package/dist/src/core/council/config.d.ts +3 -0
  66. package/dist/src/core/council/context.d.ts +2 -0
  67. package/dist/src/core/council/runner.d.ts +4 -0
  68. package/dist/src/core/council/types.d.ts +36 -0
  69. package/dist/src/core/detect/git-context.d.ts +12 -0
  70. package/dist/src/core/detect/llm-key.d.ts +38 -0
  71. package/dist/src/core/detect/protected-paths.d.ts +6 -0
  72. package/dist/src/core/detect/provider-usage.d.ts +17 -0
  73. package/dist/src/core/detect/stack.d.ts +6 -0
  74. package/dist/src/core/detect/workspaces.d.ts +11 -0
  75. package/dist/src/core/errors.d.ts +17 -0
  76. package/dist/src/core/findings/dedup.d.ts +4 -0
  77. package/dist/src/core/findings/types.d.ts +33 -0
  78. package/dist/src/core/fix/generator.d.ts +17 -0
  79. package/dist/src/core/git/diff-hunks.d.ts +22 -0
  80. package/dist/src/core/git/touched-files.d.ts +11 -0
  81. package/dist/src/core/ignore/index.d.ts +11 -0
  82. package/dist/src/core/index.d.ts +2 -0
  83. package/dist/src/core/logging/ndjson-writer.d.ts +16 -0
  84. package/dist/src/core/logging/redaction.d.ts +4 -0
  85. package/dist/src/core/mcp/concurrency.d.ts +2 -0
  86. package/dist/src/core/mcp/handlers/fix-finding.d.ts +17 -0
  87. package/dist/src/core/mcp/handlers/get-capabilities.d.ts +14 -0
  88. package/dist/src/core/mcp/handlers/get-findings.d.ts +13 -0
  89. package/dist/src/core/mcp/handlers/review-diff.d.ts +18 -0
  90. package/dist/src/core/mcp/handlers/scan-files.d.ts +15 -0
  91. package/dist/src/core/mcp/handlers/validate-fix.d.ts +12 -0
  92. package/dist/src/core/mcp/run-store.d.ts +12 -0
  93. package/dist/src/core/mcp/workspace.d.ts +3 -0
  94. package/dist/src/core/persist/baseline.d.ts +39 -0
  95. package/dist/src/core/persist/cost-log.d.ts +11 -0
  96. package/dist/src/core/persist/findings-cache.d.ts +9 -0
  97. package/dist/src/core/persist/triage.d.ts +30 -0
  98. package/dist/src/core/phases/static-rules.d.ts +24 -0
  99. package/dist/src/core/phases/tests.d.ts +15 -0
  100. package/dist/src/core/pipeline/review-phase.d.ts +27 -0
  101. package/dist/src/core/pipeline/run.d.ts +27 -0
  102. package/dist/src/core/runtime/idempotency.d.ts +2 -0
  103. package/dist/src/core/runtime/lock.d.ts +5 -0
  104. package/dist/src/core/runtime/state.d.ts +39 -0
  105. package/dist/src/core/schema-alignment/detector.d.ts +3 -0
  106. package/dist/src/core/schema-alignment/extractor/index.d.ts +3 -0
  107. package/dist/src/core/schema-alignment/extractor/prisma.d.ts +3 -0
  108. package/dist/src/core/schema-alignment/extractor/sql.d.ts +3 -0
  109. package/dist/src/core/schema-alignment/llm-check.d.ts +4 -0
  110. package/dist/src/core/schema-alignment/scanner.d.ts +3 -0
  111. package/dist/src/core/schema-alignment/types.d.ts +38 -0
  112. package/dist/src/core/shell.d.ts +15 -0
  113. package/dist/src/core/static-rules/registry.d.ts +5 -0
  114. package/dist/src/core/static-rules/rules/brand-tokens.d.ts +3 -0
  115. package/dist/src/core/static-rules/rules/console-log.d.ts +3 -0
  116. package/dist/src/core/static-rules/rules/hardcoded-secrets.d.ts +3 -0
  117. package/dist/src/core/static-rules/rules/insecure-redirect.d.ts +3 -0
  118. package/dist/src/core/static-rules/rules/large-file.d.ts +3 -0
  119. package/dist/src/core/static-rules/rules/missing-auth.d.ts +3 -0
  120. package/dist/src/core/static-rules/rules/missing-tests.d.ts +3 -0
  121. package/dist/src/core/static-rules/rules/npm-audit.d.ts +3 -0
  122. package/dist/src/core/static-rules/rules/package-lock-sync.d.ts +3 -0
  123. package/dist/src/core/static-rules/rules/schema-alignment.d.ts +3 -0
  124. package/dist/src/core/static-rules/rules/sql-injection.d.ts +3 -0
  125. package/dist/src/core/static-rules/rules/ssrf.d.ts +3 -0
  126. package/dist/src/core/static-rules/rules/todo-fixme.d.ts +3 -0
  127. package/dist/src/core/static-rules/tailwind-extractor.d.ts +7 -0
  128. package/dist/src/core/test-gen/coverage-analyzer.d.ts +7 -0
  129. package/dist/src/core/test-gen/framework-detector.d.ts +3 -0
  130. package/dist/src/core/test-gen/test-writer.d.ts +4 -0
  131. package/dist/src/core/ui/design-context-loader.d.ts +7 -0
  132. package/dist/src/core/worker/client.d.ts +23 -0
  133. package/dist/src/core/worker/lockfile.d.ts +12 -0
  134. package/dist/src/core/worker/server.d.ts +17 -0
  135. package/dist/src/formatters/github-annotations.d.ts +5 -0
  136. package/{src/formatters/index.ts → dist/src/formatters/index.d.ts} +1 -0
  137. package/dist/src/formatters/junit.d.ts +5 -0
  138. package/dist/src/formatters/sarif.d.ts +56 -0
  139. package/{src/index.ts → dist/src/index.d.ts} +1 -0
  140. package/package.json +7 -6
  141. package/dist/presets/go/rules/go-sql-injection.js.map +0 -1
  142. package/dist/presets/nextjs-supabase/rules/supabase-rls-bypass.js.map +0 -1
  143. package/dist/presets/python-fastapi/rules/fastapi-missing-auth.js.map +0 -1
  144. package/dist/presets/rails-postgres/rules/rails-sql-injection.js.map +0 -1
  145. package/dist/presets/t3/rules/t3-server-only.js.map +0 -1
  146. package/dist/src/adapters/base.js.map +0 -1
  147. package/dist/src/adapters/council/claude.js.map +0 -1
  148. package/dist/src/adapters/council/openai.js.map +0 -1
  149. package/dist/src/adapters/council/types.js.map +0 -1
  150. package/dist/src/adapters/loader.js.map +0 -1
  151. package/dist/src/adapters/migration-runner/supabase.js.map +0 -1
  152. package/dist/src/adapters/migration-runner/types.js.map +0 -1
  153. package/dist/src/adapters/review-bot-parser/cursor.js.map +0 -1
  154. package/dist/src/adapters/review-bot-parser/declarative-base.js.map +0 -1
  155. package/dist/src/adapters/review-bot-parser/types.js.map +0 -1
  156. package/dist/src/adapters/review-engine/auto.js.map +0 -1
  157. package/dist/src/adapters/review-engine/claude.js.map +0 -1
  158. package/dist/src/adapters/review-engine/codex.js.map +0 -1
  159. package/dist/src/adapters/review-engine/gemini.js.map +0 -1
  160. package/dist/src/adapters/review-engine/openai-compatible.js.map +0 -1
  161. package/dist/src/adapters/review-engine/parse-output.js.map +0 -1
  162. package/dist/src/adapters/review-engine/prompt-builder.js.map +0 -1
  163. package/dist/src/adapters/review-engine/types.js.map +0 -1
  164. package/dist/src/adapters/vcs-host/commit-status.js.map +0 -1
  165. package/dist/src/adapters/vcs-host/github.js.map +0 -1
  166. package/dist/src/adapters/vcs-host/types.js.map +0 -1
  167. package/dist/src/cli/_pkg-root.js.map +0 -1
  168. package/dist/src/cli/autoregress-bridge.js.map +0 -1
  169. package/dist/src/cli/baseline.js.map +0 -1
  170. package/dist/src/cli/ci.js.map +0 -1
  171. package/dist/src/cli/costs.js.map +0 -1
  172. package/dist/src/cli/council.js.map +0 -1
  173. package/dist/src/cli/detector.js.map +0 -1
  174. package/dist/src/cli/explain.js.map +0 -1
  175. package/dist/src/cli/fix.js.map +0 -1
  176. package/dist/src/cli/hook.js.map +0 -1
  177. package/dist/src/cli/ignore-helper.js.map +0 -1
  178. package/dist/src/cli/index.js.map +0 -1
  179. package/dist/src/cli/lsp.js.map +0 -1
  180. package/dist/src/cli/mcp.js.map +0 -1
  181. package/dist/src/cli/migrate-v4.js.map +0 -1
  182. package/dist/src/cli/pr-comment.js.map +0 -1
  183. package/dist/src/cli/pr-desc.js.map +0 -1
  184. package/dist/src/cli/pr-review-comments.js.map +0 -1
  185. package/dist/src/cli/pr.js.map +0 -1
  186. package/dist/src/cli/preflight.js.map +0 -1
  187. package/dist/src/cli/report.js.map +0 -1
  188. package/dist/src/cli/run.js.map +0 -1
  189. package/dist/src/cli/scan.js.map +0 -1
  190. package/dist/src/cli/setup.js.map +0 -1
  191. package/dist/src/cli/test-gen.js.map +0 -1
  192. package/dist/src/cli/triage.js.map +0 -1
  193. package/dist/src/cli/watch.js.map +0 -1
  194. package/dist/src/cli/worker.js.map +0 -1
  195. package/dist/src/core/cache/cached-engine.js.map +0 -1
  196. package/dist/src/core/cache/review-cache.js.map +0 -1
  197. package/dist/src/core/chunking/index.js.map +0 -1
  198. package/dist/src/core/chunking/risk-ranker.js.map +0 -1
  199. package/dist/src/core/config/loader.js.map +0 -1
  200. package/dist/src/core/config/preset-resolver.js.map +0 -1
  201. package/dist/src/core/config/schema.js.map +0 -1
  202. package/dist/src/core/config/types.js.map +0 -1
  203. package/dist/src/core/council/config.js.map +0 -1
  204. package/dist/src/core/council/context.js.map +0 -1
  205. package/dist/src/core/council/runner.js.map +0 -1
  206. package/dist/src/core/council/types.js.map +0 -1
  207. package/dist/src/core/detect/git-context.js.map +0 -1
  208. package/dist/src/core/detect/llm-key.js.map +0 -1
  209. package/dist/src/core/detect/protected-paths.js.map +0 -1
  210. package/dist/src/core/detect/provider-usage.js.map +0 -1
  211. package/dist/src/core/detect/stack.js.map +0 -1
  212. package/dist/src/core/detect/workspaces.js.map +0 -1
  213. package/dist/src/core/errors.js.map +0 -1
  214. package/dist/src/core/findings/dedup.js.map +0 -1
  215. package/dist/src/core/findings/types.js.map +0 -1
  216. package/dist/src/core/fix/generator.js.map +0 -1
  217. package/dist/src/core/git/diff-hunks.js.map +0 -1
  218. package/dist/src/core/git/touched-files.js.map +0 -1
  219. package/dist/src/core/ignore/index.js.map +0 -1
  220. package/dist/src/core/index.js.map +0 -1
  221. package/dist/src/core/logging/ndjson-writer.js.map +0 -1
  222. package/dist/src/core/logging/redaction.js.map +0 -1
  223. package/dist/src/core/mcp/concurrency.js.map +0 -1
  224. package/dist/src/core/mcp/handlers/fix-finding.js.map +0 -1
  225. package/dist/src/core/mcp/handlers/get-capabilities.js.map +0 -1
  226. package/dist/src/core/mcp/handlers/get-findings.js.map +0 -1
  227. package/dist/src/core/mcp/handlers/review-diff.js.map +0 -1
  228. package/dist/src/core/mcp/handlers/scan-files.js.map +0 -1
  229. package/dist/src/core/mcp/handlers/validate-fix.js.map +0 -1
  230. package/dist/src/core/mcp/run-store.js.map +0 -1
  231. package/dist/src/core/mcp/workspace.js.map +0 -1
  232. package/dist/src/core/persist/baseline.js.map +0 -1
  233. package/dist/src/core/persist/cost-log.js.map +0 -1
  234. package/dist/src/core/persist/findings-cache.js.map +0 -1
  235. package/dist/src/core/persist/triage.js.map +0 -1
  236. package/dist/src/core/phases/static-rules.js.map +0 -1
  237. package/dist/src/core/phases/tests.js.map +0 -1
  238. package/dist/src/core/pipeline/review-phase.js.map +0 -1
  239. package/dist/src/core/pipeline/run.js.map +0 -1
  240. package/dist/src/core/runtime/idempotency.js.map +0 -1
  241. package/dist/src/core/runtime/lock.js.map +0 -1
  242. package/dist/src/core/runtime/state.js.map +0 -1
  243. package/dist/src/core/schema-alignment/detector.js.map +0 -1
  244. package/dist/src/core/schema-alignment/extractor/index.js.map +0 -1
  245. package/dist/src/core/schema-alignment/extractor/prisma.js.map +0 -1
  246. package/dist/src/core/schema-alignment/extractor/sql.js.map +0 -1
  247. package/dist/src/core/schema-alignment/llm-check.js.map +0 -1
  248. package/dist/src/core/schema-alignment/scanner.js.map +0 -1
  249. package/dist/src/core/schema-alignment/types.js.map +0 -1
  250. package/dist/src/core/shell.js.map +0 -1
  251. package/dist/src/core/static-rules/registry.js.map +0 -1
  252. package/dist/src/core/static-rules/rules/brand-tokens.js.map +0 -1
  253. package/dist/src/core/static-rules/rules/console-log.js.map +0 -1
  254. package/dist/src/core/static-rules/rules/hardcoded-secrets.js.map +0 -1
  255. package/dist/src/core/static-rules/rules/insecure-redirect.js.map +0 -1
  256. package/dist/src/core/static-rules/rules/large-file.js.map +0 -1
  257. package/dist/src/core/static-rules/rules/missing-auth.js.map +0 -1
  258. package/dist/src/core/static-rules/rules/missing-tests.js.map +0 -1
  259. package/dist/src/core/static-rules/rules/npm-audit.js.map +0 -1
  260. package/dist/src/core/static-rules/rules/package-lock-sync.js.map +0 -1
  261. package/dist/src/core/static-rules/rules/schema-alignment.js.map +0 -1
  262. package/dist/src/core/static-rules/rules/sql-injection.js.map +0 -1
  263. package/dist/src/core/static-rules/rules/ssrf.js.map +0 -1
  264. package/dist/src/core/static-rules/rules/todo-fixme.js.map +0 -1
  265. package/dist/src/core/static-rules/tailwind-extractor.js.map +0 -1
  266. package/dist/src/core/test-gen/coverage-analyzer.js.map +0 -1
  267. package/dist/src/core/test-gen/framework-detector.js.map +0 -1
  268. package/dist/src/core/test-gen/test-writer.js.map +0 -1
  269. package/dist/src/core/ui/design-context-loader.js.map +0 -1
  270. package/dist/src/core/worker/client.js.map +0 -1
  271. package/dist/src/core/worker/lockfile.js.map +0 -1
  272. package/dist/src/core/worker/server.js.map +0 -1
  273. package/dist/src/formatters/github-annotations.js.map +0 -1
  274. package/dist/src/formatters/index.js.map +0 -1
  275. package/dist/src/formatters/junit.js.map +0 -1
  276. package/dist/src/formatters/sarif.js.map +0 -1
  277. package/dist/src/index.js.map +0 -1
  278. package/src/adapters/base.ts +0 -19
  279. package/src/adapters/council/claude.ts +0 -41
  280. package/src/adapters/council/openai.ts +0 -40
  281. package/src/adapters/council/types.ts +0 -7
  282. package/src/adapters/loader.ts +0 -108
  283. package/src/adapters/migration-runner/supabase.ts +0 -56
  284. package/src/adapters/migration-runner/types.ts +0 -36
  285. package/src/adapters/review-bot-parser/cursor.ts +0 -13
  286. package/src/adapters/review-bot-parser/declarative-base.ts +0 -64
  287. package/src/adapters/review-engine/auto.ts +0 -94
  288. package/src/adapters/review-engine/claude.ts +0 -100
  289. package/src/adapters/review-engine/codex.ts +0 -82
  290. package/src/adapters/review-engine/gemini.ts +0 -105
  291. package/src/adapters/review-engine/openai-compatible.ts +0 -100
  292. package/src/adapters/review-engine/parse-output.ts +0 -74
  293. package/src/adapters/review-engine/prompt-builder.ts +0 -19
  294. package/src/adapters/review-engine/types.ts +0 -19
  295. package/src/adapters/vcs-host/commit-status.ts +0 -39
  296. package/src/adapters/vcs-host/github.ts +0 -77
  297. package/src/adapters/vcs-host/types.ts +0 -44
  298. package/src/cli/autoregress-bridge.ts +0 -30
  299. package/src/cli/baseline.ts +0 -125
  300. package/src/cli/ci.ts +0 -45
  301. package/src/cli/costs.ts +0 -80
  302. package/src/cli/council.ts +0 -96
  303. package/src/cli/detector.ts +0 -92
  304. package/src/cli/explain.ts +0 -197
  305. package/src/cli/fix.ts +0 -249
  306. package/src/cli/hook.ts +0 -124
  307. package/src/cli/ignore-helper.ts +0 -116
  308. package/src/cli/index.ts +0 -612
  309. package/src/cli/lsp.ts +0 -200
  310. package/src/cli/mcp.ts +0 -206
  311. package/src/cli/migrate-v4.ts +0 -388
  312. package/src/cli/pr-comment.ts +0 -139
  313. package/src/cli/pr-desc.ts +0 -168
  314. package/src/cli/pr-review-comments.ts +0 -92
  315. package/src/cli/pr.ts +0 -76
  316. package/src/cli/preflight.ts +0 -235
  317. package/src/cli/report.ts +0 -186
  318. package/src/cli/run.ts +0 -425
  319. package/src/cli/scan.ts +0 -233
  320. package/src/cli/setup.ts +0 -191
  321. package/src/cli/test-gen.ts +0 -125
  322. package/src/cli/triage.ts +0 -137
  323. package/src/cli/watch.ts +0 -190
  324. package/src/cli/worker.ts +0 -109
  325. package/src/core/.gitkeep +0 -0
  326. package/src/core/cache/cached-engine.ts +0 -32
  327. package/src/core/cache/review-cache.ts +0 -70
  328. package/src/core/chunking/index.ts +0 -113
  329. package/src/core/chunking/risk-ranker.ts +0 -56
  330. package/src/core/config/loader.ts +0 -53
  331. package/src/core/config/preset-resolver.ts +0 -46
  332. package/src/core/config/schema.ts +0 -181
  333. package/src/core/config/types.ts +0 -98
  334. package/src/core/council/config.ts +0 -71
  335. package/src/core/council/context.ts +0 -17
  336. package/src/core/council/runner.ts +0 -83
  337. package/src/core/council/types.ts +0 -45
  338. package/src/core/detect/git-context.ts +0 -27
  339. package/src/core/detect/llm-key.ts +0 -89
  340. package/src/core/detect/protected-paths.ts +0 -63
  341. package/src/core/detect/provider-usage.ts +0 -74
  342. package/src/core/detect/stack.ts +0 -153
  343. package/src/core/detect/workspaces.ts +0 -103
  344. package/src/core/errors.ts +0 -37
  345. package/src/core/findings/dedup.ts +0 -14
  346. package/src/core/findings/types.ts +0 -39
  347. package/src/core/fix/generator.ts +0 -149
  348. package/src/core/git/diff-hunks.ts +0 -86
  349. package/src/core/git/touched-files.ts +0 -73
  350. package/src/core/ignore/index.ts +0 -54
  351. package/src/core/index.ts +0 -1
  352. package/src/core/logging/ndjson-writer.ts +0 -37
  353. package/src/core/logging/redaction.ts +0 -19
  354. package/src/core/mcp/concurrency.ts +0 -16
  355. package/src/core/mcp/handlers/fix-finding.ts +0 -126
  356. package/src/core/mcp/handlers/get-capabilities.ts +0 -62
  357. package/src/core/mcp/handlers/get-findings.ts +0 -36
  358. package/src/core/mcp/handlers/review-diff.ts +0 -65
  359. package/src/core/mcp/handlers/scan-files.ts +0 -65
  360. package/src/core/mcp/handlers/validate-fix.ts +0 -41
  361. package/src/core/mcp/run-store.ts +0 -85
  362. package/src/core/mcp/workspace.ts +0 -35
  363. package/src/core/persist/baseline.ts +0 -112
  364. package/src/core/persist/cost-log.ts +0 -30
  365. package/src/core/persist/findings-cache.ts +0 -43
  366. package/src/core/persist/triage.ts +0 -112
  367. package/src/core/phases/static-rules.ts +0 -93
  368. package/src/core/phases/tests.ts +0 -51
  369. package/src/core/pipeline/review-phase.ts +0 -182
  370. package/src/core/pipeline/run.ts +0 -116
  371. package/src/core/runtime/idempotency.ts +0 -6
  372. package/src/core/runtime/lock.ts +0 -29
  373. package/src/core/runtime/state.ts +0 -97
  374. package/src/core/schema-alignment/detector.ts +0 -59
  375. package/src/core/schema-alignment/extractor/index.ts +0 -24
  376. package/src/core/schema-alignment/extractor/prisma.ts +0 -21
  377. package/src/core/schema-alignment/extractor/sql.ts +0 -99
  378. package/src/core/schema-alignment/llm-check.ts +0 -91
  379. package/src/core/schema-alignment/scanner.ts +0 -107
  380. package/src/core/schema-alignment/types.ts +0 -43
  381. package/src/core/shell.ts +0 -48
  382. package/src/core/static-rules/registry.ts +0 -59
  383. package/src/core/static-rules/rules/brand-tokens.ts +0 -145
  384. package/src/core/static-rules/rules/console-log.ts +0 -42
  385. package/src/core/static-rules/rules/hardcoded-secrets.ts +0 -83
  386. package/src/core/static-rules/rules/insecure-redirect.ts +0 -67
  387. package/src/core/static-rules/rules/large-file.ts +0 -37
  388. package/src/core/static-rules/rules/missing-auth.ts +0 -70
  389. package/src/core/static-rules/rules/missing-tests.ts +0 -57
  390. package/src/core/static-rules/rules/npm-audit.ts +0 -38
  391. package/src/core/static-rules/rules/package-lock-sync.ts +0 -54
  392. package/src/core/static-rules/rules/schema-alignment.ts +0 -132
  393. package/src/core/static-rules/rules/sql-injection.ts +0 -71
  394. package/src/core/static-rules/rules/ssrf.ts +0 -63
  395. package/src/core/static-rules/rules/todo-fixme.ts +0 -40
  396. package/src/core/static-rules/tailwind-extractor.ts +0 -38
  397. package/src/core/test-gen/coverage-analyzer.ts +0 -93
  398. package/src/core/test-gen/framework-detector.ts +0 -21
  399. package/src/core/test-gen/test-writer.ts +0 -33
  400. package/src/core/ui/design-context-loader.ts +0 -87
  401. package/src/core/worker/client.ts +0 -46
  402. package/src/core/worker/lockfile.ts +0 -38
  403. package/src/core/worker/server.ts +0 -81
  404. package/src/formatters/github-annotations.ts +0 -36
  405. package/src/formatters/junit.ts +0 -52
  406. package/src/formatters/sarif.ts +0 -103
package/src/cli/index.ts DELETED
@@ -1,612 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * guardrail CLI — entry point
4
- *
5
- * Usage:
6
- * guardrail run review git-changed files
7
- * guardrail scan src/auth/ review any path (no git required)
8
- * guardrail scan --ask "..." ask a targeted question about code
9
- * guardrail ci opinionated CI entrypoint
10
- * guardrail watch re-run on every file save
11
- * guardrail doctor check prerequisites
12
- */
13
- import { runCommand } from './run.ts';
14
- import { runWatch } from './watch.ts';
15
- import { runSetup } from './setup.ts';
16
- import { runDoctor } from './preflight.ts';
17
- import { runCi } from './ci.ts';
18
- import { runFix } from './fix.ts';
19
- import { runScan } from './scan.ts';
20
- import { runReport } from './report.ts';
21
- import { runExplain } from './explain.ts';
22
- import { runIgnore } from './ignore-helper.ts';
23
- import { runPr } from './pr.ts';
24
- import { runBaseline } from './baseline.ts';
25
- import { runTriage } from './triage.ts';
26
- import { runLsp } from './lsp.ts';
27
- import { runWorker } from './worker.ts';
28
- import { runTestGen } from './test-gen.ts';
29
- import { runCouncilCmd } from './council.ts';
30
- import { runMigrateV4 } from './migrate-v4.ts';
31
- import { findPackageRoot } from './_pkg-root.ts';
32
-
33
- const args = process.argv.slice(2);
34
-
35
- // Version flag — read package.json via the shared package-root helper. Works
36
- // under both source (src/cli/index.ts) and compiled (dist/src/cli/index.js)
37
- // layouts since findPackageRoot walks up to the canonical package root.
38
- if (args[0] === '--version' || args[0] === '-v') {
39
- const root = findPackageRoot(import.meta.url);
40
- if (root) {
41
- const nodeFs = await import('node:fs');
42
- const nodePath = await import('node:path');
43
- const pkg = JSON.parse(nodeFs.readFileSync(nodePath.join(root, 'package.json'), 'utf8')) as { version: string };
44
- console.log(pkg.version);
45
- } else {
46
- console.log('unknown');
47
- }
48
- process.exit(0);
49
- }
50
-
51
- // Help flag — route to help handler explicitly before subcommand defaulting.
52
- // Without this, `--help` falls through the "args[0].startsWith('--')" check below
53
- // and defaults to `run`, which is surprising and a v4 regression we preserve no longer.
54
- if (args[0] === '--help' || args[0] === '-h') {
55
- args.unshift('help');
56
- args.splice(1, 1); // remove the original --help/-h token
57
- }
58
-
59
- // Verb grouping (new in alpha.2): `claude-autopilot review <verb>` and
60
- // `claude-autopilot advanced <verb>` are dispatcher prefixes that route to the
61
- // same flat handlers. Legacy flat invocation (`claude-autopilot run`) is unchanged
62
- // — the grouped form is purely additive.
63
- //
64
- // Scope gates enforce that only the documented verb sets work under each prefix,
65
- // so `claude-autopilot review doctor` is rejected with a clear error instead of
66
- // silently routing to the doctor handler (which would confuse the mental model).
67
- const REVIEW_VERBS = new Set(['run', 'scan', 'ci', 'fix', 'baseline', 'explain', 'watch', 'report']);
68
- // `detector` is a library used by setup/run, not a CLI subcommand — leave it out.
69
- const ADVANCED_VERBS = new Set(['lsp', 'mcp', 'worker', 'autoregress', 'test-gen', 'hook', 'ignore']);
70
- if (args[0] === 'review') {
71
- const sub = args[1];
72
- if (!sub || sub === '--help' || sub === '-h') {
73
- console.log(`
74
- Usage: claude-autopilot review <verb> [options]
75
-
76
- Review-phase verbs:
77
- run Review git-changed files (default)
78
- scan Review any path — no git required
79
- ci Opinionated CI entrypoint (post comments + SARIF)
80
- fix Auto-fix cached findings using the configured LLM
81
- baseline Manage the committed findings baseline
82
- explain Deep-dive explanation + remediation for a specific finding
83
- watch Watch for file changes and re-run on each save
84
- report Render cached findings as a markdown report
85
-
86
- These are aliases for the flat subcommands — \`claude-autopilot run\` and
87
- \`claude-autopilot review run\` are equivalent.
88
- `);
89
- process.exit(0);
90
- }
91
- if (!REVIEW_VERBS.has(sub)) {
92
- console.error(`\x1b[31m[claude-autopilot] "${sub}" is not a review-phase verb.\x1b[0m`);
93
- console.error(`\x1b[2m Valid: ${[...REVIEW_VERBS].join(', ')}\x1b[0m`);
94
- console.error(`\x1b[2m Did you mean: claude-autopilot ${sub} ...?\x1b[0m`);
95
- process.exit(1);
96
- }
97
- args.shift(); // drop 'review', leave the flat subcommand at args[0]
98
- }
99
- if (args[0] === 'advanced') {
100
- const sub = args[1];
101
- if (!sub || sub === '--help' || sub === '-h') {
102
- console.log(`
103
- Usage: claude-autopilot advanced <verb> [options]
104
-
105
- Advanced / niche verbs (hidden from top-level --help to keep it readable):
106
- lsp Language server — publishes findings as LSP diagnostics
107
- mcp MCP server for Claude / ChatGPT integration
108
- worker Persistent review daemon (start|stop|status)
109
- autoregress Snapshot regression tests
110
- test-gen Generate test cases for uncovered exports
111
- hook Install / remove the pre-push git hook
112
- ignore Edit the findings ignore list
113
-
114
- These are aliases for the flat subcommands; they still work without the 'advanced' prefix.
115
- `);
116
- process.exit(0);
117
- }
118
- if (!ADVANCED_VERBS.has(sub)) {
119
- console.error(`\x1b[31m[claude-autopilot] "${sub}" is not an advanced verb.\x1b[0m`);
120
- console.error(`\x1b[2m Valid: ${[...ADVANCED_VERBS].join(', ')}\x1b[0m`);
121
- process.exit(1);
122
- }
123
- args.shift(); // drop 'advanced'
124
- }
125
-
126
- const SUBCOMMANDS = ['init', 'run', 'scan', 'report', 'explain', 'ignore', 'ci', 'pr', 'fix', 'costs', 'watch', 'hook', 'autoregress', 'baseline', 'triage', 'lsp', 'worker', 'mcp', 'test-gen', 'pr-desc', 'doctor', 'preflight', 'setup', 'council', 'migrate-v4', 'brainstorm', 'help', '--help', '-h'] as const;
127
- const VALUE_FLAGS = ['base', 'config', 'files', 'format', 'output', 'debounce', 'ask', 'focus', 'fail-on', 'note', 'reason', 'expires', 'profile', 'severity', 'prompt', 'context-file', 'path'];
128
-
129
- // Bare invocation — no subcommand, no flags → show welcome guide
130
- if (args.length === 0) {
131
- const hasKey = !!(process.env.ANTHROPIC_API_KEY || process.env.GEMINI_API_KEY ||
132
- process.env.GOOGLE_API_KEY || process.env.OPENAI_API_KEY || process.env.GROQ_API_KEY);
133
- const keyLine = hasKey
134
- ? '\x1b[32m✓\x1b[0m LLM API key detected'
135
- : '\x1b[33m!\x1b[0m No LLM API key found — set one of:\n ANTHROPIC_API_KEY https://console.anthropic.com/\n OPENAI_API_KEY https://platform.openai.com/api-keys\n GEMINI_API_KEY https://aistudio.google.com/app/apikey\n GROQ_API_KEY https://console.groq.com/keys (fast free tier)';
136
- console.log(`
137
- \x1b[1m@delegance/claude-autopilot\x1b[0m — Autonomous dev pipeline for Claude Code
138
- \x1b[2m(brainstorm → spec → plan → implement → migrate → validate → PR → review)\x1b[0m
139
-
140
- ${keyLine}
141
-
142
- \x1b[1mQuick start — full pipeline:\x1b[0m
143
-
144
- \x1b[36mclaude-autopilot brainstorm "add SSO for enterprise tenants"\x1b[0m
145
- Turn an idea into a reviewed spec, then auto-implement end-to-end.
146
-
147
- \x1b[1mOr just the review phase (v4 compatible):\x1b[0m
148
-
149
- \x1b[36mclaude-autopilot run --base main\x1b[0m Review files changed vs main
150
- \x1b[36mclaude-autopilot scan src/auth/\x1b[0m Scan any path (no git required)
151
- \x1b[36mclaude-autopilot scan --ask "SQL injection?" src/db/\x1b[0m
152
- \x1b[36mclaude-autopilot fix\x1b[0m Auto-fix cached findings
153
- \x1b[36mclaude-autopilot migrate-v4\x1b[0m Codemod: migrate v4 config / CI / hooks
154
-
155
- \x1b[1mSetup:\x1b[0m
156
-
157
- \x1b[36mclaude-autopilot setup\x1b[0m Auto-detect stack, write config, install hook
158
- \x1b[36mclaude-autopilot doctor\x1b[0m Check prerequisites
159
-
160
- Run \x1b[36mclaude-autopilot --help\x1b[0m for full command reference.
161
- `);
162
- process.exit(0);
163
- }
164
-
165
- // Detect first non-flag arg as subcommand, default to 'run'
166
- const subcommand = (args[0] && !args[0].startsWith('--')) ? args[0] : 'run';
167
-
168
- /** Returns value for --name <value>. Exits if value is missing (next token is another flag or absent). */
169
- function flag(name: string): string | undefined {
170
- const idx = args.indexOf(`--${name}`);
171
- if (idx < 0) return undefined;
172
- const val = args[idx + 1];
173
- if (val === undefined || val.startsWith('--')) {
174
- console.error(`\x1b[31m[claude-autopilot] --${name} requires a value\x1b[0m`);
175
- process.exit(1);
176
- }
177
- return val;
178
- }
179
-
180
- function boolFlag(name: string): boolean {
181
- return args.includes(`--${name}`);
182
- }
183
-
184
- function printUsage(): void {
185
- console.log(`
186
- Usage: claude-autopilot <command> [options] (legacy alias: guardrail)
187
-
188
- Commands:
189
- run Review git-changed files (default)
190
- scan Review any path — no git required
191
- report Render cached findings as a markdown report
192
- explain Deep-dive explanation + remediation for a specific finding
193
- ignore Interactively add findings to .guardrail-ignore
194
- watch Watch for file changes and re-run on each save
195
- pr Review a specific PR by number (auto-detects if on PR branch)
196
- fix Auto-fix cached findings using the configured LLM
197
- costs Show per-run cost summary
198
- ci Opinionated CI entrypoint (post comments + SARIF)
199
- init Scaffold guardrail.config.yaml from a preset
200
- setup Auto-detect stack, write config, install pre-push hook
201
- doctor Check prerequisites (alias: preflight)
202
- preflight Check prerequisites (alias: doctor)
203
- hook Install / remove the pre-push git hook
204
- baseline Manage the committed findings baseline (create|update|show|delete)
205
- triage Mark individual findings as accepted/dismissed
206
- pr-desc Generate a PR title / summary / test plan from the current diff
207
- council Multi-model review — dispatch the diff to N models and synthesize consensus
208
- mcp MCP server for Claude / ChatGPT integration
209
- autoregress Snapshot regression tests (run|diff|update|generate)
210
- lsp Language server — publishes findings as LSP diagnostics (stdin/stdout)
211
- worker Persistent review daemon for multi-terminal parallel usage (start|stop|status)
212
- test-gen Detect uncovered exports and generate test cases using the LLM
213
-
214
- Options (run):
215
- --base <ref> Git base ref for diff (default: HEAD~1)
216
- --config <path> Path to config file (default: ./guardrail.config.yaml)
217
- --files <a,b,c> Explicit comma-separated file list (skips git detection)
218
- --dry-run Show what would run without executing
219
- --diff Send git diff hunks instead of full files (~70% fewer tokens)
220
- --delta Only report findings new since last run (suppress pre-existing)
221
- --inline-comments Post per-line review comments on the PR diff
222
- --post-comments Post/update a summary comment on the open PR
223
- --format <text|sarif> Output format (default: text)
224
- --output <path> Output file path (required with --format sarif)
225
-
226
- Options (scan):
227
- <path> [path...] Files or directories to scan (or --all for entire codebase)
228
- --all Scan entire codebase
229
- --ask <question> Targeted question to inject into the LLM review prompt
230
- --focus <type> security | logic | performance (default: all)
231
- --dry-run List files that would be scanned without running
232
- --config <path> Path to config file
233
-
234
- Options (pr):
235
- <number> PR number to review (optional if on a PR branch)
236
- --no-post-comments Skip posting/updating PR summary comment
237
- --no-inline-comments Skip posting per-line inline annotations
238
- --config <path> Path to config file
239
-
240
- Options (fix):
241
- --severity <critical|warning|all> Which findings to fix (default: critical)
242
- --dry-run Preview fixes without writing files
243
- --config <path> Path to config file
244
-
245
- Options (watch):
246
- --config <path> Path to config file (default: ./guardrail.config.yaml)
247
- --debounce <ms> Debounce delay in ms (default: 300)
248
-
249
- Options (autoregress):
250
- --all Run/diff all snapshots
251
- --since <ref> Git ref for changed-files detection
252
- --snapshot <slug> Target a single snapshot
253
- --files <a,b,c> Explicit file list for generate (skips git detection)
254
- `);
255
- }
256
-
257
- switch (subcommand) {
258
- case 'scan': {
259
- const config = flag('config');
260
- const ask = flag('ask');
261
- const focusArg = flag('focus');
262
- if (focusArg && !['security', 'logic', 'performance', 'brand', 'all'].includes(focusArg)) {
263
- console.error(`\x1b[31m[claude-autopilot] --focus must be "security", "logic", "performance", or "all"\x1b[0m`);
264
- process.exit(1);
265
- }
266
- const dryRun = boolFlag('dry-run');
267
- const all = boolFlag('all');
268
- // Remaining non-flag args after 'scan' are paths
269
- const targets = args.slice(1).filter(a => !a.startsWith('--') && a !== ask && a !== focusArg && a !== config);
270
- const code = await runScan({
271
- configPath: config,
272
- targets: targets.length > 0 ? targets : undefined,
273
- all,
274
- ask,
275
- focus: focusArg as 'security' | 'logic' | 'performance' | 'brand' | 'all' | undefined,
276
- dryRun,
277
- });
278
- process.exit(code);
279
- break;
280
- }
281
-
282
- case 'init': {
283
- console.log('\x1b[33m[init] guardrail init is deprecated — use: npx guardrail setup\x1b[0m\n');
284
- const force = args.includes('--force');
285
- await runSetup({ force });
286
- break;
287
- }
288
-
289
- case 'doctor':
290
- case 'preflight': {
291
- const result = await runDoctor();
292
- process.exit(result.blockers > 0 ? 1 : 0);
293
- break;
294
- }
295
-
296
- case 'help':
297
- case '--help':
298
- case '-h':
299
- printUsage();
300
- break;
301
-
302
- case 'watch': {
303
- const config = flag('config');
304
- const debounceArg = flag('debounce');
305
- const debounceMs = debounceArg ? parseInt(debounceArg, 10) : undefined;
306
- if (debounceArg && (isNaN(debounceMs!) || debounceMs! < 0)) {
307
- console.error(`\x1b[31m[claude-autopilot] --debounce must be a non-negative integer\x1b[0m`);
308
- process.exit(1);
309
- }
310
- await runWatch({ configPath: config, debounceMs });
311
- break;
312
- }
313
-
314
- case 'run': {
315
- const base = flag('base');
316
- const config = flag('config');
317
- const filesArg = flag('files');
318
- const dryRun = boolFlag('dry-run');
319
- const diff = boolFlag('diff');
320
- const delta = boolFlag('delta');
321
- const staticOnly = args.includes('--static-only');
322
- const inlineComments = boolFlag('inline-comments');
323
- const postComments = boolFlag('post-comments');
324
- const formatArg = flag('format');
325
- const outputPath = flag('output');
326
-
327
- if (formatArg && formatArg !== 'text' && formatArg !== 'sarif' && formatArg !== 'junit') {
328
- console.error(`\x1b[31m[claude-autopilot] --format must be "text", "sarif", or "junit"\x1b[0m`);
329
- process.exit(1);
330
- }
331
- if ((formatArg === 'sarif' || formatArg === 'junit') && !outputPath) {
332
- console.error(`\x1b[31m[claude-autopilot] --format ${formatArg} requires --output <path>\x1b[0m`);
333
- process.exit(1);
334
- }
335
-
336
- const failOnArg = flag('fail-on');
337
- if (failOnArg && !['critical', 'warning', 'note', 'none'].includes(failOnArg)) {
338
- console.error(`\x1b[31m[claude-autopilot] --fail-on must be "critical", "warning", "note", or "none"\x1b[0m`);
339
- process.exit(1);
340
- }
341
- const newOnly = boolFlag('new-only');
342
-
343
- const code = await runCommand({
344
- base,
345
- configPath: config,
346
- files: filesArg ? filesArg.split(',').map(f => f.trim()) : undefined,
347
- dryRun,
348
- diff,
349
- delta,
350
- newOnly,
351
- failOn: failOnArg as 'critical' | 'warning' | 'note' | 'none' | undefined,
352
- inlineComments,
353
- postComments,
354
- format: formatArg as 'text' | 'sarif' | 'junit' | undefined,
355
- outputPath,
356
- skipReview: staticOnly,
357
- });
358
- process.exit(code);
359
- break;
360
- }
361
-
362
- case 'ci': {
363
- const base = flag('base');
364
- const config = flag('config');
365
- const outputPath = flag('output');
366
- const noPostComments = boolFlag('no-post-comments');
367
- const noInlineComments = boolFlag('no-inline-comments');
368
- const diff = boolFlag('diff');
369
- const newOnly = boolFlag('new-only');
370
- const failOnArg = flag('fail-on');
371
- const code = await runCi({
372
- configPath: config,
373
- base,
374
- sarifOutput: outputPath,
375
- postComments: noPostComments ? false : undefined,
376
- inlineComments: noInlineComments ? false : undefined,
377
- diff,
378
- newOnly,
379
- failOn: failOnArg as 'critical' | 'warning' | 'note' | 'none' | undefined,
380
- });
381
- process.exit(code);
382
- break;
383
- }
384
-
385
- case 'baseline': {
386
- const { runBaseline: rb } = await import('./baseline.ts');
387
- const sub = args[1] ?? 'show';
388
- const note = flag('note');
389
- const config = flag('config');
390
- const code = await rb(sub, { cwd: process.cwd(), note, baselinePath: config });
391
- process.exit(code);
392
- break;
393
- }
394
-
395
- case 'pr': {
396
- const config = flag('config');
397
- const noPostComments = boolFlag('no-post-comments');
398
- const noInlineComments = boolFlag('no-inline-comments');
399
- const prNumber = args.slice(1).find(a => !a.startsWith('--') && /^\d+$/.test(a));
400
- const code = await runPr({
401
- configPath: config,
402
- prNumber,
403
- noPostComments,
404
- noInlineComments,
405
- });
406
- process.exit(code);
407
- break;
408
- }
409
-
410
- case 'hook': {
411
- const { runHook } = await import('./hook.ts');
412
- const hookSub = args[1] ?? 'status';
413
- const force = boolFlag('force');
414
- const code = await runHook(hookSub, {
415
- force,
416
- preCommitOnly: args.includes('--pre-commit-only'),
417
- prePushOnly: args.includes('--pre-push-only'),
418
- });
419
- process.exit(code);
420
- break;
421
- }
422
-
423
- case 'autoregress': {
424
- const { runAutoregress } = await import('./autoregress-bridge.ts');
425
- const code = runAutoregress(args.slice(1));
426
- process.exit(code);
427
- break;
428
- }
429
-
430
- case 'fix': {
431
- const config = flag('config');
432
- const severityArg = flag('severity');
433
- if (severityArg && !['critical', 'warning', 'all'].includes(severityArg)) {
434
- console.error(`\x1b[31m[claude-autopilot] --severity must be "critical", "warning", or "all"\x1b[0m`);
435
- process.exit(1);
436
- }
437
- const dryRun = boolFlag('dry-run');
438
- const noVerify = boolFlag('no-verify');
439
- const code = await runFix({
440
- configPath: config,
441
- severity: severityArg as 'critical' | 'warning' | 'all' | undefined,
442
- dryRun,
443
- noVerify,
444
- });
445
- process.exit(code);
446
- break;
447
- }
448
-
449
- case 'triage': {
450
- const sub = args[1];
451
- const rest = args.slice(2);
452
- const code = await runTriage(sub, rest);
453
- process.exit(code);
454
- break;
455
- }
456
-
457
- case 'test-gen': {
458
- const config = flag('config');
459
- const base = flag('base');
460
- const dryRun = boolFlag('dry-run');
461
- const verify = boolFlag('verify');
462
- const targets = args.slice(1).filter(a => !a.startsWith('--') && a !== config && a !== base);
463
- const code = await runTestGen({
464
- cwd: process.cwd(),
465
- configPath: config,
466
- targets: targets.length > 0 ? targets : undefined,
467
- base,
468
- dryRun,
469
- verify,
470
- });
471
- process.exit(code);
472
- break;
473
- }
474
-
475
- case 'pr-desc': {
476
- const { runPrDesc } = await import('./pr-desc.ts');
477
- const baseIdx = args.indexOf('--base');
478
- const base = baseIdx !== -1 ? args[baseIdx + 1] : undefined;
479
- const outputIdx = args.indexOf('--output');
480
- const output = outputIdx !== -1 ? args[outputIdx + 1] : undefined;
481
- await runPrDesc({
482
- base,
483
- post: args.includes('--post'),
484
- yes: args.includes('--yes'),
485
- output,
486
- });
487
- break;
488
- }
489
-
490
- case 'lsp': {
491
- await runLsp({ cwd: process.cwd() });
492
- break;
493
- }
494
-
495
- case 'costs': {
496
- const { runCosts } = await import('./costs.ts');
497
- const code = await runCosts();
498
- process.exit(code);
499
- break;
500
- }
501
-
502
- case 'report': {
503
- const outputPath = flag('output');
504
- const trend = boolFlag('trend');
505
- const code = await runReport({ output: outputPath, trend });
506
- process.exit(code);
507
- break;
508
- }
509
-
510
- case 'explain': {
511
- const config = flag('config');
512
- // Target is the first non-flag arg after 'explain'
513
- const target = args.slice(1).find(a => !a.startsWith('--'));
514
- const code = await runExplain({ configPath: config, target });
515
- process.exit(code);
516
- break;
517
- }
518
-
519
- case 'ignore': {
520
- const all = boolFlag('all');
521
- const dryRun = boolFlag('dry-run');
522
- const code = await runIgnore({ all, dryRun });
523
- process.exit(code);
524
- break;
525
- }
526
-
527
- case 'setup': {
528
- const force = args.includes('--force');
529
- const profileArg = flag('profile');
530
- if (profileArg && !['security-strict', 'team', 'solo'].includes(profileArg)) {
531
- console.error(`\x1b[31m[claude-autopilot] --profile must be "security-strict", "team", or "solo"\x1b[0m`);
532
- process.exit(1);
533
- }
534
- await runSetup({ force, profile: profileArg as 'security-strict' | 'team' | 'solo' | undefined });
535
- break;
536
- }
537
-
538
- case 'worker': {
539
- const sub = args[1];
540
- const config = flag('config');
541
- const code = await runWorker(sub, { cwd: process.cwd(), configPath: config });
542
- process.exit(code);
543
- break;
544
- }
545
-
546
- case 'council': {
547
- const config = flag('config');
548
- const prompt = flag('prompt');
549
- const contextFile = flag('context-file');
550
- const dryRun = boolFlag('dry-run');
551
- const noSynthesize = boolFlag('no-synthesize');
552
- const code = await runCouncilCmd({
553
- prompt,
554
- contextFile,
555
- configPath: config,
556
- dryRun,
557
- noSynthesize,
558
- });
559
- process.exit(code);
560
- break;
561
- }
562
-
563
- case 'mcp': {
564
- const { runMcp } = await import('./mcp.ts');
565
- const configPath = flag('config');
566
- await runMcp({ cwd: process.cwd(), configPath });
567
- break;
568
- }
569
-
570
- case 'migrate-v4': {
571
- const code = await runMigrateV4({
572
- cwd: flag('path') ?? process.cwd(),
573
- write: boolFlag('write'),
574
- undo: boolFlag('undo'),
575
- });
576
- process.exit(code);
577
- break;
578
- }
579
-
580
- case 'brainstorm': {
581
- // `brainstorm` is the front of the pipeline and is implemented as a Claude
582
- // Code skill (superpowers:brainstorming → autopilot), not a standalone CLI.
583
- // The welcome screen advertises `claude-autopilot brainstorm "..."` as the
584
- // primary quickstart, so users WILL land here. Give them clear instructions
585
- // instead of a generic "Unknown subcommand" rejection. Only reference CLI
586
- // subcommands that actually route (verified by the welcome regression test).
587
- console.log(`
588
- \x1b[1m[brainstorm]\x1b[0m The pipeline entry point is a Claude Code skill, not a CLI subcommand.
589
-
590
- Invoke it from Claude Code:
591
-
592
- \x1b[36m/brainstorm\x1b[0m Interactive spec writing
593
- \x1b[36m/autopilot\x1b[0m Full pipeline from an approved spec
594
- \x1b[36m/migrate\x1b[0m Database migration phase (stack-dependent)
595
-
596
- From the terminal, the CLI subset exposes only the individual review-phase subcommands:
597
-
598
- \x1b[36mclaude-autopilot run --base main\x1b[0m Just the review phase
599
- \x1b[36mclaude-autopilot doctor\x1b[0m Check prerequisites (incl. superpowers plugin)
600
- \x1b[36mclaude-autopilot migrate-v4\x1b[0m Codemod for v4 → v5 repo migration (not a pipeline phase)
601
-
602
- Full pipeline docs: https://github.com/axledbetter/claude-autopilot#the-pipeline-phase-by-phase
603
- `);
604
- process.exit(0);
605
- break;
606
- }
607
-
608
- default:
609
- console.error(`\x1b[31m[claude-autopilot] Unknown subcommand: "${subcommand}"\x1b[0m`);
610
- printUsage();
611
- process.exit(1);
612
- }