@metabase/cli 0.1.0-alpha.workspaces-commands.c1d5eea → 0.1.0-alpha.workspaces-commands.d9c31ec

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 (189) hide show
  1. package/README.md +121 -100
  2. package/dist/{add-collection-Dsju7qPh.mjs → add-collection-8GuI25VU.mjs} +6 -6
  3. package/dist/add-collection-Dy0OMhKh.mjs +11 -0
  4. package/dist/{api-key-BU8wdQsz.mjs → api-key-bpZ0_40D.mjs} +1 -1
  5. package/dist/{archive-Dc8Ob7X2.mjs → archive-BAaYDw3P.mjs} +6 -6
  6. package/dist/{archive-C9nd1_nR.mjs → archive-BhqpKCm3.mjs} +7 -7
  7. package/dist/{archive-CT0qt-5r.mjs → archive-C17bfUgD.mjs} +6 -6
  8. package/dist/{archive-coFyGzcm.mjs → archive-Ci_l9wTo.mjs} +7 -7
  9. package/dist/auth-B2WfejxA.mjs +19 -0
  10. package/dist/{body-CFl-TxuS.mjs → body-DTkC7hZO.mjs} +3 -3
  11. package/dist/{branches-D84zM_wy.mjs → branches-CnlppPuF.mjs} +8 -8
  12. package/dist/{cancel-DbvPIFvO.mjs → cancel-CoZbsyqE.mjs} +5 -5
  13. package/dist/{cancel-task-CgdIriIr.mjs → cancel-task-VKO9ybMn.mjs} +9 -9
  14. package/dist/{card-BOGKT258.mjs → card-B2ZlGpQP.mjs} +3 -2
  15. package/dist/card-BgsQATFn.mjs +20 -0
  16. package/dist/{cards-Dfito_3s.mjs → cards-BLaa40uq.mjs} +6 -6
  17. package/dist/cli.mjs +24 -24
  18. package/dist/collection-wYJz_mCI.mjs +19 -0
  19. package/dist/{create-DbCWjP7O.mjs → create-1MX0T09Q.mjs} +8 -8
  20. package/dist/{create-B8-zmzDZ.mjs → create-B1NpGekI.mjs} +7 -7
  21. package/dist/{create-C45EtiVU.mjs → create-BJLX_cZo.mjs} +10 -9
  22. package/dist/{create-C9qNOUXt.mjs → create-CJxCVV2H.mjs} +24 -16
  23. package/dist/create-CRwWU9Pt.mjs +48 -0
  24. package/dist/{create-B0TZE4Hr.mjs → create-CVWAZRMp.mjs} +7 -7
  25. package/dist/{create-D2kaDG42.mjs → create-D3B8Fp4j.mjs} +7 -7
  26. package/dist/{create-D8iPEfcs.mjs → create-D3Ov4MEg.mjs} +10 -9
  27. package/dist/create-DnpGQ53I.mjs +48 -0
  28. package/dist/{create-branch-BHj7sWkz.mjs → create-branch-D3jzZxC4.mjs} +9 -9
  29. package/dist/{create-DdloUQrd.mjs → create-wWiNTJLy.mjs} +7 -7
  30. package/dist/{credentials-BXeWvbXs.mjs → credentials-DbTDsBkj.mjs} +8 -8
  31. package/dist/{current-task-t3ZYfeDJ.mjs → current-task-Bfhc8LzZ.mjs} +9 -9
  32. package/dist/dashboard-DICdcfPK.mjs +20 -0
  33. package/dist/{database-GbK7OAPX.mjs → database-DzcFix9u.mjs} +1 -1
  34. package/dist/{database-CCEjHEhb.mjs → database-ES40jkkB.mjs} +3 -3
  35. package/dist/db-CMrQrcFi.mjs +22 -0
  36. package/dist/{delete-BXnoOVMK.mjs → delete-B_pJNwBp.mjs} +7 -7
  37. package/dist/{delete-BgeI7Wzb.mjs → delete-hf1Mi3qy.mjs} +7 -7
  38. package/dist/{delete-runtime-CuaZEfPZ.mjs → delete-runtime-BMzvfj_B.mjs} +2 -2
  39. package/dist/{delete-table-Ba7JKvh7.mjs → delete-table-0sArY7go.mjs} +7 -7
  40. package/dist/{deprovision-DCtUz-YU.mjs → deprovision-DpmNjEEy.mjs} +11 -11
  41. package/dist/{dirty-2JmT5pZg.mjs → dirty-DiXL5WlS.mjs} +8 -8
  42. package/dist/{docker-DOCqIlti.mjs → docker-B-ckbz3m.mjs} +3 -3
  43. package/dist/{eid-CKrpg4jn.mjs → eid-bTxWg-gM.mjs} +1 -1
  44. package/dist/{export-CvPiPcDh.mjs → export-BzUsvMov.mjs} +11 -11
  45. package/dist/field-jFWcinu2.mjs +18 -0
  46. package/dist/{fields-CNaifB7g.mjs → fields-DET7ptiD.mjs} +7 -7
  47. package/dist/{flag-pair-DYOzdz6v.mjs → flag-pair-DtR1AiBQ.mjs} +1 -1
  48. package/dist/{get-CKkv8r_u.mjs → get-BECueuy8.mjs} +6 -6
  49. package/dist/{get-Bct3EBkp.mjs → get-BlYCHIJW.mjs} +6 -6
  50. package/dist/{get-CxmSDkJe.mjs → get-CELbZWrF.mjs} +6 -6
  51. package/dist/{get-DGmhriFO.mjs → get-CoFWjiiZ.mjs} +6 -6
  52. package/dist/{get-wC3HYX_n.mjs → get-Cu1nkuao.mjs} +8 -8
  53. package/dist/{get-DZ_tRfsn.mjs → get-D5jlfcMf.mjs} +6 -6
  54. package/dist/{get-D9OZkrQu.mjs → get-DGcusTgD.mjs} +6 -6
  55. package/dist/{get-Cp9pmC6J.mjs → get-DV1XjM5s.mjs} +6 -6
  56. package/dist/{get-Dyd0ggJ7.mjs → get-DbYGYs5c.mjs} +6 -6
  57. package/dist/get-Dm6Vm-8-.mjs +53 -0
  58. package/dist/{get-BHJt6xei.mjs → get-MHbeOynz.mjs} +6 -6
  59. package/dist/{get-run-DJDdFhZY.mjs → get-run-7hO_vClh.mjs} +6 -6
  60. package/dist/{get-Cc9CcZiV.mjs → get-ylnDN2Q8.mjs} +6 -6
  61. package/dist/{has-remote-changes-CIjJIIA-.mjs → has-remote-changes-DFARAyMl.mjs} +8 -8
  62. package/dist/{import-BdsWGGbT.mjs → import-CNi5I2EU.mjs} +11 -11
  63. package/dist/{input-fYkvqiUd.mjs → input-ikCiip6x.mjs} +1 -1
  64. package/dist/is-dirty-BFjDV_iH.mjs +10 -0
  65. package/dist/{is-dirty-CsqnEo7_.mjs → is-dirty-CPhiqe85.mjs} +5 -5
  66. package/dist/{items-CTpGfbiu.mjs → items-XPGeJSJ9.mjs} +8 -8
  67. package/dist/{key-Bb5PjkM7.mjs → key-NDEARu2L.mjs} +1 -1
  68. package/dist/{license-BG03M-I2.mjs → license-CBNy8WgI.mjs} +3 -3
  69. package/dist/{list-CHF7sQ6x.mjs → list-6myIKQLr.mjs} +4 -4
  70. package/dist/{list-C7lMxzzh.mjs → list-B-iAfasr.mjs} +5 -5
  71. package/dist/{list-E6wvq_SF.mjs → list-B15hTiuw.mjs} +5 -5
  72. package/dist/{list-CDZNFzoF.mjs → list-BGL8Z1JR.mjs} +5 -5
  73. package/dist/{list-lWJ2zBMg.mjs → list-BNtqsWab.mjs} +7 -7
  74. package/dist/{list-DS9R5u1C.mjs → list-BnRnm1Is.mjs} +5 -5
  75. package/dist/{list-D9ivyQsr.mjs → list-BoTtrGX2.mjs} +7 -7
  76. package/dist/{list-MDYtjA1Q.mjs → list-CrhFq5TH.mjs} +5 -5
  77. package/dist/{list-DcBCPK2O.mjs → list-D71fmTpn.mjs} +5 -5
  78. package/dist/{list-DWY1uNjV.mjs → list-DRBrOPpS.mjs} +5 -5
  79. package/dist/{list-CooT7UU7.mjs → list-DyBGj4yk.mjs} +5 -5
  80. package/dist/{list-DcnNRz2P.mjs → list-YXpUzQCL.mjs} +5 -5
  81. package/dist/{list-CdGj-vuH.mjs → list-ytrd005Z.mjs} +5 -5
  82. package/dist/{login-CXp0bxaB.mjs → login-BBHhoDPM.mjs} +6 -6
  83. package/dist/{logout-CnFQsbEt.mjs → logout-DMZkFSrC.mjs} +5 -5
  84. package/dist/{logs-1FNWPS2k.mjs → logs-Dusp0eIR.mjs} +6 -6
  85. package/dist/{manifest-CNNRftoC.mjs → manifest-VVjycZCe.mjs} +2 -2
  86. package/dist/measure-ol3ZlXbc.mjs +19 -0
  87. package/dist/{metadata-Cj9U2Vm6.mjs → metadata-BEPQuzQx.mjs} +8 -8
  88. package/dist/{metadata-CCE5TQqV.mjs → metadata-D1hGZxVH.mjs} +7 -7
  89. package/dist/{package-CbQKObcX.mjs → package-DwhGofpM.mjs} +1 -1
  90. package/dist/{paginate-CnTxzOh2.mjs → paginate-B9W7ZuBj.mjs} +2 -2
  91. package/dist/{parse-id-BgFi3UCN.mjs → parse-id-Di-wVtcP.mjs} +1 -1
  92. package/dist/{parse-ref-CzHgk0Hw.mjs → parse-ref-FBB8uGZw.mjs} +1 -1
  93. package/dist/{parse-schemas-CeeVtFhy.mjs → parse-schemas-DoQyoqgX.mjs} +2 -2
  94. package/dist/{poll-D1ZjdFr1.mjs → poll-BHFOOAGq.mjs} +2 -2
  95. package/dist/{poll-task-BP37zYAf.mjs → poll-task-CQ0jyN9p.mjs} +4 -4
  96. package/dist/{errors-CkVGRHrW.mjs → predicates-DiIiS3k7.mjs} +50 -7
  97. package/dist/preflight-7VrJgXMP.mjs +91 -0
  98. package/dist/{prompt-BiJFbHAV.mjs → prompt-Bf3DQ-qE.mjs} +1 -1
  99. package/dist/{provision-CAHqCCqN.mjs → provision-ChB9o8Vo.mjs} +12 -12
  100. package/dist/ps-D9xB9Ozi.mjs +10 -0
  101. package/dist/{ps-Csbckpzy.mjs → ps-DWjsRdjB.mjs} +3 -3
  102. package/dist/{query-DRkBg3wV.mjs → query-DLQsi5fQ.mjs} +6 -6
  103. package/dist/query-Xy_Hg05O.mjs +89 -0
  104. package/dist/remote-sync-C7sgxp7Q.mjs +28 -0
  105. package/dist/{remove-B8OV41WP.mjs → remove-Cw_fznOe.mjs} +5 -5
  106. package/dist/{remove-Cvk6y8BI.mjs → remove-DDmdEMUN.mjs} +8 -8
  107. package/dist/{remove-collection-Bm4M_Yss.mjs → remove-collection-CXSYFReG.mjs} +10 -10
  108. package/dist/{render-BblMa0Cg.mjs → render-DXv-D6fU.mjs} +2 -8
  109. package/dist/{rescan-values-CTN1kQ42.mjs → rescan-values-8gedBuRt.mjs} +8 -8
  110. package/dist/{run-G0ID7yHo.mjs → run-DiCxS7XF.mjs} +8 -8
  111. package/dist/{runs-DQwkAOj6.mjs → runs-BRZx2sjg.mjs} +7 -7
  112. package/dist/{runtime-DcczfJol.mjs → runtime-BY0yq43g.mjs} +59 -10
  113. package/dist/{schema-tables-kIynp5bQ.mjs → schema-tables-C2I8G64H.mjs} +7 -7
  114. package/dist/{schemas-CFFB2zpA.mjs → schemas-6OCy-dtZ.mjs} +5 -5
  115. package/dist/{search-GxIXyy0y.mjs → search-CADCabkh.mjs} +5 -5
  116. package/dist/segment-CGFQ7DQW.mjs +19 -0
  117. package/dist/{set-LivrVQWS.mjs → set-BvyvNejO.mjs} +6 -6
  118. package/dist/{set-Dw4chkYT.mjs → set-Ds3IVECR.mjs} +8 -8
  119. package/dist/{setting-DLkszd2Z.mjs → setting-BTgMc8H8.mjs} +3 -3
  120. package/dist/{setup-SjNjs7J0.mjs → setup-CCm7U1YU.mjs} +6 -6
  121. package/dist/snippet-DyoeUSIZ.mjs +19 -0
  122. package/dist/{start-3g0bvGr4.mjs → start-DrUCVDmu.mjs} +9 -9
  123. package/dist/{stash-DYIChkiQ.mjs → stash-BLRsdgxP.mjs} +9 -9
  124. package/dist/{status-DIaoIXv-.mjs → status-B4LY0-fS.mjs} +4 -4
  125. package/dist/{status-CK5qyGY4.mjs → status-Vc-Z4igY.mjs} +10 -10
  126. package/dist/{status-B72bjG8r.mjs → status-pFVwQsTF.mjs} +4 -4
  127. package/dist/{stop-Cjfs6eSc.mjs → stop-DsfVFTVy.mjs} +8 -8
  128. package/dist/{summary-ejyOKb2m.mjs → summary-M5WC7ttj.mjs} +6 -6
  129. package/dist/{sync-schema-BS5iqwmO.mjs → sync-schema-CkEohTrp.mjs} +8 -8
  130. package/dist/table-BXKV-RRl.mjs +19 -0
  131. package/dist/{table-DhB2_Dxd.mjs → table-Ck9sInse.mjs} +2 -2
  132. package/dist/transform-1rvuoPJE.mjs +24 -0
  133. package/dist/transform-job-ajyQmW3Z.mjs +19 -0
  134. package/dist/{translate-Btcr7JM7.mjs → translate-CtA59uzV.mjs} +7 -7
  135. package/dist/{tree-Bee3n9O2.mjs → tree-I_YkLcUL.mjs} +5 -5
  136. package/dist/{update-6Ng7wDHI.mjs → update-CADTPRV7.mjs} +12 -12
  137. package/dist/{update-CykTg7dz.mjs → update-COd94eCd.mjs} +8 -8
  138. package/dist/{update-ClOXgd6r.mjs → update-Cs8XYPu0.mjs} +13 -9
  139. package/dist/{update-CFsK-l0O.mjs → update-DGVAW1mn.mjs} +15 -10
  140. package/dist/{update-BGu-Xfs9.mjs → update-DU9fChpu.mjs} +11 -10
  141. package/dist/{update-BVnKMYi-.mjs → update-DppEfL1x.mjs} +9 -9
  142. package/dist/{update-FUHQBhNl.mjs → update-DwJ3NPY1.mjs} +11 -10
  143. package/dist/{update-YOvftU-I.mjs → update-HGyNITdd.mjs} +8 -8
  144. package/dist/{update-CudF7SIR.mjs → update-REiXbF-2.mjs} +15 -10
  145. package/dist/{update-dashcard--VnK1rU9.mjs → update-dashcard-D_AZjssC.mjs} +8 -8
  146. package/dist/{update-DuX9MHHw.mjs → update-jt_ybR9D.mjs} +8 -8
  147. package/dist/{url-MwoX0YYz.mjs → url-mxsHGJy8.mjs} +7 -7
  148. package/dist/{uuid-DUBsfCMS.mjs → uuid-Dz2jp9kb.mjs} +4 -4
  149. package/dist/{validate-query-VseSssGt.mjs → validate-GPoiblzw.mjs} +23 -125
  150. package/dist/validate-query-DQDzQCQv.mjs +37 -0
  151. package/dist/{values-DAPG4o1b.mjs → values-D0wz8xUT.mjs} +6 -6
  152. package/dist/{wait-ByIaTJfE.mjs → wait-B2wti_nF.mjs} +10 -10
  153. package/dist/{wait-B4MBOMM1.mjs → wait-BvriwUjY.mjs} +2 -2
  154. package/dist/{wait-flags-Cq5-5h6t.mjs → wait-flags-fyZuPGaW.mjs} +2 -2
  155. package/dist/workspace-Bj2YBuLj.mjs +24 -0
  156. package/dist/{workspace-credentials-Sl-qjCOb.mjs → workspace-credentials-B6BL-X0d.mjs} +1 -1
  157. package/package.json +1 -1
  158. package/dist/add-collection-D3o3iuV6.mjs +0 -11
  159. package/dist/auth-DDWFPOHE.mjs +0 -19
  160. package/dist/card-BLpzPLLD.mjs +0 -20
  161. package/dist/collection-BGMj95CP.mjs +0 -19
  162. package/dist/create-Cx6hzotV.mjs +0 -40
  163. package/dist/create-PWrAe2aX.mjs +0 -40
  164. package/dist/dashboard-nJ1dwYuB.mjs +0 -20
  165. package/dist/db-BKNI64nZ.mjs +0 -22
  166. package/dist/field-DGy3BZhm.mjs +0 -18
  167. package/dist/get-CQEYcyoK.mjs +0 -37
  168. package/dist/is-dirty-DW1j1P0B.mjs +0 -10
  169. package/dist/measure-qkBiyAN-.mjs +0 -19
  170. package/dist/ps-CmV4Fw-U.mjs +0 -10
  171. package/dist/query-vW-ws-hr.mjs +0 -93
  172. package/dist/segment-DLvpwQyO.mjs +0 -19
  173. package/dist/snippet-DLHBijDM.mjs +0 -19
  174. package/dist/sync-D3wsCLfY.mjs +0 -28
  175. package/dist/table-DHFb9SJU.mjs +0 -19
  176. package/dist/transform-DzEnER7v.mjs +0 -24
  177. package/dist/transform-job-CNNY-VWb.mjs +0 -19
  178. package/dist/workspace-CXHVXWXa.mjs +0 -24
  179. /package/dist/{collection-KWd1KZUC.mjs → collection-DFqH6N7s.mjs} +0 -0
  180. /package/dist/{dashboard-CztCJxke.mjs → dashboard-DyrRSbqQ.mjs} +0 -0
  181. /package/dist/{field-BakUM_Le.mjs → field-D6CJbmAR.mjs} +0 -0
  182. /package/dist/{measure-B1GKcZxO.mjs → measure-jbc7fsCs.mjs} +0 -0
  183. /package/dist/{revision-message-flag-BJiGjb5m.mjs → revision-message-flag-D4E1lKE5.mjs} +0 -0
  184. /package/dist/{segment-CQ5w3M_W.mjs → segment-BMrUBz94.mjs} +0 -0
  185. /package/dist/{setting-DIXJ2haa.mjs → setting-CTaAeMci.mjs} +0 -0
  186. /package/dist/{snippet-DRTklDg3.mjs → snippet-Dw0Sjzkr.mjs} +0 -0
  187. /package/dist/{transform-92odFxg-.mjs → transform-IEX4Mx3X.mjs} +0 -0
  188. /package/dist/{transform-job-DgApCViL.mjs → transform-job-DZ38Xc3k.mjs} +0 -0
  189. /package/dist/{workspace-C5FVNshq.mjs → workspace-jfsegcq8.mjs} +0 -0
package/README.md CHANGED
@@ -271,39 +271,42 @@ metabase transform-job delete 1 --yes
271
271
 
272
272
  ## Databases
273
273
 
274
- Read warehouse metadata from `/api/database`. The `db` group exposes the full database list, the per-database record, hydrated metadata (tables + fields rolled up in one response), schema and table inspection, and the two manual-sync triggers.
274
+ Read warehouse metadata from `/api/database`. The `db` group exposes the full database list, the per-database record, schema and table inspection, the two manual-sync triggers, and (rarely useful) full-warehouse rollup endpoints.
275
275
 
276
276
  `db` is aliased to `database`.
277
277
 
278
+ > **Agent traversal:** prefer the granular path — `db list` → `db schemas <db-id>` → `db schema-tables <db-id> <schema>` → `table get <table-id> --include fields`. On a real warehouse (dozens of schemas, hundreds of tables, dozens of fields per table) the rollup commands (`db metadata`, `db get --include tables.fields`, `db list --include tables`) return megabytes of JSON and exhaust the agent context. Reach for them only on small/dev warehouses where you know the size up front.
279
+
278
280
  ### `metabase db list`
279
281
 
280
282
  ```sh
281
283
  metabase db list
282
284
  metabase db list --json
283
- metabase db list --include tables --full --json
284
285
  metabase db list --saved --json
286
+ metabase db list --include tables --full --json # rollup: every db with its full table list
285
287
  ```
286
288
 
287
- | Flag | Description |
288
- | ------------------- | ------------------------------------------------------------------------------------------------------------- |
289
- | `--include <which>` | Hydrate related entities. Currently only `tables` is supported (each database is returned with its `tables`). |
290
- | `--saved` | Include the Saved Questions virtual database in the list. The virtual db has id `-1337` and no `engine`. |
289
+ | Flag | Description |
290
+ | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
291
+ | `--include <which>` | Hydrate related entities. Currently only `tables` is supported (each database is returned with its `tables`). On real warehouses this returns hundreds of table records per db — use the granular traversal instead. |
292
+ | `--saved` | Include the Saved Questions virtual database in the list. The virtual db has id `-1337` and no `engine`. |
291
293
 
292
294
  ### `metabase db get <id>`
293
295
 
294
296
  ```sh
295
297
  metabase db get 1
296
298
  metabase db get 1 --json
297
- metabase db get 1 --include tables.fields --full --json
299
+ metabase db get 1 --include tables --full --json # rollup: db + every table (compact)
300
+ metabase db get 1 --include tables.fields --full --json # rollup: db + every table + every field
298
301
  ```
299
302
 
300
- | Flag | Description |
301
- | ------------------- | ------------------------------------------------------------- |
302
- | `--include <which>` | Hydrate related entities. One of `tables` or `tables.fields`. |
303
+ | Flag | Description |
304
+ | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
305
+ | `--include <which>` | Hydrate related entities. One of `tables` or `tables.fields`. `tables.fields` returns every column of every table in the database in one response — only safe on small/dev warehouses. For a real warehouse use `db schemas` → `db schema-tables` → `table get --include fields`. |
303
306
 
