Registry / devops / base-cli

base-cli

JSON →
library0.5.0jsnpmunverified

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.

npm install base-cli
INSTALL
IMPORT
SIG · BASE-CLI
B
base-cli
devopsjavascriptv0.5.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

cli
const cli = require('base-cli');
import cli from 'base-cli';
Package is CommonJS-only; no ESM exports. Use require().
app.use
app.use(cli());
app.use(cli);
cli is a function that returns a plugin function; must call cli()
app.cli
app.cli.map('get', (key, val) => app.get(key, val));
app.cli.map('get', app.get);
Must wrap in function to preserve context

Demonstrates registering base-cli plugin, mapping CLI flags to base methods, and processing argv.

const cli = require('base-cli'); const Base = require('base'); const app = new Base(); app.use(cli()); app.cli .map('get', function(key, val) { app.get(key, val); }) .map('set', function(key, val) { app.set(key, val); }); const argv = require('minimist')(process.argv.slice(2)); const expand = require('expand-args'); app.cli.process(expand(argv), function(err) { if (err) throw err; });
base --version
Debug
Known issues
breakingRequires 'base' version 0.x; incompatible with base 1.x.
fix
Use base@0.x or fork/update plugin.
affects: >=0.5.0
deprecatedPackage is no longer actively maintained; no updates since 2017.
fix
Consider migrating to base-config or modern CLI framework.
affects: >=0.0.0
gotchacli() must be called as a function, not passed directly to app.use().
fix
app.use(cli()) instead of app.use(cli)
affects: >=0.0.0
gotchaMap callbacks lose context; must use function or arrow to access app.
fix
Use app.cli.map('get', (key, val) => app.get(key, val));
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: app.cli is undefined
Forgetting to call cli() as function or before using app.cli.
fix
Ensure app.use(cli()); is called before accessing app.cli
Error: base-cli requires base-methods 0.x
Using base version 1.x or higher which changed the API.
fix
Downgrade base to 0.x or use a different CLI plugin.
Upgrade
Version history
0.5.0latest on npm
Audit
Dependencies
baserequiredCore framework required for plugin registration
Agent activity
5 hits · last 30 days
node
4
Resources
base-cli — npm install base-cli · libregistry