Skip to content
Fallow home
All docs pages

Docs home

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

ArgumentDescription
<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:

FieldContent
pathThe path from the project root.
existsfalse for a file that does not exist yet.
zonename and patterns of the zone, or null.
boundaryconfigured, unrestricted, allowed_zones, allowed_type_only_zones, forbidden_calls, coverage_required.
policy_rulesOne 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.
severitiesThe severity of boundary_violation and policy_violation.
notesNotes 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 zones appears only for the files in those zones. A rule without zones appears for each file, also a file outside each zone.
  • The human line of a banned-import rule with allowNames adds the list, for example banned-import: three (allowed names: Vector3, Quaternion).
  • For a gdp-proof-producer rule, allowed_files lists the globs where proof factories are allowed, and the human output adds an allowed producers: line. An absent proof_kinds means that the rule checks each factory call, also a call with a dynamic label. These fields give the permission. The files, exclude and zones of the rule still set where it checks code. See gdp-ts proof producers.
  • The guard tool 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

CodeMeaning
0Fallow printed the rules, also for a file outside each zone or a file that does not exist.
2Invalid 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