ShellGPT
ShellGPT copied to clipboard
Install script, `--repl` issues on Windows
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
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');
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.runstill 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
gptwithout any arguments. Did you try running something likegpt hello worldto make sure it's working?
-
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. -
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.commandbut at some point it started throwing the errors below. I typically use it with--repland that doesn't work at all. These screenshots show it being installed and then invoked a few ways:
- I had assumed from the error message I was seeing around the
Deno.runinvocation that it was related to the deprecation. I didn't see where it is still going to be available until 2.0.
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.
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.