scaffold-exercises
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseScaffold Exercises
搭建练习框架
创建能通过 的 exercise directory structures,然后用 提交。
pnpm ai-hero-cli internal lintgit commit创建能通过检查的练习目录结构,然后用提交。
pnpm ai-hero-cli internal lintgit commitDirectory naming
目录命名规则
- Sections:下的
exercises/(例如XX-section-name/)01-retrieval-skill-building - Exercises:section 下的 (例如
XX.YY-exercise-name/)01.03-retrieval-with-bm25 - Section number = ,exercise number =
XXXX.YY - Names 使用 dash-case(小写、连字符)
- 章节(Sections):目录下的
exercises/(例如XX-section-name/)01-retrieval-skill-building - 练习(Exercises):章节下的(例如
XX.YY-exercise-name/)01.03-retrieval-with-bm25 - 章节编号 = ,练习编号 =
XXXX.YY - 名称采用dash-case格式(小写、连字符分隔)
Exercise variants
练习变体
每个 exercise 至少需要这些 subfolders 中的一个:
- — student workspace,包含 TODOs
problem/ - — reference implementation
solution/ - — conceptual material,不含 TODOs
explainer/
创建 stub 时,除非 plan 指定其他 variant,否则默认使用 。
explainer/每个练习至少需要以下子文件夹中的一个:
- — 学生工作区,包含待完成项(TODOs)
problem/ - — 参考实现方案
solution/ - — 概念性资料,不含待完成项(TODOs)
explainer/
创建stub时,除非计划中指定了其他变体,否则默认使用。
explainer/Required files
必填文件
每个 subfolder(、、)都需要一个 ,要求:
problem/solution/explainer/readme.md- 非空(必须有真实内容,即使只有一行 title 也可以)
- 没有 broken links
创建 stub 时,生成带 title 和 description 的最小 readme:
md
undefined每个子文件夹(、、)都需要一个文件,要求:
problem/solution/explainer/readme.md- 非空(必须包含真实内容,哪怕只有一行标题也可以)
- 无无效链接(broken links)
创建stub时,生成包含标题和描述的最简readme:
md
undefinedExercise Title
练习标题
Description here
如果 subfolder 有 code,还需要 `main.ts`(>1 行)。但对 stubs 来说,readme-only exercise 可以接受。描述内容
如果子文件夹包含代码,还需要`main.ts`文件(内容超过1行)。但对于stub来说,仅含readme的练习是可接受的。Workflow
工作流程
- Parse the plan — 提取 section names、exercise names 和 variant types
- Create directories — 对每个 path 执行
mkdir -p - Create stub readmes — 每个 variant folder 一个带 title 的
readme.md - Run lint — 执行 验证
pnpm ai-hero-cli internal lint - Fix any errors — 迭代直到 lint 通过
- 解析计划 — 提取章节名称、练习名称和变体类型
- 创建目录 — 对每个路径执行命令
mkdir -p - 创建Stub说明文档 — 为每个变体文件夹生成带标题的
readme.md - 运行检查 — 执行进行验证
pnpm ai-hero-cli internal lint - 修复错误 — 迭代调整直到检查通过
Lint rules summary
Lint规则摘要
linter()检查:
pnpm ai-hero-cli internal lint- 每个 exercise 有 subfolders(、
problem/、solution/)explainer/ - 至少存在 、
problem/或explainer/之一explainer.1/ - primary subfolder 中存在非空
readme.md - 没有 files
.gitkeep - 没有 files
speaker-notes.md - readmes 中没有 broken links
- readmes 中没有 commands
pnpm run exercise - 除非是 readme-only,否则每个 subfolder 都需要
main.ts
检查工具()会验证以下内容:
pnpm ai-hero-cli internal lint- 每个练习都有子文件夹(、
problem/、solution/)explainer/ - 至少存在、
problem/或explainer/中的一个explainer.1/ - 主文件夹中存在非空的
readme.md - 不存在文件
.gitkeep - 不存在文件
speaker-notes.md - 说明文档中无无效链接
- 说明文档中无命令
pnpm run exercise - 除非是仅含readme的练习,否则每个子文件夹都需要文件
main.ts
Moving/renaming exercises
移动/重命名练习
重新编号或移动 exercises 时:
- 使用 (不是
git mv)重命名 directories,保留 git historymv - 更新 numeric prefix 以维持顺序
- 移动后重新运行 lint
Example:
bash
git mv exercises/01-retrieval/01.03-embeddings exercises/01-retrieval/01.04-embeddings重新编号或移动练习时:
- 使用(而非
git mv)重命名目录,保留git历史记录mv - 更新数字前缀以维持顺序
- 移动后重新运行检查
示例:
bash
git mv exercises/01-retrieval/01.03-embeddings exercises/01-retrieval/01.04-embeddingsExample: stubbing from a plan
示例:根据计划创建Stub
给定这样的 plan:
Section 05: Memory Skill Building
- 05.01 Introduction to Memory
- 05.02 Short-term Memory (explainer + problem + solution)
- 05.03 Long-term Memory创建:
bash
mkdir -p exercises/05-memory-skill-building/05.01-introduction-to-memory/explainer
mkdir -p exercises/05-memory-skill-building/05.02-short-term-memory/{explainer,problem,solution}
mkdir -p exercises/05-memory-skill-building/05.03-long-term-memory/explainer然后创建 readme stubs:
exercises/05-memory-skill-building/05.01-introduction-to-memory/explainer/readme.md -> "# Introduction to Memory"
exercises/05-memory-skill-building/05.02-short-term-memory/explainer/readme.md -> "# Short-term Memory"
exercises/05-memory-skill-building/05.02-short-term-memory/problem/readme.md -> "# Short-term Memory"
exercises/05-memory-skill-building/05.02-short-term-memory/solution/readme.md -> "# Short-term Memory"
exercises/05-memory-skill-building/05.03-long-term-memory/explainer/readme.md -> "# Long-term Memory"给定如下计划:
Section 05: Memory Skill Building
- 05.01 Introduction to Memory
- 05.02 Short-term Memory (explainer + problem + solution)
- 05.03 Long-term Memory创建目录:
bash
mkdir -p exercises/05-memory-skill-building/05.01-introduction-to-memory/explainer
mkdir -p exercises/05-memory-skill-building/05.02-short-term-memory/{explainer,problem,solution}
mkdir -p exercises/05-memory-skill-building/05.03-long-term-memory/explainer然后创建Stub说明文档:
exercises/05-memory-skill-building/05.01-introduction-to-memory/explainer/readme.md -> "# Introduction to Memory"
exercises/05-memory-skill-building/05.02-short-term-memory/explainer/readme.md -> "# Short-term Memory"
exercises/05-memory-skill-building/05.02-short-term-memory/problem/readme.md -> "# Short-term Memory"
exercises/05-memory-skill-building/05.02-short-term-memory/solution/readme.md -> "# Short-term Memory"
exercises/05-memory-skill-building/05.03-long-term-memory/explainer/readme.md -> "# Long-term Memory"