Skip to content

Latest commit

 

History

History
312 lines (224 loc) · 12.1 KB

CLI.md

File metadata and controls

312 lines (224 loc) · 12.1 KB

Blunt Code CLI Reference Manual

Blunt Code features complete command-line interface support for every capability in the system. Every action that can be performed in the web UI can also be executed headlessly via the bluntcode binary without starting a browser.

CLI queries open the SQLite database directly with shared concurrency, meaning CLI commands can run safely in parallel with the web UI server.


Command Quick Reference

Command Category Description
bluntcode scan <path> CI & Scans Run automated code security & quality scans with CI exit codes
bluntcode prune <path> CI & Scans Retain the last N completed scans for a workspace
bluntcode workspace <cmd> Management Register, inspect, list, tag, or delete workspaces
bluntcode findings <cmd> Inspection Search across findings, list scan issues, preview source code
bluntcode report <target> Exporters Export audit reports in Markdown, SARIF, HTML, JSON, CSV, JSONL
bluntcode history <cmd> Audit Trail Trace past scans and compare two scans for regressions
bluntcode suppress <cmd> Triage Suppress false positives forever by fingerprint hash
bluntcode rules <cmd> Configuration View/set path exclusion globs and toggle analyzer rules
bluntcode tools <cmd> Toolchain List, install, repair, and update hermetic analyzer binaries
bluntcode pentest probe DAST Dynamic HTTP security header, TLS, and vulnerability probe
bluntcode stats / risk Metrics Calculate global/workspace statistics, weighted risk score (A–D grade), trends
bluntcode doctor / update System Run environment health checks, auto-repair, check updates
bluntcode agent / llm AI Agents Machine-readable defaults and developer documentation for agents
bluntcode cli [command] Built-in Docs Built-in CLI reference manual and syntax helper

Exit Codes

All Blunt Code commands return deterministic exit codes suitable for CI/CD automation:

  • 0 — Clean / Success: Scan completed with full analyzer coverage and no gate violations.
  • 1 — Gate Tripped: Findings tripped --fail-on or --max-findings on an otherwise-complete scan.
  • 2 — Usage / Flag Error: Missing required arguments, invalid flag value, an invalid path argument, or an unresolvable --baseline.
  • 3 — Operational Failure / Incomplete Coverage: The scan failed, timed out, was interrupted, ended in completed_with_warnings (some analyzers failed or ran degraded), or could not start/persist its result. Zero findings from an incomplete scan never read as a pass.
  • 4 — Cancelled: The user cancelled the scan (single Ctrl+C graceful stop).
  • 130 — Forced Interrupt: A second Ctrl+C pressed while the first was still being handled.

1. Automated Scans (bluntcode scan)

Run static code analysis on a project directory.

bluntcode scan <path> [options]

Flags

  • --profile quick|standard|deep|pentest: Analyzer depth (default: standard).
    • quick: Fast lint pass only (Ruff, Biome).
    • standard: Adds Semgrep, Gitleaks, SonarQube, the static pentest pattern pass, license-scan, and the built-in secrets/todo scans.
    • deep: The full catalog — everything in standard plus OSV (dependency CVEs), Trivy (containers), Checkov (IaC), and Ruff's extended rule sets.
    • pentest: Everything in deep, plus the dast-probe analyzer: a live HTTP probe (security headers, CSP, CORS origin reflection, banner leaks, exposed sensitive paths) of the URL given with --target. Without --target the probe is skipped and the scan is static-only.
  • --target <url>: Pentest profile only. The running app the DAST probe requests; only that host is contacted (cross-host redirects are refused), and offline mode accepts loopback targets only.
  • --fail-on <severity+>: Trips exit code 1 if findings remain at or above severity (e.g. critical, high+, medium+, low+).
  • --max-findings N: Trips exit code 1 if total non-suppressed findings exceed N.
  • --baseline <id-or-sarif>: Compares findings against a baseline scan ID or SARIF file; only trips gate on new findings.
  • --format text|json|github|sarif|csv|jsonl|markdown: Output document format (default: text).
  • --output <file>: Write document to destination file instead of stdout.
  • --incremental: Reuses previous scan findings for files whose content hashes have not changed.
  • --jobs N: Run up to N analyzers concurrently (default: 4).
  • --watch: Watch directory and automatically trigger incremental rescan on file changes.
  • --quiet: Suppress analyzer progress lines on stderr.
  • --json: Print compact JSON summary block.

