code-auditor-mcp 4.1.0 → 5.0.1

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 (1086) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +374 -0
  3. package/README.md +4 -4
  4. package/configs/hhra-compat.json +0 -8
  5. package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.d.ts +1 -1
  6. package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.d.ts.map +1 -1
  7. package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.js +7 -1
  8. package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.js.map +1 -1
  9. package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.d.ts +2 -8
  10. package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.d.ts.map +1 -1
  11. package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.js +4 -4
  12. package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.js.map +1 -1
  13. package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.d.ts +1 -1
  14. package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.d.ts.map +1 -1
  15. package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.js.map +1 -1
  16. package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.d.ts +2 -2
  17. package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.d.ts.map +1 -1
  18. package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.js.map +1 -1
  19. package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.d.ts +1 -1
  20. package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.d.ts.map +1 -1
  21. package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.js.map +1 -1
  22. package/dist/analyzers/applicability.d.ts +42 -0
  23. package/dist/analyzers/applicability.d.ts.map +1 -1
  24. package/dist/analyzers/applicability.js +74 -0
  25. package/dist/analyzers/applicability.js.map +1 -1
  26. package/dist/analyzers/cross-language/APIContractAnalyzer.js +18 -24
  27. package/dist/analyzers/cross-language/APIContractAnalyzer.js.map +1 -1
  28. package/dist/analyzers/cross-language/DependencyGraphBuilder.d.ts +30 -23
  29. package/dist/analyzers/cross-language/DependencyGraphBuilder.d.ts.map +1 -1
  30. package/dist/analyzers/cross-language/DependencyGraphBuilder.js +113 -76
  31. package/dist/analyzers/cross-language/DependencyGraphBuilder.js.map +1 -1
  32. package/dist/analyzers/cross-language/SchemaValidator.d.ts +2 -0
  33. package/dist/analyzers/cross-language/SchemaValidator.d.ts.map +1 -1
  34. package/dist/analyzers/cross-language/SchemaValidator.js +8 -3
  35. package/dist/analyzers/cross-language/SchemaValidator.js.map +1 -1
  36. package/dist/analyzers/crossDomain/CrossDomainAnalyzer.d.ts.map +1 -1
  37. package/dist/analyzers/crossDomain/CrossDomainAnalyzer.js +210 -148
  38. package/dist/analyzers/crossDomain/CrossDomainAnalyzer.js.map +1 -1
  39. package/dist/analyzers/documentationAnalyzer.d.ts.map +1 -1
  40. package/dist/analyzers/documentationAnalyzer.js +23 -28
  41. package/dist/analyzers/documentationAnalyzer.js.map +1 -1
  42. package/dist/analyzers/handleIdentification.d.ts +356 -0
  43. package/dist/analyzers/handleIdentification.d.ts.map +1 -0
  44. package/dist/analyzers/handleIdentification.js +424 -0
  45. package/dist/analyzers/handleIdentification.js.map +1 -0
  46. package/dist/analyzers/manifestStaleness.d.ts +64 -0
  47. package/dist/analyzers/manifestStaleness.d.ts.map +1 -0
  48. package/dist/analyzers/manifestStaleness.js +115 -0
  49. package/dist/analyzers/manifestStaleness.js.map +1 -0
  50. package/dist/analyzers/orgFilterTiers.d.ts +73 -1
  51. package/dist/analyzers/orgFilterTiers.d.ts.map +1 -1
  52. package/dist/analyzers/orgFilterTiers.js +166 -1
  53. package/dist/analyzers/orgFilterTiers.js.map +1 -1
  54. package/dist/analyzers/provenance.d.ts +251 -57
  55. package/dist/analyzers/provenance.d.ts.map +1 -1
  56. package/dist/analyzers/provenance.js +1109 -429
  57. package/dist/analyzers/provenance.js.map +1 -1
  58. package/dist/analyzers/reactAnalyzer.d.ts +2 -0
  59. package/dist/analyzers/reactAnalyzer.d.ts.map +1 -1
  60. package/dist/analyzers/reactAnalyzer.js +2 -0
  61. package/dist/analyzers/reactAnalyzer.js.map +1 -1
  62. package/dist/analyzers/receiverResolution.d.ts +183 -0
  63. package/dist/analyzers/receiverResolution.d.ts.map +1 -0
  64. package/dist/analyzers/receiverResolution.js +540 -0
  65. package/dist/analyzers/receiverResolution.js.map +1 -0
  66. package/dist/analyzers/receiverRoot.d.ts +328 -0
  67. package/dist/analyzers/receiverRoot.d.ts.map +1 -0
  68. package/dist/analyzers/receiverRoot.js +990 -0
  69. package/dist/analyzers/receiverRoot.js.map +1 -0
  70. package/dist/analyzers/ruleRegistry.d.ts +12 -68
  71. package/dist/analyzers/ruleRegistry.d.ts.map +1 -1
  72. package/dist/analyzers/ruleRegistry.js +32 -342
  73. package/dist/analyzers/ruleRegistry.js.map +1 -1
  74. package/dist/analyzers/ruleTiming.d.ts +10 -0
  75. package/dist/analyzers/ruleTiming.d.ts.map +1 -1
  76. package/dist/analyzers/ruleTiming.js +20 -0
  77. package/dist/analyzers/ruleTiming.js.map +1 -1
  78. package/dist/analyzers/sqlLiteral.d.ts +76 -0
  79. package/dist/analyzers/sqlLiteral.d.ts.map +1 -0
  80. package/dist/analyzers/sqlLiteral.js +419 -0
  81. package/dist/analyzers/sqlLiteral.js.map +1 -0
  82. package/dist/analyzers/tsEcosystem.d.ts +115 -0
  83. package/dist/analyzers/tsEcosystem.d.ts.map +1 -0
  84. package/dist/analyzers/tsEcosystem.js +231 -0
  85. package/dist/analyzers/tsEcosystem.js.map +1 -0
  86. package/dist/analyzers/tsExpressionDescriptor.d.ts +156 -0
  87. package/dist/analyzers/tsExpressionDescriptor.d.ts.map +1 -0
  88. package/dist/analyzers/tsExpressionDescriptor.js +374 -0
  89. package/dist/analyzers/tsExpressionDescriptor.js.map +1 -0
  90. package/dist/analyzers/universal/UniversalConventionsAnalyzer.d.ts +6 -0
  91. package/dist/analyzers/universal/UniversalConventionsAnalyzer.d.ts.map +1 -1
  92. package/dist/analyzers/universal/UniversalConventionsAnalyzer.js +107 -44
  93. package/dist/analyzers/universal/UniversalConventionsAnalyzer.js.map +1 -1
  94. package/dist/analyzers/universal/UniversalDRYAnalyzer.d.ts +1 -12
  95. package/dist/analyzers/universal/UniversalDRYAnalyzer.d.ts.map +1 -1
  96. package/dist/analyzers/universal/UniversalDRYAnalyzer.js +24 -101
  97. package/dist/analyzers/universal/UniversalDRYAnalyzer.js.map +1 -1
  98. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts +287 -49
  99. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts.map +1 -1
  100. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js +2130 -512
  101. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js.map +1 -1
  102. package/dist/analyzers/universal/UniversalDocumentationAnalyzer.d.ts.map +1 -1
  103. package/dist/analyzers/universal/UniversalDocumentationAnalyzer.js +2 -18
  104. package/dist/analyzers/universal/UniversalDocumentationAnalyzer.js.map +1 -1
  105. package/dist/analyzers/universal/UniversalSOLIDAnalyzer.d.ts +0 -33
  106. package/dist/analyzers/universal/UniversalSOLIDAnalyzer.d.ts.map +1 -1
  107. package/dist/analyzers/universal/UniversalSOLIDAnalyzer.js +20 -143
  108. package/dist/analyzers/universal/UniversalSOLIDAnalyzer.js.map +1 -1
  109. package/dist/analyzers/universal/UniversalSchemaAnalyzer.d.ts +4 -3
  110. package/dist/analyzers/universal/UniversalSchemaAnalyzer.d.ts.map +1 -1
  111. package/dist/analyzers/universal/UniversalSchemaAnalyzer.js +36 -13
  112. package/dist/analyzers/universal/UniversalSchemaAnalyzer.js.map +1 -1
  113. package/dist/analyzers/universal/UniversalSecretsAnalyzer.d.ts.map +1 -1
  114. package/dist/analyzers/universal/UniversalSecretsAnalyzer.js +6 -0
  115. package/dist/analyzers/universal/UniversalSecretsAnalyzer.js.map +1 -1
  116. package/dist/analyzers/universal/UniversalSecurityAnalyzer.d.ts +15 -0
  117. package/dist/analyzers/universal/UniversalSecurityAnalyzer.d.ts.map +1 -1
  118. package/dist/analyzers/universal/UniversalSecurityAnalyzer.js +25 -0
  119. package/dist/analyzers/universal/UniversalSecurityAnalyzer.js.map +1 -1
  120. package/dist/analyzers/universal/UniversalStylesAnalyzer.d.ts +21 -32
  121. package/dist/analyzers/universal/UniversalStylesAnalyzer.d.ts.map +1 -1
  122. package/dist/analyzers/universal/UniversalStylesAnalyzer.js +166 -196
  123. package/dist/analyzers/universal/UniversalStylesAnalyzer.js.map +1 -1
  124. package/dist/analyzers/universal/functionConcerns.d.ts +3 -0
  125. package/dist/analyzers/universal/functionConcerns.d.ts.map +1 -1
  126. package/dist/analyzers/universal/functionConcerns.js +4 -1
  127. package/dist/analyzers/universal/functionConcerns.js.map +1 -1
  128. package/dist/analyzers/universal/schema/codeAnalysis.d.ts +310 -69
  129. package/dist/analyzers/universal/schema/codeAnalysis.d.ts.map +1 -1
  130. package/dist/analyzers/universal/schema/codeAnalysis.js +709 -383
  131. package/dist/analyzers/universal/schema/codeAnalysis.js.map +1 -1
  132. package/dist/analyzers/universal/schema/config.d.ts +3 -14
  133. package/dist/analyzers/universal/schema/config.d.ts.map +1 -1
  134. package/dist/analyzers/universal/schema/config.js +3 -16
  135. package/dist/analyzers/universal/schema/config.js.map +1 -1
  136. package/dist/analyzers/universal/schema/discovery.d.ts +22 -1
  137. package/dist/analyzers/universal/schema/discovery.d.ts.map +1 -1
  138. package/dist/analyzers/universal/schema/discovery.js +36 -20
  139. package/dist/analyzers/universal/schema/discovery.js.map +1 -1
  140. package/dist/analyzers/universal/schema/jsonSchema.d.ts.map +1 -1
  141. package/dist/analyzers/universal/schema/jsonSchema.js +13 -3
  142. package/dist/analyzers/universal/schema/jsonSchema.js.map +1 -1
  143. package/dist/analyzers/universal/schema/migrations.d.ts +187 -27
  144. package/dist/analyzers/universal/schema/migrations.d.ts.map +1 -1
  145. package/dist/analyzers/universal/schema/migrations.js +443 -186
  146. package/dist/analyzers/universal/schema/migrations.js.map +1 -1
  147. package/dist/analyzers/universal/schema/types.d.ts +17 -3
  148. package/dist/analyzers/universal/schema/types.d.ts.map +1 -1
  149. package/dist/analyzers/universal/schema/violations.js +1 -1
  150. package/dist/analyzers/universal/schema/violations.js.map +1 -1
  151. package/dist/analyzers/universal/styleScale.d.ts +52 -0
  152. package/dist/analyzers/universal/styleScale.d.ts.map +1 -0
  153. package/dist/analyzers/universal/styleScale.js +95 -0
  154. package/dist/analyzers/universal/styleScale.js.map +1 -0
  155. package/dist/applyDataDirEnv.js +1 -1
  156. package/dist/applyDataDirEnv.js.map +1 -1
  157. package/dist/auditRouter.d.ts +26 -30
  158. package/dist/auditRouter.d.ts.map +1 -1
  159. package/dist/auditRouter.js +373 -143
  160. package/dist/auditRouter.js.map +1 -1
  161. package/dist/auditRunner.d.ts +64 -1
  162. package/dist/auditRunner.d.ts.map +1 -1
  163. package/dist/auditRunner.js +1537 -1051
  164. package/dist/auditRunner.js.map +1 -1
  165. package/dist/baseline.d.ts +30 -3
  166. package/dist/baseline.d.ts.map +1 -1
  167. package/dist/baseline.js +70 -9
  168. package/dist/baseline.js.map +1 -1
  169. package/dist/cli.js +997 -812
  170. package/dist/cli.js.map +1 -1
  171. package/dist/codeIndex/analyzerConfig.d.ts +60 -0
  172. package/dist/codeIndex/analyzerConfig.d.ts.map +1 -0
  173. package/dist/codeIndex/analyzerConfig.js +98 -0
  174. package/dist/codeIndex/analyzerConfig.js.map +1 -0
  175. package/dist/codeIndex/auditResults.d.ts +39 -0
  176. package/dist/codeIndex/auditResults.d.ts.map +1 -0
  177. package/dist/codeIndex/auditResults.js +99 -0
  178. package/dist/codeIndex/auditResults.js.map +1 -0
  179. package/dist/codeIndex/codeMap.d.ts +59 -0
  180. package/dist/codeIndex/codeMap.d.ts.map +1 -0
  181. package/dist/codeIndex/codeMap.js +72 -0
  182. package/dist/codeIndex/codeMap.js.map +1 -0
  183. package/dist/codeIndex/conventions.d.ts +33 -0
  184. package/dist/codeIndex/conventions.d.ts.map +1 -0
  185. package/dist/codeIndex/conventions.js +84 -0
  186. package/dist/codeIndex/conventions.js.map +1 -0
  187. package/dist/codeIndex/coverage.d.ts +78 -0
  188. package/dist/codeIndex/coverage.d.ts.map +1 -0
  189. package/dist/codeIndex/coverage.js +164 -0
  190. package/dist/codeIndex/coverage.js.map +1 -0
  191. package/dist/codeIndex/dependencyGraph.d.ts +97 -0
  192. package/dist/codeIndex/dependencyGraph.d.ts.map +1 -0
  193. package/dist/codeIndex/dependencyGraph.js +241 -0
  194. package/dist/codeIndex/dependencyGraph.js.map +1 -0
  195. package/dist/codeIndex/functionIndex.d.ts +111 -0
  196. package/dist/codeIndex/functionIndex.d.ts.map +1 -0
  197. package/dist/codeIndex/functionIndex.js +306 -0
  198. package/dist/codeIndex/functionIndex.js.map +1 -0
  199. package/dist/codeIndex/inferredReceivers.d.ts +32 -0
  200. package/dist/codeIndex/inferredReceivers.d.ts.map +1 -0
  201. package/dist/codeIndex/inferredReceivers.js +41 -0
  202. package/dist/codeIndex/inferredReceivers.js.map +1 -0
  203. package/dist/codeIndex/meta.d.ts +30 -0
  204. package/dist/codeIndex/meta.d.ts.map +1 -0
  205. package/dist/codeIndex/meta.js +37 -0
  206. package/dist/codeIndex/meta.js.map +1 -0
  207. package/dist/codeIndex/migrations.d.ts +96 -0
  208. package/dist/codeIndex/migrations.d.ts.map +1 -0
  209. package/dist/codeIndex/migrations.js +1302 -0
  210. package/dist/codeIndex/migrations.js.map +1 -0
  211. package/dist/codeIndex/projectTasks.d.ts +54 -0
  212. package/dist/codeIndex/projectTasks.d.ts.map +1 -0
  213. package/dist/codeIndex/projectTasks.js +81 -0
  214. package/dist/codeIndex/projectTasks.js.map +1 -0
  215. package/dist/codeIndex/provenance.d.ts +47 -0
  216. package/dist/codeIndex/provenance.d.ts.map +1 -0
  217. package/dist/codeIndex/provenance.js +48 -0
  218. package/dist/codeIndex/provenance.js.map +1 -0
  219. package/dist/codeIndex/rawSql.d.ts +54 -0
  220. package/dist/codeIndex/rawSql.d.ts.map +1 -0
  221. package/dist/codeIndex/rawSql.js +71 -0
  222. package/dist/codeIndex/rawSql.js.map +1 -0
  223. package/dist/codeIndex/schema.d.ts +99 -0
  224. package/dist/codeIndex/schema.d.ts.map +1 -0
  225. package/dist/codeIndex/schema.js +174 -0
  226. package/dist/codeIndex/schema.js.map +1 -0
  227. package/dist/codeIndex/search.d.ts +40 -0
  228. package/dist/codeIndex/search.d.ts.map +1 -0
  229. package/dist/codeIndex/search.js +316 -0
  230. package/dist/codeIndex/search.js.map +1 -0
  231. package/dist/codeIndex/shared.d.ts +27 -0
  232. package/dist/codeIndex/shared.d.ts.map +1 -0
  233. package/dist/codeIndex/shared.js +46 -0
  234. package/dist/codeIndex/shared.js.map +1 -0
  235. package/dist/codeIndex/sqliteCollection.d.ts +81 -0
  236. package/dist/codeIndex/sqliteCollection.d.ts.map +1 -0
  237. package/dist/codeIndex/sqliteCollection.js +250 -0
  238. package/dist/codeIndex/sqliteCollection.js.map +1 -0
  239. package/dist/codeIndex/whitelist.d.ts +59 -0
  240. package/dist/codeIndex/whitelist.d.ts.map +1 -0
  241. package/dist/codeIndex/whitelist.js +188 -0
  242. package/dist/codeIndex/whitelist.js.map +1 -0
  243. package/dist/codeIndexDB.d.ts +130 -277
  244. package/dist/codeIndexDB.d.ts.map +1 -1
  245. package/dist/codeIndexDB.js +364 -2748
  246. package/dist/codeIndexDB.js.map +1 -1
  247. package/dist/codeIndexService.d.ts +87 -12
  248. package/dist/codeIndexService.d.ts.map +1 -1
  249. package/dist/codeIndexService.js +110 -34
  250. package/dist/codeIndexService.js.map +1 -1
  251. package/dist/componentScanner.d.ts +35 -0
  252. package/dist/componentScanner.d.ts.map +1 -1
  253. package/dist/componentScanner.js +114 -80
  254. package/dist/componentScanner.js.map +1 -1
  255. package/dist/config/configGeneratePath.d.ts +4 -0
  256. package/dist/config/configGeneratePath.d.ts.map +1 -1
  257. package/dist/config/configGeneratePath.js +4 -0
  258. package/dist/config/configGeneratePath.js.map +1 -1
  259. package/dist/config/configLoader.d.ts +16 -1
  260. package/dist/config/configLoader.d.ts.map +1 -1
  261. package/dist/config/configLoader.js +26 -23
  262. package/dist/config/configLoader.js.map +1 -1
  263. package/dist/config/defaults.d.ts +11 -7
  264. package/dist/config/defaults.d.ts.map +1 -1
  265. package/dist/config/defaults.js +21 -20
  266. package/dist/config/defaults.js.map +1 -1
  267. package/dist/config/effectiveConfig.d.ts +17 -2
  268. package/dist/config/effectiveConfig.d.ts.map +1 -1
  269. package/dist/config/effectiveConfig.js +32 -25
  270. package/dist/config/effectiveConfig.js.map +1 -1
  271. package/dist/config/lintConfigReader.d.ts +6 -0
  272. package/dist/config/lintConfigReader.d.ts.map +1 -1
  273. package/dist/config/lintConfigReader.js +6 -0
  274. package/dist/config/lintConfigReader.js.map +1 -1
  275. package/dist/config/staticObjectExtract.d.ts +4 -0
  276. package/dist/config/staticObjectExtract.d.ts.map +1 -1
  277. package/dist/config/staticObjectExtract.js +7 -3
  278. package/dist/config/staticObjectExtract.js.map +1 -1
  279. package/dist/config/thresholdRationales.d.ts +2 -0
  280. package/dist/config/thresholdRationales.d.ts.map +1 -1
  281. package/dist/config/thresholdRationales.js +5 -2
  282. package/dist/config/thresholdRationales.js.map +1 -1
  283. package/dist/constants.d.ts +1 -1
  284. package/dist/constants.d.ts.map +1 -1
  285. package/dist/constants.js +10 -5
  286. package/dist/constants.js.map +1 -1
  287. package/dist/conventions/conventionMiner.d.ts +105 -2
  288. package/dist/conventions/conventionMiner.d.ts.map +1 -1
  289. package/dist/conventions/conventionMiner.js +334 -259
  290. package/dist/conventions/conventionMiner.js.map +1 -1
  291. package/dist/coverage/coverageService.js +4 -4
  292. package/dist/coverage/coverageService.js.map +1 -1
  293. package/dist/daemon/args.d.ts +3 -0
  294. package/dist/daemon/args.d.ts.map +1 -1
  295. package/dist/daemon/args.js +3 -0
  296. package/dist/daemon/args.js.map +1 -1
  297. package/dist/daemon/core.d.ts +33 -27
  298. package/dist/daemon/core.d.ts.map +1 -1
  299. package/dist/daemon/core.js +198 -162
  300. package/dist/daemon/core.js.map +1 -1
  301. package/dist/daemon/lspServer.d.ts +8 -0
  302. package/dist/daemon/lspServer.d.ts.map +1 -1
  303. package/dist/daemon/lspServer.js +8 -0
  304. package/dist/daemon/lspServer.js.map +1 -1
  305. package/dist/daemon/main.d.ts +2 -0
  306. package/dist/daemon/main.d.ts.map +1 -1
  307. package/dist/daemon/main.js +2 -0
  308. package/dist/daemon/main.js.map +1 -1
  309. package/dist/daemon/resolve.d.ts +22 -7
  310. package/dist/daemon/resolve.d.ts.map +1 -1
  311. package/dist/daemon/resolve.js +29 -8
  312. package/dist/daemon/resolve.js.map +1 -1
  313. package/dist/daemon/socketClient.d.ts +10 -1
  314. package/dist/daemon/socketClient.d.ts.map +1 -1
  315. package/dist/daemon/socketClient.js +10 -1
  316. package/dist/daemon/socketClient.js.map +1 -1
  317. package/dist/daemon/socketServer.d.ts +13 -0
  318. package/dist/daemon/socketServer.d.ts.map +1 -1
  319. package/dist/daemon/socketServer.js +13 -0
  320. package/dist/daemon/socketServer.js.map +1 -1
  321. package/dist/dataPaths.d.ts +27 -8
  322. package/dist/dataPaths.d.ts.map +1 -1
  323. package/dist/dataPaths.js +28 -44
  324. package/dist/dataPaths.js.map +1 -1
  325. package/dist/dismissals.d.ts +22 -1
  326. package/dist/dismissals.d.ts.map +1 -1
  327. package/dist/dismissals.js +22 -1
  328. package/dist/dismissals.js.map +1 -1
  329. package/dist/enforcement/gate.d.ts +1 -0
  330. package/dist/enforcement/gate.d.ts.map +1 -1
  331. package/dist/enforcement/gate.js +1 -0
  332. package/dist/enforcement/gate.js.map +1 -1
  333. package/dist/fingerprint.d.ts +6 -0
  334. package/dist/fingerprint.d.ts.map +1 -1
  335. package/dist/fingerprint.js +46 -1
  336. package/dist/fingerprint.js.map +1 -1
  337. package/dist/functionScanner.d.ts +30 -1
  338. package/dist/functionScanner.d.ts.map +1 -1
  339. package/dist/functionScanner.js +258 -256
  340. package/dist/functionScanner.js.map +1 -1
  341. package/dist/generators/AWSQConfigGenerator.d.ts +23 -0
  342. package/dist/generators/AWSQConfigGenerator.d.ts.map +1 -1
  343. package/dist/generators/AWSQConfigGenerator.js +23 -0
  344. package/dist/generators/AWSQConfigGenerator.js.map +1 -1
  345. package/dist/generators/BaseConfigGenerator.d.ts +7 -0
  346. package/dist/generators/BaseConfigGenerator.d.ts.map +1 -1
  347. package/dist/generators/BaseConfigGenerator.js +7 -0
  348. package/dist/generators/BaseConfigGenerator.js.map +1 -1
  349. package/dist/generators/ClaudeConfigGenerator.d.ts +23 -0
  350. package/dist/generators/ClaudeConfigGenerator.d.ts.map +1 -1
  351. package/dist/generators/ClaudeConfigGenerator.js +23 -0
  352. package/dist/generators/ClaudeConfigGenerator.js.map +1 -1
  353. package/dist/generators/ClineConfigGenerator.d.ts +23 -0
  354. package/dist/generators/ClineConfigGenerator.d.ts.map +1 -1
  355. package/dist/generators/ClineConfigGenerator.js +23 -0
  356. package/dist/generators/ClineConfigGenerator.js.map +1 -1
  357. package/dist/generators/CodeiumConfigGenerator.d.ts +23 -0
  358. package/dist/generators/CodeiumConfigGenerator.d.ts.map +1 -1
  359. package/dist/generators/CodeiumConfigGenerator.js +23 -0
  360. package/dist/generators/CodeiumConfigGenerator.js.map +1 -1
  361. package/dist/generators/CodexConfigGenerator.d.ts +23 -0
  362. package/dist/generators/CodexConfigGenerator.d.ts.map +1 -1
  363. package/dist/generators/CodexConfigGenerator.js +23 -0
  364. package/dist/generators/CodexConfigGenerator.js.map +1 -1
  365. package/dist/generators/ConfigGeneratorFactory.d.ts +9 -0
  366. package/dist/generators/ConfigGeneratorFactory.d.ts.map +1 -1
  367. package/dist/generators/ConfigGeneratorFactory.js +9 -0
  368. package/dist/generators/ConfigGeneratorFactory.js.map +1 -1
  369. package/dist/generators/ContinueConfigGenerator.d.ts +23 -0
  370. package/dist/generators/ContinueConfigGenerator.d.ts.map +1 -1
  371. package/dist/generators/ContinueConfigGenerator.js +23 -0
  372. package/dist/generators/ContinueConfigGenerator.js.map +1 -1
  373. package/dist/generators/CopilotConfigGenerator.d.ts +23 -0
  374. package/dist/generators/CopilotConfigGenerator.d.ts.map +1 -1
  375. package/dist/generators/CopilotConfigGenerator.js +23 -0
  376. package/dist/generators/CopilotConfigGenerator.js.map +1 -1
  377. package/dist/generators/CursorConfigGenerator.d.ts +23 -0
  378. package/dist/generators/CursorConfigGenerator.d.ts.map +1 -1
  379. package/dist/generators/CursorConfigGenerator.js +23 -0
  380. package/dist/generators/CursorConfigGenerator.js.map +1 -1
  381. package/dist/generators/GeminiConfigGenerator.d.ts +23 -0
  382. package/dist/generators/GeminiConfigGenerator.d.ts.map +1 -1
  383. package/dist/generators/GeminiConfigGenerator.js +23 -0
  384. package/dist/generators/GeminiConfigGenerator.js.map +1 -1
  385. package/dist/generators/VSCodeConfigGenerator.d.ts +23 -0
  386. package/dist/generators/VSCodeConfigGenerator.d.ts.map +1 -1
  387. package/dist/generators/VSCodeConfigGenerator.js +23 -0
  388. package/dist/generators/VSCodeConfigGenerator.js.map +1 -1
  389. package/dist/generators/ZCodeConfigGenerator.d.ts +23 -0
  390. package/dist/generators/ZCodeConfigGenerator.d.ts.map +1 -1
  391. package/dist/generators/ZCodeConfigGenerator.js +23 -0
  392. package/dist/generators/ZCodeConfigGenerator.js.map +1 -1
  393. package/dist/graph/blastRadius.d.ts.map +1 -1
  394. package/dist/graph/blastRadius.js +12 -7
  395. package/dist/graph/blastRadius.js.map +1 -1
  396. package/dist/graph/callGraph.d.ts +31 -0
  397. package/dist/graph/callGraph.d.ts.map +1 -1
  398. package/dist/graph/callGraph.js +62 -32
  399. package/dist/graph/callGraph.js.map +1 -1
  400. package/dist/graph/importClassification.d.ts +28 -0
  401. package/dist/graph/importClassification.d.ts.map +1 -1
  402. package/dist/graph/importClassification.js +57 -0
  403. package/dist/graph/importClassification.js.map +1 -1
  404. package/dist/graph/importGraph.d.ts +38 -0
  405. package/dist/graph/importGraph.d.ts.map +1 -1
  406. package/dist/graph/importGraph.js +38 -0
  407. package/dist/graph/importGraph.js.map +1 -1
  408. package/dist/graph/outputFormatter.d.ts +12 -4
  409. package/dist/graph/outputFormatter.d.ts.map +1 -1
  410. package/dist/graph/outputFormatter.js +12 -62
  411. package/dist/graph/outputFormatter.js.map +1 -1
  412. package/dist/hooks/codex.d.ts +8 -1
  413. package/dist/hooks/codex.d.ts.map +1 -1
  414. package/dist/hooks/codex.js +7 -0
  415. package/dist/hooks/codex.js.map +1 -1
  416. package/dist/hooks/core.d.ts +6 -0
  417. package/dist/hooks/core.d.ts.map +1 -1
  418. package/dist/hooks/core.js +6 -1
  419. package/dist/hooks/core.js.map +1 -1
  420. package/dist/hooks/cursor.d.ts +11 -1
  421. package/dist/hooks/cursor.d.ts.map +1 -1
  422. package/dist/hooks/cursor.js +10 -0
  423. package/dist/hooks/cursor.js.map +1 -1
  424. package/dist/index.d.ts +4 -0
  425. package/dist/index.d.ts.map +1 -1
  426. package/dist/index.js +4 -0
  427. package/dist/index.js.map +1 -1
  428. package/dist/installConfig.d.ts +23 -5
  429. package/dist/installConfig.d.ts.map +1 -1
  430. package/dist/installConfig.js +23 -5
  431. package/dist/installConfig.js.map +1 -1
  432. package/dist/installer.d.ts +6 -0
  433. package/dist/installer.d.ts.map +1 -1
  434. package/dist/installer.js +6 -0
  435. package/dist/installer.js.map +1 -1
  436. package/dist/invariants/ruleEngine.d.ts +3 -0
  437. package/dist/invariants/ruleEngine.d.ts.map +1 -1
  438. package/dist/invariants/ruleEngine.js +156 -119
  439. package/dist/invariants/ruleEngine.js.map +1 -1
  440. package/dist/invariants/ruleValidator.d.ts +3 -0
  441. package/dist/invariants/ruleValidator.d.ts.map +1 -1
  442. package/dist/invariants/ruleValidator.js +185 -178
  443. package/dist/invariants/ruleValidator.js.map +1 -1
  444. package/dist/languages/LanguageOrchestrator.d.ts +4 -1
  445. package/dist/languages/LanguageOrchestrator.d.ts.map +1 -1
  446. package/dist/languages/LanguageOrchestrator.js +8 -19
  447. package/dist/languages/LanguageOrchestrator.js.map +1 -1
  448. package/dist/languages/RuntimeManager.d.ts +8 -0
  449. package/dist/languages/RuntimeManager.d.ts.map +1 -1
  450. package/dist/languages/RuntimeManager.js +55 -5
  451. package/dist/languages/RuntimeManager.js.map +1 -1
  452. package/dist/languages/UniversalAnalyzer.js +1 -1
  453. package/dist/languages/UniversalAnalyzer.js.map +1 -1
  454. package/dist/languages/adapterBridge.d.ts +4 -0
  455. package/dist/languages/adapterBridge.d.ts.map +1 -1
  456. package/dist/languages/adapterBridge.js +37 -3
  457. package/dist/languages/adapterBridge.js.map +1 -1
  458. package/dist/languages/go/GoAdapter.d.ts.map +1 -1
  459. package/dist/languages/go/GoAdapter.js +11 -14
  460. package/dist/languages/go/GoAdapter.js.map +1 -1
  461. package/dist/languages/go/analyzer-darwin-amd64 +0 -0
  462. package/dist/languages/go/analyzer-darwin-arm64 +0 -0
  463. package/dist/languages/go/analyzer-linux-amd64 +0 -0
  464. package/dist/languages/go/analyzer-linux-arm64 +0 -0
  465. package/dist/languages/go/analyzer-src/analyzer.go +2 -0
  466. package/dist/languages/go/analyzer-src/dataaccess.go +388 -0
  467. package/dist/languages/go/analyzer-src/types.go +8 -0
  468. package/dist/languages/go/analyzer-windows-amd64.exe +0 -0
  469. package/dist/languages/go/database-packages.json +8 -0
  470. package/dist/languages/go/goResolution.d.ts +229 -0
  471. package/dist/languages/go/goResolution.d.ts.map +1 -0
  472. package/dist/languages/go/goResolution.js +799 -0
  473. package/dist/languages/go/goResolution.js.map +1 -0
  474. package/dist/languages/go/stdlib-packages.json +353 -0
  475. package/dist/languages/go/tenantInputs.d.ts +37 -0
  476. package/dist/languages/go/tenantInputs.d.ts.map +1 -0
  477. package/dist/languages/go/tenantInputs.js +121 -0
  478. package/dist/languages/go/tenantInputs.js.map +1 -0
  479. package/dist/languages/index.d.ts +1 -0
  480. package/dist/languages/index.d.ts.map +1 -1
  481. package/dist/languages/index.js +5 -0
  482. package/dist/languages/index.js.map +1 -1
  483. package/dist/languages/json/JsonAdapter.d.ts +177 -0
  484. package/dist/languages/json/JsonAdapter.d.ts.map +1 -0
  485. package/dist/languages/json/JsonAdapter.js +531 -0
  486. package/dist/languages/json/JsonAdapter.js.map +1 -0
  487. package/dist/languages/locationIndex.d.ts +41 -0
  488. package/dist/languages/locationIndex.d.ts.map +1 -0
  489. package/dist/languages/locationIndex.js +42 -0
  490. package/dist/languages/locationIndex.js.map +1 -0
  491. package/dist/languages/sql/dialectDetection.d.ts +57 -0
  492. package/dist/languages/sql/dialectDetection.d.ts.map +1 -0
  493. package/dist/languages/sql/dialectDetection.js +135 -0
  494. package/dist/languages/sql/dialectDetection.js.map +1 -0
  495. package/dist/languages/sql/sqlAst.d.ts +494 -0
  496. package/dist/languages/sql/sqlAst.d.ts.map +1 -0
  497. package/dist/languages/sql/sqlAst.js +1817 -0
  498. package/dist/languages/sql/sqlAst.js.map +1 -0
  499. package/dist/languages/testConventions.d.ts +12 -1
  500. package/dist/languages/testConventions.d.ts.map +1 -1
  501. package/dist/languages/testConventions.js +13 -1
  502. package/dist/languages/testConventions.js.map +1 -1
  503. package/dist/languages/tree-sitter/TreeSitterCssAdapter.js +1 -1
  504. package/dist/languages/tree-sitter/TreeSitterCssAdapter.js.map +1 -1
  505. package/dist/languages/tree-sitter/converter.js +2 -2
  506. package/dist/languages/tree-sitter/converter.js.map +1 -1
  507. package/dist/languages/tree-sitter/parser.d.ts +3 -4
  508. package/dist/languages/tree-sitter/parser.d.ts.map +1 -1
  509. package/dist/languages/tree-sitter/parser.js +10 -4
  510. package/dist/languages/tree-sitter/parser.js.map +1 -1
  511. package/dist/languages/tree-sitter/rawNode.d.ts +3 -0
  512. package/dist/languages/tree-sitter/rawNode.d.ts.map +1 -1
  513. package/dist/languages/tree-sitter/rawNode.js +3 -0
  514. package/dist/languages/tree-sitter/rawNode.js.map +1 -1
  515. package/dist/languages/types.d.ts +7 -0
  516. package/dist/languages/types.d.ts.map +1 -1
  517. package/dist/languages/typescript/TreeSitterTypeScriptAdapter.d.ts +36 -0
  518. package/dist/languages/typescript/TreeSitterTypeScriptAdapter.d.ts.map +1 -1
  519. package/dist/languages/typescript/TreeSitterTypeScriptAdapter.js +168 -45
  520. package/dist/languages/typescript/TreeSitterTypeScriptAdapter.js.map +1 -1
  521. package/dist/languages/typescript/database-packages.json +19 -0
  522. package/dist/ledger.d.ts +118 -2
  523. package/dist/ledger.d.ts.map +1 -1
  524. package/dist/ledger.js +167 -45
  525. package/dist/ledger.js.map +1 -1
  526. package/dist/legacyIndexNotice.d.ts +32 -0
  527. package/dist/legacyIndexNotice.d.ts.map +1 -0
  528. package/dist/legacyIndexNotice.js +89 -0
  529. package/dist/legacyIndexNotice.js.map +1 -0
  530. package/dist/mcp-tools/discoveryQueries.d.ts +55 -0
  531. package/dist/mcp-tools/discoveryQueries.d.ts.map +1 -0
  532. package/dist/mcp-tools/discoveryQueries.js +157 -0
  533. package/dist/mcp-tools/discoveryQueries.js.map +1 -0
  534. package/dist/mcp-tools/projectTasks.d.ts +9 -123
  535. package/dist/mcp-tools/projectTasks.d.ts.map +1 -1
  536. package/dist/mcp-tools/projectTasks.js +180 -170
  537. package/dist/mcp-tools/projectTasks.js.map +1 -1
  538. package/dist/mcp-tools/whitelistTools.d.ts +20 -0
  539. package/dist/mcp-tools/whitelistTools.d.ts.map +1 -1
  540. package/dist/mcp-tools/whitelistTools.js +20 -0
  541. package/dist/mcp-tools/whitelistTools.js.map +1 -1
  542. package/dist/mcp-tools/workflowGuide.d.ts +9 -0
  543. package/dist/mcp-tools/workflowGuide.d.ts.map +1 -1
  544. package/dist/mcp-tools/workflowGuide.js +13 -5
  545. package/dist/mcp-tools/workflowGuide.js.map +1 -1
  546. package/dist/mcp-tools-shared.d.ts +78 -0
  547. package/dist/mcp-tools-shared.d.ts.map +1 -1
  548. package/dist/mcp-tools-shared.js +203 -340
  549. package/dist/mcp-tools-shared.js.map +1 -1
  550. package/dist/mcp-ui-simple.d.ts +2 -0
  551. package/dist/mcp-ui-simple.d.ts.map +1 -1
  552. package/dist/mcp-ui-simple.js +12 -5
  553. package/dist/mcp-ui-simple.js.map +1 -1
  554. package/dist/mcp.d.ts +6 -0
  555. package/dist/mcp.d.ts.map +1 -1
  556. package/dist/mcp.js +832 -851
  557. package/dist/mcp.js.map +1 -1
  558. package/dist/mcpAuditJobs.d.ts +29 -33
  559. package/dist/mcpAuditJobs.d.ts.map +1 -1
  560. package/dist/mcpAuditJobs.js +102 -791
  561. package/dist/mcpAuditJobs.js.map +1 -1
  562. package/dist/mcpAutoIndex.d.ts +5 -0
  563. package/dist/mcpAutoIndex.d.ts.map +1 -1
  564. package/dist/mcpAutoIndex.js +7 -2
  565. package/dist/mcpAutoIndex.js.map +1 -1
  566. package/dist/mcpDiagnostics.d.ts +7 -0
  567. package/dist/mcpDiagnostics.d.ts.map +1 -1
  568. package/dist/mcpDiagnostics.js +34 -9
  569. package/dist/mcpDiagnostics.js.map +1 -1
  570. package/dist/mcpToolErrors.d.ts +16 -0
  571. package/dist/mcpToolErrors.d.ts.map +1 -1
  572. package/dist/mcpToolErrors.js +16 -0
  573. package/dist/mcpToolErrors.js.map +1 -1
  574. package/dist/nextFile.d.ts +6 -0
  575. package/dist/nextFile.d.ts.map +1 -1
  576. package/dist/nextFile.js +6 -0
  577. package/dist/nextFile.js.map +1 -1
  578. package/dist/nextFileIncremental.d.ts +44 -4
  579. package/dist/nextFileIncremental.d.ts.map +1 -1
  580. package/dist/nextFileIncremental.js +47 -7
  581. package/dist/nextFileIncremental.js.map +1 -1
  582. package/dist/phase/batchFunctions.d.ts +38 -0
  583. package/dist/phase/batchFunctions.d.ts.map +1 -0
  584. package/dist/phase/batchFunctions.js +64 -0
  585. package/dist/phase/batchFunctions.js.map +1 -0
  586. package/dist/phase/checks.d.ts +39 -0
  587. package/dist/phase/checks.d.ts.map +1 -0
  588. package/dist/phase/checks.js +48 -0
  589. package/dist/phase/checks.js.map +1 -0
  590. package/dist/phase/codeBlocks.d.ts +25 -0
  591. package/dist/phase/codeBlocks.d.ts.map +1 -0
  592. package/dist/phase/codeBlocks.js +268 -0
  593. package/dist/phase/codeBlocks.js.map +1 -0
  594. package/dist/phase/colorMath.d.ts +41 -0
  595. package/dist/phase/colorMath.d.ts.map +1 -0
  596. package/dist/phase/colorMath.js +109 -0
  597. package/dist/phase/colorMath.js.map +1 -0
  598. package/dist/phase/config.d.ts +29 -0
  599. package/dist/phase/config.d.ts.map +1 -0
  600. package/dist/phase/config.js +54 -0
  601. package/dist/phase/config.js.map +1 -0
  602. package/dist/phase/consumed.d.ts +47 -0
  603. package/dist/phase/consumed.d.ts.map +1 -0
  604. package/dist/phase/consumed.js +22 -0
  605. package/dist/phase/consumed.js.map +1 -0
  606. package/dist/phase/conventionMining.d.ts +59 -0
  607. package/dist/phase/conventionMining.d.ts.map +1 -0
  608. package/dist/phase/conventionMining.js +152 -0
  609. package/dist/phase/conventionMining.js.map +1 -0
  610. package/dist/phase/coverage.d.ts +65 -0
  611. package/dist/phase/coverage.d.ts.map +1 -0
  612. package/dist/phase/coverage.js +121 -0
  613. package/dist/phase/coverage.js.map +1 -0
  614. package/dist/phase/dag.d.ts +49 -0
  615. package/dist/phase/dag.d.ts.map +1 -0
  616. package/dist/phase/dag.js +120 -0
  617. package/dist/phase/dag.js.map +1 -0
  618. package/dist/phase/dataAccessCalls.d.ts +33 -0
  619. package/dist/phase/dataAccessCalls.d.ts.map +1 -0
  620. package/dist/phase/dataAccessCalls.js +42 -0
  621. package/dist/phase/dataAccessCalls.js.map +1 -0
  622. package/dist/phase/dataAccessCallsCandidates.d.ts +25 -0
  623. package/dist/phase/dataAccessCallsCandidates.d.ts.map +1 -0
  624. package/dist/phase/dataAccessCallsCandidates.js +27 -0
  625. package/dist/phase/dataAccessCallsCandidates.js.map +1 -0
  626. package/dist/phase/dynamicSql.d.ts +18 -0
  627. package/dist/phase/dynamicSql.d.ts.map +1 -0
  628. package/dist/phase/dynamicSql.js +20 -0
  629. package/dist/phase/dynamicSql.js.map +1 -0
  630. package/dist/phase/exportForm.d.ts +23 -0
  631. package/dist/phase/exportForm.d.ts.map +1 -0
  632. package/dist/phase/exportForm.js +29 -0
  633. package/dist/phase/exportForm.js.map +1 -0
  634. package/dist/phase/exportSymbols.d.ts +21 -0
  635. package/dist/phase/exportSymbols.d.ts.map +1 -0
  636. package/dist/phase/exportSymbols.js +28 -0
  637. package/dist/phase/exportSymbols.js.map +1 -0
  638. package/dist/phase/fileHeader.d.ts +15 -0
  639. package/dist/phase/fileHeader.d.ts.map +1 -0
  640. package/dist/phase/fileHeader.js +33 -0
  641. package/dist/phase/fileHeader.js.map +1 -0
  642. package/dist/phase/fileImports.d.ts +39 -0
  643. package/dist/phase/fileImports.d.ts.map +1 -0
  644. package/dist/phase/fileImports.js +138 -0
  645. package/dist/phase/fileImports.js.map +1 -0
  646. package/dist/phase/fileSymbols.d.ts +25 -0
  647. package/dist/phase/fileSymbols.d.ts.map +1 -0
  648. package/dist/phase/fileSymbols.js +302 -0
  649. package/dist/phase/fileSymbols.js.map +1 -0
  650. package/dist/phase/functionBodies.d.ts +28 -0
  651. package/dist/phase/functionBodies.d.ts.map +1 -0
  652. package/dist/phase/functionBodies.js +67 -0
  653. package/dist/phase/functionBodies.js.map +1 -0
  654. package/dist/phase/functionIndex.d.ts +28 -0
  655. package/dist/phase/functionIndex.d.ts.map +1 -0
  656. package/dist/phase/functionIndex.js +152 -0
  657. package/dist/phase/functionIndex.js.map +1 -0
  658. package/dist/phase/goFunctionAnalysis.d.ts +47 -0
  659. package/dist/phase/goFunctionAnalysis.d.ts.map +1 -0
  660. package/dist/phase/goFunctionAnalysis.js +291 -0
  661. package/dist/phase/goFunctionAnalysis.js.map +1 -0
  662. package/dist/phase/goFunctions.d.ts +38 -0
  663. package/dist/phase/goFunctions.d.ts.map +1 -0
  664. package/dist/phase/goFunctions.js +154 -0
  665. package/dist/phase/goFunctions.js.map +1 -0
  666. package/dist/phase/goImports.d.ts +29 -0
  667. package/dist/phase/goImports.d.ts.map +1 -0
  668. package/dist/phase/goImports.js +68 -0
  669. package/dist/phase/goImports.js.map +1 -0
  670. package/dist/phase/goPackageBindings.d.ts +22 -0
  671. package/dist/phase/goPackageBindings.d.ts.map +1 -0
  672. package/dist/phase/goPackageBindings.js +30 -0
  673. package/dist/phase/goPackageBindings.js.map +1 -0
  674. package/dist/phase/goSwitches.d.ts +28 -0
  675. package/dist/phase/goSwitches.d.ts.map +1 -0
  676. package/dist/phase/goSwitches.js +52 -0
  677. package/dist/phase/goSwitches.js.map +1 -0
  678. package/dist/phase/importForm.d.ts +20 -0
  679. package/dist/phase/importForm.d.ts.map +1 -0
  680. package/dist/phase/importForm.js +27 -0
  681. package/dist/phase/importForm.js.map +1 -0
  682. package/dist/phase/importSpecifiers.d.ts +20 -0
  683. package/dist/phase/importSpecifiers.d.ts.map +1 -0
  684. package/dist/phase/importSpecifiers.js +30 -0
  685. package/dist/phase/importSpecifiers.js.map +1 -0
  686. package/dist/phase/imports.d.ts +18 -0
  687. package/dist/phase/imports.d.ts.map +1 -0
  688. package/dist/phase/imports.js +25 -0
  689. package/dist/phase/imports.js.map +1 -0
  690. package/dist/phase/jsonDocument.d.ts +26 -0
  691. package/dist/phase/jsonDocument.d.ts.map +1 -0
  692. package/dist/phase/jsonDocument.js +36 -0
  693. package/dist/phase/jsonDocument.js.map +1 -0
  694. package/dist/phase/localBinding.d.ts +33 -0
  695. package/dist/phase/localBinding.d.ts.map +1 -0
  696. package/dist/phase/localBinding.js +208 -0
  697. package/dist/phase/localBinding.js.map +1 -0
  698. package/dist/phase/loopQueries.d.ts +31 -0
  699. package/dist/phase/loopQueries.d.ts.map +1 -0
  700. package/dist/phase/loopQueries.js +44 -0
  701. package/dist/phase/loopQueries.js.map +1 -0
  702. package/dist/phase/loopQueryCandidates.d.ts +26 -0
  703. package/dist/phase/loopQueryCandidates.d.ts.map +1 -0
  704. package/dist/phase/loopQueryCandidates.js +28 -0
  705. package/dist/phase/loopQueryCandidates.js.map +1 -0
  706. package/dist/phase/oracles.d.ts +216 -0
  707. package/dist/phase/oracles.d.ts.map +1 -0
  708. package/dist/phase/oracles.js +484 -0
  709. package/dist/phase/oracles.js.map +1 -0
  710. package/dist/phase/phaseModel.d.ts +190 -0
  711. package/dist/phase/phaseModel.d.ts.map +1 -0
  712. package/dist/phase/phaseModel.js +468 -0
  713. package/dist/phase/phaseModel.js.map +1 -0
  714. package/dist/phase/producers.d.ts +450 -0
  715. package/dist/phase/producers.d.ts.map +1 -0
  716. package/dist/phase/producers.js +1027 -0
  717. package/dist/phase/producers.js.map +1 -0
  718. package/dist/phase/querySiteCandidates.d.ts +27 -0
  719. package/dist/phase/querySiteCandidates.d.ts.map +1 -0
  720. package/dist/phase/querySiteCandidates.js +66 -0
  721. package/dist/phase/querySiteCandidates.js.map +1 -0
  722. package/dist/phase/querySites.d.ts +30 -0
  723. package/dist/phase/querySites.d.ts.map +1 -0
  724. package/dist/phase/querySites.js +93 -0
  725. package/dist/phase/querySites.js.map +1 -0
  726. package/dist/phase/reachability.d.ts +61 -0
  727. package/dist/phase/reachability.d.ts.map +1 -0
  728. package/dist/phase/reachability.js +104 -0
  729. package/dist/phase/reachability.js.map +1 -0
  730. package/dist/phase/reactComponents.d.ts +33 -0
  731. package/dist/phase/reactComponents.d.ts.map +1 -0
  732. package/dist/phase/reactComponents.js +47 -0
  733. package/dist/phase/reactComponents.js.map +1 -0
  734. package/dist/phase/receiverActivity.d.ts +35 -0
  735. package/dist/phase/receiverActivity.d.ts.map +1 -0
  736. package/dist/phase/receiverActivity.js +66 -0
  737. package/dist/phase/receiverActivity.js.map +1 -0
  738. package/dist/phase/receiverConsumers.d.ts +200 -0
  739. package/dist/phase/receiverConsumers.d.ts.map +1 -0
  740. package/dist/phase/receiverConsumers.js +1025 -0
  741. package/dist/phase/receiverConsumers.js.map +1 -0
  742. package/dist/phase/receiverProvenance.d.ts +97 -0
  743. package/dist/phase/receiverProvenance.d.ts.map +1 -0
  744. package/dist/phase/receiverProvenance.js +337 -0
  745. package/dist/phase/receiverProvenance.js.map +1 -0
  746. package/dist/phase/routing.d.ts +47 -0
  747. package/dist/phase/routing.d.ts.map +1 -0
  748. package/dist/phase/routing.js +62 -0
  749. package/dist/phase/routing.js.map +1 -0
  750. package/dist/phase/rules/conventions.d.ts +61 -0
  751. package/dist/phase/rules/conventions.d.ts.map +1 -0
  752. package/dist/phase/rules/conventions.js +403 -0
  753. package/dist/phase/rules/conventions.js.map +1 -0
  754. package/dist/phase/rules/crossDomain.d.ts +102 -0
  755. package/dist/phase/rules/crossDomain.d.ts.map +1 -0
  756. package/dist/phase/rules/crossDomain.js +918 -0
  757. package/dist/phase/rules/crossDomain.js.map +1 -0
  758. package/dist/phase/rules/dataAccess.d.ts +62 -0
  759. package/dist/phase/rules/dataAccess.d.ts.map +1 -0
  760. package/dist/phase/rules/dataAccess.js +480 -0
  761. package/dist/phase/rules/dataAccess.js.map +1 -0
  762. package/dist/phase/rules/dependencyGraph.d.ts +44 -0
  763. package/dist/phase/rules/dependencyGraph.d.ts.map +1 -0
  764. package/dist/phase/rules/dependencyGraph.js +260 -0
  765. package/dist/phase/rules/dependencyGraph.js.map +1 -0
  766. package/dist/phase/rules/documentation.d.ts +45 -0
  767. package/dist/phase/rules/documentation.d.ts.map +1 -0
  768. package/dist/phase/rules/documentation.js +340 -0
  769. package/dist/phase/rules/documentation.js.map +1 -0
  770. package/dist/phase/rules/dry.d.ts +109 -0
  771. package/dist/phase/rules/dry.d.ts.map +1 -0
  772. package/dist/phase/rules/dry.js +803 -0
  773. package/dist/phase/rules/dry.js.map +1 -0
  774. package/dist/phase/rules/fileDocumentation.d.ts +36 -0
  775. package/dist/phase/rules/fileDocumentation.d.ts.map +1 -0
  776. package/dist/phase/rules/fileDocumentation.js +134 -0
  777. package/dist/phase/rules/fileDocumentation.js.map +1 -0
  778. package/dist/phase/rules/functionBodies.d.ts +33 -0
  779. package/dist/phase/rules/functionBodies.d.ts.map +1 -0
  780. package/dist/phase/rules/functionBodies.js +71 -0
  781. package/dist/phase/rules/functionBodies.js.map +1 -0
  782. package/dist/phase/rules/goRules.d.ts +49 -0
  783. package/dist/phase/rules/goRules.d.ts.map +1 -0
  784. package/dist/phase/rules/goRules.js +209 -0
  785. package/dist/phase/rules/goRules.js.map +1 -0
  786. package/dist/phase/rules/querySites.d.ts +29 -0
  787. package/dist/phase/rules/querySites.d.ts.map +1 -0
  788. package/dist/phase/rules/querySites.js +94 -0
  789. package/dist/phase/rules/querySites.js.map +1 -0
  790. package/dist/phase/rules/react.d.ts +38 -0
  791. package/dist/phase/rules/react.d.ts.map +1 -0
  792. package/dist/phase/rules/react.js +202 -0
  793. package/dist/phase/rules/react.js.map +1 -0
  794. package/dist/phase/rules/registry.d.ts +170 -0
  795. package/dist/phase/rules/registry.d.ts.map +1 -0
  796. package/dist/phase/rules/registry.js +103 -0
  797. package/dist/phase/rules/registry.js.map +1 -0
  798. package/dist/phase/rules/schema.d.ts +79 -0
  799. package/dist/phase/rules/schema.d.ts.map +1 -0
  800. package/dist/phase/rules/schema.js +273 -0
  801. package/dist/phase/rules/schema.js.map +1 -0
  802. package/dist/phase/rules/schemaJson.d.ts +32 -0
  803. package/dist/phase/rules/schemaJson.d.ts.map +1 -0
  804. package/dist/phase/rules/schemaJson.js +81 -0
  805. package/dist/phase/rules/schemaJson.js.map +1 -0
  806. package/dist/phase/rules/schemaValidator.d.ts +38 -0
  807. package/dist/phase/rules/schemaValidator.d.ts.map +1 -0
  808. package/dist/phase/rules/schemaValidator.js +107 -0
  809. package/dist/phase/rules/schemaValidator.js.map +1 -0
  810. package/dist/phase/rules/secrets.d.ts +34 -0
  811. package/dist/phase/rules/secrets.d.ts.map +1 -0
  812. package/dist/phase/rules/secrets.js +208 -0
  813. package/dist/phase/rules/secrets.js.map +1 -0
  814. package/dist/phase/rules/security.d.ts +30 -0
  815. package/dist/phase/rules/security.d.ts.map +1 -0
  816. package/dist/phase/rules/security.js +85 -0
  817. package/dist/phase/rules/security.js.map +1 -0
  818. package/dist/phase/rules/securityDefects.d.ts +37 -0
  819. package/dist/phase/rules/securityDefects.d.ts.map +1 -0
  820. package/dist/phase/rules/securityDefects.js +167 -0
  821. package/dist/phase/rules/securityDefects.js.map +1 -0
  822. package/dist/phase/rules/solid.d.ts +61 -0
  823. package/dist/phase/rules/solid.d.ts.map +1 -0
  824. package/dist/phase/rules/solid.js +562 -0
  825. package/dist/phase/rules/solid.js.map +1 -0
  826. package/dist/phase/rules/styles.d.ts +77 -0
  827. package/dist/phase/rules/styles.d.ts.map +1 -0
  828. package/dist/phase/rules/styles.js +868 -0
  829. package/dist/phase/rules/styles.js.map +1 -0
  830. package/dist/phase/rules/unreferencedModule.d.ts +26 -0
  831. package/dist/phase/rules/unreferencedModule.d.ts.map +1 -0
  832. package/dist/phase/rules/unreferencedModule.js +61 -0
  833. package/dist/phase/rules/unreferencedModule.js.map +1 -0
  834. package/dist/phase/runner.d.ts +549 -0
  835. package/dist/phase/runner.d.ts.map +1 -0
  836. package/dist/phase/runner.js +1098 -0
  837. package/dist/phase/runner.js.map +1 -0
  838. package/dist/phase/schemaCode.d.ts +34 -0
  839. package/dist/phase/schemaCode.d.ts.map +1 -0
  840. package/dist/phase/schemaCode.js +53 -0
  841. package/dist/phase/schemaCode.js.map +1 -0
  842. package/dist/phase/schemaObjects.d.ts +37 -0
  843. package/dist/phase/schemaObjects.d.ts.map +1 -0
  844. package/dist/phase/schemaObjects.js +139 -0
  845. package/dist/phase/schemaObjects.js.map +1 -0
  846. package/dist/phase/schemaUsage.d.ts +30 -0
  847. package/dist/phase/schemaUsage.d.ts.map +1 -0
  848. package/dist/phase/schemaUsage.js +99 -0
  849. package/dist/phase/schemaUsage.js.map +1 -0
  850. package/dist/phase/schemaUsageCandidates.d.ts +32 -0
  851. package/dist/phase/schemaUsageCandidates.d.ts.map +1 -0
  852. package/dist/phase/schemaUsageCandidates.js +165 -0
  853. package/dist/phase/schemaUsageCandidates.js.map +1 -0
  854. package/dist/phase/schemaValidations.d.ts +34 -0
  855. package/dist/phase/schemaValidations.d.ts.map +1 -0
  856. package/dist/phase/schemaValidations.js +53 -0
  857. package/dist/phase/schemaValidations.js.map +1 -0
  858. package/dist/phase/secretCandidates.d.ts +28 -0
  859. package/dist/phase/secretCandidates.d.ts.map +1 -0
  860. package/dist/phase/secretCandidates.js +132 -0
  861. package/dist/phase/secretCandidates.js.map +1 -0
  862. package/dist/phase/securityCandidates.d.ts +29 -0
  863. package/dist/phase/securityCandidates.d.ts.map +1 -0
  864. package/dist/phase/securityCandidates.js +469 -0
  865. package/dist/phase/securityCandidates.js.map +1 -0
  866. package/dist/phase/seeded-defects.d.ts +18 -0
  867. package/dist/phase/seeded-defects.d.ts.map +1 -0
  868. package/dist/phase/seeded-defects.js +61 -0
  869. package/dist/phase/seeded-defects.js.map +1 -0
  870. package/dist/phase/stringLiterals.d.ts +24 -0
  871. package/dist/phase/stringLiterals.d.ts.map +1 -0
  872. package/dist/phase/stringLiterals.js +35 -0
  873. package/dist/phase/stringLiterals.js.map +1 -0
  874. package/dist/phase/stylesCss.d.ts +25 -0
  875. package/dist/phase/stylesCss.d.ts.map +1 -0
  876. package/dist/phase/stylesCss.js +34 -0
  877. package/dist/phase/stylesCss.js.map +1 -0
  878. package/dist/phase/stylesMarkup.d.ts +31 -0
  879. package/dist/phase/stylesMarkup.d.ts.map +1 -0
  880. package/dist/phase/stylesMarkup.js +48 -0
  881. package/dist/phase/stylesMarkup.js.map +1 -0
  882. package/dist/phase/stylesSource.d.ts +36 -0
  883. package/dist/phase/stylesSource.d.ts.map +1 -0
  884. package/dist/phase/stylesSource.js +50 -0
  885. package/dist/phase/stylesSource.js.map +1 -0
  886. package/dist/phase/typeDeclarations.d.ts +33 -0
  887. package/dist/phase/typeDeclarations.d.ts.map +1 -0
  888. package/dist/phase/typeDeclarations.js +76 -0
  889. package/dist/phase/typeDeclarations.js.map +1 -0
  890. package/dist/phase/types.d.ts +2191 -0
  891. package/dist/phase/types.d.ts.map +1 -0
  892. package/dist/phase/types.js +27 -0
  893. package/dist/phase/types.js.map +1 -0
  894. package/dist/phase/withinFileProvenance.d.ts +50 -0
  895. package/dist/phase/withinFileProvenance.d.ts.map +1 -0
  896. package/dist/phase/withinFileProvenance.js +112 -0
  897. package/dist/phase/withinFileProvenance.js.map +1 -0
  898. package/dist/pipeline.d.ts +37 -30
  899. package/dist/pipeline.d.ts.map +1 -1
  900. package/dist/pipeline.js +131 -326
  901. package/dist/pipeline.js.map +1 -1
  902. package/dist/pipelineAdapters.d.ts +104 -21
  903. package/dist/pipelineAdapters.d.ts.map +1 -1
  904. package/dist/pipelineAdapters.js +1145 -988
  905. package/dist/pipelineAdapters.js.map +1 -1
  906. package/dist/pipelineTypes.d.ts +21 -0
  907. package/dist/pipelineTypes.d.ts.map +1 -1
  908. package/dist/pipelineTypes.js +21 -10
  909. package/dist/pipelineTypes.js.map +1 -1
  910. package/dist/presets/presets.d.ts +9 -2
  911. package/dist/presets/presets.d.ts.map +1 -1
  912. package/dist/presets/presets.js +15 -26
  913. package/dist/presets/presets.js.map +1 -1
  914. package/dist/reporting/csvReportGenerator.d.ts +14 -3
  915. package/dist/reporting/csvReportGenerator.d.ts.map +1 -1
  916. package/dist/reporting/csvReportGenerator.js +14 -3
  917. package/dist/reporting/csvReportGenerator.js.map +1 -1
  918. package/dist/reporting/htmlReportGenerator.d.ts +5 -1
  919. package/dist/reporting/htmlReportGenerator.d.ts.map +1 -1
  920. package/dist/reporting/htmlReportGenerator.js +5 -1
  921. package/dist/reporting/htmlReportGenerator.js.map +1 -1
  922. package/dist/reporting/jsonReportGenerator.d.ts +9 -2
  923. package/dist/reporting/jsonReportGenerator.d.ts.map +1 -1
  924. package/dist/reporting/jsonReportGenerator.js +19 -5
  925. package/dist/reporting/jsonReportGenerator.js.map +1 -1
  926. package/dist/reporting/reportGenerator.d.ts +9 -2
  927. package/dist/reporting/reportGenerator.d.ts.map +1 -1
  928. package/dist/reporting/reportGenerator.js +9 -2
  929. package/dist/reporting/reportGenerator.js.map +1 -1
  930. package/dist/reporting/sarifReportGenerator.d.ts +14 -0
  931. package/dist/reporting/sarifReportGenerator.d.ts.map +1 -1
  932. package/dist/reporting/sarifReportGenerator.js +14 -0
  933. package/dist/reporting/sarifReportGenerator.js.map +1 -1
  934. package/dist/reporting/sizeDistribution.d.ts +19 -2
  935. package/dist/reporting/sizeDistribution.d.ts.map +1 -1
  936. package/dist/reporting/sizeDistribution.js +23 -5
  937. package/dist/reporting/sizeDistribution.js.map +1 -1
  938. package/dist/ruleAliases.d.ts +6 -8
  939. package/dist/ruleAliases.d.ts.map +1 -1
  940. package/dist/ruleAliases.js +29 -4
  941. package/dist/ruleAliases.js.map +1 -1
  942. package/dist/search/QueryParser.d.ts +1 -0
  943. package/dist/search/QueryParser.d.ts.map +1 -1
  944. package/dist/search/QueryParser.js +32 -91
  945. package/dist/search/QueryParser.js.map +1 -1
  946. package/dist/services/CodeMapGenerator.d.ts +19 -20
  947. package/dist/services/CodeMapGenerator.d.ts.map +1 -1
  948. package/dist/services/CodeMapGenerator.js +214 -194
  949. package/dist/services/CodeMapGenerator.js.map +1 -1
  950. package/dist/services/ProjectTaskRepository.d.ts +65 -3
  951. package/dist/services/ProjectTaskRepository.d.ts.map +1 -1
  952. package/dist/services/ProjectTaskRepository.js +94 -25
  953. package/dist/services/ProjectTaskRepository.js.map +1 -1
  954. package/dist/services/auditJobService.d.ts +17 -1
  955. package/dist/services/auditJobService.d.ts.map +1 -1
  956. package/dist/services/auditJobService.js +16 -0
  957. package/dist/services/auditJobService.js.map +1 -1
  958. package/dist/services/fileAccounting.d.ts +43 -5
  959. package/dist/services/fileAccounting.d.ts.map +1 -1
  960. package/dist/services/fileAccounting.js +48 -9
  961. package/dist/services/fileAccounting.js.map +1 -1
  962. package/dist/services/projectTaskHelpers.d.ts +45 -0
  963. package/dist/services/projectTaskHelpers.d.ts.map +1 -1
  964. package/dist/services/projectTaskHelpers.js +45 -0
  965. package/dist/services/projectTaskHelpers.js.map +1 -1
  966. package/dist/services/whitelistService.d.ts +40 -5
  967. package/dist/services/whitelistService.d.ts.map +1 -1
  968. package/dist/services/whitelistService.js +87 -46
  969. package/dist/services/whitelistService.js.map +1 -1
  970. package/dist/sqlite/betterSqlite3.d.ts +35 -1
  971. package/dist/sqlite/betterSqlite3.d.ts.map +1 -1
  972. package/dist/sqlite/betterSqlite3.js +35 -1
  973. package/dist/sqlite/betterSqlite3.js.map +1 -1
  974. package/dist/sqlite/driver.d.ts +23 -0
  975. package/dist/sqlite/driver.d.ts.map +1 -1
  976. package/dist/sqlite/driver.js +23 -0
  977. package/dist/sqlite/driver.js.map +1 -1
  978. package/dist/sqlite/nodeSqlite.d.ts +35 -1
  979. package/dist/sqlite/nodeSqlite.d.ts.map +1 -1
  980. package/dist/sqlite/nodeSqlite.js +35 -1
  981. package/dist/sqlite/nodeSqlite.js.map +1 -1
  982. package/dist/structuralSignature.d.ts +9 -0
  983. package/dist/structuralSignature.d.ts.map +1 -1
  984. package/dist/structuralSignature.js +9 -0
  985. package/dist/structuralSignature.js.map +1 -1
  986. package/dist/styles/cssAstExtractor.d.ts +15 -0
  987. package/dist/styles/cssAstExtractor.d.ts.map +1 -1
  988. package/dist/styles/cssAstExtractor.js +15 -0
  989. package/dist/styles/cssAstExtractor.js.map +1 -1
  990. package/dist/styles/normalizer.d.ts +6 -0
  991. package/dist/styles/normalizer.d.ts.map +1 -1
  992. package/dist/styles/normalizer.js +6 -0
  993. package/dist/styles/normalizer.js.map +1 -1
  994. package/dist/styles/styleExtractor.d.ts +29 -2
  995. package/dist/styles/styleExtractor.d.ts.map +1 -1
  996. package/dist/styles/styleExtractor.js +67 -48
  997. package/dist/styles/styleExtractor.js.map +1 -1
  998. package/dist/styles/styleIndexer.d.ts +8 -0
  999. package/dist/styles/styleIndexer.d.ts.map +1 -1
  1000. package/dist/styles/styleIndexer.js +135 -138
  1001. package/dist/styles/styleIndexer.js.map +1 -1
  1002. package/dist/styles/tailwindConfigLoader.d.ts +12 -0
  1003. package/dist/styles/tailwindConfigLoader.d.ts.map +1 -1
  1004. package/dist/styles/tailwindConfigLoader.js +12 -0
  1005. package/dist/styles/tailwindConfigLoader.js.map +1 -1
  1006. package/dist/styles/tailwindExpander.d.ts +3 -0
  1007. package/dist/styles/tailwindExpander.d.ts.map +1 -1
  1008. package/dist/styles/tailwindExpander.js +8 -4
  1009. package/dist/styles/tailwindExpander.js.map +1 -1
  1010. package/dist/styles/tailwindProbe.d.ts +9 -0
  1011. package/dist/styles/tailwindProbe.d.ts.map +1 -1
  1012. package/dist/styles/tailwindProbe.js +181 -166
  1013. package/dist/styles/tailwindProbe.js.map +1 -1
  1014. package/dist/styles/tailwindUtilityExpander.d.ts +13 -0
  1015. package/dist/styles/tailwindUtilityExpander.d.ts.map +1 -1
  1016. package/dist/styles/tailwindUtilityExpander.js +13 -0
  1017. package/dist/styles/tailwindUtilityExpander.js.map +1 -1
  1018. package/dist/symbols.d.ts +13 -11
  1019. package/dist/symbols.d.ts.map +1 -1
  1020. package/dist/symbols.js +14 -21
  1021. package/dist/symbols.js.map +1 -1
  1022. package/dist/telemetry.d.ts +31 -3
  1023. package/dist/telemetry.d.ts.map +1 -1
  1024. package/dist/telemetry.js +31 -3
  1025. package/dist/telemetry.js.map +1 -1
  1026. package/dist/tool-registry.d.ts +37 -1
  1027. package/dist/tool-registry.d.ts.map +1 -1
  1028. package/dist/tool-registry.js +37 -1
  1029. package/dist/tool-registry.js.map +1 -1
  1030. package/dist/types.d.ts +106 -92
  1031. package/dist/types.d.ts.map +1 -1
  1032. package/dist/types.js +7 -16
  1033. package/dist/types.js.map +1 -1
  1034. package/dist/ui/InteractivePrompts.d.ts +12 -0
  1035. package/dist/ui/InteractivePrompts.d.ts.map +1 -1
  1036. package/dist/ui/InteractivePrompts.js +12 -0
  1037. package/dist/ui/InteractivePrompts.js.map +1 -1
  1038. package/dist/utils/astParser.d.ts +15 -0
  1039. package/dist/utils/astParser.d.ts.map +1 -1
  1040. package/dist/utils/astParser.js +15 -0
  1041. package/dist/utils/astParser.js.map +1 -1
  1042. package/dist/utils/astUtils.d.ts +60 -0
  1043. package/dist/utils/astUtils.d.ts.map +1 -1
  1044. package/dist/utils/astUtils.js +350 -362
  1045. package/dist/utils/astUtils.js.map +1 -1
  1046. package/dist/utils/contentHash.d.ts +22 -0
  1047. package/dist/utils/contentHash.d.ts.map +1 -0
  1048. package/dist/utils/contentHash.js +26 -0
  1049. package/dist/utils/contentHash.js.map +1 -0
  1050. package/dist/utils/dependencyExtractor.d.ts +28 -0
  1051. package/dist/utils/dependencyExtractor.d.ts.map +1 -1
  1052. package/dist/utils/dependencyExtractor.js +28 -1
  1053. package/dist/utils/dependencyExtractor.js.map +1 -1
  1054. package/dist/utils/errorMessage.d.ts +10 -0
  1055. package/dist/utils/errorMessage.d.ts.map +1 -0
  1056. package/dist/utils/errorMessage.js +12 -0
  1057. package/dist/utils/errorMessage.js.map +1 -0
  1058. package/dist/utils/fileDiscovery.d.ts +61 -2
  1059. package/dist/utils/fileDiscovery.d.ts.map +1 -1
  1060. package/dist/utils/fileDiscovery.js +131 -23
  1061. package/dist/utils/fileDiscovery.js.map +1 -1
  1062. package/dist/utils/reactDetection.d.ts +34 -5
  1063. package/dist/utils/reactDetection.d.ts.map +1 -1
  1064. package/dist/utils/reactDetection.js +73 -52
  1065. package/dist/utils/reactDetection.js.map +1 -1
  1066. package/dist/version.generated.d.ts +1 -1
  1067. package/dist/version.generated.js +1 -1
  1068. package/dist/workers/auditWorker.js +7 -3
  1069. package/dist/workers/auditWorker.js.map +1 -1
  1070. package/examples/.auditrc.example.json +0 -8
  1071. package/examples/.auditrc.json +0 -11
  1072. package/examples/.code-auditor.json +0 -2
  1073. package/examples/nextjs.auditrc.json +0 -8
  1074. package/examples/node-api.auditrc.json +0 -7
  1075. package/examples/react.auditrc.json +0 -6
  1076. package/examples/tolerant-solid.auditrc.json +0 -5
  1077. package/package.json +14 -8
  1078. package/plugin/.claude-plugin/manifest.json +16 -0
  1079. package/plugin/.claude-plugin/plugin.json +1 -1
  1080. package/plugin/hooks/hooks.json +6 -2
  1081. package/plugin/scripts/hook-audit.sh +41 -14
  1082. package/plugin/scripts/hook-common.sh +50 -5
  1083. package/plugin/scripts/hook-drift-check.sh +72 -0
  1084. package/plugin/scripts/hook-self-audit.sh +17 -12
  1085. package/plugin/skills/code-auditor/SKILL.md +1 -1
  1086. package/server.json +2 -2
