From 98dddd6de20f8e02295995498cb65fa97336cdc8 Mon Sep 17 00:00:00 2001 From: imbytecat Date: Mon, 12 Jan 2026 12:16:02 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=88=9D=E5=A7=8B=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 4 +++ .gitignore | 6 ++++ .vscode/settings.json | 16 +++++++++ biome.json | 36 ++++++++++++++++++++ dcp.jsonc | 55 ++++++++++++++++++++++++++++++ opencode.json | 77 ++++++++++++++++++++++++++++++++++++++++++ skill/.gitkeep | 0 snippet/mcp.jsonc | 21 ++++++++++++ snippet/provider.jsonc | 58 +++++++++++++++++++++++++++++++ 9 files changed, 273 insertions(+) create mode 100644 .env.example create mode 100644 .gitignore create mode 100644 .vscode/settings.json create mode 100644 biome.json create mode 100644 dcp.jsonc create mode 100644 opencode.json create mode 100644 skill/.gitkeep create mode 100644 snippet/mcp.jsonc create mode 100644 snippet/provider.jsonc diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..84d1f54 --- /dev/null +++ b/.env.example @@ -0,0 +1,4 @@ +CPA_API_KEY= + +# if using Windows +OPENCODE_GIT_BASH_PATH=C:\Users\imbytecat\scoop\apps\git\current\bin\bash.exe diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..931fa36 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +node_modules +package.json +bun.lock + +.DS_Store +Thumbs.db diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..f0c2b1b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,16 @@ +{ + "editor.codeActionsOnSave": { + "source.fixAll.biome": "explicit", + "source.organizeImports.biome": "explicit" + }, + "editor.formatOnSave": true, + "[json]": { + "editor.defaultFormatter": "biomejs.biome" + }, + "[jsonc]": { + "editor.defaultFormatter": "biomejs.biome" + }, + "files.associations": { + "**/opencode.json": "jsonc" + } +} diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..c7a53d7 --- /dev/null +++ b/biome.json @@ -0,0 +1,36 @@ +{ + "$schema": "https://biomejs.dev/schemas/latest/schema.json", + "vcs": { + "enabled": true, + "clientKind": "git", + "useIgnoreFile": true + }, + "files": { + "ignoreUnknown": false + }, + "formatter": { + "enabled": true, + "indentStyle": "space", + "indentWidth": 2 + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true + } + }, + "javascript": { + "formatter": { + "quoteStyle": "single", + "semicolons": "asNeeded" + } + }, + "assist": { + "enabled": true, + "actions": { + "source": { + "organizeImports": "on" + } + } + } +} diff --git a/dcp.jsonc b/dcp.jsonc new file mode 100644 index 0000000..e570e56 --- /dev/null +++ b/dcp.jsonc @@ -0,0 +1,55 @@ +{ + // Enable or disable the plugin + "enabled": true, + // Enable debug logging to ~/.config/opencode/logs/dcp/ + "debug": false, + // Notification display: "off", "minimal", or "detailed" + "pruneNotification": "detailed", + // Protect from pruning for message turns + "turnProtection": { + "enabled": false, + "turns": 4 + }, + // LLM-driven context pruning tools + "tools": { + // Shared settings for all prune tools + "settings": { + // Nudge the LLM to use prune tools (every tool results) + "nudgeEnabled": true, + "nudgeFrequency": 10, + // Additional tools to protect from pruning + "protectedTools": [] + }, + // Removes tool content from context without preservation (for completed tasks or noise) + "discard": { + "enabled": true + }, + // Distills key findings into preserved knowledge before removing raw content + "extract": { + "enabled": true, + // Show distillation content as an ignored message notification + "showDistillation": false + } + }, + // Automatic pruning strategies + "strategies": { + // Remove duplicate tool calls (same tool with same arguments) + "deduplication": { + "enabled": true, + // Additional tools to protect from pruning + "protectedTools": [] + }, + // Prune write tool inputs when the file has been subsequently read + "supersedeWrites": { + "enabled": false + }, + // Prune tool inputs for errored tools after X turns + "purgeErrors": { + "enabled": true, + // Number of turns before errored tool inputs are pruned + "turns": 4, + // Additional tools to protect from pruning + "protectedTools": [] + } + } +} diff --git a/opencode.json b/opencode.json new file mode 100644 index 0000000..2ce08a9 --- /dev/null +++ b/opencode.json @@ -0,0 +1,77 @@ +{ + "$schema": "https://opencode.ai/config.json", + "autoupdate": "notify", + "theme": "tokyonight", + "model": "ai-gateway/claude-opus-4-5-thinking", + "small_model": "ai-gateway/gemini-3-flash-preview", + "plugin": [ + "@tarquinen/opencode-dcp@latest", + "@franlol/opencode-md-table-formatter@latest" + ], + "mcp": { + "websearch": { + "type": "remote", + "url": "https://mcp.exa.ai/mcp?tools=web_search_exa" + }, + "context7": { + "type": "remote", + "url": "https://mcp.context7.com/mcp" + }, + "grep_app": { + "type": "remote", + "url": "https://mcp.grep.app" + } + }, + "permission": { + "websearch": "deny" + }, + "provider": { + "ai-gateway": { + "name": "AI Gateway", + "npm": "@ai-sdk/anthropic", + "options": { + "baseURL": "http://10.0.1.1:8317/v1", + "apiKey": "{env:CPA_API_KEY}" + }, + "models": { + "claude-opus-4-5-thinking": { + "name": "Claude Opus 4.5 (Thinking)" + }, + "claude-sonnet-4-5-thinking": { + "name": "Claude Sonnet 4.5 (Thinking)" + }, + "claude-sonnet-4-5": { + "name": "Claude Sonnet 4.5" + }, + "claude-haiku-4-5": { + "name": "Claude Haiku 4.5" + }, + "gemini-3-pro-preview": { + "name": "Gemini 3 Pro" + }, + "gemini-3-flash-preview": { + "name": "Gemini 3 Flash" + }, + "gpt-5.2-codex": { + "name": "GPT-5.2-Codex" + }, + "gpt-5.2": { + "name": "GPT-5.2" + } + } + }, + "GLM Coding": { + "name": "Z.AI", + "npm": "@ai-sdk/openai-compatible", + "options": { + "baseURL": "https://api.z.ai/api/coding/paas/v4", + "apiKey": "{env:ZAI_API_KEY}" + }, + "models": { + "glm-4.7": { + "name": "GLM-4.7" + } + } + } + } +} diff --git a/skill/.gitkeep b/skill/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/snippet/mcp.jsonc b/snippet/mcp.jsonc new file mode 100644 index 0000000..fe4ca17 --- /dev/null +++ b/snippet/mcp.jsonc @@ -0,0 +1,21 @@ +{ + "$schema": "https://opencode.ai/config.json", + "mcp": { + "context7": { + "type": "remote", + "url": "https://mcp.context7.com/mcp" + }, + "deepwiki": { + "type": "remote", + "url": "https://mcp.deepwiki.com/mcp" + }, + "sequential-thinking": { + "type": "local", + "command": ["bunx", "@modelcontextprotocol/server-sequential-thinking"] + }, + "memory": { + "type": "local", + "command": ["bunx", "@modelcontextprotocol/server-memory"] + } + } +} diff --git a/snippet/provider.jsonc b/snippet/provider.jsonc new file mode 100644 index 0000000..7967335 --- /dev/null +++ b/snippet/provider.jsonc @@ -0,0 +1,58 @@ +{ + "$schema": "https://opencode.ai/config.json", + "provider": { + "cli-proxy-api": { + "name": "CLI Proxy API", + "npm": "@ai-sdk/anthropic", + "options": { + // "baseURL": "https://cpa.services.sh.cn:8443/v1", + "baseURL": "http://10.0.1.1:8317/v1", + "apiKey": "{env:CPA_API_KEY}" + }, + "models": { + // Claude + "claude-opus-4-5-thinking": { + "name": "Claude Opus 4.5 (Thinking)" + }, + "claude-sonnet-4-5-thinking": { + "name": "Claude Sonnet 4.5 (Thinking)" + }, + "claude-sonnet-4-5": { + "name": "Claude Sonnet 4.5" + }, + "claude-haiku-4-5": { + "name": "Claude Haiku 4.5" + }, + + // Gemini + "gemini-3-pro-preview": { + "name": "Gemini 3 Pro" + }, + "gemini-3-flash-preview": { + "name": "Gemini 3 Flash" + }, + + // GPT + "gpt-5.2-codex": { + "name": "GPT-5.2-Codex" + }, + "gpt-5.2": { + "name": "GPT-5.2" + } + } + }, + "GLM Coding": { + "name": "Z.AI", + "npm": "@ai-sdk/openai-compatible", + "options": { + "baseURL": "https://api.z.ai/api/coding/paas/v4", + "apiKey": "{env:ZAI_API_KEY}" + }, + "models": { + "glm-4.7": { + "name": "GLM-4.7" + } + } + } + } +}