feat: Add module docs, Enum coercion, tracebacks, and toggle improvements

- Add comprehensive module docstrings across the codebase for better clarity and documentation.
- Refactor Enum classes (e.g., FileType, ConfirmType) to use `_missing_` for built-in coercion from strings.
- Add `encoding` attribute to `LoadFileAction`, `SaveFileAction`, and `SelectFileAction` for more flexible file handling.
- Enable lazy file loading by default in `SelectFileAction` to improve performance.
- Simplify bottom bar toggle behavior: all toggles now use `ctrl+<key>`, eliminating the need for key conflict checks with Falyx commands.
- Add `ignore_in_history` attribute to `Command` to refine how `ExecutionRegistry` identifies the last valid result.
- Improve History command output: now includes tracebacks when displaying exceptions.
This commit is contained in:
2025-07-19 14:44:43 -04:00
parent 21402bff9a
commit 7f63e16097
61 changed files with 2324 additions and 373 deletions

View File

@@ -19,6 +19,7 @@ from __future__ import annotations
import time
from datetime import datetime
from traceback import format_exception
from typing import Any
from pydantic import BaseModel, ConfigDict, Field
@@ -75,7 +76,8 @@ class ExecutionContext(BaseModel):
kwargs: dict = Field(default_factory=dict)
action: Any
result: Any | None = None
exception: BaseException | None = None
traceback: str | None = None
_exception: BaseException | None = None
start_time: float | None = None
end_time: float | None = None
@@ -122,6 +124,16 @@ class ExecutionContext(BaseModel):
def status(self) -> str:
return "OK" if self.success else "ERROR"
@property
def exception(self) -> BaseException | None:
return self._exception
@exception.setter
def exception(self, exc: BaseException | None):
self._exception = exc
if exc is not None:
self.traceback = "".join(format_exception(exc)).strip()
@property
def signature(self) -> str:
"""
@@ -138,6 +150,7 @@ class ExecutionContext(BaseModel):
"name": self.name,
"result": self.result,
"exception": repr(self.exception) if self.exception else None,
"traceback": self.traceback,
"duration": self.duration,
"extra": self.extra,
}