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
+41
View File
@@ -1,3 +1,7 @@
//! Top-level TUI render pipeline: layouts the terminal into chat / input
//! / status regions, dispatches overlay rendering, and floats toast
//! notifications over the top-right corner.
pub mod chat;
pub mod markdown;
pub mod status;
@@ -11,6 +15,17 @@ use ratatui::widgets::{Block, Borders, Clear, Paragraph, Wrap};
use ratatui::Frame;
use theme::Theme;
/// Top-level render entry point called once per TUI frame.
///
/// Flow: split the frame into main / input / status regions → if an
/// overlay is active, render it inside the main region; otherwise render
/// the chat transcript → always render the input bar and status bar →
/// overlay toast notifications in the top-right corner.
///
/// Why: a single function owns the layout so every state change
/// re-renders the whole UI from a known template.
///
/// Return: nothing; writes directly into `frame`.
pub fn draw(frame: &mut Frame, state: &crate::app::state::rest::AppStateRest) {
let area = frame.area();
@@ -45,6 +60,18 @@ fn render_main_panel(frame: &mut Frame, area: Rect, state: &crate::app::state::r
chat::draw_chat(frame, area, state);
}
/// Render the active modal overlay (Help, Settings, Workflow, Bash, Editor, etc.).
///
/// Flow: compute a centered sub-area → clear it to make the rest of the
/// frame visible behind → match on the Overlay variant to pick the
/// panel's title, content Lines, and styling → render as a Paragraph or
/// delegate to a specialized drawer (e.g. `workflow::draw_workflow_panel`).
///
/// Why: each Overlay variant has its own data sources (settings,
/// session_runtime, app_config) and its own visual treatment, so they
/// are dispatched individually rather than table-driven.
///
/// Return: nothing; draws directly into `frame`.
fn render_overlay(frame: &mut Frame, area: Rect, overlay: crate::app::state::types::Overlay, state: &crate::app::state::rest::AppStateRest) {
let overlay_area = centered_rect(area, 70, 60);
@@ -499,6 +526,20 @@ fn render_overlay(frame: &mut Frame, area: Rect, overlay: crate::app::state::typ
}
}
/// Render the bottom input bar including the autocomplete dropdown above it.
///
/// Flow: if autocomplete is open and has candidates, draw a borderless
/// dropdown anchored just above the input bar showing up to 10 candidates
/// with the current selection highlighted → then render the prompt,
/// placeholder, and the buffer with a single-character highlight under
/// the cursor position.
///
/// Why: the cursor highlight is drawn by splitting the buffer at
/// `state.input.cursor` and styling one character (or trailing space)
/// with the highlight color, since ratatui Paragraph does not expose a
/// native cursor widget.
///
/// Return: nothing; draws directly into `frame` at `area`.
fn render_input_bar(frame: &mut Frame, area: Rect, state: &crate::app::state::rest::AppStateRest) {
// Render autocomplete dropdown if visible
if state.input.autocomplete_visible && !state.input.autocomplete_candidates.is_empty() {