blume 2.0.0 → 2.0.2

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 (454) hide show
  1. package/AGENTS.md +1 -1
  2. package/CHANGELOG.md +110 -0
  3. package/README.md +2 -2
  4. package/dist/cli/{chunk-f2972sbt.js → chunk-00gs3wqs.js} +1 -1
  5. package/dist/cli/{chunk-fa25z98p.js → chunk-273ygyr4.js} +4 -3
  6. package/dist/cli/chunk-273ygyr4.js.map +11 -0
  7. package/dist/cli/{chunk-pat2zzwc.js → chunk-3yce002v.js} +21 -8
  8. package/dist/cli/{chunk-pat2zzwc.js.map → chunk-3yce002v.js.map} +4 -4
  9. package/dist/cli/{chunk-d1tadaw7.js → chunk-4e9b9ra6.js} +17 -7
  10. package/dist/cli/chunk-4e9b9ra6.js.map +10 -0
  11. package/dist/cli/{chunk-zg2gtj10.js → chunk-5r8g91qn.js} +352 -676
  12. package/dist/cli/chunk-5r8g91qn.js.map +34 -0
  13. package/dist/cli/{chunk-11j0384y.js → chunk-6dtt0zfn.js} +14 -14
  14. package/dist/cli/{chunk-11j0384y.js.map → chunk-6dtt0zfn.js.map} +3 -3
  15. package/dist/cli/{chunk-bw22s759.js → chunk-6k4ftwze.js} +38 -19
  16. package/dist/cli/{chunk-bw22s759.js.map → chunk-6k4ftwze.js.map} +4 -4
  17. package/dist/cli/{chunk-sqn5t4q0.js → chunk-7mbqtmgb.js} +16 -7
  18. package/dist/cli/chunk-7mbqtmgb.js.map +10 -0
  19. package/dist/cli/{chunk-79njf86q.js → chunk-7vtckvaw.js} +21 -19
  20. package/dist/cli/chunk-7vtckvaw.js.map +11 -0
  21. package/dist/cli/{chunk-fh5hj5jt.js → chunk-8g8ytmgx.js} +17 -18
  22. package/dist/cli/{chunk-fh5hj5jt.js.map → chunk-8g8ytmgx.js.map} +2 -2
  23. package/dist/cli/{chunk-1w8dp3qb.js → chunk-91ws1n6j.js} +18 -15
  24. package/dist/cli/chunk-91ws1n6j.js.map +10 -0
  25. package/dist/cli/{chunk-7ez8ny0t.js → chunk-bbnwccaz.js} +2 -2
  26. package/dist/cli/{chunk-5a2z0198.js → chunk-bfwp9vp6.js} +18 -10
  27. package/dist/cli/chunk-bfwp9vp6.js.map +10 -0
  28. package/dist/cli/{chunk-ernrthtr.js → chunk-d1v5rhy0.js} +14 -15
  29. package/dist/cli/{chunk-ernrthtr.js.map → chunk-d1v5rhy0.js.map} +2 -2
  30. package/dist/cli/{chunk-a9kptbw5.js → chunk-ddndchfr.js} +21 -6
  31. package/dist/cli/chunk-ddndchfr.js.map +14 -0
  32. package/dist/cli/{chunk-zxccj738.js → chunk-esh98wmb.js} +1 -1
  33. package/dist/cli/{chunk-88cpgt6h.js → chunk-fsmrqk8a.js} +1 -1
  34. package/dist/cli/{chunk-b5aj94ah.js → chunk-g698a744.js} +5 -5
  35. package/dist/cli/{chunk-jts8mvcz.js → chunk-gs7r695n.js} +9 -3
  36. package/dist/cli/{chunk-jts8mvcz.js.map → chunk-gs7r695n.js.map} +3 -3
  37. package/dist/cli/{chunk-41za066z.js → chunk-h2ez8dzb.js} +4 -4
  38. package/dist/cli/{chunk-by2290sx.js → chunk-h7k3nq3v.js} +2 -2
  39. package/dist/cli/{chunk-j8mw0za6.js → chunk-hqp2ajnh.js} +252 -123
  40. package/dist/cli/chunk-hqp2ajnh.js.map +35 -0
  41. package/dist/cli/{chunk-mnqj32sj.js → chunk-hr8ne106.js} +119 -50
  42. package/dist/cli/chunk-hr8ne106.js.map +13 -0
  43. package/dist/cli/{chunk-mwt1k8n7.js → chunk-j85scx15.js} +74 -30
  44. package/dist/cli/chunk-j85scx15.js.map +10 -0
  45. package/dist/cli/{chunk-z01ze5c1.js → chunk-k7pj68a8.js} +63 -22
  46. package/dist/cli/chunk-k7pj68a8.js.map +11 -0
  47. package/dist/cli/{chunk-2q1dwty4.js → chunk-mqc662a6.js} +8 -8
  48. package/dist/cli/{chunk-2q1dwty4.js.map → chunk-mqc662a6.js.map} +4 -4
  49. package/dist/cli/{chunk-y3e45rc8.js → chunk-n1yg3tj3.js} +4 -4
  50. package/dist/cli/{chunk-bctazmbk.js → chunk-nfcyttvj.js} +17 -6
  51. package/dist/cli/chunk-nfcyttvj.js.map +10 -0
  52. package/dist/cli/{chunk-6k8vp3ta.js → chunk-pbg5a4s3.js} +60 -28
  53. package/dist/cli/chunk-pbg5a4s3.js.map +19 -0
  54. package/dist/cli/{chunk-d80hr03s.js → chunk-ppzjqwx2.js} +24 -17
  55. package/dist/cli/{chunk-d80hr03s.js.map → chunk-ppzjqwx2.js.map} +4 -4
  56. package/dist/cli/{chunk-beat36xx.js → chunk-qkb5a8sa.js} +25 -10
  57. package/dist/cli/chunk-qkb5a8sa.js.map +10 -0
  58. package/dist/cli/{chunk-bnbmcwfb.js → chunk-sqw4ekg1.js} +5 -5
  59. package/dist/cli/{chunk-bnbmcwfb.js.map → chunk-sqw4ekg1.js.map} +3 -3
  60. package/dist/cli/{chunk-xaz13gwg.js → chunk-v6ya5kcb.js} +3268 -1150
  61. package/dist/cli/chunk-v6ya5kcb.js.map +189 -0
  62. package/dist/cli/{chunk-tzne8qfq.js → chunk-w4bxdvsa.js} +18 -15
  63. package/dist/cli/chunk-w4bxdvsa.js.map +10 -0
  64. package/dist/cli/{chunk-f7t03s3g.js → chunk-wdrt2k2v.js} +2 -2
  65. package/dist/cli/{chunk-z1f5arsg.js → chunk-xh43dwgw.js} +170 -55
  66. package/dist/cli/chunk-xh43dwgw.js.map +36 -0
  67. package/dist/cli/{chunk-pnnvybbk.js → chunk-zp79m0ts.js} +5 -5
  68. package/dist/cli/{chunk-pnnvybbk.js.map → chunk-zp79m0ts.js.map} +2 -2
  69. package/dist/cli/index.js +160 -35
  70. package/dist/cli/index.js.map +4 -4
  71. package/dist/types/ai/agent-readability.d.ts +1 -1
  72. package/dist/types/ai/agent-surface.d.ts +32 -0
  73. package/dist/types/ai/api/paths.d.ts +1 -1
  74. package/dist/types/ai/api-catalog.d.ts +7 -1
  75. package/dist/types/ai/ask-context.d.ts +14 -7
  76. package/dist/types/ai/ask.d.ts +43 -43
  77. package/dist/types/ai/component-markdown.d.ts +4 -4
  78. package/dist/types/ai/index.d.ts +3 -3
  79. package/dist/types/ai/openapi-components.d.ts +1 -1
  80. package/dist/types/ai/relative-links.d.ts +9 -4
  81. package/dist/types/ai/serializers.d.ts +1 -1
  82. package/dist/types/ai/static-expression.d.ts +28 -0
  83. package/dist/types/ai/visibility.d.ts +1 -1
  84. package/dist/types/analytics/databuddy.d.ts +43 -0
  85. package/dist/types/analytics/index.d.ts +2 -0
  86. package/dist/types/analytics/schema.d.ts +14 -0
  87. package/dist/types/cli/env.d.ts +5 -0
  88. package/dist/types/cli/init/scaffold.d.ts +19 -3
  89. package/dist/types/cli/init/starter-spec.d.ts +11 -0
  90. package/dist/types/core/base-path.d.ts +9 -0
  91. package/dist/types/core/config-input.d.ts +21 -21
  92. package/dist/types/core/config.d.ts +5 -5
  93. package/dist/types/core/data.d.ts +3 -3
  94. package/dist/types/core/graph.d.ts +2 -0
  95. package/dist/types/core/i18n-ui.d.ts +37 -8
  96. package/dist/types/core/i18n.d.ts +7 -1
  97. package/dist/types/core/links.d.ts +3 -1
  98. package/dist/types/core/load-module.d.ts +10 -0
  99. package/dist/types/core/locale-links.d.ts +12 -2
  100. package/dist/types/core/meta.d.ts +5 -1
  101. package/dist/types/core/nav-diagnostics.d.ts +10 -0
  102. package/dist/types/core/navigation.d.ts +38 -0
  103. package/dist/types/core/ordering-prefix.d.ts +4 -0
  104. package/dist/types/core/safe-links.d.ts +3 -1
  105. package/dist/types/core/schema.d.ts +57 -18
  106. package/dist/types/core/sources/github-releases.d.ts +5 -0
  107. package/dist/types/core/sources/lower.d.ts +14 -2
  108. package/dist/types/core/sources/normalize.d.ts +10 -1
  109. package/dist/types/core/sources/remote.d.ts +11 -1
  110. package/dist/types/core/sources/resolve.d.ts +12 -0
  111. package/dist/types/core/sources/types.d.ts +31 -0
  112. package/dist/types/core/types.d.ts +9 -0
  113. package/dist/types/core/unrecognized-keys.d.ts +1 -1
  114. package/dist/types/deploy/adapters/node.d.ts +5 -2
  115. package/dist/types/deploy/adapters/types.d.ts +7 -0
  116. package/dist/types/deploy/cloudflare-negotiation.d.ts +3 -2
  117. package/dist/types/deploy/headers.d.ts +31 -7
  118. package/dist/types/deploy/node-headers.d.ts +43 -8
  119. package/dist/types/deploy/platforms/netlify.d.ts +27 -2
  120. package/dist/types/deploy/platforms/node.d.ts +6 -5
  121. package/dist/types/deploy/platforms/types.d.ts +7 -0
  122. package/dist/types/deploy/platforms/vercel.d.ts +3 -2
  123. package/dist/types/deploy/redirects.d.ts +7 -2
  124. package/dist/types/deploy/vercel-negotiation.d.ts +3 -2
  125. package/dist/types/openapi/model.d.ts +20 -6
  126. package/dist/types/search/documents.d.ts +1 -1
  127. package/dist/types/search/orama-index.d.ts +1 -1
  128. package/dist/types/search/sync/algolia.d.ts +3 -1
  129. package/docs/01-quickstart.mdx +3 -2
  130. package/docs/02-deployment.mdx +21 -12
  131. package/docs/03-upgrading.mdx +22 -9
  132. package/docs/04-migrating.mdx +4 -4
  133. package/docs/08-faq.mdx +12 -5
  134. package/docs/advanced/changelog.mdx +1 -1
  135. package/docs/advanced/custom-pages.mdx +5 -3
  136. package/docs/advanced/skills.mdx +1 -1
  137. package/docs/cli/audit.mdx +5 -5
  138. package/docs/cli/doctor.mdx +4 -4
  139. package/docs/cli/evals.mdx +9 -9
  140. package/docs/cli/index.mdx +6 -3
  141. package/docs/cli/translate.mdx +8 -8
  142. package/docs/configuration/analytics.mdx +23 -2
  143. package/docs/configuration/{ask-ai.mdx → assistant.mdx} +20 -20
  144. package/docs/configuration/customization.mdx +5 -4
  145. package/docs/configuration/index.mdx +7 -5
  146. package/docs/configuration/meta.ts +1 -1
  147. package/docs/configuration/search.mdx +2 -2
  148. package/docs/content/components.mdx +1 -1
  149. package/docs/content/frontmatter.mdx +5 -1
  150. package/docs/content/i18n.mdx +3 -3
  151. package/docs/content/index.mdx +4 -2
  152. package/docs/content/islands.mdx +1 -1
  153. package/docs/content/meta.mdx +5 -3
  154. package/docs/content/navigation.mdx +29 -4
  155. package/docs/content/sources.mdx +18 -12
  156. package/docs/content/versioning.mdx +1 -0
  157. package/docs/discoverability/agent-discovery.mdx +22 -8
  158. package/docs/discoverability/index.mdx +3 -3
  159. package/docs/discoverability/llms-txt.mdx +2 -5
  160. package/docs/discoverability/markdown.mdx +5 -3
  161. package/docs/discoverability/mcp.mdx +4 -0
  162. package/docs/discoverability/metadata.mdx +3 -2
  163. package/docs/discoverability/open-graph.mdx +6 -4
  164. package/docs/discoverability/rss.mdx +3 -1
  165. package/docs/index.mdx +2 -2
  166. package/docs/references/asyncapi.mdx +1 -1
  167. package/docs/references/graphql.mdx +2 -2
  168. package/docs/references/openapi.mdx +3 -3
  169. package/package.json +1 -1
  170. package/skills/blume/SKILL.md +5 -5
  171. package/skills/blume-migrate/SKILL.md +6 -6
  172. package/skills/blume-migrate/references/docusaurus.md +6 -6
  173. package/skills/blume-migrate/references/mintlify.md +3 -3
  174. package/skills/blume-migrate/references/monorepo.md +1 -1
  175. package/skills/blume-migrate/references/nextra.md +1 -1
  176. package/skills/blume-migrate/references/starlight.md +5 -5
  177. package/skills/blume-migrate/scripts/mintlify-codemod.mjs +2 -2
  178. package/skills/blume-update-docs/references/audit-checklist.md +1 -1
  179. package/src/ai/agent-readability.ts +4 -4
  180. package/src/ai/agent-surface.ts +56 -0
  181. package/src/ai/api/paths.ts +1 -1
  182. package/src/ai/api/spec.ts +15 -2
  183. package/src/ai/api-catalog.ts +7 -1
  184. package/src/ai/ask-context.ts +21 -9
  185. package/src/ai/ask-data.ts +28 -14
  186. package/src/ai/ask.ts +84 -71
  187. package/src/ai/component-markdown.ts +43 -37
  188. package/src/ai/cors.ts +3 -3
  189. package/src/ai/index.ts +16 -16
  190. package/src/ai/link-headers.ts +8 -3
  191. package/src/ai/llms.ts +4 -3
  192. package/src/ai/markdown.ts +23 -11
  193. package/src/ai/mcp/server.ts +78 -7
  194. package/src/ai/openapi-components.ts +1 -1
  195. package/src/ai/relative-links.ts +78 -10
  196. package/src/ai/serializers.ts +1 -1
  197. package/src/ai/static-expression.ts +416 -0
  198. package/src/ai/visibility.ts +46 -15
  199. package/src/analytics/databuddy.ts +67 -0
  200. package/src/analytics/head.ts +4 -0
  201. package/src/analytics/index.ts +2 -0
  202. package/src/analytics/posthog.ts +21 -3
  203. package/src/analytics/schema.ts +2 -0
  204. package/src/astro/generate.ts +90 -45
  205. package/src/astro/module-types.ts +1 -1
  206. package/src/astro/runtime-deps.ts +6 -6
  207. package/src/astro/templates.ts +87 -49
  208. package/src/audit/catalog.ts +2 -2
  209. package/src/audit/checks/assets.ts +25 -5
  210. package/src/audit/checks/content.ts +20 -2
  211. package/src/audit/checks/i18n.ts +46 -8
  212. package/src/audit/checks/indexability.ts +39 -19
  213. package/src/audit/checks/links.ts +14 -0
  214. package/src/audit/checks/llms.ts +6 -3
  215. package/src/audit/checks/network.ts +3 -1
  216. package/src/audit/checks/og-image.ts +10 -0
  217. package/src/audit/checks/robots.ts +6 -1
  218. package/src/audit/checks/sitemap.ts +56 -31
  219. package/src/audit/checks/social.ts +21 -2
  220. package/src/audit/crawl.ts +88 -15
  221. package/src/audit/report.ts +54 -17
  222. package/src/audit/run.ts +1 -0
  223. package/src/audit/types.ts +18 -0
  224. package/src/audit/url.ts +37 -6
  225. package/src/blume-modules.d.ts +2 -2
  226. package/src/cli/build-failure.ts +50 -0
  227. package/src/cli/commands/audit.ts +8 -1
  228. package/src/cli/commands/build.ts +19 -5
  229. package/src/cli/commands/check.ts +2 -0
  230. package/src/cli/commands/doctor.ts +7 -5
  231. package/src/cli/commands/eval.ts +4 -10
  232. package/src/cli/commands/init.ts +15 -5
  233. package/src/cli/commands/migrate.ts +2 -2
  234. package/src/cli/commands/preview.ts +15 -0
  235. package/src/cli/commands/sync.ts +2 -0
  236. package/src/cli/commands/translate.ts +12 -9
  237. package/src/cli/commands/upgrade.ts +13 -2
  238. package/src/cli/eject-scripts.ts +32 -7
  239. package/src/cli/env.ts +12 -1
  240. package/src/cli/init/scaffold.ts +117 -11
  241. package/src/cli/init/starter-spec.ts +235 -0
  242. package/src/cli/required-secrets.ts +3 -3
  243. package/src/components/content/AccordionItem.astro +26 -22
  244. package/src/components/content/Badge.astro +2 -9
  245. package/src/components/content/Card.astro +2 -2
  246. package/src/components/content/Component.astro +9 -3
  247. package/src/components/content/Expandable.astro +5 -1
  248. package/src/components/content/Frame.astro +2 -7
  249. package/src/components/content/GithubInfo.astro +12 -2
  250. package/src/components/content/Prompt.astro +2 -7
  251. package/src/components/content/Tabs.astro +54 -5
  252. package/src/components/content/Tile.astro +1 -1
  253. package/src/components/content/Tooltip.astro +69 -7
  254. package/src/components/content/Tree.astro +7 -2
  255. package/src/components/content/TypeTable.astro +10 -5
  256. package/src/components/content/Update.astro +8 -2
  257. package/src/components/content/auto-type-table.ts +4 -1
  258. package/src/components/content/badge-color.ts +17 -0
  259. package/src/components/content/base-href.ts +18 -3
  260. package/src/components/content/inline-markdown.ts +27 -7
  261. package/src/components/copy-feedback.ts +36 -9
  262. package/src/components/islands/{AskAI.astro → Assistant.astro} +10 -10
  263. package/src/components/islands/{ask-ai.tsx → assistant.tsx} +39 -25
  264. package/src/components/islands/hooks.ts +21 -14
  265. package/src/components/islands/webmcp.ts +12 -8
  266. package/src/components/layout/Banner.astro +23 -4
  267. package/src/components/layout/Header.astro +32 -19
  268. package/src/components/layout/Logo.astro +5 -0
  269. package/src/components/layout/NavSelector.astro +6 -1
  270. package/src/components/layout/NavTabMenu.astro +133 -0
  271. package/src/components/layout/NavTree.astro +15 -6
  272. package/src/components/layout/NavTreeCache.astro +5 -2
  273. package/src/components/layout/NavTreeScript.astro +45 -5
  274. package/src/components/layout/PageLayout.astro +28 -14
  275. package/src/components/layout/Pagination.astro +7 -7
  276. package/src/components/layout/ReferenceLayout.astro +5 -2
  277. package/src/components/layout/RootLayout.astro +27 -14
  278. package/src/components/layout/Search.astro +18 -14
  279. package/src/components/layout/analytics-client.ts +3 -1
  280. package/src/components/layout/drawer-inert.ts +1 -1
  281. package/src/components/openapi/GraphqlType.astro +11 -3
  282. package/src/components/openapi/MessageComposer.astro +1 -1
  283. package/src/components/openapi/Operation.astro +21 -5
  284. package/src/components/openapi/PanelTabs.astro +4 -1
  285. package/src/components/openapi/Playground.astro +8 -2
  286. package/src/components/openapi/RequestPanel.astro +9 -5
  287. package/src/components/openapi/SchemaProperty.astro +11 -33
  288. package/src/components/openapi/SchemaTable.astro +27 -52
  289. package/src/components/openapi/description.ts +2 -2
  290. package/src/components/openapi/helpers.ts +90 -12
  291. package/src/components/openapi/message-composer.ts +8 -0
  292. package/src/components/openapi/message-model.ts +12 -2
  293. package/src/components/openapi/message.ts +4 -1
  294. package/src/components/openapi/operation-model.ts +40 -8
  295. package/src/components/openapi/panel.ts +29 -5
  296. package/src/components/openapi/playground-client.ts +37 -7
  297. package/src/components/openapi/playground-schema.ts +25 -6
  298. package/src/components/openapi/request.ts +2 -0
  299. package/src/components/openapi/schema-tree.ts +203 -0
  300. package/src/components/openapi/snippets.ts +30 -15
  301. package/src/components/openapi/validate-json.ts +1 -1
  302. package/src/core/base-path.ts +15 -0
  303. package/src/core/code-fences.ts +1 -1
  304. package/src/core/config-input.ts +23 -23
  305. package/src/core/config.ts +21 -7
  306. package/src/core/data.ts +3 -3
  307. package/src/core/diagnostics.ts +217 -30
  308. package/src/core/graph.ts +120 -11
  309. package/src/core/i18n-ui.ts +74 -11
  310. package/src/core/i18n.ts +13 -2
  311. package/src/core/links.ts +7 -4
  312. package/src/core/load-module.ts +20 -0
  313. package/src/core/locale-links.ts +17 -17
  314. package/src/core/manifest.ts +3 -2
  315. package/src/core/meta.ts +69 -6
  316. package/src/core/nav-diagnostics.ts +56 -1
  317. package/src/core/navigation.ts +245 -76
  318. package/src/core/ordering-prefix.ts +27 -0
  319. package/src/core/project-graph.ts +23 -1
  320. package/src/core/request-body.ts +1 -1
  321. package/src/core/safe-href.ts +53 -1
  322. package/src/core/safe-links.ts +11 -2
  323. package/src/core/schema.ts +95 -34
  324. package/src/core/server-features.ts +2 -2
  325. package/src/core/sources/assets.ts +83 -41
  326. package/src/core/sources/contentful-rich-text.ts +3 -2
  327. package/src/core/sources/contentful.ts +25 -12
  328. package/src/core/sources/filesystem.ts +5 -1
  329. package/src/core/sources/github-releases.ts +106 -5
  330. package/src/core/sources/lexical.ts +9 -4
  331. package/src/core/sources/lower.ts +79 -26
  332. package/src/core/sources/mdx-remote.ts +1 -0
  333. package/src/core/sources/normalize.ts +132 -30
  334. package/src/core/sources/notion.ts +26 -10
  335. package/src/core/sources/obsidian.ts +17 -3
  336. package/src/core/sources/payload.ts +1 -0
  337. package/src/core/sources/portable-text.ts +63 -44
  338. package/src/core/sources/remote.ts +18 -2
  339. package/src/core/sources/resolve.ts +52 -33
  340. package/src/core/sources/sanity.ts +1 -0
  341. package/src/core/sources/strapi-blocks.ts +9 -4
  342. package/src/core/sources/strapi.ts +1 -0
  343. package/src/core/sources/types.ts +31 -0
  344. package/src/core/types.ts +9 -0
  345. package/src/core/ui-packs/ar.ts +17 -5
  346. package/src/core/ui-packs/bg.ts +17 -5
  347. package/src/core/ui-packs/bn.ts +17 -5
  348. package/src/core/ui-packs/ca.ts +17 -5
  349. package/src/core/ui-packs/cs.ts +17 -5
  350. package/src/core/ui-packs/da.ts +17 -5
  351. package/src/core/ui-packs/de.ts +17 -5
  352. package/src/core/ui-packs/el.ts +17 -5
  353. package/src/core/ui-packs/es.ts +17 -5
  354. package/src/core/ui-packs/fa.ts +17 -5
  355. package/src/core/ui-packs/fi.ts +17 -5
  356. package/src/core/ui-packs/fr.ts +17 -5
  357. package/src/core/ui-packs/he.ts +17 -5
  358. package/src/core/ui-packs/hi.ts +17 -5
  359. package/src/core/ui-packs/hr.ts +17 -5
  360. package/src/core/ui-packs/hu.ts +17 -5
  361. package/src/core/ui-packs/id.ts +17 -5
  362. package/src/core/ui-packs/it.ts +17 -5
  363. package/src/core/ui-packs/ja.ts +17 -5
  364. package/src/core/ui-packs/ko.ts +17 -5
  365. package/src/core/ui-packs/nl.ts +17 -5
  366. package/src/core/ui-packs/no.ts +17 -5
  367. package/src/core/ui-packs/pl.ts +17 -5
  368. package/src/core/ui-packs/pt-br.ts +17 -5
  369. package/src/core/ui-packs/pt.ts +17 -5
  370. package/src/core/ui-packs/ro.ts +17 -5
  371. package/src/core/ui-packs/ru.ts +17 -5
  372. package/src/core/ui-packs/sk.ts +17 -5
  373. package/src/core/ui-packs/sr.ts +17 -5
  374. package/src/core/ui-packs/sv.ts +17 -5
  375. package/src/core/ui-packs/th.ts +17 -5
  376. package/src/core/ui-packs/tr.ts +17 -5
  377. package/src/core/ui-packs/uk.ts +17 -5
  378. package/src/core/ui-packs/vi.ts +17 -5
  379. package/src/core/ui-packs/zh-tw.ts +17 -5
  380. package/src/core/ui-packs/zh.ts +17 -5
  381. package/src/core/unrecognized-keys.ts +1 -1
  382. package/src/core/version-cut.ts +17 -2
  383. package/src/core/versions.ts +4 -1
  384. package/src/deploy/adapters/node.ts +5 -2
  385. package/src/deploy/adapters/registry.ts +2 -1
  386. package/src/deploy/adapters/types.ts +13 -1
  387. package/src/deploy/artifacts.ts +25 -5
  388. package/src/deploy/cloudflare-negotiation.ts +23 -4
  389. package/src/deploy/headers.ts +67 -51
  390. package/src/deploy/node-headers.ts +148 -27
  391. package/src/deploy/platforms/cloudflare.ts +1 -0
  392. package/src/deploy/platforms/netlify.ts +82 -5
  393. package/src/deploy/platforms/node.ts +7 -5
  394. package/src/deploy/platforms/static.ts +1 -0
  395. package/src/deploy/platforms/types.ts +7 -0
  396. package/src/deploy/platforms/vercel.ts +9 -3
  397. package/src/deploy/redirects.ts +14 -3
  398. package/src/deploy/vercel-negotiation.ts +35 -3
  399. package/src/eval/agents.ts +10 -2
  400. package/src/eval/run.ts +25 -0
  401. package/src/markdown/base-links.ts +55 -8
  402. package/src/markdown/index.ts +6 -3
  403. package/src/markdown/relative-links.ts +3 -23
  404. package/src/markdown/route-snapshot.ts +37 -0
  405. package/src/og/card.ts +20 -4
  406. package/src/og/derive.ts +145 -4
  407. package/src/openapi/graphql-build.ts +28 -2
  408. package/src/openapi/model.ts +77 -13
  409. package/src/openapi/render-mdx.ts +10 -1
  410. package/src/registry/eject.ts +135 -37
  411. package/src/search/documents.ts +24 -3
  412. package/src/search/orama-index.ts +1 -1
  413. package/src/search/sync/algolia.ts +36 -2
  414. package/src/sources/registry.ts +5 -0
  415. package/src/theme/entry.ts +11 -4
  416. package/src/translate/agents.ts +6 -1
  417. package/src/translate/ledger.ts +26 -3
  418. package/src/translate/meta.ts +11 -3
  419. package/src/translate/report.ts +1 -1
  420. package/src/translate/run.ts +11 -5
  421. package/src/translate/validate.ts +10 -1
  422. package/src/translate/work-list.ts +36 -3
  423. package/src/upgrade/upgrade.ts +37 -5
  424. package/dist/cli/chunk-1w8dp3qb.js.map +0 -10
  425. package/dist/cli/chunk-5a2z0198.js.map +0 -10
  426. package/dist/cli/chunk-6k8vp3ta.js.map +0 -19
  427. package/dist/cli/chunk-79njf86q.js.map +0 -11
  428. package/dist/cli/chunk-a9kptbw5.js.map +0 -14
  429. package/dist/cli/chunk-abh8yjkn.js +0 -31
  430. package/dist/cli/chunk-abh8yjkn.js.map +0 -10
  431. package/dist/cli/chunk-bctazmbk.js.map +0 -10
  432. package/dist/cli/chunk-beat36xx.js.map +0 -10
  433. package/dist/cli/chunk-d1tadaw7.js.map +0 -10
  434. package/dist/cli/chunk-fa25z98p.js.map +0 -11
  435. package/dist/cli/chunk-j8mw0za6.js.map +0 -35
  436. package/dist/cli/chunk-mnqj32sj.js.map +0 -12
  437. package/dist/cli/chunk-mwt1k8n7.js.map +0 -10
  438. package/dist/cli/chunk-nk3ts2xk.js +0 -51
  439. package/dist/cli/chunk-nk3ts2xk.js.map +0 -10
  440. package/dist/cli/chunk-sqn5t4q0.js.map +0 -10
  441. package/dist/cli/chunk-tzne8qfq.js.map +0 -10
  442. package/dist/cli/chunk-xaz13gwg.js.map +0 -182
  443. package/dist/cli/chunk-z01ze5c1.js.map +0 -10
  444. package/dist/cli/chunk-z1f5arsg.js.map +0 -36
  445. package/dist/cli/chunk-zg2gtj10.js.map +0 -35
  446. /package/dist/cli/{chunk-f2972sbt.js.map → chunk-00gs3wqs.js.map} +0 -0
  447. /package/dist/cli/{chunk-7ez8ny0t.js.map → chunk-bbnwccaz.js.map} +0 -0
  448. /package/dist/cli/{chunk-zxccj738.js.map → chunk-esh98wmb.js.map} +0 -0
  449. /package/dist/cli/{chunk-88cpgt6h.js.map → chunk-fsmrqk8a.js.map} +0 -0
  450. /package/dist/cli/{chunk-b5aj94ah.js.map → chunk-g698a744.js.map} +0 -0
  451. /package/dist/cli/{chunk-41za066z.js.map → chunk-h2ez8dzb.js.map} +0 -0
  452. /package/dist/cli/{chunk-by2290sx.js.map → chunk-h7k3nq3v.js.map} +0 -0
  453. /package/dist/cli/{chunk-y3e45rc8.js.map → chunk-n1yg3tj3.js.map} +0 -0
  454. /package/dist/cli/{chunk-f7t03s3g.js.map → chunk-wdrt2k2v.js.map} +0 -0
