Registry / devops / cli-compiler

cli-compiler

JSON →
library0.1.35jsnpmunverified

A compiler for CLI command definitions written in Markdown, transforming them into JavaScript modules. Integrated with the cli-command and cli-toolkit ecosystem, it supports multiple phases including parsing, rendering, variable replacement, and module generation. This package is at version 0.1.35, with no recent releases indicating active maintenance. It is designed for Node.js environments and lacks TypeScript type definitions. Key differentiator: it uses Markdown as the source format for CLI program definitions, allowing documentation and code generation from the same file.

npm install cli-compiler
INSTALL
IMPORT
SIG · CLI-COMPILER
C
cli-compiler
devopsjavascriptv0.1.35
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

default
import compiler from 'cli-compiler';
const compiler = require('cli-compiler');
Package exports a default function that initializes the compiler.
compile
import { compile } from 'cli-compiler';
import { Compiler } from 'cli-compiler';
Named export `compile` for direct compilation.
Phases
import { Phases } from 'cli-compiler';
import Phases from 'cli-compiler';
Named export for the phases enum-like object, used for custom compiler pipelines.

Compiles a Markdown-defined CLI program into a JavaScript module file.

import { compile } from 'cli-compiler'; import { writeFileSync } from 'fs'; const markdown = ` # myprogram ## hello Greet the user. *Usage:* myprogram hello [name] *Description:* Say hello to a user. `; const result = compile(markdown, { name: 'myprogram', description: 'My CLI program' }); writeFileSync('myprogram.js', result, 'utf8'); console.log('Compiled successfully.');
Debug
Known issues
gotchaInput markdown must strictly follow the CLI-command Markdown specification; otherwise, parsing may fail silently or produce malformed output.
fix
Refer to the cli-command documentation for the exact Markdown format expected.
affects: <1.0.0
gotchaThe compiler does not validate the generated JavaScript; lint your output separately.
fix
Run eslint or similar on the output file.
affects: >=0.0.0
deprecatedThe compiler relies on deprecated Node.js APIs such as `fs.existsSync`.
fix
No fix available; consider using an alternative compiler.
affects: <=0.1.35
Errors
Common errors & fixes
Cannot find module 'cli-compiler'
Package not installed or version mismatch.
fix
Run `npm install cli-compiler` to install the package.
TypeError: compiler is not a function
Default import is a function, but may be imported incorrectly.
fix
Use `import compiler from 'cli-compiler'` (ESM) or `const compiler = require('cli-compiler').default` (CJS).
SyntaxError: Unexpected token in Markdown
Markdown does not conform to the expected CLI format.
fix
Review the cli-command specification and ensure headings and definitions are correct.
Upgrade
Version history
0.1.35latest on npm
Audit
Dependencies
cli-commandoptionalRequired for defining CLI commands that the compiler processes.
Agent activity
6 hits · last 30 days
node
6
Resources
cli-compiler — npm install cli-compiler · libregistry