gate scan

Discovers agent configuration, classifies what it can do, runs every rule, and prints a blast radius.

Usage

gate scan [path]
npx @usegate/cli scan [path]

path defaults to the current directory. scan is the default command, so gate on its own does the same thing.

The scan is read-only and local. Gate opens configuration files, and does not start MCP servers, write to the repository, or make network calls.

Options

  • Name
    --json
    Type
    boolean
    Description

    Emit the machine-readable scan result instead of human output. Stable enough to depend on in CI, and validated against its published schema on the way out.

  • Name
    --sarif <file>
    Type
    path
    Description

    Also write SARIF 2.1.0 for GitHub code scanning. Additive; does not replace --json.

  • Name
    -q, --quiet
    Type
    boolean
    Description

    Print a single summary line. Useful for a build log where the detail lives in an artifact.

  • Name
    -s, --severity <level>
    Type
    info | low | medium | high | critical
    Description

    Exit non-zero at this severity or above. Defaults to high, or whatever gate.config.ts says.

  • Name
    -c, --config <file>
    Type
    path
    Description

    Use a specific configuration file. Without this, Gate looks for gate.config.ts, .mts, .mjs, .js, .json, then a gate key in package.json. A missing file passed here is an error, not a fallback.

  • Name
    --baseline <file>
    Type
    path
    Description

    Compare against a baseline and mark findings as new or unchanged. Defaults to .gate/baseline.json when that file exists.

  • Name
    --write-baseline
    Type
    boolean
    Description

    Record the current state as the baseline and write it to .gate/baseline.json. Commit the result.

  • Name
    --inspect
    Type
    boolean
    Description

    Connect to already-running remote MCP servers and enumerate their real tools. Gate never calls a tool. See deep inspection.

  • Name
    --allow-stdio-launch
    Type
    boolean
    Description

    Also start local stdio MCP servers during --inspect. Unsafe: this executes command lines taken from the configuration Gate is auditing. Gate prints the exact command and asks before each one.

  • Name
    -y, --yes
    Type
    boolean
    Description

    Do not prompt before starting a local server. Only meaningful with --allow-stdio-launch.

  • Name
    --show-suppressed
    Type
    boolean
    Description

    List findings hidden by ignore entries in your configuration, with the reason each was suppressed.

  • Name
    --no-telemetry
    Type
    boolean
    Description

    Do not send anonymous aggregate usage data for this run. See privacy.

  • Name
    --no-color
    Type
    boolean
    Description

    Disable coloured output. Gate also honours NO_COLOR and disables colour automatically when output is redirected.

Exit codes

CodeMeaning
0No findings at or above the configured threshold
1Findings at or above the threshold
2Gate itself failed. Bad configuration, unreadable file, internal error

1 and 2 are separate so CI can tell "your agent is dangerous" from "Gate broke". See exit codes.

Examples

Everyday use

# Scan the current repository
gate scan

# Only fail the build on critical findings
gate scan --severity critical

# Machine-readable output for a pipeline
gate scan --json > gate-result.json

# See what your configuration is hiding
gate scan --show-suppressed

Working with a baseline

# Record what the agent can do today
gate scan --write-baseline

# Later: what has changed since?
gate scan --baseline .gate/baseline.json

Deep inspection

# Ask running remote servers what tools they really have
gate scan --inspect

# Also start local stdio servers (unsafe, prompts per server)
gate scan --inspect --allow-stdio-launch

Was this page helpful?