code-auditor-mcp 5.0.1 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (360) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +227 -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/handleIdentification.d.ts.map +1 -1
  12. package/dist/analyzers/handleIdentification.js +4 -1
  13. package/dist/analyzers/handleIdentification.js.map +1 -1
  14. package/dist/analyzers/provenance.d.ts +9 -4
  15. package/dist/analyzers/provenance.d.ts.map +1 -1
  16. package/dist/analyzers/provenance.js +8 -25
  17. package/dist/analyzers/provenance.js.map +1 -1
  18. package/dist/analyzers/reactAnalyzer.d.ts.map +1 -1
  19. package/dist/analyzers/reactAnalyzer.js +0 -5
  20. package/dist/analyzers/reactAnalyzer.js.map +1 -1
  21. package/dist/analyzers/receiverRoot.d.ts +20 -0
  22. package/dist/analyzers/receiverRoot.d.ts.map +1 -1
  23. package/dist/analyzers/receiverRoot.js +42 -0
  24. package/dist/analyzers/receiverRoot.js.map +1 -1
  25. package/dist/analyzers/ruleRegistry.js +4 -4
  26. package/dist/analyzers/ruleRegistry.js.map +1 -1
  27. package/dist/analyzers/ruleTiming.d.ts +1 -1
  28. package/dist/analyzers/ruleTiming.js +2 -2
  29. package/dist/analyzers/ruleTiming.js.map +1 -1
  30. package/dist/analyzers/tsEcosystem.d.ts.map +1 -1
  31. package/dist/analyzers/tsEcosystem.js +10 -0
  32. package/dist/analyzers/tsEcosystem.js.map +1 -1
  33. package/dist/analyzers/universal/UniversalConventionsAnalyzer.d.ts.map +1 -1
  34. package/dist/analyzers/universal/UniversalConventionsAnalyzer.js +22 -26
  35. package/dist/analyzers/universal/UniversalConventionsAnalyzer.js.map +1 -1
  36. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts +32 -15
  37. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts.map +1 -1
  38. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js +189 -115
  39. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js.map +1 -1
  40. package/dist/analyzers/universal/UniversalSOLIDAnalyzer.d.ts +0 -2
  41. package/dist/analyzers/universal/UniversalSOLIDAnalyzer.d.ts.map +1 -1
  42. package/dist/analyzers/universal/UniversalSOLIDAnalyzer.js +0 -5
  43. package/dist/analyzers/universal/UniversalSOLIDAnalyzer.js.map +1 -1
  44. package/dist/analyzers/universal/UniversalStylesAnalyzer.d.ts +2 -10
  45. package/dist/analyzers/universal/UniversalStylesAnalyzer.d.ts.map +1 -1
  46. package/dist/analyzers/universal/UniversalStylesAnalyzer.js +7 -49
  47. package/dist/analyzers/universal/UniversalStylesAnalyzer.js.map +1 -1
  48. package/dist/analyzers/universal/schema/config.d.ts.map +1 -1
  49. package/dist/analyzers/universal/schema/config.js +0 -2
  50. package/dist/analyzers/universal/schema/config.js.map +1 -1
  51. package/dist/analyzers/universal/schema/types.d.ts +0 -2
  52. package/dist/analyzers/universal/schema/types.d.ts.map +1 -1
  53. package/dist/analyzers/vendorSurfaces.d.ts +126 -0
  54. package/dist/analyzers/vendorSurfaces.d.ts.map +1 -0
  55. package/dist/analyzers/vendorSurfaces.js +580 -0
  56. package/dist/analyzers/vendorSurfaces.js.map +1 -0
  57. package/dist/auditRunner.d.ts +2 -0
  58. package/dist/auditRunner.d.ts.map +1 -1
  59. package/dist/auditRunner.js +159 -160
  60. package/dist/auditRunner.js.map +1 -1
  61. package/dist/churn/churnExtractor.d.ts +0 -1
  62. package/dist/churn/churnExtractor.d.ts.map +1 -1
  63. package/dist/churn/churnExtractor.js +2 -4
  64. package/dist/churn/churnExtractor.js.map +1 -1
  65. package/dist/cli.d.ts +1 -1
  66. package/dist/cli.d.ts.map +1 -1
  67. package/dist/cli.js +212 -29
  68. package/dist/cli.js.map +1 -1
  69. package/dist/codeIndex/migrations.d.ts.map +1 -1
  70. package/dist/codeIndex/migrations.js +4 -3
  71. package/dist/codeIndex/migrations.js.map +1 -1
  72. package/dist/codeIndexDB.d.ts +11 -2
  73. package/dist/codeIndexDB.d.ts.map +1 -1
  74. package/dist/codeIndexDB.js +27 -2
  75. package/dist/codeIndexDB.js.map +1 -1
  76. package/dist/config/configLoader.d.ts +60 -7
  77. package/dist/config/configLoader.d.ts.map +1 -1
  78. package/dist/config/configLoader.js +252 -60
  79. package/dist/config/configLoader.js.map +1 -1
  80. package/dist/config/defaults.d.ts +77 -18
  81. package/dist/config/defaults.d.ts.map +1 -1
  82. package/dist/config/defaults.js +105 -43
  83. package/dist/config/defaults.js.map +1 -1
  84. package/dist/constants.d.ts +2 -1
  85. package/dist/constants.d.ts.map +1 -1
  86. package/dist/constants.js +4 -0
  87. package/dist/constants.js.map +1 -1
  88. package/dist/daemon/main.d.ts +0 -1
  89. package/dist/daemon/main.d.ts.map +1 -1
  90. package/dist/daemon/main.js +31 -8
  91. package/dist/daemon/main.js.map +1 -1
  92. package/dist/dataPaths.d.ts +17 -11
  93. package/dist/dataPaths.d.ts.map +1 -1
  94. package/dist/dataPaths.js +51 -16
  95. package/dist/dataPaths.js.map +1 -1
  96. package/dist/graph/resolutionEnvironment.d.ts +61 -0
  97. package/dist/graph/resolutionEnvironment.d.ts.map +1 -0
  98. package/dist/graph/resolutionEnvironment.js +57 -0
  99. package/dist/graph/resolutionEnvironment.js.map +1 -0
  100. package/dist/hookLog.d.ts +54 -0
  101. package/dist/hookLog.d.ts.map +1 -0
  102. package/dist/hookLog.js +105 -0
  103. package/dist/hookLog.js.map +1 -0
  104. package/dist/hookLogPath.generated.d.ts +3 -0
  105. package/dist/hookLogPath.generated.d.ts.map +1 -0
  106. package/dist/hookLogPath.generated.js +8 -0
  107. package/dist/hookLogPath.generated.js.map +1 -0
  108. package/dist/index.d.ts +0 -5
  109. package/dist/index.d.ts.map +1 -1
  110. package/dist/index.js +0 -7
  111. package/dist/index.js.map +1 -1
  112. package/dist/installConfig.d.ts +15 -2
  113. package/dist/installConfig.d.ts.map +1 -1
  114. package/dist/installConfig.js +17 -2
  115. package/dist/installConfig.js.map +1 -1
  116. package/dist/languages/typescript/TreeSitterTypeScriptAdapter.d.ts.map +1 -1
  117. package/dist/languages/typescript/TreeSitterTypeScriptAdapter.js +18 -3
  118. package/dist/languages/typescript/TreeSitterTypeScriptAdapter.js.map +1 -1
  119. package/dist/mcp-tools/workflowGuide.js +8 -8
  120. package/dist/mcp-tools/workflowGuide.js.map +1 -1
  121. package/dist/mcp-tools-shared.d.ts.map +1 -1
  122. package/dist/mcp-tools-shared.js +5 -2
  123. package/dist/mcp-tools-shared.js.map +1 -1
  124. package/dist/mcp-ui-simple.d.ts +5 -0
  125. package/dist/mcp-ui-simple.d.ts.map +1 -1
  126. package/dist/mcp-ui-simple.js +9 -2
  127. package/dist/mcp-ui-simple.js.map +1 -1
  128. package/dist/mcp.d.ts +0 -1
  129. package/dist/mcp.d.ts.map +1 -1
  130. package/dist/mcp.js +36 -33
  131. package/dist/mcp.js.map +1 -1
  132. package/dist/mcpAuditJobs.d.ts +10 -0
  133. package/dist/mcpAuditJobs.d.ts.map +1 -1
  134. package/dist/mcpAuditJobs.js +10 -1
  135. package/dist/mcpAuditJobs.js.map +1 -1
  136. package/dist/mcpAutoIndex.d.ts.map +1 -1
  137. package/dist/mcpAutoIndex.js +2 -1
  138. package/dist/mcpAutoIndex.js.map +1 -1
  139. package/dist/phase/colorMath.d.ts +18 -5
  140. package/dist/phase/colorMath.d.ts.map +1 -1
  141. package/dist/phase/colorMath.js +88 -5
  142. package/dist/phase/colorMath.js.map +1 -1
  143. package/dist/phase/dataAccessCallsCandidates.js +1 -1
  144. package/dist/phase/dataAccessCallsCandidates.js.map +1 -1
  145. package/dist/phase/goFunctionAnalysis.d.ts +2 -2
  146. package/dist/phase/goFunctionAnalysis.js +2 -2
  147. package/dist/phase/goFunctions.d.ts +2 -2
  148. package/dist/phase/goFunctions.js +2 -2
  149. package/dist/phase/goImports.d.ts +2 -2
  150. package/dist/phase/goImports.js +2 -2
  151. package/dist/phase/goSwitches.d.ts +2 -2
  152. package/dist/phase/goSwitches.js +2 -2
  153. package/dist/phase/loopQueryCandidates.js +1 -1
  154. package/dist/phase/loopQueryCandidates.js.map +1 -1
  155. package/dist/phase/phaseModel.d.ts +37 -8
  156. package/dist/phase/phaseModel.d.ts.map +1 -1
  157. package/dist/phase/phaseModel.js +94 -46
  158. package/dist/phase/phaseModel.js.map +1 -1
  159. package/dist/phase/producers.d.ts.map +1 -1
  160. package/dist/phase/producers.js +27 -17
  161. package/dist/phase/producers.js.map +1 -1
  162. package/dist/phase/reachability.d.ts +44 -1
  163. package/dist/phase/reachability.d.ts.map +1 -1
  164. package/dist/phase/reachability.js +79 -0
  165. package/dist/phase/reachability.js.map +1 -1
  166. package/dist/phase/receiverConsumers.d.ts +8 -1
  167. package/dist/phase/receiverConsumers.d.ts.map +1 -1
  168. package/dist/phase/receiverConsumers.js +59 -21
  169. package/dist/phase/receiverConsumers.js.map +1 -1
  170. package/dist/phase/receiverProvenance.d.ts +23 -0
  171. package/dist/phase/receiverProvenance.d.ts.map +1 -1
  172. package/dist/phase/receiverProvenance.js +40 -0
  173. package/dist/phase/receiverProvenance.js.map +1 -1
  174. package/dist/phase/rules/crossDomain.d.ts.map +1 -1
  175. package/dist/phase/rules/crossDomain.js +16 -6
  176. package/dist/phase/rules/crossDomain.js.map +1 -1
  177. package/dist/phase/rules/dry.d.ts.map +1 -1
  178. package/dist/phase/rules/dry.js +0 -1
  179. package/dist/phase/rules/dry.js.map +1 -1
  180. package/dist/phase/rules/goRules.d.ts +2 -2
  181. package/dist/phase/rules/goRules.js +2 -2
  182. package/dist/phase/rules/secrets.d.ts +22 -8
  183. package/dist/phase/rules/secrets.d.ts.map +1 -1
  184. package/dist/phase/rules/secrets.js +48 -67
  185. package/dist/phase/rules/secrets.js.map +1 -1
  186. package/dist/phase/rules/styles.d.ts +23 -9
  187. package/dist/phase/rules/styles.d.ts.map +1 -1
  188. package/dist/phase/rules/styles.js +47 -15
  189. package/dist/phase/rules/styles.js.map +1 -1
  190. package/dist/phase/rules/unreferencedModule.d.ts.map +1 -1
  191. package/dist/phase/rules/unreferencedModule.js +16 -5
  192. package/dist/phase/rules/unreferencedModule.js.map +1 -1
  193. package/dist/phase/runner.d.ts +16 -7
  194. package/dist/phase/runner.d.ts.map +1 -1
  195. package/dist/phase/runner.js +32 -20
  196. package/dist/phase/runner.js.map +1 -1
  197. package/dist/phase/stylesCss.d.ts.map +1 -1
  198. package/dist/phase/stylesCss.js +4 -0
  199. package/dist/phase/stylesCss.js.map +1 -1
  200. package/dist/phase/stylesMarkup.d.ts.map +1 -1
  201. package/dist/phase/stylesMarkup.js +4 -0
  202. package/dist/phase/stylesMarkup.js.map +1 -1
  203. package/dist/phase/stylesSource.d.ts.map +1 -1
  204. package/dist/phase/stylesSource.js +6 -0
  205. package/dist/phase/stylesSource.js.map +1 -1
  206. package/dist/phase/testProgram.d.ts +57 -0
  207. package/dist/phase/testProgram.d.ts.map +1 -0
  208. package/dist/phase/testProgram.js +244 -0
  209. package/dist/phase/testProgram.js.map +1 -0
  210. package/dist/phase/typeDeclarations.d.ts +2 -2
  211. package/dist/phase/typeDeclarations.js +2 -2
  212. package/dist/phase/types.d.ts +54 -0
  213. package/dist/phase/types.d.ts.map +1 -1
  214. package/dist/pipelineAdapters.d.ts +1 -171
  215. package/dist/pipelineAdapters.d.ts.map +1 -1
  216. package/dist/pipelineAdapters.js +47 -1281
  217. package/dist/pipelineAdapters.js.map +1 -1
  218. package/dist/reporting/csvReportGenerator.d.ts.map +1 -1
  219. package/dist/reporting/csvReportGenerator.js +0 -6
  220. package/dist/reporting/csvReportGenerator.js.map +1 -1
  221. package/dist/reporting/htmlReportGenerator.d.ts.map +1 -1
  222. package/dist/reporting/htmlReportGenerator.js +0 -4
  223. package/dist/reporting/htmlReportGenerator.js.map +1 -1
  224. package/dist/reporting/jsonReportGenerator.d.ts.map +1 -1
  225. package/dist/reporting/jsonReportGenerator.js +0 -1
  226. package/dist/reporting/jsonReportGenerator.js.map +1 -1
  227. package/dist/reporting/sarifReportGenerator.d.ts.map +1 -1
  228. package/dist/reporting/sarifReportGenerator.js +0 -7
  229. package/dist/reporting/sarifReportGenerator.js.map +1 -1
  230. package/dist/sqlite/driver.d.ts +17 -1
  231. package/dist/sqlite/driver.d.ts.map +1 -1
  232. package/dist/sqlite/driver.js +28 -5
  233. package/dist/sqlite/driver.js.map +1 -1
  234. package/dist/styles/cssInJsHarvest.d.ts +36 -0
  235. package/dist/styles/cssInJsHarvest.d.ts.map +1 -0
  236. package/dist/styles/cssInJsHarvest.js +78 -0
  237. package/dist/styles/cssInJsHarvest.js.map +1 -0
  238. package/dist/styles/definedClasses.d.ts +95 -0
  239. package/dist/styles/definedClasses.d.ts.map +1 -0
  240. package/dist/styles/definedClasses.js +129 -0
  241. package/dist/styles/definedClasses.js.map +1 -0
  242. package/dist/styles/markupStyleHarvest.d.ts +33 -0
  243. package/dist/styles/markupStyleHarvest.d.ts.map +1 -0
  244. package/dist/styles/markupStyleHarvest.js +73 -0
  245. package/dist/styles/markupStyleHarvest.js.map +1 -0
  246. package/dist/styles/styleExtractor.d.ts +37 -0
  247. package/dist/styles/styleExtractor.d.ts.map +1 -1
  248. package/dist/styles/styleExtractor.js +89 -33
  249. package/dist/styles/styleExtractor.js.map +1 -1
  250. package/dist/styles/styleIndexer.d.ts.map +1 -1
  251. package/dist/styles/styleIndexer.js +11 -10
  252. package/dist/styles/styleIndexer.js.map +1 -1
  253. package/dist/styles/tailwindExpander.d.ts.map +1 -1
  254. package/dist/styles/tailwindExpander.js +31 -10
  255. package/dist/styles/tailwindExpander.js.map +1 -1
  256. package/dist/telemetry.d.ts +67 -1
  257. package/dist/telemetry.d.ts.map +1 -1
  258. package/dist/telemetry.js +100 -20
  259. package/dist/telemetry.js.map +1 -1
  260. package/dist/types/crossLanguage.d.ts +1 -0
  261. package/dist/types/crossLanguage.d.ts.map +1 -1
  262. package/dist/types.d.ts +36 -56
  263. package/dist/types.d.ts.map +1 -1
  264. package/dist/types.js +4 -4
  265. package/dist/types.js.map +1 -1
  266. package/dist/version.generated.d.ts +1 -1
  267. package/dist/version.generated.js +1 -1
  268. package/examples/.auditrc.example.json +7 -22
  269. package/examples/.auditrc.json +12 -155
  270. package/examples/.code-auditor.json +8 -51
  271. package/examples/nextjs.auditrc.json +7 -34
  272. package/examples/node-api.auditrc.json +6 -46
  273. package/examples/react.auditrc.json +8 -25
  274. package/examples/tolerant-solid.auditrc.json +12 -44
  275. package/package.json +13 -9
  276. package/plugin/.claude-plugin/manifest.json +10 -9
  277. package/plugin/.claude-plugin/plugin.json +1 -1
  278. package/plugin/hooks/hooks.json +4 -4
  279. package/plugin/scripts/hook-audit.sh +14 -2
  280. package/plugin/scripts/hook-common.sh +41 -11
  281. package/plugin/scripts/hook-drift-check.sh +19 -6
  282. package/plugin/scripts/hook-log-path.sh +7 -0
  283. package/plugin/scripts/hook-self-audit.sh +14 -2
  284. package/plugin/scripts/hook-warm.sh +22 -17
  285. package/plugin/skills/code-auditor/SKILL.md +26 -3
  286. package/server.json +10 -4
  287. package/dist/__tests__/fixtures/spec-20/scripts/tool.d.ts +0 -6
  288. package/dist/__tests__/fixtures/spec-20/scripts/tool.d.ts.map +0 -1
  289. package/dist/__tests__/fixtures/spec-20/scripts/tool.js +0 -12
  290. package/dist/__tests__/fixtures/spec-20/scripts/tool.js.map +0 -1
  291. package/dist/__tests__/fixtures/spec-20/src/demo-module.d.ts +0 -7
  292. package/dist/__tests__/fixtures/spec-20/src/demo-module.d.ts.map +0 -1
  293. package/dist/__tests__/fixtures/spec-20/src/demo-module.js +0 -13
  294. package/dist/__tests__/fixtures/spec-20/src/demo-module.js.map +0 -1
  295. package/dist/__tests__/fixtures/spec-52/item-01-prepare-in-loop.d.ts +0 -14
  296. package/dist/__tests__/fixtures/spec-52/item-01-prepare-in-loop.d.ts.map +0 -1
  297. package/dist/__tests__/fixtures/spec-52/item-01-prepare-in-loop.js +0 -16
  298. package/dist/__tests__/fixtures/spec-52/item-01-prepare-in-loop.js.map +0 -1
  299. package/dist/__tests__/fixtures/spec-52/item-02-prepare-bind-accumulate-batch.d.ts +0 -15
  300. package/dist/__tests__/fixtures/spec-52/item-02-prepare-bind-accumulate-batch.d.ts.map +0 -1
  301. package/dist/__tests__/fixtures/spec-52/item-02-prepare-bind-accumulate-batch.js +0 -17
  302. package/dist/__tests__/fixtures/spec-52/item-02-prepare-bind-accumulate-batch.js.map +0 -1
  303. package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.d.ts +0 -14
  304. package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.d.ts.map +0 -1
  305. package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.js +0 -19
  306. package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.js.map +0 -1
  307. package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.d.ts +0 -18
  308. package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.d.ts.map +0 -1
  309. package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.js +0 -19
  310. package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.js.map +0 -1
  311. package/dist/__tests__/fixtures/spec-52/item-05-upsert-forms.d.ts +0 -19
  312. package/dist/__tests__/fixtures/spec-52/item-05-upsert-forms.d.ts.map +0 -1
  313. package/dist/__tests__/fixtures/spec-52/item-05-upsert-forms.js +0 -19
  314. package/dist/__tests__/fixtures/spec-52/item-05-upsert-forms.js.map +0 -1
  315. package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.d.ts +0 -17
  316. package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.d.ts.map +0 -1
  317. package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.js +0 -19
  318. package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.js.map +0 -1
  319. package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.d.ts +0 -25
  320. package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.d.ts.map +0 -1
  321. package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.js +0 -21
  322. package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.js.map +0 -1
  323. package/dist/__tests__/fixtures/spec-52/item-08-promise-all-of-statements-in-loop.d.ts +0 -15
  324. package/dist/__tests__/fixtures/spec-52/item-08-promise-all-of-statements-in-loop.d.ts.map +0 -1
  325. package/dist/__tests__/fixtures/spec-52/item-08-promise-all-of-statements-in-loop.js +0 -19
  326. package/dist/__tests__/fixtures/spec-52/item-08-promise-all-of-statements-in-loop.js.map +0 -1
  327. package/dist/__tests__/fixtures/spec-52/item-09-promise-all-map-of-statements-in-loop.d.ts +0 -14
  328. package/dist/__tests__/fixtures/spec-52/item-09-promise-all-map-of-statements-in-loop.d.ts.map +0 -1
  329. package/dist/__tests__/fixtures/spec-52/item-09-promise-all-map-of-statements-in-loop.js +0 -14
  330. package/dist/__tests__/fixtures/spec-52/item-09-promise-all-map-of-statements-in-loop.js.map +0 -1
  331. package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.d.ts +0 -15
  332. package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.d.ts.map +0 -1
  333. package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.js +0 -16
  334. package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.js.map +0 -1
  335. package/dist/languages/go/analyzer-darwin-amd64 +0 -0
  336. package/dist/languages/go/analyzer-darwin-arm64 +0 -0
  337. package/dist/languages/go/analyzer-linux-amd64 +0 -0
  338. package/dist/languages/go/analyzer-linux-arm64 +0 -0
  339. package/dist/languages/go/analyzer-src/analyzer.go +0 -643
  340. package/dist/languages/go/analyzer-src/dataaccess.go +0 -388
  341. package/dist/languages/go/analyzer-src/go.mod +0 -3
  342. package/dist/languages/go/analyzer-src/indexer.go +0 -268
  343. package/dist/languages/go/analyzer-src/parser.go +0 -461
  344. package/dist/languages/go/analyzer-src/solid.go +0 -311
  345. package/dist/languages/go/analyzer-src/testconventions.go +0 -25
  346. package/dist/languages/go/analyzer-src/types.go +0 -156
  347. package/dist/languages/go/analyzer-windows-amd64.exe +0 -0
  348. package/dist/languages/go/go.mod +0 -7
  349. package/dist/languages/go/main.go +0 -203
  350. package/dist/native/ast-grep-napi.darwin-arm64.node +0 -0
  351. package/dist/native/ast-grep-napi.darwin-x64.node +0 -0
  352. package/dist/native/ast-grep-napi.linux-arm64-gnu.node +0 -0
  353. package/dist/native/ast-grep-napi.linux-arm64-musl.node +0 -0
  354. package/dist/native/ast-grep-napi.linux-x64-gnu.node +0 -0
  355. package/dist/native/ast-grep-napi.linux-x64-musl.node +0 -0
  356. package/dist/native/ast-grep-napi.win32-x64-msvc.node +0 -0
  357. package/dist/native-bootstrap.d.ts +0 -15
  358. package/dist/native-bootstrap.d.ts.map +0 -1
  359. package/dist/native-bootstrap.js +0 -75
  360. package/dist/native-bootstrap.js.map +0 -1
