Skip to content

Instantly share code, notes, and snippets.

@loxal
Created August 30, 2025 22:19
Show Gist options
  • Save loxal/730cd2fb8d5702a25ca3fbb48ad3d165 to your computer and use it in GitHub Desktop.
Save loxal/730cd2fb8d5702a25ca3fbb48ad3d165 to your computer and use it in GitHub Desktop.
Run an AI query in the Comet/Chrome browser from the CLI
# Run from the Nushell terminal: `?? Who are you?`
def --wrapped "??" [...user_prompt_phrase: string] {
let user_prompt = ($user_prompt_phrase | str join " ")
osascript ~/my/cfg/cli_ai_query.applescript $user_prompt
}
on run argv
set userText to "Show me the time!"
try
if (count of argv) > 0 then set userText to (item 1 of argv) as text
end try
tell application "Comet" to activate
tell application "System Events"
keystroke "t" using {command down} -- New Tab
keystroke "l" using {command down} -- focus address bar
-- keystroke "Who are you?"
keystroke userText
keystroke return using {shift down} -- Shift+Return
end tell
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment