diff --git a/.yarnrc b/.yarnrc new file mode 100644 index 000000000..85b738b8d --- /dev/null +++ b/.yarnrc @@ -0,0 +1,5 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +yarn-path ".yarn/releases/yarn-1.22.22.cjs" diff --git a/README.md b/README.md index 59efb8f5f..726151dfe 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,39 @@ # 📦 Repopack -[![Actions Status](https://github.com/yamadashy/repopack/actions/workflows/ci.yml/badge.svg)](https://github.com/yamadashy/repopack/actions?query=workflow%3A"ci") -[![npm](https://img.shields.io/npm/v/repopack.svg?maxAge=1000)](https://www.npmjs.com/package/repopack) -[![npm](https://img.shields.io/npm/d18m/repopack)](https://www.npmjs.com/package/repopack) -[![npm](https://img.shields.io/npm/l/repopack.svg?maxAge=1000)](https://github.com/yamadashy/repopack/blob/master/LICENSE.md) -[![node](https://img.shields.io/node/v/repopack.svg?maxAge=1000)](https://www.npmjs.com/package/repopack) - -Repopack is a powerful tool that packs your entire repository into a single, AI-friendly file. -It is perfect for when you need to feed your codebase to Large Language Models (LLMs) or other AI tools like Claude, ChatGPT, and Gemini. - - +![Actions Status](https://img.shields.io/badge/actions-🚀-success) ![npm](https://img.shields.io/badge/npm-📦-blue) ![node](https://img.shields.io/badge/node-🌳-green) + +**Repopack** is a powerful tool that packs your entire repository into a single, AI-friendly file. It's perfect for when you need to feed your codebase to Large Language Models (LLMs) or other AI tools like Claude, ChatGPT, and Gemini. + +## 📋 Table of Contents +- [🌟 Features](#features) +- [🚀 Quick Start](#quick-start) +- [📊 Usage](#usage) +- [💡 Prompt Examples](#prompt-examples) +- [📄 Output File Format](#output-file-format) +- [⚙️ Command Line Options](#command-line-options) +- [🔄 Updating Repopack](#updating-repopack) +- [🛠️ Configuration](#configuration) +- [📂 Include and Ignore](#include-and-ignore) +- [📄 Custom Instruction](#custom-instruction) +- [🚫 Comment Removal](#comment-removal) +- [🔍 Security Check](#security-check) +- [🤝 Contribution](#contribution) +- [📜 License](#license) ## 🌟 Features - - **AI-Optimized**: Formats your codebase in a way that's easy for AI to understand and process. - **Token Counting**: Provides token counts for each file and the entire repository, useful for LLM context limits. -- **Simple to Use**: You need just one command to pack your entire repository. +- **Simple to Use**: One command packs your entire repository. - **Customizable**: Easily configure what to include or exclude. -- **Git-Aware**: Automatically respects your .gitignore files. -- **Security-Focused**: Incorporates [Secretlint](https://github.com/secretlint/secretlint) for robust security checks to detect and prevent inclusion of sensitive information. - - +- **Git-Aware**: Automatically respects your `.gitignore` files. +- **Security-Focused**: Incorporates Secretlint for robust security checks to detect and prevent the inclusion of sensitive information. ## 🚀 Quick Start - You can try Repopack instantly in your project directory without installation: ```bash npx repopack -``` - -Or install globally for repeated use: -```bash # Install using npm npm install -g repopack @@ -41,457 +42,3 @@ yarn global add repopack # Alternatively using Homebrew (macOS) brew install repopack - -# Then run in any project directory -repopack -``` - -That's it! Repopack will generate a `repopack-output.txt` file in your current directory, containing your entire repository in an AI-friendly format. - - - -## 📊 Usage - -To pack your entire repository: - -```bash -repopack -``` - -To pack a specific directory: - -```bash -repopack path/to/directory -``` - -To pack specific files or directories using [glob patterns](https://github.com/mrmlnc/fast-glob?tab=readme-ov-file#pattern-syntax): - -```bash -repopack --include "src/**/*.ts,**/*.md" -``` - -To exclude specific files or directories: - -```bash -repopack --ignore "**/*.log,tmp/" -``` - -To pack a remote repository: -```bash -repopack --remote https://github.com/yamadashy/repopack - -# You can also use GitHub shorthand: -repopack --remote yamadashy/repopack -``` - -To initialize a new configuration file (`repopack.config.json`): - -```bash -repopack --init -``` - -Once you have generated the packed file, you can use it with Generative AI tools like Claude, ChatGPT, and Gemini. - -### Prompt Examples -Once you have generated the packed file with Repopack, you can use it with AI tools like Claude, ChatGPT, and Gemini. Here are some example prompts to get you started: - -#### Code Review and Refactoring -For a comprehensive code review and refactoring suggestions: - -``` -This file contains my entire codebase. Please review the overall structure and suggest any improvements or refactoring opportunities, focusing on maintainability and scalability. -``` - -#### Documentation Generation -To generate project documentation: - -``` -Based on the codebase in this file, please generate a detailed README.md that includes an overview of the project, its main features, setup instructions, and usage examples. -``` - -#### Test Case Generation -For generating test cases: - -``` -Analyze the code in this file and suggest a comprehensive set of unit tests for the main functions and classes. Include edge cases and potential error scenarios. -``` - -#### Code Quality Assessment -Evaluate code quality and adherence to best practices: - -``` -Review the codebase for adherence to coding best practices and industry standards. Identify areas where the code could be improved in terms of readability, maintainability, and efficiency. Suggest specific changes to align the code with best practices. -``` - -#### Library Overview -Get a high-level understanding of the library - -``` -This file contains the entire codebase of library. Please provide a comprehensive overview of the library, including its main purpose, key features, and overall architecture. -``` - -Feel free to modify these prompts based on your specific needs and the capabilities of the AI tool you're using. - -### Output File Format - -Repopack generates a single file with clear separators between different parts of your codebase. -To enhance AI comprehension, the output file begins with an AI-oriented explanation, making it easier for AI models to understand the context and structure of the packed repository. - -#### Plain Text Format (default) - -```text -This file is a merged representation of the entire codebase, combining all repository files into a single document. - -================================================================ -File Summary -================================================================ -(Metadata and usage AI instructions) - -================================================================ -Repository Structure -================================================================ -src/ - cli/ - cliOutput.ts - index.ts - config/ - configLoader.ts - -(...remaining directories) - -================================================================ -Repository Files -================================================================ - -================ -File: src/index.js -================ -// File contents here - -================ -File: src/utils.js -================ -// File contents here - -(...remaining files) - -================================================================ -Instruction -================================================================ -(Custom instructions from `output.instructionFilePath`) -``` - -#### XML Format - -To generate output in XML format, use the `--style xml` option: -```bash -repopack --style xml -``` - -The XML format structures the content in a hierarchical manner: - -```xml -This file is a merged representation of the entire codebase, combining all repository files into a single document. - - -(Metadata and usage AI instructions) - - - -src/ - cli/ - cliOutput.ts - index.ts - -(...remaining directories) - - - - -// File contents here - - -(...remaining files) - - - -(Custom instructions from `output.instructionFilePath`) - -``` - -For those interested in the potential of XML tags in AI contexts: -https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/use-xml-tags - -> When your prompts involve multiple components like context, instructions, and examples, XML tags can be a game-changer. They help Claude parse your prompts more accurately, leading to higher-quality outputs. - -This means that the XML output from Repopack is not just a different format, but potentially a more effective way to feed your codebase into AI systems for analysis, code review, or other tasks. - -#### Markdown Format - -To generate output in Markdown format, use the `--style markdown` option: -```bash -repopack --style markdown -``` - -The Markdown format structures the content in a hierarchical manner: - -````markdown -This file is a merged representation of the entire codebase, combining all repository files into a single document. - -# File Summary -(Metadata and usage AI instructions) - -# Repository Structure -``` -src/ - cli/ - cliOutput.ts - index.ts -``` -(...remaining directories) - -# Repository Files - -## File: src/index.js -``` -// File contents here -``` - -(...remaining files) - -# Instruction -(Custom instructions from `output.instructionFilePath`) -```` - -This format provides a clean, readable structure that is both human-friendly and easily parseable by AI systems. - -### Command Line Options - -- `-v, --version`: Show tool version -- `-o, --output `: Specify the output file name -- `--include `: List of include patterns (comma-separated) -- `-i, --ignore `: Additional ignore patterns (comma-separated) -- `-c, --config `: Path to a custom config file -- `--style