monday-cli 0.4.0 → 0.6.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 (154) hide show
  1. package/CHANGELOG.md +645 -0
  2. package/README.md +173 -34
  3. package/dist/api/column-types.d.ts +48 -17
  4. package/dist/api/column-types.d.ts.map +1 -1
  5. package/dist/api/column-types.js +25 -9
  6. package/dist/api/column-types.js.map +1 -1
  7. package/dist/api/column-values.d.ts +17 -9
  8. package/dist/api/column-values.d.ts.map +1 -1
  9. package/dist/api/column-values.js +33 -18
  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/file-column-set.d.ts +507 -0
  16. package/dist/api/file-column-set.d.ts.map +1 -0
  17. package/dist/api/file-column-set.js +510 -0
  18. package/dist/api/file-column-set.js.map +1 -0
  19. package/dist/api/raw-write.d.ts +27 -16
  20. package/dist/api/raw-write.d.ts.map +1 -1
  21. package/dist/api/raw-write.js +40 -24
  22. package/dist/api/raw-write.js.map +1 -1
  23. package/dist/api/resolver-error-fold.d.ts +25 -0
  24. package/dist/api/resolver-error-fold.d.ts.map +1 -1
  25. package/dist/api/resolver-error-fold.js +56 -0
  26. package/dist/api/resolver-error-fold.js.map +1 -1
  27. package/dist/api/teams.d.ts +657 -0
  28. package/dist/api/teams.d.ts.map +1 -0
  29. package/dist/api/teams.js +880 -0
  30. package/dist/api/teams.js.map +1 -0
  31. package/dist/commands/board/column-create.d.ts +8 -3
  32. package/dist/commands/board/column-create.d.ts.map +1 -1
  33. package/dist/commands/board/column-create.js +16 -8
  34. package/dist/commands/board/column-create.js.map +1 -1
  35. package/dist/commands/doc/append-markdown.d.ts +117 -0
  36. package/dist/commands/doc/append-markdown.d.ts.map +1 -0
  37. package/dist/commands/doc/append-markdown.js +253 -0
  38. package/dist/commands/doc/append-markdown.js.map +1 -0
  39. package/dist/commands/doc/block-create.d.ts +114 -0
  40. package/dist/commands/doc/block-create.d.ts.map +1 -0
  41. package/dist/commands/doc/block-create.js +206 -0
  42. package/dist/commands/doc/block-create.js.map +1 -0
  43. package/dist/commands/doc/block-delete.d.ts +72 -0
  44. package/dist/commands/doc/block-delete.d.ts.map +1 -0
  45. package/dist/commands/doc/block-delete.js +161 -0
  46. package/dist/commands/doc/block-delete.js.map +1 -0
  47. package/dist/commands/doc/block-update.d.ts +75 -0
  48. package/dist/commands/doc/block-update.d.ts.map +1 -0
  49. package/dist/commands/doc/block-update.js +162 -0
  50. package/dist/commands/doc/block-update.js.map +1 -0
  51. package/dist/commands/doc/create-in-workspace.d.ts +76 -0
  52. package/dist/commands/doc/create-in-workspace.d.ts.map +1 -0
  53. package/dist/commands/doc/create-in-workspace.js +164 -0
  54. package/dist/commands/doc/create-in-workspace.js.map +1 -0
  55. package/dist/commands/doc/create-on-column.d.ts +71 -0
  56. package/dist/commands/doc/create-on-column.d.ts.map +1 -0
  57. package/dist/commands/doc/create-on-column.js +146 -0
  58. package/dist/commands/doc/create-on-column.js.map +1 -0
  59. package/dist/commands/doc/delete.d.ts +68 -0
  60. package/dist/commands/doc/delete.d.ts.map +1 -0
  61. package/dist/commands/doc/delete.js +146 -0
  62. package/dist/commands/doc/delete.js.map +1 -0
  63. package/dist/commands/doc/duplicate.d.ts +101 -0
  64. package/dist/commands/doc/duplicate.d.ts.map +1 -0
  65. package/dist/commands/doc/duplicate.js +191 -0
  66. package/dist/commands/doc/duplicate.js.map +1 -0
  67. package/dist/commands/doc/import-html.d.ts +125 -0
  68. package/dist/commands/doc/import-html.d.ts.map +1 -0
  69. package/dist/commands/doc/import-html.js +273 -0
  70. package/dist/commands/doc/import-html.js.map +1 -0
  71. package/dist/commands/doc/list.d.ts +6 -3
  72. package/dist/commands/doc/list.d.ts.map +1 -1
  73. package/dist/commands/doc/list.js +17 -48
  74. package/dist/commands/doc/list.js.map +1 -1
  75. package/dist/commands/doc/rename.d.ts +60 -0
  76. package/dist/commands/doc/rename.d.ts.map +1 -0
  77. package/dist/commands/doc/rename.js +135 -0
  78. package/dist/commands/doc/rename.js.map +1 -0
  79. package/dist/commands/index.d.ts.map +1 -1
  80. package/dist/commands/index.js +116 -0
  81. package/dist/commands/index.js.map +1 -1
  82. package/dist/commands/item/create.d.ts.map +1 -1
  83. package/dist/commands/item/create.js +131 -33
  84. package/dist/commands/item/create.js.map +1 -1
  85. package/dist/commands/item/set.d.ts +33 -3
  86. package/dist/commands/item/set.d.ts.map +1 -1
  87. package/dist/commands/item/set.js +193 -15
  88. package/dist/commands/item/set.js.map +1 -1
  89. package/dist/commands/item/update.d.ts +34 -3
  90. package/dist/commands/item/update.d.ts.map +1 -1
  91. package/dist/commands/item/update.js +346 -67
  92. package/dist/commands/item/update.js.map +1 -1
  93. package/dist/commands/item/upload.d.ts.map +1 -1
  94. package/dist/commands/item/upload.js +16 -69
  95. package/dist/commands/item/upload.js.map +1 -1
  96. package/dist/commands/update/create.d.ts.map +1 -1
  97. package/dist/commands/update/create.js +6 -4
  98. package/dist/commands/update/create.js.map +1 -1
  99. package/dist/commands/update/edit.d.ts +4 -2
  100. package/dist/commands/update/edit.d.ts.map +1 -1
  101. package/dist/commands/update/edit.js +10 -6
  102. package/dist/commands/update/edit.js.map +1 -1
  103. package/dist/commands/update/reply.d.ts +4 -2
  104. package/dist/commands/update/reply.d.ts.map +1 -1
  105. package/dist/commands/update/reply.js +10 -6
  106. package/dist/commands/update/reply.js.map +1 -1
  107. package/dist/commands/update/upload.d.ts.map +1 -1
  108. package/dist/commands/update/upload.js +9 -59
  109. package/dist/commands/update/upload.js.map +1 -1
  110. package/dist/commands/user/_team-membership.d.ts +10 -0
  111. package/dist/commands/user/_team-membership.d.ts.map +1 -0
  112. package/dist/commands/user/_team-membership.js +88 -0
  113. package/dist/commands/user/_team-membership.js.map +1 -0
  114. package/dist/commands/user/team-add-members.d.ts +81 -0
  115. package/dist/commands/user/team-add-members.d.ts.map +1 -0
  116. package/dist/commands/user/team-add-members.js +186 -0
  117. package/dist/commands/user/team-add-members.js.map +1 -0
  118. package/dist/commands/user/team-create.d.ts +82 -0
  119. package/dist/commands/user/team-create.d.ts.map +1 -0
  120. package/dist/commands/user/team-create.js +206 -0
  121. package/dist/commands/user/team-create.js.map +1 -0
  122. package/dist/commands/user/team-delete.d.ts +56 -0
  123. package/dist/commands/user/team-delete.d.ts.map +1 -0
  124. package/dist/commands/user/team-delete.js +137 -0
  125. package/dist/commands/user/team-delete.js.map +1 -0
  126. package/dist/commands/user/team-get.d.ts +41 -0
  127. package/dist/commands/user/team-get.d.ts.map +1 -0
  128. package/dist/commands/user/team-get.js +87 -0
  129. package/dist/commands/user/team-get.js.map +1 -0
  130. package/dist/commands/user/team-list.d.ts +39 -0
  131. package/dist/commands/user/team-list.d.ts.map +1 -0
  132. package/dist/commands/user/team-list.js +90 -0
  133. package/dist/commands/user/team-list.js.map +1 -0
  134. package/dist/commands/user/team-remove-members.d.ts +71 -0
  135. package/dist/commands/user/team-remove-members.d.ts.map +1 -0
  136. package/dist/commands/user/team-remove-members.js +176 -0
  137. package/dist/commands/user/team-remove-members.js.map +1 -0
  138. package/dist/types/ids.d.ts +6 -0
  139. package/dist/types/ids.d.ts.map +1 -1
  140. package/dist/types/ids.js +46 -5
  141. package/dist/types/ids.js.map +1 -1
  142. package/dist/utils/file-source.d.ts +93 -0
  143. package/dist/utils/file-source.d.ts.map +1 -0
  144. package/dist/utils/file-source.js +140 -0
  145. package/dist/utils/file-source.js.map +1 -0
  146. package/dist/utils/parse-brand-list.d.ts +95 -0
  147. package/dist/utils/parse-brand-list.d.ts.map +1 -0
  148. package/dist/utils/parse-brand-list.js +96 -0
  149. package/dist/utils/parse-brand-list.js.map +1 -0
  150. package/dist/utils/source-content.d.ts +93 -0
  151. package/dist/utils/source-content.d.ts.map +1 -0
  152. package/dist/utils/source-content.js +120 -0
  153. package/dist/utils/source-content.js.map +1 -0
  154. package/package.json +1 -1
