Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .agents/skills/add-block/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ tool IDs through `tools.access` and does not change any tool's shape.
But if the same change also adds, edits **or removes** a tool, run `bun run generate:tool-metadata` and commit the result, or CI fails on stale artifacts. That matters here because a block's `outputs` are authored to match its tools' outputs, and the UI reads those from the generated metadata, not the executable registry — an unregenerated tool change makes the block's outputs disagree with what the panel renders. See `.agents/skills/tool-registry-boundary/SKILL.md`.

A visible integration block does require the generated integration catalog and docs to be refreshed:
`bun run generate:tool-metadata` (only when a tool changed), `bun run scripts/generate-docs.ts`,
`bun run generate:tool-metadata` (only when a tool changed), `bun run generate:docs`,
`bun run generate:deployment-config`, then `bun run check:audits`. Also run
`bun run apps/sim/scripts/check-block-registry.ts origin/staging` (CI runs it outside `check:audits`). Commit the
full generator output. For what each check verifies, see the `validate-integration` skill →
Expand All @@ -1051,7 +1051,7 @@ Regenerate Derived Artifacts.
- [ ] Block + meta registered in registry-maps.ts (`BLOCK_REGISTRY` / `BLOCK_META_REGISTRY`)
- [ ] If `sunset.replacedBy` changed: regenerated and committed the block successor map; `bun run check:block-successors` passes
- [ ] If any tool was added, changed or removed alongside the block: ran `bun run generate:tool-metadata` and committed the artifacts
- [ ] Ran `bun run scripts/generate-docs.ts`, reviewed the generated diff, and committed the integration catalog changes
- [ ] Ran `bun run generate:docs`, reviewed the generated diff, and committed the integration catalog changes
- [ ] `bun run check:integration-catalog` passes
- [ ] `bun run check:docs` passes (CI gate — fails on any stale generated docs page)
- [ ] If icon missing: asked user to provide SVG
Expand Down
10 changes: 5 additions & 5 deletions .agents/skills/add-integration/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ service id:
`mode: 'advanced'`. An existing block that already takes the secret inline is never edited in
place: add a credential-only successor (`add-block` → Credential-only successor).

Then run `generate-docs`, `generate:block-successors`, `generate:deployment-config`, and
`generate:tool-metadata`, and `check-block-registry.ts origin/staging`. This pattern does not fit
Then run `bun run generate` (every generated artifact, docs included) and
`check-block-registry.ts origin/staging`. This pattern does not fit
hosted-key tools, model-provider keys, two-secret or username/password logins, or a host chosen
per call.

Expand Down Expand Up @@ -438,7 +438,7 @@ a resolvable capability must fail validation; an independent service account use

## Step 8: Generate and Validate the Catalog

Run `bun run generate:tool-metadata`, `bun run scripts/generate-docs.ts`,
Run `bun run generate:tool-metadata`, `bun run generate:docs`,
`bun run generate:deployment-config`, then `bun run check:audits` (see the `validate-integration`
skill → Regenerate Derived Artifacts for the full list and what each check verifies).

Expand All @@ -464,7 +464,7 @@ In Sim, the {Service} block lets your agents {concrete workflow uses}.

Group the bullets by what the user gets done, not one bullet per tool. Only describe operations the
block actually ships. Follow `.claude/rules/constitution.md` for voice. Re-run
`bun run scripts/generate-docs.ts` afterwards and confirm the section survived unchanged.
`bun run generate:docs` afterwards and confirm the section survived unchanged.

The docs generator refreshes `packages/deployment-config/src/integrations.json`, and the deployment
config generator projects service-account provider IDs from that catalog plus the canonical OAuth
Expand Down Expand Up @@ -582,7 +582,7 @@ If creating V2 versions (API-aligned outputs):
- [ ] Registered all triggers in `triggers/registry.ts`

