🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

reporemix

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reporemix

A opiniated repomix tool for Rust and NextJS projects.

Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
3
-78.57%
Maintainers
1
Weekly downloads
 
Created
Source

Reporemix

License: MIT

An opinionated repomix-based tool designed to consolidate codebases, particularly useful for Rust and Next.js projects, into a single, AI-friendly file while applying specific transformations.

Overview

Reporemix leverages the core file discovery and collection capabilities of the excellent repomix library. It builds upon this foundation by adding specific, opinionated processing steps to clean up common elements that can inflate token counts or are less relevant for AI analysis in certain contexts (like large SVG definitions or verbose layout comments).

The goal is to produce a cleaner, more focused single-file representation of your codebase, ideal for feeding into Large Language Models (LLMs) or for simplified code sharing and review.

Why Reporemix?

While repomix is a fantastic general-purpose tool, Reporemix provides targeted cleanup for scenarios where:

  • Large SVG definitions (common in UI components) unnecessarily inflate the context size for AI models.
  • Inline Base64 encoded images add significant length without providing easily parseable code context.
  • Specific generated comments (like XState layout hints) are not needed for the consolidation purpose.

This makes it particularly handy when preparing Rust (perhaps with embedded web views or UI components) or Next.js projects for analysis by AI assistants.

Installation

# Using npm
npm install -g reporemix  # Choose a suitable npm package name if you publish

# OR - Install from source for development:
git clone https://github.com/canesin/reporemix.git # Replace with your repo URL
cd reporemix
npm install
npm run build
npm link # Make the 'reporemix' command available globally from your local build

Usage

reporemix <directory> [options]

Arguments:

  • <directory>: (Required) The path to the project directory you want to process.

Options:

  • -o, --output <file>: Specify the output file name. (Default: reporemix-output.xml)
  • -h, --help: Display help information.

Example:

# Process the current directory and save to the default output file
reporemix .

# Process a specific project directory and save to a custom file
reporemix ./my-nextjs-app -o packed-next-app.txt

# Process a Rust project directory
reporemix ../my-rust-project -o packed-rust-project.txt

The tool will scan the specified directory, apply the transformations to non-binary files, and write the consolidated output to the specified file.

Transformations Details

  • Comment Shortening:

    • Finds: Long single-line (//, #) and multi-line (/* ... */, <!-- ... -->) comments exceeding 75 characters.
    • Applies to: .js, .jsx, .ts, .tsx, .rs, .kt, .kts, .swift, .css, .html, .htm, .py files.
    • Action: Truncates the comment content and adds an ellipsis (..., ...*/, ...-->).
  • SVG Replacement:

    • Finds: <svg ... > ... </svg> blocks.
    • Applies to: Files where text transformations are generally applied (see below).
    • Replaces with: [Inline SVG content removed by script]
  • Base64 Content Shortening (in Data URIs):

    • Finds: src="data:image/...;base64,LONG_BASE64_STRING" or similar data URIs.
    • Applies to: Files where text transformations are generally applied.
    • Replaces LONG_BASE64_STRING with: ABCD...XYZ (keeping only the first 4 and last 4 characters).
  • Base64 Variable Assignment Shortening:

    • Finds: JavaScript/TypeScript variable declarations (const, let, var) assigned very long (75+ chars) strings composed of Base64-like characters.
    • Applies to: .js, .jsx, .ts, .tsx files.
    • Replaces the long string literal with: "ABCD...XYZ".
  • @xstate-layout Removal:

    • Finds: Any line containing the exact string @xstate-layout.
    • Applies to: Files where text transformations are generally applied.
    • Action: Removes the entire line.

How it Works

Reporemix uses the repomix library internally to:

  • Discover files within the target directory.
  • Respect .gitignore rules and default ignore patterns.
  • Read the content of non-binary files.

It then iterates through the collected file contents, applies the custom transformation functions defined in this tool, and concatenates the results into the final output file.

Contributing

Contributions are welcome! Please feel free to open an issue or submit a pull request.

  • Fork the repository.
  • Create your feature branch (git checkout -b feature/AmazingFeature).
  • Commit your changes (git commit -m 'Add some AmazingFeature').
  • Push to the branch (git push origin feature/AmazingFeature).
  • Open a Pull Request.

License

Distributed under the MIT License. See LICENSE file for more information.

Keywords

cli

FAQs

Package last updated on 29 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts