Skip to content

Prototype: scripts/star_radar.py -- GraphQL cross-repo collector #70

@djdarcy

Description

@djdarcy

Prototype: scripts/star_radar.py -- GraphQL cross-repo collector

Parent: Cross-repo engagement radar epic
Milestone: v0.5.0 (prototype can start earlier as a script)

Goal

Build a standalone prototype script that demonstrates the core value: "which of my repos got new stars since I last checked?"

Specification

Input: User's GitHub identity (via gh auth status)

Process:

  1. Call gh api graphql to fetch all repos (personal + org) with star/fork/issue counts
  2. Handle pagination (cursor-based, >100 repos)
  3. Store snapshot as ~/.ghtraf/portfolio/snapshots/YYYY-MM-DD.json
  4. Compare against previous snapshot
  5. Output delta report

Output (stdout):

Star changes since 2026-03-20:
  +2  DazzleTools/Windows-No-Internet-Secured-BUGFIX  (142 -> 144)
  +1  djdarcy/github-traffic-tracker  (12 -> 13)
  --- 47 repos unchanged ---

Fork changes since 2026-03-20:
  +1  DazzleML/comfyui-triton-and-sageattention-installer  (23 -> 24)

GraphQL query sketch:

{
  viewer {
    repositories(first: 100, ownerAffiliations: [OWNER]) {
      pageInfo { hasNextPage endCursor }
      nodes {
        nameWithOwner
        stargazerCount
        forkCount
        issues(states: OPEN) { totalCount }
        pullRequests(states: OPEN) { totalCount }
      }
    }
    organizations(first: 20) {
      nodes {
        repositories(first: 100) {
          pageInfo { hasNextPage endCursor }
          nodes {
            nameWithOwner
            stargazerCount
            forkCount
            issues(states: OPEN) { totalCount }
            pullRequests(states: OPEN) { totalCount }
          }
        }
      }
    }
  }
}

Key decisions

  • Use subprocess to call gh api graphql (matches ghtraf's existing gh.py pattern)
  • Store snapshots as JSON (same pattern as state.json)
  • No external dependencies -- stdlib + gh CLI only
  • Script should work standalone (python scripts/star_radar.py) and as a module

Graduation criteria

This script becomes ghtraf portfolio collect when:

  1. It reliably collects data across all repos/orgs
  2. The snapshot/delta pattern is proven
  3. Output format is settled
  4. ghtraf's v0.4.0 milestone is complete

Analysis

See 2026-03-21__17-57-11__dev-workflow-process_cross-repo-analytics-extend-vs-separate.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    analyticsDerived metrics, insights, and conversion ratiosenhancementNew feature or requestportfolioCross-repo/org-level analytics and engagement tracking

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions