Files
vercel__vercel-plugin/tests/hooks-json-structural.test.ts
John Lindquist b8b233995c feat(skills): broaden trigger patterns for 7 under-injected skills based on eval findings; add next-forge skill; bump to 0.15.0
Eval analysis of 9 real sessions showed 10 skills never triggering despite being
requested. Root causes: pathPatterns too narrow (agents write to lib/email-template.tsx
not emails/), promptSignals containing regex instead of plain text (vercel-sandbox),
and missing promptSignals entirely (v0-dev, vercel-firewall).

Skills updated: email, vercel-queues, edge-runtime, vercel-firewall, chat-sdk,
v0-dev, vercel-sandbox. New skill: next-forge (bootstrap detection).
2026-03-09 17:56:23 -06:00

60 lines
1.4 KiB
TypeScript

/**
* Structural validation: hooks.json contains SubagentStart and SubagentStop
* entries with the expected matchers and timeouts.
*/
import { describe, test, expect } from "bun:test";
import { resolve } from "node:path";
const ROOT = resolve(import.meta.dirname, "..");
interface HookEntry {
type: string;
command: string;
timeout?: number;
}
interface HookGroup {
matcher: string;
hooks: HookEntry[];
}
interface HooksJson {
hooks: Record<string, HookGroup[]>;
}
const hooksJson: HooksJson = await import(resolve(ROOT, "hooks/hooks.json"));
describe("hooks.json SubagentStart", () => {
const groups = hooksJson.hooks.SubagentStart;
test("array exists with at least one entry", () => {
expect(Array.isArray(groups)).toBe(true);
expect(groups.length).toBeGreaterThanOrEqual(1);
});
test("matcher is '.+'", () => {
expect(groups[0].matcher).toBe(".+");
});
test("hook has timeout set to 5", () => {
expect(groups[0].hooks[0].timeout).toBe(5);
});
});
describe("hooks.json SubagentStop", () => {
const groups = hooksJson.hooks.SubagentStop;
test("array exists with at least one entry", () => {
expect(Array.isArray(groups)).toBe(true);
expect(groups.length).toBeGreaterThanOrEqual(1);
});
test("matcher is '.+'", () => {
expect(groups[0].matcher).toBe(".+");
});
test("hook has timeout set to 5", () => {
expect(groups[0].hooks[0].timeout).toBe(5);
});
});