stats+log : am stats (agregats par agent, periodes 7d/30d/90d, barres ASCII) et am log (filtres agent/kind/date, limite) (issue #6)

This commit is contained in:
2026-08-16 22:30:41 -04:00
parent 19e77fd261
commit 33748bea36
8 changed files with 534 additions and 1 deletions
+40
View File
@@ -198,6 +198,46 @@ pub static HELP_SPECS: &[HelpSpec] = &[
HelpExample { desc: "Show one session with its log excerpt.", code: "sessions --show 20260815_143926_a1b2c3" },
],
},
HelpSpec {
name: "stats",
category: "Commands",
usage: "stats {flags} [agent]",
about: "Show usage statistics computed from the event journal.",
search_terms: &["usage", "metrics", "duration"],
flags: &[
HelpFlag { short: "", long: "--period", value: "PERIOD", desc: "Only events of the last period (7d, 30d, 90d, all)" },
],
subcommands: &[],
parameters: &[
HelpParam { name: "agent", typ: "string", desc: "Agent name or alias (omit for the global view)" },
],
io: None,
examples: &[
HelpExample { desc: "Global usage statistics.", code: "stats" },
HelpExample { desc: "One agent over the last month.", code: "stats claude-code --period 30d" },
],
},
HelpSpec {
name: "log",
category: "Commands",
usage: "log {flags} [agent]",
about: "Read the event journal: everything am did.",
search_terms: &["journal", "events", "history"],
flags: &[
HelpFlag { short: "", long: "--kind", value: "KINDS", desc: "Only these event kinds (comma separated)" },
HelpFlag { short: "", long: "--since", value: "DATE", desc: "Only events at or after this date (YYYY-MM-DD or RFC 3339)" },
HelpFlag { short: "", long: "--limit", value: "N", desc: "Maximum number of events (default: 50)" },
],
subcommands: &[],
parameters: &[
HelpParam { name: "agent", typ: "string", desc: "Only events of this agent" },
],
io: None,
examples: &[
HelpExample { desc: "The last 50 events.", code: "log" },
HelpExample { desc: "Starts of one agent since a date.", code: "log claude-code --kind start --since 2026-08-01" },
],
},
HelpSpec {
name: "search",
category: "Commands",