blume 1.7.3 → 2.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 (673) hide show
  1. package/AGENTS.md +19 -0
  2. package/CHANGELOG.md +217 -0
  3. package/README.md +34 -21
  4. package/dist/cli/chunk-11j0384y.js +148 -0
  5. package/dist/cli/chunk-11j0384y.js.map +10 -0
  6. package/dist/cli/{chunk-rqy0s5wh.js → chunk-1w8dp3qb.js} +17 -16
  7. package/dist/cli/{chunk-rqy0s5wh.js.map → chunk-1w8dp3qb.js.map} +3 -3
  8. package/dist/cli/chunk-2q1dwty4.js +75 -0
  9. package/dist/cli/chunk-2q1dwty4.js.map +11 -0
  10. package/dist/cli/chunk-41za066z.js +122 -0
  11. package/dist/cli/chunk-41za066z.js.map +11 -0
  12. package/dist/cli/chunk-5a2z0198.js +133 -0
  13. package/dist/cli/chunk-5a2z0198.js.map +10 -0
  14. package/dist/cli/{chunk-5g0w1e2c.js → chunk-6k8vp3ta.js} +25 -13
  15. package/dist/cli/{chunk-5g0w1e2c.js.map → chunk-6k8vp3ta.js.map} +4 -4
  16. package/dist/cli/{chunk-5qk08vmp.js → chunk-79njf86q.js} +133 -54
  17. package/dist/cli/chunk-79njf86q.js.map +11 -0
  18. package/dist/cli/{chunk-e7f42gdj.js → chunk-7ez8ny0t.js} +2 -2
  19. package/dist/cli/{chunk-nn13znc2.js → chunk-88cpgt6h.js} +1 -1
  20. package/dist/cli/chunk-a9kptbw5.js +361 -0
  21. package/dist/cli/chunk-a9kptbw5.js.map +14 -0
  22. package/dist/cli/chunk-abh8yjkn.js +31 -0
  23. package/dist/cli/chunk-abh8yjkn.js.map +10 -0
  24. package/dist/cli/chunk-b5aj94ah.js +91 -0
  25. package/dist/cli/chunk-b5aj94ah.js.map +10 -0
  26. package/dist/cli/{chunk-b27xqwn9.js → chunk-bctazmbk.js} +9 -5
  27. package/dist/cli/chunk-bctazmbk.js.map +10 -0
  28. package/dist/cli/chunk-beat36xx.js +279 -0
  29. package/dist/cli/chunk-beat36xx.js.map +10 -0
  30. package/dist/cli/chunk-bnbmcwfb.js +145 -0
  31. package/dist/cli/chunk-bnbmcwfb.js.map +11 -0
  32. package/dist/cli/{chunk-0xjyb285.js → chunk-bw22s759.js} +15 -5
  33. package/dist/cli/{chunk-0xjyb285.js.map → chunk-bw22s759.js.map} +4 -4
  34. package/dist/cli/chunk-by2290sx.js +39 -0
  35. package/dist/cli/chunk-by2290sx.js.map +10 -0
  36. package/dist/cli/chunk-d1tadaw7.js +79 -0
  37. package/dist/cli/chunk-d1tadaw7.js.map +10 -0
  38. package/dist/cli/{chunk-ahnw3kxw.js → chunk-d80hr03s.js} +24 -19
  39. package/dist/cli/chunk-d80hr03s.js.map +15 -0
  40. package/dist/cli/chunk-ernrthtr.js +97 -0
  41. package/dist/cli/chunk-ernrthtr.js.map +10 -0
  42. package/dist/cli/chunk-f2972sbt.js +374 -0
  43. package/dist/cli/chunk-f2972sbt.js.map +10 -0
  44. package/dist/cli/{chunk-vacwm2hv.js → chunk-f7t03s3g.js} +2 -2
  45. package/dist/cli/{chunk-2z47ypj8.js → chunk-fa25z98p.js} +16 -3
  46. package/dist/cli/chunk-fa25z98p.js.map +11 -0
  47. package/dist/cli/{chunk-cjtn640a.js → chunk-fh5hj5jt.js} +43 -20
  48. package/dist/cli/chunk-fh5hj5jt.js.map +10 -0
  49. package/dist/cli/{chunk-yg63d42r.js → chunk-j8mw0za6.js} +86 -57
  50. package/dist/cli/chunk-j8mw0za6.js.map +35 -0
  51. package/dist/cli/{chunk-ct47dqpx.js → chunk-jts8mvcz.js} +67 -7
  52. package/dist/cli/{chunk-2mzebbbz.js.map → chunk-jts8mvcz.js.map} +6 -4
  53. package/dist/cli/{chunk-ps4m1xh4.js → chunk-mnqj32sj.js} +505 -542
  54. package/dist/cli/chunk-mnqj32sj.js.map +12 -0
  55. package/dist/cli/{chunk-8cjtbafj.js → chunk-mwt1k8n7.js} +100 -374
  56. package/dist/cli/chunk-mwt1k8n7.js.map +10 -0
  57. package/dist/cli/chunk-nk3ts2xk.js +51 -0
  58. package/dist/cli/chunk-nk3ts2xk.js.map +10 -0
  59. package/dist/cli/{chunk-3r45185y.js → chunk-pat2zzwc.js} +9 -11
  60. package/dist/cli/{chunk-3r45185y.js.map → chunk-pat2zzwc.js.map} +2 -2
  61. package/dist/cli/chunk-pnnvybbk.js +176 -0
  62. package/dist/cli/chunk-pnnvybbk.js.map +11 -0
  63. package/dist/cli/{chunk-4x36ddpw.js → chunk-sqn5t4q0.js} +81 -87
  64. package/dist/cli/chunk-sqn5t4q0.js.map +10 -0
  65. package/dist/cli/{chunk-bvwwhd84.js → chunk-tzne8qfq.js} +15 -15
  66. package/dist/cli/{chunk-bvwwhd84.js.map → chunk-tzne8qfq.js.map} +1 -1
  67. package/dist/cli/chunk-xaz13gwg.js +12449 -0
  68. package/dist/cli/chunk-xaz13gwg.js.map +182 -0
  69. package/dist/cli/chunk-y3e45rc8.js +102 -0
  70. package/dist/cli/chunk-y3e45rc8.js.map +10 -0
  71. package/dist/cli/chunk-z01ze5c1.js +261 -0
  72. package/dist/cli/chunk-z01ze5c1.js.map +10 -0
  73. package/dist/cli/{chunk-k79xp7av.js → chunk-z1f5arsg.js} +219 -689
  74. package/dist/cli/chunk-z1f5arsg.js.map +36 -0
  75. package/dist/cli/{chunk-1jefwnfs.js → chunk-zg2gtj10.js} +1076 -2592
  76. package/dist/cli/chunk-zg2gtj10.js.map +35 -0
  77. package/dist/cli/{chunk-dwgcp5sm.js → chunk-zxccj738.js} +1 -1
  78. package/dist/cli/index.js +214 -57
  79. package/dist/cli/index.js.map +8 -7
  80. package/dist/types/ai/agent-readability.d.ts +52 -0
  81. package/dist/types/ai/ai-catalog.d.ts +42 -0
  82. package/dist/types/ai/api/paths.d.ts +17 -0
  83. package/dist/types/ai/api-catalog.d.ts +18 -0
  84. package/dist/types/ai/ask.d.ts +368 -0
  85. package/dist/types/ai/changelog-markdown.d.ts +2 -0
  86. package/dist/types/ai/component-markdown.d.ts +2 -2
  87. package/dist/types/ai/index.d.ts +24 -0
  88. package/dist/types/ai/link-headers.d.ts +24 -0
  89. package/dist/types/ai/llms.d.ts +25 -0
  90. package/dist/types/ai/markdown.d.ts +45 -0
  91. package/dist/types/ai/mcp/discovery.d.ts +68 -0
  92. package/dist/types/ai/mcp/tools.d.ts +16 -0
  93. package/dist/types/ai/openapi-components.d.ts +43 -0
  94. package/dist/types/ai/relative-links.d.ts +26 -0
  95. package/dist/types/ai/serializers.d.ts +15 -0
  96. package/dist/types/ai/skills.d.ts +42 -0
  97. package/dist/types/ai/tar.d.ts +25 -0
  98. package/dist/types/ai/visibility.d.ts +17 -0
  99. package/dist/types/ai/web-bot-auth.d.ts +16 -0
  100. package/dist/types/analytics/adobe.d.ts +35 -0
  101. package/dist/types/analytics/amplitude.d.ts +50 -0
  102. package/dist/types/analytics/clarity.d.ts +31 -0
  103. package/dist/types/analytics/clearbit.d.ts +29 -0
  104. package/dist/types/analytics/cloudflare.d.ts +41 -0
  105. package/dist/types/analytics/fathom.d.ts +41 -0
  106. package/dist/types/analytics/google-analytics.d.ts +44 -0
  107. package/dist/types/analytics/google-tag-manager.d.ts +40 -0
  108. package/dist/types/analytics/head.d.ts +30 -0
  109. package/dist/types/analytics/heap.d.ts +40 -0
  110. package/dist/types/analytics/hightouch.d.ts +44 -0
  111. package/dist/types/analytics/hotjar.d.ts +33 -0
  112. package/dist/types/analytics/index.d.ts +61 -0
  113. package/dist/types/analytics/inline.d.ts +17 -0
  114. package/dist/types/analytics/logrocket.d.ts +44 -0
  115. package/dist/types/analytics/mixpanel.d.ts +67 -0
  116. package/dist/types/analytics/pirsch.d.ts +42 -0
  117. package/dist/types/analytics/plausible.d.ts +56 -0
  118. package/dist/types/analytics/posthog.d.ts +45 -0
  119. package/dist/types/analytics/schema.d.ts +320 -0
  120. package/dist/types/analytics/script.d.ts +46 -0
  121. package/dist/types/analytics/segment.d.ts +50 -0
  122. package/dist/types/analytics/vercel.d.ts +48 -0
  123. package/dist/types/astro/integration.d.ts +76 -0
  124. package/dist/types/astro/markdown-negotiation.d.ts +23 -0
  125. package/dist/types/astro/module-types.d.ts +14 -0
  126. package/dist/types/astro/pages.d.ts +44 -0
  127. package/dist/types/cli/env.d.ts +12 -0
  128. package/dist/types/cli/init/scaffold.d.ts +154 -0
  129. package/dist/types/components/layout/nav-utils.d.ts +11 -0
  130. package/dist/types/core/adapter.d.ts +47 -0
  131. package/dist/types/core/api-name.d.ts +7 -0
  132. package/dist/types/core/changelog-index.d.ts +13 -0
  133. package/dist/types/core/config-input.d.ts +186 -515
  134. package/dist/types/core/config.d.ts +60 -34
  135. package/dist/types/core/content-assets.d.ts +76 -0
  136. package/dist/types/core/custom-pages.d.ts +33 -0
  137. package/dist/types/core/data.d.ts +27 -12
  138. package/dist/types/core/define-components.d.ts +12 -9
  139. package/dist/types/core/deployment-env.d.ts +6 -11
  140. package/dist/types/core/frontmatter.d.ts +10 -0
  141. package/dist/types/core/graph.d.ts +18 -0
  142. package/dist/types/core/heading-markers.d.ts +54 -0
  143. package/dist/types/core/i18n-ui.d.ts +6 -2
  144. package/dist/types/core/i18n.d.ts +87 -0
  145. package/dist/types/core/includes.d.ts +138 -0
  146. package/dist/types/core/last-modified.d.ts +47 -0
  147. package/dist/types/core/links.d.ts +95 -0
  148. package/dist/types/core/locale-links.d.ts +60 -0
  149. package/dist/types/core/manifest.d.ts +17 -0
  150. package/dist/types/core/meta.d.ts +38 -0
  151. package/dist/types/core/nav-diagnostics.d.ts +26 -0
  152. package/dist/types/core/navigation.d.ts +6 -0
  153. package/dist/types/core/node-require.d.ts +19 -0
  154. package/dist/types/core/package-json.d.ts +13 -0
  155. package/dist/types/core/probe.d.ts +42 -0
  156. package/dist/types/core/project-graph.d.ts +51 -0
  157. package/dist/types/core/project.d.ts +2 -0
  158. package/dist/types/core/safe-href.d.ts +2 -0
  159. package/dist/types/core/safe-links.d.ts +26 -0
  160. package/dist/types/core/schema.d.ts +2282 -452
  161. package/dist/types/core/site-url.d.ts +16 -0
  162. package/dist/types/core/sources/assets.d.ts +36 -0
  163. package/dist/types/core/sources/cache.d.ts +37 -0
  164. package/dist/types/core/sources/collection.d.ts +28 -0
  165. package/dist/types/core/sources/contentful-rich-text.d.ts +31 -0
  166. package/dist/types/core/sources/contentful.d.ts +40 -0
  167. package/dist/types/core/sources/filesystem.d.ts +24 -0
  168. package/dist/types/core/sources/github-releases.d.ts +31 -0
  169. package/dist/types/core/sources/json.d.ts +30 -0
  170. package/dist/types/core/sources/lexical.d.ts +19 -0
  171. package/dist/types/core/sources/lower.d.ts +75 -0
  172. package/dist/types/core/sources/mdx-remote.d.ts +28 -0
  173. package/dist/types/core/sources/normalize.d.ts +147 -0
  174. package/dist/types/core/sources/notion.d.ts +131 -0
  175. package/dist/types/core/sources/obsidian.d.ts +46 -0
  176. package/dist/types/core/sources/payload.d.ts +39 -0
  177. package/dist/types/core/sources/portable-text.d.ts +42 -0
  178. package/dist/types/core/sources/read.d.ts +23 -0
  179. package/dist/types/core/sources/remote.d.ts +74 -0
  180. package/dist/types/core/sources/resolve.d.ts +19 -0
  181. package/dist/types/core/sources/sanity.d.ts +43 -0
  182. package/dist/types/core/sources/strapi-blocks.d.ts +12 -0
  183. package/dist/types/core/sources/strapi.d.ts +33 -0
  184. package/dist/types/core/sources/types.d.ts +7 -0
  185. package/dist/types/core/sources/watch.d.ts +45 -0
  186. package/dist/types/core/text-width.d.ts +11 -0
  187. package/dist/types/core/types.d.ts +15 -1
  188. package/dist/types/core/unrecognized-keys.d.ts +7 -0
  189. package/dist/types/core/versions.d.ts +72 -0
  190. package/dist/types/core/yaml.d.ts +9 -0
  191. package/dist/types/deploy/adapter-output.d.ts +45 -0
  192. package/dist/types/deploy/adapters/cloudflare.d.ts +40 -0
  193. package/dist/types/deploy/adapters/index.d.ts +29 -0
  194. package/dist/types/deploy/adapters/netlify.d.ts +37 -0
  195. package/dist/types/deploy/adapters/node.d.ts +37 -0
  196. package/dist/types/deploy/adapters/registry.d.ts +133 -0
  197. package/dist/types/deploy/adapters/types.d.ts +71 -0
  198. package/dist/types/deploy/adapters/vercel.d.ts +38 -0
  199. package/dist/types/deploy/artifacts.d.ts +65 -0
  200. package/dist/types/deploy/cloudflare-negotiation.d.ts +196 -0
  201. package/dist/types/deploy/function-bundle.d.ts +80 -0
  202. package/dist/types/deploy/headers.d.ts +50 -0
  203. package/dist/types/deploy/node-headers.d.ts +42 -0
  204. package/dist/types/deploy/platforms/cloudflare.d.ts +40 -0
  205. package/dist/types/deploy/platforms/index.d.ts +18 -0
  206. package/dist/types/deploy/platforms/netlify.d.ts +13 -0
  207. package/dist/types/deploy/platforms/node.d.ts +11 -0
  208. package/dist/types/deploy/platforms/paths.d.ts +27 -0
  209. package/dist/types/deploy/platforms/static.d.ts +10 -0
  210. package/dist/types/deploy/platforms/types.d.ts +104 -0
  211. package/dist/types/deploy/platforms/vercel.d.ts +32 -0
  212. package/dist/types/deploy/redirects.d.ts +53 -0
  213. package/dist/types/deploy/robots.d.ts +8 -0
  214. package/dist/types/deploy/rss.d.ts +31 -0
  215. package/dist/types/deploy/sitemap.d.ts +21 -0
  216. package/dist/types/deploy/vercel-negotiation.d.ts +109 -0
  217. package/dist/types/markdown/code-title.d.ts +32 -0
  218. package/dist/types/markdown/fence-meta.d.ts +23 -0
  219. package/dist/types/markdown/themes.d.ts +3 -3
  220. package/dist/types/openapi/asyncapi.d.ts +129 -0
  221. package/dist/types/openapi/graphql-build.d.ts +8 -0
  222. package/dist/types/openapi/graphql.d.ts +122 -0
  223. package/dist/types/openapi/model.d.ts +158 -0
  224. package/dist/types/openapi/parse.d.ts +57 -0
  225. package/dist/types/openapi/references.d.ts +37 -25
  226. package/dist/types/openapi/render-mdx.d.ts +33 -0
  227. package/dist/types/openapi/sentence.d.ts +7 -0
  228. package/dist/types/openapi/signature.d.ts +10 -0
  229. package/dist/types/openapi/source.d.ts +22 -0
  230. package/dist/types/openapi/spec-dependency-error.d.ts +10 -0
  231. package/dist/types/reference/asyncapi.d.ts +166 -0
  232. package/dist/types/reference/graphql.d.ts +181 -0
  233. package/dist/types/reference/index.d.ts +32 -0
  234. package/dist/types/reference/openapi.d.ts +165 -0
  235. package/dist/types/reference/options.d.ts +157 -0
  236. package/dist/types/reference/scalar.d.ts +136 -0
  237. package/dist/types/reference/schema.d.ts +630 -0
  238. package/dist/types/search/adapters/algolia.d.ts +32 -0
  239. package/dist/types/search/adapters/flexsearch.d.ts +12 -0
  240. package/dist/types/search/adapters/index.d.ts +31 -0
  241. package/dist/types/search/adapters/mixedbread.d.ts +22 -0
  242. package/dist/types/search/adapters/orama-cloud.d.ts +33 -0
  243. package/dist/types/search/adapters/orama.d.ts +13 -0
  244. package/dist/types/search/adapters/pagefind.d.ts +12 -0
  245. package/dist/types/search/adapters/registry.d.ts +228 -0
  246. package/dist/types/search/adapters/types.d.ts +34 -0
  247. package/dist/types/search/adapters/typesense.d.ts +42 -0
  248. package/dist/types/search/build.d.ts +23 -0
  249. package/dist/types/search/documents.d.ts +90 -0
  250. package/dist/types/search/facets.d.ts +3 -0
  251. package/dist/types/search/sync/algolia.d.ts +14 -0
  252. package/dist/types/search/sync/index.d.ts +14 -0
  253. package/dist/types/search/sync/orama-cloud.d.ts +10 -0
  254. package/dist/types/search/sync/typesense.d.ts +14 -0
  255. package/dist/types/sources/contentful.d.ts +68 -0
  256. package/dist/types/sources/custom.d.ts +20 -0
  257. package/dist/types/sources/filesystem.d.ts +42 -0
  258. package/dist/types/sources/github-releases.d.ts +46 -0
  259. package/dist/types/sources/index.d.ts +48 -0
  260. package/dist/types/sources/mdx-remote.d.ts +63 -0
  261. package/dist/types/sources/notion.d.ts +65 -0
  262. package/dist/types/sources/obsidian.d.ts +34 -0
  263. package/dist/types/sources/payload.d.ts +68 -0
  264. package/dist/types/sources/registry.d.ts +1414 -0
  265. package/dist/types/sources/sanity.d.ts +69 -0
  266. package/dist/types/sources/shared.d.ts +46 -0
  267. package/dist/types/sources/strapi.d.ts +66 -0
  268. package/dist/types/theme/icon-kind.d.ts +11 -0
  269. package/dist/types/theme/icons.d.ts +20 -0
  270. package/docs/01-quickstart.mdx +18 -18
  271. package/docs/02-deployment.mdx +50 -26
  272. package/docs/03-upgrading.mdx +351 -0
  273. package/docs/04-migrating.mdx +58 -0
  274. package/docs/08-faq.mdx +3 -3
  275. package/docs/advanced/blog.mdx +13 -6
  276. package/docs/advanced/changelog.mdx +23 -35
  277. package/docs/advanced/custom-pages.mdx +20 -8
  278. package/docs/advanced/meta.ts +1 -8
  279. package/docs/advanced/skills.mdx +8 -0
  280. package/docs/cli/audit.mdx +646 -0
  281. package/docs/cli/doctor.mdx +29 -0
  282. package/docs/{reference/eval.mdx → cli/evals.mdx} +9 -8
  283. package/docs/cli/index.mdx +105 -0
  284. package/docs/cli/meta.ts +7 -0
  285. package/docs/{reference → cli}/translate.mdx +1 -1
  286. package/docs/cli/validate.mdx +41 -0
  287. package/docs/cli/version.mdx +40 -0
  288. package/docs/configuration/analytics.mdx +350 -59
  289. package/docs/configuration/ask-ai.mdx +162 -61
  290. package/docs/configuration/customization.mdx +15 -9
  291. package/docs/configuration/index.mdx +50 -31
  292. package/docs/configuration/search.mdx +75 -54
  293. package/docs/configuration/theming.mdx +24 -15
  294. package/docs/content/components.mdx +21 -5
  295. package/docs/{reference → content}/frontmatter.mdx +35 -1
  296. package/docs/content/i18n.mdx +8 -6
  297. package/docs/content/includes.mdx +2 -4
  298. package/docs/content/index.mdx +1 -1
  299. package/docs/content/islands.mdx +10 -5
  300. package/docs/content/meta.mdx +1 -1
  301. package/docs/content/meta.ts +1 -0
  302. package/docs/content/navigation.mdx +9 -7
  303. package/docs/content/sources.mdx +145 -50
  304. package/docs/content/syntax.mdx +16 -12
  305. package/docs/content/versioning.mdx +3 -3
  306. package/docs/discoverability/agent-discovery.mdx +11 -11
  307. package/docs/discoverability/index.mdx +4 -4
  308. package/docs/discoverability/json-api.mdx +4 -4
  309. package/docs/discoverability/llms-txt.mdx +6 -6
  310. package/docs/discoverability/markdown.mdx +4 -4
  311. package/docs/discoverability/mcp.mdx +11 -11
  312. package/docs/discoverability/sitemap-and-robots.mdx +3 -3
  313. package/docs/index.mdx +2 -2
  314. package/docs/references/asyncapi.mdx +59 -0
  315. package/docs/{advanced → references}/graphql.mdx +45 -32
  316. package/docs/{reference → references}/meta.ts +2 -2
  317. package/docs/references/openapi.mdx +171 -0
  318. package/docs/references/scalar.mdx +64 -0
  319. package/package.json +42 -8
  320. package/skills/blume/SKILL.md +21 -8
  321. package/skills/blume-migrate/SKILL.md +22 -21
  322. package/skills/blume-migrate/assets/oxfmt@0.67.0.patch +49 -0
  323. package/skills/blume-migrate/references/docusaurus.md +5 -4
  324. package/skills/blume-migrate/references/fumadocs.md +4 -4
  325. package/skills/blume-migrate/references/mintlify.md +23 -8
  326. package/skills/blume-migrate/references/monorepo.md +6 -6
  327. package/skills/blume-migrate/references/starlight.md +4 -4
  328. package/src/ai/agent-readability.ts +21 -22
  329. package/src/ai/ai-catalog.ts +50 -32
  330. package/src/ai/api/handlers.ts +46 -11
  331. package/src/ai/api-catalog.ts +8 -8
  332. package/src/ai/ask-data.ts +1 -1
  333. package/src/ai/ask.ts +624 -100
  334. package/src/ai/changelog-markdown.ts +91 -0
  335. package/src/ai/component-markdown.ts +328 -12
  336. package/src/ai/index.ts +45 -0
  337. package/src/ai/link-headers.ts +7 -6
  338. package/src/ai/llms.ts +20 -15
  339. package/src/ai/markdown.ts +35 -5
  340. package/src/ai/mcp/data.ts +9 -5
  341. package/src/ai/openapi-components.ts +4 -1
  342. package/src/ai/relative-links.ts +170 -0
  343. package/src/ai/serializers.ts +2 -2
  344. package/src/ai/skills.ts +1 -1
  345. package/src/ai/web-bot-auth.ts +2 -2
  346. package/src/analytics/adobe.ts +46 -0
  347. package/src/analytics/amplitude.ts +79 -0
  348. package/src/analytics/clarity.ts +46 -0
  349. package/src/analytics/clearbit.ts +47 -0
  350. package/src/analytics/cloudflare.ts +67 -0
  351. package/src/analytics/fathom.ts +64 -0
  352. package/src/analytics/google-analytics.ts +84 -0
  353. package/src/analytics/google-tag-manager.ts +61 -0
  354. package/src/analytics/head.ts +130 -0
  355. package/src/analytics/heap.ts +65 -0
  356. package/src/analytics/hightouch.ts +77 -0
  357. package/src/analytics/hotjar.ts +47 -0
  358. package/src/analytics/index.ts +71 -0
  359. package/src/analytics/inline.ts +21 -0
  360. package/src/analytics/logrocket.ts +71 -0
  361. package/src/analytics/mixpanel.ts +92 -0
  362. package/src/analytics/pirsch.ts +66 -0
  363. package/src/analytics/plausible.ts +83 -0
  364. package/src/analytics/posthog.ts +78 -0
  365. package/src/analytics/schema.ts +60 -0
  366. package/src/analytics/script.ts +60 -0
  367. package/src/analytics/segment.ts +85 -0
  368. package/src/analytics/vercel.ts +50 -0
  369. package/src/astro/adapter-root.ts +7 -9
  370. package/src/astro/component-slots.ts +131 -91
  371. package/src/astro/generate.ts +112 -345
  372. package/src/astro/integration.ts +2 -6
  373. package/src/astro/pages.ts +13 -101
  374. package/src/astro/render-deps.ts +379 -0
  375. package/src/astro/runtime-deps.ts +201 -0
  376. package/src/astro/templates.ts +554 -541
  377. package/src/audit/agent.ts +24 -0
  378. package/src/audit/catalog.ts +2 -2
  379. package/src/audit/checks/assets.ts +2 -2
  380. package/src/audit/checks/dns-aid.ts +1 -1
  381. package/src/audit/checks/duplicates.ts +3 -1
  382. package/src/audit/checks/i18n.ts +1 -1
  383. package/src/audit/checks/indexability.ts +7 -7
  384. package/src/audit/checks/links.ts +2 -2
  385. package/src/audit/checks/llms.ts +6 -6
  386. package/src/audit/checks/network.ts +3 -3
  387. package/src/audit/checks/og-image.ts +2 -2
  388. package/src/audit/checks/robots.ts +1 -1
  389. package/src/audit/checks/sitemap.ts +2 -2
  390. package/src/audit/checks/social.ts +1 -1
  391. package/src/audit/run.ts +4 -3
  392. package/src/audit/terms.ts +31 -0
  393. package/src/audit/url.ts +13 -13
  394. package/src/cli/command-meta.ts +10 -0
  395. package/src/cli/commands/audit.ts +39 -20
  396. package/src/cli/commands/build.ts +71 -316
  397. package/src/cli/commands/check.ts +1 -0
  398. package/src/cli/commands/dev.ts +40 -1
  399. package/src/cli/commands/doctor.ts +90 -14
  400. package/src/cli/commands/eject.ts +44 -7
  401. package/src/cli/commands/eval.ts +2 -2
  402. package/src/cli/commands/init.ts +161 -41
  403. package/src/cli/commands/migrate.ts +121 -0
  404. package/src/cli/commands/preview.ts +7 -1
  405. package/src/cli/commands/translate.ts +2 -2
  406. package/src/cli/commands/upgrade.ts +141 -0
  407. package/src/cli/commands/version.ts +57 -44
  408. package/src/cli/eject-scripts.ts +121 -6
  409. package/src/cli/index.ts +11 -1
  410. package/src/cli/init/install.ts +70 -0
  411. package/src/cli/init/questions.ts +7 -0
  412. package/src/cli/init/scaffold.ts +459 -75
  413. package/src/cli/lazy-command.ts +37 -1
  414. package/src/cli/prepare.ts +40 -6
  415. package/src/cli/required-secrets.ts +38 -11
  416. package/src/cli/unknown-flags.ts +266 -0
  417. package/src/cli/yarn-pnp.ts +52 -0
  418. package/src/components/content/AccordionItem.astro +7 -1
  419. package/src/components/content/Card.astro +4 -3
  420. package/src/components/content/ColorItem.astro +22 -4
  421. package/src/components/content/GithubInfo.astro +2 -2
  422. package/src/components/content/Prompt.astro +25 -25
  423. package/src/components/content/Tabs.astro +3 -1
  424. package/src/components/content/Tile.astro +2 -3
  425. package/src/components/content/Tooltip.astro +57 -9
  426. package/src/components/content/content-strings.ts +34 -0
  427. package/src/components/content/diff.ts +1 -1
  428. package/src/components/content/mermaid-element.ts +13 -2
  429. package/src/components/content/prompt-markdown.ts +292 -0
  430. package/src/components/content/tooltip-id.ts +41 -0
  431. package/src/components/islands/hooks.ts +25 -2
  432. package/src/components/layout/Analytics.astro +21 -79
  433. package/src/components/layout/Banner.astro +3 -1
  434. package/src/components/layout/DiscoveryLinks.astro +69 -0
  435. package/src/components/layout/Header.astro +83 -20
  436. package/src/components/layout/LanguageSwitcher.astro +4 -1
  437. package/src/components/layout/Logo.astro +23 -2
  438. package/src/components/layout/NavSelector.astro +13 -2
  439. package/src/components/layout/NavTree.astro +12 -3
  440. package/src/components/layout/NavTreeScript.astro +17 -3
  441. package/src/components/layout/PageActions.astro +3 -3
  442. package/src/components/layout/PageFeedback.astro +11 -1
  443. package/src/components/layout/PageLayout.astro +52 -5
  444. package/src/components/layout/ReferenceLayout.astro +21 -12
  445. package/src/components/layout/RootLayout.astro +69 -66
  446. package/src/components/layout/Search.astro +30 -6
  447. package/src/components/layout/WebMcp.astro +1 -1
  448. package/src/components/layout/analytics-client.ts +72 -15
  449. package/src/components/layout/drawer-inert.ts +113 -15
  450. package/src/components/layout/dropdown-clamp.ts +105 -0
  451. package/src/components/layout/head-scripts.ts +15 -6
  452. package/src/components/layout/nav-utils.ts +17 -0
  453. package/src/components/layout/search/algolia.ts +8 -8
  454. package/src/components/layout/search/orama-cloud.ts +9 -7
  455. package/src/components/layout/search/typesense.ts +11 -17
  456. package/src/components/openapi/MessageComposer.astro +2 -2
  457. package/src/components/openapi/Playground.astro +2 -2
  458. package/src/components/openapi/playground-client.ts +79 -10
  459. package/src/core/changelog-index.ts +24 -0
  460. package/src/core/component-overrides.ts +399 -154
  461. package/src/core/config-input.ts +188 -553
  462. package/src/core/config.ts +130 -41
  463. package/src/core/custom-pages.ts +105 -0
  464. package/src/core/data.ts +31 -12
  465. package/src/core/define-components.ts +12 -9
  466. package/src/core/deployment-env.ts +18 -74
  467. package/src/core/diagnostics.ts +14 -7
  468. package/src/core/graph.ts +69 -25
  469. package/src/core/i18n-ui.ts +6 -2
  470. package/src/core/i18n.ts +17 -0
  471. package/src/core/includes.ts +156 -38
  472. package/src/core/last-modified.ts +6 -11
  473. package/src/core/links.ts +166 -2
  474. package/src/core/manifest.ts +10 -3
  475. package/src/core/navigation.ts +115 -16
  476. package/src/core/new-tab.ts +35 -0
  477. package/src/core/node-require.ts +21 -0
  478. package/src/core/project-graph.ts +42 -26
  479. package/src/core/project.ts +9 -4
  480. package/src/core/request-body.ts +61 -0
  481. package/src/core/safe-href.ts +28 -0
  482. package/src/core/safe-links.ts +68 -0
  483. package/src/core/schema.ts +517 -739
  484. package/src/core/server-features.ts +8 -9
  485. package/src/core/sources/assets.ts +47 -11
  486. package/src/core/sources/collection.ts +67 -0
  487. package/src/core/sources/contentful-rich-text.ts +285 -0
  488. package/src/core/sources/contentful.ts +173 -0
  489. package/src/core/sources/github-releases.ts +51 -1
  490. package/src/core/sources/json.ts +71 -0
  491. package/src/core/sources/lexical.ts +195 -0
  492. package/src/core/sources/lower.ts +226 -0
  493. package/src/core/sources/normalize.ts +52 -2
  494. package/src/core/sources/notion.ts +39 -28
  495. package/src/core/sources/payload.ts +135 -0
  496. package/src/core/sources/portable-text.ts +11 -16
  497. package/src/core/sources/remote.ts +226 -0
  498. package/src/core/sources/resolve.ts +104 -166
  499. package/src/core/sources/sanity.ts +16 -49
  500. package/src/core/sources/strapi-blocks.ts +124 -0
  501. package/src/core/sources/strapi.ts +191 -0
  502. package/src/core/sources/types.ts +12 -1
  503. package/src/core/types.ts +15 -1
  504. package/src/core/ui-packs/ar.ts +6 -2
  505. package/src/core/ui-packs/bg.ts +6 -2
  506. package/src/core/ui-packs/bn.ts +6 -2
  507. package/src/core/ui-packs/ca.ts +3 -1
  508. package/src/core/ui-packs/cs.ts +6 -2
  509. package/src/core/ui-packs/da.ts +6 -2
  510. package/src/core/ui-packs/de.ts +6 -2
  511. package/src/core/ui-packs/el.ts +3 -1
  512. package/src/core/ui-packs/es.ts +3 -1
  513. package/src/core/ui-packs/fa.ts +6 -2
  514. package/src/core/ui-packs/fi.ts +6 -2
  515. package/src/core/ui-packs/fr.ts +3 -1
  516. package/src/core/ui-packs/he.ts +6 -2
  517. package/src/core/ui-packs/hi.ts +6 -2
  518. package/src/core/ui-packs/hr.ts +6 -2
  519. package/src/core/ui-packs/hu.ts +6 -2
  520. package/src/core/ui-packs/id.ts +6 -2
  521. package/src/core/ui-packs/it.ts +3 -1
  522. package/src/core/ui-packs/ja.ts +3 -1
  523. package/src/core/ui-packs/ko.ts +3 -1
  524. package/src/core/ui-packs/nl.ts +6 -2
  525. package/src/core/ui-packs/no.ts +6 -2
  526. package/src/core/ui-packs/pl.ts +6 -2
  527. package/src/core/ui-packs/pt-br.ts +3 -1
  528. package/src/core/ui-packs/pt.ts +3 -1
  529. package/src/core/ui-packs/ro.ts +6 -2
  530. package/src/core/ui-packs/ru.ts +6 -2
  531. package/src/core/ui-packs/sk.ts +6 -2
  532. package/src/core/ui-packs/sr.ts +6 -2
  533. package/src/core/ui-packs/sv.ts +6 -2
  534. package/src/core/ui-packs/th.ts +3 -1
  535. package/src/core/ui-packs/tr.ts +6 -2
  536. package/src/core/ui-packs/uk.ts +6 -2
  537. package/src/core/ui-packs/vi.ts +3 -1
  538. package/src/core/ui-packs/zh-tw.ts +3 -1
  539. package/src/core/ui-packs/zh.ts +3 -1
  540. package/src/core/unrecognized-keys.ts +10 -0
  541. package/src/core/version-cut.ts +116 -8
  542. package/src/deploy/adapter-output.ts +57 -97
  543. package/src/deploy/adapters/cloudflare.ts +39 -0
  544. package/src/deploy/adapters/index.ts +41 -0
  545. package/src/deploy/adapters/netlify.ts +34 -0
  546. package/src/deploy/adapters/node.ts +34 -0
  547. package/src/deploy/adapters/registry.ts +127 -0
  548. package/src/deploy/adapters/types.ts +92 -0
  549. package/src/deploy/adapters/vercel.ts +35 -0
  550. package/src/deploy/artifacts.ts +55 -27
  551. package/src/deploy/cloudflare-negotiation.ts +179 -100
  552. package/src/deploy/function-bundle.ts +18 -3
  553. package/src/deploy/headers.ts +124 -23
  554. package/src/deploy/node-headers.ts +198 -0
  555. package/src/deploy/platforms/cloudflare.ts +312 -0
  556. package/src/deploy/platforms/index.ts +67 -0
  557. package/src/deploy/platforms/netlify.ts +52 -0
  558. package/src/deploy/platforms/node.ts +40 -0
  559. package/src/deploy/platforms/paths.ts +42 -0
  560. package/src/deploy/platforms/static.ts +29 -0
  561. package/src/deploy/platforms/types.ts +112 -0
  562. package/src/deploy/platforms/vercel.ts +193 -0
  563. package/src/deploy/redirects.ts +30 -18
  564. package/src/deploy/robots.ts +3 -3
  565. package/src/deploy/rss.ts +2 -2
  566. package/src/deploy/sitemap.ts +2 -2
  567. package/src/deploy/vercel-negotiation.ts +2 -2
  568. package/src/eval/agents.ts +32 -1
  569. package/src/eval/findings.ts +19 -11
  570. package/src/eval/report.ts +10 -2
  571. package/src/markdown/external-links.ts +65 -0
  572. package/src/markdown/include.ts +45 -27
  573. package/src/markdown/index.ts +34 -9
  574. package/src/markdown/inline-code.ts +12 -6
  575. package/src/markdown/relative-links.ts +324 -0
  576. package/src/markdown/themes.ts +3 -3
  577. package/src/migrate/migrate.ts +149 -0
  578. package/src/openapi/parse.ts +64 -16
  579. package/src/openapi/proxy.ts +62 -10
  580. package/src/openapi/references.ts +147 -147
  581. package/src/openapi/render-mdx.ts +32 -10
  582. package/src/openapi/scalar.ts +15 -13
  583. package/src/openapi/sentence.ts +14 -0
  584. package/src/openapi/source.ts +37 -21
  585. package/src/openapi/spec-dependency-error.ts +15 -0
  586. package/src/reference/asyncapi.ts +83 -0
  587. package/src/reference/graphql.ts +89 -0
  588. package/src/reference/index.ts +40 -0
  589. package/src/reference/openapi.ts +83 -0
  590. package/src/reference/options.ts +201 -0
  591. package/src/reference/scalar.ts +136 -0
  592. package/src/reference/schema.ts +88 -0
  593. package/src/registry/eject.ts +97 -42
  594. package/src/search/adapters/algolia.ts +46 -0
  595. package/src/search/adapters/flexsearch.ts +29 -0
  596. package/src/search/adapters/index.ts +39 -0
  597. package/src/search/adapters/mixedbread.ts +39 -0
  598. package/src/search/adapters/orama-cloud.ts +51 -0
  599. package/src/search/adapters/orama.ts +24 -0
  600. package/src/search/adapters/pagefind.ts +27 -0
  601. package/src/search/adapters/registry.ts +131 -0
  602. package/src/search/adapters/types.ts +46 -0
  603. package/src/search/adapters/typesense.ts +57 -0
  604. package/src/search/build.ts +8 -4
  605. package/src/search/documents.ts +6 -0
  606. package/src/search/sync/algolia.ts +12 -11
  607. package/src/search/sync/index.ts +35 -20
  608. package/src/search/sync/orama-cloud.ts +12 -9
  609. package/src/search/sync/typesense.ts +15 -13
  610. package/src/sources/contentful.ts +63 -0
  611. package/src/sources/custom.ts +38 -0
  612. package/src/sources/filesystem.ts +51 -0
  613. package/src/sources/github-releases.ts +52 -0
  614. package/src/sources/index.ts +60 -0
  615. package/src/sources/mdx-remote.ts +76 -0
  616. package/src/sources/notion.ts +63 -0
  617. package/src/sources/obsidian.ts +38 -0
  618. package/src/sources/payload.ts +60 -0
  619. package/src/sources/registry.ts +182 -0
  620. package/src/sources/sanity.ts +66 -0
  621. package/src/sources/shared.ts +52 -0
  622. package/src/sources/strapi.ts +58 -0
  623. package/src/theme/entry.ts +24 -2
  624. package/src/translate/report.ts +40 -7
  625. package/src/upgrade/upgrade.ts +499 -0
  626. package/dist/cli/chunk-0qymqwzz.js +0 -164
  627. package/dist/cli/chunk-0qymqwzz.js.map +0 -15
  628. package/dist/cli/chunk-1jefwnfs.js.map +0 -48
  629. package/dist/cli/chunk-2mzebbbz.js +0 -69
  630. package/dist/cli/chunk-2z47ypj8.js.map +0 -11
  631. package/dist/cli/chunk-4x36ddpw.js.map +0 -11
  632. package/dist/cli/chunk-5093q3n7.js +0 -68
  633. package/dist/cli/chunk-5093q3n7.js.map +0 -10
  634. package/dist/cli/chunk-5qk08vmp.js.map +0 -11
  635. package/dist/cli/chunk-7s8hm3b6.js +0 -5347
  636. package/dist/cli/chunk-7s8hm3b6.js.map +0 -58
  637. package/dist/cli/chunk-8cjtbafj.js.map +0 -13
  638. package/dist/cli/chunk-97r59kpr.js +0 -381
  639. package/dist/cli/chunk-97r59kpr.js.map +0 -12
  640. package/dist/cli/chunk-ahnw3kxw.js.map +0 -15
  641. package/dist/cli/chunk-b27xqwn9.js.map +0 -10
  642. package/dist/cli/chunk-bf6bt1xt.js +0 -185
  643. package/dist/cli/chunk-bf6bt1xt.js.map +0 -11
  644. package/dist/cli/chunk-cjtn640a.js.map +0 -10
  645. package/dist/cli/chunk-ct47dqpx.js.map +0 -11
  646. package/dist/cli/chunk-esphfr8p.js +0 -107
  647. package/dist/cli/chunk-esphfr8p.js.map +0 -11
  648. package/dist/cli/chunk-ex56aa81.js +0 -1016
  649. package/dist/cli/chunk-ex56aa81.js.map +0 -13
  650. package/dist/cli/chunk-garjf5z9.js +0 -30
  651. package/dist/cli/chunk-garjf5z9.js.map +0 -10
  652. package/dist/cli/chunk-js7saxwm.js +0 -1045
  653. package/dist/cli/chunk-js7saxwm.js.map +0 -22
  654. package/dist/cli/chunk-k79xp7av.js.map +0 -39
  655. package/dist/cli/chunk-ps4m1xh4.js.map +0 -15
  656. package/dist/cli/chunk-q4rae3bg.js +0 -60
  657. package/dist/cli/chunk-q4rae3bg.js.map +0 -10
  658. package/dist/cli/chunk-rz9jmfhz.js +0 -108
  659. package/dist/cli/chunk-rz9jmfhz.js.map +0 -10
  660. package/dist/cli/chunk-vh9w1sgp.js +0 -73
  661. package/dist/cli/chunk-vh9w1sgp.js.map +0 -10
  662. package/dist/cli/chunk-vrfp10qk.js +0 -81
  663. package/dist/cli/chunk-vrfp10qk.js.map +0 -10
  664. package/dist/cli/chunk-yg63d42r.js.map +0 -34
  665. package/docs/advanced/api-reference.mdx +0 -240
  666. package/docs/reference/cli.mdx +0 -197
  667. package/skills/blume-migrate/assets/oxfmt@0.55.0.patch +0 -20
  668. package/src/components/content/changelog-element.ts +0 -69
  669. package/src/search/providers.ts +0 -91
  670. /package/dist/cli/{chunk-e7f42gdj.js.map → chunk-7ez8ny0t.js.map} +0 -0
  671. /package/dist/cli/{chunk-nn13znc2.js.map → chunk-88cpgt6h.js.map} +0 -0
  672. /package/dist/cli/{chunk-vacwm2hv.js.map → chunk-f7t03s3g.js.map} +0 -0
  673. /package/dist/cli/{chunk-dwgcp5sm.js.map → chunk-zxccj738.js.map} +0 -0
