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