Feature: non-watch snapshot for `sentry local` (`local dump` / `serve --once`)

Open
#1,035 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Quiet
Tech stack
typescript
Domain
cli

Research direction

Start by reading the existing sentry local serve and run command entry points and the server's in-memory envelope buffer and SSE replay behavior. Resolve whether the change is local dump or a serve --once mode, define behavior when no server is running, and verify that filtering, formatting, buffer draining, and clean exit status work for scripts.

Written by the indexing model from the issue text.

Description

Summary

sentry local is watch-only today: serve tails a live SSE stream and run wraps a process. There's no non-interactive way to grab the events captured so far and exit. A one-shot sentry local dump (or a --once flag on serve) would print the current buffer and return, which is handy for scripts, CI checks, and AI coding agents.

Motivation

The server already retains a buffer of recent envelopes for late subscribers, but the only way to read it is to attach to the stream and disconnect manually (serve -F json | head, or curl -N localhost:8969/stream). That's awkward for:

  • Agents/automation that want "what did my app emit in the last run?" as a single command with a clean exit code.
  • CI / scripts asserting on captured events without managing a long-lived process.
  • Quick inspection without entering watch mode.

(Related but distinct: #998 adds --verify — run app, wait for first envelope, pass/fail, exit — and #809 is synthetic event generation. Neither gives a snapshot of captured events.)

Proposed behavior

  • sentry local dump — connect to a running server (or the buffer), print everything currently buffered, then exit 0. Honors the existing -f/--filter (error|transaction|log|ai) and -F/--format (human|json) flags.
  • Or equivalently sentry local serve --once / --exit-after-drain: replay the buffer and exit instead of streaming.
  • Errors with a clear message if no server is running (or starts an ephemeral one for the run-style case — TBD).
# Snapshot the buffer as NDJSON and query it
sentry local dump -F json | jq 'select(.type=="error")'

# Just the AI/agent spans captured so far
sentry local dump -f ai

Notes / open questions

  • Scope is the in-memory Spotlight buffer (last N envelopes), not a persistent store — same data serve already replays to late subscribers.
  • Should dump auto-start a server if none is running, or only read an existing one? (Probably read-only; error if none.)
  • Naming: dump vs serve --once vs tail --once.

🤖 Generated with Claude Code

Dominant language
TypeScript
Stars
121
Forks
14
Avg merge
22h 3m
Merged PRs (30d)
94

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from getsentry/cli

All issues in getsentry/cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.