Skip to content

feat(config): add parent and name path-traversal template filters#2592

Merged
max-sixty merged 1 commit intomainfrom
parent
May 4, 2026
Merged

feat(config): add parent and name path-traversal template filters#2592
max-sixty merged 1 commit intomainfrom
parent

Conversation

@max-sixty
Copy link
Copy Markdown
Owner

Two new filters expose Path::parent and Path::file_name to templates, enabling path traversal that previous filters couldn't express. They unblock the bare-repo-in-hidden-directory layout (myproject/.git), where {{ repo }} resolves to .git: users who want a richer worktree-path naming scheme can now write {{ repo_path | parent | name }} to recover myproject.

The interactive bare-repo prompt still suggests the simpler {{ repo_path }}/../{{ branch | sanitize }} template, since the bare layout already nests worktrees inside a repo-specific wrapper directory — no prefix needed for disambiguation. The filters are there for users with different layout preferences (#1281 discussion).

Thanks to @seakayone for reporting #1279 and @Xilis for raising the parent_dir question that prompted this approach.

This was written by Claude Code on behalf of @max-sixty

Two new filters expose `Path::parent` and `Path::file_name` to templates,
enabling path traversal that previous filters couldn't express. They unblock
the bare-repo-in-hidden-directory layout (`myproject/.git`), where `{{ repo }}`
resolves to `.git`: users who want a richer worktree-path naming scheme can now
write `{{ repo_path | parent | name }}` to recover `myproject`.

Co-Authored-By: Claude <noreply@anthropic.com>
@max-sixty max-sixty merged commit 670cb2a into main May 4, 2026
28 checks passed
@max-sixty max-sixty deleted the parent branch May 4, 2026 18:55
max-sixty added a commit that referenced this pull request May 4, 2026
…2605)

\`name\` was too generic — likely to collide with future filters
operating on domain objects (a Branch, a worktree, a remote). Switch to
the POSIX/jinja-convention pair so both filters travel together: ansible
ships \`dirname\`/\`basename\`, shell users already know them, and
\`dirname\` is no more ambiguous than \`parent\` was.

Follow-up to #2592, which landed ~30 minutes ago — no users to break
yet.

> _This was written by Claude Code on behalf of @max-sixty_

Co-authored-by: Claude <noreply@anthropic.com>
@max-sixty max-sixty mentioned this pull request May 5, 2026
3 tasks
max-sixty added a commit that referenced this pull request May 5, 2026
## Summary
Release v0.48.0. See
[CHANGELOG.md](https://github.com/max-sixty/worktrunk/blob/release/CHANGELOG.md)
for the full notes.

Highlights:
- `--format=json` extends to seven step + hook commands (#2560)
- `wt step commit` / `wt step squash` gain `--dry-run` (#2557)
- New `dirname` / `basename` template filters (#2592, #2605)
- New `[remove] delete-branch` config option (#2589)
- `wt-perf timeline` subcommand (#2558)
- Faster `wt list` on dirty worktrees (#2602) and faster alias dispatch
(#2556, #2573)
- Short-SHA display honors `core.abbrev` (#2576)
- Cleaner `wt config show` shell-integration section for new users

## Test plan
- [x] `cargo run -- hook pre-merge --yes` (3497 tests, lints clean)
- [x] `cargo semver-checks check-release -p worktrunk` consulted; minor
bump confirmed
- [ ] CI green
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.

2 participants