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
.envfiles 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:| Command | Description |
|---|---|
sentry auth | Login, logout, check authentication status |
sentry org | List and view organizations |
sentry project | List and view projects |
sentry issue | List, view, explain, and plan issues |
sentry event | View event details |
sentry api | Make 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
-wflag to open any resource directly in your browser
For AI Agents
- JSON output: All commands support
--jsonfor 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_TOKENfor non-interactive authentication - Scriptable commands: Integrate with deployment and monitoring workflows
- Direct API access: Use
sentry apifor custom operations
Example Workflow
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