304
307
  ### `metabase db metadata <id>`
305
308
 
306
- Equivalent to `GET /api/database/:id/metadata`: a single database with all its tables and fields rolled up in one response. Use this when an agent needs a one-shot warehouse introspection rather than the per-table `metabase table get --full`.
309
+ Equivalent to `GET /api/database/:id/metadata`: a single database with all its tables and fields rolled up in one response. This is the largest read in the `db` group — on a real warehouse the response will exceed the agent context. Use only when you know the database is small (a seeded dev instance, a sample db, a freshly-bootstrapped test fixture). For agent-driven introspection on a real warehouse, walk `db schemas` → `db schema-tables` `table get --include fields` instead.
307
310
 
308
311
  ```sh
309
312
  metabase db metadata 1 --json --full --max-bytes 0
@@ -311,7 +314,7 @@ metabase db metadata 1 --json --full --max-bytes 0
311
314
 
312
315
  ### `metabase db schemas <id>`
313
316
 
314
- List the schemas in a database. Schemas with no tables are excluded.
317
+ List the schemas in a database. Schemas with no tables are excluded. Cheap and bounded — this is the right entry point for an agent walking a warehouse.
315
318
 
316
319
  ```sh
317
320
  metabase db schemas 1
@@ -320,7 +323,7 @@ metabase db schemas 1 --json
320
323
 
321
324
  ### `metabase db schema-tables <id> <schema>`
322
325
 
323
- List the tables in a given schema, sorted by display name.
326
+ List the tables in one schema, sorted by display name. Returns compact projections without fields — pair with `table get --include fields` (or `table fields <id>`) per table you actually need to introspect.
324
327
 
325
328
  ```sh
326
329
  metabase db schema-tables 1 public
@@ -347,10 +350,12 @@ metabase db rescan-values 1 --json
347
350
 
348
351
  ## Tables
349
352
 
350
- Inspect and edit warehouse tables via `/api/table`.
353
+ Inspect and edit warehouse tables via `/api/table`. For agent-driven field introspection, `table get --include fields` is the default — it returns the table plus its columns in a single bounded response.
351
354
 
352
355
  ### `metabase table list`
353
356
 
357
+ Returns every table in the chosen database (or across all databases) as a flat compact list — no fields, no per-table hydration. On a real warehouse with hundreds of tables this is still bounded (kilobytes), but `db schema-tables <db-id> <schema>` is the better starting point when you know the schema.
358
+
354
359
  ```sh
355
360
  metabase table list
356
361
  metabase table list --db-id 1 --json
@@ -362,28 +367,33 @@ metabase table list --db-id 1 --json
362
367
 
363
368
  ### `metabase table get <id>`
364
369
 
365
- Returns the basic table record (no fields). Use `metabase table metadata <id>` when you want the rollup with fields/FKs/dimensions hydrated.
370
+ Returns the basic table record (no fields). Pass `--include fields` to route through `/api/table/:id/query_metadata` so the response carries the table's columns compact-projected as `fields` — this is the default agent path for field introspection. Use `metabase table fields <id>` if you only want the fields as a list envelope, or `metabase table metadata <id>` when you also need FKs and dimensions hydrated.
366
371
 
367
372
  ```sh
368
373
  metabase table get 42
369
374
  metabase table get 42 --json
375
+ metabase table get 42 --include fields --json
370
376
  ```
371
377
 
372
- ### `metabase table metadata <id>`
378
+ | Flag | Description |
379
+ | ------------------- | --------------------------------------------------------------------------------------------------- |
380
+ | `--include <which>` | Hydrate related entities. Currently only `fields` is supported (bundles compact-projected columns). |
373
381
 
374
- `GET /api/table/:id/query_metadata`: the table with its fields, FKs, and dimensions hydrated. The agent-facing one-shot introspection for a single table.
382
+ ### `metabase table fields <id>`
383
+
384
+ List the fields on a table (a thin projection over `query_metadata.fields`). Use this when you want just the field array without the surrounding table metadata.
375
385
 
376
386
  ```sh
377
- metabase table metadata 42 --json --full --max-bytes 0
387
+ metabase table fields 42
388
+ metabase table fields 42 --json
378
389
  ```
379
390
 
380
- ### `metabase table fields <id>`
391
+ ### `metabase table metadata <id>`
381
392
 
382
- List the fields on a table (a thin projection over `query_metadata.fields`).
393
+ `GET /api/table/:id/query_metadata`: the table with its fields, FKs, dimensions, segments, and measures all hydrated. Heavier than `table get --include fields` — reach for it only when you actually need the FK / dimension / segment / measure data.
383
394
 
384
395
  ```sh
385
- metabase table fields 42
386
- metabase table fields 42 --json
396
+ metabase table metadata 42 --json --full --max-bytes 0
387
397
  ```
388
398
 
389
399
  ### `metabase table update <id>`
@@ -685,29 +695,33 @@ metabase segment get 1 --json --full
685
695
  ```sh
686
696
  cat segment.json | metabase segment create
687
697
  metabase segment create --file segment.json
698
+ metabase segment create --file segment.json --skip-validate
688
699
  ```
