code-auditor-mcp 5.0.2 → 5.3.3

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 (419) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +326 -3
  3. package/README.md +24 -2
  4. package/configs/hhra-compat.json +12 -118
  5. package/dist/analyzers/cross-language/DependencyGraphBuilder.d.ts.map +1 -1
  6. package/dist/analyzers/cross-language/DependencyGraphBuilder.js +11 -1
  7. package/dist/analyzers/cross-language/DependencyGraphBuilder.js.map +1 -1
  8. package/dist/analyzers/crossDomain/CrossDomainAnalyzer.d.ts.map +1 -1
  9. package/dist/analyzers/crossDomain/CrossDomainAnalyzer.js +57 -52
  10. package/dist/analyzers/crossDomain/CrossDomainAnalyzer.js.map +1 -1
  11. package/dist/analyzers/provenance.d.ts +9 -4
  12. package/dist/analyzers/provenance.d.ts.map +1 -1
  13. package/dist/analyzers/provenance.js +8 -25
  14. package/dist/analyzers/provenance.js.map +1 -1
  15. package/dist/analyzers/reactAnalyzer.d.ts.map +1 -1
  16. package/dist/analyzers/reactAnalyzer.js +35 -14
  17. package/dist/analyzers/reactAnalyzer.js.map +1 -1
  18. package/dist/analyzers/ruleRegistry.js +4 -4
  19. package/dist/analyzers/ruleRegistry.js.map +1 -1
  20. package/dist/analyzers/ruleTiming.d.ts +1 -1
  21. package/dist/analyzers/ruleTiming.js +2 -2
  22. package/dist/analyzers/ruleTiming.js.map +1 -1
  23. package/dist/analyzers/universal/UniversalConventionsAnalyzer.d.ts.map +1 -1
  24. package/dist/analyzers/universal/UniversalConventionsAnalyzer.js +22 -26
  25. package/dist/analyzers/universal/UniversalConventionsAnalyzer.js.map +1 -1
  26. package/dist/analyzers/universal/UniversalDRYAnalyzer.d.ts +0 -2
  27. package/dist/analyzers/universal/UniversalDRYAnalyzer.d.ts.map +1 -1
  28. package/dist/analyzers/universal/UniversalDRYAnalyzer.js +4 -5
  29. package/dist/analyzers/universal/UniversalDRYAnalyzer.js.map +1 -1
  30. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts +32 -15
  31. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts.map +1 -1
  32. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js +189 -115
  33. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js.map +1 -1
  34. package/dist/analyzers/universal/UniversalSOLIDAnalyzer.d.ts +0 -2
  35. package/dist/analyzers/universal/UniversalSOLIDAnalyzer.d.ts.map +1 -1
  36. package/dist/analyzers/universal/UniversalSOLIDAnalyzer.js +0 -5
  37. package/dist/analyzers/universal/UniversalSOLIDAnalyzer.js.map +1 -1
  38. package/dist/analyzers/universal/UniversalStylesAnalyzer.d.ts +2 -10
  39. package/dist/analyzers/universal/UniversalStylesAnalyzer.d.ts.map +1 -1
  40. package/dist/analyzers/universal/UniversalStylesAnalyzer.js +7 -49
  41. package/dist/analyzers/universal/UniversalStylesAnalyzer.js.map +1 -1
  42. package/dist/analyzers/universal/schema/codeAnalysis.d.ts.map +1 -1
  43. package/dist/analyzers/universal/schema/codeAnalysis.js +51 -3
  44. package/dist/analyzers/universal/schema/codeAnalysis.js.map +1 -1
  45. package/dist/analyzers/universal/schema/config.d.ts.map +1 -1
  46. package/dist/analyzers/universal/schema/config.js +0 -2
  47. package/dist/analyzers/universal/schema/config.js.map +1 -1
  48. package/dist/analyzers/universal/schema/types.d.ts +0 -2
  49. package/dist/analyzers/universal/schema/types.d.ts.map +1 -1
  50. package/dist/analyzers/vendorSurfaces.d.ts +126 -0
  51. package/dist/analyzers/vendorSurfaces.d.ts.map +1 -0
  52. package/dist/analyzers/vendorSurfaces.js +580 -0
  53. package/dist/analyzers/vendorSurfaces.js.map +1 -0
  54. package/dist/auditRunner.d.ts +9 -1
  55. package/dist/auditRunner.d.ts.map +1 -1
  56. package/dist/auditRunner.js +198 -146
  57. package/dist/auditRunner.js.map +1 -1
  58. package/dist/cacheGc.d.ts +88 -0
  59. package/dist/cacheGc.d.ts.map +1 -0
  60. package/dist/cacheGc.js +196 -0
  61. package/dist/cacheGc.js.map +1 -0
  62. package/dist/churn/churnExtractor.d.ts +0 -1
  63. package/dist/churn/churnExtractor.d.ts.map +1 -1
  64. package/dist/churn/churnExtractor.js +2 -4
  65. package/dist/churn/churnExtractor.js.map +1 -1
  66. package/dist/cli.d.ts +1 -1
  67. package/dist/cli.d.ts.map +1 -1
  68. package/dist/cli.js +260 -47
  69. package/dist/cli.js.map +1 -1
  70. package/dist/codeIndex/migrations.d.ts.map +1 -1
  71. package/dist/codeIndex/migrations.js +4 -3
  72. package/dist/codeIndex/migrations.js.map +1 -1
  73. package/dist/codeIndexDB.d.ts +11 -2
  74. package/dist/codeIndexDB.d.ts.map +1 -1
  75. package/dist/codeIndexDB.js +27 -2
  76. package/dist/codeIndexDB.js.map +1 -1
  77. package/dist/config/configLoader.d.ts +60 -7
  78. package/dist/config/configLoader.d.ts.map +1 -1
  79. package/dist/config/configLoader.js +252 -60
  80. package/dist/config/configLoader.js.map +1 -1
  81. package/dist/config/defaults.d.ts +137 -43
  82. package/dist/config/defaults.d.ts.map +1 -1
  83. package/dist/config/defaults.js +174 -101
  84. package/dist/config/defaults.js.map +1 -1
  85. package/dist/config/effectiveConfig.d.ts +1 -1
  86. package/dist/config/effectiveConfig.d.ts.map +1 -1
  87. package/dist/config/effectiveConfig.js +4 -6
  88. package/dist/config/effectiveConfig.js.map +1 -1
  89. package/dist/config/pathProfiles.d.ts +4 -3
  90. package/dist/config/pathProfiles.d.ts.map +1 -1
  91. package/dist/config/pathProfiles.js +3 -2
  92. package/dist/config/pathProfiles.js.map +1 -1
  93. package/dist/constants.d.ts +2 -1
  94. package/dist/constants.d.ts.map +1 -1
  95. package/dist/constants.js +4 -0
  96. package/dist/constants.js.map +1 -1
  97. package/dist/daemon/main.d.ts +0 -1
  98. package/dist/daemon/main.d.ts.map +1 -1
  99. package/dist/daemon/main.js +11 -4
  100. package/dist/daemon/main.js.map +1 -1
  101. package/dist/dataPaths.d.ts +32 -9
  102. package/dist/dataPaths.d.ts.map +1 -1
  103. package/dist/dataPaths.js +69 -16
  104. package/dist/dataPaths.js.map +1 -1
  105. package/dist/hookLog.d.ts +54 -0
  106. package/dist/hookLog.d.ts.map +1 -0
  107. package/dist/hookLog.js +105 -0
  108. package/dist/hookLog.js.map +1 -0
  109. package/dist/hookLogPath.generated.d.ts +3 -0
  110. package/dist/hookLogPath.generated.d.ts.map +1 -0
  111. package/dist/hookLogPath.generated.js +8 -0
  112. package/dist/hookLogPath.generated.js.map +1 -0
  113. package/dist/index.d.ts +0 -5
  114. package/dist/index.d.ts.map +1 -1
  115. package/dist/index.js +0 -7
  116. package/dist/index.js.map +1 -1
  117. package/dist/installConfig.d.ts +15 -2
  118. package/dist/installConfig.d.ts.map +1 -1
  119. package/dist/installConfig.js +17 -2
  120. package/dist/installConfig.js.map +1 -1
  121. package/dist/installer.d.ts.map +1 -1
  122. package/dist/installer.js +2 -1
  123. package/dist/installer.js.map +1 -1
  124. package/dist/languages/adapterBridge.d.ts +11 -0
  125. package/dist/languages/adapterBridge.d.ts.map +1 -1
  126. package/dist/languages/adapterBridge.js +11 -0
  127. package/dist/languages/adapterBridge.js.map +1 -1
  128. package/dist/languages/types.d.ts +8 -0
  129. package/dist/languages/types.d.ts.map +1 -1
  130. package/dist/languages/typescript/TreeSitterTypeScriptAdapter.d.ts +13 -0
  131. package/dist/languages/typescript/TreeSitterTypeScriptAdapter.d.ts.map +1 -1
  132. package/dist/languages/typescript/TreeSitterTypeScriptAdapter.js +135 -18
  133. package/dist/languages/typescript/TreeSitterTypeScriptAdapter.js.map +1 -1
  134. package/dist/ledger.d.ts +7 -0
  135. package/dist/ledger.d.ts.map +1 -1
  136. package/dist/ledger.js +7 -0
  137. package/dist/ledger.js.map +1 -1
  138. package/dist/mcp-tools/workflowGuide.js +8 -8
  139. package/dist/mcp-tools/workflowGuide.js.map +1 -1
  140. package/dist/mcp-tools-shared.d.ts.map +1 -1
  141. package/dist/mcp-tools-shared.js +5 -2
  142. package/dist/mcp-tools-shared.js.map +1 -1
  143. package/dist/mcp-ui-simple.d.ts +5 -0
  144. package/dist/mcp-ui-simple.d.ts.map +1 -1
  145. package/dist/mcp-ui-simple.js +9 -2
  146. package/dist/mcp-ui-simple.js.map +1 -1
  147. package/dist/mcp.d.ts +0 -1
  148. package/dist/mcp.d.ts.map +1 -1
  149. package/dist/mcp.js +36 -33
  150. package/dist/mcp.js.map +1 -1
  151. package/dist/mcpAuditJobs.d.ts +10 -0
  152. package/dist/mcpAuditJobs.d.ts.map +1 -1
  153. package/dist/mcpAuditJobs.js +10 -1
  154. package/dist/mcpAuditJobs.js.map +1 -1
  155. package/dist/mcpAutoIndex.d.ts.map +1 -1
  156. package/dist/mcpAutoIndex.js +2 -1
  157. package/dist/mcpAutoIndex.js.map +1 -1
  158. package/dist/mcpDiagnostics.d.ts +2 -0
  159. package/dist/mcpDiagnostics.d.ts.map +1 -1
  160. package/dist/mcpDiagnostics.js +2 -0
  161. package/dist/mcpDiagnostics.js.map +1 -1
  162. package/dist/phase/candidates.d.ts +53 -0
  163. package/dist/phase/candidates.d.ts.map +1 -0
  164. package/dist/phase/candidates.js +67 -0
  165. package/dist/phase/candidates.js.map +1 -0
  166. package/dist/phase/colorMath.d.ts +18 -5
  167. package/dist/phase/colorMath.d.ts.map +1 -1
  168. package/dist/phase/colorMath.js +88 -5
  169. package/dist/phase/colorMath.js.map +1 -1
  170. package/dist/phase/dataAccessCallsCandidates.js +1 -1
  171. package/dist/phase/dataAccessCallsCandidates.js.map +1 -1
  172. package/dist/phase/goFunctionAnalysis.d.ts +2 -2
  173. package/dist/phase/goFunctionAnalysis.js +2 -2
  174. package/dist/phase/goFunctions.d.ts +2 -2
  175. package/dist/phase/goFunctions.js +2 -2
  176. package/dist/phase/goImports.d.ts +2 -2
  177. package/dist/phase/goImports.js +2 -2
  178. package/dist/phase/goSwitches.d.ts +2 -2
  179. package/dist/phase/goSwitches.js +2 -2
  180. package/dist/phase/imports.d.ts.map +1 -1
  181. package/dist/phase/imports.js +1 -0
  182. package/dist/phase/imports.js.map +1 -1
  183. package/dist/phase/loopQueryCandidates.js +1 -1
  184. package/dist/phase/loopQueryCandidates.js.map +1 -1
  185. package/dist/phase/oracles.d.ts +28 -0
  186. package/dist/phase/oracles.d.ts.map +1 -1
  187. package/dist/phase/oracles.js +28 -0
  188. package/dist/phase/oracles.js.map +1 -1
  189. package/dist/phase/phaseModel.d.ts +47 -8
  190. package/dist/phase/phaseModel.d.ts.map +1 -1
  191. package/dist/phase/phaseModel.js +44 -8
  192. package/dist/phase/phaseModel.js.map +1 -1
  193. package/dist/phase/producers.d.ts.map +1 -1
  194. package/dist/phase/producers.js +24 -17
  195. package/dist/phase/producers.js.map +1 -1
  196. package/dist/phase/reachability.d.ts +44 -1
  197. package/dist/phase/reachability.d.ts.map +1 -1
  198. package/dist/phase/reachability.js +79 -0
  199. package/dist/phase/reachability.js.map +1 -1
  200. package/dist/phase/rules/conventions.d.ts.map +1 -1
  201. package/dist/phase/rules/conventions.js +6 -2
  202. package/dist/phase/rules/conventions.js.map +1 -1
  203. package/dist/phase/rules/crossDomain.d.ts.map +1 -1
  204. package/dist/phase/rules/crossDomain.js +16 -6
  205. package/dist/phase/rules/crossDomain.js.map +1 -1
  206. package/dist/phase/rules/dataAccess.d.ts.map +1 -1
  207. package/dist/phase/rules/dataAccess.js +13 -0
  208. package/dist/phase/rules/dataAccess.js.map +1 -1
  209. package/dist/phase/rules/documentation.d.ts.map +1 -1
  210. package/dist/phase/rules/documentation.js +11 -1
  211. package/dist/phase/rules/documentation.js.map +1 -1
  212. package/dist/phase/rules/dry.d.ts +16 -7
  213. package/dist/phase/rules/dry.d.ts.map +1 -1
  214. package/dist/phase/rules/dry.js +51 -32
  215. package/dist/phase/rules/dry.js.map +1 -1
  216. package/dist/phase/rules/goRules.d.ts +2 -2
  217. package/dist/phase/rules/goRules.js +2 -2
  218. package/dist/phase/rules/secrets.d.ts +22 -8
  219. package/dist/phase/rules/secrets.d.ts.map +1 -1
  220. package/dist/phase/rules/secrets.js +75 -69
  221. package/dist/phase/rules/secrets.js.map +1 -1
  222. package/dist/phase/rules/styles.d.ts +23 -9
  223. package/dist/phase/rules/styles.d.ts.map +1 -1
  224. package/dist/phase/rules/styles.js +61 -15
  225. package/dist/phase/rules/styles.js.map +1 -1
  226. package/dist/phase/rules/unreferencedModule.d.ts.map +1 -1
  227. package/dist/phase/rules/unreferencedModule.js +32 -10
  228. package/dist/phase/rules/unreferencedModule.js.map +1 -1
  229. package/dist/phase/runner.d.ts +16 -7
  230. package/dist/phase/runner.d.ts.map +1 -1
  231. package/dist/phase/runner.js +32 -20
  232. package/dist/phase/runner.js.map +1 -1
  233. package/dist/phase/stringLiterals.d.ts.map +1 -1
  234. package/dist/phase/stringLiterals.js +16 -7
  235. package/dist/phase/stringLiterals.js.map +1 -1
  236. package/dist/phase/stylesCss.d.ts.map +1 -1
  237. package/dist/phase/stylesCss.js +4 -0
  238. package/dist/phase/stylesCss.js.map +1 -1
  239. package/dist/phase/stylesMarkup.d.ts.map +1 -1
  240. package/dist/phase/stylesMarkup.js +4 -0
  241. package/dist/phase/stylesMarkup.js.map +1 -1
  242. package/dist/phase/stylesSource.d.ts.map +1 -1
  243. package/dist/phase/stylesSource.js +6 -0
  244. package/dist/phase/stylesSource.js.map +1 -1
  245. package/dist/phase/testProgram.d.ts +57 -0
  246. package/dist/phase/testProgram.d.ts.map +1 -0
  247. package/dist/phase/testProgram.js +244 -0
  248. package/dist/phase/testProgram.js.map +1 -0
  249. package/dist/phase/typeDeclarations.d.ts +2 -2
  250. package/dist/phase/typeDeclarations.js +2 -2
  251. package/dist/phase/types.d.ts +104 -0
  252. package/dist/phase/types.d.ts.map +1 -1
  253. package/dist/pipeline.d.ts +4 -0
  254. package/dist/pipeline.d.ts.map +1 -1
  255. package/dist/pipeline.js +4 -0
  256. package/dist/pipeline.js.map +1 -1
  257. package/dist/pipelineAdapters.d.ts +1 -171
  258. package/dist/pipelineAdapters.d.ts.map +1 -1
  259. package/dist/pipelineAdapters.js +47 -1281
  260. package/dist/pipelineAdapters.js.map +1 -1
  261. package/dist/reporting/csvReportGenerator.d.ts.map +1 -1
  262. package/dist/reporting/csvReportGenerator.js +0 -6
  263. package/dist/reporting/csvReportGenerator.js.map +1 -1
  264. package/dist/reporting/htmlReportGenerator.d.ts.map +1 -1
  265. package/dist/reporting/htmlReportGenerator.js +0 -4
  266. package/dist/reporting/htmlReportGenerator.js.map +1 -1
  267. package/dist/reporting/jsonReportGenerator.d.ts.map +1 -1
  268. package/dist/reporting/jsonReportGenerator.js +0 -1
  269. package/dist/reporting/jsonReportGenerator.js.map +1 -1
  270. package/dist/reporting/sarifReportGenerator.d.ts.map +1 -1
  271. package/dist/reporting/sarifReportGenerator.js +0 -7
  272. package/dist/reporting/sarifReportGenerator.js.map +1 -1
  273. package/dist/services/auditJobService.d.ts +15 -0
  274. package/dist/services/auditJobService.d.ts.map +1 -1
  275. package/dist/services/auditJobService.js +15 -0
  276. package/dist/services/auditJobService.js.map +1 -1
  277. package/dist/services/projectTaskHelpers.d.ts +7 -0
  278. package/dist/services/projectTaskHelpers.d.ts.map +1 -1
  279. package/dist/services/projectTaskHelpers.js +7 -0
  280. package/dist/services/projectTaskHelpers.js.map +1 -1
  281. package/dist/services/whitelistService.d.ts +28 -0
  282. package/dist/services/whitelistService.d.ts.map +1 -1
  283. package/dist/services/whitelistService.js +28 -0
  284. package/dist/services/whitelistService.js.map +1 -1
  285. package/dist/sqlite/driver.d.ts +17 -1
  286. package/dist/sqlite/driver.d.ts.map +1 -1
  287. package/dist/sqlite/driver.js +28 -5
  288. package/dist/sqlite/driver.js.map +1 -1
  289. package/dist/styles/cssInJsHarvest.d.ts +36 -0
  290. package/dist/styles/cssInJsHarvest.d.ts.map +1 -0
  291. package/dist/styles/cssInJsHarvest.js +78 -0
  292. package/dist/styles/cssInJsHarvest.js.map +1 -0
  293. package/dist/styles/definedClasses.d.ts +95 -0
  294. package/dist/styles/definedClasses.d.ts.map +1 -0
  295. package/dist/styles/definedClasses.js +129 -0
  296. package/dist/styles/definedClasses.js.map +1 -0
  297. package/dist/styles/markupStyleHarvest.d.ts +33 -0
  298. package/dist/styles/markupStyleHarvest.d.ts.map +1 -0
  299. package/dist/styles/markupStyleHarvest.js +73 -0
  300. package/dist/styles/markupStyleHarvest.js.map +1 -0
  301. package/dist/styles/styleExtractor.d.ts +37 -0
  302. package/dist/styles/styleExtractor.d.ts.map +1 -1
  303. package/dist/styles/styleExtractor.js +89 -33
  304. package/dist/styles/styleExtractor.js.map +1 -1
  305. package/dist/styles/styleIndexer.d.ts.map +1 -1
  306. package/dist/styles/styleIndexer.js +11 -10
  307. package/dist/styles/styleIndexer.js.map +1 -1
  308. package/dist/styles/tailwindExpander.d.ts.map +1 -1
  309. package/dist/styles/tailwindExpander.js +31 -10
  310. package/dist/styles/tailwindExpander.js.map +1 -1
  311. package/dist/styles/tailwindUtilityExpander.d.ts +4 -0
  312. package/dist/styles/tailwindUtilityExpander.d.ts.map +1 -1
  313. package/dist/styles/tailwindUtilityExpander.js +4 -0
  314. package/dist/styles/tailwindUtilityExpander.js.map +1 -1
  315. package/dist/telemetry.d.ts +67 -1
  316. package/dist/telemetry.d.ts.map +1 -1
  317. package/dist/telemetry.js +100 -20
  318. package/dist/telemetry.js.map +1 -1
  319. package/dist/types/crossLanguage.d.ts +1 -0
  320. package/dist/types/crossLanguage.d.ts.map +1 -1
  321. package/dist/types.d.ts +73 -56
  322. package/dist/types.d.ts.map +1 -1
  323. package/dist/types.js +4 -4
  324. package/dist/types.js.map +1 -1
  325. package/dist/version.generated.d.ts +1 -1
  326. package/dist/version.generated.js +1 -1
  327. package/examples/.auditrc.example.json +7 -22
  328. package/examples/.auditrc.json +12 -155
  329. package/examples/.code-auditor.json +8 -51
  330. package/examples/nextjs.auditrc.json +7 -34
  331. package/examples/node-api.auditrc.json +6 -46
  332. package/examples/react.auditrc.json +8 -25
  333. package/examples/tolerant-solid.auditrc.json +12 -44
  334. package/package.json +8 -5
  335. package/plugin/.claude-plugin/manifest.json +10 -9
  336. package/plugin/.claude-plugin/plugin.json +1 -1
  337. package/plugin/hooks/hooks.json +4 -4
  338. package/plugin/scripts/hook-audit.sh +25 -10
  339. package/plugin/scripts/hook-common.sh +12 -7
  340. package/plugin/scripts/hook-drift-check.sh +10 -1
  341. package/plugin/scripts/hook-log-path.sh +7 -0
  342. package/plugin/scripts/hook-self-audit.sh +21 -6
  343. package/plugin/scripts/hook-warm.sh +17 -11
  344. package/plugin/skills/code-auditor/SKILL.md +26 -3
  345. package/server.json +2 -2
  346. package/dist/__tests__/fixtures/spec-20/scripts/tool.d.ts +0 -6
  347. package/dist/__tests__/fixtures/spec-20/scripts/tool.d.ts.map +0 -1
  348. package/dist/__tests__/fixtures/spec-20/scripts/tool.js +0 -12
  349. package/dist/__tests__/fixtures/spec-20/scripts/tool.js.map +0 -1
  350. package/dist/__tests__/fixtures/spec-20/src/demo-module.d.ts +0 -7
  351. package/dist/__tests__/fixtures/spec-20/src/demo-module.d.ts.map +0 -1
  352. package/dist/__tests__/fixtures/spec-20/src/demo-module.js +0 -13
  353. package/dist/__tests__/fixtures/spec-20/src/demo-module.js.map +0 -1
  354. package/dist/__tests__/fixtures/spec-52/item-01-prepare-in-loop.d.ts +0 -14
  355. package/dist/__tests__/fixtures/spec-52/item-01-prepare-in-loop.d.ts.map +0 -1
  356. package/dist/__tests__/fixtures/spec-52/item-01-prepare-in-loop.js +0 -16
  357. package/dist/__tests__/fixtures/spec-52/item-01-prepare-in-loop.js.map +0 -1
  358. package/dist/__tests__/fixtures/spec-52/item-02-prepare-bind-accumulate-batch.d.ts +0 -15
  359. package/dist/__tests__/fixtures/spec-52/item-02-prepare-bind-accumulate-batch.d.ts.map +0 -1
  360. package/dist/__tests__/fixtures/spec-52/item-02-prepare-bind-accumulate-batch.js +0 -17
  361. package/dist/__tests__/fixtures/spec-52/item-02-prepare-bind-accumulate-batch.js.map +0 -1
  362. package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.d.ts +0 -14
  363. package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.d.ts.map +0 -1
  364. package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.js +0 -19
  365. package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.js.map +0 -1
  366. package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.d.ts +0 -18
  367. package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.d.ts.map +0 -1
  368. package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.js +0 -19
  369. package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.js.map +0 -1
  370. package/dist/__tests__/fixtures/spec-52/item-05-upsert-forms.d.ts +0 -19
  371. package/dist/__tests__/fixtures/spec-52/item-05-upsert-forms.d.ts.map +0 -1
  372. package/dist/__tests__/fixtures/spec-52/item-05-upsert-forms.js +0 -19
  373. package/dist/__tests__/fixtures/spec-52/item-05-upsert-forms.js.map +0 -1
  374. package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.d.ts +0 -17
  375. package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.d.ts.map +0 -1
  376. package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.js +0 -19
  377. package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.js.map +0 -1
  378. package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.d.ts +0 -25
  379. package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.d.ts.map +0 -1
  380. package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.js +0 -21
  381. package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.js.map +0 -1
  382. package/dist/__tests__/fixtures/spec-52/item-08-promise-all-of-statements-in-loop.d.ts +0 -15
  383. package/dist/__tests__/fixtures/spec-52/item-08-promise-all-of-statements-in-loop.d.ts.map +0 -1
  384. package/dist/__tests__/fixtures/spec-52/item-08-promise-all-of-statements-in-loop.js +0 -19
  385. package/dist/__tests__/fixtures/spec-52/item-08-promise-all-of-statements-in-loop.js.map +0 -1
  386. package/dist/__tests__/fixtures/spec-52/item-09-promise-all-map-of-statements-in-loop.d.ts +0 -14
  387. package/dist/__tests__/fixtures/spec-52/item-09-promise-all-map-of-statements-in-loop.d.ts.map +0 -1
  388. package/dist/__tests__/fixtures/spec-52/item-09-promise-all-map-of-statements-in-loop.js +0 -14
  389. package/dist/__tests__/fixtures/spec-52/item-09-promise-all-map-of-statements-in-loop.js.map +0 -1
  390. package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.d.ts +0 -15
  391. package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.d.ts.map +0 -1
  392. package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.js +0 -16
  393. package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.js.map +0 -1
  394. package/dist/languages/go/analyzer-darwin-amd64 +0 -0
  395. package/dist/languages/go/analyzer-darwin-arm64 +0 -0
  396. package/dist/languages/go/analyzer-linux-amd64 +0 -0
  397. package/dist/languages/go/analyzer-linux-arm64 +0 -0
  398. package/dist/languages/go/analyzer-src/analyzer.go +0 -643
  399. package/dist/languages/go/analyzer-src/dataaccess.go +0 -388
  400. package/dist/languages/go/analyzer-src/go.mod +0 -3
  401. package/dist/languages/go/analyzer-src/indexer.go +0 -268
  402. package/dist/languages/go/analyzer-src/parser.go +0 -461
  403. package/dist/languages/go/analyzer-src/solid.go +0 -311
  404. package/dist/languages/go/analyzer-src/testconventions.go +0 -25
  405. package/dist/languages/go/analyzer-src/types.go +0 -156
  406. package/dist/languages/go/analyzer-windows-amd64.exe +0 -0
  407. package/dist/languages/go/go.mod +0 -7
  408. package/dist/languages/go/main.go +0 -203
  409. package/dist/native/ast-grep-napi.darwin-arm64.node +0 -0
  410. package/dist/native/ast-grep-napi.darwin-x64.node +0 -0
  411. package/dist/native/ast-grep-napi.linux-arm64-gnu.node +0 -0
  412. package/dist/native/ast-grep-napi.linux-arm64-musl.node +0 -0
  413. package/dist/native/ast-grep-napi.linux-x64-gnu.node +0 -0
  414. package/dist/native/ast-grep-napi.linux-x64-musl.node +0 -0
  415. package/dist/native/ast-grep-napi.win32-x64-msvc.node +0 -0
  416. package/dist/native-bootstrap.d.ts +0 -15
  417. package/dist/native-bootstrap.d.ts.map +0 -1
  418. package/dist/native-bootstrap.js +0 -75
  419. package/dist/native-bootstrap.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Default configurations for the code auditor
