generated from nhcarrigan/template
feat: add disable_1m_context toggle to settings UI
Adds a new config option to expose the CLAUDE_CODE_DISABLE_1M_CONTEXT environment variable through the settings sidebar, allowing users to opt out of the extended 1M context window without manually setting environment variables. Closes #154
This commit is contained in:
@@ -28,6 +28,9 @@ pub struct ClaudeStartOptions {
|
||||
|
||||
#[serde(default)]
|
||||
pub use_worktree: bool,
|
||||
|
||||
#[serde(default)]
|
||||
pub disable_1m_context: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@@ -119,6 +122,9 @@ pub struct HikariConfig {
|
||||
|
||||
#[serde(default)]
|
||||
pub use_worktree: bool,
|
||||
|
||||
#[serde(default)]
|
||||
pub disable_1m_context: bool,
|
||||
}
|
||||
|
||||
impl Default for HikariConfig {
|
||||
@@ -152,6 +158,7 @@ impl Default for HikariConfig {
|
||||
budget_warning_threshold: 0.8,
|
||||
discord_rpc_enabled: true,
|
||||
use_worktree: false,
|
||||
disable_1m_context: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -259,6 +266,8 @@ mod tests {
|
||||
assert_eq!(config.budget_action, BudgetAction::Warn);
|
||||
assert!((config.budget_warning_threshold - 0.8).abs() < f32::EPSILON);
|
||||
assert!(config.discord_rpc_enabled);
|
||||
assert!(!config.use_worktree);
|
||||
assert!(!config.disable_1m_context);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -292,6 +301,7 @@ mod tests {
|
||||
budget_warning_threshold: 0.75,
|
||||
discord_rpc_enabled: true,
|
||||
use_worktree: true,
|
||||
disable_1m_context: false,
|
||||
};
|
||||
|
||||
let json = serde_json::to_string(&config).unwrap();
|
||||
|
||||
@@ -279,6 +279,11 @@ impl WslBridge {
|
||||
}
|
||||
}
|
||||
|
||||
// Disable 1M context window if requested
|
||||
if options.disable_1m_context {
|
||||
cmd.env("CLAUDE_CODE_DISABLE_1M_CONTEXT", "1");
|
||||
}
|
||||
|
||||
cmd
|
||||
} else {
|
||||
// Running on Windows - use wsl with bash login shell to ensure PATH is loaded
|
||||
@@ -319,6 +324,11 @@ impl WslBridge {
|
||||
}
|
||||
}
|
||||
|
||||
// Disable 1M context window if requested
|
||||
if options.disable_1m_context {
|
||||
claude_cmd.push_str("CLAUDE_CODE_DISABLE_1M_CONTEXT=1 ");
|
||||
}
|
||||
|
||||
claude_cmd.push_str(
|
||||
"claude --output-format stream-json --input-format stream-json --verbose",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user