Skip to content

Per-repo env and mounts

Goal: make every worktree lazybox creates for a repository feel like a real checkout — with the environment variables, shared directories, and helper scripts your project needs.

Because each workspace lives in its own fresh git worktree, things that sit outside version control (a .env, a node_modules, a local credentials dir) are not there by default. Per-repo configuration fills that gap.

All of this lives under repos.<owner/name> in ~/.lazybox/config.yaml.

env is injected into every shell and agent PTY launched in that repo’s worktrees:

repos:
acme/widgets:
env:
DATABASE_URL: postgres://localhost/widgets_dev
RUST_LOG: widgets=debug

mounts symlinks an existing directory into each worktree so you don’t re-create or re-download it per workspace. Each mount has a source, a link_at path, and a placement:

repos:
acme/widgets:
mounts:
- source: /Users/me/widgets-shared/node_modules
link_at: node_modules
placement: inside # symlink lives inside the worktree
- source: /Users/me/widgets-secrets
link_at: .secrets
placement: above # symlink placed above the worktree
  • placement: inside — the symlink is created inside the worktree directory.
  • placement: above — the symlink is created in the worktree’s parent.

scripts writes executables into <worktree>/_lazybox/scripts/<name> so agents and shells can call them. Provide the body inline with content, or point at a file with source:

repos:
acme/widgets:
scripts:
- name: seed-db
content: |
#!/usr/bin/env bash
set -euo pipefail
psql "$DATABASE_URL" -f db/seed.sql
- name: lint
source: /Users/me/widgets-shared/lint.sh

Each script lands at <worktree>/_lazybox/scripts/seed-db (and lint), executable, in every worktree for that repo.

Open a new workspace for the repo and press s for a shell. Then check that the variables and files are present:

Terminal window
echo "$DATABASE_URL"
ls -l node_modules _lazybox/scripts
ls -l ../.secrets # placement: above → the link lives in the worktree's parent