fallow guard
Find the output fields and exit codes of fallow guard, which shows the architecture rules of a file before you change it.
Show the architecture rules that apply to one or more files before you change them: the zone, the zones that the file can import, the forbidden calls, and the policy rules.
For zones and their rules, read Architecture.
Synopsis
fallow guard [OPTIONS] <FILES>...
Options
| Argument | Description |
|---|---|
<FILES...> | Files to report on (root-relative or absolute; may not exist yet) |
This command has no options of its own.
The global options are in these groups: Project, Output, Scope, Baselines, Gates, Duplication, Type-aware, Performance.
Fallow reads only the config file and matches each path against the zone patterns. It runs no analysis and does not read the file, so the file can be new. The analysis options that --help shows have no effect. --format takes only human or json.
Output
fallow guard src/reports/invoice.ts src/lib/new-helper.ts
src/reports/invoice.ts (zone: reports)
note: Same-zone imports are always allowed.
may import zones: lib, reports (same zone), services type-only: none
forbidden calls in zone: none
policy rules: none
severities: boundary-violation=error policy-violation=warn
src/lib/new-helper.ts (zone: lib)
exists: false
note: Same-zone imports are always allowed.
may import zones: lib (same zone) type-only: none
forbidden calls in zone: none
policy rules: none
severities: boundary-violation=error policy-violation=warn
Each file shows its zone, the zones that it can import, the zones that it can import types from, the forbidden calls, and the policy rules in scope. A file outside each zone shows zone: none and has no import rules. Policy rules without zones still apply to it. Each policy rule shows its severity, its id, its kind and its patterns, and the suppression comment for it.
With --format json, the output has kind: "guard" and files, with one object for each file:
| Field | Content |
|---|---|
path | The path from the project root. |
exists | false for a file that does not exist yet. |
zone | name and patterns of the zone, or null. |
boundary | configured, unrestricted, allowed_zones, allowed_type_only_zones, forbidden_calls, coverage_required. |
policy_rules | One object for each rule in scope: pack, rule_id, kind, patterns, message, severity, suppress_token. A banned-import rule with allowNames also has allowed_names. A gdp-proof-producer rule also has allowed_files and proof_kinds. |
severities | The severity of boundary_violation and policy_violation. |
notes | Notes about the rules. |
allowed_zones always holds the zone of the file. unrestricted is true when no import rule applies. coverage_required is true when boundaries.coverage.requireAllFiles is on and the file is outside each zone. policy_rules is empty when the severity of policy-violation is off. The JSON output reference has each field.
- A policy rule with
zonesappears only for the files in those zones. A rule withoutzonesappears for each file, also a file outside each zone. - The human line of a
banned-importrule withallowNamesadds the list, for examplebanned-import: three (allowed names: Vector3, Quaternion). - For a
gdp-proof-producerrule,allowed_fileslists the globs where proof factories are allowed, and the human output adds anallowed producers:line. An absentproof_kindsmeans that the rule checks each factory call, also a call with a dynamic label. These fields give the permission. Thefiles,excludeandzonesof the rule still set where it checks code. See gdp-ts proof producers. - The
guardtool of the MCP server gives the same output.
The suppression comment of a policy rule uses the token policy-violation:<pack>/<rule-id>, for example // fallow-ignore-next-line policy-violation:house-rules/no-moment -- <reason>.
Exit codes
| Code | Meaning |
|---|---|
0 | Fallow printed the rules, also for a file outside each zone or a file that does not exist. |
2 | Invalid input or config, for example --format sarif, or a rule pack that does not parse. |
The command reports no findings, so it never exits with code 1. See Exit codes.
Examples
# Show the rules of a file before you change it
fallow guard src/ui/App.ts
# Show the rules of a new file
fallow guard src/ui/NewScreen.tsx
# Get the rules of two files as JSON for an agent
fallow guard src/ui/App.ts src/db/query.ts --format json --quiet
Related
fallow architecture: find the boundary and policy violations in the code.- Boundaries config: define zones and their rules.
fallow rule-pack: write and test policy rules.