fix(custom-tools): quote values for cmd.exe - #1108
Open
Elioooon wants to merge 1 commit into
Open
Conversation
Elioooon
requested review from
Avtrkrb,
akramcodez and
will-lamerton
as code owners
September 1, 2026 03:23
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.
Description
Custom tool templates rendered every
{{ value }}with POSIX single quotes before selecting the execution shell. That is correct for bash/sh, but cmd.exe treats the quotes as literal characters and still interprets command metacharacters and%VAR%expansion.This selects the shell first, keeps the existing POSIX quoter unchanged, and injects a cmd.exe quoter into the existing render path. The cmd quoter wraps each scalar or array item in double quotes, caret-escapes cmd metacharacters, and doubles percent signs. Documentation now describes the selected-shell behavior.
Closes #1084.
Type of Change
Changeset
pnpm changeset) describing this change for the changelogTesting
Automated Tests
.spec.ts/tsxfilespnpm test:allcompletes successfully)Passed locally:
pnpm run test:ava source/custom-tools/template.spec.ts source/custom-tools/handler.spec.ts(41 tests)pnpm exec biome check source/custom-tools/template.ts source/custom-tools/template.spec.ts source/custom-tools/handler.ts docs/features/custom-tools.md .changeset/custom-tool-cmd-quoting.mdpnpm run test:typespnpm run test:types:vscodepnpm run test:changesetspnpm run buildpnpm run test:ava source/cli-integration.spec.ts(10 tests)pnpm test:allreached the AVA suite but did not complete cleanly in this checkout. Its 10 reported CLI integration failures were alldist/cli.jsmissing before a build; afterpnpm run build, all 10 pass. AVA also left 127 unrelated tests pending after suite timeouts.Manual Testing
The local host is macOS, so the generated cmd.exe command is covered by focused unit tests; actual
cmd.exe /d /s /cexecution is left to Windows CI.Checklist
No logging path changes.