From e51d8aad87bd3d145120e519bc373738308b2370 Mon Sep 17 00:00:00 2001 From: Mikheil Berishvili Date: Sun, 14 Dec 2025 11:01:19 +0400 Subject: [PATCH 1/2] fix: update installation instructions and handle app startup errors --- README.md | 22 +++++++++++++++++----- bun.lock | 5 ++++- package.json | 5 ++++- src/main/database.ts | 6 +++--- src/main/main.ts | 42 +++++++++++++++++++++++++++--------------- 5 files changed, 55 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 4dacb1c..7ed8387 100644 --- a/README.md +++ b/README.md @@ -70,11 +70,23 @@ Download the latest release from the [Releases page](https://github.com/mberrish 1. Download the `.dmg` file (choose `arm64` for Apple Silicon or `x64` for Intel Macs) 2. Open the `.dmg` file 3. Drag clipai to your Applications folder -4. On first launch, you may see "clipai cannot be opened because it is from an unidentified developer" - - Right-click (or Control-click) on clipai in Applications - - Click "Open" - - Click "Open" again in the dialog - - This only needs to be done once +4. **Important:** Remove macOS quarantine (required for unsigned apps) + + Open Terminal and run: + ```bash + xattr -cr /Applications/clipai.app + ``` + + This is safe - it just removes the quarantine flag that macOS adds to downloaded files. Required because the app is not code-signed. + +5. Launch clipai from Applications + +**Alternative method if you see "unidentified developer" warning:** +- Right-click (or Control-click) on clipai in Applications +- Click "Open" +- Click "Open" again in the dialog + +**Note:** If you see "app is damaged and can't be opened", you must use the Terminal command above. **Windows Users:** diff --git a/bun.lock b/bun.lock index 958bc99..a263228 100644 --- a/bun.lock +++ b/bun.lock @@ -15,7 +15,6 @@ "react": "^19.2.1", "react-dom": "^19.2.1", "sqlite-vec": "^0.1.7-alpha.2", - "sqlite-vec-darwin-arm64": "^0.1.7-alpha.2", "vite": "^7.2.7", "wait-on": "^9.0.3", }, @@ -27,6 +26,10 @@ "electron-builder": "^26.0.12", "electron-rebuild": "^3.2.9", }, + "optionalDependencies": { + "sqlite-vec-darwin-arm64": "^0.1.7-alpha.2", + "sqlite-vec-windows-x64": "^0.1.7-alpha.2", + }, "peerDependencies": { "typescript": "^5.9.3", }, diff --git a/package.json b/package.json index e006e70..52417d2 100644 --- a/package.json +++ b/package.json @@ -102,8 +102,11 @@ "react": "^19.2.1", "react-dom": "^19.2.1", "sqlite-vec": "^0.1.7-alpha.2", - "sqlite-vec-darwin-arm64": "^0.1.7-alpha.2", "vite": "^7.2.7", "wait-on": "^9.0.3" + }, + "optionalDependencies": { + "sqlite-vec-darwin-arm64": "^0.1.7-alpha.2", + "sqlite-vec-windows-x64": "^0.1.7-alpha.2" } } diff --git a/src/main/database.ts b/src/main/database.ts index 8fe0fb2..ac52671 100644 --- a/src/main/database.ts +++ b/src/main/database.ts @@ -2,7 +2,6 @@ import Database from "better-sqlite3"; import { app } from "electron"; import { join } from "path"; import log from "electron-log"; -import * as sqliteVec from "sqlite-vec"; import type { ClipboardItem } from "../models/ClipboardItem.ts"; export class DatabaseManager { @@ -23,13 +22,14 @@ export class DatabaseManager { log.info("Journal mode set"); log.info("Loading sqlite-vec extension..."); + const sqliteVec = require("sqlite-vec"); let loadablePath = sqliteVec.getLoadablePath(); // Fix path for Electron asar packaging if (loadablePath.includes('.asar')) { loadablePath = loadablePath.replace( - join('app.asar', 'node_modules'), - join('app.asar.unpacked', 'node_modules') + 'app.asar' + (process.platform === 'win32' ? '\\' : '/') + 'node_modules', + 'app.asar.unpacked' + (process.platform === 'win32' ? '\\' : '/') + 'node_modules' ); } diff --git a/src/main/main.ts b/src/main/main.ts index 70c55fa..9ef6179 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -6,6 +6,7 @@ import { Menu, shell, globalShortcut, + dialog, } from "electron"; import { join, dirname } from "path"; import { fileURLToPath } from "url"; @@ -255,26 +256,37 @@ function registerGlobalShortcut(shortcut: string = "CommandOrControl+Shift+V") { app.whenReady().then(() => { log.info("App ready"); - configManager = new ConfigManager(); - databaseManager = new DatabaseManager(); - embeddingService = new EmbeddingService(configManager); + try { + configManager = new ConfigManager(); + databaseManager = new DatabaseManager(); + embeddingService = new EmbeddingService(configManager); - app.setLoginItemSettings({ - openAtLogin: true, - }); + app.setLoginItemSettings({ + openAtLogin: true, + }); - if (app.dock) { - app.dock.hide(); - } + if (app.dock) { + app.dock.hide(); + } - createWindow(); - createTray(); + createWindow(); + createTray(); - const config = configManager.getConfig(); - registerGlobalShortcut(config.globalShortcut); + const config = configManager.getConfig(); + registerGlobalShortcut(config.globalShortcut); - if (!app.isPackaged) { - win?.show(); + if (!app.isPackaged) { + win?.show(); + } + } catch (error) { + log.error("Failed to start app:", error); + dialog.showErrorBox( + "Failed to Start", + `The application failed to start:\n\n${ + error instanceof Error ? error.message : String(error) + }` + ); + app.quit(); } }); From 9cbe018f877b89ce16d2588b0daf3060d42ea0d1 Mon Sep 17 00:00:00 2001 From: Mikheil Berishvili Date: Sun, 14 Dec 2025 11:24:56 +0400 Subject: [PATCH 2/2] feat: add workflows for macOS and Windows releases --- .github/workflows/release-macos.yml | 37 +++++++++++++++++++++++++++ .github/workflows/release-windows.yml | 36 ++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 .github/workflows/release-macos.yml create mode 100644 .github/workflows/release-windows.yml diff --git a/.github/workflows/release-macos.yml b/.github/workflows/release-macos.yml new file mode 100644 index 0000000..2273a38 --- /dev/null +++ b/.github/workflows/release-macos.yml @@ -0,0 +1,37 @@ +name: Release macOS + +on: + workflow_dispatch: + +jobs: + build-macos: + runs-on: macos-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: Install dependencies + run: bun install + + - name: Rebuild native modules for Electron + run: bun run rebuild + + - name: Build and Package (macOS) + run: bun run package --mac + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload macOS artifacts + uses: actions/upload-artifact@v4 + with: + name: macos-release + path: | + release/*.dmg + release/*.zip + if-no-files-found: error diff --git a/.github/workflows/release-windows.yml b/.github/workflows/release-windows.yml new file mode 100644 index 0000000..25eb704 --- /dev/null +++ b/.github/workflows/release-windows.yml @@ -0,0 +1,36 @@ +name: Release Windows + +on: + workflow_dispatch: + +jobs: + build-windows: + runs-on: windows-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: Install dependencies + run: bun install + + - name: Rebuild native modules for Electron + run: bun run rebuild + + - name: Build and Package (Windows) + run: bun run package --win + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload Windows artifacts + uses: actions/upload-artifact@v4 + with: + name: windows-release + path: | + release/*.exe + if-no-files-found: error