@staff0rd/assist 0.722.3 → 0.724.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/README.md +3 -0
- package/claude/commands/review-high-level.md +14 -0
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +206 -142
- 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.724.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -756,7 +756,7 @@ var assistConfigShape = {
|
|
|
756
756
|
trunk: z3.boolean().default(false),
|
|
757
757
|
includeDrafts: z3.boolean().default(false),
|
|
758
758
|
root: z3.string().optional(),
|
|
759
|
-
install: z3.union([z3.boolean(), z3.string()]).default(true),
|
|
759
|
+
install: z3.union([z3.boolean(), z3.string(), z3.array(z3.string())]).default(true),
|
|
760
760
|
commitBeforeManualChecks: z3.boolean().default(false),
|
|
761
761
|
commitBeforePhaseEnd: z3.boolean().optional(),
|
|
762
762
|
copy: z3.array(z3.string()).default([
|
|
@@ -1786,9 +1786,9 @@ var daemonPaths = {
|
|
|
1786
1786
|
|
|
1787
1787
|
// src/commands/sessions/daemon/connectToDaemon.ts
|
|
1788
1788
|
function connectToDaemon() {
|
|
1789
|
-
return new Promise((
|
|
1789
|
+
return new Promise((resolve26, reject) => {
|
|
1790
1790
|
const socket = net.connect(daemonPaths.socket);
|
|
1791
|
-
socket.once("connect", () =>
|
|
1791
|
+
socket.once("connect", () => resolve26(socket));
|
|
1792
1792
|
socket.once("error", reject);
|
|
1793
1793
|
});
|
|
1794
1794
|
}
|
|
@@ -2106,7 +2106,7 @@ ${failed3.length} script(s) failed:`);
|
|
|
2106
2106
|
}
|
|
2107
2107
|
}
|
|
2108
2108
|
function runEntry(entry) {
|
|
2109
|
-
return new Promise((
|
|
2109
|
+
return new Promise((resolve26) => {
|
|
2110
2110
|
const startTime = Date.now();
|
|
2111
2111
|
const child = spawnCommand(
|
|
2112
2112
|
entry.fullCommand,
|
|
@@ -2118,7 +2118,7 @@ function runEntry(entry) {
|
|
|
2118
2118
|
child.on("close", (code) => {
|
|
2119
2119
|
const exitCode = code ?? 1;
|
|
2120
2120
|
flushIfFailed(exitCode, chunks);
|
|
2121
|
-
|
|
2121
|
+
resolve26({
|
|
2122
2122
|
script: entry.name,
|
|
2123
2123
|
code: exitCode,
|
|
2124
2124
|
durationMs: Date.now() - startTime
|
|
@@ -5678,7 +5678,7 @@ function parsePreviewDecision(line, requestId) {
|
|
|
5678
5678
|
|
|
5679
5679
|
// src/commands/sessions/shared/requestPreviewDecision.ts
|
|
5680
5680
|
function requestPreviewDecision(request) {
|
|
5681
|
-
return new Promise((
|
|
5681
|
+
return new Promise((resolve26, reject) => {
|
|
5682
5682
|
connectToDaemon().then((socket) => {
|
|
5683
5683
|
let settled = false;
|
|
5684
5684
|
const finish2 = (error, decision) => {
|
|
@@ -5686,7 +5686,7 @@ function requestPreviewDecision(request) {
|
|
|
5686
5686
|
settled = true;
|
|
5687
5687
|
socket.destroy();
|
|
5688
5688
|
if (error) reject(error);
|
|
5689
|
-
else
|
|
5689
|
+
else resolve26(decision);
|
|
5690
5690
|
};
|
|
5691
5691
|
readSocketLines(socket, (line) => {
|
|
5692
5692
|
const incoming = parsePreviewDecision(line, request.requestId);
|
|
@@ -7174,8 +7174,8 @@ function spawnInherit(command, args, options2 = {}) {
|
|
|
7174
7174
|
env: { ...env, ...options2.env },
|
|
7175
7175
|
cwd: options2.cwd
|
|
7176
7176
|
});
|
|
7177
|
-
const done2 = new Promise((
|
|
7178
|
-
child.on("close", (code) =>
|
|
7177
|
+
const done2 = new Promise((resolve26, reject) => {
|
|
7178
|
+
child.on("close", (code) => resolve26(code ?? 0));
|
|
7179
7179
|
child.on("error", reject);
|
|
7180
7180
|
});
|
|
7181
7181
|
return { child, done: done2 };
|
|
@@ -7601,7 +7601,7 @@ Failed to launch Claude for ${context}: ${message3}`)
|
|
|
7601
7601
|
// src/commands/sessions/daemon/sendToDaemon.ts
|
|
7602
7602
|
var WRITE_TIMEOUT_MS = 500;
|
|
7603
7603
|
function sendToDaemon(message3) {
|
|
7604
|
-
return new Promise((
|
|
7604
|
+
return new Promise((resolve26, reject) => {
|
|
7605
7605
|
connectToDaemon().then((socket) => {
|
|
7606
7606
|
const timer = setTimeout(() => {
|
|
7607
7607
|
socket.destroy();
|
|
@@ -7615,7 +7615,7 @@ function sendToDaemon(message3) {
|
|
|
7615
7615
|
`, () => {
|
|
7616
7616
|
clearTimeout(timer);
|
|
7617
7617
|
socket.end();
|
|
7618
|
-
|
|
7618
|
+
resolve26();
|
|
7619
7619
|
});
|
|
7620
7620
|
}, reject);
|
|
7621
7621
|
});
|
|
@@ -7624,7 +7624,7 @@ function sendToDaemon(message3) {
|
|
|
7624
7624
|
// src/commands/sessions/daemon/sendToDaemonAwaitAck.ts
|
|
7625
7625
|
var ACK_TIMEOUT_MS = 1e3;
|
|
7626
7626
|
function sendToDaemonAwaitAck(message3) {
|
|
7627
|
-
return new Promise((
|
|
7627
|
+
return new Promise((resolve26, reject) => {
|
|
7628
7628
|
connectToDaemon().then((socket) => {
|
|
7629
7629
|
let settled = false;
|
|
7630
7630
|
const finish2 = (error) => {
|
|
@@ -7633,7 +7633,7 @@ function sendToDaemonAwaitAck(message3) {
|
|
|
7633
7633
|
clearTimeout(timer);
|
|
7634
7634
|
socket.destroy();
|
|
7635
7635
|
if (error) reject(error);
|
|
7636
|
-
else
|
|
7636
|
+
else resolve26();
|
|
7637
7637
|
};
|
|
7638
7638
|
const timer = setTimeout(
|
|
7639
7639
|
() => finish2(new Error("timed out awaiting daemon ack")),
|
|
@@ -7724,7 +7724,7 @@ async function deliverReliably(sessionId, status3, payload) {
|
|
|
7724
7724
|
}
|
|
7725
7725
|
}
|
|
7726
7726
|
function sleep(ms) {
|
|
7727
|
-
return new Promise((
|
|
7727
|
+
return new Promise((resolve26) => setTimeout(resolve26, ms));
|
|
7728
7728
|
}
|
|
7729
7729
|
function describeError(error) {
|
|
7730
7730
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -10694,7 +10694,7 @@ function spawnDaemon(reason4) {
|
|
|
10694
10694
|
child.unref();
|
|
10695
10695
|
}
|
|
10696
10696
|
function delay(ms) {
|
|
10697
|
-
return new Promise((
|
|
10697
|
+
return new Promise((resolve26) => setTimeout(resolve26, ms));
|
|
10698
10698
|
}
|
|
10699
10699
|
|
|
10700
10700
|
// src/commands/sessions/daemon/originForCwd.ts
|
|
@@ -10736,10 +10736,10 @@ function gitInvocation(cwd, args) {
|
|
|
10736
10736
|
}
|
|
10737
10737
|
function git(cwd, args) {
|
|
10738
10738
|
const { file, argv, options: options2 } = gitInvocation(cwd, args);
|
|
10739
|
-
return new Promise((
|
|
10739
|
+
return new Promise((resolve26, reject) => {
|
|
10740
10740
|
execFile2(file, argv, options2, (error, stdout) => {
|
|
10741
10741
|
if (error) reject(error);
|
|
10742
|
-
else
|
|
10742
|
+
else resolve26(stdout.toString());
|
|
10743
10743
|
});
|
|
10744
10744
|
});
|
|
10745
10745
|
}
|
|
@@ -11278,12 +11278,12 @@ async function loadVisibleItems(req) {
|
|
|
11278
11278
|
|
|
11279
11279
|
// src/commands/backlog/web/parseStatusBody.ts
|
|
11280
11280
|
function readBody(req) {
|
|
11281
|
-
return new Promise((
|
|
11281
|
+
return new Promise((resolve26, reject) => {
|
|
11282
11282
|
let body = "";
|
|
11283
11283
|
req.on("data", (chunk) => {
|
|
11284
11284
|
body += chunk.toString();
|
|
11285
11285
|
});
|
|
11286
|
-
req.on("end", () =>
|
|
11286
|
+
req.on("end", () => resolve26(body));
|
|
11287
11287
|
req.on("error", reject);
|
|
11288
11288
|
});
|
|
11289
11289
|
}
|
|
@@ -12855,7 +12855,7 @@ var sessionsConfigHelp = [
|
|
|
12855
12855
|
{
|
|
12856
12856
|
key: "worktree.install",
|
|
12857
12857
|
setter: "assist config set worktree.install true -g --repo",
|
|
12858
|
-
note:
|
|
12858
|
+
note: `per-worktree dep install: true auto-detects the package manager, or give an explicit command; false to skip; or a JSON list of paths (e.g. '[".","packages/ui"]') to auto-detect and install in each, in order, stopping at the first failure`
|
|
12859
12859
|
},
|
|
12860
12860
|
{
|
|
12861
12861
|
key: "worktree.commitBeforePhaseEnd",
|
|
@@ -13392,11 +13392,11 @@ async function queryNodes() {
|
|
|
13392
13392
|
} catch {
|
|
13393
13393
|
return void 0;
|
|
13394
13394
|
}
|
|
13395
|
-
return new Promise((
|
|
13395
|
+
return new Promise((resolve26) => {
|
|
13396
13396
|
const finish2 = (result) => {
|
|
13397
13397
|
clearTimeout(timer);
|
|
13398
13398
|
socket.destroy();
|
|
13399
|
-
|
|
13399
|
+
resolve26(result);
|
|
13400
13400
|
};
|
|
13401
13401
|
const timer = setTimeout(() => finish2(void 0), QUERY_TIMEOUT_MS);
|
|
13402
13402
|
const lines2 = createInterface5({ input: socket });
|
|
@@ -14139,7 +14139,7 @@ function forwardToPeer(req, res, node, url) {
|
|
|
14139
14139
|
const label2 = `link ${node} http: ${req.method} ${url.pathname} trace=${traceId}`;
|
|
14140
14140
|
const log2 = (outcome) => console.log(`${label2} -> ${outcome} (${Date.now() - started}ms)`);
|
|
14141
14141
|
const send = url.protocol === "https:" ? httpsRequest : httpRequest;
|
|
14142
|
-
return new Promise((
|
|
14142
|
+
return new Promise((resolve26) => {
|
|
14143
14143
|
const upstream = send(
|
|
14144
14144
|
url,
|
|
14145
14145
|
{
|
|
@@ -14151,7 +14151,7 @@ function forwardToPeer(req, res, node, url) {
|
|
|
14151
14151
|
[TRACE_HEADER]: traceId
|
|
14152
14152
|
}
|
|
14153
14153
|
},
|
|
14154
|
-
(peer) => relayPeerResponse(peer, res, url.pathname, log2,
|
|
14154
|
+
(peer) => relayPeerResponse(peer, res, url.pathname, log2, resolve26)
|
|
14155
14155
|
);
|
|
14156
14156
|
upstream.on("error", (error) => {
|
|
14157
14157
|
log2(`failed: ${error.message}`);
|
|
@@ -14160,7 +14160,7 @@ function forwardToPeer(req, res, node, url) {
|
|
|
14160
14160
|
respondJson(res, 502, {
|
|
14161
14161
|
error: `${node} unreachable: ${error.message}`
|
|
14162
14162
|
});
|
|
14163
|
-
|
|
14163
|
+
resolve26();
|
|
14164
14164
|
});
|
|
14165
14165
|
req.pipe(upstream);
|
|
14166
14166
|
});
|
|
@@ -14782,17 +14782,17 @@ async function stopDaemon() {
|
|
|
14782
14782
|
}
|
|
14783
14783
|
}
|
|
14784
14784
|
function closedBeforeTimeout(socket) {
|
|
14785
|
-
return new Promise((
|
|
14785
|
+
return new Promise((resolve26) => {
|
|
14786
14786
|
const timer = setTimeout(() => {
|
|
14787
14787
|
socket.destroy();
|
|
14788
|
-
|
|
14788
|
+
resolve26(false);
|
|
14789
14789
|
}, STOP_TIMEOUT_MS);
|
|
14790
14790
|
socket.resume();
|
|
14791
14791
|
socket.on("error", () => {
|
|
14792
14792
|
});
|
|
14793
14793
|
socket.once("close", () => {
|
|
14794
14794
|
clearTimeout(timer);
|
|
14795
|
-
|
|
14795
|
+
resolve26(true);
|
|
14796
14796
|
});
|
|
14797
14797
|
});
|
|
14798
14798
|
}
|
|
@@ -14844,8 +14844,8 @@ async function restartWeb(req, res, deps2 = {}) {
|
|
|
14844
14844
|
respondJson(res, 400, { error: "Invalid target" });
|
|
14845
14845
|
return;
|
|
14846
14846
|
}
|
|
14847
|
-
await new Promise((
|
|
14848
|
-
res.once("finish",
|
|
14847
|
+
await new Promise((resolve26) => {
|
|
14848
|
+
res.once("finish", resolve26);
|
|
14849
14849
|
respondJson(res, 200, { ok: true });
|
|
14850
14850
|
});
|
|
14851
14851
|
await performRestart(target, deps2);
|
|
@@ -14979,8 +14979,8 @@ async function selfUpdate(_req, res, deps2 = {}) {
|
|
|
14979
14979
|
return;
|
|
14980
14980
|
}
|
|
14981
14981
|
console.log("self-update: updated; restarting daemon and web server");
|
|
14982
|
-
await new Promise((
|
|
14983
|
-
res.once("finish",
|
|
14982
|
+
await new Promise((resolve26) => {
|
|
14983
|
+
res.once("finish", resolve26);
|
|
14984
14984
|
respondJson(res, 200, { ok: true });
|
|
14985
14985
|
});
|
|
14986
14986
|
await performRestart("both", restartDeps);
|
|
@@ -15113,6 +15113,12 @@ function configLeafSchema(schema2, key) {
|
|
|
15113
15113
|
function coerceStructuredConfigValue(key, raw) {
|
|
15114
15114
|
const schema2 = configLeafSchema(assistConfigSchema, key);
|
|
15115
15115
|
if (!schema2) return { ok: false, error: `Unknown config key "${key}"` };
|
|
15116
|
+
const fromJson = parseJson(raw);
|
|
15117
|
+
if (fromJson !== void 0) {
|
|
15118
|
+
const parsedJson = schema2.safeParse(fromJson);
|
|
15119
|
+
if (parsedJson.success)
|
|
15120
|
+
return { ok: true, value: parsedJson.data };
|
|
15121
|
+
}
|
|
15116
15122
|
const parsed = schema2.safeParse(raw);
|
|
15117
15123
|
if (parsed.success)
|
|
15118
15124
|
return { ok: true, value: parsed.data };
|
|
@@ -15121,6 +15127,14 @@ function coerceStructuredConfigValue(key, raw) {
|
|
|
15121
15127
|
error: parsed.error.issues.map((issue) => formatIssue(key, issue)).join("\n")
|
|
15122
15128
|
};
|
|
15123
15129
|
}
|
|
15130
|
+
function parseJson(raw) {
|
|
15131
|
+
if (typeof raw !== "string") return void 0;
|
|
15132
|
+
try {
|
|
15133
|
+
return JSON.parse(raw);
|
|
15134
|
+
} catch {
|
|
15135
|
+
return void 0;
|
|
15136
|
+
}
|
|
15137
|
+
}
|
|
15124
15138
|
function formatIssue(key, issue) {
|
|
15125
15139
|
const path106 = formatConfigPath([
|
|
15126
15140
|
{ kind: "key", name: key },
|
|
@@ -17747,12 +17761,12 @@ function hasSubcommands(helpText) {
|
|
|
17747
17761
|
// src/commands/permitCliReads/runHelp.ts
|
|
17748
17762
|
import { exec as exec2 } from "child_process";
|
|
17749
17763
|
function runHelp(args) {
|
|
17750
|
-
return new Promise((
|
|
17764
|
+
return new Promise((resolve26) => {
|
|
17751
17765
|
exec2(
|
|
17752
17766
|
`${args.join(" ")} --help`,
|
|
17753
17767
|
{ encoding: "utf8", timeout: 3e4 },
|
|
17754
17768
|
(_err, stdout, stderr) => {
|
|
17755
|
-
|
|
17769
|
+
resolve26(stdout || stderr || "");
|
|
17756
17770
|
}
|
|
17757
17771
|
);
|
|
17758
17772
|
});
|
|
@@ -24720,24 +24734,52 @@ import { copyFileSync, existsSync as existsSync60, mkdirSync as mkdirSync17 } fr
|
|
|
24720
24734
|
import { dirname as dirname29, join as join66 } from "path";
|
|
24721
24735
|
|
|
24722
24736
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
24723
|
-
import {
|
|
24737
|
+
import { resolve as resolve16 } from "path";
|
|
24724
24738
|
|
|
24725
|
-
// src/commands/sessions/daemon/worktree/
|
|
24739
|
+
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
24726
24740
|
import { existsSync as existsSync59 } from "fs";
|
|
24727
24741
|
import { join as join65 } from "path";
|
|
24728
|
-
function detectInstallCommand(
|
|
24729
|
-
if (!existsSync59(join65(
|
|
24730
|
-
if (existsSync59(join65(
|
|
24731
|
-
if (existsSync59(join65(
|
|
24732
|
-
if (existsSync59(join65(
|
|
24742
|
+
function detectInstallCommand(dir) {
|
|
24743
|
+
if (!existsSync59(join65(dir, "package.json"))) return null;
|
|
24744
|
+
if (existsSync59(join65(dir, "pnpm-lock.yaml"))) return "pnpm install";
|
|
24745
|
+
if (existsSync59(join65(dir, "yarn.lock"))) return "yarn install";
|
|
24746
|
+
if (existsSync59(join65(dir, "bun.lockb"))) return "bun install";
|
|
24733
24747
|
return "npm install";
|
|
24734
24748
|
}
|
|
24749
|
+
|
|
24750
|
+
// src/commands/sessions/daemon/worktree/resolveInstallCommand.ts
|
|
24735
24751
|
function resolveInstallCommand(repoRoot2, install) {
|
|
24736
24752
|
if (install === false) return null;
|
|
24737
24753
|
if (typeof install === "string") return install;
|
|
24738
24754
|
return detectInstallCommand(repoRoot2);
|
|
24739
24755
|
}
|
|
24740
24756
|
|
|
24757
|
+
// src/commands/sessions/daemon/worktree/spawnInstall.ts
|
|
24758
|
+
import { spawn as spawn6 } from "child_process";
|
|
24759
|
+
|
|
24760
|
+
// src/commands/sessions/daemon/worktree/installInvocation.ts
|
|
24761
|
+
function installInvocation(worktreePath, command) {
|
|
24762
|
+
const windows = /^[A-Za-z]:[\\/]/.test(worktreePath);
|
|
24763
|
+
const shell = windows ? "cmd.exe" : process.env.SHELL ?? "bash";
|
|
24764
|
+
const args = windows ? ["/c", `cd /d ${quoteForCmd(worktreePath)} && ${command}`] : ["-l", "-c", `cd ${quoteForPosixShell(worktreePath)} && ${command}`];
|
|
24765
|
+
return [
|
|
24766
|
+
shell,
|
|
24767
|
+
args,
|
|
24768
|
+
{
|
|
24769
|
+
cwd: worktreePath,
|
|
24770
|
+
detached: true,
|
|
24771
|
+
windowsHide: true,
|
|
24772
|
+
stdio: ["ignore", "ignore", "pipe"]
|
|
24773
|
+
}
|
|
24774
|
+
];
|
|
24775
|
+
}
|
|
24776
|
+
function quoteForCmd(value) {
|
|
24777
|
+
return `"${value.replaceAll('"', "")}"`;
|
|
24778
|
+
}
|
|
24779
|
+
function quoteForPosixShell(value) {
|
|
24780
|
+
return `'${value.replaceAll("'", `'\\''`)}'`;
|
|
24781
|
+
}
|
|
24782
|
+
|
|
24741
24783
|
// src/commands/sessions/daemon/worktree/stopInstall.ts
|
|
24742
24784
|
import { execFile as execFile11 } from "child_process";
|
|
24743
24785
|
var running2 = /* @__PURE__ */ new Map();
|
|
@@ -24745,7 +24787,9 @@ function trackInstall(worktreePath, child) {
|
|
|
24745
24787
|
running2.set(worktreePath, child);
|
|
24746
24788
|
}
|
|
24747
24789
|
function untrackInstall(worktreePath, child) {
|
|
24748
|
-
if (running2.get(worktreePath)
|
|
24790
|
+
if (running2.get(worktreePath) !== child) return false;
|
|
24791
|
+
running2.delete(worktreePath);
|
|
24792
|
+
return true;
|
|
24749
24793
|
}
|
|
24750
24794
|
function stopInstall(worktreePath) {
|
|
24751
24795
|
const child = running2.get(worktreePath);
|
|
@@ -24777,61 +24821,81 @@ function killTree(pid) {
|
|
|
24777
24821
|
}
|
|
24778
24822
|
}
|
|
24779
24823
|
|
|
24780
|
-
// src/commands/sessions/daemon/worktree/
|
|
24781
|
-
function installInvocation(worktreePath, command) {
|
|
24782
|
-
const windows = /^[A-Za-z]:[\\/]/.test(worktreePath);
|
|
24783
|
-
const shell = windows ? "cmd.exe" : process.env.SHELL ?? "bash";
|
|
24784
|
-
const args = windows ? ["/c", `cd /d ${quoteForCmd(worktreePath)} && ${command}`] : ["-l", "-c", `cd ${quoteForPosixShell(worktreePath)} && ${command}`];
|
|
24785
|
-
return [
|
|
24786
|
-
shell,
|
|
24787
|
-
args,
|
|
24788
|
-
{
|
|
24789
|
-
cwd: worktreePath,
|
|
24790
|
-
detached: true,
|
|
24791
|
-
windowsHide: true,
|
|
24792
|
-
stdio: ["ignore", "ignore", "pipe"]
|
|
24793
|
-
}
|
|
24794
|
-
];
|
|
24795
|
-
}
|
|
24796
|
-
function quoteForCmd(value) {
|
|
24797
|
-
return `"${value.replaceAll('"', "")}"`;
|
|
24798
|
-
}
|
|
24799
|
-
function quoteForPosixShell(value) {
|
|
24800
|
-
return `'${value.replaceAll("'", `'\\''`)}'`;
|
|
24801
|
-
}
|
|
24802
|
-
|
|
24803
|
-
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
24824
|
+
// src/commands/sessions/daemon/worktree/spawnInstall.ts
|
|
24804
24825
|
var STDERR_TAIL = 2e3;
|
|
24805
|
-
function
|
|
24806
|
-
|
|
24807
|
-
|
|
24808
|
-
onSeeded();
|
|
24809
|
-
return;
|
|
24810
|
-
}
|
|
24811
|
-
daemonLog(`worktree ${worktreePath} installing deps: ${command}`);
|
|
24812
|
-
const child = spawn6(...installInvocation(worktreePath, command));
|
|
24826
|
+
function spawnInstall(worktreePath, cwd, command, where, onDone) {
|
|
24827
|
+
daemonLog(`worktree ${worktreePath} installing deps${where}: ${command}`);
|
|
24828
|
+
const child = spawn6(...installInvocation(cwd, command));
|
|
24813
24829
|
trackInstall(worktreePath, child);
|
|
24814
24830
|
let stderr = "";
|
|
24815
24831
|
child.stderr?.on("data", (chunk) => {
|
|
24816
24832
|
stderr = (stderr + chunk.toString()).slice(-STDERR_TAIL);
|
|
24817
24833
|
});
|
|
24818
24834
|
let settled = false;
|
|
24819
|
-
const settle = (outcome) => {
|
|
24835
|
+
const settle = (ok, outcome) => {
|
|
24820
24836
|
if (settled) return;
|
|
24821
24837
|
settled = true;
|
|
24822
|
-
untrackInstall(worktreePath, child);
|
|
24823
|
-
daemonLog(`worktree ${worktreePath} install ${outcome}`);
|
|
24824
|
-
|
|
24838
|
+
const stopped = !untrackInstall(worktreePath, child);
|
|
24839
|
+
daemonLog(`worktree ${worktreePath} install${where} ${outcome}`);
|
|
24840
|
+
onDone({ ok, stopped });
|
|
24825
24841
|
};
|
|
24826
|
-
child.on(
|
|
24842
|
+
child.on(
|
|
24843
|
+
"error",
|
|
24844
|
+
(error) => settle(false, `failed to start: ${error.message}`)
|
|
24845
|
+
);
|
|
24827
24846
|
child.on(
|
|
24828
24847
|
"close",
|
|
24829
24848
|
(code, signal) => settle(
|
|
24849
|
+
code === 0,
|
|
24830
24850
|
code === 0 ? "complete" : `failed (${signal ? `signal ${signal}` : `exit ${code}`}): ${stderr.trim() || "no output"}`
|
|
24831
24851
|
)
|
|
24832
24852
|
);
|
|
24833
24853
|
}
|
|
24834
24854
|
|
|
24855
|
+
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
24856
|
+
function runInstall(worktreePath, clone, install, onSeeded) {
|
|
24857
|
+
if (Array.isArray(install)) {
|
|
24858
|
+
installPaths(worktreePath, install, onSeeded);
|
|
24859
|
+
return;
|
|
24860
|
+
}
|
|
24861
|
+
const command = resolveInstallCommand(clone, install);
|
|
24862
|
+
if (!command) {
|
|
24863
|
+
onSeeded();
|
|
24864
|
+
return;
|
|
24865
|
+
}
|
|
24866
|
+
spawnInstall(worktreePath, worktreePath, command, "", () => onSeeded());
|
|
24867
|
+
}
|
|
24868
|
+
function installPaths(worktreePath, paths, onSeeded) {
|
|
24869
|
+
const next3 = (index3) => {
|
|
24870
|
+
const rel = paths[index3];
|
|
24871
|
+
if (rel === void 0) {
|
|
24872
|
+
onSeeded();
|
|
24873
|
+
return;
|
|
24874
|
+
}
|
|
24875
|
+
const dir = resolve16(worktreePath, rel);
|
|
24876
|
+
const command = detectInstallCommand(dir);
|
|
24877
|
+
if (!command) {
|
|
24878
|
+
daemonLog(
|
|
24879
|
+
`worktree ${worktreePath} install in ${rel} failed: no package.json at ${dir}; skipping remaining paths`
|
|
24880
|
+
);
|
|
24881
|
+
onSeeded();
|
|
24882
|
+
return;
|
|
24883
|
+
}
|
|
24884
|
+
spawnInstall(worktreePath, dir, command, ` in ${rel}`, (outcome) => {
|
|
24885
|
+
if (outcome.ok && !outcome.stopped) {
|
|
24886
|
+
next3(index3 + 1);
|
|
24887
|
+
return;
|
|
24888
|
+
}
|
|
24889
|
+
if (index3 < paths.length - 1)
|
|
24890
|
+
daemonLog(
|
|
24891
|
+
`worktree ${worktreePath} install skipping remaining paths: ${paths.slice(index3 + 1).join(", ")}`
|
|
24892
|
+
);
|
|
24893
|
+
onSeeded();
|
|
24894
|
+
});
|
|
24895
|
+
};
|
|
24896
|
+
next3(0);
|
|
24897
|
+
}
|
|
24898
|
+
|
|
24835
24899
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
24836
24900
|
function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
24837
24901
|
}) {
|
|
@@ -24866,7 +24930,7 @@ function placedByDaemon() {
|
|
|
24866
24930
|
function seed(worktreePath, clone) {
|
|
24867
24931
|
console.log(`Preparing ${worktreePath}\u2026`);
|
|
24868
24932
|
return new Promise(
|
|
24869
|
-
(
|
|
24933
|
+
(resolve26) => seedWorktree(worktreePath, clone, resolve26)
|
|
24870
24934
|
);
|
|
24871
24935
|
}
|
|
24872
24936
|
async function moveToPrCheckoutTree() {
|
|
@@ -25148,12 +25212,12 @@ function registerLitellm(program2) {
|
|
|
25148
25212
|
|
|
25149
25213
|
// src/commands/mermaidExport.ts
|
|
25150
25214
|
import { mkdirSync as mkdirSync18, readdirSync as readdirSync11 } from "fs";
|
|
25151
|
-
import { resolve as
|
|
25215
|
+
import { resolve as resolve18 } from "path";
|
|
25152
25216
|
import chalk173 from "chalk";
|
|
25153
25217
|
|
|
25154
25218
|
// src/commands/mermaid/exportFile.ts
|
|
25155
25219
|
import { readFileSync as readFileSync39, writeFileSync as writeFileSync32 } from "fs";
|
|
25156
|
-
import { basename as basename18, extname as extname2, resolve as
|
|
25220
|
+
import { basename as basename18, extname as extname2, resolve as resolve17 } from "path";
|
|
25157
25221
|
import chalk172 from "chalk";
|
|
25158
25222
|
|
|
25159
25223
|
// src/commands/mermaid/renderBlock.ts
|
|
@@ -25201,7 +25265,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
25201
25265
|
for (const [i, source] of blocks.entries()) {
|
|
25202
25266
|
const idx = i + 1;
|
|
25203
25267
|
if (onlyIndex !== void 0 && idx !== onlyIndex) continue;
|
|
25204
|
-
const outPath =
|
|
25268
|
+
const outPath = resolve17(outDir, `${stem}-${idx}.svg`);
|
|
25205
25269
|
const svg = await renderBlock(krokiUrl, source);
|
|
25206
25270
|
writeFileSync32(outPath, svg, "utf8");
|
|
25207
25271
|
console.log(chalk172.green(` \u2192 ${outPath}`));
|
|
@@ -25215,7 +25279,7 @@ function extractMermaidBlocks(markdown) {
|
|
|
25215
25279
|
// src/commands/mermaidExport.ts
|
|
25216
25280
|
async function mermaidExport(file, options2 = {}) {
|
|
25217
25281
|
const { mermaid } = loadConfig();
|
|
25218
|
-
const outDir =
|
|
25282
|
+
const outDir = resolve18(process.cwd(), options2.out ?? ".");
|
|
25219
25283
|
mkdirSync18(outDir, { recursive: true });
|
|
25220
25284
|
if (options2.index !== void 0) {
|
|
25221
25285
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
@@ -25343,17 +25407,17 @@ function emitExtract(out, header, texts) {
|
|
|
25343
25407
|
}
|
|
25344
25408
|
|
|
25345
25409
|
// src/commands/miro/resolveExtractPath.ts
|
|
25346
|
-
import { isAbsolute as isAbsolute3, relative as relative5, resolve as
|
|
25410
|
+
import { isAbsolute as isAbsolute3, relative as relative5, resolve as resolve19 } from "path";
|
|
25347
25411
|
function extractRoot(cwd) {
|
|
25348
25412
|
return findConfigUp(cwd)?.rootDir ?? cwd;
|
|
25349
25413
|
}
|
|
25350
25414
|
function resolveExtractPath(value, cwd) {
|
|
25351
25415
|
if (value === void 0) return void 0;
|
|
25352
|
-
return isAbsolute3(value) ? value :
|
|
25416
|
+
return isAbsolute3(value) ? value : resolve19(extractRoot(cwd), value);
|
|
25353
25417
|
}
|
|
25354
25418
|
function storedExtractPath(value, cwd) {
|
|
25355
25419
|
if (value === void 0) return void 0;
|
|
25356
|
-
const absolute2 =
|
|
25420
|
+
const absolute2 = resolve19(cwd, value);
|
|
25357
25421
|
const within = relative5(extractRoot(cwd), absolute2);
|
|
25358
25422
|
return within.startsWith("..") ? absolute2 : within;
|
|
25359
25423
|
}
|
|
@@ -25940,7 +26004,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
25940
26004
|
}
|
|
25941
26005
|
|
|
25942
26006
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
25943
|
-
import { isAbsolute as isAbsolute4, join as join70, resolve as
|
|
26007
|
+
import { isAbsolute as isAbsolute4, join as join70, resolve as resolve20 } from "path";
|
|
25944
26008
|
|
|
25945
26009
|
// src/commands/netcap/defaultCapturePath.ts
|
|
25946
26010
|
import { homedir as homedir21 } from "os";
|
|
@@ -25952,7 +26016,7 @@ function defaultCapturePath() {
|
|
|
25952
26016
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
25953
26017
|
function resolveNetcapOutPath(out) {
|
|
25954
26018
|
if (!out) return defaultCapturePath();
|
|
25955
|
-
const dir = isAbsolute4(out) ? out :
|
|
26019
|
+
const dir = isAbsolute4(out) ? out : resolve20(process.cwd(), out);
|
|
25956
26020
|
return join70(dir, "capture.jsonl");
|
|
25957
26021
|
}
|
|
25958
26022
|
|
|
@@ -26043,25 +26107,25 @@ function isVisibleText(t) {
|
|
|
26043
26107
|
return /[a-zA-Z]{3,}/.test(t);
|
|
26044
26108
|
}
|
|
26045
26109
|
var isHashtag = (t) => /^#[A-Za-z0-9_]+$/.test(t);
|
|
26046
|
-
function collectRscText(v,
|
|
26110
|
+
function collectRscText(v, resolve26, sink3, seen) {
|
|
26047
26111
|
if (v == null) return;
|
|
26048
26112
|
if (typeof v === "string") {
|
|
26049
26113
|
if (isRscRef(v)) {
|
|
26050
26114
|
if (!seen.has(v)) {
|
|
26051
26115
|
seen.add(v);
|
|
26052
|
-
collectRscText(
|
|
26116
|
+
collectRscText(resolve26(v), resolve26, sink3, seen);
|
|
26053
26117
|
}
|
|
26054
26118
|
} else if (isHashtag(v)) sink3.hashtags.push(v);
|
|
26055
26119
|
else if (isVisibleText(v)) sink3.text.push(v);
|
|
26056
26120
|
return;
|
|
26057
26121
|
}
|
|
26058
26122
|
if (Array.isArray(v)) {
|
|
26059
|
-
for (const x of v) collectRscText(x,
|
|
26123
|
+
for (const x of v) collectRscText(x, resolve26, sink3, seen);
|
|
26060
26124
|
return;
|
|
26061
26125
|
}
|
|
26062
26126
|
if (typeof v === "object") {
|
|
26063
26127
|
for (const val of Object.values(v)) {
|
|
26064
|
-
collectRscText(val,
|
|
26128
|
+
collectRscText(val, resolve26, sink3, seen);
|
|
26065
26129
|
}
|
|
26066
26130
|
}
|
|
26067
26131
|
}
|
|
@@ -26093,7 +26157,7 @@ function visitObjects(root2, fn) {
|
|
|
26093
26157
|
}
|
|
26094
26158
|
}
|
|
26095
26159
|
}
|
|
26096
|
-
function buildMentionMap(rows,
|
|
26160
|
+
function buildMentionMap(rows, resolve26) {
|
|
26097
26161
|
const map = /* @__PURE__ */ new Map();
|
|
26098
26162
|
visitObjects(rows, (o) => {
|
|
26099
26163
|
const url = profileActionUrl(o);
|
|
@@ -26101,7 +26165,7 @@ function buildMentionMap(rows, resolve25) {
|
|
|
26101
26165
|
const slug2 = slugFromProfileUrl(url);
|
|
26102
26166
|
if (!slug2 || map.has(slug2)) return;
|
|
26103
26167
|
const sink3 = { text: [], hashtags: [] };
|
|
26104
|
-
collectRscText(o.children,
|
|
26168
|
+
collectRscText(o.children, resolve26, sink3, /* @__PURE__ */ new Set());
|
|
26105
26169
|
const name = sink3.text.join(" ").replace(/\s+/g, " ").trim();
|
|
26106
26170
|
map.set(slug2, name ? { slug: slug2, name, url } : { slug: slug2, url });
|
|
26107
26171
|
});
|
|
@@ -26187,10 +26251,10 @@ function buildPost(raw, mentionMap, author) {
|
|
|
26187
26251
|
|
|
26188
26252
|
// src/commands/netcap/walkPostRow.ts
|
|
26189
26253
|
var isCommentary = (o) => asObject(o.viewTrackingSpecs)?.viewName === "feed-commentary";
|
|
26190
|
-
function walkPostRow(v,
|
|
26254
|
+
function walkPostRow(v, resolve26, raw) {
|
|
26191
26255
|
if (v == null || typeof v !== "object") return;
|
|
26192
26256
|
if (Array.isArray(v)) {
|
|
26193
|
-
for (const x of v) walkPostRow(x,
|
|
26257
|
+
for (const x of v) walkPostRow(x, resolve26, raw);
|
|
26194
26258
|
return;
|
|
26195
26259
|
}
|
|
26196
26260
|
const o = v;
|
|
@@ -26204,9 +26268,9 @@ function walkPostRow(v, resolve25, raw) {
|
|
|
26204
26268
|
}
|
|
26205
26269
|
if (isCommentary(o)) {
|
|
26206
26270
|
const sink3 = { text: raw.text, hashtags: raw.hashtags };
|
|
26207
|
-
collectRscText(o.children,
|
|
26271
|
+
collectRscText(o.children, resolve26, sink3, /* @__PURE__ */ new Set());
|
|
26208
26272
|
}
|
|
26209
|
-
for (const val of Object.values(o)) walkPostRow(val,
|
|
26273
|
+
for (const val of Object.values(o)) walkPostRow(val, resolve26, raw);
|
|
26210
26274
|
}
|
|
26211
26275
|
|
|
26212
26276
|
// src/commands/netcap/extractLinkedInPosts.ts
|
|
@@ -26220,8 +26284,8 @@ function findCommentaryRows(rows) {
|
|
|
26220
26284
|
}
|
|
26221
26285
|
function extractLinkedInPosts(flight, author = findAuthorSlug(flight)) {
|
|
26222
26286
|
const rows = parseRscRows(flight);
|
|
26223
|
-
const
|
|
26224
|
-
const mentionMap = buildMentionMap(rows,
|
|
26287
|
+
const resolve26 = makeRscResolver(rows);
|
|
26288
|
+
const mentionMap = buildMentionMap(rows, resolve26);
|
|
26225
26289
|
const posts = [];
|
|
26226
26290
|
for (const id of findCommentaryRows(rows)) {
|
|
26227
26291
|
const raw = {
|
|
@@ -26231,7 +26295,7 @@ function extractLinkedInPosts(flight, author = findAuthorSlug(flight)) {
|
|
|
26231
26295
|
links: [],
|
|
26232
26296
|
related: []
|
|
26233
26297
|
};
|
|
26234
|
-
walkPostRow(rows[id],
|
|
26298
|
+
walkPostRow(rows[id], resolve26, raw);
|
|
26235
26299
|
const post = buildPost(raw, mentionMap, author);
|
|
26236
26300
|
if (post) posts.push(post);
|
|
26237
26301
|
}
|
|
@@ -27778,7 +27842,7 @@ function parseIncoming(line, type) {
|
|
|
27778
27842
|
}
|
|
27779
27843
|
}
|
|
27780
27844
|
function requestSession(message3) {
|
|
27781
|
-
return new Promise((
|
|
27845
|
+
return new Promise((resolve26, reject) => {
|
|
27782
27846
|
connectToDaemon().then((socket) => {
|
|
27783
27847
|
let settled = false;
|
|
27784
27848
|
const finish2 = (error, sessionId) => {
|
|
@@ -27786,7 +27850,7 @@ function requestSession(message3) {
|
|
|
27786
27850
|
settled = true;
|
|
27787
27851
|
socket.destroy();
|
|
27788
27852
|
if (error) reject(error);
|
|
27789
|
-
else
|
|
27853
|
+
else resolve26(sessionId);
|
|
27790
27854
|
};
|
|
27791
27855
|
readSocketLines(socket, (line) => {
|
|
27792
27856
|
const incoming = parseIncoming(line, message3.type);
|
|
@@ -29661,7 +29725,7 @@ async function notify() {
|
|
|
29661
29725
|
import { execSync as execSync52 } from "child_process";
|
|
29662
29726
|
import { existsSync as existsSync63, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync38 } from "fs";
|
|
29663
29727
|
import { tmpdir as tmpdir9 } from "os";
|
|
29664
|
-
import { join as join76, resolve as
|
|
29728
|
+
import { join as join76, resolve as resolve21 } from "path";
|
|
29665
29729
|
import chalk203 from "chalk";
|
|
29666
29730
|
|
|
29667
29731
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -29795,7 +29859,7 @@ function buildOutputPath(outputDir, processName) {
|
|
|
29795
29859
|
mkdirSync21(outputDir, { recursive: true });
|
|
29796
29860
|
}
|
|
29797
29861
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
29798
|
-
return
|
|
29862
|
+
return resolve21(outputDir, `${processName}-${timestamp6}.png`);
|
|
29799
29863
|
}
|
|
29800
29864
|
function runPowerShellScript(processName, outputPath) {
|
|
29801
29865
|
const scriptPath = join76(tmpdir9(), `assist-screenshot-${Date.now()}.ps1`);
|
|
@@ -29811,7 +29875,7 @@ function runPowerShellScript(processName, outputPath) {
|
|
|
29811
29875
|
}
|
|
29812
29876
|
function screenshot(processName) {
|
|
29813
29877
|
const config = loadConfig();
|
|
29814
|
-
const outputDir =
|
|
29878
|
+
const outputDir = resolve21(config.screenshot.outputDir);
|
|
29815
29879
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
29816
29880
|
console.log(chalk203.gray(`Capturing window for process "${processName}" ...`));
|
|
29817
29881
|
try {
|
|
@@ -29913,7 +29977,7 @@ function buildLimitsSegment(rateLimits) {
|
|
|
29913
29977
|
|
|
29914
29978
|
// src/commands/readGitBranch.ts
|
|
29915
29979
|
import { readFileSync as readFileSync46, statSync as statSync10 } from "fs";
|
|
29916
|
-
import { isAbsolute as isAbsolute5, join as join77, resolve as
|
|
29980
|
+
import { isAbsolute as isAbsolute5, join as join77, resolve as resolve22 } from "path";
|
|
29917
29981
|
function resolveGitDir(cwd) {
|
|
29918
29982
|
const dotGit = join77(cwd, ".git");
|
|
29919
29983
|
let stat4;
|
|
@@ -29936,7 +30000,7 @@ function resolveGitDir(cwd) {
|
|
|
29936
30000
|
return null;
|
|
29937
30001
|
}
|
|
29938
30002
|
const gitDir = match[1].trim();
|
|
29939
|
-
return isAbsolute5(gitDir) ? gitDir :
|
|
30003
|
+
return isAbsolute5(gitDir) ? gitDir : resolve22(cwd, gitDir);
|
|
29940
30004
|
}
|
|
29941
30005
|
function readGitBranch(cwd) {
|
|
29942
30006
|
const gitDir = resolveGitDir(cwd);
|
|
@@ -30246,7 +30310,7 @@ function getViolations(pattern2, options2 = {}, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
30246
30310
|
|
|
30247
30311
|
// src/commands/refactor/check.ts
|
|
30248
30312
|
function runScript(script, cwd) {
|
|
30249
|
-
return new Promise((
|
|
30313
|
+
return new Promise((resolve26) => {
|
|
30250
30314
|
const child = spawn7("npm", ["run", script], {
|
|
30251
30315
|
stdio: "pipe",
|
|
30252
30316
|
shell: true,
|
|
@@ -30260,7 +30324,7 @@ function runScript(script, cwd) {
|
|
|
30260
30324
|
output += data.toString();
|
|
30261
30325
|
});
|
|
30262
30326
|
child.on("close", (code) => {
|
|
30263
|
-
|
|
30327
|
+
resolve26({ script, code: code ?? 1, output });
|
|
30264
30328
|
});
|
|
30265
30329
|
});
|
|
30266
30330
|
}
|
|
@@ -34735,12 +34799,12 @@ function onCloseResult(ctx, code) {
|
|
|
34735
34799
|
return { ...closed, stderr: ctx.stderr.value, stdout: ctx.stdout.value };
|
|
34736
34800
|
}
|
|
34737
34801
|
function waitForChildExit(ctx) {
|
|
34738
|
-
return new Promise((
|
|
34802
|
+
return new Promise((resolve26) => {
|
|
34739
34803
|
let settled = false;
|
|
34740
34804
|
const settle = (result) => {
|
|
34741
34805
|
if (settled) return;
|
|
34742
34806
|
settled = true;
|
|
34743
|
-
|
|
34807
|
+
resolve26(result);
|
|
34744
34808
|
};
|
|
34745
34809
|
ctx.child.on("error", (err) => settle(onErrorResult(ctx, err)));
|
|
34746
34810
|
ctx.child.on("close", (code) => settle(onCloseResult(ctx, code)));
|
|
@@ -37085,9 +37149,9 @@ function createReadlineInterface() {
|
|
|
37085
37149
|
});
|
|
37086
37150
|
}
|
|
37087
37151
|
function askQuestion(rl, question) {
|
|
37088
|
-
return new Promise((
|
|
37152
|
+
return new Promise((resolve26) => {
|
|
37089
37153
|
rl.question(question, (answer) => {
|
|
37090
|
-
|
|
37154
|
+
resolve26(answer.trim());
|
|
37091
37155
|
});
|
|
37092
37156
|
});
|
|
37093
37157
|
}
|
|
@@ -38876,7 +38940,7 @@ function resolveParams(params, cliArgs) {
|
|
|
38876
38940
|
|
|
38877
38941
|
// src/commands/run/resolveRunCwd.ts
|
|
38878
38942
|
import { existsSync as existsSync84 } from "fs";
|
|
38879
|
-
import { resolve as
|
|
38943
|
+
import { resolve as resolve24 } from "path";
|
|
38880
38944
|
var MissingRunCwdError = class extends Error {
|
|
38881
38945
|
constructor(runName, cwd) {
|
|
38882
38946
|
super(`run config "${runName}": cwd ${cwd} does not exist`);
|
|
@@ -38887,7 +38951,7 @@ var MissingRunCwdError = class extends Error {
|
|
|
38887
38951
|
};
|
|
38888
38952
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
38889
38953
|
if (!config.cwd) return void 0;
|
|
38890
|
-
const cwd =
|
|
38954
|
+
const cwd = resolve24(baseDir, config.cwd);
|
|
38891
38955
|
if (!existsSync84(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
38892
38956
|
return cwd;
|
|
38893
38957
|
}
|
|
@@ -39003,7 +39067,7 @@ function readMovement(cwd) {
|
|
|
39003
39067
|
// src/commands/watch/pollForMovement.ts
|
|
39004
39068
|
function pollForMovement(options2) {
|
|
39005
39069
|
const { upstream, intervalMs, timeoutMs, timeout, cwd } = options2;
|
|
39006
|
-
return new Promise((
|
|
39070
|
+
return new Promise((resolve26) => {
|
|
39007
39071
|
let settled = false;
|
|
39008
39072
|
const finish2 = (outcome) => {
|
|
39009
39073
|
if (settled) return;
|
|
@@ -39011,7 +39075,7 @@ function pollForMovement(options2) {
|
|
|
39011
39075
|
clearInterval(ticker);
|
|
39012
39076
|
clearTimeout(deadline);
|
|
39013
39077
|
process.off("SIGINT", onInterrupt);
|
|
39014
|
-
|
|
39078
|
+
resolve26(outcome);
|
|
39015
39079
|
};
|
|
39016
39080
|
const onInterrupt = () => finish2({ kind: "interrupted" });
|
|
39017
39081
|
const ticker = setInterval(() => {
|
|
@@ -39137,7 +39201,7 @@ function extractCode(url, expectedState) {
|
|
|
39137
39201
|
return code;
|
|
39138
39202
|
}
|
|
39139
39203
|
function waitForCallback(port, expectedState) {
|
|
39140
|
-
return new Promise((
|
|
39204
|
+
return new Promise((resolve26, reject) => {
|
|
39141
39205
|
const timeout = setTimeout(() => {
|
|
39142
39206
|
server.close();
|
|
39143
39207
|
reject(new Error("Authorization timed out after 120 seconds"));
|
|
@@ -39154,7 +39218,7 @@ function waitForCallback(port, expectedState) {
|
|
|
39154
39218
|
const code = extractCode(url, expectedState);
|
|
39155
39219
|
respondHtml(res, 200, "Authorization successful!");
|
|
39156
39220
|
server.close();
|
|
39157
|
-
|
|
39221
|
+
resolve26(code);
|
|
39158
39222
|
} catch (error) {
|
|
39159
39223
|
respondHtml(res, 400, error.message);
|
|
39160
39224
|
server.close();
|
|
@@ -39667,10 +39731,10 @@ var STATUS_TIMEOUT_MS = 5e3;
|
|
|
39667
39731
|
function queryDaemon(socket) {
|
|
39668
39732
|
socket.write(`${JSON.stringify({ type: "ping" })}
|
|
39669
39733
|
`);
|
|
39670
|
-
return new Promise((
|
|
39734
|
+
return new Promise((resolve26) => {
|
|
39671
39735
|
const result = { sessions: [] };
|
|
39672
39736
|
const pending = /* @__PURE__ */ new Set(["sessions", "pong"]);
|
|
39673
|
-
const timer = setTimeout(() =>
|
|
39737
|
+
const timer = setTimeout(() => resolve26(result), STATUS_TIMEOUT_MS);
|
|
39674
39738
|
const lines2 = createInterface8({ input: socket });
|
|
39675
39739
|
lines2.on("error", () => {
|
|
39676
39740
|
});
|
|
@@ -39678,7 +39742,7 @@ function queryDaemon(socket) {
|
|
|
39678
39742
|
applyLine(result, pending, line);
|
|
39679
39743
|
if (pending.size === 0) {
|
|
39680
39744
|
clearTimeout(timer);
|
|
39681
|
-
|
|
39745
|
+
resolve26(result);
|
|
39682
39746
|
}
|
|
39683
39747
|
});
|
|
39684
39748
|
});
|
|
@@ -39778,11 +39842,11 @@ function clearPersistedSessionsOnDrain() {
|
|
|
39778
39842
|
|
|
39779
39843
|
// src/commands/sessions/daemon/readDaemonMessage.ts
|
|
39780
39844
|
function readDaemonMessage(lines2, timeoutMs, fallback, match) {
|
|
39781
|
-
return new Promise((
|
|
39845
|
+
return new Promise((resolve26) => {
|
|
39782
39846
|
const finish2 = (value) => {
|
|
39783
39847
|
clearTimeout(timer);
|
|
39784
39848
|
lines2.off("line", onLine);
|
|
39785
|
-
|
|
39849
|
+
resolve26(value);
|
|
39786
39850
|
};
|
|
39787
39851
|
const timer = setTimeout(() => finish2(fallback), timeoutMs);
|
|
39788
39852
|
const onLine = (line) => {
|
|
@@ -41242,7 +41306,7 @@ function emitSessionOutput(session, clients, data) {
|
|
|
41242
41306
|
|
|
41243
41307
|
// src/commands/sessions/daemon/exitReason.ts
|
|
41244
41308
|
import { existsSync as existsSync92 } from "fs";
|
|
41245
|
-
import { resolve as
|
|
41309
|
+
import { resolve as resolve25 } from "path";
|
|
41246
41310
|
function exitDetail(session) {
|
|
41247
41311
|
if (session.cwd && !existsSync92(session.cwd))
|
|
41248
41312
|
return `working directory ${session.cwd} no longer exists`;
|
|
@@ -41257,7 +41321,7 @@ function missingRunConfigCwd(session) {
|
|
|
41257
41321
|
const dir = session.cwd ?? process.cwd();
|
|
41258
41322
|
const config = resolveRunConfig(session.runName, dir);
|
|
41259
41323
|
if (!config?.cwd) return void 0;
|
|
41260
|
-
const configured =
|
|
41324
|
+
const configured = resolve25(runConfigBaseDirFrom(dir), config.cwd);
|
|
41261
41325
|
if (existsSync92(configured)) return void 0;
|
|
41262
41326
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
41263
41327
|
}
|
|
@@ -43945,14 +44009,14 @@ function linkWebSocketUrl(url) {
|
|
|
43945
44009
|
return target.toString();
|
|
43946
44010
|
}
|
|
43947
44011
|
function connectLinkWebSocket(url, handlers) {
|
|
43948
|
-
return new Promise((
|
|
44012
|
+
return new Promise((resolve26, reject) => {
|
|
43949
44013
|
const ws = new WebSocket(linkWebSocketUrl(url), {
|
|
43950
44014
|
handshakeTimeout: HANDSHAKE_TIMEOUT_MS
|
|
43951
44015
|
});
|
|
43952
44016
|
let open = false;
|
|
43953
44017
|
ws.on("open", () => {
|
|
43954
44018
|
open = true;
|
|
43955
|
-
|
|
44019
|
+
resolve26({
|
|
43956
44020
|
send: (line) => {
|
|
43957
44021
|
if (ws.readyState !== WebSocket.OPEN) return false;
|
|
43958
44022
|
ws.send(line);
|
|
@@ -44026,11 +44090,11 @@ import { spawn as spawn11 } from "child_process";
|
|
|
44026
44090
|
// src/commands/sessions/shared/portAccepts.ts
|
|
44027
44091
|
import { connect as connect3 } from "net";
|
|
44028
44092
|
function portAccepts(port, timeoutMs = 1e3) {
|
|
44029
|
-
return new Promise((
|
|
44093
|
+
return new Promise((resolve26) => {
|
|
44030
44094
|
const socket = connect3({ host: "127.0.0.1", port });
|
|
44031
44095
|
const settle = (ok) => {
|
|
44032
44096
|
socket.destroy();
|
|
44033
|
-
|
|
44097
|
+
resolve26(ok);
|
|
44034
44098
|
};
|
|
44035
44099
|
socket.setTimeout(timeoutMs, () => settle(false));
|
|
44036
44100
|
socket.once("connect", () => settle(true));
|
|
@@ -44195,7 +44259,7 @@ function failPendingCreators(state, message3) {
|
|
|
44195
44259
|
}
|
|
44196
44260
|
function resetRelayState(state, reason4) {
|
|
44197
44261
|
failPendingCreators(state, reason4);
|
|
44198
|
-
for (const
|
|
44262
|
+
for (const resolve26 of state.historyWaiters) resolve26([]);
|
|
44199
44263
|
state.historyWaiters = [];
|
|
44200
44264
|
state.sessions = [];
|
|
44201
44265
|
state.lastSnapshot = void 0;
|
|
@@ -44639,16 +44703,16 @@ var HISTORY_TIMEOUT_MS = 5e3;
|
|
|
44639
44703
|
function requestLinkHistory(ctx) {
|
|
44640
44704
|
if (!ctx.greeted) return Promise.resolve([]);
|
|
44641
44705
|
const waiters = ctx.relay.historyWaiters;
|
|
44642
|
-
return new Promise((
|
|
44706
|
+
return new Promise((resolve26) => {
|
|
44643
44707
|
const settle = (sessions) => {
|
|
44644
44708
|
clearTimeout(timer);
|
|
44645
|
-
|
|
44709
|
+
resolve26(sessions);
|
|
44646
44710
|
};
|
|
44647
44711
|
const timer = setTimeout(() => {
|
|
44648
44712
|
const index3 = waiters.indexOf(settle);
|
|
44649
44713
|
if (index3 !== -1) waiters.splice(index3, 1);
|
|
44650
44714
|
daemonLog(`link ${ctx.spec.name} ws: history timed out`);
|
|
44651
|
-
|
|
44715
|
+
resolve26(ctx.relay.lastHistory ?? []);
|
|
44652
44716
|
}, HISTORY_TIMEOUT_MS);
|
|
44653
44717
|
timer.unref?.();
|
|
44654
44718
|
waiters.push(settle);
|
|
@@ -46294,8 +46358,8 @@ var HELLO_TIMEOUT_MS = 5e3;
|
|
|
46294
46358
|
async function probePeerHello(url) {
|
|
46295
46359
|
let settle = () => {
|
|
46296
46360
|
};
|
|
46297
|
-
const reply2 = new Promise((
|
|
46298
|
-
settle =
|
|
46361
|
+
const reply2 = new Promise((resolve26) => {
|
|
46362
|
+
settle = resolve26;
|
|
46299
46363
|
});
|
|
46300
46364
|
const socket = await connectLinkWebSocket(url, {
|
|
46301
46365
|
onLine: (line) => {
|
|
@@ -46323,7 +46387,7 @@ async function probePeerHello(url) {
|
|
|
46323
46387
|
import { spawn as spawn12 } from "child_process";
|
|
46324
46388
|
var PROBE_TIMEOUT_MS = 15e3;
|
|
46325
46389
|
function probeSsh(alias) {
|
|
46326
|
-
return new Promise((
|
|
46390
|
+
return new Promise((resolve26) => {
|
|
46327
46391
|
const child = spawn12(
|
|
46328
46392
|
"ssh",
|
|
46329
46393
|
["-o", "BatchMode=yes", "-o", "ConnectTimeout=5", alias, "exit"],
|
|
@@ -46336,11 +46400,11 @@ function probeSsh(alias) {
|
|
|
46336
46400
|
const timer = setTimeout(() => child.kill(), PROBE_TIMEOUT_MS);
|
|
46337
46401
|
child.once("error", (error) => {
|
|
46338
46402
|
clearTimeout(timer);
|
|
46339
|
-
|
|
46403
|
+
resolve26({ code: null, stderr: error.message });
|
|
46340
46404
|
});
|
|
46341
46405
|
child.once("close", (code) => {
|
|
46342
46406
|
clearTimeout(timer);
|
|
46343
|
-
|
|
46407
|
+
resolve26({ code, stderr: stderr.trim() });
|
|
46344
46408
|
});
|
|
46345
46409
|
});
|
|
46346
46410
|
}
|