@aptove/aptove 0.1.5 → 0.1.7
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/package.json +6 -6
- package/postinstall.js +69 -30
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aptove/aptove",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
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.
|
|
39
|
-
"@aptove/aptove-darwin-x64": "0.1.
|
|
40
|
-
"@aptove/aptove-linux-arm64": "0.1.
|
|
41
|
-
"@aptove/aptove-linux-x64": "0.1.
|
|
42
|
-
"@aptove/aptove-win32-x64": "0.1.
|
|
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"
|
|
43
43
|
}
|
|
44
44
|
}
|
package/postinstall.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* aptove postinstall script
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Ensures the correct platform-specific binary package is installed.
|
|
5
|
+
* npm sometimes skips optional dependencies during global installs, so
|
|
6
|
+
* we detect this and install the platform package explicitly if needed.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
const { execSync } = require('child_process');
|
|
@@ -17,43 +18,81 @@ const PLATFORM_PACKAGES = {
|
|
|
17
18
|
'win32-x64': '@aptove/aptove-win32-x64',
|
|
18
19
|
};
|
|
19
20
|
|
|
20
|
-
function
|
|
21
|
+
function getPlatformPackage() {
|
|
21
22
|
const platformKey = `${process.platform}-${process.arch}`;
|
|
22
|
-
|
|
23
|
+
return { platformKey, packageName: PLATFORM_PACKAGES[platformKey] };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function isBinaryInstalled(packageName) {
|
|
27
|
+
try {
|
|
28
|
+
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
|
+
} catch (e) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function getPackageVersion() {
|
|
38
|
+
try {
|
|
39
|
+
const pkg = require('./package.json');
|
|
40
|
+
// optionalDependencies values are updated by the release workflow to match the published version
|
|
41
|
+
const deps = pkg.optionalDependencies || {};
|
|
42
|
+
const versions = Object.values(deps).filter(v => v !== '*');
|
|
43
|
+
return versions[0] || pkg.version;
|
|
44
|
+
} catch (e) {
|
|
45
|
+
return 'latest';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function installPlatformPackage(packageName, version) {
|
|
50
|
+
// During `npm install -g`, npm_config_prefix points to the global prefix (e.g. /usr/local or ~/.nvm/...).
|
|
51
|
+
// Installing with --prefix ensures the package lands in the same global node_modules tree.
|
|
52
|
+
const prefix = process.env.npm_config_prefix;
|
|
53
|
+
const prefixFlag = prefix ? `--prefix "${prefix}"` : '';
|
|
54
|
+
|
|
55
|
+
console.log(` Installing ${packageName}@${version}...`);
|
|
56
|
+
execSync(
|
|
57
|
+
`npm install ${prefixFlag} --no-save --no-audit --no-fund "${packageName}@${version}"`,
|
|
58
|
+
{ stdio: 'inherit' }
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function main() {
|
|
63
|
+
const { platformKey, packageName } = getPlatformPackage();
|
|
23
64
|
|
|
24
65
|
if (!packageName) {
|
|
25
66
|
console.warn(`⚠️ aptove: Unsupported platform ${platformKey}`);
|
|
26
|
-
console.warn(' Supported
|
|
67
|
+
console.warn(' Supported: darwin-arm64, darwin-x64, linux-arm64, linux-x64, win32-x64');
|
|
27
68
|
return;
|
|
28
69
|
}
|
|
29
70
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
71
|
+
if (isBinaryInstalled(packageName)) {
|
|
72
|
+
console.log(`✓ aptove installed successfully for ${platformKey}`);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Optional dependency was not installed (common with `npm install -g`).
|
|
77
|
+
// Install it explicitly.
|
|
78
|
+
console.log(`⬇ aptove: platform package not found, installing ${packageName}...`);
|
|
79
|
+
const version = getPackageVersion();
|
|
34
80
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (process.platform !== 'win32') {
|
|
41
|
-
try {
|
|
42
|
-
fs.chmodSync(binaryPath, 0o755);
|
|
43
|
-
} catch (e) {
|
|
44
|
-
// Not critical
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
try {
|
|
49
|
-
execSync(`"${binaryPath}" --version`, { stdio: 'pipe' });
|
|
50
|
-
console.log(`✓ aptove installed successfully for ${platformKey}`);
|
|
51
|
-
} catch (e) {
|
|
52
|
-
console.warn(`⚠️ aptove: Binary exists but failed to execute on ${platformKey}`);
|
|
53
|
-
}
|
|
81
|
+
try {
|
|
82
|
+
installPlatformPackage(packageName, version);
|
|
54
83
|
} catch (e) {
|
|
55
|
-
console.
|
|
56
|
-
console.
|
|
84
|
+
console.error(`✗ aptove: failed to install ${packageName}@${version}`);
|
|
85
|
+
console.error(` You can install it manually with:`);
|
|
86
|
+
console.error(` npm install -g ${packageName}@${version}`);
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (isBinaryInstalled(packageName)) {
|
|
91
|
+
console.log(`✓ aptove installed successfully for ${platformKey}`);
|
|
92
|
+
} else {
|
|
93
|
+
console.error(`✗ aptove: binary not found after installing ${packageName}`);
|
|
94
|
+
console.error(` Try: npm install -g ${packageName}@${version}`);
|
|
95
|
+
process.exit(1);
|
|
57
96
|
}
|
|
58
97
|
}
|
|
59
98
|
|