zor-ai 0.8.16 → 0.8.17
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/install.js +45 -0
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -535,6 +535,39 @@ function extractBundledGuidelines(archiveData, releaseInfo, guidelinesDir) {
|
|
|
535
535
|
extractBundledTree(archiveData, releaseInfo.guidelinesArchiveRoot, guidelinesDir, true);
|
|
536
536
|
}
|
|
537
537
|
|
|
538
|
+
function installMacosDesktopApp(platform, binDir, deps) {
|
|
539
|
+
if (platform !== "darwin") {
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
var helpers = deps || {};
|
|
544
|
+
var spawnSync = helpers.spawnSync || childProcess.spawnSync;
|
|
545
|
+
var appZip = path.join(binDir, "zorai-desktop.app.zip");
|
|
546
|
+
var appDir = path.join(binDir, "zorai-desktop.app");
|
|
547
|
+
if (!fs.existsSync(appZip)) {
|
|
548
|
+
throw new Error("Installed macOS desktop app archive is missing: " + appZip);
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
fs.rmSync(appDir, { recursive: true, force: true });
|
|
552
|
+
var result = spawnSync("ditto", ["-x", "-k", appZip, binDir], {
|
|
553
|
+
stdio: "inherit",
|
|
554
|
+
});
|
|
555
|
+
if (!result || result.error || result.status !== 0) {
|
|
556
|
+
result = spawnSync("unzip", ["-oq", appZip, "-d", binDir], {
|
|
557
|
+
stdio: "inherit",
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
if (!result || result.error || result.status !== 0) {
|
|
562
|
+
throw new Error("Failed to extract macOS desktop app archive: " + appZip);
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
var appBinary = path.join(appDir, "Contents", "MacOS", "zorai");
|
|
566
|
+
if (!fs.existsSync(appBinary)) {
|
|
567
|
+
throw new Error("Installed macOS desktop app is missing executable: " + appBinary);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
538
571
|
async function verifyExtractedBinaries(checksumsData, releaseInfo) {
|
|
539
572
|
var requiredFiles = releaseInfo.requiredBinaries.concat(releaseInfo.requiredAssets || []);
|
|
540
573
|
for (var i = 0; i < requiredFiles.length; i++) {
|
|
@@ -571,6 +604,16 @@ function cleanupExtractedBinaries(releaseInfo) {
|
|
|
571
604
|
/* ignore cleanup errors */
|
|
572
605
|
}
|
|
573
606
|
}
|
|
607
|
+
if ((releaseInfo.requiredAssets || []).includes("zorai-desktop.app.zip")) {
|
|
608
|
+
try {
|
|
609
|
+
fs.rmSync(path.join(BIN_DIR, "zorai-desktop.app"), {
|
|
610
|
+
recursive: true,
|
|
611
|
+
force: true,
|
|
612
|
+
});
|
|
613
|
+
} catch (_e) {
|
|
614
|
+
/* ignore cleanup errors */
|
|
615
|
+
}
|
|
616
|
+
}
|
|
574
617
|
}
|
|
575
618
|
|
|
576
619
|
async function main() {
|
|
@@ -642,6 +685,7 @@ async function main() {
|
|
|
642
685
|
console.log("zorai: extracting binaries, skills, and guidelines...");
|
|
643
686
|
extractRequiredBinaries(archiveData, releaseInfo);
|
|
644
687
|
extractRequiredAssets(archiveData, releaseInfo);
|
|
688
|
+
installMacosDesktopApp(os.platform(), BIN_DIR);
|
|
645
689
|
extractBundledSkills(archiveData, releaseInfo, runtimeSkillsDir);
|
|
646
690
|
extractBundledGuidelines(archiveData, releaseInfo, runtimeGuidelinesDir);
|
|
647
691
|
console.log(
|
|
@@ -691,6 +735,7 @@ module.exports.getRuntimeZoraiRoot = getRuntimeZoraiRoot;
|
|
|
691
735
|
module.exports.ensureCustomAuthTemplate = ensureCustomAuthTemplate;
|
|
692
736
|
module.exports.extractBundledGuidelines = extractBundledGuidelines;
|
|
693
737
|
module.exports.getLegacyTamuxRoot = getLegacyTamuxRoot;
|
|
738
|
+
module.exports.installMacosDesktopApp = installMacosDesktopApp;
|
|
694
739
|
module.exports.migrateLegacyTamuxRoot = migrateLegacyTamuxRoot;
|
|
695
740
|
module.exports.isManagedProcessRunning = isManagedProcessRunning;
|
|
696
741
|
module.exports.maybeRefreshDaemonAfterInstall = maybeRefreshDaemonAfterInstall;
|