@@ -5,7 +5,7 @@ description: Audit code quality, search the codebase semantically, enforce invar
5
5
 
6
6
  # Code Auditor Skill
7
7
 
8
- > **Version 5.0.1** • Run `code-audit --version` to check your installed version.
8
+ > **Version 5.2.0** • Run `code-audit --version` to check your installed version.
9
9
  > If versions differ, the CLI is authoritative — use `code-audit <command> --help` to see what your install actually supports.
10
10
 
11
11
  You have the `code-audit` CLI available. It indexes every function, component, and struct in the codebase for semantic search and invariant enforcement. Use these commands instead of raw grep/find whenever possible.
@@ -82,10 +82,31 @@ A dismissal is for *this finding is not relevant*, not for *I don't want to fix
82
82
 
83
83
  The tool can send dismissed findings to an anonymous feedback service that collects them. It is **off by default** and is turned on only by an explicit opt-in:
84
84
 
85
- - `mcp__code-auditor__telemetry` `status` / `enable` / `disable` manage the opt-in. `enable` needs no arguments — it opts in against the built-in service endpoint and generates the anonymous install ID.
85
+ - `code-audit telemetry status` / `enable` / `disable` manage the opt-in (the `mcp__code-auditor__telemetry` tool mirrors the same toggle). `enable` needs no arguments — it opts in against the built-in service endpoint and generates the anonymous install ID.
86
86
  - When opted in, each dismissal sends only the reason plus a structural shape — **no code, identifiers, or file paths**.