689
700
 
690
- | Flag | Description |
691
- | --------------- | ----------------------- |
692
- | `--body <json>` | Inline JSON body. |
693
- | `--file <path>` | Path to JSON body file. |
701
+ | Flag | Description |
702
+ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
703
+ | `--body <json>` | Inline JSON body. |
704
+ | `--file <path>` | Path to JSON body file. |
705
+ | `--skip-validate` | Skip the local MBQL 5 pre-flight validation; let the server be the authority. Use only when the bundled schema disagrees with what the server accepts. |
694
706
 
695
- Body fields: `name` (required), `table_id` (required positive integer), `definition` (required MBQL filter object), `description` (optional).
707
+ Body fields: `name` (required), `table_id` (required positive integer), `definition` (required MBQL filter object), `description` (optional). If `definition` is MBQL 5 (`lib/type: "mbql/query"`) it goes through the same pre-flight validation as `card create` and `metabase query`; pass `--skip-validate` to bypass.
696
708
 
697
709
  ### `metabase segment update <id>`
698
710
 
699
- Patch a segment. The body MUST include `revision_message`. Other keys are partial: `name`, `definition`, `archived`, `description`, `caveats`, `points_of_interest`, `show_in_getting_started`.
711
+ Patch a segment. The body MUST include `revision_message`. Other keys are partial: `name`, `definition`, `archived`, `description`, `caveats`, `points_of_interest`, `show_in_getting_started`. If `definition` is MBQL 5 (`lib/type: "mbql/query"`) it goes through the same pre-flight validation as `segment create`; pass `--skip-validate` to bypass.
700
712
 
701
713
  ```sh
702
714
  cat patch.json | metabase segment update 1
703
715
  metabase segment update 1 --file patch.json
704
716
  metabase segment update 1 --body '{"name":"renamed","revision_message":"rename"}'
717
+ metabase segment update 1 --file patch.json --skip-validate
705
718
  ```
706
719
 
707
- | Flag | Description |
708
- | --------------- | ----------------------- |
709
- | `--body <json>` | Inline JSON body. |
710
- | `--file <path>` | Path to JSON body file. |
720
+ | Flag | Description |
721
+ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
722
+ | `--body <json>` | Inline JSON body. |
723
+ | `--file <path>` | Path to JSON body file. |
724
+ | `--skip-validate` | Skip the local MBQL 5 pre-flight validation; let the server be the authority. Use only when the bundled schema disagrees with what the server accepts. |
711
725
 
712
726
  ### `metabase segment archive <id>`
713
727
 
@@ -745,29 +759,33 @@ metabase measure get 1 --json --full
745
759
  ```sh
746
760
  cat measure.json | metabase measure create
747
761
  metabase measure create --file measure.json
762
+ metabase measure create --file measure.json --skip-validate
748
763
  ```
749
764
 
750
- | Flag | Description |
751
- | --------------- | ----------------------- |
752
- | `--body <json>` | Inline JSON body. |
753
- | `--file <path>` | Path to JSON body file. |
765
+ | Flag | Description |
766
+ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
767
+ | `--body <json>` | Inline JSON body. |
768
+ | `--file <path>` | Path to JSON body file. |
769
+ | `--skip-validate` | Skip the local MBQL 5 pre-flight validation; let the server be the authority. Use only when the bundled schema disagrees with what the server accepts. |
754
770
 
755
- Body fields: `name` (required), `table_id` (required positive integer), `definition` (required MBQL aggregation object), `description` (optional).
771
+ Body fields: `name` (required), `table_id` (required positive integer), `definition` (required MBQL aggregation object), `description` (optional). If `definition` is MBQL 5 (`lib/type: "mbql/query"`) it goes through the same pre-flight validation as `card create` and `metabase query`; pass `--skip-validate` to bypass.
756
772
 
757
773
  ### `metabase measure update <id>`
758
774
 
759
- Patch a measure. The body MUST include `revision_message`. Other keys are partial: `name`, `definition`, `archived`, `description`.
775
+ Patch a measure. The body MUST include `revision_message`. Other keys are partial: `name`, `definition`, `archived`, `description`. If `definition` is MBQL 5 (`lib/type: "mbql/query"`) it goes through the same pre-flight validation as `measure create`; pass `--skip-validate` to bypass.
760
776
 
761
777
  ```sh
762
778
  cat patch.json | metabase measure update 1
763
779
  metabase measure update 1 --file patch.json
764
780
  metabase measure update 1 --body '{"name":"renamed","revision_message":"rename"}'
781
+ metabase measure update 1 --file patch.json --skip-validate
765
782
  ```
766
783
 
767
- | Flag | Description |
768
- | --------------- | ----------------------- |
769
- | `--body <json>` | Inline JSON body. |
770
- | `--file <path>` | Path to JSON body file. |
784
+ | Flag | Description |
785
+ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
786
+ | `--body <json>` | Inline JSON body. |
787
+ | `--file <path>` | Path to JSON body file. |
788
+ | `--skip-validate` | Skip the local MBQL 5 pre-flight validation; let the server be the authority. Use only when the bundled schema disagrees with what the server accepts. |
771
789
 
772
790
  ### `metabase measure archive <id>`
773
791
 
@@ -914,73 +932,73 @@ metabase search products --archived
914
932
  | `--table-db-id` | Restrict to items on a given database id. |
915
933
  | `--verified` | Only verified content. |
916
934
 
917
- ## Sync
935
+ ## Remote Sync
918
936
 
919
- Drive Metabase Enterprise Remote Sync (`/api/ee/remote-sync`) — import / export Metabase content against a configured git remote, inspect dirty state, and manage branches. All sync commands require an active EE token and superuser credentials.
937
+ Drive Metabase Enterprise Remote Sync (`/api/ee/remote-sync`) — import / export Metabase content against a configured git remote, inspect dirty state, and manage branches. All remote-sync commands require an active EE token and superuser credentials.
920
938
 
921
- ### `metabase sync status`
939
+ ### `metabase remote-sync status`
922
940
 
923
941
  Roll up the current sync state in one call: configured branch, dirty flag, and the most recent sync task (or `null` if none has ever run).
924
942
 
925
943
  ```sh
926
- metabase sync status
927
- metabase sync status --json
944
+ metabase remote-sync status
945
+ metabase remote-sync status --json
928
946
  ```
929
947
 
930
- ### `metabase sync is-dirty`
948
+ ### `metabase remote-sync is-dirty`
931
949
 
932
950
  Boolean check for whether any synced collection has unsynced local changes.
933
951
 
934
952
  ```sh
935
- metabase sync is-dirty --json
953
+ metabase remote-sync is-dirty --json
936
954
  ```
937
955
 
938
- ### `metabase sync has-remote-changes`
956
+ ### `metabase remote-sync has-remote-changes`
939
957
 
940
958
  Compare the latest version on the remote branch against the version Metabase last imported. Cached for a short TTL server-side; pass `--force-refresh` to bypass.
941
959
 
