DEV Community

OleksandraKordonets
OleksandraKordonets

Posted on

The Repo Packager: My OSD600 CLI That Helps Me Learn Faster

I want to share my experience working on OSD600 - Release 0.1. The project is a command-line tool that analyzes local Git repositories and generates a single, well-structured text file with repository content optimized for sharing with Large Language Models (LLMs). The idea is simple but powerful: instead of copy-pasting a few files and losing important context (project layout, dependencies, commit info), the tool packages structure, metadata, and code into a prompt-friendly format that makes asking an LLM about your repo much more effective.

Solution overview

The tool is written in C++ and structured around small, focused modules so the code is easy to test and extend:

  • CLI & Config - reads command-line options (like -h/--help, -v/--version, -o/--output, -i/--include) and stores them in a Config object for the rest of the program to use.
  • RepositoryScanner - walks through the folders you point it to (using std::filesystem), applies the --include filter (for example *.cpp,*.h), and returns a list of files to include plus any files it had to skip.
  • FileReader - opens each file, reads the text, counts lines, and if a file is very large it truncates it (default 16 KB) so the output doesn’t get too big.
  • GitInfoCollector - finds the repo root by looking for .git up the folder tree and runs git to get the current commit SHA, branch, author, and date. I made this work on both Windows and Unix.
  • OutputFormatter - builds the final text (absolute path, git info, a directory tree, each file’s contents in fenced blocks, and a short summary). By default it prints to stdout, or you can write to a file with -o.

Challenges

  • Walking folders - At first I didn’t know how to reliably walk a project, I had issues with undestanding how to navigate directories. For that I used std::filesystem: recursive_directory_iterator with skip_permission_denied. Now the scanner skips unreadable places, ignores build artifacts, and only includes files that match my --include filters.
  • Calling git - The git info part confused me at first as my Linux-style commands and redirections blew up on Windows and I didn’t know why. I fixed it by running git from the repo root, I wrote a tiny RAII ScopedChdir helper so the program temporarily chdir()s to the repo, and using the right null device for each OS (NULon Windows, /dev/null on Unix). I also capture git output with popen()/_popen() so I can parse commit, branch, author, and date reliably.
  • Paths and Visual Studio - Visual Studio runs programs from the build folder by default, which confused the scanner, the build folder may not contain source files. So I cwitched to VSCode, which made everything much easier.

My experience

At first I was honestly terrified. The assignment left a lot of design choices open, and that felt overwhelming, especially with only two weeks to deliver. I spent almost every free moment on it during the first week because I was sure I wouldn’t finish on time. Ironically, that nervous sprint paid off and I managed to complete about 90% of the functionality in that first week. Looking back, the lesson is simple: the stress felt worse than the work.

Highlights

One of the highlights of this release was collaboration. I’m used to working alone on assignments, so having to coordinate and exchange ideas with classmates was new. Talking to others and sharing approaches made the project less intimidating. Several classmates and I exchanged ideas over Teams and with some I even met in person. That experience made me more confident in reaching out when I’m stuck. It no longer feels awkward to send a quick message. This experience truly improved my confidence.

Another thing is that I love that this tool is actually useful beyond the course. Unlike some throwaway projects, I’ve already started using it for other classes. For example, in my Java course I often get long in-class code example from the professor that are hard to review by yourself after class. I use the CLI tool to package the codebase and then feed that package to an LLM to ask questions, it saves a ton of time and helps me understand code structure and relationships faster.

Top comments (0)