@vikasitai/vikasit-code 1.2.0 → 2.0.1
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/bin/opencode +107 -0
- package/bin/bin/vikasit +107 -0
- package/bin/opencode +107 -0
- package/package.json +5 -19
- package/README.md +0 -3
package/bin/bin/opencode
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
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
|
+
process.exit(typeof result.status === "number" ? result.status : 0)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const envPath = process.env.VIKASIT_BIN_PATH
|
|
20
|
+
if (envPath) run(envPath)
|
|
21
|
+
|
|
22
|
+
const scriptPath = fs.realpathSync(__filename)
|
|
23
|
+
const scriptDir = path.dirname(scriptPath)
|
|
24
|
+
|
|
25
|
+
const cached = path.join(scriptDir, ".vikasit")
|
|
26
|
+
if (fs.existsSync(cached)) run(cached)
|
|
27
|
+
|
|
28
|
+
const platformMap = { darwin: "darwin", linux: "linux", win32: "windows" }
|
|
29
|
+
const archMap = { x64: "x64", arm64: "arm64", arm: "arm" }
|
|
30
|
+
|
|
31
|
+
const platform = platformMap[os.platform()] || os.platform()
|
|
32
|
+
const arch = archMap[os.arch()] || os.arch()
|
|
33
|
+
const base = "vikasit-code-" + platform + "-" + arch
|
|
34
|
+
const binary = platform === "windows" ? "vikasit.exe" : "vikasit"
|
|
35
|
+
|
|
36
|
+
function supportsAvx2() {
|
|
37
|
+
if (arch !== "x64") return false
|
|
38
|
+
if (platform === "darwin") {
|
|
39
|
+
try {
|
|
40
|
+
const r = childProcess.spawnSync("sysctl", ["-n", "hw.optional.avx2_0"], { encoding: "utf8", timeout: 1500 })
|
|
41
|
+
return r.status === 0 && (r.stdout || "").trim() === "1"
|
|
42
|
+
} catch { return false }
|
|
43
|
+
}
|
|
44
|
+
if (platform === "linux") {
|
|
45
|
+
try { return /(^|\s)avx2(\s|$)/i.test(fs.readFileSync("/proc/cpuinfo", "utf8")) }
|
|
46
|
+
catch { return false }
|
|
47
|
+
}
|
|
48
|
+
return false
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const names = (() => {
|
|
52
|
+
const avx2 = supportsAvx2()
|
|
53
|
+
const baseline = arch === "x64" && !avx2
|
|
54
|
+
|
|
55
|
+
if (platform === "linux") {
|
|
56
|
+
const musl = (() => {
|
|
57
|
+
try { if (fs.existsSync("/etc/alpine-release")) return true } catch {}
|
|
58
|
+
try {
|
|
59
|
+
const r = childProcess.spawnSync("ldd", ["--version"], { encoding: "utf8" })
|
|
60
|
+
if (((r.stdout || "") + (r.stderr || "")).toLowerCase().includes("musl")) return true
|
|
61
|
+
} catch {}
|
|
62
|
+
return false
|
|
63
|
+
})()
|
|
64
|
+
|
|
65
|
+
if (musl) {
|
|
66
|
+
if (baseline) return [`${base}-baseline-musl`, `${base}-musl`, `${base}-baseline`, base]
|
|
67
|
+
return [`${base}-musl`, `${base}-baseline-musl`, base, `${base}-baseline`]
|
|
68
|
+
}
|
|
69
|
+
if (baseline) return [`${base}-baseline`, base, `${base}-baseline-musl`, `${base}-musl`]
|
|
70
|
+
return [base, `${base}-baseline`, `${base}-musl`, `${base}-baseline-musl`]
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (baseline) return [`${base}-baseline`, base]
|
|
74
|
+
return [base, `${base}-baseline`]
|
|
75
|
+
})()
|
|
76
|
+
|
|
77
|
+
function findBinary(startDir) {
|
|
78
|
+
let current = startDir
|
|
79
|
+
for (;;) {
|
|
80
|
+
const modules = path.join(current, "node_modules")
|
|
81
|
+
if (fs.existsSync(modules)) {
|
|
82
|
+
for (const name of names) {
|
|
83
|
+
// Check @vikasitai scoped package first
|
|
84
|
+
const scoped = path.join(modules, "@vikasitai", name, "bin", binary)
|
|
85
|
+
if (fs.existsSync(scoped)) return scoped
|
|
86
|
+
// Fallback to unscoped
|
|
87
|
+
const unscoped = path.join(modules, name, "bin", binary)
|
|
88
|
+
if (fs.existsSync(unscoped)) return unscoped
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const parent = path.dirname(current)
|
|
92
|
+
if (parent === current) return
|
|
93
|
+
current = parent
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const resolved = findBinary(scriptDir)
|
|
98
|
+
if (!resolved) {
|
|
99
|
+
console.error(
|
|
100
|
+
"Could not find Vikasit Code binary for your platform (" + platform + "/" + arch + ").\n" +
|
|
101
|
+
"Try: npm install -g @vikasitai/" + names[0] + "\n" +
|
|
102
|
+
"Or visit: https://vikasit.ai/code"
|
|
103
|
+
)
|
|
104
|
+
process.exit(1)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
run(resolved)
|
package/bin/bin/vikasit
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
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
|
+
process.exit(typeof result.status === "number" ? result.status : 0)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const envPath = process.env.VIKASIT_BIN_PATH
|
|
20
|
+
if (envPath) run(envPath)
|
|
21
|
+
|
|
22
|
+
const scriptPath = fs.realpathSync(__filename)
|
|
23
|
+
const scriptDir = path.dirname(scriptPath)
|
|
24
|
+
|
|
25
|
+
const cached = path.join(scriptDir, ".vikasit")
|
|
26
|
+
if (fs.existsSync(cached)) run(cached)
|
|
27
|
+
|
|
28
|
+
const platformMap = { darwin: "darwin", linux: "linux", win32: "windows" }
|
|
29
|
+
const archMap = { x64: "x64", arm64: "arm64", arm: "arm" }
|
|
30
|
+
|
|
31
|
+
const platform = platformMap[os.platform()] || os.platform()
|
|
32
|
+
const arch = archMap[os.arch()] || os.arch()
|
|
33
|
+
const base = "vikasit-code-" + platform + "-" + arch
|
|
34
|
+
const binary = platform === "windows" ? "vikasit.exe" : "vikasit"
|
|
35
|
+
|
|
36
|
+
function supportsAvx2() {
|
|
37
|
+
if (arch !== "x64") return false
|
|
38
|
+
if (platform === "darwin") {
|
|
39
|
+
try {
|
|
40
|
+
const r = childProcess.spawnSync("sysctl", ["-n", "hw.optional.avx2_0"], { encoding: "utf8", timeout: 1500 })
|
|
41
|
+
return r.status === 0 && (r.stdout || "").trim() === "1"
|
|
42
|
+
} catch { return false }
|
|
43
|
+
}
|
|
44
|
+
if (platform === "linux") {
|
|
45
|
+
try { return /(^|\s)avx2(\s|$)/i.test(fs.readFileSync("/proc/cpuinfo", "utf8")) }
|
|
46
|
+
catch { return false }
|
|
47
|
+
}
|
|
48
|
+
return false
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const names = (() => {
|
|
52
|
+
const avx2 = supportsAvx2()
|
|
53
|
+
const baseline = arch === "x64" && !avx2
|
|
54
|
+
|
|
55
|
+
if (platform === "linux") {
|
|
56
|
+
const musl = (() => {
|
|
57
|
+
try { if (fs.existsSync("/etc/alpine-release")) return true } catch {}
|
|
58
|
+
try {
|
|
59
|
+
const r = childProcess.spawnSync("ldd", ["--version"], { encoding: "utf8" })
|
|
60
|
+
if (((r.stdout || "") + (r.stderr || "")).toLowerCase().includes("musl")) return true
|
|
61
|
+
} catch {}
|
|
62
|
+
return false
|
|
63
|
+
})()
|
|
64
|
+
|
|
65
|
+
if (musl) {
|
|
66
|
+
if (baseline) return [`${base}-baseline-musl`, `${base}-musl`, `${base}-baseline`, base]
|
|
67
|
+
return [`${base}-musl`, `${base}-baseline-musl`, base, `${base}-baseline`]
|
|
68
|
+
}
|
|
69
|
+
if (baseline) return [`${base}-baseline`, base, `${base}-baseline-musl`, `${base}-musl`]
|
|
70
|
+
return [base, `${base}-baseline`, `${base}-musl`, `${base}-baseline-musl`]
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (baseline) return [`${base}-baseline`, base]
|
|
74
|
+
return [base, `${base}-baseline`]
|
|
75
|
+
})()
|
|
76
|
+
|
|
77
|
+
function findBinary(startDir) {
|
|
78
|
+
let current = startDir
|
|
79
|
+
for (;;) {
|
|
80
|
+
const modules = path.join(current, "node_modules")
|
|
81
|
+
if (fs.existsSync(modules)) {
|
|
82
|
+
for (const name of names) {
|
|
83
|
+
// Check @vikasitai scoped package first
|
|
84
|
+
const scoped = path.join(modules, "@vikasitai", name, "bin", binary)
|
|
85
|
+
if (fs.existsSync(scoped)) return scoped
|
|
86
|
+
// Fallback to unscoped
|
|
87
|
+
const unscoped = path.join(modules, name, "bin", binary)
|
|
88
|
+
if (fs.existsSync(unscoped)) return unscoped
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const parent = path.dirname(current)
|
|
92
|
+
if (parent === current) return
|
|
93
|
+
current = parent
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const resolved = findBinary(scriptDir)
|
|
98
|
+
if (!resolved) {
|
|
99
|
+
console.error(
|
|
100
|
+
"Could not find Vikasit Code binary for your platform (" + platform + "/" + arch + ").\n" +
|
|
101
|
+
"Try: npm install -g @vikasitai/" + names[0] + "\n" +
|
|
102
|
+
"Or visit: https://vikasit.ai/code"
|
|
103
|
+
)
|
|
104
|
+
process.exit(1)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
run(resolved)
|
package/bin/opencode
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
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
|
+
process.exit(typeof result.status === "number" ? result.status : 0)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const envPath = process.env.VIKASIT_BIN_PATH
|
|
20
|
+
if (envPath) run(envPath)
|
|
21
|
+
|
|
22
|
+
const scriptPath = fs.realpathSync(__filename)
|
|
23
|
+
const scriptDir = path.dirname(scriptPath)
|
|
24
|
+
|
|
25
|
+
const cached = path.join(scriptDir, ".vikasit")
|
|
26
|
+
if (fs.existsSync(cached)) run(cached)
|
|
27
|
+
|
|
28
|
+
const platformMap = { darwin: "darwin", linux: "linux", win32: "windows" }
|
|
29
|
+
const archMap = { x64: "x64", arm64: "arm64", arm: "arm" }
|
|
30
|
+
|
|
31
|
+
const platform = platformMap[os.platform()] || os.platform()
|
|
32
|
+
const arch = archMap[os.arch()] || os.arch()
|
|
33
|
+
const base = "vikasit-code-" + platform + "-" + arch
|
|
34
|
+
const binary = platform === "windows" ? "vikasit.exe" : "vikasit"
|
|
35
|
+
|
|
36
|
+
function supportsAvx2() {
|
|
37
|
+
if (arch !== "x64") return false
|
|
38
|
+
if (platform === "darwin") {
|
|
39
|
+
try {
|
|
40
|
+
const r = childProcess.spawnSync("sysctl", ["-n", "hw.optional.avx2_0"], { encoding: "utf8", timeout: 1500 })
|
|
41
|
+
return r.status === 0 && (r.stdout || "").trim() === "1"
|
|
42
|
+
} catch { return false }
|
|
43
|
+
}
|
|
44
|
+
if (platform === "linux") {
|
|
45
|
+
try { return /(^|\s)avx2(\s|$)/i.test(fs.readFileSync("/proc/cpuinfo", "utf8")) }
|
|
46
|
+
catch { return false }
|
|
47
|
+
}
|
|
48
|
+
return false
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const names = (() => {
|
|
52
|
+
const avx2 = supportsAvx2()
|
|
53
|
+
const baseline = arch === "x64" && !avx2
|
|
54
|
+
|
|
55
|
+
if (platform === "linux") {
|
|
56
|
+
const musl = (() => {
|
|
57
|
+
try { if (fs.existsSync("/etc/alpine-release")) return true } catch {}
|
|
58
|
+
try {
|
|
59
|
+
const r = childProcess.spawnSync("ldd", ["--version"], { encoding: "utf8" })
|
|
60
|
+
if (((r.stdout || "") + (r.stderr || "")).toLowerCase().includes("musl")) return true
|
|
61
|
+
} catch {}
|
|
62
|
+
return false
|
|
63
|
+
})()
|
|
64
|
+
|
|
65
|
+
if (musl) {
|
|
66
|
+
if (baseline) return [`${base}-baseline-musl`, `${base}-musl`, `${base}-baseline`, base]
|
|
67
|
+
return [`${base}-musl`, `${base}-baseline-musl`, base, `${base}-baseline`]
|
|
68
|
+
}
|
|
69
|
+
if (baseline) return [`${base}-baseline`, base, `${base}-baseline-musl`, `${base}-musl`]
|
|
70
|
+
return [base, `${base}-baseline`, `${base}-musl`, `${base}-baseline-musl`]
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (baseline) return [`${base}-baseline`, base]
|
|
74
|
+
return [base, `${base}-baseline`]
|
|
75
|
+
})()
|
|
76
|
+
|
|
77
|
+
function findBinary(startDir) {
|
|
78
|
+
let current = startDir
|
|
79
|
+
for (;;) {
|
|
80
|
+
const modules = path.join(current, "node_modules")
|
|
81
|
+
if (fs.existsSync(modules)) {
|
|
82
|
+
for (const name of names) {
|
|
83
|
+
// Check @vikasitai scoped package first
|
|
84
|
+
const scoped = path.join(modules, "@vikasitai", name, "bin", binary)
|
|
85
|
+
if (fs.existsSync(scoped)) return scoped
|
|
86
|
+
// Fallback to unscoped
|
|
87
|
+
const unscoped = path.join(modules, name, "bin", binary)
|
|
88
|
+
if (fs.existsSync(unscoped)) return unscoped
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const parent = path.dirname(current)
|
|
92
|
+
if (parent === current) return
|
|
93
|
+
current = parent
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const resolved = findBinary(scriptDir)
|
|
98
|
+
if (!resolved) {
|
|
99
|
+
console.error(
|
|
100
|
+
"Could not find Vikasit Code binary for your platform (" + platform + "/" + arch + ").\n" +
|
|
101
|
+
"Try: npm install -g @vikasitai/" + names[0] + "\n" +
|
|
102
|
+
"Or visit: https://vikasit.ai/code"
|
|
103
|
+
)
|
|
104
|
+
process.exit(1)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
run(resolved)
|
package/package.json
CHANGED
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vikasitai/vikasit-code",
|
|
3
|
-
"version": "1.2.0",
|
|
4
|
-
"description": "Your AI coding partner, right in the terminal",
|
|
5
|
-
"author": "Vikasit AI <info@vikasit.ai>",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"homepage": "https://vikasit.ai/code",
|
|
8
3
|
"bin": {
|
|
9
|
-
"vikasit": "bin/vikasit"
|
|
4
|
+
"vikasit": "./bin/vikasit"
|
|
10
5
|
},
|
|
11
6
|
"scripts": {
|
|
12
|
-
"postinstall": "
|
|
7
|
+
"postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
|
|
13
8
|
},
|
|
9
|
+
"version": "2.0.1",
|
|
10
|
+
"license": "MIT",
|
|
14
11
|
"optionalDependencies": {
|
|
15
|
-
"@vikasitai/vikasit-code-darwin-arm64": "
|
|
16
|
-
"@vikasitai/vikasit-code-darwin-x64": "1.2.0",
|
|
17
|
-
"@vikasitai/vikasit-code-darwin-x64-baseline": "1.2.0",
|
|
18
|
-
"@vikasitai/vikasit-code-linux-arm64": "1.2.0",
|
|
19
|
-
"@vikasitai/vikasit-code-linux-arm64-musl": "1.2.0",
|
|
20
|
-
"@vikasitai/vikasit-code-linux-x64": "1.2.0",
|
|
21
|
-
"@vikasitai/vikasit-code-linux-x64-baseline": "1.2.0",
|
|
22
|
-
"@vikasitai/vikasit-code-linux-x64-baseline-musl": "1.2.0",
|
|
23
|
-
"@vikasitai/vikasit-code-linux-x64-musl": "1.2.0",
|
|
24
|
-
"@vikasitai/vikasit-code-windows-arm64": "1.2.0",
|
|
25
|
-
"@vikasitai/vikasit-code-windows-x64": "1.2.0",
|
|
26
|
-
"@vikasitai/vikasit-code-windows-x64-baseline": "1.2.0"
|
|
12
|
+
"@vikasitai/vikasit-code-darwin-arm64": "2.0.1"
|
|
27
13
|
}
|
|
28
14
|
}
|
package/README.md
DELETED