Skip to main content

CLI Reference

The ai-bom CLI is the primary interface for scanning projects. It is built with Typer and supports rich terminal output.

Commands

ai-bom scan

Scan a directory, file, or git repository for AI/LLM components.

ai-bom scan [TARGET] [OPTIONS]

Arguments:

ArgumentDefaultDescription
TARGET.Path to scan (file, directory, or git URL)

Options:

FlagShortDefaultDescription
--format-ftableOutput format (see Output Formats)
--output-oNoneWrite output to file
--deepfalseEnable AST-based deep Python analysis
--severity-sNoneMinimum severity filter: critical, high, medium, low
--no-colorfalseDisable colored output
--quiet-qfalseSuppress banner and progress (for CI)
--verbose-vfalseShow scanner details, file counts, and timing
--debugfalseEnable debug logging with full stack traces
--fail-onNoneExit code 1 if severity threshold met
--policyNonePath to YAML policy file for CI/CD enforcement
--configNonePath to .ai-bom.yml config file
--save-dashboardfalseSave scan results to dashboard database
--workers0Number of parallel scanner workers (0 = sequential)
--cache / --no-cachefalseEnable incremental scanning cache
--max-file-size10Max file size in MB
--n8n-urlNonen8n instance URL for live scanning
--n8n-api-keyNonen8n API key (required with --n8n-url)
--n8n-localfalseScan local ~/.n8n/ directory

Examples:

# Scan current directory
ai-bom scan .

# Scan a git repository
ai-bom scan https://github.com/example/project.git

# Deep scan with AST analysis
ai-bom scan . --deep

# Generate CycloneDX SBOM
ai-bom scan . -f cyclonedx -o ai-bom.cdx.json

# CI mode: fail on critical, SARIF output
ai-bom scan . --fail-on critical -q -f sarif -o results.sarif

# Parallel scanning with 4 workers
ai-bom scan . --workers 4

# Scan n8n instance via API
ai-bom scan . --n8n-url http://localhost:5678 --n8n-api-key YOUR_KEY

# Scan with policy enforcement
ai-bom scan . --policy .ai-bom-policy.yml --quiet

ai-bom scan-cloud

Scan a live cloud provider account for managed AI/ML services.

ai-bom scan-cloud PROVIDER [OPTIONS]

Arguments:

ArgumentDescription
PROVIDERCloud provider: aws, gcp, or azure

Options:

FlagShortDefaultDescription
--format-ftableOutput format
--output-oNoneWrite output to file
--quiet-qfalseSuppress banner and progress

Requires the corresponding SDK extra:

pip install ai-bom[aws]    # for aws
pip install ai-bom[gcp] # for gcp
pip install ai-bom[azure] # for azure

ai-bom diff

Compare two scan results and show differences.

ai-bom diff SCAN1 SCAN2 [OPTIONS]

Arguments:

ArgumentDescription
SCAN1Path to first scan JSON file
SCAN2Path to second scan JSON file

Options:

FlagShortDefaultDescription
--format-ftableOutput format: table, json, markdown

ai-bom dashboard

Launch the web dashboard for viewing scan history.

ai-bom dashboard [OPTIONS]
FlagDefaultDescription
--host127.0.0.1Host to bind
--port8000Port to bind

Requires the dashboard extra: pip install ai-bom[dashboard]

ai-bom serve

Start the AI-BOM REST API server.

ai-bom serve [OPTIONS]
FlagDefaultDescription
--host0.0.0.0Host to bind
--port8080Port to bind

Requires the server extra: pip install ai-bom[server]

ai-bom watch

Watch a directory for changes and re-scan automatically.

ai-bom watch [TARGET] [OPTIONS]
FlagShortDefaultDescription
--format-ftableOutput format
--verbose-vfalseShow scanner details

Requires the watch extra: pip install ai-bom[watch]

ai-bom list-scanners

List all registered scanners and their status.

ai-bom list-scanners

ai-bom demo

Run a demo scan on the bundled example project.

ai-bom demo

ai-bom version

Print the installed AI-BOM version.

ai-bom version

Output formats

FormatFlagUse case
Table-f tableRich terminal output with color-coded severity (default)
CycloneDX 1.6-f cyclonedxIndustry-standard SBOM, compatible with OWASP Dependency-Track
JSON-f jsonAlias for CycloneDX
SARIF 2.1.0-f sarifGitHub Code Scanning integration
SPDX 3.0-f spdx3SPDX-compatible output with AI extensions
HTML-f htmlShareable dashboard - no server required
Markdown-f markdownPR comments and documentation
CSV-f csvSpreadsheet analysis
JUnit-f junitCI/CD test reporting

Exit codes

CodeMeaning
0Scan completed successfully
1Policy violation (from --fail-on or --policy)
2Operational error (bad path, network failure, parse error)

Policy file

Use a YAML policy file for fine-grained CI/CD enforcement:

# .ai-bom-policy.yml
max_critical: 0
max_high: 5
max_risk_score: 75
block_providers: []
block_flags:
- hardcoded_api_key
- hardcoded_credentials
ai-bom scan . --policy .ai-bom-policy.yml --quiet

Scan levels

AI-BOM's detection depth depends on the access available at scan time:

LevelAccess RequiredWhat It Finds
L1 - File SystemRead-only file accessSource code imports, configs, IaC, n8n JSON, notebooks
L2 - Docker+ Docker socketRunning AI containers, GPU allocations
L3 - Network+ Env filesAPI endpoints, hardcoded keys, .env secrets
L4 - Cloud IaC+ Terraform/CFN files60+ AWS/Azure/GCP AI resource types
L5 - Live Cloud+ Cloud credentialsManaged AI services via cloud APIs
# L1 (default) - works out of the box
ai-bom scan .

# L5 - live cloud scanning
pip install ai-bom[aws]
ai-bom scan-cloud aws

Environment variables

VariableDescription
NO_COLORDisable colored output (any value)