@zyzheal/ola-cc 0.3.12 → 0.3.15

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.
Files changed (2) hide show
  1. package/install.cjs +21 -3
  2. package/package.json +9 -9
package/install.cjs CHANGED
@@ -25,7 +25,11 @@ const PLATFORM_MAP = {
25
25
  }
26
26
 
27
27
  const pkgRoot = __dirname
28
- const nodeModules = join(pkgRoot, '..', '..')
28
+ // npm installs optionalDependencies inside the package's node_modules directory
29
+ // when using global install or certain package managers (pnpm, yarn).
30
+ // Check both locations to support all installation modes.
31
+ const nodeModulesNested = join(pkgRoot, 'node_modules') // npm global / pnpm / yarn
32
+ const nodeModulesTopLevel = join(pkgRoot, '..', '..') // npm local (legacy behavior)
29
33
  const binDir = join(pkgRoot, 'bin')
30
34
 
31
35
  function detectPlatform() {
@@ -54,6 +58,20 @@ function detectPlatform() {
54
58
  : `${platform}-${arch}`
55
59
  }
56
60
 
61
+ function findPlatformPackage(depName) {
62
+ // Try nested location first (npm global, pnpm, yarn)
63
+ const nestedPath = join(nodeModulesNested, depName)
64
+ if (existsSync(nestedPath)) {
65
+ return nestedPath
66
+ }
67
+ // Try top-level location (npm local install legacy behavior)
68
+ const topLevelPath = join(nodeModulesTopLevel, depName)
69
+ if (existsSync(topLevelPath)) {
70
+ return topLevelPath
71
+ }
72
+ return null
73
+ }
74
+
57
75
  function main() {
58
76
  const platformKey = detectPlatform()
59
77
  const depName = PLATFORM_MAP[platformKey]
@@ -63,9 +81,9 @@ function main() {
63
81
  return
64
82
  }
65
83
 
66
- const depPath = join(nodeModules, depName)
84
+ const depPath = findPlatformPackage(depName)
67
85
 
68
- if (!existsSync(depPath)) {
86
+ if (!depPath) {
69
87
  console.warn(`ola-cc: Platform package ${depName} not installed.`)
70
88
  return
71
89
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyzheal/ola-cc",
3
- "version": "0.3.12",
3
+ "version": "0.3.15",
4
4
  "description": "Ola CC - AI coding assistant in your terminal",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "type": "commonjs",
@@ -20,14 +20,14 @@
20
20
  },
21
21
  "dependencies": {},
22
22
  "optionalDependencies": {
23
- "@zyzheal/ola-cc-darwin-arm64": "0.3.12",
24
- "@zyzheal/ola-cc-darwin-x64": "0.3.12",
25
- "@zyzheal/ola-cc-linux-x64": "0.3.12",
26
- "@zyzheal/ola-cc-linux-arm64": "0.3.12",
27
- "@zyzheal/ola-cc-linux-x64-musl": "0.3.12",
28
- "@zyzheal/ola-cc-linux-arm64-musl": "0.3.12",
29
- "@zyzheal/ola-cc-win32-x64": "0.3.12",
30
- "@zyzheal/ola-cc-win32-arm64": "0.3.12"
23
+ "@zyzheal/ola-cc-darwin-arm64": "0.3.15",
24
+ "@zyzheal/ola-cc-darwin-x64": "0.3.15",
25
+ "@zyzheal/ola-cc-linux-x64": "0.3.15",
26
+ "@zyzheal/ola-cc-linux-arm64": "0.3.15",
27
+ "@zyzheal/ola-cc-linux-x64-musl": "0.3.15",
28
+ "@zyzheal/ola-cc-linux-arm64-musl": "0.3.15",
29
+ "@zyzheal/ola-cc-win32-x64": "0.3.15",
30
+ "@zyzheal/ola-cc-win32-arm64": "0.3.15"
31
31
  },
32
32
  "files": [
33
33
  "bin/ola-cc.js",