@sanity/workflow-cli 0.28.0 → 0.29.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 CHANGED
@@ -1,5 +1,33 @@
1
1
  # @sanity/workflow-cli
2
2
 
3
+ ## 0.29.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 8bb6a85: The workflow CLI README lists commands with operator-facing descriptions instead of implementation status.
8
+
9
+ **No upgrade action required.** Command behavior is unchanged.
10
+
11
+ **Docs impact:** `packages/workflow-cli` README — the former Command status table is now Command list.
12
+
13
+ - 772876b: When this package is mounted inside the official `sanity` CLI, its telemetry prerun hook no longer installs a store for host commands outside the `workflows` topic (the finally hook already no-ops when telemetry was never installed). Previously every `sanity` command in a directory with a `sanity.workflow.ts` could load workflow config, show the workflow-cli disclosure, and emit an `Editorial Workflows CLI Command Executed` event for unrelated commands such as `sanity dataset list`. Standalone `sanity-workflows` behaviour is unchanged.
14
+
15
+ **No upgrade action required** for standalone users. Hosts that already mount this package as an oclif plugin pick up the safer hook scope on upgrade — no config change.
16
+
17
+ **Docs impact:** None — host-mount telemetry scoping only; documented invoke paths are unchanged.
18
+
19
+ - 772876b: The `workflows` topic help description no longer uses an em dash. It now reads "Deploy, inspect, and administer Editorial Workflows definitions and instances", matching the plain phrasing of other product CLI topics.
20
+
21
+ **No upgrade action required.**
22
+
23
+ **Docs impact:** None — help copy only; documented invoke paths are unchanged.
24
+
25
+ - Updated dependencies [f44fc33]
26
+ - Updated dependencies [26f25e0]
27
+ - Updated dependencies [25bd1fb]
28
+ - Updated dependencies [3fd04f1]
29
+ - @sanity/workflow-engine@0.29.0
30
+
3
31
  ## 0.28.0
4
32
 
5
33
  ### Minor Changes
package/README.md CHANGED
@@ -153,30 +153,32 @@ stale compiled output.
153
153
  > `--dry-run` and `--only` don't collide with pnpm flags and work
154
154
  > through the normal `pnpm --filter … dev …` invocation.
155
155
 
