Skip to content

feat(cli): Trinity CLI tool with email auth onboarding (#231) - #245

Merged
vybe merged 2 commits into
mainfrom
feature/231-trinity-cli
Apr 2, 2026
Merged

vybe merged 2 commits into
mainfrom
feature/231-trinity-cli

Conversation

@vybe

@vybe vybe commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds trinity CLI (Python Click, pip-installable from src/cli/) with 20 core commands: agents, chat, logs, health, skills, schedules, tags
  • Implements trinity init onboarding flow: configure instance → auto-register email → email/code login → ready
  • New backend endpoint POST /api/access/request for auto-approve whitelist registration (rate-limited, idempotent)
  • JSON output by default, --format table via Rich for human-readable display

Changes

  • src/cli/ — 14 new files (CLI package)
  • src/backend/routers/auth.py — new /api/access/request endpoint (+62 lines)
  • docs/CLI.md — CLI usage documentation
  • docs/memory/feature-flows/cli-tool.md — feature flow
  • docs/memory/requirements.md — Section 30 (CLI-001)
  • docs/memory/feature-flows.md — index update

Test Plan

  • trinity --help shows all commands
  • trinity agents list --format table returns live data
  • trinity health fleet, trinity logs, trinity tags list verified against running backend
  • POST /api/access/request auto-approves and is idempotent
  • Rate limiting records attempts correctly (C1 fix from /review)
  • CSO --diff audit: 0 findings above confidence gate
  • Manual: trinity init full onboarding flow with email verification

Closes #231

Generated with Claude Code

vybe and others added 2 commits April 2, 2026 10:51
Adds a pip-installable Python Click CLI (`trinity`) that provides shell-level
access to the platform. Includes email-based login flow with auto-approve
access request endpoint for public instance onboarding, plus 20 core commands
covering agents, chat, logs, health, skills, schedules, and tags.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
9 smoke tests covering the POST /api/access/request endpoint: happy path,
idempotency, input validation, email normalization, and whitelist integration.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@vybe
vybe merged commit 7dc9138 into main Apr 2, 2026
dolho added a commit that referenced this pull request Aug 25, 2026
…253)

Audit first, per the issue's own AC #1: all 31 interval-refreshed files, each
with its verdict and the evidence for it, posted as a comment on ent#253 before
any change. #1927 had already fixed four surfaces and shipped the rule
(`utils/loadingState.js::viewState`) plus the bare-gate ratchet, so most of the
inventory was already green. Three were not: MetricsPanel, DashboardPanel, and
ObservabilityPanel via the observability store.

All three shared a defect worse than the cosmetic one the issue describes. The
re-flash was real — each set its loading flag inside the function the poll
calls, so the panel was replaced by a spinner on every tick — but the `catch`
was the serious half: it OVERWROTE the data with a synthetic empty payload
(`{has_metrics: false}`, `{has_dashboard: false}`, `available = false`). One
transient 502 therefore rewrote a working agent as one with no metrics, no
dashboard, or an unreachable collector, and the real values were gone until the
next success — a claim about the subject manufactured out of a claim about the
request, which is #1926 one layer down. Each also logged to `console.error` and
nowhere else.

The fix, per surface: gate on "no data yet" via `viewState`, keep `loading`
meaning "fetch in flight" for the retry labels, keep the data on a failed
refresh and raise the shared stale banner beside it (never as an else-if arm,
which would replace the data it promises to keep), give a failed FIRST load a
`LoadFailed` with a retry — distinct from the empty state, which is a statement
about the agent — and replace the bespoke spinners with the #245
`ScanlineReveal` primitive, which brings `prefers-reduced-motion` with it. The
agent-switch watchers clear the error too, so agent B's first failure is not
reported with agent A's detail. In the store, a transport failure is now held
apart from `error`, which carries the collector's own message out of a
successful response — collapsing the two let a dropped request read as the
collector declaring itself down.

Verified live against a local stack (Vite-mounted branch source) on the one
mounted surface, driving the panel's real 30s poll with the endpoint aborting:
the loading face is never re-entered, the dashboard stays on screen, the "no
dashboard" empty state does not appear, and the stale banner does.

Honest scope, and it corrects the audit: MetricsPanel and ObservabilityPanel
turn out to be mounted by NOTHING (`stores/observability.js` has exactly one
consumer — that orphaned panel). Their defect is real in code and unreachable
in the app; the live win is DashboardPanel. Correction posted on the issue, and
the convention note now says to record consumer-reachability in the audit,
because `grep setInterval` finds code that polls, not surfaces a user reaches.

Out of scope and untouched: ReplayTimeline (excluded by the issue), and the
bare gates on surfaces that do not poll — they re-flash only on a user-triggered
refetch, which is a different complaint, and they stay in the ratchet baseline.

Related to Abilityai/trinity-enterprise#253

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
dolho added a commit that referenced this pull request Aug 25, 2026
…253)

Audit first, per the issue's own AC #1: all 31 interval-refreshed files, each
with its verdict and the evidence for it, posted as a comment on ent#253 before
any change. #1927 had already fixed four surfaces and shipped the rule
(`utils/loadingState.js::viewState`) plus the bare-gate ratchet, so most of the
inventory was already green. Three were not: MetricsPanel, DashboardPanel, and
ObservabilityPanel via the observability store.

All three shared a defect worse than the cosmetic one the issue describes. The
re-flash was real — each set its loading flag inside the function the poll
calls, so the panel was replaced by a spinner on every tick — but the `catch`
was the serious half: it OVERWROTE the data with a synthetic empty payload
(`{has_metrics: false}`, `{has_dashboard: false}`, `available = false`). One
transient 502 therefore rewrote a working agent as one with no metrics, no
dashboard, or an unreachable collector, and the real values were gone until the
next success — a claim about the subject manufactured out of a claim about the
request, which is #1926 one layer down. Each also logged to `console.error` and
nowhere else.

The fix, per surface: gate on "no data yet" via `viewState`, keep `loading`
meaning "fetch in flight" for the retry labels, keep the data on a failed
refresh and raise the shared stale banner beside it (never as an else-if arm,
which would replace the data it promises to keep), give a failed FIRST load a
`LoadFailed` with a retry — distinct from the empty state, which is a statement
about the agent — and replace the bespoke spinners with the #245
`ScanlineReveal` primitive, which brings `prefers-reduced-motion` with it. The
agent-switch watchers clear the error too, so agent B's first failure is not
reported with agent A's detail. In the store, a transport failure is now held
apart from `error`, which carries the collector's own message out of a
successful response — collapsing the two let a dropped request read as the
collector declaring itself down.

Verified live against a local stack (Vite-mounted branch source) on the one
mounted surface, driving the panel's real 30s poll with the endpoint aborting:
the loading face is never re-entered, the dashboard stays on screen, the "no
dashboard" empty state does not appear, and the stale banner does.

Honest scope, and it corrects the audit: MetricsPanel and ObservabilityPanel
turn out to be mounted by NOTHING (`stores/observability.js` has exactly one
consumer — that orphaned panel). Their defect is real in code and unreachable
in the app; the live win is DashboardPanel. Correction posted on the issue, and
the convention note now says to record consumer-reachability in the audit,
because `grep setInterval` finds code that polls, not surfaces a user reaches.

Out of scope and untouched: ReplayTimeline (excluded by the issue), and the
bare gates on surfaces that do not poll — they re-flash only on a user-triggered
refetch, which is a different complaint, and they stay in the ratchet baseline.

Related to Abilityai/trinity-enterprise#253

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trinity CLI tool mirroring MCP server

1 participant