Find skill IR in renamed checkouts
This commit is contained in:
@@ -22,6 +22,11 @@ def find_ir(root: Path) -> tuple[dict, str]:
|
||||
root / "reports" / "skill-ir.json",
|
||||
root / "skill-ir" / "examples" / f"{root.name}.json",
|
||||
]
|
||||
examples_dir = root / "skill-ir" / "examples"
|
||||
if examples_dir.exists():
|
||||
for path in sorted(examples_dir.glob("*.json")):
|
||||
if path not in candidates:
|
||||
candidates.append(path)
|
||||
for path in candidates:
|
||||
if path.exists():
|
||||
return load_json(path), str(path.relative_to(root))
|
||||
|
||||
@@ -2,14 +2,31 @@
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
SCRIPT = ROOT / "scripts" / "render_portability_report.py"
|
||||
sys.path.insert(0, str(ROOT / "scripts"))
|
||||
|
||||
from render_portability_report import find_ir
|
||||
|
||||
|
||||
def main() -> None:
|
||||
with tempfile.TemporaryDirectory(prefix="renamed-skill-root-") as tmp:
|
||||
tmp_root = Path(tmp)
|
||||
ir_dir = tmp_root / "skill-ir" / "examples"
|
||||
ir_dir.mkdir(parents=True)
|
||||
ir_path = ir_dir / "yao-meta-skill.json"
|
||||
ir_path.write_text(
|
||||
json.dumps({"schema_version": "2.0.0", "job_to_be_done": "test renamed checkout"}),
|
||||
encoding="utf-8",
|
||||
)
|
||||
ir_payload, ir_source = find_ir(tmp_root)
|
||||
assert ir_payload["schema_version"] == "2.0.0", ir_payload
|
||||
assert ir_source == "skill-ir/examples/yao-meta-skill.json", ir_source
|
||||
|
||||
payload = None
|
||||
for args in ([], [str(ROOT)]):
|
||||
proc = subprocess.run(
|
||||
|
||||
Reference in New Issue
Block a user