E2E Encrypted Relay
-or
-Direct Connection
+E2E Encrypted Relay
+or
+Direct Connection
When Paseo creates a worktree, it's a fresh checkout. Dependencies aren't installed, config files aren't copied. You can automate setup by creating a{" "} @@ -117,6 +117,20 @@ function Worktrees() { the worktree is created. Use it to install dependencies, copy local config files, or run any other initialization.
+
+ You can also add a teardown array for cleanup commands
+ that run before Paseo removes the worktree directory during archive:
+
+ {`{
+ "worktree": {
+ "teardown": [
+ "pkill -f \\"vite --port $PASEO_WORKTREE_PORT\\" || true",
+ "rm -rf \\"$PASEO_WORKTREE_PATH/.cache\\""
+ ]
+ }
+}`}
+
paseo.json in the selected base branch. If you pick{" "}
@@ -130,7 +144,7 @@ function Worktrees() {
- Setup commands have access to these environment variables: + Setup and teardown commands have access to these environment variables:
$PASEO_BRANCH_NAME — the branch name created
$PASEO_WORKTREE_PORT — an available local port for
- setup scripts
+ $PASEO_WORKTREE_PORT — the worktree port, when
+ runtime metadata exists
@@ -157,6 +171,39 @@ function Worktrees() {
shouldn't be in git (like .env) from your source
checkout to the worktree.
+ $PASEO_WORKTREE_PORT is available when the worktree
+ was bootstrapped with a port. That makes it useful for both starting services in setup
+ and stopping them again in teardown.
+
+ Teardown runs during archive, before Paseo removes the worktree directory. Use it for + cleanup that needs access to the worktree path or its assigned port. +
+
+ Common uses include stopping dev servers on{" "}
+ $PASEO_WORKTREE_PORT, deleting generated files, or
+ deregistering services tied to that worktree.
+
+ {`{
+ "worktree": {
+ "setup": [
+ "npm ci",
+ "nohup npm run dev -- --port $PASEO_WORKTREE_PORT > \\"$PASEO_WORKTREE_PATH/dev.log\\" 2>&1 &"
+ ],
+ "teardown": [
+ "pkill -f \\"npm run dev -- --port $PASEO_WORKTREE_PORT\\" || true",
+ "rm -f \\"$PASEO_WORKTREE_PATH/dev.log\\""
+ ]
+ }
+}`}
+