feat(presets): list presets in resolution/precedence order (#4086) (#4104)

`specify preset list` now sorts installed presets by (priority, id) so the
printed order matches the actual resolution/composition order used by
PresetRegistry.list_by_priority(). Lower priority number = higher precedence;
ties are broken alphabetically by preset id. Adds a header and footer note
clarifying the ordering, updates the presets reference docs, and adds tests.

Assisted-by: GitHub Copilot (model: Claude Opus 4.8, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Manfred Riem
2026-08-13 10:00:16 -05:00
committed by GitHub
co-authored by Copilot App
parent e79fa25f3f
commit 229022943c
3 changed files with 80 additions and 1 deletions
+11 -1
View File
@@ -59,7 +59,15 @@ def preset_list():
console.print(" [cyan]specify preset add <pack-name>[/cyan]")
return
console.print("\n[bold cyan]Installed Presets:[/bold cyan]\n")
# Sort by actual resolution precedence: lower priority number wins, ties
# broken by preset id (matching PresetRegistry.list_by_priority()). This
# keeps the printed order aligned with how presets are composed/resolved.
installed = sorted(
installed,
key=lambda pack: (pack.get("priority", 10), str(pack.get("id", ""))),
)
console.print("\n[bold cyan]Installed Presets[/bold cyan] [dim](in resolution order — highest precedence first)[/dim]\n")
for pack in installed:
status = "[green]enabled[/green]" if pack.get("enabled", True) else "[red]disabled[/red]"
pri = pack.get('priority', 10)
@@ -75,6 +83,8 @@ def preset_list():
console.print(f" [dim]Templates: {pack['template_count']}[/dim]")
console.print()
console.print("[dim]Lower priority number = higher precedence. Ties are broken by preset id (alphabetical).[/dim]")
@preset_app.command("add")
def preset_add(