fix: locate codex plugin from platform binary
This commit is contained in:
@@ -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",
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user