Skip to content

Commit 7255391

Browse files
committed
fix(cli): add compact exec alias
1 parent 7954d02 commit 7255391

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

src/cortex-cli/src/agent_cmd/tests.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
#[cfg(test)]
44
mod tests {
55
use crate::agent_cmd::cli::{CopyArgs, ExportArgs};
6-
use crate::agent_cmd::loader::{
7-
load_builtin_agents, parse_frontmatter, read_file_with_encoding,
8-
};
6+
use crate::agent_cmd::loader::{load_builtin_agents, parse_frontmatter};
97
use crate::agent_cmd::types::AgentMode;
8+
use crate::utils::file::read_file_with_encoding;
109

1110
#[test]
1211
fn test_read_file_with_utf8() {

src/cortex-cli/src/compact_cmd.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ pub struct CompactCli {
2929
#[derive(Debug, clap::Subcommand)]
3030
pub enum CompactSubcommand {
3131
/// Run a compaction cycle (logs + sessions)
32+
#[command(visible_alias = "exec")]
3233
Run(CompactRunArgs),
3334

3435
/// Prune old log files
@@ -732,13 +733,25 @@ use cortex_compact::AutoCompactionConfig;
732733
#[cfg(test)]
733734
mod tests {
734735
use super::*;
736+
use clap::Parser;
735737
use std::fs;
736738
use tempfile::tempdir;
737739

738740
// ========================================================================
739741
// format_size tests
740742
// ========================================================================
741743

744+
#[test]
745+
fn test_compact_run_exec_alias() {
746+
let cli = CompactCli::try_parse_from(["compact", "exec", "--dry-run"])
747+
.expect("compact exec should parse as run alias");
748+
749+
match cli.subcommand {
750+
Some(CompactSubcommand::Run(args)) => assert!(args.dry_run),
751+
other => panic!("expected run subcommand, got {other:?}"),
752+
}
753+
}
754+
742755
#[test]
743756
fn test_format_size_bytes() {
744757
assert_eq!(format_size(0), "0 B");

0 commit comments

Comments
 (0)