3
3
  */
4
- import { AuditConfig, PathProfile } from '../types.js';
4
+ import { AuditConfig, ChurnConfig, PathProfile } from '../types.js';
5
5
  /**
6
6
  * Get default configuration
7
7
  *
@@ -22,6 +22,120 @@ export declare function getProjectTypeDefaults(projectType: string): Partial<Aud
22
22
  * @returns Environment-specific defaults, or an empty object when unknown.
23
23
  */
24
24
  export declare function getEnvironmentDefaults(env: string): Partial<AuditConfig>;
25
+ /**
26
+ * The value-drift colour threshold — the single source of truth for the
27
+ * `styles.colorDeltaE` config key (Spec 70 colour directive, item 2). The phase
28
+ * rule (`src/phase/rules/styles.ts`) and the legacy analyzer
29
+ * (`src/analyzers/universal/UniversalStylesAnalyzer.ts`) both read this symbol;
30
+ * the literal must not be re-declared elsewhere.
31
+ *
32
+ * `1.0` is the CIEDE2000 (ΔE00) just-noticeable difference. The CIEDE2000
33
+ * formula (Sharma, Wu & Dalal 2005, "The CIEDE2000 color-difference formula:
34
+ * Implementation notes, supplementary test data, and mathematical observations",
35
+ * Color Research & Application 30(1):21–30, doi:10.1002/col.20070; standardised
36
+ * as CIE 142-2001 / ISO/CIE 11664-6) is normalised so ΔE00 = 1.0 is the
37
+ * threshold of human perception: pairs with ΔE00 < 1.0 are perceptually
38
+ * indistinguishable ("near-identical") — exactly the drift the rule flags. The
39
+ * metric changed ΔE76 → ΔE00 in Spec 70 colour directive item 4; the prior ΔE76
40
+ * default of 2.5 was "JND-adjacent" to the ~2.3 ΔE76 JND with no written
41
+ * citation and does not transfer, because the ΔE00 JND is 1.0, not 2.3.
42
+ */
43
+ export declare const DEFAULT_COLOR_DELTA_E = 1;
44
+ /**
45
+ * The validator-package vocabulary — the single source of truth for which npm
46
+ * packages mark an imported identifier as validator-provenanced. Consumed by
47
+ * three sites (Spec 21 R4 / R3 cross-domain validator-bypass):
48
+ * - `buildProvenanceContext` (`src/analyzers/provenance.ts`) — the
49
+ * `validatorProvenanced` map the schema/data-access analyzers and the
50
+ * CLI `map` command read;
51
+ * - the migrated `cross-domain/no-validator-reachable` rule
52
+ * (`src/phase/rules/crossDomain.ts`);
53
+ * - the legacy `CrossDomainAnalyzer` (kept for the Spec 68 parity guard).
54
+ *
55
+ * This replaced the hand-maintained `VALIDATOR_PACKAGES` `ReadonlySet` that
56
+ * lived in `provenance.ts` and did the job of the deleted `validatorPackageList`
57
+ * config key. The list must not be re-declared elsewhere: consumers read the
58
+ * config key and fall back to this symbol (the `DEFAULT_COLOR_DELTA_E` pattern).
59
+ */
60
+ export declare const DEFAULT_VALIDATOR_PACKAGES: readonly string[];
61
+ /**
62
+ * The git-churn lookback window — the single source of truth for the top-level
63
+ * `churn` config key (Spec 13 R1). The churn extractor
64
+ * (`src/churn/churnExtractor.ts`) reads `churnWindowMonths` from here instead of
65
+ * hardcoding `12`; the two extraction call sites (`deepSync` in
66
+ * `src/codeIndexDB.ts` and the CLI `hotspots` command in `src/cli.ts`) read the
67
+ * configured `churn` key and fall back to this symbol (the `DEFAULT_COLOR_DELTA_E`
68
+ * pattern). The literal must not be re-declared elsewhere.
69
+ *
70
+ * `12` months is the window `git log --since` scans for file/function churn.
71
+ */
72
+ export declare const DEFAULT_CHURN_CONFIG: ChurnConfig;
73
+ /**
74
+ * The health-score pass/fail floor — the single source of truth for the
75
+ * `audit.health` (`mcp.ts`) and `audit_health` (`mcp-tools-shared.ts`) MCP
76
+ * tools' `threshold` parameter default. `calculateHealthScore` returns a 0-100
77
+ * score; below this floor a codebase reports `needs-attention`. Read by both
78
+ * tool-definition `default` fields and both handler fallbacks; the literal must
79
+ * not be re-declared elsewhere (the `DEFAULT_COLOR_DELTA_E` pattern).
80
+ *
81
+ * `70` is the cut below which `audit.health` reports `needs-attention`.
82
+ */
83
+ export declare const DEFAULT_HEALTH_SCORE_THRESHOLD = 70;
84
+ /**
85
+ * Resolve the health-score floor for one call. Precedence: the MCP `threshold`
86
+ * argument, then the configured `thresholds.minHealthScore` (read from
87
+ * `.codeauditor.json` by `loadMinHealthScore`), then the single default above.
88
+ * This is the one place the fallback is computed, so both MCP surfaces move
89
+ * together when the default changes. The `||` (not `??`) mirrors the historical
90
+ * fallback: a `0` threshold (always-pass) was — and remains — indistinguishable
91
+ * from "unset".
92
+ *
93
+ * @param args the MCP tool arguments carrying an optional `threshold` override
94
+ * @param configMin the configured `thresholds.minHealthScore` floor (if any)
95
+ * @returns the resolved floor, never below the single default above
96
+ */
97
+ export declare function resolveHealthThreshold(args?: {
98
+ threshold?: number;
99
+ }, configMin?: number): number;
100
+ /**
101
+ * The blocking gate's deterministic-work budget — the single source of truth for
102
+ * `gateBudgetResolutions()` (Directive J). The gate (`code-audit changed`) used to
103
+ * be budgeted in CPU time (`auditCpuMs` < 900 ms); CPU time is load-dependent, so
104
+ * the gate jittered under sustained load. Directive J re-expresses the budget over
105
+ * a deterministic quantity instead — the number of distinct receiver resolutions
106
+ * the phase pipeline performed (`receiverResolutions`, the `handleVerdictCache`
107
+ * size after the pass). A fixed file folds `identifyHandle` a fixed number of
108
+ * times regardless of machine load, so a regression moves this count
109
+ * deterministically, where CPU time only jittered.
110
+ *
111
+ * MEASURED against `src/analyzers/universal/UniversalSOLIDAnalyzer.ts`, never
112
+ * carried over: re-measured each re-baseline with the architectural reason
113
+ * recorded. The deterministic count is `handleVerdictCache.size` for that file:
114
+ * 77 on every warm run (5/5 runs, zero jitter). 100 = ~30% headroom over the
115
+ * measured 77, matching the headroom discipline of the two prior CPU re-baselines.
116
+ * The headroom is NOT for jitter (there is none) — it is room for legitimate
117
+ * single-site growth before the tripwire fires; a real regression moves the count
118
+ * by 2–5×, far past 100.
119
+ *
120
+ * Formerly `src/gateBudget.ts`; moved here (Directive J correction 3) to sit
121
+ * alongside the other defaults rather than in a one-constant module.
122
+ */
123
+ export declare const DEFAULT_GATE_BUDGET_RESOLUTIONS = 100;
124
+ /**
125
+ * The env override for the gate budget, or the default. The override accepts any
126
+ * integer ≥ 0 (0 is the liveness knob, not "unset"); a non-numeric or negative
127
+ * value falls back to the default rather than tripping the gate spuriously.
128
+ *
129
+ * This is the one place `CODE_AUDITOR_GATE_BUDGET_RESOLUTIONS` is read (the
130
+ * `env-tunable single-source` pattern): both `cli.ts:856` (the `gate work: …
131
+ * (budget N)` display line) and the `verify:gate-budget` verifier read this one
132
+ * resolved value — the verifier parses it out of the CLI line, so the CLI is the
133
+ * single source and the verifier can never drift from it.
134
+ *
135
+ * @returns the resolved gate budget — the non-negative numeric override when
136
+ * set, otherwise {@link DEFAULT_GATE_BUDGET_RESOLUTIONS}.
137
+ */
138
+ export declare function gateBudgetResolutions(): number;
25
139
  /**
26
140
  * Default analyzer configurations
27
141
  */
