Skip to content

Commit 038fc0a

Browse files
committed
Extract TileLang tutorial into standalone Astro site
0 parents  commit 038fc0a

1,207 files changed

Lines changed: 183111 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Bug report
2+
description: 报告页面、构建或交互问题
3+
title: "[Bug] "
4+
labels: ["bug"]
5+
body:
6+
- type: textarea
7+
id: problem
8+
attributes:
9+
label: 问题描述
10+
description: 发生了什么,预期是什么?
11+
validations:
12+
required: true
13+
- type: input
14+
id: url
15+
attributes:
16+
label: 页面 URL
17+
placeholder: https://tilelang-tutorial.huandu.me/...
18+
- type: textarea
19+
id: reproduce
20+
attributes:
21+
label: 复现步骤
22+
validations:
23+
required: true
24+
- type: input
25+
id: environment
26+
attributes:
27+
label: 浏览器或环境
28+
placeholder: Safari 20 / macOS 16
29+
- type: textarea
30+
id: screenshots
31+
attributes:
32+
label: 截图或日志

‎.github/ISSUE_TEMPLATE/config.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: true
2+
contact_links:
3+
- name: Security report
4+
url: https://github.com/huandu/tilelang-tutorial/blob/main/SECURITY.md
5+
about: 请私下报告安全问题,不要公开敏感细节。
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Content correction
2+
description: 报告技术、引用或文字问题
3+
title: "[Content] "
4+
labels: ["content"]
5+
body:
6+
- type: input
7+
id: chapter
8+
attributes:
9+
label: 章节或页面
10+
placeholder: 第 14 章 / 14-operators-gemm
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: issue
15+
attributes:
16+
label: 问题
17+
description: 指出原文和问题所在。
18+
validations:
19+
required: true
20+
- type: textarea
21+
id: evidence
22+
attributes:
23+
label: 依据
24+
description: 给出源码 tag、文件行号、官方文档或论文链接。
25+
validations:
26+
required: true
27+
- type: textarea
28+
id: proposal
29+
attributes:
30+
label: 建议修改

‎.github/PULL_REQUEST_TEMPLATE.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## 改动
2+
3+
说明改了什么,以及为什么。
4+
5+
## 影响
6+
7+
- [ ] 章节或教程内容
8+
- [ ] 页面、组件或样式
9+
- [ ] 构建、生成器或测试
10+
- [ ] 文档或仓库维护
11+
12+
## 验证
13+
14+
- [ ] `pnpm verify`
15+
- [ ] 移动端布局
16+
- [ ] 浅色 / 深色 / 护眼阅读模式
17+
- [ ] 新增外链可访问
18+
19+
补充验证说明:

‎.github/dependabot.yml‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: /
5+
schedule:
6+
interval: monthly
7+
groups:
8+
npm:
9+
patterns: ["*"]
10+
ignore:
11+
- dependency-name: "*"
12+
update-types: ["version-update:semver-major"]
13+
14+
- package-ecosystem: github-actions
15+
directory: /
16+
schedule:
17+
interval: monthly

