@sanity/workflow-cli 0.26.0 → 0.28.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 +38 -0
- package/README.md +14 -15
- package/bin/run.js +3 -1
- package/dist/command-ids.d.ts +2 -0
- package/dist/command-ids.js +2 -0
- package/dist/commands/{editorial-workflows → workflows}/abort.d.ts +0 -1
- package/dist/commands/{editorial-workflows → workflows}/abort.js +2 -3
- package/dist/commands/{editorial-workflows → workflows}/definition/delete.d.ts +0 -1
- package/dist/commands/{editorial-workflows → workflows}/definition/delete.js +3 -4
- package/dist/commands/{editorial-workflows → workflows}/definition/diff.d.ts +0 -1
- package/dist/commands/{editorial-workflows → workflows}/definition/diff.js +2 -3
- package/dist/commands/{editorial-workflows → workflows}/definition/list.d.ts +0 -1
- package/dist/commands/{editorial-workflows → workflows}/definition/list.js +3 -4
- package/dist/commands/{editorial-workflows → workflows}/definition/show.d.ts +0 -1
- package/dist/commands/{editorial-workflows → workflows}/definition/show.js +0 -1
- package/dist/commands/{editorial-workflows → workflows}/deploy.d.ts +4 -3
- package/dist/commands/{editorial-workflows → workflows}/deploy.js +15 -9
- package/dist/commands/{editorial-workflows → workflows}/diagnose.d.ts +0 -1
- package/dist/commands/{editorial-workflows → workflows}/diagnose.js +3 -4
- package/dist/commands/{editorial-workflows → workflows}/fire-action.d.ts +0 -1
- package/dist/commands/{editorial-workflows → workflows}/fire-action.js +3 -4
- package/dist/commands/{editorial-workflows → workflows}/list.d.ts +0 -1
- package/dist/commands/{editorial-workflows → workflows}/list.js +6 -7
- package/dist/commands/{editorial-workflows → workflows}/nuke.d.ts +0 -1
- package/dist/commands/{editorial-workflows → workflows}/nuke.js +3 -4
- package/dist/commands/{editorial-workflows → workflows}/reset-activity.d.ts +0 -1
- package/dist/commands/{editorial-workflows → workflows}/reset-activity.js +2 -3
- package/dist/commands/{editorial-workflows → workflows}/set-stage.d.ts +0 -1
- package/dist/commands/{editorial-workflows → workflows}/set-stage.js +3 -4
- package/dist/commands/{editorial-workflows → workflows}/show.d.ts +0 -1
- package/dist/commands/{editorial-workflows → workflows}/show.js +3 -4
- package/dist/commands/{editorial-workflows → workflows}/start.d.ts +0 -1
- package/dist/commands/{editorial-workflows → workflows}/start.js +4 -5
- package/dist/commands/{editorial-workflows → workflows}/tail.d.ts +0 -1
- package/dist/commands/{editorial-workflows → workflows}/tail.js +1 -2
- package/dist/help.d.ts +9 -4
- package/dist/help.js +36 -8
- package/dist/lib/base-command.d.ts +3 -3
- package/dist/lib/base-command.js +4 -0
- package/dist/lib/context.d.ts +5 -4
- package/dist/lib/context.js +2 -1
- package/dist/lib/select-deployment.js +2 -1
- package/dist/lib/share-definitions.js +2 -1
- package/dist/lib/telemetry.d.ts +1 -3
- package/dist/standalone-argv.d.ts +14 -0
- package/dist/standalone-argv.js +54 -0
- package/oclif.manifest.json +105 -135
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# @sanity/workflow-cli
|
|
2
2
|
|
|
3
|
+
## 0.28.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5050b06: **BREAKING:** Authoring a deployment now types through `WorkflowDeploymentInput` / `WorkflowConfigInput`, which require `expectedMinReaderModel` as the current reader-floor literal. Passing a parsed `WorkflowDeployment` / `WorkflowConfig` (where the floor is optional/unverified) into `defineWorkflowConfig` or `defineWorkflows` is a type error — share the authored deployment object instead of `config.deployments[n]`. The same pin shows up on the blueprint resource: `EditorialWorkflowsResource.deployment` and `parseWorkflowDeployment`'s return type are now `AcknowledgedDeployment` (floor asserted to the current literal), so a hand-constructed provider resource must carry that literal too.
|
|
8
|
+
|
|
9
|
+
At runtime, config parse no longer rejects a stale or missing floor on an untargeted deployment. Only deployment-scoped commands assert, and only the selected deployment: definition deploy, `--check` / `--dry-run`, blueprint provision, `start`, `definition delete`, and `definition diff` (the last is a deployment-scoped read). Instance-id commands (`fire-action`, `abort`, `set-stage`, `reset-activity`) deliberately do not assert — they resolve by instance id, not by a declared deployment's acknowledgement — so an unacknowledged floor does not stop those instance commits.
|
|
10
|
+
|
|
11
|
+
Upgrade TypeScript configs and blueprint manifests that fed a parsed deployment into those helpers: keep a shared authored object (`satisfies WorkflowDeploymentInput`) for both `defineWorkflowConfig` and `defineWorkflows`, and give any hand-built `EditorialWorkflowsResource` the current floor literal on `deployment`. Existing configs that already acknowledge the current floor keep working at runtime; a stale selected deployment still fails with `ReaderModelAcknowledgementError` (headline + short steps; the CLI renders it through the clean styled-error path).
|
|
12
|
+
|
|
13
|
+
**Docs impact:** Update the CLI / blueprint authoring examples and the prerelease reader-floor guidance so they name `WorkflowConfigInput` / `WorkflowDeploymentInput` / `AcknowledgedDeployment`, forbid passing `config.deployments[n]` into `defineWorkflows`, state that instance-id writes are outside the acknowledgement gate, and stop implying whole-config parse-time rejection for commands that never select a deployment.
|
|
14
|
+
|
|
15
|
+
- cc50d58: **BREAKING:** Canonical oclif command ids move from the `editorial-workflows` topic to `workflows`. A future host mount therefore surfaces `sanity workflows deploy` (and the same shape for every other command) instead of `sanity editorial-workflows …`. Standalone short forms (`sanity-workflows deploy`, `definition list`, …) are unchanged — the bin still rewrites them onto the topic before resolution.
|
|
16
|
+
|
|
17
|
+
Anyone invoking the previous topic-scoped ids (`sanity-workflows editorial-workflows deploy`, or a host/plugin that hard-coded those ids) must switch to `workflows …`. Continuing to call `editorial-workflows …` fails with command-not-found.
|
|
18
|
+
|
|
19
|
+
**Docs impact:** When the host mount ships, update Editorial Workflows CLI getting-started and invocation docs so the documented host path is `sanity workflows …`, and refresh any topic-scoped examples that still say `editorial-workflows`. Until then the standalone short forms remain the documented surface.
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- 4403e66: Short command forms (`deploy`, `definition list`, …) are no longer registered as oclif root aliases. The standalone `sanity-workflows` binary still accepts those forms by rewriting argv onto the `workflows` topic before command resolution, so day-to-day usage is unchanged. Removing the aliases makes the package safe to mount inside the official `sanity` CLI without colliding with host commands such as `sanity deploy`.
|
|
24
|
+
|
|
25
|
+
**No upgrade action required** for standalone `sanity-workflows` / `npx @sanity/workflow-cli` users. Anyone who embedded this package as an oclif plugin and relied on the root aliases must invoke the topic-scoped ids (`workflows deploy`, …) or perform equivalent argv rewriting in the host.
|
|
26
|
+
|
|
27
|
+
**Docs impact:** Update Editorial Workflows CLI getting-started and invocation docs when the host mount ships so the primary path is `sanity workflows …`; until then the standalone short forms remain the documented surface in this package README.
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [1e4a5da]
|
|
30
|
+
- Updated dependencies [5050b06]
|
|
31
|
+
- Updated dependencies [a044ba5]
|
|
32
|
+
- @sanity/workflow-engine@0.28.0
|
|
33
|
+
|
|
34
|
+
## 0.27.0
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- Updated dependencies [780cf93]
|
|
39
|
+
- @sanity/workflow-engine@0.27.0
|
|
40
|
+
|
|
3
41
|
## 0.26.0
|
|
4
42
|
|
|
5
43
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -21,17 +21,16 @@ pnpm --filter @sanity/workflow-cli dev show wf-instance.abc123
|
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
The package is an [oclif](https://oclif.io) plugin: every command's canonical
|
|
24
|
-
id nests under the `
|
|
25
|
-
(`sanity-workflows
|
|
24
|
+
id nests under the `workflows` topic
|
|
25
|
+
(`sanity-workflows workflows deploy`), so mounting the package into
|
|
26
26
|
the `sanity` CLI's plugin list surfaces the same commands as
|
|
27
|
-
`sanity
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
host-side mount work, not something a host can configure away.
|
|
27
|
+
`sanity workflows …` without colliding with the host's own root
|
|
28
|
+
commands (the sanity CLI already has a `deploy`). The short forms used
|
|
29
|
+
throughout this README (`deploy`, `definition list`, …) are the standalone
|
|
30
|
+
binary's stable surface — its production and development entrypoints
|
|
31
|
+
(`bin/run.js` and `bin/dev.js`) rewrite them onto the topic before oclif
|
|
32
|
+
resolves the command. Those short forms are **not** registered as oclif aliases,
|
|
33
|
+
so a host mount does not pollute the host root.
|
|
35
34
|
|
|
36
35
|
Authenticate once with `sanity login` (the CLI reads that session token); for
|
|
37
36
|
CI, set `SANITY_AUTH_TOKEN` instead. Then create a `sanity.workflow.ts` in the
|
|
@@ -224,11 +223,11 @@ only warns, never failing a completed deploy.
|
|
|
224
223
|
## Known gaps
|
|
225
224
|
|
|
226
225
|
- **Not mounted in the `sanity` CLI yet.** The package side is mount-ready —
|
|
227
|
-
commands nest under the `
|
|
228
|
-
[Run](#run)) — but the `sanity` CLI does not list this package
|
|
229
|
-
plugin array, so the commands ship only through the standalone
|
|
230
|
-
`sanity-workflows` binary today. The host-side mount
|
|
231
|
-
|
|
226
|
+
commands nest under the `workflows` oclif topic with no root
|
|
227
|
+
aliases (see [Run](#run)) — but the `sanity` CLI does not list this package
|
|
228
|
+
in its plugin array, so the commands ship only through the standalone
|
|
229
|
+
`sanity-workflows` binary today. The host-side mount is a separate piece of
|
|
230
|
+
work.
|
|
232
231
|
- **No true bypass.** `set-stage` is the engine's `setStage` admin
|
|
233
232
|
override: it skips the definition's declared transitions and filters, but
|
|
234
233
|
the target stage's enter lifecycle and the post-move cascade still run. A
|
package/bin/run.js
CHANGED
|
@@ -2,7 +2,6 @@ import { type WorkflowInstance } from '@sanity/workflow-engine';
|
|
|
2
2
|
import { WorkflowCommand } from '../../lib/base-command.ts';
|
|
3
3
|
import { type WriteReport } from '../../lib/ops-report.ts';
|
|
4
4
|
export default class Abort extends WorkflowCommand {
|
|
5
|
-
static aliases: string[];
|
|
6
5
|
static description: string;
|
|
7
6
|
static examples: string[];
|
|
8
7
|
static args: {
|
|
@@ -7,11 +7,10 @@ import { instanceFlags } from "../../lib/flags.js";
|
|
|
7
7
|
import { buildOperationArgs } from "../../lib/operation-args.js";
|
|
8
8
|
import { runWriteVerb } from "../../lib/ops-report.js";
|
|
9
9
|
export default class Abort extends WorkflowCommand {
|
|
10
|
-
static aliases = ['abort'];
|
|
11
10
|
static description = 'Abort an in-flight workflow instance — a hard stop: pending effects are cancelled, stage guards removed, and the instance is marked terminal where it stands.';
|
|
12
11
|
static examples = [
|
|
13
|
-
'<%= config.bin %> abort wf-instance.abc123',
|
|
14
|
-
"<%= config.bin %> abort wf-instance.abc123 --reason 'superseded by relaunch'",
|
|
12
|
+
'<%= config.bin %> workflows abort wf-instance.abc123',
|
|
13
|
+
"<%= config.bin %> workflows abort wf-instance.abc123 --reason 'superseded by relaunch'",
|
|
15
14
|
];
|
|
16
15
|
static args = {
|
|
17
16
|
instanceId: Args.string({ required: true, description: 'Workflow instance id.' }),
|
|
@@ -2,7 +2,6 @@ import { type DeleteDefinitionArgs, type DeleteDefinitionResult } from '@sanity/
|
|
|
2
2
|
import { WorkflowCommand } from '../../../lib/base-command.ts';
|
|
3
3
|
import { type EngineScope } from '../../../lib/operation-args.ts';
|
|
4
4
|
export default class DefinitionDelete extends WorkflowCommand {
|
|
5
|
-
static aliases: string[];
|
|
6
5
|
static description: string;
|
|
7
6
|
static examples: string[];
|
|
8
7
|
static args: {
|
|
@@ -7,14 +7,13 @@ import { deploymentFlags } from "../../../lib/flags.js";
|
|
|
7
7
|
import { baseEngineArgs } from "../../../lib/operation-args.js";
|
|
8
8
|
import { runWriteVerb } from "../../../lib/ops-report.js";
|
|
9
9
|
export default class DefinitionDelete extends WorkflowCommand {
|
|
10
|
-
static aliases = ['definition:delete'];
|
|
11
10
|
static description = 'Delete a deployed workflow definition (every version, or one via --version). ' +
|
|
12
11
|
'Refuses while non-terminal instances exist unless --cascade aborts them first — ' +
|
|
13
12
|
'instances are aborted in place, never deleted.';
|
|
14
13
|
static examples = [
|
|
15
|
-
'<%= config.bin %> definition delete my-workflow',
|
|
16
|
-
'<%= config.bin %> definition delete my-workflow --version 2',
|
|
17
|
-
"<%= config.bin %> definition delete my-workflow --cascade --reason 'workflow retired'",
|
|
14
|
+
'<%= config.bin %> workflows definition delete my-workflow',
|
|
15
|
+
'<%= config.bin %> workflows definition delete my-workflow --version 2',
|
|
16
|
+
"<%= config.bin %> workflows definition delete my-workflow --cascade --reason 'workflow retired'",
|
|
18
17
|
];
|
|
19
18
|
static args = {
|
|
20
19
|
name: Args.string({ required: true, description: 'Workflow definition name.' }),
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type WorkflowDefinition } from '@sanity/workflow-engine';
|
|
2
2
|
import { WorkflowCommand } from '../../../lib/base-command.ts';
|
|
3
3
|
export default class DefinitionDiff extends WorkflowCommand {
|
|
4
|
-
static aliases: string[];
|
|
5
4
|
static description: string;
|
|
6
5
|
static examples: string[];
|
|
7
6
|
static args: {
|
|
@@ -8,11 +8,10 @@ import { diffReport } from "../../../lib/diff.js";
|
|
|
8
8
|
import { deploymentFlags } from "../../../lib/flags.js";
|
|
9
9
|
import { deploymentToTarget } from "../../../lib/select-deployment.js";
|
|
10
10
|
export default class DefinitionDiff extends WorkflowCommand {
|
|
11
|
-
static aliases = ['definition:diff'];
|
|
12
11
|
static description = 'Diff an in-code definition against the deployed version (latest by default).';
|
|
13
12
|
static examples = [
|
|
14
|
-
'<%= config.bin %> definition diff productLaunch',
|
|
15
|
-
'<%= config.bin %> definition diff productLaunch --version 2',
|
|
13
|
+
'<%= config.bin %> workflows definition diff productLaunch',
|
|
14
|
+
'<%= config.bin %> workflows definition diff productLaunch --version 2',
|
|
16
15
|
];
|
|
17
16
|
static args = {
|
|
18
17
|
name: Args.string({ required: true, description: 'Workflow definition name.' }),
|
|
@@ -22,7 +22,6 @@ export declare function buildDefinitionListQuery(flags: DefinitionListFlags): {
|
|
|
22
22
|
params: Record<string, unknown>;
|
|
23
23
|
};
|
|
24
24
|
export default class DefinitionList extends WorkflowCommand {
|
|
25
|
-
static aliases: string[];
|
|
26
25
|
static description: string;
|
|
27
26
|
static examples: string[];
|
|
28
27
|
static flags: {
|
|
@@ -40,12 +40,11 @@ export function buildDefinitionListQuery(flags) {
|
|
|
40
40
|
return { groq, params };
|
|
41
41
|
}
|
|
42
42
|
export default class DefinitionList extends WorkflowCommand {
|
|
43
|
-
static aliases = ['definition:list'];
|
|
44
43
|
static description = 'List deployed workflow definitions.';
|
|
45
44
|
static examples = [
|
|
46
|
-
'<%= config.bin %> definition list',
|
|
47
|
-
'<%= config.bin %> definition list --tag prod',
|
|
48
|
-
'<%= config.bin %> definition list --json',
|
|
45
|
+
'<%= config.bin %> workflows definition list',
|
|
46
|
+
'<%= config.bin %> workflows definition list --tag prod',
|
|
47
|
+
'<%= config.bin %> workflows definition list --json',
|
|
49
48
|
];
|
|
50
49
|
static flags = {
|
|
51
50
|
...tagFlags,
|
|
@@ -2,7 +2,6 @@ import { type DeployedDefinition, type WorkflowDefinition, type WorkflowResource
|
|
|
2
2
|
import { WorkflowCommand } from '../../../lib/base-command.ts';
|
|
3
3
|
import { type ReadTarget } from '../../../lib/context.ts';
|
|
4
4
|
export default class DefinitionShow extends WorkflowCommand {
|
|
5
|
-
static aliases: string[];
|
|
6
5
|
static description: string;
|
|
7
6
|
static args: {
|
|
8
7
|
name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
@@ -9,7 +9,6 @@ import { fail } from "../../../lib/fail.js";
|
|
|
9
9
|
import { jsonFlags, tagFlags } from "../../../lib/flags.js";
|
|
10
10
|
import { formatKeyValue, resourceLabel, sectionHeader } from "../../../lib/ui.js";
|
|
11
11
|
export default class DefinitionShow extends WorkflowCommand {
|
|
12
|
-
static aliases = ['definition:show'];
|
|
13
12
|
static description = 'Show a deployed workflow definition.';
|
|
14
13
|
static args = {
|
|
15
14
|
name: Args.string({ required: true, description: 'Workflow definition name.' }),
|
|
@@ -12,7 +12,6 @@ interface DeployFailure {
|
|
|
12
12
|
message: string;
|
|
13
13
|
}
|
|
14
14
|
export default class Deploy extends WorkflowCommand {
|
|
15
|
-
static aliases: string[];
|
|
16
15
|
static description: string;
|
|
17
16
|
static examples: string[];
|
|
18
17
|
static flags: {
|
|
@@ -47,8 +46,10 @@ export declare function resolveBatches(config: WorkflowConfig, { only, selection
|
|
|
47
46
|
* Select and validate every deployment's definitions up front. Validation runs
|
|
48
47
|
* before any network write ({@link validateOrFail} exits on a bad definition),
|
|
49
48
|
* so a whole-config deploy can never leave a partial reconcile behind a broken
|
|
50
|
-
* batch.
|
|
51
|
-
*
|
|
49
|
+
* batch. Also asserts each selected deployment's reader-floor acknowledgement —
|
|
50
|
+
* including `--check`, which never reaches {@link deploymentToTarget}. In a
|
|
51
|
+
* multi-deployment run the failure names its deployment — it exits before any
|
|
52
|
+
* banner could attribute it.
|
|
52
53
|
*/
|
|
53
54
|
export declare function buildBatches(deployments: WorkflowDeployment[], only: string | undefined): DeployBatch[];
|
|
54
55
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { styleText } from 'node:util';
|
|
2
2
|
import { Flags } from '@oclif/core';
|
|
3
|
-
import { computeDiffEntries, errorMessage, workflow, } from '@sanity/workflow-engine';
|
|
3
|
+
import { assertReaderModelAcknowledgement, computeDiffEntries, errorMessage, workflow, } from '@sanity/workflow-engine';
|
|
4
4
|
import logSymbols from 'log-symbols';
|
|
5
5
|
import ora from 'ora';
|
|
6
6
|
import { WorkflowCommand } from "../../lib/base-command.js";
|
|
@@ -15,15 +15,14 @@ import { shareDefinitionsAfterDeploy } from "../../lib/share-definitions.js";
|
|
|
15
15
|
import { cliTelemetry } from "../../lib/telemetry.js";
|
|
16
16
|
import { groupBanner, resourceLabel } from "../../lib/ui.js";
|
|
17
17
|
export default class Deploy extends WorkflowCommand {
|
|
18
|
-
static aliases = ['deploy'];
|
|
19
18
|
static description = 'Validate, diff, and deploy workflow definitions to the resource bound by the selected deployment.';
|
|
20
19
|
static examples = [
|
|
21
|
-
'<%= config.bin %> deploy --deployment review-prod',
|
|
22
|
-
'<%= config.bin %> deploy --tag prod',
|
|
23
|
-
'<%= config.bin %> deploy --all-tags',
|
|
24
|
-
'<%= config.bin %> deploy --check',
|
|
25
|
-
'<%= config.bin %> deploy --dry-run',
|
|
26
|
-
'<%= config.bin %> deploy --only productLaunch',
|
|
20
|
+
'<%= config.bin %> workflows deploy --deployment review-prod',
|
|
21
|
+
'<%= config.bin %> workflows deploy --tag prod',
|
|
22
|
+
'<%= config.bin %> workflows deploy --all-tags',
|
|
23
|
+
'<%= config.bin %> workflows deploy --check',
|
|
24
|
+
'<%= config.bin %> workflows deploy --dry-run',
|
|
25
|
+
'<%= config.bin %> workflows deploy --only productLaunch',
|
|
27
26
|
];
|
|
28
27
|
static flags = {
|
|
29
28
|
...deploymentFlags,
|
|
@@ -161,6 +160,7 @@ export async function resolveBatches(config, { only, selection }) {
|
|
|
161
160
|
}
|
|
162
161
|
export function buildBatches(deployments, only) {
|
|
163
162
|
return deployments.map((deployment) => {
|
|
163
|
+
assertReaderModelAcknowledgement(deployment.expectedMinReaderModel, `Deployment ${deployment.name}`);
|
|
164
164
|
const context = deployments.length > 1 ? `${deploymentLabel(deployment)} — ` : '';
|
|
165
165
|
const defs = selectDefinitions(deployment.definitions, { only, context });
|
|
166
166
|
validateOrFail(defs, context);
|
|
@@ -193,7 +193,13 @@ export function deploySummary({ total, failures, }) {
|
|
|
193
193
|
return [
|
|
194
194
|
'',
|
|
195
195
|
styleText('bold', `${total - failures.length} of ${total} deployments succeeded — ${failures.length} failed:`),
|
|
196
|
-
...failures.
|
|
196
|
+
...failures.flatMap((f) => {
|
|
197
|
+
const [first = '', ...rest] = f.message.split('\n');
|
|
198
|
+
return [
|
|
199
|
+
styleText('red', ` ${logSymbols.error} ${deploymentLabel(f.deployment)} — ${first}`),
|
|
200
|
+
...rest.map((line) => styleText('red', ` ${line}`)),
|
|
201
|
+
];
|
|
202
|
+
}),
|
|
197
203
|
];
|
|
198
204
|
}
|
|
199
205
|
export function deploymentBanner({ deployment, index, total, }) {
|
|
@@ -32,7 +32,6 @@ export declare function renderDiagnosis({ diagnosis, input, remediations, explan
|
|
|
32
32
|
explanations?: ReadonlyMap<string, string> | undefined;
|
|
33
33
|
}): string[];
|
|
34
34
|
export default class Diagnose extends WorkflowCommand {
|
|
35
|
-
static aliases: string[];
|
|
36
35
|
static description: string;
|
|
37
36
|
static examples: string[];
|
|
38
37
|
static args: {
|
|
@@ -212,12 +212,11 @@ export function renderDiagnosis({ diagnosis, input, remediations, explanations,
|
|
|
212
212
|
return lines;
|
|
213
213
|
}
|
|
214
214
|
export default class Diagnose extends WorkflowCommand {
|
|
215
|
-
static aliases = ['diagnose'];
|
|
216
215
|
static description = "Explain why a workflow instance is or isn't progressing, and what would unstick it.";
|
|
217
216
|
static examples = [
|
|
218
|
-
'<%= config.bin %> diagnose wf-instance.abc123',
|
|
219
|
-
'<%= config.bin %> diagnose wf-instance.abc123 --tag prod',
|
|
220
|
-
'<%= config.bin %> diagnose wf-instance.abc123 --json',
|
|
217
|
+
'<%= config.bin %> workflows diagnose wf-instance.abc123',
|
|
218
|
+
'<%= config.bin %> workflows diagnose wf-instance.abc123 --tag prod',
|
|
219
|
+
'<%= config.bin %> workflows diagnose wf-instance.abc123 --json',
|
|
221
220
|
];
|
|
222
221
|
static args = {
|
|
223
222
|
instanceId: Args.string({ required: true, description: 'Workflow instance id.' }),
|
|
@@ -30,7 +30,6 @@ export declare function fireActionReport({ result, activity, action, }: {
|
|
|
30
30
|
action: string;
|
|
31
31
|
}): WriteReport;
|
|
32
32
|
export default class FireAction extends WorkflowCommand {
|
|
33
|
-
static aliases: string[];
|
|
34
33
|
static description: string;
|
|
35
34
|
static examples: string[];
|
|
36
35
|
static args: {
|
|
@@ -82,12 +82,11 @@ export function fireActionReport({ result, activity, action, }) {
|
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
export default class FireAction extends WorkflowCommand {
|
|
85
|
-
static aliases = ['fire-action'];
|
|
86
85
|
static description = 'Fire an action on an instance to unstick a waiting activity — the write acts as the configured token. Omit --action to list what can be fired.';
|
|
87
86
|
static examples = [
|
|
88
|
-
'<%= config.bin %> fire-action wf-instance.abc123',
|
|
89
|
-
'<%= config.bin %> fire-action wf-instance.abc123 --activity approve --action approve',
|
|
90
|
-
'<%= config.bin %> fire-action wf-instance.abc123 --activity publish --action publish --param note=shipping',
|
|
87
|
+
'<%= config.bin %> workflows fire-action wf-instance.abc123',
|
|
88
|
+
'<%= config.bin %> workflows fire-action wf-instance.abc123 --activity approve --action approve',
|
|
89
|
+
'<%= config.bin %> workflows fire-action wf-instance.abc123 --activity publish --action publish --param note=shipping',
|
|
91
90
|
];
|
|
92
91
|
static args = {
|
|
93
92
|
instanceId: Args.string({ required: true, description: 'Workflow instance id.' }),
|
|
@@ -77,15 +77,14 @@ export function instanceRow(r) {
|
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
export default class List extends WorkflowCommand {
|
|
80
|
-
static aliases = ['list'];
|
|
81
80
|
static description = 'List workflow instances in the configured dataset (in-flight by default).';
|
|
82
81
|
static examples = [
|
|
83
|
-
'<%= config.bin %> list',
|
|
84
|
-
'<%= config.bin %> list --include-completed',
|
|
85
|
-
'<%= config.bin %> list --definition productLaunch',
|
|
86
|
-
'<%= config.bin %> list --document dataset:proj:ds:article-1',
|
|
87
|
-
'<%= config.bin %> list --tag prod',
|
|
88
|
-
'<%= config.bin %> list --json',
|
|
82
|
+
'<%= config.bin %> workflows list',
|
|
83
|
+
'<%= config.bin %> workflows list --include-completed',
|
|
84
|
+
'<%= config.bin %> workflows list --definition productLaunch',
|
|
85
|
+
'<%= config.bin %> workflows list --document dataset:proj:ds:article-1',
|
|
86
|
+
'<%= config.bin %> workflows list --tag prod',
|
|
87
|
+
'<%= config.bin %> workflows list --json',
|
|
89
88
|
];
|
|
90
89
|
static flags = {
|
|
91
90
|
...tagFlags,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type WorkflowConfig, type WorkflowDeployment, type WorkflowInstance, type WorkflowResource } from '@sanity/workflow-engine';
|
|
2
2
|
import { WorkflowCommand } from '../../lib/base-command.ts';
|
|
3
3
|
export default class Nuke extends WorkflowCommand {
|
|
4
|
-
static aliases: string[];
|
|
5
4
|
static summary: string;
|
|
6
5
|
static description: string;
|
|
7
6
|
static examples: string[];
|
|
@@ -16,7 +16,6 @@ function planApiHost() {
|
|
|
16
16
|
return resolveApiHost() ?? 'https://api.sanity.io (production default)';
|
|
17
17
|
}
|
|
18
18
|
export default class Nuke extends WorkflowCommand {
|
|
19
|
-
static aliases = ['nuke'];
|
|
20
19
|
static summary = 'Delete engine-owned documents — a whole deployment tag, or a single instance.';
|
|
21
20
|
static description = 'The reset for a dataset holding engine documents the versioned upgrade framework cannot yet ' +
|
|
22
21
|
"migrate: deletes the tag's instances, definitions, and guards (across every alias-bound " +
|
|
@@ -24,9 +23,9 @@ export default class Nuke extends WorkflowCommand {
|
|
|
24
23
|
'documents are never touched. Prints a dry-run plan, then confirms (--force skips the prompt; ' +
|
|
25
24
|
'the plan still prints).';
|
|
26
25
|
static examples = [
|
|
27
|
-
'<%= config.bin %> nuke --deployment plugin-dev',
|
|
28
|
-
'<%= config.bin %> nuke --tag plugin-dev --force',
|
|
29
|
-
'<%= config.bin %> nuke --instance plugin-dev.wf-instance.abc123',
|
|
26
|
+
'<%= config.bin %> workflows nuke --deployment plugin-dev',
|
|
27
|
+
'<%= config.bin %> workflows nuke --tag plugin-dev --force',
|
|
28
|
+
'<%= config.bin %> workflows nuke --instance plugin-dev.wf-instance.abc123',
|
|
30
29
|
];
|
|
31
30
|
static flags = {
|
|
32
31
|
deployment: Flags.string({
|
|
@@ -2,7 +2,6 @@ import { type ResetActivityTarget, type WorkflowInstance } from '@sanity/workflo
|
|
|
2
2
|
import { WorkflowCommand } from '../../lib/base-command.ts';
|
|
3
3
|
import { type WriteOutcome, type WriteReport } from '../../lib/ops-report.ts';
|
|
4
4
|
export default class ResetActivity extends WorkflowCommand {
|
|
5
|
-
static aliases: string[];
|
|
6
5
|
static description: string;
|
|
7
6
|
static examples: string[];
|
|
8
7
|
static args: {
|
|
@@ -7,11 +7,10 @@ import { instanceFlags } from "../../lib/flags.js";
|
|
|
7
7
|
import { buildOperationArgs } from "../../lib/operation-args.js";
|
|
8
8
|
import { cascadeTail, runWriteVerb, } from "../../lib/ops-report.js";
|
|
9
9
|
export default class ResetActivity extends WorkflowCommand {
|
|
10
|
-
static aliases = ['reset-activity'];
|
|
11
10
|
static description = 'Reset a failed activity on an in-flight instance — back to active to re-run it, or --skip to bypass it (mark it skipped) so a gated exit transition can fire.';
|
|
12
11
|
static examples = [
|
|
13
|
-
'<%= config.bin %> reset-activity wf-instance.abc123 legal-review',
|
|
14
|
-
'<%= config.bin %> reset-activity wf-instance.abc123 legal-review --skip',
|
|
12
|
+
'<%= config.bin %> workflows reset-activity wf-instance.abc123 legal-review',
|
|
13
|
+
'<%= config.bin %> workflows reset-activity wf-instance.abc123 legal-review --skip',
|
|
15
14
|
];
|
|
16
15
|
static args = {
|
|
17
16
|
instanceId: Args.string({ required: true, description: 'Workflow instance id.' }),
|
|
@@ -3,7 +3,6 @@ import { WorkflowCommand } from '../../lib/base-command.ts';
|
|
|
3
3
|
import { type EngineScope } from '../../lib/operation-args.ts';
|
|
4
4
|
import { type WriteOutcome, type WriteReport } from '../../lib/ops-report.ts';
|
|
5
5
|
export default class SetStage extends WorkflowCommand {
|
|
6
|
-
static aliases: string[];
|
|
7
6
|
static description: string;
|
|
8
7
|
static examples: string[];
|
|
9
8
|
static args: {
|
|
@@ -9,12 +9,11 @@ import { buildOperationArgs } from "../../lib/operation-args.js";
|
|
|
9
9
|
import { cascadeTail, opsAppliedLines, runWriteVerb, } from "../../lib/ops-report.js";
|
|
10
10
|
import { canPromptOnStderr, selectOnStderr } from "../../lib/prompt.js";
|
|
11
11
|
export default class SetStage extends WorkflowCommand {
|
|
12
|
-
static aliases = ['set-stage'];
|
|
13
12
|
static description = "Force an instance into a stage, regardless of its declared transitions and filters — the engine's setStage admin override. The target stage's enter lifecycle still runs (auto-activities start, stage guards reconcile), and the post-move cascade can immediately auto-transition the instance onward.";
|
|
14
13
|
static examples = [
|
|
15
|
-
'<%= config.bin %> set-stage wf-instance.abc123 --to ready',
|
|
16
|
-
'<%= config.bin %> set-stage wf-instance.abc123',
|
|
17
|
-
"<%= config.bin %> set-stage wf-instance.abc123 --to ready --reason 'unblock for demo'",
|
|
14
|
+
'<%= config.bin %> workflows set-stage wf-instance.abc123 --to ready',
|
|
15
|
+
'<%= config.bin %> workflows set-stage wf-instance.abc123',
|
|
16
|
+
"<%= config.bin %> workflows set-stage wf-instance.abc123 --to ready --reason 'unblock for demo'",
|
|
18
17
|
];
|
|
19
18
|
static args = {
|
|
20
19
|
instanceId: Args.string({
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type WorkflowInstance } from '@sanity/workflow-engine';
|
|
2
2
|
import { WorkflowCommand } from '../../lib/base-command.ts';
|
|
3
3
|
export default class Show extends WorkflowCommand {
|
|
4
|
-
static aliases: string[];
|
|
5
4
|
static description: string;
|
|
6
5
|
static examples: string[];
|
|
7
6
|
static args: {
|
|
@@ -7,12 +7,11 @@ import { findInstance, resolveReadTargets } from "../../lib/context.js";
|
|
|
7
7
|
import { jsonFlags, tagFlags } from "../../lib/flags.js";
|
|
8
8
|
import { formatKeyValue, formatTimestamp, sectionHeader, activityIcon } from "../../lib/ui.js";
|
|
9
9
|
export default class Show extends WorkflowCommand {
|
|
10
|
-
static aliases = ['show'];
|
|
11
10
|
static description = 'Show the state, activities, and effects of a workflow instance.';
|
|
12
11
|
static examples = [
|
|
13
|
-
'<%= config.bin %> show wf-instance.abc123',
|
|
14
|
-
'<%= config.bin %> show wf-instance.abc123 --include history',
|
|
15
|
-
'<%= config.bin %> show wf-instance.abc123 --json',
|
|
12
|
+
'<%= config.bin %> workflows show wf-instance.abc123',
|
|
13
|
+
'<%= config.bin %> workflows show wf-instance.abc123 --include history',
|
|
14
|
+
'<%= config.bin %> workflows show wf-instance.abc123 --json',
|
|
16
15
|
];
|
|
17
16
|
static args = {
|
|
18
17
|
instanceId: Args.string({
|
|
@@ -2,7 +2,6 @@ import { StartNotSettledError, type InitialFieldValue, type StartInstanceArgs, t
|
|
|
2
2
|
import { WorkflowCommand } from '../../lib/base-command.ts';
|
|
3
3
|
import { type EngineScope } from '../../lib/operation-args.ts';
|
|
4
4
|
export default class Start extends WorkflowCommand {
|
|
5
|
-
static aliases: string[];
|
|
6
5
|
static description: string;
|
|
7
6
|
static examples: string[];
|
|
8
7
|
static args: {
|
|
@@ -10,14 +10,13 @@ import { baseEngineArgs } from "../../lib/operation-args.js";
|
|
|
10
10
|
import { runWriteVerb } from "../../lib/ops-report.js";
|
|
11
11
|
import { parseParams } from "../../lib/params.js";
|
|
12
12
|
export default class Start extends WorkflowCommand {
|
|
13
|
-
static aliases = ['start'];
|
|
14
13
|
static description = 'Start a workflow instance from a deployed definition. Supply values for the ' +
|
|
15
14
|
"workflow's input-sourced fields with --field (e.g. the subject document ref).";
|
|
16
15
|
static examples = [
|
|
17
|
-
'<%= config.bin %> start productLaunch',
|
|
18
|
-
'<%= config.bin %> start article-review --field subject=\'{"id":"dataset:proj:ds:article-1","type":"article"}\'',
|
|
19
|
-
'<%= config.bin %> start productLaunch --version 2 --tag prod',
|
|
20
|
-
'<%= config.bin %> start productLaunch --instance-id prod.wf-instance.a1b2c3d4e5f6',
|
|
16
|
+
'<%= config.bin %> workflows start productLaunch',
|
|
17
|
+
'<%= config.bin %> workflows start article-review --field subject=\'{"id":"dataset:proj:ds:article-1","type":"article"}\'',
|
|
18
|
+
'<%= config.bin %> workflows start productLaunch --version 2 --tag prod',
|
|
19
|
+
'<%= config.bin %> workflows start productLaunch --instance-id prod.wf-instance.a1b2c3d4e5f6',
|
|
21
20
|
];
|
|
22
21
|
static args = {
|
|
23
22
|
name: Args.string({ required: true, description: 'Workflow definition name.' }),
|
|
@@ -9,9 +9,8 @@ import { tagFlags } from "../../lib/flags.js";
|
|
|
9
9
|
import { formatTimestamp } from "../../lib/ui.js";
|
|
10
10
|
const TAIL_TAG = 'tail';
|
|
11
11
|
export default class Tail extends WorkflowCommand {
|
|
12
|
-
static aliases = ['tail'];
|
|
13
12
|
static description = 'Stream new history entries on a workflow instance as they land in the dataset.';
|
|
14
|
-
static examples = ['<%= config.bin %> tail wf-instance.abc123'];
|
|
13
|
+
static examples = ['<%= config.bin %> workflows tail wf-instance.abc123'];
|
|
15
14
|
static args = {
|
|
16
15
|
instanceId: Args.string({
|
|
17
16
|
required: true,
|
package/dist/help.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { Help } from '@oclif/core';
|
|
2
|
-
|
|
1
|
+
import { Help, type Command } from '@oclif/core';
|
|
2
|
+
/** Strip the mount topic so standalone root help can list short forms. */
|
|
3
|
+
export declare const standaloneSurfaceId: (id: string) => string | undefined;
|
|
4
|
+
/** Keep the standalone short surface, including oclif's help command. */
|
|
3
5
|
export declare const keepCommandAtRoot: (id: string) => boolean;
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
+
/** Strip the mount topic from an example rendered by standalone help. */
|
|
7
|
+
export declare const standaloneExample: (example: Command.Example) => Command.Example;
|
|
8
|
+
/** Standalone-binary help that lists topic-scoped commands under their short
|
|
9
|
+
* forms (`deploy`, `definition list`) rather than the mount ids. */
|
|
6
10
|
export default class WorkflowHelp extends Help {
|
|
11
|
+
showCommandHelp(command: Command.Loadable): Promise<void>;
|
|
7
12
|
protected showRootHelp(): Promise<void>;
|
|
8
13
|
}
|