2026-02-15 00:33:41 +00:00
---
paths:
- "js/**"
---
# JS/TS Packages
2026-04-13 16:03:05 +00:00
NEVER start, restart, or manage dev servers (pnpm dev, node, nohup, background processes). The developer will run services manually.
2026-02-15 00:33:41 +00:00
2026-04-13 16:03:05 +00:00
pnpm workspace at `js/` . Install from workspace root: `cd js && pnpm install` . All use ESLint + Prettier.
2026-02-15 00:33:41 +00:00
## Prisma
2026-04-13 16:03:05 +00:00
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:*"` .
2026-02-15 00:33:41 +00:00
## 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)