create-zudo-doc 5.3.0 → 5.5.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.
package/dist/cli.d.ts
CHANGED
package/dist/constants.js
CHANGED
|
@@ -219,6 +219,13 @@ export const FEATURES = [
|
|
|
219
219
|
default: false,
|
|
220
220
|
cliFlag: "claude-skills",
|
|
221
221
|
},
|
|
222
|
+
{
|
|
223
|
+
value: "claudeSkillsWriting",
|
|
224
|
+
label: "Claude skills (writing)",
|
|
225
|
+
hint: "Ship the zudo-doc-writing skill (doc-writing + navigation-structure guide for AI-assisted authoring)",
|
|
226
|
+
default: false,
|
|
227
|
+
cliFlag: "claude-skills-writing",
|
|
228
|
+
},
|
|
222
229
|
{
|
|
223
230
|
value: "designTokenPanel",
|
|
224
231
|
label: "Design Token Panel",
|
package/dist/features/index.js
CHANGED
|
@@ -51,6 +51,7 @@ export const featureModules = {
|
|
|
51
51
|
dynamicPageTransition: dynamicPageTransitionFeature,
|
|
52
52
|
// skillSymlinker — handled in scaffold.ts
|
|
53
53
|
// claudeSkills — handled in scaffold.ts (copies zudo-doc-* skills from monorepo)
|
|
54
|
+
// claudeSkillsWriting — handled in scaffold.ts (copies the zudo-doc-writing skill)
|
|
54
55
|
tagGovernance: tagGovernanceFeature,
|
|
55
56
|
docTags: docTagsFeature,
|
|
56
57
|
footerTaglist: footerTaglistFeature,
|
package/dist/scaffold.d.ts
CHANGED
|
@@ -32,5 +32,5 @@ export declare function deriveDocSkillName(projectName: string): string;
|
|
|
32
32
|
*
|
|
33
33
|
* Bumped in lockstep by scripts/release-create-zudo-doc.sh.
|
|
34
34
|
*/
|
|
35
|
-
export declare const ZUDO_DOC_PIN = "^5.
|
|
35
|
+
export declare const ZUDO_DOC_PIN = "^5.5.0";
|
|
36
36
|
export declare function scaffold(choices: UserChoices): Promise<void>;
|
package/dist/scaffold.js
CHANGED
|
@@ -43,7 +43,7 @@ export function deriveDocSkillName(projectName) {
|
|
|
43
43
|
*
|
|
44
44
|
* Bumped in lockstep by scripts/release-create-zudo-doc.sh.
|
|
45
45
|
*/
|
|
46
|
-
export const ZUDO_DOC_PIN = "^5.
|
|
46
|
+
export const ZUDO_DOC_PIN = "^5.5.0";
|
|
47
47
|
/**
|
|
48
48
|
* Files in `templates/base/**` that must not be copied by the unconditional
|
|
49
49
|
* base mirror. Each entry is matched against the path relative to
|
|
@@ -271,6 +271,22 @@ export async function scaffold(choices) {
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
|
+
// 2c. Copy the writing-guide skill when enabled — same shipping model as
|
|
275
|
+
// 2b (committed, scaffold-authored template; not read from the monorepo's
|
|
276
|
+
// .claude/skills/), but an independent checkbox: the writing + navigation
|
|
277
|
+
// guide targets AI-assisted content authoring, which a project may want
|
|
278
|
+
// without the design-system/translate/version-bump bundle (or vice versa).
|
|
279
|
+
if (choices.features.includes("claudeSkillsWriting")) {
|
|
280
|
+
const skillSrc = path.join(featuresDir, "claudeSkillsWriting/files/.claude/skills/zudo-doc-writing");
|
|
281
|
+
const skillDest = path.join(targetDir, ".claude/skills/zudo-doc-writing");
|
|
282
|
+
if (await fs.pathExists(skillSrc)) {
|
|
283
|
+
await fs.copy(skillSrc, skillDest);
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
// Defensive only — unreachable in a healthy publish.
|
|
287
|
+
console.warn('claudeSkillsWriting: missing template source for "zudo-doc-writing", skipping');
|
|
288
|
+
}
|
|
289
|
+
}
|
|
274
290
|
const defaultLang = choices.defaultLang;
|
|
275
291
|
const escapedName = capitalize(choices.projectName.replace(/-/g, " "));
|
|
276
292
|
// Place primary content in src/content/docs/
|
|
@@ -582,9 +598,20 @@ function generatePackageJson(choices) {
|
|
|
582
598
|
// 2.3.0/2.3.1: additive + bugfix only (desktop TOC collapse toggle,
|
|
583
599
|
// markdown fragment validation fixes, dev-server CSS rebuild loop fix).
|
|
584
600
|
// No generator-side migration.
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
601
|
+
// 2.4.0: additive + bugfix only (plugin log envelopes rendered on the
|
|
602
|
+
// terminal, stale plugin bundle temp-file sweeping, an SSR request-param
|
|
603
|
+
// detector wired into dev/build/check, and a wrangler minimum-version gate
|
|
604
|
+
// in `zfb preview` replacing the old exact-equality check). A fresh
|
|
605
|
+
// scaffold ships no plugins and no SSR routes, so there is no
|
|
606
|
+
// generator-side migration.
|
|
607
|
+
// 2.5.0: `markdown.gfm`'s conservative default now also includes
|
|
608
|
+
// `autolinkLiteral`, so bare URLs in markdown render as links without
|
|
609
|
+
// config. Behavioral, but purely additive for authors; a partial `gfm`
|
|
610
|
+
// object still inherits the default for keys it does not name, so the
|
|
611
|
+
// preset's `{ taskListItem, footnoteDefinition }` picks it up for free.
|
|
612
|
+
"@takazudo/zfb": "2.5.0",
|
|
613
|
+
"@takazudo/zfb-runtime": "2.5.0",
|
|
614
|
+
"@takazudo/zfb-md-wasm": "2.5.0",
|
|
588
615
|
// @takazudo/zudo-doc — published from this monorepo via
|
|
589
616
|
// .github/workflows/publish-zudo-doc.yml. The pin here is bumped in
|
|
590
617
|
// lockstep by scripts/release-create-zudo-doc.sh whenever zudo-doc's
|
|
@@ -706,7 +733,7 @@ function generatePackageJson(choices) {
|
|
|
706
733
|
// `/exclude` at module scope from the always-bundled chrome graph; #3110
|
|
707
734
|
// moved compileExclude into @takazudo/zudo-doc, so docHistory-OFF projects
|
|
708
735
|
// no longer need the package at all.
|
|
709
|
-
deps["@takazudo/zudo-doc-history-server"] = "^5.
|
|
736
|
+
deps["@takazudo/zudo-doc-history-server"] = "^5.5.0";
|
|
710
737
|
// tsx is no longer needed here: the relocated package plugin imports the
|
|
711
738
|
// runner directly (no `tsx -e` spawn) since the package ships compiled
|
|
712
739
|
// dist/ — package-first migration #2321 (#2337).
|
package/package.json
CHANGED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: zudo-doc-writing
|
|
3
|
+
description: "Doc-writing and navigation-structure guide for this zudo-doc project. Consult BEFORE creating pages, adding categories, designing header navigation, or writing/editing mdx content under src/content/. Covers: plan-the-nav-tree-first workflow, 3-level hierarchy (header → sidebar → nested), file-structure-is-navigation, category index pages, sidebar_position discipline, frontmatter schema, no-h1 rule, relative .mdx links, and admonition syntax. Triggered by 'write docs', 'add a page', 'create a page', 'add category', 'structure navigation', 'nav design', 'zudo-doc-writing'."
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# zudo-doc Writing & Navigation Guide
|
|
8
|
+
|
|
9
|
+
**IMPORTANT**: Follow this guide strictly when creating or editing documentation in this project. AI tools that skip the navigation-planning step produce chaotic, hard-to-navigate doc structures almost every time — this skill exists to prevent exactly that.
|
|
10
|
+
|
|
11
|
+
## Step 0 — Plan the Navigation Tree BEFORE Writing Anything
|
|
12
|
+
|
|
13
|
+
Never create pages one by one "wherever seems closest." Before writing the first page:
|
|
14
|
+
|
|
15
|
+
1. List every topic the site must cover.
|
|
16
|
+
2. Draw the full navigation tree (header items → sidebar categories → pages) as a plain-text outline.
|
|
17
|
+
3. Only then create directories and files matching that tree exactly.
|
|
18
|
+
|
|
19
|
+
When adding to an existing site, read the current tree under `src/content/docs/` first, draw it out, and place the new page where it fits the hierarchy — never skip this step.
|
|
20
|
+
|
|
21
|
+
## The 3-Level Hierarchy
|
|
22
|
+
|
|
23
|
+
zudo-doc has exactly three navigation levels. Do not invent more:
|
|
24
|
+
|
|
25
|
+
1. **Header nav** — the broadest categories (3–6 items max)
|
|
26
|
+
2. **Sidebar** — all pages of the active category (generated from the filesystem)
|
|
27
|
+
3. **Nested sidebar categories** — subsections within a sidebar (2–3 levels of nesting max)
|
|
28
|
+
|
|
29
|
+
Each level narrows scope. Never jump levels — do not put a specific page directly in the header, and do not bury a whole category inside a deep sidebar fold.
|
|
30
|
+
|
|
31
|
+
## File Structure IS the Navigation
|
|
32
|
+
|
|
33
|
+
**This is the single most important rule.** The directory tree under `src/content/docs/` *is* the navigation. There is no separate navigation config to maintain:
|
|
34
|
+
|
|
35
|
+
- A directory becomes a sidebar category. Its `index.mdx` is the category landing page.
|
|
36
|
+
- A file becomes a sidebar item.
|
|
37
|
+
- Subdirectories become nested collapsible categories.
|
|
38
|
+
- The `headerNav` setting maps top-level directories to header items via `categoryMatch`.
|
|
39
|
+
|
|
40
|
+
**Consequence**: design the filesystem with navigation in mind from the start. Do not reorganize the sidebar via config hacks — reorganize the files.
|
|
41
|
+
|
|
42
|
+
## Header Navigation Rules
|
|
43
|
+
|
|
44
|
+
Header navigation is the `headerNav` field of the `zudoDoc({...})` call in this project's `zfb.config.ts`:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
// zfb.config.ts
|
|
48
|
+
export default defineConfig(
|
|
49
|
+
zudoDoc({
|
|
50
|
+
headerNav: [
|
|
51
|
+
{ label: "Getting Started", path: "/docs/getting-started", categoryMatch: "getting-started" },
|
|
52
|
+
{
|
|
53
|
+
label: "Learn",
|
|
54
|
+
path: "/docs/guides",
|
|
55
|
+
categoryMatch: "guides",
|
|
56
|
+
children: [
|
|
57
|
+
{ label: "Guides", path: "/docs/guides", categoryMatch: "guides" },
|
|
58
|
+
{ label: "Components", path: "/docs/components", categoryMatch: "components" },
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
{ label: "Reference", path: "/docs/reference", categoryMatch: "reference" },
|
|
62
|
+
],
|
|
63
|
+
}),
|
|
64
|
+
);
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
- **3–6 items max.** More than 6 overwhelms users and wraps the header.
|
|
68
|
+
- **Each item is a broad section, not a page.** "Guides" ✓, "How to install" ✗.
|
|
69
|
+
- **`categoryMatch` MUST be a single top-level directory name.** Multi-segment values (e.g. `"platforms/xbox"`) break active-state highlighting. For nested grouping, use a header-level dropdown with `children` — not a path.
|
|
70
|
+
- **Dropdowns are for closely related sections only.** "Learn > Guides, Components" makes sense. "Everything > 7 miscellaneous items" does not — split into separate header items instead.
|
|
71
|
+
- **`categoryMatch` values must match actual directory names** — `categoryMatch: "guides"` requires a `guides/` directory under the docs content root.
|
|
72
|
+
|
|
73
|
+
For a large navigation tree, the home page's category grid can opt into a wider layout with `home: { wide: true }` in the same `zudoDoc({...})` call.
|
|
74
|
+
|
|
75
|
+
## Sidebar Structure Rules
|
|
76
|
+
|
|
77
|
+
The sidebar is generated from the filesystem. The rules are about how you organize files:
|
|
78
|
+
|
|
79
|
+
- **Every category directory MUST have an `index.mdx`.** Without it, the category has no landing page and may not appear correctly. The index's `sidebar_position` sets the category's position in the parent sidebar.
|
|
80
|
+
- **Every page MUST set `sidebar_position`.** Without it, pages sort alphabetically — almost never what you want. This is the single most common AI mistake. Small integers are fine; leaving gaps (1, 2, 3, 10) makes later insertion easier.
|
|
81
|
+
- **Nesting depth: 2–3 levels max.** Deep nesting hides content. If you need more, the header nav is probably missing a category — split it out.
|
|
82
|
+
- **Each sidebar section covers one cohesive topic.** Do not mix unrelated themes in the same section (e.g. "Hardware" and "Community Events").
|
|
83
|
+
- **Use kebab-case directory and file names.** `my-article.mdx`, not `myArticle.mdx` (breaks on case-sensitive filesystems) or `my_article.mdx`. The URL slug derives from the filename, so kebab-case also keeps URLs clean.
|
|
84
|
+
|
|
85
|
+
## Category Top Page (index.mdx)
|
|
86
|
+
|
|
87
|
+
Every category directory must have an `index.mdx` — the **landing page** for that category. Keep it short:
|
|
88
|
+
|
|
89
|
+
- A 1–2 sentence intro describing what the category covers.
|
|
90
|
+
- A `<CategoryNav category="<dir>" />` component that auto-renders links to sibling pages.
|
|
91
|
+
- **No full content beyond the intro.** Real documentation lives in sibling `.mdx` files under the same directory.
|
|
92
|
+
|
|
93
|
+
```mdx
|
|
94
|
+
---
|
|
95
|
+
title: Guides
|
|
96
|
+
sidebar_position: 1
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
Step-by-step guides for common tasks.
|
|
100
|
+
|
|
101
|
+
<CategoryNav category="guides" />
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The `category` prop value is the category's **slug relative to the docs content root** — for a top-level directory this is just the directory name (e.g. `"guides"`), and for a nested category the slash-joined path (e.g. `"guides/advanced"`). It is a slug, never a filesystem path — no `src/content/` prefix, no trailing slash.
|
|
105
|
+
|
|
106
|
+
## Worked Example — Nav Plan First, Then Files
|
|
107
|
+
|
|
108
|
+
Building a gaming wiki? Plan the tree first:
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
Header Nav: Sidebar (Xbox section):
|
|
112
|
+
├── Home ├── Overview (index)
|
|
113
|
+
├── Platforms ← dropdown ├── Hardware
|
|
114
|
+
│ ├── Xbox │ ├── Xbox Series X
|
|
115
|
+
│ ├── PlayStation │ └── Accessories
|
|
116
|
+
│ └── Nintendo ├── Games
|
|
117
|
+
├── Genres ← dropdown │ ├── Halo Infinite
|
|
118
|
+
│ ├── RPG │ └── Starfield
|
|
119
|
+
│ └── Action └── Services
|
|
120
|
+
└── Community └── Game Pass
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Then the directory structure follows mechanically — each platform and genre gets its own top-level directory so `categoryMatch` matches the first URL segment:
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
src/content/docs/
|
|
127
|
+
├── home/
|
|
128
|
+
│ └── index.mdx
|
|
129
|
+
├── xbox/
|
|
130
|
+
│ ├── index.mdx ← "Overview" (short intro + <CategoryNav>)
|
|
131
|
+
│ ├── hardware/
|
|
132
|
+
│ │ ├── index.mdx
|
|
133
|
+
│ │ ├── xbox-series-x.mdx
|
|
134
|
+
│ │ └── accessories.mdx
|
|
135
|
+
│ ├── games/
|
|
136
|
+
│ │ └── ...
|
|
137
|
+
│ └── services/
|
|
138
|
+
│ └── ...
|
|
139
|
+
├── playstation/
|
|
140
|
+
│ └── index.mdx
|
|
141
|
+
├── rpg/
|
|
142
|
+
│ └── ...
|
|
143
|
+
└── community/
|
|
144
|
+
└── index.mdx
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Writing Rules (per page)
|
|
148
|
+
|
|
149
|
+
### Frontmatter
|
|
150
|
+
|
|
151
|
+
```mdx
|
|
152
|
+
---
|
|
153
|
+
title: My Page
|
|
154
|
+
description: A brief summary of this page.
|
|
155
|
+
sidebar_position: 1
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## First Section
|
|
159
|
+
|
|
160
|
+
Your content here.
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
| Field | Type | Required | Description |
|
|
164
|
+
|-------|------|----------|-------------|
|
|
165
|
+
| `title` | string | Yes | Page title — automatically rendered as the page h1 |
|
|
166
|
+
| `sidebar_position` | number | Strongly recommended | Sort order within category (lower = first) |
|
|
167
|
+
| `description` | string | No | Subtitle shown below the title |
|
|
168
|
+
| `sidebar_label` | string | No | Override the sidebar display label |
|
|
169
|
+
| `tags` | string[] | No | Cross-category grouping |
|
|
170
|
+
| `draft` | boolean | No | Exclude the page from the build entirely |
|
|
171
|
+
| `unlisted` | boolean | No | Built but hidden from sidebar/nav |
|
|
172
|
+
|
|
173
|
+
Frontmatter is Zod-validated at build time. The table above covers the framework-known fields; custom keys (e.g. `author`, `status`) pass through and are preserved for your own use — they just carry no built-in behavior.
|
|
174
|
+
|
|
175
|
+
### No h1 in content
|
|
176
|
+
|
|
177
|
+
The frontmatter `title` IS the page h1, rendered automatically. **Content must start with `## h2` headings.** Writing `# Something` in the body produces a duplicate h1 and breaks the heading hierarchy, TOC, and accessibility.
|
|
178
|
+
|
|
179
|
+
### Linking between documents
|
|
180
|
+
|
|
181
|
+
Use **relative file paths with the `.md`/`.mdx` extension** — they are resolved to correct URLs and validated at build time:
|
|
182
|
+
|
|
183
|
+
```mdx
|
|
184
|
+
[Installation guide](./installation.mdx)
|
|
185
|
+
[Frontmatter fields](../guides/frontmatter.mdx#anchor)
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
- Do NOT use absolute paths like `/docs/foo/bar` in prose — the resolver cannot verify them.
|
|
189
|
+
- Do NOT omit the extension — the resolver needs it to distinguish file links from URL links.
|
|
190
|
+
- External links use regular URLs as usual.
|
|
191
|
+
|
|
192
|
+
### Admonitions
|
|
193
|
+
|
|
194
|
+
Available globally — no imports needed. Two syntaxes:
|
|
195
|
+
|
|
196
|
+
```mdx
|
|
197
|
+
:::note[Optional Title]
|
|
198
|
+
Directive syntax — preferred in prose-heavy content.
|
|
199
|
+
:::
|
|
200
|
+
|
|
201
|
+
<Warning title="Be Careful">JSX syntax — preferred when nesting other JSX.</Warning>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Six types: `note`/`<Note>`, `tip`/`<Tip>`, `info`/`<Info>`, `warning`/`<Warning>`, `danger`/`<Danger>`, `caution`/`<Caution>`. All accept an optional title. (JSX additionally registers `<Important>`, used by GitHub-alert conversion.)
|
|
205
|
+
|
|
206
|
+
## i18n (only when this project's i18n feature is enabled)
|
|
207
|
+
|
|
208
|
+
Check `zfb.config.ts`: if the `zudoDoc({...})` call sets a non-empty `locales` field, i18n is on. Then every page must exist in BOTH the default-locale directory (`src/content/docs/`) and each secondary-locale directory (e.g. `src/content/docs-ja/`), mirroring the same tree — same filenames, translated prose, identical code blocks. A non-i18n scaffold has no secondary content directory; skip this section entirely.
|
|
209
|
+
|
|
210
|
+
Two carve-outs — do NOT create secondary-locale mirrors for these:
|
|
211
|
+
|
|
212
|
+
- Pages with `generated: true` in frontmatter (build-generated content).
|
|
213
|
+
- Paths listed in the `defaultLocaleOnlyPrefixes` setting in `zfb.config.ts` — default-locale-only by design (the Claude Resources feature, when enabled, registers its four `/docs/claude-*` prefixes there).
|
|
214
|
+
|
|
215
|
+
## Common Mistakes (Do Not Do)
|
|
216
|
+
|
|
217
|
+
- **Writing pages before planning the nav tree** — the root cause of chaotic structures.
|
|
218
|
+
- **Putting specific pages in the header nav.** The header is for broad categories only.
|
|
219
|
+
- **Missing `sidebar_position`** — unpredictable alphabetical ordering.
|
|
220
|
+
- **Missing `index.mdx` in category directories** — category has no landing page.
|
|
221
|
+
- **Stuffing a category `index.mdx` with full content** — keep it to intro + `<CategoryNav>`.
|
|
222
|
+
- **Multi-segment `categoryMatch`** (e.g. `"platforms/xbox"`) — breaks header active-state highlighting.
|
|
223
|
+
- **Deep nesting (4+ levels)** — the header nav is probably missing a category.
|
|
224
|
+
- **Starting content with `# h1`** — duplicates the auto-rendered title.
|
|
225
|
+
- **Absolute `/docs/...` links or extension-less links in prose** — the resolver can't verify them.
|
|
226
|
+
- **camelCase/PascalCase file names** — break on case-sensitive filesystems.
|
|
227
|
+
- **Reorganizing navigation via config instead of moving files** — the filesystem is the navigation.
|
|
228
|
+
|
|
229
|
+
## Checklist Before Creating Any Page
|
|
230
|
+
|
|
231
|
+
- [ ] Have you drawn (or re-read) the full navigation tree?
|
|
232
|
+
- [ ] Which header category does the page belong under? (If none fits, add a header category or reconsider the page.)
|
|
233
|
+
- [ ] Which sidebar section inside that header category?
|
|
234
|
+
- [ ] Does the target directory exist, with an `index.mdx`?
|
|
235
|
+
- [ ] Is `sidebar_position` set in the frontmatter?
|
|
236
|
+
- [ ] Is the file name kebab-case?
|
|
237
|
+
- [ ] Does the content start with `## h2` (no h1)?
|
|
238
|
+
- [ ] If i18n is enabled: is the secondary-locale mirror file created too?
|
|
239
|
+
|
|
240
|
+
## Full Guides
|
|
241
|
+
|
|
242
|
+
The complete versions of this guidance (with more examples) are published in the zudo-doc showcase docs:
|
|
243
|
+
|
|
244
|
+
- Writing docs: https://zudo-doc.takazudomodular.com/docs/getting-started/writing-docs/
|
|
245
|
+
- Structuring navigations: https://zudo-doc.takazudomodular.com/docs/getting-started/structuring-navigations/
|