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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@traceweave/trf-analyzer

v0.1.0

Published

Graph analytics for .twpack files - TRF (Traceability Report Framework)

Downloads

14

Readme

@traceweave/trf-analyzer

Graph analytics for .twpack files - TRF (Traceability Report Framework)

Installation

npm install @traceweave/trf-analyzer

Usage

Basic Analysis

import { TwpackAnalyzer } from '@traceweave/trf-analyzer';

// Create analyzer instance
const analyzer = new TwpackAnalyzer();

// Load a .twpack file
await analyzer.loadTwpack('./my-pack.twpack');

// Get graph statistics
const stats = analyzer.getStats();
console.log(`Total Artifacts: ${stats.totalArtifacts}`);
console.log(`Total Links: ${stats.totalLinks}`);
console.log(`Artifacts by Kind:`, stats.artifactsByKind);

Impact Analysis

Find all artifacts affected by a change to a given artifact:

const impact = analyzer.impactAnalysis('req:BRAKE-001');

console.log(`Total Impacted: ${impact.totalImpacted}`);
impact.impactedArtifacts.forEach(artifact => {
  console.log(`- ${artifact.id} (distance: ${artifact.distance})`);
  console.log(`  Path: ${artifact.path.join(' -> ')}`);
});

Root Cause Analysis

Find potential root causes that could have led to an issue:

const rootCause = analyzer.rootCauseAnalysis('test:FAILED-001');

console.log(`Total Root Causes: ${rootCause.totalRootCauses}`);
rootCause.rootCauses.forEach(cause => {
  console.log(`- ${cause.id} (distance: ${cause.distance})`);
});

Coverage Analysis

Check if artifacts of a given kind are properly linked (e.g., test coverage):

// Check if all requirements are verified by tests
const coverage = analyzer.coverageAnalysis('requirement', 'verified_by');

console.log(`Coverage: ${coverage.coveragePercentage.toFixed(1)}%`);
console.log(`Covered: ${coverage.coveredArtifacts}/${coverage.totalArtifacts}`);

if (coverage.uncoveredArtifacts.length > 0) {
  console.log('Uncovered requirements:');
  coverage.uncoveredArtifacts.forEach(id => console.log(`- ${id}`));
}

Path Finding

Find trace paths between two artifacts:

const paths = analyzer.findPaths('req:BRAKE-001', 'test:HIL-ABS-042');

paths.paths.forEach((path, index) => {
  console.log(`Path ${index + 1} (length ${path.length}):`);
  console.log(`  ${path.path.join(' -> ')}`);
  console.log(`  Relations: ${path.relations.join(' -> ')}`);
});

Features

  • Impact Analysis - Forward graph traversal to find affected artifacts
  • Root Cause Analysis - Backward graph traversal to find potential causes
  • Coverage Analysis - Check linkage coverage by artifact kind
  • Path Finding - Find trace paths between artifacts
  • Graph Statistics - Overall graph metrics and analysis
  • SQLite Storage - Efficient in-memory or persistent storage
  • Performance - Sub-second queries for 10K-100K artifacts

API Reference

TwpackAnalyzer

Main class for graph analytics.

Methods

  • loadTwpack(path: string) - Load a .twpack file
  • loadData(artifacts, links) - Load data directly
  • impactAnalysis(artifactId) - Perform impact analysis
  • rootCauseAnalysis(artifactId) - Perform root cause analysis
  • coverageAnalysis(kind, relation?) - Perform coverage analysis
  • findPaths(from, to, maxPaths?) - Find paths between artifacts
  • getStats() - Get graph statistics
  • getArtifact(id) - Get artifact by ID
  • getAllArtifacts() - Get all artifacts
  • getArtifactsByKind(kind) - Get artifacts by kind
  • close() - Close database connection

Use Cases

Safety-Critical Development

// Find all tests impacted by a requirement change
const impact = analyzer.impactAnalysis('req:SAFETY-042');

// Check if all ASIL-D requirements are verified
const coverage = analyzer.coverageAnalysis('requirement');
const asilDReqs = analyzer.getArtifactsByKind('requirement')
  .filter(r => r.fields.safety_level === 'ASIL-D');

Compliance Auditing

// Verify traceability from requirement to test
const paths = analyzer.findPaths('req:ISO26262-1.2.3', 'test:HIL-001');
if (paths.paths.length === 0) {
  console.error('Missing traceability!');
}

// Check test coverage
const testCoverage = analyzer.coverageAnalysis('requirement', 'verified_by');

License

MIT