mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 22:21:22 -07:00
fix(pre-commit): improve monorepo handling and failure messaging (#9123)
Co-authored-by: matt korwel <matt.korwel@gmail.com>
This commit is contained in:
22
scripts/pre-commit.js
Normal file
22
scripts/pre-commit.js
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2025 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { execSync } from 'node:child_process';
|
||||
import lintStaged from 'lint-staged';
|
||||
|
||||
try {
|
||||
// Get repository root
|
||||
const root = execSync('git rev-parse --show-toplevel').toString().trim();
|
||||
|
||||
// Run lint-staged with API directly
|
||||
const passed = await lintStaged({ cwd: root });
|
||||
|
||||
// Exit with appropriate code
|
||||
process.exit(passed ? 0 : 1);
|
||||
} catch {
|
||||
// Exit with error code
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user