monday-cli 0.4.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 (122) hide show
  1. package/CHANGELOG.md +368 -0
  2. package/README.md +112 -34
  3. package/dist/api/column-types.d.ts +3 -1
  4. package/dist/api/column-types.d.ts.map +1 -1
  5. package/dist/api/column-types.js +3 -1
  6. package/dist/api/column-types.js.map +1 -1
  7. package/dist/api/column-values.d.ts +5 -4
  8. package/dist/api/column-values.d.ts.map +1 -1
  9. package/dist/api/column-values.js +6 -5
  10. package/dist/api/column-values.js.map +1 -1
  11. package/dist/api/documents.d.ts +1136 -3
  12. package/dist/api/documents.d.ts.map +1 -1
  13. package/dist/api/documents.js +1828 -3
  14. package/dist/api/documents.js.map +1 -1
  15. package/dist/api/raw-write.d.ts +6 -5
  16. package/dist/api/raw-write.d.ts.map +1 -1
  17. package/dist/api/raw-write.js +7 -6
  18. package/dist/api/raw-write.js.map +1 -1
  19. package/dist/api/teams.d.ts +657 -0
  20. package/dist/api/teams.d.ts.map +1 -0
  21. package/dist/api/teams.js +880 -0
  22. package/dist/api/teams.js.map +1 -0
  23. package/dist/commands/doc/append-markdown.d.ts +117 -0
  24. package/dist/commands/doc/append-markdown.d.ts.map +1 -0
  25. package/dist/commands/doc/append-markdown.js +253 -0
  26. package/dist/commands/doc/append-markdown.js.map +1 -0
  27. package/dist/commands/doc/block-create.d.ts +114 -0
  28. package/dist/commands/doc/block-create.d.ts.map +1 -0
  29. package/dist/commands/doc/block-create.js +206 -0
  30. package/dist/commands/doc/block-create.js.map +1 -0
  31. package/dist/commands/doc/block-delete.d.ts +72 -0
  32. package/dist/commands/doc/block-delete.d.ts.map +1 -0
  33. package/dist/commands/doc/block-delete.js +161 -0
  34. package/dist/commands/doc/block-delete.js.map +1 -0
  35. package/dist/commands/doc/block-update.d.ts +75 -0
  36. package/dist/commands/doc/block-update.d.ts.map +1 -0
  37. package/dist/commands/doc/block-update.js +162 -0
  38. package/dist/commands/doc/block-update.js.map +1 -0
  39. package/dist/commands/doc/create-in-workspace.d.ts +76 -0
  40. package/dist/commands/doc/create-in-workspace.d.ts.map +1 -0
  41. package/dist/commands/doc/create-in-workspace.js +164 -0
  42. package/dist/commands/doc/create-in-workspace.js.map +1 -0
  43. package/dist/commands/doc/create-on-column.d.ts +71 -0
  44. package/dist/commands/doc/create-on-column.d.ts.map +1 -0
  45. package/dist/commands/doc/create-on-column.js +146 -0
  46. package/dist/commands/doc/create-on-column.js.map +1 -0
  47. package/dist/commands/doc/delete.d.ts +68 -0
  48. package/dist/commands/doc/delete.d.ts.map +1 -0
  49. package/dist/commands/doc/delete.js +146 -0
  50. package/dist/commands/doc/delete.js.map +1 -0
  51. package/dist/commands/doc/duplicate.d.ts +101 -0
  52. package/dist/commands/doc/duplicate.d.ts.map +1 -0
  53. package/dist/commands/doc/duplicate.js +191 -0
  54. package/dist/commands/doc/duplicate.js.map +1 -0
  55. package/dist/commands/doc/import-html.d.ts +125 -0
  56. package/dist/commands/doc/import-html.d.ts.map +1 -0
  57. package/dist/commands/doc/import-html.js +273 -0
  58. package/dist/commands/doc/import-html.js.map +1 -0
  59. package/dist/commands/doc/list.d.ts +6 -3
  60. package/dist/commands/doc/list.d.ts.map +1 -1
  61. package/dist/commands/doc/list.js +17 -48
  62. package/dist/commands/doc/list.js.map +1 -1
  63. package/dist/commands/doc/rename.d.ts +60 -0
  64. package/dist/commands/doc/rename.d.ts.map +1 -0
  65. package/dist/commands/doc/rename.js +135 -0
  66. package/dist/commands/doc/rename.js.map +1 -0
  67. package/dist/commands/index.d.ts.map +1 -1
  68. package/dist/commands/index.js +116 -0
  69. package/dist/commands/index.js.map +1 -1
  70. package/dist/commands/item/create.js +2 -2
  71. package/dist/commands/update/create.d.ts.map +1 -1
  72. package/dist/commands/update/create.js +6 -4
  73. package/dist/commands/update/create.js.map +1 -1
  74. package/dist/commands/update/edit.d.ts +4 -2
  75. package/dist/commands/update/edit.d.ts.map +1 -1
  76. package/dist/commands/update/edit.js +10 -6
  77. package/dist/commands/update/edit.js.map +1 -1
  78. package/dist/commands/update/reply.d.ts +4 -2
  79. package/dist/commands/update/reply.d.ts.map +1 -1
  80. package/dist/commands/update/reply.js +10 -6
  81. package/dist/commands/update/reply.js.map +1 -1
  82. package/dist/commands/user/_team-membership.d.ts +10 -0
  83. package/dist/commands/user/_team-membership.d.ts.map +1 -0
  84. package/dist/commands/user/_team-membership.js +88 -0
  85. package/dist/commands/user/_team-membership.js.map +1 -0
  86. package/dist/commands/user/team-add-members.d.ts +81 -0
  87. package/dist/commands/user/team-add-members.d.ts.map +1 -0
  88. package/dist/commands/user/team-add-members.js +186 -0
  89. package/dist/commands/user/team-add-members.js.map +1 -0
  90. package/dist/commands/user/team-create.d.ts +82 -0
  91. package/dist/commands/user/team-create.d.ts.map +1 -0
  92. package/dist/commands/user/team-create.js +206 -0
  93. package/dist/commands/user/team-create.js.map +1 -0
  94. package/dist/commands/user/team-delete.d.ts +56 -0
  95. package/dist/commands/user/team-delete.d.ts.map +1 -0
  96. package/dist/commands/user/team-delete.js +137 -0
  97. package/dist/commands/user/team-delete.js.map +1 -0
  98. package/dist/commands/user/team-get.d.ts +41 -0
  99. package/dist/commands/user/team-get.d.ts.map +1 -0
  100. package/dist/commands/user/team-get.js +87 -0
  101. package/dist/commands/user/team-get.js.map +1 -0
  102. package/dist/commands/user/team-list.d.ts +39 -0
  103. package/dist/commands/user/team-list.d.ts.map +1 -0
  104. package/dist/commands/user/team-list.js +90 -0
  105. package/dist/commands/user/team-list.js.map +1 -0
  106. package/dist/commands/user/team-remove-members.d.ts +71 -0
  107. package/dist/commands/user/team-remove-members.d.ts.map +1 -0
  108. package/dist/commands/user/team-remove-members.js +176 -0
  109. package/dist/commands/user/team-remove-members.js.map +1 -0
  110. package/dist/types/ids.d.ts +6 -0
  111. package/dist/types/ids.d.ts.map +1 -1
  112. package/dist/types/ids.js +46 -5
  113. package/dist/types/ids.js.map +1 -1
  114. package/dist/utils/parse-brand-list.d.ts +95 -0
  115. package/dist/utils/parse-brand-list.d.ts.map +1 -0
  116. package/dist/utils/parse-brand-list.js +96 -0
  117. package/dist/utils/parse-brand-list.js.map +1 -0
  118. package/dist/utils/source-content.d.ts +93 -0
  119. package/dist/utils/source-content.d.ts.map +1 -0
  120. package/dist/utils/source-content.js +120 -0
  121. package/dist/utils/source-content.js.map +1 -0
  122. package/package.json +1 -1
