From 9d4755521f0ef6b7dcfac7d9933aac3d82b658ab Mon Sep 17 00:00:00 2001 From: Taylor Eernisse Date: Tue, 3 Feb 2026 12:07:06 -0500 Subject: [PATCH] feat(config): Add fetchResourceEvents config flag with --no-events CLI override Adds a new boolean field to SyncConfig that controls whether resource event fetching is performed during sync: - SyncConfig.fetch_resource_events: defaults to true via serde default_true helper, serialized as "fetchResourceEvents" in JSON - SyncArgs.no_events: --no-events CLI flag that overrides the config value to false when present - SyncOptions.no_events: propagates the flag through the sync pipeline - handle_sync_cmd: mutates loaded config when --no-events is set, ensuring the flag takes effect regardless of config file contents This follows the existing pattern established by --no-embed and --no-docs flags, where CLI flags override config file defaults. The config is loaded as mutable specifically to support this override. Also adds "events" to the count command's entity type value_parser, enabling `lore count events` (implementation in a separate commit). Co-Authored-By: Claude Opus 4.5 --- src/cli/commands/sync.rs | 1 + src/cli/mod.rs | 8 ++++++-- src/core/config.rs | 8 ++++++++ src/main.rs | 20 +++++++++++++++++--- 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/cli/commands/sync.rs b/src/cli/commands/sync.rs index bd0007c..1bd0a85 100644 --- a/src/cli/commands/sync.rs +++ b/src/cli/commands/sync.rs @@ -19,6 +19,7 @@ pub struct SyncOptions { pub force: bool, pub no_embed: bool, pub no_docs: bool, + pub no_events: bool, pub robot_mode: bool, } diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 0b162af..8186d72 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -478,6 +478,10 @@ pub struct SyncArgs { /// Skip document regeneration #[arg(long)] pub no_docs: bool, + + /// Skip resource event fetching (overrides config) + #[arg(long = "no-events")] + pub no_events: bool, } /// Arguments for `lore embed` @@ -501,8 +505,8 @@ pub struct EmbedArgs { /// Arguments for `lore count ` #[derive(Parser)] pub struct CountArgs { - /// Entity type to count (issues, mrs, discussions, notes) - #[arg(value_parser = ["issues", "mrs", "discussions", "notes"])] + /// Entity type to count (issues, mrs, discussions, notes, events) + #[arg(value_parser = ["issues", "mrs", "discussions", "notes", "events"])] pub entity: String, /// Parent type filter: issue or mr (for discussions/notes) diff --git a/src/core/config.rs b/src/core/config.rs index bfef3e3..3d16532 100644 --- a/src/core/config.rs +++ b/src/core/config.rs @@ -50,6 +50,13 @@ pub struct SyncConfig { #[serde(rename = "dependentConcurrency")] pub dependent_concurrency: u32, + + #[serde(rename = "fetchResourceEvents", default = "default_true")] + pub fetch_resource_events: bool, +} + +fn default_true() -> bool { + true } impl Default for SyncConfig { @@ -61,6 +68,7 @@ impl Default for SyncConfig { cursor_rewind_seconds: 2, primary_concurrency: 4, dependent_concurrency: 2, + fetch_resource_events: true, } } } diff --git a/src/main.rs b/src/main.rs index c6f090e..f2fa93d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,14 +11,14 @@ use tracing_subscriber::util::SubscriberInitExt; use lore::Config; use lore::cli::commands::{ InitInputs, InitOptions, InitResult, ListFilters, MrListFilters, SearchCliFilters, open_issue_in_browser, - open_mr_in_browser, print_count, print_count_json, print_doctor_results, print_generate_docs, + open_mr_in_browser, print_count, print_count_json, print_event_count, print_event_count_json, print_doctor_results, print_generate_docs, print_generate_docs_json, print_ingest_summary, print_ingest_summary_json, print_list_issues, print_list_issues_json, print_list_mrs, print_list_mrs_json, print_search_results, print_search_results_json, print_show_issue, print_show_issue_json, print_show_mr, print_stats, print_stats_json, print_embed, print_embed_json, print_sync, print_sync_json, print_show_mr_json, print_sync_status, print_sync_status_json, run_auth_test, run_count, - run_doctor, run_embed, run_generate_docs, run_ingest, run_init, run_list_issues, run_list_mrs, + run_count_events, run_doctor, run_embed, run_generate_docs, run_ingest, run_init, run_list_issues, run_list_mrs, run_search, run_show_issue, run_show_mr, run_stats, run_sync, run_sync_status, SyncOptions, IngestDisplay, }; @@ -518,6 +518,16 @@ async fn handle_count( ) -> Result<(), Box> { let config = Config::load(config_override)?; + if args.entity == "events" { + let counts = run_count_events(&config)?; + if robot_mode { + print_event_count_json(&counts); + } else { + print_event_count(&counts); + } + return Ok(()); + } + let result = run_count(&config, &args.entity, args.for_entity.as_deref())?; if robot_mode { print_count_json(&result); @@ -1128,12 +1138,16 @@ async fn handle_sync_cmd( args: SyncArgs, robot_mode: bool, ) -> Result<(), Box> { - let config = Config::load(config_override)?; + let mut config = Config::load(config_override)?; + if args.no_events { + config.sync.fetch_resource_events = false; + } let options = SyncOptions { full: args.full && !args.no_full, force: args.force && !args.no_force, no_embed: args.no_embed, no_docs: args.no_docs, + no_events: args.no_events, robot_mode, };