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
1 change: 1 addition & 0 deletions .agents/skills/ship/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ When the user runs `/ship`:
- If the diff modifies UI code (any non-test `.tsx` file, or anything under `apps/sim/components/`, `apps/sim/hooks/`, or `apps/sim/stores/`), run `/cleanup`. It fans out the React/UI passes (effects, memo, callbacks, state, React Query, emcn, url-state), the comment pass, and the test-audit pass, and applies fixes so they land in this commit.
- Otherwise, if the diff adds or changes tests (`*.test.ts(x)`, `*.integration.ts`, `**/e2e/**`, `apps/sim/scripts/test-*-e2e.ts`), run `/test-audit audit <changed test files>` on its own. Every new or changed test must pass the authoring gate; delete the ones that don't rather than shipping them.
- Then run the test files the diff adds or changes, plus the existing tests beside changed source files, with `bun run --cwd <workspace> test <paths>` (`bun run --cwd apps/sim test <paths>` for the app; `*.integration.ts` needs the setup in `.claude/rules/sim-testing.md`). A failing test aborts ship.
- Then run root `bun run test` from the repo root. It chains `test:scripts` (the `scripts/*.test.ts` suite CI runs) before every workspace suite; workspace-scoped runs skip it, which is how a `scripts/check-*.test.ts` failure has reached CI. A failing test aborts ship.
5. **Run migration safety** — only if the diff touches `packages/db/migrations/**` or `packages/db/schema.ts`:
- Run `/db-migrate` to review the migration for zero-downtime safety (expand/contract phasing, backward-compatibility with the deployed app version).
- `bun run check:migrations origin/staging` must pass (staging is the PR base). Do not silence a flagged statement with a `-- migration-safe:` annotation unless `/db-migrate` confirmed the old code no longer depends on it; otherwise split the destructive change into a later deploy.
Expand Down
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ The `'use client'` server boundary, the app/worker runtime env split, and featur

## Code Conventions

- **Naming**: components PascalCase (`WorkflowList`); hooks `use*`; files kebab-case (`workflow-list.tsx`); constants SCREAMING_SNAKE_CASE; interfaces PascalCase with a suffix (`WorkflowListProps`); stores `stores/<feature>/store.ts`.
- **Naming**: components PascalCase (`WorkflowList`); hooks `use*`; files kebab-case (`workflow-list.tsx`); constants SCREAMING_SNAKE_CASE; interfaces PascalCase with a suffix (`WorkflowListProps`); stores `stores/<feature>/store.ts`. A file never repeats its folder's name (`lib/logs/views.ts`, not `lib/logs/log-views.ts`; `utils/date.ts`, not `utils/date-utils.ts`); `check:file-names` enforces this.
- **Imports**: absolute (`@/...`) only, never relative. A folder with 3+ exports gets an `index.ts` barrel; never re-export from a non-barrel file. `import type` for type-only imports. Order and lazy-loading through barrels: `.claude/rules/sim-imports.md`.
- **TypeScript**: no `any` (use precise types or `unknown` with guards); a props interface for every component; `as const` for constant objects/arrays; explicit ref types (`useRef<HTMLDivElement>(null)`).
- **TypeScript**: no `any` and no non-null `!` (use precise types or `unknown` with guards; `check:explicit-any` ratchets both); no export nothing imports (`check:unused-exports`); a props interface for every component; `as const` for constant objects/arrays; explicit ref types (`useRef<HTMLDivElement>(null)`).
- **Unused bindings** fail lint (biome `noUnusedVariables`, `noUnusedFunctionParameters`): delete the dead variable, import, or parameter and update callers; write `catch {}` when the error is unused. Prefix `_` only for a parameter that must hold its position because a later one is used. `const { a, ...rest } = obj` to omit keys is allowed. The rules carry no autofix, so `bun run lint` will not rename anything for you.
- **Components**: `'use client'` only for hooks or browser APIs. Structure order, extraction thresholds, and list-render rules: `.claude/rules/sim-components.md`. Render-performance idioms (lazy-init refs, hoisting, `Map` pre-indexing, `[...arr].sort()` never `toSorted()` on client paths): `.claude/rules/sim-react-performance.md`. For effect/state/memo/callback anti-patterns use the `/you-might-not-need-*` skills and verify against the running UI.
- **State ownership**: React Query owns server data — never `useState` + `fetch`; shareable client view-state (tabs, filters, search, pagination, selected id) lives in the URL via `nuqs`; Zustand owns global client state; `useState` owns UI-only state. Hooks: `.claude/rules/sim-hooks.md`. Stores (`devtools`, `persist` only with an explicit `partialize` whitelist, workflow value invariants): `.claude/rules/sim-stores.md`. URL state: `.claude/rules/sim-url-state.md`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { dbChainMockFns, queueTableRows, resetDbChainMock, schemaMock } from '@sim/testing'
import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest'
import { afterAll, beforeEach, describe, expect, it } from 'vitest'
import { listWorkspaceFiles } from './workspace-file-manager'

afterAll(resetDbChainMock)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,6 @@ describe('listWorkspaceFiles', () => {
resetDbChainMock()
})

const lastProjection = () =>
Object.keys((dbChainMockFns.select.mock.calls.at(-1)?.[0] ?? {}) as Record<string, unknown>)

