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

ghost-ai

v1.0.0

Published

Background file linting and code quality service.

Readme

ghost-ai

Background code quality daemon for TypeScript, JavaScript, and Java projects.


What it does

Write // @gen: <your instruction> @@ anywhere in a .tsx, .ts, .js, .jsx, or .java file and hit save. The daemon detects the marker, sends the surrounding code as context to an OpenRouter AI model, and atomically replaces the comment with real, working code — indented correctly, formatted with Prettier, and with missing React imports auto-injected.


Installation

Global (run anywhere)

npm install -g ghost-ai

Local (per-project)

npm install --save-dev ghost-ai

Setup

  1. Get an OpenRouter API keyhttps://openrouter.ai/keys

  2. Create a .env file in the directory where you run the daemon:

OPENROUTER_API_KEY=your_key_here
AI_MODEL=inclusionai/ling-2.6-1t:free # optional, default shown
AI_TEMPERATURE=0.1                    # optional, 0.0–1.0
  1. Start the daemon:
# Watch current directory
ghost

# Watch specific directories
ghost ./src ./lib

# Using the full package name
ghost-ai ./src

Usage

Type the marker anywhere in a watched file, ending it with @@ so the daemon knows you're done typing:

function LoginForm() {
  // @gen: Create a login form with email and password fields using React state @@
}

Hit Ctrl+S. Within seconds, the comment is replaced:

function LoginForm() {
  const [email, setEmail] = useState('');
  const [password, setPassword] = useState('');

  const handleSubmit = (e: FormEvent<HTMLFormElement>) => {
    e.preventDefault();
    console.log({ email, password });
  };

  return (
    <form onSubmit={handleSubmit}>
      <input
        type="email"
        value={email}
        onChange={(e) => setEmail(e.target.value)}
        placeholder="Email"
      />
      <input
        type="password"
        value={password}
        onChange={(e) => setPassword(e.target.value)}
        placeholder="Password"
      />
      <button type="submit">Login</button>
    </form>
  );
}

Missing imports (e.g. useState, FormEvent) are silently added to the top of the file.


CLI Options

| Flag | Description | Default | |------|-------------|---------| | --dir, -d | Directory to watch (repeatable) | cwd | | --ext | Comma-separated extensions | .tsx,.ts,.js,.jsx,.java | | --context | Lines of context sent to AI | 50 | | --no-prettier | Disable Prettier formatting | Prettier on | | --silent | Suppress all console output | off | | --help, -h | Show help | — |


Running in Background (Windows)

Using pm2 (recommended):

npm install -g pm2
pm2 start ghost --name linter -- ./src
pm2 save
pm2 startup

Running in Background (macOS/Linux)

nohup ghost ./src > /dev/null 2>&1 &

Programmatic API

const { injectFile, startWatcher } = require('ghost-ai');

// Process a single file manually
await injectFile('/absolute/path/to/file.tsx', {
  contextLines: 50,
  usePrettier: true,
  silent: false,
});

// Start the watcher programmatically
startWatcher({
  watchDirs: ['/path/to/src'],
  extensions: ['.tsx', '.ts'],
  contextLines: 50,
  usePrettier: true,
  silent: false,
});

Environment Variables

| Variable | Description | Default | |----------|-------------|---------| | OPENROUTER_API_KEY | Required. Your OpenRouter API key | — | | AI_MODEL | OpenRouter AI model to use | inclusionai/ling-2.6-1t:free | | AI_TEMPERATURE | Generation temperature (0.0–1.0) | 0.1 | | WATCH_EXTENSIONS | Extensions to watch | .tsx,.ts,.js,.jsx,.java |


How it works

Save event
    │
    ▼
chokidar detects change (debounced 300ms)
    │
    ▼
Quick scan: does file contain // @gen: and @@ ?
    │
    ├─ No ──► ignore
    │
    ▼
Parse all markers + extract context (50 lines above/below)
    │
    ▼
Call OpenRouter API with stealth prompt
    │
    ▼
Apply indentation + Prettier format
    │
    ▼
Splice into file content (reverse order for multiple markers)
    │
    ▼
Auto-fix missing React imports
    │
    ▼
Atomic write (temp file → rename)

License

MIT