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,164 @@
|
|
|
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 { ensureSubcommand } from '../types.js';
|
|
63
|
+
import { parseArgv } from '../parse-argv.js';
|
|
64
|
+
import { emitDryRun, emitMutation } from '../emit.js';
|
|
65
|
+
import { resolveClient } from '../../api/resolve-client.js';
|
|
66
|
+
import { WorkspaceIdSchema, DocFolderIdSchema } from '../../types/ids.js';
|
|
67
|
+
import { createDocInWorkspace, DOC_KIND_VALUES, docCreateInWorkspaceOutputSchema, } from '../../api/documents.js';
|
|
68
|
+
const inputSchema = z
|
|
69
|
+
.object({
|
|
70
|
+
workspace: WorkspaceIdSchema,
|
|
71
|
+
name: z.string().min(1, '--name must not be empty'),
|
|
72
|
+
folder: DocFolderIdSchema.optional(),
|
|
73
|
+
kind: z.enum(DOC_KIND_VALUES).optional(),
|
|
74
|
+
})
|
|
75
|
+
.strict();
|
|
76
|
+
export const docCreateInWorkspaceCommand = {
|
|
77
|
+
name: 'doc.create-in-workspace',
|
|
78
|
+
summary: 'Create a workspace-scoped workdoc (--workspace + --name required)',
|
|
79
|
+
examples: [
|
|
80
|
+
'monday doc create-in-workspace --workspace 5555 --name "Q4 launch plan"',
|
|
81
|
+
'monday doc create-in-workspace --workspace 5555 --name "Q4 launch plan" --folder 12345',
|
|
82
|
+
'monday doc create-in-workspace --workspace 5555 --name "Q4 launch plan" --kind private',
|
|
83
|
+
'monday doc create-in-workspace --workspace 5555 --name "Q4 launch plan" --dry-run --json',
|
|
84
|
+
],
|
|
85
|
+
// Re-running creates a duplicate-named doc — Monday's wire does
|
|
86
|
+
// NOT dedupe by name within a workspace. Mark non-idempotent so
|
|
87
|
+
// agents don't naively retry on transient failures.
|
|
88
|
+
idempotent: false,
|
|
89
|
+
inputSchema,
|
|
90
|
+
outputSchema: docCreateInWorkspaceOutputSchema,
|
|
91
|
+
attach: (program, ctx) => {
|
|
92
|
+
const noun = ensureSubcommand(program, 'doc', 'Workdoc commands');
|
|
93
|
+
noun
|
|
94
|
+
.command('create-in-workspace')
|
|
95
|
+
.description(docCreateInWorkspaceCommand.summary)
|
|
96
|
+
.requiredOption('--workspace <wid>', 'numeric workspace ID (maps to wire `workspace_id: ID!`)')
|
|
97
|
+
.requiredOption('--name <n>', 'doc name (Monday\'s `String!` — must not be empty)')
|
|
98
|
+
.option('--folder <fid>', 'optional numeric folder ID (maps to wire `folder_id: ID`); absent → doc lands at workspace root')
|
|
99
|
+
.option(`--kind <${DOC_KIND_VALUES.join('|')}>`, `optional doc kind (maps to wire \`kind: BoardKind\`); absent → Monday's workspace-default kind applies`)
|
|
100
|
+
.addHelpText('after', [
|
|
101
|
+
'',
|
|
102
|
+
'Examples:',
|
|
103
|
+
...docCreateInWorkspaceCommand.examples.map((e) => ` ${e}`),
|
|
104
|
+
'',
|
|
105
|
+
'Notes:',
|
|
106
|
+
' - Monday allows duplicate doc names within a workspace; this verb is non-idempotent.',
|
|
107
|
+
' - `--dry-run` emits the planned `create_doc` operation + resolved input fields (no wire call fires; `meta.source: "none"`).',
|
|
108
|
+
' - For item-scoped docs use `monday doc create-on-column --item <iid> --column <cid>`.',
|
|
109
|
+
'',
|
|
110
|
+
].join('\n'))
|
|
111
|
+
.action(async (opts) => {
|
|
112
|
+
const parsed = parseArgv(docCreateInWorkspaceCommand.inputSchema, opts);
|
|
113
|
+
const { client, globalFlags, apiVersion } = resolveClient(ctx, program.opts());
|
|
114
|
+
if (globalFlags.dryRun) {
|
|
115
|
+
// Minimal dry-run shape per cli-design §6.4 mutation-
|
|
116
|
+
// dry-run variant — argv-derived, no preflight read.
|
|
117
|
+
// Only supplied input slots land in the planned payload
|
|
118
|
+
// (mirrors the wire-side omit-vs-null discipline the live
|
|
119
|
+
// path uses; agents see exactly what the live mutation
|
|
120
|
+
// would send).
|
|
121
|
+
const planned = {
|
|
122
|
+
operation: 'create_doc',
|
|
123
|
+
workspace_id: parsed.workspace,
|
|
124
|
+
name: parsed.name,
|
|
125
|
+
};
|
|
126
|
+
if (parsed.folder !== undefined) {
|
|
127
|
+
planned.folder_id = parsed.folder;
|
|
128
|
+
}
|
|
129
|
+
if (parsed.kind !== undefined) {
|
|
130
|
+
planned.kind = parsed.kind;
|
|
131
|
+
}
|
|
132
|
+
emitDryRun({
|
|
133
|
+
ctx,
|
|
134
|
+
programOpts: program.opts(),
|
|
135
|
+
plannedChanges: [planned],
|
|
136
|
+
source: 'none',
|
|
137
|
+
cacheAgeSeconds: null,
|
|
138
|
+
warnings: [],
|
|
139
|
+
apiVersion,
|
|
140
|
+
});
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const result = await createDocInWorkspace({
|
|
144
|
+
client,
|
|
145
|
+
workspaceId: parsed.workspace,
|
|
146
|
+
name: parsed.name,
|
|
147
|
+
...(parsed.folder === undefined ? {} : { folderId: parsed.folder }),
|
|
148
|
+
...(parsed.kind === undefined ? {} : { kind: parsed.kind }),
|
|
149
|
+
});
|
|
150
|
+
emitMutation({
|
|
151
|
+
ctx,
|
|
152
|
+
data: result.document,
|
|
153
|
+
schema: docCreateInWorkspaceCommand.outputSchema,
|
|
154
|
+
programOpts: program.opts(),
|
|
155
|
+
warnings: [],
|
|
156
|
+
source: result.source,
|
|
157
|
+
cacheAgeSeconds: result.cacheAgeSeconds,
|
|
158
|
+
complexity: result.complexity,
|
|
159
|
+
apiVersion,
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
//# sourceMappingURL=create-in-workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-in-workspace.js","sourceRoot":"","sources":["../../../src/commands/doc/create-in-workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;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,oBAAoB,EACpB,eAAe,EACf,gCAAgC,GAEjC,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,GAAG,CAAC;KAClB,MAAM,CAAC;IACN,SAAS,EAAE,iBAAiB;IAC5B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,0BAA0B,CAAC;IACnD,MAAM,EAAE,iBAAiB,CAAC,QAAQ,EAAE;IACpC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,QAAQ,EAAE;CACzC,CAAC;KACD,MA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YACH,YAAY,CAAC;gBACX,GAAG;gBACH,IAAI,EAAE,MAAM,CAAC,QAAQ;gBACrB,MAAM,EAAE,2BAA2B,CAAC,YAAY;gBAChD,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,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `monday doc create-on-column --item <iid> --column <cid>
|
|
3
|
+
* [--dry-run]` — create a new workdoc embedded into a doc-column
|
|
4
|
+
* on an existing item (`cli-design.md` §4.3 DOC section + §13
|
|
5
|
+
* v0.5 entry; `v0.5-plan.md` §3 M35 + §8 D7-D9).
|
|
6
|
+
*
|
|
7
|
+
* **Wire shape.** Single `create_doc(location: {board: ...})`
|
|
8
|
+
* round-trip via {@link createDocOnColumn} against `mutation
|
|
9
|
+
* CreateDocOnColumn` with `operationName: 'CreateDocOnColumn'`
|
|
10
|
+
* (R-NEW-37 W2 audit-point). Returns the created `Document`.
|
|
11
|
+
* The wire's `CreateDocInput` is mutually-exclusive between
|
|
12
|
+
* `board` (item-scoped) and `workspace` (workspace-scoped)
|
|
13
|
+
* variants per D7; this verb supplies only the `board` slot.
|
|
14
|
+
* The sibling verb `monday doc create-in-workspace` covers the
|
|
15
|
+
* workspace variant.
|
|
16
|
+
*
|
|
17
|
+
* **Argv shape.**
|
|
18
|
+
*
|
|
19
|
+
* - `--item <iid>` — required (Monday's
|
|
20
|
+
* `CreateDocBoardInput.item_id` is `ID!`). Numeric item ID;
|
|
21
|
+
* brand-validated via {@link ItemIdSchema}.
|
|
22
|
+
* - `--column <cid>` — required (Monday's
|
|
23
|
+
* `CreateDocBoardInput.column_id` is `ID!`). Column ID slug;
|
|
24
|
+
* brand-validated via {@link ColumnIdSchema}. The column must
|
|
25
|
+
* be a doc-typed column on the item's board — CLI doesn't
|
|
26
|
+
* pre-check column-type compatibility (mirrors M8's
|
|
27
|
+
* `change_column_value` cadence); incompatible columns
|
|
28
|
+
* surface `validation_failed` at the wire.
|
|
29
|
+
*
|
|
30
|
+
* **Output envelope.** Direct unwrap of the created Document —
|
|
31
|
+
* `data: <Document>`. Same shape as
|
|
32
|
+
* `monday doc create-in-workspace` per the create-variant
|
|
33
|
+
* symmetry.
|
|
34
|
+
*
|
|
35
|
+
* **Dry-run shape** per cli-design §6.4 mutation-dry-run variant.
|
|
36
|
+
* Minimal envelope listing the planned `create_doc` operation +
|
|
37
|
+
* the resolved input fields (`item_id`, `column_id`). No
|
|
38
|
+
* preflight read fires; the dry-run is purely argv-derived.
|
|
39
|
+
* `meta.source: 'none'`.
|
|
40
|
+
*
|
|
41
|
+
* **Idempotent: false.** Re-running creates a SECOND doc on the
|
|
42
|
+
* same column slot (Monday's wire allows multiple docs to attach
|
|
43
|
+
* to one item-column pair). Agents that need idempotency must
|
|
44
|
+
* pair with a column-value read first.
|
|
45
|
+
*
|
|
46
|
+
* **Permission-sensitive.** Tokens lacking write scope on the
|
|
47
|
+
* target item's board (or lacking the column-write permission
|
|
48
|
+
* for the doc-typed column) surface `forbidden` (mapped from
|
|
49
|
+
* Monday's PERMISSION_DENIED extension). Distinct from the
|
|
50
|
+
* separate `validation_failed` rejection for incompatible
|
|
51
|
+
* column types — permission failure precedes column-type
|
|
52
|
+
* validation at Monday's wire.
|
|
53
|
+
*
|
|
54
|
+
* **Runtime body landed at v0.5-M35 IMPL.** `parseArgv` runs
|
|
55
|
+
* BEFORE `resolveClient` so invalid argv surfaces `usage_error`
|
|
56
|
+
* ahead of any missing-token `config_error`; `resolveClient`
|
|
57
|
+
* parses global flags internally before `loadConfig`. Dry-run
|
|
58
|
+
* path emits minimal planned changes (no wire call fires); live
|
|
59
|
+
* path dispatches {@link createDocOnColumn} + projects via
|
|
60
|
+
* `emitMutation`.
|
|
61
|
+
*/
|
|
62
|
+
import { z } from 'zod';
|
|
63
|
+
import { type CommandModule } from '../types.js';
|
|
64
|
+
import { type DocCreateOnColumnOutput } from '../../api/documents.js';
|
|
65
|
+
declare const inputSchema: z.ZodObject<{
|
|
66
|
+
item: z.core.$ZodBranded<z.ZodString, "ItemId", "out">;
|
|
67
|
+
column: z.core.$ZodBranded<z.ZodString, "ColumnId", "out">;
|
|
68
|
+
}, z.core.$strict>;
|
|
69
|
+
export declare const docCreateOnColumnCommand: CommandModule<z.infer<typeof inputSchema>, DocCreateOnColumnOutput>;
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=create-on-column.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-on-column.d.ts","sourceRoot":"","sources":["../../../src/commands/doc/create-on-column.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAKnE,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAEhC,QAAA,MAAM,WAAW;;;kBAKN,CAAC;AAEZ,eAAO,MAAM,wBAAwB,EAAE,aAAa,CAClD,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,EAC3B,uBAAuB,CAgFxB,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `monday doc create-on-column --item <iid> --column <cid>
|
|
3
|
+
* [--dry-run]` — create a new workdoc embedded into a doc-column
|
|
4
|
+
* on an existing item (`cli-design.md` §4.3 DOC section + §13
|
|
5
|
+
* v0.5 entry; `v0.5-plan.md` §3 M35 + §8 D7-D9).
|
|
6
|
+
*
|
|
7
|
+
* **Wire shape.** Single `create_doc(location: {board: ...})`
|
|
8
|
+
* round-trip via {@link createDocOnColumn} against `mutation
|
|
9
|
+
* CreateDocOnColumn` with `operationName: 'CreateDocOnColumn'`
|
|
10
|
+
* (R-NEW-37 W2 audit-point). Returns the created `Document`.
|
|
11
|
+
* The wire's `CreateDocInput` is mutually-exclusive between
|
|
12
|
+
* `board` (item-scoped) and `workspace` (workspace-scoped)
|
|
13
|
+
* variants per D7; this verb supplies only the `board` slot.
|
|
14
|
+
* The sibling verb `monday doc create-in-workspace` covers the
|
|
15
|
+
* workspace variant.
|
|
16
|
+
*
|
|
17
|
+
* **Argv shape.**
|
|
18
|
+
*
|
|
19
|
+
* - `--item <iid>` — required (Monday's
|
|
20
|
+
* `CreateDocBoardInput.item_id` is `ID!`). Numeric item ID;
|
|
21
|
+
* brand-validated via {@link ItemIdSchema}.
|
|
22
|
+
* - `--column <cid>` — required (Monday's
|
|
23
|
+
* `CreateDocBoardInput.column_id` is `ID!`). Column ID slug;
|
|
24
|
+
* brand-validated via {@link ColumnIdSchema}. The column must
|
|
25
|
+
* be a doc-typed column on the item's board — CLI doesn't
|
|
26
|
+
* pre-check column-type compatibility (mirrors M8's
|
|
27
|
+
* `change_column_value` cadence); incompatible columns
|
|
28
|
+
* surface `validation_failed` at the wire.
|
|
29
|
+
*
|
|
30
|
+
* **Output envelope.** Direct unwrap of the created Document —
|
|
31
|
+
* `data: <Document>`. Same shape as
|
|
32
|
+
* `monday doc create-in-workspace` per the create-variant
|
|
33
|
+
* symmetry.
|
|
34
|
+
*
|
|
35
|
+
* **Dry-run shape** per cli-design §6.4 mutation-dry-run variant.
|
|
36
|
+
* Minimal envelope listing the planned `create_doc` operation +
|
|
37
|
+
* the resolved input fields (`item_id`, `column_id`). No
|
|
38
|
+
* preflight read fires; the dry-run is purely argv-derived.
|
|
39
|
+
* `meta.source: 'none'`.
|
|
40
|
+
*
|
|
41
|
+
* **Idempotent: false.** Re-running creates a SECOND doc on the
|
|
42
|
+
* same column slot (Monday's wire allows multiple docs to attach
|
|
43
|
+
* to one item-column pair). Agents that need idempotency must
|
|
44
|
+
* pair with a column-value read first.
|
|
45
|
+
*
|
|
46
|
+
* **Permission-sensitive.** Tokens lacking write scope on the
|
|
47
|
+
* target item's board (or lacking the column-write permission
|
|
48
|
+
* for the doc-typed column) surface `forbidden` (mapped from
|
|
49
|
+
* Monday's PERMISSION_DENIED extension). Distinct from the
|
|
50
|
+
* separate `validation_failed` rejection for incompatible
|
|
51
|
+
* column types — permission failure precedes column-type
|
|
52
|
+
* validation at Monday's wire.
|
|
53
|
+
*
|
|
54
|
+
* **Runtime body landed at v0.5-M35 IMPL.** `parseArgv` runs
|
|
55
|
+
* BEFORE `resolveClient` so invalid argv surfaces `usage_error`
|
|
56
|
+
* ahead of any missing-token `config_error`; `resolveClient`
|
|
57
|
+
* parses global flags internally before `loadConfig`. Dry-run
|
|
58
|
+
* path emits minimal planned changes (no wire call fires); live
|
|
59
|
+
* path dispatches {@link createDocOnColumn} + projects via
|
|
60
|
+
* `emitMutation`.
|
|
61
|
+
*/
|
|
62
|
+
import { z } from 'zod';
|
|
63
|
+
import { ensureSubcommand } from '../types.js';
|
|
64
|
+
import { parseArgv } from '../parse-argv.js';
|
|
65
|
+
import { emitDryRun, emitMutation } from '../emit.js';
|
|
66
|
+
import { resolveClient } from '../../api/resolve-client.js';
|
|
67
|
+
import { ItemIdSchema, ColumnIdSchema } from '../../types/ids.js';
|
|
68
|
+
import { createDocOnColumn, docCreateOnColumnOutputSchema, } from '../../api/documents.js';
|
|
69
|
+
const inputSchema = z
|
|
70
|
+
.object({
|
|
71
|
+
item: ItemIdSchema,
|
|
72
|
+
column: ColumnIdSchema,
|
|
73
|
+
})
|
|
74
|
+
.strict();
|
|
75
|
+
export const docCreateOnColumnCommand = {
|
|
76
|
+
name: 'doc.create-on-column',
|
|
77
|
+
summary: 'Create a workdoc embedded on a doc-column of an existing item (--item + --column required)',
|
|
78
|
+
examples: [
|
|
79
|
+
'monday doc create-on-column --item 12345 --column doc_column_1',
|
|
80
|
+
'monday doc create-on-column --item 12345 --column doc_column_1 --dry-run --json',
|
|
81
|
+
],
|
|
82
|
+
// Monday allows multiple docs on the same item-column slot
|
|
83
|
+
// (the column is a one-to-many holder); creates are
|
|
84
|
+
// non-idempotent against the column slot.
|
|
85
|
+
idempotent: false,
|
|
86
|
+
inputSchema,
|
|
87
|
+
outputSchema: docCreateOnColumnOutputSchema,
|
|
88
|
+
attach: (program, ctx) => {
|
|
89
|
+
const noun = ensureSubcommand(program, 'doc', 'Workdoc commands');
|
|
90
|
+
noun
|
|
91
|
+
.command('create-on-column')
|
|
92
|
+
.description(docCreateOnColumnCommand.summary)
|
|
93
|
+
.requiredOption('--item <iid>', 'numeric item ID (maps to wire `item_id: ID!`)')
|
|
94
|
+
.requiredOption('--column <cid>', 'column ID slug (maps to wire `column_id: ID!`); column must be a doc-typed column on the item\'s board')
|
|
95
|
+
.addHelpText('after', [
|
|
96
|
+
'',
|
|
97
|
+
'Examples:',
|
|
98
|
+
...docCreateOnColumnCommand.examples.map((e) => ` ${e}`),
|
|
99
|
+
'',
|
|
100
|
+
'Notes:',
|
|
101
|
+
' - The column must be a doc-typed column on the item\'s board; incompatible columns surface `validation_failed` at the wire (CLI does not pre-check column type).',
|
|
102
|
+
' - `--dry-run` emits the planned `create_doc` operation + resolved input fields (no wire call fires; `meta.source: "none"`).',
|
|
103
|
+
' - For workspace-scoped docs use `monday doc create-in-workspace --workspace <wid> --name <n>`.',
|
|
104
|
+
'',
|
|
105
|
+
].join('\n'))
|
|
106
|
+
.action(async (opts) => {
|
|
107
|
+
const parsed = parseArgv(docCreateOnColumnCommand.inputSchema, opts);
|
|
108
|
+
const { client, globalFlags, apiVersion } = resolveClient(ctx, program.opts());
|
|
109
|
+
if (globalFlags.dryRun) {
|
|
110
|
+
emitDryRun({
|
|
111
|
+
ctx,
|
|
112
|
+
programOpts: program.opts(),
|
|
113
|
+
plannedChanges: [
|
|
114
|
+
{
|
|
115
|
+
operation: 'create_doc',
|
|
116
|
+
item_id: parsed.item,
|
|
117
|
+
column_id: parsed.column,
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
source: 'none',
|
|
121
|
+
cacheAgeSeconds: null,
|
|
122
|
+
warnings: [],
|
|
123
|
+
apiVersion,
|
|
124
|
+
});
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const result = await createDocOnColumn({
|
|
128
|
+
client,
|
|
129
|
+
itemId: parsed.item,
|
|
130
|
+
columnId: parsed.column,
|
|
131
|
+
});
|
|
132
|
+
emitMutation({
|
|
133
|
+
ctx,
|
|
134
|
+
data: result.document,
|
|
135
|
+
schema: docCreateOnColumnCommand.outputSchema,
|
|
136
|
+
programOpts: program.opts(),
|
|
137
|
+
warnings: [],
|
|
138
|
+
source: result.source,
|
|
139
|
+
cacheAgeSeconds: result.cacheAgeSeconds,
|
|
140
|
+
complexity: result.complexity,
|
|
141
|
+
apiVersion,
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
//# sourceMappingURL=create-on-column.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-on-column.js","sourceRoot":"","sources":["../../../src/commands/doc/create-on-column.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;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,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAClE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AAa,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,YAAY;4BACvB,OAAO,EAAE,MAAM,CAAC,IAAI;4BACpB,SAAS,EAAE,MAAM,CAAC,MAAM;yBACzB;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,iBAAiB,CAAC;gBACrC,MAAM;gBACN,MAAM,EAAE,MAAM,CAAC,IAAI;gBACnB,QAAQ,EAAE,MAAM,CAAC,MAAM;aACxB,CAAC,CAAC;YACH,YAAY,CAAC;gBACX,GAAG;gBACH,IAAI,EAAE,MAAM,CAAC,QAAQ;gBACrB,MAAM,EAAE,wBAAwB,CAAC,YAAY;gBAC7C,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,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `monday doc delete <doc-id> --yes [--dry-run]` — delete an
|
|
3
|
+
* existing workdoc (`cli-design.md` §4.3 DOC section + §13 v0.5
|
|
4
|
+
* entry; `v0.5-plan.md` §3 M35 + §8 D7-D9).
|
|
5
|
+
*
|
|
6
|
+
* **Confirmation gate** (cli-design §3.1 #7 + §10.2 + M10 round-1
|
|
7
|
+
* P2 invariant). `--yes` is mandatory for the live path; without
|
|
8
|
+
* `--yes` (and without `--dry-run`) the command fails fast with
|
|
9
|
+
* `confirmation_required` (exit 1) carrying `details.doc_id`. The
|
|
10
|
+
* gate fires BEFORE `resolveClient()` so a missing token doesn't
|
|
11
|
+
* mask `confirmation_required` as `config_error` (same shape — and
|
|
12
|
+
* same gate-before-resolve ordering — as M14 `workspace delete` /
|
|
13
|
+
* M10 `item delete` / `update delete` / `team delete`).
|
|
14
|
+
*
|
|
15
|
+
* **Wire shape.** Single round-trip via `delete_doc(docId)` against
|
|
16
|
+
* `mutation DeleteDoc` with `operationName: 'DeleteDoc'`
|
|
17
|
+
* (R-NEW-37 W2 audit-point). Returns Monday's opaque `JSON` scalar
|
|
18
|
+
* — the fetcher projects to the flat `{ doc_id: <echoed>,
|
|
19
|
+
* success: true }` envelope per D9. A null `delete_doc` payload
|
|
20
|
+
* surfaces `not_found` — same cadence as M14 `workspace delete`
|
|
21
|
+
* + M34 `team delete` (id bogus or doc already deleted by a
|
|
22
|
+
* concurrent caller).
|
|
23
|
+
*
|
|
24
|
+
* **camelCase wire-arg note.** `delete_doc` takes camelCase
|
|
25
|
+
* `docId` on the wire (Finding 7) — see the canonical
|
|
26
|
+
* asymmetry note at `src/api/documents.ts` module header (4th
|
|
27
|
+
* supporting site for R-NEW-41).
|
|
28
|
+
*
|
|
29
|
+
* **Argv shape.**
|
|
30
|
+
*
|
|
31
|
+
* - `<doc-id>` — required positional (Monday's
|
|
32
|
+
* `delete_doc.docId` is `ID!`). Brand-validated via
|
|
33
|
+
* {@link DocIdSchema}.
|
|
34
|
+
*
|
|
35
|
+
* **Output envelope.** Projected from Monday's opaque JSON return
|
|
36
|
+
* per D9 — `data: { doc_id: <echoed>, success: true }`. Envelope
|
|
37
|
+
* shape is intentionally narrower than M34 `team-delete`'s "full
|
|
38
|
+
* deleted Team" projection: Monday's `delete_doc` doesn't return
|
|
39
|
+
* the deleted Document (the wire return is opaque JSON), and the
|
|
40
|
+
* agent contract doesn't gain from speculatively rehydrating the
|
|
41
|
+
* doc on the way out.
|
|
42
|
+
*
|
|
43
|
+
* **Dry-run shape** per cli-design §6.4 mutation-dry-run variant:
|
|
44
|
+
* minimal `{operation: "delete_doc", doc_id}`. No preflight read
|
|
45
|
+
* fires; the dry-run is purely argv-derived. `meta.source: 'none'`.
|
|
46
|
+
* Mirrors `workspace delete` / `team delete` — destructive-no-read
|
|
47
|
+
* pattern is uniform across destructive verbs.
|
|
48
|
+
*
|
|
49
|
+
* **Idempotent: false.** Re-running surfaces `not_found` past the
|
|
50
|
+
* first call. Same rationale as `workspace delete` / `team delete`
|
|
51
|
+
* — agents can't safely retry without verifying the id still
|
|
52
|
+
* names the same record.
|
|
53
|
+
*
|
|
54
|
+
* **Runtime body landed at v0.5-M35 IMPL.** Destructive gate fires
|
|
55
|
+
* BEFORE `resolveClient` (M10 round-1 P2 invariant); dry-run path
|
|
56
|
+
* emits minimal `{operation: "delete_doc", doc_id}` (no wire call);
|
|
57
|
+
* live path dispatches {@link deleteDoc} + projects via
|
|
58
|
+
* `emitMutation`.
|
|
59
|
+
*/
|
|
60
|
+
import { z } from 'zod';
|
|
61
|
+
import { type CommandModule } from '../types.js';
|
|
62
|
+
import { type DocDeleteOutput } from '../../api/documents.js';
|
|
63
|
+
declare const inputSchema: z.ZodObject<{
|
|
64
|
+
docId: z.core.$ZodBranded<z.ZodString, "DocId", "out">;
|
|
65
|
+
}, z.core.$strict>;
|
|
66
|
+
export declare const docDeleteCommand: CommandModule<z.infer<typeof inputSchema>, DocDeleteOutput>;
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=delete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/doc/delete.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAOnE,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,wBAAwB,CAAC;AAEhC,QAAA,MAAM,WAAW;;kBAA4C,CAAC;AAE9D,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAC1C,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,EAC3B,eAAe,CAmFhB,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `monday doc delete <doc-id> --yes [--dry-run]` — delete an
|
|
3
|
+
* existing workdoc (`cli-design.md` §4.3 DOC section + §13 v0.5
|
|
4
|
+
* entry; `v0.5-plan.md` §3 M35 + §8 D7-D9).
|
|
5
|
+
*
|
|
6
|
+
* **Confirmation gate** (cli-design §3.1 #7 + §10.2 + M10 round-1
|
|
7
|
+
* P2 invariant). `--yes` is mandatory for the live path; without
|
|
8
|
+
* `--yes` (and without `--dry-run`) the command fails fast with
|
|
9
|
+
* `confirmation_required` (exit 1) carrying `details.doc_id`. The
|
|
10
|
+
* gate fires BEFORE `resolveClient()` so a missing token doesn't
|
|
11
|
+
* mask `confirmation_required` as `config_error` (same shape — and
|
|
12
|
+
* same gate-before-resolve ordering — as M14 `workspace delete` /
|
|
13
|
+
* M10 `item delete` / `update delete` / `team delete`).
|
|
14
|
+
*
|
|
15
|
+
* **Wire shape.** Single round-trip via `delete_doc(docId)` against
|
|
16
|
+
* `mutation DeleteDoc` with `operationName: 'DeleteDoc'`
|
|
17
|
+
* (R-NEW-37 W2 audit-point). Returns Monday's opaque `JSON` scalar
|
|
18
|
+
* — the fetcher projects to the flat `{ doc_id: <echoed>,
|
|
19
|
+
* success: true }` envelope per D9. A null `delete_doc` payload
|
|
20
|
+
* surfaces `not_found` — same cadence as M14 `workspace delete`
|
|
21
|
+
* + M34 `team delete` (id bogus or doc already deleted by a
|
|
22
|
+
* concurrent caller).
|
|
23
|
+
*
|
|
24
|
+
* **camelCase wire-arg note.** `delete_doc` takes camelCase
|
|
25
|
+
* `docId` on the wire (Finding 7) — see the canonical
|
|
26
|
+
* asymmetry note at `src/api/documents.ts` module header (4th
|
|
27
|
+
* supporting site for R-NEW-41).
|
|
28
|
+
*
|
|
29
|
+
* **Argv shape.**
|
|
30
|
+
*
|
|
31
|
+
* - `<doc-id>` — required positional (Monday's
|
|
32
|
+
* `delete_doc.docId` is `ID!`). Brand-validated via
|
|
33
|
+
* {@link DocIdSchema}.
|
|
34
|
+
*
|
|
35
|
+
* **Output envelope.** Projected from Monday's opaque JSON return
|
|
36
|
+
* per D9 — `data: { doc_id: <echoed>, success: true }`. Envelope
|
|
37
|
+
* shape is intentionally narrower than M34 `team-delete`'s "full
|
|
38
|
+
* deleted Team" projection: Monday's `delete_doc` doesn't return
|
|
39
|
+
* the deleted Document (the wire return is opaque JSON), and the
|
|
40
|
+
* agent contract doesn't gain from speculatively rehydrating the
|
|
41
|
+
* doc on the way out.
|
|
42
|
+
*
|
|
43
|
+
* **Dry-run shape** per cli-design §6.4 mutation-dry-run variant:
|
|
44
|
+
* minimal `{operation: "delete_doc", doc_id}`. No preflight read
|
|
45
|
+
* fires; the dry-run is purely argv-derived. `meta.source: 'none'`.
|
|
46
|
+
* Mirrors `workspace delete` / `team delete` — destructive-no-read
|
|
47
|
+
* pattern is uniform across destructive verbs.
|
|
48
|
+
*
|
|
49
|
+
* **Idempotent: false.** Re-running surfaces `not_found` past the
|
|
50
|
+
* first call. Same rationale as `workspace delete` / `team delete`
|
|
51
|
+
* — agents can't safely retry without verifying the id still
|
|
52
|
+
* names the same record.
|
|
53
|
+
*
|
|
54
|
+
* **Runtime body landed at v0.5-M35 IMPL.** Destructive gate fires
|
|
55
|
+
* BEFORE `resolveClient` (M10 round-1 P2 invariant); dry-run path
|
|
56
|
+
* emits minimal `{operation: "delete_doc", doc_id}` (no wire call);
|
|
57
|
+
* live path dispatches {@link deleteDoc} + projects via
|
|
58
|
+
* `emitMutation`.
|
|
59
|
+
*/
|
|
60
|
+
import { z } from 'zod';
|
|
61
|
+
import { ensureSubcommand } from '../types.js';
|
|
62
|
+
import { parseArgv } from '../parse-argv.js';
|
|
63
|
+
import { parseGlobalFlags } from '../../types/global-flags.js';
|
|
64
|
+
import { enforceDestructiveGate } from '../../api/destructive-gate.js';
|
|
65
|
+
import { emitDryRun, emitMutation } from '../emit.js';
|
|
66
|
+
import { resolveClient } from '../../api/resolve-client.js';
|
|
67
|
+
import { DocIdSchema } from '../../types/ids.js';
|
|
68
|
+
import { deleteDoc, docDeleteOutputSchema, } from '../../api/documents.js';
|
|
69
|
+
const inputSchema = z.object({ docId: DocIdSchema }).strict();
|
|
70
|
+
export const docDeleteCommand = {
|
|
71
|
+
name: 'doc.delete',
|
|
72
|
+
summary: 'Delete a workdoc — --yes required',
|
|
73
|
+
examples: [
|
|
74
|
+
'monday doc delete 12345678 --yes',
|
|
75
|
+
'monday doc delete 12345678 --dry-run',
|
|
76
|
+
'monday doc delete 12345678 --yes --json',
|
|
77
|
+
],
|
|
78
|
+
// Re-deleting an already-deleted doc surfaces `not_found`;
|
|
79
|
+
// re-running with the same `<doc-id>` after an interim
|
|
80
|
+
// `doc create-in-workspace` would target a different record
|
|
81
|
+
// (Monday mints new DocIds on create). Mark non-idempotent.
|
|
82
|
+
idempotent: false,
|
|
83
|
+
inputSchema,
|
|
84
|
+
outputSchema: docDeleteOutputSchema,
|
|
85
|
+
attach: (program, ctx) => {
|
|
86
|
+
const noun = ensureSubcommand(program, 'doc', 'Workdoc commands');
|
|
87
|
+
noun
|
|
88
|
+
.command('delete <docId>')
|
|
89
|
+
.description(docDeleteCommand.summary)
|
|
90
|
+
.addHelpText('after', ['', 'Examples:', ...docDeleteCommand.examples.map((e) => ` ${e}`), ''].join('\n'))
|
|
91
|
+
.action(async (docId) => {
|
|
92
|
+
const parsed = parseArgv(docDeleteCommand.inputSchema, { docId });
|
|
93
|
+
// Gate BEFORE `resolveClient()` — M10 round-1 P2 invariant.
|
|
94
|
+
// A missing `--yes` must surface as `confirmation_required`
|
|
95
|
+
// per cli-design §3.1 #7's unconditional contract, never
|
|
96
|
+
// masked by `config_error` when no token is configured.
|
|
97
|
+
const preGateGlobalFlags = parseGlobalFlags(program.opts(), ctx.env);
|
|
98
|
+
enforceDestructiveGate({
|
|
99
|
+
globalFlags: preGateGlobalFlags,
|
|
100
|
+
verb: 'doc delete',
|
|
101
|
+
target: parsed.docId,
|
|
102
|
+
detailKey: 'doc_id',
|
|
103
|
+
action: 'delete the workdoc',
|
|
104
|
+
hint: 'delete is destructive — Monday\'s wire surface offers no ' +
|
|
105
|
+
'restore mutation for workdocs; agents needing reversal must ' +
|
|
106
|
+
'recreate via `monday doc create-in-workspace` / `create-on-' +
|
|
107
|
+
'column` (lossy: new id, content must be re-imported).',
|
|
108
|
+
});
|
|
109
|
+
if (preGateGlobalFlags.dryRun) {
|
|
110
|
+
// Minimal dry-run shape — no preflight read fires. Per
|
|
111
|
+
// cli-design §6.4 mutation-dry-run variant: `operation:
|
|
112
|
+
// "delete_doc"`, `doc_id`, nothing else. `meta.source:
|
|
113
|
+
// 'none'` because no API call fires; live surfaces
|
|
114
|
+
// `not_found` for missing ids on its own. Mirrors
|
|
115
|
+
// workspace-delete + team-delete cadence.
|
|
116
|
+
const { apiVersion } = resolveClient(ctx, program.opts());
|
|
117
|
+
emitDryRun({
|
|
118
|
+
ctx,
|
|
119
|
+
programOpts: program.opts(),
|
|
120
|
+
plannedChanges: [
|
|
121
|
+
{ operation: 'delete_doc', doc_id: parsed.docId },
|
|
122
|
+
],
|
|
123
|
+
source: 'none',
|
|
124
|
+
cacheAgeSeconds: null,
|
|
125
|
+
warnings: [],
|
|
126
|
+
apiVersion,
|
|
127
|
+
});
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const { client, apiVersion } = resolveClient(ctx, program.opts());
|
|
131
|
+
const result = await deleteDoc({ client, docId: parsed.docId });
|
|
132
|
+
emitMutation({
|
|
133
|
+
ctx,
|
|
134
|
+
data: result.result,
|
|
135
|
+
schema: docDeleteCommand.outputSchema,
|
|
136
|
+
programOpts: program.opts(),
|
|
137
|
+
warnings: [],
|
|
138
|
+
source: result.source,
|
|
139
|
+
cacheAgeSeconds: result.cacheAgeSeconds,
|
|
140
|
+
complexity: result.complexity,
|
|
141
|
+
apiVersion,
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/commands/doc/delete.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAsB,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EACL,SAAS,EACT,qBAAqB,GAEtB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAE9D,MAAM,CAAC,MAAM,gBAAgB,GAGzB;IACF,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,mCAAmC;IAC5C,QAAQ,EAAE;QACR,kCAAk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