diff --git a/Justfile b/Justfile index 317541e2f49..3e4b6bee093 100644 --- a/Justfile +++ b/Justfile @@ -6,9 +6,10 @@ desktop_dir := "desktop" desktop_tauri_manifest := "desktop/src-tauri/Cargo.toml" web_dir := "web" -# Opt-in mesh-llm. Off by default so `just dev`/`just staging` skip ~420 extra -# crates + the llama.cpp native runtime build and stay fast to iterate on. -# Turn on to test mesh compute features: `just mesh=1 dev` / `just mesh=1 staging`. +# Opt-in mesh-llm. Off by default so `just dev`/`just staging`/`just production` +# skip ~420 extra crates + the llama.cpp native runtime build and stay fast to +# iterate on. Turn on to test mesh compute features: `just mesh=1 dev` / +# `just mesh=1 staging` / `just mesh=1 production`. mesh := "" # Reset only the current standalone desktop instance before launch. @@ -517,6 +518,33 @@ staging *ARGS: bootstrap _ensure-sidecar-stubs echo "Starting staging on Vite port ${BUZZ_VITE_PORT}, relay ${BUZZ_RELAY_URL}" pnpm exec tauri dev ${FEATURES[@]+"${FEATURES[@]}"} --config "$BUZZ_TAURI_CONFIG" {{ARGS}} +# Run the desktop app against the production relay (installs deps + builds agent tools automatically) +production *ARGS: bootstrap _ensure-sidecar-stubs + #!/usr/bin/env bash + set -euo pipefail + export PATH="{{justfile_directory()}}/bin:$PATH" + pnpm install # unconditional: production must always start with a clean dep tree + cargo build --release -p buzz-acp -p buzz-agent -p buzz-dev-mcp -p buzz-cli -p git-credential-nostr + FEATURES=() + if [[ -n "{{mesh}}" ]]; then + FEATURES=(--features mesh-llm) + export MESH_LLM_NATIVE_RUNTIME_CACHE_DIR="$(./scripts/ensure-mesh-native-runtime.sh)" + fi + # Replace the 0-byte sidecar stub with the real CLI binary so tauri dev picks it up. + 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") + cp "${TARGET_DIR}/release/buzz" "desktop/src-tauri/binaries/buzz-${TARGET}" + chmod +x "desktop/src-tauri/binaries/buzz-${TARGET}" + cd {{desktop_dir}} + export BUZZ_RELAY_URL="wss://buzz.block.builderlab.xyz" + source ../scripts/instance-env.sh + # Ctrl+C kills the Tauri app before its in-process sweep finishes, leaking + # agent workers. Reap this instance's agents on exit as a backstop. + INSTANCE_ID=$(node -e "console.log(JSON.parse(process.env.BUZZ_TAURI_CONFIG).identifier)") + trap '../scripts/cleanup-instance-agents.sh "$INSTANCE_ID" || true' EXIT + echo "Starting production on Vite port ${BUZZ_VITE_PORT}, relay ${BUZZ_RELAY_URL}" + pnpm exec tauri dev ${FEATURES[@]+"${FEATURES[@]}"} --config "$BUZZ_TAURI_CONFIG" {{ARGS}} + # Run the desktop frontend dev server (port derived from worktree) desktop-dev: #!/usr/bin/env bash