Skip to content

refactor(cli): standardize command implementation and reduce boilerplate#80

Merged
allisson merged 1 commit intomainfrom
improve-cmd
Mar 2, 2026
Merged

refactor(cli): standardize command implementation and reduce boilerplate#80
allisson merged 1 commit intomainfrom
improve-cmd

Conversation

@allisson
Copy link
Owner

@allisson allisson commented Mar 2, 2026

Centralize DI container lifecycle management and unify command output logic to improve maintainability and consistency across the CLI.

  • Implement ExecuteWithContainer to manage configuration loading, container initialization, and graceful shutdown centrally.
  • Introduce Formatter interface and WriteOutput helper to standardize JSON and Text output, removing repetitive conditional blocks.
  • Move interactive CLI prompts and policy validation to a new internal/ui package.
  • Consolidate shared parsing logic for algorithms and format types into helpers.go.
  • Standardize I/O handling across all commands using the IOTuple abstraction.
  • Add SERVER_SHUTDOWN_TIMEOUT configuration to decouple server exit from DB settings.
  • Implement strict validation for ACTIVE_MASTER_KEY_ID during rotation.
  • Add comprehensive docstrings and unit tests for CLI definitions and helpers.
  • Resolve gosec linting issues and fix build failures in command tests.

Centralize DI container lifecycle management and unify command output logic
to improve maintainability and consistency across the CLI.

- Implement `ExecuteWithContainer` to manage configuration loading, container
  initialization, and graceful shutdown centrally.
- Introduce `Formatter` interface and `WriteOutput` helper to standardize
  JSON and Text output, removing repetitive conditional blocks.
- Move interactive CLI prompts and policy validation to a new `internal/ui` package.
- Consolidate shared parsing logic for algorithms and format types into `helpers.go`.
- Standardize I/O handling across all commands using the `IOTuple` abstraction.
- Add `SERVER_SHUTDOWN_TIMEOUT` configuration to decouple server exit from DB settings.
- Implement strict validation for `ACTIVE_MASTER_KEY_ID` during rotation.
- Add comprehensive docstrings and unit tests for CLI definitions and helpers.
- Resolve `gosec` linting issues and fix build failures in command tests.
@allisson allisson merged commit 21f8d4e into main Mar 2, 2026
1 of 2 checks passed
@allisson allisson deleted the improve-cmd branch March 2, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant