Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
fc585d0
refactor(table-cells): move table cell rules to a pure @sim/table-cel…
waleedlatif1 Nov 20, 2026
161faf7
refactor(testing): one linear-growth helper in @sim/testing
waleedlatif1 Nov 20, 2026
65046e7
refactor(deployments): withExpectedDraft runs a publish under its dra…
waleedlatif1 Nov 20, 2026
eee7fb3
refactor(workflow-code): one diagnostics module for codes, severity, …
waleedlatif1 Nov 20, 2026
140eb3e
refactor(workflow-code): bound findings once at the answer edge, one …
waleedlatif1 Nov 20, 2026
0443812
refactor(workflow-code): split the source pipeline into plan, preview…
waleedlatif1 Nov 20, 2026
aa8de4f
refactor(workflow-code): present the source routes' outcome explicitly
waleedlatif1 Nov 20, 2026
5ec6218
refactor(sim-cli): split source-dir.ts into a source-dir/ folder behi…
waleedlatif1 Nov 20, 2026
2cc526c
refactor(sim-cli): stop source command files importing each other
waleedlatif1 Nov 20, 2026
15bc735
refactor(sim-cli): raise source refusals as SourceDirError and CliUsa…
waleedlatif1 Nov 20, 2026
e9fa778
refactor(sim-cli): one runSourceWrite flow, and a command lock on eve…
waleedlatif1 Nov 20, 2026
9e0d2fa
refactor(sim-cli): generate source commands' exit-code help from the …
waleedlatif1 Nov 20, 2026
7c5346a
docs(sim-cli): name the shared source modules after the split
waleedlatif1 Nov 20, 2026
505d315
refactor(sim-cli): drop the base type alias the apply command no long…
waleedlatif1 Nov 20, 2026
6f20fd7
refactor(workflow-code): source pipeline findings through the diagnos…
waleedlatif1 Nov 20, 2026
a359c8e
refactor(workflows): drop outcome fields nothing reads and the unreac…
waleedlatif1 Nov 20, 2026
cf3cdce
refactor(workflows): workspace commits take a plan, and the pipeline …
waleedlatif1 Nov 20, 2026
854293a
fix(sim-cli): the command lock removes the parent folders it created
waleedlatif1 Nov 20, 2026
c11bf92
refactor(workflow-code): one answer bound, applied only at the edges
waleedlatif1 Nov 20, 2026
8265ca5
feat(sim-cli): bound offline check output as the server bounds an answer
waleedlatif1 Nov 20, 2026
7d4fa3c
test(sim-cli): a standalone directory no one may write dry-runs and p…
waleedlatif1 Nov 20, 2026
aa823e2
test(workflows): guard update audit provenance, dry-run key allocatio…
waleedlatif1 Nov 20, 2026
666efc3
refactor(workflows): one EMPTY_LOCK beside the empty stored source
waleedlatif1 Nov 20, 2026
d990384
refactor(workflow-code): drop exports the bound move left unused
waleedlatif1 Nov 20, 2026
103e621
fix(workflows): refuse a foreign plan before replanning it at commit
waleedlatif1 Nov 20, 2026
bd2f334
test(source): guard the workflow GET, workspace GET and workspace pla…
waleedlatif1 Nov 20, 2026
d35f60f
test(sim-cli): guard the workflows source check default answer bound
waleedlatif1 Nov 20, 2026
8b33d0d
fix(sim-cli): resolve the locked directory before creating it
waleedlatif1 Nov 20, 2026
024be2d
docs(workflow-code): say only a cut list holds a single truncation ma…
waleedlatif1 Nov 20, 2026
c798d4d
fix(sim-cli): a source plan no longer refreshes the workspace types
waleedlatif1 Nov 20, 2026
2f94949
fix(sim-cli): prune only real code files a previous lock named
waleedlatif1 Nov 20, 2026
f3bc9b0
fix(sim-cli): an embedded source read stopped mid-run throws
waleedlatif1 Nov 20, 2026
4cfb7ca
fix(sim-cli): never read a local refusal as an unreachable server
waleedlatif1 Nov 20, 2026
92beb64
test(workflows): name the dry-run key check for the stored credential…
waleedlatif1 Nov 20, 2026
d31ac0b
docs(rules): name workspace-source-dir.ts among the shared source mod…
waleedlatif1 Nov 20, 2026
6f7207b
docs(workflow-code): a withheld refusable warning still builds its co…
waleedlatif1 Nov 20, 2026
6c88b63
fix(sim-cli): both source gets name exit 13 in their --help
waleedlatif1 Nov 20, 2026
c53441b
docs(cli): regenerate the reference for the source gets' exit 13
waleedlatif1 Nov 20, 2026
e5467fe
Merge remote-tracking branch 'origin/staging' into refactor/workflow-…
waleedlatif1 Nov 20, 2026
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
7 changes: 4 additions & 3 deletions .claude/rules/sim-workflow-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@ workspace directory).
| `packages/workflow-types` | Shared workflow, block and resource-kind types (`WORKFLOW_RESOURCE_KINDS`) |
| `packages/workflow-code` | Pure engines for one workflow: catalog types, canonicalize, print, compile, materialize, lock, diagnostics |
| `packages/workspace-code` | Pure workspace half: `KIND_DIRS`, `APPLY_ORDER`, one codec per kind (`src/kinds/`), `.sim/base.json`, `rf1:` fingerprints, limits |
| `packages/table-cells` | Pure table cell rules (coerce, validate, currency/date/ttl parsing) shared by the table codec's offline row check and the server's writes |
| `packages/workflow-sdk` | Authoring declarations (`src/core.d.ts`, `src/workspace/*.d.ts`), type codegen from the catalog (`src/codegen/`), the cookbook |
| `packages/sim-cli/src/commands/protocol/` | `workflow-source-*` and `workspace-source-*` commands; `source-dir.ts`, `source-tree.ts`, `source-ui.ts` are shared |
| `packages/sim-cli/src/commands/protocol/` | `workflow-source-*` and `workspace-source-*` commands, which never import each other's command modules; `source-dir/`, `workflow-dir.ts`, `source-check.ts`, `source-write.ts`, `source-tree.ts`, `source-ui.ts` and `workspace-source-dir.ts` (the workspace directory reader a workflow check also reads declarations through) are shared |
| `apps/sim/lib/workflows/code/` | Server glue: catalog projection from the registry (`catalog/`), source-apply gates (`apply/`), stored canonical form, the feature flag, the proof corpus (`corpus/`) |
| `apps/sim/lib/workflows/application/*source*` | Workflow source use cases: read, apply, create, catalog, resources |
| `apps/sim/lib/workspace-source/` | Workspace source use cases (`application/`), one adapter per kind (`application/kinds/<kind>/`), route policies (`api/`) |
| `apps/sim/blocks/sdk-names/<type>.json` | Frozen SDK builder names, one file per block type |
| `apps/sim/app/workspace/**/panel/components/code/` | The read-only Code tab |