87
87
 
88
- Before enabling, tell the user the privacy facts: **data is anonymous, and the ID is generated locally to avoid tracking anything personal.** Only the reason and enough shape to reproduce the finding are sent; nothing derived from their code or environment.
88
+ On first contact, run `code-audit telemetry status` and read its `decided` field:
89
+
90
+ - **`decided` is false** — the user has never been asked. Tell them the privacy facts (below), then ask **once** whether to opt in. Run `code-audit telemetry enable` on yes and `code-audit telemetry disable` on no — either records the decision so the question is never repeated.
91
+ - **`decided` is true** — the user has already chosen. Never ask again; leave the setting exactly as it is.
92
+
93
+ The privacy facts: each submission contains the tool version, the rule ID, the urgency level, the dismissal reason exactly as typed, a structural AST signature (grammar node types only, never their contents), a coarse language hint, a timestamp, and an anonymous install ID generated locally on your machine. Source code, identifiers, literals, file paths, and environment details are never sent, unless the user types them into the reason.
94
+
95
+ ### `code-audit request-rule` — request a rule for an unflagged defect
96
+
97
+ When you find a *class* of defect the audit did not flag, request a new rule instead of silently working around it:
98
+
99
+ ```bash
100
+ code-audit request-rule \
101
+ --title "Flag unbounded loops" \
102
+ --symptom "A loop with no exit condition hangs the process at runtime." \
103
+ --signal "A for-loop over a dynamic collection with no bound check." \
104
+ --language typescript \
105
+ --fires bad.ts \
106
+ --clean fixed.ts
107
+ ```
108
+
109
+ Call `lookup_rule` or `explain_symptom` first to confirm no existing rule covers it. Provide a minimal example that *should* be flagged (`--fires`) and a corrected example that *should not* (`--clean`), each reduced to the smallest code that shows the difference, with secrets and proprietary identifiers removed. The CLI prints a receipt id so the request can be tracked.
89
110
 
