@gonovus-ai/spec-flow-cli 0.6.3 → 1.0.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/README.md +58 -7
- package/dist/authentication-command-topology.js.map +1 -1
- package/dist/bin.js.map +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +864 -287
- package/dist/cli.js.map +1 -1
- package/dist/client-identity.d.ts +1 -1
- package/dist/client-identity.js +3 -1
- package/dist/client-identity.js.map +1 -1
- package/dist/commands/client-compatibility.d.ts +3 -0
- package/dist/commands/client-compatibility.js +191 -0
- package/dist/commands/client-compatibility.js.map +1 -0
- package/dist/commands/guide.d.ts +2 -0
- package/dist/commands/guide.js +35 -0
- package/dist/commands/guide.js.map +1 -0
- package/dist/commands/work-item-output.d.ts +15 -5
- package/dist/commands/work-item-output.js +47 -9
- package/dist/commands/work-item-output.js.map +1 -1
- package/dist/credential-store.js +6 -7
- package/dist/credential-store.js.map +1 -1
- package/dist/custom-field-color-commands.js +13 -3
- package/dist/custom-field-color-commands.js.map +1 -1
- package/dist/default-api-origin.js.map +1 -1
- package/dist/github-account-commands.js +116 -20
- package/dist/github-account-commands.js.map +1 -1
- package/dist/github-connection-commands.js +284 -36
- package/dist/github-connection-commands.js.map +1 -1
- package/dist/github-import-commands.js +41 -11
- package/dist/github-import-commands.js.map +1 -1
- package/dist/http-origin.js +1 -1
- package/dist/http-origin.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +125 -35
- package/dist/index.js.map +1 -1
- package/dist/input/text-source.js +8 -2
- package/dist/input/text-source.js.map +1 -1
- package/dist/node-version.js.map +1 -1
- package/dist/product-map-commands.js +220 -37
- package/dist/product-map-commands.js.map +1 -1
- package/dist/program.js +9 -3
- package/dist/program.js.map +1 -1
- package/dist/project-administration-commands.js +36 -8
- package/dist/project-administration-commands.js.map +1 -1
- package/dist/runtime/client-compatibility.d.ts +13 -0
- package/dist/runtime/client-compatibility.js +79 -0
- package/dist/runtime/client-compatibility.js.map +1 -0
- package/dist/runtime/errors.js +21 -3
- package/dist/runtime/errors.js.map +1 -1
- package/dist/runtime/execute.js +16 -2
- package/dist/runtime/execute.js.map +1 -1
- package/dist/runtime/identity.d.ts +8 -80
- package/dist/runtime/identity.js +21 -4
- package/dist/runtime/identity.js.map +1 -1
- package/dist/runtime/npm-upgrade.d.ts +32 -0
- package/dist/runtime/npm-upgrade.js +132 -0
- package/dist/runtime/npm-upgrade.js.map +1 -0
- package/dist/runtime/output.js +6 -1
- package/dist/runtime/output.js.map +1 -1
- package/dist/runtime/session.js +44 -11
- package/dist/runtime/session.js.map +1 -1
- package/dist/screen-image-commands.js +66 -14
- package/dist/screen-image-commands.js.map +1 -1
- package/dist/spec-discussion-commands.js +87 -24
- package/dist/spec-discussion-commands.js.map +1 -1
- package/dist/spec-owner-commands.js +22 -7
- package/dist/spec-owner-commands.js.map +1 -1
- package/dist/user-api-key-commands.js +92 -20
- package/dist/user-api-key-commands.js.map +1 -1
- package/dist/work-item-asset-commands.js +23 -6
- package/dist/work-item-asset-commands.js.map +1 -1
- package/dist/work-item-delivery-commands.js +97 -31
- package/dist/work-item-delivery-commands.js.map +1 -1
- package/dist/work-item-exchange-file.js +22 -8
- package/dist/work-item-exchange-file.js.map +1 -1
- package/dist/work-item-query-commands.js +403 -35
- package/dist/work-item-query-commands.js.map +1 -1
- package/dist/work-item-resource-link-commands.js +105 -28
- package/dist/work-item-resource-link-commands.js.map +1 -1
- package/dist/work-item-thread-commands.d.ts +3 -0
- package/dist/work-item-thread-commands.js +101 -0
- package/dist/work-item-thread-commands.js.map +1 -0
- package/dist/work-item-watcher-commands.d.ts +20 -0
- package/dist/work-item-watcher-commands.js +93 -0
- package/dist/work-item-watcher-commands.js.map +1 -0
- package/guides/authoring.md +178 -0
- package/guides/delivery.md +60 -0
- package/guides/discussions-audit.md +32 -0
- package/guides/errors.md +41 -0
- package/guides/glossary.md +40 -0
- package/guides/map-and-screens.md +31 -0
- package/guides/search.md +9 -0
- package/guides/work-items.md +195 -0
- package/guides/workspace-admin.md +130 -0
- package/package.json +8 -3
package/dist/cli.js
CHANGED
|
@@ -2,18 +2,20 @@ import { CommanderError, InvalidArgumentError } from "commander";
|
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { addAuthenticationCommandTopology } from "./authentication-command-topology.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { registerClientCompatibilityCommands } from "./commands/client-compatibility.js";
|
|
6
|
+
import { itemOutput, itemListOutput, relationListOutput, relationReceiptOutput, } from "./commands/work-item-output.js";
|
|
7
|
+
import { registerCustomFieldColorCommands, parseOptionColors, } from "./custom-field-color-commands.js";
|
|
7
8
|
import { registerGitHubAccountCommands } from "./github-account-commands.js";
|
|
8
9
|
import { readDescription, singleDescriptionSource } from "./input/text-source.js";
|
|
9
10
|
import { registerProductMapCommands } from "./product-map-commands.js";
|
|
10
11
|
import { createProgram } from "./program.js";
|
|
11
12
|
import { registerProjectAdministrationCommands } from "./project-administration-commands.js";
|
|
13
|
+
import { observeCompatibility } from "./runtime/client-compatibility.js";
|
|
12
14
|
import { writeSkillError, skillErrorExitCode } from "./runtime/errors.js";
|
|
13
|
-
import { execute } from "./runtime/execute.js";
|
|
15
|
+
import { execute, } from "./runtime/execute.js";
|
|
14
16
|
import { readIdentity } from "./runtime/identity.js";
|
|
15
17
|
import { writeResult } from "./runtime/output.js";
|
|
16
|
-
import { selectSession, hasWorkspaceReadToken, rejectWorkspaceReadTokenOperation } from "./runtime/session.js";
|
|
18
|
+
import { selectSession, hasWorkspaceReadToken, rejectWorkspaceReadTokenOperation, } from "./runtime/session.js";
|
|
17
19
|
import { registerSpecDiscussionCommands } from "./spec-discussion-commands.js";
|
|
18
20
|
import { registerSpecOwnerCommands } from "./spec-owner-commands.js";
|
|
19
21
|
import { registerUserApiKeyCommands } from "./user-api-key-commands.js";
|
|
@@ -22,6 +24,8 @@ import { registerWorkItemDeliveryCommands } from "./work-item-delivery-commands.
|
|
|
22
24
|
import { readWorkItemImportFile } from "./work-item-exchange-file.js";
|
|
23
25
|
import { registerWorkItemQueryCommands } from "./work-item-query-commands.js";
|
|
24
26
|
import { registerWorkItemResourceLinkCommands } from "./work-item-resource-link-commands.js";
|
|
27
|
+
import { registerWorkItemThreadCommands } from "./work-item-thread-commands.js";
|
|
28
|
+
import { registerWorkItemWatcherCommands } from "./work-item-watcher-commands.js";
|
|
25
29
|
export function formatResourceDiagnostic(message) {
|
|
26
30
|
return `${JSON.stringify({ diagnostic: { level: "warning", message } })}\n`;
|
|
27
31
|
}
|
|
@@ -49,7 +53,10 @@ const sourceReferenceInputSchema = z
|
|
|
49
53
|
externalRevision: z.string().trim().min(1).max(200).optional(),
|
|
50
54
|
section: z.string().trim().min(1).max(500).optional(),
|
|
51
55
|
title: z.string().trim().min(1).max(300),
|
|
52
|
-
url: z
|
|
56
|
+
url: z
|
|
57
|
+
.url()
|
|
58
|
+
.max(2_000)
|
|
59
|
+
.refine((value) => {
|
|
53
60
|
const url = new URL(value);
|
|
54
61
|
return ((url.protocol === "https:" || url.protocol === "http:") &&
|
|
55
62
|
url.username.length === 0 &&
|
|
@@ -68,7 +75,11 @@ const findingReferenceSchema = z
|
|
|
68
75
|
const findingTargetSchema = z
|
|
69
76
|
.object({
|
|
70
77
|
references: z.array(findingReferenceSchema).min(1).max(50),
|
|
71
|
-
specId: z
|
|
78
|
+
specId: z
|
|
79
|
+
.string()
|
|
80
|
+
.trim()
|
|
81
|
+
.toUpperCase()
|
|
82
|
+
.regex(/^[A-Z]{2,10}-S[1-9]\d*$/u),
|
|
72
83
|
})
|
|
73
84
|
.strict();
|
|
74
85
|
const findingEvidenceSchema = z.discriminatedUnion("kind", [
|
|
@@ -139,11 +150,26 @@ const findingCreateInputSchema = z
|
|
|
139
150
|
targets: z.array(findingTargetSchema).min(1).max(10),
|
|
140
151
|
})
|
|
141
152
|
.strict();
|
|
142
|
-
export async function runCli(arguments_,
|
|
153
|
+
export async function runCli(arguments_, originalDependencies) {
|
|
143
154
|
let exitCode = 0;
|
|
155
|
+
const observe = observeCompatibility(originalDependencies);
|
|
156
|
+
const dependencies = {
|
|
157
|
+
...originalDependencies,
|
|
158
|
+
fetch: async (request) => {
|
|
159
|
+
const response = await originalDependencies.fetch(request);
|
|
160
|
+
if (new URL(request.url).pathname !== "/v1/client-compatibility")
|
|
161
|
+
await observe(request.url, response);
|
|
162
|
+
return response;
|
|
163
|
+
},
|
|
164
|
+
};
|
|
144
165
|
let outputMode = "full";
|
|
145
|
-
const warnMissingUrl = () => {
|
|
166
|
+
const warnMissingUrl = () => {
|
|
167
|
+
dependencies.stderr(formatResourceDiagnostic("This server version does not support Work Item URLs; upgrade the server. The business operation succeeded."));
|
|
168
|
+
};
|
|
146
169
|
const program = createProgram(dependencies);
|
|
170
|
+
registerClientCompatibilityCommands(program, dependencies, (code) => {
|
|
171
|
+
exitCode = code;
|
|
172
|
+
});
|
|
147
173
|
const run = async (request, options = {}) => {
|
|
148
174
|
const selected = await selectSession(dependencies, options, program.getOptionValue("server"), program.getOptionValue("apiKeyId"));
|
|
149
175
|
if ("exitCode" in selected)
|
|
@@ -159,27 +185,61 @@ export async function runCli(arguments_, dependencies) {
|
|
|
159
185
|
}
|
|
160
186
|
me = identity.data.user.id;
|
|
161
187
|
}
|
|
162
|
-
const result = await execute(client => request(client, me, selected.credentialKind), selected.client, options);
|
|
188
|
+
const result = await execute((client) => request(client, me, selected.credentialKind), selected.client, options);
|
|
163
189
|
if (!result.ok) {
|
|
164
190
|
writeSkillError(dependencies, result.error);
|
|
165
191
|
return skillErrorExitCode(result.error);
|
|
166
192
|
}
|
|
167
193
|
return writeResult(dependencies, () => options.project === undefined ? result.data : options.project(result.data));
|
|
168
194
|
};
|
|
169
|
-
registerUserApiKeyCommands(program, {
|
|
170
|
-
|
|
195
|
+
registerUserApiKeyCommands(program, {
|
|
196
|
+
dependencies,
|
|
197
|
+
run,
|
|
198
|
+
setExitCode: (value) => {
|
|
199
|
+
exitCode = value;
|
|
200
|
+
},
|
|
201
|
+
parseScopes: parseRoleStatements,
|
|
202
|
+
parseLimit: parseSearchLimit,
|
|
203
|
+
});
|
|
204
|
+
registerGitHubAccountCommands(program, {
|
|
205
|
+
dependencies,
|
|
206
|
+
run,
|
|
207
|
+
setExitCode: (value) => {
|
|
208
|
+
exitCode = value;
|
|
209
|
+
},
|
|
210
|
+
});
|
|
171
211
|
const authentication = addAuthenticationCommandTopology(program);
|
|
172
212
|
program.hook("preAction", (_command, actionCommand) => {
|
|
173
213
|
const names = [];
|
|
174
214
|
for (let command = actionCommand; command.parent !== null; command = command.parent)
|
|
175
215
|
names.unshift(command.name());
|
|
176
216
|
const path = names.join(" ");
|
|
177
|
-
outputMode =
|
|
178
|
-
|
|
217
|
+
outputMode =
|
|
218
|
+
program.opts().output ??
|
|
219
|
+
(path === "work-item subtask link" ? "summary" : "full");
|
|
220
|
+
if (outputMode === "summary" &&
|
|
221
|
+
![
|
|
222
|
+
"work-item create",
|
|
223
|
+
"work-item read",
|
|
224
|
+
"work-item update",
|
|
225
|
+
"work-item assign",
|
|
226
|
+
"work-item list",
|
|
227
|
+
"work-item relation create",
|
|
228
|
+
"work-item relation list",
|
|
229
|
+
"work-item subtask link",
|
|
230
|
+
].includes(path))
|
|
179
231
|
throw invalidArgument("Summary output is not supported for this command");
|
|
180
|
-
if (![
|
|
232
|
+
if (![
|
|
233
|
+
"work-item create",
|
|
234
|
+
"work-item assign",
|
|
235
|
+
"work-item list",
|
|
236
|
+
"work-item board",
|
|
237
|
+
"work-item export",
|
|
238
|
+
].includes(path)) {
|
|
181
239
|
const assignee = actionCommand.getOptionValue("assignee");
|
|
182
|
-
if (assignee === "me" ||
|
|
240
|
+
if (assignee === "me" ||
|
|
241
|
+
(Array.isArray(assignee) &&
|
|
242
|
+
assignee.some((value) => typeof value === "string" && value.split(",").includes("me"))))
|
|
183
243
|
throw invalidArgument("This command accepts User IDs only; me is supported by work-item create and assign");
|
|
184
244
|
}
|
|
185
245
|
const options = actionCommand.opts();
|
|
@@ -193,32 +253,36 @@ export async function runCli(arguments_, dependencies) {
|
|
|
193
253
|
actionCommand.setOptionValue("workItemId", parseWorkItemId(options.workItemId));
|
|
194
254
|
}
|
|
195
255
|
});
|
|
196
|
-
for (const command of [
|
|
197
|
-
authentication.login,
|
|
198
|
-
authentication.logout,
|
|
199
|
-
authentication.status,
|
|
200
|
-
]) {
|
|
256
|
+
for (const command of [authentication.login, authentication.logout, authentication.status]) {
|
|
201
257
|
command.action(() => {
|
|
202
258
|
throw new CommanderError(2, "specflow.authenticationCommand", "Authentication commands use the human-facing CLI boundary");
|
|
203
259
|
});
|
|
204
260
|
}
|
|
205
261
|
dependencies.registerAuthentication?.(program, authentication);
|
|
206
|
-
authentication.status.parent
|
|
262
|
+
authentication.status.parent
|
|
263
|
+
?.command("whoami")
|
|
264
|
+
.description("Read the current User ID and selected credential kind")
|
|
265
|
+
.action(async () => {
|
|
207
266
|
exitCode = await run(async (client, _me, credentialKind) => {
|
|
208
267
|
const result = await readIdentity(client);
|
|
209
|
-
return {
|
|
268
|
+
return {
|
|
269
|
+
...result,
|
|
270
|
+
...(result.data === undefined
|
|
271
|
+
? {}
|
|
272
|
+
: { data: { user: { id: result.data.user.id }, credentialKind } }),
|
|
273
|
+
};
|
|
210
274
|
}, { rejectWorkspaceReadToken: true });
|
|
211
275
|
});
|
|
212
276
|
const workspace = program.command("workspace");
|
|
213
|
-
workspace
|
|
214
|
-
.
|
|
215
|
-
|
|
216
|
-
|
|
277
|
+
workspace.command("list").action(async () => {
|
|
278
|
+
exitCode = await run((client) => client.GET("/v1/workspaces"), {
|
|
279
|
+
rejectWorkspaceReadToken: true,
|
|
280
|
+
});
|
|
217
281
|
});
|
|
218
282
|
workspace
|
|
219
283
|
.command("create")
|
|
220
284
|
.requiredOption("--name <name>")
|
|
221
|
-
.
|
|
285
|
+
.option("--prefix <prefix>", "Immutable Workspace number prefix, 2 to 10 uppercase letters")
|
|
222
286
|
.option("--spec-language <language>", "Workspace keyword language: zh-CN or en", (value) => z.enum(["zh-CN", "en"]).parse(value), "zh-CN")
|
|
223
287
|
.action(async (options) => {
|
|
224
288
|
if (hasWorkspaceReadToken(dependencies.environment)) {
|
|
@@ -227,23 +291,63 @@ export async function runCli(arguments_, dependencies) {
|
|
|
227
291
|
}
|
|
228
292
|
const idempotencyKey = randomUUID();
|
|
229
293
|
exitCode = await run((client) => client.POST("/v1/workspaces", {
|
|
230
|
-
body: {
|
|
294
|
+
body: {
|
|
295
|
+
name: options.name,
|
|
296
|
+
prefix: options.prefix,
|
|
297
|
+
specLanguage: options.specLanguage,
|
|
298
|
+
},
|
|
231
299
|
params: { header: { "idempotency-key": idempotencyKey } },
|
|
232
|
-
}), {
|
|
300
|
+
}), {
|
|
301
|
+
retryTransportOnce: true,
|
|
302
|
+
ambiguousOutcomeMessage: "Workspace creation outcome is unknown; run workspace list before trying a new command identity",
|
|
303
|
+
});
|
|
233
304
|
});
|
|
234
|
-
workspace
|
|
235
|
-
|
|
305
|
+
workspace
|
|
306
|
+
.command("rename")
|
|
307
|
+
.requiredOption("--workspace-id <workspaceId>")
|
|
308
|
+
.requiredOption("--name <name>")
|
|
309
|
+
.requiredOption("--expected-version <version>", "Observed Workspace settings version", parseOpaqueVersion)
|
|
310
|
+
.requiredOption("--idempotency-key <key>")
|
|
311
|
+
.action(async (options) => {
|
|
312
|
+
exitCode = await run((client) => client.PATCH("/v1/workspaces/{workspaceId}/settings", {
|
|
313
|
+
params: {
|
|
314
|
+
path: { workspaceId: options.workspaceId },
|
|
315
|
+
header: {
|
|
316
|
+
"idempotency-key": options.idempotencyKey,
|
|
317
|
+
"if-match": options.expectedVersion,
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
body: { name: options.name },
|
|
321
|
+
}), { retryTransportOnce: true });
|
|
236
322
|
});
|
|
237
323
|
const workspaceSettings = workspace.command("settings");
|
|
238
|
-
workspaceSettings
|
|
239
|
-
|
|
324
|
+
workspaceSettings
|
|
325
|
+
.command("read")
|
|
326
|
+
.requiredOption("--workspace-id <workspaceId>")
|
|
327
|
+
.action(async (options) => {
|
|
328
|
+
exitCode = await run((client) => client.GET("/v1/workspaces/{workspaceId}/settings", { params: { path: options } }));
|
|
240
329
|
});
|
|
241
|
-
workspaceSettings
|
|
330
|
+
workspaceSettings
|
|
331
|
+
.command("update")
|
|
332
|
+
.requiredOption("--workspace-id <workspaceId>")
|
|
333
|
+
.requiredOption("--spec-language <language>", "Workspace keyword language", (value) => z.enum(["zh-CN", "en"]).parse(value))
|
|
334
|
+
.requiredOption("--expected-version <version>", "Observed Workspace settings version", parseOpaqueVersion)
|
|
335
|
+
.requiredOption("--idempotency-key <key>")
|
|
336
|
+
.action(async (options) => {
|
|
242
337
|
if (hasWorkspaceReadToken(dependencies.environment)) {
|
|
243
338
|
exitCode = rejectTokenWrite(dependencies);
|
|
244
339
|
return;
|
|
245
340
|
}
|
|
246
|
-
exitCode = await run(client => client.PATCH("/v1/workspaces/{workspaceId}/settings", {
|
|
341
|
+
exitCode = await run((client) => client.PATCH("/v1/workspaces/{workspaceId}/settings", {
|
|
342
|
+
params: {
|
|
343
|
+
path: { workspaceId: options.workspaceId },
|
|
344
|
+
header: {
|
|
345
|
+
"idempotency-key": options.idempotencyKey,
|
|
346
|
+
"if-match": options.expectedVersion,
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
body: { specLanguage: options.specLanguage },
|
|
350
|
+
}), { retryTransportOnce: true });
|
|
247
351
|
});
|
|
248
352
|
const workspaceMember = workspace.command("member");
|
|
249
353
|
workspaceMember
|
|
@@ -440,12 +544,8 @@ export async function runCli(arguments_, dependencies) {
|
|
|
440
544
|
exitCode = await run((client) => client.GET("/v1/projects", {
|
|
441
545
|
params: {
|
|
442
546
|
query: {
|
|
443
|
-
...(options.status === undefined
|
|
444
|
-
|
|
445
|
-
: { status: options.status }),
|
|
446
|
-
...(options.workspaceId === undefined
|
|
447
|
-
? {}
|
|
448
|
-
: { workspaceId: options.workspaceId }),
|
|
547
|
+
...(options.status === undefined ? {} : { status: options.status }),
|
|
548
|
+
...(options.workspaceId === undefined ? {} : { workspaceId: options.workspaceId }),
|
|
449
549
|
},
|
|
450
550
|
},
|
|
451
551
|
}), { rejectWorkspaceReadToken: true });
|
|
@@ -498,15 +598,19 @@ export async function runCli(arguments_, dependencies) {
|
|
|
498
598
|
params: { path: { projectId: options.projectId } },
|
|
499
599
|
}));
|
|
500
600
|
});
|
|
501
|
-
const sharing = project
|
|
502
|
-
|
|
601
|
+
const sharing = project
|
|
602
|
+
.command("sharing")
|
|
603
|
+
.description("Manage anonymous task-only Project sharing");
|
|
604
|
+
sharing
|
|
605
|
+
.command("read")
|
|
503
606
|
.requiredOption("--project-id <projectId>")
|
|
504
607
|
.action(async (options) => {
|
|
505
608
|
exitCode = await run((client) => client.GET("/v1/projects/{projectId}/sharing", {
|
|
506
609
|
params: { path: { projectId: options.projectId } },
|
|
507
610
|
}), { rejectWorkspaceReadToken: true });
|
|
508
611
|
});
|
|
509
|
-
sharing
|
|
612
|
+
sharing
|
|
613
|
+
.command("set")
|
|
510
614
|
.requiredOption("--project-id <projectId>")
|
|
511
615
|
.requiredOption("--public <boolean>", "true or false", (value) => {
|
|
512
616
|
if (value !== "true" && value !== "false")
|
|
@@ -526,12 +630,39 @@ export async function runCli(arguments_, dependencies) {
|
|
|
526
630
|
}
|
|
527
631
|
exitCode = await run((client) => client.PUT("/v1/projects/{projectId}/sharing", {
|
|
528
632
|
body: { isPublic: options.public },
|
|
529
|
-
params: {
|
|
530
|
-
|
|
633
|
+
params: {
|
|
634
|
+
path: { projectId: options.projectId },
|
|
635
|
+
header: {
|
|
636
|
+
"if-match": options.expectedVersion,
|
|
637
|
+
"idempotency-key": options.idempotencyKey,
|
|
638
|
+
},
|
|
639
|
+
},
|
|
640
|
+
}), {
|
|
641
|
+
rejectWorkspaceReadToken: true,
|
|
642
|
+
retryTransportOnce: true,
|
|
643
|
+
ambiguousOutcomeMessage: "Sharing outcome is unknown; reread project sharing and retry the same command key and intent",
|
|
644
|
+
});
|
|
531
645
|
});
|
|
532
646
|
const spec = program.command("spec");
|
|
533
|
-
spec
|
|
534
|
-
|
|
647
|
+
spec
|
|
648
|
+
.command("list")
|
|
649
|
+
.requiredOption("--workspace-id <workspaceId>")
|
|
650
|
+
.option("--project-id <projectId>")
|
|
651
|
+
.option("--query <query>")
|
|
652
|
+
.option("--limit <limit>", "Maximum results", parseSearchLimit, 50)
|
|
653
|
+
.option("--cursor <cursor>")
|
|
654
|
+
.action(async (options) => {
|
|
655
|
+
exitCode = await run((client) => client.GET("/v1/workspaces/{workspaceId}/spec-directory", {
|
|
656
|
+
params: {
|
|
657
|
+
path: { workspaceId: options.workspaceId },
|
|
658
|
+
query: {
|
|
659
|
+
...(options.projectId === undefined ? {} : { projectId: options.projectId }),
|
|
660
|
+
...(options.query === undefined ? {} : { query: options.query }),
|
|
661
|
+
limit: options.limit,
|
|
662
|
+
...(options.cursor === undefined ? {} : { cursor: options.cursor }),
|
|
663
|
+
},
|
|
664
|
+
},
|
|
665
|
+
}), { rejectWorkspaceReadToken: true });
|
|
535
666
|
});
|
|
536
667
|
spec
|
|
537
668
|
.command("read")
|
|
@@ -547,7 +678,9 @@ export async function runCli(arguments_, dependencies) {
|
|
|
547
678
|
.requiredOption("--workspace-id <workspaceId>")
|
|
548
679
|
.requiredOption("--spec-id <specId>")
|
|
549
680
|
.action(async (options) => {
|
|
550
|
-
exitCode = await run((client) => client.GET("/v1/workspaces/{workspaceId}/specs/{specId}/changelog", {
|
|
681
|
+
exitCode = await run((client) => client.GET("/v1/workspaces/{workspaceId}/specs/{specId}/changelog", {
|
|
682
|
+
params: { path: options },
|
|
683
|
+
}), { rejectWorkspaceReadToken: true });
|
|
551
684
|
});
|
|
552
685
|
spec
|
|
553
686
|
.command("search")
|
|
@@ -560,9 +693,7 @@ export async function runCli(arguments_, dependencies) {
|
|
|
560
693
|
params: {
|
|
561
694
|
path: { workspaceId: options.workspaceId },
|
|
562
695
|
query: {
|
|
563
|
-
...(options.cursor === undefined
|
|
564
|
-
? {}
|
|
565
|
-
: { cursor: options.cursor }),
|
|
696
|
+
...(options.cursor === undefined ? {} : { cursor: options.cursor }),
|
|
566
697
|
limit: options.limit,
|
|
567
698
|
query: options.query,
|
|
568
699
|
},
|
|
@@ -574,7 +705,9 @@ export async function runCli(arguments_, dependencies) {
|
|
|
574
705
|
.requiredOption("--workspace-id <workspaceId>")
|
|
575
706
|
.requiredOption("--spec-id <specId>")
|
|
576
707
|
.action(async (options) => {
|
|
577
|
-
exitCode = await run((client) => client.GET(hasWorkspaceReadToken(dependencies.environment)
|
|
708
|
+
exitCode = await run((client) => client.GET(hasWorkspaceReadToken(dependencies.environment)
|
|
709
|
+
? "/v1/workspaces/{workspaceId}/published/specs/{specId}/current-revision"
|
|
710
|
+
: "/v1/workspaces/{workspaceId}/specs/{specId}/current-revision", { params: { path: options } }));
|
|
578
711
|
});
|
|
579
712
|
spec
|
|
580
713
|
.command("revision")
|
|
@@ -582,7 +715,9 @@ export async function runCli(arguments_, dependencies) {
|
|
|
582
715
|
.requiredOption("--spec-id <specId>")
|
|
583
716
|
.requiredOption("--revision-id <revisionId>")
|
|
584
717
|
.action(async (options) => {
|
|
585
|
-
exitCode = await run((client) => client.GET(hasWorkspaceReadToken(dependencies.environment)
|
|
718
|
+
exitCode = await run((client) => client.GET(hasWorkspaceReadToken(dependencies.environment)
|
|
719
|
+
? "/v1/workspaces/{workspaceId}/published/specs/{specId}/revisions/{revisionId}"
|
|
720
|
+
: "/v1/workspaces/{workspaceId}/specs/{specId}/revisions/{revisionId}", { params: { path: options } }));
|
|
586
721
|
});
|
|
587
722
|
spec
|
|
588
723
|
.command("edit")
|
|
@@ -688,8 +823,7 @@ export async function runCli(arguments_, dependencies) {
|
|
|
688
823
|
exitCode = rejectTokenWrite(dependencies);
|
|
689
824
|
return;
|
|
690
825
|
}
|
|
691
|
-
if (options.capabilityId === undefined &&
|
|
692
|
-
options.sourceReferences === undefined) {
|
|
826
|
+
if (options.capabilityId === undefined && options.sourceReferences === undefined) {
|
|
693
827
|
throw invalidArgument("Spec update requires Metadata to change");
|
|
694
828
|
}
|
|
695
829
|
const sourceReferences = options.sourceReferences === undefined
|
|
@@ -700,9 +834,7 @@ export async function runCli(arguments_, dependencies) {
|
|
|
700
834
|
...(options.capabilityId === undefined
|
|
701
835
|
? {}
|
|
702
836
|
: { capabilityId: options.capabilityId === "none" ? null : options.capabilityId }),
|
|
703
|
-
...(sourceReferences === undefined
|
|
704
|
-
? {}
|
|
705
|
-
: { sourceReferences }),
|
|
837
|
+
...(sourceReferences === undefined ? {} : { sourceReferences }),
|
|
706
838
|
},
|
|
707
839
|
params: {
|
|
708
840
|
header: { "if-match": options.expectedVersion },
|
|
@@ -746,12 +878,10 @@ export async function runCli(arguments_, dependencies) {
|
|
|
746
878
|
exitCode = rejectTokenWrite(dependencies);
|
|
747
879
|
return;
|
|
748
880
|
}
|
|
749
|
-
if (options.state === "Unavailable" &&
|
|
750
|
-
options.unavailabilityReason === undefined) {
|
|
881
|
+
if (options.state === "Unavailable" && options.unavailabilityReason === undefined) {
|
|
751
882
|
throw invalidArgument("Unavailable requires --unavailability-reason");
|
|
752
883
|
}
|
|
753
|
-
if (options.state === "Ready" &&
|
|
754
|
-
options.unavailabilityReason !== undefined) {
|
|
884
|
+
if (options.state === "Ready" && options.unavailabilityReason !== undefined) {
|
|
755
885
|
throw invalidArgument("Ready does not accept --unavailability-reason");
|
|
756
886
|
}
|
|
757
887
|
exitCode = await run((client) => client.PATCH("/v1/workspaces/{workspaceId}/specs/{specId}/state", {
|
|
@@ -812,7 +942,9 @@ export async function runCli(arguments_, dependencies) {
|
|
|
812
942
|
.requiredOption("--workspace-id <workspaceId>")
|
|
813
943
|
.requiredOption("--revision-id <revisionId>")
|
|
814
944
|
.action(async (options) => {
|
|
815
|
-
exitCode = await run((client) => client.GET(hasWorkspaceReadToken(dependencies.environment)
|
|
945
|
+
exitCode = await run((client) => client.GET(hasWorkspaceReadToken(dependencies.environment)
|
|
946
|
+
? "/v1/workspaces/{workspaceId}/published/glossary/revisions/{revisionId}"
|
|
947
|
+
: "/v1/workspaces/{workspaceId}/glossary/revisions/{revisionId}", { params: { path: options } }));
|
|
816
948
|
});
|
|
817
949
|
workspaceGlossary
|
|
818
950
|
.command("read")
|
|
@@ -909,8 +1041,13 @@ export async function runCli(arguments_, dependencies) {
|
|
|
909
1041
|
retryTransportOnce: true,
|
|
910
1042
|
});
|
|
911
1043
|
});
|
|
912
|
-
workspace
|
|
913
|
-
|
|
1044
|
+
workspace
|
|
1045
|
+
.command("context")
|
|
1046
|
+
.requiredOption("--workspace-id <workspaceId>")
|
|
1047
|
+
.action(async (options) => {
|
|
1048
|
+
exitCode = await run((client) => client.GET("/v1/workspaces/{workspaceId}/knowledge-context", {
|
|
1049
|
+
params: { path: { workspaceId: options.workspaceId } },
|
|
1050
|
+
}), { rejectWorkspaceReadToken: true });
|
|
914
1051
|
});
|
|
915
1052
|
const proposal = program.command("proposal");
|
|
916
1053
|
proposal
|
|
@@ -992,9 +1129,7 @@ export async function runCli(arguments_, dependencies) {
|
|
|
992
1129
|
query: {
|
|
993
1130
|
...(options.specId === undefined ? {} : { specId: options.specId }),
|
|
994
1131
|
...(options.status === undefined ? {} : { status: options.status }),
|
|
995
|
-
...(options.targetKind === undefined
|
|
996
|
-
? {}
|
|
997
|
-
: { targetKind: options.targetKind }),
|
|
1132
|
+
...(options.targetKind === undefined ? {} : { targetKind: options.targetKind }),
|
|
998
1133
|
},
|
|
999
1134
|
},
|
|
1000
1135
|
}));
|
|
@@ -1147,9 +1282,27 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1147
1282
|
.option("--limit <limit>", "Maximum results", parseSearchLimit, 20)
|
|
1148
1283
|
.option("--cursor <cursor>")
|
|
1149
1284
|
.action(async (options) => {
|
|
1150
|
-
exitCode = await run(client => options.specId === undefined
|
|
1151
|
-
? client.GET("/v1/workspaces/{workspaceId}/findings", {
|
|
1152
|
-
|
|
1285
|
+
exitCode = await run((client) => options.specId === undefined
|
|
1286
|
+
? client.GET("/v1/workspaces/{workspaceId}/findings", {
|
|
1287
|
+
params: {
|
|
1288
|
+
path: { workspaceId: options.workspaceId },
|
|
1289
|
+
query: {
|
|
1290
|
+
limit: options.limit,
|
|
1291
|
+
...(options.cursor === undefined ? {} : { cursor: options.cursor }),
|
|
1292
|
+
...(options.status === undefined ? {} : { status: options.status }),
|
|
1293
|
+
},
|
|
1294
|
+
},
|
|
1295
|
+
})
|
|
1296
|
+
: client.GET("/v1/workspaces/{workspaceId}/specs/{specId}/findings", {
|
|
1297
|
+
params: {
|
|
1298
|
+
path: { workspaceId: options.workspaceId, specId: options.specId },
|
|
1299
|
+
query: {
|
|
1300
|
+
limit: options.limit,
|
|
1301
|
+
...(options.cursor === undefined ? {} : { cursor: options.cursor }),
|
|
1302
|
+
...(options.status === undefined ? {} : { status: options.status }),
|
|
1303
|
+
},
|
|
1304
|
+
},
|
|
1305
|
+
}), { rejectWorkspaceReadToken: true });
|
|
1153
1306
|
});
|
|
1154
1307
|
workspaceFinding
|
|
1155
1308
|
.command("read")
|
|
@@ -1213,36 +1366,112 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1213
1366
|
});
|
|
1214
1367
|
});
|
|
1215
1368
|
}
|
|
1216
|
-
workspaceFinding
|
|
1217
|
-
|
|
1369
|
+
workspaceFinding
|
|
1370
|
+
.command("handler")
|
|
1371
|
+
.requiredOption("--workspace-id <workspaceId>")
|
|
1372
|
+
.requiredOption("--finding-id <findingId>")
|
|
1373
|
+
.option("--user-id <userId>", "Workspace member; omit to clear the handler")
|
|
1374
|
+
.requiredOption("--expected-version <expectedVersion>", "Opaque version", parseOpaqueVersion)
|
|
1375
|
+
.requiredOption("--idempotency-key <key>")
|
|
1376
|
+
.action(async (options) => {
|
|
1377
|
+
exitCode = await run((client) => client.PATCH("/v1/workspaces/{workspaceId}/findings/{findingId}/handler", {
|
|
1378
|
+
body: { handlerUserId: options.userId ?? null },
|
|
1379
|
+
params: {
|
|
1380
|
+
path: options,
|
|
1381
|
+
header: {
|
|
1382
|
+
"idempotency-key": options.idempotencyKey,
|
|
1383
|
+
"if-match": options.expectedVersion,
|
|
1384
|
+
},
|
|
1385
|
+
},
|
|
1386
|
+
}), { rejectWorkspaceReadToken: true });
|
|
1218
1387
|
});
|
|
1219
|
-
workspaceFinding
|
|
1220
|
-
|
|
1388
|
+
workspaceFinding
|
|
1389
|
+
.command("follow-up")
|
|
1390
|
+
.requiredOption("--workspace-id <workspaceId>")
|
|
1391
|
+
.requiredOption("--finding-id <findingId>")
|
|
1392
|
+
.requiredOption("--project-id <projectId>")
|
|
1393
|
+
.requiredOption("--idempotency-key <key>")
|
|
1394
|
+
.action(async (options) => {
|
|
1395
|
+
exitCode = await run((client) => client.POST("/v1/workspaces/{workspaceId}/findings/{findingId}/work-item", {
|
|
1396
|
+
body: { projectId: options.projectId },
|
|
1397
|
+
params: {
|
|
1398
|
+
path: { workspaceId: options.workspaceId, findingId: options.findingId },
|
|
1399
|
+
header: { "idempotency-key": options.idempotencyKey },
|
|
1400
|
+
},
|
|
1401
|
+
}), { rejectWorkspaceReadToken: true });
|
|
1221
1402
|
});
|
|
1222
|
-
workspaceFinding
|
|
1223
|
-
|
|
1403
|
+
workspaceFinding
|
|
1404
|
+
.command("discussion")
|
|
1405
|
+
.requiredOption("--workspace-id <workspaceId>")
|
|
1406
|
+
.requiredOption("--finding-id <findingId>")
|
|
1407
|
+
.action(async (options) => {
|
|
1408
|
+
exitCode = await run((client) => client.GET("/v1/workspaces/{workspaceId}/findings/{findingId}/discussion", {
|
|
1409
|
+
params: { path: options },
|
|
1410
|
+
}), { rejectWorkspaceReadToken: true });
|
|
1224
1411
|
});
|
|
1225
|
-
workspaceFinding
|
|
1226
|
-
|
|
1412
|
+
workspaceFinding
|
|
1413
|
+
.command("comment")
|
|
1414
|
+
.requiredOption("--workspace-id <workspaceId>")
|
|
1415
|
+
.requiredOption("--finding-id <findingId>")
|
|
1416
|
+
.requiredOption("--body <body>")
|
|
1417
|
+
.option("--parent-id <parentId>")
|
|
1418
|
+
.requiredOption("--idempotency-key <key>")
|
|
1419
|
+
.action(async (options) => {
|
|
1420
|
+
exitCode = await run((client) => client.POST("/v1/workspaces/{workspaceId}/findings/{findingId}/discussion", {
|
|
1421
|
+
body: { body: options.body, parentId: options.parentId ?? null },
|
|
1422
|
+
params: { path: options, header: { "idempotency-key": options.idempotencyKey } },
|
|
1423
|
+
}), { rejectWorkspaceReadToken: true });
|
|
1227
1424
|
});
|
|
1228
1425
|
const workspaceReview = workspace.command("review");
|
|
1229
|
-
workspaceReview
|
|
1230
|
-
|
|
1426
|
+
workspaceReview
|
|
1427
|
+
.command("request")
|
|
1428
|
+
.requiredOption("--workspace-id <workspaceId>")
|
|
1429
|
+
.requiredOption("--spec-id <specId>")
|
|
1430
|
+
.option("--idempotency-key <key>")
|
|
1431
|
+
.action(async (options) => {
|
|
1432
|
+
exitCode = await run((client) => client.POST("/v1/workspaces/{workspaceId}/specs/{specId}/reviews", {
|
|
1433
|
+
params: {
|
|
1434
|
+
path: options,
|
|
1435
|
+
header: { "idempotency-key": options.idempotencyKey ?? randomUUID() },
|
|
1436
|
+
},
|
|
1437
|
+
}), { rejectWorkspaceReadToken: true });
|
|
1231
1438
|
});
|
|
1232
|
-
workspaceReview
|
|
1233
|
-
|
|
1439
|
+
workspaceReview
|
|
1440
|
+
.command("history")
|
|
1441
|
+
.requiredOption("--workspace-id <workspaceId>")
|
|
1442
|
+
.action(async (options) => {
|
|
1443
|
+
exitCode = await run((client) => client.GET("/v1/workspaces/{workspaceId}/reviews", { params: { path: options } }), { rejectWorkspaceReadToken: true });
|
|
1234
1444
|
});
|
|
1235
|
-
workspaceReview
|
|
1236
|
-
|
|
1445
|
+
workspaceReview
|
|
1446
|
+
.command("read")
|
|
1447
|
+
.requiredOption("--workspace-id <workspaceId>")
|
|
1448
|
+
.requiredOption("--review-id <reviewId>")
|
|
1449
|
+
.action(async (options) => {
|
|
1450
|
+
exitCode = await run((client) => client.GET("/v1/workspaces/{workspaceId}/reviews/{reviewId}", {
|
|
1451
|
+
params: { path: options },
|
|
1452
|
+
}), { rejectWorkspaceReadToken: true });
|
|
1237
1453
|
});
|
|
1238
|
-
workspaceReview
|
|
1239
|
-
|
|
1454
|
+
workspaceReview
|
|
1455
|
+
.command("plan")
|
|
1456
|
+
.requiredOption("--workspace-id <workspaceId>")
|
|
1457
|
+
.action(async (options) => {
|
|
1458
|
+
exitCode = await run((client) => client.GET("/v1/workspaces/{workspaceId}/review-schedule", { params: { path: options } }), { rejectWorkspaceReadToken: true });
|
|
1240
1459
|
});
|
|
1241
|
-
workspaceReview
|
|
1460
|
+
workspaceReview
|
|
1461
|
+
.command("configure")
|
|
1462
|
+
.requiredOption("--workspace-id <workspaceId>")
|
|
1463
|
+
.requiredOption("--expected-version <expectedVersion>", "Opaque version", parseOpaqueVersion)
|
|
1464
|
+
.requiredOption("--input <input>", "Review plan JSON")
|
|
1465
|
+
.action(async (options) => {
|
|
1242
1466
|
const body = reviewPlanInputSchema.parse(JSON.parse(options.input));
|
|
1243
|
-
exitCode = await run(client => client.PUT("/v1/workspaces/{workspaceId}/review-schedule", {
|
|
1467
|
+
exitCode = await run((client) => client.PUT("/v1/workspaces/{workspaceId}/review-schedule", {
|
|
1468
|
+
body,
|
|
1469
|
+
params: { path: options, header: { "if-match": options.expectedVersion } },
|
|
1470
|
+
}), { rejectWorkspaceReadToken: true });
|
|
1244
1471
|
});
|
|
1245
|
-
const notification = program
|
|
1472
|
+
const notification = program
|
|
1473
|
+
.command("notification")
|
|
1474
|
+
.description("Read and manage your personal task notifications");
|
|
1246
1475
|
notification.command("list").action(async () => {
|
|
1247
1476
|
if (hasWorkspaceReadToken(dependencies.environment)) {
|
|
1248
1477
|
exitCode = rejectWorkspaceReadTokenOperation(dependencies);
|
|
@@ -1250,14 +1479,18 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1250
1479
|
}
|
|
1251
1480
|
exitCode = await run((client) => client.GET("/v1/notifications"));
|
|
1252
1481
|
});
|
|
1253
|
-
notification
|
|
1482
|
+
notification
|
|
1483
|
+
.command("create")
|
|
1254
1484
|
.option("--title <title>")
|
|
1255
1485
|
.option("--message <message>")
|
|
1256
1486
|
.option("--type <type>", "Notification type", "info")
|
|
1257
1487
|
.option("--event-data <json>", "JSON object for presentation", parseNotificationEventData)
|
|
1258
1488
|
.option("--related-entity-id <id>", "Public task ID or Workspace ID")
|
|
1259
|
-
.option("--related-entity-type <type>", "task or workspace", (value) => {
|
|
1260
|
-
|
|
1489
|
+
.option("--related-entity-type <type>", "task or workspace", (value) => {
|
|
1490
|
+
if (value !== "task" && value !== "workspace")
|
|
1491
|
+
throw invalidArgument("Notification target must be task or workspace");
|
|
1492
|
+
return value;
|
|
1493
|
+
})
|
|
1261
1494
|
.requiredOption("--idempotency-key <key>", "Reuse the same command key and inputs when retrying", parseNotificationUuid)
|
|
1262
1495
|
.action(async (options) => {
|
|
1263
1496
|
if (hasWorkspaceReadToken(dependencies.environment)) {
|
|
@@ -1266,9 +1499,27 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1266
1499
|
}
|
|
1267
1500
|
if ((options.relatedEntityId === undefined) !== (options.relatedEntityType === undefined))
|
|
1268
1501
|
throw invalidArgument("Notification target identity and type must be provided together");
|
|
1269
|
-
exitCode = await run((client) => client.POST("/v1/notifications", {
|
|
1502
|
+
exitCode = await run((client) => client.POST("/v1/notifications", {
|
|
1503
|
+
body: {
|
|
1504
|
+
type: options.type,
|
|
1505
|
+
...(options.title === undefined ? {} : { title: options.title }),
|
|
1506
|
+
...(options.message === undefined ? {} : { message: options.message }),
|
|
1507
|
+
...(options.eventData === undefined ? {} : { eventData: options.eventData }),
|
|
1508
|
+
...(options.relatedEntityId === undefined
|
|
1509
|
+
? {}
|
|
1510
|
+
: { relatedEntityId: options.relatedEntityId }),
|
|
1511
|
+
...(options.relatedEntityType === undefined
|
|
1512
|
+
? {}
|
|
1513
|
+
: { relatedEntityType: options.relatedEntityType }),
|
|
1514
|
+
},
|
|
1515
|
+
params: { header: { "idempotency-key": options.idempotencyKey } },
|
|
1516
|
+
}), {
|
|
1517
|
+
retryTransportOnce: true,
|
|
1518
|
+
ambiguousOutcomeMessage: "Notification creation outcome is unknown; retry with the same inputs and command key",
|
|
1519
|
+
});
|
|
1270
1520
|
});
|
|
1271
|
-
notification
|
|
1521
|
+
notification
|
|
1522
|
+
.command("read")
|
|
1272
1523
|
.requiredOption("--notification-id <id>", "Notification UUID returned by the list", parseNotificationUuid)
|
|
1273
1524
|
.requiredOption("--idempotency-key <key>", "Reuse the same key when retrying", parseNotificationUuid)
|
|
1274
1525
|
.action(async (options) => {
|
|
@@ -1276,17 +1527,32 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1276
1527
|
exitCode = rejectWorkspaceReadTokenOperation(dependencies);
|
|
1277
1528
|
return;
|
|
1278
1529
|
}
|
|
1279
|
-
exitCode = await run((client) => client.PATCH("/v1/notifications/{notificationId}/read", {
|
|
1530
|
+
exitCode = await run((client) => client.PATCH("/v1/notifications/{notificationId}/read", {
|
|
1531
|
+
params: {
|
|
1532
|
+
path: { notificationId: options.notificationId },
|
|
1533
|
+
header: { "idempotency-key": options.idempotencyKey },
|
|
1534
|
+
},
|
|
1535
|
+
}), {
|
|
1536
|
+
retryTransportOnce: true,
|
|
1537
|
+
ambiguousOutcomeMessage: "Notification read outcome is unknown; retry with the same notification and command key",
|
|
1538
|
+
});
|
|
1280
1539
|
});
|
|
1281
1540
|
for (const action of ["read-all", "clear"]) {
|
|
1282
|
-
notification
|
|
1541
|
+
notification
|
|
1542
|
+
.command(action)
|
|
1543
|
+
.requiredOption("--idempotency-key <key>", "Reuse the same key to avoid changing notifications that arrived after the first command", parseNotificationUuid)
|
|
1283
1544
|
.action(async (options) => {
|
|
1284
1545
|
if (hasWorkspaceReadToken(dependencies.environment)) {
|
|
1285
1546
|
exitCode = rejectWorkspaceReadTokenOperation(dependencies);
|
|
1286
1547
|
return;
|
|
1287
1548
|
}
|
|
1288
1549
|
const params = { header: { "idempotency-key": options.idempotencyKey } };
|
|
1289
|
-
exitCode = await run((client) => action === "read-all"
|
|
1550
|
+
exitCode = await run((client) => action === "read-all"
|
|
1551
|
+
? client.PATCH("/v1/notifications/read", { params })
|
|
1552
|
+
: client.DELETE("/v1/notifications", { params }), {
|
|
1553
|
+
retryTransportOnce: true,
|
|
1554
|
+
ambiguousOutcomeMessage: "Notification bulk command outcome is unknown; retry with the same command key",
|
|
1555
|
+
});
|
|
1290
1556
|
});
|
|
1291
1557
|
}
|
|
1292
1558
|
const notificationPreferences = notification.command("preferences");
|
|
@@ -1297,7 +1563,8 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1297
1563
|
}
|
|
1298
1564
|
exitCode = await run((client) => client.GET("/v1/notification-preferences"));
|
|
1299
1565
|
});
|
|
1300
|
-
notificationPreferences
|
|
1566
|
+
notificationPreferences
|
|
1567
|
+
.command("update")
|
|
1301
1568
|
.requiredOption("--expected-version <version>", "Opaque preference version returned by get")
|
|
1302
1569
|
.requiredOption("--preferences <json>", "JSON category settings; omitted settings remain unchanged", parseNotificationPreferences)
|
|
1303
1570
|
.requiredOption("--idempotency-key <key>", "Reuse the same key and settings when retrying", parseNotificationUuid)
|
|
@@ -1306,50 +1573,129 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1306
1573
|
exitCode = rejectWorkspaceReadTokenOperation(dependencies);
|
|
1307
1574
|
return;
|
|
1308
1575
|
}
|
|
1309
|
-
exitCode = await run((client) => client.PATCH("/v1/notification-preferences", {
|
|
1576
|
+
exitCode = await run((client) => client.PATCH("/v1/notification-preferences", {
|
|
1577
|
+
body: options.preferences,
|
|
1578
|
+
params: {
|
|
1579
|
+
header: {
|
|
1580
|
+
"idempotency-key": options.idempotencyKey,
|
|
1581
|
+
"if-match": options.expectedVersion,
|
|
1582
|
+
},
|
|
1583
|
+
},
|
|
1584
|
+
}), {
|
|
1585
|
+
retryTransportOnce: true,
|
|
1586
|
+
ambiguousOutcomeMessage: "Notification preference outcome is unknown; retry with the same settings and command key",
|
|
1587
|
+
});
|
|
1310
1588
|
});
|
|
1311
1589
|
const workItem = program.command("work-item");
|
|
1312
|
-
registerWorkItemAssetCommands(workItem, {
|
|
1313
|
-
|
|
1590
|
+
registerWorkItemAssetCommands(workItem, {
|
|
1591
|
+
dependencies,
|
|
1592
|
+
run,
|
|
1593
|
+
setExitCode: (value) => {
|
|
1594
|
+
exitCode = value;
|
|
1595
|
+
},
|
|
1596
|
+
rejectWrite: () => rejectTokenWrite(dependencies),
|
|
1597
|
+
});
|
|
1598
|
+
const resourceRuntime = {
|
|
1599
|
+
run,
|
|
1600
|
+
setExitCode: (value) => {
|
|
1601
|
+
exitCode = value;
|
|
1602
|
+
},
|
|
1603
|
+
parseOpaqueVersion,
|
|
1604
|
+
parseLimit: parseSearchLimit,
|
|
1605
|
+
};
|
|
1314
1606
|
registerSpecOwnerCommands(spec, resourceRuntime);
|
|
1315
1607
|
registerSpecDiscussionCommands(spec, resourceRuntime);
|
|
1316
1608
|
registerProjectAdministrationCommands(project, workspace, resourceRuntime);
|
|
1317
|
-
program
|
|
1609
|
+
program
|
|
1610
|
+
.command("search-global")
|
|
1611
|
+
.description("Search all currently accessible objects; preserves server totals and cursor")
|
|
1318
1612
|
.requiredOption("--query <query>")
|
|
1319
1613
|
.option("--types <types>", "Comma-separated kinds: project,work-item,capability,spec,glossary,screen,journey,user")
|
|
1320
1614
|
.option("--limit <limit>", "Server page size (1–100)", resourceRuntime.parseLimit, 20)
|
|
1321
1615
|
.option("--cursor <cursor>")
|
|
1322
1616
|
.action(async (options) => {
|
|
1323
|
-
resourceRuntime.setExitCode(await resourceRuntime.run(client => client.GET("/v1/search", {
|
|
1324
|
-
params: {
|
|
1617
|
+
resourceRuntime.setExitCode(await resourceRuntime.run((client) => client.GET("/v1/search", {
|
|
1618
|
+
params: {
|
|
1619
|
+
query: {
|
|
1620
|
+
query: options.query,
|
|
1621
|
+
limit: options.limit,
|
|
1622
|
+
...(options.cursor === undefined ? {} : { cursor: options.cursor }),
|
|
1623
|
+
...(options.types === undefined ? {} : { types: options.types }),
|
|
1624
|
+
},
|
|
1625
|
+
},
|
|
1325
1626
|
}), { rejectWorkspaceReadToken: true }));
|
|
1326
1627
|
});
|
|
1327
1628
|
registerWorkItemQueryCommands(workItem, workspace, resourceRuntime);
|
|
1328
1629
|
registerWorkItemDeliveryCommands(workItem, project, resourceRuntime);
|
|
1329
|
-
registerProductMapCommands(program, {
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1630
|
+
registerProductMapCommands(program, {
|
|
1631
|
+
dependencies,
|
|
1632
|
+
run,
|
|
1633
|
+
setExitCode: (value) => {
|
|
1634
|
+
exitCode = value;
|
|
1635
|
+
},
|
|
1636
|
+
canWrite: () => !hasWorkspaceReadToken(dependencies.environment),
|
|
1637
|
+
rejectWrite: () => rejectTokenWrite(dependencies),
|
|
1638
|
+
parseOpaqueVersion,
|
|
1639
|
+
});
|
|
1640
|
+
registerWorkItemResourceLinkCommands(workItem, spec, {
|
|
1641
|
+
run,
|
|
1642
|
+
setExitCode: (value) => {
|
|
1643
|
+
exitCode = value;
|
|
1644
|
+
},
|
|
1645
|
+
canWrite: () => !hasWorkspaceReadToken(dependencies.environment),
|
|
1646
|
+
rejectWrite: () => rejectTokenWrite(dependencies),
|
|
1647
|
+
parseOpaqueVersion,
|
|
1648
|
+
parseLimit: parseSearchLimit,
|
|
1649
|
+
});
|
|
1650
|
+
registerWorkItemWatcherCommands(workItem, {
|
|
1651
|
+
run,
|
|
1652
|
+
setExitCode: (value) => {
|
|
1653
|
+
exitCode = value;
|
|
1654
|
+
},
|
|
1655
|
+
canWrite: () => !hasWorkspaceReadToken(dependencies.environment),
|
|
1656
|
+
rejectWrite: () => rejectTokenWrite(dependencies),
|
|
1657
|
+
});
|
|
1658
|
+
registerWorkItemThreadCommands(workItem, resourceRuntime);
|
|
1659
|
+
const workItemComment = workItem
|
|
1660
|
+
.command("comment")
|
|
1661
|
+
.description("Read and manage authored task comments");
|
|
1662
|
+
workItemComment
|
|
1663
|
+
.command("list")
|
|
1333
1664
|
.requiredOption("--project-id <projectId>")
|
|
1334
1665
|
.requiredOption("--work-item-id <workItemId>")
|
|
1335
1666
|
.option("--limit <limit>", "Maximum results, 1 through 100", parseSearchLimit, 50)
|
|
1336
1667
|
.option("--cursor <cursor>", "Opaque cursor returned by the previous page")
|
|
1337
1668
|
.action(async (options) => {
|
|
1338
1669
|
exitCode = await run((client) => client.GET("/v1/projects/{projectId}/work-items/{workItemId}/comments", {
|
|
1339
|
-
params: {
|
|
1670
|
+
params: {
|
|
1671
|
+
path: { projectId: options.projectId, workItemId: options.workItemId },
|
|
1672
|
+
query: {
|
|
1673
|
+
limit: options.limit,
|
|
1674
|
+
...(options.cursor === undefined ? {} : { cursor: options.cursor }),
|
|
1675
|
+
},
|
|
1676
|
+
},
|
|
1340
1677
|
}));
|
|
1341
1678
|
});
|
|
1342
|
-
workItem
|
|
1679
|
+
workItem
|
|
1680
|
+
.command("discussion")
|
|
1681
|
+
.description("Read comments and immutable activity newest first")
|
|
1343
1682
|
.requiredOption("--project-id <projectId>")
|
|
1344
1683
|
.requiredOption("--work-item-id <workItemId>")
|
|
1345
1684
|
.option("--limit <limit>", "Maximum results, 1 through 100", parseSearchLimit, 50)
|
|
1346
1685
|
.option("--cursor <cursor>", "Opaque cursor returned by the previous page")
|
|
1347
1686
|
.action(async (options) => {
|
|
1348
1687
|
exitCode = await run((client) => client.GET("/v1/projects/{projectId}/work-items/{workItemId}/discussion", {
|
|
1349
|
-
params: {
|
|
1688
|
+
params: {
|
|
1689
|
+
path: { projectId: options.projectId, workItemId: options.workItemId },
|
|
1690
|
+
query: {
|
|
1691
|
+
limit: options.limit,
|
|
1692
|
+
...(options.cursor === undefined ? {} : { cursor: options.cursor }),
|
|
1693
|
+
},
|
|
1694
|
+
},
|
|
1350
1695
|
}));
|
|
1351
1696
|
});
|
|
1352
|
-
workItemComment
|
|
1697
|
+
workItemComment
|
|
1698
|
+
.command("create")
|
|
1353
1699
|
.requiredOption("--project-id <projectId>")
|
|
1354
1700
|
.requiredOption("--work-item-id <workItemId>")
|
|
1355
1701
|
.requiredOption("--content <markdown>", "Markdown comment body, up to 20000 characters", parseCommentContent)
|
|
@@ -1361,10 +1707,17 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1361
1707
|
}
|
|
1362
1708
|
exitCode = await run((client) => client.POST("/v1/projects/{projectId}/work-items/{workItemId}/comments", {
|
|
1363
1709
|
body: { content: options.content },
|
|
1364
|
-
params: {
|
|
1365
|
-
|
|
1710
|
+
params: {
|
|
1711
|
+
path: { projectId: options.projectId, workItemId: options.workItemId },
|
|
1712
|
+
header: { "idempotency-key": options.idempotencyKey },
|
|
1713
|
+
},
|
|
1714
|
+
}), {
|
|
1715
|
+
retryTransportOnce: true,
|
|
1716
|
+
ambiguousOutcomeMessage: "Comment creation outcome is unknown; retry with the same inputs and command key",
|
|
1717
|
+
});
|
|
1366
1718
|
});
|
|
1367
|
-
workItemComment
|
|
1719
|
+
workItemComment
|
|
1720
|
+
.command("update")
|
|
1368
1721
|
.requiredOption("--project-id <projectId>")
|
|
1369
1722
|
.requiredOption("--work-item-id <workItemId>")
|
|
1370
1723
|
.requiredOption("--comment-id <commentId>", "Identifier returned by comments", parseCommentId)
|
|
@@ -1378,11 +1731,24 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1378
1731
|
}
|
|
1379
1732
|
exitCode = await run((client) => client.PATCH("/v1/projects/{projectId}/work-items/{workItemId}/comments/{commentId}", {
|
|
1380
1733
|
body: { content: options.content },
|
|
1381
|
-
params: {
|
|
1382
|
-
|
|
1383
|
-
|
|
1734
|
+
params: {
|
|
1735
|
+
path: {
|
|
1736
|
+
projectId: options.projectId,
|
|
1737
|
+
workItemId: options.workItemId,
|
|
1738
|
+
commentId: options.commentId,
|
|
1739
|
+
},
|
|
1740
|
+
header: {
|
|
1741
|
+
"idempotency-key": options.idempotencyKey,
|
|
1742
|
+
"if-match": options.expectedVersion,
|
|
1743
|
+
},
|
|
1744
|
+
},
|
|
1745
|
+
}), {
|
|
1746
|
+
retryTransportOnce: true,
|
|
1747
|
+
ambiguousOutcomeMessage: "Comment edit outcome is unknown; reread the comment or retry the same inputs and command key",
|
|
1748
|
+
});
|
|
1384
1749
|
});
|
|
1385
|
-
workItemComment
|
|
1750
|
+
workItemComment
|
|
1751
|
+
.command("delete")
|
|
1386
1752
|
.requiredOption("--project-id <projectId>")
|
|
1387
1753
|
.requiredOption("--work-item-id <workItemId>")
|
|
1388
1754
|
.requiredOption("--comment-id <commentId>", "Identifier returned by comments", parseCommentId)
|
|
@@ -1394,41 +1760,93 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1394
1760
|
return;
|
|
1395
1761
|
}
|
|
1396
1762
|
exitCode = await run((client) => client.DELETE("/v1/projects/{projectId}/work-items/{workItemId}/comments/{commentId}", {
|
|
1397
|
-
params: {
|
|
1398
|
-
|
|
1399
|
-
|
|
1763
|
+
params: {
|
|
1764
|
+
path: {
|
|
1765
|
+
projectId: options.projectId,
|
|
1766
|
+
workItemId: options.workItemId,
|
|
1767
|
+
commentId: options.commentId,
|
|
1768
|
+
},
|
|
1769
|
+
header: {
|
|
1770
|
+
"idempotency-key": options.idempotencyKey,
|
|
1771
|
+
"if-match": options.expectedVersion,
|
|
1772
|
+
},
|
|
1773
|
+
},
|
|
1774
|
+
}), {
|
|
1775
|
+
retryTransportOnce: true,
|
|
1776
|
+
ambiguousOutcomeMessage: "Comment deletion outcome is unknown; reread the comment or retry the same inputs and command key",
|
|
1777
|
+
});
|
|
1400
1778
|
});
|
|
1401
|
-
const workItemRelation = workItem
|
|
1402
|
-
|
|
1779
|
+
const workItemRelation = workItem
|
|
1780
|
+
.command("relation")
|
|
1781
|
+
.description("Manage subtask, blocking and related task links");
|
|
1782
|
+
workItemRelation
|
|
1783
|
+
.command("list")
|
|
1403
1784
|
.requiredOption("--project-id <projectId>")
|
|
1404
1785
|
.requiredOption("--work-item-id <workItemId>")
|
|
1405
1786
|
.action(async (options) => {
|
|
1406
|
-
exitCode = await run((client) => client.GET("/v1/projects/{projectId}/work-items/{workItemId}/relations", {
|
|
1787
|
+
exitCode = await run((client) => client.GET("/v1/projects/{projectId}/work-items/{workItemId}/relations", {
|
|
1788
|
+
params: { path: options },
|
|
1789
|
+
}), { project: (data) => relationListOutput(data, outputMode, warnMissingUrl) });
|
|
1407
1790
|
});
|
|
1408
|
-
workItemRelation
|
|
1791
|
+
workItemRelation
|
|
1792
|
+
.command("create")
|
|
1409
1793
|
.addHelpText("after", "\nExample: specflow work-item relation create --project-id PROJECT --work-item-id GON-78 --target-project-id PROJECT --target-work-item-id GON-79 --type subtask --idempotency-key KEY\n")
|
|
1410
1794
|
.requiredOption("--project-id <projectId>")
|
|
1411
1795
|
.requiredOption("--work-item-id <workItemId>")
|
|
1412
1796
|
.requiredOption("--target-project-id <projectId>", "Target task's current Project", parseProjectId)
|
|
1413
1797
|
.requiredOption("--target-work-item-id <workItemId>", "Target task's public identity", parseWorkItemId)
|
|
1414
|
-
.
|
|
1415
|
-
const result = z.enum(["subtask", "blocks", "related"]).safeParse(value);
|
|
1798
|
+
.option("--type <type>", "subtask (source=parent, target=child), blocks, related or duplicate", (value) => {
|
|
1799
|
+
const result = z.enum(["subtask", "blocks", "related", "duplicate"]).safeParse(value);
|
|
1800
|
+
if (!result.success)
|
|
1801
|
+
throw invalidArgument("Relation type must be subtask, blocks, related or duplicate");
|
|
1802
|
+
return result.data;
|
|
1803
|
+
})
|
|
1804
|
+
.option("--direction <direction>", "Direction from the current task: related, subtask, parent, blocks or blocked-by", (value) => {
|
|
1805
|
+
const result = z
|
|
1806
|
+
.enum(["related", "subtask", "parent", "blocks", "blocked-by"])
|
|
1807
|
+
.safeParse(value);
|
|
1416
1808
|
if (!result.success)
|
|
1417
|
-
throw invalidArgument("
|
|
1809
|
+
throw invalidArgument("Invalid relation direction");
|
|
1418
1810
|
return result.data;
|
|
1419
1811
|
})
|
|
1812
|
+
.option("--replace-parent", "Replace the existing parent when linking a subtask")
|
|
1420
1813
|
.requiredOption("--idempotency-key <key>", "Reuse the same key and inputs when retrying", parseRelationCommandKey)
|
|
1421
1814
|
.action(async (options) => {
|
|
1422
1815
|
if (hasWorkspaceReadToken(dependencies.environment)) {
|
|
1423
1816
|
exitCode = rejectTokenWrite(dependencies);
|
|
1424
1817
|
return;
|
|
1425
1818
|
}
|
|
1819
|
+
if (options.direction === undefined && options.type === undefined)
|
|
1820
|
+
throw invalidArgument("Provide --type or --direction");
|
|
1821
|
+
const relationBody = options.direction === undefined
|
|
1822
|
+
? options.type === undefined
|
|
1823
|
+
? (() => {
|
|
1824
|
+
throw invalidArgument("Provide --type or --direction");
|
|
1825
|
+
})()
|
|
1826
|
+
: { relationType: options.type }
|
|
1827
|
+
: { direction: options.direction };
|
|
1426
1828
|
exitCode = await run((client) => client.POST("/v1/projects/{projectId}/work-items/{workItemId}/relations", {
|
|
1427
|
-
body: {
|
|
1428
|
-
|
|
1429
|
-
|
|
1829
|
+
body: {
|
|
1830
|
+
targetProjectId: options.targetProjectId,
|
|
1831
|
+
targetWorkItemId: options.targetWorkItemId,
|
|
1832
|
+
...relationBody,
|
|
1833
|
+
...(options.replaceParent === undefined
|
|
1834
|
+
? {}
|
|
1835
|
+
: { replaceParent: options.replaceParent }),
|
|
1836
|
+
},
|
|
1837
|
+
params: {
|
|
1838
|
+
path: { projectId: options.projectId, workItemId: options.workItemId },
|
|
1839
|
+
header: { "idempotency-key": options.idempotencyKey },
|
|
1840
|
+
},
|
|
1841
|
+
}), {
|
|
1842
|
+
project: (data) => relationReceiptOutput(data, outputMode, warnMissingUrl),
|
|
1843
|
+
retryTransportOnce: true,
|
|
1844
|
+
ambiguousOutcomeMessage: "Relation creation outcome is unknown; retry with the same inputs and command key",
|
|
1845
|
+
});
|
|
1430
1846
|
});
|
|
1431
|
-
workItem
|
|
1847
|
+
workItem
|
|
1848
|
+
.command("subtask")
|
|
1849
|
+
.command("link")
|
|
1432
1850
|
.description("Link parent (source) to child (target), including across Projects")
|
|
1433
1851
|
.requiredOption("--project-id <projectId>", "Parent Project")
|
|
1434
1852
|
.requiredOption("--parent <workItemId>", "Parent public Work Item ID", parseWorkItemId)
|
|
@@ -1440,12 +1858,24 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1440
1858
|
exitCode = rejectTokenWrite(dependencies);
|
|
1441
1859
|
return;
|
|
1442
1860
|
}
|
|
1443
|
-
exitCode = await run(client => client.POST("/v1/projects/{projectId}/work-items/{workItemId}/relations", {
|
|
1444
|
-
body: {
|
|
1445
|
-
|
|
1446
|
-
|
|
1861
|
+
exitCode = await run((client) => client.POST("/v1/projects/{projectId}/work-items/{workItemId}/relations", {
|
|
1862
|
+
body: {
|
|
1863
|
+
relationType: "subtask",
|
|
1864
|
+
targetProjectId: options.childProjectId ?? options.projectId,
|
|
1865
|
+
targetWorkItemId: options.child,
|
|
1866
|
+
},
|
|
1867
|
+
params: {
|
|
1868
|
+
path: { projectId: options.projectId, workItemId: options.parent },
|
|
1869
|
+
header: { "idempotency-key": options.idempotencyKey },
|
|
1870
|
+
},
|
|
1871
|
+
}), {
|
|
1872
|
+
retryTransportOnce: true,
|
|
1873
|
+
project: (data) => relationReceiptOutput(data, outputMode, warnMissingUrl),
|
|
1874
|
+
ambiguousOutcomeMessage: "Relation creation outcome is unknown; retry with the same inputs and command key",
|
|
1875
|
+
});
|
|
1447
1876
|
});
|
|
1448
|
-
workItemRelation
|
|
1877
|
+
workItemRelation
|
|
1878
|
+
.command("delete")
|
|
1449
1879
|
.requiredOption("--project-id <projectId>")
|
|
1450
1880
|
.requiredOption("--work-item-id <workItemId>")
|
|
1451
1881
|
.requiredOption("--peer-project-id <projectId>", "Other endpoint's current Project", parseProjectId)
|
|
@@ -1462,9 +1892,83 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1462
1892
|
return;
|
|
1463
1893
|
}
|
|
1464
1894
|
exitCode = await run((client) => client.DELETE("/v1/projects/{projectId}/work-items/{workItemId}/relations/{relationId}", {
|
|
1465
|
-
params: {
|
|
1466
|
-
|
|
1467
|
-
|
|
1895
|
+
params: {
|
|
1896
|
+
path: {
|
|
1897
|
+
projectId: options.projectId,
|
|
1898
|
+
workItemId: options.workItemId,
|
|
1899
|
+
relationId: options.relationId,
|
|
1900
|
+
},
|
|
1901
|
+
query: { peerProjectId: options.peerProjectId },
|
|
1902
|
+
header: {
|
|
1903
|
+
"idempotency-key": options.idempotencyKey,
|
|
1904
|
+
"if-match": options.expectedVersion,
|
|
1905
|
+
},
|
|
1906
|
+
},
|
|
1907
|
+
}), {
|
|
1908
|
+
retryTransportOnce: true,
|
|
1909
|
+
ambiguousOutcomeMessage: "Relation removal outcome is unknown; retry with the same inputs and command key",
|
|
1910
|
+
});
|
|
1911
|
+
});
|
|
1912
|
+
workItemRelation
|
|
1913
|
+
.command("duplicate")
|
|
1914
|
+
.description("Mark or cancel a duplicate Work Item mark")
|
|
1915
|
+
.command("mark")
|
|
1916
|
+
.requiredOption("--project-id <projectId>")
|
|
1917
|
+
.requiredOption("--work-item-id <workItemId>")
|
|
1918
|
+
.requiredOption("--target-project-id <projectId>", "Project containing the retained task")
|
|
1919
|
+
.requiredOption("--target-work-item-id <workItemId>", "Retained task public identity", parseWorkItemId)
|
|
1920
|
+
.requiredOption("--expected-version <expectedVersion>", "Current task version", parseOpaqueVersion)
|
|
1921
|
+
.requiredOption("--idempotency-key <key>", "Reuse the same key and inputs when retrying", parseRelationCommandKey)
|
|
1922
|
+
.action(async (options) => {
|
|
1923
|
+
if (hasWorkspaceReadToken(dependencies.environment)) {
|
|
1924
|
+
exitCode = rejectTokenWrite(dependencies);
|
|
1925
|
+
return;
|
|
1926
|
+
}
|
|
1927
|
+
const expectedVersion = Number(options.expectedVersion);
|
|
1928
|
+
if (!Number.isInteger(expectedVersion) || expectedVersion < 1)
|
|
1929
|
+
throw invalidArgument("Expected version must be a positive integer");
|
|
1930
|
+
exitCode = await run((client) => client.POST("/v1/projects/{projectId}/work-items/{workItemId}/relations/duplicate", {
|
|
1931
|
+
body: {
|
|
1932
|
+
targetProjectId: options.targetProjectId,
|
|
1933
|
+
targetWorkItemId: options.targetWorkItemId,
|
|
1934
|
+
expectedVersion,
|
|
1935
|
+
},
|
|
1936
|
+
params: {
|
|
1937
|
+
path: { projectId: options.projectId, workItemId: options.workItemId },
|
|
1938
|
+
header: { "idempotency-key": options.idempotencyKey },
|
|
1939
|
+
},
|
|
1940
|
+
}), {
|
|
1941
|
+
project: (data) => itemOutput(data, outputMode, warnMissingUrl),
|
|
1942
|
+
retryTransportOnce: true,
|
|
1943
|
+
ambiguousOutcomeMessage: "Duplicate mark outcome is unknown; retry with the same inputs and command key",
|
|
1944
|
+
});
|
|
1945
|
+
});
|
|
1946
|
+
workItemRelation
|
|
1947
|
+
.command("duplicate-cancel")
|
|
1948
|
+
.description("Cancel a duplicate Work Item mark")
|
|
1949
|
+
.requiredOption("--project-id <projectId>")
|
|
1950
|
+
.requiredOption("--work-item-id <workItemId>")
|
|
1951
|
+
.requiredOption("--expected-version <expectedVersion>", "Current task version", parseOpaqueVersion)
|
|
1952
|
+
.requiredOption("--idempotency-key <key>", "Reuse the same key and inputs when retrying", parseRelationCommandKey)
|
|
1953
|
+
.action(async (options) => {
|
|
1954
|
+
if (hasWorkspaceReadToken(dependencies.environment)) {
|
|
1955
|
+
exitCode = rejectTokenWrite(dependencies);
|
|
1956
|
+
return;
|
|
1957
|
+
}
|
|
1958
|
+
const expectedVersion = Number(options.expectedVersion);
|
|
1959
|
+
if (!Number.isInteger(expectedVersion) || expectedVersion < 1)
|
|
1960
|
+
throw invalidArgument("Expected version must be a positive integer");
|
|
1961
|
+
exitCode = await run((client) => client.DELETE("/v1/projects/{projectId}/work-items/{workItemId}/relations/duplicate", {
|
|
1962
|
+
params: {
|
|
1963
|
+
path: { projectId: options.projectId, workItemId: options.workItemId },
|
|
1964
|
+
query: { expectedVersion },
|
|
1965
|
+
header: { "idempotency-key": options.idempotencyKey },
|
|
1966
|
+
},
|
|
1967
|
+
}), {
|
|
1968
|
+
project: (data) => itemOutput(data, outputMode, warnMissingUrl),
|
|
1969
|
+
retryTransportOnce: true,
|
|
1970
|
+
ambiguousOutcomeMessage: "Duplicate cancellation outcome is unknown; retry with the same inputs and command key",
|
|
1971
|
+
});
|
|
1468
1972
|
});
|
|
1469
1973
|
workItemCompletedFlag(workItemSelectionFlags(workItem.command("list")))
|
|
1470
1974
|
.requiredOption("--project-id <projectId>")
|
|
@@ -1483,16 +1987,12 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1483
1987
|
query: {
|
|
1484
1988
|
...workItemSelectionQuery(options),
|
|
1485
1989
|
...(options.completed === undefined ? {} : { completed: options.completed }),
|
|
1486
|
-
...(options.cursor === undefined
|
|
1487
|
-
|
|
1488
|
-
: { cursor: options.cursor }),
|
|
1489
|
-
...(options.groupBy === undefined
|
|
1490
|
-
? {}
|
|
1491
|
-
: { groupBy: options.groupBy }),
|
|
1990
|
+
...(options.cursor === undefined ? {} : { cursor: options.cursor }),
|
|
1991
|
+
...(options.groupBy === undefined ? {} : { groupBy: options.groupBy }),
|
|
1492
1992
|
limit: options.limit,
|
|
1493
1993
|
},
|
|
1494
1994
|
},
|
|
1495
|
-
}), { project: data => itemListOutput(data, outputMode, warnMissingUrl) });
|
|
1995
|
+
}), { project: (data) => itemListOutput(data, outputMode, warnMissingUrl) });
|
|
1496
1996
|
});
|
|
1497
1997
|
workItem
|
|
1498
1998
|
.command("read")
|
|
@@ -1501,7 +2001,7 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1501
2001
|
.action(async (options) => {
|
|
1502
2002
|
exitCode = await run((client) => client.GET("/v1/projects/{projectId}/work-items/{workItemId}", {
|
|
1503
2003
|
params: { path: options },
|
|
1504
|
-
}), { project: data => itemOutput(data, outputMode, warnMissingUrl) });
|
|
2004
|
+
}), { project: (data) => itemOutput(data, outputMode, warnMissingUrl) });
|
|
1505
2005
|
});
|
|
1506
2006
|
workItem
|
|
1507
2007
|
.command("assignees")
|
|
@@ -1524,40 +2024,67 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1524
2024
|
.option("--start-date <startDate>", "ISO 8601 date", parseWorkItemDate)
|
|
1525
2025
|
.option("--due-date <dueDate>", "ISO 8601 date", parseWorkItemDate)
|
|
1526
2026
|
.option("--status <status>", "Workflow Column slug or virtual status to create the Work Item in")
|
|
2027
|
+
.option("--relation-direction <direction>", "Create one relation atomically: related, subtask, parent, blocks or blocked-by", (value) => {
|
|
2028
|
+
const result = z
|
|
2029
|
+
.enum(["related", "subtask", "parent", "blocks", "blocked-by"])
|
|
2030
|
+
.safeParse(value);
|
|
2031
|
+
if (!result.success)
|
|
2032
|
+
throw invalidArgument("Invalid relation direction");
|
|
2033
|
+
return result.data;
|
|
2034
|
+
})
|
|
2035
|
+
.option("--relation-target-project-id <projectId>", "Project containing the related task")
|
|
2036
|
+
.option("--relation-target-work-item-id <workItemId>", "Public identity of the related task", parseWorkItemId)
|
|
2037
|
+
.option("--replace-parent", "Replace an existing parent when creating a subtask relation")
|
|
2038
|
+
.option("--initial-watcher-ids <json>", "Initial watcher User IDs as a JSON array; [] explicitly mutes the creator", (value) => parseStringArray(value, "initial-watcher-ids"))
|
|
1527
2039
|
.action(async (options) => {
|
|
1528
2040
|
const description = (await readDescription(options)) ?? undefined;
|
|
1529
2041
|
if (hasWorkspaceReadToken(dependencies.environment)) {
|
|
1530
2042
|
exitCode = rejectTokenWrite(dependencies);
|
|
1531
2043
|
return;
|
|
1532
2044
|
}
|
|
2045
|
+
const relationFlags = [
|
|
2046
|
+
options.relationDirection,
|
|
2047
|
+
options.relationTargetProjectId,
|
|
2048
|
+
options.relationTargetWorkItemId,
|
|
2049
|
+
];
|
|
2050
|
+
if (relationFlags.some((value) => value !== undefined) &&
|
|
2051
|
+
relationFlags.some((value) => value === undefined))
|
|
2052
|
+
throw invalidArgument("Atomic relation creation requires --relation-direction, --relation-target-project-id and --relation-target-work-item-id together");
|
|
2053
|
+
const relation = options.relationDirection === undefined
|
|
2054
|
+
? undefined
|
|
2055
|
+
: options.relationTargetProjectId === undefined ||
|
|
2056
|
+
options.relationTargetWorkItemId === undefined
|
|
2057
|
+
? (() => {
|
|
2058
|
+
throw invalidArgument("Atomic relation creation requires a relation target");
|
|
2059
|
+
})()
|
|
2060
|
+
: {
|
|
2061
|
+
direction: options.relationDirection,
|
|
2062
|
+
targetProjectId: options.relationTargetProjectId,
|
|
2063
|
+
targetWorkItemId: options.relationTargetWorkItemId,
|
|
2064
|
+
...(options.replaceParent === undefined
|
|
2065
|
+
? {}
|
|
2066
|
+
: { replaceParent: options.replaceParent }),
|
|
2067
|
+
};
|
|
1533
2068
|
const customFields = options.customField.map(parseCustomFieldAssignment);
|
|
1534
2069
|
const idempotencyKey = randomUUID();
|
|
1535
2070
|
exitCode = await run((client, me) => client.POST("/v1/projects/{projectId}/work-items", {
|
|
1536
2071
|
body: {
|
|
1537
|
-
...(options.assignee === undefined
|
|
1538
|
-
? {}
|
|
1539
|
-
: { assigneeId: me ?? options.assignee }),
|
|
2072
|
+
...(options.assignee === undefined ? {} : { assigneeId: me ?? options.assignee }),
|
|
1540
2073
|
...(options.customField.length === 0
|
|
1541
2074
|
? {}
|
|
1542
2075
|
: {
|
|
1543
2076
|
customFields,
|
|
1544
2077
|
}),
|
|
1545
|
-
...(description === undefined
|
|
1546
|
-
? {}
|
|
1547
|
-
: { description }),
|
|
2078
|
+
...(description === undefined ? {} : { description }),
|
|
1548
2079
|
...(options.label.length === 0 ? {} : { labelIds: [...new Set(options.label)] }),
|
|
1549
|
-
...(options.
|
|
1550
|
-
? {}
|
|
1551
|
-
: { dueDate: options.dueDate }),
|
|
1552
|
-
...(options.priority === undefined
|
|
1553
|
-
? {}
|
|
1554
|
-
: { priority: options.priority }),
|
|
1555
|
-
...(options.startDate === undefined
|
|
2080
|
+
...(options.initialWatcherIds === undefined
|
|
1556
2081
|
? {}
|
|
1557
|
-
: {
|
|
1558
|
-
...(options.
|
|
1559
|
-
|
|
1560
|
-
|
|
2082
|
+
: { initialWatcherIds: options.initialWatcherIds }),
|
|
2083
|
+
...(options.dueDate === undefined ? {} : { dueDate: options.dueDate }),
|
|
2084
|
+
...(options.priority === undefined ? {} : { priority: options.priority }),
|
|
2085
|
+
...(options.startDate === undefined ? {} : { startDate: options.startDate }),
|
|
2086
|
+
...(options.status === undefined ? {} : { status: options.status }),
|
|
2087
|
+
...(relation === undefined ? {} : { relation }),
|
|
1561
2088
|
title: options.title,
|
|
1562
2089
|
},
|
|
1563
2090
|
params: {
|
|
@@ -1566,7 +2093,7 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1566
2093
|
},
|
|
1567
2094
|
}), {
|
|
1568
2095
|
resolveMe: options.assignee === "me",
|
|
1569
|
-
project: data => itemOutput(data, outputMode, warnMissingUrl),
|
|
2096
|
+
project: (data) => itemOutput(data, outputMode, warnMissingUrl),
|
|
1570
2097
|
ambiguousOutcomeMessage: "Work Item creation outcome is unknown; list Work Items before retrying",
|
|
1571
2098
|
retryTransportOnce: true,
|
|
1572
2099
|
});
|
|
@@ -1625,12 +2152,8 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1625
2152
|
: options.startDate === undefined
|
|
1626
2153
|
? {}
|
|
1627
2154
|
: { startDate: options.startDate }),
|
|
1628
|
-
...(options.priority === undefined
|
|
1629
|
-
|
|
1630
|
-
: { priority: options.priority }),
|
|
1631
|
-
...(options.title === undefined
|
|
1632
|
-
? {}
|
|
1633
|
-
: { title: options.title }),
|
|
2155
|
+
...(options.priority === undefined ? {} : { priority: options.priority }),
|
|
2156
|
+
...(options.title === undefined ? {} : { title: options.title }),
|
|
1634
2157
|
},
|
|
1635
2158
|
params: {
|
|
1636
2159
|
header: {
|
|
@@ -1643,7 +2166,7 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1643
2166
|
},
|
|
1644
2167
|
},
|
|
1645
2168
|
}), {
|
|
1646
|
-
project: data => itemOutput(data, outputMode, warnMissingUrl),
|
|
2169
|
+
project: (data) => itemOutput(data, outputMode, warnMissingUrl),
|
|
1647
2170
|
ambiguousOutcomeMessage: "Work Item update outcome is unknown; read the Work Item before retrying",
|
|
1648
2171
|
retryTransportOnce: true,
|
|
1649
2172
|
});
|
|
@@ -1683,7 +2206,7 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1683
2206
|
},
|
|
1684
2207
|
}), {
|
|
1685
2208
|
resolveMe: options.assignee === "me",
|
|
1686
|
-
project: data => itemOutput(data, outputMode, warnMissingUrl),
|
|
2209
|
+
project: (data) => itemOutput(data, outputMode, warnMissingUrl),
|
|
1687
2210
|
ambiguousOutcomeMessage: "Work Item assignment outcome is unknown; read the Work Item before retrying",
|
|
1688
2211
|
retryTransportOnce: true,
|
|
1689
2212
|
});
|
|
@@ -1721,7 +2244,10 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1721
2244
|
exitCode = await run((client) => client.GET("/v1/projects/{projectId}/work-item-board", {
|
|
1722
2245
|
params: {
|
|
1723
2246
|
path: { projectId: options.projectId },
|
|
1724
|
-
query: {
|
|
2247
|
+
query: {
|
|
2248
|
+
...workItemSelectionQuery(options),
|
|
2249
|
+
...(options.completed === undefined ? {} : { completed: options.completed }),
|
|
2250
|
+
},
|
|
1725
2251
|
},
|
|
1726
2252
|
}));
|
|
1727
2253
|
});
|
|
@@ -1779,17 +2305,14 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1779
2305
|
? {}
|
|
1780
2306
|
: { dueDate: options.dueDate }
|
|
1781
2307
|
: {}),
|
|
1782
|
-
...((options.action === "addLabel" ||
|
|
1783
|
-
options.action === "removeLabel") &&
|
|
2308
|
+
...((options.action === "addLabel" || options.action === "removeLabel") &&
|
|
1784
2309
|
options.labelId !== undefined
|
|
1785
2310
|
? { labelId: options.labelId }
|
|
1786
2311
|
: {}),
|
|
1787
|
-
...(options.action === "updatePriority" &&
|
|
1788
|
-
options.priority !== undefined
|
|
2312
|
+
...(options.action === "updatePriority" && options.priority !== undefined
|
|
1789
2313
|
? { priority: options.priority }
|
|
1790
2314
|
: {}),
|
|
1791
|
-
...(options.action === "updateStatus" &&
|
|
1792
|
-
options.status !== undefined
|
|
2315
|
+
...(options.action === "updateStatus" && options.status !== undefined
|
|
1793
2316
|
? { status: options.status }
|
|
1794
2317
|
: {}),
|
|
1795
2318
|
workItems: options.target.map((target) => ({
|
|
@@ -1826,7 +2349,8 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1826
2349
|
if (body === null) {
|
|
1827
2350
|
writeSkillError(dependencies, {
|
|
1828
2351
|
message: "The import file must be valid task JSON within 1 MiB and 1000 tasks",
|
|
1829
|
-
reason: "Invalid Operation",
|
|
2352
|
+
reason: "Invalid Operation",
|
|
2353
|
+
retryable: false,
|
|
1830
2354
|
});
|
|
1831
2355
|
exitCode = 2;
|
|
1832
2356
|
return;
|
|
@@ -1834,7 +2358,11 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1834
2358
|
let failed = 0;
|
|
1835
2359
|
exitCode = await run(async (client) => {
|
|
1836
2360
|
const result = await client.POST("/v1/projects/{projectId}/work-items/import", {
|
|
1837
|
-
body,
|
|
2361
|
+
body,
|
|
2362
|
+
params: {
|
|
2363
|
+
header: { "idempotency-key": key },
|
|
2364
|
+
path: { projectId: options.projectId },
|
|
2365
|
+
},
|
|
1838
2366
|
});
|
|
1839
2367
|
if (result.data !== undefined) {
|
|
1840
2368
|
failed = result.data.results.failed;
|
|
@@ -1847,7 +2375,8 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1847
2375
|
if (exitCode === 0 && failed > 0) {
|
|
1848
2376
|
writeSkillError(dependencies, {
|
|
1849
2377
|
message: "Some tasks were refused; inspect the per-row results and import only corrected failed rows with a new key",
|
|
1850
|
-
reason: "Invalid Operation",
|
|
2378
|
+
reason: "Invalid Operation",
|
|
2379
|
+
retryable: false,
|
|
1851
2380
|
});
|
|
1852
2381
|
exitCode = 2;
|
|
1853
2382
|
}
|
|
@@ -1857,7 +2386,10 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1857
2386
|
.requiredOption("--project-id <projectId>")
|
|
1858
2387
|
.action(async (options) => {
|
|
1859
2388
|
exitCode = await run((client) => client.GET("/v1/projects/{projectId}/work-items/export", {
|
|
1860
|
-
params: {
|
|
2389
|
+
params: {
|
|
2390
|
+
path: { projectId: options.projectId },
|
|
2391
|
+
query: workItemSelectionQuery(options),
|
|
2392
|
+
},
|
|
1861
2393
|
}));
|
|
1862
2394
|
});
|
|
1863
2395
|
workItem
|
|
@@ -1877,7 +2409,9 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1877
2409
|
exitCode = await run((client) => client.POST("/v1/projects/{projectId}/work-items/{workItemId}/transfer", {
|
|
1878
2410
|
body: {
|
|
1879
2411
|
destinationProjectId: options.destinationProjectId,
|
|
1880
|
-
...(options.destinationStatus === undefined
|
|
2412
|
+
...(options.destinationStatus === undefined
|
|
2413
|
+
? {}
|
|
2414
|
+
: { destinationStatus: options.destinationStatus }),
|
|
1881
2415
|
},
|
|
1882
2416
|
params: {
|
|
1883
2417
|
header: { "idempotency-key": idempotencyKey, "if-match": options.expectedVersion },
|
|
@@ -1903,9 +2437,7 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1903
2437
|
const idempotencyKey = randomUUID();
|
|
1904
2438
|
exitCode = await run((client) => client.POST("/v1/projects/{projectId}/work-items/{workItemId}/move", {
|
|
1905
2439
|
body: {
|
|
1906
|
-
...(options.position === undefined
|
|
1907
|
-
? {}
|
|
1908
|
-
: { position: options.position }),
|
|
2440
|
+
...(options.position === undefined ? {} : { position: options.position }),
|
|
1909
2441
|
status: options.status,
|
|
1910
2442
|
},
|
|
1911
2443
|
params: {
|
|
@@ -1924,7 +2456,8 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1924
2456
|
});
|
|
1925
2457
|
});
|
|
1926
2458
|
for (const action of ["archive", "unarchive"]) {
|
|
1927
|
-
workItem
|
|
2459
|
+
workItem
|
|
2460
|
+
.command(action)
|
|
1928
2461
|
.requiredOption("--project-id <projectId>")
|
|
1929
2462
|
.requiredOption("--work-item-id <workItemId>")
|
|
1930
2463
|
.requiredOption("--expected-version <expectedVersion>", "Opaque version returned by SpecFlow", parseOpaqueVersion)
|
|
@@ -1934,10 +2467,20 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1934
2467
|
return;
|
|
1935
2468
|
}
|
|
1936
2469
|
const idempotencyKey = randomUUID();
|
|
1937
|
-
exitCode = await run((client) => client.POST(action === "archive"
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
2470
|
+
exitCode = await run((client) => client.POST(action === "archive"
|
|
2471
|
+
? "/v1/projects/{projectId}/work-items/{workItemId}/archive"
|
|
2472
|
+
: "/v1/projects/{projectId}/work-items/{workItemId}/unarchive", {
|
|
2473
|
+
params: {
|
|
2474
|
+
path: { projectId: options.projectId, workItemId: options.workItemId },
|
|
2475
|
+
header: {
|
|
2476
|
+
"if-match": options.expectedVersion,
|
|
2477
|
+
"idempotency-key": idempotencyKey,
|
|
2478
|
+
},
|
|
2479
|
+
},
|
|
2480
|
+
}), {
|
|
2481
|
+
retryTransportOnce: true,
|
|
2482
|
+
ambiguousOutcomeMessage: "Work Item archive outcome is unknown; read the Work Item before retrying",
|
|
2483
|
+
});
|
|
1941
2484
|
});
|
|
1942
2485
|
}
|
|
1943
2486
|
workItem
|
|
@@ -1953,7 +2496,9 @@ export async function runCli(arguments_, dependencies) {
|
|
|
1953
2496
|
}
|
|
1954
2497
|
const idempotencyKey = randomUUID();
|
|
1955
2498
|
exitCode = await run(async (client) => {
|
|
1956
|
-
const board = await client.GET("/v1/projects/{projectId}/work-item-board", {
|
|
2499
|
+
const board = await client.GET("/v1/projects/{projectId}/work-item-board", {
|
|
2500
|
+
params: { path: { projectId: options.projectId } },
|
|
2501
|
+
});
|
|
1957
2502
|
if (!board.response.ok) {
|
|
1958
2503
|
return board;
|
|
1959
2504
|
}
|
|
@@ -2009,7 +2554,9 @@ export async function runCli(arguments_, dependencies) {
|
|
|
2009
2554
|
.requiredOption("--project-id <projectId>")
|
|
2010
2555
|
.requiredOption("--label-id <labelId>")
|
|
2011
2556
|
.action(async (options) => {
|
|
2012
|
-
exitCode = await run((client) => client.GET("/v1/projects/{projectId}/work-item-labels/{labelId}", {
|
|
2557
|
+
exitCode = await run((client) => client.GET("/v1/projects/{projectId}/work-item-labels/{labelId}", {
|
|
2558
|
+
params: { path: options },
|
|
2559
|
+
}));
|
|
2013
2560
|
});
|
|
2014
2561
|
workItemLabel
|
|
2015
2562
|
.command("create")
|
|
@@ -2027,9 +2574,7 @@ export async function runCli(arguments_, dependencies) {
|
|
|
2027
2574
|
body: {
|
|
2028
2575
|
color: options.color,
|
|
2029
2576
|
name: options.name,
|
|
2030
|
-
...(options.workItemId === undefined
|
|
2031
|
-
? {}
|
|
2032
|
-
: { workItemId: options.workItemId }),
|
|
2577
|
+
...(options.workItemId === undefined ? {} : { workItemId: options.workItemId }),
|
|
2033
2578
|
},
|
|
2034
2579
|
params: {
|
|
2035
2580
|
header: { "idempotency-key": idempotencyKey },
|
|
@@ -2058,9 +2603,7 @@ export async function runCli(arguments_, dependencies) {
|
|
|
2058
2603
|
const idempotencyKey = randomUUID();
|
|
2059
2604
|
exitCode = await run((client) => client.PATCH("/v1/projects/{projectId}/work-item-labels/{labelId}", {
|
|
2060
2605
|
body: {
|
|
2061
|
-
...(options.color === undefined
|
|
2062
|
-
? {}
|
|
2063
|
-
: { color: options.color }),
|
|
2606
|
+
...(options.color === undefined ? {} : { color: options.color }),
|
|
2064
2607
|
...(options.name === undefined ? {} : { name: options.name }),
|
|
2065
2608
|
},
|
|
2066
2609
|
params: {
|
|
@@ -2203,7 +2746,7 @@ export async function runCli(arguments_, dependencies) {
|
|
|
2203
2746
|
.command("create")
|
|
2204
2747
|
.requiredOption("--project-id <projectId>")
|
|
2205
2748
|
.requiredOption("--name <name>")
|
|
2206
|
-
.requiredOption("--type <type>", "text, number, date, dropdown, or boolean", parseWorkItemCustomFieldType)
|
|
2749
|
+
.requiredOption("--type <type>", "text, number, date, dropdown, multi-select, or boolean", parseWorkItemCustomFieldType)
|
|
2207
2750
|
.option("--option <option>", "Dropdown option; repeat for every choice", collectOption, [])
|
|
2208
2751
|
.option("--default-value <defaultValue>")
|
|
2209
2752
|
.option("--required", "Reject Work Items that leave the field blank")
|
|
@@ -2216,17 +2759,11 @@ export async function runCli(arguments_, dependencies) {
|
|
|
2216
2759
|
const idempotencyKey = randomUUID();
|
|
2217
2760
|
exitCode = await run((client) => client.POST("/v1/projects/{projectId}/work-item-custom-fields", {
|
|
2218
2761
|
body: {
|
|
2219
|
-
...(options.defaultValue === undefined
|
|
2220
|
-
? {}
|
|
2221
|
-
: { defaultValue: options.defaultValue }),
|
|
2762
|
+
...(options.defaultValue === undefined ? {} : { defaultValue: options.defaultValue }),
|
|
2222
2763
|
name: options.name,
|
|
2223
2764
|
...(options.optionColors === undefined ? {} : { optionColors: options.optionColors }),
|
|
2224
|
-
...(options.option.length === 0
|
|
2225
|
-
|
|
2226
|
-
: { options: options.option }),
|
|
2227
|
-
...(options.required === undefined
|
|
2228
|
-
? {}
|
|
2229
|
-
: { required: options.required }),
|
|
2765
|
+
...(options.option.length === 0 ? {} : { options: options.option }),
|
|
2766
|
+
...(options.required === undefined ? {} : { required: options.required }),
|
|
2230
2767
|
type: options.type,
|
|
2231
2768
|
},
|
|
2232
2769
|
params: {
|
|
@@ -2269,7 +2806,7 @@ export async function runCli(arguments_, dependencies) {
|
|
|
2269
2806
|
workItemCustomField
|
|
2270
2807
|
.command("reorder")
|
|
2271
2808
|
.requiredOption("--project-id <projectId>")
|
|
2272
|
-
.requiredOption("--order <order>",
|
|
2809
|
+
.requiredOption("--order <order>", 'Comma-separated id@version pairs in display order — version is the integer inside the field\'s opaque "N" version')
|
|
2273
2810
|
.action(async (options) => {
|
|
2274
2811
|
if (hasWorkspaceReadToken(dependencies.environment)) {
|
|
2275
2812
|
exitCode = rejectTokenWrite(dependencies);
|
|
@@ -2310,7 +2847,9 @@ export async function runCli(arguments_, dependencies) {
|
|
|
2310
2847
|
.command("filter-values")
|
|
2311
2848
|
.requiredOption("--project-id <projectId>")
|
|
2312
2849
|
.action(async (options) => {
|
|
2313
|
-
exitCode = await run((client) => client.GET("/v1/projects/{projectId}/work-item-custom-field-filter-values", {
|
|
2850
|
+
exitCode = await run((client) => client.GET("/v1/projects/{projectId}/work-item-custom-field-filter-values", {
|
|
2851
|
+
params: { path: options },
|
|
2852
|
+
}));
|
|
2314
2853
|
});
|
|
2315
2854
|
workItemCustomField
|
|
2316
2855
|
.command("set")
|
|
@@ -2368,12 +2907,8 @@ export async function runCli(arguments_, dependencies) {
|
|
|
2368
2907
|
const idempotencyKey = randomUUID();
|
|
2369
2908
|
exitCode = await run((client) => client.POST("/v1/projects/{projectId}/workflow-columns", {
|
|
2370
2909
|
body: {
|
|
2371
|
-
...(options.color === undefined
|
|
2372
|
-
|
|
2373
|
-
: { color: options.color }),
|
|
2374
|
-
...(options.category === undefined
|
|
2375
|
-
? {}
|
|
2376
|
-
: { category: options.category }),
|
|
2910
|
+
...(options.color === undefined ? {} : { color: options.color }),
|
|
2911
|
+
...(options.category === undefined ? {} : { category: options.category }),
|
|
2377
2912
|
...(options.icon === undefined ? {} : { icon: options.icon }),
|
|
2378
2913
|
name: options.name,
|
|
2379
2914
|
},
|
|
@@ -2430,9 +2965,7 @@ export async function runCli(arguments_, dependencies) {
|
|
|
2430
2965
|
? {}
|
|
2431
2966
|
: { icon: options.icon }),
|
|
2432
2967
|
...(options.category === undefined ? {} : { category: options.category }),
|
|
2433
|
-
...(options.name === undefined
|
|
2434
|
-
? {}
|
|
2435
|
-
: { name: options.name }),
|
|
2968
|
+
...(options.name === undefined ? {} : { name: options.name }),
|
|
2436
2969
|
},
|
|
2437
2970
|
params: {
|
|
2438
2971
|
header: {
|
|
@@ -2479,7 +3012,7 @@ export async function runCli(arguments_, dependencies) {
|
|
|
2479
3012
|
workflowColumn
|
|
2480
3013
|
.command("reorder")
|
|
2481
3014
|
.requiredOption("--project-id <projectId>")
|
|
2482
|
-
.requiredOption("--order <order>",
|
|
3015
|
+
.requiredOption("--order <order>", 'Comma-separated slug@version pairs in board order — version is the integer inside the column\'s opaque "N" version')
|
|
2483
3016
|
.action(async (options) => {
|
|
2484
3017
|
if (hasWorkspaceReadToken(dependencies.environment)) {
|
|
2485
3018
|
exitCode = rejectTokenWrite(dependencies);
|
|
@@ -2542,7 +3075,9 @@ export async function runCli(arguments_, dependencies) {
|
|
|
2542
3075
|
exitCode = rejectTokenWrite(dependencies);
|
|
2543
3076
|
return;
|
|
2544
3077
|
}
|
|
2545
|
-
exitCode = await run(async (client) => withSuccessData(await client.DELETE("/v1/workspaces/{workspaceId}/read-tokens/{tokenId}", {
|
|
3078
|
+
exitCode = await run(async (client) => withSuccessData(await client.DELETE("/v1/workspaces/{workspaceId}/read-tokens/{tokenId}", {
|
|
3079
|
+
params: { path: options },
|
|
3080
|
+
}), { revoked: { tokenId: options.tokenId } }), {
|
|
2546
3081
|
ambiguousOutcomeMessage: "Workspace read-only Token revocation outcome is unknown; list tokens before retrying",
|
|
2547
3082
|
retryTransportOnce: true,
|
|
2548
3083
|
});
|
|
@@ -2557,7 +3092,10 @@ export async function runCli(arguments_, dependencies) {
|
|
|
2557
3092
|
return cause.exitCode;
|
|
2558
3093
|
}
|
|
2559
3094
|
writeSkillError(dependencies, {
|
|
2560
|
-
message: cause.message
|
|
3095
|
+
message: cause.message
|
|
3096
|
+
.replace(/'[^']*'/gu, (quoted) => /^'--?[a-z][a-z-]*(?: [<[][^>\]]+[>\]])?'$/u.test(quoted) ? quoted : "'<redacted>'")
|
|
3097
|
+
.replace(/[\r\n]/gu, " ")
|
|
3098
|
+
.slice(0, 500),
|
|
2561
3099
|
code: "INVALID_CLI_INPUT",
|
|
2562
3100
|
reason: "Invalid Operation",
|
|
2563
3101
|
retryable: false,
|
|
@@ -2630,7 +3168,15 @@ function parseWorkItemId(value) {
|
|
|
2630
3168
|
throw invalidArgument("Work Item ID must be a Project ID followed by a positive number");
|
|
2631
3169
|
}
|
|
2632
3170
|
const workflowCategories = ["backlog", "unstarted", "started", "completed", "canceled"];
|
|
2633
|
-
const workflowIcons = [
|
|
3171
|
+
const workflowIcons = [
|
|
3172
|
+
"backlog",
|
|
3173
|
+
"todo",
|
|
3174
|
+
"in-progress",
|
|
3175
|
+
"in-review",
|
|
3176
|
+
"done",
|
|
3177
|
+
"canceled",
|
|
3178
|
+
"duplicate",
|
|
3179
|
+
];
|
|
2634
3180
|
function parseWorkflowCategory(value) {
|
|
2635
3181
|
if (workflowCategories.includes(value))
|
|
2636
3182
|
return value;
|
|
@@ -2641,13 +3187,7 @@ function parseWorkflowIcon(value) {
|
|
|
2641
3187
|
return value;
|
|
2642
3188
|
throw invalidArgument("Workflow icon must be backlog, todo, in-progress, in-review, done, canceled or duplicate");
|
|
2643
3189
|
}
|
|
2644
|
-
const workItemPriorities = [
|
|
2645
|
-
"no-priority",
|
|
2646
|
-
"low",
|
|
2647
|
-
"medium",
|
|
2648
|
-
"high",
|
|
2649
|
-
"urgent",
|
|
2650
|
-
];
|
|
3190
|
+
const workItemPriorities = ["no-priority", "low", "medium", "high", "urgent"];
|
|
2651
3191
|
function parseWorkItemPriority(value) {
|
|
2652
3192
|
const normalized = value.trim().toLowerCase();
|
|
2653
3193
|
if (workItemPriorities.includes(normalized)) {
|
|
@@ -2656,18 +3196,17 @@ function parseWorkItemPriority(value) {
|
|
|
2656
3196
|
throw invalidArgument("Work Item priority must be no-priority, low, medium, high, or urgent");
|
|
2657
3197
|
}
|
|
2658
3198
|
function parseWorkItemDate(value) {
|
|
2659
|
-
if (z.iso.date().safeParse(value).success ||
|
|
2660
|
-
z.iso.datetime().safeParse(value).success) {
|
|
3199
|
+
if (z.iso.date().safeParse(value).success || z.iso.datetime().safeParse(value).success) {
|
|
2661
3200
|
return value;
|
|
2662
3201
|
}
|
|
2663
3202
|
throw invalidArgument("Work Item dates must be an ISO 8601 date or date-time");
|
|
2664
3203
|
}
|
|
2665
|
-
const workItemDueDateFilters = [
|
|
2666
|
-
"dueThisWeek",
|
|
2667
|
-
"dueNextWeek",
|
|
2668
|
-
"noDueDate",
|
|
2669
|
-
];
|
|
3204
|
+
const workItemDueDateFilters = ["dueThisWeek", "dueNextWeek", "noDueDate"];
|
|
2670
3205
|
const workItemQuerySortFields = [
|
|
3206
|
+
"status",
|
|
3207
|
+
"startDate",
|
|
3208
|
+
"updatedAt",
|
|
3209
|
+
"assignee",
|
|
2671
3210
|
"createdAt",
|
|
2672
3211
|
"dueDate",
|
|
2673
3212
|
"number",
|
|
@@ -2706,34 +3245,29 @@ function workItemSelectionQuery(options) {
|
|
|
2706
3245
|
customFields[fieldId] = [...(customFields[fieldId] ?? []), value];
|
|
2707
3246
|
}
|
|
2708
3247
|
return {
|
|
2709
|
-
...(options.
|
|
3248
|
+
...(options.creator === undefined || options.creator.length === 0
|
|
2710
3249
|
? {}
|
|
2711
|
-
: {
|
|
3250
|
+
: { creator: options.creator.join(",") }),
|
|
3251
|
+
...Object.fromEntries(["operators", "created", "updated", "relations", "specs", "pullRequests"].flatMap((key) => (options[key] === undefined ? [] : [[key, options[key]]]))),
|
|
3252
|
+
...(options.assignee.length === 0 ? {} : { assignee: options.assignee.join(",") }),
|
|
3253
|
+
...(options.watcher.length === 0 ? {} : { watcher: options.watcher.join(",") }),
|
|
2712
3254
|
...(Object.keys(customFields).length === 0
|
|
2713
3255
|
? {}
|
|
2714
3256
|
: { customFields: JSON.stringify(customFields) }),
|
|
2715
3257
|
...(options.due.length === 0 ? {} : { due: options.due.join(",") }),
|
|
2716
3258
|
...(options.dueAfter === undefined ? {} : { dueAfter: options.dueAfter }),
|
|
2717
|
-
...(options.dueBefore === undefined
|
|
2718
|
-
? {}
|
|
2719
|
-
: { dueBefore: options.dueBefore }),
|
|
3259
|
+
...(options.dueBefore === undefined ? {} : { dueBefore: options.dueBefore }),
|
|
2720
3260
|
...(options.label.length === 0 ? {} : { label: options.label.join(",") }),
|
|
2721
|
-
...(options.priority.length === 0
|
|
3261
|
+
...(options.priority.length === 0 ? {} : { priority: options.priority.join(",") }),
|
|
3262
|
+
...(options.repositoryConnectionId === undefined
|
|
2722
3263
|
? {}
|
|
2723
|
-
: {
|
|
2724
|
-
...(options.repositoryConnectionId === undefined ? {} : { repositoryConnectionId: options.repositoryConnectionId }),
|
|
3264
|
+
: { repositoryConnectionId: options.repositoryConnectionId }),
|
|
2725
3265
|
...(options.search === undefined ? {} : { search: options.search }),
|
|
2726
3266
|
...(options.sort === undefined ? {} : { sortBy: options.sort }),
|
|
2727
3267
|
...(options.order === undefined ? {} : { sortOrder: options.order }),
|
|
2728
|
-
...(options.startAfter === undefined
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
...(options.startBefore === undefined
|
|
2732
|
-
? {}
|
|
2733
|
-
: { startBefore: options.startBefore }),
|
|
2734
|
-
...(options.status.length === 0
|
|
2735
|
-
? {}
|
|
2736
|
-
: { status: options.status.join(",") }),
|
|
3268
|
+
...(options.startAfter === undefined ? {} : { startAfter: options.startAfter }),
|
|
3269
|
+
...(options.startBefore === undefined ? {} : { startBefore: options.startBefore }),
|
|
3270
|
+
...(options.status.length === 0 ? {} : { status: options.status.join(",") }),
|
|
2737
3271
|
};
|
|
2738
3272
|
}
|
|
2739
3273
|
/** List and board only: which completed Work Items to keep. */
|
|
@@ -2750,7 +3284,15 @@ function workItemCompletedFlag(command) {
|
|
|
2750
3284
|
*/
|
|
2751
3285
|
function workItemSelectionFlags(command) {
|
|
2752
3286
|
return command
|
|
2753
|
-
.option("--
|
|
3287
|
+
.option("--creator <id>", "Creator User ID or me; repeat for several", collectOption, [])
|
|
3288
|
+
.option("--operators <json>", "Category -> include|exclude; custom fields use customField:<id>")
|
|
3289
|
+
.option("--created <filter>", "today|pastWeek|past2Weeks|pastMonth|past3Months or YYYY-MM-DD (UTC inclusive)")
|
|
3290
|
+
.option("--updated <filter>", "Same time choices as --created")
|
|
3291
|
+
.option("--relations <csv>", "blocked,blocking,hasParent,hasChildren,related")
|
|
3292
|
+
.option("--specs <csv>", "Linked Spec IDs, or none")
|
|
3293
|
+
.option("--pull-requests <csv>", "none,draft,open,merged,closed; synchronized state only")
|
|
3294
|
+
.option("--assignee <assignee>", "Filter by assignee User ID, me, or unassigned; repeat for several", collectOption, [])
|
|
3295
|
+
.option("--watcher <userId>", "Filter by watcher User ID or me; repeat for several", collectOption, [])
|
|
2754
3296
|
.option("--custom-field <fieldId=value>", "Filter by Custom Field value; repeat to OR values or combine fields", collectOption, [])
|
|
2755
3297
|
.option("--due <filter>", "Filter by due bucket: dueThisWeek, dueNextWeek, or noDueDate; repeat for several", (value, previous) => [
|
|
2756
3298
|
...previous,
|
|
@@ -2759,10 +3301,7 @@ function workItemSelectionFlags(command) {
|
|
|
2759
3301
|
.option("--due-after <date>", "Filter due on/after", parseWorkItemDate)
|
|
2760
3302
|
.option("--due-before <date>", "Filter due on/before", parseWorkItemDate)
|
|
2761
3303
|
.option("--label <labelId>", "Filter by Work Item Label ID; repeat for several", collectOption, [])
|
|
2762
|
-
.option("--priority <priority>", "Filter by priority; repeat for several", (value, previous) => [
|
|
2763
|
-
...previous,
|
|
2764
|
-
parseWorkItemPriority(value),
|
|
2765
|
-
], [])
|
|
3304
|
+
.option("--priority <priority>", "Filter by priority; repeat for several", (value, previous) => [...previous, parseWorkItemPriority(value)], [])
|
|
2766
3305
|
.option("--repository-connection-id <id>", "Filter by an explicit GitHub repository connection")
|
|
2767
3306
|
.option("--search <search>", "Filter by title search text")
|
|
2768
3307
|
.option("--sort <field>", "Sort by field", parseWorkItemSortField)
|
|
@@ -2795,20 +3334,21 @@ function parseWorkItemBulkTarget(value, previous) {
|
|
|
2795
3334
|
throw invalidArgument(`Bulk target "${value}" must be a WORK-ITEM-ID@version pair`);
|
|
2796
3335
|
}
|
|
2797
3336
|
const numericVersion = Number(version);
|
|
2798
|
-
if (!Number.isSafeInteger(numericVersion) ||
|
|
2799
|
-
numericVersion > 2_147_483_647) {
|
|
3337
|
+
if (!Number.isSafeInteger(numericVersion) || numericVersion > 2_147_483_647) {
|
|
2800
3338
|
throw invalidArgument(`Bulk target "${value}" has a version outside the supported range`);
|
|
2801
3339
|
}
|
|
2802
3340
|
return [
|
|
2803
3341
|
...previous,
|
|
2804
|
-
{
|
|
3342
|
+
{
|
|
3343
|
+
expectedVersion: `"${version}"`,
|
|
3344
|
+
id: id.trim().toUpperCase(),
|
|
3345
|
+
...(projectId === undefined ? {} : { projectId }),
|
|
3346
|
+
},
|
|
2805
3347
|
];
|
|
2806
3348
|
}
|
|
2807
3349
|
function parseBoardPosition(value) {
|
|
2808
3350
|
const position = Number(value);
|
|
2809
|
-
if (!Number.isInteger(position) ||
|
|
2810
|
-
position < 0 ||
|
|
2811
|
-
position > 2_147_483_646) {
|
|
3351
|
+
if (!Number.isInteger(position) || position < 0 || position > 2_147_483_646) {
|
|
2812
3352
|
throw invalidArgument("Board position must be a nonnegative integer within the supported range");
|
|
2813
3353
|
}
|
|
2814
3354
|
return position;
|
|
@@ -2847,6 +3387,7 @@ const workItemCustomFieldTypes = [
|
|
|
2847
3387
|
"text",
|
|
2848
3388
|
"number",
|
|
2849
3389
|
"date",
|
|
3390
|
+
"multi-select",
|
|
2850
3391
|
"dropdown",
|
|
2851
3392
|
"boolean",
|
|
2852
3393
|
];
|
|
@@ -2855,7 +3396,7 @@ function parseWorkItemCustomFieldType(value) {
|
|
|
2855
3396
|
if (workItemCustomFieldTypes.includes(normalized)) {
|
|
2856
3397
|
return normalized;
|
|
2857
3398
|
}
|
|
2858
|
-
throw invalidArgument("Custom Field type must be text, number, date, dropdown, or boolean");
|
|
3399
|
+
throw invalidArgument("Custom Field type must be text, number, date, dropdown, multi-select, or boolean");
|
|
2859
3400
|
}
|
|
2860
3401
|
function collectOption(value, previous) {
|
|
2861
3402
|
return [...previous, value];
|
|
@@ -2978,9 +3519,7 @@ function parseStringArray(value, label) {
|
|
|
2978
3519
|
}
|
|
2979
3520
|
function toAgentProvenance(options) {
|
|
2980
3521
|
return {
|
|
2981
|
-
...(options.agentRevision === undefined
|
|
2982
|
-
? {}
|
|
2983
|
-
: { agentRevision: options.agentRevision }),
|
|
3522
|
+
...(options.agentRevision === undefined ? {} : { agentRevision: options.agentRevision }),
|
|
2984
3523
|
...(options.agentModel === undefined ? {} : { model: options.agentModel }),
|
|
2985
3524
|
sourceReferenceIds: options.sourceReferenceIds === undefined
|
|
2986
3525
|
? []
|
|
@@ -3028,9 +3567,7 @@ function parseFindingInput(value) {
|
|
|
3028
3567
|
return finding.data;
|
|
3029
3568
|
}
|
|
3030
3569
|
function withSuccessData(result, data) {
|
|
3031
|
-
return result.response.ok && result.data === undefined
|
|
3032
|
-
? { ...result, data }
|
|
3033
|
-
: result;
|
|
3570
|
+
return result.response.ok && result.data === undefined ? { ...result, data } : result;
|
|
3034
3571
|
}
|
|
3035
3572
|
/**
|
|
3036
3573
|
* Whether a `work-item-label delete` payload is the still-running cascade —
|
|
@@ -3043,10 +3580,8 @@ function isWorkItemLabelDeletionPending(data) {
|
|
|
3043
3580
|
const label = data.workItemLabel;
|
|
3044
3581
|
return (typeof label === "object" &&
|
|
3045
3582
|
label !== null &&
|
|
3046
|
-
label.deletionStartedAt !==
|
|
3047
|
-
|
|
3048
|
-
label.deletionStartedAt !==
|
|
3049
|
-
undefined);
|
|
3583
|
+
label.deletionStartedAt !== null &&
|
|
3584
|
+
label.deletionStartedAt !== undefined);
|
|
3050
3585
|
}
|
|
3051
3586
|
function rejectTokenWrite(dependencies) {
|
|
3052
3587
|
if (hasWorkspaceReadToken(dependencies.environment)) {
|
|
@@ -3065,7 +3600,13 @@ function rejectTokenWrite(dependencies) {
|
|
|
3065
3600
|
return 2;
|
|
3066
3601
|
}
|
|
3067
3602
|
function parseCommentContent(value) {
|
|
3068
|
-
const result = z
|
|
3603
|
+
const result = z
|
|
3604
|
+
.string()
|
|
3605
|
+
.trim()
|
|
3606
|
+
.min(1)
|
|
3607
|
+
.max(20_000)
|
|
3608
|
+
.refine((content) => !content.includes("\0"))
|
|
3609
|
+
.safeParse(value);
|
|
3069
3610
|
if (!result.success)
|
|
3070
3611
|
throw invalidArgument("Comment content must contain 1 through 20000 characters without null characters");
|
|
3071
3612
|
return result.data;
|
|
@@ -3106,11 +3647,47 @@ function parseNotificationPreferences(value) {
|
|
|
3106
3647
|
catch {
|
|
3107
3648
|
throw invalidArgument("Notification preferences must be a JSON object");
|
|
3108
3649
|
}
|
|
3109
|
-
const result = z
|
|
3650
|
+
const result = z
|
|
3651
|
+
.object({
|
|
3652
|
+
taskAssignmentEnabled: z.boolean().optional(),
|
|
3653
|
+
taskCommentEnabled: z.boolean().optional(),
|
|
3654
|
+
taskStatusChangeEnabled: z.boolean().optional(),
|
|
3655
|
+
dueDateReminderEnabled: z.boolean().optional(),
|
|
3656
|
+
dueDateReminderMinutes: z.number().int().min(5).max(43200).optional(),
|
|
3657
|
+
})
|
|
3658
|
+
.strict()
|
|
3659
|
+
.safeParse(parsed);
|
|
3110
3660
|
if (!result.success)
|
|
3111
3661
|
throw invalidArgument("Notification preferences contain unsupported settings or invalid values");
|
|
3112
3662
|
const data = result.data;
|
|
3113
|
-
return {
|
|
3663
|
+
return {
|
|
3664
|
+
...(data.taskAssignmentEnabled === undefined
|
|
3665
|
+
? {}
|
|
3666
|
+
: { taskAssignmentEnabled: data.taskAssignmentEnabled }),
|
|
3667
|
+
...(data.taskCommentEnabled === undefined
|
|
3668
|
+
? {}
|
|
3669
|
+
: { taskCommentEnabled: data.taskCommentEnabled }),
|
|
3670
|
+
...(data.taskStatusChangeEnabled === undefined
|
|
3671
|
+
? {}
|
|
3672
|
+
: { taskStatusChangeEnabled: data.taskStatusChangeEnabled }),
|
|
3673
|
+
...(data.dueDateReminderEnabled === undefined
|
|
3674
|
+
? {}
|
|
3675
|
+
: { dueDateReminderEnabled: data.dueDateReminderEnabled }),
|
|
3676
|
+
...(data.dueDateReminderMinutes === undefined
|
|
3677
|
+
? {}
|
|
3678
|
+
: { dueDateReminderMinutes: data.dueDateReminderMinutes }),
|
|
3679
|
+
};
|
|
3114
3680
|
}
|
|
3115
|
-
const reviewPlanInputSchema = z.discriminatedUnion("cadence", [
|
|
3681
|
+
const reviewPlanInputSchema = z.discriminatedUnion("cadence", [
|
|
3682
|
+
z.object({ cadence: z.literal("Disabled") }).strict(),
|
|
3683
|
+
z.object({ cadence: z.literal("Daily"), timeOfDay: z.string(), timeZone: z.string() }).strict(),
|
|
3684
|
+
z
|
|
3685
|
+
.object({
|
|
3686
|
+
cadence: z.literal("Weekly"),
|
|
3687
|
+
dayOfWeek: z.number().int().min(1).max(7),
|
|
3688
|
+
timeOfDay: z.string(),
|
|
3689
|
+
timeZone: z.string(),
|
|
3690
|
+
})
|
|
3691
|
+
.strict(),
|
|
3692
|
+
]);
|
|
3116
3693
|
//# sourceMappingURL=cli.js.map
|