From db625031bf52020ed1d6c8cfa868ba658ca91c08 Mon Sep 17 00:00:00 2001 From: junhsss Date: Fri, 11 Sep 2026 02:44:32 +0900 Subject: [PATCH 1/2] feat(computer): make --template optional and drop --disk --- docs/cli-reference.md | 3 +-- src/api/computers.rs | 23 +++++++++++------------ src/commands/computer/mod.rs | 9 ++------- 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/docs/cli-reference.md b/docs/cli-reference.md index e315107..2844e12 100644 --- a/docs/cli-reference.md +++ b/docs/cli-reference.md @@ -1572,11 +1572,10 @@ steel computer create ### Parameters -- `--template` (string, required): Template name +- `--template` (string, optional): Template name (defaults to the only one the API offers) - `--region` (string, optional): Region, for example us-east - `--vcpu` (string, optional): Number of vCPUs - `--memory` (string, optional): Memory in MiB -- `--disk` (string, optional): Disk in MiB - `--timeout` (string, optional): Stop the computer after this many seconds of running time - `--auto-pause` (boolean, optional): Pause instead of stopping when the timeout is reached - `--wait` (boolean, optional): Wait until the computer is running diff --git a/src/api/computers.rs b/src/api/computers.rs index 240a316..709d163 100644 --- a/src/api/computers.rs +++ b/src/api/computers.rs @@ -10,18 +10,20 @@ pub fn computer_path(id: &str) -> String { #[derive(Debug, Default, Clone)] pub struct CreateComputer { - pub template: String, + pub template: Option, pub region: Option, pub vcpu: Option, pub memory_mib: Option, - pub disk_mib: Option, pub timeout_seconds: Option, pub auto_pause: Option, } impl CreateComputer { pub fn body(&self) -> Value { - let mut body = json!({ "template": self.template }); + let mut body = json!({}); + if let Some(template) = &self.template { + body["template"] = json!(template); + } if let Some(region) = &self.region { body["region"] = json!(region); } @@ -31,9 +33,6 @@ impl CreateComputer { if let Some(memory) = self.memory_mib { body["memoryMib"] = json!(memory); } - if let Some(disk) = self.disk_mib { - body["diskMib"] = json!(disk); - } if let Some(timeout) = self.timeout_seconds { body["timeoutSeconds"] = json!(timeout); } @@ -195,18 +194,19 @@ mod tests { #[test] fn create_body_only_carries_given_fields() { - let minimal = CreateComputer { - template: "steel".into(), + assert_eq!(CreateComputer::default().body(), json!({})); + + let named = CreateComputer { + template: Some("steel".into()), ..Default::default() }; - assert_eq!(minimal.body(), json!({ "template": "steel" })); + assert_eq!(named.body(), json!({ "template": "steel" })); let full = CreateComputer { - template: "steel".into(), + template: Some("steel".into()), region: Some("us-east".into()), vcpu: Some(4), memory_mib: Some(4096), - disk_mib: Some(10240), timeout_seconds: Some(600), auto_pause: Some(true), }; @@ -217,7 +217,6 @@ mod tests { "region": "us-east", "vcpu": 4, "memoryMib": 4096, - "diskMib": 10240, "timeoutSeconds": 600, "autoPause": true, }) diff --git a/src/commands/computer/mod.rs b/src/commands/computer/mod.rs index 2e0e8f7..7c5f10c 100644 --- a/src/commands/computer/mod.rs +++ b/src/commands/computer/mod.rs @@ -74,9 +74,9 @@ impl Command { #[derive(Parser)] pub struct CreateArgs { - /// Template name + /// Template name (defaults to the only one the API offers) #[arg(long)] - pub template: String, + pub template: Option, /// Region, for example us-east #[arg(long)] @@ -90,10 +90,6 @@ pub struct CreateArgs { #[arg(long = "memory", value_name = "MIB")] pub memory_mib: Option, - /// Disk in MiB - #[arg(long = "disk", value_name = "MIB")] - pub disk_mib: Option, - /// Stop the computer after this many seconds of running time #[arg(long = "timeout", value_name = "SECONDS")] pub timeout_seconds: Option, @@ -215,7 +211,6 @@ async fn run_create(args: CreateArgs) -> Result<()> { region: args.region, vcpu: args.vcpu, memory_mib: args.memory_mib, - disk_mib: args.disk_mib, timeout_seconds: args.timeout_seconds, auto_pause: args.auto_pause.then_some(true), }; From dcf3706a7c1eee0ac6a293a165cb0c38dcd887f4 Mon Sep 17 00:00:00 2001 From: junhsss Date: Fri, 11 Sep 2026 03:00:13 +0900 Subject: [PATCH 2/2] chore: bump version --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7cc8609..95df3bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3762,7 +3762,7 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "steel-cli" -version = "0.5.0-preview.2" +version = "0.5.0-preview.3" dependencies = [ "aes 0.8.4", "aes-gcm 0.10.3", diff --git a/Cargo.toml b/Cargo.toml index 359fbdd..5519f37 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "steel-cli" -version = "0.5.0-preview.2" +version = "0.5.0-preview.3" edition = "2024" description = "Steel CLI - Browser automation for AI agents" license = "MIT"