mirror of
https://github.com/lahfir/agent-desktop.git
synced 2026-08-04 21:20:48 +00:00
refactor: organize binary crate modules
This commit is contained in:
parent
d11ff33583
commit
8792f8a704
18 changed files with 35 additions and 33 deletions
|
|
@ -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<SkillsArgs, AppError> {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "batch_tests.rs"]
|
||||
mod tests;
|
||||
|
|
@ -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;
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -212,5 +212,4 @@ fn requires_screen_recording(permission: PermissionNeed) -> bool {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "command_policy_tests.rs"]
|
||||
mod tests;
|
||||
|
|
@ -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),
|
||||
|
|
@ -80,5 +80,5 @@ pub(crate) fn parse_xy_opt(s: Option<&str>) -> Result<Option<(f64, f64)>, AppErr
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "dispatch_parse_tests.rs"]
|
||||
#[path = "parse_tests.rs"]
|
||||
mod tests;
|
||||
10
src/main.rs
10
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() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue