GitHub

Your Source to Prompt Project Description

What is the project about?

The project, "Your Source to Prompt," is a tool designed to combine multiple code files from a directory into a single text output, suitable for use as a prompt for Large Language Models (LLMs). It's designed to be extremely easy to use, secure, and efficient.

What problem does it solve?

It addresses several problems with existing code-to-prompt tools:

  • Privacy: Many existing tools require sending code to external servers or using API keys, raising privacy concerns, especially with private codebases.
  • Installation Complexity: Many tools require installing Python, Node.js, or other dependencies, creating setup hurdles.
  • Repetitive File Selection: Users often need to select the same set of files repeatedly, which is time-consuming.
  • Lack of Contextual Information: Simply concatenating files doesn't provide the LLM with sufficient context about the project structure or the user's goals.
  • Context Window Limits: Large projects can easily exceed the context window limits of LLMs.
  • Git dependency: Many tools are limited to only git repositories.

What are the features of the project?

  • Fully Local and Secure: Runs entirely within the browser; code never leaves the user's machine.
  • No Dependencies: Requires only a modern, Chromium-based browser. No installation of other software is needed.
  • Works with Any Folder: Not limited to Git repositories; can be used with any directory.
  • Presets: Save and load file selections and settings for repeated use. Presets can be exported/imported as JSON.
  • Efficient File Selection: String-based filtering, quick select options (e.g., select all React files), and the ability to toggle all text files.
  • Context Size Awareness: Displays total size and line count, with warnings for potential context window overruns.
  • Hierarchical Structure Preview: Automatically generates a tree-like structure showing file sizes and line counts.
  • Minification: Optionally minify JavaScript, CSS, HTML, and JSON files to reduce prompt size.
  • Custom Preamble & Goal: Allows users to add a preamble and a stated goal to provide context to the LLM.
  • User-Friendly UI: Includes a dark mode and tooltips for ease of use.
  • Export/Import Presets: Share or backup presets.

What are the technologies used in the project?

  • HTML/JavaScript: The core of the application.
  • Tailwind CSS: For styling.
  • Tippy.js: For tooltips.
  • File System Access API: A modern browser API for accessing local files and directories.
  • Terser: For JavaScript/TypeScript minification (loaded via CDN).
  • csso: For CSS minification (loaded via CDN).
  • html-minifier-terser: For HTML minification (loaded via CDN).
  • localStorage: For storing presets.

What are the benefits of the project?

  • Enhanced Security: Code privacy is guaranteed as everything runs locally.
  • Ease of Use: No installation or complex setup is required.
  • Time Savings: Presets and efficient file selection features reduce repetitive tasks.
  • Improved LLM Performance: Contextual information (preamble, goal, file structure) and minification help the LLM understand the code better.
  • Flexibility: Works with any folder, not just Git repositories.

What are the use cases of the project?

  • Code Refactoring: Provide an LLM with a codebase to suggest refactoring improvements.
  • Code Documentation: Generate documentation for a project.
  • Code Completion/Generation: Use an LLM to complete or generate code snippets based on the provided context.
  • Bug Fixing: Help an LLM identify and fix bugs in a codebase.
  • Code Explanation: Ask an LLM to explain the functionality of a codebase.
  • Code Review: Provide code to an LLM for review and feedback.
  • Any task where you need to give an LLM context from multiple files.
your-source-to-prompt.html screenshot