skydive-cli 0.1.0-beta.45
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 +185 -0
- package/dist/js/bin.mjs +2280 -0
- package/dist/js/boot-BQ8xC2R8.mjs +5930 -0
- package/dist/js/print-B76KzChc.mjs +446 -0
- package/package.json +62 -0
package/README.md
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# skydive-cli
|
|
2
|
+
|
|
3
|
+
The Skydive CLI — manage agents and chat with them from the terminal.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npx skydive-cli --help
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Authentication
|
|
10
|
+
|
|
11
|
+
The CLI has two credentials, stored together in `~/.config/skydive/config.json`:
|
|
12
|
+
|
|
13
|
+
- **API key** (`sky_live_…`) for the management commands. Mint one at
|
|
14
|
+
`skydive.com/account`, then:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
skydive auth login # paste the key
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
- **User session** for `skydive chat`. Chat is user-level and multi-agent,
|
|
21
|
+
so it signs you in via the browser (device flow) rather than a per-agent
|
|
22
|
+
API key. `skydive chat` does this automatically on first run; you can also
|
|
23
|
+
do it up front:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
skydive auth login --web # opens the browser, prompts for approval
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`skydive auth status` shows both; `skydive auth logout` clears them.
|
|
30
|
+
|
|
31
|
+
## Commands
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
skydive agents list
|
|
35
|
+
skydive agents get <id>
|
|
36
|
+
skydive agents create --name "My Agent"
|
|
37
|
+
|
|
38
|
+
skydive keys list --agent-id <id>
|
|
39
|
+
skydive keys create <name> --agent-id <id>
|
|
40
|
+
skydive keys revoke <id> --agent-id <id>
|
|
41
|
+
|
|
42
|
+
skydive secrets list --agent-id <id>
|
|
43
|
+
skydive secrets set <KEY> --agent-id <id> # value from stdin
|
|
44
|
+
skydive secrets rm <KEY> --agent-id <id>
|
|
45
|
+
|
|
46
|
+
skydive chat # interactive chat TUI (Node; fetches Bun on first run)
|
|
47
|
+
skydive chat -p "<prompt>" # one-shot, non-interactive (runs under Node)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Global flags: `--json`, `--quiet`, `--api-url <url>`.
|
|
51
|
+
|
|
52
|
+
## `skydive secrets`
|
|
53
|
+
|
|
54
|
+
Manage the environment secrets injected into an agent's sandbox. All
|
|
55
|
+
subcommands are scoped to an agent with `--agent-id <id>` and require an
|
|
56
|
+
API key with edit access to that agent.
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
skydive secrets list --agent-id <id> # names only — values are never returned
|
|
60
|
+
skydive secrets set OPENAI_API_KEY --agent-id <id> # reads the value from stdin
|
|
61
|
+
echo -n "$TOKEN" | skydive secrets set MY_TOKEN --agent-id <id>
|
|
62
|
+
skydive secrets set MY_TOKEN "literal-value" --agent-id <id>
|
|
63
|
+
skydive secrets rm MY_TOKEN --agent-id <id>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- Keys must be env-var identifiers (uppercase letters, digits, underscores).
|
|
67
|
+
- `set` reads the value from **stdin** when no value argument is given, so the
|
|
68
|
+
secret stays out of shell history. Passing it inline is supported for
|
|
69
|
+
scripting but avoid it in an interactive shell.
|
|
70
|
+
- **Values are write-only over the API.** `list` returns key names, never
|
|
71
|
+
values — the same contract as the in-sandbox `platform secrets` surface.
|
|
72
|
+
- Setting a secret updates the agent's vault. If an outbound-proxy rule
|
|
73
|
+
references that key, the proxy picks up the new value on the next request.
|
|
74
|
+
Setting a secret does **not** by itself create a proxy rule — see below.
|
|
75
|
+
|
|
76
|
+
## `skydive chat`
|
|
77
|
+
|
|
78
|
+
An interactive terminal chat client (an OpenTUI app) that drives the same
|
|
79
|
+
agents, sandboxes, and streaming responses as the web app — over the
|
|
80
|
+
internal API. On launch it walks you through:
|
|
81
|
+
|
|
82
|
+
1. **Agent picker** — type to filter your agents by name; `↑/↓` to move,
|
|
83
|
+
`↵` to open, or `ctrl+n` to create one.
|
|
84
|
+
2. **Conversation picker** — resume an existing thread or start a new one
|
|
85
|
+
(also filterable).
|
|
86
|
+
3. **Chat** — send a message and watch the reply stream, with markdown
|
|
87
|
+
formatting, collapsed reasoning, and rich rendering of tool calls
|
|
88
|
+
(`bash`, `edit`/`write` diffs, `read`, `grep`/`glob`).
|
|
89
|
+
|
|
90
|
+
Runs under **Node** like every other command. The TUI renders through
|
|
91
|
+
OpenTUI, whose native core needs the [Bun](https://bun.sh) runtime, so the
|
|
92
|
+
first `chat` run downloads a private, pinned Bun and re-execs under it
|
|
93
|
+
automatically — no separate Bun install required:
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
npx skydive-cli chat
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The Bun binary is cached under the CLI config dir and reused after the first
|
|
100
|
+
run. Already have Bun and want to skip the download? Point `SKYDIVE_BUN_PATH`
|
|
101
|
+
at your `bun` binary, or just invoke the command under `bun`.
|
|
102
|
+
|
|
103
|
+
### Non-interactive: `chat -p`
|
|
104
|
+
|
|
105
|
+
For scripts, pipes, and CI, `-p`/`--print` sends a single prompt, streams the
|
|
106
|
+
reply to stdout, and exits — the `claude -p` convention. It has no TUI, so it
|
|
107
|
+
runs under plain **Node** (no Bun needed):
|
|
108
|
+
|
|
109
|
+
```sh
|
|
110
|
+
skydive chat -p "summarize my open PRs" --agent grace
|
|
111
|
+
echo "what changed today?" | skydive chat -p --agent grace # prompt from stdin
|
|
112
|
+
skydive chat -p "and the one before?" --agent grace --conversation <id>
|
|
113
|
+
skydive chat -p "status?" --agent grace --json # structured envelope
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
- `--agent <id|slug|name>` targets the agent. Optional when the account has
|
|
117
|
+
exactly one agent; required (with the candidate list printed) otherwise.
|
|
118
|
+
- `--conversation <id>` continues an existing thread; omitted, it starts a new
|
|
119
|
+
one. The conversation id is included in `--json` output for chaining.
|
|
120
|
+
- `-p` needs a user session just like `chat`, but never opens the interactive
|
|
121
|
+
browser login — sign in first with `skydive auth login --web` or set
|
|
122
|
+
`SKYDIVE_SESSION_TOKEN`.
|
|
123
|
+
- `--json` prints `{ agentId, agentName, conversationId, isNewConversation,
|
|
124
|
+
runId, text }` instead of streaming the raw text.
|
|
125
|
+
|
|
126
|
+
It defaults to the production API (`https://api.skydive.com`). For local
|
|
127
|
+
dev, point it at your stack:
|
|
128
|
+
|
|
129
|
+
```sh
|
|
130
|
+
npx skydive-cli chat --api-url http://localhost:4500
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
`--api-url` in chat overrides the **app/session** origin (where better-auth
|
|
134
|
+
and the internal tRPC API live), which is distinct from the public
|
|
135
|
+
management API used by `agents`/`keys`.
|
|
136
|
+
|
|
137
|
+
### Keybindings
|
|
138
|
+
|
|
139
|
+
| Context | Key | Action |
|
|
140
|
+
| ------------ | ------------- | ------------------------------------ |
|
|
141
|
+
| Pickers | _type_ | filter the list |
|
|
142
|
+
| Pickers | `↑` / `↓` | move selection |
|
|
143
|
+
| Pickers | `↵` | open / select |
|
|
144
|
+
| Pickers | `esc` | back |
|
|
145
|
+
| Agent picker | `ctrl+n` | create an agent |
|
|
146
|
+
| Chat | `↵` | send (or queue, while streaming) |
|
|
147
|
+
| Chat | `pgup`/`pgdn` | scroll the transcript |
|
|
148
|
+
| Chat | `ctrl+c` | cancel the active run; again to quit |
|
|
149
|
+
| Chat | `esc` | back to the conversation picker |
|
|
150
|
+
|
|
151
|
+
Messages typed while a response is streaming are **queued** and sent in
|
|
152
|
+
order as each run finishes; `ctrl+c` cancels the current run and clears the
|
|
153
|
+
queue.
|
|
154
|
+
|
|
155
|
+
## Environment variables
|
|
156
|
+
|
|
157
|
+
| Variable | Effect |
|
|
158
|
+
| ----------------------- | ------------------------------------------------ |
|
|
159
|
+
| `SKYDIVE_API_KEY` | Management API key (overrides stored key) |
|
|
160
|
+
| `SKYDIVE_API_URL` | Management API base URL |
|
|
161
|
+
| `SKYDIVE_SESSION_TOKEN` | Chat session token (for non-interactive use) |
|
|
162
|
+
| `SKYDIVE_APP_URL` | Chat app/session origin (overrides stored value) |
|
|
163
|
+
|
|
164
|
+
## Testing the TUI
|
|
165
|
+
|
|
166
|
+
`yarn test:unit` runs both suites: unit tests (`*.test.ts`) under vitest,
|
|
167
|
+
then TUI tests (`*.tui.test.tsx`) under `bun test` (needs [Bun](https://bun.sh)
|
|
168
|
+
≥ 1.3.14 on your PATH — see `engines`).
|
|
169
|
+
|
|
170
|
+
TUI tests render the real OpenTUI screens headlessly — fixed terminal size,
|
|
171
|
+
mock keyboard input, frames captured as plain text — via
|
|
172
|
+
`@opentui/react/test-utils`. OpenTUI needs Bun's FFI, which is why they run
|
|
173
|
+
under `bun test`, not vitest:
|
|
174
|
+
|
|
175
|
+
```sh
|
|
176
|
+
bun test .tui.test # just the TUI suite
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Frame snapshots live in `__snapshots__/` next to each test; a diff there is
|
|
180
|
+
a visual diff of the screen. `yarn render:frames <dir>` writes true-color
|
|
181
|
+
ANSI captures of key screens — CI converts them to PNGs (textimg) and posts
|
|
182
|
+
them as a sticky screenshot comment on CLI PRs.
|
|
183
|
+
|
|
184
|
+
The pattern (stub `fetch`, seed the store, drive keys, assert on
|
|
185
|
+
`captureCharFrame()`) is in `src/chat/tui/screens/agent-picker.tui.test.tsx`.
|