code-auditor-mcp 2.6.2 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (343) hide show
  1. package/README.md +319 -147
  2. package/dist/analyzers/analyzerUtils.d.ts +13 -11
  3. package/dist/analyzers/analyzerUtils.d.ts.map +1 -1
  4. package/dist/analyzers/analyzerUtils.js +22 -56
  5. package/dist/analyzers/analyzerUtils.js.map +1 -1
  6. package/dist/analyzers/cross-language/APIContractAnalyzer.d.ts.map +1 -1
  7. package/dist/analyzers/cross-language/CrossLanguageSOLIDAnalyzer.d.ts.map +1 -1
  8. package/dist/analyzers/cross-language/CrossLanguageSOLIDAnalyzer.js.map +1 -1
  9. package/dist/analyzers/cross-language/DependencyGraphBuilder.d.ts.map +1 -1
  10. package/dist/analyzers/cross-language/DependencyGraphBuilder.js.map +1 -1
  11. package/dist/analyzers/cross-language/SchemaValidator.d.ts.map +1 -1
  12. package/dist/analyzers/cross-language/SchemaValidator.js.map +1 -1
  13. package/dist/analyzers/dataAccessAnalyzer.d.ts.map +1 -1
  14. package/dist/analyzers/dataAccessAnalyzer.js +50 -24
  15. package/dist/analyzers/dataAccessAnalyzer.js.map +1 -1
  16. package/dist/analyzers/documentationAnalyzer.d.ts +4 -1
  17. package/dist/analyzers/documentationAnalyzer.d.ts.map +1 -1
  18. package/dist/analyzers/documentationAnalyzer.js +210 -111
  19. package/dist/analyzers/documentationAnalyzer.js.map +1 -1
  20. package/dist/analyzers/dryAnalyzer.d.ts.map +1 -1
  21. package/dist/analyzers/dryAnalyzer.js +190 -58
  22. package/dist/analyzers/dryAnalyzer.js.map +1 -1
  23. package/dist/analyzers/invariantsAnalyzer.d.ts +20 -0
  24. package/dist/analyzers/invariantsAnalyzer.d.ts.map +1 -0
  25. package/dist/analyzers/invariantsAnalyzer.js +148 -0
  26. package/dist/analyzers/invariantsAnalyzer.js.map +1 -0
  27. package/dist/analyzers/reactAnalyzer.d.ts.map +1 -1
  28. package/dist/analyzers/reactAnalyzer.js +2 -2
  29. package/dist/analyzers/reactAnalyzer.js.map +1 -1
  30. package/dist/analyzers/schemaAnalyzer.d.ts +2 -0
  31. package/dist/analyzers/schemaAnalyzer.d.ts.map +1 -1
  32. package/dist/analyzers/schemaAnalyzer.js +306 -147
  33. package/dist/analyzers/schemaAnalyzer.js.map +1 -1
  34. package/dist/analyzers/solidAnalyzer.d.ts.map +1 -1
  35. package/dist/analyzers/solidAnalyzer.js +145 -119
  36. package/dist/analyzers/solidAnalyzer.js.map +1 -1
  37. package/dist/analyzers/universal/UniversalDRYAnalyzer.d.ts +3 -1
  38. package/dist/analyzers/universal/UniversalDRYAnalyzer.d.ts.map +1 -1
  39. package/dist/analyzers/universal/UniversalDRYAnalyzer.js +41 -1
  40. package/dist/analyzers/universal/UniversalDRYAnalyzer.js.map +1 -1
  41. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts.map +1 -1
  42. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js +8 -8
  43. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js.map +1 -1
  44. package/dist/analyzers/universal/UniversalDocumentationAnalyzer.d.ts.map +1 -1
  45. package/dist/analyzers/universal/UniversalDocumentationAnalyzer.js +6 -6
  46. package/dist/analyzers/universal/UniversalDocumentationAnalyzer.js.map +1 -1
  47. package/dist/analyzers/universal/UniversalSOLIDAnalyzer.d.ts.map +1 -1
  48. package/dist/analyzers/universal/UniversalSchemaAnalyzer.d.ts.map +1 -1
  49. package/dist/analyzers/universal/UniversalSchemaAnalyzer.js +1 -1
  50. package/dist/analyzers/universal/UniversalSchemaAnalyzer.js.map +1 -1
  51. package/dist/api/index.js +1 -0
  52. package/dist/api/index.js.map +1 -1
  53. package/dist/auditRunner.d.ts.map +1 -1
  54. package/dist/auditRunner.js +367 -24
  55. package/dist/auditRunner.js.map +1 -1
  56. package/dist/cli.d.ts +1 -1
  57. package/dist/cli.d.ts.map +1 -1
  58. package/dist/cli.js +740 -18
  59. package/dist/cli.js.map +1 -1
  60. package/dist/codeIndexDB-enhanced.d.ts +35 -13
  61. package/dist/codeIndexDB-enhanced.d.ts.map +1 -1
  62. package/dist/codeIndexDB-enhanced.js +311 -214
  63. package/dist/codeIndexDB-enhanced.js.map +1 -1
  64. package/dist/{codeIndexDb.d.ts → codeIndexDB.d.ts} +51 -224
  65. package/dist/codeIndexDB.d.ts.map +1 -0
  66. package/dist/codeIndexDB.js +2042 -0
  67. package/dist/codeIndexDB.js.map +1 -0
  68. package/dist/codeIndexService.d.ts.map +1 -1
  69. package/dist/codeIndexService.js.map +1 -1
  70. package/dist/componentScanner.d.ts +14 -8
  71. package/dist/componentScanner.d.ts.map +1 -1
  72. package/dist/componentScanner.js +136 -113
  73. package/dist/componentScanner.js.map +1 -1
  74. package/dist/config/configLoader.d.ts.map +1 -1
  75. package/dist/config/configLoader.js +10 -7
  76. package/dist/config/configLoader.js.map +1 -1
  77. package/dist/config/defaults.d.ts.map +1 -1
  78. package/dist/constants.js.map +1 -1
  79. package/dist/fingerprint.d.ts +15 -0
  80. package/dist/fingerprint.d.ts.map +1 -0
  81. package/dist/fingerprint.js +32 -0
  82. package/dist/fingerprint.js.map +1 -0
  83. package/dist/functionScanner.d.ts +5 -0
  84. package/dist/functionScanner.d.ts.map +1 -1
  85. package/dist/functionScanner.js +417 -341
  86. package/dist/functionScanner.js.map +1 -1
  87. package/dist/generators/AWSQConfigGenerator.d.ts.map +1 -1
  88. package/dist/generators/AiderConfigGenerator.d.ts.map +1 -1
  89. package/dist/generators/BaseConfigGenerator.d.ts.map +1 -1
  90. package/dist/generators/BaseConfigGenerator.js.map +1 -1
  91. package/dist/generators/ClaudeConfigGenerator.d.ts.map +1 -1
  92. package/dist/generators/ClineConfigGenerator.d.ts.map +1 -1
  93. package/dist/generators/CodeiumConfigGenerator.d.ts.map +1 -1
  94. package/dist/generators/ConfigGeneratorFactory.d.ts.map +1 -1
  95. package/dist/generators/ConfigGeneratorFactory.js.map +1 -1
  96. package/dist/generators/ContinueConfigGenerator.d.ts.map +1 -1
  97. package/dist/generators/CopilotConfigGenerator.d.ts.map +1 -1
  98. package/dist/generators/CursorConfigGenerator.d.ts.map +1 -1
  99. package/dist/generators/JetBrainsConfigGenerator.d.ts.map +1 -1
  100. package/dist/generators/VSCodeConfigGenerator.d.ts.map +1 -1
  101. package/dist/grammars/tree-sitter-go.wasm +0 -0
  102. package/dist/grammars/tree-sitter-javascript.wasm +0 -0
  103. package/dist/grammars/tree-sitter-tsx.wasm +0 -0
  104. package/dist/grammars/tree-sitter-typescript.wasm +0 -0
  105. package/dist/index.d.ts +1 -0
  106. package/dist/index.d.ts.map +1 -1
  107. package/dist/index.js +2 -1
  108. package/dist/index.js.map +1 -1
  109. package/dist/invariants/index.d.ts +9 -0
  110. package/dist/invariants/index.d.ts.map +1 -0
  111. package/dist/invariants/index.js +4 -0
  112. package/dist/invariants/index.js.map +1 -0
  113. package/dist/invariants/invariant-rules.schema.json +137 -0
  114. package/dist/invariants/ruleEngine.d.ts +32 -0
  115. package/dist/invariants/ruleEngine.d.ts.map +1 -0
  116. package/dist/invariants/ruleEngine.js +536 -0
  117. package/dist/invariants/ruleEngine.js.map +1 -0
  118. package/dist/invariants/ruleValidator.d.ts +17 -0
  119. package/dist/invariants/ruleValidator.d.ts.map +1 -0
  120. package/dist/invariants/ruleValidator.js +264 -0
  121. package/dist/invariants/ruleValidator.js.map +1 -0
  122. package/dist/invariants/types.d.ts +78 -0
  123. package/dist/invariants/types.d.ts.map +1 -0
  124. package/dist/invariants/types.js +5 -0
  125. package/dist/invariants/types.js.map +1 -0
  126. package/dist/languages/LanguageOrchestrator.d.ts.map +1 -1
  127. package/dist/languages/LanguageOrchestrator.js.map +1 -1
  128. package/dist/languages/LanguageRegistry.d.ts.map +1 -1
  129. package/dist/languages/RuntimeManager.d.ts.map +1 -1
  130. package/dist/languages/RuntimeManager.js +1 -1
  131. package/dist/languages/RuntimeManager.js.map +1 -1
  132. package/dist/languages/UniversalAnalyzer.d.ts.map +1 -1
  133. package/dist/languages/UniversalAnalyzer.js.map +1 -1
  134. package/dist/languages/adapterBridge.d.ts +102 -0
  135. package/dist/languages/adapterBridge.d.ts.map +1 -0
  136. package/dist/languages/adapterBridge.js +382 -0
  137. package/dist/languages/adapterBridge.js.map +1 -0
  138. package/dist/languages/go/GoAdapter.d.ts +37 -26
  139. package/dist/languages/go/GoAdapter.d.ts.map +1 -1
  140. package/dist/languages/go/GoAdapter.js +560 -281
  141. package/dist/languages/go/GoAdapter.js.map +1 -1
  142. package/dist/languages/index.d.ts +5 -2
  143. package/dist/languages/index.d.ts.map +1 -1
  144. package/dist/languages/index.js +11 -9
  145. package/dist/languages/index.js.map +1 -1
  146. package/dist/languages/tree-sitter/converter.d.ts +43 -0
  147. package/dist/languages/tree-sitter/converter.d.ts.map +1 -0
  148. package/dist/languages/tree-sitter/converter.js +150 -0
  149. package/dist/languages/tree-sitter/converter.js.map +1 -0
  150. package/dist/languages/tree-sitter/parser.d.ts +36 -0
  151. package/dist/languages/tree-sitter/parser.d.ts.map +1 -0
  152. package/dist/languages/tree-sitter/parser.js +114 -0
  153. package/dist/languages/tree-sitter/parser.js.map +1 -0
  154. package/dist/languages/types.d.ts +11 -0
  155. package/dist/languages/types.d.ts.map +1 -1
  156. package/dist/languages/typescript/TreeSitterTypeScriptAdapter.d.ts +92 -0
  157. package/dist/languages/typescript/TreeSitterTypeScriptAdapter.d.ts.map +1 -0
  158. package/dist/languages/typescript/TreeSitterTypeScriptAdapter.js +951 -0
  159. package/dist/languages/typescript/TreeSitterTypeScriptAdapter.js.map +1 -0
  160. package/dist/mcp-tools/projectTasks.d.ts +58 -22
  161. package/dist/mcp-tools/projectTasks.d.ts.map +1 -1
  162. package/dist/mcp-tools/projectTasks.js +172 -10
  163. package/dist/mcp-tools/projectTasks.js.map +1 -1
  164. package/dist/mcp-tools/whitelistTools.d.ts +21 -21
  165. package/dist/mcp-tools/whitelistTools.d.ts.map +1 -1
  166. package/dist/mcp-tools/workflowGuide.d.ts.map +1 -1
  167. package/dist/mcp-tools/workflowGuide.js +130 -126
  168. package/dist/mcp-tools/workflowGuide.js.map +1 -1
  169. package/dist/mcp-tools-shared.d.ts.map +1 -1
  170. package/dist/mcp-tools-shared.js.map +1 -1
  171. package/dist/mcp-ui-simple.js +1 -1
  172. package/dist/mcp-ui-simple.js.map +1 -1
  173. package/dist/mcp.d.ts +1 -1
  174. package/dist/mcp.d.ts.map +1 -1
  175. package/dist/mcp.js +1376 -1181
  176. package/dist/mcp.js.map +1 -1
  177. package/dist/mcpAuditJobs.d.ts +4 -0
  178. package/dist/mcpAuditJobs.d.ts.map +1 -1
  179. package/dist/mcpAuditJobs.js +49 -2
  180. package/dist/mcpAuditJobs.js.map +1 -1
  181. package/dist/mcpToolErrors.d.ts.map +1 -1
  182. package/dist/mcpToolErrors.js.map +1 -1
  183. package/dist/native/ast-grep-napi.darwin-arm64.node +0 -0
  184. package/dist/native/ast-grep-napi.darwin-x64.node +0 -0
  185. package/dist/native/ast-grep-napi.linux-arm64-gnu.node +0 -0
  186. package/dist/native/ast-grep-napi.linux-arm64-musl.node +0 -0
  187. package/dist/native/ast-grep-napi.linux-x64-gnu.node +0 -0
  188. package/dist/native/ast-grep-napi.linux-x64-musl.node +0 -0
  189. package/dist/native/ast-grep-napi.win32-x64-msvc.node +0 -0
  190. package/dist/native-bootstrap.d.ts +15 -0
  191. package/dist/native-bootstrap.d.ts.map +1 -0
  192. package/dist/native-bootstrap.js +75 -0
  193. package/dist/native-bootstrap.js.map +1 -0
  194. package/dist/reporting/csvReportGenerator.d.ts.map +1 -1
  195. package/dist/reporting/htmlReportGenerator.d.ts.map +1 -1
  196. package/dist/reporting/jsonReportGenerator.d.ts.map +1 -1
  197. package/dist/reporting/reportGenerator.d.ts.map +1 -1
  198. package/dist/reporting/reportGenerator.js +4 -0
  199. package/dist/reporting/reportGenerator.js.map +1 -1
  200. package/dist/reporting/sarifReportGenerator.d.ts +39 -0
  201. package/dist/reporting/sarifReportGenerator.d.ts.map +1 -0
  202. package/dist/reporting/sarifReportGenerator.js +229 -0
  203. package/dist/reporting/sarifReportGenerator.js.map +1 -0
  204. package/dist/search/QueryParser.d.ts +41 -0
  205. package/dist/search/QueryParser.d.ts.map +1 -1
  206. package/dist/search/QueryParser.js +200 -19
  207. package/dist/search/QueryParser.js.map +1 -1
  208. package/dist/services/CodeMapGenerator.d.ts.map +1 -1
  209. package/dist/services/CodeMapGenerator.js +4 -4
  210. package/dist/services/CodeMapGenerator.js.map +1 -1
  211. package/dist/services/ProjectTaskRepository.d.ts +15 -2
  212. package/dist/services/ProjectTaskRepository.d.ts.map +1 -1
  213. package/dist/services/ProjectTaskRepository.js +16 -1
  214. package/dist/services/ProjectTaskRepository.js.map +1 -1
  215. package/dist/services/SchemaParser.d.ts.map +1 -1
  216. package/dist/services/SchemaParser.js +5 -8
  217. package/dist/services/SchemaParser.js.map +1 -1
  218. package/dist/services/auditJobService.d.ts +1 -1
  219. package/dist/services/projectTaskHelpers.js.map +1 -1
  220. package/dist/services/whitelistService.d.ts.map +1 -1
  221. package/dist/services/whitelistService.js +1 -1
  222. package/dist/services/whitelistService.js.map +1 -1
  223. package/dist/tool-registry.d.ts +79 -0
  224. package/dist/tool-registry.d.ts.map +1 -0
  225. package/dist/tool-registry.js +139 -0
  226. package/dist/tool-registry.js.map +1 -0
  227. package/dist/types/projectTask.d.ts +4 -0
  228. package/dist/types/projectTask.d.ts.map +1 -1
  229. package/dist/types.d.ts +26 -2
  230. package/dist/types.d.ts.map +1 -1
  231. package/dist/types.js.map +1 -1
  232. package/dist/ui/InteractivePrompts.d.ts.map +1 -1
  233. package/dist/ui/InteractivePrompts.js.map +1 -1
  234. package/dist/utils/astParser.d.ts +31 -38
  235. package/dist/utils/astParser.d.ts.map +1 -1
  236. package/dist/utils/astParser.js +138 -196
  237. package/dist/utils/astParser.js.map +1 -1
  238. package/dist/utils/astUtils.d.ts +87 -58
  239. package/dist/utils/astUtils.d.ts.map +1 -1
  240. package/dist/utils/astUtils.js +852 -581
  241. package/dist/utils/astUtils.js.map +1 -1
  242. package/dist/utils/componentPatterns.js.map +1 -1
  243. package/dist/utils/componentResponsibility.d.ts +13 -9
  244. package/dist/utils/componentResponsibility.d.ts.map +1 -1
  245. package/dist/utils/componentResponsibility.js +236 -206
  246. package/dist/utils/componentResponsibility.js.map +1 -1
  247. package/dist/utils/dependencyExtractor.d.ts +11 -6
  248. package/dist/utils/dependencyExtractor.d.ts.map +1 -1
  249. package/dist/utils/dependencyExtractor.js +200 -119
  250. package/dist/utils/dependencyExtractor.js.map +1 -1
  251. package/dist/utils/fileDiscovery.d.ts +1 -1
  252. package/dist/utils/fileDiscovery.d.ts.map +1 -1
  253. package/dist/utils/fileDiscovery.js.map +1 -1
  254. package/dist/utils/jsDocParser.d.ts +27 -30
  255. package/dist/utils/jsDocParser.d.ts.map +1 -1
  256. package/dist/utils/jsDocParser.js +271 -207
  257. package/dist/utils/jsDocParser.js.map +1 -1
  258. package/dist/utils/reactDetection.d.ts +27 -12
  259. package/dist/utils/reactDetection.d.ts.map +1 -1
  260. package/dist/utils/reactDetection.js +331 -219
  261. package/dist/utils/reactDetection.js.map +1 -1
  262. package/dist/workers/auditWorker.js +17 -3
  263. package/dist/workers/auditWorker.js.map +1 -1
  264. package/package.json +54 -51
  265. package/dist/adapters/GoAdapter.d.ts +0 -53
  266. package/dist/adapters/GoAdapter.d.ts.map +0 -1
  267. package/dist/adapters/GoAdapter.js +0 -611
  268. package/dist/adapters/GoAdapter.js.map +0 -1
  269. package/dist/adapters/GoConfig.d.ts +0 -35
  270. package/dist/adapters/GoConfig.d.ts.map +0 -1
  271. package/dist/adapters/GoConfig.js +0 -155
  272. package/dist/adapters/GoConfig.js.map +0 -1
  273. package/dist/adapters/LanguageAdapter.d.ts +0 -135
  274. package/dist/adapters/LanguageAdapter.d.ts.map +0 -1
  275. package/dist/adapters/LanguageAdapter.js +0 -47
  276. package/dist/adapters/LanguageAdapter.js.map +0 -1
  277. package/dist/adapters/TypeScriptAdapter.d.ts +0 -43
  278. package/dist/adapters/TypeScriptAdapter.d.ts.map +0 -1
  279. package/dist/adapters/TypeScriptAdapter.js +0 -386
  280. package/dist/adapters/TypeScriptAdapter.js.map +0 -1
  281. package/dist/adapters/UniversalAnalyzer.d.ts +0 -42
  282. package/dist/adapters/UniversalAnalyzer.d.ts.map +0 -1
  283. package/dist/adapters/UniversalAnalyzer.js +0 -103
  284. package/dist/adapters/UniversalAnalyzer.js.map +0 -1
  285. package/dist/adapters/UniversalSOLIDAnalyzer.d.ts +0 -48
  286. package/dist/adapters/UniversalSOLIDAnalyzer.d.ts.map +0 -1
  287. package/dist/adapters/UniversalSOLIDAnalyzer.js +0 -178
  288. package/dist/adapters/UniversalSOLIDAnalyzer.js.map +0 -1
  289. package/dist/adapters/solidAnalyzerCompat.d.ts +0 -21
  290. package/dist/adapters/solidAnalyzerCompat.d.ts.map +0 -1
  291. package/dist/adapters/solidAnalyzerCompat.js +0 -78
  292. package/dist/adapters/solidAnalyzerCompat.js.map +0 -1
  293. package/dist/analyzers/dataAccessAnalyzerCompat.d.ts +0 -20
  294. package/dist/analyzers/dataAccessAnalyzerCompat.d.ts.map +0 -1
  295. package/dist/analyzers/dataAccessAnalyzerCompat.js +0 -59
  296. package/dist/analyzers/dataAccessAnalyzerCompat.js.map +0 -1
  297. package/dist/analyzers/documentationAnalyzerCompat.d.ts +0 -20
  298. package/dist/analyzers/documentationAnalyzerCompat.d.ts.map +0 -1
  299. package/dist/analyzers/documentationAnalyzerCompat.js +0 -52
  300. package/dist/analyzers/documentationAnalyzerCompat.js.map +0 -1
  301. package/dist/analyzers/dryAnalyzerCompat.d.ts +0 -20
  302. package/dist/analyzers/dryAnalyzerCompat.d.ts.map +0 -1
  303. package/dist/analyzers/dryAnalyzerCompat.js +0 -44
  304. package/dist/analyzers/dryAnalyzerCompat.js.map +0 -1
  305. package/dist/analyzers/schemaAnalyzerCompat.d.ts +0 -20
  306. package/dist/analyzers/schemaAnalyzerCompat.d.ts.map +0 -1
  307. package/dist/analyzers/schemaAnalyzerCompat.js +0 -69
  308. package/dist/analyzers/schemaAnalyzerCompat.js.map +0 -1
  309. package/dist/analyzers/solidAnalyzerCompat.d.ts +0 -20
  310. package/dist/analyzers/solidAnalyzerCompat.d.ts.map +0 -1
  311. package/dist/analyzers/solidAnalyzerCompat.js +0 -78
  312. package/dist/analyzers/solidAnalyzerCompat.js.map +0 -1
  313. package/dist/codeIndexDb.d.ts.map +0 -1
  314. package/dist/codeIndexDb.js +0 -2102
  315. package/dist/codeIndexDb.js.map +0 -1
  316. package/dist/languages/typescript/TypeScriptAdapter.d.ts +0 -108
  317. package/dist/languages/typescript/TypeScriptAdapter.d.ts.map +0 -1
  318. package/dist/languages/typescript/TypeScriptAdapter.js +0 -567
  319. package/dist/languages/typescript/TypeScriptAdapter.js.map +0 -1
  320. package/dist/languages/typescript/test-extraction.d.ts +0 -2
  321. package/dist/languages/typescript/test-extraction.d.ts.map +0 -1
  322. package/dist/languages/typescript/test-extraction.js +0 -36
  323. package/dist/languages/typescript/test-extraction.js.map +0 -1
  324. package/dist/mcp-hybrid.d.ts +0 -10
  325. package/dist/mcp-hybrid.d.ts.map +0 -1
  326. package/dist/mcp-hybrid.js +0 -41
  327. package/dist/mcp-hybrid.js.map +0 -1
  328. package/dist/mcp-index.d.ts +0 -13
  329. package/dist/mcp-index.d.ts.map +0 -1
  330. package/dist/mcp-index.js +0 -136
  331. package/dist/mcp-index.js.map +0 -1
  332. package/dist/mcp-standalone.d.ts +0 -3
  333. package/dist/mcp-standalone.d.ts.map +0 -1
  334. package/dist/mcp-standalone.js +0 -1324
  335. package/dist/mcp-standalone.js.map +0 -1
  336. package/dist/mcp-ui-server.d.ts +0 -27
  337. package/dist/mcp-ui-server.d.ts.map +0 -1
  338. package/dist/mcp-ui-server.js +0 -484
  339. package/dist/mcp-ui-server.js.map +0 -1
  340. package/dist/test-multi-strategy-search.d.ts +0 -3
  341. package/dist/test-multi-strategy-search.d.ts.map +0 -1
  342. package/dist/test-multi-strategy-search.js +0 -170
  343. package/dist/test-multi-strategy-search.js.map +0 -1
