You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: auto-generate flag tables and replace --format with global --json (#80)
* refactor: auto-generate flag tables and replace --format with global --json
Add gendocs tool that generates README flag tables from Cobra command
definitions via `go generate`, with CI check and pre-commit hook to
keep them in sync. Extract ValidationError to dedicated errors.go.
Replace per-command `--format text|json` flag on inspect, verify,
connect, scan, ocsp, and crl with a global `--json` persistent flag.
Rename `convert --to` to `convert --format` for consistency with
`bundle --format` (both specify container format).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add global --json flag and restore per-command --format
Keep per-command --format on display commands (inspect, verify, connect,
scan, ocsp, crl) while adding a global --json persistent flag that works
on ALL commands. --json overrides --format when both are set.
Add JSON output to keygen, csr, sign (self-signed and csr), bundle, and
convert commands. Revert convert --format back to --to. Fix CHANGELOG
refs and add missing PR references.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address review findings for --json output consistency
- Fix connect JSON sha256_fingerprint to use colon-hex format matching
inspect and sha1_fingerprint (CLI-4 consistency)
- Fix bundle --json to base64 encode binary p12/jks output instead of
casting raw bytes to string (produces valid JSON)
- Fix sign --json + -o to write file AND output JSON (matching
bundle/convert behavior; previously --json silently skipped file write)
- Simplify redundant conditionals in keygen/csr JSON output (omitempty
handles empty strings)
- Move --json changelog entries from Changed to Added section (CL-2)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address gendocs review findings (CS-5, OBS-1)
- Add spliceMarkerInput struct for 3-parameter spliceMarker (CS-5)
- Replace fmt.Fprintf(os.Stderr) with slog calls for diagnostics (OBS-1)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: standardize --json output behavior across all commands
- Standardize --json override to use local variable copy instead of
mutating package-level format variables (all 6 display commands)
- Decouple keygen/csr stderr file messages from --json (always print
when -o is set, regardless of --json)
- Add file path fields to keygenJSON and csrJSON for script discovery
- Fix bundle --json -o with PEM format to emit file metadata instead
of full PEM data (matches convert pattern)
- Add doc comment on connectCertJSON struct
- Add breaking change note for connect sha256_fingerprint format change
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: remove backtick type placeholders, rename csr --cert to --from-cert
pflag's UnquoteUsage consumes backtick-quoted text as type placeholders,
corrupting --help output for --format, --trust-store, --log-level,
--algorithm, and --curve flags. Remove all backticks from usage strings.
Rename csr --cert to --from-cert for clarity — avoids confusion with
certificate file arguments used by other commands.
Also fix convert --json without -o missing the format field in output.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* build: update all Go dependencies
- github.com/spf13/pflag v1.0.9 → v1.0.10
- golang.org/x/exp → 2025-02-18
- modernc.org/libc v1.67.6 → v1.68.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use actual file path in gendocs error messages
spliceMarker error messages hardcoded "README.md" instead of using the
path argument. Include the path field in spliceMarkerInput so errors
reference the correct file when gendocs is run with a custom path.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+33-24Lines changed: 33 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
10
10
### Added
11
11
12
+
- Auto-generate CLI flag tables in README from Cobra command definitions via `go generate` ([#80])
13
+
- Add `gendocs` pre-commit hook and CI check to verify flag tables stay in sync ([#80])
14
+
- Add global `--json` persistent flag — all commands now support JSON output; overrides `--format` when both are set ([#80])
15
+
- Add JSON output to `keygen`, `csr`, `sign`, `bundle`, and `convert` commands ([#80])
12
16
-`connect` automatically checks OCSP revocation status on the leaf certificate (best-effort; shows "skipped" or "unavailable" when check cannot complete) ([#78])
13
17
- Add `--crl` flag to `connect` for opt-in CRL revocation checking via distribution points ([#78])
14
18
- Add `FetchCRL` library function for downloading CRLs from HTTP URLs with SSRF validation ([#78])
@@ -30,25 +34,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
30
34
- Add `ErrUnknownOtherNameType` sentinel error for invalid OtherName type strings ([#74])
31
35
- Add `ErrEmptySANExtension` sentinel error for empty SAN extension input ([#74])
32
36
- Add `aia_fetched` field to inspect results and "via aia" badge in web UI for AIA-fetched certificates ([#73])
33
-
- Add multi-entry JKS support to `convert --key` — when multiple keys match different certificates, JKS output creates a multi-alias keystore with one `PrivateKeyEntry` per match
34
-
- Add `EncodeJKSEntries` library function for creating multi-entry JKS keystores with alias sanitization and deduplication
35
-
- Add `CollectCertificateSANs` library function for canonical SAN aggregation (DNS, IP, email, URI, OtherName) across all commands
36
-
- Add `ParsePEMPrivateKeys` library function for extracting all private keys from a multi-key PEM bundle, skipping non-key blocks
37
-
- Add chain diagnostics to `connect` command — detect root certificates in chain (RFC 8446 §4.4.2) and duplicate certificates
38
-
- Add AIA walking to `connect` command — automatically fetch missing intermediates when server sends leaf-only chain, with `missing-intermediate` diagnostic warning
39
-
- Add mTLS detection to `connect` command — shows whether the server requests a client certificate, acceptable CAs, and accepted signature algorithms
40
-
- Add ALPN (negotiated application protocol) to `connect` command output
41
-
- Add `--verbose` / `-v` global flag for extended certificate details in `connect`, `verify`, `scan`, and `ocsp` output (serial, key info, signature algorithm, key usage, EKU, fingerprints, SKI/AKI)
42
-
- Add CRL number and authority key identifier to `crl` output
43
-
- Add `convert` command for converting between PEM, DER, PKCS#12, JKS, and PKCS#7 formats
44
-
- Add `sign` command with `self-signed` and `csr` subcommands for certificate signing
45
-
- Add `connect` command for TLS connection testing with certificate chain display
46
-
- Add `--diagnose` flag to `verify` command for chain failure diagnostics
47
-
- Add `ocsp` command for checking certificate revocation status via OCSP
48
-
- Add `crl` command for parsing and inspecting Certificate Revocation Lists
37
+
- Add multi-entry JKS support to `convert --key` — when multiple keys match different certificates, JKS output creates a multi-alias keystore with one `PrivateKeyEntry` per match ([#75])
38
+
- Add `EncodeJKSEntries` library function for creating multi-entry JKS keystores with alias sanitization and deduplication ([#75])
39
+
- Add `CollectCertificateSANs` library function for canonical SAN aggregation (DNS, IP, email, URI, OtherName) across all commands ([#75])
40
+
- Add `ParsePEMPrivateKeys` library function for extracting all private keys from a multi-key PEM bundle, skipping non-key blocks ([#75])
41
+
- Add chain diagnostics to `connect` command — detect root certificates in chain (RFC 8446 §4.4.2) and duplicate certificates ([#75])
42
+
- Add AIA walking to `connect` command — automatically fetch missing intermediates when server sends leaf-only chain, with `missing-intermediate` diagnostic warning ([#75])
43
+
- Add mTLS detection to `connect` command — shows whether the server requests a client certificate, acceptable CAs, and accepted signature algorithms ([#75])
- Add `--verbose` / `-v` global flag for extended certificate details in `connect`, `verify`, `scan`, and `ocsp` output (serial, key info, signature algorithm, key usage, EKU, fingerprints, SKI/AKI) ([#75])
46
+
- Add CRL number and authority key identifier to `crl` output ([#75])
47
+
- Add `convert` command for converting between PEM, DER, PKCS#12, JKS, and PKCS#7 formats ([#75])
48
+
- Add `sign` command with `self-signed` and `csr` subcommands for certificate signing ([#75])
49
+
- Add `connect` command for TLS connection testing with certificate chain display ([#75])
50
+
- Add `--diagnose` flag to `verify` command for chain failure diagnostics ([#75])
51
+
- Add `ocsp` command for checking certificate revocation status via OCSP ([#75])
52
+
- Add `crl` command for parsing and inspecting Certificate Revocation Lists ([#75])
49
53
50
54
### Changed
51
55
56
+
-**Breaking:** Rename `csr --cert` flag to `--from-cert` for clarity — avoids confusion with certificate file arguments in other commands ([#80])
57
+
-**Breaking:**`connect` JSON `sha256_fingerprint` format changed from lowercase hex to colon-separated uppercase hex for CLI-4 consistency with `inspect` and `sha1_fingerprint` ([#80])
52
58
-**Breaking:** Rename `CRLCheckResult.DistributionPoint` to `CRLCheckResult.URL` (JSON: `url`) and `OCSPResult.ResponderURL` to `OCSPResult.URL` (JSON: `url`) — consistent field name for the checked endpoint across both revocation types (CLI-4) ([#78])
53
59
-**Breaking:** Rename OCSP JSON field `serial_number` to `serial` for CLI-4 consistency with all other commands ([#78])
54
60
-**Breaking:**`FetchCRL` now takes `FetchCRLInput` struct instead of a URL string — enables `AllowPrivateNetworks` for user-provided URLs ([#78])
@@ -63,6 +69,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
63
69
64
70
### Fixed
65
71
72
+
- Fix backtick-quoted values in flag usage strings being consumed by pflag as type placeholders — all `--format`, `--trust-store`, `--log-level`, `--algorithm`, and `--curve` flags now display correctly in `--help` output ([#80])
73
+
- Fix `convert --json` without `-o` missing `format` field in JSON output ([#80])
66
74
- Fix data race in `TestCheckLeafCRL` — CRL bytes are now generated before starting the test HTTP server (CC-3) ([#78])
67
75
- Fix `CheckLeafCRL` panic on nil `Leaf` or `Issuer` — now returns "unavailable" result instead of panicking ([#78])
68
76
- Fix `verify` help text claiming "Exits with code 2 if revoked" — actually exits 2 for any verification error including revocation ([#78])
@@ -96,8 +104,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
96
104
-**Breaking:** Rename `CRLContainsCert` to `CRLContainsCertificate` — exported function names must not abbreviate per CS-2 ([#75])
97
105
- Fix `verify --diagnose` running chain diagnostics on non-chain errors (key mismatch, expiry warnings) — now gates on `chain_valid == false` only ([#75])
98
106
- Fix silent `continue` in `connect` mTLS CA DN parsing when `asn1.Unmarshal` fails — now logs with `slog.Debug` (ERR-5) ([#75])
99
-
- Fix `convert --key` only using first key from multi-key PEM file and including all certs in output — now matches the key to its leaf certificate and extracts only the chain for that leaf
100
-
- Fix AIA proxy rejecting `cacerts.geotrust.com` and `cacerts.thawte.com` — consolidate all per-host CA entries into suffix matches for broader coverage of CA subdomains
107
+
- Fix `convert --key` only using first key from multi-key PEM file and including all certs in output — now matches the key to its leaf certificate and extracts only the chain for that leaf ([#75])
108
+
- Fix AIA proxy rejecting `cacerts.geotrust.com` and `cacerts.thawte.com` — consolidate all per-host CA entries into suffix matches for broader coverage of CA subdomains ([#75])
101
109
- Fix `marshalOtherNameGN` encoding non-SRV OtherName values as PrintableString instead of UTF8String ([#74])
102
110
- Fix `MarshalSANExtension` accepting nil URI entries and invalid IP addresses without validation ([#74])
Copy file name to clipboardExpand all lines: CLAUDE.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -218,11 +218,11 @@ Invoke `/ralph` for comprehensive test validation. Full protocol in `.claude/ski
218
218
219
219
-**CLI-1 (MUST)** Stdout is for data, stderr is for everything else. PEM output, JSON, scan summaries — anything a user might pipe goes to stdout. File paths, progress messages, warnings go to stderr. Follow the OpenSSL convention.
220
220
-**CLI-2 (MUST)** Never write files without explicit consent. Commands that produce PEM output print to stdout by default. Files are only written when the user provides `-o`. Export requires `--bundle-path <dir>`. No silent writes to the current directory.
221
-
-**CLI-3 (MUST)** Every command that displays certificate/key info must support `--format json`.
221
+
-**CLI-3 (MUST)** Every command supports `--json` (global persistent flag). Display commands (`inspect`, `verify`, `connect`, `scan`, `ocsp`, `crl`) also support `--format json`. `--json` overrides `--format` when both are set.
222
222
-**CLI-4 (MUST)** JSON field names must be consistent across commands. Same concept uses the same key everywhere (e.g., SKI is always `subject_key_id`).
223
223
-**CLI-5 (MUST)** All dates in RFC 3339 format. No RFC 1123, no custom layouts.
-**G-5 (MUST)**`GOOS=js GOARCH=wasm go vet ./cmd/wasm/` and `go build` pass.
353
354
-**G-6 (MUST)**`cd web && npm test` passes (vitest).
354
355
-**G-7 (MUST)**`cd web && wrangler pages functions build` compiles (local only, no credentials).
356
+
-**G-8 (MUST)**`go generate ./...` followed by `git diff --exit-code README.md` — flag tables in README must match Cobra command definitions. Run `go generate` after changing any CLI flags.
Use `--format json` on any command for machine-readable output. Data always goes to stdout, warnings and progress to stderr, so piping works cleanly:
581
+
Use `--json` on any command for machine-readable output. Display commands also accept `--format json`. Data always goes to stdout, warnings and progress to stderr, so piping works cleanly:
582
582
583
583
```sh
584
584
# Check cert in CI -- fails with exit code 2 if expiring within 30 days
0 commit comments