Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@stricli/auto-complete": "^1.2.4",
"@stricli/core": "^1.2.4",
"@types/bun": "latest",
"@types/http-cache-semantics": "^4.2.0",
"@types/node": "^22",
"@types/qrcode-terminal": "^0.12.2",
"@types/semver": "^7.7.1",
Expand All @@ -22,6 +23,7 @@
"cli-highlight": "^2.1.11",
"esbuild": "^0.25.0",
"fast-check": "^4.5.3",
"http-cache-semantics": "^4.2.0",
"ignore": "^7.0.5",
"marked": "^15",
"p-limit": "^7.2.0",
Expand Down
26 changes: 26 additions & 0 deletions plugins/sentry-cli/skills/sentry-cli/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ View authentication status

**Flags:**
- `--show-token - Show the stored token (masked by default)`
- `-f, --fresh - Bypass cache and fetch fresh data`

**Examples:**

Expand All @@ -106,6 +107,7 @@ Show the currently authenticated user

**Flags:**
- `--json - Output as JSON`
- `-f, --fresh - Bypass cache and fetch fresh data`

### Org

Expand All @@ -118,6 +120,7 @@ List organizations
**Flags:**
- `-n, --limit <value> - Maximum number of organizations to list - (default: "30")`
- `--json - Output JSON`
- `-f, --fresh - Bypass cache and fetch fresh data`

**Examples:**

Expand All @@ -134,6 +137,7 @@ View details of an organization
**Flags:**
- `--json - Output as JSON`
- `-w, --web - Open in browser`
- `-f, --fresh - Bypass cache and fetch fresh data`

**Examples:**

Expand Down Expand Up @@ -166,6 +170,7 @@ List projects
- `--json - Output JSON`
- `-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 and fetch fresh data`

**Examples:**

Expand All @@ -187,6 +192,7 @@ View details of a project
**Flags:**
- `--json - Output as JSON`
- `-w, --web - Open in browser`
- `-f, --fresh - Bypass cache and fetch fresh data`

**Examples:**

Expand Down Expand Up @@ -220,6 +226,7 @@ List issues in a project
- `-t, --period <value> - Time period for issue activity (e.g. 24h, 14d, 90d) - (default: "90d")`
- `--json - Output JSON`
- `-c, --cursor <value> - Pagination cursor for <org>/ or multi-target modes (use "last" to continue)`
- `-f, --fresh - Bypass cache and fetch fresh data`

**Examples:**

Expand Down Expand Up @@ -264,6 +271,7 @@ Analyze an issue's root cause using Seer AI
**Flags:**
- `--json - Output as JSON`
- `--force - Force new analysis even if one exists`
- `-f, --fresh - Bypass cache and fetch fresh data`

**Examples:**

Expand Down Expand Up @@ -291,6 +299,7 @@ Generate a solution plan using Seer AI
- `--cause <value> - Root cause ID to plan (required if multiple causes exist)`
- `--json - Output as JSON`
- `--force - Force new plan even if one exists`
- `-f, --fresh - Bypass cache and fetch fresh data`

**Examples:**

Expand Down Expand Up @@ -318,6 +327,7 @@ View details of a specific issue
- `--json - Output as JSON`
- `-w, --web - Open in browser`
- `--spans <value> - Span tree depth limit (number, "all" for unlimited, "no" to disable) - (default: "3")`
- `-f, --fresh - Bypass cache and fetch fresh data`

**Examples:**

Expand Down Expand Up @@ -345,6 +355,7 @@ View details of a specific event
- `--json - Output as JSON`
- `-w, --web - Open in browser`
- `--spans <value> - Span tree depth limit (number, "all" for unlimited, "no" to disable) - (default: "3")`
- `-f, --fresh - Bypass cache and fetch fresh data`

**Examples:**

Expand Down Expand Up @@ -467,6 +478,7 @@ List repositories
- `-n, --limit <value> - Maximum number of repositories to list - (default: "30")`
- `--json - Output JSON`
- `-c, --cursor <value> - Pagination cursor (use "last" to continue from previous page)`
- `-f, --fresh - Bypass cache and fetch fresh data`

### Team

Expand All @@ -480,6 +492,7 @@ List teams
- `-n, --limit <value> - Maximum number of teams to list - (default: "30")`
- `--json - Output JSON`
- `-c, --cursor <value> - Pagination cursor (use "last" to continue from previous page)`
- `-f, --fresh - Bypass cache and fetch fresh data`

**Examples:**

Expand Down Expand Up @@ -510,6 +523,7 @@ List logs from a project
- `-f, --follow <value> - Stream logs (optionally specify poll interval in seconds)`
- `--trace <value> - Filter logs by trace ID (32-character hex string)`
- `--json - Output as JSON`
- `--fresh - Bypass cache and fetch fresh data`

**Examples:**

Expand Down Expand Up @@ -555,6 +569,7 @@ View details of a specific log entry
**Flags:**
- `--json - Output as JSON`
- `-w, --web - Open in browser`
- `-f, --fresh - Bypass cache and fetch fresh data`

**Examples:**

Expand Down Expand Up @@ -591,6 +606,7 @@ List recent traces in a project
- `-s, --sort <value> - Sort by: date, duration - (default: "date")`
- `-c, --cursor <value> - Pagination cursor (use "last" to continue from previous page)`
- `--json - Output as JSON`
- `-f, --fresh - Bypass cache and fetch fresh data`

#### `sentry trace view <args...>`

Expand All @@ -600,6 +616,7 @@ View details of a specific trace
- `--json - Output as JSON`
- `-w, --web - Open in browser`
- `--spans <value> - Span tree depth limit (number, "all" for unlimited, "no" to disable) - (default: "3")`
- `-f, --fresh - Bypass cache and fetch fresh data`

#### `sentry trace logs <args...>`

Expand All @@ -611,6 +628,7 @@ View logs associated with a trace
- `-t, --period <value> - Time period to search (e.g., "14d", "7d", "24h"). Default: 14d - (default: "14d")`
- `-n, --limit <value> - Number of log entries (1-1000) - (default: "100")`
- `-q, --query <value> - Additional filter query (Sentry search syntax)`
- `-f, --fresh - Bypass cache and fetch fresh data`

### Issues

Expand All @@ -627,6 +645,7 @@ List issues in a project
- `-t, --period <value> - Time period for issue activity (e.g. 24h, 14d, 90d) - (default: "90d")`
- `--json - Output JSON`
- `-c, --cursor <value> - Pagination cursor for <org>/ or multi-target modes (use "last" to continue)`
- `-f, --fresh - Bypass cache and fetch fresh data`

### Orgs

Expand All @@ -639,6 +658,7 @@ List organizations
**Flags:**
- `-n, --limit <value> - Maximum number of organizations to list - (default: "30")`
- `--json - Output JSON`
- `-f, --fresh - Bypass cache and fetch fresh data`

### Projects

Expand All @@ -653,6 +673,7 @@ List projects
- `--json - Output JSON`
- `-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 and fetch fresh data`

### Repos

Expand All @@ -666,6 +687,7 @@ List repositories
- `-n, --limit <value> - Maximum number of repositories to list - (default: "30")`
- `--json - Output JSON`
- `-c, --cursor <value> - Pagination cursor (use "last" to continue from previous page)`
- `-f, --fresh - Bypass cache and fetch fresh data`

### Teams

Expand All @@ -679,6 +701,7 @@ List teams
- `-n, --limit <value> - Maximum number of teams to list - (default: "30")`
- `--json - Output JSON`
- `-c, --cursor <value> - Pagination cursor (use "last" to continue from previous page)`
- `-f, --fresh - Bypass cache and fetch fresh data`

### Logs

Expand All @@ -694,6 +717,7 @@ List logs from a project
- `-f, --follow <value> - Stream logs (optionally specify poll interval in seconds)`
- `--trace <value> - Filter logs by trace ID (32-character hex string)`
- `--json - Output as JSON`
- `--fresh - Bypass cache and fetch fresh data`

### Traces

Expand All @@ -709,6 +733,7 @@ List recent traces in a project
- `-s, --sort <value> - Sort by: date, duration - (default: "date")`
- `-c, --cursor <value> - Pagination cursor (use "last" to continue from previous page)`
- `--json - Output as JSON`
- `-f, --fresh - Bypass cache and fetch fresh data`

### Whoami

Expand All @@ -720,6 +745,7 @@ Show the currently authenticated user

**Flags:**
- `--json - Output as JSON`
- `-f, --fresh - Bypass cache and fetch fresh data`

## Output Formats

