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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@posthog/wizard

v1.22.0

Published

The PostHog wizard helps you to configure your project

Readme

⚠️ Experimental: This wizard is still in an experimental phase. If you have any feedback, please drop an email to [email protected].

Usage

To use the wizard, you can run it directly using:

npx @posthog/wizard

Currently the wizard can be used for React, NextJS, Svelte, Astro and React Native projects. If you have other integrations you would like the wizard to support, please open a GitHub issue!

MCP Commands

The wizard also includes commands for managing PostHog MCP (Model Context Protocol) servers:

# Install PostHog MCP server to supported clients
npx @posthog/wizard mcp add

# Remove PostHog MCP server from supported clients
npx @posthog/wizard mcp remove

Options

The following CLI arguments are available:

| Option | Description | Type | Default | Choices | Environment Variable | | ----------------- | ---------------------------------------------------------------- | ------- | ------- | ---------------------------------------------------- | ------------------------------ | | --help | Show help | boolean | | | | | --version | Show version number | boolean | | | | | --debug | Enable verbose logging | boolean | false | | POSTHOG_WIZARD_DEBUG | | --region | PostHog cloud region (when not specified, prompts for selection) | string | | "us", "eu" | POSTHOG_WIZARD_REGION | | --default | Use default options for all prompts | boolean | true | | POSTHOG_WIZARD_DEFAULT | | --signup | Create a new PostHog account during setup | boolean | false | | POSTHOG_WIZARD_SIGNUP | | --integration | Integration to set up | string | | "nextjs", "astro", "react", "svelte", "react-native" | | | --force-install | Force install packages even if peer dependency checks fail | boolean | false | | POSTHOG_WIZARD_FORCE_INSTALL | | --install-dir | Directory to install PostHog in | string | | | POSTHOG_WIZARD_INSTALL_DIR |

Note: A large amount of the scaffolding for this came from the amazing Sentry wizard, which you can find here 💖

Steal this code

While the wizard works great on its own, we also find the approach used by this project is a powerful way to improve AI agent coding sessions. Agents can run CLI tools, which means that conventional code like this can participate in the AI revolution as well – with all the benefits and control that conventional code implies.

If you want to use this code as a starting place for your own project, here's a quick explainer on its structure.

Entrypoint: run.ts

The entrypoint for this tool is run.ts. Use this file to interpret arguments and set up the general flow of the application.

Analytics

Did you know you can capture PostHog events even for smaller, supporting products like a command line tool? src/utils/analytics.ts is a great example of how to do it.

This file wraps posthog-node with some convenience functions to set up an analytics session and log events. We can see the usage and outcomes of this wizard alongside all of our other PostHog product data, and this is very powerful. For example: we could show in-product surveys to people who have used the wizard to improve the experience.

Leave rules behind

Supporting agent sessions after we leave is important. There are plenty of ways to break or misconfigure PostHog, so guarding against this is key.

src/utils/rules/add-editor-rules.ts demonstrates how to dynamically construct rules files and store them in the project's .cursor/rules directory.

Prompts and LLM interactions

LLM agent sessions are anti-deterministic: really, anything can happen.

But using LLMs for code generation is really advantageous: they can interpret existing code at scale and then modify it reliably.

If they are well prompted.

src/lib/prompts.ts demonstrates how to wrap a deterministic fence around a chaotic process. Every wizard session gets the same prompt, tailored to the specific files in the project.

These prompts are channeled using src/utils/query.ts to an LLM interface we host. This gives us more control: we can be certain of the model version and provider which interpret the prompts and modify the files. This way, we can find the right tools for the job and again, apply them consistently.

This also allows us to pick up the bill on behalf of our customers.

When we make improvements to this process, these are available instantly to all users of the wizard, no training delays or other ambiguity.

Running locally

Quick test without linking

pnpm try --install-dir=[a path]

Development with auto-rebuild

pnpm run dev

This builds, links globally, and watches for changes. Leave it running - any .ts file changes will auto-rebuild. Then from any project:

wizard --integration=nextjs

# Or use local MCP server:
wizard --integration=nextjs --local-mcp

Testing

To run unit tests, run:

bin/test

To run E2E tests run:

bin/test-e2e

E2E tests are a bit more complicated to create and adjust due to to their mocked LLM calls. See the e2e-tests/README.md for more information.

Publishing your tool

To make your version of a tool usable with a one-line npx command:

  1. Edit package.json, especially details like name, version
  2. Run npm publish from your project directory
  3. Now you can run it with npx yourpackagename