@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.
Files changed (207) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/README.md +26 -236
  3. package/dist/{add-collection-CwrbKmC1.mjs → add-collection-CoP-6FZR.mjs} +5 -5
  4. package/dist/add-collection-EPp89tcs.mjs +10 -0
  5. package/dist/{archive-DqUtqRut.mjs → archive-BY8nrgnq.mjs} +5 -6
  6. package/dist/{archive-BzvqQd34.mjs → archive-BeslLaal.mjs} +5 -6
  7. package/dist/{archive-BpKZsGAm.mjs → archive-Blt0TxxA.mjs} +6 -7
  8. package/dist/{archive-ZnnJc2iT.mjs → archive-BxwGVDpd.mjs} +6 -7
  9. package/dist/{archive-BAjGIzhn.mjs → archive-C17qIvFW.mjs} +6 -7
  10. package/dist/{archive-BO3DOWI4.mjs → archive-CPLXsrzD.mjs} +5 -6
  11. package/dist/auth-CCUDM9Sv.mjs +19 -0
  12. package/dist/{body-DDYKoyMt.mjs → body-2jl-YSxT.mjs} +2 -2
  13. package/dist/{branches-DjiGsjAz.mjs → branches-Vlu44J51.mjs} +5 -6
  14. package/dist/{cancel-BwtDQ2MR.mjs → cancel-D0aBPUhs.mjs} +4 -5
  15. package/dist/{cancel-task-uJp18RvR.mjs → cancel-task-DoL2bqs1.mjs} +5 -6
  16. package/dist/{render-0_GsapXa.mjs → capabilities-7L9GVMd_.mjs} +45 -4
  17. package/dist/{card-ezYiriML.mjs → card-DnIeMmUn.mjs} +18 -2
  18. package/dist/card-UwczcLjq.mjs +20 -0
  19. package/dist/{cards-z68PANDD.mjs → cards-6MTreYAo.mjs} +5 -6
  20. package/dist/cli.mjs +23 -34
  21. package/dist/{collection-Bcy8cWYH.mjs → collection-BPTlcFw5.mjs} +8 -2
  22. package/dist/collection-Cexywhlj.mjs +20 -0
  23. package/dist/collection-namespace-BdqQJb7j.mjs +12 -0
  24. package/dist/{create-4EAGYVyp.mjs → create-BWD8H6yw.mjs} +12 -10
  25. package/dist/{create-GVfCQU3B.mjs → create-BZRA7nPu.mjs} +7 -8
  26. package/dist/{create-7JOWFxqu.mjs → create-BsOdn1Q1.mjs} +10 -11
  27. package/dist/{create-CQ4Vg4Ge.mjs → create-C_Z3IDrW.mjs} +9 -10
  28. package/dist/{create-Dd_Gyg_F.mjs → create-DNYFXAsy.mjs} +7 -8
  29. package/dist/{create-BzK59YlR.mjs → create-DcoF52Kx.mjs} +11 -12
  30. package/dist/{create-branch-CdWGiREu.mjs → create-branch-40Xm4DN7.mjs} +5 -6
  31. package/dist/create-dVmIemXi.mjs +52 -0
  32. package/dist/{create-DHWfmO2L.mjs → create-k59K2qf1.mjs} +9 -10
  33. package/dist/{current-task-nPs-iCLi.mjs → current-task-BN_XEFSX.mjs} +5 -6
  34. package/dist/dashboard-B_CuVbMX.mjs +21 -0
  35. package/dist/{database-BXiue1in.mjs → database-Dsv4QBs0.mjs} +20 -10
  36. package/dist/db-DULi5MOr.mjs +22 -0
  37. package/dist/{delete-Do1agSiL.mjs → delete-DEFgs5LE.mjs} +6 -7
  38. package/dist/{delete-runtime-uuYbd4k2.mjs → delete-runtime-DVb-Pkzp.mjs} +2 -2
  39. package/dist/{delete-CJqLgr6w.mjs → delete-tPjicYO4.mjs} +6 -7
  40. package/dist/{delete-table-ZiJDpMFT.mjs → delete-table-CDj19Qn6.mjs} +6 -7
  41. package/dist/{dirty-BnTG7w7v.mjs → dirty-DGCa6W1F.mjs} +5 -6
  42. package/dist/{eid-CwQ_smOD.mjs → eid-3v5MAKNA.mjs} +6 -7
  43. package/dist/{error-CTVL5CdB.mjs → error-BndUmcwS.mjs} +1 -1
  44. package/dist/{export-DR2cC4rL.mjs → export-BIZ-UR_M.mjs} +7 -8
  45. package/dist/field-CfrrLetM.mjs +18 -0
  46. package/dist/{fields-Ck31lDz9.mjs → fields-9lOrO8UH.mjs} +6 -7
  47. package/dist/{get-BFJ3VBPa.mjs → get-6Cj360cH.mjs} +5 -6
  48. package/dist/{get-CyG_P55z.mjs → get-BIH72g0v.mjs} +6 -7
  49. package/dist/{get-CICzGFSW.mjs → get-BSJN5TwW.mjs} +6 -7
  50. package/dist/{get-DyArILlF.mjs → get-BYSj7tMP.mjs} +5 -6
  51. package/dist/{get-DauAF3sm.mjs → get-Bk81meka.mjs} +5 -6
  52. package/dist/{get-GWRprk7k.mjs → get-BpWjLkKT.mjs} +5 -7
  53. package/dist/{get-F338MOK-.mjs → get-BuM6QPjZ.mjs} +5 -6
  54. package/dist/{get-C71ypFQk.mjs → get-CHaIVT6Y.mjs} +5 -6
  55. package/dist/{get-pO0wiy1e.mjs → get-CRa-h69C.mjs} +5 -6
  56. package/dist/{get-BPOd0Rm8.mjs → get-DFe2WoJ2.mjs} +5 -6
  57. package/dist/{get-DxqzDKKK.mjs → get-DlGlnciR.mjs} +5 -6
  58. package/dist/{get-BNKsNCcx.mjs → get-LI2xsRoT.mjs} +5 -6
  59. package/dist/{get-run-DhM_PyVy.mjs → get-run-hCZaw8-h.mjs} +5 -6
  60. package/dist/{get-BZiu-u-9.mjs → get-w-WqpjKy.mjs} +7 -8
  61. package/dist/git-sync-BpRstrZo.mjs +28 -0
  62. package/dist/{has-remote-changes-Ca0exJmb.mjs → has-remote-changes-DcpW1_KX.mjs} +5 -6
  63. package/dist/{import-DjclIzGP.mjs → import-CTQT1atq.mjs} +7 -8
  64. package/dist/{is-dirty-Cke0a1ie.mjs → is-dirty-DGrmt1ss.mjs} +4 -4
  65. package/dist/is-dirty-DuWCgrz2.mjs +9 -0
  66. package/dist/{items-BSpapmCU.mjs → items-Kr0oN2V7.mjs} +7 -8
  67. package/dist/{list-CEE9yKNp.mjs → list-Bz2ej0Cl.mjs} +4 -5
  68. package/dist/{list-V5IuMr_5.mjs → list-CCtYVgPN.mjs} +4 -5
  69. package/dist/{list-Brt4oKO7.mjs → list-CLvlEVQo.mjs} +6 -7
  70. package/dist/{list-Br77Mw6U.mjs → list-Ccj8-vb5.mjs} +5 -6
  71. package/dist/{list-Fjjtpghb.mjs → list-Cj3v4Lgv.mjs} +6 -7
  72. package/dist/{list-bVlCwg8g.mjs → list-Cl_O4_U4.mjs} +4 -5
  73. package/dist/{list-BRXGDSMo.mjs → list-D2D5Mw1E.mjs} +5 -6
  74. package/dist/{list-DUyWON1F.mjs → list-DNmekF2B.mjs} +4 -5
  75. package/dist/{list-fIV-P6wP.mjs → list-DaESiI72.mjs} +4 -5
  76. package/dist/{list-DWWGcUTg.mjs → list-DzKKdfCI.mjs} +5 -7
  77. package/dist/{list-BI1PfPjn.mjs → list-jcgK0thu.mjs} +5 -6
  78. package/dist/{list-D1qhCQn0.mjs → list-tklIxo38.mjs} +6 -7
  79. package/dist/{list-DmO4ADQq.mjs → list-zRQsvrH6.mjs} +4 -5
  80. package/dist/{login-BJGhZLgZ.mjs → login-BMKBmgeQ.mjs} +9 -10
  81. package/dist/{logout-BAGLqtnV.mjs → logout-C5pod937.mjs} +4 -5
  82. package/dist/{manifest-BNh0Lw6p.mjs → manifest-Cmu--CG5.mjs} +1 -2
  83. package/dist/measure-BkwFsP44.mjs +19 -0
  84. package/dist/{metadata-B-GOcWqL.mjs → metadata-CG4VZ5NW.mjs} +6 -7
  85. package/dist/{metadata-DJAdsOoh.mjs → metadata-DIEbyQeS.mjs} +7 -8
  86. package/dist/{parse-id-D1LTTt9L.mjs → parse-id-Boqc4wn4.mjs} +1 -1
  87. package/dist/{path-D5kX-msX.mjs → path-ur3NsMFr.mjs} +4 -6
  88. package/dist/{poll-DxpnK1wW.mjs → poll-BMjCkDaj.mjs} +1 -1
  89. package/dist/{poll-task-D8mG49IN.mjs → poll-task-CiRA0ER9.mjs} +2 -2
  90. package/dist/{preflight-Df_FqJ6o.mjs → preflight-CSqcIlbX.mjs} +3 -3
  91. package/dist/{query-zWFRDH3T.mjs → query-B8JzsQ_I.mjs} +7 -8
  92. package/dist/{query-OIuumiXN.mjs → query-CG0rEMS-.mjs} +11 -12
  93. package/dist/{query-result-ABPLz6I4.mjs → query-result-B4kTRid7.mjs} +1 -1
  94. package/dist/{remove-collection-BxmiXWKz.mjs → remove-collection-Clwz3EHQ.mjs} +7 -8
  95. package/dist/{rescan-values-M7g81KIl.mjs → rescan-values-DuHBnFjK.mjs} +8 -11
  96. package/dist/run-JXRivkfH.mjs +136 -0
  97. package/dist/{runs-CqfJIuh_.mjs → runs-FxgbXvax.mjs} +6 -7
  98. package/dist/{runtime-B40L_bj8.mjs → runtime-Ck8KKQe-.mjs} +11 -78
  99. package/dist/{schema-tables-CjBRF0_0.mjs → schema-tables-izDPI4f5.mjs} +6 -7
  100. package/dist/{schemas-GIIbek2O.mjs → schemas-CyzplnXl.mjs} +4 -5
  101. package/dist/{search-h78uOYec.mjs → search-BeuoOEQV.mjs} +4 -5
  102. package/dist/segment-ChYmSM0p.mjs +19 -0
  103. package/dist/{set-BRDxcLcQ.mjs → set-ClzB_5Jk.mjs} +7 -8
  104. package/dist/{setting-mKzZJpQY.mjs → setting-CBJVEx7_.mjs} +3 -3
  105. package/dist/{setup-WTIT2WbM.mjs → setup-vKXEUMM7.mjs} +6 -7
  106. package/dist/skills-1Z5Wj7Kp.mjs +18 -0
  107. package/dist/{skills-BkregMyb.mjs → skills-BDPVoBWU.mjs} +33 -2
  108. package/dist/snippet-De70ayL1.mjs +19 -0
  109. package/dist/{stash-DxoAJzcK.mjs → stash-DLtVf4_D.mjs} +7 -8
  110. package/dist/{status-B1dc3bbQ.mjs → status-AnPzI1f7.mjs} +4 -5
  111. package/dist/{status-D0Ukfodl.mjs → status-DHFYn9kO.mjs} +6 -7
  112. package/dist/{summary-3qOMUcEX.mjs → summary-DDed1LOz.mjs} +5 -6
  113. package/dist/sync-schema-BGQVq2JA.mjs +55 -0
  114. package/dist/table-C_bP2ao-.mjs +19 -0
  115. package/dist/{table-qDD2kApF.mjs → table-CkWja2UH.mjs} +1 -1
  116. package/dist/transform-B4RZfm6A.mjs +24 -0
  117. package/dist/{transform-BKahefz_.mjs → transform-DyWCoiO-.mjs} +1 -0
  118. package/dist/transform-job-C4pZcrIF.mjs +19 -0
  119. package/dist/{tree-DsnIPFyE.mjs → tree-BlYgJOn9.mjs} +4 -5
  120. package/dist/{update-Baya6OkO.mjs → update-B0z-2zqC.mjs} +12 -13
  121. package/dist/{update-BEtl9LpG.mjs → update-BHtliIr_.mjs} +8 -9
  122. package/dist/{update-CLsqoEJ8.mjs → update-CdfAogO2.mjs} +8 -9
  123. package/dist/{update-DPouQi4U.mjs → update-CgOPxKXK.mjs} +13 -11
  124. package/dist/{update-UaPqSfPN.mjs → update-CilTW98H.mjs} +10 -11
  125. package/dist/{update-DWn-nLPo.mjs → update-CoVvsU-I.mjs} +8 -9
  126. package/dist/{update-CZEd_Eej.mjs → update-DBN7yfAk.mjs} +9 -10
  127. package/dist/{update-BRLcnSwK.mjs → update-DqSG5_Ie.mjs} +10 -11
  128. package/dist/{update-BsgHRoZ8.mjs → update-DykqQLfo.mjs} +11 -12
  129. package/dist/{update-dashcard-DK9X91ha.mjs → update-dashcard-DZ8oV8up.mjs} +8 -9
  130. package/dist/{upgrade-UqdvTikR.mjs → upgrade-B8sEEQdQ.mjs} +34 -7
  131. package/dist/{uuid-BWCaWG4O.mjs → uuid-lLVnEoBN.mjs} +3 -4
  132. package/dist/{validate-dPEOnOf8.mjs → validate-B62TRDGV.mjs} +1 -1
  133. package/dist/{validate-query-CYvOP8Ld.mjs → validate-query-BpiN1CFu.mjs} +2 -2
  134. package/dist/{values-D_wycrcr.mjs → values-oD72EtRq.mjs} +5 -6
  135. package/dist/{verify-D7hb6VMy.mjs → verify-Bg6F0oFN.mjs} +1 -1
  136. package/dist/{wait-B5IpNFCG.mjs → wait-BtzuqQC3.mjs} +6 -7
  137. package/dist/{wait-flags-CNIeSq0_.mjs → wait-flags-DyFfZeav.mjs} +2 -2
  138. package/package.json +1 -1
  139. package/skill-data/core/SKILL.md +19 -32
  140. package/skill-data/git-sync/SKILL.md +8 -63
  141. package/skill-data/mbql/SKILL.md +95 -28
  142. package/skill-data/mbql/references/operators.md +13 -13
  143. package/skill-data/transform/SKILL.md +18 -7
  144. package/skills/metabase-cli/SKILL.md +1 -1
  145. package/dist/add-collection-DxtuNxeP.mjs +0 -11
  146. package/dist/auth-B9B4pUaH.mjs +0 -19
  147. package/dist/capabilities-7e9MgquN.mjs +0 -29
  148. package/dist/card-D54unw6r.mjs +0 -20
  149. package/dist/collection-B5kIKRTL.mjs +0 -20
  150. package/dist/create-6XE7GYxk.mjs +0 -45
  151. package/dist/create-C8gA-XP2.mjs +0 -54
  152. package/dist/credentials-CFA9iGZG.mjs +0 -88
  153. package/dist/dashboard-lw6IFfOs.mjs +0 -21
  154. package/dist/database-BPT6BrmF.mjs +0 -17
  155. package/dist/db-CBCj8sBg.mjs +0 -22
  156. package/dist/delete-CiV6f69N.mjs +0 -104
  157. package/dist/deprovision-C-qEnh-P.mjs +0 -67
  158. package/dist/docker-B-QQWThD.mjs +0 -515
  159. package/dist/field-DJmQ2pul.mjs +0 -18
  160. package/dist/git-sync-rmjYOGFK.mjs +0 -28
  161. package/dist/is-dirty-DFGgGLDi.mjs +0 -10
  162. package/dist/license-j0tDQLKI.mjs +0 -17
  163. package/dist/list-evetBTcH.mjs +0 -36
  164. package/dist/logs-jx5b_YDk.mjs +0 -60
  165. package/dist/measure-BfgxqewH.mjs +0 -19
  166. package/dist/parse-schemas-DDK9nXuh.mjs +0 -12
  167. package/dist/process-CM7Uu5q_.mjs +0 -105
  168. package/dist/provision-BJd6zO1D.mjs +0 -83
  169. package/dist/ps-CpyHEvv7.mjs +0 -11
  170. package/dist/ps-dEqRGeB3.mjs +0 -80
  171. package/dist/remove-BNQ1c6hB.mjs +0 -64
  172. package/dist/run-DTsx8bLb.mjs +0 -96
  173. package/dist/segment-CoElN2b-.mjs +0 -19
  174. package/dist/set-Dclba9xF.mjs +0 -68
  175. package/dist/skills-tMYd5d9v.mjs +0 -18
  176. package/dist/snippet-B84H3tfp.mjs +0 -19
  177. package/dist/start-B7ByBicB.mjs +0 -414
  178. package/dist/status-DAzD1Cn_.mjs +0 -34
  179. package/dist/stop-Cvexagxh.mjs +0 -87
  180. package/dist/sync-schema-CrmVX1cy.mjs +0 -44
  181. package/dist/table-B0fRQv91.mjs +0 -19
  182. package/dist/transform-K_kp6Rdm.mjs +0 -24
  183. package/dist/transform-job-CuNN8zgv.mjs +0 -19
  184. package/dist/update-hiJdbbsb.mjs +0 -78
  185. package/dist/url-LMJZRDv4.mjs +0 -56
  186. package/dist/wait-DHjXk3jD.mjs +0 -19
  187. package/dist/workspace-Bt8n3ojY.mjs +0 -25
  188. package/dist/workspace-D8HtUN0y.mjs +0 -72
  189. package/dist/workspace-credentials-8CBMQJFz.mjs +0 -100
  190. package/dist/yaml-Gv6wRFMF.mjs +0 -43
  191. package/skill-data/workspace/SKILL.md +0 -390
  192. /package/dist/{body-flags-D7q87Btw.mjs → body-flags-D78h_-Ua.mjs} +0 -0
  193. /package/dist/{dashboard-B4bn3z6t.mjs → dashboard-FY5UzJ_Z.mjs} +0 -0
  194. /package/dist/{field-E0IBy4Uw.mjs → field-MGxpNQUH.mjs} +0 -0
  195. /package/dist/{input-cMSEqISy.mjs → input-xewHccej.mjs} +0 -0
  196. /package/dist/{key-vkNkH82H.mjs → key-C2XG394c.mjs} +0 -0
  197. /package/dist/{measure-Bt3InQsA.mjs → measure-ClESGxIb.mjs} +0 -0
  198. /package/dist/{paginate-BexjkjbY.mjs → paginate-Dfm9eO9A.mjs} +0 -0
  199. /package/dist/{parse-enum-CrEWOhuY.mjs → parse-enum-Dr7ACrTR.mjs} +0 -0
  200. /package/dist/{parse-ref-DKag6a6I.mjs → parse-ref-BiETXmvm.mjs} +0 -0
  201. /package/dist/{prompt-CFKoys7k.mjs → prompt-u4WhE4T5.mjs} +0 -0
  202. /package/dist/{render-khznBlla.mjs → render-BQHJhSP1.mjs} +0 -0
  203. /package/dist/{revision-message-flag-DY29-cgz.mjs → revision-message-flag-WmsIzUOM.mjs} +0 -0
  204. /package/dist/{segment-DhBmcr_E.mjs → segment-Be2v4ilr.mjs} +0 -0
  205. /package/dist/{setting-BzCng1Ub.mjs → setting-oL97SNeO.mjs} +0 -0
  206. /package/dist/{snippet-bi_0XbNT.mjs → snippet-xh42tYly.mjs} +0 -0
  207. /package/dist/{transform-job-DjhoJbiV.mjs → transform-job-DpDGoqQt.mjs} +0 -0
