diff --git a/packages/website/src/routes/docs.tsx b/packages/website/src/routes/docs.tsx index 28c68130b..03be4a85e 100644 --- a/packages/website/src/routes/docs.tsx +++ b/packages/website/src/routes/docs.tsx @@ -7,6 +7,7 @@ export const Route = createFileRoute('/docs')({ const navigation = [ { name: 'Getting started', href: '/docs' }, + { name: 'Git worktrees', href: '/docs/worktrees' }, { name: 'CLI', href: '/docs/cli' }, { name: 'Configuration', href: '/docs/configuration' }, { name: 'Security', href: '/docs/security' }, diff --git a/packages/website/src/routes/docs/worktrees.tsx b/packages/website/src/routes/docs/worktrees.tsx new file mode 100644 index 000000000..dac603ba1 --- /dev/null +++ b/packages/website/src/routes/docs/worktrees.tsx @@ -0,0 +1,235 @@ +import { createFileRoute } from '@tanstack/react-router' + +export const Route = createFileRoute('/docs/worktrees')({ + head: () => ({ + meta: [ + { title: 'Git Worktrees - Paseo Docs' }, + { + name: 'description', + content: 'Run agents in isolated git worktrees for parallel feature development.', + }, + ], + }), + component: Worktrees, +}) + +function Code({ children }: { children: React.ReactNode }) { + return ( +
+ Git worktrees let you have multiple working directories from the same repository. + Paseo uses them to run agents in isolated branches without switching contexts. +
++ Without worktrees, running multiple agents on the same repo means they share the + working directory. One agent's changes interfere with another's. You can't safely + run parallel tasks. +
++ With worktrees, each agent gets its own directory and branch. They can work + simultaneously without conflict. When an agent finishes, you review the diff, + merge the branch, and archive the worktree. +
+
+ Paseo creates worktrees under $PASEO_HOME/worktrees/,
+ organized by project:
+
+ {`~/.paseo/worktrees/
+├── my-project/
+│ ├── feature-auth/ # worktree for feature-auth branch
+│ └── fix-login-bug/ # worktree for fix-login-bug branch
+└── another-repo/
+ └── refactor-api/ # worktree for refactor-api branch`}
+
+ + The project name is derived from your git remote URL or repository directory name. + Worktree names map to branch names. +
+
+ 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{' '}
+ paseo.json file in your repository root:
+
+ {`{
+ "worktree": {
+ "setup": [
+ "npm ci",
+ "cp \\"$PASEO_ROOT_PATH/.env\\" \\"$PASEO_WORKTREE_PATH/.env\\""
+ ]
+ }
+}`}
+
+
+ The setup array contains shell commands that run
+ after the worktree is created. Use it to install dependencies, copy local config
+ files, or run any other initialization.
+
+ Setup commands have access to these environment variables: +
+$PASEO_ROOT_PATH — your original repository root
+ $PASEO_WORKTREE_PATH — the new worktree directory
+ $PASEO_BRANCH_NAME — the branch name created
+
+ Use $PASEO_ROOT_PATH to copy files that shouldn't
+ be in git (like .env) from your main checkout to
+ the worktree.
+
+ {`{
+ "worktree": {
+ "setup": ["npm ci"]
+ }
+}`}
+
+
+
+ {`{
+ "worktree": {
+ "setup": ["poetry install"]
+ }
+}`}
+
+
+
+ {`{
+ "worktree": {
+ "setup": [
+ "npm ci",
+ "cp \\"$PASEO_ROOT_PATH/.env\\" \\"$PASEO_WORKTREE_PATH/.env\\"",
+ "cp \\"$PASEO_ROOT_PATH/.env.local\\" \\"$PASEO_WORKTREE_PATH/.env.local\\""
+ ]
+ }
+}`}
+
+
+
+ {`{
+ "worktree": {
+ "setup": [
+ "npm ci",
+ "cp \\"$PASEO_ROOT_PATH/.env\\" \\"$PASEO_WORKTREE_PATH/.env\\"",
+ "npm run db:migrate"
+ ]
+ }
+}`}
+
+ + The typical workflow is: +
++ You can run multiple agents in different worktrees simultaneously. Each has its + own branch and working directory. +
++ Create an agent in a new worktree: +
+
+ {`paseo run --worktree feature-auth --base main "implement auth"`}
+
+ + List all worktrees: +
+
+ {`paseo worktree ls`}
+
+ + Archive a worktree (stops agents, removes directory): +
+
+ {`paseo worktree archive feature-auth`}
+
+ + Paseo stores metadata in each worktree's git directory to track the base branch. + This is used for diff operations and to know what branch to merge into. +
++ You don't need to manage this manually — Paseo handles it when creating and + archiving worktrees. +
+