Setup, Teardown & Run Scripts
Automate workspace initialization and dev servers
Overview
Run commands automatically when creating or deleting workspaces, and define dev server commands that launch via the Run button.
Create .superset/config.json in your project:
{
"setup": ["bun install", "cp \"$SUPERSET_ROOT_PATH/.env\" .env"],
"teardown": ["docker-compose down"],
"run": ["./.superset/run.sh"]
}How It Works
- Create workspace → setup commands run in a terminal
- Delete workspace → teardown commands run
- Click the Run button → run commands execute in a dedicated pane
Setup and teardown commands run sequentially in the workspace directory.
Run Script
The run field defines commands that start your dev server or other long-running processes. Unlike setup/teardown, run commands are:
- On-demand: triggered by the Run button, not automatically on workspace creation
- Restartable: stop and restart from the UI without recreating the workspace
- Dedicated pane: runs in its own terminal pane separate from your shell
{
"setup": ["npm install"],
"run": ["./.superset/run.sh"]
}Environment Variables
| Variable | Description |
|---|---|
SUPERSET_ROOT_PATH | Path to root repository |
SUPERSET_WORKSPACE_NAME | Current workspace name |
SUPERSET_WORKSPACE_PATH | Path to the workspace worktree |
Examples
Node.js:
{ "setup": ["bun install", "cp \"$SUPERSET_ROOT_PATH/.env\" .env"] }Docker:
{
"setup": ["docker-compose up -d", "bun run db:migrate"],
"teardown": ["docker-compose down -v"]
}Full config:
{
"setup": ["./.superset/setup.sh"],
"teardown": ["./.superset/teardown.sh"],
"run": ["./.superset/run.sh"]
}User Overrides
Override project scripts without modifying the repo by placing a config.json in your home directory, mirroring the repo's absolute path:
~/.superset/projects/<repo-path>/config.jsonFor a repo at /Users/me/work/app, that's ~/.superset/projects/Users/me/work/app/config.json. The legacy location keyed by project ID (~/.superset/projects/<project-id>/config.json) still works as a fallback.
Priority Order
For each key (setup, teardown, run), the highest-priority source that defines it wins:
~/.superset/projects/<repo-path>/config.json: user override<worktree>/.superset/config.json: workspace-specific (setup and teardown only)<repo>/.superset/config.json: project default
Levels merge per key: a key one level doesn't define falls through to the next. run resolves at the project level, so it skips the worktree layer.
Script Fallback
If no commands are configured for a key, Superset looks for a script instead: .superset/<key>.sh (setup.sh, teardown.sh, run.sh) in the worktree first, then the main repo. A gitignored script isn't checked out into new worktrees, so it typically exists only in the main repo.
Working Directory
Set cwd to run commands somewhere other than the workspace root. Relative paths resolve against the worktree:
{ "cwd": "apps/web", "run": ["bun dev"] }Examples
Custom setup script:
{
"setup": ["~/.superset/projects/<repo-path>/setup.sh"],
"teardown": ["~/.superset/projects/<repo-path>/teardown.sh"]
}Skip setup entirely:
{ "setup": [], "teardown": [] }Local Config
Extend or override your team's committed scripts without modifying the repo. Create .superset/config.local.json alongside config.json. It's gitignored automatically.
Prepend and/or append
Add steps before or after the team's scripts:
{
"setup": {
"before": ["echo 'running pre-setup'"],
"after": ["./.superset/my-post-setup.sh"]
},
"teardown": {
"after": ["./.superset/my-cleanup.sh"]
}
}Result: before → committed setup scripts → after. Keys you don't specify pass through unchanged.
Override entirely
Use a plain array to replace the team's scripts completely:
{
"setup": ["./.superset/my-custom-setup.sh"]
}Mix and match
Override one key while extending the other:
{
"setup": { "after": ["bun run my-extra-step"] },
"teardown": ["my-custom-teardown.sh"]
}Resolution order
The local config merges on top of whichever base config wins the priority order. If a config.local.json exists in both the worktree and main repo, the worktree's local config takes priority.
Force Delete
If teardown scripts fail during workspace deletion, you can force-delete to skip the failed teardown and continue cleanup.
When teardown fails:
- Error toast appears with "Delete Anyway" and "View Logs" buttons
- Click "Delete Anyway" to force-delete immediately
- Or click "View Logs" to review the failure, then force-delete from the dialog
Tips
- Keep setup fast: it runs on every workspace creation
- Commit
.superset/to share with team - Use shell scripts for complex logic:
"setup": ["./.superset/setup.sh"] - Use
config.local.jsonto add personal steps without touching the team's config - Use user overrides (
~/.superset/projects/) to replace scripts entirely per-project - Use
runfor dev servers instead of putting them insetup: run scripts are restartable and don't block workspace creation