@staff0rd/assist 0.929.0 → 0.930.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 +5 -0
- package/allowed.cli-reads +1 -0
- package/dist/allowed.cli-reads +1 -0
- package/dist/commands/extension/extension/background.js +1 -1
- package/dist/commands/extension/extension/content.js +29 -29
- package/dist/commands/extension/extension/docs.js +26 -26
- package/dist/commands/extension/extension/manifest.json +1 -1
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +829 -573
- 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.930.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -1570,6 +1570,157 @@ async function ensureTailscaleServe(port, deps2 = {}) {
|
|
|
1570
1570
|
// src/commands/sessions/web/attachSessionSocket.ts
|
|
1571
1571
|
import { WebSocketServer } from "ws";
|
|
1572
1572
|
|
|
1573
|
+
// src/commands/extension/browserLink/types.ts
|
|
1574
|
+
var BROWSER_LINK_PATH = "/ws/browser";
|
|
1575
|
+
|
|
1576
|
+
// src/commands/sessions/web/browser/createLinkWaiters.ts
|
|
1577
|
+
function createLinkWaiters() {
|
|
1578
|
+
const waiters = /* @__PURE__ */ new Set();
|
|
1579
|
+
return {
|
|
1580
|
+
wait(timeoutMs, onTimeout) {
|
|
1581
|
+
return new Promise((resolve31, reject) => {
|
|
1582
|
+
const onLink = (link3) => {
|
|
1583
|
+
clearTimeout(timer);
|
|
1584
|
+
waiters.delete(onLink);
|
|
1585
|
+
resolve31(link3);
|
|
1586
|
+
};
|
|
1587
|
+
const timer = setTimeout(() => {
|
|
1588
|
+
waiters.delete(onLink);
|
|
1589
|
+
reject(onTimeout());
|
|
1590
|
+
}, timeoutMs);
|
|
1591
|
+
waiters.add(onLink);
|
|
1592
|
+
});
|
|
1593
|
+
},
|
|
1594
|
+
notify(link3) {
|
|
1595
|
+
for (const waiter of waiters) waiter(link3);
|
|
1596
|
+
}
|
|
1597
|
+
};
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
// src/commands/sessions/web/browser/relayError.ts
|
|
1601
|
+
function relayError(message3, status2) {
|
|
1602
|
+
return Object.assign(new Error(message3), { status: status2 });
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
// src/commands/sessions/web/browser/createLinkState.ts
|
|
1606
|
+
var noExtension = () => relayError("no assist extension is connected to this web server", 503);
|
|
1607
|
+
function createLinkState({
|
|
1608
|
+
recentLinkMs = 9e4,
|
|
1609
|
+
reconnectWaitMs = 35e3,
|
|
1610
|
+
now = Date.now
|
|
1611
|
+
}) {
|
|
1612
|
+
let link3;
|
|
1613
|
+
let lastSeen = now();
|
|
1614
|
+
const waiters = createLinkWaiters();
|
|
1615
|
+
return {
|
|
1616
|
+
open(ws, version2) {
|
|
1617
|
+
link3 = { ws, version: version2 };
|
|
1618
|
+
lastSeen = now();
|
|
1619
|
+
waiters.notify(link3);
|
|
1620
|
+
},
|
|
1621
|
+
close(ws) {
|
|
1622
|
+
if (link3?.ws !== ws) return;
|
|
1623
|
+
link3 = void 0;
|
|
1624
|
+
lastSeen = now();
|
|
1625
|
+
},
|
|
1626
|
+
connected() {
|
|
1627
|
+
if (link3) return Promise.resolve(link3);
|
|
1628
|
+
if (now() - lastSeen > recentLinkMs) return Promise.reject(noExtension());
|
|
1629
|
+
return waiters.wait(reconnectWaitMs, noExtension);
|
|
1630
|
+
}
|
|
1631
|
+
};
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
// src/commands/sessions/web/browser/createPendingReplies.ts
|
|
1635
|
+
import { randomUUID } from "crypto";
|
|
1636
|
+
function createPendingReplies() {
|
|
1637
|
+
const pending = /* @__PURE__ */ new Map();
|
|
1638
|
+
function take(id) {
|
|
1639
|
+
const entry = pending.get(id);
|
|
1640
|
+
if (!entry) return void 0;
|
|
1641
|
+
pending.delete(id);
|
|
1642
|
+
clearTimeout(entry.timer);
|
|
1643
|
+
return entry;
|
|
1644
|
+
}
|
|
1645
|
+
return {
|
|
1646
|
+
send(ws, timeoutMs, write) {
|
|
1647
|
+
const id = randomUUID();
|
|
1648
|
+
return new Promise((resolve31, reject) => {
|
|
1649
|
+
const timer = setTimeout(() => {
|
|
1650
|
+
pending.delete(id);
|
|
1651
|
+
reject(
|
|
1652
|
+
relayError(
|
|
1653
|
+
`the assist extension did not reply within ${timeoutMs / 1e3}s`,
|
|
1654
|
+
504
|
|
1655
|
+
)
|
|
1656
|
+
);
|
|
1657
|
+
}, timeoutMs);
|
|
1658
|
+
pending.set(id, { ws, timer, resolve: resolve31, reject });
|
|
1659
|
+
write(id);
|
|
1660
|
+
});
|
|
1661
|
+
},
|
|
1662
|
+
settle(id, reply2) {
|
|
1663
|
+
take(id)?.resolve(reply2);
|
|
1664
|
+
},
|
|
1665
|
+
dropSocket(ws) {
|
|
1666
|
+
for (const [id, entry] of pending) {
|
|
1667
|
+
if (entry.ws !== ws) continue;
|
|
1668
|
+
take(id)?.reject(
|
|
1669
|
+
relayError("the assist extension disconnected before replying", 502)
|
|
1670
|
+
);
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
};
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
// src/commands/sessions/web/browser/createBrowserLink.ts
|
|
1677
|
+
function parseLinkMessage(raw) {
|
|
1678
|
+
try {
|
|
1679
|
+
return JSON.parse(String(raw));
|
|
1680
|
+
} catch {
|
|
1681
|
+
return void 0;
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
function createBrowserLink(options2 = {}) {
|
|
1685
|
+
const state = createLinkState(options2);
|
|
1686
|
+
const replies = createPendingReplies();
|
|
1687
|
+
function onMessage(ws, raw) {
|
|
1688
|
+
const message3 = parseLinkMessage(raw);
|
|
1689
|
+
if (message3?.type === "hello") state.open(ws, message3.version);
|
|
1690
|
+
else if (message3?.type === "response") {
|
|
1691
|
+
const { type: _type, id, ...reply2 } = message3;
|
|
1692
|
+
replies.settle(id, reply2);
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
return {
|
|
1696
|
+
attach(ws) {
|
|
1697
|
+
ws.on("message", (data) => onMessage(ws, data));
|
|
1698
|
+
ws.on("close", () => {
|
|
1699
|
+
state.close(ws);
|
|
1700
|
+
replies.dropSocket(ws);
|
|
1701
|
+
});
|
|
1702
|
+
},
|
|
1703
|
+
async request(request, timeoutMs) {
|
|
1704
|
+
const current = await state.connected();
|
|
1705
|
+
const reply2 = await replies.send(
|
|
1706
|
+
current.ws,
|
|
1707
|
+
timeoutMs,
|
|
1708
|
+
(id) => current.ws.send(JSON.stringify({ ...request, type: "request", id }))
|
|
1709
|
+
);
|
|
1710
|
+
return { ...reply2, version: current.version };
|
|
1711
|
+
}
|
|
1712
|
+
};
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
// src/commands/sessions/web/browser/browserLink.ts
|
|
1716
|
+
var browserLink = createBrowserLink();
|
|
1717
|
+
|
|
1718
|
+
// src/commands/sessions/web/fromGithub/isExtensionOrigin.ts
|
|
1719
|
+
var EXTENSION_ORIGIN = /^(moz|chrome)-extension:\/\/[^/]+$/;
|
|
1720
|
+
function isExtensionOrigin(origin) {
|
|
1721
|
+
return !!origin && EXTENSION_ORIGIN.test(origin);
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1573
1724
|
// src/commands/sessions/web/handleSocket.ts
|
|
1574
1725
|
import { createInterface } from "readline";
|
|
1575
1726
|
|
|
@@ -1719,6 +1870,8 @@ function attachSessionSocket(server, ctx) {
|
|
|
1719
1870
|
wss.handleUpgrade(req, socket, head, (ws) => {
|
|
1720
1871
|
handleSocket(ws, ctx);
|
|
1721
1872
|
});
|
|
1873
|
+
} else if (req.url === BROWSER_LINK_PATH && isExtensionOrigin(req.headers.origin)) {
|
|
1874
|
+
wss.handleUpgrade(req, socket, head, (ws) => browserLink.attach(ws));
|
|
1722
1875
|
} else {
|
|
1723
1876
|
socket.destroy();
|
|
1724
1877
|
}
|
|
@@ -4483,6 +4636,43 @@ async function handleItemRoute(req, res, pathname) {
|
|
|
4483
4636
|
return false;
|
|
4484
4637
|
}
|
|
4485
4638
|
|
|
4639
|
+
// src/commands/sessions/web/readJsonBody.ts
|
|
4640
|
+
async function readJsonBody(req) {
|
|
4641
|
+
const chunks = [];
|
|
4642
|
+
for await (const chunk of req) chunks.push(chunk);
|
|
4643
|
+
return JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
4644
|
+
}
|
|
4645
|
+
|
|
4646
|
+
// src/commands/sessions/web/browser/browserRelay.ts
|
|
4647
|
+
var RELAY_TIMEOUT_MS = 1e4;
|
|
4648
|
+
function parseBrowserRequest(body) {
|
|
4649
|
+
const { op, url } = body ?? {};
|
|
4650
|
+
if (op !== "status") return void 0;
|
|
4651
|
+
if (url !== void 0 && typeof url !== "string") return void 0;
|
|
4652
|
+
return { op, url };
|
|
4653
|
+
}
|
|
4654
|
+
async function browserRelay(req, res) {
|
|
4655
|
+
if (req.headers.origin) {
|
|
4656
|
+
respondJson(res, 403, { error: "browser relay is CLI-only" });
|
|
4657
|
+
return;
|
|
4658
|
+
}
|
|
4659
|
+
const request = parseBrowserRequest(
|
|
4660
|
+
await readJsonBody(req).catch(() => void 0)
|
|
4661
|
+
);
|
|
4662
|
+
if (!request) {
|
|
4663
|
+
respondJson(res, 400, { error: "Invalid browser request" });
|
|
4664
|
+
return;
|
|
4665
|
+
}
|
|
4666
|
+
try {
|
|
4667
|
+
respondJson(res, 200, await browserLink.request(request, RELAY_TIMEOUT_MS));
|
|
4668
|
+
} catch (error) {
|
|
4669
|
+
const status2 = error.status ?? 500;
|
|
4670
|
+
respondJson(res, status2, {
|
|
4671
|
+
error: error instanceof Error ? error.message : String(error)
|
|
4672
|
+
});
|
|
4673
|
+
}
|
|
4674
|
+
}
|
|
4675
|
+
|
|
4486
4676
|
// src/commands/sessions/shared/readLogTail.ts
|
|
4487
4677
|
import { closeSync as closeSync2, fstatSync, openSync as openSync2, readSync } from "fs";
|
|
4488
4678
|
var MAX_TAIL_BYTES = 4 * 1024 * 1024;
|
|
@@ -4944,23 +5134,15 @@ async function requestDaemonReply(request, replyType, timeoutMs = QUERY_TIMEOUT_
|
|
|
4944
5134
|
}
|
|
4945
5135
|
|
|
4946
5136
|
// src/commands/sessions/web/fromGithub/allowExtensionOrigin.ts
|
|
4947
|
-
var EXTENSION_ORIGIN = /^(moz|chrome)-extension:\/\/[^/]+$/;
|
|
4948
5137
|
function allowExtensionOrigin(req, res) {
|
|
4949
5138
|
const origin = req.headers.origin;
|
|
4950
|
-
if (!origin || !
|
|
5139
|
+
if (!origin || !isExtensionOrigin(origin)) return;
|
|
4951
5140
|
res.setHeader("Access-Control-Allow-Origin", origin);
|
|
4952
5141
|
res.setHeader("Access-Control-Allow-Methods", "POST");
|
|
4953
5142
|
res.setHeader("Access-Control-Allow-Headers", "Content-Type");
|
|
4954
5143
|
res.setHeader("Vary", "Origin");
|
|
4955
5144
|
}
|
|
4956
5145
|
|
|
4957
|
-
// src/commands/sessions/web/readJsonBody.ts
|
|
4958
|
-
async function readJsonBody(req) {
|
|
4959
|
-
const chunks = [];
|
|
4960
|
-
for await (const chunk of req) chunks.push(chunk);
|
|
4961
|
-
return JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
4962
|
-
}
|
|
4963
|
-
|
|
4964
5146
|
// src/commands/sessions/web/docsFeedback/docsFeedbackPrompt.ts
|
|
4965
5147
|
function docsFeedbackPrompt({
|
|
4966
5148
|
pageId,
|
|
@@ -8952,10 +9134,10 @@ function findLinkSpec(name) {
|
|
|
8952
9134
|
}
|
|
8953
9135
|
|
|
8954
9136
|
// src/commands/sessions/shared/newTraceId.ts
|
|
8955
|
-
import { randomUUID } from "crypto";
|
|
9137
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
8956
9138
|
var TRACE_HEADER = "x-assist-trace-id";
|
|
8957
9139
|
function newTraceId() {
|
|
8958
|
-
return
|
|
9140
|
+
return randomUUID2().slice(0, 8);
|
|
8959
9141
|
}
|
|
8960
9142
|
|
|
8961
9143
|
// src/commands/sessions/web/forwardToPeer.ts
|
|
@@ -11611,6 +11793,7 @@ var routes2 = {
|
|
|
11611
11793
|
"OPTIONS /api/sessions/review-from-github": sessionFromGithubPreflight,
|
|
11612
11794
|
"POST /api/sessions/docs-feedback": docsFeedback,
|
|
11613
11795
|
"OPTIONS /api/sessions/docs-feedback": sessionFromGithubPreflight,
|
|
11796
|
+
"POST /api/browser": browserRelay,
|
|
11614
11797
|
"POST /api/open-in-code": openInCode,
|
|
11615
11798
|
"POST /api/pr-preview/upload-image": uploadPrImage,
|
|
11616
11799
|
"GET /api/pr-preview/image": previewImage,
|
|
@@ -14045,7 +14228,7 @@ function internalCommand(command, calledBy4) {
|
|
|
14045
14228
|
}
|
|
14046
14229
|
|
|
14047
14230
|
// src/commands/ask.ts
|
|
14048
|
-
import { randomUUID as
|
|
14231
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
14049
14232
|
|
|
14050
14233
|
// src/commands/backlog/import/readStdinBuffer.ts
|
|
14051
14234
|
async function readStdinBuffer() {
|
|
@@ -14266,7 +14449,7 @@ async function ask(options2) {
|
|
|
14266
14449
|
options2.title,
|
|
14267
14450
|
{
|
|
14268
14451
|
sessionId,
|
|
14269
|
-
requestId:
|
|
14452
|
+
requestId: randomUUID3(),
|
|
14270
14453
|
title: options2.title,
|
|
14271
14454
|
body,
|
|
14272
14455
|
prNumber: null,
|
|
@@ -15731,7 +15914,7 @@ async function resolveInsertPosition(orm, itemId2, position) {
|
|
|
15731
15914
|
}
|
|
15732
15915
|
|
|
15733
15916
|
// src/commands/backlog/addPhase/reviewProposedPhase.ts
|
|
15734
|
-
import { randomUUID as
|
|
15917
|
+
import { randomUUID as randomUUID4 } from "crypto";
|
|
15735
15918
|
|
|
15736
15919
|
// src/commands/backlog/renderPhaseSection.ts
|
|
15737
15920
|
function renderPhaseSection(phase, idx) {
|
|
@@ -15755,7 +15938,7 @@ async function reviewProposedPhase(item, phaseIdx, phase) {
|
|
|
15755
15938
|
return;
|
|
15756
15939
|
await awaitPreviewApproval("Backlog phase preview", {
|
|
15757
15940
|
sessionId,
|
|
15758
|
-
requestId:
|
|
15941
|
+
requestId: randomUUID4(),
|
|
15759
15942
|
title: `Add a phase to ${formatItemId(item.id)}: ${item.name}`,
|
|
15760
15943
|
body: renderPhaseSection(phase, phaseIdx),
|
|
15761
15944
|
prNumber: null,
|
|
@@ -15957,7 +16140,7 @@ function readProposedItem(source) {
|
|
|
15957
16140
|
}
|
|
15958
16141
|
|
|
15959
16142
|
// src/commands/backlog/propose/reviewProposal.ts
|
|
15960
|
-
import { randomUUID as
|
|
16143
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
15961
16144
|
import chalk60 from "chalk";
|
|
15962
16145
|
|
|
15963
16146
|
// src/shared/renderMarkdownTerminal.ts
|
|
@@ -15999,7 +16182,7 @@ async function reviewProposal(item, sessionId, confirmed) {
|
|
|
15999
16182
|
if (sessionId) {
|
|
16000
16183
|
const decision = await awaitPreviewApproval("Backlog item preview", {
|
|
16001
16184
|
sessionId,
|
|
16002
|
-
requestId:
|
|
16185
|
+
requestId: randomUUID5(),
|
|
16003
16186
|
title: item.name,
|
|
16004
16187
|
body,
|
|
16005
16188
|
prNumber: null,
|
|
@@ -17355,7 +17538,7 @@ Phase ${phaseNumber} completed.`));
|
|
|
17355
17538
|
}
|
|
17356
17539
|
|
|
17357
17540
|
// src/commands/backlog/preparePhaseSession.ts
|
|
17358
|
-
import { randomUUID as
|
|
17541
|
+
import { randomUUID as randomUUID6 } from "crypto";
|
|
17359
17542
|
|
|
17360
17543
|
// src/commands/backlog/persistPhaseSession.ts
|
|
17361
17544
|
import os4 from "os";
|
|
@@ -17526,7 +17709,7 @@ async function verifyPhaseResume(itemId2, resumeSessionId, phaseLabel2) {
|
|
|
17526
17709
|
// src/commands/backlog/preparePhaseSession.ts
|
|
17527
17710
|
async function preparePhaseSession(item, phase, phaseIndex, phaseNumber, totalPhases, phaseLabel2, spawnOptions) {
|
|
17528
17711
|
const resumeSessionId = spawnOptions?.resumeSessionId;
|
|
17529
|
-
const claudeSessionId = resumeSessionId ??
|
|
17712
|
+
const claudeSessionId = resumeSessionId ?? randomUUID6();
|
|
17530
17713
|
if (resumeSessionId && !await verifyPhaseResume(item.id, resumeSessionId, phaseLabel2)) {
|
|
17531
17714
|
return void 0;
|
|
17532
17715
|
}
|
|
@@ -17880,7 +18063,7 @@ import chalk83 from "chalk";
|
|
|
17880
18063
|
import enquirer7 from "enquirer";
|
|
17881
18064
|
|
|
17882
18065
|
// src/commands/backlog/launchMode.ts
|
|
17883
|
-
import { randomUUID as
|
|
18066
|
+
import { randomUUID as randomUUID7 } from "crypto";
|
|
17884
18067
|
|
|
17885
18068
|
// src/commands/backlog/handleLaunchSignal.ts
|
|
17886
18069
|
import chalk82 from "chalk";
|
|
@@ -17985,7 +18168,7 @@ async function launchMode(slashCommand, options2) {
|
|
|
17985
18168
|
const resumeSessionId = options2?.resumeSessionId;
|
|
17986
18169
|
if (!resumeSessionId) pullIfConfigured();
|
|
17987
18170
|
process.env.ASSIST_SESSION_ID ??= String(process.pid);
|
|
17988
|
-
const claudeSessionId = resumeSessionId ??
|
|
18171
|
+
const claudeSessionId = resumeSessionId ?? randomUUID7();
|
|
17989
18172
|
const harness = options2?.harness ?? "claude";
|
|
17990
18173
|
reportLaunchActivity(slashCommand, claudeSessionId, harness, options2);
|
|
17991
18174
|
const prompt = resumeSessionId ? resumeNudge() : buildSlashCommand(slashCommand, options2?.description);
|
|
@@ -18824,7 +19007,7 @@ async function replacePlan(orm, itemId2, phases, currentPhase) {
|
|
|
18824
19007
|
}
|
|
18825
19008
|
|
|
18826
19009
|
// src/commands/backlog/updatePlan/reviewPlanUpdate.ts
|
|
18827
|
-
import { randomUUID as
|
|
19010
|
+
import { randomUUID as randomUUID8 } from "crypto";
|
|
18828
19011
|
import chalk103 from "chalk";
|
|
18829
19012
|
|
|
18830
19013
|
// src/commands/backlog/updatePlan/isCompleted.ts
|
|
@@ -18981,7 +19164,7 @@ async function reviewPlanUpdate(item, phases) {
|
|
|
18981
19164
|
if (process.env.ASSIST_SESSION === "1" && sessionId) {
|
|
18982
19165
|
const decision = await awaitPreviewApproval("Plan update preview", {
|
|
18983
19166
|
sessionId,
|
|
18984
|
-
requestId:
|
|
19167
|
+
requestId: randomUUID8(),
|
|
18985
19168
|
title: `Update the plan for ${formatItemId(item.id)}: ${item.name}`,
|
|
18986
19169
|
body,
|
|
18987
19170
|
prNumber: null,
|
|
@@ -22693,9 +22876,81 @@ function registerConfig(program) {
|
|
|
22693
22876
|
).action((filter) => configKeys(filter));
|
|
22694
22877
|
}
|
|
22695
22878
|
|
|
22879
|
+
// src/commands/browser/browserStatus.ts
|
|
22880
|
+
import chalk138 from "chalk";
|
|
22881
|
+
|
|
22882
|
+
// src/commands/browser/requestBrowser.ts
|
|
22883
|
+
var CLI_TIMEOUT_MS = 5e4;
|
|
22884
|
+
async function requestBrowser(server, request) {
|
|
22885
|
+
let response;
|
|
22886
|
+
try {
|
|
22887
|
+
response = await fetch(`${server}/api/browser`, {
|
|
22888
|
+
method: "POST",
|
|
22889
|
+
headers: { "Content-Type": "application/json" },
|
|
22890
|
+
body: JSON.stringify(request),
|
|
22891
|
+
signal: AbortSignal.timeout(CLI_TIMEOUT_MS)
|
|
22892
|
+
});
|
|
22893
|
+
} catch (error) {
|
|
22894
|
+
if (error instanceof Error && error.name === "TimeoutError")
|
|
22895
|
+
throw new Error(`the assist web server at ${server} did not answer`);
|
|
22896
|
+
throw new Error(
|
|
22897
|
+
`assist web server unreachable at ${server}; start it with \`assist sessions web\``
|
|
22898
|
+
);
|
|
22899
|
+
}
|
|
22900
|
+
const data = await response.json().catch(() => ({}));
|
|
22901
|
+
if (!response.ok)
|
|
22902
|
+
throw new Error(
|
|
22903
|
+
`${"error" in data && data.error ? data.error : `assist web server returned ${response.status}`} (${server})`
|
|
22904
|
+
);
|
|
22905
|
+
return data;
|
|
22906
|
+
}
|
|
22907
|
+
|
|
22908
|
+
// src/commands/browser/browserStatus.ts
|
|
22909
|
+
async function browserStatus(options2) {
|
|
22910
|
+
const reply2 = await requestBrowser(options2.server, {
|
|
22911
|
+
op: "status",
|
|
22912
|
+
url: options2.url
|
|
22913
|
+
}).catch((error) => {
|
|
22914
|
+
console.error(chalk138.red(`Error: ${error.message}`));
|
|
22915
|
+
process.exit(1);
|
|
22916
|
+
});
|
|
22917
|
+
console.log(`extension: connected (v${reply2.version})`);
|
|
22918
|
+
if (!reply2.ok) {
|
|
22919
|
+
if (reply2.tabUrl) console.log(`tab: ${reply2.tabUrl}`);
|
|
22920
|
+
console.error(chalk138.red(`Error: ${reply2.error}`));
|
|
22921
|
+
process.exit(1);
|
|
22922
|
+
}
|
|
22923
|
+
console.log(`tab: ${reply2.result.tabUrl}`);
|
|
22924
|
+
console.log(
|
|
22925
|
+
`content script: ${reply2.result.contentScript ? "running" : "not running (reload the tab, or update the extension)"}`
|
|
22926
|
+
);
|
|
22927
|
+
}
|
|
22928
|
+
|
|
22929
|
+
// src/commands/registerBrowser.ts
|
|
22930
|
+
function withTargetOptions(command) {
|
|
22931
|
+
return command.option(
|
|
22932
|
+
"--url <substring>",
|
|
22933
|
+
"Target the most recently active tab whose URL contains this, instead of the focused window's active tab"
|
|
22934
|
+
).option(
|
|
22935
|
+
"--server <url>",
|
|
22936
|
+
"assist web server the extension connects to",
|
|
22937
|
+
"http://localhost:3100"
|
|
22938
|
+
);
|
|
22939
|
+
}
|
|
22940
|
+
function registerBrowser(program) {
|
|
22941
|
+
const browser = program.command("browser").description(
|
|
22942
|
+
"Probe the live browser tab through the assist extension, relayed by the assist web server"
|
|
22943
|
+
);
|
|
22944
|
+
withTargetOptions(
|
|
22945
|
+
browser.command("status").description(
|
|
22946
|
+
"Print the connected extension's version, the target tab's URL and whether the assist content script runs there"
|
|
22947
|
+
)
|
|
22948
|
+
).action(browserStatus);
|
|
22949
|
+
}
|
|
22950
|
+
|
|
22696
22951
|
// src/commands/extension/extension.ts
|
|
22697
22952
|
import { cp } from "fs/promises";
|
|
22698
|
-
import
|
|
22953
|
+
import chalk139 from "chalk";
|
|
22699
22954
|
|
|
22700
22955
|
// src/commands/extension/extensionDir.ts
|
|
22701
22956
|
import { existsSync as existsSync49 } from "fs";
|
|
@@ -22718,21 +22973,21 @@ async function loadPath(source) {
|
|
|
22718
22973
|
return WSL_WINDOWS_PATH;
|
|
22719
22974
|
} catch {
|
|
22720
22975
|
console.log(
|
|
22721
|
-
|
|
22976
|
+
chalk139.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
22722
22977
|
);
|
|
22723
22978
|
return source;
|
|
22724
22979
|
}
|
|
22725
22980
|
}
|
|
22726
22981
|
async function extension() {
|
|
22727
22982
|
const path108 = await loadPath(extensionDir());
|
|
22728
|
-
console.log(
|
|
22729
|
-
console.log(
|
|
22983
|
+
console.log(chalk139.bold("assist \u2014 GitHub browser extension"));
|
|
22984
|
+
console.log(chalk139.dim(`load the unpacked extension from ${path108}`));
|
|
22730
22985
|
}
|
|
22731
22986
|
|
|
22732
22987
|
// src/commands/extension/printExtensionUrl.ts
|
|
22733
22988
|
import { readFile as readFile4 } from "fs/promises";
|
|
22734
22989
|
import { join as join55 } from "path";
|
|
22735
|
-
import
|
|
22990
|
+
import chalk140 from "chalk";
|
|
22736
22991
|
|
|
22737
22992
|
// src/commands/extension/latestUpdate.ts
|
|
22738
22993
|
function latestUpdate(manifest, updates2) {
|
|
@@ -22755,7 +23010,7 @@ async function printExtensionUrl() {
|
|
|
22755
23010
|
const response = await fetch(update_url);
|
|
22756
23011
|
const link3 = response.ok ? latestUpdateLink(manifest, await response.text()) : void 0;
|
|
22757
23012
|
if (!link3) {
|
|
22758
|
-
console.log(
|
|
23013
|
+
console.log(chalk140.red(`no signed build found in ${update_url}`));
|
|
22759
23014
|
process.exitCode = 1;
|
|
22760
23015
|
return;
|
|
22761
23016
|
}
|
|
@@ -22766,7 +23021,7 @@ async function printExtensionUrl() {
|
|
|
22766
23021
|
import { rm as rm2 } from "fs/promises";
|
|
22767
23022
|
import { homedir as homedir21, tmpdir as tmpdir3 } from "os";
|
|
22768
23023
|
import { join as join61 } from "path";
|
|
22769
|
-
import
|
|
23024
|
+
import chalk142 from "chalk";
|
|
22770
23025
|
|
|
22771
23026
|
// src/commands/extension/copySignedXpi.ts
|
|
22772
23027
|
import { copyFile } from "fs/promises";
|
|
@@ -22791,7 +23046,7 @@ async function findSignedXpi(dir) {
|
|
|
22791
23046
|
|
|
22792
23047
|
// src/commands/extension/signedAddonInstallPath.ts
|
|
22793
23048
|
import { cp as cp2 } from "fs/promises";
|
|
22794
|
-
import
|
|
23049
|
+
import chalk141 from "chalk";
|
|
22795
23050
|
var WSL_WINDOWS_XPI = "/mnt/c/tools/assist-extension.xpi";
|
|
22796
23051
|
var WSL_WINDOWS_PATH2 = String.raw`C:\tools\assist-extension.xpi`;
|
|
22797
23052
|
async function signedAddonInstallPath(xpi) {
|
|
@@ -22801,7 +23056,7 @@ async function signedAddonInstallPath(xpi) {
|
|
|
22801
23056
|
return WSL_WINDOWS_PATH2;
|
|
22802
23057
|
} catch {
|
|
22803
23058
|
console.log(
|
|
22804
|
-
|
|
23059
|
+
chalk141.yellow(`could not copy the add-on to ${WSL_WINDOWS_PATH2}`)
|
|
22805
23060
|
);
|
|
22806
23061
|
return xpi;
|
|
22807
23062
|
}
|
|
@@ -22894,15 +23149,15 @@ async function signExtension() {
|
|
|
22894
23149
|
const source = extensionDir();
|
|
22895
23150
|
const problem = signPreflightProblem(source);
|
|
22896
23151
|
if (problem) {
|
|
22897
|
-
console.log(
|
|
22898
|
-
console.log(
|
|
23152
|
+
console.log(chalk142.red(problem.message));
|
|
23153
|
+
console.log(chalk142.dim(problem.hint));
|
|
22899
23154
|
process.exitCode = 1;
|
|
22900
23155
|
return;
|
|
22901
23156
|
}
|
|
22902
23157
|
const { version: version2 } = package_default;
|
|
22903
23158
|
await stageExtension(source, STAGING_DIR, version2);
|
|
22904
23159
|
await rm2(ARTIFACTS_DIR, { recursive: true, force: true });
|
|
22905
|
-
console.log(
|
|
23160
|
+
console.log(chalk142.bold(`signing version ${version2} for self-distribution`));
|
|
22906
23161
|
const { done: done2 } = spawnInherit("npx", [
|
|
22907
23162
|
"--yes",
|
|
22908
23163
|
"web-ext",
|
|
@@ -22912,13 +23167,13 @@ async function signExtension() {
|
|
|
22912
23167
|
"--channel=unlisted"
|
|
22913
23168
|
]);
|
|
22914
23169
|
if (await done2 !== 0) {
|
|
22915
|
-
console.log(
|
|
23170
|
+
console.log(chalk142.red("web-ext sign failed"));
|
|
22916
23171
|
process.exitCode = 1;
|
|
22917
23172
|
return;
|
|
22918
23173
|
}
|
|
22919
23174
|
const xpi = await findSignedXpi(ARTIFACTS_DIR);
|
|
22920
23175
|
if (!xpi) {
|
|
22921
|
-
console.log(
|
|
23176
|
+
console.log(chalk142.red(`web-ext wrote no .xpi into ${ARTIFACTS_DIR}`));
|
|
22922
23177
|
process.exitCode = 1;
|
|
22923
23178
|
return;
|
|
22924
23179
|
}
|
|
@@ -22926,7 +23181,7 @@ async function signExtension() {
|
|
|
22926
23181
|
const path108 = await signedAddonInstallPath(
|
|
22927
23182
|
await copySignedXpi(xpi, ARTIFACTS_DIR)
|
|
22928
23183
|
);
|
|
22929
|
-
console.log(
|
|
23184
|
+
console.log(chalk142.dim(`install the signed add-on from ${path108}`));
|
|
22930
23185
|
}
|
|
22931
23186
|
|
|
22932
23187
|
// src/commands/registerExtension.ts
|
|
@@ -22987,11 +23242,11 @@ async function dropRetiredTables(exec3) {
|
|
|
22987
23242
|
}
|
|
22988
23243
|
|
|
22989
23244
|
// src/commands/db/reportRetiredTables.ts
|
|
22990
|
-
import
|
|
23245
|
+
import chalk143 from "chalk";
|
|
22991
23246
|
function reportRetiredTables(tables) {
|
|
22992
23247
|
for (const table of tables) {
|
|
22993
23248
|
console.error(
|
|
22994
|
-
|
|
23249
|
+
chalk143.yellow(
|
|
22995
23250
|
`Retired table ${table.name} still exists (${table.rows} rows). Run \`assist db drop-retired\` to drop it.`
|
|
22996
23251
|
)
|
|
22997
23252
|
);
|
|
@@ -22999,40 +23254,40 @@ function reportRetiredTables(tables) {
|
|
|
22999
23254
|
}
|
|
23000
23255
|
|
|
23001
23256
|
// src/commands/db/reportMigrationStatus.ts
|
|
23002
|
-
import
|
|
23257
|
+
import chalk144 from "chalk";
|
|
23003
23258
|
function reportApplied(applied) {
|
|
23004
23259
|
if (applied.length === 0) {
|
|
23005
|
-
console.error(
|
|
23260
|
+
console.error(chalk144.green("Database is up to date; nothing to apply."));
|
|
23006
23261
|
return;
|
|
23007
23262
|
}
|
|
23008
23263
|
for (const migration of applied) {
|
|
23009
23264
|
console.error(
|
|
23010
|
-
|
|
23265
|
+
chalk144.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
23011
23266
|
);
|
|
23012
23267
|
}
|
|
23013
23268
|
}
|
|
23014
23269
|
function reportMigrationStatus(status2) {
|
|
23015
23270
|
if (status2.state === "in-sync") {
|
|
23016
23271
|
console.error(
|
|
23017
|
-
|
|
23272
|
+
chalk144.green(`In sync at migration ${status2.version} (latest).`)
|
|
23018
23273
|
);
|
|
23019
23274
|
return;
|
|
23020
23275
|
}
|
|
23021
23276
|
if (status2.state === "behind") {
|
|
23022
23277
|
console.error(
|
|
23023
|
-
|
|
23278
|
+
chalk144.yellow(
|
|
23024
23279
|
`Behind: applied ${status2.applied}, build expects ${status2.expected}.`
|
|
23025
23280
|
)
|
|
23026
23281
|
);
|
|
23027
23282
|
console.error(
|
|
23028
|
-
|
|
23283
|
+
chalk144.yellow(
|
|
23029
23284
|
`Pending: ${status2.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
23030
23285
|
)
|
|
23031
23286
|
);
|
|
23032
23287
|
return;
|
|
23033
23288
|
}
|
|
23034
23289
|
console.error(
|
|
23035
|
-
|
|
23290
|
+
chalk144.red(
|
|
23036
23291
|
`Ahead: applied ${status2.applied}, build knows ${status2.expected}. Update assist.`
|
|
23037
23292
|
)
|
|
23038
23293
|
);
|
|
@@ -23074,7 +23329,7 @@ function registerDb(program) {
|
|
|
23074
23329
|
|
|
23075
23330
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
23076
23331
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync27 } from "fs";
|
|
23077
|
-
import
|
|
23332
|
+
import chalk145 from "chalk";
|
|
23078
23333
|
|
|
23079
23334
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
23080
23335
|
import { join as join62 } from "path";
|
|
@@ -23105,7 +23360,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
23105
23360
|
sweepRestrictedDir();
|
|
23106
23361
|
const state = readMigrationPinState(pin2);
|
|
23107
23362
|
if (!state) {
|
|
23108
|
-
console.error(
|
|
23363
|
+
console.error(chalk145.red(`No pending migration unlock for pin: ${pin2}`));
|
|
23109
23364
|
process.exitCode = 1;
|
|
23110
23365
|
return;
|
|
23111
23366
|
}
|
|
@@ -23115,7 +23370,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
23115
23370
|
);
|
|
23116
23371
|
unlinkSync9(getMigrationPinPath(pin2));
|
|
23117
23372
|
console.log(
|
|
23118
|
-
|
|
23373
|
+
chalk145.green(
|
|
23119
23374
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
23120
23375
|
)
|
|
23121
23376
|
);
|
|
@@ -23124,7 +23379,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
23124
23379
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
23125
23380
|
import { mkdirSync as mkdirSync17, writeFileSync as writeFileSync28 } from "fs";
|
|
23126
23381
|
import { randomInt as randomInt2 } from "crypto";
|
|
23127
|
-
import
|
|
23382
|
+
import chalk146 from "chalk";
|
|
23128
23383
|
|
|
23129
23384
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
23130
23385
|
function nextMigrationId() {
|
|
@@ -23139,7 +23394,7 @@ function dbMigrationUnlock() {
|
|
|
23139
23394
|
sweepRestrictedDir();
|
|
23140
23395
|
writeFileSync28(getMigrationPinPath(pin2), JSON.stringify({ pin: pin2, migrationId }));
|
|
23141
23396
|
console.error(
|
|
23142
|
-
|
|
23397
|
+
chalk146.yellow.bold(
|
|
23143
23398
|
"THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a new database migration.\nA schema change is hard to reverse once shipped. You had BETTER have confirmed\nthe change with the user and be certain this migration is genuinely necessary."
|
|
23144
23399
|
)
|
|
23145
23400
|
);
|
|
@@ -23149,7 +23404,7 @@ function dbMigrationUnlock() {
|
|
|
23149
23404
|
});
|
|
23150
23405
|
if (!delivered) {
|
|
23151
23406
|
console.error(
|
|
23152
|
-
|
|
23407
|
+
chalk146.red(
|
|
23153
23408
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
23154
23409
|
)
|
|
23155
23410
|
);
|
|
@@ -23159,7 +23414,7 @@ function dbMigrationUnlock() {
|
|
|
23159
23414
|
console.log(
|
|
23160
23415
|
`A confirmation pin was sent to your desktop notifications.
|
|
23161
23416
|
To approve creating migration ${migrationId}, run:
|
|
23162
|
-
${
|
|
23417
|
+
${chalk146.cyan(" assist db-migration confirm <PIN>")}
|
|
23163
23418
|
using the pin from that notification.`
|
|
23164
23419
|
);
|
|
23165
23420
|
}
|
|
@@ -23186,7 +23441,7 @@ function registerDbMigration(parent) {
|
|
|
23186
23441
|
|
|
23187
23442
|
// src/commands/deploy/redirect.ts
|
|
23188
23443
|
import { existsSync as existsSync53, readFileSync as readFileSync34, writeFileSync as writeFileSync29 } from "fs";
|
|
23189
|
-
import
|
|
23444
|
+
import chalk147 from "chalk";
|
|
23190
23445
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
23191
23446
|
if (!window.location.pathname.endsWith('/')) {
|
|
23192
23447
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -23195,23 +23450,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
23195
23450
|
function redirect() {
|
|
23196
23451
|
const indexPath = "index.html";
|
|
23197
23452
|
if (!existsSync53(indexPath)) {
|
|
23198
|
-
console.log(
|
|
23453
|
+
console.log(chalk147.yellow("No index.html found"));
|
|
23199
23454
|
return;
|
|
23200
23455
|
}
|
|
23201
23456
|
const content = readFileSync34(indexPath, "utf8");
|
|
23202
23457
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
23203
|
-
console.log(
|
|
23458
|
+
console.log(chalk147.dim("Trailing slash script already present"));
|
|
23204
23459
|
return;
|
|
23205
23460
|
}
|
|
23206
23461
|
const headCloseIndex = content.indexOf("</head>");
|
|
23207
23462
|
if (headCloseIndex === -1) {
|
|
23208
|
-
console.log(
|
|
23463
|
+
console.log(chalk147.red("Could not find </head> tag in index.html"));
|
|
23209
23464
|
return;
|
|
23210
23465
|
}
|
|
23211
23466
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
23212
23467
|
${content.slice(headCloseIndex)}`;
|
|
23213
23468
|
writeFileSync29(indexPath, newContent);
|
|
23214
|
-
console.log(
|
|
23469
|
+
console.log(chalk147.green("Added trailing slash redirect to index.html"));
|
|
23215
23470
|
}
|
|
23216
23471
|
|
|
23217
23472
|
// src/commands/registerDeploy.ts
|
|
@@ -23238,7 +23493,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
23238
23493
|
|
|
23239
23494
|
// src/commands/devlog/shared.ts
|
|
23240
23495
|
import { execSync as execSync31 } from "child_process";
|
|
23241
|
-
import
|
|
23496
|
+
import chalk148 from "chalk";
|
|
23242
23497
|
|
|
23243
23498
|
// src/shared/getRepoName.ts
|
|
23244
23499
|
import { existsSync as existsSync54, readFileSync as readFileSync35 } from "fs";
|
|
@@ -23347,13 +23602,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
23347
23602
|
}
|
|
23348
23603
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
23349
23604
|
for (const commit2 of commits2) {
|
|
23350
|
-
console.log(` ${
|
|
23605
|
+
console.log(` ${chalk148.yellow(commit2.hash)} ${commit2.message}`);
|
|
23351
23606
|
if (verbose) {
|
|
23352
23607
|
const visibleFiles = commit2.files.filter(
|
|
23353
23608
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
23354
23609
|
);
|
|
23355
23610
|
for (const file of visibleFiles) {
|
|
23356
|
-
console.log(` ${
|
|
23611
|
+
console.log(` ${chalk148.dim(file)}`);
|
|
23357
23612
|
}
|
|
23358
23613
|
}
|
|
23359
23614
|
}
|
|
@@ -23378,15 +23633,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
23378
23633
|
}
|
|
23379
23634
|
|
|
23380
23635
|
// src/commands/devlog/list/printDateHeader.ts
|
|
23381
|
-
import
|
|
23636
|
+
import chalk149 from "chalk";
|
|
23382
23637
|
function printDateHeader(date, isSkipped, entries) {
|
|
23383
23638
|
if (isSkipped) {
|
|
23384
|
-
console.log(`${
|
|
23639
|
+
console.log(`${chalk149.bold.blue(date)} ${chalk149.dim("skipped")}`);
|
|
23385
23640
|
} else if (entries && entries.length > 0) {
|
|
23386
|
-
const entryInfo = entries.map((e) => `${
|
|
23387
|
-
console.log(`${
|
|
23641
|
+
const entryInfo = entries.map((e) => `${chalk149.green(e.version)} ${e.title}`).join(" | ");
|
|
23642
|
+
console.log(`${chalk149.bold.blue(date)} ${entryInfo}`);
|
|
23388
23643
|
} else {
|
|
23389
|
-
console.log(`${
|
|
23644
|
+
console.log(`${chalk149.bold.blue(date)} ${chalk149.red("\u26A0 devlog missing")}`);
|
|
23390
23645
|
}
|
|
23391
23646
|
}
|
|
23392
23647
|
|
|
@@ -23490,24 +23745,24 @@ function bumpVersion(version2, type) {
|
|
|
23490
23745
|
|
|
23491
23746
|
// src/commands/devlog/next/displayNextEntry.ts
|
|
23492
23747
|
import { execFileSync as execFileSync9 } from "child_process";
|
|
23493
|
-
import
|
|
23748
|
+
import chalk151 from "chalk";
|
|
23494
23749
|
|
|
23495
23750
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
23496
|
-
import
|
|
23751
|
+
import chalk150 from "chalk";
|
|
23497
23752
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
23498
23753
|
if (conventional && firstHash) {
|
|
23499
23754
|
const version2 = getVersionAtCommit(firstHash);
|
|
23500
23755
|
if (version2) {
|
|
23501
|
-
console.log(`${
|
|
23756
|
+
console.log(`${chalk150.bold("version:")} ${stripToMinor(version2)}`);
|
|
23502
23757
|
} else {
|
|
23503
|
-
console.log(`${
|
|
23758
|
+
console.log(`${chalk150.bold("version:")} ${chalk150.red("unknown")}`);
|
|
23504
23759
|
}
|
|
23505
23760
|
} else if (patchVersion && minorVersion) {
|
|
23506
23761
|
console.log(
|
|
23507
|
-
`${
|
|
23762
|
+
`${chalk150.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
23508
23763
|
);
|
|
23509
23764
|
} else {
|
|
23510
|
-
console.log(`${
|
|
23765
|
+
console.log(`${chalk150.bold("version:")} v0.1 (initial)`);
|
|
23511
23766
|
}
|
|
23512
23767
|
}
|
|
23513
23768
|
|
|
@@ -23555,16 +23810,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
23555
23810
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
23556
23811
|
}
|
|
23557
23812
|
function logName(repoName) {
|
|
23558
|
-
console.log(`${
|
|
23813
|
+
console.log(`${chalk151.bold("name:")} ${repoName}`);
|
|
23559
23814
|
}
|
|
23560
23815
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
23561
23816
|
logName(ctx.repoName);
|
|
23562
23817
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
23563
|
-
console.log(
|
|
23818
|
+
console.log(chalk151.bold.blue(targetDate));
|
|
23564
23819
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
23565
23820
|
}
|
|
23566
23821
|
function logNoCommits(lastInfo) {
|
|
23567
|
-
console.log(
|
|
23822
|
+
console.log(chalk151.dim(noCommitsMessage(!!lastInfo)));
|
|
23568
23823
|
}
|
|
23569
23824
|
|
|
23570
23825
|
// src/commands/devlog/next.ts
|
|
@@ -23605,11 +23860,11 @@ function next2(options2) {
|
|
|
23605
23860
|
import { execSync as execSync33 } from "child_process";
|
|
23606
23861
|
|
|
23607
23862
|
// src/commands/devlog/repos/printReposTable.ts
|
|
23608
|
-
import
|
|
23863
|
+
import chalk152 from "chalk";
|
|
23609
23864
|
function colorStatus(status2) {
|
|
23610
|
-
if (status2 === "missing") return
|
|
23611
|
-
if (status2 === "outdated") return
|
|
23612
|
-
return
|
|
23865
|
+
if (status2 === "missing") return chalk152.red(status2);
|
|
23866
|
+
if (status2 === "outdated") return chalk152.yellow(status2);
|
|
23867
|
+
return chalk152.green(status2);
|
|
23613
23868
|
}
|
|
23614
23869
|
function formatRow(row3, nameWidth) {
|
|
23615
23870
|
const devlog = (row3.lastDevlog ?? "-").padEnd(11);
|
|
@@ -23623,8 +23878,8 @@ function printReposTable(rows) {
|
|
|
23623
23878
|
"Last Devlog".padEnd(11),
|
|
23624
23879
|
"Status"
|
|
23625
23880
|
].join(" ");
|
|
23626
|
-
console.log(
|
|
23627
|
-
console.log(
|
|
23881
|
+
console.log(chalk152.dim(header));
|
|
23882
|
+
console.log(chalk152.dim("-".repeat(header.length)));
|
|
23628
23883
|
for (const row3 of rows) {
|
|
23629
23884
|
console.log(formatRow(row3, nameWidth));
|
|
23630
23885
|
}
|
|
@@ -23682,14 +23937,14 @@ function repos(options2) {
|
|
|
23682
23937
|
// src/commands/devlog/skip.ts
|
|
23683
23938
|
import { writeFileSync as writeFileSync30 } from "fs";
|
|
23684
23939
|
import { join as join66 } from "path";
|
|
23685
|
-
import
|
|
23940
|
+
import chalk153 from "chalk";
|
|
23686
23941
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
23687
23942
|
function getBlogConfigPath() {
|
|
23688
23943
|
return join66(BLOG_REPO_ROOT, "assist.yml");
|
|
23689
23944
|
}
|
|
23690
23945
|
function skip2(date) {
|
|
23691
23946
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
23692
|
-
console.log(
|
|
23947
|
+
console.log(chalk153.red("Invalid date format. Use YYYY-MM-DD"));
|
|
23693
23948
|
process.exit(1);
|
|
23694
23949
|
}
|
|
23695
23950
|
const repoName = getRepoName();
|
|
@@ -23700,7 +23955,7 @@ function skip2(date) {
|
|
|
23700
23955
|
const skipDays = skip3[repoName] ?? [];
|
|
23701
23956
|
if (skipDays.includes(date)) {
|
|
23702
23957
|
console.log(
|
|
23703
|
-
|
|
23958
|
+
chalk153.yellow(`${date} is already in skip list for ${repoName}`)
|
|
23704
23959
|
);
|
|
23705
23960
|
return;
|
|
23706
23961
|
}
|
|
@@ -23710,20 +23965,20 @@ function skip2(date) {
|
|
|
23710
23965
|
devlog.skip = skip3;
|
|
23711
23966
|
config.devlog = devlog;
|
|
23712
23967
|
writeFileSync30(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
23713
|
-
console.log(
|
|
23968
|
+
console.log(chalk153.green(`Added ${date} to skip list for ${repoName}`));
|
|
23714
23969
|
}
|
|
23715
23970
|
|
|
23716
23971
|
// src/commands/devlog/version.ts
|
|
23717
|
-
import
|
|
23972
|
+
import chalk154 from "chalk";
|
|
23718
23973
|
function version() {
|
|
23719
23974
|
const config = loadConfig();
|
|
23720
23975
|
const name = getRepoName();
|
|
23721
23976
|
const lastInfo = getLastVersionInfo(name, config);
|
|
23722
23977
|
const lastVersion = lastInfo?.version ?? null;
|
|
23723
23978
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
23724
|
-
console.log(`${
|
|
23725
|
-
console.log(`${
|
|
23726
|
-
console.log(`${
|
|
23979
|
+
console.log(`${chalk154.bold("name:")} ${name}`);
|
|
23980
|
+
console.log(`${chalk154.bold("last:")} ${lastVersion ?? chalk154.dim("none")}`);
|
|
23981
|
+
console.log(`${chalk154.bold("next:")} ${nextVersion ?? chalk154.dim("none")}`);
|
|
23727
23982
|
}
|
|
23728
23983
|
|
|
23729
23984
|
// src/commands/registerDevlog.ts
|
|
@@ -23748,7 +24003,7 @@ function registerDevlog(program) {
|
|
|
23748
24003
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
23749
24004
|
import { closeSync as closeSync4, openSync as openSync5, readdirSync as readdirSync9 } from "fs";
|
|
23750
24005
|
import { join as join67 } from "path";
|
|
23751
|
-
import
|
|
24006
|
+
import chalk155 from "chalk";
|
|
23752
24007
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
23753
24008
|
function isLockedDll(debugDir) {
|
|
23754
24009
|
let files;
|
|
@@ -23795,14 +24050,14 @@ function checkBuildLocks(startDir) {
|
|
|
23795
24050
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
23796
24051
|
if (locked) {
|
|
23797
24052
|
console.error(
|
|
23798
|
-
|
|
24053
|
+
chalk155.red("Build output locked (is VS debugging?): ") + locked
|
|
23799
24054
|
);
|
|
23800
24055
|
process.exit(1);
|
|
23801
24056
|
}
|
|
23802
24057
|
}
|
|
23803
24058
|
async function checkBuildLocksCommand() {
|
|
23804
24059
|
checkBuildLocks();
|
|
23805
|
-
console.log(
|
|
24060
|
+
console.log(chalk155.green("No build locks detected"));
|
|
23806
24061
|
}
|
|
23807
24062
|
|
|
23808
24063
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -23901,30 +24156,30 @@ function escapeRegex(s) {
|
|
|
23901
24156
|
}
|
|
23902
24157
|
|
|
23903
24158
|
// src/commands/dotnet/printTree.ts
|
|
23904
|
-
import
|
|
24159
|
+
import chalk156 from "chalk";
|
|
23905
24160
|
function printNodes(nodes, prefix2) {
|
|
23906
24161
|
for (let i = 0; i < nodes.length; i++) {
|
|
23907
24162
|
const isLast = i === nodes.length - 1;
|
|
23908
24163
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
23909
24164
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
23910
24165
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
23911
|
-
const label2 = isMissing ?
|
|
24166
|
+
const label2 = isMissing ? chalk156.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
23912
24167
|
console.log(`${prefix2}${connector}${label2}`);
|
|
23913
24168
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
23914
24169
|
}
|
|
23915
24170
|
}
|
|
23916
24171
|
function printTree(tree, totalCount, solutions) {
|
|
23917
|
-
console.log(
|
|
23918
|
-
console.log(
|
|
24172
|
+
console.log(chalk156.bold("\nProject Dependency Tree"));
|
|
24173
|
+
console.log(chalk156.cyan(tree.relativePath));
|
|
23919
24174
|
printNodes(tree.children, "");
|
|
23920
|
-
console.log(
|
|
24175
|
+
console.log(chalk156.dim(`
|
|
23921
24176
|
${totalCount} projects total (including root)`));
|
|
23922
|
-
console.log(
|
|
24177
|
+
console.log(chalk156.bold("\nSolution Membership"));
|
|
23923
24178
|
if (solutions.length === 0) {
|
|
23924
|
-
console.log(
|
|
24179
|
+
console.log(chalk156.yellow(" Not found in any .sln"));
|
|
23925
24180
|
} else {
|
|
23926
24181
|
for (const sln of solutions) {
|
|
23927
|
-
console.log(` ${
|
|
24182
|
+
console.log(` ${chalk156.green(sln)}`);
|
|
23928
24183
|
}
|
|
23929
24184
|
}
|
|
23930
24185
|
console.log();
|
|
@@ -23953,16 +24208,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
23953
24208
|
// src/commands/dotnet/resolveCsproj.ts
|
|
23954
24209
|
import { existsSync as existsSync55 } from "fs";
|
|
23955
24210
|
import path37 from "path";
|
|
23956
|
-
import
|
|
24211
|
+
import chalk157 from "chalk";
|
|
23957
24212
|
function resolveCsproj(csprojPath) {
|
|
23958
24213
|
const resolved = path37.resolve(csprojPath);
|
|
23959
24214
|
if (!existsSync55(resolved)) {
|
|
23960
|
-
console.error(
|
|
24215
|
+
console.error(chalk157.red(`File not found: ${resolved}`));
|
|
23961
24216
|
process.exit(1);
|
|
23962
24217
|
}
|
|
23963
24218
|
const repoRoot2 = findRepoRoot(path37.dirname(resolved));
|
|
23964
24219
|
if (!repoRoot2) {
|
|
23965
|
-
console.error(
|
|
24220
|
+
console.error(chalk157.red("Could not find git repository root"));
|
|
23966
24221
|
process.exit(1);
|
|
23967
24222
|
}
|
|
23968
24223
|
return { resolved, repoRoot: repoRoot2 };
|
|
@@ -24012,12 +24267,12 @@ function getChangedCsFiles(scope) {
|
|
|
24012
24267
|
}
|
|
24013
24268
|
|
|
24014
24269
|
// src/commands/dotnet/inSln.ts
|
|
24015
|
-
import
|
|
24270
|
+
import chalk158 from "chalk";
|
|
24016
24271
|
async function inSln(csprojPath) {
|
|
24017
24272
|
const { resolved, repoRoot: repoRoot2 } = resolveCsproj(csprojPath);
|
|
24018
24273
|
const solutions = findContainingSolutions(resolved, repoRoot2);
|
|
24019
24274
|
if (solutions.length === 0) {
|
|
24020
|
-
console.log(
|
|
24275
|
+
console.log(chalk158.yellow("Not found in any .sln file"));
|
|
24021
24276
|
process.exit(1);
|
|
24022
24277
|
}
|
|
24023
24278
|
for (const sln of solutions) {
|
|
@@ -24026,7 +24281,7 @@ async function inSln(csprojPath) {
|
|
|
24026
24281
|
}
|
|
24027
24282
|
|
|
24028
24283
|
// src/commands/dotnet/inspect.ts
|
|
24029
|
-
import
|
|
24284
|
+
import chalk164 from "chalk";
|
|
24030
24285
|
|
|
24031
24286
|
// src/shared/formatElapsed.ts
|
|
24032
24287
|
function formatElapsed(ms) {
|
|
@@ -24038,12 +24293,12 @@ function formatElapsed(ms) {
|
|
|
24038
24293
|
}
|
|
24039
24294
|
|
|
24040
24295
|
// src/commands/dotnet/displayIssues.ts
|
|
24041
|
-
import
|
|
24296
|
+
import chalk159 from "chalk";
|
|
24042
24297
|
var SEVERITY_COLOR = {
|
|
24043
|
-
ERROR:
|
|
24044
|
-
WARNING:
|
|
24045
|
-
SUGGESTION:
|
|
24046
|
-
HINT:
|
|
24298
|
+
ERROR: chalk159.red,
|
|
24299
|
+
WARNING: chalk159.yellow,
|
|
24300
|
+
SUGGESTION: chalk159.cyan,
|
|
24301
|
+
HINT: chalk159.dim
|
|
24047
24302
|
};
|
|
24048
24303
|
function groupByFile(issues) {
|
|
24049
24304
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -24059,15 +24314,15 @@ function groupByFile(issues) {
|
|
|
24059
24314
|
}
|
|
24060
24315
|
function displayIssues(issues) {
|
|
24061
24316
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
24062
|
-
console.log(
|
|
24317
|
+
console.log(chalk159.bold(file));
|
|
24063
24318
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
24064
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
24319
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk159.white;
|
|
24065
24320
|
console.log(
|
|
24066
|
-
` ${
|
|
24321
|
+
` ${chalk159.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
24067
24322
|
);
|
|
24068
24323
|
}
|
|
24069
24324
|
}
|
|
24070
|
-
console.log(
|
|
24325
|
+
console.log(chalk159.dim(`
|
|
24071
24326
|
${issues.length} issue(s) found`));
|
|
24072
24327
|
}
|
|
24073
24328
|
|
|
@@ -24126,12 +24381,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
24126
24381
|
// src/commands/dotnet/resolveSolution.ts
|
|
24127
24382
|
import { existsSync as existsSync56 } from "fs";
|
|
24128
24383
|
import path38 from "path";
|
|
24129
|
-
import
|
|
24384
|
+
import chalk161 from "chalk";
|
|
24130
24385
|
|
|
24131
24386
|
// src/commands/dotnet/findSolution.ts
|
|
24132
24387
|
import { readdirSync as readdirSync11 } from "fs";
|
|
24133
24388
|
import { dirname as dirname29, join as join68 } from "path";
|
|
24134
|
-
import
|
|
24389
|
+
import chalk160 from "chalk";
|
|
24135
24390
|
function findSlnInDir(dir) {
|
|
24136
24391
|
try {
|
|
24137
24392
|
return readdirSync11(dir).filter((f) => f.endsWith(".sln")).map((f) => join68(dir, f));
|
|
@@ -24147,17 +24402,17 @@ function findSolution() {
|
|
|
24147
24402
|
const slnFiles = findSlnInDir(current);
|
|
24148
24403
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
24149
24404
|
if (slnFiles.length > 1) {
|
|
24150
|
-
console.error(
|
|
24405
|
+
console.error(chalk160.red(`Multiple .sln files found in ${current}:`));
|
|
24151
24406
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
24152
24407
|
console.error(
|
|
24153
|
-
|
|
24408
|
+
chalk160.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
24154
24409
|
);
|
|
24155
24410
|
process.exit(1);
|
|
24156
24411
|
}
|
|
24157
24412
|
if (current === ceiling) break;
|
|
24158
24413
|
current = dirname29(current);
|
|
24159
24414
|
}
|
|
24160
|
-
console.error(
|
|
24415
|
+
console.error(chalk160.red("No .sln file found between cwd and repo root"));
|
|
24161
24416
|
process.exit(1);
|
|
24162
24417
|
}
|
|
24163
24418
|
|
|
@@ -24166,7 +24421,7 @@ function resolveSolution(sln) {
|
|
|
24166
24421
|
if (sln) {
|
|
24167
24422
|
const resolved = path38.resolve(sln);
|
|
24168
24423
|
if (!existsSync56(resolved)) {
|
|
24169
|
-
console.error(
|
|
24424
|
+
console.error(chalk161.red(`Solution file not found: ${resolved}`));
|
|
24170
24425
|
process.exit(1);
|
|
24171
24426
|
}
|
|
24172
24427
|
return resolved;
|
|
@@ -24208,14 +24463,14 @@ import { execSync as execSync35 } from "child_process";
|
|
|
24208
24463
|
import { existsSync as existsSync57, readFileSync as readFileSync39, unlinkSync as unlinkSync10 } from "fs";
|
|
24209
24464
|
import { tmpdir as tmpdir4 } from "os";
|
|
24210
24465
|
import path39 from "path";
|
|
24211
|
-
import
|
|
24466
|
+
import chalk162 from "chalk";
|
|
24212
24467
|
function assertJbInstalled() {
|
|
24213
24468
|
try {
|
|
24214
24469
|
execSync35("jb inspectcode --version", { stdio: "pipe" });
|
|
24215
24470
|
} catch {
|
|
24216
|
-
console.error(
|
|
24471
|
+
console.error(chalk162.red("jb is not installed. Install with:"));
|
|
24217
24472
|
console.error(
|
|
24218
|
-
|
|
24473
|
+
chalk162.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
24219
24474
|
);
|
|
24220
24475
|
process.exit(1);
|
|
24221
24476
|
}
|
|
@@ -24233,11 +24488,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
24233
24488
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
24234
24489
|
process.stderr.write(error.stderr);
|
|
24235
24490
|
}
|
|
24236
|
-
console.error(
|
|
24491
|
+
console.error(chalk162.red("jb inspectcode failed"));
|
|
24237
24492
|
process.exit(1);
|
|
24238
24493
|
}
|
|
24239
24494
|
if (!existsSync57(reportPath)) {
|
|
24240
|
-
console.error(
|
|
24495
|
+
console.error(chalk162.red("Report file not generated"));
|
|
24241
24496
|
process.exit(1);
|
|
24242
24497
|
}
|
|
24243
24498
|
const xml = readFileSync39(reportPath, "utf8");
|
|
@@ -24247,7 +24502,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
24247
24502
|
|
|
24248
24503
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
24249
24504
|
import { execSync as execSync36 } from "child_process";
|
|
24250
|
-
import
|
|
24505
|
+
import chalk163 from "chalk";
|
|
24251
24506
|
function resolveMsbuildPath() {
|
|
24252
24507
|
const { run: run4 } = loadConfig();
|
|
24253
24508
|
const configs = resolveRunConfigs(run4, runConfigBaseDir());
|
|
@@ -24259,9 +24514,9 @@ function assertMsbuildInstalled() {
|
|
|
24259
24514
|
try {
|
|
24260
24515
|
execSync36(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
24261
24516
|
} catch {
|
|
24262
|
-
console.error(
|
|
24517
|
+
console.error(chalk163.red(`msbuild not found at: ${msbuild}`));
|
|
24263
24518
|
console.error(
|
|
24264
|
-
|
|
24519
|
+
chalk163.yellow(
|
|
24265
24520
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
24266
24521
|
)
|
|
24267
24522
|
);
|
|
@@ -24308,17 +24563,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
24308
24563
|
// src/commands/dotnet/inspect.ts
|
|
24309
24564
|
function logScope(changedFiles2) {
|
|
24310
24565
|
if (changedFiles2 === null) {
|
|
24311
|
-
console.log(
|
|
24566
|
+
console.log(chalk164.dim("Inspecting full solution..."));
|
|
24312
24567
|
} else {
|
|
24313
24568
|
console.log(
|
|
24314
|
-
|
|
24569
|
+
chalk164.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
24315
24570
|
);
|
|
24316
24571
|
}
|
|
24317
24572
|
}
|
|
24318
24573
|
function reportResults(issues, elapsed) {
|
|
24319
24574
|
if (issues.length > 0) displayIssues(issues);
|
|
24320
|
-
else console.log(
|
|
24321
|
-
console.log(
|
|
24575
|
+
else console.log(chalk164.green("No issues found"));
|
|
24576
|
+
console.log(chalk164.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
24322
24577
|
if (issues.length > 0) process.exit(1);
|
|
24323
24578
|
}
|
|
24324
24579
|
async function inspect(sln, options2) {
|
|
@@ -24329,7 +24584,7 @@ async function inspect(sln, options2) {
|
|
|
24329
24584
|
const scope = parseScope(options2.scope);
|
|
24330
24585
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
24331
24586
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
24332
|
-
console.log(
|
|
24587
|
+
console.log(chalk164.green("No changed .cs files found"));
|
|
24333
24588
|
return;
|
|
24334
24589
|
}
|
|
24335
24590
|
logScope(changedFiles2);
|
|
@@ -25207,25 +25462,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
25207
25462
|
}
|
|
25208
25463
|
|
|
25209
25464
|
// src/commands/github/printCountTable.ts
|
|
25210
|
-
import
|
|
25465
|
+
import chalk165 from "chalk";
|
|
25211
25466
|
function printCountTable(labelHeader, rows) {
|
|
25212
25467
|
const labelWidth = Math.max(
|
|
25213
25468
|
labelHeader.length,
|
|
25214
25469
|
...rows.map((row3) => row3.label.length)
|
|
25215
25470
|
);
|
|
25216
25471
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
25217
|
-
console.log(
|
|
25218
|
-
console.log(
|
|
25472
|
+
console.log(chalk165.dim(header));
|
|
25473
|
+
console.log(chalk165.dim("-".repeat(header.length)));
|
|
25219
25474
|
for (const row3 of rows) {
|
|
25220
25475
|
console.log(`${row3.label.padEnd(labelWidth)} ${row3.count}`);
|
|
25221
25476
|
}
|
|
25222
25477
|
}
|
|
25223
25478
|
|
|
25224
25479
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
25225
|
-
import
|
|
25480
|
+
import chalk166 from "chalk";
|
|
25226
25481
|
function printRepoAuthorBreakdown(repos2) {
|
|
25227
25482
|
for (const repo of repos2) {
|
|
25228
|
-
console.log(
|
|
25483
|
+
console.log(chalk166.bold(repo.name));
|
|
25229
25484
|
const authorWidth = Math.max(
|
|
25230
25485
|
0,
|
|
25231
25486
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -25308,10 +25563,10 @@ function parseTopCount(value) {
|
|
|
25308
25563
|
}
|
|
25309
25564
|
|
|
25310
25565
|
// src/commands/github/issue/fixStructure/applyAndVerifySubtree.ts
|
|
25311
|
-
import
|
|
25566
|
+
import chalk168 from "chalk";
|
|
25312
25567
|
|
|
25313
25568
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
25314
|
-
import
|
|
25569
|
+
import chalk167 from "chalk";
|
|
25315
25570
|
|
|
25316
25571
|
// src/commands/github/issue/fixStructure/removeIssueLabels.ts
|
|
25317
25572
|
var MUTATION2 = `mutation($labelableId: ID!, $labelIds: [ID!]!) {
|
|
@@ -25348,7 +25603,7 @@ function writeLineNow(line) {
|
|
|
25348
25603
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
25349
25604
|
function applyFixStructurePlan(plan2) {
|
|
25350
25605
|
for (const entry of plan2.entries) {
|
|
25351
|
-
const where =
|
|
25606
|
+
const where = chalk167.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
25352
25607
|
const { typeChange, labelRemovals } = entry;
|
|
25353
25608
|
if (typeChange) {
|
|
25354
25609
|
writeLineNow(
|
|
@@ -25618,12 +25873,12 @@ function planSubtree(root2, context) {
|
|
|
25618
25873
|
function applyAndVerifySubtree(target, plan2, context) {
|
|
25619
25874
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) return;
|
|
25620
25875
|
applyFixStructurePlan(plan2);
|
|
25621
|
-
writeLineNow(
|
|
25876
|
+
writeLineNow(chalk168.dim("Re-walking the subtree to confirm"));
|
|
25622
25877
|
assertNoResidualDrift(
|
|
25623
25878
|
planSubtree(fetchRootIssue(target), context),
|
|
25624
25879
|
context.chain
|
|
25625
25880
|
);
|
|
25626
|
-
writeLineNow(
|
|
25881
|
+
writeLineNow(chalk168.green("Subtree normalised"));
|
|
25627
25882
|
}
|
|
25628
25883
|
|
|
25629
25884
|
// src/commands/github/issue/fixStructure/assertChainTypesExist.ts
|
|
@@ -25659,22 +25914,22 @@ function parseTypeChain(value) {
|
|
|
25659
25914
|
}
|
|
25660
25915
|
|
|
25661
25916
|
// src/commands/github/issue/fixStructure/printFixStructurePlan.ts
|
|
25662
|
-
import
|
|
25917
|
+
import chalk169 from "chalk";
|
|
25663
25918
|
function annotate(entry) {
|
|
25664
25919
|
const notes = [];
|
|
25665
25920
|
if (entry.level === null) {
|
|
25666
|
-
notes.push(
|
|
25921
|
+
notes.push(chalk169.red("deeper than the leaf level"));
|
|
25667
25922
|
} else if (entry.typeChange) {
|
|
25668
25923
|
notes.push(
|
|
25669
|
-
|
|
25924
|
+
chalk169.yellow(
|
|
25670
25925
|
`${entry.typeChange.from ?? "no type"} -> ${entry.typeChange.to}`
|
|
25671
25926
|
)
|
|
25672
25927
|
);
|
|
25673
25928
|
} else {
|
|
25674
|
-
notes.push(
|
|
25929
|
+
notes.push(chalk169.dim(entry.issue.typeName ?? "no type"));
|
|
25675
25930
|
}
|
|
25676
25931
|
for (const label2 of entry.labelRemovals) {
|
|
25677
|
-
notes.push(
|
|
25932
|
+
notes.push(chalk169.yellow(`-${label2.name}`));
|
|
25678
25933
|
}
|
|
25679
25934
|
return notes;
|
|
25680
25935
|
}
|
|
@@ -25682,22 +25937,22 @@ function formatCount(count10, noun) {
|
|
|
25682
25937
|
return `${count10} ${noun}${count10 === 1 ? "" : "s"}`;
|
|
25683
25938
|
}
|
|
25684
25939
|
function printFixStructurePlan(plan2, chain2, apply) {
|
|
25685
|
-
writeLineNow(
|
|
25940
|
+
writeLineNow(chalk169.dim(`chain: ${chain2.join(" > ")}`));
|
|
25686
25941
|
for (const entry of plan2.entries) {
|
|
25687
25942
|
const indent3 = " ".repeat(entry.issue.depth);
|
|
25688
|
-
const name =
|
|
25943
|
+
const name = chalk169.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
25689
25944
|
writeLineNow(
|
|
25690
25945
|
`${indent3}${name} ${entry.issue.title} [${annotate(entry).join(", ")}]`
|
|
25691
25946
|
);
|
|
25692
25947
|
}
|
|
25693
25948
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) {
|
|
25694
|
-
writeLineNow(
|
|
25949
|
+
writeLineNow(chalk169.green("Nothing to change"));
|
|
25695
25950
|
return;
|
|
25696
25951
|
}
|
|
25697
25952
|
writeLineNow(
|
|
25698
25953
|
`${formatCount(plan2.typeChangeCount, "type change")}, ${formatCount(plan2.labelRemovalCount, "label removal")} planned`
|
|
25699
25954
|
);
|
|
25700
|
-
if (!apply) writeLineNow(
|
|
25955
|
+
if (!apply) writeLineNow(chalk169.dim("Dry run \u2014 nothing written"));
|
|
25701
25956
|
}
|
|
25702
25957
|
|
|
25703
25958
|
// src/commands/github/issue/parseRepoSlug.ts
|
|
@@ -25883,13 +26138,13 @@ function validateProposedContent(labels, title, body) {
|
|
|
25883
26138
|
}
|
|
25884
26139
|
|
|
25885
26140
|
// src/commands/github/issue/reviewProposedIssueComment.ts
|
|
25886
|
-
import { randomUUID as
|
|
26141
|
+
import { randomUUID as randomUUID9 } from "crypto";
|
|
25887
26142
|
async function reviewProposedIssueComment(title, body) {
|
|
25888
26143
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
25889
26144
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
25890
26145
|
await awaitPreviewApproval("GitHub issue comment preview", {
|
|
25891
26146
|
sessionId,
|
|
25892
|
-
requestId:
|
|
26147
|
+
requestId: randomUUID9(),
|
|
25893
26148
|
title,
|
|
25894
26149
|
body,
|
|
25895
26150
|
prNumber: null,
|
|
@@ -26407,13 +26662,13 @@ function resolveCreateIssueMetadata(options2) {
|
|
|
26407
26662
|
}
|
|
26408
26663
|
|
|
26409
26664
|
// src/commands/github/issue/reviewProposedIssue.ts
|
|
26410
|
-
import { randomUUID as
|
|
26665
|
+
import { randomUUID as randomUUID10 } from "crypto";
|
|
26411
26666
|
async function reviewProposedIssue(title, body, metadata2 = []) {
|
|
26412
26667
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
26413
26668
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return void 0;
|
|
26414
26669
|
return await awaitPreviewApproval("GitHub issue preview", {
|
|
26415
26670
|
sessionId,
|
|
26416
|
-
requestId:
|
|
26671
|
+
requestId: randomUUID10(),
|
|
26417
26672
|
title,
|
|
26418
26673
|
body,
|
|
26419
26674
|
prNumber: null,
|
|
@@ -26718,7 +26973,7 @@ function pushUnchangedIssue(number, repo, target, fetchedAt, bodyPath) {
|
|
|
26718
26973
|
}
|
|
26719
26974
|
|
|
26720
26975
|
// src/commands/github/issue/reviewProposedIssueEdit.ts
|
|
26721
|
-
import { randomUUID as
|
|
26976
|
+
import { randomUUID as randomUUID11 } from "crypto";
|
|
26722
26977
|
async function reviewProposedIssueEdit(title, body, working) {
|
|
26723
26978
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
26724
26979
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return body;
|
|
@@ -26726,7 +26981,7 @@ async function reviewProposedIssueEdit(title, body, working) {
|
|
|
26726
26981
|
"GitHub issue edit preview",
|
|
26727
26982
|
{
|
|
26728
26983
|
sessionId,
|
|
26729
|
-
requestId:
|
|
26984
|
+
requestId: randomUUID11(),
|
|
26730
26985
|
title,
|
|
26731
26986
|
body,
|
|
26732
26987
|
prNumber: null,
|
|
@@ -27059,7 +27314,7 @@ function registerGithub(program) {
|
|
|
27059
27314
|
}
|
|
27060
27315
|
|
|
27061
27316
|
// src/commands/jira/acceptanceCriteria.ts
|
|
27062
|
-
import
|
|
27317
|
+
import chalk170 from "chalk";
|
|
27063
27318
|
|
|
27064
27319
|
// src/commands/jira/adfToText.ts
|
|
27065
27320
|
function renderInline(node) {
|
|
@@ -27126,7 +27381,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
27126
27381
|
const parsed = fetchIssue(issueKey, field);
|
|
27127
27382
|
const acValue = parsed?.fields?.[field];
|
|
27128
27383
|
if (!acValue) {
|
|
27129
|
-
console.log(
|
|
27384
|
+
console.log(chalk170.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
27130
27385
|
return;
|
|
27131
27386
|
}
|
|
27132
27387
|
if (typeof acValue === "string") {
|
|
@@ -27192,14 +27447,14 @@ async function jiraAuth() {
|
|
|
27192
27447
|
}
|
|
27193
27448
|
|
|
27194
27449
|
// src/commands/jira/viewIssue.ts
|
|
27195
|
-
import
|
|
27450
|
+
import chalk171 from "chalk";
|
|
27196
27451
|
function viewIssue2(issueKey) {
|
|
27197
27452
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
27198
27453
|
const fields = parsed?.fields;
|
|
27199
27454
|
const summary = fields?.summary;
|
|
27200
27455
|
const description = fields?.description;
|
|
27201
27456
|
if (summary) {
|
|
27202
|
-
console.log(
|
|
27457
|
+
console.log(chalk171.bold(summary));
|
|
27203
27458
|
}
|
|
27204
27459
|
if (description) {
|
|
27205
27460
|
if (summary) console.log();
|
|
@@ -27213,7 +27468,7 @@ function viewIssue2(issueKey) {
|
|
|
27213
27468
|
}
|
|
27214
27469
|
if (!summary && !description) {
|
|
27215
27470
|
console.log(
|
|
27216
|
-
|
|
27471
|
+
chalk171.yellow(`No summary or description found on ${issueKey}.`)
|
|
27217
27472
|
);
|
|
27218
27473
|
}
|
|
27219
27474
|
}
|
|
@@ -27244,7 +27499,7 @@ function registerRefineLaunch(program, resumeFlag) {
|
|
|
27244
27499
|
}
|
|
27245
27500
|
|
|
27246
27501
|
// src/commands/fixConflict.ts
|
|
27247
|
-
import { randomUUID as
|
|
27502
|
+
import { randomUUID as randomUUID12 } from "crypto";
|
|
27248
27503
|
|
|
27249
27504
|
// src/commands/review/checkoutPr.ts
|
|
27250
27505
|
import { execFileSync as execFileSync19 } from "child_process";
|
|
@@ -27925,7 +28180,7 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
27925
28180
|
}
|
|
27926
28181
|
|
|
27927
28182
|
// src/commands/review/failCheckout.ts
|
|
27928
|
-
import
|
|
28183
|
+
import chalk172 from "chalk";
|
|
27929
28184
|
|
|
27930
28185
|
// src/commands/review/azCliProblem.ts
|
|
27931
28186
|
import { execFileSync as execFileSync18 } from "child_process";
|
|
@@ -27978,14 +28233,14 @@ function failCheckout(number, headRef, stale, from, checkout) {
|
|
|
27978
28233
|
gitSyncOrNull(process.cwd(), ["checkout", "--quiet", from]);
|
|
27979
28234
|
if (headRef && stale === "local-work")
|
|
27980
28235
|
console.error(
|
|
27981
|
-
|
|
28236
|
+
chalk172.red(
|
|
27982
28237
|
`Local branch ${headRef} has commits that are not on the remote and cannot fast-forward to PR #${number}'s head; push or reset ${headRef}, then retry.`
|
|
27983
28238
|
)
|
|
27984
28239
|
);
|
|
27985
28240
|
const problem = checkout.file === "az" ? azCliProblem() : null;
|
|
27986
|
-
if (problem) console.error(
|
|
28241
|
+
if (problem) console.error(chalk172.red(problem));
|
|
27987
28242
|
console.error(
|
|
27988
|
-
|
|
28243
|
+
chalk172.red(`${checkout.file} ${checkout.args.join(" ")} failed; aborting.`)
|
|
27989
28244
|
);
|
|
27990
28245
|
process.exit(1);
|
|
27991
28246
|
}
|
|
@@ -28034,7 +28289,7 @@ function buildPrompt2(rebase) {
|
|
|
28034
28289
|
async function fixConflict(number, options2 = {}) {
|
|
28035
28290
|
const { resumeSessionId } = options2;
|
|
28036
28291
|
if (number && !resumeSessionId) await checkoutPr(number);
|
|
28037
|
-
const claudeSessionId = resumeSessionId ??
|
|
28292
|
+
const claudeSessionId = resumeSessionId ?? randomUUID12();
|
|
28038
28293
|
emitActivity({
|
|
28039
28294
|
kind: "command",
|
|
28040
28295
|
name: "fix-conflict",
|
|
@@ -28062,7 +28317,7 @@ function registerFixConflict(program, resumeFlag) {
|
|
|
28062
28317
|
}
|
|
28063
28318
|
|
|
28064
28319
|
// src/commands/reviewPrComments.ts
|
|
28065
|
-
import { randomUUID as
|
|
28320
|
+
import { randomUUID as randomUUID13 } from "crypto";
|
|
28066
28321
|
function buildPrompt3(number, announce, options2) {
|
|
28067
28322
|
const args = [
|
|
28068
28323
|
"/review-pr-comments",
|
|
@@ -28088,7 +28343,7 @@ async function reviewPrComments(number, options2 = {}) {
|
|
|
28088
28343
|
validateAnnounce(number, announce);
|
|
28089
28344
|
validateMode(options2);
|
|
28090
28345
|
if (number && !resumeSessionId) await checkoutPr(number);
|
|
28091
|
-
const claudeSessionId = resumeSessionId ??
|
|
28346
|
+
const claudeSessionId = resumeSessionId ?? randomUUID13();
|
|
28092
28347
|
emitActivity({
|
|
28093
28348
|
kind: "command",
|
|
28094
28349
|
name: "review-pr-comments",
|
|
@@ -28178,18 +28433,18 @@ function registerList(program) {
|
|
|
28178
28433
|
}
|
|
28179
28434
|
|
|
28180
28435
|
// src/commands/litellm/listModels.ts
|
|
28181
|
-
import
|
|
28436
|
+
import chalk174 from "chalk";
|
|
28182
28437
|
|
|
28183
28438
|
// src/commands/litellm/resolveLitellmConfig.ts
|
|
28184
|
-
import
|
|
28439
|
+
import chalk173 from "chalk";
|
|
28185
28440
|
function resolveLitellmConfig() {
|
|
28186
28441
|
const { config, missing } = readLitellmConfig();
|
|
28187
28442
|
if (!config) {
|
|
28188
|
-
console.error(
|
|
28443
|
+
console.error(chalk173.red("LiteLLM is not configured"));
|
|
28189
28444
|
for (const key of missing) {
|
|
28190
28445
|
const entry = litellmConfigHelp.find((help) => help.key === key);
|
|
28191
28446
|
console.error(
|
|
28192
|
-
|
|
28447
|
+
chalk173.red(` ${key} is not set. Set it with: ${entry?.setter}`)
|
|
28193
28448
|
);
|
|
28194
28449
|
}
|
|
28195
28450
|
process.exit(1);
|
|
@@ -28215,13 +28470,13 @@ async function listModels(options2) {
|
|
|
28215
28470
|
} catch (error) {
|
|
28216
28471
|
const reason4 = error instanceof Error ? error.message : String(error);
|
|
28217
28472
|
console.error(
|
|
28218
|
-
|
|
28473
|
+
chalk174.red(`Failed to reach LiteLLM at ${baseUrl}: ${reason4}`)
|
|
28219
28474
|
);
|
|
28220
28475
|
process.exit(1);
|
|
28221
28476
|
}
|
|
28222
28477
|
const body = await response.text();
|
|
28223
28478
|
if (!response.ok) {
|
|
28224
|
-
console.error(
|
|
28479
|
+
console.error(chalk174.red(`LiteLLM returned ${response.status}: ${body}`));
|
|
28225
28480
|
process.exit(1);
|
|
28226
28481
|
}
|
|
28227
28482
|
if (options2.json) {
|
|
@@ -28241,15 +28496,15 @@ function registerLitellm(program) {
|
|
|
28241
28496
|
// src/commands/mermaidExport.ts
|
|
28242
28497
|
import { mkdirSync as mkdirSync20, readdirSync as readdirSync12 } from "fs";
|
|
28243
28498
|
import { resolve as resolve20 } from "path";
|
|
28244
|
-
import
|
|
28499
|
+
import chalk177 from "chalk";
|
|
28245
28500
|
|
|
28246
28501
|
// src/commands/mermaid/exportFile.ts
|
|
28247
28502
|
import { readFileSync as readFileSync41, writeFileSync as writeFileSync33 } from "fs";
|
|
28248
28503
|
import { basename as basename20, extname as extname4, resolve as resolve19 } from "path";
|
|
28249
|
-
import
|
|
28504
|
+
import chalk176 from "chalk";
|
|
28250
28505
|
|
|
28251
28506
|
// src/commands/mermaid/renderBlock.ts
|
|
28252
|
-
import
|
|
28507
|
+
import chalk175 from "chalk";
|
|
28253
28508
|
async function renderBlock(krokiUrl, source) {
|
|
28254
28509
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
28255
28510
|
method: "POST",
|
|
@@ -28258,7 +28513,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
28258
28513
|
});
|
|
28259
28514
|
if (!response.ok) {
|
|
28260
28515
|
console.error(
|
|
28261
|
-
|
|
28516
|
+
chalk175.red(
|
|
28262
28517
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
28263
28518
|
)
|
|
28264
28519
|
);
|
|
@@ -28276,19 +28531,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
28276
28531
|
if (onlyIndex !== void 0) {
|
|
28277
28532
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
28278
28533
|
console.error(
|
|
28279
|
-
|
|
28534
|
+
chalk176.red(
|
|
28280
28535
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
28281
28536
|
)
|
|
28282
28537
|
);
|
|
28283
28538
|
process.exit(1);
|
|
28284
28539
|
}
|
|
28285
28540
|
console.log(
|
|
28286
|
-
|
|
28541
|
+
chalk176.gray(
|
|
28287
28542
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
28288
28543
|
)
|
|
28289
28544
|
);
|
|
28290
28545
|
} else {
|
|
28291
|
-
console.log(
|
|
28546
|
+
console.log(chalk176.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
28292
28547
|
}
|
|
28293
28548
|
for (const [i, source] of blocks.entries()) {
|
|
28294
28549
|
const idx = i + 1;
|
|
@@ -28296,7 +28551,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
28296
28551
|
const outPath = resolve19(outDir, `${stem}-${idx}.svg`);
|
|
28297
28552
|
const svg = await renderBlock(krokiUrl, source);
|
|
28298
28553
|
writeFileSync33(outPath, svg, "utf8");
|
|
28299
|
-
console.log(
|
|
28554
|
+
console.log(chalk176.green(` \u2192 ${outPath}`));
|
|
28300
28555
|
}
|
|
28301
28556
|
}
|
|
28302
28557
|
function extractMermaidBlocks(markdown) {
|
|
@@ -28312,18 +28567,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
28312
28567
|
if (options2.index !== void 0) {
|
|
28313
28568
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
28314
28569
|
console.error(
|
|
28315
|
-
|
|
28570
|
+
chalk177.red(`--index must be a positive integer (got ${options2.index})`)
|
|
28316
28571
|
);
|
|
28317
28572
|
process.exit(1);
|
|
28318
28573
|
}
|
|
28319
28574
|
if (!file) {
|
|
28320
|
-
console.error(
|
|
28575
|
+
console.error(chalk177.red("--index requires a file argument"));
|
|
28321
28576
|
process.exit(1);
|
|
28322
28577
|
}
|
|
28323
28578
|
}
|
|
28324
28579
|
const files = file ? [file] : readdirSync12(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
28325
28580
|
if (files.length === 0) {
|
|
28326
|
-
console.log(
|
|
28581
|
+
console.log(chalk177.gray("No markdown files found in current directory."));
|
|
28327
28582
|
return;
|
|
28328
28583
|
}
|
|
28329
28584
|
for (const f of files) {
|
|
@@ -28469,7 +28724,7 @@ function extractToSave(details, cwd = process.cwd()) {
|
|
|
28469
28724
|
}
|
|
28470
28725
|
|
|
28471
28726
|
// src/commands/miro/keptTexts.ts
|
|
28472
|
-
import
|
|
28727
|
+
import chalk178 from "chalk";
|
|
28473
28728
|
|
|
28474
28729
|
// src/commands/miro/applyIgnore.ts
|
|
28475
28730
|
function applyIgnore(texts, ignore3) {
|
|
@@ -28508,7 +28763,7 @@ function warnUnmatched(file, unmatched) {
|
|
|
28508
28763
|
if (unmatched.length === 0) return;
|
|
28509
28764
|
const entries = unmatched.map((entry) => ` - ${entry}`).join("\n");
|
|
28510
28765
|
console.error(
|
|
28511
|
-
|
|
28766
|
+
chalk178.yellow(
|
|
28512
28767
|
`${unmatched.length} ${unmatched.length === 1 ? "entry" : "entries"} in ${file} matched no box text:
|
|
28513
28768
|
${entries}`
|
|
28514
28769
|
)
|
|
@@ -28630,7 +28885,7 @@ async function offerSaveExtract(extract2, options2, paths = {}) {
|
|
|
28630
28885
|
}
|
|
28631
28886
|
|
|
28632
28887
|
// src/commands/miro/pickAnchors.ts
|
|
28633
|
-
import { randomUUID as
|
|
28888
|
+
import { randomUUID as randomUUID14 } from "crypto";
|
|
28634
28889
|
|
|
28635
28890
|
// src/commands/miro/isBox.ts
|
|
28636
28891
|
var boxTypes = /* @__PURE__ */ new Set(["shape", "sticky_note"]);
|
|
@@ -28651,7 +28906,7 @@ async function pickAnchors(sessionId, items2) {
|
|
|
28651
28906
|
"Miro anchor selection",
|
|
28652
28907
|
{
|
|
28653
28908
|
sessionId,
|
|
28654
|
-
requestId:
|
|
28909
|
+
requestId: randomUUID14(),
|
|
28655
28910
|
title: "Pick the top-left then the bottom-right box",
|
|
28656
28911
|
body: encodeMiroBoardPreview(items2),
|
|
28657
28912
|
prNumber: null,
|
|
@@ -28709,7 +28964,7 @@ function readMiroItems(file) {
|
|
|
28709
28964
|
}
|
|
28710
28965
|
|
|
28711
28966
|
// src/commands/miro/resolveExtractOptions.ts
|
|
28712
|
-
import
|
|
28967
|
+
import chalk179 from "chalk";
|
|
28713
28968
|
|
|
28714
28969
|
// src/commands/miro/extractLayers.ts
|
|
28715
28970
|
function extractsIn(layer) {
|
|
@@ -28787,7 +29042,7 @@ function resolveExtractOptions(name, options2, paths) {
|
|
|
28787
29042
|
paths.cwd,
|
|
28788
29043
|
paths.globalConfigPath
|
|
28789
29044
|
);
|
|
28790
|
-
console.error(
|
|
29045
|
+
console.error(chalk179.dim(`Extract "${name}" from ${resolved.from}`));
|
|
28791
29046
|
return resolved.options;
|
|
28792
29047
|
}
|
|
28793
29048
|
|
|
@@ -28889,7 +29144,7 @@ function registerMiro(program) {
|
|
|
28889
29144
|
import { mkdir as mkdir6 } from "fs/promises";
|
|
28890
29145
|
import { createServer as createServer2 } from "http";
|
|
28891
29146
|
import { dirname as dirname35 } from "path";
|
|
28892
|
-
import
|
|
29147
|
+
import chalk181 from "chalk";
|
|
28893
29148
|
|
|
28894
29149
|
// src/commands/netcap/corsHeaders.ts
|
|
28895
29150
|
var corsHeaders = {
|
|
@@ -28968,7 +29223,7 @@ function createNetcapHandler(options2) {
|
|
|
28968
29223
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
28969
29224
|
import { networkInterfaces } from "os";
|
|
28970
29225
|
import { join as join75 } from "path";
|
|
28971
|
-
import
|
|
29226
|
+
import chalk180 from "chalk";
|
|
28972
29227
|
|
|
28973
29228
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
28974
29229
|
import { dirname as dirname34, join as join74 } from "path";
|
|
@@ -29012,7 +29267,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
29012
29267
|
const host = lanIPv4();
|
|
29013
29268
|
if (!host) {
|
|
29014
29269
|
console.log(
|
|
29015
|
-
|
|
29270
|
+
chalk180.yellow("could not determine the WSL IP for the extension")
|
|
29016
29271
|
);
|
|
29017
29272
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
29018
29273
|
return source;
|
|
@@ -29023,7 +29278,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
29023
29278
|
return WSL_WINDOWS_PATH3;
|
|
29024
29279
|
} catch {
|
|
29025
29280
|
console.log(
|
|
29026
|
-
|
|
29281
|
+
chalk180.yellow(`could not copy extension to ${WSL_WINDOWS_PATH3}`)
|
|
29027
29282
|
);
|
|
29028
29283
|
return source;
|
|
29029
29284
|
}
|
|
@@ -29056,30 +29311,30 @@ async function netcap(options2) {
|
|
|
29056
29311
|
let count10 = 0;
|
|
29057
29312
|
const handler = createNetcapHandler({
|
|
29058
29313
|
outPath,
|
|
29059
|
-
onPing: () => console.log(
|
|
29314
|
+
onPing: () => console.log(chalk181.dim("ping from extension")),
|
|
29060
29315
|
onCapture: (entry) => {
|
|
29061
29316
|
count10 += 1;
|
|
29062
29317
|
console.log(
|
|
29063
|
-
|
|
29064
|
-
|
|
29318
|
+
chalk181.green(`captured #${count10}`),
|
|
29319
|
+
chalk181.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
29065
29320
|
);
|
|
29066
29321
|
}
|
|
29067
29322
|
});
|
|
29068
29323
|
const server = createServer2(handler);
|
|
29069
29324
|
server.listen(port, () => {
|
|
29070
29325
|
console.log(
|
|
29071
|
-
|
|
29326
|
+
chalk181.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
29072
29327
|
);
|
|
29073
|
-
console.log(
|
|
29328
|
+
console.log(chalk181.dim(`appending captures to ${outPath}`));
|
|
29074
29329
|
if (filter)
|
|
29075
|
-
console.log(
|
|
29076
|
-
console.log(
|
|
29077
|
-
console.log(
|
|
29330
|
+
console.log(chalk181.dim(`forwarding only URLs matching "${filter}"`));
|
|
29331
|
+
console.log(chalk181.dim(`load the unpacked extension from ${extensionPath}`));
|
|
29332
|
+
console.log(chalk181.dim("press Ctrl-C to stop"));
|
|
29078
29333
|
});
|
|
29079
29334
|
process.on("SIGINT", () => {
|
|
29080
29335
|
server.close();
|
|
29081
29336
|
console.log(
|
|
29082
|
-
|
|
29337
|
+
chalk181.bold(
|
|
29083
29338
|
`
|
|
29084
29339
|
netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
29085
29340
|
)
|
|
@@ -29091,7 +29346,7 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
29091
29346
|
// src/commands/netcap/netcapExtract.ts
|
|
29092
29347
|
import { writeFileSync as writeFileSync35 } from "fs";
|
|
29093
29348
|
import { join as join78 } from "path";
|
|
29094
|
-
import
|
|
29349
|
+
import chalk182 from "chalk";
|
|
29095
29350
|
|
|
29096
29351
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
29097
29352
|
import { readFileSync as readFileSync44 } from "fs";
|
|
@@ -29539,8 +29794,8 @@ function netcapExtract(file) {
|
|
|
29539
29794
|
writeFileSync35(outFile, `${JSON.stringify(posts, null, 2)}
|
|
29540
29795
|
`);
|
|
29541
29796
|
console.log(
|
|
29542
|
-
|
|
29543
|
-
|
|
29797
|
+
chalk182.green(`extracted ${posts.length} posts`),
|
|
29798
|
+
chalk182.dim(`-> ${outFile}`)
|
|
29544
29799
|
);
|
|
29545
29800
|
}
|
|
29546
29801
|
|
|
@@ -29561,7 +29816,7 @@ function registerNetcap(program) {
|
|
|
29561
29816
|
}
|
|
29562
29817
|
|
|
29563
29818
|
// src/commands/news/add.ts
|
|
29564
|
-
import
|
|
29819
|
+
import chalk183 from "chalk";
|
|
29565
29820
|
import enquirer8 from "enquirer";
|
|
29566
29821
|
async function add2(url) {
|
|
29567
29822
|
if (!url) {
|
|
@@ -29582,25 +29837,25 @@ async function add2(url) {
|
|
|
29582
29837
|
}
|
|
29583
29838
|
const added = await addFeed(await getDb(), url);
|
|
29584
29839
|
if (!added) {
|
|
29585
|
-
console.log(
|
|
29840
|
+
console.log(chalk183.yellow("Feed already exists"));
|
|
29586
29841
|
return;
|
|
29587
29842
|
}
|
|
29588
|
-
console.log(
|
|
29843
|
+
console.log(chalk183.green(`Added feed: ${url}`));
|
|
29589
29844
|
}
|
|
29590
29845
|
|
|
29591
29846
|
// src/commands/news/list.ts
|
|
29592
|
-
import
|
|
29847
|
+
import chalk184 from "chalk";
|
|
29593
29848
|
async function list3() {
|
|
29594
29849
|
const urls = await listFeeds(await getDb());
|
|
29595
29850
|
if (urls.length === 0) {
|
|
29596
|
-
console.log(
|
|
29851
|
+
console.log(chalk184.dim("No feeds; add one with assist news add <url>"));
|
|
29597
29852
|
return;
|
|
29598
29853
|
}
|
|
29599
29854
|
for (const url of urls) console.log(url);
|
|
29600
29855
|
}
|
|
29601
29856
|
|
|
29602
29857
|
// src/commands/news/remove.ts
|
|
29603
|
-
import
|
|
29858
|
+
import chalk185 from "chalk";
|
|
29604
29859
|
|
|
29605
29860
|
// src/commands/backlog/removeFeed.ts
|
|
29606
29861
|
import { eq as eq43 } from "drizzle-orm";
|
|
@@ -29613,10 +29868,10 @@ async function removeFeed(db, url) {
|
|
|
29613
29868
|
async function remove(url) {
|
|
29614
29869
|
const removed = await removeFeed(await getDb(), url);
|
|
29615
29870
|
if (!removed) {
|
|
29616
|
-
console.log(
|
|
29871
|
+
console.log(chalk185.yellow(`No feed matches ${url}`));
|
|
29617
29872
|
return;
|
|
29618
29873
|
}
|
|
29619
|
-
console.log(
|
|
29874
|
+
console.log(chalk185.green(`Removed feed: ${url}`));
|
|
29620
29875
|
}
|
|
29621
29876
|
|
|
29622
29877
|
// src/commands/registerNews.ts
|
|
@@ -29669,7 +29924,7 @@ function registerPiHook(program) {
|
|
|
29669
29924
|
}
|
|
29670
29925
|
|
|
29671
29926
|
// src/commands/prompts/printPromptsTable.ts
|
|
29672
|
-
import
|
|
29927
|
+
import chalk186 from "chalk";
|
|
29673
29928
|
function truncate(str, max) {
|
|
29674
29929
|
if (str.length <= max) return str;
|
|
29675
29930
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -29687,14 +29942,14 @@ function printPromptsTable(rows) {
|
|
|
29687
29942
|
"Command".padEnd(commandWidth),
|
|
29688
29943
|
"Repos"
|
|
29689
29944
|
].join(" ");
|
|
29690
|
-
console.log(
|
|
29691
|
-
console.log(
|
|
29945
|
+
console.log(chalk186.dim(header));
|
|
29946
|
+
console.log(chalk186.dim("-".repeat(header.length)));
|
|
29692
29947
|
for (const row3 of rows) {
|
|
29693
29948
|
const count10 = String(row3.count).padStart(countWidth);
|
|
29694
29949
|
const tool = row3.tool.padEnd(toolWidth);
|
|
29695
29950
|
const command = truncate(row3.command, 60).padEnd(commandWidth);
|
|
29696
29951
|
console.log(
|
|
29697
|
-
`${
|
|
29952
|
+
`${chalk186.yellow(count10)} ${tool} ${command} ${chalk186.dim(row3.repos)}`
|
|
29698
29953
|
);
|
|
29699
29954
|
}
|
|
29700
29955
|
}
|
|
@@ -29732,13 +29987,13 @@ import { execSync as execSync39 } from "child_process";
|
|
|
29732
29987
|
import enquirer9 from "enquirer";
|
|
29733
29988
|
|
|
29734
29989
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
29735
|
-
import
|
|
29990
|
+
import chalk187 from "chalk";
|
|
29736
29991
|
var STATUS_MAP = {
|
|
29737
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
29738
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
29992
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk187.magenta("merged"), date: pr.mergedAt } : null,
|
|
29993
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk187.red("closed"), date: pr.closedAt } : null
|
|
29739
29994
|
};
|
|
29740
29995
|
function defaultStatus(pr) {
|
|
29741
|
-
return { label:
|
|
29996
|
+
return { label: chalk187.green("opened"), date: pr.createdAt };
|
|
29742
29997
|
}
|
|
29743
29998
|
function getStatus2(pr) {
|
|
29744
29999
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -29747,11 +30002,11 @@ function formatDate(dateStr) {
|
|
|
29747
30002
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
29748
30003
|
}
|
|
29749
30004
|
function formatPrHeader(pr, status2) {
|
|
29750
|
-
return `${
|
|
30005
|
+
return `${chalk187.cyan(`#${pr.number}`)} ${pr.title} ${chalk187.dim(`(${pr.author.login},`)} ${status2.label} ${chalk187.dim(`${formatDate(status2.date)})`)}`;
|
|
29751
30006
|
}
|
|
29752
30007
|
function logPrDetails(pr) {
|
|
29753
30008
|
console.log(
|
|
29754
|
-
|
|
30009
|
+
chalk187.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
29755
30010
|
);
|
|
29756
30011
|
console.log();
|
|
29757
30012
|
}
|
|
@@ -29879,13 +30134,13 @@ function postReviewComment(vars) {
|
|
|
29879
30134
|
}
|
|
29880
30135
|
|
|
29881
30136
|
// src/commands/prs/reviewProposedPrComment.ts
|
|
29882
|
-
import { randomUUID as
|
|
30137
|
+
import { randomUUID as randomUUID15 } from "crypto";
|
|
29883
30138
|
async function reviewProposedPrComment(title, body, prNumber) {
|
|
29884
30139
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
29885
30140
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
29886
30141
|
await awaitPreviewApproval("PR comment preview", {
|
|
29887
30142
|
sessionId,
|
|
29888
|
-
requestId:
|
|
30143
|
+
requestId: randomUUID15(),
|
|
29889
30144
|
title,
|
|
29890
30145
|
body,
|
|
29891
30146
|
prNumber,
|
|
@@ -30320,13 +30575,13 @@ function agentFooter(unresolvedCount) {
|
|
|
30320
30575
|
}
|
|
30321
30576
|
|
|
30322
30577
|
// src/commands/prs/listComments/commentStyle.ts
|
|
30323
|
-
import
|
|
30578
|
+
import chalk188 from "chalk";
|
|
30324
30579
|
var plain = (text17) => text17;
|
|
30325
30580
|
function colouredState(state) {
|
|
30326
30581
|
const label2 = `[${state}]`;
|
|
30327
|
-
if (state === "APPROVED") return
|
|
30328
|
-
if (state === "CHANGES_REQUESTED") return
|
|
30329
|
-
return
|
|
30582
|
+
if (state === "APPROVED") return chalk188.green(label2);
|
|
30583
|
+
if (state === "CHANGES_REQUESTED") return chalk188.red(label2);
|
|
30584
|
+
return chalk188.yellow(label2);
|
|
30330
30585
|
}
|
|
30331
30586
|
function commentStyle() {
|
|
30332
30587
|
if (isClaudeCode()) {
|
|
@@ -30340,9 +30595,9 @@ function commentStyle() {
|
|
|
30340
30595
|
};
|
|
30341
30596
|
}
|
|
30342
30597
|
return {
|
|
30343
|
-
cyan:
|
|
30344
|
-
bold:
|
|
30345
|
-
dim:
|
|
30598
|
+
cyan: chalk188.cyan,
|
|
30599
|
+
bold: chalk188.bold,
|
|
30600
|
+
dim: chalk188.dim,
|
|
30346
30601
|
state: colouredState,
|
|
30347
30602
|
diffHunk: true,
|
|
30348
30603
|
agent: false
|
|
@@ -30920,7 +31175,7 @@ function parseScreenshotSpecs(specs) {
|
|
|
30920
31175
|
}
|
|
30921
31176
|
|
|
30922
31177
|
// src/commands/prs/previewAndApplyEdit.ts
|
|
30923
|
-
import { randomUUID as
|
|
31178
|
+
import { randomUUID as randomUUID16 } from "crypto";
|
|
30924
31179
|
|
|
30925
31180
|
// src/commands/prs/stageScreenshots.ts
|
|
30926
31181
|
import { readFile as readFile8 } from "fs/promises";
|
|
@@ -30942,7 +31197,7 @@ function stageScreenshots(screenshots = []) {
|
|
|
30942
31197
|
async function previewAndApplyEdit(args) {
|
|
30943
31198
|
const decision = await awaitPreviewApproval("PR preview", {
|
|
30944
31199
|
sessionId: args.sessionId,
|
|
30945
|
-
requestId:
|
|
31200
|
+
requestId: randomUUID16(),
|
|
30946
31201
|
title: args.title ?? args.currentTitle,
|
|
30947
31202
|
body: args.body,
|
|
30948
31203
|
prNumber: args.number,
|
|
@@ -31277,7 +31532,7 @@ async function placePr(prNumber, title, body, options2, attachments = []) {
|
|
|
31277
31532
|
}
|
|
31278
31533
|
|
|
31279
31534
|
// src/commands/prs/previewAndPlace.ts
|
|
31280
|
-
import { randomUUID as
|
|
31535
|
+
import { randomUUID as randomUUID17 } from "crypto";
|
|
31281
31536
|
|
|
31282
31537
|
// src/commands/review/announcePr.ts
|
|
31283
31538
|
function announcePr(prNumber) {
|
|
@@ -31353,7 +31608,7 @@ function enableAutoMerge() {
|
|
|
31353
31608
|
async function previewAndPlace(args) {
|
|
31354
31609
|
const decision = await awaitPreviewApproval("PR preview", {
|
|
31355
31610
|
sessionId: args.sessionId,
|
|
31356
|
-
requestId:
|
|
31611
|
+
requestId: randomUUID17(),
|
|
31357
31612
|
title: args.title,
|
|
31358
31613
|
body: args.body,
|
|
31359
31614
|
prNumber: args.prNumber,
|
|
@@ -31816,16 +32071,16 @@ function buildPrsStatusReport(repoArguments, now = Date.now()) {
|
|
|
31816
32071
|
}
|
|
31817
32072
|
|
|
31818
32073
|
// src/commands/prs/status/printPrsStatus.ts
|
|
31819
|
-
import
|
|
32074
|
+
import chalk190 from "chalk";
|
|
31820
32075
|
|
|
31821
32076
|
// src/commands/prs/status/printPrStatus.ts
|
|
31822
|
-
import
|
|
32077
|
+
import chalk189 from "chalk";
|
|
31823
32078
|
function flags(pr) {
|
|
31824
32079
|
const markers = [];
|
|
31825
32080
|
if (pr.isDraft) markers.push("draft");
|
|
31826
32081
|
if (pr.isDoNotMerge) markers.push("do not merge");
|
|
31827
32082
|
if (pr.isBot) markers.push("bot");
|
|
31828
|
-
return markers.length ? ` ${
|
|
32083
|
+
return markers.length ? ` ${chalk189.yellow(`[${markers.join(", ")}]`)}` : "";
|
|
31829
32084
|
}
|
|
31830
32085
|
function updated(pr) {
|
|
31831
32086
|
return pr.ageHours === null ? "updated unknown" : `updated ${pr.age} ago`;
|
|
@@ -31839,35 +32094,35 @@ function reviewLine(pr) {
|
|
|
31839
32094
|
function checkLines(pr) {
|
|
31840
32095
|
const lines2 = [];
|
|
31841
32096
|
if (pr.checks.failing.length) {
|
|
31842
|
-
lines2.push(
|
|
32097
|
+
lines2.push(chalk189.red(`failing: ${pr.checks.failing.join(", ")}`));
|
|
31843
32098
|
}
|
|
31844
32099
|
if (pr.checks.pending.length) {
|
|
31845
|
-
lines2.push(
|
|
32100
|
+
lines2.push(chalk189.yellow(`pending: ${pr.checks.pending.join(", ")}`));
|
|
31846
32101
|
}
|
|
31847
32102
|
return lines2;
|
|
31848
32103
|
}
|
|
31849
32104
|
function threadsLine(pr) {
|
|
31850
32105
|
if (pr.unresolvedThreads === null) {
|
|
31851
|
-
return
|
|
32106
|
+
return chalk189.dim("unresolved comments: unknown");
|
|
31852
32107
|
}
|
|
31853
32108
|
if (pr.unresolvedThreads === 0) return null;
|
|
31854
|
-
return
|
|
32109
|
+
return chalk189.yellow(`unresolved comments: ${pr.unresolvedThreads}`);
|
|
31855
32110
|
}
|
|
31856
32111
|
function mergeableLine(pr) {
|
|
31857
|
-
if (pr.mergeable === "CONFLICTING") return
|
|
32112
|
+
if (pr.mergeable === "CONFLICTING") return chalk189.red("conflicting");
|
|
31858
32113
|
if (pr.mergeable === "MERGEABLE") return null;
|
|
31859
|
-
return
|
|
32114
|
+
return chalk189.dim(`mergeable: ${pr.mergeable.toLowerCase()}`);
|
|
31860
32115
|
}
|
|
31861
32116
|
function printPrStatus(pr) {
|
|
31862
32117
|
console.log(
|
|
31863
|
-
` ${
|
|
32118
|
+
` ${chalk189.cyan(`#${pr.number}`)} ${pr.title} ${chalk189.dim(`(${pr.author}, ${updated(pr)})`)}${flags(pr)}`
|
|
31864
32119
|
);
|
|
31865
32120
|
const details = [
|
|
31866
32121
|
reviewLine(pr),
|
|
31867
32122
|
...checkLines(pr),
|
|
31868
32123
|
threadsLine(pr),
|
|
31869
32124
|
mergeableLine(pr),
|
|
31870
|
-
|
|
32125
|
+
chalk189.dim(pr.url)
|
|
31871
32126
|
];
|
|
31872
32127
|
for (const detail of details) {
|
|
31873
32128
|
if (detail) console.log(` ${detail}`);
|
|
@@ -31878,17 +32133,17 @@ function printPrStatus(pr) {
|
|
|
31878
32133
|
function printPrsStatus(report) {
|
|
31879
32134
|
for (const repo of report.repos) {
|
|
31880
32135
|
const count10 = repo.pullRequests.length;
|
|
31881
|
-
console.log(`${
|
|
32136
|
+
console.log(`${chalk190.bold(repo.repo)} ${chalk190.dim(`(${count10} open)`)}`);
|
|
31882
32137
|
for (const pr of repo.pullRequests) {
|
|
31883
32138
|
printPrStatus(pr);
|
|
31884
32139
|
}
|
|
31885
|
-
if (count10 === 0) console.log(
|
|
32140
|
+
if (count10 === 0) console.log(chalk190.dim(" no open pull requests"));
|
|
31886
32141
|
console.log();
|
|
31887
32142
|
}
|
|
31888
32143
|
if (report.errors.length === 0) return;
|
|
31889
|
-
console.log(
|
|
32144
|
+
console.log(chalk190.bold("Errors"));
|
|
31890
32145
|
for (const failure of report.errors) {
|
|
31891
|
-
console.log(` ${
|
|
32146
|
+
console.log(` ${chalk190.red(failure.repo)}: ${failure.error}`);
|
|
31892
32147
|
}
|
|
31893
32148
|
console.log();
|
|
31894
32149
|
}
|
|
@@ -32116,10 +32371,10 @@ function registerPrs(program) {
|
|
|
32116
32371
|
}
|
|
32117
32372
|
|
|
32118
32373
|
// src/commands/ravendb/ravendbAuth.ts
|
|
32119
|
-
import
|
|
32374
|
+
import chalk196 from "chalk";
|
|
32120
32375
|
|
|
32121
32376
|
// src/shared/createConnectionAuth.ts
|
|
32122
|
-
import
|
|
32377
|
+
import chalk191 from "chalk";
|
|
32123
32378
|
function listConnections(connections, format3) {
|
|
32124
32379
|
if (connections.length === 0) {
|
|
32125
32380
|
console.log("No connections configured.");
|
|
@@ -32132,7 +32387,7 @@ function listConnections(connections, format3) {
|
|
|
32132
32387
|
function removeConnection(connections, name, save) {
|
|
32133
32388
|
const filtered = connections.filter((c) => c.name !== name);
|
|
32134
32389
|
if (filtered.length === connections.length) {
|
|
32135
|
-
console.error(
|
|
32390
|
+
console.error(chalk191.red(`Connection "${name}" not found.`));
|
|
32136
32391
|
process.exit(1);
|
|
32137
32392
|
}
|
|
32138
32393
|
save(filtered);
|
|
@@ -32178,15 +32433,15 @@ function saveConnections(connections) {
|
|
|
32178
32433
|
}
|
|
32179
32434
|
|
|
32180
32435
|
// src/commands/ravendb/promptConnection.ts
|
|
32181
|
-
import
|
|
32436
|
+
import chalk194 from "chalk";
|
|
32182
32437
|
|
|
32183
32438
|
// src/commands/ravendb/selectOpSecret.ts
|
|
32184
|
-
import
|
|
32439
|
+
import chalk193 from "chalk";
|
|
32185
32440
|
import Enquirer2 from "enquirer";
|
|
32186
32441
|
|
|
32187
32442
|
// src/commands/ravendb/searchItems.ts
|
|
32188
32443
|
import { execSync as execSync46 } from "child_process";
|
|
32189
|
-
import
|
|
32444
|
+
import chalk192 from "chalk";
|
|
32190
32445
|
function opExec(args) {
|
|
32191
32446
|
return execSync46(`op ${args}`, {
|
|
32192
32447
|
encoding: "utf8",
|
|
@@ -32199,7 +32454,7 @@ function searchItems(search2) {
|
|
|
32199
32454
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
32200
32455
|
} catch {
|
|
32201
32456
|
console.error(
|
|
32202
|
-
|
|
32457
|
+
chalk192.red(
|
|
32203
32458
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
32204
32459
|
)
|
|
32205
32460
|
);
|
|
@@ -32213,7 +32468,7 @@ function getItemFields(itemId2) {
|
|
|
32213
32468
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
32214
32469
|
return item.fields.filter((f) => f.reference && f.label);
|
|
32215
32470
|
} catch {
|
|
32216
|
-
console.error(
|
|
32471
|
+
console.error(chalk192.red("Failed to get item details from 1Password."));
|
|
32217
32472
|
process.exit(1);
|
|
32218
32473
|
}
|
|
32219
32474
|
}
|
|
@@ -32232,7 +32487,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
32232
32487
|
}).run();
|
|
32233
32488
|
const items2 = searchItems(search2);
|
|
32234
32489
|
if (items2.length === 0) {
|
|
32235
|
-
console.error(
|
|
32490
|
+
console.error(chalk193.red(`No items found matching "${search2}".`));
|
|
32236
32491
|
process.exit(1);
|
|
32237
32492
|
}
|
|
32238
32493
|
const itemId2 = await selectOne(
|
|
@@ -32241,7 +32496,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
32241
32496
|
);
|
|
32242
32497
|
const fields = getItemFields(itemId2);
|
|
32243
32498
|
if (fields.length === 0) {
|
|
32244
|
-
console.error(
|
|
32499
|
+
console.error(chalk193.red("No fields with references found on this item."));
|
|
32245
32500
|
process.exit(1);
|
|
32246
32501
|
}
|
|
32247
32502
|
const ref = await selectOne(
|
|
@@ -32255,7 +32510,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
32255
32510
|
async function promptConnection(existingNames) {
|
|
32256
32511
|
const name = await promptInput("name", "Connection name:");
|
|
32257
32512
|
if (existingNames.includes(name)) {
|
|
32258
|
-
console.error(
|
|
32513
|
+
console.error(chalk194.red(`Connection "${name}" already exists.`));
|
|
32259
32514
|
process.exit(1);
|
|
32260
32515
|
}
|
|
32261
32516
|
const url = await promptInput(
|
|
@@ -32264,22 +32519,22 @@ async function promptConnection(existingNames) {
|
|
|
32264
32519
|
);
|
|
32265
32520
|
const database = await promptInput("database", "Database name:");
|
|
32266
32521
|
if (!name || !url || !database) {
|
|
32267
|
-
console.error(
|
|
32522
|
+
console.error(chalk194.red("All fields are required."));
|
|
32268
32523
|
process.exit(1);
|
|
32269
32524
|
}
|
|
32270
32525
|
const apiKeyRef = await selectOpSecret();
|
|
32271
|
-
console.log(
|
|
32526
|
+
console.log(chalk194.dim(`Using: ${apiKeyRef}`));
|
|
32272
32527
|
return { name, url, database, apiKeyRef };
|
|
32273
32528
|
}
|
|
32274
32529
|
|
|
32275
32530
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
32276
|
-
import
|
|
32531
|
+
import chalk195 from "chalk";
|
|
32277
32532
|
function ravendbSetConnection(name) {
|
|
32278
32533
|
const raw = loadGlobalConfigRaw();
|
|
32279
32534
|
const ravendb = raw.ravendb ?? {};
|
|
32280
32535
|
const connections = ravendb.connections ?? [];
|
|
32281
32536
|
if (!connections.some((c) => c.name === name)) {
|
|
32282
|
-
console.error(
|
|
32537
|
+
console.error(chalk195.red(`Connection "${name}" not found.`));
|
|
32283
32538
|
console.error(
|
|
32284
32539
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
32285
32540
|
);
|
|
@@ -32295,16 +32550,16 @@ function ravendbSetConnection(name) {
|
|
|
32295
32550
|
var ravendbAuth = createConnectionAuth({
|
|
32296
32551
|
load: loadConnections,
|
|
32297
32552
|
save: saveConnections,
|
|
32298
|
-
format: (c) => `${
|
|
32553
|
+
format: (c) => `${chalk196.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
32299
32554
|
promptNew: promptConnection,
|
|
32300
32555
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
32301
32556
|
});
|
|
32302
32557
|
|
|
32303
32558
|
// src/commands/ravendb/ravendbCollections.ts
|
|
32304
|
-
import
|
|
32559
|
+
import chalk200 from "chalk";
|
|
32305
32560
|
|
|
32306
32561
|
// src/commands/ravendb/ravenFetch.ts
|
|
32307
|
-
import
|
|
32562
|
+
import chalk198 from "chalk";
|
|
32308
32563
|
|
|
32309
32564
|
// src/commands/ravendb/getAccessToken.ts
|
|
32310
32565
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -32341,10 +32596,10 @@ ${errorText}`
|
|
|
32341
32596
|
|
|
32342
32597
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
32343
32598
|
import { execSync as execSync47 } from "child_process";
|
|
32344
|
-
import
|
|
32599
|
+
import chalk197 from "chalk";
|
|
32345
32600
|
function resolveOpSecret(reference) {
|
|
32346
32601
|
if (!reference.startsWith("op://")) {
|
|
32347
|
-
console.error(
|
|
32602
|
+
console.error(chalk197.red(`Invalid secret reference: must start with op://`));
|
|
32348
32603
|
process.exit(1);
|
|
32349
32604
|
}
|
|
32350
32605
|
try {
|
|
@@ -32354,7 +32609,7 @@ function resolveOpSecret(reference) {
|
|
|
32354
32609
|
}).trim();
|
|
32355
32610
|
} catch {
|
|
32356
32611
|
console.error(
|
|
32357
|
-
|
|
32612
|
+
chalk197.red(
|
|
32358
32613
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
32359
32614
|
)
|
|
32360
32615
|
);
|
|
@@ -32381,7 +32636,7 @@ async function ravenFetch(connection, path108) {
|
|
|
32381
32636
|
if (!response.ok) {
|
|
32382
32637
|
const body = await response.text();
|
|
32383
32638
|
console.error(
|
|
32384
|
-
|
|
32639
|
+
chalk198.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
32385
32640
|
);
|
|
32386
32641
|
console.error(body.substring(0, 500));
|
|
32387
32642
|
process.exit(1);
|
|
@@ -32390,7 +32645,7 @@ async function ravenFetch(connection, path108) {
|
|
|
32390
32645
|
}
|
|
32391
32646
|
|
|
32392
32647
|
// src/commands/ravendb/resolveConnection.ts
|
|
32393
|
-
import
|
|
32648
|
+
import chalk199 from "chalk";
|
|
32394
32649
|
function loadRavendb() {
|
|
32395
32650
|
const raw = loadGlobalConfigRaw();
|
|
32396
32651
|
const ravendb = raw.ravendb;
|
|
@@ -32404,7 +32659,7 @@ function resolveConnection(name) {
|
|
|
32404
32659
|
const connectionName = name ?? defaultConnection;
|
|
32405
32660
|
if (!connectionName) {
|
|
32406
32661
|
console.error(
|
|
32407
|
-
|
|
32662
|
+
chalk199.red(
|
|
32408
32663
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
32409
32664
|
)
|
|
32410
32665
|
);
|
|
@@ -32412,7 +32667,7 @@ function resolveConnection(name) {
|
|
|
32412
32667
|
}
|
|
32413
32668
|
const connection = connections.find((c) => c.name === connectionName);
|
|
32414
32669
|
if (!connection) {
|
|
32415
|
-
console.error(
|
|
32670
|
+
console.error(chalk199.red(`Connection "${connectionName}" not found.`));
|
|
32416
32671
|
console.error(
|
|
32417
32672
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
32418
32673
|
);
|
|
@@ -32443,15 +32698,15 @@ async function ravendbCollections(connectionName) {
|
|
|
32443
32698
|
return;
|
|
32444
32699
|
}
|
|
32445
32700
|
for (const c of collections) {
|
|
32446
|
-
console.log(`${
|
|
32701
|
+
console.log(`${chalk200.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
32447
32702
|
}
|
|
32448
32703
|
}
|
|
32449
32704
|
|
|
32450
32705
|
// src/commands/ravendb/ravendbQuery.ts
|
|
32451
|
-
import
|
|
32706
|
+
import chalk202 from "chalk";
|
|
32452
32707
|
|
|
32453
32708
|
// src/commands/ravendb/fetchAllPages.ts
|
|
32454
|
-
import
|
|
32709
|
+
import chalk201 from "chalk";
|
|
32455
32710
|
|
|
32456
32711
|
// src/commands/ravendb/buildQueryPath.ts
|
|
32457
32712
|
function buildQueryPath(opts) {
|
|
@@ -32489,7 +32744,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
32489
32744
|
allResults.push(...results);
|
|
32490
32745
|
start2 += results.length;
|
|
32491
32746
|
process.stderr.write(
|
|
32492
|
-
`\r${
|
|
32747
|
+
`\r${chalk201.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
32493
32748
|
);
|
|
32494
32749
|
if (start2 >= totalResults) break;
|
|
32495
32750
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -32504,7 +32759,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
32504
32759
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
32505
32760
|
const resolved = resolveArgs(connectionName, collection);
|
|
32506
32761
|
if (!resolved.collection && !options2.query) {
|
|
32507
|
-
console.error(
|
|
32762
|
+
console.error(chalk202.red("Provide a collection name or --query filter."));
|
|
32508
32763
|
process.exit(1);
|
|
32509
32764
|
}
|
|
32510
32765
|
const { collection: col } = resolved;
|
|
@@ -32539,7 +32794,7 @@ function registerRavendb(program) {
|
|
|
32539
32794
|
}
|
|
32540
32795
|
|
|
32541
32796
|
// src/commands/releases/releasesConfigure.ts
|
|
32542
|
-
import
|
|
32797
|
+
import chalk204 from "chalk";
|
|
32543
32798
|
|
|
32544
32799
|
// src/commands/releases/checkStreamGraph.ts
|
|
32545
32800
|
function nodeIds(stream) {
|
|
@@ -32601,26 +32856,26 @@ function readStreamsInput(source) {
|
|
|
32601
32856
|
}
|
|
32602
32857
|
|
|
32603
32858
|
// src/commands/releases/reportDerivedStreams.ts
|
|
32604
|
-
import
|
|
32859
|
+
import chalk203 from "chalk";
|
|
32605
32860
|
function printDerived(stream) {
|
|
32606
32861
|
const environments = stream.nodes.flatMap((n) => n.environment ?? []);
|
|
32607
32862
|
const steps = stream.nodes.filter((n) => !n.environment);
|
|
32608
32863
|
console.log(
|
|
32609
|
-
`${
|
|
32864
|
+
`${chalk203.bold(stream.name)} ${chalk203.dim(`${stream.repo} \xB7 ${stream.workflow}`)}`
|
|
32610
32865
|
);
|
|
32611
32866
|
console.log(
|
|
32612
|
-
` environments: ${environments.join(", ") ||
|
|
32867
|
+
` environments: ${environments.join(", ") || chalk203.dim("none")}`
|
|
32613
32868
|
);
|
|
32614
32869
|
if (steps.length > 0)
|
|
32615
32870
|
console.log(
|
|
32616
32871
|
` steps: ${steps.map((n) => `${n.id} [${n.kind ?? "step"}]`).join(", ")}`
|
|
32617
32872
|
);
|
|
32618
32873
|
const edges = stream.edges.map(([from, to]) => `${from} \u2192 ${to}`);
|
|
32619
|
-
console.log(` edges: ${edges.join(", ") ||
|
|
32874
|
+
console.log(` edges: ${edges.join(", ") || chalk203.dim("none")}`);
|
|
32620
32875
|
}
|
|
32621
32876
|
function reportDerivedStreams(streams, target) {
|
|
32622
32877
|
for (const stream of streams) printDerived(stream);
|
|
32623
|
-
console.log(
|
|
32878
|
+
console.log(chalk203.dim(`Written to ${target}`));
|
|
32624
32879
|
}
|
|
32625
32880
|
|
|
32626
32881
|
// src/commands/releases/withCurrentRepo.ts
|
|
@@ -32708,8 +32963,8 @@ async function writeReleaseStreams(incoming, scope) {
|
|
|
32708
32963
|
|
|
32709
32964
|
// src/commands/releases/releasesConfigure.ts
|
|
32710
32965
|
function fail6(message3, details = []) {
|
|
32711
|
-
console.error(
|
|
32712
|
-
for (const detail of details) console.error(
|
|
32966
|
+
console.error(chalk204.red(message3));
|
|
32967
|
+
for (const detail of details) console.error(chalk204.red(` ${detail}`));
|
|
32713
32968
|
process.exitCode = 1;
|
|
32714
32969
|
}
|
|
32715
32970
|
function reportWritten(incoming, target) {
|
|
@@ -32741,23 +32996,23 @@ async function releasesConfigure(options2 = {}) {
|
|
|
32741
32996
|
}
|
|
32742
32997
|
|
|
32743
32998
|
// src/commands/releases/releasesList.ts
|
|
32744
|
-
import
|
|
32999
|
+
import chalk205 from "chalk";
|
|
32745
33000
|
function describeNode(node) {
|
|
32746
33001
|
if (node.environment) return `${node.id} \u2192 ${node.environment}`;
|
|
32747
33002
|
return `${node.id} (${node.kind ?? "step"})`;
|
|
32748
33003
|
}
|
|
32749
33004
|
function printStream(stream) {
|
|
32750
|
-
console.log(`${
|
|
32751
|
-
console.log(
|
|
33005
|
+
console.log(`${chalk205.bold(stream.name)} ${chalk205.dim(stream.repo)}`);
|
|
33006
|
+
console.log(chalk205.dim(` workflow: ${stream.workflow}`));
|
|
32752
33007
|
for (const node of stream.nodes) console.log(` ${describeNode(node)}`);
|
|
32753
33008
|
for (const [from, to] of stream.edges)
|
|
32754
|
-
console.log(
|
|
33009
|
+
console.log(chalk205.dim(` ${from} \u2192 ${to}`));
|
|
32755
33010
|
}
|
|
32756
33011
|
function releasesList() {
|
|
32757
33012
|
const streams = loadConfig().releases?.streams ?? [];
|
|
32758
33013
|
if (streams.length === 0) {
|
|
32759
33014
|
console.log(
|
|
32760
|
-
|
|
33015
|
+
chalk205.dim("No release streams configured under releases.streams.")
|
|
32761
33016
|
);
|
|
32762
33017
|
return;
|
|
32763
33018
|
}
|
|
@@ -32805,7 +33060,7 @@ function coverage() {
|
|
|
32805
33060
|
|
|
32806
33061
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
32807
33062
|
import path45 from "path";
|
|
32808
|
-
import
|
|
33063
|
+
import chalk207 from "chalk";
|
|
32809
33064
|
|
|
32810
33065
|
// src/commands/lint/lint/checkFileNames.ts
|
|
32811
33066
|
import fs23 from "fs";
|
|
@@ -32885,7 +33140,7 @@ function checkFileNames() {
|
|
|
32885
33140
|
}
|
|
32886
33141
|
|
|
32887
33142
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
32888
|
-
import
|
|
33143
|
+
import chalk206 from "chalk";
|
|
32889
33144
|
|
|
32890
33145
|
// src/commands/lint/lint/applyMoves.ts
|
|
32891
33146
|
import fs24 from "fs";
|
|
@@ -32970,25 +33225,25 @@ function fixFileNameViolations(moves) {
|
|
|
32970
33225
|
const start2 = performance.now();
|
|
32971
33226
|
const project = createLintProject();
|
|
32972
33227
|
const cwd = process.cwd();
|
|
32973
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
33228
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk206.green(line)));
|
|
32974
33229
|
const ms = (performance.now() - start2).toFixed(0);
|
|
32975
|
-
console.log(
|
|
33230
|
+
console.log(chalk206.dim(` Done in ${ms}ms`));
|
|
32976
33231
|
}
|
|
32977
33232
|
|
|
32978
33233
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
32979
33234
|
function reportViolations(violations) {
|
|
32980
|
-
console.error(
|
|
33235
|
+
console.error(chalk207.red("\nFile name check failed:\n"));
|
|
32981
33236
|
console.error(
|
|
32982
|
-
|
|
33237
|
+
chalk207.red(
|
|
32983
33238
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
32984
33239
|
)
|
|
32985
33240
|
);
|
|
32986
33241
|
for (const violation of violations) {
|
|
32987
|
-
console.error(
|
|
32988
|
-
console.error(
|
|
33242
|
+
console.error(chalk207.red(` ${violation.filePath}`));
|
|
33243
|
+
console.error(chalk207.gray(` Rename to: ${violation.suggestedName}
|
|
32989
33244
|
`));
|
|
32990
33245
|
}
|
|
32991
|
-
console.error(
|
|
33246
|
+
console.error(chalk207.dim(" Run with -f to auto-fix.\n"));
|
|
32992
33247
|
}
|
|
32993
33248
|
function runFileNameCheck(fix = false) {
|
|
32994
33249
|
const violations = checkFileNames();
|
|
@@ -33017,17 +33272,17 @@ function runFileNameCheck(fix = false) {
|
|
|
33017
33272
|
import fs26 from "fs";
|
|
33018
33273
|
|
|
33019
33274
|
// src/commands/lint/shared.ts
|
|
33020
|
-
import
|
|
33275
|
+
import chalk208 from "chalk";
|
|
33021
33276
|
function reportViolations2(violations, checkName2, errorMessage3, successMessage) {
|
|
33022
33277
|
if (violations.length > 0) {
|
|
33023
|
-
console.error(
|
|
33278
|
+
console.error(chalk208.red(`
|
|
33024
33279
|
${checkName2} failed:
|
|
33025
33280
|
`));
|
|
33026
|
-
console.error(
|
|
33281
|
+
console.error(chalk208.red(` ${errorMessage3}
|
|
33027
33282
|
`));
|
|
33028
33283
|
for (const violation of violations) {
|
|
33029
|
-
console.error(
|
|
33030
|
-
console.error(
|
|
33284
|
+
console.error(chalk208.red(` ${violation.filePath}:${violation.line}`));
|
|
33285
|
+
console.error(chalk208.gray(` ${violation.content}
|
|
33031
33286
|
`));
|
|
33032
33287
|
}
|
|
33033
33288
|
return false;
|
|
@@ -33158,7 +33413,7 @@ import { execSync as execSync49 } from "child_process";
|
|
|
33158
33413
|
import { existsSync as existsSync65, mkdirSync as mkdirSync23, unlinkSync as unlinkSync15, writeFileSync as writeFileSync38 } from "fs";
|
|
33159
33414
|
import { tmpdir as tmpdir7 } from "os";
|
|
33160
33415
|
import { join as join82, resolve as resolve24 } from "path";
|
|
33161
|
-
import
|
|
33416
|
+
import chalk209 from "chalk";
|
|
33162
33417
|
|
|
33163
33418
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
33164
33419
|
var captureWindowPs1 = `
|
|
@@ -33309,19 +33564,19 @@ function screenshot(processName) {
|
|
|
33309
33564
|
const config = loadConfig();
|
|
33310
33565
|
const outputDir = resolve24(config.screenshot.outputDir);
|
|
33311
33566
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
33312
|
-
console.log(
|
|
33567
|
+
console.log(chalk209.gray(`Capturing window for process "${processName}" ...`));
|
|
33313
33568
|
try {
|
|
33314
33569
|
runPowerShellScript(processName, outputPath);
|
|
33315
|
-
console.log(
|
|
33570
|
+
console.log(chalk209.green(`Screenshot saved: ${outputPath}`));
|
|
33316
33571
|
} catch (error) {
|
|
33317
33572
|
const msg = error instanceof Error ? error.message : String(error);
|
|
33318
|
-
console.error(
|
|
33573
|
+
console.error(chalk209.red(`Failed to capture screenshot: ${msg}`));
|
|
33319
33574
|
process.exit(1);
|
|
33320
33575
|
}
|
|
33321
33576
|
}
|
|
33322
33577
|
|
|
33323
33578
|
// src/commands/statusLine.ts
|
|
33324
|
-
import
|
|
33579
|
+
import chalk211 from "chalk";
|
|
33325
33580
|
|
|
33326
33581
|
// src/shared/contextLevel.ts
|
|
33327
33582
|
var THRESHOLDS = {
|
|
@@ -33337,7 +33592,7 @@ function contextLevel(pct, harness) {
|
|
|
33337
33592
|
}
|
|
33338
33593
|
|
|
33339
33594
|
// src/commands/buildLimitsSegment.ts
|
|
33340
|
-
import
|
|
33595
|
+
import chalk210 from "chalk";
|
|
33341
33596
|
|
|
33342
33597
|
// src/shared/rateLimitLevel.ts
|
|
33343
33598
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -33375,9 +33630,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
33375
33630
|
|
|
33376
33631
|
// src/commands/buildLimitsSegment.ts
|
|
33377
33632
|
var LEVEL_COLOR = {
|
|
33378
|
-
ok:
|
|
33379
|
-
warn:
|
|
33380
|
-
over:
|
|
33633
|
+
ok: chalk210.green,
|
|
33634
|
+
warn: chalk210.yellow,
|
|
33635
|
+
over: chalk210.red
|
|
33381
33636
|
};
|
|
33382
33637
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
33383
33638
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -33473,7 +33728,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
33473
33728
|
}
|
|
33474
33729
|
|
|
33475
33730
|
// src/commands/statusLine.ts
|
|
33476
|
-
|
|
33731
|
+
chalk211.level = 3;
|
|
33477
33732
|
function formatNumber(num) {
|
|
33478
33733
|
return num.toLocaleString("en-US");
|
|
33479
33734
|
}
|
|
@@ -33481,9 +33736,9 @@ function colorizePercent(pct) {
|
|
|
33481
33736
|
const label2 = `${Math.round(pct)}%`;
|
|
33482
33737
|
switch (contextLevel(pct)) {
|
|
33483
33738
|
case "red":
|
|
33484
|
-
return
|
|
33739
|
+
return chalk211.red(label2);
|
|
33485
33740
|
case "yellow":
|
|
33486
|
-
return
|
|
33741
|
+
return chalk211.yellow(label2);
|
|
33487
33742
|
default:
|
|
33488
33743
|
return label2;
|
|
33489
33744
|
}
|
|
@@ -33496,7 +33751,7 @@ async function statusLine() {
|
|
|
33496
33751
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
33497
33752
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
33498
33753
|
const branch2 = dir ? readGitBranch(dir) : null;
|
|
33499
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
33754
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk211.cyan(branch2)} | ` : "";
|
|
33500
33755
|
console.log(
|
|
33501
33756
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
33502
33757
|
);
|
|
@@ -33603,7 +33858,7 @@ import { spawn as spawn7 } from "child_process";
|
|
|
33603
33858
|
import * as path47 from "path";
|
|
33604
33859
|
|
|
33605
33860
|
// src/commands/refactor/logViolations.ts
|
|
33606
|
-
import
|
|
33861
|
+
import chalk212 from "chalk";
|
|
33607
33862
|
var DEFAULT_MAX_LINES2 = 100;
|
|
33608
33863
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
33609
33864
|
if (violations.length === 0) {
|
|
@@ -33612,43 +33867,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
33612
33867
|
}
|
|
33613
33868
|
return;
|
|
33614
33869
|
}
|
|
33615
|
-
console.error(
|
|
33870
|
+
console.error(chalk212.red(`
|
|
33616
33871
|
Refactor check failed:
|
|
33617
33872
|
`));
|
|
33618
|
-
console.error(
|
|
33873
|
+
console.error(chalk212.red(` The following files exceed ${maxLines} lines:
|
|
33619
33874
|
`));
|
|
33620
33875
|
for (const violation of violations) {
|
|
33621
|
-
console.error(
|
|
33876
|
+
console.error(chalk212.red(` ${violation.file} (${violation.lines} lines)`));
|
|
33622
33877
|
}
|
|
33623
33878
|
console.error(
|
|
33624
|
-
|
|
33879
|
+
chalk212.yellow(
|
|
33625
33880
|
`
|
|
33626
33881
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
33627
33882
|
way to refactor it, ignore it with:
|
|
33628
33883
|
`
|
|
33629
33884
|
)
|
|
33630
33885
|
);
|
|
33631
|
-
console.error(
|
|
33886
|
+
console.error(chalk212.gray(` assist refactor ignore <file>
|
|
33632
33887
|
`));
|
|
33633
33888
|
if (process.env.CLAUDECODE) {
|
|
33634
|
-
console.error(
|
|
33889
|
+
console.error(chalk212.cyan(`
|
|
33635
33890
|
## Extracting Code to New Files
|
|
33636
33891
|
`));
|
|
33637
33892
|
console.error(
|
|
33638
|
-
|
|
33893
|
+
chalk212.cyan(
|
|
33639
33894
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
33640
33895
|
`
|
|
33641
33896
|
)
|
|
33642
33897
|
);
|
|
33643
33898
|
console.error(
|
|
33644
|
-
|
|
33899
|
+
chalk212.cyan(
|
|
33645
33900
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
33646
33901
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
33647
33902
|
`
|
|
33648
33903
|
)
|
|
33649
33904
|
);
|
|
33650
33905
|
console.error(
|
|
33651
|
-
|
|
33906
|
+
chalk212.cyan(
|
|
33652
33907
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
33653
33908
|
domains, move it to a common/shared folder.
|
|
33654
33909
|
`
|
|
@@ -33804,7 +34059,7 @@ async function check(pattern2, options2) {
|
|
|
33804
34059
|
|
|
33805
34060
|
// src/commands/refactor/extract.ts
|
|
33806
34061
|
import path55 from "path";
|
|
33807
|
-
import
|
|
34062
|
+
import chalk215 from "chalk";
|
|
33808
34063
|
|
|
33809
34064
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
33810
34065
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -34412,23 +34667,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
34412
34667
|
|
|
34413
34668
|
// src/commands/refactor/extract/displayPlan.ts
|
|
34414
34669
|
import path51 from "path";
|
|
34415
|
-
import
|
|
34670
|
+
import chalk213 from "chalk";
|
|
34416
34671
|
function section(title) {
|
|
34417
34672
|
return `
|
|
34418
|
-
${
|
|
34673
|
+
${chalk213.cyan(title)}`;
|
|
34419
34674
|
}
|
|
34420
34675
|
function displayImporters(plan2, cwd) {
|
|
34421
34676
|
if (plan2.importersToUpdate.length === 0) return;
|
|
34422
34677
|
console.log(section("Update importers:"));
|
|
34423
34678
|
for (const imp of plan2.importersToUpdate) {
|
|
34424
34679
|
const rel = path51.relative(cwd, imp.file.getFilePath());
|
|
34425
|
-
console.log(` ${
|
|
34680
|
+
console.log(` ${chalk213.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
34426
34681
|
}
|
|
34427
34682
|
}
|
|
34428
34683
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
34429
|
-
console.log(
|
|
34684
|
+
console.log(chalk213.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
34430
34685
|
`));
|
|
34431
|
-
console.log(` ${
|
|
34686
|
+
console.log(` ${chalk213.cyan("Functions to move:")}`);
|
|
34432
34687
|
for (const name of plan2.extractedNames) {
|
|
34433
34688
|
console.log(` ${name}`);
|
|
34434
34689
|
}
|
|
@@ -34462,7 +34717,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
34462
34717
|
|
|
34463
34718
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
34464
34719
|
import path54 from "path";
|
|
34465
|
-
import
|
|
34720
|
+
import chalk214 from "chalk";
|
|
34466
34721
|
import { Project as Project3 } from "ts-morph";
|
|
34467
34722
|
|
|
34468
34723
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -34554,7 +34809,7 @@ function loadProjectFile(file) {
|
|
|
34554
34809
|
});
|
|
34555
34810
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
34556
34811
|
if (!sourceFile) {
|
|
34557
|
-
console.log(
|
|
34812
|
+
console.log(chalk214.red(`File not found in project: ${file}`));
|
|
34558
34813
|
process.exit(1);
|
|
34559
34814
|
}
|
|
34560
34815
|
return { project, sourceFile };
|
|
@@ -34577,19 +34832,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
34577
34832
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
34578
34833
|
if (options2.apply) {
|
|
34579
34834
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
34580
|
-
console.log(
|
|
34835
|
+
console.log(chalk215.green("\nExtraction complete"));
|
|
34581
34836
|
} else {
|
|
34582
|
-
console.log(
|
|
34837
|
+
console.log(chalk215.dim("\nDry run. Use --apply to execute."));
|
|
34583
34838
|
}
|
|
34584
34839
|
}
|
|
34585
34840
|
|
|
34586
34841
|
// src/commands/refactor/ignore.ts
|
|
34587
34842
|
import fs32 from "fs";
|
|
34588
|
-
import
|
|
34843
|
+
import chalk216 from "chalk";
|
|
34589
34844
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
34590
34845
|
function ignore2(file) {
|
|
34591
34846
|
if (!fs32.existsSync(file)) {
|
|
34592
|
-
console.error(
|
|
34847
|
+
console.error(chalk216.red(`Error: File does not exist: ${file}`));
|
|
34593
34848
|
process.exit(1);
|
|
34594
34849
|
}
|
|
34595
34850
|
const content = fs32.readFileSync(file, "utf8");
|
|
@@ -34605,7 +34860,7 @@ function ignore2(file) {
|
|
|
34605
34860
|
fs32.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
34606
34861
|
}
|
|
34607
34862
|
console.log(
|
|
34608
|
-
|
|
34863
|
+
chalk216.green(
|
|
34609
34864
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
34610
34865
|
)
|
|
34611
34866
|
);
|
|
@@ -34614,12 +34869,12 @@ function ignore2(file) {
|
|
|
34614
34869
|
// src/commands/refactor/rename.ts
|
|
34615
34870
|
import fs35 from "fs";
|
|
34616
34871
|
import path61 from "path";
|
|
34617
|
-
import
|
|
34872
|
+
import chalk219 from "chalk";
|
|
34618
34873
|
|
|
34619
34874
|
// src/commands/refactor/rename/applyRename.ts
|
|
34620
34875
|
import fs34 from "fs";
|
|
34621
34876
|
import path57 from "path";
|
|
34622
|
-
import
|
|
34877
|
+
import chalk217 from "chalk";
|
|
34623
34878
|
|
|
34624
34879
|
// src/commands/refactor/restructure/computeRewrites.ts
|
|
34625
34880
|
import path56 from "path";
|
|
@@ -34725,13 +34980,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
34725
34980
|
const updatedContents = applyRewrites(rewrites);
|
|
34726
34981
|
for (const [file, content] of updatedContents) {
|
|
34727
34982
|
fs34.writeFileSync(file, content, "utf8");
|
|
34728
|
-
console.log(
|
|
34983
|
+
console.log(chalk217.cyan(` Updated imports in ${path57.relative(cwd, file)}`));
|
|
34729
34984
|
}
|
|
34730
34985
|
const destDir = path57.dirname(destPath);
|
|
34731
34986
|
if (!fs34.existsSync(destDir)) fs34.mkdirSync(destDir, { recursive: true });
|
|
34732
34987
|
fs34.renameSync(sourcePath, destPath);
|
|
34733
34988
|
console.log(
|
|
34734
|
-
|
|
34989
|
+
chalk217.white(
|
|
34735
34990
|
` Moved ${path57.relative(cwd, sourcePath)} \u2192 ${path57.relative(cwd, destPath)}`
|
|
34736
34991
|
)
|
|
34737
34992
|
);
|
|
@@ -34881,16 +35136,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
34881
35136
|
|
|
34882
35137
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
34883
35138
|
import path60 from "path";
|
|
34884
|
-
import
|
|
35139
|
+
import chalk218 from "chalk";
|
|
34885
35140
|
function printRenamePreview(rewrites, cwd) {
|
|
34886
35141
|
for (const rewrite of rewrites) {
|
|
34887
35142
|
console.log(
|
|
34888
|
-
|
|
35143
|
+
chalk218.dim(
|
|
34889
35144
|
` ${path60.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
34890
35145
|
)
|
|
34891
35146
|
);
|
|
34892
35147
|
}
|
|
34893
|
-
console.log(
|
|
35148
|
+
console.log(chalk218.dim("Dry run. Use --apply to execute."));
|
|
34894
35149
|
}
|
|
34895
35150
|
|
|
34896
35151
|
// src/commands/refactor/rename.ts
|
|
@@ -34901,20 +35156,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
34901
35156
|
const relSource = path61.relative(cwd, sourcePath);
|
|
34902
35157
|
const relDest = path61.relative(cwd, destPath);
|
|
34903
35158
|
if (!fs35.existsSync(sourcePath)) {
|
|
34904
|
-
console.log(
|
|
35159
|
+
console.log(chalk219.red(`File not found: ${source}`));
|
|
34905
35160
|
process.exit(1);
|
|
34906
35161
|
}
|
|
34907
35162
|
if (destPath !== sourcePath && fs35.existsSync(destPath)) {
|
|
34908
|
-
console.log(
|
|
35163
|
+
console.log(chalk219.red(`Destination already exists: ${destination}`));
|
|
34909
35164
|
process.exit(1);
|
|
34910
35165
|
}
|
|
34911
|
-
console.log(
|
|
34912
|
-
console.log(
|
|
34913
|
-
console.log(
|
|
35166
|
+
console.log(chalk219.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
35167
|
+
console.log(chalk219.dim("Loading project..."));
|
|
35168
|
+
console.log(chalk219.dim("Scanning imports across the project..."));
|
|
34914
35169
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
34915
35170
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
34916
35171
|
console.log(
|
|
34917
|
-
|
|
35172
|
+
chalk219.dim(
|
|
34918
35173
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
34919
35174
|
)
|
|
34920
35175
|
);
|
|
@@ -34923,11 +35178,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
34923
35178
|
return;
|
|
34924
35179
|
}
|
|
34925
35180
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
34926
|
-
console.log(
|
|
35181
|
+
console.log(chalk219.green("Done"));
|
|
34927
35182
|
}
|
|
34928
35183
|
|
|
34929
35184
|
// src/commands/refactor/renameSymbol.ts
|
|
34930
|
-
import
|
|
35185
|
+
import chalk220 from "chalk";
|
|
34931
35186
|
|
|
34932
35187
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
34933
35188
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -34973,34 +35228,34 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
34973
35228
|
const { project, sourceFile } = loadProjectFile(file);
|
|
34974
35229
|
const symbol = findSymbol(sourceFile, oldName);
|
|
34975
35230
|
if (!symbol) {
|
|
34976
|
-
console.log(
|
|
35231
|
+
console.log(chalk220.red(`Symbol "${oldName}" not found in ${file}`));
|
|
34977
35232
|
process.exit(1);
|
|
34978
35233
|
}
|
|
34979
35234
|
const grouped = groupReferences(symbol, cwd);
|
|
34980
35235
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
34981
35236
|
console.log(
|
|
34982
|
-
|
|
35237
|
+
chalk220.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
34983
35238
|
`)
|
|
34984
35239
|
);
|
|
34985
35240
|
for (const [refFile, lines2] of grouped) {
|
|
34986
35241
|
console.log(
|
|
34987
|
-
` ${
|
|
35242
|
+
` ${chalk220.dim(refFile)}: lines ${chalk220.cyan(lines2.join(", "))}`
|
|
34988
35243
|
);
|
|
34989
35244
|
}
|
|
34990
35245
|
if (options2.apply) {
|
|
34991
35246
|
symbol.rename(newName);
|
|
34992
35247
|
await project.save();
|
|
34993
|
-
console.log(
|
|
35248
|
+
console.log(chalk220.green(`
|
|
34994
35249
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
34995
35250
|
} else {
|
|
34996
|
-
console.log(
|
|
35251
|
+
console.log(chalk220.dim("\nDry run. Use --apply to execute."));
|
|
34997
35252
|
}
|
|
34998
35253
|
}
|
|
34999
35254
|
|
|
35000
35255
|
// src/commands/refactor/restructure.ts
|
|
35001
35256
|
import fs37 from "fs";
|
|
35002
35257
|
import path82 from "path";
|
|
35003
|
-
import
|
|
35258
|
+
import chalk230 from "chalk";
|
|
35004
35259
|
|
|
35005
35260
|
// src/commands/refactor/restructure/buildPlan.ts
|
|
35006
35261
|
import path72 from "path";
|
|
@@ -35337,7 +35592,7 @@ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
|
|
|
35337
35592
|
}
|
|
35338
35593
|
|
|
35339
35594
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
35340
|
-
import
|
|
35595
|
+
import chalk225 from "chalk";
|
|
35341
35596
|
|
|
35342
35597
|
// src/commands/refactor/restructure/applyCommand.ts
|
|
35343
35598
|
import path73 from "path";
|
|
@@ -35348,13 +35603,13 @@ function applyCommand(scopeRoot) {
|
|
|
35348
35603
|
|
|
35349
35604
|
// src/commands/refactor/restructure/displayDrift.ts
|
|
35350
35605
|
import path74 from "path";
|
|
35351
|
-
import
|
|
35606
|
+
import chalk221 from "chalk";
|
|
35352
35607
|
var shownMoves = 20;
|
|
35353
35608
|
function displayDrift(plan2, listMoves) {
|
|
35354
35609
|
const rel = (file) => path74.relative(process.cwd(), file);
|
|
35355
35610
|
if (plan2.moves.length > 0) {
|
|
35356
35611
|
console.log(
|
|
35357
|
-
|
|
35612
|
+
chalk221.red(
|
|
35358
35613
|
`${plan2.moves.length} file(s) drift from the plan${listMoves ? ":" : "."}`
|
|
35359
35614
|
)
|
|
35360
35615
|
);
|
|
@@ -35362,17 +35617,17 @@ function displayDrift(plan2, listMoves) {
|
|
|
35362
35617
|
for (const move2 of plan2.moves.slice(0, shownMoves))
|
|
35363
35618
|
console.log(` ${rel(move2.from)} \u2192 ${rel(move2.to)}`);
|
|
35364
35619
|
if (plan2.moves.length > shownMoves)
|
|
35365
|
-
console.log(
|
|
35620
|
+
console.log(chalk221.dim(` \u2026and ${plan2.moves.length - shownMoves} more`));
|
|
35366
35621
|
}
|
|
35367
35622
|
}
|
|
35368
|
-
for (const error of plan2.errors) console.log(
|
|
35623
|
+
for (const error of plan2.errors) console.log(chalk221.red(error));
|
|
35369
35624
|
}
|
|
35370
35625
|
|
|
35371
35626
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
35372
|
-
import
|
|
35627
|
+
import chalk224 from "chalk";
|
|
35373
35628
|
|
|
35374
35629
|
// src/commands/refactor/restructure/displayDeepChains.ts
|
|
35375
|
-
import
|
|
35630
|
+
import chalk222 from "chalk";
|
|
35376
35631
|
var shownChains = 10;
|
|
35377
35632
|
function formatChain(chain2) {
|
|
35378
35633
|
const folders = chain2.folders.map((f) => `${f.name} (${f.files})`).join(" > ");
|
|
@@ -35382,28 +35637,28 @@ function displayDeepChains(chains, maxDepth) {
|
|
|
35382
35637
|
if (chains.length === 0) return;
|
|
35383
35638
|
const tooDeep = chains.reduce((sum3, c) => sum3 + c.tooDeep, 0);
|
|
35384
35639
|
console.log(
|
|
35385
|
-
|
|
35640
|
+
chalk222.red(
|
|
35386
35641
|
`
|
|
35387
35642
|
Plan exceeds restructure.maxDepth ${maxDepth}: ${tooDeep} file(s) deeper.`
|
|
35388
35643
|
)
|
|
35389
35644
|
);
|
|
35390
35645
|
console.log(
|
|
35391
|
-
|
|
35646
|
+
chalk222.bold(
|
|
35392
35647
|
"Deep chains, as folder (files beneath), most files too deep first:"
|
|
35393
35648
|
)
|
|
35394
35649
|
);
|
|
35395
35650
|
for (const chain2 of chains.slice(0, shownChains))
|
|
35396
35651
|
console.log(formatChain(chain2));
|
|
35397
35652
|
if (chains.length > shownChains)
|
|
35398
|
-
console.log(
|
|
35653
|
+
console.log(chalk222.dim(` \u2026and ${chains.length - shownChains} more`));
|
|
35399
35654
|
}
|
|
35400
35655
|
|
|
35401
35656
|
// src/commands/refactor/restructure/displayLongPaths.ts
|
|
35402
|
-
import
|
|
35657
|
+
import chalk223 from "chalk";
|
|
35403
35658
|
function displayLongPaths(longPaths, maxPathLength) {
|
|
35404
35659
|
if (longPaths.length === 0) return;
|
|
35405
35660
|
console.log(
|
|
35406
|
-
|
|
35661
|
+
chalk223.red(
|
|
35407
35662
|
`
|
|
35408
35663
|
Plan exceeds restructure.maxPathLength ${maxPathLength}: ${longPaths.length} repo-relative path(s) longer.`
|
|
35409
35664
|
)
|
|
@@ -35431,7 +35686,7 @@ function displayLayoutLimits(limits, apply) {
|
|
|
35431
35686
|
displayDeepChains(limits.chains, limits.maxDepth);
|
|
35432
35687
|
displayLongPaths(limits.longPaths, limits.maxPathLength);
|
|
35433
35688
|
console.log("");
|
|
35434
|
-
for (const line of pinSteps(apply)) console.log(
|
|
35689
|
+
for (const line of pinSteps(apply)) console.log(chalk224.yellow(line));
|
|
35435
35690
|
}
|
|
35436
35691
|
|
|
35437
35692
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
@@ -35443,14 +35698,14 @@ function checkPlan(plan2, limits) {
|
|
|
35443
35698
|
if (exceeds || plan2.errors.length > 0) process.exit(1);
|
|
35444
35699
|
if (plan2.moves.length > 0) {
|
|
35445
35700
|
console.log(
|
|
35446
|
-
|
|
35701
|
+
chalk225.yellow(
|
|
35447
35702
|
`
|
|
35448
35703
|
Run \`${apply}\` to move the files and rewrite their imports.`
|
|
35449
35704
|
)
|
|
35450
35705
|
);
|
|
35451
35706
|
process.exit(1);
|
|
35452
35707
|
}
|
|
35453
|
-
console.log(
|
|
35708
|
+
console.log(chalk225.green("Layout matches the restructure plan"));
|
|
35454
35709
|
}
|
|
35455
35710
|
|
|
35456
35711
|
// src/commands/refactor/restructure/findDeepChains.ts
|
|
@@ -35520,15 +35775,15 @@ function partitionIgnored(files) {
|
|
|
35520
35775
|
}
|
|
35521
35776
|
|
|
35522
35777
|
// src/commands/refactor/restructure/runPlan.ts
|
|
35523
|
-
import
|
|
35778
|
+
import chalk229 from "chalk";
|
|
35524
35779
|
|
|
35525
35780
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
35526
|
-
import
|
|
35781
|
+
import chalk227 from "chalk";
|
|
35527
35782
|
|
|
35528
35783
|
// src/commands/refactor/restructure/executePlan.ts
|
|
35529
35784
|
import fs36 from "fs";
|
|
35530
35785
|
import path78 from "path";
|
|
35531
|
-
import
|
|
35786
|
+
import chalk226 from "chalk";
|
|
35532
35787
|
function relPath(file) {
|
|
35533
35788
|
return path78.relative(process.cwd(), file);
|
|
35534
35789
|
}
|
|
@@ -35545,14 +35800,14 @@ function moveFiles(moves) {
|
|
|
35545
35800
|
fs36.mkdirSync(path78.dirname(move2.to), { recursive: true });
|
|
35546
35801
|
fs36.renameSync(staging, move2.to);
|
|
35547
35802
|
console.log(
|
|
35548
|
-
|
|
35803
|
+
chalk226.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
|
|
35549
35804
|
);
|
|
35550
35805
|
}
|
|
35551
35806
|
}
|
|
35552
35807
|
function removeIfEmpty(dir) {
|
|
35553
35808
|
if (!fs36.existsSync(dir) || fs36.readdirSync(dir).length > 0) return false;
|
|
35554
35809
|
fs36.rmdirSync(dir);
|
|
35555
|
-
console.log(
|
|
35810
|
+
console.log(chalk226.dim(` Removed empty directory ${relPath(dir)}`));
|
|
35556
35811
|
return true;
|
|
35557
35812
|
}
|
|
35558
35813
|
function removeEmptyDirectories(dirs, scopeRoot) {
|
|
@@ -35565,7 +35820,7 @@ function removeEmptyDirectories(dirs, scopeRoot) {
|
|
|
35565
35820
|
function executePlan(plan2) {
|
|
35566
35821
|
for (const [file, content] of applyRewrites(plan2.rewrites)) {
|
|
35567
35822
|
fs36.writeFileSync(file, content, "utf8");
|
|
35568
|
-
console.log(
|
|
35823
|
+
console.log(chalk226.cyan(` Rewrote imports in ${relPath(file)}`));
|
|
35569
35824
|
}
|
|
35570
35825
|
moveFiles(plan2.moves);
|
|
35571
35826
|
removeEmptyDirectories(
|
|
@@ -35577,17 +35832,17 @@ function executePlan(plan2) {
|
|
|
35577
35832
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
35578
35833
|
function applyPlan(plan2) {
|
|
35579
35834
|
if (plan2.errors.length > 0) {
|
|
35580
|
-
console.log(
|
|
35835
|
+
console.log(chalk227.red("\nResolve the errors above before applying."));
|
|
35581
35836
|
process.exit(1);
|
|
35582
35837
|
}
|
|
35583
|
-
console.log(
|
|
35838
|
+
console.log(chalk227.bold("\nApplying changes..."));
|
|
35584
35839
|
executePlan(plan2);
|
|
35585
|
-
console.log(
|
|
35840
|
+
console.log(chalk227.green("\nRestructuring complete"));
|
|
35586
35841
|
}
|
|
35587
35842
|
|
|
35588
35843
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
35589
35844
|
import path81 from "path";
|
|
35590
|
-
import
|
|
35845
|
+
import chalk228 from "chalk";
|
|
35591
35846
|
|
|
35592
35847
|
// src/commands/refactor/restructure/computeDepthStats.ts
|
|
35593
35848
|
import path79 from "path";
|
|
@@ -35638,17 +35893,17 @@ function relPath2(filePath) {
|
|
|
35638
35893
|
}
|
|
35639
35894
|
function displayMoves(plan2) {
|
|
35640
35895
|
if (plan2.moves.length === 0) return;
|
|
35641
|
-
console.log(
|
|
35896
|
+
console.log(chalk228.bold("\nFile moves:"));
|
|
35642
35897
|
for (const move2 of plan2.moves) {
|
|
35643
35898
|
console.log(
|
|
35644
|
-
` ${
|
|
35899
|
+
` ${chalk228.red(relPath2(move2.from))} \u2192 ${chalk228.green(relPath2(move2.to))}`
|
|
35645
35900
|
);
|
|
35646
|
-
console.log(
|
|
35901
|
+
console.log(chalk228.dim(` ${move2.reason}`));
|
|
35647
35902
|
}
|
|
35648
35903
|
}
|
|
35649
35904
|
function displayTree(plan2) {
|
|
35650
35905
|
console.log(
|
|
35651
|
-
|
|
35906
|
+
chalk228.bold(`
|
|
35652
35907
|
Resulting tree (${relPath2(plan2.scopeRoot) || "."}/):`)
|
|
35653
35908
|
);
|
|
35654
35909
|
for (const line of formatTree(plan2.targets.values(), plan2.scopeRoot))
|
|
@@ -35659,15 +35914,15 @@ function displayDepthStats(plan2) {
|
|
|
35659
35914
|
plan2.targets.values(),
|
|
35660
35915
|
plan2.scopeRoot
|
|
35661
35916
|
);
|
|
35662
|
-
console.log(
|
|
35917
|
+
console.log(chalk228.bold(`
|
|
35663
35918
|
Depth (max ${max}):`));
|
|
35664
35919
|
for (const depth of [...distribution.keys()].sort((a, b) => a - b))
|
|
35665
35920
|
console.log(` ${depth}: ${distribution.get(depth)} file(s)`);
|
|
35666
35921
|
}
|
|
35667
35922
|
function displayErrors(errors) {
|
|
35668
35923
|
if (errors.length === 0) return;
|
|
35669
|
-
console.log(
|
|
35670
|
-
for (const error of errors) console.log(
|
|
35924
|
+
console.log(chalk228.red("\nErrors:"));
|
|
35925
|
+
for (const error of errors) console.log(chalk228.red(` ${error}`));
|
|
35671
35926
|
}
|
|
35672
35927
|
function displayPlan2(plan2) {
|
|
35673
35928
|
displayMoves(plan2);
|
|
@@ -35676,7 +35931,7 @@ function displayPlan2(plan2) {
|
|
|
35676
35931
|
displayErrors(plan2.errors);
|
|
35677
35932
|
const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
|
|
35678
35933
|
console.log(
|
|
35679
|
-
|
|
35934
|
+
chalk228.dim(
|
|
35680
35935
|
`
|
|
35681
35936
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
|
|
35682
35937
|
)
|
|
@@ -35688,11 +35943,11 @@ function runPlan(plan2, limits, apply) {
|
|
|
35688
35943
|
displayPlan2(plan2);
|
|
35689
35944
|
displayLayoutLimits(limits, applyCommand(plan2.scopeRoot));
|
|
35690
35945
|
if (plan2.moves.length === 0 && plan2.errors.length === 0) {
|
|
35691
|
-
console.log(
|
|
35946
|
+
console.log(chalk229.green("No restructuring needed"));
|
|
35692
35947
|
return;
|
|
35693
35948
|
}
|
|
35694
35949
|
if (!apply) {
|
|
35695
|
-
console.log(
|
|
35950
|
+
console.log(chalk229.dim("\nDry run. Use --apply to execute."));
|
|
35696
35951
|
return;
|
|
35697
35952
|
}
|
|
35698
35953
|
applyPlan(plan2);
|
|
@@ -35702,14 +35957,14 @@ function runPlan(plan2, limits, apply) {
|
|
|
35702
35957
|
async function restructure(root2, options2 = {}) {
|
|
35703
35958
|
const scopeRoot = path82.resolve(root2 ?? "src");
|
|
35704
35959
|
if (!fs37.existsSync(scopeRoot) || !fs37.statSync(scopeRoot).isDirectory()) {
|
|
35705
|
-
console.log(
|
|
35960
|
+
console.log(chalk230.red(`Not a directory: ${root2 ?? "src"}`));
|
|
35706
35961
|
process.exit(1);
|
|
35707
35962
|
}
|
|
35708
35963
|
const found = [];
|
|
35709
35964
|
walkSourceFiles(scopeRoot, found);
|
|
35710
35965
|
const { scoped, ignored } = partitionIgnored(found);
|
|
35711
35966
|
if (scoped.length === 0) {
|
|
35712
|
-
console.log(
|
|
35967
|
+
console.log(chalk230.yellow("No files found under root"));
|
|
35713
35968
|
return;
|
|
35714
35969
|
}
|
|
35715
35970
|
const {
|
|
@@ -35767,10 +36022,10 @@ function registerRefactor(program) {
|
|
|
35767
36022
|
}
|
|
35768
36023
|
|
|
35769
36024
|
// src/commands/review/checkoutPrSession.ts
|
|
35770
|
-
import { randomUUID as
|
|
36025
|
+
import { randomUUID as randomUUID18 } from "crypto";
|
|
35771
36026
|
async function checkoutPrSession(number, prompt = "") {
|
|
35772
36027
|
await checkoutPr(number);
|
|
35773
|
-
const claudeSessionId =
|
|
36028
|
+
const claudeSessionId = randomUUID18();
|
|
35774
36029
|
emitActivity({ kind: "command", name: "review", claudeSessionId });
|
|
35775
36030
|
const { done: done2 } = spawnClaude(prompt, {
|
|
35776
36031
|
permissionMode: "auto",
|
|
@@ -35780,7 +36035,7 @@ async function checkoutPrSession(number, prompt = "") {
|
|
|
35780
36035
|
}
|
|
35781
36036
|
|
|
35782
36037
|
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
35783
|
-
import
|
|
36038
|
+
import chalk234 from "chalk";
|
|
35784
36039
|
|
|
35785
36040
|
// src/commands/config/promptConfigScope.ts
|
|
35786
36041
|
import Enquirer3 from "enquirer";
|
|
@@ -35806,7 +36061,7 @@ async function promptConfigScope() {
|
|
|
35806
36061
|
}
|
|
35807
36062
|
|
|
35808
36063
|
// src/commands/config/resolveConfigKeyAnswer.ts
|
|
35809
|
-
import
|
|
36064
|
+
import chalk231 from "chalk";
|
|
35810
36065
|
async function resolveConfigKeyAnswer(question, supplied) {
|
|
35811
36066
|
if (supplied !== void 0) return coerceSupplied(question.key, supplied);
|
|
35812
36067
|
for (; ; ) {
|
|
@@ -35814,7 +36069,7 @@ async function resolveConfigKeyAnswer(question, supplied) {
|
|
|
35814
36069
|
if (answer === "") return void 0;
|
|
35815
36070
|
const coercion = coerceCliConfigValue(question.key, answer);
|
|
35816
36071
|
if (coercion.ok) return coercion.value;
|
|
35817
|
-
console.error(
|
|
36072
|
+
console.error(chalk231.red(coercion.error));
|
|
35818
36073
|
}
|
|
35819
36074
|
}
|
|
35820
36075
|
function coerceSupplied(key, supplied) {
|
|
@@ -35894,7 +36149,7 @@ function suggestGlobs(current, proposed) {
|
|
|
35894
36149
|
}
|
|
35895
36150
|
|
|
35896
36151
|
// src/commands/review/highLevel/parseConfigureAnswers.ts
|
|
35897
|
-
import
|
|
36152
|
+
import chalk232 from "chalk";
|
|
35898
36153
|
function parseConfigureAnswers(answers) {
|
|
35899
36154
|
const known = Object.values(highLevelConfigKeys);
|
|
35900
36155
|
const parsed = {};
|
|
@@ -35912,13 +36167,13 @@ function answersCoverEveryKey(answers) {
|
|
|
35912
36167
|
return Object.values(highLevelConfigKeys).every((key) => key in answers);
|
|
35913
36168
|
}
|
|
35914
36169
|
function exitWith(message3) {
|
|
35915
|
-
console.error(
|
|
36170
|
+
console.error(chalk232.red(`Error: ${message3}.`));
|
|
35916
36171
|
process.exit(1);
|
|
35917
36172
|
}
|
|
35918
36173
|
|
|
35919
36174
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
35920
36175
|
import { execFileSync as execFileSync28 } from "child_process";
|
|
35921
|
-
import
|
|
36176
|
+
import chalk233 from "chalk";
|
|
35922
36177
|
|
|
35923
36178
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
35924
36179
|
function buildGlobProposalPrompt(tree) {
|
|
@@ -36012,12 +36267,12 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
36012
36267
|
const tree = summariseRepoTree(cwd);
|
|
36013
36268
|
if (tree === "") return NOTHING_PROPOSED;
|
|
36014
36269
|
console.log(
|
|
36015
|
-
|
|
36270
|
+
chalk233.dim("Asking Claude to propose globs from the repo's own tree...")
|
|
36016
36271
|
);
|
|
36017
36272
|
const output = askClaude(buildGlobProposalPrompt(tree), cwd);
|
|
36018
36273
|
if (output === void 0) {
|
|
36019
36274
|
console.log(
|
|
36020
|
-
|
|
36275
|
+
chalk233.yellow(
|
|
36021
36276
|
"Claude proposed nothing; answer each key from its current value."
|
|
36022
36277
|
)
|
|
36023
36278
|
);
|
|
@@ -36081,14 +36336,14 @@ function asConfigKeyScope(value) {
|
|
|
36081
36336
|
function reportConfigured(result) {
|
|
36082
36337
|
for (const write of result.written)
|
|
36083
36338
|
console.log(
|
|
36084
|
-
|
|
36339
|
+
chalk234.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
|
|
36085
36340
|
);
|
|
36086
|
-
for (const key of result.skipped) console.log(
|
|
36087
|
-
console.log(
|
|
36341
|
+
for (const key of result.skipped) console.log(chalk234.dim(`Left ${key} unset`));
|
|
36342
|
+
console.log(chalk234.dim(`Written to ${result.target}`));
|
|
36088
36343
|
}
|
|
36089
36344
|
|
|
36090
36345
|
// src/commands/review/highLevel/announceSavedReview.ts
|
|
36091
|
-
import
|
|
36346
|
+
import chalk235 from "chalk";
|
|
36092
36347
|
function savedMessage(subject) {
|
|
36093
36348
|
const head = subject.headSha.slice(0, 7);
|
|
36094
36349
|
if (subject.draft)
|
|
@@ -36099,10 +36354,10 @@ function savedMessage(subject) {
|
|
|
36099
36354
|
}
|
|
36100
36355
|
function announceSavedReview(subject, force) {
|
|
36101
36356
|
const message3 = savedMessage(subject);
|
|
36102
|
-
if (message3) console.log(
|
|
36357
|
+
if (message3) console.log(chalk235.dim(message3));
|
|
36103
36358
|
else if (force)
|
|
36104
36359
|
console.log(
|
|
36105
|
-
|
|
36360
|
+
chalk235.dim(
|
|
36106
36361
|
`Discarding any review saved for ${subject.headSha.slice(0, 7)} and starting fresh (--force).`
|
|
36107
36362
|
)
|
|
36108
36363
|
);
|
|
@@ -36835,7 +37090,7 @@ function gatherHighLevelSubject(prNumber, force) {
|
|
|
36835
37090
|
}
|
|
36836
37091
|
|
|
36837
37092
|
// src/commands/review/highLevel/openHighLevelOverlay.ts
|
|
36838
|
-
import { randomUUID as
|
|
37093
|
+
import { randomUUID as randomUUID20 } from "crypto";
|
|
36839
37094
|
|
|
36840
37095
|
// src/commands/review/highLevel/highLevelProgress.ts
|
|
36841
37096
|
function toItem2(check2, decision) {
|
|
@@ -37094,7 +37349,7 @@ function splitQueuedComments(record) {
|
|
|
37094
37349
|
}
|
|
37095
37350
|
|
|
37096
37351
|
// src/commands/review/highLevel/previewHighLevelReview.ts
|
|
37097
|
-
import { randomUUID as
|
|
37352
|
+
import { randomUUID as randomUUID19 } from "crypto";
|
|
37098
37353
|
|
|
37099
37354
|
// src/commands/review/highLevel/formatHighLevelReviewPreview.ts
|
|
37100
37355
|
function formatHighLevelReviewPreview(lineLevel, body) {
|
|
@@ -37121,7 +37376,7 @@ async function previewHighLevelReview(sessionId, record, submission) {
|
|
|
37121
37376
|
"Review",
|
|
37122
37377
|
{
|
|
37123
37378
|
sessionId,
|
|
37124
|
-
requestId:
|
|
37379
|
+
requestId: randomUUID19(),
|
|
37125
37380
|
title: `${LABELS[submission.event]} ${record.repo}#${record.prNumber}`,
|
|
37126
37381
|
body: formatHighLevelReviewPreview(submission.comments, submission.body),
|
|
37127
37382
|
prNumber: record.prNumber,
|
|
@@ -37172,7 +37427,7 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
37172
37427
|
"High-level review",
|
|
37173
37428
|
{
|
|
37174
37429
|
sessionId,
|
|
37175
|
-
requestId:
|
|
37430
|
+
requestId: randomUUID20(),
|
|
37176
37431
|
title: `${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`,
|
|
37177
37432
|
body: JSON.stringify(highLevelPreviewPayload(subject)),
|
|
37178
37433
|
prNumber: subject.prNumber,
|
|
@@ -37197,55 +37452,55 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
37197
37452
|
}
|
|
37198
37453
|
|
|
37199
37454
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
37200
|
-
import
|
|
37455
|
+
import chalk240 from "chalk";
|
|
37201
37456
|
|
|
37202
37457
|
// src/commands/review/highLevel/formatCriticalDiffs.ts
|
|
37203
|
-
import
|
|
37458
|
+
import chalk236 from "chalk";
|
|
37204
37459
|
var PATCH_LINE_COLOURS = {
|
|
37205
|
-
"+":
|
|
37206
|
-
"-":
|
|
37207
|
-
"@":
|
|
37460
|
+
"+": chalk236.green,
|
|
37461
|
+
"-": chalk236.red,
|
|
37462
|
+
"@": chalk236.cyan
|
|
37208
37463
|
};
|
|
37209
37464
|
function formatPatch(patch2) {
|
|
37210
37465
|
return patch2.split("\n").map(
|
|
37211
|
-
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ??
|
|
37466
|
+
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk236.dim)(line)}`
|
|
37212
37467
|
);
|
|
37213
37468
|
}
|
|
37214
37469
|
function formatDiff(diff3) {
|
|
37215
37470
|
return [
|
|
37216
37471
|
"",
|
|
37217
|
-
` ${
|
|
37218
|
-
...diff3.patch === null ? [` ${
|
|
37472
|
+
` ${chalk236.bold(diff3.path)} ${chalk236.dim(`(${diff3.status})`)} ${chalk236.green(`+${diff3.additions}`)} ${chalk236.red(`-${diff3.deletions}`)}`,
|
|
37473
|
+
...diff3.patch === null ? [` ${chalk236.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
|
|
37219
37474
|
];
|
|
37220
37475
|
}
|
|
37221
37476
|
function formatCriticalDiffs(diffs, criticalPaths) {
|
|
37222
37477
|
if (criticalPaths.length === 0)
|
|
37223
|
-
return `${
|
|
37224
|
-
${
|
|
37478
|
+
return `${chalk236.bold.underline("Critical diffs")}
|
|
37479
|
+
${chalk236.dim("review.highLevel.criticalPaths is empty, so no diffs are shown")}`;
|
|
37225
37480
|
if (diffs.length === 0)
|
|
37226
|
-
return `${
|
|
37227
|
-
${
|
|
37481
|
+
return `${chalk236.bold.underline("Critical diffs")}
|
|
37482
|
+
${chalk236.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
|
|
37228
37483
|
return [
|
|
37229
|
-
|
|
37484
|
+
chalk236.bold.underline("Critical diffs"),
|
|
37230
37485
|
...diffs.flatMap(formatDiff)
|
|
37231
37486
|
].join("\n");
|
|
37232
37487
|
}
|
|
37233
37488
|
|
|
37234
37489
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
37235
|
-
import
|
|
37490
|
+
import chalk237 from "chalk";
|
|
37236
37491
|
var MARKERS = {
|
|
37237
|
-
pass: () =>
|
|
37238
|
-
fail: () =>
|
|
37239
|
-
manual: () =>
|
|
37492
|
+
pass: () => chalk237.green("\u2714"),
|
|
37493
|
+
fail: () => chalk237.red("\u2718"),
|
|
37494
|
+
manual: () => chalk237.yellow("\u25A1")
|
|
37240
37495
|
};
|
|
37241
37496
|
function formatCheck(check2) {
|
|
37242
|
-
const title = check2.status === "fail" ?
|
|
37497
|
+
const title = check2.status === "fail" ? chalk237.red(check2.title) : chalk237.bold(check2.title);
|
|
37243
37498
|
return ` ${MARKERS[check2.status]()} ${title}
|
|
37244
|
-
${
|
|
37499
|
+
${chalk237.dim(check2.reason)}`;
|
|
37245
37500
|
}
|
|
37246
37501
|
function formatGroup(heading2, checks2) {
|
|
37247
37502
|
if (checks2.length === 0) return [];
|
|
37248
|
-
return ["",
|
|
37503
|
+
return ["", chalk237.bold.underline(heading2), ...checks2.map(formatCheck)];
|
|
37249
37504
|
}
|
|
37250
37505
|
function formatHighLevelChecklist(checks2) {
|
|
37251
37506
|
const deterministic = checks2.filter(
|
|
@@ -37254,7 +37509,7 @@ function formatHighLevelChecklist(checks2) {
|
|
|
37254
37509
|
const failed3 = deterministic.filter(
|
|
37255
37510
|
(check2) => check2.status === "fail"
|
|
37256
37511
|
).length;
|
|
37257
|
-
const summary = failed3 === 0 ?
|
|
37512
|
+
const summary = failed3 === 0 ? chalk237.green(`All ${deterministic.length} deterministic checks pass`) : chalk237.red(
|
|
37258
37513
|
`${failed3} of ${deterministic.length} deterministic checks fail`
|
|
37259
37514
|
);
|
|
37260
37515
|
return [
|
|
@@ -37269,37 +37524,37 @@ function formatHighLevelChecklist(checks2) {
|
|
|
37269
37524
|
}
|
|
37270
37525
|
|
|
37271
37526
|
// src/commands/review/highLevel/formatHighLevelStructure.ts
|
|
37272
|
-
import
|
|
37527
|
+
import chalk238 from "chalk";
|
|
37273
37528
|
var STATUS_MARKERS = {
|
|
37274
|
-
added: () =>
|
|
37275
|
-
removed: () =>
|
|
37276
|
-
modified: () =>
|
|
37529
|
+
added: () => chalk238.green("A"),
|
|
37530
|
+
removed: () => chalk238.red("D"),
|
|
37531
|
+
modified: () => chalk238.yellow("M")
|
|
37277
37532
|
};
|
|
37278
37533
|
function counts(additions, deletions) {
|
|
37279
|
-
return `${
|
|
37534
|
+
return `${chalk238.green(`+${additions}`)} ${chalk238.red(`-${deletions}`)}`;
|
|
37280
37535
|
}
|
|
37281
37536
|
function formatNode(node, indent3) {
|
|
37282
37537
|
if (node.kind === "file")
|
|
37283
37538
|
return [
|
|
37284
|
-
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${
|
|
37539
|
+
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk238.dim(counts(node.additions, node.deletions))}`
|
|
37285
37540
|
];
|
|
37286
37541
|
const dir = node;
|
|
37287
37542
|
return [
|
|
37288
|
-
`${indent3}${
|
|
37543
|
+
`${indent3}${chalk238.bold(`${dir.name}/`)} ${chalk238.dim(counts(dir.additions, dir.deletions))}`,
|
|
37289
37544
|
...dir.children.flatMap((child) => formatNode(child, `${indent3} `))
|
|
37290
37545
|
];
|
|
37291
37546
|
}
|
|
37292
37547
|
function formatHighLevelStructure(structure) {
|
|
37293
37548
|
const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
|
|
37294
37549
|
return [
|
|
37295
|
-
|
|
37550
|
+
chalk238.bold.underline("Structure"),
|
|
37296
37551
|
` ${summary}`,
|
|
37297
37552
|
...structure.tree.flatMap((node) => formatNode(node, " "))
|
|
37298
37553
|
].join("\n");
|
|
37299
37554
|
}
|
|
37300
37555
|
|
|
37301
37556
|
// src/commands/review/highLevel/formatHighLevelTests.ts
|
|
37302
|
-
import
|
|
37557
|
+
import chalk239 from "chalk";
|
|
37303
37558
|
function changeMarker(change) {
|
|
37304
37559
|
if (change === "added") return "A";
|
|
37305
37560
|
if (change === "modified") return "M";
|
|
@@ -37308,22 +37563,22 @@ function changeMarker(change) {
|
|
|
37308
37563
|
function formatNode2(node, depth) {
|
|
37309
37564
|
const indent3 = " ".repeat(depth + 2);
|
|
37310
37565
|
if (node.kind === "it")
|
|
37311
|
-
return [`${indent3}${
|
|
37566
|
+
return [`${indent3}${chalk239.dim(changeMarker(node.change))} ${node.name}`];
|
|
37312
37567
|
return [
|
|
37313
|
-
`${indent3}${
|
|
37568
|
+
`${indent3}${chalk239.bold(node.name)}`,
|
|
37314
37569
|
...node.children.flatMap((child) => formatNode2(child, depth + 1))
|
|
37315
37570
|
];
|
|
37316
37571
|
}
|
|
37317
37572
|
function formatHighLevelTests(files, testPaths) {
|
|
37318
|
-
const heading2 =
|
|
37573
|
+
const heading2 = chalk239.bold.underline("Changed tests");
|
|
37319
37574
|
if (files.length === 0)
|
|
37320
37575
|
return `${heading2}
|
|
37321
|
-
${
|
|
37576
|
+
${chalk239.dim(`no changed test in files matching ${testPaths.join(", ")}`)}`;
|
|
37322
37577
|
return [
|
|
37323
37578
|
heading2,
|
|
37324
37579
|
...files.flatMap((file) => [
|
|
37325
37580
|
"",
|
|
37326
|
-
` ${
|
|
37581
|
+
` ${chalk239.bold(file.path)} ${chalk239.dim(`(${file.status})`)}`,
|
|
37327
37582
|
...file.tests.flatMap((node) => formatNode2(node, 0))
|
|
37328
37583
|
])
|
|
37329
37584
|
].join("\n");
|
|
@@ -37337,10 +37592,10 @@ function highLevelChangedFileCount(structure) {
|
|
|
37337
37592
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
37338
37593
|
function printHighLevelChecklist(subject) {
|
|
37339
37594
|
console.log(
|
|
37340
|
-
|
|
37595
|
+
chalk240.bold(
|
|
37341
37596
|
`High-level review of ${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`
|
|
37342
37597
|
),
|
|
37343
|
-
|
|
37598
|
+
chalk240.dim(
|
|
37344
37599
|
`\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
|
|
37345
37600
|
)
|
|
37346
37601
|
);
|
|
@@ -37354,12 +37609,12 @@ function printHighLevelChecklist(subject) {
|
|
|
37354
37609
|
console.log("");
|
|
37355
37610
|
console.log(formatHighLevelTests(subject.tests, subject.testPaths));
|
|
37356
37611
|
console.log(
|
|
37357
|
-
|
|
37612
|
+
chalk240.dim(
|
|
37358
37613
|
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
37359
37614
|
)
|
|
37360
37615
|
);
|
|
37361
37616
|
console.log(
|
|
37362
|
-
|
|
37617
|
+
chalk240.dim(
|
|
37363
37618
|
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
37364
37619
|
)
|
|
37365
37620
|
);
|
|
@@ -37645,18 +37900,18 @@ function partitionFindingsByDiff(findings, index2) {
|
|
|
37645
37900
|
}
|
|
37646
37901
|
|
|
37647
37902
|
// src/commands/review/warnOutOfDiff.ts
|
|
37648
|
-
import
|
|
37903
|
+
import chalk241 from "chalk";
|
|
37649
37904
|
function warnOutOfDiff(outOfDiff) {
|
|
37650
37905
|
if (outOfDiff.length === 0) return;
|
|
37651
37906
|
console.warn(
|
|
37652
|
-
|
|
37907
|
+
chalk241.yellow(
|
|
37653
37908
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
37654
37909
|
)
|
|
37655
37910
|
);
|
|
37656
37911
|
for (const finding of outOfDiff) {
|
|
37657
37912
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
37658
37913
|
console.warn(
|
|
37659
|
-
` ${
|
|
37914
|
+
` ${chalk241.yellow("\xB7")} ${finding.title} ${chalk241.dim(
|
|
37660
37915
|
`(${finding.file}:${range})`
|
|
37661
37916
|
)}`
|
|
37662
37917
|
);
|
|
@@ -37680,18 +37935,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
37680
37935
|
}
|
|
37681
37936
|
|
|
37682
37937
|
// src/commands/review/warnUnlocated.ts
|
|
37683
|
-
import
|
|
37938
|
+
import chalk242 from "chalk";
|
|
37684
37939
|
function warnUnlocated(unlocated) {
|
|
37685
37940
|
if (unlocated.length === 0) return;
|
|
37686
37941
|
console.warn(
|
|
37687
|
-
|
|
37942
|
+
chalk242.yellow(
|
|
37688
37943
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
37689
37944
|
)
|
|
37690
37945
|
);
|
|
37691
37946
|
for (const finding of unlocated) {
|
|
37692
|
-
const where = finding.location ||
|
|
37947
|
+
const where = finding.location || chalk242.dim("missing");
|
|
37693
37948
|
console.warn(
|
|
37694
|
-
` ${
|
|
37949
|
+
` ${chalk242.yellow("\xB7")} ${finding.title} ${chalk242.dim(`(${where})`)}`
|
|
37695
37950
|
);
|
|
37696
37951
|
}
|
|
37697
37952
|
}
|
|
@@ -39834,7 +40089,7 @@ function registerReview(program) {
|
|
|
39834
40089
|
// src/commands/rules/addRule.ts
|
|
39835
40090
|
import { existsSync as existsSync72, readFileSync as readFileSync56, writeFileSync as writeFileSync43 } from "fs";
|
|
39836
40091
|
import path87 from "path";
|
|
39837
|
-
import
|
|
40092
|
+
import chalk243 from "chalk";
|
|
39838
40093
|
|
|
39839
40094
|
// src/commands/rules/insertRuleBullet.ts
|
|
39840
40095
|
function ruleBullet({ code, title, text: text17 }) {
|
|
@@ -39970,7 +40225,7 @@ function read2(file) {
|
|
|
39970
40225
|
function addRule(text17, options2) {
|
|
39971
40226
|
const rule = text17.trim();
|
|
39972
40227
|
if (rule === "") {
|
|
39973
|
-
console.error(
|
|
40228
|
+
console.error(chalk243.red("Rule text is required"));
|
|
39974
40229
|
process.exitCode = 1;
|
|
39975
40230
|
return;
|
|
39976
40231
|
}
|
|
@@ -39988,13 +40243,13 @@ function addRule(text17, options2) {
|
|
|
39988
40243
|
);
|
|
39989
40244
|
updateScopedRulesIndex(root2);
|
|
39990
40245
|
console.log(
|
|
39991
|
-
`Added ${
|
|
40246
|
+
`Added ${chalk243.cyan(code)} to ${path87.relative(process.cwd(), target) || target}`
|
|
39992
40247
|
);
|
|
39993
40248
|
}
|
|
39994
40249
|
|
|
39995
40250
|
// src/commands/rules/indexRules.ts
|
|
39996
40251
|
import path88 from "path";
|
|
39997
|
-
import
|
|
40252
|
+
import chalk244 from "chalk";
|
|
39998
40253
|
function indexRules() {
|
|
39999
40254
|
const startDir = scopeDirectory(process.cwd());
|
|
40000
40255
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
@@ -40002,24 +40257,24 @@ function indexRules() {
|
|
|
40002
40257
|
const rootFile = path88.relative(process.cwd(), path88.join(root2, "CLAUDE.md"));
|
|
40003
40258
|
if (directories.length === 0) {
|
|
40004
40259
|
console.log(
|
|
40005
|
-
|
|
40260
|
+
chalk244.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
40006
40261
|
);
|
|
40007
40262
|
return;
|
|
40008
40263
|
}
|
|
40009
40264
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
40010
40265
|
for (const directory of directories)
|
|
40011
|
-
console.log(` ${
|
|
40266
|
+
console.log(` ${chalk244.cyan(directory)}`);
|
|
40012
40267
|
}
|
|
40013
40268
|
|
|
40014
40269
|
// src/commands/rules/listRules.ts
|
|
40015
40270
|
import path89 from "path";
|
|
40016
|
-
import
|
|
40271
|
+
import chalk245 from "chalk";
|
|
40017
40272
|
function listRules(target, options2 = {}) {
|
|
40018
40273
|
const resolved = path89.resolve(target ?? process.cwd());
|
|
40019
40274
|
const rules2 = readScopedRules(resolved);
|
|
40020
40275
|
if (rules2.length === 0) {
|
|
40021
40276
|
const label2 = path89.relative(process.cwd(), resolved) || ".";
|
|
40022
|
-
console.log(
|
|
40277
|
+
console.log(chalk245.gray(`No rules in scope for ${label2}`));
|
|
40023
40278
|
return;
|
|
40024
40279
|
}
|
|
40025
40280
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -40029,14 +40284,14 @@ function listRules(target, options2 = {}) {
|
|
|
40029
40284
|
if (rule.source !== shown) {
|
|
40030
40285
|
shown = rule.source;
|
|
40031
40286
|
console.log(
|
|
40032
|
-
|
|
40287
|
+
chalk245.dim(base ? path89.relative(base, rule.source) : rule.source)
|
|
40033
40288
|
);
|
|
40034
40289
|
}
|
|
40035
40290
|
console.log(
|
|
40036
|
-
` ${
|
|
40291
|
+
` ${chalk245.cyan(rule.code.padEnd(width2))} ${rule.title ?? rule.text}`
|
|
40037
40292
|
);
|
|
40038
40293
|
if (options2.full && rule.title)
|
|
40039
|
-
console.log(` ${" ".repeat(width2)} ${
|
|
40294
|
+
console.log(` ${" ".repeat(width2)} ${chalk245.dim(rule.text)}`);
|
|
40040
40295
|
}
|
|
40041
40296
|
}
|
|
40042
40297
|
|
|
@@ -40071,7 +40326,7 @@ function registerRules(program) {
|
|
|
40071
40326
|
}
|
|
40072
40327
|
|
|
40073
40328
|
// src/commands/seq/seqAuth.ts
|
|
40074
|
-
import
|
|
40329
|
+
import chalk247 from "chalk";
|
|
40075
40330
|
|
|
40076
40331
|
// src/commands/seq/loadConnections.ts
|
|
40077
40332
|
function loadConnections2() {
|
|
@@ -40100,10 +40355,10 @@ function setDefaultConnection(name) {
|
|
|
40100
40355
|
}
|
|
40101
40356
|
|
|
40102
40357
|
// src/shared/assertUniqueName.ts
|
|
40103
|
-
import
|
|
40358
|
+
import chalk246 from "chalk";
|
|
40104
40359
|
function assertUniqueName(existingNames, name) {
|
|
40105
40360
|
if (existingNames.includes(name)) {
|
|
40106
|
-
console.error(
|
|
40361
|
+
console.error(chalk246.red(`Connection "${name}" already exists.`));
|
|
40107
40362
|
process.exit(1);
|
|
40108
40363
|
}
|
|
40109
40364
|
}
|
|
@@ -40121,16 +40376,16 @@ async function promptConnection2(existingNames) {
|
|
|
40121
40376
|
var seqAuth = createConnectionAuth({
|
|
40122
40377
|
load: loadConnections2,
|
|
40123
40378
|
save: saveConnections2,
|
|
40124
|
-
format: (c) => `${
|
|
40379
|
+
format: (c) => `${chalk247.bold(c.name)} ${c.url}`,
|
|
40125
40380
|
promptNew: promptConnection2,
|
|
40126
40381
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
40127
40382
|
});
|
|
40128
40383
|
|
|
40129
40384
|
// src/commands/seq/seqQuery.ts
|
|
40130
|
-
import
|
|
40385
|
+
import chalk251 from "chalk";
|
|
40131
40386
|
|
|
40132
40387
|
// src/commands/seq/fetchSeq.ts
|
|
40133
|
-
import
|
|
40388
|
+
import chalk248 from "chalk";
|
|
40134
40389
|
async function fetchSeq(conn, path108, params) {
|
|
40135
40390
|
const url = `${conn.url}${path108}?${params}`;
|
|
40136
40391
|
const response = await fetch(url, {
|
|
@@ -40141,7 +40396,7 @@ async function fetchSeq(conn, path108, params) {
|
|
|
40141
40396
|
});
|
|
40142
40397
|
if (!response.ok) {
|
|
40143
40398
|
const body = await response.text();
|
|
40144
|
-
console.error(
|
|
40399
|
+
console.error(chalk248.red(`Seq returned ${response.status}: ${body}`));
|
|
40145
40400
|
process.exit(1);
|
|
40146
40401
|
}
|
|
40147
40402
|
return response;
|
|
@@ -40200,23 +40455,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
40200
40455
|
}
|
|
40201
40456
|
|
|
40202
40457
|
// src/commands/seq/formatEvent.ts
|
|
40203
|
-
import
|
|
40458
|
+
import chalk249 from "chalk";
|
|
40204
40459
|
function levelColor(level) {
|
|
40205
40460
|
switch (level) {
|
|
40206
40461
|
case "Fatal":
|
|
40207
|
-
return
|
|
40462
|
+
return chalk249.bgRed.white;
|
|
40208
40463
|
case "Error":
|
|
40209
|
-
return
|
|
40464
|
+
return chalk249.red;
|
|
40210
40465
|
case "Warning":
|
|
40211
|
-
return
|
|
40466
|
+
return chalk249.yellow;
|
|
40212
40467
|
case "Information":
|
|
40213
|
-
return
|
|
40468
|
+
return chalk249.cyan;
|
|
40214
40469
|
case "Debug":
|
|
40215
|
-
return
|
|
40470
|
+
return chalk249.gray;
|
|
40216
40471
|
case "Verbose":
|
|
40217
|
-
return
|
|
40472
|
+
return chalk249.dim;
|
|
40218
40473
|
default:
|
|
40219
|
-
return
|
|
40474
|
+
return chalk249.white;
|
|
40220
40475
|
}
|
|
40221
40476
|
}
|
|
40222
40477
|
function levelAbbrev(level) {
|
|
@@ -40257,12 +40512,12 @@ function formatTimestamp(iso) {
|
|
|
40257
40512
|
function formatEvent(event) {
|
|
40258
40513
|
const color = levelColor(event.Level);
|
|
40259
40514
|
const abbrev = levelAbbrev(event.Level);
|
|
40260
|
-
const ts10 =
|
|
40515
|
+
const ts10 = chalk249.dim(formatTimestamp(event.Timestamp));
|
|
40261
40516
|
const msg = renderMessage(event);
|
|
40262
40517
|
const lines2 = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
|
|
40263
40518
|
if (event.Exception) {
|
|
40264
40519
|
for (const line of event.Exception.split("\n")) {
|
|
40265
|
-
lines2.push(
|
|
40520
|
+
lines2.push(chalk249.red(` ${line}`));
|
|
40266
40521
|
}
|
|
40267
40522
|
}
|
|
40268
40523
|
return lines2.join("\n");
|
|
@@ -40295,11 +40550,11 @@ function rejectTimestampFilter(filter) {
|
|
|
40295
40550
|
}
|
|
40296
40551
|
|
|
40297
40552
|
// src/shared/resolveNamedConnection.ts
|
|
40298
|
-
import
|
|
40553
|
+
import chalk250 from "chalk";
|
|
40299
40554
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
40300
40555
|
if (connections.length === 0) {
|
|
40301
40556
|
console.error(
|
|
40302
|
-
|
|
40557
|
+
chalk250.red(
|
|
40303
40558
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
40304
40559
|
)
|
|
40305
40560
|
);
|
|
@@ -40308,7 +40563,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
40308
40563
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
40309
40564
|
const connection = connections.find((c) => c.name === target);
|
|
40310
40565
|
if (!connection) {
|
|
40311
|
-
console.error(
|
|
40566
|
+
console.error(chalk250.red(`${kind} connection "${target}" not found.`));
|
|
40312
40567
|
process.exit(1);
|
|
40313
40568
|
}
|
|
40314
40569
|
return connection;
|
|
@@ -40337,7 +40592,7 @@ async function seqQuery(filter, options2) {
|
|
|
40337
40592
|
new URLSearchParams({ filter, count: String(count10) })
|
|
40338
40593
|
);
|
|
40339
40594
|
if (events.length === 0) {
|
|
40340
|
-
console.log(
|
|
40595
|
+
console.log(chalk251.yellow("No events found."));
|
|
40341
40596
|
return;
|
|
40342
40597
|
}
|
|
40343
40598
|
if (options2.json) {
|
|
@@ -40348,11 +40603,11 @@ async function seqQuery(filter, options2) {
|
|
|
40348
40603
|
for (const event of chronological) {
|
|
40349
40604
|
console.log(formatEvent(event));
|
|
40350
40605
|
}
|
|
40351
|
-
console.log(
|
|
40606
|
+
console.log(chalk251.dim(`
|
|
40352
40607
|
${events.length} events`));
|
|
40353
40608
|
if (events.length >= count10) {
|
|
40354
40609
|
console.log(
|
|
40355
|
-
|
|
40610
|
+
chalk251.yellow(
|
|
40356
40611
|
`Results limited to ${count10}. Use --count to retrieve more.`
|
|
40357
40612
|
)
|
|
40358
40613
|
);
|
|
@@ -40360,10 +40615,10 @@ ${events.length} events`));
|
|
|
40360
40615
|
}
|
|
40361
40616
|
|
|
40362
40617
|
// src/shared/setNamedDefaultConnection.ts
|
|
40363
|
-
import
|
|
40618
|
+
import chalk252 from "chalk";
|
|
40364
40619
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
40365
40620
|
if (!connections.find((c) => c.name === name)) {
|
|
40366
|
-
console.error(
|
|
40621
|
+
console.error(chalk252.red(`Connection "${name}" not found.`));
|
|
40367
40622
|
process.exit(1);
|
|
40368
40623
|
}
|
|
40369
40624
|
setDefault(name);
|
|
@@ -40399,7 +40654,7 @@ function registerSeq(program) {
|
|
|
40399
40654
|
}
|
|
40400
40655
|
|
|
40401
40656
|
// src/commands/show.ts
|
|
40402
|
-
import { randomUUID as
|
|
40657
|
+
import { randomUUID as randomUUID21 } from "crypto";
|
|
40403
40658
|
|
|
40404
40659
|
// src/commands/sessions/shared/sendShowPreview.ts
|
|
40405
40660
|
async function sendShowPreview(request) {
|
|
@@ -40451,7 +40706,7 @@ async function show3(options2) {
|
|
|
40451
40706
|
try {
|
|
40452
40707
|
await sendShowPreview({
|
|
40453
40708
|
sessionId,
|
|
40454
|
-
requestId:
|
|
40709
|
+
requestId: randomUUID21(),
|
|
40455
40710
|
title: options2.title ?? "Show",
|
|
40456
40711
|
body
|
|
40457
40712
|
});
|
|
@@ -40535,7 +40790,7 @@ function readSlackParts(files) {
|
|
|
40535
40790
|
}
|
|
40536
40791
|
|
|
40537
40792
|
// src/commands/slack/reviewProposedSlackMessage.ts
|
|
40538
|
-
import { randomUUID as
|
|
40793
|
+
import { randomUUID as randomUUID22 } from "crypto";
|
|
40539
40794
|
async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
40540
40795
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
40541
40796
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
@@ -40545,7 +40800,7 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
40545
40800
|
part ? `Slack message ${part.index} of ${part.total}` : "Slack message preview",
|
|
40546
40801
|
{
|
|
40547
40802
|
sessionId,
|
|
40548
|
-
requestId:
|
|
40803
|
+
requestId: randomUUID22(),
|
|
40549
40804
|
title: part ? `${destination} (${part.index}/${part.total})` : destination,
|
|
40550
40805
|
body,
|
|
40551
40806
|
prNumber: null,
|
|
@@ -40665,7 +40920,7 @@ function registerSlack(program) {
|
|
|
40665
40920
|
}
|
|
40666
40921
|
|
|
40667
40922
|
// src/commands/sql/sqlAuth.ts
|
|
40668
|
-
import
|
|
40923
|
+
import chalk254 from "chalk";
|
|
40669
40924
|
|
|
40670
40925
|
// src/commands/sql/loadConnections.ts
|
|
40671
40926
|
function loadConnections3() {
|
|
@@ -40694,7 +40949,7 @@ function setDefaultConnection2(name) {
|
|
|
40694
40949
|
}
|
|
40695
40950
|
|
|
40696
40951
|
// src/commands/sql/promptConnection.ts
|
|
40697
|
-
import
|
|
40952
|
+
import chalk253 from "chalk";
|
|
40698
40953
|
async function promptConnection3(existingNames) {
|
|
40699
40954
|
const name = await promptInput("name", "Connection name:", "default");
|
|
40700
40955
|
assertUniqueName(existingNames, name);
|
|
@@ -40702,7 +40957,7 @@ async function promptConnection3(existingNames) {
|
|
|
40702
40957
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
40703
40958
|
const port = Number.parseInt(portStr, 10);
|
|
40704
40959
|
if (!Number.isFinite(port)) {
|
|
40705
|
-
console.error(
|
|
40960
|
+
console.error(chalk253.red(`Invalid port "${portStr}".`));
|
|
40706
40961
|
process.exit(1);
|
|
40707
40962
|
}
|
|
40708
40963
|
const user = await promptInput("user", "User:");
|
|
@@ -40715,13 +40970,13 @@ async function promptConnection3(existingNames) {
|
|
|
40715
40970
|
var sqlAuth = createConnectionAuth({
|
|
40716
40971
|
load: loadConnections3,
|
|
40717
40972
|
save: saveConnections3,
|
|
40718
|
-
format: (c) => `${
|
|
40973
|
+
format: (c) => `${chalk254.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
40719
40974
|
promptNew: promptConnection3,
|
|
40720
40975
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
40721
40976
|
});
|
|
40722
40977
|
|
|
40723
40978
|
// src/commands/sql/printTable.ts
|
|
40724
|
-
import
|
|
40979
|
+
import chalk255 from "chalk";
|
|
40725
40980
|
function formatCell(value) {
|
|
40726
40981
|
if (value === null || value === void 0) return "";
|
|
40727
40982
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -40730,7 +40985,7 @@ function formatCell(value) {
|
|
|
40730
40985
|
}
|
|
40731
40986
|
function printTable(rows) {
|
|
40732
40987
|
if (rows.length === 0) {
|
|
40733
|
-
console.log(
|
|
40988
|
+
console.log(chalk255.yellow("(no rows)"));
|
|
40734
40989
|
return;
|
|
40735
40990
|
}
|
|
40736
40991
|
const columns = Object.keys(rows[0]);
|
|
@@ -40738,13 +40993,13 @@ function printTable(rows) {
|
|
|
40738
40993
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
40739
40994
|
);
|
|
40740
40995
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
40741
|
-
console.log(
|
|
40742
|
-
console.log(
|
|
40996
|
+
console.log(chalk255.dim(header));
|
|
40997
|
+
console.log(chalk255.dim("-".repeat(header.length)));
|
|
40743
40998
|
for (const row3 of rows) {
|
|
40744
40999
|
const line = columns.map((c, i) => formatCell(row3[c]).padEnd(widths[i])).join(" ");
|
|
40745
41000
|
console.log(line);
|
|
40746
41001
|
}
|
|
40747
|
-
console.log(
|
|
41002
|
+
console.log(chalk255.dim(`
|
|
40748
41003
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
40749
41004
|
}
|
|
40750
41005
|
|
|
@@ -40804,7 +41059,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
40804
41059
|
}
|
|
40805
41060
|
|
|
40806
41061
|
// src/commands/sql/sqlMutate.ts
|
|
40807
|
-
import
|
|
41062
|
+
import chalk256 from "chalk";
|
|
40808
41063
|
|
|
40809
41064
|
// src/commands/sql/isMutation.ts
|
|
40810
41065
|
var MUTATION_KEYWORDS = [
|
|
@@ -40838,7 +41093,7 @@ function isMutation(sql27) {
|
|
|
40838
41093
|
async function sqlMutate(query, connectionName) {
|
|
40839
41094
|
if (!isMutation(query)) {
|
|
40840
41095
|
console.error(
|
|
40841
|
-
|
|
41096
|
+
chalk256.red(
|
|
40842
41097
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
40843
41098
|
)
|
|
40844
41099
|
);
|
|
@@ -40848,18 +41103,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
40848
41103
|
const pool = await sqlConnect(conn);
|
|
40849
41104
|
try {
|
|
40850
41105
|
const result = await pool.request().query(query);
|
|
40851
|
-
console.log(
|
|
41106
|
+
console.log(chalk256.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
40852
41107
|
} finally {
|
|
40853
41108
|
await pool.close();
|
|
40854
41109
|
}
|
|
40855
41110
|
}
|
|
40856
41111
|
|
|
40857
41112
|
// src/commands/sql/sqlQuery.ts
|
|
40858
|
-
import
|
|
41113
|
+
import chalk257 from "chalk";
|
|
40859
41114
|
async function sqlQuery(query, connectionName) {
|
|
40860
41115
|
if (isMutation(query)) {
|
|
40861
41116
|
console.error(
|
|
40862
|
-
|
|
41117
|
+
chalk257.red(
|
|
40863
41118
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
40864
41119
|
)
|
|
40865
41120
|
);
|
|
@@ -40874,7 +41129,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
40874
41129
|
printTable(rows);
|
|
40875
41130
|
} else {
|
|
40876
41131
|
console.log(
|
|
40877
|
-
|
|
41132
|
+
chalk257.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
40878
41133
|
);
|
|
40879
41134
|
}
|
|
40880
41135
|
} finally {
|
|
@@ -41289,7 +41544,7 @@ function syncPi(claudeDir, options2) {
|
|
|
41289
41544
|
// src/commands/sync/syncSettings.ts
|
|
41290
41545
|
import * as fs46 from "fs";
|
|
41291
41546
|
import * as path100 from "path";
|
|
41292
|
-
import
|
|
41547
|
+
import chalk258 from "chalk";
|
|
41293
41548
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
41294
41549
|
const source = path100.join(claudeDir, "settings.json");
|
|
41295
41550
|
const target = path100.join(targetBase, "settings.json");
|
|
@@ -41308,7 +41563,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
41308
41563
|
if (mergedContent !== normalizedTarget) {
|
|
41309
41564
|
if (!options2?.yes) {
|
|
41310
41565
|
console.log(
|
|
41311
|
-
|
|
41566
|
+
chalk258.yellow(
|
|
41312
41567
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
41313
41568
|
)
|
|
41314
41569
|
);
|
|
@@ -41316,7 +41571,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
41316
41571
|
printDiff(targetContent, mergedContent);
|
|
41317
41572
|
printAutoConfirmHint();
|
|
41318
41573
|
const confirm = await promptConfirm(
|
|
41319
|
-
|
|
41574
|
+
chalk258.red("Overwrite existing settings.json?"),
|
|
41320
41575
|
false
|
|
41321
41576
|
);
|
|
41322
41577
|
if (!confirm) {
|
|
@@ -43556,7 +43811,7 @@ function registerWatch(program) {
|
|
|
43556
43811
|
|
|
43557
43812
|
// src/commands/roam/auth.ts
|
|
43558
43813
|
import { randomBytes } from "crypto";
|
|
43559
|
-
import
|
|
43814
|
+
import chalk259 from "chalk";
|
|
43560
43815
|
|
|
43561
43816
|
// src/commands/roam/waitForCallback.ts
|
|
43562
43817
|
import { createServer as createServer3 } from "http";
|
|
@@ -43687,13 +43942,13 @@ async function auth() {
|
|
|
43687
43942
|
saveGlobalConfig(config);
|
|
43688
43943
|
const state = randomBytes(16).toString("hex");
|
|
43689
43944
|
console.log(
|
|
43690
|
-
|
|
43945
|
+
chalk259.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
43691
43946
|
);
|
|
43692
|
-
console.log(
|
|
43693
|
-
console.log(
|
|
43694
|
-
console.log(
|
|
43947
|
+
console.log(chalk259.white("http://localhost:14523/callback\n"));
|
|
43948
|
+
console.log(chalk259.blue("Opening browser for authorization..."));
|
|
43949
|
+
console.log(chalk259.dim("Waiting for authorization callback..."));
|
|
43695
43950
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
43696
|
-
console.log(
|
|
43951
|
+
console.log(chalk259.dim("Exchanging code for tokens..."));
|
|
43697
43952
|
const tokens = await exchangeToken({
|
|
43698
43953
|
code,
|
|
43699
43954
|
clientId,
|
|
@@ -43709,7 +43964,7 @@ async function auth() {
|
|
|
43709
43964
|
};
|
|
43710
43965
|
saveGlobalConfig(config);
|
|
43711
43966
|
console.log(
|
|
43712
|
-
|
|
43967
|
+
chalk259.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
43713
43968
|
);
|
|
43714
43969
|
}
|
|
43715
43970
|
|
|
@@ -44285,18 +44540,18 @@ function registerRun(program) {
|
|
|
44285
44540
|
}
|
|
44286
44541
|
|
|
44287
44542
|
// src/commands/sessions/nodes/formatLink.ts
|
|
44288
|
-
import
|
|
44543
|
+
import chalk260 from "chalk";
|
|
44289
44544
|
var STATE_COLOURS = {
|
|
44290
|
-
connected:
|
|
44291
|
-
connecting:
|
|
44292
|
-
disconnected:
|
|
44293
|
-
"version-blocked":
|
|
44545
|
+
connected: chalk260.green,
|
|
44546
|
+
connecting: chalk260.yellow,
|
|
44547
|
+
disconnected: chalk260.red,
|
|
44548
|
+
"version-blocked": chalk260.red
|
|
44294
44549
|
};
|
|
44295
44550
|
function formatLink(link3) {
|
|
44296
|
-
const colour = STATE_COLOURS[link3.state] ??
|
|
44551
|
+
const colour = STATE_COLOURS[link3.state] ?? chalk260.white;
|
|
44297
44552
|
const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
|
|
44298
44553
|
const error = link3.error ? `
|
|
44299
|
-
${
|
|
44554
|
+
${chalk260.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
|
|
44300
44555
|
return ` ${link3.name} ${colour(link3.state)} ${link3.url}${peer}${error}`;
|
|
44301
44556
|
}
|
|
44302
44557
|
|
|
@@ -45373,7 +45628,7 @@ var ClientHub = class extends Set {
|
|
|
45373
45628
|
};
|
|
45374
45629
|
|
|
45375
45630
|
// src/commands/sessions/daemon/createSession.ts
|
|
45376
|
-
import { randomUUID as
|
|
45631
|
+
import { randomUUID as randomUUID23 } from "crypto";
|
|
45377
45632
|
|
|
45378
45633
|
// src/commands/sessions/daemon/sessionBase.ts
|
|
45379
45634
|
function sessionBase(id, status2) {
|
|
@@ -45596,7 +45851,7 @@ function spawnRun(opts) {
|
|
|
45596
45851
|
function createSession(id, { prompt, cwd, design, auto, harness, holdPty } = {}) {
|
|
45597
45852
|
if (harness && harness !== "claude")
|
|
45598
45853
|
return createHarnessSession(id, harness, prompt, cwd, holdPty);
|
|
45599
|
-
const claudeSessionId =
|
|
45854
|
+
const claudeSessionId = randomUUID23();
|
|
45600
45855
|
return {
|
|
45601
45856
|
...sessionBase(id, prompt ? "running" : "waiting"),
|
|
45602
45857
|
name: `Session ${id}`,
|
|
@@ -48447,7 +48702,7 @@ function codexRespawnPlan(session) {
|
|
|
48447
48702
|
}
|
|
48448
48703
|
|
|
48449
48704
|
// src/commands/sessions/daemon/interactiveRespawnPlan.ts
|
|
48450
|
-
import { randomUUID as
|
|
48705
|
+
import { randomUUID as randomUUID24 } from "crypto";
|
|
48451
48706
|
|
|
48452
48707
|
// src/commands/sessions/daemon/hasTranscriptOnDisk.ts
|
|
48453
48708
|
function hasTranscriptOnDisk(session) {
|
|
@@ -48474,7 +48729,7 @@ function interactiveRespawnPlan(session, resumes) {
|
|
|
48474
48729
|
return null;
|
|
48475
48730
|
}
|
|
48476
48731
|
function freshClaudePlan(session, prompt, cwd) {
|
|
48477
|
-
const claudeSessionId =
|
|
48732
|
+
const claudeSessionId = randomUUID24();
|
|
48478
48733
|
return {
|
|
48479
48734
|
spawn: () => {
|
|
48480
48735
|
session.claudeSessionId = claudeSessionId;
|
|
@@ -52030,7 +52285,7 @@ async function closeSession() {
|
|
|
52030
52285
|
}
|
|
52031
52286
|
|
|
52032
52287
|
// src/commands/sessions/nodes/listNodes.ts
|
|
52033
|
-
import
|
|
52288
|
+
import chalk261 from "chalk";
|
|
52034
52289
|
async function nodesReport() {
|
|
52035
52290
|
const live = await queryNodes();
|
|
52036
52291
|
if (live)
|
|
@@ -52047,10 +52302,10 @@ async function listNodes(options2) {
|
|
|
52047
52302
|
console.log(JSON.stringify(report, null, 2));
|
|
52048
52303
|
return;
|
|
52049
52304
|
}
|
|
52050
|
-
console.log(`${report.local} ${
|
|
52305
|
+
console.log(`${report.local} ${chalk261.dim("(this node)")}`);
|
|
52051
52306
|
if (!report.daemonRunning)
|
|
52052
|
-
console.log(
|
|
52053
|
-
if (report.links.length === 0) console.log(
|
|
52307
|
+
console.log(chalk261.dim(" daemon not running; showing configured links"));
|
|
52308
|
+
if (report.links.length === 0) console.log(chalk261.dim(" no links"));
|
|
52054
52309
|
for (const link3 of report.links) console.log(formatLink(link3));
|
|
52055
52310
|
}
|
|
52056
52311
|
|
|
@@ -52072,7 +52327,7 @@ async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
|
52072
52327
|
}
|
|
52073
52328
|
|
|
52074
52329
|
// src/commands/sessions/nodes/printReport.ts
|
|
52075
|
-
import
|
|
52330
|
+
import chalk262 from "chalk";
|
|
52076
52331
|
function printReport(report) {
|
|
52077
52332
|
if (report.links.length === 0) {
|
|
52078
52333
|
console.log(`${report.local} has no links`);
|
|
@@ -52086,11 +52341,11 @@ function printReport(report) {
|
|
|
52086
52341
|
for (const diagnosis of report.links) printDiagnosis(diagnosis);
|
|
52087
52342
|
}
|
|
52088
52343
|
function printDiagnosis(diagnosis) {
|
|
52089
|
-
console.log(`${
|
|
52344
|
+
console.log(`${chalk262.bold(diagnosis.name)} ${chalk262.dim(diagnosis.url)}`);
|
|
52090
52345
|
for (const hop of diagnosis.hops) {
|
|
52091
|
-
const mark = hop.ok ?
|
|
52346
|
+
const mark = hop.ok ? chalk262.green("\u2713") : chalk262.red("\u2717");
|
|
52092
52347
|
console.log(` ${mark} ${hop.hop.padEnd(9)} ${hop.detail ?? hop.error}`);
|
|
52093
|
-
if (hop.remediation) console.log(` ${
|
|
52348
|
+
if (hop.remediation) console.log(` ${chalk262.yellow(hop.remediation)}`);
|
|
52094
52349
|
}
|
|
52095
52350
|
}
|
|
52096
52351
|
|
|
@@ -52162,14 +52417,14 @@ function registerDiagnoseCommands(nodes, calledBy4) {
|
|
|
52162
52417
|
}
|
|
52163
52418
|
|
|
52164
52419
|
// src/commands/sessions/nodes/linkNode.ts
|
|
52165
|
-
import
|
|
52420
|
+
import chalk265 from "chalk";
|
|
52166
52421
|
|
|
52167
52422
|
// src/commands/sessions/nodes/notifyDaemonLinks.ts
|
|
52168
|
-
import
|
|
52423
|
+
import chalk263 from "chalk";
|
|
52169
52424
|
async function notifyDaemonLinks() {
|
|
52170
52425
|
if (!await isDaemonRunning()) {
|
|
52171
52426
|
console.log(
|
|
52172
|
-
|
|
52427
|
+
chalk263.yellow(
|
|
52173
52428
|
"The sessions daemon is not running; it loads the links when it starts."
|
|
52174
52429
|
)
|
|
52175
52430
|
);
|
|
@@ -52177,11 +52432,11 @@ async function notifyDaemonLinks() {
|
|
|
52177
52432
|
}
|
|
52178
52433
|
try {
|
|
52179
52434
|
await sendToDaemonAwaitAck({ type: "reload-links" });
|
|
52180
|
-
console.log(
|
|
52435
|
+
console.log(chalk263.dim("The sessions daemon reloaded its links."));
|
|
52181
52436
|
} catch (error) {
|
|
52182
52437
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
52183
52438
|
console.log(
|
|
52184
|
-
|
|
52439
|
+
chalk263.yellow(
|
|
52185
52440
|
`Could not notify the sessions daemon (${message3}); run \`assist daemon restart\` to apply the change.`
|
|
52186
52441
|
)
|
|
52187
52442
|
);
|
|
@@ -52189,7 +52444,7 @@ async function notifyDaemonLinks() {
|
|
|
52189
52444
|
}
|
|
52190
52445
|
|
|
52191
52446
|
// src/commands/sessions/nodes/readLinks.ts
|
|
52192
|
-
import
|
|
52447
|
+
import chalk264 from "chalk";
|
|
52193
52448
|
|
|
52194
52449
|
// src/commands/sessions/nodes/writeLinks.ts
|
|
52195
52450
|
async function writeLinks(links2) {
|
|
@@ -52212,7 +52467,7 @@ async function readLinks() {
|
|
|
52212
52467
|
await writeLinks(links2);
|
|
52213
52468
|
const dropped = stored.filter((link3) => !link3.url).map((link3) => link3.name);
|
|
52214
52469
|
console.log(
|
|
52215
|
-
|
|
52470
|
+
chalk264.yellow(`Removed ${dropped.join(", ")}: ${SSH_LINK_RETIRED}`)
|
|
52216
52471
|
);
|
|
52217
52472
|
return links2;
|
|
52218
52473
|
}
|
|
@@ -52268,7 +52523,7 @@ async function linkNode(name, url, options2) {
|
|
|
52268
52523
|
throw new Error(`${name} is this node; link to a different node`);
|
|
52269
52524
|
const link3 = await buildLink(name, url, options2);
|
|
52270
52525
|
await writeLinks([...others, link3]);
|
|
52271
|
-
console.log(
|
|
52526
|
+
console.log(chalk265.green(`Linked ${name} (${link3.url})`));
|
|
52272
52527
|
await notifyDaemonLinks();
|
|
52273
52528
|
}
|
|
52274
52529
|
|
|
@@ -52451,16 +52706,16 @@ function registerPeerActionCommands(nodes, calledBy4) {
|
|
|
52451
52706
|
}
|
|
52452
52707
|
|
|
52453
52708
|
// src/commands/sessions/nodes/unlinkNode.ts
|
|
52454
|
-
import
|
|
52709
|
+
import chalk266 from "chalk";
|
|
52455
52710
|
async function unlinkNode(name) {
|
|
52456
52711
|
const links2 = await readLinks();
|
|
52457
52712
|
const remaining = links2.filter((link3) => link3.name !== name);
|
|
52458
52713
|
if (remaining.length === links2.length) {
|
|
52459
|
-
console.log(
|
|
52714
|
+
console.log(chalk266.yellow(`No link named ${name}`));
|
|
52460
52715
|
return;
|
|
52461
52716
|
}
|
|
52462
52717
|
await writeLinks(remaining);
|
|
52463
|
-
console.log(
|
|
52718
|
+
console.log(chalk266.green(`Unlinked ${name}`));
|
|
52464
52719
|
await notifyDaemonLinks();
|
|
52465
52720
|
}
|
|
52466
52721
|
|
|
@@ -52668,6 +52923,7 @@ var programRegistrars = [
|
|
|
52668
52923
|
registerNews,
|
|
52669
52924
|
registerNetcap,
|
|
52670
52925
|
registerExtension,
|
|
52926
|
+
registerBrowser,
|
|
52671
52927
|
registerLitellm,
|
|
52672
52928
|
registerRavendb,
|
|
52673
52929
|
registerSeq,
|
|
@@ -52694,10 +52950,10 @@ function createProgram() {
|
|
|
52694
52950
|
}
|
|
52695
52951
|
|
|
52696
52952
|
// src/reportCliError.ts
|
|
52697
|
-
import
|
|
52953
|
+
import chalk267 from "chalk";
|
|
52698
52954
|
function reportCliError(error) {
|
|
52699
52955
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
52700
|
-
console.error(
|
|
52956
|
+
console.error(chalk267.red(error.message));
|
|
52701
52957
|
} else {
|
|
52702
52958
|
console.error(error);
|
|
52703
52959
|
}
|