Skip to content

Commit 8f293ad

Browse files
authored
docs(workflow-code): document --run trigger selection, multi-block find, and the root AGENTS.md pointer (#10550)
edit.mdx and coding-agents.mdx now cover naming a trigger in --run and repeating it, and find taking several block names. directory.mdx, ci.mdx and coding-agents.mdx list the root AGENTS.md pointer get writes. The advanced guide's find line and the layout TSDoc match the CLI.
1 parent 3321522 commit 8f293ad

6 files changed

Lines changed: 9 additions & 6 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Saving and dry-running source act as a person. Use a personal API key (**Setting
1111

1212
## What to commit
1313

14-
- **A workflow directory:** commit `workflow.ts`, `functions/`, `.sim/lock.json`, `.sim/base.json`, `.sim/written.json`, `.sim/stored-edges.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. Gitignore `tsconfig.full.json`; `.sim/sdk/` is optional.
14+
- **A workflow directory:** commit `workflow.ts`, `functions/`, `.sim/lock.json`, `.sim/base.json`, `.sim/written.json`, `.sim/stored-edges.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. Gitignore `tsconfig.full.json`; `.sim/sdk/` and the root `AGENTS.md` pointer are optional.
1515
- **A workspace directory:** commit everything, including `.sim/`. Its generated `.gitignore` leaves out only temporary files.
1616

1717
[Directory layout](/workflows/code/directory) lists every file.

‎apps/docs/content/docs/workflows/code/coding-agents.mdx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Claude Code, Cursor, Codex and other coding agents work from a directory that `g
88
## What get gives an agent
99

1010
- A **primer**, which opens `.sim/AGENTS.md`. `get` prints a short summary instead (the files written, the guide, and the `editLoop` command to run). It covers the edit loop, how block identity, references and renames work, failures and retries, test runs, deletes, deploy, exit codes, and the params of each builder the workflow already uses.
11+
- **`AGENTS.md`** at the directory root: a short pointer to `.sim/AGENTS.md` with the edit loop and exit codes, which agents that load the nearest `AGENTS.md` find first. `get` writes it again unless you delete its first line, which makes the file yours.
1112
- **`.sim/AGENTS.md`**: the primer followed by a reference, by task. **`.sim/GUIDE-advanced.md`** beside it has the rest, by task, in a workflow directory and a workspace directory alike.
1213
- **`.sim/examples/`**: one correct example of each common block to copy from.
1314
- **`.sim/sdk/`**: the type declarations, with `.sim/sdk/INDEX.md` listing the builders.
@@ -26,15 +27,15 @@ Point the agent at `.sim/AGENTS.md` before it edits.
2627

2728
A non-zero exit code stops the chain at the first failure. `apply` compiles the source and compares it with the saved draft again, so an agent can skip `--dry`. `check` also type-checks the directory, so the chain needs no separate `tsc`. People and CI use `apply --dry` to review the plan, and `status` shows what changed and what to run next.
2829

29-
`--run` dry-runs the saved draft with that input, and `--deploy` deploys only if the run completed; a run that fails exits 1, deploys nothing, and maps the failing block to its file and line. Drop `--deploy` to keep the change a draft. The result opens with a one-line `summary` and ends with `errors`, `warnings`, `live` and `next`, so a `| head` or `| tail` of it still shows the outcome.
30+
`--run` dry-runs the saved draft with that input, and `--deploy` deploys only if the run completed; a run that fails exits 1, deploys nothing, and maps the failing block to its file and line. With several triggers (an API and a webhook), name the entry by its const, as in `--run 'shopWebhook={...}'`, and repeat `--run` to test each path: `--deploy` needs every run to complete. Drop `--deploy` to keep the change a draft. The result opens with a one-line `summary` and ends with `errors`, `warnings`, `live` and `next`, so a `| head` or `| tail` of it still shows the outcome.
3031

3132
The dry run (also `sim workflows run <workflowId> --dry`) tests the saved draft without sending its writes: each write returns a placeholder and is listed under `sideEffects` with the request it would have sent, so the agent checks payloads instead of cleaning up rows or messages. `--allow <block>` sends one block's writes for real against a test resource, and `--draft` runs everything for real.
3233

3334
For a whole workspace, use `sim workspaces source` with the same steps: its chained command is `sim workspaces source check --dir <dir> && sim workspaces source apply --dir <dir> --yes --run <key>='{...}'`, one `--run` per workflow folder (`workflows/<key>/`) to test, and `deployments/` is applied only if every run completed. See [Test workflows on apply](/workflows/code/workspace#test-workflows-on-apply).
3435

3536
## Look things up
3637

37-
- `sim workflows source find <block>` prints one block of the workflow by name, key or identifier, from the directory without a request: its declaration with line numbers, its function file, its incoming and outgoing wiring and every block that reads its outputs, each as `file:line`. A part of a name prints every block it matches.
38+
- `sim workflows source find <block...>` prints each named block of the workflow by name, key or identifier, from the directory without a request: its declaration with line numbers, its function file, its incoming and outgoing wiring and every block that reads its outputs, each as `file:line`. A part of a name prints every block it matches. Name every block a change touches in one call; a name that matches no block exits `1` after the others print.
3839
- `sim workflows source params <builder>` prints a builder in brief (an example call, the required params with types, the optional ones by name and the outputs) from the cached block catalog without a request. `--full` prints every param with its type, options, default and doc. A legacy builder names the one that replaces it, and a namespace such as `gmail` lists its builders.
3940
- `sim workflows source resources` lists the tables, knowledge bases, credentials, workflows, skills, custom tools, MCP servers and environment variable names the file can name.
4041
- `sim workflows source catalog` shows the block catalog the source is checked against.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ description: Every file a workflow directory and a workspace directory holds, wh
1818
| `.sim/written.json` | A digest of each file as the CLI last wrote it, so `status` and `get` tell your edits from the CLI's | Commit |
1919
| `.sim/stored-edges.json` | The connections the stored workflow held when it was printed, so an offline `check` tells them from connections you added. The CLI's own record, never sent | Commit |
2020
| `.sim/starter.json` | The workspace a starter was written for, before `create` | Not kept: removed once the workflow exists |
21+
| `AGENTS.md` | A pointer for coding agents to `.sim/AGENTS.md`, with the edit loop and exit codes | Optional, written again by `get` unless you delete its first line |
2122
| `.sim/AGENTS.md` | The guide for coding agents: the primer, then a reference | Optional, written again by `get` |
2223
| `.sim/GUIDE-advanced.md` | The rest of the guide, by task: the edit loop step by step and what a dry run stubs, a new workflow or a fork, finding a builder and its types, the rules, and every diagnostic and exit code | Optional, written again by `get` |
2324
| `.sim/examples/` | Example workflows to copy from | Optional, written again by `get` |
@@ -76,6 +77,7 @@ Beside the resources:
7677
| `.sim/written.json` | A digest of each file as the CLI last wrote it, so `status` and `get` tell your edits from the CLI's | Commit |
7778
| `.sim/targets/<workspaceId>.json` | What each [promotion](/workflows/code/promote) left in that workspace | Commit |
7879
| `.sim/skipped.json` | Documents and files a get left out, with the reason | Optional |
80+
| `AGENTS.md` | A pointer for coding agents to `.sim/AGENTS.md`, as for a workflow directory | Optional, written again by `get` unless you delete its first line |
7981
| `.sim/AGENTS.md`, `.sim/GUIDE-advanced.md`, `.sim/examples/`, `.sim/sdk/` | The agent guide with deletes, Git and CI, and promotion in depth; examples of every kind; type declarations including `.sim/sdk/workspace.d.ts` | Optional, written again by `get` |
8082
| `.sim/cache/` | This machine's file stats. It ignores itself | Not committed |
8183
| `tsconfig.json`, `tsconfig.full.json`, `.gitattributes`, `.gitignore` | As for a workflow directory. `.gitattributes` also keeps workspace files and knowledge base documents byte for byte | Commit all but `tsconfig.full.json` |

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Editing the name or description in `workflow('…')` renames or redescribes the
7676

7777
### Deploy
7878

79-
Saving writes the draft. Add `--deploy` to deploy right after the save, which also prints the URL of each webhook the workflow now serves. Add `--run '<input json>'` to dry-run the saved draft with that input first: with `--deploy`, it deploys only if the run completed. Without `--deploy`, a deployed workflow whose draft now differs prints the `sim workflows deploy` command to run, pinned to the draft this apply saved; after an apply without `--run`, it also names the apply that tests and deploys in one step.
79+
Saving writes the draft. Add `--deploy` to deploy right after the save, which also prints the URL of each webhook the workflow now serves. Add `--run '<input json>'` to dry-run the saved draft with that input first: with `--deploy`, it deploys only if the run completed. A workflow with several triggers (an API and a webhook) needs the entry named by its const, as in `--run 'shopWebhook={…}'`. Repeat `--run` to test each input or trigger: every run is made and reported, and `--deploy` needs all of them to complete. Without `--deploy`, a deployed workflow whose draft now differs prints the `sim workflows deploy` command to run, pinned to the draft this apply saved; after an apply without `--run`, it also names the apply that tests and deploys in one step.
8080

8181
### Deletes
8282

‎packages/sim-cli/src/commands/protocol/source-dir/layout.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { SourceDirError } from '../local-errors'
1515

1616
/** Generated SDK declarations: the blocks the source uses (every block's are cached), plus `workspace.d.ts`. */
1717
export const SOURCE_SDK_DIR = '.sim/sdk'
18-
/** A short guide for an agent working in the directory; never a top-level `AGENTS.md`. */
18+
/** The guide for an agent working in the directory, which the root `AGENTS.md` pointer names. */
1919
export const SOURCE_AGENTS_FILE = '.sim/AGENTS.md'
2020
/**
2121
* Example workflows (`cookbook.ts`, `integrations.ts`, `agents.ts`): together one correct example

‎packages/sim-cli/src/commands/protocol/workflow-dir.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ Editing the \`workflow('…')\` name or description renames or redescribes the w
300300
301301
## Finding a builder and its types
302302
303-
- \`sim workflows source find <block>\`: one block of this workflow by name, key or identifier, from the directory alone: its declaration with line numbers, its function file, its incoming and outgoing wiring and every block that reads its outputs, each as file:line. A part of a name prints every block it matches (\`find 'Fetch Policy'\`). Use it instead of searching a long \`${SOURCE_ENTRY_FILE}\`.
303+
- \`sim workflows source find <block...>\`: each named block of this workflow by name, key or identifier, from the directory alone: its declaration with line numbers, its function file, its incoming and outgoing wiring and every block that reads its outputs, each as file:line. A part of a name prints every block it matches; name every block a change touches in one call (\`find 'Fetch Policy' 'Refunds Score'\`). Use it instead of searching a long \`${SOURCE_ENTRY_FILE}\`.
304304
- \`sim workflows source params <builder>\`: one builder's params (required first, enums, defaults) and outputs; a namespace (\`gmail\`) lists its builders; a miss names the closest. Builders are named for the service, not the block type: \`gmail_v2\` is \`gmail.*\`, \`workflow_input\` is \`runWorkflow\`, the HTTP request block is \`api\`, and \`legacy.*\` builders are old versions not to write.
305305
- \`${SDK_DIR}/core.d.ts\`: the SDK (\`workflow\`, \`t\`, \`env\`, \`credential\`, \`table\`, \`loop\`, \`parallel\`, \`BlockMeta\`).
306306
- \`${SDK_DIR}/blocks/<block type>.d.ts\`: the builders of a block the source uses, with their params and outputs (check adds the file of a block an edit starts using). Do not read them, or \`${SDK_DIR}/models.d.ts\`, whole: \`params\` prints the part you need, and \`grep\` finds a model id.

0 commit comments

Comments
 (0)