smoosh: effortlessly copy an entire software project to the clipboard and share with AI
Problem
AI tools have made it a great time to be a bad programmer and still get things done. I use ChatGPT and Claude for help with programming tasks for scientific work and hobby projects. I have played around with AI-integrated editors like VSCode + Copilot, but the response quality has generally been better in the classic chat interfaces.
When working with larger multi-file projects you can’t just paste your script into the chat interface and get good advice. You need more context in the prompt, but copying and pasting several files and explaining their directory structure is tedious.
Solution
smoosh is an easy way to snapshot a whole project to the clipboard and paste it into a chat interface. First, it generates a tree diagram of the project’s files. Then, it concatenates this with the names and contents of all text files in the project directory and copies them to the clipboard. The terminal output is a simple summary of the repository size and structure. smoosh excludes non-text files, large files, and anything set in your .gitignore, so you won’t waste tokens on binaries, caches, and other extraneous data.
Use Cases
- Project-wide assistance: Get help with multi-file programs without tediously copying files one by one
- Code comprehension: Quickly understand cloned repositories by getting AI assistance with the overall structure
- Documentation gaps: Fill in the blanks when official documentation falls short
- Quick modifications: Make targeted changes to packages without having to learn its development conventions
Try smoosh!
You can check out the GitHub repo here.
To install, run:
pip install smoosh
Example use:
smoosh my_project
where my_project is a git repo or any directory that contains text files.
Example terminal output:
╭───────────────────────────────────────────────────────╮
│ 🐍 smoosh v0.1.3 - Making Python packages digestible! │
╰───────────────────────────────────────────────────────╯
⠋ Analyzing repository...INFO: Processing directory at my_project
✨ Output copied to clipboard!
Analysis Results
┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┓
┃ Metric ┃ Value ┃
┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━┩
│ Repository Size │ 0.00MB │
│ Total Files │ 4 │
│ Python Files │ 1 │
│ Original Lines │ 5 │
│ Composed Lines │ 16 │
│ Original Characters │ 97 │
│ Composed Characters │ 211 │
│ Lines Ratio │ 3.20x │
│ Characters Ratio │ 2.18x │
└─────────────────────┴────────┘
⠹ Analyzing repository...
⠹ Generating summary...
Example clipboard output:
Repository:
Mode: cat
Files: 4 (1 Python)
Total Size: 0.00MB
Repository Structure:
./
├── .gitignore
├── hello_world.py
├── hello_world.sh
└── README.md
### File: .gitignore ###
data/*
### File: README.md ###
This is sample text for a readme!
### File: hello_world.py ###
print("Hello, World!")
### File: hello_world.sh ###
#!/bin/bash
echo "Hello, World!"
Enjoy Reading This Article?
Here are some more articles you might like to read next: