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

@nendlabs/hargness

v0.1.2

Published

Define nested agent-facing CLIs in TypeScript or YAML and compile them into Bun executables with generated skill docs.

Downloads

34

Readme

hargness

Hargness turns a typed command definition into:

  • a Bun CLI executable that agents can invoke
  • a generated SKILL.md that explains how to use that CLI
  • optional per-invocation trace manifests and artifacts

Use it when you want to expose a bounded set of application or repo operations to agents through a validated command tree instead of open-ended shell access.

Install

bun add -d @nendlabs/hargness

Run the build CLI without installing it into a project:

bunx @nendlabs/hargness build --source ./cli.ts

Install or refresh the Hargness Codex skill without a global install:

bunx @nendlabs/hargness codex install

This writes the package skill to ~/.hargness/SKILL.md and links it into ${CODEX_HOME:-~/.codex}/skills/hargness/SKILL.md, so future installs can update the stable Hargness-owned file without changing the Codex skill path.

Definitions in TypeScript

Author a CLI by wrapping existing functions with defineAction(...) and nesting them with defineGroup(...).

import { createCli, defineAction, defineGroup } from "@nendlabs/hargness";

async function deploy(args: { env: "staging" | "prod"; version: string }) {
	return {
		ok: true,
		env: args.env,
		version: args.version,
	};
}

export default createCli({
	name: "appctl",
	description: "App operations for agents.",
	build: {
		version: "0.1.0",
	},
	trace: {
		enabled: true,
	},
	commands: [
		defineGroup({
			name: "deploy",
			description: "Deployment commands.",
			commands: [
				defineAction({
					name: "run",
					description: "Deploy a version.",
					args: {
						env: {
							type: "enum",
							values: ["staging", "prod"] as const,
							required: true,
							description: "Target environment.",
						},
						version: {
							type: "string",
							required: true,
							description: "Version to deploy.",
						},
					},
					run: deploy,
				}),
			],
		}),
	],
});

The declared args schema is the runtime source of truth for parsing, validation, help, generated docs, and trace redaction.

Definitions in YAML

YAML definitions are useful for shell-backed commands:

name: fs
description: Filesystem helpers for agents.
build:
  version: "0.1.0"
trace:
  enabled: true
commands:
  - name: file
    description: Read file contents.
    commands:
      - name: read
        description: Read a file and cap output to maxBytes.
        args:
          path:
            type: string
            required: true
            description: File path to read.
          maxBytes:
            type: number
            default: 4096
            description: Maximum bytes to return.
        sh: |
          head -c {{maxBytes}} {{path}}

Shell placeholders like {{path}} must reference declared args. Hargness validates them and shell-quotes values at runtime.

Build

Build a Hargness CLI definition into a distributable directory containing the executable and its generated skill. The source file should export a CliDefinition or CliRuntime, or be a Hargness YAML definition.

hargness build --source ./cli.ts

YAML definitions use the same flag:

hargness build --source ./cli.yaml

By default this writes:

~/.hargness/<cli-name>/dist/<version>/
  <cli-name>
  SKILL.md

Pass --outdir to choose the directory explicitly:

hargness build --source ./examples/fs.ts --outdir ./dist/fs

The programmatic API is the same:

import { buildCli } from "@nendlabs/hargness";

await buildCli({
	source: "./examples/fs.ts",
	outdir: "./dist/fs",
});

Run

After building, give agents the executable and generated SKILL.md:

./dist/fs/fs dir list --path ./src --session-id agent-session-123
./dist/fs/fs file read --path ./README.md --maxBytes 256 --session-id agent-session-123

--session-id is optional, but agents should pass a stable value across related invocations so traces can be correlated.

Traces

Set trace: { enabled: true } in the CLI definition to write invocation records under:

~/.hargness/<cli-name>/trace/<build-hash>/<run-id>/
  manifest.json
  artifacts/

List recent trace manifests for a CLI:

hargness trace list --cli fs

Show the latest trace manifest, or a specific manifest:

hargness trace show --cli fs
hargness trace show --cli fs --buildHash <build-hash> --runId <run-id>

Use --dir <trace-root> when a CLI definition writes traces to a custom trace.dir.

Args marked secret: true are redacted in manifests and generated examples.