@@ -27,9 +27,46 @@ enum Commands {
2727 // ============================================================================
2828 // Graph-Aware CI Optimization
2929 // ============================================================================
30- /// Graph-aware workspace operations
31- #[ command( subcommand) ]
32- Graph ( GraphCommands ) ,
30+ /// Show which crates are affected by changes
31+ Affected {
32+ /// Git ref to compare against (default: origin/main)
33+ #[ arg( long, default_value = "origin/main" ) ]
34+ since : String ,
35+ /// Start ref (for SHA pair mode)
36+ #[ arg( long, conflicts_with = "since" ) ]
37+ from : Option < String > ,
38+ /// End ref (for SHA pair mode)
39+ #[ arg( long, requires = "from" ) ]
40+ to : Option < String > ,
41+ /// Output format: text, json, names-only
42+ #[ arg( long, default_value = "text" ) ]
43+ format : String ,
44+ } ,
45+
46+ /// Run tests only for affected crates (smart test runner)
47+ Test {
48+ /// Git ref to compare against (auto-detects origin/main, origin/master, or HEAD~1)
49+ #[ arg( long) ]
50+ since : Option < String > ,
51+ /// Use cargo-nextest if available
52+ #[ arg( long) ]
53+ nextest : bool ,
54+ /// Show what would be tested without running tests
55+ #[ arg( long) ]
56+ dry_run : bool ,
57+ /// Explain why tests are being run
58+ #[ arg( long) ]
59+ explain : bool ,
60+ /// Watch for file changes and re-run tests automatically
61+ #[ arg( long) ]
62+ watch : bool ,
63+ /// Watch mode backend: bacon, cargo-watch, auto (default: auto)
64+ #[ arg( long, default_value = "auto" ) ]
65+ watch_mode : String ,
66+ /// Pass additional arguments to the test runner
67+ #[ arg( last = true ) ]
68+ test_args : Vec < String > ,
69+ } ,
3370
3471 // ============================================================================
3572 // Dependency Unification
@@ -107,50 +144,6 @@ enum Commands {
107144 } ,
108145}
109146
110- #[ derive( Subcommand ) ]
111- enum GraphCommands {
112- /// Show which crates are affected by changes
113- Affected {
114- /// Git ref to compare against (default: origin/main)
115- #[ arg( long, default_value = "origin/main" ) ]
116- since : String ,
117- /// Start ref (for SHA pair mode)
118- #[ arg( long, conflicts_with = "since" ) ]
119- from : Option < String > ,
120- /// End ref (for SHA pair mode)
121- #[ arg( long, requires = "from" ) ]
122- to : Option < String > ,
123- /// Output format: text, json, names-only
124- #[ arg( long, default_value = "text" ) ]
125- format : String ,
126- } ,
127-
128- /// Run tests only for affected crates (smart test runner)
129- Test {
130- /// Git ref to compare against (auto-detects origin/main, origin/master, or HEAD~1)
131- #[ arg( long) ]
132- since : Option < String > ,
133- /// Use cargo-nextest if available
134- #[ arg( long) ]
135- nextest : bool ,
136- /// Show what would be tested without running tests
137- #[ arg( long) ]
138- dry_run : bool ,
139- /// Explain why tests are being run
140- #[ arg( long) ]
141- explain : bool ,
142- /// Watch for file changes and re-run tests automatically
143- #[ arg( long) ]
144- watch : bool ,
145- /// Watch mode backend: bacon, cargo-watch, auto (default: auto)
146- #[ arg( long, default_value = "auto" ) ]
147- watch_mode : String ,
148- /// Pass additional arguments to the test runner
149- #[ arg( last = true ) ]
150- test_args : Vec < String > ,
151- } ,
152- }
153-
154147#[ derive( Subcommand ) ]
155148enum UnifyCommands {
156149 /// Analyze dependencies and show unification plan (dry-run)
@@ -237,44 +230,42 @@ fn main() {
237230
238231 let result = match cli. command {
239232 // Graph Commands
240- Commands :: Graph ( graph_cmd) => match graph_cmd {
241- GraphCommands :: Affected {
242- since,
243- from,
244- to,
245- format,
246- } => commands:: run_affected ( & ctx, since, from, to, format, false ) ,
247- GraphCommands :: Test {
233+ Commands :: Affected {
234+ since,
235+ from,
236+ to,
237+ format,
238+ } => commands:: run_affected ( & ctx, since, from, to, format, false ) ,
239+ Commands :: Test {
240+ since,
241+ nextest,
242+ dry_run,
243+ explain,
244+ watch,
245+ watch_mode,
246+ test_args,
247+ } => {
248+ let config = commands:: test:: TestConfig {
248249 since,
249- nextest,
250250 dry_run,
251251 explain,
252- watch,
253- watch_mode,
252+ prefer_nextest : nextest,
254253 test_args,
255- } => {
256- let config = commands:: test:: TestConfig {
257- since,
258- dry_run,
259- explain,
260- prefer_nextest : nextest,
261- test_args,
262- } ;
254+ } ;
263255
264- if watch {
265- // Parse watch mode
266- let mode = match watch_mode. as_str ( ) {
267- "bacon" => commands:: watch:: WatchMode :: Bacon ,
268- "cargo-watch" => commands:: watch:: WatchMode :: CargoWatch ,
269- "auto" => commands:: watch:: WatchMode :: Auto ,
270- _ => commands:: watch:: WatchMode :: Auto ,
271- } ;
272- commands:: run_test_watch ( & ctx, config, mode)
273- } else {
274- commands:: run_test ( & ctx, config)
275- }
256+ if watch {
257+ // Parse watch mode
258+ let mode = match watch_mode. as_str ( ) {
259+ "bacon" => commands:: watch:: WatchMode :: Bacon ,
260+ "cargo-watch" => commands:: watch:: WatchMode :: CargoWatch ,
261+ "auto" => commands:: watch:: WatchMode :: Auto ,
262+ _ => commands:: watch:: WatchMode :: Auto ,
263+ } ;
264+ commands:: run_test_watch ( & ctx, config, mode)
265+ } else {
266+ commands:: run_test ( & ctx, config)
276267 }
277- } ,
268+ }
278269
279270 // Dependency Unification
280271 Commands :: Unify ( unify_cmd) => match unify_cmd {
0 commit comments