Conventional CLI Tooling

raw JSON →
1.2.0 verified Thu Apr 23 auth: no javascript abandoned

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.

error TypeError: conventional_cli_1.Argument is not a constructor
cause Attempting to use CommonJS `require()` syntax while treating the imported module as an ES module with named exports, or vice-versa, or an incorrect import path.
fix
Ensure you are using 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'.
cause This error typically occurs if your TypeScript environment is not correctly picking up the library's type definitions, or if you're attempting to assign a value that doesn't conform to the `ArgumentTypes` enum.
fix
Verify that 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).
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.
fix Evaluate alternative, actively maintained CLI argument parsing libraries for new projects. For existing projects, consider vendoring the code or migrating.
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.
fix Ensure your project explicitly uses `conventional-cli@^1.2.0` if you depend on these features. However, due to the project's abandoned status, consider carefully before using.
npm install conventional-cli
yarn add conventional-cli
pnpm add conventional-cli

Demonstrates how to define a CLI argument with various properties using the Argument class and ArgumentTypes enum.

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}`);