From 951d7af8a41a793b73a327756eb3d6edc35618ab Mon Sep 17 00:00:00 2001 From: JoshRob Date: Sun, 8 Nov 2026 20:51:46 -0600 Subject: [PATCH] 2.8.1: install.sh, and the docs stop recommending the github: spec --- CHANGELOG.md | 11 ++++ README.es.md | 58 ++++++++++++++----- README.md | 75 ++++++++++++------------ docs/TROUBLESHOOTING.es.md | 28 +++++++-- docs/TROUBLESHOOTING.md | 33 ++++++++--- install.sh | 114 +++++++++++++++++++++++++++++++++++++ package.json | 2 +- 7 files changed, 257 insertions(+), 64 deletions(-) create mode 100755 install.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 0237494..24ccc02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [2.8.1] - 2026-11-09 + +### Added + +- **`install.sh`**: downloads a release tarball, unpacks it under `~/.local/share/opencode-antigravity-auth/` and wires the config entry. `curl` and `tar` are the only requirements — no npm, no git, no build step. Takes an optional version (`install.sh v2.8.1`), respects `OPENCODE_ANTIGRAVITY_HOME` and `XDG_CONFIG_HOME`, keeps the other keys of `opencode.json` intact, and writes to whichever key the config already uses (`plugin` on v1, `plugins` on v2). + +### Fixed + +- **The documented install path did not work.** `"plugins": ["github:JoshRob297/opencode-antigravity-auth"]` fails with `git dep preparation failed` in OpenCode's embedded npm, on 1.19.5 and 2.2.6, from a clean machine, and **against the upstream repository too**. `README`, `README.es.md` and `docs/TROUBLESHOOTING.md` now lead with the tarball and the installer, and say plainly that the `github:` spec is broken instead of claiming it clones and builds. Real npm still installs the same spec, which is why Option C stays available. +- **2.8.0's changelog was wrong about this**: it stated the `github:` spec "still clones and builds the plugin on install". It does not, on the OpenCode builds tested. + ## [2.8.0] - 2026-11-08 ### Changed diff --git a/README.es.md b/README.es.md index 7868eaa..c9992ec 100644 --- a/README.es.md +++ b/README.es.md @@ -98,45 +98,75 @@ No hace falta cambiar nada de configuración al pasar de OpenCode v1 a v2. ## Instalación -### Opción A: Directo desde GitHub (Recomendado) +El plugin **no necesita npm ni git**. El instalador propio de OpenCode no sabe preparar +dependencias de git (`git dep preparation failed`) y no hay paquete de npm publicado con +este nombre, así que la instalación sale del tarball de cada release. -Añade a `plugins` en `~/.config/opencode/opencode.json`: +### Opción A: El instalador (Recomendado) + +```bash +curl -fsSL https://raw.githubusercontent.com/JoshRob297/opencode-antigravity-auth/main/install.sh | bash +``` + +Para fijar una versión en vez de seguir la última release: + +```bash +curl -fsSL https://raw.githubusercontent.com/JoshRob297/opencode-antigravity-auth/main/install.sh | bash -s -- v2.8.1 +``` + +Descarga la release empaquetada, la descomprime en `~/.local/share/opencode-antigravity-auth/` +y apunta `plugin` / `plugins` a ella — la clave que ya use tu config, así que la entrada +funciona igual en OpenCode v1 y v2. Vuelve a correrlo para actualizar. Solo pide `curl` y `tar`. + +### Opción B: El tarball, a mano + +Cada release lleva el plugin empaquetado como asset. Descarga +`opencode-antigravity-auth-.tgz` de [Releases](../../releases) y luego: + +```bash +mkdir -p ~/.local/share/opencode-antigravity-auth +tar -xzf opencode-antigravity-auth-2.8.1.tgz -C ~/.local/share/opencode-antigravity-auth +``` + +Y en `~/.config/opencode/opencode.json`: ```json { - "plugins": ["github:JoshRob297/opencode-antigravity-auth#v2.6.0"] + "plugin": ["/home/tu-usuario/.local/share/opencode-antigravity-auth/package"] } ``` -> OpenCode v2 clona, compila y actualiza el plugin automáticamente desde el repositorio oficial. +OpenCode **v1 lee `plugin`, v2 lee `plugins`** — el instalador detecta cuál tienes. -### Opción B: Directorio local (Desarrollo / Sin conexión) - -Clona y referencia de forma local: +### Opción C: Desde el código (Desarrollo) ```bash git clone https://github.com/JoshRob297/opencode-antigravity-auth.git /path/to/plugin cd /path/to/plugin && npm install && npm run build ``` -Luego, en `~/.config/opencode/opencode.json`: - ```json { "plugins": ["/path/to/plugin"] } ``` +### ¿Por qué no el spec `github:`? + +`"plugins": ["github:JoshRob297/opencode-antigravity-auth"]` **no instala** hoy: el npm +embebido de OpenCode termina en `git dep preparation failed`. Se reprodujo en OpenCode +1.19.5 y 2.2.6, desde una máquina limpia, y **también contra el repositorio del upstream** +— o sea que es el instalador, no este paquete. El npm real maneja el mismo spec sin +quejarse, por eso se queda documentado para quien tenga uno que funcione. + --- ## Inicio rápido (cero configuración en OpenCode v2) -1. **Añade el plugin** a `~/.config/opencode/opencode.json`: +1. **Instala el plugin** — Opción A de arriba: - ```json - { - "plugins": ["github:JoshRob297/opencode-antigravity-auth"] - } + ```bash + curl -fsSL https://raw.githubusercontent.com/JoshRob297/opencode-antigravity-auth/main/install.sh | bash ``` 2. **Autentícate con Google:** diff --git a/README.md b/README.md index 428f30a..e9eab8e 100644 --- a/README.md +++ b/README.md @@ -95,67 +95,76 @@ No configuration changes are required when transitioning between OpenCode v1 and ## Installation -### Option A: Direct from GitHub (Recommended) +The plugin needs **neither npm nor git**. OpenCode's own installer cannot prepare git +dependencies (`git dep preparation failed`) and there is no npm package published under +this name, so installs come from the release tarball. -Add to `plugins` in `~/.config/opencode/opencode.json`: +### Option A: The installer (Recommended) -```json -{ - "plugins": ["github:JoshRob297/opencode-antigravity-auth"] -} +```bash +curl -fsSL https://raw.githubusercontent.com/JoshRob297/opencode-antigravity-auth/main/install.sh | bash ``` -To pin a version, so what you run does not change under you: - +To pin a version instead of following the latest release: - -```json -{ - "plugins": ["github:JoshRob297/opencode-antigravity-auth#v2.6.0"] -} +```bash +curl -fsSL https://raw.githubusercontent.com/JoshRob297/opencode-antigravity-auth/main/install.sh | bash -s -- v2.8.1 ``` +It downloads the packed release, unpacks it under `~/.local/share/opencode-antigravity-auth/` +and points `plugin` / `plugins` at it — whichever key your config already uses, so the entry +works on OpenCode v1 and v2 alike. Re-run it to upgrade. `curl` and `tar` are the only +requirements. +### Option B: The tarball, by hand -Every release also ships the packed plugin as an asset, for offline installs: - - +Every release carries the packed plugin as an asset. Download +`opencode-antigravity-auth-.tgz` from [Releases](../../releases), then: ```bash +mkdir -p ~/.local/share/opencode-antigravity-auth +tar -xzf opencode-antigravity-auth-2.8.1.tgz -C ~/.local/share/opencode-antigravity-auth +``` -npm install https://github.com/JoshRob297/opencode-antigravity-auth/releases/download/v2.6.0/opencode-antigravity-auth-2.6.0.tgz +And in `~/.config/opencode/opencode.json`: +```json +{ + "plugin": ["/home/you/.local/share/opencode-antigravity-auth/package"] +} ``` -> OpenCode v2 will automatically clone, build, and update the plugin directly from the official repository. - -### Option B: Local Directory (Development / Offline) +OpenCode **v1 reads `plugin`, v2 reads `plugins`** — the installer detects which one you have. -Clone and reference locally: +### Option C: From source (Development) ```bash git clone https://github.com/JoshRob297/opencode-antigravity-auth.git /path/to/plugin cd /path/to/plugin && npm install && npm run build ``` -Then in `~/.config/opencode/opencode.json`: - ```json { "plugins": ["/path/to/plugin"] } ``` +### Why not the `github:` spec? + +`"plugins": ["github:JoshRob297/opencode-antigravity-auth"]` **does not install** today: +OpenCode's embedded npm ends with `git dep preparation failed`. It was reproduced on +OpenCode 1.19.5 and 2.2.6, from a clean machine, and **against the upstream repository as +well** — so it is the installer, not this package. Real npm handles the same spec without +complaint, which is why it stays documented for setups that ship a working one. + --- ## Quick Start (Zero-Config in OpenCode v2) -1. **Add the plugin** to `~/.config/opencode/opencode.json`: +1. **Install the plugin** — Option A above: - ```json - { - "plugins": ["github:JoshRob297/opencode-antigravity-auth"] - } + ```bash + curl -fsSL https://raw.githubusercontent.com/JoshRob297/opencode-antigravity-auth/main/install.sh | bash ``` 2. **Authenticate with Google:** @@ -637,15 +646,7 @@ To pin a version, so what you run does not change under you: -Every release also ships the packed plugin as an asset, for offline installs: - - - -```bash - -npm install https://github.com/JoshRob297/opencode-antigravity-auth/releases/download/v2.6.0/opencode-antigravity-auth-2.6.0.tgz - -``` +See [Installation](#installation) for how to get the files. OpenCode v1 uses the legacy singular key `"plugin"`. The updater detects both automatically and preserves whichever convention your configuration uses. diff --git a/docs/TROUBLESHOOTING.es.md b/docs/TROUBLESHOOTING.es.md index 51f9d4b..386faa1 100644 --- a/docs/TROUBLESHOOTING.es.md +++ b/docs/TROUBLESHOOTING.es.md @@ -510,20 +510,40 @@ npx tsx script/test-regression.ts --dry-run # Lista las pruebas ## Ayer funcionaba y hoy no -`github:JoshRob297/opencode-antigravity-auth` sigue a `main`, así que OpenCode toma cada commit. Cuando una actualización rompe algo, fija la versión que sabes que funciona y reporta el fallo contra esa: +Fija la versión que sabes que funciona y reporta el fallo contra esa: + +```bash +curl -fsSL https://raw.githubusercontent.com/JoshRob297/opencode-antigravity-auth/main/install.sh | bash -s -- v2.6.0 +``` + +Con `git log` entre esa etiqueta y `main` ves qué cambió. El instalador siempre trae exactamente la release que le pides, así que puedes moverte entre builds sin volver a tocar la config. + +--- + +## "git dep preparation failed" + +El plugin no se puede instalar con el spec `github:`: ```json -{ "plugins": ["github:JoshRob297/opencode-antigravity-auth#v2.6.0"] } +{ "plugins": ["github:JoshRob297/opencode-antigravity-auth"] } ``` -Con `git log` ves qué cambió entre la etiqueta que fijaste y el head. Cada release también publica el plugin empaquetado como asset, por si prefieres instalar un build exacto: +El npm embebido de OpenCode no logra preparar la dependencia de git, ni en 1.19.5 ni en +2.2.6, y tampoco con el repositorio del upstream — el problema es el instalador, no el paquete. + +Usa el tarball de la release: ```bash -npm install https://github.com/JoshRob297/opencode-antigravity-auth/releases/download/v2.6.0/opencode-antigravity-auth-2.6.0.tgz +curl -fsSL https://raw.githubusercontent.com/JoshRob297/opencode-antigravity-auth/main/install.sh | bash ``` +Si prefieres hacerlo a mano, descomprime `opencode-antigravity-auth-.tgz` donde +quieras y apunta `plugin` / `plugins` al directorio `package/` que trae dentro. Un clon con +`npm install && npm run build` también sirve, porque el npm real sí prepara dependencias de git. + --- ## ¿Sigues atascado? Abre un issue en [GitHub](https://github.com/JoshRob297/opencode-antigravity-auth/issues). + diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md index b2df649..8490f5e 100644 --- a/docs/TROUBLESHOOTING.md +++ b/docs/TROUBLESHOOTING.md @@ -146,6 +146,27 @@ Then restart OpenCode. --- +### "git dep preparation failed" + +The plugin cannot be installed with the `github:` spec: + +```json +{ "plugins": ["github:JoshRob297/opencode-antigravity-auth"] } +``` + +OpenCode's embedded npm fails to prepare the git dependency, on both 1.19.5 and 2.2.6, +and with the upstream repository as well — the installer is at fault, not the package. + +Use the release tarball instead: + +```bash +curl -fsSL https://raw.githubusercontent.com/JoshRob297/opencode-antigravity-auth/main/install.sh | bash +``` + +If you would rather do it by hand, unpack `opencode-antigravity-auth-.tgz` anywhere +and point `plugin` / `plugins` at the `package/` directory inside it. A clone plus +`npm install && npm run build` works too, because real npm does prepare git dependencies. + ## IAM / Google Cloud Project Permission Error If you see: @@ -507,18 +528,14 @@ npx tsx script/test-regression.ts --dry-run # List tests ## It worked yesterday and broke today -`github:JoshRob297/opencode-antigravity-auth` follows `main`, so OpenCode picks up every commit. When an update breaks something, pin the version you know works and report the regression against it: - -```json -{ "plugins": ["github:JoshRob297/opencode-antigravity-auth#v2.6.0"] } -``` - -`git log` then tells you what changed between the tag you pinned and the head. Every release also publishes the packed plugin as an asset, if you would rather install an exact build: +Pin the version you know works and report the regression against it: ```bash -npm install https://github.com/JoshRob297/opencode-antigravity-auth/releases/download/v2.6.0/opencode-antigravity-auth-2.6.0.tgz +curl -fsSL https://raw.githubusercontent.com/JoshRob297/opencode-antigravity-auth/main/install.sh | bash -s -- v2.6.0 ``` +`git log` between that tag and `main` then tells you what changed. The installer always fetches exactly the release you name, so you can move between builds without editing the config again. + --- ## Still stuck? diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..7712727 --- /dev/null +++ b/install.sh @@ -0,0 +1,114 @@ +#!/usr/bin/env bash +# Install Antigravity Auth - Reloaded into OpenCode without npm and without git. +# +# curl -fsSL https://raw.githubusercontent.com/JoshRob297/opencode-antigravity-auth/main/install.sh | bash +# curl -fsSL .../install.sh | bash -s -- v2.8.1 # pin a version +# ./install.sh v2.8.1 # or run it from a clone +# +# OpenCode's own installer cannot prepare git dependencies (`git dep preparation +# failed`), and this plugin does not live on npm, so the release tarball is the +# way in. Nothing here needs node, npm or git: curl and tar are enough. +set -euo pipefail + +REPO="JoshRob297/opencode-antigravity-auth" +VERSION="${1:-}" +DEST="${OPENCODE_ANTIGRAVITY_HOME:-$HOME/.local/share/opencode-antigravity-auth}" +CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/opencode" +CONFIG="$CONFIG_DIR/opencode.json" + +say() { printf '%s\n' "$*"; } +die() { printf 'error: %s\n' "$*" >&2; exit 1; } + +command -v curl >/dev/null 2>&1 || die "curl is required" +command -v tar >/dev/null 2>&1 || die "tar is required" + +if [ -z "$VERSION" ]; then + VERSION=$(curl -fsSL "https://api.github.com/repos/$REPO/releases/latest" 2>/dev/null \ + | sed -n 's/.*"tag_name": *"v\{0,1\}\([^"]*\)".*/\1/p' | head -1) + [ -n "$VERSION" ] || die "could not read the latest release — pass one: install.sh v2.8.1" +fi +VERSION="${VERSION#v}" + +URL="https://github.com/$REPO/releases/download/v$VERSION/opencode-antigravity-auth-$VERSION.tgz" +TMP="$(mktemp -d)" +trap 'rm -rf "$TMP"' EXIT + +say "Antigravity Auth $VERSION" +say " downloading $URL" +curl -fsSL -o "$TMP/plugin.tgz" "$URL" || die "download failed — does v$VERSION exist?" + +tar -xzf "$TMP/plugin.tgz" -C "$TMP" 2>/dev/null || die "the archive did not unpack" +[ -f "$TMP/package/dist/index.js" ] || die "the archive has no dist/index.js — is that a release tarball?" + +rm -rf "$DEST" +mkdir -p "$DEST" +cp -a "$TMP/package" "$DEST/package" +PLUGIN_PATH="$DEST/package" +say " files $PLUGIN_PATH" + +mkdir -p "$CONFIG_DIR" + +MAJOR="" +if command -v opencode >/dev/null 2>&1; then + MAJOR=$(opencode --version 2>/dev/null | sed -n 's/^\([0-9]*\)\..*/\1/p' | head -1) +fi + +if command -v python3 >/dev/null 2>&1; then + OPENCODE_MAJOR="$MAJOR" python3 - "$CONFIG" "$PLUGIN_PATH" <<'PY' +import json, os, sys + +path, plugin = sys.argv[1], sys.argv[2] +data = {} +if os.path.exists(path): + try: + with open(path) as fh: + data = json.load(fh) or {} + except Exception: + sys.exit("error: %s is not valid JSON — fix it and run again" % path) + if not isinstance(data, dict): + sys.exit("error: %s does not hold a JSON object" % path) + +# OpenCode v1 reads "plugin", v2 reads "plugins". An existing key wins so the +# installer never turns a working config into one the running version ignores. +if "plugins" in data: + key = "plugins" +elif "plugin" in data: + key = "plugin" +elif (os.environ.get("OPENCODE_MAJOR") or "").isdigit() and int(os.environ["OPENCODE_MAJOR"]) >= 2: + key = "plugins" +else: + key = "plugin" + +entries = data.get(key) or [] +if isinstance(entries, str): + entries = [entries] +entries = [ + e for e in entries + if not (isinstance(e, str) and ("opencode-antigravity-auth" in e or "antigravity" in e)) +] +entries.append(plugin) +data[key] = entries + +with open(path, "w") as fh: + json.dump(data, fh, indent=2) + fh.write("\n") +print(" config %s (%s)" % (path, key)) + +stale = [e for e in entries[:-1] if isinstance(e, str) and e.startswith("/")] +if stale: + print(" note these entries load another copy — remove them if they point to it:") + for e in stale: + print(" %s" % e) +PY +else + say "" + say "python3 is not available, so add this by hand to $CONFIG:" + say " \"plugin\": [\"$PLUGIN_PATH\"]" +fi + +say "" +say "Done. Next:" +say " 1. opencode auth login # choose Antigravity, finish the browser flow" +say " 2. opencode models # the antigravity models should now be listed" +say "" +say "Re-run this script to upgrade; it replaces $DEST." diff --git a/package.json b/package.json index 514013e..37a4aa9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "opencode-antigravity-auth", - "version": "2.8.0", + "version": "2.8.1", "description": "Google Antigravity IDE OAuth auth plugin for OpenCode v2 - access Gemini 4 Argon, 3.8 Flash, and Claude models using Google credentials", "main": "./dist/index.js", "types": "./dist/index.d.ts",