From 2e57b610ed669c7bf1f7972de50be9bc8b6d345b Mon Sep 17 00:00:00 2001 From: David Abram Date: Thu, 2 Jul 2026 23:44:18 +0200 Subject: [PATCH] release: Add bump-version tool and bump to 0.3.0 Co-authored-by: SCE --- .version | 2 +- cli/Cargo.lock | 2 +- cli/Cargo.toml | 2 +- flake.nix | 17 +++ nix/bump-version.sh | 111 ++++++++++++++++++ npm/package.json | 2 +- .../flatpak/dev.crocoder.sce.metainfo.xml | 2 +- 7 files changed, 133 insertions(+), 5 deletions(-) create mode 100755 nix/bump-version.sh diff --git a/.version b/.version index 15e330bc..0d91a54c 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.3.0-pre-alpha-v6 +0.3.0 diff --git a/cli/Cargo.lock b/cli/Cargo.lock index 57cf6386..36e86732 100644 --- a/cli/Cargo.lock +++ b/cli/Cargo.lock @@ -3383,7 +3383,7 @@ dependencies = [ [[package]] name = "shared-context-engineering" -version = "0.3.0-pre-alpha-v6" +version = "0.3.0" dependencies = [ "anyhow", "apple-native-keyring-store", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 85995b53..31d2aa30 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "shared-context-engineering" -version = "0.3.0-pre-alpha-v6" +version = "0.3.0" edition = "2021" description = "Shared Context Engineering CLI" license = "Apache-2.0" diff --git a/flake.nix b/flake.nix index 89a41e98..cca7a939 100644 --- a/flake.nix +++ b/flake.nix @@ -970,6 +970,15 @@ text = builtins.readFile ./nix/flatpak/version-parity.sh; }; + bumpVersionApp = pkgs.writeShellApplication { + name = "bump-version"; + runtimeInputs = [ + pkgs.coreutils + pkgs.gnused + ]; + text = builtins.readFile ./nix/bump-version.sh; + }; + flatpakLocalManifestCheckApp = pkgs.writeShellApplication { name = "flatpak-local-manifest-check"; runtimeInputs = [ pkgs.coreutils ]; @@ -1418,6 +1427,14 @@ }; }; + bump-version = { + type = "app"; + program = "${bumpVersionApp}/bin/bump-version"; + meta = { + description = "Bump the checked-in version in .version, Cargo.toml, Cargo.lock, npm package.json, and Flatpak metainfo"; + }; + }; + } // pkgs.lib.optionalAttrs pkgs.stdenv.isLinux { sce-flatpak = { diff --git a/nix/bump-version.sh b/nix/bump-version.sh new file mode 100755 index 00000000..dbd10f1c --- /dev/null +++ b/nix/bump-version.sh @@ -0,0 +1,111 @@ +#!/usr/bin/env bash +set -euo pipefail + +APP_ID="dev.crocoder.sce" + +usage() { + printf 'usage: bump-version.sh --repo-root --version \n\n' >&2 + printf 'Updates .version, cli/Cargo.toml, cli/Cargo.lock, npm/package.json,\n' >&2 + printf 'and packaging/flatpak/%s.metainfo.xml to match --version.\n' "$APP_ID" >&2 + printf '\n' >&2 + printf 'Options:\n' >&2 + printf ' --repo-root Repository root directory\n' >&2 + printf ' --version New version to set\n' >&2 + printf ' --from Previous version (optional; auto-detected from .version if omitted)\n' >&2 + printf ' --dry-run Print changes without writing\n' >&2 + printf ' -h, --help Show this help\n' >&2 +} + +fail_usage() { + usage + exit 2 +} + +repo_root="" +version="" +from_version="" +dry_run=0 + +while [[ $# -gt 0 ]]; do + case "$1" in + --repo-root) + [[ $# -ge 2 ]] || fail_usage + repo_root="$2" + shift 2 + ;; + --version) + [[ $# -ge 2 ]] || fail_usage + version="$2" + shift 2 + ;; + --from) + [[ $# -ge 2 ]] || fail_usage + from_version="$2" + shift 2 + ;; + --dry-run) + dry_run=1 + shift + ;; + -h|--help) + usage + exit 0 + ;; + *) + fail_usage + ;; + esac +done + +[[ -n "$repo_root" ]] || fail_usage +[[ -n "$version" ]] || fail_usage + +version_path="$repo_root/.version" +cargo_toml_path="$repo_root/cli/Cargo.toml" +cargo_lock_path="$repo_root/cli/Cargo.lock" +npm_package_path="$repo_root/npm/package.json" +metainfo_path="$repo_root/packaging/flatpak/$APP_ID.metainfo.xml" + +if [[ -z "$from_version" ]]; then + from_version="$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' < "$version_path")" +fi + +files=( + "$version_path" + "$cargo_toml_path" + "$cargo_lock_path" + "$npm_package_path" + "$metainfo_path" +) + +for f in "${files[@]}"; do + if [[ ! -r "$f" ]]; then + printf 'error: could not read %s\n' "$f" >&2 + exit 1 + fi + if [[ ! -w "$f" ]] && [[ "$dry_run" -ne 1 ]]; then + printf 'error: %s is not writable\n' "$f" >&2 + exit 1 + fi +done + +changes=0 + +for f in "${files[@]}"; do + rel="${f#"$repo_root"/}" + if grep -qF "$from_version" "$f"; then + printf ' %s: %s -> %s\n' "$rel" "$from_version" "$version" + if [[ "$dry_run" -ne 1 ]]; then + sed -i "s/\\b$from_version\\b/$version/g" "$f" + fi + changes=$((changes + 1)) + else + printf ' %s: warning: did not find %s, skipping\n' "$rel" "$from_version" + fi +done + +if [[ "$dry_run" -eq 1 ]]; then + printf 'Dry run: %d file(s) would change\n' "$changes" +else + printf 'Bumped %d file(s) to %s\n' "$changes" "$version" +fi diff --git a/npm/package.json b/npm/package.json index 6882238f..9dfb1d73 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "@crocoder-dev/sce", - "version": "0.3.0-pre-alpha-v6", + "version": "0.3.0", "description": "npm launcher package for the Shared Context Engineering CLI", "type": "module", "private": false, diff --git a/packaging/flatpak/dev.crocoder.sce.metainfo.xml b/packaging/flatpak/dev.crocoder.sce.metainfo.xml index 222b889a..30c20cc9 100644 --- a/packaging/flatpak/dev.crocoder.sce.metainfo.xml +++ b/packaging/flatpak/dev.crocoder.sce.metainfo.xml @@ -21,7 +21,7 @@ sce - +