Skip to content

Rationalize tsh — cut Workbench-superseded UI/diagnostics, reposition as automation-first CLI #454

Closed
6 of 6 issues completed

Description

@nockawa

Summary

tsh predates the Workbench. Its original "diagnostic-first" charter (per claude/design/Apps/TyphonShell/) is now obsolete: the Workbench's Open mode hosts the same in-process DatabaseEngine, so it has identical internal access plus a real GUI (Resource Tree, sortable schema/archetype browsers, Hilbert-curve File Map, byte-grid layouts, Storage Health, Engine Live Health, live Query Console). Every tsh command whose job is "a human stares at engine internals" is now strictly inferior to its Workbench panel.

What the Workbench cannot do — confirmed: its only data-mutating endpoint is OptionsController.PUT (its own settings) — is change data, drive transactions, run migrations, stream logs, or run headless in CI. That is tsh's durable identity.

This Feature repositions tsh from "diagnostic-first" to "automation-first" — the scriptable, mutating, CI-facing sqlite3-analog — by removing UI/diagnostics the Workbench supersedes and keeping everything only a CLI can do.

Guiding principle: exploration/visualization → Workbench; automation/assertion/mutation → tsh. The test for any command: does its output feed another program (keep) or a pair of human eyes (cut)?

Context: sibling Feature #435 (Distribution & Packaging), Epic #146 (Developer Experience & Adoption). Assessment sources: claude/design/Apps/TyphonShell/, claude/design/Apps/Workbench/views/, .../inventory/views-and-panels.md.

Decision matrix

Legend: 🔴 remove now · 🟠 cut interactive UI, keep JSON/CI probe · 🟢 keep · (🟡 "cut-after-parity" was folded into 🟢 keep — no Workbench equivalent exists, so keep behind clean scriptable output and retire only if/when the Workbench ships parity).

Interactive UI

Item Decision Reason
resources Terminal.Gui full-screen explorer + Tui/ResourceExplorer.cs 🔴 remove Duplicates the shipped Resource Tree panel badly; a TUI is the opposite of scriptable.
resources --flat (plain table) 🟢 keep (optional) Scriptable resource dump; free once the TUI is gone.
Spectre.Console output 🟢 keep Not a UI — it's result rendering (tsh's sqlite3 box-drawing).

Test / fixture generation

Item Decision Reason
arpg-generate shipped in tsh (the test/Typhon.ARPG.Shell ProjectReference) 🔴 remove Shipped tool bundling a test/ fixture generator — inverted src→test dep; the Workbench gates its own fixtures #if DEBUG. Safe: tsh code uses no ARPG types.
Extension mechanism (Typhon.Shell.Extensibility, ShellCommand, sibling discovery) 🟢 keep tsh-unique extensibility; arpg-generate is only its sample consumer.
Typhon.ARPG.Schema 🟢 keep Used independently by Typhon.Benchmark; tsh only pulled it transitively.

Diagnostics

