@greyworld/code-check-core 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (309) hide show
  1. package/dist/facade/code-checker.d.ts +14 -0
  2. package/dist/facade/code-checker.d.ts.map +1 -0
  3. package/dist/facade/code-checker.js +63 -0
  4. package/dist/facade/code-checker.js.map +1 -0
  5. package/dist/facade/index.d.ts +3 -0
  6. package/dist/facade/index.d.ts.map +1 -0
  7. package/dist/facade/index.js +6 -0
  8. package/dist/facade/index.js.map +1 -0
  9. package/dist/facade/types.d.ts +24 -0
  10. package/dist/facade/types.d.ts.map +1 -0
  11. package/dist/facade/types.js +3 -0
  12. package/dist/facade/types.js.map +1 -0
  13. package/dist/index.d.ts +3 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +7 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/tools/ast-parser/go/index.d.ts +3 -0
  18. package/dist/tools/ast-parser/go/index.d.ts.map +1 -0
  19. package/dist/tools/ast-parser/go/index.js +6 -0
  20. package/dist/tools/ast-parser/go/index.js.map +1 -0
  21. package/dist/tools/ast-parser/go/parser.d.ts +56 -0
  22. package/dist/tools/ast-parser/go/parser.d.ts.map +1 -0
  23. package/dist/tools/ast-parser/go/parser.js +147 -0
  24. package/dist/tools/ast-parser/go/parser.js.map +1 -0
  25. package/dist/tools/ast-parser/go/schema-extractor.d.ts +103 -0
  26. package/dist/tools/ast-parser/go/schema-extractor.d.ts.map +1 -0
  27. package/dist/tools/ast-parser/go/schema-extractor.js +487 -0
  28. package/dist/tools/ast-parser/go/schema-extractor.js.map +1 -0
  29. package/dist/tools/ast-parser/go/semantic-normalizer.d.ts +51 -0
  30. package/dist/tools/ast-parser/go/semantic-normalizer.d.ts.map +1 -0
  31. package/dist/tools/ast-parser/go/semantic-normalizer.js +263 -0
  32. package/dist/tools/ast-parser/go/semantic-normalizer.js.map +1 -0
  33. package/dist/tools/ast-parser/go/types.d.ts +131 -0
  34. package/dist/tools/ast-parser/go/types.d.ts.map +1 -0
  35. package/dist/tools/ast-parser/go/types.js +3 -0
  36. package/dist/tools/ast-parser/go/types.js.map +1 -0
  37. package/dist/tools/ast-parser/markdown/index.d.ts +28 -0
  38. package/dist/tools/ast-parser/markdown/index.d.ts.map +1 -0
  39. package/dist/tools/ast-parser/markdown/index.js +31 -0
  40. package/dist/tools/ast-parser/markdown/index.js.map +1 -0
  41. package/dist/tools/ast-parser/markdown/parser.d.ts +271 -0
  42. package/dist/tools/ast-parser/markdown/parser.d.ts.map +1 -0
  43. package/dist/tools/ast-parser/markdown/parser.js +613 -0
  44. package/dist/tools/ast-parser/markdown/parser.js.map +1 -0
  45. package/dist/tools/ast-parser/markdown/types.d.ts +131 -0
  46. package/dist/tools/ast-parser/markdown/types.d.ts.map +1 -0
  47. package/dist/tools/ast-parser/markdown/types.js +3 -0
  48. package/dist/tools/ast-parser/markdown/types.js.map +1 -0
  49. package/dist/tools/env/index.d.ts +2 -0
  50. package/dist/tools/env/index.d.ts.map +1 -0
  51. package/dist/tools/env/index.js +6 -0
  52. package/dist/tools/env/index.js.map +1 -0
  53. package/dist/tools/env/load-env.d.ts +9 -0
  54. package/dist/tools/env/load-env.d.ts.map +1 -0
  55. package/dist/tools/env/load-env.js +39 -0
  56. package/dist/tools/env/load-env.js.map +1 -0
  57. package/dist/tools/line-pattern/index.d.ts +15 -0
  58. package/dist/tools/line-pattern/index.d.ts.map +1 -0
  59. package/dist/tools/line-pattern/index.js +25 -0
  60. package/dist/tools/line-pattern/index.js.map +1 -0
  61. package/dist/tools/line-pattern/line-pattern.d.ts +53 -0
  62. package/dist/tools/line-pattern/line-pattern.d.ts.map +1 -0
  63. package/dist/tools/line-pattern/line-pattern.js +88 -0
  64. package/dist/tools/line-pattern/line-pattern.js.map +1 -0
  65. package/dist/tools/line-pattern/segment.d.ts +24 -0
  66. package/dist/tools/line-pattern/segment.d.ts.map +1 -0
  67. package/dist/tools/line-pattern/segment.js +15 -0
  68. package/dist/tools/line-pattern/segment.js.map +1 -0
  69. package/dist/tools/line-pattern/segments.d.ts +43 -0
  70. package/dist/tools/line-pattern/segments.d.ts.map +1 -0
  71. package/dist/tools/line-pattern/segments.js +91 -0
  72. package/dist/tools/line-pattern/segments.js.map +1 -0
  73. package/dist/tools/llm/description-intent/format-spec.d.ts +3 -0
  74. package/dist/tools/llm/description-intent/format-spec.d.ts.map +1 -0
  75. package/dist/tools/llm/description-intent/format-spec.js +167 -0
  76. package/dist/tools/llm/description-intent/format-spec.js.map +1 -0
  77. package/dist/tools/llm/description-intent/index.d.ts +7 -0
  78. package/dist/tools/llm/description-intent/index.d.ts.map +1 -0
  79. package/dist/tools/llm/description-intent/index.js +15 -0
  80. package/dist/tools/llm/description-intent/index.js.map +1 -0
  81. package/dist/tools/llm/description-intent/intent-detector.d.ts +8 -0
  82. package/dist/tools/llm/description-intent/intent-detector.d.ts.map +1 -0
  83. package/dist/tools/llm/description-intent/intent-detector.js +103 -0
  84. package/dist/tools/llm/description-intent/intent-detector.js.map +1 -0
  85. package/dist/tools/llm/description-intent/normalizer.d.ts +12 -0
  86. package/dist/tools/llm/description-intent/normalizer.d.ts.map +1 -0
  87. package/dist/tools/llm/description-intent/normalizer.js +73 -0
  88. package/dist/tools/llm/description-intent/normalizer.js.map +1 -0
  89. package/dist/tools/llm/description-intent/slot-extractor.d.ts +3 -0
  90. package/dist/tools/llm/description-intent/slot-extractor.d.ts.map +1 -0
  91. package/dist/tools/llm/description-intent/slot-extractor.js +66 -0
  92. package/dist/tools/llm/description-intent/slot-extractor.js.map +1 -0
  93. package/dist/tools/llm/description-intent/types.d.ts +28 -0
  94. package/dist/tools/llm/description-intent/types.d.ts.map +1 -0
  95. package/dist/tools/llm/description-intent/types.js +19 -0
  96. package/dist/tools/llm/description-intent/types.js.map +1 -0
  97. package/dist/tools/llm/index.d.ts +16 -0
  98. package/dist/tools/llm/index.d.ts.map +1 -0
  99. package/dist/tools/llm/index.js +26 -0
  100. package/dist/tools/llm/index.js.map +1 -0
  101. package/dist/tools/llm/model.d.ts +3 -0
  102. package/dist/tools/llm/model.d.ts.map +1 -0
  103. package/dist/tools/llm/model.js +18 -0
  104. package/dist/tools/llm/model.js.map +1 -0
  105. package/dist/tools/llm/structured-caller.d.ts +86 -0
  106. package/dist/tools/llm/structured-caller.d.ts.map +1 -0
  107. package/dist/tools/llm/structured-caller.js +181 -0
  108. package/dist/tools/llm/structured-caller.js.map +1 -0
  109. package/dist/tools/node-pattern/index.d.ts +17 -0
  110. package/dist/tools/node-pattern/index.d.ts.map +1 -0
  111. package/dist/tools/node-pattern/index.js +36 -0
  112. package/dist/tools/node-pattern/index.js.map +1 -0
  113. package/dist/tools/node-pattern/matchers.d.ts +61 -0
  114. package/dist/tools/node-pattern/matchers.d.ts.map +1 -0
  115. package/dist/tools/node-pattern/matchers.js +154 -0
  116. package/dist/tools/node-pattern/matchers.js.map +1 -0
  117. package/dist/tools/node-pattern/node-matcher.d.ts +69 -0
  118. package/dist/tools/node-pattern/node-matcher.d.ts.map +1 -0
  119. package/dist/tools/node-pattern/node-matcher.js +122 -0
  120. package/dist/tools/node-pattern/node-matcher.js.map +1 -0
  121. package/dist/tools/node-pattern/node-pattern.d.ts +65 -0
  122. package/dist/tools/node-pattern/node-pattern.d.ts.map +1 -0
  123. package/dist/tools/node-pattern/node-pattern.js +129 -0
  124. package/dist/tools/node-pattern/node-pattern.js.map +1 -0
  125. package/dist/tools/section-check/index.d.ts +4 -0
  126. package/dist/tools/section-check/index.d.ts.map +1 -0
  127. package/dist/tools/section-check/index.js +10 -0
  128. package/dist/tools/section-check/index.js.map +1 -0
  129. package/dist/tools/section-check/section-check.d.ts +46 -0
  130. package/dist/tools/section-check/section-check.d.ts.map +1 -0
  131. package/dist/tools/section-check/section-check.js +264 -0
  132. package/dist/tools/section-check/section-check.js.map +1 -0
  133. package/dist/tools/section-check/types.d.ts +35 -0
  134. package/dist/tools/section-check/types.d.ts.map +1 -0
  135. package/dist/tools/section-check/types.js +23 -0
  136. package/dist/tools/section-check/types.js.map +1 -0
  137. package/dist/tools/text-grep/index.d.ts +10 -0
  138. package/dist/tools/text-grep/index.d.ts.map +1 -0
  139. package/dist/tools/text-grep/index.js +13 -0
  140. package/dist/tools/text-grep/index.js.map +1 -0
  141. package/dist/tools/text-grep/regex-grep.d.ts +92 -0
  142. package/dist/tools/text-grep/regex-grep.d.ts.map +1 -0
  143. package/dist/tools/text-grep/regex-grep.js +141 -0
  144. package/dist/tools/text-grep/regex-grep.js.map +1 -0
  145. package/dist/workflow/context/context.d.ts +13 -0
  146. package/dist/workflow/context/context.d.ts.map +1 -0
  147. package/dist/workflow/context/context.js +29 -0
  148. package/dist/workflow/context/context.js.map +1 -0
  149. package/dist/workflow/implement/resource-check/context-keys.d.ts +30 -0
  150. package/dist/workflow/implement/resource-check/context-keys.d.ts.map +1 -0
  151. package/dist/workflow/implement/resource-check/context-keys.js +33 -0
  152. package/dist/workflow/implement/resource-check/context-keys.js.map +1 -0
  153. package/dist/workflow/implement/resource-check/resource-check-workflow.d.ts +20 -0
  154. package/dist/workflow/implement/resource-check/resource-check-workflow.d.ts.map +1 -0
  155. package/dist/workflow/implement/resource-check/resource-check-workflow.js +325 -0
  156. package/dist/workflow/implement/resource-check/resource-check-workflow.js.map +1 -0
  157. package/dist/workflow/implement/resource-check/rules/index.d.ts +5 -0
  158. package/dist/workflow/implement/resource-check/rules/index.d.ts.map +1 -0
  159. package/dist/workflow/implement/resource-check/rules/index.js +21 -0
  160. package/dist/workflow/implement/resource-check/rules/index.js.map +1 -0
  161. package/dist/workflow/implement/resource-check/rules/markdown-format/arguments/argument-section-format-rule.d.ts +8 -0
  162. package/dist/workflow/implement/resource-check/rules/markdown-format/arguments/argument-section-format-rule.d.ts.map +1 -0
  163. package/dist/workflow/implement/resource-check/rules/markdown-format/arguments/argument-section-format-rule.js +51 -0
  164. package/dist/workflow/implement/resource-check/rules/markdown-format/arguments/argument-section-format-rule.js.map +1 -0
  165. package/dist/workflow/implement/resource-check/rules/markdown-format/attributes/attribute-section-format-rule.d.ts +8 -0
  166. package/dist/workflow/implement/resource-check/rules/markdown-format/attributes/attribute-section-format-rule.d.ts.map +1 -0
  167. package/dist/workflow/implement/resource-check/rules/markdown-format/attributes/attribute-section-format-rule.js +60 -0
  168. package/dist/workflow/implement/resource-check/rules/markdown-format/attributes/attribute-section-format-rule.js.map +1 -0
  169. package/dist/workflow/implement/resource-check/rules/markdown-format/blank-line-between-blocks-rule.d.ts +9 -0
  170. package/dist/workflow/implement/resource-check/rules/markdown-format/blank-line-between-blocks-rule.d.ts.map +1 -0
  171. package/dist/workflow/implement/resource-check/rules/markdown-format/blank-line-between-blocks-rule.js +80 -0
  172. package/dist/workflow/implement/resource-check/rules/markdown-format/blank-line-between-blocks-rule.js.map +1 -0
  173. package/dist/workflow/implement/resource-check/rules/markdown-format/example/example-section-exists-rule.d.ts +8 -0
  174. package/dist/workflow/implement/resource-check/rules/markdown-format/example/example-section-exists-rule.d.ts.map +1 -0
  175. package/dist/workflow/implement/resource-check/rules/markdown-format/example/example-section-exists-rule.js +42 -0
  176. package/dist/workflow/implement/resource-check/rules/markdown-format/example/example-section-exists-rule.js.map +1 -0
  177. package/dist/workflow/implement/resource-check/rules/markdown-format/example-section-exists-rule.d.ts +8 -0
  178. package/dist/workflow/implement/resource-check/rules/markdown-format/example-section-exists-rule.d.ts.map +1 -0
  179. package/dist/workflow/implement/resource-check/rules/markdown-format/example-section-exists-rule.js +34 -0
  180. package/dist/workflow/implement/resource-check/rules/markdown-format/example-section-exists-rule.js.map +1 -0
  181. package/dist/workflow/implement/resource-check/rules/markdown-format/frontmatter/frontmatter-check-rule.d.ts +8 -0
  182. package/dist/workflow/implement/resource-check/rules/markdown-format/frontmatter/frontmatter-check-rule.d.ts.map +1 -0
  183. package/dist/workflow/implement/resource-check/rules/markdown-format/frontmatter/frontmatter-check-rule.js +33 -0
  184. package/dist/workflow/implement/resource-check/rules/markdown-format/frontmatter/frontmatter-check-rule.js.map +1 -0
  185. package/dist/workflow/implement/resource-check/rules/markdown-format/frontmatter-check-rule.d.ts +8 -0
  186. package/dist/workflow/implement/resource-check/rules/markdown-format/frontmatter-check-rule.d.ts.map +1 -0
  187. package/dist/workflow/implement/resource-check/rules/markdown-format/frontmatter-check-rule.js +33 -0
  188. package/dist/workflow/implement/resource-check/rules/markdown-format/frontmatter-check-rule.js.map +1 -0
  189. package/dist/workflow/implement/resource-check/rules/markdown-format/h1-exists-rule.d.ts +8 -0
  190. package/dist/workflow/implement/resource-check/rules/markdown-format/h1-exists-rule.d.ts.map +1 -0
  191. package/dist/workflow/implement/resource-check/rules/markdown-format/h1-exists-rule.js +34 -0
  192. package/dist/workflow/implement/resource-check/rules/markdown-format/h1-exists-rule.js.map +1 -0
  193. package/dist/workflow/implement/resource-check/rules/markdown-format/index.d.ts +11 -0
  194. package/dist/workflow/implement/resource-check/rules/markdown-format/index.d.ts.map +1 -0
  195. package/dist/workflow/implement/resource-check/rules/markdown-format/index.js +38 -0
  196. package/dist/workflow/implement/resource-check/rules/markdown-format/index.js.map +1 -0
  197. package/dist/workflow/implement/resource-check/rules/markdown-format/line-length-rule.d.ts +15 -0
  198. package/dist/workflow/implement/resource-check/rules/markdown-format/line-length-rule.d.ts.map +1 -0
  199. package/dist/workflow/implement/resource-check/rules/markdown-format/line-length-rule.js +77 -0
  200. package/dist/workflow/implement/resource-check/rules/markdown-format/line-length-rule.js.map +1 -0
  201. package/dist/workflow/implement/resource-check/rules/markdown-format/number-format-rule.d.ts +23 -0
  202. package/dist/workflow/implement/resource-check/rules/markdown-format/number-format-rule.d.ts.map +1 -0
  203. package/dist/workflow/implement/resource-check/rules/markdown-format/number-format-rule.js +128 -0
  204. package/dist/workflow/implement/resource-check/rules/markdown-format/number-format-rule.js.map +1 -0
  205. package/dist/workflow/implement/resource-check/rules/markdown-format/shared/section-check-result.d.ts +9 -0
  206. package/dist/workflow/implement/resource-check/rules/markdown-format/shared/section-check-result.d.ts.map +1 -0
  207. package/dist/workflow/implement/resource-check/rules/markdown-format/shared/section-check-result.js +19 -0
  208. package/dist/workflow/implement/resource-check/rules/markdown-format/shared/section-check-result.js.map +1 -0
  209. package/dist/workflow/implement/resource-check/rules/markdown-format/title/h1-exists-rule.d.ts +8 -0
  210. package/dist/workflow/implement/resource-check/rules/markdown-format/title/h1-exists-rule.d.ts.map +1 -0
  211. package/dist/workflow/implement/resource-check/rules/markdown-format/title/h1-exists-rule.js +44 -0
  212. package/dist/workflow/implement/resource-check/rules/markdown-format/title/h1-exists-rule.js.map +1 -0
  213. package/dist/workflow/implement/resource-check/rules/markdown-format/total/blank-line-between-blocks-rule.d.ts +9 -0
  214. package/dist/workflow/implement/resource-check/rules/markdown-format/total/blank-line-between-blocks-rule.d.ts.map +1 -0
  215. package/dist/workflow/implement/resource-check/rules/markdown-format/total/blank-line-between-blocks-rule.js +80 -0
  216. package/dist/workflow/implement/resource-check/rules/markdown-format/total/blank-line-between-blocks-rule.js.map +1 -0
  217. package/dist/workflow/implement/resource-check/rules/markdown-format/total/line-length-rule.d.ts +15 -0
  218. package/dist/workflow/implement/resource-check/rules/markdown-format/total/line-length-rule.d.ts.map +1 -0
  219. package/dist/workflow/implement/resource-check/rules/markdown-format/total/line-length-rule.js +77 -0
  220. package/dist/workflow/implement/resource-check/rules/markdown-format/total/line-length-rule.js.map +1 -0
  221. package/dist/workflow/implement/resource-check/rules/markdown-format/total/number-format-rule.d.ts +23 -0
  222. package/dist/workflow/implement/resource-check/rules/markdown-format/total/number-format-rule.d.ts.map +1 -0
  223. package/dist/workflow/implement/resource-check/rules/markdown-format/total/number-format-rule.js +128 -0
  224. package/dist/workflow/implement/resource-check/rules/markdown-format/total/number-format-rule.js.map +1 -0
  225. package/dist/workflow/implement/resource-check/rules/markdown-semantic/argument-section-semantic-rule.d.ts +11 -0
  226. package/dist/workflow/implement/resource-check/rules/markdown-semantic/argument-section-semantic-rule.d.ts.map +1 -0
  227. package/dist/workflow/implement/resource-check/rules/markdown-semantic/argument-section-semantic-rule.js +145 -0
  228. package/dist/workflow/implement/resource-check/rules/markdown-semantic/argument-section-semantic-rule.js.map +1 -0
  229. package/dist/workflow/implement/resource-check/rules/markdown-semantic/arguments/argument-section-semantic-rule.d.ts +11 -0
  230. package/dist/workflow/implement/resource-check/rules/markdown-semantic/arguments/argument-section-semantic-rule.d.ts.map +1 -0
  231. package/dist/workflow/implement/resource-check/rules/markdown-semantic/arguments/argument-section-semantic-rule.js +145 -0
  232. package/dist/workflow/implement/resource-check/rules/markdown-semantic/arguments/argument-section-semantic-rule.js.map +1 -0
  233. package/dist/workflow/implement/resource-check/rules/markdown-semantic/attribute-section-semantic-rule.d.ts +9 -0
  234. package/dist/workflow/implement/resource-check/rules/markdown-semantic/attribute-section-semantic-rule.d.ts.map +1 -0
  235. package/dist/workflow/implement/resource-check/rules/markdown-semantic/attribute-section-semantic-rule.js +83 -0
  236. package/dist/workflow/implement/resource-check/rules/markdown-semantic/attribute-section-semantic-rule.js.map +1 -0
  237. package/dist/workflow/implement/resource-check/rules/markdown-semantic/attributes/attribute-section-semantic-rule.d.ts +9 -0
  238. package/dist/workflow/implement/resource-check/rules/markdown-semantic/attributes/attribute-section-semantic-rule.d.ts.map +1 -0
  239. package/dist/workflow/implement/resource-check/rules/markdown-semantic/attributes/attribute-section-semantic-rule.js +83 -0
  240. package/dist/workflow/implement/resource-check/rules/markdown-semantic/attributes/attribute-section-semantic-rule.js.map +1 -0
  241. package/dist/workflow/implement/resource-check/rules/markdown-semantic/index.d.ts +7 -0
  242. package/dist/workflow/implement/resource-check/rules/markdown-semantic/index.d.ts.map +1 -0
  243. package/dist/workflow/implement/resource-check/rules/markdown-semantic/index.js +15 -0
  244. package/dist/workflow/implement/resource-check/rules/markdown-semantic/index.js.map +1 -0
  245. package/dist/workflow/implement/resource-check/rules/markdown-semantic/section-existence-rule.d.ts +9 -0
  246. package/dist/workflow/implement/resource-check/rules/markdown-semantic/section-existence-rule.d.ts.map +1 -0
  247. package/dist/workflow/implement/resource-check/rules/markdown-semantic/section-existence-rule.js +96 -0
  248. package/dist/workflow/implement/resource-check/rules/markdown-semantic/section-existence-rule.js.map +1 -0
  249. package/dist/workflow/implement/resource-check/rules/markdown-semantic/total/section-existence-rule.d.ts +9 -0
  250. package/dist/workflow/implement/resource-check/rules/markdown-semantic/total/section-existence-rule.d.ts.map +1 -0
  251. package/dist/workflow/implement/resource-check/rules/markdown-semantic/total/section-existence-rule.js +109 -0
  252. package/dist/workflow/implement/resource-check/rules/markdown-semantic/total/section-existence-rule.js.map +1 -0
  253. package/dist/workflow/implement/resource-check/rules/stage-placeholder-rule.d.ts +19 -0
  254. package/dist/workflow/implement/resource-check/rules/stage-placeholder-rule.d.ts.map +1 -0
  255. package/dist/workflow/implement/resource-check/rules/stage-placeholder-rule.js +31 -0
  256. package/dist/workflow/implement/resource-check/rules/stage-placeholder-rule.js.map +1 -0
  257. package/dist/workflow/implement/resource-check/tools/doc-semantic/builder.d.ts +15 -0
  258. package/dist/workflow/implement/resource-check/tools/doc-semantic/builder.d.ts.map +1 -0
  259. package/dist/workflow/implement/resource-check/tools/doc-semantic/builder.js +554 -0
  260. package/dist/workflow/implement/resource-check/tools/doc-semantic/builder.js.map +1 -0
  261. package/dist/workflow/implement/resource-check/tools/doc-semantic/index.d.ts +5 -0
  262. package/dist/workflow/implement/resource-check/tools/doc-semantic/index.d.ts.map +1 -0
  263. package/dist/workflow/implement/resource-check/tools/doc-semantic/index.js +16 -0
  264. package/dist/workflow/implement/resource-check/tools/doc-semantic/index.js.map +1 -0
  265. package/dist/workflow/implement/resource-check/tools/doc-semantic/types.d.ts +94 -0
  266. package/dist/workflow/implement/resource-check/tools/doc-semantic/types.d.ts.map +1 -0
  267. package/dist/workflow/implement/resource-check/tools/doc-semantic/types.js +42 -0
  268. package/dist/workflow/implement/resource-check/tools/doc-semantic/types.js.map +1 -0
  269. package/dist/workflow/implement/resource-check/tools/schema-semantic/builder.d.ts +4 -0
  270. package/dist/workflow/implement/resource-check/tools/schema-semantic/builder.d.ts.map +1 -0
  271. package/dist/workflow/implement/resource-check/tools/schema-semantic/builder.js +103 -0
  272. package/dist/workflow/implement/resource-check/tools/schema-semantic/builder.js.map +1 -0
  273. package/dist/workflow/implement/resource-check/tools/schema-semantic/index.d.ts +3 -0
  274. package/dist/workflow/implement/resource-check/tools/schema-semantic/index.d.ts.map +1 -0
  275. package/dist/workflow/implement/resource-check/tools/schema-semantic/index.js +6 -0
  276. package/dist/workflow/implement/resource-check/tools/schema-semantic/index.js.map +1 -0
  277. package/dist/workflow/implement/resource-check/tools/schema-semantic/types.d.ts +47 -0
  278. package/dist/workflow/implement/resource-check/tools/schema-semantic/types.d.ts.map +1 -0
  279. package/dist/workflow/implement/resource-check/tools/schema-semantic/types.js +3 -0
  280. package/dist/workflow/implement/resource-check/tools/schema-semantic/types.js.map +1 -0
  281. package/dist/workflow/implement/resource-check/tools/terraform-schema/index.d.ts +4 -0
  282. package/dist/workflow/implement/resource-check/tools/terraform-schema/index.d.ts.map +1 -0
  283. package/dist/workflow/implement/resource-check/tools/terraform-schema/index.js +8 -0
  284. package/dist/workflow/implement/resource-check/tools/terraform-schema/index.js.map +1 -0
  285. package/dist/workflow/implement/resource-check/tools/terraform-schema/schema-extractor.d.ts +108 -0
  286. package/dist/workflow/implement/resource-check/tools/terraform-schema/schema-extractor.d.ts.map +1 -0
  287. package/dist/workflow/implement/resource-check/tools/terraform-schema/schema-extractor.js +498 -0
  288. package/dist/workflow/implement/resource-check/tools/terraform-schema/schema-extractor.js.map +1 -0
  289. package/dist/workflow/implement/resource-check/tools/terraform-schema/semantic-normalizer.d.ts +51 -0
  290. package/dist/workflow/implement/resource-check/tools/terraform-schema/semantic-normalizer.d.ts.map +1 -0
  291. package/dist/workflow/implement/resource-check/tools/terraform-schema/semantic-normalizer.js +271 -0
  292. package/dist/workflow/implement/resource-check/tools/terraform-schema/semantic-normalizer.js.map +1 -0
  293. package/dist/workflow/implement/resource-check/tools/terraform-schema/types.d.ts +133 -0
  294. package/dist/workflow/implement/resource-check/tools/terraform-schema/types.d.ts.map +1 -0
  295. package/dist/workflow/implement/resource-check/tools/terraform-schema/types.js +3 -0
  296. package/dist/workflow/implement/resource-check/tools/terraform-schema/types.js.map +1 -0
  297. package/dist/workflow/implement/resource-check/types.d.ts +18 -0
  298. package/dist/workflow/implement/resource-check/types.d.ts.map +1 -0
  299. package/dist/workflow/implement/resource-check/types.js +107 -0
  300. package/dist/workflow/implement/resource-check/types.js.map +1 -0
  301. package/dist/workflow/types/rule/rule.d.ts +72 -0
  302. package/dist/workflow/types/rule/rule.d.ts.map +1 -0
  303. package/dist/workflow/types/rule/rule.js +110 -0
  304. package/dist/workflow/types/rule/rule.js.map +1 -0
  305. package/dist/workflow/workflow.d.ts +52 -0
  306. package/dist/workflow/workflow.d.ts.map +1 -0
  307. package/dist/workflow/workflow.js +121 -0
  308. package/dist/workflow/workflow.js.map +1 -0
  309. package/package.json +36 -0
