refactor(cli): remove obsolete workflow commands
This commit is contained in:
@@ -162,63 +162,3 @@ def add_cmd(
|
||||
}])[0]
|
||||
typer.secho(f"OK: decisione [{record.seq}] {record.type}: {record.subject}",
|
||||
fg=typer.colors.GREEN)
|
||||
|
||||
|
||||
@decision_app.command("retract")
|
||||
def retract_cmd(
|
||||
session: str = typer.Option(..., "--session", help="Id della sessione."),
|
||||
config: Path = CONFIG_OPT,
|
||||
) -> None:
|
||||
"""Ritira l'ultima decisione sostanziale della fase corrente (D15 granularita' step).
|
||||
|
||||
Granularita' (a) del rollback §4.8: 'rispondi di nuovo a questa domanda'. Scrive un
|
||||
marker decision_retracted (append-only, l'audit resta) che effective_decisions onora;
|
||||
il widget corrente puo' essere riproposto. Non cambia la fase."""
|
||||
from tht.phase import effective_decisions
|
||||
|
||||
cfg = _load_config_or_exit(config)
|
||||
load_session_or_exit(cfg, session)
|
||||
snapshot = load_snapshot_or_exit(cfg, session)
|
||||
|
||||
# Ultima decisione NON-meta della vista effective = quella associata al widget corrente.
|
||||
meta = {
|
||||
"phase_approved", "phase_auto_approved", "phase_reopened",
|
||||
"phase_skipped", "decision_retracted",
|
||||
}
|
||||
substantive = [d for d in effective_decisions(snapshot) if d.type not in meta]
|
||||
if not substantive:
|
||||
typer.secho(
|
||||
"Nessuna decisione sostanziale da ritirare nella fase corrente.",
|
||||
fg=typer.colors.YELLOW, err=True,
|
||||
)
|
||||
raise typer.Exit(code=6)
|
||||
target = substantive[-1]
|
||||
record = session_repository(cfg).append_decisions(session, [{
|
||||
"type": "decision_retracted", "subject": target.subject,
|
||||
"rationale": f"ritira [{target.seq}] {target.type}", "retracts": target.seq,
|
||||
}])[0]
|
||||
typer.secho(
|
||||
f"OK: ritirata decisione [{target.seq}] {target.type}: {target.subject} "
|
||||
f"(marker #{record.seq}).",
|
||||
fg=typer.colors.GREEN,
|
||||
)
|
||||
|
||||
|
||||
@decision_app.command("list")
|
||||
def list_cmd(
|
||||
session: str = typer.Option(..., "--session"),
|
||||
config: Path = CONFIG_OPT,
|
||||
) -> None:
|
||||
"""Elenca le decisioni della sessione."""
|
||||
cfg = _load_config_or_exit(config)
|
||||
decisions = load_snapshot_or_exit(cfg, session).decisions
|
||||
if not decisions:
|
||||
typer.echo("Nessuna decisione registrata.")
|
||||
return
|
||||
for d in decisions:
|
||||
line = f"[{d.seq}] {d.ts:%Y-%m-%d %H:%M} {d.type}: {d.subject}"
|
||||
if d.detail:
|
||||
line += f" — {d.detail}"
|
||||
if d.rationale:
|
||||
line += f" ({d.rationale})"
|
||||
typer.echo(line)
|
||||
|
||||
Reference in New Issue
Block a user