Guidance for AI agents working in this repo. Also read CONTRIBUTING.md
and, before architectural changes, search ADRs/.
- Run under Node 22 (
nvm usefrom the repo root). - Edit source content in
docs/pages/en/only. - If pages are added, moved, renamed, or deleted, update only the
/ensection ofdocs/sidebar.json. - Run
npm run checkbefore finishing.
Content lives in docs/pages/en/ only. The cn (Chinese) and ko (Korean)
trees are generated from English by the translation pipeline — never
hand-edit cn/ko content. Mirror English exactly (same relative paths under
the Diátaxis structure: explanation/, how-to/, reference/, tutorial/,
resources/).
- Add/edit a page → edit
enonly; updatedocs/sidebar.json(/en/) if pages were added/moved/renamed. The PR'si18n-translateworkflow generates thecn/koversions;i18n-checkblocks the merge if any en page lacks a same-path translation. - Sidebar → edit only the
/ensection ofdocs/sidebar.json. The/cnand/kosections are generated from/en(links re-prefixed, labels translated) — never hand-edit them. Regenerate after editing/en:LLM_API_KEY=… node docs/lib/i18n-sidebar.mjs cn LLM_API_KEY=… node docs/lib/i18n-sidebar.mjs ko
- Internal links are absolute and locale-prefixed (
/en/...in source). The translation pipeline rewrites them to the target locale automatically; never point acn/kopage at/en/.... - Delete a page →
git rmfromenand the same path incn/ko. No orphan translations. - Generate/refresh translations locally (e.g. when CI can't, or for a
freshness pass):
LLM_API_KEY=… node docs/lib/i18n-translate.mjs cn [--stale] [pages…] LLM_API_KEY=… node docs/lib/i18n-translate.mjs ko [--stale] [pages…]
- LLM provider/model are env-swappable (one seam,
docs/lib/llm.mjs).LLM_API_KEY(orOPENROUTER_API_KEY) is required;LLM_BASE_URLdefaults to OpenRouter;TRANSLATE_MODELpicks the translator and an optionalREVIEW_MODELenables a second QA pass;MAX_OUTPUT_TOKENS(default 8000) must fit the chosen model's output cap. Changing provider or model is config, never a code edit. - Verify before finishing:
npm run i18n:check(expect0 missing) andnpm run check.
Full rationale: ADRs/DR002_i18n_Sync_Pipeline.md.
Before editing or adding a page, read STYLEGUIDE.md. It is the
authority on voice, frontmatter (title / description / diataxis), file/folder
rules, callout directives, code blocks, and the Vocs authoring features to use. The
mechanical rules are enforced on every PR by npm run style:check
(docs/lib/verify-style.mjs) — run it before finishing.
Node >=22. npm run docs:dev / docs:build / docs:preview.
Use npm run check for the full local gate. It runs the Node preflight, style
check, i18n parity check, TypeScript check, structured-data check, and docs build.
- Do not hand-edit
docs/pages/cn/ordocs/pages/ko/. - Do not hand-edit localized sidebar sections; edit only
/enindocs/sidebar.json. - Do not treat green
npm run i18n:checkas proof translations are fresh; stale translations are advisory unlessnpm run i18n:check:strictruns. - Search ADRs before changing i18n, SEO, analytics, consent, style enforcement, or Vocs runtime behavior.
- Content:
docs/pages/en/ - Generated translations:
docs/pages/cn/,docs/pages/ko/ - Navigation:
docs/sidebar.json - Runtime customization:
vocs.config.ts,docs/layout.tsx,docs/styles.css - SEO and analytics:
docs/lib/structured-data.ts,docs/lib/analytics.ts - Automation:
docs/lib/*.mjs,.github/workflows/*