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

@anarchitects/governance-adapter-typescript

v0.0.2

Published

Platform-independent Governance TypeScript workspace adapter that normalizes discovery into Governance Core contracts.

Readme

@anarchitects/governance-adapter-typescript

Platform-independent TypeScript workspace discovery and normalization for Governance.

Overview

@anarchitects/governance-adapter-typescript reads a TypeScript-oriented workspace as plain files and maps the result into contracts owned by @anarchitects/governance-core.

The package focuses on discovery and normalization, not on owning the canonical Governance model. It is intended for hosts that need to inspect a TypeScript workspace outside Nx and then feed the normalized result into Governance Core.

Responsibilities

This package is responsible for:

  • detecting whether a repository looks like a supported TypeScript workspace
  • parsing package-manager workspace configuration
  • parsing tsconfig.json and tsconfig.base.json resolution state
  • discovering TypeScript projects from workspace package roots
  • building a static TypeScript import graph
  • mapping discovered imports into Core-owned dependency inputs
  • deriving project tags from naming and path rules

This package is not responsible for:

  • CLI command behavior
  • canonical Governance contracts
  • Nx graph loading
  • Nx metadata extraction
  • Nx plugin runtime behavior
  • Nx executors or generators

Supported Assumptions

The current implementation assumes:

  • workspace detection based on plain package-manager files such as pnpm-workspace.yaml and package.json#workspaces
  • tsconfig parsing through root tsconfig.json, tsconfig.base.json, and deterministic extends chains
  • static analysis of relative imports, package-name imports, compilerOptions.paths, baseUrl, re-exports, and string-literal dynamic imports
  • project discovery from package-manager workspace roots rather than from Nx graph APIs

Public API

The public package surface is intentionally adapter-oriented:

import {
  buildTypeScriptImportGraph,
  createGovernanceWorkspaceAdapter,
  createTypeScriptWorkspaceAdapter,
  detectTypeScriptWorkspace,
  discoverTypeScriptProjects,
  deriveProjectTags,
  mapTypeScriptImportsToGovernanceDependencies,
  parsePackageManagerWorkspace,
  parseTsConfigResolution,
  type TsConfigResolutionModel,
  type TypeScriptImportGraph,
  type TypeScriptProjectDiscoveryResult,
  type TypeScriptWorkspaceDetectionResult,
  type WorkspacePackageResolution,
} from '@anarchitects/governance-adapter-typescript';

The root export currently includes:

  • createTypeScriptWorkspaceAdapter(...)
  • createGovernanceWorkspaceAdapter(...)
  • detectTypeScriptWorkspace(...)
  • parsePackageManagerWorkspace(...)
  • parseTsConfigResolution(...)
  • discoverTypeScriptProjects(...)
  • buildTypeScriptImportGraph(...)
  • mapTypeScriptImportsToGovernanceDependencies(...)
  • deriveProjectTags(...)
  • exported adapter result and diagnostic types from types.ts

The current API is a set of composable adapter primitives. It does not expose a single all-in-one host runner.

Parity already covered inside this package includes:

  • workspace detection and probe-style support heuristics
  • package-manager workspace parsing
  • TypeScript project discovery and tag derivation
  • tsconfig / path-alias resolution
  • static import graph extraction
  • normalization into Governance Core adapter result inputs

Usage

The typical workflow is:

  1. detect a supported workspace
  2. resolve workspace package roots
  3. discover projects
  4. resolve TypeScript path aliases
  5. build a static import graph
  6. map that graph into Core-owned dependency inputs
import {
  buildTypeScriptImportGraph,
  detectTypeScriptWorkspace,
  discoverTypeScriptProjects,
  mapTypeScriptImportsToGovernanceDependencies,
  parsePackageManagerWorkspace,
  parseTsConfigResolution,
} from '@anarchitects/governance-adapter-typescript';

const detection = detectTypeScriptWorkspace(process.cwd());

if (!detection.supported) {
  throw new Error('Unsupported TypeScript workspace.');
}

const workspacePackages = parsePackageManagerWorkspace(detection.workspaceRoot);
const projectDiscovery = discoverTypeScriptProjects({
  workspaceRoot: workspacePackages.workspaceRoot,
  packageRoots: workspacePackages.packageRoots,
});
const tsconfig = parseTsConfigResolution(detection.workspaceRoot);
const importGraph = buildTypeScriptImportGraph({
  workspaceRoot: detection.workspaceRoot,
  projects: projectDiscovery.projects,
  tsconfig,
});
const dependencyMapping = mapTypeScriptImportsToGovernanceDependencies({
  projects: projectDiscovery.projects,
  importGraph,
});

Normalization into Governance Core

This adapter normalizes into @anarchitects/governance-core contracts rather than defining a parallel model.

In practice:

  • project discovery produces GovernanceProjectInput values
  • dependency mapping produces GovernanceDependencyInput values
  • diagnostics align with Core-owned diagnostic shapes where the exported types reference them

Hosts can combine these results with Core-owned assessment, rule, signal, and extension APIs.

Package Boundaries

@anarchitects/governance-adapter-typescript is explicitly non-Nx.

That means:

  • no @nx/devkit
  • no nx
  • no Nx graph loading
  • no Nx plugin runtime assumptions
  • no executor or generator ownership

The package reads repository files directly and stays usable in plain TypeScript or mixed monorepo environments without requiring Nx.

For detailed package-boundary rules and the adapter ownership model, see ADR 0001: Governance Package Boundaries for Core, CLI, Adapters, and Extensions.

Related Packages

  • @anarchitects/governance-core owns the canonical Governance contracts and deterministic evaluation logic
  • @anarchitects/governance-cli is a separate host/runtime package and should not be treated as part of this adapter’s public API