@metabase/rde 0.1.2 → 0.1.3-alpha.rde-fixes.59b956e

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 +72 -40
  2. package/dist/cli.mjs +1115 -378
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -44,7 +44,7 @@ The wizard shows its checklist first (`✓` done, `○` to do, `–` not applica
44
44
  ● Running npm install -g @metabase/cli@alpha-transform-tests
45
45
  ```
46
46
 
47
- The steps up to the license run without a question: `mb` is installed with the package manager that installed `rde`, the skill goes to every coding agent found on the machine, Metabase runs in Docker when Docker is there (the jar with your Java otherwise), on the first free port from 3100 up, with the default admin credentials, and a Postgres sample database comes up in a second container, connected to Metabase as a place transforms can write. Each of those choices is printed as it is made and can be overridden with a flag. The prompts that remain are the license token (Enter skips it) and, with a license that includes remote sync, where the git repository lives and which remote it uses. The databases step asks nothing while the sample database is the only one: pass `--database` to connect your own during `init`, or run `rde db add` afterwards.
47
+ The steps up to the license run without a question: `mb` is installed with the package manager that installed `rde`, the skill goes to every coding agent found on the machine, Metabase runs in Docker when Docker is there (the jar with your Java otherwise), on the first free port from 3100 up, with an admin user whose password is generated and kept in `~/.rde`, and a Postgres sample database comes up in a second container, connected to Metabase as a place transforms can write. Each of those choices is printed as it is made and can be overridden with a flag. The prompts that remain are the license token (Enter skips it) and, with a license that includes remote sync, where the git repository lives and which remote it uses. The databases step asks nothing while the sample database is the only one: pass `--database` to connect your own during `init`, or run `rde db add` afterwards.
48
48
 
49
49
  The git step reads `–` until a license with remote sync is active; it is checked again when its turn comes, so a run that activates a license connects the repository in the same pass.
50
50
 
@@ -52,16 +52,16 @@ The git step reads `–` until a license with remote sync is active; it is check
52
52
  | --- | --- |
53
53
  | Check this machine | Platform, Node version, git, and a reachable Docker daemon or a Java 21+ runtime |
54
54
  | Install the Metabase CLI | `@metabase/cli` (`mb`) at the `alpha-transform-tests` dist-tag, with the package manager that installed `rde` |
55
- | Install the rde skill | The `rde` skill from `metabase/agent-skills` for every coding agent found on this machine (Claude Code, Codex, Cursor, Gemini CLI, OpenCode, Windsurf); `--agents` picks a different set, `--skip-agents` none |
56
- | Install Metabase | **Docker** when it is available: pulls `metabase/metabase-dev:transform-tests-ee` (or `--image`) and creates the container. **Jar** otherwise, or with `--runtime jar`: downloads the latest enterprise release (or the tag or `.jar` path given as `--jar`) into `~/.rde/jars/` and runs it with your Java. Either way on port 3100, or the first free port above it, or `--port` |
55
+ | Install the rde skill | The `rde` skill from the `rde-skill` branch of `metabase/agent-skills` for every coding agent found on this machine (Claude Code, Codex, Cursor, Gemini CLI, OpenCode, Windsurf); `--agents` picks a different set, `--skip-agents` none; `RDE_SKILL_SOURCE` installs it from another URL or a local directory |
56
+ | Install Metabase | **Docker** when it is available: pulls `metabase/metabase-enterprise-head:latest` (or `--image`) and creates the container. **Jar** otherwise, or with `--runtime jar`: downloads the latest enterprise release (or the tag or `.jar` path given as `--jar`) into `~/.rde/jars/` and runs it with your Java. Either way on port 3100, or the first free port above it, or `--port` |
57
57
  | Start Metabase | Starts the container or the jar and waits for `/api/health`, showing Metabase's own progress |
58
- | Create the admin user | `admin@metabase.com` / `metabase123`, or your own with `--admin prompted`, see below |
59
- | Connect the Metabase CLI | Creates an API key named `rde` and logs `mb` in with it under the profile `default`, so plain `mb …` uses the instance; if `default` already points at another Metabase, offers the named profile `rde` instead |
58
+ | Create the admin user | `admin@metabase.local` with a generated password that `rde credentials` shows, or your own with `--admin prompted`, see [Credentials](#credentials) |
59
+ | Connect the Metabase CLI | Creates an API key named `rde` and logs `mb` in with it under the profile `rde`, never one you made; a key Metabase rejects is replaced |
60
60
  | Connect a sample database | Runs Metabase's Postgres sample data (`metabase/qa-databases:postgres-sample-15`) in a container named `rde-sampledb-default` on the first free port from 15432, connects it as `Sample Database`, and switches transforms on. It replaces the H2 sample database Metabase would otherwise bundle, which cannot be a transform target. Needs Docker, so a jar instance on a machine without Docker keeps the H2 one instead |
61
61
  | Activate your license | Optional. Paste a token, or press Enter to skip; remote sync needs one with the `remote-sync` feature |
62
62
  | Connect your databases | Only when `--database` names one or `rde db add` runs: paste a connection string (or fill the fields one by one), review, test, add; repeat |
63
63
  | Connect a git repository | Only with a license. Initializes or reuses a repository and points Metabase's remote sync at it |
64
- | Summary | URL, login, `mb` profile, databases, repository, and the command that opens each detected agent |
64
+ | Summary | URL, login email, `mb` profile, databases, repository, and the command that opens each detected agent |
65
65
 
66
66
  The second run on the same machine detects every step as done and prints the summary only:
67
67
 
@@ -80,22 +80,22 @@ The second run on the same machine detects every step as done and prints the sum
80
80
  – Connect a git repository
81
81
  ○ Summary
82
82
  │
83
- ◇ Your environment ─────────────────────────────────────────────────────────────────╮
84
- │ │
85
- │ Metabase: http://localhost:3100 │
86
- │ Login: admin@metabase.com / metabase123 │
87
- │ Metabase CLI: mb <command> │
88
- │ Databases: │
89
- │ Sample Database (postgres, sync complete) │
90
- │ warehouse (postgres, sync complete) │
91
- │ Sample database: psql "postgres://metabase:metasample123@localhost:15432/sample" │
92
- │ Remote sync: not configured (no license) │
93
- │ rde skill: installed for Claude Code │
94
- │ Start working: │
95
- │ claude (Claude Code) │
96
- │ Lifecycle: rde status, rde stop, rde start │
97
- │ │
98
- ├─────────────────────────────────────────────────────────────────────────────────────╯
83
+ ◇ Your environment ────────────────────────────────────────────────────────────────────╮
84
+ │ │
85
+ │ Metabase: http://localhost:3100 │
86
+ │ Login: admin@metabase.local (run rde credentials in your terminal for the password) │
87
+ │ Metabase CLI: mb --profile rde <command> or export MB_PROFILE=rde │
88
+ │ Databases: │
89
+ │ Sample Database (postgres, sync complete) │
90
+ │ warehouse (postgres, sync complete) │
91
+ │ Sample database: psql "postgres://metabase:metasample123@localhost:15432/sample" │
92
+ │ Remote sync: not configured (no license) │
93
+ │ rde skill: installed for Claude Code │
94
+ │ Start working: │
95
+ │ claude (Claude Code) │
96
+ │ Lifecycle: rde status, rde stop, rde start │
97
+ │ │
98
+ ├───────────────────────────────────────────────────────────────────────────────────────╯
99
99
  │
100
100
  └ rde init finished
101
101
  ```
@@ -114,18 +114,29 @@ psql "postgres://metabase:metasample123@localhost:15432/sample" # the summary
114
114
 
115
115
  ## Credentials
116
116
 
117
- The admin user is created with the default credentials `admin@metabase.com` / `metabase123`. Both are written to `~/.rde` and shown in the summary and in `rde status`, so agents and scripts can log in without asking you; the instance listens on this machine only, so nobody else can reach it. To use your own instead, run `rde init --admin prompted` (or pass `--admin-email` / `--admin-password`, or an `admin-user` section in the answers file): the email and password are asked once, sent to Metabase, and never written anywhere by `rde`.
117
+ The admin user is `admin@metabase.local` with a password `rde` generates: 32 random URL-safe characters, kept in `~/.rde/instances/default/secrets.json` (mode `0600`, in a `0700` directory) and nowhere else. The summary and `rde status` show only the email:
118
118
 
119
- In both variants `rde` creates an API key named `rde` in the Administrators group and stores it in the instance's state file with mode `0600`. That key is what `mb` and `rde` itself use afterwards. The sample database's own credentials (`metabase` / `metasample123`) are baked into its image and are not a secret.
119
+ ```
120
+ Login: admin@metabase.local (run rde credentials in your terminal for the password)
121
+ ```
122
+
123
+ `rde credentials` prints the email and the password, and only to a terminal: run from a script, a pipe, or a coding agent, it exits with code 2 and `rde credentials prints only to a terminal; run it in your own terminal`. To use your own login instead, run `rde init --admin prompted` (or pass `--admin-email` / `--admin-password`, or an `admin-user` section in the answers file): the email and password are asked once, sent to Metabase, and never written anywhere by `rde`, and `rde credentials` says so.
124
+
125
+ In both variants `rde` creates an API key named `rde` in the Administrators group and keeps it in the same secrets file. That key is what `mb` and `rde` itself use afterwards; `state.json` and `rde status --json` never carry it. If Metabase stops accepting it (someone regenerated or revoked it in the admin settings), `rde init --only api-key` or `rde doctor --fix` makes a new one with the stored admin login and logs `mb` in again, asking nothing; with a prompted admin it asks for the password once.
126
+
127
+ An instance whose state file held the public `admin@metabase.com` pair keeps working: the password and the key move to `secrets.json` the first time any `rde` command reads the state, and `rde doctor` marks the admin password `legacy-default`, because anyone who knows the default can log in. When the instance holds nothing you need, `rde uninstall` then `rde init` recreates it with a generated password.
128
+
129
+ The sample database's own credentials (`metabase` / `metasample123`) are baked into its image and are not a secret.
120
130
 
121
131
  ## What lands in `~/.rde`, and what never does
122
132
 
123
133
  ```
124
134
  ~/.rde/
125
135
  config.json { schemaVersion, defaultInstance }
126
- instances/default/
127
- state.json mode 0600: runtime, url, Metabase version, admin credentials variant,
128
- API key, license features, databases, sample database, git remote, step records
136
+ instances/default/ mode 0700
137
+ state.json mode 0600, no secrets: runtime, url, Metabase version, admin email and variant,
138
+ mb profile, license features, databases, sample database, git remote, step records
139
+ secrets.json mode 0600: { schemaVersion, admin: { email, password } | null, apiKey }
129
140
  data/ mounted into the container as /rde, or the jar's working directory
130
141
  metabase.db/metabase.db.mv.db the H2 application database
131
142
  plugins/ driver jars (Oracle, Vertica) go here
@@ -150,23 +161,25 @@ Docker is used whenever it is available: the image is self-contained, and the co
150
161
  | --- | --- |
151
162
  | `rde start` | Starts the sample database and the instance, and waits until Metabase is healthy |
152
163
  | `rde stop` | Stops both; the data stays |
153
- | `rde status` | The init checklist, runtime state, health, databases with their sync state, the sample database's container and connection string, remote sync state; `--json` for scripts |
164
+ | `rde status` | The login email, the `mb` profile, the init checklist, runtime state, health, databases with their sync state, the sample database's container and connection string, remote sync state; `--json` for scripts and agents (`mbProfile`, `adminEmail`, never a secret) |
165
+ | `rde credentials` | The admin email and password, printed only to a terminal |
154
166
  | `rde logs` | The container's log, or the jar's `metabase.log`; `-f` keeps streaming |
155
167
  | `rde open` | Opens the instance in the browser |
156
168
  | `rde db add` | The same database wizard as in `init` |
157
169
  | `rde db list` | The connected databases; `--json` for scripts |
158
- | `rde doctor` | One table of checks with a fix hint per failure; `--fix` re-runs the init steps behind them; `--json` for scripts; exit 1 while anything fails |
170
+ | `rde doctor` | One table of checks with a fix hint per failure; `--fix` re-runs the init steps behind them; `--json` for scripts and the rde skill (every row's `id`, `status`, `detail`, `hint`, and `fix`: the `rde` command that repairs it, or null when you have to act); exit 1 while anything fails |
159
171
  | `rde upgrade` | Moves the instance to a newer Metabase after backing up its data; see [Upgrading](#upgrading) |
160
172
  | `rde uninstall` | Removes the instance, its data, and the `mb` profile; see [Resetting](#resetting) |
161
173
 
162
- Everything else goes through the Metabase CLI, logged in as the profile `default`, so plain `mb …` talks to the instance:
174
+ Everything else goes through the Metabase CLI, logged in as the profile `rde` (`rde-<name>` for an instance not named `default`); `init` never touches a profile you made:
163
175
 
164
176
  ```sh
165
- mb db list
177
+ mb --profile rde db list
178
+ export MB_PROFILE=rde # once per shell, then plain `mb …`
166
179
  mb git-sync status
167
180
  ```
168
181
 
169
- If your `default` profile already pointed at another Metabase when `init` ran, it was left alone and the instance was connected as the profile `rde` (`init` asks; `--mb-profile default|rde` answers without a terminal). Then it is `mb --profile rde …`, or `export MB_PROFILE=rde` once per shell; the summary and `rde status` say which.
182
+ An instance whose state file names another profile, such as `default`, keeps it; the summary and `rde status` say which.
170
183
 
171
184
  ## The git repository
172
185
 
@@ -179,8 +192,8 @@ A repository that already holds Metabase content is imported on the spot. Afterw
179
192
 
180
193
  ```sh
181
194
  cd <your working directory>
182
- mb git-sync status
183
- mb git-sync export -m "what changed"
195
+ mb --profile rde git-sync status
196
+ mb --profile rde git-sync export -m "what changed"
184
197
  git pull # after an export, to see the YAML files
185
198
  ```
186
199
 
@@ -199,8 +212,8 @@ rde init --skip-license \
199
212
  | Flag | Answers |
200
213
  | --- | --- |
201
214
  | `--agents claude-code,codex` / `--skip-agents` | Which agents get the skill, instead of the ones found on the machine |
202
- | `--runtime docker\|jar`, `--image`, `--jar`, `--port` | How Metabase runs, the Docker image or the jar (`latest`, a release tag, or a `.jar` path), and the host port, instead of Docker when available, `metabase/metabase-dev:transform-tests-ee`, the latest release, and the first free port from 3100; `--image` implies `docker` and `--jar` implies `jar` |
203
- | `--admin default\|prompted`, `--admin-email`, `--admin-password` | The admin user, `default` unless given; an email or password implies `prompted` |
215
+ | `--runtime docker\|jar`, `--image`, `--jar`, `--port` | How Metabase runs, the Docker image or the jar (`latest`, a release tag, or a `.jar` path), and the host port, instead of Docker when available, `metabase/metabase-enterprise-head:latest`, the latest release, and the first free port from 3100; `--image` implies `docker` and `--jar` implies `jar` |
216
+ | `--admin generated\|prompted`, `--admin-email`, `--admin-password` | The admin user, `generated` unless given; an email or password implies `prompted` |
204
217
  | `--license-token` / `--skip-license` | The license |
205
218
  | `--database <engine>=<connection string>` (repeatable) / `--skip-databases` | The warehouses |
206
219
  | `--git-dir`, `--git-remote local\|hosted`, `--git-url`, `--git-token` / `--skip-git` | The content repository; a remote or URL without `--git-dir` means the current directory |
@@ -257,11 +270,11 @@ If Metabase does not become healthy on the new version, nothing is rolled back a
257
270
 
258
271
  ## Resetting
259
272
 
260
- `rde uninstall` returns the machine to the state before `rde init`: it stops and removes the Metabase container, or stops the jar's process, stops and removes the sample database container, forgets the `mb` profile it logged in (`default`, or `rde`; never a profile pointing at another Metabase), and deletes `~/.rde/instances/default` along with the `config.json` entry. It shows the list first and asks once; `--yes` skips the question. Your working directory and its git history are never touched, nor are the `mb` CLI, Docker, and Java themselves.
273
+ `rde uninstall` returns the machine to the state before `rde init`: it stops and removes the Metabase container, or stops the jar's process, stops and removes the sample database container, forgets the `mb` profile it logged in (`rde`, or the one an older instance recorded; never a profile pointing at another Metabase), and deletes the stored credentials and `~/.rde/instances/default` along with the `config.json` entry. It shows the list first and asks once; `--yes` skips the question. Your working directory and its git history are never touched, nor are the `mb` CLI, Docker, and Java themselves.
261
274
 
262
275
  ```sh
263
276
  rde uninstall # container or process, mb profile, ~/.rde/instances/default
264
- rde uninstall --keep-data # container or process and profile only; `rde init` reinstalls from the kept data
277
+ rde uninstall --keep-data # container or process and profile only; the data and secrets.json stay, and `rde init` reinstalls from them
265
278
  rde uninstall --remove-skill # also the rde skill from your coding agents
266
279
  rde uninstall --remove-image # also the Docker images or the downloaded jar (otherwise they stay for the next init)
267
280
  ```
@@ -270,10 +283,10 @@ Running it twice is a no-op. It also works with no `~/.rde` at all, so a leftove
270
283
 
271
284
  ## Troubleshooting
272
285
 
273
- Start with `rde doctor`. It checks the machine (platform, Node, git, Docker, Java, `mb`), the instance (the container or the jar process, port, health, Metabase version, admin user, API key, `mb` profile, license, databases, the sample database's container, port, and Metabase record, remote sync), and the skill for each detected coding agent, one row each with ✓, ✗, or – and a hint under every ✗. Of Docker and Java, the one the instance does not use is `–` when missing; the one it uses is ✗.
286
+ Start with `rde doctor`. It checks the machine (platform, Node, git, Docker, Java, every `mb` on `PATH`), the instance (the container or the jar process, port, health, Metabase version, admin user, admin password, whether Metabase accepts the API key, the secrets file's modes, no secret left in `state.json`, `mb` profile and the URL it points at, license, databases, the sample database's container, port, and Metabase record, remote sync), the `MB_PROFILE`, `MB_URL`, and `MB_API_KEY` variables when set, the other Metabases `mb` knows, the skill for each detected coding agent, and every copy of the skill, one row each with ✓, ✗, or – and a hint under every ✗. A row marked `!` is a note: nothing fails, but it changes where `mb` goes. Of Docker and Java, the one the instance does not use is `–` when missing; the one it uses is ✗.
274
287
 
275
288
  ```
276
- ✓ container rde-metabase-default stopped (metabase/metabase-dev:transform-tests-ee)
289
+ ✓ container rde-metabase-default stopped (metabase/metabase-enterprise-head:latest)
277
290
  ✓ port 3100 is free
278
291
  ✗ health unreachable
279
292
  → `rde start`
@@ -309,6 +322,24 @@ Start Docker (or `colima start`), or install Java, and run `rde init` again. `rd
309
322
 
310
323
  **The jar's Java is wrong.** The jar runtime needs Java 21 or newer and says which one it found: `Java 17.0.9 at /usr/bin/java is too old`. Point `JAVA_HOME` at a newer runtime, or put one first on `PATH`; the next `rde start` uses it. A pid file left by a reboot is recognized as stale (the pid is free, or runs something else) and ignored.
311
324
 
325
+ **`mb` says the API key is invalid.** The key was regenerated or revoked in Metabase's admin settings. `rde doctor` shows `✗ API key in the secrets file, but Metabase rejects it`; `rde init --only api-key` (or `rde doctor --fix`) replaces it with the stored admin login and logs `mb` in again.
326
+
327
+ **An older `mb` runs first.** Another package manager installed an `mb` earlier, and its directory comes first on `PATH`. The `mb` row lists every `mb` in `PATH` order and fails when the first one is too old, or comes from another package manager while a newer one sits later; the hint names both paths and the command that removes the old one, taken from its path (`bun remove -g @metabase/cli`, `brew uninstall <formula>`, …), or the `PATH` order that puts the new one first. `rde` never edits shell profiles; open a new terminal after the change. `rde init` stops with the same list when the `mb` it installed is still not the one that runs.
328
+
329
+ **`mb` went to the wrong Metabase.** A plain `mb` uses the `default` profile, or the one `MB_PROFILE` names, and `MB_URL` or `MB_API_KEY` override every profile, `--profile rde` included. `rde doctor` shows a `!` row for each of those variables that is set, with the `unset` to run, and lists every other profile by host with whether it authenticates and which one plain `mb` uses:
330
+
331
+ ```
332
+ ✗ mb profile rde points at http://127.0.0.1:3101, not at this instance (http://localhost:3101)
333
+ → `rde init --only api-key` logs it back in against the instance
334
+ ! MB_PROFILE prod: `mb` and the rde skill will use profile prod (prod.acme.example) instead of rde's (rde)
335
+ → `unset MB_PROFILE`, remove it from your shell profile if it is exported there, then restart the agent session
336
+ ✓ other Metabases default: metabase.acme.example, not answering
337
+ staging: localhost:3101, login rejected
338
+ plain `mb` uses prod (MB_PROFILE): prod.acme.example
339
+ ```
340
+
341
+ **The agent follows an old copy of the skill.** The `rde skill copies` row lists every copy of the skill the `skills` CLI knows, global and in the current directory's project, with where it came from, and fails when one did not come from rde's source (the branch is read from the `skills` lock file; against a local `RDE_SKILL_SOURCE` the copy's `SKILL.md` is compared). With several copies it says which one Claude Code started in that directory loads (a personal skill wins over a project one). `rde init --only agents-skills` reinstalls the global copy; restart the agent session afterwards.
342
+
312
343
  **The license token is rejected.** Activation ends with `Metabase reports the token as invalid` (or another status Metabase returned). Check the token, and check that the container can reach `token-check.metabase.com`: activation needs outbound network access. Run `rde init --from license` to try again; press Enter at the prompt to skip the license and carry on without remote sync.
313
344
 
314
345
  ## Development
@@ -317,6 +348,7 @@ Start Docker (or `colima start`), or install Java, and run `rde init` again. `rd
317
348
  bun install
318
349
  bun run check # tsc, oxlint + boundary linter, oxfmt, unit tests
319
350
  bin/rde-dev init # runs from source with RDE_HOME and the mb config under .dev-state/
351
+ RDE_SKILL_SOURCE=~/agent-skills/skills/rde bin/rde-dev init --only agents-skills # the skill from a local checkout
320
352
  ```
321
353
 
322
354
  The end-to-end lane runs the built binary against real Docker: a seeded Postgres 16 sidecar on `127.0.0.1:15432` (`RDE_E2E_PG_PORT` to change it) and a fresh instance under `.e2e-state/`, with a fake `HOME` so the skill installer never touches your agents. `bun run build` must precede `bun run test:e2e`. With `RDE_E2E_JAR` pointing at a Metabase jar (a local build) the lane also runs the jar runtime through init, doctor, stop, start, and uninstall with the host's Java; without it those tests are reported as skipped.