package/README.md CHANGED
@@ -1,216 +1,388 @@
1
- # Code Auditor: AI-Powered Multi-Language Code Intelligence
1
+ # Code Auditor
2
2
 
3
- **Your AI understands your code across languages.** Code Auditor indexes your entire codebase (TypeScript, JavaScript, and Go) and provides real-time analysis that AI assistants like Claude can actually use to help you write better code.
3
+ Code Auditor enforces architectural invariants and code quality rules inside your AI agent's edit loop. When an agent writes code that violates your project's rules — importing a banned library, breaking a module boundary, calling a restricted function — Code Auditor blocks the edit and tells the agent why. It also runs traditional static analysis (SOLID, DRY, security, documentation) and builds a searchable index of every function and component in your codebase. MCP server, CLI, and Claude Code plugin. TypeScript, JavaScript, Go.
4
4
 
5
- ## The Problem It Solves
5
+ ## The loop, shown not told
6
6
 
7
- AI coding assistants are powerful, but they're flying blind. They can't search your codebase, don't know your patterns, and miss critical context. Code Auditor changes that by creating a searchable index of every function, component, and pattern in your code.
7
+ Given this `.codeauditor.json` in the project root:
8
8
 
9
- ## How It Works
10
-
11
- 1. **Index** - Automatically catalogs functions, React components, Go structs, and dependencies
12
- 2. **Analyze** - Detects SOLID violations, code duplication, and security issues across multiple languages
13
- 3. **Connect** - AI assistants access your code index via MCP (Model Context Protocol)
14
- 4. **Iterate** - Get intelligent suggestions based on your actual codebase patterns
9
+ ```json
10
+ {
11
+ "rules": [
12
+ {
13
+ "id": "no-lokijs",
14
+ "kind": "import-ban",
15
+ "severity": "critical",
16
+ "module": "lokijs",
17
+ "message": "lokijs was replaced by better-sqlite3 in v3.1.0. Use the SQLite-backed CodeIndexDB instead."
18
+ }
19
+ ]
20
+ }
21
+ ```
15
22
 
