Enhance tool documentation and add new features

- Added module-level documentation for memory tools (`remember`, `recall`, `forget`) to clarify their purpose.
- Improved documentation in `recall.rs` and `remember.rs` to describe the functionality and flow of memory entry operations.
- Updated `mod.rs` to include descriptions for the tool trait and execution context.
- Enhanced `plan.rs` with detailed comments on plan-mode signaling tools.
- Documented text search tools in `search.rs` to explain their functionality.
- Improved sequential-thinking tool documentation in `seqthink.rs`.
- Added safety filter documentation in `shell_filter` for credential and git operations.
- Enhanced utility tools documentation, including `cd`, `dir_cache_update`, and `todowrite`.
- Improved rendering documentation in view modules (`chat`, `markdown`, `status`, `workflow`) to clarify rendering flows and purposes.
This commit is contained in:
asepharyana
2026-07-12 11:28:39 +07:00
parent 7158d362fd
commit 2efd40ca88
124 changed files with 2379 additions and 19 deletions
+12
View File
@@ -1,5 +1,9 @@
//! Slash-command parser that maps TUI `/foo` input lines into `Command`
//! variants for the action dispatch system.
use crate::app::mode::ModeKind;
/// A parsed slash command from the TUI input buffer.
#[derive(Debug, Clone, PartialEq)]
pub enum Command {
Help,
@@ -23,6 +27,14 @@ pub enum Command {
Unknown(String),
}
/// Parse a slash-prefixed input line into a `Command` value.
///
/// Flow: trim -> check for leading `/` -> split on space (max 3 parts) ->
/// match the first token against known commands -> extract arguments from
/// the remaining parts.
///
/// Why: early return `Unknown` for non-slash lines so the caller can treat
/// them as regular chat input.
pub fn parse_command(text: &str) -> Command {
let text = text.trim();
if !text.starts_with('/') {
+20
View File
@@ -1,3 +1,7 @@
//! Key event dispatcher: maps crossterm `KeyEvent` values into `Action`
//! variants, with special handling for overlays, auto-complete, and the
//! inline editor.
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
use crate::app::mode;
@@ -7,6 +11,16 @@ use crate::app::state::rest::AppStateRest;
use crate::app::state::types::Overlay;
use crate::controller::command::parse_command;
/// Translate a terminal `KeyEvent` into zero or more `Action` values
/// based on the current application state.
///
/// Flow: check overlay first (Editor gets its own handler) -> match on
/// key code and modifiers -> handle auto-complete cycles -> dispatch to
/// `Action` variants or overlay-specific handlers.
///
/// Why: when Editor overlay is active, all key events are consumed by the
/// editor handler and never reach the main action dispatch. Return `Vec`
/// so that a single key press can trigger multiple actions.
pub fn handle_key(key: KeyEvent, state: &mut AppStateRest) -> Vec<Action> {
// While Editor overlay is active, route input directly to the editor handler
if state.misc.overlay == Overlay::Editor {
@@ -192,6 +206,12 @@ pub fn handle_key(key: KeyEvent, state: &mut AppStateRest) -> Vec<Action> {
}
}
/// Handle pressing Enter while a modal overlay is active: dispatch
/// overlay-specific submit logic (bash, settings, todo, quit, etc.).
///
/// Flow: match the current overlay -> run the associated handler ->
/// mutate state or produce actions as needed -> always return `Vec::new()`
/// (the handler itself applies state mutations).
fn handle_overlay_enter(state: &mut AppStateRest) -> Vec<Action> {
match state.misc.overlay {
Overlay::Bash => {
+2
View File
@@ -1,2 +1,4 @@
//! Keyboard input handling and command parsing for the TUI.
pub mod command;
pub mod input;