agi 0.2.1 → 0.2.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/package.json +1 -1
- package/scripts/install-dmg.js +29 -9
package/package.json
CHANGED
package/scripts/install-dmg.js
CHANGED
|
@@ -29,15 +29,35 @@ const dmgPath = path.join(os.tmpdir(), "AGI.dmg");
|
|
|
29
29
|
throw new Error("Failed to find mount point");
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
console.log("• Copying to
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
console.log("• Copying to /Applications …");
|
|
33
|
+
const systemAppsDir = "/Applications";
|
|
34
|
+
const appSrc = path.join(mount, "AGI.app");
|
|
35
|
+
const appDest = path.join(systemAppsDir, "AGI.app");
|
|
36
|
+
|
|
37
|
+
// Use ditto for robust app bundle copy. Try without admin first, then prompt via AppleScript.
|
|
38
|
+
const dittoCmd = `ditto "${appSrc}" "${appDest}"`;
|
|
39
|
+
try {
|
|
40
|
+
execSync(dittoCmd, { stdio: "inherit" });
|
|
41
|
+
} catch (err) {
|
|
42
|
+
console.log("• Admin permission required. Prompting…");
|
|
43
|
+
const escapedCmd = dittoCmd.replace(/"/g, '\\"');
|
|
44
|
+
execSync(`osascript -e 'do shell script "${escapedCmd}" with administrator privileges'`, { stdio: "inherit" });
|
|
38
45
|
}
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
|
|
47
|
+
// Best-effort: remove quarantine to avoid gatekeeper warnings on first launch
|
|
48
|
+
try {
|
|
49
|
+
execSync(`xattr -dr com.apple.quarantine "${appDest}"`, { stdio: "ignore" });
|
|
50
|
+
} catch {}
|
|
51
|
+
|
|
52
|
+
// Remove any duplicate in the user's Applications folder to avoid confusion
|
|
53
|
+
try {
|
|
54
|
+
const userAppsDir = path.join(os.homedir(), 'Applications');
|
|
55
|
+
const userApp = path.join(userAppsDir, 'AGI.app');
|
|
56
|
+
if (fs.existsSync(userApp)) {
|
|
57
|
+
console.log("• Removing duplicate from ~/Applications …");
|
|
58
|
+
fs.rmSync(userApp, { recursive: true, force: true });
|
|
59
|
+
}
|
|
60
|
+
} catch {}
|
|
41
61
|
|
|
42
62
|
console.log("• Detaching …");
|
|
43
63
|
execSync(`hdiutil detach "${mount}"`);
|
|
@@ -46,7 +66,7 @@ const dmgPath = path.join(os.tmpdir(), "AGI.dmg");
|
|
|
46
66
|
console.log("✅ AGI installed!");
|
|
47
67
|
|
|
48
68
|
console.log("• Opening AGI …");
|
|
49
|
-
execSync(`open "${
|
|
69
|
+
execSync(`open "${appDest}"`);
|
|
50
70
|
} catch (e) {
|
|
51
71
|
console.error("⚠️ DMG install failed:", e.message);
|
|
52
72
|
process.exit(1);
|