0xacx / chatGPT-shell-cli

Simple shell script to use OpenAI's ChatGPT and DALL-E from the terminal. No Python or JS required.
https://gptshell.cc
MIT License
1.05k stars 150 forks source link

Add interactive command execution feature? #38

Closed wjianbo closed 1 year ago

wjianbo commented 1 year ago

Would you consider to add an interactive command execution feature.

This feature should allow users to input a command prompt, and then receive a suggestion for a command to execute based on their input. The application should then ask the user whether they would like to execute the suggested command.

I tried something like this:

Enter a prompt:
show current folder contents

chatgpt  Execute 'ls'? (Yes/No, Enter=Yes)
chatgpt.sh  install.sh  LICENSE  README.md  test

This feature will make the application more intuitive and user-friendly, and will help users who are not familiar with command-line interfaces to use the application more easily.

0xacx commented 1 year ago

Yes that has been on my mind for quite a while, I have already started working on it https://github.com/0xacx/chatGPT-shell-cli/pull/40 and hope I will have time to finish it soon.

rxaviers commented 1 year ago

If this is done, please do not enable it by default (but consider enabling only if a certain argument is passed). I am afraid of security implications. I don't want to delete my files by mistake for example. Thanks

0xacx commented 1 year ago

@wjianbo I just merged this functionality in https://github.com/0xacx/chatGPT-shell-cli/pull/40 👍

@rxaviers I agree, and that's why I included a confirmation and warning before executing a command. In practice during testing I found that it is hard to get chatgpt to return a malicious command that is ready to run. Meaning that for simple commands like rm -rf, chatgpt has been moderated and responds with "I can't give commands that may harm systems". For more complex commands, chatgpt usually feels the need to explain what is going on, so just running the output directly doesn't work either as it is the command mixed in text. If it starts to become really dangerous I am open to only enable it with a certain flag, but for now as my initial testing showed me, it's not really a big worry as only simple commands are ready to run.

Since this functionality is added I am closing this issue ✌️ If you have any questions/concerns please lmk.