{"id":13432726,"url":"https://github.com/sindresorhus/meow","last_synced_at":"2026-10-18T20:20:08.823Z","repository":{"id":21799018,"uuid":"25121561","full_name":"sindresorhus/meow","owner":"sindresorhus","description":"🐈 CLI app helper","archived":false,"fork":false,"pushed_at":"2026-07-21T18:40:22.000Z","size":845,"stargazers_count":3715,"open_issues_count":3,"forks_count":154,"subscribers_count":20,"default_branch":"main","last_synced_at":"2026-10-11T20:47:55.642Z","etag":null,"topics":["cli","command-line","javascript","kitten","meow","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sindresorhus.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/security.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"claude":null,"gemini":null,"cursor":null,"copilot":null,"dco":null,"cla":null,"disclosure":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","buy_me_a_coffee":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2014-10-12T14:24:36.000Z","updated_at":"2026-10-10T10:07:15.000Z","dependencies_parsed_at":"2026-08-18T13:31:37.421Z","dependency_job_id":null,"html_url":"https://github.com/sindresorhus/meow","commit_stats":{"total_commits":193,"total_committers":45,"mean_commits":4.288888888888889,"dds":"0.43523316062176165","last_synced_commit":"87d1bc394d9a1d73b76a81d4874db4f1190259ef"},"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"purl":"pkg:github/sindresorhus/meow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fmeow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fmeow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fmeow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fmeow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/meow/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fmeow/sbom","scorecard":{"id":826589,"data":{"date":"2025-08-11","repo":{"name":"github.com/sindresorhus/meow","commit":"87d1bc394d9a1d73b76a81d4874db4f1190259ef"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.5,"checks":[{"name":"Code-Review","score":5,"reason":"Found 17/30 approved changesets -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: .github/security.md:1","Info: Found linked content: .github/security.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: .github/security.md:1","Info: Found text in security policy: .github/security.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/main.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/sindresorhus/meow/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/sindresorhus/meow/main.yml/main?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/main.yml:22","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: license:0","Info: FSF or OSI recognized license: MIT License: license:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 17 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T16:44:53.386Z","repository_id":21799018,"created_at":"2025-08-23T16:44:53.386Z","updated_at":"2025-08-23T16:44:53.386Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":343843146,"owners_count":38249808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-10-03T21:59:58.778Z","status":"online","status_checked_at":"2026-10-12T02:00:06.297Z","response_time":96,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","command-line","javascript","kitten","meow","nodejs"],"created_at":"2024-07-31T02:01:15.778Z","updated_at":"2026-10-18T20:20:08.817Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://buymeacoffee.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["JavaScript","Packages","Npm","包","Repository","Repositories","Command-line utilities","cli","目录","Utilities","Helpful","Node.js / JavaScript 🟨","3. 命令行程序"],"sub_categories":["Command-line utilities","命令行工具","Command-line Utilities","Project","Command Line Tools","3.1 开发库","命令行实用工具"],"readme":"# meow\n\n\u003e CLI app helper\n\n![](meow.gif)\n\n*I would recommend reading this [guide](https://clig.dev) on how to make user-friendly command-line tools.*\n\n## Features\n\n- Parses arguments\n- Converts flags to [camelCase](https://github.com/sindresorhus/camelcase)\n- Negates flags when using the `--no-` prefix\n- Outputs version when `--version`\n- Outputs description and supplied help text when `--help`\n- Sets the process title to the binary name defined in package.json\n- No dependencies!\n\n## Install\n\n```sh\nnpm install meow\n```\n\n## Usage\n\n```sh\n./foo-app.js unicorns --rainbow\n```\n\n```js\n#!/usr/bin/env node\nimport meow from 'meow';\nimport foo from './lib/index.js';\n\nconst cli = meow(`\n\tUsage\n\t  $ foo \u003cinput\u003e\n\n\tOptions\n\t  --rainbow, -r  Include a rainbow\n\n\tExamples\n\t  $ foo unicorns --rainbow\n\t  🌈 unicorns 🌈\n`, {\n\timportMeta: import.meta, // This is required\n\tflags: {\n\t\trainbow: {\n\t\t\ttype: 'boolean',\n\t\t\tshortFlag: 'r'\n\t\t}\n\t}\n});\n/*\n{\n\tinput: ['unicorns'],\n\tflags: {rainbow: true},\n\t...\n}\n*/\n\nfoo(cli.input.at(0), cli.flags);\n```\n\n## API\n\n### meow(helpText, options)\n### meow(options)\n\nReturns an `object` with:\n\n- `input` *(Array)* - Non-flag arguments\n- `command` *(string | undefined)* - The selected command when using `commands`\n- `flags` *(Object)* - Flags converted to camelCase excluding aliases\n- `unnormalizedFlags` *(Object)* - Flags converted to camelCase including aliases\n- `pkg` *(Object)* - The `package.json` object\n- `help` *(string)* - The help text used with `--help`\n- `showHelp([exitCode=2])` *(Function)* - Show the help text and exit with `exitCode`\n- `showVersion()` *(Function)* - Show the version text and exit\n\n#### helpText\n\nType: `string`\n\nShortcut for the `help` option.\n\n#### options\n\nType: `object`\n\n##### importMeta\n\n**Required**\\\nType: `object`\n\nPass in [`import.meta`](https://nodejs.org/dist/latest/docs/api/esm.html#esm_import_meta). This is used to find the correct package.json file.\n\n##### input\n\nType: `object | string`\n\nOptions for non-flag input arguments.\n\nThe value is an object with any of:\n\n- `type`: Type of value. (Possible values: `string` `boolean` `number` `array` `string-array` `boolean-array` `number-array`)\n- `isRequired`: Determine if at least one non-flag input argument is required. (Default: false)\n\t- If it's only known at runtime whether the input is required or not, you can pass a `Function` instead of a `boolean`, which based on the given input should decide if the input is required.\n\t- The first argument is the **input** string array, which contains the non-flag arguments.\n\t- The function should return a `boolean`, true if the input is required, otherwise false.\n\nExample:\n\n```js\ninput: 'number'\n```\n\nExample:\n\n```js\ninput: {\n\tisRequired: true\n}\n```\n\n##### commands\n\nType: `string[]`\n\nList of valid commands. Commands must be a single argument without whitespace and must not start with `-`.\n\nWhen set, parsing stops at the first non-flag argument and treats it as the command. The remaining arguments are returned in `input` so they can be passed to a subcommand parser. An unknown command will show help and exit with code 2. Parent flags must appear before the command.\n\nIf no command is given, `cli.command` is `undefined` and meow does not exit — you decide what to do:\n\n```js\nif (!cli.command) {\n\tcli.showHelp(); // or showHelp(0), or a custom message, or a default command\n}\n```\n\nExample:\n\n```js\nimport meow from 'meow';\n\nconst cli = meow({\n\timportMeta: import.meta,\n\tcommands: ['run', 'list'],\n\tflags: {\n\t\tverbose: {\n\t\t\ttype: 'boolean',\n\t\t\tshortFlag: 'v'\n\t\t}\n\t}\n});\n\nif (!cli.command) {\n\tcli.showHelp(0);\n}\n\nif (cli.command === 'run') {\n\tconst runCli = meow({importMeta: import.meta, argv: cli.input});\n}\n```\n\n##### flags\n\nType: `object`\n\nDefine argument flags.\n\nThe key is the flag name in camel-case and the value is an object with any of:\n\n- `type`: Type of value. (Possible values: `string` `boolean` `number`)\n- `choices`: Limit valid values to a predefined set of choices.\n- `default`: Default value when the flag is not specified.\n- `shortFlag`: A short flag alias.\n- `aliases`: Other names for the flag.\n- `isMultiple`: Indicates a flag can be set multiple times. Values are turned into an array. (Default: false)\n\t- Multiple values are provided by specifying the flag multiple times, for example, `$ foo -u rainbow -u cat`. Space- or comma-separated values are [currently *not* supported](https://github.com/sindresorhus/meow/issues/164).\n- `isRequired`: Determine if the flag is required. (Default: false)\n\t- If it's only known at runtime whether the flag is required or not, you can pass a `Function` instead of a `boolean`, which based on the given flags and other non-flag arguments, should decide if the flag is required. Two arguments are passed to the function:\n\t- The first argument is the **flags** object, which contains the flags converted to camel-case excluding aliases.\n\t- The second argument is the **input** string array, which contains the non-flag arguments.\n\t- The function should return a `boolean`, true if the flag is required, otherwise false.\n\nNote that flags are always defined using a camel-case key (`myKey`), but will match arguments in kebab-case (`--my-key`).\n\nExample:\n\n```js\nflags: {\n\tunicorn: {\n\t\ttype: 'string',\n\t\tchoices: ['rainbow', 'cat', 'unicorn'],\n\t\tdefault: ['rainbow', 'cat'],\n\t\tshortFlag: 'u',\n\t\taliases: ['unicorns'],\n\t\tisMultiple: true,\n\t\tisRequired: (flags, input) =\u003e {\n\t\t\tif (flags.otherFlag) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\t}\n}\n```\n\n##### description\n\nType: `string | false`\\\nDefault: The package.json `\"description\"` property\n\nDescription to show above the help text.\n\nSet it to `false` to disable it altogether.\n\n##### help\n\nType: `string | false`\n\nThe help text you want shown.\n\nThe input is reindented and starting/ending newlines are trimmed which means you can use a [template literal](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/template_strings) without having to care about using the correct amount of indent.\n\nThe description will be shown above your help text automatically.\n\nSet it to `false` to disable it altogether.\n\n##### version\n\nType: `string`\\\nDefault: The package.json `\"version\"` property\n\nSet a custom version output.\n\n##### autoHelp\n\nType: `boolean`\\\nDefault: `true`\n\nAutomatically show the help text when the `--help` flag is present. Useful to set this value to `false` when a CLI manages child CLIs with their own help text.\n\nThis is only triggered when `--help` is the only argument.\n\n##### autoVersion\n\nType: `boolean`\\\nDefault: `true`\n\nAutomatically show the version text when the `--version` flag is present. Useful to set this value to `false` when a CLI manages child CLIs with their own version text.\n\nThis is only triggered when `--version` is the only argument.\n\n##### pkg\n\nType: `object`\\\nDefault: Closest package.json upwards\n\npackage.json as an `object`.\n\nNote: Setting this stops `meow` from finding a package.json.\n\n*You most likely don't need this option.*\n\n##### argv\n\nType: `string[]`\\\nDefault: `process.argv.slice(2)`\n\nCustom arguments object.\n\n##### inferType\n\nType: `boolean`\\\nDefault: `false`\n\nInfer the argument type.\n\nBy default, the argument `5` in `$ foo 5` becomes a string. Enabling this would infer it as a number.\n\nAlso applies to flags without explicit types. By default, `--count 42` remains as the string `'42'`. With `inferType: true`, it becomes the number `42`.\n\n##### booleanDefault\n\nType: `boolean | undefined`\\\nDefault: `false`\n\nValue of `boolean` flags not defined in `argv`.\n\nIf set to `undefined`, the flags not defined in `argv` will be excluded from the result.\nThe `default` value set in `boolean` flags take precedence over `booleanDefault`.\n\n_Note: If used in conjunction with `isMultiple`, the default flag value is set to `[]`._\n\n__Caution: Explicitly specifying `undefined` for `booleanDefault` has different meaning from omitting key itself.__\n\nExample:\n\n```js\nimport meow from 'meow';\n\nconst cli = meow(`\n\tUsage\n\t  $ foo\n\n\tOptions\n\t  --rainbow, -r  Include a rainbow\n\t  --unicorn, -u  Include a unicorn\n\t  --no-sparkles  Exclude sparkles\n\n\tExamples\n\t  $ foo\n\t  🌈 unicorns✨🌈\n`, {\n\timportMeta: import.meta,\n\tbooleanDefault: undefined,\n\tflags: {\n\t\trainbow: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t\tshortFlag: 'r'\n\t\t},\n\t\tunicorn: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t\tshortFlag: 'u'\n\t\t},\n\t\tcake: {\n\t\t\ttype: 'boolean',\n\t\t\tshortFlag: 'c'\n\t\t},\n\t\tsparkles: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true\n\t\t}\n\t}\n});\n/*\n{\n\tflags: {\n\t\trainbow: true,\n\t\tunicorn: false,\n\t\tsparkles: true\n\t},\n\tunnormalizedFlags: {\n\t\trainbow: true,\n\t\tr: true,\n\t\tunicorn: false,\n\t\tu: false,\n\t\tsparkles: true\n\t},\n\t…\n}\n*/\n```\n\n##### allowUnknownFlags\n\nType: `boolean`\\\nDefault: `true`\n\nWhether to allow unknown flags or not.\n\n\u003e [!NOTE]\n\u003e Flags declared in camelCase accept both `--camelCase` and `--camel-case` (including when `allowUnknownFlags` is `false`).\n\n##### helpIndent\n\nType: `number`\\\nDefault: `2`\n\nThe number of spaces to use for indenting the help text.\n\n## Tips\n\nSee [`chalk`](https://github.com/chalk/chalk) if you want to colorize the terminal output.\n\nSee [`get-stdin`](https://github.com/sindresorhus/get-stdin) if you want to accept input from stdin.\n\nSee [`conf`](https://github.com/sindresorhus/conf) if you need to persist some data.\n\n[More useful CLI utilities…](https://github.com/sindresorhus/awesome-nodejs#command-line-utilities)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fmeow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Fmeow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fmeow/lists"}