Skip to content

Commit d283a9e

Browse files
hashpandaclaude
andcommitted
docs(zh): 修复 s20-s34 运行命令缺少 .env 加载,补充 .gitignore
- s20-s34 文档:npx tsx src/cli.tsx → npm run dev(已内置 --env-file=.env) - 终端录制数据 s13-s26:同步更新模拟器中的启动命令 - .gitignore:补充 pnpm-lock.yaml / yarn.lock / bun.lockb Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ba70934 commit d283a9e

30 files changed

Lines changed: 35 additions & 32 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ web/src/data/generated/
1111

1212
# Agent lock files (generated on install)
1313
agents/*/package-lock.json
14+
agents/*/pnpm-lock.yaml
15+
agents/*/yarn.lock
16+
agents/*/bun.lockb
1417

1518
# Build
1619
dist/

docs/zh/s20-basic-streaming.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ function StreamingMessage({ content }: { content: string }) {
140140
## 验证
141141

142142
```bash
143-
cd agents/s20-basic-streaming && npx tsx src/cli.tsx
143+
cd agents/s20-basic-streaming && npm run dev
144144
```
145145

146146
1. 发送 "explain what streaming means" → 文字逐字出现

docs/zh/s21-advanced-streaming.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ function ThinkingMessage({ content, streaming }) {
178178
## 验证
179179

180180
```bash
181-
cd agents/s21-advanced-streaming && npx tsx src/cli.tsx
181+
cd agents/s21-advanced-streaming && npm run dev
182182
```
183183

184184
1. 发送一个复杂问题 → 观察 💭 thinking 实时显示

docs/zh/s22-parallel-tools.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ const toolResults = await executor.executeAll();
177177
## 验证
178178

179179
```bash
180-
cd agents/s22-parallel-tools && npx tsx src/cli.tsx
180+
cd agents/s22-parallel-tools && npm run dev
181181
```
182182

183183
1. 发送 "read package.json and tsconfig.json at the same time" → 观察两个 file_read 并行执行

docs/zh/s23-startup-perf.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,10 @@ export function startPrefetch(cwd: string) {
227227
cd agents/s23-startup-perf
228228

229229
# 快速路径测试
230-
npx tsx src/cli.tsx --version # 应该立即输出版本号
230+
npm run dev -- --version # 应该立即输出版本号
231231

232232
# 性能分析
233-
npx tsx src/cli.tsx --profile # 启动后查看 stderr 的性能报告
233+
npm run dev -- --profile # 启动后查看 stderr 的性能报告
234234
```
235235

236236
## 对照 Claude Code
@@ -269,6 +269,6 @@ cli.tsx (bootstrap)
269269

270270
## 练习
271271

272-
1. 在你的机器上实际测量:`time npx tsx src/cli.tsx --version`,然后对比 `time npx tsx src/cli.tsx`(完整启动)
272+
1. 在你的机器上实际测量:`time npm run dev -- --version`,然后对比 `time npm run dev`(完整启动)
273273
2. 实现 `startDeferredPrefetches()`:在首次渲染 200ms 后执行一些低优先级初始化
274274
3. 添加一个缓存层:把 `detectProjectRoot` 的结果缓存到 `/tmp`,下次启动直接读取

docs/zh/s24-auto-compact.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ private async maybeCompact(onOutput): Promise<void> {
210210
cd agents/s24-auto-compact
211211

212212
# 启动 Agent
213-
npx tsx src/cli.tsx
213+
npm run dev
214214

215215
# 进行多轮对话,观察当 token 数接近阈值时自动压缩的行为
216216
# 压缩状态会通过 compact_status 类型输出显示

docs/zh/s25-multi-compact.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ await this.maybeAutoCompact(onOutput);
179179
cd agents/s25-multi-compact
180180

181181
# 启动 Agent
182-
npx tsx src/cli.tsx
182+
npm run dev
183183

184184
# 多次读取大文件,观察微压缩行为
185185
# 当工具结果数量超过 5 个时,旧的会被替换为占位符

docs/zh/s26-tool-result-budget.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ this.applyBudget(onOutput); // 确保不超预算
175175
cd agents/s26-tool-result-budget
176176

177177
# 启动 Agent
178-
npx tsx src/cli.tsx
178+
npm run dev
179179

180180
# 让 Agent 读取一个大文件
181181
> 读取 node_modules/typescript/lib/typescript.d.ts

docs/zh/s27-todo-write.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export const todoWriteTool = buildTool({
167167

168168
```bash
169169
cd agents/s27-todo-write
170-
npx tsx src/cli.tsx
170+
npm run dev
171171

172172
# Agent 会在处理复杂任务时自动使用 TodoWrite
173173
# 观察任务状态从 pending → in_progress → completed 的流转

docs/zh/s28-subagent-basic.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export const agentTool = buildTool({
129129

130130
```bash
131131
cd agents/s28-subagent-basic
132-
npx tsx src/cli.tsx
132+
npm run dev
133133

134134
> 分析 src/ 目录的代码质量,同时搜索所有 TODO 注释
135135
# Agent 会创建子 Agent 来独立执行子任务

0 commit comments

Comments
 (0)