@staff0rd/assist 0.1007.1 → 0.1009.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/claude/commands/bug.md +5 -3
- package/claude/commands/devlog.md +41 -54
- package/claude/commands/draft.md +5 -3
- package/claude/commands/refine.md +2 -2
- package/dist/commands/sessions/web/bundle.js +389 -389
- package/dist/index.js +1161 -765
- 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.1009.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -6083,8 +6083,8 @@ var devlogConfigHelp = [
|
|
|
6083
6083
|
},
|
|
6084
6084
|
{
|
|
6085
6085
|
key: "devlog.skip",
|
|
6086
|
-
setter: "assist devlog skip 2026-
|
|
6087
|
-
note: "
|
|
6086
|
+
setter: "assist devlog skip 2026-W33",
|
|
6087
|
+
note: "ISO weeks (per repo) omitted from devlog output"
|
|
6088
6088
|
}
|
|
6089
6089
|
];
|
|
6090
6090
|
|
|
@@ -18873,6 +18873,7 @@ var activitySchema = z12.object({
|
|
|
18873
18873
|
name: z12.string().optional(),
|
|
18874
18874
|
itemId: z12.number().optional(),
|
|
18875
18875
|
itemName: z12.string().optional(),
|
|
18876
|
+
itemIds: z12.array(z12.number()).optional(),
|
|
18876
18877
|
phase: z12.number().optional(),
|
|
18877
18878
|
phaseName: z12.string().optional(),
|
|
18878
18879
|
totalPhases: z12.number().optional(),
|
|
@@ -19326,23 +19327,35 @@ import { randomUUID as randomUUID9 } from "crypto";
|
|
|
19326
19327
|
// src/commands/backlog/handleLaunchSignal.ts
|
|
19327
19328
|
import chalk85 from "chalk";
|
|
19328
19329
|
|
|
19329
|
-
// src/commands/backlog/
|
|
19330
|
-
|
|
19331
|
-
|
|
19332
|
-
|
|
19333
|
-
|
|
19334
|
-
|
|
19335
|
-
|
|
19336
|
-
|
|
19330
|
+
// src/commands/backlog/surfaceCreatedItems.ts
|
|
19331
|
+
function parseValidIds(ids) {
|
|
19332
|
+
const parsed = [];
|
|
19333
|
+
for (const id of ids) {
|
|
19334
|
+
try {
|
|
19335
|
+
parsed.push(parseItemId(id));
|
|
19336
|
+
} catch (error) {
|
|
19337
|
+
if (!(error instanceof InvalidItemIdError)) throw error;
|
|
19338
|
+
}
|
|
19337
19339
|
}
|
|
19340
|
+
return [...new Set(parsed)];
|
|
19341
|
+
}
|
|
19342
|
+
async function surfaceCreatedItems(slashCommand, ids) {
|
|
19343
|
+
const numericIds = parseValidIds(ids);
|
|
19344
|
+
if (numericIds.length === 0) return;
|
|
19338
19345
|
const { orm } = await getReady();
|
|
19339
|
-
const
|
|
19340
|
-
|
|
19346
|
+
const items2 = [];
|
|
19347
|
+
for (const id of numericIds) {
|
|
19348
|
+
const item = await loadItem(orm, id);
|
|
19349
|
+
if (item) items2.push(item);
|
|
19350
|
+
}
|
|
19351
|
+
const [first] = items2;
|
|
19352
|
+
if (!first) return;
|
|
19341
19353
|
emitActivity({
|
|
19342
19354
|
kind: "command",
|
|
19343
19355
|
name: slashCommand,
|
|
19344
|
-
itemId:
|
|
19345
|
-
itemName:
|
|
19356
|
+
itemId: first.id,
|
|
19357
|
+
itemName: first.name,
|
|
19358
|
+
...items2.length > 1 && { itemIds: items2.map((item) => item.id) }
|
|
19346
19359
|
});
|
|
19347
19360
|
}
|
|
19348
19361
|
|
|
@@ -19380,12 +19393,17 @@ Running backlog item ${label}...
|
|
|
19380
19393
|
}
|
|
19381
19394
|
|
|
19382
19395
|
// src/commands/backlog/handleLaunchSignal.ts
|
|
19396
|
+
function createdIds(signal) {
|
|
19397
|
+
const ids = Array.isArray(signal.ids) ? signal.ids : [signal.id];
|
|
19398
|
+
return ids.filter((id) => typeof id === "string" && !!id);
|
|
19399
|
+
}
|
|
19383
19400
|
async function handleLaunchSignal(slashCommand, once) {
|
|
19384
19401
|
const signal = readSignal();
|
|
19385
19402
|
cleanupSignal();
|
|
19386
19403
|
try {
|
|
19387
|
-
if (signal?.event === "done"
|
|
19388
|
-
|
|
19404
|
+
if (signal?.event === "done") {
|
|
19405
|
+
const ids = createdIds(signal);
|
|
19406
|
+
if (ids.length > 0) await surfaceCreatedItems(slashCommand, ids);
|
|
19389
19407
|
}
|
|
19390
19408
|
if (signal?.event === "next") {
|
|
19391
19409
|
if (typeof signal.id === "string" && signal.id) {
|
|
@@ -25431,6 +25449,68 @@ function list2(options2) {
|
|
|
25431
25449
|
}
|
|
25432
25450
|
}
|
|
25433
25451
|
|
|
25452
|
+
// src/commands/devlog/isoWeek.ts
|
|
25453
|
+
var DAY_MS = 864e5;
|
|
25454
|
+
var WEEK_ID_PATTERN = /^(\d{4})-W(\d{2})$/;
|
|
25455
|
+
function toUtc(date) {
|
|
25456
|
+
return /* @__PURE__ */ new Date(`${date}T00:00:00Z`);
|
|
25457
|
+
}
|
|
25458
|
+
function formatDate(date) {
|
|
25459
|
+
return date.toISOString().slice(0, 10);
|
|
25460
|
+
}
|
|
25461
|
+
function isoWeek(date) {
|
|
25462
|
+
const d = toUtc(date);
|
|
25463
|
+
const dayOfWeek = d.getUTCDay() || 7;
|
|
25464
|
+
const thursday = new Date(d.getTime() + (4 - dayOfWeek) * DAY_MS);
|
|
25465
|
+
const year = thursday.getUTCFullYear();
|
|
25466
|
+
const yearStart = Date.UTC(year, 0, 1);
|
|
25467
|
+
const week = Math.ceil(((thursday.getTime() - yearStart) / DAY_MS + 1) / 7);
|
|
25468
|
+
return `${year}-W${String(week).padStart(2, "0")}`;
|
|
25469
|
+
}
|
|
25470
|
+
function isoWeekRange(weekId) {
|
|
25471
|
+
const match = weekId.match(WEEK_ID_PATTERN);
|
|
25472
|
+
if (!match) throw new Error(`Invalid week id: ${weekId}`);
|
|
25473
|
+
const year = Number(match[1]);
|
|
25474
|
+
const week = Number(match[2]);
|
|
25475
|
+
const jan4 = new Date(Date.UTC(year, 0, 4));
|
|
25476
|
+
const jan4Day = jan4.getUTCDay() || 7;
|
|
25477
|
+
const week1Monday = jan4.getTime() - (jan4Day - 1) * DAY_MS;
|
|
25478
|
+
const start2 = new Date(week1Monday + (week - 1) * 7 * DAY_MS);
|
|
25479
|
+
const end = new Date(start2.getTime() + 6 * DAY_MS);
|
|
25480
|
+
return { start: formatDate(start2), end: formatDate(end) };
|
|
25481
|
+
}
|
|
25482
|
+
function isValidWeek(weekId) {
|
|
25483
|
+
const match = weekId.match(WEEK_ID_PATTERN);
|
|
25484
|
+
if (!match || Number(match[2]) < 1) return false;
|
|
25485
|
+
return isoWeek(isoWeekRange(weekId).start) === weekId;
|
|
25486
|
+
}
|
|
25487
|
+
function isCompletedWeek(weekId, today) {
|
|
25488
|
+
return isoWeekRange(weekId).end < today;
|
|
25489
|
+
}
|
|
25490
|
+
|
|
25491
|
+
// src/commands/devlog/loadDevWeeks.ts
|
|
25492
|
+
import { readdirSync as readdirSync9 } from "fs";
|
|
25493
|
+
import { join as join68 } from "path";
|
|
25494
|
+
var DEV_DIR = join68(BLOG_REPO_ROOT, "src/content/dev");
|
|
25495
|
+
var DEV_FILENAME_PATTERN = /^(\d{4})-w(\d{2})\.md$/;
|
|
25496
|
+
function parseDevWeekFilename(filename) {
|
|
25497
|
+
const match = filename.match(DEV_FILENAME_PATTERN);
|
|
25498
|
+
return match ? `${match[1]}-W${match[2]}` : null;
|
|
25499
|
+
}
|
|
25500
|
+
function readFilenames(dir) {
|
|
25501
|
+
try {
|
|
25502
|
+
return readdirSync9(dir);
|
|
25503
|
+
} catch {
|
|
25504
|
+
return [];
|
|
25505
|
+
}
|
|
25506
|
+
}
|
|
25507
|
+
function loadDevWeeks(repoName, devDir = DEV_DIR) {
|
|
25508
|
+
return readFilenames(join68(devDir, repoName)).map(parseDevWeekFilename).filter((week) => week !== null).sort();
|
|
25509
|
+
}
|
|
25510
|
+
|
|
25511
|
+
// src/commands/devlog/next/displayNextEntry.ts
|
|
25512
|
+
import chalk160 from "chalk";
|
|
25513
|
+
|
|
25434
25514
|
// src/commands/devlog/getLastVersionInfo.ts
|
|
25435
25515
|
import { execFileSync as execFileSync8, execSync as execSync34 } from "child_process";
|
|
25436
25516
|
import semver2 from "semver";
|
|
@@ -25496,127 +25576,161 @@ function bumpVersion(version2, type) {
|
|
|
25496
25576
|
}
|
|
25497
25577
|
|
|
25498
25578
|
// src/commands/devlog/next/displayNextEntry.ts
|
|
25499
|
-
|
|
25500
|
-
|
|
25501
|
-
|
|
25502
|
-
|
|
25503
|
-
|
|
25504
|
-
|
|
25505
|
-
|
|
25506
|
-
|
|
25507
|
-
|
|
25508
|
-
|
|
25509
|
-
|
|
25510
|
-
|
|
25511
|
-
|
|
25512
|
-
|
|
25579
|
+
function withVersions(commits2) {
|
|
25580
|
+
return commits2.map((commit2) => {
|
|
25581
|
+
const version2 = getVersionAtCommit(commit2.hash);
|
|
25582
|
+
return { ...commit2, version: version2 ? stripToMinor(version2) : null };
|
|
25583
|
+
});
|
|
25584
|
+
}
|
|
25585
|
+
function versionRange(commits2) {
|
|
25586
|
+
const versions = commits2.map((c) => c.version).filter((v) => v !== null);
|
|
25587
|
+
if (versions.length === 0) return null;
|
|
25588
|
+
const first = versions[0];
|
|
25589
|
+
const last = versions[versions.length - 1];
|
|
25590
|
+
return first === last ? first : `${first} \u2013 ${last}`;
|
|
25591
|
+
}
|
|
25592
|
+
function printField(label, value) {
|
|
25593
|
+
console.log(`${chalk160.bold(`${label}:`)} ${value}`);
|
|
25594
|
+
}
|
|
25595
|
+
function printCommits(commits2, ignore3, verbose) {
|
|
25596
|
+
for (const commit2 of commits2) {
|
|
25597
|
+
const version2 = commit2.version ? ` ${chalk160.cyan(commit2.version)}` : "";
|
|
25513
25598
|
console.log(
|
|
25514
|
-
|
|
25599
|
+
` ${chalk160.dim(commit2.date)} ${chalk160.yellow(commit2.hash)}${version2} ${commit2.message}`
|
|
25515
25600
|
);
|
|
25516
|
-
|
|
25517
|
-
|
|
25601
|
+
if (!verbose) continue;
|
|
25602
|
+
for (const file of commit2.files) {
|
|
25603
|
+
if (!ignore3.some((p) => file.startsWith(p))) {
|
|
25604
|
+
console.log(` ${chalk160.dim(file)}`);
|
|
25605
|
+
}
|
|
25606
|
+
}
|
|
25518
25607
|
}
|
|
25519
25608
|
}
|
|
25609
|
+
function displayNextEntry(ctx, week, commits2) {
|
|
25610
|
+
const versioned = withVersions(commits2);
|
|
25611
|
+
const { start: start2, end } = isoWeekRange(week);
|
|
25612
|
+
printField("name", ctx.repoName);
|
|
25613
|
+
printField("week", chalk160.bold.blue(week));
|
|
25614
|
+
printField("range", `${start2} \u2013 ${end}`);
|
|
25615
|
+
const versions = versionRange(versioned);
|
|
25616
|
+
if (versions) printField("versions", versions);
|
|
25617
|
+
printCommits(versioned, ctx.ignore, ctx.verbose);
|
|
25618
|
+
}
|
|
25619
|
+
function logNoCommits(lastWeek) {
|
|
25620
|
+
console.log(
|
|
25621
|
+
chalk160.dim(
|
|
25622
|
+
lastWeek ? `No completed weeks with commits after ${lastWeek}` : "No completed weeks with commits found"
|
|
25623
|
+
)
|
|
25624
|
+
);
|
|
25625
|
+
}
|
|
25520
25626
|
|
|
25521
|
-
// src/commands/devlog/next/
|
|
25522
|
-
|
|
25523
|
-
|
|
25627
|
+
// src/commands/devlog/next/fetchCommitsAfter.ts
|
|
25628
|
+
import { execFileSync as execFileSync9 } from "child_process";
|
|
25629
|
+
var RECORD_SEPARATOR = "";
|
|
25630
|
+
function parseRecord(record) {
|
|
25631
|
+
const [header, ...fileLines] = record.trim().split("\n");
|
|
25632
|
+
if (!header) return null;
|
|
25633
|
+
const [date, hash, ...messageParts] = header.split("|");
|
|
25634
|
+
if (!date || !hash) return null;
|
|
25524
25635
|
return {
|
|
25525
|
-
|
|
25526
|
-
|
|
25636
|
+
date,
|
|
25637
|
+
hash,
|
|
25638
|
+
message: messageParts.join("|"),
|
|
25639
|
+
files: fileLines.filter(Boolean)
|
|
25527
25640
|
};
|
|
25528
25641
|
}
|
|
25529
|
-
function
|
|
25530
|
-
|
|
25642
|
+
function isIgnored(commit2, ignore3) {
|
|
25643
|
+
if (ignore3.length === 0 || commit2.files.length === 0) return false;
|
|
25644
|
+
return commit2.files.every((file) => ignore3.some((p) => file.startsWith(p)));
|
|
25645
|
+
}
|
|
25646
|
+
function parseNameOnlyLog(output, ignore3, afterDate) {
|
|
25647
|
+
const byDate = /* @__PURE__ */ new Map();
|
|
25648
|
+
for (const record of output.split(RECORD_SEPARATOR)) {
|
|
25649
|
+
const commit2 = parseRecord(record);
|
|
25650
|
+
if (!commit2 || afterDate && commit2.date <= afterDate) continue;
|
|
25651
|
+
if (isIgnored(commit2, ignore3)) continue;
|
|
25652
|
+
byDate.set(commit2.date, [...byDate.get(commit2.date) ?? [], commit2]);
|
|
25653
|
+
}
|
|
25654
|
+
return byDate;
|
|
25531
25655
|
}
|
|
25532
|
-
function
|
|
25656
|
+
function fetchCommitsAfter(ignore3, afterDate) {
|
|
25657
|
+
const range = afterDate ? [`--since=${afterDate}T00:00:00`] : ["-n", "500"];
|
|
25533
25658
|
const output = execFileSync9(
|
|
25534
25659
|
"git",
|
|
25535
|
-
[
|
|
25536
|
-
|
|
25537
|
-
|
|
25538
|
-
|
|
25539
|
-
|
|
25540
|
-
|
|
25541
|
-
|
|
25542
|
-
|
|
25543
|
-
!!config.commit?.conventional,
|
|
25544
|
-
firstHash,
|
|
25545
|
-
versions.patch,
|
|
25546
|
-
versions.minor
|
|
25660
|
+
[
|
|
25661
|
+
"log",
|
|
25662
|
+
"--name-only",
|
|
25663
|
+
`--pretty=format:${RECORD_SEPARATOR}%ad|%h|%s`,
|
|
25664
|
+
"--date=short",
|
|
25665
|
+
...range
|
|
25666
|
+
],
|
|
25667
|
+
{ encoding: "utf8", maxBuffer: 256 * 1024 * 1024 }
|
|
25547
25668
|
);
|
|
25669
|
+
return parseNameOnlyLog(output, ignore3, afterDate);
|
|
25548
25670
|
}
|
|
25549
|
-
|
|
25550
|
-
|
|
25551
|
-
|
|
25552
|
-
|
|
25553
|
-
|
|
25554
|
-
|
|
25555
|
-
|
|
25556
|
-
|
|
25557
|
-
|
|
25558
|
-
|
|
25559
|
-
|
|
25560
|
-
}
|
|
25561
|
-
|
|
25562
|
-
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
25563
|
-
}
|
|
25564
|
-
function logName(repoName) {
|
|
25565
|
-
console.log(`${chalk161.bold("name:")} ${repoName}`);
|
|
25566
|
-
}
|
|
25567
|
-
function displayNextEntry(ctx, targetDate, commits2) {
|
|
25568
|
-
logName(ctx.repoName);
|
|
25569
|
-
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
25570
|
-
console.log(chalk161.bold.blue(targetDate));
|
|
25571
|
-
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
25671
|
+
|
|
25672
|
+
// src/commands/devlog/next/findTargetWeek.ts
|
|
25673
|
+
function groupCommitsByWeek(commitsByDate) {
|
|
25674
|
+
const byWeek = /* @__PURE__ */ new Map();
|
|
25675
|
+
const dates = Array.from(commitsByDate.keys()).sort();
|
|
25676
|
+
for (const date of dates) {
|
|
25677
|
+
const week = isoWeek(date);
|
|
25678
|
+
const existing = byWeek.get(week) ?? [];
|
|
25679
|
+
const newestFirst2 = commitsByDate.get(date) ?? [];
|
|
25680
|
+
existing.push(...[...newestFirst2].reverse());
|
|
25681
|
+
byWeek.set(week, existing);
|
|
25682
|
+
}
|
|
25683
|
+
return byWeek;
|
|
25572
25684
|
}
|
|
25573
|
-
function
|
|
25574
|
-
|
|
25685
|
+
function findTargetWeek(weeks, { lastWeek, skip: skip3, today }) {
|
|
25686
|
+
return Array.from(weeks).filter((week) => !lastWeek || week > lastWeek).filter((week) => !skip3.has(week)).filter((week) => isCompletedWeek(week, today)).sort()[0];
|
|
25575
25687
|
}
|
|
25576
25688
|
|
|
25577
25689
|
// src/commands/devlog/next.ts
|
|
25578
|
-
function
|
|
25579
|
-
const
|
|
25580
|
-
const
|
|
25581
|
-
return {
|
|
25690
|
+
function localToday() {
|
|
25691
|
+
const now = /* @__PURE__ */ new Date();
|
|
25692
|
+
const pad3 = (n) => String(n).padStart(2, "0");
|
|
25693
|
+
return `${now.getFullYear()}-${pad3(now.getMonth() + 1)}-${pad3(now.getDate())}`;
|
|
25582
25694
|
}
|
|
25583
|
-
function
|
|
25584
|
-
|
|
25585
|
-
const data = resolveContextData(config, options2);
|
|
25586
|
-
return { config, ...data, verbose: options2.verbose ?? false };
|
|
25695
|
+
function lastDailyDevlogDate(repoName) {
|
|
25696
|
+
return Array.from(loadDevlogEntries(repoName).keys()).sort().at(-1) ?? null;
|
|
25587
25697
|
}
|
|
25588
|
-
function
|
|
25589
|
-
|
|
25590
|
-
|
|
25591
|
-
getLastDate(ctx.lastInfo)
|
|
25592
|
-
);
|
|
25593
|
-
const targetDate = findTargetDate(
|
|
25594
|
-
commitsByDate,
|
|
25595
|
-
resolveSkipDays(ctx.repoName)
|
|
25596
|
-
);
|
|
25597
|
-
return targetDate ? { targetDate, commits: getCommitsForDate(commitsByDate, targetDate) } : null;
|
|
25698
|
+
function resolveAfterDate(repoName, lastWeek) {
|
|
25699
|
+
if (lastWeek) return isoWeekRange(lastWeek).end;
|
|
25700
|
+
return lastDailyDevlogDate(repoName);
|
|
25598
25701
|
}
|
|
25599
|
-
function
|
|
25600
|
-
|
|
25601
|
-
|
|
25702
|
+
function next2(options2) {
|
|
25703
|
+
const config = loadConfig();
|
|
25704
|
+
const repoName = getRepoName();
|
|
25705
|
+
const ignore3 = options2.ignore ?? config.devlog?.ignore ?? [];
|
|
25706
|
+
const lastWeek = loadDevWeeks(repoName).at(-1) ?? null;
|
|
25707
|
+
const afterDate = resolveAfterDate(repoName, lastWeek);
|
|
25708
|
+
const byWeek = groupCommitsByWeek(fetchCommitsAfter(ignore3, afterDate));
|
|
25709
|
+
const week = findTargetWeek(byWeek.keys(), {
|
|
25710
|
+
lastWeek,
|
|
25711
|
+
skip: loadBlogSkipDays(repoName),
|
|
25712
|
+
today: localToday()
|
|
25713
|
+
});
|
|
25714
|
+
if (!week) {
|
|
25715
|
+
logNoCommits(lastWeek);
|
|
25602
25716
|
return;
|
|
25603
25717
|
}
|
|
25604
|
-
displayNextEntry(
|
|
25605
|
-
}
|
|
25606
|
-
|
|
25607
|
-
|
|
25608
|
-
|
|
25718
|
+
displayNextEntry(
|
|
25719
|
+
{ repoName, ignore: ignore3, verbose: options2.verbose ?? false },
|
|
25720
|
+
week,
|
|
25721
|
+
byWeek.get(week) ?? []
|
|
25722
|
+
);
|
|
25609
25723
|
}
|
|
25610
25724
|
|
|
25611
25725
|
// src/commands/devlog/repos.ts
|
|
25612
25726
|
import { execSync as execSync35 } from "child_process";
|
|
25613
25727
|
|
|
25614
25728
|
// src/commands/devlog/repos/printReposTable.ts
|
|
25615
|
-
import
|
|
25729
|
+
import chalk161 from "chalk";
|
|
25616
25730
|
function colorStatus(status2) {
|
|
25617
|
-
if (status2 === "missing") return
|
|
25618
|
-
if (status2 === "outdated") return
|
|
25619
|
-
return
|
|
25731
|
+
if (status2 === "missing") return chalk161.red(status2);
|
|
25732
|
+
if (status2 === "outdated") return chalk161.yellow(status2);
|
|
25733
|
+
return chalk161.green(status2);
|
|
25620
25734
|
}
|
|
25621
25735
|
function formatRow(row3, nameWidth) {
|
|
25622
25736
|
const devlog = (row3.lastDevlog ?? "-").padEnd(11);
|
|
@@ -25630,8 +25744,8 @@ function printReposTable(rows) {
|
|
|
25630
25744
|
"Last Devlog".padEnd(11),
|
|
25631
25745
|
"Status"
|
|
25632
25746
|
].join(" ");
|
|
25633
|
-
console.log(
|
|
25634
|
-
console.log(
|
|
25747
|
+
console.log(chalk161.dim(header));
|
|
25748
|
+
console.log(chalk161.dim("-".repeat(header.length)));
|
|
25635
25749
|
for (const row3 of rows) {
|
|
25636
25750
|
console.log(formatRow(row3, nameWidth));
|
|
25637
25751
|
}
|
|
@@ -25688,15 +25802,15 @@ function repos(options2) {
|
|
|
25688
25802
|
|
|
25689
25803
|
// src/commands/devlog/skip.ts
|
|
25690
25804
|
import { writeFileSync as writeFileSync32 } from "fs";
|
|
25691
|
-
import { join as
|
|
25692
|
-
import
|
|
25805
|
+
import { join as join69 } from "path";
|
|
25806
|
+
import chalk162 from "chalk";
|
|
25693
25807
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
25694
25808
|
function getBlogConfigPath() {
|
|
25695
|
-
return
|
|
25809
|
+
return join69(BLOG_REPO_ROOT, "assist.yml");
|
|
25696
25810
|
}
|
|
25697
|
-
function skip2(
|
|
25698
|
-
if (
|
|
25699
|
-
console.log(
|
|
25811
|
+
function skip2(week) {
|
|
25812
|
+
if (!isValidWeek(week)) {
|
|
25813
|
+
console.log(chalk162.red("Invalid week. Use YYYY-Www (e.g. 2026-W33)"));
|
|
25700
25814
|
process.exit(1);
|
|
25701
25815
|
}
|
|
25702
25816
|
const repoName = getRepoName();
|
|
@@ -25704,33 +25818,33 @@ function skip2(date) {
|
|
|
25704
25818
|
const config = loadRawYaml(configPath);
|
|
25705
25819
|
const devlog = config.devlog ?? {};
|
|
25706
25820
|
const skip3 = devlog.skip ?? {};
|
|
25707
|
-
const
|
|
25708
|
-
if (
|
|
25821
|
+
const skipWeeks = skip3[repoName] ?? [];
|
|
25822
|
+
if (skipWeeks.includes(week)) {
|
|
25709
25823
|
console.log(
|
|
25710
|
-
|
|
25824
|
+
chalk162.yellow(`${week} is already in skip list for ${repoName}`)
|
|
25711
25825
|
);
|
|
25712
25826
|
return;
|
|
25713
25827
|
}
|
|
25714
|
-
|
|
25715
|
-
|
|
25716
|
-
skip3[repoName] =
|
|
25828
|
+
skipWeeks.push(week);
|
|
25829
|
+
skipWeeks.sort();
|
|
25830
|
+
skip3[repoName] = skipWeeks;
|
|
25717
25831
|
devlog.skip = skip3;
|
|
25718
25832
|
config.devlog = devlog;
|
|
25719
25833
|
writeFileSync32(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
25720
|
-
console.log(
|
|
25834
|
+
console.log(chalk162.green(`Added ${week} to skip list for ${repoName}`));
|
|
25721
25835
|
}
|
|
25722
25836
|
|
|
25723
25837
|
// src/commands/devlog/version.ts
|
|
25724
|
-
import
|
|
25838
|
+
import chalk163 from "chalk";
|
|
25725
25839
|
function version() {
|
|
25726
25840
|
const config = loadConfig();
|
|
25727
25841
|
const name = getRepoName();
|
|
25728
25842
|
const lastInfo = getLastVersionInfo(name, config);
|
|
25729
25843
|
const lastVersion = lastInfo?.version ?? null;
|
|
25730
25844
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
25731
|
-
console.log(`${
|
|
25732
|
-
console.log(`${
|
|
25733
|
-
console.log(`${
|
|
25845
|
+
console.log(`${chalk163.bold("name:")} ${name}`);
|
|
25846
|
+
console.log(`${chalk163.bold("last:")} ${lastVersion ?? chalk163.dim("none")}`);
|
|
25847
|
+
console.log(`${chalk163.bold("next:")} ${nextVersion ?? chalk163.dim("none")}`);
|
|
25734
25848
|
}
|
|
25735
25849
|
|
|
25736
25850
|
// src/commands/registerDevlog.ts
|
|
@@ -25742,8 +25856,10 @@ function registerDevlog(program) {
|
|
|
25742
25856
|
Number.parseInt
|
|
25743
25857
|
).option("--since <date>", "Only show commits since this date (YYYY-MM-DD)").option("-r, --reverse", "Show earliest commits first").option("-v, --verbose", "Show file names for each commit").action(list2);
|
|
25744
25858
|
devlogCommand.command("version").description("Show current repo name and version info").action(version);
|
|
25745
|
-
devlogCommand.command("next").description(
|
|
25746
|
-
|
|
25859
|
+
devlogCommand.command("next").description(
|
|
25860
|
+
"Show commits for the next completed ISO week after the last dev entry"
|
|
25861
|
+
).option("-v, --verbose", "Show file names for each commit").action(next2);
|
|
25862
|
+
devlogCommand.command("skip <week>").description("Add an ISO week (YYYY-Www) to the skip list").action(skip2);
|
|
25747
25863
|
devlogCommand.command("repos").description("Show repos missing devlog entries").option(
|
|
25748
25864
|
"--days <number>",
|
|
25749
25865
|
"Only show repos pushed within N days (default: 30)",
|
|
@@ -25753,13 +25869,29 @@ function registerDevlog(program) {
|
|
|
25753
25869
|
}
|
|
25754
25870
|
|
|
25755
25871
|
// src/commands/docs/docsConfirm.ts
|
|
25872
|
+
import chalk164 from "chalk";
|
|
25873
|
+
|
|
25874
|
+
// src/commands/notify/forwardPinConfirm.ts
|
|
25875
|
+
import { randomUUID as randomUUID11 } from "crypto";
|
|
25876
|
+
var CONFIRM_TIMEOUT_MS = 15e3;
|
|
25877
|
+
async function forwardPinConfirm(area, pin2) {
|
|
25878
|
+
const requestId = randomUUID11();
|
|
25879
|
+
const reply2 = await requestDaemonReply(
|
|
25880
|
+
{ type: "confirm-pin", requestId, area, pin: pin2 },
|
|
25881
|
+
"confirm-pin-result",
|
|
25882
|
+
CONFIRM_TIMEOUT_MS
|
|
25883
|
+
);
|
|
25884
|
+
if (!reply2?.found || reply2.requestId !== requestId) return void 0;
|
|
25885
|
+
return { ok: reply2.ok === true, message: reply2.message ?? "" };
|
|
25886
|
+
}
|
|
25887
|
+
|
|
25888
|
+
// src/commands/docs/approveDocsUnlock.ts
|
|
25756
25889
|
import { unlinkSync as unlinkSync10 } from "fs";
|
|
25757
|
-
import chalk165 from "chalk";
|
|
25758
25890
|
|
|
25759
25891
|
// src/commands/docs/getDocsUnlockPinPath.ts
|
|
25760
|
-
import { join as
|
|
25892
|
+
import { join as join70 } from "path";
|
|
25761
25893
|
function getDocsUnlockPinPath(pin2) {
|
|
25762
|
-
return
|
|
25894
|
+
return join70(getRestrictedDir(), `docs-unlock-pin-${pin2}.json`);
|
|
25763
25895
|
}
|
|
25764
25896
|
|
|
25765
25897
|
// src/commands/docs/readDocsUnlockPinState.ts
|
|
@@ -25795,45 +25927,77 @@ async function recordDocsUnlock(orm, itemId2, phase) {
|
|
|
25795
25927
|
});
|
|
25796
25928
|
}
|
|
25797
25929
|
|
|
25798
|
-
// src/commands/docs/
|
|
25799
|
-
async function
|
|
25930
|
+
// src/commands/docs/approveDocsUnlock.ts
|
|
25931
|
+
async function approveDocsUnlock(pin2) {
|
|
25800
25932
|
sweepRestrictedDir();
|
|
25801
25933
|
const state = readDocsUnlockPinState(pin2);
|
|
25802
|
-
if (!state)
|
|
25803
|
-
console.error(chalk165.red(`No pending docs unlock for pin: ${pin2}`));
|
|
25804
|
-
process.exitCode = 1;
|
|
25805
|
-
return;
|
|
25806
|
-
}
|
|
25934
|
+
if (!state) return void 0;
|
|
25807
25935
|
unlinkSync10(getDocsUnlockPinPath(pin2));
|
|
25808
25936
|
const found = await findOneItem(String(state.itemId));
|
|
25809
|
-
if (!found)
|
|
25937
|
+
if (!found)
|
|
25938
|
+
return {
|
|
25939
|
+
ok: false,
|
|
25940
|
+
message: `Item ${formatItemId(state.itemId)} not found; nothing was approved.`
|
|
25941
|
+
};
|
|
25942
|
+
const label = `${formatItemId(state.itemId)} ${found.item.name}`;
|
|
25943
|
+
if ((found.item.currentPhase ?? 1) !== state.phase)
|
|
25944
|
+
return {
|
|
25945
|
+
ok: false,
|
|
25946
|
+
message: `${label} has moved on from phase ${state.phase} since the unlock was requested. Nothing was approved; request a new unlock from the current phase.`
|
|
25947
|
+
};
|
|
25948
|
+
await recordDocsUnlock(found.orm, state.itemId, state.phase);
|
|
25949
|
+
return {
|
|
25950
|
+
ok: true,
|
|
25951
|
+
message: `Approved docs changes for phase ${state.phase} of ${label}. Its sessions may edit and commit docs pages and screenshots until the item moves on from that phase or is done or won't-do.`
|
|
25952
|
+
};
|
|
25953
|
+
}
|
|
25954
|
+
|
|
25955
|
+
// src/commands/docs/docsConfirm.ts
|
|
25956
|
+
async function docsConfirm(pin2) {
|
|
25957
|
+
const result = await approveDocsUnlock(pin2) ?? await forwardPinConfirm("docs", pin2);
|
|
25958
|
+
if (!result) {
|
|
25959
|
+
console.error(chalk164.red(`No pending docs unlock for pin: ${pin2}`));
|
|
25810
25960
|
process.exitCode = 1;
|
|
25811
25961
|
return;
|
|
25812
25962
|
}
|
|
25813
|
-
|
|
25814
|
-
|
|
25815
|
-
console.error(
|
|
25816
|
-
chalk165.red(
|
|
25817
|
-
`${label} has moved on from phase ${state.phase} since the unlock was requested. Nothing was approved; request a new unlock from the current phase.`
|
|
25818
|
-
)
|
|
25819
|
-
);
|
|
25820
|
-
process.exitCode = 1;
|
|
25963
|
+
if (result.ok) {
|
|
25964
|
+
console.log(chalk164.green(result.message));
|
|
25821
25965
|
return;
|
|
25822
25966
|
}
|
|
25823
|
-
|
|
25824
|
-
|
|
25825
|
-
chalk165.green(
|
|
25826
|
-
`Approved docs changes for phase ${state.phase} of ${label}. Its sessions may edit and commit docs pages and screenshots until the item moves on from that phase or is done or won't-do.`
|
|
25827
|
-
)
|
|
25828
|
-
);
|
|
25967
|
+
console.error(chalk164.red(result.message));
|
|
25968
|
+
process.exitCode = 1;
|
|
25829
25969
|
}
|
|
25830
25970
|
|
|
25831
25971
|
// src/commands/docs/docsUnlock.ts
|
|
25832
25972
|
import { randomInt as randomInt3 } from "crypto";
|
|
25833
25973
|
import { mkdirSync as mkdirSync20, unlinkSync as unlinkSync11, writeFileSync as writeFileSync33 } from "fs";
|
|
25834
|
-
import
|
|
25974
|
+
import chalk165 from "chalk";
|
|
25975
|
+
|
|
25976
|
+
// src/commands/notify/deliverPinNotification.ts
|
|
25977
|
+
import { randomUUID as randomUUID12 } from "crypto";
|
|
25978
|
+
var ROUTE_TIMEOUT_MS = 1e4;
|
|
25979
|
+
async function relayToViewerNode(notification) {
|
|
25980
|
+
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
25981
|
+
if (!sessionId) return void 0;
|
|
25982
|
+
const requestId = randomUUID12();
|
|
25983
|
+
const reply2 = await requestDaemonReply(
|
|
25984
|
+
{ type: "notify-pin", sessionId, requestId, ...notification },
|
|
25985
|
+
"notify-pin-result",
|
|
25986
|
+
ROUTE_TIMEOUT_MS
|
|
25987
|
+
);
|
|
25988
|
+
if (reply2?.requestId !== requestId) return void 0;
|
|
25989
|
+
return reply2.node;
|
|
25990
|
+
}
|
|
25991
|
+
async function deliverPinNotification(notification) {
|
|
25992
|
+
const node = await relayToViewerNode(notification);
|
|
25993
|
+
if (node) return { delivered: true, node };
|
|
25994
|
+
const { title, message: message3 } = notification;
|
|
25995
|
+
return { delivered: showNotification({ title, message: message3 }) };
|
|
25996
|
+
}
|
|
25997
|
+
|
|
25998
|
+
// src/commands/docs/docsUnlock.ts
|
|
25835
25999
|
function fail7(message3) {
|
|
25836
|
-
console.error(
|
|
26000
|
+
console.error(chalk165.red(message3));
|
|
25837
26001
|
process.exitCode = 1;
|
|
25838
26002
|
}
|
|
25839
26003
|
async function docsUnlock() {
|
|
@@ -25856,7 +26020,9 @@ async function docsUnlock() {
|
|
|
25856
26020
|
sweepRestrictedDir();
|
|
25857
26021
|
const pinPath = getDocsUnlockPinPath(pin2);
|
|
25858
26022
|
writeFileSync33(pinPath, JSON.stringify({ pin: pin2, itemId: itemId2, phase }));
|
|
25859
|
-
const delivered =
|
|
26023
|
+
const { delivered, node } = await deliverPinNotification({
|
|
26024
|
+
area: "docs",
|
|
26025
|
+
pin: pin2,
|
|
25860
26026
|
title: `assist docs unlock: ${label}`,
|
|
25861
26027
|
message: `Pin ${pin2} \u2014 run: assist docs confirm ${pin2}`
|
|
25862
26028
|
});
|
|
@@ -25868,9 +26034,9 @@ async function docsUnlock() {
|
|
|
25868
26034
|
return;
|
|
25869
26035
|
}
|
|
25870
26036
|
console.log(
|
|
25871
|
-
`A confirmation pin was sent to the user's desktop notifications.
|
|
25872
|
-
To let this phase of ${label} edit docs pages and screenshots, the user runs:
|
|
25873
|
-
${
|
|
26037
|
+
`A confirmation pin was sent to the user's desktop notifications${node ? ` on ${node}, the node controlling this session` : ""}.
|
|
26038
|
+
To let this phase of ${label} edit docs pages and screenshots, the user runs${node ? ` on ${node}` : ""}:
|
|
26039
|
+
${chalk165.cyan(" assist docs confirm <PIN>")}
|
|
25874
26040
|
Wait for the user to confirm before editing docs.`
|
|
25875
26041
|
);
|
|
25876
26042
|
}
|
|
@@ -25896,20 +26062,20 @@ function registerDocs(parent) {
|
|
|
25896
26062
|
}
|
|
25897
26063
|
|
|
25898
26064
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
25899
|
-
import { closeSync as closeSync4, openSync as openSync5, readdirSync as
|
|
25900
|
-
import { join as
|
|
25901
|
-
import
|
|
26065
|
+
import { closeSync as closeSync4, openSync as openSync5, readdirSync as readdirSync10 } from "fs";
|
|
26066
|
+
import { join as join71 } from "path";
|
|
26067
|
+
import chalk166 from "chalk";
|
|
25902
26068
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
25903
26069
|
function isLockedDll(debugDir) {
|
|
25904
26070
|
let files;
|
|
25905
26071
|
try {
|
|
25906
|
-
files =
|
|
26072
|
+
files = readdirSync10(debugDir, { recursive: true });
|
|
25907
26073
|
} catch {
|
|
25908
26074
|
return null;
|
|
25909
26075
|
}
|
|
25910
26076
|
for (const file of files) {
|
|
25911
26077
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
25912
|
-
const dllPath =
|
|
26078
|
+
const dllPath = join71(debugDir, file);
|
|
25913
26079
|
try {
|
|
25914
26080
|
const fd = openSync5(dllPath, "r+");
|
|
25915
26081
|
closeSync4(fd);
|
|
@@ -25922,18 +26088,18 @@ function isLockedDll(debugDir) {
|
|
|
25922
26088
|
function findFirstLockedDll(dir) {
|
|
25923
26089
|
let entries;
|
|
25924
26090
|
try {
|
|
25925
|
-
entries =
|
|
26091
|
+
entries = readdirSync10(dir);
|
|
25926
26092
|
} catch {
|
|
25927
26093
|
return null;
|
|
25928
26094
|
}
|
|
25929
26095
|
if (entries.includes("bin")) {
|
|
25930
|
-
const locked = isLockedDll(
|
|
26096
|
+
const locked = isLockedDll(join71(dir, "bin", "Debug"));
|
|
25931
26097
|
if (locked) return locked;
|
|
25932
26098
|
}
|
|
25933
26099
|
for (const entry of entries) {
|
|
25934
26100
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
25935
26101
|
continue;
|
|
25936
|
-
const found = findFirstLockedDll(
|
|
26102
|
+
const found = findFirstLockedDll(join71(dir, entry));
|
|
25937
26103
|
if (found) return found;
|
|
25938
26104
|
}
|
|
25939
26105
|
return null;
|
|
@@ -25945,14 +26111,14 @@ function checkBuildLocks(startDir) {
|
|
|
25945
26111
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
25946
26112
|
if (locked) {
|
|
25947
26113
|
console.error(
|
|
25948
|
-
|
|
26114
|
+
chalk166.red("Build output locked (is VS debugging?): ") + locked
|
|
25949
26115
|
);
|
|
25950
26116
|
process.exit(1);
|
|
25951
26117
|
}
|
|
25952
26118
|
}
|
|
25953
26119
|
async function checkBuildLocksCommand() {
|
|
25954
26120
|
checkBuildLocks();
|
|
25955
|
-
console.log(
|
|
26121
|
+
console.log(chalk166.green("No build locks detected"));
|
|
25956
26122
|
}
|
|
25957
26123
|
|
|
25958
26124
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -26002,14 +26168,14 @@ function collectAllDeps(node) {
|
|
|
26002
26168
|
}
|
|
26003
26169
|
|
|
26004
26170
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
26005
|
-
import { readdirSync as
|
|
26171
|
+
import { readdirSync as readdirSync11, readFileSync as readFileSync41, statSync as statSync8 } from "fs";
|
|
26006
26172
|
import path36 from "path";
|
|
26007
26173
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
26008
26174
|
if (depth > maxDepth) return [];
|
|
26009
26175
|
const results = [];
|
|
26010
26176
|
let entries;
|
|
26011
26177
|
try {
|
|
26012
|
-
entries =
|
|
26178
|
+
entries = readdirSync11(dir);
|
|
26013
26179
|
} catch {
|
|
26014
26180
|
return results;
|
|
26015
26181
|
}
|
|
@@ -26051,30 +26217,30 @@ function escapeRegex(s) {
|
|
|
26051
26217
|
}
|
|
26052
26218
|
|
|
26053
26219
|
// src/commands/dotnet/printTree.ts
|
|
26054
|
-
import
|
|
26220
|
+
import chalk167 from "chalk";
|
|
26055
26221
|
function printNodes(nodes, prefix2) {
|
|
26056
26222
|
for (let i = 0; i < nodes.length; i++) {
|
|
26057
26223
|
const isLast = i === nodes.length - 1;
|
|
26058
26224
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
26059
26225
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
26060
26226
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
26061
|
-
const label = isMissing ?
|
|
26227
|
+
const label = isMissing ? chalk167.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
26062
26228
|
console.log(`${prefix2}${connector}${label}`);
|
|
26063
26229
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
26064
26230
|
}
|
|
26065
26231
|
}
|
|
26066
26232
|
function printTree(tree, totalCount, solutions) {
|
|
26067
|
-
console.log(
|
|
26068
|
-
console.log(
|
|
26233
|
+
console.log(chalk167.bold("\nProject Dependency Tree"));
|
|
26234
|
+
console.log(chalk167.cyan(tree.relativePath));
|
|
26069
26235
|
printNodes(tree.children, "");
|
|
26070
|
-
console.log(
|
|
26236
|
+
console.log(chalk167.dim(`
|
|
26071
26237
|
${totalCount} projects total (including root)`));
|
|
26072
|
-
console.log(
|
|
26238
|
+
console.log(chalk167.bold("\nSolution Membership"));
|
|
26073
26239
|
if (solutions.length === 0) {
|
|
26074
|
-
console.log(
|
|
26240
|
+
console.log(chalk167.yellow(" Not found in any .sln"));
|
|
26075
26241
|
} else {
|
|
26076
26242
|
for (const sln of solutions) {
|
|
26077
|
-
console.log(` ${
|
|
26243
|
+
console.log(` ${chalk167.green(sln)}`);
|
|
26078
26244
|
}
|
|
26079
26245
|
}
|
|
26080
26246
|
console.log();
|
|
@@ -26103,16 +26269,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
26103
26269
|
// src/commands/dotnet/resolveCsproj.ts
|
|
26104
26270
|
import { existsSync as existsSync56 } from "fs";
|
|
26105
26271
|
import path37 from "path";
|
|
26106
|
-
import
|
|
26272
|
+
import chalk168 from "chalk";
|
|
26107
26273
|
function resolveCsproj(csprojPath) {
|
|
26108
26274
|
const resolved = path37.resolve(csprojPath);
|
|
26109
26275
|
if (!existsSync56(resolved)) {
|
|
26110
|
-
console.error(
|
|
26276
|
+
console.error(chalk168.red(`File not found: ${resolved}`));
|
|
26111
26277
|
process.exit(1);
|
|
26112
26278
|
}
|
|
26113
26279
|
const repoRoot2 = findRepoRoot(path37.dirname(resolved));
|
|
26114
26280
|
if (!repoRoot2) {
|
|
26115
|
-
console.error(
|
|
26281
|
+
console.error(chalk168.red("Could not find git repository root"));
|
|
26116
26282
|
process.exit(1);
|
|
26117
26283
|
}
|
|
26118
26284
|
return { resolved, repoRoot: repoRoot2 };
|
|
@@ -26162,12 +26328,12 @@ function getChangedCsFiles(scope) {
|
|
|
26162
26328
|
}
|
|
26163
26329
|
|
|
26164
26330
|
// src/commands/dotnet/inSln.ts
|
|
26165
|
-
import
|
|
26331
|
+
import chalk169 from "chalk";
|
|
26166
26332
|
async function inSln(csprojPath) {
|
|
26167
26333
|
const { resolved, repoRoot: repoRoot2 } = resolveCsproj(csprojPath);
|
|
26168
26334
|
const solutions = findContainingSolutions(resolved, repoRoot2);
|
|
26169
26335
|
if (solutions.length === 0) {
|
|
26170
|
-
console.log(
|
|
26336
|
+
console.log(chalk169.yellow("Not found in any .sln file"));
|
|
26171
26337
|
process.exit(1);
|
|
26172
26338
|
}
|
|
26173
26339
|
for (const sln of solutions) {
|
|
@@ -26176,7 +26342,7 @@ async function inSln(csprojPath) {
|
|
|
26176
26342
|
}
|
|
26177
26343
|
|
|
26178
26344
|
// src/commands/dotnet/inspect.ts
|
|
26179
|
-
import
|
|
26345
|
+
import chalk175 from "chalk";
|
|
26180
26346
|
|
|
26181
26347
|
// src/shared/formatElapsed.ts
|
|
26182
26348
|
function formatElapsed(ms) {
|
|
@@ -26188,12 +26354,12 @@ function formatElapsed(ms) {
|
|
|
26188
26354
|
}
|
|
26189
26355
|
|
|
26190
26356
|
// src/commands/dotnet/displayIssues.ts
|
|
26191
|
-
import
|
|
26357
|
+
import chalk170 from "chalk";
|
|
26192
26358
|
var SEVERITY_COLOR = {
|
|
26193
|
-
ERROR:
|
|
26194
|
-
WARNING:
|
|
26195
|
-
SUGGESTION:
|
|
26196
|
-
HINT:
|
|
26359
|
+
ERROR: chalk170.red,
|
|
26360
|
+
WARNING: chalk170.yellow,
|
|
26361
|
+
SUGGESTION: chalk170.cyan,
|
|
26362
|
+
HINT: chalk170.dim
|
|
26197
26363
|
};
|
|
26198
26364
|
function groupByFile(issues) {
|
|
26199
26365
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -26209,15 +26375,15 @@ function groupByFile(issues) {
|
|
|
26209
26375
|
}
|
|
26210
26376
|
function displayIssues(issues) {
|
|
26211
26377
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
26212
|
-
console.log(
|
|
26378
|
+
console.log(chalk170.bold(file));
|
|
26213
26379
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
26214
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
26380
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk170.white;
|
|
26215
26381
|
console.log(
|
|
26216
|
-
` ${
|
|
26382
|
+
` ${chalk170.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
26217
26383
|
);
|
|
26218
26384
|
}
|
|
26219
26385
|
}
|
|
26220
|
-
console.log(
|
|
26386
|
+
console.log(chalk170.dim(`
|
|
26221
26387
|
${issues.length} issue(s) found`));
|
|
26222
26388
|
}
|
|
26223
26389
|
|
|
@@ -26276,15 +26442,15 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
26276
26442
|
// src/commands/dotnet/resolveSolution.ts
|
|
26277
26443
|
import { existsSync as existsSync57 } from "fs";
|
|
26278
26444
|
import path38 from "path";
|
|
26279
|
-
import
|
|
26445
|
+
import chalk172 from "chalk";
|
|
26280
26446
|
|
|
26281
26447
|
// src/commands/dotnet/findSolution.ts
|
|
26282
|
-
import { readdirSync as
|
|
26283
|
-
import { dirname as dirname31, join as
|
|
26284
|
-
import
|
|
26448
|
+
import { readdirSync as readdirSync12 } from "fs";
|
|
26449
|
+
import { dirname as dirname31, join as join72 } from "path";
|
|
26450
|
+
import chalk171 from "chalk";
|
|
26285
26451
|
function findSlnInDir(dir) {
|
|
26286
26452
|
try {
|
|
26287
|
-
return
|
|
26453
|
+
return readdirSync12(dir).filter((f) => f.endsWith(".sln")).map((f) => join72(dir, f));
|
|
26288
26454
|
} catch {
|
|
26289
26455
|
return [];
|
|
26290
26456
|
}
|
|
@@ -26297,17 +26463,17 @@ function findSolution() {
|
|
|
26297
26463
|
const slnFiles = findSlnInDir(current);
|
|
26298
26464
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
26299
26465
|
if (slnFiles.length > 1) {
|
|
26300
|
-
console.error(
|
|
26466
|
+
console.error(chalk171.red(`Multiple .sln files found in ${current}:`));
|
|
26301
26467
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
26302
26468
|
console.error(
|
|
26303
|
-
|
|
26469
|
+
chalk171.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
26304
26470
|
);
|
|
26305
26471
|
process.exit(1);
|
|
26306
26472
|
}
|
|
26307
26473
|
if (current === ceiling) break;
|
|
26308
26474
|
current = dirname31(current);
|
|
26309
26475
|
}
|
|
26310
|
-
console.error(
|
|
26476
|
+
console.error(chalk171.red("No .sln file found between cwd and repo root"));
|
|
26311
26477
|
process.exit(1);
|
|
26312
26478
|
}
|
|
26313
26479
|
|
|
@@ -26316,7 +26482,7 @@ function resolveSolution(sln) {
|
|
|
26316
26482
|
if (sln) {
|
|
26317
26483
|
const resolved = path38.resolve(sln);
|
|
26318
26484
|
if (!existsSync57(resolved)) {
|
|
26319
|
-
console.error(
|
|
26485
|
+
console.error(chalk172.red(`Solution file not found: ${resolved}`));
|
|
26320
26486
|
process.exit(1);
|
|
26321
26487
|
}
|
|
26322
26488
|
return resolved;
|
|
@@ -26358,14 +26524,14 @@ import { execSync as execSync37 } from "child_process";
|
|
|
26358
26524
|
import { existsSync as existsSync58, readFileSync as readFileSync42, unlinkSync as unlinkSync12 } from "fs";
|
|
26359
26525
|
import { tmpdir as tmpdir4 } from "os";
|
|
26360
26526
|
import path39 from "path";
|
|
26361
|
-
import
|
|
26527
|
+
import chalk173 from "chalk";
|
|
26362
26528
|
function assertJbInstalled() {
|
|
26363
26529
|
try {
|
|
26364
26530
|
execSync37("jb inspectcode --version", { stdio: "pipe" });
|
|
26365
26531
|
} catch {
|
|
26366
|
-
console.error(
|
|
26532
|
+
console.error(chalk173.red("jb is not installed. Install with:"));
|
|
26367
26533
|
console.error(
|
|
26368
|
-
|
|
26534
|
+
chalk173.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
26369
26535
|
);
|
|
26370
26536
|
process.exit(1);
|
|
26371
26537
|
}
|
|
@@ -26383,11 +26549,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
26383
26549
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
26384
26550
|
process.stderr.write(error.stderr);
|
|
26385
26551
|
}
|
|
26386
|
-
console.error(
|
|
26552
|
+
console.error(chalk173.red("jb inspectcode failed"));
|
|
26387
26553
|
process.exit(1);
|
|
26388
26554
|
}
|
|
26389
26555
|
if (!existsSync58(reportPath)) {
|
|
26390
|
-
console.error(
|
|
26556
|
+
console.error(chalk173.red("Report file not generated"));
|
|
26391
26557
|
process.exit(1);
|
|
26392
26558
|
}
|
|
26393
26559
|
const xml = readFileSync42(reportPath, "utf8");
|
|
@@ -26397,7 +26563,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
26397
26563
|
|
|
26398
26564
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
26399
26565
|
import { execSync as execSync38 } from "child_process";
|
|
26400
|
-
import
|
|
26566
|
+
import chalk174 from "chalk";
|
|
26401
26567
|
function resolveMsbuildPath() {
|
|
26402
26568
|
const { run: run4 } = loadConfig();
|
|
26403
26569
|
const configs = resolveRunConfigs(run4, runConfigBaseDir());
|
|
@@ -26409,9 +26575,9 @@ function assertMsbuildInstalled() {
|
|
|
26409
26575
|
try {
|
|
26410
26576
|
execSync38(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
26411
26577
|
} catch {
|
|
26412
|
-
console.error(
|
|
26578
|
+
console.error(chalk174.red(`msbuild not found at: ${msbuild}`));
|
|
26413
26579
|
console.error(
|
|
26414
|
-
|
|
26580
|
+
chalk174.yellow(
|
|
26415
26581
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
26416
26582
|
)
|
|
26417
26583
|
);
|
|
@@ -26458,17 +26624,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
26458
26624
|
// src/commands/dotnet/inspect.ts
|
|
26459
26625
|
function logScope(changedFiles2) {
|
|
26460
26626
|
if (changedFiles2 === null) {
|
|
26461
|
-
console.log(
|
|
26627
|
+
console.log(chalk175.dim("Inspecting full solution..."));
|
|
26462
26628
|
} else {
|
|
26463
26629
|
console.log(
|
|
26464
|
-
|
|
26630
|
+
chalk175.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
26465
26631
|
);
|
|
26466
26632
|
}
|
|
26467
26633
|
}
|
|
26468
26634
|
function reportResults(issues, elapsed) {
|
|
26469
26635
|
if (issues.length > 0) displayIssues(issues);
|
|
26470
|
-
else console.log(
|
|
26471
|
-
console.log(
|
|
26636
|
+
else console.log(chalk175.green("No issues found"));
|
|
26637
|
+
console.log(chalk175.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
26472
26638
|
if (issues.length > 0) process.exit(1);
|
|
26473
26639
|
}
|
|
26474
26640
|
async function inspect(sln, options2) {
|
|
@@ -26479,7 +26645,7 @@ async function inspect(sln, options2) {
|
|
|
26479
26645
|
const scope = parseScope(options2.scope);
|
|
26480
26646
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
26481
26647
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
26482
|
-
console.log(
|
|
26648
|
+
console.log(chalk175.green("No changed .cs files found"));
|
|
26483
26649
|
return;
|
|
26484
26650
|
}
|
|
26485
26651
|
logScope(changedFiles2);
|
|
@@ -27292,7 +27458,7 @@ function aggregateCommitters(authorLists) {
|
|
|
27292
27458
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
27293
27459
|
import { unlinkSync as unlinkSync14, writeFileSync as writeFileSync34 } from "fs";
|
|
27294
27460
|
import { tmpdir as tmpdir5 } from "os";
|
|
27295
|
-
import { join as
|
|
27461
|
+
import { join as join73 } from "path";
|
|
27296
27462
|
function buildArgs2(queryFile, vars) {
|
|
27297
27463
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
27298
27464
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -27302,7 +27468,7 @@ function buildArgs2(queryFile, vars) {
|
|
|
27302
27468
|
return args;
|
|
27303
27469
|
}
|
|
27304
27470
|
function runGhGraphql(mutation, vars) {
|
|
27305
|
-
const queryFile =
|
|
27471
|
+
const queryFile = join73(tmpdir5(), `gh-query-${Date.now()}.graphql`);
|
|
27306
27472
|
writeFileSync34(queryFile, mutation);
|
|
27307
27473
|
try {
|
|
27308
27474
|
const result = spawnSync6("gh", buildArgs2(queryFile, vars), {
|
|
@@ -27367,25 +27533,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
27367
27533
|
}
|
|
27368
27534
|
|
|
27369
27535
|
// src/commands/github/printCountTable.ts
|
|
27370
|
-
import
|
|
27536
|
+
import chalk176 from "chalk";
|
|
27371
27537
|
function printCountTable(labelHeader, rows) {
|
|
27372
27538
|
const labelWidth = Math.max(
|
|
27373
27539
|
labelHeader.length,
|
|
27374
27540
|
...rows.map((row3) => row3.label.length)
|
|
27375
27541
|
);
|
|
27376
27542
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
27377
|
-
console.log(
|
|
27378
|
-
console.log(
|
|
27543
|
+
console.log(chalk176.dim(header));
|
|
27544
|
+
console.log(chalk176.dim("-".repeat(header.length)));
|
|
27379
27545
|
for (const row3 of rows) {
|
|
27380
27546
|
console.log(`${row3.label.padEnd(labelWidth)} ${row3.count}`);
|
|
27381
27547
|
}
|
|
27382
27548
|
}
|
|
27383
27549
|
|
|
27384
27550
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
27385
|
-
import
|
|
27551
|
+
import chalk177 from "chalk";
|
|
27386
27552
|
function printRepoAuthorBreakdown(repos2) {
|
|
27387
27553
|
for (const repo of repos2) {
|
|
27388
|
-
console.log(
|
|
27554
|
+
console.log(chalk177.bold(repo.name));
|
|
27389
27555
|
const authorWidth = Math.max(
|
|
27390
27556
|
0,
|
|
27391
27557
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -27459,10 +27625,10 @@ function parseSinceDate(value) {
|
|
|
27459
27625
|
}
|
|
27460
27626
|
|
|
27461
27627
|
// src/commands/github/issue/fixStructure/applyAndVerifySubtree.ts
|
|
27462
|
-
import
|
|
27628
|
+
import chalk179 from "chalk";
|
|
27463
27629
|
|
|
27464
27630
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
27465
|
-
import
|
|
27631
|
+
import chalk178 from "chalk";
|
|
27466
27632
|
|
|
27467
27633
|
// src/commands/github/issue/fixStructure/removeIssueLabels.ts
|
|
27468
27634
|
var MUTATION2 = `mutation($labelableId: ID!, $labelIds: [ID!]!) {
|
|
@@ -27499,7 +27665,7 @@ function writeLineNow(line) {
|
|
|
27499
27665
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
27500
27666
|
function applyFixStructurePlan(plan2) {
|
|
27501
27667
|
for (const entry of plan2.entries) {
|
|
27502
|
-
const where =
|
|
27668
|
+
const where = chalk178.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
27503
27669
|
const { typeChange, labelRemovals } = entry;
|
|
27504
27670
|
if (typeChange) {
|
|
27505
27671
|
writeLineNow(
|
|
@@ -27769,12 +27935,12 @@ function planSubtree(root2, context) {
|
|
|
27769
27935
|
function applyAndVerifySubtree(target, plan2, context) {
|
|
27770
27936
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) return;
|
|
27771
27937
|
applyFixStructurePlan(plan2);
|
|
27772
|
-
writeLineNow(
|
|
27938
|
+
writeLineNow(chalk179.dim("Re-walking the subtree to confirm"));
|
|
27773
27939
|
assertNoResidualDrift(
|
|
27774
27940
|
planSubtree(fetchRootIssue(target), context),
|
|
27775
27941
|
context.chain
|
|
27776
27942
|
);
|
|
27777
|
-
writeLineNow(
|
|
27943
|
+
writeLineNow(chalk179.green("Subtree normalised"));
|
|
27778
27944
|
}
|
|
27779
27945
|
|
|
27780
27946
|
// src/commands/github/issue/fixStructure/assertChainTypesExist.ts
|
|
@@ -27810,22 +27976,22 @@ function parseTypeChain(value) {
|
|
|
27810
27976
|
}
|
|
27811
27977
|
|
|
27812
27978
|
// src/commands/github/issue/fixStructure/printFixStructurePlan.ts
|
|
27813
|
-
import
|
|
27979
|
+
import chalk180 from "chalk";
|
|
27814
27980
|
function annotate(entry) {
|
|
27815
27981
|
const notes = [];
|
|
27816
27982
|
if (entry.level === null) {
|
|
27817
|
-
notes.push(
|
|
27983
|
+
notes.push(chalk180.red("deeper than the leaf level"));
|
|
27818
27984
|
} else if (entry.typeChange) {
|
|
27819
27985
|
notes.push(
|
|
27820
|
-
|
|
27986
|
+
chalk180.yellow(
|
|
27821
27987
|
`${entry.typeChange.from ?? "no type"} -> ${entry.typeChange.to}`
|
|
27822
27988
|
)
|
|
27823
27989
|
);
|
|
27824
27990
|
} else {
|
|
27825
|
-
notes.push(
|
|
27991
|
+
notes.push(chalk180.dim(entry.issue.typeName ?? "no type"));
|
|
27826
27992
|
}
|
|
27827
27993
|
for (const label of entry.labelRemovals) {
|
|
27828
|
-
notes.push(
|
|
27994
|
+
notes.push(chalk180.yellow(`-${label.name}`));
|
|
27829
27995
|
}
|
|
27830
27996
|
return notes;
|
|
27831
27997
|
}
|
|
@@ -27833,22 +27999,22 @@ function formatCount(count10, noun) {
|
|
|
27833
27999
|
return `${count10} ${noun}${count10 === 1 ? "" : "s"}`;
|
|
27834
28000
|
}
|
|
27835
28001
|
function printFixStructurePlan(plan2, chain2, apply) {
|
|
27836
|
-
writeLineNow(
|
|
28002
|
+
writeLineNow(chalk180.dim(`chain: ${chain2.join(" > ")}`));
|
|
27837
28003
|
for (const entry of plan2.entries) {
|
|
27838
28004
|
const indent4 = " ".repeat(entry.issue.depth);
|
|
27839
|
-
const name =
|
|
28005
|
+
const name = chalk180.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
27840
28006
|
writeLineNow(
|
|
27841
28007
|
`${indent4}${name} ${entry.issue.title} [${annotate(entry).join(", ")}]`
|
|
27842
28008
|
);
|
|
27843
28009
|
}
|
|
27844
28010
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) {
|
|
27845
|
-
writeLineNow(
|
|
28011
|
+
writeLineNow(chalk180.green("Nothing to change"));
|
|
27846
28012
|
return;
|
|
27847
28013
|
}
|
|
27848
28014
|
writeLineNow(
|
|
27849
28015
|
`${formatCount(plan2.typeChangeCount, "type change")}, ${formatCount(plan2.labelRemovalCount, "label removal")} planned`
|
|
27850
28016
|
);
|
|
27851
|
-
if (!apply) writeLineNow(
|
|
28017
|
+
if (!apply) writeLineNow(chalk180.dim("Dry run \u2014 nothing written"));
|
|
27852
28018
|
}
|
|
27853
28019
|
|
|
27854
28020
|
// src/commands/github/issue/parseRepoSlug.ts
|
|
@@ -28034,13 +28200,13 @@ function validateProposedContent(labels, title, body) {
|
|
|
28034
28200
|
}
|
|
28035
28201
|
|
|
28036
28202
|
// src/commands/github/issue/reviewProposedIssueComment.ts
|
|
28037
|
-
import { randomUUID as
|
|
28203
|
+
import { randomUUID as randomUUID13 } from "crypto";
|
|
28038
28204
|
async function reviewProposedIssueComment(title, body) {
|
|
28039
28205
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
28040
28206
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
28041
28207
|
await awaitPreviewApproval("GitHub issue comment preview", {
|
|
28042
28208
|
sessionId,
|
|
28043
|
-
requestId:
|
|
28209
|
+
requestId: randomUUID13(),
|
|
28044
28210
|
title,
|
|
28045
28211
|
body,
|
|
28046
28212
|
prNumber: null,
|
|
@@ -28558,13 +28724,13 @@ function resolveCreateIssueMetadata(options2) {
|
|
|
28558
28724
|
}
|
|
28559
28725
|
|
|
28560
28726
|
// src/commands/github/issue/reviewProposedIssue.ts
|
|
28561
|
-
import { randomUUID as
|
|
28727
|
+
import { randomUUID as randomUUID14 } from "crypto";
|
|
28562
28728
|
async function reviewProposedIssue(title, body, metadata2 = []) {
|
|
28563
28729
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
28564
28730
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return void 0;
|
|
28565
28731
|
return await awaitPreviewApproval("GitHub issue preview", {
|
|
28566
28732
|
sessionId,
|
|
28567
|
-
requestId:
|
|
28733
|
+
requestId: randomUUID14(),
|
|
28568
28734
|
title,
|
|
28569
28735
|
body,
|
|
28570
28736
|
prNumber: null,
|
|
@@ -28753,14 +28919,14 @@ function slugFromUrl(url) {
|
|
|
28753
28919
|
import { mkdirSync as mkdirSync21, writeFileSync as writeFileSync35 } from "fs";
|
|
28754
28920
|
|
|
28755
28921
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
28756
|
-
import { join as
|
|
28922
|
+
import { join as join74 } from "path";
|
|
28757
28923
|
function issueWorkingFile(slug2, number) {
|
|
28758
28924
|
const [owner = "unknown", repo = "unknown"] = slug2.split("/");
|
|
28759
|
-
const dir =
|
|
28925
|
+
const dir = join74(getStoreDir(), "github-issues", owner, repo);
|
|
28760
28926
|
return {
|
|
28761
28927
|
dir,
|
|
28762
|
-
bodyPath:
|
|
28763
|
-
metaPath:
|
|
28928
|
+
bodyPath: join74(dir, `${number}.md`),
|
|
28929
|
+
metaPath: join74(dir, `${number}.json`)
|
|
28764
28930
|
};
|
|
28765
28931
|
}
|
|
28766
28932
|
|
|
@@ -28864,7 +29030,7 @@ function pushUnchangedIssue(number, repo, target, fetchedAt, bodyPath) {
|
|
|
28864
29030
|
}
|
|
28865
29031
|
|
|
28866
29032
|
// src/commands/github/issue/reviewProposedIssueEdit.ts
|
|
28867
|
-
import { randomUUID as
|
|
29033
|
+
import { randomUUID as randomUUID15 } from "crypto";
|
|
28868
29034
|
async function reviewProposedIssueEdit(title, body, working) {
|
|
28869
29035
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
28870
29036
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return body;
|
|
@@ -28872,7 +29038,7 @@ async function reviewProposedIssueEdit(title, body, working) {
|
|
|
28872
29038
|
"GitHub issue edit preview",
|
|
28873
29039
|
{
|
|
28874
29040
|
sessionId,
|
|
28875
|
-
requestId:
|
|
29041
|
+
requestId: randomUUID15(),
|
|
28876
29042
|
title,
|
|
28877
29043
|
body,
|
|
28878
29044
|
prNumber: null,
|
|
@@ -29255,25 +29421,25 @@ function registerGithub(program) {
|
|
|
29255
29421
|
}
|
|
29256
29422
|
|
|
29257
29423
|
// src/commands/inbox/list.ts
|
|
29258
|
-
import
|
|
29424
|
+
import chalk181 from "chalk";
|
|
29259
29425
|
async function list3() {
|
|
29260
29426
|
const messages = await listInboxMessages(await getDb());
|
|
29261
29427
|
if (messages.length === 0) {
|
|
29262
|
-
console.log(
|
|
29428
|
+
console.log(chalk181.dim("No flagged messages; run assist inbox scan"));
|
|
29263
29429
|
return;
|
|
29264
29430
|
}
|
|
29265
29431
|
for (const message3 of messages) {
|
|
29266
29432
|
const when = (message3.receivedAt ?? message3.flaggedAt).toISOString();
|
|
29267
29433
|
console.log(
|
|
29268
|
-
`${
|
|
29434
|
+
`${chalk181.dim(when)} ${chalk181.cyan(message3.source)} ${chalk181.bold(message3.sender)}`
|
|
29269
29435
|
);
|
|
29270
29436
|
console.log(` ${message3.summary}`);
|
|
29271
|
-
console.log(` ${
|
|
29437
|
+
console.log(` ${chalk181.dim(message3.link)}`);
|
|
29272
29438
|
}
|
|
29273
29439
|
}
|
|
29274
29440
|
|
|
29275
29441
|
// src/commands/inbox/scan.ts
|
|
29276
|
-
import
|
|
29442
|
+
import chalk182 from "chalk";
|
|
29277
29443
|
|
|
29278
29444
|
// src/shared/formatTokens.ts
|
|
29279
29445
|
function formatTokens(n) {
|
|
@@ -29685,7 +29851,7 @@ async function scan() {
|
|
|
29685
29851
|
)
|
|
29686
29852
|
});
|
|
29687
29853
|
console.log(
|
|
29688
|
-
`Flagged ${flagged} message(s) needing a reply, ${
|
|
29854
|
+
`Flagged ${flagged} message(s) needing a reply, ${chalk182.bold(added)} new. ${chalk182.dim(formatScanUsage(usage))}`
|
|
29689
29855
|
);
|
|
29690
29856
|
}
|
|
29691
29857
|
|
|
@@ -29700,7 +29866,7 @@ function registerInbox(program) {
|
|
|
29700
29866
|
}
|
|
29701
29867
|
|
|
29702
29868
|
// src/commands/jira/acceptanceCriteria.ts
|
|
29703
|
-
import
|
|
29869
|
+
import chalk183 from "chalk";
|
|
29704
29870
|
|
|
29705
29871
|
// src/commands/jira/adfToText.ts
|
|
29706
29872
|
function renderInline(node) {
|
|
@@ -29767,7 +29933,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
29767
29933
|
const parsed = fetchIssue(issueKey, field);
|
|
29768
29934
|
const acValue = parsed?.fields?.[field];
|
|
29769
29935
|
if (!acValue) {
|
|
29770
|
-
console.log(
|
|
29936
|
+
console.log(chalk183.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
29771
29937
|
return;
|
|
29772
29938
|
}
|
|
29773
29939
|
if (typeof acValue === "string") {
|
|
@@ -29833,14 +29999,14 @@ async function jiraAuth() {
|
|
|
29833
29999
|
}
|
|
29834
30000
|
|
|
29835
30001
|
// src/commands/jira/viewIssue.ts
|
|
29836
|
-
import
|
|
30002
|
+
import chalk184 from "chalk";
|
|
29837
30003
|
function viewIssue2(issueKey) {
|
|
29838
30004
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
29839
30005
|
const fields = parsed?.fields;
|
|
29840
30006
|
const summary = fields?.summary;
|
|
29841
30007
|
const description = fields?.description;
|
|
29842
30008
|
if (summary) {
|
|
29843
|
-
console.log(
|
|
30009
|
+
console.log(chalk184.bold(summary));
|
|
29844
30010
|
}
|
|
29845
30011
|
if (description) {
|
|
29846
30012
|
if (summary) console.log();
|
|
@@ -29854,7 +30020,7 @@ function viewIssue2(issueKey) {
|
|
|
29854
30020
|
}
|
|
29855
30021
|
if (!summary && !description) {
|
|
29856
30022
|
console.log(
|
|
29857
|
-
|
|
30023
|
+
chalk184.yellow(`No summary or description found on ${issueKey}.`)
|
|
29858
30024
|
);
|
|
29859
30025
|
}
|
|
29860
30026
|
}
|
|
@@ -29885,7 +30051,7 @@ function registerRefineLaunch(program, resumeFlag) {
|
|
|
29885
30051
|
}
|
|
29886
30052
|
|
|
29887
30053
|
// src/commands/fixConflict.ts
|
|
29888
|
-
import { randomUUID as
|
|
30054
|
+
import { randomUUID as randomUUID16 } from "crypto";
|
|
29889
30055
|
|
|
29890
30056
|
// src/commands/review/checkoutPr.ts
|
|
29891
30057
|
import { execFileSync as execFileSync18 } from "child_process";
|
|
@@ -29948,11 +30114,11 @@ import { existsSync as existsSync61 } from "fs";
|
|
|
29948
30114
|
import { basename as basename21, dirname as dirname33 } from "path";
|
|
29949
30115
|
|
|
29950
30116
|
// src/commands/sessions/daemon/worktree/nextWorktreePath.ts
|
|
29951
|
-
import { basename as basename20, join as
|
|
30117
|
+
import { basename as basename20, join as join75 } from "path";
|
|
29952
30118
|
function nextWorktreePath(clone, base, isTaken) {
|
|
29953
30119
|
const name = basename20(clone);
|
|
29954
30120
|
for (let n = 2; n < 1e3; n++) {
|
|
29955
|
-
const candidate =
|
|
30121
|
+
const candidate = join75(base, `${name}-${n}`);
|
|
29956
30122
|
if (!isTaken(candidate)) return candidate;
|
|
29957
30123
|
}
|
|
29958
30124
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -30215,20 +30381,20 @@ function persistedTreeRoots() {
|
|
|
30215
30381
|
|
|
30216
30382
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
30217
30383
|
import { copyFileSync, existsSync as existsSync63, mkdirSync as mkdirSync22 } from "fs";
|
|
30218
|
-
import { dirname as dirname34, join as
|
|
30384
|
+
import { dirname as dirname34, join as join77 } from "path";
|
|
30219
30385
|
|
|
30220
30386
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
30221
30387
|
import { resolve as resolve19 } from "path";
|
|
30222
30388
|
|
|
30223
30389
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
30224
30390
|
import { existsSync as existsSync62 } from "fs";
|
|
30225
|
-
import { join as
|
|
30391
|
+
import { join as join76 } from "path";
|
|
30226
30392
|
function detectInstallCommand(dir) {
|
|
30227
|
-
if (!existsSync62(
|
|
30228
|
-
if (existsSync62(
|
|
30229
|
-
if (existsSync62(
|
|
30230
|
-
if (existsSync62(
|
|
30231
|
-
if (existsSync62(
|
|
30393
|
+
if (!existsSync62(join76(dir, "package.json"))) return null;
|
|
30394
|
+
if (existsSync62(join76(dir, "pnpm-lock.yaml"))) return "pnpm install";
|
|
30395
|
+
if (existsSync62(join76(dir, "yarn.lock"))) return "yarn install";
|
|
30396
|
+
if (existsSync62(join76(dir, "bun.lockb"))) return "bun install";
|
|
30397
|
+
if (existsSync62(join76(dir, "package-lock.json"))) return "npm ci";
|
|
30232
30398
|
return "npm install";
|
|
30233
30399
|
}
|
|
30234
30400
|
|
|
@@ -30393,9 +30559,9 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
30393
30559
|
}
|
|
30394
30560
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
30395
30561
|
for (const rel of copy) {
|
|
30396
|
-
const src =
|
|
30562
|
+
const src = join77(clone, rel);
|
|
30397
30563
|
if (!existsSync63(src)) continue;
|
|
30398
|
-
const dest =
|
|
30564
|
+
const dest = join77(worktreePath, rel);
|
|
30399
30565
|
try {
|
|
30400
30566
|
mkdirSync22(dirname34(dest), { recursive: true });
|
|
30401
30567
|
copyFileSync(src, dest);
|
|
@@ -30561,7 +30727,7 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
30561
30727
|
}
|
|
30562
30728
|
|
|
30563
30729
|
// src/commands/review/failCheckout.ts
|
|
30564
|
-
import
|
|
30730
|
+
import chalk185 from "chalk";
|
|
30565
30731
|
|
|
30566
30732
|
// src/commands/review/azCliProblem.ts
|
|
30567
30733
|
import { execFileSync as execFileSync17 } from "child_process";
|
|
@@ -30614,14 +30780,14 @@ function failCheckout(number, headRef, stale, from, checkout) {
|
|
|
30614
30780
|
gitSyncOrNull(process.cwd(), ["checkout", "--quiet", from]);
|
|
30615
30781
|
if (headRef && stale === "local-work")
|
|
30616
30782
|
console.error(
|
|
30617
|
-
|
|
30783
|
+
chalk185.red(
|
|
30618
30784
|
`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.`
|
|
30619
30785
|
)
|
|
30620
30786
|
);
|
|
30621
30787
|
const problem = checkout.file === "az" ? azCliProblem() : null;
|
|
30622
|
-
if (problem) console.error(
|
|
30788
|
+
if (problem) console.error(chalk185.red(problem));
|
|
30623
30789
|
console.error(
|
|
30624
|
-
|
|
30790
|
+
chalk185.red(`${checkout.file} ${checkout.args.join(" ")} failed; aborting.`)
|
|
30625
30791
|
);
|
|
30626
30792
|
process.exit(1);
|
|
30627
30793
|
}
|
|
@@ -30670,7 +30836,7 @@ function buildPrompt2(rebase) {
|
|
|
30670
30836
|
async function fixConflict(number, options2 = {}) {
|
|
30671
30837
|
const { resumeSessionId } = options2;
|
|
30672
30838
|
if (number && !resumeSessionId) await checkoutPr(number);
|
|
30673
|
-
const claudeSessionId = resumeSessionId ??
|
|
30839
|
+
const claudeSessionId = resumeSessionId ?? randomUUID16();
|
|
30674
30840
|
emitActivity({
|
|
30675
30841
|
kind: "command",
|
|
30676
30842
|
name: "fix-conflict",
|
|
@@ -30698,7 +30864,7 @@ function registerFixConflict(program, resumeFlag) {
|
|
|
30698
30864
|
}
|
|
30699
30865
|
|
|
30700
30866
|
// src/commands/reviewPrComments.ts
|
|
30701
|
-
import { randomUUID as
|
|
30867
|
+
import { randomUUID as randomUUID17 } from "crypto";
|
|
30702
30868
|
function buildPrompt3(number, announce, options2) {
|
|
30703
30869
|
const args = [
|
|
30704
30870
|
"/review-pr-comments",
|
|
@@ -30724,7 +30890,7 @@ async function reviewPrComments(number, options2 = {}) {
|
|
|
30724
30890
|
validateAnnounce(number, announce);
|
|
30725
30891
|
validateMode(options2);
|
|
30726
30892
|
if (number && !resumeSessionId) await checkoutPr(number);
|
|
30727
|
-
const claudeSessionId = resumeSessionId ??
|
|
30893
|
+
const claudeSessionId = resumeSessionId ?? randomUUID17();
|
|
30728
30894
|
emitActivity({
|
|
30729
30895
|
kind: "command",
|
|
30730
30896
|
name: "review-pr-comments",
|
|
@@ -30814,18 +30980,18 @@ function registerList(program) {
|
|
|
30814
30980
|
}
|
|
30815
30981
|
|
|
30816
30982
|
// src/commands/litellm/listModels.ts
|
|
30817
|
-
import
|
|
30983
|
+
import chalk187 from "chalk";
|
|
30818
30984
|
|
|
30819
30985
|
// src/commands/litellm/resolveLitellmConfig.ts
|
|
30820
|
-
import
|
|
30986
|
+
import chalk186 from "chalk";
|
|
30821
30987
|
function resolveLitellmConfig() {
|
|
30822
30988
|
const { config, missing } = readLitellmConfig();
|
|
30823
30989
|
if (!config) {
|
|
30824
|
-
console.error(
|
|
30990
|
+
console.error(chalk186.red("LiteLLM is not configured"));
|
|
30825
30991
|
for (const key of missing) {
|
|
30826
30992
|
const entry = litellmConfigHelp.find((help) => help.key === key);
|
|
30827
30993
|
console.error(
|
|
30828
|
-
|
|
30994
|
+
chalk186.red(` ${key} is not set. Set it with: ${entry?.setter}`)
|
|
30829
30995
|
);
|
|
30830
30996
|
}
|
|
30831
30997
|
process.exit(1);
|
|
@@ -30851,13 +31017,13 @@ async function listModels(options2) {
|
|
|
30851
31017
|
} catch (error) {
|
|
30852
31018
|
const reason4 = error instanceof Error ? error.message : String(error);
|
|
30853
31019
|
console.error(
|
|
30854
|
-
|
|
31020
|
+
chalk187.red(`Failed to reach LiteLLM at ${baseUrl}: ${reason4}`)
|
|
30855
31021
|
);
|
|
30856
31022
|
process.exit(1);
|
|
30857
31023
|
}
|
|
30858
31024
|
const body = await response.text();
|
|
30859
31025
|
if (!response.ok) {
|
|
30860
|
-
console.error(
|
|
31026
|
+
console.error(chalk187.red(`LiteLLM returned ${response.status}: ${body}`));
|
|
30861
31027
|
process.exit(1);
|
|
30862
31028
|
}
|
|
30863
31029
|
if (options2.json) {
|
|
@@ -30875,17 +31041,17 @@ function registerLitellm(program) {
|
|
|
30875
31041
|
}
|
|
30876
31042
|
|
|
30877
31043
|
// src/commands/mermaidExport.ts
|
|
30878
|
-
import { mkdirSync as mkdirSync23, readdirSync as
|
|
31044
|
+
import { mkdirSync as mkdirSync23, readdirSync as readdirSync13 } from "fs";
|
|
30879
31045
|
import { resolve as resolve21 } from "path";
|
|
30880
|
-
import
|
|
31046
|
+
import chalk190 from "chalk";
|
|
30881
31047
|
|
|
30882
31048
|
// src/commands/mermaid/exportFile.ts
|
|
30883
31049
|
import { readFileSync as readFileSync44, writeFileSync as writeFileSync36 } from "fs";
|
|
30884
31050
|
import { basename as basename22, extname as extname4, resolve as resolve20 } from "path";
|
|
30885
|
-
import
|
|
31051
|
+
import chalk189 from "chalk";
|
|
30886
31052
|
|
|
30887
31053
|
// src/commands/mermaid/renderBlock.ts
|
|
30888
|
-
import
|
|
31054
|
+
import chalk188 from "chalk";
|
|
30889
31055
|
async function renderBlock(krokiUrl, source) {
|
|
30890
31056
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
30891
31057
|
method: "POST",
|
|
@@ -30894,7 +31060,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
30894
31060
|
});
|
|
30895
31061
|
if (!response.ok) {
|
|
30896
31062
|
console.error(
|
|
30897
|
-
|
|
31063
|
+
chalk188.red(
|
|
30898
31064
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
30899
31065
|
)
|
|
30900
31066
|
);
|
|
@@ -30912,19 +31078,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
30912
31078
|
if (onlyIndex !== void 0) {
|
|
30913
31079
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
30914
31080
|
console.error(
|
|
30915
|
-
|
|
31081
|
+
chalk189.red(
|
|
30916
31082
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
30917
31083
|
)
|
|
30918
31084
|
);
|
|
30919
31085
|
process.exit(1);
|
|
30920
31086
|
}
|
|
30921
31087
|
console.log(
|
|
30922
|
-
|
|
31088
|
+
chalk189.gray(
|
|
30923
31089
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
30924
31090
|
)
|
|
30925
31091
|
);
|
|
30926
31092
|
} else {
|
|
30927
|
-
console.log(
|
|
31093
|
+
console.log(chalk189.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
30928
31094
|
}
|
|
30929
31095
|
for (const [i, source] of blocks.entries()) {
|
|
30930
31096
|
const idx = i + 1;
|
|
@@ -30932,7 +31098,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
30932
31098
|
const outPath = resolve20(outDir, `${stem}-${idx}.svg`);
|
|
30933
31099
|
const svg = await renderBlock(krokiUrl, source);
|
|
30934
31100
|
writeFileSync36(outPath, svg, "utf8");
|
|
30935
|
-
console.log(
|
|
31101
|
+
console.log(chalk189.green(` \u2192 ${outPath}`));
|
|
30936
31102
|
}
|
|
30937
31103
|
}
|
|
30938
31104
|
function extractMermaidBlocks(markdown) {
|
|
@@ -30948,18 +31114,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
30948
31114
|
if (options2.index !== void 0) {
|
|
30949
31115
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
30950
31116
|
console.error(
|
|
30951
|
-
|
|
31117
|
+
chalk190.red(`--index must be a positive integer (got ${options2.index})`)
|
|
30952
31118
|
);
|
|
30953
31119
|
process.exit(1);
|
|
30954
31120
|
}
|
|
30955
31121
|
if (!file) {
|
|
30956
|
-
console.error(
|
|
31122
|
+
console.error(chalk190.red("--index requires a file argument"));
|
|
30957
31123
|
process.exit(1);
|
|
30958
31124
|
}
|
|
30959
31125
|
}
|
|
30960
|
-
const files = file ? [file] :
|
|
31126
|
+
const files = file ? [file] : readdirSync13(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
30961
31127
|
if (files.length === 0) {
|
|
30962
|
-
console.log(
|
|
31128
|
+
console.log(chalk190.gray("No markdown files found in current directory."));
|
|
30963
31129
|
return;
|
|
30964
31130
|
}
|
|
30965
31131
|
for (const f of files) {
|
|
@@ -31105,7 +31271,7 @@ function extractToSave(details, cwd = process.cwd()) {
|
|
|
31105
31271
|
}
|
|
31106
31272
|
|
|
31107
31273
|
// src/commands/miro/keptTexts.ts
|
|
31108
|
-
import
|
|
31274
|
+
import chalk191 from "chalk";
|
|
31109
31275
|
|
|
31110
31276
|
// src/commands/miro/applyIgnore.ts
|
|
31111
31277
|
function applyIgnore(texts, ignore3) {
|
|
@@ -31144,7 +31310,7 @@ function warnUnmatched(file, unmatched) {
|
|
|
31144
31310
|
if (unmatched.length === 0) return;
|
|
31145
31311
|
const entries = unmatched.map((entry) => ` - ${entry}`).join("\n");
|
|
31146
31312
|
console.error(
|
|
31147
|
-
|
|
31313
|
+
chalk191.yellow(
|
|
31148
31314
|
`${unmatched.length} ${unmatched.length === 1 ? "entry" : "entries"} in ${file} matched no box text:
|
|
31149
31315
|
${entries}`
|
|
31150
31316
|
)
|
|
@@ -31266,7 +31432,7 @@ async function offerSaveExtract(extract2, options2, paths = {}) {
|
|
|
31266
31432
|
}
|
|
31267
31433
|
|
|
31268
31434
|
// src/commands/miro/pickAnchors.ts
|
|
31269
|
-
import { randomUUID as
|
|
31435
|
+
import { randomUUID as randomUUID18 } from "crypto";
|
|
31270
31436
|
|
|
31271
31437
|
// src/commands/miro/isBox.ts
|
|
31272
31438
|
var boxTypes = /* @__PURE__ */ new Set(["shape", "sticky_note"]);
|
|
@@ -31287,7 +31453,7 @@ async function pickAnchors(sessionId, items2) {
|
|
|
31287
31453
|
"Miro anchor selection",
|
|
31288
31454
|
{
|
|
31289
31455
|
sessionId,
|
|
31290
|
-
requestId:
|
|
31456
|
+
requestId: randomUUID18(),
|
|
31291
31457
|
title: "Pick the top-left then the bottom-right box",
|
|
31292
31458
|
body: encodeMiroBoardPreview(items2),
|
|
31293
31459
|
prNumber: null,
|
|
@@ -31345,7 +31511,7 @@ function readMiroItems(file) {
|
|
|
31345
31511
|
}
|
|
31346
31512
|
|
|
31347
31513
|
// src/commands/miro/resolveExtractOptions.ts
|
|
31348
|
-
import
|
|
31514
|
+
import chalk192 from "chalk";
|
|
31349
31515
|
|
|
31350
31516
|
// src/commands/miro/extractLayers.ts
|
|
31351
31517
|
function extractsIn(layer) {
|
|
@@ -31423,7 +31589,7 @@ function resolveExtractOptions(name, options2, paths) {
|
|
|
31423
31589
|
paths.cwd,
|
|
31424
31590
|
paths.globalConfigPath
|
|
31425
31591
|
);
|
|
31426
|
-
console.error(
|
|
31592
|
+
console.error(chalk192.dim(`Extract "${name}" from ${resolved.from}`));
|
|
31427
31593
|
return resolved.options;
|
|
31428
31594
|
}
|
|
31429
31595
|
|
|
@@ -31528,7 +31694,7 @@ function registerMiro(program) {
|
|
|
31528
31694
|
import { mkdir as mkdir6 } from "fs/promises";
|
|
31529
31695
|
import { createServer as createServer2 } from "http";
|
|
31530
31696
|
import { dirname as dirname37 } from "path";
|
|
31531
|
-
import
|
|
31697
|
+
import chalk194 from "chalk";
|
|
31532
31698
|
|
|
31533
31699
|
// src/commands/netcap/corsHeaders.ts
|
|
31534
31700
|
var corsHeaders = {
|
|
@@ -31606,15 +31772,15 @@ function createNetcapHandler(options2) {
|
|
|
31606
31772
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
31607
31773
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
31608
31774
|
import { networkInterfaces } from "os";
|
|
31609
|
-
import { join as
|
|
31610
|
-
import
|
|
31775
|
+
import { join as join79 } from "path";
|
|
31776
|
+
import chalk193 from "chalk";
|
|
31611
31777
|
|
|
31612
31778
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
31613
|
-
import { dirname as dirname36, join as
|
|
31779
|
+
import { dirname as dirname36, join as join78 } from "path";
|
|
31614
31780
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
31615
31781
|
var moduleDir2 = dirname36(fileURLToPath7(import.meta.url));
|
|
31616
31782
|
function netcapExtensionDir() {
|
|
31617
|
-
return
|
|
31783
|
+
return join78(moduleDir2, "commands", "netcap", "netcap-extension");
|
|
31618
31784
|
}
|
|
31619
31785
|
|
|
31620
31786
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -31629,7 +31795,7 @@ function lanIPv4() {
|
|
|
31629
31795
|
return void 0;
|
|
31630
31796
|
}
|
|
31631
31797
|
async function configureBackground(dir, host, port, filter) {
|
|
31632
|
-
const file =
|
|
31798
|
+
const file = join79(dir, "background.js");
|
|
31633
31799
|
const source = await readFile7(file, "utf8");
|
|
31634
31800
|
await writeFile6(
|
|
31635
31801
|
file,
|
|
@@ -31651,7 +31817,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
31651
31817
|
const host = lanIPv4();
|
|
31652
31818
|
if (!host) {
|
|
31653
31819
|
console.log(
|
|
31654
|
-
|
|
31820
|
+
chalk193.yellow("could not determine the WSL IP for the extension")
|
|
31655
31821
|
);
|
|
31656
31822
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
31657
31823
|
return source;
|
|
@@ -31662,27 +31828,27 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
31662
31828
|
return WSL_WINDOWS_PATH3;
|
|
31663
31829
|
} catch {
|
|
31664
31830
|
console.log(
|
|
31665
|
-
|
|
31831
|
+
chalk193.yellow(`could not copy extension to ${WSL_WINDOWS_PATH3}`)
|
|
31666
31832
|
);
|
|
31667
31833
|
return source;
|
|
31668
31834
|
}
|
|
31669
31835
|
}
|
|
31670
31836
|
|
|
31671
31837
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
31672
|
-
import { isAbsolute as isAbsolute5, join as
|
|
31838
|
+
import { isAbsolute as isAbsolute5, join as join81, resolve as resolve23 } from "path";
|
|
31673
31839
|
|
|
31674
31840
|
// src/commands/netcap/defaultCapturePath.ts
|
|
31675
31841
|
import { homedir as homedir25 } from "os";
|
|
31676
|
-
import { join as
|
|
31842
|
+
import { join as join80 } from "path";
|
|
31677
31843
|
function defaultCapturePath() {
|
|
31678
|
-
return
|
|
31844
|
+
return join80(homedir25(), ".assist", "netcap", "capture.jsonl");
|
|
31679
31845
|
}
|
|
31680
31846
|
|
|
31681
31847
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
31682
31848
|
function resolveNetcapOutPath(out) {
|
|
31683
31849
|
if (!out) return defaultCapturePath();
|
|
31684
31850
|
const dir = isAbsolute5(out) ? out : resolve23(process.cwd(), out);
|
|
31685
|
-
return
|
|
31851
|
+
return join81(dir, "capture.jsonl");
|
|
31686
31852
|
}
|
|
31687
31853
|
|
|
31688
31854
|
// src/commands/netcap/netcap.ts
|
|
@@ -31695,30 +31861,30 @@ async function netcap(options2) {
|
|
|
31695
31861
|
let count10 = 0;
|
|
31696
31862
|
const handler = createNetcapHandler({
|
|
31697
31863
|
outPath,
|
|
31698
|
-
onPing: () => console.log(
|
|
31864
|
+
onPing: () => console.log(chalk194.dim("ping from extension")),
|
|
31699
31865
|
onCapture: (entry) => {
|
|
31700
31866
|
count10 += 1;
|
|
31701
31867
|
console.log(
|
|
31702
|
-
|
|
31703
|
-
|
|
31868
|
+
chalk194.green(`captured #${count10}`),
|
|
31869
|
+
chalk194.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
31704
31870
|
);
|
|
31705
31871
|
}
|
|
31706
31872
|
});
|
|
31707
31873
|
const server = createServer2(handler);
|
|
31708
31874
|
server.listen(port, () => {
|
|
31709
31875
|
console.log(
|
|
31710
|
-
|
|
31876
|
+
chalk194.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
31711
31877
|
);
|
|
31712
|
-
console.log(
|
|
31878
|
+
console.log(chalk194.dim(`appending captures to ${outPath}`));
|
|
31713
31879
|
if (filter)
|
|
31714
|
-
console.log(
|
|
31715
|
-
console.log(
|
|
31716
|
-
console.log(
|
|
31880
|
+
console.log(chalk194.dim(`forwarding only URLs matching "${filter}"`));
|
|
31881
|
+
console.log(chalk194.dim(`load the unpacked extension from ${extensionPath}`));
|
|
31882
|
+
console.log(chalk194.dim("press Ctrl-C to stop"));
|
|
31717
31883
|
});
|
|
31718
31884
|
process.on("SIGINT", () => {
|
|
31719
31885
|
server.close();
|
|
31720
31886
|
console.log(
|
|
31721
|
-
|
|
31887
|
+
chalk194.bold(
|
|
31722
31888
|
`
|
|
31723
31889
|
netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
31724
31890
|
)
|
|
@@ -31729,8 +31895,8 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
31729
31895
|
|
|
31730
31896
|
// src/commands/netcap/netcapExtract.ts
|
|
31731
31897
|
import { writeFileSync as writeFileSync38 } from "fs";
|
|
31732
|
-
import { join as
|
|
31733
|
-
import
|
|
31898
|
+
import { join as join82 } from "path";
|
|
31899
|
+
import chalk195 from "chalk";
|
|
31734
31900
|
|
|
31735
31901
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
31736
31902
|
import { readFileSync as readFileSync47 } from "fs";
|
|
@@ -32174,12 +32340,12 @@ function extractPostsFromCapture(captureFile) {
|
|
|
32174
32340
|
function netcapExtract(file) {
|
|
32175
32341
|
const captureFile = file ?? defaultCapturePath();
|
|
32176
32342
|
const posts = extractPostsFromCapture(captureFile);
|
|
32177
|
-
const outFile =
|
|
32343
|
+
const outFile = join82(captureFile, "..", "posts.json");
|
|
32178
32344
|
writeFileSync38(outFile, `${JSON.stringify(posts, null, 2)}
|
|
32179
32345
|
`);
|
|
32180
32346
|
console.log(
|
|
32181
|
-
|
|
32182
|
-
|
|
32347
|
+
chalk195.green(`extracted ${posts.length} posts`),
|
|
32348
|
+
chalk195.dim(`-> ${outFile}`)
|
|
32183
32349
|
);
|
|
32184
32350
|
}
|
|
32185
32351
|
|
|
@@ -32200,7 +32366,7 @@ function registerNetcap(program) {
|
|
|
32200
32366
|
}
|
|
32201
32367
|
|
|
32202
32368
|
// src/commands/news/add.ts
|
|
32203
|
-
import
|
|
32369
|
+
import chalk196 from "chalk";
|
|
32204
32370
|
import enquirer8 from "enquirer";
|
|
32205
32371
|
async function add2(url) {
|
|
32206
32372
|
if (!url) {
|
|
@@ -32221,25 +32387,25 @@ async function add2(url) {
|
|
|
32221
32387
|
}
|
|
32222
32388
|
const added = await addFeed(await getDb(), url);
|
|
32223
32389
|
if (!added) {
|
|
32224
|
-
console.log(
|
|
32390
|
+
console.log(chalk196.yellow("Feed already exists"));
|
|
32225
32391
|
return;
|
|
32226
32392
|
}
|
|
32227
|
-
console.log(
|
|
32393
|
+
console.log(chalk196.green(`Added feed: ${url}`));
|
|
32228
32394
|
}
|
|
32229
32395
|
|
|
32230
32396
|
// src/commands/news/list.ts
|
|
32231
|
-
import
|
|
32397
|
+
import chalk197 from "chalk";
|
|
32232
32398
|
async function list4() {
|
|
32233
32399
|
const urls = await listFeeds(await getDb());
|
|
32234
32400
|
if (urls.length === 0) {
|
|
32235
|
-
console.log(
|
|
32401
|
+
console.log(chalk197.dim("No feeds; add one with assist news add <url>"));
|
|
32236
32402
|
return;
|
|
32237
32403
|
}
|
|
32238
32404
|
for (const url of urls) console.log(url);
|
|
32239
32405
|
}
|
|
32240
32406
|
|
|
32241
32407
|
// src/commands/news/remove.ts
|
|
32242
|
-
import
|
|
32408
|
+
import chalk198 from "chalk";
|
|
32243
32409
|
|
|
32244
32410
|
// src/commands/backlog/removeFeed.ts
|
|
32245
32411
|
import { eq as eq50 } from "drizzle-orm";
|
|
@@ -32252,10 +32418,10 @@ async function removeFeed(db, url) {
|
|
|
32252
32418
|
async function remove(url) {
|
|
32253
32419
|
const removed = await removeFeed(await getDb(), url);
|
|
32254
32420
|
if (!removed) {
|
|
32255
|
-
console.log(
|
|
32421
|
+
console.log(chalk198.yellow(`No feed matches ${url}`));
|
|
32256
32422
|
return;
|
|
32257
32423
|
}
|
|
32258
|
-
console.log(
|
|
32424
|
+
console.log(chalk198.green(`Removed feed: ${url}`));
|
|
32259
32425
|
}
|
|
32260
32426
|
|
|
32261
32427
|
// src/commands/registerNews.ts
|
|
@@ -32308,7 +32474,7 @@ function registerPiHook(program) {
|
|
|
32308
32474
|
}
|
|
32309
32475
|
|
|
32310
32476
|
// src/commands/prompts/printPromptsTable.ts
|
|
32311
|
-
import
|
|
32477
|
+
import chalk199 from "chalk";
|
|
32312
32478
|
function truncate2(str, max) {
|
|
32313
32479
|
if (str.length <= max) return str;
|
|
32314
32480
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -32326,14 +32492,14 @@ function printPromptsTable(rows) {
|
|
|
32326
32492
|
"Command".padEnd(commandWidth),
|
|
32327
32493
|
"Repos"
|
|
32328
32494
|
].join(" ");
|
|
32329
|
-
console.log(
|
|
32330
|
-
console.log(
|
|
32495
|
+
console.log(chalk199.dim(header));
|
|
32496
|
+
console.log(chalk199.dim("-".repeat(header.length)));
|
|
32331
32497
|
for (const row3 of rows) {
|
|
32332
32498
|
const count10 = String(row3.count).padStart(countWidth);
|
|
32333
32499
|
const tool = row3.tool.padEnd(toolWidth);
|
|
32334
32500
|
const command = truncate2(row3.command, 60).padEnd(commandWidth);
|
|
32335
32501
|
console.log(
|
|
32336
|
-
`${
|
|
32502
|
+
`${chalk199.yellow(count10)} ${tool} ${command} ${chalk199.dim(row3.repos)}`
|
|
32337
32503
|
);
|
|
32338
32504
|
}
|
|
32339
32505
|
}
|
|
@@ -32371,26 +32537,26 @@ import { execSync as execSync41 } from "child_process";
|
|
|
32371
32537
|
import enquirer9 from "enquirer";
|
|
32372
32538
|
|
|
32373
32539
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
32374
|
-
import
|
|
32540
|
+
import chalk200 from "chalk";
|
|
32375
32541
|
var STATUS_MAP = {
|
|
32376
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
32377
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
32542
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk200.magenta("merged"), date: pr.mergedAt } : null,
|
|
32543
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk200.red("closed"), date: pr.closedAt } : null
|
|
32378
32544
|
};
|
|
32379
32545
|
function defaultStatus(pr) {
|
|
32380
|
-
return { label:
|
|
32546
|
+
return { label: chalk200.green("opened"), date: pr.createdAt };
|
|
32381
32547
|
}
|
|
32382
32548
|
function getStatus2(pr) {
|
|
32383
32549
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
32384
32550
|
}
|
|
32385
|
-
function
|
|
32551
|
+
function formatDate2(dateStr) {
|
|
32386
32552
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
32387
32553
|
}
|
|
32388
32554
|
function formatPrHeader(pr, status2) {
|
|
32389
|
-
return `${
|
|
32555
|
+
return `${chalk200.cyan(`#${pr.number}`)} ${pr.title} ${chalk200.dim(`(${pr.author.login},`)} ${status2.label} ${chalk200.dim(`${formatDate2(status2.date)})`)}`;
|
|
32390
32556
|
}
|
|
32391
32557
|
function logPrDetails(pr) {
|
|
32392
32558
|
console.log(
|
|
32393
|
-
|
|
32559
|
+
chalk200.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
32394
32560
|
);
|
|
32395
32561
|
console.log();
|
|
32396
32562
|
}
|
|
@@ -32518,13 +32684,13 @@ function postReviewComment(vars) {
|
|
|
32518
32684
|
}
|
|
32519
32685
|
|
|
32520
32686
|
// src/commands/prs/reviewProposedPrComment.ts
|
|
32521
|
-
import { randomUUID as
|
|
32687
|
+
import { randomUUID as randomUUID19 } from "crypto";
|
|
32522
32688
|
async function reviewProposedPrComment(title, body, prNumber) {
|
|
32523
32689
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
32524
32690
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
32525
32691
|
await awaitPreviewApproval("PR comment preview", {
|
|
32526
32692
|
sessionId,
|
|
32527
|
-
requestId:
|
|
32693
|
+
requestId: randomUUID19(),
|
|
32528
32694
|
title,
|
|
32529
32695
|
body,
|
|
32530
32696
|
prNumber,
|
|
@@ -32570,9 +32736,9 @@ async function comment2(path109, line, body, options2 = {}) {
|
|
|
32570
32736
|
|
|
32571
32737
|
// src/commands/prs/commentsCachePath.ts
|
|
32572
32738
|
import { homedir as homedir26 } from "os";
|
|
32573
|
-
import { join as
|
|
32739
|
+
import { join as join83 } from "path";
|
|
32574
32740
|
function commentsCachePath(org, repo, prNumber) {
|
|
32575
|
-
return
|
|
32741
|
+
return join83(
|
|
32576
32742
|
homedir26(),
|
|
32577
32743
|
".assist",
|
|
32578
32744
|
"pr-comments",
|
|
@@ -32607,19 +32773,19 @@ function deleteCommentsCache(org, repo, prNumber) {
|
|
|
32607
32773
|
}
|
|
32608
32774
|
|
|
32609
32775
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
32610
|
-
import { readdirSync as
|
|
32611
|
-
import { join as
|
|
32776
|
+
import { readdirSync as readdirSync14, unlinkSync as unlinkSync16 } from "fs";
|
|
32777
|
+
import { join as join84 } from "path";
|
|
32612
32778
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
32613
32779
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
32614
|
-
const dir =
|
|
32780
|
+
const dir = join84(cwd, ".assist");
|
|
32615
32781
|
let entries;
|
|
32616
32782
|
try {
|
|
32617
|
-
entries =
|
|
32783
|
+
entries = readdirSync14(dir);
|
|
32618
32784
|
} catch {
|
|
32619
32785
|
return;
|
|
32620
32786
|
}
|
|
32621
32787
|
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
32622
|
-
unlinkSync16(
|
|
32788
|
+
unlinkSync16(join84(dir, entry));
|
|
32623
32789
|
}
|
|
32624
32790
|
}
|
|
32625
32791
|
|
|
@@ -32737,7 +32903,7 @@ function failAzureDevops(error) {
|
|
|
32737
32903
|
import { execFileSync as execFileSync20 } from "child_process";
|
|
32738
32904
|
import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync40 } from "fs";
|
|
32739
32905
|
import { tmpdir as tmpdir6 } from "os";
|
|
32740
|
-
import { join as
|
|
32906
|
+
import { join as join85 } from "path";
|
|
32741
32907
|
function azDevopsInvokeArgs(request, inFile) {
|
|
32742
32908
|
return [
|
|
32743
32909
|
"devops",
|
|
@@ -32772,8 +32938,8 @@ function runAz2(args) {
|
|
|
32772
32938
|
}
|
|
32773
32939
|
function invokeAzDevops(request) {
|
|
32774
32940
|
if (request.body === void 0) return runAz2(azDevopsInvokeArgs(request));
|
|
32775
|
-
const dir = mkdtempSync2(
|
|
32776
|
-
const inFile =
|
|
32941
|
+
const dir = mkdtempSync2(join85(tmpdir6(), "assist-az-"));
|
|
32942
|
+
const inFile = join85(dir, "body.json");
|
|
32777
32943
|
try {
|
|
32778
32944
|
writeFileSync40(inFile, JSON.stringify(request.body));
|
|
32779
32945
|
return runAz2(azDevopsInvokeArgs(request, inFile));
|
|
@@ -32959,13 +33125,13 @@ function agentFooter(unresolvedCount) {
|
|
|
32959
33125
|
}
|
|
32960
33126
|
|
|
32961
33127
|
// src/commands/prs/listComments/commentStyle.ts
|
|
32962
|
-
import
|
|
33128
|
+
import chalk201 from "chalk";
|
|
32963
33129
|
var plain = (text18) => text18;
|
|
32964
33130
|
function colouredState(state) {
|
|
32965
33131
|
const label = `[${state}]`;
|
|
32966
|
-
if (state === "APPROVED") return
|
|
32967
|
-
if (state === "CHANGES_REQUESTED") return
|
|
32968
|
-
return
|
|
33132
|
+
if (state === "APPROVED") return chalk201.green(label);
|
|
33133
|
+
if (state === "CHANGES_REQUESTED") return chalk201.red(label);
|
|
33134
|
+
return chalk201.yellow(label);
|
|
32969
33135
|
}
|
|
32970
33136
|
function commentStyle() {
|
|
32971
33137
|
if (isClaudeCode()) {
|
|
@@ -32979,9 +33145,9 @@ function commentStyle() {
|
|
|
32979
33145
|
};
|
|
32980
33146
|
}
|
|
32981
33147
|
return {
|
|
32982
|
-
cyan:
|
|
32983
|
-
bold:
|
|
32984
|
-
dim:
|
|
33148
|
+
cyan: chalk201.cyan,
|
|
33149
|
+
bold: chalk201.bold,
|
|
33150
|
+
dim: chalk201.dim,
|
|
32985
33151
|
state: colouredState,
|
|
32986
33152
|
diffHunk: true,
|
|
32987
33153
|
agent: false
|
|
@@ -33559,7 +33725,7 @@ function parseScreenshotSpecs(specs) {
|
|
|
33559
33725
|
}
|
|
33560
33726
|
|
|
33561
33727
|
// src/commands/prs/previewAndApplyEdit.ts
|
|
33562
|
-
import { randomUUID as
|
|
33728
|
+
import { randomUUID as randomUUID20 } from "crypto";
|
|
33563
33729
|
|
|
33564
33730
|
// src/commands/prs/stageScreenshots.ts
|
|
33565
33731
|
import { readFile as readFile8 } from "fs/promises";
|
|
@@ -33581,7 +33747,7 @@ function stageScreenshots(screenshots = []) {
|
|
|
33581
33747
|
async function previewAndApplyEdit(args) {
|
|
33582
33748
|
const decision = await awaitPreviewApproval("PR preview", {
|
|
33583
33749
|
sessionId: args.sessionId,
|
|
33584
|
-
requestId:
|
|
33750
|
+
requestId: randomUUID20(),
|
|
33585
33751
|
title: args.title ?? args.currentTitle,
|
|
33586
33752
|
body: args.body,
|
|
33587
33753
|
prNumber: args.number,
|
|
@@ -33916,7 +34082,7 @@ async function placePr(prNumber, title, body, options2, attachments = []) {
|
|
|
33916
34082
|
}
|
|
33917
34083
|
|
|
33918
34084
|
// src/commands/prs/previewAndPlace.ts
|
|
33919
|
-
import { randomUUID as
|
|
34085
|
+
import { randomUUID as randomUUID21 } from "crypto";
|
|
33920
34086
|
|
|
33921
34087
|
// src/commands/review/announcePr.ts
|
|
33922
34088
|
function announcePr(prNumber) {
|
|
@@ -33992,7 +34158,7 @@ function enableAutoMerge() {
|
|
|
33992
34158
|
async function previewAndPlace(args) {
|
|
33993
34159
|
const decision = await awaitPreviewApproval("PR preview", {
|
|
33994
34160
|
sessionId: args.sessionId,
|
|
33995
|
-
requestId:
|
|
34161
|
+
requestId: randomUUID21(),
|
|
33996
34162
|
title: args.title,
|
|
33997
34163
|
body: args.body,
|
|
33998
34164
|
prNumber: args.prNumber,
|
|
@@ -34455,16 +34621,16 @@ function buildPrsStatusReport(repoArguments, now = Date.now()) {
|
|
|
34455
34621
|
}
|
|
34456
34622
|
|
|
34457
34623
|
// src/commands/prs/status/printPrsStatus.ts
|
|
34458
|
-
import
|
|
34624
|
+
import chalk203 from "chalk";
|
|
34459
34625
|
|
|
34460
34626
|
// src/commands/prs/status/printPrStatus.ts
|
|
34461
|
-
import
|
|
34627
|
+
import chalk202 from "chalk";
|
|
34462
34628
|
function flags(pr) {
|
|
34463
34629
|
const markers = [];
|
|
34464
34630
|
if (pr.isDraft) markers.push("draft");
|
|
34465
34631
|
if (pr.isDoNotMerge) markers.push("do not merge");
|
|
34466
34632
|
if (pr.isBot) markers.push("bot");
|
|
34467
|
-
return markers.length ? ` ${
|
|
34633
|
+
return markers.length ? ` ${chalk202.yellow(`[${markers.join(", ")}]`)}` : "";
|
|
34468
34634
|
}
|
|
34469
34635
|
function updated(pr) {
|
|
34470
34636
|
return pr.ageHours === null ? "updated unknown" : `updated ${pr.age} ago`;
|
|
@@ -34478,35 +34644,35 @@ function reviewLine(pr) {
|
|
|
34478
34644
|
function checkLines(pr) {
|
|
34479
34645
|
const lines2 = [];
|
|
34480
34646
|
if (pr.checks.failing.length) {
|
|
34481
|
-
lines2.push(
|
|
34647
|
+
lines2.push(chalk202.red(`failing: ${pr.checks.failing.join(", ")}`));
|
|
34482
34648
|
}
|
|
34483
34649
|
if (pr.checks.pending.length) {
|
|
34484
|
-
lines2.push(
|
|
34650
|
+
lines2.push(chalk202.yellow(`pending: ${pr.checks.pending.join(", ")}`));
|
|
34485
34651
|
}
|
|
34486
34652
|
return lines2;
|
|
34487
34653
|
}
|
|
34488
34654
|
function threadsLine(pr) {
|
|
34489
34655
|
if (pr.unresolvedThreads === null) {
|
|
34490
|
-
return
|
|
34656
|
+
return chalk202.dim("unresolved comments: unknown");
|
|
34491
34657
|
}
|
|
34492
34658
|
if (pr.unresolvedThreads === 0) return null;
|
|
34493
|
-
return
|
|
34659
|
+
return chalk202.yellow(`unresolved comments: ${pr.unresolvedThreads}`);
|
|
34494
34660
|
}
|
|
34495
34661
|
function mergeableLine(pr) {
|
|
34496
|
-
if (pr.mergeable === "CONFLICTING") return
|
|
34662
|
+
if (pr.mergeable === "CONFLICTING") return chalk202.red("conflicting");
|
|
34497
34663
|
if (pr.mergeable === "MERGEABLE") return null;
|
|
34498
|
-
return
|
|
34664
|
+
return chalk202.dim(`mergeable: ${pr.mergeable.toLowerCase()}`);
|
|
34499
34665
|
}
|
|
34500
34666
|
function printPrStatus(pr) {
|
|
34501
34667
|
console.log(
|
|
34502
|
-
` ${
|
|
34668
|
+
` ${chalk202.cyan(`#${pr.number}`)} ${pr.title} ${chalk202.dim(`(${pr.author}, ${updated(pr)})`)}${flags(pr)}`
|
|
34503
34669
|
);
|
|
34504
34670
|
const details = [
|
|
34505
34671
|
reviewLine(pr),
|
|
34506
34672
|
...checkLines(pr),
|
|
34507
34673
|
threadsLine(pr),
|
|
34508
34674
|
mergeableLine(pr),
|
|
34509
|
-
|
|
34675
|
+
chalk202.dim(pr.url)
|
|
34510
34676
|
];
|
|
34511
34677
|
for (const detail of details) {
|
|
34512
34678
|
if (detail) console.log(` ${detail}`);
|
|
@@ -34517,17 +34683,17 @@ function printPrStatus(pr) {
|
|
|
34517
34683
|
function printPrsStatus(report) {
|
|
34518
34684
|
for (const repo of report.repos) {
|
|
34519
34685
|
const count10 = repo.pullRequests.length;
|
|
34520
|
-
console.log(`${
|
|
34686
|
+
console.log(`${chalk203.bold(repo.repo)} ${chalk203.dim(`(${count10} open)`)}`);
|
|
34521
34687
|
for (const pr of repo.pullRequests) {
|
|
34522
34688
|
printPrStatus(pr);
|
|
34523
34689
|
}
|
|
34524
|
-
if (count10 === 0) console.log(
|
|
34690
|
+
if (count10 === 0) console.log(chalk203.dim(" no open pull requests"));
|
|
34525
34691
|
console.log();
|
|
34526
34692
|
}
|
|
34527
34693
|
if (report.errors.length === 0) return;
|
|
34528
|
-
console.log(
|
|
34694
|
+
console.log(chalk203.bold("Errors"));
|
|
34529
34695
|
for (const failure of report.errors) {
|
|
34530
|
-
console.log(` ${
|
|
34696
|
+
console.log(` ${chalk203.red(failure.repo)}: ${failure.error}`);
|
|
34531
34697
|
}
|
|
34532
34698
|
console.log();
|
|
34533
34699
|
}
|
|
@@ -34755,10 +34921,10 @@ function registerPrs(program) {
|
|
|
34755
34921
|
}
|
|
34756
34922
|
|
|
34757
34923
|
// src/commands/ravendb/ravendbAuth.ts
|
|
34758
|
-
import
|
|
34924
|
+
import chalk209 from "chalk";
|
|
34759
34925
|
|
|
34760
34926
|
// src/shared/createConnectionAuth.ts
|
|
34761
|
-
import
|
|
34927
|
+
import chalk204 from "chalk";
|
|
34762
34928
|
function listConnections(connections, format3) {
|
|
34763
34929
|
if (connections.length === 0) {
|
|
34764
34930
|
console.log("No connections configured.");
|
|
@@ -34771,7 +34937,7 @@ function listConnections(connections, format3) {
|
|
|
34771
34937
|
function removeConnection(connections, name, save) {
|
|
34772
34938
|
const filtered = connections.filter((c) => c.name !== name);
|
|
34773
34939
|
if (filtered.length === connections.length) {
|
|
34774
|
-
console.error(
|
|
34940
|
+
console.error(chalk204.red(`Connection "${name}" not found.`));
|
|
34775
34941
|
process.exit(1);
|
|
34776
34942
|
}
|
|
34777
34943
|
save(filtered);
|
|
@@ -34817,15 +34983,15 @@ function saveConnections(connections) {
|
|
|
34817
34983
|
}
|
|
34818
34984
|
|
|
34819
34985
|
// src/commands/ravendb/promptConnection.ts
|
|
34820
|
-
import
|
|
34986
|
+
import chalk207 from "chalk";
|
|
34821
34987
|
|
|
34822
34988
|
// src/commands/ravendb/selectOpSecret.ts
|
|
34823
|
-
import
|
|
34989
|
+
import chalk206 from "chalk";
|
|
34824
34990
|
import Enquirer2 from "enquirer";
|
|
34825
34991
|
|
|
34826
34992
|
// src/commands/ravendb/searchItems.ts
|
|
34827
34993
|
import { execSync as execSync48 } from "child_process";
|
|
34828
|
-
import
|
|
34994
|
+
import chalk205 from "chalk";
|
|
34829
34995
|
function opExec(args) {
|
|
34830
34996
|
return execSync48(`op ${args}`, {
|
|
34831
34997
|
encoding: "utf8",
|
|
@@ -34838,7 +35004,7 @@ function searchItems(search2) {
|
|
|
34838
35004
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
34839
35005
|
} catch {
|
|
34840
35006
|
console.error(
|
|
34841
|
-
|
|
35007
|
+
chalk205.red(
|
|
34842
35008
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
34843
35009
|
)
|
|
34844
35010
|
);
|
|
@@ -34852,7 +35018,7 @@ function getItemFields(itemId2) {
|
|
|
34852
35018
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
34853
35019
|
return item.fields.filter((f) => f.reference && f.label);
|
|
34854
35020
|
} catch {
|
|
34855
|
-
console.error(
|
|
35021
|
+
console.error(chalk205.red("Failed to get item details from 1Password."));
|
|
34856
35022
|
process.exit(1);
|
|
34857
35023
|
}
|
|
34858
35024
|
}
|
|
@@ -34871,7 +35037,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
34871
35037
|
}).run();
|
|
34872
35038
|
const items2 = searchItems(search2);
|
|
34873
35039
|
if (items2.length === 0) {
|
|
34874
|
-
console.error(
|
|
35040
|
+
console.error(chalk206.red(`No items found matching "${search2}".`));
|
|
34875
35041
|
process.exit(1);
|
|
34876
35042
|
}
|
|
34877
35043
|
const itemId2 = await selectOne(
|
|
@@ -34880,7 +35046,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
34880
35046
|
);
|
|
34881
35047
|
const fields = getItemFields(itemId2);
|
|
34882
35048
|
if (fields.length === 0) {
|
|
34883
|
-
console.error(
|
|
35049
|
+
console.error(chalk206.red("No fields with references found on this item."));
|
|
34884
35050
|
process.exit(1);
|
|
34885
35051
|
}
|
|
34886
35052
|
const ref = await selectOne(
|
|
@@ -34894,7 +35060,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
34894
35060
|
async function promptConnection(existingNames) {
|
|
34895
35061
|
const name = await promptInput("name", "Connection name:");
|
|
34896
35062
|
if (existingNames.includes(name)) {
|
|
34897
|
-
console.error(
|
|
35063
|
+
console.error(chalk207.red(`Connection "${name}" already exists.`));
|
|
34898
35064
|
process.exit(1);
|
|
34899
35065
|
}
|
|
34900
35066
|
const url = await promptInput(
|
|
@@ -34903,22 +35069,22 @@ async function promptConnection(existingNames) {
|
|
|
34903
35069
|
);
|
|
34904
35070
|
const database = await promptInput("database", "Database name:");
|
|
34905
35071
|
if (!name || !url || !database) {
|
|
34906
|
-
console.error(
|
|
35072
|
+
console.error(chalk207.red("All fields are required."));
|
|
34907
35073
|
process.exit(1);
|
|
34908
35074
|
}
|
|
34909
35075
|
const apiKeyRef = await selectOpSecret();
|
|
34910
|
-
console.log(
|
|
35076
|
+
console.log(chalk207.dim(`Using: ${apiKeyRef}`));
|
|
34911
35077
|
return { name, url, database, apiKeyRef };
|
|
34912
35078
|
}
|
|
34913
35079
|
|
|
34914
35080
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
34915
|
-
import
|
|
35081
|
+
import chalk208 from "chalk";
|
|
34916
35082
|
function ravendbSetConnection(name) {
|
|
34917
35083
|
const raw = loadGlobalConfigRaw();
|
|
34918
35084
|
const ravendb = raw.ravendb ?? {};
|
|
34919
35085
|
const connections = ravendb.connections ?? [];
|
|
34920
35086
|
if (!connections.some((c) => c.name === name)) {
|
|
34921
|
-
console.error(
|
|
35087
|
+
console.error(chalk208.red(`Connection "${name}" not found.`));
|
|
34922
35088
|
console.error(
|
|
34923
35089
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
34924
35090
|
);
|
|
@@ -34934,16 +35100,16 @@ function ravendbSetConnection(name) {
|
|
|
34934
35100
|
var ravendbAuth = createConnectionAuth({
|
|
34935
35101
|
load: loadConnections,
|
|
34936
35102
|
save: saveConnections,
|
|
34937
|
-
format: (c) => `${
|
|
35103
|
+
format: (c) => `${chalk209.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
34938
35104
|
promptNew: promptConnection,
|
|
34939
35105
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
34940
35106
|
});
|
|
34941
35107
|
|
|
34942
35108
|
// src/commands/ravendb/ravendbCollections.ts
|
|
34943
|
-
import
|
|
35109
|
+
import chalk213 from "chalk";
|
|
34944
35110
|
|
|
34945
35111
|
// src/commands/ravendb/ravenFetch.ts
|
|
34946
|
-
import
|
|
35112
|
+
import chalk211 from "chalk";
|
|
34947
35113
|
|
|
34948
35114
|
// src/commands/ravendb/getAccessToken.ts
|
|
34949
35115
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -34980,10 +35146,10 @@ ${errorText}`
|
|
|
34980
35146
|
|
|
34981
35147
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
34982
35148
|
import { execSync as execSync49 } from "child_process";
|
|
34983
|
-
import
|
|
35149
|
+
import chalk210 from "chalk";
|
|
34984
35150
|
function resolveOpSecret(reference) {
|
|
34985
35151
|
if (!reference.startsWith("op://")) {
|
|
34986
|
-
console.error(
|
|
35152
|
+
console.error(chalk210.red(`Invalid secret reference: must start with op://`));
|
|
34987
35153
|
process.exit(1);
|
|
34988
35154
|
}
|
|
34989
35155
|
try {
|
|
@@ -34993,7 +35159,7 @@ function resolveOpSecret(reference) {
|
|
|
34993
35159
|
}).trim();
|
|
34994
35160
|
} catch {
|
|
34995
35161
|
console.error(
|
|
34996
|
-
|
|
35162
|
+
chalk210.red(
|
|
34997
35163
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
34998
35164
|
)
|
|
34999
35165
|
);
|
|
@@ -35020,7 +35186,7 @@ async function ravenFetch(connection, path109) {
|
|
|
35020
35186
|
if (!response.ok) {
|
|
35021
35187
|
const body = await response.text();
|
|
35022
35188
|
console.error(
|
|
35023
|
-
|
|
35189
|
+
chalk211.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
35024
35190
|
);
|
|
35025
35191
|
console.error(body.substring(0, 500));
|
|
35026
35192
|
process.exit(1);
|
|
@@ -35029,7 +35195,7 @@ async function ravenFetch(connection, path109) {
|
|
|
35029
35195
|
}
|
|
35030
35196
|
|
|
35031
35197
|
// src/commands/ravendb/resolveConnection.ts
|
|
35032
|
-
import
|
|
35198
|
+
import chalk212 from "chalk";
|
|
35033
35199
|
function loadRavendb() {
|
|
35034
35200
|
const raw = loadGlobalConfigRaw();
|
|
35035
35201
|
const ravendb = raw.ravendb;
|
|
@@ -35043,7 +35209,7 @@ function resolveConnection(name) {
|
|
|
35043
35209
|
const connectionName = name ?? defaultConnection;
|
|
35044
35210
|
if (!connectionName) {
|
|
35045
35211
|
console.error(
|
|
35046
|
-
|
|
35212
|
+
chalk212.red(
|
|
35047
35213
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
35048
35214
|
)
|
|
35049
35215
|
);
|
|
@@ -35051,7 +35217,7 @@ function resolveConnection(name) {
|
|
|
35051
35217
|
}
|
|
35052
35218
|
const connection = connections.find((c) => c.name === connectionName);
|
|
35053
35219
|
if (!connection) {
|
|
35054
|
-
console.error(
|
|
35220
|
+
console.error(chalk212.red(`Connection "${connectionName}" not found.`));
|
|
35055
35221
|
console.error(
|
|
35056
35222
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
35057
35223
|
);
|
|
@@ -35082,15 +35248,15 @@ async function ravendbCollections(connectionName) {
|
|
|
35082
35248
|
return;
|
|
35083
35249
|
}
|
|
35084
35250
|
for (const c of collections) {
|
|
35085
|
-
console.log(`${
|
|
35251
|
+
console.log(`${chalk213.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
35086
35252
|
}
|
|
35087
35253
|
}
|
|
35088
35254
|
|
|
35089
35255
|
// src/commands/ravendb/ravendbQuery.ts
|
|
35090
|
-
import
|
|
35256
|
+
import chalk215 from "chalk";
|
|
35091
35257
|
|
|
35092
35258
|
// src/commands/ravendb/fetchAllPages.ts
|
|
35093
|
-
import
|
|
35259
|
+
import chalk214 from "chalk";
|
|
35094
35260
|
|
|
35095
35261
|
// src/commands/ravendb/buildQueryPath.ts
|
|
35096
35262
|
function buildQueryPath(opts) {
|
|
@@ -35128,7 +35294,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
35128
35294
|
allResults.push(...results);
|
|
35129
35295
|
start2 += results.length;
|
|
35130
35296
|
process.stderr.write(
|
|
35131
|
-
`\r${
|
|
35297
|
+
`\r${chalk214.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
35132
35298
|
);
|
|
35133
35299
|
if (start2 >= totalResults) break;
|
|
35134
35300
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -35143,7 +35309,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
35143
35309
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
35144
35310
|
const resolved = resolveArgs(connectionName, collection);
|
|
35145
35311
|
if (!resolved.collection && !options2.query) {
|
|
35146
|
-
console.error(
|
|
35312
|
+
console.error(chalk215.red("Provide a collection name or --query filter."));
|
|
35147
35313
|
process.exit(1);
|
|
35148
35314
|
}
|
|
35149
35315
|
const { collection: col } = resolved;
|
|
@@ -35178,7 +35344,7 @@ function registerRavendb(program) {
|
|
|
35178
35344
|
}
|
|
35179
35345
|
|
|
35180
35346
|
// src/commands/releases/releasesConfigure.ts
|
|
35181
|
-
import
|
|
35347
|
+
import chalk217 from "chalk";
|
|
35182
35348
|
|
|
35183
35349
|
// src/commands/config/parseRepoScopeFlag.ts
|
|
35184
35350
|
var REPO_SCOPE_FLAGS = {
|
|
@@ -35249,26 +35415,26 @@ function readStreamsInput(source) {
|
|
|
35249
35415
|
}
|
|
35250
35416
|
|
|
35251
35417
|
// src/commands/releases/reportDerivedStreams.ts
|
|
35252
|
-
import
|
|
35418
|
+
import chalk216 from "chalk";
|
|
35253
35419
|
function printDerived(stream) {
|
|
35254
35420
|
const environments = stream.nodes.flatMap((n) => n.environment ?? []);
|
|
35255
35421
|
const steps = stream.nodes.filter((n) => !n.environment);
|
|
35256
35422
|
console.log(
|
|
35257
|
-
`${
|
|
35423
|
+
`${chalk216.bold(stream.name)} ${chalk216.dim(`${stream.repo} \xB7 ${stream.workflow}`)}`
|
|
35258
35424
|
);
|
|
35259
35425
|
console.log(
|
|
35260
|
-
` environments: ${environments.join(", ") ||
|
|
35426
|
+
` environments: ${environments.join(", ") || chalk216.dim("none")}`
|
|
35261
35427
|
);
|
|
35262
35428
|
if (steps.length > 0)
|
|
35263
35429
|
console.log(
|
|
35264
35430
|
` steps: ${steps.map((n) => `${n.id} [${n.kind ?? "step"}]`).join(", ")}`
|
|
35265
35431
|
);
|
|
35266
35432
|
const edges = stream.edges.map(([from, to]) => `${from} \u2192 ${to}`);
|
|
35267
|
-
console.log(` edges: ${edges.join(", ") ||
|
|
35433
|
+
console.log(` edges: ${edges.join(", ") || chalk216.dim("none")}`);
|
|
35268
35434
|
}
|
|
35269
35435
|
function reportDerivedStreams(streams, target) {
|
|
35270
35436
|
for (const stream of streams) printDerived(stream);
|
|
35271
|
-
console.log(
|
|
35437
|
+
console.log(chalk216.dim(`Written to ${target}`));
|
|
35272
35438
|
}
|
|
35273
35439
|
|
|
35274
35440
|
// src/commands/releases/withCurrentRepo.ts
|
|
@@ -35359,8 +35525,8 @@ async function writeReleaseStreams(incoming, scope) {
|
|
|
35359
35525
|
|
|
35360
35526
|
// src/commands/releases/releasesConfigure.ts
|
|
35361
35527
|
function fail8(message3, details = []) {
|
|
35362
|
-
console.error(
|
|
35363
|
-
for (const detail of details) console.error(
|
|
35528
|
+
console.error(chalk217.red(message3));
|
|
35529
|
+
for (const detail of details) console.error(chalk217.red(` ${detail}`));
|
|
35364
35530
|
process.exitCode = 1;
|
|
35365
35531
|
}
|
|
35366
35532
|
function reportWritten(incoming, target) {
|
|
@@ -35393,23 +35559,23 @@ async function releasesConfigure(options2 = {}) {
|
|
|
35393
35559
|
}
|
|
35394
35560
|
|
|
35395
35561
|
// src/commands/releases/releasesList.ts
|
|
35396
|
-
import
|
|
35562
|
+
import chalk218 from "chalk";
|
|
35397
35563
|
function describeNode(node) {
|
|
35398
35564
|
if (node.environment) return `${node.id} \u2192 ${node.environment}`;
|
|
35399
35565
|
return `${node.id} (${node.kind ?? "step"})`;
|
|
35400
35566
|
}
|
|
35401
35567
|
function printStream(stream) {
|
|
35402
|
-
console.log(`${
|
|
35403
|
-
console.log(
|
|
35568
|
+
console.log(`${chalk218.bold(stream.name)} ${chalk218.dim(stream.repo)}`);
|
|
35569
|
+
console.log(chalk218.dim(` workflow: ${stream.workflow}`));
|
|
35404
35570
|
for (const node of stream.nodes) console.log(` ${describeNode(node)}`);
|
|
35405
35571
|
for (const [from, to] of stream.edges)
|
|
35406
|
-
console.log(
|
|
35572
|
+
console.log(chalk218.dim(` ${from} \u2192 ${to}`));
|
|
35407
35573
|
}
|
|
35408
35574
|
function releasesList() {
|
|
35409
35575
|
const streams = loadConfig().releases?.streams ?? [];
|
|
35410
35576
|
if (streams.length === 0) {
|
|
35411
35577
|
console.log(
|
|
35412
|
-
|
|
35578
|
+
chalk218.dim("No release streams configured under releases.streams.")
|
|
35413
35579
|
);
|
|
35414
35580
|
return;
|
|
35415
35581
|
}
|
|
@@ -35457,7 +35623,7 @@ function coverage() {
|
|
|
35457
35623
|
|
|
35458
35624
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
35459
35625
|
import path45 from "path";
|
|
35460
|
-
import
|
|
35626
|
+
import chalk220 from "chalk";
|
|
35461
35627
|
|
|
35462
35628
|
// src/commands/lint/lint/checkFileNames.ts
|
|
35463
35629
|
import fs23 from "fs";
|
|
@@ -35537,7 +35703,7 @@ function checkFileNames() {
|
|
|
35537
35703
|
}
|
|
35538
35704
|
|
|
35539
35705
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
35540
|
-
import
|
|
35706
|
+
import chalk219 from "chalk";
|
|
35541
35707
|
|
|
35542
35708
|
// src/commands/lint/lint/applyMoves.ts
|
|
35543
35709
|
import fs24 from "fs";
|
|
@@ -35622,25 +35788,25 @@ function fixFileNameViolations(moves) {
|
|
|
35622
35788
|
const start2 = performance.now();
|
|
35623
35789
|
const project = createLintProject();
|
|
35624
35790
|
const cwd = process.cwd();
|
|
35625
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
35791
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk219.green(line)));
|
|
35626
35792
|
const ms = (performance.now() - start2).toFixed(0);
|
|
35627
|
-
console.log(
|
|
35793
|
+
console.log(chalk219.dim(` Done in ${ms}ms`));
|
|
35628
35794
|
}
|
|
35629
35795
|
|
|
35630
35796
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
35631
35797
|
function reportViolations(violations) {
|
|
35632
|
-
console.error(
|
|
35798
|
+
console.error(chalk220.red("\nFile name check failed:\n"));
|
|
35633
35799
|
console.error(
|
|
35634
|
-
|
|
35800
|
+
chalk220.red(
|
|
35635
35801
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
35636
35802
|
)
|
|
35637
35803
|
);
|
|
35638
35804
|
for (const violation of violations) {
|
|
35639
|
-
console.error(
|
|
35640
|
-
console.error(
|
|
35805
|
+
console.error(chalk220.red(` ${violation.filePath}`));
|
|
35806
|
+
console.error(chalk220.gray(` Rename to: ${violation.suggestedName}
|
|
35641
35807
|
`));
|
|
35642
35808
|
}
|
|
35643
|
-
console.error(
|
|
35809
|
+
console.error(chalk220.dim(" Run with -f to auto-fix.\n"));
|
|
35644
35810
|
}
|
|
35645
35811
|
function runFileNameCheck(fix = false) {
|
|
35646
35812
|
const violations = checkFileNames();
|
|
@@ -35669,17 +35835,17 @@ function runFileNameCheck(fix = false) {
|
|
|
35669
35835
|
import fs26 from "fs";
|
|
35670
35836
|
|
|
35671
35837
|
// src/commands/lint/shared.ts
|
|
35672
|
-
import
|
|
35838
|
+
import chalk221 from "chalk";
|
|
35673
35839
|
function reportViolations2(violations, checkName2, errorMessage3, successMessage) {
|
|
35674
35840
|
if (violations.length > 0) {
|
|
35675
|
-
console.error(
|
|
35841
|
+
console.error(chalk221.red(`
|
|
35676
35842
|
${checkName2} failed:
|
|
35677
35843
|
`));
|
|
35678
|
-
console.error(
|
|
35844
|
+
console.error(chalk221.red(` ${errorMessage3}
|
|
35679
35845
|
`));
|
|
35680
35846
|
for (const violation of violations) {
|
|
35681
|
-
console.error(
|
|
35682
|
-
console.error(
|
|
35847
|
+
console.error(chalk221.red(` ${violation.filePath}:${violation.line}`));
|
|
35848
|
+
console.error(chalk221.gray(` ${violation.content}
|
|
35683
35849
|
`));
|
|
35684
35850
|
}
|
|
35685
35851
|
return false;
|
|
@@ -35903,8 +36069,8 @@ async function notify() {
|
|
|
35903
36069
|
import { execSync as execSync51 } from "child_process";
|
|
35904
36070
|
import { existsSync as existsSync66, mkdirSync as mkdirSync26, unlinkSync as unlinkSync17, writeFileSync as writeFileSync41 } from "fs";
|
|
35905
36071
|
import { tmpdir as tmpdir7 } from "os";
|
|
35906
|
-
import { join as
|
|
35907
|
-
import
|
|
36072
|
+
import { join as join86, resolve as resolve25 } from "path";
|
|
36073
|
+
import chalk222 from "chalk";
|
|
35908
36074
|
|
|
35909
36075
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
35910
36076
|
var captureWindowPs1 = `
|
|
@@ -36040,7 +36206,7 @@ function buildOutputPath(outputDir, processName) {
|
|
|
36040
36206
|
return resolve25(outputDir, `${processName}-${timestamp8}.png`);
|
|
36041
36207
|
}
|
|
36042
36208
|
function runPowerShellScript(processName, outputPath) {
|
|
36043
|
-
const scriptPath =
|
|
36209
|
+
const scriptPath = join86(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
|
|
36044
36210
|
writeFileSync41(scriptPath, captureWindowPs1, "utf8");
|
|
36045
36211
|
try {
|
|
36046
36212
|
execSync51(
|
|
@@ -36055,22 +36221,22 @@ function screenshot(processName) {
|
|
|
36055
36221
|
const config = loadConfig();
|
|
36056
36222
|
const outputDir = resolve25(config.screenshot.outputDir);
|
|
36057
36223
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
36058
|
-
console.log(
|
|
36224
|
+
console.log(chalk222.gray(`Capturing window for process "${processName}" ...`));
|
|
36059
36225
|
try {
|
|
36060
36226
|
runPowerShellScript(processName, outputPath);
|
|
36061
|
-
console.log(
|
|
36227
|
+
console.log(chalk222.green(`Screenshot saved: ${outputPath}`));
|
|
36062
36228
|
} catch (error) {
|
|
36063
36229
|
const msg = error instanceof Error ? error.message : String(error);
|
|
36064
|
-
console.error(
|
|
36230
|
+
console.error(chalk222.red(`Failed to capture screenshot: ${msg}`));
|
|
36065
36231
|
process.exit(1);
|
|
36066
36232
|
}
|
|
36067
36233
|
}
|
|
36068
36234
|
|
|
36069
36235
|
// src/commands/statusLine.ts
|
|
36070
|
-
import
|
|
36236
|
+
import chalk225 from "chalk";
|
|
36071
36237
|
|
|
36072
36238
|
// src/commands/buildLimitsSegment.ts
|
|
36073
|
-
import
|
|
36239
|
+
import chalk223 from "chalk";
|
|
36074
36240
|
|
|
36075
36241
|
// src/shared/rateLimitLevel.ts
|
|
36076
36242
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -36108,9 +36274,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
36108
36274
|
|
|
36109
36275
|
// src/commands/buildLimitsSegment.ts
|
|
36110
36276
|
var LEVEL_COLOR = {
|
|
36111
|
-
ok:
|
|
36112
|
-
warn:
|
|
36113
|
-
over:
|
|
36277
|
+
ok: chalk223.green,
|
|
36278
|
+
warn: chalk223.yellow,
|
|
36279
|
+
over: chalk223.red
|
|
36114
36280
|
};
|
|
36115
36281
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
36116
36282
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -36142,9 +36308,9 @@ function buildLimitsSegment(rateLimits) {
|
|
|
36142
36308
|
|
|
36143
36309
|
// src/commands/readGitBranch.ts
|
|
36144
36310
|
import { readFileSync as readFileSync51, statSync as statSync10 } from "fs";
|
|
36145
|
-
import { isAbsolute as isAbsolute6, join as
|
|
36311
|
+
import { isAbsolute as isAbsolute6, join as join87, resolve as resolve26 } from "path";
|
|
36146
36312
|
function resolveGitDir(cwd) {
|
|
36147
|
-
const dotGit =
|
|
36313
|
+
const dotGit = join87(cwd, ".git");
|
|
36148
36314
|
let stat5;
|
|
36149
36315
|
try {
|
|
36150
36316
|
stat5 = statSync10(dotGit);
|
|
@@ -36174,7 +36340,7 @@ function readGitBranch(cwd) {
|
|
|
36174
36340
|
}
|
|
36175
36341
|
let head;
|
|
36176
36342
|
try {
|
|
36177
|
-
head = readFileSync51(
|
|
36343
|
+
head = readFileSync51(join87(gitDir, "HEAD"), "utf8");
|
|
36178
36344
|
} catch {
|
|
36179
36345
|
return null;
|
|
36180
36346
|
}
|
|
@@ -36206,7 +36372,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
36206
36372
|
}
|
|
36207
36373
|
|
|
36208
36374
|
// src/commands/colorizePercent.ts
|
|
36209
|
-
import
|
|
36375
|
+
import chalk224 from "chalk";
|
|
36210
36376
|
|
|
36211
36377
|
// src/shared/contextLevel.ts
|
|
36212
36378
|
var THRESHOLDS = {
|
|
@@ -36226,16 +36392,16 @@ function colorizePercent(pct) {
|
|
|
36226
36392
|
const label = `${Math.round(pct)}%`;
|
|
36227
36393
|
switch (contextLevel(pct)) {
|
|
36228
36394
|
case "red":
|
|
36229
|
-
return
|
|
36395
|
+
return chalk224.red(label);
|
|
36230
36396
|
case "yellow":
|
|
36231
|
-
return
|
|
36397
|
+
return chalk224.yellow(label);
|
|
36232
36398
|
default:
|
|
36233
36399
|
return label;
|
|
36234
36400
|
}
|
|
36235
36401
|
}
|
|
36236
36402
|
|
|
36237
36403
|
// src/commands/statusLine.ts
|
|
36238
|
-
|
|
36404
|
+
chalk225.level = 3;
|
|
36239
36405
|
function formatNumber(num) {
|
|
36240
36406
|
return num.toLocaleString("en-US");
|
|
36241
36407
|
}
|
|
@@ -36247,7 +36413,7 @@ async function statusLine() {
|
|
|
36247
36413
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
36248
36414
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
36249
36415
|
const branch2 = dir ? readGitBranch(dir) : null;
|
|
36250
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
36416
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk225.cyan(branch2)} | ` : "";
|
|
36251
36417
|
const limitsSegment = process.env.ASSIST_SESSION === "1" ? "" : buildLimitsSegment(data.rate_limits);
|
|
36252
36418
|
console.log(
|
|
36253
36419
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${limitsSegment}`
|
|
@@ -36355,7 +36521,7 @@ import { spawn as spawn8 } from "child_process";
|
|
|
36355
36521
|
import * as path48 from "path";
|
|
36356
36522
|
|
|
36357
36523
|
// src/commands/refactor/logViolations.ts
|
|
36358
|
-
import
|
|
36524
|
+
import chalk226 from "chalk";
|
|
36359
36525
|
var DEFAULT_MAX_LINES2 = 100;
|
|
36360
36526
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
36361
36527
|
if (violations.length === 0) {
|
|
@@ -36364,43 +36530,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
36364
36530
|
}
|
|
36365
36531
|
return;
|
|
36366
36532
|
}
|
|
36367
|
-
console.error(
|
|
36533
|
+
console.error(chalk226.red(`
|
|
36368
36534
|
Refactor check failed:
|
|
36369
36535
|
`));
|
|
36370
|
-
console.error(
|
|
36536
|
+
console.error(chalk226.red(` The following files exceed ${maxLines} lines:
|
|
36371
36537
|
`));
|
|
36372
36538
|
for (const violation of violations) {
|
|
36373
|
-
console.error(
|
|
36539
|
+
console.error(chalk226.red(` ${violation.file} (${violation.lines} lines)`));
|
|
36374
36540
|
}
|
|
36375
36541
|
console.error(
|
|
36376
|
-
|
|
36542
|
+
chalk226.yellow(
|
|
36377
36543
|
`
|
|
36378
36544
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
36379
36545
|
way to refactor it, ignore it with:
|
|
36380
36546
|
`
|
|
36381
36547
|
)
|
|
36382
36548
|
);
|
|
36383
|
-
console.error(
|
|
36549
|
+
console.error(chalk226.gray(` assist refactor ignore <file>
|
|
36384
36550
|
`));
|
|
36385
36551
|
if (process.env.CLAUDECODE) {
|
|
36386
|
-
console.error(
|
|
36552
|
+
console.error(chalk226.cyan(`
|
|
36387
36553
|
## Extracting Code to New Files
|
|
36388
36554
|
`));
|
|
36389
36555
|
console.error(
|
|
36390
|
-
|
|
36556
|
+
chalk226.cyan(
|
|
36391
36557
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
36392
36558
|
`
|
|
36393
36559
|
)
|
|
36394
36560
|
);
|
|
36395
36561
|
console.error(
|
|
36396
|
-
|
|
36562
|
+
chalk226.cyan(
|
|
36397
36563
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
36398
36564
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
36399
36565
|
`
|
|
36400
36566
|
)
|
|
36401
36567
|
);
|
|
36402
36568
|
console.error(
|
|
36403
|
-
|
|
36569
|
+
chalk226.cyan(
|
|
36404
36570
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
36405
36571
|
domains, move it to a common/shared folder.
|
|
36406
36572
|
`
|
|
@@ -36556,7 +36722,7 @@ async function check(pattern2, options2) {
|
|
|
36556
36722
|
|
|
36557
36723
|
// src/commands/refactor/extract.ts
|
|
36558
36724
|
import path56 from "path";
|
|
36559
|
-
import
|
|
36725
|
+
import chalk229 from "chalk";
|
|
36560
36726
|
|
|
36561
36727
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
36562
36728
|
import { SyntaxKind as SyntaxKind8 } from "ts-morph";
|
|
@@ -37164,23 +37330,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
37164
37330
|
|
|
37165
37331
|
// src/commands/refactor/extract/displayPlan.ts
|
|
37166
37332
|
import path52 from "path";
|
|
37167
|
-
import
|
|
37333
|
+
import chalk227 from "chalk";
|
|
37168
37334
|
function section(title) {
|
|
37169
37335
|
return `
|
|
37170
|
-
${
|
|
37336
|
+
${chalk227.cyan(title)}`;
|
|
37171
37337
|
}
|
|
37172
37338
|
function displayImporters(plan2, cwd) {
|
|
37173
37339
|
if (plan2.importersToUpdate.length === 0) return;
|
|
37174
37340
|
console.log(section("Update importers:"));
|
|
37175
37341
|
for (const imp of plan2.importersToUpdate) {
|
|
37176
37342
|
const rel = path52.relative(cwd, imp.file.getFilePath());
|
|
37177
|
-
console.log(` ${
|
|
37343
|
+
console.log(` ${chalk227.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
37178
37344
|
}
|
|
37179
37345
|
}
|
|
37180
37346
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
37181
|
-
console.log(
|
|
37347
|
+
console.log(chalk227.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
37182
37348
|
`));
|
|
37183
|
-
console.log(` ${
|
|
37349
|
+
console.log(` ${chalk227.cyan("Functions to move:")}`);
|
|
37184
37350
|
for (const name of plan2.extractedNames) {
|
|
37185
37351
|
console.log(` ${name}`);
|
|
37186
37352
|
}
|
|
@@ -37214,7 +37380,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
37214
37380
|
|
|
37215
37381
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
37216
37382
|
import path55 from "path";
|
|
37217
|
-
import
|
|
37383
|
+
import chalk228 from "chalk";
|
|
37218
37384
|
import { Project as Project4 } from "ts-morph";
|
|
37219
37385
|
|
|
37220
37386
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -37306,7 +37472,7 @@ function loadProjectFile(file) {
|
|
|
37306
37472
|
});
|
|
37307
37473
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
37308
37474
|
if (!sourceFile) {
|
|
37309
|
-
console.log(
|
|
37475
|
+
console.log(chalk228.red(`File not found in project: ${file}`));
|
|
37310
37476
|
process.exit(1);
|
|
37311
37477
|
}
|
|
37312
37478
|
return { project, sourceFile };
|
|
@@ -37329,19 +37495,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
37329
37495
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
37330
37496
|
if (options2.apply) {
|
|
37331
37497
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
37332
|
-
console.log(
|
|
37498
|
+
console.log(chalk229.green("\nExtraction complete"));
|
|
37333
37499
|
} else {
|
|
37334
|
-
console.log(
|
|
37500
|
+
console.log(chalk229.dim("\nDry run. Use --apply to execute."));
|
|
37335
37501
|
}
|
|
37336
37502
|
}
|
|
37337
37503
|
|
|
37338
37504
|
// src/commands/refactor/ignore.ts
|
|
37339
37505
|
import fs33 from "fs";
|
|
37340
|
-
import
|
|
37506
|
+
import chalk230 from "chalk";
|
|
37341
37507
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
37342
37508
|
function ignore2(file) {
|
|
37343
37509
|
if (!fs33.existsSync(file)) {
|
|
37344
|
-
console.error(
|
|
37510
|
+
console.error(chalk230.red(`Error: File does not exist: ${file}`));
|
|
37345
37511
|
process.exit(1);
|
|
37346
37512
|
}
|
|
37347
37513
|
const content = fs33.readFileSync(file, "utf8");
|
|
@@ -37357,7 +37523,7 @@ function ignore2(file) {
|
|
|
37357
37523
|
fs33.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
37358
37524
|
}
|
|
37359
37525
|
console.log(
|
|
37360
|
-
|
|
37526
|
+
chalk230.green(
|
|
37361
37527
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
37362
37528
|
)
|
|
37363
37529
|
);
|
|
@@ -37366,12 +37532,12 @@ function ignore2(file) {
|
|
|
37366
37532
|
// src/commands/refactor/rename.ts
|
|
37367
37533
|
import fs36 from "fs";
|
|
37368
37534
|
import path62 from "path";
|
|
37369
|
-
import
|
|
37535
|
+
import chalk233 from "chalk";
|
|
37370
37536
|
|
|
37371
37537
|
// src/commands/refactor/rename/applyRename.ts
|
|
37372
37538
|
import fs35 from "fs";
|
|
37373
37539
|
import path58 from "path";
|
|
37374
|
-
import
|
|
37540
|
+
import chalk231 from "chalk";
|
|
37375
37541
|
|
|
37376
37542
|
// src/commands/refactor/restructure/computeRewrites.ts
|
|
37377
37543
|
import path57 from "path";
|
|
@@ -37477,13 +37643,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
37477
37643
|
const updatedContents = applyRewrites(rewrites);
|
|
37478
37644
|
for (const [file, content] of updatedContents) {
|
|
37479
37645
|
fs35.writeFileSync(file, content, "utf8");
|
|
37480
|
-
console.log(
|
|
37646
|
+
console.log(chalk231.cyan(` Updated imports in ${path58.relative(cwd, file)}`));
|
|
37481
37647
|
}
|
|
37482
37648
|
const destDir = path58.dirname(destPath);
|
|
37483
37649
|
if (!fs35.existsSync(destDir)) fs35.mkdirSync(destDir, { recursive: true });
|
|
37484
37650
|
fs35.renameSync(sourcePath, destPath);
|
|
37485
37651
|
console.log(
|
|
37486
|
-
|
|
37652
|
+
chalk231.white(
|
|
37487
37653
|
` Moved ${path58.relative(cwd, sourcePath)} \u2192 ${path58.relative(cwd, destPath)}`
|
|
37488
37654
|
)
|
|
37489
37655
|
);
|
|
@@ -37633,16 +37799,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
37633
37799
|
|
|
37634
37800
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
37635
37801
|
import path61 from "path";
|
|
37636
|
-
import
|
|
37802
|
+
import chalk232 from "chalk";
|
|
37637
37803
|
function printRenamePreview(rewrites, cwd) {
|
|
37638
37804
|
for (const rewrite of rewrites) {
|
|
37639
37805
|
console.log(
|
|
37640
|
-
|
|
37806
|
+
chalk232.dim(
|
|
37641
37807
|
` ${path61.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
37642
37808
|
)
|
|
37643
37809
|
);
|
|
37644
37810
|
}
|
|
37645
|
-
console.log(
|
|
37811
|
+
console.log(chalk232.dim("Dry run. Use --apply to execute."));
|
|
37646
37812
|
}
|
|
37647
37813
|
|
|
37648
37814
|
// src/commands/refactor/rename.ts
|
|
@@ -37653,20 +37819,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
37653
37819
|
const relSource = path62.relative(cwd, sourcePath);
|
|
37654
37820
|
const relDest = path62.relative(cwd, destPath);
|
|
37655
37821
|
if (!fs36.existsSync(sourcePath)) {
|
|
37656
|
-
console.log(
|
|
37822
|
+
console.log(chalk233.red(`File not found: ${source}`));
|
|
37657
37823
|
process.exit(1);
|
|
37658
37824
|
}
|
|
37659
37825
|
if (destPath !== sourcePath && fs36.existsSync(destPath)) {
|
|
37660
|
-
console.log(
|
|
37826
|
+
console.log(chalk233.red(`Destination already exists: ${destination}`));
|
|
37661
37827
|
process.exit(1);
|
|
37662
37828
|
}
|
|
37663
|
-
console.log(
|
|
37664
|
-
console.log(
|
|
37665
|
-
console.log(
|
|
37829
|
+
console.log(chalk233.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
37830
|
+
console.log(chalk233.dim("Loading project..."));
|
|
37831
|
+
console.log(chalk233.dim("Scanning imports across the project..."));
|
|
37666
37832
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
37667
37833
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
37668
37834
|
console.log(
|
|
37669
|
-
|
|
37835
|
+
chalk233.dim(
|
|
37670
37836
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
37671
37837
|
)
|
|
37672
37838
|
);
|
|
@@ -37675,11 +37841,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
37675
37841
|
return;
|
|
37676
37842
|
}
|
|
37677
37843
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
37678
|
-
console.log(
|
|
37844
|
+
console.log(chalk233.green("Done"));
|
|
37679
37845
|
}
|
|
37680
37846
|
|
|
37681
37847
|
// src/commands/refactor/renameSymbol.ts
|
|
37682
|
-
import
|
|
37848
|
+
import chalk234 from "chalk";
|
|
37683
37849
|
|
|
37684
37850
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
37685
37851
|
import { SyntaxKind as SyntaxKind19 } from "ts-morph";
|
|
@@ -37725,34 +37891,34 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
37725
37891
|
const { project, sourceFile } = loadProjectFile(file);
|
|
37726
37892
|
const symbol = findSymbol(sourceFile, oldName);
|
|
37727
37893
|
if (!symbol) {
|
|
37728
|
-
console.log(
|
|
37894
|
+
console.log(chalk234.red(`Symbol "${oldName}" not found in ${file}`));
|
|
37729
37895
|
process.exit(1);
|
|
37730
37896
|
}
|
|
37731
37897
|
const grouped = groupReferences(symbol, cwd);
|
|
37732
37898
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
37733
37899
|
console.log(
|
|
37734
|
-
|
|
37900
|
+
chalk234.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
37735
37901
|
`)
|
|
37736
37902
|
);
|
|
37737
37903
|
for (const [refFile, lines2] of grouped) {
|
|
37738
37904
|
console.log(
|
|
37739
|
-
` ${
|
|
37905
|
+
` ${chalk234.dim(refFile)}: lines ${chalk234.cyan(lines2.join(", "))}`
|
|
37740
37906
|
);
|
|
37741
37907
|
}
|
|
37742
37908
|
if (options2.apply) {
|
|
37743
37909
|
symbol.rename(newName);
|
|
37744
37910
|
await project.save();
|
|
37745
|
-
console.log(
|
|
37911
|
+
console.log(chalk234.green(`
|
|
37746
37912
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
37747
37913
|
} else {
|
|
37748
|
-
console.log(
|
|
37914
|
+
console.log(chalk234.dim("\nDry run. Use --apply to execute."));
|
|
37749
37915
|
}
|
|
37750
37916
|
}
|
|
37751
37917
|
|
|
37752
37918
|
// src/commands/refactor/restructure.ts
|
|
37753
37919
|
import fs38 from "fs";
|
|
37754
37920
|
import path83 from "path";
|
|
37755
|
-
import
|
|
37921
|
+
import chalk244 from "chalk";
|
|
37756
37922
|
|
|
37757
37923
|
// src/commands/refactor/restructure/buildPlan.ts
|
|
37758
37924
|
import path73 from "path";
|
|
@@ -38089,7 +38255,7 @@ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
|
|
|
38089
38255
|
}
|
|
38090
38256
|
|
|
38091
38257
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
38092
|
-
import
|
|
38258
|
+
import chalk239 from "chalk";
|
|
38093
38259
|
|
|
38094
38260
|
// src/commands/refactor/restructure/applyCommand.ts
|
|
38095
38261
|
import path74 from "path";
|
|
@@ -38100,13 +38266,13 @@ function applyCommand(scopeRoot) {
|
|
|
38100
38266
|
|
|
38101
38267
|
// src/commands/refactor/restructure/displayDrift.ts
|
|
38102
38268
|
import path75 from "path";
|
|
38103
|
-
import
|
|
38269
|
+
import chalk235 from "chalk";
|
|
38104
38270
|
var shownMoves = 20;
|
|
38105
38271
|
function displayDrift(plan2, listMoves) {
|
|
38106
38272
|
const rel = (file) => path75.relative(process.cwd(), file);
|
|
38107
38273
|
if (plan2.moves.length > 0) {
|
|
38108
38274
|
console.log(
|
|
38109
|
-
|
|
38275
|
+
chalk235.red(
|
|
38110
38276
|
`${plan2.moves.length} file(s) drift from the plan${listMoves ? ":" : "."}`
|
|
38111
38277
|
)
|
|
38112
38278
|
);
|
|
@@ -38114,17 +38280,17 @@ function displayDrift(plan2, listMoves) {
|
|
|
38114
38280
|
for (const move2 of plan2.moves.slice(0, shownMoves))
|
|
38115
38281
|
console.log(` ${rel(move2.from)} \u2192 ${rel(move2.to)}`);
|
|
38116
38282
|
if (plan2.moves.length > shownMoves)
|
|
38117
|
-
console.log(
|
|
38283
|
+
console.log(chalk235.dim(` \u2026and ${plan2.moves.length - shownMoves} more`));
|
|
38118
38284
|
}
|
|
38119
38285
|
}
|
|
38120
|
-
for (const error of plan2.errors) console.log(
|
|
38286
|
+
for (const error of plan2.errors) console.log(chalk235.red(error));
|
|
38121
38287
|
}
|
|
38122
38288
|
|
|
38123
38289
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
38124
|
-
import
|
|
38290
|
+
import chalk238 from "chalk";
|
|
38125
38291
|
|
|
38126
38292
|
// src/commands/refactor/restructure/displayDeepChains.ts
|
|
38127
|
-
import
|
|
38293
|
+
import chalk236 from "chalk";
|
|
38128
38294
|
var shownChains = 10;
|
|
38129
38295
|
function formatChain(chain2) {
|
|
38130
38296
|
const folders = chain2.folders.map((f) => `${f.name} (${f.files})`).join(" > ");
|
|
@@ -38134,28 +38300,28 @@ function displayDeepChains(chains, maxDepth) {
|
|
|
38134
38300
|
if (chains.length === 0) return;
|
|
38135
38301
|
const tooDeep = chains.reduce((sum3, c) => sum3 + c.tooDeep, 0);
|
|
38136
38302
|
console.log(
|
|
38137
|
-
|
|
38303
|
+
chalk236.red(
|
|
38138
38304
|
`
|
|
38139
38305
|
Plan exceeds restructure.maxDepth ${maxDepth}: ${tooDeep} file(s) deeper.`
|
|
38140
38306
|
)
|
|
38141
38307
|
);
|
|
38142
38308
|
console.log(
|
|
38143
|
-
|
|
38309
|
+
chalk236.bold(
|
|
38144
38310
|
"Deep chains, as folder (files beneath), most files too deep first:"
|
|
38145
38311
|
)
|
|
38146
38312
|
);
|
|
38147
38313
|
for (const chain2 of chains.slice(0, shownChains))
|
|
38148
38314
|
console.log(formatChain(chain2));
|
|
38149
38315
|
if (chains.length > shownChains)
|
|
38150
|
-
console.log(
|
|
38316
|
+
console.log(chalk236.dim(` \u2026and ${chains.length - shownChains} more`));
|
|
38151
38317
|
}
|
|
38152
38318
|
|
|
38153
38319
|
// src/commands/refactor/restructure/displayLongPaths.ts
|
|
38154
|
-
import
|
|
38320
|
+
import chalk237 from "chalk";
|
|
38155
38321
|
function displayLongPaths(longPaths, maxPathLength) {
|
|
38156
38322
|
if (longPaths.length === 0) return;
|
|
38157
38323
|
console.log(
|
|
38158
|
-
|
|
38324
|
+
chalk237.red(
|
|
38159
38325
|
`
|
|
38160
38326
|
Plan exceeds restructure.maxPathLength ${maxPathLength}: ${longPaths.length} repo-relative path(s) longer.`
|
|
38161
38327
|
)
|
|
@@ -38183,7 +38349,7 @@ function displayLayoutLimits(limits, apply) {
|
|
|
38183
38349
|
displayDeepChains(limits.chains, limits.maxDepth);
|
|
38184
38350
|
displayLongPaths(limits.longPaths, limits.maxPathLength);
|
|
38185
38351
|
console.log("");
|
|
38186
|
-
for (const line of pinSteps(apply)) console.log(
|
|
38352
|
+
for (const line of pinSteps(apply)) console.log(chalk238.yellow(line));
|
|
38187
38353
|
}
|
|
38188
38354
|
|
|
38189
38355
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
@@ -38195,14 +38361,14 @@ function checkPlan(plan2, limits) {
|
|
|
38195
38361
|
if (exceeds || plan2.errors.length > 0) process.exit(1);
|
|
38196
38362
|
if (plan2.moves.length > 0) {
|
|
38197
38363
|
console.log(
|
|
38198
|
-
|
|
38364
|
+
chalk239.yellow(
|
|
38199
38365
|
`
|
|
38200
38366
|
Run \`${apply}\` to move the files and rewrite their imports.`
|
|
38201
38367
|
)
|
|
38202
38368
|
);
|
|
38203
38369
|
process.exit(1);
|
|
38204
38370
|
}
|
|
38205
|
-
console.log(
|
|
38371
|
+
console.log(chalk239.green("Layout matches the restructure plan"));
|
|
38206
38372
|
}
|
|
38207
38373
|
|
|
38208
38374
|
// src/commands/refactor/restructure/findDeepChains.ts
|
|
@@ -38264,23 +38430,23 @@ import path78 from "path";
|
|
|
38264
38430
|
import { minimatch as minimatch4 } from "minimatch";
|
|
38265
38431
|
function partitionIgnored(files) {
|
|
38266
38432
|
const globs = loadConfig().restructure?.ignore ?? [];
|
|
38267
|
-
const
|
|
38433
|
+
const isIgnored2 = (file) => globs.some((glob) => minimatch4(path78.relative(process.cwd(), file), glob));
|
|
38268
38434
|
return {
|
|
38269
|
-
scoped: files.filter((f) => !
|
|
38270
|
-
ignored: files.filter(
|
|
38435
|
+
scoped: files.filter((f) => !isIgnored2(f)),
|
|
38436
|
+
ignored: files.filter(isIgnored2)
|
|
38271
38437
|
};
|
|
38272
38438
|
}
|
|
38273
38439
|
|
|
38274
38440
|
// src/commands/refactor/restructure/runPlan.ts
|
|
38275
|
-
import
|
|
38441
|
+
import chalk243 from "chalk";
|
|
38276
38442
|
|
|
38277
38443
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
38278
|
-
import
|
|
38444
|
+
import chalk241 from "chalk";
|
|
38279
38445
|
|
|
38280
38446
|
// src/commands/refactor/restructure/executePlan.ts
|
|
38281
38447
|
import fs37 from "fs";
|
|
38282
38448
|
import path79 from "path";
|
|
38283
|
-
import
|
|
38449
|
+
import chalk240 from "chalk";
|
|
38284
38450
|
function relPath(file) {
|
|
38285
38451
|
return path79.relative(process.cwd(), file);
|
|
38286
38452
|
}
|
|
@@ -38297,14 +38463,14 @@ function moveFiles(moves) {
|
|
|
38297
38463
|
fs37.mkdirSync(path79.dirname(move2.to), { recursive: true });
|
|
38298
38464
|
fs37.renameSync(staging, move2.to);
|
|
38299
38465
|
console.log(
|
|
38300
|
-
|
|
38466
|
+
chalk240.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
|
|
38301
38467
|
);
|
|
38302
38468
|
}
|
|
38303
38469
|
}
|
|
38304
38470
|
function removeIfEmpty(dir) {
|
|
38305
38471
|
if (!fs37.existsSync(dir) || fs37.readdirSync(dir).length > 0) return false;
|
|
38306
38472
|
fs37.rmdirSync(dir);
|
|
38307
|
-
console.log(
|
|
38473
|
+
console.log(chalk240.dim(` Removed empty directory ${relPath(dir)}`));
|
|
38308
38474
|
return true;
|
|
38309
38475
|
}
|
|
38310
38476
|
function removeEmptyDirectories(dirs, scopeRoot) {
|
|
@@ -38317,7 +38483,7 @@ function removeEmptyDirectories(dirs, scopeRoot) {
|
|
|
38317
38483
|
function executePlan(plan2) {
|
|
38318
38484
|
for (const [file, content] of applyRewrites(plan2.rewrites)) {
|
|
38319
38485
|
fs37.writeFileSync(file, content, "utf8");
|
|
38320
|
-
console.log(
|
|
38486
|
+
console.log(chalk240.cyan(` Rewrote imports in ${relPath(file)}`));
|
|
38321
38487
|
}
|
|
38322
38488
|
moveFiles(plan2.moves);
|
|
38323
38489
|
removeEmptyDirectories(
|
|
@@ -38329,17 +38495,17 @@ function executePlan(plan2) {
|
|
|
38329
38495
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
38330
38496
|
function applyPlan(plan2) {
|
|
38331
38497
|
if (plan2.errors.length > 0) {
|
|
38332
|
-
console.log(
|
|
38498
|
+
console.log(chalk241.red("\nResolve the errors above before applying."));
|
|
38333
38499
|
process.exit(1);
|
|
38334
38500
|
}
|
|
38335
|
-
console.log(
|
|
38501
|
+
console.log(chalk241.bold("\nApplying changes..."));
|
|
38336
38502
|
executePlan(plan2);
|
|
38337
|
-
console.log(
|
|
38503
|
+
console.log(chalk241.green("\nRestructuring complete"));
|
|
38338
38504
|
}
|
|
38339
38505
|
|
|
38340
38506
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
38341
38507
|
import path82 from "path";
|
|
38342
|
-
import
|
|
38508
|
+
import chalk242 from "chalk";
|
|
38343
38509
|
|
|
38344
38510
|
// src/commands/refactor/restructure/computeDepthStats.ts
|
|
38345
38511
|
import path80 from "path";
|
|
@@ -38390,17 +38556,17 @@ function relPath2(filePath) {
|
|
|
38390
38556
|
}
|
|
38391
38557
|
function displayMoves(plan2) {
|
|
38392
38558
|
if (plan2.moves.length === 0) return;
|
|
38393
|
-
console.log(
|
|
38559
|
+
console.log(chalk242.bold("\nFile moves:"));
|
|
38394
38560
|
for (const move2 of plan2.moves) {
|
|
38395
38561
|
console.log(
|
|
38396
|
-
` ${
|
|
38562
|
+
` ${chalk242.red(relPath2(move2.from))} \u2192 ${chalk242.green(relPath2(move2.to))}`
|
|
38397
38563
|
);
|
|
38398
|
-
console.log(
|
|
38564
|
+
console.log(chalk242.dim(` ${move2.reason}`));
|
|
38399
38565
|
}
|
|
38400
38566
|
}
|
|
38401
38567
|
function displayTree(plan2) {
|
|
38402
38568
|
console.log(
|
|
38403
|
-
|
|
38569
|
+
chalk242.bold(`
|
|
38404
38570
|
Resulting tree (${relPath2(plan2.scopeRoot) || "."}/):`)
|
|
38405
38571
|
);
|
|
38406
38572
|
for (const line of formatTree(plan2.targets.values(), plan2.scopeRoot))
|
|
@@ -38411,15 +38577,15 @@ function displayDepthStats(plan2) {
|
|
|
38411
38577
|
plan2.targets.values(),
|
|
38412
38578
|
plan2.scopeRoot
|
|
38413
38579
|
);
|
|
38414
|
-
console.log(
|
|
38580
|
+
console.log(chalk242.bold(`
|
|
38415
38581
|
Depth (max ${max}):`));
|
|
38416
38582
|
for (const depth of [...distribution.keys()].sort((a, b) => a - b))
|
|
38417
38583
|
console.log(` ${depth}: ${distribution.get(depth)} file(s)`);
|
|
38418
38584
|
}
|
|
38419
38585
|
function displayErrors(errors) {
|
|
38420
38586
|
if (errors.length === 0) return;
|
|
38421
|
-
console.log(
|
|
38422
|
-
for (const error of errors) console.log(
|
|
38587
|
+
console.log(chalk242.red("\nErrors:"));
|
|
38588
|
+
for (const error of errors) console.log(chalk242.red(` ${error}`));
|
|
38423
38589
|
}
|
|
38424
38590
|
function displayPlan2(plan2) {
|
|
38425
38591
|
displayMoves(plan2);
|
|
@@ -38428,7 +38594,7 @@ function displayPlan2(plan2) {
|
|
|
38428
38594
|
displayErrors(plan2.errors);
|
|
38429
38595
|
const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
|
|
38430
38596
|
console.log(
|
|
38431
|
-
|
|
38597
|
+
chalk242.dim(
|
|
38432
38598
|
`
|
|
38433
38599
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
|
|
38434
38600
|
)
|
|
@@ -38440,11 +38606,11 @@ function runPlan(plan2, limits, apply) {
|
|
|
38440
38606
|
displayPlan2(plan2);
|
|
38441
38607
|
displayLayoutLimits(limits, applyCommand(plan2.scopeRoot));
|
|
38442
38608
|
if (plan2.moves.length === 0 && plan2.errors.length === 0) {
|
|
38443
|
-
console.log(
|
|
38609
|
+
console.log(chalk243.green("No restructuring needed"));
|
|
38444
38610
|
return;
|
|
38445
38611
|
}
|
|
38446
38612
|
if (!apply) {
|
|
38447
|
-
console.log(
|
|
38613
|
+
console.log(chalk243.dim("\nDry run. Use --apply to execute."));
|
|
38448
38614
|
return;
|
|
38449
38615
|
}
|
|
38450
38616
|
applyPlan(plan2);
|
|
@@ -38454,14 +38620,14 @@ function runPlan(plan2, limits, apply) {
|
|
|
38454
38620
|
async function restructure(root2, options2 = {}) {
|
|
38455
38621
|
const scopeRoot = path83.resolve(root2 ?? "src");
|
|
38456
38622
|
if (!fs38.existsSync(scopeRoot) || !fs38.statSync(scopeRoot).isDirectory()) {
|
|
38457
|
-
console.log(
|
|
38623
|
+
console.log(chalk244.red(`Not a directory: ${root2 ?? "src"}`));
|
|
38458
38624
|
process.exit(1);
|
|
38459
38625
|
}
|
|
38460
38626
|
const found = [];
|
|
38461
38627
|
walkSourceFiles(scopeRoot, found);
|
|
38462
38628
|
const { scoped, ignored } = partitionIgnored(found);
|
|
38463
38629
|
if (scoped.length === 0) {
|
|
38464
|
-
console.log(
|
|
38630
|
+
console.log(chalk244.yellow("No files found under root"));
|
|
38465
38631
|
return;
|
|
38466
38632
|
}
|
|
38467
38633
|
const {
|
|
@@ -38519,10 +38685,10 @@ function registerRefactor(program) {
|
|
|
38519
38685
|
}
|
|
38520
38686
|
|
|
38521
38687
|
// src/commands/review/checkoutPrSession.ts
|
|
38522
|
-
import { randomUUID as
|
|
38688
|
+
import { randomUUID as randomUUID22 } from "crypto";
|
|
38523
38689
|
async function checkoutPrSession(number, prompt = "") {
|
|
38524
38690
|
await checkoutPr(number);
|
|
38525
|
-
const claudeSessionId =
|
|
38691
|
+
const claudeSessionId = randomUUID22();
|
|
38526
38692
|
emitActivity({ kind: "command", name: "review", claudeSessionId });
|
|
38527
38693
|
const { done: done2 } = spawnClaude(prompt, {
|
|
38528
38694
|
permissionMode: "auto",
|
|
@@ -38532,7 +38698,7 @@ async function checkoutPrSession(number, prompt = "") {
|
|
|
38532
38698
|
}
|
|
38533
38699
|
|
|
38534
38700
|
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
38535
|
-
import
|
|
38701
|
+
import chalk248 from "chalk";
|
|
38536
38702
|
|
|
38537
38703
|
// src/commands/config/promptConfigScope.ts
|
|
38538
38704
|
import Enquirer3 from "enquirer";
|
|
@@ -38558,7 +38724,7 @@ async function promptConfigScope() {
|
|
|
38558
38724
|
}
|
|
38559
38725
|
|
|
38560
38726
|
// src/commands/config/resolveConfigKeyAnswer.ts
|
|
38561
|
-
import
|
|
38727
|
+
import chalk245 from "chalk";
|
|
38562
38728
|
async function resolveConfigKeyAnswer(question, supplied) {
|
|
38563
38729
|
if (supplied !== void 0) return coerceSupplied(question.key, supplied);
|
|
38564
38730
|
for (; ; ) {
|
|
@@ -38566,7 +38732,7 @@ async function resolveConfigKeyAnswer(question, supplied) {
|
|
|
38566
38732
|
if (answer === "") return void 0;
|
|
38567
38733
|
const coercion = coerceCliConfigValue(question.key, answer);
|
|
38568
38734
|
if (coercion.ok) return coercion.value;
|
|
38569
|
-
console.error(
|
|
38735
|
+
console.error(chalk245.red(coercion.error));
|
|
38570
38736
|
}
|
|
38571
38737
|
}
|
|
38572
38738
|
function coerceSupplied(key, supplied) {
|
|
@@ -38646,7 +38812,7 @@ function suggestGlobs(current, proposed) {
|
|
|
38646
38812
|
}
|
|
38647
38813
|
|
|
38648
38814
|
// src/commands/review/highLevel/parseConfigureAnswers.ts
|
|
38649
|
-
import
|
|
38815
|
+
import chalk246 from "chalk";
|
|
38650
38816
|
function parseConfigureAnswers(answers) {
|
|
38651
38817
|
const known = Object.values(highLevelConfigKeys);
|
|
38652
38818
|
const parsed = {};
|
|
@@ -38664,13 +38830,13 @@ function answersCoverEveryKey(answers) {
|
|
|
38664
38830
|
return Object.values(highLevelConfigKeys).every((key) => key in answers);
|
|
38665
38831
|
}
|
|
38666
38832
|
function exitWith(message3) {
|
|
38667
|
-
console.error(
|
|
38833
|
+
console.error(chalk246.red(`Error: ${message3}.`));
|
|
38668
38834
|
process.exit(1);
|
|
38669
38835
|
}
|
|
38670
38836
|
|
|
38671
38837
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
38672
38838
|
import { execFileSync as execFileSync27 } from "child_process";
|
|
38673
|
-
import
|
|
38839
|
+
import chalk247 from "chalk";
|
|
38674
38840
|
|
|
38675
38841
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
38676
38842
|
function buildGlobProposalPrompt(tree) {
|
|
@@ -38764,12 +38930,12 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
38764
38930
|
const tree = summariseRepoTree(cwd);
|
|
38765
38931
|
if (tree === "") return NOTHING_PROPOSED;
|
|
38766
38932
|
console.log(
|
|
38767
|
-
|
|
38933
|
+
chalk247.dim("Asking Claude to propose globs from the repo's own tree...")
|
|
38768
38934
|
);
|
|
38769
38935
|
const output = askClaude(buildGlobProposalPrompt(tree), cwd);
|
|
38770
38936
|
if (output === void 0) {
|
|
38771
38937
|
console.log(
|
|
38772
|
-
|
|
38938
|
+
chalk247.yellow(
|
|
38773
38939
|
"Claude proposed nothing; answer each key from its current value."
|
|
38774
38940
|
)
|
|
38775
38941
|
);
|
|
@@ -38829,14 +38995,14 @@ async function configureHighLevelReview(options2 = {}) {
|
|
|
38829
38995
|
function reportConfigured(result) {
|
|
38830
38996
|
for (const write of result.written)
|
|
38831
38997
|
console.log(
|
|
38832
|
-
|
|
38998
|
+
chalk248.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
|
|
38833
38999
|
);
|
|
38834
|
-
for (const key of result.skipped) console.log(
|
|
38835
|
-
console.log(
|
|
39000
|
+
for (const key of result.skipped) console.log(chalk248.dim(`Left ${key} unset`));
|
|
39001
|
+
console.log(chalk248.dim(`Written to ${result.target}`));
|
|
38836
39002
|
}
|
|
38837
39003
|
|
|
38838
39004
|
// src/commands/review/highLevel/announceSavedReview.ts
|
|
38839
|
-
import
|
|
39005
|
+
import chalk249 from "chalk";
|
|
38840
39006
|
function savedMessage(subject) {
|
|
38841
39007
|
const head = subject.headSha.slice(0, 7);
|
|
38842
39008
|
if (subject.draft)
|
|
@@ -38847,10 +39013,10 @@ function savedMessage(subject) {
|
|
|
38847
39013
|
}
|
|
38848
39014
|
function announceSavedReview(subject, force) {
|
|
38849
39015
|
const message3 = savedMessage(subject);
|
|
38850
|
-
if (message3) console.log(
|
|
39016
|
+
if (message3) console.log(chalk249.dim(message3));
|
|
38851
39017
|
else if (force)
|
|
38852
39018
|
console.log(
|
|
38853
|
-
|
|
39019
|
+
chalk249.dim(
|
|
38854
39020
|
`Discarding any review saved for ${subject.headSha.slice(0, 7)} and starting fresh (--force).`
|
|
38855
39021
|
)
|
|
38856
39022
|
);
|
|
@@ -39521,12 +39687,12 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
39521
39687
|
}
|
|
39522
39688
|
|
|
39523
39689
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
39524
|
-
import { join as
|
|
39690
|
+
import { join as join88 } from "path";
|
|
39525
39691
|
function slug(value) {
|
|
39526
39692
|
return value.replace(/[^\w.-]+/g, "-");
|
|
39527
39693
|
}
|
|
39528
39694
|
function highLevelReviewPath(repo, headRef, headSha) {
|
|
39529
|
-
return
|
|
39695
|
+
return join88(
|
|
39530
39696
|
getStoreDir(),
|
|
39531
39697
|
"high-level-reviews",
|
|
39532
39698
|
slug(repo),
|
|
@@ -39629,7 +39795,7 @@ function gatherHighLevelSubject(prNumber, force) {
|
|
|
39629
39795
|
}
|
|
39630
39796
|
|
|
39631
39797
|
// src/commands/review/highLevel/openHighLevelOverlay.ts
|
|
39632
|
-
import { randomUUID as
|
|
39798
|
+
import { randomUUID as randomUUID24 } from "crypto";
|
|
39633
39799
|
|
|
39634
39800
|
// src/commands/review/highLevel/highLevelProgress.ts
|
|
39635
39801
|
function toItem2(check2, decision) {
|
|
@@ -39888,7 +40054,7 @@ function splitQueuedComments(record) {
|
|
|
39888
40054
|
}
|
|
39889
40055
|
|
|
39890
40056
|
// src/commands/review/highLevel/previewHighLevelReview.ts
|
|
39891
|
-
import { randomUUID as
|
|
40057
|
+
import { randomUUID as randomUUID23 } from "crypto";
|
|
39892
40058
|
|
|
39893
40059
|
// src/commands/review/highLevel/formatHighLevelReviewPreview.ts
|
|
39894
40060
|
function formatHighLevelReviewPreview(lineLevel, body) {
|
|
@@ -39915,7 +40081,7 @@ async function previewHighLevelReview(sessionId, record, submission) {
|
|
|
39915
40081
|
"Review",
|
|
39916
40082
|
{
|
|
39917
40083
|
sessionId,
|
|
39918
|
-
requestId:
|
|
40084
|
+
requestId: randomUUID23(),
|
|
39919
40085
|
title: `${LABELS[submission.event]} ${record.repo}#${record.prNumber}`,
|
|
39920
40086
|
body: formatHighLevelReviewPreview(submission.comments, submission.body),
|
|
39921
40087
|
prNumber: record.prNumber,
|
|
@@ -39966,7 +40132,7 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
39966
40132
|
"High-level review",
|
|
39967
40133
|
{
|
|
39968
40134
|
sessionId,
|
|
39969
|
-
requestId:
|
|
40135
|
+
requestId: randomUUID24(),
|
|
39970
40136
|
title: `${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`,
|
|
39971
40137
|
body: JSON.stringify(highLevelPreviewPayload(subject)),
|
|
39972
40138
|
prNumber: subject.prNumber,
|
|
@@ -39991,55 +40157,55 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
39991
40157
|
}
|
|
39992
40158
|
|
|
39993
40159
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
39994
|
-
import
|
|
40160
|
+
import chalk254 from "chalk";
|
|
39995
40161
|
|
|
39996
40162
|
// src/commands/review/highLevel/formatCriticalDiffs.ts
|
|
39997
|
-
import
|
|
40163
|
+
import chalk250 from "chalk";
|
|
39998
40164
|
var PATCH_LINE_COLOURS = {
|
|
39999
|
-
"+":
|
|
40000
|
-
"-":
|
|
40001
|
-
"@":
|
|
40165
|
+
"+": chalk250.green,
|
|
40166
|
+
"-": chalk250.red,
|
|
40167
|
+
"@": chalk250.cyan
|
|
40002
40168
|
};
|
|
40003
40169
|
function formatPatch(patch2) {
|
|
40004
40170
|
return patch2.split("\n").map(
|
|
40005
|
-
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ??
|
|
40171
|
+
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk250.dim)(line)}`
|
|
40006
40172
|
);
|
|
40007
40173
|
}
|
|
40008
40174
|
function formatDiff(diff3) {
|
|
40009
40175
|
return [
|
|
40010
40176
|
"",
|
|
40011
|
-
` ${
|
|
40012
|
-
...diff3.patch === null ? [` ${
|
|
40177
|
+
` ${chalk250.bold(diff3.path)} ${chalk250.dim(`(${diff3.status})`)} ${chalk250.green(`+${diff3.additions}`)} ${chalk250.red(`-${diff3.deletions}`)}`,
|
|
40178
|
+
...diff3.patch === null ? [` ${chalk250.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
|
|
40013
40179
|
];
|
|
40014
40180
|
}
|
|
40015
40181
|
function formatCriticalDiffs(diffs, criticalPaths) {
|
|
40016
40182
|
if (criticalPaths.length === 0)
|
|
40017
|
-
return `${
|
|
40018
|
-
${
|
|
40183
|
+
return `${chalk250.bold.underline("Critical diffs")}
|
|
40184
|
+
${chalk250.dim("review.highLevel.criticalPaths is empty, so no diffs are shown")}`;
|
|
40019
40185
|
if (diffs.length === 0)
|
|
40020
|
-
return `${
|
|
40021
|
-
${
|
|
40186
|
+
return `${chalk250.bold.underline("Critical diffs")}
|
|
40187
|
+
${chalk250.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
|
|
40022
40188
|
return [
|
|
40023
|
-
|
|
40189
|
+
chalk250.bold.underline("Critical diffs"),
|
|
40024
40190
|
...diffs.flatMap(formatDiff)
|
|
40025
40191
|
].join("\n");
|
|
40026
40192
|
}
|
|
40027
40193
|
|
|
40028
40194
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
40029
|
-
import
|
|
40195
|
+
import chalk251 from "chalk";
|
|
40030
40196
|
var MARKERS = {
|
|
40031
|
-
pass: () =>
|
|
40032
|
-
fail: () =>
|
|
40033
|
-
manual: () =>
|
|
40197
|
+
pass: () => chalk251.green("\u2714"),
|
|
40198
|
+
fail: () => chalk251.red("\u2718"),
|
|
40199
|
+
manual: () => chalk251.yellow("\u25A1")
|
|
40034
40200
|
};
|
|
40035
40201
|
function formatCheck(check2) {
|
|
40036
|
-
const title = check2.status === "fail" ?
|
|
40202
|
+
const title = check2.status === "fail" ? chalk251.red(check2.title) : chalk251.bold(check2.title);
|
|
40037
40203
|
return ` ${MARKERS[check2.status]()} ${title}
|
|
40038
|
-
${
|
|
40204
|
+
${chalk251.dim(check2.reason)}`;
|
|
40039
40205
|
}
|
|
40040
40206
|
function formatGroup(heading2, checks2) {
|
|
40041
40207
|
if (checks2.length === 0) return [];
|
|
40042
|
-
return ["",
|
|
40208
|
+
return ["", chalk251.bold.underline(heading2), ...checks2.map(formatCheck)];
|
|
40043
40209
|
}
|
|
40044
40210
|
function formatHighLevelChecklist(checks2) {
|
|
40045
40211
|
const deterministic = checks2.filter(
|
|
@@ -40048,7 +40214,7 @@ function formatHighLevelChecklist(checks2) {
|
|
|
40048
40214
|
const failed3 = deterministic.filter(
|
|
40049
40215
|
(check2) => check2.status === "fail"
|
|
40050
40216
|
).length;
|
|
40051
|
-
const summary = failed3 === 0 ?
|
|
40217
|
+
const summary = failed3 === 0 ? chalk251.green(`All ${deterministic.length} deterministic checks pass`) : chalk251.red(
|
|
40052
40218
|
`${failed3} of ${deterministic.length} deterministic checks fail`
|
|
40053
40219
|
);
|
|
40054
40220
|
return [
|
|
@@ -40063,37 +40229,37 @@ function formatHighLevelChecklist(checks2) {
|
|
|
40063
40229
|
}
|
|
40064
40230
|
|
|
40065
40231
|
// src/commands/review/highLevel/formatHighLevelStructure.ts
|
|
40066
|
-
import
|
|
40232
|
+
import chalk252 from "chalk";
|
|
40067
40233
|
var STATUS_MARKERS = {
|
|
40068
|
-
added: () =>
|
|
40069
|
-
removed: () =>
|
|
40070
|
-
modified: () =>
|
|
40234
|
+
added: () => chalk252.green("A"),
|
|
40235
|
+
removed: () => chalk252.red("D"),
|
|
40236
|
+
modified: () => chalk252.yellow("M")
|
|
40071
40237
|
};
|
|
40072
40238
|
function counts(additions, deletions) {
|
|
40073
|
-
return `${
|
|
40239
|
+
return `${chalk252.green(`+${additions}`)} ${chalk252.red(`-${deletions}`)}`;
|
|
40074
40240
|
}
|
|
40075
40241
|
function formatNode(node, indent4) {
|
|
40076
40242
|
if (node.kind === "file")
|
|
40077
40243
|
return [
|
|
40078
|
-
`${indent4}${STATUS_MARKERS[node.status]()} ${node.name} ${
|
|
40244
|
+
`${indent4}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk252.dim(counts(node.additions, node.deletions))}`
|
|
40079
40245
|
];
|
|
40080
40246
|
const dir = node;
|
|
40081
40247
|
return [
|
|
40082
|
-
`${indent4}${
|
|
40248
|
+
`${indent4}${chalk252.bold(`${dir.name}/`)} ${chalk252.dim(counts(dir.additions, dir.deletions))}`,
|
|
40083
40249
|
...dir.children.flatMap((child) => formatNode(child, `${indent4} `))
|
|
40084
40250
|
];
|
|
40085
40251
|
}
|
|
40086
40252
|
function formatHighLevelStructure(structure) {
|
|
40087
40253
|
const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
|
|
40088
40254
|
return [
|
|
40089
|
-
|
|
40255
|
+
chalk252.bold.underline("Structure"),
|
|
40090
40256
|
` ${summary}`,
|
|
40091
40257
|
...structure.tree.flatMap((node) => formatNode(node, " "))
|
|
40092
40258
|
].join("\n");
|
|
40093
40259
|
}
|
|
40094
40260
|
|
|
40095
40261
|
// src/commands/review/highLevel/formatHighLevelTests.ts
|
|
40096
|
-
import
|
|
40262
|
+
import chalk253 from "chalk";
|
|
40097
40263
|
function changeMarker(change) {
|
|
40098
40264
|
if (change === "added") return "A";
|
|
40099
40265
|
if (change === "modified") return "M";
|
|
@@ -40102,22 +40268,22 @@ function changeMarker(change) {
|
|
|
40102
40268
|
function formatNode2(node, depth) {
|
|
40103
40269
|
const indent4 = " ".repeat(depth + 2);
|
|
40104
40270
|
if (node.kind === "it")
|
|
40105
|
-
return [`${indent4}${
|
|
40271
|
+
return [`${indent4}${chalk253.dim(changeMarker(node.change))} ${node.name}`];
|
|
40106
40272
|
return [
|
|
40107
|
-
`${indent4}${
|
|
40273
|
+
`${indent4}${chalk253.bold(node.name)}`,
|
|
40108
40274
|
...node.children.flatMap((child) => formatNode2(child, depth + 1))
|
|
40109
40275
|
];
|
|
40110
40276
|
}
|
|
40111
40277
|
function formatHighLevelTests(files, testPaths) {
|
|
40112
|
-
const heading2 =
|
|
40278
|
+
const heading2 = chalk253.bold.underline("Changed tests");
|
|
40113
40279
|
if (files.length === 0)
|
|
40114
40280
|
return `${heading2}
|
|
40115
|
-
${
|
|
40281
|
+
${chalk253.dim(`no changed test in files matching ${testPaths.join(", ")}`)}`;
|
|
40116
40282
|
return [
|
|
40117
40283
|
heading2,
|
|
40118
40284
|
...files.flatMap((file) => [
|
|
40119
40285
|
"",
|
|
40120
|
-
` ${
|
|
40286
|
+
` ${chalk253.bold(file.path)} ${chalk253.dim(`(${file.status})`)}`,
|
|
40121
40287
|
...file.tests.flatMap((node) => formatNode2(node, 0))
|
|
40122
40288
|
])
|
|
40123
40289
|
].join("\n");
|
|
@@ -40131,10 +40297,10 @@ function highLevelChangedFileCount(structure) {
|
|
|
40131
40297
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
40132
40298
|
function printHighLevelChecklist(subject) {
|
|
40133
40299
|
console.log(
|
|
40134
|
-
|
|
40300
|
+
chalk254.bold(
|
|
40135
40301
|
`High-level review of ${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`
|
|
40136
40302
|
),
|
|
40137
|
-
|
|
40303
|
+
chalk254.dim(
|
|
40138
40304
|
`\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
|
|
40139
40305
|
)
|
|
40140
40306
|
);
|
|
@@ -40148,12 +40314,12 @@ function printHighLevelChecklist(subject) {
|
|
|
40148
40314
|
console.log("");
|
|
40149
40315
|
console.log(formatHighLevelTests(subject.tests, subject.testPaths));
|
|
40150
40316
|
console.log(
|
|
40151
|
-
|
|
40317
|
+
chalk254.dim(
|
|
40152
40318
|
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
40153
40319
|
)
|
|
40154
40320
|
);
|
|
40155
40321
|
console.log(
|
|
40156
|
-
|
|
40322
|
+
chalk254.dim(
|
|
40157
40323
|
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
40158
40324
|
)
|
|
40159
40325
|
);
|
|
@@ -40439,18 +40605,18 @@ function partitionFindingsByDiff(findings, index2) {
|
|
|
40439
40605
|
}
|
|
40440
40606
|
|
|
40441
40607
|
// src/commands/review/warnOutOfDiff.ts
|
|
40442
|
-
import
|
|
40608
|
+
import chalk255 from "chalk";
|
|
40443
40609
|
function warnOutOfDiff(outOfDiff) {
|
|
40444
40610
|
if (outOfDiff.length === 0) return;
|
|
40445
40611
|
console.warn(
|
|
40446
|
-
|
|
40612
|
+
chalk255.yellow(
|
|
40447
40613
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
40448
40614
|
)
|
|
40449
40615
|
);
|
|
40450
40616
|
for (const finding of outOfDiff) {
|
|
40451
40617
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
40452
40618
|
console.warn(
|
|
40453
|
-
` ${
|
|
40619
|
+
` ${chalk255.yellow("\xB7")} ${finding.title} ${chalk255.dim(
|
|
40454
40620
|
`(${finding.file}:${range})`
|
|
40455
40621
|
)}`
|
|
40456
40622
|
);
|
|
@@ -40477,18 +40643,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
40477
40643
|
}
|
|
40478
40644
|
|
|
40479
40645
|
// src/commands/review/warnUnlocated.ts
|
|
40480
|
-
import
|
|
40646
|
+
import chalk256 from "chalk";
|
|
40481
40647
|
function warnUnlocated(unlocated) {
|
|
40482
40648
|
if (unlocated.length === 0) return;
|
|
40483
40649
|
console.warn(
|
|
40484
|
-
|
|
40650
|
+
chalk256.yellow(
|
|
40485
40651
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
40486
40652
|
)
|
|
40487
40653
|
);
|
|
40488
40654
|
for (const finding of unlocated) {
|
|
40489
|
-
const where = finding.location ||
|
|
40655
|
+
const where = finding.location || chalk256.dim("missing");
|
|
40490
40656
|
console.warn(
|
|
40491
|
-
` ${
|
|
40657
|
+
` ${chalk256.yellow("\xB7")} ${finding.title} ${chalk256.dim(`(${where})`)}`
|
|
40492
40658
|
);
|
|
40493
40659
|
}
|
|
40494
40660
|
}
|
|
@@ -40691,7 +40857,7 @@ import { format as format2 } from "util";
|
|
|
40691
40857
|
|
|
40692
40858
|
// src/commands/review/createReviewLogSink.ts
|
|
40693
40859
|
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync28 } from "fs";
|
|
40694
|
-
import { join as
|
|
40860
|
+
import { join as join89 } from "path";
|
|
40695
40861
|
var LOG_FILE = "review.log";
|
|
40696
40862
|
function createReviewLogSink() {
|
|
40697
40863
|
let logPath2;
|
|
@@ -40708,7 +40874,7 @@ function createReviewLogSink() {
|
|
|
40708
40874
|
},
|
|
40709
40875
|
attach(reviewDir) {
|
|
40710
40876
|
mkdirSync28(reviewDir, { recursive: true });
|
|
40711
|
-
logPath2 =
|
|
40877
|
+
logPath2 = join89(reviewDir, LOG_FILE);
|
|
40712
40878
|
const lines2 = [
|
|
40713
40879
|
"",
|
|
40714
40880
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -41868,9 +42034,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
41868
42034
|
|
|
41869
42035
|
// src/commands/review/buildReviewPaths.ts
|
|
41870
42036
|
import { homedir as homedir27 } from "os";
|
|
41871
|
-
import { basename as basename26, join as
|
|
42037
|
+
import { basename as basename26, join as join90 } from "path";
|
|
41872
42038
|
function buildReviewPaths(repoRoot2, key) {
|
|
41873
|
-
const reviewDir =
|
|
42039
|
+
const reviewDir = join90(
|
|
41874
42040
|
homedir27(),
|
|
41875
42041
|
".assist",
|
|
41876
42042
|
"reviews",
|
|
@@ -41879,10 +42045,10 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
41879
42045
|
);
|
|
41880
42046
|
return {
|
|
41881
42047
|
reviewDir,
|
|
41882
|
-
requestPath:
|
|
41883
|
-
claudePath:
|
|
41884
|
-
codexPath:
|
|
41885
|
-
synthesisPath:
|
|
42048
|
+
requestPath: join90(reviewDir, "request.md"),
|
|
42049
|
+
claudePath: join90(reviewDir, "claude.md"),
|
|
42050
|
+
codexPath: join90(reviewDir, "codex.md"),
|
|
42051
|
+
synthesisPath: join90(reviewDir, "synthesis.md")
|
|
41886
42052
|
};
|
|
41887
42053
|
}
|
|
41888
42054
|
|
|
@@ -42578,7 +42744,7 @@ function registerReview(program) {
|
|
|
42578
42744
|
|
|
42579
42745
|
// src/commands/rules/indexRules.ts
|
|
42580
42746
|
import path87 from "path";
|
|
42581
|
-
import
|
|
42747
|
+
import chalk257 from "chalk";
|
|
42582
42748
|
|
|
42583
42749
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
42584
42750
|
import { existsSync as existsSync71, readFileSync as readFileSync57, writeFileSync as writeFileSync45 } from "fs";
|
|
@@ -42589,12 +42755,12 @@ import { readFileSync as readFileSync56 } from "fs";
|
|
|
42589
42755
|
import path85 from "path";
|
|
42590
42756
|
|
|
42591
42757
|
// src/commands/rules/findClaudeFiles.ts
|
|
42592
|
-
import { readdirSync as
|
|
42758
|
+
import { readdirSync as readdirSync15 } from "fs";
|
|
42593
42759
|
import path84 from "path";
|
|
42594
42760
|
var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
|
|
42595
42761
|
function findClaudeFiles(dir) {
|
|
42596
42762
|
const results = [];
|
|
42597
|
-
for (const entry of
|
|
42763
|
+
for (const entry of readdirSync15(dir, { withFileTypes: true })) {
|
|
42598
42764
|
if (entry.isDirectory()) {
|
|
42599
42765
|
if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
|
|
42600
42766
|
continue;
|
|
@@ -42665,24 +42831,24 @@ function indexRules() {
|
|
|
42665
42831
|
const rootFile = path87.relative(process.cwd(), path87.join(root2, "CLAUDE.md"));
|
|
42666
42832
|
if (directories.length === 0) {
|
|
42667
42833
|
console.log(
|
|
42668
|
-
|
|
42834
|
+
chalk257.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
42669
42835
|
);
|
|
42670
42836
|
return;
|
|
42671
42837
|
}
|
|
42672
42838
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
42673
42839
|
for (const directory of directories)
|
|
42674
|
-
console.log(` ${
|
|
42840
|
+
console.log(` ${chalk257.cyan(directory)}`);
|
|
42675
42841
|
}
|
|
42676
42842
|
|
|
42677
42843
|
// src/commands/rules/listRules.ts
|
|
42678
42844
|
import path88 from "path";
|
|
42679
|
-
import
|
|
42845
|
+
import chalk258 from "chalk";
|
|
42680
42846
|
function listRules(target, options2 = {}) {
|
|
42681
42847
|
const resolved = path88.resolve(target ?? process.cwd());
|
|
42682
42848
|
const rules2 = readScopedRules(resolved);
|
|
42683
42849
|
if (rules2.length === 0) {
|
|
42684
42850
|
const label = path88.relative(process.cwd(), resolved) || ".";
|
|
42685
|
-
console.log(
|
|
42851
|
+
console.log(chalk258.gray(`No rules in scope for ${label}`));
|
|
42686
42852
|
return;
|
|
42687
42853
|
}
|
|
42688
42854
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -42692,21 +42858,21 @@ function listRules(target, options2 = {}) {
|
|
|
42692
42858
|
if (rule.source !== shown) {
|
|
42693
42859
|
shown = rule.source;
|
|
42694
42860
|
console.log(
|
|
42695
|
-
|
|
42861
|
+
chalk258.dim(base ? path88.relative(base, rule.source) : rule.source)
|
|
42696
42862
|
);
|
|
42697
42863
|
}
|
|
42698
42864
|
console.log(
|
|
42699
|
-
` ${
|
|
42865
|
+
` ${chalk258.cyan(rule.code.padEnd(width2))} ${rule.title ?? rule.text}`
|
|
42700
42866
|
);
|
|
42701
42867
|
if (options2.full && rule.title)
|
|
42702
|
-
console.log(` ${" ".repeat(width2)} ${
|
|
42868
|
+
console.log(` ${" ".repeat(width2)} ${chalk258.dim(rule.text)}`);
|
|
42703
42869
|
}
|
|
42704
42870
|
}
|
|
42705
42871
|
|
|
42706
42872
|
// src/commands/rules/addRule.ts
|
|
42707
42873
|
import { existsSync as existsSync73, readFileSync as readFileSync59, writeFileSync as writeFileSync46 } from "fs";
|
|
42708
42874
|
import path90 from "path";
|
|
42709
|
-
import
|
|
42875
|
+
import chalk259 from "chalk";
|
|
42710
42876
|
|
|
42711
42877
|
// src/commands/rules/insertRuleBullet.ts
|
|
42712
42878
|
function ruleBullet({ code, title, text: text18 }) {
|
|
@@ -42765,7 +42931,7 @@ function read2(file) {
|
|
|
42765
42931
|
function addRule(text18, options2) {
|
|
42766
42932
|
const rule = text18.trim();
|
|
42767
42933
|
if (rule === "") {
|
|
42768
|
-
console.error(
|
|
42934
|
+
console.error(chalk259.red("Rule text is required"));
|
|
42769
42935
|
process.exitCode = 1;
|
|
42770
42936
|
return;
|
|
42771
42937
|
}
|
|
@@ -42783,14 +42949,14 @@ function addRule(text18, options2) {
|
|
|
42783
42949
|
);
|
|
42784
42950
|
updateScopedRulesIndex(root2);
|
|
42785
42951
|
console.log(
|
|
42786
|
-
`Added ${
|
|
42952
|
+
`Added ${chalk259.cyan(code)} to ${path90.relative(process.cwd(), target) || target}`
|
|
42787
42953
|
);
|
|
42788
42954
|
}
|
|
42789
42955
|
|
|
42790
42956
|
// src/commands/rules/addUserRule.ts
|
|
42791
|
-
import
|
|
42957
|
+
import chalk260 from "chalk";
|
|
42792
42958
|
function fail9(message3) {
|
|
42793
|
-
console.error(
|
|
42959
|
+
console.error(chalk260.red(message3));
|
|
42794
42960
|
process.exitCode = 1;
|
|
42795
42961
|
}
|
|
42796
42962
|
function asRules(value) {
|
|
@@ -42809,7 +42975,7 @@ async function addToUserDb(rule) {
|
|
|
42809
42975
|
rule
|
|
42810
42976
|
]);
|
|
42811
42977
|
if (!result.ok) return fail9(result.errors.join("\n"));
|
|
42812
|
-
console.log(`Added ${
|
|
42978
|
+
console.log(`Added ${chalk260.cyan(rule.title)} to advice.rules in user (db)`);
|
|
42813
42979
|
}
|
|
42814
42980
|
function addToUserNode(rule, globalConfigPath) {
|
|
42815
42981
|
const advice = loadGlobalConfigRaw(globalConfigPath).advice;
|
|
@@ -42822,7 +42988,7 @@ function addToUserNode(rule, globalConfigPath) {
|
|
|
42822
42988
|
);
|
|
42823
42989
|
if (!result.ok) return fail9(result.errors.join("\n"));
|
|
42824
42990
|
console.log(
|
|
42825
|
-
`Added ${
|
|
42991
|
+
`Added ${chalk260.cyan(rule.title)} to advice.rules in user (node) (${globalConfigFileLabel(globalConfigPath)})`
|
|
42826
42992
|
);
|
|
42827
42993
|
}
|
|
42828
42994
|
async function addUserRule(text18, options2, globalConfigPath = getGlobalConfigPath()) {
|
|
@@ -42877,7 +43043,7 @@ function registerRules(program) {
|
|
|
42877
43043
|
}
|
|
42878
43044
|
|
|
42879
43045
|
// src/commands/seq/seqAuth.ts
|
|
42880
|
-
import
|
|
43046
|
+
import chalk262 from "chalk";
|
|
42881
43047
|
|
|
42882
43048
|
// src/commands/seq/loadConnections.ts
|
|
42883
43049
|
function loadConnections2() {
|
|
@@ -42906,10 +43072,10 @@ function setDefaultConnection(name) {
|
|
|
42906
43072
|
}
|
|
42907
43073
|
|
|
42908
43074
|
// src/shared/assertUniqueName.ts
|
|
42909
|
-
import
|
|
43075
|
+
import chalk261 from "chalk";
|
|
42910
43076
|
function assertUniqueName(existingNames, name) {
|
|
42911
43077
|
if (existingNames.includes(name)) {
|
|
42912
|
-
console.error(
|
|
43078
|
+
console.error(chalk261.red(`Connection "${name}" already exists.`));
|
|
42913
43079
|
process.exit(1);
|
|
42914
43080
|
}
|
|
42915
43081
|
}
|
|
@@ -42927,16 +43093,16 @@ async function promptConnection2(existingNames) {
|
|
|
42927
43093
|
var seqAuth = createConnectionAuth({
|
|
42928
43094
|
load: loadConnections2,
|
|
42929
43095
|
save: saveConnections2,
|
|
42930
|
-
format: (c) => `${
|
|
43096
|
+
format: (c) => `${chalk262.bold(c.name)} ${c.url}`,
|
|
42931
43097
|
promptNew: promptConnection2,
|
|
42932
43098
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
42933
43099
|
});
|
|
42934
43100
|
|
|
42935
43101
|
// src/commands/seq/seqQuery.ts
|
|
42936
|
-
import
|
|
43102
|
+
import chalk266 from "chalk";
|
|
42937
43103
|
|
|
42938
43104
|
// src/commands/seq/fetchSeq.ts
|
|
42939
|
-
import
|
|
43105
|
+
import chalk263 from "chalk";
|
|
42940
43106
|
async function fetchSeq(conn, path109, params) {
|
|
42941
43107
|
const url = `${conn.url}${path109}?${params}`;
|
|
42942
43108
|
const response = await fetch(url, {
|
|
@@ -42947,7 +43113,7 @@ async function fetchSeq(conn, path109, params) {
|
|
|
42947
43113
|
});
|
|
42948
43114
|
if (!response.ok) {
|
|
42949
43115
|
const body = await response.text();
|
|
42950
|
-
console.error(
|
|
43116
|
+
console.error(chalk263.red(`Seq returned ${response.status}: ${body}`));
|
|
42951
43117
|
process.exit(1);
|
|
42952
43118
|
}
|
|
42953
43119
|
return response;
|
|
@@ -43006,23 +43172,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
43006
43172
|
}
|
|
43007
43173
|
|
|
43008
43174
|
// src/commands/seq/formatEvent.ts
|
|
43009
|
-
import
|
|
43175
|
+
import chalk264 from "chalk";
|
|
43010
43176
|
function levelColor(level) {
|
|
43011
43177
|
switch (level) {
|
|
43012
43178
|
case "Fatal":
|
|
43013
|
-
return
|
|
43179
|
+
return chalk264.bgRed.white;
|
|
43014
43180
|
case "Error":
|
|
43015
|
-
return
|
|
43181
|
+
return chalk264.red;
|
|
43016
43182
|
case "Warning":
|
|
43017
|
-
return
|
|
43183
|
+
return chalk264.yellow;
|
|
43018
43184
|
case "Information":
|
|
43019
|
-
return
|
|
43185
|
+
return chalk264.cyan;
|
|
43020
43186
|
case "Debug":
|
|
43021
|
-
return
|
|
43187
|
+
return chalk264.gray;
|
|
43022
43188
|
case "Verbose":
|
|
43023
|
-
return
|
|
43189
|
+
return chalk264.dim;
|
|
43024
43190
|
default:
|
|
43025
|
-
return
|
|
43191
|
+
return chalk264.white;
|
|
43026
43192
|
}
|
|
43027
43193
|
}
|
|
43028
43194
|
function levelAbbrev(level) {
|
|
@@ -43063,12 +43229,12 @@ function formatTimestamp(iso) {
|
|
|
43063
43229
|
function formatEvent(event) {
|
|
43064
43230
|
const color = levelColor(event.Level);
|
|
43065
43231
|
const abbrev = levelAbbrev(event.Level);
|
|
43066
|
-
const ts10 =
|
|
43232
|
+
const ts10 = chalk264.dim(formatTimestamp(event.Timestamp));
|
|
43067
43233
|
const msg = renderMessage(event);
|
|
43068
43234
|
const lines2 = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
|
|
43069
43235
|
if (event.Exception) {
|
|
43070
43236
|
for (const line of event.Exception.split("\n")) {
|
|
43071
|
-
lines2.push(
|
|
43237
|
+
lines2.push(chalk264.red(` ${line}`));
|
|
43072
43238
|
}
|
|
43073
43239
|
}
|
|
43074
43240
|
return lines2.join("\n");
|
|
@@ -43101,11 +43267,11 @@ function rejectTimestampFilter(filter) {
|
|
|
43101
43267
|
}
|
|
43102
43268
|
|
|
43103
43269
|
// src/shared/resolveNamedConnection.ts
|
|
43104
|
-
import
|
|
43270
|
+
import chalk265 from "chalk";
|
|
43105
43271
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
43106
43272
|
if (connections.length === 0) {
|
|
43107
43273
|
console.error(
|
|
43108
|
-
|
|
43274
|
+
chalk265.red(
|
|
43109
43275
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
43110
43276
|
)
|
|
43111
43277
|
);
|
|
@@ -43114,7 +43280,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
43114
43280
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
43115
43281
|
const connection = connections.find((c) => c.name === target);
|
|
43116
43282
|
if (!connection) {
|
|
43117
|
-
console.error(
|
|
43283
|
+
console.error(chalk265.red(`${kind} connection "${target}" not found.`));
|
|
43118
43284
|
process.exit(1);
|
|
43119
43285
|
}
|
|
43120
43286
|
return connection;
|
|
@@ -43143,7 +43309,7 @@ async function seqQuery(filter, options2) {
|
|
|
43143
43309
|
new URLSearchParams({ filter, count: String(count10) })
|
|
43144
43310
|
);
|
|
43145
43311
|
if (events.length === 0) {
|
|
43146
|
-
console.log(
|
|
43312
|
+
console.log(chalk266.yellow("No events found."));
|
|
43147
43313
|
return;
|
|
43148
43314
|
}
|
|
43149
43315
|
if (options2.json) {
|
|
@@ -43154,11 +43320,11 @@ async function seqQuery(filter, options2) {
|
|
|
43154
43320
|
for (const event of chronological) {
|
|
43155
43321
|
console.log(formatEvent(event));
|
|
43156
43322
|
}
|
|
43157
|
-
console.log(
|
|
43323
|
+
console.log(chalk266.dim(`
|
|
43158
43324
|
${events.length} events`));
|
|
43159
43325
|
if (events.length >= count10) {
|
|
43160
43326
|
console.log(
|
|
43161
|
-
|
|
43327
|
+
chalk266.yellow(
|
|
43162
43328
|
`Results limited to ${count10}. Use --count to retrieve more.`
|
|
43163
43329
|
)
|
|
43164
43330
|
);
|
|
@@ -43166,10 +43332,10 @@ ${events.length} events`));
|
|
|
43166
43332
|
}
|
|
43167
43333
|
|
|
43168
43334
|
// src/shared/setNamedDefaultConnection.ts
|
|
43169
|
-
import
|
|
43335
|
+
import chalk267 from "chalk";
|
|
43170
43336
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
43171
43337
|
if (!connections.find((c) => c.name === name)) {
|
|
43172
|
-
console.error(
|
|
43338
|
+
console.error(chalk267.red(`Connection "${name}" not found.`));
|
|
43173
43339
|
process.exit(1);
|
|
43174
43340
|
}
|
|
43175
43341
|
setDefault(name);
|
|
@@ -43205,7 +43371,7 @@ function registerSeq(program) {
|
|
|
43205
43371
|
}
|
|
43206
43372
|
|
|
43207
43373
|
// src/commands/show.ts
|
|
43208
|
-
import { randomUUID as
|
|
43374
|
+
import { randomUUID as randomUUID25 } from "crypto";
|
|
43209
43375
|
|
|
43210
43376
|
// src/commands/sessions/shared/sendShowPreview.ts
|
|
43211
43377
|
async function sendShowPreview(request) {
|
|
@@ -43257,7 +43423,7 @@ async function show3(options2) {
|
|
|
43257
43423
|
try {
|
|
43258
43424
|
await sendShowPreview({
|
|
43259
43425
|
sessionId,
|
|
43260
|
-
requestId:
|
|
43426
|
+
requestId: randomUUID25(),
|
|
43261
43427
|
title: options2.title ?? "Show",
|
|
43262
43428
|
body
|
|
43263
43429
|
});
|
|
@@ -43289,8 +43455,10 @@ function registerSignal(program) {
|
|
|
43289
43455
|
"/next"
|
|
43290
43456
|
);
|
|
43291
43457
|
internalCommand(
|
|
43292
|
-
signalCommand.command("done").argument("[
|
|
43293
|
-
|
|
43458
|
+
signalCommand.command("done").argument("[ids...]", "Backlog item IDs created by the session").description(
|
|
43459
|
+
"Write a done signal to end a --once launch session, once every item it set out to create exists"
|
|
43460
|
+
).action((ids) => {
|
|
43461
|
+
writeSignal("done", ids.length > 0 ? { ids } : void 0);
|
|
43294
43462
|
console.log("Signal written.");
|
|
43295
43463
|
}),
|
|
43296
43464
|
"/draft, /bug, /refine"
|
|
@@ -43341,7 +43509,7 @@ function readSlackParts(files) {
|
|
|
43341
43509
|
}
|
|
43342
43510
|
|
|
43343
43511
|
// src/commands/slack/reviewProposedSlackMessage.ts
|
|
43344
|
-
import { randomUUID as
|
|
43512
|
+
import { randomUUID as randomUUID26 } from "crypto";
|
|
43345
43513
|
async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
43346
43514
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
43347
43515
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
@@ -43351,7 +43519,7 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
43351
43519
|
part ? `Slack message ${part.index} of ${part.total}` : "Slack message preview",
|
|
43352
43520
|
{
|
|
43353
43521
|
sessionId,
|
|
43354
|
-
requestId:
|
|
43522
|
+
requestId: randomUUID26(),
|
|
43355
43523
|
title: part ? `${destination} (${part.index}/${part.total})` : destination,
|
|
43356
43524
|
body,
|
|
43357
43525
|
prNumber: null,
|
|
@@ -43364,12 +43532,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
43364
43532
|
}
|
|
43365
43533
|
|
|
43366
43534
|
// src/commands/slack/slackWorkingFile.ts
|
|
43367
|
-
import { join as
|
|
43535
|
+
import { join as join91 } from "path";
|
|
43368
43536
|
function slackWorkingFile(channel, partIndex) {
|
|
43369
43537
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
43370
|
-
const dir =
|
|
43538
|
+
const dir = join91(getStoreDir(), "slack");
|
|
43371
43539
|
const name = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
43372
|
-
return { dir, bodyPath:
|
|
43540
|
+
return { dir, bodyPath: join91(dir, `${name}.md`) };
|
|
43373
43541
|
}
|
|
43374
43542
|
|
|
43375
43543
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
@@ -43471,7 +43639,7 @@ function registerSlack(program) {
|
|
|
43471
43639
|
}
|
|
43472
43640
|
|
|
43473
43641
|
// src/commands/sql/sqlAuth.ts
|
|
43474
|
-
import
|
|
43642
|
+
import chalk269 from "chalk";
|
|
43475
43643
|
|
|
43476
43644
|
// src/commands/sql/loadConnections.ts
|
|
43477
43645
|
function loadConnections3() {
|
|
@@ -43500,7 +43668,7 @@ function setDefaultConnection2(name) {
|
|
|
43500
43668
|
}
|
|
43501
43669
|
|
|
43502
43670
|
// src/commands/sql/promptConnection.ts
|
|
43503
|
-
import
|
|
43671
|
+
import chalk268 from "chalk";
|
|
43504
43672
|
async function promptConnection3(existingNames) {
|
|
43505
43673
|
const name = await promptInput("name", "Connection name:", "default");
|
|
43506
43674
|
assertUniqueName(existingNames, name);
|
|
@@ -43508,7 +43676,7 @@ async function promptConnection3(existingNames) {
|
|
|
43508
43676
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
43509
43677
|
const port = Number.parseInt(portStr, 10);
|
|
43510
43678
|
if (!Number.isFinite(port)) {
|
|
43511
|
-
console.error(
|
|
43679
|
+
console.error(chalk268.red(`Invalid port "${portStr}".`));
|
|
43512
43680
|
process.exit(1);
|
|
43513
43681
|
}
|
|
43514
43682
|
const user = await promptInput("user", "User:");
|
|
@@ -43521,13 +43689,13 @@ async function promptConnection3(existingNames) {
|
|
|
43521
43689
|
var sqlAuth = createConnectionAuth({
|
|
43522
43690
|
load: loadConnections3,
|
|
43523
43691
|
save: saveConnections3,
|
|
43524
|
-
format: (c) => `${
|
|
43692
|
+
format: (c) => `${chalk269.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
43525
43693
|
promptNew: promptConnection3,
|
|
43526
43694
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
43527
43695
|
});
|
|
43528
43696
|
|
|
43529
43697
|
// src/commands/sql/printTable.ts
|
|
43530
|
-
import
|
|
43698
|
+
import chalk270 from "chalk";
|
|
43531
43699
|
function formatCell(value) {
|
|
43532
43700
|
if (value === null || value === void 0) return "";
|
|
43533
43701
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -43536,7 +43704,7 @@ function formatCell(value) {
|
|
|
43536
43704
|
}
|
|
43537
43705
|
function printTable(rows) {
|
|
43538
43706
|
if (rows.length === 0) {
|
|
43539
|
-
console.log(
|
|
43707
|
+
console.log(chalk270.yellow("(no rows)"));
|
|
43540
43708
|
return;
|
|
43541
43709
|
}
|
|
43542
43710
|
const columns = Object.keys(rows[0]);
|
|
@@ -43544,13 +43712,13 @@ function printTable(rows) {
|
|
|
43544
43712
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
43545
43713
|
);
|
|
43546
43714
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
43547
|
-
console.log(
|
|
43548
|
-
console.log(
|
|
43715
|
+
console.log(chalk270.dim(header));
|
|
43716
|
+
console.log(chalk270.dim("-".repeat(header.length)));
|
|
43549
43717
|
for (const row3 of rows) {
|
|
43550
43718
|
const line = columns.map((c, i) => formatCell(row3[c]).padEnd(widths[i])).join(" ");
|
|
43551
43719
|
console.log(line);
|
|
43552
43720
|
}
|
|
43553
|
-
console.log(
|
|
43721
|
+
console.log(chalk270.dim(`
|
|
43554
43722
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
43555
43723
|
}
|
|
43556
43724
|
|
|
@@ -43610,7 +43778,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
43610
43778
|
}
|
|
43611
43779
|
|
|
43612
43780
|
// src/commands/sql/sqlMutate.ts
|
|
43613
|
-
import
|
|
43781
|
+
import chalk271 from "chalk";
|
|
43614
43782
|
|
|
43615
43783
|
// src/commands/sql/isMutation.ts
|
|
43616
43784
|
var MUTATION_KEYWORDS = [
|
|
@@ -43644,7 +43812,7 @@ function isMutation(sql31) {
|
|
|
43644
43812
|
async function sqlMutate(query, connectionName) {
|
|
43645
43813
|
if (!isMutation(query)) {
|
|
43646
43814
|
console.error(
|
|
43647
|
-
|
|
43815
|
+
chalk271.red(
|
|
43648
43816
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
43649
43817
|
)
|
|
43650
43818
|
);
|
|
@@ -43654,18 +43822,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
43654
43822
|
const pool = await sqlConnect(conn);
|
|
43655
43823
|
try {
|
|
43656
43824
|
const result = await pool.request().query(query);
|
|
43657
|
-
console.log(
|
|
43825
|
+
console.log(chalk271.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
43658
43826
|
} finally {
|
|
43659
43827
|
await pool.close();
|
|
43660
43828
|
}
|
|
43661
43829
|
}
|
|
43662
43830
|
|
|
43663
43831
|
// src/commands/sql/sqlQuery.ts
|
|
43664
|
-
import
|
|
43832
|
+
import chalk272 from "chalk";
|
|
43665
43833
|
async function sqlQuery(query, connectionName) {
|
|
43666
43834
|
if (isMutation(query)) {
|
|
43667
43835
|
console.error(
|
|
43668
|
-
|
|
43836
|
+
chalk272.red(
|
|
43669
43837
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
43670
43838
|
)
|
|
43671
43839
|
);
|
|
@@ -43680,7 +43848,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
43680
43848
|
printTable(rows);
|
|
43681
43849
|
} else {
|
|
43682
43850
|
console.log(
|
|
43683
|
-
|
|
43851
|
+
chalk272.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
43684
43852
|
);
|
|
43685
43853
|
}
|
|
43686
43854
|
} finally {
|
|
@@ -44095,7 +44263,7 @@ function syncPi(claudeDir, options2) {
|
|
|
44095
44263
|
// src/commands/sync/syncSettings.ts
|
|
44096
44264
|
import * as fs47 from "fs";
|
|
44097
44265
|
import * as path101 from "path";
|
|
44098
|
-
import
|
|
44266
|
+
import chalk273 from "chalk";
|
|
44099
44267
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
44100
44268
|
const source = path101.join(claudeDir, "settings.json");
|
|
44101
44269
|
const target = path101.join(targetBase, "settings.json");
|
|
@@ -44114,7 +44282,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
44114
44282
|
if (mergedContent !== normalizedTarget) {
|
|
44115
44283
|
if (!options2?.yes) {
|
|
44116
44284
|
console.log(
|
|
44117
|
-
|
|
44285
|
+
chalk273.yellow(
|
|
44118
44286
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
44119
44287
|
)
|
|
44120
44288
|
);
|
|
@@ -44122,7 +44290,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
44122
44290
|
printDiff(targetContent, mergedContent);
|
|
44123
44291
|
printAutoConfirmHint();
|
|
44124
44292
|
const confirm = await promptConfirm(
|
|
44125
|
-
|
|
44293
|
+
chalk273.red("Overwrite existing settings.json?"),
|
|
44126
44294
|
false
|
|
44127
44295
|
);
|
|
44128
44296
|
if (!confirm) {
|
|
@@ -44551,21 +44719,21 @@ async function configure() {
|
|
|
44551
44719
|
}
|
|
44552
44720
|
|
|
44553
44721
|
// src/commands/transcript/list.ts
|
|
44554
|
-
import { existsSync as existsSync79, readdirSync as
|
|
44555
|
-
import { join as
|
|
44722
|
+
import { existsSync as existsSync79, readdirSync as readdirSync22, statSync as statSync12 } from "fs";
|
|
44723
|
+
import { join as join103 } from "path";
|
|
44556
44724
|
function list5() {
|
|
44557
44725
|
const { vttDir } = getTranscriptConfig();
|
|
44558
44726
|
if (!existsSync79(vttDir)) return;
|
|
44559
|
-
for (const entry of
|
|
44727
|
+
for (const entry of readdirSync22(vttDir)) {
|
|
44560
44728
|
if (!entry.endsWith(".vtt")) continue;
|
|
44561
|
-
if (statSync12(
|
|
44729
|
+
if (statSync12(join103(vttDir, entry)).isDirectory()) continue;
|
|
44562
44730
|
console.log(entry);
|
|
44563
44731
|
}
|
|
44564
44732
|
}
|
|
44565
44733
|
|
|
44566
44734
|
// src/commands/transcript/move.ts
|
|
44567
44735
|
import { existsSync as existsSync80, mkdirSync as mkdirSync37, renameSync as renameSync5, writeFileSync as writeFileSync53 } from "fs";
|
|
44568
|
-
import { basename as basename29, join as
|
|
44736
|
+
import { basename as basename29, join as join104 } from "path";
|
|
44569
44737
|
|
|
44570
44738
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
44571
44739
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -44575,9 +44743,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
44575
44743
|
// src/commands/transcript/move.ts
|
|
44576
44744
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
44577
44745
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
44578
|
-
const processedDir =
|
|
44746
|
+
const processedDir = join104(vttDir, "processed");
|
|
44579
44747
|
mkdirSync37(processedDir, { recursive: true });
|
|
44580
|
-
renameSync5(sourcePath,
|
|
44748
|
+
renameSync5(sourcePath, join104(processedDir, filename));
|
|
44581
44749
|
}
|
|
44582
44750
|
function move(file, options2) {
|
|
44583
44751
|
const { date, client } = options2;
|
|
@@ -44587,19 +44755,19 @@ function move(file, options2) {
|
|
|
44587
44755
|
}
|
|
44588
44756
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
44589
44757
|
const filename = basename29(file);
|
|
44590
|
-
const sourcePath =
|
|
44758
|
+
const sourcePath = join104(vttDir, filename);
|
|
44591
44759
|
if (!existsSync80(sourcePath)) {
|
|
44592
44760
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
44593
44761
|
process.exit(1);
|
|
44594
44762
|
}
|
|
44595
44763
|
const base = basename29(filename, ".vtt").replace(/ Transcription$/, "");
|
|
44596
44764
|
const outputName = `${date} ${base}.md`;
|
|
44597
|
-
const formattedDir =
|
|
44765
|
+
const formattedDir = join104(transcriptsDir, client);
|
|
44598
44766
|
mkdirSync37(formattedDir, { recursive: true });
|
|
44599
|
-
const formattedPath =
|
|
44767
|
+
const formattedPath = join104(formattedDir, outputName);
|
|
44600
44768
|
writeFileSync53(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
44601
44769
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
44602
|
-
const summaryPath =
|
|
44770
|
+
const summaryPath = join104(summaryDir, client, outputName);
|
|
44603
44771
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
44604
44772
|
console.log(`Summary target: ${summaryPath}`);
|
|
44605
44773
|
}
|
|
@@ -45413,10 +45581,10 @@ function checkSequential(migrations3, files) {
|
|
|
45413
45581
|
}
|
|
45414
45582
|
|
|
45415
45583
|
// src/commands/verify/migrations/listMigrationFiles.ts
|
|
45416
|
-
import { readdirSync as
|
|
45584
|
+
import { readdirSync as readdirSync23 } from "fs";
|
|
45417
45585
|
var MIGRATION_FILE2 = /^migration\d+[A-Za-z0-9]*\.ts$/;
|
|
45418
45586
|
function listMigrationFiles(dir) {
|
|
45419
|
-
return
|
|
45587
|
+
return readdirSync23(dir).filter((file) => MIGRATION_FILE2.test(file));
|
|
45420
45588
|
}
|
|
45421
45589
|
|
|
45422
45590
|
// src/commands/verify/migrations/readBaselineMigrations.ts
|
|
@@ -46378,17 +46546,17 @@ function registerWatch(program) {
|
|
|
46378
46546
|
|
|
46379
46547
|
// src/commands/roam/postRoamActivity.ts
|
|
46380
46548
|
import { execFileSync as execFileSync32 } from "child_process";
|
|
46381
|
-
import { readdirSync as
|
|
46382
|
-
import { join as
|
|
46549
|
+
import { readdirSync as readdirSync24, readFileSync as readFileSync68, statSync as statSync13 } from "fs";
|
|
46550
|
+
import { join as join105 } from "path";
|
|
46383
46551
|
function findPortFile(roamDir) {
|
|
46384
46552
|
let entries;
|
|
46385
46553
|
try {
|
|
46386
|
-
entries =
|
|
46554
|
+
entries = readdirSync24(roamDir);
|
|
46387
46555
|
} catch {
|
|
46388
46556
|
return void 0;
|
|
46389
46557
|
}
|
|
46390
46558
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
46391
|
-
const path109 =
|
|
46559
|
+
const path109 = join105(roamDir, name);
|
|
46392
46560
|
try {
|
|
46393
46561
|
return { path: path109, mtimeMs: statSync13(path109).mtimeMs };
|
|
46394
46562
|
} catch {
|
|
@@ -46405,7 +46573,7 @@ var PID_BY_APP = {
|
|
|
46405
46573
|
function postRoamActivity(app, event) {
|
|
46406
46574
|
const appData = process.env.APPDATA;
|
|
46407
46575
|
if (!appData) return;
|
|
46408
|
-
const portFile = findPortFile(
|
|
46576
|
+
const portFile = findPortFile(join105(appData, "Roam"));
|
|
46409
46577
|
if (!portFile) return;
|
|
46410
46578
|
let port;
|
|
46411
46579
|
try {
|
|
@@ -46748,11 +46916,11 @@ function requireParsedArgs() {
|
|
|
46748
46916
|
}
|
|
46749
46917
|
|
|
46750
46918
|
// src/commands/run/runCommandFilePath.ts
|
|
46751
|
-
import { join as
|
|
46919
|
+
import { join as join106 } from "path";
|
|
46752
46920
|
function runCommandFilePath(name) {
|
|
46753
46921
|
const segments = name.split(":");
|
|
46754
46922
|
const file = `${segments.pop()}.md`;
|
|
46755
|
-
return
|
|
46923
|
+
return join106(".claude", "commands", ...segments, file);
|
|
46756
46924
|
}
|
|
46757
46925
|
|
|
46758
46926
|
// src/commands/run/add.ts
|
|
@@ -46880,8 +47048,8 @@ function registerRunAdd(runCommand) {
|
|
|
46880
47048
|
}
|
|
46881
47049
|
|
|
46882
47050
|
// src/commands/run/remove.ts
|
|
46883
|
-
import { existsSync as existsSync85, readdirSync as
|
|
46884
|
-
import { dirname as dirname46, join as
|
|
47051
|
+
import { existsSync as existsSync85, readdirSync as readdirSync25, rmdirSync, unlinkSync as unlinkSync21 } from "fs";
|
|
47052
|
+
import { dirname as dirname46, join as join107 } from "path";
|
|
46885
47053
|
|
|
46886
47054
|
// src/commands/run/removeRepoRunConfig.ts
|
|
46887
47055
|
function isNamed(entry, name) {
|
|
@@ -46899,15 +47067,15 @@ function removeRepoRunConfig(name, repoName, cwd = process.cwd()) {
|
|
|
46899
47067
|
|
|
46900
47068
|
// src/commands/run/remove.ts
|
|
46901
47069
|
function removeEmptyNamespaceDirs(filePath) {
|
|
46902
|
-
const root2 =
|
|
47070
|
+
const root2 = join107(".claude", "commands");
|
|
46903
47071
|
for (let dir = dirname46(filePath); dir !== root2; dir = dirname46(dir)) {
|
|
46904
|
-
if (!existsSync85(dir) ||
|
|
47072
|
+
if (!existsSync85(dir) || readdirSync25(dir).length > 0) return;
|
|
46905
47073
|
rmdirSync(dir);
|
|
46906
47074
|
}
|
|
46907
47075
|
}
|
|
46908
47076
|
function deleteCommandFile(name) {
|
|
46909
47077
|
const filePath = runCommandFilePath(name);
|
|
46910
|
-
const legacyPath =
|
|
47078
|
+
const legacyPath = join107(".claude", "commands", `${name}.md`);
|
|
46911
47079
|
for (const path109 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
|
|
46912
47080
|
if (existsSync85(path109)) {
|
|
46913
47081
|
unlinkSync21(path109);
|
|
@@ -46964,18 +47132,18 @@ function registerRun(program) {
|
|
|
46964
47132
|
}
|
|
46965
47133
|
|
|
46966
47134
|
// src/commands/sessions/nodes/formatLink.ts
|
|
46967
|
-
import
|
|
47135
|
+
import chalk274 from "chalk";
|
|
46968
47136
|
var STATE_COLOURS = {
|
|
46969
|
-
connected:
|
|
46970
|
-
connecting:
|
|
46971
|
-
disconnected:
|
|
46972
|
-
"version-blocked":
|
|
47137
|
+
connected: chalk274.green,
|
|
47138
|
+
connecting: chalk274.yellow,
|
|
47139
|
+
disconnected: chalk274.red,
|
|
47140
|
+
"version-blocked": chalk274.red
|
|
46973
47141
|
};
|
|
46974
47142
|
function formatLink(link3) {
|
|
46975
|
-
const colour = STATE_COLOURS[link3.state] ??
|
|
47143
|
+
const colour = STATE_COLOURS[link3.state] ?? chalk274.white;
|
|
46976
47144
|
const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
|
|
46977
47145
|
const error = link3.error ? `
|
|
46978
|
-
${
|
|
47146
|
+
${chalk274.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
|
|
46979
47147
|
return ` ${link3.name} ${colour(link3.state)} ${link3.url}${peer}${error}`;
|
|
46980
47148
|
}
|
|
46981
47149
|
|
|
@@ -47699,7 +47867,7 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
47699
47867
|
|
|
47700
47868
|
// src/commands/sessions/daemon/findServerParents.ts
|
|
47701
47869
|
import { existsSync as existsSync87 } from "fs";
|
|
47702
|
-
import { join as
|
|
47870
|
+
import { join as join108, resolve as resolve30 } from "path";
|
|
47703
47871
|
function isLive(session) {
|
|
47704
47872
|
return !!session.pty && session.status !== "done" && session.status !== "error";
|
|
47705
47873
|
}
|
|
@@ -47708,7 +47876,7 @@ function isLiveAgent(session) {
|
|
|
47708
47876
|
}
|
|
47709
47877
|
function serverRunDirs(sessions, file) {
|
|
47710
47878
|
return new Set(
|
|
47711
|
-
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve30(s.cwd)).filter((dir) => existsSync87(
|
|
47879
|
+
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve30(s.cwd)).filter((dir) => existsSync87(join108(dir, file)))
|
|
47712
47880
|
);
|
|
47713
47881
|
}
|
|
47714
47882
|
function findServerParents(sessions, file) {
|
|
@@ -48359,7 +48527,7 @@ var ClientHub = class extends Set {
|
|
|
48359
48527
|
harnessLimits = /* @__PURE__ */ new Map();
|
|
48360
48528
|
// why: log delivery is opt-in so browser tabs aren't spammed; only connections that ask via subscribe-logs receive daemonLog lines.
|
|
48361
48529
|
logSubscribers = /* @__PURE__ */ new Set();
|
|
48362
|
-
peers = /* @__PURE__ */ new
|
|
48530
|
+
peers = /* @__PURE__ */ new Map();
|
|
48363
48531
|
updateLimits(rateLimits) {
|
|
48364
48532
|
this.latestLimits = rateLimits;
|
|
48365
48533
|
broadcast(this, { type: "limits", rateLimits });
|
|
@@ -48386,12 +48554,20 @@ var ClientHub = class extends Set {
|
|
|
48386
48554
|
for (const [harness, rateLimits] of this.harnessLimits)
|
|
48387
48555
|
sendTo(client, { type: "limits", harness, rateLimits });
|
|
48388
48556
|
}
|
|
48389
|
-
markPeer(client) {
|
|
48390
|
-
this.peers.
|
|
48557
|
+
markPeer(client, node) {
|
|
48558
|
+
this.peers.set(client, node);
|
|
48391
48559
|
}
|
|
48392
48560
|
isPeer(client) {
|
|
48393
48561
|
return this.peers.has(client);
|
|
48394
48562
|
}
|
|
48563
|
+
peerNode(client) {
|
|
48564
|
+
return this.peers.get(client);
|
|
48565
|
+
}
|
|
48566
|
+
peerFor(node) {
|
|
48567
|
+
let latest2;
|
|
48568
|
+
for (const [client, name] of this.peers) if (name === node) latest2 = client;
|
|
48569
|
+
return latest2;
|
|
48570
|
+
}
|
|
48395
48571
|
viewers() {
|
|
48396
48572
|
return new Set([...this].filter((client) => !this.peers.has(client)));
|
|
48397
48573
|
}
|
|
@@ -48417,7 +48593,7 @@ var ClientHub = class extends Set {
|
|
|
48417
48593
|
};
|
|
48418
48594
|
|
|
48419
48595
|
// src/commands/sessions/daemon/createSession.ts
|
|
48420
|
-
import { randomUUID as
|
|
48596
|
+
import { randomUUID as randomUUID27 } from "crypto";
|
|
48421
48597
|
|
|
48422
48598
|
// src/commands/sessions/daemon/sessionBase.ts
|
|
48423
48599
|
function sessionBase(id, status2) {
|
|
@@ -48640,7 +48816,7 @@ function spawnRun(opts) {
|
|
|
48640
48816
|
function createSession(id, { prompt, cwd, design, auto, harness, holdPty } = {}) {
|
|
48641
48817
|
if (harness && harness !== "claude")
|
|
48642
48818
|
return createHarnessSession(id, harness, prompt, cwd, holdPty);
|
|
48643
|
-
const claudeSessionId =
|
|
48819
|
+
const claudeSessionId = randomUUID27();
|
|
48644
48820
|
return {
|
|
48645
48821
|
...sessionBase(id, prompt ? "running" : "waiting"),
|
|
48646
48822
|
name: `Session ${id}`,
|
|
@@ -49225,12 +49401,12 @@ import { basename as basename32 } from "path";
|
|
|
49225
49401
|
|
|
49226
49402
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
49227
49403
|
import { existsSync as existsSync93 } from "fs";
|
|
49228
|
-
import { join as
|
|
49404
|
+
import { join as join112 } from "path";
|
|
49229
49405
|
|
|
49230
49406
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
49231
49407
|
import { statSync as statSync15 } from "fs";
|
|
49232
49408
|
import { rm as rm3 } from "fs/promises";
|
|
49233
|
-
import { join as
|
|
49409
|
+
import { join as join111 } from "path";
|
|
49234
49410
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
49235
49411
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
49236
49412
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -49258,7 +49434,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
49258
49434
|
return { removed: true };
|
|
49259
49435
|
}
|
|
49260
49436
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
49261
|
-
return statSync15(
|
|
49437
|
+
return statSync15(join111(worktreePath, ".git"), {
|
|
49262
49438
|
throwIfNoEntry: false
|
|
49263
49439
|
})?.isDirectory() === true;
|
|
49264
49440
|
}
|
|
@@ -49294,7 +49470,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
49294
49470
|
);
|
|
49295
49471
|
}
|
|
49296
49472
|
function strandedReason(worktreePath, cause) {
|
|
49297
|
-
if (!existsSync93(
|
|
49473
|
+
if (!existsSync93(join112(worktreePath, ".git")))
|
|
49298
49474
|
return "its .git link is already gone";
|
|
49299
49475
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
49300
49476
|
return "git no longer recognises it as a working tree";
|
|
@@ -49527,12 +49703,12 @@ function closeGateApplies(sessions, session) {
|
|
|
49527
49703
|
}
|
|
49528
49704
|
|
|
49529
49705
|
// src/commands/sessions/daemon/worktree/liveProcessesInTree.ts
|
|
49530
|
-
import { readdirSync as
|
|
49706
|
+
import { readdirSync as readdirSync27, readlinkSync } from "fs";
|
|
49531
49707
|
import { sep as sep4 } from "path";
|
|
49532
49708
|
function liveProcessesInTree(treePath, procRoot = "/proc") {
|
|
49533
49709
|
let entries;
|
|
49534
49710
|
try {
|
|
49535
|
-
entries =
|
|
49711
|
+
entries = readdirSync27(procRoot);
|
|
49536
49712
|
} catch {
|
|
49537
49713
|
return [];
|
|
49538
49714
|
}
|
|
@@ -51546,7 +51722,7 @@ function codexRespawnPlan(session) {
|
|
|
51546
51722
|
}
|
|
51547
51723
|
|
|
51548
51724
|
// src/commands/sessions/daemon/interactiveRespawnPlan.ts
|
|
51549
|
-
import { randomUUID as
|
|
51725
|
+
import { randomUUID as randomUUID28 } from "crypto";
|
|
51550
51726
|
|
|
51551
51727
|
// src/commands/sessions/daemon/hasTranscriptOnDisk.ts
|
|
51552
51728
|
function hasTranscriptOnDisk(session) {
|
|
@@ -51573,7 +51749,7 @@ function interactiveRespawnPlan(session, resumes) {
|
|
|
51573
51749
|
return null;
|
|
51574
51750
|
}
|
|
51575
51751
|
function freshClaudePlan(session, prompt, cwd) {
|
|
51576
|
-
const claudeSessionId =
|
|
51752
|
+
const claudeSessionId = randomUUID28();
|
|
51577
51753
|
return {
|
|
51578
51754
|
spawn: () => {
|
|
51579
51755
|
session.claudeSessionId = claudeSessionId;
|
|
@@ -52977,6 +53153,66 @@ async function collectHistory(linked) {
|
|
|
52977
53153
|
return withRepoGroups(local).concat(remote);
|
|
52978
53154
|
}
|
|
52979
53155
|
|
|
53156
|
+
// src/commands/sessions/daemon/pins/PinRelay.ts
|
|
53157
|
+
var ORIGIN_TTL_MS = 30 * 60 * 1e3;
|
|
53158
|
+
var PinRelay = class {
|
|
53159
|
+
constructor(now = Date.now) {
|
|
53160
|
+
this.now = now;
|
|
53161
|
+
}
|
|
53162
|
+
origins = /* @__PURE__ */ new Map();
|
|
53163
|
+
deliveries = /* @__PURE__ */ new Map();
|
|
53164
|
+
confirms = /* @__PURE__ */ new Map();
|
|
53165
|
+
rememberOrigin(area, pin2, node) {
|
|
53166
|
+
this.origins.set(`${area}:${pin2}`, { node, at: this.now() });
|
|
53167
|
+
}
|
|
53168
|
+
takeOrigin(area, pin2) {
|
|
53169
|
+
const key = `${area}:${pin2}`;
|
|
53170
|
+
const origin = this.origins.get(key);
|
|
53171
|
+
this.origins.delete(key);
|
|
53172
|
+
if (!origin || this.now() - origin.at > ORIGIN_TTL_MS) return void 0;
|
|
53173
|
+
return origin.node;
|
|
53174
|
+
}
|
|
53175
|
+
awaitDelivery(requestId, timeoutMs, settle) {
|
|
53176
|
+
addWaiter(this.deliveries, requestId, timeoutMs, false, settle);
|
|
53177
|
+
}
|
|
53178
|
+
settleDelivery(requestId, delivered) {
|
|
53179
|
+
settleWaiter(this.deliveries, requestId, delivered);
|
|
53180
|
+
}
|
|
53181
|
+
awaitConfirm(requestId, client, timeoutMs, node) {
|
|
53182
|
+
addWaiter(
|
|
53183
|
+
this.confirms,
|
|
53184
|
+
requestId,
|
|
53185
|
+
timeoutMs,
|
|
53186
|
+
{ ok: false, message: `${node} did not answer the confirmation.` },
|
|
53187
|
+
(result) => sendTo(client, {
|
|
53188
|
+
type: "confirm-pin-result",
|
|
53189
|
+
requestId,
|
|
53190
|
+
found: true,
|
|
53191
|
+
...result
|
|
53192
|
+
})
|
|
53193
|
+
);
|
|
53194
|
+
}
|
|
53195
|
+
settleConfirm(requestId, result) {
|
|
53196
|
+
settleWaiter(this.confirms, requestId, result);
|
|
53197
|
+
}
|
|
53198
|
+
};
|
|
53199
|
+
function addWaiter(waiters, requestId, timeoutMs, onTimeout, settle) {
|
|
53200
|
+
const timer = setTimeout(
|
|
53201
|
+
() => settleWaiter(waiters, requestId, onTimeout),
|
|
53202
|
+
timeoutMs
|
|
53203
|
+
);
|
|
53204
|
+
timer.unref?.();
|
|
53205
|
+
waiters.set(requestId, { settle, timer });
|
|
53206
|
+
}
|
|
53207
|
+
function settleWaiter(waiters, requestId, value) {
|
|
53208
|
+
if (typeof requestId !== "string") return;
|
|
53209
|
+
const waiter = waiters.get(requestId);
|
|
53210
|
+
if (!waiter) return;
|
|
53211
|
+
waiters.delete(requestId);
|
|
53212
|
+
clearTimeout(waiter.timer);
|
|
53213
|
+
waiter.settle(value);
|
|
53214
|
+
}
|
|
53215
|
+
|
|
52980
53216
|
// src/commands/sessions/daemon/links/guardLinkCallback.ts
|
|
52981
53217
|
function guardLinkCallback(label, callback) {
|
|
52982
53218
|
return (...args) => {
|
|
@@ -53006,6 +53242,7 @@ function linkDeps(options2, callbacks) {
|
|
|
53006
53242
|
"links: history-changed handler",
|
|
53007
53243
|
callbacks.onHistoryChanged
|
|
53008
53244
|
),
|
|
53245
|
+
pins: callbacks.pins,
|
|
53009
53246
|
transport: options2.transport ?? connectLinkWebSocket,
|
|
53010
53247
|
reconnectMs: options2.reconnectMs ?? 3e3,
|
|
53011
53248
|
blockedRetryMs: options2.blockedRetryMs ?? 6e4,
|
|
@@ -53354,6 +53591,31 @@ function relayLinkMessage(state, msg) {
|
|
|
53354
53591
|
);
|
|
53355
53592
|
}
|
|
53356
53593
|
|
|
53594
|
+
// src/commands/sessions/daemon/links/showRelayedPin.ts
|
|
53595
|
+
function tryShow(title, message3) {
|
|
53596
|
+
if (typeof title !== "string" || typeof message3 !== "string") return false;
|
|
53597
|
+
try {
|
|
53598
|
+
return showNotification({ title, message: message3 });
|
|
53599
|
+
} catch {
|
|
53600
|
+
return false;
|
|
53601
|
+
}
|
|
53602
|
+
}
|
|
53603
|
+
function showRelayedPin(ctx, msg) {
|
|
53604
|
+
const node = ctx.spec.name;
|
|
53605
|
+
const { area, pin: pin2 } = msg;
|
|
53606
|
+
const valid = typeof area === "string" && typeof pin2 === "string";
|
|
53607
|
+
const delivered = valid && tryShow(msg.title, msg.message);
|
|
53608
|
+
if (delivered) ctx.deps.pins.rememberOrigin(area, pin2, node);
|
|
53609
|
+
daemonLog(
|
|
53610
|
+
`link ${node} ws: ${valid ? area : "malformed"} PIN notification for a session on ${node} ${delivered ? "shown" : "not shown"}`
|
|
53611
|
+
);
|
|
53612
|
+
sendToLink(ctx, {
|
|
53613
|
+
type: "notify-pin-result",
|
|
53614
|
+
requestId: msg.requestId,
|
|
53615
|
+
delivered
|
|
53616
|
+
});
|
|
53617
|
+
}
|
|
53618
|
+
|
|
53357
53619
|
// src/commands/sessions/daemon/links/scheduleReconnect.ts
|
|
53358
53620
|
function armReconnect(ctx, delay2) {
|
|
53359
53621
|
clearTimeout(ctx.reconnectTimer);
|
|
@@ -53435,7 +53697,20 @@ function onLinkLine(ctx, line) {
|
|
|
53435
53697
|
return;
|
|
53436
53698
|
}
|
|
53437
53699
|
if (msg.type === "hello") return onHello(ctx, msg);
|
|
53438
|
-
if (ctx.greeted)
|
|
53700
|
+
if (!ctx.greeted) return;
|
|
53701
|
+
if (msg.type === "notify-pin") return showRelayedPin(ctx, msg);
|
|
53702
|
+
if (msg.type === "confirm-pin-result") return settleRelayedConfirm(ctx, msg);
|
|
53703
|
+
relayLinkMessage(ctx.relay, msg);
|
|
53704
|
+
}
|
|
53705
|
+
function settleRelayedConfirm(ctx, msg) {
|
|
53706
|
+
const ok = msg.ok === true;
|
|
53707
|
+
daemonLog(
|
|
53708
|
+
`link ${ctx.spec.name} ws: PIN confirmation ${ok ? "approved" : "rejected"} by ${ctx.spec.name}`
|
|
53709
|
+
);
|
|
53710
|
+
ctx.deps.pins.settleConfirm(msg.requestId, {
|
|
53711
|
+
ok,
|
|
53712
|
+
message: typeof msg.message === "string" ? msg.message : ""
|
|
53713
|
+
});
|
|
53439
53714
|
}
|
|
53440
53715
|
|
|
53441
53716
|
// src/commands/sessions/daemon/links/openLink.ts
|
|
@@ -53574,6 +53849,7 @@ var NodeLinks = class {
|
|
|
53574
53849
|
}
|
|
53575
53850
|
links = /* @__PURE__ */ new Map();
|
|
53576
53851
|
options = {};
|
|
53852
|
+
pins = new PinRelay();
|
|
53577
53853
|
configure(options2) {
|
|
53578
53854
|
this.options = options2;
|
|
53579
53855
|
}
|
|
@@ -53583,7 +53859,8 @@ var NodeLinks = class {
|
|
|
53583
53859
|
viewers: () => this.clients.viewers(),
|
|
53584
53860
|
onSessionsChanged: this.onSessionsChanged,
|
|
53585
53861
|
onStateChanged: () => broadcast(this.clients.viewers(), this.nodes()),
|
|
53586
|
-
onHistoryChanged: () => void this.broadcastHistory()
|
|
53862
|
+
onHistoryChanged: () => void this.broadcastHistory(),
|
|
53863
|
+
pins: this.pins
|
|
53587
53864
|
});
|
|
53588
53865
|
reconcileLinks(this.links, specs, (spec) => new NodeLink(spec, deps2));
|
|
53589
53866
|
this.onSessionsChanged();
|
|
@@ -53743,7 +54020,7 @@ import { existsSync as existsSync101 } from "fs";
|
|
|
53743
54020
|
|
|
53744
54021
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
53745
54022
|
import { copyFileSync as copyFileSync4, existsSync as existsSync100, mkdirSync as mkdirSync42 } from "fs";
|
|
53746
|
-
import { join as
|
|
54023
|
+
import { join as join113 } from "path";
|
|
53747
54024
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
53748
54025
|
const dir = projectDirForCwd(toCwd);
|
|
53749
54026
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -53752,7 +54029,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
53752
54029
|
);
|
|
53753
54030
|
return;
|
|
53754
54031
|
}
|
|
53755
|
-
const dest =
|
|
54032
|
+
const dest = join113(dir, `${claudeSessionId}.jsonl`);
|
|
53756
54033
|
if (existsSync100(dest)) {
|
|
53757
54034
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
53758
54035
|
return;
|
|
@@ -54135,7 +54412,10 @@ var handleHelloRequest = (client, m, d) => {
|
|
|
54135
54412
|
daemonLog(
|
|
54136
54413
|
`peer link from ${d.nodeName ?? "unknown node"} (${d.version ?? "unknown version"}); exporting local sessions only`
|
|
54137
54414
|
);
|
|
54138
|
-
m.clients.markPeer(
|
|
54415
|
+
m.clients.markPeer(
|
|
54416
|
+
client,
|
|
54417
|
+
typeof d.nodeName === "string" ? d.nodeName : void 0
|
|
54418
|
+
);
|
|
54139
54419
|
sendTo(client, { type: "sessions", sessions: m.localSessions(), active: {} });
|
|
54140
54420
|
m.replayLocal(client);
|
|
54141
54421
|
};
|
|
@@ -54708,6 +54988,121 @@ var lifecycleHandlers = {
|
|
|
54708
54988
|
shutdown: handleShutdown
|
|
54709
54989
|
};
|
|
54710
54990
|
|
|
54991
|
+
// src/commands/sessions/daemon/pins/pinConfirmers.ts
|
|
54992
|
+
var pinConfirmers = {
|
|
54993
|
+
docs: approveDocsUnlock
|
|
54994
|
+
};
|
|
54995
|
+
|
|
54996
|
+
// src/commands/sessions/daemon/pins/confirmPinLocally.ts
|
|
54997
|
+
async function confirmPinLocally(area, pin2) {
|
|
54998
|
+
const confirm = pinConfirmers[area];
|
|
54999
|
+
if (!confirm)
|
|
55000
|
+
return { ok: false, message: `Unknown confirmation area ${area}.` };
|
|
55001
|
+
try {
|
|
55002
|
+
return await confirm(pin2) ?? {
|
|
55003
|
+
ok: false,
|
|
55004
|
+
message: `No pending ${area} confirmation for that pin.`
|
|
55005
|
+
};
|
|
55006
|
+
} catch (error) {
|
|
55007
|
+
return {
|
|
55008
|
+
ok: false,
|
|
55009
|
+
message: error instanceof Error ? error.message : String(error)
|
|
55010
|
+
};
|
|
55011
|
+
}
|
|
55012
|
+
}
|
|
55013
|
+
|
|
55014
|
+
// src/commands/sessions/daemon/pins/handleConfirmPin.ts
|
|
55015
|
+
var CONFIRM_TIMEOUT_MS2 = 1e4;
|
|
55016
|
+
var handlePeerConfirm = (client, m, d) => {
|
|
55017
|
+
const area = String(d.area);
|
|
55018
|
+
const from = m.clients.peerNode(client) ?? "unknown node";
|
|
55019
|
+
void confirmPinLocally(area, String(d.pin)).then((result) => {
|
|
55020
|
+
daemonLog(
|
|
55021
|
+
`confirm-pin: ${area} confirmation relayed from ${from} ${result.ok ? "approved" : "rejected"}`
|
|
55022
|
+
);
|
|
55023
|
+
sendTo(client, {
|
|
55024
|
+
type: "confirm-pin-result",
|
|
55025
|
+
requestId: d.requestId,
|
|
55026
|
+
...result
|
|
55027
|
+
});
|
|
55028
|
+
});
|
|
55029
|
+
};
|
|
55030
|
+
var handleConfirmPin = (client, m, d) => {
|
|
55031
|
+
if (m.clients.isPeer(client)) return handlePeerConfirm(client, m, d);
|
|
55032
|
+
const area = String(d.area);
|
|
55033
|
+
const requestId = String(d.requestId);
|
|
55034
|
+
const node = m.links.pins.takeOrigin(area, String(d.pin));
|
|
55035
|
+
if (!node) {
|
|
55036
|
+
daemonLog(`confirm-pin: no relayed ${area} PIN matches; nothing forwarded`);
|
|
55037
|
+
sendTo(client, { type: "confirm-pin-result", requestId, found: false });
|
|
55038
|
+
return;
|
|
55039
|
+
}
|
|
55040
|
+
daemonLog(`confirm-pin: forwarding ${area} confirmation to ${node}`);
|
|
55041
|
+
m.links.pins.awaitConfirm(requestId, client, CONFIRM_TIMEOUT_MS2, node);
|
|
55042
|
+
m.links.route(client, { ...d, node });
|
|
55043
|
+
};
|
|
55044
|
+
|
|
55045
|
+
// src/commands/sessions/daemon/pins/pinNotificationTarget.ts
|
|
55046
|
+
function pinNotificationTarget(viewerNode, localNode, peerFor) {
|
|
55047
|
+
if (!viewerNode) return { kind: "local", reason: "has no active viewer" };
|
|
55048
|
+
if (viewerNode === localNode)
|
|
55049
|
+
return { kind: "local", reason: "is controlled from this node" };
|
|
55050
|
+
const peer = peerFor(viewerNode);
|
|
55051
|
+
if (!peer)
|
|
55052
|
+
return {
|
|
55053
|
+
kind: "local",
|
|
55054
|
+
reason: `is controlled from ${viewerNode}, which has no peer link here`
|
|
55055
|
+
};
|
|
55056
|
+
return { kind: "peer", node: viewerNode, peer };
|
|
55057
|
+
}
|
|
55058
|
+
|
|
55059
|
+
// src/commands/sessions/daemon/pins/handleNotifyPin.ts
|
|
55060
|
+
var DELIVERY_TIMEOUT_MS = 5e3;
|
|
55061
|
+
var handleNotifyPin = (client, m, d) => {
|
|
55062
|
+
const { sessionId, requestId, area } = d;
|
|
55063
|
+
const reply2 = (node) => sendTo(client, { type: "notify-pin-result", requestId, node });
|
|
55064
|
+
const target = pinNotificationTarget(
|
|
55065
|
+
m.localSessions().find((s) => s.id === sessionId)?.activeViewerNode,
|
|
55066
|
+
m.links.localNode(),
|
|
55067
|
+
(node) => m.clients.peerFor(node)
|
|
55068
|
+
);
|
|
55069
|
+
if (target.kind === "local") {
|
|
55070
|
+
daemonLog(
|
|
55071
|
+
`notify-pin: session ${sessionId} ${target.reason}; ${area} PIN notifies locally`
|
|
55072
|
+
);
|
|
55073
|
+
return reply2();
|
|
55074
|
+
}
|
|
55075
|
+
daemonLog(
|
|
55076
|
+
`notify-pin: session ${sessionId} relaying ${area} PIN notification to ${target.node}`
|
|
55077
|
+
);
|
|
55078
|
+
m.links.pins.awaitDelivery(
|
|
55079
|
+
String(requestId),
|
|
55080
|
+
DELIVERY_TIMEOUT_MS,
|
|
55081
|
+
(delivered) => {
|
|
55082
|
+
daemonLog(
|
|
55083
|
+
`notify-pin: session ${sessionId} ${area} PIN ${delivered ? `shown on ${target.node}` : `not shown on ${target.node}; notifying locally`}`
|
|
55084
|
+
);
|
|
55085
|
+
reply2(delivered ? target.node : void 0);
|
|
55086
|
+
}
|
|
55087
|
+
);
|
|
55088
|
+
const { title, message: message3, pin: pin2 } = d;
|
|
55089
|
+
sendTo(target.peer, {
|
|
55090
|
+
type: "notify-pin",
|
|
55091
|
+
requestId,
|
|
55092
|
+
area,
|
|
55093
|
+
pin: pin2,
|
|
55094
|
+
title,
|
|
55095
|
+
message: message3
|
|
55096
|
+
});
|
|
55097
|
+
};
|
|
55098
|
+
|
|
55099
|
+
// src/commands/sessions/daemon/pins/pinHandlers.ts
|
|
55100
|
+
var pinHandlers = {
|
|
55101
|
+
"notify-pin": handleNotifyPin,
|
|
55102
|
+
"notify-pin-result": (_client, m, d) => m.links.pins.settleDelivery(d.requestId, d.delivered === true),
|
|
55103
|
+
"confirm-pin": handleConfirmPin
|
|
55104
|
+
};
|
|
55105
|
+
|
|
54711
55106
|
// src/commands/sessions/daemon/handleSnapshotRequest.ts
|
|
54712
55107
|
var handleSnapshotRequest = (client, m, d) => {
|
|
54713
55108
|
const sessionId = d.sessionId;
|
|
@@ -54946,6 +55341,7 @@ var messageHandlers = {
|
|
|
54946
55341
|
),
|
|
54947
55342
|
"codex-usage": handleCodexUsage,
|
|
54948
55343
|
...viewerHandlers,
|
|
55344
|
+
...pinHandlers,
|
|
54949
55345
|
"type-prompt": handleTypePrompt,
|
|
54950
55346
|
"type-prompt-to-writer": handleTypePromptToWriter,
|
|
54951
55347
|
retry: routed((client, m, d) => {
|
|
@@ -55201,7 +55597,7 @@ async function closeSession2() {
|
|
|
55201
55597
|
}
|
|
55202
55598
|
|
|
55203
55599
|
// src/commands/sessions/nodes/listNodes.ts
|
|
55204
|
-
import
|
|
55600
|
+
import chalk275 from "chalk";
|
|
55205
55601
|
async function nodesReport() {
|
|
55206
55602
|
const live = await queryNodes();
|
|
55207
55603
|
if (live)
|
|
@@ -55218,10 +55614,10 @@ async function listNodes(options2) {
|
|
|
55218
55614
|
console.log(JSON.stringify(report, null, 2));
|
|
55219
55615
|
return;
|
|
55220
55616
|
}
|
|
55221
|
-
console.log(`${report.local} ${
|
|
55617
|
+
console.log(`${report.local} ${chalk275.dim("(this node)")}`);
|
|
55222
55618
|
if (!report.daemonRunning)
|
|
55223
|
-
console.log(
|
|
55224
|
-
if (report.links.length === 0) console.log(
|
|
55619
|
+
console.log(chalk275.dim(" daemon not running; showing configured links"));
|
|
55620
|
+
if (report.links.length === 0) console.log(chalk275.dim(" no links"));
|
|
55225
55621
|
for (const link3 of report.links) console.log(formatLink(link3));
|
|
55226
55622
|
}
|
|
55227
55623
|
|
|
@@ -55243,7 +55639,7 @@ async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
|
55243
55639
|
}
|
|
55244
55640
|
|
|
55245
55641
|
// src/commands/sessions/nodes/printReport.ts
|
|
55246
|
-
import
|
|
55642
|
+
import chalk276 from "chalk";
|
|
55247
55643
|
function printReport(report) {
|
|
55248
55644
|
if (report.links.length === 0) {
|
|
55249
55645
|
console.log(`${report.local} has no links`);
|
|
@@ -55257,11 +55653,11 @@ function printReport(report) {
|
|
|
55257
55653
|
for (const diagnosis of report.links) printDiagnosis(diagnosis);
|
|
55258
55654
|
}
|
|
55259
55655
|
function printDiagnosis(diagnosis) {
|
|
55260
|
-
console.log(`${
|
|
55656
|
+
console.log(`${chalk276.bold(diagnosis.name)} ${chalk276.dim(diagnosis.url)}`);
|
|
55261
55657
|
for (const hop of diagnosis.hops) {
|
|
55262
|
-
const mark = hop.ok ?
|
|
55658
|
+
const mark = hop.ok ? chalk276.green("\u2713") : chalk276.red("\u2717");
|
|
55263
55659
|
console.log(` ${mark} ${hop.hop.padEnd(9)} ${hop.detail ?? hop.error}`);
|
|
55264
|
-
if (hop.remediation) console.log(` ${
|
|
55660
|
+
if (hop.remediation) console.log(` ${chalk276.yellow(hop.remediation)}`);
|
|
55265
55661
|
}
|
|
55266
55662
|
}
|
|
55267
55663
|
|
|
@@ -55333,14 +55729,14 @@ function registerDiagnoseCommands(nodes, calledBy5) {
|
|
|
55333
55729
|
}
|
|
55334
55730
|
|
|
55335
55731
|
// src/commands/sessions/nodes/linkNode.ts
|
|
55336
|
-
import
|
|
55732
|
+
import chalk279 from "chalk";
|
|
55337
55733
|
|
|
55338
55734
|
// src/commands/sessions/nodes/notifyDaemonLinks.ts
|
|
55339
|
-
import
|
|
55735
|
+
import chalk277 from "chalk";
|
|
55340
55736
|
async function notifyDaemonLinks() {
|
|
55341
55737
|
if (!await isDaemonRunning()) {
|
|
55342
55738
|
console.log(
|
|
55343
|
-
|
|
55739
|
+
chalk277.yellow(
|
|
55344
55740
|
"The sessions daemon is not running; it loads the links when it starts."
|
|
55345
55741
|
)
|
|
55346
55742
|
);
|
|
@@ -55348,11 +55744,11 @@ async function notifyDaemonLinks() {
|
|
|
55348
55744
|
}
|
|
55349
55745
|
try {
|
|
55350
55746
|
await sendToDaemonAwaitAck({ type: "reload-links" });
|
|
55351
|
-
console.log(
|
|
55747
|
+
console.log(chalk277.dim("The sessions daemon reloaded its links."));
|
|
55352
55748
|
} catch (error) {
|
|
55353
55749
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
55354
55750
|
console.log(
|
|
55355
|
-
|
|
55751
|
+
chalk277.yellow(
|
|
55356
55752
|
`Could not notify the sessions daemon (${message3}); run \`assist daemon restart\` to apply the change.`
|
|
55357
55753
|
)
|
|
55358
55754
|
);
|
|
@@ -55360,7 +55756,7 @@ async function notifyDaemonLinks() {
|
|
|
55360
55756
|
}
|
|
55361
55757
|
|
|
55362
55758
|
// src/commands/sessions/nodes/readLinks.ts
|
|
55363
|
-
import
|
|
55759
|
+
import chalk278 from "chalk";
|
|
55364
55760
|
|
|
55365
55761
|
// src/commands/sessions/nodes/writeLinks.ts
|
|
55366
55762
|
async function writeLinks(links2) {
|
|
@@ -55383,7 +55779,7 @@ async function readLinks() {
|
|
|
55383
55779
|
await writeLinks(links2);
|
|
55384
55780
|
const dropped = stored.filter((link3) => !link3.url).map((link3) => link3.name);
|
|
55385
55781
|
console.log(
|
|
55386
|
-
|
|
55782
|
+
chalk278.yellow(`Removed ${dropped.join(", ")}: ${SSH_LINK_RETIRED}`)
|
|
55387
55783
|
);
|
|
55388
55784
|
return links2;
|
|
55389
55785
|
}
|
|
@@ -55439,7 +55835,7 @@ async function linkNode(name, url, options2) {
|
|
|
55439
55835
|
throw new Error(`${name} is this node; link to a different node`);
|
|
55440
55836
|
const link3 = await buildLink(name, url, options2);
|
|
55441
55837
|
await writeLinks([...others, link3]);
|
|
55442
|
-
console.log(
|
|
55838
|
+
console.log(chalk279.green(`Linked ${name} (${link3.url})`));
|
|
55443
55839
|
await notifyDaemonLinks();
|
|
55444
55840
|
}
|
|
55445
55841
|
|
|
@@ -55622,16 +56018,16 @@ function registerPeerActionCommands(nodes, calledBy5) {
|
|
|
55622
56018
|
}
|
|
55623
56019
|
|
|
55624
56020
|
// src/commands/sessions/nodes/unlinkNode.ts
|
|
55625
|
-
import
|
|
56021
|
+
import chalk280 from "chalk";
|
|
55626
56022
|
async function unlinkNode(name) {
|
|
55627
56023
|
const links2 = await readLinks();
|
|
55628
56024
|
const remaining = links2.filter((link3) => link3.name !== name);
|
|
55629
56025
|
if (remaining.length === links2.length) {
|
|
55630
|
-
console.log(
|
|
56026
|
+
console.log(chalk280.yellow(`No link named ${name}`));
|
|
55631
56027
|
return;
|
|
55632
56028
|
}
|
|
55633
56029
|
await writeLinks(remaining);
|
|
55634
|
-
console.log(
|
|
56030
|
+
console.log(chalk280.green(`Unlinked ${name}`));
|
|
55635
56031
|
await notifyDaemonLinks();
|
|
55636
56032
|
}
|
|
55637
56033
|
|
|
@@ -55869,10 +56265,10 @@ function createProgram() {
|
|
|
55869
56265
|
}
|
|
55870
56266
|
|
|
55871
56267
|
// src/reportCliError.ts
|
|
55872
|
-
import
|
|
56268
|
+
import chalk281 from "chalk";
|
|
55873
56269
|
function reportCliError(error) {
|
|
55874
56270
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError || error instanceof MissingDatabaseUrlError) {
|
|
55875
|
-
console.error(
|
|
56271
|
+
console.error(chalk281.red(error.message));
|
|
55876
56272
|
} else {
|
|
55877
56273
|
console.error(error);
|
|
55878
56274
|
}
|