{"repo":"millionco/cli-to-js","free":true,"listed":false,"github":"https://github.com/millionco/cli-to-js","clone":"git clone https://github.com/millionco/cli-to-js.git","description":"Turn any CLI into a JavaScript API","language":"TypeScript","stars":406,"topics":["agent","api","cli","node"],"license":"MIT","category":"cli-tools","readme_excerpt":"cli-to-js Warning: This project is very experimental. APIs may change without notice. Turn any CLI into a JavaScript API, automatically. Give it a binary name, it reads --help , and hands you back a fully typed object where subcommands are methods, flags are options, and everything just works. Why this matters for agents. Agents need to call CLI tools, but they work best with structured APIs, not raw shell strings. cli-to-js lets an agent introspect any binary on the system, get a typed interface, and call it safely. $validate catches hallucinated flag names before spawning a process and returns did-you-mean suggestions the agent can self-correct from in a single retry. $spawn returns a standard async iterator, so streaming and piping is just a for await loop. Install Quick start convertCliToJs runs --help on the binary, parses the output into a schema, and returns a Proxy-based API where every subcommand is a method and every flag is an option. Here's how JS option keys map to CLI flags: JS option CLI output ------------------------- ------------------------- { verbose: true } --verbose { verbose: false } (omitted) { output: \"file.txt\" } --output file.txt { dryRun: true } --dry-run { v: true } -v { include: [\"a\", \"b\"] } --include a --include b { : [\"file.txt\"] } file.txt TypeScript The API is fully typed out of the box. Every subcommand returns Promise , and $schema , $parse , $spawn are all properly typed. No codegen needed. For per-subcommand option types, pass a generic: ","default_branch":null,"files":null,"tree":[],"storefront":"/r/millionco","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/millionco/cli-to-js/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}