From 9eae05406d99e51d31f592ef3117afa59228e235 Mon Sep 17 00:00:00 2001 From: David Mann Date: Thu, 3 Dec 2026 07:38:40 +0100 Subject: [PATCH] packaging(macos): ship materialcraft-cli inside MaterialCraft.app The ArtCraft Launcher registers `-cli mcp` for agents only when the CLI sits next to the app; the stable .app held only the GUI. Copy the CLI to Contents/MacOS/materialcraft-cli and sign it as the standalone CLI is, before the app's executable and the bundle are sealed. Nightly stays GUI-only (nightly-lib.sh checks that). Refs #356 Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- packaging/macos/package.sh | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fd9a76299..46132dd5c 100644 --- a/README.md +++ b/README.md @@ -215,7 +215,7 @@ are in [`AGENTS.md`](AGENTS.md). Every bundled asset is listed with its licence | Build | File | Notes | |---|---|---| | App, universal (Apple silicon + Intel) | `materialcraft--macos-universal.dmg` | Signed and notarized | -| Command-line tool, universal | `materialcraft-cli--macos-universal.zip` | Signed and notarized | +| Command-line tool, universal | `materialcraft-cli--macos-universal.zip` | Signed and notarized; the app also carries it as `MaterialCraft.app/Contents/MacOS/materialcraft-cli` | ### Linux diff --git a/packaging/macos/package.sh b/packaging/macos/package.sh index 37f226ca0..48630617b 100755 --- a/packaging/macos/package.sh +++ b/packaging/macos/package.sh @@ -2,6 +2,7 @@ # Build, sign and (optionally) notarize the macOS release artifacts: # # $DIST/materialcraft--macos-.dmg MaterialCraft.app on a drag-to-Applications DMG +# (the CLI inside too: Contents/MacOS/materialcraft-cli) # $DIST/materialcraft-cli--macos-.zip the headless CLI # # Usage: packaging/macos/package.sh [--arch universal|aarch64|x86_64] [--skip-build] @@ -102,6 +103,9 @@ echo "==> assembling $APP" mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources" # Executable and icon carry the display name (CFBundleExecutable / CFBundleIconFile). cp "$WORK/bin/materialcraft" "$APP/Contents/MacOS/MaterialCraft" +# The CLI too, beside the app's executable: the ArtCraft Launcher finds `materialcraft-cli` next to it +# and registers `materialcraft-cli mcp` for agents, which starts the app beside it when it is closed. +cp "$WORK/bin/materialcraft-cli" "$APP/Contents/MacOS/materialcraft-cli" cp "$ROOT/assets/app-icon/materialcraft.icns" "$APP/Contents/Resources/MaterialCraft.icns" sed -e "s/@VERSION@/$VERSION/g" -e "s/@SHORT_VERSION@/$SHORT_VERSION/g" \ -e "s/@BUILD_SHA@/${MATERIALCRAFT_BUILD_SHA:-unknown}/g" \ @@ -112,7 +116,9 @@ printf 'APPL????' >"$APP/Contents/PkgInfo" copy_docs "$APP/Contents/Resources" # Sign inside-out: nested code first, then the bundle itself (no --deep on the final signature). -# Today the only nested code is the main executable; frameworks/helpers would be signed here too. +# The bundled CLI is nested executable code, signed as the standalone CLI is (its own identifier, +# hardened runtime), before the app's executable and the bundle are sealed. +sign --options runtime --identifier ai.storyteller.materialcraft-cli "$APP/Contents/MacOS/materialcraft-cli" sign --options runtime --entitlements "$HERE/entitlements.plist" "$APP/Contents/MacOS/MaterialCraft" sign --options runtime --entitlements "$HERE/entitlements.plist" "$APP" codesign --verify --strict --deep --verbose=2 "$APP"