Skip to content

Commit 8bc0ce2

Browse files
authored
fix(sim-cli): publish when bundled packages change, complete third-party licenses, and fix docs drift (#10279)
The CLI republishes when any package it bundles changes (trigger paths derived from the bundle's real dependency graph and guarded by a new check:sim-cli-bundle audit), THIRD_PARTY_LICENSES lists every bundled package, and sim-cli is released as 2.3.0. Workspace apply keeps a tool code file the server reprinted as stored() and warns, outline prints block ids as sent, and the scripting exit tables, SDK README, code page and git provenance docs match the CLI.
1 parent 825a419 commit 8bc0ce2

22 files changed

Lines changed: 313 additions & 81 deletions

File tree

‎.github/workflows/publish-sim-cli.yml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ on:
66
paths:
77
- 'packages/sim-cli/**'
88
# The build bundles its workspace dependencies, so a change there
9-
# changes what ships.
9+
# changes what ships. `bun run check:sim-cli-bundle` fails when this
10+
# list and the bundle's workspace packages disagree.
11+
- 'packages/table-cells/**'
1012
- 'packages/utils/**'
13+
- 'packages/workflow-code/**'
14+
- 'packages/workflow-sdk/**'
15+
- 'packages/workflow-types/**'
16+
- 'packages/workspace-code/**'
1117
# A change to how the package is built or published has to republish it.
1218
- '.github/workflows/publish-sim-cli.yml'
1319

‎apps/docs/content/docs/cli/scripting.mdx‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,12 @@ The CLI resends a request the API answers `429` only when sending it twice is sa
168168
| Code | `sim workflows source apply` or `create` |
169169
| --- | --- |
170170
| `0` | Applied or created, or a dry run with no errors |
171-
| `1` | The source has errors (each printed as `file:line:column` with its frame and hint), or command/request failure |
171+
| `1` | The source has errors (each printed as `file:line:column` with its frame and hint), `create`'s workflow name is taken (`SOURCE_NAME_TAKEN`: pass `--name`), or command/request failure |
172172
| `5` | The workflow changed since the directory was read (`409 SOURCE_STALE`): get it again, reapply the edit, and retry |
173173
| `6` | The workflow or its folder is locked (`423`, `E_APPLY_LOCKED`); a locked block exits `1` (`E_APPLY_LOCKED_BLOCK`) |
174174
| `7` | The source is over the size limits (`413`) |
175175
| `9` | Still rate limited (`429`) after the CLI's retries; nothing was written |
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 |
176+
| `10` | Busy, retry: another `sim` command is using `--dir`, or the workspace directory it is a workflow folder of (`SOURCE_DIR_BUSY`); nothing was read or written: run it again once the other finished |
177177
| `13` | `AUTH_REQUIRED`: not logged in, or the server refused the credential; nothing was sent |
178178
| `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` |
179179
| `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 |
@@ -183,6 +183,7 @@ The CLI resends a request the API answers `429` only when sending it twice is sa
183183
| `0` | Clean: nothing to apply, and the server changed nothing since the directory was read |
184184
| `1` | Command/request failure |
185185
| `7` | The source is too large for the server to read in one dry run |
186+
| `10` | `sim workspaces source status` only: another `sim workspaces source` command is using the directory (`SOURCE_DIR_BUSY`); nothing was read: run it again once the other finished |
186187
| `11` | Local changes only: applying writes them |
187188
| `12` | The server changed since the directory was read (drift, or a conflict with local changes) |
188189
| `13` | `AUTH_REQUIRED`: not logged in, or the server refused the credential; the local changes are still shown |
@@ -191,13 +192,17 @@ The CLI resends a request the API answers `429` only when sending it twice is sa
191192
| --- | --- |
192193
| `0` | No errors (warnings may still print) |
193194
| `1` | The source has errors, or a warning that fails the check on a block the edit added (see `--strict`), or no block catalog is cached: run the get once |
195+
| `10` | `sim workspaces source check` only: another `sim workspaces source` command is using the directory (`SOURCE_DIR_BUSY`); nothing was read: run it again once the other finished |
194196

195197
| Code | `sim workflows source get --dir` or `sim workspaces source get` |
196198
| --- | --- |
197199
| `0` | Written |
198-
| `1` | The directory holds edits no apply has saved (`SOURCE_LOCAL_EDITS`) or another workflow's source (`SOURCE_WORKFLOW_MISMATCH`): apply them, get into another directory, or pass `--force`; or command/request failure |
200+
| `1` | The directory holds edits no apply has saved (`SOURCE_LOCAL_EDITS`) or another workflow's source (`SOURCE_WORKFLOW_MISMATCH`): apply them, get into another directory, or pass `--force`; it is the other kind of source directory (`SOURCE_DIR_KIND_MISMATCH`, even with `--force`); for a workspace, `--workspace` names another workspace than the one the directory was read from (`SOURCE_OTHER_WORKSPACE`) or a downloaded binary file does not match its listing (`SOURCE_BLOB_MISMATCH`); or command/request failure |
199201
| `7` | The workflow, or a kind of resource, is too large for one directory |
200202
| `9` | Still rate limited (`429`) after the CLI's retries; nothing was written |
203+
| `10` | Busy, retry: another `sim` command is using the directory (or, for a workflow folder, its workspace directory) (`SOURCE_DIR_BUSY`); nothing was read or written: run it again once the other finished |
204+
| `13` | `AUTH_REQUIRED`: not logged in, the login expired, or the server refused the credential; nothing was read or written: run `sim login` and the get again |
205+
| `130` | Interrupted (Ctrl-C): run the get again |
201206

202207
| Code | `sim workspaces source apply` |
203208
| --- | --- |

‎apps/docs/content/docs/platform/enterprise/audit-logs.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Events use identifiers such as `resource.action`. These categories are represent
104104
| Links | `sim_link.created`, `sim_link.updated`, `sim_link.deleted` |
105105
| Exports and drains | `audit_logs.exported`, `data_drain.created`, `data_drain.updated`, `data_drain.ran`, `data_drain.tested` |
106106

107-
Authentication failures and password-reset requests use an anonymous actor and record the target account separately. Impersonation and administrative session revocations identify the operator and target organization. Table-row mutations record summaries and counts without copying row contents.
107+
Authentication failures and password-reset requests use an anonymous actor and record the target account separately. Impersonation and administrative session revocations identify the operator and target organization. Table-row mutations record summaries and counts without copying row contents. A workflow or workspace written from source by the CLI (`workflow.created`, `workflow.updated` or `workspace.updated`) records `metadata.client` as `cli` and, when the source directory is in a git repository and `git` can read them, `metadata.gitSha` (the commit checked out) and `metadata.repo` (the `origin` remote URL, with any credentials removed). Either may be absent, for example `repo` in a repository with no `origin`.
108108

109109
When a workflow run makes the same kind of change to a table many times in quick succession, such as inserting rows in a loop, the repeats are merged into one `table.updated` entry. The merged entry keeps every row ID in `metadata.rowIds`, sums the counts, and records in `metadata.rollup` how many changes it covers and when the first and last happened. The actor of any workflow-made entry names the workflow (`metadata.actor.workflowId`) and the run (`metadata.actor.executionId`). Credential use by a workflow run is merged the same way: one `credential.accessed` entry per credential, counting the repeats, that names the workflow (`metadata.workflowId`) and the run (`metadata.executionId`).
110110

‎apps/docs/content/docs/workflows/code.mdx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ Claude Code, Cursor, Codex and other coding agents work from a directory that `g
1919
2. Edit `workflow.ts`.
2020
3. `sim workflows source check --dir <dir>` compiles it offline.
2121
4. `sim workflows source status --dir <dir>` shows what changed and what to run next.
22+
5. `sim workflows source apply --dir <dir> --dry-run`, then `--yes`, saves the draft.
2223

2324
To write a block the workflow does not use yet, `sim workflows source params <builder>` (for example `table.upsertRow` or `trigger.schedule`) prints its params, required ones first with their options and defaults, and its outputs, from the cached block catalog without a request. A namespace such as `gmail` lists its builders.
24-
5. `sim workflows source apply --dir <dir> --dry-run`, then `--yes`, saves the draft.
2525

2626
For a whole workspace, use `sim workspaces source` with the same steps; see [Workspace as code](/workflows/workspace-code).
2727

@@ -206,6 +206,7 @@ Run `sim workflows source apply <workflowId> --dir <dir> --dry-run` in CI to cat
206206
- **Commit** `workflow.ts`, `functions/`, `.sim/lock.json`, `.sim/base.json`, `.sim/written.json`, `tsconfig.json` and `.gitattributes`. CI finds the workflow from `workflowId` in `.sim/base.json`, and `status` and `get` use `.sim/written.json` to tell your edits apart from what the CLI last wrote.
207207
- **Optionally gitignore** `.sim/sdk/`, the generated type declarations of the blocks in use (a few dozen files); `get` and `check` write them again. Gitignore `tsconfig.full.json`, which names the CLI's cache on your machine; `check` writes it again. A single-workflow directory gets no `.gitignore`, so add the lines yourself.
208208
- **A whole workspace** in one repository, with dry runs on pull requests, apply on merge and promotion from one workspace to another, is covered in [Git and CI](/workflows/workspace-code#git-and-ci) and [Promote to another workspace](/workflows/workspace-code#promote-to-another-workspace).
209+
- **Git provenance:** in a git repository, `apply` and `create` send the commit checked out (`HEAD`) and the `origin` remote URL, with any credentials, query or fragment removed, as `provenance.gitSha` and `provenance.repo`, each only when `git` can read it (a repository with no `origin` sends only the commit). A saved write records what was sent in its [audit log](/platform/enterprise/audit-logs) entry (`workflow.updated` or `workflow.created`). A directory outside a repository sends neither.
209210
- **Credentials:** use a personal API key (**Settings → Sim API keys**, passed as `SIM_API_KEY`) or an OAuth login, not a workspace API key. Saving and dry-running source act as a person, so a workspace key is refused with `403`. Set `SIM_WORKSPACE` unless you pass `--workspace`, and `SIM_ENDPOINT` if you use a self-hosted Sim. See [Authenticating CI](/cli/authentication#authenticating-ci).
210211

211212
## Working with other people

‎apps/docs/content/docs/workflows/workspace-code.mdx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ Commit the record with the rest of the directory, so a promotion from CI or anot
108108

109109
Commit the whole directory, including `.sim/`: its base files are what an apply compares with, from any clone. The generated `.gitignore` leaves out only temporary files. A fresh clone can run `check`, `apply --dry-run` and `apply` with nothing else. See [Workspace source in CI](/cli/scripting#workspace-source-in-ci) for a GitHub Actions setup.
110110

111+
In a git repository, `apply` sends the commit checked out (`HEAD`) and the `origin` remote URL, with any credentials, query or fragment removed, as `provenance.gitSha` and `provenance.repo`, each only when `git` can read it (a repository with no `origin` sends only the commit). An apply that writes records what was sent in its `workspace.updated` [audit log](/platform/enterprise/audit-logs) entry. A directory outside a repository sends neither.
112+
111113
## Good to know
112114

113115
- Secret values never appear. Workflows read environment variables as `env.NAME`, tool code as `$env.NAME`, and credentials by key.

‎biome.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"!**/packages/workflow-sdk/src/codegen/core-text.generated.ts",
3838
"!**/packages/workflow-sdk/src/codegen/cookbook-text.generated.ts",
3939
"!**/packages/workflow-sdk/src/codegen/workspace-cookbook-text.generated.ts",
40+
"!**/packages/workflow-sdk/src/codegen/workspace-text.generated.ts",
4041
"!**/packages/workflow-sdk/cookbook/workspace/tools/*.js",
4142
"!**/apps/docs/.content",
4243
"!**/apps/desktop/release",

‎bun.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
"check:mcp-operations": "bun run scripts/generate-v2-mcp-operations.ts --check",
4040
"generate:cli-docs": "bun run scripts/generate-cli-docs.ts",
4141
"check:cli-docs": "bun run scripts/generate-cli-docs.ts --check",
42+
"check:sim-cli-bundle": "bun run scripts/check-sim-cli-bundle.ts",
43+
"generate:workflow-sdk-embedded-text": "bun run packages/workflow-sdk/scripts/generate-embedded-text.ts",
44+
"check:workflow-sdk-embedded-text": "bun run packages/workflow-sdk/scripts/generate-embedded-text.ts --check",
4245
"generate:v2-route-table": "bun run scripts/generate-v2-route-table.ts",
4346
"check:v2-route-table": "bun run scripts/generate-v2-route-table.ts --check",
4447
"check:canonical-index": "bun run scripts/check-canonical-index-surface.ts",

‎packages/sim-cli/THIRD_PARTY_LICENSES‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
The Sim CLI bundle includes the following third-party software.
22

3+
@babel/parser
4+
Copyright (C) 2012-2014 by various contributors (see AUTHORS)
5+
6+
@noble/hashes
7+
Copyright (c) 2022 Paul Miller (https://paulmillr.com)
8+
39
chalk
410
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
511

@@ -22,6 +28,9 @@ retry
2228
Copyright (c) 2011 Tim Koschützki (tim@debuggable.com)
2329
Copyright (c) 2011 Felix Geisendörfer (felix@debuggable.com)
2430

31+
zod
32+
Copyright (c) 2025 Colin McDonnell
33+
2534
Each dependency above is licensed under the MIT License:
2635

2736
Permission is hereby granted, free of charge, to any person obtaining a copy

‎packages/sim-cli/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sim",
3-
"version": "2.2.0",
3+
"version": "2.3.0",
44
"description": "Sim CLI - talk to the Sim API from your terminal",
55
"type": "module",
66
"imports": {

0 commit comments

Comments
 (0)