{"id":25077,"library":"cli-compiler","title":"cli-compiler","description":"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.","status":"active","version":"0.1.35","language":"javascript","source_language":"en","source_url":"https://github.com/freeformsystems/cli-compiler","tags":["javascript","cli","program","command","compiler","markdown"],"install":[{"cmd":"npm install cli-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add cli-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add cli-compiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for defining CLI commands that the compiler processes.","package":"cli-command","optional":true}],"imports":[{"note":"Package exports a default function that initializes the compiler.","wrong":"const compiler = require('cli-compiler');","symbol":"default","correct":"import compiler from 'cli-compiler';"},{"note":"Named export `compile` for direct compilation.","wrong":"import { Compiler } from 'cli-compiler';","symbol":"compile","correct":"import { compile } from 'cli-compiler';"},{"note":"Named export for the phases enum-like object, used for custom compiler pipelines.","wrong":"import Phases from 'cli-compiler';","symbol":"Phases","correct":"import { Phases } from 'cli-compiler';"}],"quickstart":{"code":"import { compile } from 'cli-compiler';\nimport { writeFileSync } from 'fs';\n\nconst markdown = `\n# myprogram\n\n## hello\n\nGreet the user.\n\n*Usage:*\n\nmyprogram hello [name]\n\n*Description:*\n\nSay hello to a user.\n`;\n\nconst result = compile(markdown, {\n  name: 'myprogram',\n  description: 'My CLI program'\n});\n\nwriteFileSync('myprogram.js', result, 'utf8');\nconsole.log('Compiled successfully.');","lang":"javascript","description":"Compiles a Markdown-defined CLI program into a JavaScript module file."},"warnings":[{"fix":"Refer to the cli-command documentation for the exact Markdown format expected.","message":"Input markdown must strictly follow the CLI-command Markdown specification; otherwise, parsing may fail silently or produce malformed output.","severity":"gotcha","affected_versions":"<1.0.0"},{"fix":"Run eslint or similar on the output file.","message":"The compiler does not validate the generated JavaScript; lint your output separately.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"No fix available; consider using an alternative compiler.","message":"The compiler relies on deprecated Node.js APIs such as `fs.existsSync`.","severity":"deprecated","affected_versions":"<=0.1.35"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `npm install cli-compiler` to install the package.","cause":"Package not installed or version mismatch.","error":"Cannot find module 'cli-compiler'"},{"fix":"Use `import compiler from 'cli-compiler'` (ESM) or `const compiler = require('cli-compiler').default` (CJS).","cause":"Default import is a function, but may be imported incorrectly.","error":"TypeError: compiler is not a function"},{"fix":"Review the cli-command specification and ensure headings and definitions are correct.","cause":"Markdown does not conform to the expected CLI format.","error":"SyntaxError: Unexpected token in Markdown"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}