Repository navigation
Add CLI shell completion generation and installer integration - #20026
Damian Edwards (DamianEdwards) merged 12 commits into
Conversation
Co-authored-by: Copilot App <[email protected]> Copilot-Session: d900e7a0-ba55-42da-bce0-23220d3dc2c3
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 20026Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 20026" |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
Bash candidates are incorrectly pre-escaped, CI routing misses a consumed template, and executable-level coverage is absent.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds live shell completion generation and integrates it with supported installation routes.
Changes:
- Adds Bash, Fish, Zsh, and PowerShell completion scripts.
- Adds safe, idempotent installer registration and opt-out handling.
- Adds documentation, localization, and focused completion tests.
File summaries
| File | Description |
|---|---|
tests/Aspire.Cli.Tests/Utils/CliTestHelper.cs |
Registers the completion command in tests. |
tests/Aspire.Cli.Tests/Snapshots/CompletionsCommandTests.Script_WritesOnlyGeneratedScript_shell=zsh.verified.txt |
Verifies Zsh output. |
tests/Aspire.Cli.Tests/Snapshots/CompletionsCommandTests.Script_WritesOnlyGeneratedScript_shell=pwsh.verified.txt |
Verifies PowerShell output. |
tests/Aspire.Cli.Tests/Snapshots/CompletionsCommandTests.Script_WritesOnlyGeneratedScript_shell=fish.verified.txt |
Verifies Fish output. |
tests/Aspire.Cli.Tests/Snapshots/CompletionsCommandTests.Script_WritesOnlyGeneratedScript_shell=bash.verified.txt |
Verifies Bash output. |
tests/Aspire.Cli.Tests/Commands/CompletionScriptTests.cs |
Exercises generated shell hooks. |
tests/Aspire.Cli.Tests/Commands/CompletionsCommandTests.cs |
Tests command generation and suggestions. |
tests/Aspire.Acquisition.Tests/Scripts/ReleaseScriptShellTests.cs |
Tests shell installer opt-out. |
tests/Aspire.Acquisition.Tests/Scripts/ReleaseScriptPowerShellTests.cs |
Tests PowerShell installer opt-out. |
tests/Aspire.Acquisition.Tests/Scripts/PRScriptShellTests.cs |
Tests dogfood shell opt-out. |
tests/Aspire.Acquisition.Tests/Scripts/PRScriptPowerShellTests.cs |
Tests dogfood PowerShell opt-out. |
tests/Aspire.Acquisition.Tests/Scripts/CompletionScriptTests.cs |
Covers installer completion safety. |
tests/Aspire.Acquisition.Tests/Scripts/Common/ScriptToolCommand.cs |
Isolates Zsh test profiles. |
tests/Aspire.Acquisition.Tests/Scripts/Common/ScriptFunctionCommand.cs |
Isolates profiles and elevation. |
src/Aspire.Cli/Resources/xlf/RootCommandStrings.zh-Hant.xlf |
Adds Traditional Chinese resources. |
src/Aspire.Cli/Resources/xlf/RootCommandStrings.zh-Hans.xlf |
Adds Simplified Chinese resources. |
src/Aspire.Cli/Resources/xlf/RootCommandStrings.tr.xlf |
Adds Turkish resources. |
src/Aspire.Cli/Resources/xlf/RootCommandStrings.ru.xlf |
Adds Russian resources. |
src/Aspire.Cli/Resources/xlf/RootCommandStrings.pt-BR.xlf |
Adds Portuguese resources. |
src/Aspire.Cli/Resources/xlf/RootCommandStrings.pl.xlf |
Adds Polish resources. |
src/Aspire.Cli/Resources/xlf/RootCommandStrings.ko.xlf |
Adds Korean resources. |
src/Aspire.Cli/Resources/xlf/RootCommandStrings.ja.xlf |
Adds Japanese resources. |
src/Aspire.Cli/Resources/xlf/RootCommandStrings.it.xlf |
Adds Italian resources. |
src/Aspire.Cli/Resources/xlf/RootCommandStrings.fr.xlf |
Adds French resources. |
src/Aspire.Cli/Resources/xlf/RootCommandStrings.es.xlf |
Adds Spanish resources. |
src/Aspire.Cli/Resources/xlf/RootCommandStrings.de.xlf |
Adds German resources. |
src/Aspire.Cli/Resources/xlf/RootCommandStrings.cs.xlf |
Adds Czech resources. |
src/Aspire.Cli/Resources/RootCommandStrings.resx |
Defines completion messages. |
src/Aspire.Cli/Resources/RootCommandStrings.Designer.cs |
Exposes generated resource properties. |
src/Aspire.Cli/README.md |
Documents setup and removal. |
src/Aspire.Cli/Program.cs |
Adds side-effect-free completion startup. |
src/Aspire.Cli/Diagnostics/FileLoggerProvider.cs |
Supports disabled file logging. |
src/Aspire.Cli/Completions/CompletionScripts.cs |
Generates shell hooks. |
src/Aspire.Cli/Completions/CompletionInvocation.cs |
Detects and serves suggestions. |
src/Aspire.Cli/Commands/RootCommand.cs |
Registers completion commands. |
src/Aspire.Cli/Commands/CompletionsCommand.cs |
Implements script generation command. |
src/Aspire.Cli/Caching/DiskCache.cs |
Defers cache-directory creation. |
eng/winget/microsoft.aspire/Aspire.locale.en-US.yaml.template |
Adds manual completion notes. |
eng/scripts/pack-cli-npm-package.pointer.README.md |
Documents npm completion setup. |
eng/scripts/get-aspire-cli.sh |
Installs Unix completions. |
eng/scripts/get-aspire-cli.ps1 |
Installs PowerShell completions. |
eng/scripts/get-aspire-cli-pr.sh |
Generates dogfood Unix artifacts. |
eng/scripts/get-aspire-cli-pr.ps1 |
Generates dogfood PowerShell artifacts. |
eng/homebrew/validate-cask-artifact.sh |
Validates completion lifecycle. |
eng/homebrew/README.md |
Documents Homebrew integration. |
eng/homebrew/aspire.rb.template |
Adds native cask generation. |
Review details
Files not reviewed (1)
- src/Aspire.Cli/Resources/RootCommandStrings.Designer.cs: Generated file
- Files reviewed: 45/46 changed files
- Comments generated: 3
- Review effort level: Balanced
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Copilot App <[email protected]> Copilot-Session: d900e7a0-ba55-42da-bce0-23220d3dc2c3
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
Bash discards valid cursor-aware suggestions when the cursor is inside the current token.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Files not reviewed (1)
- src/Aspire.Cli/Resources/RootCommandStrings.Designer.cs: Generated file
- Files reviewed: 48/49 changed files
- Comments generated: 1
- Review effort level: Balanced
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Copilot App <[email protected]> Copilot-Session: d900e7a0-ba55-42da-bce0-23220d3dc2c3
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🔵 Needs a closer look
Bash completion currently fails when completing an argument that already begins with a quote.
Review details
Files not reviewed (1)
- src/Aspire.Cli/Resources/RootCommandStrings.Designer.cs: Generated file
Suppressed comments (1)
src/Aspire.Cli/Completions/CompletionScripts.cs:49
- Quoted partial arguments are not completable because
%qalways formats a standalone, unquoted shell word. For example, interactive Bash leavesaspire "na<Tab>unchanged and Enter drops to the continuation prompt instead of insertingname with space. Use context-aware Readline quoting (for example, raw candidates with thefilenamescompletion option) and cover Tab insertion when the current token already starts with single or double quotes.
printf -v suggestion '%q' "$suggestion"
COMPREPLY+=("$suggestion")
- Files reviewed: 48/49 changed files
- Comments generated: 0 new
- Review effort level: Balanced
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Copilot App <[email protected]> Copilot-Session: d900e7a0-ba55-42da-bce0-23220d3dc2c3
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot App <[email protected]> Copilot-Session: d900e7a0-ba55-42da-bce0-23220d3dc2c3
There was a problem hiding this comment.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Note
This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.
Resolve the test-trigger-map conflict by retaining both npm packaging and CreateFailingTestIssue routing cases. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 626588e5-9040-435f-928e-4b94b5a0d7cd
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Bash ANSI-C quoted arguments are misdecoded before completion requests, producing incorrect suggestions.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
Files not reviewed (1)
- src/Aspire.Cli/Resources/RootCommandStrings.Designer.cs: Generated file
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Mitch Denny (mitchdenny)
left a comment
There was a problem hiding this comment.
Looks good to me. I have manually tested the completions on macOS. Before merging, I expect manual testing on Windows and Linux as well, covering completion setup and behavior in the supported shells on those platforms.
Co-authored-by: Copilot App <[email protected]> Copilot-Session: d900e7a0-ba55-42da-bce0-23220d3dc2c3
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Three moderate completion correctness and validation issues remain unresolved.
Review effort: Balanced
Findings: 1
Files not reviewed (1)
- src/Aspire.Cli/Resources/RootCommandStrings.Designer.cs: Generated file
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Copilot App <[email protected]> Copilot-Session: d900e7a0-ba55-42da-bce0-23220d3dc2c3
Tests selector4 / 99 PR test projects · 6 PR jobs, from 49 changed files. Selected PR test projects (4 / 99)
Selected PR jobs (6)
How these were chosen — grouped by what changed📄 📄 📄 📄 📦 affected project 📄 📄 📄 📄 🔧 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 Job reasons
Selection computed for commit |
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Two moderate completion and installer regressions remain unresolved.
Review effort: Balanced
Findings: None
Resolved since last review (1)
Files not reviewed (1)
- src/Aspire.Cli/Resources/RootCommandStrings.Designer.cs: Generated file
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
6615623
into
main



Description
Make the Aspire CLI easier to discover and use through shell tab completion, and configure completion during installation where the installer has a suitable user-shell integration mechanism.
Adds
aspire completions script [bash|fish|pwsh|zsh]. Generated hooks query the live command model for commands, subcommands, options, and completion-enabled values without requiringdotnet-suggest. Requests avoid normal command execution, hosted services, telemetry, package prefetching, config migration, first-use notices, and log/cache creation. Loaded settings are normalized in memory, preserving the original file bytes and existing collision precedence.--skip-completions/-SkipCompletions.aspire.ps1launcher.aspireand local-tool/npxinvocations.Fixes #20000
User-facing usage
Enable completion in the current PowerShell session:
Command-specific help from
aspire completions script --help(excerpt):Security considerations
This change generates executable shell code and adds user-profile registration. The installer assumes the user authorizes installation into the chosen CLI directory; nonpersistent artifacts are confined to that boundary rather than the home directory. Automatic profile edits remain home-confined and are not performed from elevated sessions. Signed profiles, PowerShell signing policy, path/redirection checks, and safe replacement of generated files are preserved. No execution policies or machine-wide profiles are changed.
Typed shell words are decoded without
evalor substitution execution. Generated hooks preserve candidate values as literal arguments, including spaces, quotes, backslashes,$()and backticks. Callbacks resolve the activeaspirecommand on PATH rather than pinning a versioned package-manager cache. Loading a generated script trusts that selected CLI installation.A focused automated security assessment of the installer boundaries and generated Bash/Zsh escaping reported no vulnerabilities. This is not a completed formal product threat model or security sign-off.
Validation
Current review-fix validation:
Checklist
<remarks />and<code />elements on your triple slash comments?