| 39 | } |
| 40 | |
| 41 | function findPiPackageRoot() { |
| 42 | let directory = path.dirname(fileURLToPath(import.meta.url)) |
| 43 | |
| 44 | while (true) { |
| 45 | const candidate = path.join(directory, piPackagePath) |
| 46 | if (fs.existsSync(path.join(candidate, 'package.json'))) { |
| 47 | return candidate |
| 48 | } |
| 49 | const parent = path.dirname(directory) |
| 50 | if (parent === directory) { |
| 51 | throw new Error('Could not locate @earendil-works/pi-coding-agent package root.') |
| 52 | } |
| 53 | directory = parent |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | async function getThemeHelpers() { |
| 58 | if (!themeHelpersPromise) { |