refactor(command): update parsing to use registry-based system
Update the command parsing layer to use the new CmdRegistry: - parse_line() now uses default_registry() and returns Vec<Box<dyn Cmd>> - parse_line_with() accepts a registry parameter for custom registries - Tokenization replaced direct Command construction with registry.parse() - Updated tests to verify command names instead of struct fields - Removed parse_command() and helper functions (require_args, parse_coords, etc.) The parser now delegates command construction to the registry, which allows commands to be defined and registered in one place. Co-Authored-By: fiddlerwoaroof/git-smart-commit (unsloth/Qwen3.5-35B-A3B-GGUF:Q5_K_M)
This commit is contained in:
@ -1,16 +1,12 @@
|
||||
//! Command layer — all model mutations go through this layer so they can be
|
||||
//! replayed, scripted, and tested without the TUI.
|
||||
//!
|
||||
//! Each command is a JSON object: `{"op": "CommandName", ...args}`.
|
||||
//! The headless CLI (--cmd / --script) routes through here, and the TUI
|
||||
//! App also calls dispatch() for every user action that mutates state.
|
||||
//! Commands are trait objects (`dyn Cmd`) that produce effects (`dyn Effect`).
|
||||
//! The headless CLI (--cmd / --script) parses Forth-style text into effects
|
||||
//! and applies them directly.
|
||||
|
||||
pub mod cmd;
|
||||
pub mod dispatch;
|
||||
pub mod keymap;
|
||||
pub mod parse;
|
||||
pub mod types;
|
||||
|
||||
pub use dispatch::dispatch;
|
||||
pub use parse::parse_line;
|
||||
pub use types::{Command, CommandResult};
|
||||
|
||||
Reference in New Issue
Block a user