@cabane/cli 0.1.4 → 0.1.5

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.
Files changed (3) hide show
  1. package/README.md +74 -87
  2. package/dist/cli.js +284 -730
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -1,27 +1,24 @@
1
1
  # cabane CLI
2
2
 
3
3
  Run a self-hosted [Cabane](https://cabane.ai) on your own machine. `@cabane/cli`
4
- installs the Cabane server, runs the whole stack — server, embedded Postgres,
5
- and the house bridge — and keeps it updated.
4
+ installs the Cabane server, runs the whole stack — server plus embedded Postgres —
5
+ and keeps it updated.
6
6
 
7
- Two terms you'll see throughout:
8
-
9
- - The **house bridge** is what makes your agents answer: it runs each agent
10
- turn on your machine, through an executor.
11
- - An **executor** is a coding-agent harness installed on your machine —
12
- **Claude Code**, **Codex**, or **opencode**. Cabane ships no model of its own
13
- and requires no particular provider; the house bridge runs whichever executor
14
- (and credentials) you have.
7
+ That's the whole server side — your workspace, its files, and its data. **Agents
8
+ run the same way they do on hosted Cabane: on a [companion](https://app.cabane.ai/docs/reference/companion)
9
+ you pair**, on a device you control, using the harness (Claude Code, Codex, or
10
+ OpenCode) and credential already there. The self-hosted server runs no agent turns
11
+ itself and needs no model key of its own.
15
12
 
16
13
  The short version:
17
14
 
18
15
  ```sh
19
16
  npm i -g @cabane/cli # install the CLI (bin: `cabane`)
20
- cabane init # first-run wizard
17
+ cabane init # first-run wizard (data location, port, URL)
21
18
  cabane install --token cabdist_… # fetch + verify + unpack the server
22
19
  cabane up --daemon # run the stack
23
20
  # open http://localhost:3000, sign up
24
- cabane setup-agent # connect your agent to the house bridge
21
+ cabane setup-agent # confirm your account + how to pair a companion
25
22
  ```
26
23
 
27
24
  Each step, in order, below.
@@ -29,8 +26,10 @@ Each step, in order, below.
29
26
  ## Requirements
30
27
 
31
28
  - **Node ≥ 22.**
32
- - **An executor the house bridge can run** — Claude Code, Codex, or opencode —
33
- with its credentials reachable (see [Credentials](#credentials)).
29
+ - **A companion to run your agents** — the desktop Companion or the headless
30
+ `@cabane/companion`, on a device you control, with a coding-agent harness (Claude
31
+ Code, Codex, or OpenCode) installed and signed in. The server itself needs no
32
+ model credential.
34
33
 
35
34
  ## Getting started
36
35
 
@@ -38,35 +37,34 @@ Each step, in order, below.
38
37
 
39
38
  2. **Run `cabane init`** — the interactive first-run wizard. It asks where your
40
39
  data lives (and shows the resolved paths — `data/storage` for uploads,
41
- `data/pg` for the database), the port, an optional public URL, and your
42
- executor credential if you use API-key billing (on a Claude subscription
43
- login there's nothing to enter — see [Credentials](#credentials)). Everything
44
- persists to config, so a later `cabane up` needs no flags. Re-run it any time
45
- to reconfigure, or skip it and pass flags directly if you prefer.
40
+ `data/pg` for the database), the port, and an optional public URL. Everything
41
+ persists to config, so a later `cabane up` needs no flags. Re-run it any time to
42
+ reconfigure, or skip it and pass flags directly if you prefer.
46
43
 
47
44
  3. **Run `cabane install --token cabdist_…`** — fetches the server artifact with
48
45
  your distribution token, verifies its sha256, and unpacks it. (Have a local
49
46
  tarball instead? `cabane install --from <artifact.tgz>` works offline.)
50
47
 
51
48
  4. **Run `cabane up --daemon`** — starts and supervises the stack: embedded
52
- Postgres, the server, and the house bridge. Leave off `--daemon` to run it in
53
- the foreground.
49
+ Postgres and the server. Leave off `--daemon` to run it in the foreground.
54
50
 
55
51
  5. **Sign up.** Open <http://localhost:3000> and create your account and first
56
52
  workspace.
57
53
 
58
- 6. **Run `cabane setup-agent`** — the step that connects your agent to your
59
- executor. Mint an access token in the app (**Settings → Developer**), then
60
- run `cabane setup-agent` and paste the `cab_…` token at the prompt. That
61
- registers the house bridge and puts your agent on it — your agent now
62
- answers in chat.
54
+ 6. **Pair a companion.** Your workspace seeds an agent, but it has nowhere to run
55
+ until you pair a device. `cabane setup-agent` (mint an access token in
56
+ **Settings → Developer**, paste it at the prompt) confirms your account and
57
+ prints the steps: install the Companion (desktop app, or the headless
58
+ `@cabane/companion`), sign in against this instance, pair it, then assign the
59
+ seeded agent to one of its connectors. This is the same pairing flow as hosted
60
+ Cabane.
63
61
 
64
- For the fuller picture of what you just stood up — agents, bridges, workspaces,
65
- files — see the [Cabane docs](https://app.cabane.ai/docs).
62
+ For the fuller picture of what you just stood up — agents, workspaces, files —
63
+ see the [Cabane docs](https://app.cabane.ai/docs).
66
64
 
67
65
  ## What it supervises
68
66
 
69
- `cabane up` runs three children in order, with a clean SIGTERM teardown:
67
+ `cabane up` runs two children in order, with a clean SIGTERM teardown:
70
68
 
71
69
  1. **Embedded Postgres** — the `embedded-postgres` binaries (pinned pg 16.14) run
72
70
  as a child on a local off-5432 port; data in `<CABANE_HOME>/data/pg`. No system
@@ -74,30 +72,29 @@ files — see the [Cabane docs](https://app.cabane.ai/docs).
74
72
  2. **The server** — the artifact's single-process API+SPA (`server.js`, filesystem
75
73
  storage, the bundled SPA served via `WEB_DIST`), env composed automatically
76
74
  (`NODE_ENV=production`, `http://localhost:<port>`, generated-once vision
77
- secret). Migrations apply on boot.
78
- 3. **The house bridge** — bundled inside the server artifact from the same commit
79
- (`<appDir>/bridge`), run as the house executor so your agents answer, always in
80
- version lockstep with the server. Configured by `cabane setup-agent`.
75
+ secret, any persisted `cabane set-env` creds). Migrations apply on boot.
76
+
77
+ Agents don't run here — they run on a companion you pair (a separate process on a
78
+ device you control), the same as hosted Cabane.
81
79
 
82
80
  ## Layout (`~/.cabane-selfhost/`)
83
81
 
84
82
  ```
85
- config.json the CLI's config (token, port, versions, house ids)
83
+ config.json the CLI's config (token, port, versions, persisted creds)
86
84
  app/<version>/ each installed artifact tree
87
85
  data/pg/ Postgres data dir
88
86
  data/storage/ file bytes (filesystem storage backend)
89
- bridge/ the house bridge's isolated HOME
90
- logs/ server.log · bridge.log
87
+ logs/ server.log
91
88
  run/ supervisor.pid · state.json
92
89
  ```
93
90
 
94
91
  The root defaults to **`~/.cabane-selfhost/`** — deliberately _not_ `~/.cabane`,
95
- which a standalone `@cabane/bridge` user bridge already keys off, so a self-host
96
- install can never clobber a bridge's device pairing on a shared box. Override the
97
- whole root with the **`CABANE_HOME`** env var (the multi-instance lever); a
98
- pre-existing self-host install still living at `~/.cabane` is adopted in place, so
99
- no data moves. A `cabane install` / `set-env` pointed (via `CABANE_HOME`) at a
100
- directory that holds a bridge config refuses rather than overwrite it.
92
+ which a standalone `@cabane/companion` user companion already keys off, so a
93
+ self-host install can never clobber a companion's device pairing on a shared box.
94
+ Override the whole root with the **`CABANE_HOME`** env var (the multi-instance
95
+ lever); a pre-existing self-host install still living at `~/.cabane` is adopted in
96
+ place, so no data moves. A `cabane install` / `set-env` pointed (via `CABANE_HOME`)
97
+ at a directory that holds a companion config refuses rather than overwrite it.
101
98
 
102
99
  **Relocating just the data.** `cabane init` can point the **data** leg (pg +
103
100
  storage) at any path you choose while `config.json` + `app/` stay under the root —
@@ -115,17 +112,28 @@ paths so you can see it.
115
112
 
116
113
  | Command | What it does |
117
114
  | -------------------- | --------------------------------------------------------------------------------------------- |
118
- | `cabane init` | interactive first-run wizard: data location, port, public URL, executor credential |
115
+ | `cabane init` | interactive first-run wizard: data location, port, public URL |
119
116
  | `cabane install` | fetch (token → gated artifact) or `--from` a local tarball; unpack + `npm install --omit=dev` |
120
117
  | `cabane up` | start + supervise the stack (`--daemon` for background) |
121
- | `cabane setup-agent` | after signup: register the house bridge, assign your agent |
118
+ | `cabane setup-agent` | after signup: confirm your account + print companion-pairing guidance |
122
119
  | `cabane update` | install a newer published artifact (keeps N-1 for rollback) |
123
- | `cabane set-env` | persist `KEY=VALUE` credentials forwarded to the house bridge (`--list` / `--unset`) |
120
+ | `cabane set-env` | persist generic `KEY=VALUE` server env forwarded to the server (`--list` / `--unset`) |
124
121
  | `cabane down` | stop a running stack |
125
122
  | `cabane status` | what's installed + running |
126
- | `cabane logs` | tail the server + bridge logs |
123
+ | `cabane logs` | tail the server log |
127
124
  | `cabane doctor` | preflight: diagnose common self-host failure classes (runs with the stack down) |
128
125
 
126
+ ## Running agents
127
+
128
+ A self-hosted server runs no agent turns itself. Agents run exactly as on hosted
129
+ Cabane: on a companion you pair against your instance. Install the desktop
130
+ Companion or the headless `@cabane/companion` on a device you control, sign in
131
+ against your self-hosted URL, pair it, and assign your agents to its connectors.
132
+ The turn runs in the harness on that device — Claude Code, Codex, or OpenCode —
133
+ against the login or key already there; the server never sees the credential. For a
134
+ single-box setup, the companion can run on the same machine as the server (point it
135
+ at `http://localhost:3000`).
136
+
129
137
  ## Troubleshooting — `cabane doctor`
130
138
 
131
139
  When something won't start, run `cabane doctor` **first**. It's a standalone
@@ -135,53 +143,32 @@ pass/fail/warn report, each with a one-line fix, then exits non-zero if any hard
135
143
  check fails. It's strictly local — nothing phones home. Checks:
136
144
 
137
145
  - **Node** ≥ the required version.
138
- - **Executor** — your executor's binary on PATH (`claude` by default), and a
139
- credential reachable by the house bridge (a subscription login, or an
140
- `ANTHROPIC_*` env/persisted key). Reachability only; it never calls the
141
- provider.
142
146
  - **Port** free (or held by a running cabane).
143
147
  - **Embedded Postgres** — platform binaries present + data dir healthy.
144
148
  - **Storage root** — writable, and where it is.
145
- - **Bridge/server version** — the bridge bundled in the installed artifact
146
- matches the server it ships with (a version skew from a mismatched install is
147
- flagged).
148
149
  - **Disk space** for the data dir.
149
150
  - **macOS Gatekeeper** — quarantine on the Postgres binaries (macOS only).
150
151
 
151
- ## Credentials
152
-
153
- The house bridge inherits the environment `cabane up` runs under, so your
154
- executor's credentials reach it — no provider is special-cased:
155
-
156
- - **Claude subscription** — a logged-in Claude Code just works; its OAuth creds
157
- live on disk under `~/.claude` (pointed at by `CLAUDE_CONFIG_DIR`), so there's
158
- nothing to export.
159
- - **API-key billing (or any executor keyed by an env var)** — the key lives in
160
- your environment, not on disk, so make it reachable one of two ways:
161
-
162
- ```sh
163
- # the wizard — `cabane init` prompts for it password-style and persists it
164
- cabane init
165
-
166
- # persisted, on its own — save once; every future `up` (fresh shell, reboot) picks it up.
167
- # A bare KEY prompts for the value (hidden); `KEY=VALUE` still works for scripting.
168
- cabane set-env ANTHROPIC_API_KEY
169
- cabane up --daemon
170
-
171
- # ambient — export in the shell you launch from
172
- export ANTHROPIC_API_KEY=sk-ant-…
173
- cabane up --daemon
174
- ```
175
-
176
- `set-env` stores generic `KEY=VALUE` pairs in `<CABANE_HOME>/config.json` and composes
177
- them into the bridge on every `up`, so it serves any executor's credentials (a
178
- proxy `ANTHROPIC_BASE_URL`, an `ANTHROPIC_AUTH_TOKEN`, another harness's key) —
179
- not just Anthropic. A bare `cabane set-env KEY` (no `=value`) prompts for the value
180
- without echoing, so a secret never lands on the command line. Inspect with `cabane
181
- set-env --list` (values masked), remove with `cabane set-env --unset KEY`. A live shell export takes precedence over a
182
- persisted value; the house-class isolation vars (`HOME`, `CLAUDE_CONFIG_DIR`,
183
- class) always win over both. Apply a change to an already-running stack with
184
- `cabane down && cabane up`.
152
+ ## Server env — `cabane set-env`
153
+
154
+ The self-hosted server needs no model credential of its own. `cabane set-env` stays
155
+ for any generic server env you _do_ want to persist:
156
+
157
+ ```sh
158
+ # persisted — save once; every future `up` (fresh shell, reboot) picks it up.
159
+ # A bare KEY prompts for the value (hidden); `KEY=VALUE` still works for scripting.
160
+ cabane set-env SOME_KEY
161
+ cabane down && cabane up --daemon
162
+ ```
163
+
164
+ It stores generic `KEY=VALUE` pairs in `<CABANE_HOME>/config.json` and layers them
165
+ into the server's env on every `up` — beneath the composed infra vars, so an
166
+ operator key reaches the server but can never clobber `DATABASE_URL` / `NODE_ENV` /
167
+ `STORAGE_*`. A bare `cabane set-env KEY` (no `=value`) prompts for the value without
168
+ echoing, so a secret never lands on the command line. Inspect with
169
+ `cabane set-env --list` (values masked), remove with `cabane set-env --unset KEY`.
170
+ A live shell export takes precedence over a persisted value. Apply a change to an
171
+ already-running stack with `cabane down && cabane up`.
185
172
 
186
173
  ## Notes
187
174