You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 57b358f
Browse filesBrowse the repository at this point in the historyBrowse files
fix(cli): pick a trigger in workspace apply --run and skip deployment reads of new workflows (#10539)
* fix(cli): pick a trigger in workspace apply --run and skip deployment reads of new workflows
- --run <key>.<trigger>=<input> enters a run through a named trigger (const, block key or id); a key may repeat once per trigger
- a multi-trigger refusal is rewritten in --run terms and next names a trigger instead of repeating the refused value; no doubled period
- created workflows with no deployments/ change report not deployed without a deployment GET
- docs, primer and loop help name the trigger form and the untested-draft gate
* fix(cli): retry a refused bare --run without an empty input, once per trigger, and name every trigger form
* test(cli): pin the deployment read of a workflow whose folder rename moved its key
* fix(cli): refuse two --run names of one trigger once the saved lock resolves them
|`--delete-target-only`| No | With --to and --allow-delete, also delete the target's resources this directory never declared and no promotion from it left there (prod-only tables and their rows, skills made in prod). Without it a promotion keeps them, naming each with a warning. |
10146
10146
|`--only <kinds>`| No | Apply only these kinds (comma-separated folders: secrets.ts, credentials.ts, tools, skills, mcp, tables, knowledge, files, workflows, deployments). |
10147
10147
|`--to <workspaceId>`| No | Promote the directory to another workspace (dev to prod): its resources bind by key to that workspace's own and are updated in place. Only .sim/targets/<workspaceId>.json changes, the record the next promotion compares with: a resource changed there since is kept, or refused as stale (exit 5) when the directory changed it too. |
10148
-
|`--run <key=input>`| No | After the apply, dry-run workflows/<key>/'s saved draft with this input (JSON or @file, as `sim workflows run --dry --input` takes it; `--run <key>` alone: no input). Repeat it to test more workflows. deployments/ is applied only after every run completed, and only when every draft it publishes was test-run; a run that does not complete exits 1 and leaves the applied drafts in place. Sandboxed code (Python, shell, imports) really runs in it, network requests included, and is listed in runs[].sideEffects.unchecked. |
10148
+
|`--run <key[.trigger]=input>`| No | After the apply, dry-run workflows/<key>/'s saved draft with this input (JSON or @file, as `sim workflows run --dry --input` takes it; `--run <key>` alone: no input). In a workflow with several triggers, name the one the run enters through after a period (its const, block key or id): `--run 'orders.shopWebhook={…}'`. Repeat it to test more workflows, or more triggers of one. deployments/ is applied only after every run completed, and only when every draft it publishes was test-run; a run that does not complete exits 1 and leaves the applied drafts in place. Sandboxed code (Python, shell, imports) really runs in it, network requests included, and is listed in runs[].sideEffects.unchecked. |
10149
10149
|`--json`| No | Print machine-readable JSON (same as --output json). |
|`--delete-target-only`| No | With --to and --allow-delete, also delete the target's resources this directory never declared and no promotion from it left there (prod-only tables and their rows, skills made in prod). Without it a promotion keeps them, naming each with a warning. |
761
761
|`--only <kinds>`| No | Apply only these kinds (comma-separated folders: secrets.ts, credentials.ts, tools, skills, mcp, tables, knowledge, files, workflows, deployments). |
762
762
|`--to <workspaceId>`| No | Promote the directory to another workspace (dev to prod): its resources bind by key to that workspace's own and are updated in place. Only .sim/targets/<workspaceId>.json changes, the record the next promotion compares with: a resource changed there since is kept, or refused as stale (exit 5) when the directory changed it too. |
763
-
|`--run <key=input>`| No | After the apply, dry-run workflows/<key>/'s saved draft with this input (JSON or @file, as `sim workflows run --dry --input` takes it; `--run <key>` alone: no input). Repeat it to test more workflows. deployments/ is applied only after every run completed, and only when every draft it publishes was test-run; a run that does not complete exits 1 and leaves the applied drafts in place. Sandboxed code (Python, shell, imports) really runs in it, network requests included, and is listed in runs[].sideEffects.unchecked. |
763
+
|`--run <key[.trigger]=input>`| No | After the apply, dry-run workflows/<key>/'s saved draft with this input (JSON or @file, as `sim workflows run --dry --input` takes it; `--run <key>` alone: no input). In a workflow with several triggers, name the one the run enters through after a period (its const, block key or id): `--run 'orders.shopWebhook={…}'`. Repeat it to test more workflows, or more triggers of one. deployments/ is applied only after every run completed, and only when every draft it publishes was test-run; a run that does not complete exits 1 and leaves the applied drafts in place. Sandboxed code (Python, shell, imports) really runs in it, network requests included, and is listed in runs[].sideEffects.unchecked. |
764
764
|`--json`| No | Print machine-readable JSON (same as --output json). |
`--run <key>='<input>'` dry-runs the saved draft of `workflows/<key>/` with that input after the apply, as `sim workflows run <workflowId> --dry --input` does: writes return placeholders and are listed under each run's `sideEffects`. The input is JSON or `@file`; repeat `--run` to test several workflows. The result lists each run under `runs` with its workflow key and id, status and output. A run that does not complete exits `1` and prints the failing block's file and line in `workflows/<key>/`; the applied drafts stay in place, so fix the source and run the same command again.
59
+
`--run <key>='<input>'` dry-runs the saved draft of `workflows/<key>/` with that input after the apply, as `sim workflows run <workflowId> --dry --input` does: writes return placeholders and are listed under each run's `sideEffects`. The input is JSON or `@file`; repeat `--run` to test several workflows. A workflow with more than one trigger (an API trigger and a webhook, say) needs the trigger each run enters through, named after a period by its const, block key or id: `--run two.apiIn='{…}' --run two.hook='{…}'` tests both paths in one apply. The result lists each run under `runs` with its workflow key and id, status and output. A run that does not complete exits `1` and prints the failing block's file and line in `workflows/<key>/`; the applied drafts stay in place, so fix the source and run the same command again.
60
60
61
-
With `--run`, `deployments/` is applied only after every run completed, in a second write, so a deployment with `live: 'draft'` publishes only a draft that passed its test. Without `--run` it is applied with everything else. `--run` is refused with `--dry` (nothing is written to test), with `--to` (test in this workspace, then promote), and with an `--only` that leaves out `workflows`.
61
+
With `--run`, `deployments/` is applied only after every run completed, in a second write, so a deployment with `live: 'draft'` publishes only a draft that passed its test. It is also applied only when every draft it publishes was test-run in this apply: if it would publish a workflow no `--run` tested, `deployments/` is skipped, the apply exits non-zero, and its `next` adds the `--run` for each untested workflow. Without `--run` it is applied with everything else. `--run` is refused with `--dry` (nothing is written to test), with `--to` (test in this workspace, then promote), and with an `--only` that leaves out `workflows`.
62
62
63
63
An apply adopts a resource it never read (one made in Sim under the name a new declaration gives) only when the declaration matches it, or only adds to it: a column, rows into an empty table, a document. An adopt that would change or remove anything the resource holds is refused with `E_APPLY_NO_BASE`, even with `--allow-delete`. Run `get` into a new directory to read the resource, then make your edit there, or give the declaration another name.
A Sim workspace as files; nothing here runs. Commands here (table ones too) act on the workspace \`${SOURCE_BASE_FILE}\` names. Every \`.ts\` file starts with \`// @sim-sdk ${SDK_MAJOR}\`.
129
129
130
-
**Edit loop**: write every file, then run one chained command; fix what it reports: \`${WORKSPACE_LOOP}\` dry-runs \`workflows/<key>/\`'s draft (one \`--run\` per workflow you changed; drop it when you changed none) and deploys only if all complete. \`check\` also type-checks (no \`tsc\`). Apply re-checks (\`apply --dry\` only plans) and rewrites files: reread before editing.
130
+
**Edit loop**: write every file, then run one chained command; fix what it reports: \`${WORKSPACE_LOOP}\` dry-runs \`workflows/<key>/\`'s draft (one \`--run\` per workflow you changed; drop it when you changed none; several triggers: \`--run '<key>.<const>={…}'\` each) and deploys only if all complete and every draft it deploys was tested. \`check\` also type-checks (no \`tsc\`). Apply re-checks (\`apply --dry\` only plans) and rewrites files: reread before editing.
131
131
132
132
- **Deletes**: removing anything (file, column, block) needs \`apply --allow-delete\` and is permanent.
133
133
- **Exit ${SOURCE_HELD_EXIT_CODE}**: partly written: what needs an unset secret or unbound credential waits; set it, reapply.
raw: request.raw==='' ? first : `${first}=${request.raw}`,
155
+
})
138
156
return{
139
-
failure: `the workflow has more than one trigger (${triggers.join(', ')}), so name the one each --run enters through: --run ${shellWord(next)}${others.length>0 ? ` (or ${others.map((other)=>`${other}=<its input>`).join(', ')})` : ''}`,
157
+
failure: `the workflow has more than one trigger (${triggers.join(', ')}), so name the one each --run enters through: --run ${shellWord(next)}${others.length>0 ? ` (or ${others.map((other)=>flag({trigger: other,raw: `${other}=<its input>`})).join(', ')})` : ''}`,
0 commit comments