NHacker Next
login
▲Show HN: Crust – A CLI framework for TypeScript and Bungithub.com
52 points by jellyotsiro 17 hours ago | 20 comments
Loading comments...
camkego 3 hours ago [-]
This looks useful. But, it's interesting how the backend-world and front-end world keep diverging. I must admit, I had no idea what this was from the title. "CLI framework"? But in backend-land, these would typically be called "argument parsers" or "command line argument parsers". But maybe I am missing some of the functionality.
chenxin-yan 13 minutes ago [-]
Hi, I called it "CLI framework" because it is more of a ecosystem of modules that contains everything you need to build a CLI, argument parsing is just part of it. The @crustjs/core module is the argument parser, and there are more modules such as @crustjs/skills that would derive agent skills from your command definition, @crustjs/store that state persistent and so on
embedding-shape 2 hours ago [-]
Both in the frontend and the backend, I've usually used "If it calls your code, it's a framework, if you call its code, it's a library", and would seem to fit here too. An argument parser you'd call from your main method, then do stuff with what it returns. In Crust, it seems you instead setup the command + what will happen when it's called, then let the framework call your code.
codybontecou 38 minutes ago [-]
That’s… actually a great definition. I’m going to try to retain that.
jellyotsiro 3 hours ago [-]
good point.

we’re using “framework” intentionally because it goes beyond argument parsing. crust handles parsing, but also:

type inference across args + flags end to end compile-time validation (so mistakes fail before runtime) plugin system with lifecycle hooks (help, version, autocomplete, etc.) composable modules (prompts, styling, validation, build tooling) auto-generates agent skills and modules from the CLI definitions

so it sits a layer above a traditional arg parser like yargs or commander, closer to something like oclif, but much lighter and bun-native.

bennettpompi1 4 hours ago [-]
this is cool! i'd recommend fleshing out the README. Clicked on the link before the discussion and was a tad confused.
jellyotsiro 4 hours ago [-]
will fix in the next hour!
landl0rd 4 hours ago [-]
Is there an examples section? Would be helpful to see a demo
jellyotsiro 4 hours ago [-]
one of the examples would be trynia.ai (search and index api for ai agents)

here is github: github.com/nozomio-labs/nia-cli

rgbrgb 3 hours ago [-]
nice, congrats on launch. To get an idea... what's the size of a standalone hello world cli binary?
jellyotsiro 3 hours ago [-]
tens of KBs (v small)
rgbrgb 2 hours ago [-]
Isn't a standalone Bun binary like 50MB because it has to bundle the runtime? How could this get smaller?
nullstyle 1 hours ago [-]
I’ve been using the jsr:@cliffy/* packages from deno to solve the same problem.
matt_kantor 4 hours ago [-]
> Versions before 1.0 do not strictly follow semantic versioning.

Sorry for being nitpicky, but yes they do. Semantic versioning[0] allows arbitrary changes while the major version is 0:

> Major version zero (0.y.z) is for initial development. Anything MAY change at any time. The public API SHOULD NOT be considered stable.

[0]: https://semver.org/

jellyotsiro 4 hours ago [-]
thanks for the catch, what we meant is that we’re not committing to strict stability guarantees yet, so APIs may still change as we iterate toward 1.0.
matt_kantor 4 hours ago [-]
I understand, but that's already implied by a 0.y.z version number.
olivia-banks 38 minutes ago [-]
I will say that this doesn't seem to be how semver is used in the wild, which I would argue is more important. I personally didn't know about this rule. Tons of Rust projects follow semver don't follow it either, and just stay on 0.x.y forever.
leontloveless 2 hours ago [-]
[dead]
dnlzro 4 hours ago [-]
Psst, the GitHub link in your post is broken (it should be https://github.com/chenxin-yan/crust).
dang 2 hours ago [-]
Fixed above. Thanks for the heads-up!
jellyotsiro 4 hours ago [-]
thanks for flagging! the post itself works, just the link at the bottom
4 hours ago [-]