Skip to content

Commit ea265a2

Browse files
authored
docs(cli): say --upload cannot take a command (#4502)
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
1 parent 32f0264 commit ea265a2

4 files changed

Lines changed: 42 additions & 7 deletions

File tree

‎crates/openshell-cli/src/main.rs‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,6 +1472,10 @@ enum SandboxCommands {
14721472
/// Outside a Git work tree, uploads proceed unfiltered with a warning.
14731473
/// Filtering errors or empty selections stop the upload; use
14741474
/// `--no-git-ignore` to intentionally upload everything.
1475+
///
1476+
/// Cannot be combined with a trailing command, because uploads finish
1477+
/// after the main process starts. Create the sandbox without a command,
1478+
/// then run the workload with `sandbox exec`.
14751479
#[arg(
14761480
long,
14771481
value_hint = ValueHint::AnyPath,
@@ -4878,6 +4882,35 @@ mod tests {
48784882
);
48794883
}
48804884

4885+
#[test]
4886+
fn sandbox_create_upload_conflicts_with_command_and_help_says_so() {
4887+
let err = Cli::try_parse_from([
4888+
"openshell",
4889+
"sandbox",
4890+
"create",
4891+
"--upload",
4892+
".",
4893+
"--",
4894+
"true",
4895+
])
4896+
.expect_err("--upload with a trailing command should be rejected");
4897+
assert_eq!(err.kind(), clap::error::ErrorKind::ArgumentConflict);
4898+
4899+
let cmd = Cli::command();
4900+
let create = cmd
4901+
.find_subcommand("sandbox")
4902+
.and_then(|c| c.find_subcommand("create"))
4903+
.expect("missing sandbox create subcommand");
4904+
let help = create
4905+
.get_arguments()
4906+
.find(|a| a.get_id() == "upload")
4907+
.and_then(|a| a.get_long_help())
4908+
.expect("--upload has long help")
4909+
.to_string();
4910+
assert!(help.contains("Cannot be combined with a trailing command"));
4911+
assert!(help.contains("sandbox exec"));
4912+
}
4913+
48814914
#[test]
48824915
fn sandbox_create_no_git_ignore_requires_upload() {
48834916
let result = Cli::try_parse_from(["openshell", "sandbox", "create", "--no-git-ignore"]);

‎docs/how-it-works/sandboxes/overview.mdx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -946,10 +946,11 @@ directory are also accepted.
946946
<Note>
947947
You can also upload files at creation time with the `--upload` flag on
948948
`openshell sandbox create`. Pass `--upload` multiple times to upload
949-
several paths in a single command:
949+
several paths in a single command. You cannot add a trailing command, so run
950+
the workload from the shell that opens or with `sandbox exec`:
950951
951952
```shell
952-
openshell sandbox create --from registry.example.com/your-org/claude-agent:latest --upload ./src:/workspace/src --upload ./config:/workspace/config -- claude
953+
openshell sandbox create --from registry.example.com/your-org/claude-agent:latest --upload ./src:/workspace/src --upload ./config:/workspace/config
953954
```
954955
955956
</Note>

‎docs/tutorials/run-pi-with-openrouter.mdx‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,18 +185,20 @@ blocks. When you're done, type `/quit` in Pi to exit.
185185
## Work on a Local Project
186186

187187
To point Pi at your own code, run this from your project directory. `--upload`
188-
copies the directory into the sandbox before Pi starts, skipping anything
189-
`.gitignore` excludes.
188+
copies the directory into the sandbox, skipping anything `.gitignore` excludes.
189+
You cannot combine `--upload` with a trailing command, so start Pi from the
190+
shell that opens.
190191

191192
```shell
192193
openshell sandbox create \
193194
--name pi-project \
194195
--from pi-agent:local \
195196
--provider openrouter \
196-
--upload .:/workspace \
197-
-- pi
197+
--upload .:/workspace
198198
```
199199

200+
In the sandbox shell, run `pi`.
201+
200202
Pi's changes stay inside the sandbox. To copy them back, run
201203
`openshell sandbox download` from another terminal while Pi is still running.
202204
Refer to [Transfer Files](/how-it-works/sandboxes/overview#transfer-files).

‎skills/openshell-cli/SKILL.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,6 @@ openshell sandbox create \
291291
--provider my-github \
292292
--provider my-claude \
293293
--policy ./my-policy.yaml \
294-
--upload .:/workspace \
295294
--label team=agents \
296295
-- claude
297296
```

0 commit comments

Comments
 (0)