@apono-io/apono-mcp 0.1.4 → 0.2.0
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/lib/download.js +21 -4
- package/package.json +1 -1
package/lib/download.js
CHANGED
|
@@ -35,6 +35,17 @@ function getArch() {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
function validatePlatformArch(platform, arch) {
|
|
39
|
+
const unsupported = [
|
|
40
|
+
{ platform: "windows", arch: "armv7" },
|
|
41
|
+
];
|
|
42
|
+
for (const combo of unsupported) {
|
|
43
|
+
if (platform === combo.platform && arch === combo.arch) {
|
|
44
|
+
throw new Error(`Unsupported platform/architecture combination: ${platform}/${arch}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
38
49
|
function getArchiveExtension() {
|
|
39
50
|
return process.platform === "win32" ? "zip" : "tar.gz";
|
|
40
51
|
}
|
|
@@ -164,6 +175,7 @@ async function ensureBinary() {
|
|
|
164
175
|
|
|
165
176
|
const platformStr = getPlatform();
|
|
166
177
|
const archStr = getArch();
|
|
178
|
+
validatePlatformArch(platformStr, archStr);
|
|
167
179
|
const ext = getArchiveExtension();
|
|
168
180
|
const archiveName = `apono-agentic-cli_${latestVersion}_${platformStr}_${archStr}.${ext}`;
|
|
169
181
|
const downloadUrl = `${RELEASES_BASE_URL}/cli/v${latestVersion}/${archiveName}`;
|
|
@@ -189,23 +201,28 @@ async function ensureBinary() {
|
|
|
189
201
|
throw new Error(`Binary not found in archive at ${extractedBinary}`);
|
|
190
202
|
}
|
|
191
203
|
|
|
192
|
-
|
|
193
|
-
|
|
204
|
+
// Write to a temp file then atomically rename to avoid corruption
|
|
205
|
+
// if multiple processes run concurrently.
|
|
206
|
+
const tmpBinary = BINARY_PATH + ".tmp." + process.pid;
|
|
207
|
+
fs.copyFileSync(extractedBinary, tmpBinary);
|
|
208
|
+
fs.chmodSync(tmpBinary, 0o755);
|
|
194
209
|
|
|
195
210
|
// Remove macOS quarantine attribute so Gatekeeper doesn't block the binary
|
|
196
211
|
if (process.platform === "darwin") {
|
|
197
212
|
try {
|
|
198
|
-
execFileSync("xattr", ["-d", "com.apple.quarantine",
|
|
213
|
+
execFileSync("xattr", ["-d", "com.apple.quarantine", tmpBinary], { timeout: 5000 });
|
|
199
214
|
} catch {
|
|
200
215
|
// Ignore — attribute may not exist
|
|
201
216
|
}
|
|
202
217
|
try {
|
|
203
|
-
execFileSync("xattr", ["-d", "com.apple.provenance",
|
|
218
|
+
execFileSync("xattr", ["-d", "com.apple.provenance", tmpBinary], { timeout: 5000 });
|
|
204
219
|
} catch {
|
|
205
220
|
// Ignore
|
|
206
221
|
}
|
|
207
222
|
}
|
|
208
223
|
|
|
224
|
+
fs.renameSync(tmpBinary, BINARY_PATH);
|
|
225
|
+
|
|
209
226
|
process.stderr.write(`Apono CLI v${latestVersion} installed to ${BINARY_PATH}\n`);
|
|
210
227
|
} finally {
|
|
211
228
|
fs.rmSync(tmpDir, { recursive: true, force: true });
|