mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-23 02:08:12 +00:00
Plugins: fix env-aware root resolution and caching (#44046)
Merged via squash.
Prepared head SHA: 6e8852a188
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
committed by
GitHub
parent
688e3f0863
commit
e6897c800b
@@ -1,13 +1,9 @@
|
||||
import path from "node:path";
|
||||
import { resolveConfigDir, shortenHomeInString } from "../utils.js";
|
||||
import { resolveBundledPluginsDir } from "./bundled-dir.js";
|
||||
import { shortenHomeInString } from "../utils.js";
|
||||
import type { PluginRecord } from "./registry.js";
|
||||
|
||||
export type PluginSourceRoots = {
|
||||
stock?: string;
|
||||
global?: string;
|
||||
workspace?: string;
|
||||
};
|
||||
import type { PluginSourceRoots } from "./roots.js";
|
||||
export { resolvePluginSourceRoots } from "./roots.js";
|
||||
export type { PluginSourceRoots } from "./roots.js";
|
||||
|
||||
function tryRelative(root: string, filePath: string): string | null {
|
||||
const rel = path.relative(root, filePath);
|
||||
@@ -27,15 +23,6 @@ function tryRelative(root: string, filePath: string): string | null {
|
||||
return rel.replaceAll("\\", "/");
|
||||
}
|
||||
|
||||
export function resolvePluginSourceRoots(params: { workspaceDir?: string }): PluginSourceRoots {
|
||||
const stock = resolveBundledPluginsDir();
|
||||
const global = path.join(resolveConfigDir(), "extensions");
|
||||
const workspace = params.workspaceDir
|
||||
? path.join(params.workspaceDir, ".openclaw", "extensions")
|
||||
: undefined;
|
||||
return { stock, global, workspace };
|
||||
}
|
||||
|
||||
export function formatPluginSourceForTable(
|
||||
plugin: Pick<PluginRecord, "source" | "origin">,
|
||||
roots: PluginSourceRoots,
|
||||
|
||||
Reference in New Issue
Block a user