feat: support plugin-managed hooks

This commit is contained in:
Peter Steinberger
2026-01-18 05:56:59 +00:00
parent 88b37e80fc
commit e2c10a2b7a
16 changed files with 436 additions and 26 deletions

View File

@@ -10,6 +10,7 @@ const report: HookStatusReport = {
name: "session-memory",
description: "Save session context to memory",
source: "clawdbot-bundled",
pluginId: undefined,
filePath: "/tmp/hooks/session-memory/HOOK.md",
baseDir: "/tmp/hooks/session-memory",
handlerPath: "/tmp/hooks/session-memory/handler.js",
@@ -20,6 +21,7 @@ const report: HookStatusReport = {
always: false,
disabled: false,
eligible: true,
managedByPlugin: false,
requirements: {
bins: [],
anyBins: [],
@@ -51,4 +53,49 @@ describe("hooks cli formatting", () => {
const output = formatHooksCheck(report, {});
expect(output).toContain("Hooks Status");
});
it("labels plugin-managed hooks with plugin id", () => {
const pluginReport: HookStatusReport = {
workspaceDir: "/tmp/workspace",
managedHooksDir: "/tmp/hooks",
hooks: [
{
name: "plugin-hook",
description: "Hook from plugin",
source: "clawdbot-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,
disabled: false,
eligible: true,
managedByPlugin: true,
requirements: {
bins: [],
anyBins: [],
env: [],
config: [],
os: [],
},
missing: {
bins: [],
anyBins: [],
env: [],
config: [],
os: [],
},
configChecks: [],
install: [],
},
],
};
const output = formatHooksList(pluginReport, {});
expect(output).toContain("plugin:voice-call");
});
});