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

axi-sdk-js

v0.1.7

Published

Shared Node.js primitives for building AXI CLIs

Downloads

33,535

Readme

Every Node-based AXI ends up redoing the same work: top-level dispatch, structured errors, TOON output, and optional hook installation for a few agents.

axi-sdk-js pulls those shared runtime pieces into one package. Your AXI can stay focused on business logic, work with plain JavaScript objects, and let the runtime handle official TOON serialization. If you want agent session context plumbing, wire installSessionStartHooks() into an explicit setup command.

runAxiCli() assumes a command-first CLI shape: <bin> <command> ...args ...flags. Bare --help is still supported, but flags are not allowed before the top-level command.

If your executable boundary needs to normalize loader-specific arguments before dispatch, pass argv explicitly to runAxiCli() instead of relying on process.argv.slice(2).

Quick Start

$ npm install axi-sdk-js
added 1 package
import { runAxiCli } from "axi-sdk-js";

await runAxiCli({
  description: "Manage GitHub state in the current repository",
  version: "1.2.3",
  argv: process.argv.slice(2),
  topLevelHelp: TOP_LEVEL_HELP,
  resolveContext: ({ command, args }) =>
    command === "issue" || command === "pr"
      ? resolveRepoFromArgs(args)
      : undefined,
  home: async () => ({
    issues: [{ number: 12, title: "Fix auth bug", state: "open" }],
    help: ["Run `gh-axi issue view <number>` for details"],
  }),
  commands: {
    issue: issueCommand,
    pr: prCommand,
  },
});

Reference

axi-sdk-js is a library package. In normal use, runAxiCli() should be the main entry point.

| API | Description | | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | runAxiCli() | Shared runtime for command-first dispatch, bare --help/--version fast paths, lazy context resolution, home header injection, TOON serialization, and standardized errors |

Advanced Exports

Most AXI authors should not need these directly.

| API | Description | | ---------------------------------------- | ----------------------------------------------------------------------------------------------- | | AxiError | Throw structured AXI errors from command handlers | | installSessionStartHooks() | Install or repair Claude Code hooks, Codex hooks, and OpenCode ambient context plugins directly | | resolvePortableHookCommand() | Resolve a hook command to a safe binary name or absolute path | | PortableHookCommandContext | Context for resolving portable hook commands | | shouldInstallHooksForNodeAxiExecPath() | Check whether an executable path is safe for hook installation |

Session Hook Setup

runAxiCli() does not install hooks during normal CLI execution. Hook installation should be exposed through an explicit user-invoked setup command, for example my-axi setup hooks.

import { installSessionStartHooks, runAxiCli } from "axi-sdk-js";

await runAxiCli({
  // ...other options
  commands: {
    setup: async (args) => {
      if (args[0] !== "hooks") {
        return {
          error: "Unknown setup command",
          help: "Run `my-axi setup hooks`",
        };
      }

      installSessionStartHooks();
      return { setup: "hooks installed or already up to date" };
    },
  },
});

Calling installSessionStartHooks() without identity options infers the current CLI from process.argv[1]. Packaged entrypoints such as dist/bin/gh-axi.js infer marker: "gh-axi", binaryNames: ["gh-axi"], and a safety policy that skips development TypeScript entrypoints. Pass explicit options when your setup command needs custom behavior:

await installSessionStartHooks({
  marker: "my-axi",
  binaryNames: ["my-axi"],
});

Claude Code and Codex receive native SessionStart hooks, while OpenCode receives a managed plugin in ~/.config/opencode/plugins/ that injects the AXI home view as ambient model context.

Hook Command Portability

Hook commands use a plain binary name such as gh-axi only when that name contains the hook marker and binaryNames resolves through the current PATH to the same executable; otherwise they use the absolute execPath.

For custom wrappers, pass binaryNames: ["my-axi"] to installSessionStartHooks().

Development

pnpm install # Install workspace dependencies
pnpm --dir packages/axi-sdk-js test # Run tests
pnpm --dir packages/axi-sdk-js run build # Build dist output