Add Bun language support

Implements Bun as a new language option for pre-commit hooks, enabling
hooks to run using the Bun JavaScript runtime and package manager.

- Add bun.py language implementation with binary download/install
- Support system-installed Bun or automatic version download
- Add comprehensive tests including version handling and hook execution
- Register bun in all_languages.py
- Include test repository fixture for integration tests
This commit is contained in:
Matan Shavit 2025-10-28 21:15:51 -04:00
parent 65175f3cf3
commit ae5018d3e5
No known key found for this signature in database
GPG key ID: 2093205717EFF8A5
6 changed files with 366 additions and 0 deletions

View file

@ -0,0 +1,5 @@
- id: test-bun-hook
name: Test Bun Hook
entry: test-bun-hook
language: bun
files: \.txt$

View file

@ -0,0 +1,16 @@
#!/usr/bin/env node
// Simple test hook that validates file content
const fs = require('fs');
const files = process.argv.slice(2);
let failed = false;
files.forEach(file => {
const content = fs.readFileSync(file, 'utf8');
if (content.includes('bad')) {
console.error(`Error in ${file}: contains 'bad'`);
failed = true;
}
});
process.exit(failed ? 1 : 0);

View file

@ -0,0 +1,7 @@
{
"name": "test-bun-hook",
"version": "1.0.0",
"bin": {
"test-bun-hook": "./bin/test-hook.js"
}
}