blume 0.5.3 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/dist/cli/index.js +3349 -7024
  2. package/dist/cli/index.js.map +39 -69
  3. package/dist/types/core/config.d.ts +0 -8
  4. package/dist/types/core/data.d.ts +6 -2
  5. package/dist/types/core/i18n-ui.d.ts +50 -0
  6. package/dist/types/core/schema.d.ts +379 -485
  7. package/dist/types/core/types.d.ts +8 -6
  8. package/docs/advanced/meta.ts +1 -8
  9. package/docs/advanced/skills.mdx +28 -0
  10. package/docs/configuration/ai.mdx +58 -0
  11. package/docs/configuration/index.mdx +13 -17
  12. package/docs/configuration/seo.mdx +59 -1
  13. package/docs/configuration/theming.mdx +15 -18
  14. package/docs/content/components.mdx +2 -53
  15. package/docs/content/i18n.mdx +0 -4
  16. package/docs/content/meta.mdx +3 -17
  17. package/docs/content/navigation.mdx +41 -4
  18. package/docs/content/syntax.mdx +1 -1
  19. package/docs/index.mdx +0 -1
  20. package/docs/reference/cli.mdx +12 -13
  21. package/package.json +6 -6
  22. package/skills/blume/SKILL.md +71 -0
  23. package/skills/blume-update-docs/SKILL.md +52 -0
  24. package/skills/blume-update-docs/references/audit-checklist.md +46 -0
  25. package/src/ai/agent-readability.ts +97 -0
  26. package/src/ai/ask-context.ts +131 -8
  27. package/src/ai/ask-data.ts +4 -1
  28. package/src/astro/generate.ts +19 -12
  29. package/src/astro/integration.ts +0 -21
  30. package/src/astro/templates.ts +33 -21
  31. package/src/cli/commands/build.ts +15 -0
  32. package/src/cli/commands/dev.ts +31 -20
  33. package/src/cli/commands/validate.ts +0 -2
  34. package/src/cli/dev-lock.ts +94 -21
  35. package/src/cli/index.ts +0 -2
  36. package/src/components/BlumePage.astro +0 -6
  37. package/src/components/Icon.astro +1 -12
  38. package/src/components/content/AccordionItem.astro +3 -6
  39. package/src/components/content/Badge.astro +1 -3
  40. package/src/components/content/Callout.astro +3 -9
  41. package/src/components/content/Card.astro +2 -3
  42. package/src/components/content/ColorItem.astro +2 -2
  43. package/src/components/content/Column.astro +1 -1
  44. package/src/components/content/GithubInfo.astro +11 -10
  45. package/src/components/content/Prompt.astro +1 -1
  46. package/src/components/content/Step.astro +3 -4
  47. package/src/components/content/Tab.astro +2 -3
  48. package/src/components/content/TypeTable.astro +13 -8
  49. package/src/components/content/Update.astro +1 -1
  50. package/src/components/islands/AskAI.astro +66 -2
  51. package/src/components/islands/ask-ai.tsx +289 -53
  52. package/src/components/layout/Header.astro +27 -4
  53. package/src/components/layout/Logo.astro +5 -1
  54. package/src/components/layout/NavSelector.astro +1 -1
  55. package/src/components/layout/NavTree.astro +15 -15
  56. package/src/components/layout/PageActions.astro +73 -30
  57. package/src/components/layout/PageLayout.astro +42 -0
  58. package/src/components/layout/ReferenceLayout.astro +1 -0
  59. package/src/components/layout/RootLayout.astro +79 -4
  60. package/src/components/layout/Search.astro +5 -5
  61. package/src/components/layout/nav-utils.ts +9 -4
  62. package/src/components/openapi/ApiOverview.astro +4 -50
  63. package/src/components/openapi/ApiTagOperations.astro +42 -0
  64. package/src/core/builtin-tags.ts +1 -3
  65. package/src/core/config.ts +5 -28
  66. package/src/core/data.ts +6 -2
  67. package/src/core/graph.ts +8 -6
  68. package/src/core/i18n-ui.ts +5 -0
  69. package/src/core/links.ts +5 -19
  70. package/src/core/meta.ts +1 -1
  71. package/src/core/nav-diagnostics.ts +7 -0
  72. package/src/core/navigation.ts +38 -17
  73. package/src/core/project-graph.ts +0 -5
  74. package/src/core/schema.ts +133 -95
  75. package/src/core/sources/filesystem.ts +5 -1
  76. package/src/core/sources/resolve.ts +0 -13
  77. package/src/core/sources/watch.ts +43 -11
  78. package/src/core/types.ts +8 -6
  79. package/src/deploy/robots.ts +37 -4
  80. package/src/openapi/parse.ts +197 -14
  81. package/src/openapi/render-mdx.ts +44 -10
  82. package/src/openapi/scalar.ts +1 -1
  83. package/src/openapi/source.ts +19 -2
  84. package/src/search/documents.ts +9 -2
  85. package/src/theme/entry.ts +45 -17
  86. package/src/theme/icons.ts +18 -109
  87. package/src/theme/palette.ts +25 -51
  88. package/src/theme/twoslash.ts +6 -1
  89. package/dist/types/core/bridge.d.ts +0 -24
  90. package/dist/types/core/package-json.d.ts +0 -12
  91. package/dist/types/migrate/mintlify/assets.d.ts +0 -8
  92. package/dist/types/migrate/mintlify/config.d.ts +0 -16
  93. package/dist/types/migrate/mintlify/i18n.d.ts +0 -7
  94. package/dist/types/migrate/shared.d.ts +0 -153
  95. package/docs/advanced/bridge.mdx +0 -76
  96. package/docs/advanced/migrate.mdx +0 -124
  97. package/src/astro/static-assets.ts +0 -124
  98. package/src/cli/commands/migrate.ts +0 -39
  99. package/src/components/content/ApiField.astro +0 -75
  100. package/src/components/content/ParamField.astro +0 -39
  101. package/src/components/content/RequestField.astro +0 -23
  102. package/src/components/content/ResponseField.astro +0 -23
  103. package/src/components/content/Warning.astro +0 -9
  104. package/src/core/assets.ts +0 -31
  105. package/src/core/bridge.ts +0 -102
  106. package/src/core/sources/mintlify.ts +0 -190
  107. package/src/migrate/fumadocs/config.ts +0 -155
  108. package/src/migrate/fumadocs/content.ts +0 -376
  109. package/src/migrate/fumadocs/frontmatter.ts +0 -18
  110. package/src/migrate/fumadocs/groups.ts +0 -237
  111. package/src/migrate/fumadocs/index.ts +0 -355
  112. package/src/migrate/fumadocs/meta.ts +0 -244
  113. package/src/migrate/migrate.ts +0 -53
  114. package/src/migrate/mintlify/assets.ts +0 -46
  115. package/src/migrate/mintlify/config.ts +0 -954
  116. package/src/migrate/mintlify/content.ts +0 -120
  117. package/src/migrate/mintlify/frontmatter.ts +0 -126
  118. package/src/migrate/mintlify/i18n.ts +0 -51
  119. package/src/migrate/mintlify/icons.ts +0 -128
  120. package/src/migrate/mintlify/index.ts +0 -459
  121. package/src/migrate/mintlify/snippets.ts +0 -315
  122. package/src/migrate/mintlify/transform.ts +0 -82
  123. package/src/migrate/nextra/content.ts +0 -46
  124. package/src/migrate/nextra/frontmatter.ts +0 -40
  125. package/src/migrate/nextra/index.ts +0 -389
  126. package/src/migrate/nextra/meta.ts +0 -266
  127. package/src/migrate/shared.ts +0 -801
  128. package/src/migrate/starlight/config.ts +0 -455
  129. package/src/migrate/starlight/content.ts +0 -75
  130. package/src/migrate/starlight/frontmatter.ts +0 -111
  131. package/src/migrate/starlight/i18n.ts +0 -54
  132. package/src/migrate/starlight/index.ts +0 -131
