Skip to main content

Built and signed on GitHub Actions

zero code make cli program

This package works with Deno, Browsers
This package works with Deno
This package works with Browsers
JSR Score
41%
Published
2 days ago (0.1.6)

Zero-Code CLI Tool (or Interactive Shell) Creation

Generate and Invoke CLI from Files/Modules via JSDoc

English | 简体中文

Installation

deno install -A -g --name cli jsr:@24wings/cli/cli.ts


Example

Your code (my_hello.ts):

// my_hello.ts

/**
@param name  You can set the name you use.
*/
export function hello(name: string) {
  return { msg: `hello ${name}` };
}

/**
@param name  You can set the name you use (variant 2).
*/
export function hello2(name: string) {
  return { msg: `hello ${name}` };
}
  
**Note**: `@param name` is optional. If included, it becomes the parameter documentation (and CLI argument help text).  

Usage

1. Run as CLI

cli ./my-hello.ts --help

Or launch interactive shell mode:

cli ./my-hello.ts --shell --log

hello.jpeg
Lists all functions in the module as subcommands.

2. View Subcommand Help

cli ./my-hello.ts hello --help

hello-help.jpeg

3. Execute with Logging (-log)

-log is a built-in flag to print function results:

cli ./my-hello.ts hello --name zhangsan -log

hello-exec-result.jpeg

4. Use with JSR Modules

cli jsr:@std/path dirname --help

jsr-help.jpeg


How It Works

Converts module documentation (via deno doc --json) into CLI arguments using gunshi.


Planned Features

  • Map optional parameters to CLI flags.
  • Support complex object parameters.
  • Output formats: JSON, XML, JSONL.
  • Structured logging (e.g., logtap-style).
  • Better integration with NuShell.
  • Interactive shell mode.
  • Auto-generated shorthand flags.
  • load more modules ,complex ui (app mode)

Let me know if you'd like any refinements!

Built and signed on
GitHub Actions
View transparency log