@@ -1,15 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/cli/commands/eval.ts", "../src/eval/prompts.ts", "../src/eval/report.ts", "../src/eval/run.ts", "../src/eval/schema.ts", "../src/eval/findings.ts"],
4
- "sourcesContent": [
5
- "import { existsSync } from \"node:fs\";\n\nimport { defineCommand } from \"citty\";\nimport { join } from \"pathe\";\n\nimport { AGENTS, launchAgent } from \"../../audit/agent.ts\";\nimport type { AgentKind } from \"../../audit/agent.ts\";\nimport { BlumeError } from \"../../core/diagnostics.ts\";\nimport { scanProject } from \"../../core/project-graph.ts\";\nimport { evalFixPrompt, initPrompt } from \"../../eval/prompts.ts\";\nimport {\n evalReportJson,\n fixLines,\n headerLine,\n questionDetails,\n questionLine,\n startLine,\n summaryLine,\n warningLines,\n writeEvalReport,\n} from \"../../eval/report.ts\";\nimport { runEval } from \"../../eval/run.ts\";\nimport type { EvalResult } from \"../../eval/run.ts\";\nimport { EvalsFileError, loadEvalsFile } from \"../../eval/schema.ts\";\nimport { commandMeta } from \"../command-meta.ts\";\nimport { reportInternalError } from \"../internal-error.ts\";\nimport { flushStdout, logger } from \"../log.ts\";\n\nconst DEFAULT_FILE = \"evals.yaml\";\n\n/** Reader wall-clock ceiling per question, in seconds. */\nconst DEFAULT_TIMEOUT_S = 180;\n\nconst isAgentKind = (value: string): value is AgentKind => value in AGENTS;\n\n/**\n * Launch the interactive agent CLI, turning a missing executable into the\n * install hint. Only `ENOENT` means \"not installed\" — any other spawn failure\n * (`EACCES`, `EMFILE`, …) must surface as itself.\n */\nconst notInstalled = (agent: AgentKind): never => {\n const cli = AGENTS[agent];\n logger.error(\n `${cli.name} (\\`${cli.bin}\\`) was not found on PATH. Install it with \\`${cli.install}\\`.`\n );\n return process.exit(1);\n};\n\nconst launchAgentCode = async (\n agent: AgentKind,\n prompt: string\n): Promise<number> => {\n try {\n return await launchAgent(AGENTS[agent].bin, prompt);\n } catch (error) {\n // SAFETY: only the `code` tag is inspected; a spawn failure throws an\n // ErrnoException, and any other thrown value fails the comparison and\n // rethrows unchanged.\n if ((error as NodeJS.ErrnoException)?.code !== \"ENOENT\") {\n throw error;\n }\n return notInstalled(agent);\n }\n};\n\n/** The fraction of run (non-skipped) questions that passed. */\nexport const passFraction = (result: EvalResult): number => {\n const ran = result.results.length - result.counts.skip;\n return ran === 0 ? 1 : result.counts.pass / ran;\n};\n\ninterface EvalFlags {\n action?: string;\n agent: string;\n file: string;\n fix?: boolean;\n json?: boolean;\n threshold?: string;\n timeout?: string;\n}\n\n/** Validate the flag surface, exiting with a message on the first offense. */\nconst parseFlags = (args: EvalFlags) => {\n if (!isAgentKind(args.agent)) {\n logger.error(`Invalid --agent \"${args.agent}\" (use claude | codex).`);\n process.exit(1);\n }\n if (args.action !== undefined && args.action !== \"init\") {\n logger.error(`Unknown action \"${args.action}\" (did you mean \"init\"?).`);\n process.exit(1);\n }\n if (args.json && args.fix) {\n logger.error(\"--json and --fix are mutually exclusive.\");\n process.exit(1);\n }\n const threshold = args.threshold === undefined ? 1 : Number(args.threshold);\n if (!Number.isFinite(threshold) || threshold < 0 || threshold > 1) {\n logger.error(`Invalid --threshold \"${args.threshold}\" (use 0..1).`);\n process.exit(1);\n }\n const timeoutS =\n args.timeout === undefined ? DEFAULT_TIMEOUT_S : Number(args.timeout);\n if (!Number.isInteger(timeoutS) || timeoutS <= 0) {\n logger.error(`Invalid --timeout \"${args.timeout}\" (whole seconds).`);\n process.exit(1);\n }\n return { agent: args.agent, threshold, timeoutS };\n};\n\n/** `blume eval --fix`: hand the failing report to the interactive agent. */\nconst runFixHandoff = async (\n agent: AgentKind,\n result: EvalResult,\n root: string,\n threshold: number\n): Promise<void> => {\n const count = result.counts.fail + result.counts.error;\n if (count === 0) {\n return;\n }\n const cli = AGENTS[agent];\n const report = await writeEvalReport(result, root, threshold);\n process.stderr.write(\n ` Handing ${count} failed question${count === 1 ? \"\" : \"s\"} to ${cli.name}…\\n\\n`\n );\n const code = await launchAgentCode(agent, evalFixPrompt(report));\n if (code !== 0) {\n process.exit(code);\n }\n};\n\n/** `blume eval init`: draft a starter evals file via the interactive agent. */\nconst runInit = async (agent: AgentKind, file: string): Promise<void> => {\n const path = join(process.cwd(), file);\n if (existsSync(path)) {\n logger.error(\n `${file} already exists — edit it directly, or pass --file to draft elsewhere.`\n );\n process.exit(1);\n }\n const code = await launchAgentCode(agent, initPrompt(file));\n if (code !== 0) {\n process.exit(code);\n }\n};\n\nexport const evalCommand = defineCommand({\n args: {\n action: {\n description: 'Optional action: \"init\" drafts a starter evals file.',\n required: false,\n type: \"positional\",\n },\n agent: {\n default: \"claude\",\n description: \"Agent CLI that reads and grades the docs: claude | codex.\",\n type: \"string\",\n },\n file: {\n default: DEFAULT_FILE,\n description: \"The evals file to run.\",\n type: \"string\",\n },\n fix: {\n description:\n \"After a failing run, hand the report to the agent to fix the docs interactively.\",\n type: \"boolean\",\n },\n json: {\n description: \"Emit the report as JSON on stdout (for CI/editors).\",\n type: \"boolean\",\n },\n threshold: {\n description:\n \"Minimum passing fraction (0..1) before the run exits non-zero. Defaults to 1.\",\n type: \"string\",\n },\n timeout: {\n description: `Reader time limit per question, in seconds. Defaults to ${DEFAULT_TIMEOUT_S}.`,\n type: \"string\",\n },\n verbose: {\n description: \"Include the reader's full answer under each failure.\",\n type: \"boolean\",\n },\n },\n meta: commandMeta.eval,\n async run({ args }) {\n const root = process.cwd();\n const { agent, threshold, timeoutS } = parseFlags(args);\n if (args.action === \"init\") {\n await runInit(agent, args.file);\n return;\n }\n\n let result: EvalResult;\n try {\n // `scanProject`, not `prepareProject`: the eval reads the content tree\n // and never regenerates the runtime, so it doesn't contend with a\n // running dev server. Same reasoning as `blume audit`.\n const project = await scanProject(root, { mode: \"build\" });\n const evalsPath = join(root, args.file);\n const { evals, raw } = await loadEvalsFile(evalsPath);\n\n process.stderr.write(`${headerLine(evals.questions.length, agent)}\\n\\n`);\n result = await runEval({\n agent,\n evals,\n evalsPath,\n onProgress: (event) => {\n // Straight to stderr, not `logger.info` — consola drops info-level\n // lines in test and CI environments.\n if (event.kind === \"question-start\") {\n process.stderr.write(\n `${startLine(event.id, event.index, event.total)}\\n`\n );\n return;\n }\n const lines = [\n questionLine(event.result),\n ...questionDetails(event.result, Boolean(args.verbose)),\n ];\n process.stderr.write(`${lines.join(\"\\n\")}\\n`);\n },\n project,\n rawEvals: raw,\n readerTimeoutMs: timeoutS * 1000,\n });\n } catch (error) {\n if (error instanceof EvalsFileError) {\n logger.error(error.message);\n process.exit(1);\n }\n if (error instanceof BlumeError) {\n logger.error(error.diagnostic.message);\n process.exit(1);\n }\n // SAFETY: only the `code` tag is inspected; a spawn failure throws an\n // ErrnoException, and any other thrown value fails the comparison and\n // falls through to the internal-error report.\n if ((error as NodeJS.ErrnoException)?.code === \"ENOENT\") {\n notInstalled(agent);\n }\n reportInternalError(error);\n process.exit(1);\n }\n\n const tail = [\n \"\",\n ...warningLines(result, root),\n ...fixLines(result, root),\n \"\",\n ` ${summaryLine(result)}`,\n \"\",\n ];\n process.stderr.write(tail.join(\"\\n\"));\n\n const failed = passFraction(result) < threshold;\n\n if (args.fix) {\n // The gate is a CI concern; a handoff run succeeds when the agent\n // session does, not when the docs already passed.\n await runFixHandoff(agent, result, root, threshold);\n return;\n }\n\n if (args.json) {\n process.stdout.write(evalReportJson(result, root, threshold));\n if (failed) {\n // `process.exit` doesn't flush a piped stdout — without this the JSON\n // is truncated mid-write in exactly the CI setups that consume it.\n await flushStdout();\n process.exit(1);\n }\n return;\n }\n\n if (failed) {\n process.exit(1);\n }\n },\n});\n",
6
- "import type { EvalQuestion } from \"./schema.ts\";\n\n/**\n * The reader's instructions. The agent is spawned in an empty directory with\n * its file/shell/web tools disabled, so the prompt's job is to direct it at\n * the MCP docs tools and forbid the one escape hatch that remains: answering\n * from prior knowledge of the product.\n */\nexport const readerPrompt = (question: EvalQuestion): string =>\n `You are evaluating whether a product's documentation can answer a user's question.\n\nAnswer the question below using ONLY the connected documentation tools (search_docs, get_page, list_pages, get_navigation). Rules:\n- Do not use prior knowledge about the product. Do not guess.\n- Do not read files, run commands, or access the network.\n- Search first, then read the most relevant pages with get_page.\n- If the documentation does not contain the answer, say exactly what information is missing instead of inventing one.\n\nQuestion: ${question.question}\n\nReply with a concise answer containing the specific facts the documentation provides. Plain text only.`;\n\n/** The judge's instructions: grade the answer against the expected facts. */\nexport const judgePrompt = (question: EvalQuestion, answer: string): string => {\n const facts = question.expected.map((fact) => `- ${fact}`).join(\"\\n\");\n return `You are grading an answer against expected facts. Do not use any tools.\n\nQuestion: ${question.question}\n\nExpected facts — each must be present in substance (paraphrase is fine, contradiction is not):\n${facts}\n\nAnswer to grade:\n\"\"\"\n${answer}\n\"\"\"\n\nAn answer that states the documentation lacks the information FAILS.\n\nReply with ONLY this JSON object on a single line, no markdown fences:\n{\"pass\": true|false, \"score\": 0.0-1.0, \"missing\": [\"expected facts absent or contradicted\"], \"notes\": \"one sentence\"}`;\n};\n\n/** The `--fix` handoff prompt: where the report is and the ground rules. */\nexport const evalFixPrompt = (reportPath: string): string =>\n `Fix the documentation gaps found by \\`blume eval\\` in this project.\n\nThe full report is at ${reportPath}. It is JSON: each entry in \\`eval.results\\` with status \"fail\" is one question the documentation could not answer. Each carries the \\`question\\`, the \\`expected\\` facts, the judge's \\`missing\\` facts, and the reader agent's \\`answer\\` (what the docs currently convey). The matching \\`diagnostics\\` entry names the source \\`file\\` of the page that should answer it.\n\nWork through every failed question:\n1. Read the page named in the finding (or choose the best page when none is named).\n2. Edit the documentation so it states the missing facts explicitly. Add prose, not filler; keep the page's voice.\n3. Never delete questions from the evals file or weaken expected facts.\n\nWhen you are done, run \\`blume eval\\` to verify, and repeat until every question passes.`;\n\n/** The `eval init` prompt: draft a starter evals file from the docs. */\nexport const initPrompt = (evalsPath: string): string =>\n `Draft a starter evals file for \\`blume eval\\` in this documentation project.\n\nRead the documentation source pages in this project and write ${evalsPath} with about 10 high-value questions a real user would ask — installation, configuration, deployment, and the project's headline features. For each question, list the expected facts a correct answer must state, grounded in what the documentation actually promises (never invent facts the docs don't state).\n\nThe file format is YAML:\n\nquestions:\n - id: kebab-case-slug\n question: One user question?\n expected:\n - a fact the answer must contain\n - another required fact\n routes:\n - /route/of/the/page/that/answers/it\n\nRules:\n- Every \\`expected\\` fact must be verifiable in the docs today.\n- Prefer questions whose answers live on one page; set \\`routes\\` to that page.\n- Keep ids unique and questions short.\n\nWhen you are done, print the file and suggest running \\`blume eval\\` to try it.`;\n",
7
- "import { mkdtemp, writeFile } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\n\nimport { colors } from \"consola/utils\";\nimport type { ColorFunction } from \"consola/utils\";\nimport { join, relative } from \"pathe\";\n\nimport { AGENTS } from \"../audit/agent.ts\";\nimport { duration, money, seconds } from \"../cli/report-format.ts\";\nimport { countBySeverity } from \"../core/diagnostics.ts\";\nimport type { EvalResult, QuestionResult, QuestionStatus } from \"./run.ts\";\n\nconst GLYPH = {\n error: \"!\",\n fail: \"✖\",\n pass: \"✔\",\n skip: \"⊘\",\n} satisfies Record<QuestionStatus, string>;\n\nconst STATUS_COLOR = {\n error: colors.yellow,\n fail: colors.red,\n pass: colors.green,\n skip: colors.dim,\n} satisfies Record<QuestionStatus, ColorFunction>;\n\n/** Longest id gets the room; everything shorter aligns to it. */\nconst ID_PAD = 28;\n\n/** One question's progress/report line: glyph, id, status, score, time, cost. */\nexport const questionLine = (result: QuestionResult): string => {\n const color = STATUS_COLOR[result.status];\n const glyph = color(GLYPH[result.status]);\n const id = result.id.padEnd(ID_PAD);\n if (result.status === \"skip\") {\n return ` ${glyph} ${id} ${colors.dim(\"skipped\")}`;\n }\n const score = result.score === undefined ? \"\" : result.score.toFixed(2);\n const cost = money(result.costUsd);\n const cells = [\n color(result.status),\n score,\n colors.dim(seconds(result.durationMs)),\n cost === \"\" ? \"\" : colors.dim(cost),\n ]\n .filter((cell) => cell !== \"\")\n .join(\" \");\n return ` ${glyph} ${id} ${cells}`;\n};\n\n/** Indented context under a question's line: missing facts, error detail. */\nexport const questionDetails = (\n result: QuestionResult,\n verbose: boolean\n): string[] => {\n const lines: string[] = [];\n if (result.status === \"fail\") {\n for (const fact of result.missing) {\n lines.push(` ${colors.dim(`missing: ${fact}`)}`);\n }\n }\n if (result.status === \"error\" && result.detail) {\n lines.push(` ${colors.dim(result.detail)}`);\n }\n if (verbose && result.answer && result.status !== \"pass\") {\n lines.push(\n ...result.answer\n .split(\"\\n\")\n .map((line) => ` ${colors.dim(`> ${line}`)}`)\n );\n }\n return lines;\n};\n\n/** The one-line totals: `9 passed · 2 failed · 1 skipped · 1m 42s · $0.71`. */\nexport const summaryLine = (result: EvalResult): string => {\n const { counts } = result;\n const parts = [\n `${counts.pass} passed`,\n counts.fail > 0 ? `${counts.fail} failed` : \"\",\n counts.error > 0 ? `${counts.error} errored` : \"\",\n counts.skip > 0 ? `${counts.skip} skipped` : \"\",\n duration(result.durationMs),\n money(result.costUsd),\n ].filter((part) => part !== \"\");\n return parts.join(\" · \");\n};\n\n/** The header line the command prints before the first question runs. */\nexport const headerLine = (total: number, agent: EvalResult[\"agent\"]): string =>\n `${colors.bold(\"blume eval\")} ${total} question(s) · ${AGENTS[agent].name}`;\n\n/** The dim announce line while a question's agents run. */\nexport const startLine = (id: string, index: number, total: number): string =>\n ` ${colors.dim(`▸ ${id} (${index + 1}/${total})`)}`;\n\n/** `fix:` pointers for failed questions, naming the file that resolves each. */\nexport const fixLines = (result: EvalResult, root: string): string[] =>\n result.diagnostics\n .filter((diagnostic) => diagnostic.code !== \"BLUME_EVAL_ROUTE_UNKNOWN\")\n .map((finding) => {\n const site = finding.file\n ? `${relative(root, finding.file)}${finding.line ? `:${finding.line}` : \"\"}`\n : \"\";\n return ` ${colors.cyan(\"fix:\")} ${site} ${colors.dim(finding.message)}`;\n });\n\n/** Dim warnings for route hints that no longer match a page. */\nexport const warningLines = (result: EvalResult, root: string): string[] =>\n result.diagnostics\n .filter((diagnostic) => diagnostic.code === \"BLUME_EVAL_ROUTE_UNKNOWN\")\n .map((finding) => {\n const site = finding.file\n ? ` ${relative(root, finding.file)}${finding.line ? `:${finding.line}` : \"\"}`\n : \"\";\n return ` ${colors.yellow(\"⚠\")}${site} ${colors.dim(finding.message)}`;\n });\n\n/** The human report, written to stderr by the command. */\nexport const formatEvalReport = (\n result: EvalResult,\n root: string,\n options: { verbose?: boolean } = {}\n): string => {\n const lines: string[] = [headerLine(result.results.length, result.agent), \"\"];\n\n for (const question of result.results) {\n lines.push(\n questionLine(question),\n ...questionDetails(question, Boolean(options.verbose))\n );\n }\n lines.push(\"\");\n\n // The finding tells the author which file fixes which failure.\n const failures = fixLines(result, root);\n lines.push(...failures);\n if (failures.length > 0) {\n lines.push(\"\");\n }\n\n lines.push(` ${summaryLine(result)}`, \"\");\n return lines.join(\"\\n\");\n};\n\n/**\n * The machine-readable report. The `diagnostics` + `summary` shape matches\n * `blume validate --json` and `blume audit --json` exactly — anything parsing\n * those keeps working — with the eval run's own results alongside.\n */\nexport const evalReportJson = (\n result: EvalResult,\n root: string,\n threshold: number\n): string => {\n const diagnostics = result.diagnostics.map((diagnostic) =>\n diagnostic.file\n ? { ...diagnostic, file: relative(root, diagnostic.file) }\n : diagnostic\n );\n return `${JSON.stringify(\n {\n diagnostics,\n eval: {\n agent: result.agent,\n costUsd: result.costUsd,\n counts: result.counts,\n durationMs: result.durationMs,\n results: result.results,\n threshold,\n },\n summary: countBySeverity(result.diagnostics),\n },\n null,\n 2\n )}\\n`;\n};\n\n/**\n * Write the full JSON report where a `--fix` agent can read it — a file\n * rather than inline prompt text, because a long run's answers would exceed\n * the platform's argv limit.\n */\nexport const writeEvalReport = async (\n result: EvalResult,\n root: string,\n threshold: number\n): Promise<string> => {\n const dir = await mkdtemp(join(tmpdir(), \"blume-eval-\"));\n const path = join(dir, \"report.json\");\n await writeFile(path, evalReportJson(result, root, threshold));\n return path;\n};\n",
8
- "import { mkdir, mkdtemp, writeFile } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\n\nimport { join } from \"pathe\";\n\nimport { buildMcpData } from \"../ai/mcp/data.ts\";\nimport { AGENTS } from \"../audit/agent.ts\";\nimport type { AgentKind } from \"../audit/agent.ts\";\nimport type { BlumeProject } from \"../core/project-graph.ts\";\nimport type { Diagnostic } from \"../core/types.ts\";\nimport {\n agentArgs,\n parseVerdict,\n readAgentOutput,\n runAgentHeadless,\n writeMcpConfig,\n} from \"./agents.ts\";\nimport type { HeadlessRunner } from \"./agents.ts\";\nimport { questionFinding, routeFindings } from \"./findings.ts\";\nimport { judgePrompt, readerPrompt } from \"./prompts.ts\";\nimport type { EvalQuestion, EvalsFile } from \"./schema.ts\";\n\n/** Reader runs search and read several pages; the judge grades one answer. */\nconst DEFAULT_READER_TIMEOUT_MS = 180_000;\nconst DEFAULT_JUDGE_TIMEOUT_MS = 60_000;\n\nexport type QuestionStatus = \"error\" | \"fail\" | \"pass\" | \"skip\";\n\n/** One question's outcome, carrying everything the reports print. */\nexport interface QuestionResult {\n answer?: string;\n costUsd?: number;\n /** Why the run errored (timeout, agent failure, unparseable verdict). */\n detail?: string;\n durationMs: number;\n expected: string[];\n id: string;\n missing: string[];\n notes?: string;\n question: string;\n routes: string[];\n score?: number;\n status: QuestionStatus;\n}\n\nexport interface EvalResult {\n agent: AgentKind;\n /** Total spend, when the agent CLI reports it (claude does, codex doesn't). */\n costUsd?: number;\n counts: Record<QuestionStatus, number>;\n diagnostics: Diagnostic[];\n durationMs: number;\n results: QuestionResult[];\n}\n\nexport type EvalProgress =\n | {\n kind: \"question-end\";\n index: number;\n result: QuestionResult;\n total: number;\n }\n | { kind: \"question-start\"; id: string; index: number; total: number };\n\nexport interface EvalRunOptions {\n agent: AgentKind;\n evals: EvalsFile;\n /** Where the evals file lives, for findings with no usable route hint. */\n evalsPath: string;\n judgeTimeoutMs?: number;\n onProgress?: (event: EvalProgress) => void;\n project: BlumeProject;\n /** The evals file's raw text, for line-anchoring findings. */\n rawEvals: string;\n readerTimeoutMs?: number;\n /** The spawn function — injectable so tests never launch a real agent. */\n run?: HeadlessRunner;\n}\n\ninterface QuestionContext {\n bin: string;\n dir: string;\n judgeTimeoutMs: number;\n kind: AgentKind;\n mcp: Awaited<ReturnType<typeof writeMcpConfig>>;\n readerTimeoutMs: number;\n run: HeadlessRunner;\n}\n\nconst errored = (\n question: EvalQuestion,\n detail: string,\n durationMs: number\n): QuestionResult => ({\n detail,\n durationMs,\n expected: question.expected,\n id: question.id,\n missing: [],\n question: question.question,\n routes: question.routes,\n status: \"error\",\n});\n\n/** Run one question: a fresh empty cwd, the reader, then the judge. */\nconst runQuestion = async (\n question: EvalQuestion,\n index: number,\n context: QuestionContext\n): Promise<QuestionResult> => {\n const started = performance.now();\n const elapsed = () => Math.round(performance.now() - started);\n\n // An empty working directory per invocation is the fresh-eyes guardrail:\n // even if a tool restriction slips, there is nothing here to read.\n const workDir = join(context.dir, `work-${index}`);\n await mkdir(workDir, { recursive: true });\n\n const answerPath = join(workDir, \"answer.txt\");\n const reader = await context.run(\n context.bin,\n agentArgs(context.kind, { lastMessagePath: answerPath, mcp: context.mcp }),\n {\n cwd: workDir,\n prompt: readerPrompt(question),\n timeoutMs: context.readerTimeoutMs,\n }\n );\n const answer = await readAgentOutput(context.kind, reader, answerPath);\n if (answer.isError) {\n return {\n ...errored(question, `reader ${answer.detail ?? \"failed\"}`, elapsed()),\n costUsd: answer.costUsd,\n };\n }\n\n const verdictPath = join(workDir, \"verdict.txt\");\n const judge = await context.run(\n context.bin,\n agentArgs(context.kind, { lastMessagePath: verdictPath }),\n {\n cwd: workDir,\n prompt: judgePrompt(question, answer.text),\n timeoutMs: context.judgeTimeoutMs,\n }\n );\n const graded = await readAgentOutput(context.kind, judge, verdictPath);\n const costUsd =\n answer.costUsd === undefined && graded.costUsd === undefined\n ? undefined\n : (answer.costUsd ?? 0) + (graded.costUsd ?? 0);\n if (graded.isError) {\n return {\n ...errored(question, `judge ${graded.detail ?? \"failed\"}`, elapsed()),\n answer: answer.text,\n costUsd,\n };\n }\n\n const verdict = parseVerdict(graded.text);\n if (!verdict) {\n return {\n ...errored(question, \"judge returned no parseable verdict\", elapsed()),\n answer: answer.text,\n costUsd,\n };\n }\n\n return {\n answer: answer.text,\n costUsd,\n durationMs: elapsed(),\n expected: question.expected,\n id: question.id,\n missing: verdict.missing,\n notes: verdict.notes || undefined,\n question: question.question,\n routes: question.routes,\n score: verdict.score,\n status: verdict.pass ? \"pass\" : \"fail\",\n };\n};\n\n/**\n * Run every question through the reader/judge pair, sequentially: each\n * question is already two agent sessions, and a serial run keeps progress\n * output ordered and cost attribution obvious.\n */\nexport const runEval = async (options: EvalRunOptions): Promise<EvalResult> => {\n const started = performance.now();\n const kind = options.agent;\n const run = options.run ?? runAgentHeadless;\n const anchor = { path: options.evalsPath, raw: options.rawEvals };\n\n const dir = await mkdtemp(join(tmpdir(), \"blume-eval-\"));\n const snapshotPath = join(dir, \"mcp-data.json\");\n await writeFile(\n snapshotPath,\n JSON.stringify(await buildMcpData(options.project))\n );\n const mcp = await writeMcpConfig(dir, snapshotPath);\n\n const context: QuestionContext = {\n bin: AGENTS[kind].bin,\n dir,\n judgeTimeoutMs: options.judgeTimeoutMs ?? DEFAULT_JUDGE_TIMEOUT_MS,\n kind,\n mcp,\n readerTimeoutMs: options.readerTimeoutMs ?? DEFAULT_READER_TIMEOUT_MS,\n run,\n };\n\n const diagnostics: Diagnostic[] = [];\n const results: QuestionResult[] = [];\n const { questions } = options.evals;\n\n for (const [index, question] of questions.entries()) {\n diagnostics.push(...routeFindings(question, options.project, anchor));\n\n if (question.skip) {\n results.push({\n durationMs: 0,\n expected: question.expected,\n id: question.id,\n missing: [],\n question: question.question,\n routes: question.routes,\n status: \"skip\",\n });\n continue;\n }\n\n options.onProgress?.({\n id: question.id,\n index,\n kind: \"question-start\",\n total: questions.length,\n });\n // Sequential by design: each question is already two agent sessions, and\n // a serial run keeps progress output ordered and cost attribution obvious.\n // oxlint-disable-next-line no-await-in-loop\n const result = await runQuestion(question, index, context);\n results.push(result);\n if (result.status === \"fail\" || result.status === \"error\") {\n diagnostics.push(\n questionFinding(\n question,\n {\n detail: result.detail,\n missing: result.missing,\n status: result.status,\n },\n options.project,\n anchor\n )\n );\n }\n options.onProgress?.({\n index,\n kind: \"question-end\",\n result,\n total: questions.length,\n });\n }\n\n const counts = {\n error: 0,\n fail: 0,\n pass: 0,\n skip: 0,\n } satisfies Record<QuestionStatus, number>;\n for (const result of results) {\n counts[result.status] += 1;\n }\n const costs = results.flatMap((result) =>\n result.costUsd === undefined ? [] : [result.costUsd]\n );\n\n return {\n agent: kind,\n costUsd:\n costs.length > 0\n ? costs.reduce((total, cost) => total + cost, 0)\n : undefined,\n counts,\n diagnostics,\n durationMs: Math.round(performance.now() - started),\n results,\n };\n};\n",
9
- "import { readFile } from \"node:fs/promises\";\n\nimport { load } from \"js-yaml\";\nimport { z } from \"zod\";\n\nimport { YAML_SCHEMA } from \"../core/yaml.ts\";\n\n/** Question ids are kebab-case slugs so they read well in reports and CI logs. */\nconst ID_PATTERN = /^[a-z0-9][a-z0-9-]*$/u;\n\nconst questionSchema = z.strictObject({\n expected: z\n .array(z.string().min(1))\n .min(1, \"expected must list at least one fact\"),\n id: z\n .string()\n .regex(ID_PATTERN, \"id must be a kebab-case slug (a-z, 0-9, dashes)\"),\n question: z.string().min(1),\n routes: z\n .union([z.string(), z.array(z.string())])\n .default([])\n .transform((value) => (Array.isArray(value) ? value : [value])),\n severity: z.enum([\"error\", \"warning\"]).default(\"error\"),\n skip: z.boolean().default(false),\n});\n\n/** One author-written eval: a question plus the facts a passing answer states. */\nexport type EvalQuestion = z.infer<typeof questionSchema>;\n\nconst fullSchema = z.strictObject({\n questions: z.array(questionSchema).min(1),\n version: z.literal(1).default(1),\n});\n\n/**\n * The evals file schema. A bare top-level list of questions is accepted as\n * shorthand — `loadEvalsFile` wraps it before validating, rather than a\n * `z.union`, so schema errors name the offending field instead of collapsing\n * into an opaque \"invalid union\" issue.\n */\nexport const evalsFileSchema = fullSchema.superRefine((value, context) => {\n const seen = new Set<string>();\n for (const question of value.questions) {\n if (seen.has(question.id)) {\n context.addIssue({\n code: z.ZodIssueCode.custom,\n message: `duplicate question id \"${question.id}\"`,\n path: [\"questions\"],\n });\n }\n seen.add(question.id);\n }\n});\n\nexport type EvalsFile = z.infer<typeof evalsFileSchema>;\n\n/** A problem loading or validating the evals file, with the path it names. */\nexport class EvalsFileError extends Error {\n readonly path: string;\n\n constructor(path: string, message: string) {\n super(message);\n this.name = \"EvalsFileError\";\n this.path = path;\n }\n}\n\nconst describeIssues = (error: z.ZodError): string =>\n error.issues\n .map((issue) => {\n const at = issue.path.length > 0 ? ` at ${issue.path.join(\".\")}` : \"\";\n return `${issue.message}${at}`;\n })\n .join(\"; \");\n\n/**\n * Read and validate an evals file. Returns the parsed questions plus the raw\n * text, kept so findings can anchor to the line a question is defined on.\n */\nexport const loadEvalsFile = async (\n path: string\n): Promise<{ evals: EvalsFile; raw: string }> => {\n let raw: string;\n try {\n raw = await readFile(path, \"utf-8\");\n } catch {\n throw new EvalsFileError(\n path,\n `No evals file found at ${path}. Run \\`blume eval init\\` to draft one.`\n );\n }\n\n let parsed: unknown;\n try {\n parsed = load(raw, { schema: YAML_SCHEMA });\n } catch (error) {\n const detail = error instanceof Error ? error.message : String(error);\n throw new EvalsFileError(path, `Invalid YAML in ${path}: ${detail}`);\n }\n\n // The bare-list shorthand: a top-level sequence of questions.\n const candidate = Array.isArray(parsed) ? { questions: parsed } : parsed;\n const result = evalsFileSchema.safeParse(candidate);\n if (!result.success) {\n throw new EvalsFileError(\n path,\n `Invalid evals file at ${path}: ${describeIssues(result.error)}`\n );\n }\n return { evals: result.data, raw };\n};\n\n/**\n * The 1-based line where a question's `id:` entry appears in the raw evals\n * file, so a finding with no route hint can still point somewhere editable.\n */\nexport const locateQuestion = (raw: string, id: string): number | undefined => {\n const pattern = new RegExp(`^\\\\s*-?\\\\s*id:\\\\s*[\"']?${id}[\"']?\\\\s*$`, \"u\");\n const lines = raw.split(\"\\n\");\n for (const [index, line] of lines.entries()) {\n if (pattern.test(line)) {\n return index + 1;\n }\n }\n return undefined;\n};\n",
10
- "import type { BlumeProject } from \"../core/project-graph.ts\";\nimport type { Diagnostic } from \"../core/types.ts\";\nimport { locateQuestion } from \"./schema.ts\";\nimport type { EvalQuestion } from \"./schema.ts\";\n\nconst DOCS_URL = \"https://useblume.dev/docs/reference/eval\";\n\n/** Where a finding should anchor when no route hint matches a page. */\nexport interface EvalsAnchor {\n path: string;\n raw: string;\n}\n\n/** The manifest route a hint names, if any. */\nconst hintedRoute = (question: EvalQuestion, project: BlumeProject) => {\n for (const hint of question.routes) {\n const route = project.manifest.routes.find(\n (candidate) => candidate.path === hint\n );\n if (route) {\n return route;\n }\n }\n};\n\n/**\n * Warnings for route hints that name no manifest route — docs move, and a\n * finding that silently anchors to the evals file instead of the page it\n * used to name is a debugging session; a warning is a one-line fix.\n */\nexport const routeFindings = (\n question: EvalQuestion,\n project: BlumeProject,\n anchor: EvalsAnchor\n): Diagnostic[] => {\n const known = new Set(project.manifest.routes.map((route) => route.path));\n return question.routes\n .filter((hint) => !known.has(hint))\n .map((hint) => ({\n code: \"BLUME_EVAL_ROUTE_UNKNOWN\",\n docsUrl: DOCS_URL,\n file: anchor.path,\n line: locateQuestion(anchor.raw, question.id),\n message: `Question \"${question.id}\" hints at route \"${hint}\", which matches no page.`,\n severity: \"warning\" as const,\n suggestion:\n \"Update the question's `routes` to the page's current route, or remove the hint.\",\n }));\n};\n\n/** What the finding needs to know about how the question went. */\nexport interface QuestionOutcome {\n /** Why the run errored, when it did. */\n detail?: string;\n /** The expected facts the judge found absent or contradicted. */\n missing: string[];\n status: \"error\" | \"fail\";\n}\n\n/**\n * The diagnostic for a failed or errored question, anchored to the page that\n * should have answered it (via the first matching route hint) or, failing\n * that, to the question's line in the evals file.\n */\nexport const questionFinding = (\n question: EvalQuestion,\n outcome: QuestionOutcome,\n project: BlumeProject,\n anchor: EvalsAnchor\n): Diagnostic => {\n const route = hintedRoute(question, project);\n const site = route\n ? { file: route.sourcePath, url: route.path }\n : { file: anchor.path, line: locateQuestion(anchor.raw, question.id) };\n\n if (outcome.status === \"error\") {\n return {\n code: \"BLUME_EVAL_QUESTION_ERROR\",\n docsUrl: DOCS_URL,\n message: `Eval run failed for \"${question.question}\"${\n outcome.detail ? ` — ${outcome.detail}` : \"\"\n }.`,\n severity: question.severity,\n suggestion:\n \"Rerun `blume eval`; if it persists, check the agent CLI installation and the failure detail.\",\n ...site,\n };\n }\n\n const missing =\n outcome.missing.length > 0\n ? ` — missing: ${outcome.missing.join(\"; \")}`\n : \"\";\n return {\n code: \"BLUME_EVAL_QUESTION_FAILED\",\n docsUrl: DOCS_URL,\n message: `Docs could not answer: \"${question.question}\"${missing}`,\n severity: question.severity,\n suggestion:\n \"State the missing facts on this page, then rerun `blume eval`.\",\n ...site,\n };\n};\n"
11
- ],
12
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAEA;AACA,iBAAS;;;ACKF,IAAM,eAAe,CAAC,aAC3B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAQU,SAAS;AAAA;AAAA;AAKd,IAAM,cAAc,CAAC,UAAwB,WAA2B;AAAA,EAC7E,MAAM,QAAQ,SAAS,SAAS,IAAI,CAAC,SAAS,KAAK,MAAM,EAAE,KAAK;AAAA,CAAI;AAAA,EACpE,OAAO;AAAA;AAAA,YAEG,SAAS;AAAA;AAAA;AAAA,EAGnB;AAAA;AAAA;AAAA;AAAA,EAIA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUK,IAAM,gBAAgB,CAAC,eAC5B;AAAA;AAAA,wBAEsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUjB,IAAM,aAAa,CAAC,cACzB;AAAA;AAAA,gEAE8D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC3DhE;AACA;AAEA;AAEA;AAOA,IAAM,QAAQ;AAAA,EACZ,OAAO;A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ACX;AAAA,MACA,GAAG,aAAa,QAAQ,IAAI;AAAA,MAC5B,GAAG,SAAS,QAAQ,IAAI;AAAA,MACxB;AAAA,MACA,KAAK,YAAY,MAAM;AAAA,MACvB;AAAA,IACF;AAAA,IACA,QAAQ,OAAO,MAAM,KAAK,KAAK;AAAA,CAAI,CAAC;AAAA,IAEpC,MAAM,SAAS,aAAa,MAAM,IAAI;AAAA,IAEtC,IAAI,KAAK,KAAK;AAAA,MAGZ,MAAM,cAAc,OAAO,QAAQ,MAAM,SAAS;AAAA,MAClD;AAAA,IACF;AAAA,IAEA,IAAI,KAAK,MAAM;AAAA,MACb,QAAQ,OAAO,MAAM,eAAe,QAAQ,MAAM,SAAS,CAAC;AAAA,MAC5D,IAAI,QAAQ;AAAA,QAGV,MAAM,YAAY;AAAA,QAClB,QAAQ,KAAK,CAAC;AAAA,MAChB;AAAA,MACA;AAAA,IACF;AAAA,IAEA,IAAI,QAAQ;AAAA,MACV,QAAQ,KAAK,CAAC;AAAA,IAChB;AAAA;AAEJ,CAAC;",
13
- "debugId": "83C1CBF787A3FD3264756E2164756E21",
14
- "names": []
15
- }
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/cli/commands/preview.ts"],
4
- "sourcesContent": [
5
- "import { existsSync } from \"node:fs\";\n\nimport { preview } from \"astro\";\nimport { defineCommand } from \"citty\";\nimport { join } from \"pathe\";\n\nimport { loadConfig } from \"../../core/config.ts\";\nimport { resolveProjectContext } from \"../../core/project.ts\";\nimport { parsePort } from \"../args.ts\";\nimport { commandMeta } from \"../command-meta.ts\";\nimport { normalizeHost } from \"../host-args.ts\";\nimport { logger } from \"../log.ts\";\n\nexport const previewCommand = defineCommand({\n args: {\n host: { description: \"Network host to bind.\", type: \"string\" },\n port: { description: \"Port to listen on.\", type: \"string\" },\n },\n meta: commandMeta.preview,\n async run({ args }) {\n const root = process.cwd();\n const { config } = await loadConfig(root);\n const context = resolveProjectContext(root, config);\n\n if (!existsSync(join(context.outDir, \"astro.config.mjs\"))) {\n logger.error(\"No build found. Run `blume build` first.\");\n process.exit(1);\n }\n\n await preview({\n logLevel: \"info\",\n root: context.outDir,\n server: {\n // `normalizeHost` maps a bare `--host` (citty parses it as \"\") to\n // `true` so Vite binds all interfaces instead of the hostname \"\".\n host: normalizeHost(args.host),\n port: parsePort(args.port),\n },\n });\n },\n});\n"
6
- ],
7
- "mappings": ";;;;;;;;;;;;;;;AAAA;AAEA;AACA;AACA;AASO,IAAM,iBAAiB,cAAc;AAAA,EAC1C,MAAM;AAAA,IACJ,MAAM,EAAE,aAAa,yBAAyB,MAAM,SAAS;AAAA,IAC7D,MAAM,EAAE,aAAa,sBAAsB,MAAM,SAAS;AAAA,EAC5D;AAAA,EACA,MAAM,YAAY;AAAA,OACZ,IAAG,GAAG,QAAQ;AAAA,IAClB,MAAM,OAAO,QAAQ,IAAI;AAAA,IACzB,QAAQ,WAAW,MAAM,WAAW,IAAI;AAAA,IACxC,MAAM,UAAU,sBAAsB,MAAM,MAAM;AAAA,IAElD,IAAI,CAAC,WAAW,KAAK,QAAQ,QAAQ,kBAAkB,CAAC,GAAG;AAAA,MACzD,OAAO,MAAM,0CAA0C;AAAA,MACvD,QAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,IAEA,MAAM,QAAQ;AAAA,MACZ,UAAU;AAAA,MACV,MAAM,QAAQ;AAAA,MACd,QAAQ;AAAA,QAGN,MAAM,cAAc,KAAK,IAAI;AAAA,QAC7B,MAAM,UAAU,KAAK,IAAI;AAAA,MAC3B;AAAA,IACF,CAAC;AAAA;AAEL,CAAC;",
8
- "debugId": "F86008553E8CAFA164756E2164756E21",
9
- "names": []
10
- }
@@ -1,185 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- nextFenceState,
4
- INLINE_CODE,
5
- MD_IMAGE,
6
- targetOffsetIn,
7
- hasIncludeStatements,
8
- expandIncludes,
9
- hashText
10
- } from "./chunk-1jefwnfs.js";
11
- import {
12
- normalizeBasePath
13
- } from "./chunk-2mzebbbz.js";
14
-
15
- // src/core/sources/read.ts
16
- import { readFile } from "node:fs/promises";
17
- var readEntryText = async (ctx, page) => {
18
- if (page.body) {
19
- return page.body.text;
20
- }
21
- const name = page.source?.name;
22
- const source = name ? ctx.sources?.find((candidate) => candidate.name === name) : undefined;
23
- if (source?.read) {
24
- return await source.read(page.source.ref);
25
- }
26
- if (page.sourcePath) {
27
- return await readFile(page.sourcePath, "utf-8");
28
- }
29
- return "";
30
- };
31
- var readExpandedEntryText = async (ctx, page) => {
32
- const raw = await readEntryText(ctx, page);
33
- if (!(page.sourcePath && hasIncludeStatements(raw))) {
34
- return raw;
35
- }
36
- const source = ctx.sources?.find((candidate) => candidate.name === page.source.name);
37
- if (!source || source.staged || !source.contentRoot) {
38
- return raw;
39
- }
40
- const expansion = await expandIncludes(raw, {
41
- contentRoot: source.contentRoot,
42
- sourcePath: page.sourcePath
43
- });
44
- return expansion.text;
45
- };
46
-
47
- // src/core/content-assets.ts
48
- import { readdirSync, statSync } from "node:fs";
49
- import { readFile as readFile2 } from "node:fs/promises";
50
- import {
51
- basename,
52
- dirname,
53
- extname,
54
- normalize,
55
- relative,
56
- resolve
57
- } from "pathe";
58
- var CONTENT_ASSETS_PREFIX = "/blume-assets/content";
59
- var IMAGE_EXTENSIONS = new Set([
60
- ".apng",
61
- ".avif",
62
- ".bmp",
63
- ".gif",
64
- ".ico",
65
- ".jpeg",
66
- ".jpg",
67
- ".png",
68
- ".svg",
69
- ".tiff",
70
- ".webp"
71
- ]);
72
- var isRelativeTarget = (target) => !(target.startsWith("/") || target.startsWith("#")) && !URL.canParse(target);
73
- var contentAssetParam = (projectRoot, absPath) => {
74
- const rel = relative(projectRoot, absPath);
75
- if (rel.startsWith("..")) {
76
- return `_/${hashText(absPath)}${extname(absPath)}`;
77
- }
78
- return rel;
79
- };
80
- var decodeTarget = (target) => {
81
- try {
82
- return decodeURI(target);
83
- } catch {
84
- return target;
85
- }
86
- };
87
- var isRelativeImageTarget = (target) => isRelativeTarget(target) && IMAGE_EXTENSIONS.has(extname(decodeTarget(target)).toLowerCase());
88
- var existsAsWritten = (abs, segments) => {
89
- let current = abs;
90
- for (let i = 0;i < segments; i += 1) {
91
- const parent = dirname(current);
92
- let entries;
93
- try {
94
- entries = readdirSync(parent);
95
- } catch {
96
- return false;
97
- }
98
- if (!entries.includes(basename(current))) {
99
- return false;
100
- }
101
- current = parent;
102
- }
103
- const stat = statSync(abs, { throwIfNoEntry: false });
104
- return stat !== undefined && stat.isFile();
105
- };
106
- var resolveRelativeImage = (sourceDir, target) => {
107
- if (!isRelativeImageTarget(target)) {
108
- return null;
109
- }
110
- const decoded = decodeTarget(target);
111
- const segments = normalize(decoded).split("/").filter((part) => part !== "" && part !== "..").length;
112
- const abs = resolve(sourceDir, decoded);
113
- return existsAsWritten(abs, segments) ? abs : null;
114
- };
115
- var encodedParam = (param) => param.split("/").map(encodeURIComponent).join("/");
116
- var rewriteLine = (line, toUrl) => {
117
- const masked = line.replaceAll(INLINE_CODE, (span) => " ".repeat(span.length));
118
- let out = "";
119
- let cursor = 0;
120
- for (const match of masked.matchAll(MD_IMAGE)) {
121
- const target = match.groups?.target ?? "";
122
- const url = toUrl(target);
123
- if (url === null) {
124
- continue;
125
- }
126
- const offset = (match.index ?? 0) + targetOffsetIn(match[0], target, match.groups?.title);
127
- out += line.slice(cursor, offset) + url;
128
- cursor = offset + target.length;
129
- }
130
- return out + line.slice(cursor);
131
- };
132
- var rewriteRelativeImages = (options) => {
133
- const { source, sourcePath, projectRoot, deployBase, register } = options;
134
- const sourceDir = dirname(sourcePath);
135
- const prefix = `${normalizeBasePath(deployBase)}${CONTENT_ASSETS_PREFIX}`;
136
- const toUrl = (target) => {
137
- const abs = resolveRelativeImage(sourceDir, target);
138
- if (abs === null) {
139
- return null;
140
- }
141
- const param = contentAssetParam(projectRoot, abs);
142
- register?.(param, abs);
143
- return `${prefix}/${encodedParam(param)}`;
144
- };
145
- let fence = null;
146
- const lines = source.split(`
147
- `).map((line) => {
148
- const next = nextFenceState(line, fence);
149
- const inFence = fence !== null || next !== null;
150
- fence = next;
151
- return inFence ? line : rewriteLine(line, toUrl);
152
- });
153
- return lines.join(`
154
- `);
155
- };
156
- var collectContentAssets = async (project) => {
157
- const pageById = new Map(project.graph.pages.map((page) => [page.id, page]));
158
- const files = {};
159
- await Promise.all(project.manifest.routes.map(async (route) => {
160
- if (!route.sourcePath) {
161
- return;
162
- }
163
- const page = pageById.get(route.id);
164
- let source;
165
- try {
166
- source = page ? await readExpandedEntryText(project, page) : await readFile2(route.sourcePath, "utf-8");
167
- } catch {
168
- return;
169
- }
170
- rewriteRelativeImages({
171
- projectRoot: project.context.root,
172
- register: (param, abs) => {
173
- files[param] = abs;
174
- },
175
- source,
176
- sourcePath: route.sourcePath
177
- });
178
- }));
179
- return files;
180
- };
181
-
182
- export { readExpandedEntryText, isRelativeImageTarget, resolveRelativeImage, rewriteRelativeImages, collectContentAssets };
183
-
184
- //# debugId=A36E1E08EE90A10064756E2164756E21
185
- //# sourceMappingURL=chunk-bf6bt1xt.js.map
@@ -1,11 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/core/sources/read.ts", "../src/core/content-assets.ts"],
4
- "sourcesContent": [
5
- "import { readFile } from \"node:fs/promises\";\n\nimport { expandIncludes, hasIncludeStatements } from \"../includes.ts\";\nimport type { PageRecord } from \"../types.ts\";\nimport type { ContentSource } from \"./types.ts\";\n\n/** The subset of a scanned project the entry reader needs. */\nexport interface EntryReadContext {\n /** The instantiated sources, keyed for `read()` lookups. */\n sources?: ContentSource[];\n}\n\n/**\n * Read an entry's raw body text without assuming a filesystem path. Prefers the\n * body captured at scan time (staged sources), then the owning source's lazy\n * `read()`, then the back-compat `sourcePath` (any local file). Returns `\"\"` when an\n * entry can't be resolved, so callers degrade gracefully.\n */\nexport const readEntryText = async (\n ctx: EntryReadContext,\n page: PageRecord\n): Promise<string> => {\n if (page.body) {\n return page.body.text;\n }\n const name = page.source?.name;\n const source = name\n ? ctx.sources?.find((candidate) => candidate.name === name)\n : undefined;\n if (source?.read) {\n return await source.read(page.source.ref);\n }\n if (page.sourcePath) {\n return await readFile(page.sourcePath, \"utf-8\");\n }\n return \"\";\n};\n\n/**\n * Read an entry's raw body with `<include>` statements expanded — what search\n * indexing, the `.md`/`.mdx` mirrors, and llms-full.txt should see, matching\n * the spliced content the rendered page shows. Filesystem entries only\n * (includes resolve as filesystem paths); everything else passes through\n * verbatim. Expansion errors were already surfaced as scan diagnostics, so\n * unresolvable statements simply stay verbatim here.\n */\nexport const readExpandedEntryText = async (\n ctx: EntryReadContext,\n page: PageRecord\n): Promise<string> => {\n const raw = await readEntryText(ctx, page);\n if (!(page.sourcePath && hasIncludeStatements(raw))) {\n return raw;\n }\n const source = ctx.sources?.find(\n (candidate) => candidate.name === page.source.name\n );\n // Mirror the scan's expansion gate exactly (`!staged && contentRoot`): a\n // staged/custom source's entries were never expanded at scan time, so no\n // headings/links/diagnostics exist for the spliced content — expanding only\n // here would splice text the rest of the pipeline never validated, with no\n // content-root bound on resolution.\n if (!source || source.staged || !source.contentRoot) {\n return raw;\n }\n const expansion = await expandIncludes(raw, {\n contentRoot: source.contentRoot,\n sourcePath: page.sourcePath,\n });\n return expansion.text;\n};\n",
6
- "import { readdirSync, statSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\n\nimport {\n basename,\n dirname,\n extname,\n normalize,\n relative,\n resolve,\n} from \"pathe\";\n\nimport { normalizeBasePath } from \"./base-path.ts\";\nimport { nextFenceState } from \"./code-fences.ts\";\nimport type { FenceState } from \"./code-fences.ts\";\nimport { hashText } from \"./sources/cache.ts\";\nimport { INLINE_CODE, MD_IMAGE, targetOffsetIn } from \"./sources/normalize.ts\";\nimport { readExpandedEntryText } from \"./sources/read.ts\";\nimport type { ContentSource } from \"./sources/types.ts\";\nimport type { PageRecord } from \"./types.ts\";\n\n/**\n * Colocated content images — `![alt](./diagram.png)` next to the page that\n * references it. The HTML render optimizes these through `astro:assets` into\n * hashed `_astro/` files, but that mapping doesn't exist yet when the raw\n * agent-facing Markdown (`/<route>.md`, llms-full.txt, MCP) is snapshotted at\n * generate time — so a verbatim relative path would 404 for every agent\n * fetching the page by URL. Instead, the originals are served at\n * `/blume-assets/content/<project-relative path>` by a generated endpoint (see\n * `contentAssetsEndpointTemplate`), and these helpers rewrite the relative\n * references in agent-facing output to that URL.\n */\n\n/** The endpoint route prefix colocated content images are served under. */\nexport const CONTENT_ASSETS_PREFIX = \"/blume-assets/content\";\n\n// The formats Astro's image pipeline accepts, plus the web-safe pass-throughs;\n// anything else referenced relatively (a `.pdf`, a source file) is left alone.\nconst IMAGE_EXTENSIONS = new Set([\n \".apng\",\n \".avif\",\n \".bmp\",\n \".gif\",\n \".ico\",\n \".jpeg\",\n \".jpg\",\n \".png\",\n \".svg\",\n \".tiff\",\n \".webp\",\n]);\n\n/** Whether a link target is a relative filesystem path (not URL/absolute/hash). */\nconst isRelativeTarget = (target: string): boolean =>\n !(target.startsWith(\"/\") || target.startsWith(\"#\")) && !URL.canParse(target);\n\n/**\n * The endpoint param a colocated image is served under: its project-relative\n * path (readable, collision-free — it mirrors the source tree). A file outside\n * the project root can't be addressed that way (`..` segments don't survive a\n * URL), so it falls back to a content-addressed name.\n */\nexport const contentAssetParam = (\n projectRoot: string,\n absPath: string\n): string => {\n const rel = relative(projectRoot, absPath);\n if (rel.startsWith(\"..\")) {\n return `_/${hashText(absPath)}${extname(absPath)}`;\n }\n return rel;\n};\n\n/** Percent-decode an image target; malformed escapes stay verbatim. */\nconst decodeTarget = (target: string): string => {\n try {\n return decodeURI(target);\n } catch {\n return target;\n }\n};\n\n/**\n * Whether a target is *shaped* like a colocated image reference: a relative\n * filesystem path with an image extension. Exported so link validation can\n * tell \"not a colocated candidate\" apart from \"a candidate that resolves\n * nowhere\" — the former falls through to the public-dir probe, the latter is\n * a broken reference beside the page source.\n */\nexport const isRelativeImageTarget = (target: string): boolean =>\n isRelativeTarget(target) &&\n IMAGE_EXTENSIONS.has(extname(decodeTarget(target)).toLowerCase());\n\n/**\n * Whether `abs` is a file whose trailing `segments` names match the on-disk\n * entries exactly. A bare `existsSync` accepts `./Diagram.PNG` for\n * `diagram.png` (or a directory named like an image) on a case-insensitive\n * filesystem — the reference then validates and serves locally but breaks on\n * the case-sensitive Linux build.\n */\nconst existsAsWritten = (abs: string, segments: number): boolean => {\n let current = abs;\n for (let i = 0; i < segments; i += 1) {\n const parent = dirname(current);\n let entries: string[];\n try {\n entries = readdirSync(parent);\n } catch {\n return false;\n }\n if (!entries.includes(basename(current))) {\n return false;\n }\n current = parent;\n }\n const stat = statSync(abs, { throwIfNoEntry: false });\n return stat !== undefined && stat.isFile();\n};\n\n/**\n * Resolve one image target against its page's directory. Returns the absolute\n * file path when the target is relative, is an image, and exists on disk —\n * anything else (remote URLs, `public/` absolutes, broken refs, code-block\n * examples that happen to look like paths) is null and left untouched. Shared\n * with link validation, so what counts as a colocated image is decided once.\n */\nexport const resolveRelativeImage = (\n sourceDir: string,\n target: string\n): string | null => {\n if (!isRelativeImageTarget(target)) {\n return null;\n }\n const decoded = decodeTarget(target);\n // Only the segments the author wrote are checked against on-disk names;\n // `sourceDir`'s own casing is the filesystem's business, not the target's.\n const segments = normalize(decoded)\n .split(\"/\")\n .filter((part) => part !== \"\" && part !== \"..\").length;\n const abs = resolve(sourceDir, decoded);\n return existsAsWritten(abs, segments) ? abs : null;\n};\n\n/** Encode an endpoint param for use in a Markdown URL, keeping `/` separators. */\nconst encodedParam = (param: string): string =>\n param.split(\"/\").map(encodeURIComponent).join(\"/\");\n\n/**\n * Rewrite one line's relative image targets. Matches run on a copy with inline\n * code blanked out (a `` `![x](./y.png)` `` span is syntax being *shown*, not\n * an image), while replacements splice into the real line by index — the mask\n * preserves length, so the indices line up.\n */\nconst rewriteLine = (\n line: string,\n toUrl: (target: string) => string | null\n): string => {\n const masked = line.replaceAll(INLINE_CODE, (span) =>\n \" \".repeat(span.length)\n );\n let out = \"\";\n let cursor = 0;\n for (const match of masked.matchAll(MD_IMAGE)) {\n const target = match.groups?.target ?? \"\";\n const url = toUrl(target);\n if (url === null) {\n continue;\n }\n const offset =\n (match.index ?? 0) +\n targetOffsetIn(match[0], target, match.groups?.title);\n out += line.slice(cursor, offset) + url;\n cursor = offset + target.length;\n }\n return out + line.slice(cursor);\n};\n\n/**\n * Rewrite a page's relative image references to their served\n * `/blume-assets/content/…` URLs (under `deployment.base` when set). Fenced\n * code blocks and inline code are skipped; only references whose file actually\n * exists next to the source are touched. `register` observes each rewritten\n * asset so a caller can accumulate the files the endpoint must serve.\n */\nexport const rewriteRelativeImages = (options: {\n source: string;\n sourcePath: string;\n projectRoot: string;\n deployBase?: string;\n register?: (param: string, absPath: string) => void;\n}): string => {\n const { source, sourcePath, projectRoot, deployBase, register } = options;\n const sourceDir = dirname(sourcePath);\n const prefix = `${normalizeBasePath(deployBase)}${CONTENT_ASSETS_PREFIX}`;\n const toUrl = (target: string): string | null => {\n const abs = resolveRelativeImage(sourceDir, target);\n if (abs === null) {\n return null;\n }\n const param = contentAssetParam(projectRoot, abs);\n register?.(param, abs);\n return `${prefix}/${encodedParam(param)}`;\n };\n\n let fence: FenceState = null;\n const lines = source.split(\"\\n\").map((line) => {\n const next = nextFenceState(line, fence);\n const inFence = fence !== null || next !== null;\n fence = next;\n return inFence ? line : rewriteLine(line, toUrl);\n });\n return lines.join(\"\\n\");\n};\n\n/**\n * Every colocated image the project's pages reference, keyed by endpoint param.\n * Serialized to `generated/content-assets.json`, which the\n * `/blume-assets/[...asset]` endpoint reads to serve the original files. Runs\n * the same rewrite the agent-Markdown builders apply — over the same\n * include-expanded text, so a partial's colocated images (rebased into the\n * including page by the expander) are served too — keeping the served set and\n * the rewritten URLs from drifting apart.\n */\nexport const collectContentAssets = async (project: {\n context: { root: string };\n manifest: { routes: { id: string; sourcePath?: string }[] };\n graph: { pages: PageRecord[] };\n sources?: ContentSource[];\n}): Promise<Record<string, string>> => {\n const pageById = new Map(project.graph.pages.map((page) => [page.id, page]));\n const files: Record<string, string> = {};\n await Promise.all(\n project.manifest.routes.map(async (route) => {\n if (!route.sourcePath) {\n return;\n }\n const page = pageById.get(route.id);\n let source: string;\n try {\n source = page\n ? await readExpandedEntryText(project, page)\n : await readFile(route.sourcePath, \"utf-8\");\n } catch {\n return;\n }\n rewriteRelativeImages({\n projectRoot: project.context.root,\n register: (param, abs) => {\n files[param] = abs;\n },\n source,\n sourcePath: route.sourcePath,\n });\n })\n );\n return files;\n};\n"
7
- ],
8
- "mappings": ";;;;;;;;;;;;;;;AAAA;AAkBO,IAAM,gBAAgB,OAC3B,KACA,SACoB;AAAA,EACpB,IAAI,KAAK,MAAM;AAAA,IACb,OAAO,KAAK,KAAK;AAAA,EACnB;AAAA,EACA,MAAM,OAAO,KAAK,QAAQ;AAAA,EAC1B,MAAM,SAAS,OACX,IAAI,SAAS,KAAK,CAAC,cAAc,UAAU,SAAS,IAAI,IACxD;AAAA,EACJ,IAAI,QAAQ,MAAM;AAAA,IAChB,OAAO,MAAM,OAAO,KAAK,KAAK,OAAO,GAAG;AAAA,EAC1C;AAAA,EACA,IAAI,KAAK,YAAY;AAAA,IACnB,OAAO,MAAM,SAAS,KAAK,YAAY,OAAO;AAAA,EAChD;AAAA,EACA,OAAO;AAAA;AAWF,IAAM,wBAAwB,OACnC,KACA,SACoB;AAAA,EACpB,MAAM,MAAM,MAAM,cAAc,KAAK,IAAI;AAAA,EACzC,IAAI,EAAE,KAAK,cAAc,qBAAqB,GAAG,IAAI;AAAA,IACnD,OAAO;AAAA,EACT;AAAA,EACA,MAAM,SAAS,IAAI,SAAS,KAC1B,CAAC,cAAc,UAAU,SAAS,KAAK,OAAO,IAChD;AAAA,EAMA,IAAI,CAAC,UAAU,OAAO,UAAU,CAAC,OAAO,aAAa;AAAA,IACnD,OAAO;AAAA,EACT;AAAA,EACA,MAAM,YAAY,MAAM,eAAe,KAAK;AAAA,IAC1C,aAAa,OAAO;AAAA,IACpB,YAAY,KAAK;AAAA,EACnB,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AC,OAAO,QAAQ;AAAA,QACxB,MAAM,SAAS;AAAA;AAAA,MAEjB;AAAA,MACA,YAAY,MAAM;AAAA,IACpB,CAAC;AAAA,GACF,CACH;AAAA,EACA,OAAO;AAAA;",
9
- "debugId": "A36E1E08EE90A10064756E2164756E21",
10
- "names": []
11
- }
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/cli/commands/dev.ts"],
4
- "sourcesContent": [
5
- "import { dev } from \"astro\";\nimport { watch } from \"chokidar\";\nimport { defineCommand } from \"citty\";\nimport { debounce } from \"perfect-debounce\";\n\nimport { generateRuntime } from \"../../astro/generate.ts\";\nimport {\n refreshBlumeContent,\n showBlumeErrorOverlay,\n} from \"../../astro/integration.ts\";\nimport { scanProject } from \"../../core/project-graph.ts\";\nimport { resolveRuntimeDir } from \"../../core/project.ts\";\nimport { parsePort } from \"../args.ts\";\nimport { commandMeta } from \"../command-meta.ts\";\nimport {\n acquireDevLock,\n describeDevLock,\n DevLockHeldError,\n updateDevLockPort,\n} from \"../dev-lock.ts\";\nimport { normalizeHost } from \"../host-args.ts\";\nimport { logger, reportDiagnostics } from \"../log.ts\";\nimport { prepareProject } from \"../prepare.ts\";\n\n/**\n * A fingerprint of the route set: the sorted `path entryId` pairs. It changes\n * when a page is added, removed, or renamed (a folder rename shifts many at\n * once) but stays equal across pure body edits — so the dev loop can tell a\n * \"structural\" change (needs a content re-sync) from a hot-reloadable one.\n */\nconst routeSignature = (\n routes: readonly { entryId: string; path: string }[]\n): string =>\n routes\n .map((route) => `${route.path} ${route.entryId}`)\n .toSorted()\n .join(\"\\n\");\n\nexport const devCommand = defineCommand({\n args: {\n \"content-dir\": {\n description: \"Content folder to scan, overriding config (content.root).\",\n type: \"string\",\n },\n debug: {\n description: \"Verbose Astro/Vite logging for troubleshooting.\",\n type: \"boolean\",\n },\n host: { description: \"Network host to bind.\", type: \"string\" },\n open: { description: \"Open the browser on start.\", type: \"boolean\" },\n port: { description: \"Port to listen on.\", type: \"string\" },\n preview: {\n description: \"Include drafts and unpublished CMS content.\",\n type: \"boolean\",\n },\n strict: { description: \"Fail on diagnostics.\", type: \"boolean\" },\n },\n meta: commandMeta.dev,\n async run({ args }) {\n const root = process.cwd();\n const preview = args.preview ?? false;\n const overrides = args[\"content-dir\"]\n ? { contentRoot: args[\"content-dir\"] }\n : undefined;\n // Astro's dev server defaults to 4321 when no port is passed. Feeding the\n // resolved URL in as the `deployment.site` fallback lets site-gated features\n // (OG images, canonicals, sitemap) work locally without configuring a site.\n const explicitPort = parsePort(args.port);\n const port = explicitPort ?? 4321;\n let devServerUrl = `http://localhost:${port}`;\n\n // Claim the shared `.blume` dir BEFORE preparing: `prepareProject`\n // regenerates the runtime, so even a refused second dev server would\n // otherwise clobber the running one's generated tree (with this\n // invocation's port baked in) on its way out. The claim is atomic, so two\n // simultaneous starts can't both win. Dev never relocates the runtime dir,\n // so the lock always lives at `<root>/.blume`.\n const outDir = resolveRuntimeDir(root);\n let releaseLock: () => void;\n try {\n releaseLock = acquireDevLock(outDir, port);\n } catch (error) {\n if (error instanceof DevLockHeldError) {\n logger.error(\n `A \\`blume dev\\` server is already running${describeDevLock(error.lock)} in this project. Reuse that server instead of starting a second one — two dev servers would corrupt the shared .blume dir. If it crashed, delete .blume/dev.lock.`\n );\n process.exit(1);\n }\n throw error;\n }\n process.on(\"exit\", releaseLock);\n\n const project = await prepareProject({\n devServerUrl,\n mode: \"dev\",\n overrides,\n preview,\n root,\n strict: args.strict,\n });\n\n // A factory so the regenerate loop can recreate the server when a\n // structural (route-set) change can't be re-synced in place (see below).\n // `open` is honored on first boot only — a restart must not reopen the\n // browser.\n const createServer = (listenPort: number | undefined, open: boolean) =>\n dev({\n logLevel: args.debug ? \"debug\" : \"info\",\n root: project.context.outDir,\n server: { host: normalizeHost(args.host), open, port: listenPort },\n });\n\n let server = await createServer(explicitPort, args.open ?? false);\n\n // Vite bumps to the next free port when the default is taken, so record\n // the port the server actually bound — the lock's URL is what a refused\n // second invocation tells its caller to reuse. The site fallback baked\n // into the runtime also carries the port, so it must follow suit (below,\n // once the regeneration closure exists).\n const boundPort = server.address.port;\n if (boundPort !== port) {\n updateDevLockPort(outDir, boundPort);\n devServerUrl = `http://localhost:${boundPort}`;\n }\n\n // Mirror any initial diagnostics into the browser overlay now the server\n // (and its HMR channel) is up.\n showBlumeErrorOverlay(project.diagnostics);\n\n let lastSignature = routeSignature(project.manifest.routes);\n\n // Watch user inputs and regenerate the runtime data on change. A body edit\n // hot-reloads via Vite (fast path). A route-set change also needs Astro's\n // content store re-synced: its glob watcher misses directory renames, so a\n // renamed page would 404 (`getEntry` reads a stale store). Astro hands the\n // integration `refreshContent` for exactly that — a full loader run\n // against the live server, after which Astro's own store watcher clears\n // the route cache and reloads the browser. Only a server that registered\n // no refresh (none since Astro 5) falls back to a cold restart: stop,\n // then bring up a fresh container whose cold sync re-globs everything.\n // perfect-debounce both debounces the watch burst (80ms) and\n // single-flights the scan: a\n // trigger during a run never starts a second run, only marks one trailing\n // rerun after the current settles. Both halves are load-bearing — a plain\n // debounce once let bursts stack overlapping scans until the heap was\n // exhausted (observed as an OOM after minutes of looping). The contract is\n // pinned by test/dev-debounce.test.ts. The task must not reject (the\n // library re-invokes it from an unhandled .finally), so the body catches\n // its own errors and always resolves.\n const regenerate = debounce(async () => {\n try {\n const next = await scanProject(root, {\n devServerUrl,\n mode: \"dev\",\n overrides,\n preview,\n });\n const nextSignature = routeSignature(next.manifest.routes);\n const structural = nextSignature !== lastSignature;\n // Generate first: the new runtime data (and any staged remote content)\n // is on disk and published before the store re-syncs against it.\n await generateRuntime(next);\n if (structural && !(await refreshBlumeContent())) {\n await server.stop();\n server = await createServer(boundPort, false);\n }\n // Commit the signature only after the (re)generation succeeded. If the\n // re-sync or restart above throws mid-sequence, the signature stays\n // stale so the next watch event retries the structural path.\n lastSignature = nextSignature;\n // Surface any content/config errors in the terminal AND the browser\n // overlay. The terminal report is not redundant: the overlay only\n // shows once the browser has connected, and it clears on the next HMR\n // update.\n reportDiagnostics(next.diagnostics, root);\n showBlumeErrorOverlay(next.diagnostics);\n } catch (error) {\n // SAFETY: regeneration failures come from the generator and Astro's\n // server API, which raise Error instances; only the message is shown.\n logger.error(`Regeneration failed: ${(error as Error).message}`);\n }\n }, 80);\n\n // The runtime prepared above baked the *requested* port into the site\n // fallback; if Vite bumped it, regenerate so OG images, canonicals, and\n // other site-gated URLs point at the port actually serving.\n if (boundPort !== port) {\n void regenerate();\n }\n\n // Content is watched per source (filesystem uses fs.watch; remote sources\n // are frozen for the session). The remaining project inputs — user pages,\n // config, theme, and component overrides — are watched directly.\n const dirTargets = [project.context.pagesRoot].filter(\n (target) => target !== null\n );\n const fileTargets = [\n project.context.configFile,\n project.context.themeFile,\n project.context.componentsFile,\n ].filter((target) => target !== null);\n\n // chokidar handles what raw fs.watch made us hand-roll: recursive\n // directory watching on every platform, and single files surviving a\n // rename-replace save (vim and most \"atomic save\" editors), which orphans\n // an inode-tracking fs.watch watcher after the first write.\n const projectWatcher = watch([...dirTargets, ...fileTargets], {\n ignoreInitial: true,\n }).on(\"all\", regenerate);\n const disposers = [\n ...project.sources.map((source) => source.watch?.(regenerate)),\n () => {\n void projectWatcher.close();\n },\n ].filter((dispose) => dispose !== undefined);\n\n const shutdown = async () => {\n for (const dispose of disposers) {\n dispose();\n }\n releaseLock();\n await server.stop();\n process.exit(0);\n };\n\n process.on(\"SIGINT\", shutdown);\n process.on(\"SIGTERM\", shutdown);\n },\n});\n"
6
- ],
7
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AA2BA,IAAM,iBAAiB,CACrB,WAEA,OACG,IAAI,CAAC,UAAU,GAAG,MAAM,QAAQ,MAAM,SAAS,EAC/C,SAAS,EACT,KAAK;AAAA,CAAI;AAEP,IAAM,aAAa,cAAc;AAAA,EACtC,MAAM;AAAA,IACJ,eAAe;AAAA,MACb,aAAa;AAAA,MACb,MAAM;AAAA,IACR;A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;AAAA,IAClB,EAAE,OAAO,CAAC,WAAW,WAAW,IAAI;AAAA,IAMpC,MAAM,iBAAiB,MAAM,CAAC,GAAG,YAAY,GAAG,WAAW,GAAG;AAAA,MAC5D,eAAe;AAAA,IACjB,CAAC,EAAE,GAAG,OAAO,UAAU;AAAA,IACvB,MAAM,YAAY;AAAA,MAChB,GAAG,QAAQ,QAAQ,IAAI,CAAC,WAAW,OAAO,QAAQ,UAAU,CAAC;AAAA,MAC7D,MAAM;AAAA,QACC,eAAe,MAAM;AAAA;AAAA,IAE9B,EAAE,OAAO,CAAC,YAAY,YAAY,SAAS;AAAA,IAE3C,MAAM,WAAW,YAAY;AAAA,MAC3B,WAAW,WAAW,WAAW;AAAA,QAC/B,QAAQ;AAAA,MACV;AAAA,MACA,YAAY;AAAA,MACZ,MAAM,OAAO,KAAK;AAAA,MAClB,QAAQ,KAAK,CAAC;AAAA;AAAA,IAGhB,QAAQ,GAAG,UAAU,QAAQ;AAAA,IAC7B,QAAQ,GAAG,WAAW,QAAQ;AAAA;AAElC,CAAC;",
8
- "debugId": "C55DCF2DA51757BB64756E2164756E21",
9
- "names": []
10
- }
@@ -1,11 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/core/site-url.ts", "../src/ai/mcp/tools.ts"],
4
- "sourcesContent": [
5
- "import { joinURL } from \"ufo\";\n\nimport { trimEnd } from \"./trim.ts\";\n\n/**\n * Absolute-URL building for the configured `deployment.site`, shared by every\n * emitter that prints site URLs (sitemap, RSS, robots, llms.txt, the MCP and\n * agent-discovery documents). One implementation replaces eight per-file\n * copies that had drifted across three different trailing-slash treatments.\n *\n * Deliberately not `new URL(path, site)`: a root-absolute path would drop the\n * base path of a subpath deployment (`acme.com/docs`). ufo's `joinURL` joins\n * without that footgun; the site is first trimmed with the ReDoS-safe\n * `trimEnd` loop so even a malformed `site` with piled-up trailing slashes\n * joins cleanly.\n */\n\n/** The configured site with any trailing slashes dropped. */\nexport const siteRoot = (site: string): string => trimEnd(site, \"/\");\n\n/** `site` + root-absolute `path` (already carrying any deployment base). */\nexport const absoluteUrl = (site: string, path: string): string => {\n const root = siteRoot(site);\n // joinURL folds a lone \"/\" away entirely; the homepage keeps its slash\n // (`https://example.com/`), matching what every emitter always printed.\n return path === \"/\" ? `${root}/` : joinURL(root, path);\n};\n",
6
- "/**\n * Static metadata for the MCP tools Blume exposes. Shared by the server (which\n * pairs each entry with a Zod input schema and handler) and the `.well-known`\n * discovery documents, so tool names and descriptions never drift between the\n * live server and its advertised capabilities.\n */\n\n/** A read-only, non-mutating tool hint set (every Blume tool is read-only). */\nconst READ_ONLY = { openWorldHint: false, readOnlyHint: true } as const;\n\nexport interface McpToolMeta {\n annotations: { openWorldHint: boolean; readOnlyHint: boolean };\n description: string;\n name: string;\n title: string;\n}\n\nexport const MCP_TOOLS: McpToolMeta[] = [\n {\n annotations: READ_ONLY,\n description:\n 'Full-text search across the documentation. Returns matching pages with their title, route, content type, and a short excerpt; pass `contentTypes` to search only pages of certain types (e.g. `rfc`, `changelog`), `filters` to require facet values the site declares per type (e.g. `{\"status\": \"enforced\"}`), and `locale` to search one language. On a versioned site results default to the current docs — pass `version` to search an archived version (e.g. `\"v1.0\"`) or `\"all\"` for every version. Use this first to discover relevant pages, then `get_page` to read one in full.',\n name: \"search_docs\",\n title: \"Search documentation\",\n },\n {\n annotations: READ_ONLY,\n description:\n \"Fetch a single documentation page as agent-optimized Markdown (frontmatter included, components downleveled to plain Markdown). Pass a route from `search_docs` or `list_pages`, e.g. `/guides/install`.\",\n name: \"get_page\",\n title: \"Get page Markdown\",\n },\n {\n annotations: READ_ONLY,\n description:\n 'List every documentation page with its route, title, description, content type, and any declared facet values; pass `contentTypes`, `filters`, and/or `locale` to narrow the list. On a versioned site the list defaults to the current docs — pass `version` for an archived version or `\"all\"`. Useful for enumerating the docs, discovering the types and facets in use, or finding a page when search is too narrow.',\n name: \"list_pages\",\n title: \"List pages\",\n },\n {\n annotations: READ_ONLY,\n description:\n \"Return the documentation navigation tree (header tabs and the sidebar hierarchy), reflecting how the docs are organized for readers. Pass `locale` for a language's tree and, on a versioned site, `version` for an archived snapshot's tree.\",\n name: \"get_navigation\",\n title: \"Get navigation\",\n },\n];\n"
7
- ],
8
- "mappings": ";;;;;;AAAA;AAkBO,IAAM,WAAW,CAAC,SAAyB,QAAQ,MAAM,GAAG;AAG5D,IAAM,cAAc,CAAC,MAAc,SAAyB;AAAA,EACjE,MAAM,OAAO,SAAS,IAAI;AAAA,EAG1B,OAAO,SAAS,MAAM,GAAG,UAAU,QAAQ,MAAM,IAAI;AAAA;;;ACjBvD,IAAM,YAAY,EAAE,eAAe,OAAO,cAAc,KAAK;AAStD,IAAM,YAA2B;AAAA,EACtC;AAAA,IACE,aAAa;AAAA,IACb,aACE;AAAA,IACF,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,aAAa;AAAA,IACb,aACE;AAAA,IACF,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,aAAa;AAAA,IACb,aACE;AAAA,IACF,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,aAAa;AAAA,IACb,aACE;AAAA,IACF,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AACF;",
9
- "debugId": "3DB06DF8543389A264756E2164756E21",
10
- "names": []
11
- }
@@ -1,107 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- scanProject
4
- } from "./chunk-1jefwnfs.js";
5
- import {
6
- generateRuntime
7
- } from "./chunk-k79xp7av.js";
8
- import {
9
- loadEnvFiles,
10
- reportInternalError,
11
- BlumeError,
12
- hasErrors,
13
- logger,
14
- reportDiagnostics
15
- } from "./index.js";
16
- import {
17
- resolveAskBackend
18
- } from "./chunk-ps4m1xh4.js";
19
- import {
20
- serverFeatures
21
- } from "./chunk-garjf5z9.js";
22
-
23
- // src/cli/required-secrets.ts
24
- var checkRequiredSecrets = (config) => {
25
- const diagnostics = [];
26
- const requireSecret = (feature, env, note) => {
27
- if (process.env[env]) {
28
- return;
29
- }
30
- const noteSuffix = note ? ` (${note})` : "";
31
- diagnostics.push({
32
- code: "BLUME_MISSING_SECRET",
33
- message: `${feature} is enabled but ${env} is not set${noteSuffix}.`,
34
- severity: "warning",
35
- suggestion: `Set ${env} in .env.local for local dev, or in your host's environment for production.`
36
- });
37
- };
38
- if (config.ai.ask?.enabled && !config.ai.ask.endpoint) {
39
- const backend = resolveAskBackend(config.ai.ask);
40
- if (backend.kind === "gateway") {
41
- requireSecret("Ask AI (AI Gateway)", "AI_GATEWAY_API_KEY", "on Vercel the gateway can also authenticate via OIDC");
42
- } else {
43
- requireSecret("Ask AI", backend.apiKeyEnv);
44
- }
45
- }
46
- if (config.search.provider === "mixedbread") {
47
- requireSecret("Mixedbread search", "MIXEDBREAD_API_KEY");
48
- }
49
- return diagnostics;
50
- };
51
-
52
- // src/cli/prepare.ts
53
- var prepareProject = async (options) => {
54
- loadEnvFiles(options.root);
55
- let project;
56
- try {
57
- project = await scanProject(options.root, {
58
- devServerUrl: options.devServerUrl,
59
- mode: options.mode,
60
- overrides: options.overrides,
61
- preview: options.preview,
62
- refresh: options.refresh,
63
- runtimeDir: options.runtimeDir
64
- });
65
- } catch (error) {
66
- if (error instanceof BlumeError) {
67
- reportDiagnostics([error.diagnostic], options.root);
68
- } else {
69
- reportInternalError(error);
70
- }
71
- process.exit(1);
72
- }
73
- if (options.mode === "build" && project.config.deployment.output === "static") {
74
- const features = serverFeatures(project.config);
75
- if (features.length > 0) {
76
- reportDiagnostics([
77
- {
78
- code: "BLUME_SERVER_FEATURE_REQUIRED",
79
- message: `${features.join(", ")} require server output, but deployment.output is "static".`,
80
- severity: "error",
81
- suggestion: 'Set deployment: { output: "server", adapter: "vercel" } in blume.config.ts.'
82
- }
83
- ], options.root);
84
- process.exit(1);
85
- }
86
- }
87
- const hadErrors = reportDiagnostics(project.diagnostics, options.root);
88
- const dropped = project.droppedPages > 0 ? `${project.droppedPages} page(s) failed frontmatter validation and were dropped from the site. ` : "";
89
- if (hadErrors && options.strict) {
90
- logger.error(`Aborting due to errors. ${dropped}Fix the diagnostics above, or pass --no-strict to continue despite them.`);
91
- process.exit(1);
92
- }
93
- if (hasErrors(project.diagnostics) && !options.strict) {
94
- logger.warn(`Continuing despite errors. ${dropped}Use --strict to fail instead.`);
95
- }
96
- const { warnings } = await generateRuntime(project);
97
- for (const warning of warnings) {
98
- logger.warn(warning);
99
- }
100
- reportDiagnostics(checkRequiredSecrets(project.config), options.root);
101
- return project;
102
- };
103
-
104
- export { prepareProject };
105
-
106
- //# debugId=D880E559CA8C83D564756E2164756E21
107
- //# sourceMappingURL=chunk-esphfr8p.js.map
@@ -1,11 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/cli/required-secrets.ts", "../src/cli/prepare.ts"],
4
- "sourcesContent": [
5
- "import { resolveAskBackend } from \"../ai/ask.ts\";\nimport type { ResolvedConfig } from \"../core/schema.ts\";\nimport type { Diagnostic } from \"../core/types.ts\";\n\n/**\n * Warn early when an enabled feature needs a secret env var that isn't set, so\n * the failure surfaces at `blume dev`/`build` instead of at the first request in\n * production. These are runtime secrets (the endpoint reads them on the server),\n * so this warns rather than hard-fails — the value may live only in the deploy\n * environment. Build-time secrets (search-index sync) already warn during sync.\n */\nexport const checkRequiredSecrets = (config: ResolvedConfig): Diagnostic[] => {\n const diagnostics: Diagnostic[] = [];\n const requireSecret = (feature: string, env: string, note?: string): void => {\n if (process.env[env]) {\n return;\n }\n const noteSuffix = note ? ` (${note})` : \"\";\n diagnostics.push({\n code: \"BLUME_MISSING_SECRET\",\n message: `${feature} is enabled but ${env} is not set${noteSuffix}.`,\n severity: \"warning\",\n suggestion: `Set ${env} in .env.local for local dev, or in your host's environment for production.`,\n });\n };\n\n if (config.ai.ask?.enabled && !config.ai.ask.endpoint) {\n const backend = resolveAskBackend(config.ai.ask);\n if (backend.kind === \"gateway\") {\n requireSecret(\n \"Ask AI (AI Gateway)\",\n \"AI_GATEWAY_API_KEY\",\n \"on Vercel the gateway can also authenticate via OIDC\"\n );\n } else {\n requireSecret(\"Ask AI\", backend.apiKeyEnv);\n }\n }\n\n if (config.search.provider === \"mixedbread\") {\n requireSecret(\"Mixedbread search\", \"MIXEDBREAD_API_KEY\");\n }\n\n return diagnostics;\n};\n",
6
- "import { generateRuntime } from \"../astro/generate.ts\";\nimport { BlumeError, hasErrors } from \"../core/diagnostics.ts\";\nimport { scanProject } from \"../core/project-graph.ts\";\nimport type {\n BlumeProject,\n BuildMode,\n ConfigOverrides,\n} from \"../core/project-graph.ts\";\nimport { serverFeatures } from \"../core/server-features.ts\";\nimport { loadEnvFiles } from \"./env.ts\";\nimport { reportInternalError } from \"./internal-error.ts\";\nimport { logger, reportDiagnostics } from \"./log.ts\";\nimport { checkRequiredSecrets } from \"./required-secrets.ts\";\n\nexport interface PrepareOptions {\n root: string;\n mode?: BuildMode;\n strict?: boolean;\n /** Local dev server URL, used as the `deployment.site` fallback (dev only). */\n devServerUrl?: string;\n /** Render drafts and fetch unpublished CMS content. */\n preview?: boolean;\n /** Force remote sources to re-fetch instead of serving the cached snapshot. */\n refresh?: boolean;\n /** CLI config overrides (e.g. `--output`, `--content-dir`). */\n overrides?: ConfigOverrides;\n /** Relocate the generated runtime (e.g. `.blume-verify` for `--isolated`). */\n runtimeDir?: string;\n}\n\n/**\n * Scan the project, surface diagnostics, and (re)generate the `.blume` runtime.\n * In strict mode, any error aborts. Returns the resolved project.\n */\nexport const prepareProject = async (\n options: PrepareOptions\n): Promise<BlumeProject> => {\n // Load `.env` files from the project root before the scan: remote sources\n // read their tokens from `process.env` during `scanProject`, and\n // `loadEnvFiles` never overrides variables that are already set.\n loadEnvFiles(options.root);\n\n let project: BlumeProject;\n try {\n project = await scanProject(options.root, {\n devServerUrl: options.devServerUrl,\n mode: options.mode,\n overrides: options.overrides,\n preview: options.preview,\n refresh: options.refresh,\n runtimeDir: options.runtimeDir,\n });\n } catch (error) {\n if (error instanceof BlumeError) {\n reportDiagnostics([error.diagnostic], options.root);\n } else {\n reportInternalError(error);\n }\n process.exit(1);\n }\n\n // Hard gate: server-only features cannot ship in a static build.\n if (\n options.mode === \"build\" &&\n project.config.deployment.output === \"static\"\n ) {\n const features = serverFeatures(project.config);\n if (features.length > 0) {\n reportDiagnostics(\n [\n {\n code: \"BLUME_SERVER_FEATURE_REQUIRED\",\n message: `${features.join(\", \")} require server output, but deployment.output is \"static\".`,\n severity: \"error\",\n suggestion:\n 'Set deployment: { output: \"server\", adapter: \"vercel\" } in blume.config.ts.',\n },\n ],\n options.root\n );\n process.exit(1);\n }\n }\n\n const hadErrors = reportDiagnostics(project.diagnostics, options.root);\n const dropped =\n project.droppedPages > 0\n ? `${project.droppedPages} page(s) failed frontmatter validation and were dropped from the site. `\n : \"\";\n if (hadErrors && options.strict) {\n logger.error(\n `Aborting due to errors. ${dropped}Fix the diagnostics above, or pass --no-strict to continue despite them.`\n );\n process.exit(1);\n }\n if (hasErrors(project.diagnostics) && !options.strict) {\n logger.warn(\n `Continuing despite errors. ${dropped}Use --strict to fail instead.`\n );\n }\n\n const { warnings } = await generateRuntime(project);\n for (const warning of warnings) {\n logger.warn(warning);\n }\n\n // Fail-fast on missing runtime secrets: warn now, not at the first request.\n reportDiagnostics(checkRequiredSecrets(project.config), options.root);\n\n return project;\n};\n"
7
- ],
8
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAWO,IAAM,uBAAuB,CAAC,WAAyC;AAAA,EAC5E,MAAM,cAA4B,CAAC;AAAA,EACnC,MAAM,gBAAgB,CAAC,SAAiB,KAAa,SAAwB;AAAA,IAC3E,IAAI,QAAQ,IAAI,MAAM;AAAA,MACpB;AAAA,IACF;AAAA,IACA,MAAM,aAAa,OAAO,KAAK,UAAU;AAAA,IACzC,YAAY,KAAK;AAAA,MACf,MAAM;AAAA,MACN,SAAS,GAAG,0BAA0B,iBAAiB;AAAA,MACvD,UAAU;AAAA,MACV,YAAY,OAAO;AAAA,IACrB,CAAC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