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

@kb-labs/impact-core

v2.29.0

Published

Core implementation of KB Labs Impact Analysis Plugin.

Readme

@kb-labs/plugin-template-cli

Reference CLI/REST/Studio plugin package for KB Labs Plugin Template.

Vision & Purpose

@kb-labs/plugin-template-cli is the canonical example plugin package used by @kb-labs/plugin-template.
It shows how to implement a plugin that exposes:

  • a CLI command (Hello),
  • a REST handler, and
  • a Studio widget,

all driven by a single manifest and contracts package.

Package Status

  • Version: 0.1.0
  • Stage: Stable (template)
  • Status: Reference Implementation ✅

Architecture

High-Level Overview

plugin-cli
    │
    ├──► contracts     (from @kb-labs/plugin-template-contracts)
    ├──► shared        (constants/helpers)
    ├──► domain        (Greeting entity and invariants)
    ├──► application   (use-cases: create greeting, etc.)
    ├──► cli           (Hello command wiring)
    ├──► rest          (Hello REST handler + schema)
    └──► studio        (Hello Studio widget)

Key Components

  • src/domain/: Greeting entity and domain rules
  • src/application/: use-cases that orchestrate domain logic
  • src/cli/commands/hello/*: CLI command implementation
  • src/rest/handlers/hello-handler.ts: REST handler bound to manifest
  • src/studio/widgets/hello-widget.tsx: Studio widget implementation
  • src/manifest.v2.ts: Plugin manifest v2 (CLI/REST/Studio wiring)

Features

  • Single-source manifest for CLI/REST/Studio surfaces
  • Layered architecture (shared → domain → application → interface)
  • Type-safe contracts via @kb-labs/plugin-template-contracts
  • Hello-world flow demonstrating end-to-end plugin wiring

Exports

From src/index.ts:

  • manifest: Plugin Manifest V2
  • All public surfaces:
    • CLI command exports
    • domain/application/shared re-exports

Dependencies

Runtime

  • @kb-labs/setup-operations: reusable setup operations
  • @kb-labs/plugin-manifest: manifest types and helpers
  • @kb-labs/plugin-template-contracts: public contracts for this template plugin
  • @kb-labs/shared-cli-ui: shared CLI UI helpers
  • react, react-dom, zod

Development

  • @kb-labs/devkit: shared TS/ESLint/Vitest/TSUP presets
  • typescript, tsup, vitest, rimraf

Scripts

From kb-labs-plugin-template repo root:

pnpm install
pnpm --filter @kb-labs/plugin-template-cli build
pnpm --filter @kb-labs/plugin-template-cli test

To run sandboxes, see the root README.md (pnpm sandbox:cli, sandbox:rest, sandbox:studio).

Command Implementation

This template demonstrates three different approaches to implementing CLI commands:

  1. High-level wrapper (defineCommand) - Recommended for most cases
  2. Low-level atomic tools - For maximum control
  3. Hybrid approach - Combining both

See COMMAND_IMPLEMENTATION_GUIDE.md for detailed explanations and examples.

Quick Start

The template:hello command in src/cli/commands/hello/run.ts shows all three approaches with working code examples. The default implementation uses Approach 1 (defineCommand), which provides:

  • ✅ Zero-boilerplate flag validation
  • ✅ Automatic analytics integration
  • ✅ Structured logging
  • ✅ Error handling
  • ✅ Timing tracking
  • ✅ JSON output mode

Customising for Your Plugin

When using this as a starting point:

  • Rename the package in package.json (e.g. @kb-labs/my-plugin-cli)
  • Update manifest IDs and the contracts package
  • Replace the Hello flow with your own domain, use-cases, and surfaces
  • Choose the command implementation approach that fits your needs (see COMMAND_IMPLEMENTATION_GUIDE.md)