Skip to content
Merged
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
6 changes: 3 additions & 3 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ archives:
- go-chrome-ai
formats:
- tar.gz
name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}"
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"

checksum:
name_template: SHA256SUMS
name_template: checksums.txt

snapshot:
version_template: "{{ .Version }}-devel"
version_template: "{{ incpatch .Version }}-devel"

changelog:
sort: asc
Expand Down
16 changes: 8 additions & 8 deletions PUBLISHING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@ The repository includes `.github/workflows/ci.yml` to run:
Tagging a semantic version triggers `.github/workflows/release.yml`.

```bash
git tag v1.0.3
git push origin v1.0.3
git tag v1.0.4
git push origin v1.0.4
```

That workflow publishes release archives and `SHA256SUMS` through GoReleaser.
That workflow publishes release archives and `checksums.txt` through GoReleaser.

Published macOS assets keep the current install-compatible names:
Published macOS assets follow the same versioned artifact pattern as the other managed repos:

- `go-chrome-ai-darwin-arm64.tar.gz`
- `go-chrome-ai-darwin-amd64.tar.gz`
- `SHA256SUMS`
- `go-chrome-ai_1.0.4_darwin_arm64.tar.gz`
- `go-chrome-ai_1.0.4_darwin_amd64.tar.gz`
- `checksums.txt`

## Homebrew Cask

After the release is live:

```bash
./scripts/render-homebrew-cask.sh --owner itamaker --version v1.0.3 > /path/to/homebrew-tap/Casks/go-chrome-ai.rb
./scripts/render-homebrew-cask.sh --owner itamaker --version v1.0.4 > /path/to/homebrew-tap/Casks/go-chrome-ai.rb
```

Commit the rendered file to `https://github.com/itamaker/homebrew-tap` as `Casks/go-chrome-ai.rb`.
Expand Down
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,33 @@ English | [中文](docs/README.zh.md)
`go-chrome-ai` is a cross-platform Chrome profile patcher written in Go, with both **CLI** and **GUI** modes.
It helps enable Chrome AI-related features, including **Ask Gemini**, without reinstalling Chrome or recreating your profile.

![go-chrome-ai social preview](docs/images/social-preview.png)

## Support

