@sanity/workflow-cli 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +61 -0
- package/README.md +57 -39
- package/dist/commands/definition/list.d.ts +3 -0
- package/dist/commands/definition/list.js +7 -4
- package/dist/commands/definition/show.d.ts +13 -0
- package/dist/commands/definition/show.js +25 -7
- package/dist/commands/deploy.d.ts +1 -1
- package/dist/commands/deploy.js +4 -4
- package/dist/commands/diagnose.d.ts +1 -1
- package/dist/commands/diagnose.js +23 -13
- package/dist/commands/fire-action.js +13 -2
- package/dist/commands/list.d.ts +13 -2
- package/dist/commands/list.js +43 -17
- package/dist/commands/nuke.d.ts +11 -0
- package/dist/commands/nuke.js +76 -0
- package/dist/commands/start.d.ts +17 -23
- package/dist/commands/start.js +49 -33
- package/dist/commands/tail.js +19 -15
- package/dist/hooks/prerun/telemetry.d.ts +4 -1
- package/dist/hooks/prerun/telemetry.js +6 -2
- package/dist/lib/client.d.ts +8 -0
- package/dist/lib/client.js +1 -1
- package/dist/lib/context.d.ts +6 -2
- package/dist/lib/context.js +9 -7
- package/dist/lib/definitions.d.ts +10 -0
- package/dist/lib/definitions.js +8 -2
- package/dist/lib/fail.d.ts +7 -0
- package/dist/lib/fail.js +2 -1
- package/dist/lib/nuke.d.ts +89 -0
- package/dist/lib/nuke.js +111 -0
- package/dist/lib/operation-args.d.ts +3 -1
- package/dist/lib/ops-report.d.ts +2 -1
- package/dist/lib/prompt.d.ts +10 -0
- package/dist/lib/prompt.js +4 -0
- package/dist/lib/share-definitions.d.ts +59 -25
- package/dist/lib/share-definitions.js +104 -21
- package/dist/lib/telemetry-setup.d.ts +4 -0
- package/dist/lib/telemetry-setup.js +18 -11
- package/dist/lib/telemetry.d.ts +33 -2
- package/dist/lib/telemetry.js +9 -4
- package/dist/lib/ui.js +0 -1
- package/oclif.manifest.json +66 -11
- package/package.json +4 -4
package/dist/lib/telemetry.d.ts
CHANGED
|
@@ -23,7 +23,9 @@
|
|
|
23
23
|
* never flag values, arguments, or error text. `Editorial Workflows
|
|
24
24
|
* Definition Shared` is a content-free marker (hash + structural counts); the shared
|
|
25
25
|
* document itself rides the first-party feedback endpoint, never
|
|
26
|
-
* telemetry (see `share-definitions.ts`).
|
|
26
|
+
* telemetry (see `share-definitions.ts`). `Editorial Workflows Definition
|
|
27
|
+
* Sharing Decided` records the per-invocation consent outcome (default /
|
|
28
|
+
* opt-in / opt-out and whether anything was donated) — also content-free.
|
|
27
29
|
*/
|
|
28
30
|
import { type DefinedTelemetryTrace, type TelemetryStore } from '@sanity/telemetry';
|
|
29
31
|
import { type TelemetryIntakeClient, type WorkflowDefinitionDeployedData, type WorkflowTelemetryLogger } from '@sanity/workflow-engine';
|
|
@@ -42,6 +44,26 @@ export declare const WorkflowCliCommandExecuted: DefinedTelemetryTrace<WorkflowC
|
|
|
42
44
|
* are ever shared, so status carries nothing. */
|
|
43
45
|
export type WorkflowDefinitionSharedData = Omit<WorkflowDefinitionDeployedData, 'status'>;
|
|
44
46
|
export declare const WorkflowDefinitionShared: import("@sanity/telemetry").DefinedTelemetryLog<WorkflowDefinitionSharedData>;
|
|
47
|
+
/**
|
|
48
|
+
* How the donation decision was reached, and what it was. Paired with `shared`
|
|
49
|
+
* (whether it actually reached the endpoint) this keeps every case distinct —
|
|
50
|
+
* an explicit decline vs a run that couldn't ask, and a chosen share vs a
|
|
51
|
+
* failed POST:
|
|
52
|
+
* - `opt-in` / `opt-out` — an explicit `--share-defs` / `--no-share-defs`.
|
|
53
|
+
* - `prompt-accepted` / `prompt-declined` — the first-run consent prompt.
|
|
54
|
+
* - `remembered-share` / `remembered-decline` — a persisted earlier answer.
|
|
55
|
+
* - `unattended` — CI / `DO_NOT_TRACK` / non-TTY: never asked, never shares.
|
|
56
|
+
*/
|
|
57
|
+
export type DefinitionSharingDecision = 'opt-in' | 'opt-out' | 'prompt-accepted' | 'prompt-declined' | 'remembered-share' | 'remembered-decline' | 'unattended';
|
|
58
|
+
export interface WorkflowDefinitionSharingDecidedData {
|
|
59
|
+
decision: DefinitionSharingDecision;
|
|
60
|
+
/** Whether the donation actually reached the feedback endpoint — `false` for
|
|
61
|
+
* any non-sharing decision, and also for a chosen share whose POST failed. */
|
|
62
|
+
shared: boolean;
|
|
63
|
+
/** Newly created definition versions this invocation could have donated. */
|
|
64
|
+
definitionCount: number;
|
|
65
|
+
}
|
|
66
|
+
export declare const WorkflowDefinitionSharingDecided: import("@sanity/telemetry").DefinedTelemetryLog<WorkflowDefinitionSharingDecidedData>;
|
|
45
67
|
/**
|
|
46
68
|
* The shell for one CLI invocation. `builtin` is the Sanity-intake store;
|
|
47
69
|
* `provided` is a config-supplied logger that replaces the shell and its
|
|
@@ -53,6 +75,10 @@ export type CliTelemetry = {
|
|
|
53
75
|
logger: WorkflowTelemetryLogger;
|
|
54
76
|
store: TelemetryStore<unknown>;
|
|
55
77
|
envDenied: boolean;
|
|
78
|
+
/** The environment denial was overridden ({@link createBuiltinTelemetry}):
|
|
79
|
+
* the store sends despite CI / `DO_NOT_TRACK`, subject only to
|
|
80
|
+
* account consent. */
|
|
81
|
+
forceSend: boolean;
|
|
56
82
|
} | {
|
|
57
83
|
kind: 'provided';
|
|
58
84
|
logger: WorkflowTelemetryLogger;
|
|
@@ -66,11 +92,16 @@ export declare function cliTelemetry(): CliTelemetry;
|
|
|
66
92
|
export declare function setCliTelemetry(telemetry: CliTelemetry): void;
|
|
67
93
|
export declare function clearCliTelemetry(): void;
|
|
68
94
|
/** Build the built-in Sanity-intake shell over an authenticated,
|
|
69
|
-
* project-bound client.
|
|
95
|
+
* project-bound client. `forceSend` overrides the environment denial
|
|
96
|
+
* (CI / `DO_NOT_TRACK`) — an explicit `--share-defs` opts the deploy
|
|
97
|
+
* invocation's telemetry in regardless (a command-line arg beats env
|
|
98
|
+
* vars). Account-level consent is unaffected: the intake still fetches
|
|
99
|
+
* `/intake/telemetry-status`, so `sanity telemetry disable` still mutes. */
|
|
70
100
|
export declare function createBuiltinTelemetry(args: {
|
|
71
101
|
client: TelemetryIntakeClient;
|
|
72
102
|
projectId: string;
|
|
73
103
|
env: Record<string, string | undefined>;
|
|
104
|
+
forceSend?: boolean;
|
|
74
105
|
}): Extract<CliTelemetry, {
|
|
75
106
|
kind: 'builtin';
|
|
76
107
|
}>;
|
package/dist/lib/telemetry.js
CHANGED
|
@@ -8,7 +8,12 @@ export const WorkflowCliCommandExecuted = defineTrace({
|
|
|
8
8
|
export const WorkflowDefinitionShared = defineEvent({
|
|
9
9
|
name: 'Editorial Workflows Definition Shared',
|
|
10
10
|
version: 1,
|
|
11
|
-
description: 'A newly created workflow definition version was donated
|
|
11
|
+
description: 'A newly created workflow definition version was donated to Sanity. Content-free marker: the content hash plus the same structural counts Editorial Workflows Definition Deployed carries — the document itself goes to the first-party definition-feedback endpoint, never through telemetry.',
|
|
12
|
+
});
|
|
13
|
+
export const WorkflowDefinitionSharingDecided = defineEvent({
|
|
14
|
+
name: 'Editorial Workflows Definition Sharing Decided',
|
|
15
|
+
version: 1,
|
|
16
|
+
description: 'One per deploy invocation that created new definition versions: how the donation decision was reached and what it was (explicit flag / prompt accept-or-decline / remembered / unattended), whether anything reached the endpoint, and how many versions were eligible. Content-free — lets adoption dashboards separate explicit opt-outs, prompt declines, and unattended runs, and measure the true opt-out rate, without ever carrying the document.',
|
|
12
17
|
});
|
|
13
18
|
const OFF = { kind: 'off', logger: noopTelemetry };
|
|
14
19
|
let current = OFF;
|
|
@@ -28,10 +33,10 @@ export function clearCliTelemetry() {
|
|
|
28
33
|
activeTrace = undefined;
|
|
29
34
|
}
|
|
30
35
|
export function createBuiltinTelemetry(args) {
|
|
31
|
-
const { client, projectId, env } = args;
|
|
36
|
+
const { client, projectId, env, forceSend = false } = args;
|
|
32
37
|
const envDenied = isTelemetryEnvDenied(env);
|
|
33
|
-
const store = createBatchedStore(createSessionId(), createTelemetryIntake({ client, projectId, denied: envDenied }));
|
|
34
|
-
return { kind: 'builtin', logger: store.logger, store, envDenied };
|
|
38
|
+
const store = createBatchedStore(createSessionId(), createTelemetryIntake({ client, projectId, denied: forceSend ? false : envDenied }));
|
|
39
|
+
return { kind: 'builtin', logger: store.logger, store, envDenied, forceSend };
|
|
35
40
|
}
|
|
36
41
|
function traceAsLogEvent(trace) {
|
|
37
42
|
const { name, version, description } = trace;
|
package/dist/lib/ui.js
CHANGED
package/oclif.manifest.json
CHANGED
|
@@ -91,10 +91,10 @@
|
|
|
91
91
|
"multiple": false,
|
|
92
92
|
"type": "option"
|
|
93
93
|
},
|
|
94
|
-
"share-
|
|
95
|
-
"description": "Share the definition documents newly created by this deploy with Sanity — the full document, verbatim (structure, names, filters, effect configuration, seeded values), plus its deployment coordinates (project and dataset, or resource id); never content documents, instances, or your Sanity auth token. Opt-
|
|
96
|
-
"name": "share-
|
|
97
|
-
"allowNo":
|
|
94
|
+
"share-defs": {
|
|
95
|
+
"description": "Share the definition documents newly created by this deploy with Sanity — the full document, verbatim (structure, names, filters, effect configuration, seeded values), plus its deployment coordinates (project and dataset, or resource id); never content documents, instances, or your Sanity auth token. Opt-out: an interactive terminal is asked once (the answer is remembered), while unattended runs (CI / non-TTY / DO_NOT_TRACK) share nothing unless --share-defs is passed. Use --no-share-defs to opt out. An explicit --share-defs also sends telemetry for this deploy regardless of CI / DO_NOT_TRACK.",
|
|
96
|
+
"name": "share-defs",
|
|
97
|
+
"allowNo": true,
|
|
98
98
|
"type": "boolean"
|
|
99
99
|
}
|
|
100
100
|
},
|
|
@@ -225,11 +225,12 @@
|
|
|
225
225
|
"list": {
|
|
226
226
|
"aliases": [],
|
|
227
227
|
"args": {},
|
|
228
|
-
"description": "List workflow instances in the configured dataset.",
|
|
228
|
+
"description": "List workflow instances in the configured dataset (in-flight by default).",
|
|
229
229
|
"examples": [
|
|
230
230
|
"<%= config.bin %> list",
|
|
231
|
-
"<%= config.bin %> list --
|
|
231
|
+
"<%= config.bin %> list --include-completed",
|
|
232
232
|
"<%= config.bin %> list --definition productLaunch",
|
|
233
|
+
"<%= config.bin %> list --document dataset:proj:ds:article-1",
|
|
233
234
|
"<%= config.bin %> list --tag prod"
|
|
234
235
|
],
|
|
235
236
|
"flags": {
|
|
@@ -240,9 +241,9 @@
|
|
|
240
241
|
"multiple": false,
|
|
241
242
|
"type": "option"
|
|
242
243
|
},
|
|
243
|
-
"
|
|
244
|
-
"description": "
|
|
245
|
-
"name": "
|
|
244
|
+
"include-completed": {
|
|
245
|
+
"description": "Include completed/aborted instances (default: in-flight only).",
|
|
246
|
+
"name": "include-completed",
|
|
246
247
|
"allowNo": false,
|
|
247
248
|
"type": "boolean"
|
|
248
249
|
},
|
|
@@ -259,6 +260,13 @@
|
|
|
259
260
|
"multiple": false,
|
|
260
261
|
"type": "option"
|
|
261
262
|
},
|
|
263
|
+
"document": {
|
|
264
|
+
"description": "Only instances that reference this document (resource-qualified GDR URI, e.g. \"dataset:proj:ds:article-1\").",
|
|
265
|
+
"name": "document",
|
|
266
|
+
"hasDynamicHelp": false,
|
|
267
|
+
"multiple": false,
|
|
268
|
+
"type": "option"
|
|
269
|
+
},
|
|
262
270
|
"limit": {
|
|
263
271
|
"description": "Maximum rows to return.",
|
|
264
272
|
"name": "limit",
|
|
@@ -282,6 +290,45 @@
|
|
|
282
290
|
"list.js"
|
|
283
291
|
]
|
|
284
292
|
},
|
|
293
|
+
"nuke": {
|
|
294
|
+
"aliases": [],
|
|
295
|
+
"args": {},
|
|
296
|
+
"description": "The reset for a dataset holding engine documents the versioned upgrade framework cannot yet migrate: deletes the tag's instances, definitions, and guards (across every alias-bound resource). Content documents are never touched. Prints a dry-run plan, then requires you to type back every involved dataset (--force skips the prompt; the plan still prints).",
|
|
297
|
+
"examples": [
|
|
298
|
+
"<%= config.bin %> nuke --tag plugin-dev",
|
|
299
|
+
"<%= config.bin %> nuke --tag plugin-dev --force"
|
|
300
|
+
],
|
|
301
|
+
"flags": {
|
|
302
|
+
"tag": {
|
|
303
|
+
"description": "The deployment tag to reset. Required — a destructive reset never guesses the environment.",
|
|
304
|
+
"name": "tag",
|
|
305
|
+
"required": true,
|
|
306
|
+
"hasDynamicHelp": false,
|
|
307
|
+
"multiple": false,
|
|
308
|
+
"type": "option"
|
|
309
|
+
},
|
|
310
|
+
"force": {
|
|
311
|
+
"description": "Skip the confirmation prompt (for scripts/CI). The plan still prints.",
|
|
312
|
+
"name": "force",
|
|
313
|
+
"allowNo": false,
|
|
314
|
+
"type": "boolean"
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
"hasDynamicHelp": false,
|
|
318
|
+
"hiddenAliases": [],
|
|
319
|
+
"id": "nuke",
|
|
320
|
+
"pluginAlias": "@sanity/workflow-cli",
|
|
321
|
+
"pluginName": "@sanity/workflow-cli",
|
|
322
|
+
"pluginType": "core",
|
|
323
|
+
"strict": true,
|
|
324
|
+
"summary": "Delete every engine-owned document for a deployment tag — the dev-period big red button.",
|
|
325
|
+
"isESM": true,
|
|
326
|
+
"relativePath": [
|
|
327
|
+
"dist",
|
|
328
|
+
"commands",
|
|
329
|
+
"nuke.js"
|
|
330
|
+
]
|
|
331
|
+
},
|
|
285
332
|
"reset-activity": {
|
|
286
333
|
"aliases": [],
|
|
287
334
|
"args": {
|
|
@@ -426,7 +473,8 @@
|
|
|
426
473
|
"examples": [
|
|
427
474
|
"<%= config.bin %> start productLaunch",
|
|
428
475
|
"<%= config.bin %> start article-review --field subject='{\"id\":\"dataset:proj:ds:article-1\",\"type\":\"article\"}'",
|
|
429
|
-
"<%= config.bin %> start productLaunch --version 2 --tag prod"
|
|
476
|
+
"<%= config.bin %> start productLaunch --version 2 --tag prod",
|
|
477
|
+
"<%= config.bin %> start productLaunch --instance-id prod.wf-instance.a1b2c3d4e5f6"
|
|
430
478
|
],
|
|
431
479
|
"flags": {
|
|
432
480
|
"tag": {
|
|
@@ -451,6 +499,13 @@
|
|
|
451
499
|
"multiple": true,
|
|
452
500
|
"type": "option"
|
|
453
501
|
},
|
|
502
|
+
"instance-id": {
|
|
503
|
+
"description": "Start under this instance id — for retries. The id is the start's idempotency key: pass the id of a start that failed partway and the engine resumes it instead of creating a duplicate (an already-settled start replays as a no-op). Omit to mint a fresh id.",
|
|
504
|
+
"name": "instance-id",
|
|
505
|
+
"hasDynamicHelp": false,
|
|
506
|
+
"multiple": false,
|
|
507
|
+
"type": "option"
|
|
508
|
+
},
|
|
454
509
|
"json": {
|
|
455
510
|
"description": "Emit structured JSON instead of rendered output.",
|
|
456
511
|
"name": "json",
|
|
@@ -701,5 +756,5 @@
|
|
|
701
756
|
]
|
|
702
757
|
}
|
|
703
758
|
},
|
|
704
|
-
"version": "0.
|
|
759
|
+
"version": "0.12.0"
|
|
705
760
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/workflow-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Command-line tool for deploying, inspecting, and administering Sanity workflow definitions and instances.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -56,15 +56,15 @@
|
|
|
56
56
|
"jiti": "^2.7.0",
|
|
57
57
|
"log-symbols": "^7.0.1",
|
|
58
58
|
"ora": "^9.4.0",
|
|
59
|
-
"@sanity/workflow-engine": "0.
|
|
59
|
+
"@sanity/workflow-engine": "0.17.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/diff": "^8.0.0",
|
|
63
63
|
"@types/node": "^24.12.4",
|
|
64
64
|
"oclif": "^4.23.16",
|
|
65
65
|
"vitest": "^4.1.8",
|
|
66
|
-
"@sanity/workflow-engine-test": "0.
|
|
67
|
-
"@sanity/workflow-examples": "0.
|
|
66
|
+
"@sanity/workflow-engine-test": "0.12.0",
|
|
67
|
+
"@sanity/workflow-examples": "0.7.0"
|
|
68
68
|
},
|
|
69
69
|
"oclif": {
|
|
70
70
|
"bin": "sanity-workflows",
|