From 406104babdcc53d12c445120e6de2e64eb913171 Mon Sep 17 00:00:00 2001 From: Hare Date: Wed, 29 Jul 2026 18:44:08 +0900 Subject: [PATCH] cli: update yoi help --- crates/yoi/src/main.rs | 89 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 84 insertions(+), 5 deletions(-) diff --git a/crates/yoi/src/main.rs b/crates/yoi/src/main.rs index 2db25808..26c3998d 100644 --- a/crates/yoi/src/main.rs +++ b/crates/yoi/src/main.rs @@ -720,7 +720,7 @@ fn parse_workers_args( match arg.as_str() { "--help" | "-h" => { return Err(ParseError( - "usage: yoi [--local|--backend URL] [--workspace-id ID] workers [-r|--stopped] [--workspace PATH] [--runtime-id ID]".to_string(), + "usage: yoi [--local|--backend ] [--workspace-id ] workers [-r|--stopped] [--workspace ] [--runtime-id ]".to_string(), )); } "-r" | "--restoreable" | "--stopped" => { @@ -1589,15 +1589,80 @@ fn parse_session_id(value: &str) -> Result { .map_err(|_| ParseError(format!("invalid --session UUID: {value}"))) } +const TOP_LEVEL_HELP: &str = r#"yoi + +Usage: + yoi [TARGET] [CONSOLE_OPTIONS] + yoi [TARGET] workers [-r|--stopped] [--workspace ] [--runtime-id ] + yoi [TARGET] resume [--workspace |--all] [--runtime-id ] + yoi [TARGET] panel [--workspace ] + yoi [--backend ] login [--no-wait] + yoi [OPTIONS] + +Target selection: + Target options are top-level options and must appear before the command. + + --local Use the local Worker runtime explicitly + --backend Use a Workspace Backend explicitly + --workspace-id Scope Backend routes to a Workspace id + + If no target is explicit, connection-aware commands use the merged client config: + /client/config.toml + /.yoi/client.config.toml + + Supported client config keys: + default_connection = "local" | "backend" + default_backend = "" + [backends.] url = "https://backend.example" + [workspaces.] backend = "" + +Connection-aware commands: + yoi Local: open a new Console. Backend: open Backend Workers. + yoi workers List/select Workers for the selected target. + yoi workers -r Include stopped Workers. --restoreable is accepted as a legacy alias. + yoi resume Open the Worker picker with stopped Workers included. + yoi panel Open the dashboard/panel TUI for the selected target. + +Console options: + --workspace Local workspace root for local Console/Worker lists (defaults to cwd) + --worker Open/create a named local Worker Console + --socket Attach to a local Worker socket; requires --worker + --session Resume a local session segment + --profile Select a reusable Profile recipe for a fresh local Worker + --runtime-id Backend Runtime id for Backend Worker list/attach + --worker-id Backend Worker id to attach; requires --runtime-id + +Local commands: + keys Manage local model/API keys + setup-model Configure a local model provider + worker [WORKER_OPTIONS] Run the local Worker runtime CLI + worker delete Delete local Worker records + worker prune Prune old local Worker records + ticket Manage Tickets through the local workspace authority + objective Manage Objectives through the local workspace authority + plugin Build/check/list/show plugins + mcp Inspect configured MCP servers + memory lint Lint local memory files + session Inspect/prune local session logs + +Backend-only commands: + login Run Backend device login and save the API token + +Standalone binaries: + yoi-workspace-server Workspace Backend server/admin CLI + worker-runtime-rest-server Worker Runtime REST server + +Options: + -h, --help Print help +"#; + fn print_help() { - println!( - "yoi\n\nUsage:\n yoi [TARGET_OPTIONS] [OPTIONS]\n yoi [TARGET_OPTIONS] resume [--workspace ] [--all] [--runtime-id ]\n yoi [TARGET_OPTIONS] workers [-r|--stopped] [--workspace ] [--runtime-id ]\n yoi [TARGET_OPTIONS] panel [--workspace ]\n yoi keys\n yoi setup-model\n yoi worker [WORKER_OPTIONS]\n yoi worker delete [--force] [--dry-run]\n yoi worker prune --older-than [--force] [--dry-run]\n yoi objective [OPTIONS]\n yoi session analyze --json\n yoi session prune --unreferenced [--older-than ] [--force] [--dry-run]\n yoi ticket [OPTIONS]\n yoi plugin new [--json]\n yoi plugin check [--json]\n yoi plugin pack [--output ] [--json]\n yoi plugin list [--workspace ] [--profile ] [--json]\n yoi plugin show [--workspace ] [--profile ] [--json]\n yoi mcp list [--workspace ] [--profile ] [--json]\n yoi mcp show [--workspace ] [--profile ] [--json]\n yoi mcp tools|resources|prompts [SERVER] [--workspace ] [--profile ] [--json]\n yoi memory lint [OPTIONS]\n\nSurfaces:\n Console Single-Worker chat/client surface (default, --worker, yoi resume, Backend Runtime target)\n Dashboard Workspace cockpit/action surface (yoi panel)\n TUI Terminal UI implementation umbrella for Console and Dashboard\n\nOptions:\n --workspace Runtime workspace root for default Console/--worker/workers (defaults to cwd)\n --workspace-id Workspace identity for Backend scoped routes\n --backend Workspace Backend API URL for Backend Runtime attach/list\n --runtime-id Backend Runtime identity for attach/list\n --worker Open the Worker Console by name (attach/restore/create)\n --socket Attach a Worker Console to a specific socket with --worker\n --session Resume a specific session segment in the Worker Console\n --profile Select a reusable Profile recipe\n -h, --help Print help\n" - ); + println!("{TOP_LEVEL_HELP}"); } fn print_resume_help() { println!( - "yoi resume\n\nUsage:\n yoi resume [--workspace ] [--all]\n\nOptions:\n --workspace Open the Worker Console picker scoped to this workspace (defaults to cwd)\n --all Open the Worker Console picker across this host/data dir\n -h, --help Print help\n" + "yoi resume\n\nUsage:\n yoi [TARGET] resume [--workspace |--all] [--runtime-id ]\n\nTarget options:\n --local Use local Worker records explicitly\n --backend Use Backend Worker records explicitly\n --workspace-id Scope Backend routes to a Workspace id\n\nOptions:\n --workspace Open the Worker picker scoped to this local workspace (defaults to cwd)\n --all Open the Worker picker across this host/data dir\n --runtime-id Restrict Backend picker to a Runtime id\n -h, --help Print help\n" ); } @@ -1732,6 +1797,20 @@ backend = "shared" ); } + #[test] + fn top_level_help_matches_current_target_surface() { + assert!(TOP_LEVEL_HELP.contains("Target options are top-level options")); + assert!(TOP_LEVEL_HELP.contains("--local")); + assert!(TOP_LEVEL_HELP.contains("--backend ")); + assert!(TOP_LEVEL_HELP.contains("/client/config.toml")); + assert!(TOP_LEVEL_HELP.contains("/.yoi/client.config.toml")); + assert!(TOP_LEVEL_HELP.contains("yoi-workspace-server")); + assert!(TOP_LEVEL_HELP.contains("worker-runtime-rest-server")); + assert!(!TOP_LEVEL_HELP.contains("yoi workspace")); + assert!(!TOP_LEVEL_HELP.contains("yoi server")); + assert!(!TOP_LEVEL_HELP.contains("TARGET_OPTIONS")); + } + #[test] fn parse_local_only_commands_reject_backend_target_options() { let err = parse_args_from(["panel", "--runtime-id", "runtime-a"]).unwrap_err();