{"id":26230964,"url":"https://github.com/kazupon/gunshi","last_synced_at":"2025-12-16T04:07:38.628Z","repository":{"id":281975538,"uuid":"938203449","full_name":"kazupon/gunshi","owner":"kazupon","description":"Gunshi: Modern javascript command-line library","archived":false,"fork":false,"pushed_at":"2025-04-19T01:32:54.000Z","size":10688,"stargazers_count":104,"open_issues_count":10,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-19T10:49:43.960Z","etag":null,"topics":["args","argument","argv","cli","option"],"latest_commit_sha":null,"homepage":"https://gunshi.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/kazupon.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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},"funding":"kazupon"},"created_at":"2025-02-24T15:28:44.000Z","updated_at":"2025-04-19T01:32:57.000Z","dependencies_parsed_at":"2025-03-27T06:26:10.926Z","dependency_job_id":"94899eaa-480f-4a88-bd79-5dc5276aad6d","html_url":"https://github.com/kazupon/gunshi","commit_stats":null,"previous_names":["kazupon/gunshi"],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kazupon%2Fgunshi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kazupon%2Fgunshi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kazupon%2Fgunshi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kazupon%2Fgunshi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kazupon","download_url":"https://codeload.github.com/kazupon/gunshi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249730809,"owners_count":21317328,"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":["args","argument","argv","cli","option"],"created_at":"2025-03-12T23:17:50.881Z","updated_at":"2025-12-16T04:07:38.623Z","avatar_url":"https://github.com/kazupon.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\t\u003cimg alt=\"logo\" width=\"196\" src=\"./assets/logo.png\"\u003e\n\u003c/p\u003e\n\u003ch1 align=\"center\"\u003e🏯 Gunshi\u003c/h1\u003e\n\n[![Version][npm-version-src]][npm-version-href]\n[![CI][ci-src]][ci-href]\n[![InstallSize][install-size-src]][install-size-src]\n[![JSR][jsr-src]][jsr-href]\n\nGunshi is a modern javascript command-line library\n\n\u003c!-- eslint-disable markdown/no-missing-label-refs --\u003e\n\n\u003e [!TIP]\n\u003e gunshi (軍師) is a position in ancient Japanese samurai battle in which a samurai devised strategies and gave orders. That name is inspired by the word \"command\".\n\n\u003c!-- eslint-enable markdown/no-missing-label-refs --\u003e\n\n## ✨ Features\n\nGunshi is designed to simplify the creation of modern command-line interfaces:\n\n- 📏 **Simple \u0026 Universal**: Run commands with simple API and support for universal runtime (Node.js, Deno, Bun).\n- ⚙️ **Declarative \u0026 Type Safe**: Configure commands declaratively with full TypeScript support and type-safe argument parsing by [args-tokens](https://github.com/kazupon/args-tokens)\n- 🧩 **Composable \u0026 Lazy**: Create modular sub-commands with context sharing and lazy loading for better performance.\n- 🎨 **Flexible Rendering**: Customize usage generation, validation errors, and help messages with pluggable renderers.\n- 🌍 **Internationalization**: Built with global users in mind, featuring locale-aware design, resource management, and multi-language support.\n- 🔌 **Pluggable**: Extensible plugin system with dependency management and lifecycle hooks for modular CLI development.\n\n## 📡 Status\n\n- v0.27: stable\n\n## 💿 Installation\n\n```sh\n# npm\nnpm install --save gunshi\n\n## pnpm\npnpm add gunshi\n\n## yarn\nyarn add gunshi\n\n## deno\ndeno add jsr:@gunshi/gunshi\n\n## bun\nbun add gunshi\n```\n\n## 🚀 Usage\n\n```js\nimport { cli } from 'gunshi'\n\n// define a command with declarative configuration, using commandable object\nconst command = {\n  name: 'greet',\n  description: 'A greeting command',\n  args: {\n    name: {\n      type: 'string',\n      short: 'n',\n      description: 'Name to greet'\n    },\n    greeting: {\n      type: 'string',\n      short: 'g',\n      default: 'Hello',\n      description: 'Greeting to use (default: \"Hello\")'\n    },\n    times: {\n      type: 'number',\n      short: 't',\n      default: 1,\n      description: 'Number of times to repeat the greeting (default: 1)'\n    }\n  },\n  run: ctx =\u003e {\n    const { name = 'World', greeting, times } = ctx.values\n    for (let i = 0; i \u003c times; i++) {\n      console.log(`${greeting}, ${name}!`)\n    }\n  }\n}\n\n// run a command that is defined above\n// (the 3rd argument of `cli` is the command option)\nawait cli(process.argv.slice(2), command, {\n  name: 'my-app',\n  version: '1.0.0',\n  description: 'My CLI application'\n})\n```\n\nAbout more details and usage, see [documentations](https://gunshi.dev)\n\n## 💁‍♀️ Showcases\n\n- [pnpmc](https://github.com/kazupon/pnpmc): PNPM Catalogs Tooling\n- [sourcemap-publisher](https://github.com/es-tooling/sourcemap-publisher): A tool to publish sourcemaps externally and rewrite sourcemap URLs at pre-publish time\n- [curxy](https://github.com/ryoppippi/curxy): An proxy worker for using ollama in cursor\n- [SiteMCP](https://github.com/ryoppippi/sitemcp): Fetch an entire site and use it as an MCP Server\n- [ccusage](https://github.com/ryoppippi/ccusage): A CLI tool for analyzing Claude Code usage from local JSONL files\n- [varlock](https://github.com/dmno-dev/varlock): Enhanced .env file loader, using @decorator style comments to add validation, type-safety, and more\n\n## 🙌 Contributing guidelines\n\nIf you are interested in contributing to `gunshi`, I highly recommend checking out [the contributing guidelines](/CONTRIBUTING.md) here. You'll find all the relevant information such as [how to make a PR](/CONTRIBUTING.md#pull-request-guidelines), [how to setup development](/CONTRIBUTING.md#development-setup)) etc., there.\n\n## 💖 Credits\n\nThis project is inspired and powered by:\n\n- [`citty`](https://github.com/unjs/citty), created by [UnJS team](https://github.com/unjs) and contributors\n- [`ordana`](https://github.com/sapphi-red/ordana), createdy by [sapphi-red](https://github.com/sapphi-red), inspired documentation generation\n- cline and claude 3.7 sonnet, examples and docs is generated\n\nThank you!\n\n## 🤝 Sponsors\n\nThe development of Gunshi is supported by my OSS sponsors!\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://cdn.jsdelivr.net/gh/kazupon/sponsors/sponsors.svg\"\u003e\n    \u003cimg alt=\"sponsor\" src='https://cdn.jsdelivr.net/gh/kazupon/sponsors/sponsors.svg'/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## ©️ License\n\n[MIT](http://opensource.org/licenses/MIT)\n\n\u003c!-- Badges --\u003e\n\n[npm-version-src]: https://img.shields.io/npm/v/gunshi?style=flat\n[npm-version-href]: https://npmjs.com/package/gunshi\n[jsr-src]: https://jsr.io/badges/@gunshi/gunshi\n[jsr-href]: https://jsr.io/@gunshi/gunshi\n[install-size-src]: https://pkg-size.dev/badge/install/72346\n[ci-src]: https://github.com/kazupon/gunshi/actions/workflows/ci.yml/badge.svg\n[ci-href]: https://github.com/kazupon/gunshi/actions/workflows/ci.yml\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkazupon%2Fgunshi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkazupon%2Fgunshi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkazupon%2Fgunshi/lists"}