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 6856efa
Browse filesBrowse the repository at this point in the historyBrowse files
fix(workflow-code): staging QA fixes for workflows and workspace as code (#10220)
Fixes from the staging end-to-end QA of workflows and workspace as code: check and catalog fixes, visibility gate on source apply, CLI exit and interrupt handling, apply DX (binding, findings, created ids, deploy), workspace batching under the body ceiling, params reference and slim primer, diagnostics and rename identity, plus the review fixes.
Copy file name to clipboardExpand all lines: apps/docs/content/docs/cli/scripting.mdx
+19-3Lines changed: 19 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -170,10 +170,22 @@ The CLI resends a request the API answers `429` only when sending it twice is sa
170
170
|`0`| Applied or created, or a dry run with no errors |
171
171
|`1`| The source has errors (each printed as `file:line:column` with its frame and hint), or command/request failure |
172
172
|`5`| The workflow changed since the directory was read (`409 SOURCE_STALE`): get it again, reapply the edit, and retry |
173
-
|`6`| The workflow is locked (`423`) |
173
+
|`6`| The workflow or its folder is locked (`423`, `E_APPLY_LOCKED`); a locked block exits `1` (`E_APPLY_LOCKED_BLOCK`) |
174
174
|`7`| The source is over the size limits (`413`) |
175
175
|`9`| Still rate limited (`429`) after the CLI's retries; nothing was written |
176
176
|`10`|`--dir` is a workflow folder of a workspace directory another `sim` command is using (`SOURCE_DIR_BUSY`); nothing was written: run it again once the other finished |
177
+
|`13`|`AUTH_REQUIRED`: not logged in, or the server refused the credential; nothing was sent |
178
+
|`14`| Run without `--yes` and with no terminal to ask: the plan was printed with no errors and nothing was written; run the same command with `--yes`|
179
+
|`130`| Interrupted (Ctrl-C). A write already sent is finished and saved into the directory first, waiting up to 60s for its answer; a second Ctrl-C, or no answer by then, stops at once and prints that it may have been written and how to check |
@@ -192,11 +204,13 @@ The CLI resends a request the API answers `429` only when sending it twice is sa
192
204
|`0`| Applied, or a dry run with no errors |
193
205
|`1`| The source has errors, changes were held back for a secret or credential the workspace cannot satisfy, or command/request failure |
194
206
|`5`| A resource changed since the directory was read (`409 SOURCE_STALE`): get it again into a fresh directory, reapply the edit, and retry |
195
-
|`6`| A resource is locked (`423`) |
207
+
|`6`| A resource (a workflow or its folder, a table) is locked (`423`); a locked block exits `1` (`E_APPLY_LOCKED_BLOCK`) |
196
208
|`7`| The directory is over the size limits (`413`) |
197
209
|`8`| The apply stopped part-way: what was written is saved into the directory; apply again |
198
210
|`9`| Still rate limited (`429`) after the CLI's retries; nothing was written |
199
211
|`10`| Busy, retry: another apply is writing the workspace (`409 SOURCE_BUSY`), or another `sim workspaces source` command is using the same directory (`SOURCE_DIR_BUSY`); nothing was written: run the command again once the other finished |
212
+
|`13`|`AUTH_REQUIRED`: not logged in, or the server refused the credential; nothing was sent |
213
+
|`130`| Interrupted (Ctrl-C). A write already sent is finished and saved into the directory first, waiting up to 60s for its answer; a second Ctrl-C, or no answer by then, stops at once and prints that it may have been written and how to check |
200
214
201
215
Both waits default to 3600 seconds; `--wait-timeout 0` waits indefinitely. `SIM_TIMEOUT_SECONDS` independently bounds one API request. A timeout does not cancel the underlying run or operation.
202
216
@@ -403,12 +417,14 @@ jobs:
403
417
404
418
`check` runs first because it is offline and fast, and it regenerates `.sim/sdk/workspace.d.ts`, so the `tsc` step after it types resources the pull request adds. A workspace API key can apply tables, rows, knowledge bases, files, custom tools, MCP servers and credential bindings. Workflows, skills, secrets and deployments need a member's personal API key, and deployments need an admin. Apply rewrites files under the directory (each `.sim/base.json`, ids it allocated, values the server normalized), and the next apply compares with them, so the last step commits them back to the branch; `[skip ci]` keeps that commit from running the job again. Where the branch is protected, run `sim workspaces source get --dir workspace` on a new branch instead and open a pull request. After merging two branches that each applied, a dry run with no changes means the files match the workspace. Exit `5` means a resource changed since this branch's base: get the workspace into a fresh directory and carry the edit over. Exit `10` means another apply is writing the workspace (or another command is using the directory), so retry; the `concurrency` key keeps two runs of this job from overlapping.
405
419
406
-
To promote the same directory to a second workspace, add a step with `--to`:
420
+
To promote the same directory to a second workspace, add a step with `--to` before the step that commits the files back:
The promotion writes `workspace/.sim/targets/<workspaceId>.json`, what it left in that workspace. Committing it lets the next run tell a change made in that workspace since (kept, or exit `5` when the directory changed the same resource) from one to promote.
Copy file name to clipboardExpand all lines: apps/docs/content/docs/cli/workflows.mdx
+43-6Lines changed: 43 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1337,7 +1337,7 @@ sim workflows source status [options]
1337
1337
1338
1338
</CommandTable>
1339
1339
1340
-
Exit codes: 0 clean (nothing to apply, and the server changed nothing since the directory was read); 11 local changes only (applying writes them); 12 the server changed since the directory was read: drift (a resource edited, added or deleted there that the directory leaves alone) or a conflict (also changed here, so applying it is refused as stale), with or without local changes; 7 the source is too large for the server to read in one dry run; 1 the command failed. A server that cannot be reached is not a failure: the status shows the local changes only and says so (exit 0 or 11).
1340
+
Exit codes: 0 clean (nothing to apply, and the server changed nothing since the directory was read); 11 local changes only (applying writes them); 12 the server changed since the directory was read: drift (a resource edited, added or deleted there that the directory leaves alone) or a conflict (also changed here, so applying it is refused as stale), with or without local changes; 7 the source is too large for the server to read in one dry run; 1 the command failed; 13 not logged in (AUTH_REQUIRED) or the credential was refused: the status shows the local changes only, then run `sim login`. A server that cannot be reached is not a failure: the status shows the local changes only and says so (exit 0 or 11).
1341
1341
1342
1342
API request and response schemas: [applyWorkflowSource](/api-reference/workflows/applyWorkflowSource).
|`--verbose`| No | With --output json, also list info findings (such as blocks placed by autolayout). |
1356
1357
|`--dir <dir>`| Yes | Source directory: workflow.ts and functions/*. Without workflow.ts, writes a starter and the types instead (an error with --dry-run or --yes). |
1357
1358
|`--dry-run`| No | Check the source and show the outcome without creating anything. |
1358
1359
|`--name <name>`| No | The workflow name (default: the source's). |
1359
1360
|`--folder <path>`| No | The folder to create it in (default: the root). |
1360
1361
|`-y, --yes`| No | Create without asking for confirmation. |
1362
+
|`--deploy`| No | After the write is saved, deploy the workflow (as `sim workflows deploy <workflowId>` does). |
1361
1363
1362
1364
</CommandTable>
1363
1365
1364
-
Exit codes: 0 created (or a clean dry run, or a starter written); 1 the source has errors (each printed as file:line:column with its frame and hint), the workflow name is taken (SOURCE_NAME_TAKEN: pass --name), or the command failed; 6 the folder is locked; 7 the source is too large; 9 rate limited (HTTP 429) after the CLI's retries, so nothing was created: wait a minute and run it again. Exit 10 (busy, retry): --dir is a workflow folder of a workspace directory another sim command is using (SOURCE_DIR_BUSY); nothing was read or written. Run this one again once it finished.
1366
+
Exit codes: 0 created (or a clean dry run, or a starter written); 1 the source has errors (each printed as file:line:column with its frame and hint), the workflow name is taken (SOURCE_NAME_TAKEN: pass --name), or the command failed (a starter is created in the workspace its types were written for unless --workspace names another); 6 the folder is locked; 7 the source is too large; 9 rate limited (HTTP 429) after the CLI's retries, so nothing was created: wait a minute and run it again; 14 without --yes and with no terminal to ask: the plan was printed with no errors and nothing was created (run the same command with --yes). Exit 10 (busy, retry): --dir is a workflow folder of a workspace directory another sim command is using (SOURCE_DIR_BUSY); nothing was read or written. Run this one again once it finished. Exit 13: not logged in, or the server refused the credential (AUTH_REQUIRED); nothing was sent. Run `sim login`, or fix or unset SIM_API_KEY when the key comes from it. Exit 130: interrupted (Ctrl-C). A write already sent is finished and saved into the directory first, waiting up to 60s for its answer; a second Ctrl-C, or no answer by then, stops at once and prints that it may have been written and how to check.
1365
1367
1366
-
API request and response schemas: [createWorkflowFromSource](/api-reference/workflows/createWorkflowFromSource), [getSourceCatalog](/api-reference/catalog/getSourceCatalog), [getSourceResources](/api-reference/workflows/getSourceResources).
1368
+
API request and response schemas: [createWorkflowFromSource](/api-reference/workflows/createWorkflowFromSource), [getSourceCatalog](/api-reference/catalog/getSourceCatalog), [getSourceResources](/api-reference/workflows/getSourceResources), [deployWorkflow](/api-reference/workflows/deployWorkflow).
1367
1369
1368
1370
### Apply a workflow source directory to a workflow draft
|`--dry-run`| No | Check the source and show the outcome without saving or writing files. |
1392
1395
|`-y, --yes`| No | Apply without asking for confirmation. |
1396
+
|`--deploy`| No | After the write is saved, deploy the workflow (as `sim workflows deploy <workflowId>` does). |
1393
1397
|`--allow-delete`| No | Delete blocks the source no longer declares; without it, an apply that deletes a block is refused. |
1394
1398
1395
1399
</CommandTable>
1396
1400
1397
-
Exit codes: 0 applied (or a clean dry run); 1 the source has errors (each printed as file:line:column with its frame and hint) or the command failed; 5 the workflow changed since the directory was read (SOURCE_STALE, on a dry run too: get it again, reapply the edit, retry); 6 the workflow or its folder is locked; 7 the source is too large; 9 rate limited (HTTP 429) after the CLI's retries, so nothing was written: wait a minute and run it again. Exit 10 (busy, retry): --dir is a workflow folder of a workspace directory another sim command is using (SOURCE_DIR_BUSY); nothing was read or written. Run this one again once it finished.
1401
+
Exit codes: 0 applied (or a clean dry run); 1 the source has errors (each printed as file:line:column with its frame and hint) or the command failed; 5 the workflow changed since the directory was read (SOURCE_STALE, on a dry run too: get it again, reapply the edit, retry); 6 the workflow or its folder is locked (E_APPLY_LOCKED; a locked block exits 1, E_APPLY_LOCKED_BLOCK); 7 the source is too large; 9 rate limited (HTTP 429) after the CLI's retries, so nothing was written: wait a minute and run it again; 14 without --yes and with no terminal to ask: the plan was printed with no errors and nothing was written (run the same command with --yes to apply it). Exit 10 (busy, retry): --dir is a workflow folder of a workspace directory another sim command is using (SOURCE_DIR_BUSY); nothing was read or written. Run this one again once it finished. Exit 13: not logged in, or the server refused the credential (AUTH_REQUIRED); nothing was sent. Run `sim login`, or fix or unset SIM_API_KEY when the key comes from it. Exit 130: interrupted (Ctrl-C). A write already sent is finished and saved into the directory first, waiting up to 60s for its answer; a second Ctrl-C, or no answer by then, stops at once and prints that it may have been written and how to check.
1398
1402
1399
-
API request and response schemas: [applyWorkflowSource](/api-reference/workflows/applyWorkflowSource).
1403
+
API request and response schemas: [applyWorkflowSource](/api-reference/workflows/applyWorkflowSource), [deployWorkflow](/api-reference/workflows/deployWorkflow).
1400
1404
1401
1405
### Show the block catalog workflow source is checked against
|`--dir <dir>`| No | Source directory: workflow.ts, functions/* and .sim/. Defaults to `.`. |
1432
1436
|`--strict`| No | Fail on the warnings listed below in every block, not only new ones. |
1433
1437
|`--no-strict`| No | Never fail on a warning. |
1438
+
|`--verbose`| No | With --output json, also list info findings (such as blocks placed by autolayout). |
1434
1439
1435
1440
</CommandTable>
1436
1441
1437
1442
Compiles workflow.ts (and the function files it names) with the compiler the server runs, against the workspace's block catalog the last get or create cached, and prints the findings as the dry run does. No request is made. It covers the source itself (syntax, builders, params, references, wiring). In a workflow folder of a workspace directory (workflows/<key>), it reads the workspace's .sim/base.json and also checks env names, resource keys and table columns against what the directory declares. The dry run still checks what only the server knows (stored values, deployment), so run it before applying. A check also adds the blocks the source now uses to the CLI's tsconfig.json, so tsc type-checks a block the edit added; in a workspace directory it also regenerates .sim/sdk/workspace.d.ts, so tsc types each workflow's inputs as its files declare them.
1438
1443
1439
1444
Exit codes: 0 no errors; 1 errors (each printed as file:line:column with its frame and hint), or no cached catalog (run the get once). With --output json, stdout is one document that also lists every finding under diagnostics.
1440
1445
1441
-
These warnings, which an apply saves as written, fail the check as errors on every block the lock does not bind (a block added since the get, or every block of a new workflow): W_REQUIRED_MISSING, W_UNKNOWN_OPTION, W_UNKNOWN_OUTPUT_PATH, W_VALUE_KIND, W_OUT_OF_RANGE, W_LITERAL_SECRET, W_TABLE_UNKNOWN_COLUMN, W_CHILD_INPUT_UNKNOWN, W_BRANCH_UNWIRED. --strict fails on them in every block, except W_BRANCH_UNWIRED on a block the lock binds (the stored workflow may hold it, and the server then stays quiet); --no-strict never fails on a warning.
1446
+
These warnings, which an apply saves as written, fail the check as errors on every block the lock does not bind (a block added since the get, or every block of a new workflow): W_REQUIRED_MISSING, W_UNKNOWN_OPTION, W_UNKNOWN_OUTPUT_PATH, W_VALUE_KIND, W_OUT_OF_RANGE, W_LITERAL_SECRET, W_TABLE_UNKNOWN_COLUMN, W_CHILD_INPUT_UNKNOWN, W_BRANCH_UNWIRED, W_UNRESOLVED_REF. --strict fails on them in every block, except W_BRANCH_UNWIRED on a block the lock binds (the stored workflow may hold it, and the server then stays quiet); --no-strict never fails on a warning. W_JSON_REF_UNTYPED is reported only on blocks the lock does not bind, and with --strict on every block.
1442
1447
1443
1448
### Show the content of the changes in a workflow source directory
1444
1449
@@ -1472,6 +1477,38 @@ Without --server, each file created, edited or deleted since the directory was r
1472
1477
1473
1478
API request and response schemas: [getWorkflowSource](/api-reference/workflows/getWorkflowSource).
1474
1479
1480
+
### Print a builder's params and outputs from the cached block catalog
|`--dir <dir>`| No | Source directory whose catalog to read. Defaults to `.`. |
1505
+
1506
+
</CommandTable>
1507
+
1508
+
Prints a builder's params (required first, with enums and defaults), the gate field that picks which others apply, and its outputs, from the block catalog the last get, create or check cached. No request is made. <builder> is the dotted builder path as source writes it: table.upsertRow, agent, trigger.schedule, slack.sendMessage (slack.tool.sendMessage names the same builder). A namespace (gmail, trigger.gmail) lists its builders; a construct core.d.ts declares (loop, parallel, t, env) prints its declaration. Run it from a workflow or workspace source directory, or pass --dir.
1509
+
1510
+
Exit codes: 0 printed; 1 no builder or namespace of that name (the closest one is named), or no cached catalog (run a get once).
1511
+
1475
1512
### List the tables, knowledge bases, credentials, workflows, skills, custom tools, MCP servers and env names source can name
0 commit comments