mirror of
https://github.com/instructkr/claw-code.git
synced 2026-04-15 12:34:50 +08:00
fix(dead-code): remove stale constants + dead function; add workspace_sessions_dir tests
Three dead-code warnings eliminated from cargo check: 1. KNOWN_TOP_LEVEL_KEYS / DEPRECATED_TOP_LEVEL_KEYS in config.rs - Superseded by config_validate::TOP_LEVEL_FIELDS and DEPRECATED_FIELDS - Were out of date (missing aliases, providerFallbacks, trustedRoots) - Removed 2. read_git_recent_commits in prompt.rs - Private function, never called anywhere in the codebase - Removed 3. workspace_sessions_dir in session.rs - Public API scaffolded for session isolation (#41) - Genuinely useful for external consumers (clawhip enumerating sessions) - Added 2 tests: deterministic path for same CWD, different path for different CWDs - Annotated with #[allow(dead_code)] since it is external-facing API cargo check --workspace: 0 warnings remaining 430 runtime tests passing, 0 failing
This commit is contained in:
@@ -253,30 +253,6 @@ fn read_git_status(cwd: &Path) -> Option<String> {
|
||||
}
|
||||
}
|
||||
|
||||
fn read_git_recent_commits(cwd: &Path) -> Option<String> {
|
||||
let output = Command::new("git")
|
||||
.args([
|
||||
"--no-optional-locks",
|
||||
"log",
|
||||
"--oneline",
|
||||
"--no-decorate",
|
||||
"-n",
|
||||
"5",
|
||||
])
|
||||
.current_dir(cwd)
|
||||
.output()
|
||||
.ok()?;
|
||||
if !output.status.success() {
|
||||
return None;
|
||||
}
|
||||
let stdout = String::from_utf8(output.stdout).ok()?;
|
||||
let trimmed = stdout.trim();
|
||||
if trimmed.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(trimmed.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
fn read_git_diff(cwd: &Path) -> Option<String> {
|
||||
let mut sections = Vec::new();
|
||||
|
||||
Reference in New Issue
Block a user