Fig is the well-known IDE-style command completion tool — it collected specs for a huge number of CLI tools and worked across many terminals.
Its open-source repo, withfig/autocomplete — hand-written completion specs by 400 contributors, MIT licensed — was written in TypeScript: full of dynamic-language tricks, with no runtime and no parser.
I redid it in Dart: github.com/littlewrite/autocomplete (pub.dev: autocomplete).
What's different:
Even though it's written in Dart, porting it to other languages is now much easier.
Most of fig autocomplete is just static object definitions of completion semantics — it can be defined entirely as JSON and then unmarshalled. So that's exactly how I refactored it.
The dynamic parts are still implemented in Dart, but dynamic generator specs are a tiny fraction compared to the JSON. For Python, Rust, or Golang folks who want to port it, the work is just reimplementing the dynamic completions.
Since I rewrote it in Dart, I stripped out all the dynamic-language syntax sugar. That kills a whole class of AI hallucination during conversion, and lowers the mental burden of code review for anyone working across languages.
fig/autocomplete was only a definition of completion semantics — no runtime, no shell parser, no subcommand/argument/option expansion. I filled all of that in.
The original project is archived. I want this to be a new beginning — a new home for the spec corpus that every language can build on.
Top comments (0)