Skip to content

Commit d83841a

Browse files
Alex Holmbergclaude
authored andcommitted
feat: wire --agent flag in command handlers and add Retrieve command
Task 5: Wire --agent in main.rs match arms for Analyze, Security, Dependencies, Vulnerabilities, and Optimize commands. Each agent path forces JSON output, passes through compression pipeline via handle_agent_output helper, and stores full data for retrieval. Task 6: Refactor handle_vulnerabilities to return Result<String> so the agent path can capture JSON output for compression. Add Retrieve command handling with --list, latest resolution, filtered retrieval, and error reporting as structured JSON. Update suppress_update_banner to also suppress for --agent mode and Retrieve commands. Add Retrieve to telemetry command mapping. Update lib.rs patterns to ignore new agent field on all commands and add Retrieve arm (unreachable, handled in main.rs). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 04a698e commit d83841a

2 files changed

Lines changed: 201 additions & 42 deletions

File tree

src/lib.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pub async fn run_command(
3636
display,
3737
only,
3838
color_scheme,
39+
agent: _,
3940
} => {
4041
match handlers::handle_analyze(path, json, detailed, display, only, color_scheme) {
4142
Ok(_output) => Ok(()), // The output was already printed by display_analysis_with_return
@@ -54,7 +55,7 @@ pub async fn run_command(
5455
} => handlers::handle_generate(
5556
path, output, dockerfile, compose, terraform, all, dry_run, force,
5657
),
57-
Commands::Validate { path, types, fix } => handlers::handle_validate(path, types, fix),
58+
Commands::Validate { path, types, fix, agent: _ } => handlers::handle_validate(path, types, fix),
5859
Commands::Support {
5960
languages,
6061
frameworks,
@@ -67,6 +68,7 @@ pub async fn run_command(
6768
prod_only,
6869
dev_only,
6970
format,
71+
agent: _,
7072
} => handlers::handle_dependencies(
7173
path,
7274
licenses,
@@ -82,7 +84,8 @@ pub async fn run_command(
8284
severity,
8385
format,
8486
output,
85-
} => handlers::handle_vulnerabilities(path, severity, format, output).await,
87+
agent: _,
88+
} => handlers::handle_vulnerabilities(path, severity, format, output).await.map(|_| ()),
8689
Commands::Security {
8790
path,
8891
mode,
@@ -95,6 +98,7 @@ pub async fn run_command(
9598
format,
9699
output,
97100
fail_on_findings,
101+
agent: _,
98102
} => {
99103
handlers::handle_security(
100104
path,
@@ -133,6 +137,7 @@ pub async fn run_command(
133137
min_confidence,
134138
cloud_provider,
135139
region,
140+
agent: _,
136141
} => {
137142
let format_str = match format {
138143
cli::OutputFormat::Table => "table",
@@ -708,6 +713,10 @@ pub async fn run_command(
708713
agent::run_agent_server(&project_path, provider_type, model, &host, port).await?;
709714
Ok(())
710715
}
716+
Commands::Retrieve { .. } => {
717+
// Retrieve commands are handled in main.rs directly
718+
unreachable!("Retrieve commands should be handled in main.rs")
719+
}
711720
Commands::Deploy { .. } => {
712721
// Deploy commands are handled in main.rs directly
713722
unreachable!("Deploy commands should be handled in main.rs")

0 commit comments

Comments
 (0)