From 10621586d0adbe236f34967fca05adfac3a1fe1e Mon Sep 17 00:00:00 2001 From: alvack <714857913@qq.com> Date: Tue, 29 Jul 2025 17:44:26 +0800 Subject: [PATCH] Update .gitignore, agent docs, and provider config Expanded .gitignore to include new documentation and config files. Updated AGENTS.md with build, lint, and test commands, and clarified code style guidelines. Added Moonshot provider and new model definitions to opencode.json for improved provider support. --- .gitignore | 10 ++++++ AGENTS.md | 54 ++++++++++++++++++++++------ opencode.json | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 153 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 1c88d3d59dba..da4825c99ccc 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,13 @@ node_modules .vscode openapi.json scratch +CLAUDE.md +requirement.md +OPENCODE_ARCHITECTURE_ANALYSIS.md +opencode.json +AGENTS.md +opencode.json +AGENTS.md +.claude/settings.local.json +opencode.json +AGENTS.md diff --git a/AGENTS.md b/AGENTS.md index 0852d237ada6..65e99da9be6a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,13 +1,47 @@ -## Style +## Build/Lint/Test Commands -- prefer single word variable/function names -- avoid try catch where possible - prefer to let exceptions bubble up -- avoid else statements where possible -- do not make useless helper functions - inline functionality unless the - function is reusable or composable -- prefer Bun apis +- `bun install` - Install all dependencies +- `bun run dev` - Run CLI in development mode +- `bun run typecheck` - Type check all packages +- `bun run packages/opencode/test/bun.test.ts` - Run a single test file +- `cd packages/sdk && ./scripts/test path/to/test.file.ts` - Run a single SDK test +- `cd packages/sdk && ./scripts/lint` - Lint SDK code +- `cd packages/sdk && ./scripts/format` - Format SDK code +- `cd packages/sdk && ./scripts/build` - Build SDK -## Workflow +## Code Style Guidelines -- you can regenerate the golang sdk by calling ./scripts/stainless.ts -- we use bun for everything +### Imports +- Use relative imports within the same package +- Avoid package imports like `@opencode-ai/sdk` in source code +- Prefer single word variable/function names +- Group imports logically (external, internal, types) + +### Formatting +- Use Prettier with semi=false, printWidth=120 (root) or printWidth=110 (SDK) +- Use single quotes for strings +- Trailing commas required +- No unused imports (enforced by eslint) + +### Types +- Strict TypeScript with all strict flags enabled +- Use Zod for schema validation +- No implicit any, strict null checks +- Exact optional property types + +### Naming Conventions +- Prefer single word variable/function names +- Use camelCase for variables and functions +- Use PascalCase for classes and types +- Use UPPER_CASE for constants + +### Error Handling +- Avoid try/catch where possible - let exceptions bubble up +- Avoid else statements where possible +- Do not create useless helper functions - inline unless reusable + +### General +- Prefer Bun APIs +- Use descriptive variable/function names when single word isn't clear +- Follow existing code patterns in the codebase +- Write clean, robust, high-quality code with clear logic \ No newline at end of file diff --git a/opencode.json b/opencode.json index 8efc57a7a76e..72d057fa176f 100644 --- a/opencode.json +++ b/opencode.json @@ -2,6 +2,8 @@ "$schema": "https://opencode.ai/config.json", "provider": { "openrouter": { + "api": "https://openrouter.ai/api/v1", + "env": ["OPENROUTER_API_KEY"], "models": { "moonshotai/kimi-k2": { "options": { @@ -17,6 +19,103 @@ "models": { "Qwen/Qwen3-235B-A22B-Instruct-2507:fireworks-ai": {} } + }, + "moonshot": { + "npm": "@ai-sdk/openai-compatible", + "api": "https://api.moonshot.cn/v1", + "env": ["MOONSHOT_API_KEY"], + "models": { + "moonshot-v1-8k": { + "name": "Moonshot v1 8K", + "release_date": "2025-01-01", + "attachment": false, + "reasoning": true, + "temperature": true, + "tool_call": true, + "limit": { + "context": 8000, + "output": 4096 + }, + "cost": { + "input": 12, + "output": 12, + "cache_read": 0, + "cache_write": 0 + } + }, + "moonshot-v1-32k": { + "name": "Moonshot v1 32K", + "release_date": "2025-01-01", + "attachment": false, + "reasoning": true, + "temperature": true, + "tool_call": true, + "limit": { + "context": 32000, + "output": 4096 + }, + "cost": { + "input": 12, + "output": 12, + "cache_read": 0, + "cache_write": 0 + } + }, + "moonshot-v1-128k": { + "name": "Moonshot v1 128K", + "release_date": "2025-01-01", + "attachment": false, + "reasoning": true, + "temperature": true, + "tool_call": true, + "limit": { + "context": 128000, + "output": 4096 + }, + "cost": { + "input": 12, + "output": 12, + "cache_read": 0, + "cache_write": 0 + } + }, + "kimi-k2-0711-preview": { + "name": "Kimi K2 0711 Preview", + "release_date": "2025-07-11", + "attachment": true, + "reasoning": true, + "temperature": true, + "tool_call": true, + "limit": { + "context": 128000, + "output": 8192 + }, + "cost": { + "input": 8, + "output": 8, + "cache_read": 0, + "cache_write": 0 + } + }, + "kimi-latest": { + "name": "Kimi Latest", + "release_date": "2025-01-01", + "attachment": true, + "reasoning": true, + "temperature": true, + "tool_call": true, + "limit": { + "context": 128000, + "output": 8192 + }, + "cost": { + "input": 8, + "output": 8, + "cache_read": 0, + "cache_write": 0 + } + } + } } }, "mcp": {