Skip to content

fix(custom-tools): quote values for cmd.exe - #1108

Open
Elioooon wants to merge 1 commit into
Nano-Collective:mainfrom
Elioooon:fix/windows-custom-tool-quoting
Open

fix(custom-tools): quote values for cmd.exe#1108
Elioooon wants to merge 1 commit into
Nano-Collective:mainfrom
Elioooon:fix/windows-custom-tool-quoting

Conversation

@Elioooon

@Elioooon Elioooon commented Sep 1, 2026

Copy link
Copy Markdown

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

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Changeset

  • Added a changeset (pnpm changeset) describing this change for the changelog

Testing

Automated Tests

  • New features include passing tests in .spec.ts/tsx files
  • All existing tests pass (pnpm test:all completes successfully)
  • Tests cover both success and error scenarios

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.md
  • pnpm run test:types
  • pnpm run test:types:vscode
  • pnpm run test:changesets
  • pnpm run build
  • pnpm run test:ava source/cli-integration.spec.ts (10 tests)

pnpm test:all reached the AVA suite but did not complete cleanly in this checkout. Its 10 reported CLI integration failures were all dist/cli.js missing before a build; after pnpm run build, all 10 pass. AVA also left 127 unrelated tests pending after suite timeouts.

Manual Testing

  • Tested with Ollama
  • Tested with OpenRouter
  • Tested with OpenAI-compatible API
  • Tested MCP integration (if applicable)

The local host is macOS, so the generated cmd.exe command is covered by focused unit tests; actual cmd.exe /d /s /c execution is left to Windows CI.

Checklist

  • If this was for an open issue, I was assigned to it
  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed)
  • No breaking changes (or clearly documented)
  • Appropriate logging added using structured logging (see CONTRIBUTING.md)

No logging path changes.

@github-actions github-actions Bot added area:tools Tool implementations and tool-calling area:docs Documentation labels Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentation area:tools Tool implementations and tool-calling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Custom tool {{ }} quoting is POSIX-only; cmd.exe is not covered

1 participant