Files
ThothII/harness/tht/cli/phase_cmd.py
T
marcopan fc5fbe6b65 refactor(harness): renaming prodotto tht (Onda -1)
Thoth (tht) è il prodotto, PSD è il cliente. Nessun riferimento al contesto
clinico nel codice.

Rinomine:
- comando+package nsp→tht (dir nsp/→tht/, 46 import, pyproject entry point)
- gate nsp-gate.js→tht-gate.js (+ rewrite token, relayIfNspFails→relayIfThtFails)
- workspace chirone.{example,test}.yaml→tht.{example,test}.yaml (generici)
- env THOTH_→THT_ (19 var) + NSP_ stragglers (NSP_HARNESS_ROOT, NSP_SESSION)
- commenti/docstring chirone/psdwp3/policlinico neutralizzati ('the reference
  implementation', 'the DWH')

Aggiunto [tool.setuptools.packages.find] include=['tht*'] (necessario: l'auto-
discovery rompeva con tht/ + workspaces/ come top-level multipli).

.env operatore aggiornato in-place (prefissi THT_, valori preservati, gitignored).

Verifica: pytest 109 passed, npm test 14 pass, tht phase meta --json OK, zero
residui nsp/THOTH_/NSP_/chirone nel package.
2026-06-27 10:33:16 +02:00

52 lines
1.5 KiB
Python

"""tht phase -- workflow HITL gate commands.
`meta` is the single source the gate (tht-gate.js) reads workflow facts from,
killing the JS/Python PHASE_NAMES drift (F2). advance/reopen/show land with the
session/db ports (A9) -- they need current_phase + load_session_or_exit which
depend on the not-yet-ported session store helpers.
"""
from __future__ import annotations
import json
import typer
from tht.workflow import load_workflow
phase_app = typer.Typer(help="Fase del workflow HITL (gate di avanzamento/ritorno)")
@phase_app.command("meta")
def meta_cmd(
as_json: bool = typer.Option(
False,
"--json",
help="Emette i metadati del workflow come JSON (usato dall'estensione gate).",
),
) -> None:
"""Stampa i metadati del workflow derivati da workflow.yaml (F2)."""
wf = load_workflow()
if not as_json:
typer.echo(f"max_phase: {wf.max_phase}")
for p in wf.phases:
typer.echo(f" {p.id} ({p.num}/{wf.max_phase}) {p.name} advance={p.advance}")
return
typer.echo(
json.dumps(
{
"schema_version": wf.schema_version,
"max_phase": wf.max_phase,
"phases": [
{
"num": p.num,
"id": p.id,
"name": p.name,
"advance": p.advance,
"artifacts_out": p.artifacts_out,
}
for p in wf.phases
],
}
)
)