monday-cli 0.3.0 → 0.4.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 +351 -0
- package/README.md +130 -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 +11 -7
- package/dist/api/column-types.d.ts.map +1 -1
- package/dist/api/column-types.js +5 -3
- package/dist/api/column-types.js.map +1 -1
- package/dist/api/column-values.d.ts +7 -1
- package/dist/api/column-values.d.ts.map +1 -1
- package/dist/api/column-values.js +15 -6
- package/dist/api/column-values.js.map +1 -1
- package/dist/api/documents.d.ts +519 -0
- package/dist/api/documents.d.ts.map +1 -0
- package/dist/api/documents.js +586 -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 +12 -4
- package/dist/api/raw-write.d.ts.map +1 -1
- package/dist/api/raw-write.js +21 -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/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/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/list.d.ts +83 -0
- package/dist/commands/doc/list.d.ts.map +1 -0
- package/dist/commands/doc/list.js +248 -0
- package/dist/commands/doc/list.js.map +1 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +46 -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/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/types/ids.d.ts +2 -0
- package/dist/types/ids.d.ts.map +1 -1
- package/dist/types/ids.js +9 -2
- 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/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/package.json +1 -1
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `monday item upload <iid> --column <col> <file>` — attach a file to
|
|
3
|
+
* a `file`-typed column on an item via Monday's `add_file_to_column`
|
|
4
|
+
* mutation (cli-design.md §4.3 + §6.4 asset-upload sub-section +
|
|
5
|
+
* §13 v0.4 entry; v0.4-plan.md §3 M31).
|
|
6
|
+
*
|
|
7
|
+
* **Wire shape.** Single multipart/form-data round-trip via
|
|
8
|
+
* {@link addFileToColumn} against `mutation AddFileToColumn` with
|
|
9
|
+
* `operationName: 'AddFileToColumn'` (R-NEW-37 W2 audit-point).
|
|
10
|
+
* Uses the new `MultipartTransport` seam (`src/api/multipart-
|
|
11
|
+
* transport.ts`) — first v0.4 verb that does NOT cross the wire via
|
|
12
|
+
* the JSON-only `client.request` transport. See R-NEW-41 lift at
|
|
13
|
+
* `docs/architecture.md` "Wire-vs-CLI semantics documentation
|
|
14
|
+
* conventions" for the asymmetry context.
|
|
15
|
+
*
|
|
16
|
+
* **Argv shape.** Two positional args + one required flag:
|
|
17
|
+
*
|
|
18
|
+
* - `<iid>` — numeric item ID; brand-validated via
|
|
19
|
+
* {@link ItemIdSchema}.
|
|
20
|
+
* - `<file>` — local file path; resolved relative to cwd. Must be
|
|
21
|
+
* a readable regular file (not a directory). M31 does NOT
|
|
22
|
+
* support stdin (`<file>='-'`) — stdin support is a
|
|
23
|
+
* v0.4.x / v0.5 contract-extension once a clean `--filename
|
|
24
|
+
* <name>` companion flag is pinned (no upload Asset.name when
|
|
25
|
+
* reading from stdin).
|
|
26
|
+
* - `--column <col>` — required; column ID on the target board
|
|
27
|
+
* (resolved at runtime against board metadata to confirm
|
|
28
|
+
* `type === 'file'`). Brand-validated via {@link ColumnIdSchema}
|
|
29
|
+
* at the parse boundary; the column-type check fires at IMPL.
|
|
30
|
+
*
|
|
31
|
+
* **Column-type validation.** At IMPL, the action body resolves the
|
|
32
|
+
* column via the standard `resolveColumnWithRefresh` machinery and
|
|
33
|
+
* confirms `type === 'file'`. Non-`file` columns surface
|
|
34
|
+
* `unsupported_column_type` (matching the existing files_shaped
|
|
35
|
+
* rejection in `src/api/column-values.ts`'s UNSUPPORTED_TABLE) with
|
|
36
|
+
* a hint pointing at the right write path: `change_column_value` for
|
|
37
|
+
* `change_column_value`-shaped types (use `monday item set` /
|
|
38
|
+
* `monday item update --set-raw`); the rejection for `doc`-shaped
|
|
39
|
+
* columns is deferred to a future v0.4+ doc-upload milestone.
|
|
40
|
+
*
|
|
41
|
+
* **Local file failures + size handling — `details.reason`
|
|
42
|
+
* discrimination.** Three failure modes route through
|
|
43
|
+
* `usage_error` with a discriminated `details.reason` slot:
|
|
44
|
+
*
|
|
45
|
+
* - `'file_not_readable'` — local path doesn't exist
|
|
46
|
+
* (`ENOENT`), isn't readable (`EACCES`), or resolves to a
|
|
47
|
+
* directory rather than a regular file. Fires at IMPL via
|
|
48
|
+
* `fs.stat()` before any wire call.
|
|
49
|
+
* - `'file_empty'` — file exists but is zero bytes. Monday
|
|
50
|
+
* rejects empty uploads server-side; the CLI surfaces the
|
|
51
|
+
* rejection with a clearer hint via `fs.stat()` pre-check
|
|
52
|
+
* at IMPL.
|
|
53
|
+
* - `'file_too_large'` — Monday's server-side size-cap
|
|
54
|
+
* rejection rewrap (`FILE_SIZE_LIMIT_EXCEEDED` or HTTP
|
|
55
|
+
* 413). The CLI does NOT pre-check file size against a
|
|
56
|
+
* hardcoded ceiling — Monday's per-file cap is plan-tier-
|
|
57
|
+
* dependent (typically 500 MB at standard tiers, larger
|
|
58
|
+
* at enterprise) and NOT exposed via the GraphQL schema
|
|
59
|
+
* (empirical probe `scripts/probe/m31-asset-upload.ts`
|
|
60
|
+
* 2026-05-13 — `Plan` + `Account` carry no file-quota
|
|
61
|
+
* fields). Rewrap carries `details.file_size_bytes` from
|
|
62
|
+
* the **local `fs.stat()` measurement at upload time**
|
|
63
|
+
* (NOT a Monday error-payload field — Monday's wire
|
|
64
|
+
* rejection may not surface a size; the CLI already has
|
|
65
|
+
* the local size from the read leg and threads it into
|
|
66
|
+
* the details slot for a stable agent-keyed envelope)
|
|
67
|
+
* + `details.hint` pointing at the plan-tier dependency.
|
|
68
|
+
*
|
|
69
|
+
* **`--dry-run` shape** per cli-design §3.1 #6 + §6.4 asset-upload
|
|
70
|
+
* variant. Strictly local-derived — no wire mutation fires. Planned
|
|
71
|
+
* change carries `{operation: 'add_file_to_column', item_id,
|
|
72
|
+
* column_id, file_path, filename, file_size_bytes}` (size from
|
|
73
|
+
* `fs.stat()`; no file bytes are actually transmitted on a dry-
|
|
74
|
+
* run). `meta.source: 'none'`.
|
|
75
|
+
*
|
|
76
|
+
* **Idempotency: NO** — re-running uploads the file a second time
|
|
77
|
+
* minting a new `Asset` ID. Agents needing register-once semantics
|
|
78
|
+
* read `Item.assets` first and skip the upload if a matching name
|
|
79
|
+
* exists (read-side surface deferred to v0.4.x — see v0.4-plan §3
|
|
80
|
+
* M31 Decision D6 closure).
|
|
81
|
+
*
|
|
82
|
+
* **Cache invalidation.** Successful upload changes the file
|
|
83
|
+
* column's `FileValue` ColumnValue → cached board metadata for that
|
|
84
|
+
* board stale; the action body fires `invalidateBoard(boardId, env)`
|
|
85
|
+
* after success per the §8 single-leg invalidation pattern (BEFORE
|
|
86
|
+
* `emitMutation` so a cache-unlink failure surfaces through the
|
|
87
|
+
* runner's catch-all rather than double-emitting after a success
|
|
88
|
+
* envelope already hit stdout).
|
|
89
|
+
*
|
|
90
|
+
* **Side effects.** None at IMPL — `add_file_to_column` does not
|
|
91
|
+
* post an update or trigger automations beyond Monday's own
|
|
92
|
+
* file-change activity log (which `item history` surfaces).
|
|
93
|
+
*
|
|
94
|
+
* **Status: runtime body shipped at v0.4-M31 IMPL.** Argv parsing
|
|
95
|
+
* + file-read + dry-run + multipart-dispatch + envelope emit + cache
|
|
96
|
+
* invalidation all land below.
|
|
97
|
+
*/
|
|
98
|
+
import { z } from 'zod';
|
|
99
|
+
import { stat as fsStat, access as fsAccess, readFile } from 'node:fs/promises';
|
|
100
|
+
import { constants as fsConstants } from 'node:fs';
|
|
101
|
+
import { resolve as resolvePath, basename } from 'node:path';
|
|
102
|
+
import { ensureSubcommand } from '../types.js';
|
|
103
|
+
import { parseArgv } from '../parse-argv.js';
|
|
104
|
+
import { ItemIdSchema, ColumnIdSchema } from '../../types/ids.js';
|
|
105
|
+
import { itemUploadOutputSchema, addFileToColumn, } from '../../api/assets.js';
|
|
106
|
+
import { resolveClient } from '../../api/resolve-client.js';
|
|
107
|
+
import { resolveColumnWithRefresh } from '../../api/columns.js';
|
|
108
|
+
import { lookupItemBoard } from '../../api/item-board-lookup.js';
|
|
109
|
+
import { invalidateBoard } from '../../api/cache.js';
|
|
110
|
+
import { foldResolverWarningsIntoError } from '../../api/resolver-error-fold.js';
|
|
111
|
+
import { ApiError, UsageError, asError, errorCode } from '../../utils/errors.js';
|
|
112
|
+
import { sniffContentType } from '../../utils/mime.js';
|
|
113
|
+
import { emitMutation, emitDryRun } from '../emit.js';
|
|
114
|
+
const inputSchema = z
|
|
115
|
+
.object({
|
|
116
|
+
itemId: ItemIdSchema,
|
|
117
|
+
column: ColumnIdSchema,
|
|
118
|
+
file: z
|
|
119
|
+
.string()
|
|
120
|
+
.min(1, {
|
|
121
|
+
message: '<file> must be a non-empty local file path; stdin (`-`) is not supported in v0.4-M31 (a future contract extension may add stdin support once a `--filename <name>` companion flag is pinned).',
|
|
122
|
+
})
|
|
123
|
+
.refine((p) => p !== '-', {
|
|
124
|
+
message: '<file> cannot be `-` — stdin upload is not supported in v0.4-M31. Pass a local file path resolved relative to cwd. A future contract extension may add stdin support once a `--filename <name>` companion flag is pinned.',
|
|
125
|
+
}),
|
|
126
|
+
})
|
|
127
|
+
.strict();
|
|
128
|
+
export const itemUploadCommand = {
|
|
129
|
+
name: 'item.upload',
|
|
130
|
+
summary: 'Attach a file to a file-typed column on an item via add_file_to_column',
|
|
131
|
+
examples: [
|
|
132
|
+
'monday item upload 12345 --column files ./screenshot.png',
|
|
133
|
+
'monday item upload 12345 --column attachments_3 ./report.pdf --dry-run',
|
|
134
|
+
],
|
|
135
|
+
idempotent: false,
|
|
136
|
+
inputSchema,
|
|
137
|
+
outputSchema: itemUploadOutputSchema,
|
|
138
|
+
attach: (program, ctx) => {
|
|
139
|
+
const noun = ensureSubcommand(program, 'item', 'Item commands (cli-design §4.3 ITEM)');
|
|
140
|
+
noun
|
|
141
|
+
.command('upload <itemId> <file>')
|
|
142
|
+
.description(itemUploadCommand.summary)
|
|
143
|
+
.requiredOption('--column <c>', 'Column ID on the target board. Must resolve to a `file`-typed column at runtime; non-`file` columns surface `unsupported_column_type` per cli-design §5.3.')
|
|
144
|
+
.addHelpText('after', [
|
|
145
|
+
'',
|
|
146
|
+
'Examples:',
|
|
147
|
+
...itemUploadCommand.examples.map((e) => ` ${e}`),
|
|
148
|
+
'',
|
|
149
|
+
'Notes:',
|
|
150
|
+
' - Uploads cross the wire as multipart/form-data (different transport from JSON-only verbs).',
|
|
151
|
+
' - File path is resolved relative to the cwd; stdin (`-`) is not supported in this release.',
|
|
152
|
+
' - Re-running with the same args creates a second Asset; `add_file_to_column` is not idempotent.',
|
|
153
|
+
'',
|
|
154
|
+
].join('\n'))
|
|
155
|
+
.action(async (itemIdArg, fileArg, opts) => {
|
|
156
|
+
const parsed = parseArgv(itemUploadCommand.inputSchema, {
|
|
157
|
+
itemId: itemIdArg,
|
|
158
|
+
file: fileArg,
|
|
159
|
+
column: opts.column,
|
|
160
|
+
});
|
|
161
|
+
// Resolve the absolute file path relative to cwd. Pre-check
|
|
162
|
+
// existence + type + read-permission + emptiness via
|
|
163
|
+
// `fs.stat()` + `fs.access(..., R_OK)` BEFORE resolveClient
|
|
164
|
+
// so a missing/unreadable-file error surfaces as usage_error
|
|
165
|
+
// (exit 1) rather than getting tangled up with config_error
|
|
166
|
+
// (exit 3) on a token miss OR firing AFTER `lookupItemBoard`
|
|
167
|
+
// / `resolveColumnWithRefresh` Monday wire calls (round-1
|
|
168
|
+
// P2-2 fix — `fs.stat()` alone confirms type/size but not
|
|
169
|
+
// R_OK; an unreadable file would otherwise pass the
|
|
170
|
+
// pre-check and `fs.readFile()` would throw a raw fs error
|
|
171
|
+
// mid-upload after wire calls).
|
|
172
|
+
const filePath = resolvePath(process.cwd(), parsed.file);
|
|
173
|
+
const filename = basename(filePath);
|
|
174
|
+
let fileSizeBytes;
|
|
175
|
+
try {
|
|
176
|
+
const stats = await fsStat(filePath);
|
|
177
|
+
if (!stats.isFile()) {
|
|
178
|
+
throw new UsageError(`<file> ${JSON.stringify(parsed.file)} is not a regular file ` +
|
|
179
|
+
`(resolved to ${JSON.stringify(filePath)}).`, {
|
|
180
|
+
details: {
|
|
181
|
+
reason: 'file_not_readable',
|
|
182
|
+
file_path: filePath,
|
|
183
|
+
hint: 'pass a path to a regular readable file; directories ' +
|
|
184
|
+
'and special files (sockets, devices) are rejected.',
|
|
185
|
+
},
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
await fsAccess(filePath, fsConstants.R_OK);
|
|
189
|
+
fileSizeBytes = stats.size;
|
|
190
|
+
}
|
|
191
|
+
catch (err) {
|
|
192
|
+
if (err instanceof UsageError) {
|
|
193
|
+
throw err;
|
|
194
|
+
}
|
|
195
|
+
const code = errorCode(err);
|
|
196
|
+
throw new UsageError(`<file> ${JSON.stringify(parsed.file)} cannot be read ` +
|
|
197
|
+
`(resolved to ${JSON.stringify(filePath)}): ` +
|
|
198
|
+
`${asError(err).message}.`, {
|
|
199
|
+
cause: err,
|
|
200
|
+
details: {
|
|
201
|
+
reason: 'file_not_readable',
|
|
202
|
+
file_path: filePath,
|
|
203
|
+
...(code === undefined ? {} : { errno_code: code }),
|
|
204
|
+
hint: 'check that the path exists, is readable by the current ' +
|
|
205
|
+
'user, and isn\'t a directory.',
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
if (fileSizeBytes === 0) {
|
|
210
|
+
throw new UsageError(`<file> ${JSON.stringify(parsed.file)} is empty (0 bytes); ` +
|
|
211
|
+
`Monday rejects empty uploads server-side.`, {
|
|
212
|
+
details: {
|
|
213
|
+
reason: 'file_empty',
|
|
214
|
+
file_path: filePath,
|
|
215
|
+
filename,
|
|
216
|
+
file_size_bytes: 0,
|
|
217
|
+
hint: 'Monday returns FILE_SIZE_LIMIT_EXCEEDED on empty ' +
|
|
218
|
+
'uploads. Provide a non-empty file or remove the upload ' +
|
|
219
|
+
'call.',
|
|
220
|
+
},
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
const { client, globalFlags, apiVersion, multipart, toEmit } = resolveClient(ctx, program.opts());
|
|
224
|
+
if (globalFlags.dryRun) {
|
|
225
|
+
// D5 closure: dry-run is fs.stat()-backed (NOT a 0-byte
|
|
226
|
+
// stub). Planned-change carries `{operation, item_id,
|
|
227
|
+
// column_id, file_path, filename, file_size_bytes}` from
|
|
228
|
+
// the local stat; no wire mutation fires; no file bytes
|
|
229
|
+
// loaded into memory. `meta.source: 'none'`.
|
|
230
|
+
//
|
|
231
|
+
// `file_path` is the **argv-derived** path the agent
|
|
232
|
+
// passed (relative or absolute), preserving the
|
|
233
|
+
// invocation surface — matches cli-design §6.4 +
|
|
234
|
+
// output-shapes which sample `./screenshot.png` (round-2
|
|
235
|
+
// P3-2 fix). Agents that need an absolute path can
|
|
236
|
+
// resolve from cwd + `file_path` themselves; the
|
|
237
|
+
// resolved absolute path lives in `details.file_path`
|
|
238
|
+
// on `usage_error.details.reason: 'file_not_readable'` /
|
|
239
|
+
// `'file_empty'` rejections (where the absolute is
|
|
240
|
+
// useful for diagnosing path resolution mismatches).
|
|
241
|
+
emitDryRun({
|
|
242
|
+
ctx,
|
|
243
|
+
programOpts: program.opts(),
|
|
244
|
+
plannedChanges: [
|
|
245
|
+
{
|
|
246
|
+
operation: 'add_file_to_column',
|
|
247
|
+
item_id: parsed.itemId,
|
|
248
|
+
column_id: parsed.column,
|
|
249
|
+
file_path: parsed.file,
|
|
250
|
+
filename,
|
|
251
|
+
file_size_bytes: fileSizeBytes,
|
|
252
|
+
},
|
|
253
|
+
],
|
|
254
|
+
source: 'none',
|
|
255
|
+
cacheAgeSeconds: null,
|
|
256
|
+
apiVersion,
|
|
257
|
+
});
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
// Live path. Resolve the parent board so we can (a) pin the
|
|
261
|
+
// column-type check to the right board metadata and (b) fire
|
|
262
|
+
// cache invalidation on the right board after a successful
|
|
263
|
+
// upload (D6 single-leg per §8). `lookupItemBoard` throws
|
|
264
|
+
// `not_found` on a missing item or null-board, so a bad
|
|
265
|
+
// <iid> surfaces a typed envelope before file BYTES are
|
|
266
|
+
// loaded — the local `fs.stat()` + `fs.access()` pre-check
|
|
267
|
+
// above already ran (round-3 P3-2 prose precision; ordering
|
|
268
|
+
// stays "argv parse → local file pre-check → wire lookup →
|
|
269
|
+
// column resolution → file bytes → multipart dispatch →
|
|
270
|
+
// cache invalidation → emit").
|
|
271
|
+
const { boardId } = await lookupItemBoard({
|
|
272
|
+
client,
|
|
273
|
+
itemId: parsed.itemId,
|
|
274
|
+
});
|
|
275
|
+
const resolution = await resolveColumnWithRefresh({
|
|
276
|
+
client,
|
|
277
|
+
boardId,
|
|
278
|
+
token: parsed.column,
|
|
279
|
+
includeArchived: true,
|
|
280
|
+
env: ctx.env,
|
|
281
|
+
noCache: globalFlags.noCache,
|
|
282
|
+
});
|
|
283
|
+
const resolverWarnings = resolution.warnings;
|
|
284
|
+
const resolvedColumn = resolution.match.column;
|
|
285
|
+
if (resolvedColumn.archived === true) {
|
|
286
|
+
throw foldResolverWarningsIntoError(new ApiError('column_archived', `Column ${JSON.stringify(resolvedColumn.title)} ` +
|
|
287
|
+
`(id ${resolvedColumn.id}) on board ${boardId} is ` +
|
|
288
|
+
`archived; un-archive the column before uploading to it.`, {
|
|
289
|
+
details: {
|
|
290
|
+
column_id: resolvedColumn.id,
|
|
291
|
+
column_title: resolvedColumn.title,
|
|
292
|
+
column_type: resolvedColumn.type,
|
|
293
|
+
board_id: boardId,
|
|
294
|
+
},
|
|
295
|
+
}), resolverWarnings);
|
|
296
|
+
}
|
|
297
|
+
if (resolvedColumn.type !== 'file') {
|
|
298
|
+
throw foldResolverWarningsIntoError(new ApiError('unsupported_column_type', `Column ${JSON.stringify(resolvedColumn.title)} ` +
|
|
299
|
+
`(id ${resolvedColumn.id}) has type ` +
|
|
300
|
+
`${JSON.stringify(resolvedColumn.type)}, which Monday ` +
|
|
301
|
+
`writes via change_column_value not add_file_to_column. ` +
|
|
302
|
+
`monday item upload only accepts file-typed columns.`, {
|
|
303
|
+
details: {
|
|
304
|
+
column_id: resolvedColumn.id,
|
|
305
|
+
column_title: resolvedColumn.title,
|
|
306
|
+
type: resolvedColumn.type,
|
|
307
|
+
board_id: boardId,
|
|
308
|
+
hint: 'use `monday item set` / `monday item update --set` ' +
|
|
309
|
+
'against this column; `monday item upload` only ' +
|
|
310
|
+
'accepts file-typed columns (cli-design §5.3 ' +
|
|
311
|
+
'writer-expansion roadmap "files" row).',
|
|
312
|
+
},
|
|
313
|
+
}), resolverWarnings);
|
|
314
|
+
}
|
|
315
|
+
// Read the file bytes into a Blob with a sniffed content-
|
|
316
|
+
// type. Done AFTER column-type validation so a non-`file`
|
|
317
|
+
// column rejection doesn't pay for the full read.
|
|
318
|
+
const bytes = await readFile(filePath);
|
|
319
|
+
const file = new Blob([bytes], { type: sniffContentType(filename) });
|
|
320
|
+
const result = await addFileToColumn({
|
|
321
|
+
client,
|
|
322
|
+
multipart,
|
|
323
|
+
itemId: parsed.itemId,
|
|
324
|
+
columnId: resolvedColumn.id,
|
|
325
|
+
file,
|
|
326
|
+
filename,
|
|
327
|
+
signal: ctx.signal,
|
|
328
|
+
retries: globalFlags.retry,
|
|
329
|
+
});
|
|
330
|
+
// §8 single-leg cache invalidation (D6). Fired BEFORE
|
|
331
|
+
// emitMutation so a cache-unlink failure surfaces through
|
|
332
|
+
// the runner's catch-all rather than double-emitting after
|
|
333
|
+
// the success envelope already hit stdout.
|
|
334
|
+
await invalidateBoard(boardId, ctx.env);
|
|
335
|
+
const data = {
|
|
336
|
+
operation: 'add_file_to_column',
|
|
337
|
+
item_id: parsed.itemId,
|
|
338
|
+
column_id: resolvedColumn.id,
|
|
339
|
+
filename,
|
|
340
|
+
file_size_bytes: fileSizeBytes,
|
|
341
|
+
asset: result.asset,
|
|
342
|
+
};
|
|
343
|
+
// `toEmit` carries `source: 'live'` + the resolved
|
|
344
|
+
// `apiVersion`. Splat first; override `complexity` with the
|
|
345
|
+
// multipart wire's projection (Monday's asset-upload
|
|
346
|
+
// mutations don't return a complexity block today, but
|
|
347
|
+
// honoring the slot mirrors the JSON-fetcher pattern).
|
|
348
|
+
emitMutation({
|
|
349
|
+
ctx,
|
|
350
|
+
data,
|
|
351
|
+
schema: itemUploadCommand.outputSchema,
|
|
352
|
+
programOpts: program.opts(),
|
|
353
|
+
warnings: resolverWarnings.map((w) => ({
|
|
354
|
+
code: w.code,
|
|
355
|
+
message: w.message,
|
|
356
|
+
details: w.details,
|
|
357
|
+
})),
|
|
358
|
+
...toEmit({
|
|
359
|
+
data: result.asset,
|
|
360
|
+
complexity: result.complexity,
|
|
361
|
+
stats: { attempts: 1, totalBackoffMs: 0 },
|
|
362
|
+
}),
|
|
363
|
+
source: 'live',
|
|
364
|
+
cacheAgeSeconds: null,
|
|
365
|
+
complexity: result.complexity,
|
|
366
|
+
});
|
|
367
|
+
});
|
|
368
|
+
},
|
|
369
|
+
};
|
|
370
|
+
//# sourceMappingURL=upload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../src/commands/item/upload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgGG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,IAAI,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAsB,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EACL,sBAAsB,EAEtB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,E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,CAAC,UAAU;oBAC7B,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE;iBAC1C,CAAC;gBACF,MAAM,EAAE,MAAM;gBACd,eAAe,EAAE,IAAI;gBACrB,UAAU,EAAE,MAAM,CAAC,UAAU;aAC9B,CAAC,CAAC;QACL,CAAC,CACF,CAAC;IACN,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `monday item watch <iid>` — polling-based event stream over the
|
|
3
|
+
* v0.3-M24 `item-history-projection.ts` projector. Runtime body
|
|
4
|
+
* shipped at v0.4-M29 IMPL (`7b83a3a` + round-1 fix-ups). Pinned
|
|
5
|
+
* per cli-design §13 v0.4 entry + §14.4 closure (`31713fb`) +
|
|
6
|
+
* v0.4-plan §3 M29.
|
|
7
|
+
*
|
|
8
|
+
* **What this verb answers:** "wait for changes on this item + emit
|
|
9
|
+
* them as they arrive". Single CLI invocation polls Monday's
|
|
10
|
+
* `boards(ids:){ activity_logs(item_ids:, from:, limit:) }` surface
|
|
11
|
+
* each tick, projects new rows through the M24 projector, emits one
|
|
12
|
+
* NDJSON record per new event plus a session-summary trailer on exit.
|
|
13
|
+
*
|
|
14
|
+
* **GraphQL operation:** `ItemWatchPoll` (one per poll tick;
|
|
15
|
+
* R-NEW-37 W2 audit-point — operationName pinned in
|
|
16
|
+
* `WATCH_POLL_QUERY` literal at `src/api/item-watch.ts`).
|
|
17
|
+
*
|
|
18
|
+
* **Action shape (M29 IMPL).** Item-board lookup via
|
|
19
|
+
* `lookupItemBoard` → `watchItem` polling loop with NDJSON
|
|
20
|
+
* `onEvent` streaming hook + per-event projection via M24's
|
|
21
|
+
* `projectActivityLogRow` → trailer-meta emit on graceful exit.
|
|
22
|
+
* SIGINT graceful drain via `ctx.signal` (the same AbortSignal seam
|
|
23
|
+
* M22 status uses). The polling loop owns:
|
|
24
|
+
*
|
|
25
|
+
* - Cadence (default 30s; range 1s–1h; `--interval <ms>`).
|
|
26
|
+
* - Watermark advance (last-seen-event-id; `--since <event-id>`
|
|
27
|
+
* bootstraps).
|
|
28
|
+
* - Circuit breaker (reactive on Monday wire errors; trip after 5
|
|
29
|
+
* consecutive failures; per-failure warnings accumulate on
|
|
30
|
+
* `WatchItemResult.warnings` and fold into the trailer's
|
|
31
|
+
* `_meta.warnings` slot at session end per cli-design §6.3 —
|
|
32
|
+
* NOT interleaved with event lines).
|
|
33
|
+
* - Limit enforcement (`--max-events <n>` / `--max-duration
|
|
34
|
+
* <seconds>`).
|
|
35
|
+
* - `--once` short-circuit (drain backlog and exit; do NOT poll).
|
|
36
|
+
*
|
|
37
|
+
* **Output:** NDJSON only at v0.4-M29 — `--json` / `--table` /
|
|
38
|
+
* `--output` global flags ignored (this is a streaming verb).
|
|
39
|
+
* Trailer-meta carries seven M29-specific slots:
|
|
40
|
+
* `events_emitted` + `polls_made` + `failed_polls` +
|
|
41
|
+
* `watch_duration_seconds` + `last_seen_event_id` +
|
|
42
|
+
* `circuit_broken_at` + `exit_reason`. Plus the standard §6.3
|
|
43
|
+
* `_meta.warnings[]` slot collects any `WatchSessionWarning`
|
|
44
|
+
* records the polling loop accumulated (poll_failed,
|
|
45
|
+
* circuit_breaker_armed, unknown_event_kind) — warnings are NOT
|
|
46
|
+
* interleaved with event lines.
|
|
47
|
+
*
|
|
48
|
+
* Idempotent: yes (pure read; re-running with the same `--since` is
|
|
49
|
+
* safe).
|
|
50
|
+
*/
|
|
51
|
+
import { z } from 'zod';
|
|
52
|
+
import { type CommandModule } from '../types.js';
|
|
53
|
+
import { type HistoryEvent } from '../../api/item-history-projection.js';
|
|
54
|
+
/**
|
|
55
|
+
* Argv input schema for `monday item watch <iid>`. Validates at the
|
|
56
|
+
* parse boundary; the action body consumes the validated shape
|
|
57
|
+
* directly (no defensive re-checks).
|
|
58
|
+
*
|
|
59
|
+
* Mutual-exclusion rules (superRefine):
|
|
60
|
+
*
|
|
61
|
+
* - `--once` is incompatible with `--max-events` / `--max-duration`.
|
|
62
|
+
* `--once` already pins the exit (drain then return); a max-event
|
|
63
|
+
* ceiling would be redundant and a max-duration ceiling could
|
|
64
|
+
* race the backlog drain.
|
|
65
|
+
* - `--interval <ms>` requires the bare-integer ms form; the closure
|
|
66
|
+
* pins ms semantics (not bare seconds) to disambiguate 30 vs
|
|
67
|
+
* 30000 unambiguously. Range 1000–3600000 (1s–1h).
|
|
68
|
+
*/
|
|
69
|
+
declare const inputSchema: z.ZodObject<{
|
|
70
|
+
iid: z.core.$ZodBranded<z.ZodString, "ItemId", "out">;
|
|
71
|
+
interval: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
72
|
+
since: z.ZodOptional<z.ZodString>;
|
|
73
|
+
once: z.ZodOptional<z.ZodBoolean>;
|
|
74
|
+
maxEvents: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
75
|
+
maxDuration: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
76
|
+
include: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>, z.ZodArray<z.ZodEnum<{
|
|
77
|
+
unknown: "unknown";
|
|
78
|
+
update_column_value: "update_column_value";
|
|
79
|
+
create_column: "create_column";
|
|
80
|
+
create_group: "create_group";
|
|
81
|
+
update_board_name: "update_board_name";
|
|
82
|
+
update_board_nickname: "update_board_nickname";
|
|
83
|
+
board_workspace_id_changed: "board_workspace_id_changed";
|
|
84
|
+
update_posted: "update_posted";
|
|
85
|
+
update_replied: "update_replied";
|
|
86
|
+
}>>>>;
|
|
87
|
+
}, z.core.$strict>;
|
|
88
|
+
export declare const itemWatchCommand: CommandModule<z.infer<typeof inputSchema>, HistoryEvent>;
|
|
89
|
+
export {};
|
|
90
|
+
//# sourceMappingURL=watch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/commands/item/watch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAsBnE,OAAO,EAEL,KAAK,YAAY,EAClB,MAAM,sCAAsC,CAAC;AAkD9C;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;kBAsEb,CAAC;AAEL,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAC1C,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,EAC3B,YAAY,CA8Lb,CAAC"}
|