Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
appId: com.inkeep.open-knowledge
productName: OpenKnowledge
copyright: Copyright © 2026 Inkeep
# Pin the Electron version explicitly — under pnpm's isolated node_modules
# layout electron-builder's auto-version-detection walks the package manifest
# tree and refuses to infer from a caret range. electron-userland/electron-
# builder#3984 is the canonical reference. Keep this byte-identical to the
# "electron" devDep in packages/desktop/package.json — that devDep is
# pinned exact (no caret) so the packaged runtime and the version used by
# electron-rebuild / native-module ABI compilation cannot drift.
electronVersion: "44.5.1"
# @electron/rebuild stays enabled for mac and Windows from this config because
# other native modules still use that pass. node-pty's N-API prebuilds do not
# require an Electron ABI rebuild.
#
# Linux skips the pass instead: `run-electron-builder.mjs` sets
# `npmRebuild: false` in its generated config whenever `--linux` is present. The
# skip is NOT expressed as a `beforeBuild` hook returning false: in
# app-builder-lib that also asserts "node_modules are staged externally", which
# suppresses dependency collection entirely and ships an asar the app cannot
# start from.
directories:
output: dist-desktop
buildResources: build
# Core-assert: the CLI's build:assets step produces packages/cli/dist/public/
# (Vite build of packages/app/, copied by `cp -r ../app/dist dist/public`).
# We consume that output directly — no separate renderer build for the app.
#
# STOP: win.files and linux.files replace this list for files outside
# node_modules, so each repeats the three anchored patterns.
files:
- &app-out "out/**/*"
- &no-renderer "!out/renderer/**"
- &no-maps "!**/*.map"
- "!**/node_modules/@inkeep/*/src/**"
- "!**/node_modules/**/*.{ts,mts,cts,tsx}"
- "!**/node_modules/@inkeep/open-knowledge/dist/public/**"
- "!**/node_modules/@inkeep/open-knowledge-native-config/**"
- "!**/node_modules/mermaid/dist/mermaid{.js,.min.js,.esm.mjs,.esm.min.mjs}"
- "!**/node_modules/mermaid/dist/chunks/mermaid.esm{,.min}/**"
- "!**/node_modules/@mermaid-js/parser/dist/mermaid-parser.esm{,.min}.mjs"
- "!**/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.esm{,.min}/**"
- "!**/node_modules/cytoscape-fcose/demo/**"
- "!**/node_modules/sql.js/dist/*-debug*"
- "!**/node_modules/sql.js/dist/*-asm*"
- "!**/node_modules/sql.js/dist/*-browser*"
- "!**/node_modules/sql.js/dist/worker.*"
- "!**/node_modules/just-bash/vendor/cpython-emscripten/**"
- "!**/node_modules/just-bash/dist/bin/**"
- "!**/node_modules/just-bash/dist/bundle/browser.js"
- "!**/node_modules/quickjs-emscripten/**"
- "!**/node_modules/quickjs-emscripten-core/**"
- "!**/node_modules/@jitl/**"
extraResources:
- from: "../cli/dist/public"
to: "app"
filter: ["**/*"]
# Compiled message catalogs for the MAIN process. The renderer's copies are
# bundled into its JS chunks by Vite, so main — which builds the native menu
# bar before any window exists — cannot borrow them; it reads these raw files
# off disk instead (main-i18n.ts). Same catalogs, one source of truth for the
# translations, two delivery mechanisms.
# The filter keeps ONLY `messages.json`: the sibling `.po` files are the
# translator-facing sources, several times larger, and nothing reads them at
# runtime. Guarded by tests/unit/electron-builder-locale-catalogs.test.ts.
- from: "../app/src/locales"
to: "locales"
filter: ["**/messages.json"]
# M6a: ship the CLI bundle + wrapper so the packaged .app can host
# `ok` on PATH via ELECTRON_RUN_AS_NODE=1.
# Ships the whole bundled CLI, INCLUDING `cli/dist/native/` — the prebuilt
# native-config loader + `.node` the CLI build copies there (Option 3: bundle
# the addon into the CLI; reports/native-addon-npm-distribution/REPORT.md). The
# spawned `ok` subprocess resolves the addon dist-relative from there.
# The filter must not exclude `.node`/`.js`/`package.json` — guarded by
# tests/unit/electron-builder-cli-native-deps.test.ts.
- from: "../cli/dist"
to: "cli/dist"
filter:
- "**/*"
- "!public/**"
- "!**/*.map"
# Post-review Minor #21: tsdown emits `.d.mts` + `.d.mts.map` for
# every source module. TypeScript declarations have no runtime
# function inside the packaged `.app` and add ~12 MB of dead
# weight (tiny info-leak surface too — internal type names
# minable from a customer .app). Exclude both shapes.
- "!**/*.d.mts"
- "!**/*.d.mts.map"
- "!**/*.d.ts"
- "!**/*.d.ts.map"
# The `ok` CLI wrapper ships per-platform (each platform block's
# extraResources below): the darwin/.app-layout bash wrapper under `mac`,
# the linux-layout bash wrapper under `linux`, and the `.cmd`/`.ps1` pair
# under `win`. All land in `<resources>/cli/bin/` so path-install + the
# NSIS include agree on one location.
# `@inkeep/open-knowledge-server`'s `version-constants.ts` reads its
# neighbouring `package.json` at module load to populate `RUNTIME_VERSION`
# (the value written into `server.lock`'s `runtimeVersion`). The CLI bundles
# the server source into `cli/dist/`, so the resolution walks `dist/../` and
# expects `cli/package.json` adjacent. Without this rule the file is missing
# in the shipped `.app` and every lock writes `runtimeVersion: "0.0.0-unknown"`,
# which collapses cross-install drift diagnostics. Coverage:
# `tests/unit/electron-builder-cli-pkgjson.uncached.test.ts`.
- from: "../cli/package.json"
to: "cli/package.json"
# Top-level discoverable third-party attribution. The same file ships inside
# cli/dist via the rule above; this places a copy at the Resources root so
# license reviewers and an eventual in-app About panel can find it without
# crawling cli/dist/. Electron's own LICENSE + LICENSES.chromium.html are
# placed by electron-builder automatically and cover Electron + Chromium.
- from: "../cli/dist/THIRD_PARTY_NOTICES.md"
to: "THIRD_PARTY_NOTICES.md"
# The project's own GPLv3 license text at the Resources root, alongside the
# third-party notices, so the About panel and license reviewers can find it.
# electron-builder places Electron's own LICENSE separately; that covers
# Electron + Chromium only, not OpenKnowledge itself.
- from: "../../LICENSE"
to: "LICENSE"
# The bundled CLI (`cli/dist/cli.mjs`) keeps `@napi-rs/keyring` EXTERNAL
# (tsdown `neverBundle` — it ships a native .node binary). At runtime its ESM
# resolver walks its OWN tree (`cli/dist` → `cli` → `Resources` → …) and
# NEVER reaches `app.asar.unpacked/node_modules/`, where the app's copy lives.
# Without a copy on the CLI's path, `import('@napi-rs/keyring')` in
# `createTokenStore` throws ERR_MODULE_NOT_FOUND and auth silently downgrades
# to the plaintext `~/.ok/auth.yml` file backend. Ship the wrapper here (it is
# platform-neutral JS) + the per-platform binary packages under each platform
# block's extraResources so the CLI resolves the keychain. Sourced from the
# workspace-root `node_modules` — pnpm isolates packages under `.pnpm/` by
# default, so pnpm-workspace.yaml surgically hoists `@napi-rs/keyring*` to the
# public root (`publicHoistPattern`) to keep these copy sources resolvable. pnpm
# installs only the host-matching binary package, so cross-arch builds run
# `scripts/prepare-platform-natives.mjs` (or `prepare-universal.mjs` on mac)
# first to force-install the missing arch prebuilds.
# Coverage: tests/unit/electron-builder-cli-native-deps.test.ts.
- from: "../../node_modules/@napi-rs/keyring"
to: "cli/node_modules/@napi-rs/keyring"
filter: ["**/*"]
# The bundled CLI AND the desktop main process both load
# `@inkeep/open-knowledge-native-config` at runtime — the Codex TOML
# harness-config write routes through its toml_edit addon. Like
# `@napi-rs/keyring` above, the bundled CLI's ESM resolver walks
# `cli/dist → cli → Resources → …` and never reaches
# `app.asar.unpacked/node_modules/`, so the addon must sit on the CLI's own
# path. Unlike keyring (a published package with a separate per-arch binary
# package), this is a workspace package whose napi-built loader + `.node`
# live in the package dir, so source it directly and filter to the runtime
# files — never the Rust `target/` tree. arm64-only matches the arm64-only
# DMG. When the binary is absent the load fails and the TOML write degrades
# to a non-destructive decline, never a lossy write.
# Coverage: tests/unit/electron-builder-cli-native-deps.test.ts.
- from: "../native-config"
to: "cli/node_modules/@inkeep/open-knowledge-native-config"
filter:
- "index.js"
- "index.d.ts"
- "package.json"
- "*.node"
# @parcel/watcher for the bundled CLI. The `asarUnpack` globs below cover the
# desktop app's OWN copy under app.asar.unpacked/, but the spawned `ok start`
# CLI resolves from `cli/dist → cli → Resources → …` and never reaches it (the
# same resolver-scope wall keyring + native-config work around above). Without
# a copy on the CLI's path, `import('@parcel/watcher')` throws at server boot
# and the watcher degrades to chokidar, dropping external subfolder edits
# (inkeep/open-knowledge#760). `scripts/stage-parcel-watcher.mjs` (run from the
# per-platform build scripts) resolves the wrapper + its runtime deps
# (picomatch v4 / is-glob / is-extglob / detect-libc) + the present per-arch
# binary package the way Node's `require()` does — NOT via workspace hoisting,
# which the tree's dual picomatch v2/v4 would make ship the wrong major — and
# stages them per-OS. This one rule copies that staged tree onto the CLI path.
# Coverage: tests/unit/electron-builder-parcel-watcher-deps.test.ts.
- from: "build/parcel-watcher-staging/node_modules"
to: "cli/node_modules"
filter: ["**/*"]
asarUnpack:
- "**/*.node"
- "**/@parcel/watcher/**"
- "**/@parcel/watcher-*/**"
# @parcel/watcher/wrapper.js lands in app.asar.unpacked/ via the rule above,
# but Node's module resolver from a file inside app.asar.unpacked/ walks
# real-filesystem `node_modules` only — it cannot cross into the sibling
# app.asar/ to resolve transitive requires. So every runtime JS dep of
# @parcel/watcher must also be unpacked, or `require('picomatch')` from
# wrapper.js fails with MODULE_NOT_FOUND at server boot and the server
# silently falls back to chokidar/fs.watch — the degraded macOS path that
# drops bulk creates and deletes (Finder Duplicate via clonefile, rm -rf
# cascades from `git pull`, etc.). Coverage:
# tests/unit/electron-builder-parcel-watcher-deps.test.ts.
- "**/picomatch/**"
- "**/is-glob/**"
- "**/is-extglob/**"
- "**/detect-libc/**"
- "**/@napi-rs/keyring/**"
- "**/@napi-rs/keyring-*/**"
- "**/simple-git/**"
# node-pty ships its native pty.node addon AND an extensionless `spawn-helper`
# binary under prebuilds/<platform>-<arch>/. The `**/*.node` rule above unpacks
# pty.node but NOT spawn-helper (no .node extension), so unpack the whole
# prebuilds tree. node-pty resolves the helper relative to the loaded pty.node
# and rewrites `app.asar` -> `app.asar.unpacked` itself, so spawn-helper MUST
# sit on the real filesystem or `pty.fork()` dies with "posix_spawnp failed".
# The prebuilt spawn-helper ships mode 0644 (node-pty#850) — scripts/afterPack.mjs
# chmods it 0755 before signing; the unpack rule and that chmod move in lockstep.
- "**/node-pty/prebuilds/**"
# On Windows node-pty reads ConPTY output on a worker thread
# (lib/worker/conoutSocketWorker.js). worker_threads cannot load JS from
# inside an asar, and the worker's CJS require() resolution needs node-pty's
# package.json on the real filesystem beside lib/ — VS Code unpacks the same
# set. Darwin/Linux never reach this path (the conout worker is win32-only
# code), so unpacking these everywhere is layout-only, not behavioral.
- "**/node-pty/lib/**"
- "**/node-pty/package.json"
mac:
category: public.app-category.productivity
# Platform-specific extraResources merge with the top-level list. The
# darwin/.app-layout `ok.sh` wrapper + the darwin-arm64 keyring binary
# package ship only into the mac bundle; win/linux carry their own wrapper
# + binary rules in their blocks below. arm64-only keyring: matches the
# arm64-only DMG (`mac.target`) and avoids the @electron/universal
# lipo-merge collision documented under `target:`.
extraResources:
- from: "resources/cli/bin/ok.sh"
to: "cli/bin/ok.sh"
- from: "../../node_modules/@napi-rs/keyring-darwin-arm64"
to: "cli/node_modules/@napi-rs/keyring-darwin-arm64"
filter: ["**/*"]
# Icon Composer bundle — packages the appearance variants (Default, Dark,
# Clear/Tinted light+dark) into a single source. electron-builder compiles
# this via `actool` into an `Assets.car` asset catalog at package time and
# wires it through `CFBundleIconName`, so macOS 26+ users get system-driven
# Liquid Glass appearance switching automatically.
#
# Build-host requirements: macOS 26+ with Xcode 26+ installed (actool is
# part of the Xcode command-line tools).
#
# Dev-mode `app.dock.setIcon()` still needs a flat PNG fallback
# (`build/icon.png`) because Electron's runtime nativeImage API can't
# consume `.icon` bundles yet — tracked in electron/electron#48476.
icon: build/okglass.icon
# Apple-Silicon-only target (TEMPORARY). The previous Universal config
# (`arch: [universal]`) tripped @electron/universal's lipo merger on
# @napi-rs/keyring's per-arch native binary — the arm64 prebuild
# (`keyring.darwin-arm64.node`) ends up at the same path in both slices,
# which the merger treats as "duplicate but not covered by x64ArchFiles"
# and rejects:
#
# ⨯ Detected file "...@napi-rs/keyring-darwin-arm64/keyring.darwin-arm64.node"
# that's the same in both x64 and arm64 builds and not covered by the
# x64ArchFiles rule: "undefined"
#
# Failed run: 25479422451 on inkeep/open-knowledge-legacy.
#
# Restore Universal once the arch-filter rule is in place — the proper
# fix is either (a) an `x64ArchFiles` glob that names the keyring module
# path so Universal's merger picks one slice deterministically, or (b)
# invoking @electron/universal with the `singleArchFiles` option for the
# native module. Both require validation against the keyring spec's
# Pass 0 expectations. When restoring Universal, the same arch-filter must
# also cover the staged `cli/node_modules/@parcel/watcher-darwin-<arch>/
# watcher.node` binary (via `scripts/stage-parcel-watcher.mjs`) — it hits the
# identical lipo "same in both slices" rejection. For now we ship arm64-only
# DMG/ZIP so the beta cadence has a working artifact and electron-updater on
# the beta channel can flow.
target:
- target: dmg
arch: [arm64]
# `.zip` is required by the electron-updater / Squirrel.Mac swap path.
# MacUpdater.ts:~89 calls `findFile(files, "zip", ["pkg", "dmg"])` — it
# downloads the ZIP variant (not the DMG) and pipes it to Squirrel.Mac
# for the in-place swap. Without this target, auto-update would surface
# ERR_UPDATER_ZIP_FILE_NOT_FOUND at every check.
- target: zip
arch: [arm64]
hardenedRuntime: true
gatekeeperAssess: false
entitlements: build/entitlements.mac.plist
# Helper processes (Renderer / GPU / Plugin / utility-process.fork) MUST
# use a helper-only plist that excludes restricted entitlements (notably
# `com.apple.developer.associated-domains`) and the main-app file-access
# entitlements. Helpers do not carry an embedded `.provisionprofile`;
# macOS 26.4.x AMFI rejects helpers that claim profile-restricted
# entitlements (SIGKILL — parent observes `exit_code=9`). See
# `build/entitlements.mac.inherit.plist` for the full contract +
# `tests/unit/entitlements-helper-split.test.ts` for the drift guard.
entitlementsInherit: build/entitlements.mac.inherit.plist
# Developer-ID provisioning profile that grants the
# `com.apple.developer.associated-domains` entitlement at codesign time.
# Apple-Silicon-only Developer-ID build (NOT Mac App Store), so the profile
# lives at the top-level `mac.provisioningProfile` key (not `mac.mas.*`).
# The profile binary is committed at `build/embedded.provisionprofile`
# (12,497 bytes, CMS-signed) — Developer-ID provisioning profiles are NOT
# secrets per Apple convention (every signed Electron app on macOS commits
# one — VS Code, Zed, Notion all follow the same pattern).
#
# Profile metadata (verify via `security cms -D -i build/embedded.provisionprofile | plutil -p -`):
# AppIDName: Open Knowledge
# TeamIdentifier: 6NZGSG335T
# application-identifier: 6NZGSG335T.com.inkeep.open-knowledge
# com.apple.developer.associated-domains: * (wildcard — accepts any
# applinks: declaration in the binary's entitlements plist)
# ExpirationDate: 2044-05-10
# ProvisionsAllDevices: true
#
# Without this profile, codesign rejects the embedded
# `com.apple.developer.associated-domains` entitlement at notarize time
# ("not authorized to use restricted entitlement").
provisioningProfile: build/embedded.provisionprofile
# `NSUserActivityTypes` declares which Handoff/Universal Link activity
# types the app handles. Without this key in Info.plist, macOS silently
# drops `continue-activity` events for inbound Universal Link clicks even
# when the entitlement + AASA file are in place — `LSOpenURLsWithRole
# error -10810` is the symptom in console.app.
# `NSUserActivityTypeBrowsingWeb` is Apple's reserved type for tapped-URL
# Handoff (the only flow this app uses). Adding new types here requires a
# provisioning-profile re-issue, so keep the list minimal.
extendInfo:
NSUserActivityTypes:
- NSUserActivityTypeBrowsingWeb
# The text of the macOS microphone consent dialog. Declared here rather
# than left to Electron's stock Info.plist, whose default ("This app
# needs access to the microphone") describes the wrong thing: the app
# records no audio of its own, and what the user is actually granting is
# mic access to whatever CLI they run in the docked terminal. The consent
# dialog is the only place that distinction is ever shown, so the string
# names it. Pairs with `com.apple.security.device.audio-input` in
# `build/entitlements.mac.plist`, but the two fail differently: without
# the entitlement tccd denies silently and no dialog appears at all;
# without this key the dialog still appears, having fallen back to the
# stock Electron string, and misdescribes what is being granted.
NSMicrophoneUsageDescription: >-
A program running in OpenKnowledge's terminal wants to use the microphone.
# Notarization runs in `scripts/afterSign.mjs` per spec §8.9 (custom afterSign
# pipeline). electron-builder's built-in notarize runs whenever this key is
# not `false` and APPLE_* credentials are set, so leaving it unset notarizes
# every signed build twice; `false` skips only the built-in step. afterSign
# takes one complete credential shape (Apple ID, API key, or keychain
# profile), skips notarize when none is set (the unsigned smoke path), and
# fails on a partial or mixed set.
notarize: false
# Helper bundle for the detached server. Lands the Info.plist that
# declares `LSUIElement=true` so macOS LaunchServices launches the
# spawned server process without a Dock tile — without this, the
# re-exec into the parent's MacOS binary triggers LaunchServices to
# pin a stuck "exec" Dock placeholder for the child's lifetime.
# UPSTREAM([email protected]): the helper binary afterPack clones into
# `<productName> Server.app/Contents/MacOS` SIGTRAPs unless it is named
# `<productName> Helper`; see `build/helper-bundle/Info.plist`.
extraFiles:
- from: build/helper-bundle/Info.plist
to: Frameworks/OpenKnowledge Server.app/Contents/Info.plist
dmg:
# `dmg.sign` defaults to false in electron-builder 26 and dmg-builder signs
# only when it is exactly `true`, so this line is what signs the DMG. It is
# safe on the unsigned path: `build:mac:unsigned`
# passes `-c.mac.identity=null`, which cascades: `dmg-builder/out/dmg.js:63-69`
# reads `qualifier = packager.platformSpecificBuildOptions.identity` and
# early-returns ("explicitly disabled if set to null") without attempting
# a keychain lookup. So `dmg.sign: true` + `mac.identity=null` = no-op on
# the DMG codesign step, no cert required. Verify before upgrading
# electron-builder or dmg-builder: confirm the null-identity short-circuit
# is still present in `dmg-builder/out/dmg.js:signDmg()`.
sign: true
# Stable, version-less asset name so the share-splash `releases/latest/
# download/...` URL resolves across releases. electron-builder's default
# (`${productName}-${version}-${arch}.${ext}`) embeds the version in the
# filename, which makes `latest/download/OpenKnowledge.dmg` 404 — the
# actual asset is `OpenKnowledge-0.4.1-arm64.dmg`. The arch suffix stays
# because we only ship arm64 today; an x64 / universal build would need
# a parallel artifactName + a splash decision rule.
# The docs site's Stable/Beta download resolvers derive their product-specific
# names from this pattern in docs/src/lib/download-links.ts.
artifactName: ${productName}-${arch}.${ext}
title: ${productName}
# The "drag me to Applications" arrow and branding are painted INTO the
# background art — Finder only composites the .app icon and the /Applications
# alias on top of it, at the `contents` coordinates below. `window` sets the
# installer-window size, and the 1x art must match it exactly. A sibling
# `build/[email protected]` at twice these dimensions (1080x760) supplies
# the Retina representation and is auto-composited by electron-builder when it
# sits next to the 1x file.
background: build/dmg-background.png
window:
width: 540
height: 380
contents:
- x: 140
y: 130
type: file
- x: 400
y: 130
type: link
path: /Applications
iconSize: 100
win:
icon: build/icon.ico
# Per-arch NSIS installers (see `nsis.buildUniversalInstaller: false`).
# electron-updater on Windows supports NSIS only; MSI is Future Work.
target:
- target: nsis
arch: [x64, arm64]
# Azure Artifact Signing (win.azureSignOptions) is wired by the manual
# build workflow via --config flags once the signing account exists —
# endpoint/account/profile names are procurement outputs and don't
# belong hardcoded here while unknown. Unsigned Windows artifacts are
# never published (internal QA only).
#
# node-pty ships in the Windows package: the terminal runs on ConPTY via the
# win32 prebuilds. The prune mirrors
# the Linux block (no foreign-platform prebuilds, no ~10 MB/arch .pdb debug
# symbols), and BOTH win32 arch prebuilds stay in BOTH per-arch installers —
# the addon picks prebuilds/win32-<process.arch> at runtime, which keeps
# x64-under-emulation working on arm64 hosts.
#
# Unlike Linux (whose overlay skips the rebuild pass entirely), mac/win keep
# @electron/rebuild enabled, and node-pty's node-gyp output under build/
# shadows the prebuilds at require() time — a cross-arch build would then
# ship builder-host binaries. Pruning build/** makes the per-arch prebuild
# the only loadable addon. third_party/ is ConPTY C++ source weight with no
# runtime role.
files:
- *app-out
- *no-renderer
- *no-maps
- "!**/node_modules/node-pty/prebuilds/**/*.pdb"
- "!**/node_modules/node-pty/prebuilds/darwin-*/**"
- "!**/node_modules/node-pty/prebuilds/linux-*/**"
- "!**/node_modules/node-pty/build/**"
- "!**/node_modules/node-pty/third_party/**"
# conpty.dll + OpenConsole.exe (under prebuilds/win32-*/conpty/) ship with
# Microsoft's Authenticode signatures and must keep them — re-signing would
# replace Microsoft's signature with ours and split the pair's provenance.
# The signing pass covers .exe files only, so this negative pattern excludes
# the one Microsoft .exe; conpty.dll is never in the default signing set.
signExts: ["!OpenConsole.exe"]
extraResources:
- from: "resources/cli/bin/ok.cmd"
to: "cli/bin/ok.cmd"
- from: "resources/cli/bin/ok.ps1"
to: "cli/bin/ok.ps1"
# Both arch binaries ship in each per-arch installer: extraResources
# rules are static across arches, and the napi wrapper picks the
# matching binary at runtime. ~1 MB of dead weight on the wrong arch,
# accepted (mirrors the mac arm64-only rationale, not its mechanism).
# `scripts/prepare-platform-natives.mjs` force-installs both before
# electron-builder runs (pnpm installs only the host-matching one).
- from: "../../node_modules/@napi-rs/keyring-win32-x64-msvc"
to: "cli/node_modules/@napi-rs/keyring-win32-x64-msvc"
filter: ["**/*"]
- from: "../../node_modules/@napi-rs/keyring-win32-arm64-msvc"
to: "cli/node_modules/@napi-rs/keyring-win32-arm64-msvc"
filter: ["**/*"]
nsis:
# One-click, per-user (no UAC), per D1. Per-user install =
# %LOCALAPPDATA%\Programs\@inkeepopen-knowledge-desktop (electron-builder
# uses the sanitized package name for one-click per-user installs) =
# silent UAC-free auto-updates.
oneClick: true
perMachine: false
# zip payload instead of the default solid 7z. On Windows-on-ARM the x86
# NSIS stub runs emulated, and Nsis7z there silently drops the archive
# tail holding the exe + dlls (VM-verified half-install with every PE
# file missing — the staged payload was byte-identical to the built one,
# so this is extraction, not corruption); nsisunz handles a real zip.
# differentialPackage must be off for useZip to take effect: NsisTarget
# only builds a zip when the build is not differential-aware, yet the
# NSIS script unconditionally follows useZip — leaving the default on
# ships 7z bytes under a .zip name and the installer dies with "Error
# opening ZIP file". Costs: no differential auto-update downloads on
# Windows (no Windows release channel exists yet to regress), and the
# installer grows ~37% (deflate vs solid LZMA; 169 MB → 232 MB arm64).
useZip: true
# KEEP IN LOCK-STEP with build/installer.nsh customInstall: because
# differential packaging is off, the installer's self-copy to
# $LOCALAPPDATA\<updaterCacheDirName>\installer.exe (the differential-update
# seed) is inert and installer.nsh deletes it. Re-enabling
# differentialPackage requires removing that Delete in the same change.
differentialPackage: false
# Separate per-arch installers (the default single universal installer
# would double the download for every user). Version-less artifact names
# keep `releases/latest/download/…` URLs stable across releases — the
# same contract as `dmg.artifactName` (OpenKnowledge-arm64.dmg).
buildUniversalInstaller: false
artifactName: ${productName}-Setup-${arch}.${ext}
# Custom include: HKCU user-PATH append for the bundled `ok` CLI +
# HKCU\Software\Classes openknowledge:// protocol registration (electron-
# builder's `protocols` key is macOS-Info.plist-only; NSIS gets registry
# keys here, and the app self-heals via setAsDefaultProtocolClient at
# startup).
include: build/installer.nsh
linux:
icon: build/icon.png
# Pinned (matches electron-builder's default lowercase-sanitized product
# name) because three other artifacts embed it: resources/cli/bin/
# ok-linux.sh ($ROOT_DIR/openknowledge), the deb maintainer scripts'
# ${executable} macro, and the .desktop Exec/Icon lines.
executableName: openknowledge
# productivity → no direct freedesktop mapping; Office is the
# conventional slot for knowledge/editor tools.
category: Office
synopsis: Collaborative markdown knowledge base
# deb only (integration-grade: .desktop protocol registration +
# /usr/bin/ok symlink via postinst). electron-builder appends
# MimeType=x-scheme-handler/openknowledge to the generated .desktop from
# the top-level `protocols` key.
#
# AppImage was CUT (2026-07-31) rather than fixed: its runtime needs
# FUSE 2 (`libfuse.so.2` + fuse2 `fusermount`), which no current
# mainstream distro ships — stock Debian 13 fails on BOTH arches
# (arm64 additionally on libz.so.1), verified in real-VM QA. Fixing it
# would mean maintaining custom launcher-swapping build machinery for a
# secondary artifact whose one distinguishing role — self-update — the
# deb/rpm now cover in-app: electron-builder stamps
# `resources/package-type` into fpm builds, which routes electron-updater
# to its DebUpdater/RpmUpdater classes (download from the release feed,
# install via pkexec — the user authenticates the swap; no apt/rpm
# repository involved). See RELEASES.md § "Linux updates (no package
# repository)". The no-sudo niche AppImage served is covered by the
# npm CLI / web app.
#
# The arm64 deb is built on a NATIVE arm64 runner (the `build-linux` matrix
# in .github/workflows/desktop-build-win-linux.yml), never cross-compiled:
# pnpm installs only the host-arch `@parcel/watcher` prebuild and the Linux
# build skips @electron/rebuild in the generated config, so an
# x64-host arm64 deb would package but ship the wrong native binaries.
target:
- target: deb
arch: [x64, arm64]
# rpm for the Fedora/RHEL family, same integration grade as the deb (both
# go through electron-builder's FpmTarget and share the maintainer
# scripts). Built on the same native runners as the debs, for the same
# prebuilt-natives reason.
- target: rpm
arch: [x64, arm64]
# Per-target arch naming is electron-builder's, not ours: this one pattern
# yields OpenKnowledge-amd64.deb / OpenKnowledge-arm64.deb and
# OpenKnowledge-x86_64.rpm / OpenKnowledge-aarch64.rpm (`getArtifactArchName`
# in builder-util rewrites `${arch}` per extension). deb and rpm therefore
# never collide on a filename even where the arch word differs.
artifactName: ${productName}-${arch}.${ext}
# node-pty publishes every platform prebuild in one package. Drop
# foreign-platform binaries and Windows debug symbols, but keep both Linux
# prebuilds so each installer carries the correct ELF regardless of builder
# architecture.
files:
- *app-out
- *no-renderer
- *no-maps
- "!**/node_modules/node-pty/prebuilds/**/*.pdb"
- "!**/node_modules/node-pty/prebuilds/darwin-*/**"
- "!**/node_modules/node-pty/prebuilds/win32-*/**"
extraResources:
# Linux-layout wrapper ships under the same canonical destination as
# the mac one so path-install + the deb postinst agree on one path.
- from: "resources/cli/bin/ok-linux.sh"
to: "cli/bin/ok.sh"
- from: "../../node_modules/@napi-rs/keyring-linux-x64-gnu"
to: "cli/node_modules/@napi-rs/keyring-linux-x64-gnu"
filter: ["**/*"]
- from: "../../node_modules/@napi-rs/keyring-linux-arm64-gnu"
to: "cli/node_modules/@napi-rs/keyring-linux-arm64-gnu"
filter: ["**/*"]
deb:
# /usr/bin/ok symlink + AppArmor userns profile (Ubuntu 24.04+) live in
# the maintainer scripts; removal is symmetric.
afterInstall: build/deb-postinst.sh
afterRemove: build/deb-postrm.sh
# Chromium sandbox needs unprivileged userns; Ubuntu 24.04 restricts it
# via AppArmor. The postinst ships a profile permitting it for our
# binary.
#
# First nine entries mirror electron-builder's stock deb list (setting
# `depends` REPLACES it, so they must be restated). The last three are
# direct DT_NEEDED entries of the Electron binary that the stock list
# omits — without them the deb installs cleanly on a minimal system and
# then dies at exec with "error while loading shared libraries", before
# any window or dialog exists. libasound2 is the one actually observed
# missing (stock Debian 13 VM); libcups2 is a hard Depends of
# libgtk-3-0 and libgbm1 normally arrives with Mesa, so both are
# belt-and-braces. On Debian 13, libasound2/libcups2 resolve through the
# t64 renames' compatibility Provides (libasound2t64, libcups2t64);
# libgbm1 was never renamed.
depends:
- libgtk-3-0
- libnotify4
- libnss3
- libxss1
- libxtst6
- xdg-utils
- libatspi2.0-0
- libuuid1
- libsecret-1-0
- libasound2
- libcups2
- libgbm1
rpm:
# Same maintainer scripts as the deb, deliberately. Every distro-specific
# step in them is already existence-guarded, so they no-op rather than fail
# on a Fedora/RHEL host: `update-alternatives` is present (chkconfig),
# `update-mime-database` / `update-desktop-database` sit behind `hash`, and
# the AppArmor block behind `apparmor_status --enabled`, which is simply
# absent outside the Ubuntu family. There are no dpkg-isms. The one thing
# they did NOT handle is rpm's upgrade ordering — the removal script grew a
# guard for it; see the UPSTREAM marker at the head of build/deb-postrm.sh.
afterInstall: build/deb-postinst.sh
afterRemove: build/deb-postrm.sh
# Our own list, not electron-builder's rpm default. The first eight entries
# are the Fedora/RHEL names for the `deb.depends` list above, in the same
# order. The default drops libsecret (the keyring backend), so an rpm built
# on it would install cleanly and then silently downgrade auth to the
# plaintext file store.
#
# `libxss1` has NO rpm counterpart here, deliberately. Its Fedora name is
# libXScrnSaver, which is EPEL-only on RHEL 10 — requiring it would make the
# package uninstallable on a stock RHEL 10 box. It buys nothing in exchange:
# `objdump -p` on the packaged `openknowledge` binary lists 34 DT_NEEDED
# entries and none of them is libXss (Electron moved idle detection to
# DBus). The deb keeps its `libxss1` because that is electron-builder's
# stock set and it is a harmless no-op on Debian/Ubuntu, where the package
# is in the default repos.
#
# The last three ARE direct DT_NEEDED entries of that same binary; without
# them the app dies at exec with a bare dynamic-linker error and no
# user-visible signal. They are absent from the deb list above only because
# that gap is being closed separately — the two lists are meant to stay a
# mirror of each other, which
# tests/unit/electron-builder-linux-depends-parity.test.ts enforces.
#
# Upstream spells two of its defaults as rpm boolean deps —
# `(libXtst or libXtst6)`, `(libuuid or libuuid1)` — to also satisfy
# openSUSE's soname-style naming. We use the plain Fedora/RHEL names:
# openSUSE is not a target, and a half-boolean list would imply coverage we
# do not test.
depends:
- gtk3
- libnotify
- nss
- libXtst
- xdg-utils
- at-spi2-core
- libuuid
- libsecret
- alsa-lib
- cups-libs
- mesa-libgbm
# Flip fuses (D17 LOCKED, spec §8.9) on the packed app before code signing —
# all platforms (D9): off-darwin builds without the fuse flip would ship
# without RunAsNode, silently breaking the bundled-CLI/detached-spawn path.
afterPack: scripts/afterPack.mjs
# Post-sign: fuse verify on all platforms; @electron/notarize → stapler
# validate on darwin only.
afterSign: scripts/afterSign.mjs
protocols:
- name: OpenKnowledge URL
schemes: [openknowledge]
role: Editor
# Finder "Open With → OpenKnowledge" for loose markdown files. `role: Editor`
# advertises us as an editor of these types; `rank: Alternate` means we do NOT
# steal the user's default handler (their existing editor keeps the
# double-click) — we only appear in the Open With list. macOS delivers the pick
# via the `open-file` Apple Event, which `registerProtocolHandler` routes
# through the same queue-then-flush spine as `ok <file>` (see main/url-scheme.ts).
fileAssociations:
- ext: [md, mdx]
name: Markdown Document
role: Editor
rank: Alternate
publish:
- provider: github
owner: inkeep
repo: open-knowledge
# Stable defaults live here. `scripts/run-electron-builder.mjs` derives the
# Beta product identity, protocol, icon, CLI integration, and
# channel from `OK_DESKTOP_VARIANT` before invoking electron-builder.
channel: latest