fix(ci): resolve Claude marketplace shortcuts from OS home

This commit is contained in:
Vincent Koc
2026-03-19 09:38:30 -07:00
parent f1e4f8e8d2
commit dcbcecfb85
4 changed files with 77 additions and 6 deletions

View File

@@ -111,7 +111,9 @@ describe("marketplace plugins", () => {
it("resolves Claude-style plugin@marketplace shortcuts from known_marketplaces.json", async () => {
await withTempDir(async (homeDir) => {
const openClawHome = path.join(homeDir, "openclaw-home");
await fs.mkdir(path.join(homeDir, ".claude", "plugins"), { recursive: true });
await fs.mkdir(openClawHome, { recursive: true });
await fs.writeFile(
path.join(homeDir, ".claude", "plugins", "known_marketplaces.json"),
JSON.stringify({
@@ -127,7 +129,7 @@ describe("marketplace plugins", () => {
const { resolveMarketplaceInstallShortcut } = await import("./marketplace.js");
const shortcut = await withEnvAsync(
{ HOME: homeDir },
{ HOME: homeDir, OPENCLAW_HOME: openClawHome },
async () => await resolveMarketplaceInstallShortcut("superpowers@claude-plugins-official"),
);

View File

@@ -2,6 +2,7 @@ import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { resolveArchiveKind } from "../infra/archive.js";
import { resolveOsHomeRelativePath } from "../infra/home-dir.js";
import { runCommandWithTimeout } from "../process/exec.js";
import { resolveUserPath } from "../utils.js";
import { installPluginFromPath, type InstallPluginResult } from "./install.js";
@@ -299,7 +300,7 @@ async function pathExists(target: string): Promise<boolean> {
}
async function readClaudeKnownMarketplaces(): Promise<Record<string, KnownMarketplaceRecord>> {
const knownPath = resolveUserPath(CLAUDE_KNOWN_MARKETPLACES_PATH);
const knownPath = resolveOsHomeRelativePath(CLAUDE_KNOWN_MARKETPLACES_PATH);
if (!(await pathExists(knownPath))) {
return {};
}