16
- ## Quick Start (2 minutes)
23
+ An agent writes `import loki from 'lokijs'` in `src/broken.ts`. The Claude Code plugin hook fires on the edit and runs:
17
24
 
18
25
  ```bash
19
- # Add to your project with Claude Code CLI
20
- claude mcp add code-auditor -- npx code-auditor-mcp
21
-
22
- # That's it! Now ask Claude:
23
- # "What authentication functions exist in my codebase?"
24
- # "Find all API endpoints and check for rate limiting"
25
- # "Show me Go structs that handle user data"
26
- # "Compare TypeScript and Go implementations of the same feature"
26
+ code-audit changed --json --fail-on critical
27
27
  ```
28
28
 
29
- ## Core Features That Matter
29
+ The output:
30
30
 
31
- ### 🔍 Multi-Language Code Search
31
+ ```json
32
+ [
33
+ {
34
+ "analyzer": "documentation",
35
+ "rule": "file-documentation",
36
+ "severity": "warning",
37
+ "message": "File lacks proper documentation header",
38
+ "file": "src/broken.ts",
39
+ "line": 1,
40
+ "column": 1,
41
+ "enclosingSymbol": "",
42
+ "suggestion": "",
43
+ "details": ""
44
+ },
45
+ {
46
+ "analyzer": "invariants",
47
+ "rule": "no-lokijs",
48
+ "severity": "critical",
49
+ "message": "lokijs was replaced by better-sqlite3 in v3.1.0. Use the SQLite-backed CodeIndexDB instead.",
50
+ "file": "src/broken.ts",
51
+ "line": 4,
52
+ "column": 1,
53
+ "enclosingSymbol": "",
54
+ "suggestion": "",
55
+ "details": "import-ban"
56
+ },
57
+ {
58
+ "analyzer": "schema",
59
+ "rule": "unknown-table",
60
+ "severity": "warning",
61
+ "message": "Reference to unknown table 'lokijs'",
62
+ "file": "src/broken.ts",
63
+ "line": 4,
64
+ "column": 13,
65
+ "enclosingSymbol": "",
66
+ "suggestion": "",
67
+ "details": "Reference to unknown table 'lokijs'"
68
+ }
69
+ ]
32
70
  ```
