docs(cli): say --upload cannot take a command (#4502)

Signed-off-by: Eric Curtin <eric.curtin@docker.com>
This commit is contained in:
Eric Curtin
2026-10-20 18:46:42 +00:00
committed by GitHub
parent 32f026442e
commit ea265a2f9a
4 changed files with 42 additions and 7 deletions
+33
View File
@@ -1472,6 +1472,10 @@ enum SandboxCommands {
/// Outside a Git work tree, uploads proceed unfiltered with a warning.
/// Filtering errors or empty selections stop the upload; use
/// `--no-git-ignore` to intentionally upload everything.
///
/// Cannot be combined with a trailing command, because uploads finish
/// after the main process starts. Create the sandbox without a command,
/// then run the workload with `sandbox exec`.
#[arg(
long,
value_hint = ValueHint::AnyPath,
@@ -4878,6 +4882,35 @@ mod tests {
);
}
#[test]
fn sandbox_create_upload_conflicts_with_command_and_help_says_so() {
let err = Cli::try_parse_from([
"openshell",
"sandbox",
"create",
"--upload",
".",
"--",
"true",
])
.expect_err("--upload with a trailing command should be rejected");
assert_eq!(err.kind(), clap::error::ErrorKind::ArgumentConflict);
let cmd = Cli::command();
let create = cmd
.find_subcommand("sandbox")
.and_then(|c| c.find_subcommand("create"))
.expect("missing sandbox create subcommand");
let help = create
.get_arguments()
.find(|a| a.get_id() == "upload")
.and_then(|a| a.get_long_help())
.expect("--upload has long help")
.to_string();
assert!(help.contains("Cannot be combined with a trailing command"));
assert!(help.contains("sandbox exec"));
}
#[test]
fn sandbox_create_no_git_ignore_requires_upload() {
let result = Cli::try_parse_from(["openshell", "sandbox", "create", "--no-git-ignore"]);
+3 -2
View File
@@ -946,10 +946,11 @@ directory are also accepted.
<Note>
You can also upload files at creation time with the `--upload` flag on
`openshell sandbox create`. Pass `--upload` multiple times to upload
several paths in a single command:
several paths in a single command. You cannot add a trailing command, so run
the workload from the shell that opens or with `sandbox exec`:
```shell
openshell sandbox create --from registry.example.com/your-org/claude-agent:latest --upload ./src:/workspace/src --upload ./config:/workspace/config -- claude
openshell sandbox create --from registry.example.com/your-org/claude-agent:latest --upload ./src:/workspace/src --upload ./config:/workspace/config
```
</Note>
+6 -4
View File
@@ -185,18 +185,20 @@ blocks. When you're done, type `/quit` in Pi to exit.
## Work on a Local Project
To point Pi at your own code, run this from your project directory. `--upload`
copies the directory into the sandbox before Pi starts, skipping anything
`.gitignore` excludes.
copies the directory into the sandbox, skipping anything `.gitignore` excludes.
You cannot combine `--upload` with a trailing command, so start Pi from the
shell that opens.
```shell
openshell sandbox create \
--name pi-project \
--from pi-agent:local \
--provider openrouter \
--upload .:/workspace \
-- pi
--upload .:/workspace
```
In the sandbox shell, run `pi`.
Pi's changes stay inside the sandbox. To copy them back, run
`openshell sandbox download` from another terminal while Pi is still running.
Refer to [Transfer Files](/how-it-works/sandboxes/overview#transfer-files).
-1
View File
@@ -291,7 +291,6 @@ openshell sandbox create \
--provider my-github \
--provider my-claude \
--policy ./my-policy.yaml \
--upload .:/workspace \
--label team=agents \
-- claude
```