942
960
  ```sh
943
- metabase sync has-remote-changes
944
- metabase sync has-remote-changes --force-refresh --json
961
+ metabase remote-sync has-remote-changes
962
+ metabase remote-sync has-remote-changes --force-refresh --json
945
963
  ```
946
964
 
947
965
  | Flag | Description |
948
966
  | ----------------- | --------------------------------------------------- |
949
967
  | `--force-refresh` | Bypass the in-memory cache and re-check the remote. |
950
968
 
951
- ### `metabase sync dirty`
969
+ ### `metabase remote-sync dirty`
952
970
 
953
971
  List every object that has unsynced local changes (compact list envelope; `--full` for the per-row payload).
954
972
 
955
973
  ```sh
956
- metabase sync dirty
957
- metabase sync dirty --json
974
+ metabase remote-sync dirty
975
+ metabase remote-sync dirty --json
958
976
  ```
959
977
 
960
- ### `metabase sync current-task`
978
+ ### `metabase remote-sync current-task`
961
979
 
962
980
  Fetch the most recent sync task. Renders `{ status: "idle" }` when no task has ever run, otherwise the full task with its hydrated `status`.
963
981
 
964
982
  ```sh
965
- metabase sync current-task
966
- metabase sync current-task --json
983
+ metabase remote-sync current-task
984
+ metabase remote-sync current-task --json
967
985
  ```
968
986
 
969
- ### `metabase sync cancel-task`
987
+ ### `metabase remote-sync cancel-task`
970
988
 
971
989
  Cancel the currently running sync task. Fails with HTTP 400 if no task is running.
972
990
 
973
991
  ```sh
974
- metabase sync cancel-task --json
992
+ metabase remote-sync cancel-task --json
975
993
  ```
976
994
 
977
- ### `metabase sync wait`
995
+ ### `metabase remote-sync wait`
978
996
 
979
997
  Poll `/current-task` until it reaches a terminal status (`successful`, `errored`, `cancelled`, `timed-out`, `conflict`). Exits 0 on `successful` or `cancelled`; exits 1 on `errored` / `timed-out` / `conflict`. Returns immediately with `{ status: "idle" }` if no task is running.
980
998
 
981
999
  ```sh
982
- metabase sync wait
983
- metabase sync wait --timeout 300000 --json
1000
+ metabase remote-sync wait
1001
+ metabase remote-sync wait --timeout 300000 --json
984
1002
  ```
985
1003
 
986
1004
  | Flag | Description |
@@ -988,14 +1006,14 @@ metabase sync wait --timeout 300000 --json
988
1006
  | `--timeout <ms>` | Polling timeout in ms (default 600000). |
989
1007
  | `--interval <ms>` | Polling interval in ms (default 2000). |
990
1008
 
991
- ### `metabase sync import`
1009
+ ### `metabase remote-sync import`
992
1010
 
993
1011
  Import content from the configured git remote into Metabase (repo → Metabase). Auto-polls until the resulting task reaches a terminal status; pass `--no-wait` to return immediately after kickoff.
994
1012
 
995
1013
  ```sh
996
- metabase sync import
997
- metabase sync import --branch main --json
998
- metabase sync import --force --no-wait
1014
+ metabase remote-sync import
1015
+ metabase remote-sync import --branch main --json
1016
+ metabase remote-sync import --force --no-wait
999
1017
  ```
1000
1018
 
1001
1019
  | Flag | Description |
@@ -1006,14 +1024,14 @@ metabase sync import --force --no-wait
1006
1024
  | `--timeout <ms>` | Polling timeout in ms (default 600000). Used with `--wait`. |
1007
1025
  | `--interval <ms>` | Polling interval in ms (default 2000). Used with `--wait`. |
1008
1026
 
1009
- ### `metabase sync export`
1027
+ ### `metabase remote-sync export`
1010
1028
 
1011
1029
  Export Metabase changes back to the configured git remote (Metabase → repo). Auto-polls by default.
1012
1030
 
1013
1031
  ```sh
1014
- metabase sync export -m "update dashboards"
1015
- metabase sync export --branch main --json
1016
- metabase sync export --no-wait
1032
+ metabase remote-sync export -m "update dashboards"
1033
+ metabase remote-sync export --branch main --json
1034
+ metabase remote-sync export --no-wait
1017
1035
  ```
1018
1036
 
1019
1037
  | Flag | Description |
@@ -1025,13 +1043,13 @@ metabase sync export --no-wait
1025
1043
  | `--timeout <ms>` | Polling timeout in ms (default 600000). Used with `--wait`. |
1026
1044
  | `--interval <ms>` | Polling interval in ms (default 2000). Used with `--wait`. |
1027
1045
 
1028
- ### `metabase sync stash`
1046
+ ### `metabase remote-sync stash`
1029
1047
 
1030
1048
  Export the current Metabase state to a NEW branch on the remote and switch sync to it. Requires `remote-sync-type` to be `read-write`.
1031
1049
 
1032
1050
  ```sh
1033
- metabase sync stash --new-branch wip
1034
- metabase sync stash --new-branch wip -m "work in progress" --json
1051
+ metabase remote-sync stash --new-branch wip
1052
+ metabase remote-sync stash --new-branch wip -m "work in progress" --json
1035
1053
  ```
1036
1054
 
1037
1055
  | Flag | Description |
@@ -1042,41 +1060,41 @@ metabase sync stash --new-branch wip -m "work in progress" --json
1042
1060
  | `--timeout <ms>` | Polling timeout in ms. Used with `--wait`. |
1043
1061
  | `--interval <ms>` | Polling interval in ms. Used with `--wait`. |
1044
1062
 
1045
- ### `metabase sync branches`
1063
+ ### `metabase remote-sync branches`
1046
1064
 
1047
1065
  List branches available on the configured git remote.
1048
1066
 
1049
1067
  ```sh
1050
- metabase sync branches --json
1068
+ metabase remote-sync branches --json
1051
1069
  ```
1052
1070
 
1053
- ### `metabase sync create-branch <name>`
1071
+ ### `metabase remote-sync create-branch <name>`
1054
1072
 
1055
1073
  Create a new branch on the git remote (from the last imported version) and switch sync to it.
1056
1074
 
1057
1075
  ```sh
1058
- metabase sync create-branch feat/dashboards
1059
- metabase sync create-branch feat/x --json
1076
+ metabase remote-sync create-branch feat/dashboards
1077
+ metabase remote-sync create-branch feat/x --json
1060
1078
  ```
1061
1079
 
1062
- ### `metabase sync add-collection <id>`
1080
+ ### `metabase remote-sync add-collection <id>`
1063
1081
 
1064
1082
  Mark a collection as remote-synced. The toggle cascades to every descendant by `location` prefix, so flagging a parent flags the whole subtree. Returns `{ success, task_id? }`; `task_id` only appears when the toggle triggers a follow-up task (e.g. a finalization import after switching to read-only mode).
1065
1083
 
1066
1084
  ```sh
1067
- metabase sync add-collection 12
1068
- metabase sync add-collection 12 --json --profile prod
1085
+ metabase remote-sync add-collection 12
1086
+ metabase remote-sync add-collection 12 --json --profile prod
1069
1087
  ```
