sdl-mcp 0.6.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 (496) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +132 -0
  3. package/config/benchmark.ci.config.json +86 -0
  4. package/config/benchmark.ci.windows.config.json +86 -0
  5. package/config/benchmark.config.example.json +86 -0
  6. package/config/benchmark.config.json +86 -0
  7. package/config/sdlmcp.config.example.json +139 -0
  8. package/config/sdlmcp.config.json +48 -0
  9. package/config/sdlmcp.config.schema.json +381 -0
  10. package/dist/agent/evidence.d.ts +18 -0
  11. package/dist/agent/evidence.d.ts.map +1 -0
  12. package/dist/agent/evidence.js +107 -0
  13. package/dist/agent/evidence.js.map +1 -0
  14. package/dist/agent/executor.d.ts +28 -0
  15. package/dist/agent/executor.d.ts.map +1 -0
  16. package/dist/agent/executor.js +261 -0
  17. package/dist/agent/executor.js.map +1 -0
  18. package/dist/agent/index.d.ts +6 -0
  19. package/dist/agent/index.d.ts.map +1 -0
  20. package/dist/agent/index.js +6 -0
  21. package/dist/agent/index.js.map +1 -0
  22. package/dist/agent/orchestrator.d.ts +14 -0
  23. package/dist/agent/orchestrator.d.ts.map +1 -0
  24. package/dist/agent/orchestrator.js +108 -0
  25. package/dist/agent/orchestrator.js.map +1 -0
  26. package/dist/agent/planner.d.ts +21 -0
  27. package/dist/agent/planner.d.ts.map +1 -0
  28. package/dist/agent/planner.js +153 -0
  29. package/dist/agent/planner.js.map +1 -0
  30. package/dist/agent/types.d.ts +86 -0
  31. package/dist/agent/types.d.ts.map +1 -0
  32. package/dist/agent/types.js +2 -0
  33. package/dist/agent/types.js.map +1 -0
  34. package/dist/benchmark/index.d.ts +4 -0
  35. package/dist/benchmark/index.d.ts.map +1 -0
  36. package/dist/benchmark/index.js +4 -0
  37. package/dist/benchmark/index.js.map +1 -0
  38. package/dist/benchmark/regression.d.ts +40 -0
  39. package/dist/benchmark/regression.d.ts.map +1 -0
  40. package/dist/benchmark/regression.js +199 -0
  41. package/dist/benchmark/regression.js.map +1 -0
  42. package/dist/benchmark/smoothing.d.ts +40 -0
  43. package/dist/benchmark/smoothing.d.ts.map +1 -0
  44. package/dist/benchmark/smoothing.js +121 -0
  45. package/dist/benchmark/smoothing.js.map +1 -0
  46. package/dist/benchmark/threshold.d.ts +64 -0
  47. package/dist/benchmark/threshold.d.ts.map +1 -0
  48. package/dist/benchmark/threshold.js +173 -0
  49. package/dist/benchmark/threshold.js.map +1 -0
  50. package/dist/cli/argParsing.d.ts +34 -0
  51. package/dist/cli/argParsing.d.ts.map +1 -0
  52. package/dist/cli/argParsing.js +329 -0
  53. package/dist/cli/argParsing.js.map +1 -0
  54. package/dist/cli/commands/benchmark.d.ts +16 -0
  55. package/dist/cli/commands/benchmark.d.ts.map +1 -0
  56. package/dist/cli/commands/benchmark.js +412 -0
  57. package/dist/cli/commands/benchmark.js.map +1 -0
  58. package/dist/cli/commands/doctor.d.ts +3 -0
  59. package/dist/cli/commands/doctor.d.ts.map +1 -0
  60. package/dist/cli/commands/doctor.js +218 -0
  61. package/dist/cli/commands/doctor.js.map +1 -0
  62. package/dist/cli/commands/export.d.ts +12 -0
  63. package/dist/cli/commands/export.d.ts.map +1 -0
  64. package/dist/cli/commands/export.js +70 -0
  65. package/dist/cli/commands/export.js.map +1 -0
  66. package/dist/cli/commands/import.d.ts +10 -0
  67. package/dist/cli/commands/import.d.ts.map +1 -0
  68. package/dist/cli/commands/import.js +40 -0
  69. package/dist/cli/commands/import.js.map +1 -0
  70. package/dist/cli/commands/index.d.ts +3 -0
  71. package/dist/cli/commands/index.d.ts.map +1 -0
  72. package/dist/cli/commands/index.js +89 -0
  73. package/dist/cli/commands/index.js.map +1 -0
  74. package/dist/cli/commands/init.d.ts +3 -0
  75. package/dist/cli/commands/init.d.ts.map +1 -0
  76. package/dist/cli/commands/init.js +221 -0
  77. package/dist/cli/commands/init.js.map +1 -0
  78. package/dist/cli/commands/pull.d.ts +11 -0
  79. package/dist/cli/commands/pull.d.ts.map +1 -0
  80. package/dist/cli/commands/pull.js +47 -0
  81. package/dist/cli/commands/pull.js.map +1 -0
  82. package/dist/cli/commands/serve.d.ts +3 -0
  83. package/dist/cli/commands/serve.d.ts.map +1 -0
  84. package/dist/cli/commands/serve.js +72 -0
  85. package/dist/cli/commands/serve.js.map +1 -0
  86. package/dist/cli/commands/version.d.ts +3 -0
  87. package/dist/cli/commands/version.d.ts.map +1 -0
  88. package/dist/cli/commands/version.js +24 -0
  89. package/dist/cli/commands/version.js.map +1 -0
  90. package/dist/cli/index.d.ts +3 -0
  91. package/dist/cli/index.d.ts.map +1 -0
  92. package/dist/cli/index.js +213 -0
  93. package/dist/cli/index.js.map +1 -0
  94. package/dist/cli/logging.d.ts +10 -0
  95. package/dist/cli/logging.d.ts.map +1 -0
  96. package/dist/cli/logging.js +48 -0
  97. package/dist/cli/logging.js.map +1 -0
  98. package/dist/cli/transport/http.d.ts +3 -0
  99. package/dist/cli/transport/http.d.ts.map +1 -0
  100. package/dist/cli/transport/http.js +106 -0
  101. package/dist/cli/transport/http.js.map +1 -0
  102. package/dist/cli/transport/stdio.d.ts +3 -0
  103. package/dist/cli/transport/stdio.d.ts.map +1 -0
  104. package/dist/cli/transport/stdio.js +6 -0
  105. package/dist/cli/transport/stdio.js.map +1 -0
  106. package/dist/cli/types.d.ts +41 -0
  107. package/dist/cli/types.d.ts.map +1 -0
  108. package/dist/cli/types.js +2 -0
  109. package/dist/cli/types.js.map +1 -0
  110. package/dist/code/gate.d.ts +11 -0
  111. package/dist/code/gate.d.ts.map +1 -0
  112. package/dist/code/gate.js +134 -0
  113. package/dist/code/gate.js.map +1 -0
  114. package/dist/code/hotpath.d.ts +17 -0
  115. package/dist/code/hotpath.d.ts.map +1 -0
  116. package/dist/code/hotpath.js +200 -0
  117. package/dist/code/hotpath.js.map +1 -0
  118. package/dist/code/redact.d.ts +19 -0
  119. package/dist/code/redact.d.ts.map +1 -0
  120. package/dist/code/redact.js +92 -0
  121. package/dist/code/redact.js.map +1 -0
  122. package/dist/code/skeleton.d.ts +32 -0
  123. package/dist/code/skeleton.d.ts.map +1 -0
  124. package/dist/code/skeleton.js +610 -0
  125. package/dist/code/skeleton.js.map +1 -0
  126. package/dist/code/windows.d.ts +18 -0
  127. package/dist/code/windows.d.ts.map +1 -0
  128. package/dist/code/windows.js +236 -0
  129. package/dist/code/windows.js.map +1 -0
  130. package/dist/config/constants.d.ts +340 -0
  131. package/dist/config/constants.d.ts.map +1 -0
  132. package/dist/config/constants.js +379 -0
  133. package/dist/config/constants.js.map +1 -0
  134. package/dist/config/loadConfig.d.ts +3 -0
  135. package/dist/config/loadConfig.d.ts.map +1 -0
  136. package/dist/config/loadConfig.js +71 -0
  137. package/dist/config/loadConfig.js.map +1 -0
  138. package/dist/config/types.d.ts +509 -0
  139. package/dist/config/types.d.ts.map +1 -0
  140. package/dist/config/types.js +139 -0
  141. package/dist/config/types.js.map +1 -0
  142. package/dist/db/db.d.ts +4 -0
  143. package/dist/db/db.d.ts.map +1 -0
  144. package/dist/db/db.js +47 -0
  145. package/dist/db/db.js.map +1 -0
  146. package/dist/db/migrations.d.ts +15 -0
  147. package/dist/db/migrations.d.ts.map +1 -0
  148. package/dist/db/migrations.js +81 -0
  149. package/dist/db/migrations.js.map +1 -0
  150. package/dist/db/queries.d.ts +440 -0
  151. package/dist/db/queries.d.ts.map +1 -0
  152. package/dist/db/queries.js +1054 -0
  153. package/dist/db/queries.js.map +1 -0
  154. package/dist/db/schema.d.ts +132 -0
  155. package/dist/db/schema.d.ts.map +1 -0
  156. package/dist/db/schema.js +2 -0
  157. package/dist/db/schema.js.map +1 -0
  158. package/dist/delta/blastRadius.d.ts +24 -0
  159. package/dist/delta/blastRadius.d.ts.map +1 -0
  160. package/dist/delta/blastRadius.js +239 -0
  161. package/dist/delta/blastRadius.js.map +1 -0
  162. package/dist/delta/diff.d.ts +16 -0
  163. package/dist/delta/diff.d.ts.map +1 -0
  164. package/dist/delta/diff.js +236 -0
  165. package/dist/delta/diff.js.map +1 -0
  166. package/dist/delta/versioning.d.ts +11 -0
  167. package/dist/delta/versioning.d.ts.map +1 -0
  168. package/dist/delta/versioning.js +68 -0
  169. package/dist/delta/versioning.js.map +1 -0
  170. package/dist/graph/buildGraph.d.ts +12 -0
  171. package/dist/graph/buildGraph.d.ts.map +1 -0
  172. package/dist/graph/buildGraph.js +81 -0
  173. package/dist/graph/buildGraph.js.map +1 -0
  174. package/dist/graph/cache.d.ts +111 -0
  175. package/dist/graph/cache.d.ts.map +1 -0
  176. package/dist/graph/cache.js +237 -0
  177. package/dist/graph/cache.js.map +1 -0
  178. package/dist/graph/metrics.d.ts +12 -0
  179. package/dist/graph/metrics.d.ts.map +1 -0
  180. package/dist/graph/metrics.js +253 -0
  181. package/dist/graph/metrics.js.map +1 -0
  182. package/dist/graph/minHeap.d.ts +91 -0
  183. package/dist/graph/minHeap.d.ts.map +1 -0
  184. package/dist/graph/minHeap.js +159 -0
  185. package/dist/graph/minHeap.js.map +1 -0
  186. package/dist/graph/overview.d.ts +22 -0
  187. package/dist/graph/overview.d.ts.map +1 -0
  188. package/dist/graph/overview.js +379 -0
  189. package/dist/graph/overview.js.map +1 -0
  190. package/dist/graph/score.d.ts +27 -0
  191. package/dist/graph/score.d.ts.map +1 -0
  192. package/dist/graph/score.js +214 -0
  193. package/dist/graph/score.js.map +1 -0
  194. package/dist/graph/slice.d.ts +51 -0
  195. package/dist/graph/slice.d.ts.map +1 -0
  196. package/dist/graph/slice.js +1047 -0
  197. package/dist/graph/slice.js.map +1 -0
  198. package/dist/graph/sliceCache.d.ts +33 -0
  199. package/dist/graph/sliceCache.d.ts.map +1 -0
  200. package/dist/graph/sliceCache.js +140 -0
  201. package/dist/graph/sliceCache.js.map +1 -0
  202. package/dist/indexer/adapter/BaseAdapter.d.ts +29 -0
  203. package/dist/indexer/adapter/BaseAdapter.d.ts.map +1 -0
  204. package/dist/indexer/adapter/BaseAdapter.js +97 -0
  205. package/dist/indexer/adapter/BaseAdapter.js.map +1 -0
  206. package/dist/indexer/adapter/LanguageAdapter.d.ts +20 -0
  207. package/dist/indexer/adapter/LanguageAdapter.d.ts.map +1 -0
  208. package/dist/indexer/adapter/LanguageAdapter.js +2 -0
  209. package/dist/indexer/adapter/LanguageAdapter.js.map +1 -0
  210. package/dist/indexer/adapter/adapters.d.ts +57 -0
  211. package/dist/indexer/adapter/adapters.d.ts.map +1 -0
  212. package/dist/indexer/adapter/adapters.js +129 -0
  213. package/dist/indexer/adapter/adapters.js.map +1 -0
  214. package/dist/indexer/adapter/c.d.ts +18 -0
  215. package/dist/indexer/adapter/c.d.ts.map +1 -0
  216. package/dist/indexer/adapter/c.js +443 -0
  217. package/dist/indexer/adapter/c.js.map +1 -0
  218. package/dist/indexer/adapter/cpp.d.ts +18 -0
  219. package/dist/indexer/adapter/cpp.d.ts.map +1 -0
  220. package/dist/indexer/adapter/cpp.js +493 -0
  221. package/dist/indexer/adapter/cpp.js.map +1 -0
  222. package/dist/indexer/adapter/csharp.d.ts +48 -0
  223. package/dist/indexer/adapter/csharp.d.ts.map +1 -0
  224. package/dist/indexer/adapter/csharp.js +638 -0
  225. package/dist/indexer/adapter/csharp.js.map +1 -0
  226. package/dist/indexer/adapter/go.d.ts +14 -0
  227. package/dist/indexer/adapter/go.d.ts.map +1 -0
  228. package/dist/indexer/adapter/go.js +400 -0
  229. package/dist/indexer/adapter/go.js.map +1 -0
  230. package/dist/indexer/adapter/index.d.ts +14 -0
  231. package/dist/indexer/adapter/index.d.ts.map +1 -0
  232. package/dist/indexer/adapter/index.js +13 -0
  233. package/dist/indexer/adapter/index.js.map +1 -0
  234. package/dist/indexer/adapter/java.d.ts +14 -0
  235. package/dist/indexer/adapter/java.d.ts.map +1 -0
  236. package/dist/indexer/adapter/java.js +391 -0
  237. package/dist/indexer/adapter/java.js.map +1 -0
  238. package/dist/indexer/adapter/kotlin.d.ts +18 -0
  239. package/dist/indexer/adapter/kotlin.d.ts.map +1 -0
  240. package/dist/indexer/adapter/kotlin.js +599 -0
  241. package/dist/indexer/adapter/kotlin.js.map +1 -0
  242. package/dist/indexer/adapter/php.d.ts +18 -0
  243. package/dist/indexer/adapter/php.d.ts.map +1 -0
  244. package/dist/indexer/adapter/php.js +574 -0
  245. package/dist/indexer/adapter/php.js.map +1 -0
  246. package/dist/indexer/adapter/plugin/index.d.ts +3 -0
  247. package/dist/indexer/adapter/plugin/index.d.ts.map +1 -0
  248. package/dist/indexer/adapter/plugin/index.js +3 -0
  249. package/dist/indexer/adapter/plugin/index.js.map +1 -0
  250. package/dist/indexer/adapter/plugin/loader.d.ts +13 -0
  251. package/dist/indexer/adapter/plugin/loader.d.ts.map +1 -0
  252. package/dist/indexer/adapter/plugin/loader.js +154 -0
  253. package/dist/indexer/adapter/plugin/loader.js.map +1 -0
  254. package/dist/indexer/adapter/plugin/types.d.ts +76 -0
  255. package/dist/indexer/adapter/plugin/types.d.ts.map +1 -0
  256. package/dist/indexer/adapter/plugin/types.js +47 -0
  257. package/dist/indexer/adapter/plugin/types.js.map +1 -0
  258. package/dist/indexer/adapter/python.d.ts +14 -0
  259. package/dist/indexer/adapter/python.d.ts.map +1 -0
  260. package/dist/indexer/adapter/python.js +511 -0
  261. package/dist/indexer/adapter/python.js.map +1 -0
  262. package/dist/indexer/adapter/registry.d.ts +17 -0
  263. package/dist/indexer/adapter/registry.d.ts.map +1 -0
  264. package/dist/indexer/adapter/registry.js +134 -0
  265. package/dist/indexer/adapter/registry.js.map +1 -0
  266. package/dist/indexer/adapter/rust.d.ts +18 -0
  267. package/dist/indexer/adapter/rust.d.ts.map +1 -0
  268. package/dist/indexer/adapter/rust.js +709 -0
  269. package/dist/indexer/adapter/rust.js.map +1 -0
  270. package/dist/indexer/adapter/shell.d.ts +18 -0
  271. package/dist/indexer/adapter/shell.d.ts.map +1 -0
  272. package/dist/indexer/adapter/shell.js +345 -0
  273. package/dist/indexer/adapter/shell.js.map +1 -0
  274. package/dist/indexer/adapter/typescript.d.ts +14 -0
  275. package/dist/indexer/adapter/typescript.d.ts.map +1 -0
  276. package/dist/indexer/adapter/typescript.js +31 -0
  277. package/dist/indexer/adapter/typescript.js.map +1 -0
  278. package/dist/indexer/configEdges.d.ts +30 -0
  279. package/dist/indexer/configEdges.d.ts.map +1 -0
  280. package/dist/indexer/configEdges.js +260 -0
  281. package/dist/indexer/configEdges.js.map +1 -0
  282. package/dist/indexer/fileScanner.d.ts +16 -0
  283. package/dist/indexer/fileScanner.d.ts.map +1 -0
  284. package/dist/indexer/fileScanner.js +90 -0
  285. package/dist/indexer/fileScanner.js.map +1 -0
  286. package/dist/indexer/fingerprints.d.ts +23 -0
  287. package/dist/indexer/fingerprints.d.ts.map +1 -0
  288. package/dist/indexer/fingerprints.js +97 -0
  289. package/dist/indexer/fingerprints.js.map +1 -0
  290. package/dist/indexer/indexer.d.ts +58 -0
  291. package/dist/indexer/indexer.d.ts.map +1 -0
  292. package/dist/indexer/indexer.js +1229 -0
  293. package/dist/indexer/indexer.js.map +1 -0
  294. package/dist/indexer/summaries.d.ts +5 -0
  295. package/dist/indexer/summaries.d.ts.map +1 -0
  296. package/dist/indexer/summaries.js +331 -0
  297. package/dist/indexer/summaries.js.map +1 -0
  298. package/dist/indexer/treesitter/extractCalls.d.ts +40 -0
  299. package/dist/indexer/treesitter/extractCalls.d.ts.map +1 -0
  300. package/dist/indexer/treesitter/extractCalls.js +561 -0
  301. package/dist/indexer/treesitter/extractCalls.js.map +1 -0
  302. package/dist/indexer/treesitter/extractImports.d.ts +12 -0
  303. package/dist/indexer/treesitter/extractImports.d.ts.map +1 -0
  304. package/dist/indexer/treesitter/extractImports.js +184 -0
  305. package/dist/indexer/treesitter/extractImports.js.map +1 -0
  306. package/dist/indexer/treesitter/extractSymbols.d.ts +24 -0
  307. package/dist/indexer/treesitter/extractSymbols.d.ts.map +1 -0
  308. package/dist/indexer/treesitter/extractSymbols.js +389 -0
  309. package/dist/indexer/treesitter/extractSymbols.js.map +1 -0
  310. package/dist/indexer/treesitter/grammarLoader.d.ts +6 -0
  311. package/dist/indexer/treesitter/grammarLoader.d.ts.map +1 -0
  312. package/dist/indexer/treesitter/grammarLoader.js +125 -0
  313. package/dist/indexer/treesitter/grammarLoader.js.map +1 -0
  314. package/dist/indexer/treesitter/symbolUtils.d.ts +4 -0
  315. package/dist/indexer/treesitter/symbolUtils.d.ts.map +1 -0
  316. package/dist/indexer/treesitter/symbolUtils.js +26 -0
  317. package/dist/indexer/treesitter/symbolUtils.js.map +1 -0
  318. package/dist/indexer/treesitter/tsTreesitter.d.ts +9 -0
  319. package/dist/indexer/treesitter/tsTreesitter.d.ts.map +1 -0
  320. package/dist/indexer/treesitter/tsTreesitter.js +54 -0
  321. package/dist/indexer/treesitter/tsTreesitter.js.map +1 -0
  322. package/dist/indexer/treesitter/types.d.ts +19 -0
  323. package/dist/indexer/treesitter/types.d.ts.map +1 -0
  324. package/dist/indexer/treesitter/types.js +7 -0
  325. package/dist/indexer/treesitter/types.js.map +1 -0
  326. package/dist/indexer/ts/tsParser.d.ts +20 -0
  327. package/dist/indexer/ts/tsParser.d.ts.map +1 -0
  328. package/dist/indexer/ts/tsParser.js +114 -0
  329. package/dist/indexer/ts/tsParser.js.map +1 -0
  330. package/dist/indexer/worker.d.ts +2 -0
  331. package/dist/indexer/worker.d.ts.map +1 -0
  332. package/dist/indexer/worker.js +59 -0
  333. package/dist/indexer/worker.js.map +1 -0
  334. package/dist/indexer/workerPool.d.ts +20 -0
  335. package/dist/indexer/workerPool.d.ts.map +1 -0
  336. package/dist/indexer/workerPool.js +93 -0
  337. package/dist/indexer/workerPool.js.map +1 -0
  338. package/dist/main.d.ts +2 -0
  339. package/dist/main.d.ts.map +1 -0
  340. package/dist/main.js +111 -0
  341. package/dist/main.js.map +1 -0
  342. package/dist/mcp/errors.d.ts +40 -0
  343. package/dist/mcp/errors.d.ts.map +1 -0
  344. package/dist/mcp/errors.js +66 -0
  345. package/dist/mcp/errors.js.map +1 -0
  346. package/dist/mcp/resources.d.ts +24 -0
  347. package/dist/mcp/resources.d.ts.map +1 -0
  348. package/dist/mcp/resources.js +140 -0
  349. package/dist/mcp/resources.js.map +1 -0
  350. package/dist/mcp/telemetry.d.ts +67 -0
  351. package/dist/mcp/telemetry.d.ts.map +1 -0
  352. package/dist/mcp/telemetry.js +128 -0
  353. package/dist/mcp/telemetry.js.map +1 -0
  354. package/dist/mcp/tools/agent.d.ts +241 -0
  355. package/dist/mcp/tools/agent.d.ts.map +1 -0
  356. package/dist/mcp/tools/agent.js +113 -0
  357. package/dist/mcp/tools/agent.js.map +1 -0
  358. package/dist/mcp/tools/code.d.ts +32 -0
  359. package/dist/mcp/tools/code.d.ts.map +1 -0
  360. package/dist/mcp/tools/code.js +388 -0
  361. package/dist/mcp/tools/code.js.map +1 -0
  362. package/dist/mcp/tools/delta.d.ts +12 -0
  363. package/dist/mcp/tools/delta.d.ts.map +1 -0
  364. package/dist/mcp/tools/delta.js +82 -0
  365. package/dist/mcp/tools/delta.js.map +1 -0
  366. package/dist/mcp/tools/index.d.ts +3 -0
  367. package/dist/mcp/tools/index.d.ts.map +1 -0
  368. package/dist/mcp/tools/index.js +35 -0
  369. package/dist/mcp/tools/index.js.map +1 -0
  370. package/dist/mcp/tools/policy.d.ts +20 -0
  371. package/dist/mcp/tools/policy.d.ts.map +1 -0
  372. package/dist/mcp/tools/policy.js +67 -0
  373. package/dist/mcp/tools/policy.js.map +1 -0
  374. package/dist/mcp/tools/prRisk.d.ts +34 -0
  375. package/dist/mcp/tools/prRisk.d.ts.map +1 -0
  376. package/dist/mcp/tools/prRisk.js +304 -0
  377. package/dist/mcp/tools/prRisk.js.map +1 -0
  378. package/dist/mcp/tools/repo.d.ts +46 -0
  379. package/dist/mcp/tools/repo.d.ts.map +1 -0
  380. package/dist/mcp/tools/repo.js +224 -0
  381. package/dist/mcp/tools/repo.js.map +1 -0
  382. package/dist/mcp/tools/slice.d.ts +44 -0
  383. package/dist/mcp/tools/slice.d.ts.map +1 -0
  384. package/dist/mcp/tools/slice.js +688 -0
  385. package/dist/mcp/tools/slice.js.map +1 -0
  386. package/dist/mcp/tools/symbol.d.ts +21 -0
  387. package/dist/mcp/tools/symbol.d.ts.map +1 -0
  388. package/dist/mcp/tools/symbol.js +416 -0
  389. package/dist/mcp/tools/symbol.js.map +1 -0
  390. package/dist/mcp/tools.d.ts +6003 -0
  391. package/dist/mcp/tools.d.ts.map +1 -0
  392. package/dist/mcp/tools.js +932 -0
  393. package/dist/mcp/tools.js.map +1 -0
  394. package/dist/mcp/types.d.ts +500 -0
  395. package/dist/mcp/types.d.ts.map +1 -0
  396. package/dist/mcp/types.js +2 -0
  397. package/dist/mcp/types.js.map +1 -0
  398. package/dist/policy/engine.d.ts +21 -0
  399. package/dist/policy/engine.d.ts.map +1 -0
  400. package/dist/policy/engine.js +477 -0
  401. package/dist/policy/engine.js.map +1 -0
  402. package/dist/policy/types.d.ts +73 -0
  403. package/dist/policy/types.d.ts.map +1 -0
  404. package/dist/policy/types.js +12 -0
  405. package/dist/policy/types.js.map +1 -0
  406. package/dist/server.d.ts +17 -0
  407. package/dist/server.d.ts.map +1 -0
  408. package/dist/server.js +136 -0
  409. package/dist/server.js.map +1 -0
  410. package/dist/sync/pull.d.ts +4 -0
  411. package/dist/sync/pull.d.ts.map +1 -0
  412. package/dist/sync/pull.js +113 -0
  413. package/dist/sync/pull.js.map +1 -0
  414. package/dist/sync/sync.d.ts +6 -0
  415. package/dist/sync/sync.d.ts.map +1 -0
  416. package/dist/sync/sync.js +244 -0
  417. package/dist/sync/sync.js.map +1 -0
  418. package/dist/sync/types.d.ts +136 -0
  419. package/dist/sync/types.d.ts.map +1 -0
  420. package/dist/sync/types.js +2 -0
  421. package/dist/sync/types.js.map +1 -0
  422. package/dist/ts/diagnostics.d.ts +61 -0
  423. package/dist/ts/diagnostics.d.ts.map +1 -0
  424. package/dist/ts/diagnostics.js +259 -0
  425. package/dist/ts/diagnostics.js.map +1 -0
  426. package/dist/ts/mapping.d.ts +27 -0
  427. package/dist/ts/mapping.d.ts.map +1 -0
  428. package/dist/ts/mapping.js +68 -0
  429. package/dist/ts/mapping.js.map +1 -0
  430. package/dist/util/asyncFs.d.ts +103 -0
  431. package/dist/util/asyncFs.d.ts.map +1 -0
  432. package/dist/util/asyncFs.js +133 -0
  433. package/dist/util/asyncFs.js.map +1 -0
  434. package/dist/util/concurrency.d.ts +77 -0
  435. package/dist/util/concurrency.d.ts.map +1 -0
  436. package/dist/util/concurrency.js +146 -0
  437. package/dist/util/concurrency.js.map +1 -0
  438. package/dist/util/depLabels.d.ts +3 -0
  439. package/dist/util/depLabels.d.ts.map +1 -0
  440. package/dist/util/depLabels.js +19 -0
  441. package/dist/util/depLabels.js.map +1 -0
  442. package/dist/util/findPackageRoot.d.ts +7 -0
  443. package/dist/util/findPackageRoot.d.ts.map +1 -0
  444. package/dist/util/findPackageRoot.js +21 -0
  445. package/dist/util/findPackageRoot.js.map +1 -0
  446. package/dist/util/hashing.d.ts +9 -0
  447. package/dist/util/hashing.d.ts.map +1 -0
  448. package/dist/util/hashing.js +37 -0
  449. package/dist/util/hashing.js.map +1 -0
  450. package/dist/util/logger.d.ts +14 -0
  451. package/dist/util/logger.d.ts.map +1 -0
  452. package/dist/util/logger.js +51 -0
  453. package/dist/util/logger.js.map +1 -0
  454. package/dist/util/paths.d.ts +6 -0
  455. package/dist/util/paths.d.ts.map +1 -0
  456. package/dist/util/paths.js +79 -0
  457. package/dist/util/paths.js.map +1 -0
  458. package/dist/util/time.d.ts +4 -0
  459. package/dist/util/time.d.ts.map +1 -0
  460. package/dist/util/time.js +20 -0
  461. package/dist/util/time.js.map +1 -0
  462. package/dist/util/tokenize.d.ts +5 -0
  463. package/dist/util/tokenize.d.ts.map +1 -0
  464. package/dist/util/tokenize.js +30 -0
  465. package/dist/util/tokenize.js.map +1 -0
  466. package/dist/util/truncation.d.ts +38 -0
  467. package/dist/util/truncation.d.ts.map +1 -0
  468. package/dist/util/truncation.js +259 -0
  469. package/dist/util/truncation.js.map +1 -0
  470. package/migrations/.gitkeep +1 -0
  471. package/migrations/0001_init.sql +61 -0
  472. package/migrations/0002_edges_indexes.sql +2 -0
  473. package/migrations/0003_versions.sql +22 -0
  474. package/migrations/0004_metrics_audit.sql +23 -0
  475. package/migrations/0005_slice_handles.sql +15 -0
  476. package/migrations/0006_content_addressed.sql +29 -0
  477. package/migrations/0007_add_language_to_symbols.sql +28 -0
  478. package/migrations/0008_performance_indexes.sql +21 -0
  479. package/migrations/0009_fix_edge_fks.sql +37 -0
  480. package/migrations/0010_standardize_fks.sql +35 -0
  481. package/migrations/0011_add_directory_column.sql +20 -0
  482. package/migrations/0012_symbol_references.sql +16 -0
  483. package/migrations/0013_sync_artifacts.sql +17 -0
  484. package/package.json +107 -0
  485. package/templates/CLAUDE.md.template +179 -0
  486. package/templates/README.md +228 -0
  487. package/templates/claude-code.json +54 -0
  488. package/templates/codex.json +55 -0
  489. package/templates/gemini.json +66 -0
  490. package/templates/opencode.json +90 -0
  491. package/templates/plugin-template/LICENSE +21 -0
  492. package/templates/plugin-template/README.md +309 -0
  493. package/templates/plugin-template/index.ts +160 -0
  494. package/templates/plugin-template/package.json +31 -0
  495. package/templates/plugin-template/test/plugin.test.ts +186 -0
  496. package/templates/plugin-template/tsconfig.json +21 -0
