slatebox 0.1.0 → 0.2.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 CHANGED
@@ -3,15 +3,52 @@
3
3
  Run your own Slatebox with one command, on the machine of your choice:
4
4
 
5
5
  ```sh
6
- npx slatebox
6
+ npx slatebox install
7
7
  ```
8
8
 
9
- It asks a few short questions (Enter takes the default), shows a plan of
9
+ Pick a team address and sign in; Slatebox runs at `https://<name>.slatebox.team`
10
+ with no DNS, ports or certificates. Or choose your own domain, or this computer
11
+ only. It asks a few short questions (Enter takes the default), shows a plan of
10
12
  everything it will write, run and create, and installs once you say yes. Then
11
- it prints the address and how to set the admin password. `npx slatebox
12
- --dry-run` asks the same questions and prints the plan without changing
13
- anything. You need Node.js 22.13 or newer, and Docker (or Podman with its
14
- Docker compatibility on) on whatever runs Slatebox.
13
+ it prints the address and a one-time setup link: nobody can sign up until the
14
+ first admin exists, and the person who opens the link creates that account (the
15
+ server administrator and the owner of the first team). The link works once and
16
+ expires in 24 hours; `slatebox setup-link` prints a new one at a terminal and
17
+ ends the last. `npx slatebox --dry-run` asks the same questions and
18
+ prints the plan without changing anything. You need Node.js 22.13 or newer, and
19
+ Docker (or Podman with its Docker compatibility on) on whatever runs Slatebox.
20
+ Plain `npx slatebox` lists the commands.
21
+
22
+ ### A team address
23
+
24
+ ```sh
25
+ npx slatebox install --team-address acme --yes
26
+ ```
27
+
28
+ `acme.slatebox.team` is claimed for your Slatebox account when you approve a
29
+ short code in your browser (like `gh auth login`). The container then connects
30
+ out to Cloudflare through a secure tunnel, which carries HTTPS and live
31
+ editing: nothing is opened on your machine or router, and the container starts
32
+ again when the machine does. Names are 3 to 32 characters (a-z, 0-9, hyphens).
33
+ An account holds up to 3. Your address is public; your slates are not.
34
+
35
+ The install keeps one credential for the address, on this computer only:
36
+ `~/.slatebox/installs/<name>/credentials.json` (mode 0600). It can fetch the
37
+ tunnel token again and give the address back, and nothing else.
38
+
39
+ ```sh
40
+ slatebox status # includes the address and the tunnel's connections
41
+ slatebox setup-link # a new one-time link for the first admin (ends the last one)
42
+ slatebox rename acme-boards # move to https://acme-boards.slatebox.team (sign-in)
43
+ slatebox address rotate # a new tunnel token; any copy of the old one stops working
44
+ slatebox address release # give the address back; Slatebox keeps running on this computer
45
+ slatebox uninstall # also gives the address back, unless --keep-address
46
+ ```
47
+
48
+ A released name is held for your account for 30 days. Slatebox Cloud releases
49
+ an address that never connected within 24 hours, and one unused for 90 days.
50
+ To leave the team address for your own domain, run
51
+ `npx slatebox install --domain boards.example.com`.
15
52
 
16
53
  Slatebox is one container: the app, the live collaboration relay, MongoDB and
17
54
  Keycloak for single sign-on (off until you turn it on). It is free, and single
@@ -19,8 +56,8 @@ sign-on is free.
19
56
 
20
57
  | Where | How |
21
58
  | --- | --- |
22
- | This computer | `npx slatebox` (the default). Picks a free port from 7070 and prints the address. |
23
- | A Linux server | `npx slatebox install ssh root@203.0.113.5 --domain boards.example.com`. With a domain, HTTPS certificates are obtained and renewed automatically (point DNS at the server, open ports 80 and 443); without one, `http://<server>:7070`. Docker is installed only if you add `--install-docker`. |
59
+ | This computer | `npx slatebox install` (the default). A team address, your own domain, or `--local` for `http://localhost` on a free port from 7070. |
60
+ | A Linux server | `npx slatebox install ssh root@203.0.113.5 --team-address acme`, or `--domain boards.example.com`. With a domain, HTTPS certificates are obtained and renewed automatically (point DNS at the server, open ports 80 and 443); without one, `http://<server>:7070`. Docker is installed only if you add `--install-docker`. |
24
61
  | Kubernetes | `npx slatebox install k8s --route ingress --domain boards.example.com --tls-issuer ClusterIssuer/letsencrypt`. Uses kubectl and your current context (a context whose name looks like production must be named with `--k8s-context`). One StatefulSet with a volume, a Service, an optional Ingress or Gateway API HTTPRoute, a Secret, and a backups sidecar. |
25
62
  | Files only | `npx slatebox install export --format compose\|manifests\|helm --out ./slatebox-deploy` for GitOps. Nothing is applied. |
26
63
 
@@ -85,12 +122,13 @@ With `--json`, stdout is one JSON event per line (`plan`, `step`, `done`,
85
122
 
86
123
  ```sh
87
124
  slatebox status # address, health, version, AI, SSO, last backup
125
+ slatebox logs [-f] [--service tunnel] # the container's log, every line redacted
88
126
  slatebox upgrade # back up, upgrade, check health, roll back (with the backup) on failure
89
127
  slatebox backup [--to ./backups] # a complete backup now
90
128
  slatebox restore slatebox-backup.gz
91
129
  slatebox secrets path # where SLATEBOX_KEY_ENCRYPTION_KEY and your keys are kept
92
130
  slatebox secrets reveal SLATEBOX_KEY_ENCRYPTION_KEY # to a terminal only, never with --json
93
- slatebox uninstall # keeps data; --delete-data --confirm <name> removes it
131
+ slatebox uninstall # keeps data; --delete-data --confirm <name> removes it (alias: remove)
94
132
  slatebox installs # every install this computer made (--name picks one)
95
133
  ```
96
134
 
@@ -101,6 +139,42 @@ computer, `/opt/slatebox/secrets.env` (root, 0600) on a server, or the Secret
101
139
  it the AI keys people saved cannot be read after a restore. Re-running the
102
140
  installer never makes a new one.
103
141
 
142
+ ## Move your team to Slatebox Cloud, or back
143
+
144
+ ```sh
145
+ npx slatebox migrate --to cloud # your own server's team → Slatebox Cloud
146
+ npx slatebox import --from cloud # your Slatebox Cloud team → your own server
147
+ npx slatebox install --from cloud # a new server, then the steps to bring your Cloud team over
148
+ npx slatebox export --out acme.sbxteam --passphrase prompt # a team export file
149
+ npx slatebox import acme.sbxteam --to cloud --passphrase prompt
150
+ ```
151
+
152
+ The command exports everything your team owns from one side (you need to be a team admin
153
+ there), and moves it to the other side, where you own your team or are in no team yet. It
154
+ moves slates and boards, smart components, versions, comments, presentations, files, the
155
+ brand kit, and library items (sent to the other side's review queue). People arrive as
156
+ placeholders. Once the move is live you are asked once, "Send invitations to the N other
157
+ members now?" (yes by default; `--invite` / `--no-invite` answer ahead; a script invites
158
+ nobody without `--invite`). Later: `npx slatebox migrate invite <move id> --to cloud`. Someone
159
+ who already has an account on the other side accepts an invitation to join there. Passwords,
160
+ keys, access tokens and connected agents never move.
161
+
162
+ You see the report before anything is visible on the other side, and nothing goes live until
163
+ you confirm. The team stays where it was until you remove it there.
164
+
165
+ - **Your own server:** its address is `--from`/`--to <url>`, `SLATEBOX_BASE_URL`, or the install
166
+ this computer made (`--name`). Its access token is `SLATEBOX_API_TOKEN` (make one in Profile →
167
+ Developer with "Export everything my team owns" and "Move a team here"). At a terminal you are
168
+ asked for it, with hidden input.
169
+ - **Slatebox Cloud:** you sign in with a code in your browser (the page says "Move your team";
170
+ the sign-in works for the move only, for an hour), or set `SLATEBOX_CLOUD_TOKEN`.
171
+ - **The archive** is encrypted with a passphrase made for this move, in `~/.slatebox/moves/`
172
+ (mode 0600). Once the move is live you are asked whether to delete it (no by default; the
173
+ command to delete it is printed). `--delete-archive` deletes it, `--keep-archive` keeps it,
174
+ without asking.
175
+ - An older server than the archive stops the move with "update that server"; the archive is kept.
176
+ - `--replace-waiting` discards a move that is already waiting on the other side.
177
+
104
178
  ## Safety
105
179
 
106
180
  - A plan is always shown first. On a server or a cluster nothing changes
@@ -126,14 +200,17 @@ installer never makes a new one.
126
200
  command lines (`ps` can read those); they travel on standard input or in
127
201
  0600 files.
128
202
  - Re-running with the same answers changes nothing.
129
- - Nothing phones home. The installer contacts the image registry, and only
130
- with your consent get.docker.com; Slatebox itself contacts the certificate
131
- authority when you give a domain, and the AI endpoints you configure.
203
+ - Nothing phones home. The installer contacts the image registry, Slatebox
204
+ Cloud only when you ask for a team address, and only with your consent
205
+ get.docker.com; Slatebox itself contacts Cloudflare's tunnel when it has a
206
+ team address, the certificate authority when you give a domain, and the AI
207
+ endpoints you configure.
132
208
 
133
209
  ## Which image
134
210
 
135
211
  Each release of this package installs one public image,
136
- `ghcr.io/slatebox/slatebox`, by its digest (this release: `0.1.0`). It needs
212
+ `ghcr.io/slatebox/slatebox`, by its digest (this release: `0.2.1`, which adds
213
+ the team-address tunnel, the setup link and team moves). It needs
137
214
  no registry login. To install a local build instead, give `--image <name>`
138
215
  (or `--image-archive slatebox.tar` for a server).
139
216
 
@@ -148,5 +225,8 @@ address answers.
148
225
 
149
226
  ## Slates
150
227
 
151
- `slatebox exec` and `slatebox describe` (scripts against a Slatebox) come from
152
- the slatebox-mcp package; this command fetches it the first time you use one.
228
+ `slatebox exec`, `slatebox describe` and `slatebox mcp` (scripts and agents
229
+ against any Slatebox) come from the slatebox-mcp package, which this package
230
+ installs with it. If you installed slatebox-mcp 0.3 globally, which also named
231
+ a `slatebox` command, replace it with:
232
+ `npm rm -g slatebox-mcp && npm i -g slatebox slatebox-mcp`.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "slatebox",
3
- "version": "0.1.0",
4
- "description": "Install your own Slatebox with one command: npx slatebox. Runs on the machine of your choice (Docker on this computer, a server over SSH, Kubernetes, or files only), asks a few questions, shows a plan, and starts the one-container Slatebox.",
3
+ "version": "0.2.0",
4
+ "description": "Run your own Slatebox with one command: npx slatebox install. Gives it a free team address (https://<name>.slatebox.team) with no DNS, ports or certificates, or uses your own domain; installs on Docker here, a server over SSH, Kubernetes, or writes the files. Also runs agent scripts against any Slatebox (slatebox exec).",
5
5
  "keywords": [
6
6
  "slatebox",
7
7
  "self-host",
@@ -39,5 +39,8 @@
39
39
  },
40
40
  "engines": {
41
41
  "node": ">=22.13"
42
+ },
43
+ "dependencies": {
44
+ "slatebox-mcp": "0.4.0"
42
45
  }
43
46
  }
