Skip to content

Changelog

For the full, itemized change list see the CHANGELOG.md on GitHub.

The paved-road major: production batteries become the default, the error ladder is replaced by the Builder, and the naming debts are paid.

  • Module path: github.com/larsartmann/cmdguard/v4 becomes github.com/larsartmann/cmdguard/v5 (package pkg/cmdguard/v4 becomes pkg/cmdguard/v5). The codemod rewrites it mechanically.
  • Batteries are on by default. NewCLI enables strict command validation, signal handling with graceful DI shutdown, strict config keys, error hints, and the auto-registered doctor command. version appears when WithCLIVersion is set. Every flip has a Without* opt-out, and WithoutBatteries() drops the set.
  • Renames: CommandInfo becomes CommandMetadata, TypeHandler becomes TypeCodec (TypeHandlerFunc becomes TypeCodecFunc, RegisterTypeHandler becomes RegisterTypeCodec), and HuhRunner becomes HuhPrompter.
  • Removed: CLI.SetConfig. Pass the values to NewCLI or validate them with WithConfigValidation[T].
  • Graceful shutdown fires only when the run was signal-cancelled. A normally completing Execute no longer tears down the DI scope, which makes repeated ExecuteWithArgs safe. Explicit teardown is CLI.Shutdown(ctx).
  • Builder registration: NewBuilder, Add, AddParent, Try, Check, Build. Constructor errors are collected, and Build() attaches all commands or none.
  • Machine contract: a hidden describe command and CLI.Describe / WriteDescription, with a versioned schema_version.
  • Error vocabulary: ErrorCode(err) returns a stable snake_case code, and ErrorHint(err) returns one actionable fix. Human output prints a Hint: line; JSON envelopes carry hint and error_code. 62 sentinels are catalogued in docs/ERROR_REFERENCE.md.
  • Config introspection: config explain (WithConfigExplainCommand) reports where each value came from, with secret:"true" redaction.
  • NewApp: construction plus command registration that never returns a half-built CLI.
  • schema sub-module: JSON Schema 2020-12 for config structs, derived from v5.ConfigKeys.
  • lint sub-module: cmdguard-lint with rules CG001 to CG008 and a baseline ratchet.

Seven independently versioned modules: glamour, prompts, spinner, telemetry, flightrecorder, lint, and schema.

  • Module path: github.com/larsartmann/cmdguard/v3 becomes github.com/larsartmann/cmdguard/v4 (package pkg/cmdguard/v3 becomes pkg/cmdguard/v4).
  • Config loading: the configload sub-package is deleted. WithConfigFile(paths...) auto-detects JSON, YAML, and TOML through KoanfLoader, and NewJSONLoader is removed.
  • go-output upgraded from v0.31.1 to v0.35.0.
  • samber-do-auditlog upgraded from v0.7.0 to v0.8.1.
  • 500 test functions, 29 benchmarks, 8 fuzz targets, 87.8% coverage, 0 lint issues.

Five independently importable modules: glamour, prompts, spinner, telemetry, and flightrecorder.

The v2 line continues at v2.10.4; see the v2 to v3 migration guide.

See CHANGELOG.md for every release and the detailed change lists.