

























@@ -66,12 +66,16 @@ function createPluginCandidate(params: {
6666packageVersion?: string;
6767packageDir?: string;
6868packageManifest?: OpenClawPackageManifest;
69+format?: PluginCandidate["format"];
70+bundleFormat?: PluginCandidate["bundleFormat"];
6971}): PluginCandidate {
7072return {
7173idHint: params.idHint ?? "demo",
72-source: path.join(params.rootDir, "index.ts"),
74+source: params.format === "bundle" ? params.rootDir : path.join(params.rootDir, "index.ts"),
7375rootDir: params.rootDir,
7476origin: params.origin ?? "global",
77+format: params.format,
78+bundleFormat: params.bundleFormat,
7579packageName: params.packageName,
7680packageVersion: params.packageVersion,
7781packageDir: params.packageDir ?? params.rootDir,
@@ -198,6 +202,39 @@ describe("installed plugin index", () => {
198202expect(index.plugins[0]?.installRecordHash).toBeUndefined();
199203});
200204205+it("keeps bundle format metadata needed for manifest reconstruction", () => {
206+const rootDir = makeTempDir();
207+fs.mkdirSync(path.join(rootDir, ".claude-plugin"), { recursive: true });
208+fs.mkdirSync(path.join(rootDir, "commands"), { recursive: true });
209+fs.writeFileSync(
210+path.join(rootDir, ".claude-plugin", "plugin.json"),
211+JSON.stringify({
212+name: "Claude Bundle",
213+commands: "commands",
214+}),
215+"utf8",
216+);
217+218+const index = loadInstalledPluginIndex({
219+candidates: [
220+createPluginCandidate({
221+ rootDir,
222+idHint: "claude-bundle",
223+format: "bundle",
224+bundleFormat: "claude",
225+}),
226+],
227+env: hermeticEnv(),
228+});
229+230+expect(index.plugins[0]).toMatchObject({
231+pluginId: "claude-bundle",
232+format: "bundle",
233+bundleFormat: "claude",
234+source: rootDir,
235+});
236+});
237+201238it("keeps packageJson paths root-relative when packageDir is reached through a symlink", () => {
202239const fixture = createRichPluginFixture();
203240const linkParent = makeTempDir();
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。