Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
b36b810
feat(local): add command to run a local Spotlight sidecar
MathurAditya724 Apr 29, 2026
3beec45
feat(local): pretty-print errors, transactions, and logs in tail output
MathurAditya724 May 5, 2026
d030cab
feat(local): add --filter/-f flag to show only specific event types
MathurAditya724 May 5, 2026
bda0e68
fix(local): fix signal handling, SSE protocol, and browser SDK compat
MathurAditya724 May 5, 2026
935b060
refactor(local): remove --open flag and update docs
MathurAditya724 May 5, 2026
3c9aa7a
merge: resolve conflicts with main (AGENTS.md, package.json, bun.lock)
MathurAditya724 May 15, 2026
0afaf5a
fix(local): clean up startup banner, add port auto-retry
MathurAditya724 May 15, 2026
d0e70ad
chore(local): remove code slop from local.ts
MathurAditya724 May 15, 2026
736985f
fix(local): use logger.log for tail output to drop icon prefix
MathurAditya724 May 15, 2026
51d1538
fix(local): restrict CORS to localhost origins only
MathurAditya724 May 15, 2026
5d69091
fix(local): address Warden security findings
MathurAditya724 May 15, 2026
6676aea
feat(local): align tail formatting with Spotlight's human formatter
MathurAditya724 May 15, 2026
b6e7734
fix(local): show outermost exception for chained errors
MathurAditya724 May 15, 2026
32643be
fix(test): use case-insensitive comparison in colorizeSql property test
MathurAditya724 May 15, 2026
16731e3
feat(local): connect to existing server, backoff port retry
MathurAditya724 May 15, 2026
f411cf5
fix(local): return null from CORS origin callback for non-localhost o…
MathurAditya724 May 15, 2026
45fb65d
fix(local): address review findings, remove learn-more line
MathurAditya724 May 15, 2026
5aa1a83
fix(local): biome formatting for cors origin ternary
MathurAditya724 May 15, 2026
580b6fe
fix(local): add 2s timeout to health check fetch
MathurAditya724 May 15, 2026
722294b
fix(local): sanitize trace.op and trace.status with stripAnsi
MathurAditya724 May 15, 2026
d592e68
merge: resolve conflict with main (package.json)
MathurAditya724 May 15, 2026
5c32850
merge: regenerate pnpm-lock.yaml after merge with main
MathurAditya724 May 15, 2026
26869ed
fix(local): detect upstream disconnect in --quiet attach mode
MathurAditya724 May 15, 2026
2812025
feat(local): restructure into subcommands — server (default) and run
MathurAditya724 May 20, 2026
478e9a5
fix(local): rename subcommand 'server' to 'serve'
MathurAditya724 May 20, 2026
266f804
chore: regenerate docs
github-actions[bot] May 20, 2026
59daf6a
fix(local): correct misleading docs in run subcommand
MathurAditya724 May 20, 2026
3d74928
fix(local): guard formatters against non-string envelope fields
MathurAditya724 May 20, 2026
135d19e
fix(local): use EXIT.GENERAL for child exit code, sanitize newlines i…
MathurAditya724 May 20, 2026
662dc7d
fix(local): wrap Bun.spawn in try/catch for missing executables
MathurAditya724 May 20, 2026
a71dd3a
fix(local): sanitize lineno/colno and level in formatter output
MathurAditya724 May 20, 2026
c89ee86
fix(local): check SSE response status, guard subscriber against forma…
MathurAditya724 May 20, 2026
658bb82
fix(local): sanitize fallback label in formatFallbackLine
MathurAditya724 May 20, 2026
12803fb
fix(local): guard SSE subscriber against serialization errors
MathurAditya724 May 20, 2026
30eaf87
chore(local): remove Spotlight branding from user-facing text
MathurAditya724 May 20, 2026
3d60773
refactor(local): extract formatters, auto-start server in run, add tests
MathurAditya724 May 20, 2026
ca3356e
fix(local): forward child exit code, validate content-encoding, strip…
MathurAditya724 May 20, 2026
3c6d4e0
fix(local): clean up signal handlers after shutdown
MathurAditya724 May 20, 2026
37e4630
fix(local): use actual bound port when --port 0 is passed
MathurAditya724 May 20, 2026
3917199
fix(local): throw CliError with child exit code, case-insensitive lev…
MathurAditya724 May 20, 2026
0bc38d7
fix(local): use formatTime() in formatFallbackLine for consistent tim…
MathurAditya724 May 20, 2026
6d1b2a3
fix(local): fix run command arg passing — use rest params, strip '--'…
MathurAditya724 May 21, 2026
53b85f0
fix(local): forward SIGINT/SIGTERM to child process in run command
MathurAditya724 May 21, 2026
9104325
merge: resolve conflict with main (AGENTS.md lore → .lore.md)
MathurAditya724 May 21, 2026
ff3c8b8
fix(local): fix run command test to use rest params and Promise retur…
MathurAditya724 May 21, 2026
7a9f14b
fix(local): call server.close() before closeAllConnections()
MathurAditya724 May 21, 2026
afb5416
fix(local): add IPv6 localhost to CORS, guard null attribute values
MathurAditya724 May 21, 2026
24f6f1a
fix(local): strip C1 control characters and NEL in sanitize()
MathurAditya724 May 21, 2026
d5e46ee
fix(local): strip Unicode bidirectional override characters in saniti…
MathurAditya724 May 21, 2026
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
315 changes: 270 additions & 45 deletions bun.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/src/content/docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ cli/
│ │ ├── dashboard/ # list, view, create, add, edit, delete, revisions, restore
│ │ ├── event/ # view, list
│ │ ├── issue/ # list, events, explain, plan, view, resolve, unresolve, archive, merge
│ │ ├── local/ # serve, run
│ │ ├── log/ # list, view
│ │ ├── org/ # list, view
│ │ ├── project/ # create, delete, list, view
Expand Down
66 changes: 66 additions & 0 deletions docs/src/fragments/commands/local.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@


