Skip to main content

Why use setup scripts?

When working in parallel with worktrees, each new worktree may need dependencies installed or other development environment preparation. A setup script runs those steps for you, so you do not have to repeat them manually every time you create a worktree.

Configure a setup script in project settings

You can configure setup for a project in Settings → Scripts or in .radius/settings.toml. Radius runs it every time it creates a new worktree for that project. It does not run when you reopen an existing worktree.

Variables available to setup scripts

Radius automatically provides every setup script with information about the new worktree and its place in the browser: The script also receives variables configured in the project’s [environment] settings. See Environment and files for configuration and inheritance details.

Install dependencies

For many projects, setup can be a single install command:
Radius runs the command as a background process from the new worktree directory, so setup does not open or take over a terminal tab. Use the install command appropriate for your project, such as npm install, bundle install, or uv sync.

Set up your workspace

For instance, here is a short example that installs dependencies, then opens a terminal and localhost server beside the new worktree’s chat:
In Settings → Scripts, paste only the commands inside the multiline string. Radius stores them as one setup command for you.

Move a larger setup into a file

When the setup becomes long enough to test or reuse on its own, move it into a shell script. Save this as scripts/setup-worktree.sh:
Then tell Bash to run the file:
See Run and archive scripts for named run commands and pre-archive cleanup.