{"id":18148,"library":"base-cli","title":"base-cli","description":"Plugin for base-methods that maps built-in methods to CLI arguments, supporting methods from plugins like base-store, base-options, and base-data. Current stable version: 0.5.0. Release cadence: infrequent, no recent updates. Key differentiators: simplifies setting up command line logic for base applications by adding a cli object with .map(), .alias(), and .process() methods. Alternative: base-config for declarative configuration.","status":"maintenance","version":"0.5.0","language":"javascript","source_language":"en","source_url":"https://github.com/node-base/base-cli","tags":["javascript","app","application","arg","args","base","baseplugin","cache","cli"],"install":[{"cmd":"npm install base-cli","lang":"bash","label":"npm"},{"cmd":"yarn add base-cli","lang":"bash","label":"yarn"},{"cmd":"pnpm add base-cli","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core framework required for plugin registration","package":"base","optional":false}],"imports":[{"note":"Package is CommonJS-only; no ESM exports. Use require().","wrong":"import cli from 'base-cli';","symbol":"cli","correct":"const cli = require('base-cli');"},{"note":"cli is a function that returns a plugin function; must call cli()","wrong":"app.use(cli);","symbol":"app.use","correct":"app.use(cli());"},{"note":"Must wrap in function to preserve context","wrong":"app.cli.map('get', app.get);","symbol":"app.cli","correct":"app.cli.map('get', (key, val) => app.get(key, val));"}],"quickstart":{"code":"const cli = require('base-cli');\nconst Base = require('base');\nconst app = new Base();\napp.use(cli());\n\napp.cli\n  .map('get', function(key, val) {\n    app.get(key, val);\n  })\n  .map('set', function(key, val) {\n    app.set(key, val);\n  });\n\nconst argv = require('minimist')(process.argv.slice(2));\nconst expand = require('expand-args');\napp.cli.process(expand(argv), function(err) {\n  if (err) throw err;\n});","lang":"javascript","description":"Demonstrates registering base-cli plugin, mapping CLI flags to base methods, and processing argv."},"warnings":[{"fix":"Use base@0.x or fork/update plugin.","message":"Requires 'base' version 0.x; incompatible with base 1.x.","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Consider migrating to base-config or modern CLI framework.","message":"Package is no longer actively maintained; no updates since 2017.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"app.use(cli()) instead of app.use(cli)","message":"cli() must be called as a function, not passed directly to app.use().","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use app.cli.map('get', (key, val) => app.get(key, val));","message":"Map callbacks lose context; must use function or arrow to access app.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure app.use(cli()); is called before accessing app.cli","cause":"Forgetting to call cli() as function or before using app.cli.","error":"TypeError: app.cli is undefined"},{"fix":"Downgrade base to 0.x or use a different CLI plugin.","cause":"Using base version 1.x or higher which changed the API.","error":"Error: base-cli requires base-methods 0.x"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}