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

Install script, --repl issues on Windows #8

Open
pseudosavant opened this issue Jul 24, 2023 · 5 comments
Open

Install script, --repl issues on Windows #8

pseudosavant opened this issue Jul 24, 2023 · 5 comments

Comments

@pseudosavant
Copy link

Deno.run has been deprecated and replaced with Deno.command. See https://deno.land/[email protected]?s=Deno.Command

I did try fixing it in a fork, but when I checked the current code out it would give me this error message even before I changed any code:

(No message passed)

{
  "error": {
    "message": "[] is too short - 'messages'",
    "type": "invalid_request_error",
    "param": null,
    "code": null
  }
}

Failed to parse message TypeError: Cannot read properties of undefined (reading '0')
    at Object.next (file:///C:/Users/paul/Downloads/shellgpt/ShellGPT/lib/ai.ts:150:31)
    at eventLoopTick (ext:core/01_core.js:183:11)
    at async file:///C:/Users/paul/Downloads/shellgpt/ShellGPT/mod.ts:537:34
@pseudosavant
Copy link
Author

I did notice that the getExecPrefix() tests for Powershell and cmd.exe will always be false as SHELL is not set in the environment for cmd.exe or Powershell. You can check for cmd.exe by checking Deno.env.get('comSpec');

@mattvr
Copy link
Owner

mattvr commented Jul 25, 2023

Ah sorry, @pseudosavant, I have never tested on Windows.

A few clarifying questions:

  • Is this a new issue on the most recent version – it was working on Windows before?

  • I was under the impression Deno.run still is available until Deno 2.0. Can you share the error message related to this that led you to forking?

the current code out it would give me this error message even before I changed any code

  • This error is typically shown if you run gpt without any arguments. Did you try running something like gpt hello world to make sure it's working?

@pseudosavant
Copy link
Author

  1. Installing on Windows always seemed to error on the last step but was easily overcome with by just running the command it showed: deno install -frA -n gpt https://deno.land/x/shellgpt/mod.ts. Everything worked fine once installed that way. I assumed it probably hadn't been tested on Windows much.

  2. It seemed that 0.33 worked fine initially when I upgraded to it. But once I removed it and tried to install from local (to try making it work with Deno.command but at some point it started throwing the errors below. I typically use it with --repl and that doesn't work at all. These screenshots show it being installed and then invoked a few ways:

image
image

  1. I had assumed from the error message I was seeing around the Deno.run invocation that it was related to the deprecation. I didn't see where it is still going to be available until 2.0.

@mattvr
Copy link
Owner

mattvr commented Jul 26, 2023

Ah okay. Very sorry for breaking things. @pseudosavant

It looks like the issue is Deno.stdin.setRaw does not support Windows. This is used to support newline pasting. But since that's not available, I think unfortunately this functionality can't easily work for Windows.

Any reason not to use cygwin, ConEmu, git bash, WSL, etc. for terminal instead of cmd.exe? I think everything should work fine with those.

You can also install an earlier working version with deno run -rA https://deno.land/x/[email protected]/install.ts until I get around to fixing it.

@mattvr mattvr changed the title Install script fails: Deno.run deprecated Install script, --repl issues on Windows Jul 26, 2023
@pseudosavant
Copy link
Author

pseudosavant commented Jul 27, 2023

I will use the previous version when in cmd.exe until there is a fix. It looks like Deno may be working in this area (setRaw + Windows): https://github.com/denoland/deno/blob/806137bb96c6f7e4b359a6e979c4e22d3a04a55c/Releases.md?plain=1#L533.

It would seem like that method only working on Linux and Mac OS would mean it should throw an error on Windows. At least then you could fall back to the previous prompt() behavior.

cmd.exe is just always there, and starts the fastest. It depends what I want to do. I have ShellGPT installed in Windows/cmd and WSL/bash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants