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

docufresh-ai

v0.2.0

Published

AI-powered content freshening for docufresh - Uses Wikipedia + browser-based AI (no API keys needed)

Readme

DocuFresh-AI

npm version license

AI-powered content freshening for docufresh. Keep your documents updated with real-world facts using Wikipedia + browser-based AI.

No API keys required! The AI runs entirely in your browser or Node.js.

Features

  • Wikipedia Integration - Fetch current facts from Wikipedia (free, no auth)
  • Browser-Based AI - Uses Transformers.js to run AI locally
  • No API Keys - Everything runs locally, no OpenAI/Gemini keys needed
  • Smart Rewriting - AI rewrites sentences to incorporate fresh facts naturally
  • Paragraph Generation - Generate entire paragraphs about topics

Installation

npm install docufresh-ai

Note: Requires Node.js 18+ (for native fetch support).

Quick Start

import DocuFreshAI from 'docufresh-ai';

const ai = new DocuFreshAI();

// First call downloads the AI model (~250MB)
await ai.init();

// Get facts from Wikipedia
const text = 'Albert Einstein: {{ai_fact:Albert_Einstein}}';
console.log(await ai.process(text));
// "Albert Einstein: Albert Einstein was a German-born theoretical physicist..."

// Rewrite sentences with current facts
const text2 = '{{ai_rewrite:World_population:The world has X people}}';
console.log(await ai.process(text2));
// "The world has approximately 8.1 billion people"

// Generate paragraphs
const text3 = '{{ai_paragraph:SpaceX}}';
console.log(await ai.process(text3));
// "SpaceX is an American spacecraft manufacturer..."

AI Markers

| Marker | Description | Example | |--------|-------------|---------| | {{ai_fact:topic}} | Get Wikipedia fact | {{ai_fact:Moon}} | | {{ai_describe:topic}} | Short description | {{ai_describe:Python_(programming_language)}} | | {{ai_rewrite:topic:template}} | Rewrite with facts (X = placeholder) | {{ai_rewrite:Bitcoin:Bitcoin is worth X}} | | {{ai_paragraph:topic}} | Generate paragraph | {{ai_paragraph:Climate_change}} | | {{ai_summary:topic}} | Condensed summary | {{ai_summary:Artificial_intelligence}} | | {{ai_answer:topic:question}} | Answer question | {{ai_answer:Sun:How hot is it?}} | | {{ai_link:topic}} | Wikipedia URL | {{ai_link:JavaScript}} | | {{ai_updated:topic}} | Last update date | {{ai_updated:Tesla,_Inc.}} |

API Reference

new DocuFreshAI(options?)

Create a new instance.

const ai = new DocuFreshAI({
  model: 'Xenova/flan-t5-small',  // AI model (default)
  cacheTTL: 1000 * 60 * 60,       // Wikipedia cache: 1 hour
  onProgress: (p) => console.log(p) // Model download progress
});

ai.init()

Initialize the AI engine. Downloads the model on first run (~250MB).

await ai.init();

ai.process(text, customData?)

Process text with AI markers.

const result = await ai.process('{{ai_fact:Mars}}');

ai.processWithDocufresh(text, customData?)

Process with both AI markers and docufresh basic markers.

// Requires: npm install docufresh
const result = await ai.processWithDocufresh(
  '{{current_year}}: {{ai_fact:Moon}}'
);
// "2026: The Moon is Earth's only natural satellite..."

Direct Methods

// Get Wikipedia fact
const fact = await ai.getFact('JavaScript');

// Get full summary
const summary = await ai.getSummary('React_(JavaScript_library)');

// Search Wikipedia
const results = await ai.search('programming languages', 5);

// Rewrite with AI
const rewritten = await ai.rewrite(
  'JavaScript was created in 1995',
  'JS has been around for X years'
);

// Generate paragraph
const paragraph = await ai.generateParagraph('Node.js', 'Runtime for JavaScript');

Use Cases

Keep Blog Posts Fresh

const blogPost = `
# Tech Industry Update

{{ai_paragraph:Artificial_intelligence}}

Current AI trends show {{ai_rewrite:ChatGPT:ChatGPT has X users}}.

Last updated: {{ai_updated:Artificial_intelligence}}
`;

const fresh = await ai.process(blogPost);

Dynamic Documentation

const docs = `
## About Python

{{ai_fact:Python_(programming_language)}}

**Latest version info:** {{ai_rewrite:Python_(programming_language):Python X is the latest}}

[Learn more]({{ai_link:Python_(programming_language)}})
`;

Q&A Sections

const faq = `
**Q: How far is the Moon?**
A: {{ai_answer:Moon:How far is it from Earth?}}

**Q: What is the Sun made of?**
A: {{ai_answer:Sun:What is it made of?}}
`;

Browser Usage

<script type="module">
  import DocuFreshAI from 'https://esm.sh/docufresh-ai';

  const ai = new DocuFreshAI({
    onProgress: (p) => {
      if (p.status === 'progress') {
        console.log(`Loading: ${Math.round(p.loaded/p.total*100)}%`);
      }
    }
  });

  document.getElementById('content').innerHTML = await ai.process(
    document.getElementById('content').innerHTML
  );
</script>

Available Models

| Model | Size | Quality | Speed | |-------|------|---------|-------| | Xenova/flan-t5-small | ~250MB | Good | Fast | | Xenova/flan-t5-base | ~900MB | Better | Slower | | Xenova/flan-t5-large | ~3GB | Best | Slowest |

const ai = new DocuFreshAI({ model: 'Xenova/flan-t5-base' });

Caching

  • Wikipedia responses are cached for 1 hour by default
  • AI model is cached after first download (browser localStorage / Node.js cache)
  • Customize cache TTL:
const ai = new DocuFreshAI({
  cacheTTL: 1000 * 60 * 30  // 30 minutes
});

// Clear cache manually
ai.clearCache();

TypeScript

Full TypeScript support included:

import DocuFreshAI, { WikipediaSummary } from 'docufresh-ai';

const ai = new DocuFreshAI();
const summary: WikipediaSummary = await ai.getSummary('TypeScript');

Requirements

  • Node.js 18+ (for native fetch)
  • Modern browser (Chrome 89+, Firefox 89+, Safari 15+)
  • ~250MB disk space for default AI model

Related

License

MIT License - see LICENSE file for details.