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

@nothumanwork/cursor-agents-sdk

v0.7.0

Published

Typed Node-friendly utilities for driving the Cursor Agent CLI programmatically.

Readme

Cursor Agents SDK

Typed, Node-friendly helpers for driving the cursor-agent CLI in automation, CI, or custom developer tools. The SDK keeps parity with the documentation inside ./cursor-cli, exposing:

  • CursorAgent – spawns the CLI with safe defaults, structured JSON output, streaming NDJSON parsing, and AbortSignal cancellation.
  • buildCursorAgentCommand – deterministic CLI argument construction (always pairs --print + --output-format).
  • CursorStreamEventSchema / CursorJsonResultSchema – Zod validators aligned with Cursor's documented output, including tool call events.

Installation

npm install @nothumanlabs/cursor-agents-sdk
# or
pnpm add @nothumanlabs/cursor-agents-sdk
# or
bun add @nothumanlabs/cursor-agents-sdk

The install script downloads the latest published cursor-agent binary from https://downloads.cursor.com/lab. The command is linked as the package "bin", so npx cursor-agent, pnpm exec cursor-agent, or bunx cursor-agent will launch the vendored CLI without additional setup.

Environment toggles:

| Variable | Description | | --- | --- | | CURSOR_AGENT_SDK_VERSION | Override the binary version tag (default: 2025.10.22-f894c20). | | CURSOR_AGENT_SDK_BASE_URL | Override the download base URL. | | CURSOR_AGENT_SDK_FORCE=1 | Force re-downloading the binary even if cached. | | CURSOR_AGENT_SDK_SKIP=1 | Skip the download (useful for CI with cached vendor folders). | | CURSOR_AGENT_SDK_STRICT=1 | Fail the install if checksum retrieval or verification fails. | | CURSOR_AGENT_SDK_BIN_NAME | Customize the binary name written to the manifest. |

Manifest metadata is written to vendor/manifest.json. Programmatic consumers can read the manifest or resolve the executable location with resolveCursorAgentBinaryPath().

Usage

import {
  CursorAgent,
  type CursorAgentGenerateOptions,
  parseCursorEventLine,
} from "cursor-agents-sdk";

const agent = new CursorAgent({
  // apiKey defaults to process.env.CURSOR_API_KEY when omitted
  defaultModel: "sonnet-4",
});

const result = await agent.generate({
  prompt: "Summarize CONTRIBUTING.md",
  chatId: "previous-session-id", // optional resume
});
console.log(result.result);

for await (const event of agent.stream({
  prompt: "Review the staged diff for security issues",
  streamPartialOutput: true,
})) {
  if (event.type === "assistant") {
    console.log(event.message.content[0]?.text);
  }
}

If you only need the CLI command, reuse the builder:

import { spawn } from "node:child_process";
import { buildCursorAgentCommand } from "cursor-agents-sdk";

const command = buildCursorAgentCommand(
  { forceWrites: true },
  { prompt: "apply the diff", outputFormat: "json" },
);

await new Promise<void>((resolve, reject) => {
  const child = spawn(command[0], command.slice(1), { stdio: "inherit" });
  child.once("error", reject);
  child.once("close", (code) => {
    if (code === 0) {
      resolve();
    } else {
      reject(new Error(`cursor-agent exited with code ${code ?? "unknown"}`));
    }
  });
});

To delegate to the binary directly, resolve the vendored path via the manifest:

import { spawn } from "node:child_process";
import { resolveCursorAgentBinaryPath } from "cursor-agents-sdk";

const cursorAgentPath = await resolveCursorAgentBinaryPath();

await new Promise<void>((resolve, reject) => {
  const child = spawn(cursorAgentPath, ["status"], { stdio: "inherit" });
  child.once("error", reject);
  child.once("close", (code) => {
    if (code === 0) {
      resolve();
    } else {
      reject(new Error(`cursor-agent exited with code ${code ?? "unknown"}`));
    }
  });
});

Development

| Task | Command | | --- | --- | | Install deps + generate dist | bun install | | Type-check & emit types | bun run build:types | | Bundle JS + declarations | bun run build | | Lint / format | bun run lint / bun run format | | Tests | bun test |

Git hooks (via simple-git-hooks) run bun run lint && bun test before each commit, keeping the publish artifact (dist/**) in sync with src/**.

The repo follows TDD by default: add or adjust tests (*.test.ts) before changing implementation, especially when reflecting new Cursor CLI behaviors documented in ./cursor-cli.

## Changelog ### 28/10/2025 - Migration to NodeJS compatibility The library was heavily reliant on Bun's Javascript runtime, causing some severe incompatibility issues with environments where Bun won't natively run (e.g. Cloudflare Workers, Vercel...)

Removed dependencies on Bun's native features (i.e. Bun.spawn, subprocess, env...). Migrating to using Node libraries.

  • examples/showcase.mjs - can be run using node examples/showcase.mjs and it uses the built (to target Node) version of the library in dist/index.js