MCPcopy
hub / github.com/codeaashu/claude-code / detectVcs

Function detectVcs

src/utils/platform.ts:129–150  ·  view source on GitHub ↗
(dir?: string)

Source from the content-addressed store, hash-verified

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

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