Hand-offs without GitHub: bot kit zip, bot zip import, local refresh
- python -m collection export-bot-kit: policy.json, solver.js, graph.js and a README with checksums, zipped for the bot - the bot import takes a folder or a zip (files may sit under any top folder) - python -m collection refresh: the daily workflow, run locally - trajectories files are named by date and raw checksum, so two imports on one day never overwrite each other Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
19209a2ad6
commit
5c49591dae
+20
-1
@@ -4,6 +4,11 @@
|
||||
For each source (all by default): extract it (or take a local file), and when the raw file changed,
|
||||
transform it and load the public source file. Then build. Exit code 0 even when a source could not be
|
||||
reached: the report says what happened (and the daily workflow opens an issue).
|
||||
python -m collection refresh [--bot PATH ...]
|
||||
Locally, what the daily workflow does: update every source (plus bot folders or zips someone sent), then
|
||||
rebuild the graph, the route model, the statistics and the build.
|
||||
python -m collection export-bot-kit
|
||||
exports/atlas-for-bot-<date>-<policy id>.zip: policy.json, solver.js and graph.js for the bot.
|
||||
python -m collection build [--check]
|
||||
Code every public source file into data/public/runs_clean.csv (validated against data/dictionary.yaml),
|
||||
and write the files generated from the specs: the "Report a run" issue form, the bot crosswalk in
|
||||
@@ -46,7 +51,9 @@ def update_source(name, spec, manifest, report, local_file=None, env=None):
|
||||
old = {"scenes": L.read_json(f"{target}/scenes.json") or {}}
|
||||
lines = mod.describe(old, new)
|
||||
wrote = L.json_file(f"{target}/scenes.json", mod.merge_scenes(old["scenes"], new["scenes"]), compact=False)
|
||||
wrote |= L.jsonl_file(f"{target}/trajectories-{ctx['changed']}.jsonl", new["trajectories"])
|
||||
# one file per import (date + raw checksum), so two imports on the same day (yours, Ken's) never overwrite
|
||||
tag = f"{ctx['changed']}-{manifest[name]['sha256'][:8]}"
|
||||
wrote |= L.jsonl_file(f"{target}/trajectories-{tag}.jsonl", new["trajectories"])
|
||||
elif target:
|
||||
old = L.read_json(target)
|
||||
lines = mod.describe(old, new)
|
||||
@@ -93,8 +100,20 @@ def main(argv=None):
|
||||
up.add_argument("--report")
|
||||
b = sub.add_parser("build")
|
||||
b.add_argument("--check", action="store_true")
|
||||
k = sub.add_parser("export-bot-kit", help="zip policy.json, solver.js and graph.js for the bot")
|
||||
k.add_argument("--out", default="exports")
|
||||
r = sub.add_parser("refresh", help="update every source, then rebuild everything (the daily workflow, locally)")
|
||||
r.add_argument("--bot", action="append", default=[], help="a bot folder or a .zip of its data (repeatable)")
|
||||
a = ap.parse_args(argv)
|
||||
|
||||
if a.cmd == "export-bot-kit":
|
||||
from .etl.handoff import export_bot_kit
|
||||
print(f"wrote {export_bot_kit(a.out)}")
|
||||
return 0
|
||||
if a.cmd == "refresh":
|
||||
from .etl.handoff import refresh
|
||||
return refresh(main, a.bot)
|
||||
|
||||
if a.cmd == "build":
|
||||
changed = build(check=a.check)
|
||||
if a.check and changed:
|
||||
|
||||
Reference in New Issue
Block a user