()
| 607 | const getConfigPath = () => getPaths().current; |
| 608 | |
| 609 | const getSearchRoots = () => { |
| 610 | const roots = []; |
| 611 | |
| 612 | // 1. Directory of the currently active config |
| 613 | const configPath = getConfigPath(); |
| 614 | if (configPath) roots.push(path.dirname(configPath)); |
| 615 | |
| 616 | // 2. Current Working Directory |
| 617 | roots.push(process.cwd()); |
| 618 | |
| 619 | // 3. XDG Config Home |
| 620 | const xdg = process.env.XDG_CONFIG_HOME; |
| 621 | if (xdg) roots.push(path.join(xdg, 'opencode')); |
| 622 | |
| 623 | // 4. Home config |
| 624 | roots.push(path.join(HOME_DIR, '.config', 'opencode')); |
| 625 | |
| 626 | // 5. Home dotfile |
| 627 | roots.push(path.join(HOME_DIR, '.opencode')); |
| 628 | |
| 629 | // 6. Local share |
| 630 | roots.push(path.join(HOME_DIR, '.local', 'share', 'opencode')); |
| 631 | |
| 632 | // 7. Windows AppData |
| 633 | if (process.platform === 'win32' && process.env.APPDATA) { |
| 634 | roots.push(path.join(process.env.APPDATA, 'opencode')); |
| 635 | } |
| 636 | |
| 637 | // Filter nulls, duplicates and normalize |
| 638 | const unique = [...new Set(roots.filter(Boolean).map(p => path.resolve(p)))]; |
| 639 | return unique; |
| 640 | }; |
| 641 | |
| 642 | const getSkillDirs = () => { |
| 643 | const roots = getSearchRoots(); |
no test coverage detected