blume 2.1.3 → 2.2.1
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.
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +134 -0
- package/README.md +4 -4
- package/dist/cli/{chunk-y4msrwm9.js → chunk-080mfch6.js} +15 -15
- package/dist/cli/{chunk-gfc5fqvf.js → chunk-1ch3ct3r.js} +18 -18
- package/dist/cli/{chunk-gfc5fqvf.js.map → chunk-1ch3ct3r.js.map} +1 -1
- package/dist/cli/{chunk-32khwcb6.js → chunk-2ssh60qh.js} +42 -69
- package/dist/cli/{chunk-32khwcb6.js.map → chunk-2ssh60qh.js.map} +9 -10
- package/dist/cli/{chunk-9qzgg6mj.js → chunk-34wap3ed.js} +3 -3
- package/dist/cli/{chunk-k3gr1nm9.js → chunk-40vk8kgf.js} +13 -16
- package/dist/cli/{chunk-k3gr1nm9.js.map → chunk-40vk8kgf.js.map} +3 -3
- package/dist/cli/chunk-487b95qy.js +329 -0
- package/dist/cli/chunk-487b95qy.js.map +13 -0
- package/dist/cli/chunk-4zxh25hc.js +157 -0
- package/dist/cli/chunk-4zxh25hc.js.map +10 -0
- package/dist/cli/chunk-69rjf786.js +146 -0
- package/dist/cli/chunk-69rjf786.js.map +11 -0
- package/dist/cli/{chunk-dqhg54mr.js → chunk-9h8mh2tk.js} +3 -3
- package/dist/cli/{chunk-dqhg54mr.js.map → chunk-9h8mh2tk.js.map} +2 -2
- package/dist/cli/{chunk-bqxaqn5p.js → chunk-9jqmq5hv.js} +8 -8
- package/dist/cli/{chunk-bqxaqn5p.js.map → chunk-9jqmq5hv.js.map} +1 -1
- package/dist/cli/{chunk-dv2z0rzf.js → chunk-aafhwx74.js} +38 -13
- package/dist/cli/{chunk-dv2z0rzf.js.map → chunk-aafhwx74.js.map} +5 -4
- package/dist/cli/{chunk-desvm72z.js → chunk-b680sv30.js} +22 -26
- package/dist/cli/chunk-b680sv30.js.map +13 -0
- package/dist/cli/{chunk-0w6hs479.js → chunk-beb0z983.js} +30 -18
- package/dist/cli/chunk-beb0z983.js.map +10 -0
- package/dist/cli/{chunk-1f882900.js → chunk-c5bjxq8v.js} +2 -2
- package/dist/cli/chunk-e1n41w9m.js +155 -0
- package/dist/cli/chunk-e1n41w9m.js.map +11 -0
- package/dist/cli/{chunk-sc93apfs.js → chunk-etckvbrh.js} +17 -17
- package/dist/cli/{chunk-sc93apfs.js.map → chunk-etckvbrh.js.map} +2 -2
- package/dist/cli/{chunk-bxwhtvw8.js → chunk-f260jdrn.js} +5 -5
- package/dist/cli/{chunk-74wfhv79.js → chunk-fnxgtjeq.js} +1 -1
- package/dist/cli/{chunk-ms9z66nz.js → chunk-gwy55cx3.js} +2 -2
- package/dist/cli/{chunk-ms9z66nz.js.map → chunk-gwy55cx3.js.map} +2 -2
- package/dist/cli/{chunk-dhwtqnnd.js → chunk-gxhcf2hs.js} +2 -2
- package/dist/cli/{chunk-tfycddbt.js → chunk-h0qwdbem.js} +2 -2
- package/dist/cli/{chunk-nbyvgnnm.js → chunk-hktq4j5r.js} +109 -49
- package/dist/cli/chunk-hktq4j5r.js.map +36 -0
- package/dist/cli/{chunk-twy7psdz.js → chunk-hn3g2b89.js} +14 -10
- package/dist/cli/chunk-hn3g2b89.js.map +10 -0
- package/dist/cli/{chunk-j1x92mx9.js → chunk-j4nfgn2j.js} +1 -1
- package/dist/cli/{chunk-dpy8qdjf.js → chunk-k45sq16q.js} +74 -183
- package/dist/cli/chunk-k45sq16q.js.map +18 -0
- package/dist/cli/{chunk-5cmts6dv.js → chunk-kmswjxj9.js} +7 -7
- package/dist/cli/{chunk-5cmts6dv.js.map → chunk-kmswjxj9.js.map} +1 -1
- package/dist/cli/{chunk-36bxs9c7.js → chunk-nqna8dzp.js} +27 -23
- package/dist/cli/chunk-nqna8dzp.js.map +10 -0
- package/dist/cli/{chunk-a57yh0h9.js → chunk-p834rkcn.js} +7 -7
- package/dist/cli/{chunk-a57yh0h9.js.map → chunk-p834rkcn.js.map} +1 -1
- package/dist/cli/{chunk-60hz265r.js → chunk-ppa6mg4d.js} +24 -11
- package/dist/cli/chunk-ppa6mg4d.js.map +10 -0
- package/dist/cli/{chunk-s0bdnc7v.js → chunk-q1wwrxzw.js} +5 -4
- package/dist/cli/chunk-q1wwrxzw.js.map +10 -0
- package/dist/cli/{chunk-ave1wcbr.js → chunk-qcyxkj44.js} +1 -1
- package/dist/cli/{chunk-124fvmzq.js → chunk-r5nm9w0c.js} +11183 -8806
- package/dist/cli/{chunk-124fvmzq.js.map → chunk-r5nm9w0c.js.map} +82 -66
- package/dist/cli/{chunk-ckrcm08h.js → chunk-rtvgmg2j.js} +48 -62
- package/dist/cli/{chunk-ckrcm08h.js.map → chunk-rtvgmg2j.js.map} +4 -5
- package/dist/cli/{chunk-297ajdcv.js → chunk-t2h8pwy1.js} +6 -6
- package/dist/cli/{chunk-297ajdcv.js.map → chunk-t2h8pwy1.js.map} +3 -3
- package/dist/cli/{chunk-gxtg6ed2.js → chunk-x60e15st.js} +21 -21
- package/dist/cli/{chunk-gxtg6ed2.js.map → chunk-x60e15st.js.map} +3 -3
- package/dist/cli/{chunk-58bt3hag.js → chunk-x7bh6d9j.js} +4 -4
- package/dist/cli/{chunk-hvcxng5f.js → chunk-ydqzkhjn.js} +6 -6
- package/dist/cli/{chunk-kdpzw38a.js → chunk-yg8ckc3g.js} +95 -7
- package/dist/cli/chunk-yg8ckc3g.js.map +11 -0
- package/dist/cli/{chunk-0pmb4tr4.js → chunk-zxd5jrgx.js} +1205 -222
- package/dist/cli/chunk-zxd5jrgx.js.map +44 -0
- package/dist/cli/index.js +78 -42
- package/dist/cli/index.js.map +7 -6
- package/dist/types/ai/changelog-components.d.ts +18 -0
- package/dist/types/ai/changelog-markdown.d.ts +12 -0
- package/dist/types/ai/openapi-components.d.ts +7 -7
- package/dist/types/ai/operation-details.d.ts +39 -0
- package/dist/types/ai/relative-links.d.ts +3 -1
- package/dist/types/ai/serializers.d.ts +6 -4
- package/dist/types/analytics/head.d.ts +4 -2
- package/dist/types/analytics/script.d.ts +8 -2
- package/dist/types/components/content/youtube.d.ts +20 -0
- package/dist/types/components/layout/nav-utils.d.ts +8 -0
- package/dist/types/components/openapi/example-panels.d.ts +33 -0
- package/dist/types/components/openapi/helpers.d.ts +53 -11
- package/dist/types/components/openapi/snippets.d.ts +7 -1
- package/dist/types/core/alert-diagnostics.d.ts +10 -0
- package/dist/types/core/builtin-tags.d.ts +16 -0
- package/dist/types/core/changelog-list.d.ts +48 -0
- package/dist/types/core/closest-match.d.ts +6 -0
- package/dist/types/core/code-fence-diagnostics.d.ts +18 -0
- package/dist/types/core/code-fences.d.ts +8 -1
- package/dist/types/core/config-input.d.ts +38 -6
- package/dist/types/core/content-assets.d.ts +16 -18
- package/dist/types/core/data.d.ts +6 -2
- package/dist/types/core/diagnostics.d.ts +14 -0
- package/dist/types/core/directive-diagnostics.d.ts +22 -8
- package/dist/types/core/former-routes.d.ts +14 -0
- package/dist/types/core/github.d.ts +5 -4
- package/dist/types/core/heading-markers.d.ts +65 -2
- package/dist/types/core/hidden-pages.d.ts +3 -0
- package/dist/types/core/includes.d.ts +23 -0
- package/dist/types/core/last-modified.d.ts +18 -6
- package/dist/types/core/links.d.ts +42 -2
- package/dist/types/core/load-module.d.ts +19 -4
- package/dist/types/core/manifest.d.ts +14 -1
- package/dist/types/core/markdown-mirrors.d.ts +22 -0
- package/dist/types/core/mcp-clients.d.ts +47 -0
- package/dist/types/core/mdx-elements.d.ts +32 -0
- package/dist/types/core/mdx-syntax.d.ts +100 -0
- package/dist/types/core/meta-diagnostics.d.ts +7 -0
- package/dist/types/core/meta.d.ts +32 -5
- package/dist/types/core/nav-diagnostics.d.ts +16 -2
- package/dist/types/core/navigation.d.ts +13 -0
- package/dist/types/core/ordering-prefix.d.ts +6 -0
- package/dist/types/core/pinned-ids.d.ts +23 -0
- package/dist/types/core/project-graph.d.ts +9 -1
- package/dist/types/core/redirect-patterns.d.ts +18 -0
- package/dist/types/core/relative-files.d.ts +31 -0
- package/dist/types/core/schema.d.ts +322 -11
- package/dist/types/core/sources/normalize.d.ts +101 -9
- package/dist/types/core/sources/types.d.ts +16 -0
- package/dist/types/core/static-files.d.ts +10 -0
- package/dist/types/core/static-host.d.ts +42 -0
- package/dist/types/core/svg-images.d.ts +26 -0
- package/dist/types/core/syntax-diagnostics.d.ts +14 -0
- package/dist/types/core/types.d.ts +42 -1
- package/dist/types/deploy/generated-files.d.ts +41 -0
- package/dist/types/deploy/redirects.d.ts +21 -7
- package/dist/types/markdown/code-title.d.ts +9 -5
- package/dist/types/markdown/directives.d.ts +8 -0
- package/dist/types/markdown/fence-language.d.ts +51 -0
- package/dist/types/markdown/fence-meta.d.ts +5 -0
- package/dist/types/markdown/github-alerts.d.ts +35 -0
- package/dist/types/openapi/asyncapi.d.ts +6 -5
- package/dist/types/openapi/checks.d.ts +10 -5
- package/dist/types/openapi/model.d.ts +55 -8
- package/dist/types/openapi/parse.d.ts +4 -1
- package/dist/types/ratelimit/index.d.ts +2 -0
- package/dist/types/ratelimit/memory.d.ts +1 -1
- package/dist/types/ratelimit/schema.d.ts +40 -0
- package/dist/types/ratelimit/unkey.d.ts +48 -0
- package/dist/types/sources/filesystem.d.ts +14 -4
- package/dist/types/sources/mdx-remote.d.ts +6 -3
- package/dist/types/sources/registry.d.ts +3 -3
- package/dist/types/theme/color.d.ts +33 -0
- package/dist/types/theme/palette.d.ts +122 -0
- package/docs/01-quickstart.mdx +1 -1
- package/docs/02-deployment.mdx +24 -8
- package/docs/04-migrating.mdx +16 -4
- package/docs/advanced/changelog.mdx +27 -1
- package/docs/advanced/skills.mdx +1 -1
- package/docs/cli/audit.mdx +1 -1
- package/docs/cli/doctor.mdx +2 -2
- package/docs/cli/evals.mdx +1 -1
- package/docs/cli/index.mdx +4 -2
- package/docs/cli/validate.mdx +10 -7
- package/docs/configuration/analytics.mdx +2 -0
- package/docs/configuration/customization.mdx +3 -1
- package/docs/configuration/index.mdx +7 -6
- package/docs/configuration/rate-limiting.mdx +20 -1
- package/docs/configuration/theming.mdx +5 -1
- package/docs/content/components.mdx +26 -6
- package/docs/content/frontmatter.mdx +1 -1
- package/docs/content/i18n.mdx +1 -1
- package/docs/content/includes.mdx +6 -2
- package/docs/content/index.mdx +11 -1
- package/docs/content/islands.mdx +2 -0
- package/docs/content/meta.mdx +9 -3
- package/docs/content/navigation.mdx +14 -6
- package/docs/content/sources/obsidian.mdx +1 -1
- package/docs/content/sources/remote-mdx.mdx +3 -1
- package/docs/content/syntax.mdx +76 -8
- package/docs/content/variables.mdx +3 -1
- package/docs/discoverability/agent-discovery.mdx +1 -1
- package/docs/discoverability/json-api.mdx +1 -1
- package/docs/discoverability/llms-txt.mdx +1 -1
- package/docs/discoverability/markdown.mdx +2 -2
- package/docs/discoverability/mcp.mdx +40 -8
- package/docs/discoverability/open-graph.mdx +1 -1
- package/docs/discoverability/sitemap-and-robots.mdx +1 -1
- package/docs/references/graphql.mdx +2 -0
- package/docs/references/openapi.mdx +45 -7
- package/package.json +4 -4
- package/skills/blume/SKILL.md +2 -2
- package/skills/blume-migrate/SKILL.md +51 -29
- package/skills/blume-migrate/references/docsify.md +262 -0
- package/skills/blume-migrate/references/docus.md +298 -0
- package/skills/blume-migrate/references/docusaurus.md +5 -5
- package/skills/blume-migrate/references/fern.md +327 -0
- package/skills/blume-migrate/references/fumadocs.md +1 -1
- package/skills/blume-migrate/references/gitbook.md +267 -0
- package/skills/blume-migrate/references/github-wiki.md +259 -0
- package/skills/blume-migrate/references/jekyll.md +253 -0
- package/skills/blume-migrate/references/mdbook.md +256 -0
- package/skills/blume-migrate/references/mintlify.md +5 -5
- package/skills/blume-migrate/references/mkdocs.md +236 -0
- package/skills/blume-migrate/references/monorepo.md +20 -8
- package/skills/blume-migrate/references/nextra.md +5 -5
- package/skills/blume-migrate/references/readme.md +257 -0
- package/skills/blume-migrate/references/redocly.md +198 -0
- package/skills/blume-migrate/references/starlight.md +3 -3
- package/skills/blume-migrate/references/vitepress.md +204 -0
- package/skills/blume-migrate/references/vuepress.md +271 -0
- package/skills/blume-migrate/scripts/docsify-codemod.mjs +2387 -0
- package/skills/blume-migrate/scripts/docus-codemod.mjs +2542 -0
- package/skills/blume-migrate/scripts/fern-codemod.mjs +2633 -0
- package/skills/blume-migrate/scripts/github-wiki-codemod.mjs +2808 -0
- package/skills/blume-migrate/scripts/include-excerpts.mjs +649 -0
- package/skills/blume-migrate/scripts/jekyll-codemod.mjs +3649 -0
- package/skills/blume-migrate/scripts/mintlify-codemod.mjs +17 -13
- package/skills/blume-migrate/scripts/mkdocs-codemod.mjs +2526 -0
- package/skills/blume-migrate/scripts/operation-routes.mjs +508 -0
- package/skills/blume-migrate/scripts/pin-heading-ids.mjs +1049 -0
- package/skills/blume-migrate/scripts/readme-codemod.mjs +4139 -0
- package/skills/blume-migrate/scripts/vitepress-codemod.mjs +1511 -0
- package/src/ai/changelog-components.ts +24 -0
- package/src/ai/changelog-markdown.ts +45 -41
- package/src/ai/component-markdown.ts +22 -9
- package/src/ai/llms.ts +36 -5
- package/src/ai/markdown.ts +2 -2
- package/src/ai/openapi-components.ts +25 -9
- package/src/ai/operation-details.ts +208 -0
- package/src/ai/relative-links.ts +48 -8
- package/src/ai/serializers.ts +7 -6
- package/src/ai/site-skill.ts +6 -2
- package/src/analytics/head.ts +11 -5
- package/src/analytics/script.ts +13 -3
- package/src/astro/generate.ts +47 -11
- package/src/astro/index.ts +1 -0
- package/src/astro/integration.ts +27 -1
- package/src/astro/mdx-source-errors.ts +46 -0
- package/src/astro/templates.ts +93 -189
- package/src/audit/checks/redirects.ts +5 -1
- package/src/audit/redirects.ts +36 -19
- package/src/audit/report.ts +22 -9
- package/src/audit/run.ts +12 -28
- package/src/audit/terms.ts +23 -0
- package/src/audit/url.ts +2 -2
- package/src/cli/build-failure.ts +256 -7
- package/src/cli/command-meta.ts +1 -1
- package/src/cli/commands/audit.ts +1 -1
- package/src/cli/commands/build.ts +12 -3
- package/src/cli/commands/check.ts +13 -2
- package/src/cli/commands/dev.ts +1 -1
- package/src/cli/commands/doctor.ts +4 -2
- package/src/cli/commands/init.ts +3 -3
- package/src/cli/commands/preview.ts +17 -1
- package/src/cli/commands/validate.ts +22 -10
- package/src/cli/prepare.ts +1 -1
- package/src/cli/preview-pages.ts +161 -0
- package/src/cli/required-secrets.ts +0 -1
- package/src/cli/unknown-flags.ts +1 -42
- package/src/components/code-copy.ts +51 -0
- package/src/components/code-language.ts +75 -0
- package/src/components/content/AccordionItem.astro +16 -1
- package/src/components/content/Callout.astro +11 -1
- package/src/components/content/Changelog.astro +189 -0
- package/src/components/content/CodeBlock.astro +8 -11
- package/src/components/content/Tabs.astro +16 -2
- package/src/components/content/YouTube.astro +6 -4
- package/src/components/content/code-block.ts +33 -0
- package/src/components/content/content-strings.ts +5 -1
- package/src/components/content/inline-markdown.ts +35 -8
- package/src/components/content/youtube.ts +49 -7
- package/src/components/layout/Analytics.astro +5 -1
- package/src/components/layout/NavTree.astro +8 -3
- package/src/components/layout/PageActions.astro +81 -23
- package/src/components/layout/RootLayout.astro +35 -32
- package/src/components/layout/SiteFooter.astro +31 -8
- package/src/components/layout/nav-utils.ts +14 -0
- package/src/components/layout/search/pagefind.ts +2 -1
- package/src/components/openapi/Operation.astro +4 -0
- package/src/components/openapi/PanelTabs.astro +9 -3
- package/src/components/openapi/RequestBody.astro +42 -8
- package/src/components/openapi/RequestPanel.astro +34 -53
- package/src/components/openapi/example-panels.ts +110 -0
- package/src/components/openapi/helpers.ts +195 -20
- package/src/components/openapi/operation-model.ts +63 -26
- package/src/components/openapi/request.ts +13 -0
- package/src/components/openapi/snippets.ts +14 -2
- package/src/core/alert-diagnostics.ts +89 -0
- package/src/core/builtin-tags.ts +76 -0
- package/src/core/changelog-list.ts +87 -0
- package/src/core/closest-match.ts +41 -0
- package/src/core/code-fence-diagnostics.ts +267 -0
- package/src/core/code-fences.ts +43 -7
- package/src/core/component-diagnostics.ts +65 -12
- package/src/core/config-input.ts +39 -5
- package/src/core/config.ts +46 -1
- package/src/core/content-assets.ts +64 -144
- package/src/core/data.ts +10 -3
- package/src/core/diagnostics.ts +36 -3
- package/src/core/directive-diagnostics.ts +265 -47
- package/src/core/former-routes.ts +46 -0
- package/src/core/git-ignored.ts +53 -0
- package/src/core/github.ts +5 -4
- package/src/core/heading-markers.ts +156 -2
- package/src/core/hidden-pages.ts +64 -0
- package/src/core/includes.ts +181 -41
- package/src/core/last-modified.ts +47 -10
- package/src/core/links.ts +438 -83
- package/src/core/load-module.ts +98 -9
- package/src/core/manifest.ts +12 -9
- package/src/core/markdown-mirrors.ts +52 -0
- package/src/core/mcp-clients.ts +87 -0
- package/src/core/mdx-elements.ts +153 -0
- package/src/core/mdx-syntax.ts +377 -0
- package/src/core/meta-diagnostics.ts +134 -0
- package/src/core/meta.ts +154 -55
- package/src/core/nav-diagnostics.ts +41 -4
- package/src/core/navigation.ts +70 -10
- package/src/core/ordering-prefix.ts +22 -2
- package/src/core/pinned-ids.ts +141 -0
- package/src/core/project-graph.ts +221 -29
- package/src/core/redirect-patterns.ts +41 -0
- package/src/core/relative-files.ts +145 -0
- package/src/core/schema.ts +110 -6
- package/src/core/sources/mdx-remote.ts +75 -14
- package/src/core/sources/normalize.ts +885 -179
- package/src/core/sources/notion.ts +5 -4
- package/src/core/sources/obsidian.ts +2 -5
- package/src/core/sources/types.ts +17 -0
- package/src/core/static-files.ts +40 -0
- package/src/core/static-host.ts +125 -0
- package/src/core/svg-images.ts +98 -0
- package/src/core/syntax-diagnostics.ts +491 -0
- package/src/core/types.ts +43 -1
- package/src/deploy/artifacts.ts +2 -28
- package/src/deploy/generated-files.ts +128 -0
- package/src/deploy/platforms/vercel.ts +25 -1
- package/src/deploy/redirects.ts +43 -16
- package/src/deploy/sitemap.ts +2 -1
- package/src/markdown/base-links.ts +87 -6
- package/src/markdown/code-title.ts +29 -13
- package/src/markdown/content-assets.ts +210 -0
- package/src/markdown/directives.ts +69 -5
- package/src/markdown/fence-language.ts +106 -0
- package/src/markdown/fence-meta.ts +42 -0
- package/src/markdown/github-alerts.ts +172 -0
- package/src/markdown/heading-anchors.ts +265 -56
- package/src/markdown/include.ts +30 -3
- package/src/markdown/index.ts +145 -40
- package/src/markdown/prompt-text.ts +95 -0
- package/src/markdown/relative-links.ts +37 -2
- package/src/markdown/route-snapshot.ts +22 -12
- package/src/markdown/svg-fallback.ts +51 -0
- package/src/markdown/title-heading.ts +134 -0
- package/src/migrate/migrate.ts +127 -2
- package/src/og/card.ts +14 -4
- package/src/openapi/asyncapi.ts +14 -6
- package/src/openapi/checks.ts +160 -15
- package/src/openapi/model.ts +172 -33
- package/src/openapi/parse.ts +13 -4
- package/src/openapi/render-mdx.ts +55 -9
- package/src/openapi/source.ts +87 -6
- package/src/ratelimit/index.ts +2 -0
- package/src/ratelimit/memory.ts +1 -1
- package/src/ratelimit/runtime.ts +81 -0
- package/src/ratelimit/schema.ts +2 -0
- package/src/ratelimit/unkey.ts +61 -0
- package/src/registry/eject.ts +0 -1
- package/src/registry/registry.ts +1 -1
- package/src/search/documents.ts +10 -2
- package/src/sources/filesystem.ts +28 -3
- package/src/sources/mdx-remote.ts +7 -15
- package/src/theme/color.ts +14 -0
- package/src/theme/entry.ts +22 -1
- package/src/theme/palette.ts +74 -1
- package/dist/cli/chunk-0pmb4tr4.js.map +0 -35
- package/dist/cli/chunk-0w6hs479.js.map +0 -10
- package/dist/cli/chunk-150jk7km.js +0 -52
- package/dist/cli/chunk-150jk7km.js.map +0 -10
- package/dist/cli/chunk-36bxs9c7.js.map +0 -10
- package/dist/cli/chunk-53jqw8z0.js +0 -89
- package/dist/cli/chunk-53jqw8z0.js.map +0 -10
- package/dist/cli/chunk-60hz265r.js.map +0 -10
- package/dist/cli/chunk-desvm72z.js.map +0 -14
- package/dist/cli/chunk-dpy8qdjf.js.map +0 -17
- package/dist/cli/chunk-es8h0v3j.js +0 -441
- package/dist/cli/chunk-es8h0v3j.js.map +0 -11
- package/dist/cli/chunk-kdpzw38a.js.map +0 -11
- package/dist/cli/chunk-nbyvgnnm.js.map +0 -36
- package/dist/cli/chunk-s0bdnc7v.js.map +0 -10
- package/dist/cli/chunk-twy7psdz.js.map +0 -10
- package/dist/cli/chunk-ydp3065p.js +0 -64
- package/dist/cli/chunk-ydp3065p.js.map +0 -10
- /package/dist/cli/{chunk-y4msrwm9.js.map → chunk-080mfch6.js.map} +0 -0
- /package/dist/cli/{chunk-9qzgg6mj.js.map → chunk-34wap3ed.js.map} +0 -0
- /package/dist/cli/{chunk-1f882900.js.map → chunk-c5bjxq8v.js.map} +0 -0
- /package/dist/cli/{chunk-bxwhtvw8.js.map → chunk-f260jdrn.js.map} +0 -0
- /package/dist/cli/{chunk-74wfhv79.js.map → chunk-fnxgtjeq.js.map} +0 -0
- /package/dist/cli/{chunk-dhwtqnnd.js.map → chunk-gxhcf2hs.js.map} +0 -0
- /package/dist/cli/{chunk-tfycddbt.js.map → chunk-h0qwdbem.js.map} +0 -0
- /package/dist/cli/{chunk-j1x92mx9.js.map → chunk-j4nfgn2j.js.map} +0 -0
- /package/dist/cli/{chunk-ave1wcbr.js.map → chunk-qcyxkj44.js.map} +0 -0
- /package/dist/cli/{chunk-58bt3hag.js.map → chunk-x7bh6d9j.js.map} +0 -0
- /package/dist/cli/{chunk-hvcxng5f.js.map → chunk-ydqzkhjn.js.map} +0 -0
|
@@ -8,15 +8,15 @@ import {
|
|
|
8
8
|
VERSION_ID,
|
|
9
9
|
VERSION_LIKE,
|
|
10
10
|
versionizeRoute
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-r5nm9w0c.js";
|
|
12
|
+
import {
|
|
13
|
+
isWithin,
|
|
14
|
+
scanProject
|
|
15
|
+
} from "./chunk-zxd5jrgx.js";
|
|
12
16
|
import {
|
|
13
17
|
mountBasePath,
|
|
14
18
|
stripBasePath
|
|
15
19
|
} from "./chunk-zccbjcj0.js";
|
|
16
|
-
import {
|
|
17
|
-
isWithin,
|
|
18
|
-
scanProject
|
|
19
|
-
} from "./chunk-0pmb4tr4.js";
|
|
20
20
|
|
|
21
21
|
// src/core/version-cut.ts
|
|
22
22
|
import { existsSync } from "node:fs";
|
|
@@ -279,5 +279,5 @@ var cutVersion = async (root, id, options = {}) => {
|
|
|
279
279
|
|
|
280
280
|
export { CutError, unregisteredSnapshotDiagnostics, cutVersion };
|
|
281
281
|
|
|
282
|
-
//# debugId=
|
|
283
|
-
//# sourceMappingURL=chunk-
|
|
282
|
+
//# debugId=1864DE871652686F64756E2164756E21
|
|
283
|
+
//# sourceMappingURL=chunk-kmswjxj9.js.map
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"import { existsSync } from \"node:fs\";\nimport { cp, readdir, readFile, rm } from \"node:fs/promises\";\n\nimport { join, relative } from \"pathe\";\n\nimport { mountBasePath, stripBasePath } from \"./base-path.ts\";\nimport { nextFenceState } from \"./code-fences.ts\";\nimport type { FenceState } from \"./code-fences.ts\";\nimport { writeTextAtomic } from \"./fs-atomic.ts\";\nimport { localizeRoute } from \"./i18n.ts\";\nimport type { BlumeProject } from \"./project-graph.ts\";\nimport { isWithin, scanProject } from \"./project-graph.ts\";\nimport { VERSION_ID } from \"./schema.ts\";\nimport type { Diagnostic } from \"./types.ts\";\nimport { VERSION_LIKE, versionizeRoute } from \"./versions.ts\";\n\n/** What `cutVersion` did, for the CLI to report. */\nexport interface CutResult {\n /** Files copied into the snapshot. */\n copied: number;\n /** Markdown pages whose root-absolute links were rewritten, with counts. */\n rewritten: { file: string; count: number }[];\n /** Whether `blume.config.ts` was updated in place. */\n configUpdated: boolean;\n /**\n * Whether that update added the whole `versions` block — the first cut of a\n * project that had no versioning — rather than one `archived` entry.\n */\n versionsAdded: boolean;\n /** Ready-to-paste config snippet when in-place update was not possible. */\n configSnippet: string | null;\n /** Absolute path of the created snapshot directory. */\n dir: string;\n}\n\n/** A `cutVersion` failure the CLI reports as a user error, not a crash. */\nexport class CutError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"CutError\";\n }\n}\n\n// Inline code spans are syntax being *shown*, not links — blank them before\n// matching so replacements can splice into the real line by index (the mask\n// preserves length). Mirrors the content-assets rewriter.\nconst INLINE_CODE = /`[^`]*`/gu;\n// A root-absolute markdown link/image target, reference-style link definition\n// (`[setup]: /guides/setup`, up to three spaces in, never a `[^note]:`\n// footnote), or HTML href/src attribute in either quote style. Named groups\n// carry the prefix (kept) and target (rewritten).\nconst ROOT_LINK =\n /(?<prefix>\\]\\(|^ {0,3}\\[(?!\\^)[^\\]]+\\]:[ \\t]*<?|(?:href|src)=[\"'])(?<target>\\/[^\\s\"'<>)]*)/gu;\n\n/**\n * Build the link-rewrite table: every current-version route (basePath\n * stripped, since authors write root-absolute links as if mounted at root;\n * a link that spells the base out is looked up without it, see\n * `snapshotTarget`) mapped to the same page's route inside the new snapshot.\n * Only pages the snapshot actually contains qualify — filesystem pages under\n * the content root. Spec-rendered references (`/api`, `/events`) and remote\n * sources aren't copied, so links to them keep pointing at the live pages\n * instead of a 404 inside the snapshot.\n */\nconst buildRouteRewrites = (\n project: BlumeProject,\n id: string\n): Map<string, string> => {\n const { basePath, i18n } = project.config;\n const { contentRoot } = project.context;\n const rewrites = new Map<string, string>();\n // Under i18n, authors write links in the unprefixed form (`/guides/setup`)\n // and rendering moves them into the reader's locale — a form no page is\n // routed at when the default locale keeps its prefix\n // (`hideDefaultLocalePrefix: false`). So it is mapped too, to the\n // unprefixed snapshot route, which rendering localizes the same way. Page\n // routes win where the two forms coincide.\n const logical = new Map<string, string>();\n for (const page of project.graph.pages) {\n // `sourcePath` marks a page backed by a local file, which excludes\n // generated and remote pages; the content-root check below excludes local\n // files that live outside the tree a version snapshot copies. A staged\n // page (an Obsidian note) is served from its source, not from the copied\n // tree, so it keeps publishing as current even when its file sits under\n // the content root.\n const { sourcePath } = page;\n if (\n page.version !== \"\" ||\n page.collection === \"staged\" ||\n !sourcePath ||\n relative(contentRoot, sourcePath).startsWith(\"..\")\n ) {\n continue;\n }\n const snapshot = versionizeRoute(page.versionKey, id);\n rewrites.set(\n stripBasePath(basePath, page.route),\n i18n ? localizeRoute(snapshot, page.locale, i18n) : snapshot\n );\n if (i18n) {\n logical.set(page.versionKey, snapshot);\n }\n }\n for (const [route, snapshot] of logical) {\n if (!rewrites.has(route)) {\n rewrites.set(route, snapshot);\n }\n }\n return rewrites;\n};\n\n/**\n * The snapshot link a root-absolute path rewrites to, or undefined when the\n * snapshot has no copy of its page. A path written with the base path by hand\n * (`/docs/guides/x` under `basePath: \"/docs\"`) names the same page as\n * `/guides/x` — rendering leaves an already-based link alone (see\n * `withBasePath`) — so it is looked up without the base and keeps it.\n */\nconst snapshotTarget = (\n path: string,\n rewrites: Map<string, string>,\n basePath: string\n): string | undefined => {\n const based =\n basePath !== \"\" && (path === basePath || path.startsWith(`${basePath}/`));\n if (!based) {\n return rewrites.get(path);\n }\n const replacement = rewrites.get(stripBasePath(basePath, path));\n return replacement === undefined\n ? undefined\n : mountBasePath(basePath, replacement);\n};\n\n/** Rewrite one line's root-absolute internal links via the rewrite table. */\nconst rewriteLine = (\n line: string,\n rewrites: Map<string, string>,\n basePath: string\n): string => {\n const masked = line.replaceAll(INLINE_CODE, (span) =>\n \" \".repeat(span.length)\n );\n let out = \"\";\n let cursor = 0;\n let count = 0;\n for (const match of masked.matchAll(ROOT_LINK)) {\n const target = match.groups?.target ?? \"\";\n // An anchor or query stays attached to the rewritten path.\n const hash = target.search(/[#?]/u);\n const path = hash === -1 ? target : target.slice(0, hash);\n const suffix = hash === -1 ? \"\" : target.slice(hash);\n const bare = path !== \"/\" && path.endsWith(\"/\") ? path.slice(0, -1) : path;\n const replacement = snapshotTarget(bare, rewrites, basePath);\n if (replacement === undefined) {\n continue;\n }\n const offset = (match.index ?? 0) + (match.groups?.prefix?.length ?? 0);\n out += line.slice(cursor, offset) + replacement + suffix;\n cursor = offset + target.length;\n count += 1;\n }\n return count === 0 ? line : out + line.slice(cursor);\n};\n\n/** A page's link-rewritten text and how many of its lines changed. */\nexport interface SnapshotRewrite {\n text: string;\n count: number;\n}\n\n/**\n * Rewrite a copied page's root-absolute internal links to their snapshot\n * equivalents, skipping fenced and inline code. Relative links need no\n * rewriting — the whole tree copies together, so they stay self-contained.\n * `basePath` is the site's, for links that spell it out by hand.\n */\nexport const rewriteSnapshotLinks = (\n source: string,\n rewrites: Map<string, string>,\n basePath = \"\"\n): SnapshotRewrite => {\n let fence: FenceState = null;\n let count = 0;\n const lines = source.split(\"\\n\").map((line) => {\n const next = nextFenceState(line, fence);\n const inFence = fence !== null || next !== null;\n fence = next;\n if (inFence) {\n return line;\n }\n const rewrittenLine = rewriteLine(line, rewrites, basePath);\n if (rewrittenLine !== line) {\n count += 1;\n }\n return rewrittenLine;\n });\n return { count, text: lines.join(\"\\n\") };\n};\n\n/**\n * The switcher label a first cut gives the live docs. `versions.current.label`\n * is required, and \"Latest\" reads right until the author names the release.\n */\nconst CURRENT_LABEL = \"Latest\";\n\n/** The config entry to add, as a paste-ready snippet for the fallback path. */\nconst snippetFor = (id: string, hasVersions: boolean): string =>\n hasVersions\n ? `Add to versions.archived in blume.config.ts (newest first):\\n\\n { id: \"${id}\" },\\n`\n : `Add to blume.config.ts:\\n\\n versions: {\\n archived: [{ id: \"${id}\" }],\\n current: { label: \"${CURRENT_LABEL}\" },\\n },\\n`;\n\n/**\n * Best-effort in-place config update: insert the new id at the head of an\n * existing \\`archived: [\\` array literal, preserving indentation. Anything\n * fancier (computed arrays, config spread across files) falls back to a\n * printed snippet — the config is user-authored TypeScript, and string-level\n * surgery beyond this simple shape risks corrupting it.\n */\nexport const insertArchivedVersion = async (\n configPath: string,\n id: string\n): Promise<boolean> => {\n let text: string;\n try {\n text = await readFile(configPath, \"utf-8\");\n } catch {\n return false;\n }\n const match = text.match(/(?<lead>archived:\\s*\\[)/u);\n if (!match || match.index === undefined) {\n return false;\n }\n const insertAt = match.index + (match.groups?.lead?.length ?? 0);\n // Indentation: one level deeper than the line holding `archived:`.\n const lineStart = text.lastIndexOf(\"\\n\", match.index) + 1;\n const indent = text.slice(lineStart).match(/^\\s*/u)?.[0] ?? \"\";\n const rest = text.slice(insertAt);\n // Match the array's authored shape: empty stays bare, an inline array gets\n // an inline entry, a multiline array gets its own indented line — on the\n // file's own line ending, so a CRLF config doesn't gain a lone LF.\n const eol = /^\\r?\\n/u.exec(rest)?.[0];\n let entry: string;\n if (rest.trimStart().startsWith(\"]\")) {\n entry = `{ id: \"${id}\" }`;\n } else if (eol) {\n entry = `${eol}${indent} { id: \"${id}\" },`;\n } else {\n entry = `{ id: \"${id}\" }, `;\n }\n await writeTextAtomic(configPath, text.slice(0, insertAt) + entry + rest);\n return true;\n};\n\n/** The opening brace of the config object: `defineConfig({` or `export default {`. */\nconst CONFIG_OBJECT = /(?:defineConfig\\(\\s*|export\\s+default\\s+)\\{/gu;\n\n/**\n * Best-effort in-place registration of a first version: add a `versions` block\n * (the id archived, the live docs labeled {@link CURRENT_LABEL}) as the first\n * property of the config object. Only the plain shape is edited — exactly one\n * `defineConfig({` or `export default {` and no `versions` key yet — so a\n * config built any other way falls back to the printed snippet rather than\n * risk corrupting it.\n */\nexport const insertVersionsBlock = async (\n configPath: string,\n id: string\n): Promise<boolean> => {\n let text: string;\n try {\n text = await readFile(configPath, \"utf-8\");\n } catch {\n return false;\n }\n const matches = [...text.matchAll(CONFIG_OBJECT)];\n const [match] = matches;\n if (matches.length !== 1 || !match || /\\bversions\\s*:/u.test(text)) {\n return false;\n }\n const insertAt = match.index + match[0].length;\n const rest = text.slice(insertAt);\n const eol = text.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n const lineStart = text.lastIndexOf(\"\\n\", match.index) + 1;\n const outer = /^[ \\t]*/u.exec(text.slice(lineStart))?.[0] ?? \"\";\n // Match the indentation of the property on the next line, when there is one.\n const indent =\n /^[ \\t]*\\r?\\n(?<indent>[ \\t]*)\\S/u.exec(rest)?.groups?.indent ??\n `${outer} `;\n const block = [\n \"versions: {\",\n ` archived: [{ id: \"${id}\" }],`,\n ` current: { label: \"${CURRENT_LABEL}\" },`,\n \"},\",\n ]\n .map((line) => `${indent}${line}`)\n .join(eol);\n const body = rest.trimStart();\n let tail: string;\n if (body.startsWith(\"}\")) {\n // An empty object: close it on its own line.\n tail = `${eol}${outer}${body}`;\n } else if (/^[ \\t]*\\r?\\n/u.test(rest)) {\n tail = rest;\n } else {\n // An inline object: move its first property onto the next line.\n tail = `${eol}${indent}${body}`;\n }\n await writeTextAtomic(\n configPath,\n `${text.slice(0, insertAt)}${eol}${block}${tail}`\n );\n return true;\n};\n\n/**\n * Version-shaped folders (`v1.0/`) at the top of the content root of a project\n * with no `versions` config — usually a snapshot `blume version` cut but\n * couldn't register — which build as ordinary content at `/v1.0/…`, so every\n * page ships twice. With versioning configured, the scan's own\n * `BLUME_VERSIONS_UNCONFIGURED_VERSION` covers a folder it doesn't list; this\n * check is `blume doctor`'s alone, since an unversioned site can have a real\n * `v1/` section that a warning on every build would only nag about.\n */\nexport const unregisteredSnapshotDiagnostics = (\n project: BlumeProject\n): Diagnostic[] => {\n if (project.config.versions) {\n return [];\n }\n const { contentRoot } = project.context;\n const folders = new Set<string>();\n for (const page of project.graph.pages) {\n const [first, ...rest] = page.sourcePath\n ? relative(contentRoot, page.sourcePath).split(\"/\")\n : [];\n if (first && rest.length > 0 && VERSION_LIKE.test(first)) {\n folders.add(first);\n }\n }\n return [...folders].toSorted().map((folder) => ({\n code: \"BLUME_VERSIONS_UNCONFIGURED_VERSION\",\n file: join(contentRoot, folder),\n message: `Folder \"${folder}/\" looks like a version snapshot, but versioning isn't configured, so its pages build as ordinary content at /${folder}/….`,\n severity: \"warning\",\n suggestion: `If it's a snapshot, register it with \\`versions: { archived: [{ id: \"${folder}\" }], current: { label: \"${CURRENT_LABEL}\" } }\\` in blume.config.ts; if it's an ordinary section, ignore this.`,\n }));\n};\n\n/**\n * Freeze the current docs as an archived version: copy the content tree into\n * `<contentRoot>/<id>/` (excluding existing snapshots), rewrite root-absolute\n * internal links so the copy is self-contained, and register the id in\n * `blume.config.ts` (or print the snippet to paste).\n */\nexport const cutVersion = async (\n root: string,\n id: string,\n options: { force?: boolean } = {}\n): Promise<CutResult> => {\n if (!VERSION_ID.test(id)) {\n throw new CutError(\n `Version ids must start with a letter (e.g. \"v1.0\") and contain only letters, digits, dots, hyphens, and underscores — got \"${id}\".`\n );\n }\n\n const project = await scanProject(root);\n const errors = project.diagnostics.filter(\n (diagnostic) => diagnostic.severity === \"error\"\n );\n if (errors.length > 0) {\n throw new CutError(\n `The project has ${errors.length} error diagnostic(s) — fix them before cutting a version (run \\`blume validate\\`).`\n );\n }\n // A missing content root already fails inside `scanProject` (the filesystem\n // source's own validation), so only the version-level checks remain here.\n const { contentRoot } = project.context;\n if (project.config.versions?.archived.some((version) => version.id === id)) {\n throw new CutError(\n `Version \"${id}\" is already registered in versions.archived.`\n );\n }\n\n const dir = join(contentRoot, id);\n if (existsSync(dir)) {\n if (!options.force) {\n throw new CutError(\n `${dir} already exists — pass --force to overwrite the snapshot.`\n );\n }\n await rm(dir, { force: true, recursive: true });\n }\n\n // Existing snapshots must not nest inside the new one: configured ids, plus\n // any version-shaped directory (`v1.0/`) that never made it into the config —\n // e.g. a prior cut whose config update fell back to a printed snippet. A\n // genuine content folder that merely looks like a version already draws the\n // rename-or-register diagnostic, so skipping it here is consistent.\n const excluded = new Set([\n id,\n \"node_modules\",\n ...(project.config.versions?.archived.map((version) => version.id) ?? []),\n ]);\n // Another local source's tree under the content root — an Obsidian vault the\n // filesystem source excludes — is that source's to publish. Copying it would\n // republish its raw notes (wikilinks and `%%comments%%` intact) as\n // filesystem pages of the snapshot, while the source itself keeps serving\n // them as current.\n const foreignRoots = project.sources\n .flatMap((source) =>\n source.staged && source.contentRoot ? [source.contentRoot] : []\n )\n .filter((tree) => isWithin(contentRoot, tree));\n const isForeign = (path: string): boolean =>\n foreignRoots.some((tree) => isWithin(tree, path));\n const entries = await readdir(contentRoot, { withFileTypes: true });\n let copied = 0;\n await Promise.all(\n entries.map(async (entry) => {\n if (\n excluded.has(entry.name) ||\n entry.name.startsWith(\".\") ||\n (entry.isDirectory() && VERSION_LIKE.test(entry.name))\n ) {\n return;\n }\n await cp(join(contentRoot, entry.name), join(dir, entry.name), {\n filter: (source) => !isForeign(source),\n recursive: true,\n });\n })\n );\n\n // Rewrite root-absolute internal links in every copied markdown page.\n const rewrites = buildRouteRewrites(project, id);\n const rewritten: { file: string; count: number }[] = [];\n const walk = async (current: string): Promise<void> => {\n const children = await readdir(current, { withFileTypes: true });\n await Promise.all(\n children.map(async (child) => {\n const abs = join(current, child.name);\n if (child.isDirectory()) {\n await walk(abs);\n return;\n }\n copied += 1;\n if (!/\\.mdx?$/u.test(child.name)) {\n return;\n }\n const source = await readFile(abs, \"utf-8\");\n const { text, count } = rewriteSnapshotLinks(\n source,\n rewrites,\n project.config.basePath\n );\n if (count > 0) {\n await writeTextAtomic(abs, text);\n rewritten.push({ count, file: relative(dir, abs) });\n }\n })\n );\n };\n await walk(dir);\n\n const configPath =\n project.context.configFile ?? join(root, \"blume.config.ts\");\n const firstVersion = project.config.versions === undefined;\n const configUpdated = firstVersion\n ? await insertVersionsBlock(configPath, id)\n : await insertArchivedVersion(configPath, id);\n\n return {\n configSnippet: configUpdated ? null : snippetFor(id, !firstVersion),\n configUpdated,\n copied,\n dir,\n rewritten,\n versionsAdded: configUpdated && firstVersion,\n };\n};\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAEA;AAiCO,MAAM,iBAAiB,MAAM;AAAA,EAClC,WAAW,CAAC,SAAiB;AAAA,IAC3B,MAAM,OAAO;AAAA,IACb,KAAK,OAAO;AAAA;AAEhB;AAKA,IAAM,cAAc;AAKpB,IAAM,YACJ;AAYF,IAAM,qBAAqB,CACzB,SACA,OACwB;AAAA,EACxB,QAAQ,UAAU,SAAS,QAAQ;AAAA,EACnC,QAAQ,gBAAgB,QAAQ;AAAA,EAChC,MAAM,WAAW,IAAI;AAAA,EAOrB,MAAM,UAA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AA,MACF;AAAA,MACA,UAAU;AAAA,MACV,IAAI,CAAC,WAAW,KAAK,MAAM,IAAI,GAAG;AAAA,QAChC;AAAA,MACF;AAAA,MACA,MAAM,SAAS,MAAM,SAAS,KAAK,OAAO;AAAA,MAC1C,QAAQ,MAAM,UAAU,qBACtB,QACA,UACA,QAAQ,OAAO,QACjB;AAAA,MACA,IAAI,QAAQ,GAAG;AAAA,QACb,MAAM,gBAAgB,KAAK,IAAI;AAAA,QAC/B,UAAU,KAAK,EAAE,OAAO,MAAM,SAAS,KAAK,GAAG,EAAE,CAAC;AAAA,MACpD;AAAA,KACD,CACH;AAAA;AAAA,EAEF,MAAM,KAAK,GAAG;AAAA,EAEd,MAAM,aACJ,QAAQ,QAAQ,cAAc,KAAK,MAAM,iBAAiB;AAAA,EAC5D,MAAM,eAAe,QAAQ,OAAO,aAAa;AAAA,EACjD,MAAM,gBAAgB,eAClB,MAAM,oBAAoB,YAAY,EAAE,IACxC,MAAM,sBAAsB,YAAY,EAAE;AAAA,EAE9C,OAAO;AAAA,IACL,eAAe,gBAAgB,OAAO,WAAW,IAAI,CAAC,YAAY;AAAA,IAClE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe,iBAAiB;AAAA,EAClC;AAAA;",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "1864DE871652686F64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -7,50 +7,51 @@ import {
|
|
|
7
7
|
} from "./index.js";
|
|
8
8
|
import {
|
|
9
9
|
deployPlatform
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-r5nm9w0c.js";
|
|
11
|
+
import"./chunk-zxd5jrgx.js";
|
|
11
12
|
import"./chunk-zccbjcj0.js";
|
|
12
|
-
import
|
|
13
|
+
import {
|
|
14
|
+
refuseIfEjected
|
|
15
|
+
} from "./chunk-e1n41w9m.js";
|
|
13
16
|
import {
|
|
14
17
|
publishBuildProject,
|
|
15
18
|
ogCacheDir,
|
|
16
19
|
pruneCardCache,
|
|
17
20
|
cardCacheTally
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import"./chunk-
|
|
21
|
+
} from "./chunk-hktq4j5r.js";
|
|
22
|
+
import"./chunk-b680sv30.js";
|
|
20
23
|
import {
|
|
21
24
|
deployOutputDir,
|
|
22
25
|
deployStaticDir,
|
|
23
26
|
surfaceAdapterOutput
|
|
24
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-k45sq16q.js";
|
|
28
|
+
import"./chunk-487b95qy.js";
|
|
25
29
|
import {
|
|
26
30
|
ensureGitignore
|
|
27
31
|
} from "./chunk-yzhm0j9q.js";
|
|
28
|
-
import"./chunk-
|
|
32
|
+
import"./chunk-j4nfgn2j.js";
|
|
29
33
|
import {
|
|
30
34
|
removedBuildFlags,
|
|
31
35
|
flagList,
|
|
32
36
|
removedBuildFlagsAdvice
|
|
33
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-34wap3ed.js";
|
|
34
38
|
import {
|
|
35
|
-
astroBuildDiagnostics
|
|
36
|
-
|
|
39
|
+
astroBuildDiagnostics,
|
|
40
|
+
buildFailureLocator
|
|
41
|
+
} from "./chunk-4zxh25hc.js";
|
|
37
42
|
import {
|
|
38
43
|
refuseIfDevRunning
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import
|
|
41
|
-
refuseIfEjected
|
|
42
|
-
} from "./chunk-53jqw8z0.js";
|
|
43
|
-
import"./chunk-ckrcm08h.js";
|
|
44
|
+
} from "./chunk-h0qwdbem.js";
|
|
45
|
+
import"./chunk-rtvgmg2j.js";
|
|
44
46
|
import"./chunk-jq5n4avg.js";
|
|
45
|
-
import"./chunk-
|
|
46
|
-
import"./chunk-dqhg54mr.js";
|
|
47
|
+
import"./chunk-9h8mh2tk.js";
|
|
47
48
|
import {
|
|
48
49
|
prepareProject
|
|
49
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-t2h8pwy1.js";
|
|
50
51
|
import {
|
|
51
52
|
serverFeatures
|
|
52
|
-
} from "./chunk-
|
|
53
|
-
import"./chunk-
|
|
53
|
+
} from "./chunk-gwy55cx3.js";
|
|
54
|
+
import"./chunk-q1wwrxzw.js";
|
|
54
55
|
|
|
55
56
|
// src/cli/commands/build.ts
|
|
56
57
|
import { existsSync } from "node:fs";
|
|
@@ -169,7 +170,7 @@ var reportBuild = async (project, distDir, args) => {
|
|
|
169
170
|
`));
|
|
170
171
|
await runClientAssetChecks(distDir, args);
|
|
171
172
|
if (project.droppedPages > 0) {
|
|
172
|
-
logger.warn(`${project.droppedPages} page(s) failed
|
|
173
|
+
logger.warn(`${project.droppedPages} page(s) failed validation and are missing from this build.`);
|
|
173
174
|
}
|
|
174
175
|
logger.success(`Built to ${distDir}`);
|
|
175
176
|
};
|
|
@@ -236,7 +237,10 @@ var buildCommand = defineCommand({
|
|
|
236
237
|
if (error instanceof BlumeError || !(error instanceof Error)) {
|
|
237
238
|
throw error;
|
|
238
239
|
}
|
|
239
|
-
reportDiagnostics(astroBuildDiagnostics(error
|
|
240
|
+
reportDiagnostics(await astroBuildDiagnostics(error, {
|
|
241
|
+
locate: buildFailureLocator(project),
|
|
242
|
+
root
|
|
243
|
+
}), root);
|
|
240
244
|
process.exit(1);
|
|
241
245
|
}
|
|
242
246
|
await reportCardCache(project, !runtimeDir);
|
|
@@ -271,5 +275,5 @@ export {
|
|
|
271
275
|
runClientAssetChecks
|
|
272
276
|
};
|
|
273
277
|
|
|
274
|
-
//# debugId=
|
|
275
|
-
//# sourceMappingURL=chunk-
|
|
278
|
+
//# debugId=43360653920765D464756E2164756E21
|
|
279
|
+
//# sourceMappingURL=chunk-nqna8dzp.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/cli/commands/build.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { existsSync } from \"node:fs\";\nimport { readdir, stat } from \"node:fs/promises\";\n\nimport { build } from \"astro\";\nimport { defineCommand } from \"citty\";\nimport { join } from \"pathe\";\n\nimport { publishBuildProject } from \"../../astro/integration.ts\";\nimport { BlumeError } from \"../../core/diagnostics.ts\";\nimport { ensureGitignore } from \"../../core/gitignore.ts\";\nimport type { BlumeProject } from \"../../core/project-graph.ts\";\nimport { serverFeatures } from \"../../core/server-features.ts\";\nimport {\n deployOutputDir,\n deployStaticDir,\n surfaceAdapterOutput,\n} from \"../../deploy/adapter-output.ts\";\nimport { deployPlatform } from \"../../deploy/platforms/index.ts\";\nimport { cardCacheTally, ogCacheDir, pruneCardCache } from \"../../og/cache.ts\";\nimport {\n flagList,\n removedBuildFlags,\n removedBuildFlagsAdvice,\n} from \"../../upgrade/upgrade.ts\";\nimport {\n astroBuildDiagnostics,\n buildFailureLocator,\n} from \"../build-failure.ts\";\nimport { commandMeta } from \"../command-meta.ts\";\nimport { refuseIfDevRunning } from \"../dev-lock.ts\";\nimport { refuseIfEjected } from \"../eject-scripts.ts\";\nimport { logger, reportDiagnostics } from \"../log.ts\";\nimport { prepareProject } from \"../prepare.ts\";\n\nconst BUDGET_JS = \"budget-js\";\nconst BUDGET_CSS = \"budget-css\";\n\ninterface BudgetArgs {\n \"budget-css\"?: string;\n \"budget-js\"?: string;\n}\n\n/**\n * Reject a non-numeric performance budget. `Number(\"250kb\")` is `NaN` and\n * `total > NaN` is always false, so a typo'd flag would silently pass the gate;\n * fail up front instead.\n */\nconst validateBudgetFlags = (args: BudgetArgs): void => {\n for (const flag of [BUDGET_JS, BUDGET_CSS] as const) {\n const value = args[flag];\n const parsed = Number(value);\n // Equivalent to `!(parsed > 0)` but without the inverted check: this must\n // also reject `NaN` (a typo'd flag like \"250kb\"), which `parsed <= 0` alone\n // would let through since `NaN <= 0` is false.\n if (value !== undefined && (Number.isNaN(parsed) || parsed <= 0)) {\n logger.error(\n `Invalid --${flag} \"${value}\" (expected a positive number of kB).`\n );\n process.exit(1);\n }\n }\n};\n\n/**\n * Report how many OG cards the build read back from the on-disk cache against\n * how many it rendered (the endpoint tallies both), so a warm rebuild shows\n * where the time went. With `prune`, also drop the cached cards this build\n * never asked for — renamed pages, edited descriptions, cards from an earlier\n * Blume version — so a persisted cache holds exactly the current site's cards.\n */\nconst reportCardCache = async (\n project: BlumeProject,\n prune: boolean\n): Promise<void> => {\n const cards = cardCacheTally();\n if (!cards) {\n return;\n }\n logger.info(\n `OG cards: ${cards.hits} reused from the cache, ${cards.misses} rendered`\n );\n if (prune) {\n await pruneCardCache(ogCacheDir(project.context));\n }\n};\n\nconst formatBytes = (bytes: number): string => {\n if (bytes < 1024) {\n return `${bytes} B`;\n }\n const digits = bytes < 1024 * 100 ? 1 : 0;\n return `${(bytes / 1024).toFixed(digits)} kB`;\n};\n\n/** Sizes of `dist/_astro/*.<ext>`, largest first (empty when none exist). */\nconst astroAssets = async (\n distDir: string,\n ext: string\n): Promise<{ name: string; size: number }[]> => {\n const astroDir = join(distDir, \"_astro\");\n if (!existsSync(astroDir)) {\n return [];\n }\n const entries = await readdir(astroDir);\n const files = entries.filter((name) => name.endsWith(`.${ext}`));\n const sized = await Promise.all(\n files.map(async (name) => {\n const info = await stat(join(astroDir, name));\n return { name, size: info.size };\n })\n );\n return sized.toSorted((a, b) => b.size - a.size);\n};\n\nconst totalSize = (assets: { size: number }[]): number =>\n assets.reduce((sum, asset) => sum + asset.size, 0);\n\n/**\n * Print the client JavaScript Astro shipped, largest first, plus the total. A\n * dependency-free bundle report — the interactive weight of a docs site is its\n * `_astro/*.js`, so this surfaces regressions without a visualizer.\n */\nconst reportBundleSizes = async (distDir: string): Promise<void> => {\n const sized = await astroAssets(distDir, \"js\");\n if (sized.length === 0) {\n logger.info(\"No client JavaScript emitted — the site ships zero JS.\");\n return;\n }\n const rows = sized\n .slice(0, 15)\n .map((file) => ` ${formatBytes(file.size).padStart(8)} ${file.name}`);\n logger.box(\n [\n `Client JavaScript — ${sized.length} file(s), ${formatBytes(totalSize(sized))} total`,\n \"\",\n ...rows,\n sized.length > 15 ? ` … and ${sized.length - 15} more` : null,\n ]\n .filter((line) => line !== null)\n .join(\"\\n\")\n );\n};\n\n/**\n * Enforce a performance budget on the built client assets: fail the build when\n * total `_astro/*.js` (or `*.css`) exceeds the given kB cap. Budgets that would\n * otherwise be \"documented, not measured\" become a real CI gate. Returns whether\n * every budget passed.\n */\nconst enforceBudget = async (\n distDir: string,\n args: BudgetArgs\n): Promise<\"fail\" | \"pass\" | \"skip\"> => {\n const checks: { ext: string; limitKb: number; name: string }[] = [\n ...(args[BUDGET_JS]\n ? [{ ext: \"js\", limitKb: Number(args[BUDGET_JS]), name: \"JavaScript\" }]\n : []),\n ...(args[BUDGET_CSS]\n ? [{ ext: \"css\", limitKb: Number(args[BUDGET_CSS]), name: \"CSS\" }]\n : []),\n ];\n if (checks.length === 0) {\n return \"skip\";\n }\n let passed = true;\n for (const check of checks) {\n // oxlint-disable-next-line no-await-in-loop -- a couple of sequential reads\n const total = totalSize(await astroAssets(distDir, check.ext));\n const limit = check.limitKb * 1024;\n if (total > limit) {\n passed = false;\n logger.error(\n `${check.name} budget exceeded: ${formatBytes(total)} > ${check.limitKb} kB`\n );\n } else {\n logger.success(\n `${check.name} budget: ${formatBytes(total)} / ${check.limitKb} kB`\n );\n }\n }\n return passed ? \"pass\" : \"fail\";\n};\n\n/**\n * Run the optional bundle report (`--analyze`) and performance-budget gate\n * against the directory whose `_astro/` client assets the deploy serves.\n * Shared by real and isolated builds — an isolated CI run passing\n * `--budget-js` must still fail on an exceeded budget rather than silently\n * skipping the check. Exits non-zero when a budget is exceeded.\n */\nexport const runClientAssetChecks = async (\n staticDir: string,\n args: { analyze?: boolean } & BudgetArgs\n): Promise<void> => {\n if (args.analyze) {\n await reportBundleSizes(staticDir);\n }\n if ((await enforceBudget(staticDir, args)) === \"fail\") {\n process.exit(1);\n }\n};\n\n/**\n * Print the build summary box and run the optional bundle report / budget\n * gate against the served static dir. The deploy artifacts themselves\n * (search index, llms.txt, sitemap, robots, redirect and header files, …)\n * were written by the integration's `astro:build:done` hook during\n * `build()` — see `deploy/artifacts.ts`. Exits non-zero if a budget is\n * exceeded.\n */\nconst reportBuild = async (\n project: BlumeProject,\n distDir: string,\n args: { analyze?: boolean } & BudgetArgs\n): Promise<void> => {\n const { config } = project;\n const features = serverFeatures(config);\n // The sitemap needs both the flag and a `site` (absolute URLs) — only the\n // latter deserves the remediation hint.\n const sitemapNote = config.seo.sitemap\n ? \"no (set deployment.site)\"\n : \"no (seo.sitemap is false)\";\n const rows: [label: string, value: string | number][] = [\n [\"Output\", config.deployment.options.output],\n [\"Adapter\", config.deployment.kind],\n [\"Site\", config.deployment.options.site ?? \"not set\"],\n [\"Search\", config.search.provider.kind],\n [\"Redirects\", config.redirects.length],\n [\n \"Sitemap\",\n config.deployment.options.site && config.seo.sitemap\n ? \"yes\"\n : sitemapNote,\n ],\n [\"Robots\", config.seo.robots ? \"yes\" : \"no\"],\n [\"Agent JSON\", config.agents.agentReadability ? \"yes\" : \"no\"],\n [\"LLM files\", config.agents.llmsTxt.enabled ? \"yes\" : \"no\"],\n [\"Server features\", features.length > 0 ? features.join(\", \") : \"none\"],\n ];\n // One label column for every row, sized by the longest label.\n const labelWidth = Math.max(...rows.map(([label]) => label.length)) + 2;\n logger.box(\n rows\n .map(([label, value]) => `${label.padEnd(labelWidth)}${value}`)\n .join(\"\\n\")\n );\n\n await runClientAssetChecks(distDir, args);\n\n // Only reachable with --no-strict (strict aborts earlier): repeat the missing\n // count next to the success banner so it can't scroll away unseen.\n if (project.droppedPages > 0) {\n logger.warn(\n `${project.droppedPages} page(s) failed validation and are missing from this build.`\n );\n }\n logger.success(`Built to ${distDir}`);\n};\n\nexport const buildCommand = defineCommand({\n args: {\n analyze: {\n description: \"Report client JavaScript bundle sizes after the build.\",\n type: \"boolean\",\n },\n [BUDGET_CSS]: {\n description: \"Fail if total client CSS exceeds this many kB.\",\n type: \"string\",\n },\n [BUDGET_JS]: {\n description: \"Fail if total client JavaScript exceeds this many kB.\",\n type: \"string\",\n },\n isolated: {\n description:\n \"Build into an isolated .blume-verify runtime (and its own dist) so a running dev server and the real dist/ are untouched. For verifying changes while `blume dev` runs.\",\n type: \"boolean\",\n },\n preview: {\n description: \"Include drafts and unpublished CMS content.\",\n type: \"boolean\",\n },\n strict: {\n default: true,\n description:\n \"Fail on error diagnostics (default; pass --no-strict to build anyway, dropping pages that fail validation).\",\n type: \"boolean\",\n },\n },\n meta: commandMeta.build,\n async run({ args, rawArgs }) {\n const root = process.cwd();\n\n // citty accepts unknown flags, so a Blume 1 `--adapter vercel --output\n // server` would otherwise build a static site without a word.\n const removed = removedBuildFlags(rawArgs);\n if (removed.length > 0) {\n logger.error(\n `blume build no longer takes ${flagList(removed)}. ${removedBuildFlagsAdvice(removed)}`\n );\n process.exit(1);\n }\n await refuseIfEjected(root, \"build\");\n\n // `--isolated` (or BLUME_RUNTIME_DIR) relocates the whole runtime to a\n // sibling dir so this build never touches a live dev server's `.blume/` or\n // the user's real `dist/`. A non-default runtime dir has no dev lock, so the\n // refusal below lets it proceed; a plain build still refuses.\n const runtimeDir = args.isolated\n ? \".blume-verify\"\n : process.env.BLUME_RUNTIME_DIR;\n refuseIfDevRunning(root, \"building\", { isolatedHint: true, runtimeDir });\n if (args.isolated) {\n await ensureGitignore(root, [\".blume-verify/\"]);\n }\n\n validateBudgetFlags(args);\n\n const project = await prepareProject({\n mode: \"build\",\n preview: args.preview,\n root,\n runtimeDir,\n strict: args.strict,\n });\n\n logger.start(\n `Building ${project.graph.pages.length} page(s) (${project.config.deployment.options.output} output)`\n );\n\n // Hand the scanned project to the integration: its `astro:build:done`\n // hook writes the deploy artifacts (search index, llms.txt, sitemap, …)\n // into Astro's client output during the build. An isolated build is a\n // throwaway verify that only needs to confirm the site compiles and\n // renders, so it publishes nothing — no network post-steps (a hosted\n // search sync would push), no deploy artifacts.\n if (!runtimeDir) {\n publishBuildProject(project);\n }\n\n try {\n await build({\n logLevel: \"info\",\n root: project.context.outDir,\n });\n } catch (error) {\n // Astro rejects when the site fails to compile or render (MDX that\n // doesn't parse, a component that throws): report that as a build error\n // at the file it names, not as an internal error blaming Blume. A\n // BlumeError keeps its own diagnostic.\n if (error instanceof BlumeError || !(error instanceof Error)) {\n throw error;\n }\n reportDiagnostics(\n await astroBuildDiagnostics(error, {\n locate: buildFailureLocator(project),\n root,\n }),\n root\n );\n process.exit(1);\n }\n\n // A real build also prunes the cache; an isolated verify must not evict\n // cards a live dev server is still serving.\n await reportCardCache(project, !runtimeDir);\n\n // Everything the deploy target does differently after `astro build` comes\n // off its platform (see `deploy/platforms/*`): a server build's post-build\n // step (Vercel's function-bundle audit and negotiation routes, Cloudflare's\n // wrapper Worker), and where its bundle and static assets landed.\n const { deployment } = project.config;\n const platform = deployPlatform(deployment);\n const server = deployment.options.output === \"server\";\n const finalize = async (isolated: boolean): Promise<void> => {\n if (\n server &&\n platform.finalizeBuild &&\n !(await platform.finalizeBuild({ isolated, log: logger, project }))\n ) {\n process.exit(1);\n }\n };\n\n // The bundle report and budget gate still run for an isolated build —\n // `blume build --isolated --budget-js 100` exiting 0 without measuring\n // anything would be a silent false pass in CI. An isolated build never\n // surfaces the adapter bundle to the project root, so its output dirs\n // resolve under the relocated runtime.\n if (runtimeDir) {\n await finalize(true);\n await runClientAssetChecks(\n deployStaticDir(project.config, project.context),\n args\n );\n logger.success(\n `Isolated build OK — output at ${deployOutputDir(project.config, project.context)} (not published).`\n );\n return;\n }\n\n // A server adapter's deploy bundle is a build artifact — keep it out of\n // version control (Vercel's own CLI ignores `.vercel/` for the same reason).\n // Ignoring it is independent of whether the bundle had to be moved below:\n // Vercel writes straight to the project root, Netlify does not.\n const { ignoreDir } = platform.hiddenRuntime;\n if (server && ignoreDir) {\n await ensureGitignore(root, [ignoreDir]);\n }\n\n // Netlify writes its deploy bundle relative to the Astro root — which Blume\n // points at the hidden `.blume` runtime — so the bundle lands where the\n // deploy platform never looks. Surface it up to the project root before\n // publishing artifacts into the served static dir.\n const surfaced = await surfaceAdapterOutput(\n project.config,\n project.context\n );\n if (surfaced.moved) {\n logger.success(`Surfaced ${deployment.kind} output to ${surfaced.to}`);\n }\n\n await finalize(false);\n\n await reportBuild(\n project,\n deployStaticDir(project.config, project.context),\n args\n );\n },\n});\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAEA;AACA;AACA;AA6BA,IAAM,YAAY;AAClB,IAAM,aAAa;AAYnB,IAAM,sBAAsB,CAAC,SAA2B;AAAA,EACtD,WAAW,QAAQ,CAAC,WAAW,UAAU,GAAY;AAAA,IACnD,MAAM,QAAQ,KAAK;AAAA,IACnB,MAAM,SAAS,OAAO,KAAK;AAAA,IAI3B,IAAI,UAAU,cAAc,OAAO,MAAM,MAAM,KAAK,UAAU,IAAI;AAAA,MAChE,OAAO,MACL,aAAa,SAAS,4CACxB;AAAA,MACA,QAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AAAA;AAUF,IAAM,kBAAkB,OACtB,SACA,UACkB;AAAA,EAClB,MAAM,QAAQ,eAAe;AAAA,EAC7B,IAAI,CAAC,OAAO;AAAA,IACV;AAAA,EACF;AAAA,EACA,OAAO,KACL,aAAa,MAAM,+BAA+B,MAAM,iBAC1D;AAAA,EACA,IAAI,OAAO;AAAA,IACT,MAAM,eAAe,WAAW,QAAQ,OAAO,CAAC;AAAA,EAClD;AAAA;AAGF,IAAM,cAAc,CAAC,UAA0B;AAAA,EAC7C,IAAI,QAAQ,MAAM;AAAA,IAChB,OAAO,GAAG;AAAA,EACZ;AAAA,EACA,MAAM,SAAS,QAAQ,OAAO,MAAM,IAAI;AAAA,EACxC,OAAO,IAAI,QAAQ,MAAM,QAAQ,MAAM;AAAA;AAIzC,IAAM,cAAc,OAClB,SACA,QAC8C;AAAA,EAC9C,MAAM,WAAW,KAAK,SAAS,QAAQ;AAAA,EACvC,IAAI,CAAC,WAAW,QAAQ,GAAG;A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|
@@ -10,16 +9,17 @@ import {
|
|
|
10
9
|
logger,
|
|
11
10
|
reportDiagnostics
|
|
12
11
|
} from "./index.js";
|
|
12
|
+
import"./chunk-zccbjcj0.js";
|
|
13
13
|
import {
|
|
14
14
|
AGENTS,
|
|
15
15
|
launchInstalledAgent
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-aafhwx74.js";
|
|
17
17
|
import {
|
|
18
18
|
scanProject
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-zxd5jrgx.js";
|
|
20
20
|
import {
|
|
21
21
|
siteSkillName
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-q1wwrxzw.js";
|
|
23
23
|
|
|
24
24
|
// src/cli/commands/skill.ts
|
|
25
25
|
import { defineCommand } from "citty";
|
|
@@ -122,5 +122,5 @@ export {
|
|
|
122
122
|
skillCommand
|
|
123
123
|
};
|
|
124
124
|
|
|
125
|
-
//# debugId=
|
|
126
|
-
//# sourceMappingURL=chunk-
|
|
125
|
+
//# debugId=8BB2AE139A5F70AE64756E2164756E21
|
|
126
|
+
//# sourceMappingURL=chunk-p834rkcn.js.map
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
"import { existsSync } from \"node:fs\";\n\nimport { join, relative, resolve } from \"pathe\";\n\nimport type { BlumeProject } from \"../core/project-graph.ts\";\nimport { siteSkillName } from \"./site-skill.ts\";\n\n/**\n * `blume skill`'s logic, kept out of the command module so it runs (and is\n * covered) in-process. Writing a product skill is judgment work — what the\n * product is, which tasks matter, where it bites — so it lives in the\n * `blume-write-skill` skill, shipped inside the package. This module only\n * works out where the skill goes and writes the prompt that points a coding\n * agent at the skill and the docs.\n */\n\n/** The skill's directory inside the published package. */\nexport const WRITE_SKILL_DIR = join(\"skills\", \"blume-write-skill\");\n\n/** Where `agents.skills` points when the config doesn't set it. */\nconst DEFAULT_SKILLS_DIR = \"skills\";\n\n/** Where the skill goes, and what the agent needs to know to write it. */\nexport interface SkillPlan {\n /** The `agents.skills` value to add, when the config has none. */\n configure?: string;\n /** The config file to add it to, relative to the project root. */\n configFile: string;\n /** The content root, relative to the project root. */\n contentRoot: string;\n /** Whether a skill is already there to update. */\n exists: boolean;\n /** Where to write the skill, relative to the project root. */\n file: string;\n /** The skill's name: the generated site skill's, so it replaces it. */\n name: string;\n /** The site's URL, for the skill's absolute links. */\n site?: string;\n title: string;\n}\n\n/** Plan the skill for a scanned project. */\nexport const planSkill = (project: BlumeProject): SkillPlan => {\n const { config, context } = project;\n const name = siteSkillName(project);\n const file = resolve(\n context.root,\n config.agents.skills ?? DEFAULT_SKILLS_DIR,\n name,\n \"SKILL.md\"\n );\n const plan: SkillPlan = {\n configFile: context.configFile\n ? relative(context.root, context.configFile)\n : \"blume.config.ts\",\n contentRoot: relative(context.root, context.contentRoot) || \".\",\n exists: existsSync(file),\n file: relative(context.root, file),\n name,\n site: config.deployment.options.site,\n title: config.title,\n };\n return config.agents.skills\n ? plan\n : { ...plan, configure: `./${DEFAULT_SKILLS_DIR}` };\n};\n\n/** The prompt that hands the plan to a coding agent. */\nexport const writeSkillPrompt = (\n plan: SkillPlan,\n options: { skillDir: string; version: string }\n): string => {\n const { skillDir, version } = options;\n const lines = [\n `Write the agent skill for the ${plan.title} docs, a Blume ${version} site.`,\n \"\",\n `Follow the blume-write-skill skill: read ${join(skillDir, \"SKILL.md\")} first and work through its workflow.`,\n \"\",\n plan.exists\n ? `A skill already exists at ${plan.file}. Update it against the current docs rather than starting over, and keep what's still true.`\n : `Write it to ${plan.file}.`,\n `Its frontmatter \\`name\\` must be \\`${plan.name}\\`: that's the name of the skill Blume generates for this site, and a skill with the same name replaces it.`,\n ];\n if (plan.configure) {\n lines.push(\n `Then set \\`agents.skills: \"${plan.configure}\"\\` in ${plan.configFile} so the build publishes it.`\n );\n }\n lines.push(\n \"\",\n `The docs source is in ${plan.contentRoot}.`,\n plan.site\n ? `The site is served at ${plan.site}, so link pages as ${plan.site.replace(/\\/$/u, \"\")}<route>.md.`\n : `The config has no \\`deployment.site\\`, and the skill's links must be absolute. Ask me for the site's URL, and set it as \\`deployment.site\\` in ${plan.configFile}.`\n );\n return lines.join(\"\\n\");\n};\n"
|
|
7
7
|
],
|
|
8
8
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA,iBAAS;;;ACDT;AAEA;AAeO,IAAM,kBAAkB,KAAK,UAAU,mBAAmB;AAGjE,IAAM,qBAAqB;AAsBpB,IAAM,YAAY,CAAC,YAAqC;AAAA,EAC7D,QAAQ,QAAQ,YAAY;AAAA,EAC5B,MAAM,OAAO,cAAc,OAAO;AAAA,EAClC,MAAM,OAAO,QACX,QAAQ,MACR,OAAO,OAAO,UAAU,oBACxB,MACA,UACF;AAAA,EACA,MAAM,OAAkB;AAAA,IACtB,YAAY,QAAQ,aAChB,SAAS,QAAQ,MAAM,QAAQ,UAAU,IACzC;AAAA,IACJ,aAAa,SAAS,QAAQ,MAAM,QAAQ,WAAW,KAAK;AAAA,IAC5D,QAAQ,WAAW,IAAI;AAAA,IACvB,MAAM,SAAS,QAAQ,MAAM,IAAI;AAAA,IACjC;AAAA,IACA,MAAM,OAAO,WAAW,QAAQ;AAAA,IAChC,OAAO,OAAO;AAAA,EAChB;AAAA,EACA,OAAO,OAAO,OAAO,SACjB,OACA,KAAK,MAAM,WAAW,KAAK,qBAAqB;AAAA;AAI/C,IAAM,mBAAmB,CAC9B,MACA,YACW;AAAA,EACX,QAAQ,UAAU,YAAY;AAAA,EAC9B,MAAM,QAAQ;AAAA,IACZ,iCAAiC,KAAK,uBAAuB;AAAA,IAC7D;AAAA,IACA,4CAA4C,KAAK,UAAU,UAAU;AAAA,IACrE;AAAA,IACA,KAAK,SACD,6BAA6B,KAAK,oGAClC,eAAe,KAAK;AAAA,IACxB,sCAAsC,KAAK;AAAA,EAC7C;AAAA,EACA,IAAI,KAAK,WAAW;AAAA,IAClB,MAAM,KACJ,8BAA8B,KAAK,mBAAmB,KAAK,uCAC7D;AAAA,EACF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,gBAAgB,EAAE,CAAC,CACjE;AAAA,MACA,IAAI,SAAS,MAAM;AAAA,QACjB,OAAO,MACL,GAAG,IAAI,WAAW,IAAI,mDAAmD,IAAI,YAC/E;AAAA,QACA,QAAQ,KAAK,CAAC;AAAA,MAChB;AAAA,MACA,IAAI,SAAS,GAAG;AAAA,QACd,QAAQ,KAAK,IAAI;AAAA,MACnB;AAAA,MACA,OAAO,OAAO;AAAA,MACd,IAAI,iBAAiB,YAAY;AAAA,QAC/B,kBAAkB,CAAC,MAAM,UAAU,GAAG,IAAI;AAAA,QAC1C,QAAQ,KAAK,CAAC;AAAA,MAChB;AAAA,MACA,oBAAoB,KAAK;AAAA,MACzB,QAAQ,KAAK,CAAC;AAAA;AAAA;AAGpB,CAAC;",
|
|
9
|
-
"debugId": "
|
|
9
|
+
"debugId": "8BB2AE139A5F70AE64756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
+
referenceRoutes,
|
|
4
|
+
resolveDocsCollection,
|
|
3
5
|
discoverPages,
|
|
4
6
|
customStaticRoutes,
|
|
5
7
|
hasGeneratedChangelog,
|
|
8
|
+
buildManifest,
|
|
6
9
|
validateLinks
|
|
7
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-r5nm9w0c.js";
|
|
8
11
|
import {
|
|
9
12
|
commandMeta,
|
|
10
13
|
reportInternalError,
|
|
@@ -14,17 +17,21 @@ import {
|
|
|
14
17
|
reportDiagnosticsJson,
|
|
15
18
|
reportDiagnostics
|
|
16
19
|
} from "./index.js";
|
|
17
|
-
import"./chunk-zccbjcj0.js";
|
|
18
20
|
import {
|
|
19
|
-
buildManifest,
|
|
20
21
|
scanProject
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-zxd5jrgx.js";
|
|
23
|
+
import {
|
|
24
|
+
normalizeBasePath
|
|
25
|
+
} from "./chunk-zccbjcj0.js";
|
|
26
|
+
import {
|
|
27
|
+
generatedFilePaths
|
|
28
|
+
} from "./chunk-487b95qy.js";
|
|
22
29
|
import {
|
|
23
30
|
parseIgnoreFlag
|
|
24
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-fnxgtjeq.js";
|
|
32
|
+
import"./chunk-q1wwrxzw.js";
|
|
25
33
|
|
|
26
34
|
// src/cli/commands/validate.ts
|
|
27
|
-
import { existsSync } from "node:fs";
|
|
28
35
|
import { defineCommand } from "citty";
|
|
29
36
|
import { join } from "pathe";
|
|
30
37
|
var validateCommand = defineCommand({
|
|
@@ -56,7 +63,10 @@ var validateCommand = defineCommand({
|
|
|
56
63
|
const project = await scanProject(root, { mode: "build" });
|
|
57
64
|
diagnostics.push(...project.diagnostics);
|
|
58
65
|
const userPages = project.context.pagesRoot ? await discoverPages(project.context.pagesRoot) : [];
|
|
59
|
-
const extraRoutes =
|
|
66
|
+
const extraRoutes = [
|
|
67
|
+
...customStaticRoutes(userPages),
|
|
68
|
+
...referenceRoutes(project.config)
|
|
69
|
+
];
|
|
60
70
|
if (hasGeneratedChangelog(project, userPages)) {
|
|
61
71
|
extraRoutes.push("/changelog");
|
|
62
72
|
}
|
|
@@ -68,14 +78,17 @@ var validateCommand = defineCommand({
|
|
|
68
78
|
});
|
|
69
79
|
extraRoutes.push(...manifest.routes.flatMap((route) => route.fallback ? [route.path] : []));
|
|
70
80
|
}
|
|
71
|
-
const publicDir = join(root, "public");
|
|
72
81
|
diagnostics.push(...await validateLinks(project.graph, {
|
|
73
82
|
basePath: project.config.basePath,
|
|
74
83
|
checkExternal: Boolean(args.external),
|
|
84
|
+
configFile: project.context.configFile ?? undefined,
|
|
85
|
+
contentRoot: resolveDocsCollection(project.config, root).base,
|
|
86
|
+
deployBase: normalizeBasePath(project.config.deployment.options.base),
|
|
75
87
|
extraRoutes,
|
|
88
|
+
generatedFiles: generatedFilePaths(project),
|
|
76
89
|
i18n: project.config.i18n,
|
|
77
90
|
ignore,
|
|
78
|
-
publicDir:
|
|
91
|
+
publicDir: join(root, "public"),
|
|
79
92
|
redirects: project.config.redirects
|
|
80
93
|
}));
|
|
81
94
|
} catch (error) {
|
|
@@ -108,5 +121,5 @@ export {
|
|
|
108
121
|
validateCommand
|
|
109
122
|
};
|
|
110
123
|
|
|
111
|
-
//# debugId=
|
|
112
|
-
//# sourceMappingURL=chunk-
|
|
124
|
+
//# debugId=0B908AF983A1FB4C64756E2164756E21
|
|
125
|
+
//# sourceMappingURL=chunk-ppa6mg4d.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/cli/commands/validate.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { defineCommand } from \"citty\";\nimport { join } from \"pathe\";\n\nimport {\n customStaticRoutes,\n discoverPages,\n hasGeneratedChangelog,\n} from \"../../astro/pages.ts\";\nimport { normalizeBasePath } from \"../../core/base-path.ts\";\nimport { BlumeError } from \"../../core/diagnostics.ts\";\nimport { validateLinks } from \"../../core/links.ts\";\nimport { buildManifest } from \"../../core/manifest.ts\";\nimport { scanProject } from \"../../core/project-graph.ts\";\nimport { resolveDocsCollection } from \"../../core/sources/collection.ts\";\nimport type { Diagnostic } from \"../../core/types.ts\";\nimport { generatedFilePaths } from \"../../deploy/generated-files.ts\";\nimport { referenceRoutes } from \"../../openapi/references.ts\";\nimport { parseIgnoreFlag } from \"../args.ts\";\nimport { commandMeta } from \"../command-meta.ts\";\nimport { reportInternalError } from \"../internal-error.ts\";\nimport {\n flushStdout,\n logger,\n reportDiagnostics,\n reportDiagnosticsJson,\n} from \"../log.ts\";\n\nexport const validateCommand = defineCommand({\n args: {\n external: {\n description: \"Check external (HTTP) links over the network.\",\n type: \"boolean\",\n },\n ignore: {\n description:\n 'With --external, skip external links whose URL matches this glob (e.g. \"https://example.com/**\"). Repeat it for more; internal links are always checked.',\n type: \"string\",\n valueHint: \"glob\",\n },\n json: {\n description: \"Emit diagnostics as JSON on stdout (for CI/editors).\",\n type: \"boolean\",\n },\n strict: {\n description: \"Treat warnings as errors.\",\n type: \"boolean\",\n },\n },\n meta: commandMeta.validate,\n async run({ args, rawArgs }) {\n const root = process.cwd();\n const ignore = parseIgnoreFlag(rawArgs);\n const diagnostics: Diagnostic[] = [];\n\n try {\n const project = await scanProject(root, { mode: \"build\" });\n // Surface content/graph problems too: a page that fails to parse is a\n // link-validation blind spot, so silently passing would be misleading.\n diagnostics.push(...project.diagnostics);\n\n // Custom `.astro` pages, reference routes (a `scalar()` page), and the\n // generated changelog index are servable routes the content graph can't\n // see — without them, a docs link to e.g. a custom landing page fails as\n // BLUME_BROKEN_LINK.\n const userPages = project.context.pagesRoot\n ? await discoverPages(project.context.pagesRoot)\n : [];\n const extraRoutes = [\n ...customStaticRoutes(userPages),\n ...referenceRoutes(project.config),\n ];\n if (hasGeneratedChangelog(project, userPages)) {\n extraRoutes.push(\"/changelog\");\n }\n\n // Fallback-materialized locale routes (an untranslated page prerendered\n // at its localized URL) are servable but absent from the content graph —\n // without them a link to an untranslated sibling under a non-default\n // locale fails as BLUME_BROKEN_LINK even though the built site serves it.\n if (project.config.i18n) {\n const manifest = buildManifest({\n config: project.config,\n context: project.context,\n graph: project.graph,\n });\n extraRoutes.push(\n ...manifest.routes.flatMap((route) =>\n route.fallback ? [route.path] : []\n )\n );\n }\n\n // Links to `public/` files and to the files the build generates\n // (`/llms.txt`, `/sitemap.xml`) resolve too. With no `public/` folder,\n // the site ships no public files, so links to one are reported.\n diagnostics.push(\n ...(await validateLinks(project.graph, {\n basePath: project.config.basePath,\n checkExternal: Boolean(args.external),\n configFile: project.context.configFile ?? undefined,\n contentRoot: resolveDocsCollection(project.config, root).base,\n deployBase: normalizeBasePath(project.config.deployment.options.base),\n extraRoutes,\n generatedFiles: generatedFilePaths(project),\n i18n: project.config.i18n,\n ignore,\n publicDir: join(root, \"public\"),\n redirects: project.config.redirects,\n }))\n );\n } catch (error) {\n if (error instanceof BlumeError) {\n diagnostics.push(error.diagnostic);\n } else {\n reportInternalError(error);\n process.exit(1);\n }\n }\n\n // `--strict` escalates warnings to failures; info-level notes stay\n // advisory.\n const strictFailure =\n Boolean(args.strict) &&\n diagnostics.some((diagnostic) => diagnostic.severity !== \"info\");\n\n if (args.json) {\n // Drain stdout before exiting non-zero: `process.exit` would otherwise\n // truncate the JSON payload mid-write when stdout is a pipe — exactly how\n // `--json` is consumed in CI/editors.\n const hadErrors = reportDiagnosticsJson(diagnostics, root);\n if (hadErrors || strictFailure) {\n await flushStdout();\n process.exit(1);\n }\n return;\n }\n\n const hadErrors = reportDiagnostics(diagnostics, root);\n if (diagnostics.length === 0) {\n logger.success(\"No broken links found.\");\n }\n if (hadErrors || strictFailure) {\n // Set the code and return rather than `process.exit`, which doesn't wait\n // for a piped stderr: a long diagnostic list would be cut off.\n process.exitCode = 1;\n }\n },\n});\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AA0BO,IAAM,kBAAkB,cAAc;AAAA,EAC3C,MAAM;AAAA,IACJ,UAAU;AAAA,MACR,aAAa;AAAA,MACb,MAAM;AAAA,IACR;AAAA,IACA,QAAQ;AAAA,MACN,aACE;AAAA,MACF,MAAM;AAAA,MACN,WAAW;AAAA,IACb;AAAA,IACA,MAAM;AAAA,MACJ,aAAa;AAAA,MACb,MAAM;AAAA,IACR;AAAA,IACA,QAAQ;AAAA,MACN,aAAa;AAAA,MACb,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,MAAM,YAAY;AAAA,OACZ,IAAG,GAAG,MAAM,WAAW;AAAA,IAC3B,MAAM,OAAO,QAAQ,IAAI;AAAA,IACzB,MAAM,SAAS,gBAAgB,OAAO;AAAA,IACtC,MAAM,cAA4B,CAAC;AAAA,IAEnC,IAAI;AAAA,MACF,MAAM,UAAU,MAAM,YAAY,MAAM,EAAE,MAAM,QAAQ,CAAC;AAAA,MAG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AC;AAAA;AAAA;AAAA,IAMlB,MAAM,gBACJ,QAAQ,KAAK,MAAM,KACnB,YAAY,KAAK,CAAC,eAAe,WAAW,aAAa,MAAM;AAAA,IAEjE,IAAI,KAAK,MAAM;AAAA,MAIb,MAAM,YAAY,sBAAsB,aAAa,IAAI;AAAA,MACzD,IAAI,aAAa,eAAe;AAAA,QAC9B,MAAM,YAAY;AAAA,QAClB,QAAQ,KAAK,CAAC;AAAA,MAChB;AAAA,MACA;AAAA,IACF;AAAA,IAEA,MAAM,YAAY,kBAAkB,aAAa,IAAI;AAAA,IACrD,IAAI,YAAY,WAAW,GAAG;AAAA,MAC5B,OAAO,QAAQ,wBAAwB;AAAA,IACzC;AAAA,IACA,IAAI,aAAa,eAAe;AAAA,MAG9B,QAAQ,WAAW;AAAA,IACrB;AAAA;AAEJ,CAAC;",
|
|
8
|
+
"debugId": "0B908AF983A1FB4C64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
asciiSlugify
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-r5nm9w0c.js";
|
|
5
5
|
|
|
6
6
|
// src/ai/site-skill.ts
|
|
7
7
|
var NAME_MAX = 64;
|
|
8
|
+
var SKILL_MD_PATH = "/skill.md";
|
|
8
9
|
var siteSkillName = (project) => {
|
|
9
10
|
const { site } = project.config.deployment.options;
|
|
10
11
|
const fromTitle = asciiSlugify(project.config.title);
|
|
@@ -12,7 +13,7 @@ var siteSkillName = (project) => {
|
|
|
12
13
|
return name.slice(0, NAME_MAX).replace(/-+$/u, "");
|
|
13
14
|
};
|
|
14
15
|
|
|
15
|
-
export { siteSkillName };
|
|
16
|
+
export { SKILL_MD_PATH, siteSkillName };
|
|
16
17
|
|
|
17
|
-
//# debugId=
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
18
|
+
//# debugId=CA3AF8894895500A64756E2164756E21
|
|
19
|
+
//# sourceMappingURL=chunk-q1wwrxzw.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/ai/site-skill.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { hasGeneratedChangelog } from \"../astro/pages.ts\";\nimport {\n mountBasePath,\n normalizeBasePath,\n withBasePath,\n} from \"../core/base-path.ts\";\nimport { CHANGELOG_INDEX_ROUTE } from \"../core/changelog-index.ts\";\nimport { discoverPagesSync } from \"../core/custom-pages.ts\";\nimport { isHiddenPage } from \"../core/hidden-pages.ts\";\nimport { metaDescription } from \"../core/manifest.ts\";\nimport type { BlumeProject } from \"../core/project-graph.ts\";\nimport { absoluteUrl } from \"../core/site-url.ts\";\nimport type { NavNode, PageRecord } from \"../core/types.ts\";\nimport { resolveReferences } from \"../openapi/references.ts\";\nimport { docsPhrase } from \"./ai-catalog.ts\";\nimport { API_PAGES_PATH } from \"./api/paths.ts\";\nimport { asciiSlugify } from \"./mcp/discovery.ts\";\nimport {\n SKILL_DESCRIPTION_MAX,\n generatesSiteSkill,\n skillMdArtifact,\n} from \"./skills.ts\";\nimport type { SkillArtifact } from \"./skills.ts\";\n\n/**\n * The site's own agent skill (`agents.skillMd`): a `SKILL.md` in the Agent\n * Skills format, built from what the build already knows — the site's title\n * and description, how to read any page as Markdown, llms.txt and the MCP\n * server, the API references, and a map of the docs with each page's one-line\n * description. No model writes it, so it costs nothing and is current with\n * every build: a guide to the docs rather than a summary of the product. A\n * hand-written skill of the same name in `agents.skills` replaces it.\n */\n\n/** The most pages the map lists; llms.txt holds the rest. */\nexport const MAX_SKILL_PAGES = 200;\n\n/** The Agent Skills spec caps a skill name at 64 characters. */\nconst NAME_MAX = 64;\n\n/** Where the site skill is served besides the discovery index. */\nexport const SKILL_MD_PATH = \"/skill.md\";\n\n/**\n * The site skill's name: the title as a skill name (lowercase alphanumerics\n * and single hyphens), else the site's host, for a title with no Latin\n * letters in it.\n */\nexport const siteSkillName = (project: BlumeProject): string => {\n const { site } = project.config.deployment.options;\n const fromTitle = asciiSlugify(project.config.title);\n const name =\n fromTitle || asciiSlugify(site ? new URL(site).hostname : \"\") || \"docs\";\n return name.slice(0, NAME_MAX).replace(/-+$/u, \"\");\n};\n\n/** A title as Markdown link text (brackets escaped, as in llms.txt). */\nconst linkText = (title: string): string =>\n title.replaceAll(/[\\\\[\\]]/gu, String.raw`\\$&`);\n\n/**\n * Current-version, default-locale pages worth listing: not API operations,\n * and not changelog entries, which the changelog index covers in one line.\n */\nconst mappedPages = (project: BlumeProject): PageRecord[] => {\n const defaultLocale = project.config.i18n?.defaultLocale;\n return project.graph.pages.filter(\n (page) =>\n !(\n page.meta.ai.exclude ||\n page.meta.draft ||\n isHiddenPage(page, project.graph) ||\n page.meta.seo.noindex ||\n page.version !== \"\" ||\n page.source.name === \"openapi\" ||\n page.contentType === \"changelog\"\n ) &&\n (defaultLocale === undefined || page.locale === defaultLocale)\n );\n};\n\n/** Renders the page map, listing each page once, up to the cap. */\nclass PageMap {\n readonly #byRoute: Map<string, PageRecord>;\n readonly #listed = new Set<string>();\n readonly #url: (route: string) => string;\n\n constructor(pages: PageRecord[], url: (route: string) => string) {\n this.#byRoute = new Map(pages.map((page) => [page.route, page]));\n this.#url = url;\n }\n\n /** How many listable pages the cap left out. */\n get omitted(): number {\n return this.#byRoute.size - this.#listed.size;\n }\n\n /** The Markdown link line for a route, or nothing when it isn't listed. */\n line(route: string): string[] {\n const page = this.#byRoute.get(route);\n if (\n !page ||\n this.#listed.has(route) ||\n this.#listed.size >= MAX_SKILL_PAGES\n ) {\n return [];\n }\n this.#listed.add(route);\n // As `llms.txt` lists it: the page's meta description.\n const description = metaDescription(page);\n const summary = description ? `: ${description}` : \"\";\n return [`- [${linkText(page.title)}](${this.#url(route)})${summary}`];\n }\n\n /** One navigation level: its loose pages, then each group under a heading. */\n level(nodes: NavNode[], depth: number): string[] {\n const list: string[] = [];\n const groups: string[] = [];\n for (const node of nodes) {\n if (node.kind === \"page\") {\n list.push(...this.line(node.route));\n continue;\n }\n const blocks = [\n ...(node.route ? this.line(node.route) : []),\n ...this.level(node.children, depth + 1),\n ];\n if (blocks.length > 0) {\n groups.push(\n \"\",\n `${\"#\".repeat(Math.min(depth, 6))} ${node.label}`,\n \"\",\n ...blocks\n );\n }\n }\n return [...list, ...groups];\n }\n\n /** Pages the navigation doesn't reach, in route order. */\n rest(): string[] {\n return [...this.#byRoute.keys()]\n .toSorted((a, b) => a.localeCompare(b))\n .flatMap((route) => this.line(route));\n }\n}\n\n/** The \"Reading the docs\" bullets: every agent surface the site serves. */\nconst surfaceLines = (\n project: BlumeProject,\n url: (path: string) => string\n): string[] => {\n const { agents } = project.config;\n const lines = [\n `- Any page as Markdown: add \\`.md\\` to its URL (the home page is ${url(\"/index.md\")}). Every page link below already points at the Markdown.`,\n ];\n if (agents.llmsTxt.enabled) {\n lines.push(\n `- [llms.txt](${url(\"/llms.txt\")}): every page with a one-line summary.`,\n `- [llms-full.txt](${url(\"/llms-full.txt\")}): every page in one file, for when you need all of it.`\n );\n }\n if (agents.mcp.enabled) {\n lines.push(\n `- MCP server at ${url(agents.mcp.route)}, with \\`search_docs\\`, \\`get_page\\`, \\`list_pages\\`, and \\`get_navigation\\`. Connect it to search the docs instead of guessing URLs.`\n );\n }\n if (agents.api) {\n lines.push(\n `- [JSON API](${url(API_PAGES_PATH)}): the page index, with each page as JSON and Markdown.`\n );\n }\n const userPages = project.context.pagesRoot\n ? discoverPagesSync(project.context.pagesRoot)\n : [];\n if (hasGeneratedChangelog(project, userPages)) {\n lines.push(\n `- [Changelog](${url(`${CHANGELOG_INDEX_ROUTE}.md`)}): release notes, newest first.`\n );\n }\n return lines;\n};\n\n/** The \"API reference\" bullets, one per rendered reference. */\nconst referenceLines = (\n project: BlumeProject,\n url: (path: string) => string\n): string[] =>\n resolveReferences(project.config).map((reference) => {\n // Scalar renders its own page with no Markdown mirror; Blume-rendered\n // references are pages like any other, one per operation.\n const route =\n reference.kind === \"scalar\"\n ? reference.route\n : withBasePath(reference.basePath, reference.route);\n const pages =\n reference.kind === \"scalar\"\n ? \"\"\n : \", with a page per operation (add `.md` for its Markdown)\";\n return `- [${linkText(reference.label)}](${url(route)})${pages}.`;\n });\n\n/** The skill's frontmatter `description`: what it's for and when to use it. */\nconst skillDescription = (project: BlumeProject): string => {\n const { description, title } = project.config;\n const summary = description ? ` ${description.trim()}` : \"\";\n return `Read ${docsPhrase(title, \"docs\")} instead of answering from memory.${summary} Use when a task involves ${title}: how it works, how to set it up or configure it, or its API.`.slice(\n 0,\n SKILL_DESCRIPTION_MAX\n );\n};\n\n/** The site skill's `SKILL.md`. */\nconst skillMarkdown = (project: BlumeProject, name: string): string => {\n const { config } = project;\n const { site = \"\" } = config.deployment.options;\n const base = normalizeBasePath(config.deployment.options.base);\n // Mounted and encoded like llms.txt's links.\n const url = (path: string): string =>\n encodeURI(absoluteUrl(site, mountBasePath(base, path)));\n const markdownUrl = (route: string): string =>\n url(route === \"/\" ? \"/index.md\" : `${route}.md`);\n\n const map = new PageMap(mappedPages(project), markdownUrl);\n const pages = [\n ...map.level(project.graph.navigation.sidebar, 3),\n ...map.rest(),\n ];\n const { omitted } = map;\n if (omitted > 0) {\n pages.push(\n \"\",\n config.agents.llmsTxt.enabled\n ? `…and ${omitted} more. [llms.txt](${url(\"/llms.txt\")}) lists every page.`\n : `…and ${omitted} more.`\n );\n }\n const references = referenceLines(project, url);\n\n return [\n \"---\",\n `name: ${name}`,\n `description: ${JSON.stringify(skillDescription(project))}`,\n \"---\",\n \"\",\n `# ${config.title}`,\n \"\",\n ...(config.description ? [config.description.trim(), \"\"] : []),\n `This skill points you at ${docsPhrase(config.title, \"docs\")}, at ${url(\"/\")}. When a task involves ${config.title}, read the relevant page before relying on what you remember: the docs are the source of truth, and they change.`,\n \"\",\n \"## Reading the docs\",\n \"\",\n ...surfaceLines(project, url),\n ...(references.length > 0\n ? [\"\", \"## API reference\", \"\", ...references]\n : []),\n ...(pages.length > 0 ? [\"\", \"## Pages\", \"\", ...pages] : []),\n \"\",\n ]\n .join(\"\\n\")\n .replaceAll(/\\n{3,}/gu, \"\\n\\n\");\n};\n\n/**\n * The generated site skill, or `null` when `agents.skillMd` is off or there\n * is no `deployment.site` to make its links absolute.\n */\nexport const buildSiteSkill = (project: BlumeProject): SkillArtifact | null => {\n if (!generatesSiteSkill(project.config)) {\n return null;\n }\n const name = siteSkillName(project);\n return skillMdArtifact(\n name,\n skillDescription(project),\n skillMarkdown(project, name)\n );\n};\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;;AAsCA,IAAM,WAAW;AAGV,IAAM,gBAAgB;AAOtB,IAAM,gBAAgB,CAAC,YAAkC;AAAA,EAC9D,QAAQ,SAAS,QAAQ,OAAO,WAAW;AAAA,EAC3C,MAAM,YAAY,aAAa,QAAQ,OAAO,KAAK;AAAA,EACnD,MAAM,OACJ,aAAa,aAAa,OAAO,IAAI,IAAI,IAAI,EAAE,WAAW,EAAE,KAAK;AAAA,EACnE,OAAO,KAAK,MAAM,GAAG,QAAQ,EAAE,QAAQ,QAAQ,EAAE;AAAA;",
|
|
8
|
+
"debugId": "CA3AF8894895500A64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|