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

@trigguard/decision

v0.2.1

Published

TrigGuard HTTP decision client: authorize() → POST /decide (no policy in-process)

Readme

@trigguard/decision

Thin Node client: authorize()POST /decide → remote authority returns PERMIT or DENY. No policy logic in this package.

Contract: /decidePERMIT | DENY only — see decision-output.md.


Install

npm install @trigguard/decision

The unscoped npm name trigguard is a different package. Use @trigguard/decision for this HTTP client.

From the monorepo:

npm install file:./sdk/node

CommonJS (recommended)

const { authorize } = require("@trigguard/decision");

const decision = await authorize({
  surface: "deployCommit",
  context: {
    repository: "org/repo",
    ref: "refs/heads/main",
    sha: "abc123",
  },
});

if (decision.decision !== "PERMIT") {
  throw new Error("TrigGuard denied execution");
}

Optional second argument: { endpoint, token, timeoutMs, signal, maxRetries }. Defaults: TRIGGUARD_ENDPOINT / TRIGGUARD_TOKEN from the environment.


ESM usage (Node interop)

This package is published as CommonJS ("type": "commonjs"). In Node, use a default import and call .authorize:

import tg from "@trigguard/decision";

const decision = await tg.authorize({
  surface: "deployCommit",
  context: { repository: "org/repo", ref: "refs/heads/main", sha: "abc123" },
});

if (decision.decision !== "PERMIT") {
  throw new Error("TrigGuard denied execution");
}

Named imports are not supported in 0.2.x (import { authorize } from "…" may fail or behave inconsistently) because there is no separate exports.import entry yet. A dual ESM surface is planned for a future minor (e.g. 0.3).


Architecture

TrigGuard uses a remote decision authority (policy decision point).

authorize() sends JSON to TRIGGUARD_ENDPOINT (default https://decision.trigguard.ai/decide). The service evaluates the payload and returns PERMIT or DENY (and often reasonCode / human-readable fields).

CI integrations (e.g. trigguard-github-action/decision-gate) fail closed when the decision is not PERMIT.

Standard policy shape:

Policy Enforcement Point (your CI job, app, or SDK caller)
Policy Decision Point (TrigGuard /decide)
PERMIT | DENY


signals and context

The SDK forwards the object you pass: surface (string), optional signals, optional context. The authority runs remotely; richer structured fields allow stronger policy without embedding rules in the client.

Example:

{
  "surface": "merge.pull_request",
  "signals": {
    "event_type": "pull_request",
    "actor": "dev123"
  },
  "context": {
    "repository": "org/repo",
    "branch": "feature-x"
  }
}

What we are not doing in 0.2.x: no built-in diff extraction, no automatic surface inference from GitHub events, and no mandated signal schema — integrators supply evidence explicitly.


Resilience (0.2.x)

The client uses fetch with a default 5s timeout, optional AbortSignal, limited retries on transient errors, and typed errors: TrigGuardNetworkError, TrigGuardTimeoutError, TrigGuardDecisionServiceError.


Environment

| Variable | Purpose | |----------|---------| | TRIGGUARD_ENDPOINT | Decision URL (default: https://decision.trigguard.ai/decide) | | TRIGGUARD_TOKEN | Bearer token when not passed in options.token |


Publish (maintainers)

cd sdk/node && npm login && npm publish --access public

See docs/distribution/PUBLISH_DECISION_CLIENT.md.

Related package: packages/trigguard-sdk (npm trigguard) is the broader unified SDK — different artifact from @trigguard/decision.

See also