@aptove/aptove 0.1.7 → 0.1.9

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/package.json +6 -6
  2. package/postinstall.js +18 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aptove/aptove",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "ACP AI coding agent — connects to Claude, Gemini, and OpenAI",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -35,10 +35,10 @@
35
35
  "node": ">=16"
36
36
  },
37
37
  "optionalDependencies": {
38
- "@aptove/aptove-darwin-arm64": "0.1.7",
39
- "@aptove/aptove-darwin-x64": "0.1.7",
40
- "@aptove/aptove-linux-arm64": "0.1.7",
41
- "@aptove/aptove-linux-x64": "0.1.7",
42
- "@aptove/aptove-win32-x64": "0.1.7"
38
+ "@aptove/aptove-darwin-arm64": "0.1.9",
39
+ "@aptove/aptove-darwin-x64": "0.1.9",
40
+ "@aptove/aptove-linux-arm64": "0.1.9",
41
+ "@aptove/aptove-linux-x64": "0.1.9",
42
+ "@aptove/aptove-win32-x64": "0.1.9"
43
43
  }
44
44
  }
package/postinstall.js CHANGED
@@ -23,17 +23,28 @@ function getPlatformPackage() {
23
23
  return { platformKey, packageName: PLATFORM_PACKAGES[platformKey] };
24
24
  }
25
25
 
26
+ const BINARY_NAME = process.platform === 'win32' ? 'aptove.exe' : 'aptove';
27
+
28
+ // Check via require.resolve (works before install, may use module cache after).
26
29
  function isBinaryInstalled(packageName) {
27
30
  try {
28
31
  const packagePath = require.resolve(`${packageName}/package.json`);
29
- const binaryName = process.platform === 'win32' ? 'aptove.exe' : 'aptove';
30
- const binaryPath = path.join(path.dirname(packagePath), 'bin', binaryName);
31
- return fs.existsSync(binaryPath);
32
+ return fs.existsSync(path.join(path.dirname(packagePath), 'bin', BINARY_NAME));
32
33
  } catch (e) {
33
34
  return false;
34
35
  }
35
36
  }
36
37
 
38
+ // Check directly using the prefix path, bypassing Node.js module resolution cache.
39
+ // Used for post-install verification after an explicit `npm install --prefix`.
40
+ function isBinaryInstalledAtPrefix(packageName) {
41
+ const prefix = process.env.npm_config_prefix;
42
+ if (!prefix) return false;
43
+ // Scoped packages: @aptove/aptove-darwin-arm64 → lib/node_modules/@aptove/aptove-darwin-arm64
44
+ const packageDir = path.join(prefix, 'lib', 'node_modules', ...packageName.split('/'));
45
+ return fs.existsSync(path.join(packageDir, 'bin', BINARY_NAME));
46
+ }
47
+
37
48
  function getPackageVersion() {
38
49
  try {
39
50
  const pkg = require('./package.json');
@@ -87,7 +98,10 @@ function main() {
87
98
  process.exit(1);
88
99
  }
89
100
 
90
- if (isBinaryInstalled(packageName)) {
101
+ // After explicit install, verify using the prefix path directly.
102
+ // require.resolve cannot be used here because Node.js caches negative
103
+ // module resolution results within the same process.
104
+ if (isBinaryInstalledAtPrefix(packageName)) {
91
105
  console.log(`✓ aptove installed successfully for ${platformKey}`);
92
106
  } else {
93
107
  console.error(`✗ aptove: binary not found after installing ${packageName}`);