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

View File

@@ -22,6 +22,12 @@ async function csrfFetch(url, options) {
// Add CSRF token header for state-changing methods
var method = (options.method || 'GET').toUpperCase();
// Auto-initialize CSRF token for state-changing requests
if (['POST', 'PUT', 'PATCH', 'DELETE'].indexOf(method) !== -1) {
await initCsrfToken();
}
if (['POST', 'PUT', 'PATCH', 'DELETE'].indexOf(method) !== -1 && csrfToken) {
options.headers['X-CSRF-Token'] = csrfToken;
}