‎.github/workflows/ci.yml‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: ci-${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
verify:
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 20
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: pnpm/action-setup@v4
22+
with:
23+
version: 11.24.0
24+
- uses: actions/setup-node@v4
25+
with:
26+
node-version: 24
27+
cache: pnpm
28+
- run: pnpm install --frozen-lockfile
29+
- run: pnpm verify

‎.gitignore‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# build output
2+
dist/
3+
# generated types
4+
.astro/
5+
6+
# dependencies
7+
node_modules/
8+
9+
# vercel
10+
.vercel
11+
12+
# local scratch space for drafts and temporary material
13+
.workspace/
14+
15+
# logs
16+
npm-debug.log*
17+
yarn-debug.log*
18+
yarn-error.log*
19+
pnpm-debug.log*
20+
21+
22+
# environment variables
23+
.env
24+
.env.production
25+
.env.local
26+
# Vercel writes `.env*.local` when a store is connected.
27+
.env*
28+
# The documented template is part of the repository.
29+
!.env.example
30+
31+
# macOS-specific files
32+
.DS_Store
33+
34+
# jetbrains setting folder
35+
.idea/

‎.prettierignore‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# build output
2+
dist/
3+
.astro/
4+
.vercel/
5+
6+
# dependencies
7+
node_modules/
8+
9+
# tutorial source material, kept in its authored form, plus generated output
10+
src/tutorial/content/
11+
src/tutorial/source-figures/
12+
src/tutorial/notes/
13+
src/tutorial/code/
14+
src/tutorial/OUTLINE.md
15+
src/tutorial/README.md
16+
src/tutorial/VERSIONS.md
17+
src/tutorial/source-urls.json
18+
src/data/tutorial/generated/
19+
20+
# lockfiles and generated files
21+
pnpm-lock.yaml
22+
*.min.*
23+
24+
# platform specific
25+
.DS_Store

‎AGENTS.md‎

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# AGENTS.md
2+
3+
本文件适用于整个 `tilelang-tutorial` 仓库。它是 AI 代理和贡献者的操作约定。
4+
5+
## 项目目标
6+
7+
这是一个完全独立的 TileLang 中文教程 Astro 应用,发布在
8+
<https://tilelang-tutorial.huandu.me>。它不得依赖 `ai-thoughts-blog` 的代码、
9+
资源、构建产物或环境变量。
10+
11+
站点完全预渲染。浏览器功能包括阅读进度、习题自评、章节自测和阅读模式,
12+
所有状态只保存在本机 `localStorage`,不得引入账户系统或服务端持久化。
13+
14+
## 技术与命令
15+
16+
- Astro 7,`output: 'static'`,Vercel adapter。
17+
- TypeScript 5.9,继承 `astro/tsconfigs/strictest`。
18+
- Tailwind CSS 4、DaisyUI 5(`winter` / `night`)、typography。
19+
- pnpm 11,Node.js 22.12 或更新版本。
20+
- ESLint flat config、Prettier、Vitest 5。
21+
22+
```bash
23+
pnpm install
24+
pnpm dev
25+
pnpm tutorial:build
26+
pnpm tutorial:check
27+
pnpm check
28+
pnpm lint
29+
pnpm format:check
30+
pnpm test
31+
pnpm build
32+
pnpm verify
33+
```
34+
35+
`pnpm verify` 是提交门禁。修改源内容后先运行 `tutorial:build`,再运行完整门禁。
36+
37+
## 目录边界
38+
39+
```text
40+
src/tutorial/ 手写内容与不可由外部仓库恢复的源数据
41+
src/data/tutorial/generated 生成数据,和源文件一起提交
42+
scripts/tutorial/ 生成器、链接改写、SVG 渲染与校验
43+
src/lib/ 站点元数据、类型和纯函数
44+
src/components/tutorial/ Astro 组件与浏览器脚本
45+
src/pages/ 文件路由;章节位于根路径
46+
src/styles/ Tailwind、图表与阅读模式样式
47+
docs/ 维护文档
48+
tests/ 只测试纯模块与生成数据形状
49+
```
50+
51+
保持以下分工:
52+
53+
- `src/lib/tutorial.ts` 不得导入 Astro。
54+
- `scripts/tutorial/build.mjs` 必须是确定性的;同一输入连续运行两次应产生相同输出。
55+
- 浏览器脚本只能导入 `src/lib/tutorial-reader.ts` 这类纯模块,不得导入 Node
56+
文件系统、服务端配置或生成器。
57+
- `src/tutorial/content/`、`source-figures/`、`code/`、`notes/` 和生成数据
58+
不参与 Prettier/ESLint 源码格式化,但必须通过内容校验和测试。
59+
60+
## 路由
61+
62+
- `/`:教程首页、进度、阅读路径和全部章节。
63+
- `/<chapter-slug>/`:章节正文、习题、自测、代码入口和引用。
64+
- `/notes/`、`/notes/<slug>/`:编者笔记。
65+
- `/references/`、`/versions/`:资料索引和版本锁定。
66+
- `/code/<chapter-slug>/...`:章节代码目录和文件。
67+
68+
不要重新引入 `/tilelang` 前缀。站内链接必须使用根路径。
69+
70+
## 内容约定
71+
72+
- 引号统一为 `“”`,不要使用 `「」` 或 ASCII 双引号。
73+
- 先给判断,再给证据。不要用“这一节是”“接下来是”起句。
74+
- 中文要自然,避免翻译腔、空泛形容词和口号式连接词。
75+
- 中文与拉丁字母、数字之间留空格。
76+
- 破折号和冒号尽量少用。能断成完整句子时就用句号。
77+
- 不使用 emoji。
78+
- 技术结论必须能追溯到锁定版本的源码或公开资料。无法确认的内容明确写“未确认”。
79+
- 区分三类状态:release 已具备、只在 `main`、只在 PR/RFC。
80+
81+
## 图表
82+
83+
- 图只在需要表达关系时使用:并列字段、单源多消费者、时间序列、层级或状态变化。
84+
- 手写图采用 `src/tutorial/figures/<slug>/NN.json` 规格,由
85+
`scripts/tutorial/svg.mjs` 生成响应式内联 SVG。
86+
- 颜色必须来自 DaisyUI 语义 token 或 `tlfig-*` 样式,不得写死十六进制。
87+
- 先为手机设计:纵向堆叠、2×2 网格、短标签优先于长句。
88+
- 每个源图都应有规格;`pnpm tutorial:check` 会检查覆盖、占位符和渲染错误。
89+
90+
## 样式
91+
92+
- 先使用 DaisyUI 组件,再用 Tailwind 处理布局与间距。
93+
- 颜色只使用语义 token:`base-100`、`base-content`、`primary`、`success` 等。
94+
- 不使用 `dark:` 变体或 `slate-*`、`blue-*` 等原始色板。
95+
- `success`、`warning`、`error` 主要用作表面色;状态优先用 badge、alert 或背景。
96+
- 阅读模式通过 `<html>` 上的 `data-reader` 与 `data-reader-theme` 驱动,
97+
只隐藏带 `data-reader-hide` 的导航元素。
98+
99+
## TypeScript 与测试
100+
101+
- 对象形状优先使用 `interface`。
102+
- 开启 `exactOptionalPropertyTypes`;可选的透传属性写成 `prop?: T | undefined`。
103+
- `.ts` 代码遵守 `strict-boolean-expressions`,不要依赖隐式真值判断。
104+
- 修改纯函数时扩展对应测试;修改生成器时更新生成数据形状测试。
105+
- 测试不得访问网络,也不得依赖私有 `.workspace/`。
106+
107+
## 发布
108+
109+
- GitHub:`huandu/tilelang-tutorial`。
110+
- Vercel:`tilelang-tutorial`,生产域名为
111+
`tilelang-tutorial.huandu.me`。
112+
- `main` 的每次推送都通过 CI 并触发生产部署。
113+
- 部署细节见 [docs/deployment.md](./docs/deployment.md)。
114+
115+
## 完成定义
116+
117+
一项改动完成,至少满足:
118+
119+
1. 内容和代码边界符合本文件。
120+
2. 受影响的生成数据已重新生成并提交。
121+
3. `pnpm verify` 通过。
122+
4. 新增外部链接可公开访问,站内链接遵循根路径。
123+
5. 文档、README 或 AGENTS 中的命令与结构同步更新。

‎CHANGELOG.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Changelog
2+
3+
All notable project changes are documented here.
4+
5+
## 1.0.0 - 2026-10-20
6+
7+
- Extracted the TileLang tutorial from `ai-thoughts-blog` into a standalone
8+
Astro application.
9+
- Moved all chapter URLs to the site root.
10+
- Preserved reading mode, local progress, exercises, quizzes and generated SVG
11+
figures.
12+
- Added project documentation, licensing, contribution templates and CI.
13+
- Deployed to `tilelang-tutorial.huandu.me`.

0 commit comments

Comments
 (0)