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

@natl/agent

v0.1.0

Published

NATL Agent — generate YAML tests from git diffs via OpenAI-compatible LLM

Readme

@natl/agent

CI agent that turns a git diff into suggested NATL YAML tests via an OpenAI-compatible LLM Gateway, then gates output with JSON Schema + parseNatlDocument (same bar as natl validate).

Install

npm install -D @natl/agent @natl/cli

Config (natl-agent.yml)

llm:
  provider: openai   # openai | ollama | azure | custom
  endpoint: https://api.openai.com/v1
  api_key: ${LLM_API_KEY}
  model: gpt-4o-mini
  parameters:
    temperature: 0    # always forced to 0
    max_tokens: 2048
    top_p: 0.9
    seed: 42
mode: comment
test_roots: [tests, examples]

Examples in examples/:

| File | Use case | |------|----------| | natl-agent.openai.yml | Cloud OpenAI | | natl-agent.ollama.yml | Local Ollama (offline) | | natl-agent.azure.yml | Azure OpenAI | | natl-agent.custom.yml | vLLM / NIM / LM Studio / LocalAI |

CLI

# Cloud
export LLM_API_KEY=sk-...
natl-agent --config examples/natl-agent.openai.yml --mode stdout

# Local Ollama (no API key)
ollama serve && ollama pull llama3.2
natl-agent --config examples/natl-agent.ollama.yml --mode stdout

# Flags override file/env
natl-agent --provider ollama --base-url http://127.0.0.1:11434/v1 --model llama3.2

| Flag / env | Meaning | |------------|---------| | --config | Path to natl-agent.yml | | LLM_API_KEY / OPENAI_API_KEY | Cloud key (optional for ollama) | | OPENAI_BASE_URL / NATL_AGENT_ENDPOINT | Base URL …/v1 | | --provider / NATL_AGENT_PROVIDER | openai | ollama | azure | custom | | --mode | comment | stdout | commit | | --cli-validate | Extra gate via npx @natl/cli validate |

Determinism: every request sends temperature: 0 (non-zero config values are ignored with a warning).

GitHub Actions

- uses: actions/checkout@v4
  with:
    fetch-depth: 0
- uses: ./agent
  with:
    openai_api_key: ${{ secrets.OPENAI_API_KEY }}
    openai_base_url: ${{ vars.OPENAI_BASE_URL }}
    openai_model: ${{ vars.OPENAI_MODEL }}
    base_ref: origin/${{ github.base_ref }}
    config: natl-agent.yml   # optional

Pipeline

  1. Diff (simple-git)
  2. Semantic UIR — Tree-sitter WASM (Py/JS/TS/Java/Go/C#) with heuristic fallback
  3. Few-shot context from existing YAML (+ import hints)
  4. LLM Gateway → OpenAI-compatible chat/completions
  5. Validate — YAML → AJV (natl.test.schema.json) → parseNatlDocument
  6. Publish PR comment / stdout / commit

Programmatic API

import { runAgent, loadAgentConfig, createLlmClient } from '@natl/agent';

const config = loadAgentConfig({ cwd: process.cwd() });
const result = await runAgent({ config });

Offline / private

Point provider: ollama (or custom) at a local server. No outbound LLM traffic; only local git + filesystem are required.

Tiny model via npm (Transformers.js)

# once — creates gitignored ./local-llm/
node scripts/local-llm/setup.mjs
cd local-llm && npm start
# → http://127.0.0.1:8787/v1

Config: examples/natl-agent.local-transformers.yml or tests/agent-release/natl-agent.local.yml.

Pre-release suite: tests/agent-release/ (pnpm test).

Docker

cd agent
docker build -t natl-agent .
docker run --rm -e LLM_API_KEY -v "$PWD/..:/work" -w /work natl-agent --mode stdout --base origin/main

Optional Compose (Ollama + agent profile): see docker-compose.yml.

Eval (DoD ≥70% validate gate)

cd agent
pnpm eval
# writes eval/report.json — synthetic 100 candidates, no live LLM

Troubleshooting

| Symptom | Fix | |---------|-----| | Missing API key | Set LLM_API_KEY or use provider: ollama | | Empty UIR / no tests | Diff has no supported language files; check --base | | Validation exit 2 | Model YAML failed AJV/parseNatlDocument — see PR comment error | | Tree-sitter load fail | Heuristic fallback kicks in automatically |