#!/usr/bin/env node // Bump the patch version in lockstep for the GUI (app/src-tauri/tauri.conf.json) // and the daemon/CLI (root Cargo.toml [workspace.package].version), so the app's // update check and the daemon's reported version never drift apart. import { readFileSync, writeFileSync } from "node:fs"; const TAURI_CONF = "app/src-tauri/tauri.conf.json"; const CARGO_TOML = "Cargo.toml"; const conf = JSON.parse(readFileSync(TAURI_CONF, "utf8")); const parts = conf.version.split(".").map((n) => parseInt(n, 10) || 0); parts[2] = (parts[2] || 0) + 1; const next = parts.join("."); conf.version = next; writeFileSync(TAURI_CONF, JSON.stringify(conf, null, 2) + "\n"); let cargo = readFileSync(CARGO_TOML, "utf8"); // Replace only the version inside [workspace.package], not dependency versions. cargo = cargo.replace( /(\[workspace\.package\][\s\S]*?version\s*=\s*")[^"]+(")/, `$1${next}$2` ); writeFileSync(CARGO_TOML, cargo); console.log(`version → ${next} (GUI + daemon)`);