singularity-forge/src/claude-cli-check.ts
ace-pm 9d739dfa5d Rename GSD→SF: complete rebrand from fork origin
- All gsdDir/gsdRoot/gsdHome → sfDir/sfRootDir/sfHome
- GSDWorkspace* → SFWorkspace* interfaces
- bootstrapGsdProject → bootstrapProject
- runGSDDoctor → runSFDoctor
- GsdClient → SfClient, gsd-client.ts → sf-client.ts
- .gsd/ → .sf/ in all tests, docs, docker, native, vscode
- Auto-migration: headless detects .gsd/ → renames to .sf/
- Deleted gsd-phase-state.ts backward-compat re-export
- Renamed bin/gsd-from-source → bin/sf-from-source
- Updated mintlify docs, github workflows, docker configs
2026-04-15 18:33:47 +02:00

37 lines
1 KiB
TypeScript

// sf — Claude CLI binary detection for onboarding
// Lightweight check used at onboarding time (before extensions load).
// The full readiness check with caching lives in the claude-code-cli extension.
import { execFileSync } from 'node:child_process'
/**
* Check if the `claude` binary is installed (regardless of auth state).
*/
export function isClaudeBinaryInstalled(): boolean {
try {
execFileSync('claude', ['--version'], { timeout: 5_000, stdio: 'pipe' })
return true
} catch {
return false
}
}
/**
* Check if the `claude` CLI is installed AND authenticated.
*/
export function isClaudeCliReady(): boolean {
try {
execFileSync('claude', ['--version'], { timeout: 5_000, stdio: 'pipe' })
} catch {
return false
}
try {
const output = execFileSync('claude', ['auth', 'status'], { timeout: 5_000, stdio: 'pipe' })
.toString()
.toLowerCase()
return !(/not logged in|no credentials|unauthenticated|not authenticated/i.test(output))
} catch {
return false
}
}