`sentry local` runs a local development server that captures Sentry SDK envelopes from your dev stack and surfaces errors, traces, and logs in real time — right in your terminal. No authentication required.

If a server is already running on the port, the command attaches as an SSE consumer instead of starting a duplicate.

## Examples

```bash
# Start the server and tail events (default)
sentry local

# Run your app with the local server auto-enabled
sentry local run -- npm run dev
sentry local run -- python manage.py runserver

# Use a custom port
sentry local --port 9000

# Only show errors and logs (filter out transactions)
sentry local -f error -f log

# Run quietly (suppress per-envelope tail output)
sentry local --quiet
```

## `sentry local run`

Runs a command with `SENTRY_SPOTLIGHT` injected into the environment. The Sentry SDK automatically detects this variable and sends envelopes to the local server. No code changes needed.

Env vars injected into the child process:

| Variable | Value |
|----------|-------|
| `SENTRY_SPOTLIGHT` | `http://localhost:<port>/stream` |
| `NEXT_PUBLIC_SENTRY_SPOTLIGHT` | `http://localhost:<port>/stream` |
| `SENTRY_TRACES_SAMPLE_RATE` | `1` |

## Endpoints

| Method | Path | Description |
|--------|---------------------------------|----------------------------------------------------|
| `POST` | `/stream` | Envelope ingest |
| `POST` | `/api/{projectId}/envelope/` | Sentry SDK ingest path |
| `GET` | `/stream` | Server-Sent Events feed of incoming envelopes |
| `GET` | `/health` | Liveness check (returns `OK`) |

## Tail output

By default, incoming envelopes are pretty-printed to the terminal:

```
14:32:01 [ERROR] [SERVER] TypeError: x is not a function [app.ts:42:5] [handleRequest]
14:32:02 [TRACE] [BROWSER] [http.client] GET /api/users [245ms] [3 spans]
14:32:03 [INFO] [SERVER] User logged in [user_id=1234] [region=us]
```

