mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-28 09:23:08 +08:00
feat: add CLI settings export/import functionality
- Implemented exportSettings and importSettings APIs for CLI settings. - Added hooks useExportSettings and useImportSettings for managing export/import operations in the frontend. - Updated SettingsPage to include buttons for exporting and importing CLI settings. - Enhanced backend to handle export and import requests, including validation and conflict resolution. - Introduced new data structures for exported settings and import options. - Updated localization files to support new export/import features. - Refactored CLI tool configurations to remove hardcoded model defaults, allowing dynamic model retrieval.
This commit is contained in:
@@ -6482,6 +6482,68 @@ export async function upgradeCcwInstallation(
|
||||
});
|
||||
}
|
||||
|
||||
// ========== CLI Settings Export/Import API ==========
|
||||
|
||||
/**
|
||||
* Exported settings structure from backend
|
||||
*/
|
||||
export interface ExportedSettings {
|
||||
version: string;
|
||||
exportedAt: string;
|
||||
settings: {
|
||||
cliTools?: Record<string, unknown>;
|
||||
chineseResponse?: {
|
||||
claudeEnabled: boolean;
|
||||
codexEnabled: boolean;
|
||||
};
|
||||
windowsPlatform?: {
|
||||
enabled: boolean;
|
||||
};
|
||||
codexCliEnhancement?: {
|
||||
enabled: boolean;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Import options for settings import
|
||||
*/
|
||||
export interface ImportOptions {
|
||||
overwrite?: boolean;
|
||||
dryRun?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Import result from backend
|
||||
*/
|
||||
export interface ImportResult {
|
||||
success: boolean;
|
||||
imported: number;
|
||||
skipped: number;
|
||||
errors: string[];
|
||||
importedIds: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Export CLI settings to JSON file
|
||||
*/
|
||||
export async function exportSettings(): Promise<ExportedSettings> {
|
||||
return fetchApi('/api/cli/settings/export');
|
||||
}
|
||||
|
||||
/**
|
||||
* Import CLI settings from JSON data
|
||||
*/
|
||||
export async function importSettings(
|
||||
data: ExportedSettings,
|
||||
options?: ImportOptions
|
||||
): Promise<ImportResult> {
|
||||
return fetchApi('/api/cli/settings/import', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ data, options }),
|
||||
});
|
||||
}
|
||||
|
||||
// ========== CCW Tools API ==========
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user