Dependencies point one way: `packages/workflow-types` → `packages/workflow-code` →
`packages/workspace-code` and `packages/workflow-sdk` → the CLI and `apps/sim`. `check:boundaries` keeps both engines pure (no
`packages/workspace-code` and `packages/workflow-sdk` → the CLI and `apps/sim`. `check:boundaries` keeps both engines and `packages/table-cells` pure (no
Node built-ins, `eval`, `globalThis`, dynamic import): they run in the browser, the CLI and the
server unchanged.

Expand Down Expand Up @@ -151,7 +152,7 @@ satisfy.
4. If workflows name it by key: `WORKFLOW_RESOURCE_KINDS`, the live loader in
`lib/workspaces/resource-keys.ts`, the manifest in `read-source-resources.ts` and
`codegen/workspace.ts`, and `PENDABLE_REFERENCES` in
`lib/workflows/application/source-evaluate.ts`.
`lib/workflows/application/source-pipeline/evaluate/finalize.ts`.
5. SDK: `packages/workflow-sdk/src/workspace/<kind>.d.ts` plus `index.d.ts`, a cookbook example
under `cookbook/workspace/`, then regenerate the embedded text.
6. CLI (`workspace-source-dir.ts`): `workspaceTsconfig` includes, the `AGENTS_GUIDE` section and
Expand Down
7 changes: 4 additions & 3 deletions .cursor/rules/sim-workflow-code.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ workspace directory).
| `packages/workflow-types` | Shared workflow, block and resource-kind types (`WORKFLOW_RESOURCE_KINDS`) |
| `packages/workflow-code` | Pure engines for one workflow: catalog types, canonicalize, print, compile, materialize, lock, diagnostics |
| `packages/workspace-code` | Pure workspace half: `KIND_DIRS`, `APPLY_ORDER`, one codec per kind (`src/kinds/`), `.sim/base.json`, `rf1:` fingerprints, limits |
| `packages/table-cells` | Pure table cell rules (coerce, validate, currency/date/ttl parsing) shared by the table codec's offline row check and the server's writes |
| `packages/workflow-sdk` | Authoring declarations (`src/core.d.ts`, `src/workspace/*.d.ts`), type codegen from the catalog (`src/codegen/`), the cookbook |
| `packages/sim-cli/src/commands/protocol/` | `workflow-source-*` and `workspace-source-*` commands; `source-dir.ts`, `source-tree.ts`, `source-ui.ts` are shared |
| `packages/sim-cli/src/commands/protocol/` | `workflow-source-*` and `workspace-source-*` commands, which never import each other's command modules; `source-dir/`, `workflow-dir.ts`, `source-check.ts`, `source-write.ts`, `source-tree.ts`, `source-ui.ts` and `workspace-source-dir.ts` (the workspace directory reader a workflow check also reads declarations through) are shared |
| `apps/sim/lib/workflows/code/` | Server glue: catalog projection from the registry (`catalog/`), source-apply gates (`apply/`), stored canonical form, the feature flag, the proof corpus (`corpus/`) |
| `apps/sim/lib/workflows/application/*source*` | Workflow source use cases: read, apply, create, catalog, resources |
| `apps/sim/lib/workspace-source/` | Workspace source use cases (`application/`), one adapter per kind (`application/kinds/<kind>/`), route policies (`api/`) |
| `apps/sim/blocks/sdk-names/<type>.json` | Frozen SDK builder names, one file per block type |
| `apps/sim/app/workspace/**/panel/components/code/` | The read-only Code tab |

