Add cert info command, --export-cer flag, and --json output for cert commands#305
Open
Add cert info command, --export-cer flag, and --json output for cert commands#305
Conversation
Build Metrics ReportBinary Sizes
Test Results✅ 272 passed out of 272 tests in 53.9s (+24 tests, -15.6s vs. baseline) CLI Startup Time34ms median (x64, |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the cert command group with new functionality for programmatic certificate management. It introduces a cert info subcommand for inspecting certificate details, adds a --export-cer flag for exporting public keys separately, and implements --json output mode for machine-readable responses across cert commands. Additionally, it fixes a bug where --output only accepted file names, not absolute paths.
Changes:
- New
cert infocommand displays certificate metadata (subject, issuer, thumbprint, validity, private key status) --export-cerflag oncert generateexports a.cerfile (public key only) alongside the.pfx--jsonoutput mode forcert generateandcert infowith consistent error handling via JSON- Bug fix:
--outputoption now accepts absolute and relative paths (changedAcceptLegalFileNamesOnly()toAcceptLegalFilePathsOnly())
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/winapp-CLI/WinApp.Cli/Services/StatusService.cs | Adds ExecuteQuietlyAsync method to suppress console output for JSON mode execution |
| src/winapp-CLI/WinApp.Cli/Services/IStatusService.cs | Interface definition for ExecuteQuietlyAsync |
| src/winapp-CLI/WinApp.Cli/Services/CertificateService.cs | Implements .cer export logic and adds exportCer parameter to certificate generation methods |
| src/winapp-CLI/WinApp.Cli/Services/ICertificateService.cs | Adds exportCer parameter to interface methods |
| src/winapp-CLI/WinApp.Cli/Program.cs | Suppresses logging in JSON mode by setting LogLevel.None and skips first-run notice |
| src/winapp-CLI/WinApp.Cli/Models/JsonOutputModels.cs | New file defining JSON output models with source-generated serialization |
| src/winapp-CLI/WinApp.Cli/Commands/WinAppRootCommand.cs | Defines global --json option for commands to opt into |
| src/winapp-CLI/WinApp.Cli/Commands/CertCommand.cs | Registers new CertInfoCommand as subcommand |
| src/winapp-CLI/WinApp.Cli/Commands/CertInfoCommand.cs | New command implementation for displaying certificate details |
| src/winapp-CLI/WinApp.Cli/Commands/CertGenerateCommand.cs | Adds --export-cer and --json support, fixes path validation bug |
| src/winapp-CLI/WinApp.Cli/Helpers/HostBuilderExtensions.cs | Registers CertInfoCommand handler in DI container |
| src/winapp-CLI/WinApp.Cli.Tests/CertInfoCommandTests.cs | Comprehensive tests for new cert info command covering parsing, output, and error cases |
| src/winapp-CLI/WinApp.Cli.Tests/CertGenerateCommandTests.cs | New tests for path validation, --export-cer, and --json functionality |
| src/winapp-CLI/WinApp.Cli.Tests/SignCommandTests.cs | Updates parameter name for clarity after signature change |
| docs/llm-context.md | Documents new command and options |
| docs/cli-schema.json | Updates CLI schema with new command and options |
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.
Improves the
certcommand group with a new subcommand, a public key export flag, and structured JSON output for programmatic consumption.Changes
New:
cert infocommandDisplays certificate details from a PFX file — subject, issuer, thumbprint, serial number, validity dates, and private key status. Useful for verifying a certificate matches your manifest before signing.
New:
--export-cerflag oncert generateExports a
.cerfile (public key only) alongside the.pfx. Useful for distributing the public certificate separately for trust installation.New:
--jsonoutput on cert commandsBoth
cert generateandcert infosupport--jsonfor machine-readable output. When--jsonis specified:{"error": "..."}) instead of writing to stderr--jsonreject it with a parse errorBug fix:
--outputnow accepts absolute pathsChanged
AcceptLegalFileNamesOnly()toAcceptLegalFilePathsOnly()socert generate --output C:\certs\dev.pfxworks correctly.Type of Change
Checklist