---
paths:
  - "js/**"
---
# JS/TS Packages

NEVER start, restart, or manage dev servers (pnpm dev, node, nohup, background processes). The developer will run services manually.

pnpm workspace at `js/`. Install from workspace root: `cd js && pnpm install`. All use ESLint + Prettier.

## Prisma

Schema lives in `common/prisma/schema.prisma`, shared by cf-api and cf-webapp. pnpm's isolated node_modules means each package gets its own `@prisma/client` — no symlinks needed. `common` is CommonJS — use `require`-style imports when working with it directly. Published as `@codeflash-ai/common` to GitHub Packages; workspace packages reference it as `"workspace:*"`.

## Package Gotchas

### cf-api
- Webhook routes MUST be registered before body parser (raw body needed for signature verification)
- `instrument.ts` must be imported first in entry point (Sentry init)
- Tests use dependency injection: `setXxxDependencies()` / `resetXxxDependencies()`

### VSC-Extension
- **Different prettier config**: 80 width + semicolons (vs 100/no-semi elsewhere)
- npm workspaces for local `@codeflash/*` packages
- Sidebar is a separate Vite/React app embedded via webview postMessage
- `acquireVsCodeApi()` called once per session — store and reuse
- esbuild excludes `vscode` module (provided by runtime)
