Conventional CLI Tooling
raw JSON →conventional-cli provides a framework for defining and managing Command Line Interface (CLI) arguments in a structured and conventional manner. It allows developers to specify argument properties such as long and short names, descriptions, types (like enum or glob), default values, and whether they are required or deprecated. The library ships with TypeScript types, enabling type-safe CLI development. The current stable version is 1.2.0, released on January 29, 2020. Based on the release history, the project had a brief period of active development in early 2020 but has not seen any updates or releases since then, indicating a very low release cadence and an effectively abandoned status. Its primary differentiator is its emphasis on establishing a consistent, conventional structure for CLI argument definitions, which can aid in standardization and potentially simplify automated parsing or documentation generation for CLI tools.
Common errors
error TypeError: conventional_cli_1.Argument is not a constructor ↓
import { Argument } from 'conventional-cli'; for ES modules and TypeScript. If using CommonJS, it might be const { Argument } = require('conventional-cli'); but the library primarily targets ESM/TypeScript usage. error Property 'type' does not exist on type 'IArgument'. ↓
conventional-cli is correctly installed and its type definitions are accessible. Ensure the assigned value for argument.type is one of the valid ArgumentTypes enum members (e.g., ArgumentTypes.enum, ArgumentTypes.path). Warnings
breaking The project has been inactive since January 2020 (last release v1.2.0). It is considered abandoned and may not be compatible with newer Node.js versions, dependency updates, or modern JavaScript features. Security vulnerabilities in its transitive dependencies will likely not be patched. ↓
gotcha The `beta` option for arguments, added in v1.1.0, and `path` via argumentType, added in v1.2.0, are relatively new features within this inactive library. Relying on them might mean being locked into this specific, unmaintained version. ↓
Install
npm install conventional-cli yarn add conventional-cli pnpm add conventional-cli Imports
- Argument wrong
const Argument = require('conventional-cli').Argument;correctimport { Argument } from 'conventional-cli'; - IArgument
import { IArgument } from 'conventional-cli'; - ArgumentTypes wrong
import { ARGUMENT_TYPES } from 'conventional-cli';correctimport { ArgumentTypes } from 'conventional-cli';
Quickstart
import { Argument, IArgument, ArgumentTypes } from 'conventional-cli';
const argument: IArgument = new Argument();
argument.longName = '--config-path';
argument.shortName = '-c';
argument.description = 'Specify the configuration file path.';
argument.additionalDescription = 'This path can be absolute or relative to the current working directory.';
argument.type = ArgumentTypes.path;
argument.default = './config.json';
argument.required = false;
argument.deprecated = false;
argument.delimiter = ' ';
argument.beta = '';
console.log(`Defined argument: ${argument.longName}`);
console.log(`Description: ${argument.description}`);
console.log(`Type: ${argument.type}`);