### Docs and deployment metadata
- [ ] Ran `bun run scripts/generate-docs.ts`
- [ ] Ran `bun run generate:docs`
- [ ] Ran `bun run generate:deployment-config` for OAuth or service-account changes
- [ ] Verified docs file created
- [ ] Wrote the `{/* MANUAL-CONTENT-START:intro */}` section under `<BlockInfoCard />` and confirmed it survives a regenerate
Expand Down
2 changes: 1 addition & 1 deletion .agents/skills/add-tools/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ If creating V2 tools (API-aligned outputs), use `_v2` suffix:
- [ ] Index.ts exports all tools and re-exports types (`export * from './types'`)
- [ ] Tools registered in `tools/registry.ts`
- [ ] `bun run generate:tool-metadata` run and the regenerated artifacts committed
- [ ] `bun run scripts/generate-docs.ts` run and the refreshed docs committed — the integration's
- [ ] `bun run generate:docs` run and the refreshed docs committed — the integration's
docs page is rendered from each tool's description, params, and outputs, and CI's
`bun run check:docs` fails on stale pages
- [ ] Block wired: `tools.access`, dropdown options, subBlocks, `tools.config`, outputs, inputs
Expand Down
2 changes: 1 addition & 1 deletion .agents/skills/add-trigger/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,6 @@ registered `InternalToolConfig.operation`; a `directExecution` property fails
- [ ] `bun run type-check` passes
- [ ] Manually verify output keys match trigger `outputs` keys
- [ ] Trigger UI shows correctly in the block
- [ ] Ran `bun run scripts/generate-docs.ts` and committed the refreshed pages — trigger sections
- [ ] Ran `bun run generate:docs` and committed the refreshed pages — trigger sections
render into the owning integration's docs page, and CI's `bun run check:docs` fails on stale
pages
2 changes: 1 addition & 1 deletion .agents/skills/db-migrate/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ The lint flags risky *shapes*; it cannot know whether a given drop is *safe righ
```
The reason must be specific and name the PR/version that removed the dependency. An empty reason fails the lint.
- **Warnings** (`data-backfill`): non-blocking, but confirm the batching/idempotency before merging.
4. Regenerate the test schema mock: `bun run scripts/generate-schema-mock.ts` (`check:schema-mock` in `check:audits` fails after any `schema.ts` change until you do).
4. Regenerate the test schema mock: `bun run generate:schema-mock` (`check:schema-mock` in `check:audits` fails after any `schema.ts` change until you do).
5. Re-run `(cd packages/db && bunx drizzle-kit generate)` once your migration is written: it must report no schema changes and write no new file, or CI fails on the schema and migrations disagreeing.
6. Verify locally: `cd packages/db && bun run db:migrate` against a dev DB.

Expand Down
12 changes: 5 additions & 7 deletions .agents/skills/validate-integration/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,10 @@ After reporting, fix every **critical** and **warning** issue. Apply **suggestio

### Regenerate Derived Artifacts

Several files are generated from tool and block definitions. Editing a tool or block WITHOUT regenerating them fails CI, so run these before pushing:
Several files are generated from tool and block definitions. Editing a tool or block WITHOUT regenerating them fails CI, so run this before pushing:

```bash
bun run generate:tool-metadata # repo root — apps/sim/tools/generated/*
bun run scripts/generate-docs.ts # docs .mdx + deployment-config/integrations.json + docs icons
bun run generate:deployment-config # canonical OAuth registry + catalog → provider-ID facts
bun run generate # every generator below (and any other generate:<x>/check:<x> pair)
bun run check:integration-catalog # registry ↔ committed deployment metadata drift
bun run check:docs # committed docs ↔ what the generator renders today
bun run check:deployment-config # OAuth registry/catalog ↔ provider-ID fact drift
Expand All @@ -457,12 +455,12 @@ bun run apps/sim/scripts/check-block-registry.ts origin/staging # block ↔ too
```

- **`generate:tool-metadata`** — required whenever a tool's `outputs`, `params`, or descriptions change. CI enforces this with `bun run check:tool-metadata`, which fails with *"Generated tool metadata is stale"*. This is the easiest gate to miss, because nothing in the tool file hints that a generated artifact mirrors it.
- **`generate-docs`** — required whenever block metadata changes (`bgColor`, `name`, `description`, operations, outputs). Regenerates the integration `.mdx`, `packages/deployment-config/src/integrations.json`, and the docs copy of `components/icons.tsx`.
- **`generate:docs`** — required whenever block metadata changes (`bgColor`, `name`, `description`, operations, outputs). Regenerates the integration `.mdx`, `packages/deployment-config/src/integrations.json`, and the docs copy of `components/icons.tsx`.
- **`generate:deployment-config`** — required for OAuth or service-account changes. Regenerates provider-ID facts from the canonical OAuth registry and integration catalog; special deployment requirements remain handwritten policy.
- **`check:integration-catalog`** — loads the executable block registry, derives visible integration
deployment fields, and compares them with the committed catalog. It catches missing/unexpected
entries and stale auth/service IDs without loading the executable registry in client code.
- **`check:docs`** — check mode of `generate-docs.ts`: renders every generated docs artifact in
- **`check:docs`** — check mode of `generate:docs`: renders every generated docs artifact in
memory and fails listing any committed file that differs. Runs in CI via `check:audits`.

**Always diff the regen output before committing — but commit all of it.** These generators rewrite
Expand Down Expand Up @@ -525,7 +523,7 @@ After fixing, confirm:
- [ ] Reported all issues grouped by severity
- [ ] Fixed all critical and warning issues
- [ ] Ran `bun run generate:tool-metadata` if any tool outputs/params changed, and confirmed `bun run check:tool-metadata` passes
- [ ] Ran `bun run scripts/generate-docs.ts` if any block metadata changed, and committed the full generated diff — including stale-page catch-up for other integrations (`bun run check:docs` fails CI on reverted generator output)
- [ ] Ran `bun run generate:docs` if any block metadata changed, and committed the full generated diff — including stale-page catch-up for other integrations (`bun run check:docs` fails CI on reverted generator output)
- [ ] Validated the docs page has an accurate `MANUAL-CONTENT-START:intro` section
- [ ] Ran `bun run lint` after fixes
- [ ] Verified TypeScript compiles clean
Expand Down
2 changes: 1 addition & 1 deletion .claude/rules/sim-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Global (installed by `vitest.setup.ts` — knobs only, no `vi.mock`):
| `@/lib/auth` | `authMockFns.mockGetSession` (+ `auth.api.*`: `mockSignOut`, `mockSignInSSO`, `mockCreateUser`, …; `auth.$context.internalAdapter`: `mockCreateSession`, …) (`auth.mock`) |
| `@/lib/auth/hybrid` | `hybridAuthMockFns` (`hybrid-auth.mock`) |
| `@sim/db`, `drizzle-orm` | `dbChainMockFns.*`, `queueTableRows`, `resetDbChainMock`, `hasMockCondition`, `databaseMockFns.mockResolveDbUrl`; `@sim/db` re-exports every schema table; `sql` is a spy (`vi.mocked(sql).mock.calls`) (`database.mock`) |
| `@sim/db/schema` | `schemaMock`, generated from `packages/db/schema.ts` (`bun run scripts/generate-schema-mock.ts`) (`schema.mock`) |
| `@sim/db/schema` | `schemaMock`, generated from `packages/db/schema.ts` (`bun run generate:schema-mock`) (`schema.mock`) |
| `@trigger.dev/sdk` | `triggerSdkMockFns` (`task()` returns its config, so call `.run`; `runs.*`, `tasks.*`, `idempotencyKeys`), `MockTriggerApiError` (`trigger-sdk.mock`) |
| `@/components/icons` | stable stub per icon name — no knobs, never re-mock |
| `@/lib/core/config/env` | `setEnv`, `resetEnvMock`, `envMockFns.getEnv` (`env.mock`) |
Expand Down
2 changes: 1 addition & 1 deletion .cursor/rules/sim-testing.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Global (installed by `vitest.setup.ts` — knobs only, no `vi.mock`):
| `@/lib/auth` | `authMockFns.mockGetSession` (+ `auth.api.*`: `mockSignOut`, `mockSignInSSO`, `mockCreateUser`, …; `auth.$context.internalAdapter`: `mockCreateSession`, …) (`auth.mock`) |
| `@/lib/auth/hybrid` | `hybridAuthMockFns` (`hybrid-auth.mock`) |
| `@sim/db`, `drizzle-orm` | `dbChainMockFns.*`, `queueTableRows`, `resetDbChainMock`, `hasMockCondition`, `databaseMockFns.mockResolveDbUrl`; `@sim/db` re-exports every schema table; `sql` is a spy (`vi.mocked(sql).mock.calls`) (`database.mock`) |
| `@sim/db/schema` | `schemaMock`, generated from `packages/db/schema.ts` (`bun run scripts/generate-schema-mock.ts`) (`schema.mock`) |
| `@sim/db/schema` | `schemaMock`, generated from `packages/db/schema.ts` (`bun run generate:schema-mock`) (`schema.mock`) |
| `@trigger.dev/sdk` | `triggerSdkMockFns` (`task()` returns its config, so call `.run`; `runs.*`, `tasks.*`, `idempotencyKeys`), `MockTriggerApiError` (`trigger-sdk.mock`) |
| `@/components/icons` | stable stub per icon name — no knobs, never re-mock |
| `@/lib/core/config/env` | `setEnv`, `resetEnvMock`, `envMockFns.getEnv` (`env.mock`) |
Expand Down
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -516,10 +516,10 @@ In addition, you will need to update the registries:
Ensure that your tool functions correctly by making test requests and verifying the responses.

8. **Generate Documentation:**
Run the documentation generator (from `apps/sim`) to create docs for your new tool:
Regenerate every derived artifact, including your tool's docs page, from the repo root:

```bash
cd apps/sim && bun run generate-docs
bun run generate
```

### Naming Conventions
Expand Down
18 changes: 17 additions & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh
# Checks only what this push changes against its merge base with origin/staging (the PR base):
# biome format + lint on the changed files, then type-check for the affected workspaces.
# biome format + lint on the changed files, type-check for the affected workspaces, then
# `bun run generate` so no committed generated artifact is left stale.
# CI runs the full lint, type-check and audit gate on every PR, so it stays the backstop.
set -e

Expand Down Expand Up @@ -42,3 +43,18 @@ if printf '%s\n' "$changed" | grep -qE '^scripts/'; then
bun run type-check:scripts:esm
fi
TURBO_SCM_BASE="$base" bunx turbo run type-check --affected --output-logs=errors-only

# A stale generated artifact would only fail CI's check:audits. Generators read the working tree,
# so the result describes the pushed commit only when the tree is that commit; with uncommitted or
# untracked files the check is left to CI rather than judging (or blocking) unrelated work.
if git diff --quiet HEAD && [ -z "$(git ls-files --others --exclude-standard)" ]; then
bun run generate >/dev/null
if ! git diff --quiet; then
echo "pre-push: generated artifacts were stale and have been regenerated:"
git diff --name-only
echo "pre-push: commit them and push again."
exit 1
fi
else
echo "pre-push: uncommitted changes; leaving generated-artifact freshness to CI"
fi
3 changes: 3 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Build order **Tools** → **Block** → **Icon** → optional **Trigger**, from
Before declaring a change done, run the local gate from the repo root; CI fails on any of them:

```bash
bun run generate # rewrites every committed generated artifact (docs, metadata, fixtures, …)
bun run lint # biome format + lint, autofixes (CI runs lint:check)
bun run type-check # every workspace
bun run check:audits # every check:* audit, generated-artifact checks included
Expand All @@ -77,4 +78,6 @@ git fetch origin staging # the block-registry check diffs against it
bun run apps/sim/scripts/check-block-registry.ts origin/staging
```

A generated artifact gets a `generate:<x>` / `check:<x>` pair in the root package.json; `bun run generate` and `check:audits` pick it up from there (`check:generators`), so never regenerate one from a test.

Author a `packages/db` schema change or migration with the `db-migrate` skill and run `bun run check:migrations` (not in `check:audits`). Ratchet baselines (`scripts/*baseline.json`) only shrink: regenerate one with `--update` after removing violations. The one exception is `check:tool-registry-boundary`, whose module-count baseline is re-recorded with `--update-baseline` when growth is deliberate (see the `tool-registry-boundary` skill).
2 changes: 1 addition & 1 deletion apps/docs/EDITORIAL_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Edit generated prose at its owner, then regenerate:
| MCP operation catalog | Authorized operation definitions and generated OpenAPI | `bun run generate:mcp-operations` |
| v2 route table | Canonical route definitions | `bun run generate:v2-route-table` |
| Marked Agent streaming table | Streaming protocol metadata and `scripts/sync-agent-stream-docs.ts` | `bun run generate:agent-stream-docs` |
| Integration references, icons, navigation inventory and public catalog | Block/tool/trigger and OAuth metadata; authored `MANUAL-CONTENT` regions; registered credential guides; `scripts/generate-docs.ts` | `bun run scripts/generate-docs.ts` |
| Integration references, icons, navigation inventory and public catalog | Block/tool/trigger and OAuth metadata; authored `MANUAL-CONTENT` regions; registered credential guides; `scripts/generate-docs.ts` | `bun run generate:docs` |

Do not hand-edit generated pages, JSON specifications, or marked generated regions. Preserve all argument, option, schema, authentication, and confirmation detail. CLI descriptions also feed command discovery; run the existing search-ranking checks after changing help copy. Validate rendered request examples against their canonical input contracts; schema validity alone may still leave a semantic error such as an invalid serialized workflow.

Expand Down
1 change: 0 additions & 1 deletion apps/sim/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
"format:check": "biome format .",
"generate:pi-model-catalog": "bun run scripts/generate-pi-model-catalog.ts",
"generate:disposable-email-domains": "bun run scripts/generate-disposable-email-domains.ts",
"generate-docs": "bun run ../../scripts/generate-docs.ts",
Comment thread
waleedlatif1 marked this conversation as resolved.
Resolved
"org:consolidate-users": "bun run scripts/consolidate-users-into-organization.ts",
"verify:oracledb": "node scripts/oracledb-patch-self-test.cjs --worker lib/internal/oracledb/oracle-worker.cjs",
"build:cli-runtime": "bun build ../../packages/sim-cli/src/runtime.ts --target=node --format=esm --packages=bundle --outfile=../../packages/sim-cli/dist/runtime.js",
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@
"check:script-tests": "bun run scripts/check-script-test-coverage.ts",
"check:test-patterns": "bun run scripts/check-test-patterns.ts",
"check:sealed-columns": "bun run scripts/check-sealed-columns.ts",
"generate:schema-mock": "bun run scripts/generate-schema-mock.ts",
"check:schema-mock": "bun run scripts/generate-schema-mock.ts --check",
"check:audits": "bun run scripts/run-audits.ts",
"check:generators": "bun run scripts/check-generators.ts",
"generate": "bun run scripts/generate-all.ts",
"check:skills": "bun run scripts/sync-skills.ts --check",
"check:guidance-refs": "bun run scripts/check-guidance-refs.ts",
Expand All @@ -106,12 +108,13 @@
"generate:sdk-fixture-catalog": "bun run apps/sim/scripts/generate-sdk-fixture-catalog.ts",
"check:sdk-fixture-catalog": "bun run apps/sim/scripts/generate-sdk-fixture-catalog.ts --check",
"check:sdk-names-frozen": "bun run scripts/check-sdk-names-frozen.ts",
"generate:docs": "bun run scripts/generate-docs.ts",
"check:docs": "bun run scripts/generate-docs.ts --check",
"generate:deployment-config": "bun run scripts/generate-deployment-config.ts",
"check:deployment-config": "bun run scripts/generate-deployment-config.ts --check",
"images:generate": "bun run scripts/generate-image-manifest.ts",
"images:check": "bun run scripts/generate-image-manifest.ts --check",
"check:integration-catalog": "bun run scripts/check-integration-catalog.ts",
"check:docs": "bun run scripts/generate-docs.ts --check",
"mship-tools:generate": "bun run scripts/sync-tool-catalog.ts",
"mship-tools:check": "bun run scripts/sync-tool-catalog.ts --check",
"trace-spans-contract:generate": "bun run scripts/sync-trace-spans-contract.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/testing/src/mocks/schema-tables.generated.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Generated by `scripts/generate-schema-mock.ts` from `packages/db/schema.ts` — do not edit.
* Regenerate with `bun run scripts/generate-schema-mock.ts`; `check:schema-mock` fails on drift.
* Regenerate with `bun run generate:schema-mock`; `check:schema-mock` fails on drift.
*/

/** Every `pgTable` export mapped to its column property names. */
Expand Down
Loading
Loading