remd is a CLI tool designed for AI web-based development that allows you to quickly compile your entire project into a single Markdown file. This unified file is perfect for providing complete project context when working with AI tools. 🧠📄
- 🔍 Recursive Compilation: Gathers all project files (excluding those specified in your
.gitignoreand additional ignore rules) into one Markdown document. - 🎨 Syntax Highlighting: Automatically infers and applies code fence languages based on file extensions.
- 🔢 Token Counting: Uses tiktoken to count the number of tokens in the generated Markdown, useful for context size estimation.
- 💻 Easy CLI Usage: Run the tool from your terminal with a simple command.
- 🛠️ Ignore Configuration: Easily create and manage a
.remdignorefile with a dedicated subcommand (init) to add custom or default ignore patterns.
Ensure you have Node.js version >= 20.8.0 installed.
You can install remd globally via npm:
npm install -g @brngdsn/remdOr run it directly with npx:
npx @brngdsn/remd [outputFileName]Run the following command from your project directory:
remd [outputFileName]- outputFileName (optional): The name of the Markdown file to generate. Defaults to
APP.mdif not provided.
For example, to generate a file named project-context.md:
remd project-context.md🔧 What It Does:
- 📜 Reads Ignore Patterns: The tool checks your
.gitignore(if present) and applies additional ignore rules from.remdignore(if available). - 📂 Collects Files: It recursively scans your project for all files (while respecting ignore rules).
- 📝 Generates Markdown: Each file's content is wrapped in a code fence with the correct language identifier (determined by the file extension) and prefixed with a comment indicating the file path.
- 🔢 Counts Tokens: After assembling the Markdown content, it counts the tokens using tiktoken.
- 💾 Writes Output: The final Markdown file is saved to your current directory.
The init subcommand allows you to create a .remdignore file in your project directory to specify additional ignore rules. This is particularly useful for excluding files that you don't want to include in the generated Markdown.
📌 Usage:
-
Create an empty
.remdignorefile:remd init
-
Create a
.remdignorefile with default ignore patterns:remd init -d
📜 Default Ignore Patterns (with -d or --default flag):
*.png
*.svg
*.ico
.git/
*-lock.*
LICENSE
*.otf
*.pdf
mail_body
chromedriver
.next/
.vercel/A snippet of the generated Markdown might look like:
// src/index.js
import path from 'node:path';
import { promises as fs } from 'node:fs';
import chalk from 'chalk';
// ...Each section in the Markdown file corresponds to a file from your project, making it easy to navigate and review your entire codebase in one document. 📖
Contributions are welcome! 🎉 If you'd like to contribute, please fork the repository and submit a pull request. For any issues, please open an issue on GitHub.
This project is licensed under the MIT License. See the LICENSE file for details.
- 🎨 Built with Chalk for colorful terminal output.
- ⚡ Utilizes fast-glob for efficient file searching.
- 🔢 Powered by tiktoken for token counting.
- 🛠️ CLI commands managed with Commander.
🎉 Happy coding! 🚀