@pks-cli/cli 7.0.0 → 7.0.2

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/pks.js CHANGED
@@ -42,19 +42,21 @@ function getBinaryPath() {
42
42
  // Binary may be at package root or in bin/ subdirectory
43
43
  const scopeDir = join(__dirname, '..', '..'); // node_modules/@pks-cli/
44
44
  const parentScopeDir = join(__dirname, '..', '..', '..', '@pks-cli'); // ../node_modules/@pks-cli/
45
-
46
- const paths = [
47
- // Scoped: node_modules/@pks-cli/cli-linux-x64/bin/pks
48
- join(scopeDir, packageDir, 'bin', 'pks'),
49
- join(scopeDir, packageDir, 'bin', 'pks.exe'),
50
- join(scopeDir, packageDir, 'pks'),
51
- join(scopeDir, packageDir, 'pks.exe'),
52
- // Parent node_modules (hoisted)
53
- join(parentScopeDir, packageDir, 'bin', 'pks'),
54
- join(parentScopeDir, packageDir, 'bin', 'pks.exe'),
55
- join(parentScopeDir, packageDir, 'pks'),
56
- join(parentScopeDir, packageDir, 'pks.exe'),
57
- ];
45
+ // Not hoisted: npm nests the optional dependency inside this package when the
46
+ // install has nowhere to hoist it to -- which is exactly what `npm i -g` does,
47
+ // so a global install found no binary at all until this root was added.
48
+ const ownScopeDir = join(__dirname, '..', 'node_modules', '@pks-cli');
49
+
50
+ const roots = [scopeDir, parentScopeDir, ownScopeDir];
51
+ const paths = [];
52
+ for (const root of roots) {
53
+ paths.push(
54
+ join(root, packageDir, 'bin', 'pks'),
55
+ join(root, packageDir, 'bin', 'pks.exe'),
56
+ join(root, packageDir, 'pks'),
57
+ join(root, packageDir, 'pks.exe'),
58
+ );
59
+ }
58
60
 
59
61
  for (const path of paths) {
60
62
  if (existsSync(path)) {
@@ -62,6 +64,25 @@ function getBinaryPath() {
62
64
  }
63
65
  }
64
66
 
67
+ // Last resort: let Node walk the node_modules chain itself, which covers layouts
68
+ // (pnpm, yarn PnP-less workspaces) that no hardcoded root above anticipates.
69
+ try {
70
+ const manifest = require.resolve(`${packageName}/package.json`, { paths: [__dirname] });
71
+ const packageRoot = join(manifest, '..');
72
+ for (const candidate of [
73
+ join(packageRoot, 'bin', 'pks'),
74
+ join(packageRoot, 'bin', 'pks.exe'),
75
+ join(packageRoot, 'pks'),
76
+ join(packageRoot, 'pks.exe'),
77
+ ]) {
78
+ if (existsSync(candidate)) {
79
+ return candidate;
80
+ }
81
+ }
82
+ } catch {
83
+ // Fall through to the error below -- resolution failing just means "not installed".
84
+ }
85
+
65
86
  console.error(`PKS CLI binary not found for ${platform}-${arch}`);
66
87
  console.error('Please ensure the platform-specific package is installed.');
67
88
  console.error(`Expected package: ${packageName}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pks-cli/cli",
3
- "version": "7.0.0",
3
+ "version": "7.0.2",
4
4
  "description": "The next agentic CLI for .NET developers",
5
5
  "bin": {
6
6
  "pks": "./bin/pks.js"
@@ -9,12 +9,12 @@
9
9
  "postinstall": "node postinstall.js"
10
10
  },
11
11
  "optionalDependencies": {
12
- "@pks-cli/cli-linux-x64": "7.0.0",
13
- "@pks-cli/cli-linux-arm64": "7.0.0",
14
- "@pks-cli/cli-osx-x64": "7.0.0",
15
- "@pks-cli/cli-osx-arm64": "7.0.0",
16
- "@pks-cli/cli-win-x64": "7.0.0",
17
- "@pks-cli/cli-win-arm64": "7.0.0"
12
+ "@pks-cli/cli-linux-x64": "7.0.2",
13
+ "@pks-cli/cli-linux-arm64": "7.0.2",
14
+ "@pks-cli/cli-osx-x64": "7.0.2",
15
+ "@pks-cli/cli-osx-arm64": "7.0.2",
16
+ "@pks-cli/cli-win-x64": "7.0.2",
17
+ "@pks-cli/cli-win-arm64": "7.0.2"
18
18
  },
19
19
  "engines": {
20
20
  "node": ">=18.0.0"
package/postinstall.js CHANGED
@@ -39,6 +39,8 @@ function checkPlatformPackage() {
39
39
  join(__dirname, '..', packageDir),
40
40
  // Parent node_modules (hoisted)
41
41
  join(__dirname, '..', '..', '@pks-cli', packageDir),
42
+ // Nested, i.e. not hoisted anywhere -- what `npm i -g` produces
43
+ join(__dirname, 'node_modules', '@pks-cli', packageDir),
42
44
  ];
43
45
 
44
46
  for (const path of paths) {
@@ -48,7 +50,15 @@ function checkPlatformPackage() {
48
50
  }
49
51
  }
50
52
 
51
- return false;
53
+ // Same fallback as bin/pks.js: Node's own resolution covers layouts the
54
+ // hardcoded paths above do not.
55
+ try {
56
+ require.resolve(`${packageName}/package.json`, { paths: [__dirname] });
57
+ console.log(`✅ PKS CLI installed successfully for ${platform}-${arch}`);
58
+ return true;
59
+ } catch {
60
+ return false;
61
+ }
52
62
  }
53
63
 
54
64
  /**