Overview
Theaguara init command scaffolds configuration files for Aguara, including .aguara.yml config, .aguaraignore patterns, GitHub Actions workflows, and git pre-commit hooks.
Usage
Examples
Arguments
Directory to initialize. Defaults to current directory.
Flags
Create a git pre-commit hook that runs Aguara scans before each commit.Requires: Directory must be a git repository (Creates:
.git/ must exist).git/hooks/pre-commit (executable)Only generate GitHub Actions workflow. Skip Creates:
.aguara.yml and .aguaraignore..github/workflows/aguara.ymlGenerated Files
Default mode (no flags)
Creates three files:.aguara.yml
Main configuration file:
.aguaraignore
Gitignore-style ignore patterns:
.github/workflows/aguara.yml
GitHub Actions workflow with SARIF upload and PR comments:
.git/hooks/pre-commit (with --hook)
Git pre-commit hook:
chmod +x).
Behavior
Existing files are skipped
If a file already exists, it won’t be overwritten:Directory creation
Parent directories are created automatically:Git repository check (for --hook)
The --hook flag requires a git repository:
Use Cases
New project setup
Initialize all Aguara files in a new project:Git pre-commit scanning
Block commits with high-severity findings:GitHub Actions integration
Add Aguara to CI/CD pipeline:- Runs on every push and PR to
main - Uploads SARIF results to GitHub Code Scanning
- Comments on PRs with finding counts
- Fails the build if high+ severity findings exist
Existing project adoption
Add Aguara to an existing project:Custom configuration location
Initialize in a subdirectory:.aguara.yml with independent settings.
Customization After Init
Adjust ignore patterns
Edit.aguaraignore to skip large directories:
Configure severity thresholds
Edit.aguara.yml:
Disable specific rules
Edit.aguara.yml:
Add custom rules
Edit.aguara.yml:
GitHub Actions Workflow Details
The generated workflow includes:Features
- Binary caching: Caches Aguara binary to speed up runs
- SARIF upload: Integrates with GitHub Code Scanning
- PR comments: Posts finding summaries on pull requests
- Fail on high: Fails the workflow if high+ findings exist
- Permissions: Minimal required permissions declared
Customizing the workflow
Change failure threshold:Pre-commit Hook Details
The generated hook:Behavior
- Runs
aguara scan .before every commit - Fails (blocks commit) if high or critical findings exist
- Uses
--no-colorfor consistent terminal output
Customizing the hook
Scan only changed files:Bypassing the hook
Temporarily skip the hook:Removing the hook
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Files created successfully |
| 1 | Error creating files or directories |
Related Commands
- aguara scan - Run security scans
- aguara list-rules - View available detection rules
