.nexus/skills/ratkit/SKILL.md
# ratkit > Comprehensive Rust TUI component library built on ratatui 0.29, providing 21 feature-gated modules (primitives, widgets, services) for building rich terminal applications. This file provides a complete reference for working with the ratkit codebase. The repository is organized as a single crate at the root level with feature-based modularity. Use this guide to understand component relationships, find APIs, and follow established patterns when implementing new features. ## Agent Ope
npx skillsauth add alpha-innovation-labs/opencode-rs-sdk .nexus/skills/ratkitInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Comprehensive Rust TUI component library built on ratatui 0.29, providing 21 feature-gated modules (primitives, widgets, services) for building rich terminal applications.
This file provides a complete reference for working with the ratkit codebase. The repository is organized as a single crate at the root level with feature-based modularity. Use this guide to understand component relationships, find APIs, and follow established patterns when implementing new features.
src/ with 21 feature flags (e.g., button, pane, markdown-preview)features = ["button", "dialog"])tree-view enables widget-event, repo-watcher enables file-watcher and git-watcher)just for all operations: Build (just build), test (just test), check (just check), demos (just demo)--features flag: Examples require their specific features (e.g., --features markdown-preview)ratkit:: (e.g., use ratkit::Button)check_for_changes() calls in the event loopjust check (format + lint + test) before committingexamples/ (moved from crates/ratkit/examples/)examples/cargo run --example button_button_demo --features buttonjustfilejust demo (interactive picker) or just demo-md, just demo-term, etc.Cargo.toml (root level)cargo build --features "button,pane,dialog"cargo build --all-featuresjust check (runs fmt-check, lint, test)# Cargo.toml - enable specific features
[dependencies]
ratkit = { version = "0.2", features = ["button", "dialog", "pane"] }
use ratkit::prelude::*;
use ratatui::Frame;
struct MyApp;
impl CoordinatorApp for MyApp {
fn on_event(&mut self, event: CoordinatorEvent) -> LayoutResult<CoordinatorAction> {
match event {
CoordinatorEvent::Keyboard(keyboard) => {
if keyboard.is_escape() {
return Ok(CoordinatorAction::Quit);
}
}
_ => {}
}
Ok(CoordinatorAction::Continue)
}
fn on_draw(&mut self, frame: &mut Frame) {
// Render your UI here
}
}
fn main() -> std::io::Result<()> {
let app = MyApp;
run(app, RunnerConfig::default())
}
The ratkit workspace contains a single crate with 21 feature-gated modules organized into:
src/primitives/
src/widgets/
src/services/
src/core/All modules follow feature-gated compilation. Enable only what you need.
The core runtime provides the application lifecycle, event routing, and element management for terminal UI applications.
Core UI building blocks for TUI applications, located in src/primitives/.
Each primitive has an individual feature flag:
button, pane, dialog, toast, statusline, scrollmenu-bar (enables widget-event)resizable-gridtree-view (enables widget-event)widget-eventtermtuinew() and with_* methodsWidgetEventHigher-level composite widgets in src/widgets/.
markdown-preview - Most complex (syntax highlighting, TOC, themes, selection)code-diff - VS Code-style diff viewerai-chat - AI chat interface (requires reqwest, serde)hotkey-footer - Keyboard shortcut footerfile-system-tree - File browser with deviconstheme-picker - Theme selector with 25+ themes| Widget | Dependencies | |--------|-------------| | ai-chat | reqwest, serde, serde_json | | markdown-preview | pulldown-cmark, syntect, syntect-tui, notify, arboard, dirs | | code-diff | similar | | file-system-tree | devicons |
Background monitoring services in src/services/.
file-watcher - Watch files/directories for changesgit-watcher - Monitor git repository staterepo-watcher - Combined file + git watching (enables file-watcher and git-watcher)hotkey-service - Global hotkey registration and managementAll watcher services use the notify crate for filesystem events.
use ratkit::prelude::*;CoordinatorAppon_event() to handle eventson_draw() to render UIrun(app, RunnerConfig::default())on_event(), on_draw(), on_layout_changed()Arc<RwLock<>>src/coordinator.rs, src/runner_helper.rsuse ratkit::{run, run_with_diagnostics};CoordinatorAppRunnerConfig::default() or customrun(app, config) or run_with_diagnostics(app, config) for debug overlayrun(), run_with_diagnostics(), RunnerConfigsrc/runner_helper.rsuse ratkit::Element;Element trait for your widgetid(), on_render(), on_keyboard(), on_mouse()ElementMetadata and regionid(), on_render(), on_keyboard(), on_mouse(), on_focus_gain(), on_focus_loss(), on_tick()true when handling eventssrc/registry.rsfeatures = ["button"]use ratkit::Button;Button::new("Label")update_hover(x, y) on mouse moveis_clicked(x, y) on clickrender_with_title()new(), normal_style(), hover_style(), update_hover(), is_clicked()src/primitives/button/widget.rsfeatures = ["pane"]use ratkit::Pane;Pane::new("Title")with_icon(), with_padding(), border_style()new(), with_icon(), with_padding(), with_uniform_padding(), border_style()src/primitives/pane/mod.rsfeatures = ["dialog"]use ratkit::{Dialog, DialogState, DialogType};Dialog::new(title, message) or use builder (Dialog::confirm()).buttons(vec!["Yes", "No"])DialogState::new() for button selectionDialogWidgetnew(), info(), warning(), error(), success(), confirm(), buttons()src/primitives/dialog/features = ["toast"]use ratkit::{ToastManager, ToastLevel};ToastManager::new() in app state.success(), .error(), .info(), .warning()cleanup() before renderrender_toasts()ToastManager::new(), .add(), .success(), .error(), .cleanup()cleanup() to remove expired; doesn't auto-expiresrc/primitives/toast/features = ["tree-view"] (auto-enables widget-event)use ratkit::{TreeNode, TreeView, TreeViewState, TreeNavigator};TreeNode hierarchyTreeView::new(nodes) with render_fnTreeViewState::new() for selection/expansionTreeNavigator for keyboard handlingTreeNode::new(), TreeView::new(), TreeViewState::new(), TreeNavigator::new()src/primitives/tree_view/features = ["markdown-preview"] (complex dependencies)use ratkit::widgets::markdown_preview::{MarkdownWidget, ScrollState, SourceState, ...};MarkdownWidget::new(content, scroll, source, ...)handle_key()new(), handle_key(), handle_mouse(), .show_toc(), .show_scrollbar()src/widgets/markdown_preview/widgets/markdown_widget/features = ["file-watcher"] (uses notify crate)use ratkit::services::file_watcher::FileWatcher;FileWatcher::for_file() or FileWatcher::for_directory()watch(path)check_for_changes() in event loopget_changed_paths()for_file(), for_directory(), watch(), check_for_changes(), get_changed_paths()get_changed_paths() clears queue; debounced (100ms/200ms)src/services/file_watcher/features = ["hotkey-service"]use ratkit::services::hotkey_service::{Hotkey, HotkeyRegistry, HotkeyScope};HotkeyRegistry::new()Hotkey::new(key, description).scope(scope)set_active_scope()lookup(key, scope) in event loopHotkeyRegistry::new(), register(), lookup(), set_active_scope()&'static str for scopes; must handle crossterm events separatelysrc/services/hotkey_service/| Component | Key APIs |
|-----------|----------|
| CoordinatorApp | on_event(), on_draw(), on_layout_changed() |
| run | run(), run_with_diagnostics() |
| Element | id(), on_render(), on_keyboard(), on_mouse(), on_focus_gain(), on_focus_loss(), on_tick() |
| RunnerConfig | tick_rate, layout_debounce, mouse_router_config |
| Primitive | Key APIs |
|-----------|----------|
| Button | new(), normal_style(), hover_style(), update_hover(), is_clicked() |
| Pane | new(), with_icon(), with_padding(), with_uniform_padding(), border_style() |
| Dialog | new(), info(), warning(), error(), success(), confirm(), buttons() |
| Toast | ToastManager::new(), .add(), .success(), .error(), .cleanup() |
| TreeView | TreeNode::new(), TreeView::new(), TreeViewState::new(), TreeNavigator::new() |
| Scroll | calculate_scroll_offset() |
| Service | Key APIs |
|---------|----------|
| FileWatcher | for_file(), for_directory(), watch(), check_for_changes(), get_changed_paths() |
| GitWatcher | new(), with_config(), watch(), check_for_changes() |
| RepoWatcher | new(), with_config(), watch(), check_for_changes(), get_change_set() |
| HotkeyRegistry | new(), register(), lookup(), set_active_scope() |
tree-view enables widget-event; repo-watcher enables file-watcher and git-watchertrue when consuming events, false to propagatecheck_for_changes() regularly on watchers--features markdown-previewjust demo for interactive picker or just demo-* for specific demosexamples/just help for all available commandsjust build or cargo build -p ratkit --all-featuresjust testtools
Rust SDK reference for the OpenCode HTTP API and SSE streaming. Use when implementing, debugging, or reviewing code that integrates with opencode-sdk, including client setup, session/message APIs, event streaming, managed server/runtime workflows, feature-flag behavior, and error handling patterns.
tools
# opencode-sdk > Rust SDK for OpenCode HTTP API with SSE streaming support. Provides ergonomic async client, 15 REST API modules, 40+ event types, and managed server lifecycle. Use this file to understand the SDK structure, feature flags, and correct API usage patterns. All examples assume async context with tokio runtime. ## Agent Operating Rules 1. **Always check feature flags** before using APIs - `http` and `sse` are enabled by default, `server` and `cli` require explicit enabling. 2. **
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.