Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .commit-chronicle.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# commit-chronicle — repo list
#
# One git repository path per line. Lines starting with # are ignored.
# A leading ~ expands to your home directory.
#
# Use this for an explicit list of repos. Copy it to either:
# • ./.commit-chronicle (per-project, in a repo)
# • ~/.config/commit-chronicle/repos (global)
#
# Prefer auto-discovery? Instead of listing repos, put PARENT directories in
# ~/.config/commit-chronicle/roots (one dir per line, e.g. ~/work)
# and every git repo beneath them is found automatically.

~/projects/my-app
~/projects/my-api
~/work/some-service
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: ci

on:
push:
branches: ["**"]
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.24"
- run: gofmt -l cmd internal | tee /dev/stderr | (! read)
- run: go vet ./...
- run: go build ./...
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: release

# Tag a version (e.g. `git tag v0.1.0 && git push --tags`) to build
# cross-platform binaries and attach them to a GitHub Release.
on:
push:
tags:
- "v*"

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-go@v5
with:
go-version: "1.24"

- name: Build cross-platform binaries
run: make release

- name: Publish release
uses: softprops/action-gh-release@v2
with:
files: dist/*
generate_release_notes: true
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ monthly_data_*/

# IDE
.vscode/
.idea/
.idea/

# Go build artifacts
/bin/
/dist/
44 changes: 44 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
BINARY := commit-chronicle
PKG := ./cmd/commit-chronicle
BINDIR := bin
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
LDFLAGS := -s -w -X main.version=$(VERSION)

.PHONY: build install run clean test release

## build: compile the binary for the host platform into bin/
build:
go build -ldflags "$(LDFLAGS)" -o $(BINDIR)/$(BINARY) $(PKG)

## install: install worklog into $GOBIN (or $GOPATH/bin)
install:
go install -ldflags "$(LDFLAGS)" $(PKG)

## run: build and run (pass args via ARGS=...)
run: build
./$(BINDIR)/$(BINARY) $(ARGS)

## test: vet + build all packages
test:
go vet ./...
go build ./...

## clean: remove build artifacts
clean:
rm -rf $(BINDIR) dist

## release: cross-compile static binaries into dist/
release:
@mkdir -p dist
@for target in \
darwin/amd64 darwin/arm64 \
linux/amd64 linux/arm64 \
windows/amd64; do \
os=$${target%/*}; arch=$${target#*/}; \
ext=""; [ "$$os" = "windows" ] && ext=".exe"; \
out=dist/$(BINARY)-$$os-$$arch$$ext; \
echo "→ $$out"; \
GOOS=$$os GOARCH=$$arch CGO_ENABLED=0 \
go build -ldflags "$(LDFLAGS)" -o $$out $(PKG) || exit 1; \
done
@echo "done. binaries in dist/"
178 changes: 123 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,93 +1,161 @@
# 📊 Commit Chronicle
# 📓 commit-chronicle

**Generate beautiful monthly development reports from your git commits - organized by branch!**
Find your commits **and** pull requests across all your repos for a date range,
pick what matters in an interactive terminal UI, and export a clean **worklog**
(Markdown or JSON).

Turn your git history into professional reports that show exactly what you worked on, organized by feature branches, bug fixes, and more.
A single self-contained binary — no `node`, `python`, `fzf`, or `gum` to
install. The only requirement is **git**; **gh** (optional) unlocks PR & review
discovery.

## 🚀 Super Simple Setup
```
range → PICK (fuzzy filter + multi-select + live preview) → EDIT → EXPORT
```

### Step 1: Copy this to your terminal
For a window you choose, it gathers **everything you did**:

```bash
# Add this line to your ~/.zshrc file
echo 'source /Users/ashish/projects/commit-chronicle/commit-chronicle' >> ~/.zshrc
- commits from git history (matched by author, across all branches)
- commits on pull requests you authored
- pull requests you authored
- pull requests you reviewed

# Reload your terminal
source ~/.zshrc
```
…deduped into one **tagged** picker (`commit` / `PR` / `review`).

---

## Install

### Step 2: Configure your repositories
### Option 1 — `go install` (needs Go 1.24+)

Open the script file and find this section (around line 162):
```bash
go install github.com/ashishxcode/commit-chronicle/cmd/commit-chronicle@latest
```

This drops the `commit-chronicle` binary in `$(go env GOPATH)/bin` (usually
`~/go/bin`). Make sure that's on your `PATH`:

```bash
REPO_PATHS=(
"/Users/ashish/work/forked/cx-saas-dashboard"
"/Users/ashish/work/forked/cx-saas-server"
# Add your repository paths here
)
echo 'export PATH="$HOME/go/bin:$PATH"' >> ~/.zshrc # or ~/.bashrc
exec $SHELL
```

**Replace with your actual repository paths!** For example:
### Option 2 — build from source

```bash
REPO_PATHS=(
"/Users/yourname/projects/my-awesome-app"
"/Users/yourname/work/company-project"
)
git clone https://github.com/ashishxcode/commit-chronicle
cd commit-chronicle
make install # builds + installs to ~/go/bin
# or: make build # just produces ./bin/commit-chronicle
```

