返回 CodeWhale
getting-started.ts
根目录 / web / lib / content / getting-started.ts
1 /**
2 * getting-started.ts — the canonical new-user path for codewhale.net.
3 *
4 * Four steps, in order: install → first offline session → provider connection
5 * → first Fleet workflow. Both the homepage band and the /docs/guide page
6 * render from this module, so the path reads identically everywhere.
7 *
8 * TRUTH CONTRACT:
9 * - Step copy must match documented behavior in docs/GUIDE.md, docs/MODES.md,
10 * docs/PROVIDERS.md, and docs/FLEET.md. The runtime launches without any
11 * API key (constitution-first setup); model replies require a provider —
12 * hosted key or a keyless loopback route. Do not imply otherwise.
13 * - `href` values are locale-relative (no locale prefix); consumers render
14 * `/${locale}${href}` and the tests assert every target route exists.
15 *
16 * EXTENSION PATH FOR NEW LOCALES: add the locale key to each `{ en, zh }`
17 * pair; commands stay locale-agnostic shell.
18 */
19
20 import type { LocalizedText } from "./vocabulary";
21
22 export interface GuideStep {
23 id: "install" | "first-session" | "connect-provider" | "fleet-workflow";
24 title: LocalizedText;
25 body: LocalizedText;
26 /** Locale-agnostic shell commands shown for the step (may be empty). */
27 commands: string[];
28 /** Deeper-reading link; href is locale-relative. */
29 link: { href: string; label: LocalizedText };
30 }
31
32 export const GETTING_STARTED_STEPS: GuideStep[] = [
33 {
34 id: "install",
35 title: { en: "Install Codewhale", zh: "安装 Codewhale" },
36 body: {
37 en: "One npm command installs the dispatcher and terminal runtime. Cargo, archives, Docker, Nix, and China mirrors are documented alternatives — published releases only.",
38 zh: "一条 npm 命令即可安装调度器和终端运行时。Cargo、预编译包、Docker、Nix 和中国镜像是有文档的备选渠道——只提供已发布版本。",
39 },
40 commands: ["npm install -g codewhale", "codewhale doctor"],
41 link: {
42 href: "/install",
43 label: { en: "Full install guide", zh: "完整安装指南" },
44 },
45 },
46 {
47 id: "first-session",
48 title: { en: "Open a first session — no key needed", zh: "打开第一个会话——无需密钥" },
49 body: {
50 en: "Launches without any API key: short constitution-first setup, then the full interface. Explore in Plan mode — always read-only. Model replies need a provider; that's the next step.",
51 zh: "无需任何 API 密钥即可启动:简短的宪法优先设置,然后进入完整界面。在 Plan 模式中探索——始终只读。模型回复需要提供商;这正是下一步。",
52 },
53 commands: ["codewhale"],
54 link: {
55 href: "/docs/vocabulary",
56 label: { en: "Learn the product nouns first", zh: "先了解产品名词" },
57 },
58 },
59 {
60 id: "connect-provider",
61 title: { en: "Connect a provider", zh: "连接提供商" },
62 body: {
63 en: "Pick a supported route — hosted key, gateway, or keyless local runtime (Ollama, vLLM, SGLang). Provider and model stay explicit; reasoning and routing provenance stay separate, and unavailable values stay unavailable.",
64 zh: "任选受支持的路由——托管密钥、网关,或 Ollama、vLLM、SGLang 等免密钥本地运行时。Provider 与模型始终明确;思考档位与路由来源分开记录,暂不可用的值保持暂不可用。",
65 },
66 commands: ["codewhale auth set --provider deepseek"],
67 link: {
68 href: "/models",
69 label: { en: "Providers and models", zh: "提供商与模型" },
70 },
71 },
72 {
73 id: "fleet-workflow",
74 title: { en: "Run a first Fleet workflow", zh: "运行第一个 Fleet Workflow" },
75 body: {
76 en: "For durable workers, ordered phases, or receipts, author a reusable agent-team profile and launch a run. Fleet state lives in the workspace ledger; ordinary single tasks need none of this.",
77 zh: "工作需要持久 worker、有序阶段或收据时,编写可复用的 agent 团队档案并启动运行。Fleet 状态保存在工作区台账中;普通单一任务不需要这些。",
78 },
79 commands: ["codewhale fleet init", "codewhale fleet run tasks.json --max-workers 4"],
80 link: {
81 href: "/docs/fleet",
82 label: { en: "Fleet and Workflow docs", zh: "Fleet 与 Workflow 文档" },
83 },
84 },
85 ];
86
87 /**
88 * Where to go after the path — discovery links rendered at the end of the
89 * /docs/guide page. Hooks are first-class here on purpose: they are the
90 * supported extension point a new user should find without digging.
91 */
92 export const GUIDE_NEXT_LINKS: { href: string; label: LocalizedText; note: LocalizedText }[] = [
93 {
94 href: "/docs/hooks",
95 label: { en: "Hooks", zh: "钩子" },
96 note: {
97 en: "React to lifecycle events — before and after tool calls, on turn end, on session events — with project-local trust rules.",
98 zh: "借助项目级信任规则,响应生命周期事件——工具调用前后、回合结束、会话事件。",
99 },
100 },
101 {
102 href: "/docs/modes",
103 label: { en: "Modes and permission postures", zh: "模式与权限姿态" },
104 note: {
105 en: "Plan / Act / Operate and Ask / Auto-Review / Full Access, exactly as the runtime enforces them.",
106 zh: "Plan / Act / Operate 与 Ask / Auto-Review / Full Access,与运行时实际执行的一致。",
107 },
108 },
109 {
110 href: "/docs",
111 label: { en: "Documentation hub", zh: "文档中心" },
112 note: {
113 en: "Every topic, searchable, each page citing its source document in the repository.",
114 zh: "所有主题均可搜索,每个页面都注明仓库中的源文档。",
115 },
116 },
117 ];
118
118 lines TYPESCRIPT