From 789aa897dc99704a4c3b4ea5cdad8b3c020dfc48 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Sun, 16 Aug 2026 10:16:00 +0800 Subject: [PATCH] test: keep the READMEs' agent count honest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both READMEs say tty7 detects 18 CLI agents. `CLIAgent::ALL` holds 18, so today they are right — Claude, Codex, Gemini, Aider, Amp, OpenCode, Copilot, Cursor, Goose, Droid, Pi, Auggie, Hermes, Vibe, Antigravity, Grok, Qwen, OhMyPi. Nothing held them together. A nineteenth agent is a one-line addition to that array, and the number lives in prose in two files nobody edits in the same change — the front page would go on claiming eighteen and no gate would notice, which is exactly how the reboot claim in the last commit got to stay wrong. So the test reads the other file, the way `keymap` reads its own source for the action list and `aumid` reads windows-installer.iss. Checked that it is not vacuous: neither README contains "19 CLI", so the day the array grows the assertion fires. --- crates/tty7-core/src/core/cli_agent.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/crates/tty7-core/src/core/cli_agent.rs b/crates/tty7-core/src/core/cli_agent.rs index 8031fad7..53428b9d 100644 --- a/crates/tty7-core/src/core/cli_agent.rs +++ b/crates/tty7-core/src/core/cli_agent.rs @@ -628,6 +628,30 @@ pub fn parse_agent_event(payload: &[u8]) -> Option { mod tests { use super::*; + /// The READMEs count the agents tty7 detects, and the count is in prose. + /// + /// Both say "18 CLIs"; `CLIAgent::ALL` is what makes that true, and a + /// nineteenth agent would leave two sentences quietly wrong in the file + /// most people read first. Checked the way `keymap` checks its action + /// list and `aumid` checks the installer script: read the other file. + #[test] + fn the_readmes_count_the_agents_this_enum_holds() { + let n = CLIAgent::ALL.len(); + for (name, text) in [ + ("README.md", include_str!("../../../../README.md")), + ( + "README.zh-CN.md", + include_str!("../../../../README.zh-CN.md"), + ), + ] { + assert!( + text.contains(&format!("{n} CLI")) || text.contains(&format!("{n} 个 CLI")), + "{name} does not say there are {n} CLI agents; \ + CLIAgent::ALL has {n} and the file has to agree" + ); + } + } + fn argv(parts: &[&str]) -> Vec { parts.iter().map(|s| s.to_string()).collect() }