Skip to content

Add native macOS support - #1

Merged
Praveensenpai merged 1 commit into
Praveensenpai:mainfrom
whereareiam:macos-support
Sep 28, 2026
Merged

Praveensenpai merged 1 commit into
Praveensenpai:mainfrom
whereareiam:macos-support

Conversation

@whereareiam

Copy link
Copy Markdown
Contributor

What changed

  • Add separate Linux and macOS keyring backends.
  • Use Apple Security.framework for full-size Keychain credentials.
  • Decode and preserve Antigravity's go-keyring-base64: envelope.
  • Make the installer select Linux x86_64, macOS arm64, or macOS x86_64 assets.
  • Add macOS release builds and pull-request CI.

Verification

  • macOS arm64 release build and local installer verified.
  • Existing Keychain account saved and switched successfully.
  • cargo test --all-targets passes.
  • cargo clippy --all-targets -- -D warnings passes.

The fork branch is ready for upstream CI to validate the Linux and Intel macOS builds.

@Praveensenpai Praveensenpai left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thank you for putting this together! Adding native macOS Keychain support and multi-platform CI release builds is a fantastic contribution.

Before we can merge, there is one critical issue on Linux that needs to be resolved, along with a minor architectural convention:

1. 🚨 Linux Keyring Write: Keep Raw JSON (Breaking Change)

In src/account/keyring/linux.rs:

pub fn write_keyring_token(token_json: &str) -> bool {
    let encoded_token = encode_keyring_secret(token_json);
    ...
  • Issue: The go-keyring-base64: prefix is specific to zalando/go-keyring's macOS implementation (keyring_darwin.go), where it works around argument escaping with the /usr/bin/security CLI. On Linux, zalando/go-keyring communicates directly with Freedesktop Secret Service over D-Bus (secret_service/ss.go) and stores / expects raw UTF-8 JSON.
  • Impact: If agym writes go-keyring-base64:... into Secret Service on Linux, agy will read that literal prefixed string instead of valid JSON and fail with an unmarshal error, breaking Antigravity CLI on Linux after an account switch.
  • Fix: Keep normalize_keyring_secret for reading (it gracefully handles plain text or base64), but in src/account/keyring/linux.rs, write_keyring_token should continue writing raw token_json.as_bytes() directly. macos.rs can keep encode_keyring_secret(token_json).

2. 📂 Modern Rust Module Layout

To conform with the repository's Rust 2018/2021 conventions (avoiding mod.rs files per clean-code rules):

  • Please move src/account/keyring/mod.rs to src/account/keyring.rs, declaring linux and macos submodules:
    src/account/
    ├── keyring.rs
    └── keyring/
        ├── linux.rs
        └── macos.rs
    

3. 💡 Minor Polish (Optional)

  • install.sh: In the if [ -f "Cargo.toml" ] branch, build_from_source "$PWD" already copies the binary to $INSTALL_DIR/$BINARY_NAME. The second cp on line 43 is redundant. Also, adding chmod +x "$INSTALL_DIR/$BINARY_NAME" after extracting downloaded release tarballs ensures execution permissions.
  • .github/workflows/release.yml: Line 1 is still name: Release Linux Binary—renaming it to name: Build and Release Binaries would reflect the new multi-platform builds.

Once the Linux write behavior and module pathing are updated, we'll gladly approve and merge this!

@whereareiam

Copy link
Copy Markdown
Contributor Author

Addressed all requested changes:

  • Linux Secret Service now writes raw JSON; only macOS applies the go-keyring-base64: envelope.
  • Moved the dispatcher to src/account/keyring.rs with linux.rs and macos.rs submodules.
  • Removed the redundant local installer copy and explicitly chmod downloaded binaries.
  • Re-ran cargo test --all-targets, cargo clippy --all-targets -- -D warnings, bash -n install.sh, and git diff --check; all pass.

The updated branch is e500091.

@Praveensenpai Praveensenpai left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Approved! Great work addressing the feedback. Merging now and patching the Linux dead-code cfg guards on main for v0.0.8 release.

@Praveensenpai
Praveensenpai merged commit e500091 into Praveensenpai:main Sep 28, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants