monday-cli 0.3.0 → 0.5.0

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 (198) hide show
  1. package/CHANGELOG.md +719 -0
  2. package/README.md +208 -36
  3. package/dist/api/assets.d.ts +326 -0
  4. package/dist/api/assets.d.ts.map +1 -0
  5. package/dist/api/assets.js +519 -0
  6. package/dist/api/assets.js.map +1 -0
  7. package/dist/api/column-types.d.ts +13 -7
  8. package/dist/api/column-types.d.ts.map +1 -1
  9. package/dist/api/column-types.js +7 -3
  10. package/dist/api/column-types.js.map +1 -1
  11. package/dist/api/column-values.d.ts +8 -1
  12. package/dist/api/column-values.d.ts.map +1 -1
  13. package/dist/api/column-values.js +16 -6
  14. package/dist/api/column-values.js.map +1 -1
  15. package/dist/api/documents.d.ts +1652 -0
  16. package/dist/api/documents.d.ts.map +1 -0
  17. package/dist/api/documents.js +2411 -0
  18. package/dist/api/documents.js.map +1 -0
  19. package/dist/api/item-watch.d.ts +263 -0
  20. package/dist/api/item-watch.d.ts.map +1 -0
  21. package/dist/api/item-watch.js +709 -0
  22. package/dist/api/item-watch.js.map +1 -0
  23. package/dist/api/multipart-transport.d.ts +223 -0
  24. package/dist/api/multipart-transport.d.ts.map +1 -0
  25. package/dist/api/multipart-transport.js +274 -0
  26. package/dist/api/multipart-transport.js.map +1 -0
  27. package/dist/api/parallel-dispatch.d.ts +155 -0
  28. package/dist/api/parallel-dispatch.d.ts.map +1 -0
  29. package/dist/api/parallel-dispatch.js +243 -0
  30. package/dist/api/parallel-dispatch.js.map +1 -0
  31. package/dist/api/partial-success-bulk.d.ts +118 -60
  32. package/dist/api/partial-success-bulk.d.ts.map +1 -1
  33. package/dist/api/partial-success-bulk.js +137 -79
  34. package/dist/api/partial-success-bulk.js.map +1 -1
  35. package/dist/api/partial-success-mutation.d.ts +13 -1
  36. package/dist/api/partial-success-mutation.d.ts.map +1 -1
  37. package/dist/api/partial-success-mutation.js +5 -1
  38. package/dist/api/partial-success-mutation.js.map +1 -1
  39. package/dist/api/raw-write.d.ts +13 -4
  40. package/dist/api/raw-write.d.ts.map +1 -1
  41. package/dist/api/raw-write.js +22 -11
  42. package/dist/api/raw-write.js.map +1 -1
  43. package/dist/api/resolve-client.d.ts +11 -0
  44. package/dist/api/resolve-client.d.ts.map +1 -1
  45. package/dist/api/resolve-client.js +9 -1
  46. package/dist/api/resolve-client.js.map +1 -1
  47. package/dist/api/teams.d.ts +657 -0
  48. package/dist/api/teams.d.ts.map +1 -0
  49. package/dist/api/teams.js +880 -0
  50. package/dist/api/teams.js.map +1 -0
  51. package/dist/cli/run.d.ts +20 -0
  52. package/dist/cli/run.d.ts.map +1 -1
  53. package/dist/cli/run.js +1 -0
  54. package/dist/cli/run.js.map +1 -1
  55. package/dist/commands/board/column-create.d.ts +6 -5
  56. package/dist/commands/board/column-create.d.ts.map +1 -1
  57. package/dist/commands/board/column-create.js +9 -6
  58. package/dist/commands/board/column-create.js.map +1 -1
  59. package/dist/commands/completion.d.ts +188 -0
  60. package/dist/commands/completion.d.ts.map +1 -0
  61. package/dist/commands/completion.js +418 -0
  62. package/dist/commands/completion.js.map +1 -0
  63. package/dist/commands/doc/append-markdown.d.ts +117 -0
  64. package/dist/commands/doc/append-markdown.d.ts.map +1 -0
  65. package/dist/commands/doc/append-markdown.js +253 -0
  66. package/dist/commands/doc/append-markdown.js.map +1 -0
  67. package/dist/commands/doc/block-create.d.ts +114 -0
  68. package/dist/commands/doc/block-create.d.ts.map +1 -0
  69. package/dist/commands/doc/block-create.js +206 -0
  70. package/dist/commands/doc/block-create.js.map +1 -0
  71. package/dist/commands/doc/block-delete.d.ts +72 -0
  72. package/dist/commands/doc/block-delete.d.ts.map +1 -0
  73. package/dist/commands/doc/block-delete.js +161 -0
  74. package/dist/commands/doc/block-delete.js.map +1 -0
  75. package/dist/commands/doc/block-update.d.ts +75 -0
  76. package/dist/commands/doc/block-update.d.ts.map +1 -0
  77. package/dist/commands/doc/block-update.js +162 -0
  78. package/dist/commands/doc/block-update.js.map +1 -0
  79. package/dist/commands/doc/create-in-workspace.d.ts +76 -0
  80. package/dist/commands/doc/create-in-workspace.d.ts.map +1 -0
  81. package/dist/commands/doc/create-in-workspace.js +164 -0
  82. package/dist/commands/doc/create-in-workspace.js.map +1 -0
  83. package/dist/commands/doc/create-on-column.d.ts +71 -0
  84. package/dist/commands/doc/create-on-column.d.ts.map +1 -0
  85. package/dist/commands/doc/create-on-column.js +146 -0
  86. package/dist/commands/doc/create-on-column.js.map +1 -0
  87. package/dist/commands/doc/delete.d.ts +68 -0
  88. package/dist/commands/doc/delete.d.ts.map +1 -0
  89. package/dist/commands/doc/delete.js +146 -0
  90. package/dist/commands/doc/delete.js.map +1 -0
  91. package/dist/commands/doc/duplicate.d.ts +101 -0
  92. package/dist/commands/doc/duplicate.d.ts.map +1 -0
  93. package/dist/commands/doc/duplicate.js +191 -0
  94. package/dist/commands/doc/duplicate.js.map +1 -0
  95. package/dist/commands/doc/get.d.ts +46 -0
  96. package/dist/commands/doc/get.d.ts.map +1 -0
  97. package/dist/commands/doc/get.js +95 -0
  98. package/dist/commands/doc/get.js.map +1 -0
  99. package/dist/commands/doc/import-html.d.ts +125 -0
  100. package/dist/commands/doc/import-html.d.ts.map +1 -0
  101. package/dist/commands/doc/import-html.js +273 -0
  102. package/dist/commands/doc/import-html.js.map +1 -0
  103. package/dist/commands/doc/list.d.ts +86 -0
  104. package/dist/commands/doc/list.d.ts.map +1 -0
  105. package/dist/commands/doc/list.js +217 -0
  106. package/dist/commands/doc/list.js.map +1 -0
  107. package/dist/commands/doc/rename.d.ts +60 -0
  108. package/dist/commands/doc/rename.d.ts.map +1 -0
  109. package/dist/commands/doc/rename.js +135 -0
  110. package/dist/commands/doc/rename.js.map +1 -0
  111. package/dist/commands/index.d.ts.map +1 -1
  112. package/dist/commands/index.js +162 -0
  113. package/dist/commands/index.js.map +1 -1
  114. package/dist/commands/item/create.js +2 -2
  115. package/dist/commands/item/update.d.ts +1 -0
  116. package/dist/commands/item/update.d.ts.map +1 -1
  117. package/dist/commands/item/update.js +61 -0
  118. package/dist/commands/item/update.js.map +1 -1
  119. package/dist/commands/item/upload.d.ts +108 -0
  120. package/dist/commands/item/upload.d.ts.map +1 -0
  121. package/dist/commands/item/upload.js +370 -0
  122. package/dist/commands/item/upload.js.map +1 -0
  123. package/dist/commands/item/watch.d.ts +90 -0
  124. package/dist/commands/item/watch.d.ts.map +1 -0
  125. package/dist/commands/item/watch.js +342 -0
  126. package/dist/commands/item/watch.js.map +1 -0
  127. package/dist/commands/update/create.d.ts.map +1 -1
  128. package/dist/commands/update/create.js +6 -4
  129. package/dist/commands/update/create.js.map +1 -1
  130. package/dist/commands/update/edit.d.ts +4 -2
  131. package/dist/commands/update/edit.d.ts.map +1 -1
  132. package/dist/commands/update/edit.js +10 -6
  133. package/dist/commands/update/edit.js.map +1 -1
  134. package/dist/commands/update/reply.d.ts +4 -2
  135. package/dist/commands/update/reply.d.ts.map +1 -1
  136. package/dist/commands/update/reply.js +10 -6
  137. package/dist/commands/update/reply.js.map +1 -1
  138. package/dist/commands/update/upload.d.ts +69 -0
  139. package/dist/commands/update/upload.d.ts.map +1 -0
  140. package/dist/commands/update/upload.js +235 -0
  141. package/dist/commands/update/upload.js.map +1 -0
  142. package/dist/commands/user/_team-membership.d.ts +10 -0
  143. package/dist/commands/user/_team-membership.d.ts.map +1 -0
  144. package/dist/commands/user/_team-membership.js +88 -0
  145. package/dist/commands/user/_team-membership.js.map +1 -0
  146. package/dist/commands/user/team-add-members.d.ts +81 -0
  147. package/dist/commands/user/team-add-members.d.ts.map +1 -0
  148. package/dist/commands/user/team-add-members.js +186 -0
  149. package/dist/commands/user/team-add-members.js.map +1 -0
  150. package/dist/commands/user/team-create.d.ts +82 -0
  151. package/dist/commands/user/team-create.d.ts.map +1 -0
  152. package/dist/commands/user/team-create.js +206 -0
  153. package/dist/commands/user/team-create.js.map +1 -0
  154. package/dist/commands/user/team-delete.d.ts +56 -0
  155. package/dist/commands/user/team-delete.d.ts.map +1 -0
  156. package/dist/commands/user/team-delete.js +137 -0
  157. package/dist/commands/user/team-delete.js.map +1 -0
  158. package/dist/commands/user/team-get.d.ts +41 -0
  159. package/dist/commands/user/team-get.d.ts.map +1 -0
  160. package/dist/commands/user/team-get.js +87 -0
  161. package/dist/commands/user/team-get.js.map +1 -0
  162. package/dist/commands/user/team-list.d.ts +39 -0
  163. package/dist/commands/user/team-list.d.ts.map +1 -0
  164. package/dist/commands/user/team-list.js +90 -0
  165. package/dist/commands/user/team-list.js.map +1 -0
  166. package/dist/commands/user/team-remove-members.d.ts +71 -0
  167. package/dist/commands/user/team-remove-members.d.ts.map +1 -0
  168. package/dist/commands/user/team-remove-members.js +176 -0
  169. package/dist/commands/user/team-remove-members.js.map +1 -0
  170. package/dist/types/ids.d.ts +8 -0
  171. package/dist/types/ids.d.ts.map +1 -1
  172. package/dist/types/ids.js +53 -5
  173. package/dist/types/ids.js.map +1 -1
  174. package/dist/utils/mime.d.ts +24 -0
  175. package/dist/utils/mime.d.ts.map +1 -0
  176. package/dist/utils/mime.js +64 -0
  177. package/dist/utils/mime.js.map +1 -0
  178. package/dist/utils/output/envelope.d.ts +30 -0
  179. package/dist/utils/output/envelope.d.ts.map +1 -1
  180. package/dist/utils/output/envelope.js +26 -0
  181. package/dist/utils/output/envelope.js.map +1 -1
  182. package/dist/utils/output/ndjson.d.ts +25 -0
  183. package/dist/utils/output/ndjson.d.ts.map +1 -1
  184. package/dist/utils/output/ndjson.js +12 -0
  185. package/dist/utils/output/ndjson.js.map +1 -1
  186. package/dist/utils/parse-brand-list.d.ts +95 -0
  187. package/dist/utils/parse-brand-list.d.ts.map +1 -0
  188. package/dist/utils/parse-brand-list.js +96 -0
  189. package/dist/utils/parse-brand-list.js.map +1 -0
  190. package/dist/utils/signal.d.ts +42 -0
  191. package/dist/utils/signal.d.ts.map +1 -0
  192. package/dist/utils/signal.js +45 -0
  193. package/dist/utils/signal.js.map +1 -0
  194. package/dist/utils/source-content.d.ts +93 -0
  195. package/dist/utils/source-content.d.ts.map +1 -0
  196. package/dist/utils/source-content.js +120 -0
  197. package/dist/utils/source-content.js.map +1 -0
  198. package/package.json +1 -1
