microsoft / microsoft/WinAppVSCE
cert generate: guard against older CLIs that lack --if-exists / --json
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13
- Forks
- 3
- Avg merge
- 6d 1h
- Merged PRs (30d)
- 11
Description
Raised by a PR review of the winapp.certGenerate modernization.
Problem
buildCertGenerateArgs (src/cert-utils.ts) now unconditionally emits two options:
args.push('--if-exists', options.ifExists ?? 'error');
args.push('--json');
Both require a reasonably recent CLI. There is no minimum-version guard and no capability probe, so against an older CLI the command fails at argument parsing with an opaque error rather than a message the user can act on.
This is reachable in practice because the CLI is not always the bundled one:
scripts/download-cli.ps1defaults tolatest, but release builds can pass an olderCliReleaseTag.getWinappCliPathcan fall back to awinappfound onPATH, which is entirely outside our control.
Note this is newly-introduced risk rather than a regression: the previous implementation passed no options at all, so it worked against any CLI.
Suggested fix
Pick whichever is cheapest to maintain:
- Document and enforce a minimum CLI version for the extension, checked once at activation.
- Probe capability (e.g. parse
cert generate --help) and degrade gracefully — fall back to the old no-options invocation when the flags are unavailable. - At minimum, detect the argument-parsing failure and translate it into "your
winappCLI is too old for this command; expected >= X.Y.Z, found ".
Option 3 alone would remove the opaque-failure problem for very little code.
Related
- #242 (custom passwords)
- #243 (
--output/--valid-days/--export-cer)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/cert-utils.ts at buildCertGenerateArgs, then trace how the CLI path is selected through getWinappCliPath and scripts/download-cli.ps1. Decide whether to enforce a minimum version, probe capabilities, or translate argument failures, and verify that an older external or downloaded winapp CLI produces an actionable result instead of an opaque parsing error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100