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

@omniaura/astro-grab

v1.2.0

Published

Hold a key, hover, click — grab any element's source context for AI agents. Astro devtool.

Readme

astro-grab

Hold a key, hover, click — grab any element's source context for AI agents. Astro devtool inspired by solid-grab and react-grab.

Install

bun add -D @omniaura/astro-grab
# or
npm install -D @omniaura/astro-grab

Setup

Add the integration to your astro.config.mjs:

import { defineConfig } from "astro/config";
import astroGrab from "@omniaura/astro-grab";

export default defineConfig({
  integrations: [astroGrab()],
});

That's it. In dev mode, hold Alt and click any element to copy its source context to your clipboard.

How It Works

Build time: A Vite plugin injects data-astro-source and data-astro-component attributes into your .astro templates and framework island JSX/TSX files.

Runtime: An overlay activates when you hold the modifier key. Hover to see source info, click to grab full context.

Output: Formatted context (element, source location, component tree, HTML snippet) is copied to clipboard — ready to paste into Claude, Cursor, or any AI coding agent.

--- astro-grab context ---

Element: <button class="btn primary">
Source:  src/components/Counter.astro:24:8

Component tree (innermost → outermost):
  <Counter /> → src/components/Counter.astro:12:1
  <Layout /> → src/layouts/Layout.astro:8:1

HTML:
<button class="btn primary" data-astro-source="src/components/Counter.astro:24:8">Count: 5</button>

--- end astro-grab context ---

Options

Integration Options

astroGrab({
  jsxLocation: true,      // Inject data-astro-source (default: true)
  componentLocation: true, // Inject data-astro-component (default: true)
  autoImport: true,        // Auto-import runtime in dev (default: true)
  key: "Alt",              // Modifier key: "Alt" | "Control" | "Meta" | "Shift"
  holdDuration: 0,         // ms to hold key before activation (default: 0 = instant)
  theme: {
    accent: "#bc52ee",     // Optional theme overrides
    surface: "#1a1a2e",
  },
})

Runtime Options

For manual initialization (if autoImport: false):

import { initAstroGrab } from "@omniaura/astro-grab/client";

initAstroGrab({
  key: "Alt",              // Modifier key (default: "Alt")
  showToast: true,         // Show notification on copy (default: true)
  holdDuration: 0,         // ms to hold key before activation (default: 0 = instant)
  agentUrl: "ws://...",    // WebSocket URL for agent bridge (optional)
  onGrab: (context) => {}, // Callback, return false to prevent copy
  theme: {
    accent: "#bc52ee",
    surface: "#1a1a2e",
  },
});

// Set holdDuration > 0 (e.g. 1000) to require holding the key for 1s
// before targeting activates — useful to prevent accidental activation
// when the modifier is pressed for unrelated browser shortcuts.

Theme Defaults

astro-grab now exposes its built-in OmniAura palette so you can extend it instead of re-creating it:

import astroGrab, { DEFAULT_ASTRO_GRAB_THEME } from "@omniaura/astro-grab";

export default defineConfig({
  integrations: [
    astroGrab({
      key: "Alt",
      theme: {
        ...DEFAULT_ASTRO_GRAB_THEME,
        accent: "#ff7a59",
        accentSoft: "#ffd1c2",
      },
    }),
  ],
});

Available theme keys:

  • accent
  • accentSoft
  • surface
  • text
  • overlay
  • border
  • crosshair
  • tag

Agent Bridge

Send grabbed context directly to a local coding agent over WebSocket:

astroGrab({
  // Options are passed through to the runtime
  key: "Alt",
})

Then in your client code:

import { initAstroGrab } from "@omniaura/astro-grab/client";

initAstroGrab({
  agentUrl: "ws://localhost:4567",
});

The bridge sends JSON payloads:

{
  "type": "astro-grab:context",
  "payload": {
    "tagName": "button",
    "elementSource": { "file": "src/...", "line": 24, "column": 8 },
    "components": [...],
    "formatted": "--- astro-grab context ---\n...",
    "timestamp": 1234567890
  }
}

Standalone Vite Plugin

If you're not using the Astro integration (e.g., in a plain Vite project):

import { defineConfig } from "vite";
import astroGrab from "@omniaura/astro-grab/vite";

export default defineConfig({
  plugins: [astroGrab()],
});

Global API

Access the runtime programmatically via window.__ASTRO_GRAB__:

window.__ASTRO_GRAB__.init({ key: "Control" });
window.__ASTRO_GRAB__.destroy();
window.__ASTRO_GRAB__.inspect(document.querySelector(".my-element"));
console.log(window.__ASTRO_GRAB__.theme);

Dev Only

The integration and Vite plugin only activate during astro dev / vite serve. Production builds are completely unaffected — no attributes injected, no runtime loaded.

License

MIT