Skip to content

PowerShell cmdlet completion improvements#266

Merged
acarl005 merged 7 commits into
mainfrom
andy/expand-cmdlet-coverage
Apr 20, 2026
Merged

PowerShell cmdlet completion improvements#266
acarl005 merged 7 commits into
mainfrom
andy/expand-cmdlet-coverage

Conversation

@acarl005
Copy link
Copy Markdown
Contributor

@acarl005 acarl005 commented Apr 20, 2026

Description

This PR contains several improvements to the auto-generated completion specs for PowerShell cmdlets.

The files command-signatures/json/autogenerated/powershell/*.json are prodecedurally generated from Get-Help. You can run that with:

cargo run --bin autogenerate_powershell

Changes

  1. Simply running this script on Windows instead of MacOS includes a bunch of new (Windows-only) cmdlets. There are 408 new files in this PR.
  2. Improvements to generating suggestions for options' arguments. I added some fallback cases which finds other sources for allowed values. I also started sorting these alphabetically for more deterministic outputs so the ordering has changed for some existing ones.
  3. Clean up descriptions. Remove unnecessary newlines, trailing spaces, and markdown formatting which we don't actually render.
  4. Remove some deprecated flag names.

The changes that are auto-generated are in their own commit so you can review actual source changes by looking at individual commits

@acarl005 acarl005 requested a review from lucieleblanc April 20, 2026 18:25
let s = s.replace("\r\n", " ").replace('\n', " ").replace('\r', " ");
let s = s.replace("**", "");
s.split_whitespace().collect::<Vec<_>>().join(" ")
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some light post-processing to make these easier to read. Eventually we should use FormattedTextElement to actually render the markdown.

#[serde(alias = "Suggestions", default)]
pub suggestions: Vec<String>,
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed for additional fallbacks for getting suggestions for parameters.

) | Where-Object {{ $_ }} | Sort-Object -Unique
}} }}
) | ConvertTo-Json -Depth 8"#
));
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the actual new fallback logic.

Copy link
Copy Markdown
Contributor

@lucieleblanc lucieleblanc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the improvements!

I have some questions about removing the flag aliases.

I'm also slightly worried about how this amount of new specs will affect bundle size, but maybe I'm misunderstanding how this works

{
"name": [
"-AssemblyName",
"-AN"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm, the flag deletions are intentional?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eh it was but now I'm realizing it's not a good idea. That would break command x-ray when users use these aliases which I think is a regression. Pushed an update to restore the lost aliases.

@@ -2,10 +2,7 @@
"name": "Write-Verbose",
"options": [
{
"name": [
"-Message",
"-Msg"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto -- is removing these aliases intentional?

@acarl005
Copy link
Copy Markdown
Contributor Author

@lucieleblanc Regarding the bundle size. The uncompressed size of the new specs around ~3MB.

  • This does not affect WASM startup time (where bundle size matters a lot) b/c we don't use the embed-signatures feature for the WASM build.
  • The installed bundle size on my machine is >300MB so I think adding 3MB is acceptable.
  • For the installer download, that is compressed so the impact will be much less.

@acarl005 acarl005 merged commit f78c60a into main Apr 20, 2026
3 checks passed
@acarl005 acarl005 deleted the andy/expand-cmdlet-coverage branch April 20, 2026 20:17
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.

2 participants