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

@factbird/cdkgithub

v1.0.4

Published

Define GitHub organization structure (teams, hierarchy, Entra ID/SCIM links) as Infrastructure-as-Code, built on the constructs programming model (inspired by AWS CDK).

Readme

cdkgithub

Declare your GitHub organization in TypeScript. Review it in a pull request. Apply it with a plan you have read.

cdkgithub synthesizing a definition, reading the organization, printing the plan, asking before a destructive change, and applying each change

Teams and their hierarchy, repository access, Entra ID group links, rulesets at both the organization and the repository level, the Actions policy, runner groups, Actions secrets and variables, code security configurations, custom properties, issue fields, member privileges, and branch protection live in one definition in git. cdkgithub diffs that definition against the live organization and applies the difference over the GitHub REST API. It is built on constructs, the library under the AWS CDK, cdk8s, and cdktf, and it keeps the CDK's interface: synth, diff, an assembly directory, --require-approval.

const org = new Organization(app, "factbird", { login: "factbird" });

const engineering = new Team(org, "engineering", {
  externalGroup: { name: "GH-Engineering" },   // roster driven by Entra ID
});

new Team(engineering, "platform", {            // nested, so a child team
  repositories: [maintain("flow-portal")],
});
Plan for organization "factbird":

  + team platform (under engineering)
  ~ team cloud on netcore: "push" -> "maintain"
  - team legacy-tools   (requires --allow-delete)

Safety is the product:

  • apply is a dry run until --yes, and even then it pauses for an interactive "y" while the plan holds destructive changes.
  • Nothing is deleted without --allow-delete, and the flag scopes down to the kinds you name, so pruning a team does not also authorize revoking an organization role.
  • Every apply that writes saves a backup first, including a rollback manifest that an ordinary apply restores.
  • Repositories are never deleted. No code path exists for it, and a test fails the build if one appears.
  • Secret values never touch the definition, the manifest, the plan, or the backups. A secret names the environment variable its value comes from, and apply seals it to GitHub's public key in process.

New to the tool? Start with Getting started. Mid-task? How-to guides. Looking up a flag or a field? Reference. Wondering why it behaves the way it does? Design notes.

Getting started

This walkthrough goes from a fresh checkout to a first applied change: two teams, one nested under the other, on an organization you administer. Nothing before the last step writes to GitHub.

Install Bun and the GitHub CLI first. With devenv, devenv shell provides both.

  1. Install dependencies and authenticate:

    bun install
    gh auth login
  2. Create examples/my-org.ts, replacing both my-orgs with your organization's login:

    import { App, Organization, Team } from "../src/index.ts";
    
    const app = new App();
    const org = new Organization(app, "my-org", { login: "my-org" });
    
    const engineering = new Team(org, "engineering", {
      description: "All engineers",
    });
    
    new Team(engineering, "platform", {
      description: "Platform and infrastructure",
    });
    
    app.synth();
  3. Synthesize the desired-state manifest:

    bun src/bin/cdkgithub.ts synth examples/my-org.ts

    This writes github.out/manifest.json and prints nothing when the definition is clean.

  4. Compare the definition against the live organization, read-only:

    bun src/bin/cdkgithub.ts diff

    The output is your organization as a tree. The two new teams appear with a + in the gutter; teams the definition does not mention are listed unmarked.

  5. Preview the exact changes an apply would make, still read-only:

    bun src/bin/cdkgithub.ts plan

    Expect two lines, + team engineering and + team platform (under engineering), and a summary saying two creates.

  6. Apply:

    bun src/bin/cdkgithub.ts apply --yes

    The plan prints again, a backup directory is announced, and the two teams are created. Creating is not destructive, so there is no prompt. Run bun src/bin/cdkgithub.ts plan once more and it reports that the organization matches the desired state.

  7. Commit examples/my-org.ts. The definition is now the reviewable record of your team structure, and every later change starts as an edit to it.

From here, the how-to guides cover the next tasks, from owning rosters to importing an existing organization, the reference documents every command, flag, and construct, and the design notes say why the tool behaves as it does.

License

Apache License 2.0.