$ show nosarthur/gita
Gita is a CLI tool that manages multiple git repositories from a single command. It allows users to register repositories, organize them into groups, and perform batch git operations such as fetch, pull, status, and custom commands across all or selected repos. The tool also displays a side-by-side summary of repository states including branch, commit message, time, and status symbols for staged/unstaged/untracked changes and local-remote branch relationships. The architecture is a monolithic Python application with a clear separation of concerns: `__main__.py` defines the CLI interface via argparse and delegates to action functions; `utils.py` provides file I/O, configuration parsing, and async execution utilities; `info.py` contains all logic for gathering and formatting repo status information; `common.py` handles config file paths; and `io.py` parses clone configuration files. The tool uses subprocess and asyncio to run git commands concurrently for multiple repos, falling back to synchronous execution for interactive commands like difftool or when only one repo is targeted. Gita stores repository metadata in CSV files under `$XDG_CONFIG_HOME/gita/` and supports extensive customization via additional config files for colors, symbols, displayed info columns, and custom commands defined in JSON. The codebase is well-tested with pytest and exercised on CI across multiple Python versions and operating systems. While the core functionality is tightly integrated with its own config schema, several internal patterns (async subprocess execution, git status extraction via diff --quiet) are cleanly abstracted and could be repurposed in other git tooling with minor adaptation.
The LLM identified 2 files worth highlighting for reuse:
Provides a set of functions for efficiently gathering git repository state information (branch, dirty/staged/untracked/stashed flags, local-remote relationship) using `git diff --quiet`, `git symbolic-ref`, and other subprocess calls. Includes a `Color` enum for terminal color codes and a `Truncate` class for column-width formatting. The logic for determining local-remote divergence (ahead, behind, diverged, in-sync, no-remote) is generic and could be extracted into a standalone git utility library. The module also supports user-customizable color schemes and status symbols via CSV files, demonstrating a maintainable configuration pattern.
Contains utility functions for executing shell commands asynchronously across multiple repositories. `run_async` wraps `asyncio.create_subprocess_exec` to run a command in a given directory without stdin, capturing stdout/stderr and formatting output with repo name prefixes. `exec_async_tasks` gathers and runs a list of coroutines concurrently. These two functions form a reusable async subprocess manager that can be dropped into any Python project needing to run multiple external commands in parallel and collect their output. The `describe` function also demonstrates concurrent execution using `ThreadPoolExecutor` to gather repo information, though it is more tightly coupled to the project's data structures.