Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 23 additions & 13 deletions content/docs/worktree/repo-configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,27 @@ If a run-script tab is already active for that worktree, Supacode closes it befo

The setup script launches once after a new worktree is created.

Good setup scripts:

- start your coding agent
- install dependencies
- generate local artifacts
- boot a local service you always need

Example:
Good examples:

```bash
codex
```
# copy gitignored files to the worktree
cp "$SUPACODE_ROOT_PATH/.env" .env

Or:

```bash
# install dependencies
pnpm install

# generate local artifacts
pnpm prisma generate

# boot a local service you always need
docker compose up -d

# start your coding agent (codex, claude, opencode, copilot, ...)
codex
```

A new worktree contains no gitignored files. Copy the ones you need in the setup script, or enable **Copy ignored files to new worktrees** in repository settings to copy all of them, including large directories such as `node_modules`.

![Setup Script](/setup-script-claude.png)

Supacode runs the setup script inside the new worktree's terminal context, so the output is visible immediately in the app.
Expand All @@ -73,6 +74,15 @@ docker compose down

If the archive script fails, the archive does not proceed.

## Script environment

These variables are available in every Supacode terminal, including run, setup, and archive scripts:

| Variable | Value |
| --- | --- |
| `SUPACODE_ROOT_PATH` | Path to the main repository |
| `SUPACODE_WORKTREE_PATH` | Path to the current worktree |

## Where this configuration lives

These values are repository settings.
Expand Down