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

@kansnpms/console-log-pipe-client

v2.5.0

Published

Browser client library for Console Log Pipe - Real-time log streaming

Readme

@kansnpms/console-log-pipe-client

npm version npm downloads Coverage Status CI Code Quality license: MIT

Console Log Pipe Client

AI‑Friendly browser logging client – stream console output, errors, network traffic, localStorage / sessionStorage changes and cookies to your local Console Log Pipe CLI so an AI coding assistant (or a human!) can debug your application without ever opening DevTools.


✨ Highlights

| Feature | Description | | --------------------------------- | ------------------------------------------------------------------------------------------------------ | | Zero runtime deps | Written in vanilla TS → no bundled dependencies, minimal attack‑surface. | | Real‑time WebSocket streaming | <10 ms latency from browser to terminal on typical localhost. | | AI‑optimised JSON schema | Logs are enriched with metadata (env, TS type hints, stack‑traces) designed for effortless AI parsing. | | Network + Storage capture | Intercepts fetch, XHR, cookies, localStorage, sessionStorage, and optionally IndexedDB. | | Session isolation | Work on multiple tabs/apps simultaneously – each gets a unique sessionId. | | Smart filtering | Whitelist/blacklist log levels, URL patterns, payload sizes. |

📦 Installation

# your web project – choose one:
npm  i  @kansnpms/console-log-pipe-client    # npm
yarn add @kansnpms/console-log-pipe-client   # yarn
pnpm add @kansnpms/console-log-pipe-client   # pnpm

Prerequisite – the companion CLI must be running:

npm  i -g @kansnpms/console-log-pipe-cli
clp start --port 3001  # pick any free port

A CDN build is also available for quick experiments:

<script src="https://unpkg.com/@kansnpms/console-log-pipe-client"></script>

🚀 Quick Start

import ConsoleLogPipe from '@kansnpms/console-log-pipe-client';

// Basic usage (returns a Promise)
const client = await ConsoleLogPipe.init({
  serverPort: 3001, // (required) – same port you gave the CLI
  serverHost: 'localhost', // (optional) – defaults to 'localhost'
});

console.log('✅ Console Log Pipe is ready!');
// Simple initialization (most common)
await ConsoleLogPipe.init({
  serverPort: 3001,
  serverHost: 'localhost', // optional
});
// Error handling with try/catch
try {
  const client = await ConsoleLogPipe.init({
    serverPort: 3001,
    serverHost: 'localhost',
  });
  console.log('✅ Ready to capture logs!');
} catch (error) {
  console.error('❌ Failed to initialize:', error);
}

Open your browser console and watch the magic appear in your terminal 📡.


⚙️ API Reference

ConsoleLogPipe.init(options: InitOptions)

Initialises interception and returns a Promise that resolves when ready. Call it once as early as possible (before most imports if you want first‑paint logs).

⚠️ serverPort is mandatory - throws error if not provided or invalid.

| Option | Type | Default | Notes | | ---------------------- | -------------------------------------------------------- | ------------ | ---------------------------------------------------------- | | port | number | required | Port where CLI WebSocket server is listening (1024-65535). | | onReady | function | – | Callback when initialization completes successfully. | | onError | function | – | Callback when initialization fails. | | sessionId | string | auto | Custom ID useful when you manually spawn CLI sessions. | | environment | "development" \| "staging" \| "production" | auto | Included in every payload. | | developer | string | – | Helpful when multiple devs share the same pipe. | | enableNetworkCapture | boolean | true | Wraps fetch & XHR. | | enableMetadata | boolean | true | Adds file, line, column, user‑agent, etc. | | logLevels | Array<"log" \| "warn" \| "error" \| "info" \| "debug"> | all | Reduce noise. | | includePatterns | string[] | – | Regex/glob patterns to allow. | | excludePatterns | string[] | – | Regex/glob patterns to skip. | | maxLogSize | number | 10000 | in bytes – large objects are truncated (with notice). |

Returns: Promise<ConsoleLogPipe> - Resolves when client is ready to capture logs.

Throws: Error if port is missing, invalid, or initialization fails.

ConsoleLogPipe.destroy()

Restores native browser APIs and closes the socket.


🏗️ Architecture

graph LR
  subgraph Browser
    A[Console / Errors / Fetch] -->|intercept| B(Console Log Pipe Client)
  end
  B -- WebSocket JSON --> C(CLI Server)
  C -- STDOUT →|structured text| D(IDE / AI Assistant)
  D -- hot‑reload → A

CLI ↔ Client = yin & yang – each is pointless without the other.


🔒 Security Notes

  • No external requests except the WebSocket you configure.
  • Sanitises circular references and strips functions before serialising.
  • Tested with CSP script-src 'self' and strictest Chrome extension policies.

🤝 Contributing

PRs & issues welcome! Please run pnpm test and pnpm lint before opening a pull‑request.

  1. Fork ➡️ branch ➡️ commit + signoff.
  2. pnpm dev to start the test harness (CLI is auto‑spawned).
  3. Add unit & e2e tests beside new logic.

📝 License

MIT © 2025 Kansnpms & contributors