@@ -1188,7 +1188,7 @@ enum SandboxCommands {
11881188 /// `.gitignore` rules are applied by default; use `--no-git-ignore` to
11891189 /// upload everything.
11901190 #[ arg( long, value_hint = ValueHint :: AnyPath , help_heading = "UPLOAD FLAGS" ) ]
1191- upload : Option < String > ,
1191+ upload : Vec < String > ,
11921192
11931193 /// Disable `.gitignore` filtering for `--upload`.
11941194 #[ arg( long, requires = "upload" , help_heading = "UPLOAD FLAGS" ) ]
@@ -2583,11 +2583,22 @@ async fn main() -> Result<()> {
25832583 labels_map. insert ( parts[ 0 ] . to_string ( ) , parts[ 1 ] . to_string ( ) ) ;
25842584 }
25852585
2586- // Parse --upload spec into (local_path, sandbox_path, git_ignore).
2587- let upload_spec = upload. as_deref ( ) . map ( |s| {
2588- let ( local, remote) = parse_upload_spec ( s) ;
2589- ( local, remote, !no_git_ignore)
2590- } ) ;
2586+ // Parse --upload specs into [(local_path, sandbox_path, git_ignore)].
2587+ let upload_specs: Vec < ( String , Option < String > , bool ) > = upload
2588+ . iter ( )
2589+ . map ( |s| {
2590+ let ( local, remote) = parse_upload_spec ( s) ;
2591+ ( local, remote, !no_git_ignore)
2592+ } )
2593+ . collect ( ) ;
2594+
2595+ // Validate all local paths before creating the sandbox so failures are
2596+ // fast and have no side effects.
2597+ for ( local, _, _) in & upload_specs {
2598+ if std:: fs:: symlink_metadata ( local) . is_err ( ) {
2599+ return Err ( miette:: miette!( "local path does not exist: {}" , local) ) ;
2600+ }
2601+ }
25912602
25922603 let editor = editor. map ( Into :: into) ;
25932604 let forward = forward
@@ -2604,7 +2615,7 @@ async fn main() -> Result<()> {
26042615 name. as_deref ( ) ,
26052616 from. as_deref ( ) ,
26062617 & ctx. name ,
2607- upload_spec . as_ref ( ) ,
2618+ & upload_specs ,
26082619 keep,
26092620 gpu,
26102621 gpu_device. as_deref ( ) ,
@@ -3484,6 +3495,43 @@ mod tests {
34843495 assert_eq ! ( remote, None ) ;
34853496 }
34863497
3498+ #[ test]
3499+ fn sandbox_create_upload_flag_accepts_multiple_values ( ) {
3500+ let result = Cli :: try_parse_from ( [
3501+ "openshell" ,
3502+ "sandbox" ,
3503+ "create" ,
3504+ "--upload" ,
3505+ "./src:/workspace/src" ,
3506+ "--upload" ,
3507+ "./config:/workspace/config" ,
3508+ ] ) ;
3509+ assert ! (
3510+ result. is_ok( ) ,
3511+ "--upload should be repeatable, got: {:?}" ,
3512+ result. err( )
3513+ ) ;
3514+ }
3515+
3516+ #[ test]
3517+ fn sandbox_create_upload_flag_accepts_zero_values ( ) {
3518+ let result = Cli :: try_parse_from ( [ "openshell" , "sandbox" , "create" ] ) ;
3519+ assert ! (
3520+ result. is_ok( ) ,
3521+ "sandbox create with no --upload should succeed, got: {:?}" ,
3522+ result. err( )
3523+ ) ;
3524+ }
3525+
3526+ #[ test]
3527+ fn sandbox_create_no_git_ignore_requires_upload ( ) {
3528+ let result = Cli :: try_parse_from ( [ "openshell" , "sandbox" , "create" , "--no-git-ignore" ] ) ;
3529+ assert ! (
3530+ result. is_err( ) ,
3531+ "--no-git-ignore without --upload should be rejected"
3532+ ) ;
3533+ }
3534+
34873535 #[ test]
34883536 fn resolve_sandbox_name_returns_explicit_name ( ) {
34893537 // When a name is provided, it should be returned regardless of any
0 commit comments