feat: Enhance CLI tools and settings management

- Added auto-initialization of CSRF token for state-changing requests in cli-manager.js.
- Refactored Claude CLI Tools configuration to separate tools and settings into cli-tools.json and cli-settings.json respectively.
- Introduced new interfaces for Claude CLI Tools and Settings, including support for tags and primary models.
- Implemented loading and saving functions for CLI settings, ensuring backward compatibility with legacy combined config.
- Updated functions to synchronize tags between CLI tools and configuration manager.
- Added error handling and logging for loading and saving configurations.
- Created initial cli-settings.json with default settings.
This commit is contained in:
catlog22
2026-01-08 22:00:07 +08:00
parent 0bd2cff5b7
commit ea5c0bc9a4
12 changed files with 1376 additions and 180 deletions

18
.claude/cli-settings.json Normal file
View File

@@ -0,0 +1,18 @@
{
"version": "1.0.0",
"defaultTool": "gemini",
"promptFormat": "plain",
"smartContext": {
"enabled": false,
"maxFiles": 10
},
"nativeResume": true,
"recursiveQuery": true,
"cache": {
"injectionMode": "auto",
"defaultPrefix": "",
"defaultSuffix": ""
},
"codeIndexMcp": "ace",
"$schema": "./cli-settings.schema.json"
}

View File

@@ -1,39 +1,50 @@
{
"version": "1.0.0",
"version": "2.0.0",
"tools": {
"gemini": {
"enabled": true,
"isBuiltin": true,
"command": "gemini",
"description": "Google AI for code analysis"
"description": "Google AI for code analysis",
"tags": []
},
"qwen": {
"enabled": true,
"isBuiltin": true,
"command": "qwen",
"description": "Alibaba AI assistant"
"description": "Alibaba AI assistant",
"tags": []
},
"codex": {
"enabled": true,
"isBuiltin": true,
"command": "codex",
"description": "OpenAI code generation"
"description": "OpenAI code generation",
"tags": []
},
"claude": {
"enabled": true,
"isBuiltin": true,
"command": "claude",
"description": "Anthropic AI assistant"
"description": "Anthropic AI assistant",
"tags": []
},
"opencode": {
"enabled": true,
"isBuiltin": true,
"command": "opencode",
"description": "OpenCode AI assistant",
"primaryModel": "opencode/glm-4.7-free"
"primaryModel": "opencode/glm-4.7-free",
"tags": []
}
},
"customEndpoints": [],
"customEndpoints": [
{
"id": "g25",
"name": "g25",
"enabled": true
}
],
"defaultTool": "gemini",
"settings": {
"promptFormat": "plain",
@@ -48,7 +59,7 @@
"defaultPrefix": "",
"defaultSuffix": ""
},
"codeIndexMcp": "ace"
"codeIndexMcp": "codexlens"
},
"$schema": "./cli-tools.schema.json"
}