@@ -0,0 +1,309 @@
1
+ # MyLang Plugin for SDL-MCP
2
+
3
+ <div align="right">
4
+ <details>
5
+ <summary><strong>Docs Navigation</strong></summary>
6
+
7
+ - [SDL-MCP Overview](../../README.md)
8
+ - [Documentation Hub](../../docs/README.md)
9
+ - [Plugin SDK Author Guide](../../docs/PLUGIN_SDK_AUTHOR_GUIDE.md)
10
+ - [Plugin SDK Security](../../docs/PLUGIN_SDK_SECURITY.md)
11
+ - [Templates Index](../README.md)
12
+ - [Plugin Template (this page)](./README.md)
13
+ - [Example Plugin](../../examples/example-plugin/README.md)
14
+
15
+ </details>
16
+ </div>
17
+
18
+ A template adapter plugin for SDL-MCP. Customize this to add support for your language.
19
+
20
+ ## Quick Start
21
+
22
+ ```bash
23
+ # 1. Copy this template
24
+ cp -r templates/plugin-template my-lang-plugin
25
+ cd my-lang-plugin
26
+
27
+ # 2. Customize package.json
28
+ # Update name, description, author fields
29
+
30
+ # 3. Customize index.ts
31
+ # Replace "mylang" with your language name
32
+ # Implement extraction logic for your language
33
+
34
+ # 4. Install and build
35
+ npm install
36
+ npm run build
37
+
38
+ # 5. Register in SDL-MCP config
39
+ # Add to config/sdlmcp.config.json:
40
+ {
41
+ "plugins": {
42
+ "paths": ["./my-lang-plugin/dist/index.js"],
43
+ "enabled": true
44
+ }
45
+ }
46
+
47
+ # 6. Test
48
+ sdl-mcp index
49
+ ```
50
+
51
+ ## Customization Guide
52
+
53
+ ### 1. Update Plugin Metadata
54
+
55
+ Edit `manifest` in `index.ts`:
56
+
57
+ ```typescript
58
+ export const manifest = {
59
+ name: "sdl-mcp-YOURLANG-plugin", // Change this
60
+ version: "1.0.0",
61
+ apiVersion: "1.0.0",
62
+ description: "YOUR LANG adapter plugin", // Change this
63
+ author: "Your Name", // Change this
64
+ license: "MIT", // Change if needed
65
+ adapters: [
66
+ {
67
+ extension: ".yourlang", // Change this
68
+ languageId: "yourlang", // Change this
69
+ },
70
+ ],
71
+ };
72
+ ```
73
+
74
+ ### 2. Update Adapter Class
75
+
76
+ Edit `MyLangAdapter` in `index.ts`:
77
+
78
+ ```typescript
79
+ class YourLangAdapter extends BaseAdapter {
80
+ languageId = "yourlang" as const; // Change this
81
+ fileExtensions = [".yourlang"] as const; // Change this
82
+
83
+ // Implement extraction methods for your language
84
+ }
85
+ ```
86
+
87
+ ### 3. Implement Extraction Logic
88
+
89
+ Replace the placeholder extraction methods with your language-specific logic:
90
+
91
+ #### For Simple Languages (Regex-based)
92
+
93
+ ```typescript
94
+ extractSymbols(_tree: any, content: string, filePath: string): ExtractedSymbol[] {
95
+ const symbols: ExtractedSymbol[] = [];
96
+
97
+ const lines = content.split("\n");
98
+
99
+ lines.forEach((line, index) => {
100
+ // Match function definitions
101
+ const funcMatch = line.match(/YOUR_REGEX_HERE/);
102
+ if (funcMatch) {
103
+ symbols.push({
104
+ id: `${filePath}:fn:${funcMatch[1]}`,
105
+ name: funcMatch[1],
106
+ kind: "function",
107
+ filePath,
108
+ range: {
109
+ startLine: index + 1,
110
+ startCol: line.indexOf(funcMatch[1]),
111
+ endLine: index + 1,
112
+ endCol: line.indexOf(funcMatch[1]) + funcMatch[1].length,
113
+ },
114
+ parentId: null,
115
+ metadata: {},
116
+ });
117
+ }
118
+ });
119
+
120
+ return symbols;
121
+ }
122
+ ```
123
+
124
+ #### For Complex Languages (Tree-sitter-based)
125
+
126
+ ```typescript
127
+ import { getParser } from "sdl-mcp/dist/indexer/treesitter/grammarLoader.js";
128
+
129
+ class YourLangAdapter extends BaseAdapter {
130
+ languageId = "yourlang" as const;
131
+ fileExtensions = [".yourlang"] as const;
132
+
133
+ extractSymbols(
134
+ tree: any,
135
+ content: string,
136
+ filePath: string,
137
+ ): ExtractedSymbol[] {
138
+ const symbols: ExtractedSymbol[] = [];
139
+
140
+ if (!tree) {
141
+ return symbols;
142
+ }
143
+
144
+ const parser = this.getParser();
145
+ if (!parser) {
146
+ return symbols;
147
+ }
148
+
149
+ const language = parser.getLanguage();
150
+
151
+ try {
152
+ const query = language.query(`
153
+ (function_declaration name: (identifier) @name)
154
+ (class_declaration name: (identifier) @name)
155
+ `);
156
+
157
+ const captures = query.captures(tree.rootNode);
158
+
159
+ for (const [node, name] of captures) {
160
+ if (name === "name") {
161
+ symbols.push({
162
+ id: `${filePath}:${node.text}`,
163
+ name: node.text,
164
+ kind:
165
+ node.parent?.type === "function_declaration"
166
+ ? "function"
167
+ : "class",
168
+ filePath,
169
+ range: this.extractRange(node),
170
+ parentId: null,
171
+ metadata: {},
172
+ });
173
+ }
174
+ }
175
+ } catch (error) {
176
+ console.error(`Query error in ${filePath}:`, error);
177
+ }
178
+
179
+ return symbols;
180
+ }
181
+ }
182
+ ```
183
+
184
+ ### 4. Update package.json
185
+
186
+ ```json
187
+ {
188
+ "name": "sdl-mcp-yourlang-plugin",
189
+ "version": "1.0.0",
190
+ "description": "YourLang adapter plugin for SDL-MCP",
191
+ "author": "Your Name <your.email@example.com>",
192
+ "keywords": ["sdl-mcp", "plugin", "adapter", "yourlang"]
193
+ }
194
+ ```
195
+
196
+ ## File Structure
197
+
198
+ ```text
199
+ my-lang-plugin/
200
+ |-- package.json # NPM package metadata
201
+ |-- tsconfig.json # TypeScript configuration
202
+ |-- index.ts # Plugin implementation
203
+ |-- README.md # Plugin documentation (this file)
204
+ |-- LICENSE # License file
205
+ `-- dist/ # Compiled output (generated)
206
+ |-- index.js
207
+ |-- index.d.ts
208
+ `-- index.js.map
209
+ ```
210
+
211
+ ## Testing
212
+
213
+ Create test files with your language's extension:
214
+
215
+ ```yourlang
216
+ // test.mylang
217
+ import "stdlib"
218
+
219
+ function greet(name: string) {
220
+ print("Hello, " + name + "!");
221
+ }
222
+
223
+ class Calculator {
224
+ function add(a: number, b: number): number {
225
+ return a + b;
226
+ }
227
+ }
228
+
229
+ function main() {
230
+ greet("World");
231
+ let calc = Calculator();
232
+ calc.add(5, 3);
233
+ }
234
+ ```
235
+
236
+ Run SDL-MCP indexing:
237
+
238
+ ```bash
239
+ sdl-mcp index
240
+ ```
241
+
242
+ Check logs for:
243
+
244
+ ```
245
+ Plugin loaded successfully: your-lang-plugin@1.0.0
246
+ Indexed test.mylang: 3 symbols, 1 imports, 3 calls
247
+ ```
248
+
249
+ ## Publishing
250
+
251
+ ### Publish to NPM
252
+
253
+ ```bash
254
+ # 1. Login to NPM
255
+ npm login
256
+
257
+ # 2. Build plugin
258
+ npm run build
259
+
260
+ # 3. Publish
261
+ npm publish --access public
262
+
263
+ # 4. Verify
264
+ npm view sdl-mcp-yourlang-plugin
265
+ ```
266
+
267
+ ### Publish to Private Registry
268
+
269
+ ```bash
270
+ # 1. Configure registry
271
+ npm config set registry https://npm.yourcompany.com
272
+
273
+ # 2. Publish
274
+ npm publish
275
+
276
+ # 3. Users install from your registry
277
+ npm install --registry https://npm.yourcompany.com sdl-mcp-yourlang-plugin
278
+ ```
279
+
280
+ ## Documentation
281
+
282
+ For more detailed information:
283
+
284
+ - [Plugin SDK Author Guide](../../docs/PLUGIN_SDK_AUTHOR_GUIDE.md)
285
+ - [Plugin SDK Security](../../docs/PLUGIN_SDK_SECURITY.md)
286
+ - [Example Plugin](../../examples/example-plugin/README.md)
287
+ - [SDL-MCP README](../../README.md)
288
+
289
+ ## Support
290
+
291
+ For issues or questions:
292
+
293
+ - Check the [troubleshooting guide](../../docs/PLUGIN_SDK_AUTHOR_GUIDE.md#troubleshooting)
294
+ - Review the [Example Plugin](../../examples/example-plugin/README.md)
295
+ - Open an issue on the SDL-MCP repository
296
+
297
+ ## License
298
+
299
+ MIT
300
+
301
+ ## Contributing
302
+
303
+ Contributions are welcome! Please:
304
+
305
+ 1. Fork this template
306
+ 2. Customize for your language
307
+ 3. Add tests
308
+ 4. Submit a pull request
309
+
@@ -0,0 +1,160 @@
1
+ import { BaseAdapter } from "sdl-mcp/dist/indexer/adapter/BaseAdapter.js";
2
+ import type {
3
+ LanguageAdapter,
4
+ ExtractedSymbol,
5
+ ExtractedImport,
6
+ ExtractedCall,
7
+ } from "sdl-mcp/dist/indexer/adapter/LanguageAdapter.js";
8
+ import type {
9
+ AdapterPlugin,
10
+ PluginAdapter,
11
+ } from "sdl-mcp/dist/indexer/adapter/plugin/types.js";
12
+
13
+ const PLUGIN_API_VERSION = "1.0.0";
14
+
15
+ export const manifest = {
16
+ name: "sdl-mcp-mylang-plugin",
17
+ version: "1.0.0",
18
+ apiVersion: PLUGIN_API_VERSION,
19
+ description: "MyLang adapter plugin for SDL-MCP",
20
+ author: "Your Name",
21
+ license: "MIT",
22
+ adapters: [
23
+ {
24
+ extension: ".mylang",
25
+ languageId: "mylang",
26
+ },
27
+ ],
28
+ };
29
+
30
+ class MyLangAdapter extends BaseAdapter {
31
+ languageId = "mylang" as const;
32
+ fileExtensions = [".mylang"] as const;
33
+
34
+ extractSymbols(
35
+ _tree: any,
36
+ content: string,
37
+ filePath: string,
38
+ ): ExtractedSymbol[] {
39
+ const symbols: ExtractedSymbol[] = [];
40
+
41
+ const lines = content.split("\n");
42
+
43
+ lines.forEach((line, index) => {
44
+ const funcMatch = line.match(/function\s+(\w+)\s*\(/);
45
+ if (funcMatch) {
46
+ symbols.push({
47
+ id: `${filePath}:fn:${funcMatch[1]}`,
48
+ name: funcMatch[1],
49
+ kind: "function",
50
+ filePath,
51
+ range: {
52
+ startLine: index + 1,
53
+ startCol: line.indexOf(funcMatch[1]),
54
+ endLine: index + 1,
55
+ endCol: line.indexOf(funcMatch[1]) + funcMatch[1].length,
56
+ },
57
+ parentId: null,
58
+ metadata: {},
59
+ });
60
+ }
61
+
62
+ const classMatch = line.match(/class\s+(\w+)/);
63
+ if (classMatch) {
64
+ symbols.push({
65
+ id: `${filePath}:class:${classMatch[1]}`,
66
+ name: classMatch[1],
67
+ kind: "class",
68
+ filePath,
69
+ range: {
70
+ startLine: index + 1,
71
+ startCol: line.indexOf(classMatch[1]),
72
+ endLine: index + 1,
73
+ endCol: line.indexOf(classMatch[1]) + classMatch[1].length,
74
+ },
75
+ parentId: null,
76
+ metadata: {},
77
+ });
78
+ }
79
+ });
80
+
81
+ return symbols;
82
+ }
83
+
84
+ extractImports(
85
+ _tree: any,
86
+ content: string,
87
+ filePath: string,
88
+ ): ExtractedImport[] {
89
+ const imports: ExtractedImport[] = [];
90
+
91
+ const lines = content.split("\n");
92
+
93
+ lines.forEach((line, index) => {
94
+ const importMatch = line.match(/import\s+"(.+)"/);
95
+ if (importMatch) {
96
+ imports.push({
97
+ id: `${filePath}:import:${index}`,
98
+ filePath,
99
+ range: {
100
+ startLine: index + 1,
101
+ startCol: line.indexOf("import"),
102
+ endLine: index + 1,
103
+ endCol: line.length,
104
+ },
105
+ moduleName: importMatch[1],
106
+ symbols: [],
107
+ });
108
+ }
109
+ });
110
+
111
+ return imports;
112
+ }
113
+
114
+ extractCalls(
115
+ _tree: any,
116
+ content: string,
117
+ filePath: string,
118
+ extractedSymbols: ExtractedSymbol[],
119
+ ): ExtractedCall[] {
120
+ const calls: ExtractedCall[] = [];
121
+
122
+ const lines = content.split("\n");
123
+
124
+ lines.forEach((line, index) => {
125
+ const callMatch = line.match(/(\w+)\s*\(/);
126
+ if (callMatch) {
127
+ const functionName = callMatch[1];
128
+ const symbol = extractedSymbols.find((s) => s.name === functionName);
129
+
130
+ if (symbol) {
131
+ calls.push({
132
+ id: `${filePath}:call:${index}:${functionName}`,
133
+ filePath,
134
+ range: {
135
+ startLine: index + 1,
136
+ startCol: line.indexOf(functionName),
137
+ endLine: index + 1,
138
+ endCol: line.indexOf(functionName) + functionName.length,
139
+ },
140
+ targetSymbolId: symbol.id,
141
+ });
142
+ }
143
+ }
144
+ });
145
+
146
+ return calls;
147
+ }
148
+ }
149
+
150
+ export async function createAdapters(): Promise<PluginAdapter[]> {
151
+ return [
152
+ {
153
+ extension: ".mylang",
154
+ languageId: "mylang",
155
+ factory: () => new MyLangAdapter(),
156
+ },
157
+ ];
158
+ }
159
+
160
+ export default { manifest, createAdapters };
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "sdl-mcp-mylang-plugin",
3
+ "version": "1.0.0",
4
+ "description": "MyLang adapter plugin for SDL-MCP",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "watch": "tsc --watch",
10
+ "test": "node --test",
11
+ "prepublishOnly": "npm run build"
12
+ },
13
+ "keywords": [
14
+ "sdl-mcp",
15
+ "plugin",
16
+ "adapter",
17
+ "mylang"
18
+ ],
19
+ "author": "Your Name <your.email@example.com>",
20
+ "license": "MIT",
21
+ "devDependencies": {
22
+ "@types/node": "^20.0.0",
23
+ "typescript": "^5.9.3"
24
+ },
25
+ "peerDependencies": {
26
+ "sdl-mcp": "*"
27
+ },
28
+ "engines": {
29
+ "node": ">=18.0.0"
30
+ }
31
+ }
@@ -0,0 +1,186 @@
1
+ import { describe, it } from "node:test";
2
+ import assert from "node:assert";
3
+ import { MyLangAdapter } from "../dist/index.js";
4
+
5
+ describe("MyLang Plugin Tests", () => {
6
+ const adapter = new MyLangAdapter();
7
+
8
+ describe("Metadata", () => {
9
+ it("should have correct language ID", () => {
10
+ assert.strictEqual(adapter.languageId, "mylang");
11
+ });
12
+
13
+ it("should have correct file extensions", () => {
14
+ assert.ok(adapter.fileExtensions.includes(".mylang"));
15
+ });
16
+ });
17
+
18
+ describe("Symbol Extraction", () => {
19
+ it("should extract functions", () => {
20
+ const content = `function greet(name: string) {
21
+ print("Hello, " + name + "!");
22
+ }`;
23
+ const symbols = adapter.extractSymbols(null, content, "test.mylang");
24
+
25
+ const greet = symbols.find((s) => s.name === "greet");
26
+ assert.ok(greet, "Should extract greet function");
27
+ assert.strictEqual(greet.kind, "function");
28
+ assert.strictEqual(greet.filePath, "test.mylang");
29
+ assert.ok(greet.range, "Should have range information");
30
+ });
31
+
32
+ it("should extract classes", () => {
33
+ const content = `class Calculator {
34
+ function add(a: number, b: number): number {
35
+ return a + b;
36
+ }
37
+ }`;
38
+ const symbols = adapter.extractSymbols(null, content, "test.mylang");
39
+
40
+ const calculator = symbols.find((s) => s.name === "Calculator");
41
+ assert.ok(calculator, "Should extract Calculator class");
42
+ assert.strictEqual(calculator.kind, "class");
43
+ });
44
+
45
+ it("should handle empty content", () => {
46
+ const content = "";
47
+ const symbols = adapter.extractSymbols(null, content, "test.mylang");
48
+
49
+ assert.strictEqual(symbols.length, 0);
50
+ });
51
+
52
+ it("should extract multiple symbols", () => {
53
+ const content = `function func1() {}
54
+ function func2() {}
55
+ class MyClass {}`;
56
+ const symbols = adapter.extractSymbols(null, content, "test.mylang");
57
+
58
+ assert.ok(symbols.length >= 3, "Should extract multiple symbols");
59
+ assert.ok(symbols.some((s) => s.name === "func1"));
60
+ assert.ok(symbols.some((s) => s.name === "func2"));
61
+ assert.ok(symbols.some((s) => s.name === "MyClass"));
62
+ });
63
+ });
64
+
65
+ describe("Import Extraction", () => {
66
+ it("should extract imports", () => {
67
+ const content = `import "stdlib"
68
+ import "mylib/utils"`;
69
+ const imports = adapter.extractImports(null, content, "test.mylang");
70
+
71
+ assert.strictEqual(imports.length, 2);
72
+ assert.ok(imports.some((i) => i.moduleName === "stdlib"));
73
+ assert.ok(imports.some((i) => i.moduleName === "mylib/utils"));
74
+ });
75
+
76
+ it("should handle empty imports", () => {
77
+ const content = "";
78
+ const imports = adapter.extractImports(null, content, "test.mylang");
79
+
80
+ assert.strictEqual(imports.length, 0);
81
+ });
82
+
83
+ it("should extract import with correct range", () => {
84
+ const content = `import "stdlib"`;
85
+ const imports = adapter.extractImports(null, content, "test.mylang");
86
+
87
+ assert.strictEqual(imports.length, 1);
88
+ assert.strictEqual(imports[0].moduleName, "stdlib");
89
+ assert.strictEqual(imports[0].range.startLine, 1);
90
+ assert.ok(imports[0].range.endCol > imports[0].range.startCol);
91
+ });
92
+ });
93
+
94
+ describe("Call Extraction", () => {
95
+ it("should extract function calls", () => {
96
+ const content = `function test() {}
97
+ test()`;
98
+ const symbols = adapter.extractSymbols(null, content, "test.mylang");
99
+ const calls = adapter.extractCalls(null, content, "test.mylang", symbols);
100
+
101
+ const testCall = calls.find((c) => c.targetSymbolId.includes("test"));
102
+ assert.ok(testCall, "Should extract call to test function");
103
+ assert.strictEqual(testCall.filePath, "test.mylang");
104
+ assert.ok(testCall.range, "Should have range information");
105
+ });
106
+
107
+ it("should extract multiple calls", () => {
108
+ const content = `function func1() {}
109
+ function func2() {}
110
+ func1()
111
+ func2()`;
112
+ const symbols = adapter.extractSymbols(null, content, "test.mylang");
113
+ const calls = adapter.extractCalls(null, content, "test.mylang", symbols);
114
+
115
+ assert.ok(calls.length >= 2, "Should extract multiple calls");
116
+ assert.ok(calls.some((c) => c.targetSymbolId.includes("func1")));
117
+ assert.ok(calls.some((c) => c.targetSymbolId.includes("func2")));
118
+ });
119
+
120
+ it("should not extract calls to undefined symbols", () => {
121
+ const content = `undefinedFunction()`;
122
+ const symbols = adapter.extractSymbols(null, content, "test.mylang");
123
+ const calls = adapter.extractCalls(null, content, "test.mylang", symbols);
124
+
125
+ assert.strictEqual(
126
+ calls.length,
127
+ 0,
128
+ "Should not extract calls to undefined symbols",
129
+ );
130
+ });
131
+ });
132
+
133
+ describe("Graph Structure", () => {
134
+ it("should maintain valid symbol IDs", () => {
135
+ const content = `function test() {}`;
136
+ const symbols = adapter.extractSymbols(null, content, "test.mylang");
137
+
138
+ for (const symbol of symbols) {
139
+ assert.ok(symbol.id, "Symbol should have ID");
140
+ assert.ok(
141
+ symbol.id.includes("test.mylang"),
142
+ "ID should include file path",
143
+ );
144
+ assert.ok(symbol.id.includes("test"), "ID should include symbol name");
145
+ }
146
+ });
147
+
148
+ it("should maintain valid call references", () => {
149
+ const content = `function test() {}
150
+ test()`;
151
+ const symbols = adapter.extractSymbols(null, content, "test.mylang");
152
+ const calls = adapter.extractCalls(null, content, "test.mylang", symbols);
153
+
154
+ for (const call of calls) {
155
+ assert.ok(call.targetSymbolId, "Call should have targetSymbolId");
156
+ const targetSymbol = symbols.find((s) => s.id === call.targetSymbolId);
157
+ assert.ok(targetSymbol, "Call should reference existing symbol");
158
+ }
159
+ });
160
+
161
+ it("should extract complete graph", () => {
162
+ const content = `import "stdlib"
163
+
164
+ function helper() {
165
+ return 42
166
+ }
167
+
168
+ function main() {
169
+ helper()
170
+ print("Done")
171
+ }`;
172
+ const symbols = adapter.extractSymbols(null, content, "test.mylang");
173
+ const imports = adapter.extractImports(null, content, "test.mylang");
174
+ const calls = adapter.extractCalls(null, content, "test.mylang", symbols);
175
+
176
+ assert.ok(symbols.length > 0, "Should have symbols");
177
+ assert.ok(imports.length > 0, "Should have imports");
178
+ assert.ok(calls.length > 0, "Should have calls");
179
+
180
+ assert.ok(symbols.some((s) => s.name === "helper"));
181
+ assert.ok(symbols.some((s) => s.name === "main"));
182
+ assert.ok(imports.some((i) => i.moduleName === "stdlib"));
183
+ assert.ok(calls.some((c) => c.targetSymbolId.includes("helper")));
184
+ });
185
+ });
186
+ });
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "lib": ["ES2022"],
7
+ "declaration": true,
8
+ "declarationMap": true,
9
+ "sourceMap": true,
10
+ "outDir": "./dist",
11
+ "rootDir": "./",
12
+ "strict": true,
13
+ "esModuleInterop": true,
14
+ "skipLibCheck": true,
15
+ "forceConsistentCasingInFileNames": true,
16
+ "resolveJsonModule": true,
17
+ "allowSyntheticDefaultImports": true
18
+ },
19
+ "include": ["index.ts", "test/**/*.test.ts"],
20
+ "exclude": ["node_modules", "dist"]
21
+ }