feat(self-update): Phase 1 — version check + upgrade notification · Refs #296 - #425
Merged
Merged
Conversation
…efs #296 Add `parsec self-update` subcommand that queries the GitHub releases API, compares the running version against the latest published release, and prints a cargo-install upgrade command when a newer version is available. ## Changes - src/cli/commands/update.rs (new): async fetch + semver compare + output - src/cli/commands/mod.rs: wire update module - src/cli/mod.rs: SelfUpdate command variant + run dispatch ## Implementation detail - Uses reqwest (already a dep) with 8 s timeout and a parsec/VERSION User-Agent - Numeric semver comparison handles 0.10.0 > 0.9.0 correctly (7 unit tests) - Gracefully degrades on network error (prints current version + releases URL) - Respects global --offline flag: skips network call, prints version only - Phase 2 will add in-place binary replacement (see issue #296) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
무엇
parsec self-update새 서브커맨드 추가 — GitHub releases API 에서 최신 버전을 조회해 현재 버전과 비교하고, 업데이트가 있으면cargo install업그레이드 명령을 출력합니다.Refs #296
왜
parsec에는 자체 업데이트 확인 기능이 없어 사용자가 최신 버전 여부를 수동으로 확인해야 했습니다. Phase 1 은 알림까지, Phase 2 에서 바이너리 자동 교체를 구현합니다.변경
src/cli/commands/update.rs(신규)self_update()async fn — releases API fetch, 숫자 semver 비교, 출력src/cli/commands/mod.rsupdate모듈 연결src/cli/mod.rsSelfUpdate {}Command 변형 + run dispatch + cmd_name핵심 구현
reqwest(기존 dep) — 8 초 타임아웃,parsec/VERSIONUser-Agent0.10.0 > 0.9.0정확히 처리 (문자열 비교 버그 없음)--offline글로벌 플래그 준수: 네트워크 스킵, 버전만 출력다음 Phase 힌트
Phase 2:
gh release download또는 HTTP 로 바이너리 다운로드 + 임시 파일 원자 교체 + checksum 검증리스크
low — 신규 독립 명령, 기존 코드 미변경, 새 외부 dep 없음, 네트워크 실패 graceful
롤백
브랜치 삭제로 완전 롤백 가능. 기존 명령 미영향.
Test plan
cargo build✓ /cargo fmt --check✓ /cargo clippy -D warnings✓ /cargo test185 passedparsec self-update --help로 도움말 확인@erishforG