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
This commit is contained in:
@@ -0,0 +1,147 @@
|
||||
#!/usr/bin/env sh
|
||||
# 项目模板验证脚本
|
||||
|
||||
set -eu
|
||||
|
||||
echo "========================================"
|
||||
echo "🧩 项目模板验证"
|
||||
echo "========================================"
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
PLAYBOOK_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
TEMPLATES_DIR="$PLAYBOOK_ROOT/templates"
|
||||
|
||||
VALIDATION_PASSED=0
|
||||
VALIDATION_FAILED=0
|
||||
ERRORS_FILE="/tmp/project_template_validation_errors.txt"
|
||||
REPORT_FILE="$SCRIPT_DIR/project_templates_report.txt"
|
||||
|
||||
> "$ERRORS_FILE"
|
||||
> "$REPORT_FILE"
|
||||
|
||||
echo "📁 模板目录: $TEMPLATES_DIR"
|
||||
echo ""
|
||||
|
||||
# ============================================
|
||||
# 辅助函数
|
||||
# ============================================
|
||||
|
||||
validate_file_exists() {
|
||||
local file="$1"
|
||||
local description="$2"
|
||||
|
||||
if [ -f "$file" ]; then
|
||||
echo " ✅ $description: $(basename "$file")"
|
||||
VALIDATION_PASSED=$((VALIDATION_PASSED + 1))
|
||||
return 0
|
||||
else
|
||||
echo " ❌ $description: $(basename "$file") - 文件不存在"
|
||||
echo "文件不存在: $file" >> "$ERRORS_FILE"
|
||||
VALIDATION_FAILED=$((VALIDATION_FAILED + 1))
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
validate_contains() {
|
||||
local file="$1"
|
||||
local needle="$2"
|
||||
local description="$3"
|
||||
|
||||
if grep -Fq "$needle" "$file"; then
|
||||
echo " ✓ $description"
|
||||
VALIDATION_PASSED=$((VALIDATION_PASSED + 1))
|
||||
else
|
||||
echo " ✗ $description"
|
||||
echo "缺少内容: $needle in $file" >> "$ERRORS_FILE"
|
||||
VALIDATION_FAILED=$((VALIDATION_FAILED + 1))
|
||||
fi
|
||||
}
|
||||
|
||||
echo "🔍 验证核心模板文件"
|
||||
AGENTS_TEMPLATE="$TEMPLATES_DIR/AGENTS.template.md"
|
||||
AGENT_RULES_TEMPLATE="$TEMPLATES_DIR/AGENT_RULES.template.md"
|
||||
README_TEMPLATE="$TEMPLATES_DIR/README.md"
|
||||
|
||||
if validate_file_exists "$AGENTS_TEMPLATE" "AGENTS.template.md"; then
|
||||
validate_contains "$AGENTS_TEMPLATE" "<!-- playbook:templates:start -->" "包含 templates 标记"
|
||||
validate_contains "$AGENTS_TEMPLATE" "<!-- playbook:framework:start -->" "包含 framework 标记"
|
||||
validate_contains "$AGENTS_TEMPLATE" "{{DATE}}" "包含 {{DATE}} 占位符"
|
||||
fi
|
||||
|
||||
if validate_file_exists "$AGENT_RULES_TEMPLATE" "AGENT_RULES.template.md"; then
|
||||
validate_contains "$AGENT_RULES_TEMPLATE" "AGENT_RULES" "包含 AGENT_RULES 标题"
|
||||
validate_contains "$AGENT_RULES_TEMPLATE" "{{DATE}}" "包含 {{DATE}} 占位符"
|
||||
fi
|
||||
|
||||
validate_file_exists "$README_TEMPLATE" "templates/README.md"
|
||||
|
||||
echo ""
|
||||
echo "🔍 验证 memory-bank 模板"
|
||||
|
||||
MEMORY_BANK_DIR="$TEMPLATES_DIR/memory-bank"
|
||||
for name in project-brief tech-stack architecture progress decisions; do
|
||||
validate_file_exists "$MEMORY_BANK_DIR/$name.template.md" "memory-bank/$name.template.md"
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "🔍 验证 prompts 模板"
|
||||
|
||||
PROMPTS_DIR="$TEMPLATES_DIR/prompts"
|
||||
validate_file_exists "$PROMPTS_DIR/README.md" "prompts/README.md"
|
||||
validate_file_exists "$PROMPTS_DIR/system/agent-behavior.template.md" "prompts/system/agent-behavior.template.md"
|
||||
validate_file_exists "$PROMPTS_DIR/coding/clarify.template.md" "prompts/coding/clarify.template.md"
|
||||
validate_file_exists "$PROMPTS_DIR/coding/review.template.md" "prompts/coding/review.template.md"
|
||||
validate_file_exists "$PROMPTS_DIR/meta/prompt-generator.template.md" "prompts/meta/prompt-generator.template.md"
|
||||
|
||||
echo ""
|
||||
|
||||
# ============================================
|
||||
# 生成验证报告
|
||||
# ============================================
|
||||
|
||||
echo "========================================"
|
||||
echo "📊 验证结果统计"
|
||||
echo "========================================"
|
||||
echo "✅ 通过: $VALIDATION_PASSED"
|
||||
echo "❌ 失败: $VALIDATION_FAILED"
|
||||
|
||||
if [ $((VALIDATION_PASSED + VALIDATION_FAILED)) -gt 0 ]; then
|
||||
echo "📈 通过率: $(awk "BEGIN {printf \"%.1f\", ($VALIDATION_PASSED * 100.0) / ($VALIDATION_PASSED + $VALIDATION_FAILED)}")%"
|
||||
else
|
||||
echo "📈 通过率: N/A (无测试项)"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
{
|
||||
echo "项目模板验证报告"
|
||||
echo "===================="
|
||||
echo ""
|
||||
echo "验证时间: $(date '+%Y-%m-%d %H:%M:%S')"
|
||||
echo "模板目录: $TEMPLATES_DIR"
|
||||
echo ""
|
||||
echo "统计结果:"
|
||||
echo " 通过: $VALIDATION_PASSED"
|
||||
echo " 失败: $VALIDATION_FAILED"
|
||||
if [ $((VALIDATION_PASSED + VALIDATION_FAILED)) -gt 0 ]; then
|
||||
echo " 通过率: $(awk "BEGIN {printf \"%.1f\", ($VALIDATION_PASSED * 100.0) / ($VALIDATION_PASSED + $VALIDATION_FAILED)}")%"
|
||||
fi
|
||||
echo ""
|
||||
if [ -s "$ERRORS_FILE" ]; then
|
||||
echo "错误详情:"
|
||||
cat "$ERRORS_FILE"
|
||||
fi
|
||||
} > "$REPORT_FILE"
|
||||
|
||||
echo "📄 详细报告: $REPORT_FILE"
|
||||
echo "========================================"
|
||||
|
||||
rm -f "$ERRORS_FILE"
|
||||
|
||||
if [ "$VALIDATION_FAILED" -eq 0 ]; then
|
||||
echo "✅ 所有项目模板验证通过"
|
||||
exit 0
|
||||
else
|
||||
echo "❌ 项目模板验证失败 ($VALIDATION_FAILED 个错误)"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user