Closed steve8708 closed 1 year ago
I am interested in trying to contribute Windows PowerShell support.
How would you specify it in the prompt? Could you provide a first hint/starting point to integrate this feature?
I made an attempt on this issue but may need some testers and review on the code (is it too simplistic?)
tbh this is exactly what I was anticipating was needed. if we find it is flakey at all, I've has some success with being more dramatic in the prompt. like adding
IMPORTANT: be sure the shell script works with ${shellType}.
Just released v0.0.13 with this update!
this seems to add powershell
to every command, basically executing it in the context of a new powershell?
E.g. I do $ ai get all pdfs in this directory
which then returns:
powershell
Get-ChildItem -Filter "*.pdf"
which will run this command in my user directory, not the current dir and also requires Set-ExecutionPolicy RemoteSigned
edit: this actually happens to me on ubuntu too, except that it uses shell
, Shell
, Bash
, bash
, which not all are real commands.
is this just like syntax highlighting or something like that?
Like the way it's formatted with the space in front just seems weird to me?
So I solved this by adding an example: https://github.com/BuilderIO/ai-shell/blame/28e19f0530d3a609c98a751ba4abd2ea7289d343/src/helpers/completion.ts#L269
Only reply with the single line command surrounded by three backticks. It must be able to be directly run in the target shell. Do not include any other text.
Example: \`\`\`curl -s ifconfig.me\`\`\`
Make sure the command runs on ${getOperationSystemDetails()} operating system.
but i haven't tested this much
Edit: it works poorly on windows, probably easier to just filter it out?
Edit: Edit: Using something different to backticks, e.g. ### seems to work better for me. maybe doesn't remind it quite as much of markdown code blocks
Right now this assumes you use bash on mac or Linux. Would be great to support windows too, eg by specifying that in the prompt we generate when detected