Skip to content

fix(atelier): fire version-drift hook on all atelier sessions#799

Merged
kys0213 merged 4 commits into
mainfrom
fix/cli-version-check-all-sessions
Jun 14, 2026
Merged

fix(atelier): fire version-drift hook on all atelier sessions#799
kys0213 merged 4 commits into
mainfrom
fix/cli-version-check-all-sessions

Conversation

@kys0213

@kys0213 kys0213 commented Jun 14, 2026

Copy link
Copy Markdown
Owner

atelier --version(설치 바이너리)이 플러그인 버전과 별개로 뒤처질 수 있어요. 이미 SessionStart 알림 hook(check-cli-version.sh)이 있었지만 두 겹 게이트 때문에 autopilot 프로젝트에서만 작동했어요:

  • 런타임 게이트: 스크립트가 github-autopilot.local.md 없으면 즉시 skip
  • 등록 게이트: hook 등록 자체가 setup 의 autopilot 모듈에 묶여 있음

그래서 정작 버전 드리프트가 가장 잦은 plugin-dev repo / git-only 사용자가 사각지대였어요. (이 repo 에서 설치본이 0.4.3 인데 플러그인은 0.5.3 이어도 아무 안내가 없던 게 그 증상)

무엇을

버전 드리프트 알림을 atelier 를 쓰는 모든 세션으로 넓히고, 등록 방식을 setup 시점 → 플러그인 직접 선언으로 바꿨어요. 이건 autopilot 관심사가 아니라 CLI 라이프사이클 관심사예요 — Step 0(ensure-binary)이 setup 시점을 보장하면, 이 hook 은 그 이후 드리프트를 알리는 한 쌍이에요.

어떻게

  • hooks/hooks.json (신규): SessionStart "*"check-cli-version.sh 를 플러그인이 직접 선언. 플러그인 활성화 시 자동 적용되고, \${CLAUDE_PLUGIN_ROOT}활성 플러그인 버전 경로로 해석돼 frozen-path 문제를 원천 차단해요. setup 등록이 필요 없어요.
  • hooks/check-cli-version.sh: 런타임 autopilot 게이트 제거. atelier 미설치면 무음 exit 0(미사용 환경 노이즈 방지). installed < plugin 일 때만 1줄 안내. (SessionStart stdout 은 세션 컨텍스트로 노출됨)
  • commands/setup.md: check-cli-version 의 setup 등록을 제거. guard-pr-base·protect-stagnation 은 autopilot 고유(opt-in)라 Step 2b 에 그대로.

확인 방법

3개 상태 수동 검증 (check-cli-version.sh):

  • 최신 (installed 0.5.3 == plugin 0.5.3) → 무음 ✅
  • 과거 (installed 0.5.3 < plugin 9.9.9, temp harness) → `atelier CLI 업데이트 필요: v0.5.3 → v9.9.9 ...` 출력 ✅
  • 미설치 (PATH 에 atelier 없음) → 무음 (line 31-33 가드) ✅
  • make validate-ci → 0 failed (21 invariants present), hooks.json 유효 JSON
  • plugin hook 자동 발견은 다음 버전 publish 후 `/reload-plugins` 가 `1 hook` 으로 보고하는지로 최종 확인 (메커니즘은 공식 plugin 문서로 확인됨)

별도 처리 (이 PR 범위 밖)

기존 setup 으로 ~/.claude/settings.json.sh hook 4종이 .../atelier/0.4.3/... frozen 경로로 등록된 사용자는, plugin-declared hook 과 command 문자열이 달라 dedup 되지 않아 둘 다 실행돼요. 레거시 SessionStart 항목 제거(및 frozen guard hook 들 갱신)는 setup 마이그레이션/환경 정리건으로 분리했어요.

🤖 Generated with Claude Code

김용성 and others added 4 commits June 14, 2026 18:08
SessionStart 버전 드리프트 알림 hook(check-cli-version.sh)이 두 겹 게이트로
autopilot 프로젝트에서만 작동해, 정작 드리프트가 잦은 plugin-dev/git-only
환경에서 침묵했다.

