Show HN: Shelly: Write Terminal Commands in English
github.com
github.com
Both Shelly [3] and iTerm use OpenAI under the hood. Here are several alternatives [4].
[1] https://github.com/gnachman/iTerm2/commit/7bcc4e0bedb22c4fd9...
[2] https://cixtor.com/blog/iterm2-openai
[3] https://github.com/paletov/shelly/blob/main/src/llm_service....
[4] https://github.com/search?q=terminal+chatgpt&type=repositori...
find ~/Library -name '*.binarycookies' -exec binarycookies {} ; |
grep -E "GitHub|Slack" |
awk '{print $NF "\t" $1}'
Isn't that wrong? I mean, set aside how the search pattern also matches "Slackware", but my reading of the binarycookies command at https://github.com/cixtor/binarycookies/blob/master/cmd/bina... says the output columns are: expires domain path name value "Secure"? "HttpOnly"? comment?
so the awk command will get the cookie value (at $NF for most cookies) and the expires (at $1), when the request asked for the cookie name ($4) and value ($5).The following (assuming no typo) looks like it should actually do the request:
find ~/Library -name '*.binarycookies' -exec binarycookies {} ; |
awk '$4 == "Google" || $4 == "Slack" {print $4 "\t" $5}'
OTOH, I expect the author of the tool to expect best how to parse its output, so perhaps I'm looking at the wrong tool?Fortunately I checked the result before copy pasting what GPT told me as it would have deleted any file older than 7 days on the machine. I know it was “my fault” to begin with as I didn’t explicitly specify “in the current directory” or “in a given directory”. But I can see how making such a (very nice nonetheless) tool part of one’s daily routine could quickly lead to damaging outcomes.
Though I have not used it much over the years, as I havent had to do much personal regex for a long while.
It deleted tens of thousands of active users who had placed orders. I had a backup which was only a couple of hours old, thank the lord.
Lesson learned.
As someone who actually reads manuals instead of just running output from language models, I'm excited for the work I'll get to come in and fix the problems created by folks who just run output from language models.
I think this is already the case with existing software tools and developers. That's how code ships with bugs both known and unknown.
This been the case for as long as I can remember, seems to have more to do with individual developers typical methodology rather than the tools available.
I remember a bunch of issues with early npm versions were resolved by deleting the node_modules directory and running `npm install` again. Sometimes it borked the directory, sometimes it didn't, deleting everything and beginning from the beginning resolved many of those issues.
So, pretty much what we have now with the vast majority of mega-tech companies with zero customer service. Plus all the growth-hack startups playing "monkey see, monkey do."
I can see the benefit for speed, the same way I would use a calculator to multiply 6 4 digit numbers, but not because it's "obscure."
If the command is "obscure" one probably doesn't need it often (e.g. me with any dd command) in which case asking in English might cause unforeseen problems.
See: https://en.m.wikipedia.org/wiki/The_Feeling_of_Power
And for the full story: https://archive.org/details/1958-02_IF/page/n4/mode/1up?view...
The LLM doesn't actually understand the command, it's just "guessing" each 'word' in the response, as the most likely, based on the data it was trained on.
LLM's in general are trained on internet published bodies of text, for obvious reasons.
One of the largest bodies of text that would inform something like this, will be sites like the SuperUser, AskDifferent & Unix stackexchanges, and possibly the litany of gists out there.
I'm curious to see how the results would fare vs the top-ranked answer to the top question matching the input query from each of the three stack exchange sites.
Either way it sounds like a sub-par solution compared to just reading a couple of man pages.
/s
On a serious note: the one thing I think an LLM would be perfectly suited for, I haven't seen anyone make yet: producing real-enough sounding copy text, as a better replacement for Lorem Ipsum (aka Lipsum) text.
The point of Lipsum is that the text is gibberish and thus should be ignored, so the focus is on the important factors: layout, colours, design, functionality.
But in 20 years I've never once seen a non-technical person who could grasp that concept, so it's defeats the whole purpose it's being used. Of course it's also inevitable that some Lipsum will end up in the final product sometimes too, which confuses non-technical people and highlights an obvious failure to technical people.
LLM powered text waffling on about the topic would be perfect. It doesn't matter if it hallucinates shit, it just needs to seem correct at a casual glance and it's already a massive improvement.
Essentially Turbo/Retro/Hyper Encabulator[1], in text.
I'd think this would happen much more often if instead of Lorem Ipsum you switch to something that looks at a passing glance more realistic.
I am fairly new to working with LLMs (have been doing local versions of stable diffusion, basically) -- but interested in kel with Ollama...
I want to run a local one, but a newb Q:
If I run an Ollama and kel on my machine, can I ask about stuff going on ON my machine? I dont need to CLI calc, or ask for populations...
I want to know
>"How much space are all the PDFs on the machine taking up?"
>"Move all the PDFs to /home/PDFs, but organize them based on what they are related to"
>"write me an ffmpeg command to convert directory /pics so all images are 1024x1024"
>"Which config files in this directory have [text]"
That sort of thing.
I want to ask about MY machine's state.
How do?
It opens the command in an editor like when you run "git commit", so you can edit it. Saving executes the final version.
As others noted, "try" could be used to make the commands testable, so I'll look into it this weekend.
gpt=curl -s https://api.openai.com/v1/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer <YOUR_API_KEY>" -d "{\"model\": \"gpt-3.5-turbo\", \"messages\": [{\"role\": \"system\", \"content\": \"Give short single line answer.\"}, {\"role\": \"user\", \"content\": \" $\* \"}]}" --insecure | rg -o "content\":(.\*)" -r $$1
Updated it to use your prompt instead and should give much nicer results now. shelly 'find "class" in files in this directory without the .venv dir'
is interpreted. I'm assuming something like: grep -l -R --exclude-dir .venv class
and possibly with the "--null" option, but I can also see how using "find" suggests the user is thinking of the find command, so wants filenames containing the substring "class" but not in the .venv directory. My first attempt at that is: find . -name '*class*' | grep -Fv '/.venv/'grep -r --exclude-dir=.venv "class" .
I see the documentation now shows the expansion, which is nice.
It's interesting how 'check size of files in this directory but format it with gb/mb, etc' is converted to "du -sh *" while my Mac's "man du" has this:
Show disk usage for all files in the current directory.
Output is in human-readable form:
# du -ah
I point it out because the author of the man page intends for "all files in the current directory" to include files in subdirectories, and for all dot files, while OpenAI GPT version only shows info for non-dot files, and only in the top-level directory. (There will also be an issue if there are too many files for "*" expansion.)OTOH, "'find "class" in files in this directory without the .venv dir'" uses a recursive grep, which means that "in this directory" here is taken to include subdirectories ... which the poser of the question clearly intended as otherwise "without the .venv dir" does not make sense.
Still, one "files in this directory" in one case includes dot files while the other does not, which is a subtle inconsistency.
I’m assuming the commands aren’t automatically executed, as that sounds absurd.
Seeing how much some people trust LLMs, I wouln’t be surprised. We need to come up with an equivalent of Darwin Awards for computer systems.
Currently, the user has to be experienced enough to know if a command is safe to be executed. However, you are right, and I'll look into adding a safety feature that signifies if a command is potentially dangerous.
That is quite dangerous, and I assume that it is actually "on exit" and not "on save", as I assume it is implemented by creating a temp file and opening it with the editor. There are various ways that an editor can crash/abort which would automatically execute the command.
Shelly is a mini tool at the moment that only generates and executes commands for you.