diff --git a/src/batch.rs b/src/batch/mod.rs similarity index 98% rename from src/batch.rs rename to src/batch/mod.rs index 8231fb9..cf9a841 100644 --- a/src/batch.rs +++ b/src/batch/mod.rs @@ -12,8 +12,10 @@ use serde_json::{Map, Value, json}; use crate::{ cli::Commands, - cli_args_skills::{SkillsAction, SkillsArgs, SkillsGetArgs}, - cli_args_system::BatchArgs, + cli_args::{ + skills::{SkillsAction, SkillsArgs, SkillsGetArgs}, + system::BatchArgs, + }, }; pub(crate) fn execute( @@ -184,5 +186,4 @@ fn parse_skills(args: Value) -> Result { } #[cfg(test)] -#[path = "batch_tests.rs"] mod tests; diff --git a/src/batch_tests.rs b/src/batch/tests.rs similarity index 100% rename from src/batch_tests.rs rename to src/batch/tests.rs diff --git a/src/command_contract_tests.rs b/src/cli/contract_tests.rs similarity index 100% rename from src/command_contract_tests.rs rename to src/cli/contract_tests.rs diff --git a/src/help_after.txt b/src/cli/help_after.txt similarity index 100% rename from src/help_after.txt rename to src/cli/help_after.txt diff --git a/src/help_before.txt b/src/cli/help_before.txt similarity index 100% rename from src/help_before.txt rename to src/cli/help_before.txt diff --git a/src/cli.rs b/src/cli/mod.rs similarity index 93% rename from src/cli.rs rename to src/cli/mod.rs index 62ca1b3..d7effef 100644 --- a/src/cli.rs +++ b/src/cli/mod.rs @@ -3,20 +3,20 @@ use std::path::PathBuf; use crate::cli_args::{ FindArgs, GetArgs, IsArgs, ListSurfacesArgs, RefArgs, ScreenshotArgs, SnapshotArgs, -}; -use crate::cli_args_actions::{ - DragCliArgs, HoverArgs, KeyComboArgs, MouseClickArgs, MouseMoveArgs, MousePointArgs, PressArgs, - ScrollArgs, SelectArgs, SetValueArgs, TypeArgs, -}; -use crate::cli_args_notifications::{ - DismissAllNotificationsCliArgs, DismissNotificationCliArgs, ListNotificationsCliArgs, - NotificationActionCliArgs, -}; -use crate::cli_args_skills::SkillsArgs; -use crate::cli_args_system::{ - AppRefArgs, BatchArgs, ClipboardSetArgs, CloseAppArgs, FocusWindowArgs, LaunchArgs, - ListAppsArgs, ListWindowsArgs, MoveWindowCliArgs, PermissionsArgs, ResizeWindowCliArgs, - VersionArgs, WaitArgs, + actions::{ + DragCliArgs, HoverArgs, KeyComboArgs, MouseClickArgs, MouseMoveArgs, MousePointArgs, + PressArgs, ScrollArgs, SelectArgs, SetValueArgs, TypeArgs, + }, + notifications::{ + DismissAllNotificationsCliArgs, DismissNotificationCliArgs, ListNotificationsCliArgs, + NotificationActionCliArgs, + }, + skills::SkillsArgs, + system::{ + AppRefArgs, BatchArgs, ClipboardSetArgs, CloseAppArgs, FocusWindowArgs, LaunchArgs, + ListAppsArgs, ListWindowsArgs, MoveWindowCliArgs, PermissionsArgs, ResizeWindowCliArgs, + VersionArgs, WaitArgs, + }, }; const BEFORE_HELP: &str = include_str!("help_before.txt"); @@ -240,3 +240,7 @@ impl Commands { } } } + +#[cfg(test)] +#[path = "contract_tests.rs"] +mod contract_tests; diff --git a/src/cli_args_actions.rs b/src/cli_args/actions.rs similarity index 100% rename from src/cli_args_actions.rs rename to src/cli_args/actions.rs diff --git a/src/cli_args.rs b/src/cli_args/mod.rs similarity index 98% rename from src/cli_args.rs rename to src/cli_args/mod.rs index 2fcf1e1..578364c 100644 --- a/src/cli_args.rs +++ b/src/cli_args/mod.rs @@ -1,6 +1,11 @@ use clap::{Parser, ValueEnum}; use serde::Deserialize; +pub(crate) mod actions; +pub(crate) mod notifications; +pub(crate) mod skills; +pub(crate) mod system; + fn default_max_depth() -> u8 { 10 } diff --git a/src/cli_args_notifications.rs b/src/cli_args/notifications.rs similarity index 100% rename from src/cli_args_notifications.rs rename to src/cli_args/notifications.rs diff --git a/src/cli_args_skills.rs b/src/cli_args/skills.rs similarity index 100% rename from src/cli_args_skills.rs rename to src/cli_args/skills.rs diff --git a/src/cli_args_system.rs b/src/cli_args/system.rs similarity index 100% rename from src/cli_args_system.rs rename to src/cli_args/system.rs diff --git a/src/command_policy.rs b/src/command_policy/mod.rs similarity index 99% rename from src/command_policy.rs rename to src/command_policy/mod.rs index f484ed6..7e34f1f 100644 --- a/src/command_policy.rs +++ b/src/command_policy/mod.rs @@ -212,5 +212,4 @@ fn requires_screen_recording(permission: PermissionNeed) -> bool { } #[cfg(test)] -#[path = "command_policy_tests.rs"] mod tests; diff --git a/src/command_policy_tests.rs b/src/command_policy/tests.rs similarity index 100% rename from src/command_policy_tests.rs rename to src/command_policy/tests.rs diff --git a/src/dispatch.rs b/src/dispatch/mod.rs similarity index 98% rename from src/dispatch.rs rename to src/dispatch/mod.rs index 1348401..79922f6 100644 --- a/src/dispatch.rs +++ b/src/dispatch/mod.rs @@ -1,3 +1,6 @@ +mod notifications; +mod parse; + use agent_desktop_core::{ PermissionReport, adapter::PlatformAdapter, @@ -15,8 +18,8 @@ use agent_desktop_core::{ use serde_json::Value; use crate::cli::Commands; -use crate::cli_args_skills::SkillsAction; -use crate::dispatch_parse::{ +use crate::cli_args::skills::SkillsAction; +use parse::{ parse_direction, parse_get_property, parse_is_property, parse_mouse_button, parse_xy, parse_xy_opt, }; @@ -293,9 +296,7 @@ pub(crate) fn dispatch( Commands::ListNotifications(_) | Commands::DismissNotification(_) | Commands::DismissAllNotifications(_) - | Commands::NotificationAction(_) => { - crate::dispatch_notifications::dispatch_notification(cmd, adapter) - } + | Commands::NotificationAction(_) => notifications::dispatch_notification(cmd, adapter), Commands::ClipboardGet => clipboard_get::execute(adapter), Commands::ClipboardSet(a) => clipboard_set::execute(a.text, adapter), diff --git a/src/dispatch_notifications.rs b/src/dispatch/notifications.rs similarity index 100% rename from src/dispatch_notifications.rs rename to src/dispatch/notifications.rs diff --git a/src/dispatch_parse.rs b/src/dispatch/parse.rs similarity index 98% rename from src/dispatch_parse.rs rename to src/dispatch/parse.rs index 721f92f..2d17e6a 100644 --- a/src/dispatch_parse.rs +++ b/src/dispatch/parse.rs @@ -80,5 +80,5 @@ pub(crate) fn parse_xy_opt(s: Option<&str>) -> Result, AppErr } #[cfg(test)] -#[path = "dispatch_parse_tests.rs"] +#[path = "parse_tests.rs"] mod tests; diff --git a/src/dispatch_parse_tests.rs b/src/dispatch/parse_tests.rs similarity index 100% rename from src/dispatch_parse_tests.rs rename to src/dispatch/parse_tests.rs diff --git a/src/main.rs b/src/main.rs index a46c567..f5cbb78 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,16 +1,8 @@ mod batch; mod cli; mod cli_args; -mod cli_args_actions; -mod cli_args_notifications; -mod cli_args_skills; -mod cli_args_system; -#[cfg(test)] -mod command_contract_tests; mod command_policy; mod dispatch; -mod dispatch_notifications; -mod dispatch_parse; use agent_desktop_core::{ adapter::PlatformAdapter, @@ -19,7 +11,7 @@ use agent_desktop_core::{ }; use clap::{CommandFactory, Parser}; use cli::{Cli, Commands}; -use cli_args_skills::SkillsAction; +use cli_args::skills::SkillsAction; use std::io::{BufWriter, Write}; fn main() {