@av-pi-studio/cli 0.0.90 → 0.0.92

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/README.md CHANGED
@@ -1,8 +1,18 @@
1
1
  # `@av-pi-studio/cli`
2
2
 
3
- `pi-studio` — the terminal client for Pi-Studio. Drives a daemon (local or remote) over its
4
- WebSocket API: run and manage agents, control the local daemon's lifecycle, and drive terminals,
5
- chat rooms, schedules, loops, worktrees, and permissions from the command line.
3
+ Pi-Studio's job is to drive [Pi](https://pi.dev) — the terminal coding agent by Earendil — locally
4
+ or remotely, through a long-lived daemon that manages agent processes, terminals, and git
5
+ worktrees. Two clients talk to that daemon: this CLI, and a full browser UI. `pi-studio` starts
6
+ the daemon and gets you into either one:
7
+
8
+ ```bash
9
+ pi-studio daemon start # start (or find) a local daemon, print a pairing QR
10
+ pi-studio ui # serve the browser UI, connected to that daemon
11
+ ```
12
+
13
+ <p align="center">
14
+ <img src="https://cdn.jsdelivr.net/npm/@av-pi-studio/cli@0.0.92/assets/screenshots/chat-workspace.webp" alt="Pi-Studio web UI — an agent reading, editing, and running shell commands, each as its own tool-call card" width="850">
15
+ </p>
6
16
 
7
17
  ---
8
18
 
@@ -27,13 +37,11 @@ pi-studio auth login
27
37
  # start a local daemon (if one isn't already running) and print a pairing QR code
28
38
  pi-studio daemon start
29
39
 
30
- # check daemon health
31
- pi-studio daemon status
40
+ # open the full browser UI, pointed at that daemon
41
+ pi-studio ui
32
42
 
33
- # run an agent
43
+ # ...or stay in the terminal: run an agent, list it, attach to stream live output
34
44
  pi-studio agent run --provider pi/claude-3-5-sonnet "implement user authentication"
35
-
36
- # list agents, attach to stream live output
37
45
  pi-studio agent ls
38
46
  pi-studio agent attach <agentId>
39
47
 
@@ -43,6 +51,43 @@ pi-studio --host workstation.local:6767 agent ls
43
51
 
44
52
  Run `pi-studio --help` (or `<command> --help`) for the full command tree.
45
53
 