156
- ## Command status
157
-
158
- | Command | Status |
159
- | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
160
- | `deploy` | wired — calls `workflow.deployDefinitions` over the selected deployment's definitions |
161
- | `deploy --all-tags` | wired — deploys every deployment in the config, continuing past per-deployment failures |
162
- | `deploy --check` | wired runs `validateDefinition` over the local batch + a duplicate-name check |
163
- | `deploy --dry-run` | wired fetches existing docs and renders a coloured JSON diff per change |
164
- | `deploy --only <name>` | wired filters deploy/check/dry-run to one definition by `name` |
165
- | `start <name>` | wired calls `workflow.startInstance` (`--field` for input fields) |
166
- | `list` | wired `client.fetch` over `sanity.workflow.instance` documents (`--definition <name>` to filter) |
167
- | `show <instance-id>` | wired `client.getDocument` |
168
- | `diagnose <instance-id>` | wired calls `workflow.diagnose`, classifies why the instance is/isn't progressing |
169
- | `tail <instance-id>` | wired `client.listen()` over the instance, prints new history entries |
170
- | `abort <instance-id>` | wired calls `workflow.abortInstance` (hard stop: cancels pending effects, removes guards) |
171
- | `set-stage <instance-id> --to <stage>` | wired calls `workflow.setStage` (admin override: skips declared transitions/filters; enter lifecycle + cascade still run) |
172
- | `reset-activity <instance-id> <activity>` | wired calls `workflow.resetActivity` (recovery override: reset a failed activity to `active`, or `--skip` to bypass it; then cascade) |
173
- | `fire-action <instance-id>` | wired `workflow.availableActions` lists actions; `workflow.fireAction` fires one |
174
- | `definition list` | wired `client.fetch` over `sanity.workflow.definition` documents |
175
- | `definition show <name>` | wired `client.fetch`, latest version unless `--version` |
176
- | `definition diff <name>` | wired — diffs the in-code definition against the deployed latest (`--version` to pin) |
177
- | `definition delete <name>` | wired calls `workflow.deleteDefinition` (refuses on live instances unless `--cascade`) |
178
- | `nuke --deployment <name>` / `nuke --tag <tag>` | wired — dev-period reset (exists only until the versioned upgrade framework): deletes every engine-owned doc for the deployment's tag (instances, definitions, guards across resources); exactly one of these two selectors required; refuses while another same-tag deployment sweeps an overlapping resource (guard ids embed only the tag); plan + typed confirm |
179
- | `nuke --instance <id>` | wired dev-period reset, same fence as the tag mode above: deletes ONE terminal instance plus the guards it owns, swept across every alias-bound resource (matched by `sourceInstanceId`, with an id-prefix leg as redundant cover; matching provenance rather than the live instance set is what catches a partial-delete orphan); definitions are never in scope; refuses an in-flight instance (abort it first) and anything that is not an engine instance document; takes no `--tag`, and `--deployment` only to disambiguate a tag spanning deployments; plan + `y/N` confirm |
156
+ ## Command list
157
+
158
+ Invoke as `sanity-workflows <command>` (or `sanity workflows <command>` once the host CLI mount lands).
159
+
160
+ | Command | Description |
161
+ | ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
162
+ | `deploy` | Validate and deploy the definitions in the selected deployment. |
163
+ | `deploy --all-tags` | Deploy every deployment in the config. A failure in one does not stop the rest. |
164
+ | `deploy --check` | Validate local definitions without contacting the dataset. |
165
+ | `deploy --dry-run` | Show a diff against what is already deployed, without writing. |
166
+ | `deploy --only <name>` | Limit deploy, check, or dry-run to one definition. |
167
+ | `start <name>` | Start an instance from a deployed definition. Pass `--field` for input values. |
168
+ | `list` | List instances (in-flight by default). Filter with `--definition`. |
169
+ | `show <instance-id>` | Show an instance's state, activities, and effects. |
170
+ | `diagnose <instance-id>` | Explain why an instance is or isn't progressing, and what would unstick it. |
171
+ | `tail <instance-id>` | Stream new history entries as they land. |
172
+ | `abort <instance-id>` | Stop an in-flight instance. Pending effects cancel; the instance stays where it is. |
173
+ | `set-stage <instance-id> --to <stage>` | Move an instance to a stage, skipping declared transitions. The target stage's enter lifecycle still runs. |
174
+ | `reset-activity <instance-id> <activity>` | Re-run a failed activity, or `--skip` it so a gated transition can fire. |
175
+ | `fire-action <instance-id>` | Fire an action on a waiting activity. Omit `--action` to list what can be fired. |
176
+ | `definition list` | List deployed definitions. |
177
+ | `definition show <name>` | Show a deployed definition (latest version, or `--version`). |
178
+ | `definition diff <name>` | Diff the in-code definition against what is deployed. |
179
+ | `definition delete <name>` | Delete a deployed definition. Refuses while live instances exist unless `--cascade`. |
180
+ | `nuke --deployment <name>` / `nuke --tag <tag>` | Dev reset: delete every engine-owned document for that tag (instances, definitions, guards). Prints a plan, then asks for confirmation. Content documents are never touched. |
181
+ | `nuke --instance <id>` | Dev reset: delete one finished instance and its guards. Refuses in-flight instances (abort first). |
180
182
 
181
183
  ## Telemetry
182
184
 
@@ -1,2 +1,10 @@
1
1
  export declare const WORKFLOWS_TOPIC = "workflows";
2
+ export declare const WORKFLOWS_TOPIC_PREFIX = "workflows:";
2
3
  export declare const WORKFLOWS_DEPLOY_COMMAND_ID = "workflows:deploy";
4
+ /** Standalone binary name from package.json `oclif.bin` / `bin`. */
5
+ export declare const STANDALONE_BIN = "sanity-workflows";
6
+ /** True on `sanity-workflows`, or on a host only for `workflows` / `workflows:*`. */
7
+ export declare function shouldRunWorkflowCliTelemetry(args: {
8
+ bin: string;
9
+ commandId: string | undefined;
10
+ }): boolean;
@@ -1,2 +1,10 @@
1
1
  export const WORKFLOWS_TOPIC = 'workflows';
2
+ export const WORKFLOWS_TOPIC_PREFIX = `${WORKFLOWS_TOPIC}:`;
2
3
  export const WORKFLOWS_DEPLOY_COMMAND_ID = `${WORKFLOWS_TOPIC}:deploy`;
4
+ export const STANDALONE_BIN = 'sanity-workflows';
5
+ export function shouldRunWorkflowCliTelemetry(args) {
6
+ const { bin, commandId } = args;
7
+ return (bin === STANDALONE_BIN ||
8
+ commandId === WORKFLOWS_TOPIC ||
9
+ commandId?.startsWith(WORKFLOWS_TOPIC_PREFIX) === true);
10
+ }
package/dist/help.js CHANGED
@@ -1,13 +1,12 @@
1
1
  import { Help } from '@oclif/core';
2
- import { WORKFLOWS_TOPIC } from "./command-ids.js";
3
- const TOPIC_PREFIX = `${WORKFLOWS_TOPIC}:`;
2
+ import { WORKFLOWS_TOPIC, WORKFLOWS_TOPIC_PREFIX } from "./command-ids.js";
4
3
  const CANONICAL_EXAMPLE_PREFIX = `<%= config.bin %> ${WORKFLOWS_TOPIC} `;
5
4
  const STANDALONE_EXAMPLE_PREFIX = '<%= config.bin %> ';
6
5
  const HELP_COMMAND_ID = 'help';
7
6
  export const standaloneSurfaceId = (id) => {
8
- if (!id.startsWith(TOPIC_PREFIX))
7
+ if (!id.startsWith(WORKFLOWS_TOPIC_PREFIX))
9
8
  return undefined;
10
- return id.slice(TOPIC_PREFIX.length);
9
+ return id.slice(WORKFLOWS_TOPIC_PREFIX.length);
11
10
  };
12
11
  export const keepCommandAtRoot = (id) => id === HELP_COMMAND_ID || standaloneSurfaceId(id) !== undefined;
13
12
  export const standaloneExample = (example) => {
@@ -2,7 +2,8 @@ import type { Hook } from '@oclif/core';
2
2
  /**
3
3
  * Completes the command trace — command id, declared-flag names, success —
4
4
  * and flushes the final batch. Runs on success and on error alike (oclif's
5
- * `finally`); an invocation the prerun hook left with telemetry off no-ops.
5
+ * `finally`); an invocation the prerun hook left with telemetry off no-ops,
6
+ * which is what keeps host commands outside the `workflows` topic silent.
6
7
  */
7
8
  declare const hook: Hook<'finally'>;
8
9
  export default hook;
@@ -4,6 +4,7 @@ import type { Hook } from '@oclif/core';
4
4
  * A deploy that may share definitions—flagless by default or explicitly
5
5
  * enabled—forces the store to send despite CI / `DO_NOT_TRACK`. This is
6
6
  * resolved from raw argv because the store is built before oclif parses
7
- * flags. */
7
+ * flags. Skips non-workflows commands when this package is mounted as a
8
+ * host plugin so `sanity dataset list` does not inherit the shell. */
8
9
  declare const hook: Hook<'prerun'>;
9
10
  export default hook;
@@ -1,6 +1,13 @@
1
+ import { shouldRunWorkflowCliTelemetry } from "../../command-ids.js";
1
2
  import { shouldForceShareTelemetry } from "../../lib/share-definitions.js";
2
3
  import { setupCliTelemetry } from "../../lib/telemetry-setup.js";
3
4
  const hook = async function ({ config, Command, argv }) {
5
+ if (!shouldRunWorkflowCliTelemetry({
6
+ bin: config.bin,
7
+ commandId: Command?.id,
8
+ })) {
9
+ return;
10
+ }
4
11
  await setupCliTelemetry({
5
12
  cliVersion: config.version,
6
13
  forceSend: shouldForceShareTelemetry({ commandId: Command?.id, argv }),
@@ -948,5 +948,5 @@
948
948
  ]
949
949
  }
950
950
  },
951
- "version": "0.28.0"
951
+ "version": "0.29.0"
952
952
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/workflow-cli",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "description": "Command-line tool for deploying, inspecting, and administering Sanity workflow definitions and instances.",
5
5
  "keywords": [
6
6
  "cli",
@@ -62,12 +62,12 @@
62
62
  "@types/node": "^24.12.4",
63
63
  "oclif": "^4.23.16",
64
64
  "vitest": "^4.1.8",
65
- "@sanity/workflow-engine": "0.28.0",
66
- "@sanity/workflow-engine-test": "0.28.0",
67
- "@sanity/workflow-examples": "0.10.7"
65
+ "@sanity/workflow-engine": "0.29.0",
66
+ "@sanity/workflow-engine-test": "0.29.0",
67
+ "@sanity/workflow-examples": "0.10.8"
68
68
  },
69
69
  "peerDependencies": {
70
- "@sanity/workflow-engine": "0.28.0"
70
+ "@sanity/workflow-engine": "0.29.0"
71
71
  },
72
72
  "oclif": {
73
73
  "bin": "sanity-workflows",
@@ -84,7 +84,7 @@
84
84
  "topicSeparator": " ",
85
85
  "topics": {
86
86
  "workflows": {
87
- "description": "Editorial Workflows — deploy, inspect, and administer definitions and instances",
87
+ "description": "Deploy, inspect, and administer Editorial Workflows definitions and instances",
88
88
  "subtopics": {
89
89
  "definition": {
90
90
  "description": "Read and manage workflow definitions"