From ebc46fcc8e9f0560ecd021a02dd02f3b68e74b1b Mon Sep 17 00:00:00 2001 From: Gustavo Miranda Date: Sat, 8 Aug 2026 14:17:30 -0300 Subject: [PATCH 1/6] feat: add GitHub sync and LLM-powered summaries - devlog sync imports commits, authored PRs, and PR reviews from GitHub, idempotent via entry source - devlog summary create --ai with --style templates; --polish rewrites sync descriptions via any OpenAI-compatible endpoint - add github and llm config sections and go-github/oauth2 deps; update README --- README.md | 63 ++++++++- cmd/summary/create.go | 66 +++++++++- cmd/sync.go | 253 ++++++++++++++++++++++++++++++++++++ go.mod | 4 +- internal/github/activity.go | 156 ++++++++++++++++++++++ internal/github/client.go | 17 +++ internal/llm/client.go | 139 ++++++++++++++++++++ internal/store/store.go | 5 + templates/templates.go | 21 +++ 9 files changed, 710 insertions(+), 14 deletions(-) create mode 100644 cmd/sync.go create mode 100644 internal/github/activity.go create mode 100644 internal/github/client.go create mode 100644 internal/llm/client.go create mode 100644 templates/templates.go diff --git a/README.md b/README.md index 222634c..df8c359 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ DevLog is intended to be useful both directly from the terminal and through codi - Show a previously generated summary - List previously generated summaries with date-range filters - Store all data locally under `~/.devlog/` +- Import GitHub activity (commits, authored PRs, PR reviews) as entries with `devlog sync` +- Generate AI-polished summaries (`--ai`, four style templates) and LLM-rewritten sync descriptions (`--polish`) via any OpenAI-compatible endpoint - Report version/build info and self-update from GitHub releases --- @@ -154,6 +156,38 @@ devlog add "Reviewed checkout API" -p shop --date 2026-04-14 --- +### `devlog sync` + +Imports your GitHub activity for a date — commits, pull requests you authored, and pull requests you reviewed — as entries for that day. Private repositories are included as long as the token can access them. + +```bash +devlog sync [options] +``` + +Options currently implemented: + +| Option | Description | +|---|---| +| `--date ` | Date to sync. Defaults to today. | +| `--dry-run` | Print what would be imported without writing entries. | +| `--polish` | Rewrite descriptions with an LLM before saving (requires `llm.enabled` in config). On LLM failure the raw descriptions are kept. | + +Setup: + +- Set `github.username` in `~/.devlog/config.json`. +- Put a GitHub token in the environment variable named by `github.tokenEnvVar` (default `GITHUB_TOKEN`). The token needs the `repo` scope (classic) or Contents read access (fine-grained); authorize it for SSO if your organization requires it. + +Re-running `sync` for the same date skips already-imported items, so it is safe to schedule (e.g. a daily cron job). + +Examples: + +```bash +devlog sync +devlog sync --date 2026-08-05 --dry-run +``` + +--- + ### `devlog list` Displays entries for today or for a specific date. @@ -189,15 +223,18 @@ devlog summary create [options] Options currently implemented: -| Option | Description | -|---|---| -| `--date ` | Summarize a specific date. Defaults to today. | +| Option | Short | Description | +|---|---:|---| +| `--date ` | | Summarize a specific date. Defaults to today. | +| `--ai` | | Use an LLM to produce a polished narrative (requires `llm.enabled` in config). | +| `--style