



















@@ -1,6 +1,6 @@
11import { execFileSync } from "node:child_process";
2-import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
3-import { join } from "node:path";
2+import { chmodSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
3+import { delimiter, join } from "node:path";
44import { afterEach, describe, expect, it } from "vitest";
55import {
66collectClawHubPublishablePluginPackages,
@@ -362,6 +362,41 @@ describe("collectPluginClawHubReleasePlan", () => {
362362});
363363});
364364365+describe("plugin-clawhub-publish.sh", () => {
366+it("previews the publish command through the ClawHub CLI dry-run preflight", () => {
367+const repoDir = createTempPluginRepo();
368+const binDir = join(repoDir, "bin");
369+const markerPath = join(repoDir, "clawhub-invoked");
370+mkdirSync(binDir, { recursive: true });
371+const clawhubPath = join(binDir, "clawhub");
372+writeFileSync(
373+clawhubPath,
374+`#!/usr/bin/env bash\nprintf '%s\\n' "$@" > ${JSON.stringify(markerPath)}\nexit 0\n`,
375+);
376+chmodSync(clawhubPath, 0o755);
377+378+const output = execFileSync(
379+"bash",
380+[
381+join(process.cwd(), "scripts/plugin-clawhub-publish.sh"),
382+"--dry-run",
383+"extensions/demo-plugin",
384+],
385+{
386+cwd: repoDir,
387+encoding: "utf8",
388+env: {
389+ ...process.env,
390+PATH: `${binDir}${delimiter}${process.env.PATH ?? ""}`,
391+},
392+},
393+);
394+395+expect(output).toContain("Publish command: CLAWHUB_WORKDIR=");
396+expect(readFileSync(markerPath, "utf8")).toContain("--dry-run");
397+});
398+});
399+365400describe("collectPluginClawHubReleasePathsFromGitRange", () => {
366401it("rejects unsafe git refs", () => {
367402const repoDir = createTempPluginRepo();
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。