Expand Down
15 changes: 15 additions & 0 deletions src/commands/auth/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { AuthError } from "../../lib/errors.js";
import { muted, success } from "../../lib/formatters/colors.js";
import { formatUserIdentity } from "../../lib/formatters/human.js";
import { runInteractiveLogin } from "../../lib/interactive-login.js";
import { clearResponseCache } from "../../lib/response-cache.js";

type LoginFlags = {
readonly token?: string;
Expand Down Expand Up @@ -52,6 +53,13 @@ export const loginCommand = buildCommand({

// Token-based authentication
if (flags.token) {
// Clear stale cached responses from a previous session
try {
await clearResponseCache();
} catch {
// Non-fatal: cache directory may not exist
}

// Save token first, then validate by fetching user regions
await setAuthToken(flags.token);

Expand Down Expand Up @@ -90,6 +98,13 @@ export const loginCommand = buildCommand({
return;
}

// Clear stale cached responses from a previous session
try {
await clearResponseCache();
} catch {
// Non-fatal: cache directory may not exist
}

// Device Flow OAuth
const loginSuccess = await runInteractiveLogin(
stdout,
Expand Down
9 changes: 9 additions & 0 deletions src/commands/auth/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,16 @@ import {
formatUserIdentity,
maskToken,
} from "../../lib/formatters/human.js";
import {
applyFreshFlag,
FRESH_ALIASES,
FRESH_FLAG,
} from "../../lib/list-command.js";
import type { Writer } from "../../types/index.js";

type StatusFlags = {
readonly "show-token": boolean;
readonly fresh: boolean;
};

/**
Expand Down Expand Up @@ -131,9 +137,12 @@ export const statusCommand = buildCommand({
brief: "Show the stored token (masked by default)",
default: false,
},
fresh: FRESH_FLAG,
},
aliases: FRESH_ALIASES,
},
async func(this: SentryContext, flags: StatusFlags): Promise<void> {
applyFreshFlag(flags);
const { stdout, stderr } = this;

const auth = await getAuthConfig();
Expand Down
9 changes: 9 additions & 0 deletions src/commands/auth/whoami.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ import { isAuthenticated } from "../../lib/db/auth.js";
import { setUserInfo } from "../../lib/db/user.js";
import { AuthError } from "../../lib/errors.js";
import { formatUserIdentity, writeJson } from "../../lib/formatters/index.js";
import {
applyFreshFlag,
FRESH_ALIASES,
FRESH_FLAG,
} from "../../lib/list-command.js";

type WhoamiFlags = {
readonly json: boolean;
readonly fresh: boolean;
};

export const whoamiCommand = buildCommand({
Expand All @@ -33,9 +39,12 @@ export const whoamiCommand = buildCommand({
brief: "Output as JSON",
default: false,
},
fresh: FRESH_FLAG,
},
aliases: FRESH_ALIASES,
},
async func(this: SentryContext, flags: WhoamiFlags): Promise<void> {
applyFreshFlag(flags);
const { stdout } = this;

if (!(await isAuthenticated())) {
Expand Down
10 changes: 9 additions & 1 deletion src/commands/event/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ import { openInBrowser } from "../../lib/browser.js";
import { buildCommand } from "../../lib/command.js";
import { ContextError, ResolutionError } from "../../lib/errors.js";
import { formatEventDetails, writeJson } from "../../lib/formatters/index.js";
import {
applyFreshFlag,
FRESH_ALIASES,
FRESH_FLAG,
} from "../../lib/list-command.js";
import { resolveEffectiveOrg } from "../../lib/region.js";
import {
resolveOrgAndProject,
Expand All @@ -38,6 +43,7 @@ type ViewFlags = {
readonly json: boolean;
readonly web: boolean;
readonly spans: number;
readonly fresh: boolean;
};

type HumanOutputOptions = {
Expand Down Expand Up @@ -301,14 +307,16 @@ export const viewCommand = buildCommand({
default: false,
},
...spansFlag,
fresh: FRESH_FLAG,
},
aliases: { w: "web" },
aliases: { ...FRESH_ALIASES, w: "web" },
},
async func(
this: SentryContext,
flags: ViewFlags,
...args: string[]
): Promise<void> {
applyFreshFlag(flags);
const { stdout, cwd } = this;

// Parse positional args
Expand Down
Loading