[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6D2FC497B39G091ESNJT24N":3,"skill-same:01M6D2FC497B39G091ESNJT24N":71},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":51,"commitSha":52,"skillDirectory":53,"forksCount":54,"repositoryHtmlUrl":55,"repositoryHomepageUrl":6,"ownerHtmlUrl":56,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":57,"install":58,"resources":70},"01M6D2FC497B39G091ESNJT24N","l-migrate-to-preset-style",null,"Migrate an existing zudo-doc project to the MINIMAL SCAFFOLD shape (epic #2651): diff against the pinned ~5-file base template, DELETE files that match a known deleted-from-template legacy path (host chrome\u002Fislands\u002Fconfig wiring — now entirely package-owned), pause for human confirmation on every edited or ambiguous file, merge a legacy src\u002Fconfig\u002Fsettings.ts into zfb.config.ts's zudoDoc({...}) call, swap tsconfig.json to the extends form, and gate every island-touching change behind a hydration smoke test. Use when: (1) User says 'migrate to preset style', 'preset-first migration', 'migrate to minimal scaffold', 'l-migrate-to-preset-style', 'migrate generated project', 'migrate to preset', or 'run the preset migration'; (2) An existing create-zudo-doc scaffolded project (or an older preset-style project) needs to adopt the minimal-scaffold shape introduced in epic zudolab\u002Fzudo-doc#2651.","zudolab\u002Fzudo-doc","zudolab","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F266356510?v=4","01M6D2E9N9X9851YB24CEQF04H","01M6D2E9SFKZ0FWBMPB2625H28",1,"MIT","https:\u002F\u002Fgithub.com\u002Fzudolab\u002Fzudo-doc\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fl-migrate-to-preset-style\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"l migrate to preset style","preset","migrate","style","dry","wiring","when","host","now","diff","smoke","doc","config","src","merge","run","template","human","delete","change","adopt","create","confirmation","generated","files","project","2026-11-10 10:12:30",false,"---\nname: l-migrate-to-preset-style\ndescription: >-\n  Migrate an existing zudo-doc project to the MINIMAL SCAFFOLD shape (epic\n  #2651): diff against the pinned ~5-file base template, DELETE files that\n  match a known deleted-from-template legacy path (host chrome\u002Fislands\u002Fconfig\n  wiring — now entirely package-owned), pause for human confirmation on every\n  edited or ambiguous file, merge a legacy src\u002Fconfig\u002Fsettings.ts into\n  zfb.config.ts's zudoDoc({...}) call, swap tsconfig.json to the extends form,\n  and gate every island-touching change behind a hydration smoke test. Use\n  when: (1) User says 'migrate to preset style', 'preset-first migration',\n  'migrate to minimal scaffold', 'l-migrate-to-preset-style', 'migrate\n  generated project', 'migrate to preset', or 'run the preset migration';\n  (2) An existing create-zudo-doc scaffolded project (or an older\n  preset-style project) needs to adopt the minimal-scaffold shape introduced\n  in epic zudolab\u002Fzudo-doc#2651.\nuser-invocable: true\nargument-hint: \"[--dry-run] [--skip-hydration-check]\"\n---\n\n# \u002Fl-migrate-to-preset-style\n\nMigrate an existing generated project to the **minimal-scaffold** shape (epic\nzudolab\u002Fzudo-doc#2651): a single `zfb.config.ts` (`zudoDoc({...})`), a\nhandful of unavoidable root files, and markdown content — everything else\n(chrome, islands, layout, default `:root` tokens, even the doc ROUTES) ships\nfrom `@takazudo\u002Fzudo-doc` in `node_modules`. This is the v2 destination shape\nfor what used to be called \"preset-style\" (the flat-config → `zudoDocPreset()`\nmigration, Package-First Finale epic #2356) — the skill keeps its original\nname (`l-migrate-to-preset-style`) because other tooling references it by\nname (the #2664 doc-skill child), but the target shape it migrates TOWARD has\nmoved further, to the locked ~12-file manifest.\n\nThe migration is **human-gated**: auto-delete is permitted only for files\nthat are (a) byte-identical to the pinned template baseline, or (b) match a\nKNOWN deleted-from-template legacy path with no eject-CLI counterpart (see\nStep 3). Any edited or ambiguous file pauses for explicit human confirmation\nbefore touching it.\n\n> **Shaped by `l-lessons-zfb-migration-parity`:** a dead island silently\n> server-renders and the build still exits 0, so byte-comparison alone is\n> insufficient proof that an island migration succeeded. Every\n> island-touching step is gated behind a hydration smoke test.\n\n## Preconditions\n\nVerify ALL of the following before proceeding. Stop and tell the user if any fails.\n\n1. The target project was generated by `create-zudo-doc` (a `package.json`\n   exists at the project root, with a `@takazudo\u002Fzudo-doc` dependency).\n2. The working tree is clean (`git status --porcelain` returns empty). If not, commit or\n   stash first — the migration writes files and a dirty tree makes audit ambiguous.\n3. Identify the pinned `@takazudo\u002Fzudo-doc` version from `package.json`. This\n   skill always diffs against **today's** `packages\u002Fcreate-zudo-doc\u002Ftemplates\u002Fbase\u002F`\n   and `templates\u002Ffeatures\u002F*\u002Ffiles\u002F` in THIS repo (the current minimal\n   5-file base template) — not a version-matched historical template. If the\n   target project's pinned version predates the minimal-scaffold cutover\n   (epic #2651) by a lot, expect a large Step 1 diff; that is the point of\n   this migration, not an error condition.\n4. **`--dry-run`** — when passed, run Steps 1–3 (diff + classify + report) but apply no\n   mutations, perform no hydration checks, and print the plan without executing it.\n\n## Step 0 — Detect the starting shape\n\nRead the target project's `zfb.config.ts` (or, for a pre-#2657 project,\n`src\u002Fconfig\u002Fsettings.ts`) to determine which generation it's on. This\ndecides which later steps apply:\n\n| Starting shape | Signal | Steps needed |\n|---|---|---|\n| **Already minimal** (`zudoDoc({...})` in `zfb.config.ts`, no `src\u002Fconfig\u002Fsettings.ts`) | `zfb.config.ts` imports `zudoDoc` from `@takazudo\u002Fzudo-doc\u002Fconfig` | Steps 1–3, 6–8 (config already merged) |\n| **Preset-style** (`zudoDocPreset({...})` spread inline in `zfb.config.ts`, `src\u002Fconfig\u002Fsettings.ts` still the real settings object) | `zfb.config.ts` imports `zudoDocPreset` from `@takazudo\u002Fzudo-doc\u002Fpreset` | All steps, including Step 4 (config-merge) |\n| **Legacy flat-config** (hand-rolled `defineConfig({...})` with inline plugin wiring, `src\u002Fconfig\u002Fsettings.ts`) | No `zudoDocPreset`\u002F`zudoDoc` import at all | All steps — expect the largest Step 1 diff |\n\n## Step 1 — Template-baseline diff\n\nUse **`scripts\u002Fcheck-template-drift.sh`** (from the zudo-doc repo) as the canonical diff\nmechanism. The script compares `templates\u002Fbase\u002F` (today, 5 files:\n`pages\u002Findex.tsx`, `pages\u002Fdocs\u002F[[...slug]].tsx`, `src\u002Fstyles\u002Fglobal.css`,\n`tsconfig.json`, `scripts\u002Fsetup-doc-skill.sh`) and `templates\u002Ffeatures\u002F*\u002Ffiles\u002F`\nagainst the target project, respecting `.template-drift-allowlist`. It reports\nthree categories:\n\n- **`[DIFF]`** — file differs from the template (may have local edits)\n- **`[MISSING IN PROD]`** — template file has no counterpart in the target project\n- **`[USE-CLIENT DRIFT]`** — `\"use client\"` directive mismatch between template and host\n\nRun from the **target project root**, pointing `ROOT_DIR` at it:\n\n```bash\nROOT_DIR=\u003Ctarget-project-root> bash \u003Cpath-to-zudo-doc>\u002Fscripts\u002Fcheck-template-drift.sh\n```\n\nCapture the full output. This only tells you about files the CURRENT\ntemplate still has an opinion on — because the template shrank from ~64\nfiles to ~5, most of an older project's files have NO current template\ncounterpart at all, so this script won't mention them. **Step 1b below finds\nthose.**\n\n### Step 1b — Deleted-from-template scan (the bulk of an older project's diff)\n\nScan the target project for paths matching the epic's known deleted-file\nfamilies (mirrors `packages\u002Fcreate-zudo-doc\u002Fsrc\u002F__tests__\u002Fscaffold.test.ts`'s\n`NEVER_RESURRECTED` table — that test file is the authoritative, CI-enforced\nversion of this list):\n\n```bash\ncd \u003Ctarget-project-root>\nfind pages\u002Flib src\u002Fcomponents src\u002Futils src\u002Ftypes src\u002Fconfig \\\n  zfb-shim.d.ts .htmlvalidate.json .zfb\u002Fdoc-history-meta.json \\\n  scripts\u002Frun-b4push.sh src\u002Fcontent.config.ts \\\n  -type f 2>\u002Fdev\u002Fnull\n```\n\nEvery match is a **deleted-from-template legacy file** — the behavior it\nimplemented is now entirely package-owned (chrome, islands, settings types,\nz-index codegen, html-validate, etc.). See the epic's Wave 6 completion\ncomment (#2660) for the full rationale per family.\n\n**One documented exception**: if the target project selected `tagGovernance`,\nit legitimately has a narrow `src\u002Fconfig\u002Fsettings.ts` + `src\u002Fconfig\u002Ftag-vocabulary.ts`\npair (a tiny audit-only mirror the package's `tags-audit` bin still imports\nby path — see `src\u002Ffeatures\u002Ftag-governance.ts`'s header comment). Do NOT\nflag these two specific files if they match that narrow shape (a small\nobject literal with `docsDir`\u002F`tagGovernance`\u002F`tagVocabulary`\u002F`locales` only,\nor a `TagVocabularyEntry[]` array) — they are current, not legacy. If\n`src\u002Fconfig\u002Fsettings.ts` is instead the OLD full project-wide settings\nobject (dozens of fields), it IS legacy — route it to Step 4 (config-merge),\nnot Step 3 (delete).\n\n## Step 2 — Classify each drifted \u002F legacy file\n\nFor every file flagged by Step 1 or Step 1b, classify it into one of four categories:\n\n| Category | Criterion | Action |\n|---|---|---|\n| **A — byte-identical to current template** | `diff -q` against the matching `templates\u002Fbase\u002F` or `templates\u002Ffeatures\u002F*\u002Ffiles\u002F` counterpart returns 0 | Safe to auto-delete (no local edits) |\n| **D — deleted-from-template legacy file** | Matches a Step 1b path family AND has no current template counterpart at all | Default action: **DELETE** (not eject — see Step 3) |\n| **B — edited** | File exists in both old and new shape but content differs, OR is a deleted-from-template file with clearly customized content | Pause → human confirmation → default depends on eject-mapping (see Step 3) |\n| **C — missing in prod** | Current template file has no counterpart in the project | Usually means it should be added; pause → confirm |\n\n**Byte-identical check** (the definitive test for Category A):\n\n```bash\ndiff -q \u003Ctemplate-file> \u003Ctarget-file>\n# exit 0 → identical (Category A)\n# exit 1 → differs (Category B)\n```\n\nBuild three lists — `AUTO_DELETE` (A + D), `NEEDS_CONFIRMATION` (B + C), and\n`CONFIG_MERGE` (a full legacy `src\u002Fconfig\u002Fsettings.ts`, routed to Step 4) —\nbefore taking any action.\n\n## Step 3 — Delete Category A + D files\n\n> **This is the flipped default from v1 of this skill.** The v1 (preset-first,\n> #2356-era) migration defaulted an edited\u002Fambiguous file to **eject**\n> (`zudo-doc eject \u003Ccomponent>`) because the old template's host stubs\n> (`pages\u002Flib\u002F_header-with-defaults.tsx`, `src\u002Fcomponents\u002F*.tsx`, …) were\n> genuinely swappable for an ejected package copy at the SAME layer. In the\n> minimal-scaffold shape those host stubs don't exist as a concept anymore —\n> the package owns chrome\u002Froutes\u002Fislands outright via `createChrome()` and\n> `packageOwnedRoutes`, and there is **no eject target that corresponds to a\n> deleted host wiring file** (the `EJECTABLE` map below is for\n> PRESENTATIONAL components — header, footer, toc, individual islands — a\n> different and still-valid axis of customization). So a Category D file's\n> default action is **DELETE**, not eject.\n\nCategory A (byte-identical to the current template) and Category D\n(deleted-from-template legacy file, unmodified) are both safe to remove\noutright:\n\n```bash\nfor f in \"${AUTO_DELETE[@]}\"; do\n  rm \"$f\"\n  git rm \"$f\"          # stage the removal\ndone\n```\n\nReport each deleted path so the user has a clear audit trail, grouped by\nfamily (pages\u002Flib\u002F*, src\u002Fcomponents\u002F*, src\u002Futils\u002F*, src\u002Ftypes\u002F*,\nsrc\u002Fconfig\u002F*, standalone files) so the report reads like the Wave 6\ncompletion comment's delete-list rather than a flat file dump.\n\n> **Do NOT auto-delete `\"use client\"` island components** even if they are\n> byte-identical to a deleted-from-template stub. Islands that are\n> byte-identical to the old template may still be relied upon for hydration\n> wiring the package's `createChrome()` doesn't yet auto-default (check\n> `routes\u002F_chrome.tsx`'s header comment for which islands ARE\n> auto-defaulted — currently `DesignTokenPanelBootstrap`; `DocHistory` is\n> NOT, and needs the `chromeBindingsModule` seam). Move every island\n> component to `NEEDS_CONFIRMATION` regardless of diff result — the\n> hydration smoke gate in Step 6 is mandatory before their removal can be\n> declared safe.\n\n> **Do NOT delete `src\u002Fconfig\u002Fsettings.ts` here even if it looks legacy.**\n> Route it to Step 4 (config-merge) instead — deleting it before merging its\n> fields into `zfb.config.ts` silently reverts every non-default setting to\n> the package default.\n\n## Step 4 — Config-merge: `settings.ts` → `zfb.config.ts`'s `zudoDoc({...})`\n\nSkip this step if Step 0 detected the project is already on the minimal\nshape. Otherwise, the target project's real configuration currently lives in\n`src\u002Fconfig\u002Fsettings.ts` (a plain object) and is either spread into an\ninline `zudoDocPreset({...})` call or hand-wired field-by-field into\n`defineConfig({...})`. Migrate it to the single-entry `zudoDoc()` API\n(`@takazudo\u002Fzudo-doc\u002Fconfig`).\n\n### 4a. Simple path (recommended default) — keep `settings.ts`, wrap it\n\nThis is the SAME pattern this repo's own showcase uses (see the root\n`zfb.config.ts` and `src\u002Fconfig\u002Fsettings.ts`) — the lowest-risk migration,\nsince it changes zero field values, only the wiring:\n\n```ts\n\u002F\u002F zfb.config.ts\nimport { defineConfig } from \"zfb\u002Fconfig\";\nimport { zudoDoc } from \"@takazudo\u002Fzudo-doc\u002Fconfig\";\nimport { settings } from \".\u002Fsrc\u002Fconfig\u002Fsettings\";\n\nexport default defineConfig(\n  zudoDoc({\n    ...settings,\n    \u002F\u002F If the project has custom host bindings (search widget, doc-history,\n    \u002F\u002F frontmatter renderers, footer tag loader, MDX component overrides —\n    \u002F\u002F see Step 4c below), thread them here:\n    \u002F\u002F chromeBindingsModule: \".\u002Fsrc\u002Fchrome-bindings\",\n  }),\n);\n```\n\nDelete any now-redundant escape-hatch imports the old config wired manually\n(`buildDocsSchema`, `colorSchemes`, `translations`, `directives`,\n`tagVocabularyEntries`) — pass them as `zudoDoc()` fields instead if the\nproject overrides any of them (see `packages\u002Fzudo-doc\u002Fsrc\u002Fconfig.ts`'s\n`ZudoDocConfig` for the full field list and each field's `@default`).\n\n**Retired Tauri \u002F find-in-page pieces (#4758).** Drop a `findInPage` field\nfrom the merged config and any direct `@takazudo\u002Fzudo-doc\u002Ffind-in-page`\nimport — both are removed from the package. `src-tauri\u002F`, `src-tauri-dev\u002F`,\nand `dev:tauri*` \u002F `build:tauri*` scripts are user-owned app files: list them\nunder `NEEDS_CONFIRMATION` and delete only after the human confirms. Never\ntouch installed apps or per-user app data. The user guide is\n`src\u002Fcontent\u002Fdocs\u002Fguides\u002Ftauri-modes.mdx`.\n\n### 4b. Deeper cleanup (optional) — inline as diff-from-defaults literals\n\nA fresh `create-zudo-doc` scaffold emits ONLY the fields that differ from\n`ZudoDocConfig`'s documented defaults, directly as `zudoDoc({...})` literals\n— no `settings.ts` file at all. A project that wants to fully match that\nshape can flatten `settings.ts`'s fields into `zfb.config.ts` and delete the\nfile, but this is optional cosmetic cleanup, not required for the migration\nto succeed — do it only if the user asks for it, since it's a larger diff\nwith no functional benefit over 4a.\n\n### 4c. Custom host bindings (only if the project has any)\n\nIf the OLD project had real host-bound behavior (a search widget, doc\nhistory with real git data, custom frontmatter-preview renderers, a footer\ntag loader, custom MDX component overrides) wired through its own\n`pages\u002Flib\u002F_chrome.ts`-style module, that behavior needs a\n`chromeBindingsModule` — a project-root-relative module exporting\n`chromeBindings: ChromeHostBindings`. Use this repo's own\n`src\u002Fchrome-bindings.tsx` as the reference shape (it implements every\n`ChromeHostBindings` slot the showcase needs) and\n`packages\u002Fzudo-doc\u002Fdocs\u002Fadr\u002Froute-injection-seam.md`'s \"Host-callables\nchannel — chromeBindingsModule\" section for the contract. If the project has\nNO custom host bindings, skip this — the package's own stubs (empty\nsearch results, no-op DocHistory, etc.) cover a plain scaffold fine.\n\n## Step 5 — tsconfig swap to the extends form\n\nReplace the target project's hand-rolled `tsconfig.json` with the extends\nform (see `packages\u002Fzudo-doc\u002FCLAUDE.md`'s \"Shipped ambient type shims + tsconfig\nbase\" section for the full contract):\n\n```jsonc\n{\n  \"extends\": \"@takazudo\u002Fzudo-doc\u002Ftsconfig.base.json\",\n  \"include\": [\"src\", \"pages\", \"zfb.config.ts\"],\n  \"compilerOptions\": {\n    \u002F\u002F No baseUrl (TypeScript 7 rejects it with TS5102 — #4558): an explicitly\n    \u002F\u002F relative target resolves against THIS file's directory. See\n    \u002F\u002F packages\u002Fzudo-doc\u002FCLAUDE.md \"Owned JSX and project-local aliases\".\n    \"paths\": {\n      \"@\u002F*\": [\".\u002Fsrc\u002F*\"]\n    }\n  }\n}\n```\n\n**Two traps, both load-bearing:**\n\n- Do NOT declare a top-level `files` field in the project tsconfig — `files`\n  is override-only across `extends`, and the base's `files` (which pulls in\n  the two ambient shims, `zfb-config-shim.d.ts` + `virtual-modules.d.ts`) would\n  be silently dropped, surfacing later as confusing `TS2307` errors on\n  `zfb\u002Fconfig` \u002F `virtual:*` imports.\n- Delete the project's own `zfb-shim.d.ts` if it still has one — the ambient\n  `zfb\u002Fconfig` types now ship from `@takazudo\u002Fzudo-doc\u002Fzfb-config-shim.d.ts`,\n  pulled in transitively via the base's `files`.\n\nAfter swapping, run `pnpm check` and fix any newly-surfaced type errors\nbefore continuing — this step commonly surfaces stale imports Step 3 missed.\n\n## Step 6 — Hydration smoke gate (mandatory for every island-touching change)\n\n> **Critical invariant (per `l-lessons-zfb-migration-parity`):** a dead island\n> server-renders silently. The zfb build exits 0 and emits valid HTML even when an island\n> component loses its `\"use client\"` directive or its registration is broken. Byte-identical\n> deletion is insufficient proof that islands still hydrate. This gate is\n> **not optional** — skip it only when `--skip-hydration-check` was explicitly passed.\n\nAfter completing Steps 3–5, run the hydration smoke check:\n\n```bash\npnpm build\n```\n\nThen verify island hydration for each component that was deleted or whose\nwiring changed. The minimal check is a grep for the island marker in the built HTML:\n\n```bash\n# Each interactive island emits a data-zfb-island=\"\u003CName>\" marker.\ngrep -roh 'data-zfb-island=\"[^\"]*\"' dist\u002F | sort -u    # distinct island set\ngrep -rl  'data-zfb-island' dist\u002F | wc -l              # total island-bearing pages\n```\n\nCompare the distinct-island set before vs after (capture a baseline with\n`git stash` + build BEFORE Step 3 if you didn't already) — a missing island\nname means a silently dead island. `DocHistory` is the highest-risk case:\nits package-default is a deliberate no-op stub (unlike\n`DesignTokenPanelBootstrap`, which auto-defaults) — if the project had\n`docHistory` enabled and Step 4 didn't wire a `chromeBindingsModule`\nthreading the real `DocHistory` component, the History button silently stops\nhydrating with real data even though the build stays green.\n\nFor any island component touched in Steps 3–5, also verify the component is\nreachable in the dev server and interactive — a static HTML render is not\nthe same as a hydrated island. Use `pnpm dev` + a quick manual check, or\ninvoke `\u002Fverify-ui` for a computed-style smoke:\n\n```bash\npnpm dev &\n# Then check the component interacts as expected.\n```\n\n**If any island fails the hydration check:**\n\n1. Stop immediately — do not proceed to Step 7.\n2. Report which component is dead (compare the distinct-island set: `grep -roh 'data-zfb-island=\"[^\"]*\"' dist\u002F | sort -u`).\n3. Offer to restore the file from git (`git checkout -- \u003Cpath>`) or wire a `chromeBindingsModule` (Step 4c).\n\n## Step 7 — Verify build and types\n\nAfter all mutations, run a full build + typecheck to confirm nothing is broken:\n\n```bash\npnpm build\npnpm check\n```\n\nFix any TypeScript errors before committing. The most common post-migration errors are:\n\n- Import path still references a deleted host file (`pages\u002Flib\u002F_chrome.ts`,\n  `src\u002Fconfig\u002Fsettings-types.ts`, …) — the minimal shape resolves the\n  equivalent type\u002Fbehavior through `@takazudo\u002Fzudo-doc` subpaths instead.\n- A `\"use client\"` directive is missing on a component still wired through\n  a `chromeBindingsModule` slot.\n- `zfb.config.ts` field errors — cross-check against `ZudoDocConfig` in\n  `packages\u002Fzudo-doc\u002Fsrc\u002Fconfig.ts` (every field has a `@default` JSDoc).\n\n## Step 8 — Emit summary report\n\nAfter Steps 3–7 complete (or at any early stop), print a structured summary:\n\n```\n## Migration Summary\n\n### Starting shape (Step 0)\nLegacy flat-config \u002F Preset-style \u002F Already minimal\n\n### Deleted — Category A (byte-identical to current template)\n- \u003Cpath>\n- ...\n\n### Deleted — Category D (deleted-from-template legacy file, no eject target)\n- pages\u002Flib\u002F_header-with-defaults.tsx\n- src\u002Fcomponents\u002Ftheme-toggle.tsx\n- ...\n\n### Kept as-is \u002F ejected (user chose to retain ownership of an edited file)\n- src\u002Fcomponents\u002Fcustom-header.tsx (kept)\n- theme-toggle → src\u002Fcomponents\u002Fzudo-doc\u002Ftheme-toggle\u002F (ejected)\n- ...\n\n### Config merge (Step 4)\n- src\u002Fconfig\u002Fsettings.ts → spread into zfb.config.ts's zudoDoc({...}) (4a)\n- chromeBindingsModule wired: src\u002Fchrome-bindings.tsx (4c) \u002F not needed\n\n### tsconfig swap (Step 5): DONE \u002F SKIPPED (already extends form)\n\n### Skipped (deferred for later)\n- src\u002Fcomponents\u002Fbar.tsx\n- ...\n\n### Hydration smoke: PASS \u002F FAIL\n\u003Clist any failed islands>\n\n### Build: PASS \u002F FAIL\n### Typecheck: PASS \u002F FAIL\n\n### Next steps\n\u003Clist any remaining manual steps>\n```\n\n## Human-gated loop for edited \u002F ambiguous files (Category B + C)\n\nFor **each** file in `NEEDS_CONFIRMATION`, pause and present the following prompt to the\nuser:\n\n```\nFile: \u003Crelative-path>\nCategory: B (edited) \u002F C (missing in prod)\nDiff summary:\n\u003Cshow diff --stat or a short unified diff — keep it readable>\n\nAction?\n  [D] delete — this file's family has no eject target (Category D-adjacent); safe once confirmed\n  [E] eject  — copy local source into project via `zudo-doc eject \u003Ccomponent>` (only if it maps to an EJECTABLE entry, see below)\n  [K] keep   — keep the file as-is (project retains ownership, no package import)\n  [S] skip   — leave file unchanged for now (handle later)\n\nDefault: [E] eject if the file maps to an EJECTABLE component, else [K] keep\n```\n\nWait for the user's explicit response before proceeding to the next file. Never silently\ndelete or overwrite an edited file.\n\n### Eject handoff\n\nWhen the user chooses **eject** (or accepts the default for an ejectable component), call the C1 eject CLI:\n\n```bash\nzudo-doc eject \u003Ccomponent>\n```\n\nThe CLI (ships from `@takazudo\u002Fzudo-doc`, reachable in generated projects as `node_modules\u002F.bin\u002Fzudo-doc`) performs:\n\n1. Copies the component's TS source from the published `eject\u002F` bundle into\n   `src\u002Fcomponents\u002Fzudo-doc\u002F\u003Ccomponent>\u002F` inside the target project.\n2. Rewrites parent-relative cross-component imports to `@takazudo\u002Fzudo-doc\u002F\u003Cdir>` subpath\n   specifiers so they keep resolving against the installed package.\n3. Records the ejected component in `.zudo-doc.json`\n   (`{ \"ejected\": { \"\u003Ccomponent>\": \"src\u002Fcomponents\u002Fzudo-doc\u002F\u003Ccomponent>\" } }`)\n   — lazily creating the file on first successful eject (it is never seeded\n   by the scaffold itself).\n4. Is **idempotent** — re-running on an already-ejected component prints\n   `\"already ejected at \u003Cpath>\"` and exits 0 without clobbering local edits.\n\n**Ejectable components** (18 presentational\u002Flayout\u002Fisland components — the full allowlist, `packages\u002Fzudo-doc\u002Fsrc\u002Feject\u002Findex.ts`'s `EJECTABLE` map):\n\n| CLI name | Import subpath |\n|---|---|\n| `header` | `@takazudo\u002Fzudo-doc\u002Fheader` |\n| `footer` | `@takazudo\u002Fzudo-doc\u002Ffooter` |\n| `breadcrumb` | `@takazudo\u002Fzudo-doc\u002Fbreadcrumb` |\n| `toc` | `@takazudo\u002Fzudo-doc\u002Ftoc` |\n| `sidebar` | `@takazudo\u002Fzudo-doc\u002Fsidebar` |\n| `theme-toggle` | `@takazudo\u002Fzudo-doc\u002Ftheme-toggle` |\n| `page-loading` | `@takazudo\u002Fzudo-doc\u002Fpage-loading` |\n| `tab-item` | `@takazudo\u002Fzudo-doc\u002Ftab-item` |\n| `doc-pager` | `@takazudo\u002Fzudo-doc\u002Fdoc-pager` |\n| `content-admonition` | `@takazudo\u002Fzudo-doc\u002Fcontent-admonition` |\n| `code-group` | `@takazudo\u002Fzudo-doc\u002Fcode-group` |\n| `details` | `@takazudo\u002Fzudo-doc\u002Fdetails` |\n| `sidebar-tree-island` | `@takazudo\u002Fzudo-doc\u002Fsidebar-tree-island` |\n| `sidebar-toggle-island` | `@takazudo\u002Fzudo-doc\u002Fsidebar-toggle-island` |\n| `desktop-sidebar-toggle-island` | `@takazudo\u002Fzudo-doc\u002Fdesktop-sidebar-toggle-island` |\n| `image-enlarge` | `@takazudo\u002Fzudo-doc\u002Fimage-enlarge` |\n| `doc-history` | `@takazudo\u002Fzudo-doc\u002Fdoc-history` |\n| `site-tree-nav-island` | `@takazudo\u002Fzudo-doc\u002Fsite-tree-nav-island` |\n\nIf the file to be ejected does not map to one of these 18 components, the eject CLI will\nreject it. In that case, and the file is a deleted-from-template legacy wiring stub\n(Category D), route to **delete**; otherwise route to **keep** and advise the\nuser to handle it manually.\n\n## Flags\n\n| Flag | Effect |\n|---|---|\n| `--dry-run` | Run Steps 1–3 classification only; print the plan without mutating any files. |\n| `--skip-hydration-check` | Skip Step 6 (only for non-island migrations or known-safe deletions). Must be explicit — not implied by any other flag. |\n\n## Key files and references\n\n| Path | Role |\n|---|---|\n| `scripts\u002Fcheck-template-drift.sh` | Template-baseline diff mechanism for files the CURRENT template still has an opinion on |\n| `.template-drift-allowlist` | Files excluded from the automated drift check (still need manual review) |\n| `packages\u002Fcreate-zudo-doc\u002Fsrc\u002F__tests__\u002Fscaffold.test.ts` | `NEVER_RESURRECTED` — the authoritative, CI-enforced list of deleted-from-template legacy paths (Step 1b) |\n| `packages\u002Fcreate-zudo-doc\u002Ftemplates\u002Fbase\u002F` | Pristine base template (5 files) |\n| `packages\u002Fcreate-zudo-doc\u002Ftemplates\u002Ffeatures\u002F*\u002Ffiles\u002F` | Pristine feature-specific templates (only `i18n` has one; `claudeSkills`\u002F`claudeSkillsWriting` directories are copied from `scaffold.ts`) |\n| `packages\u002Fzudo-doc\u002Fsrc\u002Fconfig.ts` | `ZudoDocConfig` \u002F `zudoDoc()` — the single-entry config API and field census (Step 4) |\n| `packages\u002Fzudo-doc\u002FCLAUDE.md` | \"Shipped ambient type shims + tsconfig base\" section — the tsconfig extends-form contract and its two traps (Step 5) |\n| `packages\u002Fzudo-doc\u002Fdocs\u002Fadr\u002Froute-injection-seam.md` | \"Host-callables channel — chromeBindingsModule\" ADR (Step 4c) |\n| `src\u002Fchrome-bindings.tsx` | This repo's own reference `ChromeHostBindings` implementation (Step 4c) |\n| `packages\u002Fcreate-zudo-doc\u002Fdocs\u002Feject-contract.md` | Full eject CLI contract (C0 #2359; Decision 5 revised S4 #2373) |\n| `packages\u002Fzudo-doc\u002Fsrc\u002Feject\u002Findex.ts` | `EJECTABLE` map and `eject()` — `zudo-doc` bin ships from `@takazudo\u002Fzudo-doc`, not `create-zudo-doc` |\n| `.zudo-doc.json` | Provenance marker in the target project (records ejected components + version), lazily created |\n| `.claude\u002Fskills\u002Fl-lessons-zfb-migration-parity\u002FSKILL.md` | Lessons on why hydration smoke is mandatory |\n","# \u002Fl-migrate-to-preset-style\n\nMigrate an existing generated project to the **minimal-scaffold** shape (epic\nzudolab\u002Fzudo-doc#2651): a single `zfb.config.ts` (`zudoDoc({...})`), a\nhandful of unavoidable root files, and markdown content — everything else\n(chrome, islands, layout, default `:root` tokens, even the doc ROUTES) ships\nfrom `@takazudo\u002Fzudo-doc` in `node_modules`. This is the v2 destination shape\nfor what used to be called \"preset-style\" (the flat-config → `zudoDocPreset()`\nmigration, Package-First Finale epic #2356) — the skill keeps its original\nname (`l-migrate-to-preset-style`) because other tooling references it by\nname (the #2664 doc-skill child), but the target shape it migrates TOWARD has\nmoved further, to the locked ~12-file manifest.\n\nThe migration is **human-gated**: auto-delete is permitted only for files\nthat are (a) byte-identical to the pinned template baseline, or (b) match a\nKNOWN deleted-from-template legacy path with no eject-CLI counterpart (see\nStep 3). Any edited or ambiguous file pauses for explicit human confirmation\nbefore touching it.\n\n> **Shaped by `l-lessons-zfb-migration-parity`:** a dead island silently\n> server-renders and the build still exits 0, so byte-comparison alone is\n> insufficient proof that an island migration succeeded. Every\n> island-touching step is gated behind a hydration smoke test.\n\n## Preconditions\n\nVerify ALL of the following before proceeding. Stop and tell the user if any fails.\n\n1. The target project was generated by `create-zudo-doc` (a `package.json`\n   exists at the project root, with a `@takazudo\u002Fzudo-doc` dependency).\n2. The working tree is clean (`git status --porcelain` returns empty). If not, commit or\n   stash first — the migration writes files and a dirty tree makes audit ambiguous.\n3. Identify the pinned `@takazudo\u002Fzudo-doc` version from `package.json`. This\n   skill always diffs against **today's** `packages\u002Fcreate-zudo-doc\u002Ftemplates\u002Fbase\u002F`\n   and `templates\u002Ffeatures\u002F*\u002Ffiles\u002F` in THIS repo (the current minimal\n   5-file base template) — not a version-matched historical template. If the\n   target project's pinned version predates the minimal-scaffold cutover\n   (epic #2651) by a lot, expect a large Step 1 diff; that is the point of\n   this migration, not an error condition.\n4. **`--dry-run`** — when passed, run Steps 1–3 (diff + classify + report) but apply no\n   mutations, perform no hydration checks, and print the plan without executing it.\n\n## Step 0 — Detect the starting shape\n\nRead the target project's `zfb.config.ts` (or, for a pre-#2657 project,\n`src\u002Fconfig\u002Fsettings.ts`) to determine which generation it's on. This\ndecides which later steps apply:\n\n| Starting shape | Signal | Steps needed |\n|---|---|---|\n| **Already minimal** (`zudoDoc({...})` in `zfb.config.ts`, no `src\u002Fconfig\u002Fsettings.ts`) | `zfb.config.ts` imports `zudoDoc` from `@takazudo\u002Fzudo-doc\u002Fconfig` | Steps 1–3, 6–8 (config already merged) |\n| **Preset-style** (`zudoDocPreset({...})` spread inline in `zfb.config.ts`, `src\u002Fconfig\u002Fsettings.ts` still the real settings object) | `zfb.config.ts` imports `zudoDocPreset` from `@takazudo\u002Fzudo-doc\u002Fpreset` | All steps, including Step 4 (config-merge) |\n| **Legacy flat-config** (hand-rolled `defineConfig({...})` with inline plugin wiring, `src\u002Fconfig\u002Fsettings.ts`) | No `zudoDocPreset`\u002F`zudoDoc` import at all | All steps — expect the largest Step 1 diff |\n\n## Step 1 — Template-baseline diff\n\nUse **`scripts\u002Fcheck-template-drift.sh`** (from the zudo-doc repo) as the canonical diff\nmechanism. The script compares `templates\u002Fbase\u002F` (today, 5 files:\n`pages\u002Findex.tsx`, `pages\u002Fdocs\u002F[[...slug]].tsx`, `src\u002Fstyles\u002Fglobal.css`,\n`tsconfig.json`, `scripts\u002Fsetup-doc-skill.sh`) and `templates\u002Ffeatures\u002F*\u002Ffiles\u002F`\nagainst the target project, respecting `.template-drift-allowlist`. It reports\nthree categories:\n\n- **`[DIFF]`** — file differs from the template (may have local edits)\n- **`[MISSING IN PROD]`** — template file has no counterpart in the target project\n- **`[USE-CLIENT DRIFT]`** — `\"use client\"` directive mismatch between template and host\n\nRun from the **target project root**, pointing `ROOT_DIR` at it:\n\n```bash\nROOT_DIR=\u003Ctarget-project-root> bash \u003Cpath-to-zudo-doc>\u002Fscripts\u002Fcheck-template-drift.sh\n```\n\nCapture the full output. This only tells you about files the CURRENT\ntemplate still has an opinion on — because the template shrank from ~64\nfiles to ~5, most of an older project's files have NO current template\ncounterpart at all, so this script won't mention them. **Step 1b below finds\nthose.**\n\n### Step 1b — Deleted-from-template scan (the bulk of an older project's diff)\n\nScan the target project for paths matching the epic's known deleted-file\nfamilies (mirrors `packages\u002Fcreate-zudo-doc\u002Fsrc\u002F__tests__\u002Fscaffold.test.ts`'s\n`NEVER_RESURRECTED` table — that test file is the authoritative, CI-enforced\nversion of this list):\n\n```bash\ncd \u003Ctarget-project-root>\nfind pages\u002Flib src\u002Fcomponents src\u002Futils src\u002Ftypes src\u002Fconfig \\\n  zfb-shim.d.ts .htmlvalidate.json .zfb\u002Fdoc-history-meta.json \\\n  scripts\u002Frun-b4push.sh src\u002Fcontent.config.ts \\\n  -type f 2>\u002Fdev\u002Fnull\n```\n\nEvery match is a **deleted-from-template legacy file** — the behavior it\nimplemented is now entirely package-owned (chrome, islands, settings types,\nz-index codegen, html-validate, etc.). See the epic's Wave 6 completion\ncomment (#2660) for the full rationale per family.\n\n**One documented exception**: if the target project selected `tagGovernance`,\nit legitimately has a narrow `src\u002Fconfig\u002Fsettings.ts` + `src\u002Fconfig\u002Ftag-vocabulary.ts`\npair (a tiny audit-only mirror the package's `tags-audit` bin still imports\nby path — see `src\u002Ffeatures\u002Ftag-governance.ts`'s header comment). Do NOT\nflag these two specific files if they match that narrow shape (a small\nobject literal with `docsDir`\u002F`tagGovernance`\u002F`tagVocabulary`\u002F`locales` only,\nor a `TagVocabularyEntry[]` array) — they are current, not legacy. If\n`src\u002Fconfig\u002Fsettings.ts` is instead the OLD full project-wide settings\nobject (dozens of fields), it IS legacy — route it to Step 4 (config-merge),\nnot Step 3 (delete).\n\n## Step 2 — Classify each drifted \u002F legacy file\n\nFor every file flagged by Step 1 or Step 1b, classify it into one of four categories:\n\n| Category | Criterion | Action |\n|---|---|---|\n| **A — byte-identical to current template** | `diff -q` against the matching `templates\u002Fbase\u002F` or `templates\u002Ffeatures\u002F*\u002Ffiles\u002F` counterpart returns 0 | Safe to auto-delete (no local edits) |\n| **D — deleted-from-template legacy file** | Matches a Step 1b path family AND has no current template counterpart at all | Default action: **DELETE** (not eject — see Step 3) |\n| **B — edited** | File exists in both old and new shape but content differs, OR is a deleted-from-template file with clearly customized content | Pause → human confirmation → default depends on eject-mapping (see Step 3) |\n| **C — missing in prod** | Current template file has no counterpart in the project | Usually means it should be added; pause → confirm |\n\n**Byte-identical check** (the definitive test for Category A):\n\n```bash\ndiff -q \u003Ctemplate-file> \u003Ctarget-file>\n# exit 0 → identical (Category A)\n# exit 1 → differs (Category B)\n```\n\nBuild three lists — `AUTO_DELETE` (A + D), `NEEDS_CONFIRMATION` (B + C), and\n`CONFIG_MERGE` (a full legacy `src\u002Fconfig\u002Fsettings.ts`, routed to Step 4) —\nbefore taking any action.\n\n## Step 3 — Delete Category A + D files\n\n> **This is the flipped default from v1 of this skill.** The v1 (preset-first,\n> #2356-era) migration defaulted an edited\u002Fambiguous file to **eject**\n> (`zudo-doc eject \u003Ccomponent>`) because the old template's host stubs\n> (`pages\u002Flib\u002F_header-with-defaults.tsx`, `src\u002Fcomponents\u002F*.tsx`, …) were\n> genuinely swappable for an ejected package copy at the SAME layer. In the\n> minimal-scaffold shape those host stubs don't exist as a concept anymore —\n> the package owns chrome\u002Froutes\u002Fislands outright via `createChrome()` and\n> `packageOwnedRoutes`, and there is **no eject target that corresponds to a\n> deleted host wiring file** (the `EJECTABLE` map below is for\n> PRESENTATIONAL components — header, footer, toc, individual islands — a\n> different and still-valid axis of customization). So a Category D file's\n> default action is **DELETE**, not eject.\n\nCategory A (byte-identical to the current template) and Category D\n(deleted-from-template legacy file, unmodified) are both safe to remove\noutright:\n\n```bash\nfor f in \"${AUTO_DELETE[@]}\"; do\n  rm \"$f\"\n  git rm \"$f\"          # stage the removal\ndone\n```\n\nReport each deleted path so the user has a clear audit trail, grouped by\nfamily (pages\u002Flib\u002F*, src\u002Fcomponents\u002F*, src\u002Futils\u002F*, src\u002Ftypes\u002F*,\nsrc\u002Fconfig\u002F*, standalone files) so the report reads like the Wave 6\ncompletion comment's delete-list rather than a flat file dump.\n\n> **Do NOT auto-delete `\"use client\"` island components** even if they are\n> byte-identical to a deleted-from-template stub. Islands that are\n> byte-identical to the old template may still be relied upon for hydration\n> wiring the package's `createChrome()` doesn't yet auto-default (check\n> `routes\u002F_chrome.tsx`'s header comment for which islands ARE\n> auto-defaulted — currently `DesignTokenPanelBootstrap`; `DocHistory` is\n> NOT, and needs the `chromeBindingsModule` seam). Move every island\n> component to `NEEDS_CONFIRMATION` regardless of diff result — the\n> hydration smoke gate in Step 6 is mandatory before their removal can be\n> declared safe.\n\n> **Do NOT delete `src\u002Fconfig\u002Fsettings.ts` here even if it looks legacy.**\n> Route it to Step 4 (config-merge) instead — deleting it before merging its\n> fields into `zfb.config.ts` silently reverts every non-default setting to\n> the package default.\n\n## Step 4 — Config-merge: `settings.ts` → `zfb.config.ts`'s `zudoDoc({...})`\n\nSkip this step if Step 0 detected the project is already on the minimal\nshape. Otherwise, the target project's real configuration currently lives in\n`src\u002Fconfig\u002Fsettings.ts` (a plain object) and is either spread into an\ninline `zudoDocPreset({...})` call or hand-wired field-by-field into\n`defineConfig({...})`. Migrate it to the single-entry `zudoDoc()` API\n(`@takazudo\u002Fzudo-doc\u002Fconfig`).\n\n### 4a. Simple path (recommended default) — keep `settings.ts`, wrap it\n\nThis is the SAME pattern this repo's own showcase uses (see the root\n`zfb.config.ts` and `src\u002Fconfig\u002Fsettings.ts`) — the lowest-risk migration,\nsince it changes zero field values, only the wiring:\n\n```ts\n\u002F\u002F zfb.config.ts\nimport { defineConfig } from \"zfb\u002Fconfig\";\nimport { zudoDoc } from \"@takazudo\u002Fzudo-doc\u002Fconfig\";\nimport { settings } from \".\u002Fsrc\u002Fconfig\u002Fsettings\";\n\nexport default defineConfig(\n  zudoDoc({\n    ...settings,\n    \u002F\u002F If the project has custom host bindings (search widget, doc-history,\n    \u002F\u002F frontmatter renderers, footer tag loader, MDX component overrides —\n    \u002F\u002F see Step 4c below), thread them here:\n    \u002F\u002F chromeBindingsModule: \".\u002Fsrc\u002Fchrome-bindings\",\n  }),\n);\n```\n\nDelete any now-redundant escape-hatch imports the old config wired manually\n(`buildDocsSchema`, `colorSchemes`, `translations`, `directives`,\n`tagVocabularyEntries`) — pass them as `zudoDoc()` fields instead if the\nproject overrides any of them (see `packages\u002Fzudo-doc\u002Fsrc\u002Fconfig.ts`'s\n`ZudoDocConfig` for the full field list and each field's `@default`).\n\n**Retired Tauri \u002F find-in-page pieces (#4758).** Drop a `findInPage` field\nfrom the merged config and any direct `@takazudo\u002Fzudo-doc\u002Ffind-in-page`\nimport — both are removed from the package. `src-tauri\u002F`, `src-tauri-dev\u002F`,\nand `dev:tauri*` \u002F `build:tauri*` scripts are user-owned app files: list them\nunder `NEEDS_CONFIRMATION` and delete only after the human confirms. Never\ntouch installed apps or per-user app data. The user guide is\n`src\u002Fcontent\u002Fdocs\u002Fguides\u002Ftauri-modes.mdx`.\n\n### 4b. Deeper cleanup (optional) — inline as diff-from-defaults literals\n\nA fresh `create-zudo-doc` scaffold emits ONLY the fields that differ from\n`ZudoDocConfig`'s documented defaults, directly as `zudoDoc({...})` literals\n— no `settings.ts` file at all. A project that wants to fully match that\nshape can flatten `settings.ts`'s fields into `zfb.config.ts` and delete the\nfile, but this is optional cosmetic cleanup, not required for the migration\nto succeed — do it only if the user asks for it, since it's a larger diff\nwith no functional benefit over 4a.\n\n### 4c. Custom host bindings (only if the project has any)\n\nIf the OLD project had real host-bound behavior (a search widget, doc\nhistory with real git data, custom frontmatter-preview renderers, a footer\ntag loader, custom MDX component overrides) wired through its own\n`pages\u002Flib\u002F_chrome.ts`-style module, that behavior needs a\n`chromeBindingsModule` — a project-root-relative module exporting\n`chromeBindings: ChromeHostBindings`. Use this repo's own\n`src\u002Fchrome-bindings.tsx` as the reference shape (it implements every\n`ChromeHostBindings` slot the showcase needs) and\n`packages\u002Fzudo-doc\u002Fdocs\u002Fadr\u002Froute-injection-seam.md`'s \"Host-callables\nchannel — chromeBindingsModule\" section for the contract. If the project has\nNO custom host bindings, skip this — the package's own stubs (empty\nsearch results, no-op DocHistory, etc.) cover a plain scaffold fine.\n\n## Step 5 — tsconfig swap to the extends form\n\nReplace the target project's hand-rolled `tsconfig.json` with the extends\nform (see `packages\u002Fzudo-doc\u002FCLAUDE.md`'s \"Shipped ambient type shims + tsconfig\nbase\" section for the full contract):\n\n```jsonc\n{\n  \"extends\": \"@takazudo\u002Fzudo-doc\u002Ftsconfig.base.json\",\n  \"include\": [\"src\", \"pages\", \"zfb.config.ts\"],\n  \"compilerOptions\": {\n    \u002F\u002F No baseUrl (TypeScript 7 rejects it with TS5102 — #4558): an explicitly\n    \u002F\u002F relative target resolves against THIS file's directory. See\n    \u002F\u002F packages\u002Fzudo-doc\u002FCLAUDE.md \"Owned JSX and project-local aliases\".\n    \"paths\": {\n      \"@\u002F*\": [\".\u002Fsrc\u002F*\"]\n    }\n  }\n}\n```\n\n**Two traps, both load-bearing:**\n\n- Do NOT declare a top-level `files` field in the project tsconfig — `files`\n  is override-only across `extends`, and the base's `files` (which pulls in\n  the two ambient shims, `zfb-config-shim.d.ts` + `virtual-modules.d.ts`) would\n  be silently dropped, surfacing later as confusing `TS2307` errors on\n  `zfb\u002Fconfig` \u002F `virtual:*` imports.\n- Delete the project's own `zfb-shim.d.ts` if it still has one — the ambient\n  `zfb\u002Fconfig` types now ship from `@takazudo\u002Fzudo-doc\u002Fzfb-config-shim.d.ts`,\n  pulled in transitively via the base's `files`.\n\nAfter swapping, run `pnpm check` and fix any newly-surfaced type errors\nbefore continuing — this step commonly surfaces stale imports Step 3 missed.\n\n## Step 6 — Hydration smoke gate (mandatory for every island-touching change)\n\n> **Critical invariant (per `l-lessons-zfb-migration-parity`):** a dead island\n> server-renders silently. The zfb build exits 0 and emits valid HTML even when an island\n> component loses its `\"use client\"` directive or its registration is broken. Byte-identical\n> deletion is insufficient proof that islands still hydrate. This gate is\n> **not optional** — skip it only when `--skip-hydration-check` was explicitly passed.\n\nAfter completing Steps 3–5, run the hydration smoke check:\n\n```bash\npnpm build\n```\n\nThen verify island hydration for each component that was deleted or whose\nwiring changed. The minimal check is a grep for the island marker in the built HTML:\n\n```bash\n# Each interactive island emits a data-zfb-island=\"\u003CName>\" marker.\ngrep -roh 'data-zfb-island=\"[^\"]*\"' dist\u002F | sort -u    # distinct island set\ngrep -rl  'data-zfb-island' dist\u002F | wc -l              # total island-bearing pages\n```\n\nCompare the distinct-island set before vs after (capture a baseline with\n`git stash` + build BEFORE Step 3 if you didn't already) — a missing island\nname means a silently dead island. `DocHistory` is the highest-risk case:\nits package-default is a deliberate no-op stub (unlike\n`DesignTokenPanelBootstrap`, which auto-defaults) — if the project had\n`docHistory` enabled and Step 4 didn't wire a `chromeBindingsModule`\nthreading the real `DocHistory` component, the History button silently stops\nhydrating with real data even though the build stays green.\n\nFor any island component touched in Steps 3–5, also verify the component is\nreachable in the dev server and interactive — a static HTML render is not\nthe same as a hydrated island. Use `pnpm dev` + a quick manual check, or\ninvoke `\u002Fverify-ui` for a computed-style smoke:\n\n```bash\npnpm dev &\n# Then check the component interacts as expected.\n```\n\n**If any island fails the hydration check:**\n\n1. Stop immediately — do not proceed to Step 7.\n2. Report which component is dead (compare the distinct-island set: `grep -roh 'data-zfb-island=\"[^\"]*\"' dist\u002F | sort -u`).\n3. Offer to restore the file from git (`git checkout -- \u003Cpath>`) or wire a `chromeBindingsModule` (Step 4c).\n\n## Step 7 — Verify build and types\n\nAfter all mutations, run a full build + typecheck to confirm nothing is broken:\n\n```bash\npnpm build\npnpm check\n```\n\nFix any TypeScript errors before committing. The most common post-migration errors are:\n\n- Import path still references a deleted host file (`pages\u002Flib\u002F_chrome.ts`,\n  `src\u002Fconfig\u002Fsettings-types.ts`, …) — the minimal shape resolves the\n  equivalent type\u002Fbehavior through `@takazudo\u002Fzudo-doc` subpaths instead.\n- A `\"use client\"` directive is missing on a component still wired through\n  a `chromeBindingsModule` slot.\n- `zfb.config.ts` field errors — cross-check against `ZudoDocConfig` in\n  `packages\u002Fzudo-doc\u002Fsrc\u002Fconfig.ts` (every field has a `@default` JSDoc).\n\n## Step 8 — Emit summary report\n\nAfter Steps 3–7 complete (or at any early stop), print a structured summary:\n\n```\n## Migration Summary\n\n### Starting shape (Step 0)\nLegacy flat-config \u002F Preset-style \u002F Already minimal\n\n### Deleted — Category A (byte-identical to current template)\n- \u003Cpath>\n- ...\n\n### Deleted — Category D (deleted-from-template legacy file, no eject target)\n- pages\u002Flib\u002F_header-with-defaults.tsx\n- src\u002Fcomponents\u002Ftheme-toggle.tsx\n- ...\n\n### Kept as-is \u002F ejected (user chose to retain ownership of an edited file)\n- src\u002Fcomponents\u002Fcustom-header.tsx (kept)\n- theme-toggle → src\u002Fcomponents\u002Fzudo-doc\u002Ftheme-toggle\u002F (ejected)\n- ...\n\n### Config merge (Step 4)\n- src\u002Fconfig\u002Fsettings.ts → spread into zfb.config.ts's zudoDoc({...}) (4a)\n- chromeBindingsModule wired: src\u002Fchrome-bindings.tsx (4c) \u002F not needed\n\n### tsconfig swap (Step 5): DONE \u002F SKIPPED (already extends form)\n\n### Skipped (deferred for later)\n- src\u002Fcomponents\u002Fbar.tsx\n- ...\n\n### Hydration smoke: PASS \u002F FAIL\n\u003Clist any failed islands>\n\n### Build: PASS \u002F FAIL\n### Typecheck: PASS \u002F FAIL\n\n### Next steps\n\u003Clist any remaining manual steps>\n```\n\n## Human-gated loop for edited \u002F ambiguous files (Category B + C)\n\nFor **each** file in `NEEDS_CONFIRMATION`, pause and present the following prompt to the\nuser:\n\n```\nFile: \u003Crelative-path>\nCategory: B (edited) \u002F C (missing in prod)\nDiff summary:\n\u003Cshow diff --stat or a short unified diff — keep it readable>\n\nAction?\n  [D] delete — this file's family has no eject target (Category D-adjacent); safe once confirmed\n  [E] eject  — copy local source into project via `zudo-doc eject \u003Ccomponent>` (only if it maps to an EJECTABLE entry, see below)\n  [K] keep   — keep the file as-is (project retains ownership, no package import)\n  [S] skip   — leave file unchanged for now (handle later)\n\nDefault: [E] eject if the file maps to an EJECTABLE component, else [K] keep\n```\n\nWait for the user's explicit response before proceeding to the next file. Never silently\ndelete or overwrite an edited file.\n\n### Eject handoff\n\nWhen the user chooses **eject** (or accepts the default for an ejectable component), call the C1 eject CLI:\n\n```bash\nzudo-doc eject \u003Ccomponent>\n```\n\nThe CLI (ships from `@takazudo\u002Fzudo-doc`, reachable in generated projects as `node_modules\u002F.bin\u002Fzudo-doc`) performs:\n\n1. Copies the component's TS source from the published `eject\u002F` bundle into\n   `src\u002Fcomponents\u002Fzudo-doc\u002F\u003Ccomponent>\u002F` inside the target project.\n2. Rewrites parent-relative cross-component imports to `@takazudo\u002Fzudo-doc\u002F\u003Cdir>` subpath\n   specifiers so they keep resolving against the installed package.\n3. Records the ejected component in `.zudo-doc.json`\n   (`{ \"ejected\": { \"\u003Ccomponent>\": \"src\u002Fcomponents\u002Fzudo-doc\u002F\u003Ccomponent>\" } }`)\n   — lazily creating the file on first successful eject (it is never seeded\n   by the scaffold itself).\n4. Is **idempotent** — re-running on an already-ejected component prints\n   `\"already ejected at \u003Cpath>\"` and exits 0 without clobbering local edits.\n\n**Ejectable components** (18 presentational\u002Flayout\u002Fisland components — the full allowlist, `packages\u002Fzudo-doc\u002Fsrc\u002Feject\u002Findex.ts`'s `EJECTABLE` map):\n\n| CLI name | Import subpath |\n|---|---|\n| `header` | `@takazudo\u002Fzudo-doc\u002Fheader` |\n| `footer` | `@takazudo\u002Fzudo-doc\u002Ffooter` |\n| `breadcrumb` | `@takazudo\u002Fzudo-doc\u002Fbreadcrumb` |\n| `toc` | `@takazudo\u002Fzudo-doc\u002Ftoc` |\n| `sidebar` | `@takazudo\u002Fzudo-doc\u002Fsidebar` |\n| `theme-toggle` | `@takazudo\u002Fzudo-doc\u002Ftheme-toggle` |\n| `page-loading` | `@takazudo\u002Fzudo-doc\u002Fpage-loading` |\n| `tab-item` | `@takazudo\u002Fzudo-doc\u002Ftab-item` |\n| `doc-pager` | `@takazudo\u002Fzudo-doc\u002Fdoc-pager` |\n| `content-admonition` | `@takazudo\u002Fzudo-doc\u002Fcontent-admonition` |\n| `code-group` | `@takazudo\u002Fzudo-doc\u002Fcode-group` |\n| `details` | `@takazudo\u002Fzudo-doc\u002Fdetails` |\n| `sidebar-tree-island` | `@takazudo\u002Fzudo-doc\u002Fsidebar-tree-island` |\n| `sidebar-toggle-island` | `@takazudo\u002Fzudo-doc\u002Fsidebar-toggle-island` |\n| `desktop-sidebar-toggle-island` | `@takazudo\u002Fzudo-doc\u002Fdesktop-sidebar-toggle-island` |\n| `image-enlarge` | `@takazudo\u002Fzudo-doc\u002Fimage-enlarge` |\n| `doc-history` | `@takazudo\u002Fzudo-doc\u002Fdoc-history` |\n| `site-tree-nav-island` | `@takazudo\u002Fzudo-doc\u002Fsite-tree-nav-island` |\n\nIf the file to be ejected does not map to one of these 18 components, the eject CLI will\nreject it. In that case, and the file is a deleted-from-template legacy wiring stub\n(Category D), route to **delete**; otherwise route to **keep** and advise the\nuser to handle it manually.\n\n## Flags\n\n| Flag | Effect |\n|---|---|\n| `--dry-run` | Run Steps 1–3 classification only; print the plan without mutating any files. |\n| `--skip-hydration-check` | Skip Step 6 (only for non-island migrations or known-safe deletions). Must be explicit — not implied by any other flag. |\n\n## Key files and references\n\n| Path | Role |\n|---|---|\n| `scripts\u002Fcheck-template-drift.sh` | Template-baseline diff mechanism for files the CURRENT template still has an opinion on |\n| `.template-drift-allowlist` | Files excluded from the automated drift check (still need manual review) |\n| `packages\u002Fcreate-zudo-doc\u002Fsrc\u002F__tests__\u002Fscaffold.test.ts` | `NEVER_RESURRECTED` — the authoritative, CI-enforced list of deleted-from-template legacy paths (Step 1b) |\n| `packages\u002Fcreate-zudo-doc\u002Ftemplates\u002Fbase\u002F` | Pristine base template (5 files) |\n| `packages\u002Fcreate-zudo-doc\u002Ftemplates\u002Ffeatures\u002F*\u002Ffiles\u002F` | Pristine feature-specific templates (only `i18n` has one; `claudeSkills`\u002F`claudeSkillsWriting` directories are copied from `scaffold.ts`) |\n| `packages\u002Fzudo-doc\u002Fsrc\u002Fconfig.ts` | `ZudoDocConfig` \u002F `zudoDoc()` — the single-entry config API and field census (Step 4) |\n| `packages\u002Fzudo-doc\u002FCLAUDE.md` | \"Shipped ambient type shims + tsconfig base\" section — the tsconfig extends-form contract and its two traps (Step 5) |\n| `packages\u002Fzudo-doc\u002Fdocs\u002Fadr\u002Froute-injection-seam.md` | \"Host-callables channel — chromeBindingsModule\" ADR (Step 4c) |\n| `src\u002Fchrome-bindings.tsx` | This repo's own reference `ChromeHostBindings` implementation (Step 4c) |\n| `packages\u002Fcreate-zudo-doc\u002Fdocs\u002Feject-contract.md` | Full eject CLI contract (C0 #2359; Decision 5 revised S4 #2373) |\n| `packages\u002Fzudo-doc\u002Fsrc\u002Feject\u002Findex.ts` | `EJECTABLE` map and `eject()` — `zudo-doc` bin ships from `@takazudo\u002Fzudo-doc`, not `create-zudo-doc` |\n| `.zudo-doc.json` | Provenance marker in the target project (records ejected components + version), lazily created |\n| `.claude\u002Fskills\u002Fl-lessons-zfb-migration-parity\u002FSKILL.md` | Lessons on why hydration smoke is mandatory |\n",{"name":5,"description":7,"argument-hint":49,"user-invocable":50},"[--dry-run] [--skip-hydration-check]",true,"main","2b67af76ba78c1da6117a21efb72878fedcdc151",".claude\u002Fskills\u002Fl-migrate-to-preset-style",0,"https:\u002F\u002Fgithub.com\u002Fzudolab\u002Fzudo-doc","https:\u002F\u002Fgithub.com\u002Fzudolab","2026-11-14 11:23:40",{"source":8,"skillName":5,"commands":59,"prompt":69,"zipAvailable":50},[60,63,66],{"tool":61,"command":62},"npx","npx skills add zudolab\u002Fzudo-doc --skill l-migrate-to-preset-style",{"tool":64,"command":65},"bunx","bunx skills add zudolab\u002Fzudo-doc --skill l-migrate-to-preset-style",{"tool":67,"command":68},"pnpm","pnpm dlx skills add zudolab\u002Fzudo-doc --skill l-migrate-to-preset-style","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fzudolab\u002Fzudo-doc\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fl-migrate-to-preset-style\u002FSKILL.md",[],[72,103,131,147,185,196],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":88,"publishedAt":44},"01M6D2GZKKY2E651Q297NEZEGV","zudo-doc-writing","Doc-writing and navigation-structure guide for this zudo-doc project. Consult BEFORE creating pages, adding categories, designing header navigation, or writing\u002Fediting mdx content under src\u002Fcontent\u002F. Covers: reading the AUTHORING.md editorial policy and its four placement questions, when to run a structure review, plan-the-nav-tree-first workflow, tree vs note-tray categories, the recommended 3-level hierarchy (header → sidebar → nested), filesystem navigation as the default, linked versus heading-only category rows, 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'.","https:\u002F\u002Fgithub.com\u002Fzudolab\u002Fzudo-doc\u002Fblob\u002Fmain\u002Fpackages\u002Fcreate-zudo-doc\u002Ftemplates\u002Ffeatures\u002FclaudeSkillsWriting\u002Ffiles\u002F.claude\u002Fskills\u002Fzudo-doc-writing\u002FSKILL.md",[78,83],{"categoryNo":79,"categoryName":80,"taxonomyType":81,"taxonomyTypeDesc":82},"01JBSEEDCAT000000000000018","写作与文案","SCENARIO","使用场景",{"categoryNo":84,"categoryName":85,"taxonomyType":86,"taxonomyTypeDesc":87},"01JBSEEDCAT000000000000036","内容创作者","PROFESSION","适用职业",[89,90,29,43,91,92,93,94,95,39,96,97,98,99,24,100,101,102,33,31],"writing","zudo doc writing","default","design","only","workflow","consult","structure","plan","discipline","categories","review","hierarchy","filesystem navigation",{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":44},"01M6D2GWFZ81SCB168Z4P4NYYN","zudo-doc-version-bump","Bump package version, update changelog and versioned docs snapshot (if those features are enabled), commit, tag, and create a GitHub release. Use when: (1) User says 'version bump', 'bump version', 'release', or 'zudo-doc-version-bump', (2) User wants to create a new release of this project.","https:\u002F\u002Fgithub.com\u002Fzudolab\u002Fzudo-doc\u002Fblob\u002Fmain\u002Fpackages\u002Fcreate-zudo-doc\u002Ftemplates\u002Ffeatures\u002FclaudeSkills\u002Ffiles\u002F.claude\u002Fskills\u002Fzudo-doc-version-bump\u002FSKILL.md",[],[110,111,112,113,29,43,114,115,116,117,118,39,119,120,121,122,123,124,125,126,127,128,24,129,130],"bump","zudo doc version bump","version","version bump","update changelog","package","use","patch","commit","changelog","github","update","release","snapshot","bump version","docs","user","proposal","new","features","github release",{"skillNo":132,"name":133,"nameZh":6,"description":134,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":135,"categories":136,"keywords":137,"publishedAt":44},"01M6D2GRJ1MKMMEACKDFSAKF20","zudo-doc-translate","Translate zudo-doc documentation between the locales configured in this project, with Japanese conventions applied only to the `ja` locale.","https:\u002F\u002Fgithub.com\u002Fzudolab\u002Fzudo-doc\u002Fblob\u002Fmain\u002Fpackages\u002Fcreate-zudo-doc\u002Ftemplates\u002Ffeatures\u002FclaudeSkills\u002Ffiles\u002F.claude\u002Fskills\u002Fzudo-doc-translate\u002FSKILL.md",[],[138,139,29,140,141,142,43,93,143,125,144,145,146],"translate","zudo doc translate","documentation","i18n","japanese","conventions","translate docs","with","locale",{"skillNo":148,"name":149,"nameZh":6,"description":150,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":151,"categories":152,"keywords":162,"publishedAt":44},"01M6D2GMXQGVKJZTA35Q9AZN7V","zudo-doc-design-system","Project-specific CSS and component rules for zudo-doc. Must be consulted before writing or editing CSS, zudo-wind utilities, color tokens, or component markup in this project. Covers: component-first strategy, design token system, three-tier color architecture, and palette index convention. Triggered by 'design system', 'zudo-doc-design-system', 'zudo-doc-css-wisdom' (old name).","https:\u002F\u002Fgithub.com\u002Fzudolab\u002Fzudo-doc\u002Fblob\u002Fmain\u002Fpackages\u002Fcreate-zudo-doc\u002Ftemplates\u002Ffeatures\u002FclaudeSkills\u002Ffiles\u002F.claude\u002Fskills\u002Fzudo-doc-design-system\u002FSKILL.md",[153,156,159],{"categoryNo":154,"categoryName":155,"taxonomyType":81,"taxonomyTypeDesc":82},"01JBSEEDCAT000000000000009","前端开发",{"categoryNo":157,"categoryName":158,"taxonomyType":81,"taxonomyTypeDesc":82},"01JBSEEDCAT000000000000015","视觉设计",{"categoryNo":160,"categoryName":161,"taxonomyType":86,"taxonomyTypeDesc":87},"01JBSEEDCAT000000000000032","设计师",[163,164,92,29,165,166,167,43,168,169,170,89,171,172,173,174,175,176,177,178,179,180,181,182,183,184],"zudo doc design system","system","design system","css","three","editing","tokens","strategy","wisdom","Rules","architecture","component","first","token","design-system","index","design token","wind","palette","Utilities","color","for",{"skillNo":186,"name":187,"nameZh":6,"description":188,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":189,"categories":190,"keywords":191,"publishedAt":44},"01M6D2GJYJQRZTHVY1CN884E96","localized-shell","Fixture skill for localized generated resource routes.","https:\u002F\u002Fgithub.com\u002Fzudolab\u002Fzudo-doc\u002Fblob\u002Fmain\u002Fe2e\u002Ffixtures\u002Fi18n\u002Fsrc\u002Fcontent\u002Fresources\u002F.claude\u002Fskills\u002Flocalized-shell\u002FSKILL.md",[],[192,193,194,41,195,184],"localized shell","shell","fixture","fixture skill",{"skillNo":197,"name":198,"nameZh":6,"description":199,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":200,"categories":201,"keywords":204,"publishedAt":44},"01M6D2GF8BK70Y7TE3B7NCX87H","zudo-doc-writing-rules","Doc-writing rules for zudo-doc content (mdx files under src\u002Fcontent\u002Fdocs\u002F and src\u002Fcontent\u002Fdocs-ja\u002F). Consult before writing or editing doc content. Covers: no h1 in content, sidebar_position is mandatory, kebab-case file names, bilingual rule, linking conventions, and admonition syntax. Triggered by 'writing rules', 'zudo-doc-writing-rules', 'doc rule', 'mdx rule', 'write a doc', 'create a page'.","https:\u002F\u002Fgithub.com\u002Fzudolab\u002Fzudo-doc\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fzudo-doc-writing-rules\u002FSKILL.md",[202,203],{"categoryNo":79,"categoryName":80,"taxonomyType":81,"taxonomyTypeDesc":82},{"categoryNo":84,"categoryName":85,"taxonomyType":86,"taxonomyTypeDesc":87},[205,29,89,172,90,206,39,207,168,31,208,209,143,42,210,95,184,211,212,213],"zudo doc writing rules","writing rules","page","write","syntax","file","true","case","linking"]