juggernaut-bedrock 4.2.1 → 4.2.2

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/index.js +56 -24
  2. package/package.json +9 -6
package/index.js CHANGED
@@ -1,54 +1,86 @@
1
+ #!/usr/bin/env node
1
2
  "use strict";
2
3
 
3
- const path = require("path");
4
- const { spawnSync } = require("child_process");
4
+ var path = require("path");
5
+ var child_process = require("child_process");
6
+ var fs = require("fs");
5
7
 
6
- const PACKAGES_DIR = path.join(__dirname, "packages");
8
+ var PACKAGES_DIR = path.join(__dirname, "packages");
7
9
 
8
- const PLATFORM_MAP = {
9
- "linux-x64": "juggernaut-bedrock-linux-x64",
10
- "linux-arm64": "juggernaut-bedrock-linux-arm64",
11
- "darwin-x64": "juggernaut-bedrock-darwin-x64",
10
+ var PLATFORM_MAP = {
11
+ "linux-x64": "juggernaut-bedrock-linux-x64",
12
+ "linux-arm64": "juggernaut-bedrock-linux-arm64",
13
+ "darwin-x64": "juggernaut-bedrock-darwin-x64",
12
14
  "darwin-arm64": "juggernaut-bedrock-darwin-arm64",
13
- "win32-x64": "juggernaut-bedrock-win32-x64",
15
+ "win32-x64": "juggernaut-bedrock-win32-x64"
14
16
  };
15
17
 
18
+ var VALID_PACKAGES = [
19
+ "juggernaut-bedrock-linux-x64",
20
+ "juggernaut-bedrock-linux-arm64",
21
+ "juggernaut-bedrock-darwin-x64",
22
+ "juggernaut-bedrock-darwin-arm64",
23
+ "juggernaut-bedrock-win32-x64"
24
+ ];
25
+
26
+ /**
27
+ * @param {string} platform
28
+ * @param {string} arch
29
+ * @returns {string|void}
30
+ */
16
31
  function getPlatformPackage(platform, arch) {
17
- return PLATFORM_MAP[`${platform}-${arch}`] || null;
32
+ return PLATFORM_MAP[platform + "-" + arch] || void 0;
18
33
  }
19
34
 
35
+ function containsPackage(pkgName) {
36
+ for (var i = 0; i < VALID_PACKAGES.length; i++) {
37
+ if (VALID_PACKAGES[i] === pkgName) {
38
+ return true;
39
+ }
40
+ }
41
+ return false;
42
+ }
43
+
44
+ /**
45
+ * @param {string} pkgName
46
+ * @param {string} platform
47
+ * @returns {string}
48
+ */
20
49
  function getBinaryPath(pkgName, platform) {
21
- const binaryName = platform === "win32" ? "juggernaut.exe" : "juggernaut";
22
- return path.join(PACKAGES_DIR, pkgName, "bin", binaryName);
50
+ if (!containsPackage(pkgName)) {
51
+ throw new Error("unexpected package name: " + pkgName);
52
+ }
53
+ var binaryName = platform === "win32" ? "juggernaut.exe" : "juggernaut";
54
+ return path.join(PACKAGES_DIR, pkgName, "bin", binaryName); // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
23
55
  }
24
56
 
25
57
  if (require.main === module) {
26
- const pkg = getPlatformPackage(process.platform, process.arch);
58
+ var pkg = getPlatformPackage(process.platform, process.arch);
27
59
  if (!pkg) {
28
60
  process.stderr.write(
29
- `juggernaut-bedrock: unsupported platform ${process.platform}/${process.arch}\n` +
30
- `Please file an issue: https://github.com/jpvelasco/juggernaut/issues\n`
61
+ "juggernaut-bedrock: unsupported platform " + process.platform + "/" + process.arch + "\n" +
62
+ "Please file an issue: https://github.com/jpvelasco/juggernaut/issues\n"
31
63
  );
32
64
  process.exit(1);
33
65
  }
34
66
 
35
- const bin = getBinaryPath(pkg, process.platform);
36
- const fs = require("fs");
67
+ var bin = getBinaryPath(pkg, process.platform);
68
+ // nosemgrep: javascript_pathtraversal_rule-non-literal-fs-filename, javascript.lang.security.audit.detect-non-literal-fs-filename
37
69
  if (!fs.existsSync(bin)) {
38
70
  process.stderr.write(
39
- `juggernaut-bedrock: binary not found at ${bin}\n` +
40
- `Try reinstalling: npm install -g juggernaut-bedrock\n` +
41
- `If the problem persists, file an issue: https://github.com/jpvelasco/juggernaut/issues\n`
71
+ "juggernaut-bedrock: binary not found at " + bin + "\n" +
72
+ "Try reinstalling: npm install -g juggernaut-bedrock\n" +
73
+ "If the problem persists, file an issue: https://github.com/jpvelasco/juggernaut/issues\n"
42
74
  );
43
75
  process.exit(1);
44
76
  }
45
77
 
46
- // nosemgrep: javascript.lang.security.detect-child-process
47
- const result = spawnSync(bin, process.argv.slice(2), {
78
+ // nosemgrep: javascript.lang.security.detect-child-process, javascript_exec_rule-child-process
79
+ var result = child_process.spawnSync(bin, process.argv.slice(2), {
48
80
  stdio: "inherit",
49
- env: process.env,
81
+ env: process.env
50
82
  });
51
- process.exit(result.status ?? 1);
83
+ process.exit(result.status !== null ? result.status : 1);
52
84
  }
53
85
 
54
- module.exports = { getPlatformPackage, getBinaryPath };
86
+ module.exports = { getPlatformPackage: getPlatformPackage, getBinaryPath: getBinaryPath };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juggernaut-bedrock",
3
- "version": "4.2.1",
3
+ "version": "4.2.2",
4
4
  "description": "Route Claude Code through Amazon Bedrock in one command — IAM, SSO, or API key. Cross-platform CLI for GenAI developers.",
5
5
  "bin": {
6
6
  "juggernaut": "./index.js"
@@ -9,11 +9,11 @@
9
9
  "test": "node --test index.test.js"
10
10
  },
11
11
  "optionalDependencies": {
12
- "juggernaut-bedrock-linux-x64": "4.2.1",
13
- "juggernaut-bedrock-linux-arm64": "4.2.1",
14
- "juggernaut-bedrock-darwin-x64": "4.2.1",
15
- "juggernaut-bedrock-darwin-arm64": "4.2.1",
16
- "juggernaut-bedrock-win32-x64": "4.2.1"
12
+ "juggernaut-bedrock-linux-x64": "4.2.2",
13
+ "juggernaut-bedrock-linux-arm64": "4.2.2",
14
+ "juggernaut-bedrock-darwin-x64": "4.2.2",
15
+ "juggernaut-bedrock-darwin-arm64": "4.2.2",
16
+ "juggernaut-bedrock-win32-x64": "4.2.2"
17
17
  },
18
18
  "os": [
19
19
  "darwin",
@@ -40,6 +40,9 @@
40
40
  "sso",
41
41
  "developer-tools"
42
42
  ],
43
+ "engines": {
44
+ "node": ">=20.0.0"
45
+ },
43
46
  "license": "MIT",
44
47
  "repository": {
45
48
  "type": "git",