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ドキュメント",
"searchPlaceholder": "ドキュメントを検索...",
"sections": {
"overview": "概要",
"quickStart": "クイックスタート",
"configLocations": "設定ファイルの場所",
"agents": "エージェント",
"categories": "カテゴリ",
"skills": "スキル",
"backgroundTasks": "バックグラウンドタスク",
"hooks": "フック",
"mcps": "MCP",
"browserAutomation": "ブラウザ自動化",
"tmux": "Tmux統合",
"gitMaster": "Git Master",
"commentChecker": "コメントチェッカー",
"experimental": "実験的機能",
"lsp": "LSP設定",
"envVars": "環境変数"
},
"overview": {
"title": "設定リファレンス",
"description": "Oh My OpenAgentは意見を持っていますが、好みに応じて調整可能です。ほとんどのユーザーは何も設定する必要はありません — {command}を実行して始めてください。"
},
"quickStart": {
"title": "クイックスタート"
},
"configLocations": {
"title": "設定ファイルの場所",
"projectLevel": "(プロジェクトレベル)",
"userLevel": "(ユーザーレベル)",
"jsonc": "JSONCがサポートされており、コメントと末尾のカンマを使用できます。"
},
"agentsSection": {
"title": "エージェント",
"description": "Sisyphus、Hephaestus、Oracle、Librarian、Explore、Multimodal Looker、Prometheus、Metis、Momus、Atlas、Sisyphus Juniorなど、組み込みエージェントの動作を設定します。",
"overrideOptions": "オーバーライドオプション",
"permissions": "権限",
"options": {
"model": "モデル識別子(例:openai/gpt-4o",
"variant": "モデルバリアント(max, high, medium, low",
"category": "カテゴリから設定を継承",
"temperature": "サンプリング温度(0-2",
"topP": "Top-pサンプリング(0-1",
"prompt": "システムプロンプトを完全にオーバーライド",
"promptAppend": "システムプロンプトにテキストを追加",
"tools": "特定のツールを有効または無効にする",
"disable": "このエージェントを無効にする",
"maxTokens": "レスポンスの最大トークン数",
"thinking": "拡張思考設定",
"reasoningEffort": "推論努力:low, medium, high, xhigh"
},
"permissionValues": "ask / allow / deny",
"permissionDescriptions": {
"edit": "ファイル編集機能",
"bash": "Bashコマンド実行",
"webfetch": "Webリクエスト機能",
"doomLoop": "無限ループオーバーライド",
"externalDirectory": "プロジェクト外のファイルへのアクセス"
}
},
"categoriesSection": {
"title": "カテゴリ",
"description": "カテゴリを使用すると、エージェントが継承できる共有設定を定義できます。",
"availableOptions": "カテゴリで利用可能なオプション:{options}。",
"categories": {
"visualEngineering": "フロントエンド、UI/UX、デザインタスク",
"ultrabrain": "深い論理的推論",
"deep": "自律的な問題解決と徹底したリサーチ",
"artistry": "クリエイティブタスク",
"quick": "些細で高速なタスク",
"unspecifiedLow": "低労力の一般的タスク",
"unspecifiedHigh": "高労力の一般的タスク",
"writing": "ドキュメントと散文"
}
},
"skillsSection": {
"title": "スキル",
"description": "組み込みスキルには{playwright}、{agentBrowser}、{gitMaster}が含まれます。カスタムスキルを定義することもできます。"
},
"backgroundTasksSection": {
"title": "バックグラウンドタスク",
"priority": "優先度:",
"options": {
"defaultConcurrency": "デフォルトの最大並列タスク数",
"staleTimeoutMs": "古いタスクのタイムアウト(ミリ秒)",
"providerConcurrency": "プロバイダーごとの並列制限",
"modelConcurrency": "モデルごとの並列制限"
}
},
"hooksSection": {
"title": "フック",
"description": "フックを使用すると、さまざまなライフサイクルポイントで機能を拡張できます。"
},
"mcpsSection": {
"title": "MCP",
"websearch": {
"title": "websearch",
"description": "Exa提供の高品質検索結果。"
},
"context7": {
"title": "context7",
"description": "ドキュメント取得とコンテキスト管理。"
},
"grepApp": {
"title": "grep_app",
"description": "GitHubコード検索統合。"
}
},
"browserAutomationSection": {
"title": "ブラウザ自動化",
"playwright": {
"tool": "playwright",
"description": "フルブラウザ自動化(デフォルト)",
"useCase": "テスト、複雑なインタラクション"
},
"agentBrowser": {
"tool": "agent-browser",
"description": "軽量ブラウザエージェント",
"useCase": "クイックルックアップ、簡単なスクレイピング"
}
},
"tmuxSection": {
"title": "Tmux統合",
"options": {
"enabled": "Tmux統合を有効にする",
"layout": "Tmuxウィンドウレイアウト",
"mainPaneSize": "メインペインのサイズ"
}
},
"gitMasterSection": {
"title": "Git Master",
"options": {
"commitFooter": "コミットメッセージに追加するテキスト",
"includeCoAuthoredBy": "Co-authored-byトレーラーを追加"
}
},
"commentCheckerSection": {
"title": "コメントチェッカー",
"description": "コード内のコメントを検証します。カスタムプロンプトには{placeholder}プレースホルダーを使用してください。"
},
"experimentalSection": {
"title": "実験的機能",
"options": {
"aggressiveTruncation": "出力を積極的に切り詰める",
"autoResume": "中断されたタスクを自動的に再開",
"preemptiveCompaction": "制限前にコンテキストを圧縮",
"truncateAllToolOutputs": "すべてのツール出力を切り詰める"
},
"dynamicPruning": {
"trigger": "dynamic_context_pruning",
"description": "コンテキストウィンドウの使用量を効率的に管理するための動的プルーニングルールを設定します。"
}
},
"lspSection": {
"title": "LSP設定",
"options": {
"command": "LSPサーバーコマンド",
"extensions": "一致させるファイル拡張子",
"priority": "サーバーの優先度",
"env": "環境変数",
"initialization": "初期化オプション",
"disabled": "このLSPを無効にする"
}
},
"envVarsSection": {
"title": "環境変数",
"opencodeConfigDir": {
"name": "OPENCODE_CONFIG_DIR",
"description": "デフォルトの設定ディレクトリパスを上書きします。"
}
},
"footer": "Oh My OpenAgentドキュメント © {year}"
"searchPlaceholder": "ドキュメントを検索..."
},
"manifesto": {
"badge": "マニフェスト",