Skip to content

Commit 46c15fb

Browse files
committed
refactor(plugins): remove stale install planner exports
1 parent ef440b5 commit 46c15fb

4 files changed

Lines changed: 20 additions & 66 deletions

File tree

‎src/cli/non-clawhub-install-acknowledgement.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import type { RuntimeEnv } from "../runtime.js";
88
import { promptYesNo } from "./prompt.js";
99

1010
export {
11-
formatNonClawHubInstallWarning,
1211
NON_CLAWHUB_INSTALL_FORCE_FLAG,
1312
type NonClawHubInstallSourceClass,
1413
} from "../plugins/install-provenance.js";

‎src/cli/plugin-install-plan.test.ts‎

Lines changed: 18 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
import { installedPluginRoot } from "openclaw/plugin-sdk/test-fixtures";
33
import { describe, expect, it, vi } from "vitest";
44
import { PLUGIN_INSTALL_ERROR_CODE } from "../plugins/install.js";
5+
import {
6+
resolveCatalogOfficialExternalInstallPlan,
7+
resolveCatalogOfficialExternalNpmPackageTrust,
8+
} from "../plugins/official-external-install-trust.js";
59
import {
610
resolveBundledInstallPlanForCatalogEntry,
711
resolveBundledInstallPlanBeforeNpm,
812
resolveBundledInstallPlanForNpmFailure,
9-
resolveOfficialExternalInstallPlanBeforeNpm,
10-
resolveOfficialExternalNpmPackageTrust,
1113
} from "./plugin-install-plan.js";
1214

1315
describe("plugin install plan helpers", () => {
@@ -70,81 +72,39 @@ describe("plugin install plan helpers", () => {
7072
});
7173

7274
it("resolves exact official external plugin ids before npm fallback", () => {
73-
const findOfficialExternalPlugin = vi.fn().mockReturnValue({
74-
pluginId: "brave",
75-
npmSpec: "@openclaw/brave-plugin",
76-
expectedIntegrity: "sha512-brave",
77-
});
75+
const result = resolveCatalogOfficialExternalInstallPlan("wecom-openclaw-plugin");
7876

79-
const result = resolveOfficialExternalInstallPlanBeforeNpm({
80-
rawSpec: "brave",
81-
findOfficialExternalPlugin,
82-
});
83-
84-
expect(findOfficialExternalPlugin).toHaveBeenCalledWith("brave");
8577
expect(result).toEqual({
86-
pluginId: "brave",
87-
npmSpec: "@openclaw/brave-plugin",
88-
expectedIntegrity: "sha512-brave",
78+
pluginId: "wecom-openclaw-plugin",
79+
npmSpec: "@wecom/[email protected]",
80+
expectedIntegrity:
81+
"sha512-TCkP9as00WfEhgFWG8YL/rcmaWGIshAki2HQh83nTRccGfVBCoGjrEboTTqq3yDmK9koWTV11zi8u8A4dNtvug==",
8982
});
9083
});
9184

9285
it("skips official external plan for explicit npm selectors", () => {
93-
const findOfficialExternalPlugin = vi.fn();
94-
86+
expect(resolveCatalogOfficialExternalInstallPlan("wecom-openclaw-plugin@beta")).toBeNull();
9587
expect(
96-
resolveOfficialExternalInstallPlanBeforeNpm({
97-
rawSpec: "brave@beta",
98-
findOfficialExternalPlugin,
99-
}),
88+
resolveCatalogOfficialExternalInstallPlan("@wecom/[email protected]"),
10089
).toBeNull();
101-
expect(
102-
resolveOfficialExternalInstallPlanBeforeNpm({
103-
rawSpec: "@openclaw/brave-plugin",
104-
findOfficialExternalPlugin,
105-
}),
106-
).toBeNull();
107-
expect(findOfficialExternalPlugin).not.toHaveBeenCalled();
108-
});
109-
110-
it("skips official external plan without an npm install spec", () => {
111-
const result = resolveOfficialExternalInstallPlanBeforeNpm({
112-
rawSpec: "brave",
113-
findOfficialExternalPlugin: vi.fn().mockReturnValue({
114-
pluginId: "brave",
115-
}),
116-
});
117-
118-
expect(result).toBeNull();
11990
});
12091

12192
it("trusts exact official external npm packages without remapping the spec", () => {
122-
const findOfficialExternalPackage = vi.fn().mockReturnValue({
123-
pluginId: "discord",
124-
npmSpec: "@openclaw/discord",
125-
});
93+
const result = resolveCatalogOfficialExternalNpmPackageTrust(
94+
95+
);
12696

127-
const result = resolveOfficialExternalNpmPackageTrust({
128-
npmSpec: "@openclaw/discord",
129-
findOfficialExternalPackage,
130-
});
131-
132-
expect(findOfficialExternalPackage).toHaveBeenCalledWith("@openclaw/discord");
13397
expect(result).toEqual({
134-
pluginId: "discord",
98+
pluginId: "wecom-openclaw-plugin",
99+
expectedIntegrity:
100+
"sha512-TCkP9as00WfEhgFWG8YL/rcmaWGIshAki2HQh83nTRccGfVBCoGjrEboTTqq3yDmK9koWTV11zi8u8A4dNtvug==",
135101
trustedSourceLinkedOfficialInstall: true,
136102
});
137103
});
138104

139105
it("does not trust npm package names outside the official external catalog", () => {
140-
const findOfficialExternalPackage = vi.fn();
141-
142-
const result = resolveOfficialExternalNpmPackageTrust({
143-
npmSpec: "brave",
144-
findOfficialExternalPackage,
145-
});
106+
const result = resolveCatalogOfficialExternalNpmPackageTrust("@acme/[email protected]");
146107

147-
expect(findOfficialExternalPackage).toHaveBeenCalledWith("brave");
148108
expect(result).toBeNull();
149109
});
150110

‎src/cli/plugin-install-plan.ts‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ type BundledLookup = (params: {
99
value: string;
1010
}) => BundledPluginSource | undefined;
1111

12-
export {
13-
resolveOfficialExternalInstallPlanBeforeNpm,
14-
resolveOfficialExternalNpmPackageTrust,
15-
} from "../plugins/official-external-install-trust.js";
16-
1712
function isBareNpmPackageName(spec: string): boolean {
1813
const trimmed = spec.trim();
1914
return /^[a-z0-9][a-z0-9-._~]*$/.test(trimmed);

‎src/plugins/official-external-install-trust.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function resolveCatalogInstall(value: string, lookup: "package" | "plugin") {
4848
};
4949
}
5050

51-
export function resolveOfficialExternalInstallPlanBeforeNpm(params: {
51+
function resolveOfficialExternalInstallPlanBeforeNpm(params: {
5252
rawSpec: string;
5353
findOfficialExternalPlugin: OfficialExternalPluginLookup;
5454
}): { pluginId: string; npmSpec: string; expectedIntegrity?: string } | null {
@@ -67,7 +67,7 @@ export function resolveOfficialExternalInstallPlanBeforeNpm(params: {
6767
};
6868
}
6969

70-
export function resolveOfficialExternalNpmPackageTrust(params: {
70+
function resolveOfficialExternalNpmPackageTrust(params: {
7171
npmSpec: string;
7272
findOfficialExternalPackage: OfficialExternalPackageLookup;
7373
}): {

0 commit comments

Comments
 (0)