feat(update): 업데이트 notice를 모든 명령에서 띄움 (whoami 전용 → 종료 chokepoint)#214
Merged
Conversation
"newer aitcc available" notice가 whoami에서만 떴다 — maybeCheckForUpdate가 whoami.ts에 인라인으로 박혀 있었다. probe를 단일 종료 chokepoint(exitAfterFlush)로 옮겨 모든 명령이 24h 스로틀 안에서 notice를 띄우게 한다. self-update는 변경 없음. 왜 citty cleanup 훅이 아닌가: 모든 명령이 exitAfterFlush → process.exit로 끝나 citty의 cleanup 단계 전에 프로세스가 종료된다(cleanup 훅은 영영 안 불림, 실측 확인). exitAfterFlush가 이 코드베이스의 진짜 "after any command" seam이다. - src/update-notice-hook.ts (신규): argv 기반 결정(--json 억제 + upgrade/ completion 제외) + 500ms-race·완전 방어적 probe. - src/flush.ts: exitAfterFlush가 process.exit 직전 runUpdateNoticeOnExit() await. - src/commands/whoami.ts: 인라인 runBackgroundUpdateCheck 제거(중복 발사 방지). 보존된 보장: non-TTY 침묵, --json 침묵, 500ms 상한, 절대 throw 안 함. 검증: flush.test.ts(exit 전 1회 호출, 결정적) + hook 15케이스 + 745 tests green. Closes #213
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.
무엇을
"newer aitcc available" 업데이트 notice가
whoami에서만 떴다 —aitcc app deploy·app status를 백 번 돌려도 안 보였다. probe를 단일 종료 chokepoint(exitAfterFlush)로 옮겨 모든 명령이 24h 스로틀 안에서 notice를 띄우게 한다. self-update 동작은 변경 없음(notify-only 유지).왜 citty
cleanup훅이 아니라exitAfterFlush인가처음엔 citty 루트
cleanup훅으로 했다가 실측으로 폐기했다: 이 코드베이스의 모든 명령은exitAfterFlush→process.exit(code)로 종료해서, citty의cleanup단계가 돌기 전에 프로세스가 끝난다. cleanup 훅은 영영 안 불린다(원래 whoami가 probe를return exitAfterFlush(...)직전 인라인으로 부른 이유가 바로 이것이다). 그래서 모든 명령이 반드시 지나는 단일 종료 chokepoint인 **exitAfterFlush**에 probe를 건다.변경
src/update-notice-hook.ts(신규)shouldRunUpdateNotice:--json억제 +upgrade/completion제외) + 500ms-race·완전 방어적 probe(runUpdateNoticeOnExit)src/flush.tsexitAfterFlush가process.exit직전에runUpdateNoticeOnExit()awaitsrc/commands/whoami.tsrunBackgroundUpdateCheck제거 — chokepoint가 커버, 중복 발사 방지보존된 보장 (whoami 시절과 동일)
maybeCheckForUpdate의isTTY게이트(agent/CI는 안 봄).--json침묵 — argv 스캔 belt-and-suspenders.upgrade/completion제외 — 각각 명시적 fetch 경로 / 셸 sourced 출력.검증
flush.test.ts—exitAfterFlush가 hook을 exit 전에 정확히 1회, 올바른 순서로 호출(결정적, TTY 에뮬레이션 비의존).update-notice-hook.test.ts— argv 결정 로직 15케이스(--json/--no-json/--json-pretty/upgrade/completion/no-subcommand).Closes #213