docs: add hands-on Cordis tutorial

Seven-chapter tutorial under docs/cordis-tutorial/ for agent developers
new to Cordis: first plugin, lifecycle/effects, services, events,
config, composition/HMR, and a final chapter registering a tool against
real harness services. Every transcript was produced by running the
chapter files in a gitignored tmp/ scratch directory.

Published to both website locales as mirrored English pages under a new
'Cordis tutorial' develop-sidebar section; a Chinese pair can be added
later without route changes.
This commit is contained in:
Turtle
2026-07-22 16:36:48 +08:00
parent 4267076407
commit 21456a36ca
14 changed files with 852 additions and 1 deletions

View File

@@ -13,6 +13,7 @@ const sectionOrder = [
'基础',
'框架能力',
'实战',
'Cordis 教程',
'概念',
'生成参考',
'Cordis API',
@@ -22,6 +23,7 @@ const sectionOrder = [
'Basics',
'Framework',
'Practice',
'Cordis tutorial',
'Concepts',
'Generated reference',
'Cordis Core API',

View File

@@ -206,6 +206,26 @@ const develop = pairedPages([
},
])
const cordisTutorial = mirroredPages(([
['index.md', 'Cordis 教程', 'Cordis tutorial'],
['01-first-plugin.md', '1. 第一个插件', '1. Your first plugin'],
['02-lifecycle-and-effects.md', '2. 生命周期与副作用', '2. Lifecycle and effects'],
['03-services.md', '3. 服务', '3. Services'],
['04-events.md', '4. 事件', '4. Events'],
['05-config.md', '5. 配置', '5. Configuration'],
['06-composition-and-hmr.md', '6. 组合与热重载', '6. Composition and HMR'],
['07-into-the-harness.md', '7. 进入 Harness', '7. Into the harness'],
] as const).map(([file, rootLabel, enLabel], order): MirroredPage => ({
source: `docs/cordis-tutorial/${file}`,
route: `develop/cordis-tutorial/${file}`,
contentLocale: 'en-US',
label: { root: rootLabel, en: enLabel },
sidebar: { root: 'zh-develop', en: 'en-develop' },
section: { root: 'Cordis 教程', en: 'Cordis tutorial' },
order,
...(file === 'index.md' ? { sourceAliases: ['docs/cordis-tutorial'] } : {}),
})))
const reference = mirroredPages([
...([
['docs/architecture.md', 'reference/index.md', '架构', 'Architecture'],
@@ -301,5 +321,6 @@ const reference = mirroredPages([
export const docsPages: DocsPage[] = [
...homeAndGuide,
...develop,
...cordisTutorial,
...reference,
]