90
111
  ### `code-audit config` — know the project's laws
91
112
 
@@ -235,6 +256,8 @@ The hook auto-installs the package to a cache dir on first use — no manual npm
235
256
  | Resolve file profiles | `code-audit config profiles --file <path>` |
236
257
  | Next file to fix | `code-audit next-file` |
237
258
  | Dismiss a false positive | `code-audit dismiss <fingerprint> --reason "…"` |
259
+ | Telemetry opt-in | `code-audit telemetry status` / `enable` / `disable` |
260
+ | Request a new rule | `code-audit request-rule` |
238
261
  | Sync index | `code-audit index sync --path .` |
239
262
  | Codebase map | `code-audit map -p .` |
240
263
  | Mine conventions | `code-audit conventions list` |
package/server.json CHANGED
@@ -1,21 +1,27 @@
1
1
  {
2
- "$schema": "https://static.modelcontextprotocol.io/schemas/2025-10-17/server.schema.json",
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
3
  "name": "io.github.BenAHammond/code-auditor-mcp",
4
- "description": "Architectural invariants and code quality analysis, enforced inside your AI agent's edit loop. MCP server + CLI + Claude Code plugin. TypeScript, JavaScript, Go.",
4
+ "description": "Enforces architectural invariants and code quality rules inside your AI agent's edit loop.",
5
5
  "repository": {
6
6
  "url": "https://github.com/BenAHammond/code-auditor-mcp",
7
7
  "source": "github"
8
8
  },
9
- "version": "5.0.1",
9
+ "version": "5.0.2",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "registryBaseUrl": "https://registry.npmjs.org",
14
14
  "identifier": "code-auditor-mcp",
15
- "version": "5.0.1",
15
+ "version": "5.0.2",
16
16
  "transport": {
17
17
  "type": "stdio"
18
18
  }
19
19
  }
