Prerequisites
- Bun v1.0+
- Node.js v20+ (for the Mintlify CLI only)
- Git
Setup
Bun is required for development. npm, yarn, and pnpm won’t work for this monorepo. We use
Bun’s workspaces and native TypeScript support to streamline development.
Running Packages
| Command | Description |
|---|---|
bun cli <cmd> | Run the CLI |
bun tui | Launch the TUI |
bun web | Start the web dev server |
bun run typecheck | TypeScript type check (all packages) |
bun run lint | OXC lint |
bun run format | OXC format |
bun run db:generate | Generate a new Drizzle migration |
bun run db:migrate | Apply migrations locally |
Code Style
Grind uses OXC (oxfmt for formatting, oxlint for linting).
- 2-space indent, single quotes, semicolons, 100-char line width
- Run
bun run formatbefore committing
TypeScript Conventions
exactOptionalPropertyTypes: trueis enforced. Never assignundefinedto optional properties. Use spread conditionals:noUncheckedIndexedAccess: true: always null-check array accessverbatimModuleSyntax: true: useimport typefor type-only imports
File Organization
- Domain logic →
packages/core/src/ - CLI commands →
packages/cli/src/commands/ - TUI screens →
packages/tui/src/screens/ - Web routes →
apps/web/src/routes/
packages/cli, packages/tui, or packages/web inside packages/core. The dependency arrow is one-way: cli/tui/web → core.
Adding a New CLI Command
- Create
packages/cli/src/commands/my-command.ts - Export a default
async function myCommand()that uses Clack for prompts - Register it in
packages/cli/src/index.ts
Adding a New Agent Tool
- Define the tool in
packages/core/src/agent/tools.tsusing the Vercel AI SDKtool()helper - Add a permission check if write access is required
- Add it to the
toolsobject inrunAgent - Add rendering in
packages/tui/src/ChatApp.tsx
Adding a Database Table
- Add the table definition to
packages/core/src/vault/schema.ts - Run
bun run db:generateto create the migration - Create a repository in
packages/core/src/vault/repositories/ - Export the repository from
packages/core/src/vault/index.ts
Documentation
Docs live indocs/. To run the docs locally:
http://localhost:3000.