pastemax

pastemax

A simple tool to select files from a repository to copy/paste into an LLM

Stars: 276

Visit
 screenshot

PasteMax is a modern file viewer application designed for developers to easily navigate, search, and copy code from repositories. It provides features such as file tree navigation, token counting, search capabilities, selection management, sorting options, dark mode, binary file detection, and smart file exclusion. Built with Electron, React, and TypeScript, PasteMax is ideal for pasting code into ChatGPT or other language models. Users can download the application or build it from source, and customize file exclusions. Troubleshooting steps are provided for common issues, and contributions to the project are welcome under the MIT License.

README:

PasteMax

License: MIT GitHub issues

A modern file viewer application for developers to easily navigate, search, and copy code from repositories. Ideal for pasting into ChatGPT or your LLM of choice. Built with Electron, React, and TypeScript.

PasteMax Screenshot

Video

YouTube Link

Features

  • File Tree Navigation: Browse directories and files with an expandable tree view
  • Token Counting: View the approximate token count for each file (useful for LLM context limits)
  • Search Capabilities: Quickly find files by name or content
  • Selection Management: Select multiple files and copy their contents together
  • Sorting Options: Sort files by name, size, or token count
  • Dark Mode: Toggle between light and dark themes for comfortable viewing in any environment
  • Binary File Detection: Automatic detection and exclusion of binary files
  • Smart File Exclusion: Automatically excludes common files like package-lock.json, binary files, and more by default

Installation

Download Binary

Download the latest version from the releases page.

Or Build from Source

  1. Clone the repository:
git clone https://github.com/kleneway/pastemax.git
cd pastemax
  1. Install dependencies:
npm install
  1. Build the app:
npm run build-electron
npm run package

Note for Windows users: If you encounter issues with npm run package, you can try the platform-specific command:

npm run package:win

After successful build, you'll find the executable files in the release-builds directory:

  • PasteMax Setup 1.0.0.exe - Installer version
  • PasteMax 1.0.0.exe - Portable version

Development

Prerequisites

  • Node.js (v14 or higher)
  • npm or yarn

Setup

  1. Clone the repository
  2. Install dependencies:
npm install

Running in Development Mode

To run the application in development mode:

# Start the Vite dev server
npm run dev

# In a separate terminal, start Electron
npm run dev:electron

Building for Production

To build the application for production:

# Build the React app with Vite and update paths for Electron
npm run build-electron

# Create platform-specific distributables
npm run package

Platform-specific build commands:

  • Windows: npm run package:win
  • macOS: npm run package:mac
  • Linux: npm run package:linux

Project Structure

  • src/ - React application source code
    • components/ - React components
    • types/ - TypeScript type definitions
    • styles/ - CSS styles
  • main.js - Electron main process
  • build.js - Build script for production
  • excluded-files.js - Configuration for files to exclude by default
  • docs/ - Documentation
    • excluded-files.md - Documentation for the file exclusion feature

Libraries Used

  • Electron - Desktop application framework
  • React - UI library
  • TypeScript - Type safety
  • Vite - Build tool and development server
  • tiktoken - Token counting for LLM context estimation
  • ignore - .gitignore-style pattern matching for file exclusions

Customization

You can customize which files are excluded by default by editing the excluded-files.js file. See the excluded files documentation for more details.

Troubleshooting

"Cannot find module 'ignore'" error

If you encounter this error when running the packaged application:

Error: Cannot find module 'ignore'
Require stack:
- /Applications/PasteMax.app/Contents/Resources/app.asar/main.js

This is caused by dependencies not being properly included in the package. To fix it:

  1. Run the dependency fixer script:

    node fix-dependencies.js
    
  2. Rebuild the application:

    npm run build-electron && npm run package
    
  3. Install the new version

Build Command Issues

If you encounter issues with the standard npm run package command:

  1. Try using the platform-specific build command:

    • Windows: npm run package:win
    • macOS: npm run package:mac
    • Linux: npm run package:linux
  2. Check the release-builds directory for output files after building

Other Issues

If you encounter other issues, please report them on GitHub.

License

MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

For Tasks:

Click tags to check more tools for each tasks

For Jobs:

Alternative AI tools for pastemax

Similar Open Source Tools

For similar tasks

For similar jobs