Files
shell-speak/shell_speak/models.py
7000pctAUTO 2aa1ea0816
Some checks failed
CI / build (push) Has been cancelled
CI / test (push) Has been cancelled
Initial upload: shell-speak CLI tool with natural language to shell command conversion
2026-01-31 05:31:13 +00:00

48 lines
977 B
Python

"""Data models for shell-speak."""
from dataclasses import dataclass, field
from datetime import datetime
from typing import Optional
@dataclass
class CommandPattern:
"""A pattern for matching natural language to shell commands."""
name: str
tool: str
description: str
patterns: list[str]
template: str
explanation: str = ""
examples: list[str] = field(default_factory=list)
@dataclass
class CommandMatch:
"""A match between natural language and a shell command."""
pattern: CommandPattern
confidence: float
matched_query: str
command: str
explanation: str
@dataclass
class HistoryEntry:
"""An entry in the command history."""
query: str
command: str
tool: str
timestamp: datetime
explanation: str = ""
@dataclass
class Correction:
"""A user correction for a query."""
original_query: str
corrected_command: str
tool: str
timestamp: datetime
explanation: str = ""