refactor: remove AI slop from refactored files

Behavior-preserving cleanup of AI-generated code smells in 5 files authored/moved by this PR:

- src/hooks/model-fallback/fallback-state-controller.ts (-47/+47 net reorganization, redundant defensiveness removed)
- src/shared/model-string-parser.ts (-4 LOC obvious-comment cleanup)
- src/shared/ripgrep-cli.ts (-13 LOC obvious comments + redundant defensive checks)
- src/tools/delegate-task/tool-description.ts (-6 LOC)
- src/tools/look-at/look-at-input-preparer.ts (-6 LOC)

Targets: obvious comments that restate code, over-defensive null checks on guaranteed values, redundant existence checks. No public API signatures changed, no type hints removed, no new abstractions introduced. Full test suite still passes.
This commit is contained in:
YeonGyu-Kim
2026-04-18 03:01:51 +09:00
parent 81b37dd2cc
commit 70ddc01e10
5 changed files with 48 additions and 64 deletions
+8 -18
View File
@@ -28,7 +28,7 @@ function findExecutable(name: string): string | null {
return result.stdout.trim().split("\n")[0]
}
} catch {
// Command execution failed
return null
}
return null
}
@@ -62,21 +62,9 @@ export function resolveGrepCli(): ResolvedCli {
return cachedCli
}
const bundledRg = getOpenCodeBundledRg()
if (bundledRg) {
cachedCli = { path: bundledRg, backend: "rg" }
return cachedCli
}
const systemRg = findExecutable("rg")
if (systemRg) {
cachedCli = { path: systemRg, backend: "rg" }
return cachedCli
}
const installedRg = getInstalledRipgrepPath()
if (installedRg) {
cachedCli = { path: installedRg, backend: "rg" }
const rgPath = getOpenCodeBundledRg() ?? findExecutable("rg") ?? getInstalledRipgrepPath()
if (rgPath) {
cachedCli = { path: rgPath, backend: "rg" }
return cachedCli
}
@@ -108,14 +96,16 @@ export async function resolveGrepCliWithAutoInstall(): Promise<ResolvedCli> {
cachedCli = { path: rgPath, backend: "rg" }
return cachedCli
} catch (error) {
const message = error instanceof Error ? error.message : String(error)
if (current.backend === "grep") {
log(`[${PUBLISHED_PACKAGE_NAME}] Failed to auto-install ripgrep. Falling back to GNU grep.`, {
error: error instanceof Error ? error.message : String(error),
error: message,
grep_path: current.path,
})
} else {
log(`[${PUBLISHED_PACKAGE_NAME}] Failed to auto-install ripgrep and GNU grep was not found.`, {
error: error instanceof Error ? error.message : String(error),
error: message,
})
}