[{"data":1,"prerenderedAt":611},["ShallowReactive",2],{"doc:en:\u002Fusing-zekoder\u002Fworktrees":3,"navigation:en":382,"surround:en:\u002Fusing-zekoder\u002Fworktrees":607},{"page":4,"fallback":381},{"id":5,"title":6,"body":7,"description":373,"extension":374,"meta":375,"navigation":376,"path":377,"seo":378,"stem":379,"__hash__":380},"docs_en\u002Fusing-zekoder\u002Fworktrees.md","Worktree setup and teardown",{"type":8,"value":9,"toc":368},"minimark",[10,29,48,164,167,170,184,199,201,208,212,215,288,291,364],[11,12,13,14,18,19,22,23,28],"p",{},"A new worktree is a clean checkout, so it has no installed dependencies or local services. ",[15,16,17],"strong",{},"Setup"," and ",[15,20,21],{},"Teardown"," commands prepare and clean up each worktree Zekoder creates for a project. See ",[24,25,27],"a",{"href":26},"\u002Fusing-zekoder\u002Fprojects-and-workspaces","Projects and workspaces"," for how worktrees are created.",[11,30,31,32,35,36,35,39,42,43,47],{},"Edit them in the workspace's ",[15,33,34],{},"+"," → ",[15,37,38],{},"Project settings",[15,40,41],{},"Worktree lifecycle hooks",". They are saved to ",[44,45,46],"code",{},"zekoder.json"," at the project root.",[49,50,55],"pre",{"className":51,"code":52,"language":53,"meta":54,"style":54},"language-json shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","{\n  \"worktree\": {\n    \"setup\": [\"npm install\"],\n    \"teardown\": [\"docker compose down\"],\n    \"teardownTimeoutMs\": 60000\n  }\n}\n","json","",[44,56,57,66,85,113,136,152,158],{"__ignoreMap":54},[58,59,62],"span",{"class":60,"line":61},"line",1,[58,63,65],{"class":64},"sMK4o","{\n",[58,67,69,72,76,79,82],{"class":60,"line":68},2,[58,70,71],{"class":64},"  \"",[58,73,75],{"class":74},"spNyl","worktree",[58,77,78],{"class":64},"\"",[58,80,81],{"class":64},":",[58,83,84],{"class":64}," {\n",[58,86,88,91,95,97,99,102,104,108,110],{"class":60,"line":87},3,[58,89,90],{"class":64},"    \"",[58,92,94],{"class":93},"sBMFI","setup",[58,96,78],{"class":64},[58,98,81],{"class":64},[58,100,101],{"class":64}," [",[58,103,78],{"class":64},[58,105,107],{"class":106},"sfazB","npm install",[58,109,78],{"class":64},[58,111,112],{"class":64},"],\n",[58,114,116,118,121,123,125,127,129,132,134],{"class":60,"line":115},4,[58,117,90],{"class":64},[58,119,120],{"class":93},"teardown",[58,122,78],{"class":64},[58,124,81],{"class":64},[58,126,101],{"class":64},[58,128,78],{"class":64},[58,130,131],{"class":106},"docker compose down",[58,133,78],{"class":64},[58,135,112],{"class":64},[58,137,139,141,144,146,148],{"class":60,"line":138},5,[58,140,90],{"class":64},[58,142,143],{"class":93},"teardownTimeoutMs",[58,145,78],{"class":64},[58,147,81],{"class":64},[58,149,151],{"class":150},"sbssI"," 60000\n",[58,153,155],{"class":60,"line":154},6,[58,156,157],{"class":64},"  }\n",[58,159,161],{"class":60,"line":160},7,[58,162,163],{"class":64},"}\n",[165,166,17],"h2",{"id":94},[11,168,169],{},"Setup commands run in order, in the new worktree, before terminals and the first agent start. The first command that fails stops the rest and the worktree is not created.",[11,171,172,173,176,177,179,180,183],{},"A new worktree uses the setup commands from the base branch you pick in ",[15,174,175],{},"Start from",". If you changed ",[44,178,46],{}," and have not committed it, the settings page shows ",[15,181,182],{},"Commit zekoder.json changes",": commit first, or the new worktree starts without them.",[11,185,186,187,190,191,198],{},"To copy ignored files such as ",[44,188,189],{},".env",", use a ",[24,192,194,197],{"href":193},"\u002Fusing-zekoder\u002Fprojects-and-workspaces#copy-local-files-into-new-worktrees",[44,195,196],{},".worktreeinclude"," file"," instead of a setup command.",[165,200,21],{"id":120},[11,202,203,204,207],{},"Teardown commands run in order when you archive a worktree, before it is removed. One deadline covers every command: 60 seconds by default, or ",[44,205,206],{},"worktree.teardownTimeoutMs",". If a command fails or the deadline passes, Zekoder keeps the worktree.",[165,209,211],{"id":210},"environment-variables","Environment variables",[11,213,214],{},"Setup and teardown commands receive:",[216,217,218,231],"table",{},[219,220,221],"thead",{},[222,223,224,228],"tr",{},[225,226,227],"th",{},"Variable",[225,229,230],{},"Value",[232,233,234,245,258,268,278],"tbody",{},[222,235,236,242],{},[237,238,239],"td",{},[44,240,241],{},"PASEO_SOURCE_CHECKOUT_PATH",[237,243,244],{},"The original repository folder, shared by all worktrees.",[222,246,247,252],{},[237,248,249],{},[44,250,251],{},"PASEO_ROOT_PATH",[237,253,254,255,257],{},"Alias of ",[44,256,241],{},".",[222,259,260,265],{},[237,261,262],{},[44,263,264],{},"PASEO_WORKTREE_PATH",[237,266,267],{},"The worktree folder.",[222,269,270,275],{},[237,271,272],{},[44,273,274],{},"PASEO_BRANCH_NAME",[237,276,277],{},"The worktree's branch.",[222,279,280,285],{},[237,281,282],{},[44,283,284],{},"PASEO_WORKTREE_PORT",[237,286,287],{},"A free port reserved for this worktree. Stable for its lifetime.",[11,289,290],{},"Use the port to run a dev server per worktree without collisions:",[49,292,294],{"className":51,"code":293,"language":53,"meta":54,"style":54},"{\n  \"worktree\": {\n    \"setup\": [\"cp \\\"$PASEO_SOURCE_CHECKOUT_PATH\u002F.env\\\" .env\", \"npm install\"]\n  }\n}\n",[44,295,296,300,312,356,360],{"__ignoreMap":54},[58,297,298],{"class":60,"line":61},[58,299,65],{"class":64},[58,301,302,304,306,308,310],{"class":60,"line":68},[58,303,71],{"class":64},[58,305,75],{"class":74},[58,307,78],{"class":64},[58,309,81],{"class":64},[58,311,84],{"class":64},[58,313,314,316,318,320,322,324,326,329,333,336,338,341,343,346,349,351,353],{"class":60,"line":87},[58,315,90],{"class":64},[58,317,94],{"class":93},[58,319,78],{"class":64},[58,321,81],{"class":64},[58,323,101],{"class":64},[58,325,78],{"class":64},[58,327,328],{"class":106},"cp ",[58,330,332],{"class":331},"sTEyZ","\\\"",[58,334,335],{"class":106},"$PASEO_SOURCE_CHECKOUT_PATH\u002F.env",[58,337,332],{"class":331},[58,339,340],{"class":106}," .env",[58,342,78],{"class":64},[58,344,345],{"class":64},",",[58,347,348],{"class":64}," \"",[58,350,107],{"class":106},[58,352,78],{"class":64},[58,354,355],{"class":64},"]\n",[58,357,358],{"class":60,"line":115},[58,359,157],{"class":64},[58,361,362],{"class":60,"line":138},[58,363,163],{"class":64},[365,366,367],"style",{},"html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}",{"title":54,"searchDepth":68,"depth":68,"links":369},[370,371,372],{"id":94,"depth":68,"text":17},{"id":120,"depth":68,"text":21},{"id":210,"depth":68,"text":211},"Run commands when Zekoder creates or removes a worktree, and use the environment variables they receive.","md",{},{"order":68},"\u002Fusing-zekoder\u002Fworktrees",{"title":6,"description":373},"using-zekoder\u002Fworktrees","krq-bbuobPVASHt_jMC_qgEgb7a-Z9xY_VkI3_ESrlY",false,[383,388,409,434,485,502,542,574,588,602],{"title":384,"path":385,"stem":386,"order":387},"Zekoder documentation","\u002F","index",-1,{"title":389,"path":390,"stem":391,"children":392,"page":381},"Getting started","\u002Fgetting-started","getting-started",[393,397,401,405],{"title":394,"path":395,"stem":396},"Install","\u002Fgetting-started\u002Finstall","getting-started\u002Finstall",{"title":398,"path":399,"stem":400,"order":61},"Quick start","\u002Fgetting-started\u002Fquick-start","getting-started\u002Fquick-start",{"title":402,"path":403,"stem":404,"order":68},"Connect a host","\u002Fgetting-started\u002Fconnect-a-host","getting-started\u002Fconnect-a-host",{"title":406,"path":407,"stem":408,"order":87},"Install on a remote machine","\u002Fgetting-started\u002Fremote-host","getting-started\u002Fremote-host",{"title":410,"path":411,"stem":412,"children":413,"page":381},"Hosts","\u002Fhosts","hosts",[414,418,422,426,430],{"title":415,"path":416,"stem":417},"Security","\u002Fhosts\u002Fsecurity","hosts\u002Fsecurity",{"title":419,"path":420,"stem":421,"order":61},"The built-in host","\u002Fhosts\u002Fbuilt-in-host","hosts\u002Fbuilt-in-host",{"title":423,"path":424,"stem":425,"order":68},"Update a remote host","\u002Fhosts\u002Fupdate-a-remote-host","hosts\u002Fupdate-a-remote-host",{"title":427,"path":428,"stem":429,"order":87},"Register a remote host on a host","\u002Fhosts\u002Fregister-a-remote-host","hosts\u002Fregister-a-remote-host",{"title":431,"path":432,"stem":433,"order":115},"Connectivity","\u002Fhosts\u002Fconnectivity","hosts\u002Fconnectivity",{"title":435,"path":436,"stem":437,"children":438},"Supported providers","\u002Fproviders","providers",[439,442,446,450,454,458,462,466,470,475,480],{"title":435,"path":436,"stem":440,"order":441},"providers\u002Findex",0,{"title":443,"path":444,"stem":445,"order":61},"Antigravity","\u002Fproviders\u002Fantigravity","providers\u002Fantigravity",{"title":447,"path":448,"stem":449,"order":68},"Claude Code","\u002Fproviders\u002Fclaude-code","providers\u002Fclaude-code",{"title":451,"path":452,"stem":453,"order":87},"Codex","\u002Fproviders\u002Fcodex","providers\u002Fcodex",{"title":455,"path":456,"stem":457,"order":115},"fx","\u002Fproviders\u002Ffx","providers\u002Ffx",{"title":459,"path":460,"stem":461,"order":138},"GitHub Copilot","\u002Fproviders\u002Fgithub-copilot","providers\u002Fgithub-copilot",{"title":463,"path":464,"stem":465,"order":154},"Hoplite","\u002Fproviders\u002Fhoplite","providers\u002Fhoplite",{"title":467,"path":468,"stem":469,"order":160},"Muse Code","\u002Fproviders\u002Fmuse-code","providers\u002Fmuse-code",{"title":471,"path":472,"stem":473,"order":474},"Oh My Pi","\u002Fproviders\u002Fomp","providers\u002Fomp",8,{"title":476,"path":477,"stem":478,"order":479},"OpenCode","\u002Fproviders\u002Fopencode","providers\u002Fopencode",9,{"title":481,"path":482,"stem":483,"order":484},"Pi","\u002Fproviders\u002Fpi","providers\u002Fpi",10,{"title":486,"path":487,"stem":488,"children":489,"page":381},"Reference","\u002Freference","reference",[490,494,498],{"title":491,"path":492,"stem":493,"order":61},"CLI reference","\u002Freference\u002Fcli","reference\u002Fcli",{"title":495,"path":496,"stem":497,"order":61},"Plugin reference","\u002Freference\u002Fplugins","reference\u002Fplugins",{"title":499,"path":500,"stem":501,"order":68},"Configuration","\u002Freference\u002Fconfiguration","reference\u002Fconfiguration",{"title":503,"path":504,"stem":505,"children":506,"page":381},"Using Zekoder","\u002Fusing-zekoder","using-zekoder",[507,509,513,514,518,522,526,530,534,538],{"title":27,"path":26,"stem":508,"order":61},"using-zekoder\u002Fprojects-and-workspaces",{"title":510,"path":511,"stem":512,"order":68},"Agents and the composer","\u002Fusing-zekoder\u002Fagents","using-zekoder\u002Fagents",{"title":6,"path":377,"stem":379,"order":68},{"title":515,"path":516,"stem":517,"order":87},"Review changes","\u002Fusing-zekoder\u002Freview-changes","using-zekoder\u002Freview-changes",{"title":519,"path":520,"stem":521,"order":115},"Keyboard shortcuts","\u002Fusing-zekoder\u002Fkeyboard-shortcuts","using-zekoder\u002Fkeyboard-shortcuts",{"title":523,"path":524,"stem":525,"order":138},"Settings and updates","\u002Fusing-zekoder\u002Fsettings-and-updates","using-zekoder\u002Fsettings-and-updates",{"title":527,"path":528,"stem":529,"order":154},"Metadata generation","\u002Fusing-zekoder\u002Fmetadata-generation","using-zekoder\u002Fmetadata-generation",{"title":531,"path":532,"stem":533,"order":160},"Schedules","\u002Fusing-zekoder\u002Fschedules","using-zekoder\u002Fschedules",{"title":535,"path":536,"stem":537,"order":474},"Orchestration skills","\u002Fusing-zekoder\u002Fskills","using-zekoder\u002Fskills",{"title":539,"path":540,"stem":541,"order":479},"Phone and web","\u002Fusing-zekoder\u002Fphone-and-web","using-zekoder\u002Fphone-and-web",{"title":543,"path":544,"stem":545,"children":546,"page":381},"Zekoder workflow","\u002Fzekoder-workflow","zekoder-workflow",[547,551,555,559,562,566,570],{"title":548,"path":549,"stem":550,"order":61},"How the workflow works","\u002Fzekoder-workflow\u002Foverview","zekoder-workflow\u002Foverview",{"title":552,"path":553,"stem":554,"order":68},"Commands","\u002Fzekoder-workflow\u002Fcommands","zekoder-workflow\u002Fcommands",{"title":556,"path":557,"stem":558,"order":87},"The Issues screen","\u002Fzekoder-workflow\u002Fissues","zekoder-workflow\u002Fissues",{"title":38,"path":560,"stem":561,"order":115},"\u002Fzekoder-workflow\u002Fproject-settings","zekoder-workflow\u002Fproject-settings",{"title":563,"path":564,"stem":565,"order":138},"Coding health reports","\u002Fzekoder-workflow\u002Freports","zekoder-workflow\u002Freports",{"title":567,"path":568,"stem":569,"order":154},"Versions and updates","\u002Fzekoder-workflow\u002Fversion","zekoder-workflow\u002Fversion",{"title":571,"path":572,"stem":573,"order":160},"Error codes","\u002Fzekoder-workflow\u002Ferror-codes","zekoder-workflow\u002Ferror-codes",{"title":575,"order":576,"path":577,"stem":578,"children":579,"page":381},"Productivity tips",50,"\u002Fproductivity-tips","productivity-tips",[580,584],{"title":581,"path":582,"stem":583,"order":61},"Background tasks","\u002Fproductivity-tips\u002Fbackground-tasks","productivity-tips\u002Fbackground-tasks",{"title":585,"path":586,"stem":587,"order":68},"Agent-to-agent messaging","\u002Fproductivity-tips\u002Fagent-messaging","productivity-tips\u002Fagent-messaging",{"title":589,"order":590,"path":591,"stem":592,"children":593,"page":381},"FAQs",98,"\u002Ffaq","faq",[594,598],{"title":595,"path":596,"stem":597,"order":61},"Codex related FAQs","\u002Ffaq\u002Fcodex","faq\u002Fcodex",{"title":599,"path":600,"stem":601,"order":68},"Linux related FAQs","\u002Ffaq\u002Flinux","faq\u002Flinux",{"title":603,"path":604,"stem":605,"order":606},"What changed","\u002Fwhats-changed","whats-changed",99,[608,610],{"title":535,"path":536,"stem":537,"description":609,"order":474,"children":-1},"Reusable skills that teach agents to hand off tasks, get a second opinion, and plan with several agents.",{"title":603,"path":604,"stem":605,"description":54,"order":606,"children":-1},1796318317986]