20
+ ],
21
+ "remotes": [
22
+ {
23
+ "type": "streamable-http",
24
+ "url": "https://www.codeauditormcp.com/api/mcp"
25
+ }
20
26
  ]
21
27
  }
@@ -1,6 +0,0 @@
1
- /**
2
- * Scripts-tree module with an undocumented exported function.
3
- * Same code as src/demo-module.ts — the profile controls what fires.
4
- */
5
- export declare function calculateTotal(items: number[]): number;
6
- //# sourceMappingURL=tool.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../../../src/__tests__/fixtures/spec-20/scripts/tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAMtD"}
@@ -1,12 +0,0 @@
1
- /**
2
- * Scripts-tree module with an undocumented exported function.
3
- * Same code as src/demo-module.ts — the profile controls what fires.
4
- */
5
- export function calculateTotal(items) {
6
- let total = 0;
7
- for (const item of items) {
8
- total += item * 1.1;
9
- }
10
- return total;
11
- }
12
- //# sourceMappingURL=tool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../../../src/__tests__/fixtures/spec-20/scripts/tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAe;IAC5C,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,KAAK,IAAI,IAAI,GAAG,GAAG,CAAC;IACtB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,7 +0,0 @@
1
- /**
2
- * Source-tree module with an undocumented exported function.
3
- * When requireFunctionDocs is true (default), the documentation analyzer
4
- * flags this. When a profile sets requireFunctionDocs=false, skip entirely.
5
- */
6
- export declare function calculateTotal(items: number[]): number;
7
- //# sourceMappingURL=demo-module.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"demo-module.d.ts","sourceRoot":"","sources":["../../../../../src/__tests__/fixtures/spec-20/src/demo-module.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAMtD"}
@@ -1,13 +0,0 @@
1
- /**
2
- * Source-tree module with an undocumented exported function.
3
- * When requireFunctionDocs is true (default), the documentation analyzer
4
- * flags this. When a profile sets requireFunctionDocs=false, skip entirely.
5
- */
6
- export function calculateTotal(items) {
7
- let total = 0;
8
- for (const item of items) {
9
- total += item * 1.1;
10
- }
11
- return total;
12
- }
13
- //# sourceMappingURL=demo-module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"demo-module.js","sourceRoot":"","sources":["../../../../../src/__tests__/fixtures/spec-20/src/demo-module.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAe;IAC5C,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,KAAK,IAAI,IAAI,GAAG,GAAG,CAAC;IACtB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Spec-52 R1 item 1 — loop-query FALSE positive (oracle: MUST NOT fire).
3
- *
4
- * `db.prepare(sql)` inside a loop builds a statement object; it performs no I/O.
5
- * The statements are accumulated and executed once by a single `.batch()` after
6
- * the loop. This is the `mod.ts:213/218/223/266` shape — not an N+1.
7
- */
8
- interface Row {
9
- id: number;
10
- name: string;
11
- }
12
- export declare function insertMany(db: any, rows: Row[]): Promise<void>;
13
- export {};
14
- //# sourceMappingURL=item-01-prepare-in-loop.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item-01-prepare-in-loop.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-01-prepare-in-loop.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,UAAU,GAAG;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,UAAU,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAOpE"}
@@ -1,16 +0,0 @@
1
- /**
2
- * Spec-52 R1 item 1 — loop-query FALSE positive (oracle: MUST NOT fire).
3
- *
4
- * `db.prepare(sql)` inside a loop builds a statement object; it performs no I/O.
5
- * The statements are accumulated and executed once by a single `.batch()` after
6
- * the loop. This is the `mod.ts:213/218/223/266` shape — not an N+1.
7
- */
8
- export async function insertMany(db, rows) {
9
- const stmts = [];
10
- for (const row of rows) {
11
- const stmt = db.prepare('INSERT INTO items (id, name) VALUES (?, ?)');
12
- stmts.push(stmt);
13
- }
14
- await db.batch(stmts);
15
- }
16
- //# sourceMappingURL=item-01-prepare-in-loop.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item-01-prepare-in-loop.js","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-01-prepare-in-loop.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,EAAO,EAAE,IAAW;IACnD,MAAM,KAAK,GAAc,EAAE,CAAC;IAC5B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,CAAC,4CAA4C,CAAC,CAAC;QACtE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;IACD,MAAM,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC"}
@@ -1,15 +0,0 @@
1
- /**
2
- * Spec-52 R1 item 2 — accumulate-then-batch (oracle: MUST NOT fire).
3
- *
4
- * The explicit accumulate-then-batch shape: each loop iteration prepares and
5
- * binds a statement (statement construction — no I/O), pushes it to an array,
6
- * and a single `.batch()` after the loop executes them all. The eager call sits
7
- * outside the loop, so this is not an N+1.
8
- */
9
- interface ScoreRow {
10
- id: number;
11
- score: number;
12
- }
13
- export declare function rescoreMany(db: any, items: ScoreRow[]): Promise<void>;
14
- export {};
15
- //# sourceMappingURL=item-02-prepare-bind-accumulate-batch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item-02-prepare-bind-accumulate-batch.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-02-prepare-bind-accumulate-batch.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,UAAU,QAAQ;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,WAAW,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAO3E"}
@@ -1,17 +0,0 @@
1
- /**
2
- * Spec-52 R1 item 2 — accumulate-then-batch (oracle: MUST NOT fire).
3
- *
4
- * The explicit accumulate-then-batch shape: each loop iteration prepares and
5
- * binds a statement (statement construction — no I/O), pushes it to an array,
6
- * and a single `.batch()` after the loop executes them all. The eager call sits
7
- * outside the loop, so this is not an N+1.
8
- */
9
- export async function rescoreMany(db, items) {
10
- const stmts = [];
11
- for (const item of items) {
12
- const stmt = db.prepare('UPDATE scores SET score = ? WHERE id = ?').bind(item.score, item.id);
13
- stmts.push(stmt);
14
- }
15
- await db.batch(stmts);
16
- }
17
- //# sourceMappingURL=item-02-prepare-bind-accumulate-batch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item-02-prepare-bind-accumulate-batch.js","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-02-prepare-bind-accumulate-batch.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,EAAO,EAAE,KAAiB;IAC1D,MAAM,KAAK,GAAc,EAAE,CAAC;IAC5B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,CAAC,0CAA0C,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QAC9F,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;IACD,MAAM,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Spec-52 R1 item 3 — loop-query TRUE positive (oracle: MUST fire).
3
- *
4
- * `db.exec(sql)` inside a loop is an eager member call — immediate I/O on every
5
- * iteration. This is the simplest genuine-N+1 positive arm: the prepare/bind
6
- * skip must be surgical and leave eager member methods firing.
7
- */
8
- interface ItemRow {
9
- id: number;
10
- name: string;
11
- }
12
- export declare function renameAll(items: ItemRow[]): Promise<void>;
13
- export {};
14
- //# sourceMappingURL=item-03-exec-in-loop.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item-03-exec-in-loop.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-03-exec-in-loop.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,UAAU,OAAO;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAQD,wBAAsB,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAI/D"}
@@ -1,19 +0,0 @@
1
- /**
2
- * Spec-52 R1 item 3 — loop-query TRUE positive (oracle: MUST fire).
3
- *
4
- * `db.exec(sql)` inside a loop is an eager member call — immediate I/O on every
5
- * iteration. This is the simplest genuine-N+1 positive arm: the prepare/bind
6
- * skip must be surgical and leave eager member methods firing.
7
- */
8
- import Database from 'better-sqlite3';
9
- // Spec 70 R4 — the handle is proven by the manifest-package import
10
- // (`better-sqlite3`), not a `D1Database` type annotation. `db.exec(sql)` with a
11
- // dynamic (interpolated) argument has no static SQL for R3, so the import is the
12
- // proof; the `D1Database` binding would read `unproven` (cannot-fire).
13
- const db = new Database(':memory:');
14
- export async function renameAll(items) {
15
- for (const item of items) {
16
- db.exec(`UPDATE items SET name = 'renamed' WHERE id = ${item.id}`);
17
- }
18
- }
19
- //# sourceMappingURL=item-03-exec-in-loop.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item-03-exec-in-loop.js","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-03-exec-in-loop.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAOtC,mEAAmE;AACnE,gFAAgF;AAChF,iFAAiF;AACjF,uEAAuE;AACvE,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAC;AAEpC,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,KAAgB;IAC9C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,EAAE,CAAC,IAAI,CAAC,gDAAgD,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IACrE,CAAC;AACH,CAAC"}
@@ -1,18 +0,0 @@
1
- /**
2
- * Spec-52 R1 item 4 — loop-query TRUE positive (oracle: MUST fire).
3
- *
4
- * The `Leaderboard.ts:113` discriminating positive: `this.ctx.storage.sql.exec(...)`
5
- * inside a loop. `.exec()` is an eager method (immediate I/O), so this is a real
6
- * N+1 that must keep firing — the two-direction proof's positive arm.
7
- */
8
- interface RankRow {
9
- id: number;
10
- rank: number;
11
- }
12
- export declare class Leaderboard {
13
- private sql;
14
- constructor(sql: D1Database);
15
- applyRanks(rows: RankRow[]): Promise<void>;
16
- }
17
- export {};
18
- //# sourceMappingURL=item-04-storage-sql-exec-in-loop.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item-04-storage-sql-exec-in-loop.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,UAAU,OAAO;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,GAAG,CAAa;gBAEZ,GAAG,EAAE,UAAU;IAIrB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAKjD"}
@@ -1,19 +0,0 @@
1
- /**
2
- * Spec-52 R1 item 4 — loop-query TRUE positive (oracle: MUST fire).
3
- *
4
- * The `Leaderboard.ts:113` discriminating positive: `this.ctx.storage.sql.exec(...)`
5
- * inside a loop. `.exec()` is an eager method (immediate I/O), so this is a real
6
- * N+1 that must keep firing — the two-direction proof's positive arm.
7
- */
8
- export class Leaderboard {
9
- sql;
10
- constructor(sql) {
11
- this.sql = sql;
12
- }
13
- async applyRanks(rows) {
14
- for (const row of rows) {
15
- this.sql.exec('UPDATE leaderboard SET rank = ? WHERE id = ?', row.rank, row.id);
16
- }
17
- }
18
- }
19
- //# sourceMappingURL=item-04-storage-sql-exec-in-loop.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item-04-storage-sql-exec-in-loop.js","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,MAAM,OAAO,WAAW;IACd,GAAG,CAAa;IAExB,YAAY,GAAe;QACzB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,IAAe;QAC9B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,8CAA8C,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QAClF,CAAC;IACH,CAAC;CACF"}
@@ -1,19 +0,0 @@
1
- /**
2
- * Spec-52 R2 — the four SQLite/Postgres upsert write forms (oracle: all MUST be
3
- * classified as `insert` writes).
4
- *
5
- * `INSERT OR IGNORE INTO`, `INSERT OR REPLACE INTO`, `REPLACE INTO`, and
6
- * `INSERT INTO ... ON CONFLICT ... DO UPDATE` all mutate the target table; the
7
- * write classifier previously only matched `INSERT INTO`, so every rule reading
8
- * the write set (written-never-read, multi-table-write) missed them.
9
- *
10
- * This fixture is exercised by the spec-52 test through `parseSqlTables`, which
11
- * is the table-extraction path that feeds `schema_usage.usage_type`.
12
- */
13
- export declare const UPSERT_QUERIES: {
14
- readonly insertOrIgnore: "INSERT OR IGNORE INTO feature_flags (key, enabled) VALUES (?, ?)";
15
- readonly insertOrReplace: "INSERT OR REPLACE INTO feature_flags (key, enabled) VALUES (?, ?)";
16
- readonly replaceInto: "REPLACE INTO feature_flags (key, enabled) VALUES (?, ?)";
17
- readonly onConflictDoUpdate: "INSERT INTO feature_flags (key, enabled) VALUES (?, ?) ON CONFLICT (key) DO UPDATE SET enabled = excluded.enabled";
18
- };
19
- //# sourceMappingURL=item-05-upsert-forms.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item-05-upsert-forms.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-05-upsert-forms.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,cAAc;;;;;CASjB,CAAC"}
@@ -1,19 +0,0 @@
1
- /**
2
- * Spec-52 R2 — the four SQLite/Postgres upsert write forms (oracle: all MUST be
3
- * classified as `insert` writes).
4
- *
5
- * `INSERT OR IGNORE INTO`, `INSERT OR REPLACE INTO`, `REPLACE INTO`, and
6
- * `INSERT INTO ... ON CONFLICT ... DO UPDATE` all mutate the target table; the
7
- * write classifier previously only matched `INSERT INTO`, so every rule reading
8
- * the write set (written-never-read, multi-table-write) missed them.
9
- *
10
- * This fixture is exercised by the spec-52 test through `parseSqlTables`, which
11
- * is the table-extraction path that feeds `schema_usage.usage_type`.
12
- */
13
- export const UPSERT_QUERIES = {
14
- insertOrIgnore: 'INSERT OR IGNORE INTO feature_flags (key, enabled) VALUES (?, ?)',
15
- insertOrReplace: 'INSERT OR REPLACE INTO feature_flags (key, enabled) VALUES (?, ?)',
16
- replaceInto: 'REPLACE INTO feature_flags (key, enabled) VALUES (?, ?)',
17
- onConflictDoUpdate: 'INSERT INTO feature_flags (key, enabled) VALUES (?, ?) ON CONFLICT (key) DO UPDATE SET enabled = excluded.enabled',
18
- };
19
- //# sourceMappingURL=item-05-upsert-forms.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item-05-upsert-forms.js","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-05-upsert-forms.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,cAAc,EACZ,kEAAkE;IACpE,eAAe,EACb,mEAAmE;IACrE,WAAW,EACT,yDAAyD;IAC3D,kBAAkB,EAChB,mHAAmH;CAC7G,CAAC"}
@@ -1,17 +0,0 @@
1
- /**
2
- * Spec-52 R1 item 6 — chained prepare→bind→run in a loop (oracle: MUST fire).
3
- *
4
- * `db.prepare(sql).bind(x).run()` executes I/O on every iteration. Unlike the
5
- * accumulate-then-batch shape (where the statement is pushed to an array and a
6
- * single `.batch()` runs after the loop), the eager `.run()` sits *inside* the
7
- * loop here, so this is a genuine N+1. The prepare/bind skip must be surgical:
8
- * it skips standalone construction but leaves a prepare/bind that is chained
9
- * into an eager call firing.
10
- */
11
- interface SyncJob {
12
- id: number;
13
- slug: string;
14
- }
15
- export declare function syncBuildsForHeroes(db: D1Database, jobs: SyncJob[]): Promise<void>;
16
- export {};
17
- //# sourceMappingURL=item-06-chained-prepare-run-in-loop.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item-06-chained-prepare-run-in-loop.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,UAAU,OAAO;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,mBAAmB,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CASxF"}
@@ -1,19 +0,0 @@
1
- /**
2
- * Spec-52 R1 item 6 — chained prepare→bind→run in a loop (oracle: MUST fire).
3
- *
4
- * `db.prepare(sql).bind(x).run()` executes I/O on every iteration. Unlike the
5
- * accumulate-then-batch shape (where the statement is pushed to an array and a
6
- * single `.batch()` runs after the loop), the eager `.run()` sits *inside* the
7
- * loop here, so this is a genuine N+1. The prepare/bind skip must be surgical:
8
- * it skips standalone construction but leaves a prepare/bind that is chained
9
- * into an eager call firing.
10
- */
11
- export async function syncBuildsForHeroes(db, jobs) {
12
- for (const job of jobs) {
13
- await db
14
- .prepare(`UPDATE sync_jobs SET status = 'running', started_at = datetime('now') WHERE id = ?`)
15
- .bind(job.id)
16
- .run();
17
- }
18
- }
19
- //# sourceMappingURL=item-06-chained-prepare-run-in-loop.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item-06-chained-prepare-run-in-loop.js","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,EAAc,EAAE,IAAe;IACvE,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,EAAE;aACL,OAAO,CACN,oFAAoF,CACrF;aACA,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;aACZ,GAAG,EAAE,CAAC;IACX,CAAC;AACH,CAAC"}
@@ -1,25 +0,0 @@
1
- /**
2
- * Spec-52 R1 item 7 — chained prepare→bind→first<Row>() in a loop (oracle: MUST fire).
3
- *
4
- * The typed-read N+1: `.first<Row>()` (and `.all<Row>()`) is the D1 read idiom.
5
- * The generic type argument must not hide the eager method from detection — the
6
- * same gap that bit `too-many-queries`'s text regex. The AST path reads the
7
- * property name directly, so `first` is visible regardless of `<Row>`.
8
- */
9
- interface HeroRow {
10
- id: number;
11
- name: string;
12
- }
13
- interface Statement {
14
- bind(...args: unknown[]): Statement;
15
- first<T>(): T | null;
16
- all<T>(): T[];
17
- run(): unknown;
18
- }
19
- interface D1Database {
20
- prepare(sql: string): Statement;
21
- batch(stmts: unknown[]): unknown;
22
- }
23
- export declare function fetchHeroById(db: D1Database, ids: number[]): Promise<HeroRow[]>;
24
- export {};
25
- //# sourceMappingURL=item-07-chained-prepare-bind-first-in-loop.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item-07-chained-prepare-bind-first-in-loop.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,UAAU,OAAO;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAID,UAAU,SAAS;IACjB,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,SAAS,CAAC;IACpC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IACrB,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;IACd,GAAG,IAAI,OAAO,CAAC;CAChB;AACD,UAAU,UAAU;IAClB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;CAClC;AAED,wBAAsB,aAAa,CAAC,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAUrF"}
@@ -1,21 +0,0 @@
1
- /**
2
- * Spec-52 R1 item 7 — chained prepare→bind→first<Row>() in a loop (oracle: MUST fire).
3
- *
4
- * The typed-read N+1: `.first<Row>()` (and `.all<Row>()`) is the D1 read idiom.
5
- * The generic type argument must not hide the eager method from detection — the
6
- * same gap that bit `too-many-queries`'s text regex. The AST path reads the
7
- * property name directly, so `first` is visible regardless of `<Row>`.
8
- */
9
- export async function fetchHeroById(db, ids) {
10
- const out = [];
11
- for (const id of ids) {
12
- const row = await db
13
- .prepare('SELECT id, name FROM heroes WHERE id = ?')
14
- .bind(id)
15
- .first();
16
- if (row)
17
- out.push(row);
18
- }
19
- return out;
20
- }
21
- //# sourceMappingURL=item-07-chained-prepare-bind-first-in-loop.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item-07-chained-prepare-bind-first-in-loop.js","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAoBH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,EAAc,EAAE,GAAa;IAC/D,MAAM,GAAG,GAAc,EAAE,CAAC;IAC1B,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACrB,MAAM,GAAG,GAAG,MAAM,EAAE;aACjB,OAAO,CAAC,0CAA0C,CAAC;aACnD,IAAI,CAAC,EAAE,CAAC;aACR,KAAK,EAAW,CAAC;QACpB,IAAI,GAAG;YAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,15 +0,0 @@
1
- /**
2
- * Spec-52 R1 item 8 — Promise.all of plain statements in a loop (oracle: MUST NOT fire).
3
- *
4
- * `Promise.all([db.prepare(sql).bind(x), …])` wraps *statement objects* (no
5
- * `.run()`/`.all()`/`.first()`), so nothing executes inside the loop. This is
6
- * construction, not an N+1. `Promise.all` must not be misread as the eager D1
7
- * `.all()` method just because its property name is "all".
8
- */
9
- interface ItemRow {
10
- id: number;
11
- name: string;
12
- }
13
- export declare function stageMany(db: any, items: ItemRow[]): Promise<unknown[]>;
14
- export {};
15
- //# sourceMappingURL=item-08-promise-all-of-statements-in-loop.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item-08-promise-all-of-statements-in-loop.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-08-promise-all-of-statements-in-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,UAAU,OAAO;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAW7E"}
@@ -1,19 +0,0 @@
1
- /**
2
- * Spec-52 R1 item 8 — Promise.all of plain statements in a loop (oracle: MUST NOT fire).
3
- *
4
- * `Promise.all([db.prepare(sql).bind(x), …])` wraps *statement objects* (no
5
- * `.run()`/`.all()`/`.first()`), so nothing executes inside the loop. This is
6
- * construction, not an N+1. `Promise.all` must not be misread as the eager D1
7
- * `.all()` method just because its property name is "all".
8
- */
9
- export async function stageMany(db, items) {
10
- const staged = [];
11
- for (const item of items) {
12
- staged.push(await Promise.all([
13
- db.prepare('SELECT id FROM items WHERE id = ?').bind(item.id),
14
- db.prepare('SELECT name FROM items WHERE id = ?').bind(item.id),
15
- ]));
16
- }
17
- return staged;
18
- }
19
- //# sourceMappingURL=item-08-promise-all-of-statements-in-loop.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item-08-promise-all-of-statements-in-loop.js","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-08-promise-all-of-statements-in-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,EAAO,EAAE,KAAgB;IACvD,MAAM,MAAM,GAAc,EAAE,CAAC;IAC7B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,CAAC,IAAI,CACT,MAAM,OAAO,CAAC,GAAG,CAAC;YAChB,EAAE,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7D,EAAE,CAAC,OAAO,CAAC,qCAAqC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;SAChE,CAAC,CACH,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Spec-52 R1 item 9 — Promise.all of a .map() of plain statements (oracle: MUST NOT fire).
3
- *
4
- * `Promise.all(rows.map(r => db.prepare(sql).bind(r)))` wraps *statement
5
- * objects* (no `.run()`/`.all()`/`.first()`), so nothing executes inside the
6
- * loop. The walk-up must cross the arrow function boundary and still recognise
7
- * `Promise.all` as the promise combinator, not the eager D1 `.all()`.
8
- */
9
- interface ItemRow {
10
- id: number;
11
- }
12
- export declare function stageMapped(db: any, rows: ItemRow[]): Promise<void>;
13
- export {};
14
- //# sourceMappingURL=item-09-promise-all-map-of-statements-in-loop.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item-09-promise-all-map-of-statements-in-loop.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-09-promise-all-map-of-statements-in-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,UAAU,OAAO;IACf,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,wBAAsB,WAAW,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAMzE"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Spec-52 R1 item 9 — Promise.all of a .map() of plain statements (oracle: MUST NOT fire).
3
- *
4
- * `Promise.all(rows.map(r => db.prepare(sql).bind(r)))` wraps *statement
5
- * objects* (no `.run()`/`.all()`/`.first()`), so nothing executes inside the
6
- * loop. The walk-up must cross the arrow function boundary and still recognise
7
- * `Promise.all` as the promise combinator, not the eager D1 `.all()`.
8
- */
9
- export async function stageMapped(db, rows) {
10
- for (const row of rows) {
11
- await Promise.all(rows.map((r) => db.prepare('SELECT id FROM items WHERE id = ?').bind(r.id)));
12
- }
13
- }
14
- //# sourceMappingURL=item-09-promise-all-map-of-statements-in-loop.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item-09-promise-all-map-of-statements-in-loop.js","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-09-promise-all-map-of-statements-in-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,EAAO,EAAE,IAAe;IACxD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,OAAO,CAAC,GAAG,CACf,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAC5E,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,15 +0,0 @@
1
- /**
2
- * Spec-52 R1 item 10 — Promise.all of a .map() of eager `.all()` calls (oracle: MUST fire).
3
- *
4
- * The discriminating positive for the Promise.all guard: `Promise.all` is a
5
- * promise combinator and must be *skipped*, but the eager D1 `.all()` on each
6
- * mapped statement still executes per row — a genuine N+1. Crossing the arrow
7
- * function to reach the eager method (and skip the combinator on the way) is
8
- * exactly what the guard must get right.
9
- */
10
- interface ItemRow {
11
- id: number;
12
- }
13
- export declare function fetchMapped(db: D1Database, rows: ItemRow[]): Promise<unknown[]>;
14
- export {};
15
- //# sourceMappingURL=item-10-promise-all-map-of-eager-all-in-loop.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item-10-promise-all-map-of-eager-all-in-loop.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,UAAU,OAAO;IACf,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,wBAAsB,WAAW,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAOrF"}
@@ -1,16 +0,0 @@
1
- /**
2
- * Spec-52 R1 item 10 — Promise.all of a .map() of eager `.all()` calls (oracle: MUST fire).
3
- *
4
- * The discriminating positive for the Promise.all guard: `Promise.all` is a
5
- * promise combinator and must be *skipped*, but the eager D1 `.all()` on each
6
- * mapped statement still executes per row — a genuine N+1. Crossing the arrow
7
- * function to reach the eager method (and skip the combinator on the way) is
8
- * exactly what the guard must get right.
9
- */
10
- export async function fetchMapped(db, rows) {
11
- for (const row of rows) {
12
- await Promise.all(rows.map((r) => db.prepare('SELECT id FROM items WHERE id = ?').bind(r.id).all()));
13
- }
14
- return [];
15
- }
16
- //# sourceMappingURL=item-10-promise-all-map-of-eager-all-in-loop.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item-10-promise-all-map-of-eager-all-in-loop.js","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,EAAc,EAAE,IAAe;IAC/D,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,OAAO,CAAC,GAAG,CACf,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAClF,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}