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

Method detect

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

Source from the content-addressed store, hash-verified

135 }
136
137 detect(loc: Location): DetectionResult {
138 const file = configPath(loc);
139 const config = parseConfig(readConfigText(file));
140 const alreadyConfigured = !!config.mcp?.codegraph;
141 // Global: the XDG dir is what current opencode creates on first run; the
142 // legacy %APPDATA% dir still counts as "opencode present" so a re-install
143 // can sweep the stale pre-#535 entry out of it.
144 const legacy = legacyWindowsConfigDir();
145 const installed = loc === 'global'
146 ? fs.existsSync(globalConfigDir()) || (!!legacy && fs.existsSync(legacy))
147 : fs.existsSync(file);
148 return { installed, alreadyConfigured, configPath: file };
149 }
150
151 install(loc: Location, _opts: InstallOptions): WriteResult {
152 const files: WriteResult['files'] = [];

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected