feat(harness): port sql/cte/datamart/lsh cmd (Onda 4) — CLI completa F1→F8
Ultima onda CLI. 4 cmd portati con rename + grep-per-file (3 residui nsp nei messaggi fixati). Nessun drift costanti phase in questi cmd. La CLI tht e' ora COMPLETA: 14 gruppi di comandi (phase config schema session vector memory search evidence db decision sql cte datamart lsh). tht --help li list tutti. Suite: 165 passed. Il loop skill->LLM->gate ora ha tutti i comandi che la skill chiamera'. Resta: skill riscritta (S), setup pre-sessione (0b), sessione L2 manuale.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
from pathlib import Path
|
||||
|
||||
import typer
|
||||
|
||||
from tht.cli.config_cmd import CONFIG_OPT
|
||||
from tht.cli.schema_cmd import _load_config_or_exit
|
||||
from tht.cli.session_cmd import load_session_or_exit, session_dir
|
||||
|
||||
datamart_app = typer.Typer(help="Fase 8 — generazione dbt del datamart (hook)")
|
||||
|
||||
|
||||
@datamart_app.command("generate")
|
||||
def generate_cmd(
|
||||
session: str = typer.Option(..., "--session", help="Id della sessione."),
|
||||
mode: str = typer.Option(
|
||||
..., "--mode",
|
||||
help="Variante paziente: 'clear' (in chiaro) o 'pseudonymized' (mascherato).",
|
||||
),
|
||||
config: Path = CONFIG_OPT,
|
||||
) -> None:
|
||||
"""Innesca la generazione dbt del datamart (Fase 8). Hook: stub non operativo."""
|
||||
from tht.cli.phase_cmd import require_phase_or_exit
|
||||
from tht.datamart import DATAMART_MODES, generate_dbt_datamart
|
||||
|
||||
cfg = _load_config_or_exit(config)
|
||||
load_session_or_exit(cfg, session)
|
||||
if mode not in DATAMART_MODES:
|
||||
typer.secho(
|
||||
f"ERRORE: mode '{mode}' non valido. Valori: {', '.join(DATAMART_MODES)}",
|
||||
fg=typer.colors.RED, err=True,
|
||||
)
|
||||
raise typer.Exit(code=1)
|
||||
require_phase_or_exit(cfg, session, 8)
|
||||
try:
|
||||
generate_dbt_datamart(session_dir(cfg, session), mode)
|
||||
except NotImplementedError as e:
|
||||
typer.secho(
|
||||
f"NOTA: {e} (hook, mode={mode}). Nessuna azione eseguita.",
|
||||
fg=typer.colors.YELLOW,
|
||||
)
|
||||
raise typer.Exit(code=0)
|
||||
typer.secho(f"OK: dbt del datamart generato (mode={mode}).", fg=typer.colors.GREEN)
|
||||
Reference in New Issue
Block a user