# Weekly Digest Generator

- **Command:** `lore weekly [--since <date>]`
- **Confidence:** 90%
- **Tier:** 1
- **Status:** proposed
- **Effort:** medium — builds on digest infrastructure, adds markdown formatting

## What

Auto-generate a markdown document summarizing the week: MRs merged (grouped by
project), issues closed, new issues opened, ongoing discussions, milestone progress.
Formatted for pasting into Slack, email, or team standup notes.

Default window is 7 days. `--since` overrides.

## Why

Every team lead writes a weekly status update. This writes itself from the data.
Leverages everything gitlore has ingested. Saves 30-60 minutes of manual summarization
per week.

## Data Required

Same as digest (all exists today):
- `resource_state_events`, `merge_requests`, `issues`, `discussions`
- `milestones` for progress tracking

## Implementation Sketch

This is essentially `lore digest --since 7d --format markdown` with:
1. Section headers for each category
2. Milestone progress bars (X/Y issues closed)
3. "Highlights" section with the most-discussed items
4. "Risks" section with overdue issues and stale MRs

### Markdown Template

```markdown
# Weekly Summary — Jan 20-27, 2025

## Highlights
- **!234** Refactor auth middleware merged (12 discussions, 4 reviewers)
- **#95** New critical bug: Rate limiting returns 500

## Merged (3)
| MR | Title | Author | Reviewers |
|----|-------|--------|-----------|
| !234 | Refactor auth middleware | alice | bob, charlie |
| !231 | Fix connection pool leak | bob | alice |
| !45 | Update dashboard layout | eve | dave |

## Closed Issues (2)
- **#89** Login timeout on slow networks (closed by alice)
- **#87** Stale cache headers (closed by bob)

## New Issues (3)
- **#95** Rate limiting returns 500 (priority::high, assigned to charlie)
- **#94** Add rate limit documentation (priority::low)
- **#93** Flaky test in CI pipeline (assigned to dave)

## Milestone Progress
- **v2.0** — 14/20 issues closed (70%) — due Feb 15
- **v1.9-hotfix** — 3/3 issues closed (100%) — COMPLETE

## Active Discussions
- **#90** 8 new comments this week (needs-review)
- **!230** 5 review threads unresolved
```

## Robot Mode Output

```json
{
  "ok": true,
  "data": {
    "period": { "from": "2025-01-20", "to": "2025-01-27" },
    "merged_count": 3,
    "closed_count": 2,
    "opened_count": 3,
    "highlights": [...],
    "merged": [...],
    "closed": [...],
    "opened": [...],
    "milestones": [...],
    "active_discussions": [...]
  }
}
```

## Downsides

- Formatting preferences vary by team; hard to please everyone
- "Highlights" ranking is heuristic (discussion count as proxy for importance)
- Doesn't capture work done outside GitLab

## Extensions

- `lore weekly --project group/backend` — single project scope
- `lore weekly --author alice` — personal weekly summary
- `lore weekly --output weekly.md` — write to file
- Scheduled generation via cron + robot mode
