Skip to main content

Configuration

Anvil is configured via anvil.config.json in your project root.

Basic Structure

{
"version": "1.0",
"gates": {
"architecture": { ... },
"antiPatterns": { ... },
"secrets": { ... },
"eslint": { ... },
"coverage": { ... }
},
"watch": { ... },
"ci": { ... },
"suppressions": [ ... ]
}

Gates

Architecture

{
"architecture": {
"enabled": true,
"boundaries": [
{
"name": "api-layer",
"pattern": "src/api/**",
"allow": ["src/services/**", "src/utils/**"],
"deny": ["src/repositories/**"]
}
],
"detectCircular": true,
"maxDepth": 10
}
}
OptionTypeDescription
enabledbooleanEnable architecture checks
boundariesarrayBoundary definitions
boundaries[].namestringHuman-readable name
boundaries[].patternglobFiles this boundary applies to
boundaries[].allowglob[]Allowed import patterns
boundaries[].denyglob[]Forbidden import patterns
detectCircularbooleanDetect circular dependencies
maxDepthnumberMax import chain depth

Anti-Patterns

{
"antiPatterns": {
"enabled": true,
"patterns": {
"AP-001": { "enabled": true, "severity": "warning" },
"AP-003": { "enabled": true, "severity": "error" },
"AP-004": { "enabled": true, "severity": "warning" },
"AP-006": { "enabled": true, "severity": "warning" },
"AP-007": { "enabled": false }
}
}
}
PatternDescriptionDefault Severity
AP-001Broad eslint-disablewarning
AP-003Explicit any typewarning
AP-004@ts-ignore directivewarning
AP-006Empty catch blockwarning
AP-007Console in productioninfo (off)

Secrets

{
"secrets": {
"enabled": true,
"patterns": ["api[_-]?key", "secret[_-]?key", "password"],
"entropyThreshold": 4.5,
"checkGitHistory": false,
"allowList": ["src/config/example.ts"]
}
}
OptionTypeDescription
enabledbooleanEnable secret detection
patternsregex[]Additional patterns to match
entropyThresholdnumberShannon entropy threshold (0-8)
checkGitHistorybooleanScan git history
allowListglob[]Files to skip

ESLint

{
"eslint": {
"enabled": true,
"failOn": "error",
"configPath": ".eslintrc.js"
}
}

Coverage

{
"coverage": {
"enabled": false,
"threshold": {
"lines": 80,
"branches": 75,
"functions": 80,
"statements": 80
},
"reportPath": "coverage/coverage-summary.json"
}
}

Watch Mode

{
"watch": {
"enabled": true,
"debounceMs": 300,
"ignore": ["node_modules", "dist", ".git", "coverage"],
"extensions": [".ts", ".tsx", ".js", ".jsx"]
}
}
OptionTypeDescription
debounceMsnumberDelay before validation
ignoreglob[]Patterns to ignore
extensionsstring[]File extensions to watch

CI Mode

{
"ci": {
"failOnWarnings": false,
"outputFormat": "json",
"evidencePath": ".anvil/evidence"
}
}

Suppressions

{
"suppressions": [
{
"pattern": "src/legacy/**",
"checks": ["AP-003", "AP-006"],
"reason": "Legacy code, migration planned Q2"
},
{
"pattern": "src/generated/**",
"checks": ["*"],
"reason": "Auto-generated from protobuf"
}
]
}

Evidence

{
"evidence": {
"enabled": true,
"path": ".anvil/evidence",
"retention": {
"duration": "90d",
"keepFailures": true,
"compressAfter": "7d"
}
}
}

Extending Configuration

Local Overrides

Create anvil.local.json (gitignored):

{
"extends": "./anvil.config.json",
"watch": {
"debounceMs": 500
}
}

Environment Variables

Override via environment:

ANVIL_FAIL_ON_WARNINGS=true anvil run
VariableDescription
ANVIL_CONFIGPath to config file
ANVIL_CIForce CI mode
ANVIL_FAIL_ON_WARNINGSFail on warnings
ANVIL_DISABLEDisable Anvil entirely

Full Example

{
"version": "1.0",
"gates": {
"architecture": {
"enabled": true,
"boundaries": [
{
"name": "api",
"pattern": "src/api/**",
"deny": ["src/repositories/**"]
},
{
"name": "services",
"pattern": "src/services/**",
"allow": ["src/repositories/**"]
}
]
},
"antiPatterns": {
"enabled": true,
"patterns": {
"AP-001": { "severity": "error" },
"AP-003": { "severity": "error" },
"AP-004": { "severity": "warning" },
"AP-006": { "severity": "warning" }
}
},
"secrets": {
"enabled": true,
"entropyThreshold": 4.5
}
},
"watch": {
"debounceMs": 300,
"ignore": ["node_modules", "dist"]
},
"ci": {
"failOnWarnings": false
},
"suppressions": [
{
"pattern": "scripts/**",
"checks": ["AP-007"],
"reason": "Scripts may use console"
}
]
}

Next: Security model →