tsl-devkit/tests
csh b52102b7bd Squashed 'docs/standards/playbook/' changes from b529012..a854534
a854534  feat(plan_progress): auto-detect env for blocked plans
0d9a8ec 🐛 fix(playbook): honor no_backup for sync
2d401fa  test(templates): update prompts validation
e23474e 📝 docs(playbook): update prompts and sync notes
60ff3cd 🐛 fix(playbook): sync templates per file
816f036  test(playbook): add sync and vendor coverage
625cabb 📝 docs(memory_bank): reformat templates
2554c87 📝 docs(prompts): refresh prompt templates
6774a9d  feat(plan_progress): track plan status in progress.md
73d5c26 🔧 chore(playbook): split sync_templates into sections
278750e  feat(playbook): add plan progress tracking and rules updates
6efd637 🐛 fix(sync): keep agents block blank lines
ea00d43 🐛 fix(playbook): support toml without tomllib
ab0dd11 📝 docs(playbook): drop docs/plans snapshots
398696c  feat(playbook): merge unified cli
d959f80 🎨 style(docs): format markdown
b4f712a 🗑️ remove(legacy): drop old scripts and tests
0c4cd0e  feat(actions): add install_skills and format_md
3d1582c  feat(sync): add templates and standards actions
49bbfa1  feat(vendor): add playbook snapshot generation
8cfcc25  feat(cli): parse toml config and dispatch actions
05903c3  feat(cli): add toml config and dispatch order
65d216e  test(cli): add basic playbook cli tests
f0bcf54 📝 docs(plans): add unified playbook cli plan
0885309 📝 docs(plans): add unified playbook cli design
3483d8a 🔧 chore(git): ignore .worktrees dir
eb75036 🔧 chore(templates): align agent templates and docs
efb93f1 📝 docs(playbook): drop todo/confirm mentions
4a85306 🗑️ remove(workflow): drop todo/confirm artifacts
9c5ee9f 🎨 style(markdown): format docs with prettier
5a2925f 🐛 fix(scripts): repair windows script parsing
26a35e0  test(ci): update required skills list
8df3883 🐛 fix(test): skip external root doc links
b067fc1 📦 deps(skills): sync superpowers
c03cda0 🔧 chore(ci): sync from origin main
55e05cb 🔧 chore(ci): use superpowers sync script
73c97f3 🔧 chore(ci): centralize superpowers sync
945704f 🔧 chore(ci): add superpowers sync workflow
e5d2c93 🗑️ remove(skills): drop duplicate workflows
3ae9708 🐛 fix(ci): update tests for flag-only scripts
c44b9aa 🔧 chore(scripts): require flag-driven args
e4e1d14 🔧 chore(scripts): unify single-dash options
b2eb475  test(templates): add template coverage
fc230b7 🎨 style(markdown): format markdown files
8dc8924 🔧 chore(markdown): add prettier config and usage
2045dd4  feat(vendor_playbook): add apply-templates option
872d8cf  feat(templates): add sync templates scaffolding
5b1ca45 📝 docs(skills): clarify todo-plan template
054967a  feat(skills): add todo-plan skill
cc340f1 🔧 chore(ci): align standards-check workflow template
e9de0aa 🔧 chore(ci): drop removed skill check
e5dd7d9 🔧 fix(sync): avoid backtick expansion
087b0b9 🔧 chore(sync): align agents block across ps1/bat
9481510 🔧 chore(sync): scope agents block to existing langs
b0ca842 🔧 fix(sync): rewrite docs path in agents
c98d65c 🔧 chore(sync): rewrite agents docs paths
c33611c 🗑️ remove(skills): drop unused skills and update references
2b37860 🎨 style(markdown): format markdown files
e3ecd26 📝 docs(tsl): align syntax annotations and examples
37546fe 🐛 fix(playbook): enforce rulesets to agents flow
f2df89d 🐛 fix(scripts): include language list in AGENTS.md
c0d0737 🐛 fix(playbook): add agents mirror for sync
3b8b99b 🎨 style(markdown): normalize md headings and lists
31f3000 ♻️ refactor(playbook): rename agents template directory to rulesets
11b2bed  feat(markdown): add ruleset and sync support
5b89580  test(scripts): quiet git init warnings
5822a87 ♻️ refactor(playbook): streamline agents and refresh tsl docs

