feat(cli): Add 'lore count events' command with human and robot output

Extends the count command to support "events" as an entity type,
displaying resource event counts broken down by event type (state,
label, milestone) and entity type (issue, merge request).

New functions in count.rs:
- run_count_events: Creates DB connection and delegates to
  events_db::count_events for the actual queries
- print_event_count: Human-readable table with aligned columns
  showing per-type breakdowns and row/column totals
- print_event_count_json: Structured JSON matching the robot mode
  contract with ok/data envelope and per-type issue/mr/total counts

JSON output structure:
  {"ok":true,"data":{"state_events":{"issue":N,"merge_request":N,
  "total":N},"label_events":{...},"milestone_events":{...},"total":N}}

Updated exports in commands/mod.rs to expose the three new public
functions (run_count_events, print_event_count, print_event_count_json).

The "events" branch in handle_count (main.rs, committed earlier)
routes to these functions before the existing entity type dispatcher.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Taylor Eernisse
2026-02-03 12:08:01 -05:00
parent 724be4d265
commit 12811683ca
2 changed files with 108 additions and 1 deletions

View File

@@ -15,7 +15,10 @@ pub mod sync;
pub mod sync_status;
pub use auth_test::run_auth_test;
pub use count::{print_count, print_count_json, run_count};
pub use count::{
print_count, print_count_json, print_event_count, print_event_count_json, run_count,
run_count_events,
};
pub use doctor::{print_doctor_results, run_doctor};
pub use embed::{print_embed, print_embed_json, run_embed};
pub use generate_docs::{print_generate_docs, print_generate_docs_json, run_generate_docs};