Implementazione del piano di remediation progressiva sui difetti emersi dall'analisi dell'harness. Tutto verificato: 214 test Python (incl. L0 su Postgres reale), 14 test JS del gate, ruff pulito. Blocco 1 (CRITICA, integrazione gate↔CLI): - phase advance: gate usa --auto + exit 6; reviewer_confirm kind:phase fa advance esplicito che applica i prerequisiti (prima non avanzava per le fasi a conferma umana). - cte plan riceve i --name dal gate (param names); set-question con id posizionale; skill `tht search find`; nuovo comando `tht memory save-one` con dedup hash client-side in save_one_memory. Blocco 2 (D15, stato post-rollback): - campo `phase` su DecisionRecord + effective_decisions phase-aware per i subject "a nome" (cte_approved ecc.); _compute_promotions e finalize sulla vista effective; finalize confronta col piano CTE effettivo, non glob; `decision add --retracts` + comando `decision retract`. Blocco 3 (D7 read-only + D6 manifest): - assert_read_only su tutti e quattro i codepath (direct + REST); - manifest author/summary/updated_at/updated_by/schema_version popolati + helper touch_manifest sulle mutazioni. Blocco 4-5 (D14a/D14b): - decision_min_phase data-driven via `emits:` in workflow.yaml; - formula evidence: status auto, search_formulas, gruppo CLI `tht formula`, `search find --kind formula`, load_evidence_dir salta i .sql.md. Blocco 6 (robustezza): - taskdoc slice promoted_tables + bound enforced; report escaping/bound + rsplit note; filtro kind reader REST/direct; conteggio upserted robusto; guard REST run_query non-list; LSH disallineato -> LshIndexError. Blocco 7 (pulizia): - dead code gate e KIND_TO_TABLE morto rimossi; doc Postgres-only (README + connection.py). Blocco 0 (parziale): test di compatibilità firma gate↔CLI (tests/integration). Rinviati: fake-Pi runtime completo, artifact-gate da disco (#23), parità eligibility REST/direct (#28), unificazione reserved-labels (#30), memory_rejected da deselezione (#33). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
70 lines
2.3 KiB
Python
70 lines
2.3 KiB
Python
"""tht CLI -- Typer app `tht`.
|
|
|
|
Minimal skeleton for now: registers `phase_app` (the gate needs `tht phase meta --json`).
|
|
Other command groups (db, schema, lsh, vector, memory, session, decision, sql, cte,
|
|
evidence, search) are wired in their porting tasks, once their backend deps land
|
|
(A9 ports db/mschema/_guards; B1 ports vectorstore; B3 ports search/lshindex/sampling).
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import typer
|
|
|
|
from tht import __version__
|
|
|
|
app = typer.Typer(
|
|
help="tht (Thoth) -- kit operativo per generazione SQL assistito da Pi",
|
|
no_args_is_help=True,
|
|
)
|
|
|
|
|
|
def _version_callback(value: bool) -> None:
|
|
if value:
|
|
typer.echo(__version__)
|
|
raise typer.Exit()
|
|
|
|
|
|
@app.callback()
|
|
def main(
|
|
version: bool = typer.Option(
|
|
False,
|
|
"--version",
|
|
callback=_version_callback,
|
|
is_eager=True,
|
|
help="Mostra la versione ed esce.",
|
|
),
|
|
) -> None:
|
|
pass
|
|
|
|
|
|
from tht.cli.config_cmd import config_app # noqa: E402
|
|
from tht.cli.cte_cmd import cte_app # noqa: E402
|
|
from tht.cli.datamart_cmd import datamart_app # noqa: E402
|
|
from tht.cli.db_cmd import db_app # noqa: E402
|
|
from tht.cli.decision_cmd import decision_app # noqa: E402
|
|
from tht.cli.evidence_cmd import evidence_app # noqa: E402
|
|
from tht.cli.formula_cmd import formula_app # noqa: E402
|
|
from tht.cli.lsh_cmd import lsh_app # noqa: E402
|
|
from tht.cli.memory_cmd import memory_app # noqa: E402
|
|
from tht.cli.phase_cmd import phase_app # noqa: E402
|
|
from tht.cli.schema_cmd import schema_app # noqa: E402
|
|
from tht.cli.search_cmd import search_app # noqa: E402
|
|
from tht.cli.session_cmd import session_app # noqa: E402
|
|
from tht.cli.sql_cmd import sql_app # noqa: E402
|
|
from tht.cli.vector_cmd import vector_app # noqa: E402
|
|
|
|
app.add_typer(phase_app, name="phase")
|
|
app.add_typer(config_app, name="config")
|
|
app.add_typer(schema_app, name="schema")
|
|
app.add_typer(session_app, name="session")
|
|
app.add_typer(vector_app, name="vector")
|
|
app.add_typer(memory_app, name="memory")
|
|
app.add_typer(search_app, name="search")
|
|
app.add_typer(evidence_app, name="evidence")
|
|
app.add_typer(formula_app, name="formula")
|
|
app.add_typer(db_app, name="db")
|
|
app.add_typer(decision_app, name="decision")
|
|
app.add_typer(sql_app, name="sql")
|
|
app.add_typer(cte_app, name="cte")
|
|
app.add_typer(datamart_app, name="datamart")
|
|
app.add_typer(lsh_app, name="lsh")
|