MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / detectVcs

Function detectVcs

source code/utils/platform.ts:131–152  ·  view source on GitHub ↗
(dir?: string)

Source from the content-addressed store, hash-verified

129]
130
131export async function detectVcs(dir?: string): Promise<string[]> {
132 const detected = new Set<string>()
133
134 // Check for Perforce via env var
135 if (process.env.P4PORT) {
136 detected.add('perforce')
137 }
138
139 try {
140 const targetDir = dir ?? getFsImplementation().cwd()
141 const entries = new Set(await readdir(targetDir))
142 for (const [marker, vcs] of VCS_MARKERS) {
143 if (entries.has(marker)) {
144 detected.add(vcs)
145 }
146 }
147 } catch {
148 // Directory may not be readable
149 }
150
151 return [...detected]
152}

Callers 1

metadata.tsFile · 0.85

Calls 4

getFsImplementationFunction · 0.85
readdirFunction · 0.85
addMethod · 0.45
hasMethod · 0.45

Tested by

no test coverage detected