@vibedeckx/darwin-arm64 0.3.54-win.2 → 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.
- package/dist/bin.js +226 -215
- 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
|
|
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 (
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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(
|
|
251867
|
+
function removeWorktreeIfPresent(execFileSync7, projectPath, worktreePath) {
|
|
251868
251868
|
try {
|
|
251869
|
-
|
|
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:
|
|
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(
|
|
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:
|
|
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(
|
|
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 {
|
|
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/
|
|
252979
|
-
import {
|
|
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
|
-
|
|
252982
|
-
|
|
252983
|
-
|
|
252984
|
-
|
|
252985
|
-
|
|
252986
|
-
|
|
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
|
+
}
|
|
252988
253006
|
}
|
|
252989
|
-
function
|
|
253007
|
+
function rethrowGitTimeout(err) {
|
|
253008
|
+
if (err instanceof GitTimeoutError) throw err;
|
|
253009
|
+
}
|
|
253010
|
+
|
|
253011
|
+
// src/merge-status.ts
|
|
253012
|
+
async function revParse(repoPath, ref) {
|
|
252990
253013
|
try {
|
|
252991
|
-
return
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
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
|
|
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
|
-
|
|
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
|
|
253158
|
+
function diffArgs(commit) {
|
|
253126
253159
|
if (!commit) {
|
|
253127
|
-
return
|
|
253160
|
+
return ["diff", "HEAD", "--no-color"];
|
|
253128
253161
|
}
|
|
253129
|
-
return
|
|
253162
|
+
return ["diff", `${commit}^`, commit, "--no-color"];
|
|
253130
253163
|
}
|
|
253131
|
-
function
|
|
253132
|
-
return
|
|
253164
|
+
function diffFallbackArgs(commit) {
|
|
253165
|
+
return commit ? ["show", commit, "--format=", "--no-color"] : ["diff", "--no-color"];
|
|
253133
253166
|
}
|
|
253134
|
-
function runCompareToDiff(cwd, compareTo) {
|
|
253135
|
-
return
|
|
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
|
-
|
|
253145
|
-
|
|
253146
|
-
|
|
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 =
|
|
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
|
|
253219
|
-
|
|
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
|
-
|
|
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
|
|
253314
|
-
|
|
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
|
-
|
|
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
|
|
253391
|
-
import { promisify as
|
|
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
|
|
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
|
|
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
|
|
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
|
|
269757
|
-
import { promisify as
|
|
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
|
|
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
|
|
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
|
|
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 =
|
|
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 =
|
|
269951
|
+
output = execFileSync5(
|
|
269971
269952
|
"powershell.exe",
|
|
269972
269953
|
[
|
|
269973
269954
|
"-NoProfile",
|
|
@@ -271187,7 +271168,7 @@ function judgeLiveness(status, pid, now3 = /* @__PURE__ */ new Date()) {
|
|
|
271187
271168
|
}
|
|
271188
271169
|
|
|
271189
271170
|
// src/connect-service.ts
|
|
271190
|
-
import { spawnSync as
|
|
271171
|
+
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
271191
271172
|
import { createHash as createHash14 } from "node:crypto";
|
|
271192
271173
|
import fs14 from "node:fs";
|
|
271193
271174
|
import os3 from "node:os";
|
|
@@ -271545,7 +271526,7 @@ function pruneRuntimeVersions(dataDir, keep) {
|
|
|
271545
271526
|
}
|
|
271546
271527
|
|
|
271547
271528
|
// src/connect-windows-supervise.ts
|
|
271548
|
-
import { spawn as spawn8 } from "node:child_process";
|
|
271529
|
+
import { spawn as spawn8, spawnSync as spawnSync2 } from "node:child_process";
|
|
271549
271530
|
import { createHash as createHash13 } from "node:crypto";
|
|
271550
271531
|
import fs13 from "node:fs";
|
|
271551
271532
|
import net2 from "node:net";
|
|
@@ -271569,20 +271550,38 @@ function stopMarkerPath(dataDir) {
|
|
|
271569
271550
|
function currentBootTimeMs(now3 = Date.now(), uptimeSeconds = os2.uptime()) {
|
|
271570
271551
|
return now3 - uptimeSeconds * 1e3;
|
|
271571
271552
|
}
|
|
271572
|
-
function
|
|
271573
|
-
|
|
271553
|
+
function parseLogonId(whoamiOutput) {
|
|
271554
|
+
return /S-1-5-5-\d+-\d+/.exec(whoamiOutput)?.[0];
|
|
271555
|
+
}
|
|
271556
|
+
var cachedLogonId;
|
|
271557
|
+
function currentLogonId() {
|
|
271558
|
+
if (process.platform !== "win32") return void 0;
|
|
271559
|
+
if (cachedLogonId) return cachedLogonId;
|
|
271560
|
+
const result = spawnSync2("whoami", ["/logonid"], { encoding: "utf8", windowsHide: true, timeout: 15e3 });
|
|
271561
|
+
cachedLogonId = result.status === 0 ? parseLogonId(result.stdout ?? "") : void 0;
|
|
271562
|
+
return cachedLogonId;
|
|
271563
|
+
}
|
|
271564
|
+
function currentStopScope() {
|
|
271565
|
+
return { bootTimeMs: currentBootTimeMs(), logonId: currentLogonId() };
|
|
271566
|
+
}
|
|
271567
|
+
function writeStopMarker(dataDir, scope = currentStopScope()) {
|
|
271568
|
+
writeFileAtomic(stopMarkerPath(dataDir), `${JSON.stringify(scope)}
|
|
271574
271569
|
`);
|
|
271575
271570
|
}
|
|
271576
271571
|
function clearStopMarker(dataDir) {
|
|
271577
271572
|
fs13.rmSync(stopMarkerPath(dataDir), { force: true });
|
|
271578
271573
|
}
|
|
271579
|
-
function
|
|
271574
|
+
function stopMarkerActive(dataDir, scope = currentStopScope()) {
|
|
271575
|
+
let marker25;
|
|
271580
271576
|
try {
|
|
271581
|
-
|
|
271582
|
-
return typeof parsed.bootTimeMs === "number" && Math.abs(parsed.bootTimeMs - bootTimeMs) < BOOT_TOLERANCE_MS;
|
|
271577
|
+
marker25 = JSON.parse(fs13.readFileSync(stopMarkerPath(dataDir), "utf8"));
|
|
271583
271578
|
} catch {
|
|
271584
271579
|
return false;
|
|
271585
271580
|
}
|
|
271581
|
+
if (typeof marker25.bootTimeMs !== "number" || Math.abs(marker25.bootTimeMs - scope.bootTimeMs) >= BOOT_TOLERANCE_MS) {
|
|
271582
|
+
return false;
|
|
271583
|
+
}
|
|
271584
|
+
return !marker25.logonId || !scope.logonId || marker25.logonId === scope.logonId;
|
|
271586
271585
|
}
|
|
271587
271586
|
function sendSuperviseCommand(dataDir, command, timeoutMs = 3e4) {
|
|
271588
271587
|
return new Promise((resolve3, reject) => {
|
|
@@ -271646,8 +271645,8 @@ async function runSupervise(options) {
|
|
|
271646
271645
|
fs13.writeSync(logFd, `${(/* @__PURE__ */ new Date()).toISOString()} [${process.pid}] ${message}
|
|
271647
271646
|
`);
|
|
271648
271647
|
};
|
|
271649
|
-
if (
|
|
271650
|
-
log("stopped by `connect stop`
|
|
271648
|
+
if (stopMarkerActive(dataDir)) {
|
|
271649
|
+
log("stopped by `connect stop` in this logon session; not starting the worker");
|
|
271651
271650
|
return 0;
|
|
271652
271651
|
}
|
|
271653
271652
|
const server = net2.createServer();
|
|
@@ -271737,8 +271736,10 @@ async function runSupervise(options) {
|
|
|
271737
271736
|
const command = buffer.slice(0, newline).trim();
|
|
271738
271737
|
buffer = "";
|
|
271739
271738
|
if (command === "ping") {
|
|
271740
|
-
socket.end(
|
|
271741
|
-
|
|
271739
|
+
socket.end(
|
|
271740
|
+
`${JSON.stringify({ pid: process.pid, workerPid: worker?.pid ?? null, logonId: currentLogonId() ?? null })}
|
|
271741
|
+
`
|
|
271742
|
+
);
|
|
271742
271743
|
return;
|
|
271743
271744
|
}
|
|
271744
271745
|
if (command === "quit") {
|
|
@@ -271767,7 +271768,7 @@ async function runSupervise(options) {
|
|
|
271767
271768
|
|
|
271768
271769
|
// src/connect-service.ts
|
|
271769
271770
|
var defaultExec = (command, args) => {
|
|
271770
|
-
const result =
|
|
271771
|
+
const result = spawnSync3(command, args, { encoding: "utf8", windowsHide: true });
|
|
271771
271772
|
if (result.error) {
|
|
271772
271773
|
return { status: null, stdout: "", stderr: result.error.message };
|
|
271773
271774
|
}
|
|
@@ -272296,9 +272297,19 @@ var TaskSchedulerAdapter = class {
|
|
|
272296
272297
|
`${this.name} was started but its supervisor did not come up; see logs\\supervise.log in ${this.dataDir}`
|
|
272297
272298
|
);
|
|
272298
272299
|
}
|
|
272299
|
-
/**
|
|
272300
|
+
/**
|
|
272301
|
+
* Stopped until the next login or boot (the marker) or `start`; auto-start
|
|
272302
|
+
* is kept. The marker names the supervisor's logon session, which need not
|
|
272303
|
+
* be ours (e.g. `connect stop` over SSH).
|
|
272304
|
+
*/
|
|
272300
272305
|
async stop() {
|
|
272301
|
-
|
|
272306
|
+
const scope = currentStopScope();
|
|
272307
|
+
try {
|
|
272308
|
+
const reply = JSON.parse(await this.client(this.dataDir, "ping") ?? "{}");
|
|
272309
|
+
if (typeof reply.logonId === "string") scope.logonId = reply.logonId;
|
|
272310
|
+
} catch {
|
|
272311
|
+
}
|
|
272312
|
+
writeStopMarker(this.dataDir, scope);
|
|
272302
272313
|
await this.quit();
|
|
272303
272314
|
}
|
|
272304
272315
|
/** Restarts the supervisor too, so it picks up a new runtime. */
|
|
@@ -272703,7 +272714,7 @@ async function lifecycleStop(options) {
|
|
|
272703
272714
|
if (adapter) {
|
|
272704
272715
|
return runServiceAction(
|
|
272705
272716
|
() => adapter.stop(),
|
|
272706
|
-
`Stopped ${adapter.name}. It starts again at the next
|
|
272717
|
+
`Stopped ${adapter.name}. It starts again at the next boot/login; use \`vibedeckx connect disable\` to keep it off.`
|
|
272707
272718
|
);
|
|
272708
272719
|
}
|
|
272709
272720
|
return stopConnectDaemon(options.dataDir);
|
|
@@ -274072,7 +274083,7 @@ import process8 from "node:process";
|
|
|
274072
274083
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
274073
274084
|
import path36 from "node:path";
|
|
274074
274085
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
274075
|
-
import { promisify as
|
|
274086
|
+
import { promisify as promisify9 } from "node:util";
|
|
274076
274087
|
import childProcess from "node:child_process";
|
|
274077
274088
|
import fs25, { constants as fsConstants5 } from "node:fs/promises";
|
|
274078
274089
|
|
|
@@ -274207,20 +274218,20 @@ function defineLazyProperty(object4, propertyName, valueGetter) {
|
|
|
274207
274218
|
}
|
|
274208
274219
|
|
|
274209
274220
|
// ../../node_modules/.pnpm/default-browser@5.4.0/node_modules/default-browser/index.js
|
|
274210
|
-
import { promisify as
|
|
274221
|
+
import { promisify as promisify8 } from "node:util";
|
|
274211
274222
|
import process7 from "node:process";
|
|
274212
|
-
import { execFile as
|
|
274223
|
+
import { execFile as execFile8 } from "node:child_process";
|
|
274213
274224
|
|
|
274214
274225
|
// ../../node_modules/.pnpm/default-browser-id@5.0.1/node_modules/default-browser-id/index.js
|
|
274215
|
-
import { promisify as
|
|
274226
|
+
import { promisify as promisify5 } from "node:util";
|
|
274216
274227
|
import process5 from "node:process";
|
|
274217
|
-
import { execFile as
|
|
274218
|
-
var
|
|
274228
|
+
import { execFile as execFile5 } from "node:child_process";
|
|
274229
|
+
var execFileAsync4 = promisify5(execFile5);
|
|
274219
274230
|
async function defaultBrowserId() {
|
|
274220
274231
|
if (process5.platform !== "darwin") {
|
|
274221
274232
|
throw new Error("macOS only");
|
|
274222
274233
|
}
|
|
274223
|
-
const { stdout } = await
|
|
274234
|
+
const { stdout } = await execFileAsync4("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
|
|
274224
274235
|
const match2 = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
|
|
274225
274236
|
const browserId = match2?.groups.id ?? "com.apple.Safari";
|
|
274226
274237
|
if (browserId === "com.apple.safari") {
|
|
@@ -274231,9 +274242,9 @@ async function defaultBrowserId() {
|
|
|
274231
274242
|
|
|
274232
274243
|
// ../../node_modules/.pnpm/run-applescript@7.1.0/node_modules/run-applescript/index.js
|
|
274233
274244
|
import process6 from "node:process";
|
|
274234
|
-
import { promisify as
|
|
274235
|
-
import { execFile as
|
|
274236
|
-
var
|
|
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);
|
|
274237
274248
|
async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
|
|
274238
274249
|
if (process6.platform !== "darwin") {
|
|
274239
274250
|
throw new Error("macOS only");
|
|
@@ -274243,7 +274254,7 @@ async function runAppleScript(script, { humanReadableOutput = true, signal } = {
|
|
|
274243
274254
|
if (signal) {
|
|
274244
274255
|
execOptions.signal = signal;
|
|
274245
274256
|
}
|
|
274246
|
-
const { stdout } = await
|
|
274257
|
+
const { stdout } = await execFileAsync5("osascript", ["-e", script, outputArguments], execOptions);
|
|
274247
274258
|
return stdout.trim();
|
|
274248
274259
|
}
|
|
274249
274260
|
|
|
@@ -274254,9 +274265,9 @@ tell application "System Events" to get value of property list item "CFBundleNam
|
|
|
274254
274265
|
}
|
|
274255
274266
|
|
|
274256
274267
|
// ../../node_modules/.pnpm/default-browser@5.4.0/node_modules/default-browser/windows.js
|
|
274257
|
-
import { promisify as
|
|
274258
|
-
import { execFile as
|
|
274259
|
-
var
|
|
274268
|
+
import { promisify as promisify7 } from "node:util";
|
|
274269
|
+
import { execFile as execFile7 } from "node:child_process";
|
|
274270
|
+
var execFileAsync6 = promisify7(execFile7);
|
|
274260
274271
|
var windowsBrowserProgIds = {
|
|
274261
274272
|
MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
|
|
274262
274273
|
// The missing `L` is correct.
|
|
@@ -274279,7 +274290,7 @@ var windowsBrowserProgIds = {
|
|
|
274279
274290
|
var _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
|
|
274280
274291
|
var UnknownBrowserError = class extends Error {
|
|
274281
274292
|
};
|
|
274282
|
-
async function defaultBrowser(_execFileAsync =
|
|
274293
|
+
async function defaultBrowser(_execFileAsync = execFileAsync6) {
|
|
274283
274294
|
const { stdout } = await _execFileAsync("reg", [
|
|
274284
274295
|
"QUERY",
|
|
274285
274296
|
" HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
|
|
@@ -274299,7 +274310,7 @@ async function defaultBrowser(_execFileAsync = execFileAsync5) {
|
|
|
274299
274310
|
}
|
|
274300
274311
|
|
|
274301
274312
|
// ../../node_modules/.pnpm/default-browser@5.4.0/node_modules/default-browser/index.js
|
|
274302
|
-
var
|
|
274313
|
+
var execFileAsync7 = promisify8(execFile8);
|
|
274303
274314
|
var titleize = (string4) => string4.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x2) => x2.toUpperCase());
|
|
274304
274315
|
async function defaultBrowser2() {
|
|
274305
274316
|
if (process7.platform === "darwin") {
|
|
@@ -274308,7 +274319,7 @@ async function defaultBrowser2() {
|
|
|
274308
274319
|
return { name: name25, id };
|
|
274309
274320
|
}
|
|
274310
274321
|
if (process7.platform === "linux") {
|
|
274311
|
-
const { stdout } = await
|
|
274322
|
+
const { stdout } = await execFileAsync7("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
|
|
274312
274323
|
const id = stdout.trim();
|
|
274313
274324
|
const name25 = titleize(id.replace(/.desktop$/, "").replace("-", " "));
|
|
274314
274325
|
return { name: name25, id };
|
|
@@ -274320,7 +274331,7 @@ async function defaultBrowser2() {
|
|
|
274320
274331
|
}
|
|
274321
274332
|
|
|
274322
274333
|
// ../../node_modules/.pnpm/open@10.2.0/node_modules/open/index.js
|
|
274323
|
-
var
|
|
274334
|
+
var execFile9 = promisify9(childProcess.execFile);
|
|
274324
274335
|
var __dirname2 = path36.dirname(fileURLToPath4(import.meta.url));
|
|
274325
274336
|
var localXdgOpenPath = path36.join(__dirname2, "xdg-open");
|
|
274326
274337
|
var { platform: platform2, arch } = process8;
|
|
@@ -274328,7 +274339,7 @@ async function getWindowsDefaultBrowserFromWsl() {
|
|
|
274328
274339
|
const powershellPath = await powerShellPath();
|
|
274329
274340
|
const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
|
|
274330
274341
|
const encodedCommand = Buffer2.from(rawCommand, "utf16le").toString("base64");
|
|
274331
|
-
const { stdout } = await
|
|
274342
|
+
const { stdout } = await execFile9(
|
|
274332
274343
|
powershellPath,
|
|
274333
274344
|
[
|
|
274334
274345
|
"-NoProfile",
|