bx-mac 1.0.0 → 1.0.2

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 +8 -0
  2. package/dist/bx.js +16 -16
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -376,6 +376,14 @@ These are great when available, but they only protect within their own tool. bx
376
376
 
377
377
  - [Agent Safehouse](https://agent-safehouse.dev/) — macOS kernel-level sandboxing for LLM coding agents via `sandbox-exec`. Deny-first model that blocks write access outside the project directory.
378
378
 
379
+ ## 💛 Sponsor
380
+
381
+ If you find bx useful, consider supporting its development:
382
+
383
+ [GitHub Sponsors](https://github.com/sponsors/holtwick) - [Liberapay](https://liberapay.com/holtwick) - [Buy Me a Coffee](https://buymeacoffee.com/holtwick) - [Patreon](https://patreon.com/holtwick) - [Open Collective](https://opencollective.com/holtwick)
384
+
385
+ Also check out my other projects: [Receipts](https://receipts-app.com) - [PDFify](https://pdfify.app)
386
+
379
387
  ## 📄 License
380
388
 
381
389
  MIT — see [LICENSE](LICENSE).
package/dist/bx.js CHANGED
@@ -3,8 +3,8 @@ import { accessSync, constants, cpSync, existsSync, globSync, mkdirSync, mkdtemp
3
3
  import { basename, dirname, join, resolve } from "node:path";
4
4
  import { execFileSync, spawn } from "node:child_process";
5
5
  import { createInterface } from "node:readline";
6
- import { fileURLToPath } from "node:url";
7
6
  import process$1 from "node:process";
7
+ import { fileURLToPath } from "node:url";
8
8
  //#region node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/error.js
9
9
  /*!
10
10
  * Copyright (c) Squirrel Chat et al., All rights reserved.
@@ -1219,17 +1219,22 @@ async function checkAppAlreadyRunning(mode, apps) {
1219
1219
  if (BUILTIN_MODES.includes(mode)) return;
1220
1220
  const app = apps[mode];
1221
1221
  if (!app?.bundle) return;
1222
- let running = false;
1222
+ let appName = mode;
1223
1223
  try {
1224
- running = execFileSync("lsappinfo", ["list"], {
1224
+ const list = execFileSync("lsappinfo", ["list"], {
1225
1225
  encoding: "utf-8",
1226
1226
  timeout: 3e3
1227
- }).includes(`bundleID="${app.bundle}"`);
1227
+ });
1228
+ if (!list.includes(`bundleID="${app.bundle}"`)) return;
1229
+ const idx = list.indexOf(`bundleID="${app.bundle}"`);
1230
+ const bundleLine = list.lastIndexOf("\n", idx);
1231
+ const prevLine = list.lastIndexOf("\n", bundleLine - 1);
1232
+ const nameMatch = list.slice(prevLine === -1 ? 0 : prevLine, bundleLine).match(/"([^"]+)"/);
1233
+ if (nameMatch) appName = nameMatch[1];
1228
1234
  } catch {
1229
1235
  return;
1230
1236
  }
1231
- if (!running) return;
1232
- console.error(`\n${fmt.warn(`"${mode}" is already running`)}`);
1237
+ console.error(`\n${fmt.warn(`"${appName}" is already running`)}`);
1233
1238
  console.error(fmt.detail("the workspace will open in the EXISTING instance — sandbox will NOT apply"));
1234
1239
  if (mode === "code") console.error(fmt.detail("quit the app first, or use --profile-sandbox for an isolated instance"));
1235
1240
  else console.error(fmt.detail("quit the app first to ensure sandbox protection"));
@@ -1238,7 +1243,7 @@ async function checkAppAlreadyRunning(mode, apps) {
1238
1243
  output: process$1.stderr
1239
1244
  });
1240
1245
  const answer = await new Promise((res) => {
1241
- rl.question(` continue without sandbox? [y/N] `, res);
1246
+ rl.question(` continue with existing instance? [y/N]`, res);
1242
1247
  });
1243
1248
  rl.close();
1244
1249
  if (!answer.match(/^y(es)?$/i)) process$1.exit(0);
@@ -1573,12 +1578,9 @@ function printDryRunTree({ home, blockedDirs, ignoredPaths, readOnlyDirs, workDi
1573
1578
  console.log(`\n${RED}✖${RESET} = denied ${YELLOW}◉${RESET} = read-only ${GREEN}✔${RESET} = read-write\n`);
1574
1579
  }
1575
1580
  //#endregion
1576
- //#region package.json
1577
- var version = "1.0.0";
1578
- //#endregion
1579
1581
  //#region src/index.ts
1582
+ const VERSION = "1.0.2";
1580
1583
  const __dirname = dirname(fileURLToPath(import.meta.url));
1581
- const VERSION = version;
1582
1584
  if (process$1.argv.includes("--version") || process$1.argv.includes("-v")) {
1583
1585
  console.log(`bx ${VERSION}`);
1584
1586
  process$1.exit(0);
@@ -1593,6 +1595,8 @@ if (!process$1.env.HOME) {
1593
1595
  }
1594
1596
  const HOME = process$1.env.HOME;
1595
1597
  async function main() {
1598
+ checkOwnSandbox();
1599
+ checkExternalSandbox();
1596
1600
  const apps = getAvailableApps(loadConfig(HOME));
1597
1601
  const { mode, workArgs, verbose, dry, profileSandbox, background: backgroundFlag, appArgs, implicit } = parseArgs(getValidModes(apps));
1598
1602
  const app = apps[mode];
@@ -1608,11 +1612,7 @@ async function main() {
1608
1612
  }
1609
1613
  if (!dry) await confirmLaunch(workDirs[0], mode);
1610
1614
  }
1611
- if (!dry) {
1612
- checkOwnSandbox();
1613
- checkVSCodeTerminal();
1614
- checkExternalSandbox();
1615
- }
1615
+ if (!dry) checkVSCodeTerminal();
1616
1616
  checkWorkDirs(workDirs, HOME);
1617
1617
  await checkAppAlreadyRunning(mode, apps);
1618
1618
  if (mode === "code" && profileSandbox) setupVSCodeProfile(HOME);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bx-mac",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Sandbox any macOS app — only your project directory stays accessible",
5
5
  "type": "module",
6
6
  "bin": {