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

docsguard

v0.1.6

Published

Documentation Integrity Engine

Downloads

341

Readme

Leer en otros idiomas: Español

DocsGuard

Documentation Integrity Engine — Eliminates code-documentation drift through heuristic validation, multi-format parsing, and interactive correction.

License: MIT


The Problem

Documentation drifts from code silently. Arguments get renamed, parameters get added, types change — and the docs stay frozen in time. By the time someone notices, the damage is done.

The Solution

DocsGuard links functions directly to their documentation sections and validates them automatically:

  • Static link validation — Does the documented section actually exist?
  • Ghost argument detection — Is something documented that doesn't exist in code?
  • Missing argument detection — Is there a code parameter missing from docs?
  • Type mismatch detection — Does string in docs match i32 in code?
  • Interactive scaffold — Never modifies code without explicit permission
  • Baseline system — Adopt on legacy projects with zero CI breakage on Day 1

Quick Start

Installation

Via npm (Recommended):

npm install -g docsguard

From source (Rust):

cargo install --path .

1. Annotate your code

Add @docs annotations above functions to link them to documentation:

/// @docs: [auth-login]
fn login(username: &str, password: &str) -> Result<Token> {
    // ...
}

2. Mark your docs

Add invisible markers in your Markdown documentation:

<!-- @docs-id: auth-login -->
## Login

Authenticates a user with credentials.

| Param    | Type   | Description          |
|----------|--------|----------------------|
| username | string | The user's login name |
| password | string | The user's password   |

3. Validate

docsguard check src/auth.rs docs/api.md
[i] Info en fn login (src/auth.rs:3)
    -> Enlace verificado: fn login <-> sección 'Login'

---
Resumen: 0 errores, 0 advertencias, 1 total

Commands

docsguard check <doc_file> <code_files>...

Validates links between code and documentation. Exits with code 1 if errors are found (CI-friendly).

docsguard check docs/api.md src/main.rs
docsguard check docs/api.md src/core/validator.rs src/parser/*.rs
docsguard check docs/api.md src/main.rs --project-root .  # use baseline

docsguard scaffold <code_file> <doc_file>

Interactive TUI that suggests links between unlinked functions and doc sections using Levenshtein heuristics (>80% confidence).

docsguard scaffold src/main.rs docs/api.md              # interactive
docsguard scaffold src/main.rs docs/api.md --dry-run     # preview only
docsguard scaffold src/main.rs docs/api.md --force        # accept all

docsguard watch <code_file> <doc_file>

Watches files for changes and re-validates automatically (<200ms response).

docsguard watch src/main.rs docs/api.md

docsguard baseline <code_file> <doc_file>

Dumps current errors to .docsguard/baseline.yaml so CI passes immediately. Only new regressions will be blocked.

docsguard baseline src/main.rs docs/api.md --project-root .

Supported Languages

| Language | Extensions | Parser | |------------|------------------|-------------| | TypeScript | .ts, .tsx | tree-sitter | | JavaScript | .js, .jsx | tree-sitter | | Rust | .rs | tree-sitter |

Documentation Formats

DocsGuard parses three argument documentation formats automatically:

Tables:

| Param | Type | Description |
|-------|------|-------------|
| name  | string | The user's name |

Lists:

- name: The user's name
- `email` (`string`): The user's email

Definitions:

`name` (`string`): The user's name
`email` (`string`): The user's email

Docker

docker build -t docsguard .
docker run --rm -v $(pwd):/workspace docsguard check src/main.rs docs/api.md

CI Integration

Add to your GitHub Actions workflow:

- name: DocsGuard Check
  run: |
    cargo install --path .
    docsguard check src/main.rs docs/api.md

Or use the baseline for gradual adoption:

- name: DocsGuard Check (with baseline)
  run: |
    cargo install --path .
    docsguard check src/main.rs docs/api.md --project-root .

Type Normalization

DocsGuard normalizes types before comparison, so these are considered equivalent:

| Code Type | Doc Type | Normalized | |-----------|----------|------------| | &str | String | string | | i32 | number | number | | bool | Boolean| boolean | | UUID | String | string |

Architecture

src/
  main.rs                CLI entry point (clap)
  core/
    types.rs             Domain types: CodeEntity, DocSection, Arg, ValidationResult
    validator.rs         Link validation + argument checking + type mismatch
    heuristic.rs         Levenshtein-based matching (strsim)
  parser/
    code_parser.rs       Language detection + @docs annotation extraction
    doc_parser.rs        pulldown-cmark: Table, List, Definition strategies
    lang/
      typescript.rs      tree-sitter TypeScript/JavaScript parser
      rust.rs            tree-sitter Rust parser
  interactive/mod.rs     Scaffold TUI (dialoguer)
  watch/mod.rs           File watch mode (notify)
  baseline/mod.rs        Baseline system (serde_yaml)

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

MIT License. See LICENSE for details.