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

@citemap/validator

v0.3.1

Published

Validate citemap.json files — schema checks, quality scoring, level assessment, field diagnostics

Downloads

356

Readme

@citemap/validator

Validate citemap.json files against the official schema, with quality scoring, level assessment, and diagnostic recommendations.

Supports CiteMap v2.0 and v3.0.

Install

npm install @citemap/validator

Usage

Basic Validation

import { validate } from '@citemap/validator';

const result = validate(myCitemapData);

console.log(result.valid);          // true/false
console.log(result.version);        // "3.0"
console.log(result.level.badge);    // "Level 2 ★★☆"
console.log(result.score.overall);  // 0-100

if (result.warnings.length > 0) {
  result.warnings.forEach(w => {
    console.log(`${w.path}: ${w.message}`);
    console.log(`  → ${w.suggestion}`);
  });
}

Full Diagnosis

import { diagnose } from '@citemap/validator';

const diagnosis = diagnose(myCitemapData);

console.log(diagnosis.siteType);        // "local-business"
console.log(diagnosis.presentModules);  // ["localBusiness"]
console.log(diagnosis.missingModules);  // []
console.log(diagnosis.fieldCoverage);   // { total: 173, filled: 173, percentage: 100 }
console.log(diagnosis.level.badge);     // "Level 3 ★★★"

// Next-level coaching
diagnosis.level.nextLevelHints.forEach(hint => {
  console.log(`To reach Level ${diagnosis.level.current + 1}: ${hint}`);
});

Validate + Diagnose in One Call

import { validateAndDiagnose } from '@citemap/validator';

const result = validateAndDiagnose(myCitemapData);
// result.valid, result.errors, result.warnings, result.score, result.level
// result.diagnosis.siteType, result.diagnosis.recommendations, etc.

API Reference

validate(data: unknown): ValidationResult

Validates a citemap against the schema and returns errors, warnings, quality score, and level assessment.

diagnose(data: unknown): Diagnosis

Deep analysis with module coverage, field coverage, recommendations, and level assessment.

validateAndDiagnose(data: unknown): ValidationResult & { diagnosis: Diagnosis }

Combines both in a single call.

getApplicableModules(siteType: string): string[]

Returns module names applicable to a given site type (e.g., "restaurant"["localBusiness", "events"]).

ValidationResult

| Field | Type | Description | |-------|------|-------------| | valid | boolean | Whether the citemap passes schema validation | | errors | ValidationError[] | Schema errors (path, message, keyword) | | warnings | ValidationWarning[] | Quality warnings with suggestions | | score | QualityScore | Breakdown: overall, completeness, modules, trust (0-100 each) | | level | LevelAssessment | Current level (1/2/3), claimed vs. actual, badge, next-level hints | | version | string | Detected citemapVersion |

LevelAssessment

| Field | Type | Description | |-------|------|-------------| | current | 1 \| 2 \| 3 | Computed level based on field presence | | claimed | 1 \| 2 \| 3 \| undefined | The citemapLevel declared in the file | | claimAccurate | boolean | Whether claimed matches actual | | nextLevelHints | string[] | What to add to reach the next level | | badge | string | Display string like "Level 2 ★★☆" |

Quality Scoring

Overall = (Completeness × 0.4) + (Module Coverage × 0.3) + (Trust Signals × 0.3)
  • Completeness (0-100) — Required + recommended root fields filled
  • Module Coverage (0-100) — Applicable modules present for the site type
  • Trust Signals (0-100) — Verification block, authorized-by, answer content, verified claims, citations

v3-Specific Validation

When citemapVersion is "3.0", the validator also checks:

  • Missing citationContract (warning with suggestion)
  • Entity ID format validation (type:slug regex pattern)
  • citemapLevel claim accuracy vs. actual computed level
  • verifiedClaims type enum values

Site Type → Module Mapping

| Site Type | Applicable Modules | |-----------|-------------------| | ecommerce | ecommerce | | local-business | localBusiness | | restaurant | localBusiness, events | | saas | software | | content-publisher | content | | nonprofit | nonprofit | | healthcare | health | | education | education | | real-estate | realEstate | | legal | legal | | financial | finance | | events-venue | events | | creative-artist | creative | | government | government | | science-research | science | | person | person | | places | places | | general | (none) |

Links

License

MIT