//! Cleanup-worktrees bot command — stub module required by the commands registry.
//!
//! The real async implementation lives in
//! `chat::transport::matrix::cleanup_worktrees`. This file exists so that
//! `commands/mod.rs` can declare the module, keeping the registry consistent
//! with the pattern used by other async commands (rmtree, start, rebuild, …).
//!
//! The fallback handler `handle_cleanup_worktrees_fallback` in `mod.rs` always
//! returns `None`; the matrix transport intercepts the command before
//! `try_handle_command` is reached.

#[cfg(test)]
mod tests {
    use crate::chat::commands::tests::{commands, try_cmd_addressed};

    #[test]
    fn cleanup_worktrees_is_registered() {
        assert!(
            commands().iter().any(|c| c.name == "cleanup_worktrees"),
            "cleanup_worktrees must be in the command registry"
        );
    }

    #[test]
    fn cleanup_worktrees_has_description() {
        let cmd = commands()
            .iter()
            .find(|c| c.name == "cleanup_worktrees")
            .expect("cleanup_worktrees must be registered");
        assert!(
            !cmd.description.is_empty(),
            "cleanup_worktrees must have a description"
        );
    }

    #[test]
    fn cleanup_worktrees_fallback_returns_none() {
        // The sync fallback returns None — the async handler in the Matrix
        // transport handles the real work.
        let result = try_cmd_addressed(
            "Timmy",
            "@timmy:homeserver.local",
            "@timmy cleanup_worktrees",
        );
        assert!(
            result.is_none(),
            "cleanup_worktrees fallback must return None (handled async): {result:?}"
        );
    }
}
