Search BrigadeStack

Search BrigadeStack pages and docs.

BrigadeStack
Menu
Docs menu

Docs / Reference

guard

Run the embedded content guard scanner, redactor, Git checks, and publish gates.

Use this before you publish a repo, a draft or a PR body, to catch secrets and private details before they leave your machine.

brigadestack guard is the CLI for the content guard scanner embedded in brigade-cli. The same packaged scanner and policies back brigadestack scrub, so a fresh BrigadeStack install can scan without a separate content-guard checkout.

Set CONTENT_GUARD_DIR to run an external content-guard checkout instead of the embedded brigade.guard package. Unset, the embedded package runs.

Embedded scanner commands

  • brigadestack guard scan [target] scans a file, directory, or stdin against a policy. It exits nonzero when blocking findings exist.
  • brigadestack guard redact [target] prints redacted output, or rewrites a file or directory with --in-place.
  • brigadestack guard diff [target] shows the redaction diff without rewriting.
  • brigadestack guard audit <dir> aggregates findings across a directory. Use --strict when findings should fail the command.
  • brigadestack guard baseline init <dir> records current findings so later scans can focus on new findings.
  • brigadestack guard allow add <value> and brigadestack guard allow list manage private allow_values for known-public literals.
brigadestack guard scan README.md
brigadestack guard scan src/content/docs --policy public-content
printf '%s\n' "$DRAFT_TEXT" | brigadestack guard scan --policy public-content

Git and publish commands

  • brigadestack guard git scans staged files by default, or all tracked files with --all-tracked.
  • brigadestack guard git --history scans content introduced by commits, which catches leaks that were later removed from the tip.
  • brigadestack guard commits scans commit messages. Use --range origin/main..HEAD or --all.
  • brigadestack guard publish-check runs the local publish gate for PR bodies, staged files, commit messages, and optionally all tracked files.
  • brigadestack guard pr <body.md> scans a PR draft and writes sanitized copy plus a JSON report.
  • brigadestack guard pr-prepare [body.md] prepares a reusable PR body bundle under .content-guard/pr-drafts.
  • brigadestack guard n8n-advisory reads one JSON payload from stdin and returns advisory JSON for workflow branching.
  • brigadestack guard n8n-validate runs the bundled n8n advisory fixtures.
brigadestack guard git
brigadestack guard git --all-tracked
brigadestack guard git --history --range origin/main..HEAD
brigadestack guard publish-check
brigadestack guard publish-check --pr-body .brigade/pr-body.md
brigadestack guard publish-check --all-tracked --commit-range origin/main..HEAD

Scrub shortcut

brigadestack scrub --target . --policy public-repo is the repo-level shortcut. It uses the embedded scanner by default, resolves packaged policies first, and writes a summary receipt at .brigade/scrub/latest.json unless --no-receipt is passed.

brigadestack scrub --target .
brigadestack scrub --target . --policy public-content
brigadestack scrub --target . --policy public-repo --dry-run