Getting Started
Installation
bash
npm install @kjanat/dreamclibash
bun add @kjanat/dreamclibash
deno add jsr:@kjanat/dreamcliSupported 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 tokenWhat'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