blun-king-cli 9.1.251 → 9.1.252

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.
@@ -982,6 +982,14 @@ function pathIsWithin(root, candidate) {
982
982
  && !path.isAbsolute(relative));
983
983
  }
984
984
 
985
+ function isManagedReleasePackageRoot(blunDir, packageRoot) {
986
+ if (typeof blunDir !== 'string' || typeof packageRoot !== 'string') return false;
987
+ return pathIsWithin(
988
+ path.join(path.resolve(blunDir), UPDATE_DIRECTORY, 'releases'),
989
+ path.resolve(packageRoot),
990
+ );
991
+ }
992
+
985
993
  function resolveInstallTempRoot(options) {
986
994
  if (typeof options.blunDir !== 'string' || options.blunDir.trim().length === 0) {
987
995
  throw new Error('INVALID_UPDATE_BLUN_HOME');
@@ -1533,7 +1541,11 @@ async function runUpdateFlow(options, explicitUpdate) {
1533
1541
  }
1534
1542
  if (installResult?.code === 0 && installResult?.verified === true) {
1535
1543
  updateProgress(4, 'Installation geprüft');
1536
- clearPendingUpdate(blunDir);
1544
+ if (explicitUpdate && installResult.preparedRuntime === true) {
1545
+ writePendingUpdate(blunDir, release.version);
1546
+ } else {
1547
+ clearPendingUpdate(blunDir);
1548
+ }
1537
1549
  try {
1538
1550
  writeCoreInstallSuccess(
1539
1551
  blunDir,
@@ -1584,8 +1596,23 @@ async function runUpdateFlow(options, explicitUpdate) {
1584
1596
  }
1585
1597
  }
1586
1598
 
1587
- function runExplicitUpdate(options) {
1588
- return runUpdateFlow(options, true);
1599
+ async function runExplicitUpdate(options) {
1600
+ let preparedRuntime = options.preparedRuntime;
1601
+ if (preparedRuntime === undefined
1602
+ && isManagedReleasePackageRoot(options.blunDir, options.packageRoot)) {
1603
+ const runningUpdate = options.prepareRunningUpdate && options.stageRuntime
1604
+ ? undefined
1605
+ : require('./running-update.cjs');
1606
+ preparedRuntime = await (options.prepareRunningUpdate || runningUpdate.prepareRunningUpdate)({
1607
+ currentVersion: options.currentVersion,
1608
+ sharedHome: options.blunDir,
1609
+ env: options.env,
1610
+ });
1611
+ if (preparedRuntime !== null) {
1612
+ (options.stageRuntime || runningUpdate.stageRuntime)(options.blunDir, preparedRuntime);
1613
+ }
1614
+ }
1615
+ return runUpdateFlow({ ...options, preparedRuntime }, true);
1589
1616
  }
1590
1617
 
1591
1618
  function runUpdateNotice(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.251",
3
+ "version": "9.1.252",
4
4
  "description": "BLUN CLI - your own AI agent with a Telegram channel. Get it done. With BLUN.",
5
5
  "license": "MIT",
6
6
  "bin": {