Skip to content

Commit 75a41a3

Browse files
chore: package the goose binary in the goose2 tauri app (#8615)
Co-authored-by: Lifei Zhou <lifei@squareup.com>
1 parent bd14186 commit 75a41a3

File tree

21 files changed

+857
-519
lines changed

21 files changed

+857
-519
lines changed

.github/workflows/goose2-ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ jobs:
111111
- name: Build frontend
112112
run: pnpm build
113113

114+
- name: Mock goose binary
115+
working-directory: .
116+
run: mkdir -p target/release && touch target/release/goose-$(rustc --print host-tuple)
117+
114118
- name: Check Tauri
115119
run: cd src-tauri && cargo check
116120

@@ -167,6 +171,10 @@ jobs:
167171
ui/goose2/src-tauri/target
168172
key: ${{ runner.os }}-goose2-cargo-${{ hashFiles('ui/goose2/src-tauri/Cargo.lock') }}
169173

174+
- name: Mock goose binary
175+
working-directory: .
176+
run: mkdir -p target/release && touch target/release/goose-$(rustc --print host-tuple)
177+
170178
- name: Format check
171179
run: cd src-tauri && cargo fmt --check
172180

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
members = [
33
"crates/*",
44
# Mainly for cargo-machete to not error out during inspection.
5-
"vendor/v8"
5+
"vendor/v8",
66
]
77
exclude = ["ui/goose2/src-tauri"]
88
resolver = "2"

Justfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,3 +484,8 @@ build-test-tools:
484484
record-mcp-tests: build-test-tools
485485
GOOSE_RECORD_MCP=1 cargo test --package goose --test mcp_integration_test
486486
git add crates/goose/tests/mcp_replays/
487+
488+
bundle-goose2:
489+
cargo build --release --package goose-cli --bin goose
490+
cp target/release/goose target/release/goose-$(rustc --print host-tuple)
491+
@just goose2::bundle

ui/goose2/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@ Goose2 is a Tauri 2 + React 19 desktop app.
88
bash/zsh: `source ./bin/activate-hermit`
99
fish: `source ./bin/activate-hermit.fish`
1010
2. Install git hooks: `lefthook install`
11-
3. Install dependencies: `just setup`
11+
3. Prepare workspace dependencies: `just setup`
1212
4. Start the app: `just dev`
1313

1414
`just clean` removes Rust build artifacts, `dist`, and `node_modules`. Run `just setup` again before `just dev`.
1515

16-
`just setup` bootstraps a shared managed goose checkout in a home-level cache directory when it does not exist, fast-forwards it, builds a local `goose` binary, and stamps the exact branch/commit it used. `just dev` only does a lightweight preflight against that shared stamp; if the managed checkout is missing, stale, or built from the wrong branch, it warns and tells you to rerun `just setup`. By default the helper uses `~/Library/Caches/goose2-dev` on macOS, or `$XDG_CACHE_HOME/goose2-dev` / `~/.cache/goose2-dev` elsewhere. It prefers `origin/baxen/goose2` and falls back to `origin/main` when that branch does not exist yet.
17-
18-
Override the shared cache root or branch with `GOOSE_DEV_ROOT=/path/to/cache` and `GOOSE_DEV_BRANCH=my/integration-branch`. You can also override the checkout path directly with `GOOSE_DEV_REPO=/path/to/goose`, or the clone source with `GOOSE_DEV_CLONE_URL=...`.
16+
`just setup` installs UI workspace dependencies, builds the SDK package, and builds the local debug `goose` CLI binary. `just dev` exports `GOOSE_BIN` to that local binary and loads `src-tauri/tauri.dev.conf.json`, which clears the production `externalBin` requirement during development.
1917

2018
Run `just` to list available commands, or see [justfile](./justfile) for the full recipe definitions.
2119

ui/goose2/justfile

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ default:
1010

1111
# Install dependencies and build workspace packages
1212
setup:
13-
pnpm install
13+
cd ../ && pnpm install
1414
cd ../sdk && pnpm build
15-
cd src-tauri && cargo build
15+
cargo build --manifest-path ../../Cargo.toml -p goose-cli --bin goose
1616

1717
# ── Build & Check ────────────────────────────────────────────
1818

@@ -50,6 +50,9 @@ tauri-check:
5050
# Full CI gate
5151
ci: check clippy test build tauri-check
5252

53+
bundle:
54+
pnpm tauri build
55+
5356
# ── Test ─────────────────────────────────────────────────────
5457

5558
# Run unit/component tests
@@ -82,7 +85,9 @@ dev:
8285
VITE_PORT={{ vite_port }}
8386
export VITE_PORT
8487
PROJECT_DIR=$(pwd)
85-
TAURI_CONFIG="{\"build\":{\"devUrl\":\"http://localhost:${VITE_PORT}\",\"beforeDevCommand\":{\"script\":\"cd ${PROJECT_DIR} && exec pnpm exec vite --port ${VITE_PORT} --strictPort\",\"cwd\":\".\",\"wait\":false}}}"
88+
GOOSE_BIN="${PROJECT_DIR}/../../target/debug/goose"
89+
export GOOSE_BIN
90+
EXTRA_CONFIG_ARGS=(--config "{\"build\":{\"devUrl\":\"http://localhost:${VITE_PORT}\",\"beforeDevCommand\":{\"script\":\"cd ${PROJECT_DIR} && exec pnpm exec vite --port ${VITE_PORT} --strictPort\",\"cwd\":\".\",\"wait\":false}}}")
8691

8792
# In worktrees, generate a labeled icon so you can tell instances apart
8893
if git rev-parse --is-inside-work-tree &>/dev/null; then
@@ -97,12 +102,12 @@ dev:
97102

98103
if swift scripts/generate-dev-icon.swift src-tauri/icons/icon.icns "$DEV_ICON" "$WORKTREE_LABEL"; then
99104
echo "🌳 Worktree: ${WORKTREE_LABEL}"
100-
TAURI_CONFIG=$(python3 -c "import json,sys; a=json.loads(sys.argv[1]); a['bundle']={'icon':['$DEV_ICON']}; print(json.dumps(a))" "$TAURI_CONFIG")
105+
EXTRA_CONFIG_ARGS+=(--config "{\"bundle\":{\"icon\":[\"$DEV_ICON\"]}}")
101106
fi
102107
fi
103108
fi
104109

105-
pnpm tauri dev --features app-test-driver --config "$TAURI_CONFIG"
110+
pnpm tauri dev --features app-test-driver --config src-tauri/tauri.dev.conf.json "${EXTRA_CONFIG_ARGS[@]}"
106111

107112
# Start the desktop app with dev config
108113
dev-debug:
@@ -111,7 +116,10 @@ dev-debug:
111116

112117
VITE_PORT={{ vite_port }}
113118
export VITE_PORT
114-
EXTRA_CONFIG="--config {\"build\":{\"devUrl\":\"http://localhost:${VITE_PORT}\",\"beforeDevCommand\":{\"script\":\"exec ./node_modules/.bin/vite --port ${VITE_PORT} --strictPort\",\"cwd\":\"..\",\"wait\":false}}}"
119+
PROJECT_DIR=$(pwd)
120+
GOOSE_BIN="${PROJECT_DIR}/../../target/debug/goose"
121+
export GOOSE_BIN
122+
EXTRA_CONFIG_ARGS=(--config "{\"build\":{\"devUrl\":\"http://localhost:${VITE_PORT}\",\"beforeDevCommand\":{\"script\":\"exec ./node_modules/.bin/vite --port ${VITE_PORT} --strictPort\",\"cwd\":\"..\",\"wait\":false}}}")
115123

116124
# In worktrees, generate a labeled icon so you can tell instances apart
117125
if git rev-parse --is-inside-work-tree &>/dev/null; then
@@ -126,12 +134,12 @@ dev-debug:
126134

127135
if swift scripts/generate-dev-icon.swift src-tauri/icons/icon.icns "$DEV_ICON" "$WORKTREE_LABEL"; then
128136
echo "🌳 Worktree: ${WORKTREE_LABEL}"
129-
EXTRA_CONFIG="$EXTRA_CONFIG --config {\"bundle\":{\"icon\":[\"$DEV_ICON\"]}}"
137+
EXTRA_CONFIG_ARGS+=(--config "{\"bundle\":{\"icon\":[\"$DEV_ICON\"]}}")
130138
fi
131139
fi
132140
fi
133141

134-
pnpm tauri dev --config src-tauri/tauri.dev.conf.json $EXTRA_CONFIG
142+
pnpm tauri dev --config src-tauri/tauri.dev.conf.json "${EXTRA_CONFIG_ARGS[@]}"
135143

136144
# Start only the frontend dev server
137145
dev-frontend:
@@ -166,8 +174,3 @@ clean:
166174
cd src-tauri && cargo clean
167175
rm -rf dist
168176
rm -rf node_modules
169-
170-
# Cherry-pick commits from the goose2 repo into ui/goose2/
171-
cherry-pick-goose2 *ARGS:
172-
git fetch goose2
173-
git format-patch -1 {{ARGS}} --stdout | git am --directory=ui/goose2

ui/goose2/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@
6565
"@tailwindcss/typography": "^0.5.19",
6666
"@tanstack/react-query": "^5.90.21",
6767
"@tauri-apps/api": "^2",
68-
"@tauri-apps/plugin-dialog": "~2.6.0",
68+
"@tauri-apps/plugin-dialog": "~2.7.0",
6969
"@tauri-apps/plugin-opener": "^2.5.3",
70+
"@tauri-apps/plugin-shell": "~2.3.5",
7071
"@xyflow/react": "^12.10.2",
7172
"ai": "^6.0.142",
7273
"ansi-to-react": "^6.2.6",

0 commit comments

Comments
 (0)