@staff0rd/assist 0.508.0 → 0.510.0
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/commands/sessions/web/bundle.js +382 -382
- package/dist/index.js +189 -141
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.510.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -4501,9 +4501,9 @@ function forbiddenStrings() {
|
|
|
4501
4501
|
console.log("No forbidden-strings rules configured.");
|
|
4502
4502
|
process.exit(0);
|
|
4503
4503
|
}
|
|
4504
|
-
const
|
|
4504
|
+
const cache5 = /* @__PURE__ */ new Map();
|
|
4505
4505
|
const readJson = (file) => {
|
|
4506
|
-
if (
|
|
4506
|
+
if (cache5.has(file)) return cache5.get(file);
|
|
4507
4507
|
if (!existsSync13(file)) {
|
|
4508
4508
|
console.log(`Forbidden-strings file not found: ${file}`);
|
|
4509
4509
|
process.exit(1);
|
|
@@ -4515,7 +4515,7 @@ function forbiddenStrings() {
|
|
|
4515
4515
|
console.log(`Could not parse ${file}: ${error.message}`);
|
|
4516
4516
|
process.exit(1);
|
|
4517
4517
|
}
|
|
4518
|
-
|
|
4518
|
+
cache5.set(file, parsed);
|
|
4519
4519
|
return parsed;
|
|
4520
4520
|
};
|
|
4521
4521
|
const violations = findForbiddenStrings(rules2, readJson);
|
|
@@ -5053,7 +5053,7 @@ ${failed2.length} script(s) failed:`);
|
|
|
5053
5053
|
}
|
|
5054
5054
|
}
|
|
5055
5055
|
function runEntry(entry) {
|
|
5056
|
-
return new Promise((
|
|
5056
|
+
return new Promise((resolve23) => {
|
|
5057
5057
|
const startTime = Date.now();
|
|
5058
5058
|
const child = spawnCommand(
|
|
5059
5059
|
entry.fullCommand,
|
|
@@ -5065,7 +5065,7 @@ function runEntry(entry) {
|
|
|
5065
5065
|
child.on("close", (code) => {
|
|
5066
5066
|
const exitCode = code ?? 1;
|
|
5067
5067
|
flushIfFailed(exitCode, chunks);
|
|
5068
|
-
|
|
5068
|
+
resolve23({
|
|
5069
5069
|
script: entry.name,
|
|
5070
5070
|
code: exitCode,
|
|
5071
5071
|
durationMs: Date.now() - startTime
|
|
@@ -6229,8 +6229,8 @@ function spawnInherit(command, args, options2 = {}) {
|
|
|
6229
6229
|
env,
|
|
6230
6230
|
cwd: options2.cwd
|
|
6231
6231
|
});
|
|
6232
|
-
const done2 = new Promise((
|
|
6233
|
-
child.on("close", (code) =>
|
|
6232
|
+
const done2 = new Promise((resolve23, reject) => {
|
|
6233
|
+
child.on("close", (code) => resolve23(code ?? 0));
|
|
6234
6234
|
child.on("error", reject);
|
|
6235
6235
|
});
|
|
6236
6236
|
return { child, done: done2 };
|
|
@@ -7376,9 +7376,9 @@ Failed to launch Claude for ${context}: ${message3}`)
|
|
|
7376
7376
|
// src/commands/sessions/daemon/connectToDaemon.ts
|
|
7377
7377
|
import * as net from "net";
|
|
7378
7378
|
function connectToDaemon() {
|
|
7379
|
-
return new Promise((
|
|
7379
|
+
return new Promise((resolve23, reject) => {
|
|
7380
7380
|
const socket = net.connect(daemonPaths.socket);
|
|
7381
|
-
socket.once("connect", () =>
|
|
7381
|
+
socket.once("connect", () => resolve23(socket));
|
|
7382
7382
|
socket.once("error", reject);
|
|
7383
7383
|
});
|
|
7384
7384
|
}
|
|
@@ -7394,7 +7394,7 @@ async function isDaemonRunning() {
|
|
|
7394
7394
|
// src/commands/sessions/daemon/sendToDaemon.ts
|
|
7395
7395
|
var WRITE_TIMEOUT_MS = 500;
|
|
7396
7396
|
function sendToDaemon(message3) {
|
|
7397
|
-
return new Promise((
|
|
7397
|
+
return new Promise((resolve23, reject) => {
|
|
7398
7398
|
connectToDaemon().then((socket) => {
|
|
7399
7399
|
const timer = setTimeout(() => {
|
|
7400
7400
|
socket.destroy();
|
|
@@ -7408,7 +7408,7 @@ function sendToDaemon(message3) {
|
|
|
7408
7408
|
`, () => {
|
|
7409
7409
|
clearTimeout(timer);
|
|
7410
7410
|
socket.end();
|
|
7411
|
-
|
|
7411
|
+
resolve23();
|
|
7412
7412
|
});
|
|
7413
7413
|
}, reject);
|
|
7414
7414
|
});
|
|
@@ -7431,7 +7431,7 @@ function readSocketLines(socket, onLine) {
|
|
|
7431
7431
|
// src/commands/sessions/daemon/sendToDaemonAwaitAck.ts
|
|
7432
7432
|
var ACK_TIMEOUT_MS = 1e3;
|
|
7433
7433
|
function sendToDaemonAwaitAck(message3) {
|
|
7434
|
-
return new Promise((
|
|
7434
|
+
return new Promise((resolve23, reject) => {
|
|
7435
7435
|
connectToDaemon().then((socket) => {
|
|
7436
7436
|
let settled = false;
|
|
7437
7437
|
const finish = (error) => {
|
|
@@ -7440,7 +7440,7 @@ function sendToDaemonAwaitAck(message3) {
|
|
|
7440
7440
|
clearTimeout(timer);
|
|
7441
7441
|
socket.destroy();
|
|
7442
7442
|
if (error) reject(error);
|
|
7443
|
-
else
|
|
7443
|
+
else resolve23();
|
|
7444
7444
|
};
|
|
7445
7445
|
const timer = setTimeout(
|
|
7446
7446
|
() => finish(new Error("timed out awaiting daemon ack")),
|
|
@@ -7514,7 +7514,7 @@ async function deliverReliably(sessionId, status3, payload) {
|
|
|
7514
7514
|
}
|
|
7515
7515
|
}
|
|
7516
7516
|
function sleep(ms) {
|
|
7517
|
-
return new Promise((
|
|
7517
|
+
return new Promise((resolve23) => setTimeout(resolve23, ms));
|
|
7518
7518
|
}
|
|
7519
7519
|
function describeError(error) {
|
|
7520
7520
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -9196,7 +9196,7 @@ function spawnDaemon(reason4) {
|
|
|
9196
9196
|
child.unref();
|
|
9197
9197
|
}
|
|
9198
9198
|
function delay(ms) {
|
|
9199
|
-
return new Promise((
|
|
9199
|
+
return new Promise((resolve23) => setTimeout(resolve23, ms));
|
|
9200
9200
|
}
|
|
9201
9201
|
|
|
9202
9202
|
// src/commands/sessions/daemon/isWindowsCwd.ts
|
|
@@ -9237,10 +9237,10 @@ function gitInvocation(cwd, args) {
|
|
|
9237
9237
|
}
|
|
9238
9238
|
function git2(cwd, args) {
|
|
9239
9239
|
const { file, argv, options: options2 } = gitInvocation(cwd, args);
|
|
9240
|
-
return new Promise((
|
|
9240
|
+
return new Promise((resolve23, reject) => {
|
|
9241
9241
|
execFile2(file, argv, options2, (error, stdout) => {
|
|
9242
9242
|
if (error) reject(error);
|
|
9243
|
-
else
|
|
9243
|
+
else resolve23(stdout.toString());
|
|
9244
9244
|
});
|
|
9245
9245
|
});
|
|
9246
9246
|
}
|
|
@@ -9394,19 +9394,19 @@ import { dirname as dirname20, join as join25 } from "path";
|
|
|
9394
9394
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
9395
9395
|
function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
|
|
9396
9396
|
const file = join25(dirname20(fileURLToPath4(importMetaUrl)), bundlePath);
|
|
9397
|
-
let
|
|
9397
|
+
let cache5;
|
|
9398
9398
|
return (req, res) => {
|
|
9399
9399
|
const mtimeMs = statSync3(file).mtimeMs;
|
|
9400
|
-
if (
|
|
9400
|
+
if (cache5?.mtimeMs !== mtimeMs) {
|
|
9401
9401
|
const body = readFileSync20(file, "utf8");
|
|
9402
9402
|
const etag = `"${createHash("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
9403
|
-
|
|
9403
|
+
cache5 = { body, etag, mtimeMs };
|
|
9404
9404
|
}
|
|
9405
9405
|
const headers = {
|
|
9406
|
-
ETag:
|
|
9406
|
+
ETag: cache5.etag,
|
|
9407
9407
|
"Cache-Control": "no-cache"
|
|
9408
9408
|
};
|
|
9409
|
-
if (req.headers["if-none-match"] ===
|
|
9409
|
+
if (req.headers["if-none-match"] === cache5.etag) {
|
|
9410
9410
|
res.writeHead(304, headers);
|
|
9411
9411
|
res.end();
|
|
9412
9412
|
return;
|
|
@@ -9415,7 +9415,7 @@ function createBundleHandler(importMetaUrl, bundlePath, contentType = "applicati
|
|
|
9415
9415
|
"Content-Type": contentType,
|
|
9416
9416
|
...headers
|
|
9417
9417
|
});
|
|
9418
|
-
res.end(
|
|
9418
|
+
res.end(cache5.body);
|
|
9419
9419
|
};
|
|
9420
9420
|
}
|
|
9421
9421
|
|
|
@@ -9652,12 +9652,12 @@ async function loadVisibleItems(req) {
|
|
|
9652
9652
|
|
|
9653
9653
|
// src/commands/backlog/web/parseStatusBody.ts
|
|
9654
9654
|
function readBody(req) {
|
|
9655
|
-
return new Promise((
|
|
9655
|
+
return new Promise((resolve23, reject) => {
|
|
9656
9656
|
let body = "";
|
|
9657
9657
|
req.on("data", (chunk) => {
|
|
9658
9658
|
body += chunk.toString();
|
|
9659
9659
|
});
|
|
9660
|
-
req.on("end", () =>
|
|
9660
|
+
req.on("end", () => resolve23(body));
|
|
9661
9661
|
req.on("error", reject);
|
|
9662
9662
|
});
|
|
9663
9663
|
}
|
|
@@ -10663,6 +10663,48 @@ function githubUrl(req, res) {
|
|
|
10663
10663
|
});
|
|
10664
10664
|
}
|
|
10665
10665
|
|
|
10666
|
+
// src/commands/sessions/web/gitBranchInfo.ts
|
|
10667
|
+
var CACHE_TTL_MS2 = 3e4;
|
|
10668
|
+
var EMPTY = {
|
|
10669
|
+
branch: null,
|
|
10670
|
+
defaultBranch: null,
|
|
10671
|
+
onDefaultBranch: false
|
|
10672
|
+
};
|
|
10673
|
+
var cache4 = /* @__PURE__ */ new Map();
|
|
10674
|
+
async function currentBranch3(cwd) {
|
|
10675
|
+
try {
|
|
10676
|
+
const branch2 = (await execGit(cwd, ["rev-parse", "--abbrev-ref", "HEAD"])).trim();
|
|
10677
|
+
return branch2 && branch2 !== "HEAD" ? branch2 : null;
|
|
10678
|
+
} catch {
|
|
10679
|
+
return null;
|
|
10680
|
+
}
|
|
10681
|
+
}
|
|
10682
|
+
async function resolve11(cwd) {
|
|
10683
|
+
const [branch2, defaultRef] = await Promise.all([
|
|
10684
|
+
currentBranch3(cwd),
|
|
10685
|
+
defaultBranchRef(cwd).catch(() => void 0)
|
|
10686
|
+
]);
|
|
10687
|
+
const defaultBranch = defaultRef ?? null;
|
|
10688
|
+
return {
|
|
10689
|
+
branch: branch2,
|
|
10690
|
+
defaultBranch,
|
|
10691
|
+
onDefaultBranch: branch2 !== null && defaultBranch !== null && defaultBranch === `origin/${branch2}`
|
|
10692
|
+
};
|
|
10693
|
+
}
|
|
10694
|
+
async function gitBranchInfo(cwd) {
|
|
10695
|
+
const now = Date.now();
|
|
10696
|
+
const cached = cache4.get(cwd);
|
|
10697
|
+
if (cached && cached.expires > now) return cached.value;
|
|
10698
|
+
let value = EMPTY;
|
|
10699
|
+
try {
|
|
10700
|
+
value = await resolve11(cwd);
|
|
10701
|
+
} catch {
|
|
10702
|
+
value = EMPTY;
|
|
10703
|
+
}
|
|
10704
|
+
cache4.set(cwd, { value, expires: now + CACHE_TTL_MS2 });
|
|
10705
|
+
return value;
|
|
10706
|
+
}
|
|
10707
|
+
|
|
10666
10708
|
// src/commands/sessions/web/parseDiffNameStatus.ts
|
|
10667
10709
|
function categorize(code) {
|
|
10668
10710
|
switch (code) {
|
|
@@ -10694,6 +10736,26 @@ function parseDiffNameStatus(output) {
|
|
|
10694
10736
|
return result;
|
|
10695
10737
|
}
|
|
10696
10738
|
|
|
10739
|
+
// src/commands/sessions/web/groupedCounts.ts
|
|
10740
|
+
async function untrackedPaths(cwd) {
|
|
10741
|
+
const list5 = await execGit(cwd, [
|
|
10742
|
+
"ls-files",
|
|
10743
|
+
"--others",
|
|
10744
|
+
"--exclude-standard"
|
|
10745
|
+
]);
|
|
10746
|
+
return list5.split("\n").filter(Boolean);
|
|
10747
|
+
}
|
|
10748
|
+
async function groupedCounts(cwd, groups) {
|
|
10749
|
+
const outputs = await Promise.all(
|
|
10750
|
+
groups.map(
|
|
10751
|
+
(group) => execGit(cwd, ["diff", "--name-status", group.base, "--", ...group.paths])
|
|
10752
|
+
)
|
|
10753
|
+
);
|
|
10754
|
+
const counts = parseDiffNameStatus(outputs.join(""));
|
|
10755
|
+
counts.new.push(...await untrackedPaths(cwd));
|
|
10756
|
+
return counts;
|
|
10757
|
+
}
|
|
10758
|
+
|
|
10697
10759
|
// src/commands/sessions/web/parseGitStatus.ts
|
|
10698
10760
|
function extractPath(rest) {
|
|
10699
10761
|
const arrow = rest.indexOf(" -> ");
|
|
@@ -10721,25 +10783,7 @@ function parseGitStatus(output) {
|
|
|
10721
10783
|
return result;
|
|
10722
10784
|
}
|
|
10723
10785
|
|
|
10724
|
-
// src/commands/sessions/web/
|
|
10725
|
-
async function untrackedPaths(cwd) {
|
|
10726
|
-
const list5 = await execGit(cwd, [
|
|
10727
|
-
"ls-files",
|
|
10728
|
-
"--others",
|
|
10729
|
-
"--exclude-standard"
|
|
10730
|
-
]);
|
|
10731
|
-
return list5.split("\n").filter(Boolean);
|
|
10732
|
-
}
|
|
10733
|
-
async function groupedCounts(cwd, groups) {
|
|
10734
|
-
const outputs = await Promise.all(
|
|
10735
|
-
groups.map(
|
|
10736
|
-
(group) => execGit(cwd, ["diff", "--name-status", group.base, "--", ...group.paths])
|
|
10737
|
-
)
|
|
10738
|
-
);
|
|
10739
|
-
const counts = parseDiffNameStatus(outputs.join(""));
|
|
10740
|
-
counts.new.push(...await untrackedPaths(cwd));
|
|
10741
|
-
return counts;
|
|
10742
|
-
}
|
|
10786
|
+
// src/commands/sessions/web/workingTreeCounts.ts
|
|
10743
10787
|
async function workingTreeCounts(cwd) {
|
|
10744
10788
|
const output = await execGit(cwd, [
|
|
10745
10789
|
"status",
|
|
@@ -10748,15 +10792,18 @@ async function workingTreeCounts(cwd) {
|
|
|
10748
10792
|
]);
|
|
10749
10793
|
return parseGitStatus(output);
|
|
10750
10794
|
}
|
|
10795
|
+
|
|
10796
|
+
// src/commands/sessions/web/gitStatus.ts
|
|
10751
10797
|
async function gitStatus(req, res) {
|
|
10752
10798
|
const cwd = getCwdParam(req, res);
|
|
10753
10799
|
if (!cwd) return;
|
|
10754
10800
|
try {
|
|
10801
|
+
const branch2 = await gitBranchInfo(cwd);
|
|
10755
10802
|
const changeSet = await itemChangeSet(cwd, getSessionParam(req)).catch(
|
|
10756
10803
|
() => void 0
|
|
10757
10804
|
);
|
|
10758
10805
|
if (!changeSet) {
|
|
10759
|
-
respondJson(res, 200, await workingTreeCounts(cwd));
|
|
10806
|
+
respondJson(res, 200, { ...await workingTreeCounts(cwd), ...branch2 });
|
|
10760
10807
|
return;
|
|
10761
10808
|
}
|
|
10762
10809
|
const [counts, uncommitted] = await Promise.all([
|
|
@@ -10765,6 +10812,7 @@ async function gitStatus(req, res) {
|
|
|
10765
10812
|
]);
|
|
10766
10813
|
respondJson(res, 200, {
|
|
10767
10814
|
...counts,
|
|
10815
|
+
...branch2,
|
|
10768
10816
|
uncommitted,
|
|
10769
10817
|
hasCommits: changeSet.commits.length > 0
|
|
10770
10818
|
});
|
|
@@ -10841,7 +10889,7 @@ function rankFilePaths(paths, query, limit) {
|
|
|
10841
10889
|
|
|
10842
10890
|
// src/commands/sessions/web/listFiles.ts
|
|
10843
10891
|
var MAX_RESULTS = 20;
|
|
10844
|
-
var
|
|
10892
|
+
var CACHE_TTL_MS3 = 5e3;
|
|
10845
10893
|
var LS_FILES_MAX_BUFFER = 32 * 1024 * 1024;
|
|
10846
10894
|
var fileListCache = /* @__PURE__ */ new Map();
|
|
10847
10895
|
async function repoFiles(cwd) {
|
|
@@ -10853,7 +10901,7 @@ async function repoFiles(cwd) {
|
|
|
10853
10901
|
{ maxBuffer: LS_FILES_MAX_BUFFER }
|
|
10854
10902
|
);
|
|
10855
10903
|
const files = [...new Set(output.split(/\r?\n/).filter(Boolean))];
|
|
10856
|
-
fileListCache.set(cwd, { files, expires: Date.now() +
|
|
10904
|
+
fileListCache.set(cwd, { files, expires: Date.now() + CACHE_TTL_MS3 });
|
|
10857
10905
|
return files;
|
|
10858
10906
|
}
|
|
10859
10907
|
async function listFiles(req, res) {
|
|
@@ -11079,14 +11127,14 @@ async function openInCode(req, res) {
|
|
|
11079
11127
|
import { execFile as execFile5 } from "child_process";
|
|
11080
11128
|
import { promisify as promisify5 } from "util";
|
|
11081
11129
|
var execFileAsync4 = promisify5(execFile5);
|
|
11082
|
-
var
|
|
11130
|
+
var CACHE_TTL_MS4 = 3e4;
|
|
11083
11131
|
function createCachedGhJson(args, parse3, fallback, options2 = {}) {
|
|
11084
11132
|
const { cacheFallback = true } = options2;
|
|
11085
|
-
const
|
|
11133
|
+
const cache5 = /* @__PURE__ */ new Map();
|
|
11086
11134
|
return async (cwd, extraArgs = []) => {
|
|
11087
11135
|
const key = extraArgs.length ? `${cwd}\0${extraArgs.join("\0")}` : cwd;
|
|
11088
11136
|
const now = Date.now();
|
|
11089
|
-
const cached =
|
|
11137
|
+
const cached = cache5.get(key);
|
|
11090
11138
|
if (cached && cached.expires > now) return cached.value;
|
|
11091
11139
|
let value = fallback;
|
|
11092
11140
|
try {
|
|
@@ -11100,7 +11148,7 @@ function createCachedGhJson(args, parse3, fallback, options2 = {}) {
|
|
|
11100
11148
|
value = fallback;
|
|
11101
11149
|
}
|
|
11102
11150
|
if (cacheFallback || value !== fallback)
|
|
11103
|
-
|
|
11151
|
+
cache5.set(key, { value, expires: now + CACHE_TTL_MS4 });
|
|
11104
11152
|
return value;
|
|
11105
11153
|
};
|
|
11106
11154
|
}
|
|
@@ -11221,17 +11269,17 @@ async function stopDaemon() {
|
|
|
11221
11269
|
}
|
|
11222
11270
|
}
|
|
11223
11271
|
function closedBeforeTimeout(socket) {
|
|
11224
|
-
return new Promise((
|
|
11272
|
+
return new Promise((resolve23) => {
|
|
11225
11273
|
const timer = setTimeout(() => {
|
|
11226
11274
|
socket.destroy();
|
|
11227
|
-
|
|
11275
|
+
resolve23(false);
|
|
11228
11276
|
}, STOP_TIMEOUT_MS);
|
|
11229
11277
|
socket.resume();
|
|
11230
11278
|
socket.on("error", () => {
|
|
11231
11279
|
});
|
|
11232
11280
|
socket.once("close", () => {
|
|
11233
11281
|
clearTimeout(timer);
|
|
11234
|
-
|
|
11282
|
+
resolve23(true);
|
|
11235
11283
|
});
|
|
11236
11284
|
});
|
|
11237
11285
|
}
|
|
@@ -11282,8 +11330,8 @@ async function restartWeb(req, res, deps2 = {}) {
|
|
|
11282
11330
|
respondJson(res, 400, { error: "Invalid target" });
|
|
11283
11331
|
return;
|
|
11284
11332
|
}
|
|
11285
|
-
await new Promise((
|
|
11286
|
-
res.once("finish",
|
|
11333
|
+
await new Promise((resolve23) => {
|
|
11334
|
+
res.once("finish", resolve23);
|
|
11287
11335
|
respondJson(res, 200, { ok: true });
|
|
11288
11336
|
});
|
|
11289
11337
|
if (target === "daemon" || target === "both") {
|
|
@@ -12000,22 +12048,22 @@ import { readFileSync as readFileSync22 } from "fs";
|
|
|
12000
12048
|
import { createRequire as createRequire2 } from "module";
|
|
12001
12049
|
var require3 = createRequire2(import.meta.url);
|
|
12002
12050
|
function createCssHandler(packageEntry) {
|
|
12003
|
-
let
|
|
12051
|
+
let cache5;
|
|
12004
12052
|
return (req, res) => {
|
|
12005
|
-
if (!
|
|
12053
|
+
if (!cache5) {
|
|
12006
12054
|
const resolved = require3.resolve(packageEntry);
|
|
12007
12055
|
const body = readFileSync22(resolved, "utf8");
|
|
12008
12056
|
const etag = `"${createHash2("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
12009
|
-
|
|
12057
|
+
cache5 = { body, etag };
|
|
12010
12058
|
}
|
|
12011
|
-
const headers = { ETag:
|
|
12012
|
-
if (req.headers["if-none-match"] ===
|
|
12059
|
+
const headers = { ETag: cache5.etag, "Cache-Control": "no-cache" };
|
|
12060
|
+
if (req.headers["if-none-match"] === cache5.etag) {
|
|
12013
12061
|
res.writeHead(304, headers);
|
|
12014
12062
|
res.end();
|
|
12015
12063
|
return;
|
|
12016
12064
|
}
|
|
12017
12065
|
res.writeHead(200, { "Content-Type": "text/css", ...headers });
|
|
12018
|
-
res.end(
|
|
12066
|
+
res.end(cache5.body);
|
|
12019
12067
|
};
|
|
12020
12068
|
}
|
|
12021
12069
|
|
|
@@ -13300,7 +13348,7 @@ function parsePreviewDecision(line, requestId) {
|
|
|
13300
13348
|
|
|
13301
13349
|
// src/commands/sessions/shared/requestPreviewDecision.ts
|
|
13302
13350
|
function requestPreviewDecision(request) {
|
|
13303
|
-
return new Promise((
|
|
13351
|
+
return new Promise((resolve23, reject) => {
|
|
13304
13352
|
connectToDaemon().then((socket) => {
|
|
13305
13353
|
let settled = false;
|
|
13306
13354
|
const finish = (error, decision) => {
|
|
@@ -13308,7 +13356,7 @@ function requestPreviewDecision(request) {
|
|
|
13308
13356
|
settled = true;
|
|
13309
13357
|
socket.destroy();
|
|
13310
13358
|
if (error) reject(error);
|
|
13311
|
-
else
|
|
13359
|
+
else resolve23(decision);
|
|
13312
13360
|
};
|
|
13313
13361
|
readSocketLines(socket, (line) => {
|
|
13314
13362
|
const incoming = parsePreviewDecision(line, request.requestId);
|
|
@@ -15456,7 +15504,7 @@ function findBuiltinDenyRaw(rawCommand) {
|
|
|
15456
15504
|
}
|
|
15457
15505
|
|
|
15458
15506
|
// src/shared/isApprovedRead.ts
|
|
15459
|
-
import { resolve as
|
|
15507
|
+
import { resolve as resolve13, sep } from "path";
|
|
15460
15508
|
|
|
15461
15509
|
// src/shared/tokenize.ts
|
|
15462
15510
|
function tokenize(command) {
|
|
@@ -15538,7 +15586,7 @@ function extractGraphqlQuery(args) {
|
|
|
15538
15586
|
|
|
15539
15587
|
// src/shared/loadCliReads.ts
|
|
15540
15588
|
import { existsSync as existsSync30, readFileSync as readFileSync25, writeFileSync as writeFileSync22 } from "fs";
|
|
15541
|
-
import { dirname as dirname22, resolve as
|
|
15589
|
+
import { dirname as dirname22, resolve as resolve12 } from "path";
|
|
15542
15590
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
15543
15591
|
var __filename3 = fileURLToPath5(import.meta.url);
|
|
15544
15592
|
var __dirname4 = dirname22(__filename3);
|
|
@@ -15553,13 +15601,13 @@ var cachedReads;
|
|
|
15553
15601
|
var cachedWrites;
|
|
15554
15602
|
function getCliReadsLines() {
|
|
15555
15603
|
if (!cachedReads) {
|
|
15556
|
-
cachedReads = readLines(
|
|
15604
|
+
cachedReads = readLines(resolve12(packageRoot(), "allowed.cli-reads"));
|
|
15557
15605
|
}
|
|
15558
15606
|
return cachedReads;
|
|
15559
15607
|
}
|
|
15560
15608
|
function getCliWritesLines() {
|
|
15561
15609
|
if (!cachedWrites) {
|
|
15562
|
-
cachedWrites = readLines(
|
|
15610
|
+
cachedWrites = readLines(resolve12(packageRoot(), "allowed.cli-writes"));
|
|
15563
15611
|
}
|
|
15564
15612
|
return cachedWrites;
|
|
15565
15613
|
}
|
|
@@ -15568,7 +15616,7 @@ function loadCliReads() {
|
|
|
15568
15616
|
}
|
|
15569
15617
|
function saveCliReads(commands) {
|
|
15570
15618
|
writeFileSync22(
|
|
15571
|
-
|
|
15619
|
+
resolve12(packageRoot(), "allowed.cli-reads"),
|
|
15572
15620
|
`${commands.join("\n")}
|
|
15573
15621
|
`
|
|
15574
15622
|
);
|
|
@@ -15697,19 +15745,19 @@ function isCdToCwd(command) {
|
|
|
15697
15745
|
const parts = command.split(/\s+/);
|
|
15698
15746
|
if (parts[0] !== "cd" || parts.length > 2) return false;
|
|
15699
15747
|
if (parts.length === 1) return false;
|
|
15700
|
-
const resolved =
|
|
15701
|
-
return resolved ===
|
|
15748
|
+
const resolved = resolve13(normalizeMsysPath(parts[1]));
|
|
15749
|
+
return resolved === resolve13(process.cwd());
|
|
15702
15750
|
}
|
|
15703
15751
|
function isCdToReadAllowedDir(command) {
|
|
15704
15752
|
const parts = command.split(/\s+/);
|
|
15705
15753
|
if (parts[0] !== "cd" || parts.length !== 2) return void 0;
|
|
15706
|
-
const target =
|
|
15754
|
+
const target = resolve13(normalizeMsysPath(parts[1]));
|
|
15707
15755
|
for (const entry of readSettingsPerms("allow")) {
|
|
15708
15756
|
const m = entry.match(READ_RE);
|
|
15709
15757
|
if (!m) continue;
|
|
15710
15758
|
const base = globBaseDir(m[1]);
|
|
15711
15759
|
if (!base) continue;
|
|
15712
|
-
const resolved =
|
|
15760
|
+
const resolved = resolve13(normalizeMsysPath(base));
|
|
15713
15761
|
if (target === resolved || target.startsWith(resolved + sep)) {
|
|
15714
15762
|
return `cd to Read-allowed directory: ${entry}`;
|
|
15715
15763
|
}
|
|
@@ -16021,12 +16069,12 @@ function hasSubcommands(helpText) {
|
|
|
16021
16069
|
// src/commands/permitCliReads/runHelp.ts
|
|
16022
16070
|
import { exec as exec2 } from "child_process";
|
|
16023
16071
|
function runHelp(args) {
|
|
16024
|
-
return new Promise((
|
|
16072
|
+
return new Promise((resolve23) => {
|
|
16025
16073
|
exec2(
|
|
16026
16074
|
`${args.join(" ")} --help`,
|
|
16027
16075
|
{ encoding: "utf8", timeout: 3e4 },
|
|
16028
16076
|
(_err, stdout, stderr) => {
|
|
16029
|
-
|
|
16077
|
+
resolve23(stdout || stderr || "");
|
|
16030
16078
|
}
|
|
16031
16079
|
);
|
|
16032
16080
|
});
|
|
@@ -20105,7 +20153,7 @@ function placedByDaemon() {
|
|
|
20105
20153
|
function seed(worktreePath, clone) {
|
|
20106
20154
|
console.log(`Preparing ${worktreePath}\u2026`);
|
|
20107
20155
|
return new Promise(
|
|
20108
|
-
(
|
|
20156
|
+
(resolve23) => seedWorktree(worktreePath, clone, resolve23)
|
|
20109
20157
|
);
|
|
20110
20158
|
}
|
|
20111
20159
|
async function moveToPrCheckoutTree() {
|
|
@@ -20154,11 +20202,11 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
20154
20202
|
}
|
|
20155
20203
|
|
|
20156
20204
|
// src/commands/review/checkoutPr.ts
|
|
20157
|
-
function
|
|
20205
|
+
function currentBranch4() {
|
|
20158
20206
|
return gitSyncOrNull(process.cwd(), ["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
20159
20207
|
}
|
|
20160
20208
|
function moveToExistingCheckout(number, headRef) {
|
|
20161
|
-
if (
|
|
20209
|
+
if (currentBranch4() === headRef) {
|
|
20162
20210
|
console.log(`Already on ${headRef} for PR #${number}; reviewing here.`);
|
|
20163
20211
|
return true;
|
|
20164
20212
|
}
|
|
@@ -20268,12 +20316,12 @@ function registerList(program2) {
|
|
|
20268
20316
|
|
|
20269
20317
|
// src/commands/mermaid/index.ts
|
|
20270
20318
|
import { mkdirSync as mkdirSync17, readdirSync as readdirSync9 } from "fs";
|
|
20271
|
-
import { resolve as
|
|
20319
|
+
import { resolve as resolve15 } from "path";
|
|
20272
20320
|
import chalk164 from "chalk";
|
|
20273
20321
|
|
|
20274
20322
|
// src/commands/mermaid/exportFile.ts
|
|
20275
20323
|
import { readFileSync as readFileSync38, writeFileSync as writeFileSync31 } from "fs";
|
|
20276
|
-
import { basename as basename15, extname as extname2, resolve as
|
|
20324
|
+
import { basename as basename15, extname as extname2, resolve as resolve14 } from "path";
|
|
20277
20325
|
import chalk163 from "chalk";
|
|
20278
20326
|
|
|
20279
20327
|
// src/commands/mermaid/renderBlock.ts
|
|
@@ -20321,7 +20369,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
20321
20369
|
for (const [i, source] of blocks.entries()) {
|
|
20322
20370
|
const idx = i + 1;
|
|
20323
20371
|
if (onlyIndex !== void 0 && idx !== onlyIndex) continue;
|
|
20324
|
-
const outPath =
|
|
20372
|
+
const outPath = resolve14(outDir, `${stem}-${idx}.svg`);
|
|
20325
20373
|
const svg = await renderBlock(krokiUrl, source);
|
|
20326
20374
|
writeFileSync31(outPath, svg, "utf8");
|
|
20327
20375
|
console.log(chalk163.green(` \u2192 ${outPath}`));
|
|
@@ -20335,7 +20383,7 @@ function extractMermaidBlocks(markdown) {
|
|
|
20335
20383
|
// src/commands/mermaid/index.ts
|
|
20336
20384
|
async function mermaidExport(file, options2 = {}) {
|
|
20337
20385
|
const { mermaid } = loadConfig();
|
|
20338
|
-
const outDir =
|
|
20386
|
+
const outDir = resolve15(process.cwd(), options2.out ?? ".");
|
|
20339
20387
|
mkdirSync17(outDir, { recursive: true });
|
|
20340
20388
|
if (options2.index !== void 0) {
|
|
20341
20389
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
@@ -20519,7 +20567,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
20519
20567
|
}
|
|
20520
20568
|
|
|
20521
20569
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
20522
|
-
import { isAbsolute as isAbsolute3, join as join53, resolve as
|
|
20570
|
+
import { isAbsolute as isAbsolute3, join as join53, resolve as resolve16 } from "path";
|
|
20523
20571
|
|
|
20524
20572
|
// src/commands/netcap/defaultCapturePath.ts
|
|
20525
20573
|
import { homedir as homedir19 } from "os";
|
|
@@ -20531,7 +20579,7 @@ function defaultCapturePath() {
|
|
|
20531
20579
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
20532
20580
|
function resolveNetcapOutPath(out) {
|
|
20533
20581
|
if (!out) return defaultCapturePath();
|
|
20534
|
-
const dir = isAbsolute3(out) ? out :
|
|
20582
|
+
const dir = isAbsolute3(out) ? out : resolve16(process.cwd(), out);
|
|
20535
20583
|
return join53(dir, "capture.jsonl");
|
|
20536
20584
|
}
|
|
20537
20585
|
|
|
@@ -20622,25 +20670,25 @@ function isVisibleText(t) {
|
|
|
20622
20670
|
return /[a-zA-Z]{3,}/.test(t);
|
|
20623
20671
|
}
|
|
20624
20672
|
var isHashtag = (t) => /^#[A-Za-z0-9_]+$/.test(t);
|
|
20625
|
-
function collectRscText(v,
|
|
20673
|
+
function collectRscText(v, resolve23, sink2, seen) {
|
|
20626
20674
|
if (v == null) return;
|
|
20627
20675
|
if (typeof v === "string") {
|
|
20628
20676
|
if (isRscRef(v)) {
|
|
20629
20677
|
if (!seen.has(v)) {
|
|
20630
20678
|
seen.add(v);
|
|
20631
|
-
collectRscText(
|
|
20679
|
+
collectRscText(resolve23(v), resolve23, sink2, seen);
|
|
20632
20680
|
}
|
|
20633
20681
|
} else if (isHashtag(v)) sink2.hashtags.push(v);
|
|
20634
20682
|
else if (isVisibleText(v)) sink2.text.push(v);
|
|
20635
20683
|
return;
|
|
20636
20684
|
}
|
|
20637
20685
|
if (Array.isArray(v)) {
|
|
20638
|
-
for (const x of v) collectRscText(x,
|
|
20686
|
+
for (const x of v) collectRscText(x, resolve23, sink2, seen);
|
|
20639
20687
|
return;
|
|
20640
20688
|
}
|
|
20641
20689
|
if (typeof v === "object") {
|
|
20642
20690
|
for (const val of Object.values(v)) {
|
|
20643
|
-
collectRscText(val,
|
|
20691
|
+
collectRscText(val, resolve23, sink2, seen);
|
|
20644
20692
|
}
|
|
20645
20693
|
}
|
|
20646
20694
|
}
|
|
@@ -20672,7 +20720,7 @@ function visitObjects(root, fn) {
|
|
|
20672
20720
|
}
|
|
20673
20721
|
}
|
|
20674
20722
|
}
|
|
20675
|
-
function buildMentionMap(rows,
|
|
20723
|
+
function buildMentionMap(rows, resolve23) {
|
|
20676
20724
|
const map = /* @__PURE__ */ new Map();
|
|
20677
20725
|
visitObjects(rows, (o) => {
|
|
20678
20726
|
const url = profileActionUrl(o);
|
|
@@ -20680,7 +20728,7 @@ function buildMentionMap(rows, resolve22) {
|
|
|
20680
20728
|
const slug = slugFromProfileUrl(url);
|
|
20681
20729
|
if (!slug || map.has(slug)) return;
|
|
20682
20730
|
const sink2 = { text: [], hashtags: [] };
|
|
20683
|
-
collectRscText(o.children,
|
|
20731
|
+
collectRscText(o.children, resolve23, sink2, /* @__PURE__ */ new Set());
|
|
20684
20732
|
const name = sink2.text.join(" ").replace(/\s+/g, " ").trim();
|
|
20685
20733
|
map.set(slug, name ? { slug, name, url } : { slug, url });
|
|
20686
20734
|
});
|
|
@@ -20766,10 +20814,10 @@ function buildPost(raw, mentionMap, author) {
|
|
|
20766
20814
|
|
|
20767
20815
|
// src/commands/netcap/walkPostRow.ts
|
|
20768
20816
|
var isCommentary = (o) => asObject(o.viewTrackingSpecs)?.viewName === "feed-commentary";
|
|
20769
|
-
function walkPostRow(v,
|
|
20817
|
+
function walkPostRow(v, resolve23, raw) {
|
|
20770
20818
|
if (v == null || typeof v !== "object") return;
|
|
20771
20819
|
if (Array.isArray(v)) {
|
|
20772
|
-
for (const x of v) walkPostRow(x,
|
|
20820
|
+
for (const x of v) walkPostRow(x, resolve23, raw);
|
|
20773
20821
|
return;
|
|
20774
20822
|
}
|
|
20775
20823
|
const o = v;
|
|
@@ -20783,9 +20831,9 @@ function walkPostRow(v, resolve22, raw) {
|
|
|
20783
20831
|
}
|
|
20784
20832
|
if (isCommentary(o)) {
|
|
20785
20833
|
const sink2 = { text: raw.text, hashtags: raw.hashtags };
|
|
20786
|
-
collectRscText(o.children,
|
|
20834
|
+
collectRscText(o.children, resolve23, sink2, /* @__PURE__ */ new Set());
|
|
20787
20835
|
}
|
|
20788
|
-
for (const val of Object.values(o)) walkPostRow(val,
|
|
20836
|
+
for (const val of Object.values(o)) walkPostRow(val, resolve23, raw);
|
|
20789
20837
|
}
|
|
20790
20838
|
|
|
20791
20839
|
// src/commands/netcap/extractLinkedInPosts.ts
|
|
@@ -20799,8 +20847,8 @@ function findCommentaryRows(rows) {
|
|
|
20799
20847
|
}
|
|
20800
20848
|
function extractLinkedInPosts(flight, author = findAuthorSlug(flight)) {
|
|
20801
20849
|
const rows = parseRscRows(flight);
|
|
20802
|
-
const
|
|
20803
|
-
const mentionMap = buildMentionMap(rows,
|
|
20850
|
+
const resolve23 = makeRscResolver(rows);
|
|
20851
|
+
const mentionMap = buildMentionMap(rows, resolve23);
|
|
20804
20852
|
const posts = [];
|
|
20805
20853
|
for (const id of findCommentaryRows(rows)) {
|
|
20806
20854
|
const raw = {
|
|
@@ -20810,7 +20858,7 @@ function extractLinkedInPosts(flight, author = findAuthorSlug(flight)) {
|
|
|
20810
20858
|
links: [],
|
|
20811
20859
|
related: []
|
|
20812
20860
|
};
|
|
20813
|
-
walkPostRow(rows[id],
|
|
20861
|
+
walkPostRow(rows[id], resolve23, raw);
|
|
20814
20862
|
const post = buildPost(raw, mentionMap, author);
|
|
20815
20863
|
if (post) posts.push(post);
|
|
20816
20864
|
}
|
|
@@ -21576,20 +21624,20 @@ function resolveThread(threadId) {
|
|
|
21576
21624
|
}
|
|
21577
21625
|
}
|
|
21578
21626
|
function requireCache(org, repo, prNumber) {
|
|
21579
|
-
const
|
|
21580
|
-
if (!
|
|
21627
|
+
const cache5 = loadCommentsCache(org, repo, prNumber);
|
|
21628
|
+
if (!cache5) {
|
|
21581
21629
|
console.error(
|
|
21582
21630
|
`Error: No cached comments found for PR #${prNumber}. Run "assist prs list-comments" first.`
|
|
21583
21631
|
);
|
|
21584
21632
|
process.exit(1);
|
|
21585
21633
|
}
|
|
21586
|
-
return
|
|
21634
|
+
return cache5;
|
|
21587
21635
|
}
|
|
21588
21636
|
function findLineComment(comments3, commentId) {
|
|
21589
21637
|
return comments3.find((c) => c.type === "line" && c.id === commentId);
|
|
21590
21638
|
}
|
|
21591
|
-
function requireLineComment(
|
|
21592
|
-
const comment3 = findLineComment(
|
|
21639
|
+
function requireLineComment(cache5, commentId) {
|
|
21640
|
+
const comment3 = findLineComment(cache5.comments, commentId);
|
|
21593
21641
|
if (!comment3 || comment3.type !== "line" || !comment3.threadId) {
|
|
21594
21642
|
console.error(
|
|
21595
21643
|
`Error: Comment #${commentId} not found or has no thread ID.`
|
|
@@ -21598,8 +21646,8 @@ function requireLineComment(cache4, commentId) {
|
|
|
21598
21646
|
}
|
|
21599
21647
|
return comment3;
|
|
21600
21648
|
}
|
|
21601
|
-
function cleanupCacheIfDone(
|
|
21602
|
-
const hasRemaining =
|
|
21649
|
+
function cleanupCacheIfDone(cache5, org, repo, prNumber, commentId) {
|
|
21650
|
+
const hasRemaining = cache5.comments.some(
|
|
21603
21651
|
(c) => c.type === "line" && c.id !== commentId
|
|
21604
21652
|
);
|
|
21605
21653
|
if (!hasRemaining) deleteCommentsCache(org, repo, prNumber);
|
|
@@ -21607,13 +21655,13 @@ function cleanupCacheIfDone(cache4, org, repo, prNumber, commentId) {
|
|
|
21607
21655
|
function resolveCommentWithReply(commentId, message3) {
|
|
21608
21656
|
const prNumber = getCurrentPrNumber();
|
|
21609
21657
|
const { org, repo } = getRepoInfo();
|
|
21610
|
-
const
|
|
21611
|
-
const comment3 = requireLineComment(
|
|
21658
|
+
const cache5 = requireCache(org, repo, prNumber);
|
|
21659
|
+
const comment3 = requireLineComment(cache5, commentId);
|
|
21612
21660
|
replyToComment(org, repo, prNumber, commentId, message3);
|
|
21613
21661
|
console.log("Reply posted successfully.");
|
|
21614
21662
|
resolveThread(comment3.threadId);
|
|
21615
21663
|
console.log("Thread resolved successfully.");
|
|
21616
|
-
cleanupCacheIfDone(
|
|
21664
|
+
cleanupCacheIfDone(cache5, org, repo, prNumber, commentId);
|
|
21617
21665
|
}
|
|
21618
21666
|
|
|
21619
21667
|
// src/commands/prs/fixed.ts
|
|
@@ -22104,7 +22152,7 @@ function parseIncoming(line, type) {
|
|
|
22104
22152
|
}
|
|
22105
22153
|
}
|
|
22106
22154
|
function requestSession(message3) {
|
|
22107
|
-
return new Promise((
|
|
22155
|
+
return new Promise((resolve23, reject) => {
|
|
22108
22156
|
connectToDaemon().then((socket) => {
|
|
22109
22157
|
let settled = false;
|
|
22110
22158
|
const finish = (error, sessionId) => {
|
|
@@ -22112,7 +22160,7 @@ function requestSession(message3) {
|
|
|
22112
22160
|
settled = true;
|
|
22113
22161
|
socket.destroy();
|
|
22114
22162
|
if (error) reject(error);
|
|
22115
|
-
else
|
|
22163
|
+
else resolve23(sessionId);
|
|
22116
22164
|
};
|
|
22117
22165
|
readSocketLines(socket, (line) => {
|
|
22118
22166
|
const incoming = parseIncoming(line, message3.type);
|
|
@@ -23059,7 +23107,7 @@ function getViolations(pattern2, options2 = {}, maxLines = DEFAULT_MAX_LINES) {
|
|
|
23059
23107
|
|
|
23060
23108
|
// src/commands/refactor/check/index.ts
|
|
23061
23109
|
function runScript(script, cwd) {
|
|
23062
|
-
return new Promise((
|
|
23110
|
+
return new Promise((resolve23) => {
|
|
23063
23111
|
const child = spawn6("npm", ["run", script], {
|
|
23064
23112
|
stdio: "pipe",
|
|
23065
23113
|
shell: true,
|
|
@@ -23073,7 +23121,7 @@ function runScript(script, cwd) {
|
|
|
23073
23121
|
output += data.toString();
|
|
23074
23122
|
});
|
|
23075
23123
|
child.on("close", (code) => {
|
|
23076
|
-
|
|
23124
|
+
resolve23({ script, code: code ?? 1, output });
|
|
23077
23125
|
});
|
|
23078
23126
|
});
|
|
23079
23127
|
}
|
|
@@ -25933,12 +25981,12 @@ function onCloseResult(ctx, code) {
|
|
|
25933
25981
|
return { ...closed, stderr: ctx.stderr.value, stdout: ctx.stdout.value };
|
|
25934
25982
|
}
|
|
25935
25983
|
function waitForChildExit(ctx) {
|
|
25936
|
-
return new Promise((
|
|
25984
|
+
return new Promise((resolve23) => {
|
|
25937
25985
|
let settled = false;
|
|
25938
25986
|
const settle = (result) => {
|
|
25939
25987
|
if (settled) return;
|
|
25940
25988
|
settled = true;
|
|
25941
|
-
|
|
25989
|
+
resolve23(result);
|
|
25942
25990
|
};
|
|
25943
25991
|
ctx.child.on("error", (err) => settle(onErrorResult(ctx, err)));
|
|
25944
25992
|
ctx.child.on("close", (code) => settle(onCloseResult(ctx, code)));
|
|
@@ -27013,9 +27061,9 @@ function createReadlineInterface() {
|
|
|
27013
27061
|
});
|
|
27014
27062
|
}
|
|
27015
27063
|
function askQuestion(rl, question) {
|
|
27016
|
-
return new Promise((
|
|
27064
|
+
return new Promise((resolve23) => {
|
|
27017
27065
|
rl.question(question, (answer) => {
|
|
27018
|
-
|
|
27066
|
+
resolve23(answer.trim());
|
|
27019
27067
|
});
|
|
27020
27068
|
});
|
|
27021
27069
|
}
|
|
@@ -27950,7 +27998,7 @@ function pullFastForward(cwd) {
|
|
|
27950
27998
|
}
|
|
27951
27999
|
|
|
27952
28000
|
// src/commands/watch/runWatchBuild.ts
|
|
27953
|
-
import { resolve as
|
|
28001
|
+
import { resolve as resolve18 } from "path";
|
|
27954
28002
|
|
|
27955
28003
|
// src/commands/run/findRunConfig.ts
|
|
27956
28004
|
function exitNoRunConfigs() {
|
|
@@ -28025,12 +28073,12 @@ function resolveParams(params, cliArgs) {
|
|
|
28025
28073
|
// src/commands/run/runCommandToCompletion.ts
|
|
28026
28074
|
import { execFileSync as execFileSync11, spawn as spawn9 } from "child_process";
|
|
28027
28075
|
import { existsSync as existsSync58 } from "fs";
|
|
28028
|
-
import { dirname as dirname31, join as join68, resolve as
|
|
28076
|
+
import { dirname as dirname31, join as join68, resolve as resolve17 } from "path";
|
|
28029
28077
|
function resolveCommand2(command) {
|
|
28030
28078
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
28031
28079
|
try {
|
|
28032
28080
|
const gitPath = execFileSync11("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
28033
|
-
const gitRoot =
|
|
28081
|
+
const gitRoot = resolve17(dirname31(gitPath), "..");
|
|
28034
28082
|
const gitBash = join68(gitRoot, "bin", "bash.exe");
|
|
28035
28083
|
if (existsSync58(gitBash)) return gitBash;
|
|
28036
28084
|
} catch {
|
|
@@ -28082,7 +28130,7 @@ function runPreCommands(pre, cwd) {
|
|
|
28082
28130
|
// src/commands/watch/runWatchBuild.ts
|
|
28083
28131
|
async function runWatchBuild(entry) {
|
|
28084
28132
|
const config = findRunConfig(entry);
|
|
28085
|
-
const cwd = config.cwd ?
|
|
28133
|
+
const cwd = config.cwd ? resolve18(getConfigDir(), config.cwd) : void 0;
|
|
28086
28134
|
if (config.pre) runPreCommands(config.pre, cwd);
|
|
28087
28135
|
const result = await runCommandToCompletion(
|
|
28088
28136
|
config.command,
|
|
@@ -28146,7 +28194,7 @@ function readMovement(cwd) {
|
|
|
28146
28194
|
// src/commands/watch/pollForMovement.ts
|
|
28147
28195
|
function pollForMovement(options2) {
|
|
28148
28196
|
const { upstream, intervalMs, timeoutMs, timeout, cwd } = options2;
|
|
28149
|
-
return new Promise((
|
|
28197
|
+
return new Promise((resolve23) => {
|
|
28150
28198
|
let settled = false;
|
|
28151
28199
|
const finish = (outcome) => {
|
|
28152
28200
|
if (settled) return;
|
|
@@ -28154,7 +28202,7 @@ function pollForMovement(options2) {
|
|
|
28154
28202
|
clearInterval(ticker);
|
|
28155
28203
|
clearTimeout(deadline);
|
|
28156
28204
|
process.off("SIGINT", onInterrupt);
|
|
28157
|
-
|
|
28205
|
+
resolve23(outcome);
|
|
28158
28206
|
};
|
|
28159
28207
|
const onInterrupt = () => finish({ kind: "interrupted" });
|
|
28160
28208
|
const ticker = setInterval(() => {
|
|
@@ -28278,7 +28326,7 @@ function extractCode(url, expectedState) {
|
|
|
28278
28326
|
return code;
|
|
28279
28327
|
}
|
|
28280
28328
|
function waitForCallback(port, expectedState) {
|
|
28281
|
-
return new Promise((
|
|
28329
|
+
return new Promise((resolve23, reject) => {
|
|
28282
28330
|
const timeout = setTimeout(() => {
|
|
28283
28331
|
server.close();
|
|
28284
28332
|
reject(new Error("Authorization timed out after 120 seconds"));
|
|
@@ -28295,7 +28343,7 @@ function waitForCallback(port, expectedState) {
|
|
|
28295
28343
|
const code = extractCode(url, expectedState);
|
|
28296
28344
|
respondHtml(res, 200, "Authorization successful!");
|
|
28297
28345
|
server.close();
|
|
28298
|
-
|
|
28346
|
+
resolve23(code);
|
|
28299
28347
|
} catch (error) {
|
|
28300
28348
|
respondHtml(res, 400, error.message);
|
|
28301
28349
|
server.close();
|
|
@@ -28487,7 +28535,7 @@ function registerRoam(program2) {
|
|
|
28487
28535
|
}
|
|
28488
28536
|
|
|
28489
28537
|
// src/commands/run/index.ts
|
|
28490
|
-
import { resolve as
|
|
28538
|
+
import { resolve as resolve19 } from "path";
|
|
28491
28539
|
|
|
28492
28540
|
// src/commands/run/formatConfiguredCommands.ts
|
|
28493
28541
|
function formatConfiguredCommands() {
|
|
@@ -28532,7 +28580,7 @@ function listRunConfigs(verbose) {
|
|
|
28532
28580
|
}
|
|
28533
28581
|
}
|
|
28534
28582
|
function execRunConfig(config, args) {
|
|
28535
|
-
const cwd = config.cwd ?
|
|
28583
|
+
const cwd = config.cwd ? resolve19(getConfigDir(), config.cwd) : void 0;
|
|
28536
28584
|
if (config.pre) runPreCommands(config.pre, cwd);
|
|
28537
28585
|
const resolved = resolveParams(config.params, args);
|
|
28538
28586
|
spawnRunCommand(
|
|
@@ -28763,7 +28811,7 @@ function registerRun(program2) {
|
|
|
28763
28811
|
import { execSync as execSync61 } from "child_process";
|
|
28764
28812
|
import { existsSync as existsSync60, mkdirSync as mkdirSync25, unlinkSync as unlinkSync22, writeFileSync as writeFileSync42 } from "fs";
|
|
28765
28813
|
import { tmpdir as tmpdir8 } from "os";
|
|
28766
|
-
import { join as join72, resolve as
|
|
28814
|
+
import { join as join72, resolve as resolve20 } from "path";
|
|
28767
28815
|
import chalk211 from "chalk";
|
|
28768
28816
|
|
|
28769
28817
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -28897,7 +28945,7 @@ function buildOutputPath(outputDir, processName) {
|
|
|
28897
28945
|
mkdirSync25(outputDir, { recursive: true });
|
|
28898
28946
|
}
|
|
28899
28947
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
28900
|
-
return
|
|
28948
|
+
return resolve20(outputDir, `${processName}-${timestamp6}.png`);
|
|
28901
28949
|
}
|
|
28902
28950
|
function runPowerShellScript(processName, outputPath) {
|
|
28903
28951
|
const scriptPath = join72(tmpdir8(), `assist-screenshot-${Date.now()}.ps1`);
|
|
@@ -28913,7 +28961,7 @@ function runPowerShellScript(processName, outputPath) {
|
|
|
28913
28961
|
}
|
|
28914
28962
|
function screenshot(processName) {
|
|
28915
28963
|
const config = loadConfig();
|
|
28916
|
-
const outputDir =
|
|
28964
|
+
const outputDir = resolve20(config.screenshot.outputDir);
|
|
28917
28965
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
28918
28966
|
console.log(chalk211.gray(`Capturing window for process "${processName}" ...`));
|
|
28919
28967
|
try {
|
|
@@ -28946,10 +28994,10 @@ var STATUS_TIMEOUT_MS = 5e3;
|
|
|
28946
28994
|
function queryDaemon(socket) {
|
|
28947
28995
|
socket.write(`${JSON.stringify({ type: "ping" })}
|
|
28948
28996
|
`);
|
|
28949
|
-
return new Promise((
|
|
28997
|
+
return new Promise((resolve23) => {
|
|
28950
28998
|
const result = { sessions: [] };
|
|
28951
28999
|
const pending = /* @__PURE__ */ new Set(["sessions", "pong"]);
|
|
28952
|
-
const timer = setTimeout(() =>
|
|
29000
|
+
const timer = setTimeout(() => resolve23(result), STATUS_TIMEOUT_MS);
|
|
28953
29001
|
const lines2 = createInterface5({ input: socket });
|
|
28954
29002
|
lines2.on("error", () => {
|
|
28955
29003
|
});
|
|
@@ -28957,7 +29005,7 @@ function queryDaemon(socket) {
|
|
|
28957
29005
|
applyLine(result, pending, line);
|
|
28958
29006
|
if (pending.size === 0) {
|
|
28959
29007
|
clearTimeout(timer);
|
|
28960
|
-
|
|
29008
|
+
resolve23(result);
|
|
28961
29009
|
}
|
|
28962
29010
|
});
|
|
28963
29011
|
});
|
|
@@ -29043,11 +29091,11 @@ function clearPersistedSessionsOnDrain() {
|
|
|
29043
29091
|
|
|
29044
29092
|
// src/commands/sessions/daemon/readDaemonMessage.ts
|
|
29045
29093
|
function readDaemonMessage(lines2, timeoutMs, fallback, match) {
|
|
29046
|
-
return new Promise((
|
|
29094
|
+
return new Promise((resolve23) => {
|
|
29047
29095
|
const finish = (value) => {
|
|
29048
29096
|
clearTimeout(timer);
|
|
29049
29097
|
lines2.off("line", onLine);
|
|
29050
|
-
|
|
29098
|
+
resolve23(value);
|
|
29051
29099
|
};
|
|
29052
29100
|
const timer = setTimeout(() => finish(fallback), timeoutMs);
|
|
29053
29101
|
const onLine = (line) => {
|
|
@@ -32150,7 +32198,7 @@ function windowsDaemonHost() {
|
|
|
32150
32198
|
var CONNECT_TIMEOUT_MS = 2e3;
|
|
32151
32199
|
var KEEPALIVE_PROBE_MS = 1e4;
|
|
32152
32200
|
function connectToWindowsDaemon() {
|
|
32153
|
-
return new Promise((
|
|
32201
|
+
return new Promise((resolve23, reject) => {
|
|
32154
32202
|
const socket = net2.connect(windowsDaemonPort(), windowsDaemonHost());
|
|
32155
32203
|
socket.setTimeout(CONNECT_TIMEOUT_MS);
|
|
32156
32204
|
socket.once("timeout", () => {
|
|
@@ -32160,7 +32208,7 @@ function connectToWindowsDaemon() {
|
|
|
32160
32208
|
socket.once("connect", () => {
|
|
32161
32209
|
socket.setTimeout(0);
|
|
32162
32210
|
socket.setKeepAlive(true, KEEPALIVE_PROBE_MS);
|
|
32163
|
-
|
|
32211
|
+
resolve23(socket);
|
|
32164
32212
|
});
|
|
32165
32213
|
socket.once("error", reject);
|
|
32166
32214
|
});
|
|
@@ -32238,7 +32286,7 @@ async function waitForWindowsDaemon() {
|
|
|
32238
32286
|
);
|
|
32239
32287
|
}
|
|
32240
32288
|
function delay2(ms) {
|
|
32241
|
-
return new Promise((
|
|
32289
|
+
return new Promise((resolve23) => setTimeout(resolve23, ms));
|
|
32242
32290
|
}
|
|
32243
32291
|
|
|
32244
32292
|
// src/commands/sessions/daemon/defaultConnect.ts
|
|
@@ -32522,7 +32570,7 @@ async function healWindowsDaemon() {
|
|
|
32522
32570
|
daemonLog("windows daemon: auto-heal: stale daemon stopped");
|
|
32523
32571
|
}
|
|
32524
32572
|
function runOnWindowsHost(command, timeoutMs) {
|
|
32525
|
-
return new Promise((
|
|
32573
|
+
return new Promise((resolve23, reject) => {
|
|
32526
32574
|
const child = spawn12("pwsh.exe", ["-Command", command], {
|
|
32527
32575
|
stdio: ["ignore", "pipe", "pipe"]
|
|
32528
32576
|
});
|
|
@@ -32542,7 +32590,7 @@ function runOnWindowsHost(command, timeoutMs) {
|
|
|
32542
32590
|
});
|
|
32543
32591
|
child.on("exit", (code) => {
|
|
32544
32592
|
clearTimeout(timer);
|
|
32545
|
-
if (code === 0)
|
|
32593
|
+
if (code === 0) resolve23();
|
|
32546
32594
|
else
|
|
32547
32595
|
reject(
|
|
32548
32596
|
new Error(
|
|
@@ -33833,7 +33881,7 @@ function buildLimitsSegment(rateLimits) {
|
|
|
33833
33881
|
|
|
33834
33882
|
// src/commands/readGitBranch.ts
|
|
33835
33883
|
import { readFileSync as readFileSync54, statSync as statSync14 } from "fs";
|
|
33836
|
-
import { isAbsolute as isAbsolute4, join as join77, resolve as
|
|
33884
|
+
import { isAbsolute as isAbsolute4, join as join77, resolve as resolve21 } from "path";
|
|
33837
33885
|
function resolveGitDir(cwd) {
|
|
33838
33886
|
const dotGit = join77(cwd, ".git");
|
|
33839
33887
|
let stat3;
|
|
@@ -33856,7 +33904,7 @@ function resolveGitDir(cwd) {
|
|
|
33856
33904
|
return null;
|
|
33857
33905
|
}
|
|
33858
33906
|
const gitDir = match[1].trim();
|
|
33859
|
-
return isAbsolute4(gitDir) ? gitDir :
|
|
33907
|
+
return isAbsolute4(gitDir) ? gitDir : resolve21(cwd, gitDir);
|
|
33860
33908
|
}
|
|
33861
33909
|
function readGitBranch(cwd) {
|
|
33862
33910
|
const gitDir = resolveGitDir(cwd);
|