skydive-cli 0.1.0

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 ADDED
@@ -0,0 +1,162 @@
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) |