@@ -0,0 +1,101 @@
1
+ /**
2
+ * `monday doc duplicate <doc-id> [--with-updates] [--dry-run]` —
3
+ * duplicate an existing workdoc (`cli-design.md` §4.3 DOC section
4
+ * + §13 v0.5 entry; `v0.5-plan.md` §3 M35 + §8 D7-D9).
5
+ *
6
+ * **Wire shape.** Single `duplicate_doc(docId, duplicateType?)`
7
+ * round-trip via {@link duplicateDoc} against `mutation
8
+ * DuplicateDoc` with `operationName: 'DuplicateDoc'` (R-NEW-37 W2
9
+ * audit-point). Returns Monday's opaque `JSON` scalar — the
10
+ * fetcher projects to the flat `{ doc_id: <NEW>, success: true }`
11
+ * envelope per D9. The `doc_id` echoes the **NEWLY-CREATED**
12
+ * duplicate's id (NOT the source-doc positional id) — the
13
+ * fetcher's `extractDuplicateDocId` helper pulls the new id from
14
+ * the opaque JSON payload defensively (the v0.5 probe was
15
+ * read-only, so the helper accepts plausible shapes today;
16
+ * a future live wire response would let a follow-up commit
17
+ * narrow the accepted shapes).
18
+ *
19
+ * **`--with-updates` semantics.** Monday's `duplicate_doc.
20
+ * duplicateType` is a 2-value enum (`duplicate_doc_with_content`
21
+ * / `duplicate_doc_with_content_and_updates`); the wire-side
22
+ * default is `duplicate_doc_with_content` (content-only). The
23
+ * CLI surfaces a boolean opt-in `--with-updates`:
24
+ *
25
+ * - absent → omit the wire variable (Monday's wire-side default
26
+ * `duplicate_doc_with_content` applies — comments and update
27
+ * history are NOT copied).
28
+ * - present → wire `duplicateType:
29
+ * 'duplicate_doc_with_content_and_updates'` (clone body +
30
+ * every comment / update thread).
31
+ *
32
+ * The 2-value enum stays internal to the fetcher; agents see a
33
+ * boolean opt-in, not the wire enum name.
34
+ *
35
+ * **No `--name <n>` slot per D8.** Monday's `duplicate_doc`
36
+ * mutation carries no rename-on-duplicate arg on the wire — the
37
+ * duplicate inherits Monday's auto-generated copy name (typically
38
+ * `"Copy of <source-name>"`). Agents needing a renamed duplicate
39
+ * pair this verb with a follow-up `monday doc rename <new-id>
40
+ * --name <n>` call. Adding the slot speculatively was the D8
41
+ * alternative (CLI would have wrapped a non-atomic
42
+ * duplicate→rename sequence); pre-flight ratified the drop
43
+ * because non-atomic cross-mutation flows leak partial-failure
44
+ * complexity into the verb's envelope shape (one operation
45
+ * succeeded, one failed → the verb's envelope shape doesn't fit
46
+ * cli-design §6.1 single-mutation success/failure dichotomy).
47
+ *
48
+ * **camelCase wire-arg note.** `duplicate_doc` takes camelCase
49
+ * `docId` + `duplicateType` on the wire (Finding 7) — see the
50
+ * canonical asymmetry note at `src/api/documents.ts` module
51
+ * header (4th supporting site for R-NEW-41).
52
+ *
53
+ * **Argv shape.**
54
+ *
55
+ * - `<doc-id>` — required positional (Monday's
56
+ * `duplicate_doc.docId` is `ID!`). Brand-validated via
57
+ * {@link DocIdSchema}. Echoed in error envelopes; **NOT
58
+ * echoed in the success envelope** (the success envelope's
59
+ * `doc_id` slot carries the NEW duplicate's id per D9).
60
+ * - `--with-updates` — optional boolean. Absent → wire-side
61
+ * default `duplicate_doc_with_content`; present → wire
62
+ * `duplicate_doc_with_content_and_updates`.
63
+ *
64
+ * **Output envelope.** Projected from Monday's opaque JSON return
65
+ * per D9 — `data: { doc_id: <NEW>, success: true }`. The
66
+ * `doc_id` slot is the new duplicate's id, NOT the source-doc
67
+ * positional. Source-doc id stays accessible via the argv
68
+ * (agents script `monday doc duplicate <source-id> | jq` and
69
+ * see the new id in the projection).
70
+ *
71
+ * **Dry-run shape** per cli-design §6.4 mutation-dry-run variant:
72
+ * minimal `{operation: "duplicate_doc", doc_id: <source>,
73
+ * duplicate_type?}`. The `doc_id` slot in the dry-run echoes the
74
+ * SOURCE id (not the new-id — Monday's wire is the only entity
75
+ * that can mint a new DocId at duplicate-time). No preflight
76
+ * read fires; `meta.source: 'none'`.
77
+ *
78
+ * **Idempotent: false.** Re-running creates a SECOND duplicate
79
+ * (Monday's wire does NOT dedupe by source-id). The source-doc's
80
+ * `id` stays addressable; the duplicates accrete.
81
+ *
82
+ * **Runtime body landed at v0.5-M35 IMPL.** `parseArgv` runs
83
+ * BEFORE `resolveClient` so invalid argv surfaces `usage_error`
84
+ * ahead of any missing-token `config_error`; `resolveClient`
85
+ * parses global flags internally before `loadConfig`. Dry-run
86
+ * path emits minimal planned changes (no wire call fires); live
87
+ * path dispatches {@link duplicateDoc} + projects via
88
+ * `emitMutation`. The `--with-updates` boolean maps to wire
89
+ * `duplicateType` per the M34 omit-vs-null discipline (absent →
90
+ * omit; present → `duplicate_doc_with_content_and_updates`).
91
+ */
92
+ import { z } from 'zod';
93
+ import { type CommandModule } from '../types.js';
94
+ import { type DocDuplicateOutput } from '../../api/documents.js';
95
+ declare const inputSchema: z.ZodObject<{
96
+ docId: z.core.$ZodBranded<z.ZodString, "DocId", "out">;
97
+ withUpdates: z.ZodOptional<z.ZodBoolean>;
98
+ }, z.core.$strict>;
99
+ export declare const docDuplicateCommand: CommandModule<z.infer<typeof inputSchema>, DocDuplicateOutput>;
100
+ export {};
101
+ //# sourceMappingURL=duplicate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duplicate.d.ts","sourceRoot":"","sources":["../../../src/commands/doc/duplicate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0FG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAKnE,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,wBAAwB,CAAC;AAEhC,QAAA,MAAM,WAAW;;;kBAKN,CAAC;AAEZ,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAC7C,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,EAC3B,kBAAkB,CAoGnB,CAAC"}
@@ -0,0 +1,191 @@
1
+ /**
2
+ * `monday doc duplicate <doc-id> [--with-updates] [--dry-run]` —
3
+ * duplicate an existing workdoc (`cli-design.md` §4.3 DOC section
4
+ * + §13 v0.5 entry; `v0.5-plan.md` §3 M35 + §8 D7-D9).
5
+ *
6
+ * **Wire shape.** Single `duplicate_doc(docId, duplicateType?)`
7
+ * round-trip via {@link duplicateDoc} against `mutation
8
+ * DuplicateDoc` with `operationName: 'DuplicateDoc'` (R-NEW-37 W2
9
+ * audit-point). Returns Monday's opaque `JSON` scalar — the
10
+ * fetcher projects to the flat `{ doc_id: <NEW>, success: true }`
11
+ * envelope per D9. The `doc_id` echoes the **NEWLY-CREATED**
12
+ * duplicate's id (NOT the source-doc positional id) — the
13
+ * fetcher's `extractDuplicateDocId` helper pulls the new id from
14
+ * the opaque JSON payload defensively (the v0.5 probe was
15
+ * read-only, so the helper accepts plausible shapes today;
16
+ * a future live wire response would let a follow-up commit
17
+ * narrow the accepted shapes).
18
+ *
19
+ * **`--with-updates` semantics.** Monday's `duplicate_doc.
20
+ * duplicateType` is a 2-value enum (`duplicate_doc_with_content`
21
+ * / `duplicate_doc_with_content_and_updates`); the wire-side
22
+ * default is `duplicate_doc_with_content` (content-only). The
23
+ * CLI surfaces a boolean opt-in `--with-updates`:
24
+ *
25
+ * - absent → omit the wire variable (Monday's wire-side default
26
+ * `duplicate_doc_with_content` applies — comments and update
27
+ * history are NOT copied).
28
+ * - present → wire `duplicateType:
29
+ * 'duplicate_doc_with_content_and_updates'` (clone body +
30
+ * every comment / update thread).
31
+ *
32
+ * The 2-value enum stays internal to the fetcher; agents see a
33
+ * boolean opt-in, not the wire enum name.
34
+ *
35
+ * **No `--name <n>` slot per D8.** Monday's `duplicate_doc`
36
+ * mutation carries no rename-on-duplicate arg on the wire — the
37
+ * duplicate inherits Monday's auto-generated copy name (typically
38
+ * `"Copy of <source-name>"`). Agents needing a renamed duplicate
39
+ * pair this verb with a follow-up `monday doc rename <new-id>
40
+ * --name <n>` call. Adding the slot speculatively was the D8
41
+ * alternative (CLI would have wrapped a non-atomic
42
+ * duplicate→rename sequence); pre-flight ratified the drop
43
+ * because non-atomic cross-mutation flows leak partial-failure
44
+ * complexity into the verb's envelope shape (one operation
45
+ * succeeded, one failed → the verb's envelope shape doesn't fit
46
+ * cli-design §6.1 single-mutation success/failure dichotomy).
47
+ *
48
+ * **camelCase wire-arg note.** `duplicate_doc` takes camelCase
49
+ * `docId` + `duplicateType` on the wire (Finding 7) — see the
50
+ * canonical asymmetry note at `src/api/documents.ts` module
51
+ * header (4th supporting site for R-NEW-41).
52
+ *
53
+ * **Argv shape.**
54
+ *
55
+ * - `<doc-id>` — required positional (Monday's
56
+ * `duplicate_doc.docId` is `ID!`). Brand-validated via
57
+ * {@link DocIdSchema}. Echoed in error envelopes; **NOT
58
+ * echoed in the success envelope** (the success envelope's
59
+ * `doc_id` slot carries the NEW duplicate's id per D9).
60
+ * - `--with-updates` — optional boolean. Absent → wire-side
61
+ * default `duplicate_doc_with_content`; present → wire
62
+ * `duplicate_doc_with_content_and_updates`.
63
+ *
64
+ * **Output envelope.** Projected from Monday's opaque JSON return
65
+ * per D9 — `data: { doc_id: <NEW>, success: true }`. The
66
+ * `doc_id` slot is the new duplicate's id, NOT the source-doc
67
+ * positional. Source-doc id stays accessible via the argv
68
+ * (agents script `monday doc duplicate <source-id> | jq` and
69
+ * see the new id in the projection).
70
+ *
71
+ * **Dry-run shape** per cli-design §6.4 mutation-dry-run variant:
72
+ * minimal `{operation: "duplicate_doc", doc_id: <source>,
73
+ * duplicate_type?}`. The `doc_id` slot in the dry-run echoes the
74
+ * SOURCE id (not the new-id — Monday's wire is the only entity
75
+ * that can mint a new DocId at duplicate-time). No preflight
76
+ * read fires; `meta.source: 'none'`.
77
+ *
78
+ * **Idempotent: false.** Re-running creates a SECOND duplicate
79
+ * (Monday's wire does NOT dedupe by source-id). The source-doc's
80
+ * `id` stays addressable; the duplicates accrete.
81
+ *
82
+ * **Runtime body landed at v0.5-M35 IMPL.** `parseArgv` runs
83
+ * BEFORE `resolveClient` so invalid argv surfaces `usage_error`
84
+ * ahead of any missing-token `config_error`; `resolveClient`
85
+ * parses global flags internally before `loadConfig`. Dry-run
86
+ * path emits minimal planned changes (no wire call fires); live
87
+ * path dispatches {@link duplicateDoc} + projects via
88
+ * `emitMutation`. The `--with-updates` boolean maps to wire
89
+ * `duplicateType` per the M34 omit-vs-null discipline (absent →
90
+ * omit; present → `duplicate_doc_with_content_and_updates`).
91
+ */
92
+ import { z } from 'zod';
93
+ import { ensureSubcommand } from '../types.js';
94
+ import { parseArgv } from '../parse-argv.js';
95
+ import { emitDryRun, emitMutation } from '../emit.js';
96
+ import { resolveClient } from '../../api/resolve-client.js';
97
+ import { DocIdSchema } from '../../types/ids.js';
98
+ import { duplicateDoc, docDuplicateOutputSchema, } from '../../api/documents.js';
99
+ const inputSchema = z
100
+ .object({
101
+ docId: DocIdSchema,
102
+ withUpdates: z.boolean().optional(),
103
+ })
104
+ .strict();
105
+ export const docDuplicateCommand = {
106
+ name: 'doc.duplicate',
107
+ summary: 'Duplicate a workdoc (content-only by default; --with-updates also clones comments + update history)',
108
+ examples: [
109
+ 'monday doc duplicate 12345678',
110
+ 'monday doc duplicate 12345678 --with-updates',
111
+ 'monday doc duplicate 12345678 --with-updates --dry-run --json',
112
+ ],
113
+ // Monday's wire allows multiple duplicates per source; verb is
114
+ // non-idempotent (each call mints a new DocId).
115
+ idempotent: false,
116
+ inputSchema,
117
+ outputSchema: docDuplicateOutputSchema,
118
+ attach: (program, ctx) => {
119
+ const noun = ensureSubcommand(program, 'doc', 'Workdoc commands');
120
+ noun
121
+ .command('duplicate <docId>')
122
+ .description(docDuplicateCommand.summary)
123
+ .option('--with-updates', 'clone comments + update history alongside the doc body (maps to wire `duplicateType: duplicate_doc_with_content_and_updates`); absent → content-only')
124
+ .addHelpText('after', [
125
+ '',
126
+ 'Examples:',
127
+ ...docDuplicateCommand.examples.map((e) => ` ${e}`),
128
+ '',
129
+ 'Notes:',
130
+ ' - Envelope `data.doc_id` is the NEW duplicate\'s id (not the source-doc positional). Source-doc id stays available via the argv (D9 closure).',
131
+ ' - Monday\'s wire offers no rename-on-duplicate slot; the duplicate inherits Monday\'s auto-generated copy name. Pair with `monday doc rename <new-id> --name <n>` for a renamed duplicate (D8 closure).',
132
+ ' - `--dry-run` emits the planned `duplicate_doc` operation + resolved input fields (no wire call fires; `meta.source: "none"`).',
133
+ '',
134
+ ].join('\n'))
135
+ .action(async (docIdArg, opts) => {
136
+ const parsed = parseArgv(docDuplicateCommand.inputSchema, {
137
+ docId: docIdArg,
138
+ ...opts,
139
+ });
140
+ const { client, globalFlags, apiVersion } = resolveClient(ctx, program.opts());
141
+ // Map the CLI's boolean `--with-updates` flag to Monday's
142
+ // 2-value `DuplicateType` enum: absent → omit the wire
143
+ // variable (Monday's wire-side default content-only applies);
144
+ // present → opt into the with-updates variant.
145
+ const duplicateType = parsed.withUpdates === true
146
+ ? 'duplicate_doc_with_content_and_updates'
147
+ : undefined;
148
+ if (globalFlags.dryRun) {
149
+ const planned = {
150
+ operation: 'duplicate_doc',
151
+ // Dry-run echoes the SOURCE id (the new-id is wire-only
152
+ // — only Monday can mint it). Live envelope swaps in
153
+ // the new-id; dry-run + live envelopes' `doc_id` slots
154
+ // are intentionally different per D9 prose at
155
+ // `src/api/documents.ts`.
156
+ doc_id: parsed.docId,
157
+ };
158
+ if (duplicateType !== undefined) {
159
+ planned.duplicate_type = duplicateType;
160
+ }
161
+ emitDryRun({
162
+ ctx,
163
+ programOpts: program.opts(),
164
+ plannedChanges: [planned],
165
+ source: 'none',
166
+ cacheAgeSeconds: null,
167
+ warnings: [],
168
+ apiVersion,
169
+ });
170
+ return;
171
+ }
172
+ const result = await duplicateDoc({
173
+ client,
174
+ docId: parsed.docId,
175
+ ...(duplicateType === undefined ? {} : { duplicateType }),
176
+ });
177
+ emitMutation({
178
+ ctx,
179
+ data: result.result,
180
+ schema: docDuplicateCommand.outputSchema,
181
+ programOpts: program.opts(),
182
+ warnings: [],
183
+ source: result.source,
184
+ cacheAgeSeconds: result.cacheAgeSeconds,
185
+ complexity: result.complexity,
186
+ apiVersion,
187
+ });
188
+ });
189
+ },
190
+ };
191
+ //# sourceMappingURL=duplicate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duplicate.js","sourceRoot":"","sources":["../../../src/commands/doc/duplicate.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * `monday doc get <did>` — read a single workdoc by ID, including
3
+ * its rich-text block body (cli-design.md §4.3 DOC section + §13
4
+ * v0.4 entry; v0.4-plan.md §3 M32).
5
+ *
6
+ * **Wire shape.** Single `Query.docs(ids: [<did>])` round-trip via
7
+ * {@link getDocument} against `query GetDoc` with `operationName:
8
+ * 'GetDoc'` (R-NEW-37 W2 audit-point). Monday returns `[Document]`
9
+ * (an array even for a single-id query); the fetcher extracts
10
+ * index 0. Empty array → `not_found` with `details.doc_id` (D8 —
11
+ * Monday's wire surface collapses "doesn't exist" + "exists but
12
+ * inaccessible to token" into the same shape; the CLI can't
13
+ * distinguish them).
14
+ *
15
+ * **Output envelope (D9).** Direct unwrap of the Document — `data:
16
+ * <Document with blocks>`. Mirrors the read-one-verb convention
17
+ * (`monday board get <bid>` returns `data: <Board>`, `monday user
18
+ * get <uid>` returns `data: <User>`). The Document's own `id`
19
+ * field is the echoed input; no separate `doc_id` slot is needed.
20
+ * `data.blocks: [DocumentBlock]` is the rich-text body hydrated
21
+ * from `Document.blocks` (always present on success — never null
22
+ * for a doc that resolved).
23
+ *
24
+ * **Docs are live-only at v0.4-M32** per cli-design §8 cache
25
+ * scope. Output `meta.source: "live"`, `meta.cache_age_seconds:
26
+ * null`. Per-doc body content is content-heavy + frequently
27
+ * human-edited; the stale-cache risk outweighs the cache-hit
28
+ * value.
29
+ *
30
+ * **Idempotent: yes** (pure read).
31
+ *
32
+ * **Runtime body landed at v0.4-M32 IMPL.** Argv parsing + schema +
33
+ * commander wiring all ship as the real shipped surface; the action
34
+ * body's wire-call dispatch + envelope emit are below. The verb is
35
+ * a thin wrapper around {@link getDocument} — branded `<docId>` →
36
+ * fetcher → direct-unwrap envelope.
37
+ */
38
+ import { z } from 'zod';
39
+ import { type CommandModule } from '../types.js';
40
+ import { type DocGetOutput } from '../../api/documents.js';
41
+ declare const inputSchema: z.ZodObject<{
42
+ docId: z.core.$ZodBranded<z.ZodString, "DocId", "out">;
43
+ }, z.core.$strict>;
44
+ export declare const docGetCommand: CommandModule<z.infer<typeof inputSchema>, DocGetOutput>;
45
+ export {};
46
+ //# sourceMappingURL=get.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/doc/get.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAKnE,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,wBAAwB,CAAC;AAEhC,QAAA,MAAM,WAAW;;kBAA4C,CAAC;AAE9D,eAAO,MAAM,aAAa,EAAE,aAAa,CACvC,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,EAC3B,YAAY,CAyDb,CAAC"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * `monday doc get <did>` — read a single workdoc by ID, including
3
+ * its rich-text block body (cli-design.md §4.3 DOC section + §13
4
+ * v0.4 entry; v0.4-plan.md §3 M32).
5
+ *
6
+ * **Wire shape.** Single `Query.docs(ids: [<did>])` round-trip via
7
+ * {@link getDocument} against `query GetDoc` with `operationName:
8
+ * 'GetDoc'` (R-NEW-37 W2 audit-point). Monday returns `[Document]`
9
+ * (an array even for a single-id query); the fetcher extracts
10
+ * index 0. Empty array → `not_found` with `details.doc_id` (D8 —
11
+ * Monday's wire surface collapses "doesn't exist" + "exists but
12
+ * inaccessible to token" into the same shape; the CLI can't
13
+ * distinguish them).
14
+ *
15
+ * **Output envelope (D9).** Direct unwrap of the Document — `data:
16
+ * <Document with blocks>`. Mirrors the read-one-verb convention
17
+ * (`monday board get <bid>` returns `data: <Board>`, `monday user
18
+ * get <uid>` returns `data: <User>`). The Document's own `id`
19
+ * field is the echoed input; no separate `doc_id` slot is needed.
20
+ * `data.blocks: [DocumentBlock]` is the rich-text body hydrated
21
+ * from `Document.blocks` (always present on success — never null
22
+ * for a doc that resolved).
23
+ *
24
+ * **Docs are live-only at v0.4-M32** per cli-design §8 cache
25
+ * scope. Output `meta.source: "live"`, `meta.cache_age_seconds:
26
+ * null`. Per-doc body content is content-heavy + frequently
27
+ * human-edited; the stale-cache risk outweighs the cache-hit
28
+ * value.
29
+ *
30
+ * **Idempotent: yes** (pure read).
31
+ *
32
+ * **Runtime body landed at v0.4-M32 IMPL.** Argv parsing + schema +
33
+ * commander wiring all ship as the real shipped surface; the action
34
+ * body's wire-call dispatch + envelope emit are below. The verb is
35
+ * a thin wrapper around {@link getDocument} — branded `<docId>` →
36
+ * fetcher → direct-unwrap envelope.
37
+ */
38
+ import { z } from 'zod';
39
+ import { ensureSubcommand } from '../types.js';
40
+ import { parseArgv } from '../parse-argv.js';
41
+ import { emitSuccess } from '../emit.js';
42
+ import { resolveClient } from '../../api/resolve-client.js';
43
+ import { DocIdSchema } from '../../types/ids.js';
44
+ import { docGetOutputSchema, getDocument, } from '../../api/documents.js';
45
+ const inputSchema = z.object({ docId: DocIdSchema }).strict();
46
+ export const docGetCommand = {
47
+ name: 'doc.get',
48
+ summary: 'Read a single workdoc by ID (includes block body)',
49
+ examples: [
50
+ 'monday doc get 12345678',
51
+ 'monday doc get 12345678 --json',
52
+ ],
53
+ idempotent: true,
54
+ inputSchema,
55
+ outputSchema: docGetOutputSchema,
56
+ attach: (program, ctx) => {
57
+ const noun = ensureSubcommand(program, 'doc', 'Document commands (workdocs; read-only at v0.4 — see cli-design §13 v0.4 entry)');
58
+ noun
59
+ .command('get <docId>')
60
+ .description(docGetCommand.summary)
61
+ .addHelpText('after', [
62
+ '',
63
+ 'Examples:',
64
+ ...docGetCommand.examples.map((e) => ` ${e}`),
65
+ '',
66
+ 'Notes:',
67
+ ' - Output carries the full Document plus `blocks: [DocumentBlock]` (rich-text body).',
68
+ ' - Non-existent + inaccessible docs both surface `not_found` (Monday\'s wire collapses both cases).',
69
+ '',
70
+ ].join('\n'))
71
+ .action(async (docIdArg) => {
72
+ const parsed = parseArgv(docGetCommand.inputSchema, {
73
+ docId: docIdArg,
74
+ });
75
+ const { client, apiVersion } = resolveClient(ctx, program.opts());
76
+ const result = await getDocument({
77
+ client,
78
+ docId: parsed.docId,
79
+ });
80
+ emitSuccess({
81
+ ctx,
82
+ data: result.document,
83
+ schema: docGetCommand.outputSchema,
84
+ programOpts: program.opts(),
85
+ kind: 'single',
86
+ warnings: [],
87
+ source: result.source,
88
+ cacheAgeSeconds: result.cacheAgeSeconds,
89
+ complexity: result.complexity,
90
+ apiVersion,
91
+ });
92
+ });
93
+ },
94
+ };
95
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/doc/get.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAsB,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EACL,kBAAkB,EAClB,WAAW,GAEZ,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAE9D,MAAM,CAAC,MAAM,aAAa,GAGtB;IACF,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,mDAAmD;IAC5D,QAAQ,EAAE;QACR,yBAAyB;QACzB,gCAAgC;KACjC;IACD,UAAU,EAAE,IAAI;IAChB,WAAW;IACX,YAAY,EAAE,kBAAkB;IAChC,MAAM,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE;QACvB,MAAM,IAAI,GAAG,gBAAgB,CAC3B,OAAO,EACP,KAAK,EACL,iFAAiF,CAClF,CAAC;QACF,IAAI;aACD,OAAO,CAAC,aAAa,CAAC;aACtB,WAAW,CAAC,aAAa,CAAC,OAAO,CAAC;aAClC,WAAW,CACV,OAAO,EACP;YACE,EAAE;YACF,WAAW;YACX,GAAG,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9C,EAAE;YACF,QAAQ;YACR,uFAAuF;YACvF,sGAAsG;YACtG,EAAE;SACH,CAAC,IAAI,CAAC,IAAI,CAAC,CACb;aACA,MAAM,CAAC,KAAK,EAAE,QAAiB,EAAE,EAAE;YAClC,MAAM,MAAM,GAAG,SAAS,CAAC,aAAa,CAAC,WAAW,EAAE;gBAClD,KAAK,EAAE,QAAQ;aAChB,CAAC,CAAC;YAEH,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;YAClE,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC;gBAC/B,MAAM;gBACN,KAAK,EAAE,MAAM,CAAC,KAAK;aACpB,CAAC,CAAC;YACH,WAAW,CAAC;gBACV,GAAG;gBACH,IAAI,EAAE,MAAM,CAAC,QAAQ;gBACrB,MAAM,EAAE,aAAa,CAAC,YAAY;gBAClC,WAAW,EAAE,OAAO,CAAC,IAAI,EAAE;gBAC3B,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,EAAE;gBACZ,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,eAAe,EAAE,MAAM,CAAC,eAAe;gBACvC,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,UAAU;aACX,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACF,CAAC"}
@@ -0,0 +1,125 @@
1
+ /**
2
+ * `monday doc import-html --workspace <wid> (--html <file|-> |
3
+ * --html-string <s>) [--folder <fid>] [--kind public|private|share]
4
+ * [--title <t>] [--dry-run]` — import an HTML payload as a new workdoc
5
+ * (`cli-design.md` §4.3 DOC section + §13 v0.5 entry;
6
+ * `v0.5-plan.md` §3 M37 + §8 D12-D13).
7
+ *
8
+ * **Wire shape.** Single `import_doc_from_html(html, workspaceId,
9
+ * kind?, folderId?, title?) → ImportDocFromHtmlResult` round-trip via
10
+ * {@link importDocFromHtml} against `mutation ImportDocFromHtml` with
11
+ * `operationName: 'ImportDocFromHtml'` (R-NEW-37 W2 audit-point).
12
+ * Custom-OBJECT return shape: `{success!, doc_id?, error?}` —
13
+ * distinct from M35's opaque-JSON projection and M36's typed-OBJECT
14
+ * direct-unwrap (third doc-mutation return shape; see
15
+ * `src/api/documents.ts` M37 section header for the full taxonomy).
16
+ *
17
+ * **camelCase wire-arg note.** `import_doc_from_html` uses camelCase
18
+ * `workspaceId` / `folderId` on the wire (Finding 7); CLI argv stays
19
+ * kebab-case (`--workspace <wid>` / `--folder <fid>`); error envelope
20
+ * `details.*` keys stay snake_case (`details.workspace_id` /
21
+ * `details.folder_id`) per cli-design §6.5. See the canonical
22
+ * asymmetry note at `src/api/documents.ts` module header (5th
23
+ * supporting site for R-NEW-41).
24
+ *
25
+ * **Argv shape.**
26
+ *
27
+ * - `--workspace <wid>` — required (Monday's
28
+ * `import_doc_from_html.workspaceId` is `ID!`). Numeric workspace
29
+ * ID; brand-validated via {@link WorkspaceIdSchema} at the parse
30
+ * boundary.
31
+ * - `--html <file|->` OR `--html-string <s>` — **mutually-exclusive
32
+ * content source; exactly one required.** Both forms supply the
33
+ * HTML payload that Monday parses into a new doc; the source path
34
+ * vs inline-string split mirrors M13's `update reply / edit`
35
+ * `--body-file <path>` vs `--body <md>` shape. The file path form
36
+ * supports `-` for stdin (read up to EOF; cli-design §3.1 stdin
37
+ * discipline). The inline form caps at
38
+ * {@link MAX_DOC_IMPORT_PAYLOAD_BYTES} bytes at the parse
39
+ * boundary per D13 closure (empirical wire threshold sits
40
+ * between 250KB-OK and 500KB-rejected). The file/stdin form
41
+ * applies the same size guard at the runtime read boundary
42
+ * (defense-in-depth via the lifted {@link readSourceContent}
43
+ * helper's `maxBytes` slot).
44
+ * - `--folder <fid>` — optional (maps to wire `folderId: ID`).
45
+ * Numeric folder ID; brand-validated via {@link DocFolderIdSchema}.
46
+ * Absent → doc lands at workspace root.
47
+ * - `--kind <k>` — optional 3-value closed enum
48
+ * (`public` / `private` / `share`); maps to wire `kind: DocKind`.
49
+ * Absent → Monday applies the wire-side default `public` per
50
+ * probe description ("Defaults to 'public' if not specified").
51
+ * - `--title <t>` — optional, non-empty (maps to wire
52
+ * `title: String`). Absent → Monday infers the title from the
53
+ * HTML content per probe description ("If not provided, the
54
+ * title will be inferred from the HTML content").
55
+ *
56
+ * **Output envelope.** Custom-OBJECT projection per D12 — `data: {
57
+ * doc_id, success: true }` mirroring M35's
58
+ * {@link docMutationResultSchema} cadence so agents read a uniform
59
+ * `{ doc_id, success }` shape across rename / delete / duplicate /
60
+ * import-html. The `doc_id` slot carries the NEWLY-CREATED doc's id
61
+ * (extracted from `ImportDocFromHtmlResult.doc_id`).
62
+ *
63
+ * **Failure mapping** per D12 closure:
64
+ *
65
+ * - `success: false + populated error` → `validation_failed` with
66
+ * `details: { workspace_id, error, hint }`.
67
+ * - `success: false + empty/null error` → `internal_error` with
68
+ * wire-regression hint.
69
+ * - `success: true + missing/null doc_id` → `internal_error`
70
+ * (Monday promises a non-null `doc_id` on success).
71
+ * - Oversized inline `--html-string` at parse boundary →
72
+ * `usage_error.details.issues[{path: 'htmlString', message:
73
+ * '--html-string exceeds the 256000-byte wire-side limit ...'}]`
74
+ * from `parseArgv`'s zod-issues envelope (D13 closure). The
75
+ * `usage_error` rejection surfaces ahead of any wire dispatch.
76
+ * - Oversized file payload at runtime →
77
+ * `readSourceContent` rejects with `usage_error` carrying
78
+ * `details: { source: 'file' | 'stdin', size_bytes, limit_bytes,
79
+ * file_path? }`.
80
+ *
81
+ * **Dry-run shape** per cli-design §6.4 mutation-dry-run variant.
82
+ * Minimal envelope listing the planned `import_doc_from_html`
83
+ * operation + the resolved input fields (`workspace_id`, optional
84
+ * `folder_id`, optional `kind`, optional `title`, `html_source`
85
+ * descriptor — file path / `'(stdin)'` / `'(inline)'`). Does NOT
86
+ * include the HTML payload itself (which could be hundreds of KB);
87
+ * agents see WHAT would be sent, not the bytes. No preflight read
88
+ * fires; `meta.source: 'none'`.
89
+ *
90
+ * **Idempotent: false.** Re-running creates a duplicate doc with a
91
+ * fresh id (Monday's wire does not dedupe by HTML content or title).
92
+ * Agents that need idempotency must pair with a `monday doc list
93
+ * --workspace <wid>` lookup first.
94
+ *
95
+ * **Permission-sensitive.** Tokens lacking workdoc-create scope on
96
+ * the target workspace surface `forbidden` (mapped from Monday's
97
+ * PERMISSION_DENIED extension).
98
+ *
99
+ * **Runtime body landed at v0.5-M37 IMPL.** `parseArgv` runs BEFORE
100
+ * `resolveClient` so invalid argv surfaces `usage_error` ahead of any
101
+ * missing-token `config_error`; the lifted {@link readSourceContent}
102
+ * helper applies the same size guard at the runtime read boundary
103
+ * (file/stdin path) that the schema's `.refine()` applies at parse
104
+ * boundary (inline path). Dry-run emits minimal planned changes with
105
+ * the source descriptor; live path dispatches
106
+ * {@link importDocFromHtml} + projects via `emitMutation`.
107
+ */
108
+ import { z } from 'zod';
109
+ import { type CommandModule } from '../types.js';
110
+ import { type DocImportHtmlOutput } from '../../api/documents.js';
111
+ declare const inputSchema: z.ZodObject<{
112
+ workspace: z.core.$ZodBranded<z.ZodString, "WorkspaceId", "out">;
113
+ html: z.ZodOptional<z.ZodString>;
114
+ htmlString: z.ZodOptional<z.ZodString>;
115
+ folder: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "DocFolderId", "out">>;
116
+ kind: z.ZodOptional<z.ZodEnum<{
117
+ public: "public";
118
+ private: "private";
119
+ share: "share";
120
+ }>>;
121
+ title: z.ZodOptional<z.ZodString>;
122
+ }, z.core.$strict>;
123
+ export declare const docImportHtmlCommand: CommandModule<z.infer<typeof inputSchema>, DocImportHtmlOutput>;
124
+ export {};
125
+ //# sourceMappingURL=import-html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-html.d.ts","sourceRoot":"","sources":["../../../src/commands/doc/import-html.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0GG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAKnE,OAAO,EAKL,KAAK,mBAAmB,EACzB,MAAM,wBAAwB,CAAC;AAGhC,QAAA,MAAM,WAAW;;;;;;;;;;;kBA6Cd,CAAC;AAoBJ,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAC9C,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,EAC3B,mBAAmB,CAqHpB,CAAC"}