@clubnet/seedclub 0.2.42 → 0.2.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -395,6 +395,7 @@ const SEEDCLUB_AUTH_GATE_STATE_KEY = "__seedclubAuthGateState";
|
|
|
395
395
|
const SEEDCLUB_SHELL_WELCOME_STATE_KEY = "__seedclubShellWelcomeState";
|
|
396
396
|
const UPDATE_PREFS_FILE = join(homedir(), ".seedclub", "agent", ".seedclub-update-prefs.json");
|
|
397
397
|
const UPDATE_COMMAND = "npm install -g @clubnet/seedclub@latest";
|
|
398
|
+
const STARTUP_UPDATE_CHECK_TIMEOUT_MS = 2500;
|
|
398
399
|
const SEEDCLUB_CONFIG_DIR = join(homedir(), ".config", "seedclub");
|
|
399
400
|
const SEEDCLUB_TOKEN_FILE = join(SEEDCLUB_CONFIG_DIR, "token");
|
|
400
401
|
const SEEDCLUB_BASES_FILE = join(SEEDCLUB_CONFIG_DIR, "bases.json");
|
|
@@ -1291,31 +1292,54 @@ export class SeedclubInteractiveModeApp {
|
|
|
1291
1292
|
this.updateAnnouncementShown = true;
|
|
1292
1293
|
}
|
|
1293
1294
|
|
|
1295
|
+
async getAvailableUpdateInfo(options = {}) {
|
|
1296
|
+
const installed = getInstalledVersionInfo();
|
|
1297
|
+
if (!installed?.seedclubVersion) return null;
|
|
1298
|
+
const latest = await getLatestVersionInfo();
|
|
1299
|
+
if (!latest) return null;
|
|
1300
|
+
if (compareSemver(latest, installed.seedclubVersion) <= 0) return null;
|
|
1301
|
+
const prefs = getUpdatePrefs();
|
|
1302
|
+
if (options.respectSkip !== false && prefs.skipVersion === latest) return null;
|
|
1303
|
+
return {
|
|
1304
|
+
installedVersion: installed.seedclubVersion,
|
|
1305
|
+
latestVersion: latest,
|
|
1306
|
+
};
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1294
1309
|
startBackgroundUpdateCheck() {
|
|
1295
1310
|
if (this.updateCheckStarted) return;
|
|
1296
1311
|
this.updateCheckStarted = true;
|
|
1297
1312
|
this.updateAnnouncementShown = false;
|
|
1298
1313
|
this.setAvailableUpdate(null, null);
|
|
1299
1314
|
void (async () => {
|
|
1300
|
-
const
|
|
1301
|
-
if (!
|
|
1302
|
-
|
|
1303
|
-
if (!latest) return;
|
|
1304
|
-
if (compareSemver(latest, installed.seedclubVersion) <= 0) return;
|
|
1305
|
-
const prefs = getUpdatePrefs();
|
|
1306
|
-
if (prefs.skipVersion === latest) return;
|
|
1307
|
-
this.setAvailableUpdate(installed.seedclubVersion, latest);
|
|
1315
|
+
const update = await this.getAvailableUpdateInfo();
|
|
1316
|
+
if (!update) return;
|
|
1317
|
+
this.setAvailableUpdate(update.installedVersion, update.latestVersion);
|
|
1308
1318
|
this.maybeAnnounceAvailableUpdate();
|
|
1309
1319
|
})().catch(() => {});
|
|
1310
1320
|
}
|
|
1311
1321
|
|
|
1312
|
-
async
|
|
1322
|
+
async maybeShowStartupUpdateMenu() {
|
|
1323
|
+
const update = await withTimeout(
|
|
1324
|
+
this.getAvailableUpdateInfo(),
|
|
1325
|
+
STARTUP_UPDATE_CHECK_TIMEOUT_MS,
|
|
1326
|
+
null,
|
|
1327
|
+
);
|
|
1328
|
+
if (!update) return false;
|
|
1329
|
+
this.updateCheckStarted = true;
|
|
1330
|
+
this.setAvailableUpdate(update.installedVersion, update.latestVersion);
|
|
1331
|
+
await this.showUpdateMenu({ availableUpdate: update });
|
|
1332
|
+
this.updateAnnouncementShown = true;
|
|
1333
|
+
return true;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
async showUpdateMenu(options = {}) {
|
|
1313
1337
|
const installed = getInstalledVersionInfo();
|
|
1314
1338
|
if (!installed?.seedclubVersion) {
|
|
1315
1339
|
this.showExtensionNotify("Unable to determine the installed seedclub version.", "error");
|
|
1316
1340
|
return;
|
|
1317
1341
|
}
|
|
1318
|
-
const latest = await getLatestVersionInfo();
|
|
1342
|
+
const latest = options.availableUpdate?.latestVersion ?? await getLatestVersionInfo();
|
|
1319
1343
|
if (!latest) {
|
|
1320
1344
|
this.showExtensionNotify("Unable to check npm for the latest seedclub version.", "error");
|
|
1321
1345
|
return;
|
|
@@ -2554,9 +2578,10 @@ export class SeedclubInteractiveModeApp {
|
|
|
2554
2578
|
this.ui.setFocus(this.editor);
|
|
2555
2579
|
await this.bindExtensions();
|
|
2556
2580
|
this.configureAutocomplete();
|
|
2557
|
-
this.bindShellUiLifecycle();
|
|
2558
2581
|
this.unsubscribe = this.session.subscribe((event) => this.handleSessionEvent(event));
|
|
2559
2582
|
this.ui.start();
|
|
2583
|
+
await this.maybeShowStartupUpdateMenu();
|
|
2584
|
+
this.bindShellUiLifecycle();
|
|
2560
2585
|
this.ui.requestRender(true);
|
|
2561
2586
|
}
|
|
2562
2587
|
|