()
| 554 | }; |
| 555 | |
| 556 | const getPaths = () => { |
| 557 | const platform = process.platform; |
| 558 | const home = os.homedir(); |
| 559 | let candidates = [ |
| 560 | path.join(home, '.config', 'opencode', 'opencode.json'), |
| 561 | path.join(home, '.local', 'share', 'opencode', 'opencode.json'), |
| 562 | path.join(home, '.opencode', 'opencode.json'), |
| 563 | ]; |
| 564 | if (platform === 'win32') { |
| 565 | candidates.push(path.join(process.env.APPDATA, 'opencode', 'opencode.json')); |
| 566 | } |
| 567 | |
| 568 | if (platform === 'win32') { |
| 569 | const distros = getWslDistributions(); |
| 570 | for (const distro of distros) { |
| 571 | candidates.push(`\\\\wsl$\\${distro}\\home\\${os.userInfo().username}\\.config\\opencode\\opencode.json`); |
| 572 | } |
| 573 | } |
| 574 | |
| 575 | const studioConfig = loadStudioConfig(); |
| 576 | let manualPath = studioConfig.configPath; |
| 577 | |
| 578 | if (manualPath && fs.existsSync(manualPath) && fs.statSync(manualPath).isDirectory()) { |
| 579 | const potentialFile = path.join(manualPath, 'opencode.json'); |
| 580 | if (fs.existsSync(potentialFile)) { |
| 581 | manualPath = potentialFile; |
| 582 | } |
| 583 | } |
| 584 | |
| 585 | let detected = null; |
| 586 | for (const p of candidates) { |
| 587 | if (fs.existsSync(p)) { |
| 588 | detected = p; |
| 589 | break; |
| 590 | } |
| 591 | } |
| 592 | |
| 593 | return { |
| 594 | detected, |
| 595 | manual: manualPath, |
| 596 | current: manualPath || detected, |
| 597 | candidates: [...new Set(candidates)] |
| 598 | }; |
| 599 | }; |
| 600 | |
| 601 | const getOhMyOpenCodeConfigPath = () => { |
| 602 | const cp = getConfigPath(); |
no test coverage detected