generated from coulomb/repo-seed
Complete WARDEN-WP-0012 routing scenario playbooks
Add platform-secret playbooks for issue-core ingestion, OpenRouter llm-connect, object-storage STS, and database dynamic credentials. Extend the routing catalog with draft entries and implement `warden route list --stale` for quarterly drift review. Document the review cadence in AccessRouting and mark the workplan finished.
This commit is contained in:
@@ -547,17 +547,35 @@ def _entry_summary(entry) -> dict:
|
||||
}
|
||||
|
||||
|
||||
def _print_entry_table(entries, title: str) -> None:
|
||||
def _print_entry_table(
|
||||
entries, title: str, *, show_reviewed: bool = False, stale_threshold_days: int = 90
|
||||
) -> None:
|
||||
table = Table(title=title)
|
||||
table.add_column("ID")
|
||||
table.add_column("Need")
|
||||
table.add_column("Owner")
|
||||
table.add_column("warden")
|
||||
if show_reviewed:
|
||||
table.add_column("Reviewed")
|
||||
table.add_column("Days")
|
||||
table.add_column("Status")
|
||||
from warden.routing.catalog import days_since_review
|
||||
|
||||
for e in entries:
|
||||
executes = "[green]issue[/green]" if e.warden_executes else "route"
|
||||
status_styled = e.status if e.status == "active" else f"[yellow]{e.status}[/yellow]"
|
||||
table.add_row(e.id, e.title, e.owner_repo, executes, status_styled)
|
||||
if show_reviewed:
|
||||
days = days_since_review(e.reviewed)
|
||||
reviewed_styled = (
|
||||
f"[yellow]{e.reviewed}[/yellow]"
|
||||
if days > stale_threshold_days
|
||||
else e.reviewed
|
||||
)
|
||||
table.add_row(
|
||||
e.id, e.title, e.owner_repo, executes, reviewed_styled, str(days), status_styled
|
||||
)
|
||||
else:
|
||||
table.add_row(e.id, e.title, e.owner_repo, executes, status_styled)
|
||||
console.print(table)
|
||||
|
||||
|
||||
@@ -566,22 +584,55 @@ def route_list(
|
||||
output_json: Annotated[bool, typer.Option("--json", help="Output JSON")] = False,
|
||||
all_entries: Annotated[bool, typer.Option("--all", help="Include draft entries")] = False,
|
||||
tag: Annotated[Optional[str], typer.Option("--tag", help="Filter by need keyword")] = None,
|
||||
stale_only: Annotated[
|
||||
bool, typer.Option("--stale", help="Show entries past review cadence (see --stale-days)")
|
||||
] = False,
|
||||
stale_days: Annotated[
|
||||
int,
|
||||
typer.Option(
|
||||
"--stale-days",
|
||||
help="Days since reviewed before an entry is stale (default 90)",
|
||||
min=1,
|
||||
),
|
||||
] = 90,
|
||||
) -> None:
|
||||
"""List routing scenarios. Active-only unless --all."""
|
||||
from warden.routing.catalog import days_since_review
|
||||
|
||||
catalog = _load_catalog()
|
||||
entries = catalog.listed(include_draft=all_entries)
|
||||
if stale_only:
|
||||
entries = catalog.stale(include_draft=all_entries, threshold_days=stale_days)
|
||||
else:
|
||||
entries = catalog.listed(include_draft=all_entries)
|
||||
if tag:
|
||||
t = tag.lower()
|
||||
entries = [e for e in entries if t in [k.lower() for k in e.need_keywords]]
|
||||
|
||||
if output_json:
|
||||
print(json.dumps([_entry_summary(e) for e in entries], indent=2))
|
||||
payload = []
|
||||
for e in entries:
|
||||
row = _entry_summary(e)
|
||||
if stale_only:
|
||||
row["days_since_review"] = days_since_review(e.reviewed)
|
||||
row["stale_threshold_days"] = stale_days
|
||||
payload.append(row)
|
||||
print(json.dumps(payload, indent=2))
|
||||
return
|
||||
|
||||
if not entries:
|
||||
console.print("No matching routing entries.")
|
||||
if stale_only:
|
||||
console.print(f"No stale routing entries (threshold: {stale_days} days since reviewed).")
|
||||
else:
|
||||
console.print("No matching routing entries.")
|
||||
return
|
||||
_print_entry_table(entries, "Routing scenarios")
|
||||
title = (
|
||||
f"Stale routing scenarios (>{stale_days}d since reviewed)"
|
||||
if stale_only
|
||||
else "Routing scenarios"
|
||||
)
|
||||
_print_entry_table(
|
||||
entries, title, show_reviewed=stale_only, stale_threshold_days=stale_days
|
||||
)
|
||||
|
||||
|
||||
@route_app.command("show")
|
||||
|
||||
Reference in New Issue
Block a user