Something went wrong. Try again.
source dump of claude code forked from oppi.li/claude-code
Something went wrong. Try again.
2.9 kB · 93 lines
TypeScript
at main
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394import { feature } from 'bun:bundle'import { getModelOptions } from '../../utils/model/modelOptions.js'import { isVoiceGrowthBookEnabled } from '../../voice/voiceModeEnabled.js'import { getOptionsForSetting, SUPPORTED_SETTINGS,} from './supportedSettings.js'
export const DESCRIPTION = 'Get or set Claude Code configuration settings.'
/** * Generate the prompt documentation from the registry */export function generatePrompt(): string { const globalSettings: string[] = [] const projectSettings: string[] = []
for (const [key, config] of Object.entries(SUPPORTED_SETTINGS)) { // Skip model - it gets its own section with dynamic options if (key === 'model') continue // Voice settings are registered at build-time but gated by GrowthBook // at runtime. Hide from model prompt when the kill-switch is on. if ( feature('VOICE_MODE') && key === 'voiceEnabled' && !isVoiceGrowthBookEnabled() ) continue
const options = getOptionsForSetting(key) let line = `- ${key}`
if (options) { line += `: ${options.map(o => `"${o}"`).join(', ')}` } else if (config.type === 'boolean') { line += `: true/false` }
line += ` - ${config.description}`
if (config.source === 'global') { globalSettings.push(line) } else { projectSettings.push(line) } }
const modelSection = generateModelSection()
return `Get or set Claude Code configuration settings.
View or change Claude Code settings. Use when the user requests configuration changes, asks about current settings, or when adjusting a setting would benefit them.
## Usage- **Get current value:** Omit the "value" parameter- **Set new value:** Include the "value" parameter
## Configurable settings listThe following settings are available for you to change:
### Global Settings (stored in ~/.claude.json)${globalSettings.join('\n')}
### Project Settings (stored in settings.json)${projectSettings.join('\n')}
${modelSection}## Examples- Get theme: { "setting": "theme" }- Set dark theme: { "setting": "theme", "value": "dark" }- Enable vim mode: { "setting": "editorMode", "value": "vim" }- Enable verbose: { "setting": "verbose", "value": true }- Change model: { "setting": "model", "value": "opus" }- Change permission mode: { "setting": "permissions.defaultMode", "value": "plan" }`}
function generateModelSection(): string { try { const options = getModelOptions() const lines = options.map(o => { const value = o.value === null ? 'null/"default"' : `"${o.value}"` return ` - ${value}: ${o.descriptionForModel ?? o.description}` }) return `## Model- model - Override the default model. Available options:${lines.join('\n')}` } catch { return `## Model- model - Override the default model (sonnet, opus, haiku, best, or full model ID)` }}