TheR1D / shell_gpt

A command-line productivity tool powered by AI large language models like GPT-4, will help you accomplish your tasks faster and more efficiently.
MIT License
8.81k stars 693 forks source link

Read bash command history output and feed it as context for the next prompt #527

Open Jasperhino opened 3 months ago

Jasperhino commented 3 months ago

Is there a convenient option to read the bash history and provide a solution for any problem i might run into?

e.g. i execute

poetry install       
Installing dependencies from lock file

Package operations: 66 installs, 0 updates, 0 removals

  - Installing pycddlib (2.1.7): Failed

  ChefBuildError

  Backend subprocess exited when trying to invoke build_wheel

  running bdist_wheel
  running build
  running build_ext
  Compiling cdd.pyx because it changed.
  [1/1] Cythonizing cdd.pyx
  building 'cdd' extension
  creating build
  creating build/temp.macosx-14.0-arm64-cpython-312
  creating build/temp.macosx-14.0-arm64-cpython-312/cddlib
  creating build/temp.macosx-14.0-arm64-cpython-312/cddlib/lib-src
  clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -DGMPRATIONAL -Icddlib/lib-src -I/private/var/folders/db/8bjxm83551s6k9y4081jd5sh0000gn/T/tmp56717o84/.venv/include -I/opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12 -c cdd.c -o build/temp.macosx-14.0-arm64-cpython-312/cdd.o
  In file included from cdd.c:1244:
  In file included from cddlib/lib-src/cdd.h:17:
  cddlib/lib-src/cddmp.h:30:11: fatal error: 'gmp.h' file not found
   #include "gmp.h"
            ^~~~~~~
  1 error generated.
  error: command '/usr/bin/clang' failed with exit code 1

  at /opt/homebrew/Cellar/poetry/1.8.2/libexec/lib/python3.12/site-packages/poetry/installation/chef.py:164 in _prepare
      160│ 
      161│                 error = ChefBuildError("\n\n".join(message_parts))
      162│ 
      163│             if error is not None:
    → 164│                 raise error from None
      165│ 
      166│             return path
      167│ 
      168│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with pycddlib (2.1.7) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "pycddlib (==2.1.7)"'.

I now would love to do somthing like sgpt fixto prompt the llm to fix my problem and suggest a command to run next.

Is there something like this already?

Jasperhino commented 3 months ago

Could be a duplicate of #329 although i mean a slightly different usecase.