feat: phase 2 — coûts par session (stats --costs) + am monitor TUI (closes #49 #50)

This commit is contained in:
2026-08-18 11:23:50 -04:00
parent 63dc36660b
commit 1b3fe09074
22 changed files with 978 additions and 23 deletions
+26 -5
View File
@@ -220,10 +220,11 @@ pub static HELP_SPECS: &[HelpSpec] = &[
name: "stats",
category: "Commands",
usage: "stats {flags} [agent]",
about: "Show usage statistics computed from the event journal.",
search_terms: &["usage", "metrics", "duration"],
about: "Usage statistics from the event journal; --costs prices the token usage.",
search_terms: &["usage", "cost", "tokens", "spend", "period"],
flags: &[
HelpFlag { short: "", long: "--period", value: "PERIOD", desc: "Only events of the last period (7d, 30d, 90d, all)" },
HelpFlag { short: "", long: "--period", value: "PERIOD", desc: "7d, 30d, 90d or all" },
HelpFlag { short: "", long: "--costs", value: "", desc: "Show token usage and estimated spend per agent (issue #49)" },
],
subcommands: &[],
parameters: &[
@@ -231,8 +232,28 @@ pub static HELP_SPECS: &[HelpSpec] = &[
],
io: None,
examples: &[
HelpExample { desc: "Global usage statistics.", code: "stats" },
HelpExample { desc: "One agent over the last month.", code: "stats claude-code --period 30d" },
HelpExample { desc: "Global statistics.", code: "stats" },
HelpExample { desc: "Last 30 days.", code: "stats --period 30d" },
HelpExample { desc: "Estimated spend.", code: "stats --period 30d --costs" },
],
},
HelpSpec {
name: "monitor",
category: "Commands",
usage: "monitor {flags}",
about: "Real-time TUI of the managed processes (CPU, RSS, uptime) with threshold alerts.",
search_terms: &["process", "cpu", "memory", "rss", "alert", "top", "surveillance"],
flags: &[
HelpFlag { short: "", long: "--interval", value: "SECONDS", desc: "Refresh interval (default 2)" },
HelpFlag { short: "", long: "--json", value: "", desc: "Print one JSON document per tick (for scripts)" },
],
subcommands: &[],
parameters: &[],
io: None,
examples: &[
HelpExample { desc: "Live TUI (q / Esc quits).", code: "monitor" },
HelpExample { desc: "Refresh every 5s.", code: "monitor --interval 5" },
HelpExample { desc: "JSON stream for scripts.", code: "monitor --json --interval 10" },
],
},
HelpSpec {