nolo-cli 0.160.0-alpha.2 → 0.160.0-alpha.3

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.
@@ -912,6 +912,144 @@ async function runShellScript(script, {
912
912
  ]);
913
913
  return exitCode;
914
914
  }
915
+ function shellQuote(value) {
916
+ return "'" + value.replace(/'/g, "'\\''") + "'";
917
+ }
918
+ function buildStandaloneUpdateScript(args) {
919
+ const curl = "curl -fL --progress-bar --connect-timeout 20 --max-time 600 --speed-limit 1 --speed-time 60";
920
+ return `set -eu
921
+ EXTRACT_DIR=${shellQuote(args.extractDir)}
922
+ ENTRY=${shellQuote(args.symlinkPath)}
923
+ CURRENT_VERSION=${shellQuote(args.currentVersion)}
924
+ STAGING="$EXTRACT_DIR.new.$$"
925
+ BACKUP="$EXTRACT_DIR.old.$$"
926
+ LINK="$ENTRY.new.$$"
927
+ old_moved=0
928
+ new_moved=0
929
+ committed=0
930
+ cleanup() {
931
+ status=$?
932
+ trap - 0 HUP INT TERM
933
+ if [ "$committed" = 0 ]; then
934
+ if [ "$new_moved" = 1 ] && [ -d "$EXTRACT_DIR" ]; then
935
+ mv "$EXTRACT_DIR" "$STAGING" || exit 1
936
+ fi
937
+ if [ "$old_moved" = 1 ] && [ -d "$BACKUP" ]; then
938
+ mv "$BACKUP" "$EXTRACT_DIR" || exit 1
939
+ fi
940
+ fi
941
+ rm -rf "$STAGING"
942
+ rm -f "$LINK"
943
+ exit "$status"
944
+ }
945
+ # Refuse collisions before installing cleanup: never remove somebody else's path.
946
+ if [ -e "$STAGING" ] || [ -L "$STAGING" ] ||
947
+ [ -e "$BACKUP" ] || [ -L "$BACKUP" ] ||
948
+ [ -e "$LINK" ] || [ -L "$LINK" ]; then
949
+ echo "Error: update staging path already exists" >&2
950
+ exit 1
951
+ fi
952
+ mkdir -p "\${EXTRACT_DIR%/*}"
953
+ mkdir "$STAGING"
954
+ trap cleanup 0
955
+ trap 'exit 1' HUP INT TERM
956
+
957
+ echo ${shellQuote(`Downloading nolo from ${args.tarballUrl}...`)}
958
+ if ! ${curl} ${shellQuote(args.tarballUrl)} -o "$STAGING/bundle.tar.gz"; then
959
+ ${args.tarballUrl !== args.fallbackUrl ? `echo ${shellQuote(`Primary source unavailable, trying ${args.fallbackUrl}...`)}
960
+ if ! ${curl} ${shellQuote(args.fallbackUrl)} -o "$STAGING/bundle.tar.gz"; then
961
+ echo "Error: download failed" >&2
962
+ exit 1
963
+ fi` : `echo "Error: download failed" >&2
964
+ exit 1`}
965
+ fi
966
+ tar -xzf "$STAGING/bundle.tar.gz" -C "$STAGING"
967
+ rm -f "$STAGING/bundle.tar.gz"
968
+ chmod +x "$STAGING/nolo"
969
+ # A failing, empty or malformed version response must not touch the live install.
970
+ VERSION_TEXT=$("$STAGING/nolo" -v)
971
+ case "$VERSION_TEXT" in
972
+ "nolo-cli "*) VERSION=\${VERSION_TEXT#nolo-cli } ;;
973
+ *) VERSION=$VERSION_TEXT ;;
974
+ esac
975
+ CORE=\${VERSION%%[-+]*}
976
+ MAJOR=\${CORE%%.*}
977
+ REST=\${CORE#*.}
978
+ MINOR=\${REST%%.*}
979
+ PATCH=\${REST#*.}
980
+ case "$MAJOR:$MINOR:$PATCH" in
981
+ *[!0-9:]*|:*|*::*|*:) echo "Error: invalid bundle version" >&2; exit 1 ;;
982
+ esac
983
+ if [ "$CORE" != "$MAJOR.$MINOR.$PATCH" ]; then
984
+ echo "Error: invalid bundle version" >&2
985
+ exit 1
986
+ fi
987
+ case "$VERSION" in
988
+ *[!0-9A-Za-z.+-]*) echo "Error: invalid bundle version" >&2; exit 1 ;;
989
+ esac
990
+ case "$CURRENT_VERSION" in
991
+ "nolo-cli "*) CUR_VER=\${CURRENT_VERSION#nolo-cli } ;;
992
+ *) CUR_VER=$CURRENT_VERSION ;;
993
+ esac
994
+ CUR_CORE=\${CUR_VER%%[-+]*}
995
+ CUR_MAJOR=\${CUR_CORE%%.*}
996
+ CUR_REST=\${CUR_CORE#*.}
997
+ CUR_MINOR=\${CUR_REST%%.*}
998
+ CUR_PATCH=\${CUR_REST#*.}
999
+ if [ -n "$CUR_MAJOR" ] && [ -n "$CUR_MINOR" ] && [ -n "$CUR_PATCH" ]; then
1000
+ case "$CUR_MAJOR:$CUR_MINOR:$CUR_PATCH" in
1001
+ *[!0-9:]*|:*|*::*|*:) ;;
1002
+ *)
1003
+ if [ "$CUR_CORE" = "$CUR_MAJOR.$CUR_MINOR.$CUR_PATCH" ]; then
1004
+ is_downgrade=0
1005
+ if [ "$MAJOR" -lt "$CUR_MAJOR" ]; then
1006
+ is_downgrade=1
1007
+ elif [ "$MAJOR" -eq "$CUR_MAJOR" ]; then
1008
+ if [ "$MINOR" -lt "$CUR_MINOR" ]; then
1009
+ is_downgrade=1
1010
+ elif [ "$MINOR" -eq "$CUR_MINOR" ]; then
1011
+ if [ "$PATCH" -lt "$CUR_PATCH" ]; then
1012
+ is_downgrade=1
1013
+ fi
1014
+ fi
1015
+ fi
1016
+ if [ "$is_downgrade" = 1 ]; then
1017
+ echo "Error: refusing downgrade from $CURRENT_VERSION to $VERSION" >&2
1018
+ exit 11
1019
+ fi
1020
+ fi
1021
+ ;;
1022
+ esac
1023
+ fi
1024
+ if [ "$VERSION" = "$CURRENT_VERSION" ]; then
1025
+ echo "\u2713 Already up to date (nolo-cli $VERSION)."
1026
+ exit 10
1027
+ fi
1028
+ mkdir -p "\${ENTRY%/*}"
1029
+ # mv without -T is portable only when the destination is not a directory.
1030
+ if [ -d "$ENTRY" ] || [ -L "$EXTRACT_DIR" ]; then
1031
+ echo "Error: refusing directory entrypoint or symlink bundle directory" >&2
1032
+ exit 1
1033
+ fi
1034
+ ln -s "$EXTRACT_DIR/nolo" "$LINK"
1035
+ if [ -e "$EXTRACT_DIR" ]; then
1036
+ old_moved=1
1037
+ mv "$EXTRACT_DIR" "$BACKUP"
1038
+ fi
1039
+ new_moved=1
1040
+ mv "$STAGING" "$EXTRACT_DIR"
1041
+ mv -f "$LINK" "$ENTRY"
1042
+ committed=1
1043
+ # Retain only the newest recovery copy from this run; prune older backups.
1044
+ for old_copy in "$EXTRACT_DIR.old."*; do
1045
+ if [ -d "$old_copy" ] && [ ! -L "$old_copy" ] && [ "$old_copy" != "$BACKUP" ]; then
1046
+ rm -rf "$old_copy"
1047
+ fi
1048
+ done
1049
+ # Retain the previous bundle as a recovery copy; never unlink the live entry.
1050
+ echo "nolo updated to $ENTRY"
1051
+ `;
1052
+ }
915
1053
  async function runStandaloneBundleUpdate(options) {
916
1054
  const output = options.output ?? process.stdout;
917
1055
  const spawn2 = options.spawn ?? resolveDefaultSpawn();
@@ -937,33 +1075,13 @@ async function runStandaloneBundleUpdate(options) {
937
1075
  const extractDir = join2(homedir2(), ".nolo", extractSubdir);
938
1076
  const installDir = resolveStandaloneInstallDir();
939
1077
  const symlinkPath = join2(installDir, "nolo");
940
- const script = `set -euo pipefail
941
- TEMP_DIR=$(mktemp -d)
942
- trap 'rm -rf "$TEMP_DIR"' EXIT
943
-
944
- echo "Downloading nolo from ${tarballUrl}..."
945
- if ! curl -fL --progress-bar "${tarballUrl}" -o "$TEMP_DIR/${tarballName}"; then
946
- ${tarballUrl !== fallbackUrl ? `echo "Primary source unavailable, trying ${fallbackUrl}..."
947
- if ! curl -fL --progress-bar "${fallbackUrl}" -o "$TEMP_DIR/${tarballName}"; then
948
- echo "Error: download failed from ${fallbackUrl}" >&2
949
- exit 1
950
- fi` : `echo "Error: download failed from ${tarballUrl}" >&2
951
- exit 1`}
952
- fi
953
-
954
- mkdir -p "${extractDir}"
955
- tar -xzf "$TEMP_DIR/${tarballName}" -C "${extractDir}"
956
- chmod +x "${extractDir}/nolo"
957
-
958
- mkdir -p "${installDir}"
959
- if [ -e "${symlinkPath}" ] || [ -L "${symlinkPath}" ]; then
960
- rm -f "${symlinkPath}"
961
- fi
962
- ln -s "${extractDir}/nolo" "${symlinkPath}"
963
- trap - EXIT
964
-
965
- echo "nolo updated to ${installDir}/nolo"
966
- `;
1078
+ const script = buildStandaloneUpdateScript({
1079
+ tarballUrl,
1080
+ fallbackUrl,
1081
+ extractDir,
1082
+ symlinkPath,
1083
+ currentVersion: readPackageInfo().version
1084
+ });
967
1085
  output.write(`
968
1086
  Nolo Agent CLI Installer & Updater
969
1087
  `);
@@ -980,6 +1098,11 @@ Nolo Agent CLI Installer & Updater
980
1098
  env,
981
1099
  useCustomSink
982
1100
  });
1101
+ if (exitCode === 10) {
1102
+ output.write(` ${renderProgressBar(100)}
1103
+ `);
1104
+ return 0;
1105
+ }
983
1106
  if (exitCode === 0) {
984
1107
  output.write(` ${renderProgressBar(100)}
985
1108
  `);
@@ -1167,6 +1290,7 @@ export {
1167
1290
  buildSelfUpdateCommand,
1168
1291
  resolveSelfUpdateServerUrl,
1169
1292
  buildCliDoctorText,
1293
+ buildStandaloneUpdateScript,
1170
1294
  runStandaloneBundleUpdate,
1171
1295
  NOLO_UPDATE_CHECK_KILL_SWITCH,
1172
1296
  compareCliVersions,
@@ -546,7 +546,7 @@ function getSystemInternalCommandEntries(renderHelpText2) {
546
546
  return runDoctorRuntimeCommand(args, deps);
547
547
  }),
548
548
  createContextCommand(["doctor"], "Show CLI doctor information", async (_args, ctx) => {
549
- const { buildCliDoctorText, getCliInstallChannel, resolveSelfUpdateServerUrl } = await import("./updateCommands-KALLBWJE.js");
549
+ const { buildCliDoctorText, getCliInstallChannel, resolveSelfUpdateServerUrl } = await import("./updateCommands-ODWC7SK7.js");
550
550
  const { isCompiledBinary } = await import("./cliEnvHelpers-ZXNMX7VV.js");
551
551
  const serverUrl = resolveSelfUpdateServerUrl(ctx.env);
552
552
  console.log(
@@ -563,7 +563,7 @@ function getSystemInternalCommandEntries(renderHelpText2) {
563
563
  return 0;
564
564
  }),
565
565
  createContextCommand(["update"], "Update the CLI", async (_args, ctx) => {
566
- const { resolveSelfUpdateServerUrl, runSelfUpdate } = await import("./updateCommands-KALLBWJE.js");
566
+ const { resolveSelfUpdateServerUrl, runSelfUpdate } = await import("./updateCommands-ODWC7SK7.js");
567
567
  return runSelfUpdate({
568
568
  entrypointPath: ctx.entrypointPath,
569
569
  serverUrl: resolveSelfUpdateServerUrl(ctx.env),
@@ -576,17 +576,17 @@ function getSystemInternalCommandEntries(renderHelpText2) {
576
576
  return process.exitCode ?? 0;
577
577
  }),
578
578
  createContextCommand(["version"], "Show CLI version", async (_args, ctx) => {
579
- const { buildCliVersionText } = await import("./updateCommands-KALLBWJE.js");
579
+ const { buildCliVersionText } = await import("./updateCommands-ODWC7SK7.js");
580
580
  console.log(buildCliVersionText(ctx.packageInfo));
581
581
  return 0;
582
582
  }),
583
583
  createContextCommand(["--version"], "Show CLI version", async (_args, ctx) => {
584
- const { buildCliVersionText } = await import("./updateCommands-KALLBWJE.js");
584
+ const { buildCliVersionText } = await import("./updateCommands-ODWC7SK7.js");
585
585
  console.log(buildCliVersionText(ctx.packageInfo));
586
586
  return 0;
587
587
  }),
588
588
  createContextCommand(["-v"], "Show CLI version", async (_args, ctx) => {
589
- const { buildCliVersionText } = await import("./updateCommands-KALLBWJE.js");
589
+ const { buildCliVersionText } = await import("./updateCommands-ODWC7SK7.js");
590
590
  console.log(buildCliVersionText(ctx.packageInfo));
591
591
  return 0;
592
592
  }),
package/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  consumeWindowsUpdateStartupNotice,
8
8
  getWindowsUpdateStatus,
9
9
  readPackageInfo
10
- } from "./chunk-WR37DI7R.js";
10
+ } from "./chunk-2ODX2C4E.js";
11
11
  import {
12
12
  isCompiledBinary
13
13
  } from "./chunk-A7GB5UGH.js";
@@ -71,7 +71,7 @@ async function runScript(script, forwardedArgs, env) {
71
71
  return proc.exited;
72
72
  }
73
73
  async function launchTuiWorkspace(args2) {
74
- const { startTuiWorkspace } = await import("./readlineWorkspace-QHPB5LUC.js");
74
+ const { startTuiWorkspace } = await import("./readlineWorkspace-2DR5GHLQ.js");
75
75
  const { createTuiSummaryLlmCaller } = await import("./tuiSummaryLlmCaller-FESHBDTT.js");
76
76
  const { setCliAutoCompactionSummaryFallback } = await import("./localRuntimeAdapter-MO64KEOS.js");
77
77
  setCliAutoCompactionSummaryFallback(
@@ -85,7 +85,7 @@ async function launchTuiWorkspace(args2) {
85
85
  });
86
86
  }
87
87
  async function main() {
88
- const { createCliRuntimeContext, looksLikeDaemonShortcut, renderHelpText, resolveCommand, runResolvedCommand } = await import("./commandRegistry-A4OR4B4L.js");
88
+ const { createCliRuntimeContext, looksLikeDaemonShortcut, renderHelpText, resolveCommand, runResolvedCommand } = await import("./commandRegistry-4LWXIPNX.js");
89
89
  const { buildCliRuntimeEnv, loadProfileConfig } = await import("./profileConfig-KN3N2BLF.js");
90
90
  const { resolveTuiLaunchMode } = await import("./runtimeModeArgs-2Y7BALTO.js");
91
91
  const runtimeEnv = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nolo-cli",
3
- "version": "0.160.0-alpha.2",
3
+ "version": "0.160.0-alpha.3",
4
4
  "type": "module",
5
5
  "description": "Agent-first terminal workspace for Nolo",
6
6
  "bin": {
@@ -348,7 +348,7 @@ import {
348
348
  import {
349
349
  checkForCliUpdate,
350
350
  runSelfUpdateDetailed
351
- } from "./chunk-WR37DI7R.js";
351
+ } from "./chunk-2ODX2C4E.js";
352
352
  import {
353
353
  parseUserIdFromAuthToken,
354
354
  resolveAuthToken,
@@ -5,6 +5,7 @@ import {
5
5
  buildNpmSelfUpdateCommand,
6
6
  buildSelfUpdateCommand,
7
7
  buildStandaloneManualUpdateHint,
8
+ buildStandaloneUpdateScript,
8
9
  checkForCliUpdate,
9
10
  compareCliVersions,
10
11
  getCliInstallChannel,
@@ -16,7 +17,7 @@ import {
16
17
  runSelfUpdate,
17
18
  runSelfUpdateDetailed,
18
19
  runStandaloneBundleUpdate
19
- } from "./chunk-WR37DI7R.js";
20
+ } from "./chunk-2ODX2C4E.js";
20
21
  import "./chunk-A7GB5UGH.js";
21
22
  import "./chunk-OLZBQWZU.js";
22
23
  import "./chunk-LCBAMY2M.js";
@@ -33,6 +34,7 @@ export {
33
34
  buildNpmSelfUpdateCommand,
34
35
  buildSelfUpdateCommand,
35
36
  buildStandaloneManualUpdateHint,
37
+ buildStandaloneUpdateScript,
36
38
  checkForCliUpdate,
37
39
  compareCliVersions,
38
40
  getCliInstallChannel,