@metabase/cli 0.1.0-alpha.workspaces-commands.818a8f1 → 0.1.0-alpha.workspaces-commands.9af92d7

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 (125) hide show
  1. package/README.md +129 -0
  2. package/dist/{api-key-D9XxErQn.mjs → api-key-U35bYysN.mjs} +1 -1
  3. package/dist/{archive-BPG5c88Y.mjs → archive-t98qQCTg.mjs} +6 -5
  4. package/dist/{auth--Hpjwlaf.mjs → auth-Pmzzbl9X.mjs} +3 -3
  5. package/dist/{body-DwU2s6Pg.mjs → body-qjVMvNjF.mjs} +3 -2
  6. package/dist/{branches-BbcoJXfp.mjs → branches-GR_uFakd.mjs} +6 -5
  7. package/dist/{cancel-task-BDas45YO.mjs → cancel-task-Bx4unmzB.mjs} +6 -5
  8. package/dist/card-CY60jlXc.mjs +19 -0
  9. package/dist/cards-CvXNClLR.mjs +37 -0
  10. package/dist/cli.mjs +19 -17
  11. package/dist/create-78zUdOrE.mjs +48 -0
  12. package/dist/{create-DpnjQvPw.mjs → create-A8ixnCEp.mjs} +8 -7
  13. package/dist/create-CT8GaHhd.mjs +44 -0
  14. package/dist/create-DOsPeHvv.mjs +47 -0
  15. package/dist/{create-CCzsCZMm.mjs → create-DRSgnSTg.mjs} +8 -7
  16. package/dist/{create-branch-sDttBORB.mjs → create-branch-95PKGg4J.mjs} +6 -5
  17. package/dist/{create-Bd_U1zWU.mjs → create-klUmZ4qb.mjs} +9 -8
  18. package/dist/{credentials-C0xKke5D.mjs → credentials-h6gwy6KC.mjs} +8 -7
  19. package/dist/{current-task-BGt1mqaX.mjs → current-task-CKTHTDJ-.mjs} +6 -5
  20. package/dist/dashboard-BVEiysxL.mjs +20 -0
  21. package/dist/dashboard-DVCLGg3X.mjs +152 -0
  22. package/dist/{database-4V1iiPEx.mjs → database-VBWFKoFw.mjs} +3 -3
  23. package/dist/{db-Dm2u2ISJ.mjs → db-BNIiulL8.mjs} +2 -2
  24. package/dist/{delete-DRBTgyus.mjs → delete-Dgw7tuwF.mjs} +7 -6
  25. package/dist/{delete-DUC_stoL.mjs → delete-SpvnjwpH.mjs} +7 -6
  26. package/dist/{delete-runtime-inOVw3IX.mjs → delete-runtime-ZDxlvZa6.mjs} +3 -3
  27. package/dist/{delete-table-9Is631O_.mjs → delete-table-BXmFReAx.mjs} +7 -6
  28. package/dist/{deprovision-BAMzZc6f.mjs → deprovision-Cay-ixJs.mjs} +11 -10
  29. package/dist/{dirty-CLjHbz6J.mjs → dirty-CNjg0YSW.mjs} +6 -5
  30. package/dist/{docker-QWVMG2gl.mjs → docker-D2GAMpHR.mjs} +3 -2
  31. package/dist/{eid-BNhutC1U.mjs → eid-CLOyMi0C.mjs} +1 -1
  32. package/dist/errors-C6w1eZ1F.mjs +101 -0
  33. package/dist/{export-D2Anfu3p.mjs → export-D2PP3RlE.mjs} +7 -6
  34. package/dist/{field-Dhs2AND3.mjs → field-D9nztsQP.mjs} +1 -1
  35. package/dist/{flag-pair-CWvvzDJ_.mjs → flag-pair-Dz-mbq0z.mjs} +1 -1
  36. package/dist/{get-CAPLfawI.mjs → get-B32KbqqV.mjs} +6 -5
  37. package/dist/{get-2po1uv9i.mjs → get-B6PHgITW.mjs} +6 -5
  38. package/dist/{get-BHJA78zg.mjs → get-Bc0yqaS1.mjs} +6 -5
  39. package/dist/{get-CAVVmdMX.mjs → get-BzfjbJ1f.mjs} +6 -5
  40. package/dist/{get-DhIoNeOp.mjs → get-CW0uHmFb.mjs} +6 -5
  41. package/dist/{get-qPOsuTPw.mjs → get-DtsLPlhf.mjs} +6 -5
  42. package/dist/{get-DDWpubE8.mjs → get-gZ5sQoS9.mjs} +7 -6
  43. package/dist/get-qXYTmiCW.mjs +40 -0
  44. package/dist/{has-remote-changes-DAL5jetW.mjs → has-remote-changes-BjdywTVP.mjs} +6 -5
  45. package/dist/{import-CUMxUfSF.mjs → import-CVOFq6HN.mjs} +7 -6
  46. package/dist/{input-BNqSFl38.mjs → input-DkgCMNA9.mjs} +1 -1
  47. package/dist/is-dirty-79hBpoVR.mjs +10 -0
  48. package/dist/{is-dirty-B10S6MG0.mjs → is-dirty-DgxNJz79.mjs} +3 -3
  49. package/dist/{key-CyhOpgWt.mjs → key-CpWh7W8M.mjs} +1 -1
  50. package/dist/{license-DtsGJi3l.mjs → license-B2eNHmdg.mjs} +3 -3
  51. package/dist/list-AcUuhDxS.mjs +47 -0
  52. package/dist/{list-DeFGwhhJ.mjs → list-B0durHcU.mjs} +5 -4
  53. package/dist/{list-qetY9OIN.mjs → list-B6LmdzL6.mjs} +5 -4
  54. package/dist/{list-Y7iGsOfE.mjs → list-B9ppD-U5.mjs} +5 -4
  55. package/dist/{list-evtQS7jl.mjs → list-CW20Zfq-.mjs} +5 -4
  56. package/dist/{list-C5MGydGU.mjs → list-Cw0Geehz.mjs} +5 -4
  57. package/dist/{list-B8s7Qnzk.mjs → list-DEW7ZHzy.mjs} +5 -4
  58. package/dist/{list-OBx5B3gd.mjs → list-bSb_Y5k9.mjs} +7 -6
  59. package/dist/{login-Dqw9ZtCx.mjs → login-ChQ9J6Ne.mjs} +6 -5
  60. package/dist/{logout-DwYJ5OUi.mjs → logout-Cit2O74l.mjs} +5 -4
  61. package/dist/{logs-B_lrY7Js.mjs → logs-Ca_YA7A6.mjs} +6 -5
  62. package/dist/{manifest-wzEFG0JB.mjs → manifest-IMg51yb7.mjs} +3 -7
  63. package/dist/{package-t8dKf4m_.mjs → package-CVNZnqz9.mjs} +6 -1
  64. package/dist/{parse-id-C1prc9US.mjs → parse-id-YyyUbzvS.mjs} +1 -1
  65. package/dist/{poll-D2sXM5rc.mjs → poll-CxWRi3iY.mjs} +2 -1
  66. package/dist/{poll-task-Byiunmaj.mjs → poll-task-DdXgrDJf.mjs} +2 -2
  67. package/dist/{prompt-fXeNtj0M.mjs → prompt-D8p00XDp.mjs} +1 -1
  68. package/dist/{provision-DC4_HWZD.mjs → provision-CV30W4mk.mjs} +12 -11
  69. package/dist/ps-B9-TFn7r.mjs +10 -0
  70. package/dist/{ps-BiOrecEe.mjs → ps-BR36xoRT.mjs} +3 -3
  71. package/dist/query-DmeLeLlh.mjs +93 -0
  72. package/dist/{query-BnGVGeM3.mjs → query-Dnlo_5UK.mjs} +6 -5
  73. package/dist/{remove-Bx48o-0S.mjs → remove-ChoQTtcC.mjs} +5 -4
  74. package/dist/{remove-DecoZzNd.mjs → remove-DfVVf1N9.mjs} +8 -7
  75. package/dist/{render-DlBijc5i.mjs → render-CZNR2MNK.mjs} +5 -2
  76. package/dist/{run-D4NgvaRh.mjs → run-BiXybcsl.mjs} +8 -7
  77. package/dist/{runtime-DUgFfYkN.mjs → runtime-DR8NwmQU.mjs} +7 -104
  78. package/dist/{search-4wKx5ug2.mjs → search-0cjOmsQu.mjs} +5 -4
  79. package/dist/{set-DCjrmTFm.mjs → set-BeVw7OX5.mjs} +8 -7
  80. package/dist/{set-BZnCRL4c.mjs → set-CLsmPD8_.mjs} +6 -5
  81. package/dist/{setting-C4vQSqer.mjs → setting-DEhllKkK.mjs} +3 -3
  82. package/dist/{setup-Dqh9hN6l.mjs → setup-BYL5Yagu.mjs} +7 -6
  83. package/dist/{start-xXQypG5L.mjs → start-BdAhhZYt.mjs} +9 -8
  84. package/dist/{stash-ZZkmW_V7.mjs → stash-Ca63-mCs.mjs} +7 -6
  85. package/dist/{status-9KAPIpX8.mjs → status-Bt6rZDLa.mjs} +4 -3
  86. package/dist/{status-JH6BZppo.mjs → status-D7Ihw-lN.mjs} +4 -3
  87. package/dist/{status-DezF-PIM.mjs → status-cZiC8-t_.mjs} +7 -6
  88. package/dist/{stop-br-ZOnve.mjs → stop-BDeCLqh0.mjs} +8 -7
  89. package/dist/sync-BZPts11d.mjs +26 -0
  90. package/dist/{table-BvAr2ixC.mjs → table-BbNgtqbd.mjs} +1 -1
  91. package/dist/{table-D-Mb5Nvw.mjs → table-CjnruP5H.mjs} +2 -2
  92. package/dist/transform-BXF9B-hF.mjs +21 -0
  93. package/dist/transform-job-DDsjt-4N.mjs +19 -0
  94. package/dist/{translate-DJxDVAE4.mjs → translate-oHz4-5o0.mjs} +8 -7
  95. package/dist/{update-DYVeVjk2.mjs → update-BqI8hYNO.mjs} +12 -11
  96. package/dist/update-CLXVmkyr.mjs +52 -0
  97. package/dist/{update-DxKlQ0hP.mjs → update-Dtu0CHTJ.mjs} +9 -8
  98. package/dist/update-WFBs9Nfq.mjs +55 -0
  99. package/dist/update-dashcard-BSf1-SfK.mjs +67 -0
  100. package/dist/{url-DP88YHNo.mjs → url-B0Bc70KV.mjs} +7 -6
  101. package/dist/validate-query-DE4UouY3.mjs +1521 -0
  102. package/dist/{wait-DwZN3ZwR.mjs → wait-DFI3pf6P.mjs} +2 -2
  103. package/dist/{wait-Cj_8wu4y.mjs → wait-Dkbfo1eS.mjs} +7 -6
  104. package/dist/{wait-flags-CjW4ogUJ.mjs → wait-flags-BIVgwvUI.mjs} +2 -2
  105. package/dist/workspace-Bv7qoaJi.mjs +24 -0
  106. package/dist/{workspace-credentials-q5RRFMT8.mjs → workspace-credentials-BxrU2xZb.mjs} +1 -1
  107. package/package.json +6 -1
  108. package/dist/card-D4zZSPUb.mjs +0 -19
  109. package/dist/create-CwVcoq0O.mjs +0 -43
  110. package/dist/create-_UOeEXAj.mjs +0 -39
  111. package/dist/is-dirty-CUuq-aB6.mjs +0 -9
  112. package/dist/ps-1bZKIwWh.mjs +0 -9
  113. package/dist/sync-C7VOWD00.mjs +0 -26
  114. package/dist/transform-CqxZwhGs.mjs +0 -21
  115. package/dist/transform-job-HjbqjEoP.mjs +0 -19
  116. package/dist/update-CDtm71m2.mjs +0 -50
  117. package/dist/workspace-CbwR0vX_.mjs +0 -24
  118. /package/dist/{body-flags-7oqLhu5j.mjs → body-flags-BK7J6Daz.mjs} +0 -0
  119. /package/dist/{card-C31pGtBZ.mjs → card-2XdaHHSS.mjs} +0 -0
  120. /package/dist/{database-BTX5qbSv.mjs → database-B9-7QAXE.mjs} +0 -0
  121. /package/dist/{field-QwBMAWsq.mjs → field-D_g4xvH9.mjs} +0 -0
  122. /package/dist/{setting-DM7pm7yh.mjs → setting-Bm84ixxW.mjs} +0 -0
  123. /package/dist/{transform-DfVkUttP.mjs → transform-CRRW0mFp.mjs} +0 -0
  124. /package/dist/{transform-job-DuB_OjhO.mjs → transform-job-BtCoVYsb.mjs} +0 -0
  125. /package/dist/{workspace-Dr9lWU3D.mjs → workspace-C3tGVQ6_.mjs} +0 -0