@@ -0,0 +1,14 @@
1
+ import { Workflow } from "../workflow/workflow";
2
+ import { CodeCheckerConfig, CheckOptions, CheckReport, WorkflowInfo } from "./types";
3
+ export declare class CodeChecker {
4
+ private workflows;
5
+ private config;
6
+ private initialized;
7
+ constructor(config?: CodeCheckerConfig);
8
+ initialize(): Promise<void>;
9
+ registerWorkflow(workflow: Workflow): void;
10
+ listWorkflows(): WorkflowInfo[];
11
+ check(options: CheckOptions): Promise<CheckReport>;
12
+ private ensureInitialized;
13
+ }
14
+ //# sourceMappingURL=code-checker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-checker.d.ts","sourceRoot":"","sources":["../../src/facade/code-checker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,YAAY,EACb,MAAM,SAAS,CAAC;AAEjB,qBAAa,WAAW;IACtB,OAAO,CAAC,SAAS,CAA+B;IAChD,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,WAAW,CAAS;gBAEhB,MAAM,GAAE,iBAAsB;IAI7B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAuBjC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAO1C,aAAa,IAAI,YAAY,EAAE;IAWzB,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IAkB/D,OAAO,CAAC,iBAAiB;CAO1B"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CodeChecker = void 0;
4
+ const resource_check_workflow_1 = require("../workflow/implement/resource-check/resource-check-workflow");
5
+ class CodeChecker {
6
+ constructor(config = {}) {
7
+ this.workflows = new Map();
8
+ this.initialized = false;
9
+ this.config = config;
10
+ }
11
+ async initialize() {
12
+ if (this.initialized)
13
+ return;
14
+ if (this.config.llm) {
15
+ if (this.config.llm.apiKey) {
16
+ process.env.DASHSCOPE_API_KEY = this.config.llm.apiKey;
17
+ }
18
+ if (this.config.llm.baseUrl) {
19
+ process.env.DASHSCOPE_BASE_URL = this.config.llm.baseUrl;
20
+ }
21
+ if (this.config.llm.model) {
22
+ process.env.QWEN_MODEL = this.config.llm.model;
23
+ }
24
+ }
25
+ // Register built-in workflows (public behavior, internal implementation).
26
+ this.registerWorkflow(new resource_check_workflow_1.ResourceCheckWorkflow());
27
+ this.initialized = true;
28
+ }
29
+ // ── Workflow management ──
30
+ registerWorkflow(workflow) {
31
+ if (this.workflows.has(workflow.id)) {
32
+ throw new Error(`Workflow "${workflow.id}" is already registered`);
33
+ }
34
+ this.workflows.set(workflow.id, workflow);
35
+ }
36
+ listWorkflows() {
37
+ return Array.from(this.workflows.values()).map((wf) => ({
38
+ id: wf.id,
39
+ description: wf.description,
40
+ ruleCount: wf.getRules().length,
41
+ ruleNames: wf.getRules().map((r) => r.name),
42
+ }));
43
+ }
44
+ // ── Check ──
45
+ async check(options) {
46
+ this.ensureInitialized();
47
+ const { code, workflowId } = options;
48
+ const workflow = this.workflows.get(workflowId);
49
+ if (!workflow) {
50
+ throw new Error(`Workflow "${workflowId}" not found. ` +
51
+ `Available: ${Array.from(this.workflows.keys()).join(", ")}`);
52
+ }
53
+ const results = await workflow.run(code);
54
+ return { workflowId, results };
55
+ }
56
+ ensureInitialized() {
57
+ if (!this.initialized) {
58
+ throw new Error("CodeChecker is not initialized. Call initialize() first.");
59
+ }
60
+ }
61
+ }
62
+ exports.CodeChecker = CodeChecker;
63
+ //# sourceMappingURL=code-checker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-checker.js","sourceRoot":"","sources":["../../src/facade/code-checker.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,3 @@
1
+ export { CodeChecker } from "./code-checker";
2
+ export type { CodeCheckerConfig, LlmConfig, CheckOptions, CheckReport, WorkflowInfo, } from "./types";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/facade/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EACV,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,WAAW,EACX,YAAY,GACb,MAAM,SAAS,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CodeChecker = void 0;
4
+ var code_checker_1 = require("./code-checker");
5
+ Object.defineProperty(exports, "CodeChecker", { enumerable: true, get: function () { return code_checker_1.CodeChecker; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/facade/index.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAApC,2GAAA,WAAW,OAAA"}
@@ -0,0 +1,24 @@
1
+ import type { RuleResult } from "../workflow/workflow";
2
+ export interface LlmConfig {
3
+ apiKey?: string;
4
+ model?: string;
5
+ baseUrl?: string;
6
+ }
7
+ export interface CodeCheckerConfig {
8
+ llm?: LlmConfig;
9
+ }
10
+ export interface CheckOptions {
11
+ code: string;
12
+ workflowId: string;
13
+ }
14
+ export interface CheckReport {
15
+ workflowId: string;
16
+ results: RuleResult[];
17
+ }
18
+ export interface WorkflowInfo {
19
+ id: string;
20
+ description: string;
21
+ ruleCount: number;
22
+ ruleNames: string[];
23
+ }
24
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/facade/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,WAAW,SAAS;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,UAAU,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/facade/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export { CodeChecker } from "./facade";
2
+ export type { CodeCheckerConfig, LlmConfig, CheckOptions, CheckReport, WorkflowInfo, } from "./facade";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,YAAY,EACR,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,WAAW,EACX,YAAY,GACf,MAAM,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CodeChecker = void 0;
4
+ // ── Facade (public API) ──
5
+ var facade_1 = require("./facade");
6
+ Object.defineProperty(exports, "CodeChecker", { enumerable: true, get: function () { return facade_1.CodeChecker; } });
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,4BAA4B;AAC5B,mCAAuC;AAA9B,qGAAA,WAAW,OAAA"}
@@ -0,0 +1,3 @@
1
+ export { GoParser } from "./parser";
2
+ export type { SyntaxNode, Tree, QueryMatch, QueryCapture } from "./parser";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tools/ast-parser/go/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GoParser = void 0;
4
+ var parser_1 = require("./parser");
5
+ Object.defineProperty(exports, "GoParser", { enumerable: true, get: function () { return parser_1.GoParser; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tools/ast-parser/go/index.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;AAA3B,kGAAA,QAAQ,OAAA"}
@@ -0,0 +1,56 @@
1
+ import { Language, Query, Node as TreeSitterNode, Tree } from "web-tree-sitter";
2
+ import type { QueryMatch, QueryCapture } from "web-tree-sitter";
3
+ type SyntaxNode = TreeSitterNode;
4
+ /**
5
+ * GoParser wraps web-tree-sitter to parse Go source code into a full AST.
6
+ *
7
+ * Because WASM loading is async, instances must be created via the static
8
+ * factory method {@link GoParser.create}.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const parser = await GoParser.create();
13
+ * const tree = parser.parse(goSource);
14
+ * const root = tree.rootNode;
15
+ * ```
16
+ */
17
+ export declare class GoParser {
18
+ private parser;
19
+ private language;
20
+ private constructor();
21
+ /**
22
+ * Create a new GoParser instance.
23
+ * Loads the WASM runtime and Go grammar on first call;
24
+ * subsequent calls reuse the cached language.
25
+ */
26
+ static create(): Promise<GoParser>;
27
+ /**
28
+ * Parse Go source code into a tree-sitter Tree.
29
+ */
30
+ parse(source: string): Tree;
31
+ /**
32
+ * Run a tree-sitter S-expression query against a syntax node.
33
+ *
34
+ * @returns All matches for the query patterns.
35
+ */
36
+ query(node: SyntaxNode, pattern: string): QueryMatch[];
37
+ /**
38
+ * Run a tree-sitter S-expression query and return flat captures.
39
+ */
40
+ captures(node: SyntaxNode, pattern: string): QueryCapture[];
41
+ /**
42
+ * Find all descendant nodes of a given type.
43
+ */
44
+ findByType(node: SyntaxNode, type: string): SyntaxNode[];
45
+ /**
46
+ * Depth-first walk over the subtree rooted at `node`.
47
+ */
48
+ walk(node: SyntaxNode, visitor: (n: SyntaxNode) => void): void;
49
+ /**
50
+ * Clean up the underlying parser resources.
51
+ * Call this when the parser is no longer needed.
52
+ */
53
+ dispose(): void;
54
+ }
55
+ export type { SyntaxNode, Tree, Language, Query, QueryMatch, QueryCapture };
56
+ //# sourceMappingURL=parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../../src/tools/ast-parser/go/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,QAAQ,EACR,KAAK,EACL,IAAI,IAAI,cAAc,EACtB,IAAI,EACP,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGhE,KAAK,UAAU,GAAG,cAAc,CAAC;AAyBjC;;;;;;;;;;;;GAYG;AACH,qBAAa,QAAQ;IACjB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAW;IAE3B,OAAO;IAKP;;;;OAIG;WACiB,MAAM,IAAI,OAAO,CAAC,QAAQ,CAAC;IAO/C;;OAEG;IACI,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAQlC;;;;OAIG;IACI,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU,EAAE;IAS7D;;OAEG;IACI,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,YAAY,EAAE;IASlE;;OAEG;IACI,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE;IAM/D;;OAEG;IACI,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI;IAUrE;;;OAGG;IACI,OAAO,IAAI,IAAI;CAGzB;AAED,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,147 @@
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.GoParser = void 0;
37
+ const web_tree_sitter_1 = require("web-tree-sitter");
38
+ const path = __importStar(require("path"));
39
+ let cachedLanguage = null;
40
+ let initPromise = null;
41
+ async function ensureParserInit() {
42
+ if (initPromise)
43
+ return initPromise;
44
+ initPromise = web_tree_sitter_1.Parser.init();
45
+ return initPromise;
46
+ }
47
+ async function loadGoLanguage() {
48
+ if (cachedLanguage)
49
+ return cachedLanguage;
50
+ await ensureParserInit();
51
+ const wasmPath = path.join(path.dirname(require.resolve("tree-sitter-wasms/package.json")), "out", "tree-sitter-go.wasm");
52
+ cachedLanguage = await web_tree_sitter_1.Language.load(wasmPath);
53
+ return cachedLanguage;
54
+ }
55
+ /**
56
+ * GoParser wraps web-tree-sitter to parse Go source code into a full AST.
57
+ *
58
+ * Because WASM loading is async, instances must be created via the static
59
+ * factory method {@link GoParser.create}.
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * const parser = await GoParser.create();
64
+ * const tree = parser.parse(goSource);
65
+ * const root = tree.rootNode;
66
+ * ```
67
+ */
68
+ class GoParser {
69
+ constructor(parser, language) {
70
+ this.parser = parser;
71
+ this.language = language;
72
+ }
73
+ /**
74
+ * Create a new GoParser instance.
75
+ * Loads the WASM runtime and Go grammar on first call;
76
+ * subsequent calls reuse the cached language.
77
+ */
78
+ static async create() {
79
+ const language = await loadGoLanguage();
80
+ const parser = new web_tree_sitter_1.Parser();
81
+ parser.setLanguage(language);
82
+ return new GoParser(parser, language);
83
+ }
84
+ /**
85
+ * Parse Go source code into a tree-sitter Tree.
86
+ */
87
+ parse(source) {
88
+ const tree = this.parser.parse(source);
89
+ if (!tree) {
90
+ throw new Error("Failed to parse Go source");
91
+ }
92
+ return tree;
93
+ }
94
+ /**
95
+ * Run a tree-sitter S-expression query against a syntax node.
96
+ *
97
+ * @returns All matches for the query patterns.
98
+ */
99
+ query(node, pattern) {
100
+ const q = new web_tree_sitter_1.Query(this.language, pattern);
101
+ try {
102
+ return q.matches(node);
103
+ }
104
+ finally {
105
+ q.delete();
106
+ }
107
+ }
108
+ /**
109
+ * Run a tree-sitter S-expression query and return flat captures.
110
+ */
111
+ captures(node, pattern) {
112
+ const q = new web_tree_sitter_1.Query(this.language, pattern);
113
+ try {
114
+ return q.captures(node);
115
+ }
116
+ finally {
117
+ q.delete();
118
+ }
119
+ }
120
+ /**
121
+ * Find all descendant nodes of a given type.
122
+ */
123
+ findByType(node, type) {
124
+ return node.descendantsOfType(type).filter((n) => n !== null);
125
+ }
126
+ /**
127
+ * Depth-first walk over the subtree rooted at `node`.
128
+ */
129
+ walk(node, visitor) {
130
+ visitor(node);
131
+ for (let i = 0; i < node.childCount; i++) {
132
+ const child = node.child(i);
133
+ if (child) {
134
+ this.walk(child, visitor);
135
+ }
136
+ }
137
+ }
138
+ /**
139
+ * Clean up the underlying parser resources.
140
+ * Call this when the parser is no longer needed.
141
+ */
142
+ dispose() {
143
+ this.parser.delete();
144
+ }
145
+ }
146
+ exports.GoParser = GoParser;
147
+ //# sourceMappingURL=parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../src/tools/ast-parser/go/parser.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,103 @@
1
+ import { GoParser } from "./parser";
2
+ import type { ResourceSchema } from "./types";
3
+ /**
4
+ * Extracts Terraform resource schemas from Go source files.
5
+ *
6
+ * Targets the common Terraform Plugin SDK pattern:
7
+ * ```go
8
+ * func resourceXxx() *schema.Resource {
9
+ * return &schema.Resource{
10
+ * Schema: map[string]*schema.Schema{
11
+ * "field": { Type: schema.TypeString, ... },
12
+ * },
13
+ * }
14
+ * }
15
+ * ```
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * const parser = await GoParser.create();
20
+ * const extractor = new TerraformSchemaExtractor(parser);
21
+ * const schemas = extractor.extract(goSourceCode);
22
+ * ```
23
+ */
24
+ export declare class TerraformSchemaExtractor {
25
+ private parser;
26
+ private currentRoot;
27
+ constructor(parser: GoParser);
28
+ /**
29
+ * Extract all resource schemas from a Go source string.
30
+ */
31
+ extract(goSource: string): ResourceSchema[];
32
+ private extractFromFunction;
33
+ /**
34
+ * Locate the returned `&schema.Resource{ ... }` composite literal
35
+ * in a function body.
36
+ */
37
+ private findResourceLiteral;
38
+ /**
39
+ * Locate the `Schema: map[string]*schema.Schema{ ... }` value from
40
+ * a resource composite literal.
41
+ */
42
+ private findSchemaMap;
43
+ private isResourceCompositeLiteral;
44
+ /**
45
+ * Find a top-level keyed value from a composite literal body by key.
46
+ */
47
+ private findTopLevelValueByKey;
48
+ /**
49
+ * Check if a node is a composite_literal of type
50
+ * `map[string]*schema.Schema{ ... }`.
51
+ */
52
+ private isSchemaMapLiteral;
53
+ /**
54
+ * Extract all schema fields from a map literal
55
+ * `map[string]*schema.Schema{ ... }`.
56
+ */
57
+ private extractFieldsFromMap;
58
+ /**
59
+ * Parse a single schema field from a keyed_element like:
60
+ * `"field_name": { Type: schema.TypeString, Required: true, ... }`
61
+ *
62
+ * keyed_element -> literal_element(key) + literal_element(value)
63
+ * key unwraps to: interpreted_string_literal
64
+ * value unwraps to: literal_value (shorthand for the struct literal)
65
+ */
66
+ private parseSchemaField;
67
+ /**
68
+ * Parse the properties (Type, Required, Optional, etc.) from
69
+ * a literal_value or composite_literal node containing the field's
70
+ * key-value pairs.
71
+ */
72
+ private parseFieldProperties;
73
+ /**
74
+ * Parse the `Elem` property which can be:
75
+ * - `&schema.Schema{ Type: schema.TypeString }` (simple element type)
76
+ * - `&schema.Resource{ Schema: map[string]*schema.Schema{ ... } }` (nested block)
77
+ * - `someSchemaFunc()` (function call returning *schema.Resource)
78
+ */
79
+ private parseElem;
80
+ /**
81
+ * Resolve an `Elem: someFunc()` call expression by locating the
82
+ * function definition in the same file and extracting its returned
83
+ * schema fields.
84
+ */
85
+ private resolveSchemaFuncCall;
86
+ private extractResourceOptions;
87
+ private extractImporterStateContext;
88
+ private extractTimeouts;
89
+ /**
90
+ * Extract the content of a Go interpreted string literal,
91
+ * stripping the surrounding double quotes.
92
+ */
93
+ private extractStringLiteral;
94
+ /**
95
+ * Infer a Terraform resource name from a Go function name.
96
+ *
97
+ * `resourceAwsInstance` -> `aws_instance`
98
+ * `dataSourceAwsAmi` -> `aws_ami`
99
+ * `ResourceAwsVpcSubnet` -> `aws_vpc_subnet`
100
+ */
101
+ private inferResourceName;
102
+ }
103
+ //# sourceMappingURL=schema-extractor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-extractor.d.ts","sourceRoot":"","sources":["../../../../src/tools/ast-parser/go/schema-extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,OAAO,KAAK,EAER,cAAc,EAIjB,MAAM,SAAS,CAAC;AAgCjB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,wBAAwB;IAGrB,OAAO,CAAC,MAAM;IAF1B,OAAO,CAAC,WAAW,CAA2B;gBAE1B,MAAM,EAAE,QAAQ;IAEpC;;OAEG;IACI,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,EAAE;IAsBlD,OAAO,CAAC,mBAAmB;IAyB3B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAW3B;;;OAGG;IACH,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,0BAA0B;IAOlC;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAmB9B;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAO1B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAgB5B;;;;;;;OAOG;IACH,OAAO,CAAC,gBAAgB;IAYxB;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IA6D5B;;;;;OAKG;IACH,OAAO,CAAC,SAAS;IA4CjB;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IA2B7B,OAAO,CAAC,sBAAsB;IAmC9B,OAAO,CAAC,2BAA2B;IAyBnC,OAAO,CAAC,eAAe;IA0CvB;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAW5B;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;CAkB5B"}