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

@lineai/diagnose-log

v0.1.0

Published

Structured error logging for agent-driven diagnosis. Errors as messages to an agent.

Readme

@lineai/diagnose-log

Errors as structured messages to an agent.

When something fails, an agent will read the log, open the suspect files, and diagnose. The contract below is designed to give the agent everything it needs to start work — not to be skimmed by a human in a log viewer.

Install

pnpm add @lineai/diagnose-log

Usage

import { createDiagnoseLogger } from '@lineai/diagnose-log';

const log = createDiagnoseLogger({ service: 'service-api' });

try {
  await verifyStripeSignature(req);
} catch (err) {
  log.diagnose({
    msg: 'Stripe webhook signature verification failed',
    tag: 'webhook',
    suspectFiles: ['src/webhooks/stripe.ts', 'src/lib/stripe-config.ts'],
    suspectSymbols: ['verifyStripeSignature', 'getWebhookSecret'],
    reproSteps: 'POST /webhooks/stripe with a stale Stripe-Signature header',
    recentChanges: ['abc123: rotated webhook secret on 2026-04-15'],
    context: { eventId: req.headers['stripe-event-id'], receivedAt: Date.now() },
    err,
  });
  throw err;
}

What this produces

A single line of structured JSON, written via console.log. On Cloud Run / Cloud Functions / GKE with the Logging agent, the severity field is parsed and the rest lands in jsonPayload:

{
  "severity": "ERROR",
  "timestamp": "2026-04-17T17:42:00.123Z",
  "service": "service-api",
  "agentDiagnose": true,
  "diagnoseTag": "webhook",
  "message": "Stripe webhook signature verification failed",
  "suspectFiles": ["src/webhooks/stripe.ts", "src/lib/stripe-config.ts"],
  "suspectSymbols": ["verifyStripeSignature", "getWebhookSecret"],
  "reproSteps": "POST /webhooks/stripe with a stale Stripe-Signature header",
  "recentChanges": ["abc123: rotated webhook secret on 2026-04-15"],
  "context": { "eventId": "evt_...", "receivedAt": 1747000000000 },
  "err": { "name": "Error", "message": "...", "stack": "..." }
}

Pairing with a Cloud Logging sink

Route entries to Pub/Sub so an orchestrator can subscribe:

gcloud logging sinks create log-errors-sink \
  pubsub.googleapis.com/projects/PROJECT/topics/log-errors \
  --log-filter='(severity>=ERROR OR jsonPayload.agentDiagnose=true) AND resource.type="cloud_run_revision"'

agentDiagnose: true lets you trigger diagnosis at WARNING (or any severity) without polluting the severity-based channel.

Configuration

| Option | Type | Default | Purpose | |--------------|-----------------------------------------------|------------------|-----------------------------------------------------------| | service | string | required | Service name stamped on every entry | | defaultTag | string | none | Used when an entry omits tag | | write | (line: string) => void | console.log | Swap for testing or non-Cloud-Run environments | | redact | (ctx: Record) => Record | identity | Strip secrets/PII from context before logging |

Entry fields

All fields except msg are optional — but the more you give the agent, the better its first move.

| Field | Why the agent wants it | |------------------|------------------------------------------------------------------| | msg | One-line summary. Sets the frame. | | tag | Routes the entry to a specialized agent. | | severity | WARNING / ERROR / CRITICAL. Defaults to ERROR. | | suspectFiles | Files to open first — saves grep time. | | suspectSymbols | Functions/classes to inspect. | | reproSteps | How to trigger it again. | | recentChanges | Commits/PRs/deploys that may have introduced the regression. | | context | Runtime ids, payloads, headers (redact secrets via redact). | | err | Any thrown value. Serialized with stack and cause chain. | | trace | Cloud Trace id or request id for correlation. |