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

criterionx-vscode

v0.3.3

Published

VS Code extension for Criterion decision engine - syntax highlighting, snippets, and validation

Readme

Criterion VS Code Extension

VS Code extension for the Criterion decision engine. Provides syntax highlighting, snippets, and validation for Criterion decision files.

Features

Syntax Highlighting

Enhanced syntax highlighting for Criterion-specific keywords:

  • defineDecision, createRule, createProfileRegistry
  • Status codes: OK, NO_MATCH, INVALID_INPUT, INVALID_OUTPUT
  • Zod schema methods: z.object, z.string, z.number, etc.

Snippets

Quick snippets to scaffold Criterion code:

| Prefix | Description | |--------|-------------| | decision | Create a new decision | | rule | Add a rule to a decision | | profile | Create a profile object | | run | Run a decision with the engine | | inputSchema | Define an input schema | | outputSchema | Define an output schema | | profileSchema | Define a profile schema | | when | Create a when condition | | emit | Create an emit function | | explain | Create an explain function | | test-decision | Create a test for a decision | | server | Create a Criterion server |

Validation

Real-time validation for Criterion decisions:

  • Missing required properties (id, version, schemas)
  • Empty rules array
  • Missing rule properties (when, emit, explain)

Hover Documentation

Hover over Criterion keywords to see documentation:

  • defineDecision
  • inputSchema, outputSchema, profileSchema
  • when, emit, explain

Commands

  • Criterion: New Decision - Create a new decision file with boilerplate

Installation

From VS Code Marketplace

Search for "Criterion" in the VS Code Extensions panel.

Manual Installation

  1. Download the .vsix file from releases
  2. Open VS Code
  3. Press Ctrl+Shift+P / Cmd+Shift+P
  4. Run "Extensions: Install from VSIX..."
  5. Select the downloaded file

Development

# Clone the repository
git clone https://github.com/tomymaritano/criterionx.git
cd criterionx/packages/vscode-extension

# Install dependencies
pnpm install

# Build the extension
pnpm build

# Package the extension
pnpm package

Configuration

| Setting | Default | Description | |---------|---------|-------------| | criterion.validate | true | Enable/disable validation | | criterion.trace | false | Enable trace logging |

Supported File Types

  • .criterion.ts - Dedicated Criterion files
  • .ts / .tsx - TypeScript files containing defineDecision or importing @criterionx/core

Example

import { defineDecision } from "@criterionx/core";
import { z } from "zod";

export const riskDecision = defineDecision({
  id: "transaction-risk",
  version: "1.0.0",

  inputSchema: z.object({
    amount: z.number(),
    country: z.string(),
  }),

  outputSchema: z.object({
    risk: z.enum(["low", "medium", "high"]),
    score: z.number(),
  }),

  profileSchema: z.object({
    threshold: z.number(),
    blockedCountries: z.array(z.string()),
  }),

  rules: [
    {
      id: "blocked-country",
      when: (ctx, profile) => profile.blockedCountries.includes(ctx.country),
      emit: () => ({ risk: "high", score: 100 }),
      explain: (ctx) => `Country ${ctx.country} is blocked`,
    },
    {
      id: "default",
      when: () => true,
      emit: () => ({ risk: "low", score: 0 }),
      explain: () => "Default low risk",
    },
  ],
});

License

MIT