ibigio / shell-ai

A delightfully minimal, yet remarkably powerful AI Shell Assistant.
GNU General Public License v3.0
266 stars 25 forks source link

Feature Request - Read contents of file #17

Open bishopandco opened 1 year ago

bishopandco commented 1 year ago

It would be very helpful to pipe the contents of a file into shell-ai for operations.

ibigio commented 1 year ago

Interesting! Are you imagining more than just enabling input from stdin? (what are a couple example command/uses you'd like to be able to run) gimme straight bash

bishopandco commented 1 year ago

cat some.json | q And then inside shell-ai > "change all the object's names to pascal case in $piped"

ibigio commented 1 year ago

Oh interesting, so slightly different than raw stdin... more to provide context – I really like this! Imagining also being able to pass an optional '-i(nstruction)' flag to make it fully non-interactive.

Out of curiosity, what do you expect to happen/output when you run your example command?

bishopandco commented 1 year ago

Given I have json like this:

{
    "name": "John Doe",
    "age": 30,
    "preferences": {
        "theme": "dark",
        "notifications": true,
        "language": "English",
        "favorite_food": "pizza",
        "favorite_color": "blue",
        "music_genre": "rock",
        "movie_genre": "action",
        "book_genre": "fantasy"
    }
}

and I prompted change all the object's names to pascal case in $piped I would get

{
    "Name": "John Doe",
    "Age": 30,
    "Preferences": {
        "Theme": "dark",
        "Notifications": true,
        "Language": "English",
        "FavoriteFood": "pizza",
        "FavoriteColor": "blue",
        "MusicGenre": "rock",
        "MovieGenre": "action",
        "BookGenre": "fantasy"
    }
}
chadlangston commented 9 months ago

your tool is awesome! i would love this feature too. i wrote my own ai shell of sorts to do things like read directories, files, pdfs, websites, etc. your tool is a lot better in it's simplicity, especially for the insanely well integrated, search-hit-enter-paste feature!

the only downside i see to this feature is the cost. i added price estimates to my tool so i could abort a query and generally understand how much $$ i am racking up with it's use. it's pretty easy to rack up $1+ queries when you start sending a lot of context to the api. but, that was my main interest in building the tool. your tool is an incredibly cool. i can't wait to make it a part of my daily workflow.

thanks!