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

@locusai/sdk

v0.26.6

Published

SDK for building Locus-compatible community packages

Downloads

14,717

Readme

@locusai/sdk

npm version License: MIT

SDK for building Locus-compatible community packages. Provides configuration management, CLI invocation, structured logging, and TypeScript type definitions.

Installation

npm install @locusai/sdk

Quick Start

import {
  readLocusConfig,
  invokeLocus,
  invokeLocusStream,
  createLogger,
} from "@locusai/sdk";

// Read merged project + global config
const config = readLocusConfig();

// Run a Locus CLI command and capture output
const result = await invokeLocus(["status"]);
console.log(result.stdout);

// Stream output from a long-running command
const child = invokeLocusStream(["run", "42"]);
child.stdout?.pipe(process.stdout);

// Create a logger for your package
const log = createLogger("my-package");
log.info("Package initialized");

API Reference

Configuration

readLocusConfig(cwd?: string): LocusConfig

Reads and merges global (~/.locus/config.json) and project-level (.locus/config.json) configuration files. Project config takes precedence over global config.

import { readLocusConfig } from "@locusai/sdk";

const config = readLocusConfig();
console.log(config.ai.model);           // configured AI model
console.log(config.packages?.telegram);  // package-specific config

DEFAULT_CONFIG

Safe defaults for all configuration sections. Useful as a fallback.

Invocation

invokeLocus(args: string[], cwd?: string): Promise<LocusInvokeResult>

Spawns the locus CLI binary and captures output. Returns stdout, stderr, and exit code.

import { invokeLocus } from "@locusai/sdk";

const result = await invokeLocus(["exec", "--non-interactive", "explain this code"]);
console.log(result.stdout);    // AI response
console.log(result.exitCode);  // 0 on success

invokeLocusStream(args: string[], cwd?: string): ChildProcess

Returns a raw ChildProcess for streaming output. Use this for long-running commands where you need real-time output.

import { invokeLocusStream } from "@locusai/sdk";

const child = invokeLocusStream(["run", "42"]);
child.stdout?.on("data", (chunk) => process.stdout.write(chunk));
child.on("close", (code) => console.log("Exit:", code));

Logging

createLogger(name: string): LocusLogger

Creates a named logger with consistent formatting matching Locus CLI output. All output goes to stderr to avoid polluting stdout.

import { createLogger } from "@locusai/sdk";

const log = createLogger("my-package");
log.info("Started");           // ● [my-package] Started
log.warn("Rate limited");      // ⚠ [my-package] Rate limited
log.error("Connection lost");  // ✗ [my-package] Connection lost
log.debug("Payload:", data);   // ⋯ [my-package] Payload: ... (only with LOCUS_DEBUG=1)

Types

import type {
  LocusConfig,
  LocusPackageManifest,
  LocusInvokeResult,
  LocusLogger,
  AIProvider,
} from "@locusai/sdk";

| Type | Description | |------|-------------| | LocusConfig | Full configuration schema (AI, GitHub, agent, sprint, sandbox, packages) | | LocusPackageManifest | Shape of the "locus" field in package.json | | LocusInvokeResult | Return type from invokeLocus(){ stdout, stderr, exitCode } | | LocusLogger | Logger interface with info, warn, error, debug methods | | AIProvider | Union type: "claude" | "codex" |

Building a Package

See the Package Author Guide for a complete walkthrough covering:

  • Package structure and naming conventions (@locusai/locus-<name>)
  • Required package.json fields and the "locus" manifest
  • Using the SDK for config, invocation, and logging
  • Building, testing, and publishing
  • Submitting a pull request

You can also scaffold a new package with:

locus create my-package

Related Packages

| Package | Description | |---------|-------------| | @locusai/cli | Main Locus CLI | | @locusai/locus-gateway | Channel-agnostic message gateway for platform adapters | | @locusai/locus-pm2 | PM2 process management for background workers | | @locusai/locus-telegram | Telegram adapter — reference implementation | | @locusai/locus-cron | Cron scheduler package | | @locusai/locus-linear | Linear integration package | | @locusai/locus-jira | Jira integration package | | @locusai/locus-mcp | MCP server management |

License

MIT