@auv-js/cli

中文文档
0.0.43发布于 2026/11/04Apache-2.0TypeScriptES Module构建来源已验证近 30 天下载 2.7万

NAPI bindings and the platform-matched AUV command-line executable

原始使用文档

@auv-js/cli

Installs the AUV command-line executable that matches the current operating system and CPU architecture. The executable is delivered by a platform-specific optional npm dependency, so installation does not run a network-downloading postinstall script.

pnpm add @auv-js/cli
pnpm exec auv --help

Node applications can resolve the installed executable explicitly:

import { binaryPath } from '@auv-js/cli/binary'
import { startAuv } from '@auv-js/sdk/node'

const daemon = await startAuv({ binaryPath: binaryPath() })

On macOS, the native binding exposes the same helper setup module as the CLI:

import {
  installMacosHelper,
  macosHelperStatus,
  openMacosHelperAccessibilitySettings,
  openMacosHelperBackgroundItemsSettings,
  uninstallMacosHelper,
} from '@auv-js/cli'

const before = await macosHelperStatus()
const installed = await installMacosHelper()

if (installed.state === 'requires-approval') {
  openMacosHelperBackgroundItemsSettings()
}
else if (installed.state === 'running') {
  openMacosHelperAccessibilitySettings()
}

// Removes only the helper app and its Accessibility decision. Enrollment is
// retained so a later reinstall does not require credential entry again.
await uninstallMacosHelper()

installMacosHelper() validates and installs the embedded app under the current user's AUV Application Support directory, then registers its embedded LaunchAgent through SMAppService. It needs neither sudo nor an administrator password. Development bindings report helperEmbedded=false; official macOS release bindings carry the same signed and notarized helper app as the CLI.

The CLI and every package that bundles @auv-js/cli are independent frontends for one per-user helper. Any helper whose declared protocol range includes this binding's protocol is usable, whatever its version. installMacosHelper() replaces it only when it is older than the embedded helper or does not support this protocol, and never downgrades it. If the installed helper dropped this binding's protocol, status reports frontend-outdated: update this package rather than the helper.

uninstallMacosHelper() waits for ServiceManagement to stop any in-flight helper process, resets the helper bundle's Accessibility decision, and removes only the installed app. It preserves enrollment and all other AUV Application Support content.

Electron packaging

Do not execute the binary from inside app.asar. During packaging, copy the path returned by binaryPath() into an unpacked, app-owned location and resolve that copied path at runtime.

  • macOS: copy it to YourApp.app/Contents/MacOS/auv, and list it in electron-builder's mac.binaries so it is signed as nested code.
  • Windows: copy it to resources/bin/auv.exe through extraResources.
  • Linux: copy the complete directory containing the path returned by binaryPath() to resources/bin through extraResources. The sibling lib/, share/, and licenses/ entries are part of the executable's runtime bundle; copying only auv is unsupported.

The Electron main process should own the child process and pass the resulting absolute path to startAuv(). Importing @auv-js/cli/binary during staging does not load the NAPI addon. If the application also imports the root NAPI entrypoint at runtime, keep *.node files outside the ASAR with the packager's native-module/asarUnpack support. Keep the SDK independent of packaging policy so browser and remote-client consumers do not install a native executable.

Shipping your own macOS helper

An application may ship the macOS helper under its own name, icon, bundle identifier, and Developer ID team instead of the official AUV Helper. Build it with crates/auv-device-helper-macos/package/package.sh and its AUV_MACOS_HELPER_* overrides, notarize and staple it, and embed the unpacked app in the application bundle without re-signing it (for example YourApp.app/Contents/Library/Helpers/). Pass that absolute path to both the daemon and setup:

import path from 'node:path'
import process from 'node:process'

import { installMacosHelper } from '@auv-js/cli'
import { startAuv } from '@auv-js/sdk/node'

const helperApp = path.join(process.resourcesPath, '..', 'Library', 'Helpers', 'Your Computer Use.app')

const status = await installMacosHelper({ helperApp })
const daemon = await startAuv({ binaryPath, platforms: { macos: { helperApp } } })

AUV reads the bundle identifier and Team ID from that app's signature, installs a copy under ~/Library/Application Support/<bundle identifier>/, and the daemon trusts only that identity. The CLI equivalent is auv setup macos-helper install --helper-app <path>. See the helper setup reference.

Supported packages currently cover macOS arm64/x64, glibc Linux arm64/x64, and Windows arm64/x64. Installing with optional dependencies disabled leaves no binary; binaryPath() reports that case with an actionable error.

版本与发布记录

@auv-js/cli 共发布 27 个版本,首次发布于 2026/08/17;过去 12 个月发布了 27 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.0.43latest2026/11/043 天前
0.0.422026/11/043 天前
0.0.412026/11/043 天前
0.0.402026/11/016 天前
0.0.382026/10/2315 天前
0.0.352026/10/1622 天前

其他发布通道:bootstrap → 0.0.0-bootstrap.0。

关于 @auv-js/cli 的常见问题

@auv-js/cli 是什么?

NAPI bindings and the platform-matched AUV command-line executable

如何安装 @auv-js/cli?

在项目目录运行 npm install @auv-js/cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 auv,可以用 npx auv 直接运行。

@auv-js/cli 支持 TypeScript 吗?

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

@auv-js/cli 支持 ESM 还是 CommonJS?

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

@auv-js/cli 可以商用吗?

@auv-js/cli 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@auv-js/cli 的下载量有多少?

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

@auv-js/cli 还在维护吗?

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