feat: generate task board from task frontmatter

This commit is contained in:
chengma
2026-07-08 10:47:36 +08:00
parent d1d4f458cb
commit 8a7ce0acba
4 changed files with 309 additions and 2 deletions
+6 -2
View File
@@ -3,7 +3,7 @@ id: T-551
title: 脚本从 docs/tasks/ frontmatter 生成任务看板
phase: 8
deps: []
status: TODO
status: DONE
created: 2026-07-08
---
@@ -39,4 +39,8 @@ created: 2026-07-08
## 执行记录
(做完在此记录:改了哪些文件、跑的验证命令与结果、决策)
- 2026-07-08:完成 T-551。
- 代码:新增 `scripts/gen_task_board.py`,用标准库扫描 `docs/tasks/T-*.md`,手写解析 frontmatter;字段缺失、格式错误、非法 status/phase/deps 的任务文件会跳过并通过 stderr 提示,不让脚本崩溃;按 phase 分组输出 `id / title / deps / status`,并计算状态统计和“下一个可领取”。
- 文档产物:运行 `python scripts/gen_task_board.py` 生成 `docs/tasks-board.md`,文件顶部标注由脚本生成、请勿手改;数据源仅包含 `docs/tasks/T-*.md`,不纳入冻结归档 `docs/06-tasks.md`。
- 测试:新增 `tests/test_task_board.py`,用临时任务目录覆盖正常任务、依赖已完成的下一个可领取任务、依赖未完成任务、进行中任务,以及缺字段 frontmatter 被跳过。
- 验证:`py -3.10 -m unittest discover -s tests -p "test_task_board.py"` 通过(1 test);`python scripts/gen_task_board.py` 通过并生成 2 个任务;`python -m ruff check app tests main.py` 通过;`python -m ruff check scripts\gen_task_board.py tests\test_task_board.py` 通过;`py -3.10 -m compileall app main.py` 通过;`py -3.10 -m py_compile scripts/gen_task_board.py` 通过;`git diff --check` 通过;`py -3.10 -m unittest discover -s tests` 通过(254 tests)。