Skip to content

feat: squad update-check --json — expose cached update status for tooling #1170

Closed

Description

@tamirdresher

Summary

Add a squad update-check --json CLI command that reads the existing update-check.json cache (already maintained by self-update.ts) and emits structured JSON. This gives editor extensions, coordinator instructions (Squad's own and downstream forks), CI scripts, and IDE tooling a clean interface to query update status without OS-specific cache path resolution.

Motivation

self-update.ts already maintains an OS-specific cache at:

  • Windows: %APPDATA%\squad-cli\update-check.json
  • Linux: ~/.config/squad-cli/update-check.json
  • macOS: ~/Library/Application Support/squad-cli/update-check.json

Today, anything outside the CLI process that wants this information has to:

  1. Replicate the OS-specific path logic
  2. Read & parse the JSON file
  3. Check TTL freshness
  4. Handle the (no cache yet) case

A CLI command exposing this cleanly is much simpler for consumers.

Proposed behavior

$ squad update-check --json
{
  "current": "0.9.6-insider.2",
  "channel": "insider",
  "latest": "0.9.7-insider.1",
  "updateAvailable": true,
  "cacheAge": "PT2H15M",
  "checkedAt": "2026-05-26T12:00:00.000Z"
}

Non-JSON (default human format):

$ squad update-check
Current: 0.9.6-insider.2 (insider channel)
Latest:  0.9.7-insider.1
Update available. Run `squad upgrade` to install.

Flags

  • --json — structured output
  • --refresh — bypass cache and re-fetch (otherwise serves from existing cache)
  • Exit code: 0 (up to date) or 1 (update available); 2 on transport failure

Side effects

  • None unless --refresh is set
  • Honors SQUAD_NO_UPDATE_CHECK=1 (exits 0 silently with empty JSON / empty stdout)

Acceptance

  • squad update-check --json emits the schema above
  • Reuses the existing update-check.json cache
  • --refresh forces a re-fetch
  • Exit codes documented and stable
  • No new network calls without --refresh

Context

Filed during architecture review for downstream issue tamirdresher_microsoft/squad-squad#1 ("Coordinator-level in-chat upgrade UX"). The downstream coordinator currently has to resolve OS-specific cache paths via a node one-liner inside coordinator instructions — a CLI command would eliminate that fragility.

Activity

  1. omercangumus commented on Jul 3, 2026

    @omercangumus
    Contributor

    I'll take this one.

    Plan: add a new squad update-check [--json] [--refresh] command in packages/squad-cli/src/cli/commands/update-check.ts that reads the existing update-check.json cache maintained by self-update.ts (exporting getCachePath/fetchLatestVersion/writeCache from there for reuse) rather than duplicating the OS-specific cache path logic. It reports current/channel/latest/updateAvailable/cacheAge/checkedAt matching the schema in the issue description — release channel is derived from the current version's prerelease tag (stable/preview/insider), and cacheAge is formatted as an ISO 8601 duration (e.g. PT2H15M).

    Without --refresh it only reads the cache (no network call, per the acceptance criteria) and reports "no cache yet" if none exists. With --refresh it bypasses the cache and re-fetches from npm. Exit codes: 0 (up to date / no cache), 1 (update available), 2 (transport failure during --refresh). Honors SQUAD_NO_UPDATE_CHECK=1 for a silent no-op.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triagedIssue has been triagedwave:2-soonWave 2 — next 2-4 weeks

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions