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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ai-kb

v1.2.2

Published

AI-friendly Knowledge Base Generator

Downloads

213

Readme

AI-KB: AI-friendly Knowledge Base Generator

AI-KB is a command-line tool that generates AI-friendly knowledge bases from your codebase. It scans your project files based on specified patterns and creates markdown files that can be easily consumed by AI models like Claude for context-aware code understanding and assistance.

Features

  • Configurable file inclusion and exclusion patterns
  • Global ignore patterns for common non-code directories and files
  • Explicit include patterns to override global ignores
  • Whitespace optimization to reduce file size while preserving context
  • Special handling for whitespace-sensitive languages (e.g., Python)
  • Environment-based debug logging

Installation

You don't need to install AI-KB permanently. You can run it directly using npx:

npx ai-kb@latest

This command will download and execute the latest version of AI-KB.

Usage

  1. Create a .ai-kb-config file in your project root with the following format:
[section-name]
src/**/*.js
**/*.tsx
+node_modules/specific-package/**/*.js  # Explicitly include specific ignored paths

- src/**/some.js

[another-section]
src/**/*.js
**/*.tsx

- src/**/some.js

Each section can contain:

  • Include patterns (normal glob patterns)
  • Explicit include patterns (prefixed with +) to override global ignores
  • Exclude patterns (prefixed with -)
  1. Run the tool:
   npx ai-kb@latest

Pattern Priority

Patterns are processed in the following order:

Explicit includes (+ prefix) override global ignores for specific paths Normal includes match files while respecting global ignores Excludes (- prefix) remove files from the final set

For example, to include a specific package from node_modules while keeping the general node_modules ignore:

[section]
+node_modules/important-package/**/*.js  # This package will be included
**/*.js                                 # Other .js files (excluding node_modules)

Debug Mode

To run the application in debug mode and see additional logging information, use the -v flag when starting the application:

   npx ai-kb -v

This will provide detailed logging information about the file matching process, which can be helpful for troubleshooting or understanding how the tool processes your codebase.

Output

The tool generates markdown files named ai-kb-<section-name>.md for each section defined in your config file. These files contain the content of the matched source files, optimized for AI consumption.

Customization

The tool uses sensible defaults, but you can customize its behavior:

  • Global ignore patterns
  • Whitespace-sensitive file extensions
  • Whitespace removal rules

For advanced customization, you can fork the repository and modify the source code.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request to the GitHub repository.

License

This project is licensed under the MIT License.

Support

If you encounter any issues or have questions, please file an issue on the GitHub repository.

Privacy Note

This tool processes your source code locally. No code is sent to external servers. However, the generated markdown files may contain sensitive information from your codebase. Handle these files with appropriate care.