33
- "Find all functions that validate user input"
34
- "Show me where we're calling the payment API"
35
- "What Go structs implement the User interface?"
36
- "Compare error handling patterns between TypeScript and Go"
71
+
72
+ Exit code 2 (because a `critical` severity violation exists). The agent sees the violations, removes the import, and the next run is clean:
73
+
74
+ ```bash
75
+ code-audit changed --quiet && echo "clean"
76
+ # → clean
37
77
  ```
38
78
 
39
- ### 🎯 Smart Code Analysis
40
- - **SOLID Principles** - Catch architecture issues before they spread
41
- - **DRY Violations** - Find duplicate code that should be refactored
42
- - **Security Patterns** - Verify auth, rate limiting, SQL injection protection
43
- - **Dead Code** - Identify unused imports and functions
79
+ The agent never sees a generic "something is wrong" — it sees your rule's exact message, with the file and line, and can fix it immediately.
44
80
 
45
- ### 🤖 AI Tool Integration
46
- Auto-generates configurations for:
47
- - Claude (via MCP)
48
- - Cursor
49
- - Continue
50
- - GitHub Copilot
51
- - 10+ other AI assistants
81
+ ## Quick start
52
82
 
53
- ### ⚙️ Persistent Configuration
54
- Set your analyzer preferences once:
55
- ```
56
- You: "Set SOLID analyzer to allow 3 responsibilities for components"
57
- Claude: Configuration saved! All future audits will use this setting.
83
+ ### Claude Code plugin (two commands)
84
+
85
+ ```bash
86
+ claude plugin marketplace add BenAHammond/code-auditor-mcp
87
+ claude plugin install code-auditor
58
88
  ```
59
89
 
60
- ### 📋 Project task queue (MCP)
61
- Use the **`project_tasks`** tool to keep a per-project task list in the local database (titles, status, priorities, due dates, blockers, related files/symbols, and more). **Tasks survive `sync_index` reset**: clearing the analysis index removes indexed functions, cached audits, code maps, and schema overlays so you do not keep “ghost” references to deleted code—it does **not** delete your task list or analyzer configs.
90
+ The plugin registers a hook that runs `code-audit changed` after every edit. Violations at `critical` severity block the edit and give the agent your rule's message.
62
91
 
63
- ## Real Examples
92
+ ### Generic MCP
64
93
 
65
- ### Example 1: Finding Authentication Patterns
66
- ```
67
- You: "Show me all authentication-related functions"
68
- Claude: Found 23 functions across 8 files:
69
- - `validateToken()` in auth/tokens.ts:45
70
- - `requireAuth()` in middleware/auth.ts:12
71
- - `checkPermissions()` in auth/permissions.ts:78
72
- ...
73
- ```
94
+ ```bash
95
+ # Claude Code
96
+ claude mcp add code-auditor -- npx code-auditor-mcp
74
97
 
