$ show namolnad/Finch
Finch is a Swift CLI tool that generates well-formatted changelogs by comparing two Git versions (tags or branches). It parses commit messages using a configurable tag convention (e.g., `[feature]`) and groups commits into sections (Features, Bug Fixes, etc.) based on user-defined YAML configuration. The tool supports custom format strings with placeholders for tags, messages, contributor handles, and commit hyperlinks, as well as cascading configuration merging from multiple file locations. It is built with SwiftCLI for command routing, Yams for YAML parsing, and the Version library for semantic versioning. The architecture is modular with separate targets for core models, app logic, and utilities, and includes comprehensive unit and snapshot tests.
The LLM identified 3 files worth highlighting for reuse:
Implements a mini template engine for formatting changelog lines. Parses a format string containing `<< component >>` placeholders (e.g., `<< message >>`, `<< tags >>`, `<< commit_type_hyperlink >>`) and resolves them against commit data. The parser walks the string character by character to identify double-angle-bracket tokens, then maps them to typed `FormatComponent` enum cases. This pattern is self-contained, depends only on the `LineOutputtable` protocol and `FormatComponent` enum, and could be extracted as a generic structured text templating library for any project needing custom output formatting.
Defines a `Mergeable` protocol and a `SubConfiguration` protocol that enable a cascading configuration merge pattern. The `Configuration` struct aggregates multiple sub-configurations (contributors, format, git, resolution commands), each conforming to `Mergeable`. The `Configurator` in FinchApp uses this to merge defaults with config files from home, current, and project directories, plus optional private configs. This pattern is reusable for any application needing layered configuration from multiple sources with partial overrides.
A clean, error-handling wrapper around `Process` for executing shell commands. It accepts an array of arguments, joins them with spaces, runs via `/bin/sh -c`, captures stdout, and throws typed errors for empty arguments, empty results, or non-zero exit codes. It is fully self-contained (only depends on Foundation and the `Executable` enum) and can be reused in any Swift project that needs to run shell commands with proper error propagation.