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

@specverse/engine-parser

v4.0.4

Published

SpecVerse parser engine — parse .specly files into SpecVerseAST

Readme

@specverse/engine-parser

Parse .specly files (YAML + Conventions format) into a validated SpecVerseAST.

Purpose

This package is the front door of the SpecVerse pipeline. It reads .specly specification files, validates them against a composed JSON Schema, runs entity-module convention processors to expand shorthand into full AST nodes, resolves cross-file imports, and produces a SpecVerseAST ready for inference and realization. Schema validation runs twice — once before convention processing (to catch syntax errors early) and once after (to validate the expanded output).

Installation

npm install @specverse/engine-parser

Dependencies

| Package | Why | |---------|-----| | @specverse/types | AST types, engine interfaces, ParseResult/ParseOptions | | @specverse/engine-entities | Entity module convention processors used during parsing | | ajv | JSON Schema validation (runs twice: pre- and post-convention processing) | | ajv-formats | Format validators for JSON Schema (e.g., uri, date-time) | | js-yaml | YAML parsing of .specly files |

Key Exports

| Export | Type | Description | |--------|------|-------------| | UnifiedSpecVerseParser | class | Main parser — schema validation, convention processing, import resolution | | parseSpecVerseFile | function | Convenience: parse a .specly file given file and schema paths | | parseSpecVerse | function | Convenience: parse YAML content string with a schema object | | ConventionProcessor | class | Runs entity-module convention processors over parsed YAML | | ImportResolver | class | Resolves imports: directives across .specly files with caching | | parseNamespace, parseReference, validateNamespace | function | Namespace parsing and validation utilities | | engine | ParserEngine | Singleton engine instance for EngineRegistry discovery | | SpecVerseAST, ModelSpec, ControllerSpec, ... | type | Re-exported AST types for consumer convenience | | ParseOptions, ParseResult, ValidationError | type | Parser input/output types |

Usage

import { parseSpecVerseFile } from '@specverse/engine-parser';

const result = parseSpecVerseFile('./my-app.specly', './schema.json');

if (result.errors.length > 0) {
  console.error('Validation errors:', result.errors);
} else {
  console.log(`Parsed ${Object.keys(result.ast.models ?? {}).length} models`);
}

Architecture

src/
├── unified-parser.ts          # UnifiedSpecVerseParser — orchestrates the full parse pipeline
├── convention-processor.ts    # Runs entity-module convention processors over raw YAML
├── namespace-utils.ts         # Namespace parsing and reference resolution
├── import-resolver/
│   ├── resolver.ts            # ImportResolver — cross-file import resolution with caching
│   ├── cache.ts               # Import cache for resolved files
│   └── types.ts               # Import resolver type definitions
├── processors/                # Built-in AST processors (one per component type)
│   ├── AbstractProcessor.ts   # Base class for all processors
│   ├── ModelProcessor.ts      # Expands model shorthand (attributes, relationships, lifecycle)
│   ├── ControllerProcessor.ts # Controller convention processing
│   ├── ServiceProcessor.ts    # Service convention processing
│   ├── EventProcessor.ts      # Event convention processing
│   ├── ViewProcessor.ts       # View convention processing
│   ├── DeploymentProcessor.ts # Deployment convention processing
│   ├── AttributeProcessor.ts  # Attribute type expansion
│   ├── RelationshipProcessor.ts # Relationship shorthand expansion
│   ├── LifecycleProcessor.ts  # Lifecycle state machine processing
│   └── ExecutableProcessor.ts # Executable property processing
├── types/
│   ├── ast.ts                 # Local AST type definitions
│   └── views.ts               # View-specific types
└── index.ts                   # Barrel exports + convenience functions + engine adapter

Parse Pipeline

  1. YAML parse — Read .specly content into raw JavaScript objects
  2. Pre-convention schema validation — Validate raw YAML against composed JSON Schema (catches syntax errors early)
  3. Convention processing — Entity-module convention processors expand shorthand into full AST nodes
  4. Post-convention schema validation — Validate expanded output against the same schema (ensures processors produced valid output)
  5. Import resolution — Resolve imports: directives, merge referenced specifications
  6. AST construction — Produce final SpecVerseAST with all components fully expanded

See Also