Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .roborev.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# roborev per-repo configuration
agent = "claude-code"
46 changes: 46 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-<branch-name> -b <branch-name>

# Existing remote branch
git worktree add ../../.worktrees/ptd-<branch-name> <branch-name>
```

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-<branch-name>
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-<branch-name>
```

### Rules

- **NEVER** use `git checkout -b` for new work — always `git worktree add`
- **NEVER** put worktrees inside the repo directory — always use `../../.worktrees/ptd-<name>`
- **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:
Expand Down
14 changes: 14 additions & 0 deletions envrc.recommended
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting an envrc in the repo kind of takes up a typically developer-controlled local file. What about putting it in a .envrc.recommended or similar and then documenting via the README?

Original file line number Diff line number Diff line change
@@ -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"
Loading