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

@moldig/core

v0.1.2

Published

The moldig engine: the index, adapters, detectors and graph for the files AI coding harnesses leave across your projects.

Readme

@moldig/core

The engine behind moldig: the read-only scan that turns what six AI coding harnesses left on a machine into one index, the detectors that read findings out of it, and the actions engine that plans what a removal would do. No terminal dependency of any kind, so a CLI, an app or a CI job can all embed it.

npm install @moldig/core

ESM only, Node.js 22.18 or newer. The API is not stable before 1.0; the version moves in lockstep with moldig.

What is in it

| | | |---|---| | The index | index v0 (schemaVersion: 0): harnesses, projects, breadcrumbs, entities, edges, warnings and totals. The contract shared by the CLI and anything else that reads a scan | | The adapters | one per harness — Claude Code, Codex, Cursor, Gemini CLI, Copilot, OpenCode — plus one for the stores several harnesses share. Each knows where its harness keeps its files and turns them into entities. Read-only, always | | The detectors | the eight categories (duplicate, orphan, bloat, drift, shadow memory, autogenerated, harness cache, exposure) and the headline number | | The actions engine | pure planning: what a clean, delete or update would touch, the disposition of each target, the backups and the shape of the run manifest. The executors that actually move anything are injected by the caller (Executors), so this package never touches the trash, spawns a process or writes a file | | The graph | the typed edges between entities: names, names a tool, references, loaded by, duplicates, originates from, shadows, imports, provided by, lists |

Index v0 is the contract. It is frozen at schemaVersion: 0 for v1: field order and enum values are deterministic, unknown is null and never false, and ids are opaque — never parse one.

Using it

import { scan, audit } from "@moldig/core";
import { homedir } from "node:os";

const index = await scan({
  home: homedir(),
  roots: [],            // or the directories to limit the scan to
  cwd: process.cwd(),
  platform: process.platform as "darwin" | "linux" | "win32",
  env: process.env,
});

const audited = await audit(index);

console.log(audited.totals.bytes, audited.findings.length);
for (const warning of audited.warnings) console.error(warning.code, warning.message);

Nothing is read from the process: home, roots, cwd, platform and env are all injected, so the same tree yields the same index on every machine. scan also takes harnesses (restrict the adapters that run), git (false never spawns git), now (a deterministic clock) and isProcessAlive (the live guard). audit takes focus and readSignal.

The rest of the surface: HARNESSES, SCAN_PLATFORMS with isScanPlatform and assertScanPlatform; CATEGORY_ORDER, PINNED_FLAGS, compareForDisplay and compareSerialised for the one display order the CLI and the app share; isCleanable, isPreselected, isTickable, isProtected, isLive and selectionFrom for what may be acted on; plan and apply with Executors; dataDirFor, manifestPathFor and backupDirFor; updatePreview; MULTIPLIERS and modelFamilyOf for the token ranges. Every index v0 type is exported alongside them.

Runtime notes

  • Tokens are counted with gpt-tokenizer (o200k), loaded lazily so nothing pays for it until a scan counts. When it cannot be loaded, counts fall back to bytes / 4 and the scan reports a tokenizer-fallback warning rather than pretending. The index records which tokenizer and encoding ran, and whether it fell back, under tokenizer.
  • Parsing uses jsonc-parser and smol-toml. A file that will not parse becomes a parse-error warning, never a throw.
  • Databases are read through node:sqlite, imported lazily and opened read-only (?immutable=1, falling back to ?mode=ro) so no -wal or -shm sidecar is ever created. On Node 22 the first import prints one ExperimentalWarning about SQLite; the host decides whether to filter it — this package installs no process listener and prints nothing itself.
  • Credential stores are stat'ed and never opened.

@moldig/core/testing

loadFixture and normaliseSnapshot are exported so every package in the moldig monorepo shares one fixture helper, and they are monorepo-internal on purpose. loadFixture walks up from its own module looking for the repository's fixtures/ directory; the fixture cases are not in this package's files, so outside a checkout of the monorepo it throws an error saying exactly that. Do not build on it.

MIT © Guillermo López