Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,59 @@ desktop-release-build target="aarch64-apple-darwin":
pnpm install
cd {{desktop_dir}} && pnpm tauri build --features mesh-llm --target {{target}}

# Build a release Buzz.app from this checkout and launch it IN PLACE OF the
# installed app. Release builds use the stock `xyz.block.buzz.app` identifier,
# the `buzz-desktop` keyring, and the `~/.buzz` nest — so this opens with your
# real identity, communities, and managed agents, just running your code.
#
# Every `tauri dev` recipe (`dev`, `staging`, `production`, `desktop-standalone`)
# is a debug build and is hardwired to the dev stores (`app_state_keyring.rs`,
# `managed_agents/nest.rs`, `scripts/instance-env.sh`); none of them can reach
# prod state. This is the only recipe that does. Unsigned, macOS only, no mesh
# (`just mesh=1 desktop-release-run` to include it). The installed Buzz is quit
# first because tauri-plugin-single-instance would otherwise forward the launch
# to it; reopen /Applications/Buzz.app when you're done testing.

# Build an unsigned release Buzz.app from this checkout and run it with your installed app's identity, communities, and agents (macOS)
desktop-release-run: _ensure-sidecar-stubs
#!/usr/bin/env bash
set -euo pipefail
if [[ "$(uname -s)" != "Darwin" ]]; then
echo "desktop-release-run: macOS only (launches a .app bundle)" >&2
exit 1
fi
export PATH="{{justfile_directory()}}/bin:$PATH"
cargo build --release -p buzz-acp -p buzz-agent -p buzz-backend-kubernetes -p buzz-dev-mcp -p buzz-cli -p git-credential-nostr
TARGET=$(rustc -vV | sed -n 's|host: ||p')
TARGET_DIR=$(cargo metadata --format-version 1 --no-deps | node -p "JSON.parse(require('fs').readFileSync(0, 'utf8')).target_directory")
for bin in buzz-acp buzz-agent buzz-backend-kubernetes buzz-dev-mcp git-credential-nostr buzz; do
cp "${TARGET_DIR}/release/${bin}" "desktop/src-tauri/binaries/${bin}-${TARGET}"
chmod 755 "desktop/src-tauri/binaries/${bin}-${TARGET}"
done
cd {{desktop_dir}}
[[ -d node_modules ]] || pnpm install
FEATURES=(); [[ -n "{{mesh}}" ]] && FEATURES=(--features mesh-llm)
# Must NOT pass --config: the stock tauri.conf.json identifier is what maps
# this build onto the installed app's state.
pnpm tauri build --no-sign --bundles app ${FEATURES[@]+"${FEATURES[@]}"}
APP="${TARGET_DIR}/release/bundle/macos/Buzz.app"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Read the bundle from the Tauri target directory

TARGET_DIR comes from cargo metadata executed at the repository root, so without an explicit CARGO_TARGET_DIR it resolves to <repo>/target. The desktop crate is excluded from that workspace, and pnpm tauri build runs in its separate workspace under desktop/src-tauri, producing the app at <repo>/desktop/src-tauri/target/release/bundle/macos/Buzz.app. Consequently, on a normal macOS checkout the subsequent defaults read targets a nonexistent bundle and the new recipe fails after completing the release build instead of launching the app.

Useful? React with 👍 / 👎.

BUNDLE_ID=$(defaults read "$APP/Contents/Info.plist" CFBundleIdentifier)
if [[ "$BUNDLE_ID" != "xyz.block.buzz.app" ]]; then
echo "desktop-release-run: unexpected bundle identifier $BUNDLE_ID; refusing to launch" >&2
exit 1
fi
if pgrep -xq buzz-desktop; then
echo "Quitting the running Buzz so this build can own xyz.block.buzz.app ..."
osascript -e 'quit app id "xyz.block.buzz.app"' || true
for _ in $(seq 1 60); do pgrep -xq buzz-desktop || break; sleep 0.5; done
if pgrep -xq buzz-desktop; then
echo "desktop-release-run: Buzz is still running; quit it and re-run, or open $APP manually" >&2
exit 1
fi
fi
echo "Launching $APP ($(git rev-parse --short HEAD)) against your installed-app state"
open "$APP"

# Run desktop checks suitable for CI / pre-push
desktop-ci: desktop-check desktop-test desktop-tauri-fmt-check desktop-build desktop-tauri-check desktop-tauri-test

Expand Down
Loading