layerbase 1.0.0 → 1.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 +110 -4
- package/dist/cli.js +166 -3
- package/dist/cli.js.map +1 -1
- package/dist/commands/agent-init.js +112 -0
- package/dist/commands/agent-init.js.map +1 -0
- package/dist/commands/cloud-branch.js +97 -0
- package/dist/commands/cloud-branch.js.map +1 -0
- package/dist/commands/cloud-write.js +133 -0
- package/dist/commands/cloud-write.js.map +1 -0
- package/dist/commands/connection-string.js +17 -16
- package/dist/commands/connection-string.js.map +1 -1
- package/dist/commands/import.js +96 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/interactive.js +2 -0
- package/dist/commands/interactive.js.map +1 -1
- package/dist/commands/key-login.js +48 -0
- package/dist/commands/key-login.js.map +1 -0
- package/dist/commands/ls.js +17 -5
- package/dist/commands/ls.js.map +1 -1
- package/dist/commands/migrate.js +331 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/whoami-run.js +87 -0
- package/dist/commands/whoami-run.js.map +1 -0
- package/dist/commands/whoami.js +1 -1
- package/dist/commands/whoami.js.map +1 -1
- package/dist/lib/cli-output.js +28 -0
- package/dist/lib/cli-output.js.map +1 -0
- package/dist/lib/cloud-api.js +333 -20
- package/dist/lib/cloud-api.js.map +1 -1
- package/dist/lib/commands.js +18 -1
- package/dist/lib/commands.js.map +1 -1
- package/dist/lib/config.js +18 -0
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/confirm.js +17 -0
- package/dist/lib/confirm.js.map +1 -0
- package/dist/lib/duration.js +33 -0
- package/dist/lib/duration.js.map +1 -0
- package/dist/lib/migration-catalog.js +209 -0
- package/dist/lib/migration-catalog.js.map +1 -0
- package/dist/lib/redact.js +23 -0
- package/dist/lib/redact.js.map +1 -0
- package/dist/lib/select.js +48 -0
- package/dist/lib/select.js.map +1 -0
- package/dist/ui/app.js +1 -1
- package/dist/ui/app.js.map +1 -1
- package/package.json +4 -2
- package/skills/layerbase/SKILL.md +222 -0
package/README.md
CHANGED
|
@@ -65,21 +65,122 @@ These are the only verbs layerbase owns; everything else is spindb.
|
|
|
65
65
|
| Command | Description |
|
|
66
66
|
| --- | --- |
|
|
67
67
|
| `lbase login` | Sign in via the browser; stores a token in `~/.layerbase-cli`. |
|
|
68
|
+
| `lbase login --api-key <key>` | Save a personal `sk_` API key for headless use (no browser). |
|
|
68
69
|
| `lbase logout` | Remove the stored credentials. |
|
|
69
|
-
| `lbase whoami` | Show the signed-in account and
|
|
70
|
+
| `lbase whoami` | Show the signed-in account (and API-key usage in key mode) (`--json`). |
|
|
70
71
|
| `lbase cloud ls` | List your cloud databases (`--json` for scripting). |
|
|
72
|
+
| `lbase cloud create <name> --engine <e> [--ttl 2h]` | Provision a database (`--ttl` makes it transient). |
|
|
73
|
+
| `lbase cloud delete <db> --yes` | Delete a database (`--yes`/`-y` to skip the prompt). |
|
|
74
|
+
| `lbase cloud start <db>` / `stop <db>` | Start or stop a database. |
|
|
75
|
+
| `lbase cloud branch <db> <name>` | Create or reuse a branch (idempotent). |
|
|
76
|
+
| `lbase cloud branch reset <db> <name>` | Re-fork a branch from its parent. |
|
|
77
|
+
| `lbase cloud branch delete <db> <name>` | Delete a branch. |
|
|
78
|
+
| `lbase cloud branch ls <db>` | List a database's branches (`--json`). |
|
|
71
79
|
| `lbase cloud connect <db>` | Connect with the engine's native client. |
|
|
72
80
|
| `lbase cloud clone <db> [name]` | Clone a cloud database into a local spindb container. |
|
|
73
|
-
| `lbase cloud connection-string <db>` | Print the connection string (reveals the password; alias: `url`). |
|
|
81
|
+
| `lbase cloud connection-string <db>` | Print the connection string (reveals the password; alias: `url`; `--json`). |
|
|
74
82
|
| `lbase psql <db>` | Connect to a cloud Postgres-family database. |
|
|
75
83
|
| `lbase redis-cli <db>` | Connect to a cloud Redis / Valkey database. |
|
|
76
84
|
| `lbase mysql <db>` | Connect to a cloud MySQL / MariaDB database. |
|
|
85
|
+
| `lbase migrate --source <id> --target <db>` | Migrate an external database into a cloud database. |
|
|
86
|
+
| `lbase import <dumpfile> --target <db>` | Import a dump file into a cloud database. |
|
|
87
|
+
| `lbase agent init [--global]` | Install the Layerbase skill for AI coding agents. |
|
|
77
88
|
| `lbase alias` | Set up the short `lb` command (only if it is free). |
|
|
78
89
|
| `lbase chat` | Interactive console for your Layerbase account. |
|
|
79
90
|
|
|
80
91
|
`<db>` accepts a cloud database id or its name. Add `--print` to
|
|
81
92
|
`cloud connect` to show the connection details instead of launching a client.
|
|
82
|
-
`lbase cloud` with no subcommand prints the cloud help.
|
|
93
|
+
`lbase cloud` with no subcommand prints the cloud help. Cloud mutation commands
|
|
94
|
+
(`create`, `delete`, `start`, `stop`, `branch`) run against the cloud API and
|
|
95
|
+
need an API key (see [Headless auth](#headless-auth-ci-and-agents)); every one
|
|
96
|
+
supports `--json` and returns a meaningful exit code.
|
|
97
|
+
|
|
98
|
+
## Migrations and imports
|
|
99
|
+
|
|
100
|
+
`lbase migrate` imports an external database **into an existing cloud database**,
|
|
101
|
+
and `lbase import` restores a whole-database dump file. Both are headless (need
|
|
102
|
+
an API key), support `--json`, and never write credentials to stdout, stderr, or
|
|
103
|
+
JSON output. Run `lbase migrate --help` for the full per-source flag list.
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# Connection-string sources (paste one URL):
|
|
107
|
+
lbase migrate --source postgres --target my-db \
|
|
108
|
+
--connection-string "postgresql://user:pass@host:5432/db" --yes
|
|
109
|
+
|
|
110
|
+
# API-key sources (we discover the account, then you pick a database):
|
|
111
|
+
lbase migrate --source neon --target my-db --source-key napi_... --yes
|
|
112
|
+
lbase migrate --source algolia --target my-search --source-key <admin-key> --app-id <app-id> --yes
|
|
113
|
+
lbase migrate --source turso --target my-libsql --source-key <token> --url libsql://... --yes
|
|
114
|
+
|
|
115
|
+
# Whole-database dump import:
|
|
116
|
+
lbase import ./backup.dump --target my-db --yes
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Sources: `neon`, `supabase`, `render`, `railway`, `postgres`, `mysql`,
|
|
120
|
+
`mariadb`, `planetscale`, `upstash`, `vercel-kv`, `redis`, `valkey`, `algolia`
|
|
121
|
+
(to Meilisearch), `turso` (to libSQL). Connection-string sources
|
|
122
|
+
(`postgres`/`mysql`/`mariadb`/`redis`/`valkey`/`vercel-kv`) take
|
|
123
|
+
`--connection-string` (alias `--url`). API-key sources take `--source-key` (alias
|
|
124
|
+
`--token`) plus, where needed, `--source-id` (aliases `--app-id`, `--email`,
|
|
125
|
+
`--token-id`, `--url` for a Turso database URL) and `--source-secret` (alias
|
|
126
|
+
`--db-password`, Supabase only). When multiple source databases are discovered,
|
|
127
|
+
pick one with `--source-db <label-or-number>` (or interactively on a TTY).
|
|
128
|
+
|
|
129
|
+
`--json` on `migrate` prints **one** final result object (no interim progress
|
|
130
|
+
lines): `{ ok, runId, status, databaseId, report }` on success or
|
|
131
|
+
`{ ok: false, runId, status, error }` on failure; without `--json`, status and
|
|
132
|
+
progress stream while the migration run polls. `--yes` (`-y`) confirms
|
|
133
|
+
non-interactively; a migration or import may overwrite the target's data, so a
|
|
134
|
+
non-TTY run without `--yes` refuses and exits `1`.
|
|
135
|
+
|
|
136
|
+
## Headless auth (CI and agents)
|
|
137
|
+
|
|
138
|
+
For CI pipelines and coding agents, authenticate with a personal API key instead
|
|
139
|
+
of the browser flow. Create one in the dashboard at
|
|
140
|
+
`https://layerbase.com/cloud/settings`, then either export it or save it:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
export LAYERBASE_API_KEY=sk_... # env var: no login step needed at all
|
|
144
|
+
# or
|
|
145
|
+
lbase login --api-key sk_... # persists it to ~/.layerbase-cli (0600)
|
|
146
|
+
# or, per-invocation
|
|
147
|
+
lbase cloud ls --api-key sk_... --json
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Precedence is `--api-key` flag > `LAYERBASE_API_KEY` env > stored key. When a key
|
|
151
|
+
is in play, cloud calls go **directly** to the cloud API (the browser-JWT proxy
|
|
152
|
+
is skipped). Note: a key is tied to one account and works against your primary
|
|
153
|
+
control plane.
|
|
154
|
+
|
|
155
|
+
A transient database auto-deletes at its TTL, so a crashed CI run cannot strand
|
|
156
|
+
a database against your quota. Where the engine supports branching, a
|
|
157
|
+
branch-per-run (branch from a seeded parent, `reset` between runs, `delete` on
|
|
158
|
+
teardown) is the cheaper CI primitive.
|
|
159
|
+
|
|
160
|
+
```yaml
|
|
161
|
+
# .github/workflows/test.yml (excerpt)
|
|
162
|
+
env:
|
|
163
|
+
LAYERBASE_API_KEY: ${{ secrets.LAYERBASE_API_KEY }}
|
|
164
|
+
steps:
|
|
165
|
+
- run: npm i -g layerbase
|
|
166
|
+
- run: |
|
|
167
|
+
DB=$(lbase cloud create "ci-$GITHUB_RUN_ID" --engine postgresql --ttl 2h --json)
|
|
168
|
+
echo "DATABASE_URL=$(echo "$DB" | jq -r .connectionString)" >> "$GITHUB_ENV"
|
|
169
|
+
- run: npm test
|
|
170
|
+
- if: always()
|
|
171
|
+
run: lbase cloud delete "ci-$GITHUB_RUN_ID" --yes || true
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Exit codes for scripting: `0` success, `1` usage/generic, `3` auth (invalid or
|
|
175
|
+
revoked key), `4` account paused, `5` capacity, `6` quota or rate limit.
|
|
176
|
+
|
|
177
|
+
## Agents
|
|
178
|
+
|
|
179
|
+
`lbase agent init` installs the Layerbase skill so a coding agent (Claude Code,
|
|
180
|
+
etc.) knows how to use Layerbase. It writes `./.claude/skills/layerbase/SKILL.md`
|
|
181
|
+
(or `~/.claude/skills/layerbase/SKILL.md` with `--global`), fetching the latest
|
|
182
|
+
skill from `https://layerbase.com/skill.md` and falling back to the bundled copy
|
|
183
|
+
offline. It then prints an `AGENTS.md` snippet for Codex and other agents.
|
|
83
184
|
|
|
84
185
|
**Rule of thumb: bare = spindb, cloud = `lbase cloud <verb>`.** So `lbase ls`
|
|
85
186
|
lists your **local** containers (spindb) and `lbase cloud ls` lists your
|
|
@@ -140,6 +241,9 @@ delivered to a loopback address. It is stored at
|
|
|
140
241
|
`~/.layerbase-cli/credentials.json` (mode `0600`). This mirrors how the
|
|
141
242
|
Layerbase desktop app signs in. Run `layerbase logout` to remove it.
|
|
142
243
|
|
|
244
|
+
For non-interactive use (CI, agents), skip the browser entirely with an API key:
|
|
245
|
+
see [Headless auth](#headless-auth-ci-and-agents).
|
|
246
|
+
|
|
143
247
|
## The `lb` shortcut
|
|
144
248
|
|
|
145
249
|
The CLI installs as `layerbase` and `lbase`. For a two-letter `lb`, run
|
|
@@ -152,7 +256,9 @@ alone and suggests a shell alias instead.
|
|
|
152
256
|
|
|
153
257
|
| Variable | Purpose |
|
|
154
258
|
| --- | --- |
|
|
155
|
-
| `
|
|
259
|
+
| `LAYERBASE_API_KEY` | Personal `sk_` API key for headless cloud access (see [Headless auth](#headless-auth-ci-and-agents)). |
|
|
260
|
+
| `LAYERBASE_API_URL` | Override the web API base used by the browser-login flow (default `https://layerbase.com`). |
|
|
261
|
+
| `LAYERBASE_CLOUD_API_URL` | Override the cloud API base used in key mode (default `https://cloud.layerbase.dev`). |
|
|
156
262
|
|
|
157
263
|
## Requirements
|
|
158
264
|
|
package/dist/cli.js
CHANGED
|
@@ -9,6 +9,14 @@ import { runClone } from './commands/clone.js';
|
|
|
9
9
|
import { runSpindb } from './lib/run-spindb.js';
|
|
10
10
|
import { registeredCommandNames } from './lib/commands.js';
|
|
11
11
|
import { getVersion } from './lib/version.js';
|
|
12
|
+
import { configureCloudAuth } from './lib/cloud-api.js';
|
|
13
|
+
import { runWhoami } from './commands/whoami-run.js';
|
|
14
|
+
import { runKeyLogin } from './commands/key-login.js';
|
|
15
|
+
import { runCreate, runDestroy, runStart, runStop, } from './commands/cloud-write.js';
|
|
16
|
+
import { runBranch } from './commands/cloud-branch.js';
|
|
17
|
+
import { runAgentInit } from './commands/agent-init.js';
|
|
18
|
+
import { runMigrate } from './commands/migrate.js';
|
|
19
|
+
import { runImport } from './commands/import.js';
|
|
12
20
|
const VERSION = getVersion();
|
|
13
21
|
const UNIFIED_HELP = `
|
|
14
22
|
Layerbase ${VERSION} - local-first database CLI (also as lbase)
|
|
@@ -22,13 +30,25 @@ const UNIFIED_HELP = `
|
|
|
22
30
|
Cloud account
|
|
23
31
|
login / logout / whoami Manage your Layerbase session
|
|
24
32
|
cloud ls List your cloud databases (--json to script)
|
|
33
|
+
cloud create <name> --engine <e> [--ttl 2h] Provision a database
|
|
34
|
+
cloud delete <db> --yes Delete a cloud database
|
|
35
|
+
cloud start / stop <db> Start or stop a cloud database
|
|
36
|
+
cloud branch <db> <name> Create/reset/delete/ls database branches
|
|
25
37
|
cloud connect <db> Connect with the engine's native client
|
|
26
38
|
cloud clone <db> [name] Clone a cloud database into local spindb
|
|
27
39
|
cloud connection-string <db> Print the connection string (reveals password)
|
|
28
40
|
psql / mysql / redis-cli <db> Connect to a cloud database by engine
|
|
41
|
+
migrate --source <s> --target <db> Import an external database into a cloud DB
|
|
42
|
+
import <dumpfile> --target <db> Import a dump file into a cloud database
|
|
43
|
+
agent init [--global] Install the Layerbase skill for AI agents
|
|
29
44
|
alias Set up the short "lb" command
|
|
30
45
|
chat Interactive console for your Layerbase account
|
|
31
46
|
|
|
47
|
+
Headless auth (CI / agents)
|
|
48
|
+
Set LAYERBASE_API_KEY (or pass --api-key) to run cloud commands with no
|
|
49
|
+
browser: calls go straight to the cloud API. "layerbase login --api-key
|
|
50
|
+
<key>" saves it. Create a key at https://layerbase.com/cloud/settings.
|
|
51
|
+
|
|
32
52
|
Notes
|
|
33
53
|
bare = spindb, cloud = "lbase cloud <verb>"
|
|
34
54
|
"lbase --help" / "--version" show this help / the layerbase version.
|
|
@@ -38,25 +58,93 @@ const UNIFIED_HELP = `
|
|
|
38
58
|
$ lbase # spindb's interactive menu
|
|
39
59
|
$ lbase create my-db --engine sqlite
|
|
40
60
|
$ lbase login
|
|
41
|
-
$ lbase cloud ls
|
|
61
|
+
$ lbase cloud ls --json
|
|
62
|
+
$ LAYERBASE_API_KEY=sk_... lbase cloud create ci-db --engine postgresql --ttl 2h
|
|
42
63
|
$ lbase psql my-cloud-db
|
|
43
64
|
`;
|
|
44
65
|
const CLOUD_HELP = `
|
|
45
66
|
Cloud account commands
|
|
46
67
|
|
|
47
|
-
login / logout / whoami Manage your Layerbase session
|
|
48
68
|
lbase cloud ls List your cloud databases (--json to script)
|
|
69
|
+
lbase cloud create <name> --engine <e> [--ttl 2h] [--json]
|
|
70
|
+
Provision a database (--ttl makes it transient)
|
|
71
|
+
lbase cloud delete <db> --yes Delete a database (--yes to skip the prompt)
|
|
72
|
+
lbase cloud start <db> Start a database
|
|
73
|
+
lbase cloud stop <db> Stop a database
|
|
74
|
+
lbase cloud branch <db> <name> Create or reuse a branch
|
|
75
|
+
lbase cloud branch reset <db> <name> Re-fork a branch from its parent
|
|
76
|
+
lbase cloud branch delete <db> <name> Delete a branch
|
|
77
|
+
lbase cloud branch ls <db> List a database branches
|
|
49
78
|
lbase cloud connect <db> Connect with the engine's native client
|
|
50
79
|
lbase cloud clone <db> [name] Clone a cloud database into local spindb
|
|
51
80
|
lbase cloud connection-string <db> (alias: url)
|
|
52
81
|
Print the connection string (reveals password)
|
|
53
82
|
lbase psql / mysql / redis-cli <db> Connect to a cloud database by engine
|
|
54
83
|
|
|
55
|
-
"<db>" accepts a cloud database id or its name.
|
|
84
|
+
"<db>" accepts a cloud database id or its name. Set LAYERBASE_API_KEY (or pass
|
|
85
|
+
--api-key) to run these headlessly with no browser login.
|
|
86
|
+
`;
|
|
87
|
+
const MIGRATE_HELP = `
|
|
88
|
+
layerbase migrate - import an external database INTO a cloud database
|
|
89
|
+
|
|
90
|
+
layerbase migrate --source <id> --target <db-id-or-name> [creds] [--yes] [--json]
|
|
91
|
+
|
|
92
|
+
Sources and their credential flags
|
|
93
|
+
Connection-string sources (paste one URL with --connection-string, alias --url):
|
|
94
|
+
postgres postgresql://user:password@host:5432/dbname
|
|
95
|
+
mysql mysql://user:password@host:3306/dbname
|
|
96
|
+
mariadb mysql://... (MariaDB is MySQL-compatible)
|
|
97
|
+
redis redis:// or rediss://
|
|
98
|
+
valkey redis:// or rediss://
|
|
99
|
+
vercel-kv the KV_URL (rediss://) from your Vercel project
|
|
100
|
+
|
|
101
|
+
API-key sources (we discover the account, then you pick a database):
|
|
102
|
+
neon --source-key <napi_...>
|
|
103
|
+
supabase --source-key <sbp_...> --source-secret <db password>
|
|
104
|
+
render --source-key <rnd_...>
|
|
105
|
+
railway --source-key <token>
|
|
106
|
+
planetscale --source-key <service token> --source-id <service token id>
|
|
107
|
+
upstash --source-key <mgmt api key> --source-id <account email>
|
|
108
|
+
algolia --source-key <admin api key> --source-id <application id> (--app-id)
|
|
109
|
+
turso --source-key <auth token> --source-id <libsql:// url> (--url)
|
|
110
|
+
|
|
111
|
+
Friendly aliases: --token = --source-key; --app-id / --email / --token-id / --url
|
|
112
|
+
fill --source-id; --db-password = --source-secret.
|
|
113
|
+
|
|
114
|
+
Picking a source database
|
|
115
|
+
--source-db <label-or-number> choose among discovered databases in a non-TTY.
|
|
116
|
+
|
|
117
|
+
Output
|
|
118
|
+
--json prints ONE final JSON result object (no interim progress lines):
|
|
119
|
+
{ ok, runId, status, databaseId, report } on success
|
|
120
|
+
{ ok: false, runId, status, error } on failure
|
|
121
|
+
Without --json, status + progress lines stream to stdout while the run polls.
|
|
122
|
+
|
|
123
|
+
Credentials are never written to stdout, stderr, or --json output. In an
|
|
124
|
+
interactive terminal, missing credentials are prompted for; in CI, a missing
|
|
125
|
+
required flag exits 1 and lists what to pass.
|
|
126
|
+
`;
|
|
127
|
+
const IMPORT_HELP = `
|
|
128
|
+
layerbase import - restore a dump file INTO a cloud database
|
|
129
|
+
|
|
130
|
+
layerbase import <dumpfile> --target <db-id-or-name> [--yes] [--json]
|
|
131
|
+
|
|
132
|
+
Uploads the dump straight to storage (presigned), then restores it over the
|
|
133
|
+
target database. Validates the file exists and is non-empty first and warns on
|
|
134
|
+
very large files; the server enforces the hard size cap. --json prints a final
|
|
135
|
+
{ ok, message, database, engine, bytesUploaded } result.
|
|
56
136
|
`;
|
|
57
137
|
function printHelp() {
|
|
58
138
|
process.stdout.write(`${UNIFIED_HELP}\n`);
|
|
59
139
|
}
|
|
140
|
+
// Both migrate/import reach meow (registered verbs), which has autoHelp off, so
|
|
141
|
+
// a --help/-h/`help` subtoken is handled here explicitly. Reads the raw argv for
|
|
142
|
+
// the flag (meow strips it into flags) plus the parsed `help` subtoken.
|
|
143
|
+
function wantsHelp(rest) {
|
|
144
|
+
return (process.argv.includes('--help') ||
|
|
145
|
+
process.argv.includes('-h') ||
|
|
146
|
+
rest[0] === 'help');
|
|
147
|
+
}
|
|
60
148
|
function printCloudHelp() {
|
|
61
149
|
process.stdout.write(`${CLOUD_HELP}\n`);
|
|
62
150
|
}
|
|
@@ -72,6 +160,21 @@ async function runCloud(rest, flags) {
|
|
|
72
160
|
render(_jsx(App, { command: "ls", args: [], flags: flags }));
|
|
73
161
|
return;
|
|
74
162
|
}
|
|
163
|
+
if (sub === 'create') {
|
|
164
|
+
process.exit(await runCreate({ args: cloudArgs, flags }));
|
|
165
|
+
}
|
|
166
|
+
if (sub === 'delete' || sub === 'rm' || sub === 'destroy') {
|
|
167
|
+
process.exit(await runDestroy({ args: cloudArgs, flags }));
|
|
168
|
+
}
|
|
169
|
+
if (sub === 'start') {
|
|
170
|
+
process.exit(await runStart({ args: cloudArgs, flags }));
|
|
171
|
+
}
|
|
172
|
+
if (sub === 'stop') {
|
|
173
|
+
process.exit(await runStop({ args: cloudArgs, flags }));
|
|
174
|
+
}
|
|
175
|
+
if (sub === 'branch') {
|
|
176
|
+
process.exit(await runBranch({ args: cloudArgs, flags }));
|
|
177
|
+
}
|
|
75
178
|
if (sub === 'connect') {
|
|
76
179
|
await runExec({ command: 'connect', args: cloudArgs, flags });
|
|
77
180
|
return;
|
|
@@ -151,14 +254,60 @@ const cli = meow(UNIFIED_HELP, {
|
|
|
151
254
|
print: { type: 'boolean', default: false },
|
|
152
255
|
json: { type: 'boolean', default: false },
|
|
153
256
|
apiUrl: { type: 'string' },
|
|
257
|
+
// Headless auth: an sk_ key overrides the browser JWT and routes cloud
|
|
258
|
+
// calls straight to the cloud /v1 API.
|
|
259
|
+
apiKey: { type: 'string' },
|
|
260
|
+
// Cloud-mutation flags.
|
|
261
|
+
engine: { type: 'string' },
|
|
262
|
+
ttl: { type: 'string' },
|
|
263
|
+
yes: { type: 'boolean', default: false, shortFlag: 'y' },
|
|
264
|
+
force: { type: 'boolean', default: false },
|
|
265
|
+
global: { type: 'boolean', default: false },
|
|
266
|
+
// migrate / import flags.
|
|
267
|
+
source: { type: 'string' },
|
|
268
|
+
target: { type: 'string' },
|
|
269
|
+
sourceDb: { type: 'string' },
|
|
270
|
+
connectionString: { type: 'string' },
|
|
271
|
+
sourceKey: { type: 'string' },
|
|
272
|
+
sourceId: { type: 'string' },
|
|
273
|
+
sourceSecret: { type: 'string' },
|
|
274
|
+
// Friendly per-source credential aliases (resolved in migrate.ts).
|
|
275
|
+
appId: { type: 'string' },
|
|
276
|
+
email: { type: 'string' },
|
|
277
|
+
tokenId: { type: 'string' },
|
|
278
|
+
token: { type: 'string' },
|
|
279
|
+
url: { type: 'string' },
|
|
280
|
+
dbPassword: { type: 'string' },
|
|
154
281
|
},
|
|
155
282
|
});
|
|
283
|
+
// The --api-key flag wins over LAYERBASE_API_KEY and the stored key. Set it once
|
|
284
|
+
// before any cloud command runs.
|
|
285
|
+
configureCloudAuth({ apiKey: cli.flags.apiKey });
|
|
156
286
|
const EXEC_COMMANDS = new Set(['psql', 'redis-cli', 'mysql']);
|
|
157
287
|
const [command = '', ...rest] = cli.input;
|
|
158
288
|
if (command === 'help') {
|
|
159
289
|
printHelp();
|
|
160
290
|
process.exit(0);
|
|
161
291
|
}
|
|
292
|
+
else if (command === 'whoami') {
|
|
293
|
+
process.exit(await runWhoami({ json: cli.flags.json ?? false }));
|
|
294
|
+
}
|
|
295
|
+
else if (command === 'login' && cli.flags.apiKey) {
|
|
296
|
+
// Headless key login (no browser). Interactive browser login still runs via
|
|
297
|
+
// the Ink <Login> below when no --api-key is passed.
|
|
298
|
+
process.exit(await runKeyLogin({
|
|
299
|
+
apiKey: cli.flags.apiKey,
|
|
300
|
+
json: cli.flags.json ?? false,
|
|
301
|
+
}));
|
|
302
|
+
}
|
|
303
|
+
else if (command === 'agent') {
|
|
304
|
+
const [sub] = rest;
|
|
305
|
+
if (sub === 'init') {
|
|
306
|
+
process.exit(await runAgentInit({ flags: cli.flags }));
|
|
307
|
+
}
|
|
308
|
+
process.stderr.write('Usage: layerbase agent init [--global] [--force]\n');
|
|
309
|
+
process.exit(1);
|
|
310
|
+
}
|
|
162
311
|
else if (command === 'chat') {
|
|
163
312
|
// chat is the ONLY entry into the Ink interactive console (the bare no-arg
|
|
164
313
|
// launch moved to spindb). It needs a real terminal for the prompt.
|
|
@@ -168,6 +317,20 @@ else if (command === 'chat') {
|
|
|
168
317
|
}
|
|
169
318
|
await runInteractive(cli.flags);
|
|
170
319
|
}
|
|
320
|
+
else if (command === 'migrate') {
|
|
321
|
+
if (wantsHelp(rest)) {
|
|
322
|
+
process.stdout.write(`${MIGRATE_HELP}\n`);
|
|
323
|
+
process.exit(0);
|
|
324
|
+
}
|
|
325
|
+
process.exit(await runMigrate({ flags: cli.flags }));
|
|
326
|
+
}
|
|
327
|
+
else if (command === 'import') {
|
|
328
|
+
if (wantsHelp(rest)) {
|
|
329
|
+
process.stdout.write(`${IMPORT_HELP}\n`);
|
|
330
|
+
process.exit(0);
|
|
331
|
+
}
|
|
332
|
+
process.exit(await runImport({ args: rest, flags: cli.flags }));
|
|
333
|
+
}
|
|
171
334
|
else if (command === 'cloud') {
|
|
172
335
|
await runCloud(rest, cli.flags);
|
|
173
336
|
}
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.tsx"],"names":[],"mappings":";AAAA,OAAO,I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,CAAC;QACpB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,WAAW,IAAI,CAAC,CAAA;QACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,MAAM,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;AACjE,CAAC;KAAM,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;IAC/B,MAAM,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,CAAA;AACjC,CAAC;KAAM,IAAI,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;IACtC,MAAM,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;AAC1D,CAAC;KAAM,CAAC;IACN,gCAAgC;IAChC,MAAM,CAAC,KAAC,GAAG,IAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,GAAI,CAAC,CAAA;AACjE,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { homedir } from 'node:os';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { mkdir, readFile, writeFile, access } from 'node:fs/promises';
|
|
5
|
+
import { DEFAULT_API_URL } from '../lib/cloud-api.js';
|
|
6
|
+
import { confirm } from '../lib/confirm.js';
|
|
7
|
+
// Where the canonical skill is served (frontmatter-first text/markdown). The web
|
|
8
|
+
// base is overridable via LAYERBASE_API_URL; LAYERBASE_SKILL_URL overrides the
|
|
9
|
+
// whole URL for testing.
|
|
10
|
+
function skillUrl() {
|
|
11
|
+
return (process.env.LAYERBASE_SKILL_URL ?? `${DEFAULT_API_URL}/skill.md`);
|
|
12
|
+
}
|
|
13
|
+
// The copy bundled in the npm tarball (shipped separately). It has a short
|
|
14
|
+
// leading HTML comment BEFORE the frontmatter; strict skill parsers want `---`
|
|
15
|
+
// on line 1, so strip a leading <!-- ... --> block when installing from it.
|
|
16
|
+
function bundledSkillPath() {
|
|
17
|
+
return fileURLToPath(new URL('../../skills/layerbase/SKILL.md', import.meta.url));
|
|
18
|
+
}
|
|
19
|
+
function stripLeadingHtmlComment(content) {
|
|
20
|
+
return content.replace(/^\uFEFF?\s*<!--[\s\S]*?-->\s*\r?\n/, '');
|
|
21
|
+
}
|
|
22
|
+
async function fetchSkill() {
|
|
23
|
+
try {
|
|
24
|
+
const response = await fetch(skillUrl(), {
|
|
25
|
+
headers: { 'user-agent': 'layerbase-cli agent-init' },
|
|
26
|
+
signal: AbortSignal.timeout(15_000),
|
|
27
|
+
});
|
|
28
|
+
if (!response.ok)
|
|
29
|
+
return null;
|
|
30
|
+
return await response.text();
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async function readBundledSkill() {
|
|
37
|
+
try {
|
|
38
|
+
const raw = await readFile(bundledSkillPath(), 'utf8');
|
|
39
|
+
return stripLeadingHtmlComment(raw);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async function fileExists(path) {
|
|
46
|
+
try {
|
|
47
|
+
await access(path);
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const AGENTS_SNIPPET = `
|
|
55
|
+
Add this to your AGENTS.md so Codex and other agents can use Layerbase:
|
|
56
|
+
|
|
57
|
+
## Layerbase
|
|
58
|
+
The \`layerbase\` CLI (npm i -g layerbase) manages local and cloud databases.
|
|
59
|
+
Set LAYERBASE_API_KEY for headless cloud access: create, branch, and delete
|
|
60
|
+
transient databases in CI without a browser.
|
|
61
|
+
Capabilities, live prices, and migration sources: https://layerbase.com/agents.md
|
|
62
|
+
Full skill: read .claude/skills/layerbase/SKILL.md
|
|
63
|
+
`;
|
|
64
|
+
// `layerbase agent init [--global] [--force]`: install the Layerbase skill for
|
|
65
|
+
// coding agents. Fetches the canonical skill, falling back to the bundled copy
|
|
66
|
+
// offline. Never overwrites without consent (--force in non-TTY).
|
|
67
|
+
export async function runAgentInit(options) {
|
|
68
|
+
const global = options.flags.global ?? false;
|
|
69
|
+
const force = options.flags.force ?? false;
|
|
70
|
+
const baseDir = global
|
|
71
|
+
? join(homedir(), '.claude', 'skills', 'layerbase')
|
|
72
|
+
: join(process.cwd(), '.claude', 'skills', 'layerbase');
|
|
73
|
+
const target = join(baseDir, 'SKILL.md');
|
|
74
|
+
if (await fileExists(target)) {
|
|
75
|
+
if (!force) {
|
|
76
|
+
if (!process.stdin.isTTY) {
|
|
77
|
+
process.stderr.write(`${target} already exists. Pass --force to overwrite.\n`);
|
|
78
|
+
return 1;
|
|
79
|
+
}
|
|
80
|
+
const ok = await confirm(`Overwrite existing skill at ${target}?`);
|
|
81
|
+
if (!ok) {
|
|
82
|
+
process.stdout.write('Aborted.\n');
|
|
83
|
+
return 1;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
let content = await fetchSkill();
|
|
88
|
+
let source = 'layerbase.com';
|
|
89
|
+
if (content == null) {
|
|
90
|
+
content = await readBundledSkill();
|
|
91
|
+
source = 'bundled copy';
|
|
92
|
+
}
|
|
93
|
+
if (content == null) {
|
|
94
|
+
process.stderr.write('Could not fetch the Layerbase skill from ' +
|
|
95
|
+
`${skillUrl()} and no bundled copy is available. ` +
|
|
96
|
+
'Check your network connection or reinstall the layerbase package.\n');
|
|
97
|
+
return 1;
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
await mkdir(baseDir, { recursive: true });
|
|
101
|
+
await writeFile(target, content, { mode: 0o644 });
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
process.stderr.write(`Could not write ${target}: ${error.message}\n`);
|
|
105
|
+
return 1;
|
|
106
|
+
}
|
|
107
|
+
process.stdout.write(`Installed the Layerbase skill (${source}) to:\n`);
|
|
108
|
+
process.stdout.write(` ${target}\n`);
|
|
109
|
+
process.stdout.write(AGENTS_SNIPPET);
|
|
110
|
+
return 0;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=agent-init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-init.js","sourceRoot":"","sources":["../../src/commands/agent-init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,iFAAiF;AACjF,+EAA+E;AAC/E,yBAAyB;AACzB,SAAS,QAAQ;IACf,OAAO,CACL,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,GAAG,eAAe,WAAW,CACjE,CAAA;AACH,CAAC;AAED,2EAA2E;AAC3E,+EAA+E;AAC/E,4EAA4E;AAC5E,SAAS,gBAAgB;IACvB,OAAO,aAAa,CAAC,IAAI,GAAG,CAAC,iCAAiC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AACnF,CAAC;AAED,SAAS,uBAAuB,CAAC,OAAe;IAC9C,OAAO,OAAO,CAAC,OAAO,CAAC,oCAAoC,EAAE,EAAE,CAAC,CAAA;AAClE,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,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AAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,mBAAmB,MAAM,KAAM,KAAe,CAAC,OAAO,IAAI,CAC3D,CAAA;QACD,OAAO,CAAC,CAAA;IACV,CAAC;IAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,kCAAkC,MAAM,SAAS,CAAC,CAAA;IACvE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,MAAM,IAAI,CAAC,CAAA;IACrC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;IACpC,OAAO,CAAC,CAAA;AACV,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { createBranch, deleteBranch, listBranches, resetBranch, resolveDatabaseId, } from '../lib/cloud-api.js';
|
|
2
|
+
import { reportError, writeJson } from '../lib/cli-output.js';
|
|
3
|
+
const BRANCH_USAGE = 'Usage:\n' +
|
|
4
|
+
' layerbase cloud branch <db> <branch-name> Create/reuse a branch\n' +
|
|
5
|
+
' layerbase cloud branch reset <db> <name> Re-fork a branch from parent\n' +
|
|
6
|
+
' layerbase cloud branch delete <db> <name> Delete a branch\n' +
|
|
7
|
+
' layerbase cloud branch ls <db> List a database branches\n';
|
|
8
|
+
function printBranch(branch) {
|
|
9
|
+
process.stdout.write(`${branch.name} (${branch.status})\n`);
|
|
10
|
+
if (branch.connectionString) {
|
|
11
|
+
process.stdout.write(`${branch.connectionString}\n`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
async function runBranchCreate(db, name, json, action) {
|
|
15
|
+
if (!db || !name) {
|
|
16
|
+
process.stderr.write(BRANCH_USAGE);
|
|
17
|
+
return 1;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
const parentId = await resolveDatabaseId(db);
|
|
21
|
+
const branch = action === 'reset'
|
|
22
|
+
? await resetBranch({ parentId, name })
|
|
23
|
+
: await createBranch({ parentId, name });
|
|
24
|
+
if (json) {
|
|
25
|
+
writeJson({ ok: true, ...branch });
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
printBranch(branch);
|
|
29
|
+
}
|
|
30
|
+
return 0;
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
return reportError(error, json);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async function runBranchDelete(db, name, json) {
|
|
37
|
+
if (!db || !name) {
|
|
38
|
+
process.stderr.write(BRANCH_USAGE);
|
|
39
|
+
return 1;
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
const parentId = await resolveDatabaseId(db);
|
|
43
|
+
await deleteBranch({ parentId, name });
|
|
44
|
+
if (json) {
|
|
45
|
+
writeJson({ ok: true, deleted: name });
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
process.stdout.write(`Deleted branch ${name}.\n`);
|
|
49
|
+
}
|
|
50
|
+
return 0;
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
return reportError(error, json);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async function runBranchList(db, json) {
|
|
57
|
+
if (!db) {
|
|
58
|
+
process.stderr.write(BRANCH_USAGE);
|
|
59
|
+
return 1;
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
const parentId = await resolveDatabaseId(db);
|
|
63
|
+
const branches = await listBranches(parentId);
|
|
64
|
+
if (json) {
|
|
65
|
+
writeJson(branches);
|
|
66
|
+
return 0;
|
|
67
|
+
}
|
|
68
|
+
if (branches.length === 0) {
|
|
69
|
+
process.stdout.write('No branches.\n');
|
|
70
|
+
return 0;
|
|
71
|
+
}
|
|
72
|
+
for (const branch of branches) {
|
|
73
|
+
process.stdout.write(`${branch.name}\t${branch.status}\t${branch.id}\n`);
|
|
74
|
+
}
|
|
75
|
+
return 0;
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
return reportError(error, json);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Dispatch `cloud branch ...`. `args` is everything after the `branch` token.
|
|
82
|
+
export async function runBranch(options) {
|
|
83
|
+
const json = options.flags.json ?? false;
|
|
84
|
+
const [first, ...rest] = options.args;
|
|
85
|
+
if (first === 'ls' || first === 'list') {
|
|
86
|
+
return runBranchList(rest[0], json);
|
|
87
|
+
}
|
|
88
|
+
if (first === 'reset') {
|
|
89
|
+
return runBranchCreate(rest[0], rest[1], json, 'reset');
|
|
90
|
+
}
|
|
91
|
+
if (first === 'delete' || first === 'rm') {
|
|
92
|
+
return runBranchDelete(rest[0], rest[1], json);
|
|
93
|
+
}
|
|
94
|
+
// Default: create/reuse a branch named args[1] off database args[0].
|
|
95
|
+
return runBranchCreate(first, rest[0], json, 'create');
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=cloud-branch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-branch.js","sourceRoot":"","sources":["../../src/commands/cloud-branch.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,iBAAiB,GAClB,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEzD,MAAM,YAAY,GAChB,UAAU;IACV,uEAAuE;IACvE,8EAA8E;IAC9E,iEAAiE;IACjE,0EAA0E,CAAA;AAE5E,SAAS,WAAW,CAAC,MAAkB;IACrC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,MAAM,KAAK,CAAC,CAAA;IAC3D,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC5B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,gBAAgB,IAAI,CAAC,CAAA;IACtD,CAAC;AACH,CAAC;AAED,KAAK,UAAU,eAAe,CAC5B,EAAsB,EACtB,IAAwB,EAC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