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

@e9n/pi-kysely

v0.1.0

Published

Shared Kysely registry extension for pi coding agents

Readme

@e9n/pi-kysely

Shared Kysely database registry for pi. Provides a single managed database connection (SQLite, PostgreSQL, or MySQL) that other extensions access via the event bus, with table-level RBAC and a built-in migration system.

Features

  • Shared database — one connection pool for all extensions in a session
  • Multi-driver — SQLite (default), PostgreSQL, and MySQL
  • Table-level RBAC — extensions own prefixed tables and grant selective access to others
  • Migration system — generate SQL diffs and apply versioned migrations with checksum integrity
  • Event bus API — extensions interact via kysely:* events (no direct import needed)
  • /kysely command — inspect registered databases and applied migrations at runtime

Setup / Settings

Add to ~/.pi/agent/settings.json (global) or .pi/settings.json (project):

SQLite (default)

{
  "kysely": {
    "driver": "sqlite",
    "sqlitePath": "db/kysely.db",
    "databaseName": "default",
    "autoCreateDefault": true
  }
}

PostgreSQL

{
  "kysely": {
    "driver": "postgres",
    "databaseUrl": "postgres://user:pass@localhost:5432/app"
  }
}

MySQL

{
  "kysely": {
    "driver": "mysql",
    "databaseUrl": "mysql://user:pass@localhost:3306/app"
  }
}

| Key | Default | Description | |-----|---------|-------------| | driver | "sqlite" | Database driver: sqlite, postgres, or mysql. | | sqlitePath | "db/kysely.db" | SQLite file path (relative to agent dir or .pi/). Supports ~. | | databaseName | "default" | Name for the default registered database. | | databaseUrl | — | Connection URL for postgres/mysql. Falls back to DATABASE_URL env var. | | autoCreateDefault | true | Auto-create the default database on session start. |

sqlitePath is resolved relative to the settings file's directory (~/.pi/agent for global, .pi/ for project). Absolute paths and ~ are supported.

Event Bus API

Other extensions communicate with pi-kysely entirely via events. No direct imports required.

Schema & Queries

| Event | Description | |-------|-------------| | kysely:schema:register | Apply DDL via Kysely schema builder (create tables, indexes) | | kysely:query | Execute a parameterised raw SQL query |

Migrations

| Event | Description | |-------|-------------| | kysely:migration:generate | Diff desired schema vs live DB and return migration SQL | | kysely:migration:apply | Apply stored migration files (skips already-applied by name + checksum) | | kysely:migration:status | List applied migrations, optionally filtered by actor |

RBAC

| Event | Description | |-------|-------------| | kysely:grant | Grant table operations to another extension | | kysely:revoke | Revoke previously granted access | | kysely:grants | List current grants |

Lifecycle

| Event | Direction | Description | |-------|-----------|-------------| | kysely:ready | emitted | Database is initialised and ready; payload contains registered databases and default driver | | kysely:info | listened | Probe whether pi-kysely is available; reply callback receives the ready payload | | kysely:ack | emitted | Write confirmation when a requestId is included in the payload |

RBAC model

Each extension owns tables prefixed with <extensionId>__ (e.g. notes__items). Owners can grant select, insert, update, or delete on their tables to other extensions. RBAC is an in-process cooperative guard — not an OS-level sandbox.

Migration integrity

Migrations are identified by actor + name and checksummed (SHA-256, first 16 hex chars). Modifying a migration file after it has been applied causes a checksum mismatch error. Migrations are applied in sorted name order and stop on first error.

Commands

| Command | Description | |---------|-------------| | /kysely or /kysely status | List registered databases (name, driver, label) | | /kysely close <name> | Unregister and destroy one database connection | | /kysely close-all | Unregister and destroy all database connections | | /kysely migrations [actor] | List applied migrations, optionally filtered by actor |

Install

pi install npm:@e9n/pi-kysely

Database drivers (better-sqlite3, pg, mysql2) are bundled as dependencies.

License

MIT