VoiceInput/Makefile
JOJO 76741877a8 feat: 朗读功能、弹窗优化、Node.js 打包、Prompt 更新
- Assist/Agent 模式新增朗读开关 + NSSpeechSynthesizer 语音合成
- 朗读完成后弹窗延迟5秒带动画关闭(不再写死15/20秒)
- 打字模式下不自动关闭弹窗
- 二次输入时取消旧朗读/旧延迟关闭,避免竞争问题
- Agent 进度计时器第二次输入时正确归零
- DMG 打包自动清空 models.json API Key
- Node.js 运行时打包进 Agent/bin/,用户无需安装
- Agent system prompt 更新为 VoiceInput 身份 + 语音容错说明
- AGENTS.md 全面更新,补全 Agent 模式文档
2026-04-29 18:22:14 +08:00

102 lines
3.4 KiB
Makefile

# VoiceInput Makefile
# macOS 14+ 菜单栏语音输入应用
APP_NAME := VoiceInput
BUILD_DIR := .build
RELEASE_DIR := $(BUILD_DIR)/release
PRODUCT := $(RELEASE_DIR)/$(APP_NAME)
APP_BUNDLE := $(RELEASE_DIR)/$(APP_NAME).app
INSTALL_DIR := /Applications/$(APP_NAME).app
ENTITLEMENTS := Sources/Resources/VoiceInput.entitlements
.PHONY: all build run install clean debug release
all: build
# ============================================================
# Build
# ============================================================
build: debug
debug:
@echo "🔨 Building Debug..."
swift build -c debug --disable-sandbox
@echo "📦 Creating app bundle..."
@./scripts/create_app_bundle.sh debug
@echo "✅ Build complete: $(APP_BUNDLE)"
release:
@echo "🔨 Building Release..."
swift build -c release --disable-sandbox
@echo "📦 Creating app bundle..."
@./scripts/create_app_bundle.sh release
@echo "✅ Release build complete: $(APP_BUNDLE)"
# ============================================================
# Run
# ============================================================
run: debug
@echo "🚀 Launching..."
open $(APP_BUNDLE)
# ============================================================
# Install
# ============================================================
install: release
@echo "📥 Installing to $(INSTALL_DIR)..."
@if [ -d "$(INSTALL_DIR)" ]; then rm -rf "$(INSTALL_DIR)"; fi
cp -R $(APP_BUNDLE) $(INSTALL_DIR)
@echo "✅ Installed to $(INSTALL_DIR)"
# ============================================================
# Clean
# ============================================================
clean:
@echo "🧹 Cleaning..."
swift package clean
rm -rf $(RELEASE_DIR)
@echo "✅ Clean"
# ============================================================
# Entitlements
# ============================================================
entitlements: $(ENTITLEMENTS)
$(ENTITLEMENTS):
@mkdir -p Sources/Resources
@echo '<?xml version="1.0" encoding="UTF-8"?>' > $(ENTITLEMENTS)
@echo '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">' >> $(ENTITLEMENTS)
@echo '<plist version="1.0">' >> $(ENTITLEMENTS)
@echo '<dict>' >> $(ENTITLEMENTS)
@echo ' <key>com.apple.security.device.audio-input</key>' >> $(ENTITLEMENTS)
@echo ' <true/>' >> $(ENTITLEMENTS)
@echo ' <key>com.apple.security.cs.disable-library-validation</key>' >> $(ENTITLEMENTS)
@echo ' <true/>' >> $(ENTITLEMENTS)
@echo '</dict>' >> $(ENTITLEMENTS)
@echo '</plist>' >> $(ENTITLEMENTS)
# ============================================================
# Codesign (ad-hoc)
# ============================================================
sign: release
@echo "🔏 Signing..."
codesign --force --deep --sign - $(APP_BUNDLE)
@echo "✅ Signed (ad-hoc)"
# ============================================================
# DMG (分发)
# ============================================================
DMG_NAME := $(APP_NAME)-$(shell date +%Y%m%d).dmg
DMG_TMP := $(BUILD_DIR)/dmg_temp
dmg: sign
@echo "💿 Creating DMG..."
@rm -rf $(DMG_TMP) $(DMG_NAME)
@mkdir -p $(DMG_TMP)
@cp -R $(APP_BUNDLE) $(DMG_TMP)/
@echo '{"models":[],"default_model":"","tavily_api_key":""}' > $(DMG_TMP)/$(APP_NAME).app/Contents/Resources/Agent/models.json
@ln -s /Applications $(DMG_TMP)/Applications
@hdiutil create -volname "$(APP_NAME)" -srcfolder $(DMG_TMP) -ov -format UDZO "$(DMG_NAME)" > /dev/null 2>&1
@rm -rf $(DMG_TMP)
@echo "✅ DMG created: $(DMG_NAME)"