Primary navigation

Local environments

Define everyday actions and setup scripts for worktrees

A local environment describes a project's worktree setup and its shortcut commands. It is a desktop-app feature, read from one file in the project, .zerotwo/environments/environment.toml, which you can commit so teammates get the same behavior. ZeroTwo has no settings screen for editing it, so you write the file yourself. The app notices edits to the file and refreshes without a restart. In a repository with several projects, the file belongs in the directory you open as the project.

version = 1
name = "web-app"

[setup]
script = "npm install"

[[actions]]
name = "Run"
icon = "run"
command = "npm start"

version and name are required, and so is the [setup] table, which may hold an empty script.

Setup scripts

A worktree is a fresh checkout, so it can lack dependencies and untracked files. The [setup] script runs in the new worktree whenever ZeroTwo creates a managed one for a task. A [cleanup] table works the same way and runs when that worktree is removed. Both run through a login shell (bash, or PowerShell on Windows), and the environment variables ZEROTWO_SOURCE_TREE_PATH and ZEROTWO_WORKTREE_PATH point at the original project and the new checkout. A failed setup keeps the checkout and shows the error so you can retry.

Per-platform overrides replace the default script: add [setup.darwin], [setup.linux] or [setup.win32] with their own script, and the same suffixes work for [cleanup].

Actions

Actions are named commands, such as starting a dev server or running tests. Each [[actions]] entry needs a name and a command, and may set an icon of tool (the default), run, debug or test, and a platform of darwin, linux or win32 to show it on one operating system only. Matching actions appear as buttons in the top bar of a desktop chat. Selecting one opens the integrated terminal and runs the command there, in the directory the task is working in. Use the terminal directly for one-off debugging.

Use built-in Git tools

The desktop app adds Git controls to Code tasks. The branch pill creates and checks out branches, a commit and push dialog offers Commit, Commit and push and Push with an Include unstaged changes option, and a pull request menu opens a PR in GitHub or adds it to the chat. The /diff command opens a Review tab listing every edit the agent made in the task, and Settings > Git holds branch prefix, pull request and commit instructions. Anything else goes through the terminal, and a worktree keeps concurrent changes away from your own checkout.