mcp-multiagent-bridge/.pre-commit-config.yaml
ggq-admin 9ab9c1a9cc fix: Fix rate limiter initialization bug and add CI/CD
Critical fixes before public release:

1. Rate Limiter Bug Fix:
   - Fixed bucket reset_at initialization
   - Was: datetime.now() (immediately in past)
   - Now: datetime.now() + timedelta (future time)
   - Bug caused bucket to reset on 2nd request
   - Tests now pass: 3/4 passed, 1 skipped, 0 failed

2. Test Suite Improvements:
   - Added proper skip handling for MCP integration test
   - Clear messaging for expected skips in test environments
   - Tests exit with success when no failures (skips are OK)

3. CI/CD Pipeline:
   - .github/workflows/ci.yml - GitHub Actions workflow
   - Security tests, secret scanning, code quality checks
   - Fails fast on security test failures

4. Pre-commit Hooks:
   - .pre-commit-config.yaml for local development
   - Secret detection (detect-secrets)
   - Code quality (ruff, bandit)
   - Prevents token file commits

All security tests now passing. Ready for public release.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 01:15:11 +01:00

49 lines
1.4 KiB
YAML

# Pre-commit hooks for Claude Code Bridge
# Install: pip install pre-commit && pre-commit install
repos:
# Secret detection
- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
hooks:
- id: detect-secrets
args: ['--baseline', '.secrets.baseline']
exclude: package.lock.json
# General file checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: ['--maxkb=500']
- id: check-json
- id: check-merge-conflict
- id: mixed-line-ending
# Python code quality
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
# Python security
- repo: https://github.com/PyCQA/bandit
rev: 1.7.6
hooks:
- id: bandit
args: ['-c', 'pyproject.toml']
additional_dependencies: ['bandit[toml]']
# Additional security checks
- repo: local
hooks:
- id: check-token-files
name: Check for token files
entry: bash -c 'if git diff --cached --name-only | grep -E "\.yolo_tokens\.json|yolo_audit\.log|bridge_audit\.log"; then echo "ERROR: Token/audit files should not be committed!"; exit 1; fi'
language: system
pass_filenames: false