AutoCommenter – A Go Learning Projectcover image

AutoCommenter – A Go Learning Project

I built AutoCommenter mainly to learn how real projects are structured and built in Go. Instead of just practicing syntax, I wanted to understand how everything fits together in an actual tool — CLI design, project structure, packages, and external integrations.

What This Project Is

AutoCommenter is a simple command-line tool for Go projects that uses AI to generate:

  • Code comments
  • README files

It scans your project, understands the structure, and then uses that context to generate documentation.

Why I Built This

The goal wasn’t to create a perfect tool. It was to learn:

  • How Go projects are organized (cmd, internal, etc.)
  • How to build a CLI application
  • How to split logic into clean packages
  • How tools actually scan and process code
  • How to connect a Go app with an external API (Gemini)

This project gave me hands-on experience with all of that.

How It Works (Simple View)

The tool works in two steps:

  1. Generate context

  • Scans .go files
  • Collects imports, exports, and structure
  • Generate output

    • Adds comments to code
    • Creates or updates a README

    Everything runs from the project root (where go.mod exists).

    How to Run It

    First, install the tool:

    go install github.com/praneeth-ayla/autocommenter@latest
    

    Set your API key:

    export GEMINI_API_KEY="YOUR_API_KEY"
    

    Then use the commands:

    Generate project context:

    autocommenter context gen
    

    Generate comments:

    autocommenter comments gen
    

    Generate README:

    autocommenter readme gen
    

    Project Structure

    The project follows a clean Go structure:

    • cmd/ → CLI commands
    • internal/ → core logic (AI, scanner, config, etc.)
    • main.go → entry point

    This helped me understand how real-world Go projects are organized.

    Links

    • GitHub: link
    • Demo video: link
    • Installation: go install github.com/praneeth-ayla/autocommenter@latest