File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ mod logging;
1212mod mcp;
1313mod ndjson;
1414pub mod runtimes;
15+ #[ cfg( debug_assertions) ]
1516mod run;
1617pub mod sanitize;
1718mod safeoutputs;
@@ -131,6 +132,7 @@ enum Commands {
131132 definition_ids : Option < Vec < u64 > > ,
132133 } ,
133134 /// Run agent locally (local development mode)
135+ #[ cfg( debug_assertions) ]
134136 Run {
135137 /// Path to the agent markdown file
136138 path : String ,
@@ -181,6 +183,7 @@ async fn main() -> Result<()> {
181183 Some ( Commands :: McpHttp { .. } ) => "mcp-http" ,
182184 Some ( Commands :: Init { .. } ) => "init" ,
183185 Some ( Commands :: Configure { .. } ) => "configure" ,
186+ #[ cfg( debug_assertions) ]
184187 Some ( Commands :: Run { .. } ) => "run" ,
185188 None => "ado-aw" ,
186189 } ;
@@ -388,6 +391,7 @@ async fn main() -> Result<()> {
388391 )
389392 . await ?;
390393 }
394+ #[ cfg( debug_assertions) ]
391395 Commands :: Run {
392396 path,
393397 pat,
Original file line number Diff line number Diff line change 1+ use std:: path:: PathBuf ;
2+
3+ #[ cfg( debug_assertions) ]
4+ #[ test]
5+ fn test_run_subcommand_exposed_in_debug_builds ( ) {
6+ let binary_path = PathBuf :: from ( env ! ( "CARGO_BIN_EXE_ado-aw" ) ) ;
7+ let output = std:: process:: Command :: new ( & binary_path)
8+ . arg ( "--help" )
9+ . output ( )
10+ . expect ( "Failed to run ado-aw --help" ) ;
11+
12+ assert ! ( output. status. success( ) , "--help should succeed" ) ;
13+ let stdout = String :: from_utf8_lossy ( & output. stdout ) ;
14+ assert ! (
15+ stdout. contains( "Run agent locally" ) ,
16+ "Debug build help output should include the run subcommand, got:\n {stdout}"
17+ ) ;
18+ }
19+
20+ #[ cfg( not( debug_assertions) ) ]
21+ #[ test]
22+ fn test_run_subcommand_not_exposed_in_release_builds ( ) {
23+ let binary_path = PathBuf :: from ( env ! ( "CARGO_BIN_EXE_ado-aw" ) ) ;
24+ let output = std:: process:: Command :: new ( & binary_path)
25+ . arg ( "--help" )
26+ . output ( )
27+ . expect ( "Failed to run ado-aw --help" ) ;
28+
29+ assert ! ( output. status. success( ) , "--help should succeed" ) ;
30+ let stdout = String :: from_utf8_lossy ( & output. stdout ) ;
31+ assert ! (
32+ !stdout. contains( "Run agent locally" ) ,
33+ "Release build help output should not include the run subcommand, got:\n {stdout}"
34+ ) ;
35+ }
You can’t perform that action at this time.
0 commit comments