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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ dist-server
test-repo
.superpowers
wip-check.yml
test-repo.worktrees
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ End-to-end verification (build, launch, drive with Playwright, API curl probes):
- `~/.config/megit/config.json` is real user state. To drive the app without touching it (screenshots, probes), launch the server with an isolated `HOME`.
- Design docs live in `docs/superpowers/specs/` — the *why* behind a feature, kept so decisions don't get re-litigated. Implementation plans are scratch: write them wherever, delete them once the feature ships.
- Playwright MCP drops `.playwright-mcp/` artifacts into the CWD — keep them out of commits.
- `scripts/make-test-repo.sh` regenerates `test-repo/`: interleaved branches, merges, two stashes, dirty worktree. It is also the source of the README screenshots.
- `scripts/make-test-repo.sh` regenerates `test-repo/`: interleaved branches, merges, two stashes, dirty worktree. It is also the source of the README screenshots. `--worktrees` adds two linked worktrees (`test-repo.worktrees/`) for the worktree panel.

## Releasing

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pnpm build # catches anything the dev server tolerates

CI runs all of this on Linux, macOS and Windows, plus `pnpm build:server` and a smoke test of the CLI entrypoint.

`scripts/make-test-repo.sh` regenerates `test-repo/` — a throwaway fixture with interleaved branches, merges, two stashes and a dirty worktree. It is git-ignored, safe to delete, and is what the README screenshots are taken from. Note that vitest is configured to exclude it: the fixture contains a plausible-looking `test/renderer.test.ts` that would otherwise be collected into the real suite.
`scripts/make-test-repo.sh` regenerates `test-repo/` — a throwaway fixture with interleaved branches, merges, two stashes and a dirty worktree. It is git-ignored, safe to delete, and is what the README screenshots are taken from. `--worktrees` also creates two linked worktrees in `test-repo.worktrees/`, for the worktree panel screenshot. Note that vitest is configured to exclude it: the fixture contains a plausible-looking `test/renderer.test.ts` that would otherwise be collected into the real suite.

## Things worth knowing

Expand Down
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,19 @@ Stashes appear as their own rows, attached to the commit they were taken from wi

### Worktrees

A repository with linked worktrees gets a panel beside the graph listing each one with its branch and changed-file count. Click a row to open it in its own purple `⎇` tab; counts update live, and a branch checked out elsewhere is marked on its chip and offers to open that tab instead of failing the checkout. Drag the panel's edge to resize it, collapse it to a rail that keeps the worktree count, and the trash icon on a row deletes that worktree (its branch stays).
A worktree is a second checkout of the same repository in its own folder, on its own branch — how coding agents (Claude Code, T3 Code, Codex) work in parallel without touching your checkout. megit doesn't create them; it shows the ones your tools made.

![the worktree panel listing three worktrees with their changed-file counts, beside the graph](docs/worktrees.png)

A repository with linked worktrees gets a panel beside the graph listing each one with its branch and a live count of changed files. Click a row to open that worktree in its own purple `⎇` tab. A branch checked out in another worktree carries a `⎇` on its chip, and checking it out offers to open that tab instead of failing. Drag the panel's edge to resize it, collapse it to a rail that keeps the count, and use the trash icon on a row to delete that worktree (its branch stays).

To try it on any repository:

```bash
git worktree add ../myapp-login -b fix/login # new folder, new branch
echo "// wip" >> ../myapp-login/src/app.ts # the panel's count goes to 1
git worktree remove --force ../myapp-login # or the trash icon in megit
```

### Diffs

Expand Down Expand Up @@ -169,7 +181,7 @@ Ports come from `PORT` (API, default 3411) and `UI_PORT` (Vite dev server, defau

In development the server runs its TypeScript directly via Node's native type-stripping — no build step. That does not work for a published package, because Node refuses to strip types under `node_modules`, so `pnpm build:server` compiles `server/` to `dist-server/` at publish time.

`scripts/make-test-repo.sh` generates `test-repo/` — a throwaway fixture with interleaved branches, merges, stashes and a dirty worktree, used for manual testing and for the screenshots above.
`scripts/make-test-repo.sh` generates `test-repo/` — a throwaway fixture with interleaved branches, merges, stashes and a dirty worktree, used for manual testing and for the screenshots above. `--worktrees` adds two linked worktrees with uncommitted work in `test-repo.worktrees/`.

[`docs/architecture.md`](docs/architecture.md) explains how the two halves fit together and why the graph layout lives in a pure module. [CONTRIBUTING.md](CONTRIBUTING.md) has the setup and the house rules; [SECURITY.md](SECURITY.md) has the threat model.

Expand Down
Binary file added docs/worktrees.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 22 additions & 2 deletions scripts/make-test-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
# --date-order, so parallel branches only weave into visible lanes when their
# timestamps overlap. Safe to delete and re-run.
set -euo pipefail
# --worktrees also adds two linked worktrees in test-repo.worktrees/, as an agent
# tool would — for the README's worktree panel screenshot. Off by default: with
# them, every other screenshot would grow the panel too.

cd "$(dirname "$0")/.."
rm -rf test-repo
rm -rf test-repo test-repo.worktrees
mkdir test-repo
cd test-repo

Expand Down Expand Up @@ -242,4 +245,21 @@ cat > assets/star.svg <<'EOF'
EOF
# unstaged

echo "test-repo ready: $(git log --oneline --all | wc -l | tr -d ' ') commits, $(git branch | wc -l | tr -d ' ') branches, $(git stash list | wc -l | tr -d ' ') stashes, dirty worktree"
# ── linked worktrees (opt-in): two agents mid-task, both with uncommitted work ─
if [[ "${1:-}" == "--worktrees" ]]; then
wt=../test-repo.worktrees
git worktree add -q "$wt/particles" feature/particles
printf '%s\n' "export const maxParticles = 2048" >> "$wt/particles/src/config.ts"
printf '%s\n' "// TODO: pool emitters" > "$wt/particles/src/emitter.ts"

git worktree add -q -b agent/fps-overlay "$wt/fps-overlay" main
(
cd "$wt/fps-overlay"
w src/overlay.ts "export const showFps = true"
commit "add fps overlay toggle" 09 10:00 "Claude" "agent@example.com"
printf '%s\n' "export const overlayCorner = 'top-right'" >> src/overlay.ts
printf '%s\n' "fps overlay: needs a design pass" > TODO.md
)
fi

echo "test-repo ready: $(git log --oneline --all | wc -l | tr -d ' ') commits, $(git branch | wc -l | tr -d ' ') branches, $(git stash list | wc -l | tr -d ' ') stashes, $(git worktree list | wc -l | tr -d ' ') worktrees, dirty"
Loading