@metabase/cli 0.1.8 → 0.1.9
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/.claude-plugin/marketplace.json +1 -1
- package/README.md +26 -236
- package/dist/{add-collection-CwrbKmC1.mjs → add-collection-CoP-6FZR.mjs} +5 -5
- package/dist/add-collection-EPp89tcs.mjs +10 -0
- package/dist/{archive-DqUtqRut.mjs → archive-BY8nrgnq.mjs} +5 -6
- package/dist/{archive-BzvqQd34.mjs → archive-BeslLaal.mjs} +5 -6
- package/dist/{archive-BpKZsGAm.mjs → archive-Blt0TxxA.mjs} +6 -7
- package/dist/{archive-ZnnJc2iT.mjs → archive-BxwGVDpd.mjs} +6 -7
- package/dist/{archive-BAjGIzhn.mjs → archive-C17qIvFW.mjs} +6 -7
- package/dist/{archive-BO3DOWI4.mjs → archive-CPLXsrzD.mjs} +5 -6
- package/dist/auth-CCUDM9Sv.mjs +19 -0
- package/dist/{body-DDYKoyMt.mjs → body-2jl-YSxT.mjs} +2 -2
- package/dist/{branches-DjiGsjAz.mjs → branches-Vlu44J51.mjs} +5 -6
- package/dist/{cancel-BwtDQ2MR.mjs → cancel-D0aBPUhs.mjs} +4 -5
- package/dist/{cancel-task-uJp18RvR.mjs → cancel-task-DoL2bqs1.mjs} +5 -6
- package/dist/{render-0_GsapXa.mjs → capabilities-7L9GVMd_.mjs} +45 -4
- package/dist/{card-ezYiriML.mjs → card-DnIeMmUn.mjs} +18 -2
- package/dist/card-UwczcLjq.mjs +20 -0
- package/dist/{cards-z68PANDD.mjs → cards-6MTreYAo.mjs} +5 -6
- package/dist/cli.mjs +23 -34
- package/dist/{collection-Bcy8cWYH.mjs → collection-BPTlcFw5.mjs} +8 -2
- package/dist/collection-Cexywhlj.mjs +20 -0
- package/dist/collection-namespace-BdqQJb7j.mjs +12 -0
- package/dist/{create-4EAGYVyp.mjs → create-BWD8H6yw.mjs} +12 -10
- package/dist/{create-GVfCQU3B.mjs → create-BZRA7nPu.mjs} +7 -8
- package/dist/{create-7JOWFxqu.mjs → create-BsOdn1Q1.mjs} +10 -11
- package/dist/{create-CQ4Vg4Ge.mjs → create-C_Z3IDrW.mjs} +9 -10
- package/dist/{create-Dd_Gyg_F.mjs → create-DNYFXAsy.mjs} +7 -8
- package/dist/{create-BzK59YlR.mjs → create-DcoF52Kx.mjs} +11 -12
- package/dist/{create-branch-CdWGiREu.mjs → create-branch-40Xm4DN7.mjs} +5 -6
- package/dist/create-dVmIemXi.mjs +52 -0
- package/dist/{create-DHWfmO2L.mjs → create-k59K2qf1.mjs} +9 -10
- package/dist/{current-task-nPs-iCLi.mjs → current-task-BN_XEFSX.mjs} +5 -6
- package/dist/dashboard-B_CuVbMX.mjs +21 -0
- package/dist/{database-BXiue1in.mjs → database-Dsv4QBs0.mjs} +20 -10
- package/dist/db-DULi5MOr.mjs +22 -0
- package/dist/{delete-Do1agSiL.mjs → delete-DEFgs5LE.mjs} +6 -7
- package/dist/{delete-runtime-uuYbd4k2.mjs → delete-runtime-DVb-Pkzp.mjs} +2 -2
- package/dist/{delete-CJqLgr6w.mjs → delete-tPjicYO4.mjs} +6 -7
- package/dist/{delete-table-ZiJDpMFT.mjs → delete-table-CDj19Qn6.mjs} +6 -7
- package/dist/{dirty-BnTG7w7v.mjs → dirty-DGCa6W1F.mjs} +5 -6
- package/dist/{eid-CwQ_smOD.mjs → eid-3v5MAKNA.mjs} +6 -7
- package/dist/{error-CTVL5CdB.mjs → error-BndUmcwS.mjs} +1 -1
- package/dist/{export-DR2cC4rL.mjs → export-BIZ-UR_M.mjs} +7 -8
- package/dist/field-CfrrLetM.mjs +18 -0
- package/dist/{fields-Ck31lDz9.mjs → fields-9lOrO8UH.mjs} +6 -7
- package/dist/{get-BFJ3VBPa.mjs → get-6Cj360cH.mjs} +5 -6
- package/dist/{get-CyG_P55z.mjs → get-BIH72g0v.mjs} +6 -7
- package/dist/{get-CICzGFSW.mjs → get-BSJN5TwW.mjs} +6 -7
- package/dist/{get-DyArILlF.mjs → get-BYSj7tMP.mjs} +5 -6
- package/dist/{get-DauAF3sm.mjs → get-Bk81meka.mjs} +5 -6
- package/dist/{get-GWRprk7k.mjs → get-BpWjLkKT.mjs} +5 -7
- package/dist/{get-F338MOK-.mjs → get-BuM6QPjZ.mjs} +5 -6
- package/dist/{get-C71ypFQk.mjs → get-CHaIVT6Y.mjs} +5 -6
- package/dist/{get-pO0wiy1e.mjs → get-CRa-h69C.mjs} +5 -6
- package/dist/{get-BPOd0Rm8.mjs → get-DFe2WoJ2.mjs} +5 -6
- package/dist/{get-DxqzDKKK.mjs → get-DlGlnciR.mjs} +5 -6
- package/dist/{get-BNKsNCcx.mjs → get-LI2xsRoT.mjs} +5 -6
- package/dist/{get-run-DhM_PyVy.mjs → get-run-hCZaw8-h.mjs} +5 -6
- package/dist/{get-BZiu-u-9.mjs → get-w-WqpjKy.mjs} +7 -8
- package/dist/git-sync-BpRstrZo.mjs +28 -0
- package/dist/{has-remote-changes-Ca0exJmb.mjs → has-remote-changes-DcpW1_KX.mjs} +5 -6
- package/dist/{import-DjclIzGP.mjs → import-CTQT1atq.mjs} +7 -8
- package/dist/{is-dirty-Cke0a1ie.mjs → is-dirty-DGrmt1ss.mjs} +4 -4
- package/dist/is-dirty-DuWCgrz2.mjs +9 -0
- package/dist/{items-BSpapmCU.mjs → items-Kr0oN2V7.mjs} +7 -8
- package/dist/{list-CEE9yKNp.mjs → list-Bz2ej0Cl.mjs} +4 -5
- package/dist/{list-V5IuMr_5.mjs → list-CCtYVgPN.mjs} +4 -5
- package/dist/{list-Brt4oKO7.mjs → list-CLvlEVQo.mjs} +6 -7
- package/dist/{list-Br77Mw6U.mjs → list-Ccj8-vb5.mjs} +5 -6
- package/dist/{list-Fjjtpghb.mjs → list-Cj3v4Lgv.mjs} +6 -7
- package/dist/{list-bVlCwg8g.mjs → list-Cl_O4_U4.mjs} +4 -5
- package/dist/{list-BRXGDSMo.mjs → list-D2D5Mw1E.mjs} +5 -6
- package/dist/{list-DUyWON1F.mjs → list-DNmekF2B.mjs} +4 -5
- package/dist/{list-fIV-P6wP.mjs → list-DaESiI72.mjs} +4 -5
- package/dist/{list-DWWGcUTg.mjs → list-DzKKdfCI.mjs} +5 -7
- package/dist/{list-BI1PfPjn.mjs → list-jcgK0thu.mjs} +5 -6
- package/dist/{list-D1qhCQn0.mjs → list-tklIxo38.mjs} +6 -7
- package/dist/{list-DmO4ADQq.mjs → list-zRQsvrH6.mjs} +4 -5
- package/dist/{login-BJGhZLgZ.mjs → login-BMKBmgeQ.mjs} +9 -10
- package/dist/{logout-BAGLqtnV.mjs → logout-C5pod937.mjs} +4 -5
- package/dist/{manifest-BNh0Lw6p.mjs → manifest-Cmu--CG5.mjs} +1 -2
- package/dist/measure-BkwFsP44.mjs +19 -0
- package/dist/{metadata-B-GOcWqL.mjs → metadata-CG4VZ5NW.mjs} +6 -7
- package/dist/{metadata-DJAdsOoh.mjs → metadata-DIEbyQeS.mjs} +7 -8
- package/dist/{parse-id-D1LTTt9L.mjs → parse-id-Boqc4wn4.mjs} +1 -1
- package/dist/{path-D5kX-msX.mjs → path-ur3NsMFr.mjs} +4 -6
- package/dist/{poll-DxpnK1wW.mjs → poll-BMjCkDaj.mjs} +1 -1
- package/dist/{poll-task-D8mG49IN.mjs → poll-task-CiRA0ER9.mjs} +2 -2
- package/dist/{preflight-Df_FqJ6o.mjs → preflight-CSqcIlbX.mjs} +3 -3
- package/dist/{query-zWFRDH3T.mjs → query-B8JzsQ_I.mjs} +7 -8
- package/dist/{query-OIuumiXN.mjs → query-CG0rEMS-.mjs} +11 -12
- package/dist/{query-result-ABPLz6I4.mjs → query-result-B4kTRid7.mjs} +1 -1
- package/dist/{remove-collection-BxmiXWKz.mjs → remove-collection-Clwz3EHQ.mjs} +7 -8
- package/dist/{rescan-values-M7g81KIl.mjs → rescan-values-DuHBnFjK.mjs} +8 -11
- package/dist/run-JXRivkfH.mjs +136 -0
- package/dist/{runs-CqfJIuh_.mjs → runs-FxgbXvax.mjs} +6 -7
- package/dist/{runtime-B40L_bj8.mjs → runtime-Ck8KKQe-.mjs} +11 -78
- package/dist/{schema-tables-CjBRF0_0.mjs → schema-tables-izDPI4f5.mjs} +6 -7
- package/dist/{schemas-GIIbek2O.mjs → schemas-CyzplnXl.mjs} +4 -5
- package/dist/{search-h78uOYec.mjs → search-BeuoOEQV.mjs} +4 -5
- package/dist/segment-ChYmSM0p.mjs +19 -0
- package/dist/{set-BRDxcLcQ.mjs → set-ClzB_5Jk.mjs} +7 -8
- package/dist/{setting-mKzZJpQY.mjs → setting-CBJVEx7_.mjs} +3 -3
- package/dist/{setup-WTIT2WbM.mjs → setup-vKXEUMM7.mjs} +6 -7
- package/dist/skills-1Z5Wj7Kp.mjs +18 -0
- package/dist/{skills-BkregMyb.mjs → skills-BDPVoBWU.mjs} +33 -2
- package/dist/snippet-De70ayL1.mjs +19 -0
- package/dist/{stash-DxoAJzcK.mjs → stash-DLtVf4_D.mjs} +7 -8
- package/dist/{status-B1dc3bbQ.mjs → status-AnPzI1f7.mjs} +4 -5
- package/dist/{status-D0Ukfodl.mjs → status-DHFYn9kO.mjs} +6 -7
- package/dist/{summary-3qOMUcEX.mjs → summary-DDed1LOz.mjs} +5 -6
- package/dist/sync-schema-BGQVq2JA.mjs +55 -0
- package/dist/table-C_bP2ao-.mjs +19 -0
- package/dist/{table-qDD2kApF.mjs → table-CkWja2UH.mjs} +1 -1
- package/dist/transform-B4RZfm6A.mjs +24 -0
- package/dist/{transform-BKahefz_.mjs → transform-DyWCoiO-.mjs} +1 -0
- package/dist/transform-job-C4pZcrIF.mjs +19 -0
- package/dist/{tree-DsnIPFyE.mjs → tree-BlYgJOn9.mjs} +4 -5
- package/dist/{update-Baya6OkO.mjs → update-B0z-2zqC.mjs} +12 -13
- package/dist/{update-BEtl9LpG.mjs → update-BHtliIr_.mjs} +8 -9
- package/dist/{update-CLsqoEJ8.mjs → update-CdfAogO2.mjs} +8 -9
- package/dist/{update-DPouQi4U.mjs → update-CgOPxKXK.mjs} +13 -11
- package/dist/{update-UaPqSfPN.mjs → update-CilTW98H.mjs} +10 -11
- package/dist/{update-DWn-nLPo.mjs → update-CoVvsU-I.mjs} +8 -9
- package/dist/{update-CZEd_Eej.mjs → update-DBN7yfAk.mjs} +9 -10
- package/dist/{update-BRLcnSwK.mjs → update-DqSG5_Ie.mjs} +10 -11
- package/dist/{update-BsgHRoZ8.mjs → update-DykqQLfo.mjs} +11 -12
- package/dist/{update-dashcard-DK9X91ha.mjs → update-dashcard-DZ8oV8up.mjs} +8 -9
- package/dist/{upgrade-UqdvTikR.mjs → upgrade-B8sEEQdQ.mjs} +34 -7
- package/dist/{uuid-BWCaWG4O.mjs → uuid-lLVnEoBN.mjs} +3 -4
- package/dist/{validate-dPEOnOf8.mjs → validate-B62TRDGV.mjs} +1 -1
- package/dist/{validate-query-CYvOP8Ld.mjs → validate-query-BpiN1CFu.mjs} +2 -2
- package/dist/{values-D_wycrcr.mjs → values-oD72EtRq.mjs} +5 -6
- package/dist/{verify-D7hb6VMy.mjs → verify-Bg6F0oFN.mjs} +1 -1
- package/dist/{wait-B5IpNFCG.mjs → wait-BtzuqQC3.mjs} +6 -7
- package/dist/{wait-flags-CNIeSq0_.mjs → wait-flags-DyFfZeav.mjs} +2 -2
- package/package.json +1 -1
- package/skill-data/core/SKILL.md +19 -32
- package/skill-data/git-sync/SKILL.md +8 -63
- package/skill-data/mbql/SKILL.md +95 -28
- package/skill-data/mbql/references/operators.md +13 -13
- package/skill-data/transform/SKILL.md +18 -7
- package/skills/metabase-cli/SKILL.md +1 -1
- package/dist/add-collection-DxtuNxeP.mjs +0 -11
- package/dist/auth-B9B4pUaH.mjs +0 -19
- package/dist/capabilities-7e9MgquN.mjs +0 -29
- package/dist/card-D54unw6r.mjs +0 -20
- package/dist/collection-B5kIKRTL.mjs +0 -20
- package/dist/create-6XE7GYxk.mjs +0 -45
- package/dist/create-C8gA-XP2.mjs +0 -54
- package/dist/credentials-CFA9iGZG.mjs +0 -88
- package/dist/dashboard-lw6IFfOs.mjs +0 -21
- package/dist/database-BPT6BrmF.mjs +0 -17
- package/dist/db-CBCj8sBg.mjs +0 -22
- package/dist/delete-CiV6f69N.mjs +0 -104
- package/dist/deprovision-C-qEnh-P.mjs +0 -67
- package/dist/docker-B-QQWThD.mjs +0 -515
- package/dist/field-DJmQ2pul.mjs +0 -18
- package/dist/git-sync-rmjYOGFK.mjs +0 -28
- package/dist/is-dirty-DFGgGLDi.mjs +0 -10
- package/dist/license-j0tDQLKI.mjs +0 -17
- package/dist/list-evetBTcH.mjs +0 -36
- package/dist/logs-jx5b_YDk.mjs +0 -60
- package/dist/measure-BfgxqewH.mjs +0 -19
- package/dist/parse-schemas-DDK9nXuh.mjs +0 -12
- package/dist/process-CM7Uu5q_.mjs +0 -105
- package/dist/provision-BJd6zO1D.mjs +0 -83
- package/dist/ps-CpyHEvv7.mjs +0 -11
- package/dist/ps-dEqRGeB3.mjs +0 -80
- package/dist/remove-BNQ1c6hB.mjs +0 -64
- package/dist/run-DTsx8bLb.mjs +0 -96
- package/dist/segment-CoElN2b-.mjs +0 -19
- package/dist/set-Dclba9xF.mjs +0 -68
- package/dist/skills-tMYd5d9v.mjs +0 -18
- package/dist/snippet-B84H3tfp.mjs +0 -19
- package/dist/start-B7ByBicB.mjs +0 -414
- package/dist/status-DAzD1Cn_.mjs +0 -34
- package/dist/stop-Cvexagxh.mjs +0 -87
- package/dist/sync-schema-CrmVX1cy.mjs +0 -44
- package/dist/table-B0fRQv91.mjs +0 -19
- package/dist/transform-K_kp6Rdm.mjs +0 -24
- package/dist/transform-job-CuNN8zgv.mjs +0 -19
- package/dist/update-hiJdbbsb.mjs +0 -78
- package/dist/url-LMJZRDv4.mjs +0 -56
- package/dist/wait-DHjXk3jD.mjs +0 -19
- package/dist/workspace-Bt8n3ojY.mjs +0 -25
- package/dist/workspace-D8HtUN0y.mjs +0 -72
- package/dist/workspace-credentials-8CBMQJFz.mjs +0 -100
- package/dist/yaml-Gv6wRFMF.mjs +0 -43
- package/skill-data/workspace/SKILL.md +0 -390
- /package/dist/{body-flags-D7q87Btw.mjs → body-flags-D78h_-Ua.mjs} +0 -0
- /package/dist/{dashboard-B4bn3z6t.mjs → dashboard-FY5UzJ_Z.mjs} +0 -0
- /package/dist/{field-E0IBy4Uw.mjs → field-MGxpNQUH.mjs} +0 -0
- /package/dist/{input-cMSEqISy.mjs → input-xewHccej.mjs} +0 -0
- /package/dist/{key-vkNkH82H.mjs → key-C2XG394c.mjs} +0 -0
- /package/dist/{measure-Bt3InQsA.mjs → measure-ClESGxIb.mjs} +0 -0
- /package/dist/{paginate-BexjkjbY.mjs → paginate-Dfm9eO9A.mjs} +0 -0
- /package/dist/{parse-enum-CrEWOhuY.mjs → parse-enum-Dr7ACrTR.mjs} +0 -0
- /package/dist/{parse-ref-DKag6a6I.mjs → parse-ref-BiETXmvm.mjs} +0 -0
- /package/dist/{prompt-CFKoys7k.mjs → prompt-u4WhE4T5.mjs} +0 -0
- /package/dist/{render-khznBlla.mjs → render-BQHJhSP1.mjs} +0 -0
- /package/dist/{revision-message-flag-DY29-cgz.mjs → revision-message-flag-WmsIzUOM.mjs} +0 -0
- /package/dist/{segment-DhBmcr_E.mjs → segment-Be2v4ilr.mjs} +0 -0
- /package/dist/{setting-BzCng1Ub.mjs → setting-oL97SNeO.mjs} +0 -0
- /package/dist/{snippet-bi_0XbNT.mjs → snippet-xh42tYly.mjs} +0 -0
- /package/dist/{transform-job-DjhoJbiV.mjs → transform-job-DpDGoqQt.mjs} +0 -0
|
@@ -8,7 +8,7 @@ allowed-tools: Read, Write, Edit, Bash, AskUserQuestion
|
|
|
8
8
|
|
|
9
9
|
A **transform** persists the result of a query (native SQL or MBQL) to a warehouse table the user can read from cards, dashboards, and other transforms. It runs on a schedule (via `transform-job`) or on-demand (`transform run`).
|
|
10
10
|
|
|
11
|
-
This skill covers the create-and-run flow. The general flag conventions, body-input precedence, and output flags live in the `core` skill (`mb skills get core`).
|
|
11
|
+
This skill covers the create-and-run flow. The general flag conventions, body-input precedence, and output flags live in the `core` skill (`mb skills get core`).
|
|
12
12
|
|
|
13
13
|
## Body shape
|
|
14
14
|
|
|
@@ -53,13 +53,15 @@ mb transform run "$TRANSFORM_ID" --wait --profile <name> --json
|
|
|
53
53
|
|
|
54
54
|
Notes:
|
|
55
55
|
|
|
56
|
-
- `<db-id>` comes from `mb database list --profile <name> --json`. Database ids are per-instance
|
|
57
|
-
- Target `schema` is the
|
|
56
|
+
- `<db-id>` comes from `mb database list --profile <name> --json`. Database ids are per-instance.
|
|
57
|
+
- Target `schema` is the schema the result table is written into (e.g. `public`).
|
|
58
58
|
- `--wait` on `transform run` polls until status is `succeeded` or `failed`. Without it you only get `{message: "Transform run started", run_id, final: null}` and have to poll yourself.
|
|
59
|
-
-
|
|
59
|
+
- `--sync` implies `--wait`, then waits until the run's output table is registered — the run registers it itself, no `db sync-schema` needed — adding `target_table_id` to the envelope. Use it when you'll build MBQL on the output (see "Inspect").
|
|
60
|
+
- The `--json` envelope is shape-stable: `{message, run_id, final}` (plus `target_table_id` under `--sync` — a number, or `null` if the table didn't register before the timeout). `final` is always present — `null` when `--wait` is omitted or the run never started, otherwise a full `TransformRun` object with `status` and `message`. On a failed run (`final.status` ∈ {`failed`, `timeout`, `canceled`}) the CLI exits 1 and writes a one-line summary `transform run <id> failed` to stderr; the failure detail lives only in `final.message` on stdout, so `jq -r '.final.message'` is where to look.
|
|
60
61
|
- The heredoc with single-quoted `'EOF'` prevents shell from interpolating any `$vars` inside the SQL.
|
|
61
62
|
- `transform create --json` returns the agent-facing compact projection: `{id, name, description, source_type, target: {type, database, schema, name}, target_db_id}`. Read `target.schema`/`target.name` directly off the create output — no follow-up `transform get` needed to verify where the transform will write.
|
|
62
63
|
- If a transform with the same `name` already has a YAML representation on disk under the configured remote-sync repo, `create` mints a `_2` suffix on the exported filename (the new transform gets a fresh `entity_id`; the prior one isn't touched). For "iterate on the same concept" workflows, prefer `transform update <id>` — see "Iterating on a failing transform" below.
|
|
64
|
+
- **`collection_id` only accepts a collection in the `:transforms` namespace.** Transforms aren't filed next to cards and dashboards — passing a normal analytics collection id (the kind a dashboard lives in) fails create/update with `collection_id: A Transform can only go in Collections in the :transforms namespace.` Omit `collection_id` to leave the transform uncollected (the common case), or create one with `mb collection create --body '{"name":"…"}' --namespace transforms --json` and pass the returned `id`. Cards and dashboards you build **on top of** the transform's output table go in ordinary collections as usual — so "put the transform and its dashboard in collection X" generally means _X holds the dashboard + cards; the transform stays in the transforms namespace._
|
|
63
65
|
|
|
64
66
|
## Inspect
|
|
65
67
|
|
|
@@ -68,7 +70,16 @@ mb transform list --profile <name> --json
|
|
|
68
70
|
mb transform get <id> --profile <name> --full --json # full transform incl. last run summary
|
|
69
71
|
```
|
|
70
72
|
|
|
71
|
-
After a run
|
|
73
|
+
After a run the table physically exists in the warehouse, but Metabase addresses tables/columns by numeric id, so **MBQL and the UI can't reference a brand-new table until the instance syncs** (native SQL — a native `card` or `mb query` against `<schema>.<name>` — reads it immediately). Run and register in one step with `--sync`:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
TABLE_ID=$(mb transform run <id> --sync --profile <name> --json | jq -r '.target_table_id')
|
|
77
|
+
mb table get "$TABLE_ID" --include fields --profile <name> --json # field ids for MBQL
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`--sync` runs the transform and polls until its output table is registered, returning the id as `target_table_id` — the run registers the table itself, so no `db sync-schema` is needed. On `target_table_id: null` (still syncing when the poll timed out; exit 0) re-poll `mb transform get <id> --full --json` until the `target_table_id` / `table` linkage lands.
|
|
81
|
+
|
|
82
|
+
Columns and types are inferred from the result set; change the SELECT shape and the next run fails on a column mismatch — drop the table first (`transform delete-table <id>`). A changed shape also needs a re-run with `--sync` before MBQL sees the new/renamed columns.
|
|
72
83
|
|
|
73
84
|
## Inspect runs and cancel an in-flight run
|
|
74
85
|
|
|
@@ -107,10 +118,11 @@ Column "TAGS" not found; SQL statement:
|
|
|
107
118
|
UPDATE "TRANSFORM" SET "TAGS" = (), "UPDATED_AT" = NOW() WHERE "ID" = ? [42122-214]
|
|
108
119
|
```
|
|
109
120
|
|
|
110
|
-
|
|
121
|
+
Three specific footguns:
|
|
111
122
|
|
|
112
123
|
- **`tags` is not a key on the REST API.** The serdes/YAML representation uses `tags`; the REST contract uses `tag_ids` (an array of integer ids). If you pulled a YAML representation and want to PUT it, translate `tags: [...]` → `tag_ids: [...]` first (or omit it entirely if you're not changing tag membership).
|
|
113
124
|
- **`source_type`, `target_db_id`, `target_table_id`, `entity_id`** are derived/computed by the server. They appear in GET responses for the agent's benefit; the server doesn't accept them on update.
|
|
125
|
+
- **`collection_id` must be a `:transforms`-namespace collection** — a regular card/dashboard collection id is rejected with `A Transform can only go in Collections in the :transforms namespace.` Omit it unless you have one (see the create notes above). Round-tripping the existing value is safe; setting it to an ordinary collection is what fails.
|
|
114
126
|
|
|
115
127
|
Right shape — patch only what changes:
|
|
116
128
|
|
|
@@ -193,5 +205,4 @@ A schedule lives in a separate resource (`transform-job`) and references one or
|
|
|
193
205
|
|
|
194
206
|
- Don't put `transform run` calls in tight polling loops — pass `--wait` and let the CLI handle the polling. Manual loops without `--wait` will hammer the server.
|
|
195
207
|
- Don't author MBQL 4 (the legacy nested `{ type: "query", query: {...} }` shape) by hand — pull a sample with `mb transform get <id> --full --json`. MBQL 5 (`lib/type: "mbql/query"`) **is** authorable by hand thanks to the `mb query --print-schema` + `--dry-run` feedback loop; for non-trivial pipelines you may still prefer building in the UI and exporting.
|
|
196
|
-
- Don't write the workspace isolation schema into `target.schema` or SQL. See the `workspace` skill for the canonical-name rule.
|
|
197
208
|
- Don't paste a `transform get` body into `transform update` — the PUT endpoint only accepts writable keys, and unknown keys (notably `tags`, `source_type`, `entity_id`, `created_at`, `last_run`) leak as raw SQL errors. See "Update body: send only writable keys" above. Use `tag_ids` (not `tags`) on the REST contract.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: metabase-cli
|
|
3
|
-
description: Drive a Metabase instance from the terminal via the `mb` CLI — auth, databases, cards, dashboards, transforms, queries, search, git-sync
|
|
3
|
+
description: Drive a Metabase instance from the terminal via the `mb` CLI — auth, databases, cards, dashboards, transforms, queries, search, git-sync. Discovery entry; load the full guide with `mb skills get core`.
|
|
4
4
|
allowed-tools: Bash, Read, Write, Edit, AskUserQuestion
|
|
5
5
|
hidden: true
|
|
6
6
|
---
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import "./command-augment-BH9qgQ5u.mjs";
|
|
2
|
-
import "./error-CTVL5CdB.mjs";
|
|
3
|
-
import "./runtime-B40L_bj8.mjs";
|
|
4
|
-
import "./capabilities-7e9MgquN.mjs";
|
|
5
|
-
import "./render-0_GsapXa.mjs";
|
|
6
|
-
import "./parse-id-D1LTTt9L.mjs";
|
|
7
|
-
import "./poll-task-D8mG49IN.mjs";
|
|
8
|
-
import "./poll-DxpnK1wW.mjs";
|
|
9
|
-
import { SyncSettingsUpdateResult, add_collection_default, setCollectionRemoteSynced, syncSettingsUpdateView } from "./add-collection-CwrbKmC1.mjs";
|
|
10
|
-
|
|
11
|
-
export { add_collection_default as default };
|
package/dist/auth-B9B4pUaH.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { defineCommand } from "citty";
|
|
2
|
-
|
|
3
|
-
//#region src/commands/auth/index.ts
|
|
4
|
-
var auth_default = defineCommand({
|
|
5
|
-
meta: {
|
|
6
|
-
name: "auth",
|
|
7
|
-
description: "Authenticate against a Metabase instance"
|
|
8
|
-
},
|
|
9
|
-
default: "login",
|
|
10
|
-
subCommands: {
|
|
11
|
-
login: () => import("./login-BJGhZLgZ.mjs").then((m) => m.default),
|
|
12
|
-
status: () => import("./status-B1dc3bbQ.mjs").then((m) => m.default),
|
|
13
|
-
list: () => import("./list-BRXGDSMo.mjs").then((m) => m.default),
|
|
14
|
-
logout: () => import("./logout-BAGLqtnV.mjs").then((m) => m.default)
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { auth_default as default };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
//#region src/runtime/predicates.ts
|
|
4
|
-
function isPlainObject(value) {
|
|
5
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
//#endregion
|
|
9
|
-
//#region src/output/notice.ts
|
|
10
|
-
function warn(message) {
|
|
11
|
-
process.stderr.write(message + "\n");
|
|
12
|
-
}
|
|
13
|
-
function listTruncationNotice(bytes) {
|
|
14
|
-
return `… cut at ${bytes} bytes; rerun with --max-bytes 0`;
|
|
15
|
-
}
|
|
16
|
-
function itemOversizeMessage(bytes, maxBytes) {
|
|
17
|
-
return `output is ${bytes} bytes, over the ${maxBytes}-byte --max-bytes cap; narrow with --fields, or pass --max-bytes 0 to disable`;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/runtime/capabilities.ts
|
|
22
|
-
const Capabilities = z.object({
|
|
23
|
-
minVersion: z.number(),
|
|
24
|
-
tokenFeature: z.string().optional()
|
|
25
|
-
});
|
|
26
|
-
const BASELINE_CAPABILITIES = Object.freeze({ minVersion: 58 });
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
export { BASELINE_CAPABILITIES, Capabilities, isPlainObject, itemOversizeMessage, listTruncationNotice, warn };
|
package/dist/card-D54unw6r.mjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { defineCommand } from "citty";
|
|
2
|
-
|
|
3
|
-
//#region src/commands/card/index.ts
|
|
4
|
-
var card_default = defineCommand({
|
|
5
|
-
meta: {
|
|
6
|
-
name: "card",
|
|
7
|
-
description: "Manage Metabase cards (questions, models, metrics)"
|
|
8
|
-
},
|
|
9
|
-
subCommands: {
|
|
10
|
-
list: () => import("./list-Fjjtpghb.mjs").then((mod) => mod.default),
|
|
11
|
-
get: () => import("./get-CyG_P55z.mjs").then((mod) => mod.default),
|
|
12
|
-
query: () => import("./query-zWFRDH3T.mjs").then((mod) => mod.default),
|
|
13
|
-
create: () => import("./create-7JOWFxqu.mjs").then((mod) => mod.default),
|
|
14
|
-
update: () => import("./update-BsgHRoZ8.mjs").then((mod) => mod.default),
|
|
15
|
-
archive: () => import("./archive-ZnnJc2iT.mjs").then((mod) => mod.default)
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
//#endregion
|
|
20
|
-
export { card_default as default };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { defineCommand } from "citty";
|
|
2
|
-
|
|
3
|
-
//#region src/commands/collection/index.ts
|
|
4
|
-
var collection_default = defineCommand({
|
|
5
|
-
meta: {
|
|
6
|
-
name: "collection",
|
|
7
|
-
description: "Manage Metabase collections"
|
|
8
|
-
},
|
|
9
|
-
subCommands: {
|
|
10
|
-
list: () => import("./list-BI1PfPjn.mjs").then((mod) => mod.default),
|
|
11
|
-
get: () => import("./get-DauAF3sm.mjs").then((mod) => mod.default),
|
|
12
|
-
items: () => import("./items-BSpapmCU.mjs").then((mod) => mod.default),
|
|
13
|
-
tree: () => import("./tree-DsnIPFyE.mjs").then((mod) => mod.default),
|
|
14
|
-
create: () => import("./create-6XE7GYxk.mjs").then((mod) => mod.default),
|
|
15
|
-
archive: () => import("./archive-BzvqQd34.mjs").then((mod) => mod.default)
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
//#endregion
|
|
20
|
-
export { collection_default as default };
|
package/dist/create-6XE7GYxk.mjs
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import "./command-augment-BH9qgQ5u.mjs";
|
|
2
|
-
import { connectionFlags, outputFlags, profileFlag } from "./error-CTVL5CdB.mjs";
|
|
3
|
-
import { defineMetabaseCommand } from "./runtime-B40L_bj8.mjs";
|
|
4
|
-
import "./capabilities-7e9MgquN.mjs";
|
|
5
|
-
import { renderSummary } from "./render-0_GsapXa.mjs";
|
|
6
|
-
import "./input-cMSEqISy.mjs";
|
|
7
|
-
import { readBody } from "./body-DDYKoyMt.mjs";
|
|
8
|
-
import { bodyInputFlags } from "./body-flags-D7q87Btw.mjs";
|
|
9
|
-
import { Collection, CollectionCreateInput, collectionView } from "./collection-Bcy8cWYH.mjs";
|
|
10
|
-
|
|
11
|
-
//#region src/commands/collection/create.ts
|
|
12
|
-
var create_default = defineMetabaseCommand({
|
|
13
|
-
meta: {
|
|
14
|
-
name: "create",
|
|
15
|
-
description: "Create a collection from a JSON spec"
|
|
16
|
-
},
|
|
17
|
-
capabilities: { minVersion: 58 },
|
|
18
|
-
args: {
|
|
19
|
-
...outputFlags,
|
|
20
|
-
...profileFlag,
|
|
21
|
-
...connectionFlags,
|
|
22
|
-
...bodyInputFlags
|
|
23
|
-
},
|
|
24
|
-
outputSchema: Collection,
|
|
25
|
-
examples: [
|
|
26
|
-
"cat collection.json | mb collection create",
|
|
27
|
-
"mb collection create --file collection.json",
|
|
28
|
-
"mb collection create --body '{\"name\":\"My Collection\",\"parent_id\":4}'"
|
|
29
|
-
],
|
|
30
|
-
async run({ args, ctx, getClient }) {
|
|
31
|
-
const body = await readBody({
|
|
32
|
-
flag: args.body,
|
|
33
|
-
file: args.file
|
|
34
|
-
}, CollectionCreateInput);
|
|
35
|
-
const client = await getClient();
|
|
36
|
-
const created = await client.requestParsed(Collection, "/api/collection", {
|
|
37
|
-
method: "POST",
|
|
38
|
-
body
|
|
39
|
-
});
|
|
40
|
-
renderSummary(created, collectionView, `Created collection ${created.id} "${created.name}".`, ctx);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
//#endregion
|
|
45
|
-
export { create_default as default };
|
package/dist/create-C8gA-XP2.mjs
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import "./command-augment-BH9qgQ5u.mjs";
|
|
2
|
-
import { connectionFlags, outputFlags, profileFlag } from "./error-CTVL5CdB.mjs";
|
|
3
|
-
import { defineMetabaseCommand } from "./runtime-B40L_bj8.mjs";
|
|
4
|
-
import "./capabilities-7e9MgquN.mjs";
|
|
5
|
-
import { renderSummary } from "./render-0_GsapXa.mjs";
|
|
6
|
-
import "./input-cMSEqISy.mjs";
|
|
7
|
-
import { readBody } from "./body-DDYKoyMt.mjs";
|
|
8
|
-
import { bodyInputFlags } from "./body-flags-D7q87Btw.mjs";
|
|
9
|
-
import { Workspace, WorkspaceCreateInput, workspaceView } from "./workspace-D8HtUN0y.mjs";
|
|
10
|
-
|
|
11
|
-
//#region src/commands/workspace/create.ts
|
|
12
|
-
var create_default = defineMetabaseCommand({
|
|
13
|
-
meta: {
|
|
14
|
-
name: "create",
|
|
15
|
-
description: "Create a workspace"
|
|
16
|
-
},
|
|
17
|
-
capabilities: {
|
|
18
|
-
minVersion: 62,
|
|
19
|
-
tokenFeature: "workspaces"
|
|
20
|
-
},
|
|
21
|
-
args: {
|
|
22
|
-
...outputFlags,
|
|
23
|
-
...profileFlag,
|
|
24
|
-
...connectionFlags,
|
|
25
|
-
...bodyInputFlags,
|
|
26
|
-
name: {
|
|
27
|
-
type: "string",
|
|
28
|
-
description: "Workspace name (alternative to --body / --file)"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
outputSchema: Workspace,
|
|
32
|
-
examples: [
|
|
33
|
-
"mb workspace create --name \"analytics\"",
|
|
34
|
-
"echo '{\"name\":\"analytics\"}' | mb workspace create",
|
|
35
|
-
"mb workspace create --file workspace.json"
|
|
36
|
-
],
|
|
37
|
-
async run({ args, ctx, getClient }) {
|
|
38
|
-
const body = args.name !== void 0 && args.name !== "" ? WorkspaceCreateInput.parse({ name: args.name }) : await readBody({
|
|
39
|
-
flag: args.body,
|
|
40
|
-
file: args.file
|
|
41
|
-
}, WorkspaceCreateInput);
|
|
42
|
-
const client = await getClient();
|
|
43
|
-
const created = await client.requestParsed(Workspace, "/api/ee/workspace-manager", {
|
|
44
|
-
method: "POST",
|
|
45
|
-
body
|
|
46
|
-
});
|
|
47
|
-
const hasDatabases = (created.databases ?? []).length > 0;
|
|
48
|
-
const hint = hasDatabases ? "" : " No databases yet — run `mb workspace database provision`.";
|
|
49
|
-
renderSummary(created, workspaceView, `Created workspace ${created.id} "${created.name}".${hint}`, ctx);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
//#endregion
|
|
54
|
-
export { create_default as default };
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import "./command-augment-BH9qgQ5u.mjs";
|
|
2
|
-
import { outputFlags } from "./error-CTVL5CdB.mjs";
|
|
3
|
-
import { defineMetabaseCommand, localUrl, parseJson } from "./runtime-B40L_bj8.mjs";
|
|
4
|
-
import "./capabilities-7e9MgquN.mjs";
|
|
5
|
-
import { renderItem } from "./render-0_GsapXa.mjs";
|
|
6
|
-
import { parseId } from "./parse-id-D1LTTt9L.mjs";
|
|
7
|
-
import "./poll-DxpnK1wW.mjs";
|
|
8
|
-
import "./yaml-Gv6wRFMF.mjs";
|
|
9
|
-
import "./process-CM7Uu5q_.mjs";
|
|
10
|
-
import { checkDockerReady, readContainerCredentialsFile, requireWorkspaceContainerLocation } from "./docker-B-QQWThD.mjs";
|
|
11
|
-
import { WorkspaceCredentials } from "./workspace-credentials-8CBMQJFz.mjs";
|
|
12
|
-
import { z } from "zod";
|
|
13
|
-
|
|
14
|
-
//#region src/commands/workspace/credentials.ts
|
|
15
|
-
const WorkspaceCredentialsResult = z.object({
|
|
16
|
-
workspace_id: z.number().int().positive(),
|
|
17
|
-
url: z.string(),
|
|
18
|
-
email: z.string(),
|
|
19
|
-
password: z.string(),
|
|
20
|
-
api_key_name: z.string(),
|
|
21
|
-
api_key: z.string()
|
|
22
|
-
});
|
|
23
|
-
const credentialsView = {
|
|
24
|
-
compactPick: WorkspaceCredentialsResult,
|
|
25
|
-
tableColumns: [
|
|
26
|
-
{
|
|
27
|
-
key: "workspace_id",
|
|
28
|
-
label: "ID"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
key: "url",
|
|
32
|
-
label: "URL"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
key: "email",
|
|
36
|
-
label: "Email"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
key: "password",
|
|
40
|
-
label: "Password"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
key: "api_key_name",
|
|
44
|
-
label: "API Key Name"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
key: "api_key",
|
|
48
|
-
label: "API Key"
|
|
49
|
-
}
|
|
50
|
-
]
|
|
51
|
-
};
|
|
52
|
-
const textDecoder = new TextDecoder("utf-8");
|
|
53
|
-
var credentials_default = defineMetabaseCommand({
|
|
54
|
-
meta: {
|
|
55
|
-
name: "credentials",
|
|
56
|
-
description: "Read the workspace child instance's admin credentials (email + password + API key) from the running container"
|
|
57
|
-
},
|
|
58
|
-
capabilities: null,
|
|
59
|
-
args: {
|
|
60
|
-
...outputFlags,
|
|
61
|
-
id: {
|
|
62
|
-
type: "positional",
|
|
63
|
-
description: "Workspace id",
|
|
64
|
-
required: true
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
outputSchema: WorkspaceCredentialsResult,
|
|
68
|
-
examples: ["mb workspace credentials 1", "mb workspace credentials 1 --json"],
|
|
69
|
-
async run({ args, ctx }) {
|
|
70
|
-
const workspaceId = parseId(args.id);
|
|
71
|
-
await checkDockerReady();
|
|
72
|
-
const { containerName, hostPort } = await requireWorkspaceContainerLocation(workspaceId);
|
|
73
|
-
const bytes = await readContainerCredentialsFile(workspaceId);
|
|
74
|
-
const credentials = parseJson(textDecoder.decode(bytes), WorkspaceCredentials, { source: `${containerName}:credentials.json` });
|
|
75
|
-
const result = {
|
|
76
|
-
workspace_id: workspaceId,
|
|
77
|
-
url: localUrl(hostPort),
|
|
78
|
-
email: credentials.user.email,
|
|
79
|
-
password: credentials.user.password,
|
|
80
|
-
api_key_name: credentials.api_key.name,
|
|
81
|
-
api_key: credentials.api_key.key
|
|
82
|
-
};
|
|
83
|
-
renderItem(result, credentialsView, ctx);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
//#endregion
|
|
88
|
-
export { credentials_default as default };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { defineCommand } from "citty";
|
|
2
|
-
|
|
3
|
-
//#region src/commands/dashboard/index.ts
|
|
4
|
-
var dashboard_default = defineCommand({
|
|
5
|
-
meta: {
|
|
6
|
-
name: "dashboard",
|
|
7
|
-
description: "Manage Metabase dashboards"
|
|
8
|
-
},
|
|
9
|
-
subCommands: {
|
|
10
|
-
list: () => import("./list-Br77Mw6U.mjs").then((mod) => mod.default),
|
|
11
|
-
get: () => import("./get-BNKsNCcx.mjs").then((mod) => mod.default),
|
|
12
|
-
cards: () => import("./cards-z68PANDD.mjs").then((mod) => mod.default),
|
|
13
|
-
create: () => import("./create-BzK59YlR.mjs").then((mod) => mod.default),
|
|
14
|
-
update: () => import("./update-Baya6OkO.mjs").then((mod) => mod.default),
|
|
15
|
-
"update-dashcard": () => import("./update-dashcard-DK9X91ha.mjs").then((mod) => mod.default),
|
|
16
|
-
archive: () => import("./archive-DqUtqRut.mjs").then((mod) => mod.default)
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
//#endregion
|
|
21
|
-
export { dashboard_default as default };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { defineCommand } from "citty";
|
|
2
|
-
|
|
3
|
-
//#region src/commands/workspace/database/index.ts
|
|
4
|
-
var database_default = defineCommand({
|
|
5
|
-
meta: {
|
|
6
|
-
name: "database",
|
|
7
|
-
description: "Manage databases provisioned to a workspace"
|
|
8
|
-
},
|
|
9
|
-
subCommands: {
|
|
10
|
-
provision: () => import("./provision-BJd6zO1D.mjs").then((mod) => mod.default),
|
|
11
|
-
update: () => import("./update-hiJdbbsb.mjs").then((mod) => mod.default),
|
|
12
|
-
deprovision: () => import("./deprovision-C-qEnh-P.mjs").then((mod) => mod.default)
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
//#endregion
|
|
17
|
-
export { database_default as default };
|
package/dist/db-CBCj8sBg.mjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { defineCommand } from "citty";
|
|
2
|
-
|
|
3
|
-
//#region src/commands/db/index.ts
|
|
4
|
-
var db_default = defineCommand({
|
|
5
|
-
meta: {
|
|
6
|
-
name: "db",
|
|
7
|
-
description: "Inspect and sync Metabase databases",
|
|
8
|
-
alias: "database"
|
|
9
|
-
},
|
|
10
|
-
subCommands: {
|
|
11
|
-
list: () => import("./list-D1qhCQn0.mjs").then((m) => m.default),
|
|
12
|
-
get: () => import("./get-BZiu-u-9.mjs").then((m) => m.default),
|
|
13
|
-
metadata: () => import("./metadata-DJAdsOoh.mjs").then((m) => m.default),
|
|
14
|
-
schemas: () => import("./schemas-GIIbek2O.mjs").then((m) => m.default),
|
|
15
|
-
"schema-tables": () => import("./schema-tables-CjBRF0_0.mjs").then((m) => m.default),
|
|
16
|
-
"sync-schema": () => import("./sync-schema-CrmVX1cy.mjs").then((m) => m.default),
|
|
17
|
-
"rescan-values": () => import("./rescan-values-M7g81KIl.mjs").then((m) => m.default)
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
//#endregion
|
|
22
|
-
export { db_default as default };
|
package/dist/delete-CiV6f69N.mjs
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import "./command-augment-BH9qgQ5u.mjs";
|
|
2
|
-
import { outputFlags } from "./error-CTVL5CdB.mjs";
|
|
3
|
-
import { defineMetabaseCommand } from "./runtime-B40L_bj8.mjs";
|
|
4
|
-
import "./capabilities-7e9MgquN.mjs";
|
|
5
|
-
import { renderSummary } from "./render-0_GsapXa.mjs";
|
|
6
|
-
import { promptConfirm } from "./prompt-CFKoys7k.mjs";
|
|
7
|
-
import { parseId } from "./parse-id-D1LTTt9L.mjs";
|
|
8
|
-
import "./poll-DxpnK1wW.mjs";
|
|
9
|
-
import "./process-CM7Uu5q_.mjs";
|
|
10
|
-
import { checkDockerReady, containerNameFor, removeContainer, removeVolume, volumeNameFor } from "./docker-B-QQWThD.mjs";
|
|
11
|
-
import { z } from "zod";
|
|
12
|
-
|
|
13
|
-
//#region src/commands/workspace/delete.ts
|
|
14
|
-
const DeleteResult = z.object({
|
|
15
|
-
workspace_id: z.number().int().positive(),
|
|
16
|
-
container_name: z.string(),
|
|
17
|
-
volume_name: z.string(),
|
|
18
|
-
removed_container: z.boolean(),
|
|
19
|
-
removed_volume: z.boolean()
|
|
20
|
-
});
|
|
21
|
-
const deleteResultView = {
|
|
22
|
-
compactPick: DeleteResult.pick({
|
|
23
|
-
workspace_id: true,
|
|
24
|
-
removed_container: true,
|
|
25
|
-
removed_volume: true
|
|
26
|
-
}).strip(),
|
|
27
|
-
tableColumns: [
|
|
28
|
-
{
|
|
29
|
-
key: "workspace_id",
|
|
30
|
-
label: "ID"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
key: "container_name",
|
|
34
|
-
label: "Container"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
key: "volume_name",
|
|
38
|
-
label: "Volume"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
key: "removed_container",
|
|
42
|
-
label: "Removed Container"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
key: "removed_volume",
|
|
46
|
-
label: "Removed Volume"
|
|
47
|
-
}
|
|
48
|
-
]
|
|
49
|
-
};
|
|
50
|
-
var delete_default = defineMetabaseCommand({
|
|
51
|
-
meta: {
|
|
52
|
-
name: "delete",
|
|
53
|
-
description: "Stop and remove the local container + app-db volume (does not affect remote)"
|
|
54
|
-
},
|
|
55
|
-
capabilities: null,
|
|
56
|
-
args: {
|
|
57
|
-
...outputFlags,
|
|
58
|
-
id: {
|
|
59
|
-
type: "positional",
|
|
60
|
-
description: "Workspace id",
|
|
61
|
-
required: true
|
|
62
|
-
},
|
|
63
|
-
"keep-volume": {
|
|
64
|
-
type: "boolean",
|
|
65
|
-
description: "Keep the workspace's app-db volume (faster restart, app-db survives)",
|
|
66
|
-
default: false
|
|
67
|
-
},
|
|
68
|
-
yes: {
|
|
69
|
-
type: "boolean",
|
|
70
|
-
description: "Skip the confirmation prompt",
|
|
71
|
-
default: false
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
outputSchema: DeleteResult,
|
|
75
|
-
examples: ["mb workspace delete 1 --yes", "mb workspace delete 1 --keep-volume --yes"],
|
|
76
|
-
async run({ args, ctx }) {
|
|
77
|
-
const workspaceId = parseId(args.id);
|
|
78
|
-
const containerName = containerNameFor(workspaceId);
|
|
79
|
-
const volumeName = volumeNameFor(workspaceId);
|
|
80
|
-
const shouldRemoveVolume = args["keep-volume"] !== true;
|
|
81
|
-
await checkDockerReady();
|
|
82
|
-
if (!args.yes && process.stdin.isTTY === true) {
|
|
83
|
-
const confirmed = await promptConfirm({ message: shouldRemoveVolume ? `Remove container ${containerName} and its app-db volume ${volumeName}?` : `Remove container ${containerName}? (volume ${volumeName} will be kept)` });
|
|
84
|
-
if (!confirmed) return;
|
|
85
|
-
}
|
|
86
|
-
const removedContainer = await removeContainer(containerName);
|
|
87
|
-
const removedVolume = shouldRemoveVolume ? await removeVolume(volumeName) : false;
|
|
88
|
-
const result = {
|
|
89
|
-
workspace_id: workspaceId,
|
|
90
|
-
container_name: containerName,
|
|
91
|
-
volume_name: volumeName,
|
|
92
|
-
removed_container: removedContainer,
|
|
93
|
-
removed_volume: removedVolume
|
|
94
|
-
};
|
|
95
|
-
let message;
|
|
96
|
-
if (!result.removed_container) message = `No container found for workspace ${workspaceId} — nothing to remove.`;
|
|
97
|
-
else if (result.removed_volume) message = `Removed workspace ${workspaceId}: container ${containerName} and app-db volume ${volumeName}.`;
|
|
98
|
-
else message = `Removed workspace ${workspaceId}: container ${containerName} (volume ${volumeName} kept).`;
|
|
99
|
-
renderSummary(result, deleteResultView, message, ctx);
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
//#endregion
|
|
104
|
-
export { delete_default as default };
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import "./command-augment-BH9qgQ5u.mjs";
|
|
2
|
-
import { connectionFlags, outputFlags, profileFlag } from "./error-CTVL5CdB.mjs";
|
|
3
|
-
import { defineMetabaseCommand } from "./runtime-B40L_bj8.mjs";
|
|
4
|
-
import "./capabilities-7e9MgquN.mjs";
|
|
5
|
-
import "./render-0_GsapXa.mjs";
|
|
6
|
-
import "./prompt-CFKoys7k.mjs";
|
|
7
|
-
import { parseId } from "./parse-id-D1LTTt9L.mjs";
|
|
8
|
-
import "./poll-DxpnK1wW.mjs";
|
|
9
|
-
import { parseWaitFlags, waitFlags } from "./wait-flags-CNIeSq0_.mjs";
|
|
10
|
-
import { DeleteResult, confirmAndDelete } from "./delete-runtime-uuYbd4k2.mjs";
|
|
11
|
-
import "./workspace-D8HtUN0y.mjs";
|
|
12
|
-
import { waitForDatabaseGone } from "./wait-DHjXk3jD.mjs";
|
|
13
|
-
|
|
14
|
-
//#region src/commands/workspace/database/deprovision.ts
|
|
15
|
-
var deprovision_default = defineMetabaseCommand({
|
|
16
|
-
meta: {
|
|
17
|
-
name: "deprovision",
|
|
18
|
-
description: "Deprovision a database from a workspace"
|
|
19
|
-
},
|
|
20
|
-
capabilities: {
|
|
21
|
-
minVersion: 62,
|
|
22
|
-
tokenFeature: "workspaces"
|
|
23
|
-
},
|
|
24
|
-
args: {
|
|
25
|
-
...outputFlags,
|
|
26
|
-
...profileFlag,
|
|
27
|
-
...connectionFlags,
|
|
28
|
-
...waitFlags,
|
|
29
|
-
yes: {
|
|
30
|
-
type: "boolean",
|
|
31
|
-
description: "Skip confirmation",
|
|
32
|
-
default: false
|
|
33
|
-
},
|
|
34
|
-
id: {
|
|
35
|
-
type: "positional",
|
|
36
|
-
description: "Workspace id",
|
|
37
|
-
required: true
|
|
38
|
-
},
|
|
39
|
-
"db-id": {
|
|
40
|
-
type: "positional",
|
|
41
|
-
description: "Database id",
|
|
42
|
-
required: true
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
outputSchema: DeleteResult,
|
|
46
|
-
examples: ["mb workspace database deprovision 1 5 --yes", "mb workspace database deprovision 1 5 --yes --wait"],
|
|
47
|
-
async run({ args, ctx, getClient }) {
|
|
48
|
-
const workspaceId = parseId(args.id);
|
|
49
|
-
const databaseId = parseId(args["db-id"], "db-id");
|
|
50
|
-
const wait = parseWaitFlags(args);
|
|
51
|
-
const client = await getClient();
|
|
52
|
-
await confirmAndDelete({
|
|
53
|
-
id: databaseId,
|
|
54
|
-
path: `/api/ee/workspace-manager/${workspaceId}/database/${databaseId}`,
|
|
55
|
-
yes: args.yes,
|
|
56
|
-
promptMessage: `Deprovision database ${databaseId} from workspace ${workspaceId}?`,
|
|
57
|
-
successMessage: `Deprovisioned database ${databaseId} from workspace ${workspaceId}.`,
|
|
58
|
-
abortMessage: `Aborted; database ${databaseId} was not deprovisioned.`,
|
|
59
|
-
client,
|
|
60
|
-
ctx,
|
|
61
|
-
...wait.enabled ? { afterDelete: () => waitForDatabaseGone(client, workspaceId, databaseId, wait.schedule) } : {}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
//#endregion
|
|
67
|
-
export { deprovision_default as default };
|