TypeScript CLI Framework
Build polished CLIswith TypeScript.
$
npm install @oscli-dev/osclisrc/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();Run your promptsAwait any prompt. The typed value is stored in cli.storage automatically.
cli.storage.name;Access stored dataRead any answered prompt by name. Fully typed, available anywhere in your run handler.
await cli.spin("Installing...", fn);Spin async workWrap any async function in a spinner. Shows elapsed time on completion.
cli.flags.verbose;Type-safe flagsDefine flags in the same schema as your prompts. Read via cli.flags, fully typed.
theme: "rounded";ThemeableChoose a built-in preset or customize colors and symbols via the theme property.
cli.note("Heads up", message);Rich displayBoxes, notes, tables, trees, and progress bars. All styled by your theme.