Skip to content

feat(cwd): add cwd:PATH op to set working dir for a whole call (#339)#342

Merged
fdaviddpt merged 2 commits into
masterfrom
feat/339-cwd-op
Jun 26, 2026
Merged

feat(cwd): add cwd:PATH op to set working dir for a whole call (#339)#342
fdaviddpt merged 2 commits into
masterfrom
feat/339-cwd-op

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

Summary

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.

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 leading cd trips the use-supertool hook and a stale cwd silently poisons relative path resolution (the #336 trap).

./supertool 'cwd:~/Documents/claude-supertool' 'git-status'
  • ~/$VAR expanded; non-directory or non-first errors before any op runs
  • Docs: op table (index + meta), builtin-ops entry, CHANGELOG
  • 5 tests; full suite green (3455 pass)

Closes #339

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>
@fdaviddpt fdaviddpt merged commit 876de54 into master Jun 26, 2026
12 checks passed
@fdaviddpt fdaviddpt deleted the feat/339-cwd-op branch June 26, 2026 11:04
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.

Add a per-call working dir (--cwd / honor workspace:) so cross-repo sessions don't need cd … && on every op

1 participant