feat(desktop): extend deeplinks + add Raycast extension scaffold#1633
Open
sungdark wants to merge 11 commits intoCapSoftware:mainfrom
Open
feat(desktop): extend deeplinks + add Raycast extension scaffold#1633sungdark wants to merge 11 commits intoCapSoftware:mainfrom
sungdark wants to merge 11 commits intoCapSoftware:mainfrom
Conversation
| } | ||
|
|
||
| export async function fireSimpleAction(action: string) { | ||
| await dispatchAction({ type: action }); |
There was a problem hiding this comment.
DeepLinkAction uses Serde's default external tagging, so unit variants need to be JSON strings (e.g. "pause_recording"), not { type: "pause_recording" }.
Suggested change
| await dispatchAction({ type: action }); | |
| await dispatchAction(action); |
Comment on lines
+38
to
+42
| async function onSubmit(values: Values) { | ||
| const captureMode = | ||
| values.captureType === "screen" | ||
| ? { screen: values.captureName } | ||
| : { window: values.captureName }; |
There was a problem hiding this comment.
If captureName is empty, this will dispatch an action that the desktop app can't resolve (and the user gets a pretty opaque failure). Consider validating before dispatch.
Suggested change
| async function onSubmit(values: Values) { | |
| const captureMode = | |
| values.captureType === "screen" | |
| ? { screen: values.captureName } | |
| : { window: values.captureName }; | |
| async function onSubmit(values: Values) { | |
| const captureName = values.captureName.trim(); | |
| if (!captureName) { | |
| await showHUD("Cap: capture name required"); | |
| return; | |
| } | |
| const captureMode = | |
| values.captureType === "screen" ? { screen: captureName } : { window: captureName }; |
Comment on lines
+13
to
+15
| export async function fireSimpleAction(action: string) { | ||
| await dispatchAction({ type: action }); | ||
| await showHUD(`Cap: ${action}`); |
Contributor
There was a problem hiding this comment.
Serde deserializes unit enum variants from plain JSON strings, not objects. { type: action } should be just action
Suggested change
| export async function fireSimpleAction(action: string) { | |
| await dispatchAction({ type: action }); | |
| await showHUD(`Cap: ${action}`); | |
| export async function fireSimpleAction(action: string) { | |
| await dispatchAction(action); | |
| await showHUD(`Cap: ${action}`); | |
| } |
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/raycast/src/lib/cap.ts
Line: 13-15
Comment:
Serde deserializes unit enum variants from plain JSON strings, not objects. `{ type: action }` should be just `action`
```suggestion
export async function fireSimpleAction(action: string) {
await dispatchAction(action);
await showHUD(`Cap: ${action}`);
}
```
How can I resolve this? If you propose a fix, please make it concise.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Deeplink actions added
Closes #1540
Greptile Summary
Extended desktop deeplink actions to support pause/resume/toggle recording and device switching (microphone/camera), then added a Raycast extension scaffold to control Cap via these deeplinks.
DeepLinkActionvariants in Rust:PauseRecording,ResumeRecording,TogglePauseRecording,SwitchMicrophone,SwitchCameraapps/raycastwith 7 commands that dispatch Cap deeplinksfireSimpleActionincap.tsincorrectly wraps unit variants in{ type: action }instead of passing the plain string, which will cause deserialization failures for pause/resume/stop/toggle commandsConfidence Score: 2/5
Important Files Changed
Sequence Diagram
sequenceDiagram participant User participant Raycast participant cap.ts participant Desktop App participant Rust Handler User->>Raycast: Trigger command Raycast->>cap.ts: fireSimpleAction("pause_recording") cap.ts->>cap.ts: JSON.stringify({ type: "pause_recording" }) cap.ts->>Desktop App: cap-desktop://action?value=... Desktop App->>Rust Handler: Parse deeplink Rust Handler->>Rust Handler: serde_json::from_str<DeepLinkAction> Note over Rust Handler: FAILS - expects "pause_recording"<br/>but receives {"type":"pause_recording"} Rust Handler-->>User: Error: Failed to parse deeplink Note over cap.ts,Rust Handler: FIX: Pass action string directly,<br/>not wrapped in objectLast reviewed commit: a595e0e
(2/5) Greptile learns from your feedback when you react with thumbs up/down!