v0.1.24 - Centralized CLI Option Definitions (2025-12-07)¶
What Changed?¶
This release introduces a centralized options management system for CLI commands through the new Options and MockOptions classes. All device communication commands (query, read, status, threshold, reset) now use consistent, reusable option definitions, reducing code duplication and improving maintainability. Default values have been unified across all commands for a consistent user experience.
What's New¶
Centralized Options Management System¶
What it does:
The new options.py module provides centralized Options and MockOptions classes that define all reusable CLI option definitions. This eliminates repetitive typer.Option() definitions across commands and ensures consistency in option naming, help text, and default values.
How to use it: All device commands now use the centralized options:
# All commands now support unified defaults
kazunoko query STATUS
kazunoko read
kazunoko status
kazunoko threshold "1:300;2:300;3:300"
kazunoko reset
# All commands support consistent formatting options
kazunoko query STATUS --format json --use-flat
kazunoko status --format csv --use-raw
kazunoko threshold "1:300;2:300;3:300" --format table
Code example:
from .options import Options, MockOptions
# In command definitions:
@app.command()
def query(
command: str = typer.Argument(...),
port: str = Options.port(),
verbose: bool = Options.verbose(),
format: str = Options.format("jsonl"),
use_flat: bool = Options.use_flat(True),
mock: bool = MockOptions.mock(),
) -> None:
pass
Installation¶
Quick Start¶
# Get the release
git checkout vX.Y.Z
# Setup
task env:setup
# Run CLI
uv run kazunoko --help
What's Different from the Last Version?¶
✅ Added¶
- New
options.pymodule withOptionsclass for device communication options - New
MockOptionsclass for mock device and testing options - Centralized definitions for:
port(),verbose(),format(),use_flat(),count() - Support for generating count, speed, jitter, and seed options in
MockOptions --formatand--use-flatoptions tothresholdcommand--formatand--use-flatoptions toresetcommand
🔧 Changed¶
querycommand refactored to useOptionsclassreadcommand refactored to useOptionsclassstatuscommand refactored to useOptionsclassthresholdcommand refactored to useOptionsclass with format supportresetcommand refactored to useOptionsclass with format support- Unified default values across all commands:
format="jsonl",use_flat=True - All commands now use consistent option naming and help text
🐛 Fixed¶
- Inconsistent option definitions across CLI commands
- Duplicate help text and default value definitions
- Inconsistent default behavior between commands
Is It Safe to Upgrade?¶
Backward Compatible: Yes
- All option names and short flags remain unchanged
- Default values unified to match previous read command behavior (format="jsonl", use_flat=True)
- All existing CLI usage patterns continue to work without modification
- Internal refactoring does not affect CLI user experience
- This is a code quality improvement with no user-facing breaking changes
Tests Passed¶
- ✅ Builds without errors (
uv sync) - ✅ Type checking passes (
uvx mypy src/) - ✅ Linting passes (
uvx ruff check src/) - ✅ All CLI commands functional with mock device
- ✅ Options class methods return correct typer.Option instances
- ✅ Default values properly applied to all commands
- ✅ Help text consistent across all commands
Release Details¶
- Date: 2025-12-07
- Version: v0.1.24
- Files Changed: 2 (options.py new, cli.py modified)
- Commits:
- 8cdd87c feat: add Options and MockOptions for centralized CLI option definitions
- 3e715b7 refactor: apply Options and MockOptions to query command
- 801a407 refactor: apply Options to read command
- e0e19b4 refactor: apply Options to status command and unify defaults
- 61f53bb refactor: unify default format and use_flat values for query command
- 5bc2b35 refactor: apply Options to threshold command with format options
- a82f21d refactor: apply Options to reset command with format options
Next Steps¶
- Apply
Optionsclass to remaining CLI commands (version,generate) - Consider extracting more option groups (e.g., connection options, testing options)
- Expand Options class with common argument definitions if needed
- Gather user feedback on unified option behavior
- Plan next feature additions based on user needs