@kilocode/cli 7.5.15 → 7.6.0
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 +12 -27
- package/bin/kilocode/windows-avx2.cjs +85 -0
- package/package.json +13 -13
package/bin/kilo
CHANGED
|
@@ -26,8 +26,9 @@ function run(target, fallback) {
|
|
|
26
26
|
stdio: "inherit",
|
|
27
27
|
})
|
|
28
28
|
} catch (error) {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const next = fallback?.()
|
|
30
|
+
if (next) {
|
|
31
|
+
run(next)
|
|
31
32
|
return
|
|
32
33
|
}
|
|
33
34
|
console.error(error.message)
|
|
@@ -48,8 +49,9 @@ function run(target, fallback) {
|
|
|
48
49
|
child.on("error", (error) => {
|
|
49
50
|
clear() // kilocode_change
|
|
50
51
|
// kilocode_change start - fall through to findBinary() if cached binary fails
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
const next = fallback?.()
|
|
53
|
+
if (next) {
|
|
54
|
+
run(next)
|
|
53
55
|
return
|
|
54
56
|
}
|
|
55
57
|
// kilocode_change end
|
|
@@ -134,32 +136,14 @@ function supportsAvx2() {
|
|
|
134
136
|
}
|
|
135
137
|
|
|
136
138
|
if (platform === "windows") {
|
|
137
|
-
|
|
138
|
-
'(Add-Type -MemberDefinition "[DllImport(""kernel32.dll"")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);" -Name Kernel32 -Namespace Win32 -PassThru)::IsProcessorFeaturePresent(40)'
|
|
139
|
-
|
|
140
|
-
for (const exe of ["powershell.exe", "pwsh.exe", "pwsh", "powershell"]) {
|
|
141
|
-
try {
|
|
142
|
-
const result = childProcess.spawnSync(exe, ["-NoProfile", "-NonInteractive", "-Command", cmd], {
|
|
143
|
-
encoding: "utf8",
|
|
144
|
-
timeout: 3000,
|
|
145
|
-
windowsHide: true,
|
|
146
|
-
})
|
|
147
|
-
if (result.status !== 0) continue
|
|
148
|
-
const out = (result.stdout || "").trim().toLowerCase()
|
|
149
|
-
if (out === "true" || out === "1") return true
|
|
150
|
-
if (out === "false" || out === "0") return false
|
|
151
|
-
} catch {
|
|
152
|
-
continue
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
return false
|
|
139
|
+
return require(path.join(scriptDir, "kilocode", "windows-avx2.cjs")).supportsAvx2(arch) // kilocode_change
|
|
157
140
|
}
|
|
158
141
|
|
|
159
142
|
return false
|
|
160
143
|
}
|
|
161
144
|
|
|
162
|
-
|
|
145
|
+
let names // kilocode_change
|
|
146
|
+
function candidates() /* kilocode_change */ {
|
|
163
147
|
const avx2 = supportsAvx2()
|
|
164
148
|
const baseline = arch === "x64" && !avx2
|
|
165
149
|
|
|
@@ -202,9 +186,10 @@ const names = (() => {
|
|
|
202
186
|
return [base, `${base}-baseline`]
|
|
203
187
|
}
|
|
204
188
|
return [base]
|
|
205
|
-
}
|
|
189
|
+
} // kilocode_change
|
|
206
190
|
|
|
207
191
|
function findBinary(startDir) {
|
|
192
|
+
names ??= candidates() // kilocode_change
|
|
208
193
|
let current = startDir
|
|
209
194
|
for (;;) {
|
|
210
195
|
const modules = path.join(current, "node_modules")
|
|
@@ -232,4 +217,4 @@ if (!resolved) {
|
|
|
232
217
|
process.exit(1)
|
|
233
218
|
}
|
|
234
219
|
|
|
235
|
-
run(resolved, resolved === cached ? findBinary(scriptDir) : undefined) // kilocode_change - preserve cached binary fallback
|
|
220
|
+
run(resolved, resolved === cached ? () => findBinary(scriptDir) : undefined) // kilocode_change - preserve cached binary fallback
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const childProcess = require("child_process")
|
|
2
|
+
const fs = require("fs")
|
|
3
|
+
const os = require("os")
|
|
4
|
+
const path = require("path")
|
|
5
|
+
|
|
6
|
+
const cacheInfo = (arch) => {
|
|
7
|
+
try {
|
|
8
|
+
const root = process.env.XDG_CACHE_HOME?.replace(/[\r\n]+/g, "")
|
|
9
|
+
const dir = root && path.isAbsolute(root) ? root : path.join(os.homedir().replace(/[\r\n]+/g, ""), ".cache")
|
|
10
|
+
return {
|
|
11
|
+
file: path.join(dir, "kilo", "bin", "windows-avx2.json"),
|
|
12
|
+
key: JSON.stringify([1, "windows", arch, os.hostname(), os.release(), os.cpus().at(0)?.model]),
|
|
13
|
+
boot: Date.now() - os.uptime() * 1000,
|
|
14
|
+
}
|
|
15
|
+
} catch {
|
|
16
|
+
return undefined
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const readCache = (cache) => {
|
|
21
|
+
if (!cache) return undefined
|
|
22
|
+
try {
|
|
23
|
+
const entry = JSON.parse(fs.readFileSync(cache.file, "utf8"))
|
|
24
|
+
if (entry?.key !== cache.key || !Number.isFinite(entry.boot) || Math.abs(entry.boot - cache.boot) >= 2000)
|
|
25
|
+
return undefined
|
|
26
|
+
if (typeof entry.avx2 === "boolean") return entry.avx2
|
|
27
|
+
if (entry.avx2 === null && Number.isFinite(entry.expiry) && entry.expiry > Date.now()) return null
|
|
28
|
+
return undefined
|
|
29
|
+
} catch {
|
|
30
|
+
return undefined
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const writeCache = (cache, avx2) => {
|
|
35
|
+
if (!cache) return avx2 === true
|
|
36
|
+
try {
|
|
37
|
+
fs.mkdirSync(path.dirname(cache.file), { recursive: true })
|
|
38
|
+
fs.writeFileSync(
|
|
39
|
+
cache.file,
|
|
40
|
+
JSON.stringify({
|
|
41
|
+
key: cache.key,
|
|
42
|
+
boot: cache.boot,
|
|
43
|
+
avx2,
|
|
44
|
+
expiry: avx2 === null ? Date.now() + 60_000 : undefined,
|
|
45
|
+
}),
|
|
46
|
+
{ mode: 0o600 },
|
|
47
|
+
)
|
|
48
|
+
} catch {
|
|
49
|
+
return avx2 === true
|
|
50
|
+
}
|
|
51
|
+
return avx2 === true
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const probe = () => {
|
|
55
|
+
const cmd =
|
|
56
|
+
'(Add-Type -MemberDefinition "[DllImport(""kernel32.dll"")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);" -Name Kernel32 -Namespace Win32 -PassThru)::IsProcessorFeaturePresent(40)'
|
|
57
|
+
|
|
58
|
+
for (const exe of ["powershell.exe", "pwsh.exe", "pwsh", "powershell"]) {
|
|
59
|
+
try {
|
|
60
|
+
const result = childProcess.spawnSync(exe, ["-NoProfile", "-NonInteractive", "-Command", cmd], {
|
|
61
|
+
encoding: "utf8",
|
|
62
|
+
timeout: 3000,
|
|
63
|
+
windowsHide: true,
|
|
64
|
+
})
|
|
65
|
+
if (result.status !== 0) continue
|
|
66
|
+
const out = (result.stdout || "").trim().toLowerCase()
|
|
67
|
+
if (out === "true" || out === "1") return true
|
|
68
|
+
if (out === "false" || out === "0") return false
|
|
69
|
+
} catch {
|
|
70
|
+
continue
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return null
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function supportsAvx2(arch) {
|
|
78
|
+
if (arch !== "x64") return false
|
|
79
|
+
const cache = cacheInfo(arch)
|
|
80
|
+
const value = readCache(cache)
|
|
81
|
+
if (value !== undefined) return value === true
|
|
82
|
+
return writeCache(cache, probe())
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
module.exports = { supportsAvx2 }
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"scripts": {
|
|
8
8
|
"postinstall": "node ./postinstall.mjs"
|
|
9
9
|
},
|
|
10
|
-
"version": "7.
|
|
10
|
+
"version": "7.6.0",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"keywords": [
|
|
13
13
|
"cli",
|
|
@@ -37,18 +37,18 @@
|
|
|
37
37
|
"x64"
|
|
38
38
|
],
|
|
39
39
|
"optionalDependencies": {
|
|
40
|
-
"@kilocode/cli-linux-x64-baseline": "7.
|
|
41
|
-
"@kilocode/cli-linux-arm64-musl": "7.
|
|
42
|
-
"@kilocode/cli-windows-arm64": "7.
|
|
43
|
-
"@kilocode/cli-windows-x64-baseline": "7.
|
|
44
|
-
"@kilocode/cli-windows-x64": "7.
|
|
45
|
-
"@kilocode/cli-linux-arm64": "7.
|
|
46
|
-
"@kilocode/cli-linux-x64-musl": "7.
|
|
47
|
-
"@kilocode/cli-darwin-x64-baseline": "7.
|
|
48
|
-
"@kilocode/cli-linux-x64": "7.
|
|
49
|
-
"@kilocode/cli-darwin-arm64": "7.
|
|
50
|
-
"@kilocode/cli-linux-x64-baseline-musl": "7.
|
|
51
|
-
"@kilocode/cli-darwin-x64": "7.
|
|
40
|
+
"@kilocode/cli-linux-x64-baseline": "7.6.0",
|
|
41
|
+
"@kilocode/cli-linux-arm64-musl": "7.6.0",
|
|
42
|
+
"@kilocode/cli-windows-arm64": "7.6.0",
|
|
43
|
+
"@kilocode/cli-windows-x64-baseline": "7.6.0",
|
|
44
|
+
"@kilocode/cli-windows-x64": "7.6.0",
|
|
45
|
+
"@kilocode/cli-linux-arm64": "7.6.0",
|
|
46
|
+
"@kilocode/cli-linux-x64-musl": "7.6.0",
|
|
47
|
+
"@kilocode/cli-darwin-x64-baseline": "7.6.0",
|
|
48
|
+
"@kilocode/cli-linux-x64": "7.6.0",
|
|
49
|
+
"@kilocode/cli-darwin-arm64": "7.6.0",
|
|
50
|
+
"@kilocode/cli-linux-x64-baseline-musl": "7.6.0",
|
|
51
|
+
"@kilocode/cli-darwin-x64": "7.6.0"
|
|
52
52
|
},
|
|
53
53
|
"repository": {
|
|
54
54
|
"type": "git",
|