@psnext/slingcli 2.4.20260523-1 → 2.4.20260523-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.
package/bin/sling.js CHANGED
@@ -98,6 +98,13 @@ async function runCommand(command, args) {
98
98
  const NON_INTERACTIVE_SUBCOMMANDS = new Set([
99
99
  "install", "remove", "uninstall", "update", "list", "config",
100
100
  ]);
101
+
102
+ function isTruthyFlag(value) {
103
+ if (!value) return false;
104
+ const normalized = value.toLowerCase();
105
+ return value === "1" || normalized === "true" || normalized === "yes";
106
+ }
107
+
101
108
  function shouldSkipAutoInstall(argv) {
102
109
  if (process.env.SKIP_SLING_AUTO_INSTALL) return true;
103
110
  for (const a of argv) {
@@ -109,6 +116,30 @@ function shouldSkipAutoInstall(argv) {
109
116
  return false;
110
117
  }
111
118
 
119
+ function shouldSkipDefaultPackageUpdates(argv) {
120
+ if (argv.includes("--skip-pkg-update")) return true;
121
+ return isTruthyFlag(process.env.SKIP_SLING_PACKAGE_UPDATE_CHECK);
122
+ }
123
+
124
+ function hasUpdateRequest(argv) {
125
+ return argv.includes("-y") || argv.includes("--yes");
126
+ }
127
+
128
+ function stripUpdateRequestFlags(argv) {
129
+ return argv.filter((arg) => arg !== "-y" && arg !== "--yes");
130
+ }
131
+
132
+ function stripSlingWrapperFlags(argv) {
133
+ // Wrapper-only flags. They should not be forwarded to pi-coding-agent,
134
+ // which does not recognize them.
135
+ return argv.filter(
136
+ (arg) =>
137
+ arg !== "--skip-pkg-update" &&
138
+ arg !== "-y" &&
139
+ arg !== "--yes",
140
+ );
141
+ }
142
+
112
143
  function syncBundledSkills() {
113
144
  if (shouldSkipAutoInstall(process.argv.slice(2))) return;
114
145
 
@@ -131,8 +162,8 @@ function syncBundledSkills() {
131
162
  }
132
163
  }
133
164
 
134
- async function checkAndInstallPackages() {
135
- if (shouldSkipAutoInstall(process.argv.slice(2))) return;
165
+ async function checkAndInstallPackages(argv = process.argv.slice(2)) {
166
+ if (shouldSkipAutoInstall(argv)) return;
136
167
 
137
168
  const configPath = path.resolve(__dirname, "../sling-default-packages.json");
138
169
  if (!existsSync(configPath)) return;
@@ -172,19 +203,24 @@ async function checkAndInstallPackages() {
172
203
  for (const u of unsupported) installed.delete(u);
173
204
 
174
205
  const config = JSON.parse(readFileSync(configPath, "utf-8"));
175
- const updatePackages = (config.packages || []).filter((p) => {
176
- const source = typeof p === "object" && p !== null ? p.source : p;
177
- return installed.has(source);
178
- });
179
- for (const pkg of updatePackages) {
180
- console.log(`Updating ${pkg}...`);
181
- try {
182
- await runCommand(process.execPath, [__filename, "update", pkg]);
183
- console.log(`✓ Updated ${pkg}`);
184
- } catch (err) {
185
- console.error(`✗ Failed to update ${pkg}:`, err.message);
186
- console.error(` You can manually update it later with: sling update ${pkg}`);
206
+
207
+ if (!shouldSkipDefaultPackageUpdates(argv)) {
208
+ const updatePackages = (config.packages || []).filter((p) => {
209
+ const source = typeof p === "object" && p !== null ? p.source : p;
210
+ return installed.has(source);
211
+ });
212
+ for (const pkg of updatePackages) {
213
+ console.log(`Updating ${pkg}...`);
214
+ try {
215
+ await runCommand(process.execPath, [__filename, "update", pkg]);
216
+ console.log(`✓ Updated ${pkg}`);
217
+ } catch (err) {
218
+ console.error(`✗ Failed to update ${pkg}:`, err.message);
219
+ console.error(` You can manually update it later with: sling update ${pkg}`);
220
+ }
187
221
  }
222
+ } else {
223
+ console.log("Skipping default package updates (--skip-pkg-update).");
188
224
  }
189
225
  const packages = (config.packages || []).filter((p) => {
190
226
  const source = typeof p === "object" && p !== null ? p.source : p;
@@ -215,7 +251,7 @@ async function checkForUpdate(args) {
215
251
  if (args.includes("--version") || args.includes("-v")) return;
216
252
  if (args.includes("install")) return;
217
253
 
218
- const autoYes = args.includes("-y") || args.includes("--yes");
254
+ const autoYes = hasUpdateRequest(args);
219
255
 
220
256
  if (!autoYes && (!process.stdin.isTTY || !process.stdout.isTTY)) return;
221
257
 
@@ -253,12 +289,22 @@ async function checkForUpdate(args) {
253
289
  console.log("Installing @psnext/slingcli@" + latestVersion + "...");
254
290
  try {
255
291
  await runCommand("npm", ["install", "-g", "@psnext/slingcli@latest"]);
256
- console.log("✓ Updated to " + latestVersion + ". Please run 'sling' again.");
257
- process.exit(0);
258
292
  } catch {
259
293
  console.error("✗ Auto-update failed. Run manually:");
260
294
  console.error(" npm install -g @psnext/slingcli@latest");
261
295
  console.error(" (you may need sudo)");
296
+ return;
297
+ }
298
+
299
+ console.log("✓ Updated to " + latestVersion + ". Restarting sling...");
300
+ const restartArgs = stripUpdateRequestFlags(args);
301
+ try {
302
+ await runCommand(process.execPath, [__filename, ...restartArgs]);
303
+ process.exit(0);
304
+ } catch {
305
+ console.error("✓ Updated, but failed to restart automatically.");
306
+ console.error(" Please run: sling " + restartArgs.join(" "));
307
+ process.exit(0);
262
308
  }
263
309
  }
264
310
 
@@ -341,9 +387,9 @@ async function run() {
341
387
  setGlobalDispatcher(new EnvHttpProxyAgent({ bodyTimeout: 0, headersTimeout: 0 }));
342
388
  await productionOnly(checkForUpdate, rawArgs);
343
389
  syncBundledSkills();
344
- await productionOnly(checkAndInstallPackages);
390
+ await productionOnly(checkAndInstallPackages, rawArgs);
345
391
  setBedrockProviderModule(bedrockProviderModule);
346
- let args = applyNoEnv(rawArgs);
392
+ let args = applyNoEnv(stripSlingWrapperFlags(rawArgs));
347
393
  args = await promptInstallScopeIfNeeded(args);
348
394
 
349
395
  // Built-in subcommands are dispatched by parsePackageCommand, which only
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@psnext/slingcli",
3
- "version": "2.4.20260523-1",
3
+ "version": "2.4.20260523-3",
4
4
  "description": "Connects Sling CLI to Publicis Sapient Slingshot enterprise LLM gateway. Bundles the pi coding-agent runtime.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -29,7 +29,7 @@
29
29
  "type": "git",
30
30
  "url": "git+https://pscode.lioncloud.net/psaiproducts/slingcli.git"
31
31
  },
32
- "slingVersion": "2.4.20260523-1",
32
+ "slingVersion": "2.4.20260523-3",
33
33
  "dependencies": {
34
34
  "@earendil-works/pi-tui": "file:../.sling-pack/earendil-works-pi-tui-0.75.4.tgz",
35
35
  "@earendil-works/pi-ai": "file:../.sling-pack/earendil-works-pi-ai-0.75.4.tgz",
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "packages": [
3
+ "npm:pi-intercom",
3
4
  "npm:@psnext/s-subagents",
4
5
  "npm:pi-ask-user",
5
6
  "npm:pi-hermes-memory",