75
- ### Example 2: Analyzing Code Quality
76
- ```
77
- You: "Audit the user service for issues"
78
- Claude: Found 3 critical issues:
79
- - Single Responsibility violation: UserService handles both auth and profile updates
80
- - SQL injection risk: Raw query in getUserByEmail() at line 234
81
- - Missing rate limiting on password reset endpoint
98
+ # Cursor (.cursor/mcp.json)
99
+ {
100
+ "mcpServers": {
101
+ "code-auditor": {
102
+ "command": "npx",
103
+ "args": ["code-auditor-mcp", "--stdio"]
104
+ }
105
+ }
106
+ }
82
107
  ```
83
108
 
84
- ### Example 3: Discovering Patterns
109
+ MCP tools available: `audit`, `search`, `index`, `config`, `code_map`, `tasks`, `guide`.
110
+
111
+ > **Note: `--ignore-scripts` installs are unsupported.** Code Auditor depends on two native packages — `better-sqlite3` and `@ast-grep/napi` — that ship platform binaries via install scripts. Running `npm install` with `--ignore-scripts` prevents those binaries from downloading and the tool won't start. Stock npm doesn't use this flag by default; it is only active in security-hardened or CI environments that configure it intentionally. If your environment requires `--ignore-scripts`, run `npm install` without the flag first, or use `npm approve-scripts` (npm 11+) to allow the specific packages.
112
+
113
+ ### CLI
114
+
115
+ ```bash
116
+ npx code-audit # full audit, HTML report
117
+ npx code-audit -f json # JSON for CI/CD
118
+ npx code-audit -f sarif # SARIF for GitHub Code Scanning
119
+ npx code-audit changed --json # diff-scoped audit
120
+ npx code-audit map -p . # codebase map to stdout
121
+ npx code-audit search "calls:validate" # search the index
85
122
  ```
