@mquan/mochi 0.1.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 (414) hide show
  1. package/README.md +154 -0
  2. package/dist/bin/mochi.d.ts +3 -0
  3. package/dist/bin/mochi.d.ts.map +1 -0
  4. package/dist/bin/mochi.js +74 -0
  5. package/dist/bin/mochi.js.map +1 -0
  6. package/dist/bin/tsconfig.tsbuildinfo +1 -0
  7. package/dist/server/analysis/git-context.d.ts +12 -0
  8. package/dist/server/analysis/git-context.d.ts.map +1 -0
  9. package/dist/server/analysis/git-context.js +151 -0
  10. package/dist/server/analysis/git-context.js.map +1 -0
  11. package/dist/server/analysis/grammars.d.ts +3 -0
  12. package/dist/server/analysis/grammars.d.ts.map +1 -0
  13. package/dist/server/analysis/grammars.js +32 -0
  14. package/dist/server/analysis/grammars.js.map +1 -0
  15. package/dist/server/analysis/index.d.ts +8 -0
  16. package/dist/server/analysis/index.d.ts.map +1 -0
  17. package/dist/server/analysis/index.js +86 -0
  18. package/dist/server/analysis/index.js.map +1 -0
  19. package/dist/server/analysis/tree-sitter.d.ts +20 -0
  20. package/dist/server/analysis/tree-sitter.d.ts.map +1 -0
  21. package/dist/server/analysis/tree-sitter.js +126 -0
  22. package/dist/server/analysis/tree-sitter.js.map +1 -0
  23. package/dist/server/analysis/ts-morph.d.ts +17 -0
  24. package/dist/server/analysis/ts-morph.d.ts.map +1 -0
  25. package/dist/server/analysis/ts-morph.js +143 -0
  26. package/dist/server/analysis/ts-morph.js.map +1 -0
  27. package/dist/server/analysis/types.d.ts +7 -0
  28. package/dist/server/analysis/types.d.ts.map +1 -0
  29. package/dist/server/analysis/types.js +9 -0
  30. package/dist/server/analysis/types.js.map +1 -0
  31. package/dist/server/api.d.ts +14 -0
  32. package/dist/server/api.d.ts.map +1 -0
  33. package/dist/server/api.js +121 -0
  34. package/dist/server/api.js.map +1 -0
  35. package/dist/server/diagram/cache.d.ts +23 -0
  36. package/dist/server/diagram/cache.d.ts.map +1 -0
  37. package/dist/server/diagram/cache.js +158 -0
  38. package/dist/server/diagram/cache.js.map +1 -0
  39. package/dist/server/diagram/endpoint.d.ts +21 -0
  40. package/dist/server/diagram/endpoint.d.ts.map +1 -0
  41. package/dist/server/diagram/endpoint.js +426 -0
  42. package/dist/server/diagram/endpoint.js.map +1 -0
  43. package/dist/server/diagram/generate.d.ts +220 -0
  44. package/dist/server/diagram/generate.d.ts.map +1 -0
  45. package/dist/server/diagram/generate.js +605 -0
  46. package/dist/server/diagram/generate.js.map +1 -0
  47. package/dist/server/diagram/prompt-version.d.ts +2 -0
  48. package/dist/server/diagram/prompt-version.d.ts.map +1 -0
  49. package/dist/server/diagram/prompt-version.js +47 -0
  50. package/dist/server/diagram/prompt-version.js.map +1 -0
  51. package/dist/server/diagram/prompts/diagram-spec.md +315 -0
  52. package/dist/server/diagram/scope-resolver.d.ts +44 -0
  53. package/dist/server/diagram/scope-resolver.d.ts.map +1 -0
  54. package/dist/server/diagram/scope-resolver.js +198 -0
  55. package/dist/server/diagram/scope-resolver.js.map +1 -0
  56. package/dist/server/diagram/spawn.d.ts +18 -0
  57. package/dist/server/diagram/spawn.d.ts.map +1 -0
  58. package/dist/server/diagram/spawn.js +103 -0
  59. package/dist/server/diagram/spawn.js.map +1 -0
  60. package/dist/server/index.d.ts +2 -0
  61. package/dist/server/index.d.ts.map +1 -0
  62. package/dist/server/index.js +2 -0
  63. package/dist/server/index.js.map +1 -0
  64. package/dist/server/input/path-selector.d.ts +8 -0
  65. package/dist/server/input/path-selector.d.ts.map +1 -0
  66. package/dist/server/input/path-selector.js +45 -0
  67. package/dist/server/input/path-selector.js.map +1 -0
  68. package/dist/server/server.d.ts +14 -0
  69. package/dist/server/server.d.ts.map +1 -0
  70. package/dist/server/server.js +79 -0
  71. package/dist/server/server.js.map +1 -0
  72. package/dist/server/tsconfig.tsbuildinfo +1 -0
  73. package/dist/shared/analysis-schema.d.ts +120 -0
  74. package/dist/shared/analysis-schema.d.ts.map +1 -0
  75. package/dist/shared/analysis-schema.js +43 -0
  76. package/dist/shared/analysis-schema.js.map +1 -0
  77. package/dist/shared/design/index.d.ts +6 -0
  78. package/dist/shared/design/index.d.ts.map +1 -0
  79. package/dist/shared/design/index.js +7 -0
  80. package/dist/shared/design/index.js.map +1 -0
  81. package/dist/shared/design/kinds.d.ts +26 -0
  82. package/dist/shared/design/kinds.d.ts.map +1 -0
  83. package/dist/shared/design/kinds.js +141 -0
  84. package/dist/shared/design/kinds.js.map +1 -0
  85. package/dist/shared/design/lenses.d.ts +11 -0
  86. package/dist/shared/design/lenses.d.ts.map +1 -0
  87. package/dist/shared/design/lenses.js +36 -0
  88. package/dist/shared/design/lenses.js.map +1 -0
  89. package/dist/shared/design/node-styles.d.ts +24 -0
  90. package/dist/shared/design/node-styles.d.ts.map +1 -0
  91. package/dist/shared/design/node-styles.js +150 -0
  92. package/dist/shared/design/node-styles.js.map +1 -0
  93. package/dist/shared/design/prompt-fragments.d.ts +4 -0
  94. package/dist/shared/design/prompt-fragments.d.ts.map +1 -0
  95. package/dist/shared/design/prompt-fragments.js +45 -0
  96. package/dist/shared/design/prompt-fragments.js.map +1 -0
  97. package/dist/shared/design/tokens.d.ts +102 -0
  98. package/dist/shared/design/tokens.d.ts.map +1 -0
  99. package/dist/shared/design/tokens.js +110 -0
  100. package/dist/shared/design/tokens.js.map +1 -0
  101. package/dist/shared/diagram-spec.d.ts +914 -0
  102. package/dist/shared/diagram-spec.d.ts.map +1 -0
  103. package/dist/shared/diagram-spec.js +173 -0
  104. package/dist/shared/diagram-spec.js.map +1 -0
  105. package/dist/shared/index.d.ts +2 -0
  106. package/dist/shared/index.d.ts.map +1 -0
  107. package/dist/shared/index.js +2 -0
  108. package/dist/shared/index.js.map +1 -0
  109. package/dist/shared/tsconfig.tsbuildinfo +1 -0
  110. package/dist/web/assets/abap-BdImnpbu.js +1 -0
  111. package/dist/web/assets/actionscript-3-CoDkCxhg.js +1 -0
  112. package/dist/web/assets/ada-bCR0ucgS.js +1 -0
  113. package/dist/web/assets/andromeeda-C4gqWexZ.js +1 -0
  114. package/dist/web/assets/angular-html-DMxchsRu.js +1 -0
  115. package/dist/web/assets/angular-ts-DzOHUlBM.js +1 -0
  116. package/dist/web/assets/apache-Pmp26Uib.js +1 -0
  117. package/dist/web/assets/apex-D8_7TLub.js +1 -0
  118. package/dist/web/assets/apl-dKokRX4l.js +1 -0
  119. package/dist/web/assets/applescript-Co6uUVPk.js +1 -0
  120. package/dist/web/assets/ara-BRHolxvo.js +1 -0
  121. package/dist/web/assets/asciidoc-Ve4PFQV2.js +1 -0
  122. package/dist/web/assets/asm-D_Q5rh1f.js +1 -0
  123. package/dist/web/assets/astro-CbQHKStN.js +1 -0
  124. package/dist/web/assets/aurora-x-D-2ljcwZ.js +1 -0
  125. package/dist/web/assets/awk-DMzUqQB5.js +1 -0
  126. package/dist/web/assets/ayu-dark-DYE7WIF3.js +1 -0
  127. package/dist/web/assets/ayu-light-BA47KaF1.js +1 -0
  128. package/dist/web/assets/ayu-mirage-32ctXXKs.js +1 -0
  129. package/dist/web/assets/ballerina-BFfxhgS-.js +1 -0
  130. package/dist/web/assets/bat-BkioyH1T.js +1 -0
  131. package/dist/web/assets/beancount-k_qm7-4y.js +1 -0
  132. package/dist/web/assets/berry-uYugtg8r.js +1 -0
  133. package/dist/web/assets/bibtex-CHM0blh-.js +1 -0
  134. package/dist/web/assets/bicep-Bmn6On1c.js +1 -0
  135. package/dist/web/assets/bird2-DPOp833l.js +1 -0
  136. package/dist/web/assets/blade-D4QpJJKB.js +1 -0
  137. package/dist/web/assets/bsl-BO_Y6i37.js +1 -0
  138. package/dist/web/assets/c-BIGW1oBm.js +1 -0
  139. package/dist/web/assets/c3-eo99z4R2.js +1 -0
  140. package/dist/web/assets/cadence-Bv_4Rxtq.js +1 -0
  141. package/dist/web/assets/cairo-KRGpt6FW.js +1 -0
  142. package/dist/web/assets/catppuccin-frappe-DFWUc33u.js +1 -0
  143. package/dist/web/assets/catppuccin-latte-C9dUb6Cb.js +1 -0
  144. package/dist/web/assets/catppuccin-macchiato-DQyhUUbL.js +1 -0
  145. package/dist/web/assets/catppuccin-mocha-D87Tk5Gz.js +1 -0
  146. package/dist/web/assets/clarity-D53aC0YG.js +1 -0
  147. package/dist/web/assets/clojure-P80f7IUj.js +1 -0
  148. package/dist/web/assets/cmake-D1j8_8rp.js +1 -0
  149. package/dist/web/assets/cobol-nwyudZeR.js +1 -0
  150. package/dist/web/assets/codeowners-Bp6g37R7.js +1 -0
  151. package/dist/web/assets/codeql-DsOJ9woJ.js +1 -0
  152. package/dist/web/assets/coffee-Ch7k5sss.js +1 -0
  153. package/dist/web/assets/common-lisp-Cg-RD9OK.js +1 -0
  154. package/dist/web/assets/coq-DkFqJrB1.js +1 -0
  155. package/dist/web/assets/cpp-CofmeUqb.js +1 -0
  156. package/dist/web/assets/crystal-tKQVLTB8.js +1 -0
  157. package/dist/web/assets/csharp-COcwbKMJ.js +1 -0
  158. package/dist/web/assets/css-DPfMkruS.js +1 -0
  159. package/dist/web/assets/csv-fuZLfV_i.js +1 -0
  160. package/dist/web/assets/cue-D82EKSYY.js +1 -0
  161. package/dist/web/assets/cypher-COkxafJQ.js +1 -0
  162. package/dist/web/assets/d-85-TOEBH.js +1 -0
  163. package/dist/web/assets/dark-plus-C3mMm8J8.js +1 -0
  164. package/dist/web/assets/dart-CF10PKvl.js +1 -0
  165. package/dist/web/assets/dax-CEL-wOlO.js +1 -0
  166. package/dist/web/assets/desktop-BmXAJ9_W.js +1 -0
  167. package/dist/web/assets/diff-D97Zzqfu.js +1 -0
  168. package/dist/web/assets/docker-BcOcwvcX.js +1 -0
  169. package/dist/web/assets/dotenv-Da5cRb03.js +1 -0
  170. package/dist/web/assets/dracula-BzJJZx-M.js +1 -0
  171. package/dist/web/assets/dracula-soft-BXkSAIEj.js +1 -0
  172. package/dist/web/assets/dream-maker-BtqSS_iP.js +1 -0
  173. package/dist/web/assets/edge-BkV0erSs.js +1 -0
  174. package/dist/web/assets/elixir-CDX3lj18.js +1 -0
  175. package/dist/web/assets/elm-DbKCFpqz.js +1 -0
  176. package/dist/web/assets/emacs-lisp-C9XAeP06.js +1 -0
  177. package/dist/web/assets/erb-B12qg9BL.js +1 -0
  178. package/dist/web/assets/erlang-DsQrWhSR.js +1 -0
  179. package/dist/web/assets/everforest-dark-BgDCqdQA.js +1 -0
  180. package/dist/web/assets/everforest-light-C8M2exoo.js +1 -0
  181. package/dist/web/assets/fennel-BYunw83y.js +1 -0
  182. package/dist/web/assets/fish-BvzEVeQv.js +1 -0
  183. package/dist/web/assets/fluent-C4IJs8-o.js +1 -0
  184. package/dist/web/assets/fortran-fixed-form-CkoXwp7k.js +1 -0
  185. package/dist/web/assets/fortran-free-form-BxgE0vQu.js +1 -0
  186. package/dist/web/assets/fsharp-CXgrBDvD.js +1 -0
  187. package/dist/web/assets/gdresource-BOOCDP_w.js +1 -0
  188. package/dist/web/assets/gdscript-C5YyOfLZ.js +1 -0
  189. package/dist/web/assets/gdshader-DkwncUOv.js +1 -0
  190. package/dist/web/assets/genie-D0YGMca9.js +1 -0
  191. package/dist/web/assets/gherkin-DyxjwDmM.js +1 -0
  192. package/dist/web/assets/git-commit-F4YmCXRG.js +1 -0
  193. package/dist/web/assets/git-rebase-r7XF79zn.js +1 -0
  194. package/dist/web/assets/github-dark-DHJKELXO.js +1 -0
  195. package/dist/web/assets/github-dark-default-Cuk6v7N8.js +1 -0
  196. package/dist/web/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
  197. package/dist/web/assets/github-dark-high-contrast-E3gJ1_iC.js +1 -0
  198. package/dist/web/assets/github-light-DAi9KRSo.js +1 -0
  199. package/dist/web/assets/github-light-default-D7oLnXFd.js +1 -0
  200. package/dist/web/assets/github-light-high-contrast-BfjtVDDH.js +1 -0
  201. package/dist/web/assets/gleam-BspZqrRM.js +1 -0
  202. package/dist/web/assets/glimmer-js-Rg0-pVw9.js +1 -0
  203. package/dist/web/assets/glimmer-ts-U6CK756n.js +1 -0
  204. package/dist/web/assets/glsl-DplSGwfg.js +1 -0
  205. package/dist/web/assets/gn-n2N0HUVH.js +1 -0
  206. package/dist/web/assets/gnuplot-DdkO51Og.js +1 -0
  207. package/dist/web/assets/go-CxLEBnE3.js +1 -0
  208. package/dist/web/assets/graphql-ChdNCCLP.js +1 -0
  209. package/dist/web/assets/groovy-gcz8RCvz.js +1 -0
  210. package/dist/web/assets/gruvbox-dark-hard-CFHQjOhq.js +1 -0
  211. package/dist/web/assets/gruvbox-dark-medium-GsRaNv29.js +1 -0
  212. package/dist/web/assets/gruvbox-dark-soft-CVdnzihN.js +1 -0
  213. package/dist/web/assets/gruvbox-light-hard-CH1njM8p.js +1 -0
  214. package/dist/web/assets/gruvbox-light-medium-DRw_LuNl.js +1 -0
  215. package/dist/web/assets/gruvbox-light-soft-hJgmCMqR.js +1 -0
  216. package/dist/web/assets/hack-CaT9iCJl.js +1 -0
  217. package/dist/web/assets/haml-B8DHNrY2.js +1 -0
  218. package/dist/web/assets/handlebars-BL8al0AC.js +1 -0
  219. package/dist/web/assets/haskell-Df6bDoY_.js +1 -0
  220. package/dist/web/assets/haxe-CzTSHFRz.js +1 -0
  221. package/dist/web/assets/hcl-BWvSN4gD.js +1 -0
  222. package/dist/web/assets/hjson-D5-asLiD.js +1 -0
  223. package/dist/web/assets/hlsl-D3lLCCz7.js +1 -0
  224. package/dist/web/assets/horizon-BUw7H-hv.js +1 -0
  225. package/dist/web/assets/horizon-bright-Cn-bp-IR.js +1 -0
  226. package/dist/web/assets/houston-DnULxvSX.js +1 -0
  227. package/dist/web/assets/html-GMplVEZG.js +1 -0
  228. package/dist/web/assets/html-derivative-BFtXZ54Q.js +1 -0
  229. package/dist/web/assets/http-jrhK8wxY.js +1 -0
  230. package/dist/web/assets/hurl-irOxFIW8.js +1 -0
  231. package/dist/web/assets/hxml-Bvhsp5Yf.js +1 -0
  232. package/dist/web/assets/hy-DFXneXwc.js +1 -0
  233. package/dist/web/assets/imba-DGztddWO.js +1 -0
  234. package/dist/web/assets/index-B4-Q-CcM.js +88 -0
  235. package/dist/web/assets/index-DtQV41FL.css +1 -0
  236. package/dist/web/assets/ini-BEwlwnbL.js +1 -0
  237. package/dist/web/assets/java-CylS5w8V.js +1 -0
  238. package/dist/web/assets/javascript-wDzz0qaB.js +1 -0
  239. package/dist/web/assets/jinja-4LBKfQ-Z.js +1 -0
  240. package/dist/web/assets/jison-wvAkD_A8.js +1 -0
  241. package/dist/web/assets/json-Cp-IABpG.js +1 -0
  242. package/dist/web/assets/json5-C9tS-k6U.js +1 -0
  243. package/dist/web/assets/jsonc-Des-eS-w.js +1 -0
  244. package/dist/web/assets/jsonl-DcaNXYhu.js +1 -0
  245. package/dist/web/assets/jsonnet-DFQXde-d.js +1 -0
  246. package/dist/web/assets/jssm-C2t-YnRu.js +1 -0
  247. package/dist/web/assets/jsx-g9-lgVsj.js +1 -0
  248. package/dist/web/assets/julia-CxzCAyBv.js +1 -0
  249. package/dist/web/assets/just-Cw27pwNe.js +1 -0
  250. package/dist/web/assets/kanagawa-dragon-CkXjmgJE.js +1 -0
  251. package/dist/web/assets/kanagawa-lotus-CfQXZHmo.js +1 -0
  252. package/dist/web/assets/kanagawa-wave-DWedfzmr.js +1 -0
  253. package/dist/web/assets/kdl-DV7GczEv.js +1 -0
  254. package/dist/web/assets/kotlin-BdnUsdx6.js +1 -0
  255. package/dist/web/assets/kusto-DZf3V79B.js +1 -0
  256. package/dist/web/assets/laserwave-DUszq2jm.js +1 -0
  257. package/dist/web/assets/latex-CWtU0Tv5.js +1 -0
  258. package/dist/web/assets/lean-BZvkOJ9d.js +1 -0
  259. package/dist/web/assets/less-B1dDrJ26.js +1 -0
  260. package/dist/web/assets/light-plus-B7mTdjB0.js +1 -0
  261. package/dist/web/assets/liquid-DYVedYrR.js +1 -0
  262. package/dist/web/assets/llvm-DjAJT7YJ.js +1 -0
  263. package/dist/web/assets/log-2UxHyX5q.js +1 -0
  264. package/dist/web/assets/logo-BtOb2qkB.js +1 -0
  265. package/dist/web/assets/lua-BaeVxFsk.js +1 -0
  266. package/dist/web/assets/luau-C-HG3fhB.js +1 -0
  267. package/dist/web/assets/make-CHLpvVh8.js +1 -0
  268. package/dist/web/assets/markdown-Cvjx9yec.js +1 -0
  269. package/dist/web/assets/marko-CnJfTvn9.js +1 -0
  270. package/dist/web/assets/material-theme-D5KoaKCx.js +1 -0
  271. package/dist/web/assets/material-theme-darker-BfHTSMKl.js +1 -0
  272. package/dist/web/assets/material-theme-lighter-B0m2ddpp.js +1 -0
  273. package/dist/web/assets/material-theme-ocean-CyktbL80.js +1 -0
  274. package/dist/web/assets/material-theme-palenight-Csfq5Kiy.js +1 -0
  275. package/dist/web/assets/matlab-D7o27uSR.js +1 -0
  276. package/dist/web/assets/mdc-BMNejdWA.js +1 -0
  277. package/dist/web/assets/mdx-Cmh6b_Ma.js +1 -0
  278. package/dist/web/assets/mermaid-mWjccvbQ.js +1 -0
  279. package/dist/web/assets/min-dark-CafNBF8u.js +1 -0
  280. package/dist/web/assets/min-light-CTRr51gU.js +1 -0
  281. package/dist/web/assets/mipsasm-CKIfxQSi.js +1 -0
  282. package/dist/web/assets/mojo-rZm6bMo-.js +1 -0
  283. package/dist/web/assets/monokai-D4h5O-jR.js +1 -0
  284. package/dist/web/assets/moonbit-_H4v1dQx.js +1 -0
  285. package/dist/web/assets/move-IF9eRakj.js +1 -0
  286. package/dist/web/assets/narrat-DRg8JJMk.js +1 -0
  287. package/dist/web/assets/nextflow-Zz6hmt5N.js +1 -0
  288. package/dist/web/assets/nextflow-groovy-BeH2EWoN.js +1 -0
  289. package/dist/web/assets/nginx-BpAMiNFr.js +1 -0
  290. package/dist/web/assets/night-owl-C39BiMTA.js +1 -0
  291. package/dist/web/assets/night-owl-light-CMTm3GFP.js +1 -0
  292. package/dist/web/assets/nim-CVrawwO9.js +1 -0
  293. package/dist/web/assets/nix-CwoSXNpI.js +1 -0
  294. package/dist/web/assets/nord-Ddv68eIx.js +1 -0
  295. package/dist/web/assets/nushell-Cz2AlsmD.js +1 -0
  296. package/dist/web/assets/objective-c-DXmwc3jG.js +1 -0
  297. package/dist/web/assets/objective-cpp-CLxacb5B.js +1 -0
  298. package/dist/web/assets/ocaml-C0hk2d4L.js +1 -0
  299. package/dist/web/assets/odin-BBf5iR-q.js +1 -0
  300. package/dist/web/assets/one-dark-pro-DVMEJ2y_.js +1 -0
  301. package/dist/web/assets/one-light-C3Wv6jpd.js +1 -0
  302. package/dist/web/assets/openscad-C4EeE6gA.js +1 -0
  303. package/dist/web/assets/pascal-D93ZcfNL.js +1 -0
  304. package/dist/web/assets/perl-C0TMdlhV.js +1 -0
  305. package/dist/web/assets/php-Dhbhpdrm.js +1 -0
  306. package/dist/web/assets/pkl-u5AG7uiY.js +1 -0
  307. package/dist/web/assets/plastic-3e1v2bzS.js +1 -0
  308. package/dist/web/assets/plsql-ChMvpjG-.js +1 -0
  309. package/dist/web/assets/po-BTJTHyun.js +1 -0
  310. package/dist/web/assets/poimandres-CS3Unz2-.js +1 -0
  311. package/dist/web/assets/polar-C0HS_06l.js +1 -0
  312. package/dist/web/assets/postcss-CXtECtnM.js +1 -0
  313. package/dist/web/assets/powerquery-CEu0bR-o.js +1 -0
  314. package/dist/web/assets/powershell-Dpen1YoG.js +1 -0
  315. package/dist/web/assets/prisma-Dd19v3D-.js +1 -0
  316. package/dist/web/assets/prolog-CbFg5uaA.js +1 -0
  317. package/dist/web/assets/proto-C7zT0LnQ.js +1 -0
  318. package/dist/web/assets/pug-CGlum2m_.js +1 -0
  319. package/dist/web/assets/puppet-BMWR74SV.js +1 -0
  320. package/dist/web/assets/purescript-CklMAg4u.js +1 -0
  321. package/dist/web/assets/python-B6aJPvgy.js +1 -0
  322. package/dist/web/assets/qml-3beO22l8.js +1 -0
  323. package/dist/web/assets/qmldir-C8lEn-DE.js +1 -0
  324. package/dist/web/assets/qss-IeuSbFQv.js +1 -0
  325. package/dist/web/assets/r-Dspwwk_N.js +1 -0
  326. package/dist/web/assets/racket-BqYA7rlc.js +1 -0
  327. package/dist/web/assets/raku-DXvB9xmW.js +1 -0
  328. package/dist/web/assets/razor-Uh8Bk_45.js +1 -0
  329. package/dist/web/assets/red-bN70gL4F.js +1 -0
  330. package/dist/web/assets/reg-C-SQnVFl.js +1 -0
  331. package/dist/web/assets/regexp-CDVJQ6XC.js +1 -0
  332. package/dist/web/assets/rel-C3B-1QV4.js +1 -0
  333. package/dist/web/assets/riscv-BM1_JUlF.js +1 -0
  334. package/dist/web/assets/ron-D8l8udqQ.js +1 -0
  335. package/dist/web/assets/rose-pine-dawn-DHQR4-dF.js +1 -0
  336. package/dist/web/assets/rose-pine-moon-D4_iv3hh.js +1 -0
  337. package/dist/web/assets/rose-pine-qdsjHGoJ.js +1 -0
  338. package/dist/web/assets/rosmsg-BJDFO7_C.js +1 -0
  339. package/dist/web/assets/rst-BrH8l1NY.js +1 -0
  340. package/dist/web/assets/ruby-Dw2BHqvy.js +1 -0
  341. package/dist/web/assets/rust-B1yitclQ.js +1 -0
  342. package/dist/web/assets/sas-cz2c8ADy.js +1 -0
  343. package/dist/web/assets/sass-Cj5Yp3dK.js +1 -0
  344. package/dist/web/assets/scala-C151Ov-r.js +1 -0
  345. package/dist/web/assets/scheme-C98Dy4si.js +1 -0
  346. package/dist/web/assets/scss-OYdSNvt2.js +1 -0
  347. package/dist/web/assets/sdbl-DVxCFoDh.js +1 -0
  348. package/dist/web/assets/shaderlab-Dg9Lc6iA.js +1 -0
  349. package/dist/web/assets/shellscript-Yzrsuije.js +1 -0
  350. package/dist/web/assets/shellsession-BADoaaVG.js +1 -0
  351. package/dist/web/assets/slack-dark-BthQWCQV.js +1 -0
  352. package/dist/web/assets/slack-ochin-DqwNpetd.js +1 -0
  353. package/dist/web/assets/smalltalk-BERRCDM3.js +1 -0
  354. package/dist/web/assets/snazzy-light-Bw305WKR.js +1 -0
  355. package/dist/web/assets/solarized-dark-DXbdFlpD.js +1 -0
  356. package/dist/web/assets/solarized-light-L9t79GZl.js +1 -0
  357. package/dist/web/assets/solidity-rGO070M0.js +1 -0
  358. package/dist/web/assets/soy-Brmx7dQM.js +1 -0
  359. package/dist/web/assets/sparql-rVzFXLq3.js +1 -0
  360. package/dist/web/assets/splunk-BtCnVYZw.js +1 -0
  361. package/dist/web/assets/sql-BLtJtn59.js +1 -0
  362. package/dist/web/assets/ssh-config-_ykCGR6B.js +1 -0
  363. package/dist/web/assets/stata-BH5u7GGu.js +1 -0
  364. package/dist/web/assets/stylus-BEDo0Tqx.js +1 -0
  365. package/dist/web/assets/surrealql-Bq5Q-fJD.js +1 -0
  366. package/dist/web/assets/svelte-C_ipcX3V.js +1 -0
  367. package/dist/web/assets/swift-D82vCrfD.js +1 -0
  368. package/dist/web/assets/synthwave-84-CbfX1IO0.js +1 -0
  369. package/dist/web/assets/system-verilog-CnnmHF94.js +1 -0
  370. package/dist/web/assets/systemd-4A_iFExJ.js +1 -0
  371. package/dist/web/assets/talonscript-CkByrt1z.js +1 -0
  372. package/dist/web/assets/tasl-QIJgUcNo.js +1 -0
  373. package/dist/web/assets/tcl-dwOrl1Do.js +1 -0
  374. package/dist/web/assets/templ-P3uqSqPl.js +1 -0
  375. package/dist/web/assets/terraform-BETggiCN.js +1 -0
  376. package/dist/web/assets/tex-idrVyKtj.js +1 -0
  377. package/dist/web/assets/tokyo-night-hegEt444.js +1 -0
  378. package/dist/web/assets/toml-vGWfd6FD.js +1 -0
  379. package/dist/web/assets/ts-tags-zn1MmPIZ.js +1 -0
  380. package/dist/web/assets/tsv-B_m7g4N7.js +1 -0
  381. package/dist/web/assets/tsx-COt5Ahok.js +1 -0
  382. package/dist/web/assets/turtle-BsS91CYL.js +1 -0
  383. package/dist/web/assets/twig-DNn4PbVi.js +1 -0
  384. package/dist/web/assets/typescript-BPQ3VLAy.js +1 -0
  385. package/dist/web/assets/typespec-BGHnOYBU.js +1 -0
  386. package/dist/web/assets/typst-DHCkPAjA.js +1 -0
  387. package/dist/web/assets/v-BcVCzyr7.js +1 -0
  388. package/dist/web/assets/vala-CsfeWuGM.js +1 -0
  389. package/dist/web/assets/vb-D17OF-Vu.js +1 -0
  390. package/dist/web/assets/verilog-BQ8w6xss.js +1 -0
  391. package/dist/web/assets/vesper-DU1UobuO.js +1 -0
  392. package/dist/web/assets/vhdl-CeAyd5Ju.js +1 -0
  393. package/dist/web/assets/viml-CJc9bBzg.js +1 -0
  394. package/dist/web/assets/vitesse-black-Bkuqu6BP.js +1 -0
  395. package/dist/web/assets/vitesse-dark-D0r3Knsf.js +1 -0
  396. package/dist/web/assets/vitesse-light-CVO1_9PV.js +1 -0
  397. package/dist/web/assets/vue-DN_0RTcg.js +1 -0
  398. package/dist/web/assets/vue-html-AaS7Mt5G.js +1 -0
  399. package/dist/web/assets/vue-vine-CQOfvN7w.js +1 -0
  400. package/dist/web/assets/vyper-CDx5xZoG.js +1 -0
  401. package/dist/web/assets/wasm-CG6Dc4jp.js +1 -0
  402. package/dist/web/assets/wasm-MzD3tlZU.js +1 -0
  403. package/dist/web/assets/wenyan-BV7otONQ.js +1 -0
  404. package/dist/web/assets/wgsl-Dx-B1_4e.js +1 -0
  405. package/dist/web/assets/wikitext-BhOHFoWU.js +1 -0
  406. package/dist/web/assets/wit-5i3qLPDT.js +1 -0
  407. package/dist/web/assets/wolfram-lXgVvXCa.js +1 -0
  408. package/dist/web/assets/xml-sdJ4AIDG.js +1 -0
  409. package/dist/web/assets/xsl-CtQFsRM5.js +1 -0
  410. package/dist/web/assets/yaml-Buea-lGh.js +1 -0
  411. package/dist/web/assets/zenscript-DVFEvuxE.js +1 -0
  412. package/dist/web/assets/zig-VOosw3JB.js +1 -0
  413. package/dist/web/index.html +13 -0
  414. package/package.json +56 -0
@@ -0,0 +1,47 @@
1
+ // PROMPT_VERSION participates in the diagram cache key (server/diagram/cache.ts,
2
+ // wired up in a later task). The cache treats different prompt_versions as
3
+ // different keys — previously-cached specs become unreachable rather than
4
+ // invalidated, so a bump is cheap to roll out but cannot be selectively undone.
5
+ //
6
+ // Bump policy when editing server/diagram/prompts/diagram-spec.md:
7
+ // patch (1.0.x) — typo or clarity edits that should not change the LLM's
8
+ // output distribution. Whitespace-only edits do NOT bump.
9
+ // minor (1.x.0) — instruction tweaks (sharper lens criteria, new examples,
10
+ // reworded narration rule). Output may shift; cached specs
11
+ // remain compatible with the DiagramSpec schema.
12
+ // major (x.0.0) — prompt change incompatible with the current schema
13
+ // (new required output fields, removed sections). Coordinate
14
+ // with the schema bump in shared/diagram-spec.ts.
15
+ // 1.1.0: m2.7 LLM-backend swap. Same prompt template, but the runtime now
16
+ // passes a JSON Schema to the claude CLI via --json-schema, which enforces
17
+ // the output shape. Cache invalidated to retire any specs generated against
18
+ // the prior Anthropic-SDK tool-use path.
19
+ //
20
+ // 1.2.0: closed-set NodeKind/EdgeKind enums per lens (shared/design/kinds.ts)
21
+ // + prompt template restructured into a static block (lens definitions,
22
+ // kind enum tables, narration rules, schema) followed by a dynamic inputs
23
+ // block (scope, intent, files). Output: smaller, more cacheable, more
24
+ // evaluable. JSON Schema now constrains node.kind / edge.kind to the global
25
+ // kind union; lens-correctness (kind must match the chosen lens) is enforced
26
+ // at parse time by zod superRefine. Cache invalidated wholesale — any 1.1.x
27
+ // spec might carry a now-illegal kind value.
28
+ //
29
+ // 1.3.0: added Step 3 sub-sections on node-label style ("concepts, not code"),
30
+ // abstraction level per lens, and edge density (no orphan nodes). User
31
+ // dogfood feedback showed Claude was labelling nodes with literal code
32
+ // excerpts ("for-await line of readline(stdout)", "envelope.type === ...")
33
+ // and emitting sparse / orphan-heavy graphs. The new sections explicitly
34
+ // forbid code-fragment labels and require connected graphs. Schema
35
+ // unchanged; cache invalidated so existing entries are regenerated under
36
+ // the stricter guidance.
37
+ //
38
+ // 1.4.0: dropped the warnings channel entirely. The "Self-report uncertainty"
39
+ // step (was Step 6) was producing code-review-style commentary that
40
+ // confused readers ("TOCTOU window between resolveContainedPath and
41
+ // readFile; the diagram is fine, the race is a code property"). The
42
+ // stated purpose (diagram-fidelity caveats) kept getting lost in
43
+ // code-observation noise. Schema drops `warnings`; UI drops the Warnings
44
+ // component; prompt drops Step 6 and renumbers downstream steps. Cache
45
+ // invalidated.
46
+ export const PROMPT_VERSION = "1.4.0";
47
+ //# sourceMappingURL=prompt-version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-version.js","sourceRoot":"","sources":["../../../server/diagram/prompt-version.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,2EAA2E;AAC3E,0EAA0E;AAC1E,gFAAgF;AAChF,EAAE;AACF,mEAAmE;AACnE,2EAA2E;AAC3E,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,mEAAmE;AACnE,uEAAuE;AACvE,+EAA+E;AAC/E,oEAAoE;AAEpE,0EAA0E;AAC1E,2EAA2E;AAC3E,4EAA4E;AAC5E,yCAAyC;AACzC,EAAE;AACF,8EAA8E;AAC9E,wEAAwE;AACxE,0EAA0E;AAC1E,sEAAsE;AACtE,4EAA4E;AAC5E,6EAA6E;AAC7E,4EAA4E;AAC5E,6CAA6C;AAC7C,EAAE;AACF,+EAA+E;AAC/E,uEAAuE;AACvE,uEAAuE;AACvE,2EAA2E;AAC3E,yEAAyE;AACzE,mEAAmE;AACnE,yEAAyE;AACzE,yBAAyB;AACzB,EAAE;AACF,8EAA8E;AAC9E,oEAAoE;AACpE,oEAAoE;AACpE,oEAAoE;AACpE,iEAAiE;AACjE,yEAAyE;AACzE,uEAAuE;AACvE,eAAe;AACf,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC"}
@@ -0,0 +1,315 @@
1
+ <!-- GENERATED FILE — DO NOT EDIT. Source: server/diagram/prompts/diagram-spec.md.tmpl + shared/design/. Regenerate via `npm run build` (or `tsx scripts/gen-prompt.ts`). -->
2
+
3
+ # DiagramSpec Generation
4
+
5
+ You are an expert software analyst generating a behavioral diagram of unfamiliar code. Your reader is a developer trying to understand HOW the code works — its causal structure, the *why* behind decisions — not just what files exist.
6
+
7
+ Your task: produce a single JSON value conforming to the `DiagramSpec` schema (defined at the end of this document). Output the JSON only, with no surrounding prose, no markdown fences, no commentary.
8
+
9
+ ---
10
+
11
+ ## Step 1 — Pick exactly one lens
12
+
13
+ Choose the single lens (`flow | architecture | state | protocol`) that best illuminates this scope and intent. Use this guidance:
14
+
15
+ - **`flow`** — Branching and looping logic within a single function or file. Use when the scope is one or two functions and the interesting question is "what path does execution take?"
16
+ - **Signals:** nested conditionals, loops, early returns, error branches.
17
+ - **Tiebreaker:** If the scope is a single function with branching, prefer flow over state.
18
+
19
+ - **`architecture`** — Relationships between multiple modules, services, or layers. Use when the scope spans multiple files and the interesting question is "what depends on what, and how does data move?"
20
+ - **Signals:** imports across modules, service boundaries, layered code (controller → service → repository).
21
+ - **Tiebreaker:** If the scope is multiple files with one clear caller / callee chain, prefer architecture over flow.
22
+
23
+ - **`state`** — Explicit state machines: a small set of named states with transitions triggered by events. Use when the code contains a state variable (an enum, a `status` field, a phase) that controls behavior.
24
+ - **Signals:** switch statements over a status, setState calls that name a phase, finite-state-machine libraries, async lifecycles like idle → loading → success / error.
25
+ - **Tiebreaker:** If two lenses fit equally well, pick the one the reader is more likely to need now and put the other in alternative_lenses.
26
+
27
+ - **`protocol`** — Message exchanges between actors over time. Use when the scope describes a sequence of interactions: client and server, producer and consumer, two threads or processes coordinating.
28
+ - **Signals:** request/response pairs, pub/sub, async messaging, multi-step handshakes (auth flows, OAuth, websocket setup).
29
+ - **Tiebreaker:** Pick protocol when the temporal ordering of messages is the load-bearing thing — otherwise use architecture.
30
+
31
+ **Tiebreakers:**
32
+
33
+ - If the user's `intent` mentions framing words like "state", "flow", "architecture", "messages", "protocol", or "sequence", prefer the matching lens unless the code clearly disagrees.
34
+ - If two lenses fit equally well, pick the one the reader is more likely to need now and put the other in `alternative_lenses`.
35
+
36
+ **Intent disagrees with code shape.** If the user's intent suggests one lens but the code shape clearly calls for another, pick the code-shape lens and put the intent-suggested lens in `alternative_lenses` with a one-line reason. The reader can switch.
37
+
38
+ **No lens fits cleanly.** Pick the closest lens and generate the spec normally. Refusing to emit a spec is worse than picking imperfectly.
39
+
40
+ Single-lens rule: do not blend. Pick one. Other useful views belong in `alternative_lenses`.
41
+
42
+ ---
43
+
44
+ ## Step 2 — Use the closed-set kind vocabulary
45
+
46
+ `node.kind` and `edge.kind` are constrained per lens. The tables below list every allowed value with a short definition. **You MUST pick one of the listed kinds for the lens you chose in Step 1.** Do not invent values outside the lens's enum. If a concept doesn't fit, pick the closest match and use `metadata` to capture nuance.
47
+
48
+ ### Allowed node kinds per lens
49
+
50
+
51
+ ### flow
52
+
53
+ | kind | definition |
54
+ |---|---|
55
+ | `flow.entry` | the function or block where execution starts; usually one per flow diagram |
56
+ | `flow.call` | a function or method invocation that synchronously transfers control |
57
+ | `flow.branch` | a conditional fork (if / switch / ternary) that splits the path |
58
+ | `flow.loop` | a loop construct (for / while / do) — show iteration as a back-edge |
59
+ | `flow.await` | a suspension point on a Promise / async operation |
60
+ | `flow.throw` | a thrown exception that unwinds the stack |
61
+ | `flow.catch` | a catch handler that captures a thrown exception |
62
+ | `flow.return` | an explicit return that exits the current frame |
63
+
64
+ ### architecture
65
+
66
+ | kind | definition |
67
+ |---|---|
68
+ | `architecture.client` | the originating actor (browser, mobile app, external caller) |
69
+ | `architecture.gateway` | a routing/edge layer (API gateway, reverse proxy, load balancer) |
70
+ | `architecture.service` | a long-running runtime component with its own deployment |
71
+ | `architecture.module` | an in-process code module — a library or subsystem |
72
+ | `architecture.datastore` | a persistent store (database, file system, blob storage) |
73
+ | `architecture.queue` | an async messaging primitive (queue, topic, stream) |
74
+ | `architecture.external` | a third-party system outside the scope of this codebase |
75
+
76
+ ### state
77
+
78
+ | kind | definition |
79
+ |---|---|
80
+ | `state.initial` | the entry state of the machine (usually exactly one) |
81
+ | `state.intermediate` | any non-initial, non-terminal state |
82
+ | `state.terminal` | a state from which no further transitions originate (one or more) |
83
+ | `state.composite` | a state that contains substates (hierarchical state machines) |
84
+
85
+ ### protocol
86
+
87
+ | kind | definition |
88
+ |---|---|
89
+ | `protocol.actor` | a participant whose timeline runs as a vertical lane |
90
+ | `protocol.group` | a collection of actors treated as a unit for diagram clarity |
91
+
92
+
93
+ ### Allowed edge kinds per lens
94
+
95
+
96
+ ### flow
97
+
98
+ | kind | definition |
99
+ |---|---|
100
+ | `flow.next` | sequential continuation — control moves to the next node unconditionally |
101
+ | `flow.branch_true` | the truthy branch out of a flow.branch node |
102
+ | `flow.branch_false` | the falsy branch out of a flow.branch node |
103
+ | `flow.loop_back` | the back-edge that returns control to the loop header |
104
+ | `flow.fallthrough` | a case-fallthrough or implicit continuation (e.g., switch without break) |
105
+
106
+ ### architecture
107
+
108
+ | kind | definition |
109
+ |---|---|
110
+ | `architecture.call_sync` | a synchronous request/response call (HTTP, RPC, function call) |
111
+ | `architecture.call_async` | a fire-and-forget call where the caller does not block on the response |
112
+ | `architecture.event` | a published event the consumer may or may not handle |
113
+ | `architecture.data_flow` | data movement (read/write) between a component and a datastore |
114
+ | `architecture.depends_on` | a static dependency edge — A imports/uses B |
115
+
116
+ ### state
117
+
118
+ | kind | definition |
119
+ |---|---|
120
+ | `state.transition` | a transition from one state to a different state |
121
+ | `state.self_transition` | a transition whose source and target are the same state |
122
+
123
+ ### protocol
124
+
125
+ | kind | definition |
126
+ |---|---|
127
+ | `protocol.request` | a request message sent from one actor to another |
128
+ | `protocol.response` | the reply to a request |
129
+ | `protocol.async_message` | a message sent without expecting a synchronous reply |
130
+ | `protocol.return` | a return from a previously-invoked synchronous call |
131
+ | `protocol.create` | an actor creates another actor (e.g., spawn, instantiate) |
132
+ | `protocol.destroy` | an actor terminates another actor (e.g., close, dispose) |
133
+
134
+
135
+ ---
136
+
137
+ ## Step 3 — Build the diagram
138
+
139
+ Populate `nodes`, `edges`, and `steps` per the schema. Keep ids short, lowercase, and stable across the document (e.g., `s_idle`, `e_idle_to_loading`, `step_1`).
140
+
141
+ ### Node labels are CONCEPTS, not code
142
+
143
+ `node.label` must be a short noun-phrase or imperative describing what the node REPRESENTS — what a reader would write on a whiteboard sketch. It is NOT a code excerpt.
144
+
145
+ **BAD** (literal code fragments — readers can read the source themselves):
146
+
147
+ > "for-await line of readline(stdout)"
148
+ > "envelope.type === 'stream_event'"
149
+ > "await handle.exitCode"
150
+ > "RETRY_BACKOFF_MS[attempt - 1]"
151
+ > "if (cache.get(key) !== null)"
152
+
153
+ **GOOD** (concept names — labels a reader can hold in their head):
154
+
155
+ > "Stream CLI output line-by-line"
156
+ > "Tool-use delta arrived"
157
+ > "Wait for subprocess exit"
158
+ > "Sleep before retry"
159
+ > "Cache hit"
160
+
161
+ Rules:
162
+
163
+ - Length: 1–5 words for `state` / `architecture` nodes; 1–10 words for `flow` / `protocol` nodes.
164
+ - No code-fragment characters: avoid `()`, `===`, `{}`, `$`, `→`, backticks, square-bracketed array indices, snake_case identifiers pulled straight from the source.
165
+ - No file paths or line ranges in labels — those go in `code_anchor`.
166
+ - Variable names appear in a label only when the variable IS the concept (e.g., "Cache" is fine for a node representing the cache; "cacheRef.current" is not).
167
+ - Imperative or noun-phrase forms; not transcripts of source ("Validate JWT" not "jwt.verify(token, key)").
168
+
169
+ ### Abstraction level — match the lens
170
+
171
+ The diagram's job is to compress code into a high-level mental model. If a reader has to open the source to understand your labels, the diagram failed.
172
+
173
+ - **architecture**: nodes are deployable / runtime units. Services, modules, gateways, datastores, queues, external systems, clients. **NEVER** individual functions, control-flow constructs, or code expressions. A function call inside one service is NOT an architecture node — it's an implementation detail. Aim for 4–12 nodes covering the whole system shape.
174
+ - **state**: nodes are named states the program/object can be in. `Loading`, `Authenticated`, `Disconnected`, `Idle`. Edges are transitions, labeled with the triggering event.
175
+ - **flow**: nodes are steps in a procedure. Pick a granularity that yields 6–15 useful nodes — usually function-body-block level, not individual expressions or single statements. "Validate input" is a flow node; "if x > 0" generally isn't.
176
+ - **protocol**: nodes are participating actors (one per participant). Messages between them are edges, not nodes.
177
+
178
+ When in doubt, ask: would a senior engineer recognize this label as a meaningful concept in this codebase? If the label only makes sense after reading the exact line of code beneath it, raise the abstraction.
179
+
180
+ ### Edges — every diagram has them, every node connects
181
+
182
+ A diagram with nodes but no edges is a list pretending to be a diagram. **Every spec MUST have edges.**
183
+
184
+ - Every non-terminal node should have at least one edge in or out. Orphan nodes (zero edges) are almost always a sign of over-fragmentation or the wrong lens.
185
+ - For `flow` and `state`: the edges form a connected graph — you should be able to walk from a start node to a terminal via edges.
186
+ - For `architecture`: every depicted component connects to at least one other unless it's genuinely a leaf (e.g., an isolated external system drawn only to show its existence).
187
+ - For `protocol`: every actor must participate in at least one message edge.
188
+
189
+ If a meaningful relationship can't be expressed via the lens's edge-kind enum, that's a signal the lens is wrong — reconsider Step 1.
190
+
191
+ ---
192
+
193
+ ## Step 4 — Narrate causally (the WHY rule)
194
+
195
+ This is the most important instruction in this document.
196
+
197
+ Each `step.narration` must explain WHY this thing happens at this point in the sequence — what intent is served, what invariant is preserved, what failure mode is avoided. It must not merely label what happens.
198
+
199
+ **BAD** (labels what happens — readers can see this from the diagram):
200
+
201
+ > "Request enters the gateway."
202
+
203
+ **GOOD** (explains why this ordering exists):
204
+
205
+ > "The gateway authenticates at the edge so downstream services can trust the user id in the request context — and so a forged identity never reaches the database layer."
206
+
207
+ **BAD:**
208
+
209
+ > "State transitions from `loading` to `success`."
210
+
211
+ **GOOD:**
212
+
213
+ > "We move to `success` only after the response body has parsed cleanly, not just on a 200 status. A 200 with malformed JSON would otherwise advance the UI to a state that crashes on render."
214
+
215
+ **BAD:**
216
+
217
+ > "Client sends a POST to /auth/token."
218
+
219
+ **GOOD:**
220
+
221
+ > "The client exchanges the auth code on a fresh TLS connection — reusing the login form's connection would leak the code into the form-submission referrer, which is logged by upstream proxies."
222
+
223
+ The narration is the value. Skim-test each step: if removing the diagram still leaves the narration informative, you've done it right. If the narration is just the node label rephrased, rewrite it.
224
+
225
+ ---
226
+
227
+ ## Step 5 — Anchor nodes and steps to code
228
+
229
+ Use `code_anchor` (on nodes) and `code_focus` (on steps) only when you can point to a specific line range in the supplied files. Format: `{ "file": "<path as given in the inputs>", "range": [start, end] }` — 1-indexed, inclusive.
230
+
231
+ When in doubt about exact lines: **omit the anchor**. A missing anchor is correct. A wrong anchor sends the reader to confusing code and erodes trust.
232
+
233
+ Anchor ranges should be tight — the smallest range that contains the referenced behavior. A 100-line range is rarely useful; prefer 1 to 20 lines.
234
+
235
+ ---
236
+
237
+ ## Step 6 — Suggest alternative lenses
238
+
239
+ Populate `alternative_lenses` with 0 to 2 entries describing other views that might help the same reader. Each `reason` is one short sentence stating what the alternative would reveal that the chosen lens does not.
240
+
241
+ Example for a state-lens spec of an auth flow:
242
+
243
+ - `{ "lens": "protocol", "reason": "Shows the client-server message exchange that drives each state transition." }`
244
+ - `{ "lens": "flow", "reason": "Zooms into the branching inside the token-validation routine." }`
245
+
246
+ If no other lens would help, return `[]`.
247
+
248
+ ---
249
+
250
+ ## Step 7 — Step count
251
+
252
+ Generate **6 to 15 steps**, ordered to walk the reader through the diagram in causal order. Fewer than 6 is too sparse to be a guided tour. More than 15 overwhelms.
253
+
254
+ If the scope naturally produces more steps, group them: pick the load-bearing 6 to 15. Detail that doesn't fit belongs in node `metadata` or in the narration of a grouped step, not as a separate channel.
255
+
256
+ Each step:
257
+
258
+ - `highlight.nodes` and `highlight.edges` — what should glow when this step is the cursor. Empty arrays are allowed if the step is purely narrative.
259
+ - `code_focus` — optional. Use when one specific file and line range is the focus of this step.
260
+
261
+ ---
262
+
263
+ ## Step 8 — Output format
264
+
265
+ Return a single JSON value matching the `DiagramSpec` schema below. No prose. No markdown fences. No leading or trailing whitespace beyond the JSON itself.
266
+
267
+ The top-level fields you must set: `lens`, `scope`, `nodes`, `edges`, `steps`, `alternative_lenses`, `generated_at`, `prompt_version`, `model`.
268
+
269
+ - `scope.files` mirrors the file paths in the input.
270
+ - `scope.intent` mirrors the input intent, omitted if there was none.
271
+ - `generated_at` — echo `{{generated_at}}` verbatim.
272
+ - `model` — echo `{{model}}` verbatim.
273
+ - `prompt_version` — set to `""` (empty string). The server overwrites this with the canonical version before caching.
274
+
275
+ ---
276
+
277
+ ## DiagramSpec schema (your JSON must conform to this)
278
+
279
+ ```ts
280
+ {{schema}}
281
+ ```
282
+
283
+ ---
284
+
285
+ ## Final checklist before returning
286
+
287
+ Run through this list mentally before emitting JSON:
288
+
289
+ 1. Single lens chosen — not blended.
290
+ 2. Every `node.kind` and `edge.kind` is one of the values from the table for the chosen lens.
291
+ 3. 6 to 15 steps — not fewer, not more.
292
+ 4. Every step's `narration` answers "why this, why now" — not just "what".
293
+ 5. Every `code_anchor` and `code_focus` is a tight, specific, verifiable range — or omitted.
294
+ 6. Every `edge.from` and `edge.to` matches a node id you defined.
295
+ 7. Every `step.highlight.nodes` and `step.highlight.edges` entry matches an id you defined.
296
+ 8. All node, edge, and step ids are unique within their arrays.
297
+ 9. `alternative_lenses`: 0 to 2 entries, each with a one-line reason.
298
+ 10. Output is a single JSON value with no surrounding prose.
299
+
300
+ <!-- DYNAMIC INPUTS BELOW -->
301
+
302
+ ## Inputs
303
+
304
+ - **Scope:** {{scope_summary}}
305
+ - **Intent:** {{intent}}
306
+ - **Generated at:** {{generated_at}}
307
+ - **Model:** {{model}}
308
+
309
+ ### Source files
310
+
311
+ {{files}}
312
+
313
+ ---
314
+
315
+ Emit the JSON now.
@@ -0,0 +1,44 @@
1
+ import { EXT_TO_LANG } from "../api.js";
2
+ import { type FileEntry } from "../analysis/index.js";
3
+ import type { AnalysisContext } from "../../shared/analysis-schema.js";
4
+ export { EXT_TO_LANG };
5
+ export declare const MAX_SCOPE_TOKENS = 150000;
6
+ export type Scope = {
7
+ kind: "file";
8
+ path: string;
9
+ } | {
10
+ kind: "directory";
11
+ path: string;
12
+ } | {
13
+ kind: "multi";
14
+ paths: string[];
15
+ };
16
+ export interface ResolvedScope {
17
+ files: FileEntry[];
18
+ analysis: AnalysisContext;
19
+ estimated_tokens: number;
20
+ }
21
+ export interface ResolveScopeOptions {
22
+ maxTokens?: number;
23
+ }
24
+ export declare function estimateTokens(content: string): number;
25
+ export declare class ScopeOutsideRootError extends Error {
26
+ readonly path: string;
27
+ constructor(p: string);
28
+ }
29
+ export declare class FileResolutionError extends Error {
30
+ readonly path: string;
31
+ readonly reason: string;
32
+ constructor(p: string, reason: string);
33
+ }
34
+ export declare class EmptyScopeError extends Error {
35
+ constructor();
36
+ }
37
+ export declare class ScopeTooLargeError extends Error {
38
+ readonly estimated_tokens: number;
39
+ readonly max: number;
40
+ readonly suggestion: string;
41
+ constructor(estimated_tokens: number, max: number, fileCount: number);
42
+ }
43
+ export declare function resolveScope(scope: Scope, rootDir: string, opts?: ResolveScopeOptions): Promise<ResolvedScope>;
44
+ //# sourceMappingURL=scope-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-resolver.d.ts","sourceRoot":"","sources":["../../../server/diagram/scope-resolver.ts"],"names":[],"mappings":"AA0CA,OAAO,EAAE,WAAW,EAAe,MAAM,WAAW,CAAC;AAKrD,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,eAAO,MAAM,gBAAgB,SAAU,CAAC;AAExC,MAAM,MAAM,KAAK,GACb;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAEvC,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,QAAQ,EAAE,eAAe,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAKD,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBACV,CAAC,EAAE,MAAM;CAKtB;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBACZ,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAMtC;AAED,qBAAa,eAAgB,SAAQ,KAAK;;CAKzC;AAED,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAChB,gBAAgB,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAWrE;AA8GD,wBAAsB,YAAY,CAChC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,mBAAmB,GACzB,OAAO,CAAC,aAAa,CAAC,CA4BxB"}
@@ -0,0 +1,198 @@
1
+ // Resolve a user-supplied Scope (single file, directory, or array of file
2
+ // paths) into a normalized LLM payload: file contents + batched analysis
3
+ // context + estimated token count. Sits between path selection (m1) and
4
+ // diagram generation (m2 t6).
5
+ //
6
+ // Algorithm (high-level):
7
+ //
8
+ // resolveScope(scope, rootDir)
9
+ // │
10
+ // ├─ realpath(rootDir)
11
+ // │
12
+ // ├─ scope.kind ─┬─ 'file' → relPaths = [scope.path]
13
+ // │ ├─ 'multi' → relPaths = scope.paths
14
+ // │ └─ 'directory' → selectFromPath(absDir), rebase
15
+ // │ relpaths against realRoot
16
+ // │
17
+ // ├─ Promise.all(relPaths.map(loadFileEntry))
18
+ // │ • each path: containment check → stat → read → classify
19
+ // │ • per-path failures throw a typed error (fail-fast)
20
+ // │
21
+ // ├─ empty? → EmptyScopeError
22
+ // │
23
+ // ├─ Σ estimateTokens(content)
24
+ // │ • over budget? → ScopeTooLargeError with file count + suggestion
25
+ // │
26
+ // ├─ runAnalysis(files, realRoot)
27
+ // │ • tree-sitter + ts-morph + git-context (best-effort; t3)
28
+ // │
29
+ // └─ return { files, analysis, estimated_tokens }
30
+ //
31
+ // Error contract:
32
+ // - ScopeOutsideRootError path escapes the project root (lex or via symlink)
33
+ // - FileResolutionError stat/read/size failure for a specific path
34
+ // - EmptyScopeError no files in the resolved set
35
+ // - ScopeTooLargeError sum of estimated tokens > maxTokens budget
36
+ //
37
+ // All errors carry structured fields so the caller can build a useful
38
+ // HTTP response without parsing error messages.
39
+ import { readFile, realpath, stat } from "node:fs/promises";
40
+ import path from "node:path";
41
+ import { EXT_TO_LANG, languageFor } from "../api.js";
42
+ import { MAX_FILE_BYTES, selectFromPath, } from "../input/path-selector.js";
43
+ import { runAnalysis } from "../analysis/index.js";
44
+ export { EXT_TO_LANG };
45
+ export const MAX_SCOPE_TOKENS = 150_000;
46
+ // Heuristic: ~4 chars per token for code-ish content. Deterministic, offline,
47
+ // and good enough for a budget guardrail (the Anthropic SDK's exact counter
48
+ // would require a network call per scope — see Decisions in the task file).
49
+ export function estimateTokens(content) {
50
+ return Math.ceil(content.length / 4);
51
+ }
52
+ export class ScopeOutsideRootError extends Error {
53
+ path;
54
+ constructor(p) {
55
+ super(`scope path escapes the project root: ${p}`);
56
+ this.name = "ScopeOutsideRootError";
57
+ this.path = p;
58
+ }
59
+ }
60
+ export class FileResolutionError extends Error {
61
+ path;
62
+ reason;
63
+ constructor(p, reason) {
64
+ super(`failed to resolve file ${p}: ${reason}`);
65
+ this.name = "FileResolutionError";
66
+ this.path = p;
67
+ this.reason = reason;
68
+ }
69
+ }
70
+ export class EmptyScopeError extends Error {
71
+ constructor() {
72
+ super("scope resolved to zero files");
73
+ this.name = "EmptyScopeError";
74
+ }
75
+ }
76
+ export class ScopeTooLargeError extends Error {
77
+ estimated_tokens;
78
+ max;
79
+ suggestion;
80
+ constructor(estimated_tokens, max, fileCount) {
81
+ const suggestion = `Scope contains ${fileCount} file${fileCount === 1 ? "" : "s"} ` +
82
+ `estimating ${estimated_tokens.toLocaleString()} tokens (max ${max.toLocaleString()}). ` +
83
+ `Narrow to a smaller scope (single file, focused subdirectory, or 2–5 related files).`;
84
+ super(`scope too large: ${estimated_tokens} tokens > ${max} max`);
85
+ this.name = "ScopeTooLargeError";
86
+ this.estimated_tokens = estimated_tokens;
87
+ this.max = max;
88
+ this.suggestion = suggestion;
89
+ }
90
+ }
91
+ // Resolve `relPath` against `realRoot` to a contained absolute path, or
92
+ // classify the failure. Returns:
93
+ // { kind: 'ok', abs } — path is inside realRoot (post-symlink)
94
+ // { kind: 'lex-escape' } — lexical traversal (e.g. '../x')
95
+ // { kind: 'not-found' } — stat failed (ENOENT, EACCES on parent)
96
+ // { kind: 'symlink-escape' } — exists but resolves outside realRoot
97
+ //
98
+ // Separating the four cases is what lets us throw the right typed error.
99
+ // `resolveContainedPath` (in api.ts) collapses them all to `null`, which is
100
+ // fine for the API layer's "show 404 vs 400" decision but loses the
101
+ // resolution-vs-containment distinction we need here.
102
+ async function classifyPath(realRoot, relPath) {
103
+ const requested = path.resolve(realRoot, relPath);
104
+ const lexContained = requested === realRoot || requested.startsWith(realRoot + path.sep);
105
+ if (!lexContained)
106
+ return { kind: "lex-escape" };
107
+ let abs;
108
+ try {
109
+ abs = await realpath(requested);
110
+ }
111
+ catch (err) {
112
+ const msg = err instanceof Error ? err.message : String(err);
113
+ return { kind: "not-found", reason: msg };
114
+ }
115
+ const realContained = abs === realRoot || abs.startsWith(realRoot + path.sep);
116
+ if (!realContained)
117
+ return { kind: "symlink-escape" };
118
+ return { kind: "ok", abs };
119
+ }
120
+ async function loadFileEntry(realRoot, relPath) {
121
+ const c = await classifyPath(realRoot, relPath);
122
+ if (c.kind === "lex-escape" || c.kind === "symlink-escape") {
123
+ throw new ScopeOutsideRootError(relPath);
124
+ }
125
+ if (c.kind === "not-found") {
126
+ throw new FileResolutionError(relPath, `not-found: ${c.reason}`);
127
+ }
128
+ const abs = c.abs;
129
+ const st = await stat(abs);
130
+ if (!st.isFile()) {
131
+ throw new FileResolutionError(relPath, "not-a-file");
132
+ }
133
+ if (st.size > MAX_FILE_BYTES) {
134
+ throw new FileResolutionError(relPath, `too-large: ${st.size} bytes (max ${MAX_FILE_BYTES})`);
135
+ }
136
+ let content;
137
+ try {
138
+ content = await readFile(abs, "utf8");
139
+ }
140
+ catch (err) {
141
+ const msg = err instanceof Error ? err.message : String(err);
142
+ throw new FileResolutionError(relPath, `unreadable: ${msg}`);
143
+ }
144
+ const relFromRoot = path.relative(realRoot, abs) || path.basename(abs);
145
+ const language = languageFor(path.extname(abs));
146
+ return {
147
+ path: relFromRoot,
148
+ content,
149
+ language,
150
+ size: st.size,
151
+ };
152
+ }
153
+ async function relPathsFromScope(realRoot, scope) {
154
+ if (scope.kind === "file") {
155
+ return [scope.path];
156
+ }
157
+ if (scope.kind === "multi") {
158
+ return scope.paths;
159
+ }
160
+ // directory
161
+ const c = await classifyPath(realRoot, scope.path);
162
+ if (c.kind === "lex-escape" || c.kind === "symlink-escape") {
163
+ throw new ScopeOutsideRootError(scope.path);
164
+ }
165
+ if (c.kind === "not-found") {
166
+ throw new FileResolutionError(scope.path, `not-found: ${c.reason}`);
167
+ }
168
+ const abs = c.abs;
169
+ const st = await stat(abs);
170
+ if (!st.isDirectory()) {
171
+ throw new FileResolutionError(scope.path, "not-a-directory");
172
+ }
173
+ const sel = await selectFromPath(abs);
174
+ // selectFromPath returns paths relative to `abs`. Rebase against realRoot.
175
+ return sel.files.map((rel) => path.relative(realRoot, path.join(abs, rel)));
176
+ }
177
+ export async function resolveScope(scope, rootDir, opts) {
178
+ const maxTokens = opts?.maxTokens ?? MAX_SCOPE_TOKENS;
179
+ const realRoot = await realpath(rootDir);
180
+ const relPaths = await relPathsFromScope(realRoot, scope);
181
+ if (relPaths.length === 0) {
182
+ throw new EmptyScopeError();
183
+ }
184
+ const files = await Promise.all(relPaths.map((rel) => loadFileEntry(realRoot, rel)));
185
+ if (files.length === 0) {
186
+ throw new EmptyScopeError();
187
+ }
188
+ let estimated_tokens = 0;
189
+ for (const f of files) {
190
+ estimated_tokens += estimateTokens(f.content);
191
+ }
192
+ if (estimated_tokens > maxTokens) {
193
+ throw new ScopeTooLargeError(estimated_tokens, maxTokens, files.length);
194
+ }
195
+ const analysis = await runAnalysis(files, realRoot);
196
+ return { files, analysis, estimated_tokens };
197
+ }
198
+ //# sourceMappingURL=scope-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-resolver.js","sourceRoot":"","sources":["../../../server/diagram/scope-resolver.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,yEAAyE;AACzE,wEAAwE;AACxE,8BAA8B;AAC9B,EAAE;AACF,0BAA0B;AAC1B,EAAE;AACF,iCAAiC;AACjC,QAAQ;AACR,2BAA2B;AAC3B,QAAQ;AACR,8DAA8D;AAC9D,6DAA6D;AAC7D,qEAAqE;AACrE,gEAAgE;AAChE,QAAQ;AACR,kDAAkD;AAClD,qEAAqE;AACrE,iEAAiE;AACjE,QAAQ;AACR,kCAAkC;AAClC,QAAQ;AACR,mCAAmC;AACnC,8EAA8E;AAC9E,QAAQ;AACR,sCAAsC;AACtC,sEAAsE;AACtE,QAAQ;AACR,sDAAsD;AACtD,EAAE;AACF,kBAAkB;AAClB,iFAAiF;AACjF,yEAAyE;AACzE,2DAA2D;AAC3D,yEAAyE;AACzE,EAAE;AACF,sEAAsE;AACtE,gDAAgD;AAEhD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,WAAW,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B,CAAC;IAED,IAAI,gBAAgB,GAAG,CAAC,CAAC;IACzB,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,gBAAgB,IAAI,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;IACD,IAAI,gBAAgB,GAAG,SAAS,EAAE,CAAC;QACjC,MAAM,IAAI,kBAAkB,CAAC,gBAAgB,EAAE,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1E,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAEpD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,18 @@
1
+ export interface SpawnRequest {
2
+ command: string;
3
+ args: readonly string[];
4
+ signal?: AbortSignal;
5
+ cwd?: string;
6
+ }
7
+ export interface SpawnHandle {
8
+ stdout: NodeJS.ReadableStream;
9
+ stderr: NodeJS.ReadableStream;
10
+ exitCode: Promise<number | null>;
11
+ kill: (signal?: NodeJS.Signals) => void;
12
+ pid: number | undefined;
13
+ }
14
+ export interface MinimalSubprocessSpawner {
15
+ spawn(req: SpawnRequest): SpawnHandle;
16
+ }
17
+ export declare const defaultSpawner: MinimalSubprocessSpawner;
18
+ //# sourceMappingURL=spawn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../server/diagram/spawn.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC;IAK9B,QAAQ,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAGjC,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC;IAExC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CACzB;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,GAAG,EAAE,YAAY,GAAG,WAAW,CAAC;CACvC;AAED,eAAO,MAAM,cAAc,EAAE,wBA2F5B,CAAC"}