@@ -0,0 +1,273 @@
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 { ensureSubcommand } from '../types.js';
110
+ import { parseArgv } from '../parse-argv.js';
111
+ import { emitDryRun, emitMutation } from '../emit.js';
112
+ import { resolveClient } from '../../api/resolve-client.js';
113
+ import { WorkspaceIdSchema, DocFolderIdSchema } from '../../types/ids.js';
114
+ import { DOC_KIND_VALUES, MAX_DOC_IMPORT_PAYLOAD_BYTES, docImportHtmlOutputSchema, importDocFromHtml, } from '../../api/documents.js';
115
+ import { readSourceContent } from '../../utils/source-content.js';
116
+ const inputSchema = z
117
+ .object({
118
+ workspace: WorkspaceIdSchema,
119
+ /**
120
+ * File path for the HTML content (`-` reads from stdin). Mutually
121
+ * exclusive with `htmlString` — exactly one required, enforced by
122
+ * the cross-field `.refine()` below. The size guard against
123
+ * {@link MAX_DOC_IMPORT_PAYLOAD_BYTES} applies at the runtime
124
+ * read boundary via {@link readSourceContent}'s `maxBytes` slot
125
+ * — file content size isn't known at argv-parse time.
126
+ */
127
+ html: z.string().min(1, '--html must be a non-empty file path (use `-` for stdin)').optional(),
128
+ /**
129
+ * Literal HTML payload string. Mutually exclusive with `html`.
130
+ * Capped at {@link MAX_DOC_IMPORT_PAYLOAD_BYTES} bytes (UTF-8)
131
+ * at parse boundary per D13 closure (empirical wire threshold
132
+ * sits between 250KB-OK and 500KB-rejected; conservative pin at
133
+ * 250KB last-known-good).
134
+ */
135
+ htmlString: z
136
+ .string()
137
+ .min(1, '--html-string must not be empty')
138
+ .refine((s) => s.trim().length > 0, {
139
+ message: '--html-string must not be whitespace-only (zero non-whitespace bytes after trim). Pass HTML content.',
140
+ })
141
+ .refine((s) => Buffer.byteLength(s, 'utf8') <= MAX_DOC_IMPORT_PAYLOAD_BYTES, {
142
+ message: `--html-string exceeds the ${MAX_DOC_IMPORT_PAYLOAD_BYTES.toString()}-byte wire-side limit (empirical probe pinned the threshold between 250KB OK and 500KB rejected; pass --html <file> with a smaller payload, or split the import across multiple calls)`,
143
+ })
144
+ .optional(),
145
+ folder: DocFolderIdSchema.optional(),
146
+ kind: z.enum(DOC_KIND_VALUES).optional(),
147
+ title: z.string().min(1, '--title must not be empty (omit the flag to let Monday infer the title from HTML)').optional(),
148
+ })
149
+ .strict()
150
+ .refine((v) => (v.html === undefined) !== (v.htmlString === undefined), {
151
+ message: '--html (file path or `-` for stdin) and --html-string (literal HTML) are mutually exclusive; supply exactly one',
152
+ path: ['html'],
153
+ });
154
+ const describeHtmlSource = (html, htmlString) => {
155
+ if (htmlString !== undefined)
156
+ return '(inline)';
157
+ if (html === '-')
158
+ return '(stdin)';
159
+ // The cross-field `.refine()` guarantees exactly one of `html` /
160
+ // `htmlString` is set at this point; the fallthrough only reaches
161
+ // a string-valued `html`.
162
+ if (html === undefined) {
163
+ // Defensive — the schema's `.refine()` prevents this branch from
164
+ // firing in production. Surface a clear internal error if a future
165
+ // refactor weakens the invariant.
166
+ throw new Error('describeHtmlSource: invariant violated — neither html nor htmlString set after refine');
167
+ }
168
+ return html;
169
+ };
170
+ export const docImportHtmlCommand = {
171
+ name: 'doc.import-html',
172
+ summary: 'Import an HTML payload as a new workdoc (--workspace + --html|--html-string required)',
173
+ examples: [
174
+ 'monday doc import-html --workspace 5555 --html-string \'<h1>Plan</h1><p>Body</p>\'',
175
+ 'monday doc import-html --workspace 5555 --html ./plan.html --title "Q4 launch plan"',
176
+ 'cat plan.html | monday doc import-html --workspace 5555 --html - --kind private',
177
+ 'monday doc import-html --workspace 5555 --html-string \'<p>x</p>\' --folder 12345 --dry-run --json',
178
+ ],
179
+ // Re-running creates a fresh duplicate doc — Monday's wire does not
180
+ // dedupe by HTML content or title. Mark non-idempotent so agents
181
+ // don't naively retry on transient failures.
182
+ idempotent: false,
183
+ inputSchema,
184
+ outputSchema: docImportHtmlOutputSchema,
185
+ attach: (program, ctx) => {
186
+ const noun = ensureSubcommand(program, 'doc', 'Workdoc commands');
187
+ noun
188
+ .command('import-html')
189
+ .description(docImportHtmlCommand.summary)
190
+ .requiredOption('--workspace <wid>', 'numeric workspace ID (maps to wire `workspaceId: ID!`)')
191
+ .option('--html <file>', 'file path containing the HTML payload (use `-` to read from stdin); mutually exclusive with --html-string')
192
+ .option('--html-string <s>', `literal HTML payload (maps to wire \`html: String!\`); capped at ${MAX_DOC_IMPORT_PAYLOAD_BYTES.toString()} bytes UTF-8 per D13 empirical threshold; mutually exclusive with --html`)
193
+ .option('--folder <fid>', 'optional numeric folder ID (maps to wire `folderId: ID`); absent → doc lands at workspace root')
194
+ .option(`--kind <${DOC_KIND_VALUES.join('|')}>`, 'optional doc kind (maps to wire `kind: DocKind`); absent → Monday\'s wire-side default `public` applies')
195
+ .option('--title <t>', 'optional doc title (maps to wire `title: String`); absent → Monday infers the title from the HTML content')
196
+ .addHelpText('after', [
197
+ '',
198
+ 'Examples:',
199
+ ...docImportHtmlCommand.examples.map((e) => ` ${e}`),
200
+ '',
201
+ 'Notes:',
202
+ ` - Inline --html-string is capped at ${MAX_DOC_IMPORT_PAYLOAD_BYTES.toString()} bytes (~250KB) at parse boundary per D13 closure; file path / stdin forms apply the same cap at runtime.`,
203
+ ' - Re-running creates a duplicate doc; this verb is non-idempotent.',
204
+ ' - `--dry-run` emits the planned `import_doc_from_html` operation + resolved input slots (HTML payload omitted; only its source descriptor is logged).',
205
+ '',
206
+ ].join('\n'))
207
+ .action(async (opts) => {
208
+ const parsed = parseArgv(docImportHtmlCommand.inputSchema, opts);
209
+ const { client, globalFlags, apiVersion } = resolveClient(ctx, program.opts());
210
+ if (globalFlags.dryRun) {
211
+ // Minimal dry-run shape per cli-design §6.4 mutation-
212
+ // dry-run variant — argv-derived, no preflight read. The
213
+ // HTML payload itself is omitted (potentially hundreds of
214
+ // KB); agents see WHAT would be sent + the source it would
215
+ // come from via `html_source: '(inline)' | '(stdin)' | <path>`.
216
+ const planned = {
217
+ operation: 'import_doc_from_html',
218
+ workspace_id: parsed.workspace,
219
+ html_source: describeHtmlSource(parsed.html, parsed.htmlString),
220
+ };
221
+ if (parsed.folder !== undefined) {
222
+ planned.folder_id = parsed.folder;
223
+ }
224
+ if (parsed.kind !== undefined) {
225
+ planned.kind = parsed.kind;
226
+ }
227
+ if (parsed.title !== undefined) {
228
+ planned.title = parsed.title;
229
+ }
230
+ emitDryRun({
231
+ ctx,
232
+ programOpts: program.opts(),
233
+ plannedChanges: [planned],
234
+ source: 'none',
235
+ cacheAgeSeconds: null,
236
+ warnings: [],
237
+ apiVersion,
238
+ });
239
+ return;
240
+ }
241
+ const html = await readSourceContent({
242
+ inline: parsed.htmlString,
243
+ file: parsed.html,
244
+ stdin: ctx.stdin,
245
+ inlineFlagName: '--html-string',
246
+ fileFlagName: '--html',
247
+ verbHint: 'monday doc import-html requires either --html <file|-> or ' +
248
+ '--html-string <s>. Use --html - to read from stdin.',
249
+ maxBytes: MAX_DOC_IMPORT_PAYLOAD_BYTES,
250
+ });
251
+ const result = await importDocFromHtml({
252
+ client,
253
+ html,
254
+ workspaceId: parsed.workspace,
255
+ ...(parsed.kind === undefined ? {} : { kind: parsed.kind }),
256
+ ...(parsed.folder === undefined ? {} : { folderId: parsed.folder }),
257
+ ...(parsed.title === undefined ? {} : { title: parsed.title }),
258
+ });
259
+ emitMutation({
260
+ ctx,
261
+ data: result.result,
262
+ schema: docImportHtmlCommand.outputSchema,
263
+ programOpts: program.opts(),
264
+ warnings: [],
265
+ source: result.source,
266
+ cacheAgeSeconds: result.cacheAgeSeconds,
267
+ complexity: result.complexity,
268
+ apiVersion,
269
+ });
270
+ });
271
+ },
272
+ };
273
+ //# sourceMappingURL=import-html.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-html.js","sourceRoot":"","sources":["../../../src/commands/doc/import-html.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0GG;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,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EACL,eAAe,EACf,4BAA4B,EA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,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"}
@@ -72,11 +72,14 @@ declare const inputSchema: z.ZodObject<{
72
72
  export declare const docListCommand: CommandModule<z.infer<typeof inputSchema>, DocListOutput>;
73
73
  /**
74
74
  * Internals exposed for unit-test access (argv parser pinning).
75
- * NOT a public API — the comma-split helper + decimal parser stay
76
- * production-internal.
75
+ * NOT a public API — the decimal parser stays production-internal.
76
+ * The previous `parseWorkspaceListArg` member migrated to the
77
+ * lifted {@link parseBrandedListArg} helper at the M34 pre-flight
78
+ * kickoff (R-NEW-70 4-consumer lift); per-flag user-facing message
79
+ * shapes for `--workspace` are pinned via the lifted helper's
80
+ * options + tested at `tests/unit/utils/parse-brand-list.test.ts`.
77
81
  */
78
82
  export declare const _internals: {
79
- readonly parseWorkspaceListArg: (raw: string) => readonly string[];
80
83
  readonly parseStrictDecimal: (raw: string) => number;
81
84
  };
82
85
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/doc/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAKnE,OAAO,EAOL,KAAK,aAAa,EACnB,MAAM,wBAAwB,CAAC;AAEhC,QAAA,MAAM,WAAW;;;;;;;;kBA6BN,CAAC;AAEZ,eAAO,MAAM,cAAc,EAAE,aAAa,CACxC,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,EAC3B,aAAa,CA4Gd,CAAC;AA2EF;;;;GAIG;AACH,eAAO,MAAM,UAAU;0CA7Ca,MAAM,KAAG,SAAS,MAAM,EAAE;uCAlB7B,MAAM,KAAG,MAAM;CAkEtC,CAAC"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/doc/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAMnE,OAAO,EAOL,KAAK,aAAa,EACnB,MAAM,wBAAwB,CAAC;AAEhC,QAAA,MAAM,WAAW;;;;;;;;kBA6BN,CAAC;AAEZ,eAAO,MAAM,cAAc,EAAE,aAAa,CACxC,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,EAC3B,aAAa,CAsHd,CAAC;AAwBF;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU;uCAhBU,MAAM,KAAG,MAAM;CAkBtC,CAAC"}
@@ -58,12 +58,12 @@
58
58
  * → fetcher → envelope.
