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

@opalesce/cli

v0.1.0

Published

Generate code and other artifacts from AsyncAPI specifications through the Opalesce command-line interface.

Readme

@opalesce/cli

@opalesce/cli turns an opalesce.config.* file into one generation run. It discovers and validates project config, reads the AsyncAPI input, invokes @opalesce/core, persists successful artifacts, and maps failures to command output and exit codes.

Quick Start

Normal projects install the opalesce facade and only the output plugins they use:

{
  "devDependencies": {
    "opalesce": "workspace:*"
  },
  "scripts": {
    "generate": "opalesce generate"
  }
}

Create opalesce.config.ts:

import { defineConfig, definePlugin } from "opalesce";

const metadata = definePlugin(() => ({
  name: "metadata",
  generate(context) {
    return [
      {
        path: "metadata/version.txt",
        contents: `${context.document.version()}\n`,
      },
    ];
  },
}));

export default defineConfig({
  input: "./asyncapi.yaml",
  output: {
    path: "./generated",
    clean: true,
  },
  plugins: [metadata()],
});

Run generation:

opalesce generate

The config only describes the run. The command loads it and invokes the pipeline.

Command

opalesce generate [input] [options]

Arguments:
  input                 Override the input path from the config

Options:
  -c, --config <path>   Use an explicit Opalesce config file
  -o, --out <dir>       Override the output directory
  -h, --help            Show help

Examples:

opalesce generate
opalesce generate ./specs/events.yaml
opalesce generate --config ./configs/opalesce.staging.ts
opalesce generate --out ./src/generated

Config Discovery

Without --config, the CLI searches the invocation directory and then its ancestors for:

  1. opalesce.config.ts
  2. opalesce.config.mts
  3. opalesce.config.cts
  4. opalesce.config.js
  5. opalesce.config.mjs
  6. opalesce.config.cjs

The nearest directory containing a candidate wins. Multiple candidates in that directory are rejected instead of silently selecting one.

An explicit --config path bypasses discovery and resolves from the invocation directory. Custom config names are accepted when they use one of the supported extensions.

Config files execute as trusted project code through Node.js 24 native JavaScript or erasable TypeScript loading.

Path Resolution

  • Paths declared by input and output.path resolve from the config file directory.
  • Positional input and --out overrides resolve from the invocation directory.
  • The CLI normalizes paths to absolute values before reading or writing.
  • The CLI supplies the absolute input file: URL as parser.parse.source, so source-dependent plugins receive a stable URI for reference and identifier resolution.
  • An explicit parser.parse.source in project config remains authoritative.

Output Behavior

The CLI waits for the complete in-memory pipeline to succeed before changing output.

When output.clean is omitted or false, generated paths are overwritten but stale and unrelated files remain. When output.clean is true, the CLI removes the old output directory only when it is a safe strict descendant of the config directory. It rejects the filesystem root, config directory, invocation directory, ancestors of the invocation directory, and paths outside the config directory.

Artifacts are written as UTF-8 text. A persistence error can leave a partial artifact set; atomic replacement is not part of the current command.

Diagnostics and Exit Codes

  • Help and successful summaries use stdout.
  • Parser diagnostics and failures use stderr.
  • Exit code 0 means help or generation succeeded.
  • Exit code 1 means config loading, input reading, pipeline execution, or persistence failed.
  • Exit code 2 means command syntax or options were invalid.

Operational failures are rendered without automatic stack traces.

Architecture

opalesce
  -> @opalesce/cli
  -> @opalesce/config
  -> @opalesce/core

Use Core run directly only when another program already owns input loading and artifact persistence.

@opalesce/cli is an internal package boundary. Consumers receive its executable through opalesce.

Current Boundaries

The CLI does not currently provide watch mode, URL input, config functions or arrays, multiple configs, interactive initialization, validation-only commands, reporters, JSON output, formatting, linting, post-generation commands, or atomic output replacement.