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

Method detect

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

Source from the content-addressed store, hash-verified

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