diff --git a/CHANGELOG.md b/CHANGELOG.md index d877c2f..2c249a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,16 @@ All notable changes to `move` are documented here. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.3.3] - 2026-08-17 + +### Changed +- `install.sh` now installs the newest published tag by default instead of + tracking the `master` branch, so the plain `curl ... | sh` one-liner + installs a real release and reports its version (e.g. `v1.3.2`). The tag is + resolved from the Gitea tags API; if that lookup fails (offline, API + unreachable, or no tags yet) it falls back to `master`, preserving the old + behavior. Set `MOVE_VERSION` to pin an explicit branch or tag as before. + ## [1.3.2] - 2026-08-17 ### Added @@ -155,6 +165,7 @@ Initial release. - Source split into `src/{move,cli,config,keeper}.ts`. - `bin` entry + shebang so `bun link` registers `move` globally. +[1.3.3]: https://gitea.cahlen.com/nokeo08/Move/compare/v1.3.2...v1.3.3 [1.3.2]: https://gitea.cahlen.com/nokeo08/Move/compare/v1.3.1...v1.3.2 [1.3.1]: https://gitea.cahlen.com/nokeo08/Move/compare/v1.3.0...v1.3.1 [1.3.0]: https://gitea.cahlen.com/nokeo08/Move/compare/v1.2.0...v1.3.0 diff --git a/README.md b/README.md index 5db57d8..ac1991c 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,11 @@ cursor leaves the position the script just commanded. curl -fsSL https://gitea.cahlen.com/nokeo08/Move/raw/branch/master/scripts/install.sh | sh ``` -This fetches the latest `master` from Gitea, runs `bun install --production` -under the install dir, and drops a `move` wrapper on your bin dir. +This installs the latest tagged release from Gitea (the installer resolves +it automatically), runs `bun install --production` under the install dir, +and drops a `move` wrapper on your bin dir. If the latest tag can't be +determined — offline, or the API is unreachable — it falls back to the +`master` branch. Pin an exact ref with `MOVE_VERSION` (see below). The installer respects the XDG Base Directory Specification: @@ -40,7 +43,7 @@ one and it can reach a terminal, it tells you what's there and asks: ``` ==> Found an existing move install (v1.2.0) at /home/you/.local/share/move -Replace it with master? [Y/n] +Replace it with v1.3.2? [Y/n] ``` If a config file already exists, it asks separately whether to overwrite @@ -59,7 +62,7 @@ Env vars (all optional): | Var | Default | Purpose | | --- | ------- | ------- | -| `MOVE_VERSION` | `master` | Branch or tag to install. Pin with e.g. `v1.0.0`. | +| `MOVE_VERSION` | latest tag | Branch or tag to install; auto-resolves to the newest tag, falling back to `master`. Pin with e.g. `v1.0.0`. | | `MOVE_FORCE` | unset | Set to `1` to skip every prompt and reinstall unconditionally. Never touches your config. | | `MOVE_RESEED_CONFIG` | unset | Set to `1` to overwrite your config with the shipped defaults without asking. The old file is kept as `config.json.bak`. | | `XDG_DATA_HOME` | `$HOME/.local/share` | Where the source tree is installed (under `move/`). | diff --git a/package.json b/package.json index 0445744..5a0114f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "move", - "version": "1.3.2", + "version": "1.3.3", "private": true, "license": "GPL-3.0-only", "type": "module", diff --git a/scripts/install.sh b/scripts/install.sh index 86e4286..c575224 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -30,7 +30,9 @@ # version is replaced, and the config is left alone. # # Env vars (all optional): -# MOVE_VERSION Branch or tag to install. Default: master. +# MOVE_VERSION Branch or tag to install. Default: the newest tag +# published to the repo, falling back to the master +# branch if that can't be determined. # MOVE_FORCE Set to 1 to skip every prompt and reinstall # unconditionally. Does not touch the user config. # MOVE_RESEED_CONFIG Set to 1 to overwrite the user config with the @@ -52,7 +54,9 @@ REPO_OWNER="nokeo08" REPO_NAME="Move" GITEA_HOST="gitea.cahlen.com" -MOVE_VERSION="${MOVE_VERSION:-master}" +# Left empty when unset so it can be resolved to the latest tag once the +# prerequisite tools are confirmed present (see "Resolve version" below). +MOVE_VERSION="${MOVE_VERSION:-}" MOVE_FORCE="${MOVE_FORCE:-0}" MOVE_RESEED_CONFIG="${MOVE_RESEED_CONFIG:-0}" @@ -80,6 +84,20 @@ assert_safe_dir() { esac } +# Print the newest tag name published to the repo (e.g. v1.3.2), or return +# non-zero if it can't be determined. The Gitea tags API lists newest first, +# so with ?limit=1 the sole entry is the latest tag; grep+sed pull its "name" +# without a jq dependency. Any failure -- offline, API error, no tags, a +# missing grep/sed -- collapses to a non-zero return and lets the caller fall +# back to the master branch. +resolve_latest_tag() { + _tags_url="https://$GITEA_HOST/api/v1/repos/$REPO_OWNER/$REPO_NAME/tags?limit=1" + _json=$(curl -fsSL --max-time 10 "$_tags_url" 2>/dev/null) || return 1 + _tag=$(printf '%s' "$_json" | grep -o '"name":"[^"]*"' | head -n 1 | sed 's/.*:"//; s/"$//') + [ -n "$_tag" ] || return 1 + printf '%s\n' "$_tag" +} + # --- Interactive prompt support ---------------------------------------------- # # The documented entry point is `curl -fsSL ... | sh`, which means stdin is @@ -168,6 +186,23 @@ fi BUN_VERSION=$(bun --version) printf '==> Using bun %s\n' "$BUN_VERSION" +# --- Resolve version to install ---------------------------------------------- +# +# With no explicit MOVE_VERSION, default to the newest published tag so the +# plain one-liner installs a real release and reports its version (e.g. +# v1.3.2) rather than tracking the moving `master` branch. If the lookup +# fails -- offline, API unreachable, or no tags yet -- fall back to master, +# preserving the historical behavior instead of aborting. + +if [ -z "$MOVE_VERSION" ]; then + if MOVE_VERSION=$(resolve_latest_tag); then + printf '==> Latest release is %s\n' "$MOVE_VERSION" + else + MOVE_VERSION=master + printf '==> Could not determine latest release; installing from master\n' >&2 + fi +fi + # --- Existing install check -------------------------------------------------- # # Both questions this script can ask are asked here, before anything is