@@ -1,131 +0,0 @@
1
- import { existsSync } from "node:fs";
2
- import { readFile, writeFile } from "node:fs/promises";
3
-
4
- import { join } from "pathe";
5
- import { glob } from "tinyglobby";
6
-
7
- import matter from "../../core/frontmatter.ts";
8
- import { writeBlumeConfig } from "../shared.ts";
9
- import { loadStarlightConfig, mapStarlightConfig } from "./config.ts";
10
- import {
11
- hasAliasedAssets,
12
- rewriteStarlightAsides,
13
- rewriteStarlightComponents,
14
- stripStarlightImports,
15
- unsupportedStarlightComponents,
16
- } from "./content.ts";
17
- import { normalizeStarlightPageMeta } from "./frontmatter.ts";
18
- import { starlightI18n } from "./i18n.ts";
19
-
20
- export interface StarlightMigrationResult {
21
- moved: number;
22
- warnings: string[];
23
- }
24
-
25
- /** Starlight always keeps its docs collection here. */
26
- const CONTENT_DIR = "src/content/docs";
27
-
28
- interface PageResult {
29
- aliased: boolean;
30
- removed: string[];
31
- unsupported: string[];
32
- }
33
-
34
- /** Rewrite one Starlight page to idiomatic Blume MDX, in place. */
35
- const transformPage = async (file: string): Promise<PageResult> => {
36
- const raw = await readFile(file, "utf-8");
37
- let text = stripStarlightImports(raw);
38
- text = rewriteStarlightAsides(text);
39
- text = rewriteStarlightComponents(text);
40
- const unsupported = unsupportedStarlightComponents(text);
41
- const aliased = hasAliasedAssets(text);
42
-
43
- const parsed = matter(text);
44
- const { data, removed } = normalizeStarlightPageMeta(parsed.data);
45
- const content =
46
- Object.keys(data).length > 0
47
- ? matter.stringify(parsed.content, data)
48
- : parsed.content;
49
- if (content !== raw) {
50
- await writeFile(file, content, "utf-8");
51
- }
52
- return { aliased, removed, unsupported };
53
- };
54
-
55
- /**
56
- * Migrate a Starlight project to Blume: translate the `starlight({...})` options
57
- * out of `astro.config.*` into `blume.config.ts`, then rewrite each page under
58
- * `src/content/docs` to idiomatic Blume MDX in place (asides → directives,
59
- * component renames, frontmatter mapping). Content stays put — the generated
60
- * config points `content.root` at `src/content/docs`.
61
- */
62
- export const migrateStarlightProject = async (
63
- root: string
64
- ): Promise<StarlightMigrationResult> => {
65
- const { options, warnings } = await loadStarlightConfig(root);
66
- const config = mapStarlightConfig(options, warnings);
67
-
68
- const i18n = starlightI18n(options);
69
- if (i18n) {
70
- config.i18n = i18n;
71
- warnings.push(
72
- `Mapped ${i18n.locales.length} locale(s) to i18n (default: ${i18n.defaultLocale}); review the locale labels.`
73
- );
74
- }
75
-
76
- const base = join(root, CONTENT_DIR);
77
- if (!existsSync(base)) {
78
- await writeBlumeConfig(root, config);
79
- return {
80
- moved: 0,
81
- warnings: [
82
- ...warnings,
83
- `Content directory ${CONTENT_DIR} not found; wrote blume.config.ts only.`,
84
- ],
85
- };
86
- }
87
-
88
- const files = await glob(["**/*.{md,mdx}"], { absolute: true, cwd: base });
89
- const results = await Promise.all(files.map(transformPage));
90
-
91
- await writeBlumeConfig(root, config);
92
-
93
- const removedKeys = new Set<string>();
94
- const unsupported = new Set<string>();
95
- let aliasedAssets = false;
96
- for (const result of results) {
97
- for (const key of result.removed) {
98
- removedKeys.add(key);
99
- }
100
- for (const name of result.unsupported) {
101
- unsupported.add(name);
102
- }
103
- aliasedAssets ||= result.aliased;
104
- }
105
-
106
- if (removedKeys.size > 0) {
107
- warnings.push(
108
- `Dropped unsupported page frontmatter keys: ${[...removedKeys].join(", ")}.`
109
- );
110
- if (removedKeys.has("hero") || removedKeys.has("template")) {
111
- warnings.push(
112
- "Pages using `template: splash` / `hero` have no automatic equivalent — rebuild them as custom pages under `pages/`."
113
- );
114
- }
115
- }
116
- if (unsupported.size > 0) {
117
- warnings.push(
118
- `Components without a drop-in Blume equivalent need manual review: ${[...unsupported].join(", ")}.`
119
- );
120
- }
121
- if (aliasedAssets) {
122
- warnings.push(
123
- "Some pages reference images via `~/`/`@/` aliases; rewrite them to relative or /public paths."
124
- );
125
- }
126
- warnings.push(
127
- "Content stays under src/content/docs; the now-unused astro.config.*, src/content.config.ts, and @astrojs/starlight dependency are safe to remove."
128
- );
129
-
130
- return { moved: results.length, warnings };
131
- };