Add Raycast extension for Cap recording controls#1825
Conversation
| type DeviceOrModelID = | ||
| | { | ||
| device_id: string; | ||
| } | ||
| | { | ||
| model_id: string; | ||
| }; |
There was a problem hiding this comment.
The
DeviceOrModelID field names are snake_case (device_id, model_id) but the Rust enum DeviceOrModelID serializes without any rename_all attribute, defaulting to PascalCase — {"DeviceID": "..."} and {"ModelID": "..."}. The existing TypeScript type in apps/desktop/src/utils/tauri.ts confirms this: { DeviceID: string } | { ModelID: ModelIDType }. As written, set-camera will send a payload that fails serde deserialization on the Rust side and the action will silently be dropped.
| type DeviceOrModelID = | |
| | { | |
| device_id: string; | |
| } | |
| | { | |
| model_id: string; | |
| }; | |
| type DeviceOrModelID = | |
| | { | |
| DeviceID: string; | |
| } | |
| | { | |
| ModelID: string; | |
| }; |
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/raycast/src/cap.ts
Line: 5-11
Comment:
The `DeviceOrModelID` field names are snake_case (`device_id`, `model_id`) but the Rust enum `DeviceOrModelID` serializes without any `rename_all` attribute, defaulting to PascalCase — `{"DeviceID": "..."}` and `{"ModelID": "..."}`. The existing TypeScript type in `apps/desktop/src/utils/tauri.ts` confirms this: `{ DeviceID: string } | { ModelID: ModelIDType }`. As written, `set-camera` will send a payload that fails serde deserialization on the Rust side and the action will silently be dropped.
```suggestion
type DeviceOrModelID =
| {
DeviceID: string;
}
| {
ModelID: string;
};
```
How can I resolve this? If you propose a fix, please make it concise.| export function deviceId(value: string): DeviceOrModelID { | ||
| return { device_id: value }; | ||
| } | ||
|
|
||
| export function modelId(value: string): DeviceOrModelID { | ||
| return { model_id: value }; | ||
| } |
There was a problem hiding this comment.
The
deviceId and modelId helpers produce objects with snake_case keys (device_id, model_id), which won't match the expected PascalCase keys after fixing the type definition above.
| export function deviceId(value: string): DeviceOrModelID { | |
| return { device_id: value }; | |
| } | |
| export function modelId(value: string): DeviceOrModelID { | |
| return { model_id: value }; | |
| } | |
| export function deviceId(value: string): DeviceOrModelID { | |
| return { DeviceID: value }; | |
| } | |
| export function modelId(value: string): DeviceOrModelID { | |
| return { ModelID: value }; | |
| } |
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/raycast/src/cap.ts
Line: 50-56
Comment:
The `deviceId` and `modelId` helpers produce objects with snake_case keys (`device_id`, `model_id`), which won't match the expected PascalCase keys after fixing the type definition above.
```suggestion
export function deviceId(value: string): DeviceOrModelID {
return { DeviceID: value };
}
export function modelId(value: string): DeviceOrModelID {
return { ModelID: value };
}
```
How can I resolve this? If you propose a fix, please make it concise.|
Review the following changes in direct dependencies. Learn more about Socket for GitHub. |
|
Updated the PR to address the review comments: fixed DeviceOrModelID serialization, renamed the Raycast publish script, and added confirmation for sensitive deep-link actions. |
|
/claim #1540 |
This PR adds Raycast support for controlling Cap via the existing cap://action deep link flow.
Changes:
Extends desktop deep link actions for:
starting a recording with saved settings
opening display/window/area recording pickers
pausing, resuming, toggling pause, and stopping recordings
setting or clearing microphone input
setting or clearing camera input
Adds a standalone Raycast extension under extensions/raycast.
Adds Raycast commands for Studio/Instant recording, target pickers, pause/resume/stop, and microphone/camera switching.
Validation:
pnpm dlx @biomejs/biome@2.2.0 check --write extensions/raycast/package.json extensions/raycast/tsconfig.json extensions/raycast/README.md extensions/raycast/src/.ts extensions/raycast/src/.tsx
pnpm --dir extensions/raycast exec tsc --noEmit
pnpm --dir extensions/raycast run build
Not run:
Rust formatting/checks, because this local machine does not have cargo, rustc, or rustfmt installed.
Greptile Summary
This PR adds a Raycast extension for controlling Cap recordings via
cap://actiondeep links, and extends the desktop backend with new deep link actions (pause, resume, toggle-pause, set-mic, set-camera, open-picker, start-with-settings).deeplink_actions.rsare clean and consistent with existing patterns.cap.tsserializesDeviceOrModelIDwith snake_case keys (device_id,model_id) that don't match the PascalCase keys (DeviceID,ModelID) the Rust enum serializes to, causing the set-camera command to silently fail on the backend.Confidence Score: 3/5
Safe to merge for most commands, but the set-camera command will not work as written.
The camera ID serialization in cap.ts uses the wrong key casing, so any attempt to set a camera from Raycast will send a payload that the Rust serde deserializer rejects and silently drops. All other commands are unaffected.
extensions/raycast/src/cap.ts — the DeviceOrModelID type and its two helper functions need the key names corrected before the set-camera command will work.
Important Files Changed
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "feat: add Raycast recording controls" | Re-trigger Greptile