@fabriccode/cli 7.0.67 → 7.0.69

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/fabric CHANGED
@@ -5,6 +5,27 @@ const fs = require("fs")
5
5
  const path = require("path")
6
6
  const os = require("os")
7
7
 
8
+ // kilocode_change start
9
+ function code(signal) {
10
+ const num = os.constants.signals?.[signal]
11
+ if (typeof num === "number") return 128 + num
12
+ return 1
13
+ }
14
+
15
+ function fail(target, result) {
16
+ if (result.signal === "SIGSEGV" && target.includes("cli-linux-x64-baseline")) {
17
+ console.error("Fabric's Linux x64 baseline binary crashed inside Bun on a non-AVX CPU.")
18
+ console.error("This host is not currently supported by the npm-distributed baseline build.")
19
+ console.error("Use a machine with AVX support for now, or build and run Fabric from source on a supported host.")
20
+ }
21
+ if (result.signal) {
22
+ console.error(`Fabric binary crashed with ${result.signal}: ${target}`)
23
+ process.exit(code(result.signal))
24
+ }
25
+ const status = typeof result.status === "number" ? result.status : 1
26
+ process.exit(status)
27
+ }
28
+
8
29
  function run(target) {
9
30
  const result = childProcess.spawnSync(target, process.argv.slice(2), {
10
31
  stdio: "inherit",
@@ -13,8 +34,9 @@ function run(target) {
13
34
  console.error(result.error.message)
14
35
  process.exit(1)
15
36
  }
16
- const code = typeof result.status === "number" ? result.status : 0
17
- process.exit(code)
37
+ if (result.signal) fail(target, result)
38
+ const status = typeof result.status === "number" ? result.status : 1
39
+ process.exit(status)
18
40
  }
19
41
 
20
42
  const envPath = process.env.FABRIC_BIN_PATH
@@ -156,6 +178,26 @@ function findBinary(startDir) {
156
178
  current = parent
157
179
  }
158
180
  }
181
+ // kilocode_change start
182
+ function findFallback(startDir, target) {
183
+ if (platform !== "linux" || arch !== "x64") return
184
+ if (target.includes("-baseline")) return
185
+ let current = startDir
186
+ for (;;) {
187
+ const modules = path.join(current, "node_modules")
188
+ if (fs.existsSync(modules)) {
189
+ for (const name of names) {
190
+ if (!name.includes("-baseline")) continue
191
+ const candidate = path.join(modules, name, "bin", binary)
192
+ if (candidate !== target && fs.existsSync(candidate)) return candidate
193
+ }
194
+ }
195
+ const parent = path.dirname(current)
196
+ if (parent === current) return
197
+ current = parent
198
+ }
199
+ }
200
+ // kilocode_change end
159
201
 
160
202
  const scriptPath = fs.realpathSync(__filename)
161
203
  const scriptDir = path.dirname(scriptPath)
@@ -170,4 +212,22 @@ if (!resolved) {
170
212
  process.exit(1)
171
213
  }
172
214
 
173
- run(resolved)
215
+ const result = childProcess.spawnSync(resolved, process.argv.slice(2), {
216
+ stdio: "inherit",
217
+ })
218
+ if (result.error) {
219
+ console.error(result.error.message)
220
+ process.exit(1)
221
+ }
222
+ // kilocode_change start
223
+ if (result.signal === "SIGILL") {
224
+ const fallback = findFallback(scriptDir, resolved)
225
+ if (fallback) {
226
+ console.error(`Fabric binary crashed with SIGILL, retrying baseline build: ${fallback}`)
227
+ run(fallback)
228
+ }
229
+ }
230
+ // kilocode_change end
231
+ if (result.signal) fail(resolved, result)
232
+ const status = typeof result.status === "number" ? result.status : 1
233
+ process.exit(status)
package/package.json CHANGED
@@ -7,20 +7,20 @@
7
7
  "scripts": {
8
8
  "postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
9
9
  },
10
- "version": "7.0.67",
10
+ "version": "7.0.69",
11
11
  "license": "MIT",
12
12
  "optionalDependencies": {
13
- "@fabriccode/cli-linux-x64-musl": "7.0.67",
14
- "@fabriccode/cli-darwin-x64": "7.0.67",
15
- "@fabriccode/cli-darwin-x64-baseline": "7.0.67",
16
- "@fabriccode/cli-linux-x64-baseline-musl": "7.0.67",
17
- "@fabriccode/cli-linux-x64-baseline": "7.0.67",
18
- "@fabriccode/cli-linux-arm64": "7.0.67",
19
- "@fabriccode/cli-linux-arm64-musl": "7.0.67",
20
- "@fabriccode/cli-windows-x64": "7.0.67",
21
- "@fabriccode/cli-darwin-arm64": "7.0.67",
22
- "@fabriccode/cli-windows-x64-baseline": "7.0.67",
23
- "@fabriccode/cli-linux-x64": "7.0.67"
13
+ "@fabriccode/cli-linux-x64-musl": "7.0.69",
14
+ "@fabriccode/cli-darwin-x64": "7.0.69",
15
+ "@fabriccode/cli-darwin-x64-baseline": "7.0.69",
16
+ "@fabriccode/cli-linux-x64-baseline-musl": "7.0.69",
17
+ "@fabriccode/cli-linux-x64-baseline": "7.0.69",
18
+ "@fabriccode/cli-linux-arm64": "7.0.69",
19
+ "@fabriccode/cli-linux-arm64-musl": "7.0.69",
20
+ "@fabriccode/cli-windows-x64": "7.0.69",
21
+ "@fabriccode/cli-darwin-arm64": "7.0.69",
22
+ "@fabriccode/cli-windows-x64-baseline": "7.0.69",
23
+ "@fabriccode/cli-linux-x64": "7.0.69"
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",
package/postinstall.mjs CHANGED
@@ -145,7 +145,7 @@ function main() {
145
145
  }
146
146
 
147
147
  try {
148
- main()
148
+ void main()
149
149
  } catch (error) {
150
150
  console.error("Failed to setup fabric binary:", error.message) // kilocode_change
151
151
  process.exit(1)