@cubic-dev-ai/cli 1.6.2 → 1.6.4
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/cubic +61 -71
- package/bin/cubic.wrapper +61 -71
- package/package.json +13 -12
- package/preinstall.mjs +1 -26
package/bin/cubic
CHANGED
|
@@ -1,71 +1,61 @@
|
|
|
1
|
-
#!/bin/
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
exec "$resolved" "$@"
|
|
63
|
-
fi
|
|
64
|
-
|
|
65
|
-
# npx with no args should bootstrap setup flow in exec context
|
|
66
|
-
if [ "$#" -eq 0 ] && [ "${npm_command:-}" = "exec" ]; then
|
|
67
|
-
exec "$resolved" setup --mode install
|
|
68
|
-
fi
|
|
69
|
-
|
|
70
|
-
# Execute the binary with all arguments
|
|
71
|
-
exec "$resolved" "$@"
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import fs from "fs"
|
|
4
|
+
import path from "path"
|
|
5
|
+
import { spawnSync } from "child_process"
|
|
6
|
+
import { fileURLToPath } from "url"
|
|
7
|
+
|
|
8
|
+
function platformName() {
|
|
9
|
+
if (process.platform === "win32") return "windows"
|
|
10
|
+
return process.platform
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function archName() {
|
|
14
|
+
if (process.arch === "ia32") return "x86"
|
|
15
|
+
return process.arch
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function resolveBinary() {
|
|
19
|
+
if (process.env.CUBIC_BIN_PATH) return process.env.CUBIC_BIN_PATH
|
|
20
|
+
|
|
21
|
+
const script = fs.realpathSync(fileURLToPath(import.meta.url))
|
|
22
|
+
const platform = platformName()
|
|
23
|
+
const arch = archName()
|
|
24
|
+
const name = `@cubic-dev-ai/cli-${platform}-${arch}`
|
|
25
|
+
const binary = platform === "windows" ? "cubic.exe" : "cubic"
|
|
26
|
+
let dir = path.dirname(script)
|
|
27
|
+
|
|
28
|
+
while (true) {
|
|
29
|
+
const candidate = path.join(dir, "node_modules", name, "bin", binary)
|
|
30
|
+
if (fs.existsSync(candidate)) return candidate
|
|
31
|
+
|
|
32
|
+
const parent = path.dirname(dir)
|
|
33
|
+
if (parent === dir) break
|
|
34
|
+
dir = parent
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
console.error(
|
|
38
|
+
`It seems that your package manager failed to install the right version of the cubic CLI for your platform. You can try manually installing the "${name}" package`,
|
|
39
|
+
)
|
|
40
|
+
process.exit(1)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const binary = resolveBinary()
|
|
44
|
+
const args = process.argv.slice(2)
|
|
45
|
+
const command = args.length === 0 && process.env.npm_command === "exec" ? ["setup", "--mode", "install"] : args
|
|
46
|
+
const result = spawnSync(binary, command, /*__CUBIC_SPAWN_OPTS__*/ { stdio: "inherit", windowsHide: false })
|
|
47
|
+
|
|
48
|
+
if (result.error) {
|
|
49
|
+
console.error(result.error.message)
|
|
50
|
+
process.exit(1)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (result.signal) {
|
|
54
|
+
try {
|
|
55
|
+
process.kill(process.pid, result.signal)
|
|
56
|
+
} catch {
|
|
57
|
+
process.exit(1)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
process.exit(result.status ?? 1)
|
package/bin/cubic.wrapper
CHANGED
|
@@ -1,71 +1,61 @@
|
|
|
1
|
-
#!/bin/
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
exec "$resolved" "$@"
|
|
63
|
-
fi
|
|
64
|
-
|
|
65
|
-
# npx with no args should bootstrap setup flow in exec context
|
|
66
|
-
if [ "$#" -eq 0 ] && [ "${npm_command:-}" = "exec" ]; then
|
|
67
|
-
exec "$resolved" setup --mode install
|
|
68
|
-
fi
|
|
69
|
-
|
|
70
|
-
# Execute the binary with all arguments
|
|
71
|
-
exec "$resolved" "$@"
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import fs from "fs"
|
|
4
|
+
import path from "path"
|
|
5
|
+
import { spawnSync } from "child_process"
|
|
6
|
+
import { fileURLToPath } from "url"
|
|
7
|
+
|
|
8
|
+
function platformName() {
|
|
9
|
+
if (process.platform === "win32") return "windows"
|
|
10
|
+
return process.platform
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function archName() {
|
|
14
|
+
if (process.arch === "ia32") return "x86"
|
|
15
|
+
return process.arch
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function resolveBinary() {
|
|
19
|
+
if (process.env.CUBIC_BIN_PATH) return process.env.CUBIC_BIN_PATH
|
|
20
|
+
|
|
21
|
+
const script = fs.realpathSync(fileURLToPath(import.meta.url))
|
|
22
|
+
const platform = platformName()
|
|
23
|
+
const arch = archName()
|
|
24
|
+
const name = `@cubic-dev-ai/cli-${platform}-${arch}`
|
|
25
|
+
const binary = platform === "windows" ? "cubic.exe" : "cubic"
|
|
26
|
+
let dir = path.dirname(script)
|
|
27
|
+
|
|
28
|
+
while (true) {
|
|
29
|
+
const candidate = path.join(dir, "node_modules", name, "bin", binary)
|
|
30
|
+
if (fs.existsSync(candidate)) return candidate
|
|
31
|
+
|
|
32
|
+
const parent = path.dirname(dir)
|
|
33
|
+
if (parent === dir) break
|
|
34
|
+
dir = parent
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
console.error(
|
|
38
|
+
`It seems that your package manager failed to install the right version of the cubic CLI for your platform. You can try manually installing the "${name}" package`,
|
|
39
|
+
)
|
|
40
|
+
process.exit(1)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const binary = resolveBinary()
|
|
44
|
+
const args = process.argv.slice(2)
|
|
45
|
+
const command = args.length === 0 && process.env.npm_command === "exec" ? ["setup", "--mode", "install"] : args
|
|
46
|
+
const result = spawnSync(binary, command, /*__CUBIC_SPAWN_OPTS__*/ { stdio: "inherit", windowsHide: false })
|
|
47
|
+
|
|
48
|
+
if (result.error) {
|
|
49
|
+
console.error(result.error.message)
|
|
50
|
+
process.exit(1)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (result.signal) {
|
|
54
|
+
try {
|
|
55
|
+
process.kill(process.pid, result.signal)
|
|
56
|
+
} catch {
|
|
57
|
+
process.exit(1)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
process.exit(result.status ?? 1)
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cubic-dev-ai/cli",
|
|
3
|
+
"type": "module",
|
|
3
4
|
"bin": {
|
|
4
5
|
"cubic": "./bin/cubic"
|
|
5
6
|
},
|
|
@@ -7,23 +8,23 @@
|
|
|
7
8
|
"preinstall": "bun ./preinstall.mjs || node ./preinstall.mjs",
|
|
8
9
|
"postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
|
|
9
10
|
},
|
|
10
|
-
"version": "1.6.
|
|
11
|
+
"version": "1.6.4",
|
|
11
12
|
"repository": {
|
|
12
13
|
"type": "git",
|
|
13
14
|
"url": "git+https://github.com/mrge-io/cubic-cli.git",
|
|
14
15
|
"directory": "packages/cubic"
|
|
15
16
|
},
|
|
16
17
|
"optionalDependencies": {
|
|
17
|
-
"@cubic-dev-ai/cli-linux-arm64": "1.6.
|
|
18
|
-
"@cubic-dev-ai/cli-linux-x64": "1.6.
|
|
19
|
-
"@cubic-dev-ai/cli-linux-x64-baseline": "1.6.
|
|
20
|
-
"@cubic-dev-ai/cli-linux-arm64-musl": "1.6.
|
|
21
|
-
"@cubic-dev-ai/cli-linux-x64-musl": "1.6.
|
|
22
|
-
"@cubic-dev-ai/cli-linux-x64-baseline-musl": "1.6.
|
|
23
|
-
"@cubic-dev-ai/cli-darwin-arm64": "1.6.
|
|
24
|
-
"@cubic-dev-ai/cli-darwin-x64": "1.6.
|
|
25
|
-
"@cubic-dev-ai/cli-darwin-x64-baseline": "1.6.
|
|
26
|
-
"@cubic-dev-ai/cli-windows-x64": "1.6.
|
|
27
|
-
"@cubic-dev-ai/cli-windows-x64-baseline": "1.6.
|
|
18
|
+
"@cubic-dev-ai/cli-linux-arm64": "1.6.4",
|
|
19
|
+
"@cubic-dev-ai/cli-linux-x64": "1.6.4",
|
|
20
|
+
"@cubic-dev-ai/cli-linux-x64-baseline": "1.6.4",
|
|
21
|
+
"@cubic-dev-ai/cli-linux-arm64-musl": "1.6.4",
|
|
22
|
+
"@cubic-dev-ai/cli-linux-x64-musl": "1.6.4",
|
|
23
|
+
"@cubic-dev-ai/cli-linux-x64-baseline-musl": "1.6.4",
|
|
24
|
+
"@cubic-dev-ai/cli-darwin-arm64": "1.6.4",
|
|
25
|
+
"@cubic-dev-ai/cli-darwin-x64": "1.6.4",
|
|
26
|
+
"@cubic-dev-ai/cli-darwin-x64-baseline": "1.6.4",
|
|
27
|
+
"@cubic-dev-ai/cli-windows-x64": "1.6.4",
|
|
28
|
+
"@cubic-dev-ai/cli-windows-x64-baseline": "1.6.4"
|
|
28
29
|
}
|
|
29
30
|
}
|
package/preinstall.mjs
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import fs from "fs"
|
|
4
|
-
import path from "path"
|
|
5
3
|
import os from "os"
|
|
6
|
-
import { fileURLToPath } from "url"
|
|
7
|
-
|
|
8
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
9
4
|
|
|
10
5
|
function main() {
|
|
11
6
|
if (os.platform() !== "win32") {
|
|
@@ -13,27 +8,7 @@ function main() {
|
|
|
13
8
|
return
|
|
14
9
|
}
|
|
15
10
|
|
|
16
|
-
console.log("Windows detected:
|
|
17
|
-
|
|
18
|
-
// Read package.json
|
|
19
|
-
const packageJsonPath = path.join(__dirname, "package.json")
|
|
20
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"))
|
|
21
|
-
|
|
22
|
-
// Modify bin to point to .cmd file on Windows
|
|
23
|
-
packageJson.bin = {
|
|
24
|
-
cubic: "./bin/cubic.cmd",
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Write it back
|
|
28
|
-
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
|
|
29
|
-
console.log("Updated package.json bin to use cubic.cmd")
|
|
30
|
-
|
|
31
|
-
// Now you can also remove the Unix script if you want
|
|
32
|
-
const unixScript = path.join(__dirname, "bin", "cubic")
|
|
33
|
-
if (fs.existsSync(unixScript)) {
|
|
34
|
-
console.log("Removing Unix shell script")
|
|
35
|
-
fs.unlinkSync(unixScript)
|
|
36
|
-
}
|
|
11
|
+
console.log("Windows detected: using Node bin wrapper")
|
|
37
12
|
}
|
|
38
13
|
|
|
39
14
|
try {
|