Examples

# Standard local scan
bluntcode scan .

# CI gate for GitHub Actions failing on high/critical findings
bluntcode scan . --fail-on high+ --format github

# Export SARIF for GitHub Code Scanning
bluntcode scan . --format sarif --output audit.sarif

# Watch mode during local development
bluntcode scan . --watch --profile quick

2. Workspace Management (bluntcode workspace)

Manage registered projects, metadata, directories, and tags.

bluntcode workspace list [--json]
bluntcode workspace add <path> [--name <name>] [--profile quick|standard|deep|pentest] [--trust-repo-config] [--json]
bluntcode workspace show <id|path> [--json]
bluntcode workspace tree <id|path> [--path <subpath>] [--json]
bluntcode workspace tags <id|path> [--set "tag1,tag2"] [--json]
bluntcode workspace delete <id|path> [--json]
bluntcode workspace trust-config <id|path> on|off [--json]

trust-config (and add --trust-repo-config) is a trust decision, off by default. Off, every external analyzer runs with Blunt Code-owned configuration and ignores the config files the scanned repository ships (.gitleaks.toml, .gitleaksignore, trivy.yaml, .trivyignore, trivy-secret.yaml, .checkov.yaml, osv-scanner.toml, ruff.toml / pyproject.toml, biome.json). On, those files are honored and can disable rules or exclude paths from the audit, so only enable it for repositories whose config you control.

Examples

# Register a workspace
bluntcode workspace add . --name my-service

# Assign tags
bluntcode workspace tags my-service --set "backend,security,go"

# Inspect file tree and exclusions
bluntcode workspace tree my-service --path src

3. Findings & Code Inspection (bluntcode findings)

Search, list, and preview source snippets for any finding.

# Search across all workspaces or a specific workspace
bluntcode findings search <query> [--workspace <id|path>] [--severity <sev>] [--limit N] [--json]

# List findings for a scan or workspace
bluntcode findings list <scan-id|path> [--severity <sev>] [--format text|json|jsonl|csv] [--output <file>]

# Preview source snippet around a finding
bluntcode findings preview <scan-id> <finding-id> [--lines N] [--json]

Examples

# Search for hardcoded secrets
bluntcode findings search "AWS" --severity critical

# Export findings to CSV
bluntcode findings list . --format csv --output findings.csv

# Preview code snippet with line numbers
bluntcode findings preview 99479be6... df7e5ede... --lines 5

4. Report Exporter (bluntcode report)

Exports a full audit report for any scan in standard formats.

bluntcode report <scan-id|workspace-path> [--format md|sarif|html|json|csv|jsonl] [--output <file>]

Supported Formats

  • md / markdown: SonarQube-style human-readable Markdown report (default).
  • sarif: OASIS SARIF 2.1.0 log for GitHub Code Scanning and IDEs.
  • html: Self-contained interactive HTML executive audit report.
  • json: Complete structured report payload.
  • csv: Comma-separated spreadsheet with UTF-8 BOM.
  • jsonl: Newline-delimited JSON stream for log pipelines and jq.

5. Scan History & Diff (bluntcode history)

Trace historical runs and compare scans for regressions.

# List historical scans
bluntcode history [workspace-id|path] [--limit N] [--json]

# Compare two scans (new, fixed, persistent)
bluntcode history compare <scan-1-id> <scan-2-id> [--json]

