Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(cli): require --detach in agent workflow docs and harden inputs

Richie McIlroye912a3d075bb
diff --git a/apps/cli/README.md b/apps/cli/README.md
index 0e6f03b46..527ff00e1 100644
--- a/apps/cli/README.md
+++ b/apps/cli/README.md
@@ -58,7 +58,7 @@ is taken from `CAP_SERVER_URL`, else Cap Desktop's configured server, else `http
```sh
cap doctor --json # verify permissions & capture readiness (exits 0; read `ok`/`captureReady`)
cap targets --json # discover screens/windows/cameras/mics (ids feed the next steps)
-cap record start --screen <id> --json # start in the background -> {"type":"started","recordingId","pid","path"}
+cap record start --screen <id> --json --detach # start in the background -> {"type":"started","recordingId","pid","path"}
# ... the agent performs whatever it needs to capture ...
cap record stop --id <recordingId> --json # finalize -> {"type":"stopped","path","recordingMetaExists":true}
cap project validate <path.cap> --json # confirm the recording is complete before exporting
diff --git a/apps/cli/src/credentials.rs b/apps/cli/src/credentials.rs
index d2ce1b342..c0005954a 100644
--- a/apps/cli/src/credentials.rs
+++ b/apps/cli/src/credentials.rs
@@ -61,6 +61,7 @@ fn store_server(store: &Value) -> Option<String> {
.get("general_settings")?
.get("serverUrl")?
.as_str()
+ .filter(|value| !value.is_empty())
.map(str::to_string)
}
diff --git a/apps/cli/src/main.rs b/apps/cli/src/main.rs
index 6a44257ce..6a501fe7c 100644
--- a/apps/cli/src/main.rs
+++ b/apps/cli/src/main.rs
@@ -47,7 +47,7 @@ ENVIRONMENT
TYPICAL AGENT WORKFLOW
cap doctor --json # verify permissions & capture readiness
cap targets --json # discover screens/windows/cameras/mics
- cap record start --screen <id> --json # start in background -> {recordingId, pid, path}
+ cap record start --screen <id> --json --detach # start in background -> {recordingId, pid, path}
cap record stop --id <recordingId> --json # finalize the .cap recording
cap project validate <path.cap> --json # confirm the recording is complete
cap export <path.cap> --output out.mp4 --json
diff --git a/apps/cli/src/record.rs b/apps/cli/src/record.rs
index 5741b99fb..a410e41b0 100644
--- a/apps/cli/src/record.rs
+++ b/apps/cli/src/record.rs
@@ -55,11 +55,11 @@ pub struct RecordParams {
impl RecordParams {
fn validate(&self) -> Result<(), String> {
- if self
- .duration
- .is_some_and(|duration| !duration.is_finite() || duration <= 0.0)
- {
- return Err("Duration must be greater than 0".to_string());
+ if self.duration.is_some_and(|duration| {
+ // `> u64::MAX` would panic in `Duration::from_secs_f64` (used by `wait_for_stop`).
+ !duration.is_finite() || duration <= 0.0 || duration > u64::MAX as f64
+ }) {
+ return Err("Duration must be a positive, finite number of seconds".to_string());
}
if self.fps == Some(0) {
return Err("--fps must be greater than 0".to_string());