supbuddy 3.0.1 → 3.0.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.
package/dist/bin.js CHANGED
@@ -9251,11 +9251,11 @@ var require_mime_types = __commonJS({
9251
9251
  }
9252
9252
  return exts[0];
9253
9253
  }
9254
- function lookup(path11) {
9255
- if (!path11 || typeof path11 !== "string") {
9254
+ function lookup(path12) {
9255
+ if (!path12 || typeof path12 !== "string") {
9256
9256
  return false;
9257
9257
  }
9258
- var extension2 = extname("x." + path11).toLowerCase().substr(1);
9258
+ var extension2 = extname("x." + path12).toLowerCase().substr(1);
9259
9259
  if (!extension2) {
9260
9260
  return false;
9261
9261
  }
@@ -12630,11 +12630,11 @@ var require_server = __commonJS({
12630
12630
  * @protected
12631
12631
  */
12632
12632
  _computePath(options) {
12633
- let path11 = (options.path || "/engine.io").replace(/\/$/, "");
12633
+ let path12 = (options.path || "/engine.io").replace(/\/$/, "");
12634
12634
  if (options.addTrailingSlash !== false) {
12635
- path11 += "/";
12635
+ path12 += "/";
12636
12636
  }
12637
- return path11;
12637
+ return path12;
12638
12638
  }
12639
12639
  /**
12640
12640
  * Returns a list of available transports for upgrade given a certain transport.
@@ -13133,10 +13133,10 @@ var require_server = __commonJS({
13133
13133
  * @param {Object} options
13134
13134
  */
13135
13135
  attach(server, options = {}) {
13136
- const path11 = this._computePath(options);
13136
+ const path12 = this._computePath(options);
13137
13137
  const destroyUpgradeTimeout = options.destroyUpgradeTimeout || 1e3;
13138
13138
  function check(req) {
13139
- return path11 === req.url.slice(0, path11.length);
13139
+ return path12 === req.url.slice(0, path12.length);
13140
13140
  }
13141
13141
  const listeners = server.listeners("request").slice(0);
13142
13142
  server.removeAllListeners("request");
@@ -13144,7 +13144,7 @@ var require_server = __commonJS({
13144
13144
  server.on("listening", this.init.bind(this));
13145
13145
  server.on("request", (req, res) => {
13146
13146
  if (check(req)) {
13147
- debug('intercepting request for path "%s"', path11);
13147
+ debug('intercepting request for path "%s"', path12);
13148
13148
  this.handleRequest(req, res);
13149
13149
  } else {
13150
13150
  let i = 0;
@@ -13983,8 +13983,8 @@ var require_userver = __commonJS({
13983
13983
  * @param options
13984
13984
  */
13985
13985
  attach(app, options = {}) {
13986
- const path11 = this._computePath(options);
13987
- app.any(path11, this.handleRequest.bind(this)).ws(path11, {
13986
+ const path12 = this._computePath(options);
13987
+ app.any(path12, this.handleRequest.bind(this)).ws(path12, {
13988
13988
  compression: options.compression,
13989
13989
  idleTimeout: options.idleTimeout,
13990
13990
  maxBackpressure: options.maxBackpressure,
@@ -18397,7 +18397,7 @@ var require_dist2 = __commonJS({
18397
18397
  var zlib_1 = __require("zlib");
18398
18398
  var accepts = require_accepts();
18399
18399
  var stream_1 = __require("stream");
18400
- var path11 = __require("path");
18400
+ var path12 = __require("path");
18401
18401
  var engine_io_1 = require_engine_io();
18402
18402
  var client_1 = require_client();
18403
18403
  var events_1 = __require("events");
@@ -18592,7 +18592,7 @@ var require_dist2 = __commonJS({
18592
18592
  res.writeHeader("cache-control", "public, max-age=0");
18593
18593
  res.writeHeader("content-type", "application/" + (isMap ? "json" : "javascript") + "; charset=utf-8");
18594
18594
  res.writeHeader("etag", expectedEtag);
18595
- const filepath = path11.join(__dirname, "../client-dist/", filename);
18595
+ const filepath = path12.join(__dirname, "../client-dist/", filename);
18596
18596
  (0, uws_1.serveFile)(res, filepath);
18597
18597
  });
18598
18598
  }
@@ -18674,7 +18674,7 @@ var require_dist2 = __commonJS({
18674
18674
  * @private
18675
18675
  */
18676
18676
  static sendFile(filename, req, res) {
18677
- const readStream = (0, fs_1.createReadStream)(path11.join(__dirname, "../client-dist/", filename));
18677
+ const readStream = (0, fs_1.createReadStream)(path12.join(__dirname, "../client-dist/", filename));
18678
18678
  const encoding = accepts(req).encodings(["br", "gzip", "deflate"]);
18679
18679
  const onError = (err) => {
18680
18680
  if (err) {
@@ -19599,6 +19599,36 @@ var init_state_dir = __esm({
19599
19599
  }
19600
19600
  });
19601
19601
 
19602
+ // src/caddy-resolve.ts
19603
+ import { createRequire } from "module";
19604
+ import path4 from "path";
19605
+ function caddyPackageName(platform = process.platform, arch = process.arch) {
19606
+ if (platform === "darwin") {
19607
+ return arch === "arm64" ? "@supbuddy/caddy-darwin-arm64" : "@supbuddy/caddy-darwin-amd64";
19608
+ }
19609
+ if (platform === "linux") {
19610
+ return arch === "arm64" ? "@supbuddy/caddy-linux-arm64" : "@supbuddy/caddy-linux-amd64";
19611
+ }
19612
+ return null;
19613
+ }
19614
+ function resolvePackagedCaddyDir(deps = {}) {
19615
+ const pkgName = deps.pkgName !== void 0 ? deps.pkgName : caddyPackageName();
19616
+ if (!pkgName) return null;
19617
+ const resolve = deps.resolve ?? ((id) => requireFromHere.resolve(id));
19618
+ try {
19619
+ return path4.dirname(resolve(`${pkgName}/package.json`));
19620
+ } catch {
19621
+ return null;
19622
+ }
19623
+ }
19624
+ var requireFromHere;
19625
+ var init_caddy_resolve = __esm({
19626
+ "src/caddy-resolve.ts"() {
19627
+ "use strict";
19628
+ requireFromHere = createRequire(import.meta.url);
19629
+ }
19630
+ });
19631
+
19602
19632
  // ../../packages/shared/types/isolation.ts
19603
19633
  var init_isolation = __esm({
19604
19634
  "../../packages/shared/types/isolation.ts"() {
@@ -20281,8 +20311,8 @@ var init_parseUtil = __esm({
20281
20311
  init_errors();
20282
20312
  init_en();
20283
20313
  makeIssue = (params) => {
20284
- const { data, path: path11, errorMaps, issueData } = params;
20285
- const fullPath = [...path11, ...issueData.path || []];
20314
+ const { data, path: path12, errorMaps, issueData } = params;
20315
+ const fullPath = [...path12, ...issueData.path || []];
20286
20316
  const fullIssue = {
20287
20317
  ...issueData,
20288
20318
  path: fullPath
@@ -20593,11 +20623,11 @@ var init_types2 = __esm({
20593
20623
  init_parseUtil();
20594
20624
  init_util();
20595
20625
  ParseInputLazyPath = class {
20596
- constructor(parent, value, path11, key) {
20626
+ constructor(parent, value, path12, key) {
20597
20627
  this._cachedPath = [];
20598
20628
  this.parent = parent;
20599
20629
  this.data = value;
20600
- this._path = path11;
20630
+ this._path = path12;
20601
20631
  this._key = key;
20602
20632
  }
20603
20633
  get path() {
@@ -24770,7 +24800,7 @@ var init_shared = __esm({
24770
24800
  import { spawn as spawn2 } from "child_process";
24771
24801
  import { fileURLToPath } from "url";
24772
24802
  import fs4 from "fs";
24773
- import path4 from "path";
24803
+ import path5 from "path";
24774
24804
  function resolveWorkerEntry(deps = {}) {
24775
24805
  const binDir = deps.binDir ?? __dirname2;
24776
24806
  const repoRoot = deps.repoRoot ?? REPO_ROOT;
@@ -24778,27 +24808,32 @@ function resolveWorkerEntry(deps = {}) {
24778
24808
  const exists = deps.exists ?? fs4.existsSync;
24779
24809
  const bundle = env2.SUPBUDDY_WORKER_BUNDLE;
24780
24810
  if (bundle) {
24781
- return { cmd: process.execPath, args: [bundle], workerEntry: bundle, cwd: path4.dirname(bundle) };
24811
+ return { cmd: process.execPath, args: [bundle], workerEntry: bundle, cwd: path5.dirname(bundle), mode: "host" };
24782
24812
  }
24783
- const pkgWorker = path4.join(binDir, "daemon", "worker.cjs");
24813
+ const pkgWorker = path5.join(binDir, "daemon", "worker.cjs");
24784
24814
  if (exists(pkgWorker)) {
24785
- return { cmd: process.execPath, args: [pkgWorker], workerEntry: pkgWorker, cwd: path4.dirname(pkgWorker) };
24815
+ return { cmd: process.execPath, args: [pkgWorker], workerEntry: pkgWorker, cwd: path5.dirname(pkgWorker), mode: "npm" };
24786
24816
  }
24787
- const bootstrap = path4.join(repoRoot, "apps", "cli", "src", "worker-bootstrap.ts");
24817
+ const bootstrap = path5.join(repoRoot, "apps", "cli", "src", "worker-bootstrap.ts");
24788
24818
  if (exists(bootstrap)) {
24789
- const workerEntry = path4.join(repoRoot, "packages", "core", "index.ts");
24790
- return { cmd: process.execPath, args: ["--import", "tsx", bootstrap], workerEntry, cwd: repoRoot };
24819
+ const workerEntry = path5.join(repoRoot, "packages", "core", "index.ts");
24820
+ return { cmd: process.execPath, args: ["--import", "tsx", bootstrap], workerEntry, cwd: repoRoot, mode: "dev" };
24791
24821
  }
24792
24822
  throw new WorkerUnavailableError();
24793
24823
  }
24794
24824
  async function startDaemon(opts = {}) {
24795
24825
  const { stateDir, workerPort, assumeYes, quiet } = opts;
24796
24826
  const effectiveStateDir = stateDir ?? defaultStateDir();
24797
- const { cmd, args, workerEntry, cwd } = resolveWorkerEntry();
24827
+ const { cmd, args, workerEntry, cwd, mode } = resolveWorkerEntry();
24798
24828
  const env2 = { ...process.env, NODE_ENV: process.env.NODE_ENV ?? "development" };
24799
24829
  env2.SUPBUDDY_WORKER_ENTRY = workerEntry;
24800
24830
  env2.SUPBUDDY_STATE_DIR = effectiveStateDir;
24801
24831
  if (workerPort) env2.WORKER_PORT = String(workerPort);
24832
+ if (mode === "npm" && !env2.SUPBUDDY_BIN_DIR) {
24833
+ const caddyDir = resolvePackagedCaddyDir();
24834
+ if (!caddyDir) throw new CaddyUnavailableError();
24835
+ env2.SUPBUDDY_BIN_DIR = caddyDir;
24836
+ }
24802
24837
  const child = spawn2(cmd, args, { stdio: ["ignore", "pipe", "pipe", "ipc"], env: env2, cwd });
24803
24838
  const startedAt = (/* @__PURE__ */ new Date()).toISOString();
24804
24839
  const baseSocketPort = workerPort ?? DEFAULT_WORKER_PORT;
@@ -24950,7 +24985,7 @@ async function runDaemonDetached(opts = {}) {
24950
24985
  }
24951
24986
  const entry = process.argv[1];
24952
24987
  const isTsEntry = entry.endsWith(".ts");
24953
- const execPath = isTsEntry ? path4.join(REPO_ROOT, "node_modules", ".bin", "tsx") : process.execPath;
24988
+ const execPath = isTsEntry ? path5.join(REPO_ROOT, "node_modules", ".bin", "tsx") : process.execPath;
24954
24989
  const args = [entry, "daemon"];
24955
24990
  if (opts.stateDir) args.push(`--state-dir=${opts.stateDir}`);
24956
24991
  if (opts.workerPort) args.push(`--worker-port=${opts.workerPort}`);
@@ -24967,7 +25002,7 @@ async function runDaemonDetached(opts = {}) {
24967
25002
  console.error("[daemon] detached start did not produce daemon.json in time");
24968
25003
  return 1;
24969
25004
  }
24970
- var __dirname2, REPO_ROOT, WorkerUnavailableError;
25005
+ var __dirname2, REPO_ROOT, WorkerUnavailableError, CaddyUnavailableError;
24971
25006
  var init_daemon = __esm({
24972
25007
  "src/daemon.ts"() {
24973
25008
  "use strict";
@@ -24977,9 +25012,10 @@ var init_daemon = __esm({
24977
25012
  init_relay_server();
24978
25013
  init_network_monitor();
24979
25014
  init_state_dir();
25015
+ init_caddy_resolve();
24980
25016
  init_shared();
24981
- __dirname2 = path4.dirname(fileURLToPath(import.meta.url));
24982
- REPO_ROOT = path4.resolve(__dirname2, "..", "..", "..");
25017
+ __dirname2 = path5.dirname(fileURLToPath(import.meta.url));
25018
+ REPO_ROOT = path5.resolve(__dirname2, "..", "..", "..");
24983
25019
  WorkerUnavailableError = class extends Error {
24984
25020
  constructor() {
24985
25021
  super(
@@ -24988,6 +25024,17 @@ var init_daemon = __esm({
24988
25024
  this.name = "WorkerUnavailableError";
24989
25025
  }
24990
25026
  };
25027
+ CaddyUnavailableError = class extends Error {
25028
+ constructor() {
25029
+ const pkg = caddyPackageName();
25030
+ super(
25031
+ pkg ? `The standalone daemon needs its bundled Caddy (${pkg}), which is not installed.
25032
+ Reinstall the CLI so npm can fetch it: npm install -g supbuddy
25033
+ (if your npm skipped optional dependencies, run it without --no-optional).` : `The standalone daemon has no bundled Caddy for your platform yet (${process.platform}/${process.arch}). Install the Supbuddy desktop app, or run from a source checkout.`
25034
+ );
25035
+ this.name = "CaddyUnavailableError";
25036
+ }
25037
+ };
24991
25038
  }
24992
25039
  });
24993
25040
 
@@ -25756,10 +25803,10 @@ __export(install_exports, {
25756
25803
  });
25757
25804
  import { spawnSync } from "child_process";
25758
25805
  import readline2 from "readline";
25759
- import path5 from "path";
25806
+ import path6 from "path";
25760
25807
  function isEphemeralNpx() {
25761
25808
  const argv1 = process.argv[1] || "";
25762
- if (argv1.includes(`${path5.sep}_npx${path5.sep}`) || argv1.includes("/_npx/")) return true;
25809
+ if (argv1.includes(`${path6.sep}_npx${path6.sep}`) || argv1.includes("/_npx/")) return true;
25763
25810
  if (process.env.npm_command === "exec") return true;
25764
25811
  return false;
25765
25812
  }
@@ -25834,7 +25881,7 @@ import net from "net";
25834
25881
  import http from "http";
25835
25882
  import fs5 from "fs/promises";
25836
25883
  import os4 from "os";
25837
- import path6 from "path";
25884
+ import path7 from "path";
25838
25885
  function getFreePort() {
25839
25886
  return new Promise((resolve, reject) => {
25840
25887
  const srv = net.createServer();
@@ -25918,7 +25965,7 @@ async function main() {
25918
25965
  const workerPort = await getFreePort();
25919
25966
  let mcpPort = await getFreePort();
25920
25967
  if (mcpPort === workerPort) mcpPort = await getFreePort();
25921
- const stateDir = await fs5.mkdtemp(path6.join(os4.tmpdir(), "supbuddy-selftest-"));
25968
+ const stateDir = await fs5.mkdtemp(path7.join(os4.tmpdir(), "supbuddy-selftest-"));
25922
25969
  const seed = {
25923
25970
  projects: [],
25924
25971
  mappings: [],
@@ -25928,7 +25975,7 @@ async function main() {
25928
25975
  mcp: { enabled: true, port: mcpPort, audit_cap: 5e3, trash_ttl_days: 7 }
25929
25976
  }
25930
25977
  };
25931
- await fs5.writeFile(path6.join(stateDir, "state.json"), JSON.stringify(seed, null, 2));
25978
+ await fs5.writeFile(path7.join(stateDir, "state.json"), JSON.stringify(seed, null, 2));
25932
25979
  console.log(`isolated state dir: ${stateDir}`);
25933
25980
  console.log(`worker (Socket.IO) port: ${workerPort} MCP port: ${mcpPort}
25934
25981
  `);
@@ -25980,7 +26027,7 @@ import https from "https";
25980
26027
  import fs6 from "fs/promises";
25981
26028
  import { createWriteStream } from "fs";
25982
26029
  import os5 from "os";
25983
- import path7 from "path";
26030
+ import path8 from "path";
25984
26031
  import crypto from "crypto";
25985
26032
  import readline3 from "readline";
25986
26033
  import { execFile, execFileSync as execFileSync2, spawn as spawn3 } from "child_process";
@@ -26106,7 +26153,7 @@ function sq(p) {
26106
26153
  return `'${p.replace(/'/g, "'\\''")}'`;
26107
26154
  }
26108
26155
  async function swapApp(newApp) {
26109
- const dir = path7.dirname(INSTALLED_APP);
26156
+ const dir = path8.dirname(INSTALLED_APP);
26110
26157
  if (await canWrite(dir)) {
26111
26158
  const bak = `${INSTALLED_APP}.bak-${process.pid}`;
26112
26159
  if (await fs6.stat(INSTALLED_APP).then(() => true).catch(() => false)) {
@@ -26181,10 +26228,10 @@ supbuddy update: could not reach the release server \u2014 ${e.message}`);
26181
26228
  return 0;
26182
26229
  }
26183
26230
  }
26184
- const tmp = await fs6.mkdtemp(path7.join(os5.tmpdir(), "supbuddy-update-"));
26185
- const tar = path7.join(tmp, TAR_ASSET);
26186
- const shaFile = path7.join(tmp, SHA_ASSET);
26187
- const extractDir = path7.join(tmp, "extracted");
26231
+ const tmp = await fs6.mkdtemp(path8.join(os5.tmpdir(), "supbuddy-update-"));
26232
+ const tar = path8.join(tmp, TAR_ASSET);
26233
+ const shaFile = path8.join(tmp, SHA_ASSET);
26234
+ const extractDir = path8.join(tmp, "extracted");
26188
26235
  try {
26189
26236
  console.log("Downloading\u2026");
26190
26237
  await downloadAsset(pick.tarUrl, tar);
@@ -26198,7 +26245,7 @@ supbuddy update: could not reach the release server \u2014 ${e.message}`);
26198
26245
  }
26199
26246
  await fs6.mkdir(extractDir, { recursive: true });
26200
26247
  execFileSync2("tar", ["-xzf", tar, "-C", extractDir]);
26201
- const newApp = path7.join(extractDir, "Supbuddy.app");
26248
+ const newApp = path8.join(extractDir, "Supbuddy.app");
26202
26249
  if (!await fs6.stat(newApp).then(() => true).catch(() => false)) {
26203
26250
  console.error("supbuddy update: the archive did not contain Supbuddy.app.");
26204
26251
  return 1;
@@ -26321,11 +26368,11 @@ __export(run_exports, {
26321
26368
  });
26322
26369
  import { spawn as spawn4, execSync } from "child_process";
26323
26370
  import fs7 from "fs";
26324
- import path8 from "path";
26371
+ import path9 from "path";
26325
26372
  function readMetaLoopbackIp(startDir) {
26326
26373
  let dir = startDir;
26327
26374
  for (; ; ) {
26328
- const metaPath = path8.join(dir, ".supbuddy", "meta.json");
26375
+ const metaPath = path9.join(dir, ".supbuddy", "meta.json");
26329
26376
  if (fs7.existsSync(metaPath)) {
26330
26377
  try {
26331
26378
  return JSON.parse(fs7.readFileSync(metaPath, "utf-8")).loopbackIp;
@@ -26333,7 +26380,7 @@ function readMetaLoopbackIp(startDir) {
26333
26380
  return void 0;
26334
26381
  }
26335
26382
  }
26336
- const parent = path8.dirname(dir);
26383
+ const parent = path9.dirname(dir);
26337
26384
  if (parent === dir) return void 0;
26338
26385
  dir = parent;
26339
26386
  }
@@ -26413,7 +26460,7 @@ __export(service_exports, {
26413
26460
  });
26414
26461
  import fs8 from "fs/promises";
26415
26462
  import os6 from "os";
26416
- import path9 from "path";
26463
+ import path10 from "path";
26417
26464
  import { fileURLToPath as fileURLToPath2 } from "url";
26418
26465
  import { spawnSync as spawnSync2 } from "child_process";
26419
26466
  function launchdPlist(o) {
@@ -26436,9 +26483,9 @@ function launchdPlist(o) {
26436
26483
  <key>KeepAlive</key>
26437
26484
  <true/>
26438
26485
  <key>StandardOutPath</key>
26439
- <string>${path9.join(o.logDir, "daemon.log")}</string>
26486
+ <string>${path10.join(o.logDir, "daemon.log")}</string>
26440
26487
  <key>StandardErrorPath</key>
26441
- <string>${path9.join(o.logDir, "daemon-error.log")}</string>
26488
+ <string>${path10.join(o.logDir, "daemon-error.log")}</string>
26442
26489
  </dict>
26443
26490
  </plist>
26444
26491
  `;
@@ -26458,16 +26505,16 @@ WantedBy=default.target
26458
26505
  `;
26459
26506
  }
26460
26507
  function launchdPlistPath() {
26461
- return path9.join(os6.homedir(), "Library", "LaunchAgents", `${LAUNCHD_LABEL}.plist`);
26508
+ return path10.join(os6.homedir(), "Library", "LaunchAgents", `${LAUNCHD_LABEL}.plist`);
26462
26509
  }
26463
26510
  function systemdUnitPath() {
26464
- const configHome = process.env.XDG_CONFIG_HOME ?? path9.join(os6.homedir(), ".config");
26465
- return path9.join(configHome, "systemd", "user", SYSTEMD_SERVICE);
26511
+ const configHome = process.env.XDG_CONFIG_HOME ?? path10.join(os6.homedir(), ".config");
26512
+ return path10.join(configHome, "systemd", "user", SYSTEMD_SERVICE);
26466
26513
  }
26467
26514
  function resolveBinPath() {
26468
- const __dirname3 = path9.dirname(fileURLToPath2(import.meta.url));
26469
- const repoRoot = path9.resolve(__dirname3, "..", "..", "..");
26470
- return path9.join(repoRoot, "apps", "cli", "dist", "bin.js");
26515
+ const __dirname3 = path10.dirname(fileURLToPath2(import.meta.url));
26516
+ const repoRoot = path10.resolve(__dirname3, "..", "..", "..");
26517
+ return path10.join(repoRoot, "apps", "cli", "dist", "bin.js");
26471
26518
  }
26472
26519
  async function installService(opts = {}, run = defaultRunner) {
26473
26520
  const platform = process.platform;
@@ -26487,11 +26534,11 @@ Run \`yarn workspace supbuddy build\` first.`
26487
26534
  return 1;
26488
26535
  }
26489
26536
  const stateDir = opts.stateDir ?? defaultStateDir();
26490
- const logDir = path9.join(stateDir, "logs");
26537
+ const logDir = path10.join(stateDir, "logs");
26491
26538
  await fs8.mkdir(logDir, { recursive: true });
26492
26539
  if (platform === "darwin") {
26493
26540
  const plistPath = launchdPlistPath();
26494
- await fs8.mkdir(path9.dirname(plistPath), { recursive: true });
26541
+ await fs8.mkdir(path10.dirname(plistPath), { recursive: true });
26495
26542
  const content2 = launchdPlist({ label: LAUNCHD_LABEL, nodePath, binPath, stateDir, logDir });
26496
26543
  await fs8.writeFile(plistPath, content2, { encoding: "utf8", mode: 420 });
26497
26544
  run("launchctl", ["unload", plistPath]);
@@ -26504,7 +26551,7 @@ Run \`yarn workspace supbuddy build\` first.`
26504
26551
  return 0;
26505
26552
  }
26506
26553
  const unitPath = systemdUnitPath();
26507
- await fs8.mkdir(path9.dirname(unitPath), { recursive: true });
26554
+ await fs8.mkdir(path10.dirname(unitPath), { recursive: true });
26508
26555
  const content = systemdUnit({ label: LAUNCHD_LABEL, nodePath, binPath, stateDir, logDir });
26509
26556
  await fs8.writeFile(unitPath, content, { encoding: "utf8", mode: 420 });
26510
26557
  const reload = run("systemctl", ["--user", "daemon-reload"]);
@@ -26620,7 +26667,7 @@ init_state_dir();
26620
26667
  import { realpathSync } from "fs";
26621
26668
  import { spawnSync as spawnSync3 } from "child_process";
26622
26669
  import { fileURLToPath as fileURLToPath3 } from "url";
26623
- import path10 from "path";
26670
+ import path11 from "path";
26624
26671
 
26625
26672
  // src/commands.ts
26626
26673
  init_client();
@@ -27660,12 +27707,12 @@ async function runCommand(argv, flags, clientFactory) {
27660
27707
  return 0;
27661
27708
  }
27662
27709
  if (sub === "env-read") {
27663
- const path11 = rest[0];
27664
- if (!path11) {
27710
+ const path12 = rest[0];
27711
+ if (!path12) {
27665
27712
  console.error("usage: supbuddy project env-read <path> [--key K]");
27666
27713
  return 1;
27667
27714
  }
27668
- const args = { path: path11 };
27715
+ const args = { path: path12 };
27669
27716
  if (typeof flags.key === "string") args.key = flags.key;
27670
27717
  print(await client.call("read_env_file", args), flags);
27671
27718
  return 0;
@@ -27913,8 +27960,8 @@ async function runCommand(argv, flags, clientFactory) {
27913
27960
  return 0;
27914
27961
  }
27915
27962
  if (sub === "write") {
27916
- const [path11, ...pairs] = rest;
27917
- if (!path11 || pairs.length === 0) {
27963
+ const [path12, ...pairs] = rest;
27964
+ if (!path12 || pairs.length === 0) {
27918
27965
  console.error("usage: supbuddy env write <path> <key=val>...");
27919
27966
  return 1;
27920
27967
  }
@@ -27929,7 +27976,7 @@ async function runCommand(argv, flags, clientFactory) {
27929
27976
  const v = pair.slice(eqIdx + 1);
27930
27977
  patch[k] = v === "" ? null : v;
27931
27978
  }
27932
- print(await client.call("write_env_file", { path: path11, patch }), flags);
27979
+ print(await client.call("write_env_file", { path: path12, patch }), flags);
27933
27980
  return 0;
27934
27981
  }
27935
27982
  console.error("usage: supbuddy env copy|write ...");
@@ -28429,9 +28476,9 @@ async function runShell(opts, stateDir, module) {
28429
28476
  const os7 = await import("os");
28430
28477
  const fs9 = await import("fs");
28431
28478
  const shellEntry = fileURLToPath3(new URL("../../tui/src/shell/bin.tsx", import.meta.url));
28432
- const REPO_ROOT2 = path10.resolve(fileURLToPath3(import.meta.url), "..", "..", "..", "..");
28433
- const tsxBin = path10.join(REPO_ROOT2, "node_modules", ".bin", "tsx");
28434
- const resultFile = path10.join(os7.tmpdir(), `supbuddy-shell-${process.pid}-${Date.now()}.json`);
28479
+ const REPO_ROOT2 = path11.resolve(fileURLToPath3(import.meta.url), "..", "..", "..", "..");
28480
+ const tsxBin = path11.join(REPO_ROOT2, "node_modules", ".bin", "tsx");
28481
+ const resultFile = path11.join(os7.tmpdir(), `supbuddy-shell-${process.pid}-${Date.now()}.json`);
28435
28482
  const env2 = { ...process.env, SUPBUDDY_SHELL_RESULT: resultFile };
28436
28483
  if (stateDir) env2.SUPBUDDY_STATE_DIR = stateDir;
28437
28484
  if (module) env2.SUPBUDDY_SHELL_MODULE = module;
@@ -28528,8 +28575,8 @@ async function dispatch(argv, opts) {
28528
28575
  case "tui":
28529
28576
  case "dash": {
28530
28577
  const tuiEntry = fileURLToPath3(new URL("../../tui/src/bin.tsx", import.meta.url));
28531
- const REPO_ROOT2 = path10.resolve(fileURLToPath3(import.meta.url), "..", "..", "..", "..");
28532
- const tsxBin = path10.join(REPO_ROOT2, "node_modules", ".bin", "tsx");
28578
+ const REPO_ROOT2 = path11.resolve(fileURLToPath3(import.meta.url), "..", "..", "..", "..");
28579
+ const tsxBin = path11.join(REPO_ROOT2, "node_modules", ".bin", "tsx");
28533
28580
  const env2 = { ...process.env };
28534
28581
  if (typeof flags["state-dir"] === "string") env2.SUPBUDDY_STATE_DIR = flags["state-dir"];
28535
28582
  if (typeof flags["url"] === "string") env2.SUPBUDDY_DAEMON_URL = flags["url"];