fix(hooks): ensure notification fallback on terminal-notifier failure

This commit is contained in:
YeonGyu-Kim
2026-03-03 00:30:34 +09:00
parent e461c81cec
commit b8d13c8b5f
2 changed files with 69 additions and 5 deletions
+8 -5
View File
@@ -44,12 +44,15 @@ export async function sendSessionNotification(
const terminalNotifierPath = await getTerminalNotifierPath()
if (terminalNotifierPath) {
const bundleId = process.env.__CFBundleIdentifier
const args = [terminalNotifierPath, "-title", title, "-message", message]
if (bundleId) {
args.push("-activate", bundleId)
try {
if (bundleId) {
await ctx.$`${terminalNotifierPath} -title ${title} -message ${message} -activate ${bundleId}`
} else {
await ctx.$`${terminalNotifierPath} -title ${title} -message ${message}`
}
break
} catch {
}
await ctx.$`${args}`.catch(() => {})
break
}
// Fallback: osascript (click may open Finder instead of terminal)