TypeScript CLI Framework

Build polished CLIswith TypeScript.

$npm install @oscli-dev/oscli
src/cli.ts
import { createCLI } from "@oscli-dev/oscli";

const cli = createCLI((b) => ({
  title: "deploy",
  prompts: {
    env: b.select({ choices: ["staging", "production"] })
      .label("Environment"),
  },
}));

await cli.run(async () => {
  cli.intro("deploy");
  await cli.prompt.env();
  cli.success(`Deployed to ${cli.storage.env}!`);
  cli.outro("Done.");
});
await cli.prompt.name();
01
Run your promptsAwait any prompt. The typed value is stored in cli.storage automatically.
cli.storage.name;
02
Access stored dataRead any answered prompt by name. Fully typed, available anywhere in your run handler.
await cli.spin("Installing...", fn);
03
Spin async workWrap any async function in a spinner. Shows elapsed time on completion.
cli.flags.verbose;
04
Type-safe flagsDefine flags in the same schema as your prompts. Read via cli.flags, fully typed.
theme: "rounded";
05
ThemeableChoose a built-in preset or customize colors and symbols via the theme property.
cli.note("Heads up", message);
06
Rich displayBoxes, notes, tables, trees, and progress bars. All styled by your theme.