1070
1088
 
1071
1089
  The server rejects toggles while `remote-sync-type` is `read-only` (the install default). Switch first with `metabase setting set remote-sync-type '"read-write"'`.
1072
1090
 
1073
- ### `metabase sync remove-collection <id>`
1091
+ ### `metabase remote-sync remove-collection <id>`
1074
1092
 
1075
1093
  Unmark a collection as remote-synced. Same cascade and same `read-only` precondition as `add-collection`.
1076
1094
 
1077
1095
  ```sh
1078
- metabase sync remove-collection 12
1079
- metabase sync remove-collection 12 --json --profile prod
1096
+ metabase remote-sync remove-collection 12
1097
+ metabase remote-sync remove-collection 12 --json --profile prod
1080
1098
  ```
1081
1099
 
1082
1100
  ## Workspaces
@@ -1322,25 +1340,20 @@ metabase eid translate --body '{"entity_ids":{"card":["abc123XYZ"]}}'
1322
1340
 
1323
1341
  Run an MBQL 5 query with built-in schema validation. Three modes — discover the schema (`--print-schema`), validate without sending (`--dry-run`), run.
1324
1342
 
1325
- Two MBQL flavors:
1326
-
1327
- - **Internal MBQL** (default) — numeric IDs (`database: 1`, `source-table: 7`). POSTs to `/api/dataset`. This is what every existing Metabase API endpoint accepts.
1328
- - **External MBQL** (`--external`) — string-id FKs (`database: "My DB"`, `source-table: ["My DB", null, "orders"]`). POSTs to `/api/dataset/external` (forward-looking representations endpoint).
1329
-
1330
- 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`.
1343
+ MBQL 5 bodies use numeric IDs (`database: 1`, `source-table: 7`) and POST to `/api/dataset`. The bundled query schema is synced from `@metabase/representations`; `id.yaml` is overridden to require positive integers for every ID `$def`.
1331
1344
 
1332
1345
  ```sh
1333
- metabase query --print-schema # internal JSON Schema bundle
1334
- metabase query --print-schema --external # string-FK variant
1346
+ metabase query --print-schema # JSON Schema bundle
1335
1347
  cat q.json | metabase query --dry-run # validate, no network
1336
1348
  metabase query --file q.json
1337
- metabase query --file q.json --external
1338
1349
  metabase query --file q.json --skip-validate # bypass pre-flight; let server reject
1339
1350
  ```
1340
1351
 
1341
1352
  Body sources: `--file`, `--body`, or stdin (exactly one). Body is JSON.
1342
1353
 
1343
- `--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).
1354
+ Any non-MBQL 5 body skips pre-flight automatically — legacy MBQL 4 (`{ "type": "query", "database": N, "query": { "source-table": T, ... } }`), legacy native (`{ "type": "native", "database": N, "native": { "query": "..." } }`), or any other shape that doesn't carry `"lib/type": "mbql/query"`. The bundled schema only models MBQL 5; `/api/dataset` normalizes the rest server-side via `lib-be/normalize-query` (the same normalizer that backs `card create` / `transform create`), so behavior is symmetric across endpoints. `--dry-run` on a non-MBQL 5 body emits `{ ok: true, errors: [] }` (no schema applies). The double-wrap footgun — an MBQL 5 query nested inside a `{type:"query", query:…}` envelope — is still rejected with a `ConfigError` before send.
1355
+
1356
+ `--skip-validate` is an escape hatch when the bundled schema disagrees with what the server actually accepts (drift, false negative, edge case) for MBQL 5 bodies. Validation is skipped entirely and the body is sent as-is. Mutually exclusive with `--dry-run` (which is itself the validation mode).
1344
1357
 
1345
1358
  Exit codes:
1346
1359
 
@@ -1350,21 +1363,29 @@ Exit codes:
1350
1363
 
1351
1364
  Output by mode:
1352
1365
 
