mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-29 13:44:19 +01:00
tool updates
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
# OpenCode Agent Guidelines
|
||||
|
||||
## Build/Test Commands
|
||||
|
||||
- **Install**: `bun install`
|
||||
- **Run**: `bun run index.ts`
|
||||
- **Typecheck**: `bun run typecheck` (npm run typecheck)
|
||||
@@ -8,16 +9,22 @@
|
||||
- **Single test**: `bun test test/tool/tool.test.ts` (specific test file)
|
||||
|
||||
## Code Style
|
||||
|
||||
- **Runtime**: Bun with TypeScript ESM modules
|
||||
- **Imports**: Use relative imports for local modules, named imports preferred
|
||||
- **Types**: Zod schemas for validation, TypeScript interfaces for structure
|
||||
- **Naming**: camelCase for variables/functions, PascalCase for classes/namespaces
|
||||
- **Error handling**: Use Result patterns, avoid throwing exceptions in tools
|
||||
- **File structure**: Namespace-based organization (e.g., `Tool.define()`, `Session.create()`)
|
||||
- DO NOT do unnecessary destructuring of variables
|
||||
- DO NOT use else statements unless necessary
|
||||
- DO NOT use try catch if it can be avoided
|
||||
|
||||
## Architecture
|
||||
|
||||
- **Tools**: Implement `Tool.Info` interface with `execute()` method
|
||||
- **Context**: Pass `sessionID` in tool context, use `App.provide()` for DI
|
||||
- **Validation**: All inputs validated with Zod schemas
|
||||
- **Logging**: Use `Log.create({ service: "name" })` pattern
|
||||
- **Storage**: Use `Storage` namespace for persistence
|
||||
- **Storage**: Use `Storage` namespace for persistence
|
||||
|
||||
|
||||
Reference in New Issue
Block a user