monday-cli 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +719 -0
- package/README.md +208 -36
- package/dist/api/assets.d.ts +326 -0
- package/dist/api/assets.d.ts.map +1 -0
- package/dist/api/assets.js +519 -0
- package/dist/api/assets.js.map +1 -0
- package/dist/api/column-types.d.ts +13 -7
- package/dist/api/column-types.d.ts.map +1 -1
- package/dist/api/column-types.js +7 -3
- package/dist/api/column-types.js.map +1 -1
- package/dist/api/column-values.d.ts +8 -1
- package/dist/api/column-values.d.ts.map +1 -1
- package/dist/api/column-values.js +16 -6
- package/dist/api/column-values.js.map +1 -1
- package/dist/api/documents.d.ts +1652 -0
- package/dist/api/documents.d.ts.map +1 -0
- package/dist/api/documents.js +2411 -0
- package/dist/api/documents.js.map +1 -0
- package/dist/api/item-watch.d.ts +263 -0
- package/dist/api/item-watch.d.ts.map +1 -0
- package/dist/api/item-watch.js +709 -0
- package/dist/api/item-watch.js.map +1 -0
- package/dist/api/multipart-transport.d.ts +223 -0
- package/dist/api/multipart-transport.d.ts.map +1 -0
- package/dist/api/multipart-transport.js +274 -0
- package/dist/api/multipart-transport.js.map +1 -0
- package/dist/api/parallel-dispatch.d.ts +155 -0
- package/dist/api/parallel-dispatch.d.ts.map +1 -0
- package/dist/api/parallel-dispatch.js +243 -0
- package/dist/api/parallel-dispatch.js.map +1 -0
- package/dist/api/partial-success-bulk.d.ts +118 -60
- package/dist/api/partial-success-bulk.d.ts.map +1 -1
- package/dist/api/partial-success-bulk.js +137 -79
- package/dist/api/partial-success-bulk.js.map +1 -1
- package/dist/api/partial-success-mutation.d.ts +13 -1
- package/dist/api/partial-success-mutation.d.ts.map +1 -1
- package/dist/api/partial-success-mutation.js +5 -1
- package/dist/api/partial-success-mutation.js.map +1 -1
- package/dist/api/raw-write.d.ts +13 -4
- package/dist/api/raw-write.d.ts.map +1 -1
- package/dist/api/raw-write.js +22 -11
- package/dist/api/raw-write.js.map +1 -1
- package/dist/api/resolve-client.d.ts +11 -0
- package/dist/api/resolve-client.d.ts.map +1 -1
- package/dist/api/resolve-client.js +9 -1
- package/dist/api/resolve-client.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/cli/run.d.ts +20 -0
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +1 -0
- package/dist/cli/run.js.map +1 -1
- package/dist/commands/board/column-create.d.ts +6 -5
- package/dist/commands/board/column-create.d.ts.map +1 -1
- package/dist/commands/board/column-create.js +9 -6
- package/dist/commands/board/column-create.js.map +1 -1
- package/dist/commands/completion.d.ts +188 -0
- package/dist/commands/completion.d.ts.map +1 -0
- package/dist/commands/completion.js +418 -0
- package/dist/commands/completion.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/get.d.ts +46 -0
- package/dist/commands/doc/get.d.ts.map +1 -0
- package/dist/commands/doc/get.js +95 -0
- package/dist/commands/doc/get.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 +86 -0
- package/dist/commands/doc/list.d.ts.map +1 -0
- package/dist/commands/doc/list.js +217 -0
- package/dist/commands/doc/list.js.map +1 -0
- 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 +162 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/item/create.js +2 -2
- package/dist/commands/item/update.d.ts +1 -0
- package/dist/commands/item/update.d.ts.map +1 -1
- package/dist/commands/item/update.js +61 -0
- package/dist/commands/item/update.js.map +1 -1
- package/dist/commands/item/upload.d.ts +108 -0
- package/dist/commands/item/upload.d.ts.map +1 -0
- package/dist/commands/item/upload.js +370 -0
- package/dist/commands/item/upload.js.map +1 -0
- package/dist/commands/item/watch.d.ts +90 -0
- package/dist/commands/item/watch.d.ts.map +1 -0
- package/dist/commands/item/watch.js +342 -0
- package/dist/commands/item/watch.js.map +1 -0
- 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/update/upload.d.ts +69 -0
- package/dist/commands/update/upload.d.ts.map +1 -0
- package/dist/commands/update/upload.js +235 -0
- package/dist/commands/update/upload.js.map +1 -0
- 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 +8 -0
- package/dist/types/ids.d.ts.map +1 -1
- package/dist/types/ids.js +53 -5
- package/dist/types/ids.js.map +1 -1
- package/dist/utils/mime.d.ts +24 -0
- package/dist/utils/mime.d.ts.map +1 -0
- package/dist/utils/mime.js +64 -0
- package/dist/utils/mime.js.map +1 -0
- package/dist/utils/output/envelope.d.ts +30 -0
- package/dist/utils/output/envelope.d.ts.map +1 -1
- package/dist/utils/output/envelope.js +26 -0
- package/dist/utils/output/envelope.js.map +1 -1
- package/dist/utils/output/ndjson.d.ts +25 -0
- package/dist/utils/output/ndjson.d.ts.map +1 -1
- package/dist/utils/output/ndjson.js +12 -0
- package/dist/utils/output/ndjson.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/signal.d.ts +42 -0
- package/dist/utils/signal.d.ts.map +1 -0
- package/dist/utils/signal.js +45 -0
- package/dist/utils/signal.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,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,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AAC,GAAG,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;YAClE,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC;gBAClC,MAAM;gBACN,OAAO,EAAE,MAAM,CAAC,OAAO;aACxB,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,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"}
|
|
@@ -0,0 +1,162 @@
|
|
|
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 { ensureSubcommand } from '../types.js';
|
|
68
|
+
import { parseArgv } from '../parse-argv.js';
|
|
69
|
+
import { parseJsonArg } from '../../utils/json.js';
|
|
70
|
+
import { emitDryRun, emitMutation } from '../emit.js';
|
|
71
|
+
import { resolveClient } from '../../api/resolve-client.js';
|
|
72
|
+
import { DocBlockIdSchema } from '../../types/ids.js';
|
|
73
|
+
import { updateDocBlock, docBlockUpdateOutputSchema, } from '../../api/documents.js';
|
|
74
|
+
const inputSchema = z
|
|
75
|
+
.object({
|
|
76
|
+
blockId: DocBlockIdSchema,
|
|
77
|
+
content: z.string().min(1, '--content must not be empty'),
|
|
78
|
+
})
|
|
79
|
+
.strict();
|
|
80
|
+
export const docBlockUpdateCommand = {
|
|
81
|
+
name: 'doc.block-update',
|
|
82
|
+
summary: 'Replace the content payload of an existing doc block (--content required)',
|
|
83
|
+
examples: [
|
|
84
|
+
'monday doc block-update blk_abc123 --content \'{"alignment":"center","content":"Hi"}\'',
|
|
85
|
+
'monday doc block-update blk_abc123 --content \'{"items":["x","y","z"]}\' --dry-run --json',
|
|
86
|
+
],
|
|
87
|
+
// Re-running with the same content is a no-op on Monday's wire;
|
|
88
|
+
// re-running converges idempotently.
|
|
89
|
+
idempotent: true,
|
|
90
|
+
inputSchema,
|
|
91
|
+
outputSchema: docBlockUpdateOutputSchema,
|
|
92
|
+
attach: (program, ctx) => {
|
|
93
|
+
const noun = ensureSubcommand(program, 'doc', 'Workdoc commands');
|
|
94
|
+
noun
|
|
95
|
+
.command('block-update <blockId>')
|
|
96
|
+
.description(docBlockUpdateCommand.summary)
|
|
97
|
+
.requiredOption('--content <json>', 'new block content payload (JSON-encoded string parsed at argv boundary; shape must match the block\'s existing content type)')
|
|
98
|
+
.addHelpText('after', [
|
|
99
|
+
'',
|
|
100
|
+
'Examples:',
|
|
101
|
+
...docBlockUpdateCommand.examples.map((e) => ` ${e}`),
|
|
102
|
+
'',
|
|
103
|
+
'Notes:',
|
|
104
|
+
' - Monday\'s wire has no `type` arg on `update_doc_block`; content type is fixed at block creation. Agents needing to change type use `doc block-delete` + `doc block-create` (lossy: new id, new position).',
|
|
105
|
+
' - Per-block content shapes are documented in `output-shapes.md` "Per-block content shapes" reference table.',
|
|
106
|
+
' - `--dry-run` emits the planned `update_doc_block` operation + resolved input fields (no wire call fires; `meta.source: "none"`).',
|
|
107
|
+
'',
|
|
108
|
+
].join('\n'))
|
|
109
|
+
.action(async (blockIdArg, opts) => {
|
|
110
|
+
const parsed = parseArgv(docBlockUpdateCommand.inputSchema, {
|
|
111
|
+
blockId: blockIdArg,
|
|
112
|
+
content: opts.content,
|
|
113
|
+
});
|
|
114
|
+
// Parse the opaque `--content` JSON string once at the
|
|
115
|
+
// boundary (R-NEW-42 lift).
|
|
116
|
+
const parsedContent = parseJsonArg(parsed.content, {
|
|
117
|
+
context: '--content must be a valid JSON-encoded string',
|
|
118
|
+
details: {
|
|
119
|
+
block_id: parsed.blockId,
|
|
120
|
+
hint: 'check the JSON syntax — strings need double-quotes; the ' +
|
|
121
|
+
'shell may consume quotes if --content is not single-quoted',
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
const { client, globalFlags, apiVersion } = resolveClient(ctx, program.opts());
|
|
125
|
+
if (globalFlags.dryRun) {
|
|
126
|
+
emitDryRun({
|
|
127
|
+
ctx,
|
|
128
|
+
programOpts: program.opts(),
|
|
129
|
+
plannedChanges: [
|
|
130
|
+
{
|
|
131
|
+
operation: 'update_doc_block',
|
|
132
|
+
block_id: parsed.blockId,
|
|
133
|
+
content: parsedContent,
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
source: 'none',
|
|
137
|
+
cacheAgeSeconds: null,
|
|
138
|
+
warnings: [],
|
|
139
|
+
apiVersion,
|
|
140
|
+
});
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const result = await updateDocBlock({
|
|
144
|
+
client,
|
|
145
|
+
blockId: parsed.blockId,
|
|
146
|
+
content: parsedContent,
|
|
147
|
+
});
|
|
148
|
+
emitMutation({
|
|
149
|
+
ctx,
|
|
150
|
+
data: result.block,
|
|
151
|
+
schema: docBlockUpdateCommand.outputSchema,
|
|
152
|
+
programOpts: program.opts(),
|
|
153
|
+
warnings: [],
|
|
154
|
+
source: result.source,
|
|
155
|
+
cacheAgeSeconds: result.cacheAgeSeconds,
|
|
156
|
+
complexity: result.complexity,
|
|
157
|
+
apiVersion,
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
//# sourceMappingURL=block-update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block-update.js","sourceRoot":"","sources":["../../../src/commands/doc/block-update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;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,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,cAAc,EACd,0BAA0B,GAE3B,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,GAAG,CAAC;KAClB,MAAM,CAAC;IACN,OAAO,EAAE,gBAAgB;IACzB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,6BAA6B,CAAC;CAC1D,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ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,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,aAAa,CACvD,GAAG,EACH,OAAO,CAAC,IAAI,EAAE,CACf,CAAC;YAEF,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;gBACvB,UAAU,CAAC;oBACT,GAAG;oBACH,WAAW,EAAE,OAAO,CAAC,IAAI,EAAE;oBAC3B,cAAc,EAAE;wBACd;4BACE,SAAS,EAAE,kBAAkB;4BAC7B,QAAQ,EAAE,MAAM,CAAC,OAAO;4BACxB,OAAO,EAAE,aAAa;yBACvB;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,cAAc,CAAC;gBAClC,MAAM;gBACN,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,OAAO,EAAE,aAAa;aACvB,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,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `monday doc create-in-workspace --workspace <wid> --name <n>
|
|
3
|
+
* [--folder <fid>] [--kind public|private|share] [--dry-run]` —
|
|
4
|
+
* create a new workspace-scoped workdoc (`cli-design.md` §4.3
|
|
5
|
+
* DOC section + §13 v0.5 entry; `v0.5-plan.md` §3 M35 + §8 D7-D9).
|
|
6
|
+
*
|
|
7
|
+
* **Wire shape.** Single `create_doc(location: {workspace: ...})`
|
|
8
|
+
* round-trip via {@link createDocInWorkspace} against `mutation
|
|
9
|
+
* CreateDocInWorkspace` with `operationName:
|
|
10
|
+
* 'CreateDocInWorkspace'` (R-NEW-37 W2 audit-point). Returns the
|
|
11
|
+
* created `Document` with `id` populated post-create. The wire's
|
|
12
|
+
* `CreateDocInput` is mutually-exclusive between `board` (item-
|
|
13
|
+
* scoped) and `workspace` (workspace-scoped) variants per D7; this
|
|
14
|
+
* verb supplies only the `workspace` slot. The sibling verb
|
|
15
|
+
* `monday doc create-on-column` covers the board variant.
|
|
16
|
+
*
|
|
17
|
+
* **Argv shape.**
|
|
18
|
+
*
|
|
19
|
+
* - `--workspace <wid>` — required (Monday's
|
|
20
|
+
* `CreateDocWorkspaceInput.workspace_id` is `ID!`). Numeric
|
|
21
|
+
* workspace ID; brand-validated via {@link WorkspaceIdSchema}
|
|
22
|
+
* at the parse boundary.
|
|
23
|
+
* - `--name <n>` — required (Monday's
|
|
24
|
+
* `CreateDocWorkspaceInput.name` is `String!`). Empty string
|
|
25
|
+
* rejects at parse.
|
|
26
|
+
* - `--folder <fid>` — optional (maps to wire `folder_id: ID`).
|
|
27
|
+
* Numeric folder ID; brand-validated via the existing folder-
|
|
28
|
+
* id brand. Absent → omitted (doc lands at workspace root).
|
|
29
|
+
* - `--kind <k>` — optional 3-value closed enum
|
|
30
|
+
* (`public` / `private` / `share`); maps to wire
|
|
31
|
+
* `kind: BoardKind`. Absent → omitted (Monday's wire applies
|
|
32
|
+
* the workspace-default kind).
|
|
33
|
+
*
|
|
34
|
+
* **Output envelope.** Direct unwrap of the created Document —
|
|
35
|
+
* `data: <Document>`. Mirrors M32 `doc get` cadence (sans the
|
|
36
|
+
* `blocks` slot — Monday returns `blocks: null` on a fresh create).
|
|
37
|
+
*
|
|
38
|
+
* **Dry-run shape** per cli-design §6.4 mutation-dry-run variant.
|
|
39
|
+
* Minimal envelope listing the planned `create_doc` operation +
|
|
40
|
+
* the resolved input fields (`workspace_id`, `name`, optional
|
|
41
|
+
* `folder_id`, optional `kind`). No preflight read fires; the
|
|
42
|
+
* dry-run is purely argv-derived. `meta.source: 'none'`.
|
|
43
|
+
*
|
|
44
|
+
* **Idempotent: false.** Re-running `doc create-in-workspace
|
|
45
|
+
* --name foo` creates a SECOND doc with the same name (Monday
|
|
46
|
+
* allows duplicate doc names within a workspace). Agents that
|
|
47
|
+
* need idempotency must pair with a `doc list` lookup first.
|
|
48
|
+
*
|
|
49
|
+
* **Permission-sensitive.** Tokens lacking workdoc-create scope
|
|
50
|
+
* on the target workspace surface `forbidden` (mapped from
|
|
51
|
+
* Monday's PERMISSION_DENIED extension).
|
|
52
|
+
*
|
|
53
|
+
* **Runtime body landed at v0.5-M35 IMPL.** `parseArgv` runs
|
|
54
|
+
* BEFORE `resolveClient` so invalid argv surfaces `usage_error`
|
|
55
|
+
* ahead of any missing-token `config_error`; `resolveClient`
|
|
56
|
+
* parses global flags internally before `loadConfig`. Dry-run
|
|
57
|
+
* path emits minimal planned changes (no wire call fires); live
|
|
58
|
+
* path dispatches {@link createDocInWorkspace} + projects via
|
|
59
|
+
* `emitMutation`.
|
|
60
|
+
*/
|
|
61
|
+
import { z } from 'zod';
|
|
62
|
+
import { type CommandModule } from '../types.js';
|
|
63
|
+
import { type DocCreateInWorkspaceOutput } from '../../api/documents.js';
|
|
64
|
+
declare const inputSchema: z.ZodObject<{
|
|
65
|
+
workspace: z.core.$ZodBranded<z.ZodString, "WorkspaceId", "out">;
|
|
66
|
+
name: z.ZodString;
|
|
67
|
+
folder: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "DocFolderId", "out">>;
|
|
68
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
69
|
+
public: "public";
|
|
70
|
+
private: "private";
|
|
71
|
+
share: "share";
|
|
72
|
+
}>>;
|
|
73
|
+
}, z.core.$strict>;
|
|
74
|
+
export declare const docCreateInWorkspaceCommand: CommandModule<z.infer<typeof inputSchema>, DocCreateInWorkspaceOutput>;
|
|
75
|
+
export {};
|
|
76
|
+
//# sourceMappingURL=create-in-workspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-in-workspace.d.ts","sourceRoot":"","sources":["../../../src/commands/doc/create-in-workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAKnE,OAAO,EAIL,KAAK,0BAA0B,EAChC,MAAM,wBAAwB,CAAC;AAEhC,QAAA,MAAM,WAAW;;;;;;;;;kBAON,CAAC;AAEZ,eAAO,MAAM,2BAA2B,EAAE,aAAa,CACrD,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,EAC3B,0BAA0B,CAoG3B,CAAC"}
|