mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-02-01 14:44:29 +00: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:
@@ -1 +1,9 @@
|
||||
npm run pre-commit
|
||||
npm run pre-commit || {
|
||||
echo ''
|
||||
echo '===================================================='
|
||||
echo 'pre-commit checks failed. in case of emergency, run:'
|
||||
echo ''
|
||||
echo 'git commit --no-verify'
|
||||
echo '===================================================='
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
"telemetry": "node scripts/telemetry.js",
|
||||
"check:lockfile": "node scripts/check-lockfile.js",
|
||||
"clean": "node scripts/clean.js",
|
||||
"pre-commit": "lint-staged"
|
||||
"pre-commit": "node scripts/pre-commit.js"
|
||||
},
|
||||
"bin": {
|
||||
"gemini": "bundle/gemini.js"
|
||||
|
||||
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