/packages/create-zudo-doc/CLAUDE.md
CLAUDE.md at /packages/create-zudo-doc/CLAUDE.md
Path: packages/
create-zudo-doc
CLI scaffold tool for creating new zudo-doc documentation sites. Generates a project with configurable features, color schemes, and i18n support.
Architecture
The generator uses an additive composition approach:
- Copy a minimal base template (
templates/base/) — core files with injection anchors - Generate
astro.config.ts,content.config.ts,settings.ts,package.jsonprogrammatically - Compose selected features — copy feature files + inject code into shared files at anchor points
- Clean up unused anchors
This replaces the old “copy everything then strip” approach. Features are added, not removed — so dead code cannot remain.
Key Files
| File | Role |
|---|---|
src/ | Orchestrates the scaffold pipeline: copy base, generate configs, compose features |
src/ | Composition engine: injection system, anchor cleanup, feature resolution |
src/features/*.ts | Feature modules defining injections for each optional feature (10 modules) |
src/ | Programmatic astro.config.ts generator (conditional imports/integrations) |
src/ | Programmatic content.config.ts generator (locale/version collections) |
src/ | Generates src/ with user-chosen options |
src/ | Feature definitions, color scheme lists, light-dark pairings |
src/ | Shared utilities (patchFile, patchDefaultLang, getSecondaryLang) |
src/ | CLI argument parsing (commander) |
src/ | Programmatic API (createZudoDoc()) |
src/ | Interactive prompts (inquirer) |
src/ | Entry point |
Template Directories
| Directory | Role |
|---|---|
templates/base/ | Minimal project with injection anchors (73 files, no optional feature code) |
templates/features/*/files/ | Feature-specific files copied when a feature is selected |
Injection Anchors
Shared files in templates/base/ have anchor comments where features inject code:
src/— 16 anchors (imports, head scripts, sidebar, breadcrumb, footer, body-end)layouts/ doc- layout. astro src/— 4 anchors (imports, actions, after-theme-toggle)components/ header. astro src/— 2 anchors (theme tokens, feature styles)styles/ global. css
Testing
Unit tests
pnpm test
Runs vitest tests in src/__tests__/.
Generator CLI integration tests
Two Claude Code skills test the full scaffold-build-run cycle:
/— Test a single generation patternl- generator- cli- tester <pattern> /— Run all 9 patterns, fix bugs, verify everythingl- run- generator- cli- whole- test
Test patterns
| Pattern | Description |
|---|---|
barebone | Everything OFF — minimal project |
search | Only search enabled |
i18n | Only i18n enabled |
sidebar-filter | Only sidebar filter enabled |
claude-resources | Only Claude Resources enabled |
design-token-panel | Only design token panel enabled (API only, no CLI flag) |
light-dark | Light-dark color scheme mode |
lang-ja | Japanese as default language |
all-features | Everything ON |
Always rebuild the CLI before testing:
pnpm build
Adding a New Feature
When adding a feature to the main zudo-doc project that the generator should support:
src/— Add feature toconstants. ts FEATURESarray if it needs a CLI flagsrc/features/<name>.ts— Create a feature module defining injections for shared filessrc/— Register the feature modulefeatures/ index. ts templates/features/<name>/files/— Add feature-specific files to copysrc/— Add dependencies inscaffold. ts generatePackageJson()if neededsrc/— Add conditional imports/integrations if the feature affectsastro- config- gen. ts astro.config.tssrc/— Add collections if the feature affects content configcontent- config- gen. ts src/— Add the setting field to generatedsettings- gen. ts settings.tssrc/— Update tests_ _ tests_ _ / scaffold. test. ts
After changes, run / to verify no drift remains between the main project and the generator.