diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..ba969f6
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,204 @@
+name: Release
+
+on:
+ push:
+ tags: ['v*']
+ workflow_dispatch:
+
+concurrency:
+ group: release-${{ github.ref }}
+ cancel-in-progress: false
+
+permissions:
+ contents: read
+
+jobs:
+ source:
+ name: Validate release tag
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+ with:
+ fetch-depth: 0
+ - name: Require a version tag on main
+ env:
+ RELEASE_TAG: ${{ github.ref_name }}
+ REF_TYPE: ${{ github.ref_type }}
+ run: |
+ test "$REF_TYPE" = tag
+ node --input-type=module -e '
+ import {readFileSync} from "node:fs";
+ const {version} = JSON.parse(readFileSync("package.json"));
+ if (!/^\d+\.\d+\.\d+$/.test(version) || process.env.RELEASE_TAG !== "v" + version) throw new Error("Tag must match package.json version");'
+ git merge-base --is-ancestor HEAD origin/main
+
+ windows:
+ name: Windows signed installer and portable app
+ needs: source
+ runs-on: windows-latest
+ environment: release
+ timeout-minutes: 35
+ permissions:
+ contents: read
+ id-token: write
+ env:
+ ELECTROSCOPE_ARTIFACT_SIGNING_ENDPOINT: ${{ vars.WINDOWS_ARTIFACT_SIGNING_ENDPOINT }}
+ ELECTROSCOPE_ARTIFACT_SIGNING_ACCOUNT: ${{ vars.WINDOWS_ARTIFACT_SIGNING_ACCOUNT }}
+ ELECTROSCOPE_ARTIFACT_SIGNING_PROFILE: ${{ vars.WINDOWS_ARTIFACT_SIGNING_PROFILE }}
+ WINDOWS_SIGNER_EKU: ${{ vars.WINDOWS_SIGNER_EKU }}
+ steps:
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
+ with:
+ node-version: 24
+ cache: npm
+ - run: npm ci
+ - run: npm run typecheck
+ - run: npm test
+ - run: npm run build
+ - uses: azure/login@935127ca5bb3c4b02c9c2c10060028383878f33f # v3
+ with:
+ client-id: ${{ vars.AZURE_CLIENT_ID }}
+ tenant-id: ${{ vars.AZURE_TENANT_ID }}
+ subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
+ - uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4
+ with:
+ dotnet-version: '8.0.x'
+ - name: Prepare pinned signing client
+ shell: pwsh
+ run: ./scripts/prepare-windows-signing.ps1 -DestinationDirectory (Join-Path $env:RUNNER_TEMP 'electroscope-signing')
+ - name: Package and sign
+ run: npx electron-builder --win --x64 --publish never --config build/release.win.cjs
+ - name: Verify final packages and install
+ shell: pwsh
+ run: |
+ ./scripts/verify-windows-signature.ps1 release/Electroscope-Windows-x64-Setup.exe
+ ./scripts/verify-windows-signature.ps1 release/Electroscope-Windows-x64-Portable.exe
+ $install = Join-Path $env:RUNNER_TEMP 'ElectroscopeInstalled'
+ $setup = Start-Process release/Electroscope-Windows-x64-Setup.exe -ArgumentList @('/S', "/D=$install") -Wait -PassThru
+ if ($setup.ExitCode -ne 0) { throw "Installer exited $($setup.ExitCode)" }
+ $env:ELECTROSCOPE_EXE = Join-Path $install 'Electroscope.exe'
+ ./scripts/verify-windows-signature.ps1 $env:ELECTROSCOPE_EXE
+ node scripts/e2e.mjs --fake
+ if ($LASTEXITCODE -ne 0) { throw 'Installed Windows app failed end-to-end checks.' }
+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+ with:
+ name: release-windows
+ if-no-files-found: error
+ path: |
+ release/Electroscope-Windows-x64-Setup.exe
+ release/Electroscope-Windows-x64-Portable.exe
+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+ if: always()
+ with:
+ name: windows-release-tests
+ path: test-output/fake/
+
+ mac:
+ name: macOS signed and notarized app
+ needs: source
+ runs-on: macos-15
+ environment: release
+ timeout-minutes: 45
+ steps:
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
+ with:
+ node-version: 24
+ cache: npm
+ - run: npm ci
+ - run: npm run typecheck
+ - run: npm test
+ - run: npm run build
+ - name: Load notarization key
+ env:
+ API_KEY: ${{ secrets.APPLE_API_KEY }}
+ run: |
+ umask 077
+ test -n "$API_KEY"
+ printf '%s' "$API_KEY" > "$RUNNER_TEMP/notary.p8"
+ - name: Sign, notarize, and package
+ env:
+ CSC_LINK: ${{ secrets.MAC_CERTIFICATE_P12 }}
+ CSC_KEY_PASSWORD: ${{ secrets.MAC_CERTIFICATE_PASSWORD }}
+ APPLE_API_KEY: ${{ runner.temp }}/notary.p8
+ APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
+ APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
+ run: npx electron-builder --mac --arm64 --publish never --config build/release.mac.cjs
+ - name: Verify and test the distributable ZIP
+ run: |
+ ditto -x -k release/Electroscope-macOS-arm64.zip "$RUNNER_TEMP/zip-test"
+ app="$RUNNER_TEMP/zip-test/Electroscope.app"
+ codesign --verify --strict --deep "$app"
+ codesign -dv --verbose=4 "$app" 2>&1 | grep -F 'Authority=Developer ID Application: UnlikeOtherAI s.r.o. (23B7GTLBN7)'
+ xcrun stapler validate "$app"
+ spctl --assess --type execute --verbose=4 "$app"
+ ELECTROSCOPE_EXE="$app/Contents/MacOS/Electroscope" node scripts/e2e.mjs --fake
+ - name: Verify the DMG
+ run: |
+ hdiutil attach -nobrowse -readonly -plist release/Electroscope-macOS-arm64.dmg > "$RUNNER_TEMP/dmg-mount.plist"
+ volume="$(python3 -c 'import plistlib,sys; p=plistlib.load(open(sys.argv[1], "rb")); print(next(e["mount-point"] for e in p["system-entities"] if e.get("mount-point")))' "$RUNNER_TEMP/dmg-mount.plist")"
+ trap 'hdiutil detach "$volume"' EXIT
+ app="$volume/Electroscope.app"
+ codesign --verify --strict --deep "$app"
+ xcrun stapler validate "$app"
+ spctl --assess --type execute --verbose=4 "$app"
+ - name: Remove temporary notarization key
+ if: always()
+ run: rm -f "$RUNNER_TEMP/notary.p8"
+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+ with:
+ name: release-mac
+ if-no-files-found: error
+ path: |
+ release/Electroscope-macOS-arm64.dmg
+ release/Electroscope-macOS-arm64.zip
+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+ if: always()
+ with:
+ name: mac-release-tests
+ path: test-output/fake/
+
+ publish:
+ name: Publish verified downloads
+ needs: [windows, mac]
+ runs-on: ubuntu-latest
+ timeout-minutes: 15
+ environment: release
+ permissions:
+ contents: write
+ steps:
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
+ with:
+ pattern: release-*
+ merge-multiple: true
+ path: artifacts
+ - name: Require every platform and create checksums
+ run: node scripts/release-assets.mjs artifacts
+ - name: Stage and publish the release
+ env:
+ GH_TOKEN: ${{ github.token }}
+ RELEASE_TAG: ${{ github.ref_name }}
+ run: |
+ set -euo pipefail
+ if gh release view "$RELEASE_TAG" --json isDraft > "$RUNNER_TEMP/release.json" 2>/dev/null; then
+ node -e 'if (!require(process.argv[1]).isDraft) throw new Error("Refusing to overwrite a published release")' "$RUNNER_TEMP/release.json"
+ else
+ gh release create "$RELEASE_TAG" --draft --verify-tag --title "Electroscope $RELEASE_TAG" --notes-file docs/release-notes.md
+ fi
+ gh release upload "$RELEASE_TAG" artifacts/* --clobber
+ gh release edit "$RELEASE_TAG" --draft=false --latest
+ - name: Verify public downloads without authentication
+ env:
+ REPOSITORY: ${{ github.repository }}
+ RELEASE_TAG: ${{ github.ref_name }}
+ run: |
+ set -euo pipefail
+ mkdir downloaded
+ cd downloaded
+ base="https://github.com/$REPOSITORY/releases/download/$RELEASE_TAG"
+ for file in SHA256SUMS.txt Electroscope-Windows-x64-Setup.exe Electroscope-Windows-x64-Portable.exe Electroscope-macOS-arm64.dmg Electroscope-macOS-arm64.zip; do
+ curl --fail --location --retry 3 --max-time 300 --output "$file" "$base/$file"
+ done
+ sha256sum --check --strict SHA256SUMS.txt
diff --git a/README.md b/README.md
index d36ce2f..6a74699 100644
--- a/README.md
+++ b/README.md
@@ -1,83 +1,77 @@
-# Electroscope
+

-
+Electroscope
+Give Claude, Codex, and other agents eyes on your electronics.
+See the same board. Point to the same pin. Work through the next measurement together.
-A microscope camera as an MCP server. You watch the live view in a native window; any AI agent on your network can look through the same camera, zoom, focus, and draw on the picture.
+
+
+
+
+
+ Windows portable ·
+ Mac ZIP ·
+ All releases
+
+Windows 11 x64 · macOS on Apple Silicon · Free and open source
-A camera can usually be opened by one app at a time, so you cannot watch the microscope and also hand a stream to an agent. Electroscope owns the camera, shows it to you, and gives agents still frames and full control over MCP, without interrupting your view.
+Electroscope connects your USB microscope to an agent that supports **MCP**, including Claude Code and Codex. You keep a live view of the board while the agent takes snapshots, inspects close-ups, and draws marks on the picture.
-
+Instead of “the little component on the left,” your agent can circle the component, put a crosshair on a test point, or draw an arrow to the pin it wants you to probe. You can draw back to show exactly where you measured. You handle the probes and measurements; Electroscope makes the visual conversation precise.
-## Use it
+
-Run the app. The title bar shows the address it serves on, for example `http://192.168.1.165:7821/mcp`. Click **Copy prompt for agent** and paste it into Claude Code, Codex, or any agent. The prompt has the IP, the port, how to connect, and every tool.
+*Example marks on a real microscope image. Both you and the agent can add annotations to the same view.*
-Or connect directly:
+## A second pair of eyes at your bench
-```bash
-claude mcp add --transport http electroscope http://:7821/mcp
-```
-
-Then ask: "Look at the board and circle anything that looks like a solder bridge."
-
-## What an agent can do
+- **Inspect together.** Ask the agent to look at solder joints, read visible markings, or compare a detail before and after rework.
+- **Make the next probe location clear.** Circles, arrows, crosshairs, boxes, and text turn “measure here” into a specific place on the board.
+- **Keep the detail.** The agent can request a full-resolution crop, follow your zoomed view, or take a sequence of stills.
+- **Stay in control.** Zoom, pan, rotate, mirror, freeze, add a grid, draw your own marks, and save photos while the camera stays open.
+- **Work across your bench.** Run the microscope on one computer and connect an agent from another computer on the same trusted network.
-- **Look**: `capture_snapshot` (full frame or a full-resolution close-up of any region, or exactly what you have zoomed to), `capture_sequence` for things that change, with focus, brightness and exposure metrics and plain-language hints.
-- **Point**: `annotate` draws circles, crosshairs, rectangles, arrows and text in any colour on your live view. Marks stay on their feature when you zoom. `clear_annotations` removes them.
-- **Control**: `set_camera_controls` (focus, zoom, exposure and so on, only where the camera really obeys), `set_orientation`, `set_view` (zoom, pan, grid and crosshair with colours, freeze), `select_camera`, `list_cameras`, `save_photo`.
+
-Full reference: [docs/mcp.md](docs/mcp.md).
+*Zoom into the detail you are discussing. The agent can capture that same region without losing the original camera pixels.*
-## What you can do in the window
+## Get started
-Zoom and pan, grid and crosshair overlays, freeze, rotate and mirror, pick a resolution, save a full-resolution photo, and draw your own circles, crosshairs, rectangles, arrows and text in a colour you pick. **Clear all** removes every mark; Ctrl+Z removes the last one. A live sharpness meter helps you find best focus.
+1. **Install Electroscope** using a download above. On Mac, open the DMG and drag Electroscope into Applications. On Windows, run the installer or use the portable app.
+2. **Plug in your USB microscope** and open Electroscope. Allow camera access and select the microscope in the camera list.
+3. **Click “Copy prompt for agent.”** Paste it into Claude Code, Codex, or another MCP-capable agent. It contains your camera server’s address, connection instructions, and available tools.
+4. **Start looking at the board together.** Ask for a fresh image, describe the fault, and share your measurements as you go.
-Camera sliders appear only for controls the camera actually obeys. Many inexpensive UVC cameras accept brightness, contrast and sharpness settings and ignore them; Electroscope tests each control when the camera opens and hides the ones that do nothing.
+Try a prompt like:
-## Security
+> Look at this board. Circle any solder joints worth inspecting more closely, and explain what you see.
-The server has no password. It listens on your network by default so agents on other computers can reach it, which means anyone who can reach the port can look through the camera and control it. Use it on a network you trust, or turn off **Let other computers on the network connect** in Settings to listen on this computer only. Requests that name any host other than an IP address or this computer's own name are refused, which blocks DNS-rebinding attacks from web pages.
+> Mark the pin you mean before I put the probe on it.
-On Windows, the first run shows a firewall prompt; allow it on private networks for other computers to connect.
+> I measured 3.3 V at the point I marked. Take another look and suggest the next measurement.
-## Install
+Your agent’s own service or subscription still applies; Electroscope needs no account. It shares still images on request while you watch the live camera view.
-Windows 11 and macOS. Download a build from the releases page, or run from source:
+## Connect your agent
-```bash
-git clone https://github.com/UnlikeOtherAI/Electroscope.git
-cd Electroscope
-npm install
-npm start
-```
-
-Build a package:
+**Copy prompt for agent** is the quickest way to get the correct address. For Claude Code, you can also add the server directly:
-```bash
-npm run dist:win # Windows installer and portable exe, in release/
-npm run dist:mac # macOS dmg and zip, in release/ (run on a Mac)
+```sh
+claude mcp add --transport http electroscope http://:7821/mcp
```
-For a signed, notarized Mac package and physical-microscope verification, see [the macOS release guide](docs/macos-release.md).
+For Codex or another MCP client, add the **Streamable HTTP MCP URL** shown in Electroscope’s title bar. Use the displayed URL: the port can change if the default is busy.
-If the app says the camera is busy, another program has it. Close the Camera app, Teams, or a browser tab using the camera; Electroscope keeps retrying and connects as soon as it is free.
+Agents can take snapshots and sequences, annotate the image, adjust the on-screen view, choose a camera, save photos, and change hardware controls where the camera supports them. [Read the full tool reference →](docs/mcp.md)
-## Develop
+## Your camera, your network
-```bash
-npm run typecheck
-npm test # unit tests: tools, transport safety, addresses, prompt, annotations
-npm run test:e2e # launches the app and drives it over MCP with your real camera
-node scripts/e2e.mjs --fake # same, with Chromium's synthetic camera (what CI runs)
-npm run icons # re-render build/icon.* from build/icon.svg
-```
+Electroscope serves the camera from your computer. Network access is on by default and has no password, so use it on a trusted network. To keep access on the same computer, turn off **Let other computers on the network connect** in Settings.
-The end-to-end script drives the real app as an agent would, checks that marks land on the right pixels, and writes screenshots and every captured image to `test-output/`.
+If another app has the microscope open, close that app; Electroscope retries automatically. Camera sliders appear only for controls the camera actually responds to. Use the microscope’s physical focus ring when it has no software focus control.
-- `src/main`: Electron main process and the MCP server (`mcp/tools.ts` defines the tools, `mcp/http.ts` is the Streamable HTTP transport).
-- `src/renderer`: the window. It owns the camera, draws the live view and marks, and answers requests from the main process.
-- `src/shared`: types, IPC channel names, and the agent prompt.
+## Contribute
-## License
+Want to build from source, report a problem, or improve a tool? See the [development guide](docs/development.md), [release workflow](docs/releases.md), or [open an issue](https://github.com/UnlikeOtherAI/Electroscope/issues).
-[MIT](LICENSE)
+Made by [UnlikeOtherAI](https://unlikeotherai.com). [MIT licensed](LICENSE).
diff --git a/build/release.mac.cjs b/build/release.mac.cjs
new file mode 100644
index 0000000..6bd2c46
--- /dev/null
+++ b/build/release.mac.cjs
@@ -0,0 +1,12 @@
+const { build } = require('../package.json');
+
+module.exports = {
+ ...build,
+ forceCodeSigning: true,
+ artifactName: 'Electroscope-macOS-arm64.${ext}',
+ mac: {
+ ...build.mac,
+ identity: 'UnlikeOtherAI s.r.o. (23B7GTLBN7)',
+ notarize: true,
+ },
+};
diff --git a/build/release.win.cjs b/build/release.win.cjs
new file mode 100644
index 0000000..9daab56
--- /dev/null
+++ b/build/release.win.cjs
@@ -0,0 +1,16 @@
+const { build } = require('../package.json');
+
+module.exports = {
+ ...build,
+ forceCodeSigning: true,
+ win: {
+ ...build.win,
+ signtoolOptions: {
+ sign: 'scripts/sign-windows.cjs',
+ signingHashAlgorithms: ['sha256'],
+ publisherName: 'UnlikeOtherAI s.r.o.',
+ },
+ },
+ nsis: { ...build.nsis, artifactName: 'Electroscope-Windows-x64-Setup.${ext}' },
+ portable: { artifactName: 'Electroscope-Windows-x64-Portable.${ext}' },
+};
diff --git a/docs/development.md b/docs/development.md
new file mode 100644
index 0000000..7b0b1ff
--- /dev/null
+++ b/docs/development.md
@@ -0,0 +1,26 @@
+# Develop Electroscope
+
+Use Node 24. The Windows and Mac apps share the viewer and MCP server.
+
+```sh
+git clone https://github.com/UnlikeOtherAI/Electroscope.git
+cd Electroscope
+npm ci
+npm start
+```
+
+```sh
+npm run typecheck
+npm test
+npm run test:e2e # real camera
+node scripts/e2e.mjs --fake # synthetic camera, after npm run build
+npm run icons
+```
+
+The end-to-end suite drives the app through its UI and MCP endpoint, checks annotation pixels, and writes screenshots and captured images to `test-output/`. `ELECTROSCOPE_EXE` selects a packaged executable; `ELECTROSCOPE_CAMERA` selects a physical camera by label.
+
+- `src/main`: Electron process, camera-command bridge, and MCP server.
+- `src/renderer`: live camera, viewer, annotations, and command handlers.
+- `src/shared`: types, IPC channel names, and the agent prompt.
+
+`npm run dist:win` and `npm run dist:mac` create local development packages. Public downloads use the signed [release workflow](releases.md). The [manual Mac release guide](macos-release.md) covers a local signed build and physical-microscope checks.
diff --git a/docs/images/microscope-zoom.png b/docs/images/microscope-zoom.png
new file mode 100644
index 0000000..4a8c9ef
Binary files /dev/null and b/docs/images/microscope-zoom.png differ
diff --git a/docs/release-notes.md b/docs/release-notes.md
new file mode 100644
index 0000000..68a82d1
--- /dev/null
+++ b/docs/release-notes.md
@@ -0,0 +1,16 @@
+Give Claude, Codex, and other MCP agents eyes on your electronics. Watch the microscope live while your agent inspects snapshots and marks the component, pin, or test point it means.
+
+## Downloads
+
+- **Windows 11 x64:** `Electroscope-Windows-x64-Setup.exe`, or the portable EXE for use without installation.
+- **Mac with Apple Silicon:** `Electroscope-macOS-arm64.dmg`. Open it and drag Electroscope into Applications. A ZIP is also available.
+
+Both apps are signed as UnlikeOtherAI s.r.o.; the Mac app is notarized by Apple. SHA-256 checksums are in `SHA256SUMS.txt`.
+
+## Start looking together
+
+Plug in your USB microscope, open Electroscope, and select the camera. Click **Copy prompt for agent** and paste it into Claude Code, Codex, or another MCP-capable agent.
+
+You and your agent can draw circles, arrows, crosshairs, boxes, and labels on the same image. Zoom, rotate, freeze, capture close-ups, and save photos as you work through the board.
+
+The MCP server allows access from your trusted network by default and has no password. Disable network access in Settings if your agent runs on the same computer.
diff --git a/docs/releases.md b/docs/releases.md
new file mode 100644
index 0000000..7c6c9c9
--- /dev/null
+++ b/docs/releases.md
@@ -0,0 +1,47 @@
+# GitHub releases
+
+Push a version tag after its changes have merged to `main`. The tag must match `package.json` exactly:
+
+```sh
+git tag v0.1.1
+git push origin v0.1.1
+```
+
+The **Release** GitHub Actions workflow builds and tests both apps on GitHub-hosted Windows and Mac runners. It publishes these stable filenames, which the README download buttons follow through `releases/latest/download/`:
+
+- `Electroscope-Windows-x64-Setup.exe`
+- `Electroscope-Windows-x64-Portable.exe`
+- `Electroscope-macOS-arm64.dmg`
+- `Electroscope-macOS-arm64.zip`
+- `SHA256SUMS.txt`
+
+Windows executables and installers use the existing UnlikeOtherAI Azure Artifact Signing Public Trust profile. Each signature must be valid, timestamped, and match the legal publisher and profile-specific EKU. The NSIS installer is installed on the runner; the installed app runs the full synthetic-camera end-to-end suite.
+
+The Mac app uses the UnlikeOtherAI Developer ID Application identity, hardened runtime, and Apple notarization. The workflow extracts the final ZIP, verifies its signature, stapled ticket, and Gatekeeper acceptance, then runs the packaged app's synthetic-camera suite. It also mounts and verifies the app inside the DMG. Hosted tests use a synthetic camera; they do not claim physical-microscope verification.
+
+Publication waits for both platform jobs. It requires exactly the four expected download files, generates SHA-256 checksums, stages a draft release, uploads every asset, and only then makes the release public. Build, test, signing, or upload failures leave the new release unpublished. Rerunning can resume an unpublished draft; it refuses to replace an already published release. The final step downloads every asset through its public URL without authentication and checks its SHA-256 against the manifest.
+
+## Signing configuration
+
+The GitHub `release` environment permits only `v*` tags. The source validation job also requires the tagged commit to belong to `main` and match the package version. Pull requests and manual branch runs cannot reach signing credentials. Actions are pinned to commit SHAs.
+
+Environment secrets:
+
+- `MAC_CERTIFICATE_P12`: base64-encoded Developer ID certificate and private key.
+- `MAC_CERTIFICATE_PASSWORD`: encryption password for that P12.
+- `APPLE_API_KEY`: App Store Connect notarization key contents.
+- `APPLE_API_KEY_ID` and `APPLE_API_ISSUER`: its identifiers.
+
+Environment variables:
+
+- `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_SUBSCRIPTION_ID`.
+- `WINDOWS_ARTIFACT_SIGNING_ENDPOINT`, `WINDOWS_ARTIFACT_SIGNING_ACCOUNT`, `WINDOWS_ARTIFACT_SIGNING_PROFILE`.
+- `WINDOWS_SIGNER_EKU`: the profile-specific enhanced key usage.
+
+Electroscope uses its own Azure managed identity, federated only to `repo:UnlikeOtherAI/Electroscope:environment:release`, with the certificate-profile signer role on the existing profile. It does not reuse Nessie's federated identity or alter Nessie's release environments. Windows private signing keys are held by Azure; no PFX is required.
+
+Keys are configured through GitHub environment secrets, never through committed files or workflow logs. The Mac runner writes the notarization key to a temporary owner-only file and removes it when the job finishes. Electron Builder imports the certificate into a temporary keychain.
+
+To rerun a failed release, use **Re-run failed jobs** in Actions, or dispatch **Release** with the existing version tag selected. Tags and published artifacts should not be moved or overwritten; use a new patch version for corrections.
+
+The [manual Mac guide](macos-release.md) remains available for local signed builds and physical-camera checks.
diff --git a/package-lock.json b/package-lock.json
index a1da961..e1fd7fc 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "electroscope",
- "version": "0.1.0",
+ "version": "0.1.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "electroscope",
- "version": "0.1.0",
+ "version": "0.1.1",
"license": "MIT",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.32.2",
diff --git a/package.json b/package.json
index 2d5690a..8e53187 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "electroscope",
"productName": "Electroscope",
- "version": "0.1.0",
+ "version": "0.1.1",
"description": "Electronics microscope companion: a live camera viewer for you, on-demand snapshots for AI over MCP.",
"license": "MIT",
"author": "UnlikeOtherAI",
diff --git a/scripts/prepare-windows-signing.ps1 b/scripts/prepare-windows-signing.ps1
new file mode 100644
index 0000000..3286c41
--- /dev/null
+++ b/scripts/prepare-windows-signing.ps1
@@ -0,0 +1,37 @@
+param(
+ [Parameter(Mandatory = $true)]
+ [string]$DestinationDirectory
+)
+
+$ErrorActionPreference = 'Stop'
+$ProgressPreference = 'SilentlyContinue'
+
+# Microsoft documents extracting this package for SignTool. Pin the complete
+# archive instead of resolving a WinGet source or waiting for an MSI installer.
+$version = '1.0.146'
+$expectedHash = '7761e5d8f31e54b764da21d33cd8b0a2940e1b05526c7dfcb5e94b0431426f70'
+$uri = "https://api.nuget.org/v3-flatcontainer/microsoft.artifactsigning.client/$version/microsoft.artifactsigning.client.$version.nupkg"
+$directory = [System.IO.Path]::GetFullPath($DestinationDirectory)
+if ($directory -match '[\r\n]' -or -not $env:GITHUB_ENV) {
+ throw 'Artifact Signing preparation requires a safe directory and GITHUB_ENV.'
+}
+New-Item -ItemType Directory -Path $directory -Force | Out-Null
+$archive = Join-Path $directory 'client.zip'
+$client = Join-Path $directory 'client'
+
+Invoke-WebRequest -Uri $uri -OutFile $archive -TimeoutSec 60 -UseBasicParsing
+if ((Get-FileHash -LiteralPath $archive -Algorithm SHA256).Hash.ToLowerInvariant() -ne $expectedHash) {
+ throw 'The Artifact Signing client archive did not match its pinned SHA-256.'
+}
+Expand-Archive -LiteralPath $archive -DestinationPath $client -Force
+$dlib = Join-Path $client 'bin\x64\Azure.CodeSigning.Dlib.dll'
+if (-not (Test-Path -LiteralPath $dlib -PathType Leaf)) {
+ throw 'The Artifact Signing client archive did not contain its x64 signing library.'
+}
+$signature = Get-AuthenticodeSignature -LiteralPath $dlib
+if ($signature.Status -ne 'Valid' -or $signature.SignerCertificate.Subject -notmatch '(^|,\s*)O=Microsoft Corporation(,|$)') {
+ throw 'The Artifact Signing library requires a valid Microsoft signature.'
+}
+
+"ELECTROSCOPE_ARTIFACT_SIGNING_CLIENT_ROOT=$client" | Out-File -LiteralPath $env:GITHUB_ENV -Append -Encoding utf8
+Write-Host "Prepared pinned Microsoft Artifact Signing client $version at $client."
diff --git a/scripts/release-assets.mjs b/scripts/release-assets.mjs
new file mode 100644
index 0000000..b901151
--- /dev/null
+++ b/scripts/release-assets.mjs
@@ -0,0 +1,21 @@
+import { createHash } from 'node:crypto';
+import { readFile, readdir, writeFile } from 'node:fs/promises';
+import { join } from 'node:path';
+
+const dir = process.argv[2] ?? 'artifacts';
+const expected = [
+ 'Electroscope-Windows-x64-Setup.exe',
+ 'Electroscope-Windows-x64-Portable.exe',
+ 'Electroscope-macOS-arm64.dmg',
+ 'Electroscope-macOS-arm64.zip',
+];
+const files = (await readdir(dir)).sort();
+if (JSON.stringify(files) !== JSON.stringify([...expected].sort())) throw new Error(`Unexpected release assets: ${files}`);
+const sums = [];
+for (const name of expected) {
+ const bytes = await readFile(join(dir, name));
+ if (bytes.length < 1_000_000) throw new Error(`Release asset is unexpectedly small: ${name}`);
+ sums.push(`${createHash('sha256').update(bytes).digest('hex')} ${name}`);
+}
+await writeFile(join(dir, 'SHA256SUMS.txt'), `${sums.join('\n')}\n`);
+console.log(sums.join('\n'));
diff --git a/scripts/sign-windows-artifact.ps1 b/scripts/sign-windows-artifact.ps1
new file mode 100644
index 0000000..a2cded6
--- /dev/null
+++ b/scripts/sign-windows-artifact.ps1
@@ -0,0 +1,78 @@
+param(
+ [Parameter(Mandatory = $true)]
+ [string]$FilePath
+)
+
+$ErrorActionPreference = 'Stop'
+
+foreach ($name in @(
+ 'ELECTROSCOPE_ARTIFACT_SIGNING_ENDPOINT',
+ 'ELECTROSCOPE_ARTIFACT_SIGNING_ACCOUNT',
+ 'ELECTROSCOPE_ARTIFACT_SIGNING_PROFILE'
+)) {
+ if (-not (Get-Item -Path "Env:$name" -ErrorAction SilentlyContinue).Value) {
+ throw "$name is required for Windows Artifact Signing."
+ }
+}
+
+$resolvedFile = (Resolve-Path -LiteralPath $FilePath).Path
+$clientToolsRoots = if ($env:ELECTROSCOPE_ARTIFACT_SIGNING_CLIENT_ROOT) {
+ if (-not (Test-Path -LiteralPath $env:ELECTROSCOPE_ARTIFACT_SIGNING_CLIENT_ROOT -PathType Container)) {
+ throw 'The configured Artifact Signing client directory is unavailable.'
+ }
+ @($env:ELECTROSCOPE_ARTIFACT_SIGNING_CLIENT_ROOT)
+} else {
+ @(
+ (Join-Path ${env:ProgramFiles(x86)} 'Microsoft\ArtifactSigningClientTools'),
+ (Join-Path $env:ProgramFiles 'Microsoft\ArtifactSigningClientTools'),
+ (Join-Path $env:LOCALAPPDATA 'Microsoft\MicrosoftArtifactSigningClientTools'),
+ (Join-Path $env:LOCALAPPDATA 'Microsoft\MicrosoftTrustedSigningClientTools'),
+ (Join-Path $env:LOCALAPPDATA 'Microsoft\WinGet\Packages')
+ ) | Where-Object { Test-Path -LiteralPath $_ }
+}
+$dlib = @(
+ foreach ($root in $clientToolsRoots) {
+ Get-ChildItem -LiteralPath $root -Filter 'Azure.CodeSigning.Dlib.dll' `
+ -File -Recurse -ErrorAction SilentlyContinue
+ }
+) |
+ Sort-Object @{ Expression = { $_.FullName -match '[\\/]x64[\\/]' }; Descending = $true }, `
+ FullName -Descending |
+ Select-Object -First 1
+if (-not $dlib) {
+ throw "Azure.CodeSigning.Dlib.dll was not found below: $($clientToolsRoots -join ', ')."
+}
+
+$signToolRoots = @($clientToolsRoots)
+$signToolRoots += Join-Path ${env:ProgramFiles(x86)} 'Windows Kits\10\bin'
+$signTool = @(
+ foreach ($root in $signToolRoots) {
+ if (Test-Path -LiteralPath $root) {
+ Get-ChildItem -LiteralPath $root -Filter 'signtool.exe' -File -Recurse |
+ Where-Object { $_.FullName -match '[\\/]x64[\\/]' }
+ }
+ }
+) | Sort-Object FullName -Descending | Select-Object -First 1
+if (-not $signTool) {
+ throw 'A compatible x64 signtool.exe was not found.'
+}
+
+$metadataPath = Join-Path $env:RUNNER_TEMP "electroscope-artifact-signing-$PID.json"
+$metadata = @{
+ Endpoint = $env:ELECTROSCOPE_ARTIFACT_SIGNING_ENDPOINT
+ CodeSigningAccountName = $env:ELECTROSCOPE_ARTIFACT_SIGNING_ACCOUNT
+ CertificateProfileName = $env:ELECTROSCOPE_ARTIFACT_SIGNING_PROFILE
+ CorrelationId = $env:GITHUB_RUN_ID
+} | ConvertTo-Json
+
+try {
+ Set-Content -LiteralPath $metadataPath -Value $metadata -Encoding utf8NoBOM
+ & $signTool.FullName sign /v /debug /fd SHA256 `
+ /tr 'http://timestamp.acs.microsoft.com' /td SHA256 `
+ /dlib $dlib.FullName /dmdf $metadataPath $resolvedFile
+ if ($LASTEXITCODE -ne 0) {
+ throw "Artifact Signing failed for $resolvedFile with exit code $LASTEXITCODE."
+ }
+} finally {
+ Remove-Item -LiteralPath $metadataPath -Force -ErrorAction SilentlyContinue
+}
diff --git a/scripts/sign-windows.cjs b/scripts/sign-windows.cjs
new file mode 100644
index 0000000..101b314
--- /dev/null
+++ b/scripts/sign-windows.cjs
@@ -0,0 +1,8 @@
+const { execFileSync } = require('node:child_process');
+const { join } = require('node:path');
+
+module.exports = async ({ path, hash }) => {
+ if (process.platform !== 'win32' || hash !== 'sha256') throw new Error('Windows releases require SHA-256 Artifact Signing.');
+ execFileSync('pwsh.exe', ['-NoProfile', '-File', join(__dirname, 'sign-windows-artifact.ps1'), '-FilePath', path], { stdio: 'inherit' });
+ execFileSync('pwsh.exe', ['-NoProfile', '-File', join(__dirname, 'verify-windows-signature.ps1'), '-FilePath', path], { stdio: 'inherit' });
+};
diff --git a/scripts/verify-windows-signature.ps1 b/scripts/verify-windows-signature.ps1
new file mode 100644
index 0000000..3594532
--- /dev/null
+++ b/scripts/verify-windows-signature.ps1
@@ -0,0 +1,17 @@
+param([Parameter(Mandatory = $true)][string]$FilePath)
+$ErrorActionPreference = 'Stop'
+$signature = Get-AuthenticodeSignature -LiteralPath $FilePath
+$subject = 'CN=UnlikeOtherAI s.r.o., O=UnlikeOtherAI s.r.o., L=Mnichovice, S=Central Bohemia, C=CZ'
+if (-not $env:WINDOWS_SIGNER_EKU) { throw 'WINDOWS_SIGNER_EKU is required.' }
+$ekus = @($signature.SignerCertificate.Extensions |
+ Where-Object { $_ -is [System.Security.Cryptography.X509Certificates.X509EnhancedKeyUsageExtension] } |
+ ForEach-Object { $_.EnhancedKeyUsages } | ForEach-Object { $_.Value })
+if ($signature.Status -ne 'Valid' -or $signature.SignerCertificate.Subject -ne $subject -or
+ -not $signature.TimeStamperCertificate -or $env:WINDOWS_SIGNER_EKU -notin $ekus) {
+ throw "Invalid UnlikeOtherAI signature or timestamp on $FilePath"
+}
+$signTool = Get-ChildItem "${env:ProgramFiles(x86)}\Windows Kits\10\bin" -Filter signtool.exe -Recurse -File |
+ Where-Object { $_.FullName -match '[\\/]x64[\\/]' } | Sort-Object FullName -Descending | Select-Object -First 1
+if (-not $signTool) { throw 'x64 Windows SDK SignTool is required.' }
+& $signTool.FullName verify /pa /all /tw $FilePath
+if ($LASTEXITCODE -ne 0) { throw "SignTool verification failed: $FilePath" }
diff --git a/test/release.test.ts b/test/release.test.ts
new file mode 100644
index 0000000..88d84ca
--- /dev/null
+++ b/test/release.test.ts
@@ -0,0 +1,41 @@
+import { afterEach, expect, it } from 'vitest';
+import { mkdtemp, writeFile, readFile, rm } from 'node:fs/promises';
+import { tmpdir } from 'node:os';
+import { join } from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { spawnSync } from 'node:child_process';
+import { createHash } from 'node:crypto';
+
+const directories: string[] = [];
+const names = ['Electroscope-Windows-x64-Setup.exe', 'Electroscope-Windows-x64-Portable.exe', 'Electroscope-macOS-arm64.dmg', 'Electroscope-macOS-arm64.zip'];
+const run = (dir: string) => spawnSync(process.execPath, [fileURLToPath(new URL('../scripts/release-assets.mjs', import.meta.url)), dir], { encoding: 'utf8' });
+async function fixture() {
+ const dir = await mkdtemp(join(tmpdir(), 'electroscope-release-'));
+ directories.push(dir);
+ return dir;
+}
+afterEach(async () => {
+ await Promise.all(directories.splice(0).map((dir) => rm(dir, { recursive: true })));
+});
+
+it('refuses a release missing a platform', async () => {
+ const dir = await fixture();
+ await writeFile(join(dir, names[0]!), Buffer.alloc(1_000_000));
+ expect(run(dir).status).not.toBe(0);
+});
+
+it('refuses unexpected files instead of publishing runner data', async () => {
+ const dir = await fixture();
+ for (const name of names) await writeFile(join(dir, name), Buffer.alloc(1_000_000));
+ await writeFile(join(dir, 'notary.p8'), 'test fixture');
+ expect(run(dir).status).not.toBe(0);
+});
+
+it('writes SHA-256 checksums for exactly the four platform downloads', async () => {
+ const dir = await fixture();
+ const data = Buffer.alloc(1_000_000, 42);
+ for (const name of names) await writeFile(join(dir, name), data);
+ expect(run(dir).status).toBe(0);
+ const hash = createHash('sha256').update(data).digest('hex');
+ expect(await readFile(join(dir, 'SHA256SUMS.txt'), 'utf8')).toBe(names.map((name) => `${hash} ${name}\n`).join(''));
+});