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

@kidkender/archmind-lens

v0.2.1

Published

Symbol-first context for Go services: from any function, find the HTTP routes, background loops, callbacks and startup code that reach it, and whether the call runs inside a database transaction.

Readme

@kidkender/archmind-lens

Start from any Go function, not from a route. Given a service method, a repository call or a helper, lens walks the call graph upward and tells you which HTTP routes, goroutines and startup code reach it, and whether the call runs inside a database transaction.

An AI agent rarely begins at a route. It greps a keyword and lands in a service or a repository. lens answers the question that comes next: who calls this, and through which path?


Install

npm install @kidkender/archmind-lens @kidkender/archmind-go-parser

Go only (Gin projects get route names; plain Go code gets the call graph without routes).


Usage

import { buildCallGraph, findEntries, findTransactionEffects, handlerRouteIndex } from "@kidkender/archmind-lens"
import { readGoProjectFiles, parseGinProjectAt } from "@kidkender/archmind-go-parser"

const root = "/path/to/go-project"
const graph = buildCallGraph(readGoProjectFiles(root))
const handlerRoutes = handlerRouteIndex(parseGinProjectAt(root))

// Who reaches this function?
for (const e of findEntries(graph, "CombatService.AttackCast", { handlerRoutes })) {
  console.log(e.kind, e.route ?? e.label, e.path.join(">"), e.callSite, e.inTxn ? "[txn]" : "")
}

// Shared state changed inside a transaction by a function with no undo step
console.log(findTransactionEffects(graph))

findEntries returns one entry per way into the symbol:

| Field | Meaning | |---|---| | kind | http, background (target of a go statement), startup (main, container, cmd/) or unreferenced (nobody calls it) | | route | METHOD /path, for http entries | | path | function keys from the entry down to the symbol | | inTxn | some call on the path is inside a .Transaction(func...) closure | | async | the path goes through a go statement: the work outlives the request | | callSite | { file, line } of the call that reaches the symbol | | indirect | links that are not a written call: callback (a func stored in a field) or ref (a function or method used as a value). Worth checking by hand |

Symbols are written as Type.Method or Func, as declared in Go.


As an MCP tool

@kidkender/archmind-mcp (0.7.0 and later) exposes this as archmind_symbol_context: symbol in, compact text out, one line per route with the path, the call site and the flags above. About a third of the size of the JSON form.


What it resolves

Calls are resolved from types, not from method names:

  • receivers, struct fields, typed parameters, local variables (composite literals, constructors, var x T, range values) and package-level variables;
  • interfaces: a call on an interface value reaches every type that declares all of the interface's methods with the same parameter and result types;
  • generic calls with explicit type arguments (bindJSON[Req](c));
  • functions and methods used as values (h.respond(h.svc.Accept), return s.hub.In);
  • functions stored in fields: through a setter (g.SetBlock(func...)), an assignment (hub.OnChat = svc.SendFromWS) or a composite literal (&G{sight: terrain});
  • go statements and calls inside .Transaction(...) closures.

When a call cannot be resolved by type, lens links it only if exactly one method in the project has that name. It never picks among several.


Transaction check

findTransactionEffects reports a call made while a transaction is open (in the closure, or up to four calls deep) when the callee is a method of a mutex-guarded type that writes its own state, and the function that opened the transaction has no call named rollback, undo, revert or compensate. A rollback cannot undo in-memory state, so such a call is a candidate bug.

It is a heuristic: it counts direct writes only, an undo step is recognised by name only, and an empty list is not proof of safety.


How accurate is it

Measured on one private Gin + GORM game API (552 functions), against a type-checker call graph (Go SSA + VTA) used as the reference:

  • the route set was exact for 98.4% of the functions;
  • every route lens reported was real (precision 100%) and 98.5% of the real routes were found.

One codebase, one reference tool that has blind spots of its own, and the tuning done along the way is described in the benchmark notes of the repository. Treat the numbers as a measurement on that project, not a guarantee.

Limits

  • Go only. No GDScript or other languages.
  • Interface matching does not follow embedded interfaces, and two types with the same name in different packages are not told apart.
  • Dynamic dispatch the types cannot show (reflection, function values built at runtime) is not followed.
  • A route is only named for Gin handlers the route parser can resolve.

License

MIT