Straitjacket

CLI

Every command-line flag, the output format, exit codes, and installation details.

straitjacket [PATHS]... [OPTIONS]

With no arguments, Straitjacket scans the current directory (.), honoring .gitignore. Pass one or more files or directories to scan those instead.

Examples

straitjacket                      # scan the current directory (honors .gitignore)
straitjacket src tests            # scan specific paths
straitjacket --format json        # machine-readable output
straitjacket --only emoji,color
straitjacket --skip motion,slop-prose  # ratchet rules off
straitjacket --max-lines 800       # tighter file-size budget (0 disables the rule)
straitjacket --prose-window 600    # widen the slop-prose density window
straitjacket --dup-min-tokens 80   # only flag larger duplicated blocks
straitjacket --include-json        # also scan .json (skipped by default)
straitjacket --prop-chains         # report cross-file prop-drilling depth and exit
straitjacket --no-ignore          # don't respect .gitignore / hidden-file rules
straitjacket --no-fail            # report but always exit 0

Options

flagdefaulteffect
[PATHS]....Files or directories to scan.
--format <text|json|sarif>textOutput format. json is machine-readable; sarif emits SARIF 2.1.0 for GitHub code scanning.
--only <ids>Run only these rules (comma-separated ids).
--skip <ids>Skip these rules (comma-separated ids).
--max-lines <n>1500file-size line budget. 0 disables the rule.
--max-nesting <n>6deep-nesting indentation-depth budget. 0 disables the rule.
--prose-window <n>400slop-prose density window, in characters.
--dup-min-tokens <n>50duplication minimum clone size, in tokens.
--include-jsonoffAlso scan .json files (skipped by default as generated/config data).
--no-ignoreoffDon't respect .gitignore / hidden-file conventions; scan everything.
--no-failoffExit 0 even when findings exist (report-only).
--config <path>Use this config file instead of discovering .straitjacket.yaml.
--no-configoffIgnore any .straitjacket.yaml; use only flags and defaults.
--prop-chainsoffReport cross-file prop-drilling chains (depth analysis) and exit.
--list-rulesoffList the available rules and exit.
--versionPrint the version and exit.

Output format

In text mode, each finding is one line:

path:line:col  [rule]  matched

Warnings are tagged (warn) after the rule. When the scan is clean you get straitjacket: ok — no findings in N file(s); otherwise a summary line reports the error and warning counts.

.json is skipped by default — it's almost always generated or config data, not code or prose meant to be read by humans. Pass --include-json to scan it too.

Exit codes

codemeaning
0Clean, or only warnings, or --no-fail set.
1At least one error-level finding.

Installing

Prebuilt binary (Linux x86_64, macOS arm64/x86_64):

curl -fsSL https://raw.githubusercontent.com/zmaril/straitjacket/main/install.sh | sh

It installs to /usr/local/bin if writable, else ~/.local/bin. Override the location with STRAITJACKET_INSTALL_DIR, or pin a release with STRAITJACKET_VERSION.

On Windows, grab straitjacket-x86_64-pc-windows-msvc.zip from Releases. On any platform, from source:

cargo install --git https://github.com/zmaril/straitjacket

On this page