- Removed Prettier configuration files (.prettierignore and .prettierrc) and migrated formatting to Biome. - Updated Biome configuration from version 2.3.11 to 2.3.12 and changed arrowParentheses rule from 'always' to 'asNeeded'. - Pinned @biomejs/biome dependency to exact version 2.3.12 in package.json and bun.lock. - Applied consistent arrow function formatting across 489 files by removing unnecessary parentheses around single parameters. - Removed blank lines after comment blocks and reorganized imports for consistency across the codebase.
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
/**
|
|
* Hooks Capability
|
|
*
|
|
* Pre/post tool execution hooks defined as shell scripts.
|
|
*/
|
|
import { defineCapability } from ".";
|
|
import type { SourceMeta } from "./types";
|
|
|
|
/**
|
|
* A hook script.
|
|
*/
|
|
export interface Hook {
|
|
/** Hook name (filename without extension) */
|
|
name: string;
|
|
/** Absolute path to hook file */
|
|
path: string;
|
|
/** Hook type (pre/post) and associated tool */
|
|
type: "pre" | "post";
|
|
/** Tool this hook applies to, or "*" for all */
|
|
tool: string;
|
|
/** Source level */
|
|
level: "user" | "project";
|
|
/** Source metadata */
|
|
_source: SourceMeta;
|
|
}
|
|
|
|
export const hookCapability = defineCapability<Hook>({
|
|
id: "hooks",
|
|
displayName: "Hooks",
|
|
description: "Pre/post tool execution hooks",
|
|
key: hook => `${hook.type}:${hook.tool}:${hook.name}`,
|
|
validate: hook => {
|
|
if (!hook.name) return "Missing name";
|
|
if (!hook.path) return "Missing path";
|
|
if (hook.type !== "pre" && hook.type !== "post") return "Invalid type (must be 'pre' or 'post')";
|
|
if (!hook.tool) return "Missing tool";
|
|
return undefined;
|
|
},
|
|
});
|