Skip to content

Getting Started

Installation

bash
npm install @kjanat/dreamcli
bash
bun add @kjanat/dreamcli
bash
deno add jsr:@kjanat/dreamcli

Supported minimum runtimes: Node.js >= 22.22.2, Bun >= 1.3.11, Deno >= 2.6.0.

Your First Command

ts
import { , , ,  } from '@kjanat/dreamcli';

const  = ('greet')
  .('Greet someone')
  .('name', .().('Who to greet'))
  .(
    'loud',
    
      .()
      .('l')
      .('Shout the greeting'),
  )
  .(
    'times',
    .().(1).('Repeat count'),
  )
  .(({ , ,  }) => {
    for (let  = 0;  < .; ++) {
      const  = `Hello, ${.}!`;
      .(. ? .() : );
    }
  });

('greet').().();
bash
$ npx tsx greet.ts Alice --loud --times 3
HELLO, ALICE!
HELLO, ALICE!
HELLO, ALICE!

By the time action runs, args.name is string and flags.times is number — fully resolved, no undefined to check.

Multi-Command CLI

ts
import {
  ,
  ,
  ,
  ,
  ,
} from '@kjanat/dreamcli';

const  = ('deploy')
  .('Deploy to an environment')
  .('target', .())
  .('force', .().('f'))
  .(
    'region',
    .(['us', 'eu', 'ap']).('DEPLOY_REGION'),
  )
  .(({ , ,  }) => {
    .(
      `Deploying ${.} to ${. ?? 'default'}`,
    );
  });

const  = ('login')
  .('Authenticate with the service')
  .('token', .())
  .(({ ,  }) => {
    .(
      .
        ? 'Authenticated via token'
        : 'Authenticated interactively',
    );
  });

('mycli')
  .('1.0.0')
  .('My awesome tool')
  .()
  .()
  .();
bash
$ mycli deploy production --force
Deploying production to default

$ mycli login --token abc123
Authenticated via token

What's Next?

  • Why dreamcli? — how it compares to existing frameworks
  • Commands — command builders, groups, nesting
  • Flags — all flag types, modifiers, and resolution
  • Testing — in-process test harness
  • CLI Fundamentals — new to CLIs? Start with the concepts

Released under the MIT License.