{"id":31285530,"url":"https://github.com/AndersonBY/python-repomix","last_synced_at":"2025-09-24T08:03:38.487Z","repository":{"id":269717780,"uuid":"908249697","full_name":"AndersonBY/python-repomix","owner":"AndersonBY","description":"📦 python-repomix is a powerful tool that packs your entire repository into a single, AI-friendly file. Perfect for when you need to feed your codebase to Large Language Models (LLMs) or other AI tools like Claude, ChatGPT, and Gemini.","archived":false,"fork":false,"pushed_at":"2025-09-01T06:22:03.000Z","size":298,"stargazers_count":94,"open_issues_count":0,"forks_count":12,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-01T08:51:00.970Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AndersonBY.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-25T15:18:59.000Z","updated_at":"2025-09-01T06:22:05.000Z","dependencies_parsed_at":"2024-12-25T15:30:26.647Z","dependency_job_id":"874d7cc1-4764-4fde-925f-942bb74ea067","html_url":"https://github.com/AndersonBY/python-repomix","commit_stats":null,"previous_names":["andersonby/python-repomix"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/AndersonBY/python-repomix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndersonBY%2Fpython-repomix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndersonBY%2Fpython-repomix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndersonBY%2Fpython-repomix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndersonBY%2Fpython-repomix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndersonBY","download_url":"https://codeload.github.com/AndersonBY/python-repomix/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndersonBY%2Fpython-repomix/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276714445,"owners_count":25691396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-24T02:00:09.776Z","response_time":97,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-24T08:01:40.730Z","updated_at":"2025-09-24T08:03:38.457Z","avatar_url":"https://github.com/AndersonBY.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# 📦 Repomix (Python Version)\n\nEnglish | [简体中文](README_zh.md)\n\n## 🎯 1. Introduction\n\nRepomix 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.\n\nThe original [Repomix](https://github.com/yamadashy/repomix) is written in JavaScript, and this is the ported Python version.\n\n## ⭐ 2. Features\n\n-   **AI-Optimized**: Formats your codebase in a way that's easy for AI to understand and process.\n-   **Token Counting**: Provides token counts for each file and the entire repository using tiktoken.\n-   **Simple to Use**: Pack your entire repository with just one command.\n-   **Customizable**: Easily configure what to include or exclude.\n-   **Git-Aware**: Automatically respects your .gitignore files.\n-   **Security-Focused**: Built-in security checks to detect and prevent the inclusion of sensitive information (powered by `detect-secrets`).\n-   **Code Compression**: Advanced code compression with multiple modes to reduce output size while preserving essential information.\n-   ⚡ **Performance**: Utilizes multiprocessing or threading for faster analysis on multi-core systems.\n-   ⚙️ **Encoding Aware**: Automatically detects and handles various file encodings (using `chardet`) beyond UTF-8, increasing robustness.\n\n## 🚀 3. Quick Start\n\nYou can install Repomix using pip:\n\n```bash\npip install repomix\n```\n\nThen run in any project directory (using the installed script is preferred):\n\n```bash\nrepomix\n```\n\nAlternatively, you can use:\n\n```bash\npython -m repomix\n```\n\n### Docker Usage\n\nYou can also use Repomix with Docker without installing it locally:\n\n```bash\n# Build the Docker image\ndocker build -t repomix .\n\n# Run repomix on the current directory\ndocker run --rm -v \"$(pwd)\":/app repomix\n\n# Run repomix with specific options\ndocker run --rm -v \"$(pwd)\":/app repomix --style markdown --output custom-output.md\n\n# Run repomix on a different directory\ndocker run --rm -v \"/path/to/your/project\":/app repomix\n```\n\n**Docker Benefits:**\n- **Isolated Environment**: Run repomix without installing Python dependencies on your host system\n- **Consistent Results**: Ensures the same environment across different machines\n- **Easy Distribution**: Share the exact repomix version and configuration with your team\n- **No Installation Required**: Use repomix immediately without pip install\n\nThat's it! Repomix will generate a `repomix-output.md` file (by default) in your current directory, containing your entire repository in an AI-friendly format.\n\n## 📖 4. Usage\n\n### 4.1 Command Line Usage\n\nTo pack your entire repository:\n\n```bash\nrepomix\n```\n\nTo pack a specific directory:\n\n```bash\nrepomix path/to/directory\n```\n\nTo pack a remote repository:\n\n```bash\nrepomix --remote https://github.com/username/repo\n```\n\nTo pack a specific branch of a remote repository:\n\n```bash\nrepomix --remote https://github.com/username/repo --branch feature-branch\n```\n\nTo initialize a new configuration file:\n\n```bash\nrepomix --init\n# Use --global to create a global configuration file (see Configuration Options below)\nrepomix --init --global\n```\n\n### 4.2 Configuration Options\n\nCreate a `repomix.config.json` file in your project root for custom configurations. Repomix also automatically loads a global configuration file if it exists (e.g., `~/.config/repomix/repomix.config.json` on Linux), merging it with lower priority than local config and CLI options.\n\n```json\n{\n  \"output\": {\n    \"file_path\": \"repomix-output.md\",\n    \"style\": \"markdown\",\n    \"header_text\": \"\",\n    \"instruction_file_path\": \"\",\n    \"remove_comments\": false,\n    \"remove_empty_lines\": false,\n    \"top_files_length\": 5,\n    \"show_line_numbers\": false,\n    \"copy_to_clipboard\": false,\n    \"include_empty_directories\": false,\n    \"calculate_tokens\": false,\n    \"show_file_stats\": false,\n    \"show_directory_structure\": true\n  },\n  \"security\": {\n    \"enable_security_check\": true,\n    \"exclude_suspicious_files\": true\n  },\n  \"ignore\": {\n    \"custom_patterns\": [],\n    \"use_gitignore\": true,\n    \"use_default_ignore\": true\n  },\n  \"compression\": {\n    \"enabled\": false,\n    \"keep_signatures\": true,\n    \"keep_docstrings\": true,\n    \"keep_interfaces\": true\n  },\n  \"remote\": {\n    \"url\": \"\",\n    \"branch\": \"\"\n  },\n  \"include\": []\n}\n```\n\n\u003e [!NOTE]\n\u003e *Note on `remove_comments`*: This feature is language-aware, correctly handling comment syntax for various languages like Python, JavaScript, C++, HTML, etc., rather than using a simple generic pattern.*\n\n#### Remote Repository Configuration\n\nThe `remote` section allows you to configure remote repository processing:\n\n- `url`: The URL of the remote Git repository to process\n- `branch`: The specific branch, tag, or commit hash to process (optional, defaults to repository's default branch)\n\nWhen a remote URL is specified in the configuration, Repomix will process the remote repository instead of the local directory. This can be overridden by CLI parameters.\n\n**Command Line Options**\n\n-   `repomix [directory]`: Target directory (defaults to current directory).\n-   `-v, --version`: Show version.\n-   `-o, --output \u003cfile\u003e`: Specify output file name.\n-   `--style \u003cstyle\u003e`: Specify output style (plain, xml, markdown).\n-   `--remote \u003curl\u003e`: Process a remote Git repository.\n-   `--branch \u003cname\u003e`: Specify branch for remote repository.\n-   `--init`: Initialize configuration file (`repomix.config.json`) in the current directory.\n-   `--global`: Use with `--init` to create/manage the global configuration file (located in a platform-specific user config directory, e.g., `~/.config/repomix` on Linux). The global config is automatically loaded if present.\n-   `--no-security-check`: Disable security check.\n-   `--include \u003cpatterns\u003e`: Comma-separated list of include patterns (glob format).\n-   `-i, --ignore \u003cpatterns\u003e`: Additional comma-separated ignore patterns.\n-   `-c, --config \u003cpath\u003e`: Path to a custom configuration file.\n-   `--copy`: Copy generated output to system clipboard.\n-   `--top-files-len \u003cnumber\u003e`: Max number of largest files to display in summary.\n-   `--output-show-line-numbers`: Add line numbers to output code blocks.\n-   `--stdin`: Read file paths from standard input (one per line) instead of discovering files automatically.\n-   `--verbose`: Enable verbose logging for debugging.\n-   `--parsable-style`: By escaping and formatting, ensure the output is parsable as a document of its type.\n-   `--stdout`: Output to stdout instead of writing to a file.\n-   `--remove-comments`: Remove comments from source code.\n-   `--remove-empty-lines`: Remove empty lines from source code.\n-   `--truncate-base64`: Enable truncation of base64 data strings.\n-   `--include-empty-directories`: Include empty directories in the output.\n-   `--include-diffs`: Include git diffs in the output.\n\n### 4.3 Security Check\n\nRepomix includes built-in security checks using the [detect-secrets](https://github.com/Yelp/detect-secrets) library to detect potentially sensitive information (API keys, credentials, etc.). By default (`exclude_suspicious_files: true`), detected files are excluded from the output.\n\nDisable checks via configuration or CLI:\n\n```bash\nrepomix --no-security-check\n```\n\n### 4.4 Code Compression\n\nRepomix provides advanced code compression capabilities to reduce output size while preserving essential information. This feature is particularly useful when working with large codebases or when you need to focus on specific aspects of your code.\n\n#### 4.4.1 Compression Modes\n\n**Interface Mode** (`keep_interfaces: true`)\n- Preserves function and class signatures with their complete type annotations\n- Keeps all docstrings for comprehensive API documentation\n- Removes implementation details, replacing them with `pass` statements\n- Perfect for generating API documentation or understanding code structure\n\n**Signature Mode** (`keep_signatures: true`, `keep_interfaces: false`)\n- Preserves function and class definitions\n- Optionally keeps docstrings based on `keep_docstrings` setting\n- Maintains full implementation code\n- Useful for standard code compression while keeping functionality\n\n**Minimal Mode** (`keep_signatures: false`)\n- Removes all function and class definitions\n- Keeps only global variables, imports, and module-level code\n- Maximum compression for focusing on configuration and constants\n\n#### 4.4.2 Configuration Options\n\n```json\n{\n  \"compression\": {\n    \"enabled\": false,           // Enable/disable compression\n    \"keep_signatures\": true,    // Keep function/class signatures\n    \"keep_docstrings\": true,    // Keep docstrings\n    \"keep_interfaces\": true     // Interface mode (signatures + docstrings only)\n  }\n}\n```\n\n#### 4.4.3 Usage Examples\n\n**Generate API Documentation:**\n```bash\n# Create interface-only output for API documentation\nrepomix --config-override '{\"compression\": {\"enabled\": true, \"keep_interfaces\": true}}'\n```\n\n**Compress Implementation Details:**\n```bash\n# Keep signatures but remove implementation for code overview\nrepomix --config-override '{\"compression\": {\"enabled\": true, \"keep_interfaces\": false, \"keep_signatures\": true, \"keep_docstrings\": false}}'\n```\n\n**Extract Configuration Only:**\n```bash\n# Keep only global variables and constants\nrepomix --config-override '{\"compression\": {\"enabled\": true, \"keep_signatures\": false}}'\n```\n\n#### 4.4.4 Language Support\n\nCurrently, advanced compression features are fully supported for:\n- **Python**: Complete AST-based compression with all modes\n- **Other Languages**: Basic compression with warnings (future enhancement planned)\n\n#### 4.4.5 Example Output\n\n**Original Python Code:**\n```python\ndef calculate_sum(a: int, b: int) -\u003e int:\n    \"\"\"\n    Calculate the sum of two integers.\n    \n    Args:\n        a: First integer\n        b: Second integer\n        \n    Returns:\n        The sum of a and b\n    \"\"\"\n    if not isinstance(a, int) or not isinstance(b, int):\n        raise TypeError(\"Both arguments must be integers\")\n    \n    result = a + b\n    print(f\"Calculating {a} + {b} = {result}\")\n    return result\n```\n\n**Interface Mode Output:**\n```python\ndef calculate_sum(a: int, b: int) -\u003e int:\n    \"\"\"\n    Calculate the sum of two integers.\n    \n    Args:\n        a: First integer\n        b: Second integer\n        \n    Returns:\n        The sum of a and b\n    \"\"\"\n    pass\n```\n\n### 4.5 Ignore Patterns\n\nRepomix provides multiple methods to set ignore patterns for excluding specific files or directories during the packing process:\n\n#### Priority Order\n\nIgnore patterns are applied in the following priority order (from highest to lowest):\n\n1. Custom patterns in configuration file (`ignore.custom_patterns`)\n2. `.repomixignore` file\n3. `.gitignore` file (if `ignore.use_gitignore` is true)\n4. Default patterns (if `ignore.use_default_ignore` is true)\n\n#### Ignore Methods\n\n##### .gitignore\nBy default, Repomix uses patterns listed in your project's `.gitignore` file. This behavior can be controlled with the `ignore.use_gitignore` option in the configuration file:\n\n```json\n{\n  \"ignore\": {\n    \"use_gitignore\": true\n  }\n}\n```\n\n##### Default Patterns\nRepomix includes a default list of commonly excluded files and directories (e.g., `__pycache__`, `.git`, binary files). This feature can be controlled with the `ignore.use_default_ignore` option:\n\n```json\n{\n  \"ignore\": {\n    \"use_default_ignore\": true\n  }\n}\n```\n\nThe complete list of default ignore patterns can be found in [default_ignore.py](src/repomix/config/default_ignore.py).\n\n##### .repomixignore\nYou can create a `.repomixignore` file in your project root to define Repomix-specific ignore patterns. This file follows the same format as `.gitignore`.\n\n##### Custom Patterns\nAdditional ignore patterns can be specified using the `ignore.custom_patterns` option in the configuration file:\n\n```json\n{\n  \"ignore\": {\n    \"custom_patterns\": [\n      \"*.log\",\n      \"*.tmp\",\n      \"tests/**/*.pyc\"\n    ]\n  }\n}\n```\n\n#### Notes\n\n- Binary files are not included in the packed output by default, but their paths are listed in the \"Repository Structure\" section of the output file. This provides a complete overview of the repository structure while keeping the packed file efficient and text-based.\n- Ignore patterns help optimize the size of the generated pack file by ensuring the exclusion of security-sensitive files and large binary files, while preventing the leakage of confidential information.\n- All ignore patterns use glob pattern syntax similar to `.gitignore`.\n\n## 🔒 5. Output File Format\n\nRepomix 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.\n\n### 5.1 Plain Text Format (default)\n\n```text\nThis file is a merged representation of the entire codebase, combining all repository files into a single document.\n\n================================================================\nFile Summary\n================================================================\n(Metadata and usage AI instructions)\n\n================================================================\nRepository Structure\n================================================================\nsrc/\n  cli/\n    cliOutput.py\n    index.py\n  config/\n    configLoader.py\n\n(...remaining directories)\n\n================================================================\nRepository Files\n================================================================\n\n================\nFile: src/index.py\n================\n# File contents here\n\n================\nFile: src/utils.py\n================\n# File contents here\n\n(...remaining files)\n\n================================================================\nStatistics\n================================================================\n(File statistics and metadata)\n```\n\n### 5.2 Markdown Format\n\nTo generate output in Markdown format, use the `--style markdown` option:\n\n```bash\npython -m repomix --style markdown\n```\n\nThe Markdown format structures the content in a readable manner:\n\n`````markdown\n# File Summary\n(Metadata and usage AI instructions)\n\n# Repository Structure\n```\nsrc/\n  cli/\n    cliOutput.py\n    index.py\n```\n\n# Repository Files\n\n## File: src/index.py\n```python\n# File contents here\n```\n\n## File: src/utils.py\n```python\n# File contents here\n```\n\n# Statistics\n- Total Files: 19\n- Total Characters: 37377\n- Total Tokens: 11195\n`````\n\n### 5.3 XML Format\n\nTo generate output in XML format, use the `--style xml` option:\n\n```bash\npython -m repomix --style xml\n```\n\nThe XML format structures the content in a hierarchical manner:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003crepository\u003e\n\u003crepository_structure\u003e\n(Directory and file structure)\n\u003c/repository_structure\u003e\n\n\u003crepository_files\u003e\n\u003cfile\u003e\n  \u003cpath\u003esrc/index.py\u003c/path\u003e\n  \u003cstats\u003e\n    \u003cchars\u003e1234\u003c/chars\u003e\n    \u003ctokens\u003e567\u003c/tokens\u003e\n  \u003c/stats\u003e\n  \u003ccontent\u003e\n    # File contents here\n  \u003c/content\u003e\n\u003c/file\u003e\n(...remaining files)\n\u003c/repository_files\u003e\n\n\u003cstatistics\u003e\n  \u003ctotal_files\u003e19\u003c/total_files\u003e\n  \u003ctotal_chars\u003e37377\u003c/total_chars\u003e\n  \u003ctotal_tokens\u003e11195\u003c/total_tokens\u003e\n\u003c/statistics\u003e\n\u003c/repository\u003e\n```\n\n## 🛠️ 6. Advanced Usage\n\n### 6.1 Library Usage\n\nYou can use Repomix as a Python library in your projects. Here's a basic example:\n\n```python\nfrom repomix import RepoProcessor\n\n# Basic usage\nprocessor = RepoProcessor(\".\")\nresult = processor.process()\n\n# Process remote repository with specific branch\nprocessor = RepoProcessor(repo_url=\"https://github.com/username/repo\", branch=\"feature-branch\")\nresult = processor.process()\n\n# Access processing results\nprint(f\"Total files: {result.total_files}\")\nprint(f\"Total characters: {result.total_chars}\")\nprint(f\"Total tokens: {result.total_tokens}\")\nprint(f\"Output saved to: {result.config.output.file_path}\")\n```\n\n### 6.2 Advanced Configuration\n\n```python\nfrom repomix import RepoProcessor, RepomixConfig\n\n# Create custom configuration\nconfig = RepomixConfig()\n\n# Output settings\nconfig.output.file_path = \"custom-output.md\"\nconfig.output.style = \"markdown\"  # supports \"plain\", \"markdown\", and \"xml\"\nconfig.output.show_line_numbers = True\n\n# Security settings\nconfig.security.enable_security_check = True\nconfig.security.exclude_suspicious_files = True\n\n# Compression settings\nconfig.compression.enabled = True\nconfig.compression.keep_signatures = True\nconfig.compression.keep_docstrings = True\nconfig.compression.keep_interfaces = True  # Interface mode for API documentation\n\n# Include/Ignore patterns\nconfig.include = [\"src/**/*\", \"tests/**/*\"]\nconfig.ignore.custom_patterns = [\"*.log\", \"*.tmp\"]\nconfig.ignore.use_gitignore = True\n\n# Remote repository configuration\nconfig.remote.url = \"https://github.com/username/repo\"\nconfig.remote.branch = \"feature-branch\"\n\n# Process repository with custom config\nprocessor = RepoProcessor(\".\", config=config)\nresult = processor.process()\n```\n\n#### 6.2.1 Compression Examples\n\n```python\nfrom repomix import RepoProcessor, RepomixConfig\n\n# Example 1: Generate API documentation (Interface Mode)\nconfig = RepomixConfig()\nconfig.compression.enabled = True\nconfig.compression.keep_interfaces = True  # Keep signatures + docstrings only\nconfig.output.file_path = \"api-documentation.md\"\n\nprocessor = RepoProcessor(\".\", config=config)\nresult = processor.process()\nprint(f\"API documentation generated: {result.config.output.file_path}\")\n\n# Example 2: Code overview without implementation details\nconfig = RepomixConfig()\nconfig.compression.enabled = True\nconfig.compression.keep_signatures = True\nconfig.compression.keep_docstrings = False\nconfig.compression.keep_interfaces = False  # Keep full signatures but remove docstrings\nconfig.output.file_path = \"code-overview.md\"\n\nprocessor = RepoProcessor(\".\", config=config)\nresult = processor.process()\n\n# Example 3: Extract only configuration and constants\nconfig = RepomixConfig()\nconfig.compression.enabled = True\nconfig.compression.keep_signatures = False  # Remove all functions/classes\nconfig.output.file_path = \"config-only.md\"\n\nprocessor = RepoProcessor(\".\", config=config)\nresult = processor.process()\n```\n\nFor more example code, check out the `examples` directory:\n\n-   `basic_usage.py`: Basic usage examples\n-   `custom_config.py`: Custom configuration examples\n-   `security_check.py`: Security check feature examples\n-   `file_statistics.py`: File statistics examples\n-   `remote_repo_usage.py`: Remote repository processing examples\n\n### 6.3 Environment Variables\n\n*   `REPOMIX_COCURRENCY_STRATEGY`: Set to `thread` or `process` to manually control the concurrency strategy used for file processing (default is `process`, but `thread` might be used automatically in environments like AWS Lambda or if set explicitly).\n*   `REPOMIX_LOG_LEVEL`: Set the logging level. Available values are `TRACE`, `DEBUG`, `INFO`, `SUCCESS`, `WARN`, and `ERROR` (default is `INFO`). This setting controls the verbosity of log output regardless of the `--verbose` flag.\n\n## 🤖 7. AI Usage Guide\n\n### 7.1 Prompt Examples\n\nOnce you have generated the packed file with Repomix, you can use it with AI tools like Claude, ChatGPT, and Gemini. Here are some example prompts to get you started:\n\n#### Code Review and Refactoring\n\nFor a comprehensive code review and refactoring suggestions:\n\n```\nThis file contains my entire codebase. Please review the overall structure and suggest any improvements or refactoring opportunities, focusing on maintainability and scalability.\n```\n\n#### Documentation Generation\n\nTo generate project documentation:\n\n```\nBased 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.\n```\n\n#### Test Case Generation\n\nFor generating test cases:\n\n```\nAnalyze 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.\n```\n\n#### Code Quality Assessment\nEvaluate code quality and adherence to best practices:\n\n```\nReview 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.\n```\n\n#### Library Overview\nGet a high-level understanding of the library\n\n```\nThis file contains the entire codebase of library. Please provide a comprehensive overview of the library, including its main purpose, key features, and overall architecture.\n```\n\n#### API Documentation Review\nFor reviewing API interfaces (when using interface mode compression):\n\n```\nThis file contains the API interfaces of my codebase with all implementation details removed. Please review the API design, suggest improvements for consistency, and identify any missing documentation or unclear method signatures.\n```\n\n#### Code Architecture Analysis\nFor analyzing code structure (when using signature mode compression):\n\n```\nThis file contains the code structure with function signatures but minimal implementation details. Please analyze the overall architecture, identify design patterns used, and suggest improvements for better modularity and separation of concerns.\n```\n\n#### Configuration Analysis\nFor analyzing configuration and constants (when using minimal mode compression):\n\n```\nThis file contains only the configuration, constants, and global variables from my codebase. Please review these settings, identify potential configuration issues, and suggest best practices for configuration management.\n```\n\nFeel free to modify these prompts based on your specific needs and the capabilities of the AI tool you're using.\n\n### 7.2 MCP (Model Context Protocol) Server\n\nRepomix can run as an MCP server, allowing AI assistants like Claude to directly interact with your codebase without manual file preparation.\n\n\u003e **📦 Installation Required**: Before using MCP features, make sure you have installed repomix: `pip install repomix`\n\n#### Starting the MCP Server\n\n```bash\n# Start the MCP server (detailed logs output to stderr)\nrepomix --mcp\n```\n\nAfter starting, you'll see logs like:\n\n```\n📦 Repomix v0.3.0\n\nStarting Repomix MCP Server...\n🔧 Creating MCP server...\n📦 Registering MCP tools...\n  ✅ pack_codebase\n  ✅ pack_remote_repository  \n  ✅ read_repomix_output\n  ✅ grep_repomix_output\n  ✅ file_system_read_file\n  ✅ file_system_read_directory\n🎯 Repomix MCP Server configured with 6 tools\n🚀 Starting Repomix MCP Server on stdio transport...\n📡 Waiting for MCP client connections...\n💡 Use Ctrl+C to stop the server\n──────────────────────────────────────────────────\n```\n\n#### Configuring in AI Assistants\n\n**Claude Desktop**\nAdd to `claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"repomix\": {\n      \"command\": \"repomix\",\n      \"args\": [\"--mcp\"],\n      \"cwd\": \"/path/to/your/project\"\n    }\n  }\n}\n```\n\n**VS Code / Cline**\nAdd to `cline_mcp_settings.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"repomix\": {\n      \"command\": \"repomix\", \n      \"args\": [\"--mcp\"],\n      \"cwd\": \"/path/to/your/project\"\n    }\n  }\n}\n```\n\n**Claude Code**\n```bash\n# From any directory (after installing repomix)\nclaude mcp add repomix -- repomix --mcp\n```\n\n#### About the `cwd` Parameter\n\nThe `cwd` (current working directory) parameter in MCP configuration determines where the repomix command runs from. Here are the recommended settings:\n\n- **For general use**: Set `cwd` to your home directory or any stable location like `\"/Users/yourusername\"` (macOS) or `\"/home/yourusername\"` (Linux)\n- **For specific projects**: Set `cwd` to your main project directory that you frequently analyze\n- **For development**: You can use any directory since repomix can process any path you specify in the tool calls\n\n**Examples**:\n```json\n// General use - works from anywhere\n\"cwd\": \"/Users/yourusername\"\n\n// Project-specific - convenient for frequent analysis  \n\"cwd\": \"/Users/yourusername/projects/my-main-project\"\n\n// Development - flexible starting point\n\"cwd\": \"/Users/yourusername/dev\"\n```\n\n\u003e **💡 Pro Tip**: The MCP tools allow you to specify target directories in the tool parameters, so the `cwd` is just the starting location. You can analyze any accessible directory regardless of where the server starts.\n\n#### Available MCP Tools\n\n1. **pack_codebase** - Package local codebase into XML format\n   - Parameters: directory, compress, include_patterns, ignore_patterns, top_files_length\n   \n2. **read_repomix_output** - Read generated output files\n   - Parameters: output_id, start_line, end_line\n   \n3. **grep_repomix_output** - Search within output files\n   - Parameters: output_id, pattern, context_lines, ignore_case\n   \n4. **file_system_read_file** - Read files from filesystem\n   - Parameters: path\n   \n5. **file_system_read_directory** - List directory contents\n   - Parameters: path\n\n6. **pack_remote_repository** - Package remote repositories (coming soon)\n   - Parameters: remote, compress, include_patterns, ignore_patterns\n\n#### Tool Call Logs\n\nWhen AI assistants call tools, you'll see detailed logs in the server terminal:\n\n```\n🔨 MCP Tool Called: pack_codebase\n   📁 Directory: /path/to/project\n   🗜️ Compress: false\n   📊 Top files: 10\n   🏗️ Creating workspace...\n   📝 Output will be saved to: /tmp/repomix_mcp_xxx/repomix-output.xml\n   🔄 Processing repository...\n   ✅ Processing completed!\n   📊 Files processed: 45\n   📝 Characters: 125,432\n   🎯 Tokens: 0\n   🎉 MCP response generated successfully\n```\n\n#### Features\n\n- ✅ Complete MCP protocol support\n- ✅ Detailed operation logging\n- ✅ Security file checking\n- ✅ Multiple output formats\n- ✅ File search and reading\n- ✅ Temporary file management\n- 🔄 Remote repository support (in development)\n- 🔄 Code compression features (in development)\n\n### 7.3 Best Practices\n\n*   **Be Specific:** When prompting the AI, be as specific as possible about what you want. The more context you provide, the better the results will be.\n*   **Iterate:** Don't be afraid to iterate on your prompts. If you don't get the results you want on the first try, refine your prompt and try again.\n*   **Combine with Manual Review:** While AI can be a powerful tool, it's not perfect. Always combine AI-generated output with manual review and editing.\n*   **Security First:** Always be mindful of security when working with your codebase. Use Repomix's built-in security checks and avoid sharing sensitive information with AI tools.\n\n## 📄 8. License\n\nThis project is licensed under the MIT License.\n\n---\n\nFor more detailed information, please visit the [repository](https://github.com/andersonby/python-repomix).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAndersonBY%2Fpython-repomix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAndersonBY%2Fpython-repomix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAndersonBY%2Fpython-repomix/lists"}