# Delete a scan record
bluntcode history delete <scan-id> [--json]

6. Suppressions (bluntcode suppress)

Suppress false positives forever by SHA-256 fingerprint hash.

# List suppressions
bluntcode suppress list <workspace> [--json|--csv]

# Suppress a finding
bluntcode suppress add <workspace> --fingerprint <hash> [--reason <text>]

# Remove a suppression
bluntcode suppress remove <workspace> --fingerprint <hash>

# Batch import suppressions from CSV
bluntcode suppress import <workspace> <csv-file>

7. Rules & Overrides (bluntcode rules)

Configure path exclusion overrides and toggle individual analyzer rules.

# List rules and overrides
bluntcode rules list <workspace> [--json]

# Disable / enable rule pattern
bluntcode rules disable <workspace> "test/**"
bluntcode rules enable <workspace> "test/**"

# Set path exclusion overrides
bluntcode rules overrides <workspace> --set "dist/**,build/**,node_modules/**"

8. Managed Analyzer Toolchain (bluntcode tools)

Inspect and manage hermetic analyzer binaries.

bluntcode tools list [--json]
bluntcode tools install <tool-id>
bluntcode tools repair <tool-id>
bluntcode tools update <tool-id>

9. Dynamic Pentest Probing (bluntcode pentest)

Perform dynamic DAST probing against HTTP endpoints.

bluntcode pentest probe <url> [options]

Flags

  • --scope standard|full|spider: Probe depth (default: standard).
  • --auth-mode bearer|basic|cookie: Authentication mode.
  • --auth-token <credentials>: Token, credentials, or cookie string. Only sent to https:// targets; combining it with an http:// target is refused.
  • --insecure: Skip TLS certificate verification for this probe (self-signed local or staging targets you control). Verification is on by default; a failed verification is reported as dast.tls.untrusted-certificate before any request or credential is sent.
  • --allow-private: Allow private-network and link-local targets (see below).
  • --json: Output complete structured JSON audit results.

Target policy

The probe checks the address of every connection it opens (after DNS resolution, including same-host redirects), not just the URL text:

Destination Default Opt-in
Public addresses Allowed -
Loopback (127.0.0.0/8, ::1, localhost) Allowed -
Private and link-local (10/8, 172.16/12, 192.168/16, 100.64/10, 169.254/16, fc00::/7, fe80::/10) Refused --allow-private on the CLI; BLUNTCODE_PENTEST_ALLOW_PRIVATE=1 in the environment of bluntcode for the web UI / API
Cloud metadata (169.254.169.254, 169.254.170.2, 169.254.170.23, 100.100.100.200, fd00:ec2::254, metadata.google.internal), unspecified, multicast, broadcast, reserved Always refused -

The API opt-in is read only from the server's environment; the request body cannot enable it. Environment HTTP proxies are not used by the probe.


10. Metrics, Trends & Risk (bluntcode stats)

Calculate aggregate figures, weighted risk scores (unbounded with letter grades A–D: A 0–4, B 5–19, C 20–49, D 50+), and historical trendlines.

# Global statistics across all workspaces
bluntcode stats [--json]

# Workspace-specific summary
bluntcode stats <workspace> [--json]

# Severity trendline over time
bluntcode trends <workspace> [--limit N] [--json]

# Weighted risk assessment and risk grade (A-D)
bluntcode risk <workspace> [--json]

11. Diagnostics & Updates

# Diagnose system environment and tool installations
bluntcode doctor [--fix] [--json]

# Print resolved directory paths and configurations
bluntcode config [--json]

# Check for latest Blunt Code release
bluntcode update check [--json]

12. AI Agent Integration (bluntcode agent)

Optimized commands for AI coding assistants (Claude, Gemini, Cursor, Antigravity).

# Print llm.txt developer guidance
bluntcode agent docs
bluntcode llm

# Headless scan with automated --json --quiet defaults
bluntcode agent scan <path> [scan flags]