MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / detect

Method detect

src/installer/targets/opencode.ts:161–173  ·  view source on GitHub ↗
(loc: Location)

Source from the content-addressed store, hash-verified

159 }
160
161 detect(loc: Location): DetectionResult {
162 const file = configPath(loc);
163 const config = parseConfig(readConfigText(file));
164 const alreadyConfigured = hasCodegraphEntry(config);
165 // Global: the XDG dir is what current opencode creates on first run; the
166 // legacy %APPDATA% dir still counts as "opencode present" so a re-install
167 // can sweep the stale pre-#535 entry out of it.
168 const legacy = legacyWindowsConfigDir();
169 const installed = loc === 'global'
170 ? fs.existsSync(globalConfigDir()) || (!!legacy && fs.existsSync(legacy))
171 : fs.existsSync(file);
172 return { installed, alreadyConfigured, configPath: file };
173 }
174
175 install(loc: Location, _opts: InstallOptions): WriteResult {
176 const files: WriteResult['files'] = [];

Callers

nothing calls this directly

Calls 6

hasCodegraphEntryFunction · 0.85
legacyWindowsConfigDirFunction · 0.85
configPathFunction · 0.70
parseConfigFunction · 0.70
readConfigTextFunction · 0.70
globalConfigDirFunction · 0.70

Tested by

no test coverage detected