Command Decision Reason
page-dump, cache-pages, segments, segment-detail 🔴 remove Database File Map shipped (`/dbmap/page
list-archetypes 🔴 remove Archetype Browser shipped.
entity-info 🔴 remove Data Browser + Detail shipped.
db-stats, cache-stats, memory, transactions 🟠 cut UI, keep JSON Storage Health + Engine Live Health shipped for humans; keep pipeable numbers for CI/monitoring.
btree, btree-dump, stats-show, revisions, mvcc-stats 🟢 keep (retire-if-parity) No Workbench equivalent (B+tree walker / MVCC time-travel / histograms are engine-gated or Phase 2). Keep behind clean text/JSON; retire only when the Workbench ships parity.
btree-validate 🟢 keep Pass/fail assertion → CI. No equivalent.
stats-rebuild 🟢 keep An action (maintenance op), not a viewer.

Core identity — keep all (no Workbench substitute)

REPL + -c/-e/pipe/.tshrc; create/read/update/delete (Workbench can't mutate); begin/commit/rollback (no Workbench tx control); migrate/migrate-legacy (Workbench migration is a disabled stub); open/close/info, load-schema/reload-schema; set/echo/help/history/exit/log-level/pause; json/csv formatters; schema-validate/schema-diff/schema-export/schema-history (CI schema-drift); schema-list/describe/schema-fields (cheap scriptable text).

Acceptance criteria

  • Terminal.Gui full-screen TUI removed; Terminal.Gui package dropped from Typhon.Shell.csproj; solution builds green.
  • arpg-generate no longer ships in tsh (ProjectReference dropped); extension mechanism + Typhon.ARPG.Schema intact; ARPG.Shell keep-as-example vs delete resolved.
  • GUI-superseded diagnostics removed (page-dump, cache-pages, segments, segment-detail, list-archetypes, entity-info).
  • db-stats, cache-stats, memory, transactions emit clean JSON/CI-pipeable output; Spectre tables dropped.
  • Retained diagnostics (btree, btree-dump, stats-show, revisions, mvcc-stats, btree-validate, stats-rebuild) have clean scriptable text/JSON; "retire-if-parity" noted in docs.
  • tsh design docs + help/README updated from "diagnostic-first" to "automation-first"; removed commands documented.
  • Full test suite green.

Tasks

See linked sub-issues.

Sub-issues

Sub-issues

6 of 6 Issues completed
Loading 6 sub-issues

Activity

  1. added this to the alpha-1 milestone on Jul 4, 2026
  2. added theissue type on Jul 4, 2026
  3. added
    refactoring
    technical-debt
    on Jul 4, 2026
  4. moved this to Todo in Typhonon Jul 4, 2026
  5. updated Product CLI, Priority P1-High and Estimate L on Jul 4, 2026
  6. modified the milestones: alpha-1, pre-alpha on Jul 4, 2026
  7. moved this from Todo to In Progress in Typhonon Jul 4, 2026
  8. nockawa commented on Jul 4, 2026

    @nockawa
    CollaboratorAuthor

    Implementation plan (accepted — autonomous execution)

    Scope: the remaining work after #455 (TUI removed) and #456 (ARPG fixture reference dropped), both already code-complete on feature/454-tsh-rationalization. Executed autonomously per owner direction; the issue's decision matrix is the agreed spec.

    Acceptance criteria

    1. ARPG.Shell relocated test/ → examples/ as the canonical extension-command example (owner-confirmed keep-as-example); solution builds. (finishes tsh: stop shipping the ARPG fixture generator (drop test ProjectReference) #456)
    2. Removed GUI-superseded diagnostics: page-dump, cache-pages, segments, segment-detail, list-archetypes, entity-info (dispatch + handlers + dead helpers + help). (tsh: remove GUI-superseded diagnostics (page-dump/cache-pages/segments/segment-detail/list-archetypes/entity-info) #457)
    3. Demoted db-stats, cache-stats, memory, transactions to clean JSON/CI probes — --format json yields parseable output, no Spectre markup in the machine path; compact human default kept. (tsh: demote aggregate stats to JSON/CI probes (db-stats/cache-stats/memory/transactions) #458)
    4. Hardened kept-with-no-Workbench-equivalent diagnostics (btree, btree-dump, stats-show, revisions, mvcc-stats) with a scriptable JSON path; btree-validate/stats-rebuild unchanged; "retire-if-parity" noted in help + design doc. (tsh: keep + harden no-Workbench-equivalent diagnostics (btree, btree-dump, stats-show, revisions, mvcc-stats) #459)
    5. Docs + help repositioned from "diagnostic-first" to "automation-first" incl. a tsh-vs-Workbench division-of-labor section; removed commands dropped from help. (tsh: update design docs + help to the automation-first repositioning #460)
    6. Build + full suite green (clean rebuild; engine suite; tsh JSON smoke where feasible).
    7. Code-review gate passes before completion.

    Note: the Shell has no dedicated test project; removals are proven by build + command-absence, JSON probes by a live tsh smoke run. A dedicated Shell test project is noted as a follow-up, out of this Feature's scope.

  9. nockawa commented on Jul 4, 2026

    @nockawa
    CollaboratorAuthor

    ✅ Implementation complete — ready for review + commit (not yet committed)

    Branch feature/454-tsh-rationalization (main repo + claude/ subrepo). Net −863 lines (217 added / 1080 deleted) — a rationalization is mostly subtraction.

    Acceptance criteria — all met

    # AC Evidence
    1 ARPG.Shell relocated test/→examples/ (kept as extension example) git mv (history preserved); ARPG.Schema ref re-pathed; .slnx updated; examples/README.md; builds
    2 6 GUI-superseded diagnostics removed page-dump/cache-pages/segments/segment-detail/list-archetypes/entity-info — dispatch + handlers + exclusive helpers + help + autocomplete/highlighting all gone; live smoke: each now errors "Unknown command"
    3 db-stats/cache-stats/memory/transactions → JSON/CI probes Live smoke: all four emit valid, jq-parseable JSON under --format json; transactions carries a truncated flag
    4 Kept diagnostics hardened btree+mvcc-stats gained JSON; btree-validate/stats-rebuild unchanged; revisions/stats-show/btree-dump kept as clean text (deviation — see below); "retire-if-parity" in help + design doc
    5 Docs + help repositioned Help catalog/detail updated; Terminal.Gui TUI + package removed; design-doc "automation-first" section + tsh-vs-Workbench division; examples/README.md
    6 Build + verify Full solution restore 25/25; Shell/Benchmark/Engine.Tests build; live tsh JSON smoke green
    7 Code-review gate Multi-agent review: 0 Critical/High, 0 bugs; findings addressed (below)

    Deviations (flagged, not silent)

    • revisions/stats-show/btree-dump kept as text, not JSON. They are per-entity/structural dumps, not monitoring probes, and are retire-slated — JSON there would gold-plate code marked for removal. The two genuine probe-shaped commands (btree, mvcc-stats) did get JSON.
    • Full engine test suite not executed. The diff is provably Shell/examples/docs-only (0 engine or test-project files; solution restores clean; test tree compiles), so the engine unit suite can't exercise this change. The Shell has no test project — behavior verified by a live tsh smoke run.

    Review findings addressed

    • Removed a dead using System.Runtime.InteropServices; (its only user was the deleted page-dump).
    • Simplified ExecuteResources() — params went dead with the --flat branch.
    • Added a truncated flag to the transactions JSON (probe can now distinguish "50" from ">50").

    Recommended follow-up (needs an owner call — structural)

    The reviewer's one substantive gap: the JSON field names are now the CI/jq contract but nothing guards them — a silent rename compiles clean and breaks consumers. A Typhon.Shell.Tests project with JSON-contract snapshot tests would close this (requires a new test project + InternalsVisibleTo, so it's out of this removal-focused Feature's scope). Suggest filing as a separate Task.

    Handoff per convention: not committed — ready for your commit. After merge, /complete-task #454 will close it out.

  10. added a commit that references this issue on Jul 4, 2026
  11. moved this from In Progress to Done in Typhonon Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactoringtechnical-debt

    Fields

    Priority

    P1-High

    Estimate

    L

    Area

    None yet

    Start date

    None yet

    Target date

    None yet

    Product

    CLI

    Projects

    • Status
      Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions