ironcode-ai 1.17.1 → 1.17.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.
Files changed (2) hide show
  1. package/bin/ironcode +24 -4
  2. package/package.json +6 -4
package/bin/ironcode CHANGED
@@ -47,21 +47,41 @@ if (!arch) {
47
47
  const base = "ironcode-" + platform + "-" + arch
48
48
  const binary = platform === "windows" ? "ironcode.exe" : "ironcode"
49
49
 
50
+ function hasAvx2() {
51
+ if (platform !== "linux" || arch !== "x64") return true
52
+ try {
53
+ const cpuinfo = fs.readFileSync("/proc/cpuinfo", "utf8")
54
+ return cpuinfo.includes(" avx2 ")
55
+ } catch {
56
+ return true
57
+ }
58
+ }
59
+
60
+ const avx2 = hasAvx2()
61
+
50
62
  function findBinary(startDir) {
51
63
  let current = startDir
52
64
  for (;;) {
53
65
  const modules = path.join(current, "node_modules")
54
66
  if (fs.existsSync(modules)) {
55
67
  const entries = fs.readdirSync(modules)
68
+ // Collect all matching candidates
69
+ const candidates = []
56
70
  for (const entry of entries) {
57
- if (!entry.startsWith(base)) {
58
- continue
59
- }
71
+ if (!entry.startsWith(base)) continue
60
72
  const candidate = path.join(modules, entry, "bin", binary)
61
73
  if (fs.existsSync(candidate)) {
62
- return candidate
74
+ candidates.push({ entry, path: candidate })
63
75
  }
64
76
  }
77
+ if (candidates.length > 0) {
78
+ // Prefer modern (AVX2) or baseline based on CPU capability
79
+ const preferred = avx2 ? "modern" : "baseline"
80
+ const exact = candidates.find((c) => c.entry === base + "-" + preferred)
81
+ if (exact) return exact.path
82
+ // Fall back: if only one exists, use it; otherwise pick first
83
+ return candidates[0].path
84
+ }
65
85
  }
66
86
  const parent = path.dirname(current)
67
87
  if (parent === current) {
package/package.json CHANGED
@@ -6,11 +6,13 @@
6
6
  "scripts": {
7
7
  "postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
8
8
  },
9
- "version": "1.17.1",
9
+ "version": "1.17.3",
10
10
  "license": "MIT",
11
11
  "optionalDependencies": {
12
- "ironcode-linux-x64-modern": "1.17.1",
13
- "ironcode-windows-x64-modern": "1.17.1",
14
- "ironcode-darwin-arm64": "1.17.1"
12
+ "ironcode-linux-x64-baseline": "1.17.3",
13
+ "ironcode-linux-x64-modern": "1.17.3",
14
+ "ironcode-linux-x64-baseline-musl": "1.17.3",
15
+ "ironcode-windows-x64-modern": "1.17.3",
16
+ "ironcode-darwin-arm64": "1.17.3"
15
17
  }
16
18
  }