Skip to content

v0.24.0 - CommandHistory Library Module (2026-06-21)

What Changed?

This release promotes CommandHistory from a standalone example script (history.py) into a proper library module (kazunoko.history). All example scripts now import it directly from kazunoko, and the output filename command_history.jsonl is centralized as CommandHistory.FILENAME.


What's New

Main Feature: CommandHistory as Library Module

What it does: Tracks command execution metadata (invocation, status, duration, device info) and persists it as JSONL for troubleshooting support. When users report problems, they can submit command_history.jsonl to trace the full measurement-to-analysis workflow.

How to use it:

from kazunoko import CommandHistory
from pathlib import Path
import sys

history_path = Path("./data") / CommandHistory.FILENAME
history = CommandHistory.from_cli_context(
    executable=Path(sys.argv[0]).name,
    argv=sys.argv,
    kazunoko_version=__version__,
)
history.save(history_path)

try:
    # ... your code ...
    history.update_status("completed")
    history.save(history_path)
except KeyboardInterrupt:
    history.update_status("interrupted")
    history.save(history_path)
    raise
except Exception:
    history.update_status("error")
    history.save(history_path)
    raise

Installation

Quick Start

# Get the release
git checkout v0.24.0

# Setup
task env:setup

# Run CLI
uv run kazunoko --help

What's Different from the Last Version?

✅ Added

  • src/kazunoko/history.py: new library module with CommandHistory dataclass and reconstruct_command() function
  • CommandHistory.FILENAME: class attribute centralizing the "command_history.jsonl" filename
  • CommandHistory and reconstruct_command exported from kazunoko top-level package
  • CommandHistory added to check_bme280.py (previously missing)

🔧 Changed

  • All 12 example scripts migrated from try/except ImportError + HAS_HISTORY pattern to direct from kazunoko import CommandHistory
  • All scripts now reference CommandHistory.FILENAME instead of hardcoding "command_history.jsonl"
  • examples/history.py removed (promoted to library)

Is It Safe to Upgrade?

Backward Compatible: Yes

  • Existing command_history.jsonl files are unaffected
  • Example scripts produce identical output
  • CommandHistory API is unchanged; only the import path changed

Tests Passed

  • ✅ Builds without errors
  • uvx ruff check src/ passes
  • ✅ All example scripts import CommandHistory without errors

Release Details

  • Date: 2026-06-21
  • Version: v0.24.0
  • Files Changed: 15
  • Commits: 995b50e, 33a022e, c2bf0e2, 7ff0d87, 23885cb

Next Steps

  • Add tests for CommandHistory in tests/