From 2433063e702a554d54306e659911b2baf842524a Mon Sep 17 00:00:00 2001 From: SlaVKsVolks Date: Wed, 13 May 2026 14:07:29 -0300 Subject: [PATCH 1/2] fix: make export pretty flag explicit --- src/cortex-cli/src/export_cmd.rs | 40 ++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/src/cortex-cli/src/export_cmd.rs b/src/cortex-cli/src/export_cmd.rs index 39f3369b0..0c93eb961 100644 --- a/src/cortex-cli/src/export_cmd.rs +++ b/src/cortex-cli/src/export_cmd.rs @@ -39,8 +39,8 @@ pub struct ExportCommand { #[arg(short, long, value_enum, default_value_t = ExportFormat::Json)] pub format: ExportFormat, - /// Pretty-print the output (for json/yaml) - #[arg(long, default_value_t = true)] + /// Pretty-print JSON output + #[arg(long, action = clap::ArgAction::SetTrue)] pub pretty: bool, } @@ -111,6 +111,8 @@ pub struct ExportToolCall { impl ExportCommand { /// Run the export command. pub async fn run(self) -> Result<()> { + validate_format_options(self.format, self.pretty)?; + let cortex_home = dirs::home_dir() .map(|h| h.join(".cortex")) .ok_or_else(|| anyhow::anyhow!("Could not determine home directory"))?; @@ -241,6 +243,14 @@ impl ExportCommand { } } +fn validate_format_options(format: ExportFormat, pretty: bool) -> Result<()> { + if pretty && format != ExportFormat::Json { + bail!("--pretty is only supported for JSON exports"); + } + + Ok(()) +} + /// Escape a field for CSV output. fn escape_csv_field(field: &str) -> String { if field.contains(',') || field.contains('"') || field.contains('\n') { @@ -466,4 +476,30 @@ mod tests { assert_eq!(refs.len(), 1); assert!(refs.contains(&"explore".to_string())); } + + #[test] + fn test_pretty_defaults_to_false() { + let cmd = ExportCommand::try_parse_from(["export", "session-id"]).unwrap(); + + assert!(!cmd.pretty); + } + + #[test] + fn test_validate_format_options_allows_pretty_json() { + validate_format_options(ExportFormat::Json, true).unwrap(); + } + + #[test] + fn test_validate_format_options_rejects_pretty_yaml() { + let err = validate_format_options(ExportFormat::Yaml, true).unwrap_err(); + + assert!(err.to_string().contains("JSON exports")); + } + + #[test] + fn test_validate_format_options_rejects_pretty_csv() { + let err = validate_format_options(ExportFormat::Csv, true).unwrap_err(); + + assert!(err.to_string().contains("JSON exports")); + } } From 39b445d7351fc0f2cf784db8f9f804ecb65d9d61 Mon Sep 17 00:00:00 2001 From: SlaVKsVolks Date: Tue, 4 Aug 2026 10:58:19 -0300 Subject: [PATCH 2/2] chore: sync local changes --- README.md | 5 +++++ docs/plugins/README.md | 5 +++++ examples/plugins/code-stats/README.md | 6 ++++++ examples/plugins/hello-world/README.md | 6 ++++++ 4 files changed, 22 insertions(+) diff --git a/README.md b/README.md index 1c2679e9d..531a74d1c 100644 --- a/README.md +++ b/README.md @@ -119,3 +119,8 @@ We welcome contributions from the community! See our [Contributing Guide](./docs ## License Copyright © 2025 Cortex Foundation. All rights reserved. + +## Navigation + +- [Back to `REPOS`](../README.md) +- [Back to `AI_REVENUE_SPRINT_100_24H`](../../README.md) diff --git a/docs/plugins/README.md b/docs/plugins/README.md index f6b5b2f65..329d68005 100644 --- a/docs/plugins/README.md +++ b/docs/plugins/README.md @@ -402,3 +402,8 @@ granted_permissions = ["read_files", "network"] api_key = "your-api-key" max_items = 20 ``` +## Navigation + +- [Back to `cortex`](../../README.md) +- [Back to `REPOS`](../../../README.md) +- [Back to `AI_REVENUE_SPRINT_100_24H`](../../../../README.md) diff --git a/examples/plugins/code-stats/README.md b/examples/plugins/code-stats/README.md index e17cb75f9..59e0f7254 100644 --- a/examples/plugins/code-stats/README.md +++ b/examples/plugins/code-stats/README.md @@ -254,3 +254,9 @@ The plugin can be tested by: ## License MIT License - See LICENSE file for details. +## Navigation + +- [Back to `examples/plugins`](../../README.md) +- [Back to `cortex`](../../../README.md) +- [Back to `REPOS`](../../../../README.md) +- [Back to `AI_REVENUE_SPRINT_100_24H`](../../../../../README.md) diff --git a/examples/plugins/hello-world/README.md b/examples/plugins/hello-world/README.md index d1d27d0fd..a1b83a645 100644 --- a/examples/plugins/hello-world/README.md +++ b/examples/plugins/hello-world/README.md @@ -146,3 +146,9 @@ This is useful for debugging and auditing tool usage. ## License MIT License - See LICENSE file for details. +## Navigation + +- [Back to `examples/plugins`](../../README.md) +- [Back to `cortex`](../../../README.md) +- [Back to `REPOS`](../../../../README.md) +- [Back to `AI_REVENUE_SPRINT_100_24H`](../../../../../README.md)