Skip to content

CLI Commands

This document provides a complete reference for the Unfault CLI. Each command is listed with its options, defaults, and examples.

CommandPurpose
reviewAnalyze code for production-readiness
askQuery project health using natural language
graphExplore code dependencies and impact
configManage CLI settings
loginAuthenticate with Unfault
statusCheck authentication and connectivity
lspStart the language server for IDE integration

Analyze code and get recommendations.

Terminal window
unfault review [OPTIONS]
OptionDescriptionDefault
--output <FORMAT>Output format: basic, concise, full, json, sarifbasic
-v, --verboseEnable verbose output (dumps raw API responses)Disabled
--profile <PROFILE>Override the detected profile (e.g., python_fastapi_backend)Auto-detected
-d, --dimension <DIM>Dimensions to analyze (can be repeated). Options: stability, correctness, performance, scalabilityAll from profile
--dry-runShow fixes without applying themDisabled
--include-testsInclude test files in analysisDisabled
--discover-observabilityDiscover and link SLOs from cloud platforms (GCP, Datadog, Dynatrace)Disabled
FormatUse Case
basicDefault. Shows header, summary, and guidance on next steps.
conciseBrief statistics only. Good for dashboards.
fullDetailed findings with file locations and suggested fixes.
jsonMachine-readable. Use for CI/CD parsing or custom tooling.
sarifGitHub Code Scanning and IDE integration.
Terminal window
# Standard review
unfault review
# Focus on stability issues only
unfault review --dimension stability
# Full details with suggested fixes
unfault review --output full
# JSON for CI parsing
unfault review --output json
# Include test files
unfault review --include-tests
# Discover and link SLOs
unfault review --discover-observability

Ask questions about project health using natural language. Uses RAG (retrieval-augmented generation) to find relevant context from past reviews.

Terminal window
unfault ask [OPTIONS] <QUERY>
ArgumentDescription
<QUERY>Natural language question about your project
OptionDescriptionDefault
-w, --workspace <ID>Scope query to a specific workspace IDAuto-detected
-p, --path <PATH>Workspace path for auto-detectionCurrent directory
--max-sessions <N>Maximum session contexts to retrieve (1-20)5
--max-findings <N>Maximum finding contexts to retrieve (1-50)10
--threshold <T>Minimum similarity threshold (0.0-1.0)0.5
--jsonOutput as JSONDisabled
--llmUse configured LLM for synthesized answerDisabled
-v, --verboseEnable verbose outputDisabled
Terminal window
# Basic question
unfault ask "What are my main stability concerns?"
# Get LLM-synthesized answer
unfault ask "How do we handle database timeouts?" --llm
# Scope to specific path
unfault ask "Performance issues" --path src/api
# More context, stricter matching
unfault ask "Error handling patterns" --max-findings 20 --threshold 0.7

Query the code graph for dependencies, impact analysis, and critical files.

Terminal window
unfault graph <SUBCOMMAND>
SubcommandPurpose
impactWhat breaks if I change this file?
function-impactWhat breaks if I change this function?
libraryWhich files use a specific library?
depsWhat does this file depend on?
criticalWhich files are most critical?
statsCode graph statistics
dumpDump graph for debugging

Analyze what depends on a file. Useful before refactoring.

Terminal window
unfault graph impact [OPTIONS] <FILE>
OptionDescriptionDefault
<FILE>File path to analyzeRequired
-w, --workspace <PATH>Workspace pathCurrent directory
--max-depth <N>Transitive analysis depth (1-10)5
--jsonOutput as JSONDisabled
-v, --verboseVerbose outputDisabled
Terminal window
unfault graph impact src/api/auth.py
unfault graph impact --max-depth 3 src/core/models.py

Analyze what depends on a specific function.

Terminal window
unfault graph function-impact [OPTIONS] <FUNCTION>
OptionDescriptionDefault
<FUNCTION>Function in format file:functionRequired
-w, --workspace <PATH>Workspace pathCurrent directory
--max-depth <N>Transitive analysis depth (1-10)5
--jsonOutput as JSONDisabled
Terminal window
unfault graph function-impact src/api/auth.py:validate_token

Find files that use a specific library.

Terminal window
unfault graph library [OPTIONS] <LIBRARY>
OptionDescriptionDefault
<LIBRARY>Library name (e.g., requests, fastapi)Required
-w, --workspace <PATH>Workspace pathCurrent directory
--jsonOutput as JSONDisabled
Terminal window
unfault graph library requests
unfault graph library sqlalchemy --json

Find external dependencies of a file.

