Skip to content

Commit ca491cc

Browse files
committed
fix(workflow-code): keep the test-resource warning on --allow, concrete table commands in the chat help
1 parent 86faf7f commit ca491cc

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

‎packages/sim-cli/src/commands/protocol/source-loop-help.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ function statusLine(group: string, dir: string): string {
3030
export function workflowSourceScopeHelp(surface: PrimerSurface): string {
3131
const tables =
3232
surface === 'chat'
33-
? `change a table's columns with
34-
\`sim tables columns create|update\` before the get (the table types it writes miss a later
35-
change), its rows with \`sim tables rows\``
33+
? `change a table's columns before the get, whose
34+
table types miss a later change: \`sim tables columns create <table> --column '{…}'\` or \`sim
35+
tables columns update <table> --column-name <column> --updates '{…}'\`; its rows with \`sim tables
36+
rows update <table> <row> --data '{…}'\``
3637
: `edit a table's columns and rows with
3738
\`sim workspaces source get --dir <dir>\` (tables/<key>.ts), read rows with \`sim tables rows
3839
list <table>\``

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ const PARAMS_COMMAND = 'sim workflows source params'
5656
export const PATTERNS_HEADING = '- **Patterns**'
5757

5858
/** The rules every source directory shares, after the kind's own edit loop. */
59-
function sharedRules(
60-
extra: { renames?: string; patterns?: string; debug?: string } = {}
61-
): string {
59+
function sharedRules(extra: { renames?: string; patterns?: string; debug?: string } = {}): string {
6260
return `- **Renames**: rename blocks' display names (first argument) or consts, with other edits: \`${SOURCE_LOCK_FILE}\` keeps each block and apply rewrites every reference, \`$ref.<key>\` too. Changing both on one block keeps it only if its settings or neighbours match, else a delete (\`E_APPLY_BLOCK_DELETE\`). One workflow variable per apply.${extra.renames ?? ''}
6361
- **References**: \`${SOURCE_ENTRY_FILE}\` reads \`x.content\`, text as \`\` t\`…\` \`\`, env as \`env.NAME\`. A function file (\`codeFile('./functions/x.js')\`) reads \`$ref.<key>.<path>\` (key: display name lowercased, no spaces or dots), \`$ref.loop.currentItem\` / \`.index\` in a body (\`parallel\` too), \`$env.NAME\`; \`.py\`/\`.sh\` files \`<key.path>\`, \`{{NAME}}\`. A block that never ran reads \`null\` (\`''\` in text).
6462
${PATTERNS_HEADING} (\`.sim/examples/\`, indexed atop \`cookbook.ts\`; any builder: \`${PARAMS_COMMAND} <builder>\`):
@@ -70,7 +68,7 @@ ${PATTERNS_HEADING} (\`.sim/examples/\`, indexed atop \`cookbook.ts\`; any build
7068
- Tables: \`table.queryRows\` outputs \`rows\` (\`recent.rows[0].data.status\`), not \`row\`; \`table.upsertRow\` takes \`conflictColumn: 'orderId'\`.
7169
- Rejoin: before one \`response\`, a Function picks the branch that ran with \`??\`.${extra.patterns ?? ''}
7270
- **Credentials**: \`sim credentials connect <provider> --name "<Name>"\`, send the owner its link, then \`credential('<key>')\`.
73-
- **Run**: \`sim workflows run <workflowId>\` runs the active deployment; \`--draft\` runs the draft for real (use test resources); \`--dry\` runs it stubbing writes and MCP tools (even read-only: \`mcp-read-only\`), listed in \`sideEffects\` (\`dry_run_*\` placeholders); GET \`api\` calls and plain-JS GET fetches run; sandboxed code (Python, shell, imports): \`unchecked\`. \`--allow <block>\` sends its writes; \`--mock <block>='{…}'\` fixes its output (bare, with \`--mock-from <runId>\`: that run's); a child's block: \`<workflow>.<block>\`.
71+
- **Run**: \`sim workflows run <workflowId>\` runs the active deployment; \`--draft\` runs the draft for real and \`--allow <block>\` sends that block's writes (use test resources); \`--dry\` runs it stubbing writes and MCP tools (even read-only: \`mcp-read-only\`), listed in \`sideEffects\` (\`dry_run_*\` placeholders); GET \`api\` calls and plain-JS GET fetches run; sandboxed code (Python, shell, imports): \`unchecked\`. \`--mock <block>='{…}'\` fixes its output (bare, with \`--mock-from <runId>\`: that run's); a child's block: \`<workflow>.<block>\`.
7472
- **Debug**: \`--dir <dir>\` maps a failure to file:line; \`sim logs get <runId> --trace --no-include-workflow-state\`; rows: \`sim tables rows list <table>\`; rerun: \`--from-block <block> --source-run <runId>\`; \`--stop-after <block>\`.${extra.debug ?? ''}
7573
- **Exit codes**: 0 ok, 1 errors, ${SOURCE_STALE_EXIT_CODE} stale (redo in a fresh get), ${RATE_LIMITED_EXIT_CODE} rate limited, ${SOURCE_BUSY_EXIT_CODE} busy, ${SOURCE_LOCAL_CHANGES_EXIT_CODE}/${SOURCE_DRIFT_EXIT_CODE} \`status\`: your edits / the server changed.`
7674
}
@@ -95,7 +93,7 @@ const APPLY_REWRITES = `\`check\` also type-checks (no \`tsc\`). Apply re-checks
9593
*/
9694
const WORKFLOW_EDIT_LOOP: Record<PrimerSurface, string> = {
9795
cli: `${EDIT_LOOP_LEAD}; fix what it reports: \`${WORKFLOW_LOOP}${RUN_AND_DEPLOY}\` applies, dry-runs that input, and deploys only if it completed (no \`--deploy\`: stays a draft). ${APPLY_REWRITES}`,
98-
chat: `${EDIT_LOOP_LEAD} in run_code's shell; fix what it reports: \`${WORKFLOW_LOOP}\`. ${APPLY_REWRITES} Test the draft with sim_cli (the shell refuses sync runs): \`workflows run <workflowId> --dry --input '{…}' --dir <dir>\` (from /home/user); once it passes, \`workflows deploy <workflowId> --expected-draft-fingerprint <fingerprint>\` (from \`.sim/base.json\`).`,
96+
chat: `${EDIT_LOOP_LEAD} in run_code's shell; fix what it reports: \`${WORKFLOW_LOOP}\`. ${APPLY_REWRITES} Test the draft with sim_cli, as the shell refuses runs: \`workflows run <workflowId> --dry --input '{…}' --dir <dir>\` (from /home/user), then \`workflows deploy <workflowId> --expected-draft-fingerprint <fingerprint>\` (from \`.sim/base.json\`).`,
9997
}
10098

10199
function workflowPrimer(surface: PrimerSurface): string {

0 commit comments

Comments
 (0)