create-zudo-doc 3.1.0 → 3.3.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 (127) hide show
  1. package/dist/claude-md-gen.d.ts +8 -0
  2. package/dist/claude-md-gen.js +43 -26
  3. package/dist/compose.d.ts +14 -20
  4. package/dist/compose.js +15 -25
  5. package/dist/features/body-foot-util.d.ts +8 -4
  6. package/dist/features/body-foot-util.js +8 -4
  7. package/dist/features/claude-resources.d.ts +12 -0
  8. package/dist/features/claude-resources.js +13 -6
  9. package/dist/features/design-token-panel.d.ts +0 -12
  10. package/dist/features/design-token-panel.js +32 -93
  11. package/dist/features/doc-history.d.ts +18 -3
  12. package/dist/features/doc-history.js +45 -60
  13. package/dist/features/doc-tags.d.ts +9 -13
  14. package/dist/features/doc-tags.js +10 -26
  15. package/dist/features/dynamic-page-transition.d.ts +19 -30
  16. package/dist/features/dynamic-page-transition.js +21 -209
  17. package/dist/features/footer-taglist.d.ts +1 -1
  18. package/dist/features/footer-taglist.js +1 -1
  19. package/dist/features/footer.d.ts +3 -2
  20. package/dist/features/footer.js +3 -2
  21. package/dist/features/i18n.d.ts +13 -8
  22. package/dist/features/i18n.js +14 -9
  23. package/dist/features/image-enlarge.d.ts +7 -26
  24. package/dist/features/image-enlarge.js +7 -26
  25. package/dist/features/llms-txt.d.ts +3 -5
  26. package/dist/features/llms-txt.js +3 -5
  27. package/dist/features/search.d.ts +7 -3
  28. package/dist/features/search.js +7 -3
  29. package/dist/features/sidebar-resizer.d.ts +4 -8
  30. package/dist/features/sidebar-resizer.js +4 -8
  31. package/dist/features/sidebar-toggle.d.ts +7 -7
  32. package/dist/features/sidebar-toggle.js +7 -7
  33. package/dist/features/tag-governance.d.ts +14 -7
  34. package/dist/features/tag-governance.js +52 -8
  35. package/dist/features/tauri.d.ts +13 -10
  36. package/dist/features/tauri.js +16 -52
  37. package/dist/features/versioning.d.ts +12 -24
  38. package/dist/features/versioning.js +13 -39
  39. package/dist/index.js +2 -3
  40. package/dist/preset.d.ts +1 -0
  41. package/dist/preset.js +5 -0
  42. package/dist/prompts.d.ts +2 -0
  43. package/dist/prompts.js +1 -0
  44. package/dist/scaffold.d.ts +13 -6
  45. package/dist/scaffold.js +78 -59
  46. package/dist/utils.d.ts +10 -0
  47. package/dist/utils.js +14 -0
  48. package/dist/zfb-config-gen.d.ts +32 -20
  49. package/dist/zfb-config-gen.js +400 -53
  50. package/package.json +2 -2
  51. package/templates/base/pages/docs/[[...slug]].tsx +59 -0
  52. package/templates/base/pages/index.tsx +6 -41
  53. package/templates/base/scripts/setup-doc-skill.sh +261 -0
  54. package/templates/base/src/styles/global.css +15 -340
  55. package/templates/base/tsconfig.json +3 -26
  56. package/templates/features/i18n/files/pages/[locale]/docs/[[...slug]].tsx +88 -0
  57. package/templates/features/tagGovernance/files/scripts/tags-suggest.ts +3 -1
  58. package/dist/settings-gen.d.ts +0 -2
  59. package/dist/settings-gen.js +0 -319
  60. package/templates/base/.htmlvalidate.json +0 -5
  61. package/templates/base/.zfb/doc-history-meta.json +0 -1
  62. package/templates/base/pages/_data.ts +0 -160
  63. package/templates/base/pages/lib/_body-end-islands.tsx +0 -165
  64. package/templates/base/pages/lib/_chrome.ts +0 -167
  65. package/templates/base/pages/lib/_details.tsx +0 -29
  66. package/templates/base/pages/lib/_doc-route-entries.ts +0 -10
  67. package/templates/base/pages/lib/_extract-headings.ts +0 -37
  68. package/templates/base/pages/lib/_frontmatter-preview-data.ts +0 -27
  69. package/templates/base/pages/lib/_nav-source-cache.ts +0 -100
  70. package/templates/base/pages/lib/_nav-source-docs.ts +0 -17
  71. package/templates/base/pages/lib/_preset-generator.tsx +0 -81
  72. package/templates/base/pages/lib/_route-context.ts +0 -32
  73. package/templates/base/pages/lib/_search-widget.tsx +0 -17
  74. package/templates/base/pages/lib/doc-page-props.ts +0 -30
  75. package/templates/base/pages/lib/locale-merge.ts +0 -59
  76. package/templates/base/scripts/run-b4push.sh +0 -102
  77. package/templates/base/src/components/ai-chat-modal.tsx +0 -18
  78. package/templates/base/src/components/content/code-group.tsx +0 -3
  79. package/templates/base/src/components/content/content-admonition.tsx +0 -4
  80. package/templates/base/src/components/desktop-sidebar-toggle.tsx +0 -15
  81. package/templates/base/src/components/doc-history.tsx +0 -21
  82. package/templates/base/src/components/image-enlarge.tsx +0 -24
  83. package/templates/base/src/components/preset-generator.tsx +0 -14
  84. package/templates/base/src/components/sidebar-toggle.tsx +0 -6
  85. package/templates/base/src/components/sidebar-tree.tsx +0 -6
  86. package/templates/base/src/config/color-scheme-utils.ts +0 -69
  87. package/templates/base/src/config/color-schemes.ts +0 -165
  88. package/templates/base/src/config/docs-schema.ts +0 -95
  89. package/templates/base/src/config/frontmatter-preview-defaults.ts +0 -27
  90. package/templates/base/src/config/frontmatter-preview-renderers.tsx +0 -46
  91. package/templates/base/src/config/i18n.ts +0 -239
  92. package/templates/base/src/config/settings-types.ts +0 -45
  93. package/templates/base/src/config/sidebars.ts +0 -66
  94. package/templates/base/src/config/tag-vocabulary-types.ts +0 -4
  95. package/templates/base/src/config/tag-vocabulary.ts +0 -20
  96. package/templates/base/src/config/z-index-tokens.ts +0 -128
  97. package/templates/base/src/types/docs-entry.ts +0 -28
  98. package/templates/base/src/types/heading.ts +0 -5
  99. package/templates/base/src/types/locale.ts +0 -10
  100. package/templates/base/src/utils/base.ts +0 -164
  101. package/templates/base/src/utils/docs.ts +0 -446
  102. package/templates/base/src/utils/git-info.ts +0 -70
  103. package/templates/base/src/utils/github.ts +0 -22
  104. package/templates/base/src/utils/nav-scope.ts +0 -34
  105. package/templates/base/src/utils/sidebar.ts +0 -36
  106. package/templates/base/src/utils/slug.ts +0 -10
  107. package/templates/base/src/utils/smart-break.tsx +0 -12
  108. package/templates/base/src/utils/tags.ts +0 -83
  109. package/templates/base/zfb-shim.d.ts +0 -178
  110. package/templates/features/bodyFootUtil/files/src/utils/github.ts +0 -22
  111. package/templates/features/claudeResources/files/src/integrations/claude-resources/__tests__/escape-for-mdx.test.ts +0 -42
  112. package/templates/features/claudeResources/files/src/integrations/claude-resources/__tests__/generate.test.ts +0 -752
  113. package/templates/features/claudeResources/files/src/integrations/claude-resources/escape-for-mdx.ts +0 -97
  114. package/templates/features/claudeResources/files/src/integrations/claude-resources/generate.ts +0 -735
  115. package/templates/features/designTokenPanel/files/src/components/design-token-panel-bootstrap.tsx +0 -15
  116. package/templates/features/designTokenPanel/files/src/config/design-token-panel-config.ts +0 -435
  117. package/templates/features/designTokenPanel/files/src/config/design-tokens-manifest.ts +0 -174
  118. package/templates/features/designTokenPanel/files/src/lib/design-token-panel-bootstrap.ts +0 -30
  119. package/templates/features/docHistory/files/src/components/doc-history.tsx +0 -10
  120. package/templates/features/docHistory/files/src/types/doc-history.ts +0 -7
  121. package/templates/features/dynamicPageTransition/files/src/components/client-router-bootstrap.tsx +0 -72
  122. package/templates/features/i18n/files/pages/[locale]/index.tsx +0 -72
  123. package/templates/features/imageEnlarge/files/src/components/image-enlarge.tsx +0 -11
  124. package/templates/features/sidebarToggle/files/src/components/desktop-sidebar-toggle.tsx +0 -6
  125. package/templates/features/tauri/files/src/components/find-bar.tsx +0 -122
  126. package/templates/features/tauri/files/src/components/find-in-page-init.tsx +0 -59
  127. package/templates/features/tauri/files/src/utils/find-in-page.ts +0 -175
