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

@aaplugin/extension-hooks

v1.0.0-beta.1

Published

Portable hook authoring and Platform contributors for AAPlugin.

Readme

@aaplugin/extension-hooks

Portable Hook authoring plus six official Platform Contributors for aaplugin.

Requires Node.js ^20.19.0 || ^22.13.0 || >=23.5.0.

统一书写 Hook,通过 Core Compiler 只构建一次,再由官方 Contributor 交付为六个平台各自支持的静态或运行时能力。

pnpm add -D @aaplugin/kit \
  @aaplugin/platform-claude-code \
  @aaplugin/extension-hooks
// aaplugin.config.ts
import { defineConfig } from '@aaplugin/kit';
import claudeCode from '@aaplugin/platform-claude-code';
import hooks from '@aaplugin/extension-hooks';

export default defineConfig({
  name: 'my-plugin',
  version: '1.0.0',
  description: 'Reusable AI workflows.',
  platforms: [claudeCode()],
  extensions: [hooks()],
});

Each Hook is a plain ESM default export at src/hooks/<id>/hook.ts:

每个 Hook 使用独立一级目录,并通过 satisfies 获得事件级输入和结果类型。

import type { Hook } from '@aaplugin/extension-hooks';

export default {
  event: 'PreToolUse',
  matcher: 'Bash|Write|Edit',
  timeout: 10,
  platforms: {
    codex: { additionalContextLimit: 2_500 },
  },
  async run(input, context) {
    return input.toolName === 'Bash'
      ? { decision: 'allow' }
      : { decision: 'deny', reason: `Denied on ${context.platform}.` };
  },
} satisfies Hook<'PreToolUse'>;

The canonical events are SessionStart, SessionEnd, UserPromptSubmit, PreToolUse, PermissionRequest, PostToolUse, PreCompact, PostCompact, SubagentStart, SubagentStop, and Stop.

Platform-only events stay explicitly scoped and never expand that union:

平台专属事件必须显式限定;其他 Platform 不会获得产物或兼容性结论。

import type { Hook } from '@aaplugin/extension-hooks';

export default {
  event: { platform: 'claude-code', name: 'Setup' },
  matcher: 'init',
  run() {},
} satisfies Hook;

AAPlugin's Core portable-node Compiler bundles each implementation once as a self-contained, platform-neutral Node 20 ESM hooks/<id>/handler.mjs. Verified wire profiles are compiled into the same file and own native stdin schemas, camelCase conversion, runtime root/data environment mapping, and stdout mapping. The Handler validates event-specific results, keeps stdin/stdout within 1 MiB, emits only stable error codes, and requires no adjacent runtime JavaScript. Third-party code included in a Handler receives a deterministic THIRD_PARTY_LICENSES.txt.

作者不能声明原始 shell、绝对 executable、HTTP、prompt、agent 或 MCP-tool Handler;平台 wire 协议完全由对应 Contributor 管理。

Claude Code uses shell-free exec form (command: "node" plus args). Codex currently receives a fixed framework-generated command string because its public Hook schema does not expose args. A meaningful matcher is reported as degraded whenever the selected host silently ignores it, including Claude Code UserPromptSubmit/Stop and Codex UserPromptSubmit/Stop; empty Hooks produce no Assets.

Portable event support:

| Platform | Native | Transformed | Degraded | Unsupported | | --- | --- | --- | --- | --- | | Claude Code | all 11 portable events | — | matcher on selected events | — | | Codex | all 11 portable events | — | matcher on selected events | — | | Cursor | — | 9 events | field-level matcher/status loss | PermissionRequest, PostCompact | | Antigravity | SessionStart, SessionEnd, PreToolUse, PostToolUse, PreCompact | — | field-level matcher/status loss | remaining 6 events | | OpenCode | SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PostCompact | — | SessionEnd, Stop | remaining 4 events | | Pi | SessionStart, SessionEnd, UserPromptSubmit, PreToolUse, PostToolUse, PreCompact, PostCompact | — | Stop | PermissionRequest, SubagentStart, SubagentStop |

Strict mode rejects degraded or unsupported outcomes; relaxed mode emits only verified runtimes and preserves the full structured report. Empty Hooks produce no Asset.

Contracts were last rechecked on 2026-08-06 against Claude Code Hooks, Codex Hooks, Cursor Hooks, Antigravity Plugins, OpenCode Plugins, and Pi Extensions.

License

MIT