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

@directive-run/lint

v0.1.2

Published

ts-morph-based static analysis for Directive code. Rule registry + executable checks + autofixes. Consumed by @directive-run/mcp (review_source, fix_code tools) and the future `directive doctor lint` CLI command. Anti-pattern data sourced from @directive-

Readme

@directive-run/lint

ts-morph-based static analysis for Directive code. Rule registry + executable checks + autofixes. Consumed by @directive-run/mcp (its review_source and fix_code MCP tools) and by the future directive doctor lint CLI subcommand.

You probably don't depend on this package directly — it's the engine behind the agent-facing review tools. Install it explicitly if you're building static-analysis tooling for Directive codebases.

API

import {
  getRules,
  getRuleById,
  runRules,
  applyFix,
  type Finding,
  type RuleMetadata,
  type RunResult,
  type FixResult,
} from "@directive-run/lint";

// Metadata for every known rule, regardless of whether it has an
// executable check. v0.1.0 ships an empty registry; rules land in v0.2.0.
const rules = getRules();

// Lookup by id
const rule = getRuleById("no-single-line-if-return");

// Actually run the executable rules against a source string.
// ts-morph is loaded lazily — throws a structured error if not installed.
const result = await runRules(`
import { createModule } from "@directive-run/core";
export const x = createModule("x", { schema, init: () => {} });
`);

// Apply a mechanical fix for one finding
const fix = await applyFix(sourceString, result.findings[0]);
fix.ok;        // → true
fix.diff;      // → unified diff
fix.fixedSource;

ts-morph is optionalDependencies

The package declares ts-morph as optionalDependencies so the read-only consumers (just listing rule metadata via getRules) don't pay the ~25 MB install cost. runRules and applyFix lazy-import ts-morph and throw with a clear remediation message if it's missing.

ts-morph is not installed. @directive-run/lint declares it as an
optionalDependencies. Install it explicitly to enable runRules /
applyFix: `npm install ts-morph`.

Worker entry

For long-running parses, use the ./worker subpath export with worker_threads:

import { Worker } from "node:worker_threads";

const worker = new Worker(require.resolve("@directive-run/lint/worker"));
worker.postMessage({ kind: "run", source });
worker.on("message", ({ ok, result, error }) => { /* … */ });

// terminate() after a budget — synchronous ts-morph cannot be aborted
// any other way
setTimeout(() => worker.terminate(), 5000);

The MCP server uses this pattern to bound review_source parse cost.

See also

  • @directive-run/mcp — exposes review_source, fix_code, list_review_rules, get_review_rule MCP tools that wrap this package.
  • @directive-run/knowledge — anti-pattern markdown sources (packages/knowledge/core/anti-patterns.md); rule IDs in this package match knowledge's parsed anti-pattern IDs.
  • @directive-run/coredoctor namespace for runtime constraint checks (different scope: runtime, not source).