diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index 3012e238..d0956aff 100644 --- a/.github/workflows/build-cli.yml +++ b/.github/workflows/build-cli.yml @@ -48,8 +48,14 @@ jobs: sed -i.bak 's/^version = ".*"/version = "'${{ inputs.version }}'"/' Cargo.toml rm -f Cargo.toml.bak + - name: Setup Rust + uses: dtolnay/rust-toolchain@38b70195107dddab2c7bbd522bcf763bac00963b # pin@stable + with: + toolchain: stable + target: ${{ matrix.architecture }}-${{ matrix.target-suffix }} + - name: Install cross - run: source ./bin/activate-hermit && cargo install cross --git https://github.com/cross-rs/cross + run: cargo install cross --git https://github.com/cross-rs/cross - name: Build CLI env: @@ -58,7 +64,12 @@ jobs: RUST_BACKTRACE: 1 CROSS_VERBOSE: 1 run: | - source ./bin/activate-hermit + # Install protoc if on macOS + if [ "${{ matrix.os }}" = "macos-latest" ]; then + brew install protobuf + export PROTOC=$(which protoc) + fi + export TARGET="${{ matrix.architecture }}-${{ matrix.target-suffix }}" rustup target add "${TARGET}" echo "Building for target: ${TARGET}" diff --git a/.github/workflows/bundle-desktop-intel.yml b/.github/workflows/bundle-desktop-intel.yml index 8d614af2..e841ac31 100644 --- a/.github/workflows/bundle-desktop-intel.yml +++ b/.github/workflows/bundle-desktop-intel.yml @@ -85,16 +85,20 @@ jobs: # Update version in Cargo.toml sed -i.bak 's/^version = ".*"/version = "'${{ inputs.version }}'"/' Cargo.toml rm -f Cargo.toml.bak - - # Update version in package.json - source ./bin/activate-hermit + + # Update version in package.json cd ui/desktop npm version ${{ inputs.version }} --no-git-tag-version --allow-same-version + - name: Setup Rust + uses: dtolnay/rust-toolchain@38b70195107dddab2c7bbd522bcf763bac00963b # pin@stable + with: + toolchain: stable + targets: x86_64-apple-darwin + # Pre-build cleanup to ensure enough disk space - name: Pre-build cleanup run: | - source ./bin/activate-hermit echo "Performing pre-build cleanup..." # Clean npm cache npm cache clean --force || true @@ -133,7 +137,7 @@ jobs: # Build specifically for Intel architecture - name: Build goosed for Intel - run: source ./bin/activate-hermit && cargo build --release -p goose-server --target x86_64-apple-darwin + run: cargo build --release -p goose-server --target x86_64-apple-darwin # Post-build cleanup to free space - name: Post-build cleanup @@ -160,8 +164,13 @@ jobs: CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }} CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }} + - name: Set up Node.js + uses: actions/setup-node@7c12f8017d5436eb855f1ed4399f037a36fbd9e8 # pin@v2 + with: + node-version: 'lts/*' + - name: Install dependencies - run: source ../../bin/activate-hermit && npm ci + run: npm ci working-directory: ui/desktop # Configure Electron builder for Intel architecture @@ -178,7 +187,6 @@ jobs: - name: Make Unsigned App if: ${{ !inputs.signing }} run: | - source ../../bin/activate-hermit attempt=0 max_attempts=2 until [ $attempt -ge $max_attempts ]; do @@ -196,7 +204,6 @@ jobs: - name: Make Signed App if: ${{ inputs.signing }} run: | - source ../../bin/activate-hermit attempt=0 max_attempts=2 until [ $attempt -ge $max_attempts ]; do diff --git a/.github/workflows/bundle-desktop.yml b/.github/workflows/bundle-desktop.yml index a5875097..c4856158 100644 --- a/.github/workflows/bundle-desktop.yml +++ b/.github/workflows/bundle-desktop.yml @@ -135,7 +135,6 @@ jobs: sed -i.bak "s/^version = \".*\"/version = \"${VERSION}\"/" Cargo.toml rm -f Cargo.toml.bak - source ./bin/activate-hermit # Update version in package.json cd ui/desktop npm version "${VERSION}" --no-git-tag-version --allow-same-version @@ -143,7 +142,6 @@ jobs: # Pre-build cleanup to ensure enough disk space - name: Pre-build cleanup run: | - source ./bin/activate-hermit echo "Performing pre-build cleanup..." # Clean npm cache npm cache clean --force || true @@ -156,6 +154,16 @@ jobs: # Check disk space after cleanup df -h + - name: Install protobuf + run: | + brew install protobuf + echo "PROTOC=$(which protoc)" >> $GITHUB_ENV + + - name: Setup Rust + uses: dtolnay/rust-toolchain@38b70195107dddab2c7bbd522bcf763bac00963b # pin@stable + with: + toolchain: stable + - name: Cache Cargo registry uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # pin@v3 with: @@ -182,7 +190,7 @@ jobs: # Build the project - name: Build goosed - run: source ./bin/activate-hermit && cargo build --release -p goose-server + run: cargo build --release -p goose-server # Post-build cleanup to free space - name: Post-build cleanup @@ -208,8 +216,13 @@ jobs: CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }} CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }} + - name: Set up Node.js + uses: actions/setup-node@7c12f8017d5436eb855f1ed4399f037a36fbd9e8 # pin@v2 + with: + node-version: 'lts/*' + - name: Install dependencies - run: source ../../bin/activate-hermit && npm ci + run: npm ci working-directory: ui/desktop # Check disk space before bundling @@ -219,7 +232,6 @@ jobs: - name: Make Unsigned App if: ${{ !inputs.signing }} run: | - source ../../bin/activate-hermit attempt=0 max_attempts=2 until [ $attempt -ge $max_attempts ]; do @@ -241,7 +253,6 @@ jobs: APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} run: | - attempt=0 max_attempts=2 until [ $attempt -ge $max_attempts ]; do diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4d76255..37699a1f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,8 +17,13 @@ jobs: - name: Checkout Code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4 + - name: Setup Rust + uses: dtolnay/rust-toolchain@38b70195107dddab2c7bbd522bcf763bac00963b # pin@stable + with: + toolchain: stable + - name: Run cargo fmt - run: source ./bin/activate-hermit && cargo fmt --check + run: cargo fmt --check rust-build-and-test: name: Build and Test Rust Project @@ -52,7 +57,12 @@ jobs: - name: Install Dependencies run: | sudo apt update -y - sudo apt install -y libdbus-1-dev gnome-keyring libxcb1-dev + sudo apt install -y libdbus-1-dev gnome-keyring libxcb1-dev protobuf-compiler + + - name: Setup Rust + uses: dtolnay/rust-toolchain@38b70195107dddab2c7bbd522bcf763bac00963b # pin@stable + with: + toolchain: stable - name: Cache Cargo Registry uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # pin@v3 @@ -81,7 +91,7 @@ jobs: - name: Build and Test run: | gnome-keyring-daemon --components=secrets --daemonize --unlock <<< 'foobar' - source ../bin/activate-hermit && cargo test + cargo test working-directory: crates # Add disk space cleanup before linting @@ -110,7 +120,7 @@ jobs: run: df -h - name: Lint - run: source ./bin/activate-hermit && cargo clippy -- -D warnings + run: cargo clippy -- -D warnings desktop-lint: name: Lint Electron Desktop App @@ -119,12 +129,17 @@ jobs: - name: Checkout Code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4 + - name: Set up Node.js + uses: actions/setup-node@7c12f8017d5436eb855f1ed4399f037a36fbd9e8 # pin@v2 + with: + node-version: "lts/*" + - name: Install Dependencies - run: source ../../bin/activate-hermit && npm ci + run: npm ci working-directory: ui/desktop - name: Run Lint - run: source ../../bin/activate-hermit && npm run lint:check + run: npm run lint:check working-directory: ui/desktop # Faster Desktop App build for PRs only diff --git a/.gitignore b/.gitignore index 3f5a8419..3d5ef353 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,8 @@ target/ ./ui/desktop/out # Hermit -.hermit/ +/.hermit/ +/bin/ debug_*.txt diff --git a/Cross.toml b/Cross.toml index b52f98a2..4e7ab47d 100644 --- a/Cross.toml +++ b/Cross.toml @@ -1,4 +1,11 @@ # Configuration for cross-compiling using cross +[build.env] +passthrough = [ + "PROTOC", + "RUST_LOG", + "RUST_BACKTRACE" +] + [target.aarch64-unknown-linux-gnu] xargo = false pre-build = [ @@ -6,10 +13,20 @@ pre-build = [ "dpkg --add-architecture arm64", """\ apt-get update --fix-missing && apt-get install -y \ + curl \ + unzip \ pkg-config \ libssl-dev:arm64 \ libdbus-1-dev:arm64 \ libxcb1-dev:arm64 + """, + """\ + curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v31.1/protoc-31.1-linux-x86_64.zip && \ + unzip -o protoc-31.1-linux-x86_64.zip -d /usr/local && \ + chmod +x /usr/local/bin/protoc && \ + ln -sf /usr/local/bin/protoc /usr/bin/protoc && \ + which protoc && \ + protoc --version """ ] @@ -18,15 +35,40 @@ xargo = false pre-build = [ """\ apt-get update && apt-get install -y \ + curl \ + unzip \ pkg-config \ libssl-dev \ libdbus-1-dev \ libxcb1-dev + """, + """\ + curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v31.1/protoc-31.1-linux-x86_64.zip && \ + unzip -o protoc-31.1-linux-x86_64.zip -d /usr/local && \ + chmod +x /usr/local/bin/protoc && \ + ln -sf /usr/local/bin/protoc /usr/bin/protoc && \ + which protoc && \ + protoc --version """ ] +env = { "PROTOC" = "/usr/bin/protoc", "PATH" = "/usr/local/bin:${PATH}" } [target.x86_64-pc-windows-gnu] image = "dockcross/windows-static-x64:latest" # Enable verbose output for Windows builds build-std = true env = { "RUST_LOG" = "debug", "RUST_BACKTRACE" = "1", "CROSS_VERBOSE" = "1" } +pre-build = [ + """\ + apt-get update && apt-get install -y \ + curl \ + unzip + """, + """\ + curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v31.1/protoc-31.1-linux-x86_64.zip && \ + unzip protoc-31.1-linux-x86_64.zip -d /usr/local && \ + chmod +x /usr/local/bin/protoc && \ + export PROTOC=/usr/local/bin/protoc && \ + protoc --version + """ +] diff --git a/bin/.node-22.9.0.pkg b/bin/.node-22.9.0.pkg deleted file mode 120000 index 383f4511..00000000 --- a/bin/.node-22.9.0.pkg +++ /dev/null @@ -1 +0,0 @@ -hermit \ No newline at end of file diff --git a/bin/.protoc-31.1.pkg b/bin/.protoc-31.1.pkg deleted file mode 120000 index 383f4511..00000000 --- a/bin/.protoc-31.1.pkg +++ /dev/null @@ -1 +0,0 @@ -hermit \ No newline at end of file diff --git a/bin/.rustup-1.25.2.pkg b/bin/.rustup-1.25.2.pkg deleted file mode 120000 index 383f4511..00000000 --- a/bin/.rustup-1.25.2.pkg +++ /dev/null @@ -1 +0,0 @@ -hermit \ No newline at end of file diff --git a/bin/README.hermit.md b/bin/README.hermit.md deleted file mode 100644 index e889550b..00000000 --- a/bin/README.hermit.md +++ /dev/null @@ -1,7 +0,0 @@ -# Hermit environment - -This is a [Hermit](https://github.com/cashapp/hermit) bin directory. - -The symlinks in this directory are managed by Hermit and will automatically -download and install Hermit itself as well as packages. These packages are -local to this environment. diff --git a/bin/activate-hermit b/bin/activate-hermit deleted file mode 100755 index fe28214d..00000000 --- a/bin/activate-hermit +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# This file must be used with "source bin/activate-hermit" from bash or zsh. -# You cannot run it directly -# -# THIS FILE IS GENERATED; DO NOT MODIFY - -if [ "${BASH_SOURCE-}" = "$0" ]; then - echo "You must source this script: \$ source $0" >&2 - exit 33 -fi - -BIN_DIR="$(dirname "${BASH_SOURCE[0]:-${(%):-%x}}")" -if "${BIN_DIR}/hermit" noop > /dev/null; then - eval "$("${BIN_DIR}/hermit" activate "${BIN_DIR}/..")" - - if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ]; then - hash -r 2>/dev/null - fi - - echo "Hermit environment $("${HERMIT_ENV}"/bin/hermit env HERMIT_ENV) activated" -fi diff --git a/bin/activate-hermit.fish b/bin/activate-hermit.fish deleted file mode 100755 index 0367d233..00000000 --- a/bin/activate-hermit.fish +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env fish - -# This file must be sourced with "source bin/activate-hermit.fish" from Fish shell. -# You cannot run it directly. -# -# THIS FILE IS GENERATED; DO NOT MODIFY - -if status is-interactive - set BIN_DIR (dirname (status --current-filename)) - - if "$BIN_DIR/hermit" noop > /dev/null - # Source the activation script generated by Hermit - "$BIN_DIR/hermit" activate "$BIN_DIR/.." | source - - # Clear the command cache if applicable - functions -c > /dev/null 2>&1 - - # Display activation message - echo "Hermit environment $($HERMIT_ENV/bin/hermit env HERMIT_ENV) activated" - end -else - echo "You must source this script: source $argv[0]" >&2 - exit 33 -end diff --git a/bin/cargo b/bin/cargo deleted file mode 120000 index 5046e66f..00000000 --- a/bin/cargo +++ /dev/null @@ -1 +0,0 @@ -.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/cargo-clippy b/bin/cargo-clippy deleted file mode 120000 index 5046e66f..00000000 --- a/bin/cargo-clippy +++ /dev/null @@ -1 +0,0 @@ -.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/cargo-fmt b/bin/cargo-fmt deleted file mode 120000 index 5046e66f..00000000 --- a/bin/cargo-fmt +++ /dev/null @@ -1 +0,0 @@ -.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/cargo-miri b/bin/cargo-miri deleted file mode 120000 index 5046e66f..00000000 --- a/bin/cargo-miri +++ /dev/null @@ -1 +0,0 @@ -.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/clippy-driver b/bin/clippy-driver deleted file mode 120000 index 5046e66f..00000000 --- a/bin/clippy-driver +++ /dev/null @@ -1 +0,0 @@ -.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/corepack b/bin/corepack deleted file mode 120000 index 51cdc90c..00000000 --- a/bin/corepack +++ /dev/null @@ -1 +0,0 @@ -.node-22.9.0.pkg \ No newline at end of file diff --git a/bin/hermit b/bin/hermit deleted file mode 100755 index 31559b7d..00000000 --- a/bin/hermit +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# -# THIS FILE IS GENERATED; DO NOT MODIFY - -set -eo pipefail - -export HERMIT_USER_HOME=~ - -if [ -z "${HERMIT_STATE_DIR}" ]; then - case "$(uname -s)" in - Darwin) - export HERMIT_STATE_DIR="${HERMIT_USER_HOME}/Library/Caches/hermit" - ;; - Linux) - export HERMIT_STATE_DIR="${XDG_CACHE_HOME:-${HERMIT_USER_HOME}/.cache}/hermit" - ;; - esac -fi - -export HERMIT_DIST_URL="${HERMIT_DIST_URL:-https://github.com/cashapp/hermit/releases/download/stable}" -HERMIT_CHANNEL="$(basename "${HERMIT_DIST_URL}")" -export HERMIT_CHANNEL -export HERMIT_EXE=${HERMIT_EXE:-${HERMIT_STATE_DIR}/pkg/hermit@${HERMIT_CHANNEL}/hermit} - -if [ ! -x "${HERMIT_EXE}" ]; then - echo "Bootstrapping ${HERMIT_EXE} from ${HERMIT_DIST_URL}" 1>&2 - INSTALL_SCRIPT="$(mktemp)" - # This value must match that of the install script - INSTALL_SCRIPT_SHA256="09ed936378857886fd4a7a4878c0f0c7e3d839883f39ca8b4f2f242e3126e1c6" - if [ "${INSTALL_SCRIPT_SHA256}" = "BYPASS" ]; then - curl -fsSL "${HERMIT_DIST_URL}/install.sh" -o "${INSTALL_SCRIPT}" - else - # Install script is versioned by its sha256sum value - curl -fsSL "${HERMIT_DIST_URL}/install-${INSTALL_SCRIPT_SHA256}.sh" -o "${INSTALL_SCRIPT}" - # Verify install script's sha256sum - openssl dgst -sha256 "${INSTALL_SCRIPT}" | \ - awk -v EXPECTED="$INSTALL_SCRIPT_SHA256" \ - '$2!=EXPECTED {print "Install script sha256 " $2 " does not match " EXPECTED; exit 1}' - fi - /bin/bash "${INSTALL_SCRIPT}" 1>&2 -fi - -exec "${HERMIT_EXE}" --level=fatal exec "$0" -- "$@" diff --git a/bin/hermit.hcl b/bin/hermit.hcl deleted file mode 100644 index cc17d794..00000000 --- a/bin/hermit.hcl +++ /dev/null @@ -1,4 +0,0 @@ -manage-git = false - -github-token-auth { -} diff --git a/bin/node b/bin/node deleted file mode 120000 index 51cdc90c..00000000 --- a/bin/node +++ /dev/null @@ -1 +0,0 @@ -.node-22.9.0.pkg \ No newline at end of file diff --git a/bin/npm b/bin/npm deleted file mode 120000 index 51cdc90c..00000000 --- a/bin/npm +++ /dev/null @@ -1 +0,0 @@ -.node-22.9.0.pkg \ No newline at end of file diff --git a/bin/npx b/bin/npx deleted file mode 120000 index 51cdc90c..00000000 --- a/bin/npx +++ /dev/null @@ -1 +0,0 @@ -.node-22.9.0.pkg \ No newline at end of file diff --git a/bin/protoc b/bin/protoc deleted file mode 120000 index 6bb03478..00000000 --- a/bin/protoc +++ /dev/null @@ -1 +0,0 @@ -.protoc-31.1.pkg \ No newline at end of file diff --git a/bin/rls b/bin/rls deleted file mode 120000 index 5046e66f..00000000 --- a/bin/rls +++ /dev/null @@ -1 +0,0 @@ -.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/rust-analyzer b/bin/rust-analyzer deleted file mode 120000 index 5046e66f..00000000 --- a/bin/rust-analyzer +++ /dev/null @@ -1 +0,0 @@ -.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/rust-gdb b/bin/rust-gdb deleted file mode 120000 index 5046e66f..00000000 --- a/bin/rust-gdb +++ /dev/null @@ -1 +0,0 @@ -.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/rust-gdbgui b/bin/rust-gdbgui deleted file mode 120000 index 5046e66f..00000000 --- a/bin/rust-gdbgui +++ /dev/null @@ -1 +0,0 @@ -.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/rust-lldb b/bin/rust-lldb deleted file mode 120000 index 5046e66f..00000000 --- a/bin/rust-lldb +++ /dev/null @@ -1 +0,0 @@ -.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/rustc b/bin/rustc deleted file mode 120000 index 5046e66f..00000000 --- a/bin/rustc +++ /dev/null @@ -1 +0,0 @@ -.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/rustdoc b/bin/rustdoc deleted file mode 120000 index 5046e66f..00000000 --- a/bin/rustdoc +++ /dev/null @@ -1 +0,0 @@ -.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/rustfmt b/bin/rustfmt deleted file mode 120000 index 5046e66f..00000000 --- a/bin/rustfmt +++ /dev/null @@ -1 +0,0 @@ -.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/rustup b/bin/rustup deleted file mode 120000 index 5046e66f..00000000 --- a/bin/rustup +++ /dev/null @@ -1 +0,0 @@ -.rustup-1.25.2.pkg \ No newline at end of file diff --git a/crates/goose/src/recipe/mod.rs b/crates/goose/src/recipe/mod.rs index 510ba000..8891dbd4 100644 --- a/crates/goose/src/recipe/mod.rs +++ b/crates/goose/src/recipe/mod.rs @@ -28,7 +28,7 @@ fn default_version() -> String { /// /// # Example /// -/// +/// ``` /// use goose::recipe::Recipe; /// /// // Using the builder pattern @@ -52,7 +52,7 @@ fn default_version() -> String { /// author: None, /// parameters: None, /// }; -/// +/// ``` #[derive(Serialize, Deserialize, Debug)] pub struct Recipe { // Required fields @@ -166,7 +166,7 @@ impl Recipe { /// /// # Example /// - /// + /// ``` /// use goose::recipe::Recipe; /// /// let recipe = Recipe::builder() @@ -175,7 +175,7 @@ impl Recipe { /// .instructions("Act as a helpful assistant") /// .build() /// .expect("Failed to build Recipe: missing required fields"); - /// + /// ``` pub fn builder() -> RecipeBuilder { RecipeBuilder { version: default_version(),