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

@specd/core

v0.2.0

Published

The domain library for [specd](https://github.com/specd-sdd/SpecD) — a spec-driven development platform. For more information, visit [getspecd.dev](https://getspecd.dev).

Readme

@specd/core

The domain library for specd — a spec-driven development platform. For more information, visit getspecd.dev.

Installation

pnpm add @specd/core

@specd/core requires Node.js 18 or later and is published as ESM.

Key concepts

| Concept | Description | | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Change | An in-progress spec change moving through a schema-defined lifecycle (e.g. draftingdesigningimplementingverifyingdone). | | Spec | A directory of artifact files that defines one capability (e.g. default:auth/oauth). | | Schema | A YAML file that declares artifact types, workflow steps, hooks, validation rules, and extraction rules for a project. | | Kernel | A fully-wired set of use cases constructed from a resolved SpecdConfig. The recommended way to consume the library. | | Port | An abstract interface (repository, VCS adapter, hook runner, etc.) that the application layer depends on. Infrastructure adapters implement ports; callers receive port types. |

Architecture

@specd/core is organized in three layers with a strict one-way dependency flow:

┌──────────────────────────────────────┐
│             domain/                  │
│  Entities · Value objects · Errors   │
│  No I/O. No external dependencies.  │
└──────────────────┬───────────────────┘
                   │
┌──────────────────▼───────────────────┐
│           application/               │
│  Use cases · Ports (interfaces)      │
│  Depends on domain only.             │
└──────────────────┬───────────────────┘
                   │
┌──────────────────▼───────────────────┐
│         infrastructure/              │
│  Fs adapters · Git · Hooks           │
│  Internal. Never imported directly.  │
└──────────────────┬───────────────────┘
                   │
┌──────────────────▼───────────────────┐
│           composition/               │
│  createKernel · factory functions    │
│  Exported. Returns abstract types.   │
└──────────────────────────────────────┘

The infrastructure/ layer is intentionally not importable directly. All concrete adapters are created through the factory functions in composition/, keeping callers decoupled from storage and VCS implementation details.

Usage

Create a kernel

The Kernel is the standard entry point. Load config with createConfigLoader, then pass it to createKernel:

import { createConfigLoader, createKernel } from '@specd/core'

const loader = createConfigLoader({ startDir: process.cwd() })
const config = await loader.load()

const kernel = await createKernel(config)

Create a change

const schema = await kernel.schemas.resolve(config.schemaRef)

const change = await kernel.changes.create.execute({
  name: 'add-oauth-login',
  specIds: ['default:auth/oauth'],
  schemaName: schema.name,
  schemaVersion: schema.version,
})

Transition a change through its lifecycle

await kernel.changes.transition.execute({
  name: 'add-oauth-login',
  to: 'implementing',
  approvalsSpec: config.approvals.spec,
  approvalsSignoff: config.approvals.signoff,
})

Use a single use case without a full kernel

When you only need one or two use cases, the individual create* factory functions wire a single use case to the filesystem without constructing the full kernel:

import { createConfigLoader, createListChanges } from '@specd/core'

const loader = createConfigLoader({ startDir: process.cwd() })
const config = await loader.load()

const listChanges = createListChanges(config)
const changes = await listChanges.execute()

Public API

Everything exported from @specd/core is a domain type, an application type, or a composition factory. The public surface includes:

  • EntitiesChange, Spec, ChangeArtifact, Delta, ArchivedChange
  • Port interfacesChangeRepository, SpecRepository, ArchiveRepository, SchemaRegistry, HookRunner, VcsAdapter, FileReader, ArtifactParser, and more
  • ~30 use cases — grouped as kernel.changes.*, kernel.specs.*, kernel.project.*
  • Composition factoriescreateKernel, createConfigLoader, createSchemaRegistry, createVcsAdapter, VCS adapter classes
  • Domain errors — all extend SpecdError and carry a typed code property

See the full export reference in docs/core/overview.md.

Documentation

| Document | Read when you need to… | | ------------------------------------------------------------ | ---------------------------------------------------------------------- | | docs/core/overview.md | Full export reference — every public type, port, use case, and factory | | docs/core/domain-model.md | Understand the entities and value objects returned from use cases | | docs/core/ports.md | Implement a custom repository, schema registry, or other port | | docs/core/use-cases.md | Wire and call use cases from a delivery adapter | | docs/core/errors.md | Handle errors in a delivery layer | | docs/core/services.md | Use domain service functions such as hashFiles and buildSchema |

License

MIT