59
59
  */
60
60
  import { z } from 'zod';
61
- import { UsageError } from '../../utils/errors.js';
62
61
  import { ensureSubcommand } from '../types.js';
63
62
  import { parseArgv } from '../parse-argv.js';
64
63
  import { emitSuccess } from '../emit.js';
65
64
  import { resolveClient } from '../../api/resolve-client.js';
66
65
  import { WorkspaceIdSchema } from '../../types/ids.js';
66
+ import { parseBrandedListArg } from '../../utils/parse-brand-list.js';
67
67
  import { DEFAULT_DOC_LIST_LIMIT, MAX_DOC_LIST_LIMIT, MIN_DOC_LIST_LIMIT, docListOutputSchema, docsOrderBySchema, listDocuments, } from '../../api/documents.js';
68
68
  const inputSchema = z
69
69
  .object({
@@ -139,9 +139,18 @@ export const docListCommand = {
139
139
  // with a clear hint. Brand each entry via WorkspaceIdSchema
140
140
  // so a non-numeric token reaches the agent with the same
141
141
  // brand-error shape every other ID validator uses.
142
+ // Helper lifted to `src/utils/parse-brand-list.ts` at the
143
+ // M34 pre-flight kickoff (R-NEW-70 4-consumer lift ahead-
144
+ // of-feat per R-NEW-29 M25 cadence; v0.5-plan §22).
142
145
  const workspaceIds = parsed.workspace === undefined
143
146
  ? undefined
144
- : parseWorkspaceListArg(parsed.workspace);
147
+ : parseBrandedListArg(parsed.workspace, WorkspaceIdSchema, {
148
+ flagName: '--workspace',
149
+ entryDescription: 'numeric workspace ID',
150
+ hint: 'workspace IDs are numeric (e.g. 12345)',
151
+ emptyEntryHint: 'e.g. --workspace 12345,67890 — no leading, trailing, or ' +
152
+ 'duplicate commas',
153
+ });
145
154
  const { client, apiVersion } = resolveClient(ctx, program.opts());
146
155
  const result = await listDocuments({
147
156
  client,
@@ -193,56 +202,16 @@ const parseStrictDecimal = (raw) => {
193
202
  }
194
203
  return Number.parseInt(raw, 10);
195
204
  };
196
- /**
197
- * Splits a comma-separated `--workspace` argv string into an array of
198
- * brand-validated WorkspaceId strings. Empty entries reject with
199
- * `usage_error`; non-numeric entries reject via the WorkspaceIdSchema
200
- * brand. Whitespace around commas is trimmed.
201
- *
202
- * Exported via {@link _internals} only for parity with the existing
203
- * comma-split-helper pattern in `src/commands/workspace/add-users.ts`
204
- * — production code calls it inline within the command's action
205
- * body.
206
- */
207
- const parseWorkspaceListArg = (raw) => {
208
- const tokens = raw.split(',').map((t) => t.trim());
209
- const ids = [];
210
- for (const token of tokens) {
211
- if (token === '') {
212
- throw new UsageError('--workspace contains an empty entry (trailing comma or double ' +
213
- 'comma); pass a comma-separated list of numeric workspace IDs.', {
214
- details: {
215
- hint: 'e.g. --workspace 12345,67890 — no leading, trailing, or ' +
216
- 'duplicate commas',
217
- argv_value: raw,
218
- },
219
- });
220
- }
221
- const parsed = WorkspaceIdSchema.safeParse(token);
222
- if (!parsed.success) {
223
- throw new UsageError(`--workspace entry ${JSON.stringify(token)} is not a numeric ` +
224
- `workspace ID`, {
225
- details: {
226
- issues: parsed.error.issues.map((i) => ({
227
- path: i.path.map((p) => String(p)).join('.'),
228
- message: i.message,
229
- })),
230
- argv_value: raw,
231
- hint: 'workspace IDs are numeric (e.g. 12345)',
232
- },
233
- });
234
- }
235
- ids.push(parsed.data);
236
- }
237
- return ids;
238
- };
239
205
  /**
240
206
  * Internals exposed for unit-test access (argv parser pinning).
241
- * NOT a public API — the comma-split helper + decimal parser stay
242
- * production-internal.
207
+ * NOT a public API — the decimal parser stays production-internal.
208
+ * The previous `parseWorkspaceListArg` member migrated to the
209
+ * lifted {@link parseBrandedListArg} helper at the M34 pre-flight
210
+ * kickoff (R-NEW-70 4-consumer lift); per-flag user-facing message
211
+ * shapes for `--workspace` are pinned via the lifted helper's
212
+ * options + tested at `tests/unit/utils/parse-brand-list.test.ts`.
243
213
  */
244
214
  export const _internals = {
245
- parseWorkspaceListArg,
246
215
  parseStrictDecimal,
247
216
  };
248
217
  //# sourceMappingURL=list.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/doc/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,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,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,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
+ * `monday doc rename <doc-id> --name <n> [--dry-run]` — rename
3
+ * an existing workdoc (`cli-design.md` §4.3 DOC section + §13
4
+ * v0.5 entry; `v0.5-plan.md` §3 M35 + §8 D7-D9).
5
+ *
6
+ * **Wire shape.** Single `update_doc_name(docId, name)` round-
7
+ * trip via {@link renameDoc} against `mutation UpdateDocName`
8
+ * with `operationName: 'UpdateDocName'` (R-NEW-37 W2 audit-point).
9
+ * Returns Monday's opaque `JSON` scalar — the fetcher projects to
10
+ * the flat `{ doc_id: <echoed>, success: true }` envelope per D9.
11
+ *
12
+ * **camelCase wire-arg note.** `update_doc_name` uses camelCase
13
+ * `docId` on the wire (Finding 7); CLI argv stays kebab-case;
14
+ * error envelope `details.*` keys stay snake_case. See the
15
+ * canonical asymmetry note at `src/api/documents.ts` module
16
+ * header (4th supporting site for R-NEW-41; R-v0.5-NEW-3
17
+ * graduation candidate).
18
+ *
19
+ * **Argv shape.**
20
+ *
21
+ * - `<doc-id>` — required positional (Monday's
22
+ * `update_doc_name.docId` is `ID!`). Brand-validated via
23
+ * {@link DocIdSchema}.
24
+ * - `--name <n>` — required (Monday's `update_doc_name.name`
25
+ * is `String!`). Empty string rejects at parse.
26
+ *
27
+ * **Output envelope.** Projected from Monday's opaque JSON
28
+ * return per D9 — `data: { doc_id: <echoed>, success: true }`.
29
+ * The `doc_id` echoes the input positional (the operation
30
+ * targeted that specific doc); `success` is the literal `true`
31
+ * pinned at the schema layer because Monday surfaces failure
32
+ * via GraphQL `errors[]` (mapped to typed `ApiError`s upstream),
33
+ * not via a wire-side success flag.
34
+ *
35
+ * **Dry-run shape** per cli-design §6.4 mutation-dry-run variant.
36
+ * Minimal envelope listing the planned `update_doc_name`
37
+ * operation + the resolved input fields (`doc_id`, `name`).
38
+ * `meta.source: 'none'`.
39
+ *
40
+ * **Idempotent: yes.** Re-running with the same `<doc-id>` and
41
+ * `--name <n>` produces the same end state; Monday's wire is a
42
+ * no-op when the name matches the current value.
43
+ *
44
+ * **Runtime body landed at v0.5-M35 IMPL.** `parseArgv` runs
45
+ * BEFORE `resolveClient` so invalid argv surfaces `usage_error`
46
+ * ahead of any missing-token `config_error`; `resolveClient`
47
+ * parses global flags internally before `loadConfig`. Dry-run
48
+ * path emits minimal planned changes (no wire call fires); live
49
+ * path dispatches {@link renameDoc} + projects via `emitMutation`.
50
+ */
51
+ import { z } from 'zod';
52
+ import { type CommandModule } from '../types.js';
53
+ import { type DocRenameOutput } from '../../api/documents.js';
54
+ declare const inputSchema: z.ZodObject<{
55
+ docId: z.core.$ZodBranded<z.ZodString, "DocId", "out">;
56
+ name: z.ZodString;
57
+ }, z.core.$strict>;
58
+ export declare const docRenameCommand: CommandModule<z.infer<typeof inputSchema>, DocRenameOutput>;
59
+ export {};
60
+ //# sourceMappingURL=rename.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rename.d.ts","sourceRoot":"","sources":["../../../src/commands/doc/rename.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAKnE,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,wBAAwB,CAAC;AAEhC,QAAA,MAAM,WAAW;;;kBAKN,CAAC;AAEZ,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAC1C,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,EAC3B,eAAe,CAgFhB,CAAC"}
@@ -0,0 +1,135 @@
1
+ /**
2
+ * `monday doc rename <doc-id> --name <n> [--dry-run]` — rename
3
+ * an existing workdoc (`cli-design.md` §4.3 DOC section + §13
4
+ * v0.5 entry; `v0.5-plan.md` §3 M35 + §8 D7-D9).
5
+ *
6
+ * **Wire shape.** Single `update_doc_name(docId, name)` round-
7
+ * trip via {@link renameDoc} against `mutation UpdateDocName`
8
+ * with `operationName: 'UpdateDocName'` (R-NEW-37 W2 audit-point).
9
+ * Returns Monday's opaque `JSON` scalar — the fetcher projects to
10
+ * the flat `{ doc_id: <echoed>, success: true }` envelope per D9.
11
+ *
12
+ * **camelCase wire-arg note.** `update_doc_name` uses camelCase
13
+ * `docId` on the wire (Finding 7); CLI argv stays kebab-case;
14
+ * error envelope `details.*` keys stay snake_case. See the
15
+ * canonical asymmetry note at `src/api/documents.ts` module
16
+ * header (4th supporting site for R-NEW-41; R-v0.5-NEW-3
17
+ * graduation candidate).
18
+ *
19
+ * **Argv shape.**
20
+ *
21
+ * - `<doc-id>` — required positional (Monday's
22
+ * `update_doc_name.docId` is `ID!`). Brand-validated via
23
+ * {@link DocIdSchema}.
24
+ * - `--name <n>` — required (Monday's `update_doc_name.name`
25
+ * is `String!`). Empty string rejects at parse.
26
+ *
27
+ * **Output envelope.** Projected from Monday's opaque JSON
28
+ * return per D9 — `data: { doc_id: <echoed>, success: true }`.
29
+ * The `doc_id` echoes the input positional (the operation
30
+ * targeted that specific doc); `success` is the literal `true`
31
+ * pinned at the schema layer because Monday surfaces failure
32
+ * via GraphQL `errors[]` (mapped to typed `ApiError`s upstream),
33
+ * not via a wire-side success flag.
34
+ *
35
+ * **Dry-run shape** per cli-design §6.4 mutation-dry-run variant.
36
+ * Minimal envelope listing the planned `update_doc_name`
37
+ * operation + the resolved input fields (`doc_id`, `name`).
38
+ * `meta.source: 'none'`.
39
+ *
40
+ * **Idempotent: yes.** Re-running with the same `<doc-id>` and
41
+ * `--name <n>` produces the same end state; Monday's wire is a
42
+ * no-op when the name matches the current value.
43
+ *
44
+ * **Runtime body landed at v0.5-M35 IMPL.** `parseArgv` runs
45
+ * BEFORE `resolveClient` so invalid argv surfaces `usage_error`
46
+ * ahead of any missing-token `config_error`; `resolveClient`
47
+ * parses global flags internally before `loadConfig`. Dry-run
48
+ * path emits minimal planned changes (no wire call fires); live
49
+ * path dispatches {@link renameDoc} + projects via `emitMutation`.
50
+ */
51
+ import { z } from 'zod';
52
+ import { ensureSubcommand } from '../types.js';
53
+ import { parseArgv } from '../parse-argv.js';
54
+ import { emitDryRun, emitMutation } from '../emit.js';
55
+ import { resolveClient } from '../../api/resolve-client.js';
56
+ import { DocIdSchema } from '../../types/ids.js';
57
+ import { renameDoc, docRenameOutputSchema, } from '../../api/documents.js';
58
+ const inputSchema = z
59
+ .object({
60
+ docId: DocIdSchema,
61
+ name: z.string().min(1, '--name must not be empty'),
62
+ })
63
+ .strict();
64
+ export const docRenameCommand = {
65
+ name: 'doc.rename',
66
+ summary: 'Rename an existing workdoc (--name required)',
67
+ examples: [
68
+ 'monday doc rename 12345678 --name "Q4 launch plan (revised)"',
69
+ 'monday doc rename 12345678 --name "Q4 launch plan (revised)" --dry-run --json',
70
+ ],
71
+ // Renaming to the current name is a no-op on Monday's wire;
72
+ // re-running idempotently converges.
73
+ idempotent: true,
74
+ inputSchema,
75
+ outputSchema: docRenameOutputSchema,
76
+ attach: (program, ctx) => {
77
+ const noun = ensureSubcommand(program, 'doc', 'Workdoc commands');
78
+ noun
79
+ .command('rename <docId>')
80
+ .description(docRenameCommand.summary)
81
+ .requiredOption('--name <n>', 'new doc name (Monday\'s `String!` — must not be empty)')
82
+ .addHelpText('after', [
83
+ '',
84
+ 'Examples:',
85
+ ...docRenameCommand.examples.map((e) => ` ${e}`),
86
+ '',
87
+ 'Notes:',
88
+ ' - Envelope projects Monday\'s opaque JSON return to `{ doc_id, success: true }` (D9 closure).',
89
+ ' - `--dry-run` emits the planned `update_doc_name` operation + resolved input fields (no wire call fires; `meta.source: "none"`).',
90
+ '',
91
+ ].join('\n'))
92
+ .action(async (docIdArg, opts) => {
93
+ const parsed = parseArgv(docRenameCommand.inputSchema, {
94
+ docId: docIdArg,
95
+ ...opts,
96
+ });
97
+ const { client, globalFlags, apiVersion } = resolveClient(ctx, program.opts());
98
+ if (globalFlags.dryRun) {
99
+ emitDryRun({
100
+ ctx,
101
+ programOpts: program.opts(),
102
+ plannedChanges: [
103
+ {
104
+ operation: 'update_doc_name',
105
+ doc_id: parsed.docId,
106
+ name: parsed.name,
107
+ },
108
+ ],
109
+ source: 'none',
110
+ cacheAgeSeconds: null,
111
+ warnings: [],
112
+ apiVersion,
113
+ });
114
+ return;
115
+ }
116
+ const result = await renameDoc({
117
+ client,
118
+ docId: parsed.docId,
119
+ name: parsed.name,
120
+ });
121
+ emitMutation({
122
+ ctx,
123
+ data: result.result,
124
+ schema: docRenameCommand.outputSchema,
125
+ programOpts: program.opts(),
126
+ warnings: [],
127
+ source: result.source,
128
+ cacheAgeSeconds: result.cacheAgeSeconds,
129
+ complexity: result.complexity,
130
+ apiVersion,
131
+ });
132
+ });
133
+ },
134
+ };
135
+ //# sourceMappingURL=rename.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rename.js","sourceRoot":"","sources":["../../../src/commands/doc/rename.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;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,SAAS,EACT,qBAAqB,GAEtB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,GAAG,CAAC;KAClB,MAAM,CAAC;IACN,KAAK,EAAE,WAAW;IAClB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,0BAA0B,CAAC;CACpD,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,gBAAgB,GAGzB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K;4BACpB,IAAI,EAAE,MAAM,CAAC,IAAI;yBAClB;qBACF;oBACD,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,SAAS,CAAC;gBAC7B,MAAM;gBACN,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,IAAI,EAAE,MAAM,CAAC,IAAI;aAClB,CAAC,CAAC;YACH,YAAY,CAAC;gBACX,GAAG;gBACH,IAAI,EAAE,MAAM,CAAC,MAAM;gBACnB,MAAM,EAAE,gBAAgB,CAAC,YAAY;gBACrC,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAwOhD,eAAO,MAAM,kBAAkB,QAAO,SAAS,aAAa,EAyG3D,CAAC;AAEF,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AA4UhD,eAAO,MAAM,kBAAkB,QAAO,SAAS,aAAa,EAyH3D,CAAC;AAEF,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}