[![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://buymeacoffee.com/amaker)

## Screenshot

![go-chrome-ai GUI](docs/images/go-chrome-ai-gui.png)

## Quickstart

### Install

Install with your preferred method:

```bash
# Install the latest macOS release
curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/install.sh | sh
```

```bash
# Or install via Homebrew (custom tap)
brew install --cask itamaker/tap/go-chrome-ai
```

<details>
<summary>You can also download binaries from <a href="https://github.com/itamaker/go-chrome-ai/releases">GitHub Releases</a>.</summary>
<summary>You can also install with the shell installer or download binaries from <a href="https://github.com/itamaker/go-chrome-ai/releases">GitHub Releases</a>.</summary>

Shell installer:

```bash
curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/install.sh | sh
```

Current release archives:

- macOS (Apple Silicon/arm64): `go-chrome-ai-darwin-arm64.tar.gz`
- macOS (Intel/x86_64): `go-chrome-ai-darwin-amd64.tar.gz`
- macOS (Apple Silicon/arm64): `go-chrome-ai_1.0.4_darwin_arm64.tar.gz`
- macOS (Intel/x86_64): `go-chrome-ai_1.0.4_darwin_amd64.tar.gz`

Each archive contains a single executable: `go-chrome-ai`.

Expand All @@ -47,7 +43,7 @@ The install script also accepts:

```bash
# Install a specific release into a custom directory
curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/install.sh | VERSION=v1.0.1 INSTALL_DIR=$HOME/bin sh
curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/install.sh | VERSION=v1.0.4 INSTALL_DIR=$HOME/bin sh
```

Set `SKIP_PATH_SETUP=1` if you do not want the installer to edit your shell profile.
Expand Down Expand Up @@ -77,6 +73,10 @@ It enables Chrome AI-related features (such as **Ask Gemini**) by patching local
- `variations_country` -> `"us"`
- `variations_permanent_consistency_country` -> `["<last_version>", "us"]` (if field exists and is patchable)

## Screenshot

![go-chrome-ai GUI](docs/images/go-chrome-ai-gui.png)

## Requirements

- Go `1.26+`
Expand Down
32 changes: 16 additions & 16 deletions docs/README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,33 @@
`go-chrome-ai` 是一个用 Go 编写的跨平台 Chrome 配置修补工具,同时支持 **CLI** 和 **GUI**。
它可以在不重装 Chrome、不重建用户配置的情况下启用相关 AI 功能(包括 **Ask Gemini**)。

![go-chrome-ai social preview](images/social-preview.png)

## Support

[![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://buymeacoffee.com/amaker)

## 截图

![go-chrome-ai GUI](images/go-chrome-ai-gui.png)

## Quickstart

### 安装

可按你偏好的方式安装:

```bash
# 安装最新的 macOS release
curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/install.sh | sh
```

```bash
# 或通过 Homebrew(自定义 tap)安装
brew install --cask itamaker/tap/go-chrome-ai
```

<details>
<summary>也可以从 <a href="https://github.com/itamaker/go-chrome-ai/releases">GitHub Releases</a> 直接下载二进制。</summary>
<summary>也可以通过安装脚本或 <a href="https://github.com/itamaker/go-chrome-ai/releases">GitHub Releases</a> 获取二进制。</summary>

安装脚本:

```bash
curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/install.sh | sh
```

当前发布包:

- macOS(Apple Silicon/arm64):`go-chrome-ai-darwin-arm64.tar.gz`
- macOS(Intel/x86_64):`go-chrome-ai-darwin-amd64.tar.gz`
- macOS(Apple Silicon/arm64):`go-chrome-ai_1.0.4_darwin_arm64.tar.gz`
- macOS(Intel/x86_64):`go-chrome-ai_1.0.4_darwin_amd64.tar.gz`

每个压缩包都只包含一个可执行文件:`go-chrome-ai`。

Expand All @@ -45,7 +41,7 @@ brew install --cask itamaker/tap/go-chrome-ai

```bash
# 安装指定版本,并放到自定义目录
curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/install.sh | VERSION=v1.0.1 INSTALL_DIR=$HOME/bin sh
curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/install.sh | VERSION=v1.0.4 INSTALL_DIR=$HOME/bin sh
```

如果你不希望安装器修改 shell 配置文件,可设置 `SKIP_PATH_SETUP=1`。
Expand Down Expand Up @@ -75,6 +71,10 @@ xattr -d com.apple.quarantine $(which go-chrome-ai)
- 将 `variations_country` 设为 `"us"`
- 将 `variations_permanent_consistency_country` 设为 `["<last_version>", "us"]`(仅当该字段存在且可修改)

## 截图

![go-chrome-ai GUI](images/go-chrome-ai-gui.png)

## 环境要求

- Go `1.26+`
Expand Down
7 changes: 4 additions & 3 deletions docs/homebrew-cask.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ To support `brew install --cask`, publish the cask in your tap repo [`itamaker/h

Upload these files to each GitHub Release:

- `go-chrome-ai-darwin-arm64.tar.gz`
- `go-chrome-ai-darwin-amd64.tar.gz`
- `go-chrome-ai_1.0.4_darwin_arm64.tar.gz`
- `go-chrome-ai_1.0.4_darwin_amd64.tar.gz`
- `checksums.txt`

You can generate them via:

Expand All @@ -24,7 +25,7 @@ Each archive should contain:
Then update the cask:

```bash
./scripts/render-homebrew-cask.sh --owner itamaker --version v1.0.3 > /path/to/homebrew-tap/Casks/go-chrome-ai.rb
./scripts/render-homebrew-cask.sh --owner itamaker --version v1.0.4 > /path/to/homebrew-tap/Casks/go-chrome-ai.rb
```

## User install
Expand Down
Binary file added docs/images/logo-mark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/social-preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 33 additions & 9 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ REPO="${REPO:-itamaker/go-chrome-ai}"
BINARY_NAME="go-chrome-ai"
VERSION="${VERSION:-latest}"
SKIP_PATH_SETUP="${SKIP_PATH_SETUP:-0}"
VERSION_TAG=""
VERSION_NUMBER=""
LEGACY_ARCHIVE_NAME=""
LEGACY_DOWNLOAD_URL=""
LEGACY_CHECKSUMS_URL=""

if [ "$(id -u)" = "0" ]; then
INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}"
Expand Down Expand Up @@ -112,15 +117,28 @@ resolve_version() {
if [ "$VERSION" = "latest" ]; then
latest_json="$(github_api_get "https://api.github.com/repos/$REPO/releases/latest")" || \
error "Failed to query the latest GitHub release"
VERSION="$(printf '%s\n' "$latest_json" | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n 1)"
[ -n "$VERSION" ] || error "Failed to parse the latest release version"
VERSION_TAG="$(printf '%s\n' "$latest_json" | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n 1)"
[ -n "$VERSION_TAG" ] || error "Failed to parse the latest release version"
else
case "$VERSION" in
v*)
VERSION_TAG="$VERSION"
;;
*)
VERSION_TAG="v$VERSION"
;;
esac
fi

ARCHIVE_NAME="${BINARY_NAME}-${OS}-${ARCH}.tar.gz"
DOWNLOAD_URL="https://github.com/$REPO/releases/download/$VERSION/$ARCHIVE_NAME"
CHECKSUMS_URL="https://github.com/$REPO/releases/download/$VERSION/SHA256SUMS"
VERSION_NUMBER="${VERSION_TAG#v}"
ARCHIVE_NAME="${BINARY_NAME}_${VERSION_NUMBER}_${OS}_${ARCH}.tar.gz"
DOWNLOAD_URL="https://github.com/$REPO/releases/download/$VERSION_TAG/$ARCHIVE_NAME"
CHECKSUMS_URL="https://github.com/$REPO/releases/download/$VERSION_TAG/checksums.txt"
LEGACY_ARCHIVE_NAME="${BINARY_NAME}-${OS}-${ARCH}.tar.gz"
LEGACY_DOWNLOAD_URL="https://github.com/$REPO/releases/download/$VERSION_TAG/$LEGACY_ARCHIVE_NAME"
LEGACY_CHECKSUMS_URL="https://github.com/$REPO/releases/download/$VERSION_TAG/SHA256SUMS"

info "Version: ${BOLD}$VERSION${NC}"
info "Version: ${BOLD}$VERSION_TAG${NC}"
}

create_install_dir() {
Expand Down Expand Up @@ -149,7 +167,7 @@ verify_checksum() {
fi

if ! curl -fsSL "$CHECKSUMS_URL" -o "$checksums_path"; then
warn "Skipping checksum verification: failed to download SHA256SUMS"
warn "Skipping checksum verification: failed to download checksums.txt"
return 0
fi

Expand All @@ -174,10 +192,16 @@ install_binary() {
trap 'rm -rf "$tmp_dir"' EXIT HUP INT TERM

archive_path="$tmp_dir/$ARCHIVE_NAME"
checksums_path="$tmp_dir/SHA256SUMS"
checksums_path="$tmp_dir/checksums.txt"

info "Downloading ${BOLD}$ARCHIVE_NAME${NC}"
curl -fsSL "$DOWNLOAD_URL" -o "$archive_path" || error "Download failed: $DOWNLOAD_URL"
if ! curl -fsSL "$DOWNLOAD_URL" -o "$archive_path"; then
warn "Preferred archive name not found, trying legacy release naming"
ARCHIVE_NAME="$LEGACY_ARCHIVE_NAME"
DOWNLOAD_URL="$LEGACY_DOWNLOAD_URL"
CHECKSUMS_URL="$LEGACY_CHECKSUMS_URL"
curl -fsSL "$DOWNLOAD_URL" -o "$archive_path" || error "Download failed: $DOWNLOAD_URL"
fi

verify_checksum "$archive_path" "$checksums_path"

Expand Down
8 changes: 4 additions & 4 deletions scripts/render-homebrew-cask.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ set -euo pipefail

PROJECT="go-chrome-ai"
DESCRIPTION="Patch Chrome Local State to enable Ask Gemini and other AI features"
CHECKSUMS_FILE="dist/SHA256SUMS"
CHECKSUMS_FILE="dist/checksums.txt"
OWNER=""
REPO="${PROJECT}"
VERSION=""

usage() {
echo "Render a cask for https://github.com/itamaker/homebrew-tap" >&2
echo "Usage: $0 --owner <project-repo-owner> --version <v1.0.3> [--repo <project-repo-name>] [--checksums <path>]" >&2
echo "Usage: $0 --owner <project-repo-owner> --version <v1.0.4> [--repo <project-repo-name>] [--checksums <path>]" >&2
}

while [[ $# -gt 0 ]]; do
Expand Down Expand Up @@ -51,7 +51,7 @@ fi

checksum_for() {
local arch="$1"
local artifact="${PROJECT}-darwin-${arch}.tar.gz"
local artifact="${PROJECT}_${VERSION}_darwin_${arch}.tar.gz"
awk -v artifact="${artifact}" '$2 == artifact { print $1 }' "${CHECKSUMS_FILE}"
}

Expand All @@ -73,7 +73,7 @@ cask "${PROJECT}" do
sha256 arm: "${darwin_arm64}",
intel: "${darwin_amd64}"

url "https://github.com/${OWNER}/${REPO}/releases/download/v#{version}/${PROJECT}-darwin-#{arch}.tar.gz"
url "https://github.com/${OWNER}/${REPO}/releases/download/v#{version}/${PROJECT}_#{version}_darwin_#{arch}.tar.gz"
name "${PROJECT}"
desc "${DESCRIPTION}"
homepage "https://github.com/${OWNER}/${REPO}"
Expand Down
Loading