@hippox/codegenie 4.21.26-demo-alpha → 4.23.26-demo-alpha

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.
@@ -12,16 +12,17 @@ function detectPlatformAndArch() {
12
12
  return { platform, arch }
13
13
  }
14
14
 
15
- function findBinary() {
15
+ function findPlatformPackage() {
16
16
  const { platform, arch } = detectPlatformAndArch()
17
17
  const scopedDir = path.join("@hippox", "codegenie-" + platform + "-" + arch)
18
18
  const binaryName = platform === "win32" ? "codegenie.exe" : "codegenie"
19
19
 
20
20
  let current = path.resolve(__dirname, "..")
21
21
  for (;;) {
22
- const candidate = path.join(current, "node_modules", scopedDir, "bin", binaryName)
22
+ const pkgRoot = path.join(current, "node_modules", scopedDir)
23
+ const candidate = path.join(pkgRoot, "bin", binaryName)
23
24
  if (fs.existsSync(candidate)) {
24
- return { binaryPath: candidate, binaryName, binDir: path.dirname(candidate) }
25
+ return { binaryPath: candidate, binaryName, binDir: path.dirname(candidate), pkgRoot }
25
26
  }
26
27
  const parent = path.dirname(current)
27
28
  if (parent === current) break
@@ -31,6 +32,20 @@ function findBinary() {
31
32
  throw new Error("Could not find platform package " + scopedDir)
32
33
  }
33
34
 
35
+ function copyDirRecursive(src, dst) {
36
+ if (!fs.existsSync(src)) return
37
+ if (!fs.existsSync(dst)) fs.mkdirSync(dst, { recursive: true })
38
+ for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
39
+ const srcPath = path.join(src, entry.name)
40
+ const dstPath = path.join(dst, entry.name)
41
+ if (entry.isDirectory()) {
42
+ copyDirRecursive(srcPath, dstPath)
43
+ } else {
44
+ fs.copyFileSync(srcPath, dstPath)
45
+ }
46
+ }
47
+ }
48
+
34
49
  async function main() {
35
50
  try {
36
51
  if (os.platform() === "win32") {
@@ -38,7 +53,7 @@ async function main() {
38
53
  return
39
54
  }
40
55
 
41
- const { binaryPath, binDir } = findBinary()
56
+ const { binaryPath, pkgRoot } = findPlatformPackage()
42
57
  const target = path.join(__dirname, ".codegenie")
43
58
  if (fs.existsSync(target)) fs.unlinkSync(target)
44
59
  try {
@@ -48,14 +63,9 @@ async function main() {
48
63
  }
49
64
  fs.chmodSync(target, 0o755)
50
65
 
51
- const nativeSrc = path.join(binDir, "mcp-bridge-native")
52
- const nativeDst = path.join(__dirname, "mcp-bridge-native")
53
- if (fs.existsSync(nativeSrc)) {
54
- if (!fs.existsSync(nativeDst)) fs.mkdirSync(nativeDst, { recursive: true })
55
- for (const file of fs.readdirSync(nativeSrc)) {
56
- fs.copyFileSync(path.join(nativeSrc, file), path.join(nativeDst, file))
57
- }
58
- }
66
+ const vendorSrc = path.join(pkgRoot, "vendor")
67
+ const vendorDst = path.join(path.resolve(__dirname, ".."), "vendor")
68
+ copyDirRecursive(vendorSrc, vendorDst)
59
69
 
60
70
  console.log("codegenie binary linked successfully")
61
71
  } catch (error) {
package/bin/uninstall.js CHANGED
@@ -8,7 +8,7 @@ try {
8
8
  if (fs.existsSync(cached)) fs.unlinkSync(cached)
9
9
  } catch {}
10
10
 
11
- const nativeDir = path.join(__dirname, "mcp-bridge-native")
11
+ const vendorDir = path.join(path.resolve(__dirname, ".."), "vendor")
12
12
  try {
13
- if (fs.existsSync(nativeDir)) fs.rmSync(nativeDir, { recursive: true })
13
+ if (fs.existsSync(vendorDir)) fs.rmSync(vendorDir, { recursive: true })
14
14
  } catch {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hippox/codegenie",
3
- "version": "4.21.26-demo-alpha",
3
+ "version": "4.23.26-demo-alpha",
4
4
  "private": false,
5
5
  "description": "HarmonyOS AI 开发 CLI,通过 npm 分发平台二进制",
6
6
  "license": "MIT",
@@ -12,9 +12,9 @@
12
12
  "files": ["bin", "lib", "README.md", "platform-map.json"],
13
13
  "keywords": ["cli", "harmonyos", "codegenie", "ai"],
14
14
  "optionalDependencies": {
15
- "@hippox/codegenie-darwin-arm64": "4.21.26-demo-alpha",
16
- "@hippox/codegenie-darwin-x64": "4.21.26-demo-alpha",
17
- "@hippox/codegenie-win32-x64": "4.21.26-demo-alpha"
15
+ "@hippox/codegenie-darwin-arm64": "4.23.26-demo-alpha",
16
+ "@hippox/codegenie-darwin-x64": "4.23.26-demo-alpha",
17
+ "@hippox/codegenie-win32-x64": "4.23.26-demo-alpha"
18
18
  },
19
19
  "publishConfig": { "access": "public" },
20
20
  "repository": { "type": "git", "url": "https://gitcode.com/codegenie/codegenie.git" }