Skip to content

feat: default to nested layout, add .gitignore at install time#2

Merged
dango85 merged 6 commits intomainfrom
feat/default-nested-layout
Apr 14, 2026
Merged

feat: default to nested layout, add .gitignore at install time#2
dango85 merged 6 commits intomainfrom
feat/default-nested-layout

Conversation

@dango85
Copy link
Copy Markdown
Owner

@dango85 dango85 commented Apr 14, 2026

Summary

Three changes for v1.2.0:

1. Default layout changed from sibling to nested

Worktrees now default to .worktrees/<branch>/ inside the repo instead of sibling directories. This is self-contained, gitignored, and matches the convention used by the community worktree extension.

Existing users who prefer sibling layout add one line to config:

layout: "sibling"

2. .gitignore updated at install time

New post_install lifecycle script adds .worktrees/ to .gitignore immediately when the extension is installed — not just at first worktree creation. This prevents worktree directories from ever being accidentally committed to the main repo.

The create script retains its .gitignore check as a safety net.

3. Test suites

  • test-create-worktree.sh — 12 tests (22 assertions): dry-run, nested/sibling layouts, --in-place, --path, env override, real worktree creation + branch verification, duplicate path blocking, config file override, slash sanitization
  • test-post-install.sh — 5 tests (6 assertions): gitignore creation, idempotency, custom dotworktrees_dir, absent .gitignore, preserving existing content

All 28 assertions pass.

4. Documentation: "How worktrees stay isolated"

New README section explains the full isolation model:

  • .gitignore timing (install + create)
  • Commit isolation (each worktree's git add/commit only affects its branch)
  • Cleanup behavior (removes directories, never deletes branches)

Files changed

  • extension.yml — default layout nested, version 1.2.0, lifecycle.post_install
  • worktree-config.yml — ships with layout: "nested"
  • scripts/bash/create-worktree.sh — fallback default changed to nested
  • scripts/bash/post-install.sh — new: adds .worktrees/ to .gitignore on install
  • commands/speckit.worktrees.create.md — config table updated
  • README.md — nested first, isolation section added
  • CHANGELOG.md — 1.2.0 entry
  • tests/test-create-worktree.sh — new: 22 assertions
  • tests/test-post-install.sh — new: 6 assertions
  • .extensionignore — excludes tests/ from installs

Abishek Yadav added 6 commits April 13, 2026 17:42
Declares modifies_hooks in extension.yml so that installing this extension
automatically disables the git extension's before_specify -> speckit.git.feature
hook (with explicit user consent). This keeps the primary checkout on a stable
branch while worktrees handle feature branch isolation.

Requires: github/spec-kit#2209 (modifies_hooks support)
Made-with: Cursor
Worktrees now default to .worktrees/<branch>/ inside the repo
(gitignored, self-contained) instead of sibling directories.

Sibling layout remains available via layout: "sibling" in config.

BREAKING: Existing users relying on the sibling default will need
to add layout: "sibling" to their worktree-config.yml to preserve
the old behavior.

Made-with: Cursor
- post-install.sh adds .worktrees/ to .gitignore immediately on
  extension install, not just at first worktree creation
- README "How worktrees stay isolated" section explains gitignore
  timing, commit isolation, and cleanup behavior

Made-with: Cursor
- test-create-worktree.sh: 12 tests (22 assertions) covering dry-run,
  nested/sibling layouts, --in-place, --path, env override, real
  worktree creation, duplicate blocking, config override, slash sanitization
- test-post-install.sh: 5 tests (6 assertions) covering gitignore
  creation, idempotency, custom dotworktrees_dir, absent .gitignore,
  preserving existing content
- Add tests/ to .extensionignore (excluded from installs)

Made-with: Cursor
- Runs test-create-worktree.sh and test-post-install.sh on push
  to main and on pull requests
- Matrix: ubuntu-latest + macos-latest
- Add test status badge to README

Made-with: Cursor
@dango85 dango85 merged commit a88ea53 into main Apr 14, 2026
2 checks passed
dango85 added a commit that referenced this pull request Apr 15, 2026
feat: default to nested layout, add .gitignore at install time
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