feat(web): render docs from repo-root docs/ as MDX SoT at build time

Replace the bespoke 16-section /docs page that pulled prose from
`messages/{locale}.json` with a build-time MDX renderer that reads the
canonical markdown in repo-root `docs/`. Each markdown file becomes
one section of the docs page, scrolled-to via the existing DocsShell
sidebar. Section data structure stays in `lib/docs-sections.ts` so the
sidebar / scroll-spy keeps working with no client changes.

Why this layout:

- One source of truth: `docs/guide/*.md`, `docs/reference/*.md`,
  `docs/manifesto.md`. Edits land in one place; the website redeploys
  pick them up automatically via the existing web-deploy workflow.
- Build-time only: `MDXRemote` is rendered inside an RSC and the page
  is statically generated (`●` SSG). Cloudflare Workers serves the
  rendered HTML; no MDX compiler runs at request time.
- next-intl unchanged for everything else: only the docs prose moves
  out. `mobileHeader` and `searchPlaceholder` strings stay in
  `messages/{locale}.json`; the 18 stale section keys are removed.

Files:

- web/lib/docs-sections.ts: 9 sections matching docs/ files, typed
  `DocSection` with `{ id, title, file }`.
- web/lib/docs-source.ts: `loadDocSource(file)` reads
  `<repo-root>/docs/<file>` at build time via `node:fs/promises`.
- web/components/docs/mdx-components.tsx: shadcn-styled overrides for
  every markdown element (h1-h4, p, a, ul/ol/li, blockquote, code, pre,
  table, hr, strong) so the rendered output matches the rest of the
  site.
- web/app/[locale]/docs/page.tsx: rewritten as an async RSC that loads
  every section's source in parallel and renders one MDXRemote per
  section inside DocsShell.
- web/messages/{en,ja,ko,zh}.json: `docs` key trimmed from 20 entries
  to 2 (mobileHeader, searchPlaceholder).
- web/package.json: + next-mdx-remote, + gray-matter.

