@fabriccode/cli 7.0.67 → 7.0.68

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/fabric +58 -3
  2. package/package.json +12 -12
package/bin/fabric CHANGED
@@ -5,6 +5,22 @@ 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) {
17
+ console.error(`Fabric binary crashed with ${result.signal}: ${target}`)
18
+ process.exit(code(result.signal))
19
+ }
20
+ const status = typeof result.status === "number" ? result.status : 1
21
+ process.exit(status)
22
+ }
23
+
8
24
  function run(target) {
9
25
  const result = childProcess.spawnSync(target, process.argv.slice(2), {
10
26
  stdio: "inherit",
@@ -13,8 +29,9 @@ function run(target) {
13
29
  console.error(result.error.message)
14
30
  process.exit(1)
15
31
  }
16
- const code = typeof result.status === "number" ? result.status : 0
17
- process.exit(code)
32
+ if (result.signal) fail(target, result)
33
+ const status = typeof result.status === "number" ? result.status : 1
34
+ process.exit(status)
18
35
  }
19
36
 
20
37
  const envPath = process.env.FABRIC_BIN_PATH
@@ -156,6 +173,26 @@ function findBinary(startDir) {
156
173
  current = parent
157
174
  }
158
175
  }
176
+ // kilocode_change start
177
+ function findFallback(startDir, target) {
178
+ if (platform !== "linux" || arch !== "x64") return
179
+ if (target.includes("-baseline")) return
180
+ let current = startDir
181
+ for (;;) {
182
+ const modules = path.join(current, "node_modules")
183
+ if (fs.existsSync(modules)) {
184
+ for (const name of names) {
185
+ if (!name.includes("-baseline")) continue
186
+ const candidate = path.join(modules, name, "bin", binary)
187
+ if (candidate !== target && fs.existsSync(candidate)) return candidate
188
+ }
189
+ }
190
+ const parent = path.dirname(current)
191
+ if (parent === current) return
192
+ current = parent
193
+ }
194
+ }
195
+ // kilocode_change end
159
196
 
160
197
  const scriptPath = fs.realpathSync(__filename)
161
198
  const scriptDir = path.dirname(scriptPath)
@@ -170,4 +207,22 @@ if (!resolved) {
170
207
  process.exit(1)
171
208
  }
172
209
 
173
- run(resolved)
210
+ const result = childProcess.spawnSync(resolved, process.argv.slice(2), {
211
+ stdio: "inherit",
212
+ })
213
+ if (result.error) {
214
+ console.error(result.error.message)
215
+ process.exit(1)
216
+ }
217
+ // kilocode_change start
218
+ if (result.signal === "SIGILL") {
219
+ const fallback = findFallback(scriptDir, resolved)
220
+ if (fallback) {
221
+ console.error(`Fabric binary crashed with SIGILL, retrying baseline build: ${fallback}`)
222
+ run(fallback)
223
+ }
224
+ }
225
+ // kilocode_change end
226
+ if (result.signal) fail(resolved, result)
227
+ const status = typeof result.status === "number" ? result.status : 1
228
+ 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.68",
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.68",
14
+ "@fabriccode/cli-darwin-x64": "7.0.68",
15
+ "@fabriccode/cli-darwin-x64-baseline": "7.0.68",
16
+ "@fabriccode/cli-linux-x64-baseline-musl": "7.0.68",
17
+ "@fabriccode/cli-linux-x64-baseline": "7.0.68",
18
+ "@fabriccode/cli-linux-arm64": "7.0.68",
19
+ "@fabriccode/cli-linux-arm64-musl": "7.0.68",
20
+ "@fabriccode/cli-windows-x64": "7.0.68",
21
+ "@fabriccode/cli-darwin-arm64": "7.0.68",
22
+ "@fabriccode/cli-windows-x64-baseline": "7.0.68",
23
+ "@fabriccode/cli-linux-x64": "7.0.68"
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",