{"id":17507,"library":"base-cli-process","title":"Base CLI Process","description":"base-cli-process is a utility package designed to normalize command-line arguments (`argv`) for applications built on the `base` framework. It functions as a `base` plugin, pre-processing the input object with `base-cli-schema` before invoking the `.process()` method from `base-cli`. This package, currently at version 0.1.19, helps structure and standardize CLI input, offering commands for configuration management (`--config`), current working directory (`--cwd`), data definition (`--data`), option setting (`--option`), and plugin loading (`--plugins`). It is part of an older ecosystem and has not seen recent development. Given its low version number and lack of recent updates, it operates under a pre-1.0 development model where API stability is not guaranteed across minor versions.","status":"abandoned","version":"0.1.19","language":"javascript","source_language":"en","source_url":"https://github.com/node-base/base-cli-process","tags":["javascript","api","app","application","base","base-plugin","baseplugin","building-blocks","cli"],"install":[{"cmd":"npm install base-cli-process","lang":"bash","label":"npm"},{"cmd":"yarn add base-cli-process","lang":"bash","label":"yarn"},{"cmd":"pnpm add base-cli-process","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core framework for building pluggable applications; base-cli-process functions as a plugin for it.","package":"base","optional":false},{"reason":"Provides the core CLI processing logic that base-cli-process hooks into.","package":"base-cli","optional":false},{"reason":"Used for pre-processing and normalizing argv values before they are passed to base-cli.","package":"base-cli-schema","optional":false}],"imports":[{"note":"This package is CommonJS-only. The main export is a function that returns a base plugin.","symbol":"cli","correct":"const cli = require('base-cli-process');"},{"note":"The core 'base' framework class, typically imported to instantiate the application object before using this plugin.","symbol":"Base","correct":"const Base = require('base');"},{"note":"The primary way to integrate base-cli-process into a 'base' application is by registering it as a plugin.","symbol":"pluginUsage","correct":"app.use(cli());"}],"quickstart":{"code":"const Base = require('base');\nconst cli = require('base-cli-process');\n\n// A mock package.json content for demonstration\nconst pkg = {\n  name: 'my-cli-app',\n  version: '1.0.0',\n  description: 'A simple CLI application',\n  scripts: {\n    test: 'echo \\\"Error: no test specified\\\" && exit 1'\n  },\n  config: {\n    myApp: {\n      defaultSetting: true\n    }\n  }\n};\n\nconst app = new Base();\n// Register the base-cli-process plugin\napp.use(cli());\n\n// Simulate a CLI call with some arguments\n// For example, running `node app.js --config=myApp.newSetting:value --data=user:guest --help`\nconst simulatedArgv = {\n  config: 'myApp.newSetting:value',\n  data: 'user:guest',\n  help: true,\n  _: [] // minimist usually adds an empty array for non-flag args\n};\n\nconsole.log('--- Before CLI processing ---');\nconsole.log('App options:', app.options);\nconsole.log('App config:', app.config);\n\n// Process the simulated CLI arguments\napp.cli.process(simulatedArgv, function(err) {\n  if (err) {\n    console.error('CLI processing error:', err);\n    return;\n  }\n  console.log('\\n--- After CLI processing ---');\n  console.log('App options after processing:', app.options);\n  console.log('App config after processing:', app.config);\n  if (app.cache.get && app.cache.get.help) {\n    console.log('Help was requested!');\n  }\n  console.log('Simulated command-line arguments processed successfully.');\n});","lang":"javascript","description":"Demonstrates how to initialize a `base` application, register `base-cli-process` as a plugin, and then simulate processing command-line arguments to affect `app.options` and `app.config`."},"warnings":[{"fix":"Consider migrating to a modern, actively maintained CLI parsing library. If continued use is necessary, pin to the exact version and be aware of potential breaking changes if upstream 'base' packages are updated.","message":"The package `base-cli-process` is unmaintained and has not seen updates since at least 2017. It depends on an older `base` ecosystem, and its API is subject to change without strict semantic versioning due to being pre-1.0.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Ensure your project is configured for CommonJS, or use tools to transpile/bundle if integrating into an ESM project. For new projects, prefer ESM-first alternatives.","message":"This package is exclusively CommonJS (`require`) and will not work directly in a pure ECMAScript Modules (ESM) environment without transpilation or specific loader configurations (e.g., dual packages, top-level await imports, or tools like `esbuild`/`webpack`).","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Always install `base`, `base-cli`, and `base-cli-schema` alongside `base-cli-process`. Refer to their respective documentations for compatibility and usage.","message":"The functionality of `base-cli-process` relies heavily on `base-cli` and `base-cli-schema`. Misconfigurations or outdated versions of these peer/runtime dependencies can lead to unexpected behavior or errors during CLI processing.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-23T00:00:00.000Z","next_check":"2026-07-22T00:00:00.000Z","problems":[{"fix":"Ensure `app.use(cli())` is called *after* initializing `app = new Base()`. Also, verify that `base-cli` is installed and registered if it provides the `.cli` property directly to your `base` instance.","cause":"The `base-cli-process` plugin was not correctly registered with the `base` application instance, or the `base-cli` plugin (which adds the `.cli` property) was not used.","error":"TypeError: app.cli.process is not a function"},{"fix":"This package is CommonJS. If you must use it in an ESM project, consider using a build tool that handles CJS-to-ESM conversion, or if running Node.js, wrap the import in an async `import()` call (though direct `require` is usually the issue here).","cause":"Attempting to `require()` `base-cli-process` in a JavaScript environment configured for pure ESM, which does not support synchronous `require` for ESM modules.","error":"Error [ERR_REQUIRE_ESM]: require() of ES module not supported"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}