@staff0rd/assist 0.725.0 → 0.726.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 +8 -0
- package/dist/commands/sessions/web/bundle.js +472 -472
- package/dist/index.js +376 -174
- 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.726.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -856,6 +856,9 @@ var assistConfigShape = {
|
|
|
856
856
|
news: z3.strictObject({
|
|
857
857
|
showInNav: z3.boolean().default(false)
|
|
858
858
|
}).optional(),
|
|
859
|
+
next: z3.strictObject({
|
|
860
|
+
peers: z3.array(z3.string()).optional()
|
|
861
|
+
}).optional(),
|
|
859
862
|
deny: z3.array(
|
|
860
863
|
z3.strictObject({
|
|
861
864
|
pattern: z3.string(),
|
|
@@ -10340,13 +10343,13 @@ function phaseNotes(entry, position) {
|
|
|
10340
10343
|
}
|
|
10341
10344
|
function renderDiffPhase(entry, idx) {
|
|
10342
10345
|
const notes = phaseNotes(entry, idx + 1);
|
|
10343
|
-
const
|
|
10346
|
+
const section3 = renderPhaseSection(
|
|
10344
10347
|
{ ...entry.phase, name: `${entry.phase.name} (${notes.join(", ")})` },
|
|
10345
10348
|
idx
|
|
10346
10349
|
);
|
|
10347
|
-
if (!entry.previousTasks) return
|
|
10350
|
+
if (!entry.previousTasks) return section3;
|
|
10348
10351
|
return [
|
|
10349
|
-
|
|
10352
|
+
section3,
|
|
10350
10353
|
"**Previously:**",
|
|
10351
10354
|
entry.previousTasks.map((task) => `- ${task}`).join("\n")
|
|
10352
10355
|
].join("\n\n");
|
|
@@ -12553,6 +12556,15 @@ var newsConfigHelp = [
|
|
|
12553
12556
|
}
|
|
12554
12557
|
];
|
|
12555
12558
|
|
|
12559
|
+
// src/commands/sessions/nextConfigHelp.ts
|
|
12560
|
+
var nextConfigHelp = [
|
|
12561
|
+
{
|
|
12562
|
+
key: "next.peers",
|
|
12563
|
+
setter: "assist config set next.peers alice,bob -g --repo",
|
|
12564
|
+
note: "GitHub logins whose open, non-draft PRs the web /next view lists for review alongside PRs requesting your review; PRs you approved with no newer commits are hidden"
|
|
12565
|
+
}
|
|
12566
|
+
];
|
|
12567
|
+
|
|
12556
12568
|
// src/commands/prs/prsConfigHelp.ts
|
|
12557
12569
|
var prsRaiseConfigHelp = [
|
|
12558
12570
|
{
|
|
@@ -12993,6 +13005,7 @@ var configHelpEntries = [
|
|
|
12993
13005
|
...mermaidConfigHelp,
|
|
12994
13006
|
...miroConfigHelp,
|
|
12995
13007
|
...newsConfigHelp,
|
|
13008
|
+
...nextConfigHelp,
|
|
12996
13009
|
...prsConfigHelp,
|
|
12997
13010
|
...ravendbConfigHelp,
|
|
12998
13011
|
...readTimeConfigHelp,
|
|
@@ -13644,6 +13657,188 @@ function newsNavConfig(_req, res) {
|
|
|
13644
13657
|
respondJson(res, 200, { showInNav });
|
|
13645
13658
|
}
|
|
13646
13659
|
|
|
13660
|
+
// src/commands/sessions/web/releases/ghJson.ts
|
|
13661
|
+
import { execFile as execFile5 } from "child_process";
|
|
13662
|
+
import { promisify as promisify4 } from "util";
|
|
13663
|
+
var execFileAsync4 = promisify4(execFile5);
|
|
13664
|
+
var CACHE_TTL_MS4 = 3e4;
|
|
13665
|
+
var cache5 = /* @__PURE__ */ new Map();
|
|
13666
|
+
function partialGraphqlData(error) {
|
|
13667
|
+
const stdout = error.stdout;
|
|
13668
|
+
if (typeof stdout !== "string") return null;
|
|
13669
|
+
try {
|
|
13670
|
+
const parsed = JSON.parse(stdout);
|
|
13671
|
+
return parsed?.data ? parsed : null;
|
|
13672
|
+
} catch {
|
|
13673
|
+
return null;
|
|
13674
|
+
}
|
|
13675
|
+
}
|
|
13676
|
+
async function runGh(cwd, args) {
|
|
13677
|
+
try {
|
|
13678
|
+
const { stdout } = await execFileAsync4("gh", args, {
|
|
13679
|
+
encoding: "utf8",
|
|
13680
|
+
windowsHide: true,
|
|
13681
|
+
cwd,
|
|
13682
|
+
maxBuffer: 16 * 1024 * 1024
|
|
13683
|
+
});
|
|
13684
|
+
return JSON.parse(stdout);
|
|
13685
|
+
} catch (error) {
|
|
13686
|
+
const partial = partialGraphqlData(error);
|
|
13687
|
+
if (partial) return partial;
|
|
13688
|
+
throw error;
|
|
13689
|
+
}
|
|
13690
|
+
}
|
|
13691
|
+
function ghJson(cwd, args) {
|
|
13692
|
+
const key = [cwd, ...args].join("\0");
|
|
13693
|
+
const hit = cache5.get(key);
|
|
13694
|
+
if (hit && Date.now() - hit.at < CACHE_TTL_MS4)
|
|
13695
|
+
return hit.result;
|
|
13696
|
+
const result = runGh(cwd, args);
|
|
13697
|
+
cache5.set(key, { at: Date.now(), result });
|
|
13698
|
+
result.catch(() => cache5.delete(key));
|
|
13699
|
+
return result;
|
|
13700
|
+
}
|
|
13701
|
+
|
|
13702
|
+
// src/commands/sessions/web/next/peerPrsQuery.ts
|
|
13703
|
+
var peerPrsQuery = `query($owner: String!, $name: String!) {
|
|
13704
|
+
viewer { login }
|
|
13705
|
+
repository(owner: $owner, name: $name) {
|
|
13706
|
+
pullRequests(states: OPEN, first: 100, orderBy: { field: CREATED_AT, direction: ASC }) {
|
|
13707
|
+
nodes {
|
|
13708
|
+
number
|
|
13709
|
+
title
|
|
13710
|
+
url
|
|
13711
|
+
createdAt
|
|
13712
|
+
isDraft
|
|
13713
|
+
author { login }
|
|
13714
|
+
reviewRequests(first: 50) {
|
|
13715
|
+
nodes { requestedReviewer { ... on User { login } } }
|
|
13716
|
+
}
|
|
13717
|
+
latestReviews(first: 50) {
|
|
13718
|
+
nodes { author { login } state commit { oid } }
|
|
13719
|
+
}
|
|
13720
|
+
commits(last: 1) {
|
|
13721
|
+
nodes { commit { oid statusCheckRollup { state } } }
|
|
13722
|
+
}
|
|
13723
|
+
timelineItems(itemTypes: [REVIEW_REQUESTED_EVENT], last: 50) {
|
|
13724
|
+
nodes {
|
|
13725
|
+
... on ReviewRequestedEvent {
|
|
13726
|
+
createdAt
|
|
13727
|
+
requestedReviewer { ... on User { login } }
|
|
13728
|
+
}
|
|
13729
|
+
}
|
|
13730
|
+
}
|
|
13731
|
+
}
|
|
13732
|
+
}
|
|
13733
|
+
}
|
|
13734
|
+
}`;
|
|
13735
|
+
|
|
13736
|
+
// src/commands/sessions/web/next/headCommit.ts
|
|
13737
|
+
function headCommit(node) {
|
|
13738
|
+
return node.commits?.nodes?.[0]?.commit ?? null;
|
|
13739
|
+
}
|
|
13740
|
+
|
|
13741
|
+
// src/commands/sessions/web/next/sameLogin.ts
|
|
13742
|
+
var sameLogin = (a, b) => a?.toLowerCase() === b.toLowerCase();
|
|
13743
|
+
|
|
13744
|
+
// src/commands/sessions/web/next/toNextPr.ts
|
|
13745
|
+
var CHECK_STATES = {
|
|
13746
|
+
SUCCESS: "success",
|
|
13747
|
+
FAILURE: "failure",
|
|
13748
|
+
ERROR: "failure",
|
|
13749
|
+
PENDING: "pending",
|
|
13750
|
+
EXPECTED: "pending"
|
|
13751
|
+
};
|
|
13752
|
+
function lastRequestedAt(node, viewer) {
|
|
13753
|
+
const events = (node.timelineItems?.nodes ?? []).filter(
|
|
13754
|
+
(event) => sameLogin(event?.requestedReviewer?.login, viewer)
|
|
13755
|
+
);
|
|
13756
|
+
return events.at(-1)?.createdAt ?? node.createdAt;
|
|
13757
|
+
}
|
|
13758
|
+
function toNextPr(node, author, requested, viewer) {
|
|
13759
|
+
const rollup = headCommit(node)?.statusCheckRollup?.state;
|
|
13760
|
+
return {
|
|
13761
|
+
number: node.number,
|
|
13762
|
+
title: node.title,
|
|
13763
|
+
author,
|
|
13764
|
+
createdAt: node.createdAt,
|
|
13765
|
+
url: node.url,
|
|
13766
|
+
requestedAt: requested ? lastRequestedAt(node, viewer) : node.createdAt,
|
|
13767
|
+
reason: requested ? "requested" : "peer",
|
|
13768
|
+
checks: rollup && CHECK_STATES[rollup] || null
|
|
13769
|
+
};
|
|
13770
|
+
}
|
|
13771
|
+
|
|
13772
|
+
// src/commands/sessions/web/next/selectPeerPrs.ts
|
|
13773
|
+
function isRequested(node, viewer) {
|
|
13774
|
+
return (node.reviewRequests?.nodes ?? []).some(
|
|
13775
|
+
(request) => sameLogin(request?.requestedReviewer?.login, viewer)
|
|
13776
|
+
);
|
|
13777
|
+
}
|
|
13778
|
+
function approvedHead(node, viewer) {
|
|
13779
|
+
const mine = (node.latestReviews?.nodes ?? []).find(
|
|
13780
|
+
(review2) => sameLogin(review2?.author?.login, viewer)
|
|
13781
|
+
);
|
|
13782
|
+
const headOid = headCommit(node)?.oid;
|
|
13783
|
+
return mine?.state === "APPROVED" && !!headOid && mine.commit?.oid === headOid;
|
|
13784
|
+
}
|
|
13785
|
+
function selectPeerPrs(nodes, viewer, peers) {
|
|
13786
|
+
const selected = [];
|
|
13787
|
+
for (const node of nodes) {
|
|
13788
|
+
const author = node.author?.login ?? "unknown";
|
|
13789
|
+
if (node.isDraft || sameLogin(author, viewer)) continue;
|
|
13790
|
+
const requested = isRequested(node, viewer);
|
|
13791
|
+
const byPeer = peers.some((peer) => sameLogin(author, peer));
|
|
13792
|
+
if (!requested && (!byPeer || approvedHead(node, viewer))) continue;
|
|
13793
|
+
selected.push(toNextPr(node, author, requested, viewer));
|
|
13794
|
+
}
|
|
13795
|
+
return selected.sort((a, b) => a.requestedAt.localeCompare(b.requestedAt));
|
|
13796
|
+
}
|
|
13797
|
+
|
|
13798
|
+
// src/commands/sessions/web/next/fetchPeerPrs.ts
|
|
13799
|
+
async function fetchPeerPrs(cwd, peers) {
|
|
13800
|
+
const response = await ghJson(cwd, [
|
|
13801
|
+
"api",
|
|
13802
|
+
"graphql",
|
|
13803
|
+
"-f",
|
|
13804
|
+
`query=${peerPrsQuery}`,
|
|
13805
|
+
"-F",
|
|
13806
|
+
"owner={owner}",
|
|
13807
|
+
"-F",
|
|
13808
|
+
"name={repo}"
|
|
13809
|
+
]);
|
|
13810
|
+
const viewer = response.data?.viewer?.login;
|
|
13811
|
+
const repository = response.data?.repository;
|
|
13812
|
+
if (!viewer || !repository) throw new Error("Repository not readable");
|
|
13813
|
+
const nodes = (repository.pullRequests?.nodes ?? []).filter(
|
|
13814
|
+
(node) => !!node
|
|
13815
|
+
);
|
|
13816
|
+
return selectPeerPrs(nodes, viewer, peers);
|
|
13817
|
+
}
|
|
13818
|
+
|
|
13819
|
+
// src/commands/sessions/web/next/nextItems.ts
|
|
13820
|
+
function errorMessage(error) {
|
|
13821
|
+
const stderr = error.stderr;
|
|
13822
|
+
if (typeof stderr === "string" && stderr.trim()) return stderr.trim();
|
|
13823
|
+
return error instanceof Error ? error.message : String(error);
|
|
13824
|
+
}
|
|
13825
|
+
async function section(load3) {
|
|
13826
|
+
try {
|
|
13827
|
+
return { items: await load3(), error: null };
|
|
13828
|
+
} catch (error) {
|
|
13829
|
+
return { items: [], error: errorMessage(error) };
|
|
13830
|
+
}
|
|
13831
|
+
}
|
|
13832
|
+
async function nextItems(req, res) {
|
|
13833
|
+
const cwd = getCwdParam(req, res);
|
|
13834
|
+
if (!cwd) return;
|
|
13835
|
+
const peers = loadConfigFrom(cwd).next?.peers ?? [];
|
|
13836
|
+
const body = {
|
|
13837
|
+
peerPrs: await section(() => fetchPeerPrs(cwd, peers))
|
|
13838
|
+
};
|
|
13839
|
+
respondJson(res, 200, body);
|
|
13840
|
+
}
|
|
13841
|
+
|
|
13647
13842
|
// src/commands/sessions/web/listScopedRules.ts
|
|
13648
13843
|
import path27 from "path";
|
|
13649
13844
|
|
|
@@ -14006,8 +14201,8 @@ function listUsageItems(req, res) {
|
|
|
14006
14201
|
|
|
14007
14202
|
// src/commands/sessions/web/openInCode.ts
|
|
14008
14203
|
import { exec } from "child_process";
|
|
14009
|
-
import { promisify as
|
|
14010
|
-
var execAsync =
|
|
14204
|
+
import { promisify as promisify5 } from "util";
|
|
14205
|
+
var execAsync = promisify5(exec);
|
|
14011
14206
|
async function openInCode(req, res) {
|
|
14012
14207
|
const cwd = getCwdParam(req, res);
|
|
14013
14208
|
if (!cwd) return;
|
|
@@ -14023,10 +14218,10 @@ async function openInCode(req, res) {
|
|
|
14023
14218
|
}
|
|
14024
14219
|
|
|
14025
14220
|
// src/commands/sessions/web/createCachedGhJson.ts
|
|
14026
|
-
import { execFile as
|
|
14027
|
-
import { promisify as
|
|
14028
|
-
var
|
|
14029
|
-
var
|
|
14221
|
+
import { execFile as execFile6 } from "child_process";
|
|
14222
|
+
import { promisify as promisify6 } from "util";
|
|
14223
|
+
var execFileAsync5 = promisify6(execFile6);
|
|
14224
|
+
var CACHE_TTL_MS5 = 3e4;
|
|
14030
14225
|
function createCachedGhJson(args, parse5, fallback, options2 = {}) {
|
|
14031
14226
|
const { cacheFallback = true } = options2;
|
|
14032
14227
|
const cache6 = /* @__PURE__ */ new Map();
|
|
@@ -14037,7 +14232,7 @@ function createCachedGhJson(args, parse5, fallback, options2 = {}) {
|
|
|
14037
14232
|
if (cached && cached.expires > now) return cached.value;
|
|
14038
14233
|
let value = fallback;
|
|
14039
14234
|
try {
|
|
14040
|
-
const { stdout } = await
|
|
14235
|
+
const { stdout } = await execFileAsync5("gh", [...args, ...extraArgs], {
|
|
14041
14236
|
encoding: "utf8",
|
|
14042
14237
|
windowsHide: true,
|
|
14043
14238
|
cwd
|
|
@@ -14047,7 +14242,7 @@ function createCachedGhJson(args, parse5, fallback, options2 = {}) {
|
|
|
14047
14242
|
value = fallback;
|
|
14048
14243
|
}
|
|
14049
14244
|
if (cacheFallback || value !== fallback)
|
|
14050
|
-
cache6.set(key, { value, expires: now +
|
|
14245
|
+
cache6.set(key, { value, expires: now + CACHE_TTL_MS5 });
|
|
14051
14246
|
return value;
|
|
14052
14247
|
};
|
|
14053
14248
|
}
|
|
@@ -14214,11 +14409,11 @@ async function proxyToNode(req, res) {
|
|
|
14214
14409
|
}
|
|
14215
14410
|
|
|
14216
14411
|
// src/commands/sessions/web/ghAuthToken.ts
|
|
14217
|
-
import { execFile as
|
|
14218
|
-
import { promisify as
|
|
14219
|
-
var
|
|
14412
|
+
import { execFile as execFile7 } from "child_process";
|
|
14413
|
+
import { promisify as promisify7 } from "util";
|
|
14414
|
+
var execFileAsync6 = promisify7(execFile7);
|
|
14220
14415
|
async function ghAuthToken(cwd) {
|
|
14221
|
-
const { stdout } = await
|
|
14416
|
+
const { stdout } = await execFileAsync6("gh", ["auth", "token"], {
|
|
14222
14417
|
cwd,
|
|
14223
14418
|
windowsHide: true
|
|
14224
14419
|
});
|
|
@@ -14268,9 +14463,9 @@ async function previewImage(req, res) {
|
|
|
14268
14463
|
}
|
|
14269
14464
|
|
|
14270
14465
|
// src/commands/sessions/web/prStatus.ts
|
|
14271
|
-
import { execFile as
|
|
14272
|
-
import { promisify as
|
|
14273
|
-
var
|
|
14466
|
+
import { execFile as execFile8 } from "child_process";
|
|
14467
|
+
import { promisify as promisify8 } from "util";
|
|
14468
|
+
var execFileAsync7 = promisify8(execFile8);
|
|
14274
14469
|
function toPrSummary(parsed) {
|
|
14275
14470
|
if (typeof parsed.number !== "number") return null;
|
|
14276
14471
|
return {
|
|
@@ -14300,7 +14495,7 @@ var getOpenPrForBranch = createCachedGhJson(
|
|
|
14300
14495
|
);
|
|
14301
14496
|
async function getCurrentBranch(cwd) {
|
|
14302
14497
|
try {
|
|
14303
|
-
const { stdout } = await
|
|
14498
|
+
const { stdout } = await execFileAsync7(
|
|
14304
14499
|
"git",
|
|
14305
14500
|
["rev-parse", "--abbrev-ref", "HEAD"],
|
|
14306
14501
|
{ encoding: "utf8", windowsHide: true, cwd }
|
|
@@ -14367,48 +14562,6 @@ function repoEnvironments(streams) {
|
|
|
14367
14562
|
);
|
|
14368
14563
|
}
|
|
14369
14564
|
|
|
14370
|
-
// src/commands/sessions/web/releases/ghJson.ts
|
|
14371
|
-
import { execFile as execFile8 } from "child_process";
|
|
14372
|
-
import { promisify as promisify8 } from "util";
|
|
14373
|
-
var execFileAsync7 = promisify8(execFile8);
|
|
14374
|
-
var CACHE_TTL_MS5 = 3e4;
|
|
14375
|
-
var cache5 = /* @__PURE__ */ new Map();
|
|
14376
|
-
function partialGraphqlData(error) {
|
|
14377
|
-
const stdout = error.stdout;
|
|
14378
|
-
if (typeof stdout !== "string") return null;
|
|
14379
|
-
try {
|
|
14380
|
-
const parsed = JSON.parse(stdout);
|
|
14381
|
-
return parsed?.data ? parsed : null;
|
|
14382
|
-
} catch {
|
|
14383
|
-
return null;
|
|
14384
|
-
}
|
|
14385
|
-
}
|
|
14386
|
-
async function runGh(cwd, args) {
|
|
14387
|
-
try {
|
|
14388
|
-
const { stdout } = await execFileAsync7("gh", args, {
|
|
14389
|
-
encoding: "utf8",
|
|
14390
|
-
windowsHide: true,
|
|
14391
|
-
cwd,
|
|
14392
|
-
maxBuffer: 16 * 1024 * 1024
|
|
14393
|
-
});
|
|
14394
|
-
return JSON.parse(stdout);
|
|
14395
|
-
} catch (error) {
|
|
14396
|
-
const partial = partialGraphqlData(error);
|
|
14397
|
-
if (partial) return partial;
|
|
14398
|
-
throw error;
|
|
14399
|
-
}
|
|
14400
|
-
}
|
|
14401
|
-
function ghJson(cwd, args) {
|
|
14402
|
-
const key = [cwd, ...args].join("\0");
|
|
14403
|
-
const hit = cache5.get(key);
|
|
14404
|
-
if (hit && Date.now() - hit.at < CACHE_TTL_MS5)
|
|
14405
|
-
return hit.result;
|
|
14406
|
-
const result = runGh(cwd, args);
|
|
14407
|
-
cache5.set(key, { at: Date.now(), result });
|
|
14408
|
-
result.catch(() => cache5.delete(key));
|
|
14409
|
-
return result;
|
|
14410
|
-
}
|
|
14411
|
-
|
|
14412
14565
|
// src/commands/sessions/web/releases/commitsBehind.ts
|
|
14413
14566
|
function compareQuery(shas) {
|
|
14414
14567
|
const compares = shas.map(
|
|
@@ -14548,7 +14701,7 @@ function deploymentsQuery(environments) {
|
|
|
14548
14701
|
}
|
|
14549
14702
|
|
|
14550
14703
|
// src/commands/sessions/web/releases/liveDeployments.ts
|
|
14551
|
-
function
|
|
14704
|
+
function headCommit2(node) {
|
|
14552
14705
|
return node?.oid ? releaseCommit(node.oid, node) : null;
|
|
14553
14706
|
}
|
|
14554
14707
|
function environmentNodes(repository, count8) {
|
|
@@ -14575,7 +14728,7 @@ async function liveDeployments(cwd, repo, environments) {
|
|
|
14575
14728
|
if (!repository) throw new Error(`Repository not readable: ${repo}`);
|
|
14576
14729
|
return {
|
|
14577
14730
|
defaultBranch: repository.defaultBranchRef?.name ?? null,
|
|
14578
|
-
head:
|
|
14731
|
+
head: headCommit2(repository.defaultBranchRef?.target),
|
|
14579
14732
|
...deploymentMaps(environmentNodes(repository, distinct.length))
|
|
14580
14733
|
};
|
|
14581
14734
|
}
|
|
@@ -14696,7 +14849,7 @@ async function streamRunState(cwd, stream) {
|
|
|
14696
14849
|
}
|
|
14697
14850
|
|
|
14698
14851
|
// src/commands/sessions/web/releases/streamState.ts
|
|
14699
|
-
function
|
|
14852
|
+
function errorMessage2(error) {
|
|
14700
14853
|
if (!(error instanceof Error)) return "Failed to read release state";
|
|
14701
14854
|
return error.message.trim().split("\n")[0] || "Failed to read release state";
|
|
14702
14855
|
}
|
|
@@ -14734,7 +14887,7 @@ async function streamState(cwd, stream, repoEnvironments2 = streamEnvironments(s
|
|
|
14734
14887
|
head: null,
|
|
14735
14888
|
nodes: [],
|
|
14736
14889
|
run: null,
|
|
14737
|
-
error:
|
|
14890
|
+
error: errorMessage2(error)
|
|
14738
14891
|
};
|
|
14739
14892
|
}
|
|
14740
14893
|
}
|
|
@@ -15977,6 +16130,7 @@ var routes2 = {
|
|
|
15977
16130
|
"GET /api/pr-status": prStatus,
|
|
15978
16131
|
"GET /api/server-runs": handleServerRuns,
|
|
15979
16132
|
"GET /api/pr-list": prList,
|
|
16133
|
+
"GET /api/next": nextItems,
|
|
15980
16134
|
"GET /api/news/items": listNewsItems,
|
|
15981
16135
|
"GET /api/news/nav": newsNavConfig,
|
|
15982
16136
|
"GET /api/releases/state": releasesState,
|
|
@@ -16936,6 +17090,52 @@ function tokenize(command) {
|
|
|
16936
17090
|
return tokens;
|
|
16937
17091
|
}
|
|
16938
17092
|
|
|
17093
|
+
// src/commands/cliHook/isGhGraphqlIssueMutation.ts
|
|
17094
|
+
import { readFileSync as readFileSync25 } from "fs";
|
|
17095
|
+
var ISSUE_MUTATION = /\bmutation\b[\s\S]*\b(?:createIssue|updateIssue|deleteIssue|closeIssue|reopenIssue|transferIssue|pinIssue|unpinIssue|addComment|updateIssueComment|deleteIssueComment|addSubIssue|removeSubIssue|reprioritizeSubIssue)\s*\(/;
|
|
17096
|
+
var FIELD_FLAGS = ["-f", "-F", "--field", "--raw-field"];
|
|
17097
|
+
function isGhGraphqlIssueMutation(args, command) {
|
|
17098
|
+
if (!args.some((arg) => unquote(arg) === "graphql")) return false;
|
|
17099
|
+
return querySources(args).some(
|
|
17100
|
+
(source) => ISSUE_MUTATION.test(readSourceOrCommandText(source, command))
|
|
17101
|
+
);
|
|
17102
|
+
}
|
|
17103
|
+
function querySources(args) {
|
|
17104
|
+
const sources = [];
|
|
17105
|
+
for (let i = 0; i < args.length; i++) {
|
|
17106
|
+
const value = flagValue(args, i);
|
|
17107
|
+
if (value === void 0) continue;
|
|
17108
|
+
if (args[i] === "--input") sources.push(`@${value}`);
|
|
17109
|
+
const query = /^query=([\s\S]*)$/.exec(value);
|
|
17110
|
+
if (query) sources.push(query[1]);
|
|
17111
|
+
}
|
|
17112
|
+
return sources;
|
|
17113
|
+
}
|
|
17114
|
+
function flagValue(args, i) {
|
|
17115
|
+
const arg = args[i];
|
|
17116
|
+
if (arg === "--input") return unquote(args[i + 1] ?? "");
|
|
17117
|
+
for (const flag of FIELD_FLAGS) {
|
|
17118
|
+
if (arg === flag) return unquote(args[i + 1] ?? "");
|
|
17119
|
+
if (arg.startsWith(`${flag}=`)) return unquote(arg.slice(flag.length + 1));
|
|
17120
|
+
if (flag.length === 2 && arg.length > 2 && arg.startsWith(flag))
|
|
17121
|
+
return unquote(arg.slice(2));
|
|
17122
|
+
}
|
|
17123
|
+
return void 0;
|
|
17124
|
+
}
|
|
17125
|
+
function readSourceOrCommandText(source, command) {
|
|
17126
|
+
if (!source.startsWith("@")) return source;
|
|
17127
|
+
const path106 = source.slice(1);
|
|
17128
|
+
if (path106 === "-") return command;
|
|
17129
|
+
try {
|
|
17130
|
+
return readFileSync25(path106, "utf8");
|
|
17131
|
+
} catch {
|
|
17132
|
+
return command;
|
|
17133
|
+
}
|
|
17134
|
+
}
|
|
17135
|
+
function unquote(value) {
|
|
17136
|
+
return value.replace(/['"]/g, "");
|
|
17137
|
+
}
|
|
17138
|
+
|
|
16939
17139
|
// src/commands/cliHook/isGhIssueApiWrite.ts
|
|
16940
17140
|
var WRITE_METHODS = /* @__PURE__ */ new Set(["POST", "PATCH", "PUT", "DELETE"]);
|
|
16941
17141
|
var BODY_FLAGS = ["-f", "-F", "--field", "--raw-field", "--input"];
|
|
@@ -16947,6 +17147,7 @@ function isGhIssueApiWrite(command) {
|
|
|
16947
17147
|
if (tokens[i] !== "gh" || tokens[i + 1] !== "api") continue;
|
|
16948
17148
|
const args = argsUntilNextCommand(tokens.slice(i + 2));
|
|
16949
17149
|
if (targetsIssueEndpoint(args) && isWrite(args)) return true;
|
|
17150
|
+
if (isGhGraphqlIssueMutation(args, command)) return true;
|
|
16950
17151
|
}
|
|
16951
17152
|
return false;
|
|
16952
17153
|
}
|
|
@@ -16959,7 +17160,7 @@ function targetsIssueEndpoint(args) {
|
|
|
16959
17160
|
}
|
|
16960
17161
|
function isWrite(args) {
|
|
16961
17162
|
const method = extractGhApiMethod(args);
|
|
16962
|
-
if (method) return WRITE_METHODS.has(
|
|
17163
|
+
if (method) return WRITE_METHODS.has(unquote2(method).toUpperCase());
|
|
16963
17164
|
return args.some(isBodyFlag);
|
|
16964
17165
|
}
|
|
16965
17166
|
function isBodyFlag(arg) {
|
|
@@ -16967,7 +17168,7 @@ function isBodyFlag(arg) {
|
|
|
16967
17168
|
(flag) => arg === flag || arg.startsWith(`${flag}=`) || flag.length === 2 && arg.length > 2 && arg.startsWith(flag)
|
|
16968
17169
|
);
|
|
16969
17170
|
}
|
|
16970
|
-
function
|
|
17171
|
+
function unquote2(value) {
|
|
16971
17172
|
return value.replace(/^['"]|['"]$/g, "");
|
|
16972
17173
|
}
|
|
16973
17174
|
|
|
@@ -17003,7 +17204,7 @@ var PATTERN_DENIES = [
|
|
|
17003
17204
|
enabled: () => loadConfig().cliHook?.blockNpmRun !== false
|
|
17004
17205
|
}
|
|
17005
17206
|
];
|
|
17006
|
-
var GH_ISSUE_API_MESSAGE = "Do not write to GitHub
|
|
17207
|
+
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.";
|
|
17007
17208
|
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.";
|
|
17008
17209
|
var COMMAND_BOUNDARY = String.raw`(?<=(?:^|[;&|(\n])\s*)`;
|
|
17009
17210
|
var BRANCH_CREATION_REGEXES = [
|
|
@@ -17203,7 +17404,7 @@ function configuresReleases(command) {
|
|
|
17203
17404
|
// src/shared/isGhApiRead.ts
|
|
17204
17405
|
var READ_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD"]);
|
|
17205
17406
|
var BODY_FLAGS2 = /* @__PURE__ */ new Set(["-f", "-F", "--field", "--raw-field", "--input"]);
|
|
17206
|
-
var
|
|
17407
|
+
var FIELD_FLAGS2 = /* @__PURE__ */ new Set(["-f", "--field", "-F"]);
|
|
17207
17408
|
function isGhApiRead(command) {
|
|
17208
17409
|
const tokens = tokenize(command);
|
|
17209
17410
|
if (tokens.length < 2 || tokens[0] !== "gh" || tokens[1] !== "api") {
|
|
@@ -17230,7 +17431,7 @@ function isGraphqlRead(args) {
|
|
|
17230
17431
|
}
|
|
17231
17432
|
function extractGraphqlQuery(args) {
|
|
17232
17433
|
for (let i = 0; i < args.length; i++) {
|
|
17233
|
-
if (
|
|
17434
|
+
if (FIELD_FLAGS2.has(args[i]) && i + 1 < args.length) {
|
|
17234
17435
|
const match = args[i + 1].match(/^query=(.*)/s);
|
|
17235
17436
|
if (match) return match[1];
|
|
17236
17437
|
}
|
|
@@ -17239,7 +17440,7 @@ function extractGraphqlQuery(args) {
|
|
|
17239
17440
|
}
|
|
17240
17441
|
|
|
17241
17442
|
// src/shared/loadCliReads.ts
|
|
17242
|
-
import { existsSync as existsSync40, readFileSync as
|
|
17443
|
+
import { existsSync as existsSync40, readFileSync as readFileSync26, writeFileSync as writeFileSync22 } from "fs";
|
|
17243
17444
|
import { dirname as dirname25, resolve as resolve13 } from "path";
|
|
17244
17445
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
17245
17446
|
var __filename3 = fileURLToPath5(import.meta.url);
|
|
@@ -17249,7 +17450,7 @@ function packageRoot() {
|
|
|
17249
17450
|
}
|
|
17250
17451
|
function readLines(path106) {
|
|
17251
17452
|
if (!existsSync40(path106)) return [];
|
|
17252
|
-
return
|
|
17453
|
+
return readFileSync26(path106, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
17253
17454
|
}
|
|
17254
17455
|
var cachedReads;
|
|
17255
17456
|
var cachedWrites;
|
|
@@ -17295,7 +17496,7 @@ function findCliWrite(command) {
|
|
|
17295
17496
|
}
|
|
17296
17497
|
|
|
17297
17498
|
// src/shared/readSettingsPerms.ts
|
|
17298
|
-
import { existsSync as existsSync41, readFileSync as
|
|
17499
|
+
import { existsSync as existsSync41, readFileSync as readFileSync27 } from "fs";
|
|
17299
17500
|
import { homedir as homedir15 } from "os";
|
|
17300
17501
|
import { join as join41 } from "path";
|
|
17301
17502
|
function readSettingsPerms(key) {
|
|
@@ -17313,7 +17514,7 @@ function readSettingsPerms(key) {
|
|
|
17313
17514
|
function readPermissionArray(filePath, key) {
|
|
17314
17515
|
if (!existsSync41(filePath)) return [];
|
|
17315
17516
|
try {
|
|
17316
|
-
const data = JSON.parse(
|
|
17517
|
+
const data = JSON.parse(readFileSync27(filePath, "utf8"));
|
|
17317
17518
|
const arr = data?.permissions?.[key];
|
|
17318
17519
|
return Array.isArray(arr) ? arr.filter((e) => typeof e === "string") : [];
|
|
17319
17520
|
} catch {
|
|
@@ -17668,7 +17869,7 @@ ${reasons.join("\n")}`);
|
|
|
17668
17869
|
}
|
|
17669
17870
|
|
|
17670
17871
|
// src/commands/permitCliReads.ts
|
|
17671
|
-
import { existsSync as existsSync42, mkdirSync as mkdirSync13, readFileSync as
|
|
17872
|
+
import { existsSync as existsSync42, mkdirSync as mkdirSync13, readFileSync as readFileSync28, writeFileSync as writeFileSync23 } from "fs";
|
|
17672
17873
|
import { homedir as homedir17 } from "os";
|
|
17673
17874
|
import { join as join43 } from "path";
|
|
17674
17875
|
|
|
@@ -17938,7 +18139,7 @@ function logPath(cli) {
|
|
|
17938
18139
|
function readCache(cli) {
|
|
17939
18140
|
const path106 = logPath(cli);
|
|
17940
18141
|
if (!existsSync42(path106)) return void 0;
|
|
17941
|
-
return
|
|
18142
|
+
return readFileSync28(path106, "utf8");
|
|
17942
18143
|
}
|
|
17943
18144
|
function writeCache(cli, output) {
|
|
17944
18145
|
const dir = join43(homedir17(), ".assist");
|
|
@@ -18072,7 +18273,7 @@ function registerCliHook(program2) {
|
|
|
18072
18273
|
}
|
|
18073
18274
|
|
|
18074
18275
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
18075
|
-
import { existsSync as existsSync44, readFileSync as
|
|
18276
|
+
import { existsSync as existsSync44, readFileSync as readFileSync30, unlinkSync as unlinkSync8, writeFileSync as writeFileSync24 } from "fs";
|
|
18076
18277
|
import chalk119 from "chalk";
|
|
18077
18278
|
|
|
18078
18279
|
// src/shared/isHashCommentFile.ts
|
|
@@ -18137,12 +18338,12 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
18137
18338
|
}
|
|
18138
18339
|
|
|
18139
18340
|
// src/commands/codeComment/readPinState.ts
|
|
18140
|
-
import { existsSync as existsSync43, readFileSync as
|
|
18341
|
+
import { existsSync as existsSync43, readFileSync as readFileSync29 } from "fs";
|
|
18141
18342
|
function readPinState(pin2) {
|
|
18142
18343
|
const path106 = getPinStatePath(pin2);
|
|
18143
18344
|
if (!existsSync43(path106)) return void 0;
|
|
18144
18345
|
try {
|
|
18145
|
-
const state = JSON.parse(
|
|
18346
|
+
const state = JSON.parse(readFileSync29(path106, "utf8"));
|
|
18146
18347
|
if (state.pin !== pin2) return void 0;
|
|
18147
18348
|
return state;
|
|
18148
18349
|
} catch {
|
|
@@ -18164,7 +18365,7 @@ function codeCommentConfirm(pin2) {
|
|
|
18164
18365
|
process.exitCode = 1;
|
|
18165
18366
|
return;
|
|
18166
18367
|
}
|
|
18167
|
-
const original =
|
|
18368
|
+
const original = readFileSync30(state.file, "utf8");
|
|
18168
18369
|
const lines2 = original.split("\n");
|
|
18169
18370
|
const index3 = state.line - 1;
|
|
18170
18371
|
if (index3 > lines2.length) {
|
|
@@ -20039,12 +20240,12 @@ function getMigrationApprovalPath(migrationId) {
|
|
|
20039
20240
|
}
|
|
20040
20241
|
|
|
20041
20242
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
20042
|
-
import { existsSync as existsSync48, readFileSync as
|
|
20243
|
+
import { existsSync as existsSync48, readFileSync as readFileSync31 } from "fs";
|
|
20043
20244
|
function readMigrationPinState(pin2) {
|
|
20044
20245
|
const path106 = getMigrationPinPath(pin2);
|
|
20045
20246
|
if (!existsSync48(path106)) return void 0;
|
|
20046
20247
|
try {
|
|
20047
|
-
const state = JSON.parse(
|
|
20248
|
+
const state = JSON.parse(readFileSync31(path106, "utf8"));
|
|
20048
20249
|
if (state.pin !== pin2) return void 0;
|
|
20049
20250
|
if (!Number.isInteger(state.migrationId)) return void 0;
|
|
20050
20251
|
return state;
|
|
@@ -20131,7 +20332,7 @@ function registerDbMigration(parent) {
|
|
|
20131
20332
|
}
|
|
20132
20333
|
|
|
20133
20334
|
// src/commands/deploy/redirect.ts
|
|
20134
|
-
import { existsSync as existsSync49, readFileSync as
|
|
20335
|
+
import { existsSync as existsSync49, readFileSync as readFileSync32, writeFileSync as writeFileSync28 } from "fs";
|
|
20135
20336
|
import chalk143 from "chalk";
|
|
20136
20337
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
20137
20338
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -20144,7 +20345,7 @@ function redirect() {
|
|
|
20144
20345
|
console.log(chalk143.yellow("No index.html found"));
|
|
20145
20346
|
return;
|
|
20146
20347
|
}
|
|
20147
|
-
const content =
|
|
20348
|
+
const content = readFileSync32(indexPath, "utf8");
|
|
20148
20349
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
20149
20350
|
console.log(chalk143.dim("Trailing slash script already present"));
|
|
20150
20351
|
return;
|
|
@@ -20187,7 +20388,7 @@ import { execSync as execSync31 } from "child_process";
|
|
|
20187
20388
|
import chalk144 from "chalk";
|
|
20188
20389
|
|
|
20189
20390
|
// src/shared/getRepoName.ts
|
|
20190
|
-
import { existsSync as existsSync50, readFileSync as
|
|
20391
|
+
import { existsSync as existsSync50, readFileSync as readFileSync33 } from "fs";
|
|
20191
20392
|
import { basename as basename13, join as join54 } from "path";
|
|
20192
20393
|
function getRepoName() {
|
|
20193
20394
|
const config = loadConfig();
|
|
@@ -20197,7 +20398,7 @@ function getRepoName() {
|
|
|
20197
20398
|
const packageJsonPath = join54(process.cwd(), "package.json");
|
|
20198
20399
|
if (existsSync50(packageJsonPath)) {
|
|
20199
20400
|
try {
|
|
20200
|
-
const content =
|
|
20401
|
+
const content = readFileSync33(packageJsonPath, "utf8");
|
|
20201
20402
|
const pkg = JSON.parse(content);
|
|
20202
20403
|
if (pkg.name) {
|
|
20203
20404
|
return pkg.name;
|
|
@@ -20209,7 +20410,7 @@ function getRepoName() {
|
|
|
20209
20410
|
}
|
|
20210
20411
|
|
|
20211
20412
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
20212
|
-
import { readdirSync as readdirSync6, readFileSync as
|
|
20413
|
+
import { readdirSync as readdirSync6, readFileSync as readFileSync34 } from "fs";
|
|
20213
20414
|
import { join as join55 } from "path";
|
|
20214
20415
|
var DEVLOG_DIR = join55(BLOG_REPO_ROOT, "src/content/devlog");
|
|
20215
20416
|
function extractFrontmatter(content) {
|
|
@@ -20239,7 +20440,7 @@ function readDevlogFiles(callback) {
|
|
|
20239
20440
|
try {
|
|
20240
20441
|
const files = readdirSync6(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
20241
20442
|
for (const file of files) {
|
|
20242
|
-
const content =
|
|
20443
|
+
const content = readFileSync34(join55(DEVLOG_DIR, file), "utf8");
|
|
20243
20444
|
const parsed = parseFrontmatter(content, file);
|
|
20244
20445
|
if (parsed) callback(parsed);
|
|
20245
20446
|
}
|
|
@@ -20752,11 +20953,11 @@ async function checkBuildLocksCommand() {
|
|
|
20752
20953
|
}
|
|
20753
20954
|
|
|
20754
20955
|
// src/commands/dotnet/buildTree.ts
|
|
20755
|
-
import { readFileSync as
|
|
20956
|
+
import { readFileSync as readFileSync35 } from "fs";
|
|
20756
20957
|
import path34 from "path";
|
|
20757
20958
|
var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
20758
20959
|
function getProjectRefs(csprojPath) {
|
|
20759
|
-
const content =
|
|
20960
|
+
const content = readFileSync35(csprojPath, "utf8");
|
|
20760
20961
|
const refs = [];
|
|
20761
20962
|
for (const match of content.matchAll(PROJECT_REF_RE)) {
|
|
20762
20963
|
refs.push(match[1].replace(/\\/g, "/"));
|
|
@@ -20773,7 +20974,7 @@ function buildTree(csprojPath, repoRoot2, visited = /* @__PURE__ */ new Set()) {
|
|
|
20773
20974
|
for (const ref of getProjectRefs(abs)) {
|
|
20774
20975
|
const childAbs = path34.resolve(dir, ref);
|
|
20775
20976
|
try {
|
|
20776
|
-
|
|
20977
|
+
readFileSync35(childAbs);
|
|
20777
20978
|
node.children.push(buildTree(childAbs, repoRoot2, visited));
|
|
20778
20979
|
} catch {
|
|
20779
20980
|
node.children.push({
|
|
@@ -20798,7 +20999,7 @@ function collectAllDeps(node) {
|
|
|
20798
20999
|
}
|
|
20799
21000
|
|
|
20800
21001
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
20801
|
-
import { readdirSync as readdirSync8, readFileSync as
|
|
21002
|
+
import { readdirSync as readdirSync8, readFileSync as readFileSync36, statSync as statSync8 } from "fs";
|
|
20802
21003
|
import path35 from "path";
|
|
20803
21004
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
20804
21005
|
if (depth > maxDepth) return [];
|
|
@@ -20833,7 +21034,7 @@ function findContainingSolutions(csprojPath, repoRoot2) {
|
|
|
20833
21034
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
20834
21035
|
for (const sln of slnFiles) {
|
|
20835
21036
|
try {
|
|
20836
|
-
const content =
|
|
21037
|
+
const content = readFileSync36(sln, "utf8");
|
|
20837
21038
|
if (pattern2.test(content)) {
|
|
20838
21039
|
matches.push(path35.relative(repoRoot2, sln));
|
|
20839
21040
|
}
|
|
@@ -21151,7 +21352,7 @@ function parseInspectReport(json) {
|
|
|
21151
21352
|
|
|
21152
21353
|
// src/commands/dotnet/runInspectCode.ts
|
|
21153
21354
|
import { execSync as execSync35 } from "child_process";
|
|
21154
|
-
import { existsSync as existsSync53, readFileSync as
|
|
21355
|
+
import { existsSync as existsSync53, readFileSync as readFileSync37, unlinkSync as unlinkSync10 } from "fs";
|
|
21155
21356
|
import { tmpdir as tmpdir5 } from "os";
|
|
21156
21357
|
import path38 from "path";
|
|
21157
21358
|
import chalk158 from "chalk";
|
|
@@ -21186,7 +21387,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
21186
21387
|
console.error(chalk158.red("Report file not generated"));
|
|
21187
21388
|
process.exit(1);
|
|
21188
21389
|
}
|
|
21189
|
-
const xml =
|
|
21390
|
+
const xml = readFileSync37(reportPath, "utf8");
|
|
21190
21391
|
unlinkSync10(reportPath);
|
|
21191
21392
|
return xml;
|
|
21192
21393
|
}
|
|
@@ -23486,7 +23687,7 @@ function fetchIssue2(number, repo) {
|
|
|
23486
23687
|
}
|
|
23487
23688
|
|
|
23488
23689
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
23489
|
-
import { existsSync as existsSync55, readFileSync as
|
|
23690
|
+
import { existsSync as existsSync55, readFileSync as readFileSync38 } from "fs";
|
|
23490
23691
|
|
|
23491
23692
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
23492
23693
|
import { join as join60 } from "path";
|
|
@@ -23505,9 +23706,9 @@ function resumeIssueBody(slug2, number, updatedAt) {
|
|
|
23505
23706
|
const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
23506
23707
|
if (!existsSync55(bodyPath) || !existsSync55(metaPath)) return void 0;
|
|
23507
23708
|
try {
|
|
23508
|
-
const meta = JSON.parse(
|
|
23709
|
+
const meta = JSON.parse(readFileSync38(metaPath, "utf8"));
|
|
23509
23710
|
if (meta.updatedAt !== updatedAt) return void 0;
|
|
23510
|
-
return
|
|
23711
|
+
return readFileSync38(bodyPath, "utf8");
|
|
23511
23712
|
} catch {
|
|
23512
23713
|
return void 0;
|
|
23513
23714
|
}
|
|
@@ -23933,7 +24134,7 @@ async function countPendingHandovers(orm, origin) {
|
|
|
23933
24134
|
import {
|
|
23934
24135
|
existsSync as existsSync56,
|
|
23935
24136
|
readdirSync as readdirSync10,
|
|
23936
|
-
readFileSync as
|
|
24137
|
+
readFileSync as readFileSync39,
|
|
23937
24138
|
rmSync as rmSync3,
|
|
23938
24139
|
statSync as statSync9
|
|
23939
24140
|
} from "fs";
|
|
@@ -23996,7 +24197,7 @@ function collectMarkdown(dir) {
|
|
|
23996
24197
|
return out;
|
|
23997
24198
|
}
|
|
23998
24199
|
async function migrateFile(orm, origin, file, createdAt) {
|
|
23999
|
-
const content =
|
|
24200
|
+
const content = readFileSync39(file, "utf8");
|
|
24000
24201
|
await saveHandover(orm, {
|
|
24001
24202
|
origin,
|
|
24002
24203
|
summary: summariseHandoverContent(content),
|
|
@@ -25216,7 +25417,7 @@ import { resolve as resolve18 } from "path";
|
|
|
25216
25417
|
import chalk173 from "chalk";
|
|
25217
25418
|
|
|
25218
25419
|
// src/commands/mermaid/exportFile.ts
|
|
25219
|
-
import { readFileSync as
|
|
25420
|
+
import { readFileSync as readFileSync40, writeFileSync as writeFileSync32 } from "fs";
|
|
25220
25421
|
import { basename as basename18, extname as extname2, resolve as resolve17 } from "path";
|
|
25221
25422
|
import chalk172 from "chalk";
|
|
25222
25423
|
|
|
@@ -25242,7 +25443,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
25242
25443
|
|
|
25243
25444
|
// src/commands/mermaid/exportFile.ts
|
|
25244
25445
|
async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
25245
|
-
const content =
|
|
25446
|
+
const content = readFileSync40(file, "utf8");
|
|
25246
25447
|
const blocks = extractMermaidBlocks(content);
|
|
25247
25448
|
const stem = basename18(file, extname2(file));
|
|
25248
25449
|
if (onlyIndex !== void 0) {
|
|
@@ -25454,14 +25655,14 @@ function applyIgnore(texts, ignore3) {
|
|
|
25454
25655
|
}
|
|
25455
25656
|
|
|
25456
25657
|
// src/commands/miro/readIgnoreList.ts
|
|
25457
|
-
import { existsSync as existsSync61, readFileSync as
|
|
25658
|
+
import { existsSync as existsSync61, readFileSync as readFileSync41 } from "fs";
|
|
25458
25659
|
import { parse as parse2 } from "yaml";
|
|
25459
25660
|
function readIgnoreList(file) {
|
|
25460
25661
|
if (!existsSync61(file))
|
|
25461
25662
|
throw new MiroExtractError(
|
|
25462
25663
|
`No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
|
|
25463
25664
|
);
|
|
25464
|
-
const parsed = parse2(
|
|
25665
|
+
const parsed = parse2(readFileSync41(file, "utf8"));
|
|
25465
25666
|
if (parsed === null || parsed === void 0) return [];
|
|
25466
25667
|
if (!Array.isArray(parsed) || parsed.some((entry) => typeof entry !== "string"))
|
|
25467
25668
|
throw new MiroExtractError(
|
|
@@ -25643,7 +25844,7 @@ async function pickAnchors(sessionId, items2) {
|
|
|
25643
25844
|
}
|
|
25644
25845
|
|
|
25645
25846
|
// src/commands/miro/readMiroItems.ts
|
|
25646
|
-
import { readFileSync as
|
|
25847
|
+
import { readFileSync as readFileSync42 } from "fs";
|
|
25647
25848
|
function tryParse(text18) {
|
|
25648
25849
|
try {
|
|
25649
25850
|
return JSON.parse(text18);
|
|
@@ -25672,7 +25873,7 @@ function parsePages(raw, file) {
|
|
|
25672
25873
|
return Array.isArray(parsed) ? parsed.map(toPage) : [toPage(parsed)];
|
|
25673
25874
|
}
|
|
25674
25875
|
function readMiroItems(file) {
|
|
25675
|
-
const items2 = parsePages(
|
|
25876
|
+
const items2 = parsePages(readFileSync42(file, "utf8"), file).flatMap(
|
|
25676
25877
|
(page) => page.data ?? []
|
|
25677
25878
|
);
|
|
25678
25879
|
if (items2.length === 0)
|
|
@@ -26068,7 +26269,7 @@ import { join as join71 } from "path";
|
|
|
26068
26269
|
import chalk178 from "chalk";
|
|
26069
26270
|
|
|
26070
26271
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
26071
|
-
import { readFileSync as
|
|
26272
|
+
import { readFileSync as readFileSync43 } from "fs";
|
|
26072
26273
|
|
|
26073
26274
|
// src/commands/netcap/parseRscRows.ts
|
|
26074
26275
|
var isRscRef = (v) => typeof v === "string" && /^\$[0-9a-fL@]/.test(v);
|
|
@@ -26464,7 +26665,7 @@ function extractVoyagerPosts(body) {
|
|
|
26464
26665
|
|
|
26465
26666
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
26466
26667
|
function captureEntries(captureFile) {
|
|
26467
|
-
const lines2 =
|
|
26668
|
+
const lines2 = readFileSync43(captureFile, "utf8").split("\n").filter(Boolean);
|
|
26468
26669
|
const entries = [];
|
|
26469
26670
|
for (const line of lines2) {
|
|
26470
26671
|
let entry;
|
|
@@ -26875,7 +27076,7 @@ import { tmpdir as tmpdir7 } from "os";
|
|
|
26875
27076
|
import { join as join73 } from "path";
|
|
26876
27077
|
|
|
26877
27078
|
// src/commands/prs/loadCommentsCache.ts
|
|
26878
|
-
import { existsSync as existsSync62, readFileSync as
|
|
27079
|
+
import { existsSync as existsSync62, readFileSync as readFileSync44, unlinkSync as unlinkSync13 } from "fs";
|
|
26879
27080
|
import { parse as parse3 } from "yaml";
|
|
26880
27081
|
|
|
26881
27082
|
// src/commands/prs/commentsCachePath.ts
|
|
@@ -26898,7 +27099,7 @@ function loadCommentsCache(org, repo, prNumber) {
|
|
|
26898
27099
|
if (!existsSync62(cachePath)) {
|
|
26899
27100
|
return null;
|
|
26900
27101
|
}
|
|
26901
|
-
const content =
|
|
27102
|
+
const content = readFileSync44(cachePath, "utf8");
|
|
26902
27103
|
return parse3(content);
|
|
26903
27104
|
}
|
|
26904
27105
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
@@ -27512,9 +27713,9 @@ function parsePrBody(body) {
|
|
|
27512
27713
|
return sections;
|
|
27513
27714
|
}
|
|
27514
27715
|
function serializePrBody(sections) {
|
|
27515
|
-
return sections.map((
|
|
27716
|
+
return sections.map((section3) => `## ${section3.heading}
|
|
27516
27717
|
|
|
27517
|
-
${
|
|
27718
|
+
${section3.content}`).join("\n\n");
|
|
27518
27719
|
}
|
|
27519
27720
|
|
|
27520
27721
|
// src/commands/prs/editPrBody.ts
|
|
@@ -27563,11 +27764,11 @@ function findWallOfText(body) {
|
|
|
27563
27764
|
}
|
|
27564
27765
|
function splitParagraphs(body) {
|
|
27565
27766
|
const paragraphs = [];
|
|
27566
|
-
let
|
|
27767
|
+
let section3 = "(intro)";
|
|
27567
27768
|
let lines2 = [];
|
|
27568
27769
|
const flush = () => {
|
|
27569
27770
|
if (lines2.length > 0) {
|
|
27570
|
-
paragraphs.push({ section:
|
|
27771
|
+
paragraphs.push({ section: section3, lines: lines2 });
|
|
27571
27772
|
lines2 = [];
|
|
27572
27773
|
}
|
|
27573
27774
|
};
|
|
@@ -27575,7 +27776,7 @@ function splitParagraphs(body) {
|
|
|
27575
27776
|
const heading2 = line.match(/^#{1,6}\s+(.*)$/);
|
|
27576
27777
|
if (heading2) {
|
|
27577
27778
|
flush();
|
|
27578
|
-
|
|
27779
|
+
section3 = heading2[1].trim();
|
|
27579
27780
|
} else if (line.trim() === "") {
|
|
27580
27781
|
flush();
|
|
27581
27782
|
} else {
|
|
@@ -28487,7 +28688,7 @@ function registerPrsStatus(prsCommand) {
|
|
|
28487
28688
|
}
|
|
28488
28689
|
|
|
28489
28690
|
// src/commands/readTime/readTime.ts
|
|
28490
|
-
import { readFileSync as
|
|
28691
|
+
import { readFileSync as readFileSync45 } from "fs";
|
|
28491
28692
|
|
|
28492
28693
|
// src/commands/readTime/countReadingWords.ts
|
|
28493
28694
|
var FENCE_PATTERN = /^\s*(```|~~~)/;
|
|
@@ -28648,7 +28849,7 @@ async function loadBody(target) {
|
|
|
28648
28849
|
}
|
|
28649
28850
|
function readDraftFile(path106) {
|
|
28650
28851
|
try {
|
|
28651
|
-
return
|
|
28852
|
+
return readFileSync45(path106, "utf8");
|
|
28652
28853
|
} catch {
|
|
28653
28854
|
console.error(`Error: Could not read \`${path106}\`.`);
|
|
28654
28855
|
console.error(
|
|
@@ -29146,10 +29347,10 @@ function checkStreamGraph(streams) {
|
|
|
29146
29347
|
}
|
|
29147
29348
|
|
|
29148
29349
|
// src/commands/releases/readStreamsInput.ts
|
|
29149
|
-
import { readFileSync as
|
|
29350
|
+
import { readFileSync as readFileSync46 } from "fs";
|
|
29150
29351
|
import { parse as parse4 } from "yaml";
|
|
29151
29352
|
function readSource2(source) {
|
|
29152
|
-
return
|
|
29353
|
+
return readFileSync46(source === "-" ? 0 : source, "utf8");
|
|
29153
29354
|
}
|
|
29154
29355
|
function readStreamsInput(source) {
|
|
29155
29356
|
let parsed;
|
|
@@ -29586,12 +29787,12 @@ import fs27 from "fs";
|
|
|
29586
29787
|
|
|
29587
29788
|
// src/commands/lint/shared.ts
|
|
29588
29789
|
import chalk202 from "chalk";
|
|
29589
|
-
function reportViolations2(violations, checkName2,
|
|
29790
|
+
function reportViolations2(violations, checkName2, errorMessage3, successMessage) {
|
|
29590
29791
|
if (violations.length > 0) {
|
|
29591
29792
|
console.error(chalk202.red(`
|
|
29592
29793
|
${checkName2} failed:
|
|
29593
29794
|
`));
|
|
29594
|
-
console.error(chalk202.red(` ${
|
|
29795
|
+
console.error(chalk202.red(` ${errorMessage3}
|
|
29595
29796
|
`));
|
|
29596
29797
|
for (const violation of violations) {
|
|
29597
29798
|
console.error(chalk202.red(` ${violation.filePath}:${violation.line}`));
|
|
@@ -29976,7 +30177,7 @@ function buildLimitsSegment(rateLimits) {
|
|
|
29976
30177
|
}
|
|
29977
30178
|
|
|
29978
30179
|
// src/commands/readGitBranch.ts
|
|
29979
|
-
import { readFileSync as
|
|
30180
|
+
import { readFileSync as readFileSync47, statSync as statSync10 } from "fs";
|
|
29980
30181
|
import { isAbsolute as isAbsolute5, join as join77, resolve as resolve22 } from "path";
|
|
29981
30182
|
function resolveGitDir(cwd) {
|
|
29982
30183
|
const dotGit = join77(cwd, ".git");
|
|
@@ -29991,7 +30192,7 @@ function resolveGitDir(cwd) {
|
|
|
29991
30192
|
}
|
|
29992
30193
|
let contents;
|
|
29993
30194
|
try {
|
|
29994
|
-
contents =
|
|
30195
|
+
contents = readFileSync47(dotGit, "utf8");
|
|
29995
30196
|
} catch {
|
|
29996
30197
|
return null;
|
|
29997
30198
|
}
|
|
@@ -30009,7 +30210,7 @@ function readGitBranch(cwd) {
|
|
|
30009
30210
|
}
|
|
30010
30211
|
let head;
|
|
30011
30212
|
try {
|
|
30012
|
-
head =
|
|
30213
|
+
head = readFileSync47(join77(gitDir, "HEAD"), "utf8");
|
|
30013
30214
|
} catch {
|
|
30014
30215
|
return null;
|
|
30015
30216
|
}
|
|
@@ -30977,13 +31178,13 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
30977
31178
|
// src/commands/refactor/extract/displayPlan.ts
|
|
30978
31179
|
import path50 from "path";
|
|
30979
31180
|
import chalk207 from "chalk";
|
|
30980
|
-
function
|
|
31181
|
+
function section2(title) {
|
|
30981
31182
|
return `
|
|
30982
31183
|
${chalk207.cyan(title)}`;
|
|
30983
31184
|
}
|
|
30984
31185
|
function displayImporters(plan2, cwd) {
|
|
30985
31186
|
if (plan2.importersToUpdate.length === 0) return;
|
|
30986
|
-
console.log(
|
|
31187
|
+
console.log(section2("Update importers:"));
|
|
30987
31188
|
for (const imp of plan2.importersToUpdate) {
|
|
30988
31189
|
const rel = path50.relative(cwd, imp.file.getFilePath());
|
|
30989
31190
|
console.log(` ${chalk207.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
@@ -30997,18 +31198,18 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
30997
31198
|
console.log(` ${name}`);
|
|
30998
31199
|
}
|
|
30999
31200
|
if (plan2.imports.length > 0) {
|
|
31000
|
-
console.log(
|
|
31201
|
+
console.log(section2("Imports to copy:"));
|
|
31001
31202
|
for (const imp of plan2.imports) {
|
|
31002
31203
|
console.log(` ${formatImportLine(imp)}`);
|
|
31003
31204
|
}
|
|
31004
31205
|
}
|
|
31005
31206
|
if (plan2.exportedDeps.length > 0) {
|
|
31006
|
-
console.log(
|
|
31207
|
+
console.log(section2("New imports from source:"));
|
|
31007
31208
|
console.log(
|
|
31008
31209
|
` import { ${plan2.exportedDeps.join(", ")} } from "${plan2.sourceRelPath}";`
|
|
31009
31210
|
);
|
|
31010
31211
|
}
|
|
31011
|
-
console.log(
|
|
31212
|
+
console.log(section2("Source file changes:"));
|
|
31012
31213
|
console.log(` Remove: ${plan2.extractedNames.join(", ")}`);
|
|
31013
31214
|
if (plan2.sourceNeedsReimport) {
|
|
31014
31215
|
console.log(
|
|
@@ -31017,7 +31218,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
31017
31218
|
}
|
|
31018
31219
|
displayImporters(plan2, cwd);
|
|
31019
31220
|
if (plan2.barrel) {
|
|
31020
|
-
console.log(
|
|
31221
|
+
console.log(section2("Barrel export:"));
|
|
31021
31222
|
console.log(
|
|
31022
31223
|
` Add: export { ${functionName} } from "${plan2.barrelRelPath}";`
|
|
31023
31224
|
);
|
|
@@ -32775,10 +32976,10 @@ function checkDescriptionLinksIssue(body) {
|
|
|
32775
32976
|
|
|
32776
32977
|
// src/commands/review/highLevel/checkDescriptionSections.ts
|
|
32777
32978
|
function sectionContent(body, heading2) {
|
|
32778
|
-
const
|
|
32979
|
+
const section3 = parsePrBody(body).find(
|
|
32779
32980
|
(candidate) => candidate.heading.trim().toLowerCase() === heading2
|
|
32780
32981
|
);
|
|
32781
|
-
return
|
|
32982
|
+
return section3 ? section3.content.trim() : null;
|
|
32782
32983
|
}
|
|
32783
32984
|
function describe5(heading2, content) {
|
|
32784
32985
|
if (content === null) return `no \`## ${heading2}\` section`;
|
|
@@ -32965,7 +33166,7 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
32965
33166
|
}
|
|
32966
33167
|
|
|
32967
33168
|
// src/commands/review/highLevel/loadHighLevelReview.ts
|
|
32968
|
-
import { existsSync as existsSync64, readFileSync as
|
|
33169
|
+
import { existsSync as existsSync64, readFileSync as readFileSync48 } from "fs";
|
|
32969
33170
|
|
|
32970
33171
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
32971
33172
|
import { join as join78 } from "path";
|
|
@@ -32986,7 +33187,7 @@ function loadHighLevelReview(repo, headRef, headSha) {
|
|
|
32986
33187
|
const path106 = highLevelReviewPath(repo, headRef, headSha);
|
|
32987
33188
|
if (!existsSync64(path106)) return void 0;
|
|
32988
33189
|
try {
|
|
32989
|
-
return JSON.parse(
|
|
33190
|
+
return JSON.parse(readFileSync48(path106, "utf8"));
|
|
32990
33191
|
} catch {
|
|
32991
33192
|
return void 0;
|
|
32992
33193
|
}
|
|
@@ -33564,7 +33765,7 @@ function gatherContext() {
|
|
|
33564
33765
|
}
|
|
33565
33766
|
|
|
33566
33767
|
// src/commands/review/postReviewToPr.ts
|
|
33567
|
-
import { readFileSync as
|
|
33768
|
+
import { readFileSync as readFileSync49 } from "fs";
|
|
33568
33769
|
|
|
33569
33770
|
// src/commands/review/carriedUnanchoredFindings.ts
|
|
33570
33771
|
function carriedUnanchoredFindings(unanchored) {
|
|
@@ -34015,7 +34216,7 @@ async function confirmPost(prNumber, work, options2) {
|
|
|
34015
34216
|
return promptConfirm(`Post ${work} to PR #${prNumber}?`, false);
|
|
34016
34217
|
}
|
|
34017
34218
|
async function postFindingsToPr(prInfo, synthesisPath, options2) {
|
|
34018
|
-
const markdown =
|
|
34219
|
+
const markdown = readFileSync49(synthesisPath, "utf8");
|
|
34019
34220
|
const { inDiff, unanchored } = selectPostableFindings(markdown, prInfo);
|
|
34020
34221
|
const carried = carriedUnanchoredFindings(unanchored);
|
|
34021
34222
|
if (inDiff.length === 0 && carried.length === 0) return NOTHING_POSTED;
|
|
@@ -35013,7 +35214,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
|
|
|
35013
35214
|
}
|
|
35014
35215
|
|
|
35015
35216
|
// src/commands/review/synthesise.ts
|
|
35016
|
-
import { readFileSync as
|
|
35217
|
+
import { readFileSync as readFileSync50 } from "fs";
|
|
35017
35218
|
|
|
35018
35219
|
// src/commands/review/buildSynthesisStdin.ts
|
|
35019
35220
|
var SYNTHESIS_PROMPT = `You are consolidating two independent code reviews of the same change. The original review request is in request.md. The two reviews are in claude.md and codex.md in the current working directory.
|
|
@@ -35078,7 +35279,7 @@ Files:
|
|
|
35078
35279
|
|
|
35079
35280
|
// src/commands/review/synthesise.ts
|
|
35080
35281
|
function printSummary2(synthesisPath) {
|
|
35081
|
-
const markdown =
|
|
35282
|
+
const markdown = readFileSync50(synthesisPath, "utf8");
|
|
35082
35283
|
console.log("");
|
|
35083
35284
|
console.log(buildReviewSummary(markdown));
|
|
35084
35285
|
console.log("");
|
|
@@ -35391,7 +35592,7 @@ function registerReview(program2) {
|
|
|
35391
35592
|
}
|
|
35392
35593
|
|
|
35393
35594
|
// src/commands/rules/addRule.ts
|
|
35394
|
-
import { existsSync as existsSync70, readFileSync as
|
|
35595
|
+
import { existsSync as existsSync70, readFileSync as readFileSync54, writeFileSync as writeFileSync43 } from "fs";
|
|
35395
35596
|
import path85 from "path";
|
|
35396
35597
|
import chalk235 from "chalk";
|
|
35397
35598
|
|
|
@@ -35416,7 +35617,7 @@ function insertRuleBullet(content, rule) {
|
|
|
35416
35617
|
}
|
|
35417
35618
|
|
|
35418
35619
|
// src/commands/rules/nextRuleCode.ts
|
|
35419
|
-
import { readFileSync as
|
|
35620
|
+
import { readFileSync as readFileSync51 } from "fs";
|
|
35420
35621
|
|
|
35421
35622
|
// src/commands/rules/findClaudeFiles.ts
|
|
35422
35623
|
import { readdirSync as readdirSync13 } from "fs";
|
|
@@ -35440,7 +35641,7 @@ function findClaudeFiles(dir) {
|
|
|
35440
35641
|
var CODE_PREFIX = "R";
|
|
35441
35642
|
function nextRuleCode(root2) {
|
|
35442
35643
|
const numbers = findClaudeFiles(root2).flatMap(
|
|
35443
|
-
(file) => parseRulesSection(
|
|
35644
|
+
(file) => parseRulesSection(readFileSync51(file, "utf8")).map(
|
|
35444
35645
|
(rule) => Number(/(\d+)\s*$/.exec(rule.code)?.[1] ?? 0)
|
|
35445
35646
|
)
|
|
35446
35647
|
);
|
|
@@ -35466,15 +35667,15 @@ function resolveRuleScope(target) {
|
|
|
35466
35667
|
}
|
|
35467
35668
|
|
|
35468
35669
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
35469
|
-
import { existsSync as existsSync69, readFileSync as
|
|
35670
|
+
import { existsSync as existsSync69, readFileSync as readFileSync53, writeFileSync as writeFileSync42 } from "fs";
|
|
35470
35671
|
import path84 from "path";
|
|
35471
35672
|
|
|
35472
35673
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
35473
|
-
import { readFileSync as
|
|
35674
|
+
import { readFileSync as readFileSync52 } from "fs";
|
|
35474
35675
|
import path83 from "path";
|
|
35475
35676
|
function scopedRuleDirectories(root2) {
|
|
35476
35677
|
return findClaudeFiles(root2).filter(
|
|
35477
|
-
(file) => path83.dirname(file) !== root2 && parseRulesSection(
|
|
35678
|
+
(file) => path83.dirname(file) !== root2 && parseRulesSection(readFileSync52(file, "utf8")).length > 0
|
|
35478
35679
|
).map(
|
|
35479
35680
|
(file) => `${path83.relative(root2, path83.dirname(file)).split(path83.sep).join("/")}/`
|
|
35480
35681
|
).sort();
|
|
@@ -35516,7 +35717,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
35516
35717
|
function updateScopedRulesIndex(root2) {
|
|
35517
35718
|
const directories = scopedRuleDirectories(root2);
|
|
35518
35719
|
const rootFile = path84.join(root2, "CLAUDE.md");
|
|
35519
|
-
const before = existsSync69(rootFile) ?
|
|
35720
|
+
const before = existsSync69(rootFile) ? readFileSync53(rootFile, "utf8") : "";
|
|
35520
35721
|
const after = upsertScopedRulesPointer(before, directories);
|
|
35521
35722
|
if (after !== before) writeFileSync42(rootFile, after);
|
|
35522
35723
|
return directories;
|
|
@@ -35524,7 +35725,7 @@ function updateScopedRulesIndex(root2) {
|
|
|
35524
35725
|
|
|
35525
35726
|
// src/commands/rules/addRule.ts
|
|
35526
35727
|
function read2(file) {
|
|
35527
|
-
return existsSync70(file) ?
|
|
35728
|
+
return existsSync70(file) ? readFileSync54(file, "utf8") : "";
|
|
35528
35729
|
}
|
|
35529
35730
|
function addRule(text18, options2) {
|
|
35530
35731
|
const rule = text18.trim();
|
|
@@ -35988,12 +36189,12 @@ import { mkdirSync as mkdirSync26, writeFileSync as writeFileSync45 } from "fs";
|
|
|
35988
36189
|
import { mkdirSync as mkdirSync25, writeFileSync as writeFileSync44 } from "fs";
|
|
35989
36190
|
|
|
35990
36191
|
// src/commands/slack/readSlackParts.ts
|
|
35991
|
-
import { readFileSync as
|
|
36192
|
+
import { readFileSync as readFileSync55 } from "fs";
|
|
35992
36193
|
function readSlackParts(files) {
|
|
35993
36194
|
return files.map((file) => {
|
|
35994
36195
|
let contents;
|
|
35995
36196
|
try {
|
|
35996
|
-
contents =
|
|
36197
|
+
contents = readFileSync55(file, "utf8");
|
|
35997
36198
|
} catch {
|
|
35998
36199
|
console.error(`Error: Part file not found: ${file}`);
|
|
35999
36200
|
process.exit(1);
|
|
@@ -36721,7 +36922,7 @@ function syncPiHooks(sourceDir) {
|
|
|
36721
36922
|
}
|
|
36722
36923
|
|
|
36723
36924
|
// src/commands/sync/syncPi.ts
|
|
36724
|
-
function
|
|
36925
|
+
function unquote3(value) {
|
|
36725
36926
|
return value.trim().replace(/^["']|["']$/g, "");
|
|
36726
36927
|
}
|
|
36727
36928
|
function commandToPrompt(name, content) {
|
|
@@ -36729,9 +36930,9 @@ function commandToPrompt(name, content) {
|
|
|
36729
36930
|
const frontmatter2 = match ? match[1] : "";
|
|
36730
36931
|
const body = match ? content.slice(match[0].length) : content;
|
|
36731
36932
|
const descriptionMatch = frontmatter2.match(/^description:\s*(.*)$/m);
|
|
36732
|
-
const description = descriptionMatch ?
|
|
36933
|
+
const description = descriptionMatch ? unquote3(descriptionMatch[1]) : name;
|
|
36733
36934
|
const argsMatch = frontmatter2.match(/^allowed_args:\s*(.*)$/m);
|
|
36734
|
-
const argumentHint = argsMatch ?
|
|
36935
|
+
const argumentHint = argsMatch ? unquote3(argsMatch[1]) : void 0;
|
|
36735
36936
|
const header = [
|
|
36736
36937
|
"---",
|
|
36737
36938
|
`description: ${description}`,
|
|
@@ -37100,9 +37301,9 @@ function formatVttPassages(passages, notes = [], { sourceMarks = true } = {}) {
|
|
|
37100
37301
|
}
|
|
37101
37302
|
|
|
37102
37303
|
// src/commands/transcript/convert/readCleanedCues.ts
|
|
37103
|
-
import { readFileSync as
|
|
37304
|
+
import { readFileSync as readFileSync60 } from "fs";
|
|
37104
37305
|
function readCleanedCues(inputPath) {
|
|
37105
|
-
return deduplicateCues(parseVtt(
|
|
37306
|
+
return deduplicateCues(parseVtt(readFileSync60(inputPath, "utf8")));
|
|
37106
37307
|
}
|
|
37107
37308
|
|
|
37108
37309
|
// src/commands/transcript/clean.ts
|
|
@@ -37876,7 +38077,7 @@ function configKeys2() {
|
|
|
37876
38077
|
}
|
|
37877
38078
|
|
|
37878
38079
|
// src/commands/verify/forbiddenStrings.ts
|
|
37879
|
-
import { existsSync as existsSync79, readFileSync as
|
|
38080
|
+
import { existsSync as existsSync79, readFileSync as readFileSync61 } from "fs";
|
|
37880
38081
|
|
|
37881
38082
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
37882
38083
|
import { minimatch as minimatch9 } from "minimatch";
|
|
@@ -37923,7 +38124,7 @@ function forbiddenStrings() {
|
|
|
37923
38124
|
}
|
|
37924
38125
|
let parsed;
|
|
37925
38126
|
try {
|
|
37926
|
-
parsed = JSON.parse(
|
|
38127
|
+
parsed = JSON.parse(readFileSync61(file, "utf8"));
|
|
37927
38128
|
} catch (error) {
|
|
37928
38129
|
console.log(`Could not parse ${file}: ${error.message}`);
|
|
37929
38130
|
process.exit(1);
|
|
@@ -37993,7 +38194,7 @@ Total: ${lines2.length} hardcoded color(s)`);
|
|
|
37993
38194
|
}
|
|
37994
38195
|
|
|
37995
38196
|
// src/commands/verify/migrations.ts
|
|
37996
|
-
import { readFileSync as
|
|
38197
|
+
import { readFileSync as readFileSync62 } from "fs";
|
|
37997
38198
|
import path101 from "path";
|
|
37998
38199
|
|
|
37999
38200
|
// src/commands/verify/migrations/checkAppendOnly.ts
|
|
@@ -38158,7 +38359,7 @@ function migrations2() {
|
|
|
38158
38359
|
if (ref) {
|
|
38159
38360
|
const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
|
|
38160
38361
|
const current = new Map(
|
|
38161
|
-
files.map((file) => [file,
|
|
38362
|
+
files.map((file) => [file, readFileSync62(path101.join(dir, file), "utf8")])
|
|
38162
38363
|
);
|
|
38163
38364
|
for (const finding of checkAppendOnly(baseline, current)) {
|
|
38164
38365
|
problems.push(
|
|
@@ -38331,14 +38532,14 @@ function devices() {
|
|
|
38331
38532
|
}
|
|
38332
38533
|
|
|
38333
38534
|
// src/commands/voice/logs.ts
|
|
38334
|
-
import { existsSync as existsSync80, readFileSync as
|
|
38535
|
+
import { existsSync as existsSync80, readFileSync as readFileSync63 } from "fs";
|
|
38335
38536
|
function logs(options2) {
|
|
38336
38537
|
if (!existsSync80(voicePaths.log)) {
|
|
38337
38538
|
console.log("No voice log file found");
|
|
38338
38539
|
return;
|
|
38339
38540
|
}
|
|
38340
38541
|
const count8 = Number.parseInt(options2.lines ?? "150", 10);
|
|
38341
|
-
const content =
|
|
38542
|
+
const content = readFileSync63(voicePaths.log, "utf8").trim();
|
|
38342
38543
|
if (!content) {
|
|
38343
38544
|
console.log("Voice log is empty");
|
|
38344
38545
|
return;
|
|
@@ -38365,7 +38566,7 @@ import { join as join98 } from "path";
|
|
|
38365
38566
|
|
|
38366
38567
|
// src/commands/voice/checkLockFile.ts
|
|
38367
38568
|
import { execSync as execSync66 } from "child_process";
|
|
38368
|
-
import { existsSync as existsSync81, mkdirSync as mkdirSync33, readFileSync as
|
|
38569
|
+
import { existsSync as existsSync81, mkdirSync as mkdirSync33, readFileSync as readFileSync64, writeFileSync as writeFileSync52 } from "fs";
|
|
38369
38570
|
import { join as join97 } from "path";
|
|
38370
38571
|
function isProcessAlive2(pid) {
|
|
38371
38572
|
try {
|
|
@@ -38379,7 +38580,7 @@ function checkLockFile() {
|
|
|
38379
38580
|
const lockFile = getLockFile();
|
|
38380
38581
|
if (!existsSync81(lockFile)) return;
|
|
38381
38582
|
try {
|
|
38382
|
-
const lock2 = JSON.parse(
|
|
38583
|
+
const lock2 = JSON.parse(readFileSync64(lockFile, "utf8"));
|
|
38383
38584
|
if (lock2.pid && isProcessAlive2(lock2.pid)) {
|
|
38384
38585
|
console.error(
|
|
38385
38586
|
`Voice daemon already running (PID ${lock2.pid}, env: ${lock2.env}). Stop it first with: assist voice stop`
|
|
@@ -38481,7 +38682,7 @@ function start2(options2) {
|
|
|
38481
38682
|
}
|
|
38482
38683
|
|
|
38483
38684
|
// src/commands/voice/status.ts
|
|
38484
|
-
import { existsSync as existsSync82, readFileSync as
|
|
38685
|
+
import { existsSync as existsSync82, readFileSync as readFileSync65 } from "fs";
|
|
38485
38686
|
function isProcessAlive3(pid) {
|
|
38486
38687
|
try {
|
|
38487
38688
|
process.kill(pid, 0);
|
|
@@ -38492,7 +38693,7 @@ function isProcessAlive3(pid) {
|
|
|
38492
38693
|
}
|
|
38493
38694
|
function readRecentLogs(count8) {
|
|
38494
38695
|
if (!existsSync82(voicePaths.log)) return [];
|
|
38495
|
-
const lines2 =
|
|
38696
|
+
const lines2 = readFileSync65(voicePaths.log, "utf8").trim().split("\n");
|
|
38496
38697
|
return lines2.slice(-count8);
|
|
38497
38698
|
}
|
|
38498
38699
|
function status2() {
|
|
@@ -38500,7 +38701,7 @@ function status2() {
|
|
|
38500
38701
|
console.log("Voice daemon: not running (no PID file)");
|
|
38501
38702
|
return;
|
|
38502
38703
|
}
|
|
38503
|
-
const pid = Number.parseInt(
|
|
38704
|
+
const pid = Number.parseInt(readFileSync65(voicePaths.pid, "utf8").trim(), 10);
|
|
38504
38705
|
const alive = isProcessAlive3(pid);
|
|
38505
38706
|
console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
|
|
38506
38707
|
const recent = readRecentLogs(5);
|
|
@@ -38519,13 +38720,13 @@ function status2() {
|
|
|
38519
38720
|
}
|
|
38520
38721
|
|
|
38521
38722
|
// src/commands/voice/stop.ts
|
|
38522
|
-
import { existsSync as existsSync83, readFileSync as
|
|
38723
|
+
import { existsSync as existsSync83, readFileSync as readFileSync66, unlinkSync as unlinkSync21 } from "fs";
|
|
38523
38724
|
function stop2() {
|
|
38524
38725
|
if (!existsSync83(voicePaths.pid)) {
|
|
38525
38726
|
console.log("Voice daemon is not running (no PID file)");
|
|
38526
38727
|
return;
|
|
38527
38728
|
}
|
|
38528
|
-
const pid = Number.parseInt(
|
|
38729
|
+
const pid = Number.parseInt(readFileSync66(voicePaths.pid, "utf8").trim(), 10);
|
|
38529
38730
|
try {
|
|
38530
38731
|
process.kill(pid, "SIGTERM");
|
|
38531
38732
|
console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
|
|
@@ -39339,7 +39540,7 @@ async function auth() {
|
|
|
39339
39540
|
|
|
39340
39541
|
// src/commands/roam/postRoamActivity.ts
|
|
39341
39542
|
import { execFileSync as execFileSync23 } from "child_process";
|
|
39342
|
-
import { readdirSync as readdirSync22, readFileSync as
|
|
39543
|
+
import { readdirSync as readdirSync22, readFileSync as readFileSync67, statSync as statSync13 } from "fs";
|
|
39343
39544
|
import { join as join101 } from "path";
|
|
39344
39545
|
function findPortFile(roamDir) {
|
|
39345
39546
|
let entries;
|
|
@@ -39370,7 +39571,7 @@ function postRoamActivity(app, event) {
|
|
|
39370
39571
|
if (!portFile) return;
|
|
39371
39572
|
let port;
|
|
39372
39573
|
try {
|
|
39373
|
-
port =
|
|
39574
|
+
port = readFileSync67(portFile, "utf8").trim();
|
|
39374
39575
|
} catch {
|
|
39375
39576
|
return;
|
|
39376
39577
|
}
|
|
@@ -39762,11 +39963,11 @@ function applyLine(result, pending, line) {
|
|
|
39762
39963
|
}
|
|
39763
39964
|
|
|
39764
39965
|
// src/commands/sessions/daemon/readDaemonPidFile.ts
|
|
39765
|
-
import { readFileSync as
|
|
39966
|
+
import { readFileSync as readFileSync68 } from "fs";
|
|
39766
39967
|
function readDaemonPidFile() {
|
|
39767
39968
|
try {
|
|
39768
39969
|
const pid = Number.parseInt(
|
|
39769
|
-
|
|
39970
|
+
readFileSync68(daemonPaths.pid, "utf8").trim(),
|
|
39770
39971
|
10
|
|
39771
39972
|
);
|
|
39772
39973
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -45922,7 +46123,7 @@ function handleConnection(socket, manager) {
|
|
|
45922
46123
|
import { unlinkSync as unlinkSync23, writeFileSync as writeFileSync55 } from "fs";
|
|
45923
46124
|
|
|
45924
46125
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
45925
|
-
import { readFileSync as
|
|
46126
|
+
import { readFileSync as readFileSync70 } from "fs";
|
|
45926
46127
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
45927
46128
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
45928
46129
|
const timer = setInterval(() => {
|
|
@@ -45933,7 +46134,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
45933
46134
|
}
|
|
45934
46135
|
function ownsPidFile() {
|
|
45935
46136
|
try {
|
|
45936
|
-
return
|
|
46137
|
+
return readFileSync70(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
45937
46138
|
} catch {
|
|
45938
46139
|
return false;
|
|
45939
46140
|
}
|
|
@@ -46913,9 +47114,10 @@ function registerSessions(program2) {
|
|
|
46913
47114
|
const cmd = program2.command("sessions").description("Web dashboard for Claude Code sessions").option("--no-open", "Do not open a browser on startup").action(
|
|
46914
47115
|
(_options, command) => web({ port: "3100", open: command.optsWithGlobals().open })
|
|
46915
47116
|
);
|
|
46916
|
-
cmd.command("web").description("Start the sessions web dashboard").option("-p, --port <number>", "Port to listen on", "3100").option("--no-open", "Do not open a browser on startup").action(
|
|
47117
|
+
const webCmd = cmd.command("web").description("Start the sessions web dashboard").option("-p, --port <number>", "Port to listen on", "3100").option("--no-open", "Do not open a browser on startup").action(
|
|
46917
47118
|
(options2, command) => web({ ...options2, open: command.optsWithGlobals().open })
|
|
46918
47119
|
);
|
|
47120
|
+
configHelp(webCmd, nextConfigHelp);
|
|
46919
47121
|
cmd.command("summarise").description("Generate one-line summaries for Claude sessions").option("-f, --force", "Re-generate all summaries, even existing ones").option("-n, --limit <count>", "Maximum number of sessions to summarise").action(summarise2);
|
|
46920
47122
|
cmd.command("close").description(
|
|
46921
47123
|
"Dismiss the current daemon-managed session, ending it and reaping its worktree"
|