it('caps the rows read when the caller only needs to fit a budget', async () => {
queueTableRows(schemaMock.workspaceFiles, [buildRow()])

Expand Down
1 change: 0 additions & 1 deletion apps/sim/lib/uploads/providers/s3/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest'

const {
mockSend,
mockS3Client,
mockS3ClientConstructor,
mockPutObjectCommand,
mockGetObjectCommand,
Expand Down
2 changes: 1 addition & 1 deletion apps/sim/lib/uploads/server/markdown-export.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Markdown export image rewriting', () => {

it('returns large documents verbatim before parsing or fetching assets', async () => {
const content = Buffer.from(
'![image](/api/files/view/image-1)\n' + 'a'.repeat(MAX_EXPORT_MARKDOWN_PARSE_BYTES)
`![image](/api/files/view/image-1)\n${'a'.repeat(MAX_EXPORT_MARKDOWN_PARSE_BYTES)}`
)
const result = await createMarkdownExport({
content,
Expand Down
8 changes: 0 additions & 8 deletions apps/sim/lib/uploads/utils/file-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ import {
import { isUuid } from '@/executor/constants'
import type { UserFile } from '@/executor/types'

interface FileAttachment {
id: string
key: string
filename: string
media_type: string
size: number
}

export interface MessageContent {
type: 'text' | 'image' | 'document' | 'audio' | 'video'
text?: string
Expand Down
11 changes: 8 additions & 3 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@
"!**/.next",
"!**/.next",
"!**/next-env.d.ts",
"!**/out",
"!out",
"!apps/*/out",
"!packages/*/out",
"!**/dist",
"!**/build",
"!build",
"!apps/*/build",
"!packages/*/build",
"!**/node_modules",
"!**/.bun",
"!**/.cache",
Expand All @@ -32,7 +36,8 @@
"!**/apps/desktop/release",
"!**/venv",
"!**/.venv",
"!**/uploads",
"!uploads",
"!apps/*/uploads",
"!**/apps/sim/lib/execution/sandbox/bundles/*.cjs",
"!**/test-results",
"!**/playwright-report"
Expand Down
19 changes: 16 additions & 3 deletions knip.jsonc
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
{
"$schema": "https://unpkg.com/knip@6/schema.json",
// Gate reachability and dependency ownership. Export/type pruning needs review
// of public package contracts and test-only consumers, not a blanket threshold.
// Plain `knip` (check:dead-code) gates reachability and dependency ownership.
// Unused exports, types, and duplicates are ratcheted by check:unused-exports,
// which reuses this config in the same knip pass.
"include": ["files", "dependencies", "unlisted", "unresolved"],
// knip's default, stated so it is a decision: no entry file's exports are reported.
// That keeps package `exports`/`main`/`bin` contracts (ts-sdk, emcn, cli, …) and framework
// entries (Next routes, Trigger tasks) public, and also exempts the other configured entries
// (scripts, `*.integration.ts`, `background/**`, desktop and SDK examples).
"includeEntryExports": false,
Comment thread
waleedlatif1 marked this conversation as resolved.
"workspaces": {
".": {
"entry": ["scripts/**/*.{ts,tsx}", "vitest.shared.ts"],
Expand Down Expand Up @@ -33,6 +39,9 @@
// Required/discoverable barrels whose children have direct live imports.
// Ignore only the barrel file finding, so it cannot keep dead children alive.
"ignoreIssues": {
// Generated contracts mirror their source of truth; regenerating them must not
// trip the unused-export ratchet, and hand edits would be overwritten.
"lib/mothership/generated/**": ["exports", "types", "duplicates"],
"sandbox-tasks/index.ts": ["files"],
"components/mcp/index.ts": ["files"],
"triggers/quickbooks/index.ts": ["files"],
Expand Down Expand Up @@ -87,7 +96,11 @@
},
"packages/ts-sdk": { "entry": ["examples/*.ts"] },
// The contract audit reads this snapshot by filename.
"packages/desktop-bridge": { "entry": ["contract-snapshot.ts"] },
// Generated, so its export surface is not ratcheted either.
"packages/desktop-bridge": {
"entry": ["contract-snapshot.ts"],
"ignoreIssues": { "contract-snapshot.ts": ["exports", "types", "duplicates"] }
},
// This shared config is consumed by apps that own the Next dependency.
"packages/tsconfig": { "ignoreUnresolved": ["next"] }
}
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@
"check:desktop-bridge": "bun run scripts/check-desktop-bridge-contract.ts --check",
"check:desktop-ipc": "bun run scripts/check-desktop-ipc-contract.ts",
"check:route-verbs": "bun run scripts/check-route-verbs.ts",
"check:unused-exports": "bun run scripts/check-unused-exports.ts",
"check:explicit-any": "bun run scripts/check-explicit-any.ts",
"check:file-names": "bun run scripts/check-file-names.ts",
"desktop-bridge-contract:update": "bun run scripts/check-desktop-bridge-contract.ts --update",
"mship-contracts:generate": "bun run scripts/sync-mothership-stream-contract.ts",
"mship-contracts:check": "bun run scripts/sync-mothership-stream-contract.ts --check",
Expand Down
Loading
Loading