@remits/remits-cli 0.1.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +180 -0
- package/index.js +4379 -0
- package/package.json +40 -0
- package/skills/remits-cli/SKILL.md +1278 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Remits
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# remits-cli
|
|
2
|
+
|
|
3
|
+
Local CLI for rapid Remits component testing without push/sync cycles.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @remits/remits-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
On 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`.
|
|
12
|
+
|
|
13
|
+
## Common Commands
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
remits-cli auth --base-url https://your-remits-host --account-id 123
|
|
17
|
+
remits-cli start
|
|
18
|
+
remits-cli status
|
|
19
|
+
remits-cli stop
|
|
20
|
+
remits-cli install --skills
|
|
21
|
+
remits-cli tools
|
|
22
|
+
remits-cli tool --base-url http://localhost:8080 --name "My Tool" --input '{"foo":"bar"}'
|
|
23
|
+
remits-cli components stage
|
|
24
|
+
remits-cli test run --test 45
|
|
25
|
+
remits-cli test run --test "My New Test" --names "test case 1,test case 2"
|
|
26
|
+
git add -A
|
|
27
|
+
git commit -m "sync passing changes"
|
|
28
|
+
git push
|
|
29
|
+
remits-cli components sync
|
|
30
|
+
remits-cli token --path page/my-embeddable
|
|
31
|
+
remits-cli data-mode
|
|
32
|
+
remits-cli data-mode set prod
|
|
33
|
+
remits-cli sessions list
|
|
34
|
+
remits-cli config set --agent codex
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Skill Install
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
remits-cli install --skills
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Optional:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
remits-cli install --skills --target codex
|
|
47
|
+
remits-cli install --skills --target claude
|
|
48
|
+
remits-cli install --skills --target gemini
|
|
49
|
+
remits-cli install --skills --overwrite true
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## How It Works
|
|
53
|
+
|
|
54
|
+
- `components stage` uploads the current working tree into the staging cache used by test-mode execution.
|
|
55
|
+
- `components sync` performs a server-side sync from the git remote into the Remits platform for the selected branch. It does not run local git commands.
|
|
56
|
+
- `components commit` is a convenience wrapper that performs local git commit/push, then `components sync`, then local `git fetch`/`git pull --ff-only`.
|
|
57
|
+
- `components sync` returns the post-sync branch SHA produced by the platform. `components commit` verifies that `origin/<branch>` and local `HEAD` both match that exact SHA after the final pull.
|
|
58
|
+
- `components push` is deprecated and currently behaves the same as `components stage`.
|
|
59
|
+
- `accountId` resolution for CLI commands: explicit `--account-id` flag wins, then the current repo's `account-info.json`, then the active session. For `remits-cli tool` calls the server applies a further precedence — explicit `--account-id` > `input.accountId` > session/repo default — so a tool can execute against a different account than the surrounding repo.
|
|
60
|
+
- 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.
|
|
61
|
+
- `remits-cli start` scans the machine for `account-info.json` files and rebuilds `~/.remits-cli/account-repos.json` before bringing up the background service.
|
|
62
|
+
- Front-stage guides are **not** bundled with the CLI npm package. For account-work commands (`components`, `test`, `token`, `tools`, `tool`) and on `auth`, `remits-cli` downloads the latest guides from the authenticated `/cli/guides` endpoint and writes them into the current account repo: root `platform-overview.md` / `development-guide.md`, `guides/*.md`, `guides/features/*.md`, and the agent-guidance files `CLAUDE.md` / `AGENTS.md` / `GEMINI.md` (from `docs/guides/remits-components-zip-readme.md`).
|
|
63
|
+
- 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.
|
|
64
|
+
- During account-repo discovery, `remits-cli` also overwrites the installed remits-cli `SKILL.md` for `claude`, `codex`, and `gemini` so local agents stay on the latest packaged instructions.
|
|
65
|
+
- The platform repo's `docs/guides/` tree remains the single source of truth; the platform serves it from the classpath, so published CLI versions never carry guide content.
|
|
66
|
+
- Authenticated users also get the **core Remits platform repo** locally. After guide sync (and on `auth` / discovery), `remits-cli` ensures `git@github.com:tmillhouse/remits.git` is cloned (default `~/remits`, override with `REMITS_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 clone is tracked in `~/.remits-cli/account-repos.json` under the reserved `platform` entry so agents can analyze back-stage seams and open a fix PR when a front-stage failure turns out to be platform brittleness. An existing copy found during a `remits-cli start` scan (or the running CLI source in dev) is recorded instead of cloning a duplicate.
|
|
67
|
+
- Branch defaults to the current local git branch.
|
|
68
|
+
- Data mode defaults to `test`. Use `remits-cli data-mode set prod` only for production investigation.
|
|
69
|
+
- Test activity is streamed from websocket `TestSuite` events while final status is also polled from `/cli/test`.
|
|
70
|
+
- Tool execution writes the full response to a separate file so large payloads do not bloat the session log.
|
|
71
|
+
|
|
72
|
+
## Service, Dashboard, WebSocket, and Tmux Lifecycle
|
|
73
|
+
|
|
74
|
+
- The primary lifecycle commands are `remits-cli start`, `remits-cli stop`, and `remits-cli status`.
|
|
75
|
+
- `remits-cli listen`, `remits-cli listen stop`, and `remits-cli listen status` still work as compatibility aliases.
|
|
76
|
+
- Most non-lifecycle commands auto-start the background service if authenticated sessions already exist and no service is running.
|
|
77
|
+
- Successful `remits-cli auth` also attempts to auto-start the background service.
|
|
78
|
+
- `remits-cli start` starts a detached background process by default. Use `remits-cli start --foreground true` only when you want to run the daemon in the current terminal.
|
|
79
|
+
- `remits-cli status` reports whether the background service is alive and prints the dashboard URL when available.
|
|
80
|
+
- `remits-cli stop` stops the background service, kills the shared tmux session, and clears pane tracking state.
|
|
81
|
+
- The service starts a localhost dashboard that acts as a control center for remits-cli integration state.
|
|
82
|
+
- The dashboard shows websocket connection health, topic subscriptions, tmux session/panes, the discovered account repo index, global state files, and per-repo remits-cli files.
|
|
83
|
+
- If websocket connections are disconnected or the tmux session is missing, the dashboard exposes actions to reconnect websockets or recreate the tmux session.
|
|
84
|
+
- The service groups sessions by `baseUrl` so one websocket connection can service multiple authenticated accounts on the same Remits environment.
|
|
85
|
+
- 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.
|
|
86
|
+
- The daemon keeps STOMP heartbeats enabled and runs a maintenance watchdog that recreates unhealthy websocket connections and recreates the shared tmux session if it disappears.
|
|
87
|
+
- 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.
|
|
88
|
+
- Incoming websocket messages of type `remits-cli` are dispatched into dedicated tmux windows so the selected agent can continue working interactively with a full terminal view.
|
|
89
|
+
- The listener creates a shared tmux session named `remits-listener`.
|
|
90
|
+
- Support tickets are the primary unit of dispatched work. Each ticket gets its own tmux window/workstream.
|
|
91
|
+
- The listener enables tmux mouse support, increases scrollback history, and keeps exited panes visible for inspection.
|
|
92
|
+
- Follow-up messages with the same `ticketId` are routed back to the existing pane when it is still alive.
|
|
93
|
+
- Legacy payloads that only include `taskId` are still supported as a fallback routing key.
|
|
94
|
+
- If a pane for a tracked ticket has exited or is dead, the listener removes that mapping and creates a replacement pane.
|
|
95
|
+
- Pane commands are launched through the user's login shell so the pane inherits the normal interactive `PATH`.
|
|
96
|
+
- The preferred agent comes from `remits-cli config set --agent claude|codex|gemini`. The default is `claude`.
|
|
97
|
+
|
|
98
|
+
## Support Tickets
|
|
99
|
+
|
|
100
|
+
- Support tickets are stored as documents in the `support_tickets` collection.
|
|
101
|
+
- New tickets and ticket updates are delivered over the `remits-cli` websocket channel and appear as local tmux workstreams.
|
|
102
|
+
- Think of this as a lightweight local support queue: the platform creates and updates tickets centrally, and local agents receive those tickets to investigate and resolve.
|
|
103
|
+
- `accountId` / `accountName` identify the account that owns the ticket.
|
|
104
|
+
- If present, `implementationAccountId` / `implementationAccountName` identify the platform or product context that owns the shared implementation.
|
|
105
|
+
- Listener repo dispatch prefers `implementationAccountId` when present, then falls back to `accountId`. If one of those repos is indexed locally in `~/.remits-cli/account-repos.json`, it will be preferred as the tmux working directory.
|
|
106
|
+
- Agents must resolve account `type` (`PLATFORM`, `PRODUCT`, `CLIENT`) before deciding which local repo to use. A `CLIENT` ticket may still require code changes in a parent `PLATFORM` or `PRODUCT` repo.
|
|
107
|
+
- Use `mcp_support_ticket` to manage ticket state:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
remits-cli tool --name "mcp_support_ticket" --input '{"action":"read","ticketId":"123"}' --data-mode prod
|
|
111
|
+
remits-cli tool --name "mcp_support_ticket" --input '{"action":"accept","ticketId":"123","assignee":"codex"}' --data-mode prod
|
|
112
|
+
remits-cli tool --name "mcp_support_ticket" --input '{"action":"update_status","ticketId":"123","status":"in_progress","notes":"Investigating logs"}' --data-mode prod
|
|
113
|
+
remits-cli tool --name "mcp_support_ticket" --input '{"action":"complete","ticketId":"123","resolution":"Fixed and verified"}' --data-mode prod
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
- Recommended ticket flow: `read` first, then `accept`, then `update_status` as work progresses, then `complete` or `release`.
|
|
117
|
+
|
|
118
|
+
## Logging and State Files
|
|
119
|
+
|
|
120
|
+
There are two separate state areas:
|
|
121
|
+
|
|
122
|
+
- Repo-local state in `./.remits-cli/` for request/response artifacts tied to the current working tree.
|
|
123
|
+
- Global state in `~/.remits-cli/` for authentication, listener lifecycle, and cross-repo account mapping.
|
|
124
|
+
|
|
125
|
+
### Repo-local state
|
|
126
|
+
|
|
127
|
+
- `./.remits-cli/sessions/<current-session>.jsonl`
|
|
128
|
+
Records all `/cli/*` HTTP requests made from the current repo session.
|
|
129
|
+
- `./.remits-cli/tool-responses/<callId>.json`
|
|
130
|
+
Stores full tool responses for `remits-cli tool`.
|
|
131
|
+
- `./.remits-cli/tools/tools.json`
|
|
132
|
+
Cached tool definitions for the current repo.
|
|
133
|
+
- `./.remits-cli/current-session.txt`
|
|
134
|
+
Tracks the active local session log name.
|
|
135
|
+
|
|
136
|
+
### Global state
|
|
137
|
+
|
|
138
|
+
- `~/.remits-cli/sessions.json`
|
|
139
|
+
Auth sessions keyed by account ID, base URL, and data mode so local and production sessions can coexist safely.
|
|
140
|
+
- `~/.remits-cli/config.json`
|
|
141
|
+
CLI config such as the preferred agent.
|
|
142
|
+
- `~/.remits-cli/listener.pid`
|
|
143
|
+
PID for the background remits-cli service process.
|
|
144
|
+
- `~/.remits-cli/service-state.json`
|
|
145
|
+
Dashboard URL, repo scan summary, and websocket state snapshot for the running service.
|
|
146
|
+
- `~/.remits-cli/dispatch-panes.json`
|
|
147
|
+
Persistent map of support ticket routing key to the active tmux pane id for that ticket's dedicated window. `ticketId` is preferred, with legacy `taskId` fallback.
|
|
148
|
+
- `~/.remits-cli/account-repos.json`
|
|
149
|
+
Index of known account repositories on this machine, rebuilt by `remits-cli start` via account-info discovery and also refreshed when commands run inside an account repo.
|
|
150
|
+
- `~/.remits-cli/tmux-activity.log`
|
|
151
|
+
Human-readable global activity log for listener and tmux lifecycle events.
|
|
152
|
+
|
|
153
|
+
## Control Center
|
|
154
|
+
|
|
155
|
+
- `remits-cli start` prints or records a localhost dashboard URL such as `http://127.0.0.1:8787/`.
|
|
156
|
+
- Open that page in a browser to inspect the full local remits-cli integration state without manually opening JSON files.
|
|
157
|
+
- 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.
|
|
158
|
+
|
|
159
|
+
## Tmux Activity Log
|
|
160
|
+
|
|
161
|
+
- `~/.remits-cli/tmux-activity.log` is the quickest way to understand what the listener is doing.
|
|
162
|
+
- It records timestamped lifecycle events such as listener start/stop, websocket connect/disconnect, topic subscription, dispatch receipt, pane creation, follow-up delivery, pane replacement, and dispatch failures.
|
|
163
|
+
- Prompt bodies are not written verbatim to this log. The log stores summarized metadata such as `accountId`, `ticketId`, any legacy `taskId`, available keys, and prompt length.
|
|
164
|
+
- Typical inspection commands:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
tail -f ~/.remits-cli/tmux-activity.log
|
|
168
|
+
tail -n 200 ~/.remits-cli/tmux-activity.log
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Operational Notes
|
|
172
|
+
|
|
173
|
+
- `tmux` must be installed for agent dispatch to work. Without it, websocket dispatch is received but agent panes cannot be created.
|
|
174
|
+
- In sandboxed local agent environments, `remits-cli` network calls may fail with `ENOTFOUND`, `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.
|
|
175
|
+
- 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.
|
|
176
|
+
- Recommended durable update flow for agents: `components stage` for testing, then `git add/commit/push`, then `remits-cli components sync`, then `git pull --ff-only` to confirm platform-generated files like `account-info.json`.
|
|
177
|
+
- In sandboxed agent environments, local git writes may require a single approval step. If you want to minimize approval churn, `remits-cli components commit` consolidates the local git and sync phases into one CLI command.
|
|
178
|
+
- 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.
|
|
179
|
+
- 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.
|
|
180
|
+
- Session logs redact token fields and replace large component content fields with length summaries.
|