Guidance for AI agents (Claude Code, Codex, Cursor, etc.) working in this repository.
ObjectOS — the commercial runtime environment for ObjectStack applications (Cloud & Enterprise editions). This public repository is the product's front door: the marketing + docs site under apps/docs (content in content/docs/), the issue tracker, and the trademark policy. Product source is developed privately and does not live here.
All marketing copy, UI strings, and documentation are authored in English first. Chinese (cn) and any future locales are translations derived from English.
- Always edit the English source first. Never patch a translation without updating the English original — translation passes will overwrite you.
- If a typo or wording change only appears in Chinese, fix English too (it almost certainly has the same issue or will after the next sync).
- New content must be added to English before translations are touched.
- Translations are derived artifacts; treat them like generated code that happens to be checked in.
Type-checks and unit tests verify code correctness, not feature correctness. For any UI change in apps/docs, run the dev server and exercise the change in a browser before reporting done. If a tool can't drive a browser, say so explicitly rather than guessing.
Stack: Next.js 16 App Router + Fumadocs UI 16 + Fumadocs MDX. Many UI affordances (theme toggle, search modal, language switcher, sidebar, link rendering) come from Fumadocs components, not custom code. Check node_modules/fumadocs-ui before assuming something is broken in app code.
| Concern | File |
|---|---|
| Locale list & default | apps/docs/lib/i18n.ts |
| Language display names | apps/docs/app/[lang]/layout.tsx (LANGUAGE_NAMES) |
| Locale detection / URL rewrite | apps/docs/middleware.ts |
| Header + logo | apps/docs/lib/layout.shared.tsx |
| Homepage copy (en + cn) | apps/docs/lib/homepage-i18n.ts |
| Docs MDX content | content/docs/**/*.mdx |
| Sidebar structure / grouping | content/docs/**/meta.json |
- Supported locales:
en(default),cn. - Default locale has no prefix (
/docs/...); other locales are prefixed (/cn/docs/...). This is set byhideLocale: 'default-locale'inlib/i18n.ts. - MDX translations: add a sibling file with
.cn.mdxnext to the English.mdx. Fumadocs auto-falls-back to English when a translation is missing — you can ship translations incrementally without breaking links. - Homepage strings: must exist in both
enandcnobjects inlib/homepage-i18n.ts(they implement theHomepageTranslationsinterface; missing keys are a type error). - Sidebar titles:
meta.jsontitlefields currently render in all locales. If you localize sidebar labels, add per-localemeta.cn.json(Fumadocs convention) — don't translate inside the English file.
Folder meta.json files declare a section's title, page order, and defaultOpen: false to make the group collapsible and collapsed by default. The root content/docs/meta.json references folders by name ("deploy", "build", …), not by the "...deploy" spread + ---Deploy--- separator pattern (the old pattern produced a flat ~50-item sidebar).
When the English source changes:
- Edit the English
.mdx/enobject first; verify it renders. - Update the
.cn.mdx/cnobject to match. - If a
.cn.mdxdoesn't exist yet, that's fine — Fumadocs falls back to English. Create one when you're ready to translate, not as a stub. - Keep
frontmatter(title, description) translated too.
- Don't reintroduce the
---Section---+"...folder"flat sidebar pattern. - Don't set
alt="ObjectOS"on the logo image when the adjacent text already says "ObjectOS" — screen readers read it twice. Usealt=""+aria-hidden. - Don't add Chinese-only strings or files. If it doesn't have an English source, it shouldn't exist yet.
From apps/docs/:
npm run dev— dev server on http://localhost:3001npm run type-check—fumadocs-mdx && next typegen && tsc --noEmitnpm run build— production build