@thoughtflow/codebase 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (278) hide show
  1. package/dist/contexts/context-decomposer.d.ts +13 -0
  2. package/dist/contexts/context-decomposer.d.ts.map +1 -0
  3. package/dist/contexts/context-decomposer.js +97 -0
  4. package/dist/contexts/context-decomposer.js.map +1 -0
  5. package/dist/contexts/context-document-manager.d.ts +21 -0
  6. package/dist/contexts/context-document-manager.d.ts.map +1 -0
  7. package/dist/contexts/context-document-manager.js +69 -0
  8. package/dist/contexts/context-document-manager.js.map +1 -0
  9. package/dist/contexts/context-router.d.ts +13 -0
  10. package/dist/contexts/context-router.d.ts.map +1 -0
  11. package/dist/contexts/context-router.js +94 -0
  12. package/dist/contexts/context-router.js.map +1 -0
  13. package/dist/index.d.ts +53 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +76 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/libs/codebase/deep-analyzer.d.ts +58 -0
  18. package/dist/libs/codebase/deep-analyzer.d.ts.map +1 -0
  19. package/dist/libs/codebase/deep-analyzer.js +239 -0
  20. package/dist/libs/codebase/deep-analyzer.js.map +1 -0
  21. package/dist/libs/codebase/graph/dependency-extractor.d.ts +20 -0
  22. package/dist/libs/codebase/graph/dependency-extractor.d.ts.map +1 -0
  23. package/dist/libs/codebase/graph/dependency-extractor.js +174 -0
  24. package/dist/libs/codebase/graph/dependency-extractor.js.map +1 -0
  25. package/dist/libs/codebase/graph/graph-analysis.d.ts +42 -0
  26. package/dist/libs/codebase/graph/graph-analysis.d.ts.map +1 -0
  27. package/dist/libs/codebase/graph/graph-analysis.js +222 -0
  28. package/dist/libs/codebase/graph/graph-analysis.js.map +1 -0
  29. package/dist/libs/codebase/graph/graph-visualizer.d.ts +12 -0
  30. package/dist/libs/codebase/graph/graph-visualizer.d.ts.map +1 -0
  31. package/dist/libs/codebase/graph/graph-visualizer.js +99 -0
  32. package/dist/libs/codebase/graph/graph-visualizer.js.map +1 -0
  33. package/dist/libs/codebase/indexer/batch-processor.d.ts +18 -0
  34. package/dist/libs/codebase/indexer/batch-processor.d.ts.map +1 -0
  35. package/dist/libs/codebase/indexer/batch-processor.js +39 -0
  36. package/dist/libs/codebase/indexer/batch-processor.js.map +1 -0
  37. package/dist/libs/codebase/indexer/chunker-markdown.d.ts +19 -0
  38. package/dist/libs/codebase/indexer/chunker-markdown.d.ts.map +1 -0
  39. package/dist/libs/codebase/indexer/chunker-markdown.js +138 -0
  40. package/dist/libs/codebase/indexer/chunker-markdown.js.map +1 -0
  41. package/dist/libs/codebase/indexer/chunker.d.ts +21 -0
  42. package/dist/libs/codebase/indexer/chunker.d.ts.map +1 -0
  43. package/dist/libs/codebase/indexer/chunker.js +133 -0
  44. package/dist/libs/codebase/indexer/chunker.js.map +1 -0
  45. package/dist/libs/codebase/indexer/explorer.d.ts +29 -0
  46. package/dist/libs/codebase/indexer/explorer.d.ts.map +1 -0
  47. package/dist/libs/codebase/indexer/explorer.js +278 -0
  48. package/dist/libs/codebase/indexer/explorer.js.map +1 -0
  49. package/dist/libs/codebase/indexer/indexer.d.ts +35 -0
  50. package/dist/libs/codebase/indexer/indexer.d.ts.map +1 -0
  51. package/dist/libs/codebase/indexer/indexer.js +172 -0
  52. package/dist/libs/codebase/indexer/indexer.js.map +1 -0
  53. package/dist/libs/codebase/knowledge/cross-referencer.d.ts +32 -0
  54. package/dist/libs/codebase/knowledge/cross-referencer.d.ts.map +1 -0
  55. package/dist/libs/codebase/knowledge/cross-referencer.js +132 -0
  56. package/dist/libs/codebase/knowledge/cross-referencer.js.map +1 -0
  57. package/dist/libs/codebase/knowledge/markdown-extractor.d.ts +34 -0
  58. package/dist/libs/codebase/knowledge/markdown-extractor.d.ts.map +1 -0
  59. package/dist/libs/codebase/knowledge/markdown-extractor.js +273 -0
  60. package/dist/libs/codebase/knowledge/markdown-extractor.js.map +1 -0
  61. package/dist/libs/codebase/knowledge/summarizer.d.ts +25 -0
  62. package/dist/libs/codebase/knowledge/summarizer.d.ts.map +1 -0
  63. package/dist/libs/codebase/knowledge/summarizer.js +61 -0
  64. package/dist/libs/codebase/knowledge/summarizer.js.map +1 -0
  65. package/dist/libs/codebase/search/bm25.d.ts +23 -0
  66. package/dist/libs/codebase/search/bm25.d.ts.map +1 -0
  67. package/dist/libs/codebase/search/bm25.js +93 -0
  68. package/dist/libs/codebase/search/bm25.js.map +1 -0
  69. package/dist/libs/codebase/search/hybrid-search.d.ts +22 -0
  70. package/dist/libs/codebase/search/hybrid-search.d.ts.map +1 -0
  71. package/dist/libs/codebase/search/hybrid-search.js +80 -0
  72. package/dist/libs/codebase/search/hybrid-search.js.map +1 -0
  73. package/dist/libs/codebase-index.class.d.ts +66 -0
  74. package/dist/libs/codebase-index.class.d.ts.map +1 -0
  75. package/dist/libs/codebase-index.class.js +595 -0
  76. package/dist/libs/codebase-index.class.js.map +1 -0
  77. package/dist/tools/codebase/codebase-analyze.tool.d.ts +8 -0
  78. package/dist/tools/codebase/codebase-analyze.tool.d.ts.map +1 -0
  79. package/dist/tools/codebase/codebase-analyze.tool.js +20 -0
  80. package/dist/tools/codebase/codebase-analyze.tool.js.map +1 -0
  81. package/dist/tools/codebase/codebase-crossref.tool.d.ts +8 -0
  82. package/dist/tools/codebase/codebase-crossref.tool.d.ts.map +1 -0
  83. package/dist/tools/codebase/codebase-crossref.tool.js +20 -0
  84. package/dist/tools/codebase/codebase-crossref.tool.js.map +1 -0
  85. package/dist/tools/codebase/codebase-flow.tool.d.ts +8 -0
  86. package/dist/tools/codebase/codebase-flow.tool.d.ts.map +1 -0
  87. package/dist/tools/codebase/codebase-flow.tool.js +20 -0
  88. package/dist/tools/codebase/codebase-flow.tool.js.map +1 -0
  89. package/dist/tools/codebase/codebase-graph-circular.tool.d.ts +8 -0
  90. package/dist/tools/codebase/codebase-graph-circular.tool.d.ts.map +1 -0
  91. package/dist/tools/codebase/codebase-graph-circular.tool.js +17 -0
  92. package/dist/tools/codebase/codebase-graph-circular.tool.js.map +1 -0
  93. package/dist/tools/codebase/codebase-graph-query.tool.d.ts +8 -0
  94. package/dist/tools/codebase/codebase-graph-query.tool.d.ts.map +1 -0
  95. package/dist/tools/codebase/codebase-graph-query.tool.js +21 -0
  96. package/dist/tools/codebase/codebase-graph-query.tool.js.map +1 -0
  97. package/dist/tools/codebase/codebase-graph-stats.tool.d.ts +8 -0
  98. package/dist/tools/codebase/codebase-graph-stats.tool.d.ts.map +1 -0
  99. package/dist/tools/codebase/codebase-graph-stats.tool.js +17 -0
  100. package/dist/tools/codebase/codebase-graph-stats.tool.js.map +1 -0
  101. package/dist/tools/codebase/codebase-graph-visualize.tool.d.ts +8 -0
  102. package/dist/tools/codebase/codebase-graph-visualize.tool.d.ts.map +1 -0
  103. package/dist/tools/codebase/codebase-graph-visualize.tool.js +21 -0
  104. package/dist/tools/codebase/codebase-graph-visualize.tool.js.map +1 -0
  105. package/dist/tools/codebase/codebase-impact.tool.d.ts +8 -0
  106. package/dist/tools/codebase/codebase-impact.tool.d.ts.map +1 -0
  107. package/dist/tools/codebase/codebase-impact.tool.js +21 -0
  108. package/dist/tools/codebase/codebase-impact.tool.js.map +1 -0
  109. package/dist/tools/codebase/codebase-index.tool.d.ts +8 -0
  110. package/dist/tools/codebase/codebase-index.tool.d.ts.map +1 -0
  111. package/dist/tools/codebase/codebase-index.tool.js +21 -0
  112. package/dist/tools/codebase/codebase-index.tool.js.map +1 -0
  113. package/dist/tools/codebase/codebase-knowledge.tool.d.ts +8 -0
  114. package/dist/tools/codebase/codebase-knowledge.tool.d.ts.map +1 -0
  115. package/dist/tools/codebase/codebase-knowledge.tool.js +22 -0
  116. package/dist/tools/codebase/codebase-knowledge.tool.js.map +1 -0
  117. package/dist/tools/codebase/codebase-search.tool.d.ts +8 -0
  118. package/dist/tools/codebase/codebase-search.tool.d.ts.map +1 -0
  119. package/dist/tools/codebase/codebase-search.tool.js +24 -0
  120. package/dist/tools/codebase/codebase-search.tool.js.map +1 -0
  121. package/dist/tools/codebase/codebase-status.tool.d.ts +8 -0
  122. package/dist/tools/codebase/codebase-status.tool.d.ts.map +1 -0
  123. package/dist/tools/codebase/codebase-status.tool.js +19 -0
  124. package/dist/tools/codebase/codebase-status.tool.js.map +1 -0
  125. package/dist/tools/neural/comparative-analysis.tool.d.ts +37 -0
  126. package/dist/tools/neural/comparative-analysis.tool.d.ts.map +1 -0
  127. package/dist/tools/neural/comparative-analysis.tool.js +241 -0
  128. package/dist/tools/neural/comparative-analysis.tool.js.map +1 -0
  129. package/dist/tools/neural/index.d.ts +12 -0
  130. package/dist/tools/neural/index.d.ts.map +1 -0
  131. package/dist/tools/neural/index.js +28 -0
  132. package/dist/tools/neural/index.js.map +1 -0
  133. package/dist/tools/neural/neural-deadcode.tool.d.ts +10 -0
  134. package/dist/tools/neural/neural-deadcode.tool.d.ts.map +1 -0
  135. package/dist/tools/neural/neural-deadcode.tool.js +133 -0
  136. package/dist/tools/neural/neural-deadcode.tool.js.map +1 -0
  137. package/dist/tools/neural/neural-debug.tool.d.ts +11 -0
  138. package/dist/tools/neural/neural-debug.tool.d.ts.map +1 -0
  139. package/dist/tools/neural/neural-debug.tool.js +205 -0
  140. package/dist/tools/neural/neural-debug.tool.js.map +1 -0
  141. package/dist/tools/neural/neural-explain.tool.d.ts +9 -0
  142. package/dist/tools/neural/neural-explain.tool.d.ts.map +1 -0
  143. package/dist/tools/neural/neural-explain.tool.js +100 -0
  144. package/dist/tools/neural/neural-explain.tool.js.map +1 -0
  145. package/dist/tools/neural/neural-optimize.tool.d.ts +9 -0
  146. package/dist/tools/neural/neural-optimize.tool.d.ts.map +1 -0
  147. package/dist/tools/neural/neural-optimize.tool.js +117 -0
  148. package/dist/tools/neural/neural-optimize.tool.js.map +1 -0
  149. package/dist/tools/neural/neural-pattern.tool.d.ts +10 -0
  150. package/dist/tools/neural/neural-pattern.tool.d.ts.map +1 -0
  151. package/dist/tools/neural/neural-pattern.tool.js +169 -0
  152. package/dist/tools/neural/neural-pattern.tool.js.map +1 -0
  153. package/dist/tools/neural/neural-review.tool.d.ts +11 -0
  154. package/dist/tools/neural/neural-review.tool.d.ts.map +1 -0
  155. package/dist/tools/neural/neural-review.tool.js +152 -0
  156. package/dist/tools/neural/neural-review.tool.js.map +1 -0
  157. package/dist/tools/neural/neural-security.tool.d.ts +16 -0
  158. package/dist/tools/neural/neural-security.tool.d.ts.map +1 -0
  159. package/dist/tools/neural/neural-security.tool.js +256 -0
  160. package/dist/tools/neural/neural-security.tool.js.map +1 -0
  161. package/dist/tools/neural/neural-similar.tool.d.ts +9 -0
  162. package/dist/tools/neural/neural-similar.tool.d.ts.map +1 -0
  163. package/dist/tools/neural/neural-similar.tool.js +139 -0
  164. package/dist/tools/neural/neural-similar.tool.js.map +1 -0
  165. package/dist/tools/neural/neural-smells.tool.d.ts +9 -0
  166. package/dist/tools/neural/neural-smells.tool.d.ts.map +1 -0
  167. package/dist/tools/neural/neural-smells.tool.js +123 -0
  168. package/dist/tools/neural/neural-smells.tool.js.map +1 -0
  169. package/dist/tools/neural/neural-suggest.tool.d.ts +9 -0
  170. package/dist/tools/neural/neural-suggest.tool.d.ts.map +1 -0
  171. package/dist/tools/neural/neural-suggest.tool.js +64 -0
  172. package/dist/tools/neural/neural-suggest.tool.js.map +1 -0
  173. package/dist/tools/quality/index.d.ts +8 -0
  174. package/dist/tools/quality/index.d.ts.map +1 -0
  175. package/dist/tools/quality/index.js +24 -0
  176. package/dist/tools/quality/index.js.map +1 -0
  177. package/dist/tools/quality/quality-complexity.tool.d.ts +11 -0
  178. package/dist/tools/quality/quality-complexity.tool.d.ts.map +1 -0
  179. package/dist/tools/quality/quality-complexity.tool.js +152 -0
  180. package/dist/tools/quality/quality-complexity.tool.js.map +1 -0
  181. package/dist/tools/quality/quality-coupling.tool.d.ts +9 -0
  182. package/dist/tools/quality/quality-coupling.tool.d.ts.map +1 -0
  183. package/dist/tools/quality/quality-coupling.tool.js +51 -0
  184. package/dist/tools/quality/quality-coupling.tool.js.map +1 -0
  185. package/dist/tools/quality/quality-coverage.tool.d.ts +9 -0
  186. package/dist/tools/quality/quality-coverage.tool.d.ts.map +1 -0
  187. package/dist/tools/quality/quality-coverage.tool.js +104 -0
  188. package/dist/tools/quality/quality-coverage.tool.js.map +1 -0
  189. package/dist/tools/quality/quality-deps.tool.d.ts +11 -0
  190. package/dist/tools/quality/quality-deps.tool.d.ts.map +1 -0
  191. package/dist/tools/quality/quality-deps.tool.js +119 -0
  192. package/dist/tools/quality/quality-deps.tool.js.map +1 -0
  193. package/dist/tools/quality/quality-duplication.tool.d.ts +9 -0
  194. package/dist/tools/quality/quality-duplication.tool.d.ts.map +1 -0
  195. package/dist/tools/quality/quality-duplication.tool.js +100 -0
  196. package/dist/tools/quality/quality-duplication.tool.js.map +1 -0
  197. package/dist/tools/quality/quality-size.tool.d.ts +9 -0
  198. package/dist/tools/quality/quality-size.tool.d.ts.map +1 -0
  199. package/dist/tools/quality/quality-size.tool.js +94 -0
  200. package/dist/tools/quality/quality-size.tool.js.map +1 -0
  201. package/dist/tools/quality/quality-types.tool.d.ts +9 -0
  202. package/dist/tools/quality/quality-types.tool.d.ts.map +1 -0
  203. package/dist/tools/quality/quality-types.tool.js +95 -0
  204. package/dist/tools/quality/quality-types.tool.js.map +1 -0
  205. package/dist/tools/workspace/analyze-project.tool.d.ts +36 -0
  206. package/dist/tools/workspace/analyze-project.tool.d.ts.map +1 -0
  207. package/dist/tools/workspace/analyze-project.tool.js +454 -0
  208. package/dist/tools/workspace/analyze-project.tool.js.map +1 -0
  209. package/dist/tools/workspace/codebase-research.tool.d.ts +10 -0
  210. package/dist/tools/workspace/codebase-research.tool.d.ts.map +1 -0
  211. package/dist/tools/workspace/codebase-research.tool.js +89 -0
  212. package/dist/tools/workspace/codebase-research.tool.js.map +1 -0
  213. package/dist/tools/workspace/project-scanner.tool.d.ts +55 -0
  214. package/dist/tools/workspace/project-scanner.tool.d.ts.map +1 -0
  215. package/dist/tools/workspace/project-scanner.tool.js +978 -0
  216. package/dist/tools/workspace/project-scanner.tool.js.map +1 -0
  217. package/dist/tools/workspace/search-code.tool.d.ts +14 -0
  218. package/dist/tools/workspace/search-code.tool.d.ts.map +1 -0
  219. package/dist/tools/workspace/search-code.tool.js +286 -0
  220. package/dist/tools/workspace/search-code.tool.js.map +1 -0
  221. package/package.json +17 -0
  222. package/src/contexts/context-decomposer.ts +113 -0
  223. package/src/contexts/context-document-manager.ts +70 -0
  224. package/src/contexts/context-router.ts +121 -0
  225. package/src/index.ts +65 -0
  226. package/src/libs/codebase/deep-analyzer.ts +287 -0
  227. package/src/libs/codebase/graph/dependency-extractor.ts +165 -0
  228. package/src/libs/codebase/graph/graph-analysis.ts +231 -0
  229. package/src/libs/codebase/graph/graph-visualizer.ts +124 -0
  230. package/src/libs/codebase/indexer/batch-processor.ts +47 -0
  231. package/src/libs/codebase/indexer/chunker-markdown.ts +175 -0
  232. package/src/libs/codebase/indexer/chunker.ts +126 -0
  233. package/src/libs/codebase/indexer/explorer.ts +269 -0
  234. package/src/libs/codebase/indexer/indexer.ts +174 -0
  235. package/src/libs/codebase/knowledge/cross-referencer.ts +182 -0
  236. package/src/libs/codebase/knowledge/markdown-extractor.ts +270 -0
  237. package/src/libs/codebase/knowledge/summarizer.ts +85 -0
  238. package/src/libs/codebase/search/bm25.ts +109 -0
  239. package/src/libs/codebase/search/hybrid-search.ts +109 -0
  240. package/src/libs/codebase-index.class.ts +715 -0
  241. package/src/tools/codebase/codebase-analyze.tool.ts +18 -0
  242. package/src/tools/codebase/codebase-crossref.tool.ts +18 -0
  243. package/src/tools/codebase/codebase-flow.tool.ts +18 -0
  244. package/src/tools/codebase/codebase-graph-circular.tool.ts +15 -0
  245. package/src/tools/codebase/codebase-graph-query.tool.ts +19 -0
  246. package/src/tools/codebase/codebase-graph-stats.tool.ts +15 -0
  247. package/src/tools/codebase/codebase-graph-visualize.tool.ts +19 -0
  248. package/src/tools/codebase/codebase-impact.tool.ts +19 -0
  249. package/src/tools/codebase/codebase-index.tool.ts +19 -0
  250. package/src/tools/codebase/codebase-knowledge.tool.ts +20 -0
  251. package/src/tools/codebase/codebase-search.tool.ts +22 -0
  252. package/src/tools/codebase/codebase-status.tool.ts +17 -0
  253. package/src/tools/neural/comparative-analysis.tool.ts +309 -0
  254. package/src/tools/neural/index.ts +11 -0
  255. package/src/tools/neural/neural-deadcode.tool.ts +105 -0
  256. package/src/tools/neural/neural-debug.tool.ts +199 -0
  257. package/src/tools/neural/neural-explain.tool.ts +67 -0
  258. package/src/tools/neural/neural-optimize.tool.ts +93 -0
  259. package/src/tools/neural/neural-pattern.tool.ts +141 -0
  260. package/src/tools/neural/neural-review.tool.ts +145 -0
  261. package/src/tools/neural/neural-security.tool.ts +226 -0
  262. package/src/tools/neural/neural-similar.tool.ts +113 -0
  263. package/src/tools/neural/neural-smells.tool.ts +98 -0
  264. package/src/tools/neural/neural-suggest.tool.ts +65 -0
  265. package/src/tools/quality/index.ts +7 -0
  266. package/src/tools/quality/quality-complexity.tool.ts +132 -0
  267. package/src/tools/quality/quality-coupling.tool.ts +57 -0
  268. package/src/tools/quality/quality-coverage.tool.ts +78 -0
  269. package/src/tools/quality/quality-deps.tool.ts +89 -0
  270. package/src/tools/quality/quality-duplication.tool.ts +71 -0
  271. package/src/tools/quality/quality-size.tool.ts +66 -0
  272. package/src/tools/quality/quality-types.tool.ts +66 -0
  273. package/src/tools/workspace/analyze-project.tool.ts +429 -0
  274. package/src/tools/workspace/codebase-research.tool.ts +100 -0
  275. package/src/tools/workspace/project-scanner.tool.ts +1058 -0
  276. package/src/tools/workspace/search-code.tool.ts +344 -0
  277. package/tsconfig.build.json +12 -0
  278. package/tsconfig.json +9 -0
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.QualityTypesTool = void 0;
37
+ const zod_1 = require("zod");
38
+ const core_1 = require("@thoughtflow/core");
39
+ const explorer_1 = require("../../libs/codebase/indexer/explorer");
40
+ const fs = __importStar(require("node:fs"));
41
+ class QualityTypesTool extends core_1.ToolBase {
42
+ name = "qualityTypes";
43
+ description = "TypeScript strictness audit. Finds files missing type annotations, using 'any', @ts-ignore directives, implicit return types, and untyped parameters.";
44
+ readonly = true;
45
+ constructor() {
46
+ super(zod_1.z.object({
47
+ projectPath: zod_1.z.string().optional(),
48
+ }));
49
+ }
50
+ async run(input, _ctx) {
51
+ const rootPath = input.projectPath ?? process.cwd();
52
+ const explorer = new explorer_1.CodebaseExplorer();
53
+ const files = explorer.explore({ rootPath })
54
+ .filter((f) => f.extension === ".ts" || f.extension === ".tsx");
55
+ const stats = { totalFiles: files.length, anyUsages: 0, tsIgnores: 0, typeAssertions: 0, untypedFunctions: 0, untypedParams: 0 };
56
+ const fileReports = [];
57
+ for (const file of files) {
58
+ const content = fs.readFileSync(file.absolutePath, "utf8");
59
+ const anyCount = (content.match(/\bany\b/g) || []).length;
60
+ const tsIgnores = (content.match(/@ts-ignore/g) || []).length;
61
+ const asAssertions = (content.match(/\bas\s+\w+/g) || []).length;
62
+ const issues = [];
63
+ if (anyCount > 0)
64
+ issues.push(`${anyCount} 'any' usages`);
65
+ if (tsIgnores > 0)
66
+ issues.push(`${tsIgnores} @ts-ignore directives`);
67
+ if (asAssertions > 5)
68
+ issues.push(`${asAssertions} type assertions`);
69
+ const lines = content.split("\n");
70
+ for (let i = 0; i < lines.length; i++) {
71
+ const fnMatch = lines[i].match(/(?:function|const\s+\w+\s*=\s*(?:async\s*)?)\s*\w*\s*\(([^)]*)\)\s*(?!:)/);
72
+ if (fnMatch && !lines[i].includes(":") && !lines[i].includes("=>")) {
73
+ stats.untypedParams++;
74
+ }
75
+ }
76
+ if (issues.length > 0) {
77
+ stats.anyUsages += anyCount;
78
+ stats.tsIgnores += tsIgnores;
79
+ stats.typeAssertions += asAssertions;
80
+ fileReports.push({ file: file.relativePath, anyCount, tsIgnores, asAssertions, issues });
81
+ }
82
+ }
83
+ fileReports.sort((a, b) => b.anyCount - a.anyCount);
84
+ return {
85
+ success: true,
86
+ output: JSON.stringify({
87
+ stats,
88
+ typeQualityScore: files.length > 0 ? Math.max(0, 100 - (stats.anyUsages * 2 + stats.tsIgnores * 5 + stats.typeAssertions)) : 100,
89
+ worstFiles: fileReports.slice(0, 15),
90
+ }),
91
+ };
92
+ }
93
+ }
94
+ exports.QualityTypesTool = QualityTypesTool;
95
+ //# sourceMappingURL=quality-types.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quality-types.tool.js","sourceRoot":"","sources":["../../../src/tools/quality/quality-types.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;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AAC,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC;YAC3F,CAAC;QACH,CAAC;QAED,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;QAEpD,OAAO;YACL,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC;gBACrB,KAAK;gBACL,gBAAgB,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,GAAG,KAAK,CAAC,SAAS,GAAG,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;gBAChI,UAAU,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;aACrC,CAAC;SACH,CAAC;IACJ,CAAC;CACF;AA5DD,4CA4DC"}
@@ -0,0 +1,36 @@
1
+ import { ToolBase, ToolContext, ToolExecutionResult, KnowledgeGraph } from "@thoughtflow/core";
2
+ /** Depth levels for project analysis. */
3
+ export type AnalysisDepth = "shallow" | "standard" | "deep";
4
+ export interface ProjectAnalysisResult {
5
+ language: string | null;
6
+ framework: string | null;
7
+ testFramework: string | null;
8
+ entryPoints: string[];
9
+ dependencies: string[];
10
+ devDependencies: string[];
11
+ dockerized: boolean;
12
+ ports: number[];
13
+ cicd: string[];
14
+ structure?: string;
15
+ httpEndpoints?: string[];
16
+ exports?: string[];
17
+ configFiles: string[];
18
+ }
19
+ export declare class AnalyzeProjectTool extends ToolBase {
20
+ private readonly rootDir;
21
+ private readonly knowledgeGraph?;
22
+ readonly name = "analyzeProject";
23
+ readonly readonly = true;
24
+ readonly description: string;
25
+ constructor(rootDir: string, knowledgeGraph?: KnowledgeGraph);
26
+ run(input: Record<string, unknown>, _ctx: ToolContext): Promise<ToolExecutionResult>;
27
+ /** Build an ASCII directory tree skipping SKIP_DIRS, up to maxDepth. */
28
+ private buildTree;
29
+ /** Scan TS/JS files for route definitions like router.get('/...'), @Get('/...'). */
30
+ private extractHttpEndpoints;
31
+ /** Scan TS/JS index files for named exports. */
32
+ private extractExports;
33
+ /** Build knowledge graph nodes and edges from project analysis. */
34
+ private buildKnowledgeGraph;
35
+ }
36
+ //# sourceMappingURL=analyze-project.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyze-project.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/workspace/analyze-project.tool.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,mBAAmB,EAAE,cAAc,EAAmB,MAAM,mBAAmB,CAAC;AAEhH,yCAAyC;AACzC,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,CAAC;AAmC5D,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,qBAAa,kBAAmB,SAAQ,QAAQ;IAUlC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAAU,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;IAT9E,QAAQ,CAAC,IAAI,oBAAoB;IACjC,SAAkB,QAAQ,QAAQ;IAClC,QAAQ,CAAC,WAAW,SAK4E;gBAEnE,OAAO,EAAE,MAAM,EAAmB,cAAc,CAAC,EAAE,cAAc;IAWxF,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAiL1F,wEAAwE;IACxE,OAAO,CAAC,SAAS;IAwBjB,oFAAoF;IACpF,OAAO,CAAC,oBAAoB;IAgC5B,gDAAgD;IAChD,OAAO,CAAC,cAAc;IA8BtB,mEAAmE;YACrD,mBAAmB;CAmFlC"}
@@ -0,0 +1,454 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.AnalyzeProjectTool = void 0;
37
+ const zod_1 = require("zod");
38
+ const fs = __importStar(require("fs"));
39
+ const path = __importStar(require("path"));
40
+ const core_1 = require("@thoughtflow/core");
41
+ /** Directories always skipped during scanning. */
42
+ const SKIP_DIRS = new Set([
43
+ "node_modules",
44
+ "vendor",
45
+ "dist",
46
+ "build",
47
+ ".git",
48
+ "coverage",
49
+ "__pycache__",
50
+ ".next",
51
+ "target",
52
+ ".turbo",
53
+ ".cache",
54
+ "out",
55
+ ".svelte-kit",
56
+ ]);
57
+ /** Config files used to identify project characteristics. */
58
+ const CONFIG_FILES = [
59
+ { file: "package.json", key: "packageJson" },
60
+ { file: "tsconfig.json", key: "tsconfig" },
61
+ { file: "nest-cli.json", key: "nestCli" },
62
+ { file: "docker-compose.yml", key: "dockerCompose" },
63
+ { file: "docker-compose.yaml", key: "dockerCompose" },
64
+ { file: "Cargo.toml", key: "cargoToml" },
65
+ { file: "pyproject.toml", key: "pyprojectToml" },
66
+ { file: "go.mod", key: "goMod" },
67
+ { file: ".eslintrc.json", key: "eslint" },
68
+ { file: "jest.config.ts", key: "jestConfig" },
69
+ { file: "jest.config.js", key: "jestConfig" },
70
+ { file: "vitest.config.ts", key: "vitestConfig" },
71
+ ];
72
+ class AnalyzeProjectTool extends core_1.ToolBase {
73
+ rootDir;
74
+ knowledgeGraph;
75
+ name = "analyzeProject";
76
+ readonly = true;
77
+ description = "Analyse an existing project to determine its language, framework, test framework, entry points, " +
78
+ "dependencies, Docker setup, and (in deep mode) HTTP endpoints and API exports. " +
79
+ "Depth: 'shallow' = config files only; 'standard' = config + directory tree up to depth 3 (default); " +
80
+ "'deep' = standard + HTTP endpoint and export extraction. " +
81
+ "Always skips node_modules, vendor, dist, build, .git, coverage, __pycache__, .next, target.";
82
+ constructor(rootDir, knowledgeGraph) {
83
+ super(zod_1.z.object({
84
+ path: zod_1.z.string().optional().describe("Subdirectory to analyse (relative to rootDir). Defaults to rootDir."),
85
+ depth: zod_1.z.enum(["shallow", "standard", "deep"]).optional().describe("Analysis depth: 'shallow' (config files only), 'standard' (default; + directory tree ≤3 deep), 'deep' (+ HTTP endpoints and exports)"),
86
+ }));
87
+ this.rootDir = rootDir;
88
+ this.knowledgeGraph = knowledgeGraph;
89
+ }
90
+ async run(input, _ctx) {
91
+ const depth = (input["depth"] ?? "standard");
92
+ const relPath = input["path"] ?? ".";
93
+ const analysisRoot = (0, core_1.resolveSafePath)(this.rootDir, relPath);
94
+ if (!analysisRoot) {
95
+ return { success: false, error: "Path traversal not allowed." };
96
+ }
97
+ if (!fs.existsSync(analysisRoot)) {
98
+ return { success: false, error: `Directory not found: ${relPath}` };
99
+ }
100
+ const result = {
101
+ language: null,
102
+ framework: null,
103
+ testFramework: null,
104
+ entryPoints: [],
105
+ dependencies: [],
106
+ devDependencies: [],
107
+ dockerized: false,
108
+ ports: [],
109
+ cicd: [],
110
+ configFiles: [],
111
+ };
112
+ // ── Read config files ──────────────────────────────────────────────────
113
+ const configs = {};
114
+ for (const { file, key } of CONFIG_FILES) {
115
+ const fullPath = path.join(analysisRoot, file);
116
+ if (fs.existsSync(fullPath)) {
117
+ result.configFiles.push(file);
118
+ try {
119
+ const raw = fs.readFileSync(fullPath, "utf-8");
120
+ if (file.endsWith(".json") || file.endsWith(".toml")) {
121
+ configs[key] = file.endsWith(".json") ? JSON.parse(raw) : raw;
122
+ }
123
+ else {
124
+ configs[key] = raw;
125
+ }
126
+ }
127
+ catch {
128
+ // parse error — keep the filename in configFiles but skip data
129
+ }
130
+ }
131
+ }
132
+ // ── Language + Framework detection ────────────────────────────────────
133
+ const pkg = configs["packageJson"];
134
+ const deps = {
135
+ ...(pkg?.["dependencies"] ?? {}),
136
+ };
137
+ const devDeps = {
138
+ ...(pkg?.["devDependencies"] ?? {}),
139
+ };
140
+ if (pkg) {
141
+ result.language = "javascript";
142
+ if (configs["tsconfig"] || devDeps["typescript"] || devDeps["ts-node"]) {
143
+ result.language = "typescript";
144
+ }
145
+ result.dependencies = Object.keys(deps);
146
+ result.devDependencies = Object.keys(devDeps);
147
+ // Framework
148
+ if (deps["@nestjs/core"] || deps["@nestjs/common"]) {
149
+ result.framework = "nestjs";
150
+ }
151
+ else if (deps["express"]) {
152
+ result.framework = "express";
153
+ }
154
+ else if (deps["fastify"]) {
155
+ result.framework = "fastify";
156
+ }
157
+ else if (deps["next"]) {
158
+ result.framework = "nextjs";
159
+ }
160
+ else if (deps["react"]) {
161
+ result.framework = "react";
162
+ }
163
+ else if (deps["vue"]) {
164
+ result.framework = "vue";
165
+ }
166
+ else if (deps["svelte"] || deps["@sveltejs/kit"]) {
167
+ result.framework = "svelte";
168
+ }
169
+ else if (deps["hono"]) {
170
+ result.framework = "hono";
171
+ }
172
+ // Test framework
173
+ if (devDeps["jest"] || deps["jest"]) {
174
+ result.testFramework = "jest";
175
+ }
176
+ else if (devDeps["vitest"] || deps["vitest"]) {
177
+ result.testFramework = "vitest";
178
+ }
179
+ else if (devDeps["mocha"] || deps["mocha"]) {
180
+ result.testFramework = "mocha";
181
+ }
182
+ else if (devDeps["@playwright/test"]) {
183
+ result.testFramework = "playwright";
184
+ }
185
+ // Entry points from package.json scripts
186
+ const scripts = (pkg["scripts"] ?? {});
187
+ const mainField = pkg["main"];
188
+ if (mainField)
189
+ result.entryPoints.push(mainField);
190
+ const startScript = scripts["start"] ?? scripts["dev"] ?? scripts["serve"];
191
+ if (startScript && result.entryPoints.length === 0) {
192
+ result.entryPoints.push(`script:start → ${startScript}`);
193
+ }
194
+ }
195
+ if (configs["cargoToml"]) {
196
+ result.language = "rust";
197
+ }
198
+ if (configs["pyprojectToml"]) {
199
+ result.language = "python";
200
+ }
201
+ if (configs["goMod"]) {
202
+ result.language = "go";
203
+ }
204
+ // ── Docker / CI ────────────────────────────────────────────────────────
205
+ if (configs["dockerCompose"]) {
206
+ result.dockerized = true;
207
+ // extract exposed ports
208
+ const composeRaw = configs["dockerCompose"];
209
+ const portMatches = composeRaw.matchAll(/["']?(\d{2,5}):(\d{2,5})["']?/g);
210
+ const portSet = new Set();
211
+ for (const m of portMatches) {
212
+ const p = Number(m[2]);
213
+ if (p > 0 && p < 65536)
214
+ portSet.add(p);
215
+ }
216
+ result.ports = Array.from(portSet);
217
+ }
218
+ if (fs.existsSync(path.join(analysisRoot, "Dockerfile"))) {
219
+ result.dockerized = true;
220
+ }
221
+ const ciFiles = [
222
+ ".github/workflows",
223
+ ".gitlab-ci.yml",
224
+ ".circleci/config.yml",
225
+ "Jenkinsfile",
226
+ ".travis.yml",
227
+ "azure-pipelines.yml",
228
+ ".drone.yml",
229
+ ];
230
+ for (const f of ciFiles) {
231
+ const full = path.join(analysisRoot, f);
232
+ if (fs.existsSync(full)) {
233
+ result.cicd.push(f);
234
+ }
235
+ }
236
+ // ── Directory structure (standard+deep) ───────────────────────────────
237
+ if (depth !== "shallow") {
238
+ result.structure = this.buildTree(analysisRoot, analysisRoot, 0, 3);
239
+ }
240
+ // ── Deep analysis: HTTP endpoints + exports ───────────────────────────
241
+ if (depth === "deep") {
242
+ result.httpEndpoints = this.extractHttpEndpoints(analysisRoot);
243
+ result.exports = this.extractExports(analysisRoot);
244
+ }
245
+ // ── Build knowledge graph (if available) ─────────────────────────────
246
+ if (this.knowledgeGraph) {
247
+ await this.buildKnowledgeGraph(result, analysisRoot);
248
+ }
249
+ const summary = `language: ${result.language ?? "unknown"}\n` +
250
+ `framework: ${result.framework ?? "none"}\n` +
251
+ `testFramework: ${result.testFramework ?? "none"}\n` +
252
+ `entryPoints: ${result.entryPoints.join(", ") || "none"}\n` +
253
+ `dependencies (${result.dependencies.length}): ${result.dependencies.slice(0, 20).join(", ")}${result.dependencies.length > 20 ? "…" : ""}\n` +
254
+ `devDependencies (${result.devDependencies.length}): ${result.devDependencies.slice(0, 20).join(", ")}${result.devDependencies.length > 20 ? "…" : ""}\n` +
255
+ `dockerized: ${result.dockerized}\n` +
256
+ `ports: ${result.ports.join(", ") || "none"}\n` +
257
+ `cicd: ${result.cicd.join(", ") || "none"}\n` +
258
+ `configFiles: ${result.configFiles.join(", ") || "none"}\n` +
259
+ (result.structure ? `\nStructure:\n${result.structure}` : "") +
260
+ (result.httpEndpoints ? `\nHTTP endpoints (${result.httpEndpoints.length}): ${result.httpEndpoints.slice(0, 30).join(", ")}` : "") +
261
+ (result.exports ? `\nExports (${result.exports.length}): ${result.exports.slice(0, 30).join(", ")}` : "");
262
+ return { success: true, output: summary, data: result };
263
+ }
264
+ /** Build an ASCII directory tree skipping SKIP_DIRS, up to maxDepth. */
265
+ buildTree(root, dir, currentDepth, maxDepth) {
266
+ if (currentDepth > maxDepth)
267
+ return "";
268
+ let entries;
269
+ try {
270
+ entries = fs.readdirSync(dir, { withFileTypes: true });
271
+ }
272
+ catch {
273
+ return "";
274
+ }
275
+ const lines = [];
276
+ const indent = " ".repeat(currentDepth);
277
+ for (const entry of entries) {
278
+ if (SKIP_DIRS.has(entry.name))
279
+ continue;
280
+ if (entry.isDirectory()) {
281
+ lines.push(`${indent}${entry.name}/`);
282
+ if (currentDepth < maxDepth) {
283
+ lines.push(this.buildTree(root, path.join(dir, entry.name), currentDepth + 1, maxDepth));
284
+ }
285
+ }
286
+ else {
287
+ lines.push(`${indent}${entry.name}`);
288
+ }
289
+ }
290
+ return lines.filter(Boolean).join("\n");
291
+ }
292
+ /** Scan TS/JS files for route definitions like router.get('/...'), @Get('/...'). */
293
+ extractHttpEndpoints(dir) {
294
+ const endpoints = [];
295
+ const routeRegex = /\.(get|post|put|patch|delete)\s*\(\s*['"`]([^'"`]+)['"`]/gi;
296
+ const decoratorRegex = /@(Get|Post|Put|Patch|Delete|All)\s*\(\s*['"`]([^'"`]*)['"`]/g;
297
+ const walk = (d) => {
298
+ if (endpoints.length > 100)
299
+ return;
300
+ let entries;
301
+ try {
302
+ entries = fs.readdirSync(d, { withFileTypes: true });
303
+ }
304
+ catch {
305
+ return;
306
+ }
307
+ for (const entry of entries) {
308
+ if (SKIP_DIRS.has(entry.name))
309
+ continue;
310
+ const full = path.join(d, entry.name);
311
+ if (entry.isDirectory()) {
312
+ walk(full);
313
+ }
314
+ else if (entry.isFile() && /\.(ts|js|tsx|jsx)$/.test(entry.name)) {
315
+ let src;
316
+ try {
317
+ src = fs.readFileSync(full, "utf-8");
318
+ }
319
+ catch {
320
+ continue;
321
+ }
322
+ for (const m of src.matchAll(routeRegex)) {
323
+ endpoints.push(`${m[1].toUpperCase()} ${m[2]}`);
324
+ }
325
+ for (const m of src.matchAll(decoratorRegex)) {
326
+ endpoints.push(`${m[1].toUpperCase()} ${m[2] || "/"}`);
327
+ }
328
+ }
329
+ }
330
+ };
331
+ walk(dir);
332
+ return [...new Set(endpoints)];
333
+ }
334
+ /** Scan TS/JS index files for named exports. */
335
+ extractExports(dir) {
336
+ const exports = [];
337
+ const exportRegex = /export\s+(?:(?:default\s+)?(?:class|function|const|let|var|type|interface|enum)\s+)?(\w+)/g;
338
+ const walk = (d, depth) => {
339
+ if (exports.length > 200 || depth > 5)
340
+ return;
341
+ let entries;
342
+ try {
343
+ entries = fs.readdirSync(d, { withFileTypes: true });
344
+ }
345
+ catch {
346
+ return;
347
+ }
348
+ for (const entry of entries) {
349
+ if (SKIP_DIRS.has(entry.name))
350
+ continue;
351
+ const full = path.join(d, entry.name);
352
+ if (entry.isDirectory()) {
353
+ walk(full, depth + 1);
354
+ }
355
+ else if (entry.isFile() && /\.(ts|tsx)$/.test(entry.name) && !entry.name.endsWith(".d.ts")) {
356
+ let src;
357
+ try {
358
+ src = fs.readFileSync(full, "utf-8");
359
+ }
360
+ catch {
361
+ continue;
362
+ }
363
+ for (const m of src.matchAll(exportRegex)) {
364
+ if (m[1] && m[1] !== "from" && m[1] !== "default") {
365
+ exports.push(m[1]);
366
+ }
367
+ }
368
+ }
369
+ }
370
+ };
371
+ walk(dir, 0);
372
+ return [...new Set(exports)];
373
+ }
374
+ /** Build knowledge graph nodes and edges from project analysis. */
375
+ async buildKnowledgeGraph(result, analysisRoot) {
376
+ if (!this.knowledgeGraph)
377
+ return;
378
+ // Create project root node
379
+ const projectNode = await this.knowledgeGraph.addNode({
380
+ type: "module",
381
+ name: path.basename(analysisRoot),
382
+ description: `Project root: ${result.language} ${result.framework} application`,
383
+ source: "code",
384
+ sourceFile: ".",
385
+ confidence: 1.0,
386
+ tags: ["project", "root"],
387
+ metadata: {
388
+ language: result.language,
389
+ framework: result.framework,
390
+ testFramework: result.testFramework,
391
+ dockerized: result.dockerized,
392
+ },
393
+ });
394
+ // Create dependency nodes and edges
395
+ for (const dep of result.dependencies) {
396
+ const depNode = await this.knowledgeGraph.addNode({
397
+ type: "dependency",
398
+ name: dep,
399
+ description: `NPM dependency: ${dep}`,
400
+ source: "code",
401
+ sourceFile: "package.json",
402
+ confidence: 1.0,
403
+ tags: ["dependency", "npm"],
404
+ });
405
+ await this.knowledgeGraph.addEdge({
406
+ fromId: projectNode.id,
407
+ toId: depNode.id,
408
+ type: "depends_on",
409
+ confidence: 1.0,
410
+ evidence: "Listed in package.json dependencies",
411
+ });
412
+ }
413
+ // Create entry point nodes
414
+ for (const entry of result.entryPoints) {
415
+ const entryNode = await this.knowledgeGraph.addNode({
416
+ type: "service",
417
+ name: entry,
418
+ description: `Application entry point: ${entry}`,
419
+ source: "code",
420
+ sourceFile: entry,
421
+ confidence: 1.0,
422
+ tags: ["entry-point"],
423
+ });
424
+ await this.knowledgeGraph.addEdge({
425
+ fromId: projectNode.id,
426
+ toId: entryNode.id,
427
+ type: "contains",
428
+ confidence: 1.0,
429
+ evidence: "Defined as entry point in package.json",
430
+ });
431
+ }
432
+ // Create config file nodes
433
+ for (const configFile of result.configFiles) {
434
+ const configNode = await this.knowledgeGraph.addNode({
435
+ type: "module",
436
+ name: configFile,
437
+ description: `Configuration file: ${configFile}`,
438
+ source: "code",
439
+ sourceFile: configFile,
440
+ confidence: 1.0,
441
+ tags: ["config"],
442
+ });
443
+ await this.knowledgeGraph.addEdge({
444
+ fromId: projectNode.id,
445
+ toId: configNode.id,
446
+ type: "contains",
447
+ confidence: 1.0,
448
+ evidence: "Configuration file in project root",
449
+ });
450
+ }
451
+ }
452
+ }
453
+ exports.AnalyzeProjectTool = AnalyzeProjectTool;
454
+ //# sourceMappingURL=analyze-project.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyze-project.tool.js","sourceRoot":"","sources":["../../../src/tools/workspace/analyze-project.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAAwB;AACxB,uCAAyB;AACzB,2CAA6B;AAC7B,4CAAgH;AAKhH,kDAAkD;AAClD,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC;IACxB,cAAc;IACd,QAAQ;IACR,MAAM;IACN,OAAO;IACP,MAAM;IACN,UAAU;IACV,aAAa;IACb,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,KAAK;IACL,aAAa;CACd,CAAC,CAAC;AAEH,6DAA6D;AAC7D,MAAM,YAAY,GAAyC;IACzD,EAAE,IAAI,EAAE,cAAc,EAAQ,GAAG,EAAE,aAAa,EAAE;IAClD,EAAE,IAAI,EAAE,eAAe,EAAO,GAAG,EAAE,UAAU,EAAE;IAC/C,EAAE,IAAI,EAAE,eAAe,EAAO,GAAG,EAAE,SAAS,EAAE;IAC9C,EAAE,IAAI,EAAE,oBAAoB,EAAE,GAAG,EAAE,eAAe,EAAE;IACpD,EAAE,IAAI,EAAE,qBAAqB,EAAC,GAAG,EAAE,eAAe,EAAE;IACpD,EAAE,IAAI,EAAE,YAAY,EAAU,GAAG,EAAE,WAAW,EAAE;IAChD,EAAE,IAAI,EAAE,gBAAgB,EAAM,GAAG,EAAE,eAAe,EAAE;IACpD,EAAE,IAAI,EAAE,QAAQ,EAAc,GAAG,EAAE,OAAO,EAAE;IAC5C,EAAE,IAAI,EAAE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K;gBACX,WAAW,EAAE,4BAA4B,KAAK,EAAE;gBAChD,MAAM,EAAE,MAAM;gBACd,UAAU,EAAE,KAAK;gBACjB,UAAU,EAAE,GAAG;gBACf,IAAI,EAAE,CAAC,aAAa,CAAC;aACtB,CAAC,CAAC;YAEH,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;gBAChC,MAAM,EAAE,WAAW,CAAC,EAAE;gBACtB,IAAI,EAAE,SAAS,CAAC,EAAE;gBAClB,IAAI,EAAE,UAAU;gBAChB,UAAU,EAAE,GAAG;gBACf,QAAQ,EAAE,wCAAwC;aACnD,CAAC,CAAC;QACL,CAAC;QAED,2BAA2B;QAC3B,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;YAC5C,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;gBACnD,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,UAAU;gBAChB,WAAW,EAAE,uBAAuB,UAAU,EAAE;gBAChD,MAAM,EAAE,MAAM;gBACd,UAAU,EAAE,UAAU;gBACtB,UAAU,EAAE,GAAG;gBACf,IAAI,EAAE,CAAC,QAAQ,CAAC;aACjB,CAAC,CAAC;YAEH,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;gBAChC,MAAM,EAAE,WAAW,CAAC,EAAE;gBACtB,IAAI,EAAE,UAAU,CAAC,EAAE;gBACnB,IAAI,EAAE,UAAU;gBAChB,UAAU,EAAE,GAAG;gBACf,QAAQ,EAAE,oCAAoC;aAC/C,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AAnXD,gDAmXC"}
@@ -0,0 +1,10 @@
1
+ import { ToolBase, ToolContext, ToolExecutionResult } from "@thoughtflow/core";
2
+ export declare class CodebaseResearchTool extends ToolBase {
3
+ private readonly rootDir;
4
+ readonly name = "codebaseResearch";
5
+ readonly readonly = true;
6
+ readonly description: string;
7
+ constructor(rootDir: string);
8
+ run(input: Record<string, unknown>, _ctx: ToolContext): Promise<ToolExecutionResult>;
9
+ }
10
+ //# sourceMappingURL=codebase-research.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codebase-research.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/workspace/codebase-research.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,mBAAmB,EAAsB,MAAM,mBAAmB,CAAC;AAKnG,qBAAa,oBAAqB,SAAQ,QAAQ;IAQpC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAPpC,QAAQ,CAAC,IAAI,sBAAsB;IACnC,SAAkB,QAAQ,QAAQ;IAClC,QAAQ,CAAC,WAAW,SAGiE;gBAExD,OAAO,EAAE,MAAM;IActC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAuE3F"}