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.
- package/CHANGELOG.md +368 -0
- package/README.md +112 -34
- package/dist/api/column-types.d.ts +3 -1
- package/dist/api/column-types.d.ts.map +1 -1
- package/dist/api/column-types.js +3 -1
- package/dist/api/column-types.js.map +1 -1
- package/dist/api/column-values.d.ts +5 -4
- package/dist/api/column-values.d.ts.map +1 -1
- package/dist/api/column-values.js +6 -5
- package/dist/api/column-values.js.map +1 -1
- package/dist/api/documents.d.ts +1136 -3
- package/dist/api/documents.d.ts.map +1 -1
- package/dist/api/documents.js +1828 -3
- package/dist/api/documents.js.map +1 -1
- package/dist/api/raw-write.d.ts +6 -5
- package/dist/api/raw-write.d.ts.map +1 -1
- package/dist/api/raw-write.js +7 -6
- package/dist/api/raw-write.js.map +1 -1
- package/dist/api/teams.d.ts +657 -0
- package/dist/api/teams.d.ts.map +1 -0
- package/dist/api/teams.js +880 -0
- package/dist/api/teams.js.map +1 -0
- package/dist/commands/doc/append-markdown.d.ts +117 -0
- package/dist/commands/doc/append-markdown.d.ts.map +1 -0
- package/dist/commands/doc/append-markdown.js +253 -0
- package/dist/commands/doc/append-markdown.js.map +1 -0
- package/dist/commands/doc/block-create.d.ts +114 -0
- package/dist/commands/doc/block-create.d.ts.map +1 -0
- package/dist/commands/doc/block-create.js +206 -0
- package/dist/commands/doc/block-create.js.map +1 -0
- package/dist/commands/doc/block-delete.d.ts +72 -0
- package/dist/commands/doc/block-delete.d.ts.map +1 -0
- package/dist/commands/doc/block-delete.js +161 -0
- package/dist/commands/doc/block-delete.js.map +1 -0
- package/dist/commands/doc/block-update.d.ts +75 -0
- package/dist/commands/doc/block-update.d.ts.map +1 -0
- package/dist/commands/doc/block-update.js +162 -0
- package/dist/commands/doc/block-update.js.map +1 -0
- package/dist/commands/doc/create-in-workspace.d.ts +76 -0
- package/dist/commands/doc/create-in-workspace.d.ts.map +1 -0
- package/dist/commands/doc/create-in-workspace.js +164 -0
- package/dist/commands/doc/create-in-workspace.js.map +1 -0
- package/dist/commands/doc/create-on-column.d.ts +71 -0
- package/dist/commands/doc/create-on-column.d.ts.map +1 -0
- package/dist/commands/doc/create-on-column.js +146 -0
- package/dist/commands/doc/create-on-column.js.map +1 -0
- package/dist/commands/doc/delete.d.ts +68 -0
- package/dist/commands/doc/delete.d.ts.map +1 -0
- package/dist/commands/doc/delete.js +146 -0
- package/dist/commands/doc/delete.js.map +1 -0
- package/dist/commands/doc/duplicate.d.ts +101 -0
- package/dist/commands/doc/duplicate.d.ts.map +1 -0
- package/dist/commands/doc/duplicate.js +191 -0
- package/dist/commands/doc/duplicate.js.map +1 -0
- package/dist/commands/doc/import-html.d.ts +125 -0
- package/dist/commands/doc/import-html.d.ts.map +1 -0
- package/dist/commands/doc/import-html.js +273 -0
- package/dist/commands/doc/import-html.js.map +1 -0
- package/dist/commands/doc/list.d.ts +6 -3
- package/dist/commands/doc/list.d.ts.map +1 -1
- package/dist/commands/doc/list.js +17 -48
- package/dist/commands/doc/list.js.map +1 -1
- package/dist/commands/doc/rename.d.ts +60 -0
- package/dist/commands/doc/rename.d.ts.map +1 -0
- package/dist/commands/doc/rename.js +135 -0
- package/dist/commands/doc/rename.js.map +1 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +116 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/item/create.js +2 -2
- package/dist/commands/update/create.d.ts.map +1 -1
- package/dist/commands/update/create.js +6 -4
- package/dist/commands/update/create.js.map +1 -1
- package/dist/commands/update/edit.d.ts +4 -2
- package/dist/commands/update/edit.d.ts.map +1 -1
- package/dist/commands/update/edit.js +10 -6
- package/dist/commands/update/edit.js.map +1 -1
- package/dist/commands/update/reply.d.ts +4 -2
- package/dist/commands/update/reply.d.ts.map +1 -1
- package/dist/commands/update/reply.js +10 -6
- package/dist/commands/update/reply.js.map +1 -1
- package/dist/commands/user/_team-membership.d.ts +10 -0
- package/dist/commands/user/_team-membership.d.ts.map +1 -0
- package/dist/commands/user/_team-membership.js +88 -0
- package/dist/commands/user/_team-membership.js.map +1 -0
- package/dist/commands/user/team-add-members.d.ts +81 -0
- package/dist/commands/user/team-add-members.d.ts.map +1 -0
- package/dist/commands/user/team-add-members.js +186 -0
- package/dist/commands/user/team-add-members.js.map +1 -0
- package/dist/commands/user/team-create.d.ts +82 -0
- package/dist/commands/user/team-create.d.ts.map +1 -0
- package/dist/commands/user/team-create.js +206 -0
- package/dist/commands/user/team-create.js.map +1 -0
- package/dist/commands/user/team-delete.d.ts +56 -0
- package/dist/commands/user/team-delete.d.ts.map +1 -0
- package/dist/commands/user/team-delete.js +137 -0
- package/dist/commands/user/team-delete.js.map +1 -0
- package/dist/commands/user/team-get.d.ts +41 -0
- package/dist/commands/user/team-get.d.ts.map +1 -0
- package/dist/commands/user/team-get.js +87 -0
- package/dist/commands/user/team-get.js.map +1 -0
- package/dist/commands/user/team-list.d.ts +39 -0
- package/dist/commands/user/team-list.d.ts.map +1 -0
- package/dist/commands/user/team-list.js +90 -0
- package/dist/commands/user/team-list.js.map +1 -0
- package/dist/commands/user/team-remove-members.d.ts +71 -0
- package/dist/commands/user/team-remove-members.d.ts.map +1 -0
- package/dist/commands/user/team-remove-members.js +176 -0
- package/dist/commands/user/team-remove-members.js.map +1 -0
- package/dist/types/ids.d.ts +6 -0
- package/dist/types/ids.d.ts.map +1 -1
- package/dist/types/ids.js +46 -5
- package/dist/types/ids.js.map +1 -1
- package/dist/utils/parse-brand-list.d.ts +95 -0
- package/dist/utils/parse-brand-list.d.ts.map +1 -0
- package/dist/utils/parse-brand-list.js +96 -0
- package/dist/utils/parse-brand-list.js.map +1 -0
- package/dist/utils/source-content.d.ts +93 -0
- package/dist/utils/source-content.d.ts.map +1 -0
- package/dist/utils/source-content.js +120 -0
- package/dist/utils/source-content.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `monday doc block-create <doc-id> --type <DocBlockContentType>
|
|
3
|
+
* --content <json> [--after <bid>] [--parent <bid>] [--dry-run]` —
|
|
4
|
+
* create a new rich-text block inside an existing workdoc
|
|
5
|
+
* (`cli-design.md` §4.3 DOC section + §13 v0.5 entry;
|
|
6
|
+
* `v0.5-plan.md` §3 M36 + §8 D10-D11).
|
|
7
|
+
*
|
|
8
|
+
* **Wire shape.** Single `create_doc_block(doc_id, type, content,
|
|
9
|
+
* after_block_id?, parent_block_id?) → DocumentBlock` round-trip
|
|
10
|
+
* via {@link createDocBlock} against `mutation CreateDocBlock`
|
|
11
|
+
* with `operationName: 'CreateDocBlock'` (R-NEW-37 W2 audit-point).
|
|
12
|
+
* Returns the full 9-field `DocumentBlock` shape per the M32 probe
|
|
13
|
+
* (id / type / content / position / parent_block_id / doc_id /
|
|
14
|
+
* created_at / created_by / updated_at). OBJECT-return cadence
|
|
15
|
+
* (distinct from M35's opaque-JSON projection cadence).
|
|
16
|
+
*
|
|
17
|
+
* **Snake_case wire arg names.** M36's wire uses snake_case
|
|
18
|
+
* (`doc_id`, `after_block_id`, `parent_block_id`) — back to Monday's
|
|
19
|
+
* standard cadence after the M35 camelCase asymmetry. The fetcher's
|
|
20
|
+
* GraphQL document maps camelCase variables to snake_case wire args
|
|
21
|
+
* (`doc_id: $docId`); CLI argv stays kebab-case (`--after <bid>` /
|
|
22
|
+
* `--parent <bid>`); error envelope `details.*` keys stay
|
|
23
|
+
* snake_case per cli-design §6.5. NOT a new R-NEW-41 supporting
|
|
24
|
+
* site — M36 is the symmetric path, M35 was the asymmetric one.
|
|
25
|
+
*
|
|
26
|
+
* **Argv shape.**
|
|
27
|
+
*
|
|
28
|
+
* - `<doc-id>` — required positional (Monday's
|
|
29
|
+
* `create_doc_block.doc_id` is `ID!`). Brand-validated via
|
|
30
|
+
* {@link DocIdSchema}.
|
|
31
|
+
* - `--type <t>` — required closed enum (16 values per the M36
|
|
32
|
+
* empirical probe; see {@link DOC_BLOCK_CONTENT_TYPE_VALUES}).
|
|
33
|
+
* Maps to wire `type: DocBlockContentType!`. Unknown values
|
|
34
|
+
* reject at the parse boundary with `usage_error.details.
|
|
35
|
+
* issues[]` per D10 closure.
|
|
36
|
+
* - `--content <json>` — required JSON-string slot. Parsed once
|
|
37
|
+
* at the argv boundary via `parseJsonArg` (R-NEW-42 helper, 4th
|
|
38
|
+
* consumer; same shape `monday raw --vars` /
|
|
39
|
+
* `board column-create --settings` / `webhook create --config`
|
|
40
|
+
* use). The parsed JS value is passed through to Monday's wire
|
|
41
|
+
* `JSON` scalar unmodified. **Per-type content payload
|
|
42
|
+
* structure** varies across the 16 `DocBlockContentType`
|
|
43
|
+
* variants per D11 — `docs/output-shapes.md` "Per-block content
|
|
44
|
+
* shapes" reference table marks cassette-pinned shapes and
|
|
45
|
+
* TBD / inferred variants pending live-probe cassettes. The CLI
|
|
46
|
+
* accepts every variant + dispatches unmodified; a shape-
|
|
47
|
+
* incompatible `--content` for the chosen `--type` surfaces
|
|
48
|
+
* `validation_failed` from Monday at the live path. The CLI
|
|
49
|
+
* doesn't pre-validate the inner content shape.
|
|
50
|
+
* - `--after <bid>` — optional opaque-string block id (maps to
|
|
51
|
+
* wire `after_block_id: String`). Brand-validated via
|
|
52
|
+
* {@link DocBlockIdSchema}. Absent → block inserted at the
|
|
53
|
+
* document head (Monday's wire default per probe description).
|
|
54
|
+
* - `--parent <bid>` — optional opaque-string block id (maps to
|
|
55
|
+
* wire `parent_block_id: String`). Brand-validated via
|
|
56
|
+
* {@link DocBlockIdSchema}. Absent → block lands at the
|
|
57
|
+
* document root level (no parent nesting).
|
|
58
|
+
*
|
|
59
|
+
* **Output envelope.** Direct unwrap of the created DocumentBlock
|
|
60
|
+
* — `data: <DocumentBlock>` per cli-design §6.1 single-record
|
|
61
|
+
* convention. Mirrors M35 `doc create-in-workspace` /
|
|
62
|
+
* `create-on-column` cadence (full Document direct-unwrap on
|
|
63
|
+
* create); M36 returns the per-block shape instead.
|
|
64
|
+
*
|
|
65
|
+
* **Dry-run shape** per cli-design §6.4 mutation-dry-run variant.
|
|
66
|
+
* Minimal envelope listing the planned `create_doc_block`
|
|
67
|
+
* operation + the resolved input fields (`doc_id`, `type`,
|
|
68
|
+
* `content`, optional `after_block_id`, optional `parent_block_id`).
|
|
69
|
+
* No preflight read fires; the dry-run is purely argv-derived.
|
|
70
|
+
* `meta.source: 'none'`.
|
|
71
|
+
*
|
|
72
|
+
* **Idempotent: false.** Re-running `doc block-create` creates a
|
|
73
|
+
* SECOND block under the same anchor (Monday's wire allows
|
|
74
|
+
* duplicate content blocks within a doc). Agents that need
|
|
75
|
+
* idempotency must pair with a `doc get <doc-id>` lookup first to
|
|
76
|
+
* verify the block doesn't already exist.
|
|
77
|
+
*
|
|
78
|
+
* **Runtime body landed at v0.5-M36 IMPL.** `parseArgv` +
|
|
79
|
+
* `parseJsonArg` fire BEFORE `resolveClient` so invalid argv
|
|
80
|
+
* surfaces `usage_error` ahead of any missing-token `config_error`
|
|
81
|
+
* (R-NEW-76 graduated discipline). Dry-run path emits minimal
|
|
82
|
+
* planned changes (no wire call fires); live path dispatches
|
|
83
|
+
* {@link createDocBlock} + projects via `emitMutation`.
|
|
84
|
+
*/
|
|
85
|
+
import { z } from 'zod';
|
|
86
|
+
import { ensureSubcommand } from '../types.js';
|
|
87
|
+
import { parseArgv } from '../parse-argv.js';
|
|
88
|
+
import { parseJsonArg } from '../../utils/json.js';
|
|
89
|
+
import { emitDryRun, emitMutation } from '../emit.js';
|
|
90
|
+
import { resolveClient } from '../../api/resolve-client.js';
|
|
91
|
+
import { DocIdSchema, DocBlockIdSchema } from '../../types/ids.js';
|
|
92
|
+
import { createDocBlock, DOC_BLOCK_CONTENT_TYPE_VALUES, docBlockCreateOutputSchema, } from '../../api/documents.js';
|
|
93
|
+
const inputSchema = z
|
|
94
|
+
.object({
|
|
95
|
+
docId: DocIdSchema,
|
|
96
|
+
type: z.enum(DOC_BLOCK_CONTENT_TYPE_VALUES),
|
|
97
|
+
content: z.string().min(1, '--content must not be empty'),
|
|
98
|
+
after: DocBlockIdSchema.optional(),
|
|
99
|
+
parent: DocBlockIdSchema.optional(),
|
|
100
|
+
})
|
|
101
|
+
.strict();
|
|
102
|
+
export const docBlockCreateCommand = {
|
|
103
|
+
name: 'doc.block-create',
|
|
104
|
+
summary: 'Create a new rich-text block inside a workdoc (--type + --content required)',
|
|
105
|
+
examples: [
|
|
106
|
+
'monday doc block-create 88010 --type normal_text --content \'{"alignment":"left","content":"Hello"}\'',
|
|
107
|
+
'monday doc block-create 88010 --type code --content \'{"language":"ts","code":"console.log(1)"}\' --after blk_abc123',
|
|
108
|
+
'monday doc block-create 88010 --type bulleted_list --content \'{"items":["a","b"]}\' --parent blk_layout1',
|
|
109
|
+
'monday doc block-create 88010 --type divider --content \'{}\' --dry-run --json',
|
|
110
|
+
],
|
|
111
|
+
// Monday allows duplicate content blocks within a doc — re-running
|
|
112
|
+
// creates a second block at the same anchor. Mark non-idempotent
|
|
113
|
+
// so agents don't naively retry on transient failures.
|
|
114
|
+
idempotent: false,
|
|
115
|
+
inputSchema,
|
|
116
|
+
outputSchema: docBlockCreateOutputSchema,
|
|
117
|
+
attach: (program, ctx) => {
|
|
118
|
+
const noun = ensureSubcommand(program, 'doc', 'Workdoc commands');
|
|
119
|
+
noun
|
|
120
|
+
.command('block-create <docId>')
|
|
121
|
+
.description(docBlockCreateCommand.summary)
|
|
122
|
+
.requiredOption(`--type <${DOC_BLOCK_CONTENT_TYPE_VALUES.join('|')}>`, 'block content type (maps to wire `type: DocBlockContentType!`); 16 closed values')
|
|
123
|
+
.requiredOption('--content <json>', 'block content payload (JSON-encoded string parsed at argv boundary; shape varies per --type per Monday\'s `JSON` scalar)')
|
|
124
|
+
.option('--after <bid>', 'optional opaque block ID (maps to wire `after_block_id: String`); absent → block inserted at document head')
|
|
125
|
+
.option('--parent <bid>', 'optional opaque parent block ID (maps to wire `parent_block_id: String`); absent → block lands at document root')
|
|
126
|
+
.addHelpText('after', [
|
|
127
|
+
'',
|
|
128
|
+
'Examples:',
|
|
129
|
+
...docBlockCreateCommand.examples.map((e) => ` ${e}`),
|
|
130
|
+
'',
|
|
131
|
+
'Notes:',
|
|
132
|
+
' - `--content` must be a valid JSON string; per-block content shapes are documented in `output-shapes.md` "Per-block content shapes" reference table.',
|
|
133
|
+
' - Monday allows duplicate blocks at the same anchor; this verb is non-idempotent.',
|
|
134
|
+
' - `--dry-run` emits the planned `create_doc_block` operation + resolved input fields (no wire call fires; `meta.source: "none"`).',
|
|
135
|
+
'',
|
|
136
|
+
].join('\n'))
|
|
137
|
+
.action(async (docIdArg, opts) => {
|
|
138
|
+
const parsed = parseArgv(docBlockCreateCommand.inputSchema, {
|
|
139
|
+
docId: docIdArg,
|
|
140
|
+
type: opts.type,
|
|
141
|
+
content: opts.content,
|
|
142
|
+
...(opts.after === undefined ? {} : { after: opts.after }),
|
|
143
|
+
...(opts.parent === undefined ? {} : { parent: opts.parent }),
|
|
144
|
+
});
|
|
145
|
+
// Parse the opaque `--content` JSON string once at the
|
|
146
|
+
// boundary. Threading the raw string to Monday's `JSON`
|
|
147
|
+
// scalar would double-encode (Monday sees a JSON-string-of-
|
|
148
|
+
// a-string); parsing to a JS value first sends the intended
|
|
149
|
+
// shape. R-NEW-42 lift: shared `parseJsonArg` helper.
|
|
150
|
+
const parsedContent = parseJsonArg(parsed.content, {
|
|
151
|
+
context: '--content must be a valid JSON-encoded string',
|
|
152
|
+
details: {
|
|
153
|
+
doc_id: parsed.docId,
|
|
154
|
+
type: parsed.type,
|
|
155
|
+
hint: 'check the JSON syntax — strings need double-quotes; the ' +
|
|
156
|
+
'shell may consume quotes if --content is not single-quoted',
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
const { client, globalFlags, apiVersion } = resolveClient(ctx, program.opts());
|
|
160
|
+
if (globalFlags.dryRun) {
|
|
161
|
+
const planned = {
|
|
162
|
+
operation: 'create_doc_block',
|
|
163
|
+
doc_id: parsed.docId,
|
|
164
|
+
type: parsed.type,
|
|
165
|
+
content: parsedContent,
|
|
166
|
+
};
|
|
167
|
+
if (parsed.after !== undefined) {
|
|
168
|
+
planned.after_block_id = parsed.after;
|
|
169
|
+
}
|
|
170
|
+
if (parsed.parent !== undefined) {
|
|
171
|
+
planned.parent_block_id = parsed.parent;
|
|
172
|
+
}
|
|
173
|
+
emitDryRun({
|
|
174
|
+
ctx,
|
|
175
|
+
programOpts: program.opts(),
|
|
176
|
+
plannedChanges: [planned],
|
|
177
|
+
source: 'none',
|
|
178
|
+
cacheAgeSeconds: null,
|
|
179
|
+
warnings: [],
|
|
180
|
+
apiVersion,
|
|
181
|
+
});
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const result = await createDocBlock({
|
|
185
|
+
client,
|
|
186
|
+
docId: parsed.docId,
|
|
187
|
+
type: parsed.type,
|
|
188
|
+
content: parsedContent,
|
|
189
|
+
...(parsed.after === undefined ? {} : { afterBlockId: parsed.after }),
|
|
190
|
+
...(parsed.parent === undefined ? {} : { parentBlockId: parsed.parent }),
|
|
191
|
+
});
|
|
192
|
+
emitMutation({
|
|
193
|
+
ctx,
|
|
194
|
+
data: result.block,
|
|
195
|
+
schema: docBlockCreateCommand.outputSchema,
|
|
196
|
+
programOpts: program.opts(),
|
|
197
|
+
warnings: [],
|
|
198
|
+
source: result.source,
|
|
199
|
+
cacheAgeSeconds: result.cacheAgeSeconds,
|
|
200
|
+
complexity: result.complexity,
|
|
201
|
+
apiVersion,
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
//# sourceMappingURL=block-create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block-create.js","sourceRoot":"","sources":["../../../src/commands/doc/block-create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;G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CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;gBACrE,GAAG,CAAC,MAAM,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;aACzE,CAAC,CAAC;YACH,YAAY,CAAC;gBACX,GAAG;gBACH,IAAI,EAAE,MAAM,CAAC,KAAK;gBAClB,MAAM,EAAE,qBAAqB,CAAC,YAAY;gBAC1C,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,CACF,CAAC;IACN,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `monday doc block-delete <block-id> --yes [--dry-run]` — delete
|
|
3
|
+
* an existing rich-text block from a workdoc (`cli-design.md`
|
|
4
|
+
* §4.3 DOC section + §13 v0.5 entry; `v0.5-plan.md` §3 M36 +
|
|
5
|
+
* §8 D10-D11).
|
|
6
|
+
*
|
|
7
|
+
* **Confirmation gate** (cli-design §3.1 #7 + §10.2 + M10 round-1
|
|
8
|
+
* P2 invariant). `--yes` is mandatory for the live path; without
|
|
9
|
+
* `--yes` (and without `--dry-run`) the command fails fast with
|
|
10
|
+
* `confirmation_required` (exit 1) carrying `details.block_id`. The
|
|
11
|
+
* gate fires BEFORE `resolveClient()` so a missing token doesn't
|
|
12
|
+
* mask `confirmation_required` as `config_error` (same shape — and
|
|
13
|
+
* same gate-before-resolve ordering — as M14 `workspace delete` /
|
|
14
|
+
* M10 `item delete` / `update delete` / `team delete` / `doc delete`).
|
|
15
|
+
*
|
|
16
|
+
* **Wire shape.** Single `delete_doc_block(block_id) →
|
|
17
|
+
* DocumentBlockIdOnly` round-trip via {@link deleteDocBlock}
|
|
18
|
+
* against `mutation DeleteDocBlock` with `operationName:
|
|
19
|
+
* 'DeleteDocBlock'` (R-NEW-37 W2 audit-point). Returns a single-
|
|
20
|
+
* field OBJECT (`{id: String!}`) — Monday's wire mints a typed
|
|
21
|
+
* shape distinct from `DocumentBlock` (the deletion endpoint only
|
|
22
|
+
* confirms the id, doesn't echo the pre-delete content).
|
|
23
|
+
*
|
|
24
|
+
* **Snake_case wire arg names.** M36's wire uses snake_case
|
|
25
|
+
* (`block_id`) — back to Monday's standard cadence after the M35
|
|
26
|
+
* camelCase asymmetry. NOT a new R-NEW-41 supporting site.
|
|
27
|
+
*
|
|
28
|
+
* **Argv shape.**
|
|
29
|
+
*
|
|
30
|
+
* - `<block-id>` — required positional (Monday's
|
|
31
|
+
* `delete_doc_block.block_id` is `String!`). Brand-validated
|
|
32
|
+
* via {@link DocBlockIdSchema} (opaque non-empty string).
|
|
33
|
+
*
|
|
34
|
+
* **Output envelope.** Direct unwrap of the
|
|
35
|
+
* {@link documentBlockIdOnlySchema} shape — `data: { id }`. Envelope
|
|
36
|
+
* is intentionally narrower than the create/update variants
|
|
37
|
+
* because Monday's `delete_doc_block` wire only returns the id
|
|
38
|
+
* (NOT the full pre-delete block); the agent contract doesn't
|
|
39
|
+
* gain from speculatively rehydrating the block on the way out.
|
|
40
|
+
* Mirrors M35 `doc delete`'s narrow `{doc_id, success: true}`
|
|
41
|
+
* envelope-narrower-than-create rationale.
|
|
42
|
+
*
|
|
43
|
+
* **Dry-run shape** per cli-design §6.4 mutation-dry-run variant:
|
|
44
|
+
* minimal `{operation: "delete_doc_block", block_id}`. No
|
|
45
|
+
* preflight read fires; the dry-run is purely argv-derived.
|
|
46
|
+
* `meta.source: 'none'`. Mirrors `workspace delete` /
|
|
47
|
+
* `team delete` / `doc delete` — destructive-no-read pattern is
|
|
48
|
+
* uniform across destructive verbs.
|
|
49
|
+
*
|
|
50
|
+
* **Idempotent: false.** Re-running surfaces `not_found` past the
|
|
51
|
+
* first call (Monday's `delete_doc_block` wire returns null
|
|
52
|
+
* payload for already-deleted blocks; the fetcher rewraps to
|
|
53
|
+
* `not_found` per the standard delete cadence). Same rationale
|
|
54
|
+
* as `workspace delete` / `team delete` / `doc delete` — agents
|
|
55
|
+
* can't safely retry without verifying the id still names the
|
|
56
|
+
* same record.
|
|
57
|
+
*
|
|
58
|
+
* **Runtime body landed at v0.5-M36 IMPL.** Destructive gate fires
|
|
59
|
+
* BEFORE `resolveClient` (M10 round-1 P2 invariant); dry-run path
|
|
60
|
+
* emits minimal `{operation: "delete_doc_block", block_id}` (no wire
|
|
61
|
+
* call); live path dispatches {@link deleteDocBlock} + projects via
|
|
62
|
+
* `emitMutation`.
|
|
63
|
+
*/
|
|
64
|
+
import { z } from 'zod';
|
|
65
|
+
import { type CommandModule } from '../types.js';
|
|
66
|
+
import { type DocBlockDeleteOutput } from '../../api/documents.js';
|
|
67
|
+
declare const inputSchema: z.ZodObject<{
|
|
68
|
+
blockId: z.core.$ZodBranded<z.ZodString, "DocBlockId", "out">;
|
|
69
|
+
}, z.core.$strict>;
|
|
70
|
+
export declare const docBlockDeleteCommand: CommandModule<z.infer<typeof inputSchema>, DocBlockDeleteOutput>;
|
|
71
|
+
export {};
|
|
72
|
+
//# sourceMappingURL=block-delete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block-delete.d.ts","sourceRoot":"","sources":["../../../src/commands/doc/block-delete.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAOnE,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,wBAAwB,CAAC;AAEhC,QAAA,MAAM,WAAW;;kBAAmD,CAAC;AAErE,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAC/C,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,EAC3B,oBAAoB,CA8FrB,CAAC"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `monday doc block-delete <block-id> --yes [--dry-run]` — delete
|
|
3
|
+
* an existing rich-text block from a workdoc (`cli-design.md`
|
|
4
|
+
* §4.3 DOC section + §13 v0.5 entry; `v0.5-plan.md` §3 M36 +
|
|
5
|
+
* §8 D10-D11).
|
|
6
|
+
*
|
|
7
|
+
* **Confirmation gate** (cli-design §3.1 #7 + §10.2 + M10 round-1
|
|
8
|
+
* P2 invariant). `--yes` is mandatory for the live path; without
|
|
9
|
+
* `--yes` (and without `--dry-run`) the command fails fast with
|
|
10
|
+
* `confirmation_required` (exit 1) carrying `details.block_id`. The
|
|
11
|
+
* gate fires BEFORE `resolveClient()` so a missing token doesn't
|
|
12
|
+
* mask `confirmation_required` as `config_error` (same shape — and
|
|
13
|
+
* same gate-before-resolve ordering — as M14 `workspace delete` /
|
|
14
|
+
* M10 `item delete` / `update delete` / `team delete` / `doc delete`).
|
|
15
|
+
*
|
|
16
|
+
* **Wire shape.** Single `delete_doc_block(block_id) →
|
|
17
|
+
* DocumentBlockIdOnly` round-trip via {@link deleteDocBlock}
|
|
18
|
+
* against `mutation DeleteDocBlock` with `operationName:
|
|
19
|
+
* 'DeleteDocBlock'` (R-NEW-37 W2 audit-point). Returns a single-
|
|
20
|
+
* field OBJECT (`{id: String!}`) — Monday's wire mints a typed
|
|
21
|
+
* shape distinct from `DocumentBlock` (the deletion endpoint only
|
|
22
|
+
* confirms the id, doesn't echo the pre-delete content).
|
|
23
|
+
*
|
|
24
|
+
* **Snake_case wire arg names.** M36's wire uses snake_case
|
|
25
|
+
* (`block_id`) — back to Monday's standard cadence after the M35
|
|
26
|
+
* camelCase asymmetry. NOT a new R-NEW-41 supporting site.
|
|
27
|
+
*
|
|
28
|
+
* **Argv shape.**
|
|
29
|
+
*
|
|
30
|
+
* - `<block-id>` — required positional (Monday's
|
|
31
|
+
* `delete_doc_block.block_id` is `String!`). Brand-validated
|
|
32
|
+
* via {@link DocBlockIdSchema} (opaque non-empty string).
|
|
33
|
+
*
|
|
34
|
+
* **Output envelope.** Direct unwrap of the
|
|
35
|
+
* {@link documentBlockIdOnlySchema} shape — `data: { id }`. Envelope
|
|
36
|
+
* is intentionally narrower than the create/update variants
|
|
37
|
+
* because Monday's `delete_doc_block` wire only returns the id
|
|
38
|
+
* (NOT the full pre-delete block); the agent contract doesn't
|
|
39
|
+
* gain from speculatively rehydrating the block on the way out.
|
|
40
|
+
* Mirrors M35 `doc delete`'s narrow `{doc_id, success: true}`
|
|
41
|
+
* envelope-narrower-than-create rationale.
|
|
42
|
+
*
|
|
43
|
+
* **Dry-run shape** per cli-design §6.4 mutation-dry-run variant:
|
|
44
|
+
* minimal `{operation: "delete_doc_block", block_id}`. No
|
|
45
|
+
* preflight read fires; the dry-run is purely argv-derived.
|
|
46
|
+
* `meta.source: 'none'`. Mirrors `workspace delete` /
|
|
47
|
+
* `team delete` / `doc delete` — destructive-no-read pattern is
|
|
48
|
+
* uniform across destructive verbs.
|
|
49
|
+
*
|
|
50
|
+
* **Idempotent: false.** Re-running surfaces `not_found` past the
|
|
51
|
+
* first call (Monday's `delete_doc_block` wire returns null
|
|
52
|
+
* payload for already-deleted blocks; the fetcher rewraps to
|
|
53
|
+
* `not_found` per the standard delete cadence). Same rationale
|
|
54
|
+
* as `workspace delete` / `team delete` / `doc delete` — agents
|
|
55
|
+
* can't safely retry without verifying the id still names the
|
|
56
|
+
* same record.
|
|
57
|
+
*
|
|
58
|
+
* **Runtime body landed at v0.5-M36 IMPL.** Destructive gate fires
|
|
59
|
+
* BEFORE `resolveClient` (M10 round-1 P2 invariant); dry-run path
|
|
60
|
+
* emits minimal `{operation: "delete_doc_block", block_id}` (no wire
|
|
61
|
+
* call); live path dispatches {@link deleteDocBlock} + projects via
|
|
62
|
+
* `emitMutation`.
|
|
63
|
+
*/
|
|
64
|
+
import { z } from 'zod';
|
|
65
|
+
import { ensureSubcommand } from '../types.js';
|
|
66
|
+
import { parseArgv } from '../parse-argv.js';
|
|
67
|
+
import { parseGlobalFlags } from '../../types/global-flags.js';
|
|
68
|
+
import { enforceDestructiveGate } from '../../api/destructive-gate.js';
|
|
69
|
+
import { emitDryRun, emitMutation } from '../emit.js';
|
|
70
|
+
import { resolveClient } from '../../api/resolve-client.js';
|
|
71
|
+
import { DocBlockIdSchema } from '../../types/ids.js';
|
|
72
|
+
import { deleteDocBlock, docBlockDeleteOutputSchema, } from '../../api/documents.js';
|
|
73
|
+
const inputSchema = z.object({ blockId: DocBlockIdSchema }).strict();
|
|
74
|
+
export const docBlockDeleteCommand = {
|
|
75
|
+
name: 'doc.block-delete',
|
|
76
|
+
summary: 'Delete a rich-text block from a workdoc — --yes required',
|
|
77
|
+
examples: [
|
|
78
|
+
'monday doc block-delete blk_abc123 --yes',
|
|
79
|
+
'monday doc block-delete blk_abc123 --dry-run',
|
|
80
|
+
'monday doc block-delete blk_abc123 --yes --json',
|
|
81
|
+
],
|
|
82
|
+
// Re-deleting an already-deleted block surfaces `not_found`;
|
|
83
|
+
// re-running with the same `<block-id>` after an interim
|
|
84
|
+
// `doc block-create` would target a different record (Monday
|
|
85
|
+
// mints new block IDs on create). Mark non-idempotent.
|
|
86
|
+
idempotent: false,
|
|
87
|
+
inputSchema,
|
|
88
|
+
outputSchema: docBlockDeleteOutputSchema,
|
|
89
|
+
attach: (program, ctx) => {
|
|
90
|
+
const noun = ensureSubcommand(program, 'doc', 'Workdoc commands');
|
|
91
|
+
noun
|
|
92
|
+
.command('block-delete <blockId>')
|
|
93
|
+
.description(docBlockDeleteCommand.summary)
|
|
94
|
+
.addHelpText('after', [
|
|
95
|
+
'',
|
|
96
|
+
'Examples:',
|
|
97
|
+
...docBlockDeleteCommand.examples.map((e) => ` ${e}`),
|
|
98
|
+
'',
|
|
99
|
+
'Notes:',
|
|
100
|
+
' - Destructive — Monday\'s wire offers no restore mutation for blocks; agents needing reversal must recreate via `monday doc block-create` (lossy: new id, new position).',
|
|
101
|
+
' - Envelope projects Monday\'s `DocumentBlockIdOnly` wire return to `{ id }` — narrower than create/update because Monday\'s delete endpoint doesn\'t echo block content.',
|
|
102
|
+
' - `--dry-run` emits the planned `delete_doc_block` operation + resolved input fields (no wire call fires; `meta.source: "none"`).',
|
|
103
|
+
'',
|
|
104
|
+
].join('\n'))
|
|
105
|
+
.action(async (blockIdArg) => {
|
|
106
|
+
const parsed = parseArgv(docBlockDeleteCommand.inputSchema, {
|
|
107
|
+
blockId: blockIdArg,
|
|
108
|
+
});
|
|
109
|
+
// Gate BEFORE `resolveClient()` — M10 round-1 P2 invariant.
|
|
110
|
+
// A missing `--yes` must surface as `confirmation_required`
|
|
111
|
+
// per cli-design §3.1 #7's unconditional contract, never
|
|
112
|
+
// masked by `config_error` when no token is configured.
|
|
113
|
+
const preGateGlobalFlags = parseGlobalFlags(program.opts(), ctx.env);
|
|
114
|
+
enforceDestructiveGate({
|
|
115
|
+
globalFlags: preGateGlobalFlags,
|
|
116
|
+
verb: 'doc block-delete',
|
|
117
|
+
target: parsed.blockId,
|
|
118
|
+
detailKey: 'block_id',
|
|
119
|
+
action: 'delete the doc block',
|
|
120
|
+
hint: 'block-delete is destructive — Monday\'s wire surface offers ' +
|
|
121
|
+
'no restore mutation for doc blocks; agents needing reversal ' +
|
|
122
|
+
'must recreate via `monday doc block-create` (lossy: new id, ' +
|
|
123
|
+
'new position; content must be re-supplied).',
|
|
124
|
+
});
|
|
125
|
+
if (preGateGlobalFlags.dryRun) {
|
|
126
|
+
// Minimal dry-run shape — no preflight read fires. Mirrors
|
|
127
|
+
// `doc delete` / `team delete` / `workspace delete` cadence.
|
|
128
|
+
const { apiVersion } = resolveClient(ctx, program.opts());
|
|
129
|
+
emitDryRun({
|
|
130
|
+
ctx,
|
|
131
|
+
programOpts: program.opts(),
|
|
132
|
+
plannedChanges: [
|
|
133
|
+
{ operation: 'delete_doc_block', block_id: parsed.blockId },
|
|
134
|
+
],
|
|
135
|
+
source: 'none',
|
|
136
|
+
cacheAgeSeconds: null,
|
|
137
|
+
warnings: [],
|
|
138
|
+
apiVersion,
|
|
139
|
+
});
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const { client, apiVersion } = resolveClient(ctx, program.opts());
|
|
143
|
+
const result = await deleteDocBlock({
|
|
144
|
+
client,
|
|
145
|
+
blockId: parsed.blockId,
|
|
146
|
+
});
|
|
147
|
+
emitMutation({
|
|
148
|
+
ctx,
|
|
149
|
+
data: result.block,
|
|
150
|
+
schema: docBlockDeleteCommand.outputSchema,
|
|
151
|
+
programOpts: program.opts(),
|
|
152
|
+
warnings: [],
|
|
153
|
+
source: result.source,
|
|
154
|
+
cacheAgeSeconds: result.cacheAgeSeconds,
|
|
155
|
+
complexity: result.complexity,
|
|
156
|
+
apiVersion,
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
//# sourceMappingURL=block-delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block-delete.js","sourceRoot":"","sources":["../../../src/commands/doc/block-delete.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;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,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AAO,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,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `monday doc block-update <block-id> --content <json> [--dry-run]`
|
|
3
|
+
* — replace the content payload of an existing rich-text block
|
|
4
|
+
* inside a workdoc (`cli-design.md` §4.3 DOC section + §13 v0.5
|
|
5
|
+
* entry; `v0.5-plan.md` §3 M36 + §8 D10-D11).
|
|
6
|
+
*
|
|
7
|
+
* **Wire shape.** Single `update_doc_block(block_id, content) →
|
|
8
|
+
* DocumentBlock` round-trip via {@link updateDocBlock} against
|
|
9
|
+
* `mutation UpdateDocBlock` with `operationName: 'UpdateDocBlock'`
|
|
10
|
+
* (R-NEW-37 W2 audit-point). Returns the full 9-field
|
|
11
|
+
* `DocumentBlock` shape per the M32 probe (id / type / content /
|
|
12
|
+
* position / parent_block_id / doc_id / created_at / created_by /
|
|
13
|
+
* updated_at). OBJECT-return cadence (distinct from M35's opaque-
|
|
14
|
+
* JSON projection cadence).
|
|
15
|
+
*
|
|
16
|
+
* **Snake_case wire arg names.** M36's wire uses snake_case
|
|
17
|
+
* (`block_id`) — back to Monday's standard cadence after the M35
|
|
18
|
+
* camelCase asymmetry. NOT a new R-NEW-41 supporting site.
|
|
19
|
+
*
|
|
20
|
+
* **No `--type` slot on the wire.** Monday's `update_doc_block`
|
|
21
|
+
* mutation has no `type` arg — content type is fixed at creation
|
|
22
|
+
* time. Agents needing to switch a block's content type must
|
|
23
|
+
* `block-delete` + `block-create` (lossy: new id, new position).
|
|
24
|
+
* The CLI surface mirrors the wire constraint exactly — no
|
|
25
|
+
* client-side "change type" shim that papers over the destructive
|
|
26
|
+
* recreate.
|
|
27
|
+
*
|
|
28
|
+
* **Argv shape.**
|
|
29
|
+
*
|
|
30
|
+
* - `<block-id>` — required positional (Monday's
|
|
31
|
+
* `update_doc_block.block_id` is `String!`). Brand-validated
|
|
32
|
+
* via {@link DocBlockIdSchema} (opaque non-empty string —
|
|
33
|
+
* distinct from `DocId`'s numeric shape).
|
|
34
|
+
* - `--content <json>` — required JSON-string slot. Parsed once
|
|
35
|
+
* at the argv boundary via `parseJsonArg` (R-NEW-42 helper, 5th
|
|
36
|
+
* consumer; same shape `monday raw --vars` /
|
|
37
|
+
* `board column-create --settings` /
|
|
38
|
+
* `webhook create --config` / `doc block-create --content`
|
|
39
|
+
* use). The parsed JS value passes through to Monday's wire
|
|
40
|
+
* `JSON` scalar unmodified. The new content payload MUST match
|
|
41
|
+
* the existing block's `DocBlockContentType` shape (Monday's
|
|
42
|
+
* wire rejects shape-incompatible payloads with
|
|
43
|
+
* `validation_failed`); the CLI doesn't pre-validate.
|
|
44
|
+
*
|
|
45
|
+
* **Output envelope.** Direct unwrap of the updated DocumentBlock
|
|
46
|
+
* — `data: <DocumentBlock>` per cli-design §6.1 single-record
|
|
47
|
+
* convention. Mirrors `block-create`'s output shape — Monday's
|
|
48
|
+
* wire returns the full post-update block.
|
|
49
|
+
*
|
|
50
|
+
* **Dry-run shape** per cli-design §6.4 mutation-dry-run variant:
|
|
51
|
+
* minimal `{operation: "update_doc_block", block_id, content}`. No
|
|
52
|
+
* preflight read fires; the dry-run is purely argv-derived.
|
|
53
|
+
* `meta.source: 'none'`.
|
|
54
|
+
*
|
|
55
|
+
* **Idempotent: yes.** Re-running with the same `<block-id>` and
|
|
56
|
+
* `--content` produces the same end state; Monday's wire is a
|
|
57
|
+
* no-op when the content value matches.
|
|
58
|
+
*
|
|
59
|
+
* **Runtime body landed at v0.5-M36 IMPL.** `parseArgv` +
|
|
60
|
+
* `parseJsonArg` fire BEFORE `resolveClient` so invalid argv
|
|
61
|
+
* surfaces `usage_error` ahead of any missing-token `config_error`
|
|
62
|
+
* (R-NEW-76 graduated discipline). Dry-run path emits minimal
|
|
63
|
+
* planned changes (no wire call fires); live path dispatches
|
|
64
|
+
* {@link updateDocBlock} + projects via `emitMutation`.
|
|
65
|
+
*/
|
|
66
|
+
import { z } from 'zod';
|
|
67
|
+
import { type CommandModule } from '../types.js';
|
|
68
|
+
import { type DocBlockUpdateOutput } from '../../api/documents.js';
|
|
69
|
+
declare const inputSchema: z.ZodObject<{
|
|
70
|
+
blockId: z.core.$ZodBranded<z.ZodString, "DocBlockId", "out">;
|
|
71
|
+
content: z.ZodString;
|
|
72
|
+
}, z.core.$strict>;
|
|
73
|
+
export declare const docBlockUpdateCommand: CommandModule<z.infer<typeof inputSchema>, DocBlockUpdateOutput>;
|
|
74
|
+
export {};
|
|
75
|
+
//# sourceMappingURL=block-update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block-update.d.ts","sourceRoot":"","sources":["../../../src/commands/doc/block-update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAMnE,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,wBAAwB,CAAC;AAEhC,QAAA,MAAM,WAAW;;;kBAKN,CAAC;AAEZ,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAC/C,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,EAC3B,oBAAoB,CAqGrB,CAAC"}
|