@remits/remits-cli
v0.1.166
Published
Local CLI for auth, component sync, and live test execution against Remits
Maintainers
Readme
remits-cli
Local CLI for rapid Remits component testing without push/sync cycles.
Install
npm install -g @remits/remits-cliOn each command run, remits-cli checks the npm latest version for @remits/remits-cli. If a newer version exists, it installs it globally with npm and re-runs the original command. To skip this check for one run, pass --no-auto-update; to disable it for a process environment, set REMITS_CLI_AUTO_UPDATE=0.
Common Commands
remits-cli auth --base-url https://your-remits-host --account-id 123
remits-cli start
remits-cli status
remits-cli whoami
remits-cli stop
remits-cli install --skills
remits-cli tools
remits-cli tool --base-url http://localhost:8080 --name "My Tool" --input '{"foo":"bar"}'
remits-cli tool --name mcp_firestore_search --input '{"collection":"statements","documentId":"1234"}' --scope children
remits-cli workspace use --auto # once per checkout: your own staging lane
remits-cli components stage --workset # normal iteration: stage exactly what you changed
remits-cli components stage # FULL SNAPSHOT of the repo into the lane
remits-cli components status
remits-cli components clear
remits-cli test run --test 45
remits-cli test run --test "My New Test" --names "test case 1|test case 2"
git add -A
git commit -m "sync passing changes"
git push
remits-cli components sync --safe # variant branch: gated, dry-runs first, refuses surprises
remits-cli components sync doctor # read-only sync/promotion/staging diagnosis
remits-cli components sync
remits-cli components sync --branch feature_branch --dry-run
remits-cli components sync --branch feature_branch --dry-run --summary
remits-cli components sync --branch feature_branch --force-tombstones
remits-cli token --path page/my-embeddable # returns tokenKey/embeddableUrl, plus embedTokenKey/embedSnippet for host embeds
remits-cli token --path page/my-embeddable --variant-branch feature_branch
remits-cli token inspect --token https://example.test/s/<tokenKey>/page/my-embeddable
remits-cli tool --name mcp_account_user_admin --data-mode prod --input '{"action":"account_create","parentAccountId":4,"name":"Freto","type":"PRODUCT","dryRun":true}'
remits-cli data-mode
remits-cli data-mode set prod
remits-cli sessions list
remits-cli config set --agent codex
remits-cli activity inspect --account-id 4 --scope children --data-mode testLocal AI inference
Run remits-cli ai serve --agent codex --account-id 123 --base-url http://localhost:8080 in a terminal,
then opt in with ai(localAgent:true, ...). Claude, Gemini, and manual workers are also supported.
The supervisor resumes one native conversation per Remits session; workflow tools continue executing
on the server. The data lane defaults to test. See
local inference commands and limits.
Skill Install
remits-cli install --skillsOptional:
remits-cli install --skills --target codex
remits-cli install --skills --target claude
remits-cli install --skills --target gemini
remits-cli install --skills --target antigravity
remits-cli install --skills --overwrite trueHow It Works
cli/index.jsopens with a line-numbered code Table of Contents. Section entries are generated from the##section marker comments in the file. Runnpm run prepare:index-tocafter moving sections;npm testchecks that the prepared line numbers still point at the real headings.components stagehas three modes, and the difference decides what a run in the lane resolves:- default (full snapshot) — uploads the whole repository manifest and reconciles the lane to it, so stale aliases from prior stages are removed. Correct as a complete snapshot and as a "what is stale here?" reset; a poor progress signal, because the lane then holds every component in the repo.
--workset— uploads only the components git reports changed and reconciles the lane to exactly those. The normal iteration mode.--changed-only --replace-laneis the explicit spelling.--changed-only— uploads only the changed components and MERGES, leaving every other staged entry in place. It therefore cannot shrink a lane inherited from an earlier full snapshot; the command warns when it retains entries that way.
- An empty workset never clears a lane:
--workseton a clean working tree stages nothing and leaves the lane as it is. Pass--empty-workset clearto opt in, or usecomponents clear --all. - A deleted component file cannot be represented in Redis staging — clearing a staged entry falls back to the committed row, so the component still resolves. Those changes are reported as NOT REPRESENTABLE. On a non-trunk variant branch, prove a deletion through
components sync --dry-run --summary --fail-on-errors; on trunk there is no dry-run plan, so use the full pre-sync safety check before any mutating reconcile. - Schema
.meta.ymlsidecars can stage/sync the schema flags:enableTrigger,enableFullText,enableRAG,enableRevisions,enableBigQuerySync,enableRules,anchor, andauxiliary. components statusshows the branch/user staging entries that can shadow DB components during CLI-scoped test-mode execution, plus the other live lanes on the account.components laneslists every indexed staging lane on the account.components entries --lane-id <id>reads the authoritative staged files for one lane without switching your workspace, clearing anything, or using SQL.components clearclears staged entries. Scope it with--component-typeand/or--component-id. Component ids are type-local, so an id alone clears that one component when the id is staged in only one family; if the same id is staged across multiple families it returns an ambiguity error asking you to add--component-type. With no filter it clears every staged entry for the current branch; pass--allto force the full-branch wipe explicitly.components stage,components status,components lanes,components entries, andcomponents clearprint concise summaries by default. Add--jsonor--verboseto print the full server response.activity inspectis a read-only workstream view for operator/agent review. It joins staging lanes, verification envelopes, Test runs, corpus measurements, live agent presence, and heuristic smell signals. Use--scope childrenfrom a platform/root account and--user-emailor--user-idto focus on one CLI user.components stageandcomponents statusreport three separate numbers, and they answer three different questions: the workset (components git reports this working tree changed), what was submitted, and the materialized overlay the lane now holds — which is what a run resolves. A number that could not be established prints asunknown, never as0.components syncperforms a server-side sync from the git remote into the Remits platform for the selected branch. It does not run local git commands. After a successful non-dry-run sync, the platform clears the branch/user staging scope so staged aliases cannot keep shadowing the newly synced DB rows.- On trunk,
components syncperforms the full repo-to-DB reconcile. On a non-trunk branch, it writesComponentVariantoverlays only and may refresh branch-localaccount-info.json,account-hierarchy.json, andaccount-configurations.jsonfor the subscribing account that initiated the sync.--dry-runis accepted only for non-trunk variant syncs and reports overrides/additions/tombstones without writing variants, caching the sync SHA, updating metadata, or clearing staging. Add--summaryto dry-run output when you only need counts, removals/tombstones, errors, skipped items, and warnings.--force-tombstonesis accepted only for non-trunk variant syncs and should be used only when missing trunk component files are intentional tombstone overrides. components commitis a convenience wrapper that performs local git commit/push, thencomponents sync, then localgit fetch/git pull --ff-only.components syncreturns the post-sync branch SHA produced by the platform.components sync doctoris read-only and assembles local HEAD, origin HEAD, platform last-sync SHA, staging shadow risk, promotion freshness, repository mismatch, and the next safe action when sync state is confusing.components commitverifies thatorigin/<branch>and localHEADboth match the exact synced SHA after the final pull.components pushis deprecated and currently behaves the same ascomponents stage.accountIdresolution for CLI commands: explicit--account-idflag wins, then the current repo'saccount-info.json(resolution.accountId, then the short-livedrepoContext.accountInfoAccountId, then the legacy top-level id — legacy files are rooted at the hierarchy ROOT, so their top-levelidmay be an ancestor), then the active session.- For
remits-cli tool, read/discovery tools treat that resolved account as the scope root. You do not need the owning child account id for an exact document/record lookup: pass--scope children, or putscope:"children"in--input, and use the returnedresolvedTargetAccountIdfor follow-up writes/runs. Use--target-account-idwhen you already know the exact owner,--account-idsfor an explicit bounded owner list, and--anchor-account-idonly to disambiguate multi-parent paths. Mutating tools still require an exact target. - Auth sessions are stored per
accountId + dataMode + baseUrl, so the same account can stay authenticated against both localhost and production without overwriting the other session. - Active verification envelopes are scoped per
baseUrl + accountId + branch + workspace + dataMode, so a localhost envelope does not silently capture evidence from a production command. Pass--verify-envelope <id>for an intentional cross-context attachment. --base-urland--data-modeare independent.--base-urlchooses the Remits host (http://localhost:8080vs deployed prod), while--data-modechooses the data segment on that host (testvsprod). Do not assume--data-mode prodmeans the deployed prod host, or that--data-mode testmeans localhost.remits-cli startscans foraccount-info.jsonfiles and updates~/.remits-cli/account-repos.jsonbefore bringing up the background service. While running, it rescans every five minutes using asynchronous directory reads, then reports the refreshed inventory to the platform. Repos cloned outside the CLI are discovered without a restart or a command run inside them. Both scans useREMITS_CLI_SCAN_ROOTS(default: the home directory), the same depth limit and directory exclusions. For immediate discovery, useremits-cli agent repos --rescanor Rescan Account Repos in the control center.- Scans preserve manually selected repository directories and record competing checkouts as ambiguity.
remits-cli agent repos --account-id <id> --forgetsuppresses rediscovery until an explicit registration (--directory <path>) or a CLI command run from that account repo restores it. - Front-stage guides are not bundled with the CLI npm package. For account-work commands (
components,test,token,tools,tool) and onauth,remits-clidownloads the latest guides from the authenticated/cli/guidesendpoint and writes them into the current account repo: rootplatform-overview.md/development-guide.md,guides/*.md,guides/features/*.md, and the agent-guidance filesCLAUDE.md/AGENTS.md/GEMINI.md(fromdocs/front-stage/remits-components-zip-readme.md). - Guide sync requires authentication. If no valid session exists and the terminal is interactive, the CLI auto-authenticates first; in non-interactive contexts (CI, agent sandboxes) it skips silently so guides are only ever delivered to users who can authenticate to the platform.
- On every command,
remits-clirefreshes the installed remits-cliSKILL.mdand reference files forclaude,codex,gemini, andantigravityso local agents stay on the latest packaged instructions. - The platform repo's
docs/front-stage/tree remains the single source of truth; the platform serves it from the classpath, so published CLI versions never carry guide content. - Authenticated users also get the core Remits platform repo locally. After guide sync (and on
auth/ discovery),remits-clifirst reuses any existing local copy it already knows about, can detect directly (REMITS_PLATFORM_DIR, the running CLI source in dev,~/remits), or can discover under the configured scan roots; only if none is found does it clone[email protected]:tmillhouse/remits.git(default~/remits, override withREMITS_PLATFORM_DIR; cloning only runs in an interactive terminal). On each authenticated run it also fast-forwards the repo (git pull --ff-only, once per process) so back-stage analysis runs against current code — skipped automatically if the working tree is dirty, so local work is never clobbered. The repo is tracked in~/.remits-cli/account-repos.jsonunder the reservedplatformentry so agents can analyze back-stage seams and open a fix PR when a front-stage failure turns out to be platform brittleness. - Branch defaults to the current local git branch.
- Data mode defaults to
test. Forremits-cli test run, that default is now enforced even if the most-recent authenticated session for the account isprod; a production test run therefore requires an explicit--data-mode prodon the command line. Useremits-cli data-mode set prodonly for production investigation. - If the same account is authenticated against more than one host and you omit
--base-url, the CLI auto-resolves the best matching session and now prints the resolved host. Pass--base-urlexplicitly whenever the target host matters. --namesis|-delimited and may be repeated. A comma is part of the selector, so comma-bearing case names can be passed literally.- Nested help is available before required-argument validation, including
remits-cli test run --help,remits-cli components sync --help, andremits-cli tool --help. components sync --safeis the recommended agent path on a variant branch. It expands to--summary --changed-only --fail-on-errors --fail-on-removed, resolves--changed-sincefrom the branch's merge base with trunk when you did not name one (local refs only; it never runs an implicitgit fetch), and prints the planned writes before mutating unless--yesis passed. On trunk there is no plan to gate, so it states what a trunk reconcile does and requires--yes.components synchas fail-closed safety gates for unattended/agent use. Each exits non-zero instead of printing a wall of JSON:--changed-only(fail unless every planned write is a component this checkout edited),--names-only(print onlyBUCKET type:id namelines),--fail-on-removed,--fail-on-errors, and--expected-removed <type:id>(repeatable or comma-delimited; implies--fail-on-removed, so any removal you did not name fails).--changed-onlyalso fails closed when the checkout is not a git working tree, because "git could not answer" must never be read as "nothing changed".- Any command that can touch production prints a
PROD DATAbanner naming the operation, the resolved account, and the host, and distinguishes a live write from a live read (and from a dry run). This coverstool,test run, andcomponents sync. - When a tool call fails inside the platform runtime rather than inside the tool — Groovy reflective dispatch of a runtime-compiled component, an empty connection pool, a Redis reconnect, a lock-wait timeout — the server returns
503withfailureClass: "transient_infrastructure"andretryable: true, and the CLI printsTRANSIENT INFRASTRUCTURE FAILURE (retryable). A genuine tool error stays a500withfailureClass: "tool_error". Retry the first; do not retry the second. - Test activity is streamed from websocket
TestSuiteevents while final status is also polled from/cli/test. - Tool execution writes the full response to a separate file so large payloads do not bloat the session log.
--variant-branch <name|none>is available ontest run,token,tools, andtool. Use it to probe a committed branch variant from any checkout; omit it to resolve the execution account's normal subscription, or passnone/trunkto force subscription semantics from a variant checkout.- On
test run,--branch <name>is only the Redis staging namespace. Pair an unused value with--variant-branch nonewhen existing staged entries on the real git branch would shadow committed trunk/variant rows. Do not apply that shortcut tocomponents syncorcomponents commit, where--branchnames the GitHub branch to reconcile.
Service, Dashboard, and WebSocket Lifecycle
- The primary lifecycle commands are
remits-cli start,remits-cli stop, andremits-cli status. remits-cli listen,remits-cli listen stop, andremits-cli listen statusstill work as compatibility aliases.- Most non-lifecycle commands auto-start the background service if authenticated sessions already exist and no service is running.
- Successful
remits-cli authalso attempts to auto-start the background service. remits-cli startstarts a detached background process by default. Useremits-cli start --foreground trueonly when you want to run the daemon in the current terminal.remits-cli statusreports whether the background service is alive, prints the dashboard URL when available, and prints the resolved session tuple: Account ID, User ID, current git branch, and active data mode.remits-cli whoamiprints only the resolved session tuple. Use--base-url,--account-id, and--data-modeto prove the exact host/account/lane before running a tool or test.- Both print two data modes. "Data mode" governs
tool/tools/tokenand falls back to the stored session lane; "Data mode (test run)" governstest run, which ignores the session and defaults totestunless--data-mode prodis passed. The test-run line also reports its source, such ascliDefaultorexplicitFlag. remits-cli stopstops the background service.- The service starts a localhost dashboard that acts as a control center for remits-cli integration state.
- The dashboard shows websocket connection health, topic subscriptions, registered agents, live and recent worker runs, the discovered account repo index, global state files, and per-repo remits-cli files.
- If websocket connections are disconnected, the dashboard exposes an action to reconnect them.
- The service groups sessions by
baseUrlso one websocket connection can service multiple authenticated accounts on the same Remits environment. - Websocket subscriptions are deduplicated by user topic. If multiple authenticated accounts share the same websocket topic, the listener subscribes once and maps that topic back to all related accounts.
- The daemon keeps STOMP heartbeats enabled and runs a maintenance watchdog that recreates unhealthy websocket connections.
- Terminal server authentication/authorization errors suspend WebSocket retries and show
authentication_required. Reauthenticate to replace the managed client's credentials; the watchdog does not revive rejected credentials. Transient failures use jittered exponential backoff up to 60 seconds. Test watchers keep HTTP polling; restart local-AI workers after reauthentication. - If the machine sleeps, the network drops, or auth sessions change while the daemon is already running, the service now attempts to reconnect and resubscribe automatically once connectivity returns.
- Support tickets are the primary unit of dispatched work. A serving agent launches one fresh worker process per routed ticket.
- Agent sessions register themselves with
remits-cli agent registerorremits-cli agent serve;servealso starts the local supervisor. - Tickets are delivered by durable routing on the ticket record, then the agent asks for routed work with
remits-cli agent work. - The preferred worker comes from
remits-cli config set --agent claude|codex|gemini. The default isclaude.
Support Tickets
- Support tickets are stored as documents in the
support_ticketscollection. - New tickets and ticket updates are recorded centrally; local agents receive work by polling for tickets routed to their registered session.
- Think of this as a lightweight local support queue: the platform owns the record and lifecycle verbs, while account components can layer their own helpdesk workflow on top.
accountId/accountNameidentify the account that owns the ticket.- If present,
implementationAccountId/implementationAccountNameidentify the platform or product context that owns the shared implementation. - Worker repo resolution prefers
implementationAccountIdwhen present, then falls back toaccountId. If one of those repos is indexed locally in~/.remits-cli/account-repos.json, it is used as the worker's directory. - Agents must resolve account
type(PLATFORM,PRODUCT,CLIENT) before deciding which local repo to use. ACLIENTticket may still require code changes in a parentPLATFORMorPRODUCTrepo. - Use
remits-cli ticketto manage the generic platform ticket lifecycle:
remits-cli ticket read --ticket 123 --data-mode prod
remits-cli ticket accept --ticket 123 --data-mode prod
remits-cli ticket status --ticket 123 --status in_progress --notes "Investigating logs" --data-mode prod
remits-cli ticket complete --ticket 123 --resolution "Fixed and verified" --data-mode prod- Recommended ticket flow:
readfirst, thenaccept, thenstatusas work progresses, thencomplete,ask, orrelease.
Logging and State Files
There are two separate state areas:
- Repo-local state in
./.remits-cli/for request/response artifacts tied to the current working tree. - Global state in
~/.remits-cli/for authentication, listener lifecycle, and cross-repo account mapping.
Repo-local state
./.remits-cli/sessions/<current-session>.jsonlRecords all/cli/*HTTP requests made from the current repo session../.remits-cli/tool-responses/<callId>.jsonStores full tool responses forremits-cli tool../.remits-cli/tools/tools.jsonCached tool definitions for the current repo../.remits-cli/current-session.txtTracks the active local session log name.
Global state
~/.remits-cli/sessions.jsonAuth sessions keyed by account ID, base URL, and data mode so local and production sessions can coexist safely.~/.remits-cli/config.jsonCLI config such as the preferred agent.~/.remits-cli/listener.pidPID for the background remits-cli service process.~/.remits-cli/service-state.jsonDashboard URL, repo scan summary, and websocket state snapshot for the running service.~/.remits-cli/account-repos.jsonIndex of known account repositories on this machine, rebuilt byremits-cli startvia account-info discovery and also refreshed when commands run inside an account repo.~/.remits-cli/agents.jsonAgent sessions registered from this machine, including the process each one is anchored to.~/.remits-cli/workers.jsonActive and recent ticket worker state for serving agents.~/.remits-cli/activity.logHuman-readable global activity log for service lifecycle, websocket events, agent registration, and ticket routing.
Control Center
remits-cli startprints or records a localhost dashboard URL such ashttp://127.0.0.1:8787/.- Open that page in a browser to inspect the full local remits-cli integration state without manually opening JSON files.
- The page refreshes automatically and includes the latest global state files plus per-repo
account-info.json, local tools snapshot, and current session log tail for every indexed account repo. Large account configuration fields live inaccount-configurations.jsonand should be opened only when needed.
Activity Log
~/.remits-cli/activity.logis the quickest way to understand what the service, websocket clients, and local agents are doing.- It records timestamped lifecycle events such as service start/stop, websocket connect/disconnect, topic subscription, agent registration/heartbeat, ticket routing, worker launch, and worker completion.
- Prompt bodies are not written verbatim to this log. The log stores summarized metadata such as
accountId,ticketId, available keys, and prompt length. - Typical inspection commands:
tail -f ~/.remits-cli/activity.log
tail -n 200 ~/.remits-cli/activity.logOperational Notes
- In sandboxed local agent environments,
remits-clinetwork calls may fail withENOTFOUND,EAI_AGAIN,ECONNREFUSED,EPERM, or similar errors even when dispatch worked correctly. That means the command needs escalated permissions or must be run outside the sandbox. - If the platform returns a 500 or other unexpected server-side failure, stop normal task execution and escalate to a Remits system admin. Agents should not invent workarounds for platform faults.
- Recommended durable update flow for agents:
components stage --worksetfor testing, thengit add/commit/push, thenremits-cli components sync --safe, thengit pull --ff-onlyto confirm platform-generated files likeaccount-info.json. To verify the COMMITTED variant rather than your staging, runcomponents clear --allfirst — staged entries still win for CLI-scoped runs. - In sandboxed agent environments, local git writes may require a single approval step. If you want to minimize approval churn,
remits-cli components commitconsolidates the local git and sync phases into one CLI command. - If account repo discovery fails for a websocket message, dispatch is skipped because the listener does not know which local directory to open for that account.
- If you authenticate a new account while the listener is already running, the listener now refreshes its websocket clients automatically instead of requiring a manual restart.
- Session logs redact token fields and replace large component content fields with length summaries.