Errors show the exception type, message, and top stack frame. Transactions show the operation, duration, and span count. Logs show the severity level, message, and custom attributes.

Use `--filter` / `-f` to narrow the output to specific event types (repeatable):

```bash
sentry local -f error -f log # only errors and logs
```

Use `--quiet` to suppress tail output entirely if you only need the SSE stream.
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
"@anthropic-ai/sdk": "^0.39.0",
"@biomejs/biome": "2.3.8",
"@clack/prompts": "0.11.0",
"@hono/node-server": "^2.0.0",
"@mastra/client-js": "^1.4.0",
"@sentry/api": "^0.141.0",
"@sentry/core": "10.50.0",
"@sentry/node-core": "10.50.0",
"@sentry/sqlish": "^1.0.0",
"@spotlightjs/spotlight": "^4.11.3",
"@stricli/auto-complete": "^1.2.4",
"@stricli/core": "^1.2.4",
"@types/bun": "latest",
Expand All @@ -30,6 +32,7 @@
"consola": "^3.4.2",
"esbuild": "^0.25.0",
"fast-check": "^4.5.3",
"hono": "^4.12.15",
"http-cache-semantics": "^4.2.0",
"ignore": "^7.0.5",
"ink": "^7.0.1",
Expand Down Expand Up @@ -116,5 +119,10 @@
"check:docs-sections": "bun run script/generate-docs-sections.ts --check"
},
"type": "module",
"types": "./dist/index.d.cts"
"types": "./dist/index.d.cts",
"patchedDependencies": {
"@stricli/core@1.2.5": "patches/@stricli%2Fcore@1.2.5.patch",
"@sentry/node-core@10.50.0": "patches/@sentry%2Fnode-core@10.50.0.patch",
"@sentry/core@10.50.0": "patches/@sentry%2Fcore@10.50.0.patch"
}
}
9 changes: 9 additions & 0 deletions plugins/sentry-cli/skills/sentry-cli/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,15 @@ Initialize Sentry in your project (experimental)

→ Full flags and examples: `references/init.md`

### Local

Sentry for local development

- `sentry local serve` — Start the local dev server and tail events
- `sentry local run <command...>` — Run a command with the local dev server enabled

→ Full flags and examples: `references/local.md`

### Schema

Browse the Sentry API schema
Expand Down
54 changes: 54 additions & 0 deletions plugins/sentry-cli/skills/sentry-cli/references/local.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
name: sentry-cli-local
version: 0.35.0-dev.0
description: Sentry for local development
requires:
bins: ["sentry"]
auth: true
---

# Local Commands

Sentry for local development

### `sentry local serve`

Start the local dev server and tail events

**Flags:**
- `-p, --port <value> - Port to listen on (default 8969) - (default: "8969")`
- `-H, --host <value> - Hostname to bind to (default localhost) - (default: "localhost")`
- `-q, --quiet - Suppress per-envelope tail output`
- `-f, --filter <value>... - Only show items of this type (repeatable: error, transaction, log)`

### `sentry local run <command...>`

Run a command with the local dev server enabled

**Flags:**
- `-p, --port <value> - Port for the local server (default 8969) - (default: "8969")`
- `--host <value> - Hostname for the local server (default localhost) - (default: "localhost")`

**Examples:**

```bash
# Start the server and tail events (default)
sentry local

# Run your app with the local server auto-enabled
sentry local run -- npm run dev
sentry local run -- python manage.py runserver

# Use a custom port
sentry local --port 9000

# Only show errors and logs (filter out transactions)
sentry local -f error -f log

# Run quietly (suppress per-envelope tail output)
sentry local --quiet

sentry local -f error -f log # only errors and logs
```

All commands also support `--json`, `--fields`, `--help`, `--log-level`, and `--verbose` flags.
Loading
Loading