86
- You: "Find React components similar to DataTable"
87
- Claude: Found 4 similar components:
88
- - `UserTable` - extends DataTable with user-specific columns
89
- - `OrderGrid` - implements similar pagination pattern
90
- - `ProductList` - uses same filtering approach
123
+
124
+ ## Invariant rules
125
+
126
+ Code Auditor enforces five kinds of project-specific rules on every audit run, including diff-scoped agent-loop runs. Rules live in `.codeauditor.json` in the project root.
127
+
128
+ ### import-ban
129
+
130
+ Prevent any file from importing a banned module.
131
+
132
+ ```json
133
+ {
134
+ "id": "no-lokijs",
135
+ "kind": "import-ban",
136
+ "severity": "critical",
137
+ "module": "lokijs",
138
+ "message": "lokijs was replaced by better-sqlite3 in v3.1.0."
139
+ }
91
140
  ```
92
141
 
93
- ## Installation Options
142
+ Optional `except` field exempts specific files from the ban.
94
143
 
95
- ### Published package (npm / pnpm / yarn)
96
- ```bash
97
- npm install -g code-auditor-mcp
98
- # or: pnpm add -g code-auditor-mcp
99
- code-audit # Run analysis
144
+ ### call-constraint
145
+
146
+ Restrict which files may call a function — useful for API boundaries and security-sensitive entry points.
147
+
148
+ ```json
149
+ {
150
+ "id": "payment-calls-auth",
151
+ "kind": "call-constraint",
152
+ "severity": "critical",
153
+ "callee": "src/services/paymentService.ts#chargeCustomer",
154
+ "allowFrom": ["src/api/**"],
155
+ "message": "chargeCustomer() may only be called from API route handlers."
156
+ }
100
157
  ```
101
158
 
102
- ### Project install
103
- ```bash
104
- npm install --save-dev code-auditor-mcp
105
- npx code-audit
159
+ ### module-boundary
160
+
161
+ Prevent files matching one glob from importing from files matching another.
162
+
163
+ ```json
164
+ {
165
+ "id": "languages-no-analyzers",
166
+ "kind": "module-boundary",
167
+ "severity": "critical",
168
+ "from": "src/languages/**",
169
+ "to": "src/analyzers/**",
170
+ "message": "The languages/ module must not depend on analyzers."
171
+ }
106
172
  ```
107
173
 
108
- ### Developing from this repository
109
- Requires **Node.js 18+**. From the `app/` directory:
174
+ ### naming
110
175
 
111
- ```bash
112
- pnpm install
113
- pnpm run build
114
- pnpm test
176
+ Enforce naming conventions for exported symbols in specific directories.
177
+
178
+ ```json
179
+ {
180
+ "id": "hook-prefix",
181
+ "kind": "naming",
182
+ "severity": "warning",
183
+ "path": "src/hooks/**",
184
+ "exports": "^use[A-Z]",
185
+ "message": "Hooks in src/hooks/ must be prefixed with 'use'."
186
+ }
115
187
  ```
116
188
 
117
- The package manager in use is **pnpm** (see `packageManager` in `package.json`). Use `pnpm run test:parity` only if you need the legacy vs universal analyzer parity suite.
189
+ ### ast-pattern
118
190
 
119
- ### CI/CD Integration
120
- ```yaml
121
- # GitHub Actions
122
- - name: Code Audit
123
- run: npx code-audit --fail-on-critical
191
+ Match AST node patterns in source using ast-grep. This example bans `new Function(...)` — eval-by-another-name that bypasses static analysis.
192
+
193
+ ```json
194
+ {
195
+ "id": "no-new-function",
196
+ "kind": "ast-pattern",
197
+ "severity": "critical",
198
+ "pattern": "new Function($$$)",
199
+ "message": "new Function() is eval-by-another-name — forbidden in this codebase"
200
+ }
124
201
  ```
125
202
 
126
- ### MCP server: where the index is stored
203
+ Optional `language` field restricts to `"typescript"`, `"javascript"`, or `"go"`. Optional `path` field restricts to files matching a glob.
204
+
205
+ Rules are validated on startup — bad globs, duplicate IDs, missing fields, or mutually-exclusive options fail the audit rather than being silently skipped. Use `config rules_list` and `config rules_check` from the MCP server to introspect the rules your agent is operating under.
127
206
 
128
- The Loki index file defaults to **`<current working directory>/.code-index/index.db`**. If your MCP host runs with an unexpected or shared `cwd`, point at a dedicated folder:
207
+ ## Analyzers
129
208
 
130
- - **Environment variable** `CODE_AUDITOR_DATA_DIR` directory to use as the storage root (absolute or relative to the process cwd when the server starts). The database file is **`<resolved>/index.db`** (no extra `.code-index` segment).
131
- - **CLI** — `node dist/mcp-index.js --data-dir /path/to/data` (equivalent to setting the env var). The published binary `code-auditor-mcp` also accepts `--data-dir` because it loads the same bootstrap.
209
+ Six built-in code quality analyzers run alongside invariant rules:
132
210
 
