@kolbo/kolbo-code 1.0.3

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 (3) hide show
  1. package/LICENSE +22 -0
  2. package/bin/kolbo +179 -0
  3. package/package.json +31 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 SST
4
+ Copyright (c) 2026 Kolbo.AI
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/bin/kolbo ADDED
@@ -0,0 +1,179 @@
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.KOLBO_BIN_PATH
21
+ if (envPath) {
22
+ run(envPath)
23
+ }
24
+
25
+ const scriptPath = fs.realpathSync(__filename)
26
+ const scriptDir = path.dirname(scriptPath)
27
+
28
+ //
29
+ const cached = path.join(scriptDir, ".kolbo")
30
+ if (fs.existsSync(cached)) {
31
+ run(cached)
32
+ }
33
+
34
+ const platformMap = {
35
+ darwin: "darwin",
36
+ linux: "linux",
37
+ win32: "windows",
38
+ }
39
+ const archMap = {
40
+ x64: "x64",
41
+ arm64: "arm64",
42
+ arm: "arm",
43
+ }
44
+
45
+ let platform = platformMap[os.platform()]
46
+ if (!platform) {
47
+ platform = os.platform()
48
+ }
49
+ let arch = archMap[os.arch()]
50
+ if (!arch) {
51
+ arch = os.arch()
52
+ }
53
+ const base = "@kolbo-cli/kolbo-" + platform + "-" + arch
54
+ const binary = platform === "windows" ? "kolbo.exe" : "kolbo"
55
+
56
+ function supportsAvx2() {
57
+ if (arch !== "x64") return false
58
+
59
+ if (platform === "linux") {
60
+ try {
61
+ return /(^|\s)avx2(\s|$)/i.test(fs.readFileSync("/proc/cpuinfo", "utf8"))
62
+ } catch {
63
+ return false
64
+ }
65
+ }
66
+
67
+ if (platform === "darwin") {
68
+ try {
69
+ const result = childProcess.spawnSync("sysctl", ["-n", "hw.optional.avx2_0"], {
70
+ encoding: "utf8",
71
+ timeout: 1500,
72
+ })
73
+ if (result.status !== 0) return false
74
+ return (result.stdout || "").trim() === "1"
75
+ } catch {
76
+ return false
77
+ }
78
+ }
79
+
80
+ if (platform === "windows") {
81
+ const cmd =
82
+ '(Add-Type -MemberDefinition "[DllImport(""kernel32.dll"")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);" -Name Kernel32 -Namespace Win32 -PassThru)::IsProcessorFeaturePresent(40)'
83
+
84
+ for (const exe of ["powershell.exe", "pwsh.exe", "pwsh", "powershell"]) {
85
+ try {
86
+ const result = childProcess.spawnSync(exe, ["-NoProfile", "-NonInteractive", "-Command", cmd], {
87
+ encoding: "utf8",
88
+ timeout: 3000,
89
+ windowsHide: true,
90
+ })
91
+ if (result.status !== 0) continue
92
+ const out = (result.stdout || "").trim().toLowerCase()
93
+ if (out === "true" || out === "1") return true
94
+ if (out === "false" || out === "0") return false
95
+ } catch {
96
+ continue
97
+ }
98
+ }
99
+
100
+ return false
101
+ }
102
+
103
+ return false
104
+ }
105
+
106
+ const names = (() => {
107
+ const avx2 = supportsAvx2()
108
+ const baseline = arch === "x64" && !avx2
109
+
110
+ if (platform === "linux") {
111
+ const musl = (() => {
112
+ try {
113
+ if (fs.existsSync("/etc/alpine-release")) return true
114
+ } catch {
115
+ // ignore
116
+ }
117
+
118
+ try {
119
+ const result = childProcess.spawnSync("ldd", ["--version"], { encoding: "utf8" })
120
+ const text = ((result.stdout || "") + (result.stderr || "")).toLowerCase()
121
+ if (text.includes("musl")) return true
122
+ } catch {
123
+ // ignore
124
+ }
125
+
126
+ return false
127
+ })()
128
+
129
+ if (musl) {
130
+ if (arch === "x64") {
131
+ if (baseline) return [`${base}-baseline-musl`, `${base}-musl`, `${base}-baseline`, base]
132
+ return [`${base}-musl`, `${base}-baseline-musl`, base, `${base}-baseline`]
133
+ }
134
+ return [`${base}-musl`, base]
135
+ }
136
+
137
+ if (arch === "x64") {
138
+ if (baseline) return [`${base}-baseline`, base, `${base}-baseline-musl`, `${base}-musl`]
139
+ return [base, `${base}-baseline`, `${base}-musl`, `${base}-baseline-musl`]
140
+ }
141
+ return [base, `${base}-musl`]
142
+ }
143
+
144
+ if (arch === "x64") {
145
+ if (baseline) return [`${base}-baseline`, base]
146
+ return [base, `${base}-baseline`]
147
+ }
148
+ return [base]
149
+ })()
150
+
151
+ function findBinary(startDir) {
152
+ let current = startDir
153
+ for (;;) {
154
+ const modules = path.join(current, "node_modules")
155
+ if (fs.existsSync(modules)) {
156
+ for (const name of names) {
157
+ const candidate = path.join(modules, name, "bin", binary)
158
+ if (fs.existsSync(candidate)) return candidate
159
+ }
160
+ }
161
+ const parent = path.dirname(current)
162
+ if (parent === current) {
163
+ return
164
+ }
165
+ current = parent
166
+ }
167
+ }
168
+
169
+ const resolved = findBinary(scriptDir)
170
+ if (!resolved) {
171
+ console.error(
172
+ "It seems that your package manager failed to install the right version of the Kolbo CLI for your platform. You can try manually installing " +
173
+ names.map((n) => `\"${n}\"`).join(" or ") +
174
+ " package",
175
+ )
176
+ process.exit(1)
177
+ }
178
+
179
+ run(resolved)
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@kolbo/kolbo-code",
3
+ "version": "1.0.3",
4
+ "license": "MIT",
5
+ "description": "Kolbo — AI coding agent powered by Kolbo.AI",
6
+ "homepage": "https://kolbo.ai/cli",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/Zoharvan12/kolbo-code"
10
+ },
11
+ "bin": {
12
+ "kolbo": "./bin/kolbo"
13
+ },
14
+ "optionalDependencies": {
15
+ "@kolbo/kolbo-code-windows-x64": "1.0.3",
16
+ "@kolbo/kolbo-code-linux-arm64": "1.0.3",
17
+ "@kolbo/kolbo-code-linux-x64": "1.0.3",
18
+ "@kolbo/kolbo-code-windows-x64-baseline": "1.0.3",
19
+ "@kolbo/kolbo-code-windows-arm64": "1.0.3",
20
+ "@kolbo/kolbo-code-darwin-x64-baseline": "1.0.3",
21
+ "@kolbo/kolbo-code-darwin-arm64": "1.0.3",
22
+ "@kolbo/kolbo-code-darwin-x64": "1.0.3",
23
+ "@kolbo/kolbo-code-linux-x64-baseline": "1.0.3",
24
+ "@kolbo/kolbo-code-linux-x64-musl": "1.0.3",
25
+ "@kolbo/kolbo-code-linux-x64-baseline-musl": "1.0.3",
26
+ "@kolbo/kolbo-code-linux-arm64-musl": "1.0.3"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ }
31
+ }