revdeck 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +8 -1
- package/README.ru.md +8 -1
- package/dist/cli.js +183 -99
- package/dist/cli.js.map +3 -3
- package/dist/daemon.js +119 -61
- package/dist/daemon.js.map +3 -3
- package/dist/mcp.js +1 -1
- package/dist/mcp.js.map +1 -1
- package/docs/configuration.md +2 -0
- package/docs/integrations.md +3 -2
- package/docs/ru/configuration.md +2 -0
- package/docs/ru/integrations.md +2 -2
- package/package.json +1 -1
package/dist/daemon.js
CHANGED
|
@@ -299,11 +299,11 @@ function diffStats(files) {
|
|
|
299
299
|
function changedPaths(files) {
|
|
300
300
|
return files.map((file) => file.path);
|
|
301
301
|
}
|
|
302
|
-
function findFile(files,
|
|
303
|
-
return files.find((file) => file.path ===
|
|
302
|
+
function findFile(files, path10) {
|
|
303
|
+
return files.find((file) => file.path === path10) ?? files.find((file) => file.oldPath === path10);
|
|
304
304
|
}
|
|
305
|
-
function findNewLine(files,
|
|
306
|
-
const file = findFile(files,
|
|
305
|
+
function findNewLine(files, path10, line) {
|
|
306
|
+
const file = findFile(files, path10);
|
|
307
307
|
if (!file) return void 0;
|
|
308
308
|
for (const hunk of file.hunks) {
|
|
309
309
|
for (const item of hunk.lines) {
|
|
@@ -312,8 +312,8 @@ function findNewLine(files, path9, line) {
|
|
|
312
312
|
}
|
|
313
313
|
return void 0;
|
|
314
314
|
}
|
|
315
|
-
function snippetAround(files,
|
|
316
|
-
const file = findFile(files,
|
|
315
|
+
function snippetAround(files, path10, line, radius = 6) {
|
|
316
|
+
const file = findFile(files, path10);
|
|
317
317
|
if (!file || line == null) return null;
|
|
318
318
|
const flat = file.hunks.flatMap((hunk) => hunk.lines);
|
|
319
319
|
const target = flat.findIndex((item) => item.newLine === line);
|
|
@@ -326,9 +326,9 @@ function snippetAround(files, path9, line, radius = 6) {
|
|
|
326
326
|
target: item.newLine === line
|
|
327
327
|
}));
|
|
328
328
|
}
|
|
329
|
-
function linePosition(files,
|
|
330
|
-
const file = findFile(files,
|
|
331
|
-
const found = findNewLine(files,
|
|
329
|
+
function linePosition(files, path10, line) {
|
|
330
|
+
const file = findFile(files, path10);
|
|
331
|
+
const found = findNewLine(files, path10, line);
|
|
332
332
|
if (!file || !found) return null;
|
|
333
333
|
return { newPath: file.path, newLine: line, oldPath: file.oldPath, oldLine: found.kind === " " ? found.oldLine : null };
|
|
334
334
|
}
|
|
@@ -344,6 +344,9 @@ var init_diff = __esm({
|
|
|
344
344
|
|
|
345
345
|
// src/core/exec.ts
|
|
346
346
|
import { execFile } from "node:child_process";
|
|
347
|
+
import { access, constants } from "node:fs/promises";
|
|
348
|
+
import os2 from "node:os";
|
|
349
|
+
import path5 from "node:path";
|
|
347
350
|
function scrubEnv(extra) {
|
|
348
351
|
const env = {};
|
|
349
352
|
for (const [key, value] of Object.entries(process.env)) {
|
|
@@ -359,7 +362,45 @@ function scrubEnv(extra) {
|
|
|
359
362
|
env.TERM = "dumb";
|
|
360
363
|
return { ...env, ...extra };
|
|
361
364
|
}
|
|
362
|
-
|
|
365
|
+
async function resolveExecutable(command) {
|
|
366
|
+
if (command.includes("/") || command.includes("\\")) {
|
|
367
|
+
try {
|
|
368
|
+
await access(command, constants.X_OK);
|
|
369
|
+
return command;
|
|
370
|
+
} catch {
|
|
371
|
+
return null;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
const override = process.env[`REVDECK_${command.toUpperCase()}`];
|
|
375
|
+
if (override) return override;
|
|
376
|
+
const cached = RESOLVED.get(command);
|
|
377
|
+
if (cached) return cached;
|
|
378
|
+
const dirs = [
|
|
379
|
+
...(process.env.PATH ?? "").split(path5.delimiter),
|
|
380
|
+
path5.join(os2.homedir(), ".local", "bin"),
|
|
381
|
+
path5.join(os2.homedir(), ".local", "share", "mise", "shims"),
|
|
382
|
+
path5.join(os2.homedir(), ".asdf", "shims"),
|
|
383
|
+
path5.join(os2.homedir(), ".npm-global", "bin"),
|
|
384
|
+
"/opt/homebrew/bin",
|
|
385
|
+
"/usr/local/bin",
|
|
386
|
+
"/usr/bin",
|
|
387
|
+
"/bin"
|
|
388
|
+
].filter(Boolean);
|
|
389
|
+
const extensions = process.platform === "win32" ? (process.env.PATHEXT ?? ".EXE;.CMD;.BAT").split(";") : [""];
|
|
390
|
+
for (const dir of [...new Set(dirs)]) {
|
|
391
|
+
for (const extension of extensions) {
|
|
392
|
+
const candidate = path5.join(dir, `${command}${extension}`);
|
|
393
|
+
try {
|
|
394
|
+
await access(candidate, constants.X_OK);
|
|
395
|
+
RESOLVED.set(command, candidate);
|
|
396
|
+
return candidate;
|
|
397
|
+
} catch {
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
return null;
|
|
402
|
+
}
|
|
403
|
+
var SECRET_ENV, RESOLVED, run;
|
|
363
404
|
var init_exec = __esm({
|
|
364
405
|
"src/core/exec.ts"() {
|
|
365
406
|
"use strict";
|
|
@@ -375,41 +416,45 @@ var init_exec = __esm({
|
|
|
375
416
|
"SSH_ASKPASS",
|
|
376
417
|
"REVDECK_TOKEN"
|
|
377
418
|
];
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
const
|
|
396
|
-
|
|
397
|
-
|
|
419
|
+
RESOLVED = /* @__PURE__ */ new Map();
|
|
420
|
+
run = async (command, args, options = {}) => {
|
|
421
|
+
const executable = await resolveExecutable(command) ?? command;
|
|
422
|
+
return new Promise((resolve, reject) => {
|
|
423
|
+
const child = execFile(
|
|
424
|
+
executable,
|
|
425
|
+
args,
|
|
426
|
+
{
|
|
427
|
+
cwd: options.cwd,
|
|
428
|
+
env: scrubEnv(options.env),
|
|
429
|
+
timeout: options.timeoutMs ?? 12e4,
|
|
430
|
+
maxBuffer: options.maxBuffer ?? 64 * 1024 * 1024,
|
|
431
|
+
encoding: "utf8",
|
|
432
|
+
windowsHide: true,
|
|
433
|
+
shell: false
|
|
434
|
+
},
|
|
435
|
+
(error, stdout, stderr) => {
|
|
436
|
+
const exitCode = error?.code;
|
|
437
|
+
const code = typeof exitCode === "number" ? exitCode : error ? 1 : 0;
|
|
438
|
+
if (error && !(options.allowExitCodes ?? []).includes(code)) {
|
|
439
|
+
const reason = (stderr || stdout || error.message).trim();
|
|
440
|
+
reject(Object.assign(new Error(reason.slice(0, 4e3)), { command, code, stderr, stdout }));
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
resolve({ stdout, stderr, code });
|
|
398
444
|
}
|
|
399
|
-
|
|
445
|
+
);
|
|
446
|
+
if (options.input !== void 0) {
|
|
447
|
+
child.stdin?.end(options.input);
|
|
400
448
|
}
|
|
401
|
-
);
|
|
402
|
-
|
|
403
|
-
child.stdin?.end(options.input);
|
|
404
|
-
}
|
|
405
|
-
});
|
|
449
|
+
});
|
|
450
|
+
};
|
|
406
451
|
}
|
|
407
452
|
});
|
|
408
453
|
|
|
409
454
|
// src/providers/util.ts
|
|
410
455
|
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
411
456
|
import { tmpdir } from "node:os";
|
|
412
|
-
import
|
|
457
|
+
import path6 from "node:path";
|
|
413
458
|
function parseJson(stdout, source) {
|
|
414
459
|
const text2 = stdout.trim();
|
|
415
460
|
if (!text2) throw new ProviderError(tr(`${source}: \u043F\u0443\u0441\u0442\u043E\u0439 \u043E\u0442\u0432\u0435\u0442`, `${source}: empty response`));
|
|
@@ -422,6 +467,16 @@ function parseJson(stdout, source) {
|
|
|
422
467
|
function cliError(error, platform, host) {
|
|
423
468
|
const message = redact(error?.message ?? error).trim();
|
|
424
469
|
const lower = message.toLowerCase();
|
|
470
|
+
if (/enoent|executable file not found|spawn .* enoent/.test(lower)) {
|
|
471
|
+
const binary = platform === "gitlab" ? "glab" : "gh";
|
|
472
|
+
throw new ProviderError(
|
|
473
|
+
`${platform}: ${message}`,
|
|
474
|
+
tr(
|
|
475
|
+
`${binary} \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D \u0432 PATH \u0434\u0435\u043C\u043E\u043D\u0430: \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0435 \u0435\u0433\u043E, \u0434\u043E\u0431\u0430\u0432\u044C\u0442\u0435 \u043A\u0430\u0442\u0430\u043B\u043E\u0433 \u0432 PATH \u0438\u043B\u0438 \u0437\u0430\u0434\u0430\u0439\u0442\u0435 REVDECK_${binary.toUpperCase()}; \u043F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 revdeck doctor. \u0415\u0441\u043B\u0438 \u0434\u0435\u043C\u043E\u043D \u0437\u0430\u043F\u0443\u0449\u0435\u043D \u0432 \u043A\u043E\u043D\u0442\u0435\u0439\u043D\u0435\u0440\u0435 \u2014 \u043F\u0435\u0440\u0435\u043D\u0435\u0441\u0438\u0442\u0435 \u0435\u0433\u043E \u043D\u0430 \u0445\u043E\u0441\u0442`,
|
|
476
|
+
`${binary} is not in the daemon PATH: install it, add its directory to PATH or set REVDECK_${binary.toUpperCase()}; check revdeck doctor. If the daemon runs in a container, move it to the host`
|
|
477
|
+
)
|
|
478
|
+
);
|
|
479
|
+
}
|
|
425
480
|
if (/(auth|unauthor|401|403|not logged|token|credential|forbidden)/.test(lower)) {
|
|
426
481
|
const hint = platform === "gitlab" ? tr(`\u0432\u043E\u0439\u0434\u0438\u0442\u0435 \u0432 glab \u043D\u0430 \u044D\u0442\u043E\u043C \u0445\u043E\u0441\u0442\u0435: glab auth login --hostname ${host}`, `log in to glab for this host: glab auth login --hostname ${host}`) : tr(`\u0432\u043E\u0439\u0434\u0438\u0442\u0435 \u0432 gh: GH_HOST=${host} gh auth login`, `log in to gh: GH_HOST=${host} gh auth login`);
|
|
427
482
|
throw new AuthError(`${platform}: ${message || tr("\u043D\u0435\u0442 \u0430\u0432\u0442\u043E\u0440\u0438\u0437\u0430\u0446\u0438\u0438", "not authenticated")}`, hint);
|
|
@@ -430,8 +485,8 @@ function cliError(error, platform, host) {
|
|
|
430
485
|
throw new ProviderError(`${platform}: ${message || tr("\u043A\u043E\u043C\u0430\u043D\u0434\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043B\u0430\u0441\u044C \u0441 \u043E\u0448\u0438\u0431\u043A\u043E\u0439", "the command failed")}`);
|
|
431
486
|
}
|
|
432
487
|
async function withTempJson(data, fn) {
|
|
433
|
-
const dir = await mkdtemp(
|
|
434
|
-
const file =
|
|
488
|
+
const dir = await mkdtemp(path6.join(tmpdir(), "revdeck-"));
|
|
489
|
+
const file = path6.join(dir, "payload.json");
|
|
435
490
|
try {
|
|
436
491
|
await writeFile(file, JSON.stringify(data), { mode: 384, flag: "wx" });
|
|
437
492
|
return await fn(file);
|
|
@@ -439,8 +494,8 @@ async function withTempJson(data, fn) {
|
|
|
439
494
|
await rm(dir, { recursive: true, force: true });
|
|
440
495
|
}
|
|
441
496
|
}
|
|
442
|
-
function query(
|
|
443
|
-
const url = new URL(
|
|
497
|
+
function query(path10, params) {
|
|
498
|
+
const url = new URL(path10.startsWith("/") ? path10 : `/${path10}`, "http://local");
|
|
444
499
|
for (const [key, value] of Object.entries(params)) {
|
|
445
500
|
if (value !== void 0 && value !== "") url.searchParams.set(key, String(value));
|
|
446
501
|
}
|
|
@@ -1059,7 +1114,7 @@ rename to ${newPath}
|
|
|
1059
1114
|
import { existsSync as existsSync4, readFileSync } from "node:fs";
|
|
1060
1115
|
import { appendFile, open as open2, readFile as readFile3, unlink as unlink4 } from "node:fs/promises";
|
|
1061
1116
|
import net2 from "node:net";
|
|
1062
|
-
import
|
|
1117
|
+
import path9 from "node:path";
|
|
1063
1118
|
import { fileURLToPath } from "node:url";
|
|
1064
1119
|
import { parseArgs } from "node:util";
|
|
1065
1120
|
|
|
@@ -1167,7 +1222,7 @@ async function writeFileAtomic(file, data, mode = 384) {
|
|
|
1167
1222
|
init_redact();
|
|
1168
1223
|
|
|
1169
1224
|
// src/version.ts
|
|
1170
|
-
var VERSION = "0.3.
|
|
1225
|
+
var VERSION = "0.3.2";
|
|
1171
1226
|
var PROTOCOL_VERSION = 1;
|
|
1172
1227
|
|
|
1173
1228
|
// src/daemon/main.ts
|
|
@@ -1722,7 +1777,7 @@ import { EventEmitter } from "node:events";
|
|
|
1722
1777
|
import { createHash as createHash2, randomBytes } from "node:crypto";
|
|
1723
1778
|
import { mkdtemp as mkdtemp2, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
|
|
1724
1779
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
1725
|
-
import
|
|
1780
|
+
import path7 from "node:path";
|
|
1726
1781
|
|
|
1727
1782
|
// src/core/config.ts
|
|
1728
1783
|
import { z } from "zod";
|
|
@@ -1775,8 +1830,8 @@ function globToRegExp(glob) {
|
|
|
1775
1830
|
function escapeRegExp(value) {
|
|
1776
1831
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1777
1832
|
}
|
|
1778
|
-
function classifyFile(
|
|
1779
|
-
const lower =
|
|
1833
|
+
function classifyFile(path10) {
|
|
1834
|
+
const lower = path10.toLowerCase();
|
|
1780
1835
|
if (/(^|\/)(node_modules|dist|build|coverage|vendor)\//.test(lower)) return "generated";
|
|
1781
1836
|
if (/\.(md|mdx|rst|txt|adoc)$/.test(lower) || /(^|\/)(docs?|adr)\//.test(lower)) return "docs";
|
|
1782
1837
|
if (/(^|\/)(__tests__|tests?|spec|e2e)\//.test(lower) || /\.(test|spec)\.[cm]?[jt]sx?$/.test(lower) || /_test\.go$/.test(lower)) return "test";
|
|
@@ -2839,8 +2894,8 @@ ${errors.join("\n")}`));
|
|
|
2839
2894
|
if (!matchesSignature(buffer, spec.contentType)) {
|
|
2840
2895
|
throw new Error(tr("\u0432\u043B\u043E\u0436\u0435\u043D\u0438\u0435: \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u043C\u043E\u0435 \u043D\u0435 \u0441\u043E\u0432\u043F\u0430\u0434\u0430\u0435\u0442 \u0441 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0435\u043C", "attachment: content does not match the extension"));
|
|
2841
2896
|
}
|
|
2842
|
-
const dir = await mkdtemp2(
|
|
2843
|
-
const file =
|
|
2897
|
+
const dir = await mkdtemp2(path7.join(tmpdir4(), "revdeck-attachment-"));
|
|
2898
|
+
const file = path7.join(dir, spec.name);
|
|
2844
2899
|
try {
|
|
2845
2900
|
await writeFile2(file, buffer, { mode: 384, flag: "wx" });
|
|
2846
2901
|
const uploaded = await provider.upload({ path: file, name: spec.name, contentType: spec.contentType });
|
|
@@ -3319,7 +3374,7 @@ init_errors();
|
|
|
3319
3374
|
import http from "node:http";
|
|
3320
3375
|
import { createReadStream } from "node:fs";
|
|
3321
3376
|
import { readFile as readFile2, stat } from "node:fs/promises";
|
|
3322
|
-
import
|
|
3377
|
+
import path8 from "node:path";
|
|
3323
3378
|
import { timingSafeEqual } from "node:crypto";
|
|
3324
3379
|
|
|
3325
3380
|
// src/daemon/rpc.ts
|
|
@@ -3327,11 +3382,14 @@ import net from "node:net";
|
|
|
3327
3382
|
import { chmod, unlink as unlink2 } from "node:fs/promises";
|
|
3328
3383
|
init_redact();
|
|
3329
3384
|
init_errors();
|
|
3385
|
+
init_exec();
|
|
3330
3386
|
var MAX_LINE = 40 * 1024 * 1024;
|
|
3331
3387
|
async function dispatch(service, method, params) {
|
|
3332
3388
|
switch (method) {
|
|
3333
|
-
case "ping":
|
|
3334
|
-
|
|
3389
|
+
case "ping": {
|
|
3390
|
+
const [glab, gh, git] = await Promise.all(["glab", "gh", "git"].map((name) => resolveExecutable(name)));
|
|
3391
|
+
return { ok: true, version: VERSION, protocol: PROTOCOL_VERSION, pid: process.pid, binaries: { glab, gh, git } };
|
|
3392
|
+
}
|
|
3335
3393
|
case "reviews.list":
|
|
3336
3394
|
return { reviews: service.listReviews() };
|
|
3337
3395
|
case "reviews.open": {
|
|
@@ -3608,15 +3666,15 @@ async function startHttpServer(options) {
|
|
|
3608
3666
|
res.end('<meta charset="utf-8"><h1>\u041D\u0443\u0436\u043D\u0430 \u0441\u0441\u044B\u043B\u043A\u0430 \u0437\u0430\u043F\u0443\u0441\u043A\u0430</h1><p>\u041E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 \u0430\u0434\u0440\u0435\u0441 \u0438\u0437 \u0442\u0435\u0440\u043C\u0438\u043D\u0430\u043B\u0430: \u043E\u043D \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442 \u043E\u0434\u043D\u043E\u0440\u0430\u0437\u043E\u0432\u044B\u0439 \u0442\u043E\u043A\u0435\u043D.</p>');
|
|
3609
3667
|
return;
|
|
3610
3668
|
}
|
|
3611
|
-
const html = await readFile2(
|
|
3669
|
+
const html = await readFile2(path8.join(options.uiDir, "index.html"));
|
|
3612
3670
|
res.writeHead(200, { ...SECURITY_HEADERS, "content-type": MIME[".html"], "cache-control": "no-store" });
|
|
3613
3671
|
res.end(html);
|
|
3614
3672
|
return;
|
|
3615
3673
|
}
|
|
3616
3674
|
if (req.method === "GET" && (url.pathname.startsWith("/assets/") || url.pathname === "/favicon.svg")) {
|
|
3617
3675
|
const relative = url.pathname === "/favicon.svg" ? "favicon.svg" : url.pathname.slice("/assets/".length);
|
|
3618
|
-
const target =
|
|
3619
|
-
if (!target.startsWith(
|
|
3676
|
+
const target = path8.resolve(options.uiDir, url.pathname === "/favicon.svg" ? "" : "assets", relative);
|
|
3677
|
+
if (!target.startsWith(path8.resolve(options.uiDir) + path8.sep) || relative.includes("..")) {
|
|
3620
3678
|
reply(res, 404, { ok: false, error: "\u043D\u0435\u0442 \u0444\u0430\u0439\u043B\u0430" });
|
|
3621
3679
|
return;
|
|
3622
3680
|
}
|
|
@@ -3627,7 +3685,7 @@ async function startHttpServer(options) {
|
|
|
3627
3685
|
}
|
|
3628
3686
|
res.writeHead(200, {
|
|
3629
3687
|
...SECURITY_HEADERS,
|
|
3630
|
-
"content-type": MIME[
|
|
3688
|
+
"content-type": MIME[path8.extname(target)] ?? "application/octet-stream",
|
|
3631
3689
|
"cache-control": "public, max-age=31536000, immutable"
|
|
3632
3690
|
});
|
|
3633
3691
|
createReadStream(target).pipe(res);
|
|
@@ -3916,7 +3974,7 @@ async function main() {
|
|
|
3916
3974
|
});
|
|
3917
3975
|
const socket = socketPath();
|
|
3918
3976
|
const rpc = await startRpcServer(service, socket);
|
|
3919
|
-
const uiDir = values["ui-dir"] ?
|
|
3977
|
+
const uiDir = values["ui-dir"] ? path9.resolve(values["ui-dir"]) : path9.join(packageRoot(), "dist", "ui");
|
|
3920
3978
|
const http2 = await startHttpServer({
|
|
3921
3979
|
service,
|
|
3922
3980
|
token,
|
|
@@ -3967,7 +4025,7 @@ async function main() {
|
|
|
3967
4025
|
service.close();
|
|
3968
4026
|
await unlink4(daemonInfoPath()).catch(() => void 0);
|
|
3969
4027
|
await lock.close().catch(() => void 0);
|
|
3970
|
-
await unlink4(
|
|
4028
|
+
await unlink4(path9.join(stateDir(), "daemon.lock")).catch(() => void 0);
|
|
3971
4029
|
process.exit(0);
|
|
3972
4030
|
}
|
|
3973
4031
|
};
|
|
@@ -3979,9 +4037,9 @@ async function main() {
|
|
|
3979
4037
|
}
|
|
3980
4038
|
}
|
|
3981
4039
|
function packageRoot() {
|
|
3982
|
-
let dir =
|
|
4040
|
+
let dir = path9.dirname(fileURLToPath(import.meta.url));
|
|
3983
4041
|
for (; ; ) {
|
|
3984
|
-
const candidate =
|
|
4042
|
+
const candidate = path9.join(dir, "package.json");
|
|
3985
4043
|
if (existsSync4(candidate)) {
|
|
3986
4044
|
try {
|
|
3987
4045
|
const parsed = JSON.parse(readFileSync(candidate, "utf8"));
|
|
@@ -3989,7 +4047,7 @@ function packageRoot() {
|
|
|
3989
4047
|
} catch {
|
|
3990
4048
|
}
|
|
3991
4049
|
}
|
|
3992
|
-
const parent =
|
|
4050
|
+
const parent = path9.dirname(dir);
|
|
3993
4051
|
if (parent === dir) return process.cwd();
|
|
3994
4052
|
dir = parent;
|
|
3995
4053
|
}
|
|
@@ -4028,7 +4086,7 @@ async function runningDaemon() {
|
|
|
4028
4086
|
return reachable ? info : null;
|
|
4029
4087
|
}
|
|
4030
4088
|
async function acquireLock() {
|
|
4031
|
-
const file =
|
|
4089
|
+
const file = path9.join(stateDir(), "daemon.lock");
|
|
4032
4090
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
4033
4091
|
try {
|
|
4034
4092
|
const handle = await open2(file, "wx", 384);
|