@botiverse/hands-electron

中文文档
0.2.0发布于 2026/07/09MITTypeScriptES Module零依赖近 30 天下载 1.9万

Hands crash reporting for Electron apps — main + renderer, Crashpad minidumps auto-uploaded and symbolicated server-side.

原始使用文档
文档目录5 节
  1. Install
  2. Main process
  3. Renderer process
  4. Symbols (server-side symbolication)
  5. What gets sent

@botiverse/hands-electron

Crash reporting for Electron apps, backed by Hands.

Electron's built-in Crashpad captures native minidumps for both the main and renderer processes and uploads them straight to Hands, where they're stored as crash tickets and symbolicated server-side against your uploaded Breakpad symbols. This SDK wires that up, adds renderer/child-process crash listeners, and manages a crash scope (user / tags / extra / breadcrumbs) that rides along on the next dump.

The SDK has two entry points, like @sentry/electron: one for the main process and one for the renderer.

Install

npm install @botiverse/hands-electron

electron is a peer dependency (provided by your app).

Main process

Call init() once, before the app is ready:

import { app } from "electron";
import * as Hands from "@botiverse/hands-electron/main";

Hands.init({
  appSlug: "my-desktop-app",     // your Hands app slug
  clientKey: "qk_live_...",      // public client key (safe to ship)
  release: app.getVersion(),     // version_name (defaults to app.getVersion())
  versionCode: 1020300,          // Hands version_code → picks the symbol set
  environment: "stable",         // channel
  extra: { deployment: "ga" },   // static annotations on every crash
  onCrash: (info) => {
    // renderer / child-process termination (incl. oom / killed, which produce
    // no minidump) — log, show a dialog, etc.
    console.warn("process gone:", info.processType, info.reason);
  },
});

// Attach context that rides along on the next crash:
Hands.setUser({ id: "u_123", email: "[email protected]" });
Hands.setTag("feature", "editor");
Hands.setExtra("open_docs", 3);
Hands.addBreadcrumb({ message: "opened project", category: "ui" });

init() also sends a throttled launch/install metrics ping to Hands using a random per-install device id stored under Electron userData. This powers active-device and version-distribution analytics; it is not a true online heartbeat. Use Hands.reportDevice(options) if you need to force a metrics ping outside the normal 24h throttle.

Renderer process

Renderer crashes are captured by the main-process Crashpad automatically — the renderer entry only manages scope and forwards it to main over IPC:

import * as Hands from "@botiverse/hands-electron/renderer";

Hands.setTag("route", location.pathname);
Hands.addBreadcrumb({ message: "clicked export" });

For sandboxed renderers (contextIsolation: true), expose the API from your preload script instead:

// preload.ts
import { exposeHands } from "@botiverse/hands-electron/preload";
exposeHands(); // → window.hands.setTag(...), window.hands.addBreadcrumb(...)

Symbols (server-side symbolication)

Minidumps only become readable stacks when Hands has your app's Breakpad symbols for that version_code. In CI, generate them with dump_syms and upload alongside the release:

# produce .sym files for your app + Electron framework binaries
dump_syms path/to/MyApp > syms/MyApp.sym
# … repeat per binary, then zip them (flat is fine — Hands reads each
#    file's MODULE header to place it correctly) …
zip -r symbols.zip syms/

hands builds publish-electron my-desktop-app \
  --version-name 1.2.3 --version-code 1020300 \
  --installer dist/MyApp-1.2.3.exe \
  --symbols symbols.zip

Once symbols are present, each crash ticket gets a symbolicated stack posted as a comment. Without symbols, Hands still records the crash with module+offset frames.

What gets sent

Every minidump carries a Sentry-electron-style annotation set the server folds into the ticket: product_type=electron, version, version_code, environment/channel, platform, arch, process_type, electron_version, chrome_version, plus any extra and the current user/tags/breadcrumbs.

版本与发布记录

@botiverse/hands-electron 共发布 1 个版本,首次发布于 2026/07/09;过去 12 个月发布了 1 个版本。

版本发布日期距今
0.2.0latest2026/07/094 个月前

关于 @botiverse/hands-electron 的常见问题

@botiverse/hands-electron 是什么?

Hands crash reporting for Electron apps — main + renderer, Crashpad minidumps auto-uploaded and symbolicated server-side.

如何安装 @botiverse/hands-electron?

在项目目录运行 npm install @botiverse/hands-electron,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:electron(>=22)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@botiverse/hands-electron 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@botiverse/hands-electron 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@botiverse/hands-electron 可以商用吗?

@botiverse/hands-electron 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@botiverse/hands-electron 的下载量有多少?

根据 npm 官方下载统计,@botiverse/hands-electron 在 2026/10/09 – 2026/11/07 这 30 天内被下载 19,134 次,日均约 638 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@botiverse/hands-electron 还在维护吗?

最新版本 0.2.0 发布于 2026/07/09(4 个月前);至今共发布 1 个版本,其中过去 12 个月发布了 1 个;首次发布于 2026/07/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。