{"id":30527989,"url":"https://github.com/dahlia/optique","last_synced_at":"2025-10-10T14:49:05.678Z","repository":{"id":310599942,"uuid":"1040520976","full_name":"dahlia/optique","owner":"dahlia","description":"Type-safe combinatorial CLI parser for TypeScript","archived":false,"fork":false,"pushed_at":"2025-10-02T10:34:28.000Z","size":1112,"stargazers_count":441,"open_issues_count":2,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-10-03T11:51:32.420Z","etag":null,"topics":["cli","getopt","parser-combinators","typescript"],"latest_commit_sha":null,"homepage":"http://optique.dev/","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/dahlia.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2025-08-19T05:34:10.000Z","updated_at":"2025-10-02T10:33:35.000Z","dependencies_parsed_at":"2025-08-19T06:06:52.746Z","dependency_job_id":"81231faa-94bd-4602-91ec-5a3b5bebd486","html_url":"https://github.com/dahlia/optique","commit_stats":null,"previous_names":["dahlia/optique"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/dahlia/optique","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dahlia%2Foptique","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dahlia%2Foptique/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dahlia%2Foptique/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dahlia%2Foptique/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dahlia","download_url":"https://codeload.github.com/dahlia/optique/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dahlia%2Foptique/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279004181,"owners_count":26083689,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"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","getopt","parser-combinators","typescript"],"created_at":"2025-08-27T04:01:56.458Z","updated_at":"2025-10-10T14:49:05.673Z","avatar_url":"https://github.com/dahlia.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003cimg src=\"docs/public/optique.svg\" width=\"128\" height=\"58\" align=\"right\"\u003e\n\nOptique: Type-safe combinatorial CLI parser for TypeScript\n==========================================================\n\n[![JSR][JSR badge]][JSR]\n[![npm][npm badge]][npm]\n[![GitHub Actions][GitHub Actions badge]][GitHub Actions]\n\n\u003e [!WARNING]\n\u003e The API is stabilizing, but may change before the 1.0 release.\n\nType-safe combinatorial CLI parser for TypeScript inspired by Haskell's\n[optparse-applicative] and TypeScript's [Zod]. Build composable parsers for\ncommand-line interfaces with full type safety, automatic type inference, and\nbuilt-in shell completion support for Bash and zsh.\n\n\u003e [!NOTE]\n\u003e Optique is a parsing library that focuses on extracting and validating\n\u003e command-line arguments. It doesn't dictate your application's structure,\n\u003e handle command execution, or provide scaffolding—it simply transforms\n\u003e command-line input into well-typed data structures.\n\n[JSR]: https://jsr.io/@optique\n[JSR badge]: https://jsr.io/badges/@optique/core\n[npm]: https://www.npmjs.com/package/@optique/core\n[npm badge]: https://img.shields.io/npm/v/@optique/core?logo=npm\n[GitHub Actions]: https://github.com/dahlia/optique/actions/workflows/main.yaml\n[GitHub Actions badge]: https://github.com/dahlia/optique/actions/workflows/main.yaml/badge.svg\n[optparse-applicative]: https://github.com/pcapriotti/optparse-applicative\n[Zod]: https://zod.dev/\n\n\nQuick example\n-------------\n\n~~~~ typescript\nimport { object, option, optional, or, merge, constant } from \"@optique/core/parser\";\nimport { string, integer } from \"@optique/core/valueparser\";\nimport { run, print } from \"@optique/run\";\n\n// Reusable parser components\nconst commonOptions = object({\n  verbose: option(\"-v\", \"--verbose\"),\n  config: optional(option(\"-c\", \"--config\", string())),\n});\n\n// Mutually exclusive deployment strategies\nconst localDeploy = object({\n  mode: constant(\"local\" as const),\n  path: option(\"--path\", string()),\n  port: option(\"--port\", integer({ min: 1000 })),\n});\n\nconst cloudDeploy = object({\n  mode: constant(\"cloud\" as const),\n  provider: option(\"--provider\", string()),\n  region: option(\"--region\", string()),\n  apiKey: option(\"--api-key\", string()),\n});\n\n// Compose parsers with type-safe constraints\nconst parser = merge(\n  commonOptions,\n  or(localDeploy, cloudDeploy)\n);\n\nconst config = run(parser, { help: \"both\" });\n// config: {\n//   readonly verbose: boolean;\n//   readonly config: string | undefined;\n// } \u0026 (\n//   | {\n//       readonly mode: \"local\";\n//       readonly path: string;\n//       readonly port: number;\n//   }\n//   | {\n//       readonly mode: \"cloud\";\n//       readonly provider: string;\n//       readonly region: string;\n//       readonly apiKey: string;\n//   }\n// )\n\n// TypeScript knows exactly what's available based on the mode\nif (config.mode === \"local\") {\n  print(`Deploying to ${config.path} on port ${config.port}.`);\n} else {\n  print(`Deploying to ${config.provider} in ${config.region}.`);\n}\n~~~~\n\n\nDocs\n----\n\nOptique provides comprehensive documentation to help you get started quickly:\n\u003chttps://optique.dev/\u003e.\n\nAPI reference documentation for each package is available on JSR (see below).\n\n\nPackages\n--------\n\nOptique is a monorepo which contains multiple packages.  The main package is\n*@optique/core*, which provides the shared types and parser combinators.\nThe following is a list of the available packages:\n\n| Package                                  | JSR                          | npm                          | Description                              |\n| ---------------------------------------- | ---------------------------- | ---------------------------- | ---------------------------------------- |\n| [@optique/core](/packages/core/)         | [JSR][jsr:@optique/core]     | [npm][npm:@optique/core]     | Shared types and parser combinators      |\n| [@optique/run](/packages/run/)           | [JSR][jsr:@optique/run]      | [npm][npm:@optique/run]      | Runner for Node.js/Deno/Bun              |\n| [@optique/temporal](/packages/temporal/) | [JSR][jsr:@optique/temporal] | [npm][npm:@optique/temporal] | [Temporal] value parsers (date and time) |\n\n[jsr:@optique/core]: https://jsr.io/@optique/core\n[npm:@optique/core]: https://www.npmjs.com/package/@optique/core\n[jsr:@optique/run]: https://jsr.io/@optique/run\n[npm:@optique/run]: https://www.npmjs.com/package/@optique/run\n[jsr:@optique/temporal]: https://jsr.io/@optique/temporal\n[npm:@optique/temporal]: https://www.npmjs.com/package/@optique/temporal\n[Temporal]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdahlia%2Foptique","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdahlia%2Foptique","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdahlia%2Foptique/lists"}