Tell desktop app users when a newer release is out, and release 3.0.2

The app now asks GitHub for the newest vX.Y.Z tag when it starts and, when it is ahead, the top bar says so with a button that copies `plan2code update`. Before, the app only compared its own version with the installed skills, so it never knew a release existed.

Version 3.0.2 everywhere (version.json, package.json, the app's package.json, package-lock.json, Cargo.toml, Cargo.lock, tauri.conf.json, README, CHANGELOG).
This commit is contained in:
jparkerweb committed 2026-11-06 11:01:08 -08:00
1 parent 76e0c44e0b
commit 9226b82c37
15 files changed
+220 -17

No files matched your search

+33 -3
View File
@@ -2,7 +2,7 @@
// agent's terminal panel docked at the bottom with a drag handle.
import { mountTerminal } from './terminal.js';
import { attentionSignal, barNextSteps, continueKeys, defaultRightFraction, folderName, lastAgentNotice, pickDefaultAgent, taskbarSwitch, windowTitleFor, deadConsoleAction, loopBanner, loopLocks, loopStopLabels, loopWindowTitle } from './meter.js';
import { NEW_RELEASE_COMMAND, attentionSignal, barNextSteps, continueKeys, defaultRightFraction, folderName, lastAgentNotice, pickDefaultAgent, taskbarSwitch, windowTitleFor, deadConsoleAction, loopBanner, loopLocks, loopStopLabels, loopWindowTitle } from './meter.js';
const { invoke, Channel } = window.__TAURI__.core;
@@ -1012,6 +1012,29 @@ async function checkVersions() {
}
}
// Once, at start, and never waited on: is a newer Plan2Code release out on GitHub? The Rust
// side asks (the same tag lookup the web console uses) and answers with the newer version, or
// nothing when the app is current or the lookup failed.
async function checkNewRelease() {
try {
const latest = await invoke('check_new_release');
if (latest) setNewRelease({ latest, copied: false });
} catch {
// No answer is no reason to nag.
}
}
async function copyUpdateCommand() {
if (!newRelease) return;
try {
await navigator.clipboard.writeText(NEW_RELEASE_COMMAND);
setNewRelease({ ...newRelease, copied: true });
} catch {
// The webview refused the clipboard: the bar spells the command out instead.
setNewRelease({ ...newRelease, manual: true });
}
}
async function updateSkills() {
setVersionState({ kind: 'updating', line: 'Updating Plan2Code...' });
const progress = new Channel();
@@ -1225,11 +1248,12 @@ loopStopNowBtn.onclick = () =>
// barNextSteps decides which, and its button), with the rest as "+N more".
let consoleDead = false;
let versionState = null;
const NEXT_STEP_ACTIONS = { reconnect: reconnectConsole, 'restart-console': restartConsole, update: updateSkills };
let newRelease = null;
const NEXT_STEP_ACTIONS = { reconnect: reconnectConsole, 'restart-console': restartConsole, update: updateSkills, 'copy-update': copyUpdateCommand };
let nextStepAction = null;
function renderNextStep() {
const steps = barNextSteps({ consoleDead, version: versionState });
const steps = barNextSteps({ consoleDead, version: versionState, newRelease });
nextStepEl.hidden = steps.length === 0;
const [first, ...rest] = steps;
nextStepTextEl.textContent = first ? first.text : '';
@@ -1249,6 +1273,11 @@ function setVersionState(next) {
renderNextStep();
}
function setNewRelease(next) {
newRelease = next;
renderNextStep();
}
function markConsoleAlive() {
consoleDead = false;
renderNextStep();
@@ -1425,6 +1454,7 @@ async function main() {
applyDefaultAgent(state.lastAgent);
setInterval(updateBadge, BADGE_POLL_MS);
checkVersions();
checkNewRelease();
let reattach = null;
try {
+18 -1
View File
@@ -9,8 +9,14 @@ export const NEXT_STEP_LABELS = {
reconnect: 'Reconnect the console',
'restart-console': 'Reconnect the console',
update: 'Update skills',
'copy-update': 'Copy update command',
};
// What a person runs in a terminal to move to the newest release: the same line the web
// console's banner gives. The app cannot replace itself, and Update skills is pinned to the
// app's own version, so only this brings the app, the skills and the launcher up together.
export const NEW_RELEASE_COMMAND = 'plan2code update';
/**
* What the console page's **continue** button types into the agent's
* terminal, one write each: the word, then Enter. Claude Code holds typed
@@ -76,7 +82,7 @@ export function lastAgentNotice(list, remembered) {
* update, its Reconnect (which stops the old console first, so the new skills
* are really picked up) covers a console that has also stopped.
*/
export function barNextSteps({ consoleDead = false, version = null } = {}) {
export function barNextSteps({ consoleDead = false, version = null, newRelease = null } = {}) {
const v = version || {};
const steps = [];
if (v.kind === 'updated') {
@@ -108,6 +114,17 @@ export function barNextSteps({ consoleDead = false, version = null } = {}) {
default:
break;
}
// Last: the pending fix for a mismatch or a stopped console comes before a release that is
// merely out. `newRelease` is `{ latest, copied, manual }`.
if (newRelease && newRelease.latest) {
steps.push(
newRelease.manual
? { id: 'new-release', text: `Run \`${NEW_RELEASE_COMMAND}\` in a terminal, then reopen the app`, title: `Plan2Code v${newRelease.latest} is out. Run \`${NEW_RELEASE_COMMAND}\` in a terminal, then reopen the app.`, tone: 'warn', action: null }
: newRelease.copied
? { id: 'new-release', text: `Copied: run \`${NEW_RELEASE_COMMAND}\` in a terminal, then reopen the app`, title: `Plan2Code v${newRelease.latest} is out. Run \`${NEW_RELEASE_COMMAND}\` in a terminal, then reopen the app.`, tone: 'ok', action: null }
: { id: 'new-release', text: `Update available: v${newRelease.latest}`, title: `Plan2Code v${newRelease.latest} is out. Copy the command, run it in a terminal, then reopen the app.`, tone: 'warn', action: 'copy-update' }
);
}
return steps.map((step) => ({ ...step, label: step.action ? NEXT_STEP_LABELS[step.action] : null }));
}