Git Hook Manager for Polyglot Monorepos, developed in house by FatSolutions
npm install @fatsolutions/ganchosGit Hook Manager for Polyglot Monorepos.
``bash`
pnpm add -D @fatsolutions/ganchos
Add your desired languages to package.json:
`json`
{
"ganchos": {
"languages": ["typescript", "python", "cairo"]
}
}
The hooks will be automatically installed on pnpm install via the postinstall bootstrap.
If you prefer manual control, skip the ganchos field in package.json and use the CLI:
`bashEnable languages
pnpm ganchos enable typescript python cairo
CLI Commands
| Command | Description |
|---------|-------------|
|
ganchos install | Install git hooks based on configuration |
| ganchos generate | Generate hook content to stdout (for inspection) |
| ganchos list | List configured and available languages |
| ganchos enable | Enable one or more languages |
| ganchos disable | Disable one or more languages |Supported Languages
- javascript - ESLint, Prettier
- typescript - TypeScript compiler, ESLint, Prettier
- python - Black, isort, flake8, mypy (work in progress)
- cairo - scarb fmt, scarb lint
How It Works
1. Configuration is stored in
.ganchos.json (auto-generated, added to .git/info/exclude)
2. Language-specific hook scripts are located in hooks/pre-commit/
3. On commit, the pre-commit hook runs checks for all enabled languages on staged files
4. Auto-fixable issues (formatting) are fixed automatically; you'll be prompted to review and commit againLanguage-Specific Requirements
$3
- eslint and prettier available via npx$3
- Optional: black, isort, flake8, mypy installed in your environment$3
- scarb installed (installation guide)
- Scarb.toml present in project root or package directoriesMonorepo Support
Ganchos detects
packages/ subdirectories and runs language tools from the appropriate project roots:
- Looks for package.json, tsconfig.json, pyproject.toml, Scarb.toml` in package directoriesContributions are welcome! Feel free to open issues or submit pull requests.
GPL-2.0