sentry-cli
此技能指导用户如何通过Sentry CLI从命令行与Sentry进行交互,前提是CLI已安装并完成认证。
npx skills add sentry/dev --skill sentry-cliBefore / After 效果对比
1 组传统Sentry操作依赖网页界面,效率不高。处理大量事件或自动化任务时,手动操作耗时且易出错。
通过Sentry CLI,命令行快速交互Sentry。实现事件管理自动化,显著提升错误监控与处理效率。
sentry-cli
Sentry CLI Usage Guide
Help users interact with Sentry from the command line using the sentry CLI.
Prerequisites
The CLI must be installed and authenticated before use.
Installation
curl https://cli.sentry.dev/install -fsS | bash
curl https://cli.sentry.dev/install -fsS | bash -s -- --version nightly
brew install getsentry/tools/sentry
# Or install via npm/pnpm/bun
npm install -g sentry
Authentication
sentry auth login
sentry auth login --token YOUR_SENTRY_API_TOKEN
sentry auth status
sentry auth logout
Available Commands
Auth
Authenticate with Sentry
sentry auth login
Authenticate with Sentry
Flags:
-
--token <value> - Authenticate using an API token instead of OAuth -
--timeout <value> - Timeout for OAuth flow in seconds (default: 900) - (default: "900") -
--force - Re-authenticate without prompting -
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
Examples:
# OAuth device flow (recommended)
sentry auth login
# Using an API token
sentry auth login --token YOUR_TOKEN
SENTRY_URL=https://sentry.example.com SENTRY_CLIENT_ID=your-client-id sentry auth login
SENTRY_URL=https://sentry.example.com sentry auth login --token YOUR_TOKEN
sentry auth logout
Log out of Sentry
Flags:
-
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
Examples:
sentry auth logout
sentry auth refresh
Refresh your authentication token
Flags:
-
--force - Force refresh even if token is still valid -
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
Examples:
sentry auth refresh
sentry auth status
View authentication status
Flags:
-
--show-token - Show the stored token (masked by default) -
-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data -
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
Examples:
sentry auth status
sentry auth token
Print the stored authentication token
Flags:
-
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
sentry auth whoami
Show the currently authenticated user
Flags:
-
-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data -
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
Org
Work with Sentry organizations
sentry org list
List organizations
Flags:
-
-n, --limit <value> - Maximum number of organizations to list - (default: "30") -
-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data -
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
Examples:
sentry org list
sentry org list --json
sentry org view <org>
View details of an organization
Flags:
-
-w, --web - Open in browser -
-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data -
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
Examples:
sentry org view <org-slug>
sentry org view my-org
sentry org view my-org -w
Project
Work with Sentry projects
sentry project create <name> <platform>
Create a new project
Flags:
-
-t, --team <value> - Team to create the project under -
-n, --dry-run - Validate inputs and show what would be created without creating it -
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
sentry project delete <org/project>
Delete a project
Flags:
-
-y, --yes - Skip confirmation prompt -
-f, --force - Force deletion without confirmation -
-n, --dry-run - Validate and show what would be deleted without deleting -
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
sentry project list <org/project>
List projects
Flags:
-
-n, --limit <value> - Maximum number of projects to list - (default: "30") -
-c, --cursor <value> - Pagination cursor (use "last" to continue from previous page) -
-p, --platform <value> - Filter by platform (e.g., javascript, python) -
-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data -
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
Examples:
# List all projects
sentry project list
# List projects in a specific organization
sentry project list <org-slug>
# Filter by platform
sentry project list --platform javascript
sentry project view <org/project>
View details of a project
Flags:
-
-w, --web - Open in browser -
-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data -
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
Examples:
# Auto-detect from DSN or config
sentry project view
# Explicit org and project
sentry project view <org>/<project>
# Find project across all orgs
sentry project view <project>
sentry project view my-org/frontend
sentry project view my-org/frontend -w
Issue
Manage Sentry issues
sentry issue list <org/project>
List issues in a project
Flags:
-
-q, --query <value> - Search query (Sentry search syntax) -
-n, --limit <value> - Maximum number of issues to list - (default: "25") -
-s, --sort <value> - Sort by: date, new, freq, user - (default: "date") -
-t, --period <value> - Time period for issue activity (e.g. 24h, 14d, 90d) - (default: "90d") -
-c, --cursor <value> - Pagination cursor for <org>/ or multi-target modes (use "last" to continue) -
-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data -
--compact - Single-line rows for compact output (auto-detects if omitted) -
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
Examples:
# Explicit org and project
sentry issue list <org>/<project>
# All projects in an organization
sentry issue list <org>/
# Search for project across all accessible orgs
sentry issue list <project>
# Auto-detect from DSN or config
sentry issue list
# List issues in a specific project
sentry issue list my-org/frontend
sentry issue list my-org/
sentry issue list frontend
sentry issue list my-org/frontend --query "TypeError"
sentry issue list my-org/frontend --sort freq --limit 20
# Show only unresolved issues
sentry issue list my-org/frontend --query "is:unresolved"
# Show resolved issues
sentry issue list my-org/frontend --query "is:resolved"
# Combine with other search terms
sentry issue list my-org/frontend --query "is:unresolved TypeError"
sentry issue explain <issue>
Analyze an issue's root cause using Seer AI
Flags:
-
--force - Force new analysis even if one exists -
-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data -
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
Examples:
sentry issue explain <issue-id>
# By numeric issue ID
sentry issue explain 123456789
# By short ID with org prefix
sentry issue explain my-org/MYPROJECT-ABC
# By project-suffix format
sentry issue explain myproject-G
# Force a fresh analysis
sentry issue explain 123456789 --force
sentry issue plan <issue>
Generate a solution plan using Seer AI
Flags:
-
--cause <value> - Root cause ID to plan (required if multiple causes exist) -
--force - Force new plan even if one exists -
-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data -
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
Examples:
sentry issue plan <issue-id>
# After running explain, create a plan
sentry issue plan 123456789
# Specify which root cause to plan for (if multiple were found)
sentry issue plan 123456789 --cause 0
# By short ID with org prefix
sentry issue plan my-org/MYPROJECT-ABC --cause 1
# By project-suffix format
sentry issue plan myproject-G --cause 0
sentry issue view <issue>
View details of a specific issue
Flags:
-
-w, --web - Open in browser -
--spans <value> - Span tree depth limit (number, "all" for unlimited, "no" to disable) - (default: "3") -
-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data -
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
Examples:
# By issue ID
sentry issue view <issue-id>
# By short ID
sentry issue view <short-id>
sentry issue view FRONT-ABC
sentry issue view FRONT-ABC -w
Event
View Sentry events
sentry event view <args...>
View details of a specific event
Flags:
-
-w, --web - Open in browser -
--spans <value> - Span tree depth limit (number, "all" for unlimited, "no" to disable) - (default: "3") -
-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data -
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
Examples:
sentry event view <event-id>
sentry event view abc123def456
sentry event view abc123def456 -w
Api
Make an authenticated API request
sentry api <endpoint>
Make an authenticated API request
Flags:
-
-X, --method <value> - The HTTP method for the request - (default: "GET") -
-d, --data <value> - Inline JSON body for the request (like curl -d) -
-F, --field <value>... - Add a typed parameter (key=value, key[sub]=value, key[]=value) -
-f, --raw-field <value>... - Add a string parameter without JSON parsing -
-H, --header <value>... - Add a HTTP request header in key:value format -
--input <value> - The file to use as body for the HTTP request (use "-" to read from standard input) -
--silent - Do not print the response body -
--verbose - Include full HTTP request and response in the output -
-n, --dry-run - Show the resolved request without sending it -
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
Examples:
sentry api <endpoint> [options]
# List organizations
sentry api /organizations/
# Get a specific organization
sentry api /organizations/my-org/
# Get project details
sentry api /projects/my-org/my-project/
# Create a new project
sentry api /teams/my-org/my-team/projects/ \
--method POST \
--field name="New Project" \
--field platform=javascript
# Update an issue status
sentry api /issues/123456789/ \
--method PUT \
--field status=resolved
# Assign an issue
sentry api /issues/123456789/ \
--method PUT \
--field assignedTo="user@example.com"
# Delete a project
sentry api /projects/my-org/my-project/ \
--method DELETE
sentry api /organizations/ \
--header "X-Custom-Header:value"
sentry api /organizations/ --verbose
# Get all issues (automatically follows pagination)
sentry api /projects/my-org/my-project/issues/ --paginate
Cli
CLI-related commands
sentry cli feedback <message...>
Send feedback about the CLI
Flags:
-
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
sentry cli fix
Diagnose and repair CLI database issues
Flags:
-
--dry-run - Show what would be fixed without making changes -
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
sentry cli setup
Configure shell integration
Flags:
-
--install - Install the binary from a temp location to the system path -
--method <value> - Installation method (curl, npm, pnpm, bun, yarn) -
--channel <value> - Release channel to persist (stable or nightly) -
--no-modify-path - Skip PATH modification -
--no-completions - Skip shell completion installation -
--no-agent-skills - Skip agent skill installation for AI coding assistants -
--quiet - Suppress output (for scripted usage) -
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
sentry cli upgrade <version>
Update the Sentry CLI to the latest version
Flags:
-
--check - Check for updates without installing -
--force - Force upgrade even if already on the latest version -
--offline - Upgrade using only cached version info and patches (no network) -
--method <value> - Installation method to use (curl, brew, npm, pnpm, bun, yarn) -
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
Dashboard
Manage Sentry dashboards
sentry dashboard list <org/project>
List dashboards
Flags:
-
-w, --web - Open in browser -
-n, --limit <value> - Maximum number of dashboards to list - (default: "30") -
-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data -
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
sentry dashboard view <args...>
View a dashboard
Flags:
-
-w, --web - Open in browser -
-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data -
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
sentry dashboard create <args...>
Create a dashboard
Flags:
-
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
Repo
Work with Sentry repositories
sentry repo list <org/project>
List repositories
Flags:
-
-n, --limit <value> - Maximum number of repositories to list - (default: "30") -
-c, --cursor <value> - Pagination cursor (use "last" to continue from previous page) -
-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data -
--json - Output as JSON -
--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)
Team
Work with Sentry teams
sentry team list <org/project>
List teams
Flags:
-
-n, --limit <value> - Maximum number of teams to list - (default: "30") -
`-c, --cursor - P
...
用户评价 (0)
发表评价
暂无评价
统计数据
用户评分
为此 Skill 评分