Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

minimist

Read the options typed after a command.

Dev workflow and configNPM

GitHubWebsite

1. License

“to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software”

MIT allows use in paid and closed products.

github.com/minimistjs/minimist/blob/main/LICENSE

From the package registry and GitHub, checked daily; card checked Nov 11, 2026. Tap a verdict to see its source.How we checkedReport an error

What minimist does

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.

What people build with 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 Idea

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.

minimist popularity

57 / 100
Gid Score, #1247 overall
242M
downloads a week, npm
665
GitHub stars
13
agent projects use it
minimist: downloads per weeknpm, minimist 241,680,962
minimist: GitHub starsminimistjs/minimist 665

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How minimist is used

  • minimist is a dependency in 13 of the 6,258 public GitHub projects set up for AI coding agents that we scanned, too few to describe it from them alone. Our scan also samples projects by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750); counting those, it appears in 53 projects, and what it is used with below comes from all of them.
  • The most used alternative in our scan is Commander (174 projects).
  • Projects that use it most often also use rimraf (43.4%), Husky (41.5%), ESLint (71.7%).

By coding agent

8 projects, 0.2%
6 projects, 0.2%

Often used with

In 43.4% of its projects
In 41.5% of its projects
In 71.7% of its projects
In 34.0% of its projects
In 81.1% of its projects
In 28.3% of its projects
In 26.4% of its projects
In 26.4% of its projects

More about minimist

Funding
  • GitHub Sponsors: https://github.com/ljharb
  • GitHub Sponsors: https://github.com/shadowspawn
  • Tidelift: https://tidelift.com/funding/github/npm/minimist
  • 55 GitHub sponsors

See all

More in Dev workflow and config

Alternatives

minimist This page

MITGid 57242M/wk

Commander

Pick Commander when your tool has several commands and needs a help page and errors for wrong options made for you.

MITGid 82788M/wk

yargs

Pick yargs when you want automatic help and usage text, required options and checks on top of the parsing.

yargs-parser

Pick yargs-parser for the same small job as minimist with more settings, such as number and array options.

Compare minimist with another tool

Get started

Tell your AI assistant

“In this Node.js script use minimist 1.2.8 to read --out (alias -o, string), --dry-run (boolean) and the input files from argv._, list every text option in opts.string so values like 007 stay text, and reject unknown options with opts.unknown.”

  1. Add the package to your Node.js project.

    npm install minimist

    From github.com/minimistjs/minimist/blob/main/README.md

  2. 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' } });
    

    From github.com/minimistjs/minimist/blob/main/README.md

Mistakes to avoid

Reading argv.zip or argv.id without opts.string, for codes like 007 or long IDs
parseArgs(args, { string: ["zip", "id"] })

Numbers are converted by default; our run turned 007 into 7 and 0042 into 42.

if (argv["dry-run"]) with --dry-run false and no opts.boolean
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.

parseArgs(process.argv)
parseArgs(process.argv.slice(2))

The first two entries are the Node program and the script path, which then land in argv._.

Keeping minimist below 1.2.6 in an old lockfile
Update to 1.2.8 (check nested copies with npm ls minimist)

Older versions let crafted options such as --__proto__.x change shared objects.

Expecting minimist to print help or stop on a typo
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.