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:
2026-10-27 23:38:43 +08:00
parent cac85402a3
commit 6f8f436987
5 changed files with 488 additions and 3 deletions
+13 -1
View File
@@ -4,10 +4,22 @@ import PackageDescription
let package = Package(
name: "Kapture",
platforms: [.macOS(.v13)],
products: [
.executable(name: "Kapture", targets: ["Kapture"]),
// Command-line client for agents and scripts; talks to the running
// menu-bar app over distributed notifications (no extra permissions).
// Named kapture-cli because "Kapture" and "kapture" collide on the
// case-insensitive filesystem; the cask installs it as `kapture`.
.executable(name: "kapture-cli", targets: ["KaptureCLI"]),
],
targets: [
.executableTarget(
name: "Kapture",
path: "Sources/Kapture"
)
),
.executableTarget(
name: "KaptureCLI",
path: "Sources/KaptureCLI"
),
]
)