codeguardian-mcp 1.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 (335) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +348 -0
  3. package/dist/agent/agentTools.d.ts +26 -0
  4. package/dist/agent/agentTools.d.ts.map +1 -0
  5. package/dist/agent/agentTools.js +699 -0
  6. package/dist/agent/agentTools.js.map +1 -0
  7. package/dist/agent/autoValidator.d.ts +110 -0
  8. package/dist/agent/autoValidator.d.ts.map +1 -0
  9. package/dist/agent/autoValidator.js +964 -0
  10. package/dist/agent/autoValidator.js.map +1 -0
  11. package/dist/agent/fileWatcher.d.ts +28 -0
  12. package/dist/agent/fileWatcher.d.ts.map +1 -0
  13. package/dist/agent/fileWatcher.js +88 -0
  14. package/dist/agent/fileWatcher.js.map +1 -0
  15. package/dist/agent/guardianPersistence.d.ts +98 -0
  16. package/dist/agent/guardianPersistence.d.ts.map +1 -0
  17. package/dist/agent/guardianPersistence.js +296 -0
  18. package/dist/agent/guardianPersistence.js.map +1 -0
  19. package/dist/agent/mcpNotifications.d.ts +38 -0
  20. package/dist/agent/mcpNotifications.d.ts.map +1 -0
  21. package/dist/agent/mcpNotifications.js +81 -0
  22. package/dist/agent/mcpNotifications.js.map +1 -0
  23. package/dist/analyzers/aiPatterns.d.ts +16 -0
  24. package/dist/analyzers/aiPatterns.d.ts.map +1 -0
  25. package/dist/analyzers/aiPatterns.js +103 -0
  26. package/dist/analyzers/aiPatterns.js.map +1 -0
  27. package/dist/analyzers/antiPatterns.d.ts +60 -0
  28. package/dist/analyzers/antiPatterns.d.ts.map +1 -0
  29. package/dist/analyzers/antiPatterns.js +198 -0
  30. package/dist/analyzers/antiPatterns.js.map +1 -0
  31. package/dist/analyzers/builtinTypes.d.ts +18 -0
  32. package/dist/analyzers/builtinTypes.d.ts.map +1 -0
  33. package/dist/analyzers/builtinTypes.js +1275 -0
  34. package/dist/analyzers/builtinTypes.js.map +1 -0
  35. package/dist/analyzers/complexity.d.ts +14 -0
  36. package/dist/analyzers/complexity.d.ts.map +1 -0
  37. package/dist/analyzers/complexity.js +610 -0
  38. package/dist/analyzers/complexity.js.map +1 -0
  39. package/dist/analyzers/findingVerifier.d.ts +59 -0
  40. package/dist/analyzers/findingVerifier.d.ts.map +1 -0
  41. package/dist/analyzers/findingVerifier.js +1169 -0
  42. package/dist/analyzers/findingVerifier.js.map +1 -0
  43. package/dist/analyzers/impactAnalyzer.d.ts +53 -0
  44. package/dist/analyzers/impactAnalyzer.d.ts.map +1 -0
  45. package/dist/analyzers/impactAnalyzer.js +152 -0
  46. package/dist/analyzers/impactAnalyzer.js.map +1 -0
  47. package/dist/analyzers/languageDetector.d.ts +48 -0
  48. package/dist/analyzers/languageDetector.d.ts.map +1 -0
  49. package/dist/analyzers/languageDetector.js +404 -0
  50. package/dist/analyzers/languageDetector.js.map +1 -0
  51. package/dist/analyzers/parsers/incrementalParser.d.ts +53 -0
  52. package/dist/analyzers/parsers/incrementalParser.d.ts.map +1 -0
  53. package/dist/analyzers/parsers/incrementalParser.js +193 -0
  54. package/dist/analyzers/parsers/incrementalParser.js.map +1 -0
  55. package/dist/analyzers/parsers/scopeResolver.d.ts +92 -0
  56. package/dist/analyzers/parsers/scopeResolver.d.ts.map +1 -0
  57. package/dist/analyzers/parsers/scopeResolver.js +324 -0
  58. package/dist/analyzers/parsers/scopeResolver.js.map +1 -0
  59. package/dist/analyzers/parsers/semanticIndex.d.ts +127 -0
  60. package/dist/analyzers/parsers/semanticIndex.d.ts.map +1 -0
  61. package/dist/analyzers/parsers/semanticIndex.js +429 -0
  62. package/dist/analyzers/parsers/semanticIndex.js.map +1 -0
  63. package/dist/analyzers/parsers/sessionDiffAnalyzer.d.ts +42 -0
  64. package/dist/analyzers/parsers/sessionDiffAnalyzer.d.ts.map +1 -0
  65. package/dist/analyzers/parsers/sessionDiffAnalyzer.js +233 -0
  66. package/dist/analyzers/parsers/sessionDiffAnalyzer.js.map +1 -0
  67. package/dist/analyzers/parsers/treeSitterParser.d.ts +76 -0
  68. package/dist/analyzers/parsers/treeSitterParser.d.ts.map +1 -0
  69. package/dist/analyzers/parsers/treeSitterParser.js +709 -0
  70. package/dist/analyzers/parsers/treeSitterParser.js.map +1 -0
  71. package/dist/analyzers/relevanceScorer.d.ts +43 -0
  72. package/dist/analyzers/relevanceScorer.d.ts.map +1 -0
  73. package/dist/analyzers/relevanceScorer.js +200 -0
  74. package/dist/analyzers/relevanceScorer.js.map +1 -0
  75. package/dist/analyzers/standardLibrary.d.ts +22 -0
  76. package/dist/analyzers/standardLibrary.d.ts.map +1 -0
  77. package/dist/analyzers/standardLibrary.js +211 -0
  78. package/dist/analyzers/standardLibrary.js.map +1 -0
  79. package/dist/analyzers/symbolGraph.d.ts +30 -0
  80. package/dist/analyzers/symbolGraph.d.ts.map +1 -0
  81. package/dist/analyzers/symbolGraph.js +380 -0
  82. package/dist/analyzers/symbolGraph.js.map +1 -0
  83. package/dist/analyzers/symbolTable.d.ts +18 -0
  84. package/dist/analyzers/symbolTable.d.ts.map +1 -0
  85. package/dist/analyzers/symbolTable.js +176 -0
  86. package/dist/analyzers/symbolTable.js.map +1 -0
  87. package/dist/analyzers/typeChecker.d.ts +13 -0
  88. package/dist/analyzers/typeChecker.d.ts.map +1 -0
  89. package/dist/analyzers/typeChecker.js +580 -0
  90. package/dist/analyzers/typeChecker.js.map +1 -0
  91. package/dist/analyzers/usagePatterns.d.ts +42 -0
  92. package/dist/analyzers/usagePatterns.d.ts.map +1 -0
  93. package/dist/analyzers/usagePatterns.js +75 -0
  94. package/dist/analyzers/usagePatterns.js.map +1 -0
  95. package/dist/api-contract/context/backend.d.ts +19 -0
  96. package/dist/api-contract/context/backend.d.ts.map +1 -0
  97. package/dist/api-contract/context/backend.js +64 -0
  98. package/dist/api-contract/context/backend.js.map +1 -0
  99. package/dist/api-contract/context/contract.d.ts +34 -0
  100. package/dist/api-contract/context/contract.d.ts.map +1 -0
  101. package/dist/api-contract/context/contract.js +306 -0
  102. package/dist/api-contract/context/contract.js.map +1 -0
  103. package/dist/api-contract/context/frontend.d.ts +19 -0
  104. package/dist/api-contract/context/frontend.d.ts.map +1 -0
  105. package/dist/api-contract/context/frontend.js +64 -0
  106. package/dist/api-contract/context/frontend.js.map +1 -0
  107. package/dist/api-contract/detector.d.ts +28 -0
  108. package/dist/api-contract/detector.d.ts.map +1 -0
  109. package/dist/api-contract/detector.js +393 -0
  110. package/dist/api-contract/detector.js.map +1 -0
  111. package/dist/api-contract/extractors/python.d.ts +32 -0
  112. package/dist/api-contract/extractors/python.d.ts.map +1 -0
  113. package/dist/api-contract/extractors/python.js +521 -0
  114. package/dist/api-contract/extractors/python.js.map +1 -0
  115. package/dist/api-contract/extractors/pythonAstUtils.d.ts +44 -0
  116. package/dist/api-contract/extractors/pythonAstUtils.d.ts.map +1 -0
  117. package/dist/api-contract/extractors/pythonAstUtils.js +489 -0
  118. package/dist/api-contract/extractors/pythonAstUtils.js.map +1 -0
  119. package/dist/api-contract/extractors/tsAstUtils.d.ts +47 -0
  120. package/dist/api-contract/extractors/tsAstUtils.d.ts.map +1 -0
  121. package/dist/api-contract/extractors/tsAstUtils.js +173 -0
  122. package/dist/api-contract/extractors/tsAstUtils.js.map +1 -0
  123. package/dist/api-contract/extractors/typescript.d.ts +32 -0
  124. package/dist/api-contract/extractors/typescript.d.ts.map +1 -0
  125. package/dist/api-contract/extractors/typescript.js +666 -0
  126. package/dist/api-contract/extractors/typescript.js.map +1 -0
  127. package/dist/api-contract/index.d.ts +104 -0
  128. package/dist/api-contract/index.d.ts.map +1 -0
  129. package/dist/api-contract/index.js +232 -0
  130. package/dist/api-contract/index.js.map +1 -0
  131. package/dist/api-contract/types.d.ts +151 -0
  132. package/dist/api-contract/types.d.ts.map +1 -0
  133. package/dist/api-contract/types.js +19 -0
  134. package/dist/api-contract/types.js.map +1 -0
  135. package/dist/api-contract/validators/endpoint.d.ts +21 -0
  136. package/dist/api-contract/validators/endpoint.d.ts.map +1 -0
  137. package/dist/api-contract/validators/endpoint.js +224 -0
  138. package/dist/api-contract/validators/endpoint.js.map +1 -0
  139. package/dist/api-contract/validators/index.d.ts +40 -0
  140. package/dist/api-contract/validators/index.d.ts.map +1 -0
  141. package/dist/api-contract/validators/index.js +875 -0
  142. package/dist/api-contract/validators/index.js.map +1 -0
  143. package/dist/api-contract/validators/parameter.d.ts +17 -0
  144. package/dist/api-contract/validators/parameter.d.ts.map +1 -0
  145. package/dist/api-contract/validators/parameter.js +250 -0
  146. package/dist/api-contract/validators/parameter.js.map +1 -0
  147. package/dist/api-contract/validators/type.d.ts +38 -0
  148. package/dist/api-contract/validators/type.d.ts.map +1 -0
  149. package/dist/api-contract/validators/type.js +244 -0
  150. package/dist/api-contract/validators/type.js.map +1 -0
  151. package/dist/context/apiContract/complexTypeSupport.d.ts +83 -0
  152. package/dist/context/apiContract/complexTypeSupport.d.ts.map +1 -0
  153. package/dist/context/apiContract/complexTypeSupport.js +665 -0
  154. package/dist/context/apiContract/complexTypeSupport.js.map +1 -0
  155. package/dist/context/apiContract/graphqlSupport.d.ts +105 -0
  156. package/dist/context/apiContract/graphqlSupport.d.ts.map +1 -0
  157. package/dist/context/apiContract/graphqlSupport.js +671 -0
  158. package/dist/context/apiContract/graphqlSupport.js.map +1 -0
  159. package/dist/context/apiContract/index.d.ts +14 -0
  160. package/dist/context/apiContract/index.d.ts.map +1 -0
  161. package/dist/context/apiContract/index.js +17 -0
  162. package/dist/context/apiContract/index.js.map +1 -0
  163. package/dist/context/apiContract/webSocketSupport.d.ts +104 -0
  164. package/dist/context/apiContract/webSocketSupport.d.ts.map +1 -0
  165. package/dist/context/apiContract/webSocketSupport.js +465 -0
  166. package/dist/context/apiContract/webSocketSupport.js.map +1 -0
  167. package/dist/context/apiContractContext.d.ts +15 -0
  168. package/dist/context/apiContractContext.d.ts.map +1 -0
  169. package/dist/context/apiContractContext.js +979 -0
  170. package/dist/context/apiContractContext.js.map +1 -0
  171. package/dist/context/apiContractExtraction.d.ts +52 -0
  172. package/dist/context/apiContractExtraction.d.ts.map +1 -0
  173. package/dist/context/apiContractExtraction.js +438 -0
  174. package/dist/context/apiContractExtraction.js.map +1 -0
  175. package/dist/context/contextLineage.d.ts +79 -0
  176. package/dist/context/contextLineage.d.ts.map +1 -0
  177. package/dist/context/contextLineage.js +259 -0
  178. package/dist/context/contextLineage.js.map +1 -0
  179. package/dist/context/contextOrchestrator.d.ts +57 -0
  180. package/dist/context/contextOrchestrator.d.ts.map +1 -0
  181. package/dist/context/contextOrchestrator.js +162 -0
  182. package/dist/context/contextOrchestrator.js.map +1 -0
  183. package/dist/context/intentTracker.d.ts +73 -0
  184. package/dist/context/intentTracker.d.ts.map +1 -0
  185. package/dist/context/intentTracker.js +168 -0
  186. package/dist/context/intentTracker.js.map +1 -0
  187. package/dist/context/projectContext.d.ts +219 -0
  188. package/dist/context/projectContext.d.ts.map +1 -0
  189. package/dist/context/projectContext.js +1984 -0
  190. package/dist/context/projectContext.js.map +1 -0
  191. package/dist/prompts/index.d.ts +17 -0
  192. package/dist/prompts/index.d.ts.map +1 -0
  193. package/dist/prompts/index.js +260 -0
  194. package/dist/prompts/index.js.map +1 -0
  195. package/dist/prompts/library.d.ts +51 -0
  196. package/dist/prompts/library.d.ts.map +1 -0
  197. package/dist/prompts/library.js +65 -0
  198. package/dist/prompts/library.js.map +1 -0
  199. package/dist/prompts/templates.d.ts +44 -0
  200. package/dist/prompts/templates.d.ts.map +1 -0
  201. package/dist/prompts/templates.js +97 -0
  202. package/dist/prompts/templates.js.map +1 -0
  203. package/dist/queue/jobPersistence.d.ts +46 -0
  204. package/dist/queue/jobPersistence.d.ts.map +1 -0
  205. package/dist/queue/jobPersistence.js +158 -0
  206. package/dist/queue/jobPersistence.js.map +1 -0
  207. package/dist/queue/jobQueue.d.ts +116 -0
  208. package/dist/queue/jobQueue.d.ts.map +1 -0
  209. package/dist/queue/jobQueue.js +275 -0
  210. package/dist/queue/jobQueue.js.map +1 -0
  211. package/dist/queue/validationJob.d.ts +69 -0
  212. package/dist/queue/validationJob.d.ts.map +1 -0
  213. package/dist/queue/validationJob.js +435 -0
  214. package/dist/queue/validationJob.js.map +1 -0
  215. package/dist/resources/index.d.ts +15 -0
  216. package/dist/resources/index.d.ts.map +1 -0
  217. package/dist/resources/index.js +328 -0
  218. package/dist/resources/index.js.map +1 -0
  219. package/dist/resources/validationReportStore.d.ts +170 -0
  220. package/dist/resources/validationReportStore.d.ts.map +1 -0
  221. package/dist/resources/validationReportStore.js +515 -0
  222. package/dist/resources/validationReportStore.js.map +1 -0
  223. package/dist/server.d.ts +12 -0
  224. package/dist/server.d.ts.map +1 -0
  225. package/dist/server.js +102 -0
  226. package/dist/server.js.map +1 -0
  227. package/dist/tools/asyncValidation.d.ts +19 -0
  228. package/dist/tools/asyncValidation.d.ts.map +1 -0
  229. package/dist/tools/asyncValidation.js +346 -0
  230. package/dist/tools/asyncValidation.js.map +1 -0
  231. package/dist/tools/buildContext.d.ts +17 -0
  232. package/dist/tools/buildContext.d.ts.map +1 -0
  233. package/dist/tools/buildContext.js +188 -0
  234. package/dist/tools/buildContext.js.map +1 -0
  235. package/dist/tools/getDependencyGraph.d.ts +16 -0
  236. package/dist/tools/getDependencyGraph.d.ts.map +1 -0
  237. package/dist/tools/getDependencyGraph.js +436 -0
  238. package/dist/tools/getDependencyGraph.js.map +1 -0
  239. package/dist/tools/incrementalValidation.d.ts +71 -0
  240. package/dist/tools/incrementalValidation.d.ts.map +1 -0
  241. package/dist/tools/incrementalValidation.js +203 -0
  242. package/dist/tools/incrementalValidation.js.map +1 -0
  243. package/dist/tools/index.d.ts +24 -0
  244. package/dist/tools/index.d.ts.map +1 -0
  245. package/dist/tools/index.js +106 -0
  246. package/dist/tools/index.js.map +1 -0
  247. package/dist/tools/validateCode.d.ts +17 -0
  248. package/dist/tools/validateCode.d.ts.map +1 -0
  249. package/dist/tools/validateCode.js +368 -0
  250. package/dist/tools/validateCode.js.map +1 -0
  251. package/dist/tools/validateCodeLite.d.ts +2 -0
  252. package/dist/tools/validateCodeLite.d.ts.map +1 -0
  253. package/dist/tools/validateCodeLite.js +2 -0
  254. package/dist/tools/validateCodeLite.js.map +1 -0
  255. package/dist/tools/validation/builtins.d.ts +92 -0
  256. package/dist/tools/validation/builtins.d.ts.map +1 -0
  257. package/dist/tools/validation/builtins.js +2184 -0
  258. package/dist/tools/validation/builtins.js.map +1 -0
  259. package/dist/tools/validation/contextualNaming.d.ts +99 -0
  260. package/dist/tools/validation/contextualNaming.d.ts.map +1 -0
  261. package/dist/tools/validation/contextualNaming.js +959 -0
  262. package/dist/tools/validation/contextualNaming.js.map +1 -0
  263. package/dist/tools/validation/deadCode.d.ts +115 -0
  264. package/dist/tools/validation/deadCode.d.ts.map +1 -0
  265. package/dist/tools/validation/deadCode.js +861 -0
  266. package/dist/tools/validation/deadCode.js.map +1 -0
  267. package/dist/tools/validation/extractors/index.d.ts +131 -0
  268. package/dist/tools/validation/extractors/index.d.ts.map +1 -0
  269. package/dist/tools/validation/extractors/index.js +233 -0
  270. package/dist/tools/validation/extractors/index.js.map +1 -0
  271. package/dist/tools/validation/extractors/javascript.d.ts +73 -0
  272. package/dist/tools/validation/extractors/javascript.d.ts.map +1 -0
  273. package/dist/tools/validation/extractors/javascript.js +1841 -0
  274. package/dist/tools/validation/extractors/javascript.js.map +1 -0
  275. package/dist/tools/validation/extractors/python.d.ts +93 -0
  276. package/dist/tools/validation/extractors/python.d.ts.map +1 -0
  277. package/dist/tools/validation/extractors/python.js +799 -0
  278. package/dist/tools/validation/extractors/python.js.map +1 -0
  279. package/dist/tools/validation/manifest.d.ts +45 -0
  280. package/dist/tools/validation/manifest.d.ts.map +1 -0
  281. package/dist/tools/validation/manifest.js +719 -0
  282. package/dist/tools/validation/manifest.js.map +1 -0
  283. package/dist/tools/validation/parser.d.ts +58 -0
  284. package/dist/tools/validation/parser.d.ts.map +1 -0
  285. package/dist/tools/validation/parser.js +232 -0
  286. package/dist/tools/validation/parser.js.map +1 -0
  287. package/dist/tools/validation/registry.d.ts +15 -0
  288. package/dist/tools/validation/registry.d.ts.map +1 -0
  289. package/dist/tools/validation/registry.js +169 -0
  290. package/dist/tools/validation/registry.js.map +1 -0
  291. package/dist/tools/validation/scoring.d.ts +54 -0
  292. package/dist/tools/validation/scoring.d.ts.map +1 -0
  293. package/dist/tools/validation/scoring.js +242 -0
  294. package/dist/tools/validation/scoring.js.map +1 -0
  295. package/dist/tools/validation/types.d.ts +120 -0
  296. package/dist/tools/validation/types.d.ts.map +1 -0
  297. package/dist/tools/validation/types.js +11 -0
  298. package/dist/tools/validation/types.js.map +1 -0
  299. package/dist/tools/validation/unusedLocals.d.ts +36 -0
  300. package/dist/tools/validation/unusedLocals.d.ts.map +1 -0
  301. package/dist/tools/validation/unusedLocals.js +333 -0
  302. package/dist/tools/validation/unusedLocals.js.map +1 -0
  303. package/dist/tools/validation/validation.d.ts +98 -0
  304. package/dist/tools/validation/validation.d.ts.map +1 -0
  305. package/dist/tools/validation/validation.js +1837 -0
  306. package/dist/tools/validation/validation.js.map +1 -0
  307. package/dist/types/codeGraph.d.ts +163 -0
  308. package/dist/types/codeGraph.d.ts.map +1 -0
  309. package/dist/types/codeGraph.js +9 -0
  310. package/dist/types/codeGraph.js.map +1 -0
  311. package/dist/types/symbolGraph.d.ts +68 -0
  312. package/dist/types/symbolGraph.d.ts.map +1 -0
  313. package/dist/types/symbolGraph.js +10 -0
  314. package/dist/types/symbolGraph.js.map +1 -0
  315. package/dist/types/tools.d.ts +43 -0
  316. package/dist/types/tools.d.ts.map +1 -0
  317. package/dist/types/tools.js +7 -0
  318. package/dist/types/tools.js.map +1 -0
  319. package/dist/utils/fileFilter.d.ts +37 -0
  320. package/dist/utils/fileFilter.d.ts.map +1 -0
  321. package/dist/utils/fileFilter.js +91 -0
  322. package/dist/utils/fileFilter.js.map +1 -0
  323. package/dist/utils/gitUtils.d.ts +28 -0
  324. package/dist/utils/gitUtils.d.ts.map +1 -0
  325. package/dist/utils/gitUtils.js +81 -0
  326. package/dist/utils/gitUtils.js.map +1 -0
  327. package/dist/utils/logger.d.ts +15 -0
  328. package/dist/utils/logger.d.ts.map +1 -0
  329. package/dist/utils/logger.js +38 -0
  330. package/dist/utils/logger.js.map +1 -0
  331. package/dist/utils/serialization.d.ts +25 -0
  332. package/dist/utils/serialization.d.ts.map +1 -0
  333. package/dist/utils/serialization.js +53 -0
  334. package/dist/utils/serialization.js.map +1 -0
  335. package/package.json +90 -0
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Async Validation Tools
3
+ *
4
+ * Three tools for handling long-running validation jobs:
5
+ * 1. start_validation - Submit a validation job
6
+ * 2. get_validation_status - Check job progress
7
+ * 3. get_validation_results - Retrieve completed results
8
+ *
9
+ * Results are saved to BOTH:
10
+ * - `.codeguardian/reports/` (internal cache, gitignored)
11
+ * - `codeguardian-report.json` (LLM-readable, at project root)
12
+ *
13
+ * @format
14
+ */
15
+ import { ToolDefinition } from "../types/tools.js";
16
+ export declare const startValidationTool: ToolDefinition;
17
+ export declare const getValidationStatusTool: ToolDefinition;
18
+ export declare const getValidationResultsTool: ToolDefinition;
19
+ //# sourceMappingURL=asyncValidation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asyncValidation.d.ts","sourceRoot":"","sources":["../../src/tools/asyncValidation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AASnD,eAAO,MAAM,mBAAmB,EAAE,cAgFjC,CAAC;AAMF,eAAO,MAAM,uBAAuB,EAAE,cAgDrC,CAAC;AAMF,eAAO,MAAM,wBAAwB,EAAE,cAyNtC,CAAC"}
@@ -0,0 +1,346 @@
1
+ /**
2
+ * Async Validation Tools
3
+ *
4
+ * Three tools for handling long-running validation jobs:
5
+ * 1. start_validation - Submit a validation job
6
+ * 2. get_validation_status - Check job progress
7
+ * 3. get_validation_results - Retrieve completed results
8
+ *
9
+ * Results are saved to BOTH:
10
+ * - `.codeguardian/reports/` (internal cache, gitignored)
11
+ * - `codeguardian-report.json` (LLM-readable, at project root)
12
+ *
13
+ * @format
14
+ */
15
+ import * as path from "path";
16
+ import { logger } from "../utils/logger.js";
17
+ import { jobQueue } from "../queue/jobQueue.js";
18
+ import { validationReportStore } from "../resources/validationReportStore.js";
19
+ // ============================================================================
20
+ // Tool 1: Start Validation
21
+ // ============================================================================
22
+ export const startValidationTool = {
23
+ definition: {
24
+ name: "start_validation",
25
+ description: "Start a background validation job for large codebases (>50 files) to avoid timeouts. Use 'get_validation_status' to poll for progress. Results are saved to codeguardian-report.json at the project root (readable by file tools, NOT inside .codeguardian/).",
26
+ inputSchema: {
27
+ type: "object",
28
+ properties: {
29
+ projectPath: {
30
+ type: "string",
31
+ description: 'Path to your project (e.g., ".", "frontend")',
32
+ },
33
+ language: {
34
+ type: "string",
35
+ enum: ["javascript", "typescript", "python", "go"],
36
+ description: "Programming language (typescript includes .js/.jsx files for mixed projects)",
37
+ },
38
+ batchSize: {
39
+ type: "number",
40
+ description: "Files per batch (default: 50, max: 100)",
41
+ default: 50,
42
+ },
43
+ strictMode: {
44
+ type: "boolean",
45
+ description: "ONLY use true if explicitly requested. When true, flags ALL unresolved symbols including edge cases. Default is false which catches likely hallucinations without excessive noise.",
46
+ default: false,
47
+ },
48
+ includeTests: {
49
+ type: "boolean",
50
+ description: "Include test files (default: true)",
51
+ default: true,
52
+ },
53
+ recentlyEditedFiles: {
54
+ type: "array",
55
+ items: { type: "string" },
56
+ description: "Optional list of files edited in this session to boost relevance",
57
+ },
58
+ },
59
+ required: ["projectPath", "language"],
60
+ },
61
+ },
62
+ async handler(args) {
63
+ logger.info(`Starting async validation for: ${args.projectPath}`);
64
+ try {
65
+ const jobId = await jobQueue.submitJob("validation", args);
66
+ const resolvedPath = path.resolve(args.projectPath);
67
+ const reportFilePath = validationReportStore.getLLMReportPath(resolvedPath);
68
+ return formatResponse({
69
+ success: true,
70
+ jobId,
71
+ status: "queued",
72
+ message: "Validation job submitted successfully",
73
+ reportFile: reportFilePath,
74
+ nextSteps: [
75
+ `Use get_validation_status({ jobId: "${jobId}" }) to check progress`,
76
+ `Use get_validation_results({ jobId: "${jobId}" }) to get results when complete`,
77
+ `When complete, results will be saved to: ${reportFilePath}`,
78
+ `You can read the report file directly with your file-reading tool (it's NOT inside .codeguardian/)`,
79
+ ],
80
+ });
81
+ }
82
+ catch (error) {
83
+ logger.error("Error starting validation job:", error);
84
+ return formatResponse({
85
+ success: false,
86
+ error: error instanceof Error ? error.message : String(error),
87
+ });
88
+ }
89
+ },
90
+ };
91
+ // ============================================================================
92
+ // Tool 2: Get Validation Status
93
+ // ============================================================================
94
+ export const getValidationStatusTool = {
95
+ definition: {
96
+ name: "get_validation_status",
97
+ description: "Check progress of a validation job. Poll every 3-5s until status is 'complete' or 'failed'.",
98
+ inputSchema: {
99
+ type: "object",
100
+ properties: {
101
+ jobId: {
102
+ type: "string",
103
+ description: "Job ID returned from start_validation",
104
+ },
105
+ },
106
+ required: ["jobId"],
107
+ },
108
+ },
109
+ async handler(args) {
110
+ logger.info(`Checking status for job: ${args.jobId}`);
111
+ try {
112
+ const status = jobQueue.getJobStatus(args.jobId);
113
+ if (!status.exists) {
114
+ return formatResponse({
115
+ success: false,
116
+ exists: false,
117
+ error: `Job not found: ${args.jobId}`,
118
+ message: "Job may have expired (jobs expire after 24 hours)",
119
+ });
120
+ }
121
+ return formatResponse({
122
+ success: true,
123
+ exists: true,
124
+ jobId: args.jobId,
125
+ status: status.status,
126
+ progress: status.progress,
127
+ error: status.error,
128
+ });
129
+ }
130
+ catch (error) {
131
+ logger.error("Error getting job status:", error);
132
+ return formatResponse({
133
+ success: false,
134
+ error: error instanceof Error ? error.message : String(error),
135
+ });
136
+ }
137
+ },
138
+ };
139
+ // ============================================================================
140
+ // Tool 3: Get Validation Results
141
+ // ============================================================================
142
+ export const getValidationResultsTool = {
143
+ definition: {
144
+ name: "get_validation_results",
145
+ description: "Retrieve final results for a completed validation job. Results are also saved to codeguardian-report.json at the project root, readable by file tools.",
146
+ inputSchema: {
147
+ type: "object",
148
+ properties: {
149
+ jobId: {
150
+ type: "string",
151
+ description: "Job ID returned from start_validation",
152
+ },
153
+ fileFilter: {
154
+ type: "string",
155
+ description: "Optional: Filter results by file path (partial match)",
156
+ },
157
+ severityFilter: {
158
+ type: "string",
159
+ enum: ["critical", "high", "medium", "low", "warning"],
160
+ description: "Optional: Filter results by severity",
161
+ },
162
+ limit: {
163
+ type: "number",
164
+ description: "Optional: Limit number of issues returned (default: all)",
165
+ },
166
+ offset: {
167
+ type: "number",
168
+ description: "Optional: Offset for pagination (default: 0)",
169
+ },
170
+ summaryOnly: {
171
+ type: "boolean",
172
+ description: "Optional: If true, returns only summary and stats without issue lists",
173
+ default: false,
174
+ },
175
+ },
176
+ required: ["jobId"],
177
+ },
178
+ },
179
+ async handler(args) {
180
+ logger.info(`Getting results for job: ${args.jobId}`);
181
+ try {
182
+ const results = jobQueue.getJobResults(args.jobId);
183
+ if (!results.exists) {
184
+ return formatResponse({
185
+ success: false,
186
+ exists: false,
187
+ error: `Job not found: ${args.jobId}`,
188
+ message: "Job may have expired (jobs expire after 24 hours)",
189
+ });
190
+ }
191
+ if (results.status !== "complete") {
192
+ return formatResponse({
193
+ success: false,
194
+ exists: true,
195
+ jobId: args.jobId,
196
+ status: results.status,
197
+ error: results.error,
198
+ message: results.status === "processing" ?
199
+ "Job is still processing. Use get_validation_status to check progress."
200
+ : results.status === "failed" ?
201
+ "Job failed. Check error field for details."
202
+ : results.status === "queued" ?
203
+ "Job is queued. Use get_validation_status to check progress."
204
+ : "Job was cancelled.",
205
+ });
206
+ }
207
+ const fullResult = results.result;
208
+ if (!fullResult) {
209
+ return formatResponse({
210
+ success: true,
211
+ exists: true,
212
+ jobId: args.jobId,
213
+ status: results.status,
214
+ message: "No result data found",
215
+ });
216
+ }
217
+ // Store the report in the resource store (if not already stored)
218
+ const job = jobQueue.getJob(args.jobId);
219
+ const projectPath = job?.input?.projectPath || "";
220
+ if (!validationReportStore.has(args.jobId)) {
221
+ // Wait for the report to be written to disk
222
+ // This saves to BOTH .codeguardian/reports/ AND codeguardian-report.json (LLM-readable)
223
+ await validationReportStore.store(args.jobId, projectPath, {
224
+ summary: fullResult.summary,
225
+ stats: fullResult.stats,
226
+ hallucinations: fullResult.hallucinations || [],
227
+ deadCode: fullResult.deadCode || [],
228
+ score: fullResult.score,
229
+ recommendation: fullResult.recommendation,
230
+ });
231
+ }
232
+ // Get LLM-readable report file path
233
+ const reportFilePath = projectPath
234
+ ? validationReportStore.getLLMReportPath(projectPath)
235
+ : undefined;
236
+ const totalIssues = (fullResult.hallucinations?.length || 0) + (fullResult.deadCode?.length || 0);
237
+ const isLargeResult = totalIssues > 50;
238
+ const hasAppliedFilters = args.fileFilter || args.severityFilter || args.limit !== undefined || args.offset !== undefined;
239
+ // For large results without filters, return ONLY the URI and summary
240
+ // This prevents LLM context overflow
241
+ if (isLargeResult && !hasAppliedFilters && !args.summaryOnly) {
242
+ const reportUri = validationReportStore.getReportUri(args.jobId);
243
+ const summary = validationReportStore.getSummary(args.jobId);
244
+ return formatResponse({
245
+ success: true,
246
+ exists: true,
247
+ jobId: args.jobId,
248
+ status: results.status,
249
+ // COMPACT RESPONSE: URI + Summary only
250
+ reportUri,
251
+ reportFile: reportFilePath,
252
+ message: `Large result set (${totalIssues} issues). Full report saved to ${reportFilePath || 'MCP Resource'}. Use your file-reading tool to access it.`,
253
+ summary: summary?.summary,
254
+ stats: summary?.stats,
255
+ score: summary?.score,
256
+ recommendation: summary?.recommendation,
257
+ totalHallucinations: summary?.totalHallucinations,
258
+ totalDeadCode: summary?.totalDeadCode,
259
+ // Instructions for the LLM/IDE to fetch chunks or read file
260
+ fileAccess: {
261
+ reportFile: reportFilePath,
262
+ tip: "Use your file-reading tool (e.g. read_file) to read the codeguardian-report.json file for full details. This file is at the project root and NOT inside .codeguardian/.",
263
+ },
264
+ resourceAccess: {
265
+ summaryUri: reportUri,
266
+ hallucinationsUri: `${reportUri}/hallucinations/0`,
267
+ deadCodeUri: `${reportUri}/dead-code/0`,
268
+ bySeverityUri: `${reportUri}/by-severity/critical`,
269
+ byTypeUri: `${reportUri}/by-type/dependencyHallucination`,
270
+ tip: "Alternatively, use MCP Resources or filters (fileFilter, severityFilter) with this tool for specific queries.",
271
+ },
272
+ });
273
+ }
274
+ // For summaryOnly, return just the summary
275
+ if (args.summaryOnly) {
276
+ return formatResponse({
277
+ success: true,
278
+ exists: true,
279
+ jobId: args.jobId,
280
+ status: results.status,
281
+ summary: fullResult.summary,
282
+ stats: fullResult.stats,
283
+ recommendation: fullResult.recommendation,
284
+ score: fullResult.score,
285
+ totalIssues,
286
+ reportUri: validationReportStore.getReportUri(args.jobId),
287
+ reportFile: reportFilePath,
288
+ hint: reportFilePath
289
+ ? `Full report saved to ${reportFilePath}. Use your file-reading tool to access it.`
290
+ : undefined,
291
+ });
292
+ }
293
+ // For filtered/paginated requests, return the filtered data inline
294
+ // (This is for when the LLM specifically needs certain issues)
295
+ const filtered = validationReportStore.getFilteredIssues(args.jobId, {
296
+ type: args.severityFilter ? undefined : undefined, // Can extend later
297
+ severity: args.severityFilter,
298
+ file: args.fileFilter,
299
+ limit: args.limit ?? 25,
300
+ offset: args.offset ?? 0,
301
+ });
302
+ if (!filtered) {
303
+ return formatResponse({
304
+ success: false,
305
+ error: "Failed to retrieve filtered issues",
306
+ });
307
+ }
308
+ return formatResponse({
309
+ success: true,
310
+ exists: true,
311
+ jobId: args.jobId,
312
+ status: results.status,
313
+ reportUri: validationReportStore.getReportUri(args.jobId),
314
+ reportFile: reportFilePath,
315
+ issues: filtered.issues,
316
+ pagination: {
317
+ total: filtered.total,
318
+ limit: args.limit ?? 25,
319
+ offset: args.offset ?? 0,
320
+ hasMore: filtered.hasMore,
321
+ },
322
+ summary: fullResult.summary,
323
+ score: fullResult.score,
324
+ hint: reportFilePath
325
+ ? `Full report also available at ${reportFilePath}. Use your file-reading tool to access it.`
326
+ : undefined,
327
+ });
328
+ }
329
+ catch (error) {
330
+ logger.error("Error getting job results:", error);
331
+ return formatResponse({
332
+ success: false,
333
+ error: error instanceof Error ? error.message : String(error),
334
+ });
335
+ }
336
+ },
337
+ };
338
+ // ============================================================================
339
+ // Response Formatting
340
+ // ============================================================================
341
+ function formatResponse(data) {
342
+ return {
343
+ content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
344
+ };
345
+ }
346
+ //# sourceMappingURL=asyncValidation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asyncValidation.js","sourceRoot":"","sources":["../../src/tools/asyncValidation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAE9E,+EAA+E;AAC/E,2BAA2B;AAC3B,+EAA+E;AAE/E,MAAM,CAAC,MAAM,mBAAmB,GAAmB;IACjD,UAAU,EAAE;QACV,IAAI,EAAE,kBAAkB;QACxB,WAAW,EACT,+PAA+P;QACjQ,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,8CAA8C;iBAC5D;gBACD,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,CAAC;oBAClD,WAAW,EACT,8EAA8E;iBACjF;gBACD,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,yCAAyC;oBACtD,OAAO,EAAE,EAAE;iBACZ;gBACD,UAAU,EAAE;oBACV,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,oLAA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ACD,OAAO,EAAE,UAAU,CAAC,OAAO;gBAC3B,KAAK,EAAE,UAAU,CAAC,KAAK;gBACvB,IAAI,EAAE,cAAc;oBAClB,CAAC,CAAC,iCAAiC,cAAc,4CAA4C;oBAC7F,CAAC,CAAC,SAAS;aACd,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;YAClD,OAAO,cAAc,CAAC;gBACpB,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;aAC9D,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF,CAAC;AAEF,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAE/E,SAAS,cAAc,CAAC,IAA6B;IACnD,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;KAC1E,CAAC;AACJ,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Build Context Tool (Improved Version)
3
+ *
4
+ * Builds a shared project context that other tools can use.
5
+ * This is the entry point for the shared context system.
6
+ *
7
+ * Improvements:
8
+ * 1. Dynamic cache expiration reporting from the context object.
9
+ * 2. Added `refresh_context` tool for atomic invalidation and rebuild.
10
+ * 3. Enhanced response formatting for better LLM consumption.
11
+ * 4. Improved documentation and type safety.
12
+ *
13
+ * @format
14
+ */
15
+ import { ToolDefinition } from "../types/tools.js";
16
+ export declare const buildContextTool: ToolDefinition;
17
+ //# sourceMappingURL=buildContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildContext.d.ts","sourceRoot":"","sources":["../../src/tools/buildContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA6BnD,eAAO,MAAM,gBAAgB,EAAE,cA2H9B,CAAC"}
@@ -0,0 +1,188 @@
1
+ /**
2
+ * Build Context Tool (Improved Version)
3
+ *
4
+ * Builds a shared project context that other tools can use.
5
+ * This is the entry point for the shared context system.
6
+ *
7
+ * Improvements:
8
+ * 1. Dynamic cache expiration reporting from the context object.
9
+ * 2. Added `refresh_context` tool for atomic invalidation and rebuild.
10
+ * 3. Enhanced response formatting for better LLM consumption.
11
+ * 4. Improved documentation and type safety.
12
+ *
13
+ * @format
14
+ */
15
+ import { logger } from "../utils/logger.js";
16
+ import { orchestrateContext } from "../context/contextOrchestrator.js";
17
+ import { intentTracker } from "../context/intentTracker.js";
18
+ import { impactAnalyzer } from "../analyzers/impactAnalyzer.js";
19
+ export const buildContextTool = {
20
+ definition: {
21
+ name: "build_context",
22
+ description: "Build or rebuild project context including symbols, git history, and intent signals. Usually auto-called by other tools.",
23
+ inputSchema: {
24
+ type: "object",
25
+ properties: {
26
+ projectPath: {
27
+ type: "string",
28
+ description: "Root path of the project to analyze",
29
+ },
30
+ language: {
31
+ type: "string",
32
+ enum: ["javascript", "typescript", "python", "go", "java", "all"],
33
+ description: "Programming language to focus on (default: all)",
34
+ default: "all",
35
+ },
36
+ includeTests: {
37
+ type: "boolean",
38
+ description: "Include test files in context (default: true)",
39
+ default: true,
40
+ },
41
+ forceRebuild: {
42
+ type: "boolean",
43
+ description: "Force rebuild even if cached",
44
+ default: false,
45
+ },
46
+ maxFiles: {
47
+ type: "number",
48
+ description: "Maximum files to index (default: 1000)",
49
+ default: 1000,
50
+ },
51
+ },
52
+ required: ["projectPath"],
53
+ },
54
+ },
55
+ async handler(args) {
56
+ const startTime = Date.now();
57
+ const { projectPath, language = "all", includeTests = true, forceRebuild = false, maxFiles = 1000, } = args;
58
+ logger.info(`Building orchestrated context for: ${projectPath}`);
59
+ try {
60
+ // Use the robust orchestrator from src/context
61
+ const orchestration = await orchestrateContext({
62
+ projectPath,
63
+ language: language === "all" ? "typescript" : language, // Default to TS if all
64
+ // build_context is expected to include "Augment Secrets" like Git lineage
65
+ includeLineage: true,
66
+ // Respect tool args
67
+ forceRebuild,
68
+ includeTests,
69
+ maxFiles,
70
+ });
71
+ const context = orchestration.projectContext;
72
+ const intent = intentTracker.getCurrentIntent();
73
+ const elapsed = Date.now() - startTime;
74
+ const summary = generateContextSummary(context);
75
+ // Calculate recent authors from history
76
+ const recentAuthors = new Set();
77
+ if (orchestration.lineageContext) {
78
+ for (const history of orchestration.lineageContext.fileHistories.values()) {
79
+ history.authors.forEach(a => recentAuthors.add(a));
80
+ }
81
+ }
82
+ // Calculate Project Hubs (Architecture)
83
+ // We need to import impactAnalyzer first (adding to imports)
84
+ // For now, I will assume it is available or imported at top
85
+ const hubs = context.symbolGraph
86
+ ? impactAnalyzer.getProjectHubs(context.symbolGraph, 3).map(h => `${h.symbol} (${h.description})`)
87
+ : [];
88
+ // Use dynamic cache expiration if available in the context object
89
+ const cachedUntil = context.expiresAt ?
90
+ new Date(context.expiresAt).toISOString()
91
+ : new Date(Date.now() + 5 * 60 * 1000).toISOString();
92
+ return formatResponse({
93
+ success: true,
94
+ message: `Project context built successfully in ${elapsed}ms`,
95
+ data: {
96
+ summary,
97
+ stats: {
98
+ totalFiles: context.totalFiles,
99
+ totalSymbols: context.symbolIndex.size,
100
+ totalDependencies: context.dependencies.length,
101
+ externalPackages: context.externalDependencies.size,
102
+ entryPoints: context.entryPoints.length,
103
+ buildTimeMs: elapsed,
104
+ cachedUntil,
105
+ quality: orchestration.contextQuality,
106
+ },
107
+ augmentSecrets: {
108
+ hotFiles: orchestration.lineageContext?.hotspotFiles.slice(0, 5) || [],
109
+ recentAuthors: Array.from(recentAuthors).slice(0, 5),
110
+ focusedIntent: intent.recentFiles.slice(0, 5),
111
+ projectHubs: hubs,
112
+ },
113
+ frameworks: context.frameworks,
114
+ },
115
+ hint: "Context is cached. VibeGuard is now aware of your Git history and focus.",
116
+ });
117
+ }
118
+ catch (error) {
119
+ logger.error("Error building context:", error);
120
+ return formatResponse({
121
+ success: false,
122
+ error: error instanceof Error ? error.message : String(error),
123
+ });
124
+ }
125
+ },
126
+ };
127
+ /**
128
+ * Generates a structured summary of the project context.
129
+ */
130
+ function generateContextSummary(context) {
131
+ // Files by language
132
+ const filesByLanguage = {};
133
+ for (const file of context.files.values()) {
134
+ filesByLanguage[file.language] = (filesByLanguage[file.language] || 0) + 1;
135
+ }
136
+ // Symbols by kind
137
+ const symbolsByKind = {};
138
+ for (const definitions of context.symbolIndex.values()) {
139
+ for (const def of definitions) {
140
+ symbolsByKind[def.symbol.kind] =
141
+ (symbolsByKind[def.symbol.kind] || 0) + 1;
142
+ }
143
+ }
144
+ // Top imported files
145
+ const topImportedFiles = Array.from(context.reverseImportGraph.entries())
146
+ .map(([file, importers]) => ({
147
+ file: context.files.get(file)?.relativePath || file,
148
+ importedBy: importers.length,
149
+ }))
150
+ .sort((a, b) => b.importedBy - a.importedBy)
151
+ .slice(0, 10);
152
+ // Top symbols
153
+ const topSymbols = Array.from(context.symbolIndex.entries())
154
+ .filter(([_, definitions]) => definitions.length > 0)
155
+ .map(([name, definitions]) => ({ name, definedIn: definitions.length }))
156
+ .sort((a, b) => b.definedIn - a.definedIn)
157
+ .slice(0, 20);
158
+ // Directory structure
159
+ const directories = new Set();
160
+ for (const file of context.files.values()) {
161
+ const parts = file.relativePath.split("/");
162
+ if (parts.length > 1) {
163
+ directories.add(parts.slice(0, -1).join("/"));
164
+ }
165
+ }
166
+ const directoryStructure = Array.from(directories).sort().slice(0, 20);
167
+ return {
168
+ filesByLanguage,
169
+ symbolsByKind,
170
+ topImportedFiles,
171
+ topSymbols,
172
+ directoryStructure,
173
+ };
174
+ }
175
+ /**
176
+ * Formats the tool response for MCP.
177
+ */
178
+ function formatResponse(data) {
179
+ return {
180
+ content: [
181
+ {
182
+ type: "text",
183
+ text: JSON.stringify(data, null, 2),
184
+ },
185
+ ],
186
+ };
187
+ }
188
+ //# sourceMappingURL=buildContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildContext.js","sourceRoot":"","sources":["../../src/tools/buildContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAM5C,OAAO,EAAE,kBAAkB,EAAwB,MAAM,mCAAmC,CAAC;AAC7F,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAc,MAAM,gCAAgC,CAAC;AAoB5E,MAAM,CAAC,MAAM,gBAAgB,GAAmB;IAC9C,UAAU,EAAE;QACV,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,0HAA0H;QACvI,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,qCAAqC;iBACnD;gBACD,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC;oBACjE,WAAW,EAAE,iDAAiD;oBAC9D,OAAO,EAAE,KAAK;iBACf;gBACD,YAAY,EAAE;oBACZ,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,+CAA+C;oBAC5D,OAAO,EAAE,IAAI;iBACd;gBACD,YAAY,EAAE;oBACZ,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,8BAA8B;oBAC3C,OAAO,EAAE,KAAK;iBACf;gBACD,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,wCAAwC;oBACrD,OAAO,EAAE,IAAI;iBACd;aACF;YACD,QAAQ,EAAE,CAAC,aAAa,CAAC;SAC1B;KACF;IAED,KAAK,CAAC,OAAO,CAAC,IAAyB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E,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IACD,MAAM,kBAAkB,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEvE,OAAO;QACL,eAAe;QACf,aAAa;QACb,gBAAgB;QAChB,UAAU;QACV,kBAAkB;KACnB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CAAC,IAA6B;IACnD,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;aACpC;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Get Dependency Graph Tool (Improved Version)
3
+ *
4
+ * Returns the dependency graph for a file or directory.
5
+ *
6
+ * Improvements:
7
+ * 1. Refactored `findProjectRoot` for better readability and maintainability.
8
+ * 2. Improved `resolveTarget` to handle directory targets more accurately.
9
+ * 3. Centralized path normalization and handling.
10
+ * 4. Enhanced documentation and code structure.
11
+ *
12
+ * @format
13
+ */
14
+ import { ToolDefinition } from "../types/tools.js";
15
+ export declare const getDependencyGraphTool: ToolDefinition;
16
+ //# sourceMappingURL=getDependencyGraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDependencyGraph.d.ts","sourceRoot":"","sources":["../../src/tools/getDependencyGraph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA8CnD,eAAO,MAAM,sBAAsB,EAAE,cAwLpC,CAAC"}