133
- Example **Cursor** `.cursor/mcp.json` fragment:
211
+ | Analyzer | What it detects |
212
+ |----------|----------------|
213
+ | **SOLID** | God classes, long methods, too many parameters, dependency inversion violations |
214
+ | **DRY** | Near-duplicate blocks across files using normalized token comparison |
215
+ | **React** | Missing key props, unused state, useEffect dependency issues, component size |
216
+ | **Documentation** | Missing or insufficient JSDoc on exported functions, classes, and parameters |
217
+ | **Data Access** | Raw SQL queries missing parameterization, N+1 query patterns |
218
+ | **Schema** | Zod/JSON Schema validation gaps on API boundaries |
219
+
220
+ Each analyzer's thresholds are configurable via `config.set` in the MCP server or via `.codeauditor.json`:
134
221
 
135
222
  ```json
136
223
  {
137
- "mcpServers": {
138
- "code-auditor": {
139
- "command": "node",
140
- "args": ["/absolute/path/to/code-auditor/app/dist/mcp-index.js", "--stdio"],
141
- "env": {
142
- "CODE_AUDITOR_DATA_DIR": "/Users/you/Library/Application Support/code-auditor"
143
- }
144
- }
224
+ "analyzerConfigs": {
225
+ "dry": { "similarityThreshold": 0.8, "minLineThreshold": 5 },
226
+ "solid": { "maxMethodsPerClass": 12, "maxParametersPerMethod": 4 }
145
227
  }
146
228
  }
147
229
  ```
148
230
 
149
- ## Key Commands
231
+ ## Diff-scoped auditing and hooks
232
+
233
+ `code-audit changed` audits only the functions whose content has changed since the last index sync. It is fast enough to sit inside an agent's edit loop.
234
+
235
+ ### Scope options
236
+
237
+ | Scope | Description |
238
+ |-------|-------------|
239
+ | `changed` (default) | Files modified since last index sync |
240
+ | `git:<ref>` | Files changed vs. a git ref (`git:origin/main`) |
241
+ | `[paths...]` | Specific files or directories |
242
+ | `--stdin` | Read file paths from stdin (one per line) |
243
+
244
+ ### Hook contract
150
245
 
151
246
  ```bash
152
- code-audit # Full analysis with HTML report
153
- code-audit -f json # JSON output for CI/CD
154
- code-audit -a solid,dry # Run specific analyzers
155
- code-audit --health # Quick health score (0-100)
247
+ # Audit changed files, output JSON, exit 2 on critical violations
248
+ code-audit changed --json --fail-on critical
249
+
250
+ # Audit specific files from stdin
251
+ git diff --name-only HEAD | code-audit changed --stdin --json
252
+
253
+ # Quiet mode: no output when clean
254
+ code-audit changed --quiet && echo "clean"
156
255
  ```
157
256
 
158
- ## The Feedback Loop
257
+ | Flag | Description |
258
+ |------|-------------|
259
+ | `--json` | Machine-readable violation array to stdout |
260
+ | `--quiet` | Suppress output when zero violations |
261
+ | `--fail-on <severity>` | Nonzero exit (code 2) when violations at or above severity exist. Default: `critical` |
262
+ | `--stdin` | Read file paths from stdin, one per line |
159
263
 
160
- 1. **Write Code** Code Auditor indexes it automatically
161
- 2. **Ask AI** → "Is there a function to validate emails?"
162
- 3. **Get Context** → AI finds `validateEmail()` and similar patterns
163
- 4. **Improve** → AI suggests using existing validation instead of duplicating
164
- 5. **Repeat** → Your AI gets smarter about YOUR codebase
264
+ ### Claude Code hook recipe
165
265
 
166
- ## Configuration
266
+ In `.claude/settings.json`:
167
267
 
168
- Set custom thresholds for your architecture:
169
- ```javascript
170
- // Via MCP
171
- mcp.set_analyzer_config({
172
- analyzerName: "solid",
173
- config: {
174
- maxUnrelatedResponsibilities: 4,
175
- patternThresholds: {
176
- "Dashboard": { maxResponsibilities: 6 }
177
- }
268
+ ```json
269
+ {
270
+ "hooks": {
271
+ "PostToolUse": [
272
+ {
273
+ "matcher": "Write|Edit",
274
+ "command": "cat - | code-audit changed --stdin --json --fail-on critical"
275
+ }
276
+ ]
178
277
  }
179
- });
278
+ }
180
279
  ```
181
280
 
182
- ## Advanced Search Operators
281
+ ## Code intelligence
282
+
283
+ A searchable index of every function, component, struct, and dependency is maintained as supporting infrastructure for AI assistants. It is built during audits and synced on file changes.
284
+
285
+ ### Search operators
183
286
 
184
- | What You Want | Search Query |
185
- |--------------|--------------|
287
+ | What you want | Query |
288
+ |--------------|-------|
186
289
  | Complex functions | `complexity:>10` |
187
290
  | Go functions only | `lang:go` |
188
- | TypeScript components | `lang:typescript component:functional` |
189
- | Undocumented exports | `exported:true jsdoc:false` |
190
- | React hooks usage | `component:functional hook:useState` |
191
- | Go struct methods | `lang:go entity:struct` |
192
- | Find dependencies | `calls:validateUser` |
193
- | Cross-language patterns | `name:validateEmail` |
291
+ | React components | `component:functional` |
292
+ | Functions calling a specific function | `calls:validateUser` |
293
+ | Exported but undocumented | `exported:true jsdoc:false` |
294
+ | Find by name | `name:validateEmail` |
194
295
  | Unused imports | `unused-imports file:src` |
296
+ | Go structs | `lang:go entity:struct` |
297
+ | Functions with a specific dependency | `dep:lodash` |
195
298
 
196
- ## Performance
299
+ ### Code maps
197
300
 
198
- - Indexes 10,000+ functions in seconds
199
- - Incremental updates on file changes
200
- - LokiJS for fast in-memory search
201
- - FlexSearch for intelligent queries
301
+ `code-audit map` generates a human-readable file tree with function annotations, complexity scores, and dependency arrows. In the MCP server, `code_map.get` returns this as structured data.
202
302
 
203
- ## Contributing
303
+ ### Task queue
204
304
 
205
- See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
305
+ The `tasks` MCP tool maintains a per-project task list in the local database (titles, status, priorities, due dates, blockers, related files/symbols). `tasks from_audit` populates the task queue from audit violations — each critical issue becomes a task with file locations and fix suggestions. Tasks survive `index reset`: clearing the analysis index does not delete your task list.
206
306
 
207
- ## License
307
+ ## CI and SARIF
308
+
309
+ Upload audit results to GitHub Code Scanning so violations appear as PR annotations:
310
+
311
+ ```yaml
312
+ # .github/workflows/code-audit.yml
313
+ name: Code Audit
314
+
315
+ on:
316
+ push:
317
+ branches: [main]
318
+ pull_request:
319
+ branches: [main]
320
+
321
+ jobs:
322
+ audit:
323
+ runs-on: ubuntu-latest
324
+ steps:
325
+ - uses: actions/checkout@v4
326
+
327
+ - uses: actions/setup-node@v4
328
+ with:
329
+ node-version: '20'
330
+
331
+ - name: Run code audit
332
+ run: npx code-auditor-mcp -f sarif -o results.sarif
333
+
334
+ - name: Upload SARIF to GitHub
335
+ uses: github/codeql-action/upload-sarif@v3
336
+ with:
337
+ sarif_file: results.sarif
338
+ ```
339
+
340
+ For diff-scoped PR runs, use `changed --scope git:origin/main -f sarif` and pass `--sarif-category` to the upload action so scoped results don't overwrite full-branch results.
208
341
 
209
- MIT - Use it anywhere, anytime.
342
+ ## Configuration
343
+
344
+ ### Persistent analyzer settings
345
+
346
+ Set custom thresholds via the MCP `config` tool:
347
+
348
+ ```
349
+ config.set analyzerName="solid" config={"maxMethodsPerClass":12}
350
+ ```
351
+
352
+ Settings persist across audits and survive index resets.
353
+
354
+ ### Data directory
210
355
 
211
- ---
356
+ The index file defaults to `<cwd>/.code-index/index.db`. Point at a dedicated location with the `CODE_AUDITOR_DATA_DIR` environment variable:
212
357
 
213
- **Ready to give your AI x-ray vision into your code?**
214
358
  ```bash
