改了什么: - init-harness.sh 新增 PATH_MODE=absolute|relative,相对模式下占位符渲染为 项目内相对路径,产物可随仓库分发;非法取值直接报错退出 - 补 TEST_CASES_DIR / MANUAL_CASES_DIR / SMOKING_CASES_DIR / DEV_SELF_CASES_DIR / RELEASES_DIR 五个占位符及对应目录 - AGENTS.md.template §10 手动/冒烟用例改指 docs/test-cases/ 下的真实目录; §13 目录树按脚本实际产出的骨架重写,standards 标注「预置 / 按需创建」 - 新增 standards 模板 4 份(architecture / layers / naming / test), 与 templates/docs/standards/README.md 的预置标记对齐 - verify.sh:检查 7 扩到 harness 模板占位符必须可被 init-harness.sh 替换; 新增 9.1 在临时目录跑 abs / rel 双模式安装,断言无残留占位符、 rel 模式无安装机绝对路径、AGENTS.md 声明的 docs 路径全部真实存在 为什么: 初始化 poc-company-a 时暴露三个缺口:模板声明的用例路径与骨架不一致、 §13 列出安装器并不生成的 standards 文件、脚本没有相对路径模式导致 AGENTS.md 泄漏 30 处安装机绝对路径,只能手工 sed 修正。 怎么验证的: - ./.agents/verify.sh 68 项全部通过(34 + 24 个占位符可渲染、 abs / rel 双模式骨架一致、152 条相对链接有效、 overnight-runner 单元 44/44 + 冒烟 13/13、workflow 24/24) - 与 HEAD 版脚本对比安装结果:absolute 模式下产物仅按预期差异变化 - relative 模式安装产物:0 处绝对路径、0 残留占位符 文档同步检查:已更新(harness-installer README、SKILL.md、根 README 快速开始同步 PATH_MODE;agile-team-sdd/placeholders.md 不涉及, harness-installer 的占位符事实源是 init-harness.sh 的 PAIRS)
464 lines
17 KiB
Bash
Executable File
464 lines
17 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
# 一键验证本仓库。
|
||
#
|
||
# 用法:
|
||
# ./.agents/verify.sh # 全部检查
|
||
# ./.agents/verify.sh --fast # 跳过 overnight-runner 冒烟测试
|
||
#
|
||
# 退出码:0 全绿,1 有失败。
|
||
|
||
set -uo pipefail
|
||
|
||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||
cd "$ROOT"
|
||
|
||
FAST=0
|
||
[ "${1:-}" = "--fast" ] && FAST=1
|
||
|
||
FAILED=0
|
||
PASSED=0
|
||
|
||
ok() { PASSED=$((PASSED + 1)); printf ' \033[32m✔\033[0m %s\n' "$1"; }
|
||
bad() { FAILED=$((FAILED + 1)); printf ' \033[31m✘\033[0m %s\n' "$1"; }
|
||
skip() { printf ' \033[90m—\033[0m %s\n' "$1"; }
|
||
head_() { printf '\n\033[1m%s\033[0m\n' "$1"; }
|
||
|
||
# ── 1. Bash 语法 ───────────────────────────────────────────────────
|
||
head_ "1. Bash 语法"
|
||
while IFS= read -r f; do
|
||
if bash -n "$f" 2>/dev/null; then ok "$f"; else bad "$f"; bash -n "$f"; fi
|
||
done < <(find . -name "*.sh" -not -path "./.git/*" -not -path "*/.venv/*" -not -path "*/node_modules/*" | sort)
|
||
|
||
# ── 2. Python 语法 ─────────────────────────────────────────────────
|
||
head_ "2. Python 语法"
|
||
PY=""
|
||
for c in python3 python; do
|
||
command -v "$c" >/dev/null 2>&1 && { PY="$c"; break; }
|
||
done
|
||
if [ -z "$PY" ]; then
|
||
skip "找不到 python"
|
||
else
|
||
while IFS= read -r f; do
|
||
if "$PY" -m py_compile "$f" 2>/dev/null; then ok "$f"; else bad "$f"; "$PY" -m py_compile "$f"; fi
|
||
done < <(find . -name "*.py" -not -path "./.git/*" -not -path "*/.venv/*" -not -path "*/node_modules/*" | sort)
|
||
find . -name "__pycache__" -type d -not -path "./.git/*" -exec rm -rf {} + 2>/dev/null
|
||
fi
|
||
|
||
# ── 3. Node 语法 ───────────────────────────────────────────────────
|
||
head_ "3. Node 语法"
|
||
if ! command -v node >/dev/null 2>&1; then
|
||
skip "找不到 node"
|
||
else
|
||
while IFS= read -r f; do
|
||
if node --check "$f" 2>/dev/null; then ok "$f"; else bad "$f"; node --check "$f"; fi
|
||
done < <(find . -name "*.mjs" -o -name "*.js" -not -path "./.git/*" -not -path "*/node_modules/*" | grep -v node_modules | sort)
|
||
fi
|
||
|
||
# ── 4. JSON / YAML 可解析 ──────────────────────────────────────────
|
||
head_ "4. JSON / YAML 可解析"
|
||
if [ -n "$PY" ]; then
|
||
"$PY" - <<'PYEOF'
|
||
import json, pathlib, sys
|
||
import yaml
|
||
|
||
bad = []
|
||
files = [
|
||
p for p in pathlib.Path('.').rglob('*')
|
||
if p.suffix in ('.json', '.jsonc', '.yaml', '.yml')
|
||
and '.git/' not in str(p) and '.venv/' not in str(p)
|
||
and 'node_modules' not in str(p)
|
||
]
|
||
for p in sorted(files):
|
||
try:
|
||
if p.suffix in ('.json', '.jsonc'):
|
||
json.loads(p.read_text(encoding='utf-8'))
|
||
else:
|
||
yaml.safe_load(p.read_text(encoding='utf-8'))
|
||
print(f' \033[32m✔\033[0m {p}')
|
||
except Exception as exc:
|
||
print(f' \033[31m✘\033[0m {p} — {exc}')
|
||
bad.append(p)
|
||
sys.exit(1 if bad else 0)
|
||
PYEOF
|
||
if [ $? -eq 0 ]; then PASSED=$((PASSED + 1)); else FAILED=$((FAILED + 1)); fi
|
||
else
|
||
skip "找不到 python"
|
||
fi
|
||
|
||
# ── 5. skill 名/目录一致、无重名 ───────────────────────────────────
|
||
head_ "5. skill 名/目录一致、无重名"
|
||
if [ -n "$PY" ]; then
|
||
"$PY" - <<'PYEOF'
|
||
import collections, pathlib, re, sys
|
||
|
||
seen = collections.Counter()
|
||
bad = []
|
||
for md in sorted(pathlib.Path('.').rglob('SKILL.md')):
|
||
s = str(md)
|
||
if '.git/' in s or '.venv/' in s or 'node_modules' in s:
|
||
continue
|
||
m = re.search(r'^name:\s*(\S+)', md.read_text(encoding='utf-8'), re.M)
|
||
if not m:
|
||
print(f' \033[31m✘\033[0m {md} — 缺少 name')
|
||
bad.append(md)
|
||
continue
|
||
name = m.group(1)
|
||
seen[name] += 1
|
||
if name != md.parent.name:
|
||
print(f' \033[31m✘\033[0m {md} — name={name} 与目录名 {md.parent.name} 不一致')
|
||
bad.append(md)
|
||
for name, n in seen.items():
|
||
if n > 1:
|
||
print(f' \033[31m✘\033[0m 重名 skill: {name}({n} 处)')
|
||
bad.append(name)
|
||
if not bad:
|
||
print(f' \033[32m✔\033[0m {sum(seen.values())} 个 skill,名称与目录一致且无重名')
|
||
sys.exit(1 if bad else 0)
|
||
PYEOF
|
||
if [ $? -eq 0 ]; then PASSED=$((PASSED + 1)); else FAILED=$((FAILED + 1)); fi
|
||
else
|
||
skip "找不到 python"
|
||
fi
|
||
|
||
# ── 6. 清单 ↔ 模板 ↔ 已安装 三方一致 ──────────────────────────────
|
||
head_ "6. 清单 ↔ 模板 ↔ 已安装 一致"
|
||
if [ -n "$PY" ]; then
|
||
"$PY" - <<'PYEOF'
|
||
import json, pathlib, sys
|
||
|
||
bad = []
|
||
catalog_path = pathlib.Path('agile-team-sdd/catalog.json')
|
||
if not catalog_path.exists():
|
||
print(' \033[31m✘\033[0m 缺 agile-team-sdd/catalog.json')
|
||
sys.exit(1)
|
||
|
||
catalog = json.loads(catalog_path.read_text(encoding='utf-8'))
|
||
listed = {s['name'] for g in catalog.values() for s in g}
|
||
|
||
tpl_root = pathlib.Path('agile-team-sdd/skills')
|
||
templates = {p.name.replace('-template', '') for p in tpl_root.iterdir() if p.is_dir()}
|
||
|
||
installed_root = pathlib.Path('example-project/.agents/skills')
|
||
installed = {p.name for p in installed_root.iterdir() if p.is_dir()} if installed_root.exists() else set()
|
||
|
||
if listed != templates:
|
||
print(f' \033[31m✘\033[0m 清单与模板不一致:{sorted(listed ^ templates)}')
|
||
bad.append('catalog/templates')
|
||
if listed != installed:
|
||
print(f' \033[31m✘\033[0m 清单与已安装不一致:{sorted(listed ^ installed)}')
|
||
bad.append('catalog/installed')
|
||
if not bad:
|
||
print(f' \033[32m✔\033[0m 三方一致({len(listed)} 个 skill)')
|
||
sys.exit(1 if bad else 0)
|
||
PYEOF
|
||
if [ $? -eq 0 ]; then PASSED=$((PASSED + 1)); else FAILED=$((FAILED + 1)); fi
|
||
else
|
||
skip "找不到 python"
|
||
fi
|
||
|
||
# ── 7. 占位符已登记 + harness-installer 模板可渲染 ────────────────
|
||
head_ "7. 模板占位符已登记"
|
||
if [ -n "$PY" ]; then
|
||
"$PY" - <<'PYEOF'
|
||
import pathlib, re, sys
|
||
|
||
used = set()
|
||
for f in pathlib.Path('agile-team-sdd/skills').rglob('*.md'):
|
||
used |= set(re.findall(r'\{\{([A-Z_]+)\}\}', f.read_text(encoding='utf-8')))
|
||
|
||
doc = pathlib.Path('agile-team-sdd/placeholders.md')
|
||
declared = set(re.findall(r'\{\{([A-Z_]+)\}\}', doc.read_text(encoding='utf-8'))) if doc.exists() else set()
|
||
|
||
missing = sorted(used - declared)
|
||
if missing:
|
||
print(f' \033[31m✘\033[0m 未登记的占位符:{missing}')
|
||
sys.exit(1)
|
||
|
||
# harness-installer:模板里用到的占位符必须能被 init-harness.sh 替换
|
||
# (它的源码 PAIRS 才是这部分的事实源;placeholders.md 管的是 agile-team-sdd)
|
||
tpl = pathlib.Path('harness-installer/templates')
|
||
harness_used = set()
|
||
for f in tpl.rglob('*'):
|
||
if not f.is_file():
|
||
continue
|
||
try:
|
||
harness_used |= set(re.findall(r'\{\{([A-Z_]+)\}\}', f.read_text(encoding='utf-8')))
|
||
except UnicodeDecodeError:
|
||
continue
|
||
|
||
script = pathlib.Path('harness-installer/scripts/init-harness.sh').read_text(encoding='utf-8')
|
||
substituted = set(re.findall(r'^\s*"([A-Z_]+)=', script, re.M))
|
||
|
||
problems = []
|
||
for ph in sorted(harness_used - substituted):
|
||
problems.append(f'harness-installer 模板里的 {{{{{ph}}}}} 不会被 init-harness.sh 替换')
|
||
if problems:
|
||
for p in problems:
|
||
print(f' \033[31m✘\033[0m {p}')
|
||
sys.exit(1)
|
||
|
||
print(f' \033[32m✔\033[0m {len(used)} + {len(harness_used)} 个占位符已登记且可渲染')
|
||
PYEOF
|
||
if [ $? -eq 0 ]; then PASSED=$((PASSED + 1)); else FAILED=$((FAILED + 1)); fi
|
||
else
|
||
skip "找不到 python"
|
||
fi
|
||
|
||
# ── 8. 已安装 skill 无残留占位符、无绝对路径 ───────────────────────
|
||
head_ "8. 已安装 skill 无残留占位符 / 无绝对路径"
|
||
if [ -n "$PY" ]; then
|
||
"$PY" - <<'PYEOF'
|
||
import pathlib, re, sys
|
||
|
||
root = pathlib.Path('example-project/.agents/skills')
|
||
bad = []
|
||
files = sorted(root.rglob('*.md')) if root.exists() else []
|
||
for f in files:
|
||
text = f.read_text(encoding='utf-8')
|
||
for ph in re.findall(r'\{\{[A-Z_]+\}\}', text):
|
||
print(f' \033[31m✘\033[0m {f} — 残留占位符 {ph}')
|
||
bad.append(f)
|
||
for m in re.findall(r'/(?:Users|home)/[^\s`"\')]+', text):
|
||
print(f' \033[31m✘\033[0m {f} — 泄漏绝对路径 {m}')
|
||
bad.append(f)
|
||
if not bad:
|
||
print(f' \033[32m✔\033[0m {len(files)} 个已安装文件干净')
|
||
sys.exit(1 if bad else 0)
|
||
PYEOF
|
||
if [ $? -eq 0 ]; then PASSED=$((PASSED + 1)); else FAILED=$((FAILED + 1)); fi
|
||
else
|
||
skip "找不到 python"
|
||
fi
|
||
|
||
# ── 9. Markdown 相对链接有效 ───────────────────────────────────────
|
||
head_ "9. Markdown 相对链接有效"
|
||
if [ -n "$PY" ]; then
|
||
"$PY" - <<'PYEOF'
|
||
import pathlib, re, sys
|
||
|
||
bad = []
|
||
checked = 0
|
||
for md in pathlib.Path('.').rglob('*.md'):
|
||
s = str(md)
|
||
if '.git/' in s or '.venv/' in s or 'node_modules' in s:
|
||
continue
|
||
text = md.read_text(encoding='utf-8')
|
||
for m in re.finditer(r'\[[^\]]*\]\(([^)]+)\)', text):
|
||
link = m.group(1).split('#')[0].strip()
|
||
if not link or link.startswith(('http://', 'https://', 'mailto:')):
|
||
continue
|
||
checked += 1
|
||
if not (md.parent / link).resolve().exists():
|
||
print(f' \033[31m✘\033[0m {md} → {link}')
|
||
bad.append(link)
|
||
if not bad:
|
||
print(f' \033[32m✔\033[0m {checked} 条相对链接全部有效')
|
||
sys.exit(1 if bad else 0)
|
||
PYEOF
|
||
if [ $? -eq 0 ]; then PASSED=$((PASSED + 1)); else FAILED=$((FAILED + 1)); fi
|
||
else
|
||
skip "找不到 python"
|
||
fi
|
||
|
||
# ── 9.1 harness-installer 骨架 ↔ AGENTS.md 声明一致 ──────────────
|
||
head_ "9.1 harness-installer 骨架与声明一致"
|
||
if [ -z "$PY" ]; then
|
||
skip "找不到 python"
|
||
else
|
||
TMPI="$(mktemp -d)"
|
||
mkdir -p "$TMPI/abs" "$TMPI/rel"
|
||
if ./harness-installer/scripts/init-harness.sh "$TMPI/abs" >/dev/null 2>&1 \
|
||
&& PATH_MODE=relative ./harness-installer/scripts/init-harness.sh "$TMPI/rel" >/dev/null 2>&1; then
|
||
"$PY" - "$TMPI" <<'PYEOF'
|
||
import pathlib, re, sys
|
||
|
||
tmp = pathlib.Path(sys.argv[1])
|
||
bad = []
|
||
|
||
abs_text = (tmp / 'abs' / 'AGENTS.md').read_text(encoding='utf-8')
|
||
if str(tmp / 'abs') not in abs_text:
|
||
bad.append('absolute 模式未写入绝对路径')
|
||
|
||
rel_root = tmp / 'rel'
|
||
rel_text = (rel_root / 'AGENTS.md').read_text(encoding='utf-8')
|
||
if str(tmp) in rel_text:
|
||
bad.append('relative 模式泄漏安装机绝对路径')
|
||
for ph in sorted(set(re.findall(r'\{\{[A-Z_]+\}\}', rel_text))):
|
||
bad.append(f'AGENTS.md 残留占位符 {ph}')
|
||
|
||
# 声明 ↔ 实物:引用的 docs 路径必须存在
|
||
# - docs/facts/ 是 as-built 产物,装机时本就不存在
|
||
# - 含 <...> 的目录每个迭代才创建
|
||
for s in sorted(set(re.findall(r'(?<![\w/])docs/[^\s`)、,;,]+', rel_text))):
|
||
s = s.rstrip('/').rstrip('。')
|
||
if s.startswith('docs/facts/') or '<' in s:
|
||
continue
|
||
if not (rel_root / s).exists():
|
||
bad.append(f'AGENTS.md 声明了不存在的路径 {s}')
|
||
|
||
if bad:
|
||
for b in bad:
|
||
print(f' \033[31m✘\033[0m {b}')
|
||
sys.exit(1)
|
||
print(f' \033[32m✔\033[0m 骨架与 AGENTS.md 声明一致(abs / rel 双模式)')
|
||
PYEOF
|
||
if [ $? -eq 0 ]; then PASSED=$((PASSED + 1)); else FAILED=$((FAILED + 1)); fi
|
||
else
|
||
bad "init-harness.sh 在临时目录安装失败"
|
||
fi
|
||
rm -rf "$TMPI"
|
||
fi
|
||
|
||
# ── 10. overnight-runner 冒烟测试 ─────────────────────────────────
|
||
head_ "10. overnight-runner 测试"
|
||
if [ "$FAST" -eq 1 ]; then
|
||
skip "--fast 跳过"
|
||
elif [ -z "$PY" ]; then
|
||
skip "找不到 python"
|
||
else
|
||
# overnight-runner 零依赖,用系统 python 即可
|
||
if "$PY" overnight-runner/tests/test_units.py > /tmp/orn-units.log 2>&1; then
|
||
tail -1 /tmp/orn-units.log | sed 's/^/ \033[32m✔\033[0m 单元测试 /'
|
||
PASSED=$((PASSED + 1))
|
||
else
|
||
sed 's/^/ /' /tmp/orn-units.log
|
||
bad "单元测试"
|
||
fi
|
||
if "$PY" overnight-runner/tests/test_smoke.py > /tmp/orn-smoke.log 2>&1; then
|
||
tail -1 /tmp/orn-smoke.log | sed 's/^/ \033[32m✔\033[0m 冒烟测试 /'
|
||
PASSED=$((PASSED + 1))
|
||
else
|
||
sed 's/^/ /' /tmp/orn-smoke.log
|
||
bad "冒烟测试"
|
||
fi
|
||
fi
|
||
|
||
# ── 11. overnight-runner 队列布局 / 迁移 / 决策默认值 ───────────────
|
||
head_ "11. overnight-runner 队列布局与决策默认值"
|
||
if [ "$FAST" -eq 1 ]; then
|
||
skip "--fast 跳过"
|
||
elif [ -z "$PY" ]; then
|
||
skip "找不到 python"
|
||
else
|
||
"$PY" - <<'PYEOF'
|
||
import pathlib, sys, tempfile
|
||
|
||
sys.path.insert(0, str(pathlib.Path('overnight-runner').resolve()))
|
||
from overnight_runner import yaml_lite
|
||
from overnight_runner.config import (
|
||
DECISION_MODES,
|
||
DECISION_MODE_ATTENDED,
|
||
DECISION_MODE_UNATTENDED,
|
||
DecisionConfig,
|
||
migrate_legacy_queue,
|
||
queue_names,
|
||
queue_paths,
|
||
)
|
||
from overnight_runner.queue import load_queue_defs
|
||
|
||
bad = []
|
||
|
||
# 11.1 队列目录结构:常量与实际路径一致
|
||
paths = queue_paths(pathlib.Path('/tmp/x'), 'alice')
|
||
expect = {
|
||
'dir': '.overnight-runner/queue/alice',
|
||
'config': '.overnight-runner/queue/alice/queue.yaml',
|
||
'state': '.overnight-runner/queue/alice/state.json',
|
||
'logs': '.overnight-runner/queue/alice/logs',
|
||
'decisions': '.overnight-runner/queue/alice/decisions.jsonl',
|
||
'lock': '.overnight-runner/queue/alice/.lock',
|
||
}
|
||
for attr, want in expect.items():
|
||
got = getattr(paths, attr).as_posix().replace('/tmp/x/', '')
|
||
if got != want:
|
||
print(f' \033[31m✘\033[0m 队列路径 {attr}: {got} ≠ {want}')
|
||
bad.append(attr)
|
||
|
||
# 11.2 决策模式默认值与合法取值
|
||
cfg = DecisionConfig()
|
||
if cfg.mode != DECISION_MODE_ATTENDED:
|
||
print(f' \033[31m✘\033[0m 默认决策模式 {cfg.mode} ≠ attended')
|
||
bad.append('mode')
|
||
if cfg.timeout_sec != 600:
|
||
print(f' \033[31m✘\033[0m 默认决策窗口 {cfg.timeout_sec}s ≠ 600s')
|
||
bad.append('timeout')
|
||
if cfg.resume != 'session':
|
||
print(f' \033[31m✘\033[0m 默认续跑方式 {cfg.resume} ≠ session')
|
||
bad.append('resume')
|
||
if set(DECISION_MODES) != {DECISION_MODE_ATTENDED, DECISION_MODE_UNATTENDED}:
|
||
print(f' \033[31m✘\033[0m 决策模式取值应为 attended/unattended,实际 {DECISION_MODES}')
|
||
bad.append('modes')
|
||
|
||
# 11.3 迁移幂等:连跑两次,队列不丢不重
|
||
with tempfile.TemporaryDirectory() as tmp:
|
||
root = pathlib.Path(tmp)
|
||
(root / '.overnight-runner').mkdir(parents=True)
|
||
(root / 'overnight-runner.yaml').write_text(
|
||
yaml_lite.dumps({
|
||
'runner': {'agent': {'command': 'opencode', 'args': ['run']}},
|
||
'queue': [{'id': 't1', 'plan': 'docs/plans/p1.md'}],
|
||
}),
|
||
encoding='utf-8',
|
||
)
|
||
migrate_legacy_queue(root)
|
||
migrate_legacy_queue(root)
|
||
p = queue_paths(root, 'default')
|
||
defs = load_queue_defs(p)
|
||
if len(defs) != 1 or defs[0].get('id') != 't1':
|
||
print(f' \033[31m✘\033[0m 迁移后队列内容不对: {defs}')
|
||
bad.append('migrate')
|
||
if queue_names(root) != ['default']:
|
||
print(f' \033[31m✘\033[0m 迁移后队列名不对: {queue_names(root)}')
|
||
bad.append('migrate-names')
|
||
cfg_path = root / '.overnight-runner' / 'overnight-runner.yaml'
|
||
if not cfg_path.exists():
|
||
print(' \033[31m✘\033[0m 迁移后 overnight-runner.yaml 未进入 .overnight-runner/')
|
||
bad.append('migrate-cfg-path')
|
||
elif (root / 'overnight-runner.yaml').exists():
|
||
print(' \033[31m✘\033[0m 迁移后根目录仍留有 overnight-runner.yaml')
|
||
bad.append('migrate-root-left')
|
||
else:
|
||
raw = yaml_lite.loads(cfg_path.read_text(encoding='utf-8'))
|
||
if raw.get('queue'):
|
||
print(' \033[31m✘\033[0m 迁移后配置的 queue 段没清空')
|
||
bad.append('migrate-clear')
|
||
|
||
# 11.4 .gitignore 排除了队列运行时产物
|
||
gi = pathlib.Path('.gitignore').read_text(encoding='utf-8')
|
||
for pat in ('**/.overnight-runner/queue/*/state.json',
|
||
'**/.overnight-runner/queue/*/logs/',
|
||
'**/.overnight-runner/queue/*/.lock'):
|
||
if pat not in gi:
|
||
print(f' \033[31m✘\033[0m .gitignore 缺 {pat}')
|
||
bad.append('gitignore')
|
||
|
||
if not bad:
|
||
print(' \033[32m✔\033[0m 队列布局、迁移幂等、决策默认值一致')
|
||
sys.exit(1 if bad else 0)
|
||
PYEOF
|
||
if [ $? -eq 0 ]; then PASSED=$((PASSED + 1)); else FAILED=$((FAILED + 1)); fi
|
||
fi
|
||
|
||
# ── 12. agents-workflow-engine ────────────────────────────────────
|
||
head_ "12. agents-workflow-engine 测试"
|
||
if [ -z "$PY" ]; then
|
||
skip "找不到 python"
|
||
else
|
||
if "$PY" agents-workflow-engine/tests/test_units.py > /tmp/awe-units.log 2>&1 && grep -q '^OK$' /tmp/awe-units.log; then
|
||
grep '^Ran ' /tmp/awe-units.log | sed 's/^/ \033[32m✔\033[0m /'
|
||
PASSED=$((PASSED + 1))
|
||
else
|
||
sed 's/^/ /' /tmp/awe-units.log
|
||
bad "单元测试"
|
||
fi
|
||
fi
|
||
|
||
# ── 汇总 ───────────────────────────────────────────────────────────
|
||
printf '\n\033[1m%s\033[0m\n' "────────────────────────────"
|
||
if [ "$FAILED" -eq 0 ]; then
|
||
printf '\033[32m全部通过\033[0m(%s 项)\n' "$PASSED"
|
||
exit 0
|
||
fi
|
||
printf '\033[31m失败 %s 项\033[0m(通过 %s 项)\n' "$FAILED" "$PASSED"
|
||
exit 1
|