Skip to content

AlexandrosGounis/clifast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clifast

npm

Turn any function into a CLI. Instantly.

Export a function. Run one command. Get a published npm CLI that can be used by LLMs with minimal token consumption compared to MCP.

demo

Try it now

npx clifast your-file.ts
# or install globally
npm install -g clifast

Usage

clifast <file>              # interactive
clifast <file> -y           # skip prompts, use defaults

How it works

// math.ts
export function add(a: number, b: number) {
  return a + b;
}
% clifast math.ts -y
$ npx math 2 3
5

This will parse the exported functions and build a —-help command that explains what the function does based on the types and comments, if any.

Rules

  • Make sure your file contains at least one exported function
  • Multiple exports become subcommands
  • JSDoc comments and proper types are injected in the --help command
  • External imports are auto-bundled. You can create a CLI for an entire repository by using a single file as the entrypoint

Commands

Command Description
clifast <file> Generate a CLI package from exported functions
clifast publish [folder] Publish to npm (handles 2FA, scoped packages)
clifast unpublish [folder] Unpublish from npm (--force for all versions)
clifast test <folder> [args...] Run a generated CLI locally

What it generates

my-tool/
  bin/cli.js       # executable CLI
  dist/bundle.js   # your code, bundled with esbuild
  package.json     # ready to publish
  README.md        # auto-generated docs

License

MIT

About

Turn any file into a CLI from TypeScript/JavaScript exports

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors