feat(config): add execution context profiles for mode-specific agent output (#1827)
* feat(config): add execution context profiles for mode-specific agent output * fix(config): add enum validation for context config key Validate context values against allowed enum (dev, research, review) in cmdConfigSet before writing to config.json, matching the pattern used for model_profile validation. Add rejection test for invalid context values.
This commit is contained in:
@@ -28,6 +28,7 @@ const VALID_CONFIG_KEYS = new Set([
|
||||
'workflow.subagent_timeout',
|
||||
'hooks.context_warnings',
|
||||
'features.thinking_partner',
|
||||
'context',
|
||||
'project_code', 'phase_naming',
|
||||
'manager.flags.discuss', 'manager.flags.plan', 'manager.flags.execute',
|
||||
'response_language',
|
||||
@@ -337,6 +338,11 @@ function cmdConfigSet(cwd, keyPath, value, raw) {
|
||||
try { parsedValue = JSON.parse(value); } catch { /* keep as string */ }
|
||||
}
|
||||
|
||||
const VALID_CONTEXT_VALUES = ['dev', 'research', 'review'];
|
||||
if (keyPath === 'context' && !VALID_CONTEXT_VALUES.includes(String(parsedValue))) {
|
||||
error(`Invalid context value '${value}'. Valid values: ${VALID_CONTEXT_VALUES.join(', ')}`);
|
||||
}
|
||||
|
||||
const setConfigValueResult = setConfigValue(cwd, keyPath, parsedValue);
|
||||
output(setConfigValueResult, raw, `${keyPath}=${parsedValue}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user