approval-box 0.1.28 → 0.1.29

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.mjs +20 -11
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -11816,7 +11816,7 @@ var require_dist = __commonJS({
11816
11816
 
11817
11817
  // src/cli.ts
11818
11818
  var import_qrcode = __toESM(require_lib(), 1);
11819
- import { cpSync, existsSync as existsSync7, mkdirSync as mkdirSync5, rmSync as rmSync3 } from "node:fs";
11819
+ import { cpSync, existsSync as existsSync7, mkdirSync as mkdirSync5, rmSync as rmSync4 } from "node:fs";
11820
11820
  import { hostname } from "node:os";
11821
11821
  import { join as join10 } from "node:path";
11822
11822
  import { createInterface } from "node:readline/promises";
@@ -11914,7 +11914,7 @@ var Api = class {
11914
11914
  };
11915
11915
 
11916
11916
  // src/config.ts
11917
- import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
11917
+ import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
11918
11918
  import { dirname, join } from "node:path";
11919
11919
  var OFFICIAL_SERVER = "https://approval-box.kitepon.dev";
11920
11920
  var configFile = () => join(home(), "config.json");
@@ -11930,9 +11930,18 @@ function requireConfig() {
11930
11930
  function writeJsonFile(file, value) {
11931
11931
  mkdirSync(dirname(file), { recursive: true, mode: 448 });
11932
11932
  const temp = `${file}.${process.pid}.tmp`;
11933
- writeFileSync(temp, `${JSON.stringify(value, null, 2)}
11933
+ try {
11934
+ writeFileSync(temp, `${JSON.stringify(value, null, 2)}
11934
11935
  `, { mode: 384 });
11935
- renameSync(temp, file);
11936
+ renameSync(temp, file);
11937
+ } catch (error) {
11938
+ try {
11939
+ rmSync(temp, { force: true });
11940
+ } catch {
11941
+ process.stderr.write("approval-box: \u4FDD\u5B58\u306B\u5931\u6557\u3057\u305F\u4E00\u6642\u30D5\u30A1\u30A4\u30EB\u3092\u56DE\u53CE\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\n");
11942
+ }
11943
+ throw error;
11944
+ }
11936
11945
  }
11937
11946
  function writeConfig(config) {
11938
11947
  writeJsonFile(configFile(), config);
@@ -12022,12 +12031,12 @@ async function channelAnswerState(channelId, deliveryId, codex = provider) {
12022
12031
  }
12023
12032
 
12024
12033
  // src/daemon.ts
12025
- import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync3, rmSync as rmSync2 } from "node:fs";
12034
+ import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync3, rmSync as rmSync3 } from "node:fs";
12026
12035
  import { join as join5 } from "node:path";
12027
12036
 
12028
12037
  // src/attachments.ts
12029
12038
  import { createHash } from "node:crypto";
12030
- import { existsSync as existsSync2, mkdirSync as mkdirSync2, readdirSync, readFileSync as readFileSync2, rmSync, statSync, writeFileSync as writeFileSync3 } from "node:fs";
12039
+ import { existsSync as existsSync2, mkdirSync as mkdirSync2, readdirSync, readFileSync as readFileSync2, rmSync as rmSync2, statSync, writeFileSync as writeFileSync3 } from "node:fs";
12031
12040
  import { join as join3 } from "node:path";
12032
12041
  var KEEP_DAYS = 30;
12033
12042
  var attachmentsRoot = () => join3(home(), "attachments");
@@ -12063,7 +12072,7 @@ function pruneAttachments() {
12063
12072
  for (const name of readdirSync(root)) {
12064
12073
  const dir = join3(root, name);
12065
12074
  try {
12066
- if (statSync(dir).mtimeMs < before) rmSync(dir, { recursive: true, force: true });
12075
+ if (statSync(dir).mtimeMs < before) rmSync2(dir, { recursive: true, force: true });
12067
12076
  } catch {
12068
12077
  }
12069
12078
  }
@@ -12265,7 +12274,7 @@ async function runDaemon() {
12265
12274
  const releaseLock = () => {
12266
12275
  try {
12267
12276
  const lock = JSON.parse(readFileSync3(lockFile(), "utf8"));
12268
- if (lock.pid === process.pid) rmSync2(lockFile(), { force: true });
12277
+ if (lock.pid === process.pid) rmSync3(lockFile(), { force: true });
12269
12278
  } catch {
12270
12279
  }
12271
12280
  };
@@ -16017,7 +16026,7 @@ function claudeChannelIsCurrent(profile, channelId, parent) {
16017
16026
  }
16018
16027
 
16019
16028
  // src/version.ts
16020
- var VERSION = true ? "0.1.28" : "0.0.0-dev";
16029
+ var VERSION = true ? "0.1.29" : "0.0.0-dev";
16021
16030
  function osName() {
16022
16031
  return process.platform === "darwin" ? "macos" : process.platform === "win32" ? "windows" : process.platform;
16023
16032
  }
@@ -16407,7 +16416,7 @@ async function ask(question) {
16407
16416
  function installRuntime() {
16408
16417
  const target = join10(home(), "runtime", VERSION);
16409
16418
  if (runtimeDir() !== target) {
16410
- rmSync3(target, { recursive: true, force: true });
16419
+ rmSync4(target, { recursive: true, force: true });
16411
16420
  mkdirSync5(target, { recursive: true });
16412
16421
  cpSync(runtimeDir(), target, { recursive: true });
16413
16422
  }
@@ -16556,7 +16565,7 @@ async function uninstall() {
16556
16565
  out(` \u30B5\u30FC\u30D0\u30FC: \u63A5\u7D9A\u306E\u89E3\u9664\u306B\u5931\u6557\u3057\u307E\u3057\u305F\uFF08\u30A2\u30D7\u30EA\u306E\u300C\u63A5\u7D9A\u300D\u304B\u3089\u5916\u3057\u3066\u304F\u3060\u3055\u3044\uFF09: ${error.message}`);
16557
16566
  }
16558
16567
  }
16559
- rmSync3(join10(home(), "config.json"), { force: true });
16568
+ rmSync4(join10(home(), "config.json"), { force: true });
16560
16569
  out("\nApproval Box\u3092\u5916\u3057\u307E\u3057\u305F\u3002npm install -g \u3067\u5165\u308C\u305F\u5834\u5408\u306F\u3001npm uninstall -g approval-box \u3067\u672C\u4F53\u3082\u6D88\u305B\u307E\u3059\u3002");
16561
16570
  }
16562
16571
  async function status() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "approval-box",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "description": "Approval Box connector: lets Claude Code, Codex, Cursor and Grok ask you for a decision, and steers your answer back into the same session.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://approval-box.kitepon.dev",