setHooksDir method

Future<bool> setHooksDir()

Points Git at the managed shim directory (hooks/_), husky-style.

Uses a project-relative path so clones work without re-configuring absolute paths. User sources stay in hooks/*.dart|*.sh; Git never writes into .git/hooks.

Implementation

Future<bool> setHooksDir() async {
  final result = await process.run('git', [
    'config',
    '--local',
    'core.hooksPath',
    'hooks/_',
  ]);

  if (result.exitCode != 0) {
    logger
      ..err('Failed to set hooks directory')
      ..detail('Error: ${result.stderr}');

    return false;
  }

  return true;
}