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

@payglocal_ui/lumen

v0.1.11

Published

Dev-only in-app AI design agent — powered by Claude Code

Readme

@payglocal_ui/lumen

Dev-only in-app AI design agent — powered by Claude Code.

Lumen embeds a draggable chat overlay into your Next.js App Router app during development. Designers and engineers describe UI changes in natural language, and Claude Code applies them as real code edits in your repo — live, with no context switch to a terminal.

It is development-only by design: the overlay renders and the agent runs only in development. Production builds dead-code-eliminate the agent, and a build-time gate (lumen-assert-no-agent) fails the build if any agent code leaks into a production bundle.

Requirements

  • A Next.js app using the App Router
  • React 18 or 19
  • The Claude Code CLI installed and authenticated (the agent shells out to it)

Install

npm install --save-dev @payglocal_ui/lumen

A postinstall hook scaffolds the two integration files automatically (it skips files that already exist). To run it manually:

npx lumen

This creates:

  • LUMEN.md — your project's rules file (re-read on every message)
  • src/app/api/lumen/[[...lumen]]/route.ts — the catch-all API route

It also wires the production safety gate into your package.json as a postbuild script (lumen-assert-no-agent), so production builds are guarded automatically. This is idempotent — it won't duplicate or clobber an existing postbuild.

If you install with --ignore-scripts (common in CI), the postinstall hook won't run — use npx lumen to scaffold manually.

Setup

1. API route

The scaffolder generates src/app/api/lumen/[[...lumen]]/route.ts:

import { createLumenHandler } from "@payglocal_ui/lumen/next";

export const { GET, POST, DELETE, runtime, dynamic } = createLumenHandler({
  // referenceDirs: ["../sibling-repo"],  // read-only reference checkouts
  // secretPatterns: [/my_certs/i],       // extra patterns beyond built-in defaults
});

2. Root layout

Add the overlay to your root layout using a conditional dynamic import, so the bundler dead-code-eliminates the agent (and its styles) from production builds:

import dynamic from "next/dynamic";

// Dev-only. A conditional dynamic import keeps the agent out of prod bundles.
const DesignAgentOverlay =
  process.env.NODE_ENV === "development"
    ? dynamic(() =>
        Promise.all([
          import("@payglocal_ui/lumen/client"),
          import("@payglocal_ui/lumen/styles.css"),
        ]).then(([m]) => m.DesignAgentOverlay),
      )
    : null;

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        {children}
        {DesignAgentOverlay && <DesignAgentOverlay />}
      </body>
    </html>
  );
}

Do not use a static import { DesignAgentOverlay } from ".../client". A static import ships the entire "use client" module to production even when the render is gated behind NODE_ENV — the postbuild safety gate will catch this and fail your build. The conditional dynamic import above is required.

3. Teach it your conventions

Edit LUMEN.md to describe your project's rules — component library, import aliases, folder structure, off-limits files, and so on. It is re-read on every message, so changes take effect immediately with no restart.

4. Run

Start your dev server and click the sparkles badge in the corner.

Configuration

createLumenHandler(config) accepts:

| Option | Default | Description | | --- | --- | --- | | referenceDirs | [] | Sibling repos the agent may read (not edit). | | secretPatterns | built-in set | Extra regexes for paths the agent must never read or edit. Merged with defaults. | | rulesFile | "LUMEN.md" | Path to the project rules file. | | appDir | "src/app" | Where your App Router routes live. | | featuresDir | "src/features" | Where feature modules live. | | allowedTools | safe default set | Which Claude Code tools the agent may use. | | enabled | dev-only check | Predicate controlling whether the agent runs. | | protectedBranches | ["main", "master", "develop", "production"] | Branches the publish flow refuses to commit to directly. |

Safety

  • Secret guard — a PreToolUse hook blocks the agent from reading or editing sensitive paths (.env, SSH keys, PEM certs, .npmrc, plus your custom secretPatterns).
  • Scoped edits — the agent edits only your app; referenceDirs are read-only.
  • Production gatelumen-assert-no-agent runs after next build (wired as a postbuild script during install) to ensure no agent code ships to production. You can also invoke it directly in CI.

Package exports

| Entry | Purpose | | --- | --- | | @payglocal_ui/lumen/next | App Router adapter — createLumenHandler. | | @payglocal_ui/lumen/client | React overlay components and the useAgentChat hook. | | @payglocal_ui/lumen/server | Server primitives (config, prompt assembly, handlers). | | @payglocal_ui/lumen/types | Isomorphic TypeScript types. | | @payglocal_ui/lumen/styles.css | Compiled overlay styles. |

License

MIT