Local verification: `bun run format:check`, `bun run lint`,
`bun run type-check`, `bun run build`, `bunx opennextjs-cloudflare
build` all pass; `/[locale]/docs` builds as static for all 4 locales
at 4.12 kB / 132 kB First Load.
This commit is contained in:
YeonGyu-Kim
2026-05-08 16:14:55 +09:00
parent 810e3c7a51
commit e5369f3a63
10 changed files with 441 additions and 1238 deletions
+1 -172
View File
@@ -247,178 +247,7 @@
},
"docs": {
"mobileHeader": "Oh My OpenAgent Docs",
"searchPlaceholder": "Search docs...",
"sections": {
"overview": "Overview",
"quickStart": "Quick Start",
"configLocations": "Config File Locations",
"agents": "Agents",
"categories": "Categories",
"skills": "Skills",
"backgroundTasks": "Background Tasks",
"hooks": "Hooks",
"mcps": "MCPs",
"browserAutomation": "Browser Automation",
"tmux": "Tmux Integration",
"gitMaster": "Git Master",
"commentChecker": "Comment Checker",
"experimental": "Experimental Features",
"lsp": "LSP Configuration",
"envVars": "Environment Variables"
},
"overview": {
"title": "Configuration Reference",
"description": "Oh My OpenAgent is highly opinionated but adjustable to taste. Most users don't need to configure anything — run {command} and go."
},
"quickStart": {
"title": "Quick Start"
},
"configLocations": {
"title": "Config File Locations",
"projectLevel": "(Project level)",
"userLevel": "(User level)",
"jsonc": "JSONC is supported, allowing comments and trailing commas."
},
"agentsSection": {
"title": "Agents",
"description": "Configure specific behaviors for the built-in agents: Sisyphus, Hephaestus, Oracle, Librarian, Explore, Multimodal Looker, Prometheus, Metis, Momus, Atlas, and Sisyphus Junior.",
"overrideOptions": "Override Options",
"permissions": "Permissions",
"options": {
"model": "Model identifier (e.g., openai/gpt-4o)",
"variant": "Model variant (max, high, medium, low)",
"category": "Inherit configuration from a category",
"temperature": "Sampling temperature (0-2)",
"topP": "Top-p sampling (0-1)",
"prompt": "Override the system prompt completely",
"promptAppend": "Append text to the system prompt",
"tools": "Enable or disable specific tools",
"disable": "Disable this agent",
"maxTokens": "Maximum tokens for response",
"thinking": "Extended thinking configuration",
"reasoningEffort": "Reasoning effort: low, medium, high, xhigh"
},
"permissionValues": "ask / allow / deny",
"permissionDescriptions": {
"edit": "File editing capabilities",
"bash": "Bash command execution",
"webfetch": "Web request capabilities",
"doomLoop": "Infinite loop override",
"externalDirectory": "Access files outside project"
}
},
"categoriesSection": {
"title": "Categories",
"description": "Categories allow you to define shared configurations that agents can inherit from.",
"availableOptions": "Available options for categories: {options}.",
"categories": {
"visualEngineering": "Frontend, UI/UX, design tasks",
"ultrabrain": "Deep logical reasoning",
"deep": "Autonomous problem-solving, thorough research",
"artistry": "Creative tasks",
"quick": "Trivial, fast tasks",
"unspecifiedLow": "Low effort general tasks",
"unspecifiedHigh": "High effort general tasks",
"writing": "Documentation and prose"
}
},
"skillsSection": {
"title": "Skills",
"description": "Built-in skills include {playwright}, {agentBrowser}, and {gitMaster}. You can also define custom skills."
},
"backgroundTasksSection": {
"title": "Background Tasks",
"priority": "Priority:",
"options": {
"defaultConcurrency": "Default max concurrent tasks",
"staleTimeoutMs": "Timeout for stale tasks in ms",
"providerConcurrency": "Concurrency limit per provider",
"modelConcurrency": "Concurrency limit per model"
}
},
"hooksSection": {
"title": "Hooks",
"description": "Hooks allow you to extend functionality at various lifecycle points."
},
"mcpsSection": {
"title": "MCPs",
"websearch": {
"title": "websearch",
"description": "Powered by Exa for high-quality search results."
},
"context7": {
"title": "context7",
"description": "Documentation retrieval and context management."
},
"grepApp": {
"title": "grep_app",
"description": "GitHub code search integration."
}
},
"browserAutomationSection": {
"title": "Browser Automation",
"playwright": {
"tool": "playwright",
"description": "Full browser automation (default)",
"useCase": "Testing, complex interactions"
},
"agentBrowser": {
"tool": "agent-browser",
"description": "Lightweight browser agent",
"useCase": "Quick lookups, simple scraping"
}
},
"tmuxSection": {
"title": "Tmux Integration",
"options": {
"enabled": "Enable Tmux integration",
"layout": "Tmux window layout",
"mainPaneSize": "Size of the main pane"
}
},
"gitMasterSection": {
"title": "Git Master",
"options": {
"commitFooter": "Text to append to commit messages",
"includeCoAuthoredBy": "Add Co-authored-by trailer"
}
},
"commentCheckerSection": {
"title": "Comment Checker",
"description": "Validates comments in your code. Use the {placeholder} placeholder in your custom prompt."
},
"experimentalSection": {
"title": "Experimental Features",
"options": {
"aggressiveTruncation": "Aggressively truncate outputs",
"autoResume": "Automatically resume interrupted tasks",
"preemptiveCompaction": "Compact context before limits",
"truncateAllToolOutputs": "Truncate all tool outputs"
},
"dynamicPruning": {
"trigger": "dynamic_context_pruning",
"description": "Configure dynamic pruning rules to manage context window usage efficiently."
}
},
"lspSection": {
"title": "LSP Configuration",
"options": {
"command": "LSP server command",
"extensions": "File extensions to match",
"priority": "Server priority",
"env": "Environment variables",
"initialization": "Initialization options",
"disabled": "Disable this LSP"
}
},
"envVarsSection": {
"title": "Environment Variables",
"opencodeConfigDir": {
"name": "OPENCODE_CONFIG_DIR",
"description": "Override the default configuration directory path."
}
},
"footer": "Oh My OpenAgent Documentation © {year}"
"searchPlaceholder": "Search docs..."
},
"manifesto": {
"badge": "Manifesto",