agentapprove 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +11 -1
  2. package/dist/cli.js +264 -107
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -149,7 +149,7 @@ agentapprove --no-e2e # Skip end-to-end encryption setup
149
149
 
150
150
  - Node.js 18+
151
151
  - macOS, Linux, or Windows (with Git Bash / Git for Windows)
152
- - System tools: `curl`, `jq`, `openssl` (included with Git Bash on Windows)
152
+ - System tools: `curl`, `jq`, `openssl` (Git Bash includes curl and openssl; the installer offers to install jq separately with Winget)
153
153
  - Agent Approve iOS app and active subscription ($14.99/month, 7-day free trial)
154
154
 
155
155
  ## Links
@@ -201,3 +201,13 @@ Rerun the Agent Approve installer and select OpenClaw. Confirm that
201
201
  `before_tool_call`. Restart your running gateway to load the updated plugin.
202
202
  Keep existing settings and data while repairing; removing the plugin's config
203
203
  entry does not complete its pending migration.
204
+
205
+ ### Windows PowerShell
206
+
207
+ Install Node.js LTS and Git for Windows, then close all Terminal windows and reopen PowerShell. Use a normal terminal in the same Windows account as your coding agents; individual package installers may request administrator approval.
208
+
209
+ ```powershell
210
+ npx.cmd agentapprove@latest
211
+ ```
212
+
213
+ Use `npx.cmd` for the commands in this guide on Windows. It works without changing PowerShell's execution policy. If the wizard installs a dependency, restart your coding agent apps before testing hooks so they inherit the updated PATH.
package/dist/cli.js CHANGED
@@ -2204,13 +2204,62 @@ function applyPairKeyPlan(plan, agentApproveDir, deps) {
2204
2204
  return { backedUp };
2205
2205
  }
2206
2206
 