package/README.md CHANGED
@@ -288,6 +288,86 @@ metabase card archive 1
288
288
  metabase card archive 1 --json
289
289
  ```
290
290
 
291
+ ## Dashboards
292
+
293
+ Read and write dashboards on `/api/dashboard`. A dashboard groups cards (questions, models, metrics) into a single layout. Each card on a dashboard is a "dashcard" — a placement record with its own id, position (`row`/`col`), and size (`size_x`/`size_y`). Dashcards live nested inside the parent dashboard's `dashcards` array; the API has no per-dashcard endpoint, so single-dashcard edits round-trip through `PUT /api/dashboard/:id`.
294
+
295
+ ### `metabase dashboard list`
296
+
297
+ ```sh
298
+ metabase dashboard list
299
+ metabase dashboard list --json
300
+ metabase dashboard list --filter archived --json
301
+ ```
302
+
303
+ | Flag | Description |
304
+ | ------------------- | ------------------------------------------- |
305
+ | `--filter <preset>` | One of `all` (default), `mine`, `archived`. |
306
+
307
+ ### `metabase dashboard get <id>`
308
+
309
+ ```sh
310
+ metabase dashboard get 1
311
+ metabase dashboard get 1 --json
312
+ metabase dashboard get 1 --json --full
313
+ ```
314
+
315
+ `--full` returns the full hydrated dashboard including the `dashcards` and `tabs` arrays. The default compact view returns only `id`, `name`, `description`, `archived`, and `collection_id`.
316
+
317
+ ### `metabase dashboard cards <id>`
318
+
319
+ List the dashcards on a dashboard.
320
+
321
+ ```sh
322
+ metabase dashboard cards 1
323
+ metabase dashboard cards 1 --json
324
+ ```
325
+
326
+ ### `metabase dashboard create`
327
+
328
+ ```sh
329
+ cat dashboard.json | metabase dashboard create
330
+ metabase dashboard create --file dashboard.json
331
+ metabase dashboard create --body '{"name":"My Dashboard","collection_id":4}'
332
+ ```
333
+
334
+ | Flag | Description |
335
+ | --------------- | ----------------------- |
336
+ | `--body <json>` | Inline JSON body. |
337
+ | `--file <path>` | Path to JSON body file. |
338
+
339
+ ### `metabase dashboard update <id>`
340
+
341
+ Patch a dashboard. To edit the dashcard set, send the entire `dashcards` array — IDs not in the array get deleted, and a negative `id` indicates a new dashcard the server should create.
342
+
343
+ ```sh
344
+ cat patch.json | metabase dashboard update 1
345
+ metabase dashboard update 1 --file patch.json
346
+ metabase dashboard update 1 --body '{"name":"renamed"}'
347
+ metabase dashboard update 1 --body '{"dashcards":[{"id":-1,"card_id":42,"row":0,"col":0,"size_x":12,"size_y":6}]}'
348
+ ```
349
+
350
+ ### `metabase dashboard update-dashcard <dashboard-id> <dashcard-id>`
351
+
352
+ Patch a single dashcard's layout or settings. The command does the round-trip for you: `GET /api/dashboard/:id`, merges the patch into the targeted dashcard while preserving every other dashcard verbatim, then `PUT`s the whole array back.
353
+
354
+ ```sh
355
+ metabase dashboard update-dashcard 1 5 --body '{"row":2,"col":0}'
356
+ metabase dashboard update-dashcard 1 5 --body '{"size_x":12,"size_y":4}'
357
+ cat patch.json | metabase dashboard update-dashcard 1 5
358
+ ```
359
+
360
+ | Patch field | Type |
361
+ | ------------------------ | ---------------------------------- |
362
+ | `row`, `col` | non-negative integer |
363
+ | `size_x`, `size_y` | positive integer |
364
+ | `dashboard_tab_id` | integer or `null` |
365
+ | `parameter_mappings` | array of parameter-mapping objects |
366
+ | `inline_parameters` | array of strings |
367
+ | `visualization_settings` | object |
368
+
369
+ The patch must contain at least one field; an empty object is rejected before the network round-trip.
370
+
291
371
  ## Settings
292
372
 
293
373
  Read and write Metabase instance settings via `/api/setting`. Listing all settings requires admin privileges; per-key reads/writes additionally enforce per-setting access. Setting values are always JSON — `"main"` is the string `main`, `42` is a number, `null` deletes the override and resets the value to its default.
@@ -730,6 +810,55 @@ metabase eid translate --body '{"entity_ids":{"card":["abc123XYZ"]}}'
730
810
  | `--body <json>` | Inline JSON body. |
731
811
  | `--file <path>` | Path to JSON body file. |
732
812
 
813
+ ## Query
814
+
815
+ ### `metabase query`
816
+
817
+ Run an MBQL 5 query with built-in schema validation. Three modes — discover the schema (`--print-schema`), validate without sending (`--dry-run`), run.
818
+
819
+ Two MBQL flavors:
820
+
821
+ - **Internal MBQL** (default) — numeric IDs (`database: 1`, `source-table: 7`). POSTs to `/api/dataset`. This is what every existing Metabase API endpoint accepts.
822
+ - **External MBQL** (`--external`) — string-id FKs (`database: "My DB"`, `source-table: ["My DB", null, "orders"]`). POSTs to `/api/dataset/external` (forward-looking representations endpoint).
823
+
824
+ External and internal MBQL are structurally identical; only the ID types differ. The bundled query schema is synced from `@metabase/representations`; the internal validator overrides `id.yaml` to require positive integers for every ID `$def`.
825
+
826
+ ```sh
827
+ metabase query --print-schema # internal JSON Schema bundle
828
+ metabase query --print-schema --external # string-FK variant
829
+ cat q.json | metabase query --dry-run # validate, no network
830
+ metabase query --file q.json
831
+ metabase query --file q.json --external
832
+ metabase query --file q.json --skip-validate # bypass pre-flight; let server reject
833
+ ```
834
+
835
+ Body sources: `--file`, `--body`, or stdin (exactly one). Body is JSON.
836
+
837
+ `--skip-validate` is an escape hatch when the bundled schema disagrees with what the server actually accepts (drift, false negative, edge case). Validation is skipped entirely and the body is sent as-is. Mutually exclusive with `--dry-run` (which is itself the validation mode).
838
+
839
+ Exit codes:
840
+
841
+ - `0` — valid (and the query ran successfully when not in dry-run).
842
+ - `2` — validation failed, malformed body, or `ConfigError`.
843
+ - `1` — server-side error after a valid pre-flight (network, HTTP 4xx/5xx).
844
+
845
+ Output by mode:
846
+
847
+ - `--print-schema` — `{ mode, schema, defs: { "id.yaml", "parameter.yaml", "ref.yaml", "temporal_bucketing.yaml" } }`. The query schema's `$ref`s point into the `defs` namespace by file path; an agent can either feed the bundle directly into Ajv (`addSchema(defs["id.yaml"], "id.yaml")` etc., then `compile(schema)`) or read it as documentation.
848
+ - `--dry-run` — `{ ok: boolean, errors: { path: string, message: string }[] }`. `path` is a JSON Pointer into the body, `message` is the Ajv error string.
849
+ - Run failure (no `--dry-run`) — same `{ ok, errors }` envelope on stdout, exit 2, no request made.
850
+ - Run success — the streamed `CardQueryResult`.
851
+
852
+ ### MBQL 5 pre-flight in `card create` and `transform create`/`update`
853
+
854
+ When the embedded query (`card.dataset_query`, or `transform.source.query` for `source.type: "query"`) is MBQL 5 (`lib/type: "mbql/query"`), it is pre-flight-validated against the same schema as `metabase query`. Validation failure: `{ ok, errors }` envelope on stdout, exit 2, request not made. MBQL 4 (legacy) bodies and Python transform sources skip validation — they're still accepted by the server and we don't ship a schema for them.
855
+
856
+ Pass `--skip-validate` to bypass the pre-flight on `card create`, `transform create`, or `transform update` — the body is sent as-is and the server is the authority. Same escape hatch as on `metabase query`; use only when the bundled schema disagrees with what the server actually accepts.
857
+
858
+ Agent discovery path: `metabase __manifest` lists every command's args and description; the description for `card create` and `transform create`/`update` references `metabase query --print-schema` so an agent can fetch the validating schema directly.
859
+
860
+ The bundled query schema is synced from a pinned `@metabase/representations` release via `bun run sync:representations`; CI guards against drift.
861
+
733
862
  ## Environment variables
734
863
 
735
864
  | Variable | Effect |
@@ -6,7 +6,7 @@ var api_key_default = defineCommand({
6
6
  name: "api-key",
7
7
  description: "Manage Metabase API keys"
8
8
  },
9
- subCommands: { create: () => import("./create-Bd_U1zWU.mjs").then((mod) => mod.default) }
9
+ subCommands: { create: () => import("./create-klUmZ4qb.mjs").then((mod) => mod.default) }
10
10
  });
11
11
 
12
12
  //#endregion
@@ -1,9 +1,10 @@
1
- import "./package-t8dKf4m_.mjs";
1
+ import "./package-CVNZnqz9.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
- import { renderItem } from "./render-DlBijc5i.mjs";
4
- import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DUgFfYkN.mjs";
5
- import { parseId } from "./parse-id-C1prc9US.mjs";
6
- import { Card, cardView } from "./card-C31pGtBZ.mjs";
3
+ import { renderItem } from "./render-CZNR2MNK.mjs";
4
+ import "./errors-C6w1eZ1F.mjs";
5
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DR8NwmQU.mjs";
6
+ import { parseId } from "./parse-id-YyyUbzvS.mjs";
7
+ import { Card, cardView } from "./card-2XdaHHSS.mjs";
7
8
 
8
9
  //#region src/commands/card/archive.ts
9
10
  var archive_default = defineMetabaseCommand({
@@ -8,9 +8,9 @@ var auth_default = defineCommand({
8
8
  },
9
9
  default: "login",
10
10
  subCommands: {
11
- login: () => import("./login-Dqw9ZtCx.mjs").then((m) => m.default),
12
- status: () => import("./status-JH6BZppo.mjs").then((m) => m.default),
13
- logout: () => import("./logout-DwYJ5OUi.mjs").then((m) => m.default)
11
+ login: () => import("./login-ChQ9J6Ne.mjs").then((m) => m.default),
12
+ status: () => import("./status-D7Ihw-lN.mjs").then((m) => m.default),
13
+ logout: () => import("./logout-Cit2O74l.mjs").then((m) => m.default)
14
14
  }
15
15
  });
16
16
 
@@ -1,5 +1,6 @@
1
- import { ConfigError, parseJson } from "./runtime-DUgFfYkN.mjs";
2
- import { readInput } from "./input-BNqSFl38.mjs";
1
+ import { ConfigError } from "./errors-C6w1eZ1F.mjs";
2
+ import { readInput } from "./input-DkgCMNA9.mjs";
3
+ import { parseJson } from "./runtime-DR8NwmQU.mjs";
3
4
 
4
5
  //#region src/runtime/body.ts
5
6
  async function readBody(sources, schema) {
@@ -1,9 +1,10 @@
1
- import "./package-t8dKf4m_.mjs";
1
+ import "./package-CVNZnqz9.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
- import { renderList } from "./render-DlBijc5i.mjs";
4
- import { connectionFlags, defineMetabaseCommand, listEnvelopeSchema, outputFlags, profileFlag, wrapList } from "./runtime-DUgFfYkN.mjs";
5
- import { REMOTE_SYNC_PATHS } from "./poll-task-Byiunmaj.mjs";
6
- import "./poll-D2sXM5rc.mjs";
3
+ import { renderList } from "./render-CZNR2MNK.mjs";
4
+ import "./errors-C6w1eZ1F.mjs";
5
+ import { connectionFlags, defineMetabaseCommand, listEnvelopeSchema, outputFlags, profileFlag, wrapList } from "./runtime-DR8NwmQU.mjs";
6
+ import { REMOTE_SYNC_PATHS } from "./poll-task-DdXgrDJf.mjs";
7
+ import "./poll-CxWRi3iY.mjs";
7
8
  import { z } from "zod";
8
9
 
9
10
  //#region src/commands/sync/branches.ts
@@ -1,9 +1,10 @@
1
- import "./package-t8dKf4m_.mjs";
1
+ import "./package-CVNZnqz9.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
- import { renderItem } from "./render-DlBijc5i.mjs";
4
- import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DUgFfYkN.mjs";
5
- import { REMOTE_SYNC_PATHS, SyncTask, syncTaskView } from "./poll-task-Byiunmaj.mjs";
6
- import "./poll-D2sXM5rc.mjs";
3
+ import { renderItem } from "./render-CZNR2MNK.mjs";
4
+ import "./errors-C6w1eZ1F.mjs";
5
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DR8NwmQU.mjs";
6
+ import { REMOTE_SYNC_PATHS, SyncTask, syncTaskView } from "./poll-task-DdXgrDJf.mjs";
7
+ import "./poll-CxWRi3iY.mjs";
7
8
 
8
9
  //#region src/commands/sync/cancel-task.ts
9
10
  var cancel_task_default = defineMetabaseCommand({
@@ -0,0 +1,19 @@
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-B0durHcU.mjs").then((mod) => mod.default),
11
+ get: () => import("./get-B32KbqqV.mjs").then((mod) => mod.default),
12
+ query: () => import("./query-Dnlo_5UK.mjs").then((mod) => mod.default),
13
+ create: () => import("./create-78zUdOrE.mjs").then((mod) => mod.default),
14
+ archive: () => import("./archive-t98qQCTg.mjs").then((mod) => mod.default)
15
+ }
16
+ });
17
+
18
+ //#endregion
19
+ export { card_default as default };
@@ -0,0 +1,37 @@
1
+ import "./package-CVNZnqz9.mjs";
2
+ import "./command-augment-D9pI9Vbh.mjs";
3
+ import { renderList } from "./render-CZNR2MNK.mjs";
4
+ import "./errors-C6w1eZ1F.mjs";
5
+ import { connectionFlags, defineMetabaseCommand, listEnvelopeSchema, outputFlags, profileFlag, wrapList } from "./runtime-DR8NwmQU.mjs";
6
+ import { parseId } from "./parse-id-YyyUbzvS.mjs";
7
+ import { DashboardDetail, DashcardCompact, dashcardView } from "./dashboard-DVCLGg3X.mjs";
8
+
9
+ //#region src/commands/dashboard/cards.ts
10
+ const DashcardListEnvelope = listEnvelopeSchema(DashcardCompact);
11
+ var cards_default = defineMetabaseCommand({
12
+ meta: {
13
+ name: "cards",
14
+ description: "List dashcards on a dashboard"
15
+ },
16
+ args: {
17
+ ...outputFlags,
18
+ ...profileFlag,
19
+ ...connectionFlags,
20
+ id: {
21
+ type: "positional",
22
+ description: "Dashboard id",
23
+ required: true
24
+ }
25
+ },
26
+ outputSchema: DashcardListEnvelope,
27
+ examples: ["metabase dashboard cards 1", "metabase dashboard cards 1 --json"],
28
+ async run({ args, ctx, getClient }) {
29
+ const id = parseId(args.id);
30
+ const client = await getClient();
31
+ const dashboard = await client.requestParsed(DashboardDetail, `/api/dashboard/${id}`);
32
+ renderList(wrapList(dashboard.dashcards), dashcardView, ctx);
33
+ }
34
+ });
35
+
36
+ //#endregion
37
+ export { cards_default as default };
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { package_default } from "./package-t8dKf4m_.mjs";
2
+ import { package_default } from "./package-CVNZnqz9.mjs";
3
3
  import { getMetabaseAugment } from "./command-augment-D9pI9Vbh.mjs";
4
4
  import { defineCommand, renderUsage, runMain } from "citty";
5
5
 
@@ -11,22 +11,24 @@ const main = defineCommand({
11
11
  description: package_default.description
12
12
  },
13
13
  subCommands: {
14
- auth: () => import("./auth--Hpjwlaf.mjs").then((mod) => mod.default),
15
- license: () => import("./license-DtsGJi3l.mjs").then((mod) => mod.default),
16
- db: () => import("./db-Dm2u2ISJ.mjs").then((mod) => mod.default),
17
- table: () => import("./table-D-Mb5Nvw.mjs").then((mod) => mod.default),
18
- field: () => import("./field-Dhs2AND3.mjs").then((mod) => mod.default),
19
- card: () => import("./card-D4zZSPUb.mjs").then((mod) => mod.default),
20
- transform: () => import("./transform-CqxZwhGs.mjs").then((mod) => mod.default),
21
- "transform-job": () => import("./transform-job-HjbqjEoP.mjs").then((mod) => mod.default),
22
- setting: () => import("./setting-C4vQSqer.mjs").then((mod) => mod.default),
23
- search: () => import("./search-4wKx5ug2.mjs").then((mod) => mod.default),
24
- sync: () => import("./sync-C7VOWD00.mjs").then((mod) => mod.default),
25
- workspace: () => import("./workspace-CbwR0vX_.mjs").then((mod) => mod.default),
26
- setup: () => import("./setup-Dqh9hN6l.mjs").then((mod) => mod.default),
27
- "api-key": () => import("./api-key-D9XxErQn.mjs").then((mod) => mod.default),
28
- eid: () => import("./eid-BNhutC1U.mjs").then((mod) => mod.default),
29
- __manifest: () => import("./manifest-wzEFG0JB.mjs").then((mod) => mod.createManifestCommand(main))
14
+ auth: () => import("./auth-Pmzzbl9X.mjs").then((mod) => mod.default),
15
+ license: () => import("./license-B2eNHmdg.mjs").then((mod) => mod.default),
16
+ db: () => import("./db-BNIiulL8.mjs").then((mod) => mod.default),
17
+ table: () => import("./table-CjnruP5H.mjs").then((mod) => mod.default),
18
+ field: () => import("./field-D9nztsQP.mjs").then((mod) => mod.default),
19
+ card: () => import("./card-CY60jlXc.mjs").then((mod) => mod.default),
20
+ dashboard: () => import("./dashboard-BVEiysxL.mjs").then((mod) => mod.default),
21
+ transform: () => import("./transform-BXF9B-hF.mjs").then((mod) => mod.default),
22
+ "transform-job": () => import("./transform-job-DDsjt-4N.mjs").then((mod) => mod.default),
23
+ setting: () => import("./setting-DEhllKkK.mjs").then((mod) => mod.default),
24
+ search: () => import("./search-0cjOmsQu.mjs").then((mod) => mod.default),
25
+ sync: () => import("./sync-BZPts11d.mjs").then((mod) => mod.default),
26
+ workspace: () => import("./workspace-Bv7qoaJi.mjs").then((mod) => mod.default),
27
+ setup: () => import("./setup-BYL5Yagu.mjs").then((mod) => mod.default),
28
+ "api-key": () => import("./api-key-U35bYysN.mjs").then((mod) => mod.default),
29
+ eid: () => import("./eid-CLOyMi0C.mjs").then((mod) => mod.default),
30
+ query: () => import("./query-DmeLeLlh.mjs").then((mod) => mod.default),
31
+ __manifest: () => import("./manifest-IMg51yb7.mjs").then((mod) => mod.createManifestCommand(main))
30
32
  }
31
33
  });
32
34
  var main_default = main;
@@ -0,0 +1,48 @@
1
+ import "./package-CVNZnqz9.mjs";
2
+ import "./command-augment-D9pI9Vbh.mjs";
3
+ import { renderItem } from "./render-CZNR2MNK.mjs";
4
+ import "./errors-C6w1eZ1F.mjs";
5
+ import "./input-DkgCMNA9.mjs";
6
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DR8NwmQU.mjs";
7
+ import { readBody } from "./body-qjVMvNjF.mjs";
8
+ import { bodyInputFlags } from "./body-flags-BK7J6Daz.mjs";
9
+ import { Card, CardCreateInput, cardView } from "./card-2XdaHHSS.mjs";
10
+ import { preflightInternalMbql5Query, skipValidateFlag } from "./validate-query-DE4UouY3.mjs";
11
+
12
+ //#region src/commands/card/create.ts
13
+ var create_default = defineMetabaseCommand({
14
+ meta: {
15
+ name: "create",
16
+ description: "Create a card from a JSON spec; if dataset_query is MBQL 5 (lib/type: mbql/query) it is pre-flight-validated against the same schema as `metabase query` (see `metabase query --print-schema`)"
17
+ },
18
+ args: {
19
+ ...outputFlags,
20
+ ...profileFlag,
21
+ ...connectionFlags,
22
+ ...bodyInputFlags,
23
+ ...skipValidateFlag
24
+ },
25
+ outputSchema: Card,
26
+ examples: [
27
+ "cat card.json | metabase card create",
28
+ "metabase card create --file card.json",
29
+ "metabase card create --body '{\"name\":\"x\",\"display\":\"table\",\"dataset_query\":{...},\"visualization_settings\":{}}'",
30
+ "metabase card create --file card.json --skip-validate"
31
+ ],
32
+ async run({ args, ctx, getClient }) {
33
+ const body = await readBody({
34
+ flag: args.body,
35
+ file: args.file
36
+ }, CardCreateInput);
37
+ preflightInternalMbql5Query(body.dataset_query, "card.dataset_query validation failed", { skip: args["skip-validate"] === true });
38
+ const client = await getClient();
39
+ const created = await client.requestParsed(Card, "/api/card", {
40
+ method: "POST",
41
+ body
42
+ });
43
+ renderItem(created, cardView, ctx);
44
+ }
45
+ });
46
+
47
+ //#endregion
48
+ export { create_default as default };
@@ -1,11 +1,12 @@
1
- import "./package-t8dKf4m_.mjs";
1
+ import "./package-CVNZnqz9.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
- import { renderItem } from "./render-DlBijc5i.mjs";
4
- import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DUgFfYkN.mjs";
5
- import "./input-BNqSFl38.mjs";
6
- import { readBody } from "./body-DwU2s6Pg.mjs";
7
- import { bodyInputFlags } from "./body-flags-7oqLhu5j.mjs";
8
- import { TransformJob, TransformJobCreateInput, transformJobView } from "./transform-job-DuB_OjhO.mjs";
3
+ import { renderItem } from "./render-CZNR2MNK.mjs";
4
+ import "./errors-C6w1eZ1F.mjs";
5
+ import "./input-DkgCMNA9.mjs";
6
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DR8NwmQU.mjs";
7
+ import { readBody } from "./body-qjVMvNjF.mjs";
8
+ import { bodyInputFlags } from "./body-flags-BK7J6Daz.mjs";
9
+ import { TransformJob, TransformJobCreateInput, transformJobView } from "./transform-job-BtCoVYsb.mjs";
9
10
 
10
11
  //#region src/commands/transform-job/create.ts
11
12
  var create_default = defineMetabaseCommand({
@@ -0,0 +1,44 @@
1
+ import "./package-CVNZnqz9.mjs";
2
+ import "./command-augment-D9pI9Vbh.mjs";
3
+ import { renderItem } from "./render-CZNR2MNK.mjs";
4
+ import "./errors-C6w1eZ1F.mjs";
5
+ import "./input-DkgCMNA9.mjs";
6
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DR8NwmQU.mjs";
7
+ import { readBody } from "./body-qjVMvNjF.mjs";
8
+ import { bodyInputFlags } from "./body-flags-BK7J6Daz.mjs";
9
+ import { Dashboard, DashboardCreateInput, dashboardView } from "./dashboard-DVCLGg3X.mjs";
10
+
11
+ //#region src/commands/dashboard/create.ts
12
+ var create_default = defineMetabaseCommand({
13
+ meta: {
14
+ name: "create",
15
+ description: "Create a dashboard from a JSON spec"
16
+ },
17
+ args: {
18
+ ...outputFlags,
19
+ ...profileFlag,
20
+ ...connectionFlags,
21
+ ...bodyInputFlags
22
+ },
23
+ outputSchema: Dashboard,
24
+ examples: [
25
+ "cat dashboard.json | metabase dashboard create",
26
+ "metabase dashboard create --file dashboard.json",
27
+ "metabase dashboard create --body '{\"name\":\"My Dashboard\",\"collection_id\":4}'"
28
+ ],
29
+ async run({ args, ctx, getClient }) {
30
+ const body = await readBody({
31
+ flag: args.body,
32
+ file: args.file
33
+ }, DashboardCreateInput);
34
+ const client = await getClient();
35
+ const created = await client.requestParsed(Dashboard, "/api/dashboard", {
36
+ method: "POST",
37
+ body
38
+ });
39
+ renderItem(created, dashboardView, ctx);
40
+ }
41
+ });
42
+
43
+ //#endregion
44
+ export { create_default as default };
@@ -0,0 +1,47 @@
1
+ import "./package-CVNZnqz9.mjs";
2
+ import "./command-augment-D9pI9Vbh.mjs";
3
+ import { renderItem } from "./render-CZNR2MNK.mjs";
4
+ import "./errors-C6w1eZ1F.mjs";
5
+ import "./input-DkgCMNA9.mjs";
6
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DR8NwmQU.mjs";
7
+ import { readBody } from "./body-qjVMvNjF.mjs";
8
+ import { bodyInputFlags } from "./body-flags-BK7J6Daz.mjs";
9
+ import { preflightInternalMbql5Query, skipValidateFlag } from "./validate-query-DE4UouY3.mjs";
10
+ import { Transform, TransformCreateInput, transformView } from "./transform-CRRW0mFp.mjs";
11
+
12
+ //#region src/commands/transform/create.ts
13
+ var create_default = defineMetabaseCommand({
14
+ meta: {
15
+ name: "create",
16
+ description: "Create a transform; if source.type is `query` and source.query is MBQL 5 (lib/type: mbql/query) it is pre-flight-validated against the same schema as `metabase query` (see `metabase query --print-schema`)"
17
+ },
18
+ args: {
19
+ ...outputFlags,
20
+ ...profileFlag,
21
+ ...connectionFlags,
22
+ ...bodyInputFlags,
23
+ ...skipValidateFlag
24
+ },
25
+ outputSchema: Transform,
26
+ examples: [
27
+ "cat transform.json | metabase transform create",
28
+ "metabase transform create --file transform.json",
29
+ "metabase transform create --file transform.json --skip-validate"
30
+ ],
31
+ async run({ args, ctx, getClient }) {
32
+ const body = await readBody({
33
+ flag: args.body,
34
+ file: args.file
35
+ }, TransformCreateInput);
36
+ if (body.source.type === "query") preflightInternalMbql5Query(body.source.query, "transform.source.query validation failed", { skip: args["skip-validate"] === true });
37
+ const client = await getClient();
38
+ const created = await client.requestParsed(Transform, "/api/transform", {
39
+ method: "POST",
40
+ body
41
+ });
42
+ renderItem(created, transformView, ctx);
43
+ }
44
+ });
45
+
46
+ //#endregion
47
+ export { create_default as default };
@@ -1,11 +1,12 @@
1
- import "./package-t8dKf4m_.mjs";
1
+ import "./package-CVNZnqz9.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
- import { renderItem } from "./render-DlBijc5i.mjs";
4
- import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DUgFfYkN.mjs";
5
- import "./input-BNqSFl38.mjs";
6
- import { readBody } from "./body-DwU2s6Pg.mjs";
7
- import { bodyInputFlags } from "./body-flags-7oqLhu5j.mjs";
8
- import { Workspace, WorkspaceCreateInput, workspaceView } from "./workspace-Dr9lWU3D.mjs";
3
+ import { renderItem } from "./render-CZNR2MNK.mjs";
4
+ import "./errors-C6w1eZ1F.mjs";
5
+ import "./input-DkgCMNA9.mjs";
6
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DR8NwmQU.mjs";
7
+ import { readBody } from "./body-qjVMvNjF.mjs";
8
+ import { bodyInputFlags } from "./body-flags-BK7J6Daz.mjs";
9
+ import { Workspace, WorkspaceCreateInput, workspaceView } from "./workspace-C3tGVQ6_.mjs";
9
10
 
10
11
  //#region src/commands/workspace/create.ts
11
12
  var create_default = defineMetabaseCommand({
@@ -1,9 +1,10 @@
1
- import "./package-t8dKf4m_.mjs";
1
+ import "./package-CVNZnqz9.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
- import { renderItem } from "./render-DlBijc5i.mjs";
4
- import { ConfigError, connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DUgFfYkN.mjs";
5
- import { REMOTE_SYNC_PATHS } from "./poll-task-Byiunmaj.mjs";
6
- import "./poll-D2sXM5rc.mjs";
3
+ import { renderItem } from "./render-CZNR2MNK.mjs";
4
+ import { ConfigError } from "./errors-C6w1eZ1F.mjs";
5
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DR8NwmQU.mjs";
6
+ import { REMOTE_SYNC_PATHS } from "./poll-task-DdXgrDJf.mjs";
7
+ import "./poll-CxWRi3iY.mjs";
7
8
  import { z } from "zod";
8
9
 
9
10
  //#region src/commands/sync/create-branch.ts
@@ -1,12 +1,13 @@
1
- import "./package-t8dKf4m_.mjs";
1
+ import "./package-CVNZnqz9.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
- import { renderItem } from "./render-DlBijc5i.mjs";
4
- import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DUgFfYkN.mjs";
5
- import "./input-BNqSFl38.mjs";
6
- import { readBody } from "./body-DwU2s6Pg.mjs";
7
- import { bodyInputFlags } from "./body-flags-7oqLhu5j.mjs";
8
- import { requireBothOrNeither } from "./flag-pair-CWvvzDJ_.mjs";
9
- import { parseId } from "./parse-id-C1prc9US.mjs";
3
+ import { renderItem } from "./render-CZNR2MNK.mjs";
4
+ import "./errors-C6w1eZ1F.mjs";
5
+ import "./input-DkgCMNA9.mjs";
6
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DR8NwmQU.mjs";
7
+ import { readBody } from "./body-qjVMvNjF.mjs";
8
+ import { bodyInputFlags } from "./body-flags-BK7J6Daz.mjs";
9
+ import { requireBothOrNeither } from "./flag-pair-Dz-mbq0z.mjs";
10
+ import { parseId } from "./parse-id-YyyUbzvS.mjs";
10
11
  import { z } from "zod";
11
12
 
12
13
  //#region src/domain/api-key.ts
@@ -1,11 +1,12 @@
1
- import "./package-t8dKf4m_.mjs";
1
+ import "./package-CVNZnqz9.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
- import { renderItem } from "./render-DlBijc5i.mjs";
4
- import { defineMetabaseCommand, localUrl, outputFlags, parseJson } from "./runtime-DUgFfYkN.mjs";
5
- import { parseId } from "./parse-id-C1prc9US.mjs";
6
- import "./poll-D2sXM5rc.mjs";
7
- import { checkDockerReady, readContainerCredentialsFile, requireWorkspaceContainerLocation } from "./docker-QWVMG2gl.mjs";
8
- import { WorkspaceCredentials } from "./workspace-credentials-q5RRFMT8.mjs";
3
+ import { renderItem } from "./render-CZNR2MNK.mjs";
4
+ import "./errors-C6w1eZ1F.mjs";
5
+ import { defineMetabaseCommand, localUrl, outputFlags, parseJson } from "./runtime-DR8NwmQU.mjs";
6
+ import { parseId } from "./parse-id-YyyUbzvS.mjs";
7
+ import "./poll-CxWRi3iY.mjs";
8
+ import { checkDockerReady, readContainerCredentialsFile, requireWorkspaceContainerLocation } from "./docker-D2GAMpHR.mjs";
9
+ import { WorkspaceCredentials } from "./workspace-credentials-BxrU2xZb.mjs";
9
10
  import { z } from "zod";
10
11
 
11
12
  //#region src/commands/workspace/credentials.ts
@@ -1,9 +1,10 @@
1
- import "./package-t8dKf4m_.mjs";
1
+ import "./package-CVNZnqz9.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
- import { renderItem } from "./render-DlBijc5i.mjs";
4
- import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DUgFfYkN.mjs";
5
- import { SyncTaskOrIdle, fetchCurrentTask, syncTaskIdleView, syncTaskView } from "./poll-task-Byiunmaj.mjs";
6
- import "./poll-D2sXM5rc.mjs";
3
+ import { renderItem } from "./render-CZNR2MNK.mjs";
4
+ import "./errors-C6w1eZ1F.mjs";
5
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DR8NwmQU.mjs";
6
+ import { SyncTaskOrIdle, fetchCurrentTask, syncTaskIdleView, syncTaskView } from "./poll-task-DdXgrDJf.mjs";
7
+ import "./poll-CxWRi3iY.mjs";
7
8
 
8
9
  //#region src/commands/sync/current-task.ts
9
10
  const CurrentTaskResult = SyncTaskOrIdle;
@@ -0,0 +1,20 @@
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-AcUuhDxS.mjs").then((mod) => mod.default),
11
+ get: () => import("./get-qXYTmiCW.mjs").then((mod) => mod.default),
12
+ cards: () => import("./cards-CvXNClLR.mjs").then((mod) => mod.default),
13
+ create: () => import("./create-CT8GaHhd.mjs").then((mod) => mod.default),
14
+ update: () => import("./update-CLXVmkyr.mjs").then((mod) => mod.default),
15
+ "update-dashcard": () => import("./update-dashcard-BSf1-SfK.mjs").then((mod) => mod.default)
16
+ }
17
+ });
18
+
19
+ //#endregion
20
+ export { dashboard_default as default };