54
+ ## The web UI
55
+
56
+ `pi-studio ui` serves the production Pi-Studio browser UI — a three-column workspace (sessions on
57
+ the left, chat/terminal/code in the middle, files and git changes on the right) — as a static site,
58
+ no separate install or build step needed. Point it at any daemon, local or remote:
59
+
60
+ ```bash
61
+ pi-studio ui # serves on http://localhost:4173, connects to the local daemon
62
+ pi-studio ui --ui-port 8080 --daemon-host workstation.local:6767
63
+ ```
64
+
65
+ The hero shot above is real: every tool call an agent makes (read/edit/write/shell) renders as its
66
+ own card, with live diff stats, right in the chat.
67
+
68
+ Review what it changed without leaving the tab — a full diff view, line by line:
69
+
70
+ <p align="center">
71
+ <img src="https://cdn.jsdelivr.net/npm/@av-pi-studio/cli@0.0.92/assets/screenshots/git-diff.webp" alt="Pi-Studio web UI — git changes diff view" width="850">
72
+ </p>
73
+
74
+ Split the workspace into multiple panes — chat next to a live terminal (backed by `node-pty`), a
75
+ file, or another session — and the layout persists across reloads:
76
+
77
+ <p align="center">
78
+ <img src="https://cdn.jsdelivr.net/npm/@av-pi-studio/cli@0.0.92/assets/screenshots/split-panes.webp" alt="Pi-Studio web UI — split panes with chat and a live terminal side by side" width="850">
79
+ </p>
80
+
81
+ Every file opens with full syntax highlighting:
82
+
83
+ <p align="center">
84
+ <img src="https://cdn.jsdelivr.net/npm/@av-pi-studio/cli@0.0.92/assets/screenshots/code-viewer.webp" alt="Pi-Studio web UI — syntax-highlighted code viewer" width="850">
85
+ </p>
86
+
87
+ See the [`ui`](#ui) command below for every flag, and
88
+ [`CONTRIBUTING.md`](../../CONTRIBUTING.md#web-ui-dev-server) for how to run the UI from source in
89
+ dev mode.
90
+
46
91
  ## Global options
47
92
 
48
93
  | Flag | Description |
@@ -68,21 +113,31 @@ no `--host`, the CLI targets `ws://127.0.0.1:6767`.
68
113
 
69
114
  ### `agent`
70
115
 
71
- | Command | Description |
72
- | ----------------------------------------------------- | ----------------------------------------- |
73
- | `agent run --provider pi/<model> "prompt"` | Create an agent and run the first turn |
74
- | `agent ls` | List all agents |
75
- | `agent attach <agentId>` | Stream an agent's live events |
76
- | `agent send <agentId> "prompt"` | Send a follow-up prompt |
77
- | `agent stop <agentId>` | Interrupt the current turn |
78
- | `agent wait <agentId>` | Block until the agent goes idle or closes |
79
- | `agent timeline <agentId>` | Print paged timeline history |
80
- | `agent inspect <agentId>` | Print the full agent record |
81
- | `agent archive <agentId>` | Soft-delete |
82
- | `agent delete <agentId>` | Hard delete |
83
- | `agent update <agentId>` | Update model/mode/features/title/labels |
84
- | `agent resume <agentId>` | Resume a closed session |
85
- | `agent import --provider pi --cwd /path --handle <h>` | Import a provider-native session |
116
+ | Command | Description |
117
+ | ---------------------------------------------------- | ----------------------------------------------- |
118
+ | `agent run --provider pi/<model> "prompt"` | Create an agent and run the first turn |
119
+ | `agent ls` | List all agents |
120
+ | `agent attach <agentId>` | Stream an agent's live events |
121
+ | `agent send <agentId> "prompt"` | Send a follow-up prompt |
122
+ | `agent steer <agentId> "message"` | Steer a running turn (after current tool calls) |
123
+ | `agent follow-up <agentId> "message"` | Queue a message for after the agent stops |
124
+ | `agent stop <agentId>` | Interrupt the current turn |
125
+ | `agent wait <agentId>` | Block until the agent goes idle or closes |
126
+ | `agent logs <agentId> [-n <limit>]` | Print paged timeline history |
127
+ | `agent inspect <agentId>` | Print the full agent record |
128
+ | `agent update <agentId>` | Update model/mode/thinking/title |
129
+ | `agent archive <agentId>` | Soft-delete |
130
+ | `agent delete <agentId>` | Hard delete |
131
+ | `agent reload <agentId>` | Resume a closed session |
132
+ | `agent import <sessionRef>` | Import a provider-native session by handle |
133
+
134
+ `run`, `ls`, `attach`, `logs`, `send`, and `steer` also work without the `agent` prefix
135
+ (`pi-studio ls`, `pi-studio run …`).
136
+
137
+ Session management mirrors Pi's own slash commands — `agent session` (/session), `compact`,
138
+ `new-session`, `resume-session`, `fork`, `fork-messages`, `clone`, `name`, `export`, `model`,
139
+ `cycle-model`, `last-message`, and `commands` (list extensions/prompts/skills); run
140
+ `pi-studio agent --help` for the full set.
86
141
 
87
142
  Provider spec parsing (`--provider`): `pi/claude-3-5-sonnet` → provider `pi`, model
88
143
  `claude-3-5-sonnet`; bare `pi` → provider only; `mock` → the credential-free mock provider.
@@ -114,13 +169,18 @@ explicit provider for non-interactive setups. Secrets are never echoed, and the
114
169
 
115
170
  ### `daemon`
116
171
 
117
- | Command | Description |
118
- | -------------------------- | -------------------------------------------------------------------------- |
119
- | `daemon start` | Spawn a local daemon if one isn't already running, then print a pairing QR |
120
- | `daemon stop` | Send SIGTERM to the local daemon |
121
- | `daemon status` | Print health + PID |
122
- | `daemon set-password <pw>` | Bcrypt-hash a password into `$PI_STUDIO_HOME/config.json` |
123
- | `daemon pair` | Print the pairing URL/QR for an already-running daemon |
172
+ | Command | Description |
173
+ | -------------------------- | -------------------------------------------------------------------------------- |
174
+ | `daemon start` | Spawn a local daemon if one isn't already running, then print a pairing QR |
175
+ | `daemon stop` | Send SIGTERM to the local daemon |
176
+ | `daemon restart` | Stop then start the local daemon |
177
+ | `daemon status` | Print health + PID |
178
+ | `daemon set-password <pw>` | Bcrypt-hash a password into `$PI_STUDIO_HOME/config.json` |
179
+ | `daemon pair` | Print the pairing URL/QR for an already-running daemon |
180
+ | `daemon rotate-key` | Mint a fresh pairing keypair — revokes every previously issued pairing link/QR |
181
+
182
+ `pi-studio onboard` (top-level) is an alias for `daemon start`'s behavior, and bare `pi-studio`
183
+ does the same thing.
124
184
 
125
185
  ### `relay`
126
186
 
@@ -163,6 +223,8 @@ SPA fallback — no vite/dev dependency at runtime, works from any install shape
163
223
  tab auto-connects; the command never itself probes or starts a daemon. Blocks until
164
224
  `SIGINT`/`SIGTERM`.
165
225
 
226
+ See [The web UI](#the-web-ui) above for screenshots.
227
+
166
228
  ### `update`
167
229
 
168
230
  | Command | Description |
package/README.md.orig ADDED
@@ -0,0 +1,291 @@
1
+ # `@av-pi-studio/cli`
2
+
3
+ Pi-Studio's job is to drive [Pi](https://pi.dev) — the terminal coding agent by Earendil — locally
4
+ or remotely, through a long-lived daemon that manages agent processes, terminals, and git
5
+ worktrees. Two clients talk to that daemon: this CLI, and a full browser UI. `pi-studio` starts
6
+ the daemon and gets you into either one:
7
+
8
+ ```bash
9
+ pi-studio daemon start # start (or find) a local daemon, print a pairing QR
10
+ pi-studio ui # serve the browser UI, connected to that daemon
11
+ ```
12
+
13
+ <p align="center">
14
+ <img src="assets/screenshots/chat-workspace.webp" alt="Pi-Studio web UI — an agent reading, editing, and running shell commands, each as its own tool-call card" width="850">
15
+ </p>
16
+
17
+ ---
18
+
19
+ ## Install
20
+
21
+ ```bash
22
+ npm install -g @av-pi-studio/cli
23
+ ```
24
+
25
+ This exposes the `pi-studio` binary on your `PATH`. Without a global install, run it via:
26
+
27
+ ```bash
28
+ npx @av-pi-studio/cli [options] [command] [args]
29
+ ```
30
+
31
+ ## Quick start
32
+
33
+ ```bash
34
+ # log in to a model provider (the `pi` provider needs one before it can run a turn)
35
+ pi-studio auth login
36
+
37
+ # start a local daemon (if one isn't already running) and print a pairing QR code
38
+ pi-studio daemon start
39
+
40
+ # open the full browser UI, pointed at that daemon
41
+ pi-studio ui
42
+
43
+ # ...or stay in the terminal: run an agent, list it, attach to stream live output
44
+ pi-studio agent run --provider pi/claude-3-5-sonnet "implement user authentication"
45
+ pi-studio agent ls
46
+ pi-studio agent attach <agentId>
47
+
48
+ # target a remote daemon instead of the local one
49
+ pi-studio --host workstation.local:6767 agent ls
50
+ ```
51
+
52
+ Run `pi-studio --help` (or `<command> --help`) for the full command tree.
53
+
54
+ ## The web UI
55
+
56
+ `pi-studio ui` serves the production Pi-Studio browser UI — a three-column workspace (sessions on
57
+ the left, chat/terminal/code in the middle, files and git changes on the right) — as a static site,
58
+ no separate install or build step needed. Point it at any daemon, local or remote:
59
+
60
+ ```bash
61
+ pi-studio ui # serves on http://localhost:4173, connects to the local daemon
62
+ pi-studio ui --ui-port 8080 --daemon-host workstation.local:6767
63
+ ```
64
+
65
+ The hero shot above is real: every tool call an agent makes (read/edit/write/shell) renders as its
66
+ own card, with live diff stats, right in the chat.
67
+
68
+ Review what it changed without leaving the tab — a full diff view, line by line:
69
+
70
+ <p align="center">
71
+ <img src="assets/screenshots/git-diff.webp" alt="Pi-Studio web UI — git changes diff view" width="850">
72
+ </p>
73
+
74
+ Split the workspace into multiple panes — chat next to a live terminal (backed by `node-pty`), a
75
+ file, or another session — and the layout persists across reloads:
76
+
77
+ <p align="center">
78
+ <img src="assets/screenshots/split-panes.webp" alt="Pi-Studio web UI — split panes with chat and a live terminal side by side" width="850">
79
+ </p>
80
+
81
+ Every file opens with full syntax highlighting:
82
+
83
+ <p align="center">
84
+ <img src="assets/screenshots/code-viewer.webp" alt="Pi-Studio web UI — syntax-highlighted code viewer" width="850">
85
+ </p>
86
+
87
+ See the [`ui`](#ui) command below for every flag, and
88
+ [`CONTRIBUTING.md`](../../CONTRIBUTING.md#web-ui-dev-server) for how to run the UI from source in
89
+ dev mode.
90
+
91
+ ## Global options
92
+
93
+ | Flag | Description |
94
+ | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
95
+ | `-H, --host <host>` | Daemon target — bare `host:port`, or a URL with a `ws://`/`wss://` or `http://`/`https://` scheme (e.g. `workstation.local:6767`, `https://box.local:6767`) |
96
+ | `--password <password>` | Password for a password-protected daemon |
97
+ | `--home <dir>` | Override `$PI_STUDIO_HOME` (used for the client-id store) |
98
+ | `--pi-home <dir>` | Override `$PI_STUDIO_PI_HOME` — the bundled Pi CLI's own `.pi` config dir. Selects the `auth.json` the `auth` group reads/writes, and is forwarded to a locally-spawned daemon and to `pi-studio pi`. Must precede the subcommand |
99
+ | `--json` | Render command output as JSON instead of a table |
100
+ | `-v, --version` | Print the installed CLI version and exit |
101
+
102
+ **Connection resolution**: `--host host:port` → `ws://host:port`; a `ws://`/`wss://` URL is used
103
+ as-is; `http://`/`https://` are accepted for familiarity and mapped to `ws://`/`wss://` (the daemon
104
+ is an HTTP server that upgrades to WebSocket on the same port); `wss://`/`https://` imply TLS. With
105
+ no `--host`, the CLI targets `ws://127.0.0.1:6767`.
106
+
107
+ **Default action** (no subcommand):
108
+
109
+ - `pi-studio <path>` — open that path as a project on the daemon.
110
+ - `pi-studio` (bare) — ensure a local daemon is running, then print a pairing QR code.
111
+
112
+ ## Command tree
113
+
114
+ ### `agent`
115
+
116
+ | Command | Description |
117
+ | ---------------------------------------------------- | ----------------------------------------------- |
118
+ | `agent run --provider pi/<model> "prompt"` | Create an agent and run the first turn |
119
+ | `agent ls` | List all agents |
120
+ | `agent attach <agentId>` | Stream an agent's live events |
121
+ | `agent send <agentId> "prompt"` | Send a follow-up prompt |
122
+ | `agent steer <agentId> "message"` | Steer a running turn (after current tool calls) |
123
+ | `agent follow-up <agentId> "message"` | Queue a message for after the agent stops |
124
+ | `agent stop <agentId>` | Interrupt the current turn |
125
+ | `agent wait <agentId>` | Block until the agent goes idle or closes |
126
+ | `agent logs <agentId> [-n <limit>]` | Print paged timeline history |
127
+ | `agent inspect <agentId>` | Print the full agent record |
128
+ | `agent update <agentId>` | Update model/mode/thinking/title |
129
+ | `agent archive <agentId>` | Soft-delete |
130
+ | `agent delete <agentId>` | Hard delete |
131
+ | `agent reload <agentId>` | Resume a closed session |
132
+ | `agent import <sessionRef>` | Import a provider-native session by handle |
133
+
134
+ `run`, `ls`, `attach`, `logs`, `send`, and `steer` also work without the `agent` prefix
135
+ (`pi-studio ls`, `pi-studio run …`).
136
+
137
+ Session management mirrors Pi's own slash commands — `agent session` (/session), `compact`,
138
+ `new-session`, `resume-session`, `fork`, `fork-messages`, `clone`, `name`, `export`, `model`,
139
+ `cycle-model`, `last-message`, and `commands` (list extensions/prompts/skills); run
140
+ `pi-studio agent --help` for the full set.
141
+
142
+ Provider spec parsing (`--provider`): `pi/claude-3-5-sonnet` → provider `pi`, model
143
+ `claude-3-5-sonnet`; bare `pi` → provider only; `mock` → the credential-free mock provider.
144
+
145
+ ### `auth`
146
+
147
+ | Command | Description |
148
+ | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
149
+ | `auth login [provider] [--type api_key\|oauth] [--api-key <key>]` | Log in to a model provider. With no arguments, pick one interactively; `--api-key` is the headless path |
150
+ | `auth status [--json]` | Show which providers are configured, how (api key / oauth), and from where (stored credential vs. an ambient env var) |
151
+ | `auth logout <provider>` | Remove a stored credential. Idempotent, and tells you when an ambient env var still configures the provider |
152
+
153
+ The `pi` provider needs a model-provider credential before it can run a turn. This is the
154
+ supported way to supply one — no hand-editing Pi's `auth.json`, no hunting for `/login` inside
155
+ `pi-studio pi`'s interactive TUI:
156
+
157
+ ```bash
158
+ pi-studio auth login # interactive: filter the provider list, pick, enter key
159
+ pi-studio auth login openai --api-key sk-... # headless — for scripts, CI, Dockerfiles
160
+ pi-studio auth status
161
+ ```
162
+
163
+ **Local and daemon-free** — unlike every other group here, `auth` never opens a WebSocket. It
164
+ writes Pi's own credential store at `<piHome>/agent/auth.json` (see `--pi-home`), which is the
165
+ exact file the daemon's spawned agents read, so a credential you add here is picked up on the next
166
+ agent spawn with no daemon restart. Interactive prompts need a TTY; use `--api-key` with an
167
+ explicit provider for non-interactive setups. Secrets are never echoed, and the store is written
168
+ `0600`.
169
+
170
+ ### `daemon`
171
+
172
+ | Command | Description |
173
+ | -------------------------- | -------------------------------------------------------------------------------- |
174
+ | `daemon start` | Spawn a local daemon if one isn't already running, then print a pairing QR |
175
+ | `daemon stop` | Send SIGTERM to the local daemon |
176
+ | `daemon restart` | Stop then start the local daemon |
177
+ | `daemon status` | Print health + PID |
178
+ | `daemon set-password <pw>` | Bcrypt-hash a password into `$PI_STUDIO_HOME/config.json` |
179
+ | `daemon pair` | Print the pairing URL/QR for an already-running daemon |
180
+ | `daemon rotate-key` | Mint a fresh pairing keypair — revokes every previously issued pairing link/QR |
181
+
182
+ `pi-studio onboard` (top-level) is an alias for `daemon start`'s behavior, and bare `pi-studio`
183
+ does the same thing.
184
+
185
+ ### `relay`
186
+
187
+ | Command | Description |
188
+ | ------------------------------------- | -------------------------------------------------------------------- |
189
+ | `relay start [--listen <host:port>]` | Spawn a local relay server (default `0.0.0.0:7000`), wait for health |
190
+ | `relay stop` | Send SIGTERM to the local relay |
191
+ | `relay status [--listen <host:port>]` | Print up/down for the relay at that address |
192
+
193
+ A self-hosted, zero-knowledge relay (`@av-pi-studio/relay`) that lets a client reach a daemon
194
+ behind a firewall/NAT — the daemon dials out to it; see that package's README for the full
195
+ picture. Runs as its own managed process, entirely decoupled from daemon lifecycle: point a
196
+ daemon at it via `daemon.relay.endpoint` in `config.json` (`PI_STUDIO_RELAY_ENDPOINT` env), not
197
+ through this command.
198
+
199
+ ### `pi`
200
+
201
+ | Command | Description |
202
+ | -------------- | ------------------------------------------------------------------------ |
203
+ | `pi [args...]` | Run the embedded Pi coding-agent CLI, forwarding every argument verbatim |
204
+
205
+ A pure pass-through proxy to the exact `pi` binary bundled inside
206
+ `@earendil-works/pi-coding-agent` (the same one the daemon spawns) — so `pi-studio pi ...` is a
207
+ drop-in replacement for a globally-installed `pi`, with none of its flags, subcommands, or
208
+ interactive TUI reimplemented. `pi-studio pi` alone launches the interactive TUI, exactly like
209
+ bare `pi`; `pi-studio pi -p "prompt"` runs non-interactively. `--pi-home` (global option, must
210
+ come before `pi` on the command line) redirects the bundled CLI's `.pi` config dir, same as it
211
+ does for a locally-spawned daemon. Falls back to a global `pi` on `$PATH` if the bundled
212
+ dependency isn't installed. Never touches the daemon or the wire protocol.
213
+
214
+ ### `ui`
215
+
216
+ | Command | Description |
217
+ | ------------------------------------------------------------------- | --------------------------------------------------- |
218
+ | `ui [--ui-host <host>] [--ui-port <port>] [--daemon-host <host>]` | Serve the prebuilt web-client SPA as a static site |
219
+
220
+ Serves the built `@av-pi-studio/web-client` UI (`dist/web`) via a minimal static file server with
221
+ SPA fallback — no vite/dev dependency at runtime, works from any install shape. `--daemon-host`
222
+ (falls back to the global `--host`) pre-fills the printed URL's `?host=&connect=1` so the browser
223
+ tab auto-connects; the command never itself probes or starts a daemon. Blocks until
224
+ `SIGINT`/`SIGTERM`.
225
+
226
+ See [The web UI](#the-web-ui) above for screenshots.
227
+
228
+ ### `update`
229
+
230
+ | Command | Description |
231
+ | ------------------ | ---------------------------------------------------------------------- |
232
+ | `update [--check]` | Self-update to the latest `@av-pi-studio/cli` version published on npm |
233
+
234
+ Shells out to the same `npm install -g @av-pi-studio/cli@<version>` path used to install the CLI
235
+ in the first place (see Install above), so it respects your npm config (registry mirrors, auth,
236
+ proxies) instead of reimplementing a registry client. `--check` reports whether an update is
237
+ available without installing anything.
238
+
239
+ ### Feature groups
240
+
241
+ `chat`, `terminal`, `loop`, `schedule`, `permit`, `provider`, and `worktree` are sibling top-level
242
+ command groups (there is no `feature` wrapper, and no `project` group — opening a project is the
243
+ top-level `open <path>` command shown above):
244
+
245
+ | Group | Commands |
246
+ | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
247
+ | `chat` | `create <name> [--purpose]`, `ls`, `inspect <roomId>`, `post <roomId> <message> [--from]`, `read <roomId> [-n]`, `wait <roomId>`, `delete <roomId>` |
248
+ | `terminal` | `ls`, `create [--workspace] [--cwd]`, `capture <slot>`, `send-keys <slot> <data>`, `kill <slot>` |
249
+ | `loop` | `run <prompt> [--max]`, `ls`, `inspect <loopId>`, `logs <loopId>`, `stop <loopId>` |
250
+ | `schedule` | `create <cron> <prompt>`, `ls`, `inspect <id>`, `update <id> [--cron] [--prompt]`, `pause <id>`, `resume <id>`, `run-once <id>`, `logs <id>`, `delete <id>` |
251
+ | `permit` | `ls`, `allow <permissionRequestId>`, `deny <permissionRequestId>` |
252
+ | `provider` | `ls`, `models <providerId>` |
253
+ | `worktree` | `create <name> [--workspace]`, `ls`, `archive <name>` |
254
+
255
+ ## Using it as a library
256
+
257
+ The CLI's building blocks are also exported for programmatic use:
258
+
259
+ ```ts
260
+ import { withDaemon } from "@av-pi-studio/cli";
261
+
262
+ await withDaemon(ctx, opts, async (daemonClient) => {
263
+ // daemonClient is a connected @av-pi-studio/client DaemonClient
264
+ });
265
+ ```
266
+
267
+ `withDaemon` resolves the target URL from `--host`/defaults, connects, runs your callback, then
268
+ disconnects — handling `RpcError`s and connection failures with clean stderr output and non-zero
269
+ exit codes along the way.
270
+
271
+ ## How it talks to the daemon
272
+
273
+ The CLI process never runs daemon/relay code in-process — it only speaks the WebSocket API to
274
+ drive an existing daemon. It resolves `@av-pi-studio/server`'s/`@av-pi-studio/relay/server`'s
275
+ absolute module URL via `import.meta.resolve` (never `await import()`) purely to bake that URL
276
+ into a detached `node -e` subprocess it spawns for `daemon start`/`relay start` — see
277
+ `daemon-control.ts`'s `subprocessStarter` and `relay-control.ts`'s `subprocessRelayStarter`. A
278
+ stable per-machine `clientId` is generated on first use and stored at
279
+ `$PI_STUDIO_HOME/client-id`; `clientType` is always `"cli"`.
280
+
281
+ ## Development
282
+
283
+ ```bash
284
+ npx vitest run packages/cli
285
+ ```
286
+
287
+ Tests cover command parsing, provider-spec parsing, stream-event formatting, the daemon-control
288
+ state machine, output rendering, pairing-URL construction, and the `auth` group (path resolution,
289
+ prompt/notify rendering, login/status/logout orchestration) — all against an injected `CliContext`
290
+ (stub output sink + mock `DaemonRuntime`, fake `AuthRuntime` and terminal I/O), never a real
291
+ spawned daemon and never a real credential store.
Binary file
package/package.json CHANGED
@@ -1,13 +1,19 @@
1
1
  {
2
2
  "name": "@av-pi-studio/cli",
3
- "version": "0.0.90",
3
+ "version": "0.0.92",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/avatsaev/pi-studio.git",
7
+ "directory": "packages/cli"
8
+ },
4
9
  "bin": {
5
10
  "pi-studio": "dist/cli.js"
6
11
  },
7
12
  "files": [
8
13
  "dist",
9
14
  "!dist/**/*.map",
10
- "!dist/.tsbuildinfo"
15
+ "!dist/.tsbuildinfo",
16
+ "assets"
11
17
  ],
12
18
  "type": "module",
13
19
  "main": "./dist/index.js",
@@ -23,11 +29,11 @@
23
29
  "clean": "rm -rf dist *.tsbuildinfo"
24
30
  },
25
31
  "dependencies": {
26
- "@av-pi-studio/client": "^0.0.90",
27
- "@av-pi-studio/protocol": "^0.0.90",
28
- "@av-pi-studio/relay": "^0.0.90",
29
- "@av-pi-studio/server": "^0.0.90",
30
- "@av-pi-studio/web-client": "^0.0.90",
32
+ "@av-pi-studio/client": "^0.0.92",
33
+ "@av-pi-studio/protocol": "^0.0.92",
34
+ "@av-pi-studio/relay": "^0.0.92",
35
+ "@av-pi-studio/server": "^0.0.92",
36
+ "@av-pi-studio/web-client": "^0.0.92",
31
37
  "@earendil-works/pi-coding-agent": "^0.84.1",
32
38
  "@inquirer/prompts": "^8.5.2",
33
39
  "bcryptjs": "^3.0.3",