Skip to content

feat(self-update): Phase 1 — version check + upgrade notification · Refs #296 - #425

Merged
erishforG merged 1 commit into
developfrom
feat/auto-296-self-update-phase1
Sep 5, 2026
Merged

feat(self-update): Phase 1 — version check + upgrade notification · Refs #296#425
erishforG merged 1 commit into
developfrom
feat/auto-296-self-update-phase1

Conversation

@erishforG

Copy link
Copy Markdown
Owner

무엇

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.rs update 모듈 연결
src/cli/mod.rs SelfUpdate {} Command 변형 + run dispatch + cmd_name

핵심 구현

  • reqwest (기존 dep) — 8 초 타임아웃, parsec/VERSION User-Agent
  • 숫자 semver 비교: 0.10.0 > 0.9.0 정확히 처리 (문자열 비교 버그 없음)
  • 네트워크 실패 시 graceful degrade (현재 버전 + releases URL 출력)
  • --offline 글로벌 플래그 준수: 네트워크 스킵, 버전만 출력
  • Phase 2: 바이너리 in-place 교체 (issue feat: parsec self-update + 새 버전 알림 #296)

다음 Phase 힌트

Phase 2: gh release download 또는 HTTP 로 바이너리 다운로드 + 임시 파일 원자 교체 + checksum 검증

리스크

low — 신규 독립 명령, 기존 코드 미변경, 새 외부 dep 없음, 네트워크 실패 graceful

롤백

브랜치 삭제로 완전 롤백 가능. 기존 명령 미영향.

Test plan

  • 7 개 단위 테스트 (숫자 semver 비교 경계값 포함)
  • cargo build ✓ / cargo fmt --check ✓ / cargo clippy -D warnings ✓ / cargo test 185 passed
  • parsec self-update --help 로 도움말 확인

@erishforG

…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>
@erishforG erishforG added the auto-improvement Daily auto-generated improvement PR/issue label Sep 5, 2026
@erishforG
erishforG merged commit bf75fda into develop Sep 5, 2026
12 checks passed
@erishforG
erishforG deleted the feat/auto-296-self-update-phase1 branch September 5, 2026 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-improvement Daily auto-generated improvement PR/issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant