Skip to content

Commit 053e159

Browse files
committed
another attempt, but from scratch.
1 parent 8db9d2f commit 053e159

File tree

5 files changed

+58
-54
lines changed

5 files changed

+58
-54
lines changed

.roo/rules-architect/AGENTS.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
# Architect Mode Rules
1+
# Project Architecture Rules (Non-Obvious Only)
22

3-
## Non-Obvious Architecture Constraints
4-
5-
- Providers MUST be stateless - hidden caching layer assumes this
6-
- Webview and extension communicate through specific IPC channel patterns only
7-
- React hooks required because external state libraries break webview isolation
8-
- Large JSON operations must use `safeWriteJson()` for streaming (prevents memory issues)
9-
- TypeScript `noUncheckedIndexedAccess: true` - array/object access may return undefined
10-
- Import paths in packages/ require `.js` extensions despite TypeScript source
3+
- Webview and extension communicate ONLY through `src/core/webview/webviewMessageHandler.ts` patterns
4+
- React hooks required in webview - external state libraries break VSCode webview isolation
5+
- Monorepo has circular dependency on types package (intentional design)
6+
- `safeWriteJson()` mandatory for JSON writes - uses atomic writes with file locking
7+
- Database operations require specific directory: must `cd packages/evals` before running migrations

.roo/rules-ask/AGENTS.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
# Ask Mode Rules
1+
# Project Documentation Rules (Non-Obvious Only)
22

3-
## Non-Obvious Documentation Context
4-
5-
- `src/` contains VSCode extension code, NOT generic source (counterintuitive naming)
6-
- Two separate i18n systems: root `locales/` for extension, `webview-ui/src/i18n/` for UI
7-
- Provider examples in `src/api/providers/` are canonical reference (docs may be outdated)
8-
- Webview runs in VSCode context with restrictions (no localStorage, limited browser APIs)
3+
- `src/` contains VSCode extension code, NOT general source (counterintuitive naming)
4+
- `webview-ui/` is React UI in VSCode webview with severe restrictions (no localStorage, limited APIs)
5+
- Two separate i18n systems: `locales/` for extension, `webview-ui/src/i18n/` for UI
6+
- Monorepo workspace roots are `"src"` and `"webview-ui"` (not standard `packages/` structure)
7+
- Extension bundled with custom `esbuild.mjs`, webview uses Vite

.roo/rules-code/AGENTS.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
# Code Mode Rules
1+
# Project Coding Rules (Non-Obvious Only)
22

