# add

> For AI agents: the complete documentation index is at https://buddy.works/llms.txt

## Usage

```bash
bdy sandbox fetch add|create [options] <identifier>
```

Add a source to fetch into a sandbox: the project repository (default), a public repository (--repository) or an artifact (--artifact) Required scopes: SANDBOX_WRITE

## Arguments

| **Argument** | **Description** |
| :--- | :--- |
| `identifier` | Sandbox identifier (required) |

## Options

| **Option** | **Description** |
| :--- | :--- |
| `--context <name>` | Connection and scope context: default, git, link or a saved name. Overrides the globally active context for this invocation. |
| `--examples` | Show only examples; with this flag --format accepts text, json or jsonl |
| `--verbose` | Show REST API requests, responses, timing and retries on stderr |
| `-w, --workspace <domain>` | Workspace URL handle. Can be set via variable: BUDDY_WORKSPACE |
| `-p, --project <name>` | Project name. Can be set via variable: BUDDY_PROJECT |
| `--scope <scope>` | Force scope (WORKSPACE, PROJECT, ENVIRONMENT). By default calculated by provided options and environmental variables (--project, |
| `--environment` | BUDDY_PROJECT, linked project) |
| `-e, --environment <identifier>` | Environment identifier |
| `--ref <ref>` | Branch, tag or commit to checkout. Defaults to the default branch |
| `--repository <url>` | URL of a public git repository to fetch instead of the project repository |
| `--path <directory>` | Target directory in the sandbox. Defaults to the app directory, two fetches cannot share it |
| `--artifact <name:version>` | Artifact to fetch, in format name:version |
| `--source-path <path>` | Path inside the artifact to fetch instead of its whole content (requires --artifact) |
| `--build <command>` | Command to run after fetching |
| `--format <text\|json>` | Output format: json, text. JSON CLI errors: {error:{code,message,hint}}, exit 1. Default: text (choices: "text", "json") |
| `-h, --help` | display help for command |

Documentation for bdy v1.25.34

## Examples

### Fetch a branch of the project repository into the app directory

```bash
bdy sb fetch add sandbox-identifier --ref main
```

### Fetch a public repository and build it

```bash
bdy sb fetch add sandbox-identifier --repository https://github.com/buddy/plugin --path /home/buddy/plugin --build "npm ci"
```

### Fetch one file of an artifact

```bash
bdy sb fetch add sandbox-identifier --artifact my-artifact:latest --source-path dist.zip --path /home/buddy/dist
```


---
Original source: https://buddy.works/docs/cli/sandbox/fetch/add