Feat: Implemented advanced settings for Claude Code AI provider (#872)
* Feat: Implemented advanced settings for Claude Code AI provider - Added new 'claudeCode' property to default config - Added getters and validation functions to 'config-manager.js' - Added new 'isEmpty' utility to 'utils.js' - Added new constants file 'commands.js' for AI_COMMAND_NAMES - Updated Claude Code AI provider to use new config functions - Updated 'claude-code-usage.md' documentation - Added 'config-manager.test.js' tests to cover new settings * chore: run format --------- Co-authored-by: Ralph Khreish <35776126+Crunchyman-ralph@users.noreply.github.com>
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
import { createClaudeCode } from './custom-sdk/claude-code/index.js';
|
||||
import { BaseAIProvider } from './base-provider.js';
|
||||
import { getClaudeCodeSettingsForCommand } from '../../scripts/modules/config-manager.js';
|
||||
|
||||
export class ClaudeCodeProvider extends BaseAIProvider {
|
||||
constructor() {
|
||||
@@ -26,6 +27,7 @@ export class ClaudeCodeProvider extends BaseAIProvider {
|
||||
/**
|
||||
* Creates and returns a Claude Code client instance.
|
||||
* @param {object} params - Parameters for client initialization
|
||||
* @param {string} [params.commandName] - Name of the command invoking the service
|
||||
* @param {string} [params.baseURL] - Optional custom API endpoint (not used by Claude Code)
|
||||
* @returns {Function} Claude Code client function
|
||||
* @throws {Error} If initialization fails
|
||||
@@ -35,10 +37,7 @@ export class ClaudeCodeProvider extends BaseAIProvider {
|
||||
// Claude Code doesn't use API keys or base URLs
|
||||
// Just return the provider factory
|
||||
return createClaudeCode({
|
||||
defaultSettings: {
|
||||
// Add any default settings if needed
|
||||
// These can be overridden per request
|
||||
}
|
||||
defaultSettings: getClaudeCodeSettingsForCommand(params?.commandName)
|
||||
});
|
||||
} catch (error) {
|
||||
this.handleError('client initialization', error);
|
||||
|
||||
17
src/constants/commands.js
Normal file
17
src/constants/commands.js
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Command related constants
|
||||
* Defines which commands trigger AI processing
|
||||
*/
|
||||
|
||||
// Command names that trigger AI processing
|
||||
export const AI_COMMAND_NAMES = [
|
||||
'add-task',
|
||||
'analyze-complexity',
|
||||
'expand-task',
|
||||
'parse-prd',
|
||||
'research',
|
||||
'research-save',
|
||||
'update-subtask',
|
||||
'update-task',
|
||||
'update-tasks'
|
||||
];
|
||||
Reference in New Issue
Block a user