shell_gpt icon indicating copy to clipboard operation
shell_gpt copied to clipboard

Is there an elegant way to provide feedback and rechat on the wrong commands and results?

Open demouo opened this issue 8 months ago • 1 comments

I apologize for my unfamiliarity with this excellent project shell_gpt. An AI provided a command that failed to execute. How can I share the incorrect context in my next conversation?

<logs> ~ sgpt --shell 'check which process using max memo'
ps -eo pid,comm,%mem | sort -nr | head -n 1 [E]xecute, [D]escribe, [A]bort: e zsh:1: command not found: 41219 </logs>

Then I want to tell ai that The command failed with error: zsh:1: command not found: 41219, please retry..

Is there an elegant way to provide feedback and rechat?

I would be very grateful for your reply.

demouo avatar May 05 '25 17:05 demouo

I do think cli-ai chatting with the (last) stdout result of shell will be a great movement to cli-free.

I have two toy ideas:

  1. Save the last command and results in some place, but now run_command() is using the os.system() to run a command, which can not catch the stdout of cli. So I make it change to subprocess.run(), but this will NOT pass the pytest of @patch(os.system). I'm not sure if I can refactor it.
  2. Let user copy the stdout and chat with clipboard, which is not elegant enought.

demouo avatar May 06 '25 04:05 demouo