Skip to content

Resolve relative paths after cd in compound commands#53

Merged
ldayton merged 1 commit intomainfrom
cd-path-resolution
Jan 17, 2026
Merged

Resolve relative paths after cd in compound commands#53
ldayton merged 1 commit intomainfrom
cd-path-resolution

Conversation

@ldayton
Copy link
Copy Markdown
Owner

@ldayton ldayton commented Jan 17, 2026

When a compound command starts with cd <literal>, subsequent commands now resolve relative paths against the cd target directory rather than the original cwd.

Example:

# Config
allow ~/projects/myapp/bin/tool *

# Command
cd ~/projects/myapp && ./bin/tool --verbose

Previously ./bin/tool resolved against the original cwd and didn't match. Now it resolves against ~/projects/myapp and matches the rule.

Only handles literal paths (absolute, ~, relative). Dynamic targets (variables, command substitutions) fall back to original cwd.

Closes #52

When a compound command starts with `cd <literal>`, subsequent
commands now resolve relative paths against the cd target directory
rather than the original cwd. This allows config rules to match
as users expect.

Only handles literal paths (absolute, ~, relative). Dynamic targets
(variables, command substitutions) are ignored and fall back to
original cwd.

Closes #52
@ldayton ldayton merged commit 693ff26 into main Jan 17, 2026
1 check passed
orgoj pushed a commit to orgoj/Dippy that referenced this pull request Jan 17, 2026
When `cd <literal> && ./foo` runs, resolve `./foo` against the cd target
instead of the original cwd. This lets config rules match as users expect.

Closes ldayton#52
@ldayton ldayton deleted the cd-path-resolution branch January 17, 2026 18:25
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.

Opportunity: resolve relative paths after cd in compound commands

1 participant