DevOps
laravel-git
Handles git operations including smart commits and releases
Overview
The laravel-git agent handles all Git-related operations with Laravel-aware intelligence. It generates meaningful commit messages, performs security reviews before commits, creates releases with auto-generated changelogs, and manages branching strategies.
Responsibilities
- Smart Commits - Analyze changes and generate descriptive messages
- Security Review - Scan staged changes for sensitive data
- Release Management - Create tags and generate changelogs
- PR Descriptions - Auto-generate pull request summaries
- Branch Management - Follow conventional branch naming
- Sensitive File Detection - Prevent committing secrets
Commit Message Generation
The agent analyzes staged changes and generates conventional commit messages:
# Agent analyzes these patterns:
# - New files → "feat: add X"
# - Modified files → "update X" or "fix X" or "refactor X"
# - Deleted files → "remove X"
# - Test files → "test: add tests for X"
# - Config files → "chore: update configuration"
# Example generated commits:
feat(auth): add two-factor authentication support
- Add TwoFactorController for TOTP management
- Create migration for two_factor_secrets table
- Add TwoFactorAuthentication trait to User model
- Include QR code generation for authenticator apps
fix(orders): resolve race condition in stock reservation
- Add database lock during stock check
- Use transactions for atomic updates
- Add retry logic for deadlock scenarios
Security Review Process
┌─────────────────────────────────────────────────────────────┐
│ Pre-Commit Security Review │
├─────────────────────────────────────────────────────────────┤
│ 1. Scan Staged Files │
│ → Check for .env files │
│ → Look for credentials.json, secrets.yaml │
│ → Detect hardcoded API keys/tokens │
├─────────────────────────────────────────────────────────────┤
│ 2. Pattern Detection │
│ → AWS_SECRET_ACCESS_KEY patterns │
│ → Database connection strings │
│ → JWT secrets, encryption keys │
│ → Private keys (RSA, SSH) │
├─────────────────────────────────────────────────────────────┤
│ 3. Warning & Blocking │
│ → Warn on suspicious patterns │
│ → Block commits with confirmed secrets │
│ → Suggest .gitignore updates │
└─────────────────────────────────────────────────────────────┘
Patterns Detected
// Patterns the agent scans for:
$sensitivePatterns = [
// API Keys
'/(?:api[_-]?key|apikey)\s*[=:]\s*["\']?[\w-]{20,}/i',
// AWS Credentials
'/AKIA[0-9A-Z]{16}/',
'/aws[_-]?secret[_-]?access[_-]?key/i',
// Database URLs
'/(?:mysql|postgres|mongodb):\/\/[^:]+:[^@]+@/',
// Private Keys
'/-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----/',
// Laravel Specific
'/APP_KEY=base64:[A-Za-z0-9+\/=]{43,}/',
'/MAIL_PASSWORD=["\']?[^"\'\s]+/',
'/DB_PASSWORD=["\']?[^"\'\s]+/',
];
// Files always blocked from commits
$blockedFiles = [
'.env',
'.env.local',
'.env.production',
'credentials.json',
'service-account.json',
'*.pem',
'*.key',
'id_rsa',
];
Release Management
# Agent generates changelog from commits since last tag
# Groups by type: Features, Fixes, Breaking Changes
# Example generated release:
git tag -a v2.1.0 -m "Release v2.1.0
## What's New
### Features
- Add two-factor authentication (#142)
- Implement webhook retry mechanism (#156)
- Add bulk export functionality (#161)
### Bug Fixes
- Fix timezone handling in scheduled jobs (#158)
- Resolve N+1 query in dashboard (#163)
### Breaking Changes
- Remove deprecated PaymentGateway class (#165)
- Require PHP 8.2+ (#167)
Full Changelog: https://github.com/org/repo/compare/v2.0.0...v2.1.0"
PR Description Generation
# Agent analyzes commits in branch and generates:
gh pr create --title "feat(auth): Add two-factor authentication" --body "
## Summary
Implements TOTP-based two-factor authentication for enhanced account security.
## Changes
- Add TwoFactorController with enable/disable/verify endpoints
- Create two_factor_secrets migration
- Add TwoFactorAuthentication trait to User model
- Include QR code generation using BaconQrCode
## Test Plan
- [ ] Enable 2FA and scan QR code with authenticator app
- [ ] Verify login requires 2FA code when enabled
- [ ] Test recovery codes work correctly
- [ ] Verify 2FA can be disabled
## Screenshots
[If applicable]
---
Generated with Laravel Agent
"
Invoked By Commands
- /laravel-agent:git:commit - Smart commit with security review
- /laravel-agent:git:pr - Create pull request
- /laravel-agent:git:release - Create release with changelog
Guardrails
The git agent follows strict rules:
- ALWAYS scan for secrets before committing
- ALWAYS use conventional commit messages
- ALWAYS include ticket references when available
- NEVER commit .env or credential files
- NEVER force push to main/master branches
- NEVER update git config without user consent
See Also
- laravel-cicd - CI/CD pipeline setup
- laravel-review - Code review agent