Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

fix(doctor): walk-up .git fallback for git-repo health check (#1791.7) (#1802)

rUv48da302b3b91
diff --git a/v3/@claude-flow/cli/src/commands/doctor.ts b/v3/@claude-flow/cli/src/commands/doctor.ts
index b1aefa8e96..b6fb51479c 100644
--- a/v3/@claude-flow/cli/src/commands/doctor.ts
+++ b/v3/@claude-flow/cli/src/commands/doctor.ts
@@ -210,11 +210,32 @@ async function checkGit(): Promise<HealthCheck> {
}
// Check if in git repo (async with proper env inheritance)
+//
+// #1791.7 — `git rev-parse` was reported as failing on hosts where `.git`
+// clearly exists in cwd (linux-arm64 daemon contexts). Treat the git binary
+// as authoritative when it succeeds, but fall back to a `.git` walk-up so a
+// present repository is recognized even when the git invocation fails for
+// environment reasons (PATH, broken global config, EBADCWD, etc.).
async function checkGitRepo(): Promise<HealthCheck> {
try {
- await runCommand('git rev-parse --git-dir');
+ await runCommand('git rev-parse --is-inside-work-tree');
return { name: 'Git Repository', status: 'pass', message: 'In a git repository' };
} catch {
+ // Walk parents of cwd for a .git directory before reporting "not a repo"
+ let dir = process.cwd();
+ while (true) {
+ if (existsSync(join(dir, '.git'))) {
+ return {
+ name: 'Git Repository',
+ status: 'warn',
+ message: `Repo detected on disk (${join(dir, '.git')}) but \`git rev-parse\` failed — check git installation and PATH`,
+ fix: 'Verify git is on PATH (try `git --version`) and that the working tree is not corrupted',
+ };
+ }
+ const parent = dirname(dir);
+ if (parent === dir) break;
+ dir = parent;
+ }
return { name: 'Git Repository', status: 'warn', message: 'Not a git repository', fix: 'git init' };
}
}