• Stefy Lanza (nextime / spora )'s avatar
    township: named configuration templates (v0.2.39) · c1a65e1d
    Stefy Lanza (nextime / spora ) authored
    A saved config was one JSON file; --config/--save let you keep several by juggling
    paths. A template is the same content under a NAME, in a known place, with list, load
    and delete — so "the LongCat long-shot setup" or "the quick 480p draft" is something you
    pick rather than a path you remember.
    
    Two properties beyond convenience:
    
    - A template is a COMPLETE configuration — every CONFIG_FIELDS key, 66 of them — not a
      patch. Loading one therefore cannot leave an option from the previous run in place.
    - The name is a SECURITY boundary, because names arrive from the CLI and from a browser.
      _safe_template_name strips separators and traversal and refuses a name with nothing
      usable; a test asserts that whatever is asked for, the resolved path stays inside the
      templates directory. "../../etc/passwd" becomes "etc-passwd".
    
    They live at <out_dir>/templates/<name>.json, because that is the directory the launcher
    already maps and persists — a template written to a container-local path would vanish on
    the next run.
    
    CLI: -T/--template NAME (layered over --config; explicit arguments still win, so a
    template can be a base you tweak per run), --save-template, --list-templates (with date,
    video model and option count), --delete-template. --config/--save are untouched.
    
    Web: GET /templates, POST /templates/load, POST /templates/delete, and a picker on the
    Run page with Load / Save as… / Delete. Saving is handled INSIDE /save-config rather than
    in its own route, so the large form-to-config mapping is not duplicated and cannot drift
    — a test pins that. Loading applies to default_args exactly as /save-config does, since
    the Run page renders from it and a load that only wrote a file would appear to do nothing
    until restart; it asks for confirmation first, because replacing every option is not an
    undoable click.
    
    A corrupt template is listed with its error rather than hiding the rest of the picker.
    
    39 tests. Verified live against the web UI: save, list, load, delete, a missing name, and
    a traversal attempt contained.
    Co-Authored-By: 's avatarClaude Opus 5 (1M context) <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_0182DhR1eFNPQyGmDrpHbedY
    c1a65e1d
Name
Last commit
Last update
..
admin Loading commit data...
api Loading commit data...
backends Loading commit data...
broker Loading commit data...
cluster Loading commit data...
compose Loading commit data...
frontproxy Loading commit data...
models Loading commit data...
ocr Loading commit data...
openai Loading commit data...
pydantic Loading commit data...
queue Loading commit data...
tasks Loading commit data...
__init__.py Loading commit data...
cli.py Loading commit data...
config.py Loading commit data...
main.py Loading commit data...
platform_paths.py Loading commit data...
system_app.py Loading commit data...