1353
- - `--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.
1366
+ - `--print-schema` — `{ 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.
1354
1367
  - `--dry-run` — `{ ok: boolean, errors: { path: string, message: string }[] }`. `path` is a JSON Pointer into the body, `message` is the Ajv error string.
1355
1368
  - Run failure (no `--dry-run`) — same `{ ok, errors }` envelope on stdout, exit 2, no request made.
1356
1369
  - Run success — the streamed `CardQueryResult`.
1357
1370
 
1358
- ### MBQL 5 pre-flight in `card create`/`update` and `transform create`/`update`
1371
+ ### MBQL 5 pre-flight in `card create`/`update`, `transform create`/`update`, `measure create`/`update`, and `segment create`/`update`
1359
1372
 
1360
- 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.
1373
+ When the embedded query (`card.dataset_query`, `transform.source.query` for `source.type: "query"`, or `measure.definition` / `segment.definition`) 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.
1361
1374
 
1362
- Pass `--skip-validate` to bypass the pre-flight on `card create`, `card update`, `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.
1375
+ Pass `--skip-validate` to bypass the pre-flight on any of `card create`, `card update`, `transform create`, `transform update`, `measure create`, `measure update`, `segment create`, or `segment 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.
1363
1376
 
1364
- Agent discovery path: `metabase __manifest` lists every command's args and description; the description for `card create`/`update` and `transform create`/`update` references `metabase query --print-schema` so an agent can fetch the validating schema directly.
1377
+ Agent discovery path: `metabase __manifest` lists every command's args and description; the description for `card create`/`update`, `transform create`/`update`, `measure create`/`update`, and `segment create`/`update` references `metabase query --print-schema` so an agent can fetch the validating schema directly.
1365
1378
 
1366
1379
  The bundled query schema is synced from a pinned `@metabase/representations` release via `bun run sync:representations`; CI guards against drift.
1367
1380
 
1381
+ ### Card-reference pre-flight in `dashboard create` / `dashboard update`
1382
+
1383
+ Before either command sends anything, every positive `card_id` referenced from the body's `dashcards` array is checked against `GET /api/card/:id` in parallel (de-duplicated per id). Cards that don't exist, are archived, or aren't readable fail pre-flight: the CLI writes a `{ ok: false, errors: [{ path, message }] }` envelope to stdout (one entry per offending dashcard, `path` is a JSON pointer like `/dashcards/3/card_id`) and exits **2** with `dashboard card-reference pre-flight failed: N error(s) — fix the dashcard card_id values listed above` on stderr. No dashboard is created or modified on a pre-flight miss — this is the contract that prevents orphan dashboards when a stale spec references an archived or missing card.
1384
+
1385
+ There is no `--skip-validate` escape hatch here. The pre-flight queries live server state (no bundled schema to drift from), so the only legitimate path on a pre-flight miss is to fix the input.
1386
+
1387
+ If the chained `PUT /api/dashboard/:id` fails _after_ the create has already inserted the row (rare with pre-flight in place, but possible on a permission / 5xx / network failure mid-flight), the user-facing error is rewritten to `dashboard <id> created but follow-up PUT /api/dashboard/<id> failed: <reason>; dashcards not applied`, so the caller knows the orphan exists. Recovery: `dashboard update <id> --body '{"dashcards":[...]}'` to retry the dashcards, or `dashboard update <id> --body '{"archived":true}'` to archive the orphan.
1388
+
1368
1389
  ## UUIDs
1369
1390
 
1370
1391
  ### `metabase uuid`
@@ -1,10 +1,10 @@
1
- import { renderItem } from "./render-BblMa0Cg.mjs";
2
- import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DcczfJol.mjs";
3
- import { parseId } from "./parse-id-BgFi3UCN.mjs";
4
- import { REMOTE_SYNC_PATHS } from "./poll-task-BP37zYAf.mjs";
1
+ import { renderItem } from "./render-DXv-D6fU.mjs";
2
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-BY0yq43g.mjs";
3
+ import { parseId } from "./parse-id-Di-wVtcP.mjs";
4
+ import { REMOTE_SYNC_PATHS } from "./poll-task-CQ0jyN9p.mjs";
5
5
  import { z } from "zod";
6
6
 
7
- //#region src/commands/sync/add-collection.ts
7
+ //#region src/commands/remote-sync/add-collection.ts
8
8
  const SyncSettingsUpdateResult = z.object({
9
9
  success: z.boolean(),
10
10
  task_id: z.number().int().positive().optional()
@@ -41,7 +41,7 @@ var add_collection_default = defineMetabaseCommand({
41
41
  }
42
42
  },
43
43
  outputSchema: SyncSettingsUpdateResult,
44
- examples: ["metabase sync add-collection 12", "metabase sync add-collection 12 --json --profile prod"],
44
+ examples: ["metabase remote-sync add-collection 12", "metabase remote-sync add-collection 12 --json --profile prod"],
45
45
  async run({ args, ctx, getClient }) {
46
46
  const collectionId = parseId(args.id, "id");
47
47
  const client = await getClient();
@@ -0,0 +1,11 @@
1
+ import "./package-DwhGofpM.mjs";
2
+ import "./command-augment-D9pI9Vbh.mjs";
3
+ import "./render-DXv-D6fU.mjs";
4
+ import "./predicates-DiIiS3k7.mjs";
5
+ import "./runtime-BY0yq43g.mjs";
6
+ import "./parse-id-Di-wVtcP.mjs";
7
+ import "./poll-task-CQ0jyN9p.mjs";
8
+ import "./poll-BHFOOAGq.mjs";
9
+ import { SyncSettingsUpdateResult, add_collection_default, setCollectionRemoteSynced, syncSettingsUpdateView } from "./add-collection-8GuI25VU.mjs";
10
+
11
+ export { add_collection_default as default };
@@ -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-DbCWjP7O.mjs").then((mod) => mod.default) }
9
+ subCommands: { create: () => import("./create-1MX0T09Q.mjs").then((mod) => mod.default) }
10
10
  });
11
11
 
12
12
  //#endregion
@@ -1,10 +1,10 @@
1
- import "./package-CbQKObcX.mjs";
1
+ import "./package-DwhGofpM.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
- import { renderItem } from "./render-BblMa0Cg.mjs";
4
- import "./errors-CkVGRHrW.mjs";
5
- import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DcczfJol.mjs";
6
- import { parseId } from "./parse-id-BgFi3UCN.mjs";
7
- import { Snippet, snippetView } from "./snippet-DRTklDg3.mjs";
3
+ import { renderItem } from "./render-DXv-D6fU.mjs";
4
+ import "./predicates-DiIiS3k7.mjs";
5
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-BY0yq43g.mjs";
6
+ import { parseId } from "./parse-id-Di-wVtcP.mjs";
7
+ import { Snippet, snippetView } from "./snippet-Dw0Sjzkr.mjs";
8
8
 
9
9
  //#region src/commands/snippet/archive.ts
10
10
  var archive_default = defineMetabaseCommand({
@@ -1,11 +1,11 @@
1
- import "./package-CbQKObcX.mjs";
1
+ import "./package-DwhGofpM.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
- import { renderItem } from "./render-BblMa0Cg.mjs";
4
- import "./errors-CkVGRHrW.mjs";
5
- import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DcczfJol.mjs";
6
- import { parseId } from "./parse-id-BgFi3UCN.mjs";
7
- import { Measure, measureView } from "./measure-B1GKcZxO.mjs";
8
- import { revisionMessageFlag } from "./revision-message-flag-BJiGjb5m.mjs";
3
+ import { renderItem } from "./render-DXv-D6fU.mjs";
4
+ import "./predicates-DiIiS3k7.mjs";
5
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-BY0yq43g.mjs";
6
+ import { parseId } from "./parse-id-Di-wVtcP.mjs";
7
+ import { Measure, measureView } from "./measure-jbc7fsCs.mjs";
8
+ import { revisionMessageFlag } from "./revision-message-flag-D4E1lKE5.mjs";
9
9
 
10
10
  //#region src/commands/measure/archive.ts
11
11
  var archive_default = defineMetabaseCommand({
@@ -1,10 +1,10 @@
1
- import "./package-CbQKObcX.mjs";
1
+ import "./package-DwhGofpM.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
- import { renderItem } from "./render-BblMa0Cg.mjs";
4
- import "./errors-CkVGRHrW.mjs";
5
- import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DcczfJol.mjs";
6
- import { parseId } from "./parse-id-BgFi3UCN.mjs";
7
- import { Card, cardView } from "./card-BOGKT258.mjs";
3
+ import { renderItem } from "./render-DXv-D6fU.mjs";
4
+ import "./predicates-DiIiS3k7.mjs";
5
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-BY0yq43g.mjs";
6
+ import { parseId } from "./parse-id-Di-wVtcP.mjs";
7
+ import { Card, cardView } from "./card-B2ZlGpQP.mjs";
8
8
 
9
9
  //#region src/commands/card/archive.ts
10
10
  var archive_default = defineMetabaseCommand({
@@ -1,11 +1,11 @@
1
- import "./package-CbQKObcX.mjs";
1
+ import "./package-DwhGofpM.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
- import { renderItem } from "./render-BblMa0Cg.mjs";
4
- import "./errors-CkVGRHrW.mjs";
5
- import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DcczfJol.mjs";
6
- import { parseId } from "./parse-id-BgFi3UCN.mjs";
7
- import { revisionMessageFlag } from "./revision-message-flag-BJiGjb5m.mjs";
8
- import { Segment, segmentView } from "./segment-CQ5w3M_W.mjs";
3
+ import { renderItem } from "./render-DXv-D6fU.mjs";
4
+ import "./predicates-DiIiS3k7.mjs";
5
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-BY0yq43g.mjs";
6
+ import { parseId } from "./parse-id-Di-wVtcP.mjs";
7
+ import { revisionMessageFlag } from "./revision-message-flag-D4E1lKE5.mjs";
8
+ import { Segment, segmentView } from "./segment-BMrUBz94.mjs";
9
9
 
10
10
  //#region src/commands/segment/archive.ts
11
11
  var archive_default = defineMetabaseCommand({