{"id":47930035,"url":"https://github.com/libraz/node-cli","last_synced_at":"2026-06-26T00:00:17.139Z","repository":{"id":343698381,"uuid":"1178796333","full_name":"libraz/node-cli","owner":"libraz","description":"Zero-dependency, batteries-included interactive CLI framework for Node.js / TypeScript","archived":false,"fork":false,"pushed_at":"2026-06-09T02:46:25.000Z","size":212,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-09T04:26:41.015Z","etag":null,"topics":["cli-framework","interactive-shell","nodejs","tab-completion","typescript","zero-dependency"],"latest_commit_sha":null,"homepage":null,"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/libraz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.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":null,"dco":null,"cla":null}},"created_at":"2026-03-11T11:29:41.000Z","updated_at":"2026-06-09T02:45:41.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/libraz/node-cli","commit_stats":null,"previous_names":["libraz/node-cli"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/libraz/node-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libraz%2Fnode-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libraz%2Fnode-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libraz%2Fnode-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libraz%2Fnode-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libraz","download_url":"https://codeload.github.com/libraz/node-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libraz%2Fnode-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34796761,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-25T02:00:05.521Z","response_time":101,"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-framework","interactive-shell","nodejs","tab-completion","typescript","zero-dependency"],"created_at":"2026-04-04T07:15:24.856Z","updated_at":"2026-06-26T00:00:17.132Z","avatar_url":"https://github.com/libraz.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-cli\n\n[![CI](https://img.shields.io/github/actions/workflow/status/libraz/node-cli/ci.yml?branch=main\u0026label=CI)](https://github.com/libraz/node-cli/actions)\n[![npm](https://img.shields.io/npm/v/@libraz/node-cli)](https://www.npmjs.com/package/@libraz/node-cli)\n[![codecov](https://codecov.io/gh/libraz/node-cli/branch/main/graph/badge.svg)](https://codecov.io/gh/libraz/node-cli)\n[![License](https://img.shields.io/github/license/libraz/node-cli)](https://github.com/libraz/node-cli/blob/main/LICENSE)\n\nZero-dependency, batteries-included CLI framework for Node.js / TypeScript.\n\n## Overview\n\n**node-cli** is a lightweight interactive CLI shell framework that provides everything you need to build rich command-line applications — with no external production dependencies.\n\n| Feature | node-cli | Commander | Vorpal |\n|---------|---------|-----------|--------|\n| Interactive Shell (REPL) | Yes | No | Yes |\n| Subcommand Hierarchy | Yes | Yes | Yes |\n| Tab Completion | Yes | No | Yes |\n| Color Output | Built-in | External | External |\n| Table Display | Built-in | External | External |\n| Progress Bar / Spinner | Built-in | External | External |\n| Interactive Prompts | Built-in | External | External |\n| Logger | Built-in | External | External |\n| Pipe Commands | Yes | No | Yes |\n| Plugin System | Yes | No | Yes |\n| Event System | Yes | No | Yes |\n| Zero Dependencies | Yes | Yes | No |\n| TypeScript-first | Yes | Partial | No |\n| ESM-first | Yes | Yes | No |\n\n## Installation\n\n```bash\n# npm\nnpm install @libraz/node-cli\n\n# yarn\nyarn add @libraz/node-cli\n\n# pnpm\npnpm add @libraz/node-cli\n```\n\n## Quick Start\n\n```typescript\nimport { createCLI } from \"@libraz/node-cli\";\n\nconst cli = createCLI({ name: \"myapp\", version: \"1.0.0\" });\n\ncli\n  .command(\"greet \u003cname\u003e\")\n  .description(\"Greet someone\")\n  .option(\"-u, --uppercase\", { type: \"boolean\" })\n  .action((ctx) =\u003e {\n    const name = ctx.args.name as string;\n    const msg = ctx.options.uppercase ? name.toUpperCase() : name;\n    ctx.stdout.write(`Hello, ${msg}!\\n`);\n  });\n\ncli.start();\n```\n\n**Direct mode:**\n\n```bash\n$ myapp greet World --uppercase\nHello, WORLD!\n```\n\n**Interactive shell mode:**\n\n```bash\n$ myapp\nmyapp v1.0.0\n\u003e greet World\nHello, World!\n\u003e exit\n```\n\n## Features\n\n### Command System\n\nFluent API for defining commands with arguments, options, aliases, validation, and subcommands.\n\n```typescript\ncli\n  .command(\"deploy \u003cenv\u003e\")\n  .alias(\"d\")\n  .description(\"Deploy to environment\")\n  .option(\"-t, --tag \u003ctag\u003e\", { type: \"string\", required: true })\n  .option(\"--force\", { type: \"boolean\" })\n  .validate((ctx) =\u003e {\n    if (![\"prod\", \"staging\"].includes(ctx.args.env as string)) {\n      throw new Error(\"Invalid environment\");\n    }\n  })\n  .action(async (ctx) =\u003e {\n    ctx.stdout.write(`Deploying ${ctx.options.tag} to ${ctx.args.env}...\\n`);\n  });\n```\n\n### Subcommands\n\n```typescript\nconst user = cli.command(\"user\").description(\"User management\");\nuser.command(\"create \u003cname\u003e\").action(/* ... */);\nuser.command(\"delete \u003cname\u003e\").action(/* ... */);\n```\n\n### Color Output\n\nProxy-based chainable color API with zero-dependency ANSI support.\n\n```typescript\nimport { color, c } from \"@libraz/node-cli\";\n\nconsole.log(color.bold.green(\"Success!\"));\nconsole.log(c`{red.bold Error}: Something went wrong`);\n```\n\n### Table Display\n\n```typescript\nimport { table } from \"@libraz/node-cli\";\n\nconst data = [\n  { name: \"Alice\", role: \"Admin\", active: true },\n  { name: \"Bob\", role: \"User\", active: false },\n];\n\nconsole.log(table(data, { border: \"rounded\", headerStyle: \"bold\" }));\n```\n\n### Progress Indicators\n\n```typescript\nimport { progress } from \"@libraz/node-cli\";\n\n// Progress bar\nconst bar = progress.bar({ total: 100, label: \"Downloading\" });\nbar.update(50); // 50%\nbar.finish();\n\n// Spinner\nconst spinner = progress.spinner({ label: \"Processing...\" });\nspinner.start();\nspinner.succeed(\"Done!\");\n```\n\n### Interactive Prompts\n\n```typescript\nimport { prompt } from \"@libraz/node-cli\";\n\nconst name = await prompt.text(\"Your name:\");\nconst sure = await prompt.confirm(\"Are you sure?\");\nconst env = await prompt.select(\"Environment:\", [\"dev\", \"staging\", \"prod\"]);\n```\n\n### Logger\n\n```typescript\nimport { logger } from \"@libraz/node-cli\";\n\nconst log = logger({ prefix: \"app\", timestamp: true });\nlog.info(\"Server started on port %d\", 3000);\nlog.success(\"Deployment complete\");\nlog.error(\"Connection failed\");\n\nconst db = log.child(\"db\");\ndb.debug(\"Query executed in 12ms\");\n```\n\n### Event System\n\n```typescript\ncli.on(\"beforeExecute\", (ctx) =\u003e {\n  console.log(`Running: ${ctx.commandPath.join(\" \")}`);\n});\n\ncli.on(\"commandError\", (error, ctx) =\u003e {\n  console.error(`Command failed: ${error.message}`);\n});\n```\n\n### Plugin System\n\n```typescript\nfunction timestampPlugin(ctx) {\n  ctx.on(\"beforeExecute\", (cmdCtx) =\u003e {\n    cmdCtx.stdout.write(`[${new Date().toISOString()}] `);\n  });\n}\n\ncli.use(timestampPlugin);\n```\n\n### Pipe Commands\n\n```typescript\n// In interactive shell\n\u003e produce | transform | consume\n```\n\n### Mode Sub-REPL\n\n```typescript\ncli.command(\"sql\").action((ctx) =\u003e {\n  ctx.shell?.enterMode({\n    prompt: \"sql\u003e \",\n    message: \"Entering SQL mode. Type 'exit' to return.\",\n    action: async (input, { stdout }) =\u003e {\n      stdout.write(`Executing: ${input}\\n`);\n    },\n  });\n});\n```\n\n## Requirements\n\n- Node.js \u003e= 20\n- ESM (type: \"module\")\n\n## Documentation\n\n- [Getting Started](docs/en/getting-started.md)\n- [API Reference](docs/en/api.md)\n- [Commands \u0026 Options](docs/en/commands.md)\n- [Output Utilities](docs/en/output.md)\n\n## License\n\n[MIT](LICENSE)\n\n## Author\n\nlibraz \u003clibraz@libraz.net\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibraz%2Fnode-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibraz%2Fnode-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibraz%2Fnode-cli/lists"}