@fabriccode/cli 7.0.50 → 7.0.52
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/LICENSE +0 -0
- package/README.md +0 -0
- package/bin/bin/fabric +173 -0
- package/bin/bin/kilo +188 -0
- package/fabriccode-cli-7.0.51.tgz +0 -0
- package/package.json +9 -9
- package/postinstall.mjs +0 -0
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
package/bin/bin/fabric
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const childProcess = require("child_process")
|
|
4
|
+
const fs = require("fs")
|
|
5
|
+
const path = require("path")
|
|
6
|
+
const os = require("os")
|
|
7
|
+
|
|
8
|
+
function run(target) {
|
|
9
|
+
const result = childProcess.spawnSync(target, process.argv.slice(2), {
|
|
10
|
+
stdio: "inherit",
|
|
11
|
+
})
|
|
12
|
+
if (result.error) {
|
|
13
|
+
console.error(result.error.message)
|
|
14
|
+
process.exit(1)
|
|
15
|
+
}
|
|
16
|
+
const code = typeof result.status === "number" ? result.status : 0
|
|
17
|
+
process.exit(code)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const envPath = process.env.FABRIC_BIN_PATH
|
|
21
|
+
if (envPath) {
|
|
22
|
+
run(envPath)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const platformMap = {
|
|
26
|
+
darwin: "darwin",
|
|
27
|
+
linux: "linux",
|
|
28
|
+
win32: "windows",
|
|
29
|
+
}
|
|
30
|
+
const archMap = {
|
|
31
|
+
x64: "x64",
|
|
32
|
+
arm64: "arm64",
|
|
33
|
+
arm: "arm",
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let platform = platformMap[os.platform()]
|
|
37
|
+
if (!platform) {
|
|
38
|
+
platform = os.platform()
|
|
39
|
+
}
|
|
40
|
+
let arch = archMap[os.arch()]
|
|
41
|
+
if (!arch) {
|
|
42
|
+
arch = os.arch()
|
|
43
|
+
}
|
|
44
|
+
const base = "@fabriccode/cli-" + platform + "-" + arch
|
|
45
|
+
const binary = platform === "windows" ? "fabric.exe" : "fabric"
|
|
46
|
+
|
|
47
|
+
function supportsAvx2() {
|
|
48
|
+
if (arch !== "x64") return false
|
|
49
|
+
|
|
50
|
+
if (platform === "linux") {
|
|
51
|
+
try {
|
|
52
|
+
return /(^|\s)avx2(\s|$)/i.test(fs.readFileSync("/proc/cpuinfo", "utf8"))
|
|
53
|
+
} catch {
|
|
54
|
+
return false
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (platform === "darwin") {
|
|
59
|
+
try {
|
|
60
|
+
const result = childProcess.spawnSync("sysctl", ["-n", "hw.optional.avx2_0"], {
|
|
61
|
+
encoding: "utf8",
|
|
62
|
+
timeout: 1500,
|
|
63
|
+
})
|
|
64
|
+
if (result.status !== 0) return false
|
|
65
|
+
return (result.stdout || "").trim() === "1"
|
|
66
|
+
} catch {
|
|
67
|
+
return false
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (platform === "windows") {
|
|
72
|
+
const cmd =
|
|
73
|
+
'(Add-Type -MemberDefinition "[DllImport(""kernel32.dll"")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);" -Name Kernel32 -Namespace Win32 -PassThru)::IsProcessorFeaturePresent(40)'
|
|
74
|
+
|
|
75
|
+
for (const exe of ["powershell.exe", "pwsh.exe", "pwsh", "powershell"]) {
|
|
76
|
+
try {
|
|
77
|
+
const result = childProcess.spawnSync(exe, ["-NoProfile", "-NonInteractive", "-Command", cmd], {
|
|
78
|
+
encoding: "utf8",
|
|
79
|
+
timeout: 3000,
|
|
80
|
+
windowsHide: true,
|
|
81
|
+
})
|
|
82
|
+
if (result.status !== 0) continue
|
|
83
|
+
const out = (result.stdout || "").trim().toLowerCase()
|
|
84
|
+
if (out === "true" || out === "1") return true
|
|
85
|
+
if (out === "false" || out === "0") return false
|
|
86
|
+
} catch {
|
|
87
|
+
continue
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return false
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return false
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const names = (() => {
|
|
98
|
+
const avx2 = supportsAvx2()
|
|
99
|
+
const baseline = arch === "x64" && !avx2
|
|
100
|
+
|
|
101
|
+
if (platform === "linux") {
|
|
102
|
+
const musl = (() => {
|
|
103
|
+
try {
|
|
104
|
+
if (fs.existsSync("/etc/alpine-release")) return true
|
|
105
|
+
} catch {
|
|
106
|
+
// ignore
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
try {
|
|
110
|
+
const result = childProcess.spawnSync("ldd", ["--version"], { encoding: "utf8" })
|
|
111
|
+
const text = ((result.stdout || "") + (result.stderr || "")).toLowerCase()
|
|
112
|
+
if (text.includes("musl")) return true
|
|
113
|
+
} catch {
|
|
114
|
+
// ignore
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return false
|
|
118
|
+
})()
|
|
119
|
+
|
|
120
|
+
if (musl) {
|
|
121
|
+
if (arch === "x64") {
|
|
122
|
+
if (baseline) return [`${base}-baseline-musl`, `${base}-musl`, `${base}-baseline`, base]
|
|
123
|
+
return [`${base}-musl`, `${base}-baseline-musl`, base, `${base}-baseline`]
|
|
124
|
+
}
|
|
125
|
+
return [`${base}-musl`, base]
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (arch === "x64") {
|
|
129
|
+
if (baseline) return [`${base}-baseline`, base, `${base}-baseline-musl`, `${base}-musl`]
|
|
130
|
+
return [base, `${base}-baseline`, `${base}-musl`, `${base}-baseline-musl`]
|
|
131
|
+
}
|
|
132
|
+
return [base, `${base}-musl`]
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (arch === "x64") {
|
|
136
|
+
if (baseline) return [`${base}-baseline`, base]
|
|
137
|
+
return [base, `${base}-baseline`]
|
|
138
|
+
}
|
|
139
|
+
return [base]
|
|
140
|
+
})()
|
|
141
|
+
|
|
142
|
+
function findBinary(startDir) {
|
|
143
|
+
let current = startDir
|
|
144
|
+
for (;;) {
|
|
145
|
+
const modules = path.join(current, "node_modules")
|
|
146
|
+
if (fs.existsSync(modules)) {
|
|
147
|
+
for (const name of names) {
|
|
148
|
+
const candidate = path.join(modules, name, "bin", binary)
|
|
149
|
+
if (fs.existsSync(candidate)) return candidate
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
const parent = path.dirname(current)
|
|
153
|
+
if (parent === current) {
|
|
154
|
+
return
|
|
155
|
+
}
|
|
156
|
+
current = parent
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const scriptPath = fs.realpathSync(__filename)
|
|
161
|
+
const scriptDir = path.dirname(scriptPath)
|
|
162
|
+
|
|
163
|
+
const resolved = findBinary(scriptDir)
|
|
164
|
+
if (!resolved) {
|
|
165
|
+
console.error(
|
|
166
|
+
"It seems that your package manager failed to install the right version of Fabric Code for your platform. You can try manually installing " +
|
|
167
|
+
names.map((n) => `\"${n}\"`).join(" or ") +
|
|
168
|
+
" package",
|
|
169
|
+
)
|
|
170
|
+
process.exit(1)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
run(resolved)
|
package/bin/bin/kilo
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const childProcess = require("child_process")
|
|
4
|
+
const fs = require("fs")
|
|
5
|
+
const path = require("path")
|
|
6
|
+
const os = require("os")
|
|
7
|
+
|
|
8
|
+
function run(target) {
|
|
9
|
+
const result = childProcess.spawnSync(target, process.argv.slice(2), {
|
|
10
|
+
stdio: "inherit",
|
|
11
|
+
})
|
|
12
|
+
if (result.error) {
|
|
13
|
+
console.error(result.error.message)
|
|
14
|
+
process.exit(1)
|
|
15
|
+
}
|
|
16
|
+
const code = typeof result.status === "number" ? result.status : 0
|
|
17
|
+
process.exit(code)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const envPath = process.env.KILO_BIN_PATH
|
|
21
|
+
if (envPath) {
|
|
22
|
+
run(envPath)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const scriptPath = fs.realpathSync(__filename)
|
|
26
|
+
const scriptDir = path.dirname(scriptPath)
|
|
27
|
+
|
|
28
|
+
// kilocode_change start - fall through to findBinary() if cached binary fails
|
|
29
|
+
const cached = path.join(scriptDir, ".kilo")
|
|
30
|
+
if (fs.existsSync(cached)) {
|
|
31
|
+
const result = childProcess.spawnSync(cached, process.argv.slice(2), {
|
|
32
|
+
stdio: "inherit",
|
|
33
|
+
})
|
|
34
|
+
if (!result.error) {
|
|
35
|
+
const code = typeof result.status === "number" ? result.status : 0
|
|
36
|
+
process.exit(code)
|
|
37
|
+
}
|
|
38
|
+
// cached binary failed (e.g. wrong platform/arch, missing dynamic linker),
|
|
39
|
+
// fall through to findBinary() which has better variant detection
|
|
40
|
+
}
|
|
41
|
+
// kilocode_change end
|
|
42
|
+
|
|
43
|
+
const platformMap = {
|
|
44
|
+
darwin: "darwin",
|
|
45
|
+
linux: "linux",
|
|
46
|
+
win32: "windows",
|
|
47
|
+
}
|
|
48
|
+
const archMap = {
|
|
49
|
+
x64: "x64",
|
|
50
|
+
arm64: "arm64",
|
|
51
|
+
arm: "arm",
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
let platform = platformMap[os.platform()]
|
|
55
|
+
if (!platform) {
|
|
56
|
+
platform = os.platform()
|
|
57
|
+
}
|
|
58
|
+
let arch = archMap[os.arch()]
|
|
59
|
+
if (!arch) {
|
|
60
|
+
arch = os.arch()
|
|
61
|
+
}
|
|
62
|
+
const base = "@fabriccode/cli-" + platform + "-" + arch
|
|
63
|
+
const binary = platform === "windows" ? "fabric.exe" : "fabric" // kilocode_change: binary is built as "fabric" not "kilo"
|
|
64
|
+
|
|
65
|
+
function supportsAvx2() {
|
|
66
|
+
if (arch !== "x64") return false
|
|
67
|
+
|
|
68
|
+
if (platform === "linux") {
|
|
69
|
+
try {
|
|
70
|
+
return /(^|\s)avx2(\s|$)/i.test(fs.readFileSync("/proc/cpuinfo", "utf8"))
|
|
71
|
+
} catch {
|
|
72
|
+
return false
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (platform === "darwin") {
|
|
77
|
+
try {
|
|
78
|
+
const result = childProcess.spawnSync("sysctl", ["-n", "hw.optional.avx2_0"], {
|
|
79
|
+
encoding: "utf8",
|
|
80
|
+
timeout: 1500,
|
|
81
|
+
})
|
|
82
|
+
if (result.status !== 0) return false
|
|
83
|
+
return (result.stdout || "").trim() === "1"
|
|
84
|
+
} catch {
|
|
85
|
+
return false
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (platform === "windows") {
|
|
90
|
+
const cmd =
|
|
91
|
+
'(Add-Type -MemberDefinition "[DllImport(""kernel32.dll"")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);" -Name Kernel32 -Namespace Win32 -PassThru)::IsProcessorFeaturePresent(40)'
|
|
92
|
+
|
|
93
|
+
for (const exe of ["powershell.exe", "pwsh.exe", "pwsh", "powershell"]) {
|
|
94
|
+
try {
|
|
95
|
+
const result = childProcess.spawnSync(exe, ["-NoProfile", "-NonInteractive", "-Command", cmd], {
|
|
96
|
+
encoding: "utf8",
|
|
97
|
+
timeout: 3000,
|
|
98
|
+
windowsHide: true,
|
|
99
|
+
})
|
|
100
|
+
if (result.status !== 0) continue
|
|
101
|
+
const out = (result.stdout || "").trim().toLowerCase()
|
|
102
|
+
if (out === "true" || out === "1") return true
|
|
103
|
+
if (out === "false" || out === "0") return false
|
|
104
|
+
} catch {
|
|
105
|
+
continue
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return false
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return false
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const names = (() => {
|
|
116
|
+
const avx2 = supportsAvx2()
|
|
117
|
+
const baseline = arch === "x64" && !avx2
|
|
118
|
+
|
|
119
|
+
if (platform === "linux") {
|
|
120
|
+
const musl = (() => {
|
|
121
|
+
try {
|
|
122
|
+
if (fs.existsSync("/etc/alpine-release")) return true
|
|
123
|
+
} catch {
|
|
124
|
+
// ignore
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
try {
|
|
128
|
+
const result = childProcess.spawnSync("ldd", ["--version"], { encoding: "utf8" })
|
|
129
|
+
const text = ((result.stdout || "") + (result.stderr || "")).toLowerCase()
|
|
130
|
+
if (text.includes("musl")) return true
|
|
131
|
+
} catch {
|
|
132
|
+
// ignore
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return false
|
|
136
|
+
})()
|
|
137
|
+
|
|
138
|
+
if (musl) {
|
|
139
|
+
if (arch === "x64") {
|
|
140
|
+
if (baseline) return [`${base}-baseline-musl`, `${base}-musl`, `${base}-baseline`, base]
|
|
141
|
+
return [`${base}-musl`, `${base}-baseline-musl`, base, `${base}-baseline`]
|
|
142
|
+
}
|
|
143
|
+
return [`${base}-musl`, base]
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (arch === "x64") {
|
|
147
|
+
if (baseline) return [`${base}-baseline`, base, `${base}-baseline-musl`, `${base}-musl`]
|
|
148
|
+
return [base, `${base}-baseline`, `${base}-musl`, `${base}-baseline-musl`]
|
|
149
|
+
}
|
|
150
|
+
return [base, `${base}-musl`]
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (arch === "x64") {
|
|
154
|
+
if (baseline) return [`${base}-baseline`, base]
|
|
155
|
+
return [base, `${base}-baseline`]
|
|
156
|
+
}
|
|
157
|
+
return [base]
|
|
158
|
+
})()
|
|
159
|
+
|
|
160
|
+
function findBinary(startDir) {
|
|
161
|
+
let current = startDir
|
|
162
|
+
for (;;) {
|
|
163
|
+
const modules = path.join(current, "node_modules")
|
|
164
|
+
if (fs.existsSync(modules)) {
|
|
165
|
+
for (const name of names) {
|
|
166
|
+
const candidate = path.join(modules, name, "bin", binary)
|
|
167
|
+
if (fs.existsSync(candidate)) return candidate
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const parent = path.dirname(current)
|
|
171
|
+
if (parent === current) {
|
|
172
|
+
return
|
|
173
|
+
}
|
|
174
|
+
current = parent
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const resolved = findBinary(scriptDir)
|
|
179
|
+
if (!resolved) {
|
|
180
|
+
console.error(
|
|
181
|
+
"It seems that your package manager failed to install the right version of the Kilo CLI for your platform. You can try manually installing " +
|
|
182
|
+
names.map((n) => `\"${n}\"`).join(" or ") +
|
|
183
|
+
" package",
|
|
184
|
+
)
|
|
185
|
+
process.exit(1)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
run(resolved)
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -7,23 +7,23 @@
|
|
|
7
7
|
"scripts": {
|
|
8
8
|
"postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
|
|
9
9
|
},
|
|
10
|
-
"version": "7.0.
|
|
10
|
+
"version": "7.0.52",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"optionalDependencies": {
|
|
13
|
-
"@fabriccode/cli-linux-
|
|
13
|
+
"@fabriccode/cli-linux-x64": "7.0.51",
|
|
14
|
+
"@fabriccode/cli-linux-x64-baseline": "7.0.50",
|
|
15
|
+
"@fabriccode/cli-linux-x64-musl": "7.0.50",
|
|
14
16
|
"@fabriccode/cli-linux-x64-baseline-musl": "7.0.50",
|
|
15
|
-
"@fabriccode/cli-linux-x64": "7.0.50",
|
|
16
17
|
"@fabriccode/cli-linux-arm64": "7.0.50",
|
|
17
|
-
"@fabriccode/cli-
|
|
18
|
-
"@fabriccode/cli-linux-x64-baseline": "7.0.50",
|
|
18
|
+
"@fabriccode/cli-linux-arm64-musl": "7.0.50",
|
|
19
19
|
"@fabriccode/cli-darwin-x64": "7.0.50",
|
|
20
|
-
"@fabriccode/cli-windows-x64": "7.0.50",
|
|
21
20
|
"@fabriccode/cli-darwin-x64-baseline": "7.0.50",
|
|
22
|
-
"@fabriccode/cli-
|
|
23
|
-
"@fabriccode/cli-
|
|
21
|
+
"@fabriccode/cli-darwin-arm64": "7.0.50",
|
|
22
|
+
"@fabriccode/cli-windows-x64": "7.0.50",
|
|
23
|
+
"@fabriccode/cli-windows-x64-baseline": "7.0.50"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
27
27
|
"url": "https://github.com/Fabric-Pro/fabric-code"
|
|
28
28
|
}
|
|
29
|
-
}
|
|
29
|
+
}
|
package/postinstall.mjs
CHANGED
|
File without changes
|