3-
## Critical Non-Obvious Patterns
4-
5-
- **MANDATORY**: Use `safeWriteJson()` from `src/utils/safeWriteJson.ts` for ALL JSON writes (prevents corruption via atomic writes with locking)
6-
- Tests MUST run from workspace directory: `cd src && npx vitest run` (NOT from root)
7-
- VSCode CSS variables must be added to `webview-ui/src/index.css` before use
8-
- State management via React hooks only (external state libraries break webview isolation)
9-
- Providers MUST be stateless (hidden caching layer assumes this)
10-
- Import paths in packages/ require `.js` extensions despite TypeScript source
3+
- Always use `safeWriteJson()` from `src/utils/safeWriteJson.ts` instead of `JSON.stringify` for file writes (prevents corruption)
4+
- Extension code in `src/` directory, NOT in `apps/` (counterintuitive structure)
5+
- Webview UI in `webview-ui/` runs with restricted APIs - no localStorage, limited browser features
6+
- IPC patterns MUST follow `src/core/webview/webviewMessageHandler.ts` structure
7+
- Tests must be in `__tests__` folders or `.spec.ts` files (vitest won't find them otherwise)
8+
- VSCode API mocked differently: `src/__mocks__/vscode.js` vs `webview-ui/src/__mocks__/vscode.ts`

.roo/rules-debug/AGENTS.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
# Debug Mode Rules
1+
# Project Debug Rules (Non-Obvious Only)
22

3-
## Non-Obvious Debug Access
4-
5-
- Webview DevTools: Command Palette → "Developer: Open Webview Developer Tools" (NOT F12)
6-
- Extension logs: VSCode Output panel → "Roo Code" channel
7-
- Extension Host output channel shows different logs than Debug Console
8-
9-
## Critical Debug Patterns
10-
11-
- IPC messages fail silently without try/catch in `packages/ipc/src/`
12-
- Tests MUST run from workspace directory: `cd src && npx vitest run`
13-
- Webview runs in restricted context (no localStorage, limited browser APIs)
3+
- Extension logs only visible in "Extension Host" output channel, NOT Debug Console
4+
- Webview dev tools accessed via Command Palette > "Developer: Open Webview Developer Tools" (not F12)
5+
- Database migrations MUST run from `packages/evals/` directory: `cd packages/evals && pnpm db:migrate`
6+
- IPC messages fail silently if not wrapped in try/catch in webview message handlers
7+
- Two separate mock systems: `src/__mocks__/vscode.js` for extension, `webview-ui/src/__mocks__/vscode.ts` for UI

AGENTS.md

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,36 @@
22

33
This file provides guidance to agents when working with code in this repository.
44

5-
## Critical Non-Obvious Patterns
6-
7-
- **JSON Writes**: MUST use `safeWriteJson()` from `src/utils/safeWriteJson.ts` for ALL JSON writes (atomic writes with locking, handles streaming)
8-
- **Test Execution**: Tests MUST run from workspace directory: `cd src && npx vitest run` or `cd webview-ui && npx vitest run` (NOT from root)
9-
- **Import Extensions**: Use `.js` extensions in packages/ imports despite TypeScript source files
10-
- **Bootstrap**: `pnpm install` auto-bootstraps via `scripts/bootstrap.mjs` if pnpm not found
11-
- **Webview DevTools**: Access via Command Palette → "Developer: Open Webview Developer Tools" (not F12)
12-
- **VSCode CSS Variables**: Must be added to `webview-ui/src/index.css` before use in components
13-
- **React Hooks Required**: External state libraries break webview isolation - use React hooks only
14-
- **noUncheckedIndexedAccess**: TypeScript strict mode with this enabled - array/object access may return undefined
15-
16-
## Architecture Gotchas
17-
18-
- `src/` contains VSCode extension backend (not generic source)
19-
- `webview-ui/` is React frontend in VSCode webview (restricted APIs, no localStorage)
20-
- IPC messages between extension/webview must use typed interfaces from `packages/types`
21-
- Provider implementations must be stateless (hidden caching layer assumes this)
5+
## Critical Non-Obvious Rules
6+
7+
- **MUST** use `safeWriteJson()` from `src/utils/safeWriteJson.ts` for ALL JSON file writes (prevents corruption via atomic writes with locking)
8+
- Test files exempt from safeWriteJson rule
9+
10+
## Project Structure (Non-Standard)
11+
12+
- `src/` contains VSCode extension code (NOT general source - counterintuitive naming)
13+
- `webview-ui/` is the React UI that runs in VSCode webview (separate from extension)
14+
- Two separate i18n systems: root `locales/` for extension, `webview-ui/src/i18n/` for UI
15+
- Monorepo uses pnpm workspaces with unusual paths: `"src"` and `"webview-ui"` as workspace roots
16+
17+
## Testing Specifics
18+
19+
- Tests MUST be in `__tests__` folders or `.spec.ts` files (vitest configured this way)
20+
- VSCode module mocked at `src/__mocks__/vscode.js` and `webview-ui/src/__mocks__/vscode.ts`
21+
- Run single test: `pnpm test -- path/to/test.spec.ts`
22+
23+
## Build Commands (Directory-Sensitive)
24+
25+
- Database operations MUST run from `packages/evals/` directory: `cd packages/evals && pnpm db:migrate`
26+
- Extension bundling uses custom `esbuild.mjs` script, not standard vite/webpack
27+
28+
## Webview Restrictions
29+
30+
- Webview has NO localStorage, limited browser APIs
31+
- IPC communication through specific patterns in `src/core/webview/webviewMessageHandler.ts`
32+
- State management requires React hooks only (external state libraries break isolation)
33+
34+
## Code Style (Non-Standard)
35+
36+
- Tabs not spaces (4-width), no semicolons, bracket same line
37+
- Line width 120 chars (not default 80)

0 commit comments

Comments
 (0)