Terminal window
unfault graph deps [OPTIONS] <FILE>
OptionDescriptionDefault
<FILE>File path to analyzeRequired
-w, --workspace <PATH>Workspace pathCurrent directory
--jsonOutput as JSONDisabled
Terminal window
unfault graph deps src/api/routes.py

Find the most critical files in the codebase (high connectivity, many dependents).

Terminal window
unfault graph critical [OPTIONS]
OptionDescriptionDefault
-n, --limit <N>Number of files to return (1-50)10
--sort-by <METRIC>Sort metric (see below)in-degree
-w, --workspace <PATH>Workspace pathCurrent directory
--jsonOutput as JSONDisabled

Sort metrics:

MetricMeaning
in-degreeFiles most imported by others
out-degreeFiles that import the most
total-degreeTotal connectivity
library-usageExternal libraries used
importance-scoreWeighted importance
Terminal window
unfault graph critical
unfault graph critical --limit 20 --sort-by total-degree

Get code graph statistics.

Terminal window
unfault graph stats [OPTIONS]
OptionDescriptionDefault
-w, --workspace <PATH>Workspace pathCurrent directory
--jsonOutput as JSONDisabled

Dump the local code graph for debugging.

Terminal window
unfault graph dump [OPTIONS]
OptionDescriptionDefault
-w, --workspace <PATH>Workspace pathCurrent directory
--calls-onlyOutput only call edgesDisabled
--file <FILE>Dump only specific fileAll files

Manage CLI configuration.

Terminal window
unfault config <SUBCOMMAND>
SubcommandPurpose
showDisplay current configuration
llmManage LLM configuration

Display current configuration.

Terminal window
unfault config show

Configure an LLM provider for AI-powered features like unfault ask --llm.

Terminal window
unfault config llm <PROVIDER>
Terminal window
unfault config llm openai [OPTIONS]
OptionDescriptionDefault
-m, --model <MODEL>Model namegpt-4
-k, --api-key <KEY>API key (prefers OPENAI_API_KEY env var)From env
Terminal window
unfault config llm openai --model gpt-4o
Terminal window
unfault config llm anthropic [OPTIONS]
OptionDescriptionDefault
-m, --model <MODEL>Model nameclaude-3-5-sonnet-latest
-k, --api-key <KEY>API key (prefers ANTHROPIC_API_KEY env var)From env
Terminal window
unfault config llm anthropic --model claude-sonnet-4-5
Terminal window
unfault config llm ollama [OPTIONS]
OptionDescriptionDefault
-e, --endpoint <URL>Ollama API endpointhttp://localhost:11434
-m, --model <MODEL>Model namellama3.2
Terminal window
unfault config llm ollama --model mistral
Terminal window
unfault config llm custom --endpoint <URL> --model <MODEL> [OPTIONS]
OptionDescriptionDefault
-e, --endpoint <URL>API endpointRequired
-m, --model <MODEL>Model nameRequired
-k, --api-key <KEY>API keyNone
Terminal window
unfault config llm custom --endpoint https://api.together.xyz/v1 --model meta-llama/Llama-3-70b-chat-hf
Terminal window
# Show current LLM configuration
unfault config llm show
# Remove LLM configuration
unfault config llm remove

Authenticate with Unfault using device flow. Opens a browser for secure authentication.

Terminal window
unfault login

No options. Follow the prompts to complete authentication.


Check authentication and service connectivity.

Terminal window
unfault status

Shows:

  • Authentication status
  • API connectivity
  • Workspace detection
  • LLM configuration (if any)

Start the Language Server Protocol server for IDE integration.

Terminal window
unfault lsp [OPTIONS]
OptionDescriptionDefault
-v, --verboseEnable verbose logging to stderrDisabled

The CLI uses exit codes to communicate results:

CodeMeaningAction
0Success, no findingsProceed
1General errorCheck error message
2Configuration errorCheck config, run unfault status
3Authentication failedRun unfault login
4Network errorCheck connectivity
5Findings detectedReview findings
6Invalid inputCheck arguments
7Service unavailableRetry later
8Session errorRetry analysis
10Subscription requiredUpgrade plan

Common variables:

VariableDescription
UNFAULT_API_KEYAPI key for authentication (CI/CD)
UNFAULT_BASE_URLOverride API endpoint (enterprise)
OPENAI_API_KEYOpenAI API key for ask --llm
ANTHROPIC_API_KEYAnthropic API key for ask --llm

For SLO discovery and the complete list, see Configuration: Environment Variables.


The CLI stores configuration in:

PlatformLocation
Linux~/.config/unfault/config.json
macOS~/.config/unfault/config.json
Windows%USERPROFILE%\.config\unfault\config.json