Realiserad / fish-ai

Supercharge your command line with LLMs and get shell scripting assistance in Fish. 💪
MIT License
81 stars 3 forks source link

feat: Terminal History as context #54

Open jkgeyti-cogna opened 5 days ago

jkgeyti-cogna commented 5 days ago

Thanks for a great project. It works great!

Would it be possible to access the terminal history and (more importantly) previous output in the session? I'll often want hints in the context of what I'm doing, or have documentation readily available in the folder I'm working in. Imagine for example doing:

> cat README.md
...
> # build the project <CTRL-P>
Realiserad commented 4 days ago

Would it be possible to access [...] previous output in the session?

As far as I understand, there is no mechanism in fish that plugins like fish-ai can use to capture the output of a previous command. So, while this information is on your screen, there is no way for the plugin to retrieve it.

You can mention files in your comment, and the file contents will be sent to the LLM. For example:

> # build the project as described in README.md<Ctrl-P>

The LLM will then have the build instructions in its context window and can create the appropriate shell command.

You can also put the comment itself in your shell history (just type the comment and press enter) and then search for it with Ctrl + R (highly recommend fzf.fish for this).