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

@brainwav/diagram

v1.1.0

Published

Generate architecture evidence for humans and AI agents

Readme

archscope

Architecture evidence for humans and AI coding agents.

Table of Contents

Overview

archscope is the canonical CLI identity for the @brainwav/diagram package. The compatibility command diagram remains available during the migration window for existing scripts.

Before you review a PR, run Archscope. Before an AI agent edits a repo, give it Archscope evidence.

The CLI scans your repository and produces architecture evidence:

  • A default evidence pack (scan) for first-run review and agent handoff
  • PR architecture impact reports (workflow pr)
  • AI-context artifacts (context)
  • Architecture policy validation (validate)
  • Mermaid diagrams (generate, generate-all), including schema-backed ERD output

Default resolution precedence for scan parameters is explicit:

  1. CLI flags
  2. .diagramrc
  3. command built-ins

This applies to patterns, exclude, maxFiles, and theme where relevant.

Quick Start

git clone https://github.com/jscraik/diagram-cli.git
cd diagram-cli
npm install
npm link

After npm link, use archscope ... for new workflows. Without npm link, run commands with node src/diagram.js ....

Architecture Evidence Pack

The default evidence pack gives humans a short architecture brief and gives AI coding agents a manifest-first context path.

Use this path for new repositories:

archscope init .
archscope doctor .
archscope scan .

What this gives you:

  • .architecture.yml starter rules
  • .diagramrc defaults
  • CI step sample at .diagram/ci/github-actions-step.yml
  • toolchain diagnostics before CI rollout
  • .diagram/manifest.json as the stable artifact index
  • .diagram/brief.md as the human architecture brief
  • .diagram/report.html as the human architecture report
  • .diagram/agent-context.json as the canonical agent handoff
  • .diagram/architecture.mmd as the first architecture diagram

For PR review evidence, add git refs:

archscope scan . --base origin/main --head HEAD

That keeps the same evidence pack and adds .diagram/pr-impact/pr-impact.json when refs resolve. .diagram/report.html is written by default and becomes the primary human artifact when report generation succeeds.

Human Workflows

# Analyze repository structure
archscope analyze .

# Generate the default evidence pack
archscope scan .

# Generate one diagram and open preview
archscope generate . --type architecture --open

# Analyze only changed files in your branch
archscope changed . --base origin/main --head HEAD

# Explain a local dependency neighborhood
archscope explain auth-service .

# PR risk/blast-radius report
archscope workflow pr . --base origin/main --head HEAD --risk-threshold medium --fail-on-risk

# PR evidence pack for reviewers and agents
archscope scan . --base origin/main --head HEAD

Optional advanced media output remains available after the evidence path is working:

archscope generate-video .
archscope generate-animated .

AI Agent Workflows

# Stable machine outputs
archscope scan . --format json --deterministic
archscope scan . --base origin/main --head HEAD --format json --deterministic
archscope generate . --type architecture --format json --deterministic
archscope workflow pr . --base origin/main --head HEAD --format json --deterministic

# Canonical agent read order
cat .diagram/manifest.json
cat .diagram/brief.md
cat .diagram/agent-context.json

Agents should read .diagram/manifest.json first, then consume only artifacts whose manifest status is written. The standalone context command remains available for refreshing the older .diagram/context pack when existing automation depends on it.

Machine Output Contracts

  • Use --format json for machine output.
  • --json is a compatibility alias and is normalized to --format json.
  • Covered command outputs use the canonical machine envelope with schemaVersion, command, status, meta, data, errors, and optional agentSummary.
  • Use --deterministic for stable ordering/timestamps in machine payloads.
  • JSON-capable command coverage is tracked in .diagram/contracts/machine-command-coverage.json.
  • scan --format json nests the evidence manifest under data.evidencePack and includes data.pr when PR refs are supplied.
  • PR impact JSON nests its analytical payload under data.prImpact and includes agentSummary with:
    • changedComponents
    • riskReasons
    • suggestedReviewerChecks

Migration State

Current migration state: compatibility.

  • Canonical command: archscope
  • Compatibility command: diagram
  • Package name: @brainwav/diagram
  • Finalization policy: .diagram/migration/finalization-policy.json
  • Release readiness evidence: .diagram/migration/releases/<releaseId>/migration-readiness.json
  • Latest readiness pointer: .diagram/migration/migration-readiness.json
  • Append-only readiness ledger: .diagram/migration/releases/ledger.json

Do not treat the package as renamed or the compatibility command as removable until the finalization policy and release evidence prove the required migration window. See Archscope compatibility migration.

Documentation Index

Development

npm install
npm test
npm run test:deep
npm run migration:readiness
node src/diagram.js --help

License

Apache 2.0 - see LICENSE.

Distribution

Official installation instructions are maintained in this repository only.

Third-party indexes or mirrors may list this project, but they are not affiliated with, endorsed by, or maintained by this project unless explicitly stated here.