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

@neobbs/core

v0.1.1

Published

Modular engine for building interactive terminal applications.

Readme

@neobbs/core

Core engine for building modular, interactive terminal applications.

Part of the neobbs project.

Installation

npm install @neobbs/core

Basic Example

const Engine = require('@neobbs/core');
const { createMenu, createFlow } = require('@neobbs/core');

const engine = new Engine();

engine.registerRoute('home', (session) => {
  session.send({ type: 'header', title: 'My App' });
  session.send('Hello, ' + session.user.username);
  session.send({ type: 'footer' });
});

const session = engine.createSession({
  user: { username: 'alice', permissions: [] },
});

engine.navigate(session, 'home');

Concepts

Engine

The central runtime. Holds routes, services, permissions, and event listeners. Everything connects through it.

const engine = new Engine();

Plugins

A plugin is a plain function that receives the engine and registers routes, services, and permissions. This is the primary extension mechanism.

function myPlugin(engine) {
  engine.registerPermission('myapp:item:read');
  engine.registerRoute('myapp', (session) => {
    session.send('Hello from myapp');
  });
}

engine.use(myPlugin);

Routes

Named handlers that receive a session and produce output via session.send().

engine.registerRoute('home', (session) => {
  session.send('Welcome!');
});

engine.navigate(session, 'home');

Sessions

Represent a connected user. Hold identity, state, navigation history, and I/O channels.

const session = engine.createSession({
  user: { username: 'alice', permissions: ['app:read'] },
  _out: (msg) => myRenderer.render(msg),  // plug in your renderer
});

Session fields:

| Field | Description | |---|---| | id | Auto-incremented integer | | user | { username, permissions[] } or null | | state | Per-session mutable store | | currentRoute | Active route name | | history | Previously visited routes | | send(msg) | Send a string or message object | | onInput(fn) | Register an input handler | | clearInput() | Remove all input handlers | | goBack() | Navigate to the previous route |

Permissions

Declared by plugins, checked in services and menus.

engine.registerPermission('blog:post:create');
engine.hasPermission(session.user, 'blog:post:create'); // → true/false

Format: domain:resource:action

Navigation

engine.navigate(session, 'blog');  // pushes current route to history
session.goBack();                  // pops and returns to previous route

Events

engine.on('route:enter', ({ session, route }) => { /* ... */ });
engine.on('route:after', ({ session, route }) => { /* ... */ });
engine.on('error',       ({ session, route, error }) => { /* ... */ });

Services

engine.registerService('myService', { doThing() { /* ... */ } });
engine.getService('myService').doThing();

Helpers

createMenu

const { createMenu } = require('@neobbs/core');

createMenu(engine, session, {
  title: 'Choose:',
  options: [
    { key: '1', label: 'Blog',  route: 'blog' },
    { key: '2', label: 'Admin', route: 'admin', permission: 'system:admin:access' },
  ],
});

Options with a permission field are only shown to users who have that permission. [0] Back is added automatically when history is non-empty.

createFlow

Multi-step input flow helper.

const { createFlow } = require('@neobbs/core');

createFlow(session, [
  {
    prompt: 'Enter title:',
    validate: (input) => input ? null : 'Title cannot be empty.',
    next: (session, input) => { session.state.title = input; },
  },
  {
    prompt: 'Enter content:',
    validate: (input) => input ? null : 'Content cannot be empty.',
    next: (session, input) => {
      saveItem(session.state.title, input);
      engine.navigate(session, 'list');
    },
  },
]);

Each step renders its prompt, registers an input handler, validates, and advances automatically on success. On validation failure, the error is shown and the prompt is re-rendered.

License

MIT — see LICENSE