@vibedeckx/darwin-arm64 0.3.54-win.3 → 0.3.54

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/bin.js +181 -200
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -115594,7 +115594,7 @@ var require_token_io = __commonJS({
115594
115594
  });
115595
115595
  module.exports = __toCommonJS2(token_io_exports);
115596
115596
  var import_path17 = __toESM3(__require("path"));
115597
- var import_fs11 = __toESM3(__require("fs"));
115597
+ var import_fs10 = __toESM3(__require("fs"));
115598
115598
  var import_os5 = __toESM3(__require("os"));
115599
115599
  var import_token_error = require_token_error();
115600
115600
  function findRootDir() {
@@ -115602,7 +115602,7 @@ var require_token_io = __commonJS({
115602
115602
  let dir = process.cwd();
115603
115603
  while (dir !== import_path17.default.dirname(dir)) {
115604
115604
  const pkgPath = import_path17.default.join(dir, ".vercel");
115605
- if (import_fs11.default.existsSync(pkgPath)) {
115605
+ if (import_fs10.default.existsSync(pkgPath)) {
115606
115606
  return dir;
115607
115607
  }
115608
115608
  dir = import_path17.default.dirname(dir);
@@ -128240,7 +128240,7 @@ var require_mock_interceptor = __commonJS({
128240
128240
  var require_mock_client = __commonJS({
128241
128241
  "../../node_modules/.pnpm/undici@7.22.0/node_modules/undici/lib/mock/mock-client.js"(exports, module) {
128242
128242
  "use strict";
128243
- var { promisify: promisify9 } = __require("node:util");
128243
+ var { promisify: promisify10 } = __require("node:util");
128244
128244
  var Client3 = require_client2();
128245
128245
  var { buildMockDispatch } = require_mock_utils();
128246
128246
  var {
@@ -128288,7 +128288,7 @@ var require_mock_client = __commonJS({
128288
128288
  this[kDispatches] = [];
128289
128289
  }
128290
128290
  async [kClose]() {
128291
- await promisify9(this[kOriginalClose])();
128291
+ await promisify10(this[kOriginalClose])();
128292
128292
  this[kConnected] = 0;
128293
128293
  this[kMockAgent][Symbols.kClients].delete(this[kOrigin]);
128294
128294
  }
@@ -128501,7 +128501,7 @@ var require_mock_call_history = __commonJS({
128501
128501
  var require_mock_pool = __commonJS({
128502
128502
  "../../node_modules/.pnpm/undici@7.22.0/node_modules/undici/lib/mock/mock-pool.js"(exports, module) {
128503
128503
  "use strict";
128504
- var { promisify: promisify9 } = __require("node:util");
128504
+ var { promisify: promisify10 } = __require("node:util");
128505
128505
  var Pool = require_pool2();
128506
128506
  var { buildMockDispatch } = require_mock_utils();
128507
128507
  var {
@@ -128549,7 +128549,7 @@ var require_mock_pool = __commonJS({
128549
128549
  this[kDispatches] = [];
128550
128550
  }
128551
128551
  async [kClose]() {
128552
- await promisify9(this[kOriginalClose])();
128552
+ await promisify10(this[kOriginalClose])();
128553
128553
  this[kConnected] = 0;
128554
128554
  this[kMockAgent][Symbols.kClients].delete(this[kOrigin]);
128555
128555
  }
@@ -128873,7 +128873,7 @@ var require_snapshot_utils = __commonJS({
128873
128873
  var require_snapshot_recorder = __commonJS({
128874
128874
  "../../node_modules/.pnpm/undici@7.22.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
128875
128875
  "use strict";
128876
- var { writeFile: writeFile2, readFile: readFile2, mkdir: mkdir6 } = __require("node:fs/promises");
128876
+ var { writeFile: writeFile2, readFile: readFile3, mkdir: mkdir6 } = __require("node:fs/promises");
128877
128877
  var { dirname, resolve: resolve3 } = __require("node:path");
128878
128878
  var { setTimeout: setTimeout3, clearTimeout: clearTimeout2 } = __require("node:timers");
128879
128879
  var { InvalidArgumentError: InvalidArgumentError4, UndiciError } = require_errors7();
@@ -129075,7 +129075,7 @@ var require_snapshot_recorder = __commonJS({
129075
129075
  throw new InvalidArgumentError4("Snapshot path is required");
129076
129076
  }
129077
129077
  try {
129078
- const data = await readFile2(resolve3(path38), "utf8");
129078
+ const data = await readFile3(resolve3(path38), "utf8");
129079
129079
  const parsed = JSON.parse(data);
129080
129080
  if (Array.isArray(parsed)) {
129081
129081
  this.#snapshots.clear();
@@ -251864,9 +251864,9 @@ async function registryWorktreeList(fastify2, project, reported) {
251864
251864
  for (const [branch, machines] of rest) list.push({ branch, machines });
251865
251865
  return list;
251866
251866
  }
251867
- function removeWorktreeIfPresent(execFileSync9, projectPath, worktreePath) {
251867
+ function removeWorktreeIfPresent(execFileSync7, projectPath, worktreePath) {
251868
251868
  try {
251869
- execFileSync9("git", ["worktree", "remove", worktreePath], {
251869
+ execFileSync7("git", ["worktree", "remove", worktreePath], {
251870
251870
  cwd: projectPath,
251871
251871
  encoding: "utf-8",
251872
251872
  stdio: ["pipe", "pipe", "pipe"]
@@ -252028,7 +252028,7 @@ var routes8 = async (fastify2) => {
252028
252028
  }
252029
252029
  let worktreeRemoved = false;
252030
252030
  try {
252031
- const { execSync: execSync2, execFileSync: execFileSync9 } = await import("child_process");
252031
+ const { execSync: execSync2, execFileSync: execFileSync7 } = await import("child_process");
252032
252032
  const worktreeAbsPath = resolveWorktreePath(projectPath, branch);
252033
252033
  try {
252034
252034
  const statusOutput = execSync2("git status --porcelain", {
@@ -252056,7 +252056,7 @@ var routes8 = async (fastify2) => {
252056
252056
  branchToDelete = liveWorktreeRecord(projectPath, worktreeAbsPath)?.branch ?? branch;
252057
252057
  } catch {
252058
252058
  }
252059
- removeWorktreeIfPresent(execFileSync9, projectPath, worktreeAbsPath);
252059
+ removeWorktreeIfPresent(execFileSync7, projectPath, worktreeAbsPath);
252060
252060
  worktreeRemoved = true;
252061
252061
  invalidateWorktreeListCache(projectPath);
252062
252062
  const branchRetained = branchToDelete ? deleteBranchAfterRemoval(projectPath, branchToDelete) : null;
@@ -252494,7 +252494,7 @@ var routes8 = async (fastify2) => {
252494
252494
  return reply.code(400).send({ error: "Project has no local path" });
252495
252495
  }
252496
252496
  const deleteLocal = async () => {
252497
- const { execSync: execSync2, execFileSync: execFileSync9 } = await import("child_process");
252497
+ const { execSync: execSync2, execFileSync: execFileSync7 } = await import("child_process");
252498
252498
  const worktreeAbsPath = resolveWorktreePath(project.path, branch);
252499
252499
  const registered = await fastify2.storage.workspaceRegistry.getByProjectBranch(project.id, branch, "local");
252500
252500
  if (registered) {
@@ -252524,7 +252524,7 @@ var routes8 = async (fastify2) => {
252524
252524
  branchToDelete = liveWorktreeRecord(project.path, worktreeAbsPath)?.branch ?? branch;
252525
252525
  } catch {
252526
252526
  }
252527
- removeWorktreeIfPresent(execFileSync9, project.path, worktreeAbsPath);
252527
+ removeWorktreeIfPresent(execFileSync7, project.path, worktreeAbsPath);
252528
252528
  worktreeRemoved = true;
252529
252529
  invalidateWorktreeListCache(project.path);
252530
252530
  const branchRetained = branchToDelete ? deleteBranchAfterRemoval(project.path, branchToDelete) : null;
@@ -252834,8 +252834,7 @@ var worktree_routes_default = (0, import_fastify_plugin9.default)(routes8, { nam
252834
252834
  // src/routes/diff-routes.ts
252835
252835
  var import_fastify_plugin10 = __toESM(require_plugin2(), 1);
252836
252836
  import path13 from "path";
252837
- import { readFileSync as readFileSync4 } from "fs";
252838
- import { execFileSync as execFileSync6 } from "child_process";
252837
+ import { readFile as readFile2 } from "fs/promises";
252839
252838
 
252840
252839
  // src/utils/diff-parser.ts
252841
252840
  var C_ESCAPES = {
@@ -252975,54 +252974,81 @@ function parseDiffOutput(diffOutput) {
252975
252974
  return files;
252976
252975
  }
252977
252976
 
252978
- // src/merge-status.ts
252979
- import { execFileSync as execFileSync5 } from "child_process";
252977
+ // src/utils/git-exec.ts
252978
+ import { execFile as execFile2 } from "child_process";
252979
+ import { promisify as promisify2 } from "util";
252980
+ var execFileAsync = promisify2(execFile2);
252980
252981
  var MAX_BUFFER3 = 10 * 1024 * 1024;
252981
- function git3(cwd, args) {
252982
- return execFileSync5("git", args, {
252983
- cwd,
252984
- encoding: "utf-8",
252985
- maxBuffer: MAX_BUFFER3,
252986
- stdio: ["pipe", "pipe", "pipe"]
252987
- });
252982
+ var GIT_TIMEOUT_MS = 2e4;
252983
+ var GitTimeoutError = class extends Error {
252984
+ statusCode = 504;
252985
+ constructor(args, timeoutMs) {
252986
+ super(`git ${args[0] ?? ""} timed out after ${timeoutMs}ms \u2014 the repository may be too large or busy`);
252987
+ this.name = "GitTimeoutError";
252988
+ }
252989
+ };
252990
+ async function runGit(cwd, args, timeoutMs = GIT_TIMEOUT_MS) {
252991
+ try {
252992
+ const { stdout } = await execFileAsync("git", args, {
252993
+ cwd,
252994
+ encoding: "utf-8",
252995
+ maxBuffer: MAX_BUFFER3,
252996
+ timeout: timeoutMs
252997
+ });
252998
+ return stdout;
252999
+ } catch (err) {
253000
+ const e = err;
253001
+ if (e?.killed === true && e.code !== "ERR_CHILD_PROCESS_STDIO_MAXBUFFER") {
253002
+ throw new GitTimeoutError(args, timeoutMs);
253003
+ }
253004
+ throw err;
253005
+ }
253006
+ }
253007
+ function rethrowGitTimeout(err) {
253008
+ if (err instanceof GitTimeoutError) throw err;
252988
253009
  }
252989
- function revParse(repoPath, ref) {
253010
+
253011
+ // src/merge-status.ts
253012
+ async function revParse(repoPath, ref) {
252990
253013
  try {
252991
- return git3(repoPath, ["rev-parse", "--verify", ref]).trim();
252992
- } catch {
253014
+ return (await runGit(repoPath, ["rev-parse", "--verify", ref])).trim();
253015
+ } catch (err) {
253016
+ rethrowGitTimeout(err);
252993
253017
  return null;
252994
253018
  }
252995
253019
  }
252996
- function validateBranchExists(repoPath, branch) {
252997
- return revParse(repoPath, `refs/heads/${branch}`) !== null;
253020
+ async function validateBranchExists(repoPath, branch) {
253021
+ return await revParse(repoPath, `refs/heads/${branch}`) !== null;
252998
253022
  }
252999
- function detectDefaultBranch(repoPath) {
253023
+ async function detectDefaultBranch(repoPath) {
253000
253024
  for (const candidate of ["main", "master"]) {
253001
- if (validateBranchExists(repoPath, candidate)) return candidate;
253025
+ if (await validateBranchExists(repoPath, candidate)) return candidate;
253002
253026
  }
253003
253027
  throw Object.assign(new Error("No default branch (main/master) found"), { statusCode: 400 });
253004
253028
  }
253005
253029
  var statusCache = /* @__PURE__ */ new Map();
253006
- function isAncestor(repoPath, ancestor, descendant) {
253030
+ async function isAncestor(repoPath, ancestor, descendant) {
253007
253031
  try {
253008
- git3(repoPath, ["merge-base", "--is-ancestor", ancestor, descendant]);
253032
+ await runGit(repoPath, ["merge-base", "--is-ancestor", ancestor, descendant]);
253009
253033
  return true;
253010
- } catch {
253034
+ } catch (err) {
253035
+ rethrowGitTimeout(err);
253011
253036
  return false;
253012
253037
  }
253013
253038
  }
253014
- function branchContentContainedInTarget(repoPath, branch, target) {
253039
+ async function branchContentContainedInTarget(repoPath, branch, target) {
253015
253040
  try {
253016
- const mergedTree = git3(repoPath, ["merge-tree", "--write-tree", target, branch]).split("\n", 1)[0].trim();
253017
- const targetTree = revParse(repoPath, `${target}^{tree}`);
253041
+ const mergedTree = (await runGit(repoPath, ["merge-tree", "--write-tree", target, branch])).split("\n", 1)[0].trim();
253042
+ const targetTree = await revParse(repoPath, `${target}^{tree}`);
253018
253043
  return targetTree !== null && mergedTree === targetTree;
253019
- } catch {
253044
+ } catch (err) {
253045
+ rethrowGitTimeout(err);
253020
253046
  return false;
253021
253047
  }
253022
253048
  }
253023
- function computeBranchMergeStatus(repoPath, branch, target) {
253024
- const branchTip = revParse(repoPath, `refs/heads/${branch}`);
253025
- const targetTip = revParse(repoPath, `refs/heads/${target}`);
253049
+ async function computeBranchMergeStatus(repoPath, branch, target) {
253050
+ const branchTip = await revParse(repoPath, `refs/heads/${branch}`);
253051
+ const targetTip = await revParse(repoPath, `refs/heads/${target}`);
253026
253052
  if (!branchTip || !targetTip) {
253027
253053
  const missing = !branchTip ? branch : target;
253028
253054
  throw Object.assign(new Error(`Branch not found: ${missing}`), { statusCode: 400 });
@@ -253036,16 +253062,16 @@ function computeBranchMergeStatus(repoPath, branch, target) {
253036
253062
  let unmergedCount = 0;
253037
253063
  if (branchTip === targetTip) {
253038
253064
  status = "no-unique-commits";
253039
- } else if (isAncestor(repoPath, branchTip, targetTip)) {
253065
+ } else if (await isAncestor(repoPath, branchTip, targetTip)) {
253040
253066
  status = "merged";
253041
253067
  } else {
253042
- const lines = git3(repoPath, ["cherry", target, branch]).trim().split("\n").filter(Boolean);
253068
+ const lines = (await runGit(repoPath, ["cherry", target, branch])).trim().split("\n").filter(Boolean);
253043
253069
  unmergedCount = lines.filter((l) => l.startsWith("+")).length;
253044
253070
  if (lines.length === 0) status = "no-unique-commits";
253045
253071
  else if (unmergedCount === 0) status = "merged";
253046
253072
  else if (unmergedCount < lines.length) status = "partial";
253047
253073
  else status = "unmerged";
253048
- if (unmergedCount > 0 && branchContentContainedInTarget(repoPath, branch, target)) {
253074
+ if (unmergedCount > 0 && await branchContentContainedInTarget(repoPath, branch, target)) {
253049
253075
  status = "merged";
253050
253076
  unmergedCount = 0;
253051
253077
  }
@@ -253053,27 +253079,34 @@ function computeBranchMergeStatus(repoPath, branch, target) {
253053
253079
  statusCache.set(cacheKey2, { branchTip, targetTip, status, unmergedCount });
253054
253080
  return { status, unmergedCount };
253055
253081
  }
253056
- function isDirty2(worktreePath) {
253082
+ async function isDirty2(worktreePath) {
253057
253083
  try {
253058
- return git3(worktreePath, ["status", "--porcelain"]).trim().length > 0;
253059
- } catch {
253084
+ return (await runGit(worktreePath, ["status", "--porcelain"])).trim().length > 0;
253085
+ } catch (err) {
253086
+ rethrowGitTimeout(err);
253060
253087
  return false;
253061
253088
  }
253062
253089
  }
253063
- function computeMergeStatusPairs(repoPath, comparisons) {
253090
+ async function computeMergeStatusPairs(repoPath, comparisons) {
253064
253091
  const worktreePathByBranch = /* @__PURE__ */ new Map();
253065
253092
  for (const wt of parseGitWorktreeList(repoPath)) {
253066
253093
  if (wt.branch) worktreePathByBranch.set(wt.branch, wt.path);
253067
253094
  }
253068
253095
  let defaultTarget;
253069
253096
  const dirtyByBranch = /* @__PURE__ */ new Map();
253070
- return comparisons.map((cmp) => {
253097
+ const entries = [];
253098
+ for (const cmp of comparisons) {
253099
+ entries.push(await computePair(cmp));
253100
+ }
253101
+ return entries;
253102
+ async function computePair(cmp) {
253071
253103
  let target = cmp.target;
253072
253104
  if (!target) {
253073
253105
  if (defaultTarget === void 0) {
253074
253106
  try {
253075
- defaultTarget = detectDefaultBranch(repoPath);
253076
- } catch {
253107
+ defaultTarget = await detectDefaultBranch(repoPath);
253108
+ } catch (err) {
253109
+ rethrowGitTimeout(err);
253077
253110
  defaultTarget = null;
253078
253111
  }
253079
253112
  }
@@ -253081,21 +253114,21 @@ function computeMergeStatusPairs(repoPath, comparisons) {
253081
253114
  return { branch: cmp.branch, target: null, error: "no-default-branch" };
253082
253115
  }
253083
253116
  target = defaultTarget;
253084
- } else if (!validateBranchExists(repoPath, target)) {
253117
+ } else if (!await validateBranchExists(repoPath, target)) {
253085
253118
  return { branch: cmp.branch, target: null, error: "target-not-found" };
253086
253119
  }
253087
- if (!validateBranchExists(repoPath, cmp.branch)) {
253120
+ if (!await validateBranchExists(repoPath, cmp.branch)) {
253088
253121
  return { branch: cmp.branch, target, error: "branch-not-found" };
253089
253122
  }
253090
- const { status, unmergedCount } = computeBranchMergeStatus(repoPath, cmp.branch, target);
253123
+ const { status, unmergedCount } = await computeBranchMergeStatus(repoPath, cmp.branch, target);
253091
253124
  let dirty = dirtyByBranch.get(cmp.branch);
253092
253125
  if (dirty === void 0) {
253093
253126
  const wtPath = worktreePathByBranch.get(cmp.branch);
253094
- dirty = wtPath ? isDirty2(wtPath) : false;
253127
+ dirty = wtPath ? await isDirty2(wtPath) : false;
253095
253128
  dirtyByBranch.set(cmp.branch, dirty);
253096
253129
  }
253097
253130
  return { branch: cmp.branch, target, status, unmergedCount, dirty };
253098
- });
253131
+ }
253099
253132
  }
253100
253133
 
253101
253134
  // src/routes/diff-routes.ts
@@ -253122,31 +253155,24 @@ function parseGitLogOutput(output) {
253122
253155
  }
253123
253156
  return commits;
253124
253157
  }
253125
- function buildDiffCommand(commit) {
253158
+ function diffArgs(commit) {
253126
253159
  if (!commit) {
253127
- return `git diff HEAD --no-color`;
253160
+ return ["diff", "HEAD", "--no-color"];
253128
253161
  }
253129
- return `git diff ${commit}^ ${commit} --no-color`;
253162
+ return ["diff", `${commit}^`, commit, "--no-color"];
253130
253163
  }
253131
- function buildDiffFallbackCommand(commit) {
253132
- return `git show ${commit} --format="" --no-color`;
253164
+ function diffFallbackArgs(commit) {
253165
+ return commit ? ["show", commit, "--format=", "--no-color"] : ["diff", "--no-color"];
253133
253166
  }
253134
- function runCompareToDiff(cwd, compareTo) {
253135
- return execFileSync6("git", ["diff", `${compareTo}...HEAD`, "--no-color"], {
253136
- cwd,
253137
- encoding: "utf-8",
253138
- maxBuffer: 10 * 1024 * 1024
253139
- });
253167
+ function runCompareToDiff(cwd, compareTo, timeoutMs) {
253168
+ return runGit(cwd, ["diff", `${compareTo}...HEAD`, "--no-color"], timeoutMs);
253140
253169
  }
253141
- async function getUntrackedFiles(cwd) {
253170
+ async function getUntrackedFiles(cwd, timeoutMs) {
253142
253171
  let untrackedOutput;
253143
253172
  try {
253144
- const { execSync: execSync2 } = await import("child_process");
253145
- untrackedOutput = execSync2(
253146
- "git ls-files --others --exclude-standard -z",
253147
- { cwd, encoding: "utf-8", maxBuffer: 10 * 1024 * 1024 }
253148
- );
253149
- } catch {
253173
+ untrackedOutput = await runGit(cwd, ["ls-files", "--others", "--exclude-standard", "-z"], timeoutMs);
253174
+ } catch (err) {
253175
+ if (err instanceof GitTimeoutError) throw err;
253150
253176
  return [];
253151
253177
  }
253152
253178
  const untrackedPaths = untrackedOutput.split("\0").filter(Boolean);
@@ -253155,7 +253181,7 @@ async function getUntrackedFiles(cwd) {
253155
253181
  for (const filePath of untrackedPaths) {
253156
253182
  try {
253157
253183
  const fullPath = path13.join(cwd, filePath);
253158
- const buffer = readFileSync4(fullPath);
253184
+ const buffer = await readFile2(fullPath);
253159
253185
  if (buffer.includes(0)) {
253160
253186
  files.push({ path: filePath, status: "added", hunks: [], binary: true });
253161
253187
  continue;
@@ -253188,6 +253214,45 @@ async function getUntrackedFiles(cwd) {
253188
253214
  }
253189
253215
  return files;
253190
253216
  }
253217
+ function timeoutResult(err) {
253218
+ return { code: err.statusCode, body: { error: err.message } };
253219
+ }
253220
+ async function loadDiff(cwd, commit, compareTo, timeoutMs = GIT_TIMEOUT_MS) {
253221
+ if (compareTo) {
253222
+ try {
253223
+ if (!await validateBranchExists(cwd, compareTo)) {
253224
+ return { code: 400, body: { error: `Branch not found: ${compareTo}` } };
253225
+ }
253226
+ return { code: 200, body: { files: parseDiffOutput(await runCompareToDiff(cwd, compareTo, timeoutMs)) } };
253227
+ } catch (err) {
253228
+ return err instanceof GitTimeoutError ? timeoutResult(err) : { code: 200, body: { files: [] } };
253229
+ }
253230
+ }
253231
+ let untrackedFiles;
253232
+ try {
253233
+ untrackedFiles = !commit ? await getUntrackedFiles(cwd, timeoutMs) : [];
253234
+ } catch (err) {
253235
+ if (err instanceof GitTimeoutError) return timeoutResult(err);
253236
+ throw err;
253237
+ }
253238
+ for (const args of [diffArgs(commit), diffFallbackArgs(commit)]) {
253239
+ try {
253240
+ const files = parseDiffOutput(await runGit(cwd, args, timeoutMs));
253241
+ return { code: 200, body: { files: [...files, ...untrackedFiles] } };
253242
+ } catch (err) {
253243
+ if (err instanceof GitTimeoutError) return timeoutResult(err);
253244
+ }
253245
+ }
253246
+ return { code: 200, body: { files: untrackedFiles } };
253247
+ }
253248
+ async function loadCommits(cwd, limit) {
253249
+ try {
253250
+ const output = await runGit(cwd, ["log", "--format=%H%n%h%n%s%n%an%n%aI", "-n", String(limit)]);
253251
+ return parseGitLogOutput(output);
253252
+ } catch {
253253
+ return [];
253254
+ }
253255
+ }
253191
253256
  var routes9 = async (fastify2) => {
253192
253257
  fastify2.get("/api/path/diff", async (req, reply) => {
253193
253258
  const projectPath = req.query.path;
@@ -253203,41 +253268,9 @@ var routes9 = async (fastify2) => {
253203
253268
  if (commit && compareTo) {
253204
253269
  return reply.code(400).send({ error: "commit and compareTo are mutually exclusive" });
253205
253270
  }
253206
- if (compareTo) {
253207
- const cwd2 = resolveWorktreePath(projectPath, branch ?? null);
253208
- if (!validateBranchExists(cwd2, compareTo)) {
253209
- return reply.code(400).send({ error: `Branch not found: ${compareTo}` });
253210
- }
253211
- try {
253212
- return reply.code(200).send({ files: parseDiffOutput(runCompareToDiff(cwd2, compareTo)) });
253213
- } catch {
253214
- return reply.code(200).send({ files: [] });
253215
- }
253216
- }
253217
253271
  const cwd = resolveWorktreePath(projectPath, branch ?? null);
253218
- const untrackedFiles = !commit ? await getUntrackedFiles(cwd) : [];
253219
- try {
253220
- const { execSync: execSync2 } = await import("child_process");
253221
- const diffOutput = execSync2(buildDiffCommand(commit), {
253222
- cwd,
253223
- encoding: "utf-8",
253224
- maxBuffer: 10 * 1024 * 1024
253225
- });
253226
- const files = parseDiffOutput(diffOutput);
253227
- return reply.code(200).send({ files: [...files, ...untrackedFiles] });
253228
- } catch {
253229
- try {
253230
- const { execSync: execSync2 } = await import("child_process");
253231
- const diffOutput = execSync2(
253232
- commit ? buildDiffFallbackCommand(commit) : "git diff --no-color",
253233
- { cwd, encoding: "utf-8", maxBuffer: 10 * 1024 * 1024 }
253234
- );
253235
- const files = parseDiffOutput(diffOutput);
253236
- return reply.code(200).send({ files: [...files, ...untrackedFiles] });
253237
- } catch {
253238
- return reply.code(200).send({ files: untrackedFiles });
253239
- }
253240
- }
253272
+ const { code, body } = await loadDiff(cwd, commit, compareTo);
253273
+ return reply.code(code).send(body);
253241
253274
  });
253242
253275
  fastify2.get("/api/path/commits", async (req, reply) => {
253243
253276
  const projectPath = req.query.path;
@@ -253247,17 +253280,7 @@ var routes9 = async (fastify2) => {
253247
253280
  const branch = req.query.branch;
253248
253281
  const limit = parseInt(req.query.limit || "20", 10);
253249
253282
  const cwd = resolveWorktreePath(projectPath, branch ?? null);
253250
- try {
253251
- const { execSync: execSync2 } = await import("child_process");
253252
- const output = execSync2(
253253
- `git log --format=%H%n%h%n%s%n%an%n%aI -n ${limit}`,
253254
- { cwd, encoding: "utf-8", maxBuffer: 10 * 1024 * 1024 }
253255
- );
253256
- const commits = parseGitLogOutput(output);
253257
- return reply.code(200).send({ commits });
253258
- } catch {
253259
- return reply.code(200).send({ commits: [] });
253260
- }
253283
+ return reply.code(200).send({ commits: await loadCommits(cwd, limit) });
253261
253284
  });
253262
253285
  fastify2.get("/api/projects/:id/diff", async (req, reply) => {
253263
253286
  const userId = requireUserFacingUserId(req, reply);
@@ -253298,41 +253321,9 @@ var routes9 = async (fastify2) => {
253298
253321
  if (!project.path) {
253299
253322
  return reply.code(400).send({ error: "Project has no local path" });
253300
253323
  }
253301
- if (compareTo) {
253302
- const cwd2 = resolveWorktreePath(project.path, branch ?? null);
253303
- if (!validateBranchExists(cwd2, compareTo)) {
253304
- return reply.code(400).send({ error: `Branch not found: ${compareTo}` });
253305
- }
253306
- try {
253307
- return reply.code(200).send({ files: parseDiffOutput(runCompareToDiff(cwd2, compareTo)) });
253308
- } catch {
253309
- return reply.code(200).send({ files: [] });
253310
- }
253311
- }
253312
253324
  const cwd = resolveWorktreePath(project.path, branch ?? null);
253313
- const untrackedFiles = !commit ? await getUntrackedFiles(cwd) : [];
253314
- try {
253315
- const { execSync: execSync2 } = await import("child_process");
253316
- const diffOutput = execSync2(buildDiffCommand(commit), {
253317
- cwd,
253318
- encoding: "utf-8",
253319
- maxBuffer: 10 * 1024 * 1024
253320
- });
253321
- const files = parseDiffOutput(diffOutput);
253322
- return reply.code(200).send({ files: [...files, ...untrackedFiles] });
253323
- } catch {
253324
- try {
253325
- const { execSync: execSync2 } = await import("child_process");
253326
- const diffOutput = execSync2(
253327
- commit ? buildDiffFallbackCommand(commit) : "git diff --no-color",
253328
- { cwd, encoding: "utf-8", maxBuffer: 10 * 1024 * 1024 }
253329
- );
253330
- const files = parseDiffOutput(diffOutput);
253331
- return reply.code(200).send({ files: [...files, ...untrackedFiles] });
253332
- } catch {
253333
- return reply.code(200).send({ files: untrackedFiles });
253334
- }
253335
- }
253325
+ const { code, body } = await loadDiff(cwd, commit, compareTo);
253326
+ return reply.code(code).send(body);
253336
253327
  });
253337
253328
  fastify2.get("/api/projects/:id/commits", async (req, reply) => {
253338
253329
  const userId = requireUserFacingUserId(req, reply);
@@ -253366,17 +253357,7 @@ var routes9 = async (fastify2) => {
253366
253357
  return reply.code(400).send({ error: "Project has no local path" });
253367
253358
  }
253368
253359
  const cwd = resolveWorktreePath(project.path, branch ?? null);
253369
- try {
253370
- const { execSync: execSync2 } = await import("child_process");
253371
- const output = execSync2(
253372
- `git log --format=%H%n%h%n%s%n%an%n%aI -n ${limit}`,
253373
- { cwd, encoding: "utf-8", maxBuffer: 10 * 1024 * 1024 }
253374
- );
253375
- const commits = parseGitLogOutput(output);
253376
- return reply.code(200).send({ commits });
253377
- } catch {
253378
- return reply.code(200).send({ commits: [] });
253379
- }
253360
+ return reply.code(200).send({ commits: await loadCommits(cwd, limit) });
253380
253361
  });
253381
253362
  };
253382
253363
  var diff_routes_default = (0, import_fastify_plugin10.default)(routes9, { name: "diff-routes" });
@@ -253387,8 +253368,8 @@ import path14 from "path";
253387
253368
  import os from "os";
253388
253369
  import fs3 from "fs/promises";
253389
253370
  import { createReadStream as createReadStream2, constants as fsConstants } from "fs";
253390
- import { execFile as execFile2 } from "child_process";
253391
- import { promisify as promisify2 } from "util";
253371
+ import { execFile as execFile3 } from "child_process";
253372
+ import { promisify as promisify3 } from "util";
253392
253373
 
253393
253374
  // src/artifact-read-targets.ts
253394
253375
  function isOutsideArtifactPath(filePath) {
@@ -253490,7 +253471,7 @@ function emitFilesChanged(fastify2, projectId, branch, change) {
253490
253471
  }
253491
253472
  var MAX_FILE_SIZE = 1 * 1024 * 1024;
253492
253473
  var MAX_LIST_FILES = 5e4;
253493
- var execFileAsync = promisify2(execFile2);
253474
+ var execFileAsync2 = promisify3(execFile3);
253494
253475
  function isPathSafe(basePath33, relativePath) {
253495
253476
  const normalizedBase = path14.resolve(basePath33);
253496
253477
  const resolved = path14.resolve(normalizedBase, relativePath);
@@ -253647,7 +253628,7 @@ async function walkFilesFallback(basePath33) {
253647
253628
  }
253648
253629
  async function listProjectFiles(basePath33) {
253649
253630
  try {
253650
- const { stdout } = await execFileAsync(
253631
+ const { stdout } = await execFileAsync2(
253651
253632
  "git",
253652
253633
  ["ls-files", "--cached", "--others", "--exclude-standard", "-z"],
253653
253634
  { cwd: basePath33, maxBuffer: 64 * 1024 * 1024 }
@@ -253684,7 +253665,7 @@ function isDefinitionLine(text2, symbol26) {
253684
253665
  async function searchSymbol(basePath33, symbol26) {
253685
253666
  let stdout = "";
253686
253667
  try {
253687
- const res = await execFileAsync(
253668
+ const res = await execFileAsync2(
253688
253669
  "git",
253689
253670
  ["grep", "-n", "-I", "-F", "-w", "--no-color", "--untracked", "-e", symbol26],
253690
253671
  { cwd: basePath33, maxBuffer: 32 * 1024 * 1024, timeout: 1e4 }
@@ -257354,11 +257335,11 @@ function parseComparisons(body) {
257354
257335
  }
257355
257336
  return result;
257356
257337
  }
257357
- function sendComputed(reply, repoPath, comparisons, repository) {
257338
+ async function sendComputed(reply, repoPath, comparisons, repository) {
257358
257339
  try {
257359
257340
  return reply.code(200).send({
257360
257341
  ...repository ? { repository } : {},
257361
- entries: computeMergeStatusPairs(repoPath, comparisons)
257342
+ entries: await computeMergeStatusPairs(repoPath, comparisons)
257362
257343
  });
257363
257344
  } catch (error48) {
257364
257345
  const statusCode = error48.statusCode ?? 500;
@@ -257432,7 +257413,7 @@ var routes14 = async (fastify2) => {
257432
257413
  });
257433
257414
  }
257434
257415
  try {
257435
- const entries = computeMergeStatusPairs(project.path, resolved.comparisons);
257416
+ const entries = await computeMergeStatusPairs(project.path, resolved.comparisons);
257436
257417
  return reply.code(200).send({
257437
257418
  repository: { kind: "local", label: "Local" },
257438
257419
  entries: annotateEntries(entries, resolved.comparisons, resolved.sources)
@@ -269753,11 +269734,11 @@ var createServer = async (opts) => {
269753
269734
  // src/ui-root.ts
269754
269735
  import fs6 from "node:fs";
269755
269736
  import path23 from "node:path";
269756
- import { execFile as execFile3 } from "node:child_process";
269757
- import { promisify as promisify3 } from "node:util";
269737
+ import { execFile as execFile4 } from "node:child_process";
269738
+ import { promisify as promisify4 } from "node:util";
269758
269739
  import { fileURLToPath as fileURLToPath2 } from "node:url";
269759
269740
  import { createRequire as createRequire2 } from "node:module";
269760
- var execFileAsync2 = promisify3(execFile3);
269741
+ var execFileAsync3 = promisify4(execFile4);
269761
269742
  function hasIndexHtml(dir) {
269762
269743
  return fs6.existsSync(path23.join(dir, "index.html"));
269763
269744
  }
@@ -269783,7 +269764,7 @@ async function defaultDownload3(version2, cacheDir) {
269783
269764
  fs6.mkdirSync(stagingDir, { recursive: true });
269784
269765
  try {
269785
269766
  const isWindows = process.platform === "win32";
269786
- await execFileAsync2(
269767
+ await execFileAsync3(
269787
269768
  isWindows ? "npm.cmd" : "npm",
269788
269769
  [
269789
269770
  "install",
@@ -269884,7 +269865,7 @@ function redactErrorSecret(error48, secret) {
269884
269865
  }
269885
269866
 
269886
269867
  // src/process-identity.ts
269887
- import { execFileSync as execFileSync7 } from "node:child_process";
269868
+ import { execFileSync as execFileSync5 } from "node:child_process";
269888
269869
  import fs7 from "node:fs";
269889
269870
  function parseLinuxProcessStartTicks(stat3) {
269890
269871
  const closeParen = stat3.lastIndexOf(")");
@@ -269942,7 +269923,7 @@ function parsePsLstart(output) {
269942
269923
  function readDarwinProcessStartTicks(pid) {
269943
269924
  let output;
269944
269925
  try {
269945
- output = execFileSync7("ps", ["-o", "lstart=", "-p", String(pid)], {
269926
+ output = execFileSync5("ps", ["-o", "lstart=", "-p", String(pid)], {
269946
269927
  encoding: "utf8",
269947
269928
  env: { ...process.env, LC_ALL: "C", TZ: "UTC" },
269948
269929
  stdio: ["ignore", "pipe", "ignore"]
@@ -269967,7 +269948,7 @@ function readWindowsProcessStartTicks(pid) {
269967
269948
  function queryWindowsProcessStartTicks(pid) {
269968
269949
  let output;
269969
269950
  try {
269970
- output = execFileSync7(
269951
+ output = execFileSync5(
269971
269952
  "powershell.exe",
269972
269953
  [
269973
269954
  "-NoProfile",
@@ -274102,7 +274083,7 @@ import process8 from "node:process";
274102
274083
  import { Buffer as Buffer2 } from "node:buffer";
274103
274084
  import path36 from "node:path";
274104
274085
  import { fileURLToPath as fileURLToPath4 } from "node:url";
274105
- import { promisify as promisify8 } from "node:util";
274086
+ import { promisify as promisify9 } from "node:util";
274106
274087
  import childProcess from "node:child_process";
274107
274088
  import fs25, { constants as fsConstants5 } from "node:fs/promises";
274108
274089
 
@@ -274237,20 +274218,20 @@ function defineLazyProperty(object4, propertyName, valueGetter) {
274237
274218
  }
274238
274219
 
274239
274220
  // ../../node_modules/.pnpm/default-browser@5.4.0/node_modules/default-browser/index.js
274240
- import { promisify as promisify7 } from "node:util";
274221
+ import { promisify as promisify8 } from "node:util";
274241
274222
  import process7 from "node:process";
274242
- import { execFile as execFile7 } from "node:child_process";
274223
+ import { execFile as execFile8 } from "node:child_process";
274243
274224
 
274244
274225
  // ../../node_modules/.pnpm/default-browser-id@5.0.1/node_modules/default-browser-id/index.js
274245
- import { promisify as promisify4 } from "node:util";
274226
+ import { promisify as promisify5 } from "node:util";
274246
274227
  import process5 from "node:process";
274247
- import { execFile as execFile4 } from "node:child_process";
274248
- var execFileAsync3 = promisify4(execFile4);
274228
+ import { execFile as execFile5 } from "node:child_process";
274229
+ var execFileAsync4 = promisify5(execFile5);
274249
274230
  async function defaultBrowserId() {
274250
274231
  if (process5.platform !== "darwin") {
274251
274232
  throw new Error("macOS only");
274252
274233
  }
274253
- const { stdout } = await execFileAsync3("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
274234
+ const { stdout } = await execFileAsync4("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
274254
274235
  const match2 = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
274255
274236
  const browserId = match2?.groups.id ?? "com.apple.Safari";
274256
274237
  if (browserId === "com.apple.safari") {
@@ -274261,9 +274242,9 @@ async function defaultBrowserId() {
274261
274242
 
274262
274243
  // ../../node_modules/.pnpm/run-applescript@7.1.0/node_modules/run-applescript/index.js
274263
274244
  import process6 from "node:process";
274264
- import { promisify as promisify5 } from "node:util";
274265
- import { execFile as execFile5, execFileSync as execFileSync8 } from "node:child_process";
274266
- var execFileAsync4 = promisify5(execFile5);
274245
+ import { promisify as promisify6 } from "node:util";
274246
+ import { execFile as execFile6, execFileSync as execFileSync6 } from "node:child_process";
274247
+ var execFileAsync5 = promisify6(execFile6);
274267
274248
  async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
274268
274249
  if (process6.platform !== "darwin") {
274269
274250
  throw new Error("macOS only");
@@ -274273,7 +274254,7 @@ async function runAppleScript(script, { humanReadableOutput = true, signal } = {
274273
274254
  if (signal) {
274274
274255
  execOptions.signal = signal;
274275
274256
  }
274276
- const { stdout } = await execFileAsync4("osascript", ["-e", script, outputArguments], execOptions);
274257
+ const { stdout } = await execFileAsync5("osascript", ["-e", script, outputArguments], execOptions);
274277
274258
  return stdout.trim();
274278
274259
  }
274279
274260
 
@@ -274284,9 +274265,9 @@ tell application "System Events" to get value of property list item "CFBundleNam
274284
274265
  }
274285
274266
 
274286
274267
  // ../../node_modules/.pnpm/default-browser@5.4.0/node_modules/default-browser/windows.js
274287
- import { promisify as promisify6 } from "node:util";
274288
- import { execFile as execFile6 } from "node:child_process";
274289
- var execFileAsync5 = promisify6(execFile6);
274268
+ import { promisify as promisify7 } from "node:util";
274269
+ import { execFile as execFile7 } from "node:child_process";
274270
+ var execFileAsync6 = promisify7(execFile7);
274290
274271
  var windowsBrowserProgIds = {
274291
274272
  MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
274292
274273
  // The missing `L` is correct.
@@ -274309,7 +274290,7 @@ var windowsBrowserProgIds = {
274309
274290
  var _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
274310
274291
  var UnknownBrowserError = class extends Error {
274311
274292
  };
274312
- async function defaultBrowser(_execFileAsync = execFileAsync5) {
274293
+ async function defaultBrowser(_execFileAsync = execFileAsync6) {
274313
274294
  const { stdout } = await _execFileAsync("reg", [
274314
274295
  "QUERY",
274315
274296
  " HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
@@ -274329,7 +274310,7 @@ async function defaultBrowser(_execFileAsync = execFileAsync5) {
274329
274310
  }
274330
274311
 
274331
274312
  // ../../node_modules/.pnpm/default-browser@5.4.0/node_modules/default-browser/index.js
274332
- var execFileAsync6 = promisify7(execFile7);
274313
+ var execFileAsync7 = promisify8(execFile8);
274333
274314
  var titleize = (string4) => string4.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x2) => x2.toUpperCase());
274334
274315
  async function defaultBrowser2() {
274335
274316
  if (process7.platform === "darwin") {
@@ -274338,7 +274319,7 @@ async function defaultBrowser2() {
274338
274319
  return { name: name25, id };
274339
274320
  }
274340
274321
  if (process7.platform === "linux") {
274341
- const { stdout } = await execFileAsync6("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
274322
+ const { stdout } = await execFileAsync7("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
274342
274323
  const id = stdout.trim();
274343
274324
  const name25 = titleize(id.replace(/.desktop$/, "").replace("-", " "));
274344
274325
  return { name: name25, id };
@@ -274350,7 +274331,7 @@ async function defaultBrowser2() {
274350
274331
  }
274351
274332
 
274352
274333
  // ../../node_modules/.pnpm/open@10.2.0/node_modules/open/index.js
274353
- var execFile8 = promisify8(childProcess.execFile);
274334
+ var execFile9 = promisify9(childProcess.execFile);
274354
274335
  var __dirname2 = path36.dirname(fileURLToPath4(import.meta.url));
274355
274336
  var localXdgOpenPath = path36.join(__dirname2, "xdg-open");
274356
274337
  var { platform: platform2, arch } = process8;
@@ -274358,7 +274339,7 @@ async function getWindowsDefaultBrowserFromWsl() {
274358
274339
  const powershellPath = await powerShellPath();
274359
274340
  const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
274360
274341
  const encodedCommand = Buffer2.from(rawCommand, "utf16le").toString("base64");
274361
- const { stdout } = await execFile8(
274342
+ const { stdout } = await execFile9(
274362
274343
  powershellPath,
274363
274344
  [
274364
274345
  "-NoProfile",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibedeckx/darwin-arm64",
3
- "version": "0.3.54-win.3",
3
+ "version": "0.3.54",
4
4
  "description": "Vibedeckx platform binaries for macOS ARM64",
5
5
  "repository": {
6
6
  "type": "git",