test(skill-workshop): exercise registered prompt hook

This commit is contained in:
Vincent Koc
2026-04-22 12:02:24 -07:00
parent 3c89f5d537
commit aee9f476c8

View File

@@ -176,6 +176,28 @@ describe("skill-workshop", () => {
expect(logger.info).toHaveBeenCalledWith("skill-workshop: applied animated-gif-workflow");
});
it("emits prompt-build guidance through the registered hook", async () => {
const on = vi.fn();
const api = createTestPluginApi({
pluginConfig: { approvalPolicy: "auto" },
on,
});
plugin.register(api);
const hook = on.mock.calls.find((call) => call[0] === "before_prompt_build")?.[1];
expect(hook).toBeTypeOf("function");
await expect(hook?.({}, {})).resolves.toEqual({
prependSystemContext: expect.stringContaining(
"Auto mode: apply safe workspace-skill updates",
),
});
await expect(hook?.({}, {})).resolves.toEqual({
prependSystemContext: expect.stringContaining("<skill_workshop>"),
});
});
it("lets explicit tool suggestions stay pending in auto mode", async () => {
const workspaceDir = await makeTempDir();
const stateDir = await makeTempDir();