# minimist — card for AI agents

Lightweight command-line argument parser for Node.js CLI tools.

Category: Dev workflow and config · npm package `minimist` · latest version 1.2.8 (checked 2026-11-01)
Install: `npm install minimist`
License: MIT (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Numbers (AgentGid data)
- Gid Score: 57.2 (#1247 of all tools, 95 of 299 in its category)
- Used in 13 public projects set up for AI coding agents (0.2%)
- Downloads last week: 241,680,962 (as of 2026-11-24), +40.9% over 4 weeks
- GitHub stars: 665 (as of 2026-11-24)
- Last push: 2025-12-30

## Often used with
rimraf 43.4%, Husky 41.5%, ESLint 71.7%, glob 34.0%, TypeScript 81.1%, Axios 28.3%

## Checked alternatives (same job)
- Commander: https://agentgid.com/tools/commander/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/minimist/
- Homepage: https://github.com/minimistjs/minimist
- Repository: https://github.com/minimistjs/minimist


## minimist: read the options typed after a command

minimist is a tiny free JavaScript library for Node.js scripts. It takes the words a person types after a command, like "--width 800 -v photos/", and turns them into named values your script can use. It does not print help pages, does not check for typos and does not ask questions; bigger tools do that.

### Where to use it
- Options for a small project script: A build, backup or import script in your project reads a few switches, such as an output folder or a dry-run flag, with one line of code.
- Keep codes as text, flags as yes or no: Your export script takes a zip code like 007 and a --dry-run switch. You say which options are text and which are on-off, so no value changes kind.
- Short names, defaults and pass-through: A deploy script accepts -e as a short form of --env, fills in a default region, and hands everything after -- to the next program untouched.
- Catch mistyped options: When someone types --widht instead of --width, your script says so instead of quietly ignoring it.
- Read options inside an AI agent's tools: A small helper script that your coding assistant runs, like "fetch-docs --limit 5 topic", reads its options without adding a large package to the project. (idea, not from the official pages)

### How to start
- Add the package to your Node.js project.

```
npm install minimist
```

- Pass it the typed words (without the first two, which are Node and the script path) and read the result.

```
const parseArgs = require('minimist');
const argv = parseArgs(process.argv.slice(2), { string: ['out'], boolean: ['dry-run'], alias: { o: 'out' } });
```


### License
Free to use in personal and paid products under the MIT license. Keep the copyright and permission notice with copies of the code.

### Good to know
- The latest version, 1.2.8, came out on 2023-02-09. The code is small and finished; the project's page still gets small upkeep, and it now lives under the minimistjs group.
- Versions before 1.2.6 had a known security hole where crafted options could change built-in objects. Use 1.2.6 or newer, ideally 1.2.8.
- There is no help text, no list of required options and no error for unknown ones unless you write it yourself.
- Node.js 18.3 and newer has a built-in reader for typed options, util.parseArgs, which also stops on unknown options by default.

Checked 2026-11-11 against: https://github.com/minimistjs/minimist/blob/main/README.md, https://github.com/minimistjs/minimist/blob/main/CHANGELOG.md, https://github.com/minimistjs/minimist/blob/main/LICENSE, https://registry.npmjs.org/minimist/1.2.8, https://registry.npmjs.org/minimist, https://nodejs.org/api/util.html

### Mistakes to avoid
- Don't: Reading argv.zip or argv.id without opts.string, for codes like 007 or long IDs → Do: parseArgs(args, { string: ["zip", "id"] }) (Numbers are converted by default; our run turned 007 into 7 and 0042 into 42.)
- Don't: if (argv["dry-run"]) with --dry-run false and no opts.boolean → Do: parseArgs(args, { boolean: ["dry-run"] }) so --dry-run false gives the value false (Without it our run returned the text "false", which counts as true in an if.)
- Don't: parseArgs(process.argv) → Do: parseArgs(process.argv.slice(2)) (The first two entries are the Node program and the script path, which then land in argv._.)
- Don't: Keeping minimist below 1.2.6 in an old lockfile → Do: Update to 1.2.8 (check nested copies with npm ls minimist) (Older versions let crafted options such as --__proto__.x change shared objects.)
- Don't: Expecting minimist to print help or stop on a typo → Do: Write an opts.unknown function, or use util.parseArgs, Commander or yargs for help and strict checks (Unknown options are simply added to the result unless your unknown function returns false.)

### Questions
- Why did --zip 007 come back as 7? Anything that looks like a number is turned into a number unless you list that option in opts.string.
- How do I turn a switch off? Type --no-name; minimist gives false for name.
- Can I use it with import instead of require? Yes, the README shows both ways.
- Can I use it in a paid product? Yes, it is under the MIT license; keep its notice with copies of the code.

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
