-
Notifications
You must be signed in to change notification settings - Fork 91
Launch permission onboarding after npm install #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,8 @@ https://github.com/user-attachments/assets/eacb3b15-f939-46c7-b3b3-6f876977a58d | |
| npm i -g open-computer-use | ||
| ``` | ||
|
|
||
| 在本机交互式的全局安装场景下,npm 也会尝试自动拉起内置的 permiso 风格权限引导;如果没有弹出来,手动运行 `open-computer-use` 或 `open-computer-use doctor` 即可。 | ||
|
||
|
|
||
| 第一次使用前,给你实际准备长期保留的那个 `Open Computer Use.app` 授予 macOS 的 `Accessibility` 和 `Screen Recording` 权限。CI 产出的 release 包继续作为正式分发身份;本地 debug/dev 构建会故意打成 `Open Computer Use (Dev).app`,这样系统设置里会明确显示成一个开发版 app,而不是再出现两个同名的 `Open Computer Use`。 | ||
|
|
||
| ```bash | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| ## [2026-04-22 16:36] | Task: launch npm postinstall onboarding | ||
|
|
||
| ### 🤖 Execution Context | ||
| * **Agent ID**: `OpenCode` | ||
| * **Base Model**: `gpt-5.4` | ||
| * **Runtime**: `OpenCode CLI` | ||
|
|
||
| ### 📥 User Query | ||
| > Make a PR to `iFurySt/open-codex-computer-use` so install uses the `permiso`-style permission onboarding on install. | ||
|
|
||
| ### 🛠 Changes Overview | ||
| **Scope:** `scripts/npm`, repository README docs | ||
|
|
||
| **Key Actions:** | ||
| - **[Auto-launch onboarding from npm postinstall]**: Updated the npm package generator so interactive local global installs detach-launch the bundled permission onboarding app instead of only printing next steps. | ||
| - **[Sync install docs]**: Updated English and Chinese README install sections plus generated package README text to explain the automatic onboarding behavior and the manual fallback command. | ||
|
|
||
| ### 🧠 Design Intent (Why) | ||
| The repo already ships a native permission onboarding flow that mirrors the `permiso` UX, but npm install previously left users at a text-only next step. Launching the bundled helper during interactive global installs shortens the path from install to granted permissions without blocking CI or non-interactive environments. | ||
|
|
||
| ### 📁 Files Modified | ||
| - `scripts/npm/build-packages.mjs` | ||
| - `README.md` | ||
| - `README.zh-CN.md` | ||
| - `docs/histories/2026-04/20260422-1636-launch-npm-postinstall-onboarding.md` |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -287,6 +287,66 @@ exec "\${app_binary}" "$@" | |||||||||||
|
|
||||||||||||
| function renderPostinstall(packageName, version) { | ||||||||||||
| return `#!/usr/bin/env node | ||||||||||||
| import { spawn } from "node:child_process"; | ||||||||||||
| import { existsSync } from "node:fs"; | ||||||||||||
| import path from "node:path"; | ||||||||||||
| import process from "node:process"; | ||||||||||||
| import { fileURLToPath } from "node:url"; | ||||||||||||
|
|
||||||||||||
| const scriptDir = path.dirname(fileURLToPath(import.meta.url)); | ||||||||||||
| const packageRoot = path.resolve(scriptDir, ".."); | ||||||||||||
| const bundledAppBinary = path.join( | ||||||||||||
| packageRoot, | ||||||||||||
| "dist", | ||||||||||||
| ${JSON.stringify(appBundleName)}, | ||||||||||||
| "Contents", | ||||||||||||
| "MacOS", | ||||||||||||
| ${JSON.stringify(appExecutableName)} | ||||||||||||
| ); | ||||||||||||
|
|
||||||||||||
| function shouldLaunchOnboarding() { | ||||||||||||
| if (process.platform !== "darwin") { | ||||||||||||
| return false; | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| if (process.env.CI === "1" || process.env.CI === "true") { | ||||||||||||
| return false; | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| if (process.env.OPEN_COMPUTER_USE_SKIP_POSTINSTALL_ONBOARDING === "1") { | ||||||||||||
| return false; | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| if (process.stdout.isTTY !== true) { | ||||||||||||
| return false; | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| return process.env.npm_config_global === "true" || process.env.npm_config_location === "global"; | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| function launchOnboardingIfPossible() { | ||||||||||||
| if (!shouldLaunchOnboarding() || !existsSync(bundledAppBinary)) { | ||||||||||||
| return false; | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| try { | ||||||||||||
| const child = spawn(bundledAppBinary, [], { | ||||||||||||
| detached: true, | ||||||||||||
| stdio: "ignore", | ||||||||||||
| env: { | ||||||||||||
| ...process.env, | ||||||||||||
| OPEN_COMPUTER_USE_LAUNCHED_FROM_POSTINSTALL: "1", | ||||||||||||
| }, | ||||||||||||
| }); | ||||||||||||
| child.on("error", () => {}); | ||||||||||||
|
||||||||||||
| child.on("error", () => {}); | |
| child.on("error", () => {}); | |
| if (child.pid === undefined) { | |
| return false; | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section describes the automatic postinstall onboarding but doesn’t mention the new opt-out env var (
OPEN_COMPUTER_USE_SKIP_POSTINSTALL_ONBOARDING=1). Since this is user-facing behavior (auto-launching a GUI app), consider documenting the opt-out here (and/or in a dedicated “Environment variables” section) so users can disable it predictably.