Skip to content

Commit ee4d6ef

Browse files
committed
improvement(sim-cli): name source find in the workspace primer's debug rules
1 parent ee7fa91 commit ee4d6ef

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ const PARAMS_COMMAND = 'sim workflows source params'
3737
export const PATTERNS_HEADING = '- **Patterns**'
3838

3939
/** The rules every source directory shares, after the kind's own edit loop. */
40-
function sharedRules(group: string, extra: { renames?: string; patterns?: string } = {}): string {
40+
function sharedRules(
41+
group: string,
42+
extra: { renames?: string; patterns?: string; debug?: string } = {}
43+
): string {
4144
return `- **Renames**: rename any number of 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 ?? ''}
4245
- **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).
4346
${PATTERNS_HEADING} (\`.sim/examples/\`, indexed atop \`cookbook.ts\`; any builder: \`${PARAMS_COMMAND} <builder>\`):
@@ -50,7 +53,7 @@ ${PATTERNS_HEADING} (\`.sim/examples/\`, indexed atop \`cookbook.ts\`; any build
5053
- Rejoin: before one \`response\`, a Function picks the branch that ran with \`??\`.${extra.patterns ?? ''}
5154
- **Credentials**: \`sim credentials connect <provider> --name "<Name>"\`, send the owner its link, then \`credential('<key>')\`.
5255
- **Run**: \`sim workflows run <workflowId>\` runs the active deployment (\`sim workflows run <workflowId> --deployment-version <n>\`: that version); \`--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; a read given one too: \`placeholder\`); GET \`api\` calls and plain-JS GET fetches run; sandboxed code (Python, shell, imports): \`unchecked\`. \`--allow <block>\` sends its writes (use test resources); \`--mock <block>='{…}'\` fixes its output (bare, with \`--mock-from <runId>\`: that run's); a child's block: \`<workflow>.<block>\`.
53-
- **Debug**: \`--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>\`.
56+
- **Debug**: \`--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 ?? ''}
5457
- **Exit codes**: 0 ok, 1 errors, ${SOURCE_STALE_EXIT_CODE} stale (redo in a fresh \`${group} 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.`
5558
}
5659

@@ -71,6 +74,8 @@ const WORKSPACE_EXTRA = {
7174
renames: ' A column: change its `name`, keep its key.',
7275
patterns:
7376
"\n - Workspace: a text column is `column.string`; `deployments/<workflow key>.ts` with `defineDeployment({` and `live: 'draft'` deploys on apply.",
77+
debug:
78+
" A block's code, wiring and readers: `sim workflows source find <block> --dir workflows/<key>`.",
7479
}
7580

7681
const WORKSPACE_PRIMER = `# Sim workspace source: primer

0 commit comments

Comments
 (0)