feat(cli): unify hook pack installs under plugins

This commit is contained in:
Peter Steinberger
2026-03-22 11:19:07 -07:00
parent b44152fcc8
commit aa80b1eb7c
8 changed files with 740 additions and 400 deletions

View File

@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
import type { HookStatusReport } from "../hooks/hooks-status.js";
import { formatHooksCheck, formatHooksList } from "./hooks-cli.js";
import { formatHookInfo, formatHooksCheck, formatHooksList } from "./hooks-cli.js";
import { createEmptyInstallChecks } from "./requirements-test-fixtures.js";
const report: HookStatusReport = {
@@ -73,4 +73,37 @@ describe("hooks cli formatting", () => {
const output = formatHooksList(pluginReport, {});
expect(output).toContain("plugin:voice-call");
});
it("shows plugin-managed details in hook info", () => {
const pluginReport: HookStatusReport = {
workspaceDir: "/tmp/workspace",
managedHooksDir: "/tmp/hooks",
hooks: [
{
name: "plugin-hook",
description: "Hook from plugin",
source: "openclaw-plugin",
pluginId: "voice-call",
filePath: "/tmp/hooks/plugin-hook/HOOK.md",
baseDir: "/tmp/hooks/plugin-hook",
handlerPath: "/tmp/hooks/plugin-hook/handler.js",
hookKey: "plugin-hook",
emoji: "🔗",
homepage: undefined,
events: ["command:new"],
always: false,
enabledByConfig: true,
requirementsSatisfied: true,
loadable: true,
blockedReason: undefined,
managedByPlugin: true,
...createEmptyInstallChecks(),
},
],
};
const output = formatHookInfo(pluginReport, "plugin-hook", {});
expect(output).toContain("voice-call");
expect(output).toContain("Managed by plugin");
});
});