@sanity/workflow-cli 0.31.0 → 0.33.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/dist/lib/ui.js CHANGED
@@ -1,7 +1,4 @@
1
1
  import { stripVTControlCharacters, styleText } from 'node:util';
2
- import { formatDistanceToNow } from 'date-fns/formatDistanceToNow';
3
- import { lightFormat } from 'date-fns/lightFormat';
4
- import { parseISO } from 'date-fns/parseISO';
5
2
  import logSymbols from 'log-symbols';
6
3
  export function sectionHeader(title) {
7
4
  return styleText('bold', `${title}:`);
@@ -61,17 +58,3 @@ export const activityIcon = {
61
58
  failed: logSymbols.error,
62
59
  skipped: styleText('dim', '⊘'),
63
60
  };
64
- function parseTimestamp(iso) {
65
- if (!iso)
66
- return undefined;
67
- const date = parseISO(iso);
68
- return Number.isNaN(date.getTime()) ? undefined : date;
69
- }
70
- export function formatTimestamp(iso) {
71
- const date = parseTimestamp(iso);
72
- return date ? lightFormat(date, 'yyyy-MM-dd HH:mm:ss') : iso;
73
- }
74
- export function formatAge(iso) {
75
- const date = parseTimestamp(iso);
76
- return date ? `${formatDistanceToNow(date)} ago` : iso;
77
- }
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * First argv tokens that belong under {@link WORKFLOWS_TOPIC}.
3
3
  * Keep in sync with `src/commands/workflows/` (top-level command
4
- * files plus the `definition` subtopic directory).
4
+ * files plus the `blueprint` and `definition` subtopic directories).
5
5
  */
6
- export declare const STANDALONE_ROOT_COMMANDS: readonly ["abort", "definition", "deploy", "diagnose", "fire-action", "list", "nuke", "reset-activity", "set-stage", "show", "start", "tail"];
6
+ export declare const STANDALONE_ROOT_COMMANDS: readonly ["abort", "blueprint", "definition", "deploy", "diagnose", "fire-action", "list", "nuke", "reset-activity", "set-stage", "show", "start", "tail"];
7
7
  /** Index of the first argv token that is not a flag (and not `--`). */
8
8
  export declare function firstPositionalIndex(args: string[]): number;
9
9
  /**
@@ -1,6 +1,7 @@
1
1
  import { WORKFLOWS_TOPIC } from "./command-ids.js";
2
2
  export const STANDALONE_ROOT_COMMANDS = [
3
3
  'abort',
4
+ 'blueprint',
4
5
  'definition',
5
6
  'deploy',
6
7
  'diagnose',
@@ -289,6 +289,7 @@
289
289
  "<%= config.bin %> workflows list --include-completed",
290
290
  "<%= config.bin %> workflows list --definition productLaunch",
291
291
  "<%= config.bin %> workflows list --document dataset:proj:ds:article-1",
292
+ "<%= config.bin %> workflows list --assignment-user gAda --assignment-role legal --assignment-state routed",
292
293
  "<%= config.bin %> workflows list --tag prod",
293
294
  "<%= config.bin %> workflows list --json"
294
295
  ],
@@ -326,6 +327,32 @@
326
327
  "multiple": false,
327
328
  "type": "option"
328
329
  },
330
+ "assignment-user": {
331
+ "description": "Account-global user id used for viewer-scoped assignment filtering and counts.",
332
+ "name": "assignment-user",
333
+ "hasDynamicHelp": false,
334
+ "multiple": false,
335
+ "type": "option"
336
+ },
337
+ "assignment-role": {
338
+ "description": "A literal project role held by --assignment-user. Repeat for multiple roles.",
339
+ "name": "assignment-role",
340
+ "hasDynamicHelp": false,
341
+ "multiple": true,
342
+ "type": "option"
343
+ },
344
+ "assignment-state": {
345
+ "description": "Assignment state to include: unrouted, routed (offered through a supplied role), or held. Repeat for multiple states.",
346
+ "name": "assignment-state",
347
+ "hasDynamicHelp": false,
348
+ "multiple": true,
349
+ "options": [
350
+ "unrouted",
351
+ "routed",
352
+ "held"
353
+ ],
354
+ "type": "option"
355
+ },
329
356
  "limit": {
330
357
  "description": "Maximum rows to return.",
331
358
  "name": "limit",
@@ -712,6 +739,38 @@
712
739
  "tail.js"
713
740
  ]
714
741
  },
742
+ "workflows:blueprint:generate": {
743
+ "aliases": [],
744
+ "args": {},
745
+ "description": "Experimental: generate the Sanity Blueprints runtime the definitions require, next to sanity.workflow.ts. Writes the workflow resources, one function per derived need, the effect-handler registry, and a handler stub per declared effect. Covers every deployment in the config, because the emitted resources module declares them all. These flags and this output may change before the Blueprints backend accepts the sanity.workflow resource.",
746
+ "examples": [
747
+ "<%= config.bin %> workflows blueprint generate",
748
+ "<%= config.bin %> workflows blueprint generate --check"
749
+ ],
750
+ "flags": {
751
+ "check": {
752
+ "description": "Experimental: verify the tree on disk still matches the definitions; write nothing and exit non-zero on any difference. The CI drift gate.",
753
+ "name": "check",
754
+ "allowNo": false,
755
+ "type": "boolean"
756
+ }
757
+ },
758
+ "hasDynamicHelp": false,
759
+ "hiddenAliases": [],
760
+ "id": "workflows:blueprint:generate",
761
+ "pluginAlias": "@sanity/workflow-cli",
762
+ "pluginName": "@sanity/workflow-cli",
763
+ "pluginType": "core",
764
+ "strict": true,
765
+ "isESM": true,
766
+ "relativePath": [
767
+ "dist",
768
+ "commands",
769
+ "workflows",
770
+ "blueprint",
771
+ "generate.js"
772
+ ]
773
+ },
715
774
  "workflows:definition:delete": {
716
775
  "aliases": [],
717
776
  "args": {
@@ -948,5 +1007,5 @@
948
1007
  ]
949
1008
  }
950
1009
  },
951
- "version": "0.31.0"
1010
+ "version": "0.33.0"
952
1011
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/workflow-cli",
3
- "version": "0.31.0",
3
+ "version": "0.33.0",
4
4
  "description": "Command-line tool for deploying, inspecting, and administering Sanity workflow definitions and instances.",
5
5
  "keywords": [
6
6
  "cli",
@@ -47,27 +47,33 @@
47
47
  "dependencies": {
48
48
  "@oclif/core": "^4.11.4",
49
49
  "@oclif/plugin-help": "^6.2.50",
50
- "@sanity/cli-core": "^2.1.1",
51
50
  "@sanity/client": "^7.22.1",
52
51
  "@sanity/telemetry": "^1.1.0",
53
52
  "boxen": "^8.0.1",
54
- "date-fns": "^4.4.0",
55
53
  "diff": "^9.0.0",
56
54
  "jiti": "^2.7.0",
57
55
  "log-symbols": "^7.0.1",
58
- "ora": "^9.4.0"
56
+ "ora": "^9.4.0",
57
+ "typescript": "^6.0.3"
59
58
  },
60
59
  "devDependencies": {
60
+ "@sanity/blueprints": "^0.21.0",
61
+ "@sanity/cli-core": "^3.6.0",
62
+ "@sanity/functions": "^1.7.2",
61
63
  "@types/diff": "^8.0.0",
62
64
  "@types/node": "^24.12.4",
63
65
  "oclif": "^4.23.16",
64
66
  "vitest": "^4.1.8",
65
- "@sanity/workflow-engine": "0.31.0",
66
- "@sanity/workflow-engine-test": "0.31.0",
67
- "@sanity/workflow-examples": "0.11.1"
67
+ "@sanity/workflow-blueprint": "0.33.0",
68
+ "@sanity/workflow-engine": "0.33.0",
69
+ "@sanity/workflow-engine-test": "0.33.0",
70
+ "@sanity/workflow-examples": "0.12.1",
71
+ "@sanity/workflow-test-fixtures": "0.0.0"
68
72
  },
69
73
  "peerDependencies": {
70
- "@sanity/workflow-engine": "0.31.0"
74
+ "@sanity/cli-core": "^3.6.0",
75
+ "@sanity/workflow-blueprint": "0.33.0",
76
+ "@sanity/workflow-engine": "0.33.0"
71
77
  },
72
78
  "oclif": {
73
79
  "bin": "sanity-workflows",
@@ -86,6 +92,9 @@
86
92
  "workflows": {
87
93
  "description": "Deploy, inspect, and administer Workflows definitions and instances",
88
94
  "subtopics": {
95
+ "blueprint": {
96
+ "description": "Generate and verify the Sanity Blueprints runtime the definitions require"
97
+ },
89
98
  "definition": {
90
99
  "description": "Read and manage workflow definitions"
91
100
  }
@@ -98,6 +107,7 @@
98
107
  },
99
108
  "scripts": {
100
109
  "build": "rm -rf dist && tsc -p tsconfig.build.json && tsc -p tsconfig.declarations.json",
110
+ "docs": "node ../../scripts/run-typedoc.mjs",
101
111
  "typecheck": "tsc --noEmit -p tsconfig.json",
102
112
  "test": "vitest run",
103
113
  "test:packaging": "vitest run --config vitest.packaging.config.ts",