feat(cwd): add cwd:PATH op to set working dir for a whole call (#339)#342
Merged
Conversation
cwd:PATH as the first op chdir's once before dispatch, then is stripped, so every following op resolves against PATH. Removes the `cd <repo> &&` prefix cross-repo sessions needed on every call — a leading `cd` trips the use-supertool hook and a stale cwd silently poisons relative path resolution (the #336 trap). Handled in the pre-pass like --plain, so it never races the parallel read path or forces a batch sequential. Op not flag (keeps the single grammar); required-first so a mid-call cwd can't half-apply against the old dir. ~/$VAR expanded; non-directory or non-first errors before any op runs. Docs: op table (index/meta), builtin-ops entry, CHANGELOG. 5 tests. Co-Authored-By: Max <noreply>
Review follow-up: empty `cwd:` now errors "empty path" instead of the confusing "not a directory: " (blank). Multiple cwd ops error "only one cwd: op is allowed" instead of the misdirecting "must be the first op". Adds 3 tests: $VAR expansion, empty-path, double-cwd (8 total). Co-Authored-By: Max <noreply>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cwd:PATHas the first op chdir's once before dispatch, then is stripped, so every following op resolves againstPATH. Removes thecd <repo> &&prefix cross-repo sessions needed on every call.Why an op, not a
--flag: keeps supertool's single grammar. Handled in the pre-pass (like--plain), so it never races the parallel read path or forces a batch sequential. Required-first so a mid-call cwd can't half-apply against the old dir. A leadingcdtrips the use-supertool hook and a stale cwd silently poisons relative path resolution (the #336 trap).~/$VARexpanded; non-directory or non-first errors before any op runsCloses #339