Files
coucou/scripts
LouisandClaude Sonnet 4.6 daa4bec4e2 GitHub pulse: open PRs, CI status and reviews in the notch (#181)
* feat: GitHub pulse — open PRs, CI status and review requests in the notch

Adds a live GitHub integration to the integration_github pill:
- One GraphQL query fetches open PRs (CI + review decision), PRs
  to review and default-branch CI for 10 recent repos
- Adaptive polling: 60 s when a PR/CI is pending, 300 s otherwise
- Alerts (badge + sound) on CI failure, new review request, CI pass;
  priority: failure > review > pass; first poll is always silent
- GitHubPulseCardView replaces the stats card when pulse data is available
- GitHubDetailView with tappable PR/repo rows opens the matching GitHub URL
- Settings help text for the token (scope requirements)
- 37 unit tests covering parse, events, CIState and edge cases
- CI step "GitHub pulse tests" added to build.yml
- Docs: INTEGRATIONS.md §1quater, SPEC.md card/detail sections,
  privacy.html section 4 (EN + FR), README integrations line

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(github-pulse): 6 correctifs avant merge

1. Partial GraphQL errors: parse data when "data" key is present even if
   "errors" exists; only keep old data when "data" is absent/null.
   Replace print() with appendAppLog("github.log", ...) via private nbLog.

2. Badge: skip badge (not sound) when integration_github is already in focus.

3. Stale data: clear githubPulse when integration_github is removed from
   activeIntegrations (AppState.didSet); clear githubPulse (+ githubStats
   if deleted) when token changes in saveIntegrations(), then trigger an
   immediate pulse poll on new token via GithubPoller.triggerPulseNow().

4. Duplicate IDs: parse() deduplicates myPRs and toReview by id (keeps
   first). events() uses Dictionary(_:uniquingKeysWith:) for both PR and
   repo maps. 5 new tests covering parse-time dedup and event dedup.

5. GitHubRepoCIRowView: CI dot + short name (10.5 pt #9398A1) + branch
   (11 pt #C5C8CD) + status word right (failing/running/passing, 10 pt
   in CI colour). Tap opens repo/actions URL filtered on host==github.com.

6. Height: .clipped() on GitHubPulseCardView and GitHubDetailView outer
   containers; ScrollView maxHeight reduced to 80 pt (4 × 20 pt rows
   exactly) so list never overflows the 160 pt overview card.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: GitHub card header shows stats inline, list height 3 rows + bottom fade

- GitHubPulseCardView: replace "Overview" label with "★ N · N repos" (11pt
  #8E939C) when githubStats available; fall back to "Overview" otherwise.
  Remove right-aligned stats text and Spacer. Trailing padding 12 → 36 to
  avoid ↗ button overlap.
- GitHubDetailView: maxHeight 80 → 60 (3 rows × 20pt, no half-row cut).
  Add bottom fade mask (black → clear over last 20%) when item count > 3.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-10-03 16:34:00 +02:00
..