Files
tensors/tests
aladac ad31341a4d feat(scenes): add scene fragment library mirroring characters
Extracts the per-name YAML-list storage logic out of tensors/characters.py
into a new generic tensors.fragments.FragmentLibrary class, then layers two
kind-specific function-style modules on top:

- tensors.characters (unchanged public API, now thin wrapper)
- tensors.scenes (new): save_scene / load_scene / list_scenes / delete_scene /
  scene_path / resolve_scene, stored in ~/.local/share/tensors/scenes/

CLI additions:
- tsr scene save -o <name> 'elem1, elem2, ...'
- tsr scene list / show / delete

Wired into generate + template + style-sweep:
- tsr generate -S <name> / --scene-prompt 'elems' injects scene elements
  into the positive prompt right after the character block (order:
  quality_prefix -> character -> scene -> rating -> user)
- tsr template -S <name> / --scene-prompt 'elems' embeds a 'scene' list
  field in the dumped JSON template (named + inline merged, deduped)
- style-sweep templates accept 'scene' (str|list) and 'scene_prompt' keys
- generate --input JSON honors both 'scene' (str=name or list=inline)
  and 'scene_prompt' keys

FragmentLibrary uses kind-aware error messages (e.g. "Invalid scene name"
vs "Invalid character name") so users see the right context.

28 new tests cover the generic library + scenes. Bumps version to 0.1.24
(supersedes v0.1.23 which failed to publish due to a transient Sigstore
network error).
2026-05-18 02:19:23 +02:00
..
2026-02-15 21:45:23 +01:00