Dependencies point one way: `packages/workflow-types` → `packages/workflow-code` →
`packages/workspace-code` and `packages/workflow-sdk` → the CLI and `apps/sim`. `check:boundaries` keeps both engines pure (no
`packages/workspace-code` and `packages/workflow-sdk` → the CLI and `apps/sim`. `check:boundaries` keeps both engines and `packages/table-cells` pure (no
Node built-ins, `eval`, `globalThis`, dynamic import): they run in the browser, the CLI and the
server unchanged.

Expand Down Expand Up @@ -141,7 +142,7 @@ satisfy.
4. If workflows name it by key: `WORKFLOW_RESOURCE_KINDS`, the live loader in
`lib/workspaces/resource-keys.ts`, the manifest in `read-source-resources.ts` and
`codegen/workspace.ts`, and `PENDABLE_REFERENCES` in
`lib/workflows/application/source-evaluate.ts`.
`lib/workflows/application/source-pipeline/evaluate/finalize.ts`.
5. SDK: `packages/workflow-sdk/src/workspace/<kind>.d.ts` plus `index.d.ts`, a cookbook example
under `cookbook/workspace/`, then regenerate the embedded text.
6. CLI (`workspace-source-dir.ts`): `workspaceTsconfig` includes, the `AGENTS_GUIDE` section and
Expand Down
10 changes: 4 additions & 6 deletions apps/docs/content/docs/cli/reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8547,7 +8547,7 @@ sim workflows source get <workflowId> [options]

</CommandTable>

Exit codes with --dir: 0 written; 1 the command failed, the directory is a workspace source directory (SOURCE_DIR_KIND_MISMATCH, even with --force), or it holds another workflow's source (SOURCE_WORKFLOW_MISMATCH) or edits no apply has saved (SOURCE_LOCAL_EDITS: apply them, get into another directory, or pass --force); 7 the workflow is too large to print as source; 9 rate limited (HTTP 429) after the CLI's retries: 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.
Exit codes with --dir: 0 written; 1 the command failed, the directory is a workspace source directory (SOURCE_DIR_KIND_MISMATCH, even with --force), or it holds another workflow's source (SOURCE_WORKFLOW_MISMATCH) or edits no apply has saved (SOURCE_LOCAL_EDITS: apply them, get into another directory, or pass --force); 7 the workflow is too large to print as source; 9 rate limited (HTTP 429) after the CLI's retries: wait a minute and run it again; 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; 13 not logged in, the login expired, or the server refused the credential (AUTH_REQUIRED): nothing was read or written, run `sim login` and the get again.

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

Expand Down Expand Up @@ -8584,7 +8584,7 @@ sim workflows source apply [workflowId] [options]

</CommandTable>

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.
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; 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; 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 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.

API request and response schemas: [applyWorkflowSource](/api-reference/workflows/applyWorkflowSource), [deployWorkflow](/api-reference/workflows/deployWorkflow), [getSourceResources](/api-reference/workflows/getSourceResources).

Expand Down Expand Up @@ -8612,7 +8612,7 @@ sim workflows source create [options]

</CommandTable>

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.
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; 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; 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 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.

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).

