Skip to content

Commit 702f238

Browse files
0xrinegadeclaude
andcommitted
feat(bbs): Add mesh message statistics CLI command
Add `osvm bbs mesh` subcommand for managing Meshtastic mesh messages: - `stats` - Comprehensive statistics with optional hourly activity chart - `recent` - View recent messages with filtering by node or commands only - `nodes` - List mesh nodes ranked by message activity - `prune` - Clean up old messages with configurable retention Includes JSON output support for all commands for scripting/monitoring. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 386d6d7 commit 702f238

File tree

3 files changed

+564
-0
lines changed

3 files changed

+564
-0
lines changed

src/clparse/bbs.rs

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,4 +568,106 @@ pub fn build_bbs_command() -> Command {
568568
.about("Discover peers from on-chain registry"),
569569
),
570570
)
571+
// Mesh message management
572+
.subcommand(
573+
Command::new("mesh")
574+
.about("Meshtastic mesh message management and statistics")
575+
.long_about(
576+
"View and manage messages received over Meshtastic radio mesh.\n\
577+
\n\
578+
All mesh messages are stored in the BBS database for analysis and history.\n\
579+
Use this command to view statistics, recent messages, and activity patterns.\n\
580+
\n\
581+
Commands:\n\
582+
• stats - Show comprehensive mesh statistics\n\
583+
• recent - View recent mesh messages\n\
584+
• nodes - List active mesh nodes\n\
585+
• prune - Clean up old messages",
586+
)
587+
.arg_required_else_help(true)
588+
.subcommand(
589+
Command::new("stats")
590+
.about("Show mesh message statistics")
591+
.arg(
592+
Arg::new("json")
593+
.long("json")
594+
.action(ArgAction::SetTrue)
595+
.help("Output in JSON format"),
596+
)
597+
.arg(
598+
Arg::new("hourly")
599+
.long("hourly")
600+
.action(ArgAction::SetTrue)
601+
.help("Include hourly activity breakdown"),
602+
),
603+
)
604+
.subcommand(
605+
Command::new("recent")
606+
.about("View recent mesh messages")
607+
.arg(
608+
Arg::new("limit")
609+
.long("limit")
610+
.short('n')
611+
.value_name("COUNT")
612+
.default_value("20")
613+
.help("Number of messages to show"),
614+
)
615+
.arg(
616+
Arg::new("commands")
617+
.long("commands")
618+
.short('c')
619+
.action(ArgAction::SetTrue)
620+
.help("Show only command messages"),
621+
)
622+
.arg(
623+
Arg::new("node")
624+
.long("node")
625+
.value_name("NODE_ID")
626+
.help("Filter by node ID (e.g., !abcd1234)"),
627+
)
628+
.arg(
629+
Arg::new("json")
630+
.long("json")
631+
.action(ArgAction::SetTrue)
632+
.help("Output in JSON format"),
633+
),
634+
)
635+
.subcommand(
636+
Command::new("nodes")
637+
.about("List mesh nodes by activity")
638+
.arg(
639+
Arg::new("limit")
640+
.long("limit")
641+
.short('n')
642+
.value_name("COUNT")
643+
.default_value("10")
644+
.help("Number of nodes to show"),
645+
)
646+
.arg(
647+
Arg::new("json")
648+
.long("json")
649+
.action(ArgAction::SetTrue)
650+
.help("Output in JSON format"),
651+
),
652+
)
653+
.subcommand(
654+
Command::new("prune")
655+
.about("Remove old mesh messages")
656+
.arg(
657+
Arg::new("keep")
658+
.long("keep")
659+
.short('k')
660+
.value_name("COUNT")
661+
.default_value("1000")
662+
.help("Number of recent messages to keep"),
663+
)
664+
.arg(
665+
Arg::new("force")
666+
.long("force")
667+
.short('f')
668+
.action(ArgAction::SetTrue)
669+
.help("Skip confirmation"),
670+
),
671+
),
672+
)
571673
}

0 commit comments

Comments
 (0)