@sanity/workflow-cli 0.32.0 → 0.34.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 +153 -0
- package/README.md +361 -50
- package/dist/commands/workflows/blueprint/generate.d.ts +9 -0
- package/dist/commands/workflows/blueprint/generate.js +28 -0
- package/dist/commands/workflows/diagnose.d.ts +4 -2
- package/dist/commands/workflows/diagnose.js +11 -82
- package/dist/commands/workflows/show.d.ts +3 -5
- package/dist/commands/workflows/show.js +28 -1
- package/dist/hooks/prerun/telemetry.d.ts +6 -0
- package/dist/hooks/prerun/telemetry.js +14 -7
- package/dist/lib/blueprint-emit.d.ts +30 -0
- package/dist/lib/blueprint-emit.js +147 -0
- package/dist/lib/blueprint-needs.d.ts +2 -0
- package/dist/lib/blueprint-needs.js +109 -0
- package/dist/lib/cause-detail.d.ts +9 -0
- package/dist/lib/cause-detail.js +111 -0
- package/dist/lib/load-config.d.ts +20 -0
- package/dist/lib/load-config.js +16 -13
- package/dist/lib/share-definitions.d.ts +2 -2
- package/dist/lib/share-definitions.js +2 -2
- package/dist/lib/telemetry-setup.d.ts +2 -0
- package/dist/lib/telemetry-setup.js +2 -2
- package/dist/lib/telemetry.d.ts +5 -2
- package/dist/lib/telemetry.js +13 -4
- package/dist/standalone-argv.d.ts +2 -2
- package/dist/standalone-argv.js +1 -0
- package/oclif.manifest.json +33 -1
- package/package.json +15 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,158 @@
|
|
|
1
1
|
# @sanity/workflow-cli
|
|
2
2
|
|
|
3
|
+
## 0.34.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [00bb88f]
|
|
8
|
+
- @sanity/workflow-blueprint@0.34.0
|
|
9
|
+
- @sanity/workflow-engine@0.34.0
|
|
10
|
+
|
|
11
|
+
## 0.33.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- 225e0fb: **BREAKING:** Workflows App SDK and Studio integrations now require `@sanity/sdk` 3.1 or later in the 3.x line, and `@sanity/workflow-sdk` requires the matching `@sanity/sdk-react` 3.1 line when its React entry is used. The previous SDK 2 peer contract is no longer supported. The exported `WorkflowClient`, `TelemetryIntakeClient`, `ProjectUserProfileClient`, and `StudioUserClient` request contracts now pass their target in `url`; the previous `uri` request target is no longer used. The engine's effective client config also accepts the broader `{type: string, id: string}` resource descriptors returned by Sanity client 8.
|
|
16
|
+
|
|
17
|
+
Before upgrading Workflows, upgrade `@sanity/sdk` and `@sanity/sdk-react` together to 3.1 or later. Applications that stay on SDK 2 must stay on an earlier Workflows release. If you implement any of the request contracts named above, update it to read the request target from `url` instead of `uri`; otherwise its request-backed reads will fail. Existing `WorkflowClient.config()` implementations need no change when their resource descriptor already has string `type` and `id` fields. No separate CLI upgrade action is required; its definition-sharing and telemetry requests adopt `url` internally.
|
|
18
|
+
|
|
19
|
+
Before installing, override SDK 3's `@sanity/mutate` dependency to `0.18.2` in your application's root package-manager configuration, reinstall, and commit the updated lockfile. SDK 3.1.0 allows Mutate 0.18.1, which can leave document reads pending with client 8. For npm, set `overrides["@sanity/sdk"]["@sanity/mutate"]` to `"0.18.2"` in `package.json`. For pnpm, set `overrides['@sanity/sdk@3>@sanity/mutate']` to `0.18.2` in `pnpm-workspace.yaml`. Keep the override until your SDK release requires Mutate 0.18.2 or later. Complete examples and verification steps are in the Installation section of the published `@sanity/workflow-sdk` README.
|
|
20
|
+
|
|
21
|
+
Malformed project-member responses now report an inaccessible directory and can recover on a later lookup, instead of being cached as a missing user. No additional upgrade action is required for this correction.
|
|
22
|
+
|
|
23
|
+
**Docs impact:** Update the App SDK and Studio integration installation guidance, package compatibility references, and examples to require Sanity App SDK 3.1 and the consumer Mutate override described in the published `@sanity/workflow-sdk` README; update the client API references for `request({url})`, effective resource descriptors, and directory-response failures.
|
|
24
|
+
|
|
25
|
+
- ba031fe: **Experimental, and not ready for production use in this release.** Both commands are available so you can try the generated runtime and give feedback; their flags and their output may still change. What you would hit today:
|
|
26
|
+
- The start watcher runs on every create and update of a subject type, not only on writes that can actually start a workflow, so it wakes for documents that already have an instance or match no definition. The heartbeat is scheduled every minute and evaluates every in-flight instance in the tag when it runs; how often the platform runs it is a plan limit.
|
|
27
|
+
- `sanity-workflows deploy` does not check the generated tree, so drift between your definitions and the tree on disk is caught only by `blueprint generate --check` in CI.
|
|
28
|
+
- Definitions and functions deploy in two steps, definitions first, until the Blueprints service registers the `sanity.workflow` resource.
|
|
29
|
+
- A generated file cannot be taken over: editing one is drift, and the next generation rewrites it.
|
|
30
|
+
- A retry policy is not checked against its function's timeout at generation, so an effect can be configured to retry for longer than its function may run.
|
|
31
|
+
|
|
32
|
+
All of these are tracked, and the next release is the bar for using this in production.
|
|
33
|
+
|
|
34
|
+
`sanity-workflows blueprint generate` generates the Sanity Blueprints runtime your definitions require and writes it next to `sanity.workflow.ts`. It prints the needs analysis first — which effects force a drain function, which `$now` condition forces a scheduled heartbeat, which autonomous definition forces a start watcher, and the explicit "no functions needed" answer for a purely interactive workflow — then writes `workflows.blueprint.ts`, one function module and manifest per derived need, the effect-handler registry, and one handler stub per declared effect name. Handler stubs are yours: they are scaffolded once and never overwritten. Your own `sanity.blueprint.ts` receives the `workflowResources` import and spread once. The command deletes nothing; a handler for an effect you removed, a scaffold blocked by a path differing only in case, and a blueprint it could not wire are reported as warnings for you to resolve. The generated tree is one artifact for the whole config, so the command always covers every deployment.
|
|
35
|
+
|
|
36
|
+
`sanity-workflows blueprint generate --check` is the CI drift gate. It renders the same runtime in memory, compares it with the files on disk, writes nothing, and exits zero when they match. Otherwise it exits 1 and lists every file with its reason — `missing`, `differs`, an orphaned handler, or a blueprint that is not wired — so a CI log says what to fix without anyone reading source. A declared effect with no handler file on disk reports as `missing`, which is the handler-coverage check.
|
|
37
|
+
|
|
38
|
+
**No upgrade action required.** Both commands are new and nothing else changes. To use them, your `sanity.workflow.ts` must export each deployment under its own `name`, and that export must be the deployment object itself — `export const production = {name: 'production', …} satisfies WorkflowDeploymentInput`, then `export default defineWorkflowConfig({deployments: [production]})` — because every generated module imports its deployment from `./sanity.workflow` by that name; a config that only default-exports fails the command with the export to add rather than writing a tree that cannot compile. The command checks the name only, so make sure each export is the deployment the config lists: a typecheck of the generated modules catches a wrong export only where a generated function uses it, and a deployment that needs no functions emits none. Your `sanity.workflow.ts` must also be importable inside a deployed function, because every generated module imports it and each function bundles it: reading an absent variable there yields `undefined`, but a config that throws when a variable is missing, or requires one to build the deployment, fails every deployed function on init. Keep the deployment's resource coordinates literal in that file and read secrets inside your handlers. Deploy your definitions with `sanity-workflows deploy` before `npx sanity blueprints deploy`, because the generated blueprint carries the definitions entry commented out until the Blueprints service accepts the `sanity.workflow` resource type, and a function that starts or advances an instance resolves its definition from the Content Lake. A generated heartbeat is a scheduled function, which the platform only accepts on an organization-scoped stack, and how often it may run is a plan limit. Also install `@sanity/blueprints`, `@sanity/functions`, and `@sanity/workflow-blueprint` in your project: each generated function's manifest copies the specifications your project declares for `@sanity/functions`, `@sanity/workflow-blueprint`, and `@sanity/workflow-engine`, and a package you declare nowhere fails the command instead of being stamped with a guessed range. `typescript` is now a dependency of the CLI, because parsing `sanity.blueprint.ts` to insert the wiring uses the TypeScript compiler.
|
|
39
|
+
|
|
40
|
+
**Docs impact:** Rewrite the cookbook chapter on running workflows on a server so it drives the runtime through these two commands rather than describing hand-written functions, and cover the CI drift check there. Update the CLI command reference with both commands, and the Blueprints concept page where it explains who writes the generated tree.
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- 393ac71: CLI and MCP telemetry now includes `context.surface` (`cli` or `mcp`) and
|
|
45
|
+
execution mode in each event's `context.environment`. Dashboards can include
|
|
46
|
+
shell and engine activity while distinguishing it from SDK events marked
|
|
47
|
+
`sdk`. Existing command trace context is preserved.
|
|
48
|
+
|
|
49
|
+
All three surfaces report `production` for `NODE_ENV=production`, and
|
|
50
|
+
`development` for `development` or `test`. Unset, empty, and unrecognized values
|
|
51
|
+
default to `production` for CLI and MCP execution mode, and `development` for
|
|
52
|
+
SDK build mode. SDK environment classification is unchanged. When comparing
|
|
53
|
+
activity across surfaces, group or filter by surface alongside environment.
|
|
54
|
+
Environment does not identify a production dataset or deployment; API host,
|
|
55
|
+
dataset name, and workflow tag do not set it.
|
|
56
|
+
|
|
57
|
+
**No upgrade action required.** Existing telemetry consent and opt-out
|
|
58
|
+
settings still apply. Historical events are unchanged.
|
|
59
|
+
|
|
60
|
+
**Docs impact:** Update CLI, MCP, and SDK telemetry guidance to explain surface
|
|
61
|
+
context, build versus execution mode, the explicit defaults, and how to
|
|
62
|
+
interpret environment when comparing activity across surfaces.
|
|
63
|
+
|
|
64
|
+
- 8874c50: **BREAKING:** A `subject`, `doc.ref`, or `doc.refs` field marked `required: true`
|
|
65
|
+
now requires its selected documents to remain readable after initialization.
|
|
66
|
+
Previously, the flag checked only that an initial value was supplied. Missing
|
|
67
|
+
required targets now produce a fault and prevent normal actions, triggered
|
|
68
|
+
actions, and transitions from advancing, even without an activity requirement
|
|
69
|
+
reading those targets. Abort and direct edits to editable fields remain
|
|
70
|
+
available. Optional references fault only when an unmet runtime condition needs
|
|
71
|
+
their content; completed workflows remain completed.
|
|
72
|
+
|
|
73
|
+
`StuckCause` adds `document-missing`. Update exhaustive handlers before upgrading,
|
|
74
|
+
or their typechecks fail and renderers have no matching branch. Evaluation
|
|
75
|
+
identifies the affected field and reference in `missingDocuments`, with its title
|
|
76
|
+
and completed availability evidence; `blockingMissingDocuments` selects the
|
|
77
|
+
references that prevent progress. The engine checks draft, published, and release
|
|
78
|
+
representations before distinguishing deletion from inaccessible content or
|
|
79
|
+
content outside the workflow perspective. Studio, CLI, and MCP use that same
|
|
80
|
+
result. Failed availability checks report unreadable content and log the cause;
|
|
81
|
+
optional references still permit unrelated actions. Incomplete reads do not
|
|
82
|
+
claim deletion, and an existing task fault keeps
|
|
83
|
+
its recovery controls. The fault clears when the required content becomes
|
|
84
|
+
readable; this release adds no undo-delete operation and does not automatically
|
|
85
|
+
abort workflows.
|
|
86
|
+
|
|
87
|
+
Upgrade every Workflows runtime sharing affected data, including Studio, CLI,
|
|
88
|
+
MCP servers, and deployed Functions, before relying on continued required-target
|
|
89
|
+
availability. Then set the deployment's reviewed `expectedMinReaderModel` to
|
|
90
|
+
`10` before deploying definitions with required content references. Writers stamp
|
|
91
|
+
model 10; this feature requires reader model 10, while documents without it keep
|
|
92
|
+
the floor required by their other features, normally 4, 8, or 9. Existing
|
|
93
|
+
instances remain readable without a backfill and adopt the rule under upgraded
|
|
94
|
+
engines. Their stored floor rises on the next full write, so an older runtime
|
|
95
|
+
can still advance an unstamped existing instance until the fleet is upgraded.
|
|
96
|
+
See `packages/workflow-engine/DATAMODEL.md` for the complete rollout contract.
|
|
97
|
+
|
|
98
|
+
The rendered CLI `show` command evaluates running instances. If evaluation fails,
|
|
99
|
+
it warns and displays stored state; terminal instances and `show --json` retain
|
|
100
|
+
their stored-state behavior.
|
|
101
|
+
|
|
102
|
+
**Docs impact:** Update field requiredness and initialization guidance, required
|
|
103
|
+
reference repair examples, the model-10 readers-first rollout, the diagnostics
|
|
104
|
+
reference for `StuckCause` and `MissingDocument`, CLI `show` and `diagnose`, MCP
|
|
105
|
+
workflow-state guidance, and the Workflows tool and document-view guides for
|
|
106
|
+
loading, deletion, permissions, and perspectives.
|
|
107
|
+
|
|
108
|
+
- 3b42bdc: The Workflows CLI command-trace now sets the oclif command id as trace context (`groupOrCommand`) when the built-in telemetry shell starts, so telemetry reporting can break invocations down by command the same way it can for other Sanity CLI commands. The id remains in the log payload as `command` for config-provided telemetry loggers.
|
|
109
|
+
|
|
110
|
+
**No upgrade action required.** Existing CLI installs begin emitting the queryable context after upgrading; historical rows are unchanged.
|
|
111
|
+
|
|
112
|
+
**Docs impact:** None — internal telemetry envelope shape for an existing event; no public API or user-facing CLI behavior change.
|
|
113
|
+
|
|
114
|
+
- 7eb9eca: Correct the API references for field initialization and edits, start requirements,
|
|
115
|
+
transitions, reference IDs, effect handling, reactive state, member controls,
|
|
116
|
+
Studio mappings, test helpers, and GROQ condition outcomes. The references state
|
|
117
|
+
caller constraints and defaults that were missing or incorrect. Package setup
|
|
118
|
+
guidance identifies the public npm packages and supported deployment command;
|
|
119
|
+
the MCP validation description distinguishes validation from deployment checks.
|
|
120
|
+
Runtime behavior and API signatures are unchanged.
|
|
121
|
+
|
|
122
|
+
**No upgrade action required.**
|
|
123
|
+
|
|
124
|
+
**Docs impact:** After release and reference sync, reconcile the modeling,
|
|
125
|
+
runtime, reactive UI, Studio, testing, deployment, MCP, and evaluation-insight
|
|
126
|
+
guides and references with the corrected contracts. Fix affected examples and
|
|
127
|
+
replace redundant API inventories with verified symbol links while preserving
|
|
128
|
+
useful teaching and the CLI/MCP reference material not exposed by TypeDoc.
|
|
129
|
+
|
|
130
|
+
- 2cef086: Internal maintenance consolidates engine action/edit handling and Studio document
|
|
131
|
+
and workflow title sorting. Action and field-edit calls retain their inputs and
|
|
132
|
+
results, and document and workflow titles retain their ordering. Action
|
|
133
|
+
availability, telemetry, and persisted document formats are unchanged.
|
|
134
|
+
|
|
135
|
+
**No upgrade action required.**
|
|
136
|
+
|
|
137
|
+
**Docs impact: None** because public APIs, configuration, and workflow behavior
|
|
138
|
+
are unchanged.
|
|
139
|
+
|
|
140
|
+
- Updated dependencies [8874c50]
|
|
141
|
+
- Updated dependencies [b3b2797]
|
|
142
|
+
- Updated dependencies [393ac71]
|
|
143
|
+
- Updated dependencies [8874c50]
|
|
144
|
+
- Updated dependencies [ba031fe]
|
|
145
|
+
- Updated dependencies [0555271]
|
|
146
|
+
- Updated dependencies [b3b2797]
|
|
147
|
+
- Updated dependencies [225e0fb]
|
|
148
|
+
- Updated dependencies [b7510cc]
|
|
149
|
+
- Updated dependencies [7eb9eca]
|
|
150
|
+
- Updated dependencies [2cef086]
|
|
151
|
+
- Updated dependencies [232f811]
|
|
152
|
+
- Updated dependencies [ba031fe]
|
|
153
|
+
- @sanity/workflow-blueprint@0.33.0
|
|
154
|
+
- @sanity/workflow-engine@0.33.0
|
|
155
|
+
|
|
3
156
|
## 0.32.0
|
|
4
157
|
|
|
5
158
|
### Minor Changes
|