Coverage for  / home / runner / work / bijux-cli / bijux-cli / src / bijux_cli / services / history / contracts.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.13.2, created at 2026-01-26 17:59 +0000

1# SPDX-License-Identifier: Apache-2.0 

2# Copyright © 2025 Bijan Mousavi 

3 

4"""Defines the contract for the history service.""" 

5 

6from __future__ import annotations 

7 

8from collections.abc import Sequence 

9from typing import Any, Protocol, runtime_checkable 

10 

11 

12@runtime_checkable 

13class HistoryProtocol(Protocol): 

14 """Defines the contract for the history service.""" 

15 

16 def add( 

17 self, 

18 command: str, 

19 *, 

20 params: Sequence[str] | None = None, 

21 success: bool | None = None, 

22 return_code: int | None = None, 

23 duration_ms: float | None = None, 

24 raw: dict[str, Any] | None = None, 

25 ) -> None: 

26 """Append a history entry.""" 

27 ... 

28 

29 def list(self, *, limit: int | None = None) -> list[dict[str, Any]]: 

30 """Return stored history entries.""" 

31 ... 

32 

33 def clear(self) -> None: 

34 """Clear all history entries.""" 

35 ... 

36 

37 

38__all__ = ["HistoryProtocol"]