feat: implement CLI v2.1.81 features and global CLAUDE.md editor
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m49s
CI / Lint & Test (pull_request) Successful in 21m2s
CI / Build Linux (pull_request) Successful in 25m46s
CI / Build Windows (cross-compile) (pull_request) Successful in 30m24s

- #248: add output_style field to System init message (forward-compat)
- #245: add fast_mode_state field to Result message (forward-compat)
- #246: add model_usage field to Result message with per-model logging
- #247: add total_cost_usd field to Result message (authoritative cost)
- #237: add bare_mode config option (passes --bare flag to Claude Code)
- #239: add show_clear_context_on_plan_accept config option (settings JSON)
- #244: add custom_model_option config option (ANTHROPIC_CUSTOM_MODEL_OPTION env)
- #262: add global CLAUDE.md editor to config sidebar (get/save_global_claude_md commands)
- fix: wire disable_cron and disable_skill_shell_execution into all start_claude invocations
- fix: wire all new config fields into all start_claude invocations
This commit is contained in:
2026-04-13 11:28:57 -07:00
committed by Naomi Carrigan
parent 5663b1c09a
commit 5d9e6fbd8e
15 changed files with 432 additions and 2 deletions
+51
View File
@@ -2618,6 +2618,39 @@ pub async fn open_binary_file(app: AppHandle, path: String) -> Result<(), String
}
}
/// Read the contents of `~/.claude/CLAUDE.md`.
/// Returns an empty string if the file does not exist.
#[tauri::command]
pub async fn get_global_claude_md() -> Result<String, String> {
let path = dirs::home_dir()
.ok_or_else(|| "Could not determine home directory".to_string())?
.join(".claude")
.join("CLAUDE.md");
if !path.exists() {
return Ok(String::new());
}
std::fs::read_to_string(&path).map_err(|e| format!("Failed to read CLAUDE.md: {}", e))
}
/// Write content to `~/.claude/CLAUDE.md`.
/// Creates the file (and `~/.claude/` directory) if they do not exist.
#[tauri::command]
pub async fn save_global_claude_md(content: String) -> Result<(), String> {
let claude_dir = dirs::home_dir()
.ok_or_else(|| "Could not determine home directory".to_string())?
.join(".claude");
if !claude_dir.exists() {
std::fs::create_dir_all(&claude_dir)
.map_err(|e| format!("Failed to create ~/.claude directory: {}", e))?;
}
let path = claude_dir.join("CLAUDE.md");
std::fs::write(&path, content).map_err(|e| format!("Failed to write CLAUDE.md: {}", e))
}
#[cfg(test)]
mod tests {
use super::*;
@@ -3367,4 +3400,22 @@ gitea: gitea-mcp -t stdio (STDIO) - ✓ Connected"#;
let (_, args) = build_wslpath_command(path);
assert_eq!(args[2], path);
}
#[test]
fn test_get_global_claude_md_path_construction() {
// Verify that home_dir() resolves successfully on the test platform
let home = dirs::home_dir();
assert!(home.is_some(), "home_dir() should be available in test environment");
let expected = home.unwrap().join(".claude").join("CLAUDE.md");
assert!(expected.to_string_lossy().contains(".claude"));
assert!(expected.to_string_lossy().ends_with("CLAUDE.md"));
}
#[test]
fn test_save_global_claude_md_dir_path_construction() {
let home = dirs::home_dir();
assert!(home.is_some());
let dir = home.unwrap().join(".claude");
assert!(dir.to_string_lossy().contains(".claude"));
}
}