@@ -9,7 +9,9 @@ you what it still needs. Follow these steps exactly.
9
9
  1. **Ask the person** (do not guess):
10
10
  - Where: this computer (Docker), a Linux server over SSH (user@host), or
11
11
  Kubernetes (which kube context and namespace). Or only write the files.
12
- - The address: a domain name for HTTPS, or a port.
12
+ - The address: a free team address (https://<name>.slatebox.team: no DNS,
13
+ ports or certificates; the person signs in once in their browser to claim
14
+ it), a domain name for HTTPS, or a port.
13
15
  - The admin email (required for a server or a cluster).
14
16
  - AI: none for now, or which providers. Slatebox works with any provider and
15
17
  has no default: OpenAI, Anthropic, DeepInfra, OpenRouter, Groq, Together,
@@ -31,6 +33,7 @@ you what it still needs. Follow these steps exactly.
31
33
  default: local
32
34
  sso: { enabled: false }
33
35
  # ssh: { host: 203.0.113.5, user: root } with target: ssh
36
+ # address: { team: acme } a team address, https://acme.slatebox.team
34
37
  # address: { domain: boards.example.com } for HTTPS on a server or a cluster route
35
38
  # k8s: { context: my-cluster, namespace: slatebox, route: ingress, ingressClass: nginx, tlsIssuer: { kind: ClusterIssuer, name: letsencrypt } }
36
39
  \`\`\`
@@ -46,10 +49,22 @@ you what it still needs. Follow these steps exactly.
46
49
  checking, and never export SLATEBOX_INSTALL_YES (it is ignored).
47
50
  4. **Show the plan to the person and get an explicit yes.** It lists every
48
51
  file, command, object and port, and where the secrets are kept.
52
+ With a team address the short form is
53
+ \`npx slatebox install --team-address <name> --yes\` (add \`--ai none\` or the
54
+ providers the person chose). Exit 3 with \`id: "address-unavailable"\` lists free
55
+ \`suggestions\`: ask the person to pick one.
49
56
  5. **Install**: \`npx -y slatebox@latest install --answers slatebox.yaml --yes --json\`.
57
+ For a team address a \`sign-in\` event carries \`verificationUri\` and \`userCode\`:
58
+ show both to the person and ask them to approve it in their browser; the
59
+ command waits. Never approve it yourself.
50
60
  Report \`done.address\` from the last line. Do not print or copy any secret;
51
61
  the output never contains one. Tell the person where the key encryption key
52
62
  is stored (\`done.secretsFile\`) and that they must back it up themselves.
63
+ Nobody can sign up until the first admin exists. Tell the person to run
64
+ \`slatebox setup-link\` in their own terminal: it prints a one-time link
65
+ (24 hours, single use) that creates the first account, the server
66
+ administrator. Never run it yourself or ask for the link: it is as good as
67
+ an admin password.
53
68
  6. **If it fails**: exit 5 means the change was rolled back and the previous
54
69
  state is running; exit 6 means a person must act: show them
55
70
  \`error.commands\` and stop.
@@ -59,6 +74,6 @@ you what it still needs. Follow these steps exactly.
59
74
  asked for their data to be deleted.
60
75
 
61
76
  Nothing the installer runs sends data anywhere except pulling the image (and,
62
- with consent, installing Docker from get.docker.com, and the certificate
63
- authority when a domain is given).
77
+ with consent, installing Docker from get.docker.com, the certificate authority
78
+ when a domain is given, and Slatebox Cloud when a team address is asked for).
64
79
  `
package/src/answers.mjs CHANGED
@@ -5,6 +5,7 @@
5
5
  import { isAbsolute, join, normalize, resolve as resolvePath } from 'node:path'
6
6
  import { isRef, looksLikeKey } from './secrets.mjs'
7
7
  import { normalizeProvider, PROVIDER_KINDS } from './ai/settings-adapter.mjs'
8
+ import { teamAddressProblem, teamUrl } from './cloud.mjs'
8
9
 
9
10
  export const TARGETS = ['local', 'ssh', 'k8s', 'export']
10
11
  export const SIZES = Object.freeze({
@@ -24,10 +25,10 @@ export const ANSWER_FLAGS = {
24
25
  'mail-url-from': 'string', 'mail-from': 'string', backups: 'string', 'backup-schedule': 'string', 'backup-keep': 'string',
25
26
  size: 'string', 'k8s-context': 'string', namespace: 'string', route: 'string', 'ingress-class': 'string',
26
27
  'gateway-ref': 'string', 'tls-issuer': 'string', 'storage-class': 'string', format: 'string', out: 'string',
27
- image: 'string', name: 'string', 'acme-ca': 'string', settings: 'string',
28
+ image: 'string', name: 'string', 'acme-ca': 'string', settings: 'string', 'team-address': 'string', local: 'boolean',
28
29
  }
29
30
  // Global flags that also have an environment form.
30
- const GLOBAL_ENV_FLAGS = { answers: 'string', json: 'boolean', agent: 'string', 'image-archive': 'string', home: 'string', debug: 'boolean', 'health-timeout': 'string' }
31
+ const GLOBAL_ENV_FLAGS = { answers: 'string', json: 'boolean', agent: 'string', 'image-archive': 'string', home: 'string', debug: 'boolean', 'health-timeout': 'string', 'cloud-url': 'string' }
31
32
 
32
33
  const isObject = value => value && typeof value === 'object' && !Array.isArray(value)
33
34
 
@@ -110,6 +111,12 @@ export function answersFromFlags(flags) {
110
111
  set('ssh.options', flags['ssh-option'])
111
112
  set('address.url', flags.url)
112
113
  set('address.domain', flags.domain)
114
+ set('address.team', flags['team-address'])
115
+ // One address at a time: a flag for one kind replaces what an earlier install had of the others.
116
+ if (flags['team-address']) { set('address.url', flags.url ?? null); set('address.domain', flags.domain ?? null) }
117
+ if (flags.domain || flags.url) set('address.team', flags['team-address'] ?? null)
118
+ // --local: this computer only, and no team address even if an earlier install had one.
119
+ if (flags.local) { set('address.team', null); set('address.url', null); set('address.domain', null) }
113
120
  set('address.listen', flags.listen)
114
121
  if (flags.port !== undefined) set('address.port', Number(flags.port))
115
122
  set('adminEmail', flags['admin-email'])
@@ -188,7 +195,7 @@ export const QUESTIONS = {
188
195
  flag: '--target',
189
196
  },
190
197
  'ssh.host': { question: 'Server (user@host or a name from ~/.ssh/config)', flag: '--host' },
191
- adminEmail: { question: 'Admin email (the first account, and the HTTPS certificate contact)', flag: '--admin-email' },
198
+ adminEmail: { question: 'Admin email (the HTTPS certificate contact; the first account comes from the setup link)', flag: '--admin-email' },
192
199
  'ai.mode': {
193
200
  question: 'AI for drafts and the canvas assistant. Slatebox works with any provider, and none is chosen for you.',
194
201
  choices: AI_CHOICES,
@@ -329,14 +336,31 @@ export function resolveAnswers(partial, ctx = {}) {
329
336
  const k8s = a.target === 'k8s' || Boolean(a.k8s)
330
337
  if (given.domain && given.url) err('address.url', 'give a domain or a URL, not both')
331
338
  let url = given.domain ? `https://${given.domain}` : given.url
332
- if (k8s) {
339
+ // A team address: https://<name>.slatebox.team through an outbound tunnel from the container.
340
+ // Nothing is published beyond 127.0.0.1 and Slatebox's own HTTPS stays off.
341
+ const team = given.team ?? null
342
+ if (team !== null) {
343
+ const problem = teamAddressProblem(team)
344
+ if (problem) err('address.team', problem)
345
+ if (given.domain || (given.url && given.url !== teamUrl(team))) err('address.team', 'give a team address, a domain or a URL, not more than one')
346
+ if (a.target === 'export') err('address.team', 'a team address is claimed when Slatebox is installed; for files only use --domain, or install with --target local, ssh or k8s')
347
+ if (k8s && a.k8s.route !== 'none') err('address.team', 'a team address needs no route: leave --route out (traffic arrives through the tunnel)')
348
+ if (!problem) url = teamUrl(team)
349
+ }
350
+ if (team !== null && !k8s) {
351
+ const port = given.port ?? (a.target === 'local' ? (ctx.freePort ?? DEFAULT_PORT) : DEFAULT_PORT)
352
+ if (!Number.isInteger(port) || port < 1 || port > 65535) err('address.port', 'a port number')
353
+ const listen = given.listen ?? '127.0.0.1'
354
+ if (!['127.0.0.1', '::1'].includes(listen)) err('address.listen', 'with a team address Slatebox is published on 127.0.0.1 only (traffic arrives through the tunnel)')
355
+ a.address = { url: url ?? null, port, listen, team }
356
+ } else if (k8s) {
333
357
  if (a.k8s.route === 'none') {
334
358
  url ??= `http://localhost:${DEFAULT_PORT}`
335
359
  } else if (!url || !httpUrl(url) || httpUrl(url).protocol !== 'https:') {
336
360
  err('address.url', `a route (${a.k8s.route}) needs the host name people will use, given as --domain`)
337
361
  url = null
338
362
  }
339
- a.address = { url }
363
+ a.address = team !== null ? { url, team } : { url }
340
364
  } else {
341
365
  let port = given.port
342
366
  if (url && httpUrl(url)?.protocol === 'https:') {