From e84f7c8034239983aed475aac0ffdddeda3f61a7 Mon Sep 17 00:00:00 2001 From: bellman Date: Fri, 5 Jun 2026 05:34:56 +0900 Subject: [PATCH] fix: report 'no_git_repo' instead of 'clean' when not in git (#125) status/doctor JSON now reports git_state:'no_git_repo' when project_root is None, instead of the misleading 'clean' which implied a git repo was present with zero changes. Generated with https://github.com/Yeachan-Heo/gajae-code Co-authored-by: Gajae Code --- rust/crates/rusty-claude-cli/src/main.rs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/rust/crates/rusty-claude-cli/src/main.rs b/rust/crates/rusty-claude-cli/src/main.rs index 405c5c0d..e5fb53f5 100644 --- a/rust/crates/rusty-claude-cli/src/main.rs +++ b/rust/crates/rusty-claude-cli/src/main.rs @@ -4268,7 +4268,14 @@ fn check_workspace_health(context: &StatusContext) -> DiagnosticCheck { "Git branch {}", context.git_branch.as_deref().unwrap_or("unknown") ), - format!("Git state {}", context.git_summary.headline()), + format!( + "Git state {}", + if context.project_root.is_some() { + context.git_summary.headline() + } else { + "no git repo".to_string() + } + ), format!("Changed files {}", context.git_summary.changed_files), format!( "Memory files {} ยท config files loaded {}/{}", @@ -4305,7 +4312,11 @@ fn check_workspace_health(context: &StatusContext) -> DiagnosticCheck { ("git_branch".to_string(), json!(context.git_branch)), ( "git_state".to_string(), - json!(context.git_summary.headline()), + json!(if context.project_root.is_some() { + context.git_summary.headline() + } else { + "no_git_repo".to_string() + }), ), ( "changed_files".to_string(), @@ -9407,7 +9418,7 @@ fn status_json_value( "cwd": context.cwd, "project_root": context.project_root, "git_branch": context.git_branch, - "git_state": context.git_summary.headline(), + "git_state": if context.project_root.is_some() { context.git_summary.headline() } else { "no_git_repo".to_string() }, // #408: changed_files counts ALL non-clean files (staged + unstaged + untracked + conflicted) "changed_files": context.git_summary.changed_files, "is_clean": context.git_summary.changed_files == 0, @@ -9654,7 +9665,11 @@ fn format_status_report( .as_ref() .map_or_else(|| "unknown".to_string(), |path| path.display().to_string()), context.git_branch.as_deref().unwrap_or("unknown"), - context.git_summary.headline(), + if context.project_root.is_some() { + context.git_summary.headline() + } else { + "no_git_repo".to_string() + }, context.git_summary.changed_files, context.git_summary.staged_files, context.git_summary.unstaged_files,