Skip to content

Enter worktree with spaces#115

Merged
jdtzmn merged 6 commits into
mainfrom
jacob-enter-worktree-with-spaces
Jun 2, 2026
Merged

Enter worktree with spaces#115
jdtzmn merged 6 commits into
mainfrom
jacob-enter-worktree-with-spaces

Conversation

@jdtzmn

@jdtzmn jdtzmn commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Support entering worktrees whose branch name contains spaces via port enter and the implicit port <branch> form, in all forms: port enter "my feature", port enter my feature, port "my feature", and port my feature.
  • Parse branch arguments as variadic positionals and join bare words into a single name (new exported joinBranchArgs helper in src/index.ts).
  • Resolve a valid git ref before worktree creation: names git rejects (spaces, etc.) fall back to the sanitized form (my feature → branch my-feature), while valid refs like feature/auth are preserved (new isValidBranchRef / resolveBranchRef in src/lib/git.ts, used by enter.ts). Worktree directory naming and PORT_WORKTREE identity stay sanitized and unchanged.
  • Make the test harness space-safe: execPortAsync now uses execFile (no shell) so spaced args and script paths survive (tests/utils.ts, src/lib/exec.ts).
  • Add a design doc under docs/superpowers/specs/.

Testing

  • joinBranchArgs unit tests (src/index.test.ts); isValidBranchRef / resolveBranchRef unit tests (src/lib/git.test.ts); command-level spaced-branch case (src/commands/enter.command.test.ts); smoke E2E covering explicit and implicit forms (tests/enter-spaces.test.ts).
  • Result: targeted test set passing (68 tests across touched files); typecheck clean; lint 0 errors (only pre-existing unrelated warnings); prettier clean.

Risks

  • Behavioral change: spaced/invalid branch names now resolve to a sanitized git ref instead of erroring; valid refs (e.g. with slashes) are unaffected.
  • None noted for rollout; change is scoped to the enter / implicit entry points and the test harness, with no change to worktree directory or domain/routing identity.

(Drafted by Jacob's coding agent on his behalf)

@jdtzmn jdtzmn enabled auto-merge (squash) June 2, 2026 05:11
@jdtzmn jdtzmn disabled auto-merge June 2, 2026 05:11
@jdtzmn jdtzmn merged commit beed453 into main Jun 2, 2026
6 checks passed
@jdtzmn jdtzmn deleted the jacob-enter-worktree-with-spaces branch June 2, 2026 05:33
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