@@ -1,414 +0,0 @@
1
- import { ConfigError, errorMessage } from "./command-augment-BH9qgQ5u.mjs";
2
- import { connectionFlags, outputFlags, profileFlag } from "./error-CTVL5CdB.mjs";
3
- import { createClient, defineMetabaseCommand, localUrl, parseInteger, parseOptionalInteger, resolveLicenseToken } from "./runtime-B40L_bj8.mjs";
4
- import { warn } from "./capabilities-7e9MgquN.mjs";
5
- import { renderSummary } from "./render-0_GsapXa.mjs";
6
- import { parseId } from "./parse-id-D1LTTt9L.mjs";
7
- import { pollUntil } from "./poll-DxpnK1wW.mjs";
8
- import "./yaml-Gv6wRFMF.mjs";
9
- import { runProcess } from "./process-CM7Uu5q_.mjs";
10
- import { Workspace } from "./workspace-D8HtUN0y.mjs";
11
- import { CONTAINER_REPO_DIR, checkDockerReady, containerLifecycleStatus, containerNameFor, pullImage, removeContainer, runWorkspaceContainer, scrubContainerConfig, waitForConfigConsumed } from "./docker-B-QQWThD.mjs";
12
- import { REPO_SYNC_MODES, RepoSyncMode, buildCredentialsJson, generateWorkspaceCredentials, injectCredentialsIntoConfig, injectRepoSettingsIntoConfig } from "./workspace-credentials-8CBMQJFz.mjs";
13
- import { z } from "zod";
14
- import { resolve } from "node:path";
15
- import { stat } from "node:fs/promises";
16
- import { createServer } from "node:net";
17
-
18
- //#region src/core/http/probe.ts
19
- async function probeHealth(url, timeoutMs) {
20
- try {
21
- const response = await fetch(url, { signal: AbortSignal.timeout(timeoutMs) });
22
- return {
23
- ready: response.ok,
24
- status: response.status
25
- };
26
- } catch (error) {
27
- if (error instanceof Error) return {
28
- ready: false,
29
- status: null
30
- };
31
- throw error;
32
- }
33
- }
34
-
35
- //#endregion
36
- //#region src/runtime/port.ts
37
- const PORT_SCAN_LIMIT = 100;
38
- function isPortFree(port) {
39
- return new Promise((resolve$1) => {
40
- const server = createServer();
41
- server.unref();
42
- server.once("error", () => resolve$1(false));
43
- server.once("listening", () => {
44
- server.close(() => resolve$1(true));
45
- });
46
- server.listen(port, "0.0.0.0");
47
- });
48
- }
49
- async function findFreePort(start) {
50
- for (let port = start; port < start + PORT_SCAN_LIMIT; port++) if (await isPortFree(port)) return port;
51
- throw new ConfigError(`no free port in range ${start}..${start + PORT_SCAN_LIMIT - 1}`);
52
- }
53
-
54
- //#endregion
55
- //#region src/commands/workspace/start.ts
56
- const ENTERPRISE_IMAGE = "metabase/metabase-enterprise";
57
- const ENTERPRISE_HEAD_IMAGE = "metabase/metabase-enterprise-head";
58
- const LATEST_TAG = "latest";
59
- const WORKSPACES_MIN_VERSION = 62;
60
- const DEFAULT_HOST_PORT = 3e3;
61
- const DEFAULT_READY_TIMEOUT_MS = 24e4;
62
- const HEALTH_INTERVAL_MS = 2e3;
63
- const HEALTH_MAX_INTERVAL_MS = 1e4;
64
- const HEALTH_PROBE_TIMEOUT_MS = 4e3;
65
- const DEFAULT_REPO_MODE = "read-write";
66
- const REPO_FILE_URL = `file://${CONTAINER_REPO_DIR}`;
67
- const METADATA_IMPORT_TIMEOUT_MS = DEFAULT_READY_TIMEOUT_MS;
68
- const METADATA_POLL_INTERVAL_MS = 250;
69
- const METADATA_POLL_MAX_INTERVAL_MS = 5e3;
70
- const MetadataImportEnqueued = z.object({
71
- queued: z.literal(true),
72
- "import-id": z.string()
73
- });
74
- const MetadataImportStatus = z.object({
75
- id: z.string(),
76
- status: z.enum([
77
- "queued",
78
- "running",
79
- "ok",
80
- "error"
81
- ]),
82
- "enqueued-at": z.string(),
83
- "started-at": z.string().nullable(),
84
- "finished-at": z.string().nullable(),
85
- "wall-ms": z.number().nullable(),
86
- error: z.string().nullable()
87
- });
88
- const StartResult = z.object({
89
- workspace_id: z.number().int().positive(),
90
- workspace_name: z.string(),
91
- container_name: z.string(),
92
- state: z.enum(["running", "starting"]),
93
- host_port: z.number().int().positive(),
94
- url: z.string(),
95
- image: z.string()
96
- });
97
- const startResultView = {
98
- compactPick: StartResult.pick({
99
- workspace_id: true,
100
- workspace_name: true,
101
- state: true,
102
- url: true
103
- }).strip(),
104
- tableColumns: [
105
- {
106
- key: "workspace_id",
107
- label: "ID"
108
- },
109
- {
110
- key: "workspace_name",
111
- label: "Name"
112
- },
113
- {
114
- key: "state",
115
- label: "State"
116
- },
117
- {
118
- key: "url",
119
- label: "URL"
120
- }
121
- ]
122
- };
123
- var start_default = defineMetabaseCommand({
124
- meta: {
125
- name: "start",
126
- description: "Start a local Docker container that serves as the workspace's dev instance"
127
- },
128
- capabilities: {
129
- minVersion: WORKSPACES_MIN_VERSION,
130
- tokenFeature: "workspaces"
131
- },
132
- args: {
133
- ...outputFlags,
134
- ...profileFlag,
135
- ...connectionFlags,
136
- id: {
137
- type: "positional",
138
- description: "Workspace id",
139
- required: true
140
- },
141
- port: {
142
- type: "string",
143
- description: `Host port to bind (default: ${DEFAULT_HOST_PORT}; auto-shifts up when this flag is omitted, fails on collision when set explicitly)`
144
- },
145
- image: {
146
- type: "string",
147
- description: `Docker image to run. Default: ${ENTERPRISE_IMAGE}:${LATEST_TAG} once Metabase v${WORKSPACES_MIN_VERSION} is released, otherwise ${ENTERPRISE_HEAD_IMAGE}:${LATEST_TAG}.`
148
- },
149
- wait: {
150
- type: "boolean",
151
- description: "Block until /api/health is ready before returning. Default: return as soon as the container has consumed config.yml. (Implied when --metadata is on, since the import requires a live API.)",
152
- default: false
153
- },
154
- timeout: {
155
- type: "string",
156
- description: `Per-phase readiness deadline in ms — covers post-create config consumption, (with --wait) the /api/health probe, and (with --metadata) the metadata-import status poll. Default: ${DEFAULT_READY_TIMEOUT_MS}.`,
157
- default: String(DEFAULT_READY_TIMEOUT_MS)
158
- },
159
- pull: {
160
- type: "boolean",
161
- description: "Pull the image before starting",
162
- default: true
163
- },
164
- metadata: {
165
- type: "boolean",
166
- description: "Fetch the workspace's warehouse metadata from the parent and POST it to the child instance once it is healthy",
167
- default: true
168
- },
169
- force: {
170
- type: "boolean",
171
- description: "Remove and recreate the container even if it is running. Stopped containers (exited/created/dead) are recreated automatically without this flag.",
172
- default: false
173
- },
174
- repo: {
175
- type: "string",
176
- description: `Bind-mount a host directory (typically a remote-sync git repo) into the container at ${CONTAINER_REPO_DIR}. Sets remote-sync-url=${REPO_FILE_URL} in the workspace config.yml so the child boots already wired to the repo.`
177
- },
178
- "repo-branch": {
179
- type: "string",
180
- description: "Branch to set as remote-sync-branch (default: the current branch of the host repo, read from HEAD)"
181
- },
182
- "repo-mode": {
183
- type: "string",
184
- description: "remote-sync-type: 'read-write' (default) or 'read-only'",
185
- default: DEFAULT_REPO_MODE
186
- }
187
- },
188
- outputSchema: StartResult,
189
- examples: [
190
- "mb workspace start 1",
191
- "mb workspace start 1 --wait",
192
- "mb workspace start 1 --port 3100",
193
- "mb workspace start 1 --image metabase/metabase-enterprise:latest --no-pull",
194
- "mb workspace start 1 --force",
195
- "mb workspace start 1 --repo /path/to/sync-repo --wait",
196
- "mb workspace start 1 --repo /path/to/sync-repo --repo-branch dev --repo-mode read-only"
197
- ],
198
- async run({ args, ctx, getClient, getResolvedConfig, getServerInfo }) {
199
- const workspaceId = parseId(args.id);
200
- const containerName = containerNameFor(workspaceId);
201
- const requestedPort = parseOptionalInteger(args.port, {
202
- name: "--port",
203
- min: 1
204
- });
205
- const readyTimeoutMs = parseInteger(args.timeout ?? String(DEFAULT_READY_TIMEOUT_MS), {
206
- name: "--timeout",
207
- min: 1e3
208
- });
209
- const client = await getClient();
210
- const resolved = await getResolvedConfig();
211
- const licenseToken = await resolveLicenseToken({});
212
- const serverInfo = await getServerInfo();
213
- const image = args.image ?? resolveDefaultImage(serverInfo?.version ?? null);
214
- await checkDockerReady();
215
- await ensureNoExistingContainer(workspaceId, containerName, args.force);
216
- const pullPromise = args.pull ? pullImage(image) : Promise.resolve();
217
- const workspace = await client.requestParsed(Workspace, `/api/ee/workspace-manager/${workspaceId}`);
218
- assertAllDatabasesProvisioned(workspace);
219
- const hostPort = await resolveHostPort(requestedPort);
220
- const [parentConfigYaml, metadataJson, repoOptions] = await Promise.all([
221
- fetchConfigYaml(client, workspaceId),
222
- args.metadata ? fetchMetadataJson(client, workspaceId) : Promise.resolve(null),
223
- resolveRepoOptions({
224
- hostPath: args.repo,
225
- branch: args["repo-branch"],
226
- mode: args["repo-mode"]
227
- })
228
- ]);
229
- const bundle = assembleBootBundle(parentConfigYaml, workspaceId, repoOptions);
230
- await pullPromise;
231
- await runWorkspaceContainer({
232
- workspaceId,
233
- workspaceName: workspace.name,
234
- profile: resolved.profile,
235
- parentUrl: resolved.url,
236
- image,
237
- hostPort,
238
- configYaml: bundle.configYaml,
239
- credentialsJson: bundle.credentialsJson,
240
- licenseToken,
241
- bindMounts: repoOptions === null ? [] : [repoOptions.bindMount]
242
- });
243
- const state = await finalizeContainer({
244
- workspaceId,
245
- hostPort,
246
- credentials: bundle.credentials,
247
- metadataJson,
248
- wait: args.wait,
249
- timeoutMs: readyTimeoutMs
250
- });
251
- const result = {
252
- workspace_id: workspaceId,
253
- workspace_name: workspace.name,
254
- container_name: containerName,
255
- state,
256
- host_port: hostPort,
257
- url: localUrl(hostPort),
258
- image
259
- };
260
- const message = result.state === "running" ? `Workspace ${workspaceId} "${workspace.name}" is running at ${result.url}.` : `Workspace ${workspaceId} "${workspace.name}" is starting — container is up, instance still booting. Check \`mb workspace ps\` or rerun with --wait.`;
261
- renderSummary(result, startResultView, message, ctx);
262
- }
263
- });
264
- function resolveDefaultImage(version) {
265
- const isReleased = version !== null && version.major >= WORKSPACES_MIN_VERSION;
266
- const repo = isReleased ? ENTERPRISE_IMAGE : ENTERPRISE_HEAD_IMAGE;
267
- return `${repo}:${LATEST_TAG}`;
268
- }
269
- function assertAllDatabasesProvisioned(workspace) {
270
- const databases = workspace.databases ?? [];
271
- if (databases.length === 0) throw new ConfigError(`workspace ${workspace.id} has no databases — provision at least one before starting`);
272
- const unready = databases.filter((entry) => entry.status !== "provisioned");
273
- if (unready.length > 0) {
274
- const summary = unready.map((entry) => `database ${entry.database_id}=${entry.status}`).join(", ");
275
- throw new ConfigError(`workspace ${workspace.id} is not ready: ${summary}. Wait for provisioning to finish.`);
276
- }
277
- }
278
- async function ensureNoExistingContainer(workspaceId, containerName, force) {
279
- if (force) {
280
- await removeContainer(containerName);
281
- return;
282
- }
283
- const status = await containerLifecycleStatus(containerName);
284
- if (status === "missing") return;
285
- if (status === "exited" || status === "created" || status === "dead") {
286
- await removeContainer(containerName);
287
- return;
288
- }
289
- throw new ConfigError(`container ${containerName} is currently ${status}. Run \`mb workspace stop ${workspaceId}\` first, or use --force to recreate it.`);
290
- }
291
- async function resolveHostPort(requested) {
292
- if (requested !== null) {
293
- if (!await isPortFree(requested)) throw new ConfigError(`port ${requested} is already in use`);
294
- return requested;
295
- }
296
- if (await isPortFree(DEFAULT_HOST_PORT)) return DEFAULT_HOST_PORT;
297
- return findFreePort(DEFAULT_HOST_PORT + 1);
298
- }
299
- async function fetchConfigYaml(client, workspaceId) {
300
- const response = await client.requestRaw(`/api/ee/workspace-manager/${workspaceId}/config`, { expectContentType: "binary" });
301
- return response.text();
302
- }
303
- async function fetchMetadataJson(client, workspaceId) {
304
- const response = await client.requestRaw(`/api/ee/workspace-manager/${workspaceId}/metadata/export`, {
305
- expectContentType: "binary",
306
- query: {
307
- "with-databases": true,
308
- "with-tables": true,
309
- "with-fields": true
310
- }
311
- });
312
- return new Uint8Array(await response.arrayBuffer());
313
- }
314
- function assembleBootBundle(parentConfigYaml, workspaceId, repoOptions) {
315
- const credentials = generateWorkspaceCredentials(workspaceId);
316
- const withCredentials = injectCredentialsIntoConfig(parentConfigYaml, credentials);
317
- const configYaml = repoOptions !== null ? injectRepoSettingsIntoConfig(withCredentials, repoOptions.repo) : withCredentials;
318
- return {
319
- configYaml,
320
- credentialsJson: buildCredentialsJson(credentials),
321
- credentials
322
- };
323
- }
324
- async function finalizeContainer(input) {
325
- await waitForConfigConsumed(input.workspaceId, input.timeoutMs);
326
- try {
327
- await scrubContainerConfig(input.workspaceId);
328
- } catch (error) {
329
- warn(`could not scrub in-container config.yml: ${errorMessage(error)}`);
330
- }
331
- const reachedHealth = input.wait || input.metadataJson !== null;
332
- if (reachedHealth) await waitForHealth(input.hostPort, input.timeoutMs);
333
- if (input.metadataJson !== null) await importMetadataIntoChild(input.hostPort, input.credentials, input.metadataJson, input.timeoutMs);
334
- return reachedHealth ? "running" : "starting";
335
- }
336
- async function waitForHealth(hostPort, timeoutMs) {
337
- const url = `${localUrl(hostPort)}/api/health`;
338
- await pollUntil(() => probeHealth(url, HEALTH_PROBE_TIMEOUT_MS), (probe) => probe.ready, {
339
- intervalMs: HEALTH_INTERVAL_MS,
340
- maxIntervalMs: HEALTH_MAX_INTERVAL_MS,
341
- backoff: "exponential",
342
- timeoutMs
343
- });
344
- }
345
- async function importMetadataIntoChild(hostPort, credentials, metadataJson, pollTimeoutMs) {
346
- const childClient = createClient({
347
- url: localUrl(hostPort),
348
- apiKey: credentials.api_key.key
349
- });
350
- const enqueued = await childClient.requestParsed(MetadataImportEnqueued, "/api/ee/serialization/metadata/import", {
351
- method: "POST",
352
- body: metadataJson,
353
- timeoutMs: METADATA_IMPORT_TIMEOUT_MS
354
- });
355
- const importId = enqueued["import-id"];
356
- const final = await pollUntil(() => childClient.requestParsed(MetadataImportStatus, `/api/ee/serialization/metadata/import/${importId}`), (status) => status.status === "ok" || status.status === "error", {
357
- intervalMs: METADATA_POLL_INTERVAL_MS,
358
- maxIntervalMs: METADATA_POLL_MAX_INTERVAL_MS,
359
- backoff: "exponential",
360
- timeoutMs: pollTimeoutMs
361
- });
362
- if (final.status === "error") {
363
- const detail = final.error !== null ? `: ${final.error}` : "";
364
- throw new Error(`metadata import failed (id=${importId})${detail}`);
365
- }
366
- }
367
- async function resolveRepoOptions(input) {
368
- if (input.hostPath === void 0 || input.hostPath === "") {
369
- const explicitBranch = input.branch !== void 0;
370
- const explicitNonDefaultMode = input.mode !== void 0 && input.mode !== DEFAULT_REPO_MODE;
371
- if (explicitBranch || explicitNonDefaultMode) throw new ConfigError("--repo-branch and --repo-mode require --repo to point at a host repo path");
372
- return null;
373
- }
374
- const hostPath = resolve(input.hostPath);
375
- const stats = await stat(hostPath).catch(() => null);
376
- if (stats === null || !stats.isDirectory()) throw new ConfigError(`--repo path does not exist or is not a directory: ${hostPath}`);
377
- const mode = parseRepoMode(input.mode);
378
- const branch = input.branch ?? await detectBranch(hostPath);
379
- return {
380
- bindMount: {
381
- hostPath,
382
- containerPath: CONTAINER_REPO_DIR,
383
- readOnly: mode === "read-only"
384
- },
385
- repo: {
386
- url: REPO_FILE_URL,
387
- branch,
388
- mode
389
- }
390
- };
391
- }
392
- function parseRepoMode(raw) {
393
- const result = RepoSyncMode.safeParse(raw ?? DEFAULT_REPO_MODE);
394
- if (!result.success) throw new ConfigError(`invalid --repo-mode: "${raw}" (expected one of: ${REPO_SYNC_MODES.join(", ")})`);
395
- return result.data;
396
- }
397
- async function detectBranch(hostPath) {
398
- const result = await runProcess("git", [
399
- "-C",
400
- hostPath,
401
- "symbolic-ref",
402
- "--short",
403
- "HEAD"
404
- ]).catch((error) => {
405
- throw new ConfigError(`--repo-branch not provided and could not detect a branch at ${hostPath}: ${errorMessage(error)}`);
406
- });
407
- if (result.exitCode !== 0) throw new ConfigError(`--repo-branch not provided and \`git symbolic-ref\` at ${hostPath} failed: ${result.stderr.trim() || "no output"}`);
408
- const branch = result.stdout.trim();
409
- if (branch === "") throw new ConfigError(`--repo-branch not provided and HEAD at ${hostPath} resolved to an empty branch name`);
410
- return branch;
411
- }
412
-
413
- //#endregion
414
- export { start_default as default };
@@ -1,34 +0,0 @@
1
- import "./command-augment-BH9qgQ5u.mjs";
2
- import { outputFlags } from "./error-CTVL5CdB.mjs";
3
- import { defineMetabaseCommand, readLicense } from "./runtime-B40L_bj8.mjs";
4
- import "./capabilities-7e9MgquN.mjs";
5
- import { renderSummary } from "./render-0_GsapXa.mjs";
6
- import { z } from "zod";
7
-
8
- //#region src/commands/workspace/license/status.ts
9
- const LicenseStatus = z.object({ present: z.boolean() });
10
- const licenseStatusView = {
11
- compactPick: LicenseStatus,
12
- tableColumns: [{
13
- key: "present",
14
- label: "Present"
15
- }]
16
- };
17
- var status_default = defineMetabaseCommand({
18
- meta: {
19
- name: "status",
20
- description: "Show whether a license token is stored (does not reveal value)"
21
- },
22
- capabilities: null,
23
- args: { ...outputFlags },
24
- outputSchema: LicenseStatus,
25
- examples: ["mb workspace license status", "mb workspace license status --json"],
26
- async run({ ctx }) {
27
- const present = await readLicense() !== null;
28
- const summary = present ? "A license token is stored." : "No license token stored.";
29
- renderSummary({ present }, licenseStatusView, summary, ctx);
30
- }
31
- });
32
-
33
- //#endregion
34
- export { status_default as default };
@@ -1,87 +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 { parseId } from "./parse-id-D1LTTt9L.mjs";
7
- import "./poll-DxpnK1wW.mjs";
8
- import "./process-CM7Uu5q_.mjs";
9
- import { checkDockerReady, containerLifecycleStatus, containerNameFor, stopContainer } from "./docker-B-QQWThD.mjs";
10
- import { LocalWorkspaceState } from "./ps-dEqRGeB3.mjs";
11
- import { z } from "zod";
12
-
13
- //#region src/commands/workspace/stop.ts
14
- const StopResult = z.object({
15
- workspace_id: z.number().int().positive(),
16
- container_name: z.string(),
17
- stopped: z.boolean(),
18
- prior_state: LocalWorkspaceState.nullable()
19
- });
20
- const stopResultView = {
21
- compactPick: StopResult.pick({
22
- workspace_id: true,
23
- stopped: true,
24
- prior_state: true
25
- }).strip(),
26
- tableColumns: [
27
- {
28
- key: "workspace_id",
29
- label: "ID"
30
- },
31
- {
32
- key: "container_name",
33
- label: "Container"
34
- },
35
- {
36
- key: "stopped",
37
- label: "Stopped"
38
- },
39
- {
40
- key: "prior_state",
41
- label: "Prior State"
42
- }
43
- ]
44
- };
45
- var stop_default = defineMetabaseCommand({
46
- meta: {
47
- name: "stop",
48
- description: "Stop the local Docker container for a workspace (does not remove it)"
49
- },
50
- capabilities: null,
51
- args: {
52
- ...outputFlags,
53
- id: {
54
- type: "positional",
55
- description: "Workspace id",
56
- required: true
57
- }
58
- },
59
- outputSchema: StopResult,
60
- examples: ["mb workspace stop 1", "mb workspace stop 1 --json"],
61
- async run({ args, ctx }) {
62
- const workspaceId = parseId(args.id);
63
- const containerName = containerNameFor(workspaceId);
64
- await checkDockerReady();
65
- const status = await containerLifecycleStatus(containerName);
66
- const priorState = status === "missing" ? null : status;
67
- let stopped = false;
68
- if (status === "running") {
69
- await stopContainer(containerName);
70
- stopped = true;
71
- }
72
- const result = {
73
- workspace_id: workspaceId,
74
- container_name: containerName,
75
- stopped,
76
- prior_state: priorState
77
- };
78
- let message;
79
- if (result.stopped) message = `Stopped workspace ${workspaceId} (container ${containerName}).`;
80
- else if (result.prior_state !== null) message = `Workspace ${workspaceId} container is already ${result.prior_state} — nothing to stop.`;
81
- else message = `No container found for workspace ${workspaceId} — nothing to stop.`;
82
- renderSummary(result, stopResultView, message, ctx);
83
- }
84
- });
85
-
86
- //#endregion
87
- export { stop_default as default };
@@ -1,44 +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 "./field-E0IBy4Uw.mjs";
7
- import { parseId } from "./parse-id-D1LTTt9L.mjs";
8
- import "./table-qDD2kApF.mjs";
9
- import { DatabaseSyncResult, databaseSyncResultView } from "./database-BXiue1in.mjs";
10
- import { z } from "zod";
11
-
12
- //#region src/commands/db/sync-schema.ts
13
- const SyncSchemaApiResponse = z.object({ status: z.literal("ok") });
14
- var sync_schema_default = defineMetabaseCommand({
15
- meta: {
16
- name: "sync-schema",
17
- description: "Trigger a manual schema sync for a database"
18
- },
19
- capabilities: { minVersion: 58 },
20
- args: {
21
- ...outputFlags,
22
- ...profileFlag,
23
- ...connectionFlags,
24
- id: {
25
- type: "positional",
26
- description: "Database id",
27
- required: true
28
- }
29
- },
30
- outputSchema: DatabaseSyncResult,
31
- examples: ["mb db sync-schema 1", "mb db sync-schema 1 --json"],
32
- async run({ args, ctx, getClient }) {
33
- const id = parseId(args.id);
34
- const client = await getClient();
35
- const response = await client.requestParsed(SyncSchemaApiResponse, `/api/database/${id}/sync_schema`, { method: "POST" });
36
- renderSummary({
37
- id,
38
- status: response.status
39
- }, databaseSyncResultView, `Schema sync queued for database ${id}.`, ctx);
40
- }
41
- });
42
-
43
- //#endregion
44
- export { sync_schema_default as default };
@@ -1,19 +0,0 @@
1
- import { defineCommand } from "citty";
2
-
3
- //#region src/commands/table/index.ts
4
- var table_default = defineCommand({
5
- meta: {
6
- name: "table",
7
- description: "Manage Metabase tables"
8
- },
9
- subCommands: {
10
- list: () => import("./list-Brt4oKO7.mjs").then((m) => m.default),
11
- get: () => import("./get-CICzGFSW.mjs").then((m) => m.default),
12
- metadata: () => import("./metadata-B-GOcWqL.mjs").then((m) => m.default),
13
- fields: () => import("./fields-Ck31lDz9.mjs").then((m) => m.default),
14
- update: () => import("./update-CZEd_Eej.mjs").then((m) => m.default)
15
- }
16
- });
17
-
18
- //#endregion
19
- export { table_default as default };
@@ -1,24 +0,0 @@
1
- import { defineCommand } from "citty";
2
-
3
- //#region src/commands/transform/index.ts
4
- var transform_default = defineCommand({
5
- meta: {
6
- name: "transform",
7
- description: "Manage Metabase transforms"
8
- },
9
- subCommands: {
10
- list: () => import("./list-bVlCwg8g.mjs").then((mod) => mod.default),
11
- get: () => import("./get-BPOd0Rm8.mjs").then((mod) => mod.default),
12
- create: () => import("./create-4EAGYVyp.mjs").then((mod) => mod.default),
13
- update: () => import("./update-DPouQi4U.mjs").then((mod) => mod.default),
14
- delete: () => import("./delete-CJqLgr6w.mjs").then((mod) => mod.default),
15
- "delete-table": () => import("./delete-table-ZiJDpMFT.mjs").then((mod) => mod.default),
16
- run: () => import("./run-DTsx8bLb.mjs").then((mod) => mod.default),
17
- cancel: () => import("./cancel-BwtDQ2MR.mjs").then((mod) => mod.default),
18
- "get-run": () => import("./get-run-DhM_PyVy.mjs").then((mod) => mod.default),
19
- runs: () => import("./runs-CqfJIuh_.mjs").then((mod) => mod.default)
20
- }
21
- });
22
-
23
- //#endregion
24
- export { transform_default as default };
@@ -1,19 +0,0 @@
1
- import { defineCommand } from "citty";
2
-
3
- //#region src/commands/transform-job/index.ts
4
- var transform_job_default = defineCommand({
5
- meta: {
6
- name: "transform-job",
7
- description: "Manage Metabase transform jobs"
8
- },
9
- subCommands: {
10
- list: () => import("./list-fIV-P6wP.mjs").then((mod) => mod.default),
11
- get: () => import("./get-pO0wiy1e.mjs").then((mod) => mod.default),
12
- create: () => import("./create-Dd_Gyg_F.mjs").then((mod) => mod.default),
13
- update: () => import("./update-DWn-nLPo.mjs").then((mod) => mod.default),
14
- delete: () => import("./delete-Do1agSiL.mjs").then((mod) => mod.default)
15
- }
16
- });
17
-
18
- //#endregion
19
- export { transform_job_default as default };