Skip to content

feat: add auto-update check with 24-hour caching#11

Merged
joelhooks merged 1 commit into
mainfrom
swarm/auto-update-check
Feb 2, 2026
Merged

feat: add auto-update check with 24-hour caching#11
joelhooks merged 1 commit into
mainfrom
swarm/auto-update-check

Conversation

@joelhooks
Copy link
Copy Markdown
Owner

Summary

Implements issue #10 - auto-update check for the CLI with intelligent caching.

Features:

  • Check GitHub releases API for newer versions on CLI startup
  • 24-hour cache to avoid API rate limits (stored in ~/.agent-secrets/update-check.json)
  • Background check (non-blocking, async)
  • --no-update-check flag for CI/automation environments
  • Display notification only in human mode

Implementation:

  • UpdateCheckCache struct with LatestVersion, CurrentVersion, CheckedAt, UpdateAvailable
  • LoadCache() / SaveCache() with atomic writes (temp file + sync + rename)
  • Modified CheckForUpdate() to use cache before hitting GitHub API
  • Wired to root command via PersistentPreRunE

Test plan

  • go test ./internal/update/... - 5 test functions all pass
  • go build ./... - compiles cleanly
  • Manual test: run any command, verify no API call on second run within 24h

Closes #10

🤖 Generated with Claude Code

- Add UpdateCheckCache struct and cache persistence (update-check.json)
- Implement 24-hour cache TTL to avoid hitting GitHub API on every run
- Wire up CheckForUpdateInBackground() to root command startup
- Add --no-update-check flag for CI environments
- Add comprehensive tests for cache loading, saving, and expiration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@joelhooks joelhooks merged commit 8811cd5 into main Feb 2, 2026
1 of 3 checks passed
@joelhooks joelhooks deleted the swarm/auto-update-check branch February 2, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Auto-update check with HATEOAS action

1 participant