@@ -0,0 +1,19 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/cli/commands/translate.ts", "../src/translate/agents.ts", "../src/translate/ledger.ts", "../src/translate/report.ts", "../src/translate/run.ts", "../src/translate/meta.ts", "../src/translate/prompts.ts", "../src/translate/anchors.ts", "../src/translate/validate.ts", "../src/translate/work-list.ts"],
4
+ "sourcesContent": [
5
+ "import { defineCommand } from \"citty\";\n\nimport { AGENTS } from \"../../audit/agent.ts\";\nimport type { AgentKind } from \"../../audit/agent.ts\";\nimport { BlumeError } from \"../../core/diagnostics.ts\";\nimport { i18nEnabled, localeCodes } from \"../../core/i18n.ts\";\nimport type { ResolvedI18nConfig } from \"../../core/schema.ts\";\nimport { DEFAULT_TRANSLATE_TIMEOUT_MS } from \"../../translate/agents.ts\";\nimport {\n pruneLedger,\n readLedger,\n stampLedger,\n writeLedger,\n} from \"../../translate/ledger.ts\";\nimport {\n checkLines,\n checkReportJson,\n checkSummaryLine,\n createProgressRenderer,\n diagnosticLines,\n hasDrift,\n translateHeaderLine,\n translateReportJson,\n translateSummaryLine,\n} from \"../../translate/report.ts\";\nimport { runTranslate } from \"../../translate/run.ts\";\nimport {\n computeWorkList,\n scanForTranslation,\n} from \"../../translate/work-list.ts\";\nimport { commandMeta } from \"../command-meta.ts\";\nimport { reportInternalError } from \"../internal-error.ts\";\nimport { flushStdout, logger, reportDiagnostics } from \"../log.ts\";\n\n/** Wall-clock ceiling per file, in seconds. */\nconst DEFAULT_TIMEOUT_S = DEFAULT_TRANSLATE_TIMEOUT_MS / 1000;\n\n/** Parallel agent sessions per run; each one is a full agent process. */\nconst DEFAULT_CONCURRENCY = 4;\nconst MAX_CONCURRENCY = 16;\n\ninterface TranslateFlags {\n check?: boolean;\n claude?: boolean;\n codex?: boolean;\n concurrency?: string;\n force?: boolean;\n json?: boolean;\n locale?: string;\n timeout?: string;\n}\n\n/** The validated flag surface `parseFlags` hands the command body. */\ninterface ParsedTranslateFlags {\n agent: AgentKind | undefined;\n concurrency: number;\n timeoutS: number;\n}\n\n/** Validate the flag surface, exiting with a message on the first offense. */\nconst parseFlags = (args: TranslateFlags): ParsedTranslateFlags => {\n // SAFETY: Object.keys of the AGENTS table returns exactly its declared\n // AgentKind keys.\n const agents = (Object.keys(AGENTS) as AgentKind[]).filter(\n (kind) => args[kind]\n );\n if (agents.length > 1) {\n logger.error(\"Pass exactly one of --codex or --claude.\");\n process.exit(1);\n }\n if (args.check && agents.length > 0) {\n logger.error(\n \"--check is read-only and never runs an agent; drop --codex/--claude.\"\n );\n process.exit(1);\n }\n if (!args.check && agents.length === 0) {\n logger.error(\n \"Pass --codex or --claude to choose the agent CLI that translates.\"\n );\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 const concurrency =\n args.concurrency === undefined\n ? DEFAULT_CONCURRENCY\n : Number(args.concurrency);\n if (\n !Number.isInteger(concurrency) ||\n concurrency < 1 ||\n concurrency > MAX_CONCURRENCY\n ) {\n logger.error(\n `Invalid --concurrency \"${args.concurrency}\" (use 1..${MAX_CONCURRENCY}).`\n );\n process.exit(1);\n }\n return { agent: agents[0], concurrency, timeoutS };\n};\n\n/**\n * Resolve `--locale` against the configured locales: comma-separated,\n * case-insensitive, adopting the configured casing. Unknown codes and the\n * default locale (the translation source) are errors.\n */\nconst parseLocales = (\n value: string | undefined,\n i18n: ResolvedI18nConfig\n): string[] | undefined => {\n if (value === undefined) {\n return;\n }\n const configured = new Map(\n i18n.locales.map((locale) => [locale.code.toLowerCase(), locale.code])\n );\n const resolved: string[] = [];\n for (const part of value.split(\",\")) {\n const code = configured.get(part.trim().toLowerCase());\n if (code === undefined) {\n logger.error(\n `Unknown --locale \"${part.trim()}\" (configured: ${localeCodes(i18n).join(\", \")}).`\n );\n process.exit(1);\n }\n if (code === i18n.defaultLocale) {\n logger.error(\n `--locale \"${code}\" is the default locale — it is the translation source, not a target.`\n );\n process.exit(1);\n }\n resolved.push(code);\n }\n return resolved;\n};\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\nexport const translateCommand = defineCommand({\n args: {\n check: {\n description:\n \"Report missing/stale translations without writing anything; exits 1 on drift (for CI).\",\n type: \"boolean\",\n },\n claude: {\n description: \"Translate with Claude Code.\",\n type: \"boolean\",\n },\n codex: {\n description: \"Translate with Codex.\",\n type: \"boolean\",\n },\n concurrency: {\n description: `Parallel agent sessions. Defaults to ${DEFAULT_CONCURRENCY}, max ${MAX_CONCURRENCY}.`,\n type: \"string\",\n },\n force: {\n description:\n \"Retranslate everything, up-to-date and hand-authored files included.\",\n type: \"boolean\",\n },\n json: {\n description: \"Emit the report as JSON on stdout (for CI/editors).\",\n type: \"boolean\",\n },\n locale: {\n description:\n \"Comma-separated target locale codes; defaults to every non-default locale.\",\n type: \"string\",\n },\n timeout: {\n description: `Agent time limit per file, in seconds. Defaults to ${DEFAULT_TIMEOUT_S}.`,\n type: \"string\",\n },\n },\n meta: commandMeta.translate,\n async run({ args }) {\n const root = process.cwd();\n const { agent, concurrency, timeoutS } = parseFlags(args);\n\n try {\n // A scan, not `prepareProject`: translation reads the content tree and\n // writes source files, never `.blume/`, so it doesn't contend with a\n // running dev server. Same reasoning as `blume audit`/`eval`. Drafts\n // are included (see `scanForTranslation`).\n const project = await scanForTranslation(root);\n if (!i18nEnabled(project.config)) {\n logger.error(\n \"i18n is not configured — add `i18n.locales` to blume.config to use `blume translate`.\"\n );\n process.exit(1);\n }\n const { i18n } = project.config;\n if (localeCodes(i18n).every((code) => code === i18n.defaultLocale)) {\n logger.error(\n \"i18n.locales has no locale besides the default — nothing to translate into.\"\n );\n process.exit(1);\n }\n const locales = parseLocales(args.locale, i18n);\n const ledger = await readLedger(root);\n const workList = await computeWorkList(project, ledger, {\n force: !args.check && Boolean(args.force),\n locales,\n });\n\n if (args.check) {\n const lines = [\n ...diagnosticLines(workList.diagnostics),\n ...checkLines(workList),\n \"\",\n ` ${checkSummaryLine(workList)}`,\n \"\",\n ];\n process.stderr.write(`${lines.join(\"\\n\")}\\n`);\n if (args.json) {\n process.stdout.write(checkReportJson(workList));\n }\n if (hasDrift(workList)) {\n await flushStdout();\n process.exit(1);\n }\n return;\n }\n\n // SAFETY: parseFlags exits unless --check was passed or exactly one\n // agent flag was; on this non-check path the agent is therefore set.\n const kind = agent as AgentKind;\n process.stderr.write(\n `${translateHeaderLine(workList.items.length, workList.targetLocales.length, kind)}\\n\\n`\n );\n\n // Adopt pre-existing hand-authored translations (stamp, never rewrite)\n // and persist BEFORE the agents run, so adoption survives an interrupt.\n for (const entry of workList.untracked) {\n stampLedger(ledger, entry.sourceRel, entry.locale, entry.hash);\n }\n await writeLedger(root, ledger);\n\n const renderer = createProgressRenderer({\n isTTY: process.stderr.isTTY === true,\n write: (chunk) => process.stderr.write(chunk),\n });\n const result = await runTranslate({\n agent: kind,\n concurrency,\n ledger,\n onProgress: (event) => renderer.onProgress(event),\n // Flush after every finished item, so stopping a long run mid-way\n // keeps everything already translated out of the next work list.\n persistLedger: () => writeLedger(root, ledger),\n project,\n timeoutMs: timeoutS * 1000,\n workList,\n });\n renderer.stop();\n\n // Prune entries whose source or locale no longer exists. Pruning spans\n // ALL non-default locales — a `--locale fr` run must not drop the other\n // locales' stamps.\n const knownLocales = new Set(\n localeCodes(i18n).filter((code) => code !== i18n.defaultLocale)\n );\n await writeLedger(\n root,\n pruneLedger(ledger, workList.knownSources, knownLocales)\n );\n\n const tail = [\n \"\",\n ...diagnosticLines(workList.diagnostics),\n ` ${translateSummaryLine(result, workList)}`,\n \"\",\n ];\n process.stderr.write(tail.join(\"\\n\"));\n\n if (args.json) {\n process.stdout.write(translateReportJson(result, workList));\n }\n if (result.counts.failed > 0 || result.counts.partial > 0) {\n // The ledger write above already persisted every success, so a failed\n // rerun only retries what actually failed.\n await flushStdout();\n process.exit(1);\n }\n } catch (error) {\n if (error instanceof BlumeError) {\n reportDiagnostics([error.diagnostic], root);\n process.exit(1);\n }\n // SAFETY: an ENOENT from spawning the agent CLI is an ErrnoException;\n // any other thrown shape reads `code` as undefined and falls through.\n if ((error as NodeJS.ErrnoException)?.code === \"ENOENT\" && agent) {\n notInstalled(agent);\n }\n reportInternalError(error);\n process.exit(1);\n }\n },\n});\n",
6
+ "import type { AgentKind } from \"../audit/agent.ts\";\nimport { CODEX_LOCKDOWN, DISALLOWED_TOOLS } from \"../eval/agents.ts\";\n\n/**\n * argv builders for the translator role. The subprocess machinery\n * (`runAgentHeadless`, `readAgentOutput`, the `HeadlessRunner` test seam) is\n * shared with `blume eval` — only the argument surface differs: a translator\n * is a pure text→text call with no MCP servers and no tools at all, so the\n * agent can neither read the repo nor write files (Blume owns every write).\n */\n\n/**\n * Wall-clock ceiling per file. Generous by design: translating a large page\n * means regenerating the whole file token by token, and a 20KB+ reference\n * page comfortably exceeds the eval reader's 3-minute precedent. The ceiling\n * exists to catch hung agents, not to police slow-but-progressing ones.\n */\nexport const DEFAULT_TRANSLATE_TIMEOUT_MS = 600_000;\n\nconst claudeArgs = (): string[] => [\n \"-p\",\n \"--output-format\",\n \"json\",\n \"--strict-mcp-config\",\n \"--disallowedTools\",\n DISALLOWED_TOOLS.join(\",\"),\n \"--max-turns\",\n \"1\",\n];\n\n// `--sandbox read-only` alone still lets codex's shell read any file the user\n// can, and the source page being translated is untrusted input (a remote\n// contributor's prose), so the translator gets the same lockdown as an eval\n// run: no shell, exec, or local-image tool, and no inherited environment.\nconst codexArgs = (lastMessagePath: string): string[] => [\n \"exec\",\n \"--skip-git-repo-check\",\n \"--ignore-user-config\",\n \"--ephemeral\",\n \"--sandbox\",\n \"read-only\",\n ...CODEX_LOCKDOWN,\n \"--output-last-message\",\n lastMessagePath,\n \"-\",\n];\n\n/**\n * Build the argv for one headless translation call. `lastMessagePath` is where\n * codex writes its final message (its stdout interleaves progress); claude\n * ignores it and answers as JSON on stdout.\n */\nexport const translateAgentArgs = (\n kind: AgentKind,\n lastMessagePath: string\n): string[] => (kind === \"claude\" ? claudeArgs() : codexArgs(lastMessagePath));\n",
7
+ "import { createHash } from \"node:crypto\";\nimport { readFile } from \"node:fs/promises\";\n\nimport { join } from \"pathe\";\nimport { z } from \"zod\";\n\nimport { BlumeError } from \"../core/diagnostics.ts\";\nimport { writeTextAtomic } from \"../core/fs-atomic.ts\";\n\n/**\n * The committed translation ledger: which source files have been translated\n * into which locales, and at what source content. Named \"ledger\" to avoid\n * colliding with the route manifest (`core/manifest.ts`). It lives at the\n * project root — never inside `.blume/` (init gitignores that dir wholesale,\n * and the whole point is that the ledger is committed alongside the docs).\n */\nexport const LEDGER_FILE = \"blume.translations.json\";\n\n/**\n * `files` maps a POSIX root-relative source path to, per locale, the hash of\n * the raw source text at the moment that locale's translation was written.\n */\nexport interface TranslationLedger {\n version: 1;\n files: Record<string, Record<string, string>>;\n}\n\nconst ledgerSchema = z.object({\n files: z.record(z.string(), z.record(z.string(), z.string())),\n version: z.literal(1),\n});\n\nexport const emptyLedger = (): TranslationLedger => ({\n files: {},\n version: 1,\n});\n\n/**\n * Hash the raw source text (frontmatter included), so any edit invalidates\n * every locale's stamp. sha256-16 like the audit snapshot's content hash.\n * Kept as its own function rather than sharing core's `hashText`: ledger\n * stamps persist in user repos, so this hash must never change shape when an\n * ephemeral cache hash does. CRLF line endings are normalized to LF first, so\n * a Windows checkout (`core.autocrlf`) hashes the same as everyone else's —\n * LF text hashes exactly as it always has.\n */\nexport const hashSource = (text: string): string =>\n createHash(\"sha256\")\n .update(text.replaceAll(\"\\r\\n\", \"\\n\"))\n .digest(\"hex\")\n .slice(0, 16);\n\n/** A git merge-conflict marker line: `<<<<<<< ours`, `=======`, `>>>>>>> theirs`. */\nconst CONFLICT_MARKER = /^(?:<{7}|={7}|>{7})(?:[ \\r]|$)/mu;\n\n/**\n * Read the ledger at `root`, tolerantly: a missing file, unparseable JSON, or\n * an unknown shape/version all resolve to an empty ledger rather than an error\n * (same posture as the dev lock's `parseLock`) — the worst outcome of a\n * corrupt ledger is retranslating files that were already up to date.\n *\n * Unresolved merge-conflict markers are the exception, and an error: read as\n * empty, every existing translation would be adopted as current, so\n * `--check` would pass over translations that are out of date.\n */\nexport const readLedger = async (root: string): Promise<TranslationLedger> => {\n const path = join(root, LEDGER_FILE);\n let raw: string;\n try {\n raw = await readFile(path, \"utf-8\");\n } catch {\n return emptyLedger();\n }\n let data: unknown;\n try {\n data = JSON.parse(raw);\n } catch {\n if (CONFLICT_MARKER.test(raw)) {\n throw new BlumeError({\n code: \"BLUME_TRANSLATE_LEDGER_CONFLICT\",\n file: path,\n message: `${LEDGER_FILE} has unresolved merge-conflict markers, so it can't say which translations are current.`,\n severity: \"error\",\n suggestion: `Resolve the merge conflict in ${LEDGER_FILE}, then rerun.`,\n });\n }\n return emptyLedger();\n }\n const parsed = ledgerSchema.safeParse(data);\n return parsed.success ? parsed.data : emptyLedger();\n};\n\n/** Deterministic serialization: keys sorted at both levels, 2-space indent. */\nexport const serializeLedger = (ledger: TranslationLedger): string => {\n const files: Record<string, Record<string, string>> = {};\n for (const source of Object.keys(ledger.files).toSorted()) {\n const locales = ledger.files[source] ?? {};\n files[source] = Object.fromEntries(\n Object.keys(locales)\n .toSorted()\n .map((locale) => [locale, locales[locale] ?? \"\"])\n );\n }\n return `${JSON.stringify({ files, version: ledger.version }, null, 2)}\\n`;\n};\n\n/**\n * Write the ledger at `root`, returning whether anything changed on disk. A\n * byte-identical ledger is left untouched (no mtime churn, no git noise);\n * a changed one lands via temp-file-plus-rename so a concurrent reader never\n * observes a half-written file.\n */\nexport const writeLedger = async (\n root: string,\n ledger: TranslationLedger\n): Promise<boolean> => {\n const path = join(root, LEDGER_FILE);\n const content = serializeLedger(ledger);\n let existing: string | null = null;\n try {\n existing = await readFile(path, \"utf-8\");\n } catch {\n existing = null;\n }\n if (existing === content) {\n return false;\n }\n await writeTextAtomic(path, content);\n return true;\n};\n\n/** Record that `sourceRel` is translated into `locale` at source hash `hash`. */\nexport const stampLedger = (\n ledger: TranslationLedger,\n sourceRel: string,\n locale: string,\n hash: string\n): void => {\n const locales = ledger.files[sourceRel] ?? {};\n locales[locale] = hash;\n ledger.files[sourceRel] = locales;\n};\n\n/**\n * Drop entries for sources that no longer exist and locales that are no longer\n * configured, so deleted pages and removed locales don't linger in the ledger\n * forever. Returns a new ledger.\n */\nexport const pruneLedger = (\n ledger: TranslationLedger,\n knownSources: ReadonlySet<string>,\n knownLocales: ReadonlySet<string>\n): TranslationLedger => {\n const files: Record<string, Record<string, string>> = {};\n for (const [source, locales] of Object.entries(ledger.files)) {\n if (!knownSources.has(source)) {\n continue;\n }\n const kept = Object.fromEntries(\n Object.entries(locales).filter(([locale]) => knownLocales.has(locale))\n );\n if (Object.keys(kept).length > 0) {\n files[source] = kept;\n }\n }\n return { files, version: ledger.version };\n};\n",
8
+ "import { colors } from \"consola/utils\";\nimport type { ColorFunction } from \"consola/utils\";\n\nimport { AGENTS } from \"../audit/agent.ts\";\nimport type { AgentKind } from \"../audit/agent.ts\";\nimport { duration, money, seconds } from \"../cli/report-format.ts\";\nimport { countBySeverity } from \"../core/diagnostics.ts\";\nimport type { Diagnostic } from \"../core/types.ts\";\nimport type {\n TranslateItemResult,\n TranslateItemStatus,\n TranslateResult,\n} from \"./run.ts\";\nimport type {\n MetaWorkEntry,\n TranslateWorkList,\n WorkItem,\n WorkStatus,\n} from \"./work-list.ts\";\n\n/**\n * The live progress UI, colored via consola's `colors` (which honors\n * NO_COLOR/FORCE_COLOR and TTY detection), matching the eval report's palette.\n * Render functions are pure; the renderer takes an injectable `write`/`now` so\n * tests never touch a real TTY or clock. The command sends everything here to\n * stderr via the raw `write` — never `logger.info`, which consola drops in\n * test and CI environments.\n */\n\nconst ESC = String.fromCodePoint(27);\n\nconst GLYPH = {\n failed: \"✖\",\n partial: \"!\",\n translated: \"✔\",\n} satisfies Record<TranslateItemStatus, string>;\n\nconst STATUS_COLOR = {\n failed: colors.red,\n partial: colors.yellow,\n translated: colors.green,\n} satisfies Record<TranslateItemStatus, ColorFunction>;\n\nexport const SPINNER_FRAMES = [\n \"⠋\",\n \"⠙\",\n \"⠹\",\n \"⠸\",\n \"⠼\",\n \"⠴\",\n \"⠦\",\n \"⠧\",\n \"⠇\",\n \"⠏\",\n];\n\n/** How often the TTY spinner advances (one frame per interval). */\nexport const SPINNER_INTERVAL_MS = 80;\n\n/** The clear-to-start-of-line prefix every TTY rewrite uses. */\nconst REWRITE = `\\r${ESC}[K`;\n\n/** `docs/guides/install.mdx → fr`, or the batched meta call's label. */\nexport const itemLabel = (item: WorkItem): string =>\n item.kind === \"page\"\n ? `${item.sourceRel} → ${item.locale}`\n : `meta title${item.entries.length === 1 ? \"\" : \"s\"} (${item.entries.length}) → ${item.locale}`;\n\n/**\n * The in-flight spinner line a TTY rewrites in place: the oldest active\n * item's label, how many more lanes are running, and the run's progress.\n */\nexport const spinnerLine = (\n active: WorkItem[],\n done: number,\n total: number,\n frame: number\n): string => {\n // SAFETY: the renderer only paints while at least one item is active, so the\n // oldest active entry exists.\n const first = active[0] as WorkItem;\n const more = active.length > 1 ? ` (+${active.length - 1} more)` : \"\";\n // SAFETY: `frame % SPINNER_FRAMES.length` is always an index into the\n // non-empty frames array.\n return ` ${colors.cyan(SPINNER_FRAMES[frame % SPINNER_FRAMES.length] as string)} ${itemLabel(first)}${more} ${colors.dim(`${done}/${total}`)}`;\n};\n\n/** The permanent line printed when an item finishes. */\nexport const itemEndLine = (result: TranslateItemResult): string => {\n const color = STATUS_COLOR[result.status];\n const glyph = color(GLYPH[result.status]);\n const label = itemLabel(result.item);\n if (result.status === \"translated\") {\n const cells = [seconds(result.durationMs), money(result.costUsd)]\n .filter((cell) => cell !== \"\")\n .join(\" \");\n return ` ${glyph} ${label} ${colors.dim(cells)}`;\n }\n const word = result.status === \"partial\" ? \"partial\" : \"failed\";\n return ` ${glyph} ${label} ${color(word)}${\n result.detail ? colors.dim(`: ${result.detail}`) : \"\"\n }`;\n};\n\n/** The header line the command prints before the first item runs. */\nexport const translateHeaderLine = (\n itemCount: number,\n localeCount: number,\n agent: AgentKind\n): string =>\n `${colors.bold(\"blume translate\")} ${itemCount} item(s) · ${localeCount} locale(s) · ${AGENTS[agent].name}`;\n\n/**\n * `Translated 11 files into 2 locales · 1 failed · 2 adopted · 8 already up to\n * date · 4m 12s · $0.41` (cost only when the agent reports one).\n */\nexport const translateSummaryLine = (\n result: TranslateResult,\n workList: TranslateWorkList\n): string => {\n const { counts } = result;\n const parts = [\n `Translated ${counts.translated} file${counts.translated === 1 ? \"\" : \"s\"} into ${workList.targetLocales.length} locale${workList.targetLocales.length === 1 ? \"\" : \"s\"}`,\n counts.failed > 0 ? `${counts.failed} failed` : \"\",\n counts.partial > 0 ? `${counts.partial} partial` : \"\",\n workList.untracked.length > 0 ? `${workList.untracked.length} adopted` : \"\",\n workList.upToDate > 0 ? `${workList.upToDate} already up to date` : \"\",\n duration(result.durationMs),\n money(result.costUsd),\n ].filter((part) => part !== \"\");\n return parts.join(\" · \");\n};\n\n/** Dim warnings for work-list diagnostics (e.g. a factory-form meta file). */\nexport const diagnosticLines = (diagnostics: Diagnostic[]): string[] =>\n diagnostics.map(\n (diagnostic) => ` ${colors.yellow(\"⚠\")} ${colors.dim(diagnostic.message)}`\n );\n\n/** One (source, locale) pair a `--check` run flags. */\ninterface DriftRow {\n /** Absolute path of the default-locale source. */\n file: string;\n locale: string;\n sourceRel: string;\n status: WorkStatus;\n}\n\n/** Every (source, locale, status) drift row in a work list, pages then meta. */\nconst driftRows = (workList: TranslateWorkList): DriftRow[] =>\n workList.items.flatMap((item) =>\n item.kind === \"page\"\n ? [\n {\n file: item.sourcePath,\n locale: item.locale,\n sourceRel: item.sourceRel,\n status: item.status,\n },\n ]\n : item.entries.map((entry: MetaWorkEntry) => ({\n file: entry.meta.file,\n locale: item.locale,\n sourceRel: entry.meta.sourceRel,\n status: entry.status,\n }))\n );\n\n/**\n * Each missing or stale translation as an error diagnostic, so the `--check`\n * JSON's `summary` counts the drift that fails the gate — the exit-code\n * contract `blume validate/audit/eval --json` keep, where a non-zero exit\n * always shows as a non-zero `summary.error`.\n */\nconst driftDiagnostics = (workList: TranslateWorkList): Diagnostic[] =>\n driftRows(workList).map((row) => ({\n code:\n row.status === \"missing\"\n ? \"BLUME_TRANSLATE_MISSING\"\n : \"BLUME_TRANSLATE_STALE\",\n file: row.file,\n message:\n row.status === \"missing\"\n ? `${row.sourceRel} has no \"${row.locale}\" translation.`\n : `The \"${row.locale}\" translation of ${row.sourceRel} is stale: its source changed since it was translated.`,\n severity: \"error\",\n suggestion:\n \"Run `blume translate --codex` (or `--claude`) to bring the translations up to date.\",\n }));\n\n/** One line per missing/stale pair, plus dim lines for untracked adoptions. */\nexport const checkLines = (workList: TranslateWorkList): string[] => [\n ...driftRows(workList).map(\n (row) =>\n ` ${colors.red(\"✖\")} ${row.sourceRel} → ${row.locale} ${colors.dim(row.status)}`\n ),\n ...workList.untracked.map(\n (entry) =>\n ` ${colors.dim(`⊘ ${entry.sourceRel} → ${entry.locale} untracked (adopted by the next translate run)`)}`\n ),\n];\n\n/** The `--check` totals: `2 missing · 1 stale · 1 untracked · 14 up to date`. */\nexport const checkSummaryLine = (workList: TranslateWorkList): string => {\n const rows = driftRows(workList);\n const missing = rows.filter((row) => row.status === \"missing\").length;\n const stale = rows.filter((row) => row.status === \"stale\").length;\n const parts = [\n missing > 0 ? `${missing} missing` : \"\",\n stale > 0 ? `${stale} stale` : \"\",\n workList.untracked.length > 0\n ? `${workList.untracked.length} untracked`\n : \"\",\n `${workList.upToDate} up to date`,\n ].filter((part) => part !== \"\");\n return parts.join(\" · \");\n};\n\n/** Whether a work list fails the `--check` gate (untracked never does). */\nexport const hasDrift = (workList: TranslateWorkList): boolean =>\n workList.items.length > 0;\n\n/**\n * The machine-readable `--check` report. The `diagnostics` + `summary` shape\n * matches `blume validate/audit/eval --json` exactly — every missing or stale\n * translation is an error diagnostic there, so `summary.error` agrees with the\n * exit code — with the drift report grouped by locale under `translate`.\n */\nexport const checkReportJson = (workList: TranslateWorkList): string => {\n const diagnostics = [...workList.diagnostics, ...driftDiagnostics(workList)];\n const locales: Record<\n string,\n { missing: string[]; stale: string[]; untracked: string[] }\n > = {};\n for (const locale of workList.targetLocales) {\n locales[locale] = { missing: [], stale: [], untracked: [] };\n }\n for (const row of driftRows(workList)) {\n locales[row.locale]?.[row.status].push(row.sourceRel);\n }\n for (const entry of workList.untracked) {\n locales[entry.locale]?.untracked.push(entry.sourceRel);\n }\n return `${JSON.stringify(\n {\n diagnostics,\n summary: countBySeverity(diagnostics),\n translate: { locales, upToDate: workList.upToDate },\n },\n null,\n 2\n )}\\n`;\n};\n\n/** One run result lowered to JSON-friendly, root-relative fields. */\nconst resultJson = (result: TranslateItemResult) => ({\n costUsd: result.costUsd,\n detail: result.detail,\n durationMs: result.durationMs,\n kind: result.item.kind,\n locale: result.item.locale,\n status: result.status,\n ...(result.item.kind === \"page\"\n ? { source: result.item.sourceRel, target: result.item.targetRel }\n : {\n sources: result.item.entries.map((entry) => entry.meta.sourceRel),\n }),\n});\n\n/** The machine-readable report for a translation run (`--json`). */\nexport const translateReportJson = (\n result: TranslateResult,\n workList: TranslateWorkList\n): string => {\n const diagnostics = [...workList.diagnostics, ...result.diagnostics];\n return `${JSON.stringify(\n {\n diagnostics,\n summary: countBySeverity(diagnostics),\n translate: {\n adopted: workList.untracked.length,\n agent: result.agent,\n costUsd: result.costUsd,\n counts: result.counts,\n durationMs: result.durationMs,\n results: result.results.map(resultJson),\n upToDate: workList.upToDate,\n },\n },\n null,\n 2\n )}\\n`;\n};\n\nexport interface ProgressRenderer {\n onProgress: (\n event:\n | {\n kind: \"item-end\";\n index: number;\n result: TranslateItemResult;\n total: number;\n }\n | { kind: \"item-start\"; index: number; item: WorkItem; total: number }\n ) => void;\n stop: () => void;\n}\n\n/**\n * Live progress: on a TTY the in-flight items render as one spinner line\n * rewritten in place (`\\r\\x1B[K`) — a concurrent run shows the oldest active\n * item plus a `(+n more)` count — and each completion prints its permanent\n * line above it; off-TTY (CI) there is no interval and only the permanent\n * per-item lines print.\n */\nexport const createProgressRenderer = (options: {\n isTTY: boolean;\n write: (chunk: string) => void;\n now?: () => number;\n}): ProgressRenderer => {\n const now = options.now ?? (() => performance.now());\n let timer: ReturnType<typeof setInterval> | undefined;\n const active = new Map<number, WorkItem>();\n let done = 0;\n let total = 0;\n let startedAt = 0;\n\n const paint = (): void => {\n if (active.size > 0) {\n const frame = Math.floor((now() - startedAt) / SPINNER_INTERVAL_MS);\n options.write(\n `${REWRITE}${spinnerLine([...active.values()], done, total, frame)}`\n );\n }\n };\n const clearTimer = (): void => {\n if (timer) {\n clearInterval(timer);\n timer = undefined;\n }\n };\n\n return {\n onProgress(event) {\n ({ total } = event);\n if (event.kind === \"item-start\") {\n active.set(event.index, event.item);\n if (!options.isTTY) {\n return;\n }\n if (!timer) {\n startedAt = now();\n timer = setInterval(paint, SPINNER_INTERVAL_MS);\n timer.unref?.();\n }\n paint();\n return;\n }\n active.delete(event.index);\n done += 1;\n const line = itemEndLine(event.result);\n if (!options.isTTY) {\n options.write(`${line}\\n`);\n return;\n }\n options.write(`${REWRITE}${line}\\n`);\n if (active.size > 0) {\n paint();\n } else {\n clearTimer();\n }\n },\n stop() {\n clearTimer();\n active.clear();\n },\n };\n};\n",
9
+ "import { existsSync } from \"node:fs\";\nimport { mkdtemp, readFile } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\n\nimport pLimit from \"p-limit\";\nimport pMap from \"p-map\";\nimport { dirname, join } from \"pathe\";\n\nimport { AGENTS } from \"../audit/agent.ts\";\nimport type { AgentKind } from \"../audit/agent.ts\";\nimport { writeTextAtomic } from \"../core/fs-atomic.ts\";\nimport type { BlumeProject } from \"../core/project-graph.ts\";\nimport type { LocaleConfig } from \"../core/schema.ts\";\nimport type { Diagnostic } from \"../core/types.ts\";\nimport { readAgentOutput, runAgentHeadless } from \"../eval/agents.ts\";\nimport type { AgentOutput, HeadlessRunner } from \"../eval/agents.ts\";\nimport { DEFAULT_TRANSLATE_TIMEOUT_MS, translateAgentArgs } from \"./agents.ts\";\nimport { hashSource, stampLedger } from \"./ledger.ts\";\nimport type { TranslationLedger } from \"./ledger.ts\";\nimport { generateMetaModule } from \"./meta.ts\";\nimport type { TranslatableMeta } from \"./meta.ts\";\nimport { metaPrompt, pagePrompt } from \"./prompts.ts\";\nimport { parseMetaTitles, validateTranslation } from \"./validate.ts\";\nimport type {\n MetaWorkItem,\n PageWorkItem,\n TranslateWorkList,\n WorkItem,\n} from \"./work-list.ts\";\n\nexport type TranslateItemStatus = \"failed\" | \"partial\" | \"translated\";\n\nexport interface TranslateItemResult {\n costUsd?: number;\n /** Why the item failed (agent error, validation failure, missing titles). */\n detail?: string;\n durationMs: number;\n item: WorkItem;\n status: TranslateItemStatus;\n}\n\nexport type TranslateProgress =\n | {\n kind: \"item-end\";\n index: number;\n result: TranslateItemResult;\n total: number;\n }\n | { kind: \"item-start\"; index: number; item: WorkItem; total: number };\n\nexport interface TranslateRunOptions {\n agent: AgentKind;\n /** Parallel agent sessions. Defaults to 1 (serial). */\n concurrency?: number;\n /** Mutated in place: every validated write stamps its entry immediately. */\n ledger: TranslationLedger;\n onProgress?: (event: TranslateProgress) => void;\n /**\n * Called after each finished item to flush the ledger to disk, so an\n * interrupted run keeps everything already translated. Calls are serialized\n * here — concurrent workers finishing together never race the same file.\n * The flush's result (`writeLedger`'s wrote-or-not boolean) is ignored.\n */\n persistLedger?: () => Promise<boolean | undefined>;\n project: BlumeProject;\n /** The spawn function — injectable so tests never launch a real agent. */\n run?: HeadlessRunner;\n timeoutMs?: number;\n workList: TranslateWorkList;\n}\n\nexport interface TranslateResult {\n agent: AgentKind;\n /** Total spend, when the agent CLI reports it (claude does, codex doesn't). */\n costUsd?: number;\n counts: Record<TranslateItemStatus, number>;\n diagnostics: Diagnostic[];\n durationMs: number;\n results: TranslateItemResult[];\n}\n\ninterface RunContext {\n bin: string;\n dir: string;\n kind: AgentKind;\n run: HeadlessRunner;\n source: LocaleConfig;\n targets: Map<string, LocaleConfig>;\n timeoutMs: number;\n}\n\n/**\n * A meta file's key in a meta-titles prompt: its directory relative to the\n * project root. The content-root-relative `dir` isn't unique — two\n * filesystem sources can both have a `guides/` folder — and colliding keys\n * would hand both folders one translation.\n */\nconst metaKey = (meta: TranslatableMeta): string => dirname(meta.sourceRel);\n\n/**\n * One headless agent call. A missing executable rejects with ENOENT on every\n * platform (the runner spawns without a shell), which the command layer turns\n * into an install hint.\n */\nconst invokeAgent = async (\n context: RunContext,\n prompt: string,\n index: number\n): Promise<AgentOutput> => {\n const messagePath = join(context.dir, `message-${index}.txt`);\n const result = await context.run(\n context.bin,\n translateAgentArgs(context.kind, messagePath),\n { cwd: context.dir, prompt, timeoutMs: context.timeoutMs }\n );\n return await readAgentOutput(context.kind, result, messagePath);\n};\n\nconst runPageItem = async (\n item: PageWorkItem,\n index: number,\n context: RunContext,\n ledger: TranslationLedger\n): Promise<TranslateItemResult> => {\n const started = performance.now();\n const done = (\n status: TranslateItemStatus,\n detail?: string,\n costUsd?: number\n ): TranslateItemResult => ({\n costUsd,\n detail,\n durationMs: Math.round(performance.now() - started),\n item,\n status,\n });\n\n const sourceText = await readFile(item.sourcePath, \"utf-8\");\n if (item.verbatim) {\n // A non-markdown include partial (code embed) has no prose to translate;\n // it's copied unchanged so the locale tree's relative includes resolve.\n await writeTextAtomic(item.targetPath, sourceText);\n stampLedger(ledger, item.sourceRel, item.locale, hashSource(sourceText));\n return done(\"translated\");\n }\n // SAFETY: `targets` maps every configured locale, and work items only carry\n // configured locale codes.\n const target = context.targets.get(item.locale) as LocaleConfig;\n // A hand-authored translation can live at a non-canonical name (see\n // WorkStatus); the disk probe finds only canonical targets, and a miss just\n // means the prompt goes out without a style precedent.\n const previousTranslation = existsSync(item.targetPath)\n ? await readFile(item.targetPath, \"utf-8\")\n : undefined;\n const output = await invokeAgent(\n context,\n pagePrompt(sourceText, target, context.source, previousTranslation),\n index\n );\n if (output.isError) {\n return done(\"failed\", output.detail ?? \"agent failed\", output.costUsd);\n }\n const validated = validateTranslation(sourceText, output.text);\n if (!validated.ok) {\n return done(\"failed\", validated.reason, output.costUsd);\n }\n await writeTextAtomic(item.targetPath, validated.text);\n stampLedger(ledger, item.sourceRel, item.locale, hashSource(sourceText));\n return done(\"translated\", undefined, output.costUsd);\n};\n\nconst runMetaItem = async (\n item: MetaWorkItem,\n index: number,\n context: RunContext,\n ledger: TranslationLedger\n): Promise<TranslateItemResult> => {\n const started = performance.now();\n const done = (\n status: TranslateItemStatus,\n detail?: string,\n costUsd?: number\n ): TranslateItemResult => ({\n costUsd,\n detail,\n durationMs: Math.round(performance.now() - started),\n item,\n status,\n });\n\n const titles = Object.fromEntries(\n item.entries.map((entry) => [metaKey(entry.meta), entry.meta.title])\n );\n // SAFETY: `targets` maps every configured locale, and work items only carry\n // configured locale codes.\n const target = context.targets.get(item.locale) as LocaleConfig;\n const output = await invokeAgent(\n context,\n metaPrompt(titles, target, context.source),\n index\n );\n if (output.isError) {\n return done(\"failed\", output.detail ?? \"agent failed\", output.costUsd);\n }\n\n const parsed = parseMetaTitles(output.text, Object.keys(titles));\n for (const entry of item.entries) {\n const translated = parsed.titles[metaKey(entry.meta)];\n if (translated === undefined) {\n continue;\n }\n // Each entry writes and stamps independently, so a partially usable reply\n // still lands the titles it did translate.\n // oxlint-disable-next-line no-await-in-loop\n await writeTextAtomic(\n entry.targetPath,\n generateMetaModule(entry.meta.data, translated)\n );\n stampLedger(\n ledger,\n entry.meta.sourceRel,\n item.locale,\n hashSource(entry.meta.raw)\n );\n }\n\n if (parsed.missing.length === item.entries.length) {\n return done(\"failed\", \"reply contained no usable titles\", output.costUsd);\n }\n if (parsed.missing.length > 0) {\n return done(\n \"partial\",\n `no translation for: ${parsed.missing.join(\", \")}`,\n output.costUsd\n );\n }\n return done(\"translated\", undefined, output.costUsd);\n};\n\nconst itemDiagnostic = (result: TranslateItemResult): Diagnostic => {\n const { item } = result;\n const site =\n item.kind === \"page\"\n ? { file: item.sourcePath, subject: item.sourceRel }\n : {\n file: item.entries[0]?.meta.file,\n subject: `meta titles (${item.entries.length})`,\n };\n return {\n code:\n result.status === \"partial\"\n ? \"BLUME_TRANSLATE_META_PARTIAL\"\n : \"BLUME_TRANSLATE_FAILED\",\n file: site.file,\n message: `Translating ${site.subject} into \"${item.locale}\" ${\n result.status === \"partial\" ? \"partially failed\" : \"failed\"\n }: ${result.detail ?? \"unknown error\"}.`,\n severity: result.status === \"partial\" ? \"warning\" : \"error\",\n };\n};\n\n/**\n * Run every work item through the agent, `concurrency` at a time: each worker\n * is a serial lane pulling the next unclaimed item, so results stay indexed\n * by item and progress events interleave but never duplicate. A failed item\n * never writes or stamps; its lane continues. After every finished item the\n * ledger is flushed via `persistLedger` (serialized across lanes), so an\n * interrupted run resumes from what already landed instead of from scratch.\n */\nexport const runTranslate = async (\n options: TranslateRunOptions\n): Promise<TranslateResult> => {\n const started = performance.now();\n const { i18n } = options.project.config;\n if (!i18n) {\n throw new Error(\"blume translate requires i18n to be configured\");\n }\n // SAFETY: the config schema requires `defaultLocale` to be one of `locales`.\n const source = i18n.locales.find(\n (locale) => locale.code === i18n.defaultLocale\n ) as LocaleConfig;\n\n const context: RunContext = {\n bin: AGENTS[options.agent].bin,\n dir: await mkdtemp(join(tmpdir(), \"blume-translate-\")),\n kind: options.agent,\n run: options.run ?? runAgentHeadless,\n source,\n targets: new Map(i18n.locales.map((locale) => [locale.code, locale])),\n timeoutMs: options.timeoutMs ?? DEFAULT_TRANSLATE_TIMEOUT_MS,\n };\n\n const { items } = options.workList;\n const concurrency = Math.max(\n 1,\n Math.min(options.concurrency ?? 1, items.length || 1)\n );\n\n // The persist mutex: ledger flushes from concurrent lanes are serialized so\n // two lanes never write the ledger file at the same time.\n const persistLimit = pLimit(1);\n const persist = (): Promise<boolean | undefined> =>\n persistLimit(() => options.persistLedger?.());\n\n const results = await pMap(\n items,\n async (item: WorkItem, index): Promise<TranslateItemResult> => {\n options.onProgress?.({\n index,\n item,\n kind: \"item-start\",\n total: items.length,\n });\n const result = await (item.kind === \"page\"\n ? runPageItem(item, index, context, options.ledger)\n : runMetaItem(item, index, context, options.ledger));\n // Flush this item's stamps before the slot frees for the next item, so\n // a kill loses at most the in-flight items.\n await persist();\n options.onProgress?.({\n index,\n kind: \"item-end\",\n result,\n total: items.length,\n });\n return result;\n },\n { concurrency }\n );\n\n const diagnostics: Diagnostic[] = [];\n for (const result of results) {\n if (result.status !== \"translated\") {\n diagnostics.push(itemDiagnostic(result));\n }\n }\n\n const counts = {\n failed: 0,\n partial: 0,\n translated: 0,\n } satisfies Record<TranslateItemStatus, 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: options.agent,\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",
10
+ "import { readFile } from \"node:fs/promises\";\n\nimport { dirname, join, relative } from \"pathe\";\nimport { glob } from \"tinyglobby\";\n\nimport { createModuleLoader } from \"../core/load-module.ts\";\nimport type { BlumeProject } from \"../core/project-graph.ts\";\nimport { folderMetaSchema } from \"../core/schema.ts\";\nimport type { FolderMeta } from \"../core/schema.ts\";\nimport type { Diagnostic } from \"../core/types.ts\";\n\n/**\n * Folder-nav `meta.ts` titles are translatable under the `dir` parser ONLY:\n * per-locale meta is a whole-file replacement, not a merge (`applyFolderMeta`\n * looks up `<locale>/<group>` and falls back to shared meta, never to the\n * default locale's file), and the `dot` parser has no per-locale meta\n * mechanism at all. So the generated module must copy EVERY source key\n * (order/pages/icon/collapsed) with only the title translated — otherwise the\n * locale's navigation loses its ordering.\n */\n\n/** One default-locale meta file whose title can be translated. */\nexport interface TranslatableMeta {\n /** The parsed meta module; copied wholesale into the generated module. */\n data: FolderMeta;\n /** Directory relative to the owning source's content root (`\"\"` = root). */\n dir: string;\n /** Absolute path of the source meta file. */\n file: string;\n /** The owning source's content root (locale directories live under it). */\n contentRoot: string;\n /** Raw source text at discovery time — what the ledger hashes. */\n raw: string;\n /** POSIX root-relative path of the source meta file — the ledger key. */\n sourceRel: string;\n /** The source title to translate. */\n title: string;\n}\n\nconst META_FILES = [\"**/meta.ts\", \"**/meta.js\", \"**/meta.mjs\"];\n\n/**\n * Whether a loaded meta module default-exports a factory function. Generic so\n * it can decode the loader's untyped module value at this boundary.\n */\nconst isFactoryModule = <T>(\n value: T\n): value is T & ((...args: never[]) => FolderMeta) =>\n typeof value === \"function\";\n\n/** Where a locale's generated meta module lives (always written as `meta.ts`). */\nexport const metaTargetPath = (\n meta: TranslatableMeta,\n locale: string\n): string => join(meta.contentRoot, locale, meta.dir, \"meta.ts\");\n\n/**\n * Discover the default-locale `meta.{ts,js,mjs}` files whose titles a\n * translation run covers. Skips (in order): non-`dir` i18n projects entirely,\n * files inside a configured locale directory (those ARE translations), files\n * inside an archived-version snapshot (frozen, with their own translations —\n * the same folders the navigation's meta lookup hoists as versions),\n * factory-form modules (a warning — the generator can't re-emit a function),\n * modules that fail meta validation (the scan already errors on those), and\n * modules with no `title` (nothing to translate).\n */\nexport const discoverTranslatableMeta = async (\n project: BlumeProject\n): Promise<{ metas: TranslatableMeta[]; diagnostics: Diagnostic[] }> => {\n const { i18n } = project.config;\n if (!i18n || i18n.parser !== \"dir\") {\n return { diagnostics: [], metas: [] };\n }\n const localeDirs = new Set(\n i18n.locales.flatMap((locale) =>\n locale.code === i18n.defaultLocale ? [] : [locale.code.toLowerCase()]\n )\n );\n const versionDirs = new Set(\n project.config.versions?.archived.map((version) => version.id)\n );\n\n const load = createModuleLoader();\n const metas: TranslatableMeta[] = [];\n const diagnostics: Diagnostic[] = [];\n\n const roots = project.sources.flatMap((source) =>\n source.staged || !source.contentRoot ? [] : [source.contentRoot]\n );\n for (const contentRoot of roots) {\n // oxlint-disable-next-line no-await-in-loop -- a project has O(1) sources\n const files = await glob(META_FILES, {\n absolute: true,\n cwd: contentRoot,\n ignore: [\"**/node_modules/**\", \"**/.blume/**\", \"**/dist/**\"],\n onlyFiles: true,\n });\n for (const file of files.toSorted()) {\n const dir = relative(contentRoot, dirname(file));\n const [head] = dir.split(\"/\");\n if (\n head &&\n (localeDirs.has(head.toLowerCase()) || versionDirs.has(head))\n ) {\n continue;\n }\n // oxlint-disable-next-line no-await-in-loop -- sequential, ordered discovery\n const [raw, mod] = await Promise.all([\n readFile(file, \"utf-8\"),\n load(file),\n ]);\n if (isFactoryModule(mod)) {\n diagnostics.push({\n code: \"BLUME_TRANSLATE_META_FACTORY\",\n file,\n message:\n \"This meta file default-exports a function, so `blume translate` cannot generate per-locale copies of it.\",\n severity: \"warning\",\n suggestion:\n \"Export a plain object, or author the locale's meta file by hand.\",\n });\n continue;\n }\n const parsed = folderMetaSchema.safeParse(mod);\n if (!parsed.success || parsed.data.title === undefined) {\n continue;\n }\n metas.push({\n contentRoot,\n data: parsed.data,\n dir: dir === \".\" ? \"\" : dir,\n file,\n raw,\n sourceRel: relative(project.context.root, file),\n title: parsed.data.title,\n });\n }\n }\n return { diagnostics, metas };\n};\n\n/**\n * Emit the per-locale meta module: every source key copied verbatim, only the\n * title swapped for its translation. Keys alphabetical, values as JSON.\n */\nexport const generateMetaModule = (\n meta: FolderMeta,\n translatedTitle: string\n): string => {\n const data = {\n ...meta,\n title: translatedTitle,\n };\n const lines = Object.entries(data)\n .toSorted(([a], [b]) => (a < b ? -1 : 1))\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => ` ${key}: ${JSON.stringify(value)},`);\n return [\n \"// Generated by `blume translate` — edit the default locale's meta file\",\n \"// and rerun the translation instead of editing this copy.\",\n \"export default {\",\n ...lines,\n \"};\",\n \"\",\n ].join(\"\\n\");\n};\n",
11
+ "import type { LocaleConfig } from \"../core/schema.ts\";\n\n/**\n * The frontmatter key paths whose *values* an agent may translate. Everything\n * else in the frontmatter is copied from the source verbatim by the validator,\n * so this list is both the prompt's instruction and the reconciliation\n * contract in `validate.ts`.\n */\nexport const TRANSLATABLE_KEY_PATHS: readonly (readonly string[])[] = [\n [\"title\"],\n [\"description\"],\n [\"sidebar\", \"label\"],\n [\"sidebar\", \"badge\"],\n [\"seo\", \"title\"],\n [\"seo\", \"description\"],\n];\n\n/** \"French (fr)\" — the configured display label plus the code. */\nconst localeName = (locale: LocaleConfig): string =>\n `${locale.label} (${locale.code})`;\n\nconst KEY_LIST = TRANSLATABLE_KEY_PATHS.map((path) => path.join(\".\")).join(\n \", \"\n);\n\n/**\n * The page-translation prompt. Delivered over stdin (no argv limits), so the\n * full source file rides along inline. When the page was translated before,\n * the previous translation rides along too: without it, every retranslation\n * is a from-scratch rewrite in which the agent re-decides register, dialect,\n * and terminology (du vs Sie, pt-BR vs pt-PT) and churns the whole page for\n * a one-paragraph source edit.\n */\nexport const pagePrompt = (\n sourceText: string,\n target: LocaleConfig,\n source: LocaleConfig,\n previousTranslation?: string\n): string => {\n const styleRule =\n target.style === undefined\n ? \"\"\n : `\n- Write the translation in this style: ${target.style}`;\n const previousRule =\n previousTranslation === undefined\n ? \"\"\n : `\n- A translation of an earlier revision of this page is included below. Match its register, formality, dialect, and terminology exactly; re-translate only what the changed source requires and keep everything else word-for-word identical.${\n target.style === undefined\n ? \"\"\n : \" Where the previous translation disagrees with the style rule above, the style rule wins.\"\n }`;\n const previousSection =\n previousTranslation === undefined\n ? \"\"\n : `\nThe previous translation begins after this line and ends at the \"page source\" marker.\n${previousTranslation}`;\n return `Translate the following documentation page from ${localeName(\n source\n )} into ${localeName(target)}.\n\nRules:\n- Translate the prose: headings, paragraphs, list items, table cells, admonitions, and image alt text.\n- In the YAML frontmatter, translate ONLY the values of these keys: ${KEY_LIST}. Copy every other frontmatter key and value exactly as written.\n- Never translate or alter: code blocks, inline code, import/export statements, JSX/MDX component names and their attributes, URLs, link targets, HTML tags, or frontmatter keys.\n- A heading may end with anchor markers: \\`[#some-id]\\`, \\`{#some-id}\\` (also written \\`\\\\{#some-id\\\\}\\`), \\`[!toc]\\`, or \\`[toc]\\`. Copy every marker exactly as written, in the same position at the end of the translated heading — never translate, reorder, or drop a marker, and never change the id inside \\`[#...]\\` or \\`{#...}\\` (anchors must stay identical across languages).\n\n- Preserve the document structure exactly: the same headings, the same lists and tables, and the same number of code fences.${styleRule}${previousRule}\n- Output ONLY the complete translated file. Do not wrap it in a code fence. Do not add commentary before or after it.\n${previousSection}\nThe page source begins after this line.\n${sourceText}`;\n};\n\n/**\n * The sidebar-titles prompt: a JSON object of `{directory: title}` in, the\n * same keys with translated values out.\n */\nexport const metaPrompt = (\n titles: Record<string, string>,\n target: LocaleConfig,\n source: LocaleConfig\n): string => `Translate the following documentation sidebar section titles from ${localeName(\n source\n)} into ${localeName(target)}.\n\nThe input is a JSON object mapping a directory path to its title. Reply with ONLY a JSON object that has exactly the same keys, where each value is the title translated into ${localeName(\n target\n)}. Do not translate the keys. Do not add commentary.${\n target.style === undefined\n ? \"\"\n : `\\nWrite the titles in this style: ${target.style}`\n}\n\n${JSON.stringify(titles, null, 2)}`;\n",
12
+ "import { scanBody } from \"../core/sources/normalize.ts\";\n\n/**\n * Keep heading anchors identical across languages. A translated heading slugs\n * to a different id (`## Ordering` → `#ordering`, `## Reihenfolge` →\n * `#reihenfolge`), so a `/guide#ordering` link — which the runtime keeps\n * inside the reader's locale — would land at the top of the translated page.\n * After a translation validates, every heading whose rendered id would differ\n * from its source counterpart gets the source id pinned as a trailing\n * `[#id]` marker, so the anchor index (and every `#fragment` link) agrees in\n * every locale. Headings the translation already pins are left alone: the\n * agent is told to copy markers verbatim, and a hand-authored pin is the\n * translator's choice.\n *\n * Headings pair positionally, so the translation must mirror the source's\n * heading structure (the prompt demands exactly that); when it doesn't, no\n * pins are added and the text is returned unchanged with a reason.\n */\n\nexport interface PinResult {\n /** Number of headings that received a pin. */\n pinned: number;\n /** Why no pins were added, when the structures don't line up. */\n skipped?: string;\n text: string;\n}\n\n/** An ATX heading's optional closing hash run, which a marker must precede. */\nconst ATX_CLOSE = /\\s+#+$/u;\n\nconst structureOf = (headings: readonly { depth: number }[]): string =>\n headings.map((heading) => heading.depth).join(\",\");\n\n/** Append `[#id]` to a heading line, ahead of any closing `##` and line end. */\nconst pinLine = (line: string, id: string): string => {\n const eol = line.endsWith(\"\\r\") ? \"\\r\" : \"\";\n const body = line.slice(0, line.length - eol.length).trimEnd();\n const close = body.match(ATX_CLOSE)?.[0] ?? \"\";\n const head = body.slice(0, body.length - close.length);\n return `${head} [#${id}]${close}${eol}`;\n};\n\nexport const pinHeadingAnchors = (\n sourceText: string,\n translatedText: string\n): PinResult => {\n const source = scanBody(sourceText);\n const translated = scanBody(translatedText);\n if (structureOf(source.headings) !== structureOf(translated.headings)) {\n return {\n pinned: 0,\n skipped: `heading structure differs (source has ${source.headings.length} headings, translation has ${translated.headings.length})`,\n text: translatedText,\n };\n }\n\n const lines = translatedText.split(\"\\n\");\n let pinned = 0;\n for (const [index, heading] of translated.headings.entries()) {\n const site = translated.sites[index];\n const sourceId = source.headings[index]?.slug;\n if (\n !site ||\n site.pinned ||\n sourceId === undefined ||\n heading.slug === sourceId\n ) {\n continue;\n }\n lines[site.line - 1] = pinLine(lines[site.line - 1] ?? \"\", sourceId);\n pinned += 1;\n }\n if (pinned === 0) {\n return { pinned, text: translatedText };\n }\n\n // The pins must reproduce the source ids exactly once rendered; anything\n // else (a heading the line-based rewrite couldn't reach) keeps the text as\n // the agent wrote it rather than shipping a half-pinned page.\n const text = lines.join(\"\\n\");\n const rendered = scanBody(text).headings.map((heading) => heading.slug);\n const expected = source.headings.map((heading) => heading.slug);\n if (rendered.join(\"\\n\") !== expected.join(\"\\n\")) {\n return {\n pinned: 0,\n skipped: \"pinned anchors did not reproduce the source heading ids\",\n text: translatedText,\n };\n }\n return { pinned, text };\n};\n",
13
+ "import matter from \"../core/frontmatter.ts\";\nimport { pinHeadingAnchors } from \"./anchors.ts\";\nimport { TRANSLATABLE_KEY_PATHS } from \"./prompts.ts\";\n\n/**\n * Structural validation of agent output. The agent is never trusted for\n * structure: the final frontmatter is *reconstructed* from the source (clone\n * the source data, overlay only the translatable string values), so invented\n * keys are dropped, deleted keys are restored, and slugs/icons/orders/dates\n * stay source-verbatim by construction. Only then is the file written.\n */\n\nexport type ValidationResult =\n | { ok: true; text: string }\n | { ok: false; reason: string };\n\n/**\n * A parsed YAML frontmatter value (agent meta replies parse from JSON into the\n * same shape). js-yaml can also mint Dates and other rich scalars; the\n * traversal below only ever distinguishes \"keyed object\" from \"string\", so\n * they ride along as the object arm.\n */\ntype FrontmatterValue =\n | string\n | number\n | boolean\n | null\n | FrontmatterValue[]\n | FrontmatterData;\n\ninterface FrontmatterData {\n [key: string]: FrontmatterValue;\n}\n\nconst FRONTMATTER_OPEN = /^---\\r?\\n/u;\nconst FENCE_LINE = /^\\s*(?:```|~~~)/u;\n\n/**\n * Strip exactly one symmetric outer code fence (any info string) — the one\n * wrapper agents add despite being told not to. Anything else (no fence, or a\n * fence that isn't the entire output) is returned trimmed and untouched.\n */\nexport const stripOuterFence = (text: string): string => {\n const trimmed = text.trim();\n const match = trimmed.match(\n /^(?<fence>`{3,}|~{3,})[^\\n]*\\n(?<inner>[\\s\\S]*?)\\n\\k<fence>\\s*$/u\n );\n return match?.groups?.inner ?? trimmed;\n};\n\n/** Lines opening or closing a code fence; their count must survive translation. */\nconst countFenceLines = (text: string): number =>\n text.split(\"\\n\").filter((line) => FENCE_LINE.test(line)).length;\n\nconst isKeyedObject = (\n value: FrontmatterValue | undefined\n): value is FrontmatterData => typeof value === \"object\" && value !== null;\n\nconst isString = (value: FrontmatterValue | undefined): value is string =>\n typeof value === \"string\";\n\nconst getPath = (\n data: FrontmatterValue,\n path: readonly string[]\n): FrontmatterValue | undefined => {\n let value: FrontmatterValue | undefined = data;\n for (const key of path) {\n if (!isKeyedObject(value)) {\n return;\n }\n value = value[key];\n }\n return value;\n};\n\n/** Set `path` on `data`; only called for paths whose parents exist in `data`. */\nconst setPath = (\n data: FrontmatterData,\n path: readonly string[],\n value: string\n): void => {\n let parent = data;\n for (const key of path.slice(0, -1)) {\n // SAFETY: callers only set paths that getPath already resolved to a string\n // on this same (cloned) data, so every intermediate step is a keyed object.\n parent = parent[key] as FrontmatterData;\n }\n // SAFETY: every TRANSLATABLE_KEY_PATHS entry is a non-empty tuple, so the\n // path always has a final key.\n parent[path.at(-1) as string] = value;\n};\n\nconst ensureTrailingNewline = (text: string): string =>\n text.endsWith(\"\\n\") ? text : `${text}\\n`;\n\n/**\n * Validate one translated page against its source and reassemble the file to\n * write. Fails (no write happens) on empty output, unparseable or missing\n * frontmatter, an empty body, or a changed code-fence count.\n */\nexport const validateTranslation = (\n sourceText: string,\n agentText: string\n): ValidationResult => {\n // Only a fence the agent added is stripped. A source that is itself one\n // code block (a frontmatter-less partial holding a single bash block)\n // starts and ends with its own fence, which the translation must keep — so\n // for such a source the reply loses its outer fence only when it has more\n // fence lines than the source.\n const sourceIsFenced = stripOuterFence(sourceText) !== sourceText.trim();\n const candidate =\n sourceIsFenced && countFenceLines(agentText) <= countFenceLines(sourceText)\n ? agentText.trim()\n : stripOuterFence(agentText);\n if (candidate === \"\") {\n return { ok: false, reason: \"agent returned empty output\" };\n }\n\n const sourceHasFrontmatter = FRONTMATTER_OPEN.test(sourceText);\n const source = matter(sourceText);\n\n if (sourceHasFrontmatter && !FRONTMATTER_OPEN.test(candidate)) {\n return {\n ok: false,\n reason: \"translation dropped the frontmatter (must start with ---)\",\n };\n }\n\n let parsed: { content: string; data: FrontmatterData };\n try {\n parsed = matter(candidate);\n } catch {\n return { ok: false, reason: \"frontmatter does not parse as YAML\" };\n }\n\n const rawBody = ensureTrailingNewline(parsed.content.replace(/^\\r?\\n/u, \"\"));\n if (rawBody.trim() === \"\") {\n return { ok: false, reason: \"translation has an empty body\" };\n }\n\n const sourceFences = countFenceLines(source.content);\n const candidateFences = countFenceLines(rawBody);\n if (sourceFences !== candidateFences) {\n return {\n ok: false,\n reason: `code fence count changed (source has ${sourceFences}, translation has ${candidateFences})`,\n };\n }\n\n // Anchors stay identical across languages: each translated heading is\n // pinned to its source heading's id (see `anchors.ts`).\n const body = pinHeadingAnchors(source.content, rawBody).text;\n\n if (!sourceHasFrontmatter) {\n // A frontmatter-less source writes the body alone; any frontmatter the\n // agent invented is dropped with it.\n return { ok: true, text: body };\n }\n\n // Reconciliation by reconstruction: start from the SOURCE data and overlay\n // only the translatable key paths where both sides hold a string and the\n // translation is non-empty.\n const data: FrontmatterData = structuredClone(source.data);\n for (const path of TRANSLATABLE_KEY_PATHS) {\n const original = getPath(source.data, path);\n const translated = getPath(parsed.data, path);\n if (\n isString(original) &&\n isString(translated) &&\n translated.trim() !== \"\"\n ) {\n setPath(data, path, translated);\n }\n }\n\n return {\n ok: true,\n text: ensureTrailingNewline(matter.stringify(body, data)),\n };\n};\n\n/** A meta-batch parse: recovered titles by key, plus the keys still missing. */\nexport interface MetaTitlesResult {\n titles: Record<string, string>;\n missing: string[];\n}\n\n/**\n * Extract translated sidebar titles from a meta reply: tolerant first-`{`\n * to-last-`}` extraction (the eval `parseVerdict` idiom). Keys missing or\n * non-string in the reply land in `missing`, so a batch can partially succeed.\n */\nexport const parseMetaTitles = (\n agentText: string,\n expectedKeys: readonly string[]\n): MetaTitlesResult => {\n const start = agentText.indexOf(\"{\");\n const end = agentText.lastIndexOf(\"}\");\n let parsed: FrontmatterValue | undefined;\n if (start !== -1 && end > start) {\n try {\n parsed = JSON.parse(agentText.slice(start, end + 1));\n } catch {\n parsed = undefined;\n }\n }\n const record: FrontmatterData = isKeyedObject(parsed) ? parsed : {};\n\n const titles: Record<string, string> = {};\n const missing: string[] = [];\n for (const key of expectedKeys) {\n const value = record[key];\n if (isString(value) && value.trim() !== \"\") {\n titles[key] = value;\n } else {\n missing.push(key);\n }\n }\n return { missing, titles };\n};\n",
14
+ "import { existsSync, readdirSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\n\nimport { dirname, extname, join, relative } from \"pathe\";\n\nimport { localeCodes, localeTargetPath } from \"../core/i18n.ts\";\nimport { scanProject } from \"../core/project-graph.ts\";\nimport type { BlumeProject } from \"../core/project-graph.ts\";\nimport type { Diagnostic, PageRecord } from \"../core/types.ts\";\nimport { hashSource } from \"./ledger.ts\";\nimport type { TranslationLedger } from \"./ledger.ts\";\nimport { discoverTranslatableMeta, metaTargetPath } from \"./meta.ts\";\nimport type { TranslatableMeta } from \"./meta.ts\";\n\n/**\n * Classification of every (source, target locale) pair:\n * - `missing` — no non-fallback page record for (translationKey, locale).\n * Existence is the graph record, never a disk probe, so a hand-authored\n * translation at a non-canonical name still counts as existing.\n * - `stale` — a record exists, but the ledger hash differs from the current\n * source hash (the source changed since its last translation).\n * - up-to-date — hashes match (counted, not itemized).\n * - untracked — a record exists with no ledger entry: a pre-existing human\n * translation. Adopted (stamped at the current hash), never overwritten;\n * only `--force` retranslates it.\n */\nexport type WorkStatus = \"missing\" | \"stale\";\n\nexport interface PageWorkItem {\n kind: \"page\";\n /** Target locale code (configured casing). */\n locale: string;\n /** Absolute path of the default-locale source file. */\n sourcePath: string;\n /** POSIX root-relative source path — the ledger key. */\n sourceRel: string;\n status: WorkStatus;\n /** Absolute canonical target path (`localeTargetPath`). */\n targetPath: string;\n /** POSIX root-relative target path, for display. */\n targetRel: string;\n /** Copy the file unchanged instead of translating it — a non-markdown\n * include partial (code embed) has no prose, but must still exist in each\n * locale tree so the translated pages' relative includes resolve. */\n verbatim?: boolean;\n}\n\n/** One meta file needing its title in one locale, inside a `MetaWorkItem`. */\nexport interface MetaWorkEntry {\n meta: TranslatableMeta;\n status: WorkStatus;\n /** Absolute path of the generated per-locale `meta.ts`. */\n targetPath: string;\n}\n\n/** All of one locale's needed meta titles — a single agent call. */\nexport interface MetaWorkItem {\n kind: \"meta\";\n entries: MetaWorkEntry[];\n locale: string;\n}\n\nexport type WorkItem = MetaWorkItem | PageWorkItem;\n\n/** A pre-existing translation with no ledger entry, to adopt (stamp) as-is. */\nexport interface UntrackedEntry {\n /** The current source hash to stamp. */\n hash: string;\n kind: \"meta\" | \"page\";\n locale: string;\n sourceRel: string;\n}\n\nexport interface TranslateWorkList {\n diagnostics: Diagnostic[];\n items: WorkItem[];\n /** Every ledger key in the current universe (for pruning). */\n knownSources: Set<string>;\n /** The locales this run targets (configured casing, default excluded). */\n targetLocales: string[];\n untracked: UntrackedEntry[];\n /** Count of (source, locale) pairs already translated and current. */\n upToDate: number;\n}\n\nconst PAGE_EXTENSIONS = new Set([\".md\", \".mdx\"]);\n\n/**\n * The names in each content root, read once per root: a locale folder authored\n * in another casing (`pt-br/` for `pt-BR`) is where `localeTargetPath` puts\n * that locale's translations.\n */\nconst rootFolders = (): ((contentRoot: string) => string[]) => {\n const read = new Map<string, string[]>();\n return (contentRoot) => {\n const cached = read.get(contentRoot);\n if (cached) {\n return cached;\n }\n const names = readdirSync(contentRoot);\n read.set(contentRoot, names);\n return names;\n };\n};\n\n/**\n * Scan the project for a translation run: drafts included. A production\n * (`build`) scan drops them, so a hand-written translation marked\n * `draft: true` would look missing and be overwritten, and a source page\n * drafted for a while would lose its ledger stamps — its outdated\n * translations then reading as current once it's published again. A dev scan\n * keeps drafts and differs only in reusing cached remote content, which\n * translation never reads.\n */\nexport const scanForTranslation = (root: string): Promise<BlumeProject> =>\n scanProject(root, { mode: \"dev\" });\n\n/**\n * The translatable page universe: filesystem-backed default-locale pages.\n * Remote/staged sources have no writable path; fallback records are padding;\n * a `.$.` shared file already materializes into every locale.\n */\nconst translatablePages = (\n project: BlumeProject,\n i18n: NonNullable<BlumeProject[\"config\"][\"i18n\"]>\n): {\n page: PageRecord;\n contentRoot: string;\n ext: string;\n sourcePath: string;\n}[] => {\n const rootsByName = new Map(\n project.sources.flatMap((source) =>\n source.staged || !source.contentRoot\n ? []\n : [[source.name, source.contentRoot] as const]\n )\n );\n const seen = new Set<string>();\n const universe: {\n page: PageRecord;\n contentRoot: string;\n ext: string;\n sourcePath: string;\n }[] = [];\n for (const page of project.graph.pages) {\n if (\n page.locale !== i18n.defaultLocale ||\n page.fallback ||\n !page.sourcePath ||\n seen.has(page.sourcePath) ||\n // Archived snapshots are frozen and carry their own translations —\n // they are never (re)translated. (`localeTargetPath` would also compute\n // `fr/v1.0/…` where the snapshot's translation lives at `v1.0/fr/…`.)\n page.version !== \"\"\n ) {\n continue;\n }\n const ext = extname(page.sourcePath);\n const base = page.sourcePath.slice(0, page.sourcePath.length - ext.length);\n const contentRoot = rootsByName.get(page.source.name);\n if (!PAGE_EXTENSIONS.has(ext) || base.endsWith(\".$\") || !contentRoot) {\n continue;\n }\n seen.add(page.sourcePath);\n universe.push({ contentRoot, ext, page, sourcePath: page.sourcePath });\n }\n return universe;\n};\n\n/** Outcome of classifying one (source, locale) pair against the ledger:\n * a work status, an existing translation to adopt, or already current. */\ntype PairOutcome = WorkStatus | \"current\" | \"untracked\";\n\n/** The shared pair classifier — see the WorkStatus doc for the taxonomy. */\nconst classifyPair = (\n exists: boolean,\n stamp: string | undefined,\n hash: string,\n force: boolean\n): PairOutcome => {\n if (!exists) {\n return \"missing\";\n }\n if (stamp === undefined) {\n return force ? \"stale\" : \"untracked\";\n }\n return stamp !== hash || force ? \"stale\" : \"current\";\n};\n\n/** The classified work for the include partials the pages reference. */\ninterface PartialWork {\n items: PageWorkItem[];\n /** Ledger keys to add to the run's known-source universe. */\n sources: string[];\n untracked: UntrackedEntry[];\n upToDate: number;\n}\n\n/**\n * Work for the include partials referenced by the translatable pages. Under\n * the `dir` parser each locale is its own tree, so a translated page's\n * relative `<include>` resolves *inside the locale tree* — the partial must\n * exist there too, or the next build fails with BLUME_INCLUDE_NOT_FOUND on\n * every locale. (Under `dot` the translated file sits beside its source and\n * the shared partial already resolves; nothing to do.) Markdown partials are\n * translated like pages; anything else (code embeds) is copied verbatim. A\n * partial that is itself a page is skipped — its own translation already\n * lands at the mirrored path. Existence is a disk probe: partials have no\n * page records to consult.\n */\nconst partialWorkItems = async (\n universe: ReturnType<typeof translatablePages>,\n project: BlumeProject,\n i18n: NonNullable<BlumeProject[\"config\"][\"i18n\"]>,\n ledger: TranslationLedger,\n targetLocales: string[],\n force: boolean\n): Promise<PartialWork> => {\n const work: PartialWork = {\n items: [],\n sources: [],\n untracked: [],\n upToDate: 0,\n };\n if (i18n.parser !== \"dir\") {\n return work;\n }\n const { root } = project.context;\n const pagePaths = new Set(\n project.graph.pages.flatMap((page) =>\n page.sourcePath ? [page.sourcePath] : []\n )\n );\n const folders = rootFolders();\n const partials = new Map<string, string>();\n for (const { page, contentRoot } of universe) {\n for (const partial of page.includes ?? []) {\n if (!(pagePaths.has(partial) || partials.has(partial))) {\n partials.set(partial, contentRoot);\n }\n }\n }\n for (const [partialPath, contentRoot] of partials) {\n const sourceRel = relative(root, partialPath);\n work.sources.push(sourceRel);\n // oxlint-disable-next-line no-await-in-loop -- one read per partial\n const hash = hashSource(await readFile(partialPath, \"utf-8\"));\n const ext = extname(partialPath);\n const verbatim = !PAGE_EXTENSIONS.has(ext.toLowerCase());\n const contentRel = relative(contentRoot, partialPath);\n for (const locale of targetLocales) {\n const targetPath = join(\n contentRoot,\n localeTargetPath(contentRel, ext, locale, i18n, folders(contentRoot))\n );\n const item = (status: WorkStatus): PageWorkItem => {\n const partialItem: PageWorkItem = {\n kind: \"page\",\n locale,\n sourcePath: partialPath,\n sourceRel,\n status,\n targetPath,\n targetRel: relative(root, targetPath),\n };\n if (verbatim) {\n partialItem.verbatim = true;\n }\n return partialItem;\n };\n const stamp = ledger.files[sourceRel]?.[locale];\n const outcome = classifyPair(existsSync(targetPath), stamp, hash, force);\n if (outcome === \"untracked\") {\n work.untracked.push({ hash, kind: \"page\", locale, sourceRel });\n } else if (outcome === \"current\") {\n work.upToDate += 1;\n } else {\n work.items.push(item(outcome));\n }\n }\n }\n return work;\n};\n\n/**\n * Compute the run's work: which (source, locale) pairs are missing or stale,\n * which existing translations to adopt, and what's already up to date.\n * `force` promotes every pair to work; `locales` narrows the targets.\n */\nexport const computeWorkList = async (\n project: BlumeProject,\n ledger: TranslationLedger,\n options: { force?: boolean; locales?: string[] } = {}\n): Promise<TranslateWorkList> => {\n const { i18n } = project.config;\n if (!i18n) {\n return {\n diagnostics: [],\n items: [],\n knownSources: new Set(),\n targetLocales: [],\n untracked: [],\n upToDate: 0,\n };\n }\n const targetLocales = localeCodes(i18n).filter(\n (code) =>\n code !== i18n.defaultLocale &&\n (options.locales === undefined || options.locales.includes(code))\n );\n\n const translated = new Set(\n project.graph.pages.flatMap((page) =>\n page.fallback ? [] : [`${page.translationKey}\u0000${page.locale}`]\n )\n );\n\n const { root } = project.context;\n const knownSources = new Set<string>();\n const untracked: UntrackedEntry[] = [];\n const pageItems: PageWorkItem[] = [];\n let upToDate = 0;\n\n const universe = translatablePages(project, i18n);\n const folders = rootFolders();\n\n for (const { page, contentRoot, ext, sourcePath } of universe) {\n const sourceRel = relative(root, sourcePath);\n knownSources.add(sourceRel);\n // oxlint-disable-next-line no-await-in-loop -- one read per source file\n const hash = hashSource(await readFile(sourcePath, \"utf-8\"));\n const contentRel = relative(contentRoot, sourcePath);\n\n for (const locale of targetLocales) {\n const targetPath = join(\n contentRoot,\n localeTargetPath(contentRel, ext, locale, i18n, folders(contentRoot))\n );\n const item = (status: WorkStatus): PageWorkItem => ({\n kind: \"page\",\n locale,\n sourcePath,\n sourceRel,\n status,\n targetPath,\n targetRel: relative(root, targetPath),\n });\n const exists = translated.has(`${page.translationKey}\u0000${locale}`);\n const stamp = ledger.files[sourceRel]?.[locale];\n const outcome = classifyPair(exists, stamp, hash, options.force === true);\n if (outcome === \"untracked\") {\n untracked.push({ hash, kind: \"page\", locale, sourceRel });\n } else if (outcome === \"current\") {\n upToDate += 1;\n } else {\n pageItems.push(item(outcome));\n }\n }\n }\n\n const partialWork = await partialWorkItems(\n universe,\n project,\n i18n,\n ledger,\n targetLocales,\n options.force ?? false\n );\n for (const rel of partialWork.sources) {\n knownSources.add(rel);\n }\n pageItems.push(...partialWork.items);\n untracked.push(...partialWork.untracked);\n upToDate += partialWork.upToDate;\n\n const meta = await discoverTranslatableMeta(project);\n const metaItems: MetaWorkItem[] = [];\n for (const locale of targetLocales) {\n const entries: MetaWorkEntry[] = [];\n for (const source of meta.metas) {\n knownSources.add(source.sourceRel);\n const targetDir = dirname(metaTargetPath(source, locale));\n const exists = [\"meta.ts\", \"meta.js\", \"meta.mjs\"].some((name) =>\n existsSync(join(targetDir, name))\n );\n const hash = hashSource(source.raw);\n const stamp = ledger.files[source.sourceRel]?.[locale];\n const entry = (status: WorkStatus): MetaWorkEntry => ({\n meta: source,\n status,\n targetPath: metaTargetPath(source, locale),\n });\n const outcome = classifyPair(exists, stamp, hash, options.force === true);\n if (outcome === \"untracked\") {\n untracked.push({\n hash,\n kind: \"meta\",\n locale,\n sourceRel: source.sourceRel,\n });\n } else if (outcome === \"current\") {\n upToDate += 1;\n } else {\n entries.push(entry(outcome));\n }\n }\n if (entries.length > 0) {\n metaItems.push({ entries, kind: \"meta\", locale });\n }\n }\n\n pageItems.sort((a, b) =>\n a.sourceRel === b.sourceRel\n ? a.locale.localeCompare(b.locale)\n : a.sourceRel.localeCompare(b.sourceRel)\n );\n metaItems.sort((a, b) => a.locale.localeCompare(b.locale));\n\n return {\n diagnostics: meta.diagnostics,\n items: [...pageItems, ...metaItems],\n knownSources,\n targetLocales,\n untracked,\n upToDate,\n };\n};\n"
15
+ ],
16
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACiBO,IAAM,+BAA+B;AAE5C,IAAM,aAAa,MAAgB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,iBAAiB,KAAK,GAAG;AAAA,EACzB;AAAA,EACA;AACF;AAMA,IAAM,YAAY,CAAC,oBAAsC;AAAA,EACvD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AAAA,EACH;AAAA,EACA;AAAA,EACA;AACF;AAOO,IAAM,qBAAqB,CAChC,MACA,oBACc,SAAS,WAAW,WAAW,IAAI,UAAU,eAAe;;;ACvD5E;AACA;AAEA;AACA;AAYO,IAAM,cAAc;AAW3B,IAAM,eAAe,EAAE,OAAO;AAAA,EAC5B,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC;AAAA,EAC5D,SAAS,EAAE,QAAQ,CAAC;AACtB,CAAC;AAEM,IAAM,cAAc,OAA0B;AAAA,EACnD,OAAO,CAAC;AAAA,EACR,SAAS;AACX;AAWO,IAAM,aAAa,CAAC,SACzB,WAAW,QAAQ,EAChB,OAAO,KAAK,WAAW;AAAA,GAA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"./chunk-6k4ftwze.js";
15
15
  import {
16
16
  YAML_SCHEMA
17
- } from "./chunk-xaz13gwg.js";
18
- import"./chunk-jts8mvcz.js";
17
+ } from "./chunk-v6ya5kcb.js";
18
+ import"./chunk-gs7r695n.js";
19
19
  import {
20
20
  scanProject
21
- } from "./chunk-zg2gtj10.js";
21
+ } from "./chunk-5r8g91qn.js";
22
22
  import {
23
23
  buildMcpData
24
- } from "./chunk-a9kptbw5.js";
24
+ } from "./chunk-ddndchfr.js";
25
25
  import {
26
26
  seconds,
27
27
  money,
@@ -31,7 +31,7 @@ import {
31
31
  agentArgs,
32
32
  readAgentOutput,
33
33
  parseVerdict
34
- } from "./chunk-fa25z98p.js";
34
+ } from "./chunk-273ygyr4.js";
35
35
 
36
36
  // src/cli/commands/eval.ts
37
37
  import { existsSync } from "node:fs";
@@ -398,6 +398,18 @@ var runQuestion = async (question, index, context) => {
398
398
  status: verdict.pass ? "pass" : "fail"
399
399
  };
400
400
  };
401
+ var MISS_CODES = new Set([
402
+ "BLUME_EVAL_QUESTION_ERROR",
403
+ "BLUME_EVAL_QUESTION_FAILED"
404
+ ]);
405
+ var passFraction = (result) => {
406
+ const ran = result.results.length - result.counts.skip;
407
+ if (ran === 0) {
408
+ return 1;
409
+ }
410
+ const misses = result.diagnostics.filter((diagnostic) => MISS_CODES.has(diagnostic.code) && diagnostic.severity === "error").length;
411
+ return (ran - misses) / ran;
412
+ };
401
413
  var runEval = async (options) => {
402
414
  const started = performance.now();
403
415
  const kind = options.agent;
@@ -494,13 +506,9 @@ var launchAgentCode = async (agent, prompt) => {
494
506
  return notInstalled(agent);
495
507
  }
496
508
  };
497
- var passFraction = (result) => {
498
- const ran = result.results.length - result.counts.skip;
499
- return ran === 0 ? 1 : result.counts.pass / ran;
500
- };
501
509
  var parseFlags = (args) => {
502
510
  if (!isAgentKind(args.agent)) {
503
- logger.error(`Invalid --agent "${args.agent}" (use claude | codex).`);
511
+ logger.error(`Invalid --agent "${args.agent}" (use codex | claude).`);
504
512
  process.exit(1);
505
513
  }
506
514
  if (args.action !== undefined && args.action !== "init") {
@@ -557,8 +565,8 @@ var evalCommand = defineCommand({
557
565
  type: "positional"
558
566
  },
559
567
  agent: {
560
- default: "claude",
561
- description: "Agent CLI that reads and grades the docs: claude | codex.",
568
+ default: "codex",
569
+ description: "Agent CLI that reads and grades the docs: codex | claude.",
562
570
  type: "string"
563
571
  },
564
572
  file: {
@@ -669,9 +677,8 @@ var evalCommand = defineCommand({
669
677
  }
670
678
  });
671
679
  export {
672
- evalCommand,
673
- passFraction
680
+ evalCommand
674
681
  };
675
682
 
676
- //# debugId=141822DD5472C23264756E2164756E21
677
- //# sourceMappingURL=chunk-d80hr03s.js.map
683
+ //# debugId=8BEFEDC6126861D064756E2164756E21
684
+ //# sourceMappingURL=chunk-ppzjqwx2.js.map
@@ -2,14 +2,14 @@
2
2
  "version": 3,
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
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, reportDiagnostics } 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 reportDiagnostics([error.diagnostic], root);\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",
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 { passFraction, 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, reportDiagnostics } 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\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 codex | claude).`);\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: \"codex\",\n description: \"Agent CLI that reads and grades the docs: codex | claude.\",\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 reportDiagnostics([error.diagnostic], root);\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
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
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/**\n * `fix:` pointers for failed questions, naming the file that resolves each. A\n * question whose agent run errored gets a `run failed:` line pointing at the\n * question instead: the run never graded the docs, so there's no page to fix.\n */\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 const label =\n finding.code === \"BLUME_EVAL_QUESTION_ERROR\"\n ? colors.red(\"run failed:\")\n : colors.cyan(\"fix:\");\n return ` ${label} ${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",
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/** The findings a missed question produces: failed, or its agent run errored. */\nconst MISS_CODES: ReadonlySet<string> = new Set([\n \"BLUME_EVAL_QUESTION_ERROR\",\n \"BLUME_EVAL_QUESTION_FAILED\",\n]);\n\n/**\n * The fraction of run (non-skipped) questions that pass the CI gate. A miss on\n * a `severity: warning` question is reported as a warning and never counts\n * against the gate — each miss's finding carries its question's severity, so\n * the gate reads the same findings the JSON summary counts, and the exit code\n * can't disagree with the summary's error total.\n */\nexport const passFraction = (result: EvalResult): number => {\n const ran = result.results.length - result.counts.skip;\n if (ran === 0) {\n return 1;\n }\n const misses = result.diagnostics.filter(\n (diagnostic) =>\n MISS_CODES.has(diagnostic.code) && diagnostic.severity === \"error\"\n ).length;\n return (ran - misses) / ran;\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
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
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/cli/evals\";\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. A failure is anchored to\n * the page that should have answered it (via the first matching route hint)\n * or, failing that, to the question's line in the evals file. An errored run —\n * the agent crashed, timed out, or answered in a shape Blume couldn't read —\n * says nothing about the docs, so it always points at the question instead of\n * a page there's nothing to fix in.\n */\nexport const questionFinding = (\n question: EvalQuestion,\n outcome: QuestionOutcome,\n project: BlumeProject,\n anchor: EvalsAnchor\n): Diagnostic => {\n const questionSite = {\n file: anchor.path,\n line: locateQuestion(anchor.raw, question.id),\n };\n\n if (outcome.status === \"error\") {\n return {\n code: \"BLUME_EVAL_QUESTION_ERROR\",\n docsUrl: DOCS_URL,\n message: `The agent run failed for \"${question.question}\"${\n outcome.detail ? ` — ${outcome.detail}` : \"\"\n }, so the docs weren't graded.`,\n severity: question.severity,\n suggestion:\n \"Rerun `blume eval`; if it persists, check the agent CLI installation and the failure detail.\",\n ...questionSite,\n };\n }\n\n const route = hintedRoute(question, project);\n const site = route\n ? { file: route.sourcePath, url: route.path }\n : questionSite;\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
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;AAA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