@@ -30,8 +144,6 @@ export declare const DEFAULT_ANALYZER_CONFIGS: {
30
144
  maxMethodsPerClass: number;
31
145
  maxLinesPerMethod: number;
32
146
  maxParametersPerMethod: number;
33
- maxImportsPerFile: number;
34
- maxComplexity: number;
35
147
  maxInterfaceMembers: number;
36
148
  maxMethodComplexity: number;
37
149
  classMethodsThreshold: number;
@@ -45,28 +157,14 @@ export declare const DEFAULT_ANALYZER_CONFIGS: {
45
157
  checkStrings: boolean;
46
158
  ignoreComments: boolean;
47
159
  ignoreWhitespace: boolean;
48
- checkStructuralSimilarity: boolean;
49
160
  checkExpressionSimilarity: boolean;
50
161
  minShapeNames: number;
51
162
  divergence: {
52
163
  divergenceThreshold: number;
53
164
  divergenceRuns: number;
54
- minPairSimilarity: number;
55
165
  };
56
166
  };
57
167
  dataAccess: {
58
- databasePatterns: {
59
- postgres: string[];
60
- mysql: string[];
61
- mongodb: string[];
62
- };
63
- securityPatterns: {
64
- parameterizedQueries: string[];
65
- };
66
- performanceThresholds: {
67
- maxJoins: number;
68
- warnOnSelectStar: boolean;
69
- };
70
168
  detection: {
71
169
  mode: "hybrid";
72
170
  };
@@ -88,7 +186,6 @@ export declare const DEFAULT_ANALYZER_CONFIGS: {
88
186
  enableTableUsageTracking: boolean;
89
187
  checkMissingReferences: boolean;
90
188
  checkNamingConventions: boolean;
91
- detectUnusedTables: boolean;
92
189
  validateQueryPatterns: boolean;
93
190
  reportUnresolvedQueries: boolean;
94
191
  maxQueriesPerFunction: number;
@@ -100,7 +197,6 @@ export declare const DEFAULT_ANALYZER_CONFIGS: {
100
197
  detection: {
101
198
  mode: "hybrid";
102
199
  };
103
- validatorPackageList: string[];
104
200
  tableSources: {
105
201
  kind: string;
106
202
  name: string;
@@ -133,6 +229,7 @@ export declare const DEFAULT_ANALYZER_CONFIGS: {
133
229
  };
134
230
  validatorBypass: {
135
231
  validators: never[];
232
+ validatorPackageList: readonly string[];
136
233
  modeShare: number;
137
234
  minCorpus: number;
138
235
  depth: number;
@@ -145,33 +242,30 @@ export declare const DEFAULT_ANALYZER_CONFIGS: {
145
242
  };
146
243
  };
147
244
  /**
148
- * Built-in path profiles shipped with the tool.
149
- *
150
- * "scripts-and-tests" excludes scripts, tests, and test fixtures from the
151
- * blocking gate (Spec 36 R4) — grounded in the Spec 11 triage numbers showing
152
- * these directories produce noise, not signal. Findings still report at their
153
- * real severity; the gate simply does not block on them. This replaced the
154
- * `severityCap` soften-in-place mechanism, which made findings invisible by
155
- * capping them to "suggestion".
156
- *
157
- * Disable entirely via `"builtin": false` in .codeauditor.json.
158
- * Replace a specific built-in via a user profile with the same name
159
- * and `"builtin": false`.
160
- */
161
- export declare const BUILTIN_PATH_PROFILES: PathProfile[];
162
- /**
163
- * Merge built-in path profiles with user-configured profiles.
245
+ * No built-in path profiles ship with the tool. The "scripts-and-tests" profile
246
+ * that excluded scripts, tests, and fixtures from the blocking gate (Spec 36 R4)
247
+ * is removed: a compiled-in glob list that marks `gateExcluded: true` is a
248
+ * hand-maintained exemption list baked into the binary — the same defect as a
249
+ * suppression file, just shipped instead of written per project. A script with a
250
+ * hardcoded connection string or a fixture with dynamic SQL gates like any other
251
+ * file; teams that want an opt-out declare it explicitly in their own
252
+ * `.codeauditor.json` as a user path profile.
164
253
  *
165
- * - `builtin: false` at top level → no built-ins
166
- * - User profile with `builtin: false` → replaces built-in of same name
167
- * - Otherwise: built-ins come first, user profiles appended after
168
- * (later wins on conflict)
254
+ * There is therefore no built-in/user merge to perform, and the `builtin` config
255
+ * key that once selected a built-in profile is inert — it is still accepted (so
256
+ * a config that sets `builtin: false` validates and behaves as before) but it
257
+ * selects nothing, because there is nothing to select. The `BUILTIN_PATH_PROFILES`
258
+ * list and the built-in name-replacement machinery are deleted rather than left
259
+ * as an empty seam: an empty list invites the neighbouring reading "there are
260
+ * built-ins, there just happen to be zero today", when the truth is the
261
+ * mechanism itself is gone.
169
262
  *
170
- * @param userProfiles The user-configured path profiles to merge.
171
- * @param builtinEnabled Whether the built-in profiles are enabled (false disables all).
172
- * @returns The merged profile array, or undefined if no profiles active
263
+ * @param userProfiles The user-configured path profiles to pass through.
264
+ * @param _builtinEnabled Inert — no built-in profile ships; retained only so a
265
+ * config that sets `builtin: false` validates and behaves as before.
266
+ * @returns The user profiles when non-empty, otherwise undefined.
173
267
  */
174
- export declare function mergePathProfiles(userProfiles: PathProfile[] | undefined, builtinEnabled: boolean | undefined): PathProfile[] | undefined;
268
+ export declare function mergePathProfiles(userProfiles: PathProfile[] | undefined, _builtinEnabled: boolean | undefined): PathProfile[] | undefined;
175
269
  /**
176
270
  * Default code index configuration
177
271
  */
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEvD;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,WAAW,CAyC9C;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CA8BhF;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAuBxE;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyMpC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,EAAE,WAAW,EAqB9C,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,WAAW,EAAE,GAAG,SAAS,EACvC,cAAc,EAAE,OAAO,GAAG,SAAS,GAClC,WAAW,EAAE,GAAG,SAAS,CAqB3B;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;CAQrC,CAAC"}
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEpE;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,WAAW,CA0C9C;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CA8BhF;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAkBxE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,qBAAqB,IAAM,CAAC;AAEzC;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,0BAA0B,EAAE,SAAS,MAAM,EAUvD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAElC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,8BAA8B,KAAK,CAAC;AAEjD;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,EAC7B,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAER;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,+BAA+B,MAAM,CAAC;AAEnD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAO9C;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkLpC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,WAAW,EAAE,GAAG,SAAS,EACvC,eAAe,EAAE,OAAO,GAAG,SAAS,GACnC,WAAW,EAAE,GAAG,SAAS,CAE3B;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;CAQrC,CAAC"}
@@ -24,22 +24,23 @@ export function getDefaultConfig() {
24
24
  '**/*.test.{ts,tsx,js,jsx}',
25
25
  '**/*.spec.{ts,tsx,js,jsx}'
26
26
  ],
27
- // Note: no `outputFormats`/`outputDirectory` default. Reports are written
28
- // only to an explicit CLI `--output` path (or stdout); a config default here
29
- // would advertise a key that `print-config` then shows and the loader then
30
- // refuses/ignores. See configLoader.ts `output-directory-refused`.
27
+ // Note: no `outputDirectory` default. Reports are written only to an explicit
28
+ // CLI `--output` path (or stdout); a config default here would advertise a key
29
+ // that `print-config` then shows and the loader then refuses. See
30
+ // configLoader.ts `output-directory-refused`.
31
31
  minSeverity: 'high',
32
- failOnCritical: false,
33
- showProgress: true,
34
- thresholds: {
35
- maxCritical: 0,
36
- maxSevere: 100,
37
- minHealthScore: 75
38
- },
32
+ // Spec 11 sweep follow-up — the health-score floor, single-sourced to
33
+ // DEFAULT_HEALTH_SCORE_THRESHOLD (referenced, not re-declared). The removed
34
+ // `maxSevere`/`maxCritical`/`maxHigh` siblings are gone for good.
35
+ thresholds: { minHealthScore: DEFAULT_HEALTH_SCORE_THRESHOLD },
39
36
  // Spec 54 R3 — severity is urgency, not permission. There is no
40
37
  // `severityOverrides` and no `gateSeverities`: every rule is assigned on the
41
38
  // urgency axis (critical/severe/high) and every finding blocks. Per-rule
42
39
  // severity tuning disappeared with the old vocabulary.
40
+ // Spec 13 R1 — churn lookback window. The single default lives in
41
+ // DEFAULT_CHURN_CONFIG above; referencing it here (not re-declaring) is what
42
+ // keeps `loadConfig` and `print-config` honest about the effective value.
43
+ churn: DEFAULT_CHURN_CONFIG,
43
44
  // Spec 50 R5 — daemon lifecycle. Never auto-start (a background process the
44
45
  // user did not ask for); idle-exit after 5 minutes so it does not linger.
45
46
  daemon: {
@@ -91,31 +92,157 @@ export function getProjectTypeDefaults(projectType) {
91
92
  export function getEnvironmentDefaults(env) {
92
93
  switch (env) {
93
94
  case 'ci':
94
- return {
95
- failOnCritical: true,
96
- showProgress: false
97
- };
95
+ return {};
98
96
  case 'development':
99
97
  return {
100
- showProgress: true,
101
98
  minSeverity: 'high'
102
99
  };
103
100
  case 'production':
104
101
  return {
105
- minSeverity: 'severe',
106
- failOnCritical: true
102
+ minSeverity: 'severe'
107
103
  };
108
104
  default:
109
105
  return {};
110
106
  }
111
107
  }
108
+ /**
109
+ * The value-drift colour threshold — the single source of truth for the
110
+ * `styles.colorDeltaE` config key (Spec 70 colour directive, item 2). The phase
111
+ * rule (`src/phase/rules/styles.ts`) and the legacy analyzer
112
+ * (`src/analyzers/universal/UniversalStylesAnalyzer.ts`) both read this symbol;
113
+ * the literal must not be re-declared elsewhere.
114
+ *
115
+ * `1.0` is the CIEDE2000 (ΔE00) just-noticeable difference. The CIEDE2000
116
+ * formula (Sharma, Wu & Dalal 2005, "The CIEDE2000 color-difference formula:
117
+ * Implementation notes, supplementary test data, and mathematical observations",
118
+ * Color Research & Application 30(1):21–30, doi:10.1002/col.20070; standardised
119
+ * as CIE 142-2001 / ISO/CIE 11664-6) is normalised so ΔE00 = 1.0 is the
120
+ * threshold of human perception: pairs with ΔE00 < 1.0 are perceptually
121
+ * indistinguishable ("near-identical") — exactly the drift the rule flags. The
122
+ * metric changed ΔE76 → ΔE00 in Spec 70 colour directive item 4; the prior ΔE76
123
+ * default of 2.5 was "JND-adjacent" to the ~2.3 ΔE76 JND with no written
124
+ * citation and does not transfer, because the ΔE00 JND is 1.0, not 2.3.
125
+ */
126
+ export const DEFAULT_COLOR_DELTA_E = 1.0;
127
+ /**
128
+ * The validator-package vocabulary — the single source of truth for which npm
129
+ * packages mark an imported identifier as validator-provenanced. Consumed by
130
+ * three sites (Spec 21 R4 / R3 cross-domain validator-bypass):
131
+ * - `buildProvenanceContext` (`src/analyzers/provenance.ts`) — the
132
+ * `validatorProvenanced` map the schema/data-access analyzers and the
133
+ * CLI `map` command read;
134
+ * - the migrated `cross-domain/no-validator-reachable` rule
135
+ * (`src/phase/rules/crossDomain.ts`);
136
+ * - the legacy `CrossDomainAnalyzer` (kept for the Spec 68 parity guard).
137
+ *
138
+ * This replaced the hand-maintained `VALIDATOR_PACKAGES` `ReadonlySet` that
139
+ * lived in `provenance.ts` and did the job of the deleted `validatorPackageList`
140
+ * config key. The list must not be re-declared elsewhere: consumers read the
141
+ * config key and fall back to this symbol (the `DEFAULT_COLOR_DELTA_E` pattern).
142
+ */
143
+ export const DEFAULT_VALIDATOR_PACKAGES = [
144
+ 'zod',
145
+ 'joi',
146
+ 'ajv',
147
+ 'valibot',
148
+ 'yup',
149
+ 'superstruct',
150
+ 'arktype',
151
+ '@sinclair/typebox',
152
+ 'class-validator',
153
+ ];
154
+ /**
155
+ * The git-churn lookback window — the single source of truth for the top-level
156
+ * `churn` config key (Spec 13 R1). The churn extractor
157
+ * (`src/churn/churnExtractor.ts`) reads `churnWindowMonths` from here instead of
158
+ * hardcoding `12`; the two extraction call sites (`deepSync` in
159
+ * `src/codeIndexDB.ts` and the CLI `hotspots` command in `src/cli.ts`) read the
160
+ * configured `churn` key and fall back to this symbol (the `DEFAULT_COLOR_DELTA_E`
161
+ * pattern). The literal must not be re-declared elsewhere.
162
+ *
163
+ * `12` months is the window `git log --since` scans for file/function churn.
164
+ */
165
+ export const DEFAULT_CHURN_CONFIG = {
166
+ churnWindowMonths: 12,
167
+ };
168
+ /**
169
+ * The health-score pass/fail floor — the single source of truth for the
170
+ * `audit.health` (`mcp.ts`) and `audit_health` (`mcp-tools-shared.ts`) MCP
171
+ * tools' `threshold` parameter default. `calculateHealthScore` returns a 0-100
172
+ * score; below this floor a codebase reports `needs-attention`. Read by both
173
+ * tool-definition `default` fields and both handler fallbacks; the literal must
174
+ * not be re-declared elsewhere (the `DEFAULT_COLOR_DELTA_E` pattern).
175
+ *
176
+ * `70` is the cut below which `audit.health` reports `needs-attention`.
177
+ */
178
+ export const DEFAULT_HEALTH_SCORE_THRESHOLD = 70;
179
+ /**
180
+ * Resolve the health-score floor for one call. Precedence: the MCP `threshold`
181
+ * argument, then the configured `thresholds.minHealthScore` (read from
182
+ * `.codeauditor.json` by `loadMinHealthScore`), then the single default above.
183
+ * This is the one place the fallback is computed, so both MCP surfaces move
184
+ * together when the default changes. The `||` (not `??`) mirrors the historical
185
+ * fallback: a `0` threshold (always-pass) was — and remains — indistinguishable
186
+ * from "unset".
187
+ *
188
+ * @param args the MCP tool arguments carrying an optional `threshold` override
189
+ * @param configMin the configured `thresholds.minHealthScore` floor (if any)
190
+ * @returns the resolved floor, never below the single default above
191
+ */
192
+ export function resolveHealthThreshold(args, configMin) {
193
+ return args?.threshold || configMin || DEFAULT_HEALTH_SCORE_THRESHOLD;
194
+ }
195
+ /**
196
+ * The blocking gate's deterministic-work budget — the single source of truth for
197
+ * `gateBudgetResolutions()` (Directive J). The gate (`code-audit changed`) used to
198
+ * be budgeted in CPU time (`auditCpuMs` < 900 ms); CPU time is load-dependent, so
199
+ * the gate jittered under sustained load. Directive J re-expresses the budget over
200
+ * a deterministic quantity instead — the number of distinct receiver resolutions
201
+ * the phase pipeline performed (`receiverResolutions`, the `handleVerdictCache`
202
+ * size after the pass). A fixed file folds `identifyHandle` a fixed number of
203
+ * times regardless of machine load, so a regression moves this count
204
+ * deterministically, where CPU time only jittered.
205
+ *
206
+ * MEASURED against `src/analyzers/universal/UniversalSOLIDAnalyzer.ts`, never
207
+ * carried over: re-measured each re-baseline with the architectural reason
208
+ * recorded. The deterministic count is `handleVerdictCache.size` for that file:
209
+ * 77 on every warm run (5/5 runs, zero jitter). 100 = ~30% headroom over the
210
+ * measured 77, matching the headroom discipline of the two prior CPU re-baselines.
211
+ * The headroom is NOT for jitter (there is none) — it is room for legitimate
212
+ * single-site growth before the tripwire fires; a real regression moves the count
213
+ * by 2–5×, far past 100.
214
+ *
215
+ * Formerly `src/gateBudget.ts`; moved here (Directive J correction 3) to sit
216
+ * alongside the other defaults rather than in a one-constant module.
217
+ */
218
+ export const DEFAULT_GATE_BUDGET_RESOLUTIONS = 100;
219
+ /**
220
+ * The env override for the gate budget, or the default. The override accepts any
221
+ * integer ≥ 0 (0 is the liveness knob, not "unset"); a non-numeric or negative
222
+ * value falls back to the default rather than tripping the gate spuriously.
223
+ *
224
+ * This is the one place `CODE_AUDITOR_GATE_BUDGET_RESOLUTIONS` is read (the
225
+ * `env-tunable single-source` pattern): both `cli.ts:856` (the `gate work: …
226
+ * (budget N)` display line) and the `verify:gate-budget` verifier read this one
227
+ * resolved value — the verifier parses it out of the CLI line, so the CLI is the
228
+ * single source and the verifier can never drift from it.
229
+ *
230
+ * @returns the resolved gate budget — the non-negative numeric override when
231
+ * set, otherwise {@link DEFAULT_GATE_BUDGET_RESOLUTIONS}.
232
+ */
233
+ export function gateBudgetResolutions() {
234
+ const raw = process.env.CODE_AUDITOR_GATE_BUDGET_RESOLUTIONS;
235
+ if (raw !== undefined && raw !== '') {
236
+ const n = Number(raw);
237
+ if (Number.isFinite(n) && n >= 0)
238
+ return n;
239
+ }
240
+ return DEFAULT_GATE_BUDGET_RESOLUTIONS;
241
+ }
112
242
  /**
113
243
  * Default analyzer configurations
114
244
  */
115
245
  export const DEFAULT_ANALYZER_CONFIGS = {
116
- // Spec-17 R5: maxComplexity (old heuristic) deprecated; use maxMethodComplexity
117
- // and classAggregateComplexity for true cyclomatic complexity.
118
- //
119
246
  // AUTHORITATIVE source is DEFAULT_SOLID_CONFIG (UniversalSOLIDAnalyzer.ts) —
120
247
  // the pipeline and `--print-config` resolve from there (RUNTIME_DEFAULT_CONFIGS),
121
248
  // NOT from this copy. This namespace is exported from the library (`src/index.ts`)
@@ -126,8 +253,6 @@ export const DEFAULT_ANALYZER_CONFIGS = {
126
253
  maxMethodsPerClass: 20,
127
254
  maxLinesPerMethod: 200,
128
255
  maxParametersPerMethod: 6,
129
- maxImportsPerFile: 5, // Spec 11 R3 sweep: 20 → 5 (precision-first)
130
- maxComplexity: 10, // DEPRECATED — old heuristic
131
256
  maxInterfaceMembers: 25,
132
257
  // R5.1: Per-method cyclomatic complexity threshold (true McCC)
133
258
  maxMethodComplexity: 50,
@@ -156,7 +281,6 @@ export const DEFAULT_ANALYZER_CONFIGS = {
156
281
  checkStrings: false,
157
282
  ignoreComments: true,
158
283
  ignoreWhitespace: true,
159
- checkStructuralSimilarity: false,
160
284
  checkExpressionSimilarity: true,
161
285
  minShapeNames: 4,
162
286
  // Spec 13 R5 — Diverging-clone detection. The pipeline reads this from the
@@ -165,22 +289,9 @@ export const DEFAULT_ANALYZER_CONFIGS = {
165
289
  divergence: {
166
290
  divergenceThreshold: 0.05,
167
291
  divergenceRuns: 2,
168
- minPairSimilarity: 0.5,
169
292
  },
170
293
  },
171
294
  dataAccess: {
172
- databasePatterns: {
173
- postgres: ['pg', 'postgres', 'postgresql'],
174
- mysql: ['mysql', 'mysql2'],
175
- mongodb: ['mongodb', 'mongoose']
176
- },
177
- securityPatterns: {
178
- parameterizedQueries: ['?', '$1', ':param'],
179
- },
180
- performanceThresholds: {
181
- maxJoins: 5,
182
- warnOnSelectStar: true
183
- },
184
295
  // Spec 21 R3: shared detection mode — provenance-primary with name-fallback
185
296
  detection: {
186
297
  mode: 'hybrid',
@@ -230,7 +341,6 @@ export const DEFAULT_ANALYZER_CONFIGS = {
230
341
  enableTableUsageTracking: true,
231
342
  checkMissingReferences: true,
232
343
  checkNamingConventions: true,
233
- detectUnusedTables: false,
234
344
  validateQueryPatterns: true,
235
345
  reportUnresolvedQueries: true,
236
346
  maxQueriesPerFunction: 1, // Spec 11 R3 sweep: 5 → 1 (precision-first)
@@ -243,11 +353,6 @@ export const DEFAULT_ANALYZER_CONFIGS = {
243
353
  detection: {
244
354
  mode: 'hybrid',
245
355
  },
246
- // Spec 21 R4: validator package list for provenanced validator detection
247
- validatorPackageList: [
248
- 'zod', 'joi', 'ajv', 'valibot', 'yup', 'superstruct', 'arktype',
249
- '@sinclair/typebox', 'class-validator',
250
- ],
251
356
  // Spec 29: Declarative table-source registry — Tier 2 (ORM detection).
252
357
  // Adding an ORM becomes a config entry, not code.
253
358
  tableSources: [
@@ -258,7 +363,7 @@ export const DEFAULT_ANALYZER_CONFIGS = {
258
363
  },
259
364
  // Spec 10 R3: style intelligence analyzer defaults
260
365
  styles: {
261
- colorDeltaE: 2.5,
366
+ colorDeltaE: DEFAULT_COLOR_DELTA_E,
262
367
  scaleProperties: [
263
368
  'margin', 'margin-top', 'margin-right', 'margin-bottom', 'margin-left',
264
369
  'padding', 'padding-top', 'padding-right', 'padding-bottom', 'padding-left',
@@ -294,6 +399,9 @@ export const DEFAULT_ANALYZER_CONFIGS = {
294
399
  },
295
400
  validatorBypass: {
296
401
  validators: [],
402
+ // The package vocabulary for provenanced-validator detection (Spec 21 R4).
403
+ // Overridable via `analyzerConfigs["cross-domain"].validatorBypass.validatorPackageList`.
404
+ validatorPackageList: DEFAULT_VALIDATOR_PACKAGES,
297
405
  modeShare: 0.8,
298
406
  minCorpus: 20,
299
407
  depth: 3,
@@ -306,66 +414,31 @@ export const DEFAULT_ANALYZER_CONFIGS = {
306
414
  },
307
415
  };
308
416
  /**
309
- * Built-in path profiles shipped with the tool.
417
+ * No built-in path profiles ship with the tool. The "scripts-and-tests" profile
418
+ * that excluded scripts, tests, and fixtures from the blocking gate (Spec 36 R4)
419
+ * is removed: a compiled-in glob list that marks `gateExcluded: true` is a
420
+ * hand-maintained exemption list baked into the binary — the same defect as a
421
+ * suppression file, just shipped instead of written per project. A script with a
422
+ * hardcoded connection string or a fixture with dynamic SQL gates like any other
423
+ * file; teams that want an opt-out declare it explicitly in their own
424
+ * `.codeauditor.json` as a user path profile.
310
425
  *
311
- * "scripts-and-tests" excludes scripts, tests, and test fixtures from the
312
- * blocking gate (Spec 36 R4) — grounded in the Spec 11 triage numbers showing
313
- * these directories produce noise, not signal. Findings still report at their
314
- * real severity; the gate simply does not block on them. This replaced the
315
- * `severityCap` soften-in-place mechanism, which made findings invisible by
316
- * capping them to "suggestion".
426
+ * There is therefore no built-in/user merge to perform, and the `builtin` config
427
+ * key that once selected a built-in profile is inert — it is still accepted (so
428
+ * a config that sets `builtin: false` validates and behaves as before) but it
429
+ * selects nothing, because there is nothing to select. The `BUILTIN_PATH_PROFILES`
430
+ * list and the built-in name-replacement machinery are deleted rather than left
431
+ * as an empty seam: an empty list invites the neighbouring reading "there are
432
+ * built-ins, there just happen to be zero today", when the truth is the
433
+ * mechanism itself is gone.
317
434
  *
318
- * Disable entirely via `"builtin": false` in .codeauditor.json.
319
- * Replace a specific built-in via a user profile with the same name
320
- * and `"builtin": false`.
435
+ * @param userProfiles The user-configured path profiles to pass through.
436
+ * @param _builtinEnabled Inert — no built-in profile ships; retained only so a
437
+ * config that sets `builtin: false` validates and behaves as before.
438
+ * @returns The user profiles when non-empty, otherwise undefined.
321
439
  */
322
- export const BUILTIN_PATH_PROFILES = [
323
- {
324
- name: 'scripts-and-tests',
325
- paths: [
326
- 'scripts/**',
327
- 'tests/**',
328
- 'test/**',
329
- '__tests__/**',
330
- 'fixtures/**',
331
- // Type-test suites use their own directory and extension conventions.
332
- // They exercise types, not behavior — a hardcoded connection string or
333
- // dynamic SQL in a `.test-d.ts`/`.tst.ts` file is the file doing its job.
334
- 'test-tsd/**',
335
- 'test-tstyche/**',
336
- '**/*.test-d.ts',
337
- '**/*.tst.ts',
338
- '*.test.*',
339
- '*.spec.*',
340
- ],
341
- overrides: { excludeFromGate: true },
342
- },
343
- ];
344
- /**
345
- * Merge built-in path profiles with user-configured profiles.
346
- *
347
- * - `builtin: false` at top level → no built-ins
348
- * - User profile with `builtin: false` → replaces built-in of same name
349
- * - Otherwise: built-ins come first, user profiles appended after
350
- * (later wins on conflict)
351
- *
352
- * @param userProfiles The user-configured path profiles to merge.
353
- * @param builtinEnabled Whether the built-in profiles are enabled (false disables all).
354
- * @returns The merged profile array, or undefined if no profiles active
355
- */
356
- export function mergePathProfiles(userProfiles, builtinEnabled) {
357
- // builtin: false disables all built-in profiles
358
- if (builtinEnabled === false) {
359
- return userProfiles && userProfiles.length > 0 ? userProfiles : undefined;
360
- }
361
- if (!userProfiles || userProfiles.length === 0) {
362
- // No user profiles — use built-ins only
363
- return BUILTIN_PATH_PROFILES.length > 0 ? [...BUILTIN_PATH_PROFILES] : undefined;
364
- }
365
- // Merge: built-ins first, user profiles appended (later wins)
366
- const userReplaced = new Set(userProfiles.filter((p) => p.builtin === false).map((p) => p.name));
367
- const activeBuiltins = BUILTIN_PATH_PROFILES.filter((b) => !userReplaced.has(b.name));
368
- return [...activeBuiltins, ...userProfiles];
440
+ export function mergePathProfiles(userProfiles, _builtinEnabled) {
441
+ return userProfiles && userProfiles.length > 0 ? userProfiles : undefined;
369
442
  }
370
443
  /**
371
444
  * Default code index configuration