package/dist/mcp.js CHANGED
@@ -66,8 +66,9 @@ import chalk from 'chalk';
66
66
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
67
67
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
68
68
  import { CallToolRequestSchema, ListToolsRequestSchema, InitializeRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
69
- import { createWriteStream } from 'node:fs';
69
+ import { createWriteStream, mkdirSync, realpathSync } from 'node:fs';
70
70
  import fs from 'node:fs/promises';
71
+ import { fileURLToPath } from 'node:url';
71
72
  import { createAuditRunner } from './auditRunner.js';
72
73
  import { searchFunctions, findDefinition, syncFileIndex, getDatabase } from './codeIndexService.js';
73
74
  import { CodeMapGenerator } from './services/CodeMapGenerator.js';
@@ -75,19 +76,27 @@ import { analyzeDocumentation } from './analyzers/documentationAnalyzer.js';
75
76
  import { ConfigGeneratorFactory } from './generators/ConfigGeneratorFactory.js';
76
77
  import { resolveConfigGenerateDir } from './config/configGeneratePath.js';
77
78
  import { getInstallId, getTelemetryOptIn, setTelemetryOptIn, PRIVACY_MESSAGE, resolveTelemetryEndpoint } from './installConfig.js';
78
- import { MCP_DEFAULT_ANALYZERS } from './analyzers/ruleRegistry.js';
79
79
  import { DEFAULT_SERVER_URL, IS_DEV_MODE, PACKAGE_VERSION } from './constants.js';
80
+ import { resolveMcpDevLogPath } from './dataPaths.js';
80
81
  import { getAuditJobStatus, getAuditResultsPage, getAuditResultsAsSarif, startAuditJob } from './mcpAuditJobs.js';
81
82
  import { CodeIndexDB } from './codeIndexDB.js';
83
+ import { errorMessage } from './utils/errorMessage.js';
82
84
  import { logMcpDebug, logMcpInfo, mcpDebugStderr, mcpTraceStderr } from './mcpDiagnostics.js';
83
85
  import { assertAuditPathExists, formatMcpToolErrorPayload } from './mcpToolErrors.js';
84
86
  import { ToolRegistry } from './tool-registry.js';
85
87
  import { initParsers } from './languages/index.js';
86
88
  // ── Console / logging setup ──────────────────────────────────────────────────
87
89
  const originalConsoleError = console.error;
90
+ // Tool input-schema descriptions, hoisted so the repeated schema entries
91
+ // share one source.
92
+ const OPTION_ANALYZER_OVERRIDES = 'Analyzer-specific configuration overrides.';
93
+ const PROJECT_ROOT_DESCRIPTION = 'Project root.';
88
94
  let logStream = null;
89
95
  if (IS_DEV_MODE) {
90
- const logFilePath = path.join(process.cwd(), 'mcp-server.log');
96
+ // Dev mode is opt-in (`--dev`); even so, the log lives in the OS cache, never
97
+ // in cwd — a consumer that opts in must not get a bare file in their tree.
98
+ const logFilePath = resolveMcpDevLogPath();
99
+ mkdirSync(path.dirname(logFilePath), { recursive: true });
91
100
  logStream = createWriteStream(logFilePath, { flags: 'a' });
92
101
  console.error(chalk.blue('[INFO]'), `Development mode: Logging to file: ${logFilePath}`);
93
102
  }
@@ -130,10 +139,17 @@ async function withAbortSignal(signal, phase, op) {
130
139
  return new Promise((resolve, reject) => {
131
140
  const onAbort = () => reject(new RequestAbortedError(`Request aborted during ${phase}`));
132
141
  signal.addEventListener('abort', onAbort, { once: true });
133
- void op()
134
- .then(resolve)
135
- .catch(reject)
136
- .finally(() => signal.removeEventListener('abort', onAbort));
142
+ void (async () => {
143
+ try {
144
+ resolve(await op());
145
+ }
146
+ catch (err) {
147
+ reject(err);
148
+ }
149
+ finally {
150
+ signal.removeEventListener('abort', onAbort);
151
+ }
152
+ })();
137
153
  });
138
154
  }
139
155
  function serializeForMcp(value) {
@@ -205,469 +221,386 @@ function registerProcessReliabilityHandlers() {
205
221
  }
206
222
  }
207
223
  // ── Tool registration ────────────────────────────────────────────────────────
208
- const DEFAULT_ANALYZERS = [...MCP_DEFAULT_ANALYZERS];
209
- function registerAllTools(registry) {
210
- // ── audit ──────────────────────────────────────────────────────────────────
211
- const auditActions = [
212
- {
213
- name: 'run',
214
- description: 'Run a synchronous audit on the specified path. Returns a full audit result with violations.',
215
- parameters: [
216
- {
217
- name: 'path',
218
- type: 'string',
219
- required: false,
220
- description: 'File or directory path to audit (defaults to current directory).',
221
- default: process.cwd(),
222
- },
223
- {
224
- name: 'analyzers',
225
- type: 'array',
226
- required: false,
227
- description: `Analyzers to run (default: ${DEFAULT_ANALYZERS.join(', ')}).`,
228
- default: DEFAULT_ANALYZERS,
229
- },
230
- {
231
- name: 'minSeverity',
232
- type: 'string',
233
- required: false,
234
- description: 'Minimum severity level to report (high included by default).',
235
- default: 'high',
236
- enum: ['high', 'severe', 'critical'],
237
- },
238
- {
239
- name: 'indexFunctions',
240
- type: 'boolean',
241
- required: false,
242
- description: 'Index functions during audit (default: true).',
243
- default: true,
244
- },
245
- {
246
- name: 'analyzerConfigs',
247
- type: 'object',
248
- required: false,
249
- description: 'Analyzer-specific configuration overrides.',
250
- },
251
- {
252
- name: 'scope',
253
- type: 'string',
254
- required: false,
255
- description: 'Audit scope: "all" (default), "changed" (files differing from index), "git:<ref>" (diff against a git ref), or a comma-separated list of file paths.',
256
- default: 'all',
257
- },
258
- ],
259
- handler: async (args, signal) => {
260
- return withAbortSignal(signal, 'audit.run', async () => {
261
- const auditPath = path.resolve(args.path || process.cwd());
262
- await assertAuditPathExists(auditPath);
263
- const analyzers = args.analyzers ?? DEFAULT_ANALYZERS;
264
- const minSeverity = (args.minSeverity || 'high');
265
- const indexFunctions = args.indexFunctions !== false;
266
- const db = CodeIndexDB.getInstance();
267
- await db.initialize();
268
- const storedConfigs = await db.getAllAnalyzerConfigs(auditPath);
269
- const analyzerConfigs = {
270
- ...storedConfigs,
271
- ...(args.analyzerConfigs || {}),
272
- };
273
- const scope = args.scope || 'all';
274
- const runner = createAuditRunner({
275
- projectRoot: auditPath,
276
- enabledAnalyzers: analyzers,
277
- minSeverity,
278
- verbose: false,
279
- indexFunctions,
280
- scope: scope !== 'all' ? scope : undefined,
281
- ...(Object.keys(analyzerConfigs).length > 0 && { analyzerConfigs }),
282
- });
283
- const auditResult = await runner.run();
284
- if (indexFunctions && auditResult.metadata.fileToFunctionsMap) {
285
- try {
286
- for (const [filePath, functions] of Object.entries(auditResult.metadata.fileToFunctionsMap)) {
287
- await syncFileIndex(filePath, functions);
288
- }
289
- }
290
- catch {
291
- // indexing is best-effort for sync audit
292
- }
293
- }
294
- return {
295
- success: true,
296
- summary: auditResult.summary,
297
- violations: auditResult.analyzerResults,
298
- metadata: auditResult.metadata,
299
- guidance: 'The audit takes readings, not verdicts. Severity is urgency — how fast a defect bites, never whether you may ignore it; there is no "noise" tier. Work criticals first, then severe, then high. The coverage panel tells you what was actually measured. Documentation readings (missing JSDoc) are maintainability gaps. If you decline a reading, record why instead of silently dismissing it.',
300
- };
301
- });
224
+ // ── audit ──────────────────────────────────────────────────────────────────
225
+ const auditActions = [
226
+ {
227
+ name: 'run',
228
+ description: 'Run a synchronous audit on the specified path. Returns a full audit result with violations.',
229
+ parameters: [
230
+ {
231
+ name: 'path',
232
+ type: 'string',
233
+ required: false,
234
+ description: 'File or directory path to audit (defaults to current directory).',
235
+ default: process.cwd(),
302
236
  },
303
- },
304
- {
305
- name: 'start',
306
- description: 'Start a background audit job. Returns immediately with a jobId. Poll `audit.status` until completed, then fetch pages with `audit.results`.',
307
- parameters: [
308
- {
309
- name: 'path',
310
- type: 'string',
311
- required: false,
312
- description: 'File or directory path to audit (defaults to current directory).',
313
- default: process.cwd(),
314
- },
315
- {
316
- name: 'analyzers',
317
- type: 'array',
318
- required: false,
319
- description: `Analyzers to run (default: ${DEFAULT_ANALYZERS.join(', ')}).`,
320
- default: DEFAULT_ANALYZERS,
321
- },
322
- {
323
- name: 'minSeverity',
324
- type: 'string',
325
- required: false,
326
- description: 'Minimum severity level to report (high included by default).',
327
- default: 'high',
328
- enum: ['high', 'severe', 'critical'],
329
- },
330
- {
331
- name: 'indexFunctions',
332
- type: 'boolean',
333
- required: false,
334
- description: 'Index functions during audit (default: true).',
335
- default: true,
336
- },
337
- {
338
- name: 'analyzerConfigs',
339
- type: 'object',
340
- required: false,
341
- description: 'Analyzer-specific configuration overrides.',
342
- },
343
- {
344
- name: 'scope',
345
- type: 'string',
346
- required: false,
347
- description: 'Audit scope: "all" (default), "changed" (files differing from index), "git:<ref>" (diff against a git ref), or a comma-separated list of file paths.',
348
- default: 'all',
349
- },
350
- {
351
- name: 'analyzerConcurrency',
352
- type: 'number',
353
- required: false,
354
- description: 'Max analyzers to run in parallel (default: 1).',
355
- default: 1,
356
- },
357
- {
358
- name: 'partitionStrategy',
359
- type: 'string',
360
- required: false,
361
- description: 'Partition mode: none | auto | top-level.',
362
- default: 'auto',
363
- enum: ['none', 'auto', 'top-level'],
364
- },
365
- {
366
- name: 'maxPartitions',
367
- type: 'number',
368
- required: false,
369
- description: 'Maximum number of folder partitions (default: 4).',
370
- default: 4,
371
- },
372
- {
373
- name: 'partitionThresholdFiles',
374
- type: 'number',
375
- required: false,
376
- description: 'Minimum files before auto partitioning (default: 250).',
377
- default: 250,
378
- },
379
- {
380
- name: 'workerCount',
381
- type: 'number',
382
- required: false,
383
- description: 'Number of worker processes (default: min(4, CPU-1)).',
384
- },
385
- {
386
- name: 'maxRetries',
387
- type: 'number',
388
- required: false,
389
- description: 'Retry attempts per shard (default: 1).',
390
- default: 1,
391
- },
392
- {
393
- name: 'shardTimeoutMs',
394
- type: 'number',
395
- required: false,
396
- description: 'Per-shard timeout in ms (default: 180000).',
397
- default: 180000,
398
- },
399
- {
400
- name: 'retryBackoffMs',
401
- type: 'number',
402
- required: false,
403
- description: 'Base retry backoff in ms (default: 500).',
404
- default: 500,
405
- },
406
- {
407
- name: 'jobTimeoutMs',
408
- type: 'number',
409
- required: false,
410
- description: 'Max wall time for the audit job (default 30m, cap 4h).',
411
- },
412
- {
413
- name: 'maxFilesPerRun',
414
- type: 'number',
415
- required: false,
416
- description: 'Per worker chunk size for file processing.',
417
- },
418
- {
419
- name: 'shardSoftBudgetMs',
420
- type: 'number',
421
- required: false,
422
- description: 'Per worker soft wall-clock budget.',
423
- },
424
- {
425
- name: 'generateCodeMap',
426
- type: 'boolean',
427
- required: false,
428
- description: 'Generate code map artifacts during audit (default: false).',
429
- default: false,
430
- },
431
- ],
432
- handler: async (args, signal) => {
433
- return withAbortSignal(signal, 'audit.start', () => startAuditJob(args, {
434
- defaultAnalyzers: DEFAULT_ANALYZERS,
435
- defaultMinSeverity: 'high',
436
- defaultGenerateCodeMap: false,
437
- }));
237
+ {
238
+ name: 'minSeverity',
239
+ type: 'string',
240
+ required: false,
241
+ description: 'Minimum severity level to report (high included by default).',
242
+ default: 'high',
243
+ enum: ['high', 'severe', 'critical'],
438
244
  },
439
- },
440
- {
441
- name: 'status',
442
- description: 'Get current status for a previously started background audit job.',
443
- parameters: [
444
- {
445
- name: 'jobId',
446
- type: 'string',
447
- required: true,
448
- description: 'Job ID returned by `audit start`.',
449
- },
450
- ],
451
- handler: async (args) => {
452
- const jobId = args.jobId;
453
- if (!jobId)
454
- throw new Error('audit.status requires jobId');
455
- return await getAuditJobStatus(jobId);
245
+ {
246
+ name: 'indexFunctions',
247
+ type: 'boolean',
248
+ required: false,
249
+ description: 'Index functions during audit (default: true).',
250
+ default: true,
456
251
  },
457
- },
458
- {
459
- name: 'results',
460
- description: 'Fetch paginated violations for a completed audit result by resultId.',
461
- parameters: [
462
- {
463
- name: 'resultId',
464
- type: 'string',
465
- required: false,
466
- description: 'Result ID returned by `audit status` when completed. Also accepts legacy `auditId`.',
467
- },
468
- {
469
- name: 'auditId',
470
- type: 'string',
471
- required: false,
472
- description: 'Backward-compatible alias for resultId.',
473
- },
474
- {
475
- name: 'limit',
476
- type: 'number',
477
- required: false,
478
- description: 'Maximum violations per page (default: 50, max: 100).',
479
- default: 50,
480
- },
481
- {
482
- name: 'offset',
483
- type: 'number',
484
- required: false,
485
- description: 'Violation offset for pagination (default: 0).',
486
- default: 0,
487
- },
488
- {
489
- name: 'format',
490
- type: 'string',
491
- required: false,
492
- description: 'Output format. "json" (default, structured data) or "sarif" (SARIF 2.1.0 JSON string).',
493
- },
494
- ],
495
- handler: async (args, signal) => {
496
- const format = args.format || 'json';
497
- if (format === 'sarif') {
498
- return withAbortSignal(signal, 'audit.results', () => getAuditResultsAsSarif(args));
499
- }
500
- return withAbortSignal(signal, 'audit.results', () => getAuditResultsPage(args));
252
+ {
253
+ name: 'analyzerConfigs',
254
+ type: 'object',
255
+ required: false,
256
+ description: OPTION_ANALYZER_OVERRIDES,
501
257
  },
502
- },
503
- {
504
- name: 'health',
505
- description: 'Quick health check of a codebase with key metrics and optional code map generation.',
506
- parameters: [
507
- {
508
- name: 'path',
509
- type: 'string',
510
- required: false,
511
- description: 'The directory path to check.',
512
- default: process.cwd(),
513
- },
514
- {
515
- name: 'threshold',
516
- type: 'number',
517
- required: false,
518
- description: 'Health score threshold (0-100) for pass/fail.',
519
- default: 70,
520
- },
521
- {
522
- name: 'indexFunctions',
523
- type: 'boolean',
524
- required: false,
525
- description: 'Automatically index functions during health check.',
526
- default: true,
527
- },
528
- {
529
- name: 'analyzerConfigs',
530
- type: 'object',
531
- required: false,
532
- description: 'Analyzer-specific configuration overrides.',
533
- },
534
- {
535
- name: 'generateCodeMap',
536
- type: 'boolean',
537
- required: false,
538
- description: 'Generate and return a human-readable code map.',
539
- default: true,
540
- },
541
- ],
542
- handler: async (args) => {
258
+ {
259
+ name: 'scope',
260
+ type: 'string',
261
+ required: false,
262
+ description: 'Audit scope: "all" (default), "changed" (files differing from index), "git:<ref>" (diff against a git ref), or a comma-separated list of file paths.',
263
+ default: 'all',
264
+ },
265
+ ],
266
+ handler: async (args, signal) => {
267
+ return withAbortSignal(signal, 'audit.run', async () => {
543
268
  const auditPath = path.resolve(args.path || process.cwd());
544
269
  await assertAuditPathExists(auditPath);
545
- const threshold = args.threshold || 70;
270
+ const minSeverity = (args.minSeverity || 'high');
546
271
  const indexFunctions = args.indexFunctions !== false;
547
- const generateCodeMap = args.generateCodeMap !== false;
548
272
  const db = CodeIndexDB.getInstance();
549
273
  await db.initialize();
550
- const storedConfigs = await db.getAllAnalyzerConfigs(auditPath);
274
+ const storedConfigs = await db.analyzerConfig.getAllAnalyzerConfigs(auditPath);
551
275
  const analyzerConfigs = {
552
276
  ...storedConfigs,
553
277
  ...(args.analyzerConfigs || {}),
554
278
  };
555
- const runner = createAuditRunner({
279
+ const scope = args.scope || 'all';
280
+ // Route through the single audit entry point shared with the CLI, so
281
+ // `.go` files dispatch to the Go phase rules instead of being silently
282
+ // skipped (task #255 — the stdio MCP server bypassed per-language
283
+ // dispatch and left every Go rule `notApplicable`).
284
+ const auditResult = await createAuditRunner({
556
285
  projectRoot: auditPath,
557
- enabledAnalyzers: DEFAULT_ANALYZERS,
558
- minSeverity: 'high',
286
+ minSeverity,
559
287
  verbose: false,
560
288
  indexFunctions,
289
+ scope: scope !== 'all' ? scope : undefined,
561
290
  ...(Object.keys(analyzerConfigs).length > 0 && { analyzerConfigs }),
562
- progressCallback: (p) => {
563
- if (p.phase === 'function-indexing' &&
564
- typeof p.current === 'number' &&
565
- typeof p.total === 'number' &&
566
- p.total > 0 &&
567
- p.current % 50 !== 0 &&
568
- p.current !== p.total)
569
- return;
570
- logMcpDebug('audit.health', p.message ?? p.phase ?? 'progress', {
571
- phase: p.phase,
572
- analyzer: p.analyzer,
573
- current: p.current,
574
- total: p.total,
575
- });
576
- },
577
- });
578
- const auditResult = await runner.run();
579
- const healthScore = calculateHealthScore(auditResult);
580
- let indexingResult = null;
291
+ }).run();
581
292
  if (indexFunctions && auditResult.metadata.fileToFunctionsMap) {
582
293
  try {
583
- const syncStats = { added: 0, updated: 0, removed: 0 };
584
294
  for (const [filePath, functions] of Object.entries(auditResult.metadata.fileToFunctionsMap)) {
585
- const fileStats = await syncFileIndex(filePath, functions);
586
- syncStats.added += fileStats.added;
587
- syncStats.updated += fileStats.updated;
588
- syncStats.removed += fileStats.removed;
295
+ await syncFileIndex(filePath, functions);
589
296
  }
590
- indexingResult = {
591
- success: true,
592
- registered: syncStats.added + syncStats.updated,
593
- failed: 0,
594
- syncStats,
595
- };
596
297
  }
597
298
  catch {
598
- // best-effort
299
+ // indexing is best-effort for sync audit
599
300
  }
600
301
  }
601
- let codeMapResult = null;
602
- if (generateCodeMap && indexingResult && indexingResult.success) {
302
+ return {
303
+ success: true,
304
+ summary: auditResult.summary,
305
+ violations: auditResult.analyzerResults,
306
+ metadata: auditResult.metadata,
307
+ guidance: 'The audit takes readings, not verdicts. Severity is urgency — how fast a defect bites, never whether you may ignore it; there is no "noise" tier. Work criticals first, then severe, then high. The coverage panel tells you what was actually measured. Documentation readings (missing JSDoc) are maintainability gaps. If you decline a reading, record why instead of silently dismissing it.',
308
+ };
309
+ });
310
+ },
311
+ },
312
+ {
313
+ name: 'start',
314
+ description: 'Start a background audit job. Returns immediately with a jobId. Poll `audit.status` until completed, then fetch pages with `audit.results`.',
315
+ parameters: [
316
+ {
317
+ name: 'path',
318
+ type: 'string',
319
+ required: false,
320
+ description: 'File or directory path to audit (defaults to current directory).',
321
+ default: process.cwd(),
322
+ },
323
+ {
324
+ name: 'minSeverity',
325
+ type: 'string',
326
+ required: false,
327
+ description: 'Minimum severity level to report (high included by default).',
328
+ default: 'high',
329
+ enum: ['high', 'severe', 'critical'],
330
+ },
331
+ {
332
+ name: 'indexFunctions',
333
+ type: 'boolean',
334
+ required: false,
335
+ description: 'Index functions during audit (default: true).',
336
+ default: true,
337
+ },
338
+ {
339
+ name: 'analyzerConfigs',
340
+ type: 'object',
341
+ required: false,
342
+ description: OPTION_ANALYZER_OVERRIDES,
343
+ },
344
+ {
345
+ name: 'scope',
346
+ type: 'string',
347
+ required: false,
348
+ description: 'Audit scope: "all" (default), "changed" (files differing from index), "git:<ref>" (diff against a git ref), or a comma-separated list of file paths.',
349
+ default: 'all',
350
+ },
351
+ {
352
+ name: 'jobTimeoutMs',
353
+ type: 'number',
354
+ required: false,
355
+ description: 'Max wall time for the audit job (default 30m, cap 4h).',
356
+ },
357
+ {
358
+ name: 'generateCodeMap',
359
+ type: 'boolean',
360
+ required: false,
361
+ description: 'Generate code map artifacts during audit (default: false).',
362
+ default: false,
363
+ },
364
+ ],
365
+ handler: async (args, signal) => {
366
+ return withAbortSignal(signal, 'audit.start', () => startAuditJob(args, {
367
+ defaultMinSeverity: 'high',
368
+ defaultGenerateCodeMap: false,
369
+ }));
370
+ },
371
+ },
372
+ {
373
+ name: 'status',
374
+ description: 'Get current status for a previously started background audit job.',
375
+ parameters: [
376
+ {
377
+ name: 'jobId',
378
+ type: 'string',
379
+ required: true,
380
+ description: 'Job ID returned by `audit start`.',
381
+ },
382
+ ],
383
+ handler: async (args) => {
384
+ const jobId = args.jobId;
385
+ if (!jobId)
386
+ throw new Error('audit.status requires jobId');
387
+ return await getAuditJobStatus(jobId);
388
+ },
389
+ },
390
+ {
391
+ name: 'results',
392
+ description: 'Fetch paginated violations for a completed audit result by resultId.',
393
+ parameters: [
394
+ {
395
+ name: 'resultId',
396
+ type: 'string',
397
+ required: false,
398
+ description: 'Result ID returned by `audit status` when completed. Also accepts legacy `auditId`.',
399
+ },
400
+ {
401
+ name: 'auditId',
402
+ type: 'string',
403
+ required: false,
404
+ description: 'Backward-compatible alias for resultId.',
405
+ },
406
+ {
407
+ name: 'limit',
408
+ type: 'number',
409
+ required: false,
410
+ description: 'Maximum violations per page (default: 50, max: 100).',
411
+ default: 50,
412
+ },
413
+ {
414
+ name: 'offset',
415
+ type: 'number',
416
+ required: false,
417
+ description: 'Violation offset for pagination (default: 0).',
418
+ default: 0,
419
+ },
420
+ {
421
+ name: 'format',
422
+ type: 'string',
423
+ required: false,
424
+ description: 'Output format. "json" (default, structured data) or "sarif" (SARIF 2.1.0 JSON string).',
425
+ },
426
+ ],
427
+ handler: async (args, signal) => {
428
+ const format = args.format || 'json';
429
+ if (format === 'sarif') {
430
+ return withAbortSignal(signal, 'audit.results', () => getAuditResultsAsSarif(args));
431
+ }
432
+ return withAbortSignal(signal, 'audit.results', () => getAuditResultsPage(args));
433
+ },
434
+ },
435
+ {
436
+ name: 'health',
437
+ description: 'Quick health check of a codebase with key metrics and optional code map generation.',
438
+ parameters: [
439
+ {
440
+ name: 'path',
441
+ type: 'string',
442
+ required: false,
443
+ description: 'The directory path to check.',
444
+ default: process.cwd(),
445
+ },
446
+ {
447
+ name: 'threshold',
448
+ type: 'number',
449
+ required: false,
450
+ description: 'Health score threshold (0-100) for pass/fail.',
451
+ default: 70,
452
+ },
453
+ {
454
+ name: 'indexFunctions',
455
+ type: 'boolean',
456
+ required: false,
457
+ description: 'Automatically index functions during health check.',
458
+ default: true,
459
+ },
460
+ {
461
+ name: 'analyzerConfigs',
462
+ type: 'object',
463
+ required: false,
464
+ description: OPTION_ANALYZER_OVERRIDES,
465
+ },
466
+ {
467
+ name: 'generateCodeMap',
468
+ type: 'boolean',
469
+ required: false,
470
+ description: 'Generate and return a human-readable code map.',
471
+ default: true,
472
+ },
473
+ ],
474
+ handler: async (args) => {
475
+ const auditPath = path.resolve(args.path || process.cwd());
476
+ await assertAuditPathExists(auditPath);
477
+ const threshold = args.threshold || 70;
478
+ const indexFunctions = args.indexFunctions !== false;
479
+ const generateCodeMap = args.generateCodeMap !== false;
480
+ const db = CodeIndexDB.getInstance();
481
+ await db.initialize();
482
+ const storedConfigs = await db.analyzerConfig.getAllAnalyzerConfigs(auditPath);
483
+ const analyzerConfigs = {
484
+ ...storedConfigs,
485
+ ...(args.analyzerConfigs || {}),
486
+ };
487
+ const auditResult = await createAuditRunner({
488
+ projectRoot: auditPath,
489
+ minSeverity: 'high',
490
+ verbose: false,
491
+ indexFunctions,
492
+ ...(Object.keys(analyzerConfigs).length > 0 && { analyzerConfigs }),
493
+ progressCallback: (p) => {
494
+ if (p.phase === 'function-indexing' &&
495
+ typeof p.current === 'number' &&
496
+ typeof p.total === 'number' &&
497
+ p.total > 0 &&
498
+ p.current % 50 !== 0 &&
499
+ p.current !== p.total)
500
+ return;
501
+ logMcpDebug('audit.health', p.message ?? p.phase ?? 'progress', {
502
+ phase: p.phase,
503
+ analyzer: p.analyzer,
504
+ current: p.current,
505
+ total: p.total,
506
+ });
507
+ },
508
+ }).run();
509
+ const healthScore = calculateHealthScore(auditResult);
510
+ let indexingResult = null;
511
+ if (indexFunctions && auditResult.metadata.fileToFunctionsMap) {
512
+ try {
513
+ const syncStats = { added: 0, updated: 0, removed: 0 };
514
+ for (const [filePath, functions] of Object.entries(auditResult.metadata.fileToFunctionsMap)) {
515
+ const fileStats = await syncFileIndex(filePath, functions);
516
+ syncStats.added += fileStats.added;
517
+ syncStats.updated += fileStats.updated;
518
+ syncStats.removed += fileStats.removed;
519
+ }
520
+ indexingResult = {
521
+ success: true,
522
+ registered: syncStats.added + syncStats.updated,
523
+ failed: 0,
524
+ syncStats,
525
+ };
526
+ }
527
+ catch {
528
+ // best-effort
529
+ }
530
+ }
531
+ let codeMapResult = null;
532
+ if (generateCodeMap && indexingResult && indexingResult.success) {
533
+ try {
534
+ const mapGenerator = new CodeMapGenerator();
535
+ const mapOptions = {
536
+ includeComplexity: true,
537
+ includeDocumentation: true,
538
+ includeDependencies: true,
539
+ includeUsage: false,
540
+ groupByDirectory: true,
541
+ maxDepth: 8,
542
+ showUnusedImports: true,
543
+ minComplexity: 7,
544
+ };
545
+ let documentation;
603
546
  try {
604
- const mapGenerator = new CodeMapGenerator();
605
- const mapOptions = {
606
- includeComplexity: true,
607
- includeDocumentation: true,
608
- includeDependencies: true,
609
- includeUsage: false,
610
- groupByDirectory: true,
611
- maxDepth: 8,
612
- showUnusedImports: true,
613
- minComplexity: 7,
614
- };
615
- let documentation;
616
- try {
617
- const files = Object.keys(auditResult.metadata.fileToFunctionsMap || {});
618
- if (files.length > 0) {
619
- const docResult = await analyzeDocumentation(files);
620
- documentation = docResult.metrics;
621
- }
622
- }
623
- catch {
624
- // best-effort
547
+ const files = Object.keys(auditResult.metadata.fileToFunctionsMap || {});
548
+ if (files.length > 0) {
549
+ const docResult = await analyzeDocumentation(files);
550
+ documentation = docResult.metrics;
625
551
  }
626
- const paginatedResult = await mapGenerator.generatePaginatedCodeMap(auditPath, {
627
- ...mapOptions,
628
- includeDocumentation: !!documentation,
629
- });
630
- codeMapResult = {
631
- success: true,
632
- mapId: paginatedResult.mapId,
633
- summary: paginatedResult.summary,
634
- quickPreview: paginatedResult.quickPreview,
635
- sections: paginatedResult.summary.sectionsAvailable,
636
- documentationCoverage: documentation?.coverageScore,
637
- };
638
552
  }
639
- catch (error) {
640
- codeMapResult = {
641
- success: false,
642
- error: error instanceof Error ? error.message : 'Failed to generate code map',
643
- };
553
+ catch {
554
+ // best-effort
644
555
  }
556
+ const paginatedResult = await mapGenerator.generatePaginatedCodeMap(auditPath, {
557
+ ...mapOptions,
558
+ includeDocumentation: !!documentation,
559
+ });
560
+ codeMapResult = {
561
+ success: true,
562
+ mapId: paginatedResult.mapId,
563
+ summary: paginatedResult.summary,
564
+ quickPreview: paginatedResult.quickPreview,
565
+ sections: paginatedResult.summary.sectionsAvailable,
566
+ documentationCoverage: documentation?.coverageScore,
567
+ };
645
568
  }
646
- return {
647
- healthScore,
648
- threshold,
649
- passed: healthScore >= threshold,
650
- status: healthScore >= threshold ? 'healthy' : 'needs-attention',
651
- metrics: {
652
- filesAnalyzed: auditResult.metadata.filesAnalyzed,
653
- totalViolations: auditResult.summary.totalViolations,
654
- criticalViolations: auditResult.summary.criticalIssues,
655
- severeViolations: auditResult.summary.severe,
656
- highViolations: auditResult.summary.high,
657
- },
658
- recommendation: getHealthRecommendation(healthScore, auditResult),
659
- ...(indexingResult && { functionIndexing: indexingResult }),
660
- ...(codeMapResult && { codeMap: codeMapResult }),
661
- };
662
- },
569
+ catch (error) {
570
+ codeMapResult = {
571
+ success: false,
572
+ error: error instanceof Error ? error.message : 'Failed to generate code map',
573
+ };
574
+ }
575
+ }
576
+ return {
577
+ healthScore,
578
+ threshold,
579
+ passed: healthScore >= threshold,
580
+ status: healthScore >= threshold ? 'healthy' : 'needs-attention',
581
+ metrics: {
582
+ filesAnalyzed: auditResult.metadata.filesAnalyzed,
583
+ totalViolations: auditResult.summary.totalViolations,
584
+ criticalViolations: auditResult.summary.criticalIssues,
585
+ severeViolations: auditResult.summary.severe,
586
+ highViolations: auditResult.summary.high,
587
+ },
588
+ recommendation: getHealthRecommendation(healthScore, auditResult),
589
+ ...(indexingResult && { functionIndexing: indexingResult }),
590
+ ...(codeMapResult && { codeMap: codeMapResult }),
591
+ };
663
592
  },
664
- ];
593
+ },
594
+ ];
595
+ function registerAuditTool(registry) {
665
596
  registry.register({
666
597
  name: 'audit',
667
598
  description: 'Run code quality audits (synchronous or background), check status, fetch paginated results, and get health checks. Actions: run (sync audit, returns full results), start (background job), status (poll a job), results (paginated violations), health (score + code map).',
668
599
  actions: auditActions,
669
600
  });
670
- // ── search ─────────────────────────────────────────────────────────────────
601
+ }
602
+ // ── search ─────────────────────────────────────────────────────────────────
603
+ function registerSearchTool(registry) {
671
604
  registry.register({
672
605
  name: 'search',
673
606
  description: 'Search indexed functions and components. Actions: query (natural language + operators like entity:, component:, hook:, dep:, calls:, lang:, complexity:, exported:, jsdoc:, file:, unused-imports, name:), definition (exact function/component lookup).',
@@ -741,7 +674,9 @@ function registerAllTools(registry) {
741
674
  },
742
675
  ],
743
676
  });
744
- // ── index ──────────────────────────────────────────────────────────────────
677
+ }
678
+ // ── index ──────────────────────────────────────────────────────────────────
679
+ function registerIndexTool(registry) {
745
680
  registry.register({
746
681
  name: 'index',
747
682
  description: 'Manage the code index. Actions: sync (update from files with optional auto-whitelist), cleanup (remove deleted files), reset (clear analysis data, preserve tasks/config/whitelist), status (index statistics).',
@@ -857,7 +792,7 @@ function registerAllTools(registry) {
857
792
  handler: async () => {
858
793
  const db = CodeIndexDB.getInstance();
859
794
  await db.initialize();
860
- const functionCount = await db.getFunctionCount();
795
+ const functionCount = await db.functionIndex.getFunctionCount();
861
796
  return {
862
797
  success: true,
863
798
  functionCount,
@@ -866,426 +801,431 @@ function registerAllTools(registry) {
866
801
  },
867
802
  ],
868
803
  });
869
- // ── config ─────────────────────────────────────────────────────────────────
870
- registry.register({
871
- name: 'config',
872
- description: 'Manage analyzer configurations, generate AI tool configs, manage whitelists, and manage invariant rules. Actions: get, set, reset (analyzer configs), generate (AI tool config files), whitelist_list, whitelist_add, whitelist_update, whitelist_detect, rules_list, rules_check.',
873
- actions: [
804
+ }
805
+ // ── config ─────────────────────────────────────────────────────────────────
806
+ const configActions = [
807
+ {
808
+ name: 'get',
809
+ description: 'Get current configuration for an analyzer (or all).',
810
+ parameters: [
874
811
  {
875
- name: 'get',
876
- description: 'Get current configuration for an analyzer (or all).',
877
- parameters: [
878
- {
879
- name: 'analyzerName',
880
- type: 'string',
881
- required: false,
882
- description: 'Specific analyzer name, or omit to get all configs.',
883
- },
884
- {
885
- name: 'projectPath',
886
- type: 'string',
887
- required: false,
888
- description: 'Optional project path for project-specific config.',
889
- },
890
- ],
891
- handler: async (args) => {
892
- const analyzerName = args.analyzerName;
893
- const projectPath = args.projectPath;
894
- const db = CodeIndexDB.getInstance();
895
- await db.initialize();
896
- if (analyzerName) {
897
- const config = await db.getAnalyzerConfig(analyzerName, projectPath);
898
- return {
899
- success: true,
900
- analyzer: analyzerName,
901
- config: config || null,
902
- scope: projectPath ? 'project' : 'global',
903
- message: config ? 'Configuration found' : 'No custom configuration found, using defaults',
904
- };
905
- }
906
- const configs = await db.getAllAnalyzerConfigs(projectPath);
907
- return {
908
- success: true,
909
- configs,
910
- scope: projectPath ? 'project' : 'global',
911
- message: `Found ${Object.keys(configs).length} analyzer configurations`,
912
- };
913
- },
812
+ name: 'analyzerName',
813
+ type: 'string',
814
+ required: false,
815
+ description: 'Specific analyzer name, or omit to get all configs.',
914
816
  },
915
817
  {
916
- name: 'set',
917
- description: 'Set or update analyzer configuration that persists across audit runs.',
918
- parameters: [
919
- {
920
- name: 'analyzerName',
921
- type: 'string',
922
- required: true,
923
- description: 'The analyzer to configure (solid, dry, security, etc.).',
924
- },
925
- {
926
- name: 'config',
927
- type: 'object',
928
- required: true,
929
- description: 'Configuration object for the analyzer (e.g., thresholds, rules).',
930
- },
931
- {
932
- name: 'projectPath',
933
- type: 'string',
934
- required: false,
935
- description: 'Optional project path for project-specific config.',
936
- },
937
- ],
938
- handler: async (args) => {
939
- const analyzerName = args.analyzerName;
940
- const config = args.config;
941
- const projectPath = args.projectPath;
942
- const db = CodeIndexDB.getInstance();
943
- await db.initialize();
944
- await db.storeAnalyzerConfig(analyzerName, config, {
945
- projectPath,
946
- isGlobal: !projectPath,
947
- });
948
- return {
949
- success: true,
950
- message: `Configuration for ${analyzerName} analyzer has been saved${projectPath ? ` for project ${projectPath}` : ' globally'}`,
951
- analyzer: analyzerName,
952
- scope: projectPath ? 'project' : 'global',
953
- config,
954
- };
955
- },
818
+ name: 'projectPath',
819
+ type: 'string',
820
+ required: false,
821
+ description: 'Optional project path for project-specific config.',
956
822
  },
823
+ ],
824
+ handler: async (args) => {
825
+ const analyzerName = args.analyzerName;
826
+ const projectPath = args.projectPath;
827
+ const db = CodeIndexDB.getInstance();
828
+ await db.initialize();
829
+ if (analyzerName) {
830
+ const config = await db.analyzerConfig.getAnalyzerConfig(analyzerName, projectPath);
831
+ return {
832
+ success: true,
833
+ analyzer: analyzerName,
834
+ config: config || null,
835
+ scope: projectPath ? 'project' : 'global',
836
+ message: config ? 'Configuration found' : 'No custom configuration found, using defaults',
837
+ };
838
+ }
839
+ const configs = await db.analyzerConfig.getAllAnalyzerConfigs(projectPath);
840
+ return {
841
+ success: true,
842
+ configs,
843
+ scope: projectPath ? 'project' : 'global',
844
+ message: `Found ${Object.keys(configs).length} analyzer configurations`,
845
+ };
846
+ },
847
+ },
848
+ {
849
+ name: 'set',
850
+ description: 'Set or update analyzer configuration that persists across audit runs.',
851
+ parameters: [
957
852
  {
958
- name: 'reset',
959
- description: 'Reset analyzer configuration to defaults.',
960
- parameters: [
961
- {
962
- name: 'analyzerName',
963
- type: 'string',
964
- required: false,
965
- description: 'Specific analyzer to reset, or omit to reset all.',
966
- },
967
- {
968
- name: 'projectPath',
969
- type: 'string',
970
- required: false,
971
- description: 'Optional project path to reset only project-specific config.',
972
- },
973
- ],
974
- handler: async (args) => {
975
- const analyzerName = args.analyzerName;
976
- const projectPath = args.projectPath;
977
- const db = CodeIndexDB.getInstance();
978
- await db.initialize();
979
- if (analyzerName) {
980
- const deleted = await db.deleteAnalyzerConfig(analyzerName, {
981
- projectPath,
982
- isGlobal: !projectPath,
983
- });
984
- return {
985
- success: deleted,
986
- message: deleted
987
- ? `Configuration for ${analyzerName} analyzer has been reset${projectPath ? ` for project ${projectPath}` : ' globally'}`
988
- : `No configuration found for ${analyzerName} analyzer`,
989
- analyzer: analyzerName,
990
- scope: projectPath ? 'project' : 'global',
991
- };
992
- }
993
- await db.resetAnalyzerConfigs(projectPath);
994
- return {
995
- success: true,
996
- message: projectPath
997
- ? `All project-specific configurations for ${projectPath} have been reset`
998
- : 'All analyzer configurations have been reset to defaults',
999
- scope: projectPath ? 'project' : 'global',
1000
- };
1001
- },
853
+ name: 'analyzerName',
854
+ type: 'string',
855
+ required: true,
856
+ description: 'The analyzer to configure (solid, dry, security, etc.).',
1002
857
  },
1003
858
  {
1004
- name: 'generate',
1005
- description: 'Generate configuration files for AI coding assistants (Cursor, Claude, Copilot, etc.).',
1006
- parameters: [
1007
- {
1008
- name: 'tools',
1009
- type: 'array',
1010
- required: true,
1011
- description: 'AI tools to configure (claude, codex, cursor, gemini, copilot, continue, awsq, codeium, vscode, cline, zcode).',
1012
- },
1013
- {
1014
- name: 'outputDir',
1015
- type: 'string',
1016
- required: false,
1017
- description: 'Output directory for configuration files.',
1018
- default: '.',
1019
- },
1020
- {
1021
- name: 'serverUrl',
1022
- type: 'string',
1023
- required: false,
1024
- description: 'MCP server URL (default: auto-detected).',
1025
- default: DEFAULT_SERVER_URL,
1026
- },
1027
- {
1028
- name: 'overwrite',
1029
- type: 'boolean',
1030
- required: false,
1031
- description: 'Overwrite existing files (default: false).',
1032
- default: false,
1033
- },
1034
- ],
1035
- handler: async (args) => {
1036
- const tools = args.tools;
1037
- const serverUrl = args.serverUrl || DEFAULT_SERVER_URL;
1038
- const rawOutputDir = args.outputDir || '.';
1039
- // Containment (Spec 61 R5.1): generated configs land only inside the
1040
- // working directory. `~` expansion still resolves (so a project under
1041
- // `~` keeps working), but it is no longer a way to escape cwd.
1042
- const outputDir = resolveConfigGenerateDir(rawOutputDir, process.cwd());
1043
- const overwrite = args.overwrite || false;
1044
- if (!Array.isArray(tools) || tools.length === 0)
1045
- throw new Error('tools parameter must be a non-empty array');
1046
- const factory = new ConfigGeneratorFactory(serverUrl);
1047
- const generatedFiles = [];
1048
- const errors = [];
1049
- for (const tool of tools) {
1050
- try {
1051
- const generator = factory.createGenerator(tool);
1052
- if (!generator) {
1053
- errors.push(`Unknown tool: ${tool}`);
1054
- continue;
1055
- }
1056
- const config = generator.generateConfig();
1057
- const outputPath = path.resolve(outputDir, config.filename);
1058
- let fileExists = false;
1059
- try {
1060
- await fs.access(outputPath);
1061
- fileExists = true;
1062
- }
1063
- catch {
1064
- // doesn't exist
1065
- }
1066
- if (fileExists && !overwrite) {
1067
- errors.push(`File already exists: ${config.filename} (use overwrite: true to replace)`);
1068
- continue;
1069
- }
1070
- await fs.mkdir(path.dirname(outputPath), { recursive: true });
1071
- await fs.writeFile(outputPath, config.content);
1072
- generatedFiles.push(config.filename);
1073
- if (config.additionalFiles) {
1074
- for (const additionalFile of config.additionalFiles) {
1075
- const additionalPath = path.resolve(outputDir, additionalFile.filename);
1076
- await fs.mkdir(path.dirname(additionalPath), { recursive: true });
1077
- await fs.writeFile(additionalPath, additionalFile.content);
1078
- generatedFiles.push(additionalFile.filename);
1079
- }
1080
- }
1081
- }
1082
- catch (error) {
1083
- errors.push(`Failed to generate config for ${tool}: ${error instanceof Error ? error.message : 'Unknown error'}`);
1084
- }
1085
- }
1086
- return {
1087
- success: errors.length === 0,
1088
- generatedFiles,
1089
- errors: errors.length > 0 ? errors : undefined,
1090
- totalRequested: tools.length,
1091
- totalGenerated: generatedFiles.length,
1092
- };
1093
- },
859
+ name: 'config',
860
+ type: 'object',
861
+ required: true,
862
+ description: 'Configuration object for the analyzer (e.g., thresholds, rules).',
1094
863
  },
1095
864
  {
1096
- name: 'whitelist_list',
1097
- description: 'Get current whitelist entries for dependency and class instantiation checks.',
1098
- parameters: [
1099
- {
1100
- name: 'type',
1101
- type: 'string',
1102
- required: false,
1103
- description: 'Filter by type: platform-api, framework-class, project-dep, shared-library, node-builtin.',
1104
- enum: ['platform-api', 'framework-class', 'project-dep', 'shared-library', 'node-builtin'],
1105
- },
1106
- {
1107
- name: 'status',
1108
- type: 'string',
1109
- required: false,
1110
- description: 'Filter by status: active, pending, rejected, disabled.',
1111
- enum: ['active', 'pending', 'rejected', 'disabled'],
1112
- },
1113
- ],
1114
- handler: async (args) => {
1115
- const { handleWhitelistGet } = await import('./mcp-tools/whitelistTools.js');
1116
- return handleWhitelistGet(args);
1117
- },
865
+ name: 'projectPath',
866
+ type: 'string',
867
+ required: false,
868
+ description: 'Optional project path for project-specific config.',
1118
869
  },
870
+ ],
871
+ handler: async (args) => {
872
+ const analyzerName = args.analyzerName;
873
+ const config = args.config;
874
+ const projectPath = args.projectPath;
875
+ const db = CodeIndexDB.getInstance();
876
+ await db.initialize();
877
+ await db.analyzerConfig.storeAnalyzerConfig(analyzerName, config, {
878
+ projectPath,
879
+ isGlobal: !projectPath,
880
+ });
881
+ return {
882
+ success: true,
883
+ message: `Configuration for ${analyzerName} analyzer has been saved${projectPath ? ` for project ${projectPath}` : ' globally'}`,
884
+ analyzer: analyzerName,
885
+ scope: projectPath ? 'project' : 'global',
886
+ config,
887
+ };
888
+ },
889
+ },
890
+ {
891
+ name: 'reset',
892
+ description: 'Reset analyzer configuration to defaults.',
893
+ parameters: [
1119
894
  {
1120
- name: 'whitelist_add',
1121
- description: 'Add a new entry to the whitelist.',
1122
- parameters: [
1123
- {
1124
- name: 'name',
1125
- type: 'string',
1126
- required: true,
1127
- description: 'Class name or import path to whitelist.',
1128
- },
1129
- {
1130
- name: 'type',
1131
- type: 'string',
1132
- required: true,
1133
- description: 'Type of whitelist entry.',
1134
- enum: ['platform-api', 'framework-class', 'project-dep', 'shared-library', 'node-builtin'],
1135
- },
1136
- {
1137
- name: 'description',
1138
- type: 'string',
1139
- required: false,
1140
- description: 'Explanation of why this is whitelisted.',
1141
- },
1142
- {
1143
- name: 'patterns',
1144
- type: 'array',
1145
- required: false,
1146
- description: 'Additional patterns to match (e.g., ["fs/*", "node:fs"]).',
1147
- },
1148
- ],
1149
- handler: async (args) => {
1150
- const { handleWhitelistAdd } = await import('./mcp-tools/whitelistTools.js');
1151
- return handleWhitelistAdd(args);
1152
- },
895
+ name: 'analyzerName',
896
+ type: 'string',
897
+ required: false,
898
+ description: 'Specific analyzer to reset, or omit to reset all.',
1153
899
  },
1154
900
  {
1155
- name: 'whitelist_update',
1156
- description: 'Update the status of a whitelist entry.',
1157
- parameters: [
1158
- {
1159
- name: 'name',
1160
- type: 'string',
1161
- required: true,
1162
- description: 'Name of the whitelist entry to update.',
1163
- },
1164
- {
1165
- name: 'status',
1166
- type: 'string',
1167
- required: true,
1168
- description: 'New status for the entry.',
1169
- enum: ['active', 'pending', 'rejected', 'disabled'],
1170
- },
1171
- ],
1172
- handler: async (args) => {
1173
- const { handleWhitelistUpdateStatus } = await import('./mcp-tools/whitelistTools.js');
1174
- return handleWhitelistUpdateStatus(args);
1175
- },
901
+ name: 'projectPath',
902
+ type: 'string',
903
+ required: false,
904
+ description: 'Optional project path to reset only project-specific config.',
1176
905
  },
906
+ ],
907
+ handler: async (args) => {
908
+ const analyzerName = args.analyzerName;
909
+ const projectPath = args.projectPath;
910
+ const db = CodeIndexDB.getInstance();
911
+ await db.initialize();
912
+ if (analyzerName) {
913
+ const deleted = await db.analyzerConfig.deleteAnalyzerConfig(analyzerName, {
914
+ projectPath,
915
+ isGlobal: !projectPath,
916
+ });
917
+ return {
918
+ success: deleted,
919
+ message: deleted
920
+ ? `Configuration for ${analyzerName} analyzer has been reset${projectPath ? ` for project ${projectPath}` : ' globally'}`
921
+ : `No configuration found for ${analyzerName} analyzer`,
922
+ analyzer: analyzerName,
923
+ scope: projectPath ? 'project' : 'global',
924
+ };
925
+ }
926
+ await db.analyzerConfig.resetAnalyzerConfigs(projectPath);
927
+ return {
928
+ success: true,
929
+ message: projectPath
930
+ ? `All project-specific configurations for ${projectPath} have been reset`
931
+ : 'All analyzer configurations have been reset to defaults',
932
+ scope: projectPath ? 'project' : 'global',
933
+ };
934
+ },
935
+ },
936
+ {
937
+ name: 'generate',
938
+ description: 'Generate configuration files for AI coding assistants (Cursor, Claude, Copilot, etc.).',
939
+ parameters: [
1177
940
  {
1178
- name: 'whitelist_detect',
1179
- description: 'Detect potential whitelist candidates from package.json and usage patterns.',
1180
- parameters: [
1181
- {
1182
- name: 'path',
1183
- type: 'string',
1184
- required: false,
1185
- description: 'Project path to analyze (defaults to current directory).',
1186
- default: process.cwd(),
1187
- },
1188
- {
1189
- name: 'includePackageJson',
1190
- type: 'boolean',
1191
- required: false,
1192
- description: 'Include dependencies from package.json.',
1193
- default: true,
1194
- },
1195
- {
1196
- name: 'autoPopulate',
1197
- type: 'boolean',
1198
- required: false,
1199
- description: 'Automatically add high-confidence entries.',
1200
- default: false,
1201
- },
1202
- ],
1203
- handler: async (args) => {
1204
- const { handleWhitelistDetect } = await import('./mcp-tools/whitelistTools.js');
1205
- return handleWhitelistDetect(args);
1206
- },
941
+ name: 'tools',
942
+ type: 'array',
943
+ required: true,
944
+ description: 'AI tools to configure (claude, codex, cursor, gemini, copilot, continue, awsq, codeium, vscode, cline, zcode).',
1207
945
  },
1208
946
  {
1209
- name: 'rules_list',
1210
- description: 'List all configured invariant rules from .codeauditor.json. Shows rule IDs, kinds, severity, and messages.',
1211
- parameters: [
1212
- {
1213
- name: 'configPath',
1214
- type: 'string',
1215
- required: false,
1216
- description: 'Path to .codeauditor.json (defaults to auto-detect in current working tree).',
1217
- },
1218
- ],
1219
- handler: async (args) => {
1220
- const { readFileSync } = await import('fs');
1221
- const path = await import('path');
1222
- const configPath = args.configPath ||
1223
- path.join(process.cwd(), '.codeauditor.json');
1224
- try {
1225
- const raw = readFileSync(configPath, 'utf-8');
1226
- const config = JSON.parse(raw);
1227
- const rules = config?.rules ?? [];
1228
- return {
1229
- rules: rules.map((r) => ({
1230
- id: r.id,
1231
- kind: r.kind,
1232
- severity: r.severity,
1233
- message: r.message || null,
1234
- })),
1235
- count: rules.length,
1236
- configPath,
1237
- };
1238
- }
1239
- catch (err) {
1240
- return {
1241
- error: `Failed to read rules: ${err.message}`,
1242
- configPath,
1243
- rules: [],
1244
- count: 0,
1245
- };
1246
- }
1247
- },
947
+ name: 'outputDir',
948
+ type: 'string',
949
+ required: false,
950
+ description: 'Output directory for configuration files.',
951
+ default: '.',
1248
952
  },
1249
953
  {
1250
- name: 'rules_check',
1251
- description: 'Validate the current .codeauditor.json rules (schema, duplicate IDs, valid globs/regex, mutual exclusivity). Returns any config errors.',
1252
- parameters: [
1253
- {
1254
- name: 'configPath',
1255
- type: 'string',
1256
- required: false,
1257
- description: 'Path to .codeauditor.json (defaults to auto-detect in current working tree).',
1258
- },
1259
- ],
1260
- handler: async (args) => {
1261
- const { validateRulesConfig } = await import('./invariants/ruleValidator.js');
1262
- const { readFileSync } = await import('fs');
1263
- const path = await import('path');
1264
- const configPath = args.configPath ||
1265
- path.join(process.cwd(), '.codeauditor.json');
954
+ name: 'serverUrl',
955
+ type: 'string',
956
+ required: false,
957
+ description: 'MCP server URL (default: auto-detected).',
958
+ default: DEFAULT_SERVER_URL,
959
+ },
960
+ {
961
+ name: 'overwrite',
962
+ type: 'boolean',
963
+ required: false,
964
+ description: 'Overwrite existing files (default: false).',
965
+ default: false,
966
+ },
967
+ ],
968
+ handler: async (args) => {
969
+ const tools = args.tools;
970
+ const serverUrl = args.serverUrl || DEFAULT_SERVER_URL;
971
+ const rawOutputDir = args.outputDir || '.';
972
+ // Containment (Spec 61 R5.1): generated configs land only inside the
973
+ // working directory. `~` expansion still resolves (so a project under
974
+ // `~` keeps working), but it is no longer a way to escape cwd.
975
+ const outputDir = resolveConfigGenerateDir(rawOutputDir, process.cwd());
976
+ const overwrite = args.overwrite || false;
977
+ if (!Array.isArray(tools) || tools.length === 0)
978
+ throw new Error('tools parameter must be a non-empty array');
979
+ const factory = new ConfigGeneratorFactory(serverUrl);
980
+ const generatedFiles = [];
981
+ const errors = [];
982
+ for (const tool of tools) {
983
+ try {
984
+ const generator = factory.createGenerator(tool);
985
+ if (!generator) {
986
+ errors.push(`Unknown tool: ${tool}`);
987
+ continue;
988
+ }
989
+ const config = generator.generateConfig();
990
+ const outputPath = path.resolve(outputDir, config.filename);
991
+ let fileExists = false;
1266
992
  try {
1267
- const raw = readFileSync(configPath, 'utf-8');
1268
- const config = JSON.parse(raw);
1269
- const rulesArray = config?.rules;
1270
- const errors = validateRulesConfig({ rules: rulesArray ?? [] });
1271
- return {
1272
- valid: errors.length === 0,
1273
- errors: errors.map(e => ({ ruleId: e.ruleId || null, message: e.message })),
1274
- configPath,
1275
- };
993
+ await fs.access(outputPath);
994
+ fileExists = true;
1276
995
  }
1277
- catch (err) {
1278
- return {
1279
- valid: false,
1280
- errors: [{ message: `Failed to read/parse config: ${err.message}` }],
1281
- configPath,
1282
- };
996
+ catch {
997
+ // doesn't exist
1283
998
  }
1284
- },
999
+ if (fileExists && !overwrite) {
1000
+ errors.push(`File already exists: ${config.filename} (use overwrite: true to replace)`);
1001
+ continue;
1002
+ }
1003
+ await fs.mkdir(path.dirname(outputPath), { recursive: true });
1004
+ await fs.writeFile(outputPath, config.content);
1005
+ generatedFiles.push(config.filename);
1006
+ if (config.additionalFiles) {
1007
+ for (const additionalFile of config.additionalFiles) {
1008
+ const additionalPath = path.resolve(outputDir, additionalFile.filename);
1009
+ await fs.mkdir(path.dirname(additionalPath), { recursive: true });
1010
+ await fs.writeFile(additionalPath, additionalFile.content);
1011
+ generatedFiles.push(additionalFile.filename);
1012
+ }
1013
+ }
1014
+ }
1015
+ catch (error) {
1016
+ errors.push(`Failed to generate config for ${tool}: ${errorMessage(error)}`);
1017
+ }
1018
+ }
1019
+ return {
1020
+ success: errors.length === 0,
1021
+ generatedFiles,
1022
+ errors: errors.length > 0 ? errors : undefined,
1023
+ totalRequested: tools.length,
1024
+ totalGenerated: generatedFiles.length,
1025
+ };
1026
+ },
1027
+ },
1028
+ {
1029
+ name: 'whitelist_list',
1030
+ description: 'Get current whitelist entries for dependency and class instantiation checks.',
1031
+ parameters: [
1032
+ {
1033
+ name: 'type',
1034
+ type: 'string',
1035
+ required: false,
1036
+ description: 'Filter by type: platform-api, framework-class, project-dep, shared-library, node-builtin.',
1037
+ enum: ['platform-api', 'framework-class', 'project-dep', 'shared-library', 'node-builtin'],
1038
+ },
1039
+ {
1040
+ name: 'status',
1041
+ type: 'string',
1042
+ required: false,
1043
+ description: 'Filter by status: active, pending, rejected, disabled.',
1044
+ enum: ['active', 'pending', 'rejected', 'disabled'],
1045
+ },
1046
+ ],
1047
+ handler: async (args) => {
1048
+ const { handleWhitelistGet } = await import('./mcp-tools/whitelistTools.js');
1049
+ return handleWhitelistGet(args);
1050
+ },
1051
+ },
1052
+ {
1053
+ name: 'whitelist_add',
1054
+ description: 'Add a new entry to the whitelist.',
1055
+ parameters: [
1056
+ {
1057
+ name: 'name',
1058
+ type: 'string',
1059
+ required: true,
1060
+ description: 'Class name or import path to whitelist.',
1061
+ },
1062
+ {
1063
+ name: 'type',
1064
+ type: 'string',
1065
+ required: true,
1066
+ description: 'Type of whitelist entry.',
1067
+ enum: ['platform-api', 'framework-class', 'project-dep', 'shared-library', 'node-builtin'],
1068
+ },
1069
+ {
1070
+ name: 'description',
1071
+ type: 'string',
1072
+ required: false,
1073
+ description: 'Explanation of why this is whitelisted.',
1074
+ },
1075
+ {
1076
+ name: 'patterns',
1077
+ type: 'array',
1078
+ required: false,
1079
+ description: 'Additional patterns to match (e.g., ["fs/*", "node:fs"]).',
1080
+ },
1081
+ ],
1082
+ handler: async (args) => {
1083
+ const { handleWhitelistAdd } = await import('./mcp-tools/whitelistTools.js');
1084
+ return handleWhitelistAdd(args);
1085
+ },
1086
+ },
1087
+ {
1088
+ name: 'whitelist_update',
1089
+ description: 'Update the status of a whitelist entry.',
1090
+ parameters: [
1091
+ {
1092
+ name: 'name',
1093
+ type: 'string',
1094
+ required: true,
1095
+ description: 'Name of the whitelist entry to update.',
1096
+ },
1097
+ {
1098
+ name: 'status',
1099
+ type: 'string',
1100
+ required: true,
1101
+ description: 'New status for the entry.',
1102
+ enum: ['active', 'pending', 'rejected', 'disabled'],
1285
1103
  },
1286
1104
  ],
1105
+ handler: async (args) => {
1106
+ const { handleWhitelistUpdateStatus } = await import('./mcp-tools/whitelistTools.js');
1107
+ return handleWhitelistUpdateStatus(args);
1108
+ },
1109
+ },
1110
+ {
1111
+ name: 'whitelist_detect',
1112
+ description: 'Detect potential whitelist candidates from package.json and usage patterns.',
1113
+ parameters: [
1114
+ {
1115
+ name: 'path',
1116
+ type: 'string',
1117
+ required: false,
1118
+ description: 'Project path to analyze (defaults to current directory).',
1119
+ default: process.cwd(),
1120
+ },
1121
+ {
1122
+ name: 'includePackageJson',
1123
+ type: 'boolean',
1124
+ required: false,
1125
+ description: 'Include dependencies from package.json.',
1126
+ default: true,
1127
+ },
1128
+ {
1129
+ name: 'autoPopulate',
1130
+ type: 'boolean',
1131
+ required: false,
1132
+ description: 'Automatically add high-confidence entries.',
1133
+ default: false,
1134
+ },
1135
+ ],
1136
+ handler: async (args) => {
1137
+ const { handleWhitelistDetect } = await import('./mcp-tools/whitelistTools.js');
1138
+ return handleWhitelistDetect(args);
1139
+ },
1140
+ },
1141
+ {
1142
+ name: 'rules_list',
1143
+ description: 'List all configured invariant rules from .codeauditor.json. Shows rule IDs, kinds, severity, and messages.',
1144
+ parameters: [
1145
+ {
1146
+ name: 'configPath',
1147
+ type: 'string',
1148
+ required: false,
1149
+ description: 'Path to .codeauditor.json (defaults to auto-detect in current working tree).',
1150
+ },
1151
+ ],
1152
+ handler: async (args) => {
1153
+ const { readFileSync } = await import('fs');
1154
+ const path = await import('path');
1155
+ const configPath = args.configPath ||
1156
+ path.join(process.cwd(), '.codeauditor.json');
1157
+ try {
1158
+ const raw = readFileSync(configPath, 'utf-8');
1159
+ const config = JSON.parse(raw);
1160
+ const rules = config?.rules ?? [];
1161
+ return {
1162
+ rules: rules.map((r) => ({
1163
+ id: r.id,
1164
+ kind: r.kind,
1165
+ severity: r.severity,
1166
+ message: r.message || null,
1167
+ })),
1168
+ count: rules.length,
1169
+ configPath,
1170
+ };
1171
+ }
1172
+ catch (err) {
1173
+ return {
1174
+ error: `Failed to read rules: ${err.message}`,
1175
+ configPath,
1176
+ rules: [],
1177
+ count: 0,
1178
+ };
1179
+ }
1180
+ },
1181
+ },
1182
+ {
1183
+ name: 'rules_check',
1184
+ description: 'Validate the current .codeauditor.json rules (schema, duplicate IDs, valid globs/regex, mutual exclusivity). Returns any config errors.',
1185
+ parameters: [
1186
+ {
1187
+ name: 'configPath',
1188
+ type: 'string',
1189
+ required: false,
1190
+ description: 'Path to .codeauditor.json (defaults to auto-detect in current working tree).',
1191
+ },
1192
+ ],
1193
+ handler: async (args) => {
1194
+ const { validateRulesConfig } = await import('./invariants/ruleValidator.js');
1195
+ const { readFileSync } = await import('fs');
1196
+ const path = await import('path');
1197
+ const configPath = args.configPath ||
1198
+ path.join(process.cwd(), '.codeauditor.json');
1199
+ try {
1200
+ const raw = readFileSync(configPath, 'utf-8');
1201
+ const config = JSON.parse(raw);
1202
+ const rulesArray = config?.rules;
1203
+ const errors = validateRulesConfig({ rules: rulesArray ?? [] });
1204
+ return {
1205
+ valid: errors.length === 0,
1206
+ errors: errors.map(e => ({ ruleId: e.ruleId || null, message: e.message })),
1207
+ configPath,
1208
+ };
1209
+ }
1210
+ catch (err) {
1211
+ return {
1212
+ valid: false,
1213
+ errors: [{ message: `Failed to read/parse config: ${err.message}` }],
1214
+ configPath,
1215
+ };
1216
+ }
1217
+ },
1218
+ },
1219
+ ];
1220
+ function registerConfigTool(registry) {
1221
+ registry.register({
1222
+ name: 'config',
1223
+ description: 'Manage analyzer configurations, generate AI tool configs, manage whitelists, and manage invariant rules. Actions: get, set, reset (analyzer configs), generate (AI tool config files), whitelist_list, whitelist_add, whitelist_update, whitelist_detect, rules_list, rules_check.',
1224
+ actions: configActions,
1287
1225
  });
1288
- // ── telemetry ──────────────────────────────────────────────────────────────
1226
+ }
1227
+ // ── telemetry ──────────────────────────────────────────────────────────────
1228
+ function registerTelemetryTool(registry) {
1289
1229
  registry.register({
1290
1230
  name: 'telemetry',
1291
1231
  description: 'Manage anonymous dismissal feedback opt-in (default OFF). Actions: status, enable, disable. When enabled, a dismissal and its reason are sent to the feedback endpoint, grouped by an anonymous install ID generated locally.',
@@ -1338,7 +1278,9 @@ function registerAllTools(registry) {
1338
1278
  },
1339
1279
  ],
1340
1280
  });
1341
- // ── code_map ───────────────────────────────────────────────────────────────
1281
+ }
1282
+ // ── code_map ───────────────────────────────────────────────────────────────
1283
+ function registerCodeMapTool(registry) {
1342
1284
  registry.register({
1343
1285
  name: 'code_map',
1344
1286
  description: 'Retrieve sections of previously generated code maps. Actions: get (retrieve a specific section), list (list all available sections for a map).',
@@ -1366,7 +1308,7 @@ function registerAllTools(registry) {
1366
1308
  if (!mapId || !sectionType)
1367
1309
  return { success: false, error: 'Both mapId and sectionType are required' };
1368
1310
  const db = await getDatabase();
1369
- const section = await db.getCodeMapSection(mapId, sectionType);
1311
+ const section = await db.codeMap.getCodeMapSection(mapId, sectionType);
1370
1312
  if (section) {
1371
1313
  return { success: true, mapId, sectionType, content: section.content, metadata: section.metadata };
1372
1314
  }
@@ -1389,13 +1331,15 @@ function registerAllTools(registry) {
1389
1331
  if (!mapId)
1390
1332
  return { success: false, error: 'mapId is required' };
1391
1333
  const db = await getDatabase();
1392
- const sections = await db.listCodeMapSections(mapId);
1334
+ const sections = await db.codeMap.listCodeMapSections(mapId);
1393
1335
  return { success: true, mapId, sections, totalSections: sections.length };
1394
1336
  },
1395
1337
  },
1396
1338
  ],
1397
1339
  });
1398
- // ── tasks ──────────────────────────────────────────────────────────────────
1340
+ }
1341
+ // ── tasks ──────────────────────────────────────────────────────────────────
1342
+ function registerTasksTool(registry) {
1399
1343
  registry.register({
1400
1344
  name: 'tasks',
1401
1345
  description: 'Manage a persistent per-project task queue. Tasks survive index resets. Actions: create, list, list_tree, get, update, complete, delete, from_audit (create tasks from audit violations with deduplication).',
@@ -1404,7 +1348,7 @@ function registerAllTools(registry) {
1404
1348
  name: 'create',
1405
1349
  description: 'Create a new task.',
1406
1350
  parameters: [
1407
- { name: 'projectPath', type: 'string', required: false, description: 'Project root.' },
1351
+ { name: 'projectPath', type: 'string', required: false, description: PROJECT_ROOT_DESCRIPTION },
1408
1352
  { name: 'title', type: 'string', required: true, description: 'Task title.' },
1409
1353
  { name: 'description', type: 'string', required: false, description: 'Longer description.' },
1410
1354
  { name: 'status', type: 'string', required: false, description: 'Initial status.', enum: ['pending', 'in_progress', 'blocked', 'done', 'cancelled'] },
@@ -1428,7 +1372,7 @@ function registerAllTools(registry) {
1428
1372
  name: 'list',
1429
1373
  description: 'List tasks (flat). Supports filtering by status, priority, labels, source, query text search.',
1430
1374
  parameters: [
1431
- { name: 'projectPath', type: 'string', required: false, description: 'Project root.' },
1375
+ { name: 'projectPath', type: 'string', required: false, description: PROJECT_ROOT_DESCRIPTION },
1432
1376
  { name: 'status', type: 'string', required: false, description: 'Filter by status.', enum: ['pending', 'in_progress', 'blocked', 'done', 'cancelled'] },
1433
1377
  { name: 'priority', type: 'string', required: false, description: 'Filter by priority.', enum: ['low', 'medium', 'high'] },
1434
1378
  { name: 'label', type: 'string', required: false, description: 'Filter by label.' },
@@ -1448,7 +1392,7 @@ function registerAllTools(registry) {
1448
1392
  name: 'list_tree',
1449
1393
  description: 'List tasks as a tree (parent-child hierarchy).',
1450
1394
  parameters: [
1451
- { name: 'projectPath', type: 'string', required: false, description: 'Project root.' },
1395
+ { name: 'projectPath', type: 'string', required: false, description: PROJECT_ROOT_DESCRIPTION },
1452
1396
  { name: 'status', type: 'string', required: false, description: 'Filter by status.', enum: ['pending', 'in_progress', 'blocked', 'done', 'cancelled'] },
1453
1397
  { name: 'limit', type: 'number', required: false, description: 'Max tasks (default 500).' },
1454
1398
  ],
@@ -1461,7 +1405,7 @@ function registerAllTools(registry) {
1461
1405
  name: 'get',
1462
1406
  description: 'Get a single task by ID.',
1463
1407
  parameters: [
1464
- { name: 'projectPath', type: 'string', required: false, description: 'Project root.' },
1408
+ { name: 'projectPath', type: 'string', required: false, description: PROJECT_ROOT_DESCRIPTION },
1465
1409
  { name: 'taskId', type: 'string', required: true, description: 'Task ID.' },
1466
1410
  ],
1467
1411
  handler: async (args, signal) => {
@@ -1473,7 +1417,7 @@ function registerAllTools(registry) {
1473
1417
  name: 'update',
1474
1418
  description: 'Update a task with a patch of partial fields.',
1475
1419
  parameters: [
1476
- { name: 'projectPath', type: 'string', required: false, description: 'Project root.' },
1420
+ { name: 'projectPath', type: 'string', required: false, description: PROJECT_ROOT_DESCRIPTION },
1477
1421
  { name: 'taskId', type: 'string', required: true, description: 'Task ID.' },
1478
1422
  { name: 'patch', type: 'object', required: true, description: 'Partial fields to update.' },
1479
1423
  ],
@@ -1486,7 +1430,7 @@ function registerAllTools(registry) {
1486
1430
  name: 'complete',
1487
1431
  description: 'Mark a task as completed.',
1488
1432
  parameters: [
1489
- { name: 'projectPath', type: 'string', required: false, description: 'Project root.' },
1433
+ { name: 'projectPath', type: 'string', required: false, description: PROJECT_ROOT_DESCRIPTION },
1490
1434
  { name: 'taskId', type: 'string', required: true, description: 'Task ID.' },
1491
1435
  ],
1492
1436
  handler: async (args, signal) => {
@@ -1498,7 +1442,7 @@ function registerAllTools(registry) {
1498
1442
  name: 'delete',
1499
1443
  description: 'Delete a task. Mode: reject (default, refuse if subtasks exist), detach (move subtasks up), cascade (delete subtree).',
1500
1444
  parameters: [
1501
- { name: 'projectPath', type: 'string', required: false, description: 'Project root.' },
1445
+ { name: 'projectPath', type: 'string', required: false, description: PROJECT_ROOT_DESCRIPTION },
1502
1446
  { name: 'taskId', type: 'string', required: true, description: 'Task ID.' },
1503
1447
  { name: 'mode', type: 'string', required: false, description: 'Delete mode.', enum: ['reject', 'detach', 'cascade'] },
1504
1448
  ],
@@ -1511,10 +1455,9 @@ function registerAllTools(registry) {
1511
1455
  name: 'from_audit',
1512
1456
  description: 'Create tasks from audit violations with deduplication. Each violation gets a stable fingerprint; violations matching existing open tasks are skipped.',
1513
1457
  parameters: [
1514
- { name: 'projectPath', type: 'string', required: false, description: 'Project root.' },
1458
+ { name: 'projectPath', type: 'string', required: false, description: PROJECT_ROOT_DESCRIPTION },
1515
1459
  { name: 'auditJobId', type: 'string', required: false, description: 'Audit job ID. Omit to use most recent completed audit.' },
1516
1460
  { name: 'severities', type: 'array', required: false, description: 'Severities to include (default: critical, severe).' },
1517
- { name: 'analyzers', type: 'array', required: false, description: 'Filter violations by analyzer name.' },
1518
1461
  { name: 'paths', type: 'array', required: false, description: 'Filter violations by file path globs.' },
1519
1462
  ],
1520
1463
  handler: async (args, signal) => {
@@ -1524,7 +1467,9 @@ function registerAllTools(registry) {
1524
1467
  },
1525
1468
  ],
1526
1469
  });
1527
- // ── guide ──────────────────────────────────────────────────────────────────
1470
+ }
1471
+ // ── guide ──────────────────────────────────────────────────────────────────
1472
+ function registerGuideTool(registry) {
1528
1473
  registry.register({
1529
1474
  name: 'guide',
1530
1475
  description: 'Get recommended workflows and best practices for using the code auditor tools effectively. Single action: get.',
@@ -1555,7 +1500,7 @@ function registerAllTools(registry) {
1555
1500
  catch (error) {
1556
1501
  return {
1557
1502
  success: false,
1558
- error: error instanceof Error ? error.message : 'Unknown error',
1503
+ error: errorMessage(error),
1559
1504
  availableScenarios: [
1560
1505
  'initial-setup',
1561
1506
  'react-development',
@@ -1571,6 +1516,20 @@ function registerAllTools(registry) {
1571
1516
  ],
1572
1517
  });
1573
1518
  }
1519
+ /**
1520
+ * Register every MCP tool and its actions on the given registry.
1521
+ * @param registry - The tool registry to register tools on.
1522
+ */
1523
+ export function registerAllTools(registry) {
1524
+ registerAuditTool(registry);
1525
+ registerSearchTool(registry);
1526
+ registerIndexTool(registry);
1527
+ registerConfigTool(registry);
1528
+ registerTelemetryTool(registry);
1529
+ registerCodeMapTool(registry);
1530
+ registerTasksTool(registry);
1531
+ registerGuideTool(registry);
1532
+ }
1574
1533
  // ── MCP Server ───────────────────────────────────────────────────────────────
1575
1534
  async function startMcpServer() {
1576
1535
  logMcpInfo('startup', `code-auditor-mcp ${PACKAGE_VERSION} (stdio)`, {
@@ -1727,9 +1686,31 @@ async function main() {
1727
1686
  // --stdio (default): start the MCP server
1728
1687
  await startMcpServer();
1729
1688
  }
1730
- main().catch((error) => {
1731
- console.error(chalk.red('[ERROR]'), 'Failed to start:', error);
1732
- console.error(chalk.red('[ERROR]'), 'Stack:', error.stack);
1733
- process.exitCode = 1;
1734
- });
1689
+ // Start the server only when this file is the entry point (mirrors mcp-ui-simple).
1690
+ // Guarding `main()` lets tests import `registerAllTools` without booting the stdio
1691
+ // server (Spec 66 follow-up R5 — the entry-point conformance test must enumerate
1692
+ // the real `audit.run` / `audit.health` handlers, not a fake).
1693
+ //
1694
+ // Compare realpaths, not string-built URLs: `import.meta.url` is symlink-resolved
1695
+ // by Node, while `process.argv[1]` under a pnpm/npm `.bin` shim is the shim path
1696
+ // (or a symlinked path) that Node does not resolve. The two string forms diverge
1697
+ // on a symlinked install, so the naive `file://${argv[1]}` comparison never matches
1698
+ // and the published `code-auditor-mcp` bin boots to an immediate silent exit.
1699
+ function isMainModule() {
1700
+ if (!process.argv[1])
1701
+ return false;
1702
+ try {
1703
+ return realpathSync(fileURLToPath(import.meta.url)) === realpathSync(process.argv[1]);
1704
+ }
1705
+ catch {
1706
+ return false;
1707
+ }
1708
+ }
1709
+ if (isMainModule()) {
1710
+ main().catch((error) => {
1711
+ console.error(chalk.red('[ERROR]'), 'Failed to start:', error);
1712
+ console.error(chalk.red('[ERROR]'), 'Stack:', error.stack);
1713
+ process.exitCode = 1;
1714
+ });
1715
+ }
1735
1716
  //# sourceMappingURL=mcp.js.map