# fetch

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

## Usage

```bash
bdy sandbox fetch|f [options] [command]
```

Manage sources (repositories and artifacts) fetched into a sandbox

## 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 |
| `-h, --help` | display help for command |

## Available Commands

| **Command** | **Description** |
| :--- | :--- |
| [add](https://buddy.works/docs/cli/sandbox/fetch/add.md) | Add a source to fetch into a sandbox: the project repository (default), a
  public repository (--repository) or an artifact (--artifact) Required scopes:
  SANDBOX_WRITE |
| [delete](https://buddy.works/docs/cli/sandbox/fetch/delete.md) | Remove a source from a sandbox. Files already fetched into the sandbox are
  left in place Required scopes: SANDBOX_WRITE |
| [get](https://buddy.works/docs/cli/sandbox/fetch/get.md) | Show fetch details Required scopes: SANDBOX_READ |
| [list](https://buddy.works/docs/cli/sandbox/fetch/list.md) | List sources fetched into a sandbox with their revision and how far behind
  they are Required scopes: SANDBOX_READ |
| [refetch](https://buddy.works/docs/cli/sandbox/fetch/refetch.md) | Fetch a source again Required scopes: SANDBOX_WRITE |

Documentation for bdy v1.25.34

## Examples

### List sources fetched into a sandbox

```bash
bdy sb fetch ls sandbox-identifier
```

### Return the result as JSON

```bash
bdy sandbox fetch list my-sandbox --format json
```

### Get fetch by its target directory

```bash
bdy sb fetch get sandbox-identifier /home/buddy/plugin
```

### Get the fetch into the app directory

```bash
bdy sb fetch get sandbox-identifier :default
```

### 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
```

### Remove a fetch and automatically confirm

```bash
bdy sb fetch rm sandbox-identifier /home/buddy/plugin -f
```

### Fetch a source again

```bash
bdy sb fetch refetch sandbox-identifier /home/buddy/plugin
```


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