# dev

Run a local command in the application root with the linked application's runtime variables injected over your environment.

URL: https://coolship.itrocas.com/docs/commands/dev

```text
coolship dev [target] [-- command...] [flags]
```

`dev` runs a local process so that it sees what it would see on Coolify, without pulling a `.env` file first. A command after `--` runs directly. Without one, the binding's `dev` setting runs through your shell:

```toml title="coolship.toml"
[project]
dev = "npm run dev"
```

The application's **runtime** variables are injected over the inherited environment. Unlike `env pull`, shared references such as `{{team.API_KEY}}` are injected as the values they resolve to. Values Coolify withholds are reported and left to your own environment. The command's exit status becomes Coolship's, and Ctrl-C is forwarded to it.

## Flags

| Flag        | Purpose                                                         |
| ----------- | --------------------------------------------------------------- |
| `--preview` | Inject the preview-deployment scope instead of the regular one. |

## Examples

```bash
coolship dev -- npm run dev
coolship dev -- go run .
coolship dev api -- go run .            # named target in a monorepo
coolship dev                            # runs the binding's dev setting
coolship dev --preview -- npm test
```

## Behavior

* The process runs in the application root (`root` in the binding), whatever directory you invoked Coolship from.
* The injected pairs are layered over your environment: a variable set both locally and on Coolify takes Coolify's value.
* On cancellation the child receives an interrupt and is killed after a grace period if it does not exit.
* `dev` is the only command that resolves shared references; `env pull` keeps them as references so a push can never flatten them. See [Environment variables](https://coolship.itrocas.com/docs/concepts/variables).

## Output

`dev` prints nothing of its own on stdout; the child's streams are yours. Withheld variables are reported on stderr before the process starts. `--format json` does not change the child's output.

## Exit codes

The child's exit status. `2` when the directory is not linked or there is neither a command nor a `dev` setting; `1` when the variables cannot be read; `130` when interrupted before the child started.
