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

@tluyben/pseudo-js

v1.0.0

Published

AI-assisted code generation using stack trace context

Readme

pseudo-js

AI-assisted code generation using stack trace context. Generate JavaScript code on-the-fly by describing what you want in plain English.

Installation

npm install pseudo-js

Setup

  1. Copy .env.example to .env:
cp .env.example .env
  1. Configure your OpenRouter API credentials in .env:
OPENROUTER_API_KEY=your_openrouter_api_key_here
OPENROUTER_MODEL=openai/gpt-4
OPENROUTER_PROVIDER=

Usage

const pseudo = require('pseudo-js');

// Basic usage
const result = await pseudo("calculate the fibonacci number for n=10");

// With arguments
const spaceship = { x: 100, y: 200, velocity: 50 };
const [x, y] = await pseudo("return the point of the spaceship", spaceship);

// Complex operations
const data = [1, 2, 3, 4, 5];
const filtered = await pseudo("filter even numbers and multiply by 2", data);

How it works

  1. Stack Trace Analysis: The function uses the JavaScript stack trace to determine where it was called from
  2. Context Extraction: Reads the source file and extracts 10 lines before and after the call site
  3. AI Generation: Sends the context and specification to OpenRouter's AI models
  4. Code Execution: Executes the generated JavaScript and returns the result

Features

  • 🔍 Context-aware: Uses surrounding code to understand what you're trying to do
  • 🚀 Type-aware: Automatically detects and provides type information for arguments
  • 📝 Natural language: Describe what you want in plain English
  • Real-time: Generates and executes code instantly
  • 🔧 Flexible: Works with any JavaScript environment

API

pseudo(specification, ...args)

  • specification (string): Description of what the code should do
  • ...args (any): Optional arguments that the generated code can use
  • Returns: Promise<any> - The result of executing the generated code

Environment Variables

  • OPENROUTER_API_KEY (required): Your OpenRouter API key
  • OPENROUTER_MODEL (optional): Model to use (default: openai/gpt-4)
  • OPENROUTER_PROVIDER (optional): Specific provider preference

License

MIT