registerAll static method
void
registerAll(})
Register all built-in hooks with the given executor.
This is a convenience method for initialization. The config map
allows customization of individual hooks.
Implementation
static void registerAll(
HookExecutor executor, {
bool Function(String, Map<String, dynamic>)? isPermitted,
bool Function(String)? isInSandbox,
List<String>? allowedPaths,
int maxCallsPerMinute = 60,
void Function(String)? logEntry,
void Function(int, int, double)? onUsage,
Future<void> Function(String, String)? writeBackup,
List<String>? protectedBranches,
void Function(String)? onSecretWarning,
}) {
if (isPermitted != null) {
executor.register(permissionCheckHook(isPermitted: isPermitted));
}
if (isInSandbox != null) {
executor.register(
sandboxEnforcementHook(
allowedPaths: allowedPaths ?? [],
isInSandbox: isInSandbox,
),
);
}
executor.register(rateLimitHook(maxCallsPerMinute: maxCallsPerMinute));
if (logEntry != null) {
executor.register(auditLogHook(logEntry: logEntry));
}
if (onUsage != null) {
executor.register(costTrackingHook(onUsage: onUsage));
}
if (writeBackup != null) {
executor.register(fileBackupHook(writeBackup: writeBackup));
}
executor.register(
gitSafetyHook(protectedBranches: protectedBranches ?? ['main', 'master']),
);
executor.register(secretDetectionHook(onWarning: onSecretWarning));
}