Skip to content

fix: auto-zoom-on-click broken by uiohook-napi packaging bug - #23

Merged
Alfredoalv13 merged 1 commit into
mainfrom
fix/uiohook-node-gyp-build-packaging
Jul 25, 2026
Merged

fix: auto-zoom-on-click broken by uiohook-napi packaging bug#23
Alfredoalv13 merged 1 commit into
mainfrom
fix/uiohook-node-gyp-build-packaging

Conversation

@Alfredoalv13

Copy link
Copy Markdown
Owner

Summary

  • Root-caused a bug reported by the user: recording (screen/audio/webcam) all worked, but the automatic zoom-in/zoom-out on click never triggered in the editor.
  • Cause: click-to-zoom depends on uiohook-napi's global input hook capturing real clicks during recording. Its compiled dist/index.js does require('node-gyp-build'), but electron-builder's dependency pruning silently dropped that transitive dependency from the packaged app.asar even though it's correctly declared in uiohook-napi's own package.json. The hook failed to load with Cannot find module 'node-gyp-build', so every cursor sample during a recording was type "move" — zero "click" samples — and the zoom-suggestion pipeline (which only looks at real click samples) had nothing to build zoom regions from.
  • Fix: declare node-gyp-build as a direct dependency and explicitly force it into electron-builder's files list, which reliably includes it.
  • Also normalizes electron-builder.json5 to consistent LF line endings (it had a CRLF/LF mix that made the one-line diff unreadable).

Test plan

  • npx tsc -p tsconfig.json --noEmit — clean
  • npx vitest --run — 819/819 passing
  • Built, signed, and ran the packaged app directly
  • Confirmed via console log: [CursorTelemetry] hook loaded: true (previously: Global interaction capture unavailable: Cannot find module 'node-gyp-build')
  • Simulated real clicks during an active recording and confirmed the .cursor.json sidecar recorded "click"/"mouseup" samples (previously 100% "move")

… load in the packaged app

The click-to-zoom feature relies on uiohook-napi's global input hook to
capture real mouse clicks during a recording. Its compiled dist/index.js
does `require('node-gyp-build')` to load its native addon, but
electron-builder's dependency pruning silently dropped that (correctly
declared) transitive dependency from the packaged app.asar, so the hook
never loaded - `[CursorTelemetry] Global interaction capture unavailable:
Cannot find module 'node-gyp-build'`. Screen/audio/webcam recording were
unaffected since they don't depend on this module, so the failure was easy
to miss.

Fixed by declaring node-gyp-build as a direct dependency and explicitly
forcing it into electron-builder's files list, which reliably gets it
included. Verified against a packaged build: cursor telemetry now records
real "click"/"mouseup" samples instead of only "move" samples.

Also normalizes electron-builder.json5 to consistent LF line endings - it
had a mix of CRLF/LF that made the diff for the one-line fix unreadable.
@Alfredoalv13
Alfredoalv13 merged commit ea5c34b into main Jul 25, 2026
1 check passed
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.

2 participants