mergestory 0.0.0-stage → 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 (474) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +2 -0
  3. package/README.md +48 -2
  4. package/assets/kokoro-plugin/package-lock.json +1139 -0
  5. package/dist/analyzer/analyze.d.ts +8 -0
  6. package/dist/analyzer/analyze.js +328 -0
  7. package/dist/analyzer/components.d.ts +18 -0
  8. package/dist/analyzer/components.js +266 -0
  9. package/dist/analyzer/dependencies.d.ts +13 -0
  10. package/dist/analyzer/dependencies.js +349 -0
  11. package/dist/analyzer/evidence.d.ts +15 -0
  12. package/dist/analyzer/evidence.js +73 -0
  13. package/dist/analyzer/hunks.d.ts +21 -0
  14. package/dist/analyzer/hunks.js +88 -0
  15. package/dist/analyzer/imports.d.ts +46 -0
  16. package/dist/analyzer/imports.js +87 -0
  17. package/dist/analyzer/index.d.ts +14 -0
  18. package/dist/analyzer/index.js +16 -0
  19. package/dist/analyzer/languages/go.d.ts +2 -0
  20. package/dist/analyzer/languages/go.js +76 -0
  21. package/dist/analyzer/languages/index.d.ts +18 -0
  22. package/dist/analyzer/languages/index.js +72 -0
  23. package/dist/analyzer/languages/javascript.d.ts +2 -0
  24. package/dist/analyzer/languages/javascript.js +336 -0
  25. package/dist/analyzer/languages/jvm.d.ts +2 -0
  26. package/dist/analyzer/languages/jvm.js +157 -0
  27. package/dist/analyzer/languages/others.d.ts +2 -0
  28. package/dist/analyzer/languages/others.js +40 -0
  29. package/dist/analyzer/languages/php.d.ts +2 -0
  30. package/dist/analyzer/languages/php.js +81 -0
  31. package/dist/analyzer/languages/python.d.ts +2 -0
  32. package/dist/analyzer/languages/python.js +180 -0
  33. package/dist/analyzer/languages/ruby.d.ts +2 -0
  34. package/dist/analyzer/languages/ruby.js +99 -0
  35. package/dist/analyzer/languages/rust.d.ts +2 -0
  36. package/dist/analyzer/languages/rust.js +164 -0
  37. package/dist/analyzer/languages/shared.d.ts +35 -0
  38. package/dist/analyzer/languages/shared.js +43 -0
  39. package/dist/analyzer/languages/types.d.ts +78 -0
  40. package/dist/analyzer/languages/types.js +2 -0
  41. package/dist/analyzer/pack-format.d.ts +27 -0
  42. package/dist/analyzer/pack-format.js +139 -0
  43. package/dist/analyzer/pack.d.ts +26 -0
  44. package/dist/analyzer/pack.js +498 -0
  45. package/dist/analyzer/relationships.d.ts +17 -0
  46. package/dist/analyzer/relationships.js +34 -0
  47. package/dist/analyzer/risk-rules.d.ts +287 -0
  48. package/dist/analyzer/risk-rules.js +373 -0
  49. package/dist/analyzer/risks.d.ts +36 -0
  50. package/dist/analyzer/risks.js +480 -0
  51. package/dist/analyzer/roles.d.ts +11 -0
  52. package/dist/analyzer/roles.js +280 -0
  53. package/dist/analyzer/scan.d.ts +26 -0
  54. package/dist/analyzer/scan.js +157 -0
  55. package/dist/analyzer/signals.d.ts +20 -0
  56. package/dist/analyzer/signals.js +51 -0
  57. package/dist/analyzer/symbol-changes.d.ts +11 -0
  58. package/dist/analyzer/symbol-changes.js +101 -0
  59. package/dist/analyzer/symbol-types.d.ts +17 -0
  60. package/dist/analyzer/symbol-types.js +9 -0
  61. package/dist/analyzer/symbols.d.ts +4 -0
  62. package/dist/analyzer/symbols.js +16 -0
  63. package/dist/analyzer/trivial.d.ts +13 -0
  64. package/dist/analyzer/trivial.js +137 -0
  65. package/dist/analyzer/util.d.ts +6 -0
  66. package/dist/analyzer/util.js +24 -0
  67. package/dist/cli/commands/authoring.d.ts +9 -0
  68. package/dist/cli/commands/authoring.js +98 -0
  69. package/dist/cli/commands/cache.d.ts +4 -0
  70. package/dist/cli/commands/cache.js +37 -0
  71. package/dist/cli/commands/doctor.d.ts +5 -0
  72. package/dist/cli/commands/doctor.js +37 -0
  73. package/dist/cli/commands/generate.d.ts +8 -0
  74. package/dist/cli/commands/generate.js +69 -0
  75. package/dist/cli/commands/jobs.d.ts +8 -0
  76. package/dist/cli/commands/jobs.js +70 -0
  77. package/dist/cli/commands/publish.d.ts +8 -0
  78. package/dist/cli/commands/publish.js +120 -0
  79. package/dist/cli/commands/serve.d.ts +4 -0
  80. package/dist/cli/commands/serve.js +69 -0
  81. package/dist/cli/commands/setup.d.ts +14 -0
  82. package/dist/cli/commands/setup.js +108 -0
  83. package/dist/cli/commands/shared.d.ts +18 -0
  84. package/dist/cli/commands/shared.js +24 -0
  85. package/dist/cli/files.d.ts +26 -0
  86. package/dist/cli/files.js +98 -0
  87. package/dist/cli/format.d.ts +55 -0
  88. package/dist/cli/format.js +295 -0
  89. package/dist/cli/inputs.d.ts +23 -0
  90. package/dist/cli/inputs.js +96 -0
  91. package/dist/cli/io.d.ts +19 -0
  92. package/dist/cli/io.js +31 -0
  93. package/dist/cli/main.d.ts +2 -0
  94. package/dist/cli/main.js +15 -0
  95. package/dist/cli/options.d.ts +105 -0
  96. package/dist/cli/options.js +324 -0
  97. package/dist/cli/program.d.ts +12 -0
  98. package/dist/cli/program.js +146 -0
  99. package/dist/cli/runtime.d.ts +59 -0
  100. package/dist/cli/runtime.js +83 -0
  101. package/dist/cli/style.d.ts +13 -0
  102. package/dist/cli/style.js +27 -0
  103. package/dist/core/binaries.d.ts +7 -0
  104. package/dist/core/binaries.js +33 -0
  105. package/dist/core/binary-paths.d.ts +5 -0
  106. package/dist/core/binary-paths.js +92 -0
  107. package/dist/core/cache.d.ts +14 -0
  108. package/dist/core/cache.js +43 -0
  109. package/dist/core/child-env.d.ts +9 -0
  110. package/dist/core/child-env.js +61 -0
  111. package/dist/core/concurrency.d.ts +13 -0
  112. package/dist/core/concurrency.js +58 -0
  113. package/dist/core/config.d.ts +223 -0
  114. package/dist/core/config.js +454 -0
  115. package/dist/core/context.d.ts +39 -0
  116. package/dist/core/context.js +44 -0
  117. package/dist/core/cost.d.ts +46 -0
  118. package/dist/core/cost.js +108 -0
  119. package/dist/core/diagram-metrics.d.ts +57 -0
  120. package/dist/core/diagram-metrics.js +63 -0
  121. package/dist/core/diff-view.d.ts +44 -0
  122. package/dist/core/diff-view.js +136 -0
  123. package/dist/core/errors.d.ts +47 -0
  124. package/dist/core/errors.js +94 -0
  125. package/dist/core/ids.d.ts +11 -0
  126. package/dist/core/ids.js +36 -0
  127. package/dist/core/json.d.ts +8 -0
  128. package/dist/core/json.js +17 -0
  129. package/dist/core/languages.d.ts +19 -0
  130. package/dist/core/languages.js +292 -0
  131. package/dist/core/logger.d.ts +29 -0
  132. package/dist/core/logger.js +68 -0
  133. package/dist/core/net.d.ts +16 -0
  134. package/dist/core/net.js +80 -0
  135. package/dist/core/path-policy.d.ts +20 -0
  136. package/dist/core/path-policy.js +202 -0
  137. package/dist/core/paths.d.ts +18 -0
  138. package/dist/core/paths.js +53 -0
  139. package/dist/core/posix.d.ts +12 -0
  140. package/dist/core/posix.js +50 -0
  141. package/dist/core/process.d.ts +22 -0
  142. package/dist/core/process.js +117 -0
  143. package/dist/core/providers.d.ts +204 -0
  144. package/dist/core/providers.js +2 -0
  145. package/dist/core/redact.d.ts +11 -0
  146. package/dist/core/redact.js +70 -0
  147. package/dist/core/render-plan.d.ts +307 -0
  148. package/dist/core/render-plan.js +7 -0
  149. package/dist/core/retry.d.ts +54 -0
  150. package/dist/core/retry.js +116 -0
  151. package/dist/core/run-folder.d.ts +74 -0
  152. package/dist/core/run-folder.js +129 -0
  153. package/dist/core/secrets.d.ts +56 -0
  154. package/dist/core/secrets.js +301 -0
  155. package/dist/core/storyboard-facts.d.ts +22 -0
  156. package/dist/core/storyboard-facts.js +61 -0
  157. package/dist/core/storyboard-schema.d.ts +1279 -0
  158. package/dist/core/storyboard-schema.js +342 -0
  159. package/dist/core/text.d.ts +43 -0
  160. package/dist/core/text.js +94 -0
  161. package/dist/core/types.d.ts +459 -0
  162. package/dist/core/types.js +17 -0
  163. package/dist/doctor/check.d.ts +6 -0
  164. package/dist/doctor/check.js +18 -0
  165. package/dist/doctor/deps.d.ts +2 -0
  166. package/dist/doctor/deps.js +90 -0
  167. package/dist/doctor/format.d.ts +9 -0
  168. package/dist/doctor/format.js +19 -0
  169. package/dist/doctor/github.d.ts +2 -0
  170. package/dist/doctor/github.js +13 -0
  171. package/dist/doctor/home.d.ts +2 -0
  172. package/dist/doctor/home.js +26 -0
  173. package/dist/doctor/index.d.ts +18 -0
  174. package/dist/doctor/index.js +81 -0
  175. package/dist/doctor/llm.d.ts +2 -0
  176. package/dist/doctor/llm.js +32 -0
  177. package/dist/doctor/publish.d.ts +2 -0
  178. package/dist/doctor/publish.js +16 -0
  179. package/dist/doctor/s3.d.ts +2 -0
  180. package/dist/doctor/s3.js +125 -0
  181. package/dist/doctor/speech.d.ts +2 -0
  182. package/dist/doctor/speech.js +112 -0
  183. package/dist/doctor/tools.d.ts +5 -0
  184. package/dist/doctor/tools.js +58 -0
  185. package/dist/doctor/types.d.ts +92 -0
  186. package/dist/doctor/types.js +2 -0
  187. package/dist/doctor/youtube.d.ts +2 -0
  188. package/dist/doctor/youtube.js +73 -0
  189. package/dist/github/client.d.ts +108 -0
  190. package/dist/github/client.js +499 -0
  191. package/dist/github/errors.d.ts +37 -0
  192. package/dist/github/errors.js +155 -0
  193. package/dist/github/index.d.ts +13 -0
  194. package/dist/github/index.js +9 -0
  195. package/dist/github/linked-issues.d.ts +37 -0
  196. package/dist/github/linked-issues.js +131 -0
  197. package/dist/github/model.d.ts +81 -0
  198. package/dist/github/model.js +114 -0
  199. package/dist/github/notify.d.ts +27 -0
  200. package/dist/github/notify.js +118 -0
  201. package/dist/github/pr-url.d.ts +27 -0
  202. package/dist/github/pr-url.js +122 -0
  203. package/dist/github/token.d.ts +16 -0
  204. package/dist/github/token.js +69 -0
  205. package/dist/index.d.ts +29 -0
  206. package/dist/index.js +19 -0
  207. package/dist/jobs/input-rules.d.ts +20 -0
  208. package/dist/jobs/input-rules.js +100 -0
  209. package/dist/jobs/model.d.ts +47 -0
  210. package/dist/jobs/model.js +18 -0
  211. package/dist/jobs/runner.d.ts +43 -0
  212. package/dist/jobs/runner.js +165 -0
  213. package/dist/jobs/store.d.ts +67 -0
  214. package/dist/jobs/store.js +314 -0
  215. package/dist/jobs/view.d.ts +48 -0
  216. package/dist/jobs/view.js +111 -0
  217. package/dist/jobs/worker.d.ts +24 -0
  218. package/dist/jobs/worker.js +47 -0
  219. package/dist/llm/anthropic.d.ts +11 -0
  220. package/dist/llm/anthropic.js +225 -0
  221. package/dist/llm/index.d.ts +10 -0
  222. package/dist/llm/index.js +27 -0
  223. package/dist/llm/openai-compatible.d.ts +33 -0
  224. package/dist/llm/openai-compatible.js +378 -0
  225. package/dist/llm/prices.d.ts +26 -0
  226. package/dist/llm/prices.js +41 -0
  227. package/dist/llm/shared.d.ts +30 -0
  228. package/dist/llm/shared.js +115 -0
  229. package/dist/narration/assemble.d.ts +36 -0
  230. package/dist/narration/assemble.js +282 -0
  231. package/dist/narration/audio.d.ts +61 -0
  232. package/dist/narration/audio.js +301 -0
  233. package/dist/narration/captions.d.ts +37 -0
  234. package/dist/narration/captions.js +195 -0
  235. package/dist/narration/chunking.d.ts +6 -0
  236. package/dist/narration/chunking.js +46 -0
  237. package/dist/narration/convert.d.ts +9 -0
  238. package/dist/narration/convert.js +90 -0
  239. package/dist/narration/elevenlabs.d.ts +5 -0
  240. package/dist/narration/elevenlabs.js +53 -0
  241. package/dist/narration/http-errors.d.ts +14 -0
  242. package/dist/narration/http-errors.js +74 -0
  243. package/dist/narration/index.d.ts +21 -0
  244. package/dist/narration/index.js +22 -0
  245. package/dist/narration/kokoro-install.d.ts +30 -0
  246. package/dist/narration/kokoro-install.js +284 -0
  247. package/dist/narration/kokoro-model.d.ts +54 -0
  248. package/dist/narration/kokoro-model.js +168 -0
  249. package/dist/narration/kokoro-plugin.d.ts +78 -0
  250. package/dist/narration/kokoro-plugin.js +245 -0
  251. package/dist/narration/kokoro.d.ts +22 -0
  252. package/dist/narration/kokoro.js +231 -0
  253. package/dist/narration/openai.d.ts +4 -0
  254. package/dist/narration/openai.js +54 -0
  255. package/dist/narration/pricing.d.ts +8 -0
  256. package/dist/narration/pricing.js +17 -0
  257. package/dist/narration/remote-speech.d.ts +53 -0
  258. package/dist/narration/remote-speech.js +100 -0
  259. package/dist/narration/say.d.ts +28 -0
  260. package/dist/narration/say.js +178 -0
  261. package/dist/narration/select.d.ts +27 -0
  262. package/dist/narration/select.js +80 -0
  263. package/dist/narration/silent.d.ts +2 -0
  264. package/dist/narration/silent.js +18 -0
  265. package/dist/narration/speakable.d.ts +20 -0
  266. package/dist/narration/speakable.js +398 -0
  267. package/dist/narration/synthesize.d.ts +25 -0
  268. package/dist/narration/synthesize.js +220 -0
  269. package/dist/narration/wav.d.ts +37 -0
  270. package/dist/narration/wav.js +170 -0
  271. package/dist/pipeline/authoring.d.ts +8 -0
  272. package/dist/pipeline/authoring.js +117 -0
  273. package/dist/pipeline/commands.d.ts +9 -0
  274. package/dist/pipeline/commands.js +21 -0
  275. package/dist/pipeline/fit-duration.d.ts +41 -0
  276. package/dist/pipeline/fit-duration.js +150 -0
  277. package/dist/pipeline/index.d.ts +9 -0
  278. package/dist/pipeline/index.js +9 -0
  279. package/dist/pipeline/inputs.d.ts +42 -0
  280. package/dist/pipeline/inputs.js +171 -0
  281. package/dist/pipeline/plan.d.ts +8 -0
  282. package/dist/pipeline/plan.js +85 -0
  283. package/dist/pipeline/planned-egress.d.ts +21 -0
  284. package/dist/pipeline/planned-egress.js +43 -0
  285. package/dist/pipeline/prepare.d.ts +26 -0
  286. package/dist/pipeline/prepare.js +84 -0
  287. package/dist/pipeline/presentation.d.ts +26 -0
  288. package/dist/pipeline/presentation.js +110 -0
  289. package/dist/pipeline/publish-run.d.ts +71 -0
  290. package/dist/pipeline/publish-run.js +295 -0
  291. package/dist/pipeline/run.d.ts +7 -0
  292. package/dist/pipeline/run.js +196 -0
  293. package/dist/pipeline/storyboard-choice.d.ts +34 -0
  294. package/dist/pipeline/storyboard-choice.js +129 -0
  295. package/dist/pipeline/types.d.ts +76 -0
  296. package/dist/pipeline/types.js +2 -0
  297. package/dist/publish/access-probe.d.ts +55 -0
  298. package/dist/publish/access-probe.js +249 -0
  299. package/dist/publish/bundle.d.ts +20 -0
  300. package/dist/publish/bundle.js +57 -0
  301. package/dist/publish/comment.d.ts +10 -0
  302. package/dist/publish/comment.js +184 -0
  303. package/dist/publish/content-types.d.ts +15 -0
  304. package/dist/publish/content-types.js +41 -0
  305. package/dist/publish/index.d.ts +18 -0
  306. package/dist/publish/index.js +30 -0
  307. package/dist/publish/keys.d.ts +10 -0
  308. package/dist/publish/keys.js +30 -0
  309. package/dist/publish/local.d.ts +33 -0
  310. package/dist/publish/local.js +143 -0
  311. package/dist/publish/privacy.d.ts +20 -0
  312. package/dist/publish/privacy.js +21 -0
  313. package/dist/publish/s3/bucket.d.ts +22 -0
  314. package/dist/publish/s3/bucket.js +82 -0
  315. package/dist/publish/s3/client.d.ts +33 -0
  316. package/dist/publish/s3/client.js +134 -0
  317. package/dist/publish/s3/failures.d.ts +22 -0
  318. package/dist/publish/s3/failures.js +110 -0
  319. package/dist/publish/s3/index.d.ts +5 -0
  320. package/dist/publish/s3/index.js +6 -0
  321. package/dist/publish/s3/links.d.ts +38 -0
  322. package/dist/publish/s3/links.js +60 -0
  323. package/dist/publish/s3/protected-links.d.ts +29 -0
  324. package/dist/publish/s3/protected-links.js +67 -0
  325. package/dist/publish/s3/publisher.d.ts +32 -0
  326. package/dist/publish/s3/publisher.js +123 -0
  327. package/dist/publish/s3/settings.d.ts +29 -0
  328. package/dist/publish/s3/settings.js +64 -0
  329. package/dist/publish/s3/upload.d.ts +29 -0
  330. package/dist/publish/s3/upload.js +145 -0
  331. package/dist/publish/severity.d.ts +9 -0
  332. package/dist/publish/severity.js +18 -0
  333. package/dist/publish/text.d.ts +23 -0
  334. package/dist/publish/text.js +94 -0
  335. package/dist/publish/types.d.ts +67 -0
  336. package/dist/publish/types.js +12 -0
  337. package/dist/publish/vtt.d.ts +9 -0
  338. package/dist/publish/vtt.js +43 -0
  339. package/dist/publish/watch-page.d.ts +4 -0
  340. package/dist/publish/watch-page.js +463 -0
  341. package/dist/publish/youtube/credentials.d.ts +33 -0
  342. package/dist/publish/youtube/credentials.js +162 -0
  343. package/dist/publish/youtube/description.d.ts +56 -0
  344. package/dist/publish/youtube/description.js +197 -0
  345. package/dist/publish/youtube/google-api.d.ts +95 -0
  346. package/dist/publish/youtube/google-api.js +339 -0
  347. package/dist/publish/youtube/index.d.ts +7 -0
  348. package/dist/publish/youtube/index.js +8 -0
  349. package/dist/publish/youtube/loopback.d.ts +13 -0
  350. package/dist/publish/youtube/loopback.js +144 -0
  351. package/dist/publish/youtube/oauth.d.ts +68 -0
  352. package/dist/publish/youtube/oauth.js +159 -0
  353. package/dist/publish/youtube/prompt.d.ts +27 -0
  354. package/dist/publish/youtube/prompt.js +94 -0
  355. package/dist/publish/youtube/publisher.d.ts +38 -0
  356. package/dist/publish/youtube/publisher.js +346 -0
  357. package/dist/publish/youtube/scopes.d.ts +32 -0
  358. package/dist/publish/youtube/scopes.js +55 -0
  359. package/dist/publish/youtube/sign-in.d.ts +37 -0
  360. package/dist/publish/youtube/sign-in.js +137 -0
  361. package/dist/publish/youtube/upload.d.ts +43 -0
  362. package/dist/publish/youtube/upload.js +210 -0
  363. package/dist/render/browser.d.ts +23 -0
  364. package/dist/render/browser.js +219 -0
  365. package/dist/render/chromium-renderer.d.ts +56 -0
  366. package/dist/render/chromium-renderer.js +519 -0
  367. package/dist/render/ffmpeg.d.ts +55 -0
  368. package/dist/render/ffmpeg.js +212 -0
  369. package/dist/render/fonts.d.ts +10 -0
  370. package/dist/render/fonts.js +42 -0
  371. package/dist/render/index.d.ts +9 -0
  372. package/dist/render/index.js +11 -0
  373. package/dist/render/page.d.ts +46 -0
  374. package/dist/render/page.js +123 -0
  375. package/dist/render/playwright.d.ts +3 -0
  376. package/dist/render/playwright.js +6 -0
  377. package/dist/render/runtime-bundle.d.ts +2 -0
  378. package/dist/render/runtime-bundle.js +72 -0
  379. package/dist/runtime/runtime.js +1626 -0
  380. package/dist/server/auth.d.ts +17 -0
  381. package/dist/server/auth.js +58 -0
  382. package/dist/server/http.d.ts +43 -0
  383. package/dist/server/http.js +119 -0
  384. package/dist/server/index.d.ts +46 -0
  385. package/dist/server/index.js +310 -0
  386. package/dist/server/queue.d.ts +30 -0
  387. package/dist/server/queue.js +76 -0
  388. package/dist/server/schema.d.ts +103 -0
  389. package/dist/server/schema.js +121 -0
  390. package/dist/server/source.d.ts +17 -0
  391. package/dist/server/source.js +100 -0
  392. package/dist/sources/assemble.d.ts +86 -0
  393. package/dist/sources/assemble.js +117 -0
  394. package/dist/sources/diff-parser.d.ts +14 -0
  395. package/dist/sources/diff-parser.js +84 -0
  396. package/dist/sources/git.d.ts +28 -0
  397. package/dist/sources/git.js +108 -0
  398. package/dist/sources/github.d.ts +20 -0
  399. package/dist/sources/github.js +192 -0
  400. package/dist/sources/hunk-selection.d.ts +25 -0
  401. package/dist/sources/hunk-selection.js +46 -0
  402. package/dist/sources/index.d.ts +23 -0
  403. package/dist/sources/index.js +62 -0
  404. package/dist/sources/limits.d.ts +27 -0
  405. package/dist/sources/limits.js +22 -0
  406. package/dist/sources/local.d.ts +34 -0
  407. package/dist/sources/local.js +555 -0
  408. package/dist/sources/reader.d.ts +13 -0
  409. package/dist/sources/reader.js +45 -0
  410. package/dist/sources/remote.d.ts +13 -0
  411. package/dist/sources/remote.js +41 -0
  412. package/dist/sources/repo-context.d.ts +34 -0
  413. package/dist/sources/repo-context.js +144 -0
  414. package/dist/sources/text.d.ts +25 -0
  415. package/dist/sources/text.js +71 -0
  416. package/dist/storyboard/authoring.d.ts +108 -0
  417. package/dist/storyboard/authoring.js +196 -0
  418. package/dist/storyboard/claims.d.ts +35 -0
  419. package/dist/storyboard/claims.js +318 -0
  420. package/dist/storyboard/coderef.d.ts +28 -0
  421. package/dist/storyboard/coderef.js +118 -0
  422. package/dist/storyboard/generate.d.ts +25 -0
  423. package/dist/storyboard/generate.js +194 -0
  424. package/dist/storyboard/heuristic-code.d.ts +91 -0
  425. package/dist/storyboard/heuristic-code.js +524 -0
  426. package/dist/storyboard/heuristic-context.d.ts +42 -0
  427. package/dist/storyboard/heuristic-context.js +102 -0
  428. package/dist/storyboard/heuristic-facts.d.ts +106 -0
  429. package/dist/storyboard/heuristic-facts.js +415 -0
  430. package/dist/storyboard/heuristic-overview.d.ts +4 -0
  431. package/dist/storyboard/heuristic-overview.js +151 -0
  432. package/dist/storyboard/heuristic-review.d.ts +10 -0
  433. package/dist/storyboard/heuristic-review.js +158 -0
  434. package/dist/storyboard/heuristic-scenes.d.ts +8 -0
  435. package/dist/storyboard/heuristic-scenes.js +357 -0
  436. package/dist/storyboard/heuristic-shared.d.ts +43 -0
  437. package/dist/storyboard/heuristic-shared.js +136 -0
  438. package/dist/storyboard/heuristic.d.ts +15 -0
  439. package/dist/storyboard/heuristic.js +324 -0
  440. package/dist/storyboard/identifiers.d.ts +51 -0
  441. package/dist/storyboard/identifiers.js +195 -0
  442. package/dist/storyboard/index.d.ts +10 -0
  443. package/dist/storyboard/index.js +10 -0
  444. package/dist/storyboard/prompts.d.ts +16 -0
  445. package/dist/storyboard/prompts.js +61 -0
  446. package/dist/storyboard/run.d.ts +82 -0
  447. package/dist/storyboard/run.js +332 -0
  448. package/dist/storyboard/text.d.ts +16 -0
  449. package/dist/storyboard/text.js +103 -0
  450. package/dist/storyboard/types.d.ts +47 -0
  451. package/dist/storyboard/types.js +2 -0
  452. package/dist/storyboard/urls.d.ts +15 -0
  453. package/dist/storyboard/urls.js +83 -0
  454. package/dist/storyboard/validate.d.ts +8 -0
  455. package/dist/storyboard/validate.js +525 -0
  456. package/dist/storyboard/visuals.d.ts +23 -0
  457. package/dist/storyboard/visuals.js +324 -0
  458. package/dist/version.d.ts +2 -0
  459. package/dist/version.js +3 -0
  460. package/dist/visuals/code.d.ts +68 -0
  461. package/dist/visuals/code.js +385 -0
  462. package/dist/visuals/highlight.d.ts +17 -0
  463. package/dist/visuals/highlight.js +85 -0
  464. package/dist/visuals/image.d.ts +12 -0
  465. package/dist/visuals/image.js +96 -0
  466. package/dist/visuals/index.d.ts +10 -0
  467. package/dist/visuals/index.js +10 -0
  468. package/dist/visuals/layout.d.ts +89 -0
  469. package/dist/visuals/layout.js +506 -0
  470. package/dist/visuals/plan.d.ts +33 -0
  471. package/dist/visuals/plan.js +511 -0
  472. package/dist/visuals/timeline.d.ts +31 -0
  473. package/dist/visuals/timeline.js +96 -0
  474. package/package.json +74 -4
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The PR analyzer: classifies files, groups components, finds changed symbols, ranks hunks,
3
+ * flags review risks and builds the evidence index every storyboard claim must cite.
4
+ * It only reports what the diff and the repository show.
5
+ */
6
+ import { type Config } from '../core/config.ts';
7
+ import type { Analysis } from '../core/types.ts';
8
+ export { analyze } from './analyze.ts';
9
+ export { hunkRange } from './hunks.ts';
10
+ export type { EvidencePack, EvidencePackOptions } from './pack.ts';
11
+ export { buildEvidencePack } from './pack.ts';
12
+ export { detectRole } from './roles.ts';
13
+ /** Target video length: the configured target, else the analysis suggestion, capped by maxDurationSec. */
14
+ export declare function targetDuration(analysis: Analysis, config: Pick<Config, 'targetDurationSec' | 'maxDurationSec'>): number;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The PR analyzer: classifies files, groups components, finds changed symbols, ranks hunks,
3
+ * flags review risks and builds the evidence index every storyboard claim must cite.
4
+ * It only reports what the diff and the repository show.
5
+ */
6
+ import { DURATION_LIMITS } from '../core/config.js';
7
+ export { analyze } from './analyze.js';
8
+ export { hunkRange } from './hunks.js';
9
+ export { buildEvidencePack } from './pack.js';
10
+ export { detectRole } from './roles.js';
11
+ /** Target video length: the configured target, else the analysis suggestion, capped by maxDurationSec. */
12
+ export function targetDuration(analysis, config) {
13
+ const wanted = config.targetDurationSec ?? analysis.suggestedDurationSec;
14
+ return Math.max(DURATION_LIMITS.targetDurationSec.min, Math.min(config.maxDurationSec, wanted));
15
+ }
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ import type { LanguageSupport } from './types.ts';
2
+ export declare const GO: readonly LanguageSupport[];
@@ -0,0 +1,76 @@
1
+ // biome-ignore-all lint/suspicious/noAssignInExpressions: regex matches are assigned in the condition so the else-if chain stays flat
2
+ /** Go, with the routes of calls such as `r.GET("/users", handler)`. */
3
+ import { joinPosix } from '../../core/posix.js';
4
+ import { nestingDepths } from '../scan.js';
5
+ import { C_COMMENTS, matchAll, symbolEmitter } from './shared.js';
6
+ const PROFILE = { lineComments: ['//'], blockComments: true, backtick: true };
7
+ const GO_FUNC = /^func\s+(?:\(\s*(?:\w+\s+)?\*?([\w.]+)(?:\[[^\]]*\])?\s*\)\s*)?([A-Za-z_]\w*)\s*[[(]/;
8
+ const GO_TYPE = /^type\s+(\w+)(?:\[[^\]]*\])?\s+(struct|interface)?/;
9
+ const GO_VAR = /^(const|var)\s+(\w+)\b/;
10
+ const GO_ROUTE = /\b\w+\.(GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS|Get|Post|Put|Patch|Delete|Handle|HandleFunc)\(\s*"([^"]*)"/;
11
+ const GO_SPACED_ROUTE = /^([A-Z]+)\s+(\/.*)$/;
12
+ function detectGo(lines) {
13
+ const depths = nestingDepths(lines, PROFILE);
14
+ const { symbols, emit } = symbolEmitter(lines, depths);
15
+ for (const [i, line] of lines.entries()) {
16
+ const t = line.trim();
17
+ if (!t || t.startsWith('//'))
18
+ continue;
19
+ const route = GO_ROUTE.exec(t);
20
+ if (route) {
21
+ const [, verb = '', target = ''] = route;
22
+ const [, spacedMethod, spacedPath] = GO_SPACED_ROUTE.exec(target) ?? [];
23
+ const method = spacedMethod ?? (/^(Handle|HandleFunc)$/.test(verb) ? 'ALL' : verb.toUpperCase());
24
+ const path = spacedPath ?? target;
25
+ if (path.startsWith('/'))
26
+ emit(`${method} ${path}`, 'route', i);
27
+ }
28
+ if (depths[i] !== 0)
29
+ continue;
30
+ let m;
31
+ if ((m = GO_FUNC.exec(line))) {
32
+ const [, receiver, name = ''] = m;
33
+ const exported = /^[A-Z]/.test(name) && (!receiver || /^[A-Z]/.test(receiver.split('.').pop() ?? ''));
34
+ emit(receiver ? `${receiver}.${name}` : name, receiver ? 'method' : 'function', i, { exported });
35
+ }
36
+ else if ((m = GO_TYPE.exec(line))) {
37
+ const [, name = '', shape] = m;
38
+ const kind = shape === 'struct' ? 'class' : shape === 'interface' ? 'interface' : 'type';
39
+ emit(name, kind, i, { exported: /^[A-Z]/.test(name) });
40
+ }
41
+ else if ((m = GO_VAR.exec(line))) {
42
+ const [, , name = ''] = m;
43
+ emit(name, 'constant', i, { exported: /^[A-Z]/.test(name) });
44
+ }
45
+ }
46
+ return symbols;
47
+ }
48
+ function extractImports(text) {
49
+ const refs = [];
50
+ for (const block of matchAll(text, /^\s*import\s*\(([\s\S]*?)\)/gm)) {
51
+ const [, body = ''] = block;
52
+ for (const [, spec = ''] of matchAll(body, /"([^"\n]+)"/g))
53
+ refs.push({ lang: 'go', spec });
54
+ }
55
+ for (const [, spec = ''] of matchAll(text, /^\s*import\s+(?:[\w.]+\s+)?"([^"\n]+)"/gm)) {
56
+ refs.push({ lang: 'go', spec });
57
+ }
58
+ return refs;
59
+ }
60
+ const IMPORTS = {
61
+ lang: 'go',
62
+ extract: extractImports,
63
+ resolve(_importer, { spec }, index) {
64
+ for (const { module, dir } of index.goModules) {
65
+ if (spec === module || spec.startsWith(`${module}/`)) {
66
+ const rest = spec.slice(module.length).replace(/^\//, '');
67
+ return [joinPosix(dir, rest, '_package.go')];
68
+ }
69
+ }
70
+ return [];
71
+ },
72
+ };
73
+ export const GO = [
74
+ { extensions: ['.go'], symbols: detectGo, imports: IMPORTS, comments: C_COMMENTS },
75
+ ];
76
+ //# sourceMappingURL=go.js.map
@@ -0,0 +1,18 @@
1
+ import type { ImportLang, ImportSupport, LanguageSupport } from './types.ts';
2
+ /**
3
+ * The entries by extension and by name. A mistake in an entry would leave a file silently skipped, so
4
+ * it is refused when the module loads: an extension without its dot, a key in upper case (the lookup
5
+ * is in lower case), or one that two entries list.
6
+ */
7
+ export declare function indexLanguages(languages: readonly LanguageSupport[]): {
8
+ byExtension: Map<string, LanguageSupport>;
9
+ byName: Map<string, LanguageSupport>;
10
+ };
11
+ /** The support the analyzer has for a file, from its name or extension; null for a kind it does not know. */
12
+ export declare function languageSupport(path: string): LanguageSupport | null;
13
+ /** True when the analyzer finds declarations in files like this one. */
14
+ export declare function hasSymbols(path: string): boolean;
15
+ /** True when the analyzer reads the imports of files like this one. */
16
+ export declare function hasImports(path: string): boolean;
17
+ /** The import support that makes and resolves the imports of a language. */
18
+ export declare function importSupport(lang: ImportLang): ImportSupport | undefined;
@@ -0,0 +1,72 @@
1
+ /**
2
+ * The languages the analyzer reads, and what it knows about each: how to find declarations, how to
3
+ * read and resolve imports, how a comment starts and whether indentation carries meaning. A file
4
+ * gets the support of the language that lists its name or extension.
5
+ */
6
+ import { basename, extname } from '../../core/posix.js';
7
+ import { GO } from './go.js';
8
+ import { JAVASCRIPT } from './javascript.js';
9
+ import { JVM } from './jvm.js';
10
+ import { OTHERS } from './others.js';
11
+ import { PHP } from './php.js';
12
+ import { PYTHON } from './python.js';
13
+ import { RUBY } from './ruby.js';
14
+ import { RUST } from './rust.js';
15
+ const LANGUAGES = [
16
+ ...JAVASCRIPT,
17
+ ...PYTHON,
18
+ ...GO,
19
+ ...RUST,
20
+ ...JVM,
21
+ ...RUBY,
22
+ ...PHP,
23
+ ...OTHERS,
24
+ ];
25
+ /**
26
+ * The entries by extension and by name. A mistake in an entry would leave a file silently skipped, so
27
+ * it is refused when the module loads: an extension without its dot, a key in upper case (the lookup
28
+ * is in lower case), or one that two entries list.
29
+ */
30
+ export function indexLanguages(languages) {
31
+ const byExtension = new Map();
32
+ const byName = new Map();
33
+ const add = (map, key, language) => {
34
+ if (key !== key.toLowerCase())
35
+ throw new Error(`"${key}" must be lower case.`);
36
+ if (map === byExtension && !key.startsWith('.'))
37
+ throw new Error(`The extension "${key}" needs its dot.`);
38
+ if (map.has(key))
39
+ throw new Error(`Two languages list "${key}".`);
40
+ map.set(key, language);
41
+ };
42
+ for (const language of languages) {
43
+ for (const extension of language.extensions)
44
+ add(byExtension, extension, language);
45
+ for (const name of language.names ?? [])
46
+ add(byName, name, language);
47
+ }
48
+ return { byExtension, byName };
49
+ }
50
+ const { byExtension, byName } = indexLanguages(LANGUAGES);
51
+ /** The support the analyzer has for a file, from its name or extension; null for a kind it does not know. */
52
+ export function languageSupport(path) {
53
+ return byName.get(basename(path).toLowerCase()) ?? byExtension.get(extname(path)) ?? null;
54
+ }
55
+ /** True when the analyzer finds declarations in files like this one. */
56
+ export function hasSymbols(path) {
57
+ return languageSupport(path)?.symbols !== undefined;
58
+ }
59
+ /** True when the analyzer reads the imports of files like this one. */
60
+ export function hasImports(path) {
61
+ return languageSupport(path)?.imports !== undefined;
62
+ }
63
+ const importsByLang = new Map();
64
+ for (const language of LANGUAGES) {
65
+ if (language.imports)
66
+ importsByLang.set(language.imports.lang, language.imports);
67
+ }
68
+ /** The import support that makes and resolves the imports of a language. */
69
+ export function importSupport(lang) {
70
+ return importsByLang.get(lang);
71
+ }
72
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ import type { LanguageSupport } from './types.ts';
2
+ export declare const JAVASCRIPT: readonly LanguageSupport[];
@@ -0,0 +1,336 @@
1
+ // biome-ignore-all lint/suspicious/noAssignInExpressions: regex matches are assigned in the condition so the else-if chain stays flat
2
+ /** JavaScript and TypeScript, and Vue and Svelte components, of which only the imports are read. */
3
+ import { dirname, joinPosix, normalizePosix } from '../../core/posix.js';
4
+ import { blockEnd, nestingDepths } from '../scan.js';
5
+ import { collapse } from '../symbol-types.js';
6
+ import { C_COMMENTS, matchAll, packageRootOf, symbolEmitter } from './shared.js';
7
+ const PROFILE = {
8
+ lineComments: ['//'],
9
+ blockComments: true,
10
+ backtick: true,
11
+ templateLiterals: true,
12
+ regexLiterals: true,
13
+ };
14
+ const JS_FN = /^(export\s+)?(default\s+)?(?:declare\s+)?(async\s+)?function\s*\*?\s*([A-Za-z_$][\w$]*)?\s*[<(]/;
15
+ const JS_CLASS = /^(export\s+)?(default\s+)?(?:declare\s+)?(?:abstract\s+)?class\s+([A-Za-z_$][\w$]*)/;
16
+ const JS_IFACE = /^(export\s+)?(?:declare\s+)?interface\s+([A-Za-z_$][\w$]*)/;
17
+ const JS_TYPE = /^(export\s+)?(?:declare\s+)?type\s+([A-Za-z_$][\w$]*)\s*[<=]/;
18
+ const JS_ENUM = /^(export\s+)?(?:declare\s+)?(?:const\s+)?enum\s+([A-Za-z_$][\w$]*)/;
19
+ const JS_VAR = /^(export\s+)?(?:declare\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)\s*(?::(?:[^=]|=>)+?)?=(?!=)\s*(.*)$/;
20
+ const JS_CJS = /^(?:module\.)?exports\.([A-Za-z_$][\w$]*)\s*=\s*(.*)$/;
21
+ const JS_DEFAULT_EXPR = /^export\s+default\s+(?:async\s+)?(?:\(|[\w$]+\s*=>)/;
22
+ const ARROW = /^(?:async\s+)?(?:<[^>]*>\s*)?(?:function\b|[\w$]+\s*=>|\((?:[^()]|\([^()]*\))*\)\s*(?::\s*[^=;{]+?)?\s*=>)/;
23
+ const WRAPPED = /^(?:React\.)?(?:memo|forwardRef)\s*\(/;
24
+ const JS_METHOD = /^((?:(?:public|private|protected|static|readonly|abstract|override|async|get|set|declare)\s+)*)(\*\s*)?(#?[A-Za-z_$][\w$]*)\s*(?:<[^>()]*>)?\s*\(/;
25
+ const JS_PROP_FN = /^((?:(?:public|private|protected|static|readonly|override|declare)\s+)*)(#?[A-Za-z_$][\w$]*)\s*[?!]?\s*(?::(?:[^=]|=>)+?)?=(?!=)\s*(?:async\s+)?(?:\(|[\w$]+\s*=>|function)/;
26
+ const JS_ROUTE = /\b([A-Za-z_$][\w$]*)\.(get|post|put|patch|delete|options|head|all)\(\s*(['"`])(\/[^'"`]*|\*)\3/;
27
+ const ROUTER_NAME = /^(app|router|server|fastify|api|route|routes|r|[\w$]*Router|[\w$]*App|[\w$]*Server|[\w$]*Api)$/;
28
+ const NOT_METHODS = new Set([
29
+ 'if',
30
+ 'for',
31
+ 'while',
32
+ 'switch',
33
+ 'catch',
34
+ 'function',
35
+ 'return',
36
+ 'with',
37
+ 'else',
38
+ 'do',
39
+ 'try',
40
+ ]);
41
+ const HTTP_METHODS = new Set(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS']);
42
+ const NEST_ROUTE = /^@(Get|Post|Put|Patch|Delete|All|Head|Options)\(\s*(?:['"`]([^'"`]*)['"`])?/;
43
+ const NEST_CONTROLLER = /^@Controller\(\s*(?:['"`]([^'"`]*)['"`])?/;
44
+ const NEXT_APP_ROUTE = /(^|\/)app\/((?:.*\/)?)route\.[mc]?[jt]sx?$/;
45
+ const NEXT_PAGES_ROUTE = /(^|\/)pages\/(api\/.*)\.[mc]?[jt]sx?$/;
46
+ function joinRoute(...parts) {
47
+ const joined = parts
48
+ .filter((p) => !!p)
49
+ .map((p) => p.replace(/^\/+|\/+$/g, ''))
50
+ .filter(Boolean)
51
+ .join('/');
52
+ return `/${joined}`;
53
+ }
54
+ /** Route path of a Next.js route file, or null when the path is not one. */
55
+ function nextRoutePath(path) {
56
+ const app = NEXT_APP_ROUTE.exec(path);
57
+ if (app) {
58
+ const [, , dirs = ''] = app;
59
+ return { path: joinRoute(...dirs.split('/').filter((d) => d && !/^\(.*\)$/.test(d))), app: true };
60
+ }
61
+ const pages = NEXT_PAGES_ROUTE.exec(path);
62
+ if (pages) {
63
+ const [, , api = ''] = pages;
64
+ return { path: joinRoute(api.replace(/\/index$/, '')), app: false };
65
+ }
66
+ return null;
67
+ }
68
+ /**
69
+ * Text that stands for a symbol's signature: the declaration without its body. Interfaces and types
70
+ * use their whole text, because any change to their shape changes what callers can rely on.
71
+ */
72
+ function jsDecl(lines, kind, name, from, to) {
73
+ if (kind === 'route')
74
+ return name;
75
+ if (kind === 'interface' || kind === 'type')
76
+ return collapse(lines.slice(from, to + 1).join(' '), 2000);
77
+ const text = lines
78
+ .slice(from, Math.min(to, from + 6) + 1)
79
+ .map((l) => l.trim())
80
+ .join(' ');
81
+ if (kind === 'constant')
82
+ return collapse(text.split(/=(?!>)/)[0] ?? '');
83
+ return collapse(cutSignature(text));
84
+ }
85
+ /** Cut at the first body brace, arrow or semicolon that is not inside parentheses or brackets. */
86
+ function cutSignature(text) {
87
+ let depth = 0;
88
+ for (let k = 0; k < text.length; k++) {
89
+ const ch = text.charAt(k);
90
+ if (ch === '(' || ch === '[')
91
+ depth++;
92
+ else if (ch === ')' || ch === ']')
93
+ depth--;
94
+ else if (depth <= 0) {
95
+ if (ch === '{' || ch === ';')
96
+ return text.slice(0, k);
97
+ if (ch === '=' && text.charAt(k + 1) === '>')
98
+ return text.slice(0, k + 2);
99
+ }
100
+ }
101
+ return text;
102
+ }
103
+ const CONTINUES_AT_START = /^(?:\?\.|\.(?!\.)|\?|:|&&|\|\||\?\?|\+|-|\||&|,)/;
104
+ const CONTINUES_AT_END = /(?:=>|=|&&|\|\||\?\?|\+|-|\?|:|\||&|,|\.)$/;
105
+ /**
106
+ * A top-level statement can continue on the next line without opening a bracket: a chained call
107
+ * (".object({"), a leading operator, or an assignment that ends the line with "=".
108
+ */
109
+ function extendStatement(lines, depths, end) {
110
+ let e = end;
111
+ for (let guard = 0; guard < 400; guard++) {
112
+ const code = (lines[e] ?? '').replace(/\s\/\/.*$/, '').trimEnd();
113
+ let n = e + 1;
114
+ while (n < lines.length && (lines[n] ?? '').trim() === '')
115
+ n++;
116
+ if (n >= lines.length || depths[n] !== 0)
117
+ break;
118
+ const next = (lines[n] ?? '').trim();
119
+ const startsCont = !next.startsWith('//') && !next.startsWith('/*') && CONTINUES_AT_START.test(next);
120
+ if (!startsCont && !CONTINUES_AT_END.test(code))
121
+ break;
122
+ e = blockEnd(depths, n, lines.length);
123
+ }
124
+ return e;
125
+ }
126
+ function detectJs(lines, path) {
127
+ const depths = nestingDepths(lines, PROFILE);
128
+ const { symbols, emit } = symbolEmitter(lines, depths);
129
+ const next = nextRoutePath(path);
130
+ const jsx = /\.(tsx|jsx)$/.test(path);
131
+ // What stands for a symbol's declaration depends on its kind.
132
+ const push = (name, kind, exported, from, to) => emit(name, kind, from, { exported, end: to, decl: jsDecl(lines, kind, name, from, to) });
133
+ for (const [i, line] of lines.entries()) {
134
+ const t = line.trim();
135
+ if (!t || t.startsWith('//') || t.startsWith('*') || t.startsWith('/*'))
136
+ continue;
137
+ const route = JS_ROUTE.exec(t);
138
+ if (route) {
139
+ const [, router = '', verb = '', , target = ''] = route;
140
+ if (ROUTER_NAME.test(router)) {
141
+ push(`${verb.toUpperCase()} ${target}`, 'route', true, i, blockEnd(depths, i, lines.length));
142
+ }
143
+ }
144
+ if (depths[i] !== 0)
145
+ continue;
146
+ const end = () => blockEnd(depths, i, lines.length);
147
+ const stmtEnd = () => extendStatement(lines, depths, end());
148
+ let m;
149
+ if ((m = JS_FN.exec(t))) {
150
+ const [, exported, isDefault, , name = 'default'] = m;
151
+ if (next && !next.app && isDefault) {
152
+ push(`ALL ${next.path}`, 'route', true, i, end());
153
+ }
154
+ else if (next?.app && HTTP_METHODS.has(name)) {
155
+ push(`${name} ${next.path}`, 'route', true, i, end());
156
+ }
157
+ else {
158
+ const kind = /^[A-Z]/.test(name) && jsx ? 'component' : 'function';
159
+ push(name, kind, !!exported, i, end());
160
+ }
161
+ }
162
+ else if ((m = JS_CLASS.exec(t))) {
163
+ const [, exported, , name = ''] = m;
164
+ const e = end();
165
+ push(name, 'class', !!exported, i, e);
166
+ jsMethods(lines, depths, i, e, name, !!exported, push);
167
+ }
168
+ else if ((m = JS_IFACE.exec(t))) {
169
+ const [, exported, name = ''] = m;
170
+ push(name, 'interface', !!exported, i, end());
171
+ }
172
+ else if ((m = JS_TYPE.exec(t))) {
173
+ const [, exported, name = ''] = m;
174
+ push(name, 'type', !!exported, i, stmtEnd());
175
+ }
176
+ else if ((m = JS_ENUM.exec(t))) {
177
+ const [, exported, name = ''] = m;
178
+ push(name, 'type', !!exported, i, end());
179
+ }
180
+ else if ((m = JS_VAR.exec(t))) {
181
+ const [, exported, , name = '', init = ''] = m;
182
+ const e = stmtEnd();
183
+ const rhs = [init, ...lines.slice(i + 1, e + 1)].join(' ').slice(0, 600).trim();
184
+ const isFn = ARROW.test(rhs) || WRAPPED.test(rhs);
185
+ if (next?.app && HTTP_METHODS.has(name) && exported) {
186
+ push(`${name} ${next.path}`, 'route', true, i, e);
187
+ }
188
+ else if (isFn) {
189
+ const component = WRAPPED.test(rhs) || (/^[A-Z]/.test(name) && jsx);
190
+ push(name, component ? 'component' : 'function', !!exported, i, e);
191
+ }
192
+ else if (exported || /^[A-Z][A-Z0-9_]+$/.test(name)) {
193
+ push(name, 'constant', !!exported, i, e);
194
+ }
195
+ }
196
+ else if ((m = JS_CJS.exec(t))) {
197
+ const [, name = '', init = ''] = m;
198
+ const e = stmtEnd();
199
+ const isFn = ARROW.test([init, ...lines.slice(i + 1, e + 1)].join(' ').slice(0, 600).trim());
200
+ push(name, isFn ? 'function' : 'constant', true, i, e);
201
+ }
202
+ else if (JS_DEFAULT_EXPR.test(t)) {
203
+ push('default', next && !next.app ? 'route' : 'function', true, i, stmtEnd());
204
+ }
205
+ }
206
+ return symbols;
207
+ }
208
+ function jsMethods(lines, depths, classStart, classEnd, className, classExported, push) {
209
+ let prefix = '';
210
+ for (let k = Math.max(0, classStart - 3); k < classStart; k++) {
211
+ const c = NEST_CONTROLLER.exec((lines[k] ?? '').trim());
212
+ if (c)
213
+ prefix = c[1] ?? '';
214
+ }
215
+ let pending = null;
216
+ for (let l = classStart + 1; l < classEnd; l++) {
217
+ if (depths[l] !== 1)
218
+ continue;
219
+ const t = (lines[l] ?? '').trim();
220
+ const nest = NEST_ROUTE.exec(t);
221
+ if (nest) {
222
+ const [, verb = '', path = ''] = nest;
223
+ pending = { method: verb.toUpperCase(), path };
224
+ continue;
225
+ }
226
+ if (!t || t.startsWith('//') || t.startsWith('*') || t.startsWith('/*') || t.startsWith('@'))
227
+ continue;
228
+ const method = JS_METHOD.exec(t);
229
+ const member = method ?? JS_PROP_FN.exec(t);
230
+ const name = (method ? method[3] : member?.[2]) ?? '';
231
+ if (!member || !name || NOT_METHODS.has(name)) {
232
+ pending = null;
233
+ continue;
234
+ }
235
+ const modifiers = member[1] ?? '';
236
+ const isPrivate = /\b(private|protected)\b/.test(modifiers) || name.startsWith('#');
237
+ const e = blockEnd(depths, l, lines.length);
238
+ if (pending) {
239
+ push(`${pending.method} ${joinRoute(prefix, pending.path)}`, 'route', true, l, e);
240
+ pending = null;
241
+ }
242
+ else {
243
+ push(`${className}.${name}`, 'method', classExported && !isPrivate, l, e);
244
+ }
245
+ }
246
+ }
247
+ const IMPORT_PATTERNS = [
248
+ /^\s*(?:import|export)\s+(?:type\s+)?[^'"`;]*?\sfrom\s*['"]([^'"\n]+)['"]/gm,
249
+ /^\s*import\s*['"]([^'"\n]+)['"]/gm,
250
+ /\brequire\s*\(\s*['"]([^'"\n]+)['"]\s*\)/g,
251
+ /\bimport\s*\(\s*['"]([^'"\n]+)['"]\s*\)/g,
252
+ ];
253
+ /** True when the text before `index` on its line shows that the statement sits in a comment. */
254
+ function inLineComment(text, index) {
255
+ const start = text.lastIndexOf('\n', index - 1) + 1;
256
+ const prefix = text.slice(start, index).trimStart();
257
+ return prefix.startsWith('//') || prefix.startsWith('*');
258
+ }
259
+ function extractImports(text) {
260
+ const refs = [];
261
+ for (const re of IMPORT_PATTERNS) {
262
+ for (const m of matchAll(text, re)) {
263
+ const [, spec = ''] = m;
264
+ if (!inLineComment(text, m.index))
265
+ refs.push({ lang: 'js', spec });
266
+ }
267
+ }
268
+ return refs;
269
+ }
270
+ const JS_EXTENSIONS = [
271
+ '.ts',
272
+ '.tsx',
273
+ '.js',
274
+ '.jsx',
275
+ '.mjs',
276
+ '.cjs',
277
+ '.mts',
278
+ '.cts',
279
+ '.json',
280
+ '.vue',
281
+ '.svelte',
282
+ ];
283
+ function jsCandidates(base) {
284
+ const stem = base.replace(/\.(m|c)?js$/, '');
285
+ const list = [base, ...JS_EXTENSIONS.map((e) => base + e)];
286
+ if (stem !== base)
287
+ list.push(...['.ts', '.tsx', '.mts', '.cts'].map((e) => stem + e));
288
+ list.push(...JS_EXTENSIONS.map((e) => `${base}/index${e}`));
289
+ return list;
290
+ }
291
+ function resolveImport(importer, { spec }, index) {
292
+ const root = packageRootOf(importer);
293
+ let base = null;
294
+ if (spec.startsWith('./') || spec.startsWith('../') || spec === '.' || spec === '..') {
295
+ base = normalizePosix(joinPosix(dirname(importer), spec));
296
+ }
297
+ else if (spec.startsWith('@/') || spec.startsWith('~/') || spec.startsWith('#')) {
298
+ const rest = spec.replace(/^(@\/|~\/|#\/?)/, '');
299
+ const hit = index.firstKnown([
300
+ ...jsCandidates(joinPosix(root, 'src', rest)),
301
+ ...jsCandidates(joinPosix(root, rest)),
302
+ ]);
303
+ return hit ? [hit] : [joinPosix(root, 'src', rest)];
304
+ }
305
+ else {
306
+ for (const [name, dir] of index.packageDirs) {
307
+ if (spec === name || spec.startsWith(`${name}/`)) {
308
+ const sub = spec.slice(name.length).replace(/^\//, '');
309
+ const hit = index.firstKnown(jsCandidates(joinPosix(dir, 'src', sub || 'index')));
310
+ return [hit ?? joinPosix(dir, 'src', sub || 'index')];
311
+ }
312
+ }
313
+ return [];
314
+ }
315
+ if (base === null)
316
+ return [];
317
+ const hit = index.firstKnown(jsCandidates(base));
318
+ return [hit ?? base];
319
+ }
320
+ const IMPORTS = {
321
+ lang: 'js',
322
+ extract: extractImports,
323
+ resolve: resolveImport,
324
+ };
325
+ export const JAVASCRIPT = [
326
+ {
327
+ extensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs', '.mts', '.cts'],
328
+ symbols: detectJs,
329
+ imports: IMPORTS,
330
+ comments: C_COMMENTS,
331
+ looseSyntax: true,
332
+ },
333
+ // Single-file components: their imports are read, their declarations are not.
334
+ { extensions: ['.vue', '.svelte'], imports: IMPORTS, comments: C_COMMENTS },
335
+ ];
336
+ //# sourceMappingURL=javascript.js.map
@@ -0,0 +1,2 @@
1
+ import type { LanguageSupport } from './types.ts';
2
+ export declare const JVM: readonly LanguageSupport[];