openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
39 lines (38 loc) • 1.8 kB
JavaScript
import { m as normalizeTrimmedStringList } from "./string-normalization-DLmfYZXI.mjs";
import { t as canAccess } from "./path-existence-Co7-GyVr.mjs";
import "./openclaw-state-db-ARhwdPJg.mjs";
import "./uninstall-config-B_oarBnH.mjs";
import "./model-reference-inventory-Wy_hgz6X.mjs";
import path from "node:path";
//#region src/infra/plugin-install-path-warnings.ts
async function detectPluginInstallPathIssue(e) {
if (e.install?.source !== "path") return null;
const t = normalizeTrimmedStringList([e.install.sourcePath, e.install.installPath]);
if (t.length === 0) return null;
for (const n of t) if (await canAccess(path.resolve(n))) return {
kind: "custom-path",
pluginId: e.pluginId,
path: n
};
return {
kind: "missing-path",
pluginId: e.pluginId,
path: t[0] ?? "(unknown)"
};
}
function formatPluginInstallPathIssue(e) {
const t = e.formatCommand ?? ((e) => e);
if (e.issue.kind === "custom-path") return [
`${e.pluginLabel} is installed from a custom path: ${e.issue.path}`,
`Main updates will not automatically replace that plugin with the repo's default ${e.pluginLabel} package.`,
`Reinstall with "${t(e.defaultInstallCommand)}" when you want to return to the standard ${e.pluginLabel} plugin.`,
...e.repoInstallCommand ? [`If you are intentionally running from a repo checkout, reinstall that checkout explicitly with "${t(e.repoInstallCommand)}" after updates.`] : []
];
return [
`${e.pluginLabel} is installed from a custom path that no longer exists: ${e.issue.path}`,
`Reinstall with "${t(e.defaultInstallCommand)}".`,
...e.repoInstallCommand ? [`If you are running from a repo checkout, you can also use "${t(e.repoInstallCommand)}".`] : []
];
}
//#endregion
export { formatPluginInstallPathIssue as n, detectPluginInstallPathIssue as t };