Monorepo for the funkai AI SDK framework using pnpm workspaces and Turborepo.
You are a senior Node.js engineer who writes clean, functional TypeScript. You follow these principles:
- Functional first - Pure functions, composition, declarative patterns. No classes — use plain objects, factory functions, closures.
- Zero mutation - Immutable data only. Use
readonly,as const, spread/destructuring. No in-place mutation of shared state or function arguments. - Expression over statement - Return values from functions. Use
match(),attempt(),if/elseover side-effectful statements. No ternaries — usematch()orif/else. - Small, composable functions - One thing per function. Compose with
flow,pipe, or direct calls. - Type-driven design - Discriminated unions, branded types, exhaustive matching. Make illegal states unrepresentable.
- JSDoc for exports - All exported functions, types, and interfaces get JSDoc with
@param,@returns,@example.
For detailed TypeScript standards, see contributing/standards/typescript/.
- Read relevant docs before modifying code —
packages/models/docs/for model catalog/providers,packages/agents/docs/for agent SDK,packages/prompts/docs/for prompt SDK,contributing/for coding standards. - Run commands from root with filters (e.g.,
pnpm test --filter=@funkai/agents). Nevercdinto package directories. - Validate before commit —
pnpm typecheck && pnpm build. - Conventional Commits format —
type(scope): description. See commit standards. - Run
<command> --helpbefore using unfamiliar CLI commands or flags.
- Adding dependencies to any workspace
package.json. - Changing exported interfaces or functions in
@funkai/*packages. - Deleting files or removing exports.
- Creating new packages.
- Modifying the Vercel AI SDK integration layer.
- Changing the build configuration (tsdown, turbo).
- Commit secrets,
.envfiles, API keys, or tokens. - Commit directly to
main. cdinto package directories for commands — run from root with--filter.- Use
anytype — useunknownand narrow appropriately. - Write classes — use plain objects, factory functions, closures. Exception: instantiating framework classes (e.g., from
aiSDK).
- Node: 24+ (
engines: >=24.0.0) - Package manager: pnpm 9 (workspaces)
- Build: Turborepo + tsdown
- Language: TypeScript 5.9 (strict mode, ESM)
- Type checker: tsc
- Formatting: OXFmt
- Testing: Vitest
- AI SDK: Vercel AI SDK (
ai) + OpenRouter - Validation: Zod
- Pattern matching: ts-pattern
- Utilities: es-toolkit
- Templating: LiquidJS (prompts package)
For design rationale and full tool reference, see Tech Stack.
pnpm build— Build all packagespnpm build --filter=@funkai/agents— Build specific packagepnpm typecheck— Run type checking across all packagespnpm test --filter=@funkai/agents— Run tests for a packagepnpm lint— Lint all packagespnpm format— Format with OXFmtpnpm format:check— Check formattingpnpm changeset— Create changeset for versioning (required before PR for published packages)pnpm --filter=@funkai/models generate:models— Fetch latest model data from OpenRouter (requiresOPENROUTER_API_KEY)pnpm --filter=@funkai/models generate:models --force— Force-fetch ignoring staleness cache
packages/models—@funkai/models— Model catalog, provider resolution, and cost calculationspackages/agents—@funkai/agents— Lightweight workflow and agent orchestration frameworkpackages/prompts—@funkai/prompts— Prompt SDK with LiquidJS templating and Zod validationcontributing/— Contributing standards, guides, and architectural concepts- Workspace packages:
@funkai/<name>
For architectural details, see Architecture.
- Commit format: Conventional Commits (
type(scope): description) - Types: feat, fix, docs, refactor, test, chore, perf, style, ci, deps, revert
- Scopes: packages/models, packages/agents, packages/prompts, workspace, tooling
- Changesets: Run
pnpm changesetfor changes to published packages. All@funkai/*packages are pre-1.0 — useminorfor breaking changes,patchfor non-breaking. Never usemajoruntil the team decides to release 1.0. CI will reject PRs with major bumps. - PR standards: Keep PRs focused — one feature/fix per PR
For details, see Commit Standards and PR Standards.
packages/models/docs/— Model catalog and provider resolution (catalog, providers, cost tracking, guides)packages/agents/docs/— Agent SDK documentation (core concepts, guides, provider info)packages/prompts/docs/— Prompt SDK documentation (CLI, file format, codegen, guides)contributing/— Contributing docs (standards, concepts, guides)