Vibe Coding Forem

itsis
itsis

Posted on

I Built a Tool to Stop Explaining My Codebase to AI Every Single Time

Meet fancy-tree: because your AI deserves better context than "here's a random file"

The Annoying Problem I Had

You know that feeling when you're trying to get help from ChatGPT or Claude on a coding issue, but you end up spending 10 minutes just explaining how your project is structured? Or you keep burning through your context window and need to keep pasting and building the knowledge all over again?

I was getting tired and increasingly frustrated of copying and pasting random files while just trying to give AI tools enough context to actually help me. It felt like bringing a new teammate into a project and expecting them to be useful without any onboarding.

So I built something to fix this.

What fancy-tree Actually Does

It's pretty simple. You run it on your project, and it spits out a clean overview of your entire codebase (preserving your directory structure) that you can paste directly into any AI tool.

Here's what you get:

πŸ“ Your whole directory structure

πŸ“„ File contents (respects .gitignore)

πŸ”§ All your functions, classes, and methods listed out

πŸ“€ Ready to copy/paste anywhere

Real Ways I Use This Thing

When I'm stuck on a bug: Instead of explaining my project structure for the 100th time, I just paste the fancy-tree output and say "here's my codebase, here's the error I'm getting."

Exploring new projects: Ever clone a repo and spend 20 minutes just trying to figure out what goes where? This gives you the lay of the land instantly.

Code reviews: Sometimes I'll generate a fancy-tree overview to help reviewers understand the bigger picture.

Onboarding: New team members can see the project structure without diving into every single file.

What the Output Actually Looks Like

Instead of mumbo jumbo explanations, you get clean structured output like this:

go/
  sample_1_server.go (go, 102 lines)
    func Error(w ResponseWriter, error string, code int)
    func NotFound(w ResponseWriter, r *Request)
    func Handle(pattern string, handler Handler)
    func ListenAndServe(addr string, handler Handler) error
  sample_2_gin.go (go, 88 lines)
    func New(opts ...OptionFunc) *Engine
    func Default(opts ...OptionFunc) *Engine

python/
  sample_1_base_events.py (python, 171 lines)
    def _format_handle(handle)
    def _set_reuseport(sock)
    class Server(events.AbstractServer)
    class BaseEventLoop(events.AbstractEventLoop)
  sample_2___init__.py (python, 257 lines)
    class LazySettings(LazyObject)
      def configure(self, default_settings=global_settings, **options)
      def __getattr__(self, name)
    class Settings
      def __init__(self, settings_module)
      def is_overridden(self, setting)

Processed 6 files in 2 languages
Enter fullscreen mode Exit fullscreen mode

It's token-optimized too, so you're not wasting your context window on fluff. Just the essential structure your AI needs to understand your codebase.

Language Support

Currently built with extensive support for 15+ languages (Python, TypeScript, PHP, Rust, Go, Ruby, etc) plus decent support for 160+ others. If your language isn't on the list, it literally takes about 5 minutes to add support for it.

Why I Made It This Way

No dependencies: I hate tools that bring in 50 packages for something simple.

Token-optimized: Every line is designed to give AI maximum context without wasting your precious token budget.

Works with your existing setup: It already knows about your .gitignore, so it won't show you build files and node_modules.

Copy and paste friendly: No fancy formatting, no special tools needed. Just text you can paste anywhere.

Open source: Because why not? If it helps me, maybe it'll help you too.

Try It Out

The whole thing is on GitHub: fancy-tree

pip install fancy-tree
fancy-tree my-project/
Enter fullscreen mode Exit fullscreen mode

Honestly...

This started as a way to just simplify a super annoying problem me and a friend had. Turns out other people had the same problem.

If you work with AI tools on coding stuff, give it a shot. The whole thing is open source, so check it out and let me know what features you'd like to see added. Feel free to add your own stuff!!

What's your go-to method for giving AI tools context about your projects? Do you have any tricks that work well? And if you try fancy-tree, what would make it even more useful for your workflow?

Top comments (4)

Collapse
 
prime_1 profile image
Roshan Sharma

Using a tree representation to reduce redundant context is an interesting approach, especially in large codebases. I'm curious about how well it scales with larger repositories or more complex folder structures.
Does your tool accommodate situations where the project structure frequently changes, such as in active monorepos, or would it need to regenerate the tree each time there’s a change?

Collapse
 
itsis profile image
itsis

fancy-tree is stateless so you just re-run it to reflect changes. It scales fine on big repos because it’s .gitignore-aware, linear in scanned files and you can scope with --lang or --max-files, or run per package in a monorepo.
A watch or incremental mode possibly linked with ai agents(as a rule?) could be cool in the future though

Collapse
 
codesavant profile image
CodeSavant

Sorry, I'm still learning web Dev and GitHub usage, so please be patient with me. How can I use this Fancy-tree tool in my own code? If you can just point me in what I need to learn and do some research on, I can try to figure out once I know where to begin.

Collapse
 
christopher_santangelo_dc profile image
Christopher Santangelo

Good idea, I like it. I will for sure be testing this out.