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

contexto-generator

v0.0.1

Published

Genera un archivo contexto_repo.txt con la estructura y contenido del proyecto.

Readme

Context Generator

Context Generator is a CLI tool designed to create a comprehensive context file for your project. The generated file contains both the directory structure and the contents of your project’s files. This is especially useful for providing context to AI tools like CodeGPT or GitHub Copilot, or for generating detailed project documentation.

Features

  • Directory Tree Structure:
    Generates a tree view of your project's directory, excluding files and directories specified in the configuration.

  • File Contents:
    Concatenates the content of each file in your project. Each file is preceded by a header displaying its relative path (prefixed with ./).

  • Custom Configuration:
    Customize the tool’s behavior with a configuration file (context-generator.config.json). This file allows you to define:

    • ignoreDirs: An array of directory patterns to ignore.
    • ignoreFiles: An array of file patterns to ignore (the pattern *.context-generator.txt is automatically added so that generated files are excluded).
    • outDir: The output directory for the generated context file.
      • If set to the project root ("./"), the tool automatically appends the suffix .context-generator.txt to the output file name.
      • If set to a custom folder (e.g., "./context"), the tool creates that folder (if it doesn't exist) and saves the generated file there. The specified directory is then ignored in subsequent runs.
  • Automatic Suffix Addition:
    When generating the context file in the project root, the tool automatically appends .context-generator.txt to the output file name, which helps differentiate generated files and simplifies excluding them via .gitignore.

  • Prevents Recursive Inclusion:
    Files matching the pattern *.context-generator.txt (i.e., files generated in previous runs) are always ignored, preventing the context file from growing exponentially.

Installation

Install Context Generator as a development dependency in your project:

npm install --save-dev context-generator

Add a Script in package.json

To simplify execution, add a script to your project's package.json:

"scripts": {
  "generate-context": "generate-context"
}

Then, you can execute:

npm run generate-context

Commands and Options

Display Help

To see all available commands and options, run:

generate-context --help

This displays a help message summarizing the usage, available commands, and options.

Initialize Configuration (init)

To create a configuration template (context-generator.config.json) in your project’s root, run:

npm run generate-context init

This command generates a configuration file with the following structure:

{
  "ignoreDirs": [".git", "node_modules", ".vscode", "dist"],
  "ignoreFiles": ["package-lock.json", ".env", ".gitignore"],
  "outDir": "./"
}

Explanation of context-generator.config.json:

  • ignoreDirs:
    Specifies directories to be ignored during context generation.
    Example:

    • ".git" ignores the Git folder.
    • "node_modules" ignores dependency directories.
    • ".vscode" and "dist" are optional but often ignored.
  • ignoreFiles:
    Specifies file names or patterns to ignore.
    Example:

    • "package-lock.json" and ".env" are typically excluded.
      Note: The tool automatically adds the pattern *.context-generator.txt to ignore previously generated files.
  • outDir:
    Specifies the output directory for the generated context file.

    • If set to "./", the file is generated in the root, and the tool appends .context-generator.txt to its name.
    • If set to a folder (e.g., "./context"), the tool creates the folder (if it doesn’t exist) and places the generated file there. The folder is automatically ignored to prevent recursion.

Generate the Context File

To generate the context file using the current configuration:

npm run generate-context

This scans the project, creates a directory tree, and includes the content of each file, excluding ignored items.

Using the -n Flag to Specify a Custom Output File Name

By default, the generated file is named project.context-generator.txt. You can specify a custom file name using the -n or --name flag:

npm run generate-context --name my_context

This option allows you to create multiple versions of the context file with different names.

Command Summary

  1. Help:
npm run generate-context --help
  1. Initialize Configuration:
npm run generate-context init
  1. Generate Context File (Default):
npm run generate-context
  1. Generate Context with a Custom File Name:
npm run generate-context --name my_context

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please open issues or submit pull requests on the GitHub repository.


Happy coding!