@metabase/cli 0.1.9 → 0.1.10

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 (160) hide show
  1. package/README.md +63 -0
  2. package/dist/add-collection-D9wXgmRj.mjs +10 -0
  3. package/dist/{add-collection-CoP-6FZR.mjs → add-collection-DUqTrC5T.mjs} +4 -4
  4. package/dist/{archive-BY8nrgnq.mjs → archive-0krZxAXq.mjs} +3 -3
  5. package/dist/{archive-BxwGVDpd.mjs → archive-44EWiXud.mjs} +3 -3
  6. package/dist/{archive-Blt0TxxA.mjs → archive-B59Y7ajB.mjs} +5 -5
  7. package/dist/{archive-CPLXsrzD.mjs → archive-BEIyIsin.mjs} +4 -4
  8. package/dist/{archive-BeslLaal.mjs → archive-BZfpjMir.mjs} +3 -3
  9. package/dist/{archive-C17qIvFW.mjs → archive-DtE2H4A6.mjs} +5 -5
  10. package/dist/archive-_GMNY8wH.mjs +39 -0
  11. package/dist/auth-cFC5m69m.mjs +19 -0
  12. package/dist/{body-2jl-YSxT.mjs → body-BdRyuvU4.mjs} +1 -1
  13. package/dist/{branches-Vlu44J51.mjs → branches-Jpv-FNds.mjs} +4 -4
  14. package/dist/{cancel-D0aBPUhs.mjs → cancel-ChC4lFd4.mjs} +3 -3
  15. package/dist/{cancel-task-DoL2bqs1.mjs → cancel-task-DyhIkNaL.mjs} +4 -4
  16. package/dist/card-ClvGX6dQ.mjs +20 -0
  17. package/dist/{cards-6MTreYAo.mjs → cards-O-nKkQKP.mjs} +3 -3
  18. package/dist/cli.mjs +24 -23
  19. package/dist/collection-DjvowSJC.mjs +20 -0
  20. package/dist/{collection-namespace-BdqQJb7j.mjs → collection-namespace-7724zUMx.mjs} +1 -1
  21. package/dist/{create-DcoF52Kx.mjs → create-B4f4Pldw.mjs} +4 -4
  22. package/dist/{create-BWD8H6yw.mjs → create-BbF9zVFP.mjs} +5 -5
  23. package/dist/{create-DNYFXAsy.mjs → create-BnFHcnlL.mjs} +4 -4
  24. package/dist/{create-BZRA7nPu.mjs → create-BuKx7kw6.mjs} +4 -4
  25. package/dist/{create-C_Z3IDrW.mjs → create-BxRsXQrm.mjs} +4 -4
  26. package/dist/{create-BsOdn1Q1.mjs → create-CvYKJOcE.mjs} +3 -3
  27. package/dist/create-D45uFXlo.mjs +44 -0
  28. package/dist/{create-dVmIemXi.mjs → create-DS52EhPd.mjs} +3 -3
  29. package/dist/{create-k59K2qf1.mjs → create-DeZ2x2Db.mjs} +4 -4
  30. package/dist/{create-branch-40Xm4DN7.mjs → create-branch-KOWUIE72.mjs} +4 -4
  31. package/dist/{current-task-BN_XEFSX.mjs → current-task-ClcWPPMc.mjs} +4 -4
  32. package/dist/dashboard-BFeURTOw.mjs +21 -0
  33. package/dist/db-CSH1kwQr.mjs +22 -0
  34. package/dist/{delete-tPjicYO4.mjs → delete-CX2VUA5R.mjs} +4 -4
  35. package/dist/{delete-DEFgs5LE.mjs → delete-D68oS73R.mjs} +4 -4
  36. package/dist/{delete-table-CDj19Qn6.mjs → delete-table-DLvL9mDA.mjs} +4 -4
  37. package/dist/{dirty-DGCa6W1F.mjs → dirty-1OrXpc7E.mjs} +4 -4
  38. package/dist/document-CcfiiV3b.mjs +100 -0
  39. package/dist/document-KdT_Xj6r.mjs +19 -0
  40. package/dist/{eid-3v5MAKNA.mjs → eid-CzLhHZMW.mjs} +3 -3
  41. package/dist/{error-BndUmcwS.mjs → error-BWXBhqLW.mjs} +1 -1
  42. package/dist/{export-BIZ-UR_M.mjs → export-B5z8w-xo.mjs} +6 -6
  43. package/dist/field-CTFnZI8G.mjs +18 -0
  44. package/dist/{fields-9lOrO8UH.mjs → fields-sC7pzmPX.mjs} +3 -3
  45. package/dist/{get-CRa-h69C.mjs → get-4GEDd9YN.mjs} +4 -4
  46. package/dist/get-BC60bhel.mjs +36 -0
  47. package/dist/{get-BIH72g0v.mjs → get-BYw3xS0X.mjs} +3 -3
  48. package/dist/{get-CHaIVT6Y.mjs → get-Bo1FGyFs.mjs} +4 -4
  49. package/dist/{get-LI2xsRoT.mjs → get-ByZ4HR2T.mjs} +3 -3
  50. package/dist/{get-DlGlnciR.mjs → get-C6n86-dS.mjs} +4 -4
  51. package/dist/{get-BYSj7tMP.mjs → get-CHb6J908.mjs} +4 -4
  52. package/dist/{get-BuM6QPjZ.mjs → get-DLwb_gUh.mjs} +4 -4
  53. package/dist/{get-BSJN5TwW.mjs → get-DTHLETau.mjs} +3 -3
  54. package/dist/{get-6Cj360cH.mjs → get-Dl62Fy6Y.mjs} +3 -3
  55. package/dist/{get-w-WqpjKy.mjs → get-Fn9WkNhS.mjs} +3 -3
  56. package/dist/{get-BpWjLkKT.mjs → get-ZesERdyk.mjs} +3 -3
  57. package/dist/{get-DFe2WoJ2.mjs → get-lcX52Skc.mjs} +4 -4
  58. package/dist/{get-Bk81meka.mjs → get-reSMTfQi.mjs} +2 -2
  59. package/dist/{get-run-hCZaw8-h.mjs → get-run-CpCbHJad.mjs} +4 -4
  60. package/dist/git-sync-C2vib8rx.mjs +28 -0
  61. package/dist/{has-remote-changes-DcpW1_KX.mjs → has-remote-changes-CPz_-uxd.mjs} +4 -4
  62. package/dist/{import-CTQT1atq.mjs → import-DaWgprK6.mjs} +6 -6
  63. package/dist/is-dirty-Bb0Rtj7x.mjs +9 -0
  64. package/dist/{is-dirty-DGrmt1ss.mjs → is-dirty-DZlI7lQx.mjs} +3 -3
  65. package/dist/{items-Kr0oN2V7.mjs → items-hgbRYsYD.mjs} +3 -3
  66. package/dist/{list-jcgK0thu.mjs → list-36H-dvJZ.mjs} +2 -2
  67. package/dist/list-B9J3ujwn.mjs +32 -0
  68. package/dist/{list-D2D5Mw1E.mjs → list-BGerkRHH.mjs} +3 -3
  69. package/dist/{list-Bz2ej0Cl.mjs → list-BWv5y307.mjs} +3 -3
  70. package/dist/{list-CCtYVgPN.mjs → list-BgHESP7b.mjs} +3 -3
  71. package/dist/{list-DzKKdfCI.mjs → list-CCZnH2-Z.mjs} +3 -3
  72. package/dist/{list-Cj3v4Lgv.mjs → list-CGdOC9zX.mjs} +2 -2
  73. package/dist/{list-zRQsvrH6.mjs → list-CKeVS1IZ.mjs} +3 -3
  74. package/dist/{list-tklIxo38.mjs → list-Cd2nOCAx.mjs} +2 -2
  75. package/dist/{list-DaESiI72.mjs → list-D9EuxFHO.mjs} +3 -3
  76. package/dist/{list-Ccj8-vb5.mjs → list-DBlsRSpZ.mjs} +2 -2
  77. package/dist/{list-Cl_O4_U4.mjs → list-DO8T-nmF.mjs} +3 -3
  78. package/dist/{list-CLvlEVQo.mjs → list-DOVX3vCb.mjs} +3 -3
  79. package/dist/{list-DNmekF2B.mjs → list-kath_2cX.mjs} +3 -3
  80. package/dist/{login-BMKBmgeQ.mjs → login-BzrAGJfu.mjs} +3 -3
  81. package/dist/{logout-C5pod937.mjs → logout-CKBiltoS.mjs} +2 -2
  82. package/dist/measure-Dw1QpRZa.mjs +19 -0
  83. package/dist/{metadata-CG4VZ5NW.mjs → metadata-BcGcUEVJ.mjs} +3 -3
  84. package/dist/{metadata-DIEbyQeS.mjs → metadata-BjOrKtnv.mjs} +3 -3
  85. package/dist/{parse-id-Boqc4wn4.mjs → parse-id--iVTCKSo.mjs} +1 -1
  86. package/dist/{path-ur3NsMFr.mjs → path-LgGU6Bd0.mjs} +3 -3
  87. package/dist/{poll-BMjCkDaj.mjs → poll-BucRFJT-.mjs} +1 -1
  88. package/dist/{poll-task-CiRA0ER9.mjs → poll-task-DTzKB3T3.mjs} +2 -2
  89. package/dist/{preflight-CSqcIlbX.mjs → preflight-CzqVX0PP.mjs} +1 -1
  90. package/dist/{query-B8JzsQ_I.mjs → query-BVZkK6Qk.mjs} +3 -3
  91. package/dist/{query-CG0rEMS-.mjs → query-DG_jygDF.mjs} +3 -3
  92. package/dist/{remove-collection-Clwz3EHQ.mjs → remove-collection-HdeAfLyi.mjs} +6 -6
  93. package/dist/{rescan-values-DuHBnFjK.mjs → rescan-values-hWubCruZ.mjs} +3 -3
  94. package/dist/{run-JXRivkfH.mjs → run-C1-lDmQF.mjs} +6 -6
  95. package/dist/{runs-FxgbXvax.mjs → runs-Q6DYQyqj.mjs} +4 -4
  96. package/dist/{runtime-Ck8KKQe-.mjs → runtime-colqvhLf.mjs} +1 -1
  97. package/dist/{schema-tables-izDPI4f5.mjs → schema-tables-BEastV_8.mjs} +3 -3
  98. package/dist/{schemas-CyzplnXl.mjs → schemas-CgawwI_k.mjs} +3 -3
  99. package/dist/{search-BeuoOEQV.mjs → search-BWo7xSPP.mjs} +3 -3
  100. package/dist/segment-DMuYvFjg.mjs +19 -0
  101. package/dist/{set-ClzB_5Jk.mjs → set-7Nm2ZTb_.mjs} +5 -5
  102. package/dist/{setting-CBJVEx7_.mjs → setting-DSGXJehQ.mjs} +3 -3
  103. package/dist/{setup-vKXEUMM7.mjs → setup-aJLGLrIT.mjs} +3 -3
  104. package/dist/{skills-1Z5Wj7Kp.mjs → skills-Q2AFsYvc.mjs} +3 -3
  105. package/dist/snippet-Df2TrP7-.mjs +19 -0
  106. package/dist/{stash-DLtVf4_D.mjs → stash-DPQ0c-Cd.mjs} +6 -6
  107. package/dist/{status-AnPzI1f7.mjs → status-CvAATvV0.mjs} +2 -2
  108. package/dist/{status-DHFYn9kO.mjs → status-CvKPrV5X.mjs} +5 -5
  109. package/dist/{summary-DDed1LOz.mjs → summary-CeOnoOq2.mjs} +3 -3
  110. package/dist/{sync-schema-BGQVq2JA.mjs → sync-schema-aOPBc3CY.mjs} +5 -5
  111. package/dist/table-pK4OkVtL.mjs +19 -0
  112. package/dist/transform-D60veFH8.mjs +24 -0
  113. package/dist/transform-job-DXt5LsrY.mjs +19 -0
  114. package/dist/{tree-BlYgJOn9.mjs → tree-MOQOBeAP.mjs} +2 -2
  115. package/dist/update-57uxZWcR.mjs +52 -0
  116. package/dist/{update-CdfAogO2.mjs → update-B6mg3AZD.mjs} +4 -4
  117. package/dist/{update-DBN7yfAk.mjs → update-BD9xkglP.mjs} +4 -4
  118. package/dist/{update-BHtliIr_.mjs → update-BRrnfG0q.mjs} +5 -5
  119. package/dist/{update-CgOPxKXK.mjs → update-BWyCK8QV.mjs} +6 -6
  120. package/dist/{update-CoVvsU-I.mjs → update-Bj9s0ri8.mjs} +5 -5
  121. package/dist/{update-DykqQLfo.mjs → update-BkMWBzvk.mjs} +4 -4
  122. package/dist/{update-B0z-2zqC.mjs → update-CitS-QRN.mjs} +5 -5
  123. package/dist/{update-DqSG5_Ie.mjs → update-DfNKr_vS.mjs} +5 -5
  124. package/dist/{update-CilTW98H.mjs → update-Dri4Zg2H.mjs} +5 -5
  125. package/dist/{update-dashcard-DZ8oV8up.mjs → update-dashcard-D_-ura3Y.mjs} +4 -4
  126. package/dist/{upgrade-B8sEEQdQ.mjs → upgrade-CFkZ4USY.mjs} +2 -2
  127. package/dist/{uuid-lLVnEoBN.mjs → uuid-DpinhSxA.mjs} +2 -2
  128. package/dist/{values-oD72EtRq.mjs → values-BSS4DRxk.mjs} +3 -3
  129. package/dist/{verify-Bg6F0oFN.mjs → verify-B_A7v8TY.mjs} +1 -1
  130. package/dist/{wait-BtzuqQC3.mjs → wait-D3iSnjMM.mjs} +5 -5
  131. package/dist/{wait-flags-DyFfZeav.mjs → wait-flags-_LnHOeBA.mjs} +2 -2
  132. package/package.json +1 -1
  133. package/skill-data/core/SKILL.md +2 -2
  134. package/skill-data/document/SKILL.md +162 -0
  135. package/dist/add-collection-EPp89tcs.mjs +0 -10
  136. package/dist/auth-CCUDM9Sv.mjs +0 -19
  137. package/dist/card-UwczcLjq.mjs +0 -20
  138. package/dist/collection-Cexywhlj.mjs +0 -20
  139. package/dist/dashboard-B_CuVbMX.mjs +0 -21
  140. package/dist/db-DULi5MOr.mjs +0 -22
  141. package/dist/field-CfrrLetM.mjs +0 -18
  142. package/dist/git-sync-BpRstrZo.mjs +0 -28
  143. package/dist/is-dirty-DuWCgrz2.mjs +0 -9
  144. package/dist/measure-BkwFsP44.mjs +0 -19
  145. package/dist/segment-ChYmSM0p.mjs +0 -19
  146. package/dist/snippet-De70ayL1.mjs +0 -19
  147. package/dist/table-C_bP2ao-.mjs +0 -19
  148. package/dist/transform-B4RZfm6A.mjs +0 -24
  149. package/dist/transform-job-C4pZcrIF.mjs +0 -19
  150. /package/dist/{delete-runtime-DVb-Pkzp.mjs → delete-runtime-CjFc69tS.mjs} +0 -0
  151. /package/dist/{key-C2XG394c.mjs → key-y4TtxKwU.mjs} +0 -0
  152. /package/dist/{manifest-Cmu--CG5.mjs → manifest-BPHqF5LY.mjs} +0 -0
  153. /package/dist/{measure-ClESGxIb.mjs → measure-COGAoZpo.mjs} +0 -0
  154. /package/dist/{revision-message-flag-WmsIzUOM.mjs → revision-message-flag-Bo-Kvv6F.mjs} +0 -0
  155. /package/dist/{segment-Be2v4ilr.mjs → segment-d-708KKO.mjs} +0 -0
  156. /package/dist/{setting-oL97SNeO.mjs → setting-CSJvi1-6.mjs} +0 -0
  157. /package/dist/{skills-BDPVoBWU.mjs → skills-CY_FmaPo.mjs} +0 -0
  158. /package/dist/{snippet-xh42tYly.mjs → snippet-BZvo05ua.mjs} +0 -0
  159. /package/dist/{transform-DyWCoiO-.mjs → transform--dviwMA1.mjs} +0 -0
  160. /package/dist/{transform-job-DpDGoqQt.mjs → transform-job-n8W6tLqF.mjs} +0 -0
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: document
3
+ description: Author and edit Metabase documents via `mb` — the TipTap (ProseMirror) JSON body shape, the node-type inventory (paragraphs, headings, lists, plus the Metabase-custom `cardEmbed` / `smartLink` / `flexContainer` / `resizeNode`), the per-node-type `_id` requirement, embedding existing or brand-new cards, and the list/get/create/update/archive verbs. Load when the user touches documents — "create a document", "add a card to a document", "edit a document", "list documents", or anything `mb document …`.
4
+ allowed-tools: Read, Write, Edit, Bash, AskUserQuestion
5
+ ---
6
+
7
+ # Documents
8
+
9
+ A **document** is a Metabase rich-text page (a "report" / notebook) that mixes prose with embedded saved questions and links to other Metabase entities. The body is a **TipTap** JSON tree (TipTap is the editor; the wire format is ProseMirror JSON, and the server stores it under `content_type: "application/json+vnd.prose-mirror"`).
10
+
11
+ This skill covers authoring the body and driving the verbs. General flag conventions, body-input precedence, and output flags live in the `core` skill (`mb skills get core`).
12
+
13
+ ## Command surface
14
+
15
+ ```bash
16
+ mb document list --profile <name> --json # non-archived docs visible to you
17
+ mb document get <id> --profile <name> --full --json # one doc incl. its TipTap body
18
+ mb document create --file doc.json --profile <name> --json
19
+ mb document update <id> --file patch.json --profile <name> --json # PATCH semantics
20
+ mb document archive <id> --profile <name> --json # soft-delete (PUT archived:true)
21
+ ```
22
+
23
+ - `list` returns the standard envelope (`{data, returned, total}`). The compact item is `{id, name, collection_id, archived, creator_id, can_write}` — it does **not** include the (potentially huge) `document` body. Pull the body with `get --full`.
24
+ - `archive` is the only delete, mirroring `card` / `dashboard`. **Unarchive** with `mb document update <id> --body '{"archived":false}'`.
25
+ - `update` is PATCH — send only the keys you want to change (`name`, `document`, `collection_id`, `collection_position`, `archived`). Replacing `document` replaces the **whole** body; there is no partial-node patch.
26
+
27
+ ## Node ids (`_id`)
28
+
29
+ The editor anchors only these node types with an `_id` (a UUID): `paragraph`, `heading`, `codeBlock`, `orderedList`, `bulletList`, `blockquote`, `cardEmbed`, `supportingText`. **`create`/`update` require a non-empty `_id` on every node of those types** and reject a body missing any; other node types (`doc`, `text`, `listItem`, `resizeNode`, `flexContainer`, …) don't take an `_id` and are left alone. Mint the ids with the bundled `uuid` command — one per id-bearing node:
30
+
31
+ ```bash
32
+ mb uuid --count 5 --json # → ["…", …] one UUID per id-bearing node
33
+ ```
34
+
35
+ Set each as that node's `attrs._id`. Without them the editor backfills ids when the document opens, which makes a freshly-saved document show a spurious "unsaved changes" prompt.
36
+
37
+ ## Body shape (create / update)
38
+
39
+ The create body is `{name, document, collection_id?, collection_position?}`. `name` and `document` are required on create; everything is optional on update.
40
+
41
+ `document` is the TipTap tree — a root `doc` node whose `content` is an array of block nodes (replace each `<uuid-N>` with an `mb uuid` value):
42
+
43
+ ```json
44
+ {
45
+ "name": "Weekly report",
46
+ "collection_id": 12,
47
+ "document": {
48
+ "type": "doc",
49
+ "content": [
50
+ {
51
+ "type": "heading",
52
+ "attrs": { "level": 1, "_id": "<uuid-1>" },
53
+ "content": [{ "type": "text", "text": "Weekly report" }]
54
+ },
55
+ {
56
+ "type": "paragraph",
57
+ "attrs": { "_id": "<uuid-2>" },
58
+ "content": [{ "type": "text", "text": "Orders trended up this week." }]
59
+ }
60
+ ]
61
+ }
62
+ }
63
+ ```
64
+
65
+ `collection_id: null` (or omitted) files the document in "Our analytics" (the root). `collection_id` accepts any normal analytics collection id (unlike transforms, documents are not namespace-restricted).
66
+
67
+ ## Node inventory
68
+
69
+ Every node is `{ "type": string, "attrs"?: object, "content"?: [nodes], "text"?: string, "marks"?: [marks] }`. The id-bearing types listed above carry `attrs._id`; the rest don't.
70
+
71
+ **Standard text nodes** (TipTap StarterKit):
72
+
73
+ - `doc` — the root; `content` holds block nodes.
74
+ - `paragraph` — `content` is inline nodes (usually `text`). An empty paragraph (`{ "type": "paragraph", "attrs": { "_id": "<uuid>" } }`) is a blank line.
75
+ - `text` — a leaf with `text` and optional `marks` (no `_id`).
76
+ - `heading` — `attrs.level` 1–6.
77
+ - `bulletList` / `orderedList` — `content` is `listItem` nodes (no `_id`); each `listItem` wraps `paragraph`(s).
78
+ - `blockquote`, `codeBlock`, `horizontalRule`, `hardBreak`, `image`.
79
+
80
+ **Marks** on `text` (the `marks` array): `bold`, `italic`, `strike`, `code`, plus `link` (`attrs.href`). Example: `{ "type": "text", "text": "important", "marks": [{ "type": "bold" }] }`.
81
+
82
+ **Metabase-custom nodes** (the reason a document is more than a wiki page):
83
+
84
+ - **`cardEmbed`** — an embedded saved question. Block, atomic, id-bearing. `attrs: { "id": <card-id>, "name": <string|null>, "_id": "<uuid>" }`. `name` overrides the displayed title (`null` = use the card's own name). Card embeds are commonly wrapped in a `resizeNode` to give them a fixed height.
85
+ - **`resizeNode`** — wraps a single `cardEmbed` or `flexContainer` to make it resizable (no `_id`). `attrs: { "height": <px>, "minHeight": <px> }`, `content` is exactly one `cardEmbed`/`flexContainer`.
86
+ - **`flexContainer`** — a horizontal row of 1–3 `cardEmbed` / `supportingText` cells side by side (no `_id`). `attrs.columnWidths` is an array of width percentages.
87
+ - **`supportingText`** — a text column that sits next to a card inside a `flexContainer` (id-bearing); `content` is the usual block nodes (`paragraph`, `heading`, lists, …).
88
+ - **`smartLink`** — an inline reference to a Metabase entity (renders as a live chip). Inline, atomic, no `_id`. `attrs: { "entityId": <id>, "model": <model>, "label": <string|null>, "href": <relative-path> }`. `model` ∈ `card`, `dataset`, `metric`, `dashboard`, `collection`, `table`, `database`, `document`, `transform`, `segment`, `measure`, `user`, `action`, `indexed-entity`.
89
+ - **`metabot`** — an inline Metabot prompt block.
90
+
91
+ ## Embedding an existing card
92
+
93
+ A document embedding an existing card (id 114) under a heading (only the id-bearing nodes carry `_id`):
94
+
95
+ ```json
96
+ {
97
+ "type": "doc",
98
+ "content": [
99
+ {
100
+ "type": "heading",
101
+ "attrs": { "level": 2, "_id": "<uuid-1>" },
102
+ "content": [{ "type": "text", "text": "Orders" }]
103
+ },
104
+ {
105
+ "type": "resizeNode",
106
+ "attrs": { "height": 400, "minHeight": 200 },
107
+ "content": [{ "type": "cardEmbed", "attrs": { "id": 114, "name": null, "_id": "<uuid-2>" } }]
108
+ },
109
+ { "type": "paragraph", "attrs": { "_id": "<uuid-3>" } }
110
+ ]
111
+ }
112
+ ```
113
+
114
+ To embed an existing card, find its id with `mb card list --profile <name> --json` (or `mb search --models card "<text>"`), then reference it in a `cardEmbed`.
115
+
116
+ ## Creating brand-new cards inline with the document
117
+
118
+ You can create cards atomically with the document instead of pre-creating them. Reference each new card by a **negative** id in its `cardEmbed.attrs.id`, then supply the card definitions in a top-level `cards` map keyed by the same negative ids. The server creates the real cards and rewrites the negative ids to the real positive ids in the stored body.
119
+
120
+ ```json
121
+ {
122
+ "name": "Auto report",
123
+ "document": {
124
+ "type": "doc",
125
+ "content": [
126
+ { "type": "cardEmbed", "attrs": { "id": -1, "name": null, "_id": "<uuid-1>" } },
127
+ { "type": "paragraph", "attrs": { "_id": "<uuid-2>" } }
128
+ ]
129
+ },
130
+ "cards": {
131
+ "-1": {
132
+ "name": "Order count",
133
+ "display": "scalar",
134
+ "dataset_query": { "...": "an MBQL or native query — see the mbql skill" },
135
+ "visualization_settings": {}
136
+ }
137
+ }
138
+ }
139
+ ```
140
+
141
+ Each entry in `cards` needs at least `{name, dataset_query, display, visualization_settings}` (these are card definitions, not TipTap nodes, so they take no `_id`). Author the `dataset_query` with the `mbql` skill (`mb skills get mbql`) and the `visualization_settings` with the `viz` skill. For most edits, prefer embedding cards that already exist (a plain positive `id` in `cardEmbed`) — inline creation is for "build the report and its questions in one shot".
142
+
143
+ ## Iterating on a document
144
+
145
+ `update` replaces the whole `document` body, so the safe loop is **read → edit → write**. A fetched body already carries `_id`s on its id-bearing nodes, so preserve them — only mint new ones for id-bearing nodes you add:
146
+
147
+ ```bash
148
+ mb document get <id> --full --profile <name> --json | jq '.document' > /tmp/body.json
149
+ # edit /tmp/body.json (add nodes — give each new id-bearing node a fresh `mb uuid` _id) …
150
+ jq -n --slurpfile d /tmp/body.json '{document: $d[0]}' > /tmp/patch.json
151
+ mb document update <id> --file /tmp/patch.json --profile <name> --json
152
+ ```
153
+
154
+ Don't hand-merge a partial node tree into a live document — pull the current `document`, mutate the array, and PUT the whole thing back. To rename without touching the body, patch only `name`: `mb document update <id> --body '{"name":"New title"}'`.
155
+
156
+ ## Don't
157
+
158
+ - Don't omit `_id` on an id-bearing node (`paragraph`, `heading`, `codeBlock`, `orderedList`, `bulletList`, `blockquote`, `cardEmbed`, `supportingText`) — `create`/`update` reject the body ("did not match expected schema"). Mint ids with `mb uuid`.
159
+ - Don't paste a whole `document get` response into `update` — `update` only accepts `name`, `document`, `collection_id`, `collection_position`, `archived`. Send the body under the `document` key, not the full record.
160
+ - Don't put the full `document` body in `list` expectations — `list` is compact and omits it by design; use `get --full`.
161
+ - Don't invent node types. Stick to the inventory above; unknown block types render as empty/broken in the editor even though the response schema is lenient.
162
+ - Don't author a card's `dataset_query` or `visualization_settings` from this skill alone — load `mbql` and `viz`.
@@ -1,10 +0,0 @@
1
- import "./command-augment-BH9qgQ5u.mjs";
2
- import "./error-BndUmcwS.mjs";
3
- import "./runtime-Ck8KKQe-.mjs";
4
- import "./capabilities-7L9GVMd_.mjs";
5
- import "./parse-id-Boqc4wn4.mjs";
6
- import "./poll-BMjCkDaj.mjs";
7
- import "./poll-task-CiRA0ER9.mjs";
8
- import { SyncSettingsUpdateResult, add_collection_default, setCollectionRemoteSynced, syncSettingsUpdateView } from "./add-collection-CoP-6FZR.mjs";
9
-
10
- export { add_collection_default as default };
@@ -1,19 +0,0 @@
1
- import { defineCommand } from "citty";
2
-
3
- //#region src/commands/auth/index.ts
4
- var auth_default = defineCommand({
5
- meta: {
6
- name: "auth",
7
- description: "Authenticate against a Metabase instance"
8
- },
9
- default: "login",
10
- subCommands: {
11
- login: () => import("./login-BMKBmgeQ.mjs").then((m) => m.default),
12
- status: () => import("./status-AnPzI1f7.mjs").then((m) => m.default),
13
- list: () => import("./list-D2D5Mw1E.mjs").then((m) => m.default),
14
- logout: () => import("./logout-C5pod937.mjs").then((m) => m.default)
15
- }
16
- });
17
-
18
- //#endregion
19
- export { auth_default as default };
@@ -1,20 +0,0 @@
1
- import { defineCommand } from "citty";
2
-
3
- //#region src/commands/card/index.ts
4
- var card_default = defineCommand({
5
- meta: {
6
- name: "card",
7
- description: "Manage Metabase cards (questions, models, metrics)"
8
- },
9
- subCommands: {
10
- list: () => import("./list-Cj3v4Lgv.mjs").then((mod) => mod.default),
11
- get: () => import("./get-BIH72g0v.mjs").then((mod) => mod.default),
12
- query: () => import("./query-B8JzsQ_I.mjs").then((mod) => mod.default),
13
- create: () => import("./create-BsOdn1Q1.mjs").then((mod) => mod.default),
14
- update: () => import("./update-DykqQLfo.mjs").then((mod) => mod.default),
15
- archive: () => import("./archive-BxwGVDpd.mjs").then((mod) => mod.default)
16
- }
17
- });
18
-
19
- //#endregion
20
- export { card_default as default };
@@ -1,20 +0,0 @@
1
- import { defineCommand } from "citty";
2
-
3
- //#region src/commands/collection/index.ts
4
- var collection_default = defineCommand({
5
- meta: {
6
- name: "collection",
7
- description: "Manage Metabase collections"
8
- },
9
- subCommands: {
10
- list: () => import("./list-jcgK0thu.mjs").then((mod) => mod.default),
11
- get: () => import("./get-Bk81meka.mjs").then((mod) => mod.default),
12
- items: () => import("./items-Kr0oN2V7.mjs").then((mod) => mod.default),
13
- tree: () => import("./tree-BlYgJOn9.mjs").then((mod) => mod.default),
14
- create: () => import("./create-dVmIemXi.mjs").then((mod) => mod.default),
15
- archive: () => import("./archive-BeslLaal.mjs").then((mod) => mod.default)
16
- }
17
- });
18
-
19
- //#endregion
20
- export { collection_default as default };
@@ -1,21 +0,0 @@
1
- import { defineCommand } from "citty";
2
-
3
- //#region src/commands/dashboard/index.ts
4
- var dashboard_default = defineCommand({
5
- meta: {
6
- name: "dashboard",
7
- description: "Manage Metabase dashboards"
8
- },
9
- subCommands: {
10
- list: () => import("./list-Ccj8-vb5.mjs").then((mod) => mod.default),
11
- get: () => import("./get-LI2xsRoT.mjs").then((mod) => mod.default),
12
- cards: () => import("./cards-6MTreYAo.mjs").then((mod) => mod.default),
13
- create: () => import("./create-DcoF52Kx.mjs").then((mod) => mod.default),
14
- update: () => import("./update-B0z-2zqC.mjs").then((mod) => mod.default),
15
- "update-dashcard": () => import("./update-dashcard-DZ8oV8up.mjs").then((mod) => mod.default),
16
- archive: () => import("./archive-BY8nrgnq.mjs").then((mod) => mod.default)
17
- }
18
- });
19
-
20
- //#endregion
21
- export { dashboard_default as default };
@@ -1,22 +0,0 @@
1
- import { defineCommand } from "citty";
2
-
3
- //#region src/commands/db/index.ts
4
- var db_default = defineCommand({
5
- meta: {
6
- name: "db",
7
- description: "Inspect and sync Metabase databases",
8
- alias: "database"
9
- },
10
- subCommands: {
11
- list: () => import("./list-tklIxo38.mjs").then((m) => m.default),
12
- get: () => import("./get-w-WqpjKy.mjs").then((m) => m.default),
13
- metadata: () => import("./metadata-DIEbyQeS.mjs").then((m) => m.default),
14
- schemas: () => import("./schemas-CyzplnXl.mjs").then((m) => m.default),
15
- "schema-tables": () => import("./schema-tables-izDPI4f5.mjs").then((m) => m.default),
16
- "sync-schema": () => import("./sync-schema-BGQVq2JA.mjs").then((m) => m.default),
17
- "rescan-values": () => import("./rescan-values-DuHBnFjK.mjs").then((m) => m.default)
18
- }
19
- });
20
-
21
- //#endregion
22
- export { db_default as default };
@@ -1,18 +0,0 @@
1
- import { defineCommand } from "citty";
2
-
3
- //#region src/commands/field/index.ts
4
- var field_default = defineCommand({
5
- meta: {
6
- name: "field",
7
- description: "Manage Metabase fields"
8
- },
9
- subCommands: {
10
- get: () => import("./get-6Cj360cH.mjs").then((m) => m.default),
11
- values: () => import("./values-oD72EtRq.mjs").then((m) => m.default),
12
- summary: () => import("./summary-DDed1LOz.mjs").then((m) => m.default),
13
- update: () => import("./update-CdfAogO2.mjs").then((m) => m.default)
14
- }
15
- });
16
-
17
- //#endregion
18
- export { field_default as default };
@@ -1,28 +0,0 @@
1
- import { defineCommand } from "citty";
2
-
3
- //#region src/commands/git-sync/index.ts
4
- var git_sync_default = defineCommand({
5
- meta: {
6
- name: "git-sync",
7
- description: "Sync Metabase content with a git remote"
8
- },
9
- subCommands: {
10
- status: () => import("./status-DHFYn9kO.mjs").then((mod) => mod.default),
11
- "is-dirty": () => import("./is-dirty-DuWCgrz2.mjs").then((mod) => mod.default),
12
- "has-remote-changes": () => import("./has-remote-changes-DcpW1_KX.mjs").then((mod) => mod.default),
13
- dirty: () => import("./dirty-DGCa6W1F.mjs").then((mod) => mod.default),
14
- "current-task": () => import("./current-task-BN_XEFSX.mjs").then((mod) => mod.default),
15
- "cancel-task": () => import("./cancel-task-DoL2bqs1.mjs").then((mod) => mod.default),
16
- wait: () => import("./wait-BtzuqQC3.mjs").then((mod) => mod.default),
17
- import: () => import("./import-CTQT1atq.mjs").then((mod) => mod.default),
18
- export: () => import("./export-BIZ-UR_M.mjs").then((mod) => mod.default),
19
- stash: () => import("./stash-DLtVf4_D.mjs").then((mod) => mod.default),
20
- branches: () => import("./branches-Vlu44J51.mjs").then((mod) => mod.default),
21
- "create-branch": () => import("./create-branch-40Xm4DN7.mjs").then((mod) => mod.default),
22
- "add-collection": () => import("./add-collection-EPp89tcs.mjs").then((mod) => mod.default),
23
- "remove-collection": () => import("./remove-collection-Clwz3EHQ.mjs").then((mod) => mod.default)
24
- }
25
- });
26
-
27
- //#endregion
28
- export { git_sync_default as default };
@@ -1,9 +0,0 @@
1
- import "./command-augment-BH9qgQ5u.mjs";
2
- import "./error-BndUmcwS.mjs";
3
- import "./runtime-Ck8KKQe-.mjs";
4
- import "./capabilities-7L9GVMd_.mjs";
5
- import "./poll-BMjCkDaj.mjs";
6
- import "./poll-task-CiRA0ER9.mjs";
7
- import { IsDirtyResult, is_dirty_default } from "./is-dirty-DGrmt1ss.mjs";
8
-
9
- export { is_dirty_default as default };
@@ -1,19 +0,0 @@
1
- import { defineCommand } from "citty";
2
-
3
- //#region src/commands/measure/index.ts
4
- var measure_default = defineCommand({
5
- meta: {
6
- name: "measure",
7
- description: "Manage Metabase measures"
8
- },
9
- subCommands: {
10
- list: () => import("./list-zRQsvrH6.mjs").then((mod) => mod.default),
11
- get: () => import("./get-DlGlnciR.mjs").then((mod) => mod.default),
12
- create: () => import("./create-k59K2qf1.mjs").then((mod) => mod.default),
13
- update: () => import("./update-CilTW98H.mjs").then((mod) => mod.default),
14
- archive: () => import("./archive-Blt0TxxA.mjs").then((mod) => mod.default)
15
- }
16
- });
17
-
18
- //#endregion
19
- export { measure_default as default };
@@ -1,19 +0,0 @@
1
- import { defineCommand } from "citty";
2
-
3
- //#region src/commands/segment/index.ts
4
- var segment_default = defineCommand({
5
- meta: {
6
- name: "segment",
7
- description: "Manage Metabase segments"
8
- },
9
- subCommands: {
10
- list: () => import("./list-DNmekF2B.mjs").then((mod) => mod.default),
11
- get: () => import("./get-CHaIVT6Y.mjs").then((mod) => mod.default),
12
- create: () => import("./create-C_Z3IDrW.mjs").then((mod) => mod.default),
13
- update: () => import("./update-DqSG5_Ie.mjs").then((mod) => mod.default),
14
- archive: () => import("./archive-C17qIvFW.mjs").then((mod) => mod.default)
15
- }
16
- });
17
-
18
- //#endregion
19
- export { segment_default as default };
@@ -1,19 +0,0 @@
1
- import { defineCommand } from "citty";
2
-
3
- //#region src/commands/snippet/index.ts
4
- var snippet_default = defineCommand({
5
- meta: {
6
- name: "snippet",
7
- description: "Manage Metabase native query snippets"
8
- },
9
- subCommands: {
10
- list: () => import("./list-Bz2ej0Cl.mjs").then((mod) => mod.default),
11
- get: () => import("./get-BuM6QPjZ.mjs").then((mod) => mod.default),
12
- create: () => import("./create-BZRA7nPu.mjs").then((mod) => mod.default),
13
- update: () => import("./update-BHtliIr_.mjs").then((mod) => mod.default),
14
- archive: () => import("./archive-CPLXsrzD.mjs").then((mod) => mod.default)
15
- }
16
- });
17
-
18
- //#endregion
19
- export { snippet_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-CLvlEVQo.mjs").then((m) => m.default),
11
- get: () => import("./get-BSJN5TwW.mjs").then((m) => m.default),
12
- metadata: () => import("./metadata-CG4VZ5NW.mjs").then((m) => m.default),
13
- fields: () => import("./fields-9lOrO8UH.mjs").then((m) => m.default),
14
- update: () => import("./update-DBN7yfAk.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-Cl_O4_U4.mjs").then((mod) => mod.default),
11
- get: () => import("./get-DFe2WoJ2.mjs").then((mod) => mod.default),
12
- create: () => import("./create-BWD8H6yw.mjs").then((mod) => mod.default),
13
- update: () => import("./update-CgOPxKXK.mjs").then((mod) => mod.default),
14
- delete: () => import("./delete-tPjicYO4.mjs").then((mod) => mod.default),
15
- "delete-table": () => import("./delete-table-CDj19Qn6.mjs").then((mod) => mod.default),
16
- run: () => import("./run-JXRivkfH.mjs").then((mod) => mod.default),
17
- cancel: () => import("./cancel-D0aBPUhs.mjs").then((mod) => mod.default),
18
- "get-run": () => import("./get-run-hCZaw8-h.mjs").then((mod) => mod.default),
19
- runs: () => import("./runs-FxgbXvax.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-DaESiI72.mjs").then((mod) => mod.default),
11
- get: () => import("./get-CRa-h69C.mjs").then((mod) => mod.default),
12
- create: () => import("./create-DNYFXAsy.mjs").then((mod) => mod.default),
13
- update: () => import("./update-CoVvsU-I.mjs").then((mod) => mod.default),
14
- delete: () => import("./delete-DEFgs5LE.mjs").then((mod) => mod.default)
15
- }
16
- });
17
-
18
- //#endregion
19
- export { transform_job_default as default };
File without changes