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

teenycode

v0.1.1

Published

A tiny coding agent in TypeScript (under 200 LOC)

Readme

TeenyCode

A tiny code‑editing agent in TypeScript (200 LOC) — a minimal, hackable CLI that talks to OpenAI and can read, list, and edit files in your working directory.

This repository is for educational purposes, to demonstrate the core elements of a minimal CLI coding agent.

It's adapted from How to build an agent by Amp.

Features

  • Chat-based CLI that calls OpenAI and uses tool calls
  • File tools: read_file, list_files, edit_file (single, unique replacement or create new file)
  • Prefers reading files over guessing; makes the smallest edit that satisfies a request
  • Minimal dependencies and simple code you can tweak

[!NOTE] No bash tool added since this is just for educational purposes, you can easily add it yourself.

Requirements

  • Node.js 22+
  • npm for npx teenycode, or Vite+ (vp) for local development
  • An OpenAI API key

Quickstart

export OPENAI_API_KEY=sk-...
npx teenycode

Or put OPENAI_API_KEY=sk-... in a .env file in the directory where you run npx teenycode.

If you prefer a one-liner:

OPENAI_API_KEY=sk-... npx teenycode

If OPENAI_API_KEY is missing, the CLI prints setup instructions and exits.

Local development

vp install
cp .env.example .env
# edit .env and set your API key
vp run start

You'll see a prompt like Chat with <model>. Type your requests. Quit with exit, quit, :q, or Ctrl‑C.

How it works (quick tour)

  • src/index.ts: Entry point; checks OPENAI_API_KEY, starts the agent
  • src/agent.ts: Chat loop, tool routing, and message state
  • src/tools.ts: Three built-in tools implemented with Node fs APIs

The agent uses OpenAI Chat Completions with function/tool calling. Tool inputs are validated with Zod, and schemas are exported to JSON Schema for the model.

Example

➜  teenycode git:(main) ✗ OPENAI_API_KEY=sk-... npx teenycode

Chat with gpt-5 (type 'exit' or 'quit' or use Ctrl-C to quit)

You: What is this repo about?

tool: list_files({"path": ""})

tool: read_file({"path":"README.md"})

tool: read_file({"path":"package.json"})

tool: read_file({"path":"src/index.ts"})

tool: read_file({"path":"src/agent.ts"})

tool: read_file({"path":"src/tools.ts"})

Agent: TeenyCode is a tiny, hackable CLI coding agent written in TypeScript (~200 LOC) for educational purposes. It chats with OpenAI and can operate on your local files via three tools:
- read_file: read a file’s contents
- list_files: list files/dirs at a path
- edit_file: make a single, unique text replacement or create a new file

Tools

The agent exposes three file tools:

  • read_file (path: string): Reads and returns the text contents of a file at a relative path.
  • list_files (path: string): Lists files and directories at the given path (use "." for the current dir).
  • edit_file (path: string, old_str: string, new_str: string): Replaces exactly one occurrence of old_str with new_str in the given file.

Conventions:

  • All paths are relative to your current working directory.
  • The agent prefers reading over guessing and aims to make the smallest possible change.

Notes

  • Edits are surgical by design. Keep your work in git and commit often.
  • The agent operates relative to your current working directory.

Quality checks

vp check
vp lint --fix
vp fmt
vp test
vp build

Acknowledgements

Adapted from How to build an agent by Amp.