diff --git a/.roborev.toml b/.roborev.toml new file mode 100644 index 0000000..7f625af --- /dev/null +++ b/.roborev.toml @@ -0,0 +1,2 @@ +# roborev per-repo configuration +agent = "claude-code" diff --git a/CLAUDE.md b/CLAUDE.md index 54ef8e7..291b326 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -97,6 +97,52 @@ The Go CLI communicates the infrastructure path to Python Pulumi stacks via the - `just aws-unset`: Unset all AWS environment variables +## Git Worktrees + +**Always use git worktrees instead of plain branches.** This enables concurrent Claude sessions in the same repo. + +### Creating a Worktree + +This repo is expected to live at `ptd-workspace/ptd/`. The `../../.worktrees/` relative path resolves to `ptd-workspace/.worktrees/` in that layout. + +```bash +# New branch +git worktree add ../../.worktrees/ptd- -b + +# Existing remote branch +git worktree add ../../.worktrees/ptd- +``` + +Always prefix worktree directories with `ptd-` to avoid collisions with other repos. + +### After Creating a Worktree + +1. **Build the binary** — each worktree needs its own ptd binary: + ```bash + cd ../../.worktrees/ptd- + just build-cmd + ``` +2. **direnv** — if direnv is available, copy `envrc.recommended` to `.envrc` in the worktree, then run `direnv allow`. The file uses `source_up` to inherit workspace vars and overrides `PTD` to point to the worktree. +3. **For agents without direnv** — set env vars explicitly before running `ptd` commands: + ```bash + export PTD="$(pwd)" + export PATH="${PTD}/.local/bin:${PATH}" + ``` + +### Cleaning Up + +```bash +# From the main checkout +git worktree remove ../../.worktrees/ptd- +``` + +### Rules + +- **NEVER** use `git checkout -b` for new work — always `git worktree add` +- **NEVER** put worktrees inside the repo directory — always use `../../.worktrees/ptd-` +- **ALWAYS** rebuild the binary after creating a worktree (`just build-cmd`) +- Branch names: kebab-case, no slashes, no usernames (slashes break worktree directory paths) + ## Contributing When contributing to the project: diff --git a/envrc.recommended b/envrc.recommended new file mode 100644 index 0000000..53f98aa --- /dev/null +++ b/envrc.recommended @@ -0,0 +1,14 @@ +# Inherit workspace-level environment (PTD_CONFIG, PTD_TARGETS_CONFIG_DIR, etc.) +source_up + +# Override PTD to point to THIS directory (works for both main checkout and worktrees) +export PTD="${PWD}" +export PROJECT_ROOT="${PTD}" +export TOP="${PTD}" +export PTD_TOP="${PTD}" + +# Add this checkout's .local/bin to PATH (so worktrees use their own built binary) +PATH_add ".local/bin" + +# Python/uv configuration for Pulumi operations +export UV_PROJECT="${PTD}/python-pulumi"