"""Assemble the public Hugging Face dataset folder for Skills Desk. Writes OUT/tasks.jsonl (one row per task id: training or reserved split, family, skill, domain, title, output path and the fixed instance's instruction), OUT/manifest/ (training and reserved id lists) and OUT/source/ (environment, tools, tests, Dockerfile). The README card is kept by hand. No screening numbers are written here; v2's training selection and its screen counts are in manifest/ (v2-selection.json). Reserved results are a baseline, not a label. Usage: PYTHONPATH=. .venv/bin/python tools/make_dataset.py --out ../outputs/skills-desk-dataset """ import argparse import json import os import random import shutil import sys sys.path.insert(0, ".") from terminal_desk.families import ALL_FAMILIES, instance_seed, parse_task_id, reserved_task_ids # noqa: E402 SOURCE = ["terminal_desk", "tools", "tests", "manifest", "Dockerfile", "openenv.yaml", "README.md", "LICENSE", "NOTICE", ".dockerignore", "vendor"] SKILL = {"ev": "evidence", "cmp": "compute", "tx": "transform", "fix": "repair", "plan": "constraints"} def skill_of(fid: str) -> str: return SKILL[fid.removeprefix("res_").split("_")[0]] def main() -> None: p = argparse.ArgumentParser() p.add_argument("--out", required=True) p.add_argument("--manifest", default="manifest/training_tasks_v2.txt") a = p.parse_args() train = [ln.strip() for ln in open(a.manifest) if ln.strip() and not ln.startswith("#")] os.makedirs(a.out, exist_ok=True) with open(os.path.join(a.out, "tasks.jsonl"), "w") as fh: for split, ids in (("train", train), ("reserved", reserved_task_ids())): for tid in ids: fid, level, _ = parse_task_id(tid) fam = ALL_FAMILIES[fid] built = fam.build(level, random.Random(instance_seed(tid))) # the fixed instance reset serves fh.write(json.dumps({ "task_id": tid, "split": split, "family": fid, "skill": skill_of(fid), "domain": fam.domain, "level": level, "title": fam.title, "output": "/app/" + built.artifact.path, "instruction": built.instruction, }) + "\n") shutil.rmtree(os.path.join(a.out, "manifest"), ignore_errors=True) shutil.copytree("manifest", os.path.join(a.out, "manifest")) for name in ("LICENSE", "NOTICE"): shutil.copy(name, os.path.join(a.out, name)) src = os.path.join(a.out, "source") shutil.rmtree(src, ignore_errors=True) for name in SOURCE: if os.path.isdir(name): shutil.copytree(name, os.path.join(src, name), ignore=shutil.ignore_patterns("__pycache__", "qwen_tok")) else: shutil.copy(name, os.path.join(src, name)) print("dataset folder ready:", a.out) if __name__ == "__main__": main()