Skip to main content

Introduction to Sentry CLI

Sentry CLI is a modern command-line interface for Sentry, built with Bun and designed for both developers and AI agents. It provides powerful tools for debugging, monitoring, and managing your Sentry projects directly from your terminal.

What is Sentry CLI?

Sentry CLI is a unified command-line tool that gives you direct access to your Sentry organization, projects, issues, and events. It eliminates the need to switch between your code and the browser by bringing Sentry’s monitoring and debugging capabilities into your development workflow.
Sentry CLI is built for speed with native binaries, SQLite caching, and automatic project detection from your codebase.

Key Benefits

Zero-Config Experience

Automatically detects your project from DSNs in .env files or source code. No flags, no manual configuration needed.

AI-Powered Debugging

Get root cause analysis and fix plans powered by Seer AI directly in your terminal with sentry issue explain and sentry issue plan.

Monorepo Support

Works seamlessly with multiple projects in a single repository. Generates short aliases for easy navigation between projects.

Agent-Friendly Output

All commands support --json output for scripting, pipelines, and integration with AI coding agents.

Core Features

DSN Auto-Detection

Sentry CLI scans your codebase to automatically identify your project:
  • Searches .env files for Sentry configuration
  • Parses source code across JavaScript, Python, Go, Java, Ruby, and PHP
  • Walks up from your current directory to find project boundaries
  • Caches project information for fast repeated access

Multi-Region Support

Seamlessly works with Sentry’s global infrastructure:
  • Automatic region detection (us.sentry.io, de.sentry.io, etc.)
  • Fan-out to regional APIs when needed
  • Caches region mappings for your organizations

Comprehensive Commands

Access all major Sentry resources:
CommandDescription
sentry authLogin, logout, check authentication status
sentry orgList and view organizations
sentry projectList and view projects
sentry issueList, view, explain, and plan issues
sentry eventView event details
sentry apiMake direct API requests

Secure Credential Storage

Authentication tokens are stored securely in ~/.sentry/ with restricted file permissions (mode 600), ensuring your credentials remain protected.
Supports both OAuth device flow for interactive login and API tokens for CI/CD environments.

Use Cases

For Developers

  • Quick issue triage: List and filter issues without leaving your terminal
  • Deep debugging: Get AI-powered explanations for complex errors
  • Project management: View project configuration and recent activity
  • Browser shortcuts: Use -w flag to open any resource directly in your browser

For AI Agents

  • JSON output: All commands support --json for programmatic access
  • Predictable behavior: Consistent command structure and error handling
  • Batch operations: Script multiple operations with reliable exit codes
  • Context detection: Automatic project detection reduces configuration overhead

For CI/CD Pipelines

  • Environment variable auth: Use SENTRY_AUTH_TOKEN for non-interactive authentication
  • Scriptable commands: Integrate with deployment and monitoring workflows
  • Direct API access: Use sentry api for custom operations

Example Workflow

# Authenticate once
sentry auth login

# Navigate to your project directory
cd ~/my-project

# List recent issues (auto-detects project from your codebase)
sentry issue list

# Get AI-powered root cause analysis
sentry issue explain PROJ-ABC

# Generate a fix plan
sentry issue plan PROJ-ABC

# Open issue in browser for more details
sentry issue view PROJ-ABC -w

Technical Architecture

Sentry CLI is built on modern technologies:
  • Runtime: Bun for fast startup and execution
  • CLI Framework: Stricli for robust command parsing
  • API Client: Type-safe HTTP client with automatic retry and caching
  • Local Storage: SQLite database for caching project data, regions, and auth tokens
  • Platform Support: Native binaries for macOS (x64/ARM64), Linux (x64/ARM64), and Windows (x64)
Sentry CLI requires Node.js 22+ when installed via npm, or can be run directly with the native binary.

Next Steps

Installation

Install Sentry CLI using your preferred method

Quick Start

Get started with authentication and basic commands

Build docs developers (and LLMs) love