-
Notifications
You must be signed in to change notification settings - Fork 924
Add script to open Claude and submit prompt #954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @nimobeeren, thanks for you first contribution to our repository,
I've made some small comments on your PR, give a check and re-request a review when you finish to address them.
commands/apps/claude/claude.js
Outdated
#!/usr/bin/env node | ||
|
||
// Dependency: This script requires `chrome-cli` installed: https://github.com/prasmussen/chrome-cli | ||
// Install via homebrew: `brew install chrome-cli` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be better if you note here that node
is another requirement, since node
isn't something pre-installed on macOS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
execSync("which chrome-cli"); | ||
} catch { | ||
console.error( | ||
"chrome-cli is required to run this script (https://github.com/prasmussen/chrome-cli)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means your Script Command will only work on Chrome, maybe you should open the usage of your Script Command to users of other browsers, even though, many of them uses Chromium as engine, sounds to me that chrome-cli
will work only for Chrome.
Is something that important to be able to search for an open Claude tab in the browser to reuse it with a new prompt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chrome-cli
indeed works with other Chromium-based browsers through aliases such as brave-cli
(see the chrome-cli
readme). However, I'm not sure how to detect which browser the user would prefer. The most straight-forward approach I see is letting the user modify this script if they want to use another browser.
I could add a variable at the top of the script to make it easier to change the chrome-cli
executable. What do you think is best?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also if you're asking whether the chrome-cli
dependency is necessary at all, the main reason I need it is to be able to run my JavaScript in the browser. Though I just found out that it might be possible to do this with AppleScript too, so that could eliminate the need for this dependency. I'm not able to rewrite the script in AppleScript at the moment though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could add a variable at the top of the script to make it easier to change the
chrome-cli
executable. What do you think is best?
Maybe in this case, you could make the extension a template (just adding .template
in the file name and tell the user to uncomment the line related to its browser: brave, chrome and so on. What do you think?
Co-authored-by: Thiago Holanda <[email protected]>
Co-authored-by: Thiago Holanda <[email protected]>
@unnamedd thanks for your review! I've implemented or replied to your comments. I've also changed behavior to open in a new tab instead of new window, and added a note to tell the user to enable JavaScript from Apple Events. Could you give it another look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @nimobeeren,
thanks for you contribution! Even though there are something we could improve here, it looks good to me!
If you prefer to make improvements later, will be a pleasure to review them later!
@nimobeeren I found this link earlier today (Claude’s API now supports CORS requests, enabling client-side applications). Perhaps it might be interesting to you. |
Thanks, that's good to know! I think this only applies to the API though, rather than the user-facing Claude product. I think there is a place for API-based interactions with LMMs (like Raycast AI), but this script is meant to work with the (free or paid) web interface. |
Description
This script opens Claude in Chrome browser and submits the prompt provided as argument.
Type of change
New script command
Screenshot
claude-alt-space.mp4
Dependencies / Requirements
This script requires the following software to be installed:
node
https://nodejs.orgchrome-cli
https://github.com/prasmussen/chrome-cliInstall via homebrew:
brew install node chrome-cli
This script needs to run JavaScript in your browser, which requires your permission. To do so, open Chrome and find the menu bar item:
View > Developer > Allow JavaScript from Apple Events
Checklist