@@ -1,2 +1,10 @@
1
1
  import type { UserChoices } from "./prompts.js";
2
+ /**
3
+ * Generate the per-project `CLAUDE.md` (minimal-scaffold shape, epic
4
+ * zudolab/zudo-doc#2651, Wave 6 #2660). Rewritten from scratch — the old
5
+ * generator described a 64-file project (`src/components/admonitions/`,
6
+ * `src/layouts/`, `src/utils/`, per-page `pages/lib/*` wiring) that no
7
+ * longer exists. The scaffolded project is now ~12 files; almost
8
+ * everything referenced here lives in `node_modules/@takazudo/zudo-doc`.
9
+ */
2
10
  export declare function generateCLAUDEFile(choices: UserChoices): string;
@@ -1,53 +1,62 @@
1
- import { capitalize } from "./utils.js";
2
- function runCmd(pm, script) {
3
- if (pm === "npm")
4
- return `npm run ${script}`;
5
- return `${pm} ${script}`;
6
- }
1
+ import { capitalize, pmRunCommand } from "./utils.js";
2
+ /**
3
+ * Generate the per-project `CLAUDE.md` (minimal-scaffold shape, epic
4
+ * zudolab/zudo-doc#2651, Wave 6 #2660). Rewritten from scratch — the old
5
+ * generator described a 64-file project (`src/components/admonitions/`,
6
+ * `src/layouts/`, `src/utils/`, per-page `pages/lib/*` wiring) that no
7
+ * longer exists. The scaffolded project is now ~12 files; almost
8
+ * everything referenced here lives in `node_modules/@takazudo/zudo-doc`.
9
+ */
7
10
  export function generateCLAUDEFile(choices) {
8
11
  const siteName = capitalize(choices.projectName.replace(/-/g, " "));
9
12
  const lines = [];
10
13
  lines.push(`# ${siteName}`);
11
14
  lines.push(``);
12
- lines.push(`Documentation site built with [zudo-doc](https://github.com/zudolab/zudo-doc) — a zfb-based documentation framework with MDX, Tailwind CSS v4, and Preact islands.`);
15
+ lines.push(`Documentation site built with [zudo-doc](https://github.com/zudolab/zudo-doc) — a zfb-based documentation framework with MDX, Tailwind CSS v4, and Preact islands. This project is intentionally minimal: one config file (\`zfb.config.ts\`) plus markdown content — layout, chrome, and islands all ship from \`@takazudo/zudo-doc\` in \`node_modules\`.`);
13
16
  lines.push(``);
14
17
  // Tech stack
15
18
  lines.push(`## Tech Stack`);
16
19
  lines.push(``);
17
20
  lines.push(`- **zfb** — documentation build framework`);
18
- lines.push(`- **MDX** — content format`);
21
+ lines.push(`- **MDX** — content format, authored under \`src/content/\``);
19
22
  lines.push(`- **Tailwind CSS v4** — via \`@tailwindcss/vite\``);
20
23
  lines.push(`- **Preact** — for interactive islands only (with compat mode for React API)`);
21
- lines.push(`- **syntect** — built-in code highlighting, run by zfb's Rust pipeline at build time (single fixed theme: \`base16-ocean-dark\`)`);
24
+ lines.push(`- **syntect** — built-in code highlighting, run by zfb's Rust pipeline at build time (dual light/dark theme, follows the site's color-mode toggle)`);
25
+ lines.push(`- **@takazudo/zudo-doc** — the package that owns everything: layout, chrome, islands, default \`@theme\` design tokens, and (via \`packageOwnedRoutes\`, on by default) the doc routes themselves`);
22
26
  lines.push(``);
23
27
  // Commands
24
28
  lines.push(`## Commands`);
25
29
  lines.push(``);
26
30
  const pm = choices.packageManager;
27
- lines.push(`- \`${runCmd(pm, "dev")}\` — zfb dev server (port 4321)`);
28
- lines.push(`- \`${runCmd(pm, "build")}\` — static HTML export to \`dist/\``);
29
- lines.push(`- \`${runCmd(pm, "check")}\` — TypeScript type checking`);
31
+ lines.push(`- \`${pmRunCommand(pm, "dev")}\` — zfb dev server (port 4321)`);
32
+ lines.push(`- \`${pmRunCommand(pm, "build")}\` — static HTML export to \`dist/\``);
33
+ lines.push(`- \`${pmRunCommand(pm, "check")}\` — TypeScript type checking`);
34
+ lines.push(`- \`${pmRunCommand(pm, "preview")}\` — serve the built \`dist/\``);
30
35
  lines.push(``);
31
36
  // Key directories
32
37
  lines.push(`## Key Directories`);
33
38
  lines.push(``);
34
39
  lines.push("```");
40
+ lines.push(`zfb.config.ts # THE one config file — zudoDoc({ ...only fields you chose })`);
41
+ lines.push(`pages/`);
42
+ lines.push(`├── index.tsx # 1-line re-export of the package home route`);
43
+ lines.push(`└── docs/[[...slug]].tsx # self-contained doc-route stub (required for \`${pm} dev\`)`);
44
+ if (choices.features.includes("i18n")) {
45
+ lines.push(` [locale]/docs/[[...slug]].tsx # same, for non-default locales`);
46
+ }
35
47
  lines.push(`src/`);
36
- lines.push(`├── components/ # JSX + Preact components`);
37
- lines.push(`│ └── admonitions/ # Note, Tip, Info, Warning, Danger`);
38
- lines.push(`├── config/ # Settings, color schemes`);
39
48
  lines.push(`├── content/`);
40
- lines.push(`│ └── docs/ # MDX content`);
49
+ lines.push(`│ └── docs/ # MDX content (this project's showcase docs)`);
41
50
  if (choices.features.includes("i18n")) {
42
51
  const secondaryLang = choices.defaultLang === "ja" ? "en" : "ja";
43
52
  lines.push(`│ └── docs-${secondaryLang}/ # ${secondaryLang === "ja" ? "Japanese" : "English"} MDX content (mirrors docs/)`);
44
53
  }
45
- lines.push(`├── layouts/ # JSX layouts`);
46
- lines.push(`├── pages/ # File-based routing`);
47
54
  lines.push(`└── styles/`);
48
- lines.push(` └── global.css # Design tokens & Tailwind config`);
55
+ lines.push(` └── global.css # @import chain + a token-override slot — that's it`);
49
56
  lines.push("```");
50
57
  lines.push(``);
58
+ lines.push(`Everything else — layout, header, sidebar, footer, doc chrome, islands, and the default design tokens — lives in \`node_modules/@takazudo/zudo-doc\`. To customize a specific piece, use the eject CLI: \`npx zudo-doc eject <component>\` copies one package component into this project so you can edit it (see \`@takazudo/zudo-doc\`'s eject-contract docs). Settings you didn't set explicitly in \`zfb.config.ts\` use the package's documented defaults — hover \`zudoDoc\`'s \`ZudoDocConfig\` argument in your editor to see every field and its \`@default\`.`);
59
+ lines.push(``);
51
60
  // Content conventions
52
61
  lines.push(`## Content Conventions`);
53
62
  lines.push(``);
@@ -59,18 +68,24 @@ export function generateCLAUDEFile(choices) {
59
68
  lines.push(``);
60
69
  lines.push(`### Admonitions`);
61
70
  lines.push(``);
62
- lines.push(`Available in all MDX files without imports: \`<Note>\`, \`<Tip>\`, \`<Info>\`, \`<Warning>\`, \`<Danger>\``);
63
- lines.push(`Each accepts an optional \`title\` prop.`);
71
+ lines.push(`Available in all MDX files without imports, via directive syntax: \`:::note\`, \`:::tip\`, \`:::info\`, \`:::warning\`, \`:::danger\`, \`:::caution\`, \`:::details\`. Each accepts an optional \`{title="..."}\` attribute.`);
64
72
  lines.push(``);
65
73
  lines.push(`### Headings`);
66
74
  lines.push(``);
67
75
  lines.push(`Do NOT use h1 (\`#\`) in doc content — the page title from frontmatter is rendered as h1. Start content headings from h2 (\`##\`).`);
68
76
  lines.push(``);
69
- // Components
70
- lines.push(`## Components`);
77
+ // Built-in MDX components. The seeded getting-started/index.mdx uses
78
+ // <CategoryNav>, a package-provided global — without this section a new user
79
+ // has no in-project pointer to what it is or which siblings exist (#2703).
80
+ lines.push(`### Built-in MDX components`);
81
+ lines.push(``);
82
+ lines.push(`\`@takazudo/zudo-doc\` ships a few **globally-available MDX components** — usable in any \`.mdx\` file with **no import**. The seeded \`getting-started/index.mdx\` already uses one:`);
83
+ lines.push(``);
84
+ lines.push(`- \`<CategoryNav category="..." />\` — a card-grid list of the pages in a docs category (this is the one seeded into \`getting-started/index.mdx\`).`);
85
+ lines.push(`- \`<CategoryTreeNav category="..." />\` — the same listing as a compact nested tree, better for deeper hierarchies.`);
86
+ lines.push(`- \`<SiteTreeNavDemo />\` — a full-site documentation tree (the MDX-available wrapper of the \`SiteTreeNav\` island).`);
71
87
  lines.push(``);
72
- lines.push(`- Default to **server-rendered JSX components** (\`.tsx\`) — zero JS, server-rendered`);
73
- lines.push(`- Use **Preact islands** (\`client:load\`) only when client-side interactivity is needed`);
88
+ lines.push(`Admonitions (above), tabbed content (\`<Tabs>\` / \`<TabItem>\`, \`<CodeGroup>\`), and block math (\`<MathBlock>\`) work the same way no import. Full reference: https://zudo-doc.takazudomodular.com/docs/components/`);
74
89
  lines.push(``);
75
90
  // i18n section
76
91
  if (choices.features.includes("i18n")) {
@@ -82,12 +97,12 @@ export function generateCLAUDEFile(choices) {
82
97
  lines.push(`- ${defaultLabel} (default): \`/docs/...\` — content in \`src/content/docs/\``);
83
98
  lines.push(`- ${secondaryLabel}: \`/${secondaryLang}/docs/...\` — content in \`src/content/docs-${secondaryLang}/\``);
84
99
  lines.push(`- ${secondaryLabel} docs should mirror the ${defaultLabel} directory structure`);
100
+ lines.push(`- Both \`pages/docs/[[...slug]].tsx\` and \`pages/[locale]/docs/[[...slug]].tsx\` are self-contained doc-route stubs shipped by the generator — required so \`${pm} dev\` doesn't 404 on doc pages (a zfb dev-mode limitation on package-injected dynamic routes). Don't delete them.`);
85
101
  lines.push(``);
86
102
  }
87
103
  // Enabled features
88
104
  const featureDescriptions = {
89
105
  search: "Full-text search via Pagefind",
90
- sidebarFilter: "Real-time sidebar filtering",
91
106
  designTokenPanel: "Interactive tabbed panel for tweaking spacing, font, size, and color tokens",
92
107
  sidebarResizer: "Draggable sidebar width",
93
108
  sidebarToggle: "Show/hide desktop sidebar",
@@ -96,6 +111,8 @@ export function generateCLAUDEFile(choices) {
96
111
  llmsTxt: "Generates llms.txt for LLM consumption",
97
112
  claudeResources: "Auto-generated docs for Claude Code resources",
98
113
  changelog: "Changelog page at `/docs/changelog`",
114
+ tauri: "Desktop app wrapper (`cargo tauri dev` / `cargo tauri build`) — Cmd/Ctrl+F find bar via the package-owned `FindInPageInit` island (`findInPage: true` in `zfb.config.ts`)",
115
+ tagGovernance: "Vocabulary-aware tag audit (`tags:audit`) / suggest (`tags:suggest`) scripts",
99
116
  };
100
117
  const enabledFeatures = choices.features.filter((f) => featureDescriptions[f] !== undefined &&
101
118
  f !== "footerNavGroup" &&
package/dist/compose.d.ts CHANGED
@@ -68,27 +68,21 @@ export declare function resolveSelectedFeatures(choices: UserChoices, featureMod
68
68
  * Throws if a selected feature depends on one that isn't selected.
69
69
  */
70
70
  export declare function validateDependencies(features: FeatureDefinition[], allSelectedNames: Set<string>): void;
71
- /** Files that may contain injection anchors and need cleaning.
72
- *
73
- * The anchor targets today are:
74
- * - `global.css` — design-token-panel.ts injects
75
- * `@import "@takazudo/zdtp/styles.css";` at `@slot:global-css:feature-styles`.
76
- * The sibling `@slot:global-css:theme-tokens` anchor is consumed by the
77
- * color-scheme palette generator and must remain.
78
- * - `pages/lib/_body-end-islands.tsx` — tauri.ts injects the FindInPageInit
79
- * island (import, displayName, Island mount) when tauri is enabled.
80
- * design-token-panel.ts injects the DesignTokenPanelBootstrap island
81
- * (import, displayName, Island mount + toggle shim) when designTokenPanel
82
- * is enabled.
83
- * - `src/config/settings-types.ts` — design-token-panel.ts injects the
84
- * `"design-token-panel"` member into `HeaderRightTriggerName` when the
85
- * feature is enabled (replace-range between the :start/:end anchors).
71
+ /**
72
+ * Files that may contain injection anchors and need cleaning.
86
73
  *
87
- * NOTE: `pages/_mdx-components.ts` was removed (#2360 / E2). The imageEnlarge
88
- * p-override injections (ENLARGE_SVG, EnlargeableParagraph, p: entry) are now
89
- * handled inside the @takazudo/zudo-doc/mdx-components factory — the template
90
- * no longer carries @slot anchors for this file and the feature module's
91
- * injections are a no-op (the factory reads settings.imageEnlarge at render time).
74
+ * EMPTY as of the minimal-scaffold cutover (epic zudolab/zudo-doc#2651,
75
+ * Wave 6 #2660). Every anchor target this list used to name —
76
+ * `src/styles/global.css`'s `@slot:global-css:*` comments,
77
+ * `pages/lib/_body-end-islands.tsx`, `src/config/settings-types.ts` is
78
+ * GONE from `templates/base/` (the package now owns chrome/islands/settings
79
+ * types entirely; see `templates/base/src/styles/global.css`'s fixed
80
+ * ~20-line `@import` chain). Feature modules are pure settings-field
81
+ * emission + genuine file copies now (see `src/features/*.ts`) — none of
82
+ * them call `applyInjections` with a real anchor anymore. The
83
+ * `Injection`/`applyInjections`/`cleanAnchors` machinery below is kept as
84
+ * infrastructure for a future feature that genuinely needs it (e.g. an
85
+ * eventual host-side extension point), not because anything uses it today.
92
86
  */
93
87
  export declare const ANCHOR_FILES: string[];
94
88
  /**
package/dist/compose.js CHANGED
@@ -154,33 +154,23 @@ export function validateDependencies(features, allSelectedNames) {
154
154
  }
155
155
  }
156
156
  }
157
- /** Files that may contain injection anchors and need cleaning.
158
- *
159
- * The anchor targets today are:
160
- * - `global.css` — design-token-panel.ts injects
161
- * `@import "@takazudo/zdtp/styles.css";` at `@slot:global-css:feature-styles`.
162
- * The sibling `@slot:global-css:theme-tokens` anchor is consumed by the
163
- * color-scheme palette generator and must remain.
164
- * - `pages/lib/_body-end-islands.tsx` — tauri.ts injects the FindInPageInit
165
- * island (import, displayName, Island mount) when tauri is enabled.
166
- * design-token-panel.ts injects the DesignTokenPanelBootstrap island
167
- * (import, displayName, Island mount + toggle shim) when designTokenPanel
168
- * is enabled.
169
- * - `src/config/settings-types.ts` — design-token-panel.ts injects the
170
- * `"design-token-panel"` member into `HeaderRightTriggerName` when the
171
- * feature is enabled (replace-range between the :start/:end anchors).
157
+ /**
158
+ * Files that may contain injection anchors and need cleaning.
172
159
  *
173
- * NOTE: `pages/_mdx-components.ts` was removed (#2360 / E2). The imageEnlarge
174
- * p-override injections (ENLARGE_SVG, EnlargeableParagraph, p: entry) are now
175
- * handled inside the @takazudo/zudo-doc/mdx-components factory — the template
176
- * no longer carries @slot anchors for this file and the feature module's
177
- * injections are a no-op (the factory reads settings.imageEnlarge at render time).
160
+ * EMPTY as of the minimal-scaffold cutover (epic zudolab/zudo-doc#2651,
161
+ * Wave 6 #2660). Every anchor target this list used to name —
162
+ * `src/styles/global.css`'s `@slot:global-css:*` comments,
163
+ * `pages/lib/_body-end-islands.tsx`, `src/config/settings-types.ts` is
164
+ * GONE from `templates/base/` (the package now owns chrome/islands/settings
165
+ * types entirely; see `templates/base/src/styles/global.css`'s fixed
166
+ * ~20-line `@import` chain). Feature modules are pure settings-field
167
+ * emission + genuine file copies now (see `src/features/*.ts`) — none of
168
+ * them call `applyInjections` with a real anchor anymore. The
169
+ * `Injection`/`applyInjections`/`cleanAnchors` machinery below is kept as
170
+ * infrastructure for a future feature that genuinely needs it (e.g. an
171
+ * eventual host-side extension point), not because anything uses it today.
178
172
  */
179
- export const ANCHOR_FILES = [
180
- "src/styles/global.css",
181
- "pages/lib/_body-end-islands.tsx",
182
- "src/config/settings-types.ts",
183
- ];
173
+ export const ANCHOR_FILES = [];
184
174
  /**
185
175
  * Main composition entry point. Orchestrates the full feature composition
186
176
  * pipeline for a generated project.
@@ -2,9 +2,13 @@ import type { FeatureModule } from "../compose.js";
2
2
  /**
3
3
  * body-foot-util feature.
4
4
  *
5
- * W7A (#1736): post-cutover, the body-foot-util area is hosted by
6
- * `pages/lib/_doc-history-area.tsx` which wraps `BodyFootUtilArea`
7
- * unconditionally. The component itself runtime-gates on
8
- * `settings.bodyFootUtilArea`, so there is nothing to inject.
5
+ * Purely a `zudoDoc({ bodyFootUtilArea: {...} })` field (see
6
+ * `zfb-config-gen.ts`) `BodyFootUtilArea` is fully package-owned
7
+ * (`@takazudo/zudo-doc/body-foot-util`, wired through `doc-page-shell`) and
8
+ * runtime-gates on `settings.bodyFootUtilArea`. The old host thin-stub
9
+ * (`src/utils/github.ts`, which depended on the now-deleted
10
+ * `@/config/settings`) is gone too — the package component reads
11
+ * `settings.githubUrl` from the route context directly via
12
+ * `@takazudo/zudo-doc/github-helpers`. Nothing to inject or copy.
9
13
  */
10
14
  export declare const bodyFootUtilFeature: FeatureModule;
@@ -1,10 +1,14 @@
1
1
  /**
2
2
  * body-foot-util feature.
3
3
  *
4
- * W7A (#1736): post-cutover, the body-foot-util area is hosted by
5
- * `pages/lib/_doc-history-area.tsx` which wraps `BodyFootUtilArea`
6
- * unconditionally. The component itself runtime-gates on
7
- * `settings.bodyFootUtilArea`, so there is nothing to inject.
4
+ * Purely a `zudoDoc({ bodyFootUtilArea: {...} })` field (see
5
+ * `zfb-config-gen.ts`) `BodyFootUtilArea` is fully package-owned
6
+ * (`@takazudo/zudo-doc/body-foot-util`, wired through `doc-page-shell`) and
7
+ * runtime-gates on `settings.bodyFootUtilArea`. The old host thin-stub
8
+ * (`src/utils/github.ts`, which depended on the now-deleted
9
+ * `@/config/settings`) is gone too — the package component reads
10
+ * `settings.githubUrl` from the route context directly via
11
+ * `@takazudo/zudo-doc/github-helpers`. Nothing to inject or copy.
8
12
  */
9
13
  export const bodyFootUtilFeature = () => ({
10
14
  name: "bodyFootUtil",
@@ -1,2 +1,14 @@
1
1
  import type { FeatureModule } from "../compose.js";
2
+ /**
3
+ * Claude-resources feature.
4
+ *
5
+ * Fully plugin-owned (`@takazudo/zudo-doc/plugins/claude-resources`,
6
+ * `zudoDocPreset()` wires it whenever `settings.claudeResources` is
7
+ * truthy). The old `src/integrations/claude-resources/*` host copy
8
+ * (escape-for-mdx.ts / generate.ts + tests) was a pre-package-first
9
+ * duplicate implementation nothing imported — deleted in the minimal-scaffold
10
+ * cutover (epic zudolab/zudo-doc#2651, Wave 6 #2660). This feature's touch
11
+ * points are now just: `claudeResources` + `defaultLocaleOnlyPrefixes` fields
12
+ * (`zfb-config-gen.ts`).
13
+ */
2
14
  export declare const claudeResourcesFeature: FeatureModule;
@@ -1,9 +1,16 @@
1
+ /**
2
+ * Claude-resources feature.
3
+ *
4
+ * Fully plugin-owned (`@takazudo/zudo-doc/plugins/claude-resources`,
5
+ * `zudoDocPreset()` wires it whenever `settings.claudeResources` is
6
+ * truthy). The old `src/integrations/claude-resources/*` host copy
7
+ * (escape-for-mdx.ts / generate.ts + tests) was a pre-package-first
8
+ * duplicate implementation nothing imported — deleted in the minimal-scaffold
9
+ * cutover (epic zudolab/zudo-doc#2651, Wave 6 #2660). This feature's touch
10
+ * points are now just: `claudeResources` + `defaultLocaleOnlyPrefixes` fields
11
+ * (`zfb-config-gen.ts`).
12
+ */
1
13
  export const claudeResourcesFeature = () => ({
2
14
  name: "claudeResources",
3
- injections: [
4
- // No shared file injection needed — this feature's touch points are:
5
- // - plugin entry: zfb-config-gen.ts (claudeResources conditional import/plugin)
6
- // - settings: settings-gen.ts (claudeResources object + defaultLocaleOnlyPrefixes array)
7
- // - devDep: scaffold.ts (tsx devDep — same subprocess runner as docHistory)
8
- ],
15
+ injections: [],
9
16
  });
@@ -1,14 +1,2 @@
1
1
  import type { FeatureModule } from "../compose.js";
2
- /**
3
- * Design-token-panel (zdtp) feature.
4
- *
5
- * Injects:
6
- * 1. The zdtp CSS @import at `@slot:global-css:feature-styles` in
7
- * `src/styles/global.css`.
8
- * 2. The DesignTokenPanelBootstrap import, displayName, and Island mount
9
- * (with pre-hydration toggle shim) into
10
- * `pages/lib/_body-end-islands.tsx` via the three @slot: anchors
11
- * (imports / display-names / extra-islands). Mirrors the tauri feature
12
- * injection shape (zudolab/zudo-doc#2162).
13
- */
14
2
  export declare const designTokenPanelFeature: FeatureModule;
@@ -1,100 +1,39 @@
1
- /**
2
- * Pre-hydration toggle shim for the zdtp panel (inline, minified).
3
- *
4
- * Emitted as a <script dangerouslySetInnerHTML> alongside the
5
- * DesignTokenPanelBootstrap Island so the header palette button is
6
- * responsive before the island hydrates. Records the first click as a
7
- * boolean flag and exposes window.__zdtpReadyClicks so the bootstrap
8
- * module can drain and re-dispatch once the real zdtp listener is live.
9
- * Guards against double-installation across SPA body swaps via
10
- * __zdtpToggleShimInstalled. Mirrors the host's ZDTP_TOGGLE_SHIM_SRC
11
- * constant (pages/lib/_body-end-islands.tsx, zudolab/zudo-doc#1627 Part B).
12
- */
13
- const ZDTP_TOGGLE_SHIM_SRC = `(function(){
14
- if(window.__zdtpToggleShimInstalled)return;
15
- window.__zdtpToggleShimInstalled=true;
16
- var pending=false;
17
- function shim(){pending=true;}
18
- window.addEventListener('toggle-design-token-panel',shim);
19
- window.__zdtpReadyClicks=function(){
20
- window.removeEventListener('toggle-design-token-panel',shim);
21
- delete window.__zdtpReadyClicks;
22
- if(pending){pending=false;window.dispatchEvent(new CustomEvent('toggle-design-token-panel'));}
23
- };
24
- })();`;
1
+ import fs from "fs-extra";
2
+ import path from "path";
25
3
  /**
26
4
  * Design-token-panel (zdtp) feature.
27
5
  *
28
- * Injects:
29
- * 1. The zdtp CSS @import at `@slot:global-css:feature-styles` in
30
- * `src/styles/global.css`.
31
- * 2. The DesignTokenPanelBootstrap import, displayName, and Island mount
32
- * (with pre-hydration toggle shim) into
33
- * `pages/lib/_body-end-islands.tsx` via the three @slot: anchors
34
- * (imports / display-names / extra-islands). Mirrors the tauri feature
35
- * injection shape (zudolab/zudo-doc#2162).
6
+ * Minimal-scaffold cutover (epic zudolab/zudo-doc#2651, Wave 6 #2660): the
7
+ * bootstrap island, its config builder, and the pre-hydration toggle shim
8
+ * are ALL package-owned now —
9
+ * `chrome/derive.tsx`'s `deriveBodyEndIslands` auto-defaults the real
10
+ * `DesignTokenPanelBootstrap` island for every `createChrome` consumer
11
+ * (#2658 gate-2 fix, verified against the locked-manifest self-contained
12
+ * doc stub in the target-manifest confirm fixture), and
13
+ * `doc-body-end-islands/index.tsx` carries the toggle shim inline. So this
14
+ * feature has nothing left to inject into `pages/lib/_body-end-islands.tsx`
15
+ * or `src/config/settings-types.ts` — both files are gone anyway.
16
+ *
17
+ * The ONE thing that stays generator-owned: `@takazudo/zdtp/styles.css` is
18
+ * the single conditional line in `src/styles/global.css` (documented in
19
+ * that file's header comment) — it can't ship unconditionally from
20
+ * `@takazudo/zudo-doc/theme.css` because it pulls in zdtp's own bytes.
21
+ * Inserted right after the `@layer zd-preflight, zd-flow;` line (the same
22
+ * position the locked-manifest reference shape uses).
36
23
  */
24
+ const ZDTP_IMPORT_LINE = `@import "@takazudo/zdtp/styles.css";`;
25
+ const LAYER_LINE = `@layer zd-preflight, zd-flow;`;
37
26
  export const designTokenPanelFeature = () => ({
38
27
  name: "designTokenPanel",
39
- injections: [
40
- {
41
- // Panel chrome CSS — imported here so the rules land in the main page
42
- // CSS bundle (not a deferred chunk), ensuring the panel renders
43
- // correctly on first click. Vite library mode strips the source CSS
44
- // import from the emitted JS, so this CSS-side import is the required
45
- // pull point. See @takazudo/zdtp PORTABLE-CONTRACT.md §7.
46
- file: "src/styles/global.css",
47
- anchor: "/* @slot:global-css:feature-styles */",
48
- content: `@import "@takazudo/zdtp/styles.css";`,
49
- },
50
- // 1. Import the island entry. Inserted AFTER the
51
- // `// @slot:body-end-islands:imports` anchor.
52
- {
53
- file: "pages/lib/_body-end-islands.tsx",
54
- anchor: "// @slot:body-end-islands:imports",
55
- position: "after",
56
- content: `import DesignTokenPanelBootstrap from "@/components/design-token-panel-bootstrap";`,
57
- },
58
- // 2. Stable island marker name (belt-and-braces guard matching the
59
- // sibling islands in the file). Inserted AFTER the
60
- // `// @slot:body-end-islands:display-names` anchor.
61
- {
62
- file: "pages/lib/_body-end-islands.tsx",
63
- anchor: "// @slot:body-end-islands:display-names",
64
- position: "after",
65
- content: `(DesignTokenPanelBootstrap as { displayName?: string }).displayName = "DesignTokenPanelBootstrap";`,
66
- },
67
- // 4. Extend HeaderRightTriggerName with "design-token-panel". Uses
68
- // replace-range between the :start/:end anchors in settings-types.ts
69
- // so the base template emits only "ai-chat" and this injection adds
70
- // the zdtp trigger only when the feature is on (zudolab/zudo-doc#2162).
71
- {
72
- file: "src/config/settings-types.ts",
73
- anchor: "// @slot:settings-types:trigger-names:start",
74
- position: "replace",
75
- content: `export type HeaderRightTriggerName = "design-token-panel" | "ai-chat";`,
76
- },
77
- // 3. Island mount + pre-hydration toggle shim. Inserted AFTER the
78
- // `{/* @slot:body-end-islands:extra-islands */}` anchor.
79
- // when="load" (not "idle"): the bootstrap module registers the
80
- // `toggle-design-token-panel` window listener as a side effect of
81
- // its import, so it must hydrate as early as possible (zudolab/zudo-doc#1623).
82
- // The inline <script> is the pre-hydration shim (zudolab/zudo-doc#1627 Part B).
83
- {
84
- file: "pages/lib/_body-end-islands.tsx",
85
- anchor: "{/* @slot:body-end-islands:extra-islands */}",
86
- position: "after",
87
- content: ` {/* zdtp panel bootstrap: hydrates on load so configurePanel() runs early
88
- and the toggle-design-token-panel listener is live before the user
89
- clicks the header trigger. The inline script is the pre-hydration
90
- shim that queues the first click (zudolab/zudo-doc#1627 Part B). */}
91
- <script
92
- dangerouslySetInnerHTML={{ __html: ${JSON.stringify(ZDTP_TOGGLE_SHIM_SRC)} }}
93
- />
94
- {Island({
95
- when: "load",
96
- children: <DesignTokenPanelBootstrap />,
97
- }) as unknown as VNode}`,
98
- },
99
- ],
28
+ injections: [],
29
+ postProcess: async (targetDir) => {
30
+ const cssPath = path.join(targetDir, "src/styles/global.css");
31
+ if (!(await fs.pathExists(cssPath)))
32
+ return;
33
+ let content = await fs.readFile(cssPath, "utf-8");
34
+ if (content.includes(ZDTP_IMPORT_LINE))
35
+ return; // already patched (idempotent)
36
+ content = content.replace(LAYER_LINE, `${LAYER_LINE}\n${ZDTP_IMPORT_LINE}`);
37
+ await fs.writeFile(cssPath, content);
38
+ },
100
39
  });
@@ -2,8 +2,23 @@ import type { FeatureModule } from "../compose.js";
2
2
  /**
3
3
  * Doc-history feature.
4
4
  *
5
- * W7A (#1736): post-cutover, `pages/lib/_doc-history-area.tsx` is mounted
6
- * unconditionally and self-gates on `settings.docHistory`. The plugin entry
7
- * is wired by `zfb-config-gen.ts`.
5
+ * Minimal-scaffold cutover (epic zudolab/zudo-doc#2651, Wave 6 #2660):
6
+ * `settings.docHistory` is a plain zudoDoc() field now (see zfb-config-gen.ts)
7
+ * and the diff-viewer CSS (`.diff-row`/`.diff-line-*`) ships unconditionally
8
+ * from `@takazudo/zudo-doc/features.css` (epic #2344 S4) — the old
9
+ * `@slot:global-css:feature-styles` CSS injection this module used to carry
10
+ * is DEAD (the anchor no longer exists in the ~20-line `global.css`) and has
11
+ * been removed.
12
+ *
13
+ * What's left to wire: the self-contained doc-route stub(s)
14
+ * (`pages/docs/[[...slug]].tsx`, and its i18n locale sibling when i18n is
15
+ * also selected) call `createChrome(routeCtx)` with NO hostBindings — unlike
16
+ * `DesignTokenPanelBootstrap` (auto-defaulted at the chrome-derive seam,
17
+ * #2658 gate-2 fix), `DocHistory`'s derive-level default is a deliberate
18
+ * no-op stub (see `routes/_chrome.tsx`'s comment on why — its own island
19
+ * needs the REAL host binding to hydrate). So when docHistory is selected,
20
+ * this feature patches the stub(s) to statically import the real
21
+ * `DocHistory` component and thread it through — the same #2480 chain
22
+ * `routes/_chrome.tsx` uses for the package's own routes.
8
23
  */
9
24
  export declare const docHistoryFeature: FeatureModule;
@@ -1,67 +1,52 @@
1
+ import fs from "fs-extra";
2
+ import path from "path";
1
3
  /**
2
4
  * Doc-history feature.
3
5
  *
4
- * W7A (#1736): post-cutover, `pages/lib/_doc-history-area.tsx` is mounted
5
- * unconditionally and self-gates on `settings.docHistory`. The plugin entry
6
- * is wired by `zfb-config-gen.ts`.
6
+ * Minimal-scaffold cutover (epic zudolab/zudo-doc#2651, Wave 6 #2660):
7
+ * `settings.docHistory` is a plain zudoDoc() field now (see zfb-config-gen.ts)
8
+ * and the diff-viewer CSS (`.diff-row`/`.diff-line-*`) ships unconditionally
9
+ * from `@takazudo/zudo-doc/features.css` (epic #2344 S4) — the old
10
+ * `@slot:global-css:feature-styles` CSS injection this module used to carry
11
+ * is DEAD (the anchor no longer exists in the ~20-line `global.css`) and has
12
+ * been removed.
13
+ *
14
+ * What's left to wire: the self-contained doc-route stub(s)
15
+ * (`pages/docs/[[...slug]].tsx`, and its i18n locale sibling when i18n is
16
+ * also selected) call `createChrome(routeCtx)` with NO hostBindings — unlike
17
+ * `DesignTokenPanelBootstrap` (auto-defaulted at the chrome-derive seam,
18
+ * #2658 gate-2 fix), `DocHistory`'s derive-level default is a deliberate
19
+ * no-op stub (see `routes/_chrome.tsx`'s comment on why — its own island
20
+ * needs the REAL host binding to hydrate). So when docHistory is selected,
21
+ * this feature patches the stub(s) to statically import the real
22
+ * `DocHistory` component and thread it through — the same #2480 chain
23
+ * `routes/_chrome.tsx` uses for the package's own routes.
7
24
  */
8
25
  export const docHistoryFeature = () => ({
9
26
  name: "docHistory",
10
- injections: [
11
- {
12
- // Diff-viewer CSS — the DocHistory island's side-by-side diff markup
13
- // (.diff-row / .diff-line-*) is styled only here; without this block
14
- // scaffolded projects render the diff viewer unstyled (#2081). Values
15
- // mirror the showcase src/styles/global.css (per-line separators at
16
- // the 15% muted mix, #2077).
17
- file: "src/styles/global.css",
18
- anchor: "/* @slot:global-css:feature-styles */",
19
- content: `/* ========================================
20
- * Doc History Diff Viewer (side-by-side)
21
- * ======================================== */
22
-
23
- .diff-row {
24
- border-bottom: 1px solid color-mix(in oklch, var(--color-muted) 15%, transparent);
25
- }
26
-
27
- .diff-line-num {
28
- font-family: var(--font-mono, ui-monospace, monospace);
29
- font-size: var(--text-caption);
30
- line-height: 1.5;
31
- padding: 0 var(--spacing-hsp-xs);
32
- text-align: right;
33
- color: var(--color-muted);
34
- user-select: none;
35
- vertical-align: top;
36
- border-right: 1px solid color-mix(in oklch, var(--color-muted) 15%, transparent);
37
- }
38
-
39
- .diff-line-content {
40
- font-family: var(--font-mono, ui-monospace, monospace);
41
- font-size: var(--text-caption);
42
- line-height: 1.5;
43
- padding: 0 var(--spacing-hsp-sm);
44
- white-space: pre-wrap;
45
- word-break: break-all;
46
- vertical-align: top;
47
- }
48
-
49
- /* Left column right border to separate the two sides */
50
- .diff-row td:nth-child(2) {
51
- border-right: 2px solid var(--color-muted);
52
- }
53
-
54
- .diff-line-added {
55
- background-color: color-mix(in oklch, var(--color-success) 15%, transparent);
56
- }
57
-
58
- .diff-line-removed {
59
- background-color: color-mix(in oklch, var(--color-danger) 15%, transparent);
60
- }
61
-
62
- .diff-line-empty {
63
- background-color: color-mix(in oklch, var(--color-muted) 8%, transparent);
64
- }`,
65
- },
66
- ],
27
+ injections: [],
28
+ postProcess: async (targetDir) => {
29
+ const stubPaths = [
30
+ path.join(targetDir, "pages", "docs", "[[...slug]].tsx"),
31
+ path.join(targetDir, "pages", "[locale]", "docs", "[[...slug]].tsx"),
32
+ ];
33
+ for (const stubPath of stubPaths) {
34
+ if (!(await fs.pathExists(stubPath)))
35
+ continue;
36
+ let content = await fs.readFile(stubPath, "utf-8");
37
+ // Idempotency guard: check for the actual inserted import statement,
38
+ // NOT a bare `.includes("DocHistory")` — this file's own header
39
+ // comment (explaining WHY this patch exists) mentions "DocHistory" in
40
+ // prose, which would false-positive a weaker check and skip patching
41
+ // on every run.
42
+ const importMarker = `import { DocHistory } from "@takazudo/zudo-doc/doc-history";`;
43
+ if (content.includes(importMarker))
44
+ continue; // already patched
45
+ content = content.replace(`import { createChrome } from "@takazudo/zudo-doc/chrome";`, `import { createChrome } from "@takazudo/zudo-doc/chrome";
46
+ ${importMarker}
47
+ import { defineChromeBindings } from "@takazudo/zudo-doc/chrome-bindings";`);
48
+ content = content.replace(`const { renderDocPage } = createChrome(routeCtx);`, `const { renderDocPage } = createChrome(routeCtx, defineChromeBindings({ DocHistory }));`);
49
+ await fs.writeFile(stubPath, content);
50
+ }
51
+ },
67
52
  });