Skip to content

feat: add branch-based plugin install for worktree workflows#395

Merged
tmchow merged 6 commits into
mainfrom
feat/install-from-branch
Mar 26, 2026
Merged

feat: add branch-based plugin install for worktree workflows#395
tmchow merged 6 commits into
mainfrom
feat/install-from-branch

Conversation

@tmchow
Copy link
Copy Markdown
Collaborator

@tmchow tmchow commented Mar 26, 2026

Adds the ability to install or test Compound Engineering plugin from a specific git branch — solving a pain point for worktree-based development where the main checkout can't serve as a reliable plugin source.

Why this exists: When you develop with worktrees, ./plugins/compound-engineering always points to whatever branch your main checkout is on — not the branch you actually want to test.

  • Cross-repo: You're working in a different project and want to use a CE branch as your plugin. Without this, you'd have to switch the CE repo's checkout — which is likely WIP on something else.
  • Same-repo: You're working on CE itself — feat/feature-2 in your main checkout, feat/feature-1 in a worktree. You want to test feature-1's plugin while continuing to develop feature-2. The main checkout can't serve both purposes.

Two complementary features:

  • plugin-path command (for Claude Code) — clones a branch to a deterministic cache path (~/.cache/compound-engineering/branches/<plugin>-<branch>/) and outputs it for claude --plugin-dir. Re-running fetches the latest. Progress goes to stderr, path to stdout, so it composes cleanly in shell aliases.

  • --branch flag on install (for Codex, OpenCode, and all other targets) — passes the branch through to git clone. Skips bundled plugin lookup when specified since the user explicitly wants a remote version.

Shell alias example with argument forwarding:

claude-ce-branch() {
  claude --plugin-dir "$(bunx @every-env/compound-plugin plugin-path compound-engineering --branch "$1")" "${@:2}"
}

Also restructures README to lead with Philosophy and Workflow before installation mechanics.

Test plan

  • 5 new tests in tests/plugin-path.test.ts (clone, sanitization, update-on-rerun, error cases)
  • 1 new test in tests/cli.test.ts for install --branch
  • All 393 tests pass

Compound Engineering v2.54.0

tmchow added 4 commits March 26, 2026 10:07
Adds a `plugin-path` subcommand that clones a specific branch to a
stable, deterministic path under ~/.cache/compound-engineering/branches/.
Designed for use with `claude --plugin-dir` to test plugin branches
without mutating the local working tree.
…ranches

New `plugin-path` command clones a branch to a deterministic cache path
(~/.cache/compound-engineering/branches/) for use with `claude --plugin-dir`.
Adds `--branch` flag to `install` for non-Claude targets (Codex, OpenCode, etc.).

Designed for worktree-based workflows where the main checkout can't serve
as a reliable plugin source.
Restructured README: Philosophy and Workflow first, then Install, Branch
Install, Local Dev, and Sync. Added shell alias examples with argument
forwarding. Documented the worktree motivation for branch-based installs.
CI runners may default to master instead of main. Explicitly set the
default branch name to avoid pathspec errors on checkout.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 328cfa4953

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/commands/plugin-path.ts Outdated
Comment thread src/commands/plugin-path.ts
Comment thread tests/plugin-path.test.ts
Use ~ as the slash separator in cache paths instead of naive character
stripping. This is injective because ~ is illegal in git branch names
(git-check-ref-format reserves it for reflog notation).

Also fixes alias mismatch (cce -> claude-dev-ce), clarifies that
--branch requires pushed branches, adds collision resistance test,
and updates solution doc with cross-repo/same-repo scenarios.
@tmchow
Copy link
Copy Markdown
Collaborator Author

tmchow commented Mar 26, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3180cbbfb4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/commands/plugin-path.ts Outdated
Replace the lossy catch-all strip with percent-encoding so every
distinct branch name maps to a unique cache directory. Slash still
uses ~ (illegal in git refs), all other unsafe chars get %XX encoding.
@tmchow tmchow merged commit e09a742 into main Mar 26, 2026
2 checks passed
This was referenced Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant