@opencodereview/core 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (453) hide show
  1. package/dist/ai/anthropic-provider.d.ts +41 -0
  2. package/dist/ai/anthropic-provider.d.ts.map +1 -0
  3. package/dist/ai/anthropic-provider.js +139 -0
  4. package/dist/ai/anthropic-provider.js.map +1 -0
  5. package/dist/ai/index.d.ts +39 -0
  6. package/dist/ai/index.d.ts.map +1 -0
  7. package/dist/ai/index.js +41 -0
  8. package/dist/ai/index.js.map +1 -0
  9. package/dist/ai/ollama-provider.d.ts +46 -0
  10. package/dist/ai/ollama-provider.d.ts.map +1 -0
  11. package/dist/ai/ollama-provider.js +149 -0
  12. package/dist/ai/ollama-provider.js.map +1 -0
  13. package/dist/ai/openai-provider.d.ts +44 -0
  14. package/dist/ai/openai-provider.d.ts.map +1 -0
  15. package/dist/ai/openai-provider.js +137 -0
  16. package/dist/ai/openai-provider.js.map +1 -0
  17. package/dist/ai/orchestrator.d.ts +60 -0
  18. package/dist/ai/orchestrator.d.ts.map +1 -0
  19. package/dist/ai/orchestrator.js +188 -0
  20. package/dist/ai/orchestrator.js.map +1 -0
  21. package/dist/ai/prompts.d.ts +27 -0
  22. package/dist/ai/prompts.d.ts.map +1 -0
  23. package/dist/ai/prompts.js +112 -0
  24. package/dist/ai/prompts.js.map +1 -0
  25. package/dist/ai/types.d.ts +75 -0
  26. package/dist/ai/types.d.ts.map +1 -0
  27. package/dist/ai/types.js +10 -0
  28. package/dist/ai/types.js.map +1 -0
  29. package/dist/ai/v4/embedding/index.d.ts +10 -0
  30. package/dist/ai/v4/embedding/index.d.ts.map +1 -0
  31. package/dist/ai/v4/embedding/index.js +10 -0
  32. package/dist/ai/v4/embedding/index.js.map +1 -0
  33. package/dist/ai/v4/embedding/local.d.ts +68 -0
  34. package/dist/ai/v4/embedding/local.d.ts.map +1 -0
  35. package/dist/ai/v4/embedding/local.js +167 -0
  36. package/dist/ai/v4/embedding/local.js.map +1 -0
  37. package/dist/ai/v4/embedding/ollama.d.ts +58 -0
  38. package/dist/ai/v4/embedding/ollama.d.ts.map +1 -0
  39. package/dist/ai/v4/embedding/ollama.js +101 -0
  40. package/dist/ai/v4/embedding/ollama.js.map +1 -0
  41. package/dist/ai/v4/embedding/openai.d.ts +36 -0
  42. package/dist/ai/v4/embedding/openai.d.ts.map +1 -0
  43. package/dist/ai/v4/embedding/openai.js +76 -0
  44. package/dist/ai/v4/embedding/openai.js.map +1 -0
  45. package/dist/ai/v4/embedding/similarity.d.ts +36 -0
  46. package/dist/ai/v4/embedding/similarity.d.ts.map +1 -0
  47. package/dist/ai/v4/embedding/similarity.js +60 -0
  48. package/dist/ai/v4/embedding/similarity.js.map +1 -0
  49. package/dist/ai/v4/index.d.ts +51 -0
  50. package/dist/ai/v4/index.d.ts.map +1 -0
  51. package/dist/ai/v4/index.js +54 -0
  52. package/dist/ai/v4/index.js.map +1 -0
  53. package/dist/ai/v4/llm/anthropic.d.ts +38 -0
  54. package/dist/ai/v4/llm/anthropic.d.ts.map +1 -0
  55. package/dist/ai/v4/llm/anthropic.js +86 -0
  56. package/dist/ai/v4/llm/anthropic.js.map +1 -0
  57. package/dist/ai/v4/llm/index.d.ts +9 -0
  58. package/dist/ai/v4/llm/index.d.ts.map +1 -0
  59. package/dist/ai/v4/llm/index.js +9 -0
  60. package/dist/ai/v4/llm/index.js.map +1 -0
  61. package/dist/ai/v4/llm/ollama.d.ts +39 -0
  62. package/dist/ai/v4/llm/ollama.d.ts.map +1 -0
  63. package/dist/ai/v4/llm/ollama.js +95 -0
  64. package/dist/ai/v4/llm/ollama.js.map +1 -0
  65. package/dist/ai/v4/llm/openai.d.ts +38 -0
  66. package/dist/ai/v4/llm/openai.d.ts.map +1 -0
  67. package/dist/ai/v4/llm/openai.js +88 -0
  68. package/dist/ai/v4/llm/openai.js.map +1 -0
  69. package/dist/ai/v4/patterns/defect-patterns.d.ts +57 -0
  70. package/dist/ai/v4/patterns/defect-patterns.d.ts.map +1 -0
  71. package/dist/ai/v4/patterns/defect-patterns.js +331 -0
  72. package/dist/ai/v4/patterns/defect-patterns.js.map +1 -0
  73. package/dist/ai/v4/patterns/index.d.ts +8 -0
  74. package/dist/ai/v4/patterns/index.d.ts.map +1 -0
  75. package/dist/ai/v4/patterns/index.js +7 -0
  76. package/dist/ai/v4/patterns/index.js.map +1 -0
  77. package/dist/ai/v4/pipeline.d.ts +74 -0
  78. package/dist/ai/v4/pipeline.d.ts.map +1 -0
  79. package/dist/ai/v4/pipeline.js +381 -0
  80. package/dist/ai/v4/pipeline.js.map +1 -0
  81. package/dist/ai/v4/sla.d.ts +62 -0
  82. package/dist/ai/v4/sla.d.ts.map +1 -0
  83. package/dist/ai/v4/sla.js +136 -0
  84. package/dist/ai/v4/sla.js.map +1 -0
  85. package/dist/ai/v4/types.d.ts +117 -0
  86. package/dist/ai/v4/types.d.ts.map +1 -0
  87. package/dist/ai/v4/types.js +16 -0
  88. package/dist/ai/v4/types.js.map +1 -0
  89. package/dist/ai-healer/prompt-builder.d.ts +33 -0
  90. package/dist/ai-healer/prompt-builder.d.ts.map +1 -0
  91. package/dist/ai-healer/prompt-builder.js +89 -0
  92. package/dist/ai-healer/prompt-builder.js.map +1 -0
  93. package/dist/config/defaults.d.ts +14 -0
  94. package/dist/config/defaults.d.ts.map +1 -0
  95. package/dist/config/defaults.js +57 -0
  96. package/dist/config/defaults.js.map +1 -0
  97. package/dist/config/index.d.ts +8 -0
  98. package/dist/config/index.d.ts.map +1 -0
  99. package/dist/config/index.js +6 -0
  100. package/dist/config/index.js.map +1 -0
  101. package/dist/config/loader.d.ts +33 -0
  102. package/dist/config/loader.d.ts.map +1 -0
  103. package/dist/config/loader.js +245 -0
  104. package/dist/config/loader.js.map +1 -0
  105. package/dist/config/types.d.ts +58 -0
  106. package/dist/config/types.d.ts.map +1 -0
  107. package/dist/config/types.js +7 -0
  108. package/dist/config/types.js.map +1 -0
  109. package/dist/config/v4-config.d.ts +77 -0
  110. package/dist/config/v4-config.d.ts.map +1 -0
  111. package/dist/config/v4-config.js +336 -0
  112. package/dist/config/v4-config.js.map +1 -0
  113. package/dist/detectors/ai-detector.d.ts +38 -0
  114. package/dist/detectors/ai-detector.d.ts.map +1 -0
  115. package/dist/detectors/ai-detector.js +62 -0
  116. package/dist/detectors/ai-detector.js.map +1 -0
  117. package/dist/detectors/context-break.d.ts +57 -0
  118. package/dist/detectors/context-break.d.ts.map +1 -0
  119. package/dist/detectors/context-break.js +199 -0
  120. package/dist/detectors/context-break.js.map +1 -0
  121. package/dist/detectors/deep-hallucination.d.ts +42 -0
  122. package/dist/detectors/deep-hallucination.d.ts.map +1 -0
  123. package/dist/detectors/deep-hallucination.js +297 -0
  124. package/dist/detectors/deep-hallucination.js.map +1 -0
  125. package/dist/detectors/duplication.d.ts +61 -0
  126. package/dist/detectors/duplication.d.ts.map +1 -0
  127. package/dist/detectors/duplication.js +204 -0
  128. package/dist/detectors/duplication.js.map +1 -0
  129. package/dist/detectors/hallucination.d.ts +80 -0
  130. package/dist/detectors/hallucination.d.ts.map +1 -0
  131. package/dist/detectors/hallucination.js +350 -0
  132. package/dist/detectors/hallucination.js.map +1 -0
  133. package/dist/detectors/index.d.ts +35 -0
  134. package/dist/detectors/index.d.ts.map +1 -0
  135. package/dist/detectors/index.js +33 -0
  136. package/dist/detectors/index.js.map +1 -0
  137. package/dist/detectors/logic-gap.d.ts +58 -0
  138. package/dist/detectors/logic-gap.d.ts.map +1 -0
  139. package/dist/detectors/logic-gap.js +284 -0
  140. package/dist/detectors/logic-gap.js.map +1 -0
  141. package/dist/detectors/over-engineering.d.ts +44 -0
  142. package/dist/detectors/over-engineering.d.ts.map +1 -0
  143. package/dist/detectors/over-engineering.js +257 -0
  144. package/dist/detectors/over-engineering.js.map +1 -0
  145. package/dist/detectors/security-pattern.d.ts +43 -0
  146. package/dist/detectors/security-pattern.d.ts.map +1 -0
  147. package/dist/detectors/security-pattern.js +235 -0
  148. package/dist/detectors/security-pattern.js.map +1 -0
  149. package/dist/detectors/stale-api.d.ts +44 -0
  150. package/dist/detectors/stale-api.d.ts.map +1 -0
  151. package/dist/detectors/stale-api.js +160 -0
  152. package/dist/detectors/stale-api.js.map +1 -0
  153. package/dist/detectors/type-safety.d.ts +41 -0
  154. package/dist/detectors/type-safety.d.ts.map +1 -0
  155. package/dist/detectors/type-safety.js +306 -0
  156. package/dist/detectors/type-safety.js.map +1 -0
  157. package/dist/detectors/v4/context-coherence.d.ts +67 -0
  158. package/dist/detectors/v4/context-coherence.d.ts.map +1 -0
  159. package/dist/detectors/v4/context-coherence.js +319 -0
  160. package/dist/detectors/v4/context-coherence.js.map +1 -0
  161. package/dist/detectors/v4/hallucinated-import.d.ts +52 -0
  162. package/dist/detectors/v4/hallucinated-import.d.ts.map +1 -0
  163. package/dist/detectors/v4/hallucinated-import.js +206 -0
  164. package/dist/detectors/v4/hallucinated-import.js.map +1 -0
  165. package/dist/detectors/v4/index.d.ts +28 -0
  166. package/dist/detectors/v4/index.d.ts.map +1 -0
  167. package/dist/detectors/v4/index.js +40 -0
  168. package/dist/detectors/v4/index.js.map +1 -0
  169. package/dist/detectors/v4/over-engineering.d.ts +69 -0
  170. package/dist/detectors/v4/over-engineering.d.ts.map +1 -0
  171. package/dist/detectors/v4/over-engineering.js +234 -0
  172. package/dist/detectors/v4/over-engineering.js.map +1 -0
  173. package/dist/detectors/v4/security-pattern.d.ts +46 -0
  174. package/dist/detectors/v4/security-pattern.d.ts.map +1 -0
  175. package/dist/detectors/v4/security-pattern.js +233 -0
  176. package/dist/detectors/v4/security-pattern.js.map +1 -0
  177. package/dist/detectors/v4/stale-api.d.ts +59 -0
  178. package/dist/detectors/v4/stale-api.d.ts.map +1 -0
  179. package/dist/detectors/v4/stale-api.js +470 -0
  180. package/dist/detectors/v4/stale-api.js.map +1 -0
  181. package/dist/detectors/v4/types.d.ts +74 -0
  182. package/dist/detectors/v4/types.d.ts.map +1 -0
  183. package/dist/detectors/v4/types.js +10 -0
  184. package/dist/detectors/v4/types.js.map +1 -0
  185. package/dist/diff/filter.d.ts +35 -0
  186. package/dist/diff/filter.d.ts.map +1 -0
  187. package/dist/diff/filter.js +65 -0
  188. package/dist/diff/filter.js.map +1 -0
  189. package/dist/diff/index.d.ts +9 -0
  190. package/dist/diff/index.d.ts.map +1 -0
  191. package/dist/diff/index.js +8 -0
  192. package/dist/diff/index.js.map +1 -0
  193. package/dist/diff/parser.d.ts +61 -0
  194. package/dist/diff/parser.d.ts.map +1 -0
  195. package/dist/diff/parser.js +203 -0
  196. package/dist/diff/parser.js.map +1 -0
  197. package/dist/i18n/en.d.ts +18 -0
  198. package/dist/i18n/en.d.ts.map +1 -0
  199. package/dist/i18n/en.js +83 -0
  200. package/dist/i18n/en.js.map +1 -0
  201. package/dist/i18n/index.d.ts +13 -0
  202. package/dist/i18n/index.d.ts.map +1 -0
  203. package/dist/i18n/index.js +14 -0
  204. package/dist/i18n/index.js.map +1 -0
  205. package/dist/i18n/provider.d.ts +54 -0
  206. package/dist/i18n/provider.d.ts.map +1 -0
  207. package/dist/i18n/provider.js +88 -0
  208. package/dist/i18n/provider.js.map +1 -0
  209. package/dist/i18n/types.d.ts +37 -0
  210. package/dist/i18n/types.d.ts.map +1 -0
  211. package/dist/i18n/types.js +10 -0
  212. package/dist/i18n/types.js.map +1 -0
  213. package/dist/i18n/zh.d.ts +14 -0
  214. package/dist/i18n/zh.d.ts.map +1 -0
  215. package/dist/i18n/zh.js +83 -0
  216. package/dist/i18n/zh.js.map +1 -0
  217. package/dist/index.d.ts +113 -0
  218. package/dist/index.d.ts.map +1 -0
  219. package/dist/index.js +106 -0
  220. package/dist/index.js.map +1 -0
  221. package/dist/ir/index.d.ts +10 -0
  222. package/dist/ir/index.d.ts.map +1 -0
  223. package/dist/ir/index.js +9 -0
  224. package/dist/ir/index.js.map +1 -0
  225. package/dist/ir/types.d.ts +126 -0
  226. package/dist/ir/types.d.ts.map +1 -0
  227. package/dist/ir/types.js +33 -0
  228. package/dist/ir/types.js.map +1 -0
  229. package/dist/languages/go/index.d.ts +7 -0
  230. package/dist/languages/go/index.d.ts.map +1 -0
  231. package/dist/languages/go/index.js +7 -0
  232. package/dist/languages/go/index.js.map +1 -0
  233. package/dist/languages/go/parser.d.ts +89 -0
  234. package/dist/languages/go/parser.d.ts.map +1 -0
  235. package/dist/languages/go/parser.js +509 -0
  236. package/dist/languages/go/parser.js.map +1 -0
  237. package/dist/languages/index.d.ts +13 -0
  238. package/dist/languages/index.d.ts.map +1 -0
  239. package/dist/languages/index.js +14 -0
  240. package/dist/languages/index.js.map +1 -0
  241. package/dist/languages/java/index.d.ts +7 -0
  242. package/dist/languages/java/index.d.ts.map +1 -0
  243. package/dist/languages/java/index.js +7 -0
  244. package/dist/languages/java/index.js.map +1 -0
  245. package/dist/languages/java/parser.d.ts +82 -0
  246. package/dist/languages/java/parser.d.ts.map +1 -0
  247. package/dist/languages/java/parser.js +492 -0
  248. package/dist/languages/java/parser.js.map +1 -0
  249. package/dist/languages/kotlin/index.d.ts +7 -0
  250. package/dist/languages/kotlin/index.d.ts.map +1 -0
  251. package/dist/languages/kotlin/index.js +7 -0
  252. package/dist/languages/kotlin/index.js.map +1 -0
  253. package/dist/languages/kotlin/parser.d.ts +84 -0
  254. package/dist/languages/kotlin/parser.d.ts.map +1 -0
  255. package/dist/languages/kotlin/parser.js +507 -0
  256. package/dist/languages/kotlin/parser.js.map +1 -0
  257. package/dist/languages/python/index.d.ts +7 -0
  258. package/dist/languages/python/index.d.ts.map +1 -0
  259. package/dist/languages/python/index.js +7 -0
  260. package/dist/languages/python/index.js.map +1 -0
  261. package/dist/languages/python/parser.d.ts +91 -0
  262. package/dist/languages/python/parser.d.ts.map +1 -0
  263. package/dist/languages/python/parser.js +375 -0
  264. package/dist/languages/python/parser.js.map +1 -0
  265. package/dist/languages/registry.d.ts +81 -0
  266. package/dist/languages/registry.d.ts.map +1 -0
  267. package/dist/languages/registry.js +150 -0
  268. package/dist/languages/registry.js.map +1 -0
  269. package/dist/languages/types.d.ts +137 -0
  270. package/dist/languages/types.d.ts.map +1 -0
  271. package/dist/languages/types.js +10 -0
  272. package/dist/languages/types.js.map +1 -0
  273. package/dist/languages/typescript/index.d.ts +7 -0
  274. package/dist/languages/typescript/index.d.ts.map +1 -0
  275. package/dist/languages/typescript/index.js +7 -0
  276. package/dist/languages/typescript/index.js.map +1 -0
  277. package/dist/languages/typescript/parser.d.ts +51 -0
  278. package/dist/languages/typescript/parser.d.ts.map +1 -0
  279. package/dist/languages/typescript/parser.js +286 -0
  280. package/dist/languages/typescript/parser.js.map +1 -0
  281. package/dist/license/generator.d.ts +43 -0
  282. package/dist/license/generator.d.ts.map +1 -0
  283. package/dist/license/generator.js +72 -0
  284. package/dist/license/generator.js.map +1 -0
  285. package/dist/license/index.d.ts +11 -0
  286. package/dist/license/index.d.ts.map +1 -0
  287. package/dist/license/index.js +12 -0
  288. package/dist/license/index.js.map +1 -0
  289. package/dist/license/types.d.ts +85 -0
  290. package/dist/license/types.d.ts.map +1 -0
  291. package/dist/license/types.js +10 -0
  292. package/dist/license/types.js.map +1 -0
  293. package/dist/license/validator.d.ts +77 -0
  294. package/dist/license/validator.d.ts.map +1 -0
  295. package/dist/license/validator.js +275 -0
  296. package/dist/license/validator.js.map +1 -0
  297. package/dist/parser/extractor.d.ts +31 -0
  298. package/dist/parser/extractor.d.ts.map +1 -0
  299. package/dist/parser/extractor.js +10 -0
  300. package/dist/parser/extractor.js.map +1 -0
  301. package/dist/parser/extractors/go.d.ts +21 -0
  302. package/dist/parser/extractors/go.d.ts.map +1 -0
  303. package/dist/parser/extractors/go.js +569 -0
  304. package/dist/parser/extractors/go.js.map +1 -0
  305. package/dist/parser/extractors/index.d.ts +13 -0
  306. package/dist/parser/extractors/index.d.ts.map +1 -0
  307. package/dist/parser/extractors/index.js +13 -0
  308. package/dist/parser/extractors/index.js.map +1 -0
  309. package/dist/parser/extractors/java.d.ts +24 -0
  310. package/dist/parser/extractors/java.d.ts.map +1 -0
  311. package/dist/parser/extractors/java.js +611 -0
  312. package/dist/parser/extractors/java.js.map +1 -0
  313. package/dist/parser/extractors/kotlin.d.ts +25 -0
  314. package/dist/parser/extractors/kotlin.d.ts.map +1 -0
  315. package/dist/parser/extractors/kotlin.js +665 -0
  316. package/dist/parser/extractors/kotlin.js.map +1 -0
  317. package/dist/parser/extractors/python.d.ts +21 -0
  318. package/dist/parser/extractors/python.d.ts.map +1 -0
  319. package/dist/parser/extractors/python.js +514 -0
  320. package/dist/parser/extractors/python.js.map +1 -0
  321. package/dist/parser/extractors/typescript.d.ts +23 -0
  322. package/dist/parser/extractors/typescript.d.ts.map +1 -0
  323. package/dist/parser/extractors/typescript.js +664 -0
  324. package/dist/parser/extractors/typescript.js.map +1 -0
  325. package/dist/parser/index.d.ts +15 -0
  326. package/dist/parser/index.d.ts.map +1 -0
  327. package/dist/parser/index.js +14 -0
  328. package/dist/parser/index.js.map +1 -0
  329. package/dist/parser/manager.d.ts +50 -0
  330. package/dist/parser/manager.d.ts.map +1 -0
  331. package/dist/parser/manager.js +159 -0
  332. package/dist/parser/manager.js.map +1 -0
  333. package/dist/registry/builtins/go-builtins.d.ts +13 -0
  334. package/dist/registry/builtins/go-builtins.d.ts.map +1 -0
  335. package/dist/registry/builtins/go-builtins.js +63 -0
  336. package/dist/registry/builtins/go-builtins.js.map +1 -0
  337. package/dist/registry/builtins/java-builtins.d.ts +10 -0
  338. package/dist/registry/builtins/java-builtins.d.ts.map +1 -0
  339. package/dist/registry/builtins/java-builtins.js +59 -0
  340. package/dist/registry/builtins/java-builtins.js.map +1 -0
  341. package/dist/registry/builtins/kotlin-builtins.d.ts +10 -0
  342. package/dist/registry/builtins/kotlin-builtins.d.ts.map +1 -0
  343. package/dist/registry/builtins/kotlin-builtins.js +38 -0
  344. package/dist/registry/builtins/kotlin-builtins.js.map +1 -0
  345. package/dist/registry/builtins/node-builtins.d.ts +10 -0
  346. package/dist/registry/builtins/node-builtins.d.ts.map +1 -0
  347. package/dist/registry/builtins/node-builtins.js +36 -0
  348. package/dist/registry/builtins/node-builtins.js.map +1 -0
  349. package/dist/registry/builtins/python-builtins.d.ts +10 -0
  350. package/dist/registry/builtins/python-builtins.d.ts.map +1 -0
  351. package/dist/registry/builtins/python-builtins.js +43 -0
  352. package/dist/registry/builtins/python-builtins.js.map +1 -0
  353. package/dist/registry/cache.d.ts +53 -0
  354. package/dist/registry/cache.d.ts.map +1 -0
  355. package/dist/registry/cache.js +147 -0
  356. package/dist/registry/cache.js.map +1 -0
  357. package/dist/registry/go-registry.d.ts +52 -0
  358. package/dist/registry/go-registry.d.ts.map +1 -0
  359. package/dist/registry/go-registry.js +148 -0
  360. package/dist/registry/go-registry.js.map +1 -0
  361. package/dist/registry/index.d.ts +18 -0
  362. package/dist/registry/index.d.ts.map +1 -0
  363. package/dist/registry/index.js +21 -0
  364. package/dist/registry/index.js.map +1 -0
  365. package/dist/registry/maven-registry.d.ts +57 -0
  366. package/dist/registry/maven-registry.d.ts.map +1 -0
  367. package/dist/registry/maven-registry.js +155 -0
  368. package/dist/registry/maven-registry.js.map +1 -0
  369. package/dist/registry/npm-registry.d.ts +40 -0
  370. package/dist/registry/npm-registry.d.ts.map +1 -0
  371. package/dist/registry/npm-registry.js +155 -0
  372. package/dist/registry/npm-registry.js.map +1 -0
  373. package/dist/registry/pypi-registry.d.ts +49 -0
  374. package/dist/registry/pypi-registry.d.ts.map +1 -0
  375. package/dist/registry/pypi-registry.js +175 -0
  376. package/dist/registry/pypi-registry.js.map +1 -0
  377. package/dist/registry/registry-manager.d.ts +45 -0
  378. package/dist/registry/registry-manager.d.ts.map +1 -0
  379. package/dist/registry/registry-manager.js +107 -0
  380. package/dist/registry/registry-manager.js.map +1 -0
  381. package/dist/registry/types.d.ts +83 -0
  382. package/dist/registry/types.d.ts.map +1 -0
  383. package/dist/registry/types.js +12 -0
  384. package/dist/registry/types.js.map +1 -0
  385. package/dist/reporter/html-reporter.d.ts +20 -0
  386. package/dist/reporter/html-reporter.d.ts.map +1 -0
  387. package/dist/reporter/html-reporter.js +612 -0
  388. package/dist/reporter/html-reporter.js.map +1 -0
  389. package/dist/reporter/index.d.ts +28 -0
  390. package/dist/reporter/index.d.ts.map +1 -0
  391. package/dist/reporter/index.js +48 -0
  392. package/dist/reporter/index.js.map +1 -0
  393. package/dist/reporter/markdown-reporter.d.ts +16 -0
  394. package/dist/reporter/markdown-reporter.d.ts.map +1 -0
  395. package/dist/reporter/markdown-reporter.js +182 -0
  396. package/dist/reporter/markdown-reporter.js.map +1 -0
  397. package/dist/reporter/sarif-reporter.d.ts +67 -0
  398. package/dist/reporter/sarif-reporter.d.ts.map +1 -0
  399. package/dist/reporter/sarif-reporter.js +73 -0
  400. package/dist/reporter/sarif-reporter.js.map +1 -0
  401. package/dist/reporter/terminal-reporter.d.ts +14 -0
  402. package/dist/reporter/terminal-reporter.d.ts.map +1 -0
  403. package/dist/reporter/terminal-reporter.js +126 -0
  404. package/dist/reporter/terminal-reporter.js.map +1 -0
  405. package/dist/reporter/types.d.ts +43 -0
  406. package/dist/reporter/types.d.ts.map +1 -0
  407. package/dist/reporter/types.js +10 -0
  408. package/dist/reporter/types.js.map +1 -0
  409. package/dist/reporter/v4-html.d.ts +24 -0
  410. package/dist/reporter/v4-html.d.ts.map +1 -0
  411. package/dist/reporter/v4-html.js +359 -0
  412. package/dist/reporter/v4-html.js.map +1 -0
  413. package/dist/reporter/v4-terminal.d.ts +55 -0
  414. package/dist/reporter/v4-terminal.d.ts.map +1 -0
  415. package/dist/reporter/v4-terminal.js +199 -0
  416. package/dist/reporter/v4-terminal.js.map +1 -0
  417. package/dist/scanner/index.d.ts +9 -0
  418. package/dist/scanner/index.d.ts.map +1 -0
  419. package/dist/scanner/index.js +9 -0
  420. package/dist/scanner/index.js.map +1 -0
  421. package/dist/scanner/v4-scanner.d.ts +162 -0
  422. package/dist/scanner/v4-scanner.d.ts.map +1 -0
  423. package/dist/scanner/v4-scanner.js +327 -0
  424. package/dist/scanner/v4-scanner.js.map +1 -0
  425. package/dist/scorer/report.d.ts +52 -0
  426. package/dist/scorer/report.d.ts.map +1 -0
  427. package/dist/scorer/report.js +347 -0
  428. package/dist/scorer/report.js.map +1 -0
  429. package/dist/scorer/scoring-engine.d.ts +170 -0
  430. package/dist/scorer/scoring-engine.d.ts.map +1 -0
  431. package/dist/scorer/scoring-engine.js +308 -0
  432. package/dist/scorer/scoring-engine.js.map +1 -0
  433. package/dist/scorer/v4-adapter.d.ts +87 -0
  434. package/dist/scorer/v4-adapter.d.ts.map +1 -0
  435. package/dist/scorer/v4-adapter.js +145 -0
  436. package/dist/scorer/v4-adapter.js.map +1 -0
  437. package/dist/sla/index.d.ts +7 -0
  438. package/dist/sla/index.d.ts.map +1 -0
  439. package/dist/sla/index.js +6 -0
  440. package/dist/sla/index.js.map +1 -0
  441. package/dist/sla/tracker.d.ts +70 -0
  442. package/dist/sla/tracker.d.ts.map +1 -0
  443. package/dist/sla/tracker.js +151 -0
  444. package/dist/sla/tracker.js.map +1 -0
  445. package/dist/sla/types.d.ts +67 -0
  446. package/dist/sla/types.d.ts.map +1 -0
  447. package/dist/sla/types.js +42 -0
  448. package/dist/sla/types.js.map +1 -0
  449. package/dist/types.d.ts +172 -0
  450. package/dist/types.d.ts.map +1 -0
  451. package/dist/types.js +69 -0
  452. package/dist/types.js.map +1 -0
  453. package/package.json +97 -0
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Open Code Review V4 — Language Extractor Interface
3
+ *
4
+ * Each supported language implements a LanguageExtractor that converts
5
+ * a tree-sitter CST into the unified CodeUnit IR.
6
+ *
7
+ * @since 0.4.0
8
+ */
9
+ import type Parser from 'web-tree-sitter';
10
+ import type { CodeUnit, SupportedLanguage } from '../ir/types.js';
11
+ /**
12
+ * Interface for language-specific CST → IR extractors.
13
+ *
14
+ * Each language implements this interface to extract CodeUnits from
15
+ * a tree-sitter parse tree. This is the ONLY place where language-specific
16
+ * CST node types should appear.
17
+ */
18
+ export interface LanguageExtractor {
19
+ /** The language this extractor handles */
20
+ readonly language: SupportedLanguage;
21
+ /**
22
+ * Extract CodeUnits from a tree-sitter parse tree.
23
+ *
24
+ * @param tree - The tree-sitter parse tree (CST)
25
+ * @param filePath - Relative file path (used as part of CodeUnit IDs)
26
+ * @param source - Original source code string
27
+ * @returns Array of CodeUnits extracted from the tree
28
+ */
29
+ extract(tree: Parser.Tree, filePath: string, source: string): CodeUnit[];
30
+ }
31
+ //# sourceMappingURL=extractor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractor.d.ts","sourceRoot":"","sources":["../../src/parser/extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAElE;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IAErC;;;;;;;OAOG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,EAAE,CAAC;CAC1E"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Open Code Review V4 — Language Extractor Interface
3
+ *
4
+ * Each supported language implements a LanguageExtractor that converts
5
+ * a tree-sitter CST into the unified CodeUnit IR.
6
+ *
7
+ * @since 0.4.0
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=extractor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractor.js","sourceRoot":"","sources":["../../src/parser/extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Open Code Review V4 — Go Extractor
3
+ *
4
+ * Extracts CodeUnits from Go tree-sitter CSTs.
5
+ * Handles: imports (single, grouped, aliased, dot, blank), functions, methods (with receiver),
6
+ * calls, structs, type declarations, complexity, symbols.
7
+ *
8
+ * @since 0.4.0
9
+ */
10
+ import type Parser from 'web-tree-sitter';
11
+ import type { LanguageExtractor } from '../extractor.js';
12
+ import type { CodeUnit, SupportedLanguage } from '../../ir/types.js';
13
+ export declare class GoExtractor implements LanguageExtractor {
14
+ readonly language: SupportedLanguage;
15
+ extract(tree: Parser.Tree, filePath: string, source: string): CodeUnit[];
16
+ private extractFileImports;
17
+ private extractFileDefinitions;
18
+ private extractFunctions;
19
+ private extractTypeDeclarations;
20
+ }
21
+ //# sourceMappingURL=go.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"go.d.ts","sourceRoot":"","sources":["../../../src/parser/extractors/go.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EACV,QAAQ,EACR,iBAAiB,EAMlB,MAAM,mBAAmB,CAAC;AA8S3B,qBAAa,WAAY,YAAW,iBAAiB;IACnD,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAQ;IAE5C,OAAO,CACL,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,QAAQ,EAAE;IAqCb,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,sBAAsB;IA8E9B,OAAO,CAAC,gBAAgB;IAiJxB,OAAO,CAAC,uBAAuB;CA2EhC"}
@@ -0,0 +1,569 @@
1
+ /**
2
+ * Open Code Review V4 — Go Extractor
3
+ *
4
+ * Extracts CodeUnits from Go tree-sitter CSTs.
5
+ * Handles: imports (single, grouped, aliased, dot, blank), functions, methods (with receiver),
6
+ * calls, structs, type declarations, complexity, symbols.
7
+ *
8
+ * @since 0.4.0
9
+ */
10
+ import { createCodeUnit } from '../../ir/types.js';
11
+ // ─── Tree-sitter node type constants ───────────────────────────────
12
+ /** Node types that represent branching (for cyclomatic complexity) */
13
+ const BRANCHING_NODES = new Set([
14
+ 'if_statement',
15
+ 'for_statement',
16
+ 'expression_switch_statement',
17
+ 'type_switch_statement',
18
+ 'expression_case',
19
+ 'type_case',
20
+ 'communication_case',
21
+ 'select_statement',
22
+ 'binary_expression', // for && and ||
23
+ ]);
24
+ /** Node types that increase nesting depth */
25
+ const NESTING_NODES = new Set([
26
+ 'if_statement',
27
+ 'for_statement',
28
+ 'expression_switch_statement',
29
+ 'type_switch_statement',
30
+ 'select_statement',
31
+ ]);
32
+ /** Node types for cognitive complexity */
33
+ const COGNITIVE_NODES = new Set([
34
+ 'if_statement',
35
+ 'for_statement',
36
+ 'expression_switch_statement',
37
+ 'type_switch_statement',
38
+ 'select_statement',
39
+ 'expression_case',
40
+ 'type_case',
41
+ 'communication_case',
42
+ ]);
43
+ // ─── Helper: Get node location ─────────────────────────────────────
44
+ function getLocation(node) {
45
+ return {
46
+ startLine: node.startPosition.row,
47
+ startColumn: node.startPosition.column,
48
+ endLine: node.endPosition.row,
49
+ endColumn: node.endPosition.column,
50
+ };
51
+ }
52
+ // ─── Helper: Count lines of code ───────────────────────────────────
53
+ function countLinesOfCode(source) {
54
+ const lines = source.split('\n');
55
+ let count = 0;
56
+ for (const line of lines) {
57
+ const trimmed = line.trim();
58
+ if (trimmed.length > 0 && !trimmed.startsWith('//') && !trimmed.startsWith('/*') && !trimmed.startsWith('*')) {
59
+ count++;
60
+ }
61
+ }
62
+ return count;
63
+ }
64
+ // ─── Helper: Check if name is exported (capitalized) ───────────────
65
+ function isExportedName(name) {
66
+ if (name.length === 0)
67
+ return false;
68
+ const first = name.charAt(0);
69
+ return first === first.toUpperCase() && first !== first.toLowerCase();
70
+ }
71
+ // ─── Helper: Extract string literal content ────────────────────────
72
+ function extractStringContent(node) {
73
+ // Go string literals: "fmt" or `fmt`
74
+ const text = node.text;
75
+ if (text.startsWith('"') && text.endsWith('"')) {
76
+ return text.slice(1, -1);
77
+ }
78
+ if (text.startsWith('`') && text.endsWith('`')) {
79
+ return text.slice(1, -1);
80
+ }
81
+ return text;
82
+ }
83
+ // ─── Helper: Extract imports from import_declaration ───────────────
84
+ function extractImports(node) {
85
+ const imports = [];
86
+ if (node.type !== 'import_declaration')
87
+ return imports;
88
+ // Can be single: import "fmt"
89
+ // Or grouped: import ( "fmt" ; "os" )
90
+ const specList = node.children.find(c => c.type === 'import_spec_list');
91
+ if (specList) {
92
+ // Grouped imports
93
+ for (const spec of specList.children) {
94
+ if (spec.type === 'import_spec') {
95
+ const info = extractImportSpec(spec);
96
+ if (info)
97
+ imports.push(info);
98
+ }
99
+ }
100
+ }
101
+ else {
102
+ // Single import
103
+ const spec = node.children.find(c => c.type === 'import_spec');
104
+ if (spec) {
105
+ const info = extractImportSpec(spec);
106
+ if (info)
107
+ imports.push(info);
108
+ }
109
+ else {
110
+ // Fallback: look for a string literal directly
111
+ const strNode = node.children.find(c => c.type === 'interpreted_string_literal' || c.type === 'raw_string_literal');
112
+ if (strNode) {
113
+ const modulePath = extractStringContent(strNode);
114
+ imports.push({
115
+ module: modulePath,
116
+ symbols: [],
117
+ line: node.startPosition.row,
118
+ isRelative: modulePath.startsWith('.'),
119
+ raw: node.text,
120
+ });
121
+ }
122
+ }
123
+ }
124
+ return imports;
125
+ }
126
+ function extractImportSpec(spec) {
127
+ const strNode = spec.children.find(c => c.type === 'interpreted_string_literal' || c.type === 'raw_string_literal');
128
+ if (!strNode)
129
+ return null;
130
+ const modulePath = extractStringContent(strNode);
131
+ const symbols = [];
132
+ // Check for alias, dot import, or blank import
133
+ const aliasNode = spec.children.find(c => c.type === 'package_identifier');
134
+ const dotNode = spec.children.find(c => c.type === 'dot');
135
+ const blankNode = spec.children.find(c => c.type === 'blank_identifier');
136
+ if (dotNode) {
137
+ symbols.push('.');
138
+ }
139
+ else if (blankNode) {
140
+ symbols.push('_');
141
+ }
142
+ else if (aliasNode) {
143
+ symbols.push(aliasNode.text);
144
+ }
145
+ return {
146
+ module: modulePath,
147
+ symbols,
148
+ line: spec.startPosition.row,
149
+ isRelative: modulePath.startsWith('.'),
150
+ raw: spec.text,
151
+ };
152
+ }
153
+ // ─── Helper: Extract calls from a subtree ──────────────────────────
154
+ function extractCalls(node) {
155
+ const calls = [];
156
+ function walk(n) {
157
+ if (n.type === 'call_expression') {
158
+ const funcNode = n.children[0];
159
+ const argListNode = n.children.find(c => c.type === 'argument_list');
160
+ if (funcNode) {
161
+ const callee = funcNode.text;
162
+ let object;
163
+ let method;
164
+ if (funcNode.type === 'selector_expression') {
165
+ // e.g., fmt.Println
166
+ const objectNode = funcNode.children[0];
167
+ const fieldNode = funcNode.children.find(c => c.type === 'field_identifier');
168
+ object = objectNode?.text;
169
+ method = fieldNode?.text ?? callee;
170
+ }
171
+ else if (funcNode.type === 'identifier') {
172
+ method = funcNode.text;
173
+ }
174
+ else {
175
+ // Could be a func literal call or other complex expression
176
+ method = callee;
177
+ }
178
+ let argCount = 0;
179
+ if (argListNode) {
180
+ for (const arg of argListNode.children) {
181
+ if (arg.type !== ',' && arg.type !== '(' && arg.type !== ')') {
182
+ argCount++;
183
+ }
184
+ }
185
+ }
186
+ calls.push({
187
+ callee,
188
+ object,
189
+ method,
190
+ line: n.startPosition.row,
191
+ argCount,
192
+ });
193
+ }
194
+ }
195
+ for (let i = 0; i < n.childCount; i++) {
196
+ walk(n.child(i));
197
+ }
198
+ }
199
+ walk(node);
200
+ return calls;
201
+ }
202
+ // ─── Helper: Compute complexity ────────────────────────────────────
203
+ function computeComplexity(node, source) {
204
+ let cyclomatic = 1; // base complexity
205
+ let cognitive = 0;
206
+ let maxDepth = 0;
207
+ function walk(n, nestingDepth) {
208
+ // Cyclomatic complexity
209
+ if (BRANCHING_NODES.has(n.type)) {
210
+ if (n.type === 'binary_expression') {
211
+ const op = n.children.find(c => c.text === '&&' || c.text === '||');
212
+ if (op) {
213
+ cyclomatic++;
214
+ }
215
+ }
216
+ else {
217
+ cyclomatic++;
218
+ }
219
+ }
220
+ // Cognitive complexity
221
+ if (COGNITIVE_NODES.has(n.type)) {
222
+ if (n.type === 'expression_case' ||
223
+ n.type === 'type_case' ||
224
+ n.type === 'communication_case') {
225
+ cognitive += 1; // cases don't get nesting increment
226
+ }
227
+ else {
228
+ cognitive += 1 + nestingDepth;
229
+ }
230
+ }
231
+ if (n.type === 'binary_expression') {
232
+ const op = n.children.find(c => c.text === '&&' || c.text === '||');
233
+ if (op) {
234
+ cognitive += 1;
235
+ }
236
+ }
237
+ // Nesting
238
+ let newDepth = nestingDepth;
239
+ if (NESTING_NODES.has(n.type)) {
240
+ newDepth = nestingDepth + 1;
241
+ if (newDepth > maxDepth)
242
+ maxDepth = newDepth;
243
+ }
244
+ for (let i = 0; i < n.childCount; i++) {
245
+ walk(n.child(i), newDepth);
246
+ }
247
+ }
248
+ walk(node, 0);
249
+ return {
250
+ cyclomaticComplexity: cyclomatic,
251
+ cognitiveComplexity: cognitive,
252
+ maxNestingDepth: maxDepth,
253
+ linesOfCode: countLinesOfCode(source),
254
+ };
255
+ }
256
+ // ─── Helper: Count parameters (Go) ────────────────────────────────
257
+ function countParameters(paramsNode) {
258
+ let count = 0;
259
+ for (const child of paramsNode.children) {
260
+ if (child.type === 'parameter_declaration') {
261
+ // A parameter_declaration can declare multiple params: x, y int
262
+ const identifiers = child.children.filter(c => c.type === 'identifier');
263
+ count += Math.max(identifiers.length, 1);
264
+ }
265
+ else if (child.type === 'variadic_parameter_declaration') {
266
+ count++;
267
+ }
268
+ }
269
+ return count;
270
+ }
271
+ // ─── GoExtractor ───────────────────────────────────────────────────
272
+ export class GoExtractor {
273
+ language = 'go';
274
+ extract(tree, filePath, source) {
275
+ const units = [];
276
+ const root = tree.rootNode;
277
+ // 1. File-level CodeUnit
278
+ const fileImports = this.extractFileImports(root);
279
+ const fileCalls = extractCalls(root);
280
+ const fileDefs = this.extractFileDefinitions(root);
281
+ const fileComplexity = computeComplexity(root, source);
282
+ const fileUnit = createCodeUnit({
283
+ id: `file:${filePath}`,
284
+ file: filePath,
285
+ language: 'go',
286
+ kind: 'file',
287
+ location: getLocation(root),
288
+ source,
289
+ imports: fileImports,
290
+ calls: fileCalls,
291
+ complexity: fileComplexity,
292
+ definitions: fileDefs,
293
+ references: [],
294
+ childIds: [],
295
+ });
296
+ units.push(fileUnit);
297
+ // 2. Extract functions and methods
298
+ this.extractFunctions(root, filePath, fileUnit, units);
299
+ // 3. Extract type declarations (structs, interfaces) as class-like units
300
+ this.extractTypeDeclarations(root, filePath, fileUnit, units);
301
+ return units;
302
+ }
303
+ // ─── File-level imports ──────────────────────────────────────────
304
+ extractFileImports(root) {
305
+ const imports = [];
306
+ for (let i = 0; i < root.childCount; i++) {
307
+ const child = root.child(i);
308
+ if (child.type === 'import_declaration') {
309
+ imports.push(...extractImports(child));
310
+ }
311
+ }
312
+ return imports;
313
+ }
314
+ // ─── File-level definitions ──────────────────────────────────────
315
+ extractFileDefinitions(root) {
316
+ const defs = [];
317
+ for (let i = 0; i < root.childCount; i++) {
318
+ const child = root.child(i);
319
+ if (child.type === 'function_declaration') {
320
+ const nameNode = child.children.find(c => c.type === 'identifier');
321
+ if (nameNode) {
322
+ defs.push({
323
+ name: nameNode.text,
324
+ kind: 'function',
325
+ line: child.startPosition.row,
326
+ exported: isExportedName(nameNode.text),
327
+ });
328
+ }
329
+ }
330
+ else if (child.type === 'method_declaration') {
331
+ const nameNode = child.children.find(c => c.type === 'field_identifier');
332
+ if (nameNode) {
333
+ defs.push({
334
+ name: nameNode.text,
335
+ kind: 'method',
336
+ line: child.startPosition.row,
337
+ exported: isExportedName(nameNode.text),
338
+ });
339
+ }
340
+ }
341
+ else if (child.type === 'type_declaration') {
342
+ for (const spec of child.children) {
343
+ if (spec.type === 'type_spec') {
344
+ const nameNode = spec.children.find(c => c.type === 'type_identifier');
345
+ if (nameNode) {
346
+ defs.push({
347
+ name: nameNode.text,
348
+ kind: 'type',
349
+ line: spec.startPosition.row,
350
+ exported: isExportedName(nameNode.text),
351
+ });
352
+ }
353
+ }
354
+ }
355
+ }
356
+ else if (child.type === 'var_declaration') {
357
+ for (const spec of child.children) {
358
+ if (spec.type === 'var_spec') {
359
+ for (const id of spec.children) {
360
+ if (id.type === 'identifier') {
361
+ defs.push({
362
+ name: id.text,
363
+ kind: 'variable',
364
+ line: spec.startPosition.row,
365
+ exported: isExportedName(id.text),
366
+ });
367
+ }
368
+ }
369
+ }
370
+ }
371
+ }
372
+ else if (child.type === 'const_declaration') {
373
+ for (const spec of child.children) {
374
+ if (spec.type === 'const_spec') {
375
+ for (const id of spec.children) {
376
+ if (id.type === 'identifier') {
377
+ defs.push({
378
+ name: id.text,
379
+ kind: 'variable',
380
+ line: spec.startPosition.row,
381
+ exported: isExportedName(id.text),
382
+ });
383
+ }
384
+ }
385
+ }
386
+ }
387
+ }
388
+ }
389
+ return defs;
390
+ }
391
+ // ─── Extract functions and methods ───────────────────────────────
392
+ extractFunctions(root, filePath, fileUnit, units) {
393
+ for (let i = 0; i < root.childCount; i++) {
394
+ const child = root.child(i);
395
+ if (child.type === 'function_declaration') {
396
+ const nameNode = child.children.find(c => c.type === 'identifier');
397
+ if (!nameNode)
398
+ continue;
399
+ const funcName = nameNode.text;
400
+ const funcId = `func:${filePath}:${funcName}`;
401
+ const funcSource = child.text;
402
+ // Get parameters (first parameter_list is params, second is return types)
403
+ const paramLists = child.children.filter(c => c.type === 'parameter_list');
404
+ const paramsNode = paramLists[0];
405
+ const paramCount = paramsNode ? countParameters(paramsNode) : 0;
406
+ const complexity = computeComplexity(child, funcSource);
407
+ complexity.parameterCount = paramCount;
408
+ const calls = extractCalls(child);
409
+ const funcDefs = [
410
+ {
411
+ name: funcName,
412
+ kind: 'function',
413
+ line: child.startPosition.row,
414
+ exported: isExportedName(funcName),
415
+ },
416
+ ];
417
+ // Extract parameter definitions
418
+ if (paramsNode) {
419
+ for (const param of paramsNode.children) {
420
+ if (param.type === 'parameter_declaration') {
421
+ const ids = param.children.filter(c => c.type === 'identifier');
422
+ for (const id of ids) {
423
+ funcDefs.push({
424
+ name: id.text,
425
+ kind: 'parameter',
426
+ line: param.startPosition.row,
427
+ exported: false,
428
+ });
429
+ }
430
+ }
431
+ }
432
+ }
433
+ const funcUnit = createCodeUnit({
434
+ id: funcId,
435
+ file: filePath,
436
+ language: 'go',
437
+ kind: 'function',
438
+ location: getLocation(child),
439
+ source: funcSource,
440
+ calls,
441
+ complexity,
442
+ definitions: funcDefs,
443
+ parentId: fileUnit.id,
444
+ });
445
+ units.push(funcUnit);
446
+ fileUnit.childIds.push(funcId);
447
+ }
448
+ else if (child.type === 'method_declaration') {
449
+ // Go methods have a receiver parameter list
450
+ const nameNode = child.children.find(c => c.type === 'field_identifier');
451
+ if (!nameNode)
452
+ continue;
453
+ const methodName = nameNode.text;
454
+ // Extract receiver type
455
+ const paramLists = child.children.filter(c => c.type === 'parameter_list');
456
+ const receiverList = paramLists[0]; // First param list is receiver
457
+ const paramsNode = paramLists[1]; // Second is actual params
458
+ let receiverType = '';
459
+ if (receiverList) {
460
+ const paramDecl = receiverList.children.find(c => c.type === 'parameter_declaration');
461
+ if (paramDecl) {
462
+ const typeNode = paramDecl.children.find(c => c.type === 'type_identifier') ??
463
+ paramDecl.children.find(c => c.type === 'pointer_type');
464
+ if (typeNode) {
465
+ if (typeNode.type === 'pointer_type') {
466
+ const inner = typeNode.children.find(c => c.type === 'type_identifier');
467
+ receiverType = inner?.text ?? typeNode.text;
468
+ }
469
+ else {
470
+ receiverType = typeNode.text;
471
+ }
472
+ }
473
+ }
474
+ }
475
+ const paramCount = paramsNode ? countParameters(paramsNode) : 0;
476
+ const methodId = `method:${filePath}:${receiverType}.${methodName}`;
477
+ const methodSource = child.text;
478
+ const complexity = computeComplexity(child, methodSource);
479
+ complexity.parameterCount = paramCount;
480
+ const calls = extractCalls(child);
481
+ const methodDefs = [
482
+ {
483
+ name: methodName,
484
+ kind: 'method',
485
+ line: child.startPosition.row,
486
+ exported: isExportedName(methodName),
487
+ },
488
+ ];
489
+ const methodUnit = createCodeUnit({
490
+ id: methodId,
491
+ file: filePath,
492
+ language: 'go',
493
+ kind: 'method',
494
+ location: getLocation(child),
495
+ source: methodSource,
496
+ calls,
497
+ complexity,
498
+ definitions: methodDefs,
499
+ parentId: fileUnit.id,
500
+ });
501
+ units.push(methodUnit);
502
+ fileUnit.childIds.push(methodId);
503
+ }
504
+ }
505
+ }
506
+ // ─── Extract type declarations (struct, interface) ───────────────
507
+ extractTypeDeclarations(root, filePath, fileUnit, units) {
508
+ for (let i = 0; i < root.childCount; i++) {
509
+ const child = root.child(i);
510
+ if (child.type !== 'type_declaration')
511
+ continue;
512
+ for (const spec of child.children) {
513
+ if (spec.type !== 'type_spec')
514
+ continue;
515
+ const nameNode = spec.children.find(c => c.type === 'type_identifier');
516
+ if (!nameNode)
517
+ continue;
518
+ const typeName = nameNode.text;
519
+ const typeId = `class:${filePath}:${typeName}`;
520
+ const typeSource = child.text;
521
+ const typeCalls = extractCalls(child);
522
+ const typeComplexity = computeComplexity(child, typeSource);
523
+ const typeDefs = [
524
+ {
525
+ name: typeName,
526
+ kind: 'type',
527
+ line: spec.startPosition.row,
528
+ exported: isExportedName(typeName),
529
+ },
530
+ ];
531
+ // Extract struct field definitions
532
+ const structType = spec.children.find(c => c.type === 'struct_type');
533
+ if (structType) {
534
+ const fieldList = structType.children.find(c => c.type === 'field_declaration_list');
535
+ if (fieldList) {
536
+ for (const field of fieldList.children) {
537
+ if (field.type === 'field_declaration') {
538
+ const fieldName = field.children.find(c => c.type === 'field_identifier');
539
+ if (fieldName) {
540
+ typeDefs.push({
541
+ name: fieldName.text,
542
+ kind: 'variable',
543
+ line: field.startPosition.row,
544
+ exported: isExportedName(fieldName.text),
545
+ });
546
+ }
547
+ }
548
+ }
549
+ }
550
+ }
551
+ const typeUnit = createCodeUnit({
552
+ id: typeId,
553
+ file: filePath,
554
+ language: 'go',
555
+ kind: 'class',
556
+ location: getLocation(child),
557
+ source: typeSource,
558
+ calls: typeCalls,
559
+ complexity: typeComplexity,
560
+ definitions: typeDefs,
561
+ parentId: fileUnit.id,
562
+ });
563
+ units.push(typeUnit);
564
+ fileUnit.childIds.push(typeId);
565
+ }
566
+ }
567
+ }
568
+ }
569
+ //# sourceMappingURL=go.js.map