agentapprove 0.1.2 → 0.1.3

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 (2) hide show
  1. package/dist/cli.js +25 -4
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -2318,7 +2318,7 @@ import { homedir, hostname, platform } from "os";
2318
2318
  import { join, dirname, basename } from "path";
2319
2319
  import { execSync, spawnSync } from "child_process";
2320
2320
  import { randomBytes, createHash } from "crypto";
2321
- var VERSION = "0.1.1";
2321
+ var VERSION = "0.1.3";
2322
2322
  function getApiUrl() {
2323
2323
  return process.env.AGENTAPPROVE_API || "https://api.agentapprove.com";
2324
2324
  }
@@ -3077,7 +3077,7 @@ async function installHooksForAgent(agentId, hooksDir, mode = "approval") {
3077
3077
  return { success: true, backupPath, hooks: installedHooks };
3078
3078
  }
3079
3079
  if (agentId === "opencode") {
3080
- if (!config.plugin) {
3080
+ if (!Array.isArray(config.plugin)) {
3081
3081
  config.plugin = [];
3082
3082
  }
3083
3083
  const pluginArray = config.plugin;
@@ -4058,6 +4058,9 @@ AGENTAPPROVE_E2E_MODE=${installMode}
4058
4058
  for (const agentId of selectedAgents) {
4059
4059
  const agent = AGENTS[agentId];
4060
4060
  filesToModify.push(agent.configPath);
4061
+ if (agentId === "opencode") {
4062
+ filesToModify.push(join(getOpenCodeConfigDir(), ".opencode", "package.json"));
4063
+ }
4061
4064
  if (agentId === "vscode-agent") {
4062
4065
  const vsCodeVariants = findInstalledVSCodeVariants();
4063
4066
  for (const { path: settingsPath, variant } of vsCodeVariants) {
@@ -4171,6 +4174,20 @@ async function statusCommand() {
4171
4174
  for (const [agentId, agent] of Object.entries(AGENTS)) {
4172
4175
  if (existsSync(agent.configPath)) {
4173
4176
  const config = readJsonConfig(agent.configPath);
4177
+ if (agentId === "opencode") {
4178
+ const pluginConfig = config.plugin;
4179
+ if (Array.isArray(pluginConfig) && pluginConfig.some((entry) => entry === "@agentapprove/opencode")) {
4180
+ console.log(` ${source_default.green("✓")} ${agent.name}: agentapprove plugin`);
4181
+ }
4182
+ continue;
4183
+ }
4184
+ if (agentId === "openclaw") {
4185
+ const entries = config.plugins?.entries;
4186
+ if (entries?.agentapprove) {
4187
+ console.log(` ${source_default.green("✓")} ${agent.name}: agentapprove plugin`);
4188
+ }
4189
+ continue;
4190
+ }
4174
4191
  const hooksConfig = config[agent.hooksKey];
4175
4192
  if (hooksConfig) {
4176
4193
  const installedHooks = agent.hooks.filter((h2) => {
@@ -4236,13 +4253,17 @@ async function uninstallCommand() {
4236
4253
  continue;
4237
4254
  const config = readJsonConfig(agent.configPath);
4238
4255
  const hooksConfig = config[agent.hooksKey];
4239
- if (!hooksConfig)
4256
+ if (!hooksConfig && agentId !== "opencode")
4240
4257
  continue;
4241
4258
  let modified = false;
4242
4259
  if (agentId === "opencode") {
4243
4260
  const pluginArray = config.plugin;
4244
4261
  if (Array.isArray(pluginArray)) {
4245
- const filtered = pluginArray.filter((p) => !p.includes("agentapprove"));
4262
+ const filtered = pluginArray.filter((p) => {
4263
+ if (typeof p !== "string")
4264
+ return true;
4265
+ return !p.includes("agentapprove");
4266
+ });
4246
4267
  if (filtered.length !== pluginArray.length) {
4247
4268
  config.plugin = filtered;
4248
4269
  modified = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentapprove",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Approve AI agent actions from your iPhone or Apple Watch",
5
5
  "type": "module",
6
6
  "bin": {