--changed flag scans only files that have been modified, staged, or added in your git repository. This dramatically speeds up scans in development workflows and CI pipelines.
Quick Start
Scan only git-changed files:- Staged files: Changes added with
git add - Unstaged files: Modified but not yet staged
- Untracked files: New files not yet committed
How It Works
Git Integration
Aguara runs these git commands to detect changes:Fallback for New Repos
In repositories with no commits yet (e.g.,git init but no git commit):
No Git? No Problem
If git is not installed or the directory is not a git repository:--changedis silently ignored- Aguara scans all files (standard behavior)
- No error is thrown
Use Cases
1. Pre-Commit Hook
Scan only changed files before committing:2. Pull Request CI
Scan only files modified in a PR:3. Development Workflow
While editing skills or MCP servers, get instant feedback:skills/deploy.md (and any other modified files).
4. Monorepo Optimization
In large repos with hundreds of skills:Combining with Other Flags
With --monitor
Scan changed files AND track hashes for rug-pull detection:
- Scans only git-modified files (faster)
- Updates hashes in state file for those files
- Detects rug-pull attacks on next scan
With --severity
Filter findings by severity:
With --fail-on
Exit with code 1 if changed files have high-severity issues:
With --ci
Combines --fail-on high and --no-color:
Git-Changed File Detection
Staged Files
Files added withgit add:
Unstaged Files
Modified but not staged:Untracked Files
New files not yet added:Deleted Files
Deleted files are not scanned (nothing to analyze).Renamed Files
Git tracks renames as delete + add. Aguara scans the new path:Performance
Benchmark (500-file repo)
| Scan Type | Files Scanned | Duration |
|---|---|---|
| Full scan | 500 | 28s |
--changed (5 files) | 5 | 0.8s |
--changed (50 files) | 50 | 4.2s |
Overhead
Git command execution adds ~50ms overhead:Limitations
1. Requires Git
If git is not installed or the directory is not a git repo,--changed has no effect (all files are scanned).
2. Branch Context
--changed compares against HEAD (current commit). To compare against a specific branch:
3. Submodules
Git submodule changes are detected if the submodule pointer changed, but files inside submodules are not scanned unless you run Aguara inside the submodule directory.4. Ignored Files
Files matching.aguaraignore or .gitignore are skipped even if changed.
Best Practices
1. Use in Development
Enable--changed in your daily workflow for instant feedback:
2. Full Scan in Merge to Main
Run incremental scans on PRs, but full scans on merge to main:3. Combine with Watch Mode (Future)
While not yet supported, you can simulate watch mode withentr:
Comparison with —monitor
| Feature | --changed | --monitor |
|---|---|---|
| Detects | All issues in git-modified files | Dangerous content in changed files (vs. previous scan) |
| Requires | Git repository | Persistent state file |
| Scope | Git-tracked changes | All files (compares vs. previous scan) |
| Persistence | None (stateless) | Stores hashes in state file |
| Use Case | Fast PR scans, pre-commit hooks | Rug-pull detection, long-term monitoring |
Troubleshooting
”No files scanned” with —changed
If Aguara reports 0 files scanned:- Check git status:
- Ensure files are tracked or untracked (not ignored):
- Verify you’re in a git repository:
—changed not working in CI
Ensurefetch-depth: 0 in actions/checkout:
git diff HEAD.
Related
- Rug-Pull Detection — Track file changes across scans
- Output Formats — CI-friendly JSON and SARIF output
- MCP Discovery — Auto-detect MCP configs to scan
