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

kintsugi-math

v1.0.0

Published

The mathematics of beautiful error recovery — golden seams, fragment reassembly, crack graphs, wabi-sabi metrics, and resilience testing for JavaScript/TypeScript.

Readme

kintsugi-math

The mathematics of beautiful error recovery — for JavaScript/TypeScript.

In kintsugi, broken pottery is repaired with gold lacquer, making the cracks beautiful rather than hidden. This library brings that philosophy to software: transform errors into golden seams, reassemble fragmented data, map crack propagation graphs, measure wabi-sabi aesthetics, and test resilience.

Install

npm install kintsugi-math

Quick Start

import {
  goldenRepair,
  repairTraceback,
  FragmentCollection,
  entropyOfErrors,
  goldenRatio,
  aestheticScore,
  buildCrackGraph,
  findGoldenJoints,
  shortestCrackPath,
  injectFaults,
  measureRecovery,
} from "kintsugi-math";

// Transform an error into a golden seam
const seam = goldenRepair(new TypeError("not a function"));
console.log(seam.severity);    // number 0-10
console.log(seam.position);    // "TypeError: not a function"
console.log(seam.repairQuality); // "Ensure correct argument types..."

// Reassemble fragmented data
const coll = new FragmentCollection();
coll.add([1, 2, 3], 0.9, 0);
coll.add([7, 8], 0.7, 5);
const whole = coll.reassemble(); // fills gaps with interpolation

// Measure wabi-sabi aesthetics
const entropy = entropyOfErrors(["TypeError", "RangeError", "TypeError"]);
const beauty = goldenRatio(1.618, 1.0); // ≈ 1.0
const score = aestheticScore([1, 2, null, 4]); // 0 < score < 1

// Build crack propagation graphs
const graph = buildCrackGraph([
  { source: "database", target: "api" },
  { source: "api", target: "frontend" },
]);
const joints = findGoldenJoints(graph); // highest-impact repair points
const path = shortestCrackPath(graph, "database", "frontend");

// Test resilience
const { results, faultCount } = injectFaults(() => compute(), 0.2);
const report = measureRecovery(recoverFromError, [err1, err2, err3]);
console.log(report.recoveryRate); // 0-1

API

Types

  • GoldenSeam{ severity, position, repairQuality } — A repair point extracted from an error.
  • Fragment{ data, confidence, offset } — A piece of partial data.
  • CrackGraph{ nodes, edges, errorCounts, edgeWeights } — Directed error propagation graph.
  • GoldenJoint{ node, impact, beauty } — High-impact repair point in a crack graph.
  • WabiSabiReport{ entropy, ratio, score, imperfections, description } — Imperfection metrics.
  • ResilienceReport{ recoveryRate, meanTimeToRepair, aestheticQuality, totalFaults, successfulRecoveries } — Recovery stats.

goldenRepair

  • goldenRepair(error)GoldenSeam
  • repairTraceback(error)GoldenSeam[]
  • severityScore(error)number (0–10)

FragmentCollection

  • new FragmentCollection()
  • .add(data, confidence, offset)
  • .sort() — sort by confidence (descending)
  • .reasemble()number[] — fills gaps with confidence-weighted interpolation
  • .length, .totalConfidence, .averageConfidence

wabiSabi

  • entropyOfErrors(errors)number (Shannon entropy in bits)
  • goldenRatio(recovered, lost)number (0–1, closeness to φ)
  • aestheticScore(data)number (0–1)

cracks

  • buildCrackGraph(errors)CrackGraph
  • findGoldenJoints(graph)GoldenJoint[]
  • shortestCrackPath(graph, source, target)string[] | null

resilience

  • injectFaults(fn, faultRate){ results, faultCount }
  • measureRecovery(system, faults)ResilienceReport

License

MIT