Skip to content

Add gapp refresh to sync local cache from GitHub + GCP #3

@krisrowe

Description

@krisrowe

Summary

Add a gapp refresh command that bulk-syncs the local solutions cache from GitHub and GCP, replacing gapp list --available as the primary discovery mechanism. Move solutions.yaml from ~/.config/gapp/ (XDG_CONFIG) to ~/.cache/gapp/ (XDG_CACHE) to reflect its true nature — reconstructable, machine-specific, potentially stale.

What it does

  1. Query GitHub for all repos with gapp-solution topic
  2. For each solution, discover the GCP project via labels (gapp-{name}=default)
  3. Write everything to ~/.cache/gapp/solutions.yaml
  4. Warn if refresh has never been run (e.g., on gapp status when the cache file doesn't exist)

After refresh, gapp status project suggestions become instant (local read), gapp list shows everything without --available, and project ID resolution works for solutions that haven't been touched locally.

Why XDG_CACHE

  • solutions.yaml is fully reconstructable from GitHub + GCP — it's a cache, not configuration
  • repo_path is machine-specific and shouldn't be assumed portable across machines
  • Deletable without data loss — just re-run gapp refresh
  • Communicates staleness to the user — cache semantics set the right expectations

Implications not fully thought through

  • Solutions without local clones: After refresh, solutions appear in the cache with repo_path: null. resolve_solution(name) already handles this. gapp setup would work (only needs project_id). gapp deploy currently requires a local repo for git archive HEAD — but could potentially work remotely (see below).
  • Remote deploy without clone: If gapp deploy could git archive from a GitHub remote (via gh or git clone --bare into a temp dir), you could deploy any refreshed solution without cloning it locally. This would make gapp refresh + gapp deploy <name> a full remote workflow. Not implemented yet — needs design.
  • Clone on demand: gapp refresh could enable a lightweight gapp clone <name> that knows where to clone from (GitHub repo is in the cache). Or gapp deploy could auto-clone to a temp dir when repo_path is null.
  • Cache invalidation: How stale is too stale? Should gapp status warn if the cache is older than N days? Should certain commands auto-refresh?
  • Migration: Existing ~/.config/gapp/solutions.yaml users need a migration path. Could auto-migrate on first run.
  • CI interactions: gapp ci trigger already works by name without a local repo. After refresh, the cache would have the project_id populated, making CI commands work more reliably on fresh machines.

Replaces

  • gapp list --available (the --available flag queries GitHub on every call; refresh does it once and caches)

Related

This would improve gapp status project suggestions (#3 pending) by having more solutions and project IDs in the local cache without requiring each solution to have been gapp init'd on this machine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions