Skip to content

CLI Commands Reference

Complete reference for the cloudslash CLI. All commands are also available via the cs shorthand alias: both names are interchangeable.

# These are identical:
cloudslash scan --format=sarif
cs scan --format=sarif

Global Persistent Flags & Environment

The binary accepts persistent flags that apply across commands, as well as environment variables prefixed with CLOUDSLASH_. Flags override environment variables, which in turn supersede configuration file defaults.

Flag Viper Key Environment Variable Default Definition
--region region CLOUDSLASH_REGION us-east-1 Target AWS region
--tfstate tfstate CLOUDSLASH_TFSTATE terraform.tfstate Path to terraform.tfstate file
--all-profiles all_profiles CLOUDSLASH_ALL_PROFILES false Scan all discovered AWS CLI profiles
--required-tags required_tags CLOUDSLASH_REQUIRED_TAGS "" Comma-separated required tags
--slack-webhook slack_webhook CLOUDSLASH_SLACK_WEBHOOK "" Slack Incoming Webhook URL
-v, --verbose verbose CLOUDSLASH_VERBOSE false Enable verbose Matrix Mode logging
--json json_logs CLOUDSLASH_JSON_LOGS false Enable structured JSON logging
--no-metrics no_metrics CLOUDSLASH_NO_METRICS false Skip CloudWatch API metric calls
--rules rules_file CLOUDSLASH_RULES_FILE "" Path to custom YAML policy rules
--history-url history_url CLOUDSLASH_HISTORY_URL "" S3 URL for shared history (s3://bucket/key)
--tombstone-url tombstone_url CLOUDSLASH_TOMBSTONE_URL "" URL for tombstone storage (s3:// or file://)
--output-dir output_dir CLOUDSLASH_OUTPUT_DIR cloudslash-out Directory for generated artifacts
--otel-endpoint otel_endpoint CLOUDSLASH_OTEL_ENDPOINT "" OpenTelemetry OTLP HTTP receiver endpoint

Command Matrix

Command Category Description
scan Execution Runs headless shift-left infrastructure analysis
init Setup Onboarding for cloud credentials and local storage
config Setup Interactive and key-value configuration manager
doctor Diagnostics Dynamic system health diagnostics and auto-repair
tui Interface Interactive quad-pane terminal dashboard
watch Continuous Continuous in-process re-scanning with change detection
schedule Continuous Host-scheduled periodic scans (launchd, systemd, cron)
drift Continuous One-shot infrastructure drift check vs last snapshot
diff Analysis Compare two scan snapshots over time
trend Analysis Visual cost and waste trend sparklines
audit FinOps & M&A Structured M&A due-diligence dataroom report
chargeback FinOps & M&A Multi-sheet Finance Excel (XLSX) chargeback report
plan Remediation Scan and derive remediation plan JSON
approval Remediation Quorum-based approval workflow (approve, reject, list)
remediate Remediation Execute local or Horizon remediation plans safely
revert Remediation Review recent interventions from audit ledger for reversal
policy Governance CEL policy development tools (validate, test, lint)
permissions Governance Render least-privilege IAM policies from plugin manifests
plugin Extensibility Manage plugins (install, search, list, create, uninstall, local)
codegen Extensibility Generate Go struct bindings from Terraform provider schemas
login SaaS Horizon Browser-based OAuth login with Horizon
logout SaaS Horizon Log out and clear local Horizon auth tokens
sync SaaS Horizon Push local scan snapshot to Horizon SaaS
status Status Fast terminal overview of infrastructure state
history Status Query the persistent BadgerDB event audit trail
upgrade Maintenance Check and install binary upgrades from GitHub Releases
uninstall Maintenance Cleanly remove CloudSlash data, daemon, and config

Command Reference

scan

Stateless shift-left infrastructure scanner for CI/CD and local development. Discovers cloud resources via gRPC plugins, evaluates heuristic waste patterns, evaluates CEL rules, and enforces exit-code gates.

cs scan [flags]
Flag Type Default Description
--format string table Output format: table, json, github-pr, sarif, github-actions
--fail-on string none Exit non-zero on findings at severity: critical, warning, none
--timeout duration 10m Maximum scan duration (e.g., 5m, 30s)
--output string "" Write report directly to file instead of stdout
--plan string "" Path to terraform show -json output for plan-based pre-merge scanning
--json bool false Stream findings as newline-delimited JSON (alias for --format=json)
--waste bool false Find and rank idle/waste resources by safe-delete savings
--allow-unsigned bool false Allow execution of unsigned plugins (Security risk)
--max-cost float64 0 Maximum monthly cost budget for --fail-on=cost
--cost-threshold float64 0 Threshold for detecting cost regression. Exits code 2 if breached
--parallel bool false Enable parallel scanning across regions and providers
--compare-to-baseline bool false Detect infrastructure drift against stored baseline
--update-baseline bool false Create/update baseline from current scan state

Exit Codes

  • 0: Scan succeeded; all findings below --fail-on threshold.
  • 1: Findings exceeded --fail-on threshold (CI build failure).
  • 2: Cost increased by more than --cost-threshold since last scan.
  • 3: Infrastructure drift detected with --compare-to-baseline.

init

Interactive setup wizard. Detects local cloud credentials, provisions the graph store, and writes the local config.

cs init

config

Configuration manager for viewing and modifying settings in ~/.cloudslash/cloudslash.yaml.

cs config                          # Interactive configuration wizard
cs config get <key>                # Read a configuration value
cs config set <key> <value>        # Set a configuration value
cs config path                     # Display path to active configuration file

doctor

Dynamic system health diagnostic suite that cross-references credentials, plugins, snapshots, and local storage with auto-repair capabilities.

cs doctor           # Run diagnostic checks
cs doctor --fix     # Automatically repair fixable errors
Flag Type Default Description
--fix bool false Attempt to auto-repair missing dirs, stale sockets, and default configs

tui

Launches the terminal user interface (TUI) powered by Bubbletea, providing quad-pane visualization of the resource topology, waste findings, and remediation controls.

cs tui

watch

Runs the engine in continuous in-process scanning mode on a periodic interval, diffing subsequent runs and reporting modifications.

cs watch [flags]
Flag Type Default Description
--interval duration 5m Re-scan interval (e.g., 30s, 2m, 5m)
--alert-on-change bool false Only print output when infrastructure state actually changes

schedule

Installs periodic scans in the operating system's own scheduler instead of keeping a process alive. Each tick runs a normal cloudslash scan, inheriting your credential chain and writing the same snapshot and history. CloudSlash starts no daemon and stores no credentials for scheduled runs.

cs schedule add [-- scan flags]
cs schedule list
cs schedule remove [name]
Flag Type Default Description
--every duration 15m Scan interval; whole minutes, minimum 1m (e.g. 15m, 1h, 6h)
--name string scan Job name; letters, digits, -, _, .
--dir string executable dir Working directory for each run

Extra arguments after -- are appended to the scan invocation, e.g. cs schedule add --every 6h -- --region all.

Installers by platform: launchd (~/Library/LaunchAgents/dev.cloudslash.scan.<name>.plist) on macOS, systemd user timer (cloudslash-scan-<name>.timer) on Linux, and crontab as a fallback. Installing replaces an existing job with the same name; the first run happens after one interval, never at install time. Output goes to ~/.cloudslash/logs/schedule-<name>.log.

cs schedule add --every 15m
cs schedule list
tail -f ~/.cloudslash/logs/schedule-scan.log
cs schedule remove scan

Scheduled runs are ordinary scans: they update ~/.cloudslash/graph.snap, feed cs history, cs diff, cs trend, and keep cs tui warm. Use cs watch instead when you want a foreground loop that streams diffs.


drift

Performs a live scan and diffs discovered resources against the latest local snapshot to identify unmanaged or missing resources.

cs drift [flags]

diff

Compares infrastructure snapshots over time to highlight new waste, resolved waste, and dollar cost movement.

cs diff [flags]
Flag Type Default Description
--from string "" Starting snapshot date (YYYY-MM-DD) or file path
--to string "" Ending snapshot date (YYYY-MM-DD) or path (defaults to latest)
--list bool false List all available snapshots with timestamps and statistics

trend

Renders terminal sparklines depicting cost and waste movements over historical scan snapshots.

cs trend [flags]
Flag Type Default Description
--days int 30 Number of days to display in the trend analysis

audit

Generates an M&A due-diligence infrastructure audit report in structured JSON format, detailing spend, waste percentage, attribution coverage, and prioritized remediations.

cs audit --target "Company Name" [flags]
Flag Type Default Description
--target string "" Required. Name of company or entity being audited
--output string stdout Destination file for the JSON audit report
--period-months int 3 Number of billing months analyzed

chargeback

Generates an executive-ready, three-sheet Excel (.xlsx) workbook categorizing cloud spend and waste by team and attribution owner based on ~/.cloudslash/org-map.yaml.

cs chargeback [flags]
Flag Type Default Description
--period string current month (YYYY-MM) Billing period to analyze
--output string chargeback-<period>.xlsx File path for output workbook

plan

Scans infrastructure and outputs an actionable remediation plan JSON ordered by highest projected dollar savings.

cs plan [flags]
Flag Type Default Description
--file string stdout Write plan JSON to file path
--dry-run bool false Mark plan for review without preparing execution locks

approval

CLI workflow for managing human sign-offs on remediation requests requiring quorum.

cs approval list                     # List all pending approval requests
cs approval approve <request-id>     # Approve pending request
cs approval reject <request-id>      # Reject and veto pending request
Subcommand Flag Description
approve --reason Optional justification recorded in immutable audit log
reject --reason Justification explaining why the remediation was vetoed

remediate

Executes a remediation plan locally via the SAU engine, taking safe snapshots and enforcing rollback availability.

cs remediate [flags]
Flag Type Default Description
--plan-id string "" Fetch and execute a plan from Horizon by ID
--file string "" Path to a local plan JSON file to execute
--dry-run bool false Validate steps and permissions without altering cloud resources
--force bool false Skip interactive user confirmation prompts
--auto bool false Run automated low-risk actions without prompting
--api-url string https://api.cloudslash.dev Override Horizon SaaS API URL

revert

Reviews recent destructive interventions (purge and quarantine) from the immutable audit ledger to prepare reversal or restoration.

cs revert [flags]
Flag Type Default Description
--limit int 20 Maximum number of recent ledger entries to display

policy

Developer toolkit for authoring, compiling, and testing Common Expression Language (CEL) policy packs.

cs policy validate rules.yaml    # Check CEL syntax and schema validity
cs policy test rules.yaml        # Dry-run policy against latest scan snapshot
cs policy lint rules.yaml        # Scan rules for common logical errors

permissions

Inspects installed plugin manifests and computes a least-privilege IAM policy containing only the exact cloud actions required for scanning and remediation.

cs permissions [flags]
Flag Type Default Description
--provider string aws Target cloud provider (aws, gcp, azure)
--format string json Output serialization: json or terraform
--save string stdout Write output policy directly to a file
--manifest string "" Also include permissions declared in an external manifest

plugin

Complete lifecycle management for provider plugins and policy packs.

cs plugin search [query]          # Search registry for plugins or policies
cs plugin install <name>          # Install plugin from registry or GitHub
cs plugin list                    # List all installed plugins and load status
cs plugin uninstall <name>        # Remove an installed plugin from disk
cs plugin create <name>           # Scaffold a new gRPC plugin project
cs plugin local install <url>     # Install plugin directly from file/URL
cs plugin local list              # List local plugins bypassing registry
cs plugin status                  # Show user's published plugins
cs plugin verify                  # Validate manifest and binary before publishing

codegen

Metagraph compiler tool that reads a Terraform provider schema (terraform providers schema -json) and generates deterministic Go structs with graph edge helpers and trait injectors.

cs codegen --schema=aws.json --output=./generated/
Flag Type Default Description
--schema string "" Required. Path to Terraform provider schema JSON
--config string "" Path to codegen config YAML
--output string ./generated Destination directory for emitted Go source files

login & logout

Authenticate your local CLI session with the CloudSlash Horizon SaaS platform via a browser-based OAuth loopback flow.

cs login     # Opens system browser for OAuth authentication
cs logout    # Destroys local session token

sync

Uploads the most recent local scan snapshot (~/.cloudslash/state/latest.json) to CloudSlash Horizon so team dashboards reflect live infrastructure.

cs sync [flags]
Flag Type Default Description
--dry-run bool false Inspect payload envelope without transmitting
--api-url string https://api.cloudslash.dev Override destination Horizon API base URL

status

Provides an immediate terminal snapshot of discovered nodes, active waste, estimated monthly savings, and drift counts.

cs status

history

Queries the persistent event ledger in BadgerDB (~/.cloudslash/data/eventstore) containing records of scans, approvals, policy changes, and remediations.

cs history [flags]
Flag Type Default Description
--since string "" Filter events by duration (3d, 12h) or timestamp
--type string "" Filter by event type (SCAN_COMPLETED, SAU_ACTION, etc.)
--crn string "" Display complete lifecycle timeline for a resource CRN
--limit int 50 Maximum number of events returned
--json bool false Stream results in machine-readable JSON format

upgrade

Checks GitHub Releases for new CloudSlash versions and performs an atomic binary swap.

cs upgrade [flags]
Flag Type Default Description
--check bool false Check for newer releases without downloading
--force bool false Bypass interactive confirmation prompt

uninstall

Safely cleans up CloudSlash storage (~/.cloudslash), terminates daemon processes, and displays removal instructions.

cs uninstall [flags]
Flag Type Default Description
--force bool false Skip confirmation prompt
--keep-config bool false Preserve config.yaml and .cloudslash.yaml