Skip to content
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

[Raycast Port] It seems the JavaScript example doesn't work #16753

Open
nagauta opened this issue Feb 1, 2025 · 2 comments · May be fixed by #16754
Open

[Raycast Port] It seems the JavaScript example doesn't work #16753

nagauta opened this issue Feb 1, 2025 · 2 comments · May be fixed by #16754
Labels
bug Something isn't working extension: raycast-port Issues related to the raycast-port extension extension Issues related to one of the extensions in the Store

Comments

@nagauta
Copy link
Contributor

nagauta commented Feb 1, 2025

Extension

https://www.raycast.com/litomore/raycast-port

Raycast Version

1.90.0

macOS Version

macOS Sonoma 14.5.0

Description

Hi, this is awesome approch and I loved it.
I found the error when trying the JavaScript example written in the README.

/bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file
node:internal/errors:984
  const err = new Error(message);
              ^

Error: Command failed: open raycast://extensions/litomore/raycast-port/ai-ask?launchType=background&context=%7B%22askPrompt%22%3A%22Hello%2C%20what's%20your%20name%3F%22%2C%22askOptions%22%3A%7B%22creativity%22%3A%22high%22%2C%22model%22%3A%22openai-gpt-4o%22%7D%2C%22callbackOpen%22%3A%5B%22https%3A%2F%2Fwww.raycast.com%2F%3Fanswer%3DRAYCAST_PORT_AI_ANSWER%22%2C%22com.google.Chrome%22%5D%2C%22callbackExec%22%3A%5B%22echo%20%5C%22%24RAYCAST_PORT_AI_ANSWER%5C%22%20%3E%20~%2Fanswer.txt%22%2C%7B%22shell%22%3Atrue%7D%5D%2C%22callbackLaunchOptions%22%3A%7B%22name%22%3A%22target-command-name%22%2C%22type%22%3A%22userInitated%22%2C%22extensionName%22%3A%22target-extension-name%22%2C%22ownerOrAuthorName%22%3A%22target-extension-author-name%22%2C%22context%22%3A%7B%22foo%22%3A%22foo%22%2C%22bar%22%3A%22bar%22%7D%7D%7D
/bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file

https://github.com/raycast/extensions/blob/06087ff404fb172966ab5f1012e068df4be3c38f/extensions/raycast-port/README.md?plain=1#L91C1-L91C109

it looks escaping issue.
and it did work when i chande code like below

const context = encodeURIComponent(JSON.stringify(launchContext));
const url = `raycast://extensions/litomore/raycast-port/ai-ask?launchType=background&context=${context}`;
execSync('open ' + JSON.stringify(url));

Steps To Reproduce

  1. copy example and pbpaste > index.mjs in the terminal
  2. node index.mjs

Current Behaviour

failed to execute to open URL with answer from Raycast AI

Expected Behaviour

Success in executing the command to open the URL with the answer from Raycast AI.

@nagauta nagauta added bug Something isn't working extension Issues related to one of the extensions in the Store labels Feb 1, 2025
@raycastbot raycastbot added the extension: raycast-port Issues related to the raycast-port extension label Feb 1, 2025
@raycastbot
Copy link
Collaborator

raycastbot commented Feb 1, 2025

Thank you for opening this issue!

🔔 @LitoMore you might want to have a look.

💡 Author and Contributors commands

The author and contributors of litomore/raycast-port can trigger bot actions by commenting:

  • @raycastbot close this issue Closes the issue.
  • @raycastbot close as not planned Closes the issue as not planned.
  • @raycastbot rename this issue to "Awesome new title" Renames the issue.
  • @raycastbot reopen this issue Reopens the issue.
  • @raycastbot assign me Assigns yourself to the issue.
  • @raycastbot good first issue Adds the "Good first issue" label to the issue.
  • @raycastbot keep this issue open Make sure the issue won't go stale and will be kept open by the bot.

@LitoMore
Copy link
Contributor

LitoMore commented Feb 1, 2025

@nagauta Thanks for reporting. I forgot to add "" to the argument:

execSync(
-	`open raycast://extensions/litomore/raycast-port/ai-asklaunchType=background&context=${context}`
+	`open "raycast://extensions/litomore/raycast-port/ai-asklaunchType=background&context=${context}"`
);

I will create a PR to fix the example code.

@LitoMore LitoMore linked a pull request Feb 1, 2025 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working extension: raycast-port Issues related to the raycast-port extension extension Issues related to one of the extensions in the Store
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants