Skip to content

feat(update): 업데이트 notice를 모든 명령에서 띄움 (whoami 전용 → 종료 chokepoint)#214

Merged
DaveDev42 merged 1 commit into
mainfrom
feat/update-notice-all-commands
Jun 26, 2026
Merged

feat(update): 업데이트 notice를 모든 명령에서 띄움 (whoami 전용 → 종료 chokepoint)#214
DaveDev42 merged 1 commit into
mainfrom
feat/update-notice-all-commands

Conversation

@DaveDev42

Copy link
Copy Markdown
Contributor

무엇을

"newer aitcc available" 업데이트 notice가 whoami에서만 떴다 — aitcc app deploy·app status를 백 번 돌려도 안 보였다. probe를 단일 종료 chokepoint(exitAfterFlush)로 옮겨 모든 명령이 24h 스로틀 안에서 notice를 띄우게 한다. self-update 동작은 변경 없음(notify-only 유지).

왜 citty cleanup 훅이 아니라 exitAfterFlush인가

처음엔 citty 루트 cleanup 훅으로 했다가 실측으로 폐기했다: 이 코드베이스의 모든 명령은 exitAfterFlushprocess.exit(code)로 종료해서, citty의 cleanup 단계가 돌기 전에 프로세스가 끝난다. cleanup 훅은 영영 안 불린다(원래 whoami가 probe를 return exitAfterFlush(...) 직전 인라인으로 부른 이유가 바로 이것이다). 그래서 모든 명령이 반드시 지나는 단일 종료 chokepoint인 **exitAfterFlush**에 probe를 건다.

변경

파일 변경
src/update-notice-hook.ts (신규) argv 기반 결정(shouldRunUpdateNotice: --json 억제 + upgrade/completion 제외) + 500ms-race·완전 방어적 probe(runUpdateNoticeOnExit)
src/flush.ts exitAfterFlushprocess.exit 직전에 runUpdateNoticeOnExit() await
src/commands/whoami.ts 인라인 runBackgroundUpdateCheck 제거 — chokepoint가 커버, 중복 발사 방지

보존된 보장 (whoami 시절과 동일)

  • non-TTY 침묵maybeCheckForUpdateisTTY 게이트(agent/CI는 안 봄).
  • --json 침묵 — argv 스캔 belt-and-suspenders.
  • 500ms 상한 — cold probe는 종료를 안 늦추고 취소(다음 24h 내 재시도 안 함).
  • 절대 throw 안 함 — cleanup-phase throw가 명령 exit code를 가리지 않게.
  • upgrade/completion 제외 — 각각 명시적 fetch 경로 / 셸 sourced 출력.

검증

  • flush.test.tsexitAfterFlush가 hook을 exit 전에 정확히 1회, 올바른 순서로 호출(결정적, TTY 에뮬레이션 비의존).
  • update-notice-hook.test.ts — argv 결정 로직 15케이스(--json/--no-json/--json-pretty/upgrade/completion/no-subcommand).
  • 745 tests green · typecheck · lint · build 전부 통과.

Closes #213

"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
@DaveDev42
DaveDev42 merged commit b44792a into main Jun 26, 2026
1 check passed
@DaveDev42
DaveDev42 deleted the feat/update-notice-all-commands branch June 26, 2026 20:08
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.

update notice: surface on every command, not just whoami

1 participant