logoalt Hacker News

Once: Cache CLI commands

85 points • by baquero • today at 9:43 AM • 37 comments • view on HN

Comments

ShakataGaNai • today at 6:13 PM

OMG. `op read` with agents. Holy shit.

I first clicked this with just a mild curiosity. But as soon as I saw the 1password example. Lightning.

I try to do everything "the right way", no secrets on disk, gitops, the whole shebang. Even for my personal projects. But when working with API keys and agents it can get so frustrating. I refuse to admit to the number of times where I've told the agent "Please write the 1Password creds to .env and use .env instead because I'm tired of clicking approve on my watch 15 times for every test run."

➕ show 1 reply
aktau • today at 11:59 AM

These kinds of tools are very useful. I have my own called memo (which is just a shell script: https://github.com/aktau/dotfiles/blob/master/bin/memo).

It was discussed in https://news.ycombinator.com/item?id=45670052 and others chimed in with their own (like bkt(1) and up(1)).

The main differences I see:

  - memo doesn't need to be built (its a shell script)
  - once keeps output cache in a running daemon. By contrast, memo stores content under /tmp with whatever the best compression available is (it prefers zstd). There's trade-offs in that. More pareto-optimal from the security front may be to have a sort of session key and to compress-then-encrypt files on disk.
➕ show 1 reply
__MatrixMan__ • today at 1:58 PM

I dream of applications that expose sufficient metadata about their outputs such that the OS can know if rerunning is necessary without me needing to specify.

Nixos does this for builds, but I've not seen it generalized to arbitrary processes.

➕ show 2 replies
xuhu • today at 11:54 AM

I wish this worked without prefixing the commands with "once". Especially if I ran a command with verbose output and afterwards decided I wanted to grep something from it. Terminals have the output in their scrollback buffer and maybe it's just a matter of writing an "output" command that lets me run:

    $ cmake ..
    $ output | grep "libssl version"
➕ show 2 replies
deadbunny • today at 11:51 AM

I've always wanted to deal with cache invalidation in my terminal.

➕ show 1 reply
hecomo • today at 3:46 PM

This looks awesome. Thanks for making this.

Been using this, for similar cli output catching. https://github.com/dimo414/bkt

Wondering what you think about the two, and what are the good reasons to use one vs the other? (Maybe: once is more actively developed? bkt hasn't been active for a year).

➕ show 1 reply
giancarlostoro • today at 1:39 PM

> The typical use case: reading secrets from 1Password without approving every single read with your fingerprint.

Uh I dont know about that one chief.

➕ show 1 reply
baquero • today at 9:43 AM

Do you have CLI calls that you want to cache? Here you go!

stingraycharles • today at 11:43 AM

Seems well-designed, but what’s the use case? I’m trying to think of them but my creativity is failing me.

➕ show 3 replies
1vuio0pswjnm7 • today at 4:46 PM

I just use tmux buffers

But I'm not running agents, I have different needs

newadays • today at 2:52 PM

Congratulations. What is Word Error Rate? We have a few use cases for something like that at newcare.app

hackerbluedev • today at 9:04 PM

[flagged]

Rel8ble • today at 6:03 PM

[flagged]

singularityisne • today at 2:03 PM

[flagged]