@vikasitai/vikasit-code 2.0.1 → 2.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.
- package/package.json +14 -3
- package/postinstall.mjs +23 -5
- package/bin/bin/opencode +0 -107
- package/bin/bin/vikasit +0 -107
package/package.json
CHANGED
|
@@ -6,9 +6,20 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
|
|
8
8
|
},
|
|
9
|
-
"version": "2.0.
|
|
9
|
+
"version": "2.0.3",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"optionalDependencies": {
|
|
12
|
-
"@vikasitai/vikasit-code-
|
|
12
|
+
"@vikasitai/vikasit-code-linux-arm64": "2.0.3",
|
|
13
|
+
"@vikasitai/vikasit-code-linux-x64": "2.0.3",
|
|
14
|
+
"@vikasitai/vikasit-code-linux-x64-baseline": "2.0.3",
|
|
15
|
+
"@vikasitai/vikasit-code-linux-arm64-musl": "2.0.3",
|
|
16
|
+
"@vikasitai/vikasit-code-linux-x64-musl": "2.0.3",
|
|
17
|
+
"@vikasitai/vikasit-code-linux-x64-baseline-musl": "2.0.3",
|
|
18
|
+
"@vikasitai/vikasit-code-darwin-arm64": "2.0.3",
|
|
19
|
+
"@vikasitai/vikasit-code-darwin-x64": "2.0.3",
|
|
20
|
+
"@vikasitai/vikasit-code-darwin-x64-baseline": "2.0.3",
|
|
21
|
+
"@vikasitai/vikasit-code-windows-arm64": "2.0.3",
|
|
22
|
+
"@vikasitai/vikasit-code-windows-x64": "2.0.3",
|
|
23
|
+
"@vikasitai/vikasit-code-windows-x64-baseline": "2.0.3"
|
|
13
24
|
}
|
|
14
|
-
}
|
|
25
|
+
}
|
package/postinstall.mjs
CHANGED
|
@@ -49,8 +49,8 @@ function detectPlatformAndArch() {
|
|
|
49
49
|
|
|
50
50
|
function findBinary() {
|
|
51
51
|
const { platform, arch } = detectPlatformAndArch()
|
|
52
|
-
const packageName =
|
|
53
|
-
const binaryName = platform === "windows" ? "
|
|
52
|
+
const packageName = `@vikasitai/vikasit-code-${platform}-${arch}`
|
|
53
|
+
const binaryName = platform === "windows" ? "vikasit.exe" : "vikasit"
|
|
54
54
|
|
|
55
55
|
try {
|
|
56
56
|
// Use require.resolve to find the package
|
|
@@ -89,7 +89,7 @@ function symlinkBinary(sourcePath, binaryName) {
|
|
|
89
89
|
const { targetPath } = prepareBinDirectory(binaryName)
|
|
90
90
|
|
|
91
91
|
fs.symlinkSync(sourcePath, targetPath)
|
|
92
|
-
console.log(`
|
|
92
|
+
console.log(`vikasit binary symlinked: ${targetPath} -> ${sourcePath}`)
|
|
93
93
|
|
|
94
94
|
// Verify the file exists after operation
|
|
95
95
|
if (!fs.existsSync(targetPath)) {
|
|
@@ -97,8 +97,26 @@ function symlinkBinary(sourcePath, binaryName) {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
// Rewrite any stale dev.vikasit.ai API URL left over from earlier dev-preview
|
|
101
|
+
// CLI builds. Idempotent and silent on failure — must never block install.
|
|
102
|
+
function migrateUserConfig() {
|
|
103
|
+
try {
|
|
104
|
+
const configPath = path.join(os.homedir(), ".config", "vikasit", "vikasit.json")
|
|
105
|
+
if (!fs.existsSync(configPath)) return
|
|
106
|
+
const raw = fs.readFileSync(configPath, "utf-8")
|
|
107
|
+
if (!raw.includes("dev.vikasit.ai")) return
|
|
108
|
+
const fixed = raw.replace(/https:\/\/dev\.vikasit\.ai/g, "https://vikasit.ai")
|
|
109
|
+
fs.writeFileSync(configPath, fixed)
|
|
110
|
+
console.log("vikasit: migrated global config dev.vikasit.ai -> vikasit.ai")
|
|
111
|
+
} catch {
|
|
112
|
+
// swallow — never let migration break install
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
100
116
|
async function main() {
|
|
101
117
|
try {
|
|
118
|
+
migrateUserConfig()
|
|
119
|
+
|
|
102
120
|
if (os.platform() === "win32") {
|
|
103
121
|
// On Windows, the .exe is already included in the package and bin field points to it
|
|
104
122
|
// No postinstall setup needed
|
|
@@ -109,7 +127,7 @@ async function main() {
|
|
|
109
127
|
// On non-Windows platforms, just verify the binary package exists
|
|
110
128
|
// Don't replace the wrapper script - it handles binary execution
|
|
111
129
|
const { binaryPath } = findBinary()
|
|
112
|
-
const target = path.join(__dirname, "bin", ".
|
|
130
|
+
const target = path.join(__dirname, "bin", ".vikasit")
|
|
113
131
|
if (fs.existsSync(target)) fs.unlinkSync(target)
|
|
114
132
|
try {
|
|
115
133
|
fs.linkSync(binaryPath, target)
|
|
@@ -118,7 +136,7 @@ async function main() {
|
|
|
118
136
|
}
|
|
119
137
|
fs.chmodSync(target, 0o755)
|
|
120
138
|
} catch (error) {
|
|
121
|
-
console.error("Failed to setup
|
|
139
|
+
console.error("Failed to setup vikasit binary:", error.message)
|
|
122
140
|
process.exit(1)
|
|
123
141
|
}
|
|
124
142
|
}
|
package/bin/bin/opencode
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
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)
|