2207
+ // src/platform-command.ts
2208
+ import { statSync as statSync2 } from "node:fs";
2209
+ import { win32 } from "node:path";
2210
+ function hostInvocation(file, args, platform = process.platform, env = process.env) {
2211
+ if (platform !== "win32")
2212
+ return { file, args };
2213
+ const value = (key) => Object.entries(env).find(([k]) => k.toLowerCase() === key.toLowerCase())?.[1] ?? "";
2214
+ const directories = win32.isAbsolute(file) ? [""] : value("PATH").split(";").filter(Boolean);
2215
+ const extensions = win32.extname(file) ? [""] : (value("PATHEXT") || ".COM;.EXE;.BAT;.CMD").split(";");
2216
+ let resolved;
2217
+ for (const directory of directories) {
2218
+ for (const extension of extensions) {
2219
+ const candidate = directory ? win32.join(directory.replace(/^"|"$/g, ""), file + extension) : file + extension;
2220
+ try {
2221
+ if (statSync2(candidate).isFile()) {
2222
+ resolved = candidate;
2223
+ break;
2224
+ }
2225
+ } catch {}
2226
+ }
2227
+ if (resolved)
2228
+ break;
2229
+ }
2230
+ if (!resolved)
2231
+ return { file, args };
2232
+ if (!/\.(cmd|bat)$/i.test(resolved))
2233
+ return { file: resolved, args };
2234
+ const quote = (part) => {
2235
+ if (/[&|<>^%"!\r\n\0]/.test(part) || part.endsWith("\\"))
2236
+ throw new Error("Unsupported shell character in Windows host command.");
2237
+ return `"${part}"`;
2238
+ };
2239
+ const command = [resolved, ...args].map(quote).join(" ");
2240
+ return {
2241
+ file: win32.join(value("SystemRoot") || "C:\\Windows", "System32", "cmd.exe"),
2242
+ args: ["/d", "/s", "/c", `"${command}"`],
2243
+ windowsVerbatimArguments: true
2244
+ };
2245
+ }
2246
+ function cliInvocation(platform = process.platform) {
2247
+ return `${platform === "win32" ? "npx.cmd" : "npx"} agentapprove`;
2248
+ }
2249
+
2207
2250
  // src/openclaw-install.ts
2208
2251
  import { spawnSync } from "node:child_process";
2209
2252
  import { isDeepStrictEqual } from "node:util";
2210
2253
  var CONVERSATION_ACCESS_NOTICE = "OpenClaw setup includes access to prompts, responses, and completed conversations for monitoring and mobile follow-up. Your privacy and encryption settings still apply. OpenClaw will review any required plugin permissions during installation.";
2211
2254
  function runOpenClaw(args) {
2212
- const result = spawnSync("openclaw", args, { stdio: "inherit", shell: process.platform === "win32" });
2213
- return !result.error && result.status === 0;
2255
+ try {
2256
+ const command = hostInvocation("openclaw", args);
2257
+ const result = spawnSync(command.file, command.args, { stdio: "inherit", windowsVerbatimArguments: command.windowsVerbatimArguments });
2258
+ return !result.error && result.status === 0;
2259
+ } catch (error) {
2260
+ console.error(`Could not launch OpenClaw: ${error instanceof Error ? error.message : String(error)}`);
2261
+ return false;
2262
+ }
2214
2263
  }
2215
2264
  function isExpectedOpenClawActive(report, version) {
2216
2265
  if (!report || typeof report !== "object")
@@ -2223,11 +2272,12 @@ function isExpectedOpenClawActive(report, version) {
2223
2272
  }
2224
2273
  function readOpenClawActive(version) {
2225
2274
  try {
2226
- const result = spawnSync("openclaw", ["gateway", "call", "plugins.list", "--json"], {
2275
+ const command = hostInvocation("openclaw", ["gateway", "call", "plugins.list", "--json"]);
2276
+ const result = spawnSync(command.file, command.args, {
2227
2277
  encoding: "utf8",
2228
2278
  stdio: ["ignore", "pipe", "pipe"],
2229
2279
  timeout: 15000,
2230
- shell: process.platform === "win32"
2280
+ windowsVerbatimArguments: command.windowsVerbatimArguments
2231
2281
  });
2232
2282
  return !result.error && result.status === 0 && isExpectedOpenClawActive(JSON.parse(result.stdout), version);
2233
2283
  } catch {
@@ -2880,7 +2930,7 @@ var source_default = chalk;
2880
2930
 
2881
2931
  // src/cli.ts
2882
2932
  var import_qrcode_terminal = __toESM(require_main(), 1);
2883
- import { existsSync as existsSync5, readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync as mkdirSync3, mkdtempSync, copyFileSync as copyFileSync2, renameSync as renameSync4, readdirSync as readdirSync2, statSync as statSync2, lstatSync as lstatSync2, realpathSync as realpathSync2, rmSync as rmSync3 } from "fs";
2933
+ import { existsSync as existsSync5, readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync as mkdirSync3, mkdtempSync, copyFileSync as copyFileSync2, renameSync as renameSync4, readdirSync as readdirSync2, statSync as statSync4, lstatSync as lstatSync2, realpathSync as realpathSync2, rmSync as rmSync3 } from "fs";
2884
2934
  import { homedir, hostname, platform, tmpdir } from "os";
2885
2935
  import { join as join3, dirname as dirname4, sep as sep2 } from "path";
2886
2936
  import { execSync, spawnSync as spawnSync2 } from "child_process";
@@ -3427,8 +3477,7 @@ function getExistingKeyActionOptions(e2eRequired) {
3427
3477
  if (!e2eRequired) {
3428
3478
  options.push({
3429
3479
  value: "disable",
3430
- label: "Disable E2E encryption",
3431
- hint: "events visible on web dashboard"
3480
+ label: "Disable E2E encryption"
3432
3481
  });
3433
3482
  }
3434
3483
  return options;
@@ -3584,7 +3633,7 @@ function validBackgroundFilters(content) {
3584
3633
 
3585
3634
  // src/copy-hook-scripts.ts
3586
3635
  import { join as pathJoin } from "path";
3587
- var HOOK_INTEGRITY_FAILURE = "integrity check failed; run the latest installer: npx agentapprove@latest";
3636
+ var HOOK_INTEGRITY_FAILURE = "integrity check failed; run the latest installer: " + cliInvocation() + "@latest";
3588
3637
  function retryDelay(response) {
3589
3638
  const value = response.headers.get("Retry-After")?.trim();
3590
3639
  if (!value)
@@ -3718,9 +3767,11 @@ async function copyHookScripts(hooksDir, token, files, options) {
3718
3767
  // src/hook-manifest.generated.ts
3719
3768
  var HOOK_SCRIPT_SHA256 = {
3720
3769
  "antigravity-hook.sh": [
3770
+ "79793d7b262ada35ca5767d3fe9cddd2feb705b5f992baa5f2f7d870a3addb05",
3721
3771
  "1f096235ba308087ad578aabdf2217f3e4f8ba336626ef2b70188f8dd2f24ac9"
3722
3772
  ],
3723
3773
  "background-filter.js": [
3774
+ "b2085bc322c989592a0da489a90a540d58a29d334f2dbdb810aec160a2f05f46",
3724
3775
  "5850ec58a56474891627e54b4e34255a878b7d21037382296c5512ee6d250d54"
3725
3776
  ],
3726
3777
  "claude-notification.sh": [
@@ -3745,6 +3796,7 @@ var HOOK_SCRIPT_SHA256 = {
3745
3796
  "dc2d906e448d277be0f9b5e1cd1b0bddadd9d5d86f6a0012ffa6e63cb38fb906"
3746
3797
  ],
3747
3798
  "claude-stop.sh": [
3799
+ "867cd434a63a8eb36c29518e1f1f285afe5213843be302fab62ef30ace66f02e",
3748
3800
  "158629503c11d44d3864c6a4ea5448e5743b4cacc11f0246ef604ce5a4c27830"
3749
3801
  ],
3750
3802
  "claude-subagent-start.sh": [
@@ -3766,6 +3818,7 @@ var HOOK_SCRIPT_SHA256 = {
3766
3818
  "b14351394abeab95d047d6843e34d52e33758eef1f4f129a31efe6334858db53"
3767
3819
  ],
3768
3820
  "codex-stop.sh": [
3821
+ "e030dbba31533855bb69fef0328fcb07ca9f7e33aadd01aa289adaa346a489d7",
3769
3822
  "6c46b605b482a474205d850cec28f35ced74796beedf1f2647a1268fcfa7d45e"
3770
3823
  ],
3771
3824
  "codex-subagent-start.sh": [
@@ -3778,6 +3831,7 @@ var HOOK_SCRIPT_SHA256 = {
3778
3831
  "0e8886fa08e6c5529721f6e94907c9bad6c32e97c1f4827e2ef5270f349cce4f"
3779
3832
  ],
3780
3833
  "common.sh": [
3834
+ "6a69bce9934ca60b523298387f07f1159958c112d2897a2c1011326e3235ace3",
3781
3835
  "2c0407f51dfe95cf1bcc6c705a268ea461ab044e2808539339ad222a2b5ade2b",
3782
3836
  "e9878d93113337bd49ccfbc34f57aed38f0f93dad77eebe5b981adfe10ef82f2"
3783
3837
  ],
@@ -3818,6 +3872,7 @@ var HOOK_SCRIPT_SHA256 = {
3818
3872
  "23895ab6d2ecaa9fe278b3fb9d53b21418edd7cfac5116d53bd659d4ecbabae3"
3819
3873
  ],
3820
3874
  "cursor-stop.sh": [
3875
+ "7c699d07b577b66683aea7602c9008186ec5c62ddc2ee5fa6a70c0534e408b34",
3821
3876
  "052c9de32572aeb8b5c9d27313cd20a27790a2250ce3c9aeb8e7356a755c5de3"
3822
3877
  ],
3823
3878
  "cursor-subagent-start.sh": [
@@ -3857,6 +3912,7 @@ var HOOK_SCRIPT_SHA256 = {
3857
3912
  "5d1113f25accd644c82e21bbc7efc56739f549b6b8227bd8874afc6500112b46"
3858
3913
  ],
3859
3914
  "gemini-stop.sh": [
3915
+ "6460c3e132244224ca3900ef52538feea3c25adcfc2d1f243894cff95394cda2",
3860
3916
  "da82707cd945b2307efa0a137e54f3dc9a630b2d02a5056d676ad49712f8534f"
3861
3917
  ],
3862
3918
  "github-error.sh": [
@@ -3878,6 +3934,7 @@ var HOOK_SCRIPT_SHA256 = {
3878
3934
  "505f44ed4ca6345b8e9ff8a328198ed6141d4774a630821b984ab5cf4c3954ff"
3879
3935
  ],
3880
3936
  "github-stop.sh": [
3937
+ "a27d04f42a80503a3b6b0c86894a1934cb769fd2d74dc44d57a00aa69e8a7f9c",
3881
3938
  "07f2d802700cf7ace009207aaa3f9c96e4e5943c022faa9601d9b85277e50fa4"
3882
3939
  ],
3883
3940
  "github-subagent-start.sh": [
@@ -3893,9 +3950,11 @@ var HOOK_SCRIPT_SHA256 = {
3893
3950
  "a222c9f656da5c9b0c6cb9998ddb6dd07608cabacef2931d542d68b04075632b"
3894
3951
  ],
3895
3952
  "openhands-hook.sh": [
3953
+ "43f92e40dccca1ad9770274395e4c02f72f4d8fedff741f74efba72077ba1b45",
3896
3954
  "28cacd77360c53fdb7b095403dfc43c7b7cf83ff718ac85f7f1a9042652bd8c0"
3897
3955
  ],
3898
3956
  "windsurf-hook.sh": [
3957
+ "03514b6ad9e5af38d66c4c1d3a66d6131fade4e171699d699a13a9de7ef822fb",
3899
3958
  "b7e85df3b6188cd1dfd6b2eb904185e41b627e077a265eaa6bb88a804323b47d"
3900
3959
  ]
3901
3960
  };
@@ -3908,13 +3967,15 @@ function runHostCommand(file, args, options = {}) {
3908
3967
  const timeout = options.timeoutMs ?? HOST_COMMAND_TIMEOUT_MS;
3909
3968
  const interactive = options.interactive === true && process.stdin.isTTY === true && process.stdout.isTTY === true;
3910
3969
  try {
3911
- return execFileSync(file, args, {
3970
+ const command = hostInvocation(file, args);
3971
+ const spawnOptions = {
3972
+ windowsVerbatimArguments: command.windowsVerbatimArguments,
3912
3973
  encoding: "utf8",
3913
3974
  stdio: interactive ? "inherit" : ["ignore", "pipe", "pipe"],
3914
3975
  timeout: interactive ? undefined : timeout,
3915
- killSignal: "SIGTERM",
3916
- shell: process.platform === "win32" && file === "pi"
3917
- }) ?? "";
3976
+ killSignal: "SIGTERM"
3977
+ };
3978
+ return execFileSync(command.file, command.args, spawnOptions) ?? "";
3918
3979
  } catch (error) {
3919
3980
  if (error.code === "ETIMEDOUT") {
3920
3981
  throw new Error(`${file} ${args.slice(0, 3).join(" ")} timed out after ${timeout / 1000}s. Setup may be partial; check the host before retrying.`);
@@ -3963,6 +4024,52 @@ function ensureHermesHookTimeout(profile, run = runHostCommand) {
3963
4024
  run("hermes", [...prefix, "config", "set", TIMEOUT_KEY, String(HERMES_HOST_HOOK_TIMEOUT_SECONDS)]);
3964
4025
  }
3965
4026
 
4027
+ // src/dependency-recovery.ts
4028
+ async function verifyDependencies(options) {
4029
+ while (true) {
4030
+ options.refresh();
4031
+ const missing = options.missing();
4032
+ if (!missing.length)
4033
+ return "verified";
4034
+ const choice = await options.choose(missing);
4035
+ if (choice !== "retry")
4036
+ return choice;
4037
+ }
4038
+ }
4039
+
4040
+ // src/windows-path.ts
4041
+ import { execFileSync as execFileSync2 } from "node:child_process";
4042
+ import { win32 as win322 } from "node:path";
4043
+ function mergeWindowsPath(current, additions, env = process.env) {
4044
+ const expand = (text) => text.replace(/%([^%]+)%/g, (match, key) => Object.entries(env).find(([name]) => name.toLowerCase() === key.toLowerCase())?.[1] ?? match);
4045
+ const entries = current.split(";").filter(Boolean);
4046
+ const normalized = (entry) => entry.replace(/^"|"$/g, "").replace(/[\\/]+$/, "").toLowerCase();
4047
+ const seen = new Set(entries.map(normalized));
4048
+ for (const entry of additions.flatMap((value) => expand(value).split(";")).map((s) => s.trim()).filter(Boolean)) {
4049
+ if (/%[^%]+%/.test(entry) || seen.has(normalized(entry)))
4050
+ continue;
4051
+ entries.push(entry);
4052
+ seen.add(normalized(entry));
4053
+ }
4054
+ return entries.join(";");
4055
+ }
4056
+ function refreshWindowsPath() {
4057
+ if (process.platform !== "win32")
4058
+ return;
4059
+ const additions = [];
4060
+ try {
4061
+ const script = "$paths = @([Environment]::GetEnvironmentVariable('Path', 'Machine'), [Environment]::GetEnvironmentVariable('Path', 'User')); [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes((ConvertTo-Json -Compress -InputObject $paths)))";
4062
+ const output = execFileSync2(win322.join(process.env.SystemRoot || "C:\\Windows", "System32", "WindowsPowerShell", "v1.0", "powershell.exe"), ["-NoProfile", "-NonInteractive", "-Command", script], { encoding: "utf8", timeout: 1e4, stdio: ["ignore", "pipe", "ignore"] });
4063
+ const paths = JSON.parse(Buffer.from(output.trim(), "base64").toString("utf8"));
4064
+ if (Array.isArray(paths))
4065
+ additions.push(...paths.filter((path) => typeof path === "string"));
4066
+ } catch {}
4067
+ if (process.env.LOCALAPPDATA)
4068
+ additions.push(`${process.env.LOCALAPPDATA}\\Microsoft\\WinGet\\Links`);
4069
+ const key = Object.keys(process.env).find((key) => key.toLowerCase() === "path") || "Path";
4070
+ process.env[key] = mergeWindowsPath(process.env[key] || "", additions);
4071
+ }
4072
+
3966
4073
  // src/pairing-api-url.ts
3967
4074
  function looksLikeHostedAgentApproveApi(baseUrl) {
3968
4075
  try {
@@ -3985,6 +4092,7 @@ function resolvePairingApiBaseUrl(options) {
3985
4092
  }
3986
4093
 
3987
4094
  // src/setup-check.ts
4095
+ import { accessSync, constants, statSync as statSync3 } from "node:fs";
3988
4096
  function checkHookConfiguration(agent, config, hooksKey, hooks, mode, fileReady, expectedCommand = (file) => `~/.agentapprove/hooks/${file}`) {
3989
4097
  const result = (status, reason) => ({ agent, status, reason });
3990
4098
  const expected = hooks.filter((h) => !h.isPlugin && !(mode === "observe" && h.isApprovalHook));
@@ -4018,7 +4126,7 @@ function hookCommands(value) {
4018
4126
  function installOutro(integrations) {
4019
4127
  const ready = integrations.filter((item) => item.status === "ready").map((item) => item.agent);
4020
4128
  if (!ready.length) {
4021
- return "No integration is ready yet. Fix the problems listed above, then run npx agentapprove again. Nothing on your phone is waiting on this.";
4129
+ return `No integration is ready yet. Fix the problems listed above, then run ${cliInvocation()} again. Nothing on your phone is waiting on this.`;
4022
4130
  }
4023
4131
  return "";
4024
4132
  }
@@ -4029,12 +4137,14 @@ function formatNextSteps(steps) {
4029
4137
  }
4030
4138
  function checkSummary(integrations) {
4031
4139
  if (!integrations.length) {
4032
- return { lines: ["No integrations found. Run npx agentapprove to install one."], failed: true };
4140
+ return { lines: [`No integrations found. Run ${cliInvocation()} to install one.`], failed: true };
4033
4141
  }
4034
4142
  const lines = integrations.map((item) => ` ${item.agent}: ${item.status} (${item.reason})`);
4143
+ for (const item of integrations.filter((item) => item.status !== "ready"))
4144
+ lines.push(integrationDiagnostic(item));
4035
4145
  const ready = integrations.filter((item) => item.status === "ready").map((item) => item.agent);
4036
4146
  if (!ready.length) {
4037
- lines.push("No integration is ready. Repair the problems above with npx agentapprove, then run this again.");
4147
+ lines.push(`No integration is ready. Repair the problems above with ${cliInvocation()}, then run this again.`);
4038
4148
  return { lines, failed: true };
4039
4149
  }
4040
4150
  lines.push(`
@@ -4042,9 +4152,31 @@ Configured on this computer: ${ready.join(", ")}. Nothing was changed.`);
4042
4152
  lines.push("This checks configuration on this computer only. Open a new session in one of these agents and give it a normal task to see activity on your phone.");
4043
4153
  return { lines, failed: false };
4044
4154
  }
4155
+ function hookFileReady(path, platform = process.platform) {
4156
+ try {
4157
+ const stat = statSync3(path);
4158
+ if (!stat.isFile() || stat.size === 0)
4159
+ return false;
4160
+ accessSync(path, constants.R_OK);
4161
+ return platform === "win32" || !path.endsWith(".sh") || (stat.mode & 73) !== 0;
4162
+ } catch {
4163
+ return false;
4164
+ }
4165
+ }
4166
+ function integrationDiagnostic(item, invocation = cliInvocation()) {
4167
+ const reasons = {
4168
+ missing_files: "A required hook or encryption key file is missing, empty, or unreadable. Run setup again to repair it.",
4169
+ missing_dependency: "A required shell dependency (curl, jq, or openssl) could not be found. Install the missing dependency, restart Terminal and your agent app, then retry.",
4170
+ not_configured: "The required hooks or plugin are not registered. Run setup again and select this agent.",
4171
+ invalid_config: "The configuration could not be read or setup did not finish. Review the setup errors above and retry.",
4172
+ disabled: "This integration is disabled. Run setup when you want to enable it.",
4173
+ manual_step: "A manual setup step remains. Follow the instructions for this agent above."
4174
+ };
4175
+ return `${item.agent}: ${reasons[item.reason] ?? item.reason} Check again with ${invocation} check.`;
4176
+ }
4045
4177
 
4046
4178
  // src/cli.ts
4047
- var VERSION = "0.2.4";
4179
+ var VERSION = "0.2.6";
4048
4180
  function getApiUrl() {
4049
4181
  return process.env.AGENTAPPROVE_API || "https://api.agentapprove.com";
4050
4182
  }
@@ -4754,7 +4886,7 @@ function describeE2EEnabled(enabled) {
4754
4886
  if (enabled) {
4755
4887
  return "Event content is encrypted between this computer and your devices.";
4756
4888
  }
4757
- return "Event content can be viewed on the web dashboard.";
4889
+ return "Event content is not end-to-end encrypted.";
4758
4890
  }
4759
4891
  function describeDebugLogging(enabled) {
4760
4892
  if (enabled) {
@@ -4861,14 +4993,14 @@ async function confirmUninstallPlan(mode, plan) {
4861
4993
  message: "Delete E2E keys and rotation metadata? You may lose access to encrypted local history on this machine."
4862
4994
  });
4863
4995
  if (lD(firstKeyConfirm) || !firstKeyConfirm) {
4864
- v2.warn("Purge cancelled. Run `npx agentapprove uninstall` if you want to keep local keys and config.");
4996
+ v2.warn("Purge cancelled. Run `" + cliInvocation() + " uninstall` if you want to keep local keys and config.");
4865
4997
  return false;
4866
4998
  }
4867
4999
  const secondKeyConfirm = await ce({
4868
5000
  message: "Final confirmation: permanently delete the E2E keys and rotation metadata?"
4869
5001
  });
4870
5002
  if (lD(secondKeyConfirm) || !shouldDeleteCryptoMaterial(true, firstKeyConfirm === true, secondKeyConfirm === true)) {
4871
- v2.warn("Purge cancelled. Run `npx agentapprove uninstall` if you want to keep local keys and config.");
5003
+ v2.warn("Purge cancelled. Run `" + cliInvocation() + " uninstall` if you want to keep local keys and config.");
4872
5004
  return false;
4873
5005
  }
4874
5006
  }
@@ -4972,7 +5104,7 @@ function discoverE2EKeys() {
4972
5104
  const hex = readFileSync3(currentPath, "utf-8").trim();
4973
5105
  if (hex.length === 64) {
4974
5106
  const keyId = createHash3("sha256").update(Buffer.from(hex, "hex")).digest("hex").slice(0, 8);
4975
- keys.push({ keyId, keyHex: hex, path: currentPath, isCurrent: true, modifiedAt: statSync2(currentPath).mtime });
5107
+ keys.push({ keyId, keyHex: hex, path: currentPath, isCurrent: true, modifiedAt: statSync4(currentPath).mtime });
4976
5108
  }
4977
5109
  } catch {}
4978
5110
  }
@@ -4984,7 +5116,7 @@ function discoverE2EKeys() {
4984
5116
  const hex = readFileSync3(fullPath, "utf-8").trim();
4985
5117
  if (hex.length === 64) {
4986
5118
  const keyId = createHash3("sha256").update(Buffer.from(hex, "hex")).digest("hex").slice(0, 8);
4987
- keys.push({ keyId, keyHex: hex, path: fullPath, isCurrent: false, modifiedAt: statSync2(fullPath).mtime });
5119
+ keys.push({ keyId, keyHex: hex, path: fullPath, isCurrent: false, modifiedAt: statSync4(fullPath).mtime });
4988
5120
  }
4989
5121
  } catch {}
4990
5122
  }
@@ -5333,7 +5465,7 @@ AGENTAPPROVE_FAIL_BEHAVIOR=${config.failBehavior || "ask"}
5333
5465
  ${renderPreservedEnvSection(preserved)}
5334
5466
  # Settings in this file sync from your Agent Approve account settings, so
5335
5467
  # manual edits here are overwritten on the next config sync.
5336
- # To change settings, run: npx agentapprove install
5468
+ # To change settings, run: ${cliInvocation()} install
5337
5469
  `;
5338
5470
  writePrivateFile(envPath, content);
5339
5471
  }
@@ -6064,7 +6196,7 @@ codex_hooks = true`;
6064
6196
  return [
6065
6197
  "Install the Agent Approve plugin for Hermes:",
6066
6198
  "",
6067
- " npx agentapprove # automatic: download + verify + extract + enable",
6199
+ " " + cliInvocation() + " # automatic: download + verify + extract + enable",
6068
6200
  "",
6069
6201
  `Manual: download ${HERMES_BUNDLE_FILENAME} from your Agent Approve API,`,
6070
6202
  `verify SHA-256 matches ${HERMES_BUNDLE_SHA256.slice(0, 16)}…, extract into`,
@@ -6090,11 +6222,11 @@ function describeDownloadTerminalFailure(kind) {
6090
6222
  case "rate_limited":
6091
6223
  return "Hook download limit reached. Please wait a few minutes, then rerun the installer. Existing hook files were kept.";
6092
6224
  case "token_expired":
6093
- return "Hook download stopped: your saved token has expired. Run `npx agentapprove refresh` to re-pair, or run the installer again to choose Refresh / Re-pair.";
6225
+ return "Hook download stopped: your saved token has expired. Run `" + cliInvocation() + " refresh` to re-pair, or run the installer again to choose Refresh / Re-pair.";
6094
6226
  case "token_invalid":
6095
- return "Hook download stopped: your saved token is no longer valid. Run `npx agentapprove pair` to pair this computer again.";
6227
+ return "Hook download stopped: your saved token is no longer valid. Run `" + cliInvocation() + " pair` to pair this computer again.";
6096
6228
  case "scope_denied":
6097
- return "Hook download stopped: your saved token cannot download hooks. Run `npx agentapprove pair` to pair this computer again.";
6229
+ return "Hook download stopped: your saved token cannot download hooks. Run `" + cliInvocation() + " pair` to pair this computer again.";
6098
6230
  case "validation_unavailable":
6099
6231
  return "Hook download stopped: Agent Approve could not validate your token right now. Please try again in a few minutes.";
6100
6232
  case "network_blocked":
@@ -6114,11 +6246,12 @@ async function copyHookScripts2(hooksDir, token, files, options = {}) {
6114
6246
  }
6115
6247
  function readOpenClawInstalledVersion() {
6116
6248
  try {
6117
- const result = spawnSync2("openclaw", ["plugins", "inspect", "openclaw", "--json"], {
6249
+ const command = hostInvocation("openclaw", ["plugins", "inspect", "openclaw", "--json"]);
6250
+ const result = spawnSync2(command.file, command.args, {
6118
6251
  encoding: "utf8",
6119
6252
  stdio: ["ignore", "pipe", "pipe"],
6120
6253
  timeout: 30000,
6121
- shell: process.platform === "win32"
6254
+ windowsVerbatimArguments: command.windowsVerbatimArguments
6122
6255
  });
6123
6256
  if (result.status === 0) {
6124
6257
  const metadata = JSON.parse(result.stdout);
@@ -6173,7 +6306,9 @@ function readOpenCodeInstalledVersion() {
6173
6306
  }
6174
6307
  function installOpenCodePluginViaCli() {
6175
6308
  try {
6176
- const result = spawnSync2("opencode", ["plugin", OPENCODE_PLUGIN_SPEC, "--global", "--force"], {
6309
+ const command = hostInvocation("opencode", ["plugin", OPENCODE_PLUGIN_SPEC, "--global", "--force"]);
6310
+ const result = spawnSync2(command.file, command.args, {
6311
+ windowsVerbatimArguments: command.windowsVerbatimArguments,
6177
6312
  encoding: "utf8",
6178
6313
  stdio: ["ignore", "pipe", "pipe"]
6179
6314
  });
@@ -6581,7 +6716,7 @@ async function installHermesPluginViaCli() {
6581
6716
  return {
6582
6717
  success: false,
6583
6718
  label: "Agent Approve plugin",
6584
- error: "Python 3.10+ not found on PATH. Install Python 3.10 or newer (e.g. `brew install python@3.12`) and re-run npx agentapprove."
6719
+ error: "Python 3.10+ not found on PATH. Install Python 3.10 or newer (e.g. `brew install python@3.12`) and re-run " + cliInvocation() + "."
6585
6720
  };
6586
6721
  }
6587
6722
  const cfg = readInstallerConfig();
@@ -6589,7 +6724,7 @@ async function installHermesPluginViaCli() {
6589
6724
  return {
6590
6725
  success: false,
6591
6726
  label: "Agent Approve plugin",
6592
- error: "Missing API token. Pair your phone first by running `npx agentapprove` and completing the QR scan."
6727
+ error: "Missing API token. Pair your phone first by running `" + cliInvocation() + "` and completing the QR scan."
6593
6728
  };
6594
6729
  }
6595
6730
  v2.info("Hermes: downloading and verifying the plugin (up to 90 seconds)");
@@ -6711,7 +6846,7 @@ async function syncHermesProfiles(targetProfiles) {
6711
6846
  }
6712
6847
  const cfg = readInstallerConfig();
6713
6848
  if (!cfg.token) {
6714
- return { ok: false, results: [], error: "Missing API token. Run `npx agentapprove` to pair first." };
6849
+ return { ok: false, results: [], error: "Missing API token. Run `" + cliInvocation() + "` to pair first." };
6715
6850
  }
6716
6851
  const download = await downloadHermesBundle(cfg.apiUrl, cfg.apiVersion, cfg.token);
6717
6852
  if (!download.ok) {
@@ -6931,25 +7066,45 @@ async function checkSystemDependencies() {
6931
7066
  }
6932
7067
  if (action === "install" && combinedCommand) {
6933
7068
  const installSpinner = _2();
6934
- installSpinner.start("Installing dependencies");
7069
+ if (process.platform === "win32")
7070
+ v2.info("Installing dependencies. Follow any package-manager prompts below.");
7071
+ else
7072
+ installSpinner.start("Installing dependencies");
6935
7073
  try {
6936
- execSync(combinedCommand, { stdio: "pipe" });
6937
- installSpinner.stop("Dependencies installed");
6938
- const stillMissing = requiredMissing.filter((d) => !checkCommand(d.name));
6939
- if (stillMissing.length > 0) {
6940
- v2.warn(`Could not verify: ${stillMissing.map((d) => d.name).join(", ")}. Continuing anyway.`);
6941
- }
7074
+ execSync(combinedCommand, { stdio: process.platform === "win32" ? "inherit" : "pipe" });
7075
+ if (process.platform !== "win32")
7076
+ installSpinner.stop("Package manager finished");
6942
7077
  } catch (err) {
6943
- installSpinner.stop("Installation failed");
6944
- v2.error(`Failed to install: ${err instanceof Error ? err.message : "unknown error"}`);
6945
- v2.info("Please install the dependencies manually and try again.");
6946
- const continueAnyway = await ce({
6947
- message: "Continue with installation anyway?",
6948
- initialValue: false
6949
- });
6950
- if (lD(continueAnyway) || !continueAnyway) {
6951
- process.exit(1);
7078
+ if (process.platform !== "win32")
7079
+ installSpinner.stop("Package manager did not complete");
7080
+ v2.error(`Dependency installation did not complete: ${err instanceof Error ? err.message : "unknown error"}`);
7081
+ }
7082
+ const verification = await verifyDependencies({
7083
+ refresh: refreshWindowsPath,
7084
+ missing: () => requiredMissing.filter((d) => !checkCommand(d.name)).map((d) => d.name),
7085
+ choose: async (missing) => {
7086
+ v2.warn(`Still unavailable to hook scripts: ${missing.join(", ")}.`);
7087
+ if (process.platform === "win32")
7088
+ v2.info(`If installation succeeded, close all Terminal windows, reopen PowerShell, and run ${cliInvocation()} again. Restart your coding agent app too.`);
7089
+ const choice = await le({
7090
+ message: "How would you like to continue?",
7091
+ options: [
7092
+ { value: "retry", label: "Retry dependency check" },
7093
+ { value: "continue", label: "Continue anyway", hint: "hooks may not work correctly" },
7094
+ { value: "exit", label: "Exit and fix dependencies" }
7095
+ ]
7096
+ });
7097
+ return lD(choice) ? "exit" : choice;
6952
7098
  }
7099
+ });
7100
+ if (verification === "exit") {
7101
+ he("Install the missing dependencies and try again.");
7102
+ process.exit(1);
7103
+ }
7104
+ if (verification === "verified") {
7105
+ v2.success("Required dependencies verified.");
7106
+ if (process.platform === "win32")
7107
+ v2.info("Restart your coding agent apps before testing hooks so they can find the newly installed dependencies.");
6953
7108
  }
6954
7109
  }
6955
7110
  }
@@ -7247,7 +7402,7 @@ Monitor activity, enforce policy, and approve with a tap.`, "About");
7247
7402
  }
7248
7403
  }
7249
7404
  if (!useE2E) {
7250
- v2.info("E2E encryption disabled — event content will be visible on the web dashboard");
7405
+ v2.info("E2E encryption disabled.");
7251
7406
  }
7252
7407
  const e2eKeyId = e2eUserKey ? createHash3("sha256").update(Buffer.from(e2eUserKey, "hex")).digest("hex").slice(0, 8) : undefined;
7253
7408
  if (setupProfile === "customize") {
@@ -7602,7 +7757,7 @@ Timestamped backups will be created.`);
7602
7757
  `);
7603
7758
  nextSteps.push(`Add Agent Approve to your other Hermes profiles. Only the default one was set up.
7604
7759
  ` + `${lines}
7605
- ` + ` Run: npx agentapprove profiles`);
7760
+ ` + (" Run: " + cliInvocation() + " profiles"));
7606
7761
  }
7607
7762
  } catch {}
7608
7763
  }
@@ -7617,12 +7772,12 @@ Timestamped backups will be created.`);
7617
7772
  ` + ` Error: ${result.error || "unknown"}
7618
7773
  ` + ` Check plugin status: openclaw plugins inspect openclaw
7619
7774
  ` + ` If the package is missing: openclaw plugins install ${OPENCLAW_PLUGIN_SPEC}
7620
- ` + ` Then re-run: npx agentapprove`);
7775
+ ` + (" Then re-run: " + cliInvocation() + ""));
7621
7776
  } else if (agentId === "pi") {
7622
7777
  v2.warn(`Could not install ${PI_PLUGIN_SPEC} via Pi.
7623
7778
  ` + ` Error: ${result.error || "unknown"}
7624
7779
  ` + ` Install manually: pi install ${PI_PLUGIN_SPEC}
7625
- ` + ` Then re-run: npx agentapprove`);
7780
+ ` + (" Then re-run: " + cliInvocation() + ""));
7626
7781
  } else if (agentId === "hermes") {
7627
7782
  v2.warn(`Could not install Agent Approve plugin for Hermes.
7628
7783
  ` + ` Error: ${result.error || "unknown"}
@@ -7637,7 +7792,7 @@ Timestamped backups will be created.`);
7637
7792
  ` + ` 7. hermes config set plugins.hook_callback_timeout 600
7638
7793
  ` + ` (For a named profile add -p <profile> after hermes; skip if already 0/unlimited.)
7639
7794
  ` + ` 8. hermes plugins enable agentapprove
7640
- ` + ` Then re-run: npx agentapprove`);
7795
+ ` + (" Then re-run: " + cliInvocation() + ""));
7641
7796
  } else if (result.error) {
7642
7797
  v2.warn(`${agent.name} was not set up.
7643
7798
  ` + ` ${result.error}`);
@@ -7654,22 +7809,28 @@ Timestamped backups will be created.`);
7654
7809
  message: "Press Enter when done"
7655
7810
  });
7656
7811
  }
7657
- const integrationChecks = inspectSetup(selectedAgents).map((item) => failedSetupAgents.has(item.agent) ? { ...item, status: "failed", reason: "invalid_config" } : item);
7812
+ const integrationChecks = inspectSetup(selectedAgents).map((item) => failedSetupAgents.has(item.agent) ? { ...item, status: "failed", reason: item.status === "ready" ? "invalid_config" : item.reason } : item);
7658
7813
  writePrivateFile(join3(getAgentApproveDir(), "setup-agents.json"), JSON.stringify(selectedAgents));
7659
7814
  const modeDesc = hasE2EKey ? installMode === "observe" ? source_default.cyan("E2E Observe Mode") + " - All events encrypted, no approval hooks" : source_default.green("E2E Approval Mode") + " - Commands sent via encrypted channel for policy evaluation" : "Standard mode (no E2E keys found)";
7660
7815
  me(`Mode: ${modeDesc}
7661
7816
 
7662
- npx agentapprove pair Link a new iOS device
7663
- npx agentapprove check Re-check this computer's configuration (local only, changes nothing)
7664
- npx agentapprove status Show current configuration
7665
- npx agentapprove profiles Manage Agent Approve across Hermes profiles
7666
- npx agentapprove disable Deregister hooks/plugins, keep local state
7667
- npx agentapprove uninstall Remove hooks/plugins and keep local state
7668
- npx agentapprove purge Remove hooks/plugins and delete local state
7669
- npx agentapprove restore Restore original configs`, "Useful commands");
7817
+ ${cliInvocation()} pair Link a new iOS device
7818
+ ${cliInvocation()} check Re-check this computer's configuration (local only, changes nothing)
7819
+ ${cliInvocation()} status Show current configuration
7820
+ ${cliInvocation()} profiles Manage Agent Approve across Hermes profiles
7821
+ ${cliInvocation()} disable Deregister hooks/plugins, keep local state
7822
+ ${cliInvocation()} uninstall Remove hooks/plugins and keep local state
7823
+ ${cliInvocation()} purge Remove hooks/plugins and delete local state
7824
+ ${cliInvocation()} restore Restore original configs`, "Useful commands");
7670
7825
  if (nextSteps.length > 0) {
7671
7826
  me(formatNextSteps(nextSteps), "Next steps");
7672
7827
  }
7828
+ for (const item of integrationChecks) {
7829
+ if (item.status === "ready")
7830
+ v2.success(`${item.agent}: configuration verified on this computer.`);
7831
+ else
7832
+ v2.warn(integrationDiagnostic(item));
7833
+ }
7673
7834
  ge(installOutro(integrationChecks) || "Open Agent Approve on your iPhone and finish setting up.");
7674
7835
  }
7675
7836
  function inspectSetup(agentIds) {
@@ -7724,13 +7885,10 @@ function inspectSetup(agentIds) {
7724
7885
  }
7725
7886
  if (agentId === "codex" && !/codex_hooks\s*=\s*true/.test(readFileSync3(join3(homedir(), ".codex/config.toml"), "utf8")))
7726
7887
  return result("failed", "not_configured");
7727
- const filesReady = (file) => {
7728
- const path = join3(getAgentApproveDir(), "hooks", file);
7729
- return existsSync5(path) && statSync2(path).size > 0 && (!file.endsWith(".sh") || (statSync2(path).mode & 73) !== 0);
7730
- };
7888
+ const filesReady = (file) => hookFileReady(join3(getAgentApproveDir(), "hooks", file));
7731
7889
  if (!SHARED_HOOK_FILES.filter((file) => !BACKGROUND_FILTER_FILES.includes(file)).every(filesReady))
7732
7890
  return result("failed", "missing_files");
7733
- if (spawnSync2("bash", ["-c", "command -v curl >/dev/null && command -v jq >/dev/null && command -v openssl >/dev/null"], { timeout: 5000 }).status !== 0)
7891
+ if (spawnSync2(process.platform === "win32" ? findGitBash() || "bash" : "bash", ["-c", "command -v curl >/dev/null && command -v jq >/dev/null && command -v openssl >/dev/null"], { timeout: 5000 }).status !== 0)
7734
7892
  return result("failed", "missing_dependency");
7735
7893
  if (isAntigravityAgent(agentId)) {
7736
7894
  if (!existsSync5(join3(getAntigravityPluginRoot(agentId), "plugin.json")))
@@ -7771,7 +7929,7 @@ async function profilesCommand() {
7771
7929
  }
7772
7930
  const cfg = readInstallerConfig();
7773
7931
  if (!cfg.token) {
7774
- v2.error("Missing API token. Run `npx agentapprove` to pair your phone first.");
7932
+ v2.error("Missing API token. Run `" + cliInvocation() + "` to pair your phone first.");
7775
7933
  ge("No changes made.");
7776
7934
  process.exit(1);
7777
7935
  }
@@ -7861,11 +8019,11 @@ async function statusCommand() {
7861
8019
  `));
7862
8020
  if (existsSync5(join3(getAgentApproveDir(), DISABLED_STATE_FILENAME))) {
7863
8021
  console.log(source_default.yellow(" Disabled: hooks and plugins are deregistered from your agents."));
7864
- console.log(source_default.dim(" Run `npx agentapprove enable` to restore them.\n"));
8022
+ console.log(source_default.dim(" Run `" + cliInvocation() + " enable` to restore them.\n"));
7865
8023
  }
7866
8024
  const envPath = join3(getAgentApproveDir(), "env");
7867
8025
  if (!existsSync5(envPath)) {
7868
- console.log(source_default.yellow(" Not configured. Run `npx agentapprove` to set up.\n"));
8026
+ console.log(source_default.yellow(" Not configured. Run `" + cliInvocation() + "` to set up.\n"));
7869
8027
  return;
7870
8028
  }
7871
8029
  const envContent = readFileSync3(envPath, "utf-8");
@@ -7993,7 +8151,7 @@ function acquireDisabledStateMergeLock(lockPath) {
7993
8151
  return true;
7994
8152
  } catch {
7995
8153
  try {
7996
- if (Date.now() - statSync2(lockPath).mtimeMs > 1e4) {
8154
+ if (Date.now() - statSync4(lockPath).mtimeMs > 1e4) {
7997
8155
  rmSync3(lockPath, { recursive: true, force: true });
7998
8156
  continue;
7999
8157
  }
@@ -8018,7 +8176,7 @@ async function disableCommand() {
8018
8176
  if (hasExistingRecord) {
8019
8177
  console.log(source_default.yellow(`
8020
8178
  Already disabled.`));
8021
- console.log(source_default.dim(" Run `npx agentapprove enable` to re-register hooks and plugins.\n"));
8179
+ console.log(source_default.dim(" Run `" + cliInvocation() + " enable` to re-register hooks and plugins.\n"));
8022
8180
  return;
8023
8181
  }
8024
8182
  const existingConfig = readExistingConfig();
@@ -8040,12 +8198,12 @@ async function disableCommand() {
8040
8198
  }
8041
8199
  if (records.length === 0) {
8042
8200
  if (warnings.length > 0) {
8043
- console.log(source_default.yellow("\n Disable incomplete. Fix the warnings above and re-run `npx agentapprove disable`.\n"));
8201
+ console.log(source_default.yellow("\n Disable incomplete. Fix the warnings above and re-run `" + cliInvocation() + " disable`.\n"));
8044
8202
  } else if (!existingConfig && !legacyDisabledEnv) {
8045
- console.log(source_default.yellow(" Not configured. Run `npx agentapprove` to set up.\n"));
8203
+ console.log(source_default.yellow(" Not configured. Run `" + cliInvocation() + "` to set up.\n"));
8046
8204
  } else {
8047
8205
  console.log(source_default.yellow(" No Agent Approve hooks or plugins are registered."));
8048
- console.log(source_default.dim(" Nothing to disable. Run `npx agentapprove install` to set up agents.\n"));
8206
+ console.log(source_default.dim(" Nothing to disable. Run `" + cliInvocation() + " install` to set up agents.\n"));
8049
8207
  }
8050
8208
  return;
8051
8209
  }
@@ -8085,8 +8243,8 @@ async function disableCommand() {
8085
8243
  console.log(source_default.red(`
8086
8244
  ✗ Hooks and plugins were deregistered, but the restoration record could not be written:`));
8087
8245
  console.log(source_default.red(` ${err instanceof Error ? err.message : String(err)}`));
8088
- console.log(source_default.yellow(" `npx agentapprove enable` will not be able to restore this disable."));
8089
- console.log(source_default.yellow(" Run `npx agentapprove install` when you want to re-register hooks and plugins.\n"));
8246
+ console.log(source_default.yellow(" `" + cliInvocation() + " enable` will not be able to restore this disable."));
8247
+ console.log(source_default.yellow(" Run `" + cliInvocation() + " install` when you want to re-register hooks and plugins.\n"));
8090
8248
  return;
8091
8249
  }
8092
8250
  }
@@ -8101,7 +8259,7 @@ async function disableCommand() {
8101
8259
  if (warnings.length > 0) {
8102
8260
  console.log(source_default.yellow(" Some agents could not be fully disabled; see the warnings above."));
8103
8261
  }
8104
- console.log(source_default.dim(" Run `npx agentapprove enable` to restore everything.\n"));
8262
+ console.log(source_default.dim(" Run `" + cliInvocation() + " enable` to restore everything.\n"));
8105
8263
  }
8106
8264
  function disableAgent(agentId, agent, records, warnings) {
8107
8265
  if (agentId === "pi") {
@@ -8252,7 +8410,7 @@ async function enableCommand() {
8252
8410
  Already enabled.
8253
8411
  `));
8254
8412
  } else {
8255
- console.log(source_default.yellow("\n Not configured. Run `npx agentapprove` to set up.\n"));
8413
+ console.log(source_default.yellow("\n Not configured. Run `" + cliInvocation() + "` to set up.\n"));
8256
8414
  }
8257
8415
  return;
8258
8416
  }
@@ -8261,7 +8419,7 @@ async function enableCommand() {
8261
8419
  rmSync3(statePath, { force: true });
8262
8420
  console.log(source_default.yellow(`
8263
8421
  The disable record was unreadable, so registrations were not restored automatically.`));
8264
- console.log(source_default.dim(" Run `npx agentapprove install` to re-register hooks and plugins (your pairing is kept).\n"));
8422
+ console.log(source_default.dim(" Run `" + cliInvocation() + " install` to re-register hooks and plugins (your pairing is kept).\n"));
8265
8423
  return;
8266
8424
  }
8267
8425
  console.log(source_default.cyan(`
@@ -8273,14 +8431,14 @@ async function enableCommand() {
8273
8431
  const agent = AGENTS[record.agentId];
8274
8432
  if (!agent) {
8275
8433
  failures.push(record);
8276
- console.log(` ${source_default.yellow("⚠")} ${record.agentId}: this installer build does not know this agent. ` + "Re-run with the latest installer: npx agentapprove@latest enable");
8434
+ console.log(` ${source_default.yellow("⚠")} ${record.agentId}: this installer build does not know this agent. ` + ("Re-run with the latest installer: " + cliInvocation() + "@latest enable"));
8277
8435
  continue;
8278
8436
  }
8279
8437
  switch (record.kind) {
8280
8438
  case "hooks": {
8281
8439
  if (!existsSync5(hooksDir)) {
8282
8440
  failures.push(record);
8283
- console.log(` ${source_default.yellow("⚠")} ${agent.name}: ~/.agentapprove/hooks is missing. Run \`npx agentapprove install\` to re-download hook scripts.`);
8441
+ console.log(` ${source_default.yellow("⚠")} ${agent.name}: ~/.agentapprove/hooks is missing. Run \`${cliInvocation()} install\` to re-download hook scripts.`);
8284
8442
  break;
8285
8443
  }
8286
8444
  const result = await installHooksForAgent(record.agentId, hooksDir, state.mode);
@@ -8365,7 +8523,7 @@ async function enableCommand() {
8365
8523
  }
8366
8524
  default: {
8367
8525
  failures.push(record);
8368
- console.log(` ${source_default.yellow("⚠")} ${agent.name}: this installer build does not know how to restore this registration (kind "${record.kind}"). ` + "Re-run with the latest installer: npx agentapprove@latest enable");
8526
+ console.log(` ${source_default.yellow("⚠")} ${agent.name}: this installer build does not know how to restore this registration (kind "${record.kind}"). ` + ("Re-run with the latest installer: " + cliInvocation() + "@latest enable"));
8369
8527
  break;
8370
8528
  }
8371
8529
  }
@@ -8374,7 +8532,7 @@ async function enableCommand() {
8374
8532
  const remaining = { ...state, agents: failures };
8375
8533
  writePrivateFile(statePath, JSON.stringify(remaining, null, 2) + `
8376
8534
  `);
8377
- console.log(source_default.yellow("\n Agent Approve is partially re-enabled. Fix the warnings above and re-run `npx agentapprove enable`.\n"));
8535
+ console.log(source_default.yellow("\n Agent Approve is partially re-enabled. Fix the warnings above and re-run `" + cliInvocation() + " enable`.\n"));
8378
8536
  return;
8379
8537
  }
8380
8538
  rmSync3(statePath, { force: true });
@@ -8416,7 +8574,7 @@ async function performUninstall(mode) {
8416
8574
  const plan = buildUninstallPlan();
8417
8575
  if (!hasUninstallWork(mode, plan)) {
8418
8576
  console.log(source_default.yellow(`
8419
- Nothing to ${mode}. Run \`npx agentapprove install\` to set up Agent Approve.
8577
+ Nothing to ${mode}. Run \`${cliInvocation()} install\` to set up Agent Approve.
8420
8578
  `));
8421
8579
  return;
8422
8580
  }
@@ -8537,7 +8695,7 @@ async function performUninstall(mode) {
8537
8695
  return;
8538
8696
  }
8539
8697
  console.log(source_default.dim(" Local Agent Approve config, logs, hooks, backups, and E2E keys were kept."));
8540
- console.log(source_default.dim(" Run `npx agentapprove purge` if you want to remove all local Agent Approve traces.\n"));
8698
+ console.log(source_default.dim(" Run `" + cliInvocation() + " purge` if you want to remove all local Agent Approve traces.\n"));
8541
8699
  }
8542
8700
  async function uninstallCommand() {
8543
8701
  await performUninstall("uninstall");
@@ -8569,12 +8727,12 @@ async function initRepoCommand() {
8569
8727
  if (existsSync5(join3(getAgentApproveDir(), DISABLED_STATE_FILENAME))) {
8570
8728
  console.log(source_default.yellow(`
8571
8729
  Agent Approve is currently disabled. Hooks copied into this repo will be active.`));
8572
- console.log(source_default.dim(" Run `npx agentapprove enable` first if that is not what you want."));
8730
+ console.log(source_default.dim(" Run `" + cliInvocation() + " enable` first if that is not what you want."));
8573
8731
  }
8574
8732
  if (!existsSync5(cliHooksPath)) {
8575
8733
  console.log(source_default.yellow(`
8576
8734
  GitHub Copilot CLI hooks not found. Run the installer first with GitHub Copilot CLI selected.`));
8577
- console.log(source_default.dim(` npx agentapprove install
8735
+ console.log(source_default.dim(" " + cliInvocation() + ` install
8578
8736
  `));
8579
8737
  process.exit(1);
8580
8738
  }
@@ -8625,7 +8783,7 @@ ${source_default.dim(`Supported agents: ${SUPPORTED_AGENT_COPY}`)}
8625
8783
  ${source_default.dim(`Especially useful for autonomous agents like ${HIGHLIGHTED_AGENT_COPY}.`)}
8626
8784
 
8627
8785
  ${source_default.yellow("Usage:")}
8628
- npx agentapprove [command] [options]
8786
+ ${cliInvocation()} [command] [options]
8629
8787
 
8630
8788
  ${source_default.yellow("Commands:")}
8631
8789
  ${source_default.green("install")} Run the installation wizard (default)
@@ -8643,14 +8801,14 @@ ${source_default.yellow("Commands:")}
8643
8801
  ${source_default.green("help")} Show this help message
8644
8802
 
8645
8803
  ${source_default.yellow("Options:")}
8646
- --no-e2e Skip E2E encryption (events visible on web dashboard)
8804
+ --no-e2e Skip end-to-end encryption
8647
8805
 
8648
8806
  ${source_default.yellow("Examples:")}
8649
- npx agentapprove # Run installer
8650
- npx agentapprove pair # Link a new iOS device
8651
- npx agentapprove refresh # Get new token
8652
- npx agentapprove status # Check status
8653
- npx agentapprove profiles # Manage Hermes profiles
8807
+ ${cliInvocation()} # Run installer
8808
+ ${cliInvocation()} pair # Link a new iOS device
8809
+ ${cliInvocation()} refresh # Get new token
8810
+ ${cliInvocation()} status # Check status
8811
+ ${cliInvocation()} profiles # Manage Hermes profiles
8654
8812
 
8655
8813
  ${source_default.dim("Learn more at")} ${source_default.cyan("https://agentapprove.com")}
8656
8814
  `);
@@ -8660,7 +8818,7 @@ async function refreshCommand() {
8660
8818
  pe(source_default.bgCyan.black(" Agent Approve ") + source_default.gray(" Token Refresh"));
8661
8819
  const existingConfig = readExistingConfig();
8662
8820
  if (!existingConfig) {
8663
- v2.error('No existing configuration found. Run "npx agentapprove install" first.');
8821
+ v2.error('No existing configuration found. Run "' + cliInvocation() + ' install" first.');
8664
8822
  process.exit(1);
8665
8823
  }
8666
8824
  const pairingApiBase = resolvePairingApiBaseUrl({
@@ -8682,10 +8840,10 @@ but if unused for 30 days they expire. Get a new one below.`, "Token Expired");
8682
8840
  if (existingKey.length === 64) {
8683
8841
  e2eUserKey = existingKey;
8684
8842
  e2eKeyId = createHash3("sha256").update(Buffer.from(existingKey, "hex")).digest("hex").slice(0, 8);
8685
- v2.info(`Refresh will reuse E2E key ${e2eKeyId}. Use "npx agentapprove pair" if you need to choose a different key or repair pairing on another device.`);
8843
+ v2.info(`Refresh will reuse E2E key ${e2eKeyId}. Use "${cliInvocation()} pair" if you need to choose a different key or repair pairing on another device.`);
8686
8844
  }
8687
8845
  } else {
8688
- v2.info('Refresh updates the token only. Use "npx agentapprove pair" if you need to repair or change E2E pairing.');
8846
+ v2.info('Refresh updates the token only. Use "' + cliInvocation() + ' pair" if you need to repair or change E2E pairing.');
8689
8847
  }
8690
8848
  const configSetAt = carryConfigSetAt(existingConfig.configSetAt, Math.floor(Date.now() / 1000));
8691
8849
  const privacy = existingConfig.privacy || "full";
@@ -8735,7 +8893,7 @@ but if unused for 30 days they expire. Get a new one below.`, "Token Expired");
8735
8893
  pairingSpinner.stop(`Connected! ${result.email ? `Account: ${result.email}` : ""}`);
8736
8894
  } else {
8737
8895
  pairingSpinner.stop("Session expired");
8738
- v2.error('Session expired. Run "npx agentapprove refresh" to try again.');
8896
+ v2.error('Session expired. Run "' + cliInvocation() + ' refresh" to try again.');
8739
8897
  process.exit(1);
8740
8898
  }
8741
8899
  const refreshPreservation = resolvePreservation({
@@ -8767,7 +8925,7 @@ but if unused for 30 days they expire. Get a new one below.`, "Token Expired");
8767
8925
  updateSpinner.stop("Hooks will use the new token on their next run");
8768
8926
  } catch (error) {
8769
8927
  updateSpinner.stop("Warning: Could not refresh the installed hooks");
8770
- v2.warn('You may need to run "npx agentapprove install" to reconfigure hooks.');
8928
+ v2.warn('You may need to run "' + cliInvocation() + ' install" to reconfigure hooks.');
8771
8929
  }
8772
8930
  ge(source_default.green("Token refreshed successfully!"));
8773
8931
  }
@@ -8783,7 +8941,7 @@ async function pairCommand() {
8783
8941
  const keys = discoverE2EKeys();
8784
8942
  if (keys.length === 0 && !existingConfig) {
8785
8943
  v2.error("No E2E keys or configuration found.");
8786
- v2.info('Run "npx agentapprove install" to set up Agent Approve first.');
8944
+ v2.info('Run "' + cliInvocation() + ' install" to set up Agent Approve first.');
8787
8945
  process.exit(1);
8788
8946
  }
8789
8947
  const keyOptions = [];
@@ -8810,8 +8968,7 @@ async function pairCommand() {
8810
8968
  });
8811
8969
  keyOptions.push({
8812
8970
  value: PAIR_KEY_DISABLE,
8813
- label: "Disable E2E encryption",
8814
- hint: "events visible on web dashboard"
8971
+ label: "Disable E2E encryption"
8815
8972
  });
8816
8973
  const skipE2E = hasFlag2("--no-e2e");
8817
8974
  const selectedKeyId = skipE2E ? PAIR_KEY_DISABLE : await le({
@@ -8830,7 +8987,7 @@ async function pairCommand() {
8830
8987
  const e2eUserKey = keyPlan.e2eUserKey;
8831
8988
  const e2eKeyId = keyPlan.kind === "disable" ? undefined : keyPlan.e2eKeyId;
8832
8989
  if (keyPlan.kind === "disable") {
8833
- v2.info("E2E encryption will be disabled when pairing completes. Event content will be visible on the web dashboard.");
8990
+ v2.info("E2E encryption will be disabled when pairing completes.");
8834
8991
  } else if (keyPlan.kind === "generate") {
8835
8992
  v2.info(`A new key (${e2eKeyId}) will be saved when pairing completes.`);
8836
8993
  } else {
@@ -8880,7 +9037,7 @@ async function pairCommand() {
8880
9037
  }
8881
9038
  if (!result) {
8882
9039
  pairingSpinner.stop("Session expired");
8883
- v2.error('Session expired. Run "npx agentapprove pair" to try again.');
9040
+ v2.error('Session expired. Run "' + cliInvocation() + ' pair" to try again.');
8884
9041
  process.exit(1);
8885
9042
  }
8886
9043
  pairingSpinner.stop(`Paired! ${result.email ? `Account: ${result.email}` : ""}`);
@@ -8924,7 +9081,7 @@ async function pairCommand() {
8924
9081
  updateSpinner.stop("Hooks will use the new token on their next run");
8925
9082
  } catch {
8926
9083
  updateSpinner.stop("Warning: Could not refresh the installed hooks");
8927
- v2.warn('You may need to run "npx agentapprove install" to reconfigure hooks.');
9084
+ v2.warn('You may need to run "' + cliInvocation() + ' install" to reconfigure hooks.');
8928
9085
  }
8929
9086
  }
8930
9087
  ge(source_default.green(`Device paired with key ${e2eKeyId}`));
@@ -8985,7 +9142,7 @@ async function main() {
8985
9142
  default:
8986
9143
  console.log(source_default.red(`
8987
9144
  Unknown command: ${command}`));
8988
- console.log(source_default.dim(` Run 'npx agentapprove help' for usage.
9145
+ console.log(source_default.dim(" Run '" + cliInvocation() + ` help' for usage.
8989
9146
  `));
8990
9147
  process.exit(1);
8991
9148
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentapprove",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "AI agent observability and control from your iPhone or Apple Watch",
5
5
  "type": "module",
6
6
  "bin": {