Skip to content

Res cli v2#1935

Draft
tomaszpatrzek wants to merge 39 commits into
masterfrom
res-cli-v2
Draft

Res cli v2#1935
tomaszpatrzek wants to merge 39 commits into
masterfrom
res-cli-v2

Conversation

@tomaszpatrzek
Copy link
Copy Markdown
Contributor

Add ruby_event_store-cli contrib gem

A new CLI tool for inspecting a RubyEventStore/RailsEventStore event store from the terminal. Built entirely on
the public RubyEventStore::Client API — no ActiveRecord internals, no raw SQL.

Commands

  • res stream events STREAM — list events in a stream with filtering by type, time, position; --follow/-f to
    tail live
  • res stream show STREAM — event count, version, first/last event timestamps
  • res event show ID — full event details (data, metadata, timestamps)
  • res event streams ID — all streams an event was published or linked to
  • res trace CORRELATION_ID — ASCII causation tree for a correlation ID
  • res search — search across all streams by type, time range, or stream name
  • res stats — total event count and unique event types; --stream for per-stream stats
  • res watch — live view of new events grouped by bounded context namespace

tomaszpatrzek and others added 30 commits April 22, 2026 18:57
Scaffold for the new CLI contrib gem: gemspec, Gemfile, version,
main lib entry point, and executable bin/res.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Auto-detects config/environment.rb in CWD. Supports explicit override
via EventStoreResolver.event_store= for non-standard setups.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Registers stream events as placeholder. res --help and
res stream events --help work.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
res stream events STREAM_NAME reads and displays events in table or
json format with configurable limit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add --type, --after, --before, --from options to res stream events
for filtering by event class, time range, and pagination anchor.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace raw NameError with "Unknown event type: X" when --type
argument doesn't match a known constant.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Polls for new events every second after initial read.
Exits cleanly on Ctrl+C (exit 0).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extract render logic from stream_events into EventRenderer module, reuse in search.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Uses event_store.read.count — no AR internals. Supports optional --stream flag.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove AR/Rails/SQLite deps — specs use in-memory client only.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tests on Ruby 3.2, 3.3, 3.4 — no database needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All commands inherit from Base instead of Dry::CLI::Command, removing
the repeated local variable assignment in every call method.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Base#event_store reads Rails.configuration.event_store directly,
removing the CLI::EVENT_STORE constant assignment from bin/res.
Tests use stub_event_store helper backed by FakeConfiguration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace inline blocks with events_since, filter_by_namespaces,
and group_by_namespace to make each step explicit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
tomaszpatrzek and others added 9 commits April 23, 2026 20:05
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…filtering

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…s methods

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant