# Agent Coding Guidelines This document provides guidelines for AI agents operating in this repository. ## Project Overview **oh-my-opencode-slim** - A lightweight agent orchestration plugin for OpenCode, a slimmed-down fork of oh-my-opencode. Built with TypeScript, Bun, and Biome. ## Commands | Command | Description | |---------|-------------| | `bun run build` | Build TypeScript to `dist/` (both index.ts and cli/index.ts) | | `bun run typecheck` | Run TypeScript type checking without emitting | | `bun test` | Run all tests with Bun | | `bun run lint` | Run Biome linter on entire codebase | | `bun run format` | Format entire codebase with Biome | | `bun run check` | Run Biome check with auto-fix (lint + format + organize imports) | | `bun run check:ci` | Run Biome check without auto-fix (CI mode) | | `bun run dev` | Build and run with OpenCode | **Running a single test:** Use Bun's test filtering with the `-t` flag: ```bash bun test -t "test-name-pattern" ``` ## Code Style ### General Rules - **Formatter/Linter:** Biome (configured in `biome.json`) - **Line width:** 80 characters - **Indentation:** 2 spaces - **Line endings:** LF (Unix) - **Quotes:** Single quotes in JavaScript/TypeScript - **Trailing commas:** Always enabled ### TypeScript Guidelines - **Strict mode:** Enabled in `tsconfig.json` - **No explicit `any`:** Generates a linter warning (disabled for test files) - **Module resolution:** `bundler` strategy - **Declarations:** Generate `.d.ts` files in `dist/` ### Imports - Biome auto-organizes imports on save (`organizeImports: "on"`) - Let the formatter handle import sorting - Use path aliases defined in TypeScript configuration if present ### Naming Conventions - **Variables/functions:** camelCase - **Classes/interfaces:** PascalCase - **Constants:** SCREAMING_SNAKE_CASE - **Files:** kebab-case for most, PascalCase for React components ### Error Handling - Use typed errors with descriptive messages - Let errors propagate appropriately rather than catching silently - Use Zod for runtime validation (already a dependency) ### Git Integration - Biome integrates with git (VCS enabled) - Commits should pass `bun run check:ci` before pushing ## Project Structure ``` oh-my-opencode-slim/ ├── src/ # TypeScript source files ├── dist/ # Built JavaScript and declarations ├── node_modules/ # Dependencies ├── biome.json # Biome configuration ├── tsconfig.json # TypeScript configuration └── package.json # Project manifest and scripts ``` ## Key Dependencies - `@modelcontextprotocol/sdk` - MCP protocol implementation - `@opencode-ai/sdk` - OpenCode AI SDK - `zod` - Runtime validation - `vscode-jsonrpc` / `vscode-languageserver-protocol` - LSP support ## Development Workflow 1. Make code changes 2. Run `bun run check:ci` to verify linting and formatting 3. Run `bun run typecheck` to verify types 4. Run `bun test` to verify tests pass 5. Commit changes ## Common Patterns - This is an OpenCode plugin - most functionality lives in `src/` - The CLI entry point is `src/cli/index.ts` - The main plugin export is `src/index.ts` - Skills are located in `src/skills/` (included in package publish)