mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-08 13:01:52 +00:00
fe4a9c1425
- plan/modules.toml -> plan/units/<id>.toml (scripts/units-split.py), read everywhere through harness/plan/units.py (Python) and crates/difftest/src/plan.rs (difftest). - reports/difftest/ untracked and gitignored: CI uploads main's set as the difftest-reports artifact; scripts/fetch-reports.sh downloads it for the progress checklist, the site and the --jobs queue order (fixture-size fallback otherwise). - .gitattributes: merge=union for plan/findings.md and plan/upstream-issues.md. - scripts/units-migrate-branch.sh moves an old branch's modules.toml edits into the unit files after it merges main. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
44 lines
1.6 KiB
Python
Executable File
44 lines
1.6 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Splits the old single-file plan/modules.toml into plan/units/<id>.toml (one per unit).
|
|
|
|
Each unit's lines are copied verbatim (comment lines that follow a unit's fields stay
|
|
with it); every file is checked to parse to exactly the fields of its [[unit]] table.
|
|
|
|
python3 scripts/units-split.py [--from plan/modules.toml] [--keep]
|
|
|
|
Without --keep the source file is removed (`git rm` it yourself when it is tracked).
|
|
Unit files that already exist are overwritten; files of units no longer in the source
|
|
are left alone (and reported).
|
|
"""
|
|
import argparse
|
|
import pathlib
|
|
import sys
|
|
|
|
sys.dont_write_bytecode = True
|
|
ROOT = pathlib.Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(ROOT / "harness/plan"))
|
|
import units # noqa: E402
|
|
|
|
|
|
def main():
|
|
ap = argparse.ArgumentParser(description=__doc__.split("\n")[0])
|
|
ap.add_argument("--from", dest="src", default=str(ROOT / "plan/modules.toml"))
|
|
ap.add_argument("--keep", action="store_true", help="keep the source file")
|
|
a = ap.parse_args()
|
|
src = pathlib.Path(a.src)
|
|
files = units.split_modules_toml(src.read_text())
|
|
out = units.units_dir()
|
|
out.mkdir(parents=True, exist_ok=True)
|
|
for uid, text in files.items():
|
|
units.unit_path(uid).write_text(text)
|
|
stale = sorted(p.stem for p in out.glob("*.toml") if p.stem not in files)
|
|
for s in stale:
|
|
print(f"note: plan/units/{s}.toml is not in {src.name}", file=sys.stderr)
|
|
if not a.keep:
|
|
src.unlink()
|
|
print(f"{len(files)} unit files -> {out.relative_to(ROOT)}/")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|