@staff0rd/assist 0.928.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 +2 -2
- package/dist/commands/extension/extension/updates.json +2 -2
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +973 -777
- 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,
|
|
@@ -5170,6 +5352,17 @@ async function launchFromGithub(req, res, plan2, launch) {
|
|
|
5170
5352
|
}
|
|
5171
5353
|
}
|
|
5172
5354
|
|
|
5355
|
+
// src/shared/azureDevops/isAzureDevopsUrl.ts
|
|
5356
|
+
function isAzureDevopsUrl(url) {
|
|
5357
|
+
let host;
|
|
5358
|
+
try {
|
|
5359
|
+
host = new URL(url).hostname.toLowerCase();
|
|
5360
|
+
} catch {
|
|
5361
|
+
return false;
|
|
5362
|
+
}
|
|
5363
|
+
return host === "dev.azure.com" || host.endsWith(".visualstudio.com");
|
|
5364
|
+
}
|
|
5365
|
+
|
|
5173
5366
|
// src/shared/azureDevops/decodeUrlPart.ts
|
|
5174
5367
|
function decodeUrlPart(part) {
|
|
5175
5368
|
try {
|
|
@@ -5238,6 +5431,11 @@ function isAllowedAzureDevopsPrArgs(args) {
|
|
|
5238
5431
|
);
|
|
5239
5432
|
}
|
|
5240
5433
|
|
|
5434
|
+
// src/commands/prs/azureDevops/azureDevopsRepoUrl.ts
|
|
5435
|
+
function azureDevopsRepoUrl({ org, project, repo }) {
|
|
5436
|
+
return `https://dev.azure.com/${encodeURIComponent(org)}/${encodeURIComponent(project)}/_git/${encodeURIComponent(repo)}`;
|
|
5437
|
+
}
|
|
5438
|
+
|
|
5241
5439
|
// src/commands/sessions/web/fromGithub/findAzureDevopsClone.ts
|
|
5242
5440
|
import { existsSync as existsSync13, readdirSync as readdirSync2 } from "fs";
|
|
5243
5441
|
import { join as join18 } from "path";
|
|
@@ -5286,7 +5484,7 @@ function planAzureDevopsReview(pr, args, baseDir) {
|
|
|
5286
5484
|
return {
|
|
5287
5485
|
ok: false,
|
|
5288
5486
|
status: 404,
|
|
5289
|
-
error: `${pr.org}/${pr.project}/${pr.repo} is not cloned under ${baseDir}`
|
|
5487
|
+
error: `${pr.org}/${pr.project}/${pr.repo} is not cloned under ${baseDir}; clone ${azureDevopsRepoUrl(pr)} there and retry`
|
|
5290
5488
|
};
|
|
5291
5489
|
return { ok: true, cwd, assistArgs: [...args, pr.id] };
|
|
5292
5490
|
}
|
|
@@ -5404,8 +5602,16 @@ function planGithubReview(body, baseDir) {
|
|
|
5404
5602
|
// src/commands/sessions/web/fromGithub/planPrReview.ts
|
|
5405
5603
|
function planPrReview(body, baseDir) {
|
|
5406
5604
|
const { url, args } = body ?? {};
|
|
5407
|
-
const
|
|
5408
|
-
|
|
5605
|
+
const trimmed = typeof url === "string" ? url.trim() : "";
|
|
5606
|
+
const azurePr = parseAzureDevopsPrUrl(trimmed);
|
|
5607
|
+
if (azurePr) return planAzureDevopsReview(azurePr, args, baseDir);
|
|
5608
|
+
if (isAzureDevopsUrl(trimmed))
|
|
5609
|
+
return {
|
|
5610
|
+
ok: false,
|
|
5611
|
+
status: 400,
|
|
5612
|
+
error: `Not an Azure DevOps PR URL: ${trimmed} (expected https://dev.azure.com/<org>/<project>/_git/<repo>/pullrequest/<id>)`
|
|
5613
|
+
};
|
|
5614
|
+
return planGithubReview(body, baseDir);
|
|
5409
5615
|
}
|
|
5410
5616
|
|
|
5411
5617
|
// src/commands/sessions/web/fromGithub/reviewFromGithub.ts
|
|
@@ -8928,10 +9134,10 @@ function findLinkSpec(name) {
|
|
|
8928
9134
|
}
|
|
8929
9135
|
|
|
8930
9136
|
// src/commands/sessions/shared/newTraceId.ts
|
|
8931
|
-
import { randomUUID } from "crypto";
|
|
9137
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
8932
9138
|
var TRACE_HEADER = "x-assist-trace-id";
|
|
8933
9139
|
function newTraceId() {
|
|
8934
|
-
return
|
|
9140
|
+
return randomUUID2().slice(0, 8);
|
|
8935
9141
|
}
|
|
8936
9142
|
|
|
8937
9143
|
// src/commands/sessions/web/forwardToPeer.ts
|
|
@@ -11587,6 +11793,7 @@ var routes2 = {
|
|
|
11587
11793
|
"OPTIONS /api/sessions/review-from-github": sessionFromGithubPreflight,
|
|
11588
11794
|
"POST /api/sessions/docs-feedback": docsFeedback,
|
|
11589
11795
|
"OPTIONS /api/sessions/docs-feedback": sessionFromGithubPreflight,
|
|
11796
|
+
"POST /api/browser": browserRelay,
|
|
11590
11797
|
"POST /api/open-in-code": openInCode,
|
|
11591
11798
|
"POST /api/pr-preview/upload-image": uploadPrImage,
|
|
11592
11799
|
"GET /api/pr-preview/image": previewImage,
|
|
@@ -14021,7 +14228,7 @@ function internalCommand(command, calledBy4) {
|
|
|
14021
14228
|
}
|
|
14022
14229
|
|
|
14023
14230
|
// src/commands/ask.ts
|
|
14024
|
-
import { randomUUID as
|
|
14231
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
14025
14232
|
|
|
14026
14233
|
// src/commands/backlog/import/readStdinBuffer.ts
|
|
14027
14234
|
async function readStdinBuffer() {
|
|
@@ -14242,7 +14449,7 @@ async function ask(options2) {
|
|
|
14242
14449
|
options2.title,
|
|
14243
14450
|
{
|
|
14244
14451
|
sessionId,
|
|
14245
|
-
requestId:
|
|
14452
|
+
requestId: randomUUID3(),
|
|
14246
14453
|
title: options2.title,
|
|
14247
14454
|
body,
|
|
14248
14455
|
prNumber: null,
|
|
@@ -15707,7 +15914,7 @@ async function resolveInsertPosition(orm, itemId2, position) {
|
|
|
15707
15914
|
}
|
|
15708
15915
|
|
|
15709
15916
|
// src/commands/backlog/addPhase/reviewProposedPhase.ts
|
|
15710
|
-
import { randomUUID as
|
|
15917
|
+
import { randomUUID as randomUUID4 } from "crypto";
|
|
15711
15918
|
|
|
15712
15919
|
// src/commands/backlog/renderPhaseSection.ts
|
|
15713
15920
|
function renderPhaseSection(phase, idx) {
|
|
@@ -15731,7 +15938,7 @@ async function reviewProposedPhase(item, phaseIdx, phase) {
|
|
|
15731
15938
|
return;
|
|
15732
15939
|
await awaitPreviewApproval("Backlog phase preview", {
|
|
15733
15940
|
sessionId,
|
|
15734
|
-
requestId:
|
|
15941
|
+
requestId: randomUUID4(),
|
|
15735
15942
|
title: `Add a phase to ${formatItemId(item.id)}: ${item.name}`,
|
|
15736
15943
|
body: renderPhaseSection(phase, phaseIdx),
|
|
15737
15944
|
prNumber: null,
|
|
@@ -15933,7 +16140,7 @@ function readProposedItem(source) {
|
|
|
15933
16140
|
}
|
|
15934
16141
|
|
|
15935
16142
|
// src/commands/backlog/propose/reviewProposal.ts
|
|
15936
|
-
import { randomUUID as
|
|
16143
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
15937
16144
|
import chalk60 from "chalk";
|
|
15938
16145
|
|
|
15939
16146
|
// src/shared/renderMarkdownTerminal.ts
|
|
@@ -15975,7 +16182,7 @@ async function reviewProposal(item, sessionId, confirmed) {
|
|
|
15975
16182
|
if (sessionId) {
|
|
15976
16183
|
const decision = await awaitPreviewApproval("Backlog item preview", {
|
|
15977
16184
|
sessionId,
|
|
15978
|
-
requestId:
|
|
16185
|
+
requestId: randomUUID5(),
|
|
15979
16186
|
title: item.name,
|
|
15980
16187
|
body,
|
|
15981
16188
|
prNumber: null,
|
|
@@ -17331,7 +17538,7 @@ Phase ${phaseNumber} completed.`));
|
|
|
17331
17538
|
}
|
|
17332
17539
|
|
|
17333
17540
|
// src/commands/backlog/preparePhaseSession.ts
|
|
17334
|
-
import { randomUUID as
|
|
17541
|
+
import { randomUUID as randomUUID6 } from "crypto";
|
|
17335
17542
|
|
|
17336
17543
|
// src/commands/backlog/persistPhaseSession.ts
|
|
17337
17544
|
import os4 from "os";
|
|
@@ -17502,7 +17709,7 @@ async function verifyPhaseResume(itemId2, resumeSessionId, phaseLabel2) {
|
|
|
17502
17709
|
// src/commands/backlog/preparePhaseSession.ts
|
|
17503
17710
|
async function preparePhaseSession(item, phase, phaseIndex, phaseNumber, totalPhases, phaseLabel2, spawnOptions) {
|
|
17504
17711
|
const resumeSessionId = spawnOptions?.resumeSessionId;
|
|
17505
|
-
const claudeSessionId = resumeSessionId ??
|
|
17712
|
+
const claudeSessionId = resumeSessionId ?? randomUUID6();
|
|
17506
17713
|
if (resumeSessionId && !await verifyPhaseResume(item.id, resumeSessionId, phaseLabel2)) {
|
|
17507
17714
|
return void 0;
|
|
17508
17715
|
}
|
|
@@ -17856,7 +18063,7 @@ import chalk83 from "chalk";
|
|
|
17856
18063
|
import enquirer7 from "enquirer";
|
|
17857
18064
|
|
|
17858
18065
|
// src/commands/backlog/launchMode.ts
|
|
17859
|
-
import { randomUUID as
|
|
18066
|
+
import { randomUUID as randomUUID7 } from "crypto";
|
|
17860
18067
|
|
|
17861
18068
|
// src/commands/backlog/handleLaunchSignal.ts
|
|
17862
18069
|
import chalk82 from "chalk";
|
|
@@ -17961,7 +18168,7 @@ async function launchMode(slashCommand, options2) {
|
|
|
17961
18168
|
const resumeSessionId = options2?.resumeSessionId;
|
|
17962
18169
|
if (!resumeSessionId) pullIfConfigured();
|
|
17963
18170
|
process.env.ASSIST_SESSION_ID ??= String(process.pid);
|
|
17964
|
-
const claudeSessionId = resumeSessionId ??
|
|
18171
|
+
const claudeSessionId = resumeSessionId ?? randomUUID7();
|
|
17965
18172
|
const harness = options2?.harness ?? "claude";
|
|
17966
18173
|
reportLaunchActivity(slashCommand, claudeSessionId, harness, options2);
|
|
17967
18174
|
const prompt = resumeSessionId ? resumeNudge() : buildSlashCommand(slashCommand, options2?.description);
|
|
@@ -18800,7 +19007,7 @@ async function replacePlan(orm, itemId2, phases, currentPhase) {
|
|
|
18800
19007
|
}
|
|
18801
19008
|
|
|
18802
19009
|
// src/commands/backlog/updatePlan/reviewPlanUpdate.ts
|
|
18803
|
-
import { randomUUID as
|
|
19010
|
+
import { randomUUID as randomUUID8 } from "crypto";
|
|
18804
19011
|
import chalk103 from "chalk";
|
|
18805
19012
|
|
|
18806
19013
|
// src/commands/backlog/updatePlan/isCompleted.ts
|
|
@@ -18957,7 +19164,7 @@ async function reviewPlanUpdate(item, phases) {
|
|
|
18957
19164
|
if (process.env.ASSIST_SESSION === "1" && sessionId) {
|
|
18958
19165
|
const decision = await awaitPreviewApproval("Plan update preview", {
|
|
18959
19166
|
sessionId,
|
|
18960
|
-
requestId:
|
|
19167
|
+
requestId: randomUUID8(),
|
|
18961
19168
|
title: `Update the plan for ${formatItemId(item.id)}: ${item.name}`,
|
|
18962
19169
|
body,
|
|
18963
19170
|
prNumber: null,
|
|
@@ -19595,129 +19802,39 @@ function stripEnvPrefix(parts) {
|
|
|
19595
19802
|
return i > 0 ? parts.slice(i) : parts;
|
|
19596
19803
|
}
|
|
19597
19804
|
|
|
19598
|
-
// src/shared/extractGhApiMethod.ts
|
|
19599
|
-
function extractGhApiMethod(args) {
|
|
19600
|
-
for (let i = 0; i < args.length; i++) {
|
|
19601
|
-
const arg = args[i];
|
|
19602
|
-
if (arg.startsWith("--method=")) return arg.slice("--method=".length);
|
|
19603
|
-
if (arg.startsWith("-X=")) return arg.slice("-X=".length);
|
|
19604
|
-
if (arg.startsWith("-X") && arg.length > 2) return arg.slice(2);
|
|
19605
|
-
if ((arg === "--method" || arg === "-X") && i + 1 < args.length) {
|
|
19606
|
-
return args[i + 1];
|
|
19607
|
-
}
|
|
19608
|
-
}
|
|
19609
|
-
return void 0;
|
|
19610
|
-
}
|
|
19611
|
-
|
|
19612
|
-
// src/shared/tokenize.ts
|
|
19613
|
-
function tokenize(command) {
|
|
19614
|
-
const tokens = [];
|
|
19615
|
-
let current = "";
|
|
19616
|
-
let inSingle = false;
|
|
19617
|
-
let inDouble = false;
|
|
19618
|
-
for (let i = 0; i < command.length; i++) {
|
|
19619
|
-
const ch = command[i];
|
|
19620
|
-
if (ch === "'" && !inDouble) {
|
|
19621
|
-
inSingle = !inSingle;
|
|
19622
|
-
current += ch;
|
|
19623
|
-
} else if (ch === '"' && !inSingle) {
|
|
19624
|
-
inDouble = !inDouble;
|
|
19625
|
-
current += ch;
|
|
19626
|
-
} else if (ch === "\\" && inDouble && i + 1 < command.length) {
|
|
19627
|
-
current += ch + command[++i];
|
|
19628
|
-
} else if (/\s/.test(ch) && !inSingle && !inDouble) {
|
|
19629
|
-
if (current) {
|
|
19630
|
-
tokens.push(current);
|
|
19631
|
-
current = "";
|
|
19632
|
-
}
|
|
19633
|
-
} else {
|
|
19634
|
-
current += ch;
|
|
19635
|
-
}
|
|
19636
|
-
}
|
|
19637
|
-
if (current) tokens.push(current);
|
|
19638
|
-
return tokens;
|
|
19639
|
-
}
|
|
19640
|
-
|
|
19641
19805
|
// src/commands/cliHook/isGhGraphqlIssueMutation.ts
|
|
19642
19806
|
import { readFileSync as readFileSync27 } from "fs";
|
|
19643
19807
|
var ISSUE_MUTATION = /\bmutation\b[\s\S]*(?:issue|comment|label|assign|reaction|milestone)/i;
|
|
19644
|
-
var
|
|
19645
|
-
function isGhGraphqlIssueMutation(
|
|
19646
|
-
if (!
|
|
19647
|
-
|
|
19648
|
-
|
|
19808
|
+
var FILE_REFERENCE = /(?:=@|--input[\s=]+)["']?([^\s"';&|)]+)/g;
|
|
19809
|
+
function isGhGraphqlIssueMutation(command) {
|
|
19810
|
+
if (!command.includes("graphql")) return false;
|
|
19811
|
+
if (ISSUE_MUTATION.test(command)) return true;
|
|
19812
|
+
return [...command.matchAll(FILE_REFERENCE)].some(
|
|
19813
|
+
(m) => ISSUE_MUTATION.test(readOrEmpty(m[1]))
|
|
19649
19814
|
);
|
|
19650
19815
|
}
|
|
19651
|
-
function
|
|
19652
|
-
const sources = [];
|
|
19653
|
-
for (let i = 0; i < args.length; i++) {
|
|
19654
|
-
const value = flagValue(args, i);
|
|
19655
|
-
if (value === void 0) continue;
|
|
19656
|
-
if (args[i] === "--input") sources.push(`@${value}`);
|
|
19657
|
-
const query = /^query=([\s\S]*)$/.exec(value);
|
|
19658
|
-
if (query) sources.push(query[1]);
|
|
19659
|
-
}
|
|
19660
|
-
return sources;
|
|
19661
|
-
}
|
|
19662
|
-
function flagValue(args, i) {
|
|
19663
|
-
const arg = args[i];
|
|
19664
|
-
if (arg === "--input") return unquote(args[i + 1] ?? "");
|
|
19665
|
-
for (const flag of FIELD_FLAGS) {
|
|
19666
|
-
if (arg === flag) return unquote(args[i + 1] ?? "");
|
|
19667
|
-
if (arg.startsWith(`${flag}=`)) return unquote(arg.slice(flag.length + 1));
|
|
19668
|
-
if (flag.length === 2 && arg.length > 2 && arg.startsWith(flag))
|
|
19669
|
-
return unquote(arg.slice(2));
|
|
19670
|
-
}
|
|
19671
|
-
return void 0;
|
|
19672
|
-
}
|
|
19673
|
-
function readSourceOrCommandText(source, command) {
|
|
19674
|
-
if (!source.startsWith("@")) return source;
|
|
19675
|
-
const path108 = source.slice(1);
|
|
19676
|
-
if (path108 === "-") return command;
|
|
19816
|
+
function readOrEmpty(path108) {
|
|
19677
19817
|
try {
|
|
19678
19818
|
return readFileSync27(path108, "utf8");
|
|
19679
19819
|
} catch {
|
|
19680
|
-
return
|
|
19820
|
+
return "";
|
|
19681
19821
|
}
|
|
19682
19822
|
}
|
|
19683
|
-
function unquote(value) {
|
|
19684
|
-
return value.replace(/['"]/g, "");
|
|
19685
|
-
}
|
|
19686
19823
|
|
|
19687
19824
|
// src/commands/cliHook/isGhIssueApiWrite.ts
|
|
19688
19825
|
var WRITE_METHODS = /* @__PURE__ */ new Set(["POST", "PATCH", "PUT", "DELETE"]);
|
|
19689
|
-
var
|
|
19690
|
-
var
|
|
19691
|
-
var ISSUE_ENDPOINT = /
|
|
19826
|
+
var METHOD = /(?:-X|--method)[\s=]*["']?([A-Za-z]+)/g;
|
|
19827
|
+
var BODY_FLAG = /\s(?:-[fF]|--field|--raw-field|--input)/;
|
|
19828
|
+
var ISSUE_ENDPOINT = /repos\/[^/\s"'`]+\/[^/\s"'`]+\/issues(?:$|[/?\s"'`)])/;
|
|
19692
19829
|
function isGhIssueApiWrite(command) {
|
|
19693
|
-
|
|
19694
|
-
|
|
19695
|
-
|
|
19696
|
-
const args = argsUntilNextCommand(tokens.slice(i + 2));
|
|
19697
|
-
if (targetsIssueEndpoint(args) && isWrite(args)) return true;
|
|
19698
|
-
if (isGhGraphqlIssueMutation(args, command)) return true;
|
|
19699
|
-
}
|
|
19700
|
-
return false;
|
|
19701
|
-
}
|
|
19702
|
-
function argsUntilNextCommand(tokens) {
|
|
19703
|
-
const end = tokens.findIndex((token) => COMMAND_OPERATORS.has(token));
|
|
19704
|
-
return end === -1 ? tokens : tokens.slice(0, end);
|
|
19705
|
-
}
|
|
19706
|
-
function targetsIssueEndpoint(args) {
|
|
19707
|
-
return args.some((arg) => ISSUE_ENDPOINT.test(arg));
|
|
19830
|
+
if (!/gh\s+api/.test(command)) return false;
|
|
19831
|
+
if (ISSUE_ENDPOINT.test(command) && isWrite(command)) return true;
|
|
19832
|
+
return isGhGraphqlIssueMutation(command);
|
|
19708
19833
|
}
|
|
19709
|
-
function isWrite(
|
|
19710
|
-
const
|
|
19711
|
-
if (
|
|
19712
|
-
return
|
|
19713
|
-
}
|
|
19714
|
-
function isBodyFlag(arg) {
|
|
19715
|
-
return BODY_FLAGS.some(
|
|
19716
|
-
(flag) => arg === flag || arg.startsWith(`${flag}=`) || flag.length === 2 && arg.length > 2 && arg.startsWith(flag)
|
|
19717
|
-
);
|
|
19718
|
-
}
|
|
19719
|
-
function unquote2(value) {
|
|
19720
|
-
return value.replace(/^['"]|['"]$/g, "");
|
|
19834
|
+
function isWrite(command) {
|
|
19835
|
+
const methods = [...command.matchAll(METHOD)].map((m) => m[1].toUpperCase());
|
|
19836
|
+
if (methods.length > 0) return methods.some((m) => WRITE_METHODS.has(m));
|
|
19837
|
+
return BODY_FLAG.test(command);
|
|
19721
19838
|
}
|
|
19722
19839
|
|
|
19723
19840
|
// src/commands/cliHook/builtinDenyRules.ts
|
|
@@ -19755,30 +19872,18 @@ var PATTERN_DENIES = [
|
|
|
19755
19872
|
var GH_ISSUE_API_MESSAGE = "Do not write to GitHub issues with 'gh api' (REST issue endpoints or GraphQL issue mutations) \u2014 it bypasses the content validation and the approval pane that every outward-facing issue write goes through. Use 'assist github issue create --title <title> --body <body>' to open an issue, 'assist github issue edit <number>' to rework one's body, 'assist github issue comment <number> --body <body>' to post a comment, or 'assist github issue edit-comment <comment-id> --body <body>' to amend a comment that is already posted. Each validates the content and gates it on the user's approval before anything reaches GitHub; run the command's --help for how to compose it.";
|
|
19756
19873
|
var BRANCH_CREATION_MESSAGE = "Do not create branches with raw git. Use the /branch command, or 'assist branch <slug> [--jira <KEY>]' \u2014 it branches off the fresh remote default and enforces the team naming convention.";
|
|
19757
19874
|
var CLOSE_WITH_COMMENT_MESSAGE = "Do not post a comment through 'gh issue close', 'gh issue reopen' or 'gh pr close' with --comment/-c \u2014 it goes to GitHub without the approval pane. Post the comment first with 'assist github issue comment <number> --body <body> [-R <owner>/<repo>]', which validates it and gates it on the user's approval, then run the same close/reopen without --comment.";
|
|
19758
|
-
var CLOSE_WITH_COMMENT_REGEX = /
|
|
19759
|
-
var COMMAND_BOUNDARY = String.raw`(?<=(?:^|[;&|(\n])\s*)`;
|
|
19875
|
+
var CLOSE_WITH_COMMENT_REGEX = /gh (?:issue (?:close|reopen)|pr close)[^;&|]*? (?:--comment|-c)/;
|
|
19760
19876
|
var BRANCH_CREATION_REGEXES = [
|
|
19761
|
-
|
|
19762
|
-
|
|
19763
|
-
)
|
|
19764
|
-
new RegExp(
|
|
19765
|
-
COMMAND_BOUNDARY + String.raw`git\s+switch\s+(?:-[cC]|--create)(?=\s|$)`
|
|
19766
|
-
),
|
|
19767
|
-
new RegExp(COMMAND_BOUNDARY + String.raw`git\s+branch\s+(?!-)\S`)
|
|
19877
|
+
/git (?:checkout|co) -[bB]/,
|
|
19878
|
+
/git switch (?:-[cC]|--create)/,
|
|
19879
|
+
/git branch [^-\s;&|)]/
|
|
19768
19880
|
];
|
|
19769
|
-
function anywhereTokenSequenceRegex(pattern2) {
|
|
19770
|
-
const tokens = pattern2.trim().split(/\s+/).map((token) => token.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`\s+`);
|
|
19771
|
-
return new RegExp(`(?<=^|\\s)${tokens}(?=\\s|$)`);
|
|
19772
|
-
}
|
|
19773
19881
|
var builtinDenyRules = [
|
|
19774
|
-
...PATTERN_DENIES.map((rule) => {
|
|
19775
|
-
|
|
19776
|
-
|
|
19777
|
-
|
|
19778
|
-
|
|
19779
|
-
enabled: rule.enabled
|
|
19780
|
-
};
|
|
19781
|
-
}),
|
|
19882
|
+
...PATTERN_DENIES.map((rule) => ({
|
|
19883
|
+
message: rule.message,
|
|
19884
|
+
matches: (text17) => text17.includes(rule.pattern),
|
|
19885
|
+
enabled: rule.enabled
|
|
19886
|
+
})),
|
|
19782
19887
|
...BRANCH_CREATION_REGEXES.map((regex) => ({
|
|
19783
19888
|
message: BRANCH_CREATION_MESSAGE,
|
|
19784
19889
|
matches: (text17) => regex.test(text17)
|
|
@@ -19793,61 +19898,14 @@ var builtinDenyRules = [
|
|
|
19793
19898
|
}
|
|
19794
19899
|
];
|
|
19795
19900
|
|
|
19796
|
-
// src/commands/cliHook/extractNestedCommands.ts
|
|
19797
|
-
function extractNestedCommands(command) {
|
|
19798
|
-
const bodies = [];
|
|
19799
|
-
scanUnquoted(command, 0, (i, inDouble) => {
|
|
19800
|
-
const opener = openerLength(command, i, inDouble);
|
|
19801
|
-
if (opener === void 0) return void 0;
|
|
19802
|
-
const start2 = i + opener;
|
|
19803
|
-
const end = command[i] === "`" ? findClosingBacktick(command, start2) : findClosingParen(command, start2);
|
|
19804
|
-
const body = command.slice(start2, end);
|
|
19805
|
-
bodies.push(body, ...extractNestedCommands(body));
|
|
19806
|
-
return end;
|
|
19807
|
-
});
|
|
19808
|
-
return bodies;
|
|
19809
|
-
}
|
|
19810
|
-
function openerLength(command, i, inDouble) {
|
|
19811
|
-
if (command[i] === "$" && command[i + 1] === "(") return 2;
|
|
19812
|
-
if (command[i] === "`") return 1;
|
|
19813
|
-
if (command[i] === "(" && !inDouble) return 1;
|
|
19814
|
-
return void 0;
|
|
19815
|
-
}
|
|
19816
|
-
function findClosingBacktick(command, start2) {
|
|
19817
|
-
const end = command.indexOf("`", start2);
|
|
19818
|
-
return end === -1 ? command.length : end;
|
|
19819
|
-
}
|
|
19820
|
-
function findClosingParen(command, start2) {
|
|
19821
|
-
let depth = 1;
|
|
19822
|
-
let close = command.length;
|
|
19823
|
-
scanUnquoted(command, start2, (i, inDouble) => {
|
|
19824
|
-
if (inDouble) return void 0;
|
|
19825
|
-
if (command[i] === "(") depth++;
|
|
19826
|
-
else if (command[i] === ")" && --depth === 0) {
|
|
19827
|
-
close = i;
|
|
19828
|
-
return command.length;
|
|
19829
|
-
}
|
|
19830
|
-
return void 0;
|
|
19831
|
-
});
|
|
19832
|
-
return close;
|
|
19833
|
-
}
|
|
19834
|
-
function scanUnquoted(command, start2, visit2) {
|
|
19835
|
-
let inSingle = false;
|
|
19836
|
-
let inDouble = false;
|
|
19837
|
-
for (let i = start2; i < command.length; i++) {
|
|
19838
|
-
const ch = command[i];
|
|
19839
|
-
if (ch === "\\" && !inSingle) i++;
|
|
19840
|
-
else if (ch === "'" && !inDouble) inSingle = !inSingle;
|
|
19841
|
-
else if (ch === '"' && !inSingle) inDouble = !inDouble;
|
|
19842
|
-
else if (!inSingle) i = visit2(i, inDouble) ?? i;
|
|
19843
|
-
}
|
|
19844
|
-
}
|
|
19845
|
-
|
|
19846
19901
|
// src/commands/cliHook/findBuiltinDeny.ts
|
|
19902
|
+
function normaliseWhitespace(text17) {
|
|
19903
|
+
return text17.replace(/\\\n/g, " ").replace(/\s+/g, " ");
|
|
19904
|
+
}
|
|
19847
19905
|
function matchBuiltinDeny(text17) {
|
|
19848
|
-
const
|
|
19906
|
+
const normalised = normaliseWhitespace(text17);
|
|
19849
19907
|
return builtinDenyRules.find(
|
|
19850
|
-
(rule) =>
|
|
19908
|
+
(rule) => rule.matches(normalised) && (rule.enabled?.() ?? true)
|
|
19851
19909
|
);
|
|
19852
19910
|
}
|
|
19853
19911
|
function toDecision(rule) {
|
|
@@ -20006,10 +20064,53 @@ function configuresReleases(command) {
|
|
|
20006
20064
|
return CONFIGURE_RE.test(command);
|
|
20007
20065
|
}
|
|
20008
20066
|
|
|
20067
|
+
// src/shared/tokenize.ts
|
|
20068
|
+
function tokenize(command) {
|
|
20069
|
+
const tokens = [];
|
|
20070
|
+
let current = "";
|
|
20071
|
+
let inSingle = false;
|
|
20072
|
+
let inDouble = false;
|
|
20073
|
+
for (let i = 0; i < command.length; i++) {
|
|
20074
|
+
const ch = command[i];
|
|
20075
|
+
if (ch === "'" && !inDouble) {
|
|
20076
|
+
inSingle = !inSingle;
|
|
20077
|
+
current += ch;
|
|
20078
|
+
} else if (ch === '"' && !inSingle) {
|
|
20079
|
+
inDouble = !inDouble;
|
|
20080
|
+
current += ch;
|
|
20081
|
+
} else if (ch === "\\" && inDouble && i + 1 < command.length) {
|
|
20082
|
+
current += ch + command[++i];
|
|
20083
|
+
} else if (/\s/.test(ch) && !inSingle && !inDouble) {
|
|
20084
|
+
if (current) {
|
|
20085
|
+
tokens.push(current);
|
|
20086
|
+
current = "";
|
|
20087
|
+
}
|
|
20088
|
+
} else {
|
|
20089
|
+
current += ch;
|
|
20090
|
+
}
|
|
20091
|
+
}
|
|
20092
|
+
if (current) tokens.push(current);
|
|
20093
|
+
return tokens;
|
|
20094
|
+
}
|
|
20095
|
+
|
|
20096
|
+
// src/shared/extractGhApiMethod.ts
|
|
20097
|
+
function extractGhApiMethod(args) {
|
|
20098
|
+
for (let i = 0; i < args.length; i++) {
|
|
20099
|
+
const arg = args[i];
|
|
20100
|
+
if (arg.startsWith("--method=")) return arg.slice("--method=".length);
|
|
20101
|
+
if (arg.startsWith("-X=")) return arg.slice("-X=".length);
|
|
20102
|
+
if (arg.startsWith("-X") && arg.length > 2) return arg.slice(2);
|
|
20103
|
+
if ((arg === "--method" || arg === "-X") && i + 1 < args.length) {
|
|
20104
|
+
return args[i + 1];
|
|
20105
|
+
}
|
|
20106
|
+
}
|
|
20107
|
+
return void 0;
|
|
20108
|
+
}
|
|
20109
|
+
|
|
20009
20110
|
// src/shared/isGhApiRead.ts
|
|
20010
20111
|
var READ_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD"]);
|
|
20011
|
-
var
|
|
20012
|
-
var
|
|
20112
|
+
var BODY_FLAGS = /* @__PURE__ */ new Set(["-f", "-F", "--field", "--raw-field", "--input"]);
|
|
20113
|
+
var FIELD_FLAGS = /* @__PURE__ */ new Set(["-f", "--field", "-F"]);
|
|
20013
20114
|
function isGhApiRead(command) {
|
|
20014
20115
|
const tokens = tokenize(command);
|
|
20015
20116
|
if (tokens.length < 2 || tokens[0] !== "gh" || tokens[1] !== "api") {
|
|
@@ -20021,7 +20122,7 @@ function isGhApiRead(command) {
|
|
|
20021
20122
|
}
|
|
20022
20123
|
const method = extractGhApiMethod(args);
|
|
20023
20124
|
if (method) return READ_METHODS.has(method.toUpperCase());
|
|
20024
|
-
if (args.some((t) =>
|
|
20125
|
+
if (args.some((t) => BODY_FLAGS.has(t))) return false;
|
|
20025
20126
|
return true;
|
|
20026
20127
|
}
|
|
20027
20128
|
function isGraphqlRead(args) {
|
|
@@ -20036,7 +20137,7 @@ function isGraphqlRead(args) {
|
|
|
20036
20137
|
}
|
|
20037
20138
|
function extractGraphqlQuery(args) {
|
|
20038
20139
|
for (let i = 0; i < args.length; i++) {
|
|
20039
|
-
if (
|
|
20140
|
+
if (FIELD_FLAGS.has(args[i]) && i + 1 < args.length) {
|
|
20040
20141
|
const match = args[i + 1].match(/^query=(.*)/s);
|
|
20041
20142
|
if (match) return match[1];
|
|
20042
20143
|
}
|
|
@@ -20324,9 +20425,11 @@ function resolvePermission(toolName, parts) {
|
|
|
20324
20425
|
|
|
20325
20426
|
// src/commands/cliHook/decideCommand.ts
|
|
20326
20427
|
function decideCommand(toolName, rawCommand) {
|
|
20428
|
+
const builtinDeny = findBuiltinDenyRaw(rawCommand);
|
|
20429
|
+
if (builtinDeny) return builtinDeny;
|
|
20327
20430
|
const result = splitCompound(rawCommand);
|
|
20328
20431
|
if (result.ok) return resolvePermission(toolName, result.parts);
|
|
20329
|
-
return findRestrictedPathDenyRaw(rawCommand) ??
|
|
20432
|
+
return findRestrictedPathDenyRaw(rawCommand) ?? findTruncatedReadDenyRaw(rawCommand) ?? findDeny(toolName, [rawCommand]);
|
|
20330
20433
|
}
|
|
20331
20434
|
|
|
20332
20435
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
@@ -20447,10 +20550,10 @@ function reportDeny(toolName, parts) {
|
|
|
20447
20550
|
}
|
|
20448
20551
|
function cliHookCheck(command, toolName = "Bash") {
|
|
20449
20552
|
const trimmed = command.trim();
|
|
20553
|
+
if (reportDecision(findBuiltinDenyRaw(trimmed))) return;
|
|
20450
20554
|
const result = splitCompound(trimmed);
|
|
20451
20555
|
if (!result.ok) {
|
|
20452
20556
|
if (reportDecision(findRestrictedPathDenyRaw(trimmed))) return;
|
|
20453
|
-
if (reportDecision(findBuiltinDenyRaw(trimmed))) return;
|
|
20454
20557
|
if (reportDecision(findTruncatedReadDenyRaw(trimmed))) return;
|
|
20455
20558
|
if (reportDeny(toolName, [trimmed])) return;
|
|
20456
20559
|
console.log(`not approved (${result.error})`);
|
|
@@ -22773,9 +22876,81 @@ function registerConfig(program) {
|
|
|
22773
22876
|
).action((filter) => configKeys(filter));
|
|
22774
22877
|
}
|
|
22775
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
|
+
|
|
22776
22951
|
// src/commands/extension/extension.ts
|
|
22777
22952
|
import { cp } from "fs/promises";
|
|
22778
|
-
import
|
|
22953
|
+
import chalk139 from "chalk";
|
|
22779
22954
|
|
|
22780
22955
|
// src/commands/extension/extensionDir.ts
|
|
22781
22956
|
import { existsSync as existsSync49 } from "fs";
|
|
@@ -22798,21 +22973,21 @@ async function loadPath(source) {
|
|
|
22798
22973
|
return WSL_WINDOWS_PATH;
|
|
22799
22974
|
} catch {
|
|
22800
22975
|
console.log(
|
|
22801
|
-
|
|
22976
|
+
chalk139.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
22802
22977
|
);
|
|
22803
22978
|
return source;
|
|
22804
22979
|
}
|
|
22805
22980
|
}
|
|
22806
22981
|
async function extension() {
|
|
22807
22982
|
const path108 = await loadPath(extensionDir());
|
|
22808
|
-
console.log(
|
|
22809
|
-
console.log(
|
|
22983
|
+
console.log(chalk139.bold("assist \u2014 GitHub browser extension"));
|
|
22984
|
+
console.log(chalk139.dim(`load the unpacked extension from ${path108}`));
|
|
22810
22985
|
}
|
|
22811
22986
|
|
|
22812
22987
|
// src/commands/extension/printExtensionUrl.ts
|
|
22813
22988
|
import { readFile as readFile4 } from "fs/promises";
|
|
22814
22989
|
import { join as join55 } from "path";
|
|
22815
|
-
import
|
|
22990
|
+
import chalk140 from "chalk";
|
|
22816
22991
|
|
|
22817
22992
|
// src/commands/extension/latestUpdate.ts
|
|
22818
22993
|
function latestUpdate(manifest, updates2) {
|
|
@@ -22835,7 +23010,7 @@ async function printExtensionUrl() {
|
|
|
22835
23010
|
const response = await fetch(update_url);
|
|
22836
23011
|
const link3 = response.ok ? latestUpdateLink(manifest, await response.text()) : void 0;
|
|
22837
23012
|
if (!link3) {
|
|
22838
|
-
console.log(
|
|
23013
|
+
console.log(chalk140.red(`no signed build found in ${update_url}`));
|
|
22839
23014
|
process.exitCode = 1;
|
|
22840
23015
|
return;
|
|
22841
23016
|
}
|
|
@@ -22846,7 +23021,7 @@ async function printExtensionUrl() {
|
|
|
22846
23021
|
import { rm as rm2 } from "fs/promises";
|
|
22847
23022
|
import { homedir as homedir21, tmpdir as tmpdir3 } from "os";
|
|
22848
23023
|
import { join as join61 } from "path";
|
|
22849
|
-
import
|
|
23024
|
+
import chalk142 from "chalk";
|
|
22850
23025
|
|
|
22851
23026
|
// src/commands/extension/copySignedXpi.ts
|
|
22852
23027
|
import { copyFile } from "fs/promises";
|
|
@@ -22871,7 +23046,7 @@ async function findSignedXpi(dir) {
|
|
|
22871
23046
|
|
|
22872
23047
|
// src/commands/extension/signedAddonInstallPath.ts
|
|
22873
23048
|
import { cp as cp2 } from "fs/promises";
|
|
22874
|
-
import
|
|
23049
|
+
import chalk141 from "chalk";
|
|
22875
23050
|
var WSL_WINDOWS_XPI = "/mnt/c/tools/assist-extension.xpi";
|
|
22876
23051
|
var WSL_WINDOWS_PATH2 = String.raw`C:\tools\assist-extension.xpi`;
|
|
22877
23052
|
async function signedAddonInstallPath(xpi) {
|
|
@@ -22881,7 +23056,7 @@ async function signedAddonInstallPath(xpi) {
|
|
|
22881
23056
|
return WSL_WINDOWS_PATH2;
|
|
22882
23057
|
} catch {
|
|
22883
23058
|
console.log(
|
|
22884
|
-
|
|
23059
|
+
chalk141.yellow(`could not copy the add-on to ${WSL_WINDOWS_PATH2}`)
|
|
22885
23060
|
);
|
|
22886
23061
|
return xpi;
|
|
22887
23062
|
}
|
|
@@ -22974,15 +23149,15 @@ async function signExtension() {
|
|
|
22974
23149
|
const source = extensionDir();
|
|
22975
23150
|
const problem = signPreflightProblem(source);
|
|
22976
23151
|
if (problem) {
|
|
22977
|
-
console.log(
|
|
22978
|
-
console.log(
|
|
23152
|
+
console.log(chalk142.red(problem.message));
|
|
23153
|
+
console.log(chalk142.dim(problem.hint));
|
|
22979
23154
|
process.exitCode = 1;
|
|
22980
23155
|
return;
|
|
22981
23156
|
}
|
|
22982
23157
|
const { version: version2 } = package_default;
|
|
22983
23158
|
await stageExtension(source, STAGING_DIR, version2);
|
|
22984
23159
|
await rm2(ARTIFACTS_DIR, { recursive: true, force: true });
|
|
22985
|
-
console.log(
|
|
23160
|
+
console.log(chalk142.bold(`signing version ${version2} for self-distribution`));
|
|
22986
23161
|
const { done: done2 } = spawnInherit("npx", [
|
|
22987
23162
|
"--yes",
|
|
22988
23163
|
"web-ext",
|
|
@@ -22992,13 +23167,13 @@ async function signExtension() {
|
|
|
22992
23167
|
"--channel=unlisted"
|
|
22993
23168
|
]);
|
|
22994
23169
|
if (await done2 !== 0) {
|
|
22995
|
-
console.log(
|
|
23170
|
+
console.log(chalk142.red("web-ext sign failed"));
|
|
22996
23171
|
process.exitCode = 1;
|
|
22997
23172
|
return;
|
|
22998
23173
|
}
|
|
22999
23174
|
const xpi = await findSignedXpi(ARTIFACTS_DIR);
|
|
23000
23175
|
if (!xpi) {
|
|
23001
|
-
console.log(
|
|
23176
|
+
console.log(chalk142.red(`web-ext wrote no .xpi into ${ARTIFACTS_DIR}`));
|
|
23002
23177
|
process.exitCode = 1;
|
|
23003
23178
|
return;
|
|
23004
23179
|
}
|
|
@@ -23006,7 +23181,7 @@ async function signExtension() {
|
|
|
23006
23181
|
const path108 = await signedAddonInstallPath(
|
|
23007
23182
|
await copySignedXpi(xpi, ARTIFACTS_DIR)
|
|
23008
23183
|
);
|
|
23009
|
-
console.log(
|
|
23184
|
+
console.log(chalk142.dim(`install the signed add-on from ${path108}`));
|
|
23010
23185
|
}
|
|
23011
23186
|
|
|
23012
23187
|
// src/commands/registerExtension.ts
|
|
@@ -23067,11 +23242,11 @@ async function dropRetiredTables(exec3) {
|
|
|
23067
23242
|
}
|
|
23068
23243
|
|
|
23069
23244
|
// src/commands/db/reportRetiredTables.ts
|
|
23070
|
-
import
|
|
23245
|
+
import chalk143 from "chalk";
|
|
23071
23246
|
function reportRetiredTables(tables) {
|
|
23072
23247
|
for (const table of tables) {
|
|
23073
23248
|
console.error(
|
|
23074
|
-
|
|
23249
|
+
chalk143.yellow(
|
|
23075
23250
|
`Retired table ${table.name} still exists (${table.rows} rows). Run \`assist db drop-retired\` to drop it.`
|
|
23076
23251
|
)
|
|
23077
23252
|
);
|
|
@@ -23079,40 +23254,40 @@ function reportRetiredTables(tables) {
|
|
|
23079
23254
|
}
|
|
23080
23255
|
|
|
23081
23256
|
// src/commands/db/reportMigrationStatus.ts
|
|
23082
|
-
import
|
|
23257
|
+
import chalk144 from "chalk";
|
|
23083
23258
|
function reportApplied(applied) {
|
|
23084
23259
|
if (applied.length === 0) {
|
|
23085
|
-
console.error(
|
|
23260
|
+
console.error(chalk144.green("Database is up to date; nothing to apply."));
|
|
23086
23261
|
return;
|
|
23087
23262
|
}
|
|
23088
23263
|
for (const migration of applied) {
|
|
23089
23264
|
console.error(
|
|
23090
|
-
|
|
23265
|
+
chalk144.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
23091
23266
|
);
|
|
23092
23267
|
}
|
|
23093
23268
|
}
|
|
23094
23269
|
function reportMigrationStatus(status2) {
|
|
23095
23270
|
if (status2.state === "in-sync") {
|
|
23096
23271
|
console.error(
|
|
23097
|
-
|
|
23272
|
+
chalk144.green(`In sync at migration ${status2.version} (latest).`)
|
|
23098
23273
|
);
|
|
23099
23274
|
return;
|
|
23100
23275
|
}
|
|
23101
23276
|
if (status2.state === "behind") {
|
|
23102
23277
|
console.error(
|
|
23103
|
-
|
|
23278
|
+
chalk144.yellow(
|
|
23104
23279
|
`Behind: applied ${status2.applied}, build expects ${status2.expected}.`
|
|
23105
23280
|
)
|
|
23106
23281
|
);
|
|
23107
23282
|
console.error(
|
|
23108
|
-
|
|
23283
|
+
chalk144.yellow(
|
|
23109
23284
|
`Pending: ${status2.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
23110
23285
|
)
|
|
23111
23286
|
);
|
|
23112
23287
|
return;
|
|
23113
23288
|
}
|
|
23114
23289
|
console.error(
|
|
23115
|
-
|
|
23290
|
+
chalk144.red(
|
|
23116
23291
|
`Ahead: applied ${status2.applied}, build knows ${status2.expected}. Update assist.`
|
|
23117
23292
|
)
|
|
23118
23293
|
);
|
|
@@ -23154,7 +23329,7 @@ function registerDb(program) {
|
|
|
23154
23329
|
|
|
23155
23330
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
23156
23331
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync27 } from "fs";
|
|
23157
|
-
import
|
|
23332
|
+
import chalk145 from "chalk";
|
|
23158
23333
|
|
|
23159
23334
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
23160
23335
|
import { join as join62 } from "path";
|
|
@@ -23185,7 +23360,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
23185
23360
|
sweepRestrictedDir();
|
|
23186
23361
|
const state = readMigrationPinState(pin2);
|
|
23187
23362
|
if (!state) {
|
|
23188
|
-
console.error(
|
|
23363
|
+
console.error(chalk145.red(`No pending migration unlock for pin: ${pin2}`));
|
|
23189
23364
|
process.exitCode = 1;
|
|
23190
23365
|
return;
|
|
23191
23366
|
}
|
|
@@ -23195,7 +23370,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
23195
23370
|
);
|
|
23196
23371
|
unlinkSync9(getMigrationPinPath(pin2));
|
|
23197
23372
|
console.log(
|
|
23198
|
-
|
|
23373
|
+
chalk145.green(
|
|
23199
23374
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
23200
23375
|
)
|
|
23201
23376
|
);
|
|
@@ -23204,7 +23379,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
23204
23379
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
23205
23380
|
import { mkdirSync as mkdirSync17, writeFileSync as writeFileSync28 } from "fs";
|
|
23206
23381
|
import { randomInt as randomInt2 } from "crypto";
|
|
23207
|
-
import
|
|
23382
|
+
import chalk146 from "chalk";
|
|
23208
23383
|
|
|
23209
23384
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
23210
23385
|
function nextMigrationId() {
|
|
@@ -23219,7 +23394,7 @@ function dbMigrationUnlock() {
|
|
|
23219
23394
|
sweepRestrictedDir();
|
|
23220
23395
|
writeFileSync28(getMigrationPinPath(pin2), JSON.stringify({ pin: pin2, migrationId }));
|
|
23221
23396
|
console.error(
|
|
23222
|
-
|
|
23397
|
+
chalk146.yellow.bold(
|
|
23223
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."
|
|
23224
23399
|
)
|
|
23225
23400
|
);
|
|
@@ -23229,7 +23404,7 @@ function dbMigrationUnlock() {
|
|
|
23229
23404
|
});
|
|
23230
23405
|
if (!delivered) {
|
|
23231
23406
|
console.error(
|
|
23232
|
-
|
|
23407
|
+
chalk146.red(
|
|
23233
23408
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
23234
23409
|
)
|
|
23235
23410
|
);
|
|
@@ -23239,7 +23414,7 @@ function dbMigrationUnlock() {
|
|
|
23239
23414
|
console.log(
|
|
23240
23415
|
`A confirmation pin was sent to your desktop notifications.
|
|
23241
23416
|
To approve creating migration ${migrationId}, run:
|
|
23242
|
-
${
|
|
23417
|
+
${chalk146.cyan(" assist db-migration confirm <PIN>")}
|
|
23243
23418
|
using the pin from that notification.`
|
|
23244
23419
|
);
|
|
23245
23420
|
}
|
|
@@ -23266,7 +23441,7 @@ function registerDbMigration(parent) {
|
|
|
23266
23441
|
|
|
23267
23442
|
// src/commands/deploy/redirect.ts
|
|
23268
23443
|
import { existsSync as existsSync53, readFileSync as readFileSync34, writeFileSync as writeFileSync29 } from "fs";
|
|
23269
|
-
import
|
|
23444
|
+
import chalk147 from "chalk";
|
|
23270
23445
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
23271
23446
|
if (!window.location.pathname.endsWith('/')) {
|
|
23272
23447
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -23275,23 +23450,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
23275
23450
|
function redirect() {
|
|
23276
23451
|
const indexPath = "index.html";
|
|
23277
23452
|
if (!existsSync53(indexPath)) {
|
|
23278
|
-
console.log(
|
|
23453
|
+
console.log(chalk147.yellow("No index.html found"));
|
|
23279
23454
|
return;
|
|
23280
23455
|
}
|
|
23281
23456
|
const content = readFileSync34(indexPath, "utf8");
|
|
23282
23457
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
23283
|
-
console.log(
|
|
23458
|
+
console.log(chalk147.dim("Trailing slash script already present"));
|
|
23284
23459
|
return;
|
|
23285
23460
|
}
|
|
23286
23461
|
const headCloseIndex = content.indexOf("</head>");
|
|
23287
23462
|
if (headCloseIndex === -1) {
|
|
23288
|
-
console.log(
|
|
23463
|
+
console.log(chalk147.red("Could not find </head> tag in index.html"));
|
|
23289
23464
|
return;
|
|
23290
23465
|
}
|
|
23291
23466
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
23292
23467
|
${content.slice(headCloseIndex)}`;
|
|
23293
23468
|
writeFileSync29(indexPath, newContent);
|
|
23294
|
-
console.log(
|
|
23469
|
+
console.log(chalk147.green("Added trailing slash redirect to index.html"));
|
|
23295
23470
|
}
|
|
23296
23471
|
|
|
23297
23472
|
// src/commands/registerDeploy.ts
|
|
@@ -23318,7 +23493,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
23318
23493
|
|
|
23319
23494
|
// src/commands/devlog/shared.ts
|
|
23320
23495
|
import { execSync as execSync31 } from "child_process";
|
|
23321
|
-
import
|
|
23496
|
+
import chalk148 from "chalk";
|
|
23322
23497
|
|
|
23323
23498
|
// src/shared/getRepoName.ts
|
|
23324
23499
|
import { existsSync as existsSync54, readFileSync as readFileSync35 } from "fs";
|
|
@@ -23427,13 +23602,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
23427
23602
|
}
|
|
23428
23603
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
23429
23604
|
for (const commit2 of commits2) {
|
|
23430
|
-
console.log(` ${
|
|
23605
|
+
console.log(` ${chalk148.yellow(commit2.hash)} ${commit2.message}`);
|
|
23431
23606
|
if (verbose) {
|
|
23432
23607
|
const visibleFiles = commit2.files.filter(
|
|
23433
23608
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
23434
23609
|
);
|
|
23435
23610
|
for (const file of visibleFiles) {
|
|
23436
|
-
console.log(` ${
|
|
23611
|
+
console.log(` ${chalk148.dim(file)}`);
|
|
23437
23612
|
}
|
|
23438
23613
|
}
|
|
23439
23614
|
}
|
|
@@ -23458,15 +23633,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
23458
23633
|
}
|
|
23459
23634
|
|
|
23460
23635
|
// src/commands/devlog/list/printDateHeader.ts
|
|
23461
|
-
import
|
|
23636
|
+
import chalk149 from "chalk";
|
|
23462
23637
|
function printDateHeader(date, isSkipped, entries) {
|
|
23463
23638
|
if (isSkipped) {
|
|
23464
|
-
console.log(`${
|
|
23639
|
+
console.log(`${chalk149.bold.blue(date)} ${chalk149.dim("skipped")}`);
|
|
23465
23640
|
} else if (entries && entries.length > 0) {
|
|
23466
|
-
const entryInfo = entries.map((e) => `${
|
|
23467
|
-
console.log(`${
|
|
23641
|
+
const entryInfo = entries.map((e) => `${chalk149.green(e.version)} ${e.title}`).join(" | ");
|
|
23642
|
+
console.log(`${chalk149.bold.blue(date)} ${entryInfo}`);
|
|
23468
23643
|
} else {
|
|
23469
|
-
console.log(`${
|
|
23644
|
+
console.log(`${chalk149.bold.blue(date)} ${chalk149.red("\u26A0 devlog missing")}`);
|
|
23470
23645
|
}
|
|
23471
23646
|
}
|
|
23472
23647
|
|
|
@@ -23570,24 +23745,24 @@ function bumpVersion(version2, type) {
|
|
|
23570
23745
|
|
|
23571
23746
|
// src/commands/devlog/next/displayNextEntry.ts
|
|
23572
23747
|
import { execFileSync as execFileSync9 } from "child_process";
|
|
23573
|
-
import
|
|
23748
|
+
import chalk151 from "chalk";
|
|
23574
23749
|
|
|
23575
23750
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
23576
|
-
import
|
|
23751
|
+
import chalk150 from "chalk";
|
|
23577
23752
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
23578
23753
|
if (conventional && firstHash) {
|
|
23579
23754
|
const version2 = getVersionAtCommit(firstHash);
|
|
23580
23755
|
if (version2) {
|
|
23581
|
-
console.log(`${
|
|
23756
|
+
console.log(`${chalk150.bold("version:")} ${stripToMinor(version2)}`);
|
|
23582
23757
|
} else {
|
|
23583
|
-
console.log(`${
|
|
23758
|
+
console.log(`${chalk150.bold("version:")} ${chalk150.red("unknown")}`);
|
|
23584
23759
|
}
|
|
23585
23760
|
} else if (patchVersion && minorVersion) {
|
|
23586
23761
|
console.log(
|
|
23587
|
-
`${
|
|
23762
|
+
`${chalk150.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
23588
23763
|
);
|
|
23589
23764
|
} else {
|
|
23590
|
-
console.log(`${
|
|
23765
|
+
console.log(`${chalk150.bold("version:")} v0.1 (initial)`);
|
|
23591
23766
|
}
|
|
23592
23767
|
}
|
|
23593
23768
|
|
|
@@ -23635,16 +23810,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
23635
23810
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
23636
23811
|
}
|
|
23637
23812
|
function logName(repoName) {
|
|
23638
|
-
console.log(`${
|
|
23813
|
+
console.log(`${chalk151.bold("name:")} ${repoName}`);
|
|
23639
23814
|
}
|
|
23640
23815
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
23641
23816
|
logName(ctx.repoName);
|
|
23642
23817
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
23643
|
-
console.log(
|
|
23818
|
+
console.log(chalk151.bold.blue(targetDate));
|
|
23644
23819
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
23645
23820
|
}
|
|
23646
23821
|
function logNoCommits(lastInfo) {
|
|
23647
|
-
console.log(
|
|
23822
|
+
console.log(chalk151.dim(noCommitsMessage(!!lastInfo)));
|
|
23648
23823
|
}
|
|
23649
23824
|
|
|
23650
23825
|
// src/commands/devlog/next.ts
|
|
@@ -23685,11 +23860,11 @@ function next2(options2) {
|
|
|
23685
23860
|
import { execSync as execSync33 } from "child_process";
|
|
23686
23861
|
|
|
23687
23862
|
// src/commands/devlog/repos/printReposTable.ts
|
|
23688
|
-
import
|
|
23863
|
+
import chalk152 from "chalk";
|
|
23689
23864
|
function colorStatus(status2) {
|
|
23690
|
-
if (status2 === "missing") return
|
|
23691
|
-
if (status2 === "outdated") return
|
|
23692
|
-
return
|
|
23865
|
+
if (status2 === "missing") return chalk152.red(status2);
|
|
23866
|
+
if (status2 === "outdated") return chalk152.yellow(status2);
|
|
23867
|
+
return chalk152.green(status2);
|
|
23693
23868
|
}
|
|
23694
23869
|
function formatRow(row3, nameWidth) {
|
|
23695
23870
|
const devlog = (row3.lastDevlog ?? "-").padEnd(11);
|
|
@@ -23703,8 +23878,8 @@ function printReposTable(rows) {
|
|
|
23703
23878
|
"Last Devlog".padEnd(11),
|
|
23704
23879
|
"Status"
|
|
23705
23880
|
].join(" ");
|
|
23706
|
-
console.log(
|
|
23707
|
-
console.log(
|
|
23881
|
+
console.log(chalk152.dim(header));
|
|
23882
|
+
console.log(chalk152.dim("-".repeat(header.length)));
|
|
23708
23883
|
for (const row3 of rows) {
|
|
23709
23884
|
console.log(formatRow(row3, nameWidth));
|
|
23710
23885
|
}
|
|
@@ -23762,14 +23937,14 @@ function repos(options2) {
|
|
|
23762
23937
|
// src/commands/devlog/skip.ts
|
|
23763
23938
|
import { writeFileSync as writeFileSync30 } from "fs";
|
|
23764
23939
|
import { join as join66 } from "path";
|
|
23765
|
-
import
|
|
23940
|
+
import chalk153 from "chalk";
|
|
23766
23941
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
23767
23942
|
function getBlogConfigPath() {
|
|
23768
23943
|
return join66(BLOG_REPO_ROOT, "assist.yml");
|
|
23769
23944
|
}
|
|
23770
23945
|
function skip2(date) {
|
|
23771
23946
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
23772
|
-
console.log(
|
|
23947
|
+
console.log(chalk153.red("Invalid date format. Use YYYY-MM-DD"));
|
|
23773
23948
|
process.exit(1);
|
|
23774
23949
|
}
|
|
23775
23950
|
const repoName = getRepoName();
|
|
@@ -23780,7 +23955,7 @@ function skip2(date) {
|
|
|
23780
23955
|
const skipDays = skip3[repoName] ?? [];
|
|
23781
23956
|
if (skipDays.includes(date)) {
|
|
23782
23957
|
console.log(
|
|
23783
|
-
|
|
23958
|
+
chalk153.yellow(`${date} is already in skip list for ${repoName}`)
|
|
23784
23959
|
);
|
|
23785
23960
|
return;
|
|
23786
23961
|
}
|
|
@@ -23790,20 +23965,20 @@ function skip2(date) {
|
|
|
23790
23965
|
devlog.skip = skip3;
|
|
23791
23966
|
config.devlog = devlog;
|
|
23792
23967
|
writeFileSync30(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
23793
|
-
console.log(
|
|
23968
|
+
console.log(chalk153.green(`Added ${date} to skip list for ${repoName}`));
|
|
23794
23969
|
}
|
|
23795
23970
|
|
|
23796
23971
|
// src/commands/devlog/version.ts
|
|
23797
|
-
import
|
|
23972
|
+
import chalk154 from "chalk";
|
|
23798
23973
|
function version() {
|
|
23799
23974
|
const config = loadConfig();
|
|
23800
23975
|
const name = getRepoName();
|
|
23801
23976
|
const lastInfo = getLastVersionInfo(name, config);
|
|
23802
23977
|
const lastVersion = lastInfo?.version ?? null;
|
|
23803
23978
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
23804
|
-
console.log(`${
|
|
23805
|
-
console.log(`${
|
|
23806
|
-
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")}`);
|
|
23807
23982
|
}
|
|
23808
23983
|
|
|
23809
23984
|
// src/commands/registerDevlog.ts
|
|
@@ -23828,7 +24003,7 @@ function registerDevlog(program) {
|
|
|
23828
24003
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
23829
24004
|
import { closeSync as closeSync4, openSync as openSync5, readdirSync as readdirSync9 } from "fs";
|
|
23830
24005
|
import { join as join67 } from "path";
|
|
23831
|
-
import
|
|
24006
|
+
import chalk155 from "chalk";
|
|
23832
24007
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
23833
24008
|
function isLockedDll(debugDir) {
|
|
23834
24009
|
let files;
|
|
@@ -23875,14 +24050,14 @@ function checkBuildLocks(startDir) {
|
|
|
23875
24050
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
23876
24051
|
if (locked) {
|
|
23877
24052
|
console.error(
|
|
23878
|
-
|
|
24053
|
+
chalk155.red("Build output locked (is VS debugging?): ") + locked
|
|
23879
24054
|
);
|
|
23880
24055
|
process.exit(1);
|
|
23881
24056
|
}
|
|
23882
24057
|
}
|
|
23883
24058
|
async function checkBuildLocksCommand() {
|
|
23884
24059
|
checkBuildLocks();
|
|
23885
|
-
console.log(
|
|
24060
|
+
console.log(chalk155.green("No build locks detected"));
|
|
23886
24061
|
}
|
|
23887
24062
|
|
|
23888
24063
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -23981,30 +24156,30 @@ function escapeRegex(s) {
|
|
|
23981
24156
|
}
|
|
23982
24157
|
|
|
23983
24158
|
// src/commands/dotnet/printTree.ts
|
|
23984
|
-
import
|
|
24159
|
+
import chalk156 from "chalk";
|
|
23985
24160
|
function printNodes(nodes, prefix2) {
|
|
23986
24161
|
for (let i = 0; i < nodes.length; i++) {
|
|
23987
24162
|
const isLast = i === nodes.length - 1;
|
|
23988
24163
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
23989
24164
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
23990
24165
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
23991
|
-
const label2 = isMissing ?
|
|
24166
|
+
const label2 = isMissing ? chalk156.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
23992
24167
|
console.log(`${prefix2}${connector}${label2}`);
|
|
23993
24168
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
23994
24169
|
}
|
|
23995
24170
|
}
|
|
23996
24171
|
function printTree(tree, totalCount, solutions) {
|
|
23997
|
-
console.log(
|
|
23998
|
-
console.log(
|
|
24172
|
+
console.log(chalk156.bold("\nProject Dependency Tree"));
|
|
24173
|
+
console.log(chalk156.cyan(tree.relativePath));
|
|
23999
24174
|
printNodes(tree.children, "");
|
|
24000
|
-
console.log(
|
|
24175
|
+
console.log(chalk156.dim(`
|
|
24001
24176
|
${totalCount} projects total (including root)`));
|
|
24002
|
-
console.log(
|
|
24177
|
+
console.log(chalk156.bold("\nSolution Membership"));
|
|
24003
24178
|
if (solutions.length === 0) {
|
|
24004
|
-
console.log(
|
|
24179
|
+
console.log(chalk156.yellow(" Not found in any .sln"));
|
|
24005
24180
|
} else {
|
|
24006
24181
|
for (const sln of solutions) {
|
|
24007
|
-
console.log(` ${
|
|
24182
|
+
console.log(` ${chalk156.green(sln)}`);
|
|
24008
24183
|
}
|
|
24009
24184
|
}
|
|
24010
24185
|
console.log();
|
|
@@ -24033,16 +24208,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
24033
24208
|
// src/commands/dotnet/resolveCsproj.ts
|
|
24034
24209
|
import { existsSync as existsSync55 } from "fs";
|
|
24035
24210
|
import path37 from "path";
|
|
24036
|
-
import
|
|
24211
|
+
import chalk157 from "chalk";
|
|
24037
24212
|
function resolveCsproj(csprojPath) {
|
|
24038
24213
|
const resolved = path37.resolve(csprojPath);
|
|
24039
24214
|
if (!existsSync55(resolved)) {
|
|
24040
|
-
console.error(
|
|
24215
|
+
console.error(chalk157.red(`File not found: ${resolved}`));
|
|
24041
24216
|
process.exit(1);
|
|
24042
24217
|
}
|
|
24043
24218
|
const repoRoot2 = findRepoRoot(path37.dirname(resolved));
|
|
24044
24219
|
if (!repoRoot2) {
|
|
24045
|
-
console.error(
|
|
24220
|
+
console.error(chalk157.red("Could not find git repository root"));
|
|
24046
24221
|
process.exit(1);
|
|
24047
24222
|
}
|
|
24048
24223
|
return { resolved, repoRoot: repoRoot2 };
|
|
@@ -24092,12 +24267,12 @@ function getChangedCsFiles(scope) {
|
|
|
24092
24267
|
}
|
|
24093
24268
|
|
|
24094
24269
|
// src/commands/dotnet/inSln.ts
|
|
24095
|
-
import
|
|
24270
|
+
import chalk158 from "chalk";
|
|
24096
24271
|
async function inSln(csprojPath) {
|
|
24097
24272
|
const { resolved, repoRoot: repoRoot2 } = resolveCsproj(csprojPath);
|
|
24098
24273
|
const solutions = findContainingSolutions(resolved, repoRoot2);
|
|
24099
24274
|
if (solutions.length === 0) {
|
|
24100
|
-
console.log(
|
|
24275
|
+
console.log(chalk158.yellow("Not found in any .sln file"));
|
|
24101
24276
|
process.exit(1);
|
|
24102
24277
|
}
|
|
24103
24278
|
for (const sln of solutions) {
|
|
@@ -24106,7 +24281,7 @@ async function inSln(csprojPath) {
|
|
|
24106
24281
|
}
|
|
24107
24282
|
|
|
24108
24283
|
// src/commands/dotnet/inspect.ts
|
|
24109
|
-
import
|
|
24284
|
+
import chalk164 from "chalk";
|
|
24110
24285
|
|
|
24111
24286
|
// src/shared/formatElapsed.ts
|
|
24112
24287
|
function formatElapsed(ms) {
|
|
@@ -24118,12 +24293,12 @@ function formatElapsed(ms) {
|
|
|
24118
24293
|
}
|
|
24119
24294
|
|
|
24120
24295
|
// src/commands/dotnet/displayIssues.ts
|
|
24121
|
-
import
|
|
24296
|
+
import chalk159 from "chalk";
|
|
24122
24297
|
var SEVERITY_COLOR = {
|
|
24123
|
-
ERROR:
|
|
24124
|
-
WARNING:
|
|
24125
|
-
SUGGESTION:
|
|
24126
|
-
HINT:
|
|
24298
|
+
ERROR: chalk159.red,
|
|
24299
|
+
WARNING: chalk159.yellow,
|
|
24300
|
+
SUGGESTION: chalk159.cyan,
|
|
24301
|
+
HINT: chalk159.dim
|
|
24127
24302
|
};
|
|
24128
24303
|
function groupByFile(issues) {
|
|
24129
24304
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -24139,15 +24314,15 @@ function groupByFile(issues) {
|
|
|
24139
24314
|
}
|
|
24140
24315
|
function displayIssues(issues) {
|
|
24141
24316
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
24142
|
-
console.log(
|
|
24317
|
+
console.log(chalk159.bold(file));
|
|
24143
24318
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
24144
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
24319
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk159.white;
|
|
24145
24320
|
console.log(
|
|
24146
|
-
` ${
|
|
24321
|
+
` ${chalk159.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
24147
24322
|
);
|
|
24148
24323
|
}
|
|
24149
24324
|
}
|
|
24150
|
-
console.log(
|
|
24325
|
+
console.log(chalk159.dim(`
|
|
24151
24326
|
${issues.length} issue(s) found`));
|
|
24152
24327
|
}
|
|
24153
24328
|
|
|
@@ -24206,12 +24381,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
24206
24381
|
// src/commands/dotnet/resolveSolution.ts
|
|
24207
24382
|
import { existsSync as existsSync56 } from "fs";
|
|
24208
24383
|
import path38 from "path";
|
|
24209
|
-
import
|
|
24384
|
+
import chalk161 from "chalk";
|
|
24210
24385
|
|
|
24211
24386
|
// src/commands/dotnet/findSolution.ts
|
|
24212
24387
|
import { readdirSync as readdirSync11 } from "fs";
|
|
24213
24388
|
import { dirname as dirname29, join as join68 } from "path";
|
|
24214
|
-
import
|
|
24389
|
+
import chalk160 from "chalk";
|
|
24215
24390
|
function findSlnInDir(dir) {
|
|
24216
24391
|
try {
|
|
24217
24392
|
return readdirSync11(dir).filter((f) => f.endsWith(".sln")).map((f) => join68(dir, f));
|
|
@@ -24227,17 +24402,17 @@ function findSolution() {
|
|
|
24227
24402
|
const slnFiles = findSlnInDir(current);
|
|
24228
24403
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
24229
24404
|
if (slnFiles.length > 1) {
|
|
24230
|
-
console.error(
|
|
24405
|
+
console.error(chalk160.red(`Multiple .sln files found in ${current}:`));
|
|
24231
24406
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
24232
24407
|
console.error(
|
|
24233
|
-
|
|
24408
|
+
chalk160.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
24234
24409
|
);
|
|
24235
24410
|
process.exit(1);
|
|
24236
24411
|
}
|
|
24237
24412
|
if (current === ceiling) break;
|
|
24238
24413
|
current = dirname29(current);
|
|
24239
24414
|
}
|
|
24240
|
-
console.error(
|
|
24415
|
+
console.error(chalk160.red("No .sln file found between cwd and repo root"));
|
|
24241
24416
|
process.exit(1);
|
|
24242
24417
|
}
|
|
24243
24418
|
|
|
@@ -24246,7 +24421,7 @@ function resolveSolution(sln) {
|
|
|
24246
24421
|
if (sln) {
|
|
24247
24422
|
const resolved = path38.resolve(sln);
|
|
24248
24423
|
if (!existsSync56(resolved)) {
|
|
24249
|
-
console.error(
|
|
24424
|
+
console.error(chalk161.red(`Solution file not found: ${resolved}`));
|
|
24250
24425
|
process.exit(1);
|
|
24251
24426
|
}
|
|
24252
24427
|
return resolved;
|
|
@@ -24288,14 +24463,14 @@ import { execSync as execSync35 } from "child_process";
|
|
|
24288
24463
|
import { existsSync as existsSync57, readFileSync as readFileSync39, unlinkSync as unlinkSync10 } from "fs";
|
|
24289
24464
|
import { tmpdir as tmpdir4 } from "os";
|
|
24290
24465
|
import path39 from "path";
|
|
24291
|
-
import
|
|
24466
|
+
import chalk162 from "chalk";
|
|
24292
24467
|
function assertJbInstalled() {
|
|
24293
24468
|
try {
|
|
24294
24469
|
execSync35("jb inspectcode --version", { stdio: "pipe" });
|
|
24295
24470
|
} catch {
|
|
24296
|
-
console.error(
|
|
24471
|
+
console.error(chalk162.red("jb is not installed. Install with:"));
|
|
24297
24472
|
console.error(
|
|
24298
|
-
|
|
24473
|
+
chalk162.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
24299
24474
|
);
|
|
24300
24475
|
process.exit(1);
|
|
24301
24476
|
}
|
|
@@ -24313,11 +24488,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
24313
24488
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
24314
24489
|
process.stderr.write(error.stderr);
|
|
24315
24490
|
}
|
|
24316
|
-
console.error(
|
|
24491
|
+
console.error(chalk162.red("jb inspectcode failed"));
|
|
24317
24492
|
process.exit(1);
|
|
24318
24493
|
}
|
|
24319
24494
|
if (!existsSync57(reportPath)) {
|
|
24320
|
-
console.error(
|
|
24495
|
+
console.error(chalk162.red("Report file not generated"));
|
|
24321
24496
|
process.exit(1);
|
|
24322
24497
|
}
|
|
24323
24498
|
const xml = readFileSync39(reportPath, "utf8");
|
|
@@ -24327,7 +24502,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
24327
24502
|
|
|
24328
24503
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
24329
24504
|
import { execSync as execSync36 } from "child_process";
|
|
24330
|
-
import
|
|
24505
|
+
import chalk163 from "chalk";
|
|
24331
24506
|
function resolveMsbuildPath() {
|
|
24332
24507
|
const { run: run4 } = loadConfig();
|
|
24333
24508
|
const configs = resolveRunConfigs(run4, runConfigBaseDir());
|
|
@@ -24339,9 +24514,9 @@ function assertMsbuildInstalled() {
|
|
|
24339
24514
|
try {
|
|
24340
24515
|
execSync36(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
24341
24516
|
} catch {
|
|
24342
|
-
console.error(
|
|
24517
|
+
console.error(chalk163.red(`msbuild not found at: ${msbuild}`));
|
|
24343
24518
|
console.error(
|
|
24344
|
-
|
|
24519
|
+
chalk163.yellow(
|
|
24345
24520
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
24346
24521
|
)
|
|
24347
24522
|
);
|
|
@@ -24388,17 +24563,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
24388
24563
|
// src/commands/dotnet/inspect.ts
|
|
24389
24564
|
function logScope(changedFiles2) {
|
|
24390
24565
|
if (changedFiles2 === null) {
|
|
24391
|
-
console.log(
|
|
24566
|
+
console.log(chalk164.dim("Inspecting full solution..."));
|
|
24392
24567
|
} else {
|
|
24393
24568
|
console.log(
|
|
24394
|
-
|
|
24569
|
+
chalk164.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
24395
24570
|
);
|
|
24396
24571
|
}
|
|
24397
24572
|
}
|
|
24398
24573
|
function reportResults(issues, elapsed) {
|
|
24399
24574
|
if (issues.length > 0) displayIssues(issues);
|
|
24400
|
-
else console.log(
|
|
24401
|
-
console.log(
|
|
24575
|
+
else console.log(chalk164.green("No issues found"));
|
|
24576
|
+
console.log(chalk164.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
24402
24577
|
if (issues.length > 0) process.exit(1);
|
|
24403
24578
|
}
|
|
24404
24579
|
async function inspect(sln, options2) {
|
|
@@ -24409,7 +24584,7 @@ async function inspect(sln, options2) {
|
|
|
24409
24584
|
const scope = parseScope(options2.scope);
|
|
24410
24585
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
24411
24586
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
24412
|
-
console.log(
|
|
24587
|
+
console.log(chalk164.green("No changed .cs files found"));
|
|
24413
24588
|
return;
|
|
24414
24589
|
}
|
|
24415
24590
|
logScope(changedFiles2);
|
|
@@ -25287,25 +25462,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
25287
25462
|
}
|
|
25288
25463
|
|
|
25289
25464
|
// src/commands/github/printCountTable.ts
|
|
25290
|
-
import
|
|
25465
|
+
import chalk165 from "chalk";
|
|
25291
25466
|
function printCountTable(labelHeader, rows) {
|
|
25292
25467
|
const labelWidth = Math.max(
|
|
25293
25468
|
labelHeader.length,
|
|
25294
25469
|
...rows.map((row3) => row3.label.length)
|
|
25295
25470
|
);
|
|
25296
25471
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
25297
|
-
console.log(
|
|
25298
|
-
console.log(
|
|
25472
|
+
console.log(chalk165.dim(header));
|
|
25473
|
+
console.log(chalk165.dim("-".repeat(header.length)));
|
|
25299
25474
|
for (const row3 of rows) {
|
|
25300
25475
|
console.log(`${row3.label.padEnd(labelWidth)} ${row3.count}`);
|
|
25301
25476
|
}
|
|
25302
25477
|
}
|
|
25303
25478
|
|
|
25304
25479
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
25305
|
-
import
|
|
25480
|
+
import chalk166 from "chalk";
|
|
25306
25481
|
function printRepoAuthorBreakdown(repos2) {
|
|
25307
25482
|
for (const repo of repos2) {
|
|
25308
|
-
console.log(
|
|
25483
|
+
console.log(chalk166.bold(repo.name));
|
|
25309
25484
|
const authorWidth = Math.max(
|
|
25310
25485
|
0,
|
|
25311
25486
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -25388,10 +25563,10 @@ function parseTopCount(value) {
|
|
|
25388
25563
|
}
|
|
25389
25564
|
|
|
25390
25565
|
// src/commands/github/issue/fixStructure/applyAndVerifySubtree.ts
|
|
25391
|
-
import
|
|
25566
|
+
import chalk168 from "chalk";
|
|
25392
25567
|
|
|
25393
25568
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
25394
|
-
import
|
|
25569
|
+
import chalk167 from "chalk";
|
|
25395
25570
|
|
|
25396
25571
|
// src/commands/github/issue/fixStructure/removeIssueLabels.ts
|
|
25397
25572
|
var MUTATION2 = `mutation($labelableId: ID!, $labelIds: [ID!]!) {
|
|
@@ -25428,7 +25603,7 @@ function writeLineNow(line) {
|
|
|
25428
25603
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
25429
25604
|
function applyFixStructurePlan(plan2) {
|
|
25430
25605
|
for (const entry of plan2.entries) {
|
|
25431
|
-
const where =
|
|
25606
|
+
const where = chalk167.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
25432
25607
|
const { typeChange, labelRemovals } = entry;
|
|
25433
25608
|
if (typeChange) {
|
|
25434
25609
|
writeLineNow(
|
|
@@ -25698,12 +25873,12 @@ function planSubtree(root2, context) {
|
|
|
25698
25873
|
function applyAndVerifySubtree(target, plan2, context) {
|
|
25699
25874
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) return;
|
|
25700
25875
|
applyFixStructurePlan(plan2);
|
|
25701
|
-
writeLineNow(
|
|
25876
|
+
writeLineNow(chalk168.dim("Re-walking the subtree to confirm"));
|
|
25702
25877
|
assertNoResidualDrift(
|
|
25703
25878
|
planSubtree(fetchRootIssue(target), context),
|
|
25704
25879
|
context.chain
|
|
25705
25880
|
);
|
|
25706
|
-
writeLineNow(
|
|
25881
|
+
writeLineNow(chalk168.green("Subtree normalised"));
|
|
25707
25882
|
}
|
|
25708
25883
|
|
|
25709
25884
|
// src/commands/github/issue/fixStructure/assertChainTypesExist.ts
|
|
@@ -25739,22 +25914,22 @@ function parseTypeChain(value) {
|
|
|
25739
25914
|
}
|
|
25740
25915
|
|
|
25741
25916
|
// src/commands/github/issue/fixStructure/printFixStructurePlan.ts
|
|
25742
|
-
import
|
|
25917
|
+
import chalk169 from "chalk";
|
|
25743
25918
|
function annotate(entry) {
|
|
25744
25919
|
const notes = [];
|
|
25745
25920
|
if (entry.level === null) {
|
|
25746
|
-
notes.push(
|
|
25921
|
+
notes.push(chalk169.red("deeper than the leaf level"));
|
|
25747
25922
|
} else if (entry.typeChange) {
|
|
25748
25923
|
notes.push(
|
|
25749
|
-
|
|
25924
|
+
chalk169.yellow(
|
|
25750
25925
|
`${entry.typeChange.from ?? "no type"} -> ${entry.typeChange.to}`
|
|
25751
25926
|
)
|
|
25752
25927
|
);
|
|
25753
25928
|
} else {
|
|
25754
|
-
notes.push(
|
|
25929
|
+
notes.push(chalk169.dim(entry.issue.typeName ?? "no type"));
|
|
25755
25930
|
}
|
|
25756
25931
|
for (const label2 of entry.labelRemovals) {
|
|
25757
|
-
notes.push(
|
|
25932
|
+
notes.push(chalk169.yellow(`-${label2.name}`));
|
|
25758
25933
|
}
|
|
25759
25934
|
return notes;
|
|
25760
25935
|
}
|
|
@@ -25762,22 +25937,22 @@ function formatCount(count10, noun) {
|
|
|
25762
25937
|
return `${count10} ${noun}${count10 === 1 ? "" : "s"}`;
|
|
25763
25938
|
}
|
|
25764
25939
|
function printFixStructurePlan(plan2, chain2, apply) {
|
|
25765
|
-
writeLineNow(
|
|
25940
|
+
writeLineNow(chalk169.dim(`chain: ${chain2.join(" > ")}`));
|
|
25766
25941
|
for (const entry of plan2.entries) {
|
|
25767
25942
|
const indent3 = " ".repeat(entry.issue.depth);
|
|
25768
|
-
const name =
|
|
25943
|
+
const name = chalk169.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
25769
25944
|
writeLineNow(
|
|
25770
25945
|
`${indent3}${name} ${entry.issue.title} [${annotate(entry).join(", ")}]`
|
|
25771
25946
|
);
|
|
25772
25947
|
}
|
|
25773
25948
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) {
|
|
25774
|
-
writeLineNow(
|
|
25949
|
+
writeLineNow(chalk169.green("Nothing to change"));
|
|
25775
25950
|
return;
|
|
25776
25951
|
}
|
|
25777
25952
|
writeLineNow(
|
|
25778
25953
|
`${formatCount(plan2.typeChangeCount, "type change")}, ${formatCount(plan2.labelRemovalCount, "label removal")} planned`
|
|
25779
25954
|
);
|
|
25780
|
-
if (!apply) writeLineNow(
|
|
25955
|
+
if (!apply) writeLineNow(chalk169.dim("Dry run \u2014 nothing written"));
|
|
25781
25956
|
}
|
|
25782
25957
|
|
|
25783
25958
|
// src/commands/github/issue/parseRepoSlug.ts
|
|
@@ -25963,13 +26138,13 @@ function validateProposedContent(labels, title, body) {
|
|
|
25963
26138
|
}
|
|
25964
26139
|
|
|
25965
26140
|
// src/commands/github/issue/reviewProposedIssueComment.ts
|
|
25966
|
-
import { randomUUID as
|
|
26141
|
+
import { randomUUID as randomUUID9 } from "crypto";
|
|
25967
26142
|
async function reviewProposedIssueComment(title, body) {
|
|
25968
26143
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
25969
26144
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
25970
26145
|
await awaitPreviewApproval("GitHub issue comment preview", {
|
|
25971
26146
|
sessionId,
|
|
25972
|
-
requestId:
|
|
26147
|
+
requestId: randomUUID9(),
|
|
25973
26148
|
title,
|
|
25974
26149
|
body,
|
|
25975
26150
|
prNumber: null,
|
|
@@ -26487,13 +26662,13 @@ function resolveCreateIssueMetadata(options2) {
|
|
|
26487
26662
|
}
|
|
26488
26663
|
|
|
26489
26664
|
// src/commands/github/issue/reviewProposedIssue.ts
|
|
26490
|
-
import { randomUUID as
|
|
26665
|
+
import { randomUUID as randomUUID10 } from "crypto";
|
|
26491
26666
|
async function reviewProposedIssue(title, body, metadata2 = []) {
|
|
26492
26667
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
26493
26668
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return void 0;
|
|
26494
26669
|
return await awaitPreviewApproval("GitHub issue preview", {
|
|
26495
26670
|
sessionId,
|
|
26496
|
-
requestId:
|
|
26671
|
+
requestId: randomUUID10(),
|
|
26497
26672
|
title,
|
|
26498
26673
|
body,
|
|
26499
26674
|
prNumber: null,
|
|
@@ -26798,7 +26973,7 @@ function pushUnchangedIssue(number, repo, target, fetchedAt, bodyPath) {
|
|
|
26798
26973
|
}
|
|
26799
26974
|
|
|
26800
26975
|
// src/commands/github/issue/reviewProposedIssueEdit.ts
|
|
26801
|
-
import { randomUUID as
|
|
26976
|
+
import { randomUUID as randomUUID11 } from "crypto";
|
|
26802
26977
|
async function reviewProposedIssueEdit(title, body, working) {
|
|
26803
26978
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
26804
26979
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return body;
|
|
@@ -26806,7 +26981,7 @@ async function reviewProposedIssueEdit(title, body, working) {
|
|
|
26806
26981
|
"GitHub issue edit preview",
|
|
26807
26982
|
{
|
|
26808
26983
|
sessionId,
|
|
26809
|
-
requestId:
|
|
26984
|
+
requestId: randomUUID11(),
|
|
26810
26985
|
title,
|
|
26811
26986
|
body,
|
|
26812
26987
|
prNumber: null,
|
|
@@ -27139,7 +27314,7 @@ function registerGithub(program) {
|
|
|
27139
27314
|
}
|
|
27140
27315
|
|
|
27141
27316
|
// src/commands/jira/acceptanceCriteria.ts
|
|
27142
|
-
import
|
|
27317
|
+
import chalk170 from "chalk";
|
|
27143
27318
|
|
|
27144
27319
|
// src/commands/jira/adfToText.ts
|
|
27145
27320
|
function renderInline(node) {
|
|
@@ -27206,7 +27381,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
27206
27381
|
const parsed = fetchIssue(issueKey, field);
|
|
27207
27382
|
const acValue = parsed?.fields?.[field];
|
|
27208
27383
|
if (!acValue) {
|
|
27209
|
-
console.log(
|
|
27384
|
+
console.log(chalk170.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
27210
27385
|
return;
|
|
27211
27386
|
}
|
|
27212
27387
|
if (typeof acValue === "string") {
|
|
@@ -27272,14 +27447,14 @@ async function jiraAuth() {
|
|
|
27272
27447
|
}
|
|
27273
27448
|
|
|
27274
27449
|
// src/commands/jira/viewIssue.ts
|
|
27275
|
-
import
|
|
27450
|
+
import chalk171 from "chalk";
|
|
27276
27451
|
function viewIssue2(issueKey) {
|
|
27277
27452
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
27278
27453
|
const fields = parsed?.fields;
|
|
27279
27454
|
const summary = fields?.summary;
|
|
27280
27455
|
const description = fields?.description;
|
|
27281
27456
|
if (summary) {
|
|
27282
|
-
console.log(
|
|
27457
|
+
console.log(chalk171.bold(summary));
|
|
27283
27458
|
}
|
|
27284
27459
|
if (description) {
|
|
27285
27460
|
if (summary) console.log();
|
|
@@ -27293,7 +27468,7 @@ function viewIssue2(issueKey) {
|
|
|
27293
27468
|
}
|
|
27294
27469
|
if (!summary && !description) {
|
|
27295
27470
|
console.log(
|
|
27296
|
-
|
|
27471
|
+
chalk171.yellow(`No summary or description found on ${issueKey}.`)
|
|
27297
27472
|
);
|
|
27298
27473
|
}
|
|
27299
27474
|
}
|
|
@@ -27324,7 +27499,7 @@ function registerRefineLaunch(program, resumeFlag) {
|
|
|
27324
27499
|
}
|
|
27325
27500
|
|
|
27326
27501
|
// src/commands/fixConflict.ts
|
|
27327
|
-
import { randomUUID as
|
|
27502
|
+
import { randomUUID as randomUUID12 } from "crypto";
|
|
27328
27503
|
|
|
27329
27504
|
// src/commands/review/checkoutPr.ts
|
|
27330
27505
|
import { execFileSync as execFileSync19 } from "child_process";
|
|
@@ -28005,10 +28180,35 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
28005
28180
|
}
|
|
28006
28181
|
|
|
28007
28182
|
// src/commands/review/failCheckout.ts
|
|
28008
|
-
import
|
|
28183
|
+
import chalk172 from "chalk";
|
|
28009
28184
|
|
|
28010
28185
|
// src/commands/review/azCliProblem.ts
|
|
28011
28186
|
import { execFileSync as execFileSync18 } from "child_process";
|
|
28187
|
+
|
|
28188
|
+
// src/commands/review/azFailureProblem.ts
|
|
28189
|
+
var azProblems = {
|
|
28190
|
+
missing: "Azure CLI (az) not found; install it (https://aka.ms/azure-cli) and run az login.",
|
|
28191
|
+
extension: "The azure-devops az extension is not installed; run az extension add --name azure-devops.",
|
|
28192
|
+
login: "az is not logged in; run az login."
|
|
28193
|
+
};
|
|
28194
|
+
var EXTENSION_PATTERNS = [
|
|
28195
|
+
/requires the extension azure-devops/i,
|
|
28196
|
+
/'(?:repos|devops)' is misspelled or not recognized/i,
|
|
28197
|
+
/'(?:repos|devops)' is not in the 'az' command group/i
|
|
28198
|
+
];
|
|
28199
|
+
var LOGIN_PATTERNS = [/\baz login\b/i, /you need to run the login command/i];
|
|
28200
|
+
function azFailureProblem(error) {
|
|
28201
|
+
if (error?.code === "ENOENT")
|
|
28202
|
+
return azProblems.missing;
|
|
28203
|
+
const stderr = error?.stderr?.toString() ?? "";
|
|
28204
|
+
if (EXTENSION_PATTERNS.some((pattern2) => pattern2.test(stderr)))
|
|
28205
|
+
return azProblems.extension;
|
|
28206
|
+
if (LOGIN_PATTERNS.some((pattern2) => pattern2.test(stderr)))
|
|
28207
|
+
return azProblems.login;
|
|
28208
|
+
return null;
|
|
28209
|
+
}
|
|
28210
|
+
|
|
28211
|
+
// src/commands/review/azCliProblem.ts
|
|
28012
28212
|
function runAz(args) {
|
|
28013
28213
|
try {
|
|
28014
28214
|
execFileSync18("az", args, { stdio: "ignore" });
|
|
@@ -28017,13 +28217,13 @@ function runAz(args) {
|
|
|
28017
28217
|
return error.code === "ENOENT" ? "missing" : "failed";
|
|
28018
28218
|
}
|
|
28019
28219
|
}
|
|
28020
|
-
function azCliProblem() {
|
|
28021
|
-
|
|
28022
|
-
|
|
28220
|
+
function azCliProblem(error) {
|
|
28221
|
+
const fromFailure = error === void 0 ? null : azFailureProblem(error);
|
|
28222
|
+
if (fromFailure) return fromFailure;
|
|
28223
|
+
if (runAz(["version"]) === "missing") return azProblems.missing;
|
|
28023
28224
|
if (runAz(["extension", "show", "--name", "azure-devops"]) !== "ok")
|
|
28024
|
-
return
|
|
28025
|
-
if (runAz(["account", "show"]) !== "ok")
|
|
28026
|
-
return "az is not logged in; run az login.";
|
|
28225
|
+
return azProblems.extension;
|
|
28226
|
+
if (runAz(["account", "show"]) !== "ok") return azProblems.login;
|
|
28027
28227
|
return null;
|
|
28028
28228
|
}
|
|
28029
28229
|
|
|
@@ -28033,14 +28233,14 @@ function failCheckout(number, headRef, stale, from, checkout) {
|
|
|
28033
28233
|
gitSyncOrNull(process.cwd(), ["checkout", "--quiet", from]);
|
|
28034
28234
|
if (headRef && stale === "local-work")
|
|
28035
28235
|
console.error(
|
|
28036
|
-
|
|
28236
|
+
chalk172.red(
|
|
28037
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.`
|
|
28038
28238
|
)
|
|
28039
28239
|
);
|
|
28040
28240
|
const problem = checkout.file === "az" ? azCliProblem() : null;
|
|
28041
|
-
if (problem) console.error(
|
|
28241
|
+
if (problem) console.error(chalk172.red(problem));
|
|
28042
28242
|
console.error(
|
|
28043
|
-
|
|
28243
|
+
chalk172.red(`${checkout.file} ${checkout.args.join(" ")} failed; aborting.`)
|
|
28044
28244
|
);
|
|
28045
28245
|
process.exit(1);
|
|
28046
28246
|
}
|
|
@@ -28089,7 +28289,7 @@ function buildPrompt2(rebase) {
|
|
|
28089
28289
|
async function fixConflict(number, options2 = {}) {
|
|
28090
28290
|
const { resumeSessionId } = options2;
|
|
28091
28291
|
if (number && !resumeSessionId) await checkoutPr(number);
|
|
28092
|
-
const claudeSessionId = resumeSessionId ??
|
|
28292
|
+
const claudeSessionId = resumeSessionId ?? randomUUID12();
|
|
28093
28293
|
emitActivity({
|
|
28094
28294
|
kind: "command",
|
|
28095
28295
|
name: "fix-conflict",
|
|
@@ -28117,7 +28317,7 @@ function registerFixConflict(program, resumeFlag) {
|
|
|
28117
28317
|
}
|
|
28118
28318
|
|
|
28119
28319
|
// src/commands/reviewPrComments.ts
|
|
28120
|
-
import { randomUUID as
|
|
28320
|
+
import { randomUUID as randomUUID13 } from "crypto";
|
|
28121
28321
|
function buildPrompt3(number, announce, options2) {
|
|
28122
28322
|
const args = [
|
|
28123
28323
|
"/review-pr-comments",
|
|
@@ -28143,7 +28343,7 @@ async function reviewPrComments(number, options2 = {}) {
|
|
|
28143
28343
|
validateAnnounce(number, announce);
|
|
28144
28344
|
validateMode(options2);
|
|
28145
28345
|
if (number && !resumeSessionId) await checkoutPr(number);
|
|
28146
|
-
const claudeSessionId = resumeSessionId ??
|
|
28346
|
+
const claudeSessionId = resumeSessionId ?? randomUUID13();
|
|
28147
28347
|
emitActivity({
|
|
28148
28348
|
kind: "command",
|
|
28149
28349
|
name: "review-pr-comments",
|
|
@@ -28233,18 +28433,18 @@ function registerList(program) {
|
|
|
28233
28433
|
}
|
|
28234
28434
|
|
|
28235
28435
|
// src/commands/litellm/listModels.ts
|
|
28236
|
-
import
|
|
28436
|
+
import chalk174 from "chalk";
|
|
28237
28437
|
|
|
28238
28438
|
// src/commands/litellm/resolveLitellmConfig.ts
|
|
28239
|
-
import
|
|
28439
|
+
import chalk173 from "chalk";
|
|
28240
28440
|
function resolveLitellmConfig() {
|
|
28241
28441
|
const { config, missing } = readLitellmConfig();
|
|
28242
28442
|
if (!config) {
|
|
28243
|
-
console.error(
|
|
28443
|
+
console.error(chalk173.red("LiteLLM is not configured"));
|
|
28244
28444
|
for (const key of missing) {
|
|
28245
28445
|
const entry = litellmConfigHelp.find((help) => help.key === key);
|
|
28246
28446
|
console.error(
|
|
28247
|
-
|
|
28447
|
+
chalk173.red(` ${key} is not set. Set it with: ${entry?.setter}`)
|
|
28248
28448
|
);
|
|
28249
28449
|
}
|
|
28250
28450
|
process.exit(1);
|
|
@@ -28270,13 +28470,13 @@ async function listModels(options2) {
|
|
|
28270
28470
|
} catch (error) {
|
|
28271
28471
|
const reason4 = error instanceof Error ? error.message : String(error);
|
|
28272
28472
|
console.error(
|
|
28273
|
-
|
|
28473
|
+
chalk174.red(`Failed to reach LiteLLM at ${baseUrl}: ${reason4}`)
|
|
28274
28474
|
);
|
|
28275
28475
|
process.exit(1);
|
|
28276
28476
|
}
|
|
28277
28477
|
const body = await response.text();
|
|
28278
28478
|
if (!response.ok) {
|
|
28279
|
-
console.error(
|
|
28479
|
+
console.error(chalk174.red(`LiteLLM returned ${response.status}: ${body}`));
|
|
28280
28480
|
process.exit(1);
|
|
28281
28481
|
}
|
|
28282
28482
|
if (options2.json) {
|
|
@@ -28296,15 +28496,15 @@ function registerLitellm(program) {
|
|
|
28296
28496
|
// src/commands/mermaidExport.ts
|
|
28297
28497
|
import { mkdirSync as mkdirSync20, readdirSync as readdirSync12 } from "fs";
|
|
28298
28498
|
import { resolve as resolve20 } from "path";
|
|
28299
|
-
import
|
|
28499
|
+
import chalk177 from "chalk";
|
|
28300
28500
|
|
|
28301
28501
|
// src/commands/mermaid/exportFile.ts
|
|
28302
28502
|
import { readFileSync as readFileSync41, writeFileSync as writeFileSync33 } from "fs";
|
|
28303
28503
|
import { basename as basename20, extname as extname4, resolve as resolve19 } from "path";
|
|
28304
|
-
import
|
|
28504
|
+
import chalk176 from "chalk";
|
|
28305
28505
|
|
|
28306
28506
|
// src/commands/mermaid/renderBlock.ts
|
|
28307
|
-
import
|
|
28507
|
+
import chalk175 from "chalk";
|
|
28308
28508
|
async function renderBlock(krokiUrl, source) {
|
|
28309
28509
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
28310
28510
|
method: "POST",
|
|
@@ -28313,7 +28513,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
28313
28513
|
});
|
|
28314
28514
|
if (!response.ok) {
|
|
28315
28515
|
console.error(
|
|
28316
|
-
|
|
28516
|
+
chalk175.red(
|
|
28317
28517
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
28318
28518
|
)
|
|
28319
28519
|
);
|
|
@@ -28331,19 +28531,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
28331
28531
|
if (onlyIndex !== void 0) {
|
|
28332
28532
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
28333
28533
|
console.error(
|
|
28334
|
-
|
|
28534
|
+
chalk176.red(
|
|
28335
28535
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
28336
28536
|
)
|
|
28337
28537
|
);
|
|
28338
28538
|
process.exit(1);
|
|
28339
28539
|
}
|
|
28340
28540
|
console.log(
|
|
28341
|
-
|
|
28541
|
+
chalk176.gray(
|
|
28342
28542
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
28343
28543
|
)
|
|
28344
28544
|
);
|
|
28345
28545
|
} else {
|
|
28346
|
-
console.log(
|
|
28546
|
+
console.log(chalk176.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
28347
28547
|
}
|
|
28348
28548
|
for (const [i, source] of blocks.entries()) {
|
|
28349
28549
|
const idx = i + 1;
|
|
@@ -28351,7 +28551,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
28351
28551
|
const outPath = resolve19(outDir, `${stem}-${idx}.svg`);
|
|
28352
28552
|
const svg = await renderBlock(krokiUrl, source);
|
|
28353
28553
|
writeFileSync33(outPath, svg, "utf8");
|
|
28354
|
-
console.log(
|
|
28554
|
+
console.log(chalk176.green(` \u2192 ${outPath}`));
|
|
28355
28555
|
}
|
|
28356
28556
|
}
|
|
28357
28557
|
function extractMermaidBlocks(markdown) {
|
|
@@ -28367,18 +28567,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
28367
28567
|
if (options2.index !== void 0) {
|
|
28368
28568
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
28369
28569
|
console.error(
|
|
28370
|
-
|
|
28570
|
+
chalk177.red(`--index must be a positive integer (got ${options2.index})`)
|
|
28371
28571
|
);
|
|
28372
28572
|
process.exit(1);
|
|
28373
28573
|
}
|
|
28374
28574
|
if (!file) {
|
|
28375
|
-
console.error(
|
|
28575
|
+
console.error(chalk177.red("--index requires a file argument"));
|
|
28376
28576
|
process.exit(1);
|
|
28377
28577
|
}
|
|
28378
28578
|
}
|
|
28379
28579
|
const files = file ? [file] : readdirSync12(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
28380
28580
|
if (files.length === 0) {
|
|
28381
|
-
console.log(
|
|
28581
|
+
console.log(chalk177.gray("No markdown files found in current directory."));
|
|
28382
28582
|
return;
|
|
28383
28583
|
}
|
|
28384
28584
|
for (const f of files) {
|
|
@@ -28524,7 +28724,7 @@ function extractToSave(details, cwd = process.cwd()) {
|
|
|
28524
28724
|
}
|
|
28525
28725
|
|
|
28526
28726
|
// src/commands/miro/keptTexts.ts
|
|
28527
|
-
import
|
|
28727
|
+
import chalk178 from "chalk";
|
|
28528
28728
|
|
|
28529
28729
|
// src/commands/miro/applyIgnore.ts
|
|
28530
28730
|
function applyIgnore(texts, ignore3) {
|
|
@@ -28563,7 +28763,7 @@ function warnUnmatched(file, unmatched) {
|
|
|
28563
28763
|
if (unmatched.length === 0) return;
|
|
28564
28764
|
const entries = unmatched.map((entry) => ` - ${entry}`).join("\n");
|
|
28565
28765
|
console.error(
|
|
28566
|
-
|
|
28766
|
+
chalk178.yellow(
|
|
28567
28767
|
`${unmatched.length} ${unmatched.length === 1 ? "entry" : "entries"} in ${file} matched no box text:
|
|
28568
28768
|
${entries}`
|
|
28569
28769
|
)
|
|
@@ -28685,7 +28885,7 @@ async function offerSaveExtract(extract2, options2, paths = {}) {
|
|
|
28685
28885
|
}
|
|
28686
28886
|
|
|
28687
28887
|
// src/commands/miro/pickAnchors.ts
|
|
28688
|
-
import { randomUUID as
|
|
28888
|
+
import { randomUUID as randomUUID14 } from "crypto";
|
|
28689
28889
|
|
|
28690
28890
|
// src/commands/miro/isBox.ts
|
|
28691
28891
|
var boxTypes = /* @__PURE__ */ new Set(["shape", "sticky_note"]);
|
|
@@ -28706,7 +28906,7 @@ async function pickAnchors(sessionId, items2) {
|
|
|
28706
28906
|
"Miro anchor selection",
|
|
28707
28907
|
{
|
|
28708
28908
|
sessionId,
|
|
28709
|
-
requestId:
|
|
28909
|
+
requestId: randomUUID14(),
|
|
28710
28910
|
title: "Pick the top-left then the bottom-right box",
|
|
28711
28911
|
body: encodeMiroBoardPreview(items2),
|
|
28712
28912
|
prNumber: null,
|
|
@@ -28764,7 +28964,7 @@ function readMiroItems(file) {
|
|
|
28764
28964
|
}
|
|
28765
28965
|
|
|
28766
28966
|
// src/commands/miro/resolveExtractOptions.ts
|
|
28767
|
-
import
|
|
28967
|
+
import chalk179 from "chalk";
|
|
28768
28968
|
|
|
28769
28969
|
// src/commands/miro/extractLayers.ts
|
|
28770
28970
|
function extractsIn(layer) {
|
|
@@ -28842,7 +29042,7 @@ function resolveExtractOptions(name, options2, paths) {
|
|
|
28842
29042
|
paths.cwd,
|
|
28843
29043
|
paths.globalConfigPath
|
|
28844
29044
|
);
|
|
28845
|
-
console.error(
|
|
29045
|
+
console.error(chalk179.dim(`Extract "${name}" from ${resolved.from}`));
|
|
28846
29046
|
return resolved.options;
|
|
28847
29047
|
}
|
|
28848
29048
|
|
|
@@ -28944,7 +29144,7 @@ function registerMiro(program) {
|
|
|
28944
29144
|
import { mkdir as mkdir6 } from "fs/promises";
|
|
28945
29145
|
import { createServer as createServer2 } from "http";
|
|
28946
29146
|
import { dirname as dirname35 } from "path";
|
|
28947
|
-
import
|
|
29147
|
+
import chalk181 from "chalk";
|
|
28948
29148
|
|
|
28949
29149
|
// src/commands/netcap/corsHeaders.ts
|
|
28950
29150
|
var corsHeaders = {
|
|
@@ -29023,7 +29223,7 @@ function createNetcapHandler(options2) {
|
|
|
29023
29223
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
29024
29224
|
import { networkInterfaces } from "os";
|
|
29025
29225
|
import { join as join75 } from "path";
|
|
29026
|
-
import
|
|
29226
|
+
import chalk180 from "chalk";
|
|
29027
29227
|
|
|
29028
29228
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
29029
29229
|
import { dirname as dirname34, join as join74 } from "path";
|
|
@@ -29067,7 +29267,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
29067
29267
|
const host = lanIPv4();
|
|
29068
29268
|
if (!host) {
|
|
29069
29269
|
console.log(
|
|
29070
|
-
|
|
29270
|
+
chalk180.yellow("could not determine the WSL IP for the extension")
|
|
29071
29271
|
);
|
|
29072
29272
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
29073
29273
|
return source;
|
|
@@ -29078,7 +29278,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
29078
29278
|
return WSL_WINDOWS_PATH3;
|
|
29079
29279
|
} catch {
|
|
29080
29280
|
console.log(
|
|
29081
|
-
|
|
29281
|
+
chalk180.yellow(`could not copy extension to ${WSL_WINDOWS_PATH3}`)
|
|
29082
29282
|
);
|
|
29083
29283
|
return source;
|
|
29084
29284
|
}
|
|
@@ -29111,30 +29311,30 @@ async function netcap(options2) {
|
|
|
29111
29311
|
let count10 = 0;
|
|
29112
29312
|
const handler = createNetcapHandler({
|
|
29113
29313
|
outPath,
|
|
29114
|
-
onPing: () => console.log(
|
|
29314
|
+
onPing: () => console.log(chalk181.dim("ping from extension")),
|
|
29115
29315
|
onCapture: (entry) => {
|
|
29116
29316
|
count10 += 1;
|
|
29117
29317
|
console.log(
|
|
29118
|
-
|
|
29119
|
-
|
|
29318
|
+
chalk181.green(`captured #${count10}`),
|
|
29319
|
+
chalk181.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
29120
29320
|
);
|
|
29121
29321
|
}
|
|
29122
29322
|
});
|
|
29123
29323
|
const server = createServer2(handler);
|
|
29124
29324
|
server.listen(port, () => {
|
|
29125
29325
|
console.log(
|
|
29126
|
-
|
|
29326
|
+
chalk181.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
29127
29327
|
);
|
|
29128
|
-
console.log(
|
|
29328
|
+
console.log(chalk181.dim(`appending captures to ${outPath}`));
|
|
29129
29329
|
if (filter)
|
|
29130
|
-
console.log(
|
|
29131
|
-
console.log(
|
|
29132
|
-
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"));
|
|
29133
29333
|
});
|
|
29134
29334
|
process.on("SIGINT", () => {
|
|
29135
29335
|
server.close();
|
|
29136
29336
|
console.log(
|
|
29137
|
-
|
|
29337
|
+
chalk181.bold(
|
|
29138
29338
|
`
|
|
29139
29339
|
netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
29140
29340
|
)
|
|
@@ -29146,7 +29346,7 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
29146
29346
|
// src/commands/netcap/netcapExtract.ts
|
|
29147
29347
|
import { writeFileSync as writeFileSync35 } from "fs";
|
|
29148
29348
|
import { join as join78 } from "path";
|
|
29149
|
-
import
|
|
29349
|
+
import chalk182 from "chalk";
|
|
29150
29350
|
|
|
29151
29351
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
29152
29352
|
import { readFileSync as readFileSync44 } from "fs";
|
|
@@ -29594,8 +29794,8 @@ function netcapExtract(file) {
|
|
|
29594
29794
|
writeFileSync35(outFile, `${JSON.stringify(posts, null, 2)}
|
|
29595
29795
|
`);
|
|
29596
29796
|
console.log(
|
|
29597
|
-
|
|
29598
|
-
|
|
29797
|
+
chalk182.green(`extracted ${posts.length} posts`),
|
|
29798
|
+
chalk182.dim(`-> ${outFile}`)
|
|
29599
29799
|
);
|
|
29600
29800
|
}
|
|
29601
29801
|
|
|
@@ -29616,7 +29816,7 @@ function registerNetcap(program) {
|
|
|
29616
29816
|
}
|
|
29617
29817
|
|
|
29618
29818
|
// src/commands/news/add.ts
|
|
29619
|
-
import
|
|
29819
|
+
import chalk183 from "chalk";
|
|
29620
29820
|
import enquirer8 from "enquirer";
|
|
29621
29821
|
async function add2(url) {
|
|
29622
29822
|
if (!url) {
|
|
@@ -29637,25 +29837,25 @@ async function add2(url) {
|
|
|
29637
29837
|
}
|
|
29638
29838
|
const added = await addFeed(await getDb(), url);
|
|
29639
29839
|
if (!added) {
|
|
29640
|
-
console.log(
|
|
29840
|
+
console.log(chalk183.yellow("Feed already exists"));
|
|
29641
29841
|
return;
|
|
29642
29842
|
}
|
|
29643
|
-
console.log(
|
|
29843
|
+
console.log(chalk183.green(`Added feed: ${url}`));
|
|
29644
29844
|
}
|
|
29645
29845
|
|
|
29646
29846
|
// src/commands/news/list.ts
|
|
29647
|
-
import
|
|
29847
|
+
import chalk184 from "chalk";
|
|
29648
29848
|
async function list3() {
|
|
29649
29849
|
const urls = await listFeeds(await getDb());
|
|
29650
29850
|
if (urls.length === 0) {
|
|
29651
|
-
console.log(
|
|
29851
|
+
console.log(chalk184.dim("No feeds; add one with assist news add <url>"));
|
|
29652
29852
|
return;
|
|
29653
29853
|
}
|
|
29654
29854
|
for (const url of urls) console.log(url);
|
|
29655
29855
|
}
|
|
29656
29856
|
|
|
29657
29857
|
// src/commands/news/remove.ts
|
|
29658
|
-
import
|
|
29858
|
+
import chalk185 from "chalk";
|
|
29659
29859
|
|
|
29660
29860
|
// src/commands/backlog/removeFeed.ts
|
|
29661
29861
|
import { eq as eq43 } from "drizzle-orm";
|
|
@@ -29668,10 +29868,10 @@ async function removeFeed(db, url) {
|
|
|
29668
29868
|
async function remove(url) {
|
|
29669
29869
|
const removed = await removeFeed(await getDb(), url);
|
|
29670
29870
|
if (!removed) {
|
|
29671
|
-
console.log(
|
|
29871
|
+
console.log(chalk185.yellow(`No feed matches ${url}`));
|
|
29672
29872
|
return;
|
|
29673
29873
|
}
|
|
29674
|
-
console.log(
|
|
29874
|
+
console.log(chalk185.green(`Removed feed: ${url}`));
|
|
29675
29875
|
}
|
|
29676
29876
|
|
|
29677
29877
|
// src/commands/registerNews.ts
|
|
@@ -29724,7 +29924,7 @@ function registerPiHook(program) {
|
|
|
29724
29924
|
}
|
|
29725
29925
|
|
|
29726
29926
|
// src/commands/prompts/printPromptsTable.ts
|
|
29727
|
-
import
|
|
29927
|
+
import chalk186 from "chalk";
|
|
29728
29928
|
function truncate(str, max) {
|
|
29729
29929
|
if (str.length <= max) return str;
|
|
29730
29930
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -29742,14 +29942,14 @@ function printPromptsTable(rows) {
|
|
|
29742
29942
|
"Command".padEnd(commandWidth),
|
|
29743
29943
|
"Repos"
|
|
29744
29944
|
].join(" ");
|
|
29745
|
-
console.log(
|
|
29746
|
-
console.log(
|
|
29945
|
+
console.log(chalk186.dim(header));
|
|
29946
|
+
console.log(chalk186.dim("-".repeat(header.length)));
|
|
29747
29947
|
for (const row3 of rows) {
|
|
29748
29948
|
const count10 = String(row3.count).padStart(countWidth);
|
|
29749
29949
|
const tool = row3.tool.padEnd(toolWidth);
|
|
29750
29950
|
const command = truncate(row3.command, 60).padEnd(commandWidth);
|
|
29751
29951
|
console.log(
|
|
29752
|
-
`${
|
|
29952
|
+
`${chalk186.yellow(count10)} ${tool} ${command} ${chalk186.dim(row3.repos)}`
|
|
29753
29953
|
);
|
|
29754
29954
|
}
|
|
29755
29955
|
}
|
|
@@ -29787,13 +29987,13 @@ import { execSync as execSync39 } from "child_process";
|
|
|
29787
29987
|
import enquirer9 from "enquirer";
|
|
29788
29988
|
|
|
29789
29989
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
29790
|
-
import
|
|
29990
|
+
import chalk187 from "chalk";
|
|
29791
29991
|
var STATUS_MAP = {
|
|
29792
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
29793
|
-
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
|
|
29794
29994
|
};
|
|
29795
29995
|
function defaultStatus(pr) {
|
|
29796
|
-
return { label:
|
|
29996
|
+
return { label: chalk187.green("opened"), date: pr.createdAt };
|
|
29797
29997
|
}
|
|
29798
29998
|
function getStatus2(pr) {
|
|
29799
29999
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -29802,11 +30002,11 @@ function formatDate(dateStr) {
|
|
|
29802
30002
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
29803
30003
|
}
|
|
29804
30004
|
function formatPrHeader(pr, status2) {
|
|
29805
|
-
return `${
|
|
30005
|
+
return `${chalk187.cyan(`#${pr.number}`)} ${pr.title} ${chalk187.dim(`(${pr.author.login},`)} ${status2.label} ${chalk187.dim(`${formatDate(status2.date)})`)}`;
|
|
29806
30006
|
}
|
|
29807
30007
|
function logPrDetails(pr) {
|
|
29808
30008
|
console.log(
|
|
29809
|
-
|
|
30009
|
+
chalk187.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
29810
30010
|
);
|
|
29811
30011
|
console.log();
|
|
29812
30012
|
}
|
|
@@ -29934,13 +30134,13 @@ function postReviewComment(vars) {
|
|
|
29934
30134
|
}
|
|
29935
30135
|
|
|
29936
30136
|
// src/commands/prs/reviewProposedPrComment.ts
|
|
29937
|
-
import { randomUUID as
|
|
30137
|
+
import { randomUUID as randomUUID15 } from "crypto";
|
|
29938
30138
|
async function reviewProposedPrComment(title, body, prNumber) {
|
|
29939
30139
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
29940
30140
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
29941
30141
|
await awaitPreviewApproval("PR comment preview", {
|
|
29942
30142
|
sessionId,
|
|
29943
|
-
requestId:
|
|
30143
|
+
requestId: randomUUID15(),
|
|
29944
30144
|
title,
|
|
29945
30145
|
body,
|
|
29946
30146
|
prNumber,
|
|
@@ -30064,11 +30264,6 @@ function azureDevopsCacheRepo({ org, project, repo }) {
|
|
|
30064
30264
|
return { org, repo: `${project}/${repo}` };
|
|
30065
30265
|
}
|
|
30066
30266
|
|
|
30067
|
-
// src/commands/prs/azureDevops/azureDevopsRepoUrl.ts
|
|
30068
|
-
function azureDevopsRepoUrl({ org, project, repo }) {
|
|
30069
|
-
return `https://dev.azure.com/${encodeURIComponent(org)}/${encodeURIComponent(project)}/_git/${encodeURIComponent(repo)}`;
|
|
30070
|
-
}
|
|
30071
|
-
|
|
30072
30267
|
// src/commands/prs/azureDevops/azureDevopsThreadRequests.ts
|
|
30073
30268
|
function prRoute(pr) {
|
|
30074
30269
|
return {
|
|
@@ -30150,7 +30345,7 @@ function errorOutput(error) {
|
|
|
30150
30345
|
return error instanceof Error ? error.message : String(error);
|
|
30151
30346
|
}
|
|
30152
30347
|
function failAzureDevops(error) {
|
|
30153
|
-
console.error(`Error: ${azCliProblem() ?? errorOutput(error)}`);
|
|
30348
|
+
console.error(`Error: ${azCliProblem(error) ?? errorOutput(error)}`);
|
|
30154
30349
|
process.exit(1);
|
|
30155
30350
|
}
|
|
30156
30351
|
|
|
@@ -30380,13 +30575,13 @@ function agentFooter(unresolvedCount) {
|
|
|
30380
30575
|
}
|
|
30381
30576
|
|
|
30382
30577
|
// src/commands/prs/listComments/commentStyle.ts
|
|
30383
|
-
import
|
|
30578
|
+
import chalk188 from "chalk";
|
|
30384
30579
|
var plain = (text17) => text17;
|
|
30385
30580
|
function colouredState(state) {
|
|
30386
30581
|
const label2 = `[${state}]`;
|
|
30387
|
-
if (state === "APPROVED") return
|
|
30388
|
-
if (state === "CHANGES_REQUESTED") return
|
|
30389
|
-
return
|
|
30582
|
+
if (state === "APPROVED") return chalk188.green(label2);
|
|
30583
|
+
if (state === "CHANGES_REQUESTED") return chalk188.red(label2);
|
|
30584
|
+
return chalk188.yellow(label2);
|
|
30390
30585
|
}
|
|
30391
30586
|
function commentStyle() {
|
|
30392
30587
|
if (isClaudeCode()) {
|
|
@@ -30400,9 +30595,9 @@ function commentStyle() {
|
|
|
30400
30595
|
};
|
|
30401
30596
|
}
|
|
30402
30597
|
return {
|
|
30403
|
-
cyan:
|
|
30404
|
-
bold:
|
|
30405
|
-
dim:
|
|
30598
|
+
cyan: chalk188.cyan,
|
|
30599
|
+
bold: chalk188.bold,
|
|
30600
|
+
dim: chalk188.dim,
|
|
30406
30601
|
state: colouredState,
|
|
30407
30602
|
diffHunk: true,
|
|
30408
30603
|
agent: false
|
|
@@ -30980,7 +31175,7 @@ function parseScreenshotSpecs(specs) {
|
|
|
30980
31175
|
}
|
|
30981
31176
|
|
|
30982
31177
|
// src/commands/prs/previewAndApplyEdit.ts
|
|
30983
|
-
import { randomUUID as
|
|
31178
|
+
import { randomUUID as randomUUID16 } from "crypto";
|
|
30984
31179
|
|
|
30985
31180
|
// src/commands/prs/stageScreenshots.ts
|
|
30986
31181
|
import { readFile as readFile8 } from "fs/promises";
|
|
@@ -31002,7 +31197,7 @@ function stageScreenshots(screenshots = []) {
|
|
|
31002
31197
|
async function previewAndApplyEdit(args) {
|
|
31003
31198
|
const decision = await awaitPreviewApproval("PR preview", {
|
|
31004
31199
|
sessionId: args.sessionId,
|
|
31005
|
-
requestId:
|
|
31200
|
+
requestId: randomUUID16(),
|
|
31006
31201
|
title: args.title ?? args.currentTitle,
|
|
31007
31202
|
body: args.body,
|
|
31008
31203
|
prNumber: args.number,
|
|
@@ -31337,7 +31532,7 @@ async function placePr(prNumber, title, body, options2, attachments = []) {
|
|
|
31337
31532
|
}
|
|
31338
31533
|
|
|
31339
31534
|
// src/commands/prs/previewAndPlace.ts
|
|
31340
|
-
import { randomUUID as
|
|
31535
|
+
import { randomUUID as randomUUID17 } from "crypto";
|
|
31341
31536
|
|
|
31342
31537
|
// src/commands/review/announcePr.ts
|
|
31343
31538
|
function announcePr(prNumber) {
|
|
@@ -31413,7 +31608,7 @@ function enableAutoMerge() {
|
|
|
31413
31608
|
async function previewAndPlace(args) {
|
|
31414
31609
|
const decision = await awaitPreviewApproval("PR preview", {
|
|
31415
31610
|
sessionId: args.sessionId,
|
|
31416
|
-
requestId:
|
|
31611
|
+
requestId: randomUUID17(),
|
|
31417
31612
|
title: args.title,
|
|
31418
31613
|
body: args.body,
|
|
31419
31614
|
prNumber: args.prNumber,
|
|
@@ -31876,16 +32071,16 @@ function buildPrsStatusReport(repoArguments, now = Date.now()) {
|
|
|
31876
32071
|
}
|
|
31877
32072
|
|
|
31878
32073
|
// src/commands/prs/status/printPrsStatus.ts
|
|
31879
|
-
import
|
|
32074
|
+
import chalk190 from "chalk";
|
|
31880
32075
|
|
|
31881
32076
|
// src/commands/prs/status/printPrStatus.ts
|
|
31882
|
-
import
|
|
32077
|
+
import chalk189 from "chalk";
|
|
31883
32078
|
function flags(pr) {
|
|
31884
32079
|
const markers = [];
|
|
31885
32080
|
if (pr.isDraft) markers.push("draft");
|
|
31886
32081
|
if (pr.isDoNotMerge) markers.push("do not merge");
|
|
31887
32082
|
if (pr.isBot) markers.push("bot");
|
|
31888
|
-
return markers.length ? ` ${
|
|
32083
|
+
return markers.length ? ` ${chalk189.yellow(`[${markers.join(", ")}]`)}` : "";
|
|
31889
32084
|
}
|
|
31890
32085
|
function updated(pr) {
|
|
31891
32086
|
return pr.ageHours === null ? "updated unknown" : `updated ${pr.age} ago`;
|
|
@@ -31899,35 +32094,35 @@ function reviewLine(pr) {
|
|
|
31899
32094
|
function checkLines(pr) {
|
|
31900
32095
|
const lines2 = [];
|
|
31901
32096
|
if (pr.checks.failing.length) {
|
|
31902
|
-
lines2.push(
|
|
32097
|
+
lines2.push(chalk189.red(`failing: ${pr.checks.failing.join(", ")}`));
|
|
31903
32098
|
}
|
|
31904
32099
|
if (pr.checks.pending.length) {
|
|
31905
|
-
lines2.push(
|
|
32100
|
+
lines2.push(chalk189.yellow(`pending: ${pr.checks.pending.join(", ")}`));
|
|
31906
32101
|
}
|
|
31907
32102
|
return lines2;
|
|
31908
32103
|
}
|
|
31909
32104
|
function threadsLine(pr) {
|
|
31910
32105
|
if (pr.unresolvedThreads === null) {
|
|
31911
|
-
return
|
|
32106
|
+
return chalk189.dim("unresolved comments: unknown");
|
|
31912
32107
|
}
|
|
31913
32108
|
if (pr.unresolvedThreads === 0) return null;
|
|
31914
|
-
return
|
|
32109
|
+
return chalk189.yellow(`unresolved comments: ${pr.unresolvedThreads}`);
|
|
31915
32110
|
}
|
|
31916
32111
|
function mergeableLine(pr) {
|
|
31917
|
-
if (pr.mergeable === "CONFLICTING") return
|
|
32112
|
+
if (pr.mergeable === "CONFLICTING") return chalk189.red("conflicting");
|
|
31918
32113
|
if (pr.mergeable === "MERGEABLE") return null;
|
|
31919
|
-
return
|
|
32114
|
+
return chalk189.dim(`mergeable: ${pr.mergeable.toLowerCase()}`);
|
|
31920
32115
|
}
|
|
31921
32116
|
function printPrStatus(pr) {
|
|
31922
32117
|
console.log(
|
|
31923
|
-
` ${
|
|
32118
|
+
` ${chalk189.cyan(`#${pr.number}`)} ${pr.title} ${chalk189.dim(`(${pr.author}, ${updated(pr)})`)}${flags(pr)}`
|
|
31924
32119
|
);
|
|
31925
32120
|
const details = [
|
|
31926
32121
|
reviewLine(pr),
|
|
31927
32122
|
...checkLines(pr),
|
|
31928
32123
|
threadsLine(pr),
|
|
31929
32124
|
mergeableLine(pr),
|
|
31930
|
-
|
|
32125
|
+
chalk189.dim(pr.url)
|
|
31931
32126
|
];
|
|
31932
32127
|
for (const detail of details) {
|
|
31933
32128
|
if (detail) console.log(` ${detail}`);
|
|
@@ -31938,17 +32133,17 @@ function printPrStatus(pr) {
|
|
|
31938
32133
|
function printPrsStatus(report) {
|
|
31939
32134
|
for (const repo of report.repos) {
|
|
31940
32135
|
const count10 = repo.pullRequests.length;
|
|
31941
|
-
console.log(`${
|
|
32136
|
+
console.log(`${chalk190.bold(repo.repo)} ${chalk190.dim(`(${count10} open)`)}`);
|
|
31942
32137
|
for (const pr of repo.pullRequests) {
|
|
31943
32138
|
printPrStatus(pr);
|
|
31944
32139
|
}
|
|
31945
|
-
if (count10 === 0) console.log(
|
|
32140
|
+
if (count10 === 0) console.log(chalk190.dim(" no open pull requests"));
|
|
31946
32141
|
console.log();
|
|
31947
32142
|
}
|
|
31948
32143
|
if (report.errors.length === 0) return;
|
|
31949
|
-
console.log(
|
|
32144
|
+
console.log(chalk190.bold("Errors"));
|
|
31950
32145
|
for (const failure of report.errors) {
|
|
31951
|
-
console.log(` ${
|
|
32146
|
+
console.log(` ${chalk190.red(failure.repo)}: ${failure.error}`);
|
|
31952
32147
|
}
|
|
31953
32148
|
console.log();
|
|
31954
32149
|
}
|
|
@@ -32176,10 +32371,10 @@ function registerPrs(program) {
|
|
|
32176
32371
|
}
|
|
32177
32372
|
|
|
32178
32373
|
// src/commands/ravendb/ravendbAuth.ts
|
|
32179
|
-
import
|
|
32374
|
+
import chalk196 from "chalk";
|
|
32180
32375
|
|
|
32181
32376
|
// src/shared/createConnectionAuth.ts
|
|
32182
|
-
import
|
|
32377
|
+
import chalk191 from "chalk";
|
|
32183
32378
|
function listConnections(connections, format3) {
|
|
32184
32379
|
if (connections.length === 0) {
|
|
32185
32380
|
console.log("No connections configured.");
|
|
@@ -32192,7 +32387,7 @@ function listConnections(connections, format3) {
|
|
|
32192
32387
|
function removeConnection(connections, name, save) {
|
|
32193
32388
|
const filtered = connections.filter((c) => c.name !== name);
|
|
32194
32389
|
if (filtered.length === connections.length) {
|
|
32195
|
-
console.error(
|
|
32390
|
+
console.error(chalk191.red(`Connection "${name}" not found.`));
|
|
32196
32391
|
process.exit(1);
|
|
32197
32392
|
}
|
|
32198
32393
|
save(filtered);
|
|
@@ -32238,15 +32433,15 @@ function saveConnections(connections) {
|
|
|
32238
32433
|
}
|
|
32239
32434
|
|
|
32240
32435
|
// src/commands/ravendb/promptConnection.ts
|
|
32241
|
-
import
|
|
32436
|
+
import chalk194 from "chalk";
|
|
32242
32437
|
|
|
32243
32438
|
// src/commands/ravendb/selectOpSecret.ts
|
|
32244
|
-
import
|
|
32439
|
+
import chalk193 from "chalk";
|
|
32245
32440
|
import Enquirer2 from "enquirer";
|
|
32246
32441
|
|
|
32247
32442
|
// src/commands/ravendb/searchItems.ts
|
|
32248
32443
|
import { execSync as execSync46 } from "child_process";
|
|
32249
|
-
import
|
|
32444
|
+
import chalk192 from "chalk";
|
|
32250
32445
|
function opExec(args) {
|
|
32251
32446
|
return execSync46(`op ${args}`, {
|
|
32252
32447
|
encoding: "utf8",
|
|
@@ -32259,7 +32454,7 @@ function searchItems(search2) {
|
|
|
32259
32454
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
32260
32455
|
} catch {
|
|
32261
32456
|
console.error(
|
|
32262
|
-
|
|
32457
|
+
chalk192.red(
|
|
32263
32458
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
32264
32459
|
)
|
|
32265
32460
|
);
|
|
@@ -32273,7 +32468,7 @@ function getItemFields(itemId2) {
|
|
|
32273
32468
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
32274
32469
|
return item.fields.filter((f) => f.reference && f.label);
|
|
32275
32470
|
} catch {
|
|
32276
|
-
console.error(
|
|
32471
|
+
console.error(chalk192.red("Failed to get item details from 1Password."));
|
|
32277
32472
|
process.exit(1);
|
|
32278
32473
|
}
|
|
32279
32474
|
}
|
|
@@ -32292,7 +32487,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
32292
32487
|
}).run();
|
|
32293
32488
|
const items2 = searchItems(search2);
|
|
32294
32489
|
if (items2.length === 0) {
|
|
32295
|
-
console.error(
|
|
32490
|
+
console.error(chalk193.red(`No items found matching "${search2}".`));
|
|
32296
32491
|
process.exit(1);
|
|
32297
32492
|
}
|
|
32298
32493
|
const itemId2 = await selectOne(
|
|
@@ -32301,7 +32496,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
32301
32496
|
);
|
|
32302
32497
|
const fields = getItemFields(itemId2);
|
|
32303
32498
|
if (fields.length === 0) {
|
|
32304
|
-
console.error(
|
|
32499
|
+
console.error(chalk193.red("No fields with references found on this item."));
|
|
32305
32500
|
process.exit(1);
|
|
32306
32501
|
}
|
|
32307
32502
|
const ref = await selectOne(
|
|
@@ -32315,7 +32510,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
32315
32510
|
async function promptConnection(existingNames) {
|
|
32316
32511
|
const name = await promptInput("name", "Connection name:");
|
|
32317
32512
|
if (existingNames.includes(name)) {
|
|
32318
|
-
console.error(
|
|
32513
|
+
console.error(chalk194.red(`Connection "${name}" already exists.`));
|
|
32319
32514
|
process.exit(1);
|
|
32320
32515
|
}
|
|
32321
32516
|
const url = await promptInput(
|
|
@@ -32324,22 +32519,22 @@ async function promptConnection(existingNames) {
|
|
|
32324
32519
|
);
|
|
32325
32520
|
const database = await promptInput("database", "Database name:");
|
|
32326
32521
|
if (!name || !url || !database) {
|
|
32327
|
-
console.error(
|
|
32522
|
+
console.error(chalk194.red("All fields are required."));
|
|
32328
32523
|
process.exit(1);
|
|
32329
32524
|
}
|
|
32330
32525
|
const apiKeyRef = await selectOpSecret();
|
|
32331
|
-
console.log(
|
|
32526
|
+
console.log(chalk194.dim(`Using: ${apiKeyRef}`));
|
|
32332
32527
|
return { name, url, database, apiKeyRef };
|
|
32333
32528
|
}
|
|
32334
32529
|
|
|
32335
32530
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
32336
|
-
import
|
|
32531
|
+
import chalk195 from "chalk";
|
|
32337
32532
|
function ravendbSetConnection(name) {
|
|
32338
32533
|
const raw = loadGlobalConfigRaw();
|
|
32339
32534
|
const ravendb = raw.ravendb ?? {};
|
|
32340
32535
|
const connections = ravendb.connections ?? [];
|
|
32341
32536
|
if (!connections.some((c) => c.name === name)) {
|
|
32342
|
-
console.error(
|
|
32537
|
+
console.error(chalk195.red(`Connection "${name}" not found.`));
|
|
32343
32538
|
console.error(
|
|
32344
32539
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
32345
32540
|
);
|
|
@@ -32355,16 +32550,16 @@ function ravendbSetConnection(name) {
|
|
|
32355
32550
|
var ravendbAuth = createConnectionAuth({
|
|
32356
32551
|
load: loadConnections,
|
|
32357
32552
|
save: saveConnections,
|
|
32358
|
-
format: (c) => `${
|
|
32553
|
+
format: (c) => `${chalk196.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
32359
32554
|
promptNew: promptConnection,
|
|
32360
32555
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
32361
32556
|
});
|
|
32362
32557
|
|
|
32363
32558
|
// src/commands/ravendb/ravendbCollections.ts
|
|
32364
|
-
import
|
|
32559
|
+
import chalk200 from "chalk";
|
|
32365
32560
|
|
|
32366
32561
|
// src/commands/ravendb/ravenFetch.ts
|
|
32367
|
-
import
|
|
32562
|
+
import chalk198 from "chalk";
|
|
32368
32563
|
|
|
32369
32564
|
// src/commands/ravendb/getAccessToken.ts
|
|
32370
32565
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -32401,10 +32596,10 @@ ${errorText}`
|
|
|
32401
32596
|
|
|
32402
32597
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
32403
32598
|
import { execSync as execSync47 } from "child_process";
|
|
32404
|
-
import
|
|
32599
|
+
import chalk197 from "chalk";
|
|
32405
32600
|
function resolveOpSecret(reference) {
|
|
32406
32601
|
if (!reference.startsWith("op://")) {
|
|
32407
|
-
console.error(
|
|
32602
|
+
console.error(chalk197.red(`Invalid secret reference: must start with op://`));
|
|
32408
32603
|
process.exit(1);
|
|
32409
32604
|
}
|
|
32410
32605
|
try {
|
|
@@ -32414,7 +32609,7 @@ function resolveOpSecret(reference) {
|
|
|
32414
32609
|
}).trim();
|
|
32415
32610
|
} catch {
|
|
32416
32611
|
console.error(
|
|
32417
|
-
|
|
32612
|
+
chalk197.red(
|
|
32418
32613
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
32419
32614
|
)
|
|
32420
32615
|
);
|
|
@@ -32441,7 +32636,7 @@ async function ravenFetch(connection, path108) {
|
|
|
32441
32636
|
if (!response.ok) {
|
|
32442
32637
|
const body = await response.text();
|
|
32443
32638
|
console.error(
|
|
32444
|
-
|
|
32639
|
+
chalk198.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
32445
32640
|
);
|
|
32446
32641
|
console.error(body.substring(0, 500));
|
|
32447
32642
|
process.exit(1);
|
|
@@ -32450,7 +32645,7 @@ async function ravenFetch(connection, path108) {
|
|
|
32450
32645
|
}
|
|
32451
32646
|
|
|
32452
32647
|
// src/commands/ravendb/resolveConnection.ts
|
|
32453
|
-
import
|
|
32648
|
+
import chalk199 from "chalk";
|
|
32454
32649
|
function loadRavendb() {
|
|
32455
32650
|
const raw = loadGlobalConfigRaw();
|
|
32456
32651
|
const ravendb = raw.ravendb;
|
|
@@ -32464,7 +32659,7 @@ function resolveConnection(name) {
|
|
|
32464
32659
|
const connectionName = name ?? defaultConnection;
|
|
32465
32660
|
if (!connectionName) {
|
|
32466
32661
|
console.error(
|
|
32467
|
-
|
|
32662
|
+
chalk199.red(
|
|
32468
32663
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
32469
32664
|
)
|
|
32470
32665
|
);
|
|
@@ -32472,7 +32667,7 @@ function resolveConnection(name) {
|
|
|
32472
32667
|
}
|
|
32473
32668
|
const connection = connections.find((c) => c.name === connectionName);
|
|
32474
32669
|
if (!connection) {
|
|
32475
|
-
console.error(
|
|
32670
|
+
console.error(chalk199.red(`Connection "${connectionName}" not found.`));
|
|
32476
32671
|
console.error(
|
|
32477
32672
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
32478
32673
|
);
|
|
@@ -32503,15 +32698,15 @@ async function ravendbCollections(connectionName) {
|
|
|
32503
32698
|
return;
|
|
32504
32699
|
}
|
|
32505
32700
|
for (const c of collections) {
|
|
32506
|
-
console.log(`${
|
|
32701
|
+
console.log(`${chalk200.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
32507
32702
|
}
|
|
32508
32703
|
}
|
|
32509
32704
|
|
|
32510
32705
|
// src/commands/ravendb/ravendbQuery.ts
|
|
32511
|
-
import
|
|
32706
|
+
import chalk202 from "chalk";
|
|
32512
32707
|
|
|
32513
32708
|
// src/commands/ravendb/fetchAllPages.ts
|
|
32514
|
-
import
|
|
32709
|
+
import chalk201 from "chalk";
|
|
32515
32710
|
|
|
32516
32711
|
// src/commands/ravendb/buildQueryPath.ts
|
|
32517
32712
|
function buildQueryPath(opts) {
|
|
@@ -32549,7 +32744,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
32549
32744
|
allResults.push(...results);
|
|
32550
32745
|
start2 += results.length;
|
|
32551
32746
|
process.stderr.write(
|
|
32552
|
-
`\r${
|
|
32747
|
+
`\r${chalk201.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
32553
32748
|
);
|
|
32554
32749
|
if (start2 >= totalResults) break;
|
|
32555
32750
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -32564,7 +32759,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
32564
32759
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
32565
32760
|
const resolved = resolveArgs(connectionName, collection);
|
|
32566
32761
|
if (!resolved.collection && !options2.query) {
|
|
32567
|
-
console.error(
|
|
32762
|
+
console.error(chalk202.red("Provide a collection name or --query filter."));
|
|
32568
32763
|
process.exit(1);
|
|
32569
32764
|
}
|
|
32570
32765
|
const { collection: col } = resolved;
|
|
@@ -32599,7 +32794,7 @@ function registerRavendb(program) {
|
|
|
32599
32794
|
}
|
|
32600
32795
|
|
|
32601
32796
|
// src/commands/releases/releasesConfigure.ts
|
|
32602
|
-
import
|
|
32797
|
+
import chalk204 from "chalk";
|
|
32603
32798
|
|
|
32604
32799
|
// src/commands/releases/checkStreamGraph.ts
|
|
32605
32800
|
function nodeIds(stream) {
|
|
@@ -32661,26 +32856,26 @@ function readStreamsInput(source) {
|
|
|
32661
32856
|
}
|
|
32662
32857
|
|
|
32663
32858
|
// src/commands/releases/reportDerivedStreams.ts
|
|
32664
|
-
import
|
|
32859
|
+
import chalk203 from "chalk";
|
|
32665
32860
|
function printDerived(stream) {
|
|
32666
32861
|
const environments = stream.nodes.flatMap((n) => n.environment ?? []);
|
|
32667
32862
|
const steps = stream.nodes.filter((n) => !n.environment);
|
|
32668
32863
|
console.log(
|
|
32669
|
-
`${
|
|
32864
|
+
`${chalk203.bold(stream.name)} ${chalk203.dim(`${stream.repo} \xB7 ${stream.workflow}`)}`
|
|
32670
32865
|
);
|
|
32671
32866
|
console.log(
|
|
32672
|
-
` environments: ${environments.join(", ") ||
|
|
32867
|
+
` environments: ${environments.join(", ") || chalk203.dim("none")}`
|
|
32673
32868
|
);
|
|
32674
32869
|
if (steps.length > 0)
|
|
32675
32870
|
console.log(
|
|
32676
32871
|
` steps: ${steps.map((n) => `${n.id} [${n.kind ?? "step"}]`).join(", ")}`
|
|
32677
32872
|
);
|
|
32678
32873
|
const edges = stream.edges.map(([from, to]) => `${from} \u2192 ${to}`);
|
|
32679
|
-
console.log(` edges: ${edges.join(", ") ||
|
|
32874
|
+
console.log(` edges: ${edges.join(", ") || chalk203.dim("none")}`);
|
|
32680
32875
|
}
|
|
32681
32876
|
function reportDerivedStreams(streams, target) {
|
|
32682
32877
|
for (const stream of streams) printDerived(stream);
|
|
32683
|
-
console.log(
|
|
32878
|
+
console.log(chalk203.dim(`Written to ${target}`));
|
|
32684
32879
|
}
|
|
32685
32880
|
|
|
32686
32881
|
// src/commands/releases/withCurrentRepo.ts
|
|
@@ -32768,8 +32963,8 @@ async function writeReleaseStreams(incoming, scope) {
|
|
|
32768
32963
|
|
|
32769
32964
|
// src/commands/releases/releasesConfigure.ts
|
|
32770
32965
|
function fail6(message3, details = []) {
|
|
32771
|
-
console.error(
|
|
32772
|
-
for (const detail of details) console.error(
|
|
32966
|
+
console.error(chalk204.red(message3));
|
|
32967
|
+
for (const detail of details) console.error(chalk204.red(` ${detail}`));
|
|
32773
32968
|
process.exitCode = 1;
|
|
32774
32969
|
}
|
|
32775
32970
|
function reportWritten(incoming, target) {
|
|
@@ -32801,23 +32996,23 @@ async function releasesConfigure(options2 = {}) {
|
|
|
32801
32996
|
}
|
|
32802
32997
|
|
|
32803
32998
|
// src/commands/releases/releasesList.ts
|
|
32804
|
-
import
|
|
32999
|
+
import chalk205 from "chalk";
|
|
32805
33000
|
function describeNode(node) {
|
|
32806
33001
|
if (node.environment) return `${node.id} \u2192 ${node.environment}`;
|
|
32807
33002
|
return `${node.id} (${node.kind ?? "step"})`;
|
|
32808
33003
|
}
|
|
32809
33004
|
function printStream(stream) {
|
|
32810
|
-
console.log(`${
|
|
32811
|
-
console.log(
|
|
33005
|
+
console.log(`${chalk205.bold(stream.name)} ${chalk205.dim(stream.repo)}`);
|
|
33006
|
+
console.log(chalk205.dim(` workflow: ${stream.workflow}`));
|
|
32812
33007
|
for (const node of stream.nodes) console.log(` ${describeNode(node)}`);
|
|
32813
33008
|
for (const [from, to] of stream.edges)
|
|
32814
|
-
console.log(
|
|
33009
|
+
console.log(chalk205.dim(` ${from} \u2192 ${to}`));
|
|
32815
33010
|
}
|
|
32816
33011
|
function releasesList() {
|
|
32817
33012
|
const streams = loadConfig().releases?.streams ?? [];
|
|
32818
33013
|
if (streams.length === 0) {
|
|
32819
33014
|
console.log(
|
|
32820
|
-
|
|
33015
|
+
chalk205.dim("No release streams configured under releases.streams.")
|
|
32821
33016
|
);
|
|
32822
33017
|
return;
|
|
32823
33018
|
}
|
|
@@ -32865,7 +33060,7 @@ function coverage() {
|
|
|
32865
33060
|
|
|
32866
33061
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
32867
33062
|
import path45 from "path";
|
|
32868
|
-
import
|
|
33063
|
+
import chalk207 from "chalk";
|
|
32869
33064
|
|
|
32870
33065
|
// src/commands/lint/lint/checkFileNames.ts
|
|
32871
33066
|
import fs23 from "fs";
|
|
@@ -32945,7 +33140,7 @@ function checkFileNames() {
|
|
|
32945
33140
|
}
|
|
32946
33141
|
|
|
32947
33142
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
32948
|
-
import
|
|
33143
|
+
import chalk206 from "chalk";
|
|
32949
33144
|
|
|
32950
33145
|
// src/commands/lint/lint/applyMoves.ts
|
|
32951
33146
|
import fs24 from "fs";
|
|
@@ -33030,25 +33225,25 @@ function fixFileNameViolations(moves) {
|
|
|
33030
33225
|
const start2 = performance.now();
|
|
33031
33226
|
const project = createLintProject();
|
|
33032
33227
|
const cwd = process.cwd();
|
|
33033
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
33228
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk206.green(line)));
|
|
33034
33229
|
const ms = (performance.now() - start2).toFixed(0);
|
|
33035
|
-
console.log(
|
|
33230
|
+
console.log(chalk206.dim(` Done in ${ms}ms`));
|
|
33036
33231
|
}
|
|
33037
33232
|
|
|
33038
33233
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
33039
33234
|
function reportViolations(violations) {
|
|
33040
|
-
console.error(
|
|
33235
|
+
console.error(chalk207.red("\nFile name check failed:\n"));
|
|
33041
33236
|
console.error(
|
|
33042
|
-
|
|
33237
|
+
chalk207.red(
|
|
33043
33238
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
33044
33239
|
)
|
|
33045
33240
|
);
|
|
33046
33241
|
for (const violation of violations) {
|
|
33047
|
-
console.error(
|
|
33048
|
-
console.error(
|
|
33242
|
+
console.error(chalk207.red(` ${violation.filePath}`));
|
|
33243
|
+
console.error(chalk207.gray(` Rename to: ${violation.suggestedName}
|
|
33049
33244
|
`));
|
|
33050
33245
|
}
|
|
33051
|
-
console.error(
|
|
33246
|
+
console.error(chalk207.dim(" Run with -f to auto-fix.\n"));
|
|
33052
33247
|
}
|
|
33053
33248
|
function runFileNameCheck(fix = false) {
|
|
33054
33249
|
const violations = checkFileNames();
|
|
@@ -33077,17 +33272,17 @@ function runFileNameCheck(fix = false) {
|
|
|
33077
33272
|
import fs26 from "fs";
|
|
33078
33273
|
|
|
33079
33274
|
// src/commands/lint/shared.ts
|
|
33080
|
-
import
|
|
33275
|
+
import chalk208 from "chalk";
|
|
33081
33276
|
function reportViolations2(violations, checkName2, errorMessage3, successMessage) {
|
|
33082
33277
|
if (violations.length > 0) {
|
|
33083
|
-
console.error(
|
|
33278
|
+
console.error(chalk208.red(`
|
|
33084
33279
|
${checkName2} failed:
|
|
33085
33280
|
`));
|
|
33086
|
-
console.error(
|
|
33281
|
+
console.error(chalk208.red(` ${errorMessage3}
|
|
33087
33282
|
`));
|
|
33088
33283
|
for (const violation of violations) {
|
|
33089
|
-
console.error(
|
|
33090
|
-
console.error(
|
|
33284
|
+
console.error(chalk208.red(` ${violation.filePath}:${violation.line}`));
|
|
33285
|
+
console.error(chalk208.gray(` ${violation.content}
|
|
33091
33286
|
`));
|
|
33092
33287
|
}
|
|
33093
33288
|
return false;
|
|
@@ -33218,7 +33413,7 @@ import { execSync as execSync49 } from "child_process";
|
|
|
33218
33413
|
import { existsSync as existsSync65, mkdirSync as mkdirSync23, unlinkSync as unlinkSync15, writeFileSync as writeFileSync38 } from "fs";
|
|
33219
33414
|
import { tmpdir as tmpdir7 } from "os";
|
|
33220
33415
|
import { join as join82, resolve as resolve24 } from "path";
|
|
33221
|
-
import
|
|
33416
|
+
import chalk209 from "chalk";
|
|
33222
33417
|
|
|
33223
33418
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
33224
33419
|
var captureWindowPs1 = `
|
|
@@ -33369,19 +33564,19 @@ function screenshot(processName) {
|
|
|
33369
33564
|
const config = loadConfig();
|
|
33370
33565
|
const outputDir = resolve24(config.screenshot.outputDir);
|
|
33371
33566
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
33372
|
-
console.log(
|
|
33567
|
+
console.log(chalk209.gray(`Capturing window for process "${processName}" ...`));
|
|
33373
33568
|
try {
|
|
33374
33569
|
runPowerShellScript(processName, outputPath);
|
|
33375
|
-
console.log(
|
|
33570
|
+
console.log(chalk209.green(`Screenshot saved: ${outputPath}`));
|
|
33376
33571
|
} catch (error) {
|
|
33377
33572
|
const msg = error instanceof Error ? error.message : String(error);
|
|
33378
|
-
console.error(
|
|
33573
|
+
console.error(chalk209.red(`Failed to capture screenshot: ${msg}`));
|
|
33379
33574
|
process.exit(1);
|
|
33380
33575
|
}
|
|
33381
33576
|
}
|
|
33382
33577
|
|
|
33383
33578
|
// src/commands/statusLine.ts
|
|
33384
|
-
import
|
|
33579
|
+
import chalk211 from "chalk";
|
|
33385
33580
|
|
|
33386
33581
|
// src/shared/contextLevel.ts
|
|
33387
33582
|
var THRESHOLDS = {
|
|
@@ -33397,7 +33592,7 @@ function contextLevel(pct, harness) {
|
|
|
33397
33592
|
}
|
|
33398
33593
|
|
|
33399
33594
|
// src/commands/buildLimitsSegment.ts
|
|
33400
|
-
import
|
|
33595
|
+
import chalk210 from "chalk";
|
|
33401
33596
|
|
|
33402
33597
|
// src/shared/rateLimitLevel.ts
|
|
33403
33598
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -33435,9 +33630,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
33435
33630
|
|
|
33436
33631
|
// src/commands/buildLimitsSegment.ts
|
|
33437
33632
|
var LEVEL_COLOR = {
|
|
33438
|
-
ok:
|
|
33439
|
-
warn:
|
|
33440
|
-
over:
|
|
33633
|
+
ok: chalk210.green,
|
|
33634
|
+
warn: chalk210.yellow,
|
|
33635
|
+
over: chalk210.red
|
|
33441
33636
|
};
|
|
33442
33637
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
33443
33638
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -33533,7 +33728,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
33533
33728
|
}
|
|
33534
33729
|
|
|
33535
33730
|
// src/commands/statusLine.ts
|
|
33536
|
-
|
|
33731
|
+
chalk211.level = 3;
|
|
33537
33732
|
function formatNumber(num) {
|
|
33538
33733
|
return num.toLocaleString("en-US");
|
|
33539
33734
|
}
|
|
@@ -33541,9 +33736,9 @@ function colorizePercent(pct) {
|
|
|
33541
33736
|
const label2 = `${Math.round(pct)}%`;
|
|
33542
33737
|
switch (contextLevel(pct)) {
|
|
33543
33738
|
case "red":
|
|
33544
|
-
return
|
|
33739
|
+
return chalk211.red(label2);
|
|
33545
33740
|
case "yellow":
|
|
33546
|
-
return
|
|
33741
|
+
return chalk211.yellow(label2);
|
|
33547
33742
|
default:
|
|
33548
33743
|
return label2;
|
|
33549
33744
|
}
|
|
@@ -33556,7 +33751,7 @@ async function statusLine() {
|
|
|
33556
33751
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
33557
33752
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
33558
33753
|
const branch2 = dir ? readGitBranch(dir) : null;
|
|
33559
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
33754
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk211.cyan(branch2)} | ` : "";
|
|
33560
33755
|
console.log(
|
|
33561
33756
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
33562
33757
|
);
|
|
@@ -33663,7 +33858,7 @@ import { spawn as spawn7 } from "child_process";
|
|
|
33663
33858
|
import * as path47 from "path";
|
|
33664
33859
|
|
|
33665
33860
|
// src/commands/refactor/logViolations.ts
|
|
33666
|
-
import
|
|
33861
|
+
import chalk212 from "chalk";
|
|
33667
33862
|
var DEFAULT_MAX_LINES2 = 100;
|
|
33668
33863
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
33669
33864
|
if (violations.length === 0) {
|
|
@@ -33672,43 +33867,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
33672
33867
|
}
|
|
33673
33868
|
return;
|
|
33674
33869
|
}
|
|
33675
|
-
console.error(
|
|
33870
|
+
console.error(chalk212.red(`
|
|
33676
33871
|
Refactor check failed:
|
|
33677
33872
|
`));
|
|
33678
|
-
console.error(
|
|
33873
|
+
console.error(chalk212.red(` The following files exceed ${maxLines} lines:
|
|
33679
33874
|
`));
|
|
33680
33875
|
for (const violation of violations) {
|
|
33681
|
-
console.error(
|
|
33876
|
+
console.error(chalk212.red(` ${violation.file} (${violation.lines} lines)`));
|
|
33682
33877
|
}
|
|
33683
33878
|
console.error(
|
|
33684
|
-
|
|
33879
|
+
chalk212.yellow(
|
|
33685
33880
|
`
|
|
33686
33881
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
33687
33882
|
way to refactor it, ignore it with:
|
|
33688
33883
|
`
|
|
33689
33884
|
)
|
|
33690
33885
|
);
|
|
33691
|
-
console.error(
|
|
33886
|
+
console.error(chalk212.gray(` assist refactor ignore <file>
|
|
33692
33887
|
`));
|
|
33693
33888
|
if (process.env.CLAUDECODE) {
|
|
33694
|
-
console.error(
|
|
33889
|
+
console.error(chalk212.cyan(`
|
|
33695
33890
|
## Extracting Code to New Files
|
|
33696
33891
|
`));
|
|
33697
33892
|
console.error(
|
|
33698
|
-
|
|
33893
|
+
chalk212.cyan(
|
|
33699
33894
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
33700
33895
|
`
|
|
33701
33896
|
)
|
|
33702
33897
|
);
|
|
33703
33898
|
console.error(
|
|
33704
|
-
|
|
33899
|
+
chalk212.cyan(
|
|
33705
33900
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
33706
33901
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
33707
33902
|
`
|
|
33708
33903
|
)
|
|
33709
33904
|
);
|
|
33710
33905
|
console.error(
|
|
33711
|
-
|
|
33906
|
+
chalk212.cyan(
|
|
33712
33907
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
33713
33908
|
domains, move it to a common/shared folder.
|
|
33714
33909
|
`
|
|
@@ -33864,7 +34059,7 @@ async function check(pattern2, options2) {
|
|
|
33864
34059
|
|
|
33865
34060
|
// src/commands/refactor/extract.ts
|
|
33866
34061
|
import path55 from "path";
|
|
33867
|
-
import
|
|
34062
|
+
import chalk215 from "chalk";
|
|
33868
34063
|
|
|
33869
34064
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
33870
34065
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -34472,23 +34667,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
34472
34667
|
|
|
34473
34668
|
// src/commands/refactor/extract/displayPlan.ts
|
|
34474
34669
|
import path51 from "path";
|
|
34475
|
-
import
|
|
34670
|
+
import chalk213 from "chalk";
|
|
34476
34671
|
function section(title) {
|
|
34477
34672
|
return `
|
|
34478
|
-
${
|
|
34673
|
+
${chalk213.cyan(title)}`;
|
|
34479
34674
|
}
|
|
34480
34675
|
function displayImporters(plan2, cwd) {
|
|
34481
34676
|
if (plan2.importersToUpdate.length === 0) return;
|
|
34482
34677
|
console.log(section("Update importers:"));
|
|
34483
34678
|
for (const imp of plan2.importersToUpdate) {
|
|
34484
34679
|
const rel = path51.relative(cwd, imp.file.getFilePath());
|
|
34485
|
-
console.log(` ${
|
|
34680
|
+
console.log(` ${chalk213.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
34486
34681
|
}
|
|
34487
34682
|
}
|
|
34488
34683
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
34489
|
-
console.log(
|
|
34684
|
+
console.log(chalk213.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
34490
34685
|
`));
|
|
34491
|
-
console.log(` ${
|
|
34686
|
+
console.log(` ${chalk213.cyan("Functions to move:")}`);
|
|
34492
34687
|
for (const name of plan2.extractedNames) {
|
|
34493
34688
|
console.log(` ${name}`);
|
|
34494
34689
|
}
|
|
@@ -34522,7 +34717,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
34522
34717
|
|
|
34523
34718
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
34524
34719
|
import path54 from "path";
|
|
34525
|
-
import
|
|
34720
|
+
import chalk214 from "chalk";
|
|
34526
34721
|
import { Project as Project3 } from "ts-morph";
|
|
34527
34722
|
|
|
34528
34723
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -34614,7 +34809,7 @@ function loadProjectFile(file) {
|
|
|
34614
34809
|
});
|
|
34615
34810
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
34616
34811
|
if (!sourceFile) {
|
|
34617
|
-
console.log(
|
|
34812
|
+
console.log(chalk214.red(`File not found in project: ${file}`));
|
|
34618
34813
|
process.exit(1);
|
|
34619
34814
|
}
|
|
34620
34815
|
return { project, sourceFile };
|
|
@@ -34637,19 +34832,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
34637
34832
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
34638
34833
|
if (options2.apply) {
|
|
34639
34834
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
34640
|
-
console.log(
|
|
34835
|
+
console.log(chalk215.green("\nExtraction complete"));
|
|
34641
34836
|
} else {
|
|
34642
|
-
console.log(
|
|
34837
|
+
console.log(chalk215.dim("\nDry run. Use --apply to execute."));
|
|
34643
34838
|
}
|
|
34644
34839
|
}
|
|
34645
34840
|
|
|
34646
34841
|
// src/commands/refactor/ignore.ts
|
|
34647
34842
|
import fs32 from "fs";
|
|
34648
|
-
import
|
|
34843
|
+
import chalk216 from "chalk";
|
|
34649
34844
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
34650
34845
|
function ignore2(file) {
|
|
34651
34846
|
if (!fs32.existsSync(file)) {
|
|
34652
|
-
console.error(
|
|
34847
|
+
console.error(chalk216.red(`Error: File does not exist: ${file}`));
|
|
34653
34848
|
process.exit(1);
|
|
34654
34849
|
}
|
|
34655
34850
|
const content = fs32.readFileSync(file, "utf8");
|
|
@@ -34665,7 +34860,7 @@ function ignore2(file) {
|
|
|
34665
34860
|
fs32.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
34666
34861
|
}
|
|
34667
34862
|
console.log(
|
|
34668
|
-
|
|
34863
|
+
chalk216.green(
|
|
34669
34864
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
34670
34865
|
)
|
|
34671
34866
|
);
|
|
@@ -34674,12 +34869,12 @@ function ignore2(file) {
|
|
|
34674
34869
|
// src/commands/refactor/rename.ts
|
|
34675
34870
|
import fs35 from "fs";
|
|
34676
34871
|
import path61 from "path";
|
|
34677
|
-
import
|
|
34872
|
+
import chalk219 from "chalk";
|
|
34678
34873
|
|
|
34679
34874
|
// src/commands/refactor/rename/applyRename.ts
|
|
34680
34875
|
import fs34 from "fs";
|
|
34681
34876
|
import path57 from "path";
|
|
34682
|
-
import
|
|
34877
|
+
import chalk217 from "chalk";
|
|
34683
34878
|
|
|
34684
34879
|
// src/commands/refactor/restructure/computeRewrites.ts
|
|
34685
34880
|
import path56 from "path";
|
|
@@ -34785,13 +34980,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
34785
34980
|
const updatedContents = applyRewrites(rewrites);
|
|
34786
34981
|
for (const [file, content] of updatedContents) {
|
|
34787
34982
|
fs34.writeFileSync(file, content, "utf8");
|
|
34788
|
-
console.log(
|
|
34983
|
+
console.log(chalk217.cyan(` Updated imports in ${path57.relative(cwd, file)}`));
|
|
34789
34984
|
}
|
|
34790
34985
|
const destDir = path57.dirname(destPath);
|
|
34791
34986
|
if (!fs34.existsSync(destDir)) fs34.mkdirSync(destDir, { recursive: true });
|
|
34792
34987
|
fs34.renameSync(sourcePath, destPath);
|
|
34793
34988
|
console.log(
|
|
34794
|
-
|
|
34989
|
+
chalk217.white(
|
|
34795
34990
|
` Moved ${path57.relative(cwd, sourcePath)} \u2192 ${path57.relative(cwd, destPath)}`
|
|
34796
34991
|
)
|
|
34797
34992
|
);
|
|
@@ -34941,16 +35136,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
34941
35136
|
|
|
34942
35137
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
34943
35138
|
import path60 from "path";
|
|
34944
|
-
import
|
|
35139
|
+
import chalk218 from "chalk";
|
|
34945
35140
|
function printRenamePreview(rewrites, cwd) {
|
|
34946
35141
|
for (const rewrite of rewrites) {
|
|
34947
35142
|
console.log(
|
|
34948
|
-
|
|
35143
|
+
chalk218.dim(
|
|
34949
35144
|
` ${path60.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
34950
35145
|
)
|
|
34951
35146
|
);
|
|
34952
35147
|
}
|
|
34953
|
-
console.log(
|
|
35148
|
+
console.log(chalk218.dim("Dry run. Use --apply to execute."));
|
|
34954
35149
|
}
|
|
34955
35150
|
|
|
34956
35151
|
// src/commands/refactor/rename.ts
|
|
@@ -34961,20 +35156,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
34961
35156
|
const relSource = path61.relative(cwd, sourcePath);
|
|
34962
35157
|
const relDest = path61.relative(cwd, destPath);
|
|
34963
35158
|
if (!fs35.existsSync(sourcePath)) {
|
|
34964
|
-
console.log(
|
|
35159
|
+
console.log(chalk219.red(`File not found: ${source}`));
|
|
34965
35160
|
process.exit(1);
|
|
34966
35161
|
}
|
|
34967
35162
|
if (destPath !== sourcePath && fs35.existsSync(destPath)) {
|
|
34968
|
-
console.log(
|
|
35163
|
+
console.log(chalk219.red(`Destination already exists: ${destination}`));
|
|
34969
35164
|
process.exit(1);
|
|
34970
35165
|
}
|
|
34971
|
-
console.log(
|
|
34972
|
-
console.log(
|
|
34973
|
-
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..."));
|
|
34974
35169
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
34975
35170
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
34976
35171
|
console.log(
|
|
34977
|
-
|
|
35172
|
+
chalk219.dim(
|
|
34978
35173
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
34979
35174
|
)
|
|
34980
35175
|
);
|
|
@@ -34983,11 +35178,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
34983
35178
|
return;
|
|
34984
35179
|
}
|
|
34985
35180
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
34986
|
-
console.log(
|
|
35181
|
+
console.log(chalk219.green("Done"));
|
|
34987
35182
|
}
|
|
34988
35183
|
|
|
34989
35184
|
// src/commands/refactor/renameSymbol.ts
|
|
34990
|
-
import
|
|
35185
|
+
import chalk220 from "chalk";
|
|
34991
35186
|
|
|
34992
35187
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
34993
35188
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -35033,34 +35228,34 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
35033
35228
|
const { project, sourceFile } = loadProjectFile(file);
|
|
35034
35229
|
const symbol = findSymbol(sourceFile, oldName);
|
|
35035
35230
|
if (!symbol) {
|
|
35036
|
-
console.log(
|
|
35231
|
+
console.log(chalk220.red(`Symbol "${oldName}" not found in ${file}`));
|
|
35037
35232
|
process.exit(1);
|
|
35038
35233
|
}
|
|
35039
35234
|
const grouped = groupReferences(symbol, cwd);
|
|
35040
35235
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
35041
35236
|
console.log(
|
|
35042
|
-
|
|
35237
|
+
chalk220.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
35043
35238
|
`)
|
|
35044
35239
|
);
|
|
35045
35240
|
for (const [refFile, lines2] of grouped) {
|
|
35046
35241
|
console.log(
|
|
35047
|
-
` ${
|
|
35242
|
+
` ${chalk220.dim(refFile)}: lines ${chalk220.cyan(lines2.join(", "))}`
|
|
35048
35243
|
);
|
|
35049
35244
|
}
|
|
35050
35245
|
if (options2.apply) {
|
|
35051
35246
|
symbol.rename(newName);
|
|
35052
35247
|
await project.save();
|
|
35053
|
-
console.log(
|
|
35248
|
+
console.log(chalk220.green(`
|
|
35054
35249
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
35055
35250
|
} else {
|
|
35056
|
-
console.log(
|
|
35251
|
+
console.log(chalk220.dim("\nDry run. Use --apply to execute."));
|
|
35057
35252
|
}
|
|
35058
35253
|
}
|
|
35059
35254
|
|
|
35060
35255
|
// src/commands/refactor/restructure.ts
|
|
35061
35256
|
import fs37 from "fs";
|
|
35062
35257
|
import path82 from "path";
|
|
35063
|
-
import
|
|
35258
|
+
import chalk230 from "chalk";
|
|
35064
35259
|
|
|
35065
35260
|
// src/commands/refactor/restructure/buildPlan.ts
|
|
35066
35261
|
import path72 from "path";
|
|
@@ -35397,7 +35592,7 @@ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
|
|
|
35397
35592
|
}
|
|
35398
35593
|
|
|
35399
35594
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
35400
|
-
import
|
|
35595
|
+
import chalk225 from "chalk";
|
|
35401
35596
|
|
|
35402
35597
|
// src/commands/refactor/restructure/applyCommand.ts
|
|
35403
35598
|
import path73 from "path";
|
|
@@ -35408,13 +35603,13 @@ function applyCommand(scopeRoot) {
|
|
|
35408
35603
|
|
|
35409
35604
|
// src/commands/refactor/restructure/displayDrift.ts
|
|
35410
35605
|
import path74 from "path";
|
|
35411
|
-
import
|
|
35606
|
+
import chalk221 from "chalk";
|
|
35412
35607
|
var shownMoves = 20;
|
|
35413
35608
|
function displayDrift(plan2, listMoves) {
|
|
35414
35609
|
const rel = (file) => path74.relative(process.cwd(), file);
|
|
35415
35610
|
if (plan2.moves.length > 0) {
|
|
35416
35611
|
console.log(
|
|
35417
|
-
|
|
35612
|
+
chalk221.red(
|
|
35418
35613
|
`${plan2.moves.length} file(s) drift from the plan${listMoves ? ":" : "."}`
|
|
35419
35614
|
)
|
|
35420
35615
|
);
|
|
@@ -35422,17 +35617,17 @@ function displayDrift(plan2, listMoves) {
|
|
|
35422
35617
|
for (const move2 of plan2.moves.slice(0, shownMoves))
|
|
35423
35618
|
console.log(` ${rel(move2.from)} \u2192 ${rel(move2.to)}`);
|
|
35424
35619
|
if (plan2.moves.length > shownMoves)
|
|
35425
|
-
console.log(
|
|
35620
|
+
console.log(chalk221.dim(` \u2026and ${plan2.moves.length - shownMoves} more`));
|
|
35426
35621
|
}
|
|
35427
35622
|
}
|
|
35428
|
-
for (const error of plan2.errors) console.log(
|
|
35623
|
+
for (const error of plan2.errors) console.log(chalk221.red(error));
|
|
35429
35624
|
}
|
|
35430
35625
|
|
|
35431
35626
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
35432
|
-
import
|
|
35627
|
+
import chalk224 from "chalk";
|
|
35433
35628
|
|
|
35434
35629
|
// src/commands/refactor/restructure/displayDeepChains.ts
|
|
35435
|
-
import
|
|
35630
|
+
import chalk222 from "chalk";
|
|
35436
35631
|
var shownChains = 10;
|
|
35437
35632
|
function formatChain(chain2) {
|
|
35438
35633
|
const folders = chain2.folders.map((f) => `${f.name} (${f.files})`).join(" > ");
|
|
@@ -35442,28 +35637,28 @@ function displayDeepChains(chains, maxDepth) {
|
|
|
35442
35637
|
if (chains.length === 0) return;
|
|
35443
35638
|
const tooDeep = chains.reduce((sum3, c) => sum3 + c.tooDeep, 0);
|
|
35444
35639
|
console.log(
|
|
35445
|
-
|
|
35640
|
+
chalk222.red(
|
|
35446
35641
|
`
|
|
35447
35642
|
Plan exceeds restructure.maxDepth ${maxDepth}: ${tooDeep} file(s) deeper.`
|
|
35448
35643
|
)
|
|
35449
35644
|
);
|
|
35450
35645
|
console.log(
|
|
35451
|
-
|
|
35646
|
+
chalk222.bold(
|
|
35452
35647
|
"Deep chains, as folder (files beneath), most files too deep first:"
|
|
35453
35648
|
)
|
|
35454
35649
|
);
|
|
35455
35650
|
for (const chain2 of chains.slice(0, shownChains))
|
|
35456
35651
|
console.log(formatChain(chain2));
|
|
35457
35652
|
if (chains.length > shownChains)
|
|
35458
|
-
console.log(
|
|
35653
|
+
console.log(chalk222.dim(` \u2026and ${chains.length - shownChains} more`));
|
|
35459
35654
|
}
|
|
35460
35655
|
|
|
35461
35656
|
// src/commands/refactor/restructure/displayLongPaths.ts
|
|
35462
|
-
import
|
|
35657
|
+
import chalk223 from "chalk";
|
|
35463
35658
|
function displayLongPaths(longPaths, maxPathLength) {
|
|
35464
35659
|
if (longPaths.length === 0) return;
|
|
35465
35660
|
console.log(
|
|
35466
|
-
|
|
35661
|
+
chalk223.red(
|
|
35467
35662
|
`
|
|
35468
35663
|
Plan exceeds restructure.maxPathLength ${maxPathLength}: ${longPaths.length} repo-relative path(s) longer.`
|
|
35469
35664
|
)
|
|
@@ -35491,7 +35686,7 @@ function displayLayoutLimits(limits, apply) {
|
|
|
35491
35686
|
displayDeepChains(limits.chains, limits.maxDepth);
|
|
35492
35687
|
displayLongPaths(limits.longPaths, limits.maxPathLength);
|
|
35493
35688
|
console.log("");
|
|
35494
|
-
for (const line of pinSteps(apply)) console.log(
|
|
35689
|
+
for (const line of pinSteps(apply)) console.log(chalk224.yellow(line));
|
|
35495
35690
|
}
|
|
35496
35691
|
|
|
35497
35692
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
@@ -35503,14 +35698,14 @@ function checkPlan(plan2, limits) {
|
|
|
35503
35698
|
if (exceeds || plan2.errors.length > 0) process.exit(1);
|
|
35504
35699
|
if (plan2.moves.length > 0) {
|
|
35505
35700
|
console.log(
|
|
35506
|
-
|
|
35701
|
+
chalk225.yellow(
|
|
35507
35702
|
`
|
|
35508
35703
|
Run \`${apply}\` to move the files and rewrite their imports.`
|
|
35509
35704
|
)
|
|
35510
35705
|
);
|
|
35511
35706
|
process.exit(1);
|
|
35512
35707
|
}
|
|
35513
|
-
console.log(
|
|
35708
|
+
console.log(chalk225.green("Layout matches the restructure plan"));
|
|
35514
35709
|
}
|
|
35515
35710
|
|
|
35516
35711
|
// src/commands/refactor/restructure/findDeepChains.ts
|
|
@@ -35580,15 +35775,15 @@ function partitionIgnored(files) {
|
|
|
35580
35775
|
}
|
|
35581
35776
|
|
|
35582
35777
|
// src/commands/refactor/restructure/runPlan.ts
|
|
35583
|
-
import
|
|
35778
|
+
import chalk229 from "chalk";
|
|
35584
35779
|
|
|
35585
35780
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
35586
|
-
import
|
|
35781
|
+
import chalk227 from "chalk";
|
|
35587
35782
|
|
|
35588
35783
|
// src/commands/refactor/restructure/executePlan.ts
|
|
35589
35784
|
import fs36 from "fs";
|
|
35590
35785
|
import path78 from "path";
|
|
35591
|
-
import
|
|
35786
|
+
import chalk226 from "chalk";
|
|
35592
35787
|
function relPath(file) {
|
|
35593
35788
|
return path78.relative(process.cwd(), file);
|
|
35594
35789
|
}
|
|
@@ -35605,14 +35800,14 @@ function moveFiles(moves) {
|
|
|
35605
35800
|
fs36.mkdirSync(path78.dirname(move2.to), { recursive: true });
|
|
35606
35801
|
fs36.renameSync(staging, move2.to);
|
|
35607
35802
|
console.log(
|
|
35608
|
-
|
|
35803
|
+
chalk226.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
|
|
35609
35804
|
);
|
|
35610
35805
|
}
|
|
35611
35806
|
}
|
|
35612
35807
|
function removeIfEmpty(dir) {
|
|
35613
35808
|
if (!fs36.existsSync(dir) || fs36.readdirSync(dir).length > 0) return false;
|
|
35614
35809
|
fs36.rmdirSync(dir);
|
|
35615
|
-
console.log(
|
|
35810
|
+
console.log(chalk226.dim(` Removed empty directory ${relPath(dir)}`));
|
|
35616
35811
|
return true;
|
|
35617
35812
|
}
|
|
35618
35813
|
function removeEmptyDirectories(dirs, scopeRoot) {
|
|
@@ -35625,7 +35820,7 @@ function removeEmptyDirectories(dirs, scopeRoot) {
|
|
|
35625
35820
|
function executePlan(plan2) {
|
|
35626
35821
|
for (const [file, content] of applyRewrites(plan2.rewrites)) {
|
|
35627
35822
|
fs36.writeFileSync(file, content, "utf8");
|
|
35628
|
-
console.log(
|
|
35823
|
+
console.log(chalk226.cyan(` Rewrote imports in ${relPath(file)}`));
|
|
35629
35824
|
}
|
|
35630
35825
|
moveFiles(plan2.moves);
|
|
35631
35826
|
removeEmptyDirectories(
|
|
@@ -35637,17 +35832,17 @@ function executePlan(plan2) {
|
|
|
35637
35832
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
35638
35833
|
function applyPlan(plan2) {
|
|
35639
35834
|
if (plan2.errors.length > 0) {
|
|
35640
|
-
console.log(
|
|
35835
|
+
console.log(chalk227.red("\nResolve the errors above before applying."));
|
|
35641
35836
|
process.exit(1);
|
|
35642
35837
|
}
|
|
35643
|
-
console.log(
|
|
35838
|
+
console.log(chalk227.bold("\nApplying changes..."));
|
|
35644
35839
|
executePlan(plan2);
|
|
35645
|
-
console.log(
|
|
35840
|
+
console.log(chalk227.green("\nRestructuring complete"));
|
|
35646
35841
|
}
|
|
35647
35842
|
|
|
35648
35843
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
35649
35844
|
import path81 from "path";
|
|
35650
|
-
import
|
|
35845
|
+
import chalk228 from "chalk";
|
|
35651
35846
|
|
|
35652
35847
|
// src/commands/refactor/restructure/computeDepthStats.ts
|
|
35653
35848
|
import path79 from "path";
|
|
@@ -35698,17 +35893,17 @@ function relPath2(filePath) {
|
|
|
35698
35893
|
}
|
|
35699
35894
|
function displayMoves(plan2) {
|
|
35700
35895
|
if (plan2.moves.length === 0) return;
|
|
35701
|
-
console.log(
|
|
35896
|
+
console.log(chalk228.bold("\nFile moves:"));
|
|
35702
35897
|
for (const move2 of plan2.moves) {
|
|
35703
35898
|
console.log(
|
|
35704
|
-
` ${
|
|
35899
|
+
` ${chalk228.red(relPath2(move2.from))} \u2192 ${chalk228.green(relPath2(move2.to))}`
|
|
35705
35900
|
);
|
|
35706
|
-
console.log(
|
|
35901
|
+
console.log(chalk228.dim(` ${move2.reason}`));
|
|
35707
35902
|
}
|
|
35708
35903
|
}
|
|
35709
35904
|
function displayTree(plan2) {
|
|
35710
35905
|
console.log(
|
|
35711
|
-
|
|
35906
|
+
chalk228.bold(`
|
|
35712
35907
|
Resulting tree (${relPath2(plan2.scopeRoot) || "."}/):`)
|
|
35713
35908
|
);
|
|
35714
35909
|
for (const line of formatTree(plan2.targets.values(), plan2.scopeRoot))
|
|
@@ -35719,15 +35914,15 @@ function displayDepthStats(plan2) {
|
|
|
35719
35914
|
plan2.targets.values(),
|
|
35720
35915
|
plan2.scopeRoot
|
|
35721
35916
|
);
|
|
35722
|
-
console.log(
|
|
35917
|
+
console.log(chalk228.bold(`
|
|
35723
35918
|
Depth (max ${max}):`));
|
|
35724
35919
|
for (const depth of [...distribution.keys()].sort((a, b) => a - b))
|
|
35725
35920
|
console.log(` ${depth}: ${distribution.get(depth)} file(s)`);
|
|
35726
35921
|
}
|
|
35727
35922
|
function displayErrors(errors) {
|
|
35728
35923
|
if (errors.length === 0) return;
|
|
35729
|
-
console.log(
|
|
35730
|
-
for (const error of errors) console.log(
|
|
35924
|
+
console.log(chalk228.red("\nErrors:"));
|
|
35925
|
+
for (const error of errors) console.log(chalk228.red(` ${error}`));
|
|
35731
35926
|
}
|
|
35732
35927
|
function displayPlan2(plan2) {
|
|
35733
35928
|
displayMoves(plan2);
|
|
@@ -35736,7 +35931,7 @@ function displayPlan2(plan2) {
|
|
|
35736
35931
|
displayErrors(plan2.errors);
|
|
35737
35932
|
const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
|
|
35738
35933
|
console.log(
|
|
35739
|
-
|
|
35934
|
+
chalk228.dim(
|
|
35740
35935
|
`
|
|
35741
35936
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
|
|
35742
35937
|
)
|
|
@@ -35748,11 +35943,11 @@ function runPlan(plan2, limits, apply) {
|
|
|
35748
35943
|
displayPlan2(plan2);
|
|
35749
35944
|
displayLayoutLimits(limits, applyCommand(plan2.scopeRoot));
|
|
35750
35945
|
if (plan2.moves.length === 0 && plan2.errors.length === 0) {
|
|
35751
|
-
console.log(
|
|
35946
|
+
console.log(chalk229.green("No restructuring needed"));
|
|
35752
35947
|
return;
|
|
35753
35948
|
}
|
|
35754
35949
|
if (!apply) {
|
|
35755
|
-
console.log(
|
|
35950
|
+
console.log(chalk229.dim("\nDry run. Use --apply to execute."));
|
|
35756
35951
|
return;
|
|
35757
35952
|
}
|
|
35758
35953
|
applyPlan(plan2);
|
|
@@ -35762,14 +35957,14 @@ function runPlan(plan2, limits, apply) {
|
|
|
35762
35957
|
async function restructure(root2, options2 = {}) {
|
|
35763
35958
|
const scopeRoot = path82.resolve(root2 ?? "src");
|
|
35764
35959
|
if (!fs37.existsSync(scopeRoot) || !fs37.statSync(scopeRoot).isDirectory()) {
|
|
35765
|
-
console.log(
|
|
35960
|
+
console.log(chalk230.red(`Not a directory: ${root2 ?? "src"}`));
|
|
35766
35961
|
process.exit(1);
|
|
35767
35962
|
}
|
|
35768
35963
|
const found = [];
|
|
35769
35964
|
walkSourceFiles(scopeRoot, found);
|
|
35770
35965
|
const { scoped, ignored } = partitionIgnored(found);
|
|
35771
35966
|
if (scoped.length === 0) {
|
|
35772
|
-
console.log(
|
|
35967
|
+
console.log(chalk230.yellow("No files found under root"));
|
|
35773
35968
|
return;
|
|
35774
35969
|
}
|
|
35775
35970
|
const {
|
|
@@ -35827,10 +36022,10 @@ function registerRefactor(program) {
|
|
|
35827
36022
|
}
|
|
35828
36023
|
|
|
35829
36024
|
// src/commands/review/checkoutPrSession.ts
|
|
35830
|
-
import { randomUUID as
|
|
36025
|
+
import { randomUUID as randomUUID18 } from "crypto";
|
|
35831
36026
|
async function checkoutPrSession(number, prompt = "") {
|
|
35832
36027
|
await checkoutPr(number);
|
|
35833
|
-
const claudeSessionId =
|
|
36028
|
+
const claudeSessionId = randomUUID18();
|
|
35834
36029
|
emitActivity({ kind: "command", name: "review", claudeSessionId });
|
|
35835
36030
|
const { done: done2 } = spawnClaude(prompt, {
|
|
35836
36031
|
permissionMode: "auto",
|
|
@@ -35840,7 +36035,7 @@ async function checkoutPrSession(number, prompt = "") {
|
|
|
35840
36035
|
}
|
|
35841
36036
|
|
|
35842
36037
|
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
35843
|
-
import
|
|
36038
|
+
import chalk234 from "chalk";
|
|
35844
36039
|
|
|
35845
36040
|
// src/commands/config/promptConfigScope.ts
|
|
35846
36041
|
import Enquirer3 from "enquirer";
|
|
@@ -35866,7 +36061,7 @@ async function promptConfigScope() {
|
|
|
35866
36061
|
}
|
|
35867
36062
|
|
|
35868
36063
|
// src/commands/config/resolveConfigKeyAnswer.ts
|
|
35869
|
-
import
|
|
36064
|
+
import chalk231 from "chalk";
|
|
35870
36065
|
async function resolveConfigKeyAnswer(question, supplied) {
|
|
35871
36066
|
if (supplied !== void 0) return coerceSupplied(question.key, supplied);
|
|
35872
36067
|
for (; ; ) {
|
|
@@ -35874,7 +36069,7 @@ async function resolveConfigKeyAnswer(question, supplied) {
|
|
|
35874
36069
|
if (answer === "") return void 0;
|
|
35875
36070
|
const coercion = coerceCliConfigValue(question.key, answer);
|
|
35876
36071
|
if (coercion.ok) return coercion.value;
|
|
35877
|
-
console.error(
|
|
36072
|
+
console.error(chalk231.red(coercion.error));
|
|
35878
36073
|
}
|
|
35879
36074
|
}
|
|
35880
36075
|
function coerceSupplied(key, supplied) {
|
|
@@ -35954,7 +36149,7 @@ function suggestGlobs(current, proposed) {
|
|
|
35954
36149
|
}
|
|
35955
36150
|
|
|
35956
36151
|
// src/commands/review/highLevel/parseConfigureAnswers.ts
|
|
35957
|
-
import
|
|
36152
|
+
import chalk232 from "chalk";
|
|
35958
36153
|
function parseConfigureAnswers(answers) {
|
|
35959
36154
|
const known = Object.values(highLevelConfigKeys);
|
|
35960
36155
|
const parsed = {};
|
|
@@ -35972,13 +36167,13 @@ function answersCoverEveryKey(answers) {
|
|
|
35972
36167
|
return Object.values(highLevelConfigKeys).every((key) => key in answers);
|
|
35973
36168
|
}
|
|
35974
36169
|
function exitWith(message3) {
|
|
35975
|
-
console.error(
|
|
36170
|
+
console.error(chalk232.red(`Error: ${message3}.`));
|
|
35976
36171
|
process.exit(1);
|
|
35977
36172
|
}
|
|
35978
36173
|
|
|
35979
36174
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
35980
36175
|
import { execFileSync as execFileSync28 } from "child_process";
|
|
35981
|
-
import
|
|
36176
|
+
import chalk233 from "chalk";
|
|
35982
36177
|
|
|
35983
36178
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
35984
36179
|
function buildGlobProposalPrompt(tree) {
|
|
@@ -36072,12 +36267,12 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
36072
36267
|
const tree = summariseRepoTree(cwd);
|
|
36073
36268
|
if (tree === "") return NOTHING_PROPOSED;
|
|
36074
36269
|
console.log(
|
|
36075
|
-
|
|
36270
|
+
chalk233.dim("Asking Claude to propose globs from the repo's own tree...")
|
|
36076
36271
|
);
|
|
36077
36272
|
const output = askClaude(buildGlobProposalPrompt(tree), cwd);
|
|
36078
36273
|
if (output === void 0) {
|
|
36079
36274
|
console.log(
|
|
36080
|
-
|
|
36275
|
+
chalk233.yellow(
|
|
36081
36276
|
"Claude proposed nothing; answer each key from its current value."
|
|
36082
36277
|
)
|
|
36083
36278
|
);
|
|
@@ -36141,14 +36336,14 @@ function asConfigKeyScope(value) {
|
|
|
36141
36336
|
function reportConfigured(result) {
|
|
36142
36337
|
for (const write of result.written)
|
|
36143
36338
|
console.log(
|
|
36144
|
-
|
|
36339
|
+
chalk234.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
|
|
36145
36340
|
);
|
|
36146
|
-
for (const key of result.skipped) console.log(
|
|
36147
|
-
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}`));
|
|
36148
36343
|
}
|
|
36149
36344
|
|
|
36150
36345
|
// src/commands/review/highLevel/announceSavedReview.ts
|
|
36151
|
-
import
|
|
36346
|
+
import chalk235 from "chalk";
|
|
36152
36347
|
function savedMessage(subject) {
|
|
36153
36348
|
const head = subject.headSha.slice(0, 7);
|
|
36154
36349
|
if (subject.draft)
|
|
@@ -36159,10 +36354,10 @@ function savedMessage(subject) {
|
|
|
36159
36354
|
}
|
|
36160
36355
|
function announceSavedReview(subject, force) {
|
|
36161
36356
|
const message3 = savedMessage(subject);
|
|
36162
|
-
if (message3) console.log(
|
|
36357
|
+
if (message3) console.log(chalk235.dim(message3));
|
|
36163
36358
|
else if (force)
|
|
36164
36359
|
console.log(
|
|
36165
|
-
|
|
36360
|
+
chalk235.dim(
|
|
36166
36361
|
`Discarding any review saved for ${subject.headSha.slice(0, 7)} and starting fresh (--force).`
|
|
36167
36362
|
)
|
|
36168
36363
|
);
|
|
@@ -36895,7 +37090,7 @@ function gatherHighLevelSubject(prNumber, force) {
|
|
|
36895
37090
|
}
|
|
36896
37091
|
|
|
36897
37092
|
// src/commands/review/highLevel/openHighLevelOverlay.ts
|
|
36898
|
-
import { randomUUID as
|
|
37093
|
+
import { randomUUID as randomUUID20 } from "crypto";
|
|
36899
37094
|
|
|
36900
37095
|
// src/commands/review/highLevel/highLevelProgress.ts
|
|
36901
37096
|
function toItem2(check2, decision) {
|
|
@@ -37154,7 +37349,7 @@ function splitQueuedComments(record) {
|
|
|
37154
37349
|
}
|
|
37155
37350
|
|
|
37156
37351
|
// src/commands/review/highLevel/previewHighLevelReview.ts
|
|
37157
|
-
import { randomUUID as
|
|
37352
|
+
import { randomUUID as randomUUID19 } from "crypto";
|
|
37158
37353
|
|
|
37159
37354
|
// src/commands/review/highLevel/formatHighLevelReviewPreview.ts
|
|
37160
37355
|
function formatHighLevelReviewPreview(lineLevel, body) {
|
|
@@ -37181,7 +37376,7 @@ async function previewHighLevelReview(sessionId, record, submission) {
|
|
|
37181
37376
|
"Review",
|
|
37182
37377
|
{
|
|
37183
37378
|
sessionId,
|
|
37184
|
-
requestId:
|
|
37379
|
+
requestId: randomUUID19(),
|
|
37185
37380
|
title: `${LABELS[submission.event]} ${record.repo}#${record.prNumber}`,
|
|
37186
37381
|
body: formatHighLevelReviewPreview(submission.comments, submission.body),
|
|
37187
37382
|
prNumber: record.prNumber,
|
|
@@ -37232,7 +37427,7 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
37232
37427
|
"High-level review",
|
|
37233
37428
|
{
|
|
37234
37429
|
sessionId,
|
|
37235
|
-
requestId:
|
|
37430
|
+
requestId: randomUUID20(),
|
|
37236
37431
|
title: `${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`,
|
|
37237
37432
|
body: JSON.stringify(highLevelPreviewPayload(subject)),
|
|
37238
37433
|
prNumber: subject.prNumber,
|
|
@@ -37257,55 +37452,55 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
37257
37452
|
}
|
|
37258
37453
|
|
|
37259
37454
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
37260
|
-
import
|
|
37455
|
+
import chalk240 from "chalk";
|
|
37261
37456
|
|
|
37262
37457
|
// src/commands/review/highLevel/formatCriticalDiffs.ts
|
|
37263
|
-
import
|
|
37458
|
+
import chalk236 from "chalk";
|
|
37264
37459
|
var PATCH_LINE_COLOURS = {
|
|
37265
|
-
"+":
|
|
37266
|
-
"-":
|
|
37267
|
-
"@":
|
|
37460
|
+
"+": chalk236.green,
|
|
37461
|
+
"-": chalk236.red,
|
|
37462
|
+
"@": chalk236.cyan
|
|
37268
37463
|
};
|
|
37269
37464
|
function formatPatch(patch2) {
|
|
37270
37465
|
return patch2.split("\n").map(
|
|
37271
|
-
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ??
|
|
37466
|
+
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk236.dim)(line)}`
|
|
37272
37467
|
);
|
|
37273
37468
|
}
|
|
37274
37469
|
function formatDiff(diff3) {
|
|
37275
37470
|
return [
|
|
37276
37471
|
"",
|
|
37277
|
-
` ${
|
|
37278
|
-
...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)
|
|
37279
37474
|
];
|
|
37280
37475
|
}
|
|
37281
37476
|
function formatCriticalDiffs(diffs, criticalPaths) {
|
|
37282
37477
|
if (criticalPaths.length === 0)
|
|
37283
|
-
return `${
|
|
37284
|
-
${
|
|
37478
|
+
return `${chalk236.bold.underline("Critical diffs")}
|
|
37479
|
+
${chalk236.dim("review.highLevel.criticalPaths is empty, so no diffs are shown")}`;
|
|
37285
37480
|
if (diffs.length === 0)
|
|
37286
|
-
return `${
|
|
37287
|
-
${
|
|
37481
|
+
return `${chalk236.bold.underline("Critical diffs")}
|
|
37482
|
+
${chalk236.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
|
|
37288
37483
|
return [
|
|
37289
|
-
|
|
37484
|
+
chalk236.bold.underline("Critical diffs"),
|
|
37290
37485
|
...diffs.flatMap(formatDiff)
|
|
37291
37486
|
].join("\n");
|
|
37292
37487
|
}
|
|
37293
37488
|
|
|
37294
37489
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
37295
|
-
import
|
|
37490
|
+
import chalk237 from "chalk";
|
|
37296
37491
|
var MARKERS = {
|
|
37297
|
-
pass: () =>
|
|
37298
|
-
fail: () =>
|
|
37299
|
-
manual: () =>
|
|
37492
|
+
pass: () => chalk237.green("\u2714"),
|
|
37493
|
+
fail: () => chalk237.red("\u2718"),
|
|
37494
|
+
manual: () => chalk237.yellow("\u25A1")
|
|
37300
37495
|
};
|
|
37301
37496
|
function formatCheck(check2) {
|
|
37302
|
-
const title = check2.status === "fail" ?
|
|
37497
|
+
const title = check2.status === "fail" ? chalk237.red(check2.title) : chalk237.bold(check2.title);
|
|
37303
37498
|
return ` ${MARKERS[check2.status]()} ${title}
|
|
37304
|
-
${
|
|
37499
|
+
${chalk237.dim(check2.reason)}`;
|
|
37305
37500
|
}
|
|
37306
37501
|
function formatGroup(heading2, checks2) {
|
|
37307
37502
|
if (checks2.length === 0) return [];
|
|
37308
|
-
return ["",
|
|
37503
|
+
return ["", chalk237.bold.underline(heading2), ...checks2.map(formatCheck)];
|
|
37309
37504
|
}
|
|
37310
37505
|
function formatHighLevelChecklist(checks2) {
|
|
37311
37506
|
const deterministic = checks2.filter(
|
|
@@ -37314,7 +37509,7 @@ function formatHighLevelChecklist(checks2) {
|
|
|
37314
37509
|
const failed3 = deterministic.filter(
|
|
37315
37510
|
(check2) => check2.status === "fail"
|
|
37316
37511
|
).length;
|
|
37317
|
-
const summary = failed3 === 0 ?
|
|
37512
|
+
const summary = failed3 === 0 ? chalk237.green(`All ${deterministic.length} deterministic checks pass`) : chalk237.red(
|
|
37318
37513
|
`${failed3} of ${deterministic.length} deterministic checks fail`
|
|
37319
37514
|
);
|
|
37320
37515
|
return [
|
|
@@ -37329,37 +37524,37 @@ function formatHighLevelChecklist(checks2) {
|
|
|
37329
37524
|
}
|
|
37330
37525
|
|
|
37331
37526
|
// src/commands/review/highLevel/formatHighLevelStructure.ts
|
|
37332
|
-
import
|
|
37527
|
+
import chalk238 from "chalk";
|
|
37333
37528
|
var STATUS_MARKERS = {
|
|
37334
|
-
added: () =>
|
|
37335
|
-
removed: () =>
|
|
37336
|
-
modified: () =>
|
|
37529
|
+
added: () => chalk238.green("A"),
|
|
37530
|
+
removed: () => chalk238.red("D"),
|
|
37531
|
+
modified: () => chalk238.yellow("M")
|
|
37337
37532
|
};
|
|
37338
37533
|
function counts(additions, deletions) {
|
|
37339
|
-
return `${
|
|
37534
|
+
return `${chalk238.green(`+${additions}`)} ${chalk238.red(`-${deletions}`)}`;
|
|
37340
37535
|
}
|
|
37341
37536
|
function formatNode(node, indent3) {
|
|
37342
37537
|
if (node.kind === "file")
|
|
37343
37538
|
return [
|
|
37344
|
-
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${
|
|
37539
|
+
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk238.dim(counts(node.additions, node.deletions))}`
|
|
37345
37540
|
];
|
|
37346
37541
|
const dir = node;
|
|
37347
37542
|
return [
|
|
37348
|
-
`${indent3}${
|
|
37543
|
+
`${indent3}${chalk238.bold(`${dir.name}/`)} ${chalk238.dim(counts(dir.additions, dir.deletions))}`,
|
|
37349
37544
|
...dir.children.flatMap((child) => formatNode(child, `${indent3} `))
|
|
37350
37545
|
];
|
|
37351
37546
|
}
|
|
37352
37547
|
function formatHighLevelStructure(structure) {
|
|
37353
37548
|
const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
|
|
37354
37549
|
return [
|
|
37355
|
-
|
|
37550
|
+
chalk238.bold.underline("Structure"),
|
|
37356
37551
|
` ${summary}`,
|
|
37357
37552
|
...structure.tree.flatMap((node) => formatNode(node, " "))
|
|
37358
37553
|
].join("\n");
|
|
37359
37554
|
}
|
|
37360
37555
|
|
|
37361
37556
|
// src/commands/review/highLevel/formatHighLevelTests.ts
|
|
37362
|
-
import
|
|
37557
|
+
import chalk239 from "chalk";
|
|
37363
37558
|
function changeMarker(change) {
|
|
37364
37559
|
if (change === "added") return "A";
|
|
37365
37560
|
if (change === "modified") return "M";
|
|
@@ -37368,22 +37563,22 @@ function changeMarker(change) {
|
|
|
37368
37563
|
function formatNode2(node, depth) {
|
|
37369
37564
|
const indent3 = " ".repeat(depth + 2);
|
|
37370
37565
|
if (node.kind === "it")
|
|
37371
|
-
return [`${indent3}${
|
|
37566
|
+
return [`${indent3}${chalk239.dim(changeMarker(node.change))} ${node.name}`];
|
|
37372
37567
|
return [
|
|
37373
|
-
`${indent3}${
|
|
37568
|
+
`${indent3}${chalk239.bold(node.name)}`,
|
|
37374
37569
|
...node.children.flatMap((child) => formatNode2(child, depth + 1))
|
|
37375
37570
|
];
|
|
37376
37571
|
}
|
|
37377
37572
|
function formatHighLevelTests(files, testPaths) {
|
|
37378
|
-
const heading2 =
|
|
37573
|
+
const heading2 = chalk239.bold.underline("Changed tests");
|
|
37379
37574
|
if (files.length === 0)
|
|
37380
37575
|
return `${heading2}
|
|
37381
|
-
${
|
|
37576
|
+
${chalk239.dim(`no changed test in files matching ${testPaths.join(", ")}`)}`;
|
|
37382
37577
|
return [
|
|
37383
37578
|
heading2,
|
|
37384
37579
|
...files.flatMap((file) => [
|
|
37385
37580
|
"",
|
|
37386
|
-
` ${
|
|
37581
|
+
` ${chalk239.bold(file.path)} ${chalk239.dim(`(${file.status})`)}`,
|
|
37387
37582
|
...file.tests.flatMap((node) => formatNode2(node, 0))
|
|
37388
37583
|
])
|
|
37389
37584
|
].join("\n");
|
|
@@ -37397,10 +37592,10 @@ function highLevelChangedFileCount(structure) {
|
|
|
37397
37592
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
37398
37593
|
function printHighLevelChecklist(subject) {
|
|
37399
37594
|
console.log(
|
|
37400
|
-
|
|
37595
|
+
chalk240.bold(
|
|
37401
37596
|
`High-level review of ${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`
|
|
37402
37597
|
),
|
|
37403
|
-
|
|
37598
|
+
chalk240.dim(
|
|
37404
37599
|
`\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
|
|
37405
37600
|
)
|
|
37406
37601
|
);
|
|
@@ -37414,12 +37609,12 @@ function printHighLevelChecklist(subject) {
|
|
|
37414
37609
|
console.log("");
|
|
37415
37610
|
console.log(formatHighLevelTests(subject.tests, subject.testPaths));
|
|
37416
37611
|
console.log(
|
|
37417
|
-
|
|
37612
|
+
chalk240.dim(
|
|
37418
37613
|
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
37419
37614
|
)
|
|
37420
37615
|
);
|
|
37421
37616
|
console.log(
|
|
37422
|
-
|
|
37617
|
+
chalk240.dim(
|
|
37423
37618
|
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
37424
37619
|
)
|
|
37425
37620
|
);
|
|
@@ -37705,18 +37900,18 @@ function partitionFindingsByDiff(findings, index2) {
|
|
|
37705
37900
|
}
|
|
37706
37901
|
|
|
37707
37902
|
// src/commands/review/warnOutOfDiff.ts
|
|
37708
|
-
import
|
|
37903
|
+
import chalk241 from "chalk";
|
|
37709
37904
|
function warnOutOfDiff(outOfDiff) {
|
|
37710
37905
|
if (outOfDiff.length === 0) return;
|
|
37711
37906
|
console.warn(
|
|
37712
|
-
|
|
37907
|
+
chalk241.yellow(
|
|
37713
37908
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
37714
37909
|
)
|
|
37715
37910
|
);
|
|
37716
37911
|
for (const finding of outOfDiff) {
|
|
37717
37912
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
37718
37913
|
console.warn(
|
|
37719
|
-
` ${
|
|
37914
|
+
` ${chalk241.yellow("\xB7")} ${finding.title} ${chalk241.dim(
|
|
37720
37915
|
`(${finding.file}:${range})`
|
|
37721
37916
|
)}`
|
|
37722
37917
|
);
|
|
@@ -37740,18 +37935,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
37740
37935
|
}
|
|
37741
37936
|
|
|
37742
37937
|
// src/commands/review/warnUnlocated.ts
|
|
37743
|
-
import
|
|
37938
|
+
import chalk242 from "chalk";
|
|
37744
37939
|
function warnUnlocated(unlocated) {
|
|
37745
37940
|
if (unlocated.length === 0) return;
|
|
37746
37941
|
console.warn(
|
|
37747
|
-
|
|
37942
|
+
chalk242.yellow(
|
|
37748
37943
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
37749
37944
|
)
|
|
37750
37945
|
);
|
|
37751
37946
|
for (const finding of unlocated) {
|
|
37752
|
-
const where = finding.location ||
|
|
37947
|
+
const where = finding.location || chalk242.dim("missing");
|
|
37753
37948
|
console.warn(
|
|
37754
|
-
` ${
|
|
37949
|
+
` ${chalk242.yellow("\xB7")} ${finding.title} ${chalk242.dim(`(${where})`)}`
|
|
37755
37950
|
);
|
|
37756
37951
|
}
|
|
37757
37952
|
}
|
|
@@ -39894,7 +40089,7 @@ function registerReview(program) {
|
|
|
39894
40089
|
// src/commands/rules/addRule.ts
|
|
39895
40090
|
import { existsSync as existsSync72, readFileSync as readFileSync56, writeFileSync as writeFileSync43 } from "fs";
|
|
39896
40091
|
import path87 from "path";
|
|
39897
|
-
import
|
|
40092
|
+
import chalk243 from "chalk";
|
|
39898
40093
|
|
|
39899
40094
|
// src/commands/rules/insertRuleBullet.ts
|
|
39900
40095
|
function ruleBullet({ code, title, text: text17 }) {
|
|
@@ -40030,7 +40225,7 @@ function read2(file) {
|
|
|
40030
40225
|
function addRule(text17, options2) {
|
|
40031
40226
|
const rule = text17.trim();
|
|
40032
40227
|
if (rule === "") {
|
|
40033
|
-
console.error(
|
|
40228
|
+
console.error(chalk243.red("Rule text is required"));
|
|
40034
40229
|
process.exitCode = 1;
|
|
40035
40230
|
return;
|
|
40036
40231
|
}
|
|
@@ -40048,13 +40243,13 @@ function addRule(text17, options2) {
|
|
|
40048
40243
|
);
|
|
40049
40244
|
updateScopedRulesIndex(root2);
|
|
40050
40245
|
console.log(
|
|
40051
|
-
`Added ${
|
|
40246
|
+
`Added ${chalk243.cyan(code)} to ${path87.relative(process.cwd(), target) || target}`
|
|
40052
40247
|
);
|
|
40053
40248
|
}
|
|
40054
40249
|
|
|
40055
40250
|
// src/commands/rules/indexRules.ts
|
|
40056
40251
|
import path88 from "path";
|
|
40057
|
-
import
|
|
40252
|
+
import chalk244 from "chalk";
|
|
40058
40253
|
function indexRules() {
|
|
40059
40254
|
const startDir = scopeDirectory(process.cwd());
|
|
40060
40255
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
@@ -40062,24 +40257,24 @@ function indexRules() {
|
|
|
40062
40257
|
const rootFile = path88.relative(process.cwd(), path88.join(root2, "CLAUDE.md"));
|
|
40063
40258
|
if (directories.length === 0) {
|
|
40064
40259
|
console.log(
|
|
40065
|
-
|
|
40260
|
+
chalk244.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
40066
40261
|
);
|
|
40067
40262
|
return;
|
|
40068
40263
|
}
|
|
40069
40264
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
40070
40265
|
for (const directory of directories)
|
|
40071
|
-
console.log(` ${
|
|
40266
|
+
console.log(` ${chalk244.cyan(directory)}`);
|
|
40072
40267
|
}
|
|
40073
40268
|
|
|
40074
40269
|
// src/commands/rules/listRules.ts
|
|
40075
40270
|
import path89 from "path";
|
|
40076
|
-
import
|
|
40271
|
+
import chalk245 from "chalk";
|
|
40077
40272
|
function listRules(target, options2 = {}) {
|
|
40078
40273
|
const resolved = path89.resolve(target ?? process.cwd());
|
|
40079
40274
|
const rules2 = readScopedRules(resolved);
|
|
40080
40275
|
if (rules2.length === 0) {
|
|
40081
40276
|
const label2 = path89.relative(process.cwd(), resolved) || ".";
|
|
40082
|
-
console.log(
|
|
40277
|
+
console.log(chalk245.gray(`No rules in scope for ${label2}`));
|
|
40083
40278
|
return;
|
|
40084
40279
|
}
|
|
40085
40280
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -40089,14 +40284,14 @@ function listRules(target, options2 = {}) {
|
|
|
40089
40284
|
if (rule.source !== shown) {
|
|
40090
40285
|
shown = rule.source;
|
|
40091
40286
|
console.log(
|
|
40092
|
-
|
|
40287
|
+
chalk245.dim(base ? path89.relative(base, rule.source) : rule.source)
|
|
40093
40288
|
);
|
|
40094
40289
|
}
|
|
40095
40290
|
console.log(
|
|
40096
|
-
` ${
|
|
40291
|
+
` ${chalk245.cyan(rule.code.padEnd(width2))} ${rule.title ?? rule.text}`
|
|
40097
40292
|
);
|
|
40098
40293
|
if (options2.full && rule.title)
|
|
40099
|
-
console.log(` ${" ".repeat(width2)} ${
|
|
40294
|
+
console.log(` ${" ".repeat(width2)} ${chalk245.dim(rule.text)}`);
|
|
40100
40295
|
}
|
|
40101
40296
|
}
|
|
40102
40297
|
|
|
@@ -40131,7 +40326,7 @@ function registerRules(program) {
|
|
|
40131
40326
|
}
|
|
40132
40327
|
|
|
40133
40328
|
// src/commands/seq/seqAuth.ts
|
|
40134
|
-
import
|
|
40329
|
+
import chalk247 from "chalk";
|
|
40135
40330
|
|
|
40136
40331
|
// src/commands/seq/loadConnections.ts
|
|
40137
40332
|
function loadConnections2() {
|
|
@@ -40160,10 +40355,10 @@ function setDefaultConnection(name) {
|
|
|
40160
40355
|
}
|
|
40161
40356
|
|
|
40162
40357
|
// src/shared/assertUniqueName.ts
|
|
40163
|
-
import
|
|
40358
|
+
import chalk246 from "chalk";
|
|
40164
40359
|
function assertUniqueName(existingNames, name) {
|
|
40165
40360
|
if (existingNames.includes(name)) {
|
|
40166
|
-
console.error(
|
|
40361
|
+
console.error(chalk246.red(`Connection "${name}" already exists.`));
|
|
40167
40362
|
process.exit(1);
|
|
40168
40363
|
}
|
|
40169
40364
|
}
|
|
@@ -40181,16 +40376,16 @@ async function promptConnection2(existingNames) {
|
|
|
40181
40376
|
var seqAuth = createConnectionAuth({
|
|
40182
40377
|
load: loadConnections2,
|
|
40183
40378
|
save: saveConnections2,
|
|
40184
|
-
format: (c) => `${
|
|
40379
|
+
format: (c) => `${chalk247.bold(c.name)} ${c.url}`,
|
|
40185
40380
|
promptNew: promptConnection2,
|
|
40186
40381
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
40187
40382
|
});
|
|
40188
40383
|
|
|
40189
40384
|
// src/commands/seq/seqQuery.ts
|
|
40190
|
-
import
|
|
40385
|
+
import chalk251 from "chalk";
|
|
40191
40386
|
|
|
40192
40387
|
// src/commands/seq/fetchSeq.ts
|
|
40193
|
-
import
|
|
40388
|
+
import chalk248 from "chalk";
|
|
40194
40389
|
async function fetchSeq(conn, path108, params) {
|
|
40195
40390
|
const url = `${conn.url}${path108}?${params}`;
|
|
40196
40391
|
const response = await fetch(url, {
|
|
@@ -40201,7 +40396,7 @@ async function fetchSeq(conn, path108, params) {
|
|
|
40201
40396
|
});
|
|
40202
40397
|
if (!response.ok) {
|
|
40203
40398
|
const body = await response.text();
|
|
40204
|
-
console.error(
|
|
40399
|
+
console.error(chalk248.red(`Seq returned ${response.status}: ${body}`));
|
|
40205
40400
|
process.exit(1);
|
|
40206
40401
|
}
|
|
40207
40402
|
return response;
|
|
@@ -40260,23 +40455,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
40260
40455
|
}
|
|
40261
40456
|
|
|
40262
40457
|
// src/commands/seq/formatEvent.ts
|
|
40263
|
-
import
|
|
40458
|
+
import chalk249 from "chalk";
|
|
40264
40459
|
function levelColor(level) {
|
|
40265
40460
|
switch (level) {
|
|
40266
40461
|
case "Fatal":
|
|
40267
|
-
return
|
|
40462
|
+
return chalk249.bgRed.white;
|
|
40268
40463
|
case "Error":
|
|
40269
|
-
return
|
|
40464
|
+
return chalk249.red;
|
|
40270
40465
|
case "Warning":
|
|
40271
|
-
return
|
|
40466
|
+
return chalk249.yellow;
|
|
40272
40467
|
case "Information":
|
|
40273
|
-
return
|
|
40468
|
+
return chalk249.cyan;
|
|
40274
40469
|
case "Debug":
|
|
40275
|
-
return
|
|
40470
|
+
return chalk249.gray;
|
|
40276
40471
|
case "Verbose":
|
|
40277
|
-
return
|
|
40472
|
+
return chalk249.dim;
|
|
40278
40473
|
default:
|
|
40279
|
-
return
|
|
40474
|
+
return chalk249.white;
|
|
40280
40475
|
}
|
|
40281
40476
|
}
|
|
40282
40477
|
function levelAbbrev(level) {
|
|
@@ -40317,12 +40512,12 @@ function formatTimestamp(iso) {
|
|
|
40317
40512
|
function formatEvent(event) {
|
|
40318
40513
|
const color = levelColor(event.Level);
|
|
40319
40514
|
const abbrev = levelAbbrev(event.Level);
|
|
40320
|
-
const ts10 =
|
|
40515
|
+
const ts10 = chalk249.dim(formatTimestamp(event.Timestamp));
|
|
40321
40516
|
const msg = renderMessage(event);
|
|
40322
40517
|
const lines2 = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
|
|
40323
40518
|
if (event.Exception) {
|
|
40324
40519
|
for (const line of event.Exception.split("\n")) {
|
|
40325
|
-
lines2.push(
|
|
40520
|
+
lines2.push(chalk249.red(` ${line}`));
|
|
40326
40521
|
}
|
|
40327
40522
|
}
|
|
40328
40523
|
return lines2.join("\n");
|
|
@@ -40355,11 +40550,11 @@ function rejectTimestampFilter(filter) {
|
|
|
40355
40550
|
}
|
|
40356
40551
|
|
|
40357
40552
|
// src/shared/resolveNamedConnection.ts
|
|
40358
|
-
import
|
|
40553
|
+
import chalk250 from "chalk";
|
|
40359
40554
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
40360
40555
|
if (connections.length === 0) {
|
|
40361
40556
|
console.error(
|
|
40362
|
-
|
|
40557
|
+
chalk250.red(
|
|
40363
40558
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
40364
40559
|
)
|
|
40365
40560
|
);
|
|
@@ -40368,7 +40563,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
40368
40563
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
40369
40564
|
const connection = connections.find((c) => c.name === target);
|
|
40370
40565
|
if (!connection) {
|
|
40371
|
-
console.error(
|
|
40566
|
+
console.error(chalk250.red(`${kind} connection "${target}" not found.`));
|
|
40372
40567
|
process.exit(1);
|
|
40373
40568
|
}
|
|
40374
40569
|
return connection;
|
|
@@ -40397,7 +40592,7 @@ async function seqQuery(filter, options2) {
|
|
|
40397
40592
|
new URLSearchParams({ filter, count: String(count10) })
|
|
40398
40593
|
);
|
|
40399
40594
|
if (events.length === 0) {
|
|
40400
|
-
console.log(
|
|
40595
|
+
console.log(chalk251.yellow("No events found."));
|
|
40401
40596
|
return;
|
|
40402
40597
|
}
|
|
40403
40598
|
if (options2.json) {
|
|
@@ -40408,11 +40603,11 @@ async function seqQuery(filter, options2) {
|
|
|
40408
40603
|
for (const event of chronological) {
|
|
40409
40604
|
console.log(formatEvent(event));
|
|
40410
40605
|
}
|
|
40411
|
-
console.log(
|
|
40606
|
+
console.log(chalk251.dim(`
|
|
40412
40607
|
${events.length} events`));
|
|
40413
40608
|
if (events.length >= count10) {
|
|
40414
40609
|
console.log(
|
|
40415
|
-
|
|
40610
|
+
chalk251.yellow(
|
|
40416
40611
|
`Results limited to ${count10}. Use --count to retrieve more.`
|
|
40417
40612
|
)
|
|
40418
40613
|
);
|
|
@@ -40420,10 +40615,10 @@ ${events.length} events`));
|
|
|
40420
40615
|
}
|
|
40421
40616
|
|
|
40422
40617
|
// src/shared/setNamedDefaultConnection.ts
|
|
40423
|
-
import
|
|
40618
|
+
import chalk252 from "chalk";
|
|
40424
40619
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
40425
40620
|
if (!connections.find((c) => c.name === name)) {
|
|
40426
|
-
console.error(
|
|
40621
|
+
console.error(chalk252.red(`Connection "${name}" not found.`));
|
|
40427
40622
|
process.exit(1);
|
|
40428
40623
|
}
|
|
40429
40624
|
setDefault(name);
|
|
@@ -40459,7 +40654,7 @@ function registerSeq(program) {
|
|
|
40459
40654
|
}
|
|
40460
40655
|
|
|
40461
40656
|
// src/commands/show.ts
|
|
40462
|
-
import { randomUUID as
|
|
40657
|
+
import { randomUUID as randomUUID21 } from "crypto";
|
|
40463
40658
|
|
|
40464
40659
|
// src/commands/sessions/shared/sendShowPreview.ts
|
|
40465
40660
|
async function sendShowPreview(request) {
|
|
@@ -40511,7 +40706,7 @@ async function show3(options2) {
|
|
|
40511
40706
|
try {
|
|
40512
40707
|
await sendShowPreview({
|
|
40513
40708
|
sessionId,
|
|
40514
|
-
requestId:
|
|
40709
|
+
requestId: randomUUID21(),
|
|
40515
40710
|
title: options2.title ?? "Show",
|
|
40516
40711
|
body
|
|
40517
40712
|
});
|
|
@@ -40595,7 +40790,7 @@ function readSlackParts(files) {
|
|
|
40595
40790
|
}
|
|
40596
40791
|
|
|
40597
40792
|
// src/commands/slack/reviewProposedSlackMessage.ts
|
|
40598
|
-
import { randomUUID as
|
|
40793
|
+
import { randomUUID as randomUUID22 } from "crypto";
|
|
40599
40794
|
async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
40600
40795
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
40601
40796
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
@@ -40605,7 +40800,7 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
40605
40800
|
part ? `Slack message ${part.index} of ${part.total}` : "Slack message preview",
|
|
40606
40801
|
{
|
|
40607
40802
|
sessionId,
|
|
40608
|
-
requestId:
|
|
40803
|
+
requestId: randomUUID22(),
|
|
40609
40804
|
title: part ? `${destination} (${part.index}/${part.total})` : destination,
|
|
40610
40805
|
body,
|
|
40611
40806
|
prNumber: null,
|
|
@@ -40725,7 +40920,7 @@ function registerSlack(program) {
|
|
|
40725
40920
|
}
|
|
40726
40921
|
|
|
40727
40922
|
// src/commands/sql/sqlAuth.ts
|
|
40728
|
-
import
|
|
40923
|
+
import chalk254 from "chalk";
|
|
40729
40924
|
|
|
40730
40925
|
// src/commands/sql/loadConnections.ts
|
|
40731
40926
|
function loadConnections3() {
|
|
@@ -40754,7 +40949,7 @@ function setDefaultConnection2(name) {
|
|
|
40754
40949
|
}
|
|
40755
40950
|
|
|
40756
40951
|
// src/commands/sql/promptConnection.ts
|
|
40757
|
-
import
|
|
40952
|
+
import chalk253 from "chalk";
|
|
40758
40953
|
async function promptConnection3(existingNames) {
|
|
40759
40954
|
const name = await promptInput("name", "Connection name:", "default");
|
|
40760
40955
|
assertUniqueName(existingNames, name);
|
|
@@ -40762,7 +40957,7 @@ async function promptConnection3(existingNames) {
|
|
|
40762
40957
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
40763
40958
|
const port = Number.parseInt(portStr, 10);
|
|
40764
40959
|
if (!Number.isFinite(port)) {
|
|
40765
|
-
console.error(
|
|
40960
|
+
console.error(chalk253.red(`Invalid port "${portStr}".`));
|
|
40766
40961
|
process.exit(1);
|
|
40767
40962
|
}
|
|
40768
40963
|
const user = await promptInput("user", "User:");
|
|
@@ -40775,13 +40970,13 @@ async function promptConnection3(existingNames) {
|
|
|
40775
40970
|
var sqlAuth = createConnectionAuth({
|
|
40776
40971
|
load: loadConnections3,
|
|
40777
40972
|
save: saveConnections3,
|
|
40778
|
-
format: (c) => `${
|
|
40973
|
+
format: (c) => `${chalk254.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
40779
40974
|
promptNew: promptConnection3,
|
|
40780
40975
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
40781
40976
|
});
|
|
40782
40977
|
|
|
40783
40978
|
// src/commands/sql/printTable.ts
|
|
40784
|
-
import
|
|
40979
|
+
import chalk255 from "chalk";
|
|
40785
40980
|
function formatCell(value) {
|
|
40786
40981
|
if (value === null || value === void 0) return "";
|
|
40787
40982
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -40790,7 +40985,7 @@ function formatCell(value) {
|
|
|
40790
40985
|
}
|
|
40791
40986
|
function printTable(rows) {
|
|
40792
40987
|
if (rows.length === 0) {
|
|
40793
|
-
console.log(
|
|
40988
|
+
console.log(chalk255.yellow("(no rows)"));
|
|
40794
40989
|
return;
|
|
40795
40990
|
}
|
|
40796
40991
|
const columns = Object.keys(rows[0]);
|
|
@@ -40798,13 +40993,13 @@ function printTable(rows) {
|
|
|
40798
40993
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
40799
40994
|
);
|
|
40800
40995
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
40801
|
-
console.log(
|
|
40802
|
-
console.log(
|
|
40996
|
+
console.log(chalk255.dim(header));
|
|
40997
|
+
console.log(chalk255.dim("-".repeat(header.length)));
|
|
40803
40998
|
for (const row3 of rows) {
|
|
40804
40999
|
const line = columns.map((c, i) => formatCell(row3[c]).padEnd(widths[i])).join(" ");
|
|
40805
41000
|
console.log(line);
|
|
40806
41001
|
}
|
|
40807
|
-
console.log(
|
|
41002
|
+
console.log(chalk255.dim(`
|
|
40808
41003
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
40809
41004
|
}
|
|
40810
41005
|
|
|
@@ -40864,7 +41059,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
40864
41059
|
}
|
|
40865
41060
|
|
|
40866
41061
|
// src/commands/sql/sqlMutate.ts
|
|
40867
|
-
import
|
|
41062
|
+
import chalk256 from "chalk";
|
|
40868
41063
|
|
|
40869
41064
|
// src/commands/sql/isMutation.ts
|
|
40870
41065
|
var MUTATION_KEYWORDS = [
|
|
@@ -40898,7 +41093,7 @@ function isMutation(sql27) {
|
|
|
40898
41093
|
async function sqlMutate(query, connectionName) {
|
|
40899
41094
|
if (!isMutation(query)) {
|
|
40900
41095
|
console.error(
|
|
40901
|
-
|
|
41096
|
+
chalk256.red(
|
|
40902
41097
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
40903
41098
|
)
|
|
40904
41099
|
);
|
|
@@ -40908,18 +41103,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
40908
41103
|
const pool = await sqlConnect(conn);
|
|
40909
41104
|
try {
|
|
40910
41105
|
const result = await pool.request().query(query);
|
|
40911
|
-
console.log(
|
|
41106
|
+
console.log(chalk256.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
40912
41107
|
} finally {
|
|
40913
41108
|
await pool.close();
|
|
40914
41109
|
}
|
|
40915
41110
|
}
|
|
40916
41111
|
|
|
40917
41112
|
// src/commands/sql/sqlQuery.ts
|
|
40918
|
-
import
|
|
41113
|
+
import chalk257 from "chalk";
|
|
40919
41114
|
async function sqlQuery(query, connectionName) {
|
|
40920
41115
|
if (isMutation(query)) {
|
|
40921
41116
|
console.error(
|
|
40922
|
-
|
|
41117
|
+
chalk257.red(
|
|
40923
41118
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
40924
41119
|
)
|
|
40925
41120
|
);
|
|
@@ -40934,7 +41129,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
40934
41129
|
printTable(rows);
|
|
40935
41130
|
} else {
|
|
40936
41131
|
console.log(
|
|
40937
|
-
|
|
41132
|
+
chalk257.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
40938
41133
|
);
|
|
40939
41134
|
}
|
|
40940
41135
|
} finally {
|
|
@@ -41309,7 +41504,7 @@ function syncPiHooks(sourceDir) {
|
|
|
41309
41504
|
}
|
|
41310
41505
|
|
|
41311
41506
|
// src/commands/sync/syncPi.ts
|
|
41312
|
-
function
|
|
41507
|
+
function unquote(value) {
|
|
41313
41508
|
return value.trim().replace(/^["']|["']$/g, "");
|
|
41314
41509
|
}
|
|
41315
41510
|
function commandToPrompt(name, content) {
|
|
@@ -41317,7 +41512,7 @@ function commandToPrompt(name, content) {
|
|
|
41317
41512
|
const { frontmatter: frontmatter2, body } = split;
|
|
41318
41513
|
const description = split.description ?? name;
|
|
41319
41514
|
const argsMatch = frontmatter2.match(/^allowed_args:\s*(.*)$/m);
|
|
41320
|
-
const argumentHint = argsMatch ?
|
|
41515
|
+
const argumentHint = argsMatch ? unquote(argsMatch[1]) : void 0;
|
|
41321
41516
|
const header = [
|
|
41322
41517
|
"---",
|
|
41323
41518
|
`description: ${description}`,
|
|
@@ -41349,7 +41544,7 @@ function syncPi(claudeDir, options2) {
|
|
|
41349
41544
|
// src/commands/sync/syncSettings.ts
|
|
41350
41545
|
import * as fs46 from "fs";
|
|
41351
41546
|
import * as path100 from "path";
|
|
41352
|
-
import
|
|
41547
|
+
import chalk258 from "chalk";
|
|
41353
41548
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
41354
41549
|
const source = path100.join(claudeDir, "settings.json");
|
|
41355
41550
|
const target = path100.join(targetBase, "settings.json");
|
|
@@ -41368,7 +41563,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
41368
41563
|
if (mergedContent !== normalizedTarget) {
|
|
41369
41564
|
if (!options2?.yes) {
|
|
41370
41565
|
console.log(
|
|
41371
|
-
|
|
41566
|
+
chalk258.yellow(
|
|
41372
41567
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
41373
41568
|
)
|
|
41374
41569
|
);
|
|
@@ -41376,7 +41571,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
41376
41571
|
printDiff(targetContent, mergedContent);
|
|
41377
41572
|
printAutoConfirmHint();
|
|
41378
41573
|
const confirm = await promptConfirm(
|
|
41379
|
-
|
|
41574
|
+
chalk258.red("Overwrite existing settings.json?"),
|
|
41380
41575
|
false
|
|
41381
41576
|
);
|
|
41382
41577
|
if (!confirm) {
|
|
@@ -43616,7 +43811,7 @@ function registerWatch(program) {
|
|
|
43616
43811
|
|
|
43617
43812
|
// src/commands/roam/auth.ts
|
|
43618
43813
|
import { randomBytes } from "crypto";
|
|
43619
|
-
import
|
|
43814
|
+
import chalk259 from "chalk";
|
|
43620
43815
|
|
|
43621
43816
|
// src/commands/roam/waitForCallback.ts
|
|
43622
43817
|
import { createServer as createServer3 } from "http";
|
|
@@ -43747,13 +43942,13 @@ async function auth() {
|
|
|
43747
43942
|
saveGlobalConfig(config);
|
|
43748
43943
|
const state = randomBytes(16).toString("hex");
|
|
43749
43944
|
console.log(
|
|
43750
|
-
|
|
43945
|
+
chalk259.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
43751
43946
|
);
|
|
43752
|
-
console.log(
|
|
43753
|
-
console.log(
|
|
43754
|
-
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..."));
|
|
43755
43950
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
43756
|
-
console.log(
|
|
43951
|
+
console.log(chalk259.dim("Exchanging code for tokens..."));
|
|
43757
43952
|
const tokens = await exchangeToken({
|
|
43758
43953
|
code,
|
|
43759
43954
|
clientId,
|
|
@@ -43769,7 +43964,7 @@ async function auth() {
|
|
|
43769
43964
|
};
|
|
43770
43965
|
saveGlobalConfig(config);
|
|
43771
43966
|
console.log(
|
|
43772
|
-
|
|
43967
|
+
chalk259.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
43773
43968
|
);
|
|
43774
43969
|
}
|
|
43775
43970
|
|
|
@@ -44345,18 +44540,18 @@ function registerRun(program) {
|
|
|
44345
44540
|
}
|
|
44346
44541
|
|
|
44347
44542
|
// src/commands/sessions/nodes/formatLink.ts
|
|
44348
|
-
import
|
|
44543
|
+
import chalk260 from "chalk";
|
|
44349
44544
|
var STATE_COLOURS = {
|
|
44350
|
-
connected:
|
|
44351
|
-
connecting:
|
|
44352
|
-
disconnected:
|
|
44353
|
-
"version-blocked":
|
|
44545
|
+
connected: chalk260.green,
|
|
44546
|
+
connecting: chalk260.yellow,
|
|
44547
|
+
disconnected: chalk260.red,
|
|
44548
|
+
"version-blocked": chalk260.red
|
|
44354
44549
|
};
|
|
44355
44550
|
function formatLink(link3) {
|
|
44356
|
-
const colour = STATE_COLOURS[link3.state] ??
|
|
44551
|
+
const colour = STATE_COLOURS[link3.state] ?? chalk260.white;
|
|
44357
44552
|
const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
|
|
44358
44553
|
const error = link3.error ? `
|
|
44359
|
-
${
|
|
44554
|
+
${chalk260.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
|
|
44360
44555
|
return ` ${link3.name} ${colour(link3.state)} ${link3.url}${peer}${error}`;
|
|
44361
44556
|
}
|
|
44362
44557
|
|
|
@@ -45433,7 +45628,7 @@ var ClientHub = class extends Set {
|
|
|
45433
45628
|
};
|
|
45434
45629
|
|
|
45435
45630
|
// src/commands/sessions/daemon/createSession.ts
|
|
45436
|
-
import { randomUUID as
|
|
45631
|
+
import { randomUUID as randomUUID23 } from "crypto";
|
|
45437
45632
|
|
|
45438
45633
|
// src/commands/sessions/daemon/sessionBase.ts
|
|
45439
45634
|
function sessionBase(id, status2) {
|
|
@@ -45656,7 +45851,7 @@ function spawnRun(opts) {
|
|
|
45656
45851
|
function createSession(id, { prompt, cwd, design, auto, harness, holdPty } = {}) {
|
|
45657
45852
|
if (harness && harness !== "claude")
|
|
45658
45853
|
return createHarnessSession(id, harness, prompt, cwd, holdPty);
|
|
45659
|
-
const claudeSessionId =
|
|
45854
|
+
const claudeSessionId = randomUUID23();
|
|
45660
45855
|
return {
|
|
45661
45856
|
...sessionBase(id, prompt ? "running" : "waiting"),
|
|
45662
45857
|
name: `Session ${id}`,
|
|
@@ -48507,7 +48702,7 @@ function codexRespawnPlan(session) {
|
|
|
48507
48702
|
}
|
|
48508
48703
|
|
|
48509
48704
|
// src/commands/sessions/daemon/interactiveRespawnPlan.ts
|
|
48510
|
-
import { randomUUID as
|
|
48705
|
+
import { randomUUID as randomUUID24 } from "crypto";
|
|
48511
48706
|
|
|
48512
48707
|
// src/commands/sessions/daemon/hasTranscriptOnDisk.ts
|
|
48513
48708
|
function hasTranscriptOnDisk(session) {
|
|
@@ -48534,7 +48729,7 @@ function interactiveRespawnPlan(session, resumes) {
|
|
|
48534
48729
|
return null;
|
|
48535
48730
|
}
|
|
48536
48731
|
function freshClaudePlan(session, prompt, cwd) {
|
|
48537
|
-
const claudeSessionId =
|
|
48732
|
+
const claudeSessionId = randomUUID24();
|
|
48538
48733
|
return {
|
|
48539
48734
|
spawn: () => {
|
|
48540
48735
|
session.claudeSessionId = claudeSessionId;
|
|
@@ -52090,7 +52285,7 @@ async function closeSession() {
|
|
|
52090
52285
|
}
|
|
52091
52286
|
|
|
52092
52287
|
// src/commands/sessions/nodes/listNodes.ts
|
|
52093
|
-
import
|
|
52288
|
+
import chalk261 from "chalk";
|
|
52094
52289
|
async function nodesReport() {
|
|
52095
52290
|
const live = await queryNodes();
|
|
52096
52291
|
if (live)
|
|
@@ -52107,10 +52302,10 @@ async function listNodes(options2) {
|
|
|
52107
52302
|
console.log(JSON.stringify(report, null, 2));
|
|
52108
52303
|
return;
|
|
52109
52304
|
}
|
|
52110
|
-
console.log(`${report.local} ${
|
|
52305
|
+
console.log(`${report.local} ${chalk261.dim("(this node)")}`);
|
|
52111
52306
|
if (!report.daemonRunning)
|
|
52112
|
-
console.log(
|
|
52113
|
-
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"));
|
|
52114
52309
|
for (const link3 of report.links) console.log(formatLink(link3));
|
|
52115
52310
|
}
|
|
52116
52311
|
|
|
@@ -52132,7 +52327,7 @@ async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
|
52132
52327
|
}
|
|
52133
52328
|
|
|
52134
52329
|
// src/commands/sessions/nodes/printReport.ts
|
|
52135
|
-
import
|
|
52330
|
+
import chalk262 from "chalk";
|
|
52136
52331
|
function printReport(report) {
|
|
52137
52332
|
if (report.links.length === 0) {
|
|
52138
52333
|
console.log(`${report.local} has no links`);
|
|
@@ -52146,11 +52341,11 @@ function printReport(report) {
|
|
|
52146
52341
|
for (const diagnosis of report.links) printDiagnosis(diagnosis);
|
|
52147
52342
|
}
|
|
52148
52343
|
function printDiagnosis(diagnosis) {
|
|
52149
|
-
console.log(`${
|
|
52344
|
+
console.log(`${chalk262.bold(diagnosis.name)} ${chalk262.dim(diagnosis.url)}`);
|
|
52150
52345
|
for (const hop of diagnosis.hops) {
|
|
52151
|
-
const mark = hop.ok ?
|
|
52346
|
+
const mark = hop.ok ? chalk262.green("\u2713") : chalk262.red("\u2717");
|
|
52152
52347
|
console.log(` ${mark} ${hop.hop.padEnd(9)} ${hop.detail ?? hop.error}`);
|
|
52153
|
-
if (hop.remediation) console.log(` ${
|
|
52348
|
+
if (hop.remediation) console.log(` ${chalk262.yellow(hop.remediation)}`);
|
|
52154
52349
|
}
|
|
52155
52350
|
}
|
|
52156
52351
|
|
|
@@ -52222,14 +52417,14 @@ function registerDiagnoseCommands(nodes, calledBy4) {
|
|
|
52222
52417
|
}
|
|
52223
52418
|
|
|
52224
52419
|
// src/commands/sessions/nodes/linkNode.ts
|
|
52225
|
-
import
|
|
52420
|
+
import chalk265 from "chalk";
|
|
52226
52421
|
|
|
52227
52422
|
// src/commands/sessions/nodes/notifyDaemonLinks.ts
|
|
52228
|
-
import
|
|
52423
|
+
import chalk263 from "chalk";
|
|
52229
52424
|
async function notifyDaemonLinks() {
|
|
52230
52425
|
if (!await isDaemonRunning()) {
|
|
52231
52426
|
console.log(
|
|
52232
|
-
|
|
52427
|
+
chalk263.yellow(
|
|
52233
52428
|
"The sessions daemon is not running; it loads the links when it starts."
|
|
52234
52429
|
)
|
|
52235
52430
|
);
|
|
@@ -52237,11 +52432,11 @@ async function notifyDaemonLinks() {
|
|
|
52237
52432
|
}
|
|
52238
52433
|
try {
|
|
52239
52434
|
await sendToDaemonAwaitAck({ type: "reload-links" });
|
|
52240
|
-
console.log(
|
|
52435
|
+
console.log(chalk263.dim("The sessions daemon reloaded its links."));
|
|
52241
52436
|
} catch (error) {
|
|
52242
52437
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
52243
52438
|
console.log(
|
|
52244
|
-
|
|
52439
|
+
chalk263.yellow(
|
|
52245
52440
|
`Could not notify the sessions daemon (${message3}); run \`assist daemon restart\` to apply the change.`
|
|
52246
52441
|
)
|
|
52247
52442
|
);
|
|
@@ -52249,7 +52444,7 @@ async function notifyDaemonLinks() {
|
|
|
52249
52444
|
}
|
|
52250
52445
|
|
|
52251
52446
|
// src/commands/sessions/nodes/readLinks.ts
|
|
52252
|
-
import
|
|
52447
|
+
import chalk264 from "chalk";
|
|
52253
52448
|
|
|
52254
52449
|
// src/commands/sessions/nodes/writeLinks.ts
|
|
52255
52450
|
async function writeLinks(links2) {
|
|
@@ -52272,7 +52467,7 @@ async function readLinks() {
|
|
|
52272
52467
|
await writeLinks(links2);
|
|
52273
52468
|
const dropped = stored.filter((link3) => !link3.url).map((link3) => link3.name);
|
|
52274
52469
|
console.log(
|
|
52275
|
-
|
|
52470
|
+
chalk264.yellow(`Removed ${dropped.join(", ")}: ${SSH_LINK_RETIRED}`)
|
|
52276
52471
|
);
|
|
52277
52472
|
return links2;
|
|
52278
52473
|
}
|
|
@@ -52328,7 +52523,7 @@ async function linkNode(name, url, options2) {
|
|
|
52328
52523
|
throw new Error(`${name} is this node; link to a different node`);
|
|
52329
52524
|
const link3 = await buildLink(name, url, options2);
|
|
52330
52525
|
await writeLinks([...others, link3]);
|
|
52331
|
-
console.log(
|
|
52526
|
+
console.log(chalk265.green(`Linked ${name} (${link3.url})`));
|
|
52332
52527
|
await notifyDaemonLinks();
|
|
52333
52528
|
}
|
|
52334
52529
|
|
|
@@ -52511,16 +52706,16 @@ function registerPeerActionCommands(nodes, calledBy4) {
|
|
|
52511
52706
|
}
|
|
52512
52707
|
|
|
52513
52708
|
// src/commands/sessions/nodes/unlinkNode.ts
|
|
52514
|
-
import
|
|
52709
|
+
import chalk266 from "chalk";
|
|
52515
52710
|
async function unlinkNode(name) {
|
|
52516
52711
|
const links2 = await readLinks();
|
|
52517
52712
|
const remaining = links2.filter((link3) => link3.name !== name);
|
|
52518
52713
|
if (remaining.length === links2.length) {
|
|
52519
|
-
console.log(
|
|
52714
|
+
console.log(chalk266.yellow(`No link named ${name}`));
|
|
52520
52715
|
return;
|
|
52521
52716
|
}
|
|
52522
52717
|
await writeLinks(remaining);
|
|
52523
|
-
console.log(
|
|
52718
|
+
console.log(chalk266.green(`Unlinked ${name}`));
|
|
52524
52719
|
await notifyDaemonLinks();
|
|
52525
52720
|
}
|
|
52526
52721
|
|
|
@@ -52728,6 +52923,7 @@ var programRegistrars = [
|
|
|
52728
52923
|
registerNews,
|
|
52729
52924
|
registerNetcap,
|
|
52730
52925
|
registerExtension,
|
|
52926
|
+
registerBrowser,
|
|
52731
52927
|
registerLitellm,
|
|
52732
52928
|
registerRavendb,
|
|
52733
52929
|
registerSeq,
|
|
@@ -52754,10 +52950,10 @@ function createProgram() {
|
|
|
52754
52950
|
}
|
|
52755
52951
|
|
|
52756
52952
|
// src/reportCliError.ts
|
|
52757
|
-
import
|
|
52953
|
+
import chalk267 from "chalk";
|
|
52758
52954
|
function reportCliError(error) {
|
|
52759
52955
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
52760
|
-
console.error(
|
|
52956
|
+
console.error(chalk267.red(error.message));
|
|
52761
52957
|
} else {
|
|
52762
52958
|
console.error(error);
|
|
52763
52959
|
}
|