@@ -0,0 +1,68 @@
1
+ /**
2
+ * `monday doc delete <doc-id> --yes [--dry-run]` — delete an
3
+ * existing workdoc (`cli-design.md` §4.3 DOC section + §13 v0.5
4
+ * entry; `v0.5-plan.md` §3 M35 + §8 D7-D9).
5
+ *
6
+ * **Confirmation gate** (cli-design §3.1 #7 + §10.2 + M10 round-1
7
+ * P2 invariant). `--yes` is mandatory for the live path; without
8
+ * `--yes` (and without `--dry-run`) the command fails fast with
9
+ * `confirmation_required` (exit 1) carrying `details.doc_id`. The
10
+ * gate fires BEFORE `resolveClient()` so a missing token doesn't
11
+ * mask `confirmation_required` as `config_error` (same shape — and
12
+ * same gate-before-resolve ordering — as M14 `workspace delete` /
13
+ * M10 `item delete` / `update delete` / `team delete`).
14
+ *
15
+ * **Wire shape.** Single round-trip via `delete_doc(docId)` against
16
+ * `mutation DeleteDoc` with `operationName: 'DeleteDoc'`
17
+ * (R-NEW-37 W2 audit-point). Returns Monday's opaque `JSON` scalar
18
+ * — the fetcher projects to the flat `{ doc_id: <echoed>,
19
+ * success: true }` envelope per D9. A null `delete_doc` payload
20
+ * surfaces `not_found` — same cadence as M14 `workspace delete`
21
+ * + M34 `team delete` (id bogus or doc already deleted by a
22
+ * concurrent caller).
23
+ *
24
+ * **camelCase wire-arg note.** `delete_doc` takes camelCase
25
+ * `docId` on the wire (Finding 7) — see the canonical
26
+ * asymmetry note at `src/api/documents.ts` module header (4th
27
+ * supporting site for R-NEW-41).
28
+ *
29
+ * **Argv shape.**
30
+ *
31
+ * - `<doc-id>` — required positional (Monday's
32
+ * `delete_doc.docId` is `ID!`). Brand-validated via
33
+ * {@link DocIdSchema}.
34
+ *
35
+ * **Output envelope.** Projected from Monday's opaque JSON return
36
+ * per D9 — `data: { doc_id: <echoed>, success: true }`. Envelope
37
+ * shape is intentionally narrower than M34 `team-delete`'s "full
38
+ * deleted Team" projection: Monday's `delete_doc` doesn't return
39
+ * the deleted Document (the wire return is opaque JSON), and the
40
+ * agent contract doesn't gain from speculatively rehydrating the
41
+ * doc on the way out.
42
+ *
43
+ * **Dry-run shape** per cli-design §6.4 mutation-dry-run variant:
44
+ * minimal `{operation: "delete_doc", doc_id}`. No preflight read
45
+ * fires; the dry-run is purely argv-derived. `meta.source: 'none'`.
46
+ * Mirrors `workspace delete` / `team delete` — destructive-no-read
47
+ * pattern is uniform across destructive verbs.
48
+ *
49
+ * **Idempotent: false.** Re-running surfaces `not_found` past the
50
+ * first call. Same rationale as `workspace delete` / `team delete`
51
+ * — agents can't safely retry without verifying the id still
52
+ * names the same record.
53
+ *
54
+ * **Runtime body landed at v0.5-M35 IMPL.** Destructive gate fires
55
+ * BEFORE `resolveClient` (M10 round-1 P2 invariant); dry-run path
56
+ * emits minimal `{operation: "delete_doc", doc_id}` (no wire call);
57
+ * live path dispatches {@link deleteDoc} + projects via
58
+ * `emitMutation`.
59
+ */
60
+ import { z } from 'zod';
61
+ import { type CommandModule } from '../types.js';
62
+ import { type DocDeleteOutput } from '../../api/documents.js';
63
+ declare const inputSchema: z.ZodObject<{
64
+ docId: z.core.$ZodBranded<z.ZodString, "DocId", "out">;
65
+ }, z.core.$strict>;
66
+ export declare const docDeleteCommand: CommandModule<z.infer<typeof inputSchema>, DocDeleteOutput>;
67
+ export {};
68
+ //# sourceMappingURL=delete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/doc/delete.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAOnE,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,wBAAwB,CAAC;AAEhC,QAAA,MAAM,WAAW;;kBAA4C,CAAC;AAE9D,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAC1C,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,EAC3B,eAAe,CAmFhB,CAAC"}
@@ -0,0 +1,146 @@
1
+ /**
2
+ * `monday doc delete <doc-id> --yes [--dry-run]` — delete an
3
+ * existing workdoc (`cli-design.md` §4.3 DOC section + §13 v0.5
4
+ * entry; `v0.5-plan.md` §3 M35 + §8 D7-D9).
5
+ *
6
+ * **Confirmation gate** (cli-design §3.1 #7 + §10.2 + M10 round-1
7
+ * P2 invariant). `--yes` is mandatory for the live path; without
8
+ * `--yes` (and without `--dry-run`) the command fails fast with
9
+ * `confirmation_required` (exit 1) carrying `details.doc_id`. The
10
+ * gate fires BEFORE `resolveClient()` so a missing token doesn't
11
+ * mask `confirmation_required` as `config_error` (same shape — and
12
+ * same gate-before-resolve ordering — as M14 `workspace delete` /
13
+ * M10 `item delete` / `update delete` / `team delete`).
14
+ *
15
+ * **Wire shape.** Single round-trip via `delete_doc(docId)` against
16
+ * `mutation DeleteDoc` with `operationName: 'DeleteDoc'`
17
+ * (R-NEW-37 W2 audit-point). Returns Monday's opaque `JSON` scalar
18
+ * — the fetcher projects to the flat `{ doc_id: <echoed>,
19
+ * success: true }` envelope per D9. A null `delete_doc` payload
20
+ * surfaces `not_found` — same cadence as M14 `workspace delete`
21
+ * + M34 `team delete` (id bogus or doc already deleted by a
22
+ * concurrent caller).
23
+ *
24
+ * **camelCase wire-arg note.** `delete_doc` takes camelCase
25
+ * `docId` on the wire (Finding 7) — see the canonical
26
+ * asymmetry note at `src/api/documents.ts` module header (4th
27
+ * supporting site for R-NEW-41).
28
+ *
29
+ * **Argv shape.**
30
+ *
31
+ * - `<doc-id>` — required positional (Monday's
32
+ * `delete_doc.docId` is `ID!`). Brand-validated via
33
+ * {@link DocIdSchema}.
34
+ *
35
+ * **Output envelope.** Projected from Monday's opaque JSON return
36
+ * per D9 — `data: { doc_id: <echoed>, success: true }`. Envelope
37
+ * shape is intentionally narrower than M34 `team-delete`'s "full
38
+ * deleted Team" projection: Monday's `delete_doc` doesn't return
39
+ * the deleted Document (the wire return is opaque JSON), and the
40
+ * agent contract doesn't gain from speculatively rehydrating the
41
+ * doc on the way out.
42
+ *
43
+ * **Dry-run shape** per cli-design §6.4 mutation-dry-run variant:
44
+ * minimal `{operation: "delete_doc", doc_id}`. No preflight read
45
+ * fires; the dry-run is purely argv-derived. `meta.source: 'none'`.
46
+ * Mirrors `workspace delete` / `team delete` — destructive-no-read
47
+ * pattern is uniform across destructive verbs.
48
+ *
49
+ * **Idempotent: false.** Re-running surfaces `not_found` past the
50
+ * first call. Same rationale as `workspace delete` / `team delete`
51
+ * — agents can't safely retry without verifying the id still
52
+ * names the same record.
53
+ *
54
+ * **Runtime body landed at v0.5-M35 IMPL.** Destructive gate fires
55
+ * BEFORE `resolveClient` (M10 round-1 P2 invariant); dry-run path
56
+ * emits minimal `{operation: "delete_doc", doc_id}` (no wire call);
57
+ * live path dispatches {@link deleteDoc} + projects via
58
+ * `emitMutation`.
59
+ */
60
+ import { z } from 'zod';
61
+ import { ensureSubcommand } from '../types.js';
62
+ import { parseArgv } from '../parse-argv.js';
63
+ import { parseGlobalFlags } from '../../types/global-flags.js';
64
+ import { enforceDestructiveGate } from '../../api/destructive-gate.js';
65
+ import { emitDryRun, emitMutation } from '../emit.js';
66
+ import { resolveClient } from '../../api/resolve-client.js';
67
+ import { DocIdSchema } from '../../types/ids.js';
68
+ import { deleteDoc, docDeleteOutputSchema, } from '../../api/documents.js';
69
+ const inputSchema = z.object({ docId: DocIdSchema }).strict();
70
+ export const docDeleteCommand = {
71
+ name: 'doc.delete',
72
+ summary: 'Delete a workdoc — --yes required',
73
+ examples: [
74
+ 'monday doc delete 12345678 --yes',
75
+ 'monday doc delete 12345678 --dry-run',
76
+ 'monday doc delete 12345678 --yes --json',
77
+ ],
78
+ // Re-deleting an already-deleted doc surfaces `not_found`;
79
+ // re-running with the same `<doc-id>` after an interim
80
+ // `doc create-in-workspace` would target a different record
81
+ // (Monday mints new DocIds on create). Mark non-idempotent.
82
+ idempotent: false,
83
+ inputSchema,
84
+ outputSchema: docDeleteOutputSchema,
85
+ attach: (program, ctx) => {
86
+ const noun = ensureSubcommand(program, 'doc', 'Workdoc commands');
87
+ noun
88
+ .command('delete <docId>')
89
+ .description(docDeleteCommand.summary)
90
+ .addHelpText('after', ['', 'Examples:', ...docDeleteCommand.examples.map((e) => ` ${e}`), ''].join('\n'))
91
+ .action(async (docId) => {
92
+ const parsed = parseArgv(docDeleteCommand.inputSchema, { docId });
93
+ // Gate BEFORE `resolveClient()` — M10 round-1 P2 invariant.
94
+ // A missing `--yes` must surface as `confirmation_required`
95
+ // per cli-design §3.1 #7's unconditional contract, never
96
+ // masked by `config_error` when no token is configured.
97
+ const preGateGlobalFlags = parseGlobalFlags(program.opts(), ctx.env);
98
+ enforceDestructiveGate({
99
+ globalFlags: preGateGlobalFlags,
100
+ verb: 'doc delete',
101
+ target: parsed.docId,
102
+ detailKey: 'doc_id',
103
+ action: 'delete the workdoc',
104
+ hint: 'delete is destructive — Monday\'s wire surface offers no ' +
105
+ 'restore mutation for workdocs; agents needing reversal must ' +
106
+ 'recreate via `monday doc create-in-workspace` / `create-on-' +
107
+ 'column` (lossy: new id, content must be re-imported).',
108
+ });
109
+ if (preGateGlobalFlags.dryRun) {
110
+ // Minimal dry-run shape — no preflight read fires. Per
111
+ // cli-design §6.4 mutation-dry-run variant: `operation:
112
+ // "delete_doc"`, `doc_id`, nothing else. `meta.source:
113
+ // 'none'` because no API call fires; live surfaces
114
+ // `not_found` for missing ids on its own. Mirrors
115
+ // workspace-delete + team-delete cadence.
116
+ const { apiVersion } = resolveClient(ctx, program.opts());
117
+ emitDryRun({
118
+ ctx,
119
+ programOpts: program.opts(),
120
+ plannedChanges: [
121
+ { operation: 'delete_doc', doc_id: parsed.docId },
122
+ ],
123
+ source: 'none',
124
+ cacheAgeSeconds: null,
125
+ warnings: [],
126
+ apiVersion,
127
+ });
128
+ return;
129
+ }
130
+ const { client, apiVersion } = resolveClient(ctx, program.opts());
131
+ const result = await deleteDoc({ client, docId: parsed.docId });
132
+ emitMutation({
133
+ ctx,
134
+ data: result.result,
135
+ schema: docDeleteCommand.outputSchema,
136
+ programOpts: program.opts(),
137
+ warnings: [],
138
+ source: result.source,
139
+ cacheAgeSeconds: result.cacheAgeSeconds,
140
+ complexity: result.complexity,
141
+ apiVersion,
142
+ });
143
+ });
144
+ },
145
+ };
146
+ //# sourceMappingURL=delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/commands/doc/delete.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;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,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EACL,SAAS,EACT,qBAAqB,GAEtB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,GAAG,CAAC,CAAC,MAA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ACF,CAAC"}
@@ -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":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0FG;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,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EACL,YAAY,EACZ,wBAAwB,GAEzB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,GAAG,CAAC;KAClB,MAAM,CAAC;IACN,KAAK,EAAE,WAAW;IAClB,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACpC,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,mBAAmB,GAG5B;IACF,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,qGAAqG;IAC9G,QAAQ,EAAE;QACR,+BAA+B;QAC/B,8CAA8C;QAC9C,+DAA+D;KAChE;IACD,+DAA+D;IAC/D,gDAAgD;IAChD,UAAU,EAAE,KAAK;IACjB,WAAW;IACX,YAAY,EAAE,wBAAwB;IACtC,MAAM,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE;QACvB,MAAM,IAAI,GAAG,gBAAgB,CAAC,OAAO,EAAE,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CAAC;gBACzC,CAAC;gBACD,UAAU,CAAC;oBACT,GAAG;oBACH,WAAW,EAAE,OAAO,CAAC,IAAI,EAAE;oBAC3B,cAAc,EAAE,CAAC,OAAO,CAAC;oBACzB,MAAM,EAAE,MAAM;oBACd,eAAe,EAAE,IAAI;oBACrB,QAAQ,EAAE,EAAE;oBACZ,UAAU;iBACX,CAAC,CAAC;gBACH,OAAO;YACT,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC;gBAChC,MAAM;gBACN,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,GAAG,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC;aAC1D,CAAC,CAAC;YACH,YAAY,CAAC;gBACX,GAAG;gBACH,IAAI,EAAE,MAAM,CAAC,MAAM;gBACnB,MAAM,EAAE,mBAAmB,CAAC,YAAY;gBACxC,WAAW,EAAE,OAAO,CAAC,IAAI,EAAE;gBAC3B,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"}