Skip to content
Open
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"permissions": {
"allow": [
"Bash(gh repo view:*)",
"Bash(gh release list:*)",
"Bash(gh release view:*)",
"WebFetch(domain:raw.githubusercontent.com)",
"WebFetch(domain:github.com)"
],
"deny": [],
"ask": []
}
}
4 changes: 4 additions & 0 deletions frontend/wailsjs/runtime/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ export function EventsOff(eventName, ...additionalEventNames) {
return window.runtime.EventsOff(eventName, ...additionalEventNames);
}

export function EventsOffAll() {
return window.runtime.EventsOffAll();
}

export function EventsOnce(eventName, callback) {
return EventsOnMultiple(eventName, callback, 1);
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.23

require (
github.com/google/uuid v1.6.0
github.com/wailsapp/wails/v2 v2.10.2
github.com/wailsapp/wails/v2 v2.11.0
)

require (
Expand All @@ -28,7 +28,7 @@ require (
github.com/tkrajina/go-reflector v0.5.8 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/wailsapp/go-webview2 v1.0.19 // indirect
github.com/wailsapp/go-webview2 v1.0.22 // indirect
github.com/wailsapp/mimetype v1.4.1 // indirect
golang.org/x/crypto v0.33.0 // indirect
golang.org/x/net v0.35.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/wailsapp/go-webview2 v1.0.19 h1:7U3QcDj1PrBPaxJNCui2k1SkWml+Q5kvFUFyTImA6NU=
github.com/wailsapp/go-webview2 v1.0.19/go.mod h1:qJmWAmAmaniuKGZPWwne+uor3AHMB5PFhqiK0Bbj8kc=
github.com/wailsapp/go-webview2 v1.0.22 h1:YT61F5lj+GGaat5OB96Aa3b4QA+mybD0Ggq6NZijQ58=
github.com/wailsapp/go-webview2 v1.0.22/go.mod h1:qJmWAmAmaniuKGZPWwne+uor3AHMB5PFhqiK0Bbj8kc=
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
github.com/wailsapp/wails/v2 v2.10.2 h1:29U+c5PI4K4hbx8yFbFvwpCuvqK9VgNv8WGobIlKlXk=
github.com/wailsapp/wails/v2 v2.10.2/go.mod h1:XuN4IUOPpzBrHUkEd7sCU5ln4T/p1wQedfxP7fKik+4=
github.com/wailsapp/wails/v2 v2.11.0 h1:seLacV8pqupq32IjS4Y7V8ucab0WZwtK6VvUVxSBtqQ=
github.com/wailsapp/wails/v2 v2.11.0/go.mod h1:jrf0ZaM6+GBc1wRmXsM8cIvzlg0karYin3erahI4+0k=
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
Expand Down
13 changes: 12 additions & 1 deletion scripts/build-and-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,15 @@ Built with Wails v2" \
"${ASSETS[@]}"
fi

echo "Release created/updated: https://github.com/$(gh repo view --json nameWithOwner -q .nameWithOwner)/releases/tag/$GIT_TAG"
echo "Release created/updated: https://github.com/$(gh repo view --json nameWithOwner -q .nameWithOwner)/releases/tag/$GIT_TAG"

echo ""
echo "Updating Homebrew cask..."
if ./scripts/update-homebrew.sh "$VERSION"; then
echo ""
echo "Homebrew cask updated successfully!"
else
echo ""
echo "Warning: Failed to update Homebrew cask. You may need to update it manually."
echo "Run: ./scripts/update-homebrew.sh $VERSION"
fi
81 changes: 81 additions & 0 deletions scripts/update-homebrew.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/bash

set -e
Copy link

Choose a reason for hiding this comment

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

Medium

The set -e conflicts with error handling in build-and-release.sh (lines 100-107). When any command fails, the script exits immediately, preventing proper error context from being passed back to the caller. This makes debugging difficult when something fails mid-execution (e.g., after cloning but before pushing).

Consider either:

  1. Removing set -e and adding explicit error checking with descriptive messages
  2. Using set -eE with an error trap that logs context before exiting
    Agent: 🧠 Logic


HOMEBREW_TAP_REPO="STRRL/homebrew-collective"
CASK_NAME="transcube"
TEMP_DIR=$(mktemp -d)

cleanup() {
rm -rf "$TEMP_DIR"
}
trap cleanup EXIT

echo "Updating Homebrew cask for $CASK_NAME..."
echo ""

if [[ $# -eq 1 ]]; then
VERSION="$1"
else
GIT_TAG=$(git describe --tags --exact-match 2>/dev/null || echo "")
if [[ -z "$GIT_TAG" ]]; then
echo "Error: No version specified and no git tag found."
echo "Usage: $0 [VERSION]"
echo "Example: $0 0.1.10"
exit 1
fi
VERSION="${GIT_TAG#v}"
fi

echo "Version: $VERSION"

DMG_NAME="TransCube-${VERSION}-macOS.dmg"
DMG_PATH="build/bin/$DMG_NAME"
Copy link

Choose a reason for hiding this comment

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

Medium

The script assumes it's run from the repository root. If called from a different directory, the DMG path resolution will fail.

Make the path resolution robust:

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
DMG_PATH="$PROJECT_ROOT/build/bin/$DMG_NAME"

Agent: 🧠 Logic


if [[ ! -f "$DMG_PATH" ]]; then
echo "Error: DMG file not found at $DMG_PATH"
echo "Please run build-and-release.sh first."
exit 1
fi

echo "Calculating SHA256 for $DMG_NAME..."
SHA256=$(shasum -a 256 "$DMG_PATH" | awk '{print $1}')
Copy link

Choose a reason for hiding this comment

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

Medium

Missing validation for SHA256 calculation. If shasum fails or the DMG is corrupted, the variable could be empty or invalid, leading to an invalid Homebrew cask.

Add validation:

SHA256=$(shasum -a 256 "$DMG_PATH" | awk '{print $1}')
if [[ -z "$SHA256" || ${#SHA256} -ne 64 ]]; then
    echo "Error: Failed to calculate valid SHA256 hash"
    exit 1
fi

Agent: 🧠 Logic

echo "SHA256: $SHA256"
echo ""

echo "Cloning homebrew-collective repository..."
cd "$TEMP_DIR"
git clone "https://github.com/$HOMEBREW_TAP_REPO.git" tap
cd tap

CASK_FILE="Casks/${CASK_NAME}.rb"

if [[ ! -f "$CASK_FILE" ]]; then
echo "Error: Cask file not found at $CASK_FILE"
exit 1
fi

echo "Updating $CASK_FILE..."

sed -i '' "s/version \".*\"/version \"$VERSION\"/" "$CASK_FILE"
Copy link

Choose a reason for hiding this comment

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

High

The sed -i '' syntax is BSD sed (macOS-specific) and will fail on Linux systems. Since this script may run in CI/CD environments (suggested by .github/workflows/claude.yml), it should be cross-platform.

Consider detecting the OS and adjusting the sed syntax:

if [[ "$OSTYPE" == "darwin"* ]]; then
    sed -i '' "s/version \".*\"/version \"$VERSION\"/" "$CASK_FILE"
    sed -i '' "s/sha256 \".*\"/sha256 \"$SHA256\"/" "$CASK_FILE"
else
    sed -i "s/version \".*\"/version \"$VERSION\"/" "$CASK_FILE"
    sed -i "s/sha256 \".*\"/sha256 \"$SHA256\"/" "$CASK_FILE"
fi

Agent: 🧠 Logic

sed -i '' "s/sha256 \".*\"/sha256 \"$SHA256\"/" "$CASK_FILE"

if git diff --quiet "$CASK_FILE"; then
echo "No changes detected in $CASK_FILE. Version might already be up to date."
exit 0
fi

echo ""
echo "Changes to be committed:"
git diff "$CASK_FILE"
echo ""

git add "$CASK_FILE"
git commit -m "chore: update $CASK_NAME to $VERSION"

echo "Pushing to $HOMEBREW_TAP_REPO..."
git push origin master
Copy link

Choose a reason for hiding this comment

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

High

This push operation will fail without proper Git authentication (SSH keys or credential helper). Additionally, the hardcoded 'master' branch may not exist in the target repository (many have migrated to 'main').

Consider:

  1. Detecting the default branch dynamically:
DEFAULT_BRANCH=$(git remote show origin | grep 'HEAD branch' | cut -d' ' -f5)
git push origin "$DEFAULT_BRANCH"
  1. Adding authentication validation before attempting the push
  2. Providing a clear error message if push fails due to authentication
    Agent: 🧠 Logic


echo ""
echo "Successfully updated Homebrew cask to version $VERSION"
echo "Users can now run: brew upgrade $CASK_NAME"