{"id":20080046,"url":"https://github.com/neoncitylights/cli-help-parser","last_synced_at":"2025-09-20T17:33:13.537Z","repository":{"id":40572694,"uuid":"476151616","full_name":"neoncitylights/cli-help-parser","owner":"neoncitylights","description":"tool to parse a CLI's help manual into a machine-readable AST","archived":false,"fork":false,"pushed_at":"2023-03-14T22:36:04.000Z","size":859,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-11-13T15:30:48.105Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://neoncitylights.github.io/cli-help-parser/","language":"TypeScript","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/neoncitylights.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":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"neoncitylights"}},"created_at":"2022-03-31T04:36:10.000Z","updated_at":"2024-07-03T01:29:22.000Z","dependencies_parsed_at":"2024-11-13T15:42:49.023Z","dependency_job_id":null,"html_url":"https://github.com/neoncitylights/cli-help-parser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"neoncitylights/node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoncitylights%2Fcli-help-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoncitylights%2Fcli-help-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoncitylights%2Fcli-help-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoncitylights%2Fcli-help-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neoncitylights","download_url":"https://codeload.github.com/neoncitylights/cli-help-parser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233679465,"owners_count":18713085,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["ast","cli-parser","fig"],"created_at":"2024-11-13T15:25:50.174Z","updated_at":"2025-09-20T17:33:08.189Z","avatar_url":"https://github.com/neoncitylights.png","language":"TypeScript","funding_links":["https://github.com/sponsors/neoncitylights"],"categories":[],"sub_categories":[],"readme":"# CLI help parser for FIG specs\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![GitHub deployments](https://img.shields.io/github/deployments/neoncitylights/cli-help-parser/github-pages?label=deploy)](https://github.com/neoncitylights/cli-help-parser/deployments/activity_log?environment=github-pages)\n[![codecov](https://codecov.io/gh/neoncitylights/cli-help-parser/branch/main/graph/badge.svg?token=xtI8VUXBwP)](https://codecov.io/gh/neoncitylights/cli-help-parser)\n\nThis library provides a parser that, given a CLI help manual, generates some scaffolding for machine-readable Fig specs.\n\nI originally created this repository to help [add the webpack spec](https://github.com/withfig/autocomplete/pull/1100) to Fig.\n\n\u003e Currently, this library is slightly hardcoded to just recognize webpack's help manual, but I may update it in the future to make this parser more generic.\n\n## Setup\n\nRunning the NPM script will generate an `options.json` file (intentionally git-ignored in `.gitignore`).\n\n```bash\ngh repo clone neoncitylights/cli-help-parser\nnpm install\nnpm run generate\n```\n\n## Documentation\n[Auto-generated API documentation is available](https://neoncitylights.github.io/cli-help-parser/).\n\n## Performance\n\nThis script will usually take longer on the first run, and faster on subsequent runs.\n\nWith some informal benchmarking, this script can take around 30 milliseconds on sebsequent runs from parsing all of 957 options of the `webpack` CLI tool, with only the native macOS terminal open. This roughly tracks to approximately 36.57 μs (microseconds) per line.\n\nThe script+benchmark was ran under the following environment:\n\n* TypeScript version: 4.6.2\n* Node.js: 17.7.2\n* Machine:\n  * Model: MacBook Pro 2015\n  * OS version: macOS Monterey 12.2.1\n  * CPU: Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz\n  * Memory: 16 GB 1600 MHz DDR3\n\nThe timing was tested via `console.time()` and `console.timeEnd()`. [^console-time][^console-timeend]\n\n## Post-processing\n\nAfter parsing every option/subcommand, it post-processes the description using some basic heuristics to find out more information:\n\n### Deprecated\n\nIf the sentence contains the keyword `deprecated`, it will mark it as deprecated via `deprecated: true`.\nIt will also look to see if there is any inline code by checking for inline code delimiters, and use that as the `insertValue`.\n\n### Argument templates\n\n* Folders: If the sentence contains the keywords `directory`, and the option accepts an argument, it will add `\"folders\"` to the `template` property.\n* Filepaths: If the sentence contains the keywords `filename`, and the option accepts an argument, it will add `\"filepaths\"` to the `template` property.\n\n## License\n\nThis repository is released under the [MIT License](./LICENSE).\n\n[^console-time]: https://console.spec.whatwg.org/#time\n[^console-timeend]: https://console.spec.whatwg.org/#timeend\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneoncitylights%2Fcli-help-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneoncitylights%2Fcli-help-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneoncitylights%2Fcli-help-parser/lists"}