Expand Down Expand Up @@ -9960,9 +9960,7 @@ sim workspaces source get [options]

A directory that already holds a .sim/base.json is refreshed from the workspace it was read from, whatever the profile's default workspace.

Exit codes: 0 written; 1 the command failed, the directory holds edits no apply has saved (SOURCE_LOCAL_EDITS: apply them, get into another directory, or pass --force), --workspace names another workspace than the one the directory was read from (SOURCE_OTHER_WORKSPACE), the directory is a workflow source directory (SOURCE_DIR_KIND_MISMATCH, even with --force), or a downloaded binary file does not match its listing (SOURCE_BLOB_MISMATCH: nothing was written); 7 the workspace has more resources of a kind than one directory holds; 9 rate limited (HTTP 429) after the CLI's retries: nothing was written, the binary files already downloaded are kept in .sim/downloads, and running the get again downloads only the rest.

Exit 10 (busy, retry): another sim workspaces source command is using this directory (SOURCE_DIR_BUSY); nothing was read or written. Run this one again once it finished.
Exit codes: 0 written; 1 the command failed, the directory holds edits no apply has saved (SOURCE_LOCAL_EDITS: apply them, get into another directory, or pass --force), --workspace names another workspace than the one the directory was read from (SOURCE_OTHER_WORKSPACE), the directory is a workflow source directory (SOURCE_DIR_KIND_MISMATCH, even with --force), or a downloaded binary file does not match its listing (SOURCE_BLOB_MISMATCH: nothing was written); 7 the workspace has more resources of a kind than one directory holds; 9 rate limited (HTTP 429) after the CLI's retries: nothing was written, the binary files already downloaded are kept in .sim/downloads, and running the get again downloads only the rest; 10 (busy, retry) another sim workspaces source command is using this directory (SOURCE_DIR_BUSY): nothing was read or written, run it again once it finished; 13 not logged in, the login expired, or the server refused the credential (AUTH_REQUIRED): nothing was read or written, run `sim login` and the get again.

API request and response schemas: [getWorkspaceSource](/api-reference/workflows/getWorkspaceSource), [getSourceCatalog](/api-reference/catalog/getSourceCatalog), [getSourceResources](/api-reference/workflows/getSourceResources), [downloadFile](/api-reference/files/downloadFile), [downloadKnowledgeDocument](/api-reference/knowledge-bases/downloadKnowledgeDocument).

Expand Down
Loading
Loading