@cubic-dev-ai/cli 1.6.2-beijing.2 → 1.6.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/bin/cubic ADDED
@@ -0,0 +1,61 @@
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.cmd CHANGED
@@ -25,7 +25,7 @@ if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
25
25
  set "arch=x64"
26
26
  )
27
27
 
28
- set "name=@cubic-dev-ai\cli-!platform!-!arch!"
28
+ set "name=@cubic-dev-ai/cli-!platform!-!arch!"
29
29
  set "binary=cubic.exe"
30
30
 
31
31
  rem Search for the binary starting from script location
@@ -0,0 +1,61 @@
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/git-ai.json CHANGED
File without changes
package/package.json CHANGED
@@ -1,27 +1,30 @@
1
1
  {
2
2
  "name": "@cubic-dev-ai/cli",
3
- "version": "1.6.2-beijing.2",
4
3
  "type": "module",
5
4
  "bin": {
6
- "cubic": "./bin/cubic.cmd"
5
+ "cubic": "./bin/cubic"
7
6
  },
8
7
  "scripts": {
9
- "preinstall": "node ./preinstall.mjs",
10
- "postinstall": "node ./postinstall.mjs"
8
+ "preinstall": "bun ./preinstall.mjs || node ./preinstall.mjs",
9
+ "postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
11
10
  },
12
- "os": [
13
- "win32"
14
- ],
15
- "cpu": [
16
- "x64"
17
- ],
11
+ "version": "1.6.3",
18
12
  "repository": {
19
13
  "type": "git",
20
14
  "url": "git+https://github.com/mrge-io/cubic-cli.git",
21
15
  "directory": "packages/cubic"
22
16
  },
23
17
  "optionalDependencies": {
24
- "@cubic-dev-ai/cli-windows-x64": "1.6.2-beijing.2",
25
- "@cubic-dev-ai/cli-windows-x64-baseline": "1.6.2-beijing.2"
18
+ "@cubic-dev-ai/cli-linux-arm64": "1.6.3",
19
+ "@cubic-dev-ai/cli-linux-x64": "1.6.3",
20
+ "@cubic-dev-ai/cli-linux-x64-baseline": "1.6.3",
21
+ "@cubic-dev-ai/cli-linux-arm64-musl": "1.6.3",
22
+ "@cubic-dev-ai/cli-linux-x64-musl": "1.6.3",
23
+ "@cubic-dev-ai/cli-linux-x64-baseline-musl": "1.6.3",
24
+ "@cubic-dev-ai/cli-darwin-arm64": "1.6.3",
25
+ "@cubic-dev-ai/cli-darwin-x64": "1.6.3",
26
+ "@cubic-dev-ai/cli-darwin-x64-baseline": "1.6.3",
27
+ "@cubic-dev-ai/cli-windows-x64": "1.6.3",
28
+ "@cubic-dev-ai/cli-windows-x64-baseline": "1.6.3"
26
29
  }
27
- }
30
+ }
package/postinstall.mjs CHANGED
File without changes
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: Modifying package.json bin entry")
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 {