70 lines
2.1 KiB
Python
70 lines
2.1 KiB
Python
#!/usr/bin/env python3
|
|
"""v0.20 Python-core regression checks."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import subprocess
|
|
import sys
|
|
import tempfile
|
|
from pathlib import Path
|
|
|
|
|
|
REPO_ROOT = Path(__file__).resolve().parent.parent
|
|
|
|
|
|
def run(cmd: list[str]) -> None:
|
|
print("$ " + " ".join(cmd))
|
|
result = subprocess.run(cmd, cwd=REPO_ROOT, check=False, text=True, capture_output=True)
|
|
if result.stdout:
|
|
print(result.stdout.rstrip())
|
|
if result.stderr:
|
|
print(result.stderr.rstrip(), file=sys.stderr)
|
|
if result.returncode != 0:
|
|
raise SystemExit(result.returncode)
|
|
|
|
|
|
def make_fixture(root: Path) -> Path:
|
|
project = root / "v020-fixture"
|
|
(project / "phase4").mkdir(parents=True, exist_ok=True)
|
|
(project / "phase4" / "final_zh.md").write_text(
|
|
"# v0.20 回归测试报告\n\n正文引用占位。\n",
|
|
encoding="utf-8",
|
|
)
|
|
return project
|
|
|
|
|
|
def main() -> int:
|
|
python = sys.executable
|
|
run([python, "scripts/dr.py", "skills", "validate"])
|
|
run([python, "scripts/dr.py", "models", "--profile", "medium", "--json"])
|
|
with tempfile.TemporaryDirectory(prefix="deep-research-v020-") as tmp:
|
|
tmp_root = Path(tmp)
|
|
run(
|
|
[
|
|
python,
|
|
"scripts/dr.py",
|
|
"init",
|
|
"v0.20 fixture",
|
|
"--slug",
|
|
"v020-fixture",
|
|
"--projects-dir",
|
|
str(tmp_root),
|
|
"--method",
|
|
"mckinsey_market",
|
|
]
|
|
)
|
|
project = make_fixture(tmp_root)
|
|
run([python, "scripts/dr.py", "frame", str(project)])
|
|
run([python, "scripts/dr.py", "approve", str(project)])
|
|
run([python, "scripts/dr.py", "research", str(project), "--workers", "2", "--dry-run"])
|
|
run([python, "scripts/dr.py", "research", str(project), "--workers", "2"])
|
|
run([python, "scripts/dr.py", "review", str(project)])
|
|
run([python, "scripts/dr.py", "finalize", str(project), "--dry-run"])
|
|
print("v0.20 regression PASS")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|