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

ospm

v0.0.1

Published

A modern package manager for JavaScript/TypeScript projects

Readme

OSPM CLI Architecture

Overview

OSPM CLI is a package manager command-line interface based on the pnpm codebase. It provides a comprehensive set of commands for managing JavaScript/TypeScript dependencies in projects and workspaces. The CLI is designed with a modular architecture that facilitates extensibility and maintainability.

Directory Structure

The CLI codebase is organized in the following structure:

cli/ospm/src/
├── cmd/                  # Core command definitions and help text
├── packages/             # Modular functionality organized into packages
├── reporter/             # Output formatting and reporting tools
├── checkForUpdates.ts    # Version checking and update notifications
├── errorHandler.ts       # Error handling and formatting
├── formatError.ts        # Error message formatting
├── index.ts              # Entry point
├── main.ts               # Main CLI logic
├── parseCliArgs.ts       # Command-line argument parsing
├── runNpm.ts             # Integration with npm command passthrough
├── shorthands.ts         # Command shorthand definitions
├── switchCliVersion.ts   # Version switching logic
└── types.ts              # TypeScript type definitions

Core Architecture

The OSPM CLI follows a command-based architecture where:

  1. index.ts serves as the entry point, determining whether to pass commands to npm or handle them internally
  2. main.ts contains the core logic for command execution, configuration loading, and environment setup
  3. parseCliArgs.ts provides argument parsing functionality
  4. Commands are organized as modules in the packages/ directory
  5. Error handling is centralized through errorHandler.ts

Command Structure

Commands are organized into specific categories based on their functionality:

Installation Commands

  • add: Add dependencies to package.json
  • install/i: Install dependencies
  • update: Update dependencies
  • remove: Remove dependencies
  • link/unlink: Manage symlinked packages

Publishing Commands

  • publish: Publish packages to the registry
  • pack: Create package tarballs

Script Running Commands

  • run: Execute scripts defined in package.json
  • exec: Execute shell commands in packages
  • dlx: Execute binaries from npm packages without installation
  • create: Initialize new projects from templates

Configuration Commands

  • config: Manage OSPM configuration settings

Workspace Commands

  • Workspace-aware versions of installation and script commands that operate across multiple packages

Key Components

Command Implementation Pattern

Each command follows a consistent structure:

  1. Command definition including:

    • Command name(s)
    • Help text
    • Accepted options (CLI and rc file)
    • Option shorthands
  2. Handler function that executes the command logic

  3. Supporting utility functions specific to the command

Configuration System

OSPM uses a comprehensive configuration system that allows settings to be specified through:

  1. Command-line arguments
  2. Project-level configuration (.npmrc)
  3. Global user configuration
  4. Sensible defaults

The configuration is loaded via the getConfig function from the cli-utils package.

Extensibility

The CLI is designed to be extensible through:

  1. Modular package structure
  2. Clear separation of concerns
  3. Consistent command interface
  4. Pluggable reporter system

Notable Features

Template-based Project Creation

The create command provides a flexible way to initialize new projects:

  • Supports templates from npm packages with create- prefix
  • Handles scoped packages with consistent naming conventions
  • Allows version specification for templates

Passthrough to npm

Some commands are passed directly to npm rather than reimplemented.

Workspace Support

Many commands are workspace-aware, allowing operations across multiple packages in a monorepo structure.

Error Handling

The CLI implements a robust error handling system:

  1. Custom PnpmError class for structured errors
  2. Consistent error formatting
  3. Helpful error messages with suggestions when possible

Conclusion

OSPM is a sophisticated package management CLI built on the foundation of pnpm. Its modular architecture, comprehensive command set, and robust error handling make it a powerful tool for managing dependencies in JavaScript/TypeScript projects.

The codebase demonstrates strong software engineering principles including:

  1. Separation of concerns
  2. Modularity
  3. Consistent interfaces
  4. Comprehensive error handling
  5. Clear command structure

This architecture makes the CLI both powerful for users and maintainable for developers.