Not Her Job

Alice in Userland

Story

Alice looks at the top of main.ts and does not like it. Counting the words she typed, hunting for --needs, checking that a filter is a real filter, writing the help text by hand: it is a page of code about the shape of a command line, and none of it is about todos. Other people solved this years ago. So she installs Commander, and for the first time her project has a package.json and a src folder. The commands are now a list of small descriptions, and the help text writes itself.

It works so well that she wants to give it away. But that is where it gets awkward: her friends would have to install Bun first, and most of them will not. Then she finds bun build --compile. It puts her code and the whole runtime into one file that needs nothing else. She sends that file, they run it. No install, no explaining.

Making one of those files for every kind of computer, every time, is exactly the boring work she is bad at remembering. So she writes it down once, in a file GitHub reads. She lists the machines she cares about, Linux, macOS and Windows, and the same short recipe runs once for each of them, on its own, at the same time. Every push to main leaves five finished binaries waiting for her to pick up. She does nothing, and they are simply there.

Alice's Notebook

  • Give every command its own function instead of writing its body inside the switch block.
  • Keep the code that reads the terminal apart from the code that knows what a todo is.
  • Handle different concerns in different parts of the program (Single Responsibility Principle).
  • Use a library for the work that is not your program’s real job.

Choose a file from the tree.