git-subtree-dir: docs/standards/playbook
git-subtree-split: a85453439f65b0c0aa05a5bbece773a02216ce76
2026-02-02 10:51:38 +08:00
..
cli Squashed 'docs/standards/playbook/' changes from b529012..a854534 2026-02-02 10:51:38 +08:00
integration Squashed 'docs/standards/playbook/' changes from b529012..a854534 2026-02-02 10:51:38 +08:00
templates Squashed 'docs/standards/playbook/' changes from b529012..a854534 2026-02-02 10:51:38 +08:00
README.md Squashed 'docs/standards/playbook/' changes from b529012..a854534 2026-02-02 10:51:38 +08:00
test_format_md_action.py Squashed 'docs/standards/playbook/' changes from b529012..a854534 2026-02-02 10:51:38 +08:00
test_gitattributes_modes.py Squashed 'docs/standards/playbook/' changes from b529012..a854534 2026-02-02 10:51:38 +08:00
test_no_backup_flags.py Squashed 'docs/standards/playbook/' changes from b529012..a854534 2026-02-02 10:51:38 +08:00
test_plan_progress_cli.py Squashed 'docs/standards/playbook/' changes from b529012..a854534 2026-02-02 10:51:38 +08:00
test_superpowers_list_sync.py Squashed 'docs/standards/playbook/' changes from b529012..a854534 2026-02-02 10:51:38 +08:00
test_sync_directory_actions.py Squashed 'docs/standards/playbook/' changes from b529012..a854534 2026-02-02 10:51:38 +08:00
test_sync_templates_placeholders.py Squashed 'docs/standards/playbook/' changes from b529012..a854534 2026-02-02 10:51:38 +08:00
test_toml_edge_cases.py Squashed 'docs/standards/playbook/' changes from b529012..a854534 2026-02-02 10:51:38 +08:00
test_vendor_snapshot_templates.py Squashed 'docs/standards/playbook/' changes from b529012..a854534 2026-02-02 10:51:38 +08:00

README.md

🧪 Playbook 测试套件

本目录包含 Playbook 项目的测试,用于验证 CLI、模板与文档链接。

📋 目录结构

tests/
├── README.md                       # 本文件:测试文档
├── cli/                            # Python CLI 测试unittest
│   └── test_playbook_cli.py        # playbook.py 基础功能测试
├── test_format_md_action.py        # format_md 动作测试
├── test_gitattributes_modes.py     # gitattr_mode 行为测试
├── test_sync_directory_actions.py  # sync_memory_bank/sync_prompts 行为测试
├── test_vendor_snapshot_templates.py # vendor 快照模板完整性测试
├── test_plan_progress_cli.py       # plan_progress CLI 测试
├── test_superpowers_list_sync.py   # superpowers 列表一致性测试
├── test_sync_templates_placeholders.py # 占位符替换测试sync_rules/sync_standards
├── test_toml_edge_cases.py         # TOML 解析边界测试
├── templates/                      # 模板验证测试
│   ├── validate_python_templates.sh    # Python 模板验证
│   ├── validate_cpp_templates.sh       # C++ 模板验证
│   ├── validate_ci_templates.sh        # CI 模板验证
│   └── validate_project_templates.sh   # 项目模板验证
└── integration/                    # 集成测试
    └── check_doc_links.sh          # 文档链接有效性检查

🚀 快速开始

# 进入 playbook 根目录
cd /path/to/playbook

# 1. 运行 Python CLI 测试
python -m unittest discover -s tests/cli -v

# 1.1 运行其他 Python 测试tests/ 下的 test_*.py
python -m unittest discover -s tests -p "test_*.py" -v

# 2. 运行模板验证测试
sh tests/templates/validate_python_templates.sh
sh tests/templates/validate_cpp_templates.sh
sh tests/templates/validate_ci_templates.sh
sh tests/templates/validate_project_templates.sh

# 3. 运行文档链接检查
sh tests/integration/check_doc_links.sh

🧭 CI 自动化测试

测试套件通过 Gitea Actions 自动运行(见 .gitea/workflows/test.yml

  • 触发时机
    • 推送到 main 分支
    • Pull Request 到 main 分支
    • 手动触发workflow_dispatch
  • 运行平台ubuntu-22.04

📚 测试详解

1. Python CLI 测试 (cli/)

使用 unittest 运行,覆盖 scripts/playbook.py 的核心行为:

  • CLI 参数解析与帮助信息
  • TOML 配置解析与动作顺序
  • vendor/sync_rules/sync_memory_bank/sync_prompts/sync_standards 等基础动作落地

2. 模板验证测试 (templates/)

通过脚本检查各类模板文件结构与关键字段(如占位符、关键配置项)。

3. 文档链接检查 (integration/)

扫描 docs/ 与模板文件中的本地链接,确保引用路径有效。