npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

icore

v3.0.2

Published

Typed CLI command mechanics for Node.js that keep argument parsing separate from application logic

Readme

icore

npm version node types license

icore is a TypeScript library for building command-line interfaces in Node.js® applications. It helps an application define commands, parse arguments, run the selected command, and write text, table, JSON, or CSV output.

The library provides the shared command-line mechanics. The application provides its API calls, configuration, business rules, help text, and interactive terminal behavior.

Installation

To use icore in your project, run:

npm install icore

Quick Start

Create commands, collect them in a command registry, and pass the registry to createTerminalApp():

import { createCommand, createTerminalApp } from 'icore';

const command = createCommand();

const commands = command.registry([
  command.define({
    path: ['hello'],
    options: {
      name: {
        type: 'string',
        default: 'world'
      },
      uppercase: {
        type: 'boolean'
      }
    },
    handle({ options }) {
      const greeting = `Hello, ${options.name}!`;

      return `${options.uppercase ? greeting.toUpperCase() : greeting}\n`;
    }
  })
] as const);

const app = createTerminalApp({ commands });

async function main(args: readonly string[]): Promise<void> {
  process.exitCode = await app.run(args, undefined, {
    strict: true
  });
}

void main(process.argv.slice(2));

After building the application:

$ node dist/cli.js hello
Hello, world!

$ node dist/cli.js hello --name Alice --uppercase
HELLO, ALICE!

The options object describes arguments accepted after hello. The handle function receives their parsed values.

app.run(...) validates the arguments, runs the selected command, formats its result, and writes it to the terminal. With strict: true, the command name and any subcommands must come before options: users get --id 42.

Choose An API

| What the application needs | Start with | Example | | --- | --- | --- | | Run a command immediately | app.run(...) | Quick Start | | Handle global flags or create and close resources | app.prepare(...) and app.commands.run(...) | Set Up Command Execution And Cleanup | | Define commands and their options | createCommand(), createCommand.withTypes(), or createCommands() | Define Command Options | | Prepare a command before creating application services | commands.prepare() and commands.run() | Prepare And Run Commands Yourself | | Format JSON, table, and CSV with shared fields or separate data | createPresentation() for shared fields; renderJson(), renderTextTable(), or renderCsv() for separate data | Format And Write Output | | Write directly to standard output or standard error | createOutput() | Write Output | | Parse arguments or resolve a command directly | parseArgv(), resolveCommand(), and related exports | Direct APIs |

app.run(args, context) passes the application's context to the selected handler. When commands in a registry require different context types, TypeScript checks context against their union independently of args. For example, if users requires userId and projects requires projectId, app.run(['users'], { projectId: 'p42' }) can compile. To check the pairing, first get the selected command with const prepared = await app.prepare(args). Inside if (isPreparedCommandName(prepared, 'users')), app.runPrepared(prepared, context) requires the users context.

Errors

IcoreError describes invalid command lines and invalid command definitions. Use isIcoreError(...) to inspect one and isUsageError(...) to identify errors caused by user input. For application-specific input rules, throw CliUsageError. The current error types and codes are defined in the error source files.

Examples

All examples are grouped by task.

Release history is in CHANGELOG.md. Design decisions are in docs/roadmap.md.

See the development policies for contributor guidelines.

Licensed under the MIT License.