4 Commits

  • refactor: deduplicate config lists and unify resolveFormatterBin branches
    Extract BIOME_CONFIGS and PRETTIER_CONFIGS as shared constants to eliminate
    duplication between PROJECT_ROOT_MARKERS and detectFormatter(). Unify the
    biome/prettier branches in resolveFormatterBin() via a FORMATTER_PACKAGES
    map. Remove redundant path.resolve() in quality-gate.js.
  • fix(hooks): add Windows .cmd support with shell injection guard
    Handle Windows .cmd shim resolution via spawnSync with strict path
    validation. Removes shell:true injection risk, uses strict equality,
    and restores .cmd support with path injection guard.
  • perf(hooks): use direct require() instead of spawning child process
    Invoke hook scripts directly via require() when they export a
    run(rawInput) function, eliminating one Node.js process spawn per
    hook invocation (~50-100ms).
    
    Includes path traversal guard, timeouts, error logging, PR review
    feedback, legacy hooks guard, normalized filePath, and restored
    findProjectRoot config detection with package manager support.
  • feat(hooks): add shared resolve-formatter utility with caching
    Extract project-root discovery, formatter detection, and binary
    resolution into a reusable module. Caches results per-process to
    avoid redundant filesystem lookups on every Edit hook invocation.
    
    This is the foundation for eliminating npx overhead in format hooks.