|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +This file provides guidance to agents when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +Roo Code - AI-powered autonomous coding agent VSCode extension with React webview UI, supporting multiple AI providers and custom modes. |
| 8 | + |
| 9 | +## Build/Test/Lint Commands |
| 10 | + |
| 11 | +```bash |
| 12 | +# Install dependencies (from root) |
| 13 | +pnpm install |
| 14 | + |
| 15 | +# Build entire project |
| 16 | +pnpm build |
| 17 | + |
| 18 | +# Run tests (CRITICAL: run from workspace directory containing package.json) |
| 19 | +cd src && npx vitest run tests/user.test.ts # Backend tests |
| 20 | +cd webview-ui && npx vitest run src/components/Button.test.tsx # UI tests |
| 21 | + |
| 22 | +# Lint/format |
| 23 | +pnpm lint |
| 24 | +pnpm format |
| 25 | +``` |
| 26 | + |
| 27 | +## Code Style |
| 28 | + |
| 29 | +- **Formatting**: Tabs (4 width), 120 char lines, no semicolons, bracket same line |
| 30 | +- **Imports**: ESM modules, use `.js` extensions in packages/ |
| 31 | +- **Types**: TypeScript strict mode, `noUncheckedIndexedAccess: true` |
| 32 | +- **Naming**: camelCase functions/variables, PascalCase components/classes |
| 33 | +- **UI**: Tailwind CSS classes only (no inline styles), VSCode CSS vars via webview-ui/src/index.css |
| 34 | + |
| 35 | +## Architecture |
| 36 | + |
| 37 | +``` |
| 38 | +src/ # VSCode extension backend (TypeScript) |
| 39 | +├── extension.ts # Entry point, registers providers & commands |
| 40 | +├── api/providers/ # AI provider implementations |
| 41 | +├── core/webview/ # Webview provider & IPC |
| 42 | +└── utils/ # Utilities (MUST use safeWriteJson for JSON writes) |
| 43 | +
|
| 44 | +webview-ui/ # React frontend |
| 45 | +├── src/components/ # React components with Tailwind CSS |
| 46 | +└── src/hooks/ # Custom React hooks |
| 47 | +
|
| 48 | +packages/ # Shared packages |
| 49 | +├── types/ # Shared TypeScript types |
| 50 | +├── ipc/ # IPC communication layer |
| 51 | +└── evals/ # Evaluation framework |
| 52 | +``` |
| 53 | + |
| 54 | +## Critical Patterns |
| 55 | + |
| 56 | +- **JSON Writes**: ALWAYS use `safeWriteJson()` from src/utils/safeWriteJson.ts (atomic writes with locking) |
| 57 | +- **Testing**: Run vitest from workspace directory containing package.json, NOT from project root |
| 58 | +- **Providers**: Implement Provider interface from packages/types/src/ |
| 59 | +- **Webview**: VSCode webview architecture with IPC messaging between extension and UI |
| 60 | + |
| 61 | +## Development |
| 62 | + |
| 63 | +- **Debug**: Press F5 in VSCode to launch extension host |
| 64 | +- **Hot Reload**: Webview changes appear immediately, core changes auto-reload in dev mode |
| 65 | +- **VSIX**: `pnpm vsix` to build, `pnpm install:vsix` to install locally |
0 commit comments