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

openspec-generator

v0.2.1

Published

AI-friendly Markdown DSL → OpenAPI 3.1 + readable docs + HTML dashboard + Try It + mock server + SDK + export + diff + lint + coverage.

Readme

OpenSpec Generator v0.2.0

AI-friendly Markdown DSL → OpenAPI 3.1 + readable docs + HTML dashboard with live Try It + mock server + SDK generator + diff + lint + coverage.

Designed so AI (and humans) can write API schemas without touching raw OpenAPI. The CLI scans, validates, exports, and auto-updates docs.

Install (dev / local)

npm install
npm run build

Install from npm (after publish)

npm install -D openspec-generator

Quick start

npx openspec-generator init my-api
cd my-api
npx openspec-generator generate api.md --out output
npx openspec-generator serve --port 4321 --dir output

All commands

Core

| Command | Purpose | | --- | --- | | init [path] | Scaffold api.md + AI prompt | | generate [file\|dir] --out <dir> | Build openapi.yaml, api-docs.md, dashboard.html, ai-report.md | | validate [file\|dir] | Check completeness, exit 1 on errors | | format [file\|dir] [--write] | Format DSL to stdout or file | | scan [dir] --out <dir> [--watch] | Scan folder of DSL files, optionally watch | | bundle <a> <b> ... --out <dir> | Merge multiple DSL files | | watch <file\|dir> --out <dir> | Regenerate on file change | | serve --port 4321 --dir output | Serve generated dashboard |

Import / Export

| Command | Purpose | | --- | --- | | import-postman <file> --out <md> | Convert Postman v2.1 → DSL | | export-postman --out <json> | DSL → Postman collection | | export-insomnia --out <json> | DSL → Insomnia v4 export | | export-curl --out <sh> | DSL → cURL snippets |

AI

| Command | Purpose | | --- | --- | | infer <notes> --out <dsl> | Heuristic DSL from free-form notes/curl/JSON | | chat [target] | Interactive REPL DSL builder | | ai-fill <dsl> --out <dsl> | Use LLM to fill missing fields | | ai-infer <notes> --out <dsl> | Use LLM to convert notes to DSL |

AI options:

--provider <anthropic|openai|mock>   (default: mock)
--api-key <key>                       (or set ANTHROPIC_API_KEY / OPENAI_API_KEY)
--model <model>                       (default: claude-3-5-sonnet / gpt-4o)

Server & Testing

| Command | Purpose | | --- | --- | | mock <spec> --port 3000 | Run mock server from spec (returns realistic JSON) | | diff <old> <new> --out <md> | Compare two specs, show changes | | breaking <old> <new> | Show only breaking changes, exit 1 | | lint <file> --out <md> | Best-practice checker (10+ rules) | | coverage <file> --out <md> | Endpoint coverage report | | hit <METHOD> <path> | Record endpoint hit for coverage |

Generation

| Command | Purpose | | --- | --- | | readme <file> --out <md> | Generate README.md with table of endpoints | | sdk <file> --out <ts> | Generate TypeScript SDK class | | changelog <old> <new> --version <v> | Generate changelog from diff |

OpenAPI round-trip

# OpenAPI → DSL (read existing spec)
npx openspec-generator from-openapi openapi.yaml --out api.md   # via import-postman for Postman

# DSL → OpenAPI
npx openspec-generator generate api.md --out output   # produces openapi.yaml

Config (.openspecrc.json)

Optional config file in project root. CLI flags override config.

{
  "schemaFile": "api.md",
  "schemaDir": "schemas",
  "output": "docs/api",
  "watch": true,
  "port": 4321
}
  • schemaFile — single DSL file when no args given.
  • schemaDir — directory of .md / .yaml / .json schemas to scan.
  • output — default output directory.
  • watch — when true, scan watches the directory and regenerates on save.
  • port — port for serve command.

Dev loop (auto-update)

# Terminal 1: watch folder of DSL files
npx openspec-generator watch schemas --out output

# Terminal 2: serve dashboard
npx openspec-generator serve --port 4321 --dir output

