@synsci/cli 1.1.48 → 1.1.49
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 +18 -9
- package/postinstall.mjs +133 -0
- /package/bin/{synsc.js → synsc} +0 -0
package/package.json
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synsci/cli",
|
|
3
|
-
"version": "1.1.48",
|
|
4
|
-
"description": "Synthetic Sciences CLI - AI research agent",
|
|
5
3
|
"bin": {
|
|
6
|
-
"synsc": "./bin/synsc
|
|
4
|
+
"synsc": "./bin/synsc"
|
|
7
5
|
},
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
"scripts": {
|
|
7
|
+
"postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
|
|
8
|
+
},
|
|
9
|
+
"version": "1.1.49",
|
|
10
|
+
"optionalDependencies": {
|
|
11
|
+
"@synsci/cli-windows-x64": "1.1.49",
|
|
12
|
+
"@synsci/cli-linux-x64-baseline-musl": "1.1.49",
|
|
13
|
+
"@synsci/cli-linux-x64-baseline": "1.1.49",
|
|
14
|
+
"@synsci/cli-linux-x64": "1.1.49",
|
|
15
|
+
"@synsci/cli-darwin-arm64": "1.1.49",
|
|
16
|
+
"@synsci/cli-windows-x64-baseline": "1.1.49",
|
|
17
|
+
"@synsci/cli-darwin-x64-baseline": "1.1.49",
|
|
18
|
+
"@synsci/cli-linux-arm64": "1.1.49",
|
|
19
|
+
"@synsci/cli-linux-arm64-musl": "1.1.49",
|
|
20
|
+
"@synsci/cli-linux-x64-musl": "1.1.49",
|
|
21
|
+
"@synsci/cli-darwin-x64": "1.1.49"
|
|
13
22
|
}
|
|
14
|
-
}
|
|
23
|
+
}
|
package/postinstall.mjs
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import fs from "fs"
|
|
4
|
+
import path from "path"
|
|
5
|
+
import os from "os"
|
|
6
|
+
import { fileURLToPath } from "url"
|
|
7
|
+
import { createRequire } from "module"
|
|
8
|
+
|
|
9
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
10
|
+
const require = createRequire(import.meta.url)
|
|
11
|
+
|
|
12
|
+
function detectPlatformAndArch() {
|
|
13
|
+
// Map platform names
|
|
14
|
+
let platform
|
|
15
|
+
switch (os.platform()) {
|
|
16
|
+
case "darwin":
|
|
17
|
+
platform = "darwin"
|
|
18
|
+
break
|
|
19
|
+
case "linux":
|
|
20
|
+
platform = "linux"
|
|
21
|
+
break
|
|
22
|
+
case "win32":
|
|
23
|
+
platform = "windows"
|
|
24
|
+
break
|
|
25
|
+
default:
|
|
26
|
+
platform = os.platform()
|
|
27
|
+
break
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Map architecture names
|
|
31
|
+
let arch
|
|
32
|
+
switch (os.arch()) {
|
|
33
|
+
case "x64":
|
|
34
|
+
arch = "x64"
|
|
35
|
+
break
|
|
36
|
+
case "arm64":
|
|
37
|
+
arch = "arm64"
|
|
38
|
+
break
|
|
39
|
+
case "arm":
|
|
40
|
+
arch = "arm"
|
|
41
|
+
break
|
|
42
|
+
default:
|
|
43
|
+
arch = os.arch()
|
|
44
|
+
break
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return { platform, arch }
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function findBinary() {
|
|
51
|
+
const { platform, arch } = detectPlatformAndArch()
|
|
52
|
+
const binaryName = platform === "windows" ? "synsc.exe" : "synsc"
|
|
53
|
+
|
|
54
|
+
// Try scoped package first (@synsci/cli-darwin-arm64), then unscoped (synsc-darwin-arm64)
|
|
55
|
+
const packageNames = [
|
|
56
|
+
`@synsci/cli-${platform}-${arch}`,
|
|
57
|
+
`synsc-${platform}-${arch}`,
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
for (const packageName of packageNames) {
|
|
61
|
+
try {
|
|
62
|
+
const packageJsonPath = require.resolve(`${packageName}/package.json`)
|
|
63
|
+
const packageDir = path.dirname(packageJsonPath)
|
|
64
|
+
const binaryPath = path.join(packageDir, "bin", binaryName)
|
|
65
|
+
|
|
66
|
+
if (!fs.existsSync(binaryPath)) {
|
|
67
|
+
continue
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return { binaryPath, binaryName }
|
|
71
|
+
} catch {
|
|
72
|
+
continue
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
throw new Error(`Could not find platform binary package for ${platform}-${arch}`)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function prepareBinDirectory(binaryName) {
|
|
80
|
+
const binDir = path.join(__dirname, "bin")
|
|
81
|
+
const targetPath = path.join(binDir, binaryName)
|
|
82
|
+
|
|
83
|
+
// Ensure bin directory exists
|
|
84
|
+
if (!fs.existsSync(binDir)) {
|
|
85
|
+
fs.mkdirSync(binDir, { recursive: true })
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Remove existing binary/symlink if it exists
|
|
89
|
+
if (fs.existsSync(targetPath)) {
|
|
90
|
+
fs.unlinkSync(targetPath)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return { binDir, targetPath }
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function symlinkBinary(sourcePath, binaryName) {
|
|
97
|
+
const { targetPath } = prepareBinDirectory(binaryName)
|
|
98
|
+
|
|
99
|
+
fs.symlinkSync(sourcePath, targetPath)
|
|
100
|
+
console.log(`synsc binary symlinked: ${targetPath} -> ${sourcePath}`)
|
|
101
|
+
|
|
102
|
+
// Verify the file exists after operation
|
|
103
|
+
if (!fs.existsSync(targetPath)) {
|
|
104
|
+
throw new Error(`Failed to symlink binary to ${targetPath}`)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async function main() {
|
|
109
|
+
try {
|
|
110
|
+
if (os.platform() === "win32") {
|
|
111
|
+
// On Windows, the .exe is already included in the package and bin field points to it
|
|
112
|
+
// No postinstall setup needed
|
|
113
|
+
console.log("Windows detected: binary setup not needed (using packaged .exe)")
|
|
114
|
+
return
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// On non-Windows platforms, just verify the binary package exists
|
|
118
|
+
// Don't replace the wrapper script - it handles binary execution
|
|
119
|
+
const { binaryPath } = findBinary()
|
|
120
|
+
console.log(`Platform binary verified at: ${binaryPath}`)
|
|
121
|
+
console.log("Wrapper script will handle binary execution")
|
|
122
|
+
} catch (error) {
|
|
123
|
+
console.error("Failed to setup synsc binary:", error.message)
|
|
124
|
+
process.exit(1)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
try {
|
|
129
|
+
main()
|
|
130
|
+
} catch (error) {
|
|
131
|
+
console.error("Postinstall script error:", error.message)
|
|
132
|
+
process.exit(0)
|
|
133
|
+
}
|
/package/bin/{synsc.js → synsc}
RENAMED
|
File without changes
|