This was my very first experience contributing to an open-source project, and honestly, it wasn’t easy. I faced many difficulties, but I also learned a lot. The project I worked on is called share-my-repo, a small command-line tool that makes it easier to share GitHub repositories in a clean and organized way. The goal of share-my-repo is to cleanly package and organize repositories so they are easier to share, review, and process, both by humans and AI tools such as ChatGPT, Claude, Gemini, or Bard. Working on this assignment gave me hands-on experience with file handling, modular code design, and GitHub workflows.
Why Python
I chose Python because I already had some experience working with it, so I was familiar with its syntax and libraries. It made it easier for me to understand and implement the concepts needed for this project, like file handling, directory traversal, and formatting outputs. Python’s readability and simplicity allowed me to focus on building the functionality rather than getting stuck on low-level details.
My Experience Building the Project
Working on share-my-repo gave me a hands-on experience with writing modular code and organizing a project so that each part is easier to understand and maintain. I tried to separate the logic into different modules:
File Processing Module: Handles recursively discovering files, filtering them based on size, type, include/exclude patterns, and automatically skipping binary or unreadable files. Designing this module required careful handling of large files, edge cases, and error management.
Output Formatting Module: Responsible for generating clear outputs in Markdown, JSON, or YAML, including optional token estimation for LLM usage. Making sure the output was readable, even for large repositories, was a challenge.
Git Operations Module: Retrieves Git information such as commit hash, branch, author, and date. I learned how to safely execute Git commands programmatically while handling cases like non-Git directories or missing permissions.
Command-line Interface Module: Parses user inputs and flags using Click. Building a flexible CLI taught me how to handle multiple options gracefully and ensure the program remains user-friendly.
Some files and areas that gave me the most trouble were:
Discovering files for proper output: The first difficulty was figuring out how to correctly identify and include all relevant files while excluding unnecessary ones like
node_modules
or large binaries. Getting the logic right for a clean and meaningful output took a lot of trial and error.Implementing the directory structure: The second challenge was building a readable tree-like directory structure for the output.
Command-line Flags: Implementing the different CLI flags (like
--include
,--exclude
,--max-file-size
,--format
, and--tokens
) was challenging because I had to ensure they all worked correctly together. I learned how to parse multiple options gracefully while keeping the interface user-friendly.
This project is not perfect, and there are still many areas I can improve. I plan to continue enhancing its functionality and making it more robust. Despite the challenges, I truly enjoyed working on share-my-repo and learned a lot from the experience.
Top comments (0)