Releases: JiangHe12/cfgov-cli
Releases · JiangHe12/cfgov-cli
v0.2.0
Added
- Kubernetes rules-over-backend support: K8s now implements
cfgov.RuleStoreby storing Sentinel rule JSON arrays in ConfigMap data keys atconfigmap/{app}-{type}-rules/rules.json(ConfigMap/file-datasource convention, not a CRD datasource). - Kubernetes config backend:
k8sadapter for ConfigMap/Secret data keys (configmap|secret/<name>/<dataKey>) with kubeconfig context wiring, fail-closed coordinate validation, Secret-safe trace redaction, resourceVersion CAS, and honestSupportsHistory=false/SupportsWatch=falsecapability reporting. - etcd rules-over-backend support: etcd now implements
cfgov.RuleStore, deriving Sentinel rule coordinates as{app}-{type}-rulesunder a separateetcdRuleNamespace/ETCD_RULE_NAMESPACEoverride with defaultSENTINEL. - etcd config backend:
cfgov.Backendadapter with safe single-segment namespace/key mapping, CAS revisions, real watch support, TLS/mTLS connection options, context wiring, and honestSupportsHistory=falsecapability reporting. - Rule deep-validation parity with sentinel-cli: ported the 5 cross-rule deep checks (
MULTIPLE_SYSTEM_RULES,FLOW_REFRESOURCE_MISSING— ERROR;PARAM_WITHOUT_FLOW,AUTHORITY_MIXED_STRATEGY,FLOW_DEGRADE_GRADE_MISMATCH— WARNING) alongside the existing duplicate-key and dangerous-threshold checks. Newrule validate --dir <dir>aggregates every<type>.jsonand runs the full cross-rule check set in one pass (--fileXOR--dir). Single-filerule validate --file --deepnow runs only intra-type checks (IntraTypeDeepCheck), so it no longer false-positives on cross-type rules; ERROR checks still blockrule create/update/import/rollback. config push --create-only/--update-only(mutually exclusive): fail-if-exists (RESOURCE_ALREADY_EXISTS) / fail-if-not-found (RESOURCE_NOT_FOUND) semantics layered on the existing upsert as a post-authorization pre-write check; defaultpushstays upsert, and CAS / backup / dry-run / audit / risk classification are unchanged.- Local RBAC role management:
ctx role set/unset/listwrite per-operatorreader/writer/adminroles into the context (reader→R0,writer→R2,admin→R3 ceiling, enforced throughopskit-core/safety); independent of the--roles-source/--roles-urlremote role path. - Convenience polish:
rule list --typefilter;rule diff --dirdirectory batch diff;config listentransient-error backoff (2s→60s, abort after 20 consecutive failures; auth failures still return immediately);doctorauthandwrite-probechecks (write-probe only confirms the governance write path / effective-risk is computable — never mutates a backend);capabilities.supported.outputFormats; bare parent commands now list their subcommands and mistyped subcommands keep closest-match suggestions.
Fixed
- Embedded AI Skill (
skills/cfgov-cli/SKILL.md): added the required YAML frontmatter (name/description/allowed-tools) — it was missing since v0.1.0, so agent skill loaders (e.g. cc-switch) rejected it with "missing YAML frontmatter delimited by ---" — and refreshed the documented backends to Nacos, Apollo, etcd, and Kubernetes.
v0.1.0
Added
- P0 governance kernel: unified
cfgov.Backendabstraction (Coordinate{namespace,key}→ blob + revision/CAS) with a Nacos backend; Nacosgroup/dataIddetails are confined to the backend adapter. - Commands:
ctx set/use/list/current,config get/push/delete,capabilities,audit query/verify,version. cfgclassfail-closed config-write risk classifier (R0–R3) wired toopskit-coresafety: protected-context escalation viaEffectiveRisk, ticket gating at R2, and a precise--allow-production-config-deleteallow flag at R3.- Backend-bound contexts (
ctx set --backend nacos) with--backendper-command override; credentials stored viaopskit-corecredstore. - Audit trail records only content fingerprints (sha256) and byte counts — never plaintext config.
- Single-config read verbs:
config list/diff/validate/pull/history/listen(diffreports only sha256 + line deltas;listenis a bounded, cancellable long-poll). - Local backup primitive with backup-before-write enforcement on
config push/delete:--backup/--no-backup+safety.ValidateBackupPolicy; protected contexts require an explicit backup decision; the destructive write aborts if the backup fails; backups store under~/.cfgov-cli/backupsand audit records only the backup id + sha256. cfgov.Backendextended withHistoryandWatch(capability-gated viasupportsHistory/supportsWatch); config keys reject./..path-traversal segments and backup paths encode them.- Config write-class verbs:
config export/import/promote/rollback/reconcile; batch plans expose create/update/delete/prune counts and key lists, rollback supports local backup files/ids or Nacos history, and reconcile prune requires the precise--allow-production-pruneR3 allow flag. - Nacos namespace and service parity verbs via separate capability interfaces:
namespace list/create/update/deleteandservice list/get/instances/register/deregister; destructive verbs require precise--allow-production-namespace-delete/--allow-production-service-deregisterflags at R3. - Sentinel rule schema-over-backend read kernel:
rule list/get/export/diff/validatereads rule sets as config blobs via derived Nacos coordinates, validates flow/degrade/system/authority/param schemas, and reports only sha256/count metadata in audit. - Governed Sentinel rule writes:
rule create/update/import/delete/rollbackpersist rule arrays through the config backend with CAS, mandatory deep validation, backup-before-overwrite/delete, and the single R3--allow-production-rule-deleteflag for protected deletes. - Apollo config backend adapter: cfgov can now bind contexts to Apollo OpenAPI for config get/list/push/delete with item-level coordinate mapping, CAS revisions, release publishing, and honest NotImplemented gates for unsupported history/watch/rule/service capabilities.
- Apollo RuleStore support: Sentinel rule commands now work against Apollo with sentinel-compatible item keys (
{app}-{type}-rules) and a separate default rule namespace ofSENTINEL. cfgov install <agent> --skills: installs the embedded cfgov AI Skill into an agent's skills directory (claude/codex/opencode/copilot/cursor/cc-switch/windsurf/aider or a custom path), writes an.installed-bymanifest, and verifies the copy.- npm distribution:
package.json(unscopedcfgov-cli),bin/cfgov-cli.jslauncher, andscripts/install.jspostinstall that downloads the platform binary from the signed GitHub Release with SHA-256 verification and a redirect-host allowlist;release.ymltag pipeline (multi-platform build, cosign signing, checksums, GitHub Release, npm publish via OIDC). - Backend-agnostic config key validation:
cfgov.Backend.ValidateKey(Nacosgroup/dataIdrules vs Apollo item-key rules); backup identity is backend-adapted;ParseNacosKeyrejects any./..path segment (split on/and\). - Config flag parity with nacos-cli:
diff/validate/push --content(mutually exclusive with--file),push --no-validate(skips only content-format validation, never governance),validate/push --type xml,list --query/-q;import --skip-existing/--overwrite/--validate/--force-large-import,reconcile --prune-scope/--overwrite/--force-large-reconcile,rollback --validate,promote --validate/--overwrite/--type;diff --source-context/--target-contextcross-context comparison with LCS line-level output.--force-large-*lifts only the change-count ceiling, never the cfgclass/authorize/backup gates;--prunenow requires an explicit--prune-scope. - Context parity:
ctx setexposes the remaining governance fields (--env,--ticket-pattern,--roles-source/--roles-url/--allow-insecure-roles-url, Vault--vault-addr/--vault-path/--vault-role-id/--vault-secret-id/--vault-namespace, per-context OTel--otel-endpoint/--otel-metrics-endpoint/--otel-insecure); newctx delete(aliasremove/rm),ctx export,ctx import,ctx test;ctx/contextalias;ctx list/current --show-secrets. Security:--vault-secret-idis set only in the processVAULT_SECRET_ID(never persisted); credentials require a non-plain-yamlbackend;ctx exportredacts credentials by default and refuses cleartext export of credstore-backed secrets;ctx importneeds--forceto overwrite and--yeswhen non-interactive;roles-urlmust be https unless--allow-insecure-roles-url;--show-secretsis audited as a credential reveal. - Platform parity: global
--context(temporary context override, preserving the target context's protected/governance),--debug/--trace/--trace-body-limit(wired to the existing redacting backend trace),--strict-no-change(exit 13 when a plan has no changes),--audit-max-size(active-log rotation size),--backup-keep(backup retention).audit prune(rotated-log retention;--before/--keep-last, dry-run by default,--confirmto delete, and the prune itself is audited);audit queryfilters (--context-filter/--namespace-filter/--protected/--ticket/--env/--data-id/--app/--group/--rule-type/--path/--resource) andaudit query/verifytable/plain output;audit verify --path/--strict/--confirm/--decrypt.capabilitiesnow self-reports the bound backend's real capabilities plus limits/features; Apollo no longer lists a phantomruleverb and Nacos advertises theruleresource type. - Operational parity:
service register/deregisternow enforce the same backup-policy decision as config writes (protected contexts require explicit--backup/--no-backup), andregisterwarns on stderr when registering an ephemeral instance. Idempotent no-op writes are detected after authorization and recorded asskippedaudit events (fingerprint-only):config pushandrule create/update/importskip the backend write when the remote content already matches, andconfig import/promote/reconcileaudit already-matching items as skipped. Newbackup list/backup cleanlocal-store maintenance (cleanmirrorsaudit prune:--before/--keep-last, dry-run by default,--confirmto delete, and the clean itself is audited).namespace deleteadds a human y/N confirmation after authorization (skipped by--yes/--non-interactive; never replaces the R2/R3 authorization gate). - Ops/UX parity: read-only
doctordiagnostics (context/backend-ping/audit-log-writability; all output redacted, self-audited, no backend mutation); OpenTelemetry command spans plus trace/metrics exporter shutdown-flush (span/metric attributes carry only safe metadata — operator, context, env, ticket, protected — never config/rule content or credentials);completion {bash|zsh|fish|powershell}; "did you mean" suggestions on mistyped commands; command aliases (list→ls,delete→del/rm) and short flags (config -f/-g/-q,service -s);rule validate --fail-on-warnings(non-zero exit when deep validation reports warnings);rule get --resource(display-only exact-match filter on the ruleresourcefield — audit still records the full rule set).capabilitiesno longer advertisesbackup cleanas an R-tier verb (it is a--confirm/dry-run local-maintenance op likeaudit prune);DoctorResultadded to the kind list.