215
- claude mcp add code-auditor -- npx code-auditor-mcp
216
- ```
359
+ # Environment variable
360
+ CODE_AUDITOR_DATA_DIR=/path/to/data code-audit
361
+
362
+ # CLI
363
+ code-auditor-mcp --data-dir /path/to/data
364
+ ```
365
+
366
+ Cursor `.cursor/mcp.json` example:
367
+
368
+ ```json
369
+ {
370
+ "mcpServers": {
371
+ "code-auditor": {
372
+ "command": "npx",
373
+ "args": ["code-auditor-mcp", "--stdio"],
374
+ "env": {
375
+ "CODE_AUDITOR_DATA_DIR": "/Users/you/Library/Application Support/code-auditor"
376
+ }
377
+ }
378
+ }
379
+ }
380
+ ```
381
+
382
+ ## Contributing
383
+
384
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on adding new analyzers, language adapters, and invariant rule kinds.
385
+
386
+ ## License
387
+
388
+ MIT
@@ -2,14 +2,14 @@
2
2
  * Functional utilities for analyzer development
3
3
  * These replace the BaseAnalyzer class with composable functions
4
4
  */
5
- import * as ts from 'typescript';
5
+ import type { AST, ASTNode } from '../languages/types.js';
6
6
  import { Violation, AnalyzerResult, SeverityLevel } from '../types.js';
7
7
  export { parseTypeScriptFile } from '../utils/astParser.js';
8
8
  export { getLineAndColumn, getNodeText, getImports, findNodesByKind } from '../utils/astUtils.js';
9
9
  /**
10
10
  * File analyzer function - processes a single file
11
11
  */
12
- export type FileAnalyzerFunction = (filePath: string, sourceFile: ts.SourceFile, config: any) => Promise<Violation[]> | Violation[];
12
+ export type FileAnalyzerFunction = (filePath: string, ast: AST, config: any, sourceCode?: string) => Promise<Violation[]> | Violation[];
13
13
  /**
14
14
  * Progress reporter function
15
15
  */
@@ -24,32 +24,32 @@ export declare function processFiles(files: string[], analyzeFile: FileAnalyzerF
24
24
  */
25
25
  export declare function createViolation(data: Violation): Violation;
26
26
  /**
27
- * Get line and column from a TypeScript node
27
+ * Get line and column from an ASTNode
28
28
  */
29
- export declare function getNodePosition(sourceFile: ts.SourceFile, node: ts.Node): {
29
+ export declare function getNodePosition(node: ASTNode): {
30
30
  line: number;
31
31
  column: number;
32
32
  };
33
33
  /**
34
34
  * Check if a node is exported
35
35
  */
36
- export declare function isNodeExported(node: ts.Node): boolean;
36
+ export declare function isNodeExported(node: ASTNode): boolean;
37
37
  /**
38
38
  * Get the name of a node if it has one
39
39
  */
40
- export declare function getNodeName(node: ts.Node): string | undefined;
40
+ export declare function getNodeName(node: ASTNode): string | undefined;
41
41
  /**
42
42
  * Count specific node types in a subtree
43
43
  */
44
- export declare function countNodesOfType<T extends ts.Node>(node: ts.Node, predicate: (node: ts.Node) => node is T): number;
44
+ export declare function countNodesOfType(node: ASTNode, predicate: (node: ASTNode) => boolean): number;
45
45
  /**
46
46
  * Find all nodes of a specific type
47
47
  */
48
- export declare function findNodesOfType<T extends ts.Node>(node: ts.Node, predicate: (node: ts.Node) => node is T): T[];
48
+ export declare function findNodesOfType(node: ASTNode, predicate: (node: ASTNode) => boolean): ASTNode[];
49
49
  /**
50
50
  * Traverse AST with a visitor function
51
51
  */
52
- export declare function traverseAST(node: ts.Node, visitor: (node: ts.Node) => void): void;
52
+ export declare function traverseAST(node: ASTNode, visitor: (node: ASTNode) => void): void;
53
53
  /**
54
54
  * Filter violations by severity
55
55
  */
@@ -61,9 +61,11 @@ export declare function sortViolations(violations: Violation[]): Violation[];
61
61
  /**
62
62
  * Calculate cyclomatic complexity of a function
63
63
  */
64
- export declare function calculateComplexity(node: ts.FunctionLikeDeclaration): number;
64
+ export declare function calculateComplexity(node: ASTNode): number;
65
65
  /**
66
66
  * Create a standard analyzer function
67
67
  */
68
- export declare function createAnalyzer(name: string, fileAnalyzer: FileAnalyzerFunction, defaultConfig?: any): (files: any, config: any, options: any) => Promise<AnalyzerResult>;
68
+ export declare function createAnalyzer(name: string, fileAnalyzer: FileAnalyzerFunction, defaultConfig?: any): (files: string[], config: Record<string, unknown>, options?: {
69
+ minSeverity?: string;
70
+ }) => Promise<AnalyzerResult>;
69
71
  //# sourceMappingURL=analyzerUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"analyzerUtils.d.ts","sourceRoot":"","sources":["../../src/analyzers/analyzerUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,cAAc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