Edit DSL → output auto-regenerates → refresh browser.

AI DSL cheatsheet

API: <name>
Version: <semver>
Server: <base url>
ApiDescription: <description>

# <Endpoint Title>
<METHOD> <PATH>
Description: <what it does>
Auth: Bearer token
Tags: <tag1, tag2>
DependsOn: <other endpoint>
Flow: <process flow>
Condition:
- <business rule>

PathParams:
id string required - ID resource.

Query:
page integer optional minimum=1 - Halaman.

Headers:
Authorization string required - Bearer token.

Body:
email email required - Email user.

FormData:
avatar file required maxSize=2MB contentType=image/* - Avatar image.

Success 200:
id string required - ID resource.

Error 400:
message string required - Pesan error.

HTML Dashboard

Open output/dashboard.html or serve via openspec-generator serve.

Features:

  • 4 tabs: Overview, Endpoints, Flow, Try It
  • Sidebar endpoint list (Postman-style)
  • Tag filter bar + search input in Endpoints tab
  • Native HTML/CSS flowchart (no CDN, fully offline)
  • Try It: live request, path/query/header/body builders, JSON / form-data / url-encoded support, file upload, response viewer
  • Dark glassmorphism UI, responsive, fully offline (no external dependencies)

Why this is AI-friendly

  • DSL is a tiny subset of Markdown, easy for LLMs to emit.
  • No need to write OpenAPI YAML, JSON Schema, or HTML.
  • Validator reports exactly which fields are missing or weak.
  • format normalizes AI output to consistent style.
  • import-postman lets AI start from real collections.
  • ai-fill and ai-infer use real LLM providers (Anthropic, OpenAI) with --provider mock for offline testing.
  • infer uses heuristics to bootstrap DSL from free-form notes/curl/JSON.

Dev scripts

npm run build      # tsc → dist/
npm run dev        # tsx src/cli.ts examples/simple-api.md --out output
npm run sample     # npm run build && node dist/cli.js scan examples --out output

Publish

npm login
npm publish --access public

files in package.json ships only dist/, README.md, prompts/, examples/. prepublishOnly builds TS first.

CI/CD (GitHub Actions)

Workflows in .github/workflows/:

| File | Trigger | Purpose | | --- | --- | --- | | ci.yml | push, PR | Build, type-check, lint, validate, test all commands, verify dashboard integrity, upload artifacts. Runs on Node 22 + 24. | | publish.yml | tag v*.*.*, manual | Verify version, check registry conflict, publish to npm with provenance, create GitHub release. | | docs.yml | push main | Build dashboard + README, deploy to GitHub Pages. | | smoke.yml | push, PR | Start mock server, hit endpoints with curl, verify JSON responses. |

Local CI parity

npm run test:all    # lint + validate + smoke

Project structure

openspec-generator/
  package.json
  tsconfig.json
  .openspecrc.example.json
  README.md
  examples/
    simple-api.md
  prompts/
    ai-api-doc-prompt.md
    endpoint-template.md
  src/
    cli.ts
    commands.ts        # all subcommands
    config.ts          # .openspecrc.json
    parser.ts          # DSL → ApiSpec
    generator.ts       # OpenAPI YAML
    html.ts            # dashboard
    markdown.ts        # api-docs.md
    validator.ts       # completeness report
    lint.ts            # best-practice rules
    diff.ts            # spec comparison
    breaking.ts        # breaking changes
    mock.ts            # mock server
    export.ts          # Postman/Insomnia/curl
    sdk.ts             # TypeScript SDK
    readme.ts          # README.md generator
    changelog.ts       # changelog generator
    coverage.ts        # endpoint coverage
    infer.ts           # heuristic DSL inference
    chat.ts            # interactive REPL
    llm.ts             # AI provider integration
    postman.ts         # Postman import
    openapi.ts         # OpenAPI loader
    format.ts          # DSL formatter
    init.ts            # project scaffolder
    scan.ts            # folder scan
    types.ts
  output/              # generated

License

MIT