From 31ec2d48e3a1296e5d782e3030a8fe3d5f3efd71 Mon Sep 17 00:00:00 2001 From: sameeeeeeep <191771413+sameeeeeeep@users.noreply.github.com> Date: Sun, 4 Oct 2026 03:52:50 +0530 Subject: [PATCH 1/6] notch card: readable JavaScript run by macOS's osascript, no compiled binary The directory scan flagged "ships code the scan can't read" (the Swift sb-card binary). helper/card.js replaces it: JavaScript for Automation with the AppKit bridge, run as /usr/bin/osascript -l JavaScript helper/card.js '', with the same JSON in/out contract, so register.js only changes its argv. Same card, pixel-matched to sb-card 0.1.4 (mean difference 0.04/255): Claude design language, drops from the notch or opens beside the pointer, numbered options with the recommendation highlighted, typed answer box, esc falls back to Claude Code's dialog, 540 s timeout, .transient + .fullScreenAuxiliary. Keyboard: the card appears as a background-only app and only then becomes an accessory app, refuses to become key until clicked, and hands activation back if macOS activates it anyway. (A test of the old sb-card showed it being handed activation and keystrokes when the app that started it was frontmost.) One click on an option answers; a click on the card enables 1-4/arrows/return/esc without focusing the text box; a click on the box types there. register.js also gains /notch companion cat|clawd|off (default off; clawd is a hidden placeholder). tests: 8 plugin tests; tests/card-selftest.sh drives the real card off-screen from inside its own process (no system-wide input). Co-Authored-By: Claude Opus 5.5 --- packages/notch-mod/helper/card.js | 599 ++++++++++++++++++++++ packages/notch-mod/helper/sb-card | Bin 775088 -> 0 bytes packages/notch-mod/helper/sb-card.swift | 266 ---------- packages/notch-mod/hooks/hooks.json | 2 +- packages/notch-mod/hooks/register.js | 44 +- packages/notch-mod/listing/render-card.js | 41 ++ packages/notch-mod/tests/card-selftest.js | 85 +++ packages/notch-mod/tests/card-selftest.sh | 29 ++ packages/notch-mod/tests/notch.test.ts | 68 ++- 9 files changed, 848 insertions(+), 286 deletions(-) create mode 100644 packages/notch-mod/helper/card.js delete mode 100755 packages/notch-mod/helper/sb-card delete mode 100644 packages/notch-mod/helper/sb-card.swift create mode 100644 packages/notch-mod/listing/render-card.js create mode 100644 packages/notch-mod/tests/card-selftest.js create mode 100644 packages/notch-mod/tests/card-selftest.sh diff --git a/packages/notch-mod/helper/card.js b/packages/notch-mod/helper/card.js new file mode 100644 index 0000000..91981e6 --- /dev/null +++ b/packages/notch-mod/helper/card.js @@ -0,0 +1,599 @@ +// Ask Notch card: one question as a native card at the Mac notch (or beside the pointer). +// +// Plain JavaScript for macOS's built-in script runner (JavaScript for Automation, with its bridge to +// AppKit). Nothing is compiled; this file is the whole program: +// +// /usr/bin/osascript -l JavaScript helper/card.js '' +// json: { title?, question, options:[{label, detail?, recommended?}], at?: "notch"|"cursor", +// source?, timeout?: seconds, appearance?: "light"|"dark", companion?: {name, dir}, +// debug?: true } (tests also use at: "offscreen", a window on no display) +// stdout: {"answer":"