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

@agent-relay/github-primitive

v6.0.13

Published

GitHub workflow primitive for Agent Relay

Downloads

4,463

Readme

@agent-relay/github-primitive

GitHub workflow primitive for Agent Relay. It exposes a typed client and a workflow integration step that can run through the local gh CLI or a cloud GitHub proxy.

Runtime Selection

The primitive supports three runtime modes:

  • auto: prefer cloud when Nango or relay-cloud credentials are present, otherwise use the local gh CLI when available.
  • local: use gh api from the current machine.
  • cloud: use Nango first, then relay-cloud proxy when configured.
import { GitHubClient } from '@agent-relay/github-primitive';

const github = await GitHubClient.create({
  runtime: 'auto',
});

const repo = await github.getRepo('AgentWorkforce', 'relay');
console.log(repo.defaultBranch);

Actions

The client and workflow step support:

  • Repositories: listRepos, getRepo
  • Issues: listIssues, createIssue, updateIssue, closeIssue
  • Pull requests: listPRs, getPR, createPR, updatePR, mergePR
  • Files: listFiles, readFile, createFile, updateFile, deleteFile
  • Branches and commits: listBranches, createBranch, listCommits, createCommit
  • Identity: getUser, listOrganizations

Workflow Step

import { createGitHubStep } from '@agent-relay/github-primitive/workflow-step';

createGitHubStep({
  name: 'read-readme',
  action: 'readFile',
  repo: 'AgentWorkforce/relay',
  params: {
    path: 'README.md',
  },
  output: {
    mode: 'data',
    format: 'text',
  },
});

See examples/github-step.ts for a workflow runner example and examples/github-client.ts for a standalone client example.

End-to-end PR workflow

examples/end-to-end-pr-workflow.ts walks the full PR lifecycle against a single runtime:

  1. getRepo — inspect + log the selected runtime.
  2. createBranch off the base branch.
  3. createFile — write a marker file on the new branch.
  4. createPR — the core integration step cloud workflows migrate to.
  5. getPR — round-trip verify.
  6. updatePR — edit the PR body without code changes.
  7. listPRs — confirm indexability.
  8. (commented) mergePR — off by default so the example never merges anything real.

Run against a scratch repo:

GITHUB_REPO=AgentWorkforce/scratch npx tsx \
  packages/github-primitive/examples/end-to-end-pr-workflow.ts

Runtime selection is automatic:

| Path | Triggered when | | ----------- | ----------------------------------------------------------------------------------------------------- | | Local gh | gh auth status succeeds and no cloud creds are set | | Nango | NANGO_SECRET_KEY + NANGO_GITHUB_CONNECTION_ID + NANGO_GITHUB_PROVIDER_CONFIG_KEY present | | relay-cloud | RELAY_CLOUD_API_URL + RELAY_CLOUD_API_TOKEN + WORKSPACE_ID present (fallback when Nango absent) |

Multi-tenant routing

In cloud, every workspace has its own GitHub App install — one Nango connection per tenant. createGitHubStep accepts a per-step config field so a single workflow can route different actions through different connections. One workflow, many tenants.

examples/multi-tenant-pr-workflow.ts demonstrates this: it opens PRs in AgentWorkforce/cloud (via the AgentWorkforce app) AND in an MSD-owned repo (via MSD's app), from the same workflow definition, by varying the config: field on each step.

Cloud adoption: the resolver helper

The primitive stays tenant-unaware — it takes a GitHubRuntimeConfig and does what it's told. The tenant lookup lives in cloud, in a small helper:

// cloud/packages/web/lib/github/connection-resolver.ts
import type { GitHubRuntimeConfig } from '@agent-relay/github-primitive';

export async function githubConfigForRepo(opts: {
  repo: string; // "owner/repo"
  workspaceId?: string; // optional — cloud-owned repos default
}): Promise<GitHubRuntimeConfig> {
  const connection = await resolveWorkspaceIntegration(opts.workspaceId, 'github', opts.repo);

  return {
    runtime: 'auto',
    nango: {
      connectionId: connection.connectionId,
      providerConfigKey: connection.providerConfigKey, // 'github-agentworkforce' | 'github-msd' | 'github-nightcto' | ...
      secretKey: process.env.NANGO_SECRET_KEY,
    },
    relayCloud: {
      apiUrl: process.env.CLOUD_API_URL,
      accessToken: process.env.CLOUD_API_TOKEN,
      workspaceId: opts.workspaceId,
    },
  };
}

Workflow authors in cloud then write:

createGitHubStep({
  name: 'open-pr',
  action: 'createPR',
  repo: 'AgentWorkforce/cloud',
  params: { title, head, base, body },
  config: await githubConfigForRepo({
    repo: 'AgentWorkforce/cloud',
    workspaceId: process.env.RELAY_WORKSPACE_ID,
  }),
});

One resolver, one call-site shape. Adding a new GitHub App install is a workspace_integrations row + (optionally) a NANGO_* secret — no code change in the workflows that create PRs.