### Step 3: Done! 🎉
### Option 3 — download a release binary

Now you can run `commit_chronicle` from anywhere in your terminal:
Grab the binary for your OS/arch from the
[Releases](https://github.com/ashishxcode/commit-chronicle/releases) page, then:

```bash
commit_chronicle
chmod +x commit-chronicle-* # macOS/Linux
mv commit-chronicle-* /usr/local/bin/commit-chronicle
```

## 📋 What You'll Get
Maintainers can produce all platform binaries with `make release` (output in
`dist/`).

✅ **Branch-Based Organization** - See commits grouped by feature branches
✅ **Professional Reports** - Clean markdown with tables and statistics
✅ **Multi-Repository Support** - Analyze multiple projects at once
✅ **GitHub Integration** - Includes PR data when available
✅ **Saved to Downloads** - Reports automatically saved to your Downloads folder
---

## Usage

Run it inside a git repo, or configure repos/roots (below) to scan many at once:

### Sample Output:
```bash
commit-chronicle # interactive: pick range → pick items → edit → export
commit-chronicle --since "7 days ago"
commit-chronicle --month 2026-05 --copy
commit-chronicle --date 2026-05-25 --all --format json --out ./today.json
```
📊 Monthly Development Report - September 2025

🌿 Commits Organized by Branch:
├── cx-saas-dashboard/feat/user-authentication (15 commits)
├── cx-saas-dashboard/fix/login-bug (3 commits)
├── my-app/feature/dark-mode (8 commits)
└── my-app/main (2 commits)
### Picker keys

| Key | Action |
| -------------- | -------------------- |
| `↑` / `↓` | move |
| `space` / `tab`| toggle selection |
| `a` | select / clear all |
| `/` | fuzzy filter |
| `enter` | confirm selection |
| `q` / `esc` | cancel |

In the editor: `ctrl+s` save · `esc` cancel.

### Options

```
--since <when> relative range, e.g. "7 days ago"
--from YYYY-MM-DD start date (inclusive)
--to YYYY-MM-DD end date (inclusive; default today)
--month YYYY-MM whole calendar month
--date YYYY-MM-DD single day
--author "Name" author to match (default: git config user.name)
--user <login> GitHub login for PR discovery (default: gh user)
--repos a,b,c comma-separated repo paths
--root ~/work comma-separated dirs to auto-discover git repos under
--out <path> output path (default: ~/Downloads, timestamped)
--format md|json output format (default: md)
--all select everything (skip the picker)
--no-edit skip the editor step
--no-pr skip GitHub PR + review discovery (git commits only)
--copy copy the worklog to the clipboard
-h, --help show help
```

---

## 🔧 Optional: GitHub CLI Setup
## Configuring which repos to scan

For pull request data, install GitHub CLI:
Repo sources are **unioned** and checked in this order:

**macOS:** `brew install gh`
**Linux:** `sudo apt install gh`
**Windows:** `winget install GitHub.cli`
1. `--repos a,b,c` — explicit repo paths
2. `--root ~/work` — directories to auto-discover git repos under
3. `./.commit-chronicle` — explicit repo paths (one per line)
4. `~/.config/commit-chronicle/repos` — same, global
5. `~/.config/commit-chronicle/roots` — directories to auto-discover under
6. fallback: the current directory, if it's a git repo

Then: `gh auth login`
The most convenient setup — point it at the folder that holds your projects,
once:

## ❓ Common Questions
```bash
mkdir -p ~/.config/commit-chronicle
echo '~/work' > ~/.config/commit-chronicle/roots
```

**Q: Where do I find my repository paths?**
A: Use `pwd` command when you're inside your project folder
Now `commit-chronicle` scans every git repo under `~/work` from anywhere, with
no flags. See [`.commit-chronicle.example`](.commit-chronicle.example) for the
file format.

---

**Q: Can I change the output location?**
A: Reports are automatically saved to your Downloads folder
## How it works

**Q: What if I don't see my commits?**
A: Make sure your git name matches what you enter when running the script
- **Commits** come from `git log --all --author=<you>` across every ref.
- **PRs / reviews** come from `gh` (the GitHub CLI). It lists your PRs in the
window, then fetches commit/review details per-PR — GitHub searches are
date-bounded so it only inspects PRs that could fall in range.
- Everything is keyed by hash (commits) or repo+number (PRs) and de-duplicated,
so a commit that shows up both in history and on a PR appears once.
- Output is grouped by date; commits, PRs and reviews each render as distinct,
link-bearing lines.

**Q: Does this work on Windows?**
A: Yes! Works on Windows Git Bash, macOS, and Linux
No `gh`, or pass `--no-pr`, and it runs git-only.

---

**🎯 Generate your development report in under 30 seconds!**
## Requirements

- **git** (required)
- **gh**, authenticated (`gh auth login`) — optional, for PR & review discovery
- a clipboard tool for `--copy`: `pbcopy` (macOS), `wl-copy` or `xclip` (Linux)

## License

See [LICENSE](LICENSE).
Loading
Loading