- check-cli-version.sh: 런타임 autopilot 게이트(github-autopilot.local.md
  체크) 제거 + atelier 미설치 시 무음 exit 0 (미사용 환경 노이즈 방지).
  설치 && installed < plugin 일 때만 1줄 안내.
- setup.md: 등록을 Step 2b(autopilot 모듈)에서 Step 0b(공통)로 이동.
  버전 드리프트는 autopilot 전용이 아니라 CLI 라이프사이클 관심사
  (Step 0 ensure-binary 와 한 쌍: setup 시점 보장 vs 이후 드리프트 알림).

미설치/최신/상위 무음, 과거 버전만 경고 — 3개 상태 수동 검증.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
…tup-registered

check-cli-version SessionStart hook 을 setup 시점 settings.json 등록 대신
플러그인이 hooks/hooks.json 으로 직접 선언하도록 전환.

- hooks/hooks.json: SessionStart "*" → check-cli-version.sh 선언.
  플러그인 활성화 시 자동 적용, ${CLAUDE_PLUGIN_ROOT} 가 활성 버전 경로로
  해석되어 frozen-path 문제 원천 차단.
- setup.md: 직전 커밋의 Step 0b(공통 등록) 제거 — 더 이상 setup 이 이 hook 을
  등록하지 않음. Step 0 ensure-binary 와의 관계만 주석으로 남김.

guard-pr-base/protect-stagnation 은 autopilot 고유(opt-in)라 setup 등록 유지.

NOTE: 기존 setup 으로 settings.json 에 frozen 경로 등록된 사용자는
plugin-declared hook 과 command 문자열이 달라 dedup 되지 않아 둘 다 실행됨.
레거시 SessionStart 항목 제거는 별도 마이그레이션.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
/simplify 4-angle 리뷰 후속:

- check-cli-version.sh: command -v atelier 검사를 최상단으로 이동(효율).
  hook 이 모든 세션에서 실행되므로 미설치 환경(다수)에서 plugin.json
  grep|head|sed 파이프라인·stdin 처리 전에 builtin 검사로 즉시 종료.
- setup.md Step 2b: 제거된 "Step 0b" 를 가리키던 dangling 참조 수정 →
  plugin-declared(hooks.json) 안내로 교정.
- setup.md Step 3: frozen 마이그레이션 표에서 check-cli-version 을
  "제거만(재등록 안 함)" 으로 변경. plugin-declared 로 대체됐는데 settings.json
  으로 재등록하면 SessionStart 이중 실행되던 모순 제거.
- tool-layer-boundary.md: hook 등록의 제3형식(plugin-declared hooks.json)을
  규칙에 명시 — 기존 "shim OR hook register" 이분법에서 hooks.json 이 위반으로
  오독되던 갭 보완.

Simplify findings (skipped):
- compare_semver 가 ensure-binary.sh 와 중복 — pre-existing 부트스트랩 shim
  (바이너리 부재 시 동작해야 해 CLI 위임 불가, 공유 sourcing 컨벤션 없음).
  이 PR 이 만들거나 악화시키지 않았고 dedup 은 범위 밖.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
hooks.json 의 SessionStart command 를 escaped-quote 형태에서 bare 형태로 통일.

이전: "\"${CLAUDE_PLUGIN_ROOT}\"/hooks/check-cli-version.sh"
이후: "${CLAUDE_PLUGIN_ROOT}/hooks/check-cli-version.sh"

둘 다 shell form 으로 동작하지만(args 없음 → sh -c 해석), repo 전역이
bare 형태를 사용하고 tool-layer-boundary.md 규칙 line 49 의 이 스크립트
예시도 bare 라 일관성을 맞춤. plugin cache 경로는 공백이 없어 quote 불필요.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
@kys0213 kys0213 merged commit fd98b3b into main Jun 14, 2026
1 check passed
@kys0213 kys0213 deleted the fix/cli-version-check-all-sessions branch June 14, 2026 23:21
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.

1 participant