* build(macos): 校验打包产物声明语音识别用途 build-mac.sh 已在校验 NSMicrophoneUsageDescription 与 audio-input entitlement,但 Apple Speech provider 引入的 NSSpeechRecognitionUsage- Description 没有对应护栏。该 key 一旦缺失,构建静默成功,而选择 apple-speech 的用户会在调用 Speech.framework 时被 macOS TCC 以 SIGABRT 直接杀掉进程(崩溃报告 termination namespace = TCC)。 对打包产物 .app/Contents/Info.plist(而非源码 Info.plist)新增一行 PlistBuddy 校验:脚本开头的 set -euo pipefail 会让 key 缺失时非零退出、 当场中止构建。key 存在时输出被丢弃,行为与现在完全一致,产物逐字节不变。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(macos): enforce speech usage description contract * fix(macos): reject Unicode-only speech descriptions --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: sim <sim@local>
21 lines
473 B
Bash
Executable File
21 lines
473 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
PLIST_PATH="${1:-}"
|
|
if [ -z "$PLIST_PATH" ]; then
|
|
echo "usage: $0 <Info.plist>" >&2
|
|
exit 2
|
|
fi
|
|
|
|
DESCRIPTION=$(/usr/bin/plutil \
|
|
-extract NSSpeechRecognitionUsageDescription raw \
|
|
-expect string \
|
|
-o - \
|
|
-- "$PLIST_PATH")
|
|
|
|
if ! node -e 'process.exit(process.argv[1].trim().length === 0 ? 1 : 0)' -- "$DESCRIPTION"; then
|
|
echo "NSSpeechRecognitionUsageDescription must be a non-empty string in $PLIST_PATH" >&2
|
|
exit 1
|
|
fi
|