chore: handle CwdChanged and FileChanged hook events (v2.1.83) #253

Closed
opened 2026-04-13 09:11:21 -07:00 by hikari · 1 comment
Owner

Context

Claude Code v2.1.83 added two new hook event types fired by the CLI:

  • CwdChanged — emitted when the working directory changes during a session
  • FileChanged — emitted when a file is modified during a session

These join the existing hook event set (e.g. ElicitationEvent, PostCompactEvent, StopFailureEvent) that we parse in wsl_bridge.rs.

Why This Matters

Currently serde will silently ignore these events since they're unknown variants, but we should explicitly model them so we can:

  1. Track working directory changes — useful for displaying the current CWD in the UI
  2. Potentially trigger a Coding or Typing character state on FileChanged
  3. Ensure future logic that depends on these events doesn't silently miss them

Tasks

  • Add CwdChanged and FileChanged variants to the hook event enum in src-tauri/src/types.rs
  • Decide whether to surface either event in the UI (e.g. CWD indicator, character state trigger)
  • Add parsing/handling in src-tauri/src/wsl_bridge.rs if the events should drive character state
  • Add tests for the new type variants

References

  • Claude Code v2.1.83 changelog
  • src-tauri/src/types.rs
  • src-tauri/src/wsl_bridge.rs

This issue was created with help from Hikari~ 🌸

## Context Claude Code v2.1.83 added two new hook event types fired by the CLI: - **`CwdChanged`** — emitted when the working directory changes during a session - **`FileChanged`** — emitted when a file is modified during a session These join the existing hook event set (e.g. `ElicitationEvent`, `PostCompactEvent`, `StopFailureEvent`) that we parse in `wsl_bridge.rs`. ## Why This Matters Currently `serde` will silently ignore these events since they're unknown variants, but we should explicitly model them so we can: 1. Track working directory changes — useful for displaying the current CWD in the UI 2. Potentially trigger a `Coding` or `Typing` character state on `FileChanged` 3. Ensure future logic that depends on these events doesn't silently miss them ## Tasks - [ ] Add `CwdChanged` and `FileChanged` variants to the hook event enum in `src-tauri/src/types.rs` - [ ] Decide whether to surface either event in the UI (e.g. CWD indicator, character state trigger) - [ ] Add parsing/handling in `src-tauri/src/wsl_bridge.rs` if the events should drive character state - [ ] Add tests for the new type variants ## References - Claude Code v2.1.83 changelog - `src-tauri/src/types.rs` - `src-tauri/src/wsl_bridge.rs` ✨ This issue was created with help from Hikari~ 🌸
Author
Owner

Resolved in PR #261. Added CwdChangedEvent and FileChangedEvent types in types.rs, parse functions in wsl_bridge.rs, and Tauri events claude:cwd-changed and claude:file-changed emitted on hook detection. Tests included.

Resolved in PR #261. Added `CwdChangedEvent` and `FileChangedEvent` types in `types.rs`, parse functions in `wsl_bridge.rs`, and Tauri events `claude:cwd-changed` and `claude:file-changed` emitted on hook detection. Tests included. ✨
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: nhcarrigan/hikari-desktop#253