feat(cli): group the certificate commands under a certs topic - #162
Conversation
The three certificate commands move into bin/lib/certs.sh as one topic: certs list, certs describe, certs generate and certs delete. The old names generate-mkcert, list-certs and remove-cert still run, warn on stderr with their replacement, and leave the help and the completion. certs list is a table: the directory once, then one row per certificate with the file holding it and the file holding its key, or "missing". It needs neither Docker nor the proxy. certs describe reads one certificate with openssl and reports what it covers, its validity, its issuer, and whether the running proxy serves it. Given a hostname with no certificate of its own it finds the one that covers it, or explains that a wildcard matches one label only and names the certificate to generate. It uses only x509 options present in both OpenSSL and LibreSSL, probes the read once, and stops with the reason when openssl is missing or the file cannot be read. The other certs commands do not depend on openssl. generate and delete keep their bodies. hosts_abbreviate becomes the shared abbreviate_home so both libraries print ~ paths the same way. Refs: #160 Assisted-by: claude-code/claude-fable-5-1
… with printf The record printer no longer probes openssl itself; the two entry points in certs_describe do, so a covered hostname is probed once rather than twice. The validity label is aligned with printf instead of a padded string. Refs: #160 Assisted-by: claude-code/claude-fable-5-1
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
… self-contained The integration suite sources bin/spark-http-proxy up to the first top-level `case "$1" in` and sources bin/lib/hosts.sh on its own. The prerequisite check becomes a function so it no longer introduces an earlier case, and hosts.sh keeps hosts_abbreviate; certs.sh carries its own copy. The two certificate tests that read function bodies and the capability probe now look in bin/lib/certs.sh, where they moved. Refs: #160 Assisted-by: claude-code/claude-fable-5-1
Refs: #160 Assisted-by: claude-code/claude-fable-5-1
… it as empty Refs: #160 Assisted-by: claude-code/claude-fable-5-1
… when it is named Refs: #160 Assisted-by: claude-code/claude-fable-5-1
User description
Refs #160 (the certs half;
hosts describestays open for a follow-up).What changes
The three certificate commands become one topic,
spark-http-proxy certs, inbin/lib/certs.sh:certs listprints a table: the directory once, then one row per certificate with the file holding it and the file holding its key, ormissing. Works with Docker stopped.certs describe <domain>reads one certificate with openssl and reports what it covers, its validity, its issuer, and whether the running proxy serves it. Given a hostname with no certificate of its own it finds the certificate that covers it, or explains that a wildcard matches one label only and names the certificate to generate.certs generateandcerts deletekeep the bodies ofgenerate-mkcertandremove-certunchanged.generate-mkcert,list-certs,remove-certstill run, warn on stderr with their replacement, and leave the help and the completion.Output on a real machine
openssl
describeis the only command that reads a certificate. It uses x509 options present in both OpenSSL 3 and Apple's LibreSSL (-text,-startdate,-enddate,-issuer,-checkend), probes the read once before printing, and stops with the reason when openssl is missing or the file cannot be read. Verified on p620 (OpenSSL 3.6.3) and on a Mac with both/opt/homebrew/bin/openssland/usr/bin/openssl(LibreSSL 3.3.6): identical records.Verification
shellcheck -x bin/spark-http-proxy bin/lib/*.sh: same four pre-existing findings asmain, nothing new.certs list,describe(named, covered, one-label miss, unknown, unreadable file, missing openssl),help, unknown subcommand, the three deprecated names,generatewithout a domain,deletewithout a domain, unknown domain, and no terminal: run by hand on p620 (31 certificates) and on the Mac (3).test/test.shmoves its certificate tests to the new names and adds assertions for the deprecated alias, the table, and the twodescriberefusals. The suite runs in CI.Out of scope
build/traefik/entrypoint.shfilters keys withgrep -v "\-key", a substring match on the path, so a certificate named likemy-keycloak.spark.loc.pemis never served whilecerts listshows it installed. Container side, separate issue.PR Type
Enhancement, Tests, Documentation
Description
Group certificate operations under
certssubcommandsDescribe coverage, validity, issuer, and serving status
Preserve deprecated commands with replacement warnings
Update completion, tests, and documentation
Diagram Walkthrough
File Walkthrough
2 files
Add unified certificate command topic and inspectionIntegrate certs routing, completion, and prerequisite handling1 files
Reuse shared home-directory path abbreviation helper1 files
Test certificate subcommands, compatibility, and failure handling3 files
Update certificate command safety classificationsRecord certificate topic and deprecated commandsDocument certificate listing, description, generation, and deletion