Skip to content

Sebasxs/codemap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

codemap

A Node.js script that converts entire codebases into a single Markdown file, optimized for LLM context.


Unlock the Power of LLMs

Have you ever tried to ask a question about a large project to a LLM? It can be a frustrating experience. You can't just paste the entire codebase, and explaining the architecture takes time.

This script solves that problem by creating a single, comprehensive Markdown file that you can easily share with an LLM. This provides the model with the necessary context to understand your project's structure, dependencies, and code, leading to more relevant and accurate answers.

Features

  • Recursive Traversal: Automatically walks through the directory structure.
  • Content Aggregation: Reads and appends the content of each file.
  • Ignore Patterns: Skips specified directories and files (configured in ignore.json).
  • Customizable Output: Specify an output file or let the script create one in your Downloads folder.
  • Clear Formatting: Each file's content is clearly marked with its path and enclosed in a code block.

Installation

  1. Clone the repository:
    git clone https://github.com/sebasxs/codemap.git
  2. Navigate to the project directory:
    cd codemap
  3. Install the package globally:
    npm install -g .
    This will make the codemap command available in your system.

Usage

Once installed, you can run the codemap command from your terminal.

codemap <inputPath> [outputPath] [--exclude "file1,dir2,..."] [--include "file1,dir2,..."]
  • <inputPath>: (Required) The path to the directory you want to export.
  • [outputPath]: (Optional) The path where the final Markdown file will be saved. If not provided, it defaults to your Downloads folder.
  • [--exclude "file1,dir2,..."]: (Optional) A comma-separated list of files and directories to ignore in the current run.
  • [--include "file1,dir2,..."]: (Optional) A comma-separated list of files and directories to include in the current run.

Example

# Export the 'my-project' directory to a markdown file
codemap ./my-project --exclude "tests,package-lock.json,logs" --include "schemas.sql"

Now you can open the my-project.md file and paste its content into your LLM of choice.

License

This project is licensed under the ISC License.

About

Convert entire codebases into a single Markdown file, optimized for LLM context.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors