News for hackers. Stuff that matters.
Re:Some Terminal Frustrations by regnull on Sunday February 09, 2025 @06:45PM (#42995345)
I did a similar thing, where you describe what you want to achieve and it gives you the command and (optionally) executes it for you:

https://github.com/regnull/how.sh

Re:Some Terminal Frustrations by kristopolous on Sunday February 09, 2025 @07:05PM (#42995471)
I see you did some prompt engineering: https://github.com/regnull/how.sh/blob/main/how.sh

I think the real sweet-spot flow is to take this and use bindkey to do inline replacement. Let me fork it and see what I can do.

Re:Some Terminal Frustrations by ddworken on Sunday February 09, 2025 @07:14PM (#42995527)
I actually made a CLI tool (https://github.com/ddworken/hishtory) that automatically binds to Control+R to support both history searching and AI queries (by prefixing queries with `?`).

Here's the prompt engineering I did: https://github.com/ddworken/hishtory/blob/master/shared/ai/a...

Re:Some Terminal Frustrations by kristopolous on Sunday February 09, 2025 @08:00PM (#42995825)
Ah this is a far more significant effort. I'm glad to see that there's so much consensus that default shell history is broken (I used to use logrotate because it would always truncate regardless of how many ways I told it to not ever, under no conditions, ever, do that).

Nice to see there's so many options these days. Someone else mentioned "https://atuin.sh/" in this thread - which is also new to me. Keeping up with things is seemingly impossible

Re:Some Terminal Frustrations by porridgeraisin on Monday February 10, 2025 @02:16AM (#42997701)
Here's how I think I make sure it doesn't truncate:

  shopt -s histappend
  shopt -s cmdhist
  export HISTCONTROL=ignoreboth
  export HISTFILESIZE=-1
  export HISTFILE=~/.bash_eternal_history
  export HISTSIZE=-1
  export HISTTIMEFORMAT="%d/%m/%y %T "
  export HISTIGNORE="history:ls:l:ll:pwd:exit:clear"
It's almost a megabyte now... By when did it start to truncate for you?
Re:Some Terminal Frustrations by kristopolous on Monday February 10, 2025 @05:08AM (#42998761)
somewhere around a few thousand lines. I want it to support tens of millions. I have a fast enough computer, storage is effectively free. I've tried all those things - everything short of doing a bunch of bpf filters and setting breakpoints on the binary myself.

honestly, with these modern systems this shouldn't be a problem any more. I look forward to it.

Re:Some Terminal Frustrations by porridgeraisin on Monday February 10, 2025 @05:26AM (#42998843)
Yeah i have lots. Try my solution might work for you also.
Re:Some Terminal Frustrations by regnull on Sunday February 09, 2025 @07:10PM (#42995497)
Yeah I tweaked the prompt to make it work reasonably well. There is also an experimental mode where it can reason and correct the command if it fails. Feel free to sent a PR!
Re:Some Terminal Frustrations by kristopolous on Sunday February 09, 2025 @07:48PM (#42995756)
Alright, done.

It's a re-invention really.

Essentially you do (assuming zsh)

    $ source how.sh
Then you type your thing at the shell

    $ add a user bob using modern homectl methods  
Then you (in the default, CTRL+X+H) and it does this

    $ add a user bob using modern homectl methods ... (name of your default model)
    ... a few seconds pass ...
    $ sudo homectl create-user bob
Then you can choose to press enter and run it.

https://github.com/kristopolous/how.sh

This is a much more one-and-done approach but 99% of the time I just forget invocation syntax - I'm not actually exploring things deeply.

If you want a "proper" pr, it'd really be a rewrite with two "frontends" - your conversational edit flow and my keystroke invoke.

Honestly they're probably different things.

Re:Some Terminal Frustrations by regnull on Sunday February 09, 2025 @09:30PM (#42996307)
Interesting approach, thanks for sharing!