@psnext/slingcli 2.4.20260505-5 → 2.4.20260505-6

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.
Files changed (55) hide show
  1. package/bin/sling.js +48 -2
  2. package/node_modules/semver/LICENSE +15 -0
  3. package/node_modules/semver/README.md +665 -0
  4. package/node_modules/semver/bin/semver.js +191 -0
  5. package/node_modules/semver/classes/comparator.js +143 -0
  6. package/node_modules/semver/classes/index.js +7 -0
  7. package/node_modules/semver/classes/range.js +557 -0
  8. package/node_modules/semver/classes/semver.js +333 -0
  9. package/node_modules/semver/functions/clean.js +8 -0
  10. package/node_modules/semver/functions/cmp.js +54 -0
  11. package/node_modules/semver/functions/coerce.js +62 -0
  12. package/node_modules/semver/functions/compare-build.js +9 -0
  13. package/node_modules/semver/functions/compare-loose.js +5 -0
  14. package/node_modules/semver/functions/compare.js +7 -0
  15. package/node_modules/semver/functions/diff.js +60 -0
  16. package/node_modules/semver/functions/eq.js +5 -0
  17. package/node_modules/semver/functions/gt.js +5 -0
  18. package/node_modules/semver/functions/gte.js +5 -0
  19. package/node_modules/semver/functions/inc.js +21 -0
  20. package/node_modules/semver/functions/lt.js +5 -0
  21. package/node_modules/semver/functions/lte.js +5 -0
  22. package/node_modules/semver/functions/major.js +5 -0
  23. package/node_modules/semver/functions/minor.js +5 -0
  24. package/node_modules/semver/functions/neq.js +5 -0
  25. package/node_modules/semver/functions/parse.js +18 -0
  26. package/node_modules/semver/functions/patch.js +5 -0
  27. package/node_modules/semver/functions/prerelease.js +8 -0
  28. package/node_modules/semver/functions/rcompare.js +5 -0
  29. package/node_modules/semver/functions/rsort.js +5 -0
  30. package/node_modules/semver/functions/satisfies.js +12 -0
  31. package/node_modules/semver/functions/sort.js +5 -0
  32. package/node_modules/semver/functions/valid.js +8 -0
  33. package/node_modules/semver/index.js +91 -0
  34. package/node_modules/semver/internal/constants.js +37 -0
  35. package/node_modules/semver/internal/debug.js +11 -0
  36. package/node_modules/semver/internal/identifiers.js +29 -0
  37. package/node_modules/semver/internal/lrucache.js +42 -0
  38. package/node_modules/semver/internal/parse-options.js +17 -0
  39. package/node_modules/semver/internal/re.js +223 -0
  40. package/node_modules/semver/package.json +78 -0
  41. package/node_modules/semver/preload.js +4 -0
  42. package/node_modules/semver/range.bnf +16 -0
  43. package/node_modules/semver/ranges/gtr.js +6 -0
  44. package/node_modules/semver/ranges/intersects.js +9 -0
  45. package/node_modules/semver/ranges/ltr.js +6 -0
  46. package/node_modules/semver/ranges/max-satisfying.js +27 -0
  47. package/node_modules/semver/ranges/min-satisfying.js +26 -0
  48. package/node_modules/semver/ranges/min-version.js +63 -0
  49. package/node_modules/semver/ranges/outside.js +82 -0
  50. package/node_modules/semver/ranges/simplify.js +49 -0
  51. package/node_modules/semver/ranges/subset.js +249 -0
  52. package/node_modules/semver/ranges/to-comparators.js +10 -0
  53. package/node_modules/semver/ranges/valid.js +13 -0
  54. package/package.json +4 -3
  55. package/slingshot/index.js +1 -1
package/bin/sling.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  process.title = "sling";
3
3
 
4
- const SLING_VERSION = "2.4.20260505-5";
4
+ const SLING_VERSION = "2.4.20260505-6";
5
5
 
6
6
  import { setBedrockProviderModule } from "@mariozechner/pi-ai";
7
7
  import { bedrockProviderModule } from "@mariozechner/pi-ai/bedrock-provider";
@@ -12,6 +12,8 @@ import { fileURLToPath } from "node:url";
12
12
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
13
13
  import { homedir } from "node:os";
14
14
  import { spawn } from "node:child_process";
15
+ import readline from "node:readline/promises";
16
+ import semver from "semver";
15
17
 
16
18
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
17
19
 
@@ -86,14 +88,58 @@ async function checkAndInstallPackages() {
86
88
  }
87
89
  }
88
90
 
91
+ async function checkForUpdate(args) {
92
+ if (process.env.SKIP_SLING_AUTO_UPDATE_CHECK) return;
93
+ if (args.includes("--version") || args.includes("-v")) return;
94
+ if (args.includes("install")) return;
95
+ if (!process.stdin.isTTY || !process.stdout.isTTY) return;
96
+
97
+ let latestVersion;
98
+ try {
99
+ const res = await fetch("https://registry.npmjs.org/@psnext/slingcli/latest", {
100
+ signal: AbortSignal.timeout(10000),
101
+ headers: { accept: "application/json" },
102
+ });
103
+ if (!res.ok) return;
104
+ const data = await res.json();
105
+ latestVersion = data.version;
106
+ } catch {
107
+ return;
108
+ }
109
+
110
+ if (!latestVersion || !semver.gt(latestVersion, SLING_VERSION)) return;
111
+
112
+ console.log(`A new version ${latestVersion} is available (current ${SLING_VERSION}).`);
113
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
114
+ let answer;
115
+ try {
116
+ answer = (await rl.question("Update now? [Y/n] ")).trim().toLowerCase();
117
+ } finally {
118
+ rl.close();
119
+ }
120
+ if (answer.startsWith("n")) return;
121
+
122
+ console.log("Installing @psnext/slingcli@" + latestVersion + "...");
123
+ try {
124
+ await runCommand("npm", ["install", "-g", "@psnext/slingcli@latest"]);
125
+ console.log("\u2713 Updated to " + latestVersion + ". Please run 'sling' again.");
126
+ process.exit(0);
127
+ } catch {
128
+ console.error("\u2717 Auto-update failed. Run manually:");
129
+ console.error(" npm install -g @psnext/slingcli@latest");
130
+ console.error(" (you may need sudo)");
131
+ }
132
+ }
133
+
89
134
  async function run() {
90
135
  const rawArgs = process.argv.slice(2);
91
136
  if (rawArgs.includes("--version") || rawArgs.includes("-v")) {
92
137
  console.log(SLING_VERSION);
93
138
  process.exit(0);
94
139
  }
95
- await checkAndInstallPackages();
96
140
  setGlobalDispatcher(new EnvHttpProxyAgent());
141
+ await checkForUpdate(rawArgs);
142
+ await checkAndInstallPackages();
97
143
  setBedrockProviderModule(bedrockProviderModule);
98
144
  const args = applyNoEnv(rawArgs);
99
145
  const extensionPath = path.resolve(__dirname, "../slingshot");
@@ -0,0 +1,15 @@
1
+ The ISC License
2
+
3
+ Copyright (c) Isaac Z. Schlueter and Contributors
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
15
+ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.