Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions apps/docs/content/docs/cli/reference.mdx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/docs/content/docs/cli/scripting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ Most successful actions exit 0; API, configuration, or argument failures exit 1.
| `13` | `AUTH_REQUIRED`: the profile has no credential, its OAuth login expired and could not be refreshed, or the server answered `401` (the server's own code is kept when it sends one). Nothing was done: run `sim login` and the same command again. |
| `9` | Rate limited: the API answered `429` and the CLI gave up. Nothing more was sent: wait a minute and run the command again. |

The CLI resends a request the API answers `429` only when sending it twice is safe: every `GET`, and the source writes that are all-or-nothing (`sim workflows source apply` and `create`, `sim workspaces source apply` and its file uploads, dry runs and the dry run `status` sends included). It resends up to 6 times, waiting each time for the longer of the server's `Retry-After` (honoured up to 60 seconds) and a backoff of about 1, 2, 4, 8, 16 and 30 seconds (each ±20%), so one wait is at most a minute. Any other write answered `429` exits 9 at once. Interactive secret entry cancelled with Ctrl-C exits 130. Other outcomes are command-specific:
The CLI resends a request the API answers `429` only when sending it twice is safe: every `GET`, and the source writes that are all-or-nothing (`sim workflows source apply` and `create`, `sim workspaces source apply` and its file uploads, dry runs and the dry run `status` sends included). It resends up to 6 times, waiting each time for the longer of the server's `Retry-After` (honoured up to 60 seconds) and a backoff of about 1, 2, 4, 8, 16 and 30 seconds (each ±20%, never past 30), so one wait is at most a minute. Any other write answered `429` exits 9 at once. Interactive secret entry cancelled with Ctrl-C exits 130. Other outcomes are command-specific:

| Code | `sim whoami` |
| --- | --- |
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/content/docs/cli/tables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ sim tables create [options]
| --- | --- | --- |
| `--name <value>` | Yes | Identifier: letters, numbers, and underscores; cannot start with a number. |
| `--description <value>` | No | Optional table description. |
| `--schema <json\|@file>` | Yes | Initial table column definitions: &#123;"columns":[&#123;"name":"email","type":"string"&#125;]&#125;. A column's type is one of string, number, currency, boolean, date, json, select; a select column also takes options. (JSON, or @path / @- to read a file or stdin). |
| `--schema <json\|@file>` | Yes | Initial table column definitions: &#123;"columns":[&#123;"name":"email","type":"string","required":true,"unique":true&#125;]&#125;. Column fields: id - Optional client-provided column identifier; name (required) - Column name; type (required) - Column data type; required - Whether inserts must supply a value for this column; unique - Whether values in the column must be unique; options - Select options for select-type columns, as [&#123;"id":"open","name":"Open"&#125;]; multiple - Whether a select column accepts multiple values; currencyCode - ISO 4217 code for currency columns. A column's type is one of string, number, currency, boolean, date, json, select; a select column also takes options. (JSON, or @path / @- to read a file or stdin). |
| `--folder <value>` | No | Folder path as shown in the app; the leading / is optional. |

</CommandTable>
Expand Down Expand Up @@ -624,7 +624,7 @@ sim tables columns create <tableId> [options]

| Option | Required | Description |
| --- | --- | --- |
| `--column <json\|@file>` | Yes | Column definition to add: &#123;"name":"status","type":"string"&#125;. A column's type is one of string, number, currency, boolean, date, json, select; a select column also takes options. (JSON, or @path / @- to read a file or stdin). |
| `--column <json\|@file>` | Yes | Column definition to add: &#123;"name":"status","type":"string"&#125;. Column fields: id - Optional client-provided column identifier; name (required) - Column name; type (required) - Column data type; required - Whether inserts must supply a value for this column; unique - Whether values in the column must be unique; options - Select options for select-type columns, as [&#123;"id":"open","name":"Open"&#125;]; multiple - Whether a select column accepts multiple values; currencyCode - ISO 4217 code for currency columns; position - Zero-based insertion position for the column. A column's type is one of string, number, currency, boolean, date, json, select; a select column also takes options. (JSON, or @path / @- to read a file or stdin). |

</CommandTable>

Expand Down
4 changes: 2 additions & 2 deletions apps/docs/content/docs/cli/workflow-sync.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Forking and sync require Enterprise on billing-enabled deployments. Billing-disa

### 1. Export and inspect the workflow

`--include-references` adds a versioned manifest of resource identities and their occurrences. Default export clears registered credential fields and workspace bindings. It does not remove every ordinary variable value or literal configuration; inspect the payload before sharing it. Credentials and secret values are not transferred as destination resources.
`--include-references` adds a versioned manifest of resource identities and their occurrences. `sim workflows export` clears registered credential fields and keeps non-secret workspace bindings, such as table and knowledge base IDs; `--no-include-workspace-bindings` clears those too. It does not remove every ordinary variable value or literal configuration; inspect the payload before sharing it. Credentials and secret values are not transferred as destination resources.

Pin JSON because import does not accept YAML:

Expand All @@ -40,7 +40,7 @@ sim --profile destination --workspace "$DESTINATION_WORKSPACE" --output json \
workflows import-preview --workflow @workflow.json > preview.json
```

`--include-workspace-bindings` can preserve non-secret bindings for a same-workspace round trip. Otherwise, configure required bindings reported by import.
With `--include-references`, import preview lists the bindings the destination has to map.

### 2. Map destination resources

Expand Down
18 changes: 11 additions & 7 deletions apps/docs/content/docs/cli/workflows.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,10 @@ Edges:
or {"source":{"block":"<id>","handle":"<target handle>"}}; "success" is an alias of "source".
An add's connections create the new block's edges. An edit's connections REPLACE every
outgoing edge of that block, on every handle: list again each edge to keep; {} removes them all.
A block moved into or out of a loop or parallel (parentId) loses every edge that would cross the
container's boundary: to leave the loop, wire its loop-end-source (parallel-end-source).
Moving a block into or out of a loop or parallel (parentId) removes each of its existing edges
that would cross the container's boundary, atomic or not, and names them in warnings. Edges the
batch itself asks for across a boundary are refused. Wire into the body from loop-start-source
and onward from loop-end-source (parallel-start-source, parallel-end-source).
To remove one edge, edit its source block with
{"removeEdges":[{"targetBlockId":"<id>","sourceHandle":"source"}]} (sourceHandle defaults to
"source").
Expand Down Expand Up @@ -833,8 +835,8 @@ sim workflows run <workflowId> [options]
| `--manual` | No | Run the current saved workflow state instead of the active deployment. |
| `--trigger <blockId>` | No | Enter the run through this runnable trigger, by its block id; runs the current saved workflow state (implies --manual). |
| `--mock-payload` | No | Use the selected trigger's server-derived mock payload; runs the current saved workflow state (implies --manual). |
| `--from-block <block>` | No | Run manually from this saved workflow block: its id, display name or key. |
| `--source-run <runId>` | No | Prior run whose persisted state supplies upstream outputs (requires --from-block). |
| `--from-block <block>` | No | Rerun the saved draft from this block (its id, display name or key), reusing the outputs --source-run produced before it; a failed run prints this command as next. |
| `--source-run <runId>` | No | Earlier run of this workflow, deployed or draft, whose outputs the blocks before --from-block keep (requires --from-block). |
| `--stop-after <block>` | No | Stop the run after this saved block (its id, display name or key), failing it if the run takes a path that skips the block; with --from-block on the same block, re-runs only that block (implies --manual). Unless --select-output names others, blockOutputs holds the output of that block under its key (or id); output stays empty. |
| `--dir <dir>` | No | This workflow's source directory: a failed run names the source file and line of the block that failed, read through its .sim/lock.json. Not with --async or --follow, and not for a run --wait-timeout leaves running. |
| `--wait-timeout <seconds>` | No | Wait at most this many seconds for a synchronous run (0 waits until it settles). A run still going then continues in the background under async limits: the command prints its run record and exits 4, and `sim workflows runs wait` keeps waiting. Not with --async or --follow. |
Expand All @@ -848,6 +850,8 @@ Without --manual (or a flag that implies it) this runs the active deployment; a

The result is the run: runId, status (completed, failed, paused or cancelled), error, output (the workflow's final output) and blockOutputs (what --select-output named). It has no success field: branch on status, or on the exit code. With --follow it is the stream's final frame instead: success and output.

A run that failed in a block has next: the command that reruns the saved draft from that block (or from the outermost loop or parallel holding it) with this run as --source-run, so after a fix only that block and those after it run again. Add --stop-after &lt;block&gt; to stop after a block; naming the block next starts from reruns only it.

Exit codes: 0 completed or paused (--async: queued); 1 failed or cancelled (the result is printed first, then the error on stderr), or the command failed; 4 still running when --wait-timeout elapsed.

API request and response schemas: [executeWorkflow](/api-reference/workflows/executeWorkflowV2).
Expand Down Expand Up @@ -1155,12 +1159,12 @@ sim workflows export <workflowId> [options]
| Option | Required | Description |
| --- | --- | --- |
| `--include-references` | No | Include non-secret resource identities for mapped import. |
| `--include-workspace-bindings` | No | Keep non-secret table, knowledge base, document, folder, channel, and other workspace bindings for a same-workspace import. Defaults to false, which clears these IDs. Registered credential fields and opaque table/tool values are cleared either way; environment references and ordinary workflow variables remain included. |
| `--include-workspace-bindings` | No | Keep table, knowledge base, document, folder, channel and other workspace bindings. On by default; --no-include-workspace-bindings clears them for a copy to share outside this workspace. Credentials are cleared either way. |
| `--no-include-workspace-bindings` | No | Send --include-workspace-bindings as false. |

</CommandTable>

Workspace bindings (a table, a child workflow, a knowledge base) print as null unless --include-workspace-bindings, and credentials always do: that is the export, not an unset block. To read what a block is set to, use `sim workflows outline` or `sim workflows state get`.
A table, child workflow, knowledge base or other workspace binding prints as its id; a credential always prints as null. For a copy to share outside this workspace, pass --no-include-workspace-bindings to clear the bindings too.

API request and response schemas: [exportWorkflow](/api-reference/workflows/exportWorkflow).

Expand Down Expand Up @@ -1522,7 +1526,7 @@ Compiles workflow.ts (and the function files it names) with the compiler the ser

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.

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_CHILD_RESULT_PATH, W_BRANCH_UNWIRED, W_UNRESOLVED_REF, W_REF_OUT_OF_SCOPE, W_LOOP_CONDITION_SYNTAX. --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 fails on none of them. In every mode, as the server refuses them: W_REF_OUT_OF_SCOPE is the error E_APPLY_REF_OUT_OF_SCOPE in any file of a block the edit added or changed; W_LOOP_CONDITION_SYNTAX is the error E_APPLY_LOOP_CONDITION_SYNTAX in any file of a block the edit added or changed; W_UNKNOWN_OPTION is the error E_APPLY_INVALID_SUBBLOCK_FIELD in workflow.ts on a block the edit added or changed; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNKNOWN_BLOCK_TYPE is the error E_APPLY_INVALID_BLOCK_TYPE in workflow.ts on a block the edit added or changed; W_TYPE_NOT_ADDABLE is the error E_APPLY_TYPE_NOT_ADDABLE in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_CODE_FILE_REF_SYNTAX is the error E_APPLY_CODE_FILE_REF_SYNTAX in a function file changed since the get. A block counts as changed when the lock does not bind it, when the source moved it into another container, or when it compiles differently than in the source the last get or apply printed (.sim/stored-edges.json records a digest of each block). That last comparison needs the catalog the source was printed with in the cache: without it, a bound block that did not move counts as unchanged, so the server may refuse what the check passes. A $ref in a function file to a block the lock binds that the source no longer declares stays a warning, unless a warning cap left findings out: the server may infer that block was renamed and rewrite the reference, and refuses it otherwise. W_JSON_REF_UNTYPED is reported only on blocks the lock does not bind, and with --strict on every block.
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_CHILD_RESULT_PATH, W_BRANCH_UNWIRED, W_UNRESOLVED_REF, W_REF_OUT_OF_SCOPE, W_LOOP_CONDITION_SYNTAX. --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 fails on none of them. In every mode, as the server refuses them: W_REF_OUT_OF_SCOPE is the error E_APPLY_REF_OUT_OF_SCOPE in any file of a block the edit added or changed; W_LOOP_CONDITION_SYNTAX is the error E_APPLY_LOOP_CONDITION_SYNTAX in any file of a block the edit added or changed; W_UNKNOWN_OPTION is the error E_APPLY_INVALID_SUBBLOCK_FIELD in workflow.ts on a block the edit added or changed; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNKNOWN_BLOCK_TYPE is the error E_APPLY_INVALID_BLOCK_TYPE in workflow.ts on a block the edit added or changed; W_TYPE_NOT_ADDABLE is the error E_APPLY_TYPE_NOT_ADDABLE in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_CODE_FILE_REF_SYNTAX is the error E_APPLY_CODE_FILE_REF_SYNTAX in a function file changed since the get. A block counts as changed when the lock does not bind it, when the source moved it into another container, or when it compiles differently than in the source the last get or apply printed (.sim/stored-edges.json records a digest of each block). That last comparison needs the catalog the source was printed with in the cache: without it, a bound block that did not move counts as unchanged, so the server may refuse what the check passes. A $ref in a function file to a block the lock binds that the source no longer declares stays a warning, unless a warning cap left findings out: the server may infer that block was renamed and rewrite the reference, and refuses it otherwise. W_JSON_REF_UNTYPED is reported only on blocks the edit added or changed, including an unedited block that an edit elsewhere makes compile differently, and with --strict on every block.

Exit 10 (busy, retry): another sim workspaces source or workflows source command is using this directory or a workflow folder in it (SOURCE_DIR_BUSY); nothing was read or written. Run this one again once it finished.

Expand Down
Loading
Loading