swytchcode 2.20.10 → 2.20.12

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 (2) hide show
  1. package/bin/swytchcode.js +11 -1
  2. package/package.json +7 -7
package/bin/swytchcode.js CHANGED
@@ -413,7 +413,17 @@ const KNOWN_SUBCOMMANDS = new Set([
413
413
  const userArgs = process.argv.slice(2);
414
414
  // Capture original arg BEFORE mutation
415
415
  const originalArg = process.argv[2] || '';
416
- const isCanonicalDemoArg = /^[\w]+\.[\w.]+$/.test(originalArg) && !originalArg.startsWith('-');
416
+ // Number of user-supplied args before any mutation of userArgs below. Used to
417
+ // tell "npx swytchcode <id>" (onboarding demo) apart from a real command that
418
+ // merely starts with a canonical ID, e.g. "npx swytchcode <id> --dry-run".
419
+ const userArgCount = process.argv.length - 2;
420
+ // A dotted canonical ID routes to the onboarding demo ONLY when it is the single
421
+ // argument. If the user passed additional args (flags like --dry-run, --input,
422
+ // or an explicit subcommand), those express real intent and must reach the CLI
423
+ // unchanged - the onboarding demo path discards trailing args and always runs a
424
+ // LIVE exec, so treating "<id> --dry-run" as a demo would turn a preview into a
425
+ // real, side-effectful call.
426
+ const isCanonicalDemoArg = userArgCount === 1 && /^[\w]+\.[\w.]+$/.test(originalArg) && !originalArg.startsWith('-');
417
427
  // A single bare word under npx is a potential (invalid) demo lookup - don't pass
418
428
  // through to cobra - UNLESS it's a real subcommand, in which case it must reach
419
429
  // the actual CLI like any other argument does.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swytchcode",
3
- "version": "2.20.10",
3
+ "version": "2.20.12",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://gitlab.com/swytchcode/cli.git"
@@ -28,11 +28,11 @@
28
28
  "README.md"
29
29
  ],
30
30
  "optionalDependencies": {
31
- "swytchcode-cli-darwin-arm64": "2.20.10",
32
- "swytchcode-cli-darwin-x64": "2.20.10",
33
- "swytchcode-cli-linux-arm64": "2.20.10",
34
- "swytchcode-cli-linux-x64": "2.20.10",
35
- "swytchcode-cli-win32-arm64": "2.20.10",
36
- "swytchcode-cli-win32-x64": "2.20.10"
31
+ "swytchcode-cli-darwin-arm64": "2.20.12",
32
+ "swytchcode-cli-darwin-x64": "2.20.12",
33
+ "swytchcode-cli-linux-arm64": "2.20.12",
34
+ "swytchcode-cli-linux-x64": "2.20.12",
35
+ "swytchcode-cli-win32-arm64": "2.20.12",
36
+ "swytchcode-cli-win32-x64": "2.20.12"
37
37
  }
38
38
  }