@staff0rd/assist 0.554.0 → 0.554.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/dist/commands/sessions/web/bundle.js +2 -2
- package/dist/index.js +128 -94
- 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.554.
|
|
9
|
+
version: "0.554.2",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -5407,9 +5407,9 @@ var daemonPaths = {
|
|
|
5407
5407
|
|
|
5408
5408
|
// src/commands/sessions/daemon/connectToDaemon.ts
|
|
5409
5409
|
function connectToDaemon() {
|
|
5410
|
-
return new Promise((
|
|
5410
|
+
return new Promise((resolve24, reject) => {
|
|
5411
5411
|
const socket = net.connect(daemonPaths.socket);
|
|
5412
|
-
socket.once("connect", () =>
|
|
5412
|
+
socket.once("connect", () => resolve24(socket));
|
|
5413
5413
|
socket.once("error", reject);
|
|
5414
5414
|
});
|
|
5415
5415
|
}
|
|
@@ -5562,7 +5562,7 @@ ${failed2.length} script(s) failed:`);
|
|
|
5562
5562
|
}
|
|
5563
5563
|
}
|
|
5564
5564
|
function runEntry(entry) {
|
|
5565
|
-
return new Promise((
|
|
5565
|
+
return new Promise((resolve24) => {
|
|
5566
5566
|
const startTime = Date.now();
|
|
5567
5567
|
const child = spawnCommand(
|
|
5568
5568
|
entry.fullCommand,
|
|
@@ -5574,7 +5574,7 @@ function runEntry(entry) {
|
|
|
5574
5574
|
child.on("close", (code) => {
|
|
5575
5575
|
const exitCode = code ?? 1;
|
|
5576
5576
|
flushIfFailed(exitCode, chunks);
|
|
5577
|
-
|
|
5577
|
+
resolve24({
|
|
5578
5578
|
script: entry.name,
|
|
5579
5579
|
code: exitCode,
|
|
5580
5580
|
durationMs: Date.now() - startTime
|
|
@@ -6728,8 +6728,8 @@ function spawnInherit(command, args, options2 = {}) {
|
|
|
6728
6728
|
env,
|
|
6729
6729
|
cwd: options2.cwd
|
|
6730
6730
|
});
|
|
6731
|
-
const done2 = new Promise((
|
|
6732
|
-
child.on("close", (code) =>
|
|
6731
|
+
const done2 = new Promise((resolve24, reject) => {
|
|
6732
|
+
child.on("close", (code) => resolve24(code ?? 0));
|
|
6733
6733
|
child.on("error", reject);
|
|
6734
6734
|
});
|
|
6735
6735
|
return { child, done: done2 };
|
|
@@ -7875,7 +7875,7 @@ Failed to launch Claude for ${context}: ${message3}`)
|
|
|
7875
7875
|
// src/commands/sessions/daemon/sendToDaemon.ts
|
|
7876
7876
|
var WRITE_TIMEOUT_MS = 500;
|
|
7877
7877
|
function sendToDaemon(message3) {
|
|
7878
|
-
return new Promise((
|
|
7878
|
+
return new Promise((resolve24, reject) => {
|
|
7879
7879
|
connectToDaemon().then((socket) => {
|
|
7880
7880
|
const timer = setTimeout(() => {
|
|
7881
7881
|
socket.destroy();
|
|
@@ -7889,7 +7889,7 @@ function sendToDaemon(message3) {
|
|
|
7889
7889
|
`, () => {
|
|
7890
7890
|
clearTimeout(timer);
|
|
7891
7891
|
socket.end();
|
|
7892
|
-
|
|
7892
|
+
resolve24();
|
|
7893
7893
|
});
|
|
7894
7894
|
}, reject);
|
|
7895
7895
|
});
|
|
@@ -7912,7 +7912,7 @@ function readSocketLines(socket, onLine) {
|
|
|
7912
7912
|
// src/commands/sessions/daemon/sendToDaemonAwaitAck.ts
|
|
7913
7913
|
var ACK_TIMEOUT_MS = 1e3;
|
|
7914
7914
|
function sendToDaemonAwaitAck(message3) {
|
|
7915
|
-
return new Promise((
|
|
7915
|
+
return new Promise((resolve24, reject) => {
|
|
7916
7916
|
connectToDaemon().then((socket) => {
|
|
7917
7917
|
let settled = false;
|
|
7918
7918
|
const finish = (error) => {
|
|
@@ -7921,7 +7921,7 @@ function sendToDaemonAwaitAck(message3) {
|
|
|
7921
7921
|
clearTimeout(timer);
|
|
7922
7922
|
socket.destroy();
|
|
7923
7923
|
if (error) reject(error);
|
|
7924
|
-
else
|
|
7924
|
+
else resolve24();
|
|
7925
7925
|
};
|
|
7926
7926
|
const timer = setTimeout(
|
|
7927
7927
|
() => finish(new Error("timed out awaiting daemon ack")),
|
|
@@ -7995,7 +7995,7 @@ async function deliverReliably(sessionId, status3, payload) {
|
|
|
7995
7995
|
}
|
|
7996
7996
|
}
|
|
7997
7997
|
function sleep(ms) {
|
|
7998
|
-
return new Promise((
|
|
7998
|
+
return new Promise((resolve24) => setTimeout(resolve24, ms));
|
|
7999
7999
|
}
|
|
8000
8000
|
function describeError(error) {
|
|
8001
8001
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -9711,7 +9711,7 @@ function spawnDaemon(reason4) {
|
|
|
9711
9711
|
child.unref();
|
|
9712
9712
|
}
|
|
9713
9713
|
function delay(ms) {
|
|
9714
|
-
return new Promise((
|
|
9714
|
+
return new Promise((resolve24) => setTimeout(resolve24, ms));
|
|
9715
9715
|
}
|
|
9716
9716
|
|
|
9717
9717
|
// src/commands/sessions/daemon/isWindowsCwd.ts
|
|
@@ -9752,10 +9752,10 @@ function gitInvocation(cwd, args) {
|
|
|
9752
9752
|
}
|
|
9753
9753
|
function git2(cwd, args) {
|
|
9754
9754
|
const { file, argv, options: options2 } = gitInvocation(cwd, args);
|
|
9755
|
-
return new Promise((
|
|
9755
|
+
return new Promise((resolve24, reject) => {
|
|
9756
9756
|
execFile2(file, argv, options2, (error, stdout) => {
|
|
9757
9757
|
if (error) reject(error);
|
|
9758
|
-
else
|
|
9758
|
+
else resolve24(stdout.toString());
|
|
9759
9759
|
});
|
|
9760
9760
|
});
|
|
9761
9761
|
}
|
|
@@ -10167,12 +10167,12 @@ async function loadVisibleItems(req) {
|
|
|
10167
10167
|
|
|
10168
10168
|
// src/commands/backlog/web/parseStatusBody.ts
|
|
10169
10169
|
function readBody(req) {
|
|
10170
|
-
return new Promise((
|
|
10170
|
+
return new Promise((resolve24, reject) => {
|
|
10171
10171
|
let body = "";
|
|
10172
10172
|
req.on("data", (chunk) => {
|
|
10173
10173
|
body += chunk.toString();
|
|
10174
10174
|
});
|
|
10175
|
-
req.on("end", () =>
|
|
10175
|
+
req.on("end", () => resolve24(body));
|
|
10176
10176
|
req.on("error", reject);
|
|
10177
10177
|
});
|
|
10178
10178
|
}
|
|
@@ -11817,17 +11817,17 @@ async function stopDaemon() {
|
|
|
11817
11817
|
}
|
|
11818
11818
|
}
|
|
11819
11819
|
function closedBeforeTimeout(socket) {
|
|
11820
|
-
return new Promise((
|
|
11820
|
+
return new Promise((resolve24) => {
|
|
11821
11821
|
const timer = setTimeout(() => {
|
|
11822
11822
|
socket.destroy();
|
|
11823
|
-
|
|
11823
|
+
resolve24(false);
|
|
11824
11824
|
}, STOP_TIMEOUT_MS);
|
|
11825
11825
|
socket.resume();
|
|
11826
11826
|
socket.on("error", () => {
|
|
11827
11827
|
});
|
|
11828
11828
|
socket.once("close", () => {
|
|
11829
11829
|
clearTimeout(timer);
|
|
11830
|
-
|
|
11830
|
+
resolve24(true);
|
|
11831
11831
|
});
|
|
11832
11832
|
});
|
|
11833
11833
|
}
|
|
@@ -11878,8 +11878,8 @@ async function restartWeb(req, res, deps2 = {}) {
|
|
|
11878
11878
|
respondJson(res, 400, { error: "Invalid target" });
|
|
11879
11879
|
return;
|
|
11880
11880
|
}
|
|
11881
|
-
await new Promise((
|
|
11882
|
-
res.once("finish",
|
|
11881
|
+
await new Promise((resolve24) => {
|
|
11882
|
+
res.once("finish", resolve24);
|
|
11883
11883
|
respondJson(res, 200, { ok: true });
|
|
11884
11884
|
});
|
|
11885
11885
|
if (target === "daemon" || target === "both") {
|
|
@@ -14085,7 +14085,7 @@ function parsePreviewDecision(line, requestId) {
|
|
|
14085
14085
|
|
|
14086
14086
|
// src/commands/sessions/shared/requestPreviewDecision.ts
|
|
14087
14087
|
function requestPreviewDecision(request) {
|
|
14088
|
-
return new Promise((
|
|
14088
|
+
return new Promise((resolve24, reject) => {
|
|
14089
14089
|
connectToDaemon().then((socket) => {
|
|
14090
14090
|
let settled = false;
|
|
14091
14091
|
const finish = (error, decision) => {
|
|
@@ -14093,7 +14093,7 @@ function requestPreviewDecision(request) {
|
|
|
14093
14093
|
settled = true;
|
|
14094
14094
|
socket.destroy();
|
|
14095
14095
|
if (error) reject(error);
|
|
14096
|
-
else
|
|
14096
|
+
else resolve24(decision);
|
|
14097
14097
|
};
|
|
14098
14098
|
readSocketLines(socket, (line) => {
|
|
14099
14099
|
const incoming = parsePreviewDecision(line, request.requestId);
|
|
@@ -16924,12 +16924,12 @@ function hasSubcommands(helpText) {
|
|
|
16924
16924
|
// src/commands/permitCliReads/runHelp.ts
|
|
16925
16925
|
import { exec as exec2 } from "child_process";
|
|
16926
16926
|
function runHelp(args) {
|
|
16927
|
-
return new Promise((
|
|
16927
|
+
return new Promise((resolve24) => {
|
|
16928
16928
|
exec2(
|
|
16929
16929
|
`${args.join(" ")} --help`,
|
|
16930
16930
|
{ encoding: "utf8", timeout: 3e4 },
|
|
16931
16931
|
(_err, stdout, stderr) => {
|
|
16932
|
-
|
|
16932
|
+
resolve24(stdout || stderr || "");
|
|
16933
16933
|
}
|
|
16934
16934
|
);
|
|
16935
16935
|
});
|
|
@@ -20656,6 +20656,17 @@ function recentDaemonLogLines() {
|
|
|
20656
20656
|
return [...ring];
|
|
20657
20657
|
}
|
|
20658
20658
|
|
|
20659
|
+
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
20660
|
+
import { realpathSync as realpathSync2 } from "fs";
|
|
20661
|
+
import { resolve as resolve14 } from "path";
|
|
20662
|
+
function canonicalTreePath(path73) {
|
|
20663
|
+
try {
|
|
20664
|
+
return realpathSync2(path73);
|
|
20665
|
+
} catch {
|
|
20666
|
+
return resolve14(path73);
|
|
20667
|
+
}
|
|
20668
|
+
}
|
|
20669
|
+
|
|
20659
20670
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
20660
20671
|
import { existsSync as existsSync45 } from "fs";
|
|
20661
20672
|
import { basename as basename14, dirname as dirname25 } from "path";
|
|
@@ -20723,6 +20734,12 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
20723
20734
|
return path73;
|
|
20724
20735
|
}
|
|
20725
20736
|
|
|
20737
|
+
// src/commands/sessions/daemon/worktree/keptInTree.ts
|
|
20738
|
+
function keptInTree(cwd, reason4) {
|
|
20739
|
+
daemonLog(`session kept in ${cwd}: ${reason4}`);
|
|
20740
|
+
return { cwd, kind: "primary", created: false };
|
|
20741
|
+
}
|
|
20742
|
+
|
|
20726
20743
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
20727
20744
|
import { existsSync as existsSync46 } from "fs";
|
|
20728
20745
|
var treeIsGone = { durable: true, gone: true };
|
|
@@ -20777,8 +20794,22 @@ function reusesClone(clone, boundTreeRoots2, options2) {
|
|
|
20777
20794
|
);
|
|
20778
20795
|
return true;
|
|
20779
20796
|
}
|
|
20780
|
-
if (planAllocation(clone, boundTreeRoots2) !== "primary")
|
|
20781
|
-
|
|
20797
|
+
if (planAllocation(clone, boundTreeRoots2) !== "primary") {
|
|
20798
|
+
daemonLog(
|
|
20799
|
+
`clone ${clone} is held by a live session \u2014 spilling to a worktree`
|
|
20800
|
+
);
|
|
20801
|
+
return false;
|
|
20802
|
+
}
|
|
20803
|
+
if (wouldDisturbWorkInProgress(clone, options2.forCheckout === true))
|
|
20804
|
+
return false;
|
|
20805
|
+
daemonLog(
|
|
20806
|
+
`session kept in the clone ${clone}: no live session holds it${describeHolders(boundTreeRoots2)}`
|
|
20807
|
+
);
|
|
20808
|
+
return true;
|
|
20809
|
+
}
|
|
20810
|
+
function describeHolders(boundTreeRoots2) {
|
|
20811
|
+
if (boundTreeRoots2.size === 0) return " and no tree is bound";
|
|
20812
|
+
return ` (bound trees: ${[...boundTreeRoots2].join(", ")})`;
|
|
20782
20813
|
}
|
|
20783
20814
|
function wouldDisturbWorkInProgress(clone, forCheckout) {
|
|
20784
20815
|
if (!forCheckout) return false;
|
|
@@ -20821,12 +20852,21 @@ function forcedSpillReason(clone, trunk, options2) {
|
|
|
20821
20852
|
function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
|
|
20822
20853
|
if (!requestedCwd)
|
|
20823
20854
|
return { cwd: requestedCwd, kind: "primary", created: false };
|
|
20824
|
-
if (options2.inPlace === true)
|
|
20825
|
-
|
|
20855
|
+
if (options2.inPlace === true)
|
|
20856
|
+
return keptInTree(
|
|
20857
|
+
requestedCwd,
|
|
20858
|
+
"launched against work already checked out there"
|
|
20859
|
+
);
|
|
20860
|
+
const repoRoot2 = canonicalTreePath(
|
|
20861
|
+
findRepoRoot(requestedCwd) ?? requestedCwd
|
|
20862
|
+
);
|
|
20826
20863
|
const cfg = worktreeConfigFor(repoRoot2);
|
|
20827
20864
|
if (!cfg.enabled)
|
|
20828
|
-
return
|
|
20829
|
-
|
|
20865
|
+
return keptInTree(
|
|
20866
|
+
requestedCwd,
|
|
20867
|
+
`worktree.enabled is off for ${repoRoot2}, so every session shares this tree`
|
|
20868
|
+
);
|
|
20869
|
+
const clone = canonicalTreePath(mainWorktree(repoRoot2) ?? repoRoot2);
|
|
20830
20870
|
const reuse = { ...options2, includeDrafts: cfg.includeDrafts };
|
|
20831
20871
|
const forcedSpill = forcedSpillReason(clone, cfg.trunk, options2);
|
|
20832
20872
|
if (forcedSpill) daemonLog(forcedSpill);
|
|
@@ -20840,12 +20880,6 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
|
|
|
20840
20880
|
);
|
|
20841
20881
|
return { cwd: path73, kind: "worktree", created: true, clone };
|
|
20842
20882
|
}
|
|
20843
|
-
function keptInPlace(cwd) {
|
|
20844
|
-
daemonLog(
|
|
20845
|
-
`session kept in ${cwd}: launched against work already checked out there`
|
|
20846
|
-
);
|
|
20847
|
-
return { cwd, kind: "primary", created: false };
|
|
20848
|
-
}
|
|
20849
20883
|
|
|
20850
20884
|
// src/commands/sessions/daemon/describePersistedSession.ts
|
|
20851
20885
|
function describePersistedSession(entry) {
|
|
@@ -21132,7 +21166,7 @@ function placedByDaemon() {
|
|
|
21132
21166
|
function seed(worktreePath, clone) {
|
|
21133
21167
|
console.log(`Preparing ${worktreePath}\u2026`);
|
|
21134
21168
|
return new Promise(
|
|
21135
|
-
(
|
|
21169
|
+
(resolve24) => seedWorktree(worktreePath, clone, resolve24)
|
|
21136
21170
|
);
|
|
21137
21171
|
}
|
|
21138
21172
|
async function moveToPrCheckoutTree() {
|
|
@@ -21339,12 +21373,12 @@ function registerList(program2) {
|
|
|
21339
21373
|
|
|
21340
21374
|
// src/commands/mermaid/index.ts
|
|
21341
21375
|
import { mkdirSync as mkdirSync17, readdirSync as readdirSync9 } from "fs";
|
|
21342
|
-
import { resolve as
|
|
21376
|
+
import { resolve as resolve16 } from "path";
|
|
21343
21377
|
import chalk166 from "chalk";
|
|
21344
21378
|
|
|
21345
21379
|
// src/commands/mermaid/exportFile.ts
|
|
21346
21380
|
import { readFileSync as readFileSync38, writeFileSync as writeFileSync31 } from "fs";
|
|
21347
|
-
import { basename as basename15, extname as extname2, resolve as
|
|
21381
|
+
import { basename as basename15, extname as extname2, resolve as resolve15 } from "path";
|
|
21348
21382
|
import chalk165 from "chalk";
|
|
21349
21383
|
|
|
21350
21384
|
// src/commands/mermaid/renderBlock.ts
|
|
@@ -21392,7 +21426,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
21392
21426
|
for (const [i, source] of blocks.entries()) {
|
|
21393
21427
|
const idx = i + 1;
|
|
21394
21428
|
if (onlyIndex !== void 0 && idx !== onlyIndex) continue;
|
|
21395
|
-
const outPath =
|
|
21429
|
+
const outPath = resolve15(outDir, `${stem}-${idx}.svg`);
|
|
21396
21430
|
const svg = await renderBlock(krokiUrl, source);
|
|
21397
21431
|
writeFileSync31(outPath, svg, "utf8");
|
|
21398
21432
|
console.log(chalk165.green(` \u2192 ${outPath}`));
|
|
@@ -21406,7 +21440,7 @@ function extractMermaidBlocks(markdown) {
|
|
|
21406
21440
|
// src/commands/mermaid/index.ts
|
|
21407
21441
|
async function mermaidExport(file, options2 = {}) {
|
|
21408
21442
|
const { mermaid } = loadConfig();
|
|
21409
|
-
const outDir =
|
|
21443
|
+
const outDir = resolve16(process.cwd(), options2.out ?? ".");
|
|
21410
21444
|
mkdirSync17(outDir, { recursive: true });
|
|
21411
21445
|
if (options2.index !== void 0) {
|
|
21412
21446
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
@@ -21590,7 +21624,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
21590
21624
|
}
|
|
21591
21625
|
|
|
21592
21626
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
21593
|
-
import { isAbsolute as isAbsolute3, join as join54, resolve as
|
|
21627
|
+
import { isAbsolute as isAbsolute3, join as join54, resolve as resolve17 } from "path";
|
|
21594
21628
|
|
|
21595
21629
|
// src/commands/netcap/defaultCapturePath.ts
|
|
21596
21630
|
import { homedir as homedir19 } from "os";
|
|
@@ -21602,7 +21636,7 @@ function defaultCapturePath() {
|
|
|
21602
21636
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
21603
21637
|
function resolveNetcapOutPath(out) {
|
|
21604
21638
|
if (!out) return defaultCapturePath();
|
|
21605
|
-
const dir = isAbsolute3(out) ? out :
|
|
21639
|
+
const dir = isAbsolute3(out) ? out : resolve17(process.cwd(), out);
|
|
21606
21640
|
return join54(dir, "capture.jsonl");
|
|
21607
21641
|
}
|
|
21608
21642
|
|
|
@@ -21693,25 +21727,25 @@ function isVisibleText(t) {
|
|
|
21693
21727
|
return /[a-zA-Z]{3,}/.test(t);
|
|
21694
21728
|
}
|
|
21695
21729
|
var isHashtag = (t) => /^#[A-Za-z0-9_]+$/.test(t);
|
|
21696
|
-
function collectRscText(v,
|
|
21730
|
+
function collectRscText(v, resolve24, sink2, seen) {
|
|
21697
21731
|
if (v == null) return;
|
|
21698
21732
|
if (typeof v === "string") {
|
|
21699
21733
|
if (isRscRef(v)) {
|
|
21700
21734
|
if (!seen.has(v)) {
|
|
21701
21735
|
seen.add(v);
|
|
21702
|
-
collectRscText(
|
|
21736
|
+
collectRscText(resolve24(v), resolve24, sink2, seen);
|
|
21703
21737
|
}
|
|
21704
21738
|
} else if (isHashtag(v)) sink2.hashtags.push(v);
|
|
21705
21739
|
else if (isVisibleText(v)) sink2.text.push(v);
|
|
21706
21740
|
return;
|
|
21707
21741
|
}
|
|
21708
21742
|
if (Array.isArray(v)) {
|
|
21709
|
-
for (const x of v) collectRscText(x,
|
|
21743
|
+
for (const x of v) collectRscText(x, resolve24, sink2, seen);
|
|
21710
21744
|
return;
|
|
21711
21745
|
}
|
|
21712
21746
|
if (typeof v === "object") {
|
|
21713
21747
|
for (const val of Object.values(v)) {
|
|
21714
|
-
collectRscText(val,
|
|
21748
|
+
collectRscText(val, resolve24, sink2, seen);
|
|
21715
21749
|
}
|
|
21716
21750
|
}
|
|
21717
21751
|
}
|
|
@@ -21743,7 +21777,7 @@ function visitObjects(root, fn) {
|
|
|
21743
21777
|
}
|
|
21744
21778
|
}
|
|
21745
21779
|
}
|
|
21746
|
-
function buildMentionMap(rows,
|
|
21780
|
+
function buildMentionMap(rows, resolve24) {
|
|
21747
21781
|
const map = /* @__PURE__ */ new Map();
|
|
21748
21782
|
visitObjects(rows, (o) => {
|
|
21749
21783
|
const url = profileActionUrl(o);
|
|
@@ -21751,7 +21785,7 @@ function buildMentionMap(rows, resolve23) {
|
|
|
21751
21785
|
const slug = slugFromProfileUrl(url);
|
|
21752
21786
|
if (!slug || map.has(slug)) return;
|
|
21753
21787
|
const sink2 = { text: [], hashtags: [] };
|
|
21754
|
-
collectRscText(o.children,
|
|
21788
|
+
collectRscText(o.children, resolve24, sink2, /* @__PURE__ */ new Set());
|
|
21755
21789
|
const name = sink2.text.join(" ").replace(/\s+/g, " ").trim();
|
|
21756
21790
|
map.set(slug, name ? { slug, name, url } : { slug, url });
|
|
21757
21791
|
});
|
|
@@ -21837,10 +21871,10 @@ function buildPost(raw, mentionMap, author) {
|
|
|
21837
21871
|
|
|
21838
21872
|
// src/commands/netcap/walkPostRow.ts
|
|
21839
21873
|
var isCommentary = (o) => asObject(o.viewTrackingSpecs)?.viewName === "feed-commentary";
|
|
21840
|
-
function walkPostRow(v,
|
|
21874
|
+
function walkPostRow(v, resolve24, raw) {
|
|
21841
21875
|
if (v == null || typeof v !== "object") return;
|
|
21842
21876
|
if (Array.isArray(v)) {
|
|
21843
|
-
for (const x of v) walkPostRow(x,
|
|
21877
|
+
for (const x of v) walkPostRow(x, resolve24, raw);
|
|
21844
21878
|
return;
|
|
21845
21879
|
}
|
|
21846
21880
|
const o = v;
|
|
@@ -21854,9 +21888,9 @@ function walkPostRow(v, resolve23, raw) {
|
|
|
21854
21888
|
}
|
|
21855
21889
|
if (isCommentary(o)) {
|
|
21856
21890
|
const sink2 = { text: raw.text, hashtags: raw.hashtags };
|
|
21857
|
-
collectRscText(o.children,
|
|
21891
|
+
collectRscText(o.children, resolve24, sink2, /* @__PURE__ */ new Set());
|
|
21858
21892
|
}
|
|
21859
|
-
for (const val of Object.values(o)) walkPostRow(val,
|
|
21893
|
+
for (const val of Object.values(o)) walkPostRow(val, resolve24, raw);
|
|
21860
21894
|
}
|
|
21861
21895
|
|
|
21862
21896
|
// src/commands/netcap/extractLinkedInPosts.ts
|
|
@@ -21870,8 +21904,8 @@ function findCommentaryRows(rows) {
|
|
|
21870
21904
|
}
|
|
21871
21905
|
function extractLinkedInPosts(flight, author = findAuthorSlug(flight)) {
|
|
21872
21906
|
const rows = parseRscRows(flight);
|
|
21873
|
-
const
|
|
21874
|
-
const mentionMap = buildMentionMap(rows,
|
|
21907
|
+
const resolve24 = makeRscResolver(rows);
|
|
21908
|
+
const mentionMap = buildMentionMap(rows, resolve24);
|
|
21875
21909
|
const posts = [];
|
|
21876
21910
|
for (const id of findCommentaryRows(rows)) {
|
|
21877
21911
|
const raw = {
|
|
@@ -21881,7 +21915,7 @@ function extractLinkedInPosts(flight, author = findAuthorSlug(flight)) {
|
|
|
21881
21915
|
links: [],
|
|
21882
21916
|
related: []
|
|
21883
21917
|
};
|
|
21884
|
-
walkPostRow(rows[id],
|
|
21918
|
+
walkPostRow(rows[id], resolve24, raw);
|
|
21885
21919
|
const post = buildPost(raw, mentionMap, author);
|
|
21886
21920
|
if (post) posts.push(post);
|
|
21887
21921
|
}
|
|
@@ -23324,7 +23358,7 @@ function parseIncoming(line, type) {
|
|
|
23324
23358
|
}
|
|
23325
23359
|
}
|
|
23326
23360
|
function requestSession(message3) {
|
|
23327
|
-
return new Promise((
|
|
23361
|
+
return new Promise((resolve24, reject) => {
|
|
23328
23362
|
connectToDaemon().then((socket) => {
|
|
23329
23363
|
let settled = false;
|
|
23330
23364
|
const finish = (error, sessionId) => {
|
|
@@ -23332,7 +23366,7 @@ function requestSession(message3) {
|
|
|
23332
23366
|
settled = true;
|
|
23333
23367
|
socket.destroy();
|
|
23334
23368
|
if (error) reject(error);
|
|
23335
|
-
else
|
|
23369
|
+
else resolve24(sessionId);
|
|
23336
23370
|
};
|
|
23337
23371
|
readSocketLines(socket, (line) => {
|
|
23338
23372
|
const incoming = parseIncoming(line, message3.type);
|
|
@@ -24377,7 +24411,7 @@ function getViolations(pattern2, options2 = {}, maxLines = DEFAULT_MAX_LINES) {
|
|
|
24377
24411
|
|
|
24378
24412
|
// src/commands/refactor/check/index.ts
|
|
24379
24413
|
function runScript(script, cwd) {
|
|
24380
|
-
return new Promise((
|
|
24414
|
+
return new Promise((resolve24) => {
|
|
24381
24415
|
const child = spawn6("npm", ["run", script], {
|
|
24382
24416
|
stdio: "pipe",
|
|
24383
24417
|
shell: true,
|
|
@@ -24391,7 +24425,7 @@ function runScript(script, cwd) {
|
|
|
24391
24425
|
output += data.toString();
|
|
24392
24426
|
});
|
|
24393
24427
|
child.on("close", (code) => {
|
|
24394
|
-
|
|
24428
|
+
resolve24({ script, code: code ?? 1, output });
|
|
24395
24429
|
});
|
|
24396
24430
|
});
|
|
24397
24431
|
}
|
|
@@ -27329,12 +27363,12 @@ function onCloseResult(ctx, code) {
|
|
|
27329
27363
|
return { ...closed, stderr: ctx.stderr.value, stdout: ctx.stdout.value };
|
|
27330
27364
|
}
|
|
27331
27365
|
function waitForChildExit(ctx) {
|
|
27332
|
-
return new Promise((
|
|
27366
|
+
return new Promise((resolve24) => {
|
|
27333
27367
|
let settled = false;
|
|
27334
27368
|
const settle = (result) => {
|
|
27335
27369
|
if (settled) return;
|
|
27336
27370
|
settled = true;
|
|
27337
|
-
|
|
27371
|
+
resolve24(result);
|
|
27338
27372
|
};
|
|
27339
27373
|
ctx.child.on("error", (err) => settle(onErrorResult(ctx, err)));
|
|
27340
27374
|
ctx.child.on("close", (code) => settle(onCloseResult(ctx, code)));
|
|
@@ -28850,9 +28884,9 @@ function createReadlineInterface() {
|
|
|
28850
28884
|
});
|
|
28851
28885
|
}
|
|
28852
28886
|
function askQuestion(rl, question) {
|
|
28853
|
-
return new Promise((
|
|
28887
|
+
return new Promise((resolve24) => {
|
|
28854
28888
|
rl.question(question, (answer) => {
|
|
28855
|
-
|
|
28889
|
+
resolve24(answer.trim());
|
|
28856
28890
|
});
|
|
28857
28891
|
});
|
|
28858
28892
|
}
|
|
@@ -29858,7 +29892,7 @@ function resolveParams(params, cliArgs) {
|
|
|
29858
29892
|
|
|
29859
29893
|
// src/commands/run/resolveRunCwd.ts
|
|
29860
29894
|
import { existsSync as existsSync63 } from "fs";
|
|
29861
|
-
import { resolve as
|
|
29895
|
+
import { resolve as resolve18 } from "path";
|
|
29862
29896
|
var MissingRunCwdError = class extends Error {
|
|
29863
29897
|
constructor(runName, cwd) {
|
|
29864
29898
|
super(`run config "${runName}": cwd ${cwd} does not exist`);
|
|
@@ -29869,7 +29903,7 @@ var MissingRunCwdError = class extends Error {
|
|
|
29869
29903
|
};
|
|
29870
29904
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
29871
29905
|
if (!config.cwd) return void 0;
|
|
29872
|
-
const cwd =
|
|
29906
|
+
const cwd = resolve18(baseDir, config.cwd);
|
|
29873
29907
|
if (!existsSync63(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
29874
29908
|
return cwd;
|
|
29875
29909
|
}
|
|
@@ -29881,12 +29915,12 @@ import { existsSync as existsSync65 } from "fs";
|
|
|
29881
29915
|
// src/commands/run/resolveCommand.ts
|
|
29882
29916
|
import { execFileSync as execFileSync11 } from "child_process";
|
|
29883
29917
|
import { existsSync as existsSync64 } from "fs";
|
|
29884
|
-
import { dirname as dirname35, join as join79, resolve as
|
|
29918
|
+
import { dirname as dirname35, join as join79, resolve as resolve19 } from "path";
|
|
29885
29919
|
function resolveCommand2(command) {
|
|
29886
29920
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
29887
29921
|
try {
|
|
29888
29922
|
const gitPath = execFileSync11("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
29889
|
-
const gitRoot =
|
|
29923
|
+
const gitRoot = resolve19(dirname35(gitPath), "..");
|
|
29890
29924
|
const gitBash = join79(gitRoot, "bin", "bash.exe");
|
|
29891
29925
|
if (existsSync64(gitBash)) return gitBash;
|
|
29892
29926
|
} catch {
|
|
@@ -30017,7 +30051,7 @@ function readMovement(cwd) {
|
|
|
30017
30051
|
// src/commands/watch/pollForMovement.ts
|
|
30018
30052
|
function pollForMovement(options2) {
|
|
30019
30053
|
const { upstream, intervalMs, timeoutMs, timeout, cwd } = options2;
|
|
30020
|
-
return new Promise((
|
|
30054
|
+
return new Promise((resolve24) => {
|
|
30021
30055
|
let settled = false;
|
|
30022
30056
|
const finish = (outcome) => {
|
|
30023
30057
|
if (settled) return;
|
|
@@ -30025,7 +30059,7 @@ function pollForMovement(options2) {
|
|
|
30025
30059
|
clearInterval(ticker);
|
|
30026
30060
|
clearTimeout(deadline);
|
|
30027
30061
|
process.off("SIGINT", onInterrupt);
|
|
30028
|
-
|
|
30062
|
+
resolve24(outcome);
|
|
30029
30063
|
};
|
|
30030
30064
|
const onInterrupt = () => finish({ kind: "interrupted" });
|
|
30031
30065
|
const ticker = setInterval(() => {
|
|
@@ -30149,7 +30183,7 @@ function extractCode(url, expectedState) {
|
|
|
30149
30183
|
return code;
|
|
30150
30184
|
}
|
|
30151
30185
|
function waitForCallback(port, expectedState) {
|
|
30152
|
-
return new Promise((
|
|
30186
|
+
return new Promise((resolve24, reject) => {
|
|
30153
30187
|
const timeout = setTimeout(() => {
|
|
30154
30188
|
server.close();
|
|
30155
30189
|
reject(new Error("Authorization timed out after 120 seconds"));
|
|
@@ -30166,7 +30200,7 @@ function waitForCallback(port, expectedState) {
|
|
|
30166
30200
|
const code = extractCode(url, expectedState);
|
|
30167
30201
|
respondHtml(res, 200, "Authorization successful!");
|
|
30168
30202
|
server.close();
|
|
30169
|
-
|
|
30203
|
+
resolve24(code);
|
|
30170
30204
|
} catch (error) {
|
|
30171
30205
|
respondHtml(res, 400, error.message);
|
|
30172
30206
|
server.close();
|
|
@@ -30631,7 +30665,7 @@ function registerRun(program2) {
|
|
|
30631
30665
|
import { execSync as execSync60 } from "child_process";
|
|
30632
30666
|
import { existsSync as existsSync67, mkdirSync as mkdirSync30, unlinkSync as unlinkSync22, writeFileSync as writeFileSync45 } from "fs";
|
|
30633
30667
|
import { tmpdir as tmpdir8 } from "os";
|
|
30634
|
-
import { join as join83, resolve as
|
|
30668
|
+
import { join as join83, resolve as resolve20 } from "path";
|
|
30635
30669
|
import chalk215 from "chalk";
|
|
30636
30670
|
|
|
30637
30671
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -30765,7 +30799,7 @@ function buildOutputPath(outputDir, processName) {
|
|
|
30765
30799
|
mkdirSync30(outputDir, { recursive: true });
|
|
30766
30800
|
}
|
|
30767
30801
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
30768
|
-
return
|
|
30802
|
+
return resolve20(outputDir, `${processName}-${timestamp6}.png`);
|
|
30769
30803
|
}
|
|
30770
30804
|
function runPowerShellScript(processName, outputPath) {
|
|
30771
30805
|
const scriptPath = join83(tmpdir8(), `assist-screenshot-${Date.now()}.ps1`);
|
|
@@ -30781,7 +30815,7 @@ function runPowerShellScript(processName, outputPath) {
|
|
|
30781
30815
|
}
|
|
30782
30816
|
function screenshot(processName) {
|
|
30783
30817
|
const config = loadConfig();
|
|
30784
|
-
const outputDir =
|
|
30818
|
+
const outputDir = resolve20(config.screenshot.outputDir);
|
|
30785
30819
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
30786
30820
|
console.log(chalk215.gray(`Capturing window for process "${processName}" ...`));
|
|
30787
30821
|
try {
|
|
@@ -30814,10 +30848,10 @@ var STATUS_TIMEOUT_MS = 5e3;
|
|
|
30814
30848
|
function queryDaemon(socket) {
|
|
30815
30849
|
socket.write(`${JSON.stringify({ type: "ping" })}
|
|
30816
30850
|
`);
|
|
30817
|
-
return new Promise((
|
|
30851
|
+
return new Promise((resolve24) => {
|
|
30818
30852
|
const result = { sessions: [] };
|
|
30819
30853
|
const pending = /* @__PURE__ */ new Set(["sessions", "pong"]);
|
|
30820
|
-
const timer = setTimeout(() =>
|
|
30854
|
+
const timer = setTimeout(() => resolve24(result), STATUS_TIMEOUT_MS);
|
|
30821
30855
|
const lines2 = createInterface5({ input: socket });
|
|
30822
30856
|
lines2.on("error", () => {
|
|
30823
30857
|
});
|
|
@@ -30825,7 +30859,7 @@ function queryDaemon(socket) {
|
|
|
30825
30859
|
applyLine(result, pending, line);
|
|
30826
30860
|
if (pending.size === 0) {
|
|
30827
30861
|
clearTimeout(timer);
|
|
30828
|
-
|
|
30862
|
+
resolve24(result);
|
|
30829
30863
|
}
|
|
30830
30864
|
});
|
|
30831
30865
|
});
|
|
@@ -30911,11 +30945,11 @@ function clearPersistedSessionsOnDrain() {
|
|
|
30911
30945
|
|
|
30912
30946
|
// src/commands/sessions/daemon/readDaemonMessage.ts
|
|
30913
30947
|
function readDaemonMessage(lines2, timeoutMs, fallback, match) {
|
|
30914
|
-
return new Promise((
|
|
30948
|
+
return new Promise((resolve24) => {
|
|
30915
30949
|
const finish = (value) => {
|
|
30916
30950
|
clearTimeout(timer);
|
|
30917
30951
|
lines2.off("line", onLine);
|
|
30918
|
-
|
|
30952
|
+
resolve24(value);
|
|
30919
30953
|
};
|
|
30920
30954
|
const timer = setTimeout(() => finish(fallback), timeoutMs);
|
|
30921
30955
|
const onLine = (line) => {
|
|
@@ -32219,7 +32253,7 @@ function emitSessionOutput(session, clients, data) {
|
|
|
32219
32253
|
|
|
32220
32254
|
// src/commands/sessions/daemon/exitReason.ts
|
|
32221
32255
|
import { existsSync as existsSync74 } from "fs";
|
|
32222
|
-
import { resolve as
|
|
32256
|
+
import { resolve as resolve21 } from "path";
|
|
32223
32257
|
function exitDetail(session) {
|
|
32224
32258
|
if (session.cwd && !existsSync74(session.cwd))
|
|
32225
32259
|
return `working directory ${session.cwd} no longer exists`;
|
|
@@ -32234,7 +32268,7 @@ function missingRunConfigCwd(session) {
|
|
|
32234
32268
|
const dir = session.cwd ?? process.cwd();
|
|
32235
32269
|
const config = resolveRunConfig(session.runName, dir);
|
|
32236
32270
|
if (!config?.cwd) return void 0;
|
|
32237
|
-
const configured =
|
|
32271
|
+
const configured = resolve21(runConfigBaseDirFrom(dir), config.cwd);
|
|
32238
32272
|
if (existsSync74(configured)) return void 0;
|
|
32239
32273
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
32240
32274
|
}
|
|
@@ -34249,7 +34283,7 @@ function boundTreeRoots(sessions, exclude) {
|
|
|
34249
34283
|
}
|
|
34250
34284
|
function treeRootOf(session) {
|
|
34251
34285
|
if (!session.cwd) return void 0;
|
|
34252
|
-
return findRepoRoot(session.cwd) ?? session.cwd;
|
|
34286
|
+
return canonicalTreePath(findRepoRoot(session.cwd) ?? session.cwd);
|
|
34253
34287
|
}
|
|
34254
34288
|
function holdsTree(session, root) {
|
|
34255
34289
|
if (session.closing) return true;
|
|
@@ -34285,7 +34319,7 @@ function ensureWatcher(ctx, cwd) {
|
|
|
34285
34319
|
const repoRoot2 = findRepoRoot(cwd) ?? cwd;
|
|
34286
34320
|
const cfg = worktreeConfigFor(repoRoot2);
|
|
34287
34321
|
if (!cfg.enabled || cfg.watcher !== true) return void 0;
|
|
34288
|
-
const clone = mainWorktree(repoRoot2) ?? repoRoot2;
|
|
34322
|
+
const clone = canonicalTreePath(mainWorktree(repoRoot2) ?? repoRoot2);
|
|
34289
34323
|
const live = liveWatcherFor(ctx.sessions, clone);
|
|
34290
34324
|
if (live) {
|
|
34291
34325
|
daemonLog(
|
|
@@ -34306,7 +34340,7 @@ function ensureWatcher(ctx, cwd) {
|
|
|
34306
34340
|
}
|
|
34307
34341
|
function liveWatcherFor(sessions, clone) {
|
|
34308
34342
|
for (const session of sessions.values())
|
|
34309
|
-
if (session.watcher === true && session.cwd === clone && session.status !== "stopped" && session.status !== "error")
|
|
34343
|
+
if (session.watcher === true && session.cwd !== void 0 && canonicalTreePath(session.cwd) === clone && session.status !== "stopped" && session.status !== "error")
|
|
34310
34344
|
return session;
|
|
34311
34345
|
return void 0;
|
|
34312
34346
|
}
|
|
@@ -34532,7 +34566,7 @@ function windowsDaemonHost() {
|
|
|
34532
34566
|
var CONNECT_TIMEOUT_MS = 2e3;
|
|
34533
34567
|
var KEEPALIVE_PROBE_MS = 1e4;
|
|
34534
34568
|
function connectToWindowsDaemon() {
|
|
34535
|
-
return new Promise((
|
|
34569
|
+
return new Promise((resolve24, reject) => {
|
|
34536
34570
|
const socket = net2.connect(windowsDaemonPort(), windowsDaemonHost());
|
|
34537
34571
|
socket.setTimeout(CONNECT_TIMEOUT_MS);
|
|
34538
34572
|
socket.once("timeout", () => {
|
|
@@ -34542,7 +34576,7 @@ function connectToWindowsDaemon() {
|
|
|
34542
34576
|
socket.once("connect", () => {
|
|
34543
34577
|
socket.setTimeout(0);
|
|
34544
34578
|
socket.setKeepAlive(true, KEEPALIVE_PROBE_MS);
|
|
34545
|
-
|
|
34579
|
+
resolve24(socket);
|
|
34546
34580
|
});
|
|
34547
34581
|
socket.once("error", reject);
|
|
34548
34582
|
});
|
|
@@ -34620,7 +34654,7 @@ async function waitForWindowsDaemon() {
|
|
|
34620
34654
|
);
|
|
34621
34655
|
}
|
|
34622
34656
|
function delay2(ms) {
|
|
34623
|
-
return new Promise((
|
|
34657
|
+
return new Promise((resolve24) => setTimeout(resolve24, ms));
|
|
34624
34658
|
}
|
|
34625
34659
|
|
|
34626
34660
|
// src/commands/sessions/daemon/defaultConnect.ts
|
|
@@ -34904,7 +34938,7 @@ async function healWindowsDaemon() {
|
|
|
34904
34938
|
daemonLog("windows daemon: auto-heal: stale daemon stopped");
|
|
34905
34939
|
}
|
|
34906
34940
|
function runOnWindowsHost(command, timeoutMs) {
|
|
34907
|
-
return new Promise((
|
|
34941
|
+
return new Promise((resolve24, reject) => {
|
|
34908
34942
|
const child = spawn12("pwsh.exe", ["-Command", command], {
|
|
34909
34943
|
stdio: ["ignore", "pipe", "pipe"]
|
|
34910
34944
|
});
|
|
@@ -34924,7 +34958,7 @@ function runOnWindowsHost(command, timeoutMs) {
|
|
|
34924
34958
|
});
|
|
34925
34959
|
child.on("exit", (code) => {
|
|
34926
34960
|
clearTimeout(timer);
|
|
34927
|
-
if (code === 0)
|
|
34961
|
+
if (code === 0) resolve24();
|
|
34928
34962
|
else
|
|
34929
34963
|
reject(
|
|
34930
34964
|
new Error(
|
|
@@ -36259,7 +36293,7 @@ function buildLimitsSegment(rateLimits) {
|
|
|
36259
36293
|
|
|
36260
36294
|
// src/commands/readGitBranch.ts
|
|
36261
36295
|
import { readFileSync as readFileSync58, statSync as statSync14 } from "fs";
|
|
36262
|
-
import { isAbsolute as isAbsolute4, join as join89, resolve as
|
|
36296
|
+
import { isAbsolute as isAbsolute4, join as join89, resolve as resolve22 } from "path";
|
|
36263
36297
|
function resolveGitDir(cwd) {
|
|
36264
36298
|
const dotGit = join89(cwd, ".git");
|
|
36265
36299
|
let stat4;
|
|
@@ -36282,7 +36316,7 @@ function resolveGitDir(cwd) {
|
|
|
36282
36316
|
return null;
|
|
36283
36317
|
}
|
|
36284
36318
|
const gitDir = match[1].trim();
|
|
36285
|
-
return isAbsolute4(gitDir) ? gitDir :
|
|
36319
|
+
return isAbsolute4(gitDir) ? gitDir : resolve22(cwd, gitDir);
|
|
36286
36320
|
}
|
|
36287
36321
|
function readGitBranch(cwd) {
|
|
36288
36322
|
const gitDir = resolveGitDir(cwd);
|