@staff0rd/assist 0.971.0 → 0.973.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 +1 -1
- package/dist/index.js +323 -230
- 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.973.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -369,9 +369,9 @@ var daemonPaths = {
|
|
|
369
369
|
|
|
370
370
|
// src/commands/sessions/daemon/connectToDaemon.ts
|
|
371
371
|
function connectToDaemon() {
|
|
372
|
-
return new Promise((
|
|
372
|
+
return new Promise((resolve32, reject) => {
|
|
373
373
|
const socket = net.connect(daemonPaths.socket);
|
|
374
|
-
socket.once("connect", () =>
|
|
374
|
+
socket.once("connect", () => resolve32(socket));
|
|
375
375
|
socket.once("error", reject);
|
|
376
376
|
});
|
|
377
377
|
}
|
|
@@ -452,7 +452,7 @@ function spawnDaemon(reason4) {
|
|
|
452
452
|
child.unref();
|
|
453
453
|
}
|
|
454
454
|
function delay(ms) {
|
|
455
|
-
return new Promise((
|
|
455
|
+
return new Promise((resolve32) => setTimeout(resolve32, ms));
|
|
456
456
|
}
|
|
457
457
|
|
|
458
458
|
// src/shared/loadConfig.ts
|
|
@@ -1630,7 +1630,7 @@ var defaultDeps = {
|
|
|
1630
1630
|
serve: async (args) => {
|
|
1631
1631
|
await runTailscale(args);
|
|
1632
1632
|
},
|
|
1633
|
-
sleep: (ms) => new Promise((
|
|
1633
|
+
sleep: (ms) => new Promise((resolve32) => setTimeout(resolve32, ms)),
|
|
1634
1634
|
httpsPort: tailnetHttpsPort
|
|
1635
1635
|
};
|
|
1636
1636
|
async function ensureTailscaleServe(port, deps2 = {}) {
|
|
@@ -1665,11 +1665,11 @@ function createLinkWaiters() {
|
|
|
1665
1665
|
const waiters = /* @__PURE__ */ new Set();
|
|
1666
1666
|
return {
|
|
1667
1667
|
wait(timeoutMs, onTimeout) {
|
|
1668
|
-
return new Promise((
|
|
1668
|
+
return new Promise((resolve32, reject) => {
|
|
1669
1669
|
const onLink = (link3) => {
|
|
1670
1670
|
clearTimeout(timer);
|
|
1671
1671
|
waiters.delete(onLink);
|
|
1672
|
-
|
|
1672
|
+
resolve32(link3);
|
|
1673
1673
|
};
|
|
1674
1674
|
const timer = setTimeout(() => {
|
|
1675
1675
|
waiters.delete(onLink);
|
|
@@ -1732,7 +1732,7 @@ function createPendingReplies() {
|
|
|
1732
1732
|
return {
|
|
1733
1733
|
send(ws, timeoutMs, write) {
|
|
1734
1734
|
const id = randomUUID();
|
|
1735
|
-
return new Promise((
|
|
1735
|
+
return new Promise((resolve32, reject) => {
|
|
1736
1736
|
const timer = setTimeout(() => {
|
|
1737
1737
|
pending.delete(id);
|
|
1738
1738
|
reject(
|
|
@@ -1742,7 +1742,7 @@ function createPendingReplies() {
|
|
|
1742
1742
|
)
|
|
1743
1743
|
);
|
|
1744
1744
|
}, timeoutMs);
|
|
1745
|
-
pending.set(id, { ws, timer, resolve:
|
|
1745
|
+
pending.set(id, { ws, timer, resolve: resolve32, reject });
|
|
1746
1746
|
write(id);
|
|
1747
1747
|
});
|
|
1748
1748
|
},
|
|
@@ -4093,12 +4093,12 @@ async function loadVisibleItems(req) {
|
|
|
4093
4093
|
|
|
4094
4094
|
// src/commands/backlog/web/parseStatusBody.ts
|
|
4095
4095
|
function readBody(req) {
|
|
4096
|
-
return new Promise((
|
|
4096
|
+
return new Promise((resolve32, reject) => {
|
|
4097
4097
|
let body = "";
|
|
4098
4098
|
req.on("data", (chunk) => {
|
|
4099
4099
|
body += chunk.toString();
|
|
4100
4100
|
});
|
|
4101
|
-
req.on("end", () =>
|
|
4101
|
+
req.on("end", () => resolve32(body));
|
|
4102
4102
|
req.on("error", reject);
|
|
4103
4103
|
});
|
|
4104
4104
|
}
|
|
@@ -4630,11 +4630,11 @@ async function requestDaemonReply(request, replyType, timeoutMs = QUERY_TIMEOUT_
|
|
|
4630
4630
|
} catch {
|
|
4631
4631
|
return void 0;
|
|
4632
4632
|
}
|
|
4633
|
-
return new Promise((
|
|
4633
|
+
return new Promise((resolve32) => {
|
|
4634
4634
|
const finish2 = (result) => {
|
|
4635
4635
|
clearTimeout(timer);
|
|
4636
4636
|
socket.destroy();
|
|
4637
|
-
|
|
4637
|
+
resolve32(result);
|
|
4638
4638
|
};
|
|
4639
4639
|
const timer = setTimeout(() => finish2(void 0), timeoutMs);
|
|
4640
4640
|
const lines2 = createInterface2({ input: socket });
|
|
@@ -4829,7 +4829,7 @@ function parseIncoming(line, type) {
|
|
|
4829
4829
|
}
|
|
4830
4830
|
}
|
|
4831
4831
|
function requestSession(message3) {
|
|
4832
|
-
return new Promise((
|
|
4832
|
+
return new Promise((resolve32, reject) => {
|
|
4833
4833
|
connectToDaemon().then((socket) => {
|
|
4834
4834
|
let settled = false;
|
|
4835
4835
|
const finish2 = (error, sessionId) => {
|
|
@@ -4837,7 +4837,7 @@ function requestSession(message3) {
|
|
|
4837
4837
|
settled = true;
|
|
4838
4838
|
socket.destroy();
|
|
4839
4839
|
if (error) reject(error);
|
|
4840
|
-
else
|
|
4840
|
+
else resolve32(sessionId);
|
|
4841
4841
|
};
|
|
4842
4842
|
readSocketLines(socket, (line) => {
|
|
4843
4843
|
const incoming = parseIncoming(line, message3.type);
|
|
@@ -8164,7 +8164,7 @@ function forwardToPeer(req, res, node, url) {
|
|
|
8164
8164
|
const label = `link ${node} http: ${req.method} ${url.pathname} trace=${traceId}`;
|
|
8165
8165
|
const log2 = (outcome) => console.log(`${label} -> ${outcome} (${Date.now() - started}ms)`);
|
|
8166
8166
|
const send = url.protocol === "https:" ? httpsRequest : httpRequest;
|
|
8167
|
-
return new Promise((
|
|
8167
|
+
return new Promise((resolve32) => {
|
|
8168
8168
|
const upstream = send(
|
|
8169
8169
|
url,
|
|
8170
8170
|
{
|
|
@@ -8176,7 +8176,7 @@ function forwardToPeer(req, res, node, url) {
|
|
|
8176
8176
|
[TRACE_HEADER]: traceId
|
|
8177
8177
|
}
|
|
8178
8178
|
},
|
|
8179
|
-
(peer) => relayPeerResponse(peer, res, url.pathname, log2,
|
|
8179
|
+
(peer) => relayPeerResponse(peer, res, url.pathname, log2, resolve32)
|
|
8180
8180
|
);
|
|
8181
8181
|
boundUpstream(upstream, res, peerTimeoutFor(url.pathname));
|
|
8182
8182
|
upstream.on("error", (error) => {
|
|
@@ -8186,7 +8186,7 @@ function forwardToPeer(req, res, node, url) {
|
|
|
8186
8186
|
respondJson(res, 502, {
|
|
8187
8187
|
error: `${node} unreachable: ${error.message}`
|
|
8188
8188
|
});
|
|
8189
|
-
|
|
8189
|
+
resolve32();
|
|
8190
8190
|
});
|
|
8191
8191
|
req.pipe(upstream);
|
|
8192
8192
|
});
|
|
@@ -10557,17 +10557,17 @@ async function stopDaemon() {
|
|
|
10557
10557
|
}
|
|
10558
10558
|
}
|
|
10559
10559
|
function closedBeforeTimeout(socket) {
|
|
10560
|
-
return new Promise((
|
|
10560
|
+
return new Promise((resolve32) => {
|
|
10561
10561
|
const timer = setTimeout(() => {
|
|
10562
10562
|
socket.destroy();
|
|
10563
|
-
|
|
10563
|
+
resolve32(false);
|
|
10564
10564
|
}, STOP_TIMEOUT_MS);
|
|
10565
10565
|
socket.resume();
|
|
10566
10566
|
socket.on("error", () => {
|
|
10567
10567
|
});
|
|
10568
10568
|
socket.once("close", () => {
|
|
10569
10569
|
clearTimeout(timer);
|
|
10570
|
-
|
|
10570
|
+
resolve32(true);
|
|
10571
10571
|
});
|
|
10572
10572
|
});
|
|
10573
10573
|
}
|
|
@@ -10625,8 +10625,8 @@ async function restartWeb(req, res, deps2 = {}) {
|
|
|
10625
10625
|
return;
|
|
10626
10626
|
}
|
|
10627
10627
|
console.log(`restart ${target} ${linkedRequester(req)}`);
|
|
10628
|
-
await new Promise((
|
|
10629
|
-
res.once("finish",
|
|
10628
|
+
await new Promise((resolve32) => {
|
|
10629
|
+
res.once("finish", resolve32);
|
|
10630
10630
|
respondJson(res, 200, { ok: true });
|
|
10631
10631
|
});
|
|
10632
10632
|
try {
|
|
@@ -10817,8 +10817,8 @@ async function selfUpdate(req, res, deps2 = {}) {
|
|
|
10817
10817
|
return;
|
|
10818
10818
|
}
|
|
10819
10819
|
console.log("self-update: updated; restarting daemon and web server");
|
|
10820
|
-
await new Promise((
|
|
10821
|
-
res.once("finish",
|
|
10820
|
+
await new Promise((resolve32) => {
|
|
10821
|
+
res.once("finish", resolve32);
|
|
10822
10822
|
respondJson(res, 200, { ok: true });
|
|
10823
10823
|
});
|
|
10824
10824
|
await performRestart("both", restartDeps);
|
|
@@ -10913,14 +10913,14 @@ function linkWebSocketUrl(url) {
|
|
|
10913
10913
|
return target.toString();
|
|
10914
10914
|
}
|
|
10915
10915
|
function connectLinkWebSocket(url, handlers) {
|
|
10916
|
-
return new Promise((
|
|
10916
|
+
return new Promise((resolve32, reject) => {
|
|
10917
10917
|
const ws = new WebSocket(linkWebSocketUrl(url), {
|
|
10918
10918
|
handshakeTimeout: HANDSHAKE_TIMEOUT_MS
|
|
10919
10919
|
});
|
|
10920
10920
|
let open = false;
|
|
10921
10921
|
ws.on("open", () => {
|
|
10922
10922
|
open = true;
|
|
10923
|
-
|
|
10923
|
+
resolve32({
|
|
10924
10924
|
send: (line) => {
|
|
10925
10925
|
if (ws.readyState !== WebSocket.OPEN) return false;
|
|
10926
10926
|
ws.send(line);
|
|
@@ -10946,8 +10946,8 @@ var HELLO_TIMEOUT_MS = 5e3;
|
|
|
10946
10946
|
async function probePeerHello(url) {
|
|
10947
10947
|
let settle = () => {
|
|
10948
10948
|
};
|
|
10949
|
-
const reply2 = new Promise((
|
|
10950
|
-
settle =
|
|
10949
|
+
const reply2 = new Promise((resolve32) => {
|
|
10950
|
+
settle = resolve32;
|
|
10951
10951
|
});
|
|
10952
10952
|
const socket = await connectLinkWebSocket(url, {
|
|
10953
10953
|
onLine: (line) => {
|
|
@@ -12838,10 +12838,10 @@ function gitInvocation(cwd, args) {
|
|
|
12838
12838
|
}
|
|
12839
12839
|
function git2(cwd, args, timeout) {
|
|
12840
12840
|
const { file, argv, options: options2 } = gitInvocation(cwd, args);
|
|
12841
|
-
return new Promise((
|
|
12841
|
+
return new Promise((resolve32, reject) => {
|
|
12842
12842
|
execFile10(file, argv, { ...options2, timeout }, (error, stdout) => {
|
|
12843
12843
|
if (error) reject(error);
|
|
12844
|
-
else
|
|
12844
|
+
else resolve32(stdout.toString());
|
|
12845
12845
|
});
|
|
12846
12846
|
});
|
|
12847
12847
|
}
|
|
@@ -14191,7 +14191,7 @@ ${failed3.length} script(s) failed:`);
|
|
|
14191
14191
|
}
|
|
14192
14192
|
}
|
|
14193
14193
|
function runEntry(entry) {
|
|
14194
|
-
return new Promise((
|
|
14194
|
+
return new Promise((resolve32) => {
|
|
14195
14195
|
const startTime = Date.now();
|
|
14196
14196
|
const child = spawnCommand(
|
|
14197
14197
|
entry.fullCommand,
|
|
@@ -14203,7 +14203,7 @@ function runEntry(entry) {
|
|
|
14203
14203
|
child.on("close", (code) => {
|
|
14204
14204
|
const exitCode = code ?? 1;
|
|
14205
14205
|
flushIfFailed(exitCode, chunks);
|
|
14206
|
-
|
|
14206
|
+
resolve32({
|
|
14207
14207
|
script: entry.name,
|
|
14208
14208
|
code: exitCode,
|
|
14209
14209
|
durationMs: Date.now() - startTime
|
|
@@ -15099,7 +15099,7 @@ function parsePreviewDecision(line, requestId) {
|
|
|
15099
15099
|
|
|
15100
15100
|
// src/commands/sessions/shared/requestPreviewDecision.ts
|
|
15101
15101
|
function requestPreviewDecision(request) {
|
|
15102
|
-
return new Promise((
|
|
15102
|
+
return new Promise((resolve32, reject) => {
|
|
15103
15103
|
connectToDaemon().then((socket) => {
|
|
15104
15104
|
let settled = false;
|
|
15105
15105
|
const finish2 = (error, outcome) => {
|
|
@@ -15107,7 +15107,7 @@ function requestPreviewDecision(request) {
|
|
|
15107
15107
|
settled = true;
|
|
15108
15108
|
socket.destroy();
|
|
15109
15109
|
if (error) reject(error);
|
|
15110
|
-
else
|
|
15110
|
+
else resolve32(outcome);
|
|
15111
15111
|
};
|
|
15112
15112
|
readSocketLines(socket, (line) => {
|
|
15113
15113
|
const incoming = parsePreviewDecision(line, request.requestId);
|
|
@@ -17895,8 +17895,8 @@ function spawnInherit(command, args, options2 = {}) {
|
|
|
17895
17895
|
env: { ...env, ...options2.env },
|
|
17896
17896
|
cwd: options2.cwd
|
|
17897
17897
|
});
|
|
17898
|
-
const done2 = new Promise((
|
|
17899
|
-
child.on("close", (code) =>
|
|
17898
|
+
const done2 = new Promise((resolve32, reject) => {
|
|
17899
|
+
child.on("close", (code) => resolve32(code ?? 0));
|
|
17900
17900
|
child.on("error", reject);
|
|
17901
17901
|
});
|
|
17902
17902
|
return { child, done: done2 };
|
|
@@ -18021,7 +18021,7 @@ import chalk77 from "chalk";
|
|
|
18021
18021
|
// src/commands/sessions/daemon/sendToDaemonAwaitAck.ts
|
|
18022
18022
|
var ACK_TIMEOUT_MS = 1e3;
|
|
18023
18023
|
function sendToDaemonAwaitAck(message3) {
|
|
18024
|
-
return new Promise((
|
|
18024
|
+
return new Promise((resolve32, reject) => {
|
|
18025
18025
|
connectToDaemon().then((socket) => {
|
|
18026
18026
|
let settled = false;
|
|
18027
18027
|
const finish2 = (error) => {
|
|
@@ -18030,7 +18030,7 @@ function sendToDaemonAwaitAck(message3) {
|
|
|
18030
18030
|
clearTimeout(timer);
|
|
18031
18031
|
socket.destroy();
|
|
18032
18032
|
if (error) reject(error);
|
|
18033
|
-
else
|
|
18033
|
+
else resolve32();
|
|
18034
18034
|
};
|
|
18035
18035
|
const timer = setTimeout(
|
|
18036
18036
|
() => finish2(new Error("timed out awaiting daemon ack")),
|
|
@@ -18111,7 +18111,7 @@ async function deliver(sessionId, status2, payload, attempts) {
|
|
|
18111
18111
|
}
|
|
18112
18112
|
}
|
|
18113
18113
|
function sleep(ms) {
|
|
18114
|
-
return new Promise((
|
|
18114
|
+
return new Promise((resolve32) => setTimeout(resolve32, ms));
|
|
18115
18115
|
}
|
|
18116
18116
|
function describeError(error) {
|
|
18117
18117
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -20370,6 +20370,27 @@ function registerBranch(program) {
|
|
|
20370
20370
|
// src/commands/cliHook.ts
|
|
20371
20371
|
import { basename as basename15 } from "path";
|
|
20372
20372
|
|
|
20373
|
+
// src/commands/backlog/isDocsLocked.ts
|
|
20374
|
+
import { and as and20, eq as eq48 } from "drizzle-orm";
|
|
20375
|
+
async function isDocsRefreshItem(itemId2) {
|
|
20376
|
+
const orm = await getDb();
|
|
20377
|
+
const [row3] = await orm.select({ itemId: links.itemId }).from(links).where(and20(eq48(links.itemId, itemId2), eq48(links.type, "docs-refresh"))).limit(1);
|
|
20378
|
+
return row3 !== void 0;
|
|
20379
|
+
}
|
|
20380
|
+
async function isDocsLocked() {
|
|
20381
|
+
if (docsRefreshAfter() === void 0) return false;
|
|
20382
|
+
const itemId2 = resolveSessionItemId();
|
|
20383
|
+
if (itemId2 === null) return false;
|
|
20384
|
+
try {
|
|
20385
|
+
return !await isDocsRefreshItem(itemId2);
|
|
20386
|
+
} catch {
|
|
20387
|
+
return false;
|
|
20388
|
+
} finally {
|
|
20389
|
+
await closeDb().catch(() => {
|
|
20390
|
+
});
|
|
20391
|
+
}
|
|
20392
|
+
}
|
|
20393
|
+
|
|
20373
20394
|
// src/shared/splitCompound.ts
|
|
20374
20395
|
import { parse } from "shell-quote";
|
|
20375
20396
|
|
|
@@ -21245,6 +21266,37 @@ ${questionsJson}`
|
|
|
21245
21266
|
};
|
|
21246
21267
|
}
|
|
21247
21268
|
|
|
21269
|
+
// src/commands/backlog/isDocsPath.ts
|
|
21270
|
+
import { relative as relative6, resolve as resolve18 } from "path";
|
|
21271
|
+
var DOCS_LOCK_REASON = "Docs under 'docs/' are locked during development: they are updated by the Refresh docs backlog item after stories ship, not during development. Leave docs untouched and carry on with the phase.";
|
|
21272
|
+
var RELATIVE_DOCS = /(?:^|[\s'"=(<>|;&:])(?:\.[/\\])?docs[/\\]/;
|
|
21273
|
+
function escapeRegExp(value) {
|
|
21274
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
|
|
21275
|
+
}
|
|
21276
|
+
function isDocsPath(filePath, root2 = getProjectRoot()) {
|
|
21277
|
+
const rel = relative6(root2, resolve18(root2, filePath)).replace(/\\/g, "/");
|
|
21278
|
+
return rel.startsWith("docs/");
|
|
21279
|
+
}
|
|
21280
|
+
function mentionsDocsPath(command, root2 = getProjectRoot()) {
|
|
21281
|
+
if (RELATIVE_DOCS.test(command)) return true;
|
|
21282
|
+
const absolute2 = `${root2.replace(/\\/g, "/")}/docs/`;
|
|
21283
|
+
return new RegExp(escapeRegExp(absolute2)).test(command.replace(/\\/g, "/"));
|
|
21284
|
+
}
|
|
21285
|
+
|
|
21286
|
+
// src/commands/cliHook/findDocsPathDeny.ts
|
|
21287
|
+
function findDocsPathDeny(toolName, rawCommand, root2) {
|
|
21288
|
+
const result = splitCompound(rawCommand);
|
|
21289
|
+
const parts = result.ok ? result.parts : [rawCommand];
|
|
21290
|
+
const writes = parts.some(
|
|
21291
|
+
(part) => mentionsDocsPath(part, root2) && !isApprovedRead(part, toolName)
|
|
21292
|
+
);
|
|
21293
|
+
if (!writes) return void 0;
|
|
21294
|
+
return {
|
|
21295
|
+
permissionDecision: "deny",
|
|
21296
|
+
permissionDecisionReason: DOCS_LOCK_REASON
|
|
21297
|
+
};
|
|
21298
|
+
}
|
|
21299
|
+
|
|
21248
21300
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
21249
21301
|
import { mkdirSync as mkdirSync14 } from "fs";
|
|
21250
21302
|
import { homedir as homedir18 } from "os";
|
|
@@ -21335,10 +21387,17 @@ function tryParseInput(raw) {
|
|
|
21335
21387
|
}
|
|
21336
21388
|
|
|
21337
21389
|
// src/commands/cliHook.ts
|
|
21390
|
+
async function decideBash(toolName, command) {
|
|
21391
|
+
const decision = decideCommand(toolName, command);
|
|
21392
|
+
if (decision?.permissionDecision === "deny") return decision;
|
|
21393
|
+
const docsDeny = findDocsPathDeny(toolName, command);
|
|
21394
|
+
if (docsDeny && await isDocsLocked()) return docsDeny;
|
|
21395
|
+
return decision;
|
|
21396
|
+
}
|
|
21338
21397
|
async function cliHook() {
|
|
21339
21398
|
const input = tryParseInput(await readStdin());
|
|
21340
21399
|
if (!input) return;
|
|
21341
|
-
const decision = input.kind === "command" ?
|
|
21400
|
+
const decision = input.kind === "command" ? await decideBash(input.toolName, input.command) : input.kind === "question" ? findAskQuestionDeny(input.command) : findRestrictedPathDeny(input.paths);
|
|
21342
21401
|
if (!decision) return;
|
|
21343
21402
|
console.log(
|
|
21344
21403
|
JSON.stringify({
|
|
@@ -21491,12 +21550,12 @@ function hasSubcommands(helpText) {
|
|
|
21491
21550
|
// src/commands/permitCliReads/runHelp.ts
|
|
21492
21551
|
import { exec as exec2 } from "child_process";
|
|
21493
21552
|
function runHelp(args) {
|
|
21494
|
-
return new Promise((
|
|
21553
|
+
return new Promise((resolve32) => {
|
|
21495
21554
|
exec2(
|
|
21496
21555
|
`${args.join(" ")} --help`,
|
|
21497
21556
|
{ encoding: "utf8", timeout: 3e4 },
|
|
21498
21557
|
(_err, stdout, stderr) => {
|
|
21499
|
-
|
|
21558
|
+
resolve32(stdout || stderr || "");
|
|
21500
21559
|
}
|
|
21501
21560
|
);
|
|
21502
21561
|
});
|
|
@@ -22203,7 +22262,7 @@ function registerCodexHook(program) {
|
|
|
22203
22262
|
}
|
|
22204
22263
|
|
|
22205
22264
|
// src/commands/commit.ts
|
|
22206
|
-
import { execSync as
|
|
22265
|
+
import { execSync as execSync31 } from "child_process";
|
|
22207
22266
|
|
|
22208
22267
|
// src/commands/commit/buildCommitMessage.ts
|
|
22209
22268
|
function buildCommitMessage(subject, refs) {
|
|
@@ -22436,18 +22495,41 @@ function shouldPull(config) {
|
|
|
22436
22495
|
return false;
|
|
22437
22496
|
}
|
|
22438
22497
|
|
|
22439
|
-
// src/commands/commit/
|
|
22498
|
+
// src/commands/commit/refuseLockedDocs.ts
|
|
22440
22499
|
import { execSync as execSync28 } from "child_process";
|
|
22500
|
+
function findStagedDocs() {
|
|
22501
|
+
return execSync28("git diff --cached --name-only --relative", {
|
|
22502
|
+
cwd: getProjectRoot(),
|
|
22503
|
+
encoding: "utf8"
|
|
22504
|
+
}).split("\n").filter((path108) => path108.startsWith("docs/"));
|
|
22505
|
+
}
|
|
22506
|
+
async function refuseLockedDocs() {
|
|
22507
|
+
const staged = findStagedDocs();
|
|
22508
|
+
if (staged.length === 0 || !await isDocsLocked()) return;
|
|
22509
|
+
console.error(
|
|
22510
|
+
`Error: refusing to commit \u2014 staged changes touch docs: ${staged.join(", ")}`
|
|
22511
|
+
);
|
|
22512
|
+
console.error(DOCS_LOCK_REASON);
|
|
22513
|
+
console.error(
|
|
22514
|
+
"Unstage them with `git restore --staged docs/`, then re-run the commit. Nothing was committed or pushed."
|
|
22515
|
+
);
|
|
22516
|
+
process.exit(1);
|
|
22517
|
+
}
|
|
22518
|
+
|
|
22519
|
+
// src/commands/commit/commitStaged.ts
|
|
22520
|
+
import { execSync as execSync29 } from "child_process";
|
|
22441
22521
|
function commitStaged(message3) {
|
|
22442
|
-
|
|
22443
|
-
return
|
|
22522
|
+
execSync29(`git commit -m ${shellQuote(message3)}`, { stdio: "inherit" });
|
|
22523
|
+
return execSync29("git rev-parse --short=7 HEAD", {
|
|
22444
22524
|
encoding: "utf8"
|
|
22445
22525
|
}).trim();
|
|
22446
22526
|
}
|
|
22447
|
-
|
|
22527
|
+
|
|
22528
|
+
// src/commands/commit/stageFiles.ts
|
|
22529
|
+
import { execSync as execSync30 } from "child_process";
|
|
22530
|
+
function stageFiles(files) {
|
|
22448
22531
|
const escaped = files.map(shellQuote).join(" ");
|
|
22449
|
-
|
|
22450
|
-
return commitStaged(message3);
|
|
22532
|
+
execSync30(`git add ${escaped}`, { stdio: "inherit" });
|
|
22451
22533
|
}
|
|
22452
22534
|
|
|
22453
22535
|
// src/commands/commit/execCommit.ts
|
|
@@ -22459,7 +22541,9 @@ async function execCommit(files, message3, config) {
|
|
|
22459
22541
|
pullKeepingIndex();
|
|
22460
22542
|
}
|
|
22461
22543
|
abortOnConflicts(files, pulled);
|
|
22462
|
-
|
|
22544
|
+
if (files.length > 0) stageFiles(files);
|
|
22545
|
+
await refuseLockedDocs();
|
|
22546
|
+
const sha = commitStaged(message3);
|
|
22463
22547
|
console.log(`Committed: ${sha}`);
|
|
22464
22548
|
if (config.commit?.push) {
|
|
22465
22549
|
pushCommit(config.worktree?.trunk === true);
|
|
@@ -22593,7 +22677,7 @@ function validateMessage(message3, config) {
|
|
|
22593
22677
|
// src/commands/commit.ts
|
|
22594
22678
|
async function commit(args, options2 = {}) {
|
|
22595
22679
|
if (args[0] === "status") {
|
|
22596
|
-
|
|
22680
|
+
execSync31("git status && echo '---DIFF---' && git diff", {
|
|
22597
22681
|
stdio: "inherit"
|
|
22598
22682
|
});
|
|
22599
22683
|
return;
|
|
@@ -23059,10 +23143,10 @@ function formatResultLine(entry, failing) {
|
|
|
23059
23143
|
}
|
|
23060
23144
|
|
|
23061
23145
|
// src/commands/complexity/maintainability/getMaintainabilityGitState.ts
|
|
23062
|
-
import { execSync as
|
|
23146
|
+
import { execSync as execSync32 } from "child_process";
|
|
23063
23147
|
import path33 from "path";
|
|
23064
23148
|
function git4(command) {
|
|
23065
|
-
return
|
|
23149
|
+
return execSync32(command, { encoding: "utf8" });
|
|
23066
23150
|
}
|
|
23067
23151
|
function toAbsolute(root2, repoRelative) {
|
|
23068
23152
|
return path33.resolve(root2, repoRelative);
|
|
@@ -24542,7 +24626,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
24542
24626
|
}
|
|
24543
24627
|
|
|
24544
24628
|
// src/commands/devlog/shared.ts
|
|
24545
|
-
import { execSync as
|
|
24629
|
+
import { execSync as execSync33 } from "child_process";
|
|
24546
24630
|
import chalk154 from "chalk";
|
|
24547
24631
|
|
|
24548
24632
|
// src/shared/getRepoName.ts
|
|
@@ -24634,7 +24718,7 @@ function loadAllDevlogLatestDates() {
|
|
|
24634
24718
|
// src/commands/devlog/shared.ts
|
|
24635
24719
|
function getCommitFiles(hash) {
|
|
24636
24720
|
try {
|
|
24637
|
-
const output =
|
|
24721
|
+
const output = execSync33(`git show --name-only --format="" ${hash}`, {
|
|
24638
24722
|
encoding: "utf8"
|
|
24639
24723
|
});
|
|
24640
24724
|
return output.trim().split("\n").filter(Boolean);
|
|
@@ -24730,11 +24814,11 @@ function list2(options2) {
|
|
|
24730
24814
|
}
|
|
24731
24815
|
|
|
24732
24816
|
// src/commands/devlog/getLastVersionInfo.ts
|
|
24733
|
-
import { execFileSync as execFileSync8, execSync as
|
|
24817
|
+
import { execFileSync as execFileSync8, execSync as execSync34 } from "child_process";
|
|
24734
24818
|
import semver from "semver";
|
|
24735
24819
|
function getVersionAtCommit(hash) {
|
|
24736
24820
|
try {
|
|
24737
|
-
const content =
|
|
24821
|
+
const content = execSync34(`git show ${hash}:package.json`, {
|
|
24738
24822
|
encoding: "utf8"
|
|
24739
24823
|
});
|
|
24740
24824
|
const pkg = JSON.parse(content);
|
|
@@ -24907,7 +24991,7 @@ function next2(options2) {
|
|
|
24907
24991
|
}
|
|
24908
24992
|
|
|
24909
24993
|
// src/commands/devlog/repos.ts
|
|
24910
|
-
import { execSync as
|
|
24994
|
+
import { execSync as execSync35 } from "child_process";
|
|
24911
24995
|
|
|
24912
24996
|
// src/commands/devlog/repos/printReposTable.ts
|
|
24913
24997
|
import chalk158 from "chalk";
|
|
@@ -24942,7 +25026,7 @@ function getStatus(lastPush, lastDevlog) {
|
|
|
24942
25026
|
return lastDevlog < lastPush ? "outdated" : "ok";
|
|
24943
25027
|
}
|
|
24944
25028
|
function fetchRepos(days, all) {
|
|
24945
|
-
const json =
|
|
25029
|
+
const json = execSync35(
|
|
24946
25030
|
"gh repo list staff0rd --json name,pushedAt,isArchived --limit 200",
|
|
24947
25031
|
{ encoding: "utf8" }
|
|
24948
25032
|
);
|
|
@@ -25287,7 +25371,7 @@ async function deps(csprojPath, options2) {
|
|
|
25287
25371
|
}
|
|
25288
25372
|
|
|
25289
25373
|
// src/commands/dotnet/getChangedCsFiles.ts
|
|
25290
|
-
import { execSync as
|
|
25374
|
+
import { execSync as execSync36 } from "child_process";
|
|
25291
25375
|
var SCOPE_ALL = "all";
|
|
25292
25376
|
var SCOPE_BASE = "base:";
|
|
25293
25377
|
var SCOPE_COMMIT = "commit:";
|
|
@@ -25311,7 +25395,7 @@ function getChangedCsFiles(scope) {
|
|
|
25311
25395
|
} else {
|
|
25312
25396
|
cmd = "git diff --name-only HEAD";
|
|
25313
25397
|
}
|
|
25314
|
-
const output =
|
|
25398
|
+
const output = execSync36(cmd, { encoding: "utf8" }).trim();
|
|
25315
25399
|
if (output === "") return [];
|
|
25316
25400
|
return output.split("\n").filter((f) => f.toLowerCase().endsWith(".cs"));
|
|
25317
25401
|
}
|
|
@@ -25509,14 +25593,14 @@ function parseInspectReport(json) {
|
|
|
25509
25593
|
}
|
|
25510
25594
|
|
|
25511
25595
|
// src/commands/dotnet/runInspectCode.ts
|
|
25512
|
-
import { execSync as
|
|
25596
|
+
import { execSync as execSync37 } from "child_process";
|
|
25513
25597
|
import { existsSync as existsSync57, readFileSync as readFileSync39, unlinkSync as unlinkSync10 } from "fs";
|
|
25514
25598
|
import { tmpdir as tmpdir4 } from "os";
|
|
25515
25599
|
import path39 from "path";
|
|
25516
25600
|
import chalk168 from "chalk";
|
|
25517
25601
|
function assertJbInstalled() {
|
|
25518
25602
|
try {
|
|
25519
|
-
|
|
25603
|
+
execSync37("jb inspectcode --version", { stdio: "pipe" });
|
|
25520
25604
|
} catch {
|
|
25521
25605
|
console.error(chalk168.red("jb is not installed. Install with:"));
|
|
25522
25606
|
console.error(
|
|
@@ -25530,7 +25614,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
25530
25614
|
const includeFlag = include ? ` --include="${include}"` : "";
|
|
25531
25615
|
const sweaFlag = swea ? " --swea" : "";
|
|
25532
25616
|
try {
|
|
25533
|
-
|
|
25617
|
+
execSync37(
|
|
25534
25618
|
`jb inspectcode "${slnPath}" -o="${reportPath}"${includeFlag}${sweaFlag} --verbosity=OFF`,
|
|
25535
25619
|
{ stdio: "pipe" }
|
|
25536
25620
|
);
|
|
@@ -25551,7 +25635,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
25551
25635
|
}
|
|
25552
25636
|
|
|
25553
25637
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
25554
|
-
import { execSync as
|
|
25638
|
+
import { execSync as execSync38 } from "child_process";
|
|
25555
25639
|
import chalk169 from "chalk";
|
|
25556
25640
|
function resolveMsbuildPath() {
|
|
25557
25641
|
const { run: run4 } = loadConfig();
|
|
@@ -25562,7 +25646,7 @@ function resolveMsbuildPath() {
|
|
|
25562
25646
|
function assertMsbuildInstalled() {
|
|
25563
25647
|
const msbuild = resolveMsbuildPath();
|
|
25564
25648
|
try {
|
|
25565
|
-
|
|
25649
|
+
execSync38(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
25566
25650
|
} catch {
|
|
25567
25651
|
console.error(chalk169.red(`msbuild not found at: ${msbuild}`));
|
|
25568
25652
|
console.error(
|
|
@@ -25588,7 +25672,7 @@ function runRoslynInspect(slnPath) {
|
|
|
25588
25672
|
const msbuild = resolveMsbuildPath();
|
|
25589
25673
|
let output;
|
|
25590
25674
|
try {
|
|
25591
|
-
output =
|
|
25675
|
+
output = execSync38(
|
|
25592
25676
|
`"${msbuild}" "${slnPath}" -t:Build -v:minimal -maxcpucount -p:EnforceCodeStyleInBuild=true -p:RunAnalyzersDuringBuild=true 2>&1`,
|
|
25593
25677
|
{ encoding: "utf8", stdio: "pipe", maxBuffer: 50 * 1024 * 1024 }
|
|
25594
25678
|
);
|
|
@@ -26309,6 +26393,15 @@ function decideCommentGuard(input, existingContent) {
|
|
|
26309
26393
|
return introduced.length > 0 ? denyReason(gate.marker) : void 0;
|
|
26310
26394
|
}
|
|
26311
26395
|
|
|
26396
|
+
// src/commands/editHook/decideDocsGuard.ts
|
|
26397
|
+
var WRITE_TOOLS = /* @__PURE__ */ new Set(["Edit", "Write", "MultiEdit"]);
|
|
26398
|
+
async function decideDocsGuard(input) {
|
|
26399
|
+
const filePath = input.tool_input.file_path;
|
|
26400
|
+
if (!WRITE_TOOLS.has(input.tool_name) || !filePath) return void 0;
|
|
26401
|
+
if (!isDocsPath(filePath)) return void 0;
|
|
26402
|
+
return await isDocsLocked() ? DOCS_LOCK_REASON : void 0;
|
|
26403
|
+
}
|
|
26404
|
+
|
|
26312
26405
|
// src/commands/dbMigration/consumeMigrationApproval.ts
|
|
26313
26406
|
import { existsSync as existsSync58, unlinkSync as unlinkSync11 } from "fs";
|
|
26314
26407
|
function consumeMigrationApproval(migrationId) {
|
|
@@ -26398,7 +26491,7 @@ async function editHook() {
|
|
|
26398
26491
|
const input = tryParseInput2(await readStdin());
|
|
26399
26492
|
if (!input) return;
|
|
26400
26493
|
const existing = input.tool_name === "Write" ? readExisting(input.tool_input.file_path) : void 0;
|
|
26401
|
-
const reason4 = decideOverrideGuard(input, existing) ?? decideCommentGuard(input, existing) ?? decideMigrationGuard(input, existing);
|
|
26494
|
+
const reason4 = decideOverrideGuard(input, existing) ?? decideCommentGuard(input, existing) ?? decideMigrationGuard(input, existing) ?? await decideDocsGuard(input);
|
|
26402
26495
|
if (!reason4) return;
|
|
26403
26496
|
console.log(
|
|
26404
26497
|
JSON.stringify({
|
|
@@ -27548,7 +27641,7 @@ function resolveIssueMilestone(target, wanted) {
|
|
|
27548
27641
|
}
|
|
27549
27642
|
|
|
27550
27643
|
// src/commands/prs/shared.ts
|
|
27551
|
-
import { execSync as
|
|
27644
|
+
import { execSync as execSync39 } from "child_process";
|
|
27552
27645
|
|
|
27553
27646
|
// src/commands/prs/pinCurrentPr.ts
|
|
27554
27647
|
var pinnedPr;
|
|
@@ -27571,19 +27664,19 @@ function getRepoInfo() {
|
|
|
27571
27664
|
const preferred = getPreferredRemoteRepo();
|
|
27572
27665
|
if (preferred) return preferred;
|
|
27573
27666
|
const repoInfo = JSON.parse(
|
|
27574
|
-
|
|
27667
|
+
execSync39("gh repo view --json owner,name", { encoding: "utf8" })
|
|
27575
27668
|
);
|
|
27576
27669
|
return { org: repoInfo.owner.login, repo: repoInfo.name };
|
|
27577
27670
|
}
|
|
27578
27671
|
function getCurrentBranch2() {
|
|
27579
|
-
return
|
|
27672
|
+
return execSync39("git rev-parse --abbrev-ref HEAD", {
|
|
27580
27673
|
encoding: "utf8"
|
|
27581
27674
|
}).trim();
|
|
27582
27675
|
}
|
|
27583
27676
|
function viewCurrentPr(fields) {
|
|
27584
27677
|
const { org, repo } = getRepoInfo();
|
|
27585
27678
|
return JSON.parse(
|
|
27586
|
-
|
|
27679
|
+
execSync39(
|
|
27587
27680
|
`gh pr view ${currentPrSelector(getCurrentBranch2)} --json ${fields} -R ${org}/${repo}`,
|
|
27588
27681
|
{
|
|
27589
27682
|
encoding: "utf8"
|
|
@@ -28720,7 +28813,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
28720
28813
|
}
|
|
28721
28814
|
|
|
28722
28815
|
// src/commands/jira/jiraAuth.ts
|
|
28723
|
-
import { execSync as
|
|
28816
|
+
import { execSync as execSync40 } from "child_process";
|
|
28724
28817
|
|
|
28725
28818
|
// src/shared/promptInput.ts
|
|
28726
28819
|
import Enquirer from "enquirer";
|
|
@@ -28755,7 +28848,7 @@ async function jiraAuth() {
|
|
|
28755
28848
|
console.error("All fields are required.");
|
|
28756
28849
|
process.exit(1);
|
|
28757
28850
|
}
|
|
28758
|
-
|
|
28851
|
+
execSync40(`acli jira auth login --site ${site} --email "${email}" --token`, {
|
|
28759
28852
|
encoding: "utf8",
|
|
28760
28853
|
input: token,
|
|
28761
28854
|
stdio: ["pipe", "inherit", "inherit"]
|
|
@@ -29156,7 +29249,7 @@ import { copyFileSync, existsSync as existsSync62, mkdirSync as mkdirSync20 } fr
|
|
|
29156
29249
|
import { dirname as dirname33, join as join74 } from "path";
|
|
29157
29250
|
|
|
29158
29251
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
29159
|
-
import { resolve as
|
|
29252
|
+
import { resolve as resolve19 } from "path";
|
|
29160
29253
|
|
|
29161
29254
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
29162
29255
|
import { existsSync as existsSync61 } from "fs";
|
|
@@ -29297,7 +29390,7 @@ function installPaths(worktreePath, paths, onSeeded, onInstalling) {
|
|
|
29297
29390
|
onSeeded();
|
|
29298
29391
|
return;
|
|
29299
29392
|
}
|
|
29300
|
-
const dir =
|
|
29393
|
+
const dir = resolve19(worktreePath, rel);
|
|
29301
29394
|
const command = detectInstallCommand(dir);
|
|
29302
29395
|
if (!command) {
|
|
29303
29396
|
daemonLog(
|
|
@@ -29356,7 +29449,7 @@ function placedByDaemon() {
|
|
|
29356
29449
|
function seed(worktreePath, clone) {
|
|
29357
29450
|
console.log(`Preparing ${worktreePath}\u2026`);
|
|
29358
29451
|
return new Promise(
|
|
29359
|
-
(
|
|
29452
|
+
(resolve32) => seedWorktree(worktreePath, clone, resolve32)
|
|
29360
29453
|
);
|
|
29361
29454
|
}
|
|
29362
29455
|
async function moveToPrCheckoutTree() {
|
|
@@ -29444,7 +29537,7 @@ function prHeadBranch({
|
|
|
29444
29537
|
// src/commands/sessions/daemon/sendToDaemon.ts
|
|
29445
29538
|
var WRITE_TIMEOUT_MS = 500;
|
|
29446
29539
|
function sendToDaemon(message3) {
|
|
29447
|
-
return new Promise((
|
|
29540
|
+
return new Promise((resolve32, reject) => {
|
|
29448
29541
|
connectToDaemon().then((socket) => {
|
|
29449
29542
|
const timer = setTimeout(() => {
|
|
29450
29543
|
socket.destroy();
|
|
@@ -29458,7 +29551,7 @@ function sendToDaemon(message3) {
|
|
|
29458
29551
|
`, () => {
|
|
29459
29552
|
clearTimeout(timer);
|
|
29460
29553
|
socket.end();
|
|
29461
|
-
|
|
29554
|
+
resolve32();
|
|
29462
29555
|
});
|
|
29463
29556
|
}, reject);
|
|
29464
29557
|
});
|
|
@@ -29814,12 +29907,12 @@ function registerLitellm(program) {
|
|
|
29814
29907
|
|
|
29815
29908
|
// src/commands/mermaidExport.ts
|
|
29816
29909
|
import { mkdirSync as mkdirSync21, readdirSync as readdirSync12 } from "fs";
|
|
29817
|
-
import { resolve as
|
|
29910
|
+
import { resolve as resolve21 } from "path";
|
|
29818
29911
|
import chalk185 from "chalk";
|
|
29819
29912
|
|
|
29820
29913
|
// src/commands/mermaid/exportFile.ts
|
|
29821
29914
|
import { readFileSync as readFileSync41, writeFileSync as writeFileSync34 } from "fs";
|
|
29822
|
-
import { basename as basename22, extname as extname4, resolve as
|
|
29915
|
+
import { basename as basename22, extname as extname4, resolve as resolve20 } from "path";
|
|
29823
29916
|
import chalk184 from "chalk";
|
|
29824
29917
|
|
|
29825
29918
|
// src/commands/mermaid/renderBlock.ts
|
|
@@ -29867,7 +29960,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
29867
29960
|
for (const [i, source] of blocks.entries()) {
|
|
29868
29961
|
const idx = i + 1;
|
|
29869
29962
|
if (onlyIndex !== void 0 && idx !== onlyIndex) continue;
|
|
29870
|
-
const outPath =
|
|
29963
|
+
const outPath = resolve20(outDir, `${stem}-${idx}.svg`);
|
|
29871
29964
|
const svg = await renderBlock(krokiUrl, source);
|
|
29872
29965
|
writeFileSync34(outPath, svg, "utf8");
|
|
29873
29966
|
console.log(chalk184.green(` \u2192 ${outPath}`));
|
|
@@ -29881,7 +29974,7 @@ function extractMermaidBlocks(markdown) {
|
|
|
29881
29974
|
// src/commands/mermaidExport.ts
|
|
29882
29975
|
async function mermaidExport(file, options2 = {}) {
|
|
29883
29976
|
const { mermaid } = loadConfig();
|
|
29884
|
-
const outDir =
|
|
29977
|
+
const outDir = resolve21(process.cwd(), options2.out ?? ".");
|
|
29885
29978
|
mkdirSync21(outDir, { recursive: true });
|
|
29886
29979
|
if (options2.index !== void 0) {
|
|
29887
29980
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
@@ -30009,18 +30102,18 @@ function emitExtract(out, header, texts) {
|
|
|
30009
30102
|
}
|
|
30010
30103
|
|
|
30011
30104
|
// src/commands/miro/resolveExtractPath.ts
|
|
30012
|
-
import { isAbsolute as isAbsolute4, relative as
|
|
30105
|
+
import { isAbsolute as isAbsolute4, relative as relative7, resolve as resolve22 } from "path";
|
|
30013
30106
|
function extractRoot(cwd) {
|
|
30014
30107
|
return findConfigUp(cwd)?.rootDir ?? cwd;
|
|
30015
30108
|
}
|
|
30016
30109
|
function resolveExtractPath(value, cwd) {
|
|
30017
30110
|
if (value === void 0) return void 0;
|
|
30018
|
-
return isAbsolute4(value) ? value :
|
|
30111
|
+
return isAbsolute4(value) ? value : resolve22(extractRoot(cwd), value);
|
|
30019
30112
|
}
|
|
30020
30113
|
function storedExtractPath(value, cwd) {
|
|
30021
30114
|
if (value === void 0) return void 0;
|
|
30022
|
-
const absolute2 =
|
|
30023
|
-
const within =
|
|
30115
|
+
const absolute2 = resolve22(cwd, value);
|
|
30116
|
+
const within = relative7(extractRoot(cwd), absolute2);
|
|
30024
30117
|
return within.startsWith("..") ? absolute2 : within;
|
|
30025
30118
|
}
|
|
30026
30119
|
|
|
@@ -30607,7 +30700,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
30607
30700
|
}
|
|
30608
30701
|
|
|
30609
30702
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
30610
|
-
import { isAbsolute as isAbsolute5, join as join78, resolve as
|
|
30703
|
+
import { isAbsolute as isAbsolute5, join as join78, resolve as resolve23 } from "path";
|
|
30611
30704
|
|
|
30612
30705
|
// src/commands/netcap/defaultCapturePath.ts
|
|
30613
30706
|
import { homedir as homedir24 } from "os";
|
|
@@ -30619,7 +30712,7 @@ function defaultCapturePath() {
|
|
|
30619
30712
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
30620
30713
|
function resolveNetcapOutPath(out) {
|
|
30621
30714
|
if (!out) return defaultCapturePath();
|
|
30622
|
-
const dir = isAbsolute5(out) ? out :
|
|
30715
|
+
const dir = isAbsolute5(out) ? out : resolve23(process.cwd(), out);
|
|
30623
30716
|
return join78(dir, "capture.jsonl");
|
|
30624
30717
|
}
|
|
30625
30718
|
|
|
@@ -30710,25 +30803,25 @@ function isVisibleText(t) {
|
|
|
30710
30803
|
return /[a-zA-Z]{3,}/.test(t);
|
|
30711
30804
|
}
|
|
30712
30805
|
var isHashtag = (t) => /^#[A-Za-z0-9_]+$/.test(t);
|
|
30713
|
-
function collectRscText(v,
|
|
30806
|
+
function collectRscText(v, resolve32, sink3, seen) {
|
|
30714
30807
|
if (v == null) return;
|
|
30715
30808
|
if (typeof v === "string") {
|
|
30716
30809
|
if (isRscRef(v)) {
|
|
30717
30810
|
if (!seen.has(v)) {
|
|
30718
30811
|
seen.add(v);
|
|
30719
|
-
collectRscText(
|
|
30812
|
+
collectRscText(resolve32(v), resolve32, sink3, seen);
|
|
30720
30813
|
}
|
|
30721
30814
|
} else if (isHashtag(v)) sink3.hashtags.push(v);
|
|
30722
30815
|
else if (isVisibleText(v)) sink3.text.push(v);
|
|
30723
30816
|
return;
|
|
30724
30817
|
}
|
|
30725
30818
|
if (Array.isArray(v)) {
|
|
30726
|
-
for (const x of v) collectRscText(x,
|
|
30819
|
+
for (const x of v) collectRscText(x, resolve32, sink3, seen);
|
|
30727
30820
|
return;
|
|
30728
30821
|
}
|
|
30729
30822
|
if (typeof v === "object") {
|
|
30730
30823
|
for (const val of Object.values(v)) {
|
|
30731
|
-
collectRscText(val,
|
|
30824
|
+
collectRscText(val, resolve32, sink3, seen);
|
|
30732
30825
|
}
|
|
30733
30826
|
}
|
|
30734
30827
|
}
|
|
@@ -30760,7 +30853,7 @@ function visitObjects(root2, fn) {
|
|
|
30760
30853
|
}
|
|
30761
30854
|
}
|
|
30762
30855
|
}
|
|
30763
|
-
function buildMentionMap(rows,
|
|
30856
|
+
function buildMentionMap(rows, resolve32) {
|
|
30764
30857
|
const map = /* @__PURE__ */ new Map();
|
|
30765
30858
|
visitObjects(rows, (o) => {
|
|
30766
30859
|
const url = profileActionUrl(o);
|
|
@@ -30768,7 +30861,7 @@ function buildMentionMap(rows, resolve31) {
|
|
|
30768
30861
|
const slug2 = slugFromProfileUrl(url);
|
|
30769
30862
|
if (!slug2 || map.has(slug2)) return;
|
|
30770
30863
|
const sink3 = { text: [], hashtags: [] };
|
|
30771
|
-
collectRscText(o.children,
|
|
30864
|
+
collectRscText(o.children, resolve32, sink3, /* @__PURE__ */ new Set());
|
|
30772
30865
|
const name = sink3.text.join(" ").replace(/\s+/g, " ").trim();
|
|
30773
30866
|
map.set(slug2, name ? { slug: slug2, name, url } : { slug: slug2, url });
|
|
30774
30867
|
});
|
|
@@ -30854,10 +30947,10 @@ function buildPost(raw, mentionMap, author) {
|
|
|
30854
30947
|
|
|
30855
30948
|
// src/commands/netcap/walkPostRow.ts
|
|
30856
30949
|
var isCommentary = (o) => asObject(o.viewTrackingSpecs)?.viewName === "feed-commentary";
|
|
30857
|
-
function walkPostRow(v,
|
|
30950
|
+
function walkPostRow(v, resolve32, raw) {
|
|
30858
30951
|
if (v == null || typeof v !== "object") return;
|
|
30859
30952
|
if (Array.isArray(v)) {
|
|
30860
|
-
for (const x of v) walkPostRow(x,
|
|
30953
|
+
for (const x of v) walkPostRow(x, resolve32, raw);
|
|
30861
30954
|
return;
|
|
30862
30955
|
}
|
|
30863
30956
|
const o = v;
|
|
@@ -30871,9 +30964,9 @@ function walkPostRow(v, resolve31, raw) {
|
|
|
30871
30964
|
}
|
|
30872
30965
|
if (isCommentary(o)) {
|
|
30873
30966
|
const sink3 = { text: raw.text, hashtags: raw.hashtags };
|
|
30874
|
-
collectRscText(o.children,
|
|
30967
|
+
collectRscText(o.children, resolve32, sink3, /* @__PURE__ */ new Set());
|
|
30875
30968
|
}
|
|
30876
|
-
for (const val of Object.values(o)) walkPostRow(val,
|
|
30969
|
+
for (const val of Object.values(o)) walkPostRow(val, resolve32, raw);
|
|
30877
30970
|
}
|
|
30878
30971
|
|
|
30879
30972
|
// src/commands/netcap/extractLinkedInPosts.ts
|
|
@@ -30887,8 +30980,8 @@ function findCommentaryRows(rows) {
|
|
|
30887
30980
|
}
|
|
30888
30981
|
function extractLinkedInPosts(flight, author = findAuthorSlug(flight)) {
|
|
30889
30982
|
const rows = parseRscRows(flight);
|
|
30890
|
-
const
|
|
30891
|
-
const mentionMap = buildMentionMap(rows,
|
|
30983
|
+
const resolve32 = makeRscResolver(rows);
|
|
30984
|
+
const mentionMap = buildMentionMap(rows, resolve32);
|
|
30892
30985
|
const posts = [];
|
|
30893
30986
|
for (const id of findCommentaryRows(rows)) {
|
|
30894
30987
|
const raw = {
|
|
@@ -30898,7 +30991,7 @@ function extractLinkedInPosts(flight, author = findAuthorSlug(flight)) {
|
|
|
30898
30991
|
links: [],
|
|
30899
30992
|
related: []
|
|
30900
30993
|
};
|
|
30901
|
-
walkPostRow(rows[id],
|
|
30994
|
+
walkPostRow(rows[id], resolve32, raw);
|
|
30902
30995
|
const post2 = buildPost(raw, mentionMap, author);
|
|
30903
30996
|
if (post2) posts.push(post2);
|
|
30904
30997
|
}
|
|
@@ -31180,9 +31273,9 @@ async function list4() {
|
|
|
31180
31273
|
import chalk193 from "chalk";
|
|
31181
31274
|
|
|
31182
31275
|
// src/commands/backlog/removeFeed.ts
|
|
31183
|
-
import { eq as
|
|
31276
|
+
import { eq as eq49 } from "drizzle-orm";
|
|
31184
31277
|
async function removeFeed(db, url) {
|
|
31185
|
-
const deleted = await db.delete(feeds).where(
|
|
31278
|
+
const deleted = await db.delete(feeds).where(eq49(feeds.url, url)).returning({ id: feeds.id });
|
|
31186
31279
|
return deleted.length > 0;
|
|
31187
31280
|
}
|
|
31188
31281
|
|
|
@@ -31303,7 +31396,7 @@ function registerPrompts(program) {
|
|
|
31303
31396
|
}
|
|
31304
31397
|
|
|
31305
31398
|
// src/commands/prs/prs.ts
|
|
31306
|
-
import { execSync as
|
|
31399
|
+
import { execSync as execSync41 } from "child_process";
|
|
31307
31400
|
|
|
31308
31401
|
// src/commands/prs/prs/displayPaginated.ts
|
|
31309
31402
|
import enquirer9 from "enquirer";
|
|
@@ -31410,7 +31503,7 @@ async function prs(options2) {
|
|
|
31410
31503
|
const state = options2.open ? "open" : options2.closed ? "closed" : "all";
|
|
31411
31504
|
try {
|
|
31412
31505
|
const { org, repo } = getRepoInfo();
|
|
31413
|
-
const result =
|
|
31506
|
+
const result = execSync41(
|
|
31414
31507
|
`gh pr list --state ${state} --json number,title,url,author,createdAt,mergedAt,closedAt,state,changedFiles --limit 100 -R ${org}/${repo}`,
|
|
31415
31508
|
{ encoding: "utf8" }
|
|
31416
31509
|
);
|
|
@@ -31804,9 +31897,9 @@ function fetchThreadIds(org, repo, prNumber) {
|
|
|
31804
31897
|
}
|
|
31805
31898
|
|
|
31806
31899
|
// src/commands/prs/listComments/fetchReviewComments.ts
|
|
31807
|
-
import { execSync as
|
|
31900
|
+
import { execSync as execSync42 } from "child_process";
|
|
31808
31901
|
function fetchJson(endpoint) {
|
|
31809
|
-
const result =
|
|
31902
|
+
const result = execSync42(`gh api --paginate ${endpoint}`, {
|
|
31810
31903
|
encoding: "utf8"
|
|
31811
31904
|
});
|
|
31812
31905
|
if (!result.trim()) return [];
|
|
@@ -32051,7 +32144,7 @@ function printComments2(result) {
|
|
|
32051
32144
|
}
|
|
32052
32145
|
|
|
32053
32146
|
// src/commands/prs/fixed.ts
|
|
32054
|
-
import { execSync as
|
|
32147
|
+
import { execSync as execSync43 } from "child_process";
|
|
32055
32148
|
|
|
32056
32149
|
// src/commands/prs/threadTarget.ts
|
|
32057
32150
|
import { execFileSync as execFileSync22 } from "child_process";
|
|
@@ -32176,7 +32269,7 @@ function resolveCommentWithReply(commentId, message3, status2) {
|
|
|
32176
32269
|
// src/commands/prs/fixed.ts
|
|
32177
32270
|
function verifySha(sha) {
|
|
32178
32271
|
try {
|
|
32179
|
-
return
|
|
32272
|
+
return execSync43(`git rev-parse --verify ${sha}`, {
|
|
32180
32273
|
encoding: "utf8"
|
|
32181
32274
|
}).trim();
|
|
32182
32275
|
} catch {
|
|
@@ -32240,7 +32333,7 @@ async function reply(commentId, body) {
|
|
|
32240
32333
|
}
|
|
32241
32334
|
|
|
32242
32335
|
// src/commands/prs/wontfix.ts
|
|
32243
|
-
import { execSync as
|
|
32336
|
+
import { execSync as execSync44 } from "child_process";
|
|
32244
32337
|
function validateReason(reason4) {
|
|
32245
32338
|
const lowerReason = reason4.toLowerCase();
|
|
32246
32339
|
if (lowerReason.includes("claude") || lowerReason.includes("opus")) {
|
|
@@ -32257,7 +32350,7 @@ function validateShaReferences(reason4) {
|
|
|
32257
32350
|
const invalidShas = [];
|
|
32258
32351
|
for (const sha of shas) {
|
|
32259
32352
|
try {
|
|
32260
|
-
|
|
32353
|
+
execSync44(`git cat-file -t ${sha}`, { stdio: "pipe" });
|
|
32261
32354
|
} catch {
|
|
32262
32355
|
invalidShas.push(sha);
|
|
32263
32356
|
}
|
|
@@ -32458,7 +32551,7 @@ ${resolves}` : baseWhy);
|
|
|
32458
32551
|
|
|
32459
32552
|
// src/commands/prs/parseScreenshotSpec.ts
|
|
32460
32553
|
import { statSync as statSync9 } from "fs";
|
|
32461
|
-
import { basename as basename23, extname as extname5, resolve as
|
|
32554
|
+
import { basename as basename23, extname as extname5, resolve as resolve24 } from "path";
|
|
32462
32555
|
function splitOnce(value, separator) {
|
|
32463
32556
|
const index2 = value.indexOf(separator);
|
|
32464
32557
|
if (index2 === -1) return null;
|
|
@@ -32474,7 +32567,7 @@ function isFile2(path108) {
|
|
|
32474
32567
|
function parseScreenshotSpec(spec) {
|
|
32475
32568
|
const [label, rawPath] = splitOnce(spec, "=") ?? ["", spec];
|
|
32476
32569
|
const [group, caption] = splitOnce(label, "/") ?? ["", label];
|
|
32477
|
-
const path108 =
|
|
32570
|
+
const path108 = resolve24(rawPath.trim());
|
|
32478
32571
|
const ext = extname5(path108).replace(/^\./, "").toLowerCase();
|
|
32479
32572
|
if (!isFile2(path108))
|
|
32480
32573
|
throw new Error(`--screenshot '${spec}': file not found: ${path108}`);
|
|
@@ -32779,16 +32872,16 @@ function buildCreateArgs(title, body, options2, attachments = []) {
|
|
|
32779
32872
|
}
|
|
32780
32873
|
|
|
32781
32874
|
// src/commands/prs/readSessionPrRef.ts
|
|
32782
|
-
import { execSync as
|
|
32875
|
+
import { execSync as execSync45 } from "child_process";
|
|
32783
32876
|
function readSessionPrRef() {
|
|
32784
32877
|
try {
|
|
32785
|
-
const branch2 =
|
|
32878
|
+
const branch2 = execSync45("git rev-parse --abbrev-ref HEAD", {
|
|
32786
32879
|
encoding: "utf8",
|
|
32787
32880
|
stdio: ["pipe", "pipe", "pipe"]
|
|
32788
32881
|
}).trim();
|
|
32789
32882
|
if (!branch2 || branch2 === "HEAD") return null;
|
|
32790
32883
|
const pr = JSON.parse(
|
|
32791
|
-
|
|
32884
|
+
execSync45(`gh pr view ${branch2} --json number,title,url,state`, {
|
|
32792
32885
|
encoding: "utf8",
|
|
32793
32886
|
stdio: ["pipe", "pipe", "pipe"]
|
|
32794
32887
|
})
|
|
@@ -33233,10 +33326,10 @@ function describeFetchError(error) {
|
|
|
33233
33326
|
}
|
|
33234
33327
|
|
|
33235
33328
|
// src/commands/prs/status/fetchRepoPullRequests.ts
|
|
33236
|
-
import { execSync as
|
|
33329
|
+
import { execSync as execSync46 } from "child_process";
|
|
33237
33330
|
var FIELDS2 = "number,title,url,author,isDraft,createdAt,updatedAt,reviewDecision,latestReviews,statusCheckRollup,mergeable";
|
|
33238
33331
|
function fetchRepoPullRequests(org, repo) {
|
|
33239
|
-
const output =
|
|
33332
|
+
const output = execSync46(
|
|
33240
33333
|
`gh pr list --state open --json ${FIELDS2} --limit 100 -R ${org}/${repo}`,
|
|
33241
33334
|
{ encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }
|
|
33242
33335
|
);
|
|
@@ -33585,7 +33678,7 @@ function resolveReadTimeTarget(target) {
|
|
|
33585
33678
|
}
|
|
33586
33679
|
|
|
33587
33680
|
// src/commands/prs/fetchPrBody.ts
|
|
33588
|
-
import { execSync as
|
|
33681
|
+
import { execSync as execSync47 } from "child_process";
|
|
33589
33682
|
function exitGhNotInstalled() {
|
|
33590
33683
|
console.error("Error: GitHub CLI (gh) is not installed.");
|
|
33591
33684
|
console.error("Install it from https://cli.github.com/");
|
|
@@ -33606,7 +33699,7 @@ function currentRepo() {
|
|
|
33606
33699
|
function fetchPrBody(number, repo) {
|
|
33607
33700
|
const { org, repo: name } = repo ?? currentRepo();
|
|
33608
33701
|
try {
|
|
33609
|
-
const raw =
|
|
33702
|
+
const raw = execSync47(`gh pr view ${number} --json body -R ${org}/${name}`, {
|
|
33610
33703
|
encoding: "utf8",
|
|
33611
33704
|
stdio: ["pipe", "pipe", "pipe"]
|
|
33612
33705
|
});
|
|
@@ -33762,10 +33855,10 @@ import chalk201 from "chalk";
|
|
|
33762
33855
|
import Enquirer2 from "enquirer";
|
|
33763
33856
|
|
|
33764
33857
|
// src/commands/ravendb/searchItems.ts
|
|
33765
|
-
import { execSync as
|
|
33858
|
+
import { execSync as execSync48 } from "child_process";
|
|
33766
33859
|
import chalk200 from "chalk";
|
|
33767
33860
|
function opExec(args) {
|
|
33768
|
-
return
|
|
33861
|
+
return execSync48(`op ${args}`, {
|
|
33769
33862
|
encoding: "utf8",
|
|
33770
33863
|
stdio: ["pipe", "pipe", "pipe"]
|
|
33771
33864
|
}).trim();
|
|
@@ -33917,7 +34010,7 @@ ${errorText}`
|
|
|
33917
34010
|
}
|
|
33918
34011
|
|
|
33919
34012
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
33920
|
-
import { execSync as
|
|
34013
|
+
import { execSync as execSync49 } from "child_process";
|
|
33921
34014
|
import chalk205 from "chalk";
|
|
33922
34015
|
function resolveOpSecret(reference) {
|
|
33923
34016
|
if (!reference.startsWith("op://")) {
|
|
@@ -33925,7 +34018,7 @@ function resolveOpSecret(reference) {
|
|
|
33925
34018
|
process.exit(1);
|
|
33926
34019
|
}
|
|
33927
34020
|
try {
|
|
33928
|
-
return
|
|
34021
|
+
return execSync49(`op read "${reference}"`, {
|
|
33929
34022
|
encoding: "utf8",
|
|
33930
34023
|
stdio: ["pipe", "pipe", "pipe"]
|
|
33931
34024
|
}).trim();
|
|
@@ -34379,9 +34472,9 @@ function registerReleases(parent) {
|
|
|
34379
34472
|
}
|
|
34380
34473
|
|
|
34381
34474
|
// src/commands/coverage.ts
|
|
34382
|
-
import { execSync as
|
|
34475
|
+
import { execSync as execSync50 } from "child_process";
|
|
34383
34476
|
function coverage() {
|
|
34384
|
-
const output =
|
|
34477
|
+
const output = execSync50(
|
|
34385
34478
|
"npx vitest run --coverage --coverage.include='src/**/*.ts' --coverage.all --coverage.reporter=text 2>&1",
|
|
34386
34479
|
{ encoding: "utf8", timeout: 12e4 }
|
|
34387
34480
|
);
|
|
@@ -34744,10 +34837,10 @@ async function notify() {
|
|
|
34744
34837
|
}
|
|
34745
34838
|
|
|
34746
34839
|
// src/commands/screenshot.ts
|
|
34747
|
-
import { execSync as
|
|
34840
|
+
import { execSync as execSync51 } from "child_process";
|
|
34748
34841
|
import { existsSync as existsSync65, mkdirSync as mkdirSync24, unlinkSync as unlinkSync15, writeFileSync as writeFileSync39 } from "fs";
|
|
34749
34842
|
import { tmpdir as tmpdir7 } from "os";
|
|
34750
|
-
import { join as join83, resolve as
|
|
34843
|
+
import { join as join83, resolve as resolve25 } from "path";
|
|
34751
34844
|
import chalk217 from "chalk";
|
|
34752
34845
|
|
|
34753
34846
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -34881,13 +34974,13 @@ function buildOutputPath(outputDir, processName) {
|
|
|
34881
34974
|
mkdirSync24(outputDir, { recursive: true });
|
|
34882
34975
|
}
|
|
34883
34976
|
const timestamp8 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
34884
|
-
return
|
|
34977
|
+
return resolve25(outputDir, `${processName}-${timestamp8}.png`);
|
|
34885
34978
|
}
|
|
34886
34979
|
function runPowerShellScript(processName, outputPath) {
|
|
34887
34980
|
const scriptPath = join83(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
|
|
34888
34981
|
writeFileSync39(scriptPath, captureWindowPs1, "utf8");
|
|
34889
34982
|
try {
|
|
34890
|
-
|
|
34983
|
+
execSync51(
|
|
34891
34984
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|
|
34892
34985
|
{ stdio: ["ignore", "pipe", "pipe"], encoding: "utf8" }
|
|
34893
34986
|
);
|
|
@@ -34897,7 +34990,7 @@ function runPowerShellScript(processName, outputPath) {
|
|
|
34897
34990
|
}
|
|
34898
34991
|
function screenshot(processName) {
|
|
34899
34992
|
const config = loadConfig();
|
|
34900
|
-
const outputDir =
|
|
34993
|
+
const outputDir = resolve25(config.screenshot.outputDir);
|
|
34901
34994
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
34902
34995
|
console.log(chalk217.gray(`Capturing window for process "${processName}" ...`));
|
|
34903
34996
|
try {
|
|
@@ -34999,7 +35092,7 @@ function buildLimitsSegment(rateLimits) {
|
|
|
34999
35092
|
|
|
35000
35093
|
// src/commands/readGitBranch.ts
|
|
35001
35094
|
import { readFileSync as readFileSync48, statSync as statSync10 } from "fs";
|
|
35002
|
-
import { isAbsolute as isAbsolute6, join as join84, resolve as
|
|
35095
|
+
import { isAbsolute as isAbsolute6, join as join84, resolve as resolve26 } from "path";
|
|
35003
35096
|
function resolveGitDir(cwd) {
|
|
35004
35097
|
const dotGit = join84(cwd, ".git");
|
|
35005
35098
|
let stat5;
|
|
@@ -35022,7 +35115,7 @@ function resolveGitDir(cwd) {
|
|
|
35022
35115
|
return null;
|
|
35023
35116
|
}
|
|
35024
35117
|
const gitDir = match[1].trim();
|
|
35025
|
-
return isAbsolute6(gitDir) ? gitDir :
|
|
35118
|
+
return isAbsolute6(gitDir) ? gitDir : resolve26(cwd, gitDir);
|
|
35026
35119
|
}
|
|
35027
35120
|
function readGitBranch(cwd) {
|
|
35028
35121
|
const gitDir = resolveGitDir(cwd);
|
|
@@ -35099,7 +35192,7 @@ async function statusLine() {
|
|
|
35099
35192
|
}
|
|
35100
35193
|
|
|
35101
35194
|
// src/commands/update.ts
|
|
35102
|
-
import { execSync as
|
|
35195
|
+
import { execSync as execSync52 } from "child_process";
|
|
35103
35196
|
import * as path46 from "path";
|
|
35104
35197
|
|
|
35105
35198
|
// src/commands/restartDaemonAfterUpdate.ts
|
|
@@ -35123,7 +35216,7 @@ function isGlobalNpmInstall(dir) {
|
|
|
35123
35216
|
if (resolved.split(path46.sep).includes("node_modules")) {
|
|
35124
35217
|
return true;
|
|
35125
35218
|
}
|
|
35126
|
-
const globalPrefix =
|
|
35219
|
+
const globalPrefix = execSync52("npm prefix -g", { stdio: "pipe" }).toString().trim();
|
|
35127
35220
|
return resolved.toLowerCase().startsWith(path46.resolve(globalPrefix).toLowerCase());
|
|
35128
35221
|
} catch {
|
|
35129
35222
|
return false;
|
|
@@ -35134,18 +35227,18 @@ async function update2() {
|
|
|
35134
35227
|
console.log(`Assist is installed at: ${installDir}`);
|
|
35135
35228
|
if (isGitRepo(installDir)) {
|
|
35136
35229
|
console.log("Detected git repo installation, pulling latest...");
|
|
35137
|
-
|
|
35230
|
+
execSync52("git pull", { cwd: installDir, stdio: "inherit" });
|
|
35138
35231
|
console.log("Installing dependencies...");
|
|
35139
|
-
|
|
35232
|
+
execSync52("npm i", { cwd: installDir, stdio: "inherit" });
|
|
35140
35233
|
console.log("Building...");
|
|
35141
|
-
|
|
35234
|
+
execSync52("npm run build", { cwd: installDir, stdio: "inherit" });
|
|
35142
35235
|
console.log("Syncing commands...");
|
|
35143
|
-
|
|
35236
|
+
execSync52("assist sync", { stdio: "inherit" });
|
|
35144
35237
|
} else if (isGlobalNpmInstall(installDir)) {
|
|
35145
35238
|
console.log("Detected global npm installation, updating...");
|
|
35146
|
-
|
|
35239
|
+
execSync52("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
|
|
35147
35240
|
console.log("Syncing commands...");
|
|
35148
|
-
|
|
35241
|
+
execSync52("assist sync", { stdio: "inherit" });
|
|
35149
35242
|
} else {
|
|
35150
35243
|
console.error(
|
|
35151
35244
|
"Could not determine installation method. Expected a git repo or global npm install."
|
|
@@ -35248,7 +35341,7 @@ Refactor check failed:
|
|
|
35248
35341
|
}
|
|
35249
35342
|
|
|
35250
35343
|
// src/commands/refactor/check/getViolations.ts
|
|
35251
|
-
import { execSync as
|
|
35344
|
+
import { execSync as execSync53 } from "child_process";
|
|
35252
35345
|
import fs29 from "fs";
|
|
35253
35346
|
import { minimatch as minimatch3 } from "minimatch";
|
|
35254
35347
|
|
|
@@ -35298,7 +35391,7 @@ function getGitFiles(options2) {
|
|
|
35298
35391
|
}
|
|
35299
35392
|
const files = /* @__PURE__ */ new Set();
|
|
35300
35393
|
if (options2.staged || options2.modified) {
|
|
35301
|
-
const staged =
|
|
35394
|
+
const staged = execSync53("git diff --cached --name-only", {
|
|
35302
35395
|
encoding: "utf8"
|
|
35303
35396
|
});
|
|
35304
35397
|
for (const file of staged.trim().split("\n").filter(Boolean)) {
|
|
@@ -35306,7 +35399,7 @@ function getGitFiles(options2) {
|
|
|
35306
35399
|
}
|
|
35307
35400
|
}
|
|
35308
35401
|
if (options2.unstaged || options2.modified) {
|
|
35309
|
-
const unstaged =
|
|
35402
|
+
const unstaged = execSync53("git diff --name-only", { encoding: "utf8" });
|
|
35310
35403
|
for (const file of unstaged.trim().split("\n").filter(Boolean)) {
|
|
35311
35404
|
files.add(file);
|
|
35312
35405
|
}
|
|
@@ -35336,7 +35429,7 @@ function getViolations(pattern2, options2 = {}, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
35336
35429
|
|
|
35337
35430
|
// src/commands/refactor/check.ts
|
|
35338
35431
|
function runScript(script, cwd) {
|
|
35339
|
-
return new Promise((
|
|
35432
|
+
return new Promise((resolve32) => {
|
|
35340
35433
|
const child = spawn7("npm", ["run", script], {
|
|
35341
35434
|
stdio: "pipe",
|
|
35342
35435
|
shell: true,
|
|
@@ -35350,7 +35443,7 @@ function runScript(script, cwd) {
|
|
|
35350
35443
|
output += data.toString();
|
|
35351
35444
|
});
|
|
35352
35445
|
child.on("close", (code) => {
|
|
35353
|
-
|
|
35446
|
+
resolve32({ script, code: code ?? 1, output });
|
|
35354
35447
|
});
|
|
35355
35448
|
});
|
|
35356
35449
|
}
|
|
@@ -38311,7 +38404,7 @@ function fetchHighLevelFiles(prNumber, repo) {
|
|
|
38311
38404
|
}
|
|
38312
38405
|
|
|
38313
38406
|
// src/commands/review/highLevel/fetchHighLevelPr.ts
|
|
38314
|
-
import { execSync as
|
|
38407
|
+
import { execSync as execSync54 } from "child_process";
|
|
38315
38408
|
|
|
38316
38409
|
// src/commands/review/highLevel/waitForMergeable.ts
|
|
38317
38410
|
var MAX_ATTEMPTS = 5;
|
|
@@ -38330,7 +38423,7 @@ function waitForMergeable(initial, refetch, delayMs = DELAY_MS) {
|
|
|
38330
38423
|
|
|
38331
38424
|
// src/commands/review/highLevel/fetchHighLevelPr.ts
|
|
38332
38425
|
function ghPrView(prNumber, repo, fields) {
|
|
38333
|
-
const raw =
|
|
38426
|
+
const raw = execSync54(
|
|
38334
38427
|
`gh pr view ${prNumber} --json ${fields} -R ${repo.org}/${repo.repo}`,
|
|
38335
38428
|
{ encoding: "utf8" }
|
|
38336
38429
|
);
|
|
@@ -39228,11 +39321,11 @@ function buildDiffLineIndex(diff3) {
|
|
|
39228
39321
|
}
|
|
39229
39322
|
|
|
39230
39323
|
// src/commands/review/fetchPrDiff.ts
|
|
39231
|
-
import { execSync as
|
|
39324
|
+
import { execSync as execSync55 } from "child_process";
|
|
39232
39325
|
function fetchPrDiff(prNumber, baseSha, headSha) {
|
|
39233
39326
|
const { org, repo } = getRepoInfo();
|
|
39234
39327
|
try {
|
|
39235
|
-
return
|
|
39328
|
+
return execSync55(`gh pr diff ${prNumber} -R ${org}/${repo}`, {
|
|
39236
39329
|
encoding: "utf8",
|
|
39237
39330
|
maxBuffer: 256 * 1024 * 1024,
|
|
39238
39331
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -39247,10 +39340,10 @@ function isDiffTooLarge(error) {
|
|
|
39247
39340
|
}
|
|
39248
39341
|
function fetchDiffViaGit(baseSha, headSha) {
|
|
39249
39342
|
try {
|
|
39250
|
-
|
|
39343
|
+
execSync55(`git fetch origin ${baseSha} ${headSha}`, { stdio: "ignore" });
|
|
39251
39344
|
} catch {
|
|
39252
39345
|
}
|
|
39253
|
-
return
|
|
39346
|
+
return execSync55(`git diff ${baseSha}...${headSha}`, {
|
|
39254
39347
|
encoding: "utf8",
|
|
39255
39348
|
maxBuffer: 256 * 1024 * 1024
|
|
39256
39349
|
});
|
|
@@ -40155,12 +40248,12 @@ function onCloseResult(ctx, code) {
|
|
|
40155
40248
|
return { ...closed, stderr: ctx.stderr.value, stdout: ctx.stdout.value };
|
|
40156
40249
|
}
|
|
40157
40250
|
function waitForChildExit(ctx) {
|
|
40158
|
-
return new Promise((
|
|
40251
|
+
return new Promise((resolve32) => {
|
|
40159
40252
|
let settled = false;
|
|
40160
40253
|
const settle = (result) => {
|
|
40161
40254
|
if (settled) return;
|
|
40162
40255
|
settled = true;
|
|
40163
|
-
|
|
40256
|
+
resolve32(result);
|
|
40164
40257
|
};
|
|
40165
40258
|
ctx.child.on("error", (err) => settle(onErrorResult(ctx, err)));
|
|
40166
40259
|
ctx.child.on("close", (code) => settle(onCloseResult(ctx, code)));
|
|
@@ -40780,9 +40873,9 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
40780
40873
|
}
|
|
40781
40874
|
|
|
40782
40875
|
// src/commands/review/fetchExistingComments.ts
|
|
40783
|
-
import { execSync as
|
|
40876
|
+
import { execSync as execSync56 } from "child_process";
|
|
40784
40877
|
function fetchRawComments(org, repo, prNumber) {
|
|
40785
|
-
const out =
|
|
40878
|
+
const out = execSync56(
|
|
40786
40879
|
`gh api --paginate repos/${org}/${repo}/pulls/${prNumber}/comments`,
|
|
40787
40880
|
{ encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
|
|
40788
40881
|
);
|
|
@@ -40843,18 +40936,18 @@ function logPriorComments(count10) {
|
|
|
40843
40936
|
}
|
|
40844
40937
|
|
|
40845
40938
|
// src/commands/review/gatherContext.ts
|
|
40846
|
-
import { execSync as
|
|
40939
|
+
import { execSync as execSync58 } from "child_process";
|
|
40847
40940
|
|
|
40848
40941
|
// src/commands/review/fetchPrDiffInfo.ts
|
|
40849
|
-
import { execSync as
|
|
40942
|
+
import { execSync as execSync57 } from "child_process";
|
|
40850
40943
|
function getCurrentBranch3() {
|
|
40851
|
-
return
|
|
40944
|
+
return execSync57("git rev-parse --abbrev-ref HEAD", {
|
|
40852
40945
|
encoding: "utf8"
|
|
40853
40946
|
}).trim();
|
|
40854
40947
|
}
|
|
40855
40948
|
var FIELDS3 = "number,baseRefName,baseRefOid,headRefName,headRefOid";
|
|
40856
40949
|
function runGh2(command) {
|
|
40857
|
-
return
|
|
40950
|
+
return execSync57(command, {
|
|
40858
40951
|
encoding: "utf8",
|
|
40859
40952
|
stdio: ["ignore", "pipe", "pipe"]
|
|
40860
40953
|
});
|
|
@@ -40892,7 +40985,7 @@ function fetchPrDiffInfo() {
|
|
|
40892
40985
|
}
|
|
40893
40986
|
function fetchPrChangedFiles(prNumber) {
|
|
40894
40987
|
const { org, repo } = getRepoInfo();
|
|
40895
|
-
const out =
|
|
40988
|
+
const out = execSync57(
|
|
40896
40989
|
`gh api repos/${org}/${repo}/pulls/${prNumber}/files --paginate --jq ".[].filename"`,
|
|
40897
40990
|
{
|
|
40898
40991
|
encoding: "utf8",
|
|
@@ -40904,11 +40997,11 @@ function fetchPrChangedFiles(prNumber) {
|
|
|
40904
40997
|
|
|
40905
40998
|
// src/commands/review/gatherContext.ts
|
|
40906
40999
|
function gatherContext() {
|
|
40907
|
-
const branch2 =
|
|
41000
|
+
const branch2 = execSync58("git rev-parse --abbrev-ref HEAD", {
|
|
40908
41001
|
encoding: "utf8"
|
|
40909
41002
|
}).trim();
|
|
40910
|
-
const sha =
|
|
40911
|
-
const shortSha =
|
|
41003
|
+
const sha = execSync58("git rev-parse HEAD", { encoding: "utf8" }).trim();
|
|
41004
|
+
const shortSha = execSync58("git rev-parse --short=7 HEAD", {
|
|
40912
41005
|
encoding: "utf8"
|
|
40913
41006
|
}).trim();
|
|
40914
41007
|
const prInfo = fetchPrDiffInfo();
|
|
@@ -42103,11 +42196,11 @@ import { randomUUID as randomUUID22 } from "crypto";
|
|
|
42103
42196
|
// src/commands/sessions/shared/sendShowPreview.ts
|
|
42104
42197
|
async function sendShowPreview(request) {
|
|
42105
42198
|
const socket = await connectToDaemon();
|
|
42106
|
-
await new Promise((
|
|
42199
|
+
await new Promise((resolve32, reject) => {
|
|
42107
42200
|
const finish2 = (error) => {
|
|
42108
42201
|
socket.destroy();
|
|
42109
42202
|
if (error) reject(error);
|
|
42110
|
-
else
|
|
42203
|
+
else resolve32();
|
|
42111
42204
|
};
|
|
42112
42205
|
readSocketLines(socket, (line) => {
|
|
42113
42206
|
const reply2 = parseReply(line);
|
|
@@ -43382,9 +43475,9 @@ function createReadlineInterface() {
|
|
|
43382
43475
|
});
|
|
43383
43476
|
}
|
|
43384
43477
|
function askQuestion2(rl, question) {
|
|
43385
|
-
return new Promise((
|
|
43478
|
+
return new Promise((resolve32) => {
|
|
43386
43479
|
rl.question(question, (answer) => {
|
|
43387
|
-
|
|
43480
|
+
resolve32(answer.trim());
|
|
43388
43481
|
});
|
|
43389
43482
|
});
|
|
43390
43483
|
}
|
|
@@ -43793,7 +43886,7 @@ function adviceFragments() {
|
|
|
43793
43886
|
}
|
|
43794
43887
|
|
|
43795
43888
|
// src/commands/verify/blockCodeComments/findComments.ts
|
|
43796
|
-
import { execSync as
|
|
43889
|
+
import { execSync as execSync59 } from "child_process";
|
|
43797
43890
|
import fs48 from "fs";
|
|
43798
43891
|
import { minimatch as minimatch9 } from "minimatch";
|
|
43799
43892
|
import { Project as Project5 } from "ts-morph";
|
|
@@ -44032,7 +44125,7 @@ function shouldScan(file, ignoreGlobs) {
|
|
|
44032
44125
|
return fs48.existsSync(file);
|
|
44033
44126
|
}
|
|
44034
44127
|
function findComments(options2) {
|
|
44035
|
-
const diff3 =
|
|
44128
|
+
const diff3 = execSync59("git diff HEAD", {
|
|
44036
44129
|
encoding: "utf8",
|
|
44037
44130
|
maxBuffer: 64 * 1024 * 1024
|
|
44038
44131
|
});
|
|
@@ -44313,14 +44406,14 @@ function listMigrationFiles(dir) {
|
|
|
44313
44406
|
}
|
|
44314
44407
|
|
|
44315
44408
|
// src/commands/verify/migrations/readBaselineMigrations.ts
|
|
44316
|
-
import { execSync as
|
|
44409
|
+
import { execSync as execSync60 } from "child_process";
|
|
44317
44410
|
import { basename as basename31 } from "path";
|
|
44318
44411
|
var MIGRATION_FILE3 = /^migration\d+[A-Za-z0-9]*\.ts$/;
|
|
44319
44412
|
function readBaselineMigrations(repoRelativeDir, ref) {
|
|
44320
44413
|
const baseline = /* @__PURE__ */ new Map();
|
|
44321
44414
|
let listing;
|
|
44322
44415
|
try {
|
|
44323
|
-
listing =
|
|
44416
|
+
listing = execSync60(
|
|
44324
44417
|
`git ls-tree -r --name-only "${ref}" -- "${repoRelativeDir}"`,
|
|
44325
44418
|
{ encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] }
|
|
44326
44419
|
);
|
|
@@ -44330,7 +44423,7 @@ function readBaselineMigrations(repoRelativeDir, ref) {
|
|
|
44330
44423
|
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path108) => MIGRATION_FILE3.test(basename31(path108)));
|
|
44331
44424
|
for (const path108 of paths) {
|
|
44332
44425
|
try {
|
|
44333
|
-
const content =
|
|
44426
|
+
const content = execSync60(`git show "${ref}:${path108}"`, {
|
|
44334
44427
|
encoding: "utf8",
|
|
44335
44428
|
maxBuffer: 16 * 1024 * 1024,
|
|
44336
44429
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -44343,10 +44436,10 @@ function readBaselineMigrations(repoRelativeDir, ref) {
|
|
|
44343
44436
|
}
|
|
44344
44437
|
|
|
44345
44438
|
// src/commands/verify/migrations/resolveBaselineRef.ts
|
|
44346
|
-
import { execSync as
|
|
44439
|
+
import { execSync as execSync61 } from "child_process";
|
|
44347
44440
|
function refExists2(ref) {
|
|
44348
44441
|
try {
|
|
44349
|
-
|
|
44442
|
+
execSync61(`git rev-parse --verify --quiet "${ref}"`, {
|
|
44350
44443
|
stdio: ["pipe", "pipe", "pipe"]
|
|
44351
44444
|
});
|
|
44352
44445
|
return true;
|
|
@@ -44422,10 +44515,10 @@ Total: ${problems.length} violation(s).`);
|
|
|
44422
44515
|
}
|
|
44423
44516
|
|
|
44424
44517
|
// src/commands/verify/noVenv.ts
|
|
44425
|
-
import { execSync as
|
|
44518
|
+
import { execSync as execSync62 } from "child_process";
|
|
44426
44519
|
function noVenv() {
|
|
44427
44520
|
try {
|
|
44428
|
-
const output =
|
|
44521
|
+
const output = execSync62(
|
|
44429
44522
|
"find . -type d -name venv -not -path '*/node_modules/*'",
|
|
44430
44523
|
{
|
|
44431
44524
|
encoding: "utf8"
|
|
@@ -44845,7 +44938,7 @@ function resolveParams(params, cliArgs) {
|
|
|
44845
44938
|
|
|
44846
44939
|
// src/commands/run/resolveRunCwd.ts
|
|
44847
44940
|
import { existsSync as existsSync82 } from "fs";
|
|
44848
|
-
import { resolve as
|
|
44941
|
+
import { resolve as resolve28 } from "path";
|
|
44849
44942
|
var MissingRunCwdError = class extends Error {
|
|
44850
44943
|
constructor(runName, cwd) {
|
|
44851
44944
|
super(`run config "${runName}": cwd ${cwd} does not exist`);
|
|
@@ -44856,13 +44949,13 @@ var MissingRunCwdError = class extends Error {
|
|
|
44856
44949
|
};
|
|
44857
44950
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
44858
44951
|
if (!config.cwd) return void 0;
|
|
44859
|
-
const cwd =
|
|
44952
|
+
const cwd = resolve28(baseDir, config.cwd);
|
|
44860
44953
|
if (!existsSync82(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
44861
44954
|
return cwd;
|
|
44862
44955
|
}
|
|
44863
44956
|
|
|
44864
44957
|
// src/commands/run/runPreCommands.ts
|
|
44865
|
-
import { execSync as
|
|
44958
|
+
import { execSync as execSync63 } from "child_process";
|
|
44866
44959
|
function writeCapturedOutput(error) {
|
|
44867
44960
|
for (const stream of ["stdout", "stderr"]) {
|
|
44868
44961
|
const output = error[stream];
|
|
@@ -44872,7 +44965,7 @@ function writeCapturedOutput(error) {
|
|
|
44872
44965
|
function runPreCommands(pre, cwd, quiet) {
|
|
44873
44966
|
for (const cmd of pre) {
|
|
44874
44967
|
try {
|
|
44875
|
-
|
|
44968
|
+
execSync63(cmd, { stdio: quiet ? "pipe" : "inherit", cwd });
|
|
44876
44969
|
} catch (error) {
|
|
44877
44970
|
if (quiet && error && typeof error === "object")
|
|
44878
44971
|
writeCapturedOutput(error);
|
|
@@ -44989,9 +45082,9 @@ function consumeMarker(path108) {
|
|
|
44989
45082
|
}
|
|
44990
45083
|
|
|
44991
45084
|
// src/commands/watch/gitMarkerPath.ts
|
|
44992
|
-
import { resolve as
|
|
45085
|
+
import { resolve as resolve29 } from "path";
|
|
44993
45086
|
function gitMarkerPath(name, cwd) {
|
|
44994
|
-
return
|
|
45087
|
+
return resolve29(
|
|
44995
45088
|
cwd ?? process.cwd(),
|
|
44996
45089
|
runGit3(["rev-parse", "--git-path", name], cwd)
|
|
44997
45090
|
);
|
|
@@ -45050,7 +45143,7 @@ function readMovement(cwd) {
|
|
|
45050
45143
|
var CONTROL_POLL_MS = 1e3;
|
|
45051
45144
|
function pollForMovement(options2) {
|
|
45052
45145
|
const { upstream, intervalMs, timeoutMs, timeout, cwd, control } = options2;
|
|
45053
|
-
return new Promise((
|
|
45146
|
+
return new Promise((resolve32) => {
|
|
45054
45147
|
let settled = false;
|
|
45055
45148
|
const finish2 = (outcome) => {
|
|
45056
45149
|
if (settled) return;
|
|
@@ -45059,7 +45152,7 @@ function pollForMovement(options2) {
|
|
|
45059
45152
|
clearInterval(controller);
|
|
45060
45153
|
clearTimeout(deadline);
|
|
45061
45154
|
process.off("SIGINT", onInterrupt);
|
|
45062
|
-
|
|
45155
|
+
resolve32(outcome);
|
|
45063
45156
|
};
|
|
45064
45157
|
const onInterrupt = () => finish2({ kind: "interrupted" });
|
|
45065
45158
|
const check2 = () => {
|
|
@@ -45200,12 +45293,12 @@ function decideLap(end, interrupted) {
|
|
|
45200
45293
|
import { spawn as spawn9 } from "child_process";
|
|
45201
45294
|
var WATCH_LAP_ARGS = ["watch", "wait", "--pull", "--build"];
|
|
45202
45295
|
function runWatchLap() {
|
|
45203
|
-
return new Promise((
|
|
45296
|
+
return new Promise((resolve32, reject) => {
|
|
45204
45297
|
const assistFromPath = spawn9("assist", WATCH_LAP_ARGS, {
|
|
45205
45298
|
stdio: "inherit",
|
|
45206
45299
|
shell: process.platform === "win32"
|
|
45207
45300
|
});
|
|
45208
|
-
assistFromPath.on("close", (code, signal) =>
|
|
45301
|
+
assistFromPath.on("close", (code, signal) => resolve32({ code, signal }));
|
|
45209
45302
|
assistFromPath.on("error", reject);
|
|
45210
45303
|
});
|
|
45211
45304
|
}
|
|
@@ -45552,12 +45645,12 @@ function parseEnvPairs(pairs) {
|
|
|
45552
45645
|
if (pairs.length === 0) return void 0;
|
|
45553
45646
|
const env = {};
|
|
45554
45647
|
for (const pair of pairs) {
|
|
45555
|
-
const
|
|
45556
|
-
if (
|
|
45648
|
+
const eq52 = pair.indexOf("=");
|
|
45649
|
+
if (eq52 <= 0) {
|
|
45557
45650
|
console.error(`--env must be KEY=VALUE, got "${pair}"`);
|
|
45558
45651
|
process.exit(1);
|
|
45559
45652
|
}
|
|
45560
|
-
env[pair.slice(0,
|
|
45653
|
+
env[pair.slice(0, eq52)] = pair.slice(eq52 + 1);
|
|
45561
45654
|
}
|
|
45562
45655
|
return env;
|
|
45563
45656
|
}
|
|
@@ -45570,11 +45663,11 @@ function fail9(spec) {
|
|
|
45570
45663
|
process.exit(1);
|
|
45571
45664
|
}
|
|
45572
45665
|
function parseParamSpec(spec) {
|
|
45573
|
-
const
|
|
45574
|
-
const name =
|
|
45575
|
-
if (
|
|
45576
|
-
if (
|
|
45577
|
-
return { name, default: spec.slice(
|
|
45666
|
+
const eq52 = spec.indexOf("=");
|
|
45667
|
+
const name = eq52 === -1 ? spec : spec.slice(0, eq52);
|
|
45668
|
+
if (eq52 !== -1) {
|
|
45669
|
+
if (eq52 === 0 || name.endsWith("!")) fail9(spec);
|
|
45670
|
+
return { name, default: spec.slice(eq52 + 1) };
|
|
45578
45671
|
}
|
|
45579
45672
|
if (name.endsWith("!")) {
|
|
45580
45673
|
if (name.length === 1) fail9(spec);
|
|
@@ -45892,10 +45985,10 @@ var STATUS_TIMEOUT_MS2 = 5e3;
|
|
|
45892
45985
|
function queryDaemon(socket) {
|
|
45893
45986
|
socket.write(`${JSON.stringify({ type: "ping" })}
|
|
45894
45987
|
`);
|
|
45895
|
-
return new Promise((
|
|
45988
|
+
return new Promise((resolve32) => {
|
|
45896
45989
|
const result = { sessions: [] };
|
|
45897
45990
|
const pending = /* @__PURE__ */ new Set(["sessions", "pong"]);
|
|
45898
|
-
const timer = setTimeout(() =>
|
|
45991
|
+
const timer = setTimeout(() => resolve32(result), STATUS_TIMEOUT_MS2);
|
|
45899
45992
|
const lines2 = createInterface8({ input: socket });
|
|
45900
45993
|
lines2.on("error", () => {
|
|
45901
45994
|
});
|
|
@@ -45903,7 +45996,7 @@ function queryDaemon(socket) {
|
|
|
45903
45996
|
applyLine(result, pending, line);
|
|
45904
45997
|
if (pending.size === 0) {
|
|
45905
45998
|
clearTimeout(timer);
|
|
45906
|
-
|
|
45999
|
+
resolve32(result);
|
|
45907
46000
|
}
|
|
45908
46001
|
});
|
|
45909
46002
|
});
|
|
@@ -46003,11 +46096,11 @@ function clearPersistedSessionsOnDrain() {
|
|
|
46003
46096
|
|
|
46004
46097
|
// src/commands/sessions/daemon/readDaemonMessage.ts
|
|
46005
46098
|
function readDaemonMessage(lines2, timeoutMs, fallback, match) {
|
|
46006
|
-
return new Promise((
|
|
46099
|
+
return new Promise((resolve32) => {
|
|
46007
46100
|
const finish2 = (value) => {
|
|
46008
46101
|
clearTimeout(timer);
|
|
46009
46102
|
lines2.off("line", onLine);
|
|
46010
|
-
|
|
46103
|
+
resolve32(value);
|
|
46011
46104
|
};
|
|
46012
46105
|
const timer = setTimeout(() => finish2(fallback), timeoutMs);
|
|
46013
46106
|
const onLine = (line) => {
|
|
@@ -46454,7 +46547,7 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
46454
46547
|
|
|
46455
46548
|
// src/commands/sessions/daemon/findServerParents.ts
|
|
46456
46549
|
import { existsSync as existsSync86 } from "fs";
|
|
46457
|
-
import { join as join105, resolve as
|
|
46550
|
+
import { join as join105, resolve as resolve30 } from "path";
|
|
46458
46551
|
function isLive(session) {
|
|
46459
46552
|
return !!session.pty && session.status !== "done" && session.status !== "error";
|
|
46460
46553
|
}
|
|
@@ -46463,13 +46556,13 @@ function isLiveAgent(session) {
|
|
|
46463
46556
|
}
|
|
46464
46557
|
function serverRunDirs(sessions, file) {
|
|
46465
46558
|
return new Set(
|
|
46466
|
-
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) =>
|
|
46559
|
+
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve30(s.cwd)).filter((dir) => existsSync86(join105(dir, file)))
|
|
46467
46560
|
);
|
|
46468
46561
|
}
|
|
46469
46562
|
function findServerParents(sessions, file) {
|
|
46470
46563
|
const all = [...sessions.values()];
|
|
46471
46564
|
const dirs = serverRunDirs(all, file);
|
|
46472
|
-
return all.filter((s) => isLiveAgent(s) && s.cwd && dirs.has(
|
|
46565
|
+
return all.filter((s) => isLiveAgent(s) && s.cwd && dirs.has(resolve30(s.cwd)));
|
|
46473
46566
|
}
|
|
46474
46567
|
|
|
46475
46568
|
// src/commands/sessions/daemon/lastWriteTimes.ts
|
|
@@ -46481,7 +46574,7 @@ function asRecord(value) {
|
|
|
46481
46574
|
}
|
|
46482
46575
|
|
|
46483
46576
|
// src/commands/sessions/shared/writtenFilePaths.ts
|
|
46484
|
-
var
|
|
46577
|
+
var WRITE_TOOLS2 = /* @__PURE__ */ new Set(["Write", "Edit", "MultiEdit", "NotebookEdit"]);
|
|
46485
46578
|
function writtenFilePaths(entry) {
|
|
46486
46579
|
if (entry.type !== "assistant") return [];
|
|
46487
46580
|
const content = asRecord(entry.message)?.content;
|
|
@@ -46489,7 +46582,7 @@ function writtenFilePaths(entry) {
|
|
|
46489
46582
|
const paths = [];
|
|
46490
46583
|
for (const block of content) {
|
|
46491
46584
|
const b = asRecord(block);
|
|
46492
|
-
if (b?.type !== "tool_use" || !
|
|
46585
|
+
if (b?.type !== "tool_use" || !WRITE_TOOLS2.has(String(b.name))) continue;
|
|
46493
46586
|
const input = asRecord(b.input);
|
|
46494
46587
|
const path108 = input?.file_path ?? input?.notebook_path;
|
|
46495
46588
|
if (typeof path108 === "string") paths.push(path108);
|
|
@@ -47348,11 +47441,11 @@ var autoUpdateControl = {
|
|
|
47348
47441
|
persist2(value);
|
|
47349
47442
|
wake?.();
|
|
47350
47443
|
},
|
|
47351
|
-
sleep: (ms) => new Promise((
|
|
47444
|
+
sleep: (ms) => new Promise((resolve32) => {
|
|
47352
47445
|
const done2 = () => {
|
|
47353
47446
|
clearTimeout(timer);
|
|
47354
47447
|
if (wake === done2) wake = void 0;
|
|
47355
|
-
|
|
47448
|
+
resolve32();
|
|
47356
47449
|
};
|
|
47357
47450
|
const timer = setTimeout(done2, ms);
|
|
47358
47451
|
wake = done2;
|
|
@@ -47765,7 +47858,7 @@ function clearLapSignals(cwd) {
|
|
|
47765
47858
|
}
|
|
47766
47859
|
function runUpdateLap(cwd, onOutput) {
|
|
47767
47860
|
clearLapSignals(cwd);
|
|
47768
|
-
return new Promise((
|
|
47861
|
+
return new Promise((resolve32, reject) => {
|
|
47769
47862
|
const { ASSIST_ACTIVITY_ID: _activity, ...env } = process.env;
|
|
47770
47863
|
const child = spawn11(
|
|
47771
47864
|
process.execPath,
|
|
@@ -47785,7 +47878,7 @@ function runUpdateLap(cwd, onOutput) {
|
|
|
47785
47878
|
child.stderr.on("data", (chunk) => onOutput(chunk.toString()));
|
|
47786
47879
|
child.on("close", (code, signal) => {
|
|
47787
47880
|
process.off("exit", killWithDaemon);
|
|
47788
|
-
|
|
47881
|
+
resolve32({ code, signal });
|
|
47789
47882
|
});
|
|
47790
47883
|
child.on("error", (error) => {
|
|
47791
47884
|
process.off("exit", killWithDaemon);
|
|
@@ -48196,12 +48289,12 @@ function processCwd(link3) {
|
|
|
48196
48289
|
var POLL_MS2 = 500;
|
|
48197
48290
|
var GRACE_MS = 5e3;
|
|
48198
48291
|
function awaitTreeVacated(session, treePath) {
|
|
48199
|
-
return new Promise((
|
|
48292
|
+
return new Promise((resolve32) => {
|
|
48200
48293
|
let ticks = GRACE_MS / POLL_MS2;
|
|
48201
48294
|
const settle = (outcome) => {
|
|
48202
48295
|
clearTimeout(timer);
|
|
48203
48296
|
session.closeGrace = void 0;
|
|
48204
|
-
|
|
48297
|
+
resolve32(outcome);
|
|
48205
48298
|
};
|
|
48206
48299
|
const tick = () => {
|
|
48207
48300
|
if (liveProcessesInTree(treePath).length === 0) settle("vacated");
|
|
@@ -48908,7 +49001,7 @@ function emitSessionOutput(session, clients, data) {
|
|
|
48908
49001
|
|
|
48909
49002
|
// src/commands/sessions/daemon/exitReason.ts
|
|
48910
49003
|
import { existsSync as existsSync95 } from "fs";
|
|
48911
|
-
import { resolve as
|
|
49004
|
+
import { resolve as resolve31 } from "path";
|
|
48912
49005
|
function exitDetail(session) {
|
|
48913
49006
|
if (session.cwd && !existsSync95(session.cwd))
|
|
48914
49007
|
return `working directory ${session.cwd} no longer exists`;
|
|
@@ -48923,7 +49016,7 @@ function missingRunConfigCwd(session) {
|
|
|
48923
49016
|
const dir = session.cwd ?? process.cwd();
|
|
48924
49017
|
const config = resolveRunConfig(session.runName, dir);
|
|
48925
49018
|
if (!config?.cwd) return void 0;
|
|
48926
|
-
const configured =
|
|
49019
|
+
const configured = resolve31(runConfigBaseDirFrom(dir), config.cwd);
|
|
48927
49020
|
if (existsSync95(configured)) return void 0;
|
|
48928
49021
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
48929
49022
|
}
|
|
@@ -48995,10 +49088,10 @@ function applyReviewPause(session, activity2) {
|
|
|
48995
49088
|
}
|
|
48996
49089
|
|
|
48997
49090
|
// src/shared/db/getPhaseActiveMs.ts
|
|
48998
|
-
import { and as
|
|
49091
|
+
import { and as and21, eq as eq50 } from "drizzle-orm";
|
|
48999
49092
|
async function getPhaseActiveMs(db, itemId2, phaseIdx) {
|
|
49000
49093
|
const [row3] = await db.select({ activeMs: phaseUsage.activeMs }).from(phaseUsage).where(
|
|
49001
|
-
|
|
49094
|
+
and21(eq50(phaseUsage.itemId, itemId2), eq50(phaseUsage.phaseIdx, phaseIdx))
|
|
49002
49095
|
);
|
|
49003
49096
|
return row3?.activeMs ?? 0;
|
|
49004
49097
|
}
|
|
@@ -49885,17 +49978,17 @@ async function recordPhaseTranscriptUsage(db, itemId2, phaseIdx, responses) {
|
|
|
49885
49978
|
}
|
|
49886
49979
|
|
|
49887
49980
|
// src/shared/db/recordWindowTokens.ts
|
|
49888
|
-
import { and as
|
|
49981
|
+
import { and as and22, eq as eq51, sql as sql29 } from "drizzle-orm";
|
|
49889
49982
|
async function recordWindowTokens(db, window, resetsAt, tokensUp, tokensDown) {
|
|
49890
49983
|
if (tokensUp <= 0 && tokensDown <= 0) return;
|
|
49891
49984
|
await db.update(usagePeaks).set({
|
|
49892
49985
|
tokensUp: sql29`${usagePeaks.tokensUp} + ${tokensUp}`,
|
|
49893
49986
|
tokensDown: sql29`${usagePeaks.tokensDown} + ${tokensDown}`
|
|
49894
49987
|
}).where(
|
|
49895
|
-
|
|
49896
|
-
|
|
49897
|
-
|
|
49898
|
-
|
|
49988
|
+
and22(
|
|
49989
|
+
eq51(usagePeaks.window, window),
|
|
49990
|
+
eq51(usagePeaks.resetsAt, resetsAt),
|
|
49991
|
+
eq51(usagePeaks.segment, 0)
|
|
49899
49992
|
)
|
|
49900
49993
|
);
|
|
49901
49994
|
}
|
|
@@ -51754,7 +51847,7 @@ function failPendingCreators(state, message3) {
|
|
|
51754
51847
|
}
|
|
51755
51848
|
function resetRelayState(state, reason4) {
|
|
51756
51849
|
failPendingCreators(state, reason4);
|
|
51757
|
-
for (const
|
|
51850
|
+
for (const resolve32 of state.historyWaiters) resolve32([]);
|
|
51758
51851
|
state.historyWaiters = [];
|
|
51759
51852
|
state.sessions = [];
|
|
51760
51853
|
state.lastSnapshot = void 0;
|
|
@@ -52147,16 +52240,16 @@ var HISTORY_TIMEOUT_MS = 5e3;
|
|
|
52147
52240
|
function requestLinkHistory(ctx) {
|
|
52148
52241
|
if (!ctx.greeted) return Promise.resolve([]);
|
|
52149
52242
|
const waiters = ctx.relay.historyWaiters;
|
|
52150
|
-
return new Promise((
|
|
52243
|
+
return new Promise((resolve32) => {
|
|
52151
52244
|
const settle = (sessions) => {
|
|
52152
52245
|
clearTimeout(timer);
|
|
52153
|
-
|
|
52246
|
+
resolve32(sessions);
|
|
52154
52247
|
};
|
|
52155
52248
|
const timer = setTimeout(() => {
|
|
52156
52249
|
const index2 = waiters.indexOf(settle);
|
|
52157
52250
|
if (index2 !== -1) waiters.splice(index2, 1);
|
|
52158
52251
|
daemonLog(`link ${ctx.spec.name} ws: history timed out`);
|
|
52159
|
-
|
|
52252
|
+
resolve32(ctx.relay.lastHistory ?? []);
|
|
52160
52253
|
}, HISTORY_TIMEOUT_MS);
|
|
52161
52254
|
timer.unref?.();
|
|
52162
52255
|
waiters.push(settle);
|
|
@@ -52908,7 +53001,7 @@ function claudeMessages(line) {
|
|
|
52908
53001
|
}
|
|
52909
53002
|
|
|
52910
53003
|
// src/commands/sessions/daemon/historySearch/findTranscriptMatch.ts
|
|
52911
|
-
function
|
|
53004
|
+
function escapeRegExp2(text18) {
|
|
52912
53005
|
return text18.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
|
|
52913
53006
|
}
|
|
52914
53007
|
function encodesVerbatimInJson(query) {
|
|
@@ -52927,7 +53020,7 @@ function matchTexts(texts, pattern2) {
|
|
|
52927
53020
|
return null;
|
|
52928
53021
|
}
|
|
52929
53022
|
function queryPattern(query) {
|
|
52930
|
-
return new RegExp(
|
|
53023
|
+
return new RegExp(escapeRegExp2(query), "i");
|
|
52931
53024
|
}
|
|
52932
53025
|
async function findTranscriptMatch(filePath, harness, query) {
|
|
52933
53026
|
const pattern2 = queryPattern(query);
|
|
@@ -53507,12 +53600,12 @@ import { execFile as execFile15 } from "child_process";
|
|
|
53507
53600
|
import { existsSync as existsSync102 } from "fs";
|
|
53508
53601
|
function prHeadBranch2(number, cwd) {
|
|
53509
53602
|
const { headBranch } = prCliCommands(number, cwd);
|
|
53510
|
-
return new Promise((
|
|
53603
|
+
return new Promise((resolve32) => {
|
|
53511
53604
|
execFile15(
|
|
53512
53605
|
headBranch.file,
|
|
53513
53606
|
headBranch.args,
|
|
53514
53607
|
{ cwd, encoding: "utf8", windowsHide: true },
|
|
53515
|
-
(error, stdout) =>
|
|
53608
|
+
(error, stdout) => resolve32(error ? null : headBranch.parse(stdout))
|
|
53516
53609
|
);
|
|
53517
53610
|
});
|
|
53518
53611
|
}
|