fix: locate codex plugin from platform binary

This commit is contained in:
YeonGyu-Kim
2026-05-31 00:01:34 +09:00
parent 25d75be6db
commit 64db15a6ac
2 changed files with 23 additions and 3 deletions
+6 -2
View File
@@ -196,15 +196,19 @@ function codexMarketplaceSource(marketplaceRoot: string): CodexMarketplaceSource
return { sourceType: "local", source: marketplaceRoot }
}
function findRepoRootFromImporter(importerDir: string): string {
export function findRepoRootFromImporter(importerDir: string): string {
let current = importerDir
for (let depth = 0; depth <= 5; depth += 1) {
const pluginManifestPath = join(current, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json")
if (existsSyncLike(pluginManifestPath)) return current
for (const wrapperPackageRoot of [join(current, "node_modules", "oh-my-openagent"), join(current, "oh-my-openagent")]) {
const wrapperPluginManifestPath = join(wrapperPackageRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json")
if (existsSyncLike(wrapperPluginManifestPath)) return wrapperPackageRoot
}
current = resolve(current, "..")
}
throw new Error(
"Unable to locate vendored Codex plugin: expected packages/omo-codex/plugin/.codex-plugin/plugin.json within 5 parent levels",
"Unable to locate vendored Codex plugin: expected packages/omo-codex/plugin/.codex-plugin/plugin.json in this package or sibling oh-my-openagent package within 5 parent levels",
)
}