-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake-app.sh
More file actions
executable file
·99 lines (85 loc) · 3.69 KB
/
Copy pathmake-app.sh
File metadata and controls
executable file
·99 lines (85 loc) · 3.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/zsh
# Builds GlassTerm in release mode and assembles GlassTerm.app
# (including the Finder Sync extension for “Ouvrir GlassTerm ici”).
set -e
cd "$(dirname "$0")"
swift build -c release
APP="build/GlassTerm.app"
APPEX_ID="com.charles.glassterm.finder"
rm -rf "$APP"
mkdir -p "$APP/Contents/MacOS" \
"$APP/Contents/Resources/bin" \
"$APP/Contents/Resources/shell/zsh" \
"$APP/Contents/PlugIns/GlassTermFinder.appex/Contents/MacOS"
cp Info.plist "$APP/Contents/Info.plist"
cp .build/release/GlassTerm "$APP/Contents/MacOS/GlassTerm"
cp .build/release/glassterm-ai "$APP/Contents/Resources/bin/glassterm-ai"
cp .build/release/term-settings "$APP/Contents/Resources/bin/term-settings"
cp Resources/AppIcon.icns "$APP/Contents/Resources/AppIcon.icns"
cp Resources/shell/zsh/.zprofile "$APP/Contents/Resources/shell/zsh/.zprofile"
cp Resources/shell/zsh/.zshrc "$APP/Contents/Resources/shell/zsh/.zshrc"
# ── Finder Sync extension ─────────────────────────────────────────────
SDK="$(xcrun --sdk macosx --show-sdk-path)"
# Prefer native Apple Silicon even when this shell runs under Rosetta.
if arch -arm64 true 2>/dev/null; then
TARGET="arm64-apple-macos26.0"
SWIFT_ARCH=(arch -arm64)
else
TARGET="x86_64-apple-macos26.0"
SWIFT_ARCH=()
fi
APPEX="$APP/Contents/PlugIns/GlassTermFinder.appex"
cp Resources/GlassTermFinder/Info.plist "$APPEX/Contents/Info.plist"
printf 'XPC!' > "$APPEX/Contents/PkgInfo"
# -parse-as-library avoids a Swift `_main` so the appex entry is NSExtensionMain.
"${SWIFT_ARCH[@]}" xcrun swiftc -O \
-parse-as-library \
-module-name GlassTermFinder \
-target "$TARGET" \
-sdk "$SDK" \
-framework FinderSync \
-framework Cocoa \
-framework Foundation \
-Xlinker -e -Xlinker _NSExtensionMain \
-o "$APPEX/Contents/MacOS/GlassTermFinder" \
Sources/GlassTermFinder/FinderSync.swift
chmod +x "$APP/Contents/Resources/bin/term-settings" \
"$APP/Contents/Resources/bin/glassterm-ai" \
"$APPEX/Contents/MacOS/GlassTermFinder"
# Sign innermost first; do NOT --deep on the app (that overwrites the appex id).
codesign --force --sign - \
--identifier "$APPEX_ID" \
--enforce-adhoc-binary-validation=none \
"$APPEX" 2>/dev/null \
|| codesign --force --sign - --identifier "$APPEX_ID" "$APPEX"
codesign --force --sign - \
--identifier "com.charles.glassterm" \
"$APP"
# Register with Launch Services + pluginkit, then enable.
LSREGISTER="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister"
"$LSREGISTER" -f "$APP" 2>/dev/null || true
pluginkit -a "$APPEX" 2>/dev/null || true
pluginkit -e use -i "$APPEX_ID" 2>/dev/null || true
# Install Finder Quick Actions (Services) — visible without toggling extensions.
SERVICES_DIR="$HOME/Library/Services"
mkdir -p "$SERVICES_DIR"
install_service() {
local name="$1"
local src="$2"
local dest="$SERVICES_DIR/$name.workflow"
rm -rf "$dest"
mkdir -p "$dest/Contents"
cp "$src/Info.plist" "$dest/Contents/Info.plist"
cp "$src/document.wflow" "$dest/Contents/document.wflow"
}
install_service "Ouvrir GlassTerm ici" "Resources/FinderService"
# fcc-claude Quick Action (Terminal.app via AppleScript — proven Claude Code pattern).
python3 Resources/FinderService-fcc-claude/build.py
/System/Library/CoreServices/pbs -flush 2>/dev/null || true
echo "OK: $APP"
echo ""
echo "Finder — Actions rapides :"
echo " • Ouvrir GlassTerm ici"
echo " • Ouvrir fcc-claude ici (GlassTerm → cd + fcc-claude)"
echo " (clic droit → Actions rapides → Personnaliser… si besoin)"
echo "Extension Finder Sync : signature Developer ID requise pour le menu principal"