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

@gitlode/plugin-file-type

v0.2.0

Published

Official gitlode plugin for file type classification

Readme

@gitlode/plugin-file-type

Official gitlode plugin package for file type classification.

This plugin enriches per-file gitlode records with file type information derived from the file path. It is intended for use with --per-file; commit-only output does not carry file path facts for this plugin to classify.

The plugin is intentionally limited to mechanically determined file type classification based on file path signatures. It does not classify source/test role, architecture domain, ownership, or other interpretation-heavy concerns.

Installation

npm install -g @gitlode/plugin-file-type

Usage

Configure gitlode with --config:

{
  "version": 1,
  "extensions": {
    "file-type": {
      "entrypoint": "@gitlode/plugin-file-type"
    }
  }
}

Run gitlode with per-file output enabled:

gitlode -r main --per-file --config ./gitlode.config.json ./my-repo

Example output in each record:

{
  "extensions": {
    "file-type": {
      "name": "TypeScript"
    }
  }
}

Configuration

Default effective plugin config:

{
  "debug": false,
  "ruleSets": ["common"],
  "mappings": {},
  "unknownPolicy": "emit"
}

Supported config fields:

  • debug: optional boolean. Default is false.
  • ruleSets: optional string array. V1 supports only "common". Default is ["common"].
  • mappings: optional object from path signature to non-empty file type name.
  • unknownPolicy: optional string, either "emit" or "skip". Default is "emit".

Validation behavior:

  • Unknown top-level config fields are treated as fatal config errors.
  • Duplicate ruleSets values are invalid.
  • Invalid mapping signatures are invalid.

Mapping Key Syntax

mappings uses a single object for both suffix and basename matching.

  • Keys beginning with *. are suffix mappings.
  • Keys not beginning with *. are exact basename mappings.
  • General glob syntax is not supported.
  • Compound suffixes are supported (for example *.d.ts).
  • Dot-prefixed basename keys are valid (for example .gitignore, .config.json, .ts).

Example:

{
  "mappings": {
    "*.vue": "Vue",
    "*.d.ts": "TypeScript",
    "Dockerfile": "Dockerfile",
    ".config.json": "Tool config"
  }
}

Matching Semantics

Matching precedence is:

  1. user basename mapping
  2. user suffix mapping
  3. built-in basename mapping
  4. built-in suffix mapping
  5. unknown handling

Additional rules:

  • Basename matching is case-sensitive.
  • Suffix matching is case-insensitive.
  • Longest suffix wins among suffix matches.
  • Deleted file changes are classified the same as added/modified file changes.

Built-In Rule Set

V1 provides one built-in rule set: common.

common is a pragmatic curated set that includes widely used language, format, archive, and repository filename mappings. The full mapping table lives in src/rule-sets.ts and is grouped by maintenance categories in source comments.

Examples from common include:

  • *.ts -> TypeScript
  • *.json -> JSON
  • package.json -> npm package manifest
  • .gitignore -> Git ignore file

Strongly ambiguous signatures are intentionally omitted in V1 and can be added later when needed.

Unknown Handling

  • unknownPolicy: "emit" (default) emits { "name": "Unknown" }.
  • unknownPolicy: "skip" returns plugin skip, so gitlode writes null for this namespace.

Debug Output

When debug: true, the plugin adds _debug metadata:

{
  "name": "TypeScript",
  "_debug": {
    "source": "common",
    "matched": "*.ts"
  }
}

source values:

  • common: built-in rule set match
  • plugin-config: user mapping match
  • unknown: unknown classification

Commit Facts

For commit facts (fact.type === "commit"), the plugin always returns skip.

Compatibility

This package declares:

"peerDependencies": {
  "gitlode": "^0.10.0"
}

If the running gitlode version does not satisfy this range, gitlode emits a warning and continues.

License

MIT

Changelog

Changelog