@kilocode/cli 1.0.23 → 1.0.25
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/kilo +117 -16
- package/package.json +12 -12
package/bin/kilo
CHANGED
|
@@ -4,7 +4,6 @@ const childProcess = require("child_process")
|
|
|
4
4
|
const fs = require("fs")
|
|
5
5
|
const path = require("path")
|
|
6
6
|
const os = require("os")
|
|
7
|
-
const { createRequire } = require("module")
|
|
8
7
|
|
|
9
8
|
function run(target) {
|
|
10
9
|
const result = childProcess.spawnSync(target, process.argv.slice(2), {
|
|
@@ -45,26 +44,128 @@ if (!arch) {
|
|
|
45
44
|
const base = "@kilocode/cli-" + platform + "-" + arch
|
|
46
45
|
const binary = platform === "windows" ? "kilo.exe" : "kilo"
|
|
47
46
|
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
+
}
|
|
58
151
|
}
|
|
59
|
-
|
|
152
|
+
const parent = path.dirname(current)
|
|
153
|
+
if (parent === current) {
|
|
154
|
+
return
|
|
155
|
+
}
|
|
156
|
+
current = parent
|
|
157
|
+
}
|
|
60
158
|
}
|
|
61
159
|
|
|
62
|
-
const
|
|
160
|
+
const scriptPath = fs.realpathSync(__filename)
|
|
161
|
+
const scriptDir = path.dirname(scriptPath)
|
|
162
|
+
|
|
163
|
+
const resolved = findBinary(scriptDir)
|
|
63
164
|
if (!resolved) {
|
|
64
165
|
console.error(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
166
|
+
"It seems that your package manager failed to install the right version of the Kilo CLI for your platform. You can try manually installing " +
|
|
167
|
+
names.map((n) => `\"${n}\"`).join(" or ") +
|
|
168
|
+
" package",
|
|
68
169
|
)
|
|
69
170
|
process.exit(1)
|
|
70
171
|
}
|
package/package.json
CHANGED
|
@@ -7,20 +7,20 @@
|
|
|
7
7
|
"scripts": {
|
|
8
8
|
"postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
|
|
9
9
|
},
|
|
10
|
-
"version": "1.0.
|
|
10
|
+
"version": "1.0.25",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"optionalDependencies": {
|
|
13
|
-
"@kilocode/cli-
|
|
14
|
-
"@kilocode/cli-linux-x64-musl": "1.0.
|
|
15
|
-
"@kilocode/cli-
|
|
16
|
-
"@kilocode/cli-linux-
|
|
17
|
-
"@kilocode/cli-
|
|
18
|
-
"@kilocode/cli-
|
|
19
|
-
"@kilocode/cli-
|
|
20
|
-
"@kilocode/cli-
|
|
21
|
-
"@kilocode/cli-
|
|
22
|
-
"@kilocode/cli-
|
|
23
|
-
"@kilocode/cli-
|
|
13
|
+
"@kilocode/cli-windows-x64": "1.0.25",
|
|
14
|
+
"@kilocode/cli-linux-x64-baseline-musl": "1.0.25",
|
|
15
|
+
"@kilocode/cli-linux-x64-baseline": "1.0.25",
|
|
16
|
+
"@kilocode/cli-linux-x64": "1.0.25",
|
|
17
|
+
"@kilocode/cli-darwin-arm64": "1.0.25",
|
|
18
|
+
"@kilocode/cli-windows-x64-baseline": "1.0.25",
|
|
19
|
+
"@kilocode/cli-darwin-x64-baseline": "1.0.25",
|
|
20
|
+
"@kilocode/cli-linux-arm64": "1.0.25",
|
|
21
|
+
"@kilocode/cli-linux-arm64-musl": "1.0.25",
|
|
22
|
+
"@kilocode/cli-linux-x64-musl": "1.0.25",
|
|
23
|
+
"@kilocode/cli-darwin-x64": "1.0.25"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|