How ammar-ahmed22/chlog works
Project type and purpose
• chlog is a Go-based CLI tool for generating structured JSON changelogs from Git history via AI models (OpenAI, Gemini).
• It’s not a web app or microservice platform, but a single binary that orchestrates a series of modules: Git integration, prompt generation, AI invocation, JSON formatting, and file I/O.
File structure
• Top-level files:
• main.go – starts the CLI (using Cobra)
• cmd/ – cobra command definitions (root, init, generate, models)
• ai/ – AI provider abstractions (openai.go, gemini.go, generic ai.go)
• git/ – Git interaction logic (retrieving commits, diffs)
• models/ – data structures for changelog entries and schemas
• utils/ – helpers for config loading, prompt construction, I/O utilities
• config & generate helpers in utils
• .github, goreleaser.yaml, Makefile, install scripts – CI/CD and release pipelines
• Patterns:
• Layered CLI → command handlers → domain modules (git, ai, models, utils)
• Modular provider design for easy extension
• Separation of concerns: prompting, I/O, formatting, business logic
Key insights from README
• CLI-first design, JSON to stdout, verbose logs to stderr
• Configurable via YAML or flags; flags override config
• Prepend entries in existing file vs. create new
• Support for multiple LLM providers via a provider interface
Detail is key
• Git Service calling out to the local Git repo via the Git CLI.
• Config loader reading chlog.yaml or CLI flags.