Command-line tool for validating, linting, and formatting Agent Formation files.
Schema validation — is it valid AFS?
afs validate formation.afs
afs validate agents/*.afs --schema agent
afs validate . # Validate entire formation directoryChecks:
- Required fields present
- Correct types
- Valid secret references
- Valid component references
- Schema version compatibility
Best practices — is it good AFS?
afs lint formation.afs
afs lint . --fix # Auto-fix where possibleChecks:
- Descriptive IDs (not
agent1,mcp-server-2) - No unused secret references
- No deprecated fields
- Consistent naming conventions
- Missing descriptions
- Overly permissive defaults
Auto-format for consistency:
afs fmt formation.afs
afs fmt . --check # Check without modifying (for CI)brew install agent-formation/tap/afsgo install github.com/agent-formation/afs-cli/cmd/afs@latestDownload from Releases for:
- Linux (amd64, arm64)
- macOS (amd64, arm64)
- Windows (amd64)
# Validate a single file
afs validate formation.afs
# Validate with specific schema type
afs validate agents/support.afs --schema agent
# Lint entire directory
afs lint .
# Format in place
afs fmt .
# Check formatting (CI mode)
afs fmt . --check
# Output as JSON (for integrations)
afs validate . --output json| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Validation/lint errors found |
| 2 | Invalid arguments or file not found |
- name: Validate AFS
run: |
afs validate .
afs lint .
afs fmt . --checkafs-cli/
├── cmd/afs/ # CLI entrypoint
├── pkg/
│ ├── parser/ # AFS/YAML file parsing
│ ├── validator/ # Schema validation engine
│ ├── linter/ # Lint rule engine
│ ├── formatter/ # Auto-formatter
│ └── schema/ # Embedded JSON schemas
├── rules/ # Lint rule definitions
└── testdata/ # Fixtures for testing
For external tooling, JSON Schema files are available:
afs schema export --output ./schemas/Or download directly from releases.
See CONTRIBUTING.md.
Apache License 2.0