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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agi",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "AGI - Your intelligent browser worker",
5
5
  "keywords": [
6
6
  "agi",
@@ -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 ~/Applications …");
33
- const userAppsDir = path.join(os.homedir(), 'Applications');
34
-
35
- // Create ~/Applications directory if it doesn't exist
36
- if (!fs.existsSync(userAppsDir)) {
37
- fs.mkdirSync(userAppsDir, { recursive: true });
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
- execSync(`cp -R "${mount}/AGI.app" "${userAppsDir}"`, { stdio: "inherit" });
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 "${userAppsDir}/AGI.app"`);
69
+ execSync(`open "${appDest}"`);
50
70
  } catch (e) {
51
71
  console.error("⚠️ DMG install failed:", e.message);
52
72
  process.exit(1);