Repository navigation
Conversation
Add snapshot tests that pass hostile completion values through every provider. Document the trust boundary, the per-shell encoding rules, and the test strategy in ShellEscapingDesign.md. The snapshots record the current, unsafe output, so each fix that follows shows its effect as a snapshot diff. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Quote each compgen word-list entry independently and collect results line by line so whitespace and shell metacharacters remain literal. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 444b4475-4f2c-4742-ba4b-0988ae880fcc
Emit completion text, labels, and tooltips as escaped single-quoted PowerShell strings and normalize tooltip line endings. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 444b4475-4f2c-4742-ba4b-0988ae880fcc
Normalize line breaks and tabs before emitting tab-separated Fish completion descriptions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 444b4475-4f2c-4742-ba4b-0988ae880fcc
Quote static values for the second evaluation that _arguments performs, escape single quotes in values, and escape backslashes and other _arguments metacharacters in help text. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Replace CR, LF, and tab characters with spaces before static candidates reach line-oriented shell protocols. This keeps one CompletionItem from becoming multiple Bash, Fish, or Zsh candidates and applies the same behavior consistently to PowerShell. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 444b4475-4f2c-4742-ba4b-0988ae880fcc
Escape wordToComplete before using PowerShell's -like operator so wildcard characters remain literal and unmatched brackets cannot throw during tab completion. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 444b4475-4f2c-4742-ba4b-0988ae880fcc
The [suggest] directive writes one completion per line. Line breaks and tabs inside a completion would split it into several records, so each CRLF, CR, LF, or tab is written as one space. The output is streamed without intermediate strings, and CompletionAction shares the last-token lookup with CompletionContext. Tests cover separators and empty output. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Normalize record separators in Zsh descriptions, omit option aliases that _arguments cannot represent, and keep dynamic completion values intact. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Read suggestion output line by line, match prefixes literally, and append candidates directly instead of reparsing dynamic data through compgen -W. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 444b4475-4f2c-4742-ba4b-0988ae880fcc
Add execution tests that load each generated script in its shell, request completions, and assert that hostile candidates stay literal and cause no side effects. Each shell has its own test class with a typed fixture that resolves the shell tool once, and attributes that declare platform and tool requirements. Document the coverage requirements. The tests found duplicate Bash candidates, so Bash now removes duplicates from COMPREPLY. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
PowerShell treats U+2018, U+2019, U+201A, and U+201B as single-quote delimiters. Completion text containing them, which is common in localized descriptions, could end the quoted string and run code while the completion script loads. Double every quote-like character, and cover it in snapshot and execution tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
BenchmarkDotNet benchmarks generate completion scripts for a medium-sized CLI with each shell provider. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Bash, Fish, Zsh, and PowerShell now write script text directly to the output instead of building intermediate strings, lists, and LINQ sequences. Fish computes each command's subcommands and options once. The shared helpers skip text that needs no changes. Allocations drop by 23% to 67% per provider on the medium-sized benchmark, and the benchmark README records the results. The only snapshot change is a blank line after the Bash shebang. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Raw string script templates take the line endings of the source checkout, so scripts generated from a Windows build contained CR characters that break Bash and Zsh. Providers now convert template CRLF sequences to LF, and a test checks every provider. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Each quoting context is now an IShellEscaper that lists its special characters and writes their escaped form. ShellText.WriteEscaped owns the scan, the record-separator normalization, and the output of unchanged text, so a new context cannot forget the separators. Joined-name writing and the LF conversion also move to ShellText, and the unused NormalizeCompletionText is removed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Each provider's embedded shell commands and templates now have XML documentation that explains what the generated code does and why it is safe, and the inline fragments are named constants or methods so they can carry that documentation. The generated scripts are unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Read completion records without word-list evaluation, pass Zsh records as values, and quote PowerShell insertion text as a literal. Add regression tests for shell metacharacters and document shim refresh steps. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add XML documentation that explains the shared shell text rules, benchmark setup, and shell test fixture requirements. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add ShellTemplateHandler so providers can write script templates as interpolated strings. String holes are encoded for the template's quoting context by default; author-controlled text must be marked with Trusted, and a second context with Encode. Escapers now own their quotes, which replaces the per-provider quoting helpers. Generated scripts are unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Encode each value separately and allow explicitly trusted per-list separators. Use list templates for Bash completion word lists. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This was referenced Dec 1, 2026
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
dotnet-suggestshims and document how to update installed scripts.Behavior changes
[suggest]writesInsertTextwhen available, otherwise the label; it replaces CRLF, CR, LF, and tabs in each candidate with spaces. An empty list produces no output.dotnet-suggestshim quotes inserted candidates.dotnet-suggestshims to receive those changes.Validation
dotnet-suggesttests where changed, and built the benchmarks.