Keep formats.py to Claude Code's shapes, with paths and file reads at their callers

This commit is contained in:
2026-09-29 11:47:23 +02:00
parent 969bb26668
commit 5e84736672
5 changed files with 23 additions and 37 deletions
+10 -1
View File
@@ -57,10 +57,19 @@ def read_models(saved):
return models
def read_catalog(folder):
for path in folder.glob("*.json"):
try:
with open(path, encoding="utf-8") as handle:
yield json.load(handle)
except (OSError, ValueError):
continue
def ask_model(name, saved, folder):
if stop := human_needed.off_terminal(f"pick {name}'s model, or merge {{\"{name}\": \"<model>\"}} into {saved}"):
return stop
offered = catalog(folder)
offered = catalog(read_catalog(folder))
print(f"\nThe model to run {name} on, saved in {saved}:", file=sys.stderr)
for number, (model_id, label) in enumerate(offered, 1):
print(f" {number}. {label} ({model_id})", file=sys.stderr)