Add a kapture CLI so agents can capture windows and screens
kapture capture --app <name> (or --window-id / --screen) writes a PNG and prints its path; kapture list enumerates on-screen windows. The CLI is a thin client: requests go to the running menu-bar app over distributed notifications plus JSON files in Application Support, so captures use the app's Screen Recording grant and its window/display logic — no second permission. The app launches automatically when needed, and the bundled CLI opens its own app bundle rather than a stale installed copy. Built as `kapture-cli` (Kapture/kapture collide on the case-insensitive filesystem), signed nested in the app bundle, and installed on PATH as `kapture` by the Homebrew cask's binary stanza. Generated with OpenCode Assisted-by: Kimi:k3
This commit is contained in:
+9
-2
@@ -89,6 +89,9 @@ fi
|
||||
rm -rf "$APP"
|
||||
mkdir -p "$APP/Contents/MacOS"
|
||||
cp "$BIN" "$APP/Contents/MacOS/Kapture"
|
||||
# CLI client for agents/scripts; installed on PATH as `kapture` by the
|
||||
# Homebrew cask (binary target: kapture).
|
||||
cp ".build/release/kapture-cli" "$APP/Contents/MacOS/kapture-cli"
|
||||
|
||||
cat > "$APP/Contents/Info.plist" <<'PLIST'
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
@@ -108,9 +111,9 @@ cat > "$APP/Contents/Info.plist" <<'PLIST'
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>Icon</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.11.3</string>
|
||||
<string>1.12.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>113</string>
|
||||
<string>120</string>
|
||||
<key>LSUIElement</key>
|
||||
<true/>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
@@ -124,9 +127,13 @@ PLIST
|
||||
chmod +x scripts/make-icon.sh
|
||||
./scripts/make-icon.sh
|
||||
|
||||
# Nested executable: sign it explicitly so the bundle seal and notarization
|
||||
# see a Developer ID signature rather than SwiftPM's ad-hoc one.
|
||||
if [ -n "$SIGN_KEYCHAIN" ]; then
|
||||
codesign --force --options runtime --sign "$CERT" --keychain "$SIGN_KEYCHAIN" "$APP/Contents/MacOS/kapture-cli"
|
||||
codesign --force --options runtime --sign "$CERT" --keychain "$SIGN_KEYCHAIN" "$APP"
|
||||
else
|
||||
codesign --force --sign "$CERT" "$APP/Contents/MacOS/kapture-cli"
|
||||
codesign --force --sign "$CERT" "$APP"
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user