feat: unify hooks installs and webhooks
This commit is contained in:
@@ -79,6 +79,16 @@ export type HookConfig = {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
|
||||
export type HookInstallRecord = {
|
||||
source: "npm" | "archive" | "path";
|
||||
spec?: string;
|
||||
sourcePath?: string;
|
||||
installPath?: string;
|
||||
version?: string;
|
||||
installedAt?: string;
|
||||
hooks?: string[];
|
||||
};
|
||||
|
||||
export type InternalHooksConfig = {
|
||||
/** Enable internal hooks system */
|
||||
enabled?: boolean;
|
||||
@@ -91,6 +101,8 @@ export type InternalHooksConfig = {
|
||||
/** Additional hook directories to scan */
|
||||
extraDirs?: string[];
|
||||
};
|
||||
/** Install records for hook packs or hooks */
|
||||
installs?: Record<string, HookInstallRecord>;
|
||||
};
|
||||
|
||||
export type HooksConfig = {
|
||||
|
||||
@@ -54,6 +54,18 @@ const HookConfigSchema = z
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
const HookInstallRecordSchema = z
|
||||
.object({
|
||||
source: z.union([z.literal("npm"), z.literal("archive"), z.literal("path")]),
|
||||
spec: z.string().optional(),
|
||||
sourcePath: z.string().optional(),
|
||||
installPath: z.string().optional(),
|
||||
version: z.string().optional(),
|
||||
installedAt: z.string().optional(),
|
||||
hooks: z.array(z.string()).optional(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
export const InternalHooksSchema = z
|
||||
.object({
|
||||
enabled: z.boolean().optional(),
|
||||
@@ -64,6 +76,7 @@ export const InternalHooksSchema = z
|
||||
extraDirs: z.array(z.string()).optional(),
|
||||
})
|
||||
.optional(),
|
||||
installs: z.record(z.string(), HookInstallRecordSchema).optional(),
|
||||
})
|
||||
.optional();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user