@staff0rd/assist 0.150.0 → 0.151.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/claude/settings.json +2 -0
- package/dist/index.js +441 -385
- 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.151.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -609,12 +609,64 @@ function plan(id) {
|
|
|
609
609
|
}
|
|
610
610
|
}
|
|
611
611
|
|
|
612
|
-
// src/commands/backlog/
|
|
612
|
+
// src/commands/backlog/show/index.ts
|
|
613
613
|
import chalk12 from "chalk";
|
|
614
|
+
function printPlan(item) {
|
|
615
|
+
if (!item.plan || item.plan.length === 0) return;
|
|
616
|
+
console.log(chalk12.bold("Plan"));
|
|
617
|
+
for (const [i, phase] of item.plan.entries()) {
|
|
618
|
+
const isCurrent = item.currentPhase === i;
|
|
619
|
+
printPhase(phase, i, isCurrent);
|
|
620
|
+
}
|
|
621
|
+
console.log();
|
|
622
|
+
}
|
|
623
|
+
function printPhase(phase, index, isCurrent) {
|
|
624
|
+
const marker = isCurrent ? chalk12.green("\u25B6 ") : " ";
|
|
625
|
+
const label2 = isCurrent ? chalk12.green.bold(`Phase ${index + 1}: ${phase.name}`) : `${chalk12.bold(`Phase ${index + 1}:`)} ${phase.name}`;
|
|
626
|
+
console.log(`${marker}${label2}`);
|
|
627
|
+
for (const task of phase.tasks) {
|
|
628
|
+
console.log(` - ${task.task}`);
|
|
629
|
+
if (task.verify) {
|
|
630
|
+
console.log(` ${chalk12.dim(`verify: ${task.verify}`)}`);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
if (phase.manualChecks && phase.manualChecks.length > 0) {
|
|
634
|
+
console.log(` ${chalk12.dim("Manual checks:")}`);
|
|
635
|
+
for (const check2 of phase.manualChecks) {
|
|
636
|
+
console.log(` ${chalk12.dim(`- ${check2}`)}`);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
function show(id) {
|
|
641
|
+
const result = loadAndFindItem(id);
|
|
642
|
+
if (!result) process.exit(1);
|
|
643
|
+
const { item } = result;
|
|
644
|
+
console.log(chalk12.bold(`#${item.id} ${item.name}`));
|
|
645
|
+
console.log(
|
|
646
|
+
`${chalk12.dim("Type:")} ${item.type} ${chalk12.dim("Status:")} ${item.status}`
|
|
647
|
+
);
|
|
648
|
+
console.log();
|
|
649
|
+
if (item.description) {
|
|
650
|
+
console.log(chalk12.bold("Description"));
|
|
651
|
+
console.log(item.description);
|
|
652
|
+
console.log();
|
|
653
|
+
}
|
|
654
|
+
if (item.acceptanceCriteria.length > 0) {
|
|
655
|
+
console.log(chalk12.bold("Acceptance Criteria"));
|
|
656
|
+
for (const [i, ac] of item.acceptanceCriteria.entries()) {
|
|
657
|
+
console.log(` ${i + 1}. ${ac}`);
|
|
658
|
+
}
|
|
659
|
+
console.log();
|
|
660
|
+
}
|
|
661
|
+
printPlan(item);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
// src/commands/backlog/start/index.ts
|
|
665
|
+
import chalk13 from "chalk";
|
|
614
666
|
async function start(id) {
|
|
615
667
|
const name = setStatus(id, "in-progress");
|
|
616
668
|
if (name) {
|
|
617
|
-
console.log(
|
|
669
|
+
console.log(chalk13.green(`Started item #${id}: ${name}`));
|
|
618
670
|
}
|
|
619
671
|
}
|
|
620
672
|
|
|
@@ -626,7 +678,7 @@ import {
|
|
|
626
678
|
} from "http";
|
|
627
679
|
import { dirname, join as join3 } from "path";
|
|
628
680
|
import { fileURLToPath } from "url";
|
|
629
|
-
import
|
|
681
|
+
import chalk14 from "chalk";
|
|
630
682
|
function respondJson(res, status2, data) {
|
|
631
683
|
res.writeHead(status2, { "Content-Type": "application/json" });
|
|
632
684
|
res.end(JSON.stringify(data));
|
|
@@ -670,8 +722,8 @@ function startWebServer(label2, port, handler) {
|
|
|
670
722
|
handler(req, res, port);
|
|
671
723
|
});
|
|
672
724
|
server.listen(port, () => {
|
|
673
|
-
console.log(
|
|
674
|
-
console.log(
|
|
725
|
+
console.log(chalk14.green(`${label2}: ${url}`));
|
|
726
|
+
console.log(chalk14.dim("Press Ctrl+C to stop"));
|
|
675
727
|
exec(`open ${url}`);
|
|
676
728
|
});
|
|
677
729
|
}
|
|
@@ -825,7 +877,7 @@ import { execSync } from "child_process";
|
|
|
825
877
|
import { existsSync as existsSync5, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
|
|
826
878
|
import { homedir } from "os";
|
|
827
879
|
import { basename, dirname as dirname2, join as join4 } from "path";
|
|
828
|
-
import
|
|
880
|
+
import chalk15 from "chalk";
|
|
829
881
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
830
882
|
|
|
831
883
|
// src/shared/loadRawYaml.ts
|
|
@@ -1012,7 +1064,7 @@ function getTranscriptConfig() {
|
|
|
1012
1064
|
const config = loadConfig();
|
|
1013
1065
|
if (!config.transcript) {
|
|
1014
1066
|
console.error(
|
|
1015
|
-
|
|
1067
|
+
chalk15.red(
|
|
1016
1068
|
"Transcript directories not configured. Run 'assist transcript configure' first."
|
|
1017
1069
|
)
|
|
1018
1070
|
);
|
|
@@ -1101,7 +1153,7 @@ function commit(args) {
|
|
|
1101
1153
|
}
|
|
1102
1154
|
|
|
1103
1155
|
// src/commands/config/index.ts
|
|
1104
|
-
import
|
|
1156
|
+
import chalk16 from "chalk";
|
|
1105
1157
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
1106
1158
|
|
|
1107
1159
|
// src/commands/config/getNestedValue.ts
|
|
@@ -1177,7 +1229,7 @@ function formatIssuePath(issue, key) {
|
|
|
1177
1229
|
function printValidationErrors(issues, key) {
|
|
1178
1230
|
for (const issue of issues) {
|
|
1179
1231
|
console.error(
|
|
1180
|
-
|
|
1232
|
+
chalk16.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
1181
1233
|
);
|
|
1182
1234
|
}
|
|
1183
1235
|
}
|
|
@@ -1197,13 +1249,13 @@ function applyConfigSet(key, coerced) {
|
|
|
1197
1249
|
function configSet(key, value) {
|
|
1198
1250
|
const coerced = coerceValue(value);
|
|
1199
1251
|
applyConfigSet(key, coerced);
|
|
1200
|
-
console.log(
|
|
1252
|
+
console.log(chalk16.green(`Set ${key} = ${JSON.stringify(coerced)}`));
|
|
1201
1253
|
}
|
|
1202
1254
|
function formatOutput(value) {
|
|
1203
1255
|
return typeof value === "object" && value !== null ? JSON.stringify(value, null, 2) : String(value);
|
|
1204
1256
|
}
|
|
1205
1257
|
function exitKeyNotSet(key) {
|
|
1206
|
-
console.error(
|
|
1258
|
+
console.error(chalk16.red(`Key "${key}" is not set`));
|
|
1207
1259
|
process.exit(1);
|
|
1208
1260
|
}
|
|
1209
1261
|
function requireNestedValue(config, key) {
|
|
@@ -1239,10 +1291,10 @@ function coverage() {
|
|
|
1239
1291
|
}
|
|
1240
1292
|
|
|
1241
1293
|
// src/commands/verify/init/index.ts
|
|
1242
|
-
import
|
|
1294
|
+
import chalk31 from "chalk";
|
|
1243
1295
|
|
|
1244
1296
|
// src/shared/promptMultiselect.ts
|
|
1245
|
-
import
|
|
1297
|
+
import chalk17 from "chalk";
|
|
1246
1298
|
import enquirer3 from "enquirer";
|
|
1247
1299
|
async function promptMultiselect(message, options2) {
|
|
1248
1300
|
const { selected } = await enquirer3.prompt({
|
|
@@ -1251,7 +1303,7 @@ async function promptMultiselect(message, options2) {
|
|
|
1251
1303
|
message,
|
|
1252
1304
|
choices: options2.map((opt) => ({
|
|
1253
1305
|
name: opt.value,
|
|
1254
|
-
message: `${opt.name} - ${
|
|
1306
|
+
message: `${opt.name} - ${chalk17.dim(opt.description)}`
|
|
1255
1307
|
})),
|
|
1256
1308
|
// @ts-expect-error - enquirer types don't include symbols but it's supported
|
|
1257
1309
|
symbols: {
|
|
@@ -1267,7 +1319,7 @@ async function promptMultiselect(message, options2) {
|
|
|
1267
1319
|
// src/shared/readPackageJson.ts
|
|
1268
1320
|
import * as fs from "fs";
|
|
1269
1321
|
import * as path from "path";
|
|
1270
|
-
import
|
|
1322
|
+
import chalk18 from "chalk";
|
|
1271
1323
|
function findPackageJson() {
|
|
1272
1324
|
const packageJsonPath = path.join(process.cwd(), "package.json");
|
|
1273
1325
|
if (fs.existsSync(packageJsonPath)) {
|
|
@@ -1281,7 +1333,7 @@ function readPackageJson(filePath) {
|
|
|
1281
1333
|
function requirePackageJson() {
|
|
1282
1334
|
const packageJsonPath = findPackageJson();
|
|
1283
1335
|
if (!packageJsonPath) {
|
|
1284
|
-
console.error(
|
|
1336
|
+
console.error(chalk18.red("No package.json found in current directory"));
|
|
1285
1337
|
process.exit(1);
|
|
1286
1338
|
}
|
|
1287
1339
|
const pkg = readPackageJson(packageJsonPath);
|
|
@@ -1312,7 +1364,7 @@ function findPackageJsonWithVerifyScripts(startDir) {
|
|
|
1312
1364
|
// src/commands/verify/installPackage.ts
|
|
1313
1365
|
import { execSync as execSync3 } from "child_process";
|
|
1314
1366
|
import { writeFileSync as writeFileSync4 } from "fs";
|
|
1315
|
-
import
|
|
1367
|
+
import chalk19 from "chalk";
|
|
1316
1368
|
function writePackageJson(filePath, pkg) {
|
|
1317
1369
|
writeFileSync4(filePath, `${JSON.stringify(pkg, null, 2)}
|
|
1318
1370
|
`);
|
|
@@ -1327,12 +1379,12 @@ function addScript(pkg, name, command) {
|
|
|
1327
1379
|
};
|
|
1328
1380
|
}
|
|
1329
1381
|
function installPackage(name, cwd) {
|
|
1330
|
-
console.log(
|
|
1382
|
+
console.log(chalk19.dim(`Installing ${name}...`));
|
|
1331
1383
|
try {
|
|
1332
1384
|
execSync3(`npm install -D ${name}`, { stdio: "inherit", cwd });
|
|
1333
1385
|
return true;
|
|
1334
1386
|
} catch {
|
|
1335
|
-
console.error(
|
|
1387
|
+
console.error(chalk19.red(`Failed to install ${name}`));
|
|
1336
1388
|
return false;
|
|
1337
1389
|
}
|
|
1338
1390
|
}
|
|
@@ -1378,9 +1430,9 @@ var expectedScripts = {
|
|
|
1378
1430
|
};
|
|
1379
1431
|
|
|
1380
1432
|
// src/commands/verify/setup/setupBuild.ts
|
|
1381
|
-
import
|
|
1433
|
+
import chalk20 from "chalk";
|
|
1382
1434
|
async function setupBuild(_packageJsonPath, writer, hasVite, hasTypescript) {
|
|
1383
|
-
console.log(
|
|
1435
|
+
console.log(chalk20.blue("\nSetting up build verification..."));
|
|
1384
1436
|
let command;
|
|
1385
1437
|
if (hasVite && hasTypescript) {
|
|
1386
1438
|
command = "tsc -b && vite build --logLevel error";
|
|
@@ -1389,21 +1441,21 @@ async function setupBuild(_packageJsonPath, writer, hasVite, hasTypescript) {
|
|
|
1389
1441
|
} else {
|
|
1390
1442
|
command = "npm run build";
|
|
1391
1443
|
}
|
|
1392
|
-
console.log(
|
|
1444
|
+
console.log(chalk20.dim(`Using: ${command}`));
|
|
1393
1445
|
writer("verify:build", command);
|
|
1394
1446
|
}
|
|
1395
1447
|
async function setupTypecheck(_packageJsonPath, writer) {
|
|
1396
|
-
console.log(
|
|
1448
|
+
console.log(chalk20.blue("\nSetting up typecheck verification..."));
|
|
1397
1449
|
const command = "tsc --noEmit";
|
|
1398
|
-
console.log(
|
|
1450
|
+
console.log(chalk20.dim(`Using: ${command}`));
|
|
1399
1451
|
writer("verify:typecheck", command);
|
|
1400
1452
|
}
|
|
1401
1453
|
|
|
1402
1454
|
// src/commands/verify/setup/setupDuplicateCode.ts
|
|
1403
1455
|
import * as path2 from "path";
|
|
1404
|
-
import
|
|
1456
|
+
import chalk21 from "chalk";
|
|
1405
1457
|
async function setupDuplicateCode(packageJsonPath, writer) {
|
|
1406
|
-
console.log(
|
|
1458
|
+
console.log(chalk21.blue("\nSetting up jscpd..."));
|
|
1407
1459
|
const cwd = path2.dirname(packageJsonPath);
|
|
1408
1460
|
const pkg = readPackageJson(packageJsonPath);
|
|
1409
1461
|
const hasJscpd = !!pkg.dependencies?.jscpd || !!pkg.devDependencies?.jscpd;
|
|
@@ -1415,12 +1467,12 @@ async function setupDuplicateCode(packageJsonPath, writer) {
|
|
|
1415
1467
|
|
|
1416
1468
|
// src/commands/verify/setup/setupHardcodedColors.ts
|
|
1417
1469
|
import * as path3 from "path";
|
|
1418
|
-
import
|
|
1470
|
+
import chalk23 from "chalk";
|
|
1419
1471
|
|
|
1420
1472
|
// src/commands/verify/addToKnipIgnoreBinaries.ts
|
|
1421
1473
|
import { existsSync as existsSync7, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "fs";
|
|
1422
1474
|
import { join as join6 } from "path";
|
|
1423
|
-
import
|
|
1475
|
+
import chalk22 from "chalk";
|
|
1424
1476
|
function loadKnipConfig(knipJsonPath) {
|
|
1425
1477
|
if (existsSync7(knipJsonPath)) {
|
|
1426
1478
|
return JSON.parse(readFileSync6(knipJsonPath, "utf-8"));
|
|
@@ -1439,16 +1491,16 @@ function addToKnipIgnoreBinaries(cwd, binary) {
|
|
|
1439
1491
|
`${JSON.stringify(knipConfig, null, " ")}
|
|
1440
1492
|
`
|
|
1441
1493
|
);
|
|
1442
|
-
console.log(
|
|
1494
|
+
console.log(chalk22.dim(`Added '${binary}' to knip.json ignoreBinaries`));
|
|
1443
1495
|
}
|
|
1444
1496
|
} catch {
|
|
1445
|
-
console.log(
|
|
1497
|
+
console.log(chalk22.yellow("Warning: Could not update knip.json"));
|
|
1446
1498
|
}
|
|
1447
1499
|
}
|
|
1448
1500
|
|
|
1449
1501
|
// src/commands/verify/setup/setupHardcodedColors.ts
|
|
1450
1502
|
async function setupHardcodedColors(packageJsonPath, writer, hasOpenColor) {
|
|
1451
|
-
console.log(
|
|
1503
|
+
console.log(chalk23.blue("\nSetting up hardcoded colors check..."));
|
|
1452
1504
|
const cwd = path3.dirname(packageJsonPath);
|
|
1453
1505
|
if (!hasOpenColor) {
|
|
1454
1506
|
installPackage("open-color", cwd);
|
|
@@ -1459,9 +1511,9 @@ async function setupHardcodedColors(packageJsonPath, writer, hasOpenColor) {
|
|
|
1459
1511
|
|
|
1460
1512
|
// src/commands/verify/setup/setupKnip.ts
|
|
1461
1513
|
import * as path4 from "path";
|
|
1462
|
-
import
|
|
1514
|
+
import chalk24 from "chalk";
|
|
1463
1515
|
async function setupKnip(packageJsonPath, writer) {
|
|
1464
|
-
console.log(
|
|
1516
|
+
console.log(chalk24.blue("\nSetting up knip..."));
|
|
1465
1517
|
const cwd = path4.dirname(packageJsonPath);
|
|
1466
1518
|
const pkg = readPackageJson(packageJsonPath);
|
|
1467
1519
|
if (!pkg.devDependencies?.knip && !installPackage("knip", cwd)) {
|
|
@@ -1472,14 +1524,14 @@ async function setupKnip(packageJsonPath, writer) {
|
|
|
1472
1524
|
|
|
1473
1525
|
// src/commands/verify/setup/setupLint.ts
|
|
1474
1526
|
import * as path5 from "path";
|
|
1475
|
-
import
|
|
1527
|
+
import chalk27 from "chalk";
|
|
1476
1528
|
|
|
1477
1529
|
// src/commands/lint/init.ts
|
|
1478
1530
|
import { execSync as execSync5 } from "child_process";
|
|
1479
1531
|
import { existsSync as existsSync10, readFileSync as readFileSync8, writeFileSync as writeFileSync7 } from "fs";
|
|
1480
1532
|
import { dirname as dirname7, join as join7 } from "path";
|
|
1481
1533
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
1482
|
-
import
|
|
1534
|
+
import chalk26 from "chalk";
|
|
1483
1535
|
|
|
1484
1536
|
// src/shared/promptConfirm.ts
|
|
1485
1537
|
import enquirer4 from "enquirer";
|
|
@@ -1581,7 +1633,7 @@ function removeEslintScripts(scripts, options2) {
|
|
|
1581
1633
|
}
|
|
1582
1634
|
|
|
1583
1635
|
// src/utils/printDiff.ts
|
|
1584
|
-
import
|
|
1636
|
+
import chalk25 from "chalk";
|
|
1585
1637
|
import * as diff from "diff";
|
|
1586
1638
|
function normalizeJson(content) {
|
|
1587
1639
|
try {
|
|
@@ -1599,11 +1651,11 @@ function printDiff(oldContent, newContent) {
|
|
|
1599
1651
|
const lines = change.value.replace(/\n$/, "").split("\n");
|
|
1600
1652
|
for (const line of lines) {
|
|
1601
1653
|
if (change.added) {
|
|
1602
|
-
console.log(
|
|
1654
|
+
console.log(chalk25.green(`+ ${line}`));
|
|
1603
1655
|
} else if (change.removed) {
|
|
1604
|
-
console.log(
|
|
1656
|
+
console.log(chalk25.red(`- ${line}`));
|
|
1605
1657
|
} else {
|
|
1606
|
-
console.log(
|
|
1658
|
+
console.log(chalk25.dim(` ${line}`));
|
|
1607
1659
|
}
|
|
1608
1660
|
}
|
|
1609
1661
|
}
|
|
@@ -1637,10 +1689,10 @@ async function init() {
|
|
|
1637
1689
|
console.log("biome.json already has the correct linter config");
|
|
1638
1690
|
return;
|
|
1639
1691
|
}
|
|
1640
|
-
console.log(
|
|
1692
|
+
console.log(chalk26.yellow("\n\u26A0\uFE0F biome.json will be updated:"));
|
|
1641
1693
|
console.log();
|
|
1642
1694
|
printDiff(oldContent, newContent);
|
|
1643
|
-
const confirm = await promptConfirm(
|
|
1695
|
+
const confirm = await promptConfirm(chalk26.red("Update biome.json?"));
|
|
1644
1696
|
if (!confirm) {
|
|
1645
1697
|
console.log("Skipped biome.json update");
|
|
1646
1698
|
return;
|
|
@@ -1651,7 +1703,7 @@ async function init() {
|
|
|
1651
1703
|
|
|
1652
1704
|
// src/commands/verify/setup/setupLint.ts
|
|
1653
1705
|
async function setupLint(packageJsonPath, writer) {
|
|
1654
|
-
console.log(
|
|
1706
|
+
console.log(chalk27.blue("\nSetting up biome..."));
|
|
1655
1707
|
const cwd = path5.dirname(packageJsonPath);
|
|
1656
1708
|
const pkg = readPackageJson(packageJsonPath);
|
|
1657
1709
|
if (!pkg.devDependencies?.["@biomejs/biome"]) {
|
|
@@ -1665,9 +1717,9 @@ async function setupLint(packageJsonPath, writer) {
|
|
|
1665
1717
|
|
|
1666
1718
|
// src/commands/verify/setup/setupMadge.ts
|
|
1667
1719
|
import * as path6 from "path";
|
|
1668
|
-
import
|
|
1720
|
+
import chalk28 from "chalk";
|
|
1669
1721
|
async function setupMadge(packageJsonPath, writer) {
|
|
1670
|
-
console.log(
|
|
1722
|
+
console.log(chalk28.blue("\nSetting up madge..."));
|
|
1671
1723
|
const cwd = path6.dirname(packageJsonPath);
|
|
1672
1724
|
const pkg = readPackageJson(packageJsonPath);
|
|
1673
1725
|
const hasMadge = !!pkg.dependencies?.madge || !!pkg.devDependencies?.madge;
|
|
@@ -1679,18 +1731,18 @@ async function setupMadge(packageJsonPath, writer) {
|
|
|
1679
1731
|
|
|
1680
1732
|
// src/commands/verify/setup/setupMaintainability.ts
|
|
1681
1733
|
import * as path7 from "path";
|
|
1682
|
-
import
|
|
1734
|
+
import chalk29 from "chalk";
|
|
1683
1735
|
async function setupMaintainability(packageJsonPath, writer) {
|
|
1684
|
-
console.log(
|
|
1736
|
+
console.log(chalk29.blue("\nSetting up maintainability check..."));
|
|
1685
1737
|
addToKnipIgnoreBinaries(path7.dirname(packageJsonPath), "assist");
|
|
1686
1738
|
writer("verify:maintainability", expectedScripts["verify:maintainability"]);
|
|
1687
1739
|
}
|
|
1688
1740
|
|
|
1689
1741
|
// src/commands/verify/setup/setupTest.ts
|
|
1690
1742
|
import * as path8 from "path";
|
|
1691
|
-
import
|
|
1743
|
+
import chalk30 from "chalk";
|
|
1692
1744
|
async function setupTest(packageJsonPath, writer) {
|
|
1693
|
-
console.log(
|
|
1745
|
+
console.log(chalk30.blue("\nSetting up vitest..."));
|
|
1694
1746
|
const cwd = path8.dirname(packageJsonPath);
|
|
1695
1747
|
const pkg = readPackageJson(packageJsonPath);
|
|
1696
1748
|
if (!pkg.devDependencies?.vitest && !installPackage("vitest", cwd)) {
|
|
@@ -1859,25 +1911,25 @@ async function runSelectedSetups(selected, packageJsonPath, writer, handlers) {
|
|
|
1859
1911
|
for (const choice of selected) {
|
|
1860
1912
|
await handlers[choice]?.(packageJsonPath, writer);
|
|
1861
1913
|
}
|
|
1862
|
-
console.log(
|
|
1914
|
+
console.log(chalk31.green(`
|
|
1863
1915
|
Added ${selected.length} verify script(s):`));
|
|
1864
1916
|
for (const choice of selected) {
|
|
1865
|
-
console.log(
|
|
1917
|
+
console.log(chalk31.green(` - verify:${choice}`));
|
|
1866
1918
|
}
|
|
1867
|
-
console.log(
|
|
1919
|
+
console.log(chalk31.dim("\nRun 'assist verify' to run all verify scripts"));
|
|
1868
1920
|
}
|
|
1869
1921
|
async function promptForScripts(availableOptions) {
|
|
1870
1922
|
if (availableOptions.length === 0) {
|
|
1871
|
-
console.log(
|
|
1923
|
+
console.log(chalk31.green("All verify scripts are already configured!"));
|
|
1872
1924
|
return null;
|
|
1873
1925
|
}
|
|
1874
|
-
console.log(
|
|
1926
|
+
console.log(chalk31.bold("Available verify scripts to add:\n"));
|
|
1875
1927
|
const selected = await promptMultiselect(
|
|
1876
1928
|
"Select verify scripts to add:",
|
|
1877
1929
|
availableOptions
|
|
1878
1930
|
);
|
|
1879
1931
|
if (selected.length === 0) {
|
|
1880
|
-
console.log(
|
|
1932
|
+
console.log(chalk31.yellow("No scripts selected"));
|
|
1881
1933
|
return null;
|
|
1882
1934
|
}
|
|
1883
1935
|
return selected;
|
|
@@ -1897,17 +1949,17 @@ async function init2() {
|
|
|
1897
1949
|
}
|
|
1898
1950
|
|
|
1899
1951
|
// src/commands/vscode/init/index.ts
|
|
1900
|
-
import
|
|
1952
|
+
import chalk33 from "chalk";
|
|
1901
1953
|
|
|
1902
1954
|
// src/commands/vscode/init/createLaunchJson.ts
|
|
1903
1955
|
import * as fs2 from "fs";
|
|
1904
1956
|
import * as path9 from "path";
|
|
1905
|
-
import
|
|
1957
|
+
import chalk32 from "chalk";
|
|
1906
1958
|
function ensureVscodeFolder() {
|
|
1907
1959
|
const vscodeDir = path9.join(process.cwd(), ".vscode");
|
|
1908
1960
|
if (!fs2.existsSync(vscodeDir)) {
|
|
1909
1961
|
fs2.mkdirSync(vscodeDir);
|
|
1910
|
-
console.log(
|
|
1962
|
+
console.log(chalk32.dim("Created .vscode folder"));
|
|
1911
1963
|
}
|
|
1912
1964
|
}
|
|
1913
1965
|
function removeVscodeFromGitignore() {
|
|
@@ -1922,7 +1974,7 @@ function removeVscodeFromGitignore() {
|
|
|
1922
1974
|
);
|
|
1923
1975
|
if (filteredLines.length !== lines.length) {
|
|
1924
1976
|
fs2.writeFileSync(gitignorePath, filteredLines.join("\n"));
|
|
1925
|
-
console.log(
|
|
1977
|
+
console.log(chalk32.dim("Removed .vscode references from .gitignore"));
|
|
1926
1978
|
}
|
|
1927
1979
|
}
|
|
1928
1980
|
function createLaunchJson(type) {
|
|
@@ -1941,7 +1993,7 @@ function createLaunchJson(type) {
|
|
|
1941
1993
|
const launchPath = path9.join(process.cwd(), ".vscode", "launch.json");
|
|
1942
1994
|
fs2.writeFileSync(launchPath, `${JSON.stringify(launchConfig, null, " ")}
|
|
1943
1995
|
`);
|
|
1944
|
-
console.log(
|
|
1996
|
+
console.log(chalk32.green("Created .vscode/launch.json"));
|
|
1945
1997
|
}
|
|
1946
1998
|
function createSettingsJson() {
|
|
1947
1999
|
const settings = {
|
|
@@ -1954,7 +2006,7 @@ function createSettingsJson() {
|
|
|
1954
2006
|
const settingsPath = path9.join(process.cwd(), ".vscode", "settings.json");
|
|
1955
2007
|
fs2.writeFileSync(settingsPath, `${JSON.stringify(settings, null, " ")}
|
|
1956
2008
|
`);
|
|
1957
|
-
console.log(
|
|
2009
|
+
console.log(chalk32.green("Created .vscode/settings.json"));
|
|
1958
2010
|
}
|
|
1959
2011
|
function createExtensionsJson() {
|
|
1960
2012
|
const extensions = {
|
|
@@ -1966,7 +2018,7 @@ function createExtensionsJson() {
|
|
|
1966
2018
|
`${JSON.stringify(extensions, null, " ")}
|
|
1967
2019
|
`
|
|
1968
2020
|
);
|
|
1969
|
-
console.log(
|
|
2021
|
+
console.log(chalk32.green("Created .vscode/extensions.json"));
|
|
1970
2022
|
}
|
|
1971
2023
|
|
|
1972
2024
|
// src/commands/vscode/init/detectVscodeSetup.ts
|
|
@@ -2023,7 +2075,7 @@ function applySelections(selected, setup2) {
|
|
|
2023
2075
|
for (const choice of selected) handlers[choice]?.();
|
|
2024
2076
|
}
|
|
2025
2077
|
async function promptForOptions(options2) {
|
|
2026
|
-
console.log(
|
|
2078
|
+
console.log(chalk33.bold("Available VS Code configurations to add:\n"));
|
|
2027
2079
|
return promptMultiselect("Select configurations to add:", options2);
|
|
2028
2080
|
}
|
|
2029
2081
|
async function init3({ all = false } = {}) {
|
|
@@ -2031,17 +2083,17 @@ async function init3({ all = false } = {}) {
|
|
|
2031
2083
|
const setup2 = detectVscodeSetup(pkg);
|
|
2032
2084
|
const options2 = getAvailableOptions2(setup2);
|
|
2033
2085
|
if (options2.length === 0) {
|
|
2034
|
-
console.log(
|
|
2086
|
+
console.log(chalk33.green("VS Code configuration already exists!"));
|
|
2035
2087
|
return;
|
|
2036
2088
|
}
|
|
2037
2089
|
const selected = all ? options2.map((o) => o.value) : await promptForOptions(options2);
|
|
2038
2090
|
if (selected.length === 0) {
|
|
2039
|
-
console.log(
|
|
2091
|
+
console.log(chalk33.yellow("No configurations selected"));
|
|
2040
2092
|
return;
|
|
2041
2093
|
}
|
|
2042
2094
|
applySelections(selected, setup2);
|
|
2043
2095
|
console.log(
|
|
2044
|
-
|
|
2096
|
+
chalk33.green(`
|
|
2045
2097
|
Added ${selected.length} VS Code configuration(s)`)
|
|
2046
2098
|
);
|
|
2047
2099
|
}
|
|
@@ -2054,7 +2106,7 @@ async function init4() {
|
|
|
2054
2106
|
|
|
2055
2107
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
2056
2108
|
import path16 from "path";
|
|
2057
|
-
import
|
|
2109
|
+
import chalk35 from "chalk";
|
|
2058
2110
|
|
|
2059
2111
|
// src/commands/lint/lint/checkFileNames.ts
|
|
2060
2112
|
import fs5 from "fs";
|
|
@@ -2134,7 +2186,7 @@ function checkFileNames() {
|
|
|
2134
2186
|
}
|
|
2135
2187
|
|
|
2136
2188
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
2137
|
-
import
|
|
2189
|
+
import chalk34 from "chalk";
|
|
2138
2190
|
|
|
2139
2191
|
// src/commands/lint/lint/applyMoves.ts
|
|
2140
2192
|
import fs6 from "fs";
|
|
@@ -2219,25 +2271,25 @@ function fixFileNameViolations(moves) {
|
|
|
2219
2271
|
const start3 = performance.now();
|
|
2220
2272
|
const project = createLintProject();
|
|
2221
2273
|
const cwd = process.cwd();
|
|
2222
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
2274
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk34.green(line)));
|
|
2223
2275
|
const ms = (performance.now() - start3).toFixed(0);
|
|
2224
|
-
console.log(
|
|
2276
|
+
console.log(chalk34.dim(` Done in ${ms}ms`));
|
|
2225
2277
|
}
|
|
2226
2278
|
|
|
2227
2279
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
2228
2280
|
function reportViolations(violations) {
|
|
2229
|
-
console.error(
|
|
2281
|
+
console.error(chalk35.red("\nFile name check failed:\n"));
|
|
2230
2282
|
console.error(
|
|
2231
|
-
|
|
2283
|
+
chalk35.red(
|
|
2232
2284
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
2233
2285
|
)
|
|
2234
2286
|
);
|
|
2235
2287
|
for (const violation of violations) {
|
|
2236
|
-
console.error(
|
|
2237
|
-
console.error(
|
|
2288
|
+
console.error(chalk35.red(` ${violation.filePath}`));
|
|
2289
|
+
console.error(chalk35.gray(` Rename to: ${violation.suggestedName}
|
|
2238
2290
|
`));
|
|
2239
2291
|
}
|
|
2240
|
-
console.error(
|
|
2292
|
+
console.error(chalk35.dim(" Run with -f to auto-fix.\n"));
|
|
2241
2293
|
}
|
|
2242
2294
|
function runFileNameCheck(fix = false) {
|
|
2243
2295
|
const violations = checkFileNames();
|
|
@@ -2266,17 +2318,17 @@ function runFileNameCheck(fix = false) {
|
|
|
2266
2318
|
import fs8 from "fs";
|
|
2267
2319
|
|
|
2268
2320
|
// src/commands/lint/shared.ts
|
|
2269
|
-
import
|
|
2321
|
+
import chalk36 from "chalk";
|
|
2270
2322
|
function reportViolations2(violations, checkName, errorMessage, successMessage) {
|
|
2271
2323
|
if (violations.length > 0) {
|
|
2272
|
-
console.error(
|
|
2324
|
+
console.error(chalk36.red(`
|
|
2273
2325
|
${checkName} failed:
|
|
2274
2326
|
`));
|
|
2275
|
-
console.error(
|
|
2327
|
+
console.error(chalk36.red(` ${errorMessage}
|
|
2276
2328
|
`));
|
|
2277
2329
|
for (const violation of violations) {
|
|
2278
|
-
console.error(
|
|
2279
|
-
console.error(
|
|
2330
|
+
console.error(chalk36.red(` ${violation.filePath}:${violation.line}`));
|
|
2331
|
+
console.error(chalk36.gray(` ${violation.content}
|
|
2280
2332
|
`));
|
|
2281
2333
|
}
|
|
2282
2334
|
return false;
|
|
@@ -2756,14 +2808,14 @@ import { existsSync as existsSync14, readFileSync as readFileSync11, writeFileSy
|
|
|
2756
2808
|
|
|
2757
2809
|
// src/commands/deploy/init/index.ts
|
|
2758
2810
|
import { execSync as execSync12 } from "child_process";
|
|
2759
|
-
import
|
|
2811
|
+
import chalk38 from "chalk";
|
|
2760
2812
|
import enquirer5 from "enquirer";
|
|
2761
2813
|
|
|
2762
2814
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
2763
2815
|
import { existsSync as existsSync13, mkdirSync as mkdirSync3, readFileSync as readFileSync10, writeFileSync as writeFileSync11 } from "fs";
|
|
2764
2816
|
import { dirname as dirname13, join as join10 } from "path";
|
|
2765
2817
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
2766
|
-
import
|
|
2818
|
+
import chalk37 from "chalk";
|
|
2767
2819
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
2768
2820
|
var __dirname3 = dirname13(fileURLToPath3(import.meta.url));
|
|
2769
2821
|
function getExistingSiteId() {
|
|
@@ -2788,20 +2840,20 @@ async function updateWorkflow(siteId) {
|
|
|
2788
2840
|
if (existsSync13(WORKFLOW_PATH)) {
|
|
2789
2841
|
const oldContent = readFileSync10(WORKFLOW_PATH, "utf-8");
|
|
2790
2842
|
if (oldContent === newContent) {
|
|
2791
|
-
console.log(
|
|
2843
|
+
console.log(chalk37.green("build.yml is already up to date"));
|
|
2792
2844
|
return;
|
|
2793
2845
|
}
|
|
2794
|
-
console.log(
|
|
2846
|
+
console.log(chalk37.yellow("\nbuild.yml will be updated:"));
|
|
2795
2847
|
console.log();
|
|
2796
2848
|
printDiff(oldContent, newContent);
|
|
2797
|
-
const confirm = await promptConfirm(
|
|
2849
|
+
const confirm = await promptConfirm(chalk37.red("Update build.yml?"));
|
|
2798
2850
|
if (!confirm) {
|
|
2799
2851
|
console.log("Skipped build.yml update");
|
|
2800
2852
|
return;
|
|
2801
2853
|
}
|
|
2802
2854
|
}
|
|
2803
2855
|
writeFileSync11(WORKFLOW_PATH, newContent);
|
|
2804
|
-
console.log(
|
|
2856
|
+
console.log(chalk37.green(`
|
|
2805
2857
|
Created ${WORKFLOW_PATH}`));
|
|
2806
2858
|
}
|
|
2807
2859
|
|
|
@@ -2812,43 +2864,43 @@ async function ensureNetlifyCli() {
|
|
|
2812
2864
|
} catch (error) {
|
|
2813
2865
|
if (!(error instanceof Error) || !error.message.includes("command not found"))
|
|
2814
2866
|
throw error;
|
|
2815
|
-
console.error(
|
|
2867
|
+
console.error(chalk38.red("\nNetlify CLI is not installed.\n"));
|
|
2816
2868
|
const install = await promptConfirm("Would you like to install it now?");
|
|
2817
2869
|
if (!install) {
|
|
2818
2870
|
console.log(
|
|
2819
|
-
|
|
2871
|
+
chalk38.yellow(
|
|
2820
2872
|
"\nInstall it manually with: npm install -g netlify-cli\n"
|
|
2821
2873
|
)
|
|
2822
2874
|
);
|
|
2823
2875
|
process.exit(1);
|
|
2824
2876
|
}
|
|
2825
|
-
console.log(
|
|
2877
|
+
console.log(chalk38.dim("\nInstalling netlify-cli...\n"));
|
|
2826
2878
|
execSync12("npm install -g netlify-cli", { stdio: "inherit" });
|
|
2827
2879
|
console.log();
|
|
2828
2880
|
execSync12("netlify sites:create --disable-linking", { stdio: "inherit" });
|
|
2829
2881
|
}
|
|
2830
2882
|
}
|
|
2831
2883
|
function printSetupInstructions() {
|
|
2832
|
-
console.log(
|
|
2884
|
+
console.log(chalk38.bold("\nDeployment initialized successfully!"));
|
|
2833
2885
|
console.log(
|
|
2834
|
-
|
|
2886
|
+
chalk38.yellow("\nTo complete setup, create a personal access token at:")
|
|
2835
2887
|
);
|
|
2836
2888
|
console.log(
|
|
2837
|
-
|
|
2889
|
+
chalk38.cyan(
|
|
2838
2890
|
"https://app.netlify.com/user/applications#personal-access-tokens"
|
|
2839
2891
|
)
|
|
2840
2892
|
);
|
|
2841
2893
|
console.log(
|
|
2842
|
-
|
|
2894
|
+
chalk38.yellow(
|
|
2843
2895
|
"\nThen add it as NETLIFY_AUTH_TOKEN in your GitHub repository secrets."
|
|
2844
2896
|
)
|
|
2845
2897
|
);
|
|
2846
2898
|
}
|
|
2847
2899
|
async function init5() {
|
|
2848
|
-
console.log(
|
|
2900
|
+
console.log(chalk38.bold("Initializing Netlify deployment...\n"));
|
|
2849
2901
|
const existingSiteId = getExistingSiteId();
|
|
2850
2902
|
if (existingSiteId) {
|
|
2851
|
-
console.log(
|
|
2903
|
+
console.log(chalk38.dim(`Using existing site ID: ${existingSiteId}
|
|
2852
2904
|
`));
|
|
2853
2905
|
await updateWorkflow(existingSiteId);
|
|
2854
2906
|
return;
|
|
@@ -3028,7 +3080,7 @@ async function notify() {
|
|
|
3028
3080
|
|
|
3029
3081
|
// src/commands/backlog/add/index.ts
|
|
3030
3082
|
import { existsSync as existsSync15 } from "fs";
|
|
3031
|
-
import
|
|
3083
|
+
import chalk39 from "chalk";
|
|
3032
3084
|
|
|
3033
3085
|
// src/commands/backlog/add/shared.ts
|
|
3034
3086
|
import { spawnSync } from "child_process";
|
|
@@ -3104,7 +3156,7 @@ async function promptAcceptanceCriteria() {
|
|
|
3104
3156
|
var addItemSchema = backlogItemSchema.omit({ id: true, status: true });
|
|
3105
3157
|
async function addFromJson() {
|
|
3106
3158
|
if (process.stdin.isTTY) {
|
|
3107
|
-
console.log(
|
|
3159
|
+
console.log(chalk39.red("--json requires piped input on stdin."));
|
|
3108
3160
|
return;
|
|
3109
3161
|
}
|
|
3110
3162
|
const input = await readStdin();
|
|
@@ -3117,7 +3169,7 @@ async function addFromJson() {
|
|
|
3117
3169
|
const id = getNextId(items);
|
|
3118
3170
|
items.push({ ...data, id, status: "todo" });
|
|
3119
3171
|
saveBacklog(items);
|
|
3120
|
-
console.log(
|
|
3172
|
+
console.log(chalk39.green(`Added item #${id}: ${data.name}`));
|
|
3121
3173
|
}
|
|
3122
3174
|
async function addInteractive() {
|
|
3123
3175
|
const type = await promptType();
|
|
@@ -3135,12 +3187,12 @@ async function addInteractive() {
|
|
|
3135
3187
|
status: "todo"
|
|
3136
3188
|
});
|
|
3137
3189
|
saveBacklog(items);
|
|
3138
|
-
console.log(
|
|
3190
|
+
console.log(chalk39.green(`Added item #${id}: ${name}`));
|
|
3139
3191
|
}
|
|
3140
3192
|
async function add(options2) {
|
|
3141
3193
|
if (!existsSync15(getBacklogPath())) {
|
|
3142
3194
|
console.log(
|
|
3143
|
-
|
|
3195
|
+
chalk39.yellow(
|
|
3144
3196
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
3145
3197
|
)
|
|
3146
3198
|
);
|
|
@@ -3155,20 +3207,20 @@ async function add(options2) {
|
|
|
3155
3207
|
|
|
3156
3208
|
// src/commands/backlog/init/index.ts
|
|
3157
3209
|
import { existsSync as existsSync16 } from "fs";
|
|
3158
|
-
import
|
|
3210
|
+
import chalk40 from "chalk";
|
|
3159
3211
|
async function init6() {
|
|
3160
3212
|
const backlogPath = getBacklogPath();
|
|
3161
3213
|
if (existsSync16(backlogPath)) {
|
|
3162
|
-
console.log(
|
|
3214
|
+
console.log(chalk40.yellow("assist.backlog.yml already exists."));
|
|
3163
3215
|
return;
|
|
3164
3216
|
}
|
|
3165
3217
|
saveBacklog([]);
|
|
3166
|
-
console.log(
|
|
3218
|
+
console.log(chalk40.green("Created assist.backlog.yml"));
|
|
3167
3219
|
}
|
|
3168
3220
|
|
|
3169
3221
|
// src/commands/backlog/list/index.ts
|
|
3170
3222
|
import { existsSync as existsSync17 } from "fs";
|
|
3171
|
-
import
|
|
3223
|
+
import chalk41 from "chalk";
|
|
3172
3224
|
function filterItems(items, options2) {
|
|
3173
3225
|
if (options2.status) return items.filter((i) => i.status === options2.status);
|
|
3174
3226
|
if (!options2.all) return items.filter((i) => i.status !== "done");
|
|
@@ -3177,7 +3229,7 @@ function filterItems(items, options2) {
|
|
|
3177
3229
|
async function list2(options2) {
|
|
3178
3230
|
if (!existsSync17(getBacklogPath())) {
|
|
3179
3231
|
console.log(
|
|
3180
|
-
|
|
3232
|
+
chalk41.yellow(
|
|
3181
3233
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
3182
3234
|
)
|
|
3183
3235
|
);
|
|
@@ -3185,12 +3237,12 @@ async function list2(options2) {
|
|
|
3185
3237
|
}
|
|
3186
3238
|
const items = filterItems(loadBacklog(), options2);
|
|
3187
3239
|
if (items.length === 0) {
|
|
3188
|
-
console.log(
|
|
3240
|
+
console.log(chalk41.dim("Backlog is empty."));
|
|
3189
3241
|
return;
|
|
3190
3242
|
}
|
|
3191
3243
|
for (const item of items) {
|
|
3192
3244
|
console.log(
|
|
3193
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
3245
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk41.dim(`#${item.id}`)} ${item.name}${phaseLabel(item)}`
|
|
3194
3246
|
);
|
|
3195
3247
|
if (options2.verbose) {
|
|
3196
3248
|
printVerboseDetails(item);
|
|
@@ -3206,6 +3258,9 @@ function registerItemCommands(cmd) {
|
|
|
3206
3258
|
}
|
|
3207
3259
|
|
|
3208
3260
|
// src/commands/registerBacklog.ts
|
|
3261
|
+
function registerShowCommands(cmd) {
|
|
3262
|
+
cmd.command("show <id>").alias("view").description("Show full detail for a backlog item").action(show);
|
|
3263
|
+
}
|
|
3209
3264
|
function registerStatusCommands(cmd) {
|
|
3210
3265
|
cmd.command("start <id>").description("Set a backlog item to in-progress").action(start);
|
|
3211
3266
|
cmd.command("done <id>").description("Set a backlog item to done").action(done);
|
|
@@ -3227,6 +3282,7 @@ function registerRunCommands(cmd) {
|
|
|
3227
3282
|
function registerBacklog(program2) {
|
|
3228
3283
|
const cmd = program2.command("backlog").description("Manage a backlog of work items").action(() => web({ port: "3000" }));
|
|
3229
3284
|
registerItemCommands(cmd);
|
|
3285
|
+
registerShowCommands(cmd);
|
|
3230
3286
|
registerStatusCommands(cmd);
|
|
3231
3287
|
registerPlanCommands(cmd);
|
|
3232
3288
|
registerRunCommands(cmd);
|
|
@@ -3581,11 +3637,11 @@ function assertCliExists(cli) {
|
|
|
3581
3637
|
}
|
|
3582
3638
|
|
|
3583
3639
|
// src/commands/permitCliReads/colorize.ts
|
|
3584
|
-
import
|
|
3640
|
+
import chalk42 from "chalk";
|
|
3585
3641
|
function colorize(plainOutput) {
|
|
3586
3642
|
return plainOutput.split("\n").map((line) => {
|
|
3587
|
-
if (line.startsWith(" R ")) return
|
|
3588
|
-
if (line.startsWith(" W ")) return
|
|
3643
|
+
if (line.startsWith(" R ")) return chalk42.green(line);
|
|
3644
|
+
if (line.startsWith(" W ")) return chalk42.red(line);
|
|
3589
3645
|
return line;
|
|
3590
3646
|
}).join("\n");
|
|
3591
3647
|
}
|
|
@@ -3899,15 +3955,15 @@ function registerCliHook(program2) {
|
|
|
3899
3955
|
}
|
|
3900
3956
|
|
|
3901
3957
|
// src/commands/complexity/analyze.ts
|
|
3902
|
-
import
|
|
3958
|
+
import chalk48 from "chalk";
|
|
3903
3959
|
|
|
3904
3960
|
// src/commands/complexity/cyclomatic.ts
|
|
3905
|
-
import
|
|
3961
|
+
import chalk44 from "chalk";
|
|
3906
3962
|
|
|
3907
3963
|
// src/commands/complexity/shared/index.ts
|
|
3908
3964
|
import fs12 from "fs";
|
|
3909
3965
|
import path20 from "path";
|
|
3910
|
-
import
|
|
3966
|
+
import chalk43 from "chalk";
|
|
3911
3967
|
import ts5 from "typescript";
|
|
3912
3968
|
|
|
3913
3969
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -4153,7 +4209,7 @@ function createSourceFromFile(filePath) {
|
|
|
4153
4209
|
function withSourceFiles(pattern2, callback) {
|
|
4154
4210
|
const files = findSourceFiles2(pattern2);
|
|
4155
4211
|
if (files.length === 0) {
|
|
4156
|
-
console.log(
|
|
4212
|
+
console.log(chalk43.yellow("No files found matching pattern"));
|
|
4157
4213
|
return void 0;
|
|
4158
4214
|
}
|
|
4159
4215
|
return callback(files);
|
|
@@ -4186,11 +4242,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4186
4242
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
4187
4243
|
for (const { file, name, complexity } of results) {
|
|
4188
4244
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
4189
|
-
const color = exceedsThreshold ?
|
|
4190
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
4245
|
+
const color = exceedsThreshold ? chalk44.red : chalk44.white;
|
|
4246
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk44.cyan(complexity)}`);
|
|
4191
4247
|
}
|
|
4192
4248
|
console.log(
|
|
4193
|
-
|
|
4249
|
+
chalk44.dim(
|
|
4194
4250
|
`
|
|
4195
4251
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
4196
4252
|
)
|
|
@@ -4202,7 +4258,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
4202
4258
|
}
|
|
4203
4259
|
|
|
4204
4260
|
// src/commands/complexity/halstead.ts
|
|
4205
|
-
import
|
|
4261
|
+
import chalk45 from "chalk";
|
|
4206
4262
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
4207
4263
|
withSourceFiles(pattern2, (files) => {
|
|
4208
4264
|
const results = [];
|
|
@@ -4217,13 +4273,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4217
4273
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
4218
4274
|
for (const { file, name, metrics } of results) {
|
|
4219
4275
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
4220
|
-
const color = exceedsThreshold ?
|
|
4276
|
+
const color = exceedsThreshold ? chalk45.red : chalk45.white;
|
|
4221
4277
|
console.log(
|
|
4222
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
4278
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk45.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk45.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk45.magenta(metrics.effort.toFixed(1))}`
|
|
4223
4279
|
);
|
|
4224
4280
|
}
|
|
4225
4281
|
console.log(
|
|
4226
|
-
|
|
4282
|
+
chalk45.dim(
|
|
4227
4283
|
`
|
|
4228
4284
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
4229
4285
|
)
|
|
@@ -4238,28 +4294,28 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
4238
4294
|
import fs13 from "fs";
|
|
4239
4295
|
|
|
4240
4296
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
4241
|
-
import
|
|
4297
|
+
import chalk46 from "chalk";
|
|
4242
4298
|
function displayMaintainabilityResults(results, threshold) {
|
|
4243
4299
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
4244
4300
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
4245
|
-
console.log(
|
|
4301
|
+
console.log(chalk46.green("All files pass maintainability threshold"));
|
|
4246
4302
|
} else {
|
|
4247
4303
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
4248
|
-
const color = threshold !== void 0 ?
|
|
4304
|
+
const color = threshold !== void 0 ? chalk46.red : chalk46.white;
|
|
4249
4305
|
console.log(
|
|
4250
|
-
`${color(file)} \u2192 avg: ${
|
|
4306
|
+
`${color(file)} \u2192 avg: ${chalk46.cyan(avgMaintainability.toFixed(1))}, min: ${chalk46.yellow(minMaintainability.toFixed(1))}`
|
|
4251
4307
|
);
|
|
4252
4308
|
}
|
|
4253
4309
|
}
|
|
4254
|
-
console.log(
|
|
4310
|
+
console.log(chalk46.dim(`
|
|
4255
4311
|
Analyzed ${results.length} files`));
|
|
4256
4312
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
4257
4313
|
console.error(
|
|
4258
|
-
|
|
4314
|
+
chalk46.red(
|
|
4259
4315
|
`
|
|
4260
4316
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
4261
4317
|
|
|
4262
|
-
\u26A0\uFE0F ${
|
|
4318
|
+
\u26A0\uFE0F ${chalk46.bold("Diagnose and fix one file at a time")} \u2014 do not investigate or fix multiple files in parallel. Run 'assist complexity <file>' to see all metrics. For larger files, start by extracting responsibilities into smaller files.`
|
|
4263
4319
|
)
|
|
4264
4320
|
);
|
|
4265
4321
|
process.exit(1);
|
|
@@ -4316,7 +4372,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4316
4372
|
|
|
4317
4373
|
// src/commands/complexity/sloc.ts
|
|
4318
4374
|
import fs14 from "fs";
|
|
4319
|
-
import
|
|
4375
|
+
import chalk47 from "chalk";
|
|
4320
4376
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
4321
4377
|
withSourceFiles(pattern2, (files) => {
|
|
4322
4378
|
const results = [];
|
|
@@ -4332,12 +4388,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4332
4388
|
results.sort((a, b) => b.lines - a.lines);
|
|
4333
4389
|
for (const { file, lines } of results) {
|
|
4334
4390
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
4335
|
-
const color = exceedsThreshold ?
|
|
4336
|
-
console.log(`${color(file)} \u2192 ${
|
|
4391
|
+
const color = exceedsThreshold ? chalk47.red : chalk47.white;
|
|
4392
|
+
console.log(`${color(file)} \u2192 ${chalk47.cyan(lines)} lines`);
|
|
4337
4393
|
}
|
|
4338
4394
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
4339
4395
|
console.log(
|
|
4340
|
-
|
|
4396
|
+
chalk47.dim(`
|
|
4341
4397
|
Total: ${total} lines across ${files.length} files`)
|
|
4342
4398
|
);
|
|
4343
4399
|
if (hasViolation) {
|
|
@@ -4351,21 +4407,21 @@ async function analyze(pattern2) {
|
|
|
4351
4407
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
4352
4408
|
const files = findSourceFiles2(searchPattern);
|
|
4353
4409
|
if (files.length === 0) {
|
|
4354
|
-
console.log(
|
|
4410
|
+
console.log(chalk48.yellow("No files found matching pattern"));
|
|
4355
4411
|
return;
|
|
4356
4412
|
}
|
|
4357
4413
|
if (files.length === 1) {
|
|
4358
4414
|
const file = files[0];
|
|
4359
|
-
console.log(
|
|
4415
|
+
console.log(chalk48.bold.underline("SLOC"));
|
|
4360
4416
|
await sloc(file);
|
|
4361
4417
|
console.log();
|
|
4362
|
-
console.log(
|
|
4418
|
+
console.log(chalk48.bold.underline("Cyclomatic Complexity"));
|
|
4363
4419
|
await cyclomatic(file);
|
|
4364
4420
|
console.log();
|
|
4365
|
-
console.log(
|
|
4421
|
+
console.log(chalk48.bold.underline("Halstead Metrics"));
|
|
4366
4422
|
await halstead(file);
|
|
4367
4423
|
console.log();
|
|
4368
|
-
console.log(
|
|
4424
|
+
console.log(chalk48.bold.underline("Maintainability Index"));
|
|
4369
4425
|
await maintainability(file);
|
|
4370
4426
|
return;
|
|
4371
4427
|
}
|
|
@@ -4393,7 +4449,7 @@ function registerComplexity(program2) {
|
|
|
4393
4449
|
|
|
4394
4450
|
// src/commands/deploy/redirect.ts
|
|
4395
4451
|
import { existsSync as existsSync21, readFileSync as readFileSync16, writeFileSync as writeFileSync16 } from "fs";
|
|
4396
|
-
import
|
|
4452
|
+
import chalk49 from "chalk";
|
|
4397
4453
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
4398
4454
|
if (!window.location.pathname.endsWith('/')) {
|
|
4399
4455
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -4402,22 +4458,22 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
4402
4458
|
function redirect() {
|
|
4403
4459
|
const indexPath = "index.html";
|
|
4404
4460
|
if (!existsSync21(indexPath)) {
|
|
4405
|
-
console.log(
|
|
4461
|
+
console.log(chalk49.yellow("No index.html found"));
|
|
4406
4462
|
return;
|
|
4407
4463
|
}
|
|
4408
4464
|
const content = readFileSync16(indexPath, "utf-8");
|
|
4409
4465
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
4410
|
-
console.log(
|
|
4466
|
+
console.log(chalk49.dim("Trailing slash script already present"));
|
|
4411
4467
|
return;
|
|
4412
4468
|
}
|
|
4413
4469
|
const headCloseIndex = content.indexOf("</head>");
|
|
4414
4470
|
if (headCloseIndex === -1) {
|
|
4415
|
-
console.log(
|
|
4471
|
+
console.log(chalk49.red("Could not find </head> tag in index.html"));
|
|
4416
4472
|
return;
|
|
4417
4473
|
}
|
|
4418
4474
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
4419
4475
|
writeFileSync16(indexPath, newContent);
|
|
4420
|
-
console.log(
|
|
4476
|
+
console.log(chalk49.green("Added trailing slash redirect to index.html"));
|
|
4421
4477
|
}
|
|
4422
4478
|
|
|
4423
4479
|
// src/commands/registerDeploy.ts
|
|
@@ -4444,7 +4500,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
4444
4500
|
|
|
4445
4501
|
// src/commands/devlog/shared.ts
|
|
4446
4502
|
import { execSync as execSync16 } from "child_process";
|
|
4447
|
-
import
|
|
4503
|
+
import chalk50 from "chalk";
|
|
4448
4504
|
|
|
4449
4505
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
4450
4506
|
import { readdirSync, readFileSync as readFileSync17 } from "fs";
|
|
@@ -4531,13 +4587,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
4531
4587
|
}
|
|
4532
4588
|
function printCommitsWithFiles(commits, ignore2, verbose) {
|
|
4533
4589
|
for (const commit2 of commits) {
|
|
4534
|
-
console.log(` ${
|
|
4590
|
+
console.log(` ${chalk50.yellow(commit2.hash)} ${commit2.message}`);
|
|
4535
4591
|
if (verbose) {
|
|
4536
4592
|
const visibleFiles = commit2.files.filter(
|
|
4537
4593
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
4538
4594
|
);
|
|
4539
4595
|
for (const file of visibleFiles) {
|
|
4540
|
-
console.log(` ${
|
|
4596
|
+
console.log(` ${chalk50.dim(file)}`);
|
|
4541
4597
|
}
|
|
4542
4598
|
}
|
|
4543
4599
|
}
|
|
@@ -4562,15 +4618,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
4562
4618
|
}
|
|
4563
4619
|
|
|
4564
4620
|
// src/commands/devlog/list/printDateHeader.ts
|
|
4565
|
-
import
|
|
4621
|
+
import chalk51 from "chalk";
|
|
4566
4622
|
function printDateHeader(date, isSkipped, entries) {
|
|
4567
4623
|
if (isSkipped) {
|
|
4568
|
-
console.log(`${
|
|
4624
|
+
console.log(`${chalk51.bold.blue(date)} ${chalk51.dim("skipped")}`);
|
|
4569
4625
|
} else if (entries && entries.length > 0) {
|
|
4570
|
-
const entryInfo = entries.map((e) => `${
|
|
4571
|
-
console.log(`${
|
|
4626
|
+
const entryInfo = entries.map((e) => `${chalk51.green(e.version)} ${e.title}`).join(" | ");
|
|
4627
|
+
console.log(`${chalk51.bold.blue(date)} ${entryInfo}`);
|
|
4572
4628
|
} else {
|
|
4573
|
-
console.log(`${
|
|
4629
|
+
console.log(`${chalk51.bold.blue(date)} ${chalk51.red("\u26A0 devlog missing")}`);
|
|
4574
4630
|
}
|
|
4575
4631
|
}
|
|
4576
4632
|
|
|
@@ -4673,24 +4729,24 @@ function bumpVersion(version2, type) {
|
|
|
4673
4729
|
|
|
4674
4730
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
4675
4731
|
import { execSync as execSync19 } from "child_process";
|
|
4676
|
-
import
|
|
4732
|
+
import chalk53 from "chalk";
|
|
4677
4733
|
|
|
4678
4734
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
4679
|
-
import
|
|
4735
|
+
import chalk52 from "chalk";
|
|
4680
4736
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
4681
4737
|
if (conventional && firstHash) {
|
|
4682
4738
|
const version2 = getVersionAtCommit(firstHash);
|
|
4683
4739
|
if (version2) {
|
|
4684
|
-
console.log(`${
|
|
4740
|
+
console.log(`${chalk52.bold("version:")} ${stripToMinor(version2)}`);
|
|
4685
4741
|
} else {
|
|
4686
|
-
console.log(`${
|
|
4742
|
+
console.log(`${chalk52.bold("version:")} ${chalk52.red("unknown")}`);
|
|
4687
4743
|
}
|
|
4688
4744
|
} else if (patchVersion && minorVersion) {
|
|
4689
4745
|
console.log(
|
|
4690
|
-
`${
|
|
4746
|
+
`${chalk52.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
4691
4747
|
);
|
|
4692
4748
|
} else {
|
|
4693
|
-
console.log(`${
|
|
4749
|
+
console.log(`${chalk52.bold("version:")} v0.1 (initial)`);
|
|
4694
4750
|
}
|
|
4695
4751
|
}
|
|
4696
4752
|
|
|
@@ -4737,16 +4793,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
4737
4793
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
4738
4794
|
}
|
|
4739
4795
|
function logName(repoName) {
|
|
4740
|
-
console.log(`${
|
|
4796
|
+
console.log(`${chalk53.bold("name:")} ${repoName}`);
|
|
4741
4797
|
}
|
|
4742
4798
|
function displayNextEntry(ctx, targetDate, commits) {
|
|
4743
4799
|
logName(ctx.repoName);
|
|
4744
4800
|
printVersionInfo(ctx.config, ctx.lastInfo, commits[0]?.hash);
|
|
4745
|
-
console.log(
|
|
4801
|
+
console.log(chalk53.bold.blue(targetDate));
|
|
4746
4802
|
printCommitsWithFiles(commits, ctx.ignore, ctx.verbose);
|
|
4747
4803
|
}
|
|
4748
4804
|
function logNoCommits(lastInfo) {
|
|
4749
|
-
console.log(
|
|
4805
|
+
console.log(chalk53.dim(noCommitsMessage(!!lastInfo)));
|
|
4750
4806
|
}
|
|
4751
4807
|
|
|
4752
4808
|
// src/commands/devlog/next/index.ts
|
|
@@ -4787,11 +4843,11 @@ function next2(options2) {
|
|
|
4787
4843
|
import { execSync as execSync20 } from "child_process";
|
|
4788
4844
|
|
|
4789
4845
|
// src/commands/devlog/repos/printReposTable.ts
|
|
4790
|
-
import
|
|
4846
|
+
import chalk54 from "chalk";
|
|
4791
4847
|
function colorStatus(status2) {
|
|
4792
|
-
if (status2 === "missing") return
|
|
4793
|
-
if (status2 === "outdated") return
|
|
4794
|
-
return
|
|
4848
|
+
if (status2 === "missing") return chalk54.red(status2);
|
|
4849
|
+
if (status2 === "outdated") return chalk54.yellow(status2);
|
|
4850
|
+
return chalk54.green(status2);
|
|
4795
4851
|
}
|
|
4796
4852
|
function formatRow(row, nameWidth) {
|
|
4797
4853
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -4805,8 +4861,8 @@ function printReposTable(rows) {
|
|
|
4805
4861
|
"Last Devlog".padEnd(11),
|
|
4806
4862
|
"Status"
|
|
4807
4863
|
].join(" ");
|
|
4808
|
-
console.log(
|
|
4809
|
-
console.log(
|
|
4864
|
+
console.log(chalk54.dim(header));
|
|
4865
|
+
console.log(chalk54.dim("-".repeat(header.length)));
|
|
4810
4866
|
for (const row of rows) {
|
|
4811
4867
|
console.log(formatRow(row, nameWidth));
|
|
4812
4868
|
}
|
|
@@ -4864,14 +4920,14 @@ function repos(options2) {
|
|
|
4864
4920
|
// src/commands/devlog/skip.ts
|
|
4865
4921
|
import { writeFileSync as writeFileSync17 } from "fs";
|
|
4866
4922
|
import { join as join16 } from "path";
|
|
4867
|
-
import
|
|
4923
|
+
import chalk55 from "chalk";
|
|
4868
4924
|
import { stringify as stringifyYaml4 } from "yaml";
|
|
4869
4925
|
function getBlogConfigPath() {
|
|
4870
4926
|
return join16(BLOG_REPO_ROOT, "assist.yml");
|
|
4871
4927
|
}
|
|
4872
4928
|
function skip(date) {
|
|
4873
4929
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
4874
|
-
console.log(
|
|
4930
|
+
console.log(chalk55.red("Invalid date format. Use YYYY-MM-DD"));
|
|
4875
4931
|
process.exit(1);
|
|
4876
4932
|
}
|
|
4877
4933
|
const repoName = getRepoName();
|
|
@@ -4882,7 +4938,7 @@ function skip(date) {
|
|
|
4882
4938
|
const skipDays = skip2[repoName] ?? [];
|
|
4883
4939
|
if (skipDays.includes(date)) {
|
|
4884
4940
|
console.log(
|
|
4885
|
-
|
|
4941
|
+
chalk55.yellow(`${date} is already in skip list for ${repoName}`)
|
|
4886
4942
|
);
|
|
4887
4943
|
return;
|
|
4888
4944
|
}
|
|
@@ -4892,20 +4948,20 @@ function skip(date) {
|
|
|
4892
4948
|
devlog.skip = skip2;
|
|
4893
4949
|
config.devlog = devlog;
|
|
4894
4950
|
writeFileSync17(configPath, stringifyYaml4(config, { lineWidth: 0 }));
|
|
4895
|
-
console.log(
|
|
4951
|
+
console.log(chalk55.green(`Added ${date} to skip list for ${repoName}`));
|
|
4896
4952
|
}
|
|
4897
4953
|
|
|
4898
4954
|
// src/commands/devlog/version.ts
|
|
4899
|
-
import
|
|
4955
|
+
import chalk56 from "chalk";
|
|
4900
4956
|
function version() {
|
|
4901
4957
|
const config = loadConfig();
|
|
4902
4958
|
const name = getRepoName();
|
|
4903
4959
|
const lastInfo = getLastVersionInfo(name, config);
|
|
4904
4960
|
const lastVersion = lastInfo?.version ?? null;
|
|
4905
4961
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
4906
|
-
console.log(`${
|
|
4907
|
-
console.log(`${
|
|
4908
|
-
console.log(`${
|
|
4962
|
+
console.log(`${chalk56.bold("name:")} ${name}`);
|
|
4963
|
+
console.log(`${chalk56.bold("last:")} ${lastVersion ?? chalk56.dim("none")}`);
|
|
4964
|
+
console.log(`${chalk56.bold("next:")} ${nextVersion ?? chalk56.dim("none")}`);
|
|
4909
4965
|
}
|
|
4910
4966
|
|
|
4911
4967
|
// src/commands/registerDevlog.ts
|
|
@@ -4929,7 +4985,7 @@ function registerDevlog(program2) {
|
|
|
4929
4985
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
4930
4986
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
4931
4987
|
import { join as join17 } from "path";
|
|
4932
|
-
import
|
|
4988
|
+
import chalk57 from "chalk";
|
|
4933
4989
|
|
|
4934
4990
|
// src/shared/findRepoRoot.ts
|
|
4935
4991
|
import { existsSync as existsSync22 } from "fs";
|
|
@@ -4992,14 +5048,14 @@ function checkBuildLocks(startDir) {
|
|
|
4992
5048
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
4993
5049
|
if (locked) {
|
|
4994
5050
|
console.error(
|
|
4995
|
-
|
|
5051
|
+
chalk57.red("Build output locked (is VS debugging?): ") + locked
|
|
4996
5052
|
);
|
|
4997
5053
|
process.exit(1);
|
|
4998
5054
|
}
|
|
4999
5055
|
}
|
|
5000
5056
|
async function checkBuildLocksCommand() {
|
|
5001
5057
|
checkBuildLocks();
|
|
5002
|
-
console.log(
|
|
5058
|
+
console.log(chalk57.green("No build locks detected"));
|
|
5003
5059
|
}
|
|
5004
5060
|
|
|
5005
5061
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -5098,30 +5154,30 @@ function escapeRegex(s) {
|
|
|
5098
5154
|
}
|
|
5099
5155
|
|
|
5100
5156
|
// src/commands/dotnet/printTree.ts
|
|
5101
|
-
import
|
|
5157
|
+
import chalk58 from "chalk";
|
|
5102
5158
|
function printNodes(nodes, prefix2) {
|
|
5103
5159
|
for (let i = 0; i < nodes.length; i++) {
|
|
5104
5160
|
const isLast = i === nodes.length - 1;
|
|
5105
5161
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
5106
5162
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
5107
5163
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
5108
|
-
const label2 = isMissing ?
|
|
5164
|
+
const label2 = isMissing ? chalk58.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
5109
5165
|
console.log(`${prefix2}${connector}${label2}`);
|
|
5110
5166
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
5111
5167
|
}
|
|
5112
5168
|
}
|
|
5113
5169
|
function printTree(tree, totalCount, solutions) {
|
|
5114
|
-
console.log(
|
|
5115
|
-
console.log(
|
|
5170
|
+
console.log(chalk58.bold("\nProject Dependency Tree"));
|
|
5171
|
+
console.log(chalk58.cyan(tree.relativePath));
|
|
5116
5172
|
printNodes(tree.children, "");
|
|
5117
|
-
console.log(
|
|
5173
|
+
console.log(chalk58.dim(`
|
|
5118
5174
|
${totalCount} projects total (including root)`));
|
|
5119
|
-
console.log(
|
|
5175
|
+
console.log(chalk58.bold("\nSolution Membership"));
|
|
5120
5176
|
if (solutions.length === 0) {
|
|
5121
|
-
console.log(
|
|
5177
|
+
console.log(chalk58.yellow(" Not found in any .sln"));
|
|
5122
5178
|
} else {
|
|
5123
5179
|
for (const sln of solutions) {
|
|
5124
|
-
console.log(` ${
|
|
5180
|
+
console.log(` ${chalk58.green(sln)}`);
|
|
5125
5181
|
}
|
|
5126
5182
|
}
|
|
5127
5183
|
console.log();
|
|
@@ -5150,16 +5206,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
5150
5206
|
// src/commands/dotnet/resolveCsproj.ts
|
|
5151
5207
|
import { existsSync as existsSync23 } from "fs";
|
|
5152
5208
|
import path24 from "path";
|
|
5153
|
-
import
|
|
5209
|
+
import chalk59 from "chalk";
|
|
5154
5210
|
function resolveCsproj(csprojPath) {
|
|
5155
5211
|
const resolved = path24.resolve(csprojPath);
|
|
5156
5212
|
if (!existsSync23(resolved)) {
|
|
5157
|
-
console.error(
|
|
5213
|
+
console.error(chalk59.red(`File not found: ${resolved}`));
|
|
5158
5214
|
process.exit(1);
|
|
5159
5215
|
}
|
|
5160
5216
|
const repoRoot = findRepoRoot(path24.dirname(resolved));
|
|
5161
5217
|
if (!repoRoot) {
|
|
5162
|
-
console.error(
|
|
5218
|
+
console.error(chalk59.red("Could not find git repository root"));
|
|
5163
5219
|
process.exit(1);
|
|
5164
5220
|
}
|
|
5165
5221
|
return { resolved, repoRoot };
|
|
@@ -5209,12 +5265,12 @@ function getChangedCsFiles(scope) {
|
|
|
5209
5265
|
}
|
|
5210
5266
|
|
|
5211
5267
|
// src/commands/dotnet/inSln.ts
|
|
5212
|
-
import
|
|
5268
|
+
import chalk60 from "chalk";
|
|
5213
5269
|
async function inSln(csprojPath) {
|
|
5214
5270
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
5215
5271
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
5216
5272
|
if (solutions.length === 0) {
|
|
5217
|
-
console.log(
|
|
5273
|
+
console.log(chalk60.yellow("Not found in any .sln file"));
|
|
5218
5274
|
process.exit(1);
|
|
5219
5275
|
}
|
|
5220
5276
|
for (const sln of solutions) {
|
|
@@ -5223,7 +5279,7 @@ async function inSln(csprojPath) {
|
|
|
5223
5279
|
}
|
|
5224
5280
|
|
|
5225
5281
|
// src/commands/dotnet/inspect.ts
|
|
5226
|
-
import
|
|
5282
|
+
import chalk66 from "chalk";
|
|
5227
5283
|
|
|
5228
5284
|
// src/shared/formatElapsed.ts
|
|
5229
5285
|
function formatElapsed(ms) {
|
|
@@ -5235,12 +5291,12 @@ function formatElapsed(ms) {
|
|
|
5235
5291
|
}
|
|
5236
5292
|
|
|
5237
5293
|
// src/commands/dotnet/displayIssues.ts
|
|
5238
|
-
import
|
|
5294
|
+
import chalk61 from "chalk";
|
|
5239
5295
|
var SEVERITY_COLOR = {
|
|
5240
|
-
ERROR:
|
|
5241
|
-
WARNING:
|
|
5242
|
-
SUGGESTION:
|
|
5243
|
-
HINT:
|
|
5296
|
+
ERROR: chalk61.red,
|
|
5297
|
+
WARNING: chalk61.yellow,
|
|
5298
|
+
SUGGESTION: chalk61.cyan,
|
|
5299
|
+
HINT: chalk61.dim
|
|
5244
5300
|
};
|
|
5245
5301
|
function groupByFile(issues) {
|
|
5246
5302
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -5256,15 +5312,15 @@ function groupByFile(issues) {
|
|
|
5256
5312
|
}
|
|
5257
5313
|
function displayIssues(issues) {
|
|
5258
5314
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
5259
|
-
console.log(
|
|
5315
|
+
console.log(chalk61.bold(file));
|
|
5260
5316
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
5261
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
5317
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk61.white;
|
|
5262
5318
|
console.log(
|
|
5263
|
-
` ${
|
|
5319
|
+
` ${chalk61.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
5264
5320
|
);
|
|
5265
5321
|
}
|
|
5266
5322
|
}
|
|
5267
|
-
console.log(
|
|
5323
|
+
console.log(chalk61.dim(`
|
|
5268
5324
|
${issues.length} issue(s) found`));
|
|
5269
5325
|
}
|
|
5270
5326
|
|
|
@@ -5323,12 +5379,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
5323
5379
|
// src/commands/dotnet/resolveSolution.ts
|
|
5324
5380
|
import { existsSync as existsSync24 } from "fs";
|
|
5325
5381
|
import path25 from "path";
|
|
5326
|
-
import
|
|
5382
|
+
import chalk63 from "chalk";
|
|
5327
5383
|
|
|
5328
5384
|
// src/commands/dotnet/findSolution.ts
|
|
5329
5385
|
import { readdirSync as readdirSync4 } from "fs";
|
|
5330
5386
|
import { dirname as dirname16, join as join18 } from "path";
|
|
5331
|
-
import
|
|
5387
|
+
import chalk62 from "chalk";
|
|
5332
5388
|
function findSlnInDir(dir) {
|
|
5333
5389
|
try {
|
|
5334
5390
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join18(dir, f));
|
|
@@ -5344,17 +5400,17 @@ function findSolution() {
|
|
|
5344
5400
|
const slnFiles = findSlnInDir(current);
|
|
5345
5401
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
5346
5402
|
if (slnFiles.length > 1) {
|
|
5347
|
-
console.error(
|
|
5403
|
+
console.error(chalk62.red(`Multiple .sln files found in ${current}:`));
|
|
5348
5404
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
5349
5405
|
console.error(
|
|
5350
|
-
|
|
5406
|
+
chalk62.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
5351
5407
|
);
|
|
5352
5408
|
process.exit(1);
|
|
5353
5409
|
}
|
|
5354
5410
|
if (current === ceiling) break;
|
|
5355
5411
|
current = dirname16(current);
|
|
5356
5412
|
}
|
|
5357
|
-
console.error(
|
|
5413
|
+
console.error(chalk62.red("No .sln file found between cwd and repo root"));
|
|
5358
5414
|
process.exit(1);
|
|
5359
5415
|
}
|
|
5360
5416
|
|
|
@@ -5363,7 +5419,7 @@ function resolveSolution(sln) {
|
|
|
5363
5419
|
if (sln) {
|
|
5364
5420
|
const resolved = path25.resolve(sln);
|
|
5365
5421
|
if (!existsSync24(resolved)) {
|
|
5366
|
-
console.error(
|
|
5422
|
+
console.error(chalk63.red(`Solution file not found: ${resolved}`));
|
|
5367
5423
|
process.exit(1);
|
|
5368
5424
|
}
|
|
5369
5425
|
return resolved;
|
|
@@ -5405,14 +5461,14 @@ import { execSync as execSync22 } from "child_process";
|
|
|
5405
5461
|
import { existsSync as existsSync25, readFileSync as readFileSync20, unlinkSync as unlinkSync4 } from "fs";
|
|
5406
5462
|
import { tmpdir as tmpdir2 } from "os";
|
|
5407
5463
|
import path26 from "path";
|
|
5408
|
-
import
|
|
5464
|
+
import chalk64 from "chalk";
|
|
5409
5465
|
function assertJbInstalled() {
|
|
5410
5466
|
try {
|
|
5411
5467
|
execSync22("jb inspectcode --version", { stdio: "pipe" });
|
|
5412
5468
|
} catch {
|
|
5413
|
-
console.error(
|
|
5469
|
+
console.error(chalk64.red("jb is not installed. Install with:"));
|
|
5414
5470
|
console.error(
|
|
5415
|
-
|
|
5471
|
+
chalk64.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
5416
5472
|
);
|
|
5417
5473
|
process.exit(1);
|
|
5418
5474
|
}
|
|
@@ -5430,11 +5486,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
5430
5486
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
5431
5487
|
process.stderr.write(err.stderr);
|
|
5432
5488
|
}
|
|
5433
|
-
console.error(
|
|
5489
|
+
console.error(chalk64.red("jb inspectcode failed"));
|
|
5434
5490
|
process.exit(1);
|
|
5435
5491
|
}
|
|
5436
5492
|
if (!existsSync25(reportPath)) {
|
|
5437
|
-
console.error(
|
|
5493
|
+
console.error(chalk64.red("Report file not generated"));
|
|
5438
5494
|
process.exit(1);
|
|
5439
5495
|
}
|
|
5440
5496
|
const xml = readFileSync20(reportPath, "utf-8");
|
|
@@ -5444,7 +5500,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
5444
5500
|
|
|
5445
5501
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
5446
5502
|
import { execSync as execSync23 } from "child_process";
|
|
5447
|
-
import
|
|
5503
|
+
import chalk65 from "chalk";
|
|
5448
5504
|
function resolveMsbuildPath() {
|
|
5449
5505
|
const config = loadConfig();
|
|
5450
5506
|
const buildConfig = config.run?.find((r) => r.name === "build");
|
|
@@ -5455,9 +5511,9 @@ function assertMsbuildInstalled() {
|
|
|
5455
5511
|
try {
|
|
5456
5512
|
execSync23(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
5457
5513
|
} catch {
|
|
5458
|
-
console.error(
|
|
5514
|
+
console.error(chalk65.red(`msbuild not found at: ${msbuild}`));
|
|
5459
5515
|
console.error(
|
|
5460
|
-
|
|
5516
|
+
chalk65.yellow(
|
|
5461
5517
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
5462
5518
|
)
|
|
5463
5519
|
);
|
|
@@ -5504,17 +5560,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
5504
5560
|
// src/commands/dotnet/inspect.ts
|
|
5505
5561
|
function logScope(changedFiles) {
|
|
5506
5562
|
if (changedFiles === null) {
|
|
5507
|
-
console.log(
|
|
5563
|
+
console.log(chalk66.dim("Inspecting full solution..."));
|
|
5508
5564
|
} else {
|
|
5509
5565
|
console.log(
|
|
5510
|
-
|
|
5566
|
+
chalk66.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
5511
5567
|
);
|
|
5512
5568
|
}
|
|
5513
5569
|
}
|
|
5514
5570
|
function reportResults(issues, elapsed) {
|
|
5515
5571
|
if (issues.length > 0) displayIssues(issues);
|
|
5516
|
-
else console.log(
|
|
5517
|
-
console.log(
|
|
5572
|
+
else console.log(chalk66.green("No issues found"));
|
|
5573
|
+
console.log(chalk66.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
5518
5574
|
if (issues.length > 0) process.exit(1);
|
|
5519
5575
|
}
|
|
5520
5576
|
async function inspect(sln, options2) {
|
|
@@ -5525,7 +5581,7 @@ async function inspect(sln, options2) {
|
|
|
5525
5581
|
const scope = parseScope(options2.scope);
|
|
5526
5582
|
const changedFiles = getChangedCsFiles(scope);
|
|
5527
5583
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
5528
|
-
console.log(
|
|
5584
|
+
console.log(chalk66.green("No changed .cs files found"));
|
|
5529
5585
|
return;
|
|
5530
5586
|
}
|
|
5531
5587
|
logScope(changedFiles);
|
|
@@ -5551,7 +5607,7 @@ function registerDotnet(program2) {
|
|
|
5551
5607
|
}
|
|
5552
5608
|
|
|
5553
5609
|
// src/commands/jira/acceptanceCriteria.ts
|
|
5554
|
-
import
|
|
5610
|
+
import chalk68 from "chalk";
|
|
5555
5611
|
|
|
5556
5612
|
// src/commands/jira/adfToText.ts
|
|
5557
5613
|
function renderInline(node) {
|
|
@@ -5612,7 +5668,7 @@ function adfToText(doc) {
|
|
|
5612
5668
|
|
|
5613
5669
|
// src/commands/jira/fetchIssue.ts
|
|
5614
5670
|
import { execSync as execSync24 } from "child_process";
|
|
5615
|
-
import
|
|
5671
|
+
import chalk67 from "chalk";
|
|
5616
5672
|
function fetchIssue(issueKey, fields) {
|
|
5617
5673
|
let result;
|
|
5618
5674
|
try {
|
|
@@ -5625,15 +5681,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
5625
5681
|
const stderr = error.stderr;
|
|
5626
5682
|
if (stderr.includes("unauthorized")) {
|
|
5627
5683
|
console.error(
|
|
5628
|
-
|
|
5684
|
+
chalk67.red("Jira authentication expired."),
|
|
5629
5685
|
"Run",
|
|
5630
|
-
|
|
5686
|
+
chalk67.cyan("assist jira auth"),
|
|
5631
5687
|
"to re-authenticate."
|
|
5632
5688
|
);
|
|
5633
5689
|
process.exit(1);
|
|
5634
5690
|
}
|
|
5635
5691
|
}
|
|
5636
|
-
console.error(
|
|
5692
|
+
console.error(chalk67.red(`Failed to fetch ${issueKey}.`));
|
|
5637
5693
|
process.exit(1);
|
|
5638
5694
|
}
|
|
5639
5695
|
return JSON.parse(result);
|
|
@@ -5647,7 +5703,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
5647
5703
|
const parsed = fetchIssue(issueKey, field);
|
|
5648
5704
|
const acValue = parsed?.fields?.[field];
|
|
5649
5705
|
if (!acValue) {
|
|
5650
|
-
console.log(
|
|
5706
|
+
console.log(chalk68.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
5651
5707
|
return;
|
|
5652
5708
|
}
|
|
5653
5709
|
if (typeof acValue === "string") {
|
|
@@ -5742,14 +5798,14 @@ async function jiraAuth() {
|
|
|
5742
5798
|
}
|
|
5743
5799
|
|
|
5744
5800
|
// src/commands/jira/viewIssue.ts
|
|
5745
|
-
import
|
|
5801
|
+
import chalk69 from "chalk";
|
|
5746
5802
|
function viewIssue(issueKey) {
|
|
5747
5803
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
5748
5804
|
const fields = parsed?.fields;
|
|
5749
5805
|
const summary = fields?.summary;
|
|
5750
5806
|
const description = fields?.description;
|
|
5751
5807
|
if (summary) {
|
|
5752
|
-
console.log(
|
|
5808
|
+
console.log(chalk69.bold(summary));
|
|
5753
5809
|
}
|
|
5754
5810
|
if (description) {
|
|
5755
5811
|
if (summary) console.log();
|
|
@@ -5763,7 +5819,7 @@ function viewIssue(issueKey) {
|
|
|
5763
5819
|
}
|
|
5764
5820
|
if (!summary && !description) {
|
|
5765
5821
|
console.log(
|
|
5766
|
-
|
|
5822
|
+
chalk69.yellow(`No summary or description found on ${issueKey}.`)
|
|
5767
5823
|
);
|
|
5768
5824
|
}
|
|
5769
5825
|
}
|
|
@@ -5777,7 +5833,7 @@ function registerJira(program2) {
|
|
|
5777
5833
|
}
|
|
5778
5834
|
|
|
5779
5835
|
// src/commands/news/add/index.ts
|
|
5780
|
-
import
|
|
5836
|
+
import chalk70 from "chalk";
|
|
5781
5837
|
import enquirer7 from "enquirer";
|
|
5782
5838
|
async function add2(url) {
|
|
5783
5839
|
if (!url) {
|
|
@@ -5800,17 +5856,17 @@ async function add2(url) {
|
|
|
5800
5856
|
const news = config.news ?? {};
|
|
5801
5857
|
const feeds = news.feeds ?? [];
|
|
5802
5858
|
if (feeds.includes(url)) {
|
|
5803
|
-
console.log(
|
|
5859
|
+
console.log(chalk70.yellow("Feed already exists in config"));
|
|
5804
5860
|
return;
|
|
5805
5861
|
}
|
|
5806
5862
|
feeds.push(url);
|
|
5807
5863
|
config.news = { ...news, feeds };
|
|
5808
5864
|
saveGlobalConfig(config);
|
|
5809
|
-
console.log(
|
|
5865
|
+
console.log(chalk70.green(`Added feed: ${url}`));
|
|
5810
5866
|
}
|
|
5811
5867
|
|
|
5812
5868
|
// src/commands/news/web/handleRequest.ts
|
|
5813
|
-
import
|
|
5869
|
+
import chalk71 from "chalk";
|
|
5814
5870
|
|
|
5815
5871
|
// src/commands/news/web/shared.ts
|
|
5816
5872
|
import { decodeHTML } from "entities";
|
|
@@ -5946,17 +6002,17 @@ function prefetch() {
|
|
|
5946
6002
|
const config = loadConfig();
|
|
5947
6003
|
const total = config.news.feeds.length;
|
|
5948
6004
|
if (total === 0) return;
|
|
5949
|
-
process.stdout.write(
|
|
6005
|
+
process.stdout.write(chalk71.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
5950
6006
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
5951
6007
|
const width = 20;
|
|
5952
6008
|
const filled = Math.round(done2 / t * width);
|
|
5953
6009
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
5954
6010
|
process.stdout.write(
|
|
5955
|
-
`\r${
|
|
6011
|
+
`\r${chalk71.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
5956
6012
|
);
|
|
5957
6013
|
}).then((items) => {
|
|
5958
6014
|
process.stdout.write(
|
|
5959
|
-
`\r${
|
|
6015
|
+
`\r${chalk71.green(`Fetched ${items.length} items from ${total} feed(s)`)}
|
|
5960
6016
|
`
|
|
5961
6017
|
);
|
|
5962
6018
|
cachedItems = items;
|
|
@@ -6317,20 +6373,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
6317
6373
|
}
|
|
6318
6374
|
|
|
6319
6375
|
// src/commands/prs/listComments/printComments.ts
|
|
6320
|
-
import
|
|
6376
|
+
import chalk72 from "chalk";
|
|
6321
6377
|
function formatForHuman(comment2) {
|
|
6322
6378
|
if (comment2.type === "review") {
|
|
6323
|
-
const stateColor = comment2.state === "APPROVED" ?
|
|
6379
|
+
const stateColor = comment2.state === "APPROVED" ? chalk72.green : comment2.state === "CHANGES_REQUESTED" ? chalk72.red : chalk72.yellow;
|
|
6324
6380
|
return [
|
|
6325
|
-
`${
|
|
6381
|
+
`${chalk72.cyan("Review")} by ${chalk72.bold(comment2.user)} ${stateColor(`[${comment2.state}]`)}`,
|
|
6326
6382
|
comment2.body,
|
|
6327
6383
|
""
|
|
6328
6384
|
].join("\n");
|
|
6329
6385
|
}
|
|
6330
6386
|
const location = comment2.line ? `:${comment2.line}` : "";
|
|
6331
6387
|
return [
|
|
6332
|
-
`${
|
|
6333
|
-
|
|
6388
|
+
`${chalk72.cyan("Line comment")} by ${chalk72.bold(comment2.user)} on ${chalk72.dim(`${comment2.path}${location}`)}`,
|
|
6389
|
+
chalk72.dim(comment2.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
6334
6390
|
comment2.body,
|
|
6335
6391
|
""
|
|
6336
6392
|
].join("\n");
|
|
@@ -6420,13 +6476,13 @@ import { execSync as execSync31 } from "child_process";
|
|
|
6420
6476
|
import enquirer8 from "enquirer";
|
|
6421
6477
|
|
|
6422
6478
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
6423
|
-
import
|
|
6479
|
+
import chalk73 from "chalk";
|
|
6424
6480
|
var STATUS_MAP = {
|
|
6425
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
6426
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
6481
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk73.magenta("merged"), date: pr.mergedAt } : null,
|
|
6482
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk73.red("closed"), date: pr.closedAt } : null
|
|
6427
6483
|
};
|
|
6428
6484
|
function defaultStatus(pr) {
|
|
6429
|
-
return { label:
|
|
6485
|
+
return { label: chalk73.green("opened"), date: pr.createdAt };
|
|
6430
6486
|
}
|
|
6431
6487
|
function getStatus2(pr) {
|
|
6432
6488
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -6435,11 +6491,11 @@ function formatDate(dateStr) {
|
|
|
6435
6491
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
6436
6492
|
}
|
|
6437
6493
|
function formatPrHeader(pr, status2) {
|
|
6438
|
-
return `${
|
|
6494
|
+
return `${chalk73.cyan(`#${pr.number}`)} ${pr.title} ${chalk73.dim(`(${pr.author.login},`)} ${status2.label} ${chalk73.dim(`${formatDate(status2.date)})`)}`;
|
|
6439
6495
|
}
|
|
6440
6496
|
function logPrDetails(pr) {
|
|
6441
6497
|
console.log(
|
|
6442
|
-
|
|
6498
|
+
chalk73.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
6443
6499
|
);
|
|
6444
6500
|
console.log();
|
|
6445
6501
|
}
|
|
@@ -6605,10 +6661,10 @@ function registerPrs(program2) {
|
|
|
6605
6661
|
}
|
|
6606
6662
|
|
|
6607
6663
|
// src/commands/ravendb/ravendbAuth.ts
|
|
6608
|
-
import
|
|
6664
|
+
import chalk79 from "chalk";
|
|
6609
6665
|
|
|
6610
6666
|
// src/shared/createConnectionAuth.ts
|
|
6611
|
-
import
|
|
6667
|
+
import chalk74 from "chalk";
|
|
6612
6668
|
function listConnections(connections, format2) {
|
|
6613
6669
|
if (connections.length === 0) {
|
|
6614
6670
|
console.log("No connections configured.");
|
|
@@ -6621,7 +6677,7 @@ function listConnections(connections, format2) {
|
|
|
6621
6677
|
function removeConnection(connections, name, save) {
|
|
6622
6678
|
const filtered = connections.filter((c) => c.name !== name);
|
|
6623
6679
|
if (filtered.length === connections.length) {
|
|
6624
|
-
console.error(
|
|
6680
|
+
console.error(chalk74.red(`Connection "${name}" not found.`));
|
|
6625
6681
|
process.exit(1);
|
|
6626
6682
|
}
|
|
6627
6683
|
save(filtered);
|
|
@@ -6667,15 +6723,15 @@ function saveConnections(connections) {
|
|
|
6667
6723
|
}
|
|
6668
6724
|
|
|
6669
6725
|
// src/commands/ravendb/promptConnection.ts
|
|
6670
|
-
import
|
|
6726
|
+
import chalk77 from "chalk";
|
|
6671
6727
|
|
|
6672
6728
|
// src/commands/ravendb/selectOpSecret.ts
|
|
6673
|
-
import
|
|
6729
|
+
import chalk76 from "chalk";
|
|
6674
6730
|
import Enquirer2 from "enquirer";
|
|
6675
6731
|
|
|
6676
6732
|
// src/commands/ravendb/searchItems.ts
|
|
6677
6733
|
import { execSync as execSync33 } from "child_process";
|
|
6678
|
-
import
|
|
6734
|
+
import chalk75 from "chalk";
|
|
6679
6735
|
function opExec(args) {
|
|
6680
6736
|
return execSync33(`op ${args}`, {
|
|
6681
6737
|
encoding: "utf-8",
|
|
@@ -6688,7 +6744,7 @@ function searchItems(search) {
|
|
|
6688
6744
|
items = JSON.parse(opExec("item list --format=json"));
|
|
6689
6745
|
} catch {
|
|
6690
6746
|
console.error(
|
|
6691
|
-
|
|
6747
|
+
chalk75.red(
|
|
6692
6748
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
6693
6749
|
)
|
|
6694
6750
|
);
|
|
@@ -6702,7 +6758,7 @@ function getItemFields(itemId) {
|
|
|
6702
6758
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
6703
6759
|
return item.fields.filter((f) => f.reference && f.label);
|
|
6704
6760
|
} catch {
|
|
6705
|
-
console.error(
|
|
6761
|
+
console.error(chalk75.red("Failed to get item details from 1Password."));
|
|
6706
6762
|
process.exit(1);
|
|
6707
6763
|
}
|
|
6708
6764
|
}
|
|
@@ -6721,7 +6777,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
6721
6777
|
}).run();
|
|
6722
6778
|
const items = searchItems(search);
|
|
6723
6779
|
if (items.length === 0) {
|
|
6724
|
-
console.error(
|
|
6780
|
+
console.error(chalk76.red(`No items found matching "${search}".`));
|
|
6725
6781
|
process.exit(1);
|
|
6726
6782
|
}
|
|
6727
6783
|
const itemId = await selectOne(
|
|
@@ -6730,7 +6786,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
6730
6786
|
);
|
|
6731
6787
|
const fields = getItemFields(itemId);
|
|
6732
6788
|
if (fields.length === 0) {
|
|
6733
|
-
console.error(
|
|
6789
|
+
console.error(chalk76.red("No fields with references found on this item."));
|
|
6734
6790
|
process.exit(1);
|
|
6735
6791
|
}
|
|
6736
6792
|
const ref = await selectOne(
|
|
@@ -6744,7 +6800,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
6744
6800
|
async function promptConnection(existingNames) {
|
|
6745
6801
|
const name = await promptInput("name", "Connection name:");
|
|
6746
6802
|
if (existingNames.includes(name)) {
|
|
6747
|
-
console.error(
|
|
6803
|
+
console.error(chalk77.red(`Connection "${name}" already exists.`));
|
|
6748
6804
|
process.exit(1);
|
|
6749
6805
|
}
|
|
6750
6806
|
const url = await promptInput(
|
|
@@ -6753,22 +6809,22 @@ async function promptConnection(existingNames) {
|
|
|
6753
6809
|
);
|
|
6754
6810
|
const database = await promptInput("database", "Database name:");
|
|
6755
6811
|
if (!name || !url || !database) {
|
|
6756
|
-
console.error(
|
|
6812
|
+
console.error(chalk77.red("All fields are required."));
|
|
6757
6813
|
process.exit(1);
|
|
6758
6814
|
}
|
|
6759
6815
|
const apiKeyRef = await selectOpSecret();
|
|
6760
|
-
console.log(
|
|
6816
|
+
console.log(chalk77.dim(`Using: ${apiKeyRef}`));
|
|
6761
6817
|
return { name, url, database, apiKeyRef };
|
|
6762
6818
|
}
|
|
6763
6819
|
|
|
6764
6820
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
6765
|
-
import
|
|
6821
|
+
import chalk78 from "chalk";
|
|
6766
6822
|
function ravendbSetConnection(name) {
|
|
6767
6823
|
const raw = loadGlobalConfigRaw();
|
|
6768
6824
|
const ravendb = raw.ravendb ?? {};
|
|
6769
6825
|
const connections = ravendb.connections ?? [];
|
|
6770
6826
|
if (!connections.some((c) => c.name === name)) {
|
|
6771
|
-
console.error(
|
|
6827
|
+
console.error(chalk78.red(`Connection "${name}" not found.`));
|
|
6772
6828
|
console.error(
|
|
6773
6829
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
6774
6830
|
);
|
|
@@ -6784,16 +6840,16 @@ function ravendbSetConnection(name) {
|
|
|
6784
6840
|
var ravendbAuth = createConnectionAuth({
|
|
6785
6841
|
load: loadConnections,
|
|
6786
6842
|
save: saveConnections,
|
|
6787
|
-
format: (c) => `${
|
|
6843
|
+
format: (c) => `${chalk79.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
6788
6844
|
promptNew: promptConnection,
|
|
6789
6845
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
6790
6846
|
});
|
|
6791
6847
|
|
|
6792
6848
|
// src/commands/ravendb/ravendbCollections.ts
|
|
6793
|
-
import
|
|
6849
|
+
import chalk83 from "chalk";
|
|
6794
6850
|
|
|
6795
6851
|
// src/commands/ravendb/ravenFetch.ts
|
|
6796
|
-
import
|
|
6852
|
+
import chalk81 from "chalk";
|
|
6797
6853
|
|
|
6798
6854
|
// src/commands/ravendb/getAccessToken.ts
|
|
6799
6855
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -6830,10 +6886,10 @@ ${errorText}`
|
|
|
6830
6886
|
|
|
6831
6887
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
6832
6888
|
import { execSync as execSync34 } from "child_process";
|
|
6833
|
-
import
|
|
6889
|
+
import chalk80 from "chalk";
|
|
6834
6890
|
function resolveOpSecret(reference) {
|
|
6835
6891
|
if (!reference.startsWith("op://")) {
|
|
6836
|
-
console.error(
|
|
6892
|
+
console.error(chalk80.red(`Invalid secret reference: must start with op://`));
|
|
6837
6893
|
process.exit(1);
|
|
6838
6894
|
}
|
|
6839
6895
|
try {
|
|
@@ -6843,7 +6899,7 @@ function resolveOpSecret(reference) {
|
|
|
6843
6899
|
}).trim();
|
|
6844
6900
|
} catch {
|
|
6845
6901
|
console.error(
|
|
6846
|
-
|
|
6902
|
+
chalk80.red(
|
|
6847
6903
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
6848
6904
|
)
|
|
6849
6905
|
);
|
|
@@ -6870,7 +6926,7 @@ async function ravenFetch(connection, path50) {
|
|
|
6870
6926
|
if (!response.ok) {
|
|
6871
6927
|
const body = await response.text();
|
|
6872
6928
|
console.error(
|
|
6873
|
-
|
|
6929
|
+
chalk81.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
6874
6930
|
);
|
|
6875
6931
|
console.error(body.substring(0, 500));
|
|
6876
6932
|
process.exit(1);
|
|
@@ -6879,7 +6935,7 @@ async function ravenFetch(connection, path50) {
|
|
|
6879
6935
|
}
|
|
6880
6936
|
|
|
6881
6937
|
// src/commands/ravendb/resolveConnection.ts
|
|
6882
|
-
import
|
|
6938
|
+
import chalk82 from "chalk";
|
|
6883
6939
|
function loadRavendb() {
|
|
6884
6940
|
const raw = loadGlobalConfigRaw();
|
|
6885
6941
|
const ravendb = raw.ravendb;
|
|
@@ -6893,7 +6949,7 @@ function resolveConnection(name) {
|
|
|
6893
6949
|
const connectionName = name ?? defaultConnection;
|
|
6894
6950
|
if (!connectionName) {
|
|
6895
6951
|
console.error(
|
|
6896
|
-
|
|
6952
|
+
chalk82.red(
|
|
6897
6953
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
6898
6954
|
)
|
|
6899
6955
|
);
|
|
@@ -6901,7 +6957,7 @@ function resolveConnection(name) {
|
|
|
6901
6957
|
}
|
|
6902
6958
|
const connection = connections.find((c) => c.name === connectionName);
|
|
6903
6959
|
if (!connection) {
|
|
6904
|
-
console.error(
|
|
6960
|
+
console.error(chalk82.red(`Connection "${connectionName}" not found.`));
|
|
6905
6961
|
console.error(
|
|
6906
6962
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
6907
6963
|
);
|
|
@@ -6932,15 +6988,15 @@ async function ravendbCollections(connectionName) {
|
|
|
6932
6988
|
return;
|
|
6933
6989
|
}
|
|
6934
6990
|
for (const c of collections) {
|
|
6935
|
-
console.log(`${
|
|
6991
|
+
console.log(`${chalk83.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
6936
6992
|
}
|
|
6937
6993
|
}
|
|
6938
6994
|
|
|
6939
6995
|
// src/commands/ravendb/ravendbQuery.ts
|
|
6940
|
-
import
|
|
6996
|
+
import chalk85 from "chalk";
|
|
6941
6997
|
|
|
6942
6998
|
// src/commands/ravendb/fetchAllPages.ts
|
|
6943
|
-
import
|
|
6999
|
+
import chalk84 from "chalk";
|
|
6944
7000
|
|
|
6945
7001
|
// src/commands/ravendb/buildQueryPath.ts
|
|
6946
7002
|
function buildQueryPath(opts) {
|
|
@@ -6978,7 +7034,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
6978
7034
|
allResults.push(...results);
|
|
6979
7035
|
start3 += results.length;
|
|
6980
7036
|
process.stderr.write(
|
|
6981
|
-
`\r${
|
|
7037
|
+
`\r${chalk84.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
6982
7038
|
);
|
|
6983
7039
|
if (start3 >= totalResults) break;
|
|
6984
7040
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -6993,7 +7049,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
6993
7049
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
6994
7050
|
const resolved = resolveArgs(connectionName, collection);
|
|
6995
7051
|
if (!resolved.collection && !options2.query) {
|
|
6996
|
-
console.error(
|
|
7052
|
+
console.error(chalk85.red("Provide a collection name or --query filter."));
|
|
6997
7053
|
process.exit(1);
|
|
6998
7054
|
}
|
|
6999
7055
|
const { collection: col } = resolved;
|
|
@@ -7031,7 +7087,7 @@ import { spawn as spawn4 } from "child_process";
|
|
|
7031
7087
|
import * as path27 from "path";
|
|
7032
7088
|
|
|
7033
7089
|
// src/commands/refactor/logViolations.ts
|
|
7034
|
-
import
|
|
7090
|
+
import chalk86 from "chalk";
|
|
7035
7091
|
var DEFAULT_MAX_LINES = 100;
|
|
7036
7092
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
7037
7093
|
if (violations.length === 0) {
|
|
@@ -7040,43 +7096,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
7040
7096
|
}
|
|
7041
7097
|
return;
|
|
7042
7098
|
}
|
|
7043
|
-
console.error(
|
|
7099
|
+
console.error(chalk86.red(`
|
|
7044
7100
|
Refactor check failed:
|
|
7045
7101
|
`));
|
|
7046
|
-
console.error(
|
|
7102
|
+
console.error(chalk86.red(` The following files exceed ${maxLines} lines:
|
|
7047
7103
|
`));
|
|
7048
7104
|
for (const violation of violations) {
|
|
7049
|
-
console.error(
|
|
7105
|
+
console.error(chalk86.red(` ${violation.file} (${violation.lines} lines)`));
|
|
7050
7106
|
}
|
|
7051
7107
|
console.error(
|
|
7052
|
-
|
|
7108
|
+
chalk86.yellow(
|
|
7053
7109
|
`
|
|
7054
7110
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
7055
7111
|
way to refactor it, ignore it with:
|
|
7056
7112
|
`
|
|
7057
7113
|
)
|
|
7058
7114
|
);
|
|
7059
|
-
console.error(
|
|
7115
|
+
console.error(chalk86.gray(` assist refactor ignore <file>
|
|
7060
7116
|
`));
|
|
7061
7117
|
if (process.env.CLAUDECODE) {
|
|
7062
|
-
console.error(
|
|
7118
|
+
console.error(chalk86.cyan(`
|
|
7063
7119
|
## Extracting Code to New Files
|
|
7064
7120
|
`));
|
|
7065
7121
|
console.error(
|
|
7066
|
-
|
|
7122
|
+
chalk86.cyan(
|
|
7067
7123
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
7068
7124
|
`
|
|
7069
7125
|
)
|
|
7070
7126
|
);
|
|
7071
7127
|
console.error(
|
|
7072
|
-
|
|
7128
|
+
chalk86.cyan(
|
|
7073
7129
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
7074
7130
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
7075
7131
|
`
|
|
7076
7132
|
)
|
|
7077
7133
|
);
|
|
7078
7134
|
console.error(
|
|
7079
|
-
|
|
7135
|
+
chalk86.cyan(
|
|
7080
7136
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
7081
7137
|
domains, move it to a common/shared folder.
|
|
7082
7138
|
`
|
|
@@ -7232,7 +7288,7 @@ async function check(pattern2, options2) {
|
|
|
7232
7288
|
|
|
7233
7289
|
// src/commands/refactor/extract/index.ts
|
|
7234
7290
|
import path33 from "path";
|
|
7235
|
-
import
|
|
7291
|
+
import chalk89 from "chalk";
|
|
7236
7292
|
|
|
7237
7293
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
7238
7294
|
import { SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
@@ -7758,23 +7814,23 @@ function buildPlan(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
7758
7814
|
|
|
7759
7815
|
// src/commands/refactor/extract/displayPlan.ts
|
|
7760
7816
|
import path31 from "path";
|
|
7761
|
-
import
|
|
7817
|
+
import chalk87 from "chalk";
|
|
7762
7818
|
function section(title) {
|
|
7763
7819
|
return `
|
|
7764
|
-
${
|
|
7820
|
+
${chalk87.cyan(title)}`;
|
|
7765
7821
|
}
|
|
7766
7822
|
function displayImporters(plan2, cwd) {
|
|
7767
7823
|
if (plan2.importersToUpdate.length === 0) return;
|
|
7768
7824
|
console.log(section("Update importers:"));
|
|
7769
7825
|
for (const imp of plan2.importersToUpdate) {
|
|
7770
7826
|
const rel = path31.relative(cwd, imp.file.getFilePath());
|
|
7771
|
-
console.log(` ${
|
|
7827
|
+
console.log(` ${chalk87.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
7772
7828
|
}
|
|
7773
7829
|
}
|
|
7774
7830
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
7775
|
-
console.log(
|
|
7831
|
+
console.log(chalk87.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
7776
7832
|
`));
|
|
7777
|
-
console.log(` ${
|
|
7833
|
+
console.log(` ${chalk87.cyan("Functions to move:")}`);
|
|
7778
7834
|
for (const name of plan2.extractedNames) {
|
|
7779
7835
|
console.log(` ${name}`);
|
|
7780
7836
|
}
|
|
@@ -7809,7 +7865,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
7809
7865
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
7810
7866
|
import fs17 from "fs";
|
|
7811
7867
|
import path32 from "path";
|
|
7812
|
-
import
|
|
7868
|
+
import chalk88 from "chalk";
|
|
7813
7869
|
import { Project as Project2 } from "ts-morph";
|
|
7814
7870
|
function findTsConfig(sourcePath) {
|
|
7815
7871
|
const rootConfig = path32.resolve("tsconfig.json");
|
|
@@ -7840,7 +7896,7 @@ function loadProjectFile(file) {
|
|
|
7840
7896
|
});
|
|
7841
7897
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
7842
7898
|
if (!sourceFile) {
|
|
7843
|
-
console.log(
|
|
7899
|
+
console.log(chalk88.red(`File not found in project: ${file}`));
|
|
7844
7900
|
process.exit(1);
|
|
7845
7901
|
}
|
|
7846
7902
|
return { project, sourceFile };
|
|
@@ -7863,19 +7919,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
7863
7919
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
7864
7920
|
if (options2.apply) {
|
|
7865
7921
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
7866
|
-
console.log(
|
|
7922
|
+
console.log(chalk89.green("\nExtraction complete"));
|
|
7867
7923
|
} else {
|
|
7868
|
-
console.log(
|
|
7924
|
+
console.log(chalk89.dim("\nDry run. Use --apply to execute."));
|
|
7869
7925
|
}
|
|
7870
7926
|
}
|
|
7871
7927
|
|
|
7872
7928
|
// src/commands/refactor/ignore.ts
|
|
7873
7929
|
import fs18 from "fs";
|
|
7874
|
-
import
|
|
7930
|
+
import chalk90 from "chalk";
|
|
7875
7931
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
7876
7932
|
function ignore(file) {
|
|
7877
7933
|
if (!fs18.existsSync(file)) {
|
|
7878
|
-
console.error(
|
|
7934
|
+
console.error(chalk90.red(`Error: File does not exist: ${file}`));
|
|
7879
7935
|
process.exit(1);
|
|
7880
7936
|
}
|
|
7881
7937
|
const content = fs18.readFileSync(file, "utf-8");
|
|
@@ -7891,7 +7947,7 @@ function ignore(file) {
|
|
|
7891
7947
|
fs18.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
7892
7948
|
}
|
|
7893
7949
|
console.log(
|
|
7894
|
-
|
|
7950
|
+
chalk90.green(
|
|
7895
7951
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
7896
7952
|
)
|
|
7897
7953
|
);
|
|
@@ -7899,26 +7955,26 @@ function ignore(file) {
|
|
|
7899
7955
|
|
|
7900
7956
|
// src/commands/refactor/rename/index.ts
|
|
7901
7957
|
import path34 from "path";
|
|
7902
|
-
import
|
|
7958
|
+
import chalk91 from "chalk";
|
|
7903
7959
|
async function rename(source, destination, options2 = {}) {
|
|
7904
7960
|
const destPath = path34.resolve(destination);
|
|
7905
7961
|
const cwd = process.cwd();
|
|
7906
7962
|
const relSource = path34.relative(cwd, path34.resolve(source));
|
|
7907
7963
|
const relDest = path34.relative(cwd, destPath);
|
|
7908
7964
|
const { project, sourceFile } = loadProjectFile(source);
|
|
7909
|
-
console.log(
|
|
7965
|
+
console.log(chalk91.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
7910
7966
|
if (options2.apply) {
|
|
7911
7967
|
sourceFile.move(destPath);
|
|
7912
7968
|
await project.save();
|
|
7913
|
-
console.log(
|
|
7969
|
+
console.log(chalk91.green("Done"));
|
|
7914
7970
|
} else {
|
|
7915
|
-
console.log(
|
|
7971
|
+
console.log(chalk91.dim("Dry run. Use --apply to execute."));
|
|
7916
7972
|
}
|
|
7917
7973
|
}
|
|
7918
7974
|
|
|
7919
7975
|
// src/commands/refactor/renameSymbol/index.ts
|
|
7920
7976
|
import path36 from "path";
|
|
7921
|
-
import
|
|
7977
|
+
import chalk92 from "chalk";
|
|
7922
7978
|
import { Project as Project3 } from "ts-morph";
|
|
7923
7979
|
|
|
7924
7980
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
@@ -7967,38 +8023,38 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
7967
8023
|
const project = new Project3({ tsConfigFilePath: tsConfigPath });
|
|
7968
8024
|
const sourceFile = project.getSourceFile(filePath);
|
|
7969
8025
|
if (!sourceFile) {
|
|
7970
|
-
console.log(
|
|
8026
|
+
console.log(chalk92.red(`File not found in project: ${file}`));
|
|
7971
8027
|
process.exit(1);
|
|
7972
8028
|
}
|
|
7973
8029
|
const symbol = findSymbol(sourceFile, oldName);
|
|
7974
8030
|
if (!symbol) {
|
|
7975
|
-
console.log(
|
|
8031
|
+
console.log(chalk92.red(`Symbol "${oldName}" not found in ${file}`));
|
|
7976
8032
|
process.exit(1);
|
|
7977
8033
|
}
|
|
7978
8034
|
const grouped = groupReferences(symbol, cwd);
|
|
7979
8035
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
7980
8036
|
console.log(
|
|
7981
|
-
|
|
8037
|
+
chalk92.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
7982
8038
|
`)
|
|
7983
8039
|
);
|
|
7984
8040
|
for (const [refFile, lines] of grouped) {
|
|
7985
8041
|
console.log(
|
|
7986
|
-
` ${
|
|
8042
|
+
` ${chalk92.dim(refFile)}: lines ${chalk92.cyan(lines.join(", "))}`
|
|
7987
8043
|
);
|
|
7988
8044
|
}
|
|
7989
8045
|
if (options2.apply) {
|
|
7990
8046
|
symbol.rename(newName);
|
|
7991
8047
|
await project.save();
|
|
7992
|
-
console.log(
|
|
8048
|
+
console.log(chalk92.green(`
|
|
7993
8049
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
7994
8050
|
} else {
|
|
7995
|
-
console.log(
|
|
8051
|
+
console.log(chalk92.dim("\nDry run. Use --apply to execute."));
|
|
7996
8052
|
}
|
|
7997
8053
|
}
|
|
7998
8054
|
|
|
7999
8055
|
// src/commands/refactor/restructure/index.ts
|
|
8000
8056
|
import path45 from "path";
|
|
8001
|
-
import
|
|
8057
|
+
import chalk95 from "chalk";
|
|
8002
8058
|
|
|
8003
8059
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
8004
8060
|
import path37 from "path";
|
|
@@ -8241,50 +8297,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
8241
8297
|
|
|
8242
8298
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
8243
8299
|
import path41 from "path";
|
|
8244
|
-
import
|
|
8300
|
+
import chalk93 from "chalk";
|
|
8245
8301
|
function relPath(filePath) {
|
|
8246
8302
|
return path41.relative(process.cwd(), filePath);
|
|
8247
8303
|
}
|
|
8248
8304
|
function displayMoves(plan2) {
|
|
8249
8305
|
if (plan2.moves.length === 0) return;
|
|
8250
|
-
console.log(
|
|
8306
|
+
console.log(chalk93.bold("\nFile moves:"));
|
|
8251
8307
|
for (const move of plan2.moves) {
|
|
8252
8308
|
console.log(
|
|
8253
|
-
` ${
|
|
8309
|
+
` ${chalk93.red(relPath(move.from))} \u2192 ${chalk93.green(relPath(move.to))}`
|
|
8254
8310
|
);
|
|
8255
|
-
console.log(
|
|
8311
|
+
console.log(chalk93.dim(` ${move.reason}`));
|
|
8256
8312
|
}
|
|
8257
8313
|
}
|
|
8258
8314
|
function displayRewrites(rewrites) {
|
|
8259
8315
|
if (rewrites.length === 0) return;
|
|
8260
8316
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
8261
|
-
console.log(
|
|
8317
|
+
console.log(chalk93.bold(`
|
|
8262
8318
|
Import rewrites (${affectedFiles.size} files):`));
|
|
8263
8319
|
for (const file of affectedFiles) {
|
|
8264
|
-
console.log(` ${
|
|
8320
|
+
console.log(` ${chalk93.cyan(relPath(file))}:`);
|
|
8265
8321
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
8266
8322
|
(r) => r.file === file
|
|
8267
8323
|
)) {
|
|
8268
8324
|
console.log(
|
|
8269
|
-
` ${
|
|
8325
|
+
` ${chalk93.red(`"${oldSpecifier}"`)} \u2192 ${chalk93.green(`"${newSpecifier}"`)}`
|
|
8270
8326
|
);
|
|
8271
8327
|
}
|
|
8272
8328
|
}
|
|
8273
8329
|
}
|
|
8274
8330
|
function displayPlan2(plan2) {
|
|
8275
8331
|
if (plan2.warnings.length > 0) {
|
|
8276
|
-
console.log(
|
|
8277
|
-
for (const w of plan2.warnings) console.log(
|
|
8332
|
+
console.log(chalk93.yellow("\nWarnings:"));
|
|
8333
|
+
for (const w of plan2.warnings) console.log(chalk93.yellow(` ${w}`));
|
|
8278
8334
|
}
|
|
8279
8335
|
if (plan2.newDirectories.length > 0) {
|
|
8280
|
-
console.log(
|
|
8336
|
+
console.log(chalk93.bold("\nNew directories:"));
|
|
8281
8337
|
for (const dir of plan2.newDirectories)
|
|
8282
|
-
console.log(
|
|
8338
|
+
console.log(chalk93.green(` ${dir}/`));
|
|
8283
8339
|
}
|
|
8284
8340
|
displayMoves(plan2);
|
|
8285
8341
|
displayRewrites(plan2.rewrites);
|
|
8286
8342
|
console.log(
|
|
8287
|
-
|
|
8343
|
+
chalk93.dim(
|
|
8288
8344
|
`
|
|
8289
8345
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
8290
8346
|
)
|
|
@@ -8294,18 +8350,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
8294
8350
|
// src/commands/refactor/restructure/executePlan.ts
|
|
8295
8351
|
import fs20 from "fs";
|
|
8296
8352
|
import path42 from "path";
|
|
8297
|
-
import
|
|
8353
|
+
import chalk94 from "chalk";
|
|
8298
8354
|
function executePlan(plan2) {
|
|
8299
8355
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
8300
8356
|
for (const [file, content] of updatedContents) {
|
|
8301
8357
|
fs20.writeFileSync(file, content, "utf-8");
|
|
8302
8358
|
console.log(
|
|
8303
|
-
|
|
8359
|
+
chalk94.cyan(` Rewrote imports in ${path42.relative(process.cwd(), file)}`)
|
|
8304
8360
|
);
|
|
8305
8361
|
}
|
|
8306
8362
|
for (const dir of plan2.newDirectories) {
|
|
8307
8363
|
fs20.mkdirSync(dir, { recursive: true });
|
|
8308
|
-
console.log(
|
|
8364
|
+
console.log(chalk94.green(` Created ${path42.relative(process.cwd(), dir)}/`));
|
|
8309
8365
|
}
|
|
8310
8366
|
for (const move of plan2.moves) {
|
|
8311
8367
|
const targetDir = path42.dirname(move.to);
|
|
@@ -8314,7 +8370,7 @@ function executePlan(plan2) {
|
|
|
8314
8370
|
}
|
|
8315
8371
|
fs20.renameSync(move.from, move.to);
|
|
8316
8372
|
console.log(
|
|
8317
|
-
|
|
8373
|
+
chalk94.white(
|
|
8318
8374
|
` Moved ${path42.relative(process.cwd(), move.from)} \u2192 ${path42.relative(process.cwd(), move.to)}`
|
|
8319
8375
|
)
|
|
8320
8376
|
);
|
|
@@ -8329,7 +8385,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
8329
8385
|
if (entries.length === 0) {
|
|
8330
8386
|
fs20.rmdirSync(dir);
|
|
8331
8387
|
console.log(
|
|
8332
|
-
|
|
8388
|
+
chalk94.dim(
|
|
8333
8389
|
` Removed empty directory ${path42.relative(process.cwd(), dir)}`
|
|
8334
8390
|
)
|
|
8335
8391
|
);
|
|
@@ -8462,22 +8518,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
8462
8518
|
const targetPattern = pattern2 ?? "src";
|
|
8463
8519
|
const files = findSourceFiles2(targetPattern);
|
|
8464
8520
|
if (files.length === 0) {
|
|
8465
|
-
console.log(
|
|
8521
|
+
console.log(chalk95.yellow("No files found matching pattern"));
|
|
8466
8522
|
return;
|
|
8467
8523
|
}
|
|
8468
8524
|
const tsConfigPath = path45.resolve("tsconfig.json");
|
|
8469
8525
|
const plan2 = buildPlan2(files, tsConfigPath);
|
|
8470
8526
|
if (plan2.moves.length === 0) {
|
|
8471
|
-
console.log(
|
|
8527
|
+
console.log(chalk95.green("No restructuring needed"));
|
|
8472
8528
|
return;
|
|
8473
8529
|
}
|
|
8474
8530
|
displayPlan2(plan2);
|
|
8475
8531
|
if (options2.apply) {
|
|
8476
|
-
console.log(
|
|
8532
|
+
console.log(chalk95.bold("\nApplying changes..."));
|
|
8477
8533
|
executePlan(plan2);
|
|
8478
|
-
console.log(
|
|
8534
|
+
console.log(chalk95.green("\nRestructuring complete"));
|
|
8479
8535
|
} else {
|
|
8480
|
-
console.log(
|
|
8536
|
+
console.log(chalk95.dim("\nDry run. Use --apply to execute."));
|
|
8481
8537
|
}
|
|
8482
8538
|
}
|
|
8483
8539
|
|
|
@@ -8517,7 +8573,7 @@ function registerRefactor(program2) {
|
|
|
8517
8573
|
}
|
|
8518
8574
|
|
|
8519
8575
|
// src/commands/seq/seqAuth.ts
|
|
8520
|
-
import
|
|
8576
|
+
import chalk97 from "chalk";
|
|
8521
8577
|
|
|
8522
8578
|
// src/commands/seq/loadConnections.ts
|
|
8523
8579
|
function loadConnections2() {
|
|
@@ -8546,11 +8602,11 @@ function setDefaultConnection(name) {
|
|
|
8546
8602
|
}
|
|
8547
8603
|
|
|
8548
8604
|
// src/commands/seq/promptConnection.ts
|
|
8549
|
-
import
|
|
8605
|
+
import chalk96 from "chalk";
|
|
8550
8606
|
async function promptConnection2(existingNames) {
|
|
8551
8607
|
const name = await promptInput("name", "Connection name:", "default");
|
|
8552
8608
|
if (existingNames.includes(name)) {
|
|
8553
|
-
console.error(
|
|
8609
|
+
console.error(chalk96.red(`Connection "${name}" already exists.`));
|
|
8554
8610
|
process.exit(1);
|
|
8555
8611
|
}
|
|
8556
8612
|
const url = await promptInput("url", "Seq URL:", "http://localhost:5341");
|
|
@@ -8562,32 +8618,32 @@ async function promptConnection2(existingNames) {
|
|
|
8562
8618
|
var seqAuth = createConnectionAuth({
|
|
8563
8619
|
load: loadConnections2,
|
|
8564
8620
|
save: saveConnections2,
|
|
8565
|
-
format: (c) => `${
|
|
8621
|
+
format: (c) => `${chalk97.bold(c.name)} ${c.url}`,
|
|
8566
8622
|
promptNew: promptConnection2,
|
|
8567
8623
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
8568
8624
|
});
|
|
8569
8625
|
|
|
8570
8626
|
// src/commands/seq/seqQuery.ts
|
|
8571
|
-
import
|
|
8627
|
+
import chalk100 from "chalk";
|
|
8572
8628
|
|
|
8573
8629
|
// src/commands/seq/formatEvent.ts
|
|
8574
|
-
import
|
|
8630
|
+
import chalk98 from "chalk";
|
|
8575
8631
|
function levelColor(level) {
|
|
8576
8632
|
switch (level) {
|
|
8577
8633
|
case "Fatal":
|
|
8578
|
-
return
|
|
8634
|
+
return chalk98.bgRed.white;
|
|
8579
8635
|
case "Error":
|
|
8580
|
-
return
|
|
8636
|
+
return chalk98.red;
|
|
8581
8637
|
case "Warning":
|
|
8582
|
-
return
|
|
8638
|
+
return chalk98.yellow;
|
|
8583
8639
|
case "Information":
|
|
8584
|
-
return
|
|
8640
|
+
return chalk98.cyan;
|
|
8585
8641
|
case "Debug":
|
|
8586
|
-
return
|
|
8642
|
+
return chalk98.gray;
|
|
8587
8643
|
case "Verbose":
|
|
8588
|
-
return
|
|
8644
|
+
return chalk98.dim;
|
|
8589
8645
|
default:
|
|
8590
|
-
return
|
|
8646
|
+
return chalk98.white;
|
|
8591
8647
|
}
|
|
8592
8648
|
}
|
|
8593
8649
|
function levelAbbrev(level) {
|
|
@@ -8628,31 +8684,31 @@ function formatTimestamp(iso) {
|
|
|
8628
8684
|
function formatEvent(event) {
|
|
8629
8685
|
const color = levelColor(event.Level);
|
|
8630
8686
|
const abbrev = levelAbbrev(event.Level);
|
|
8631
|
-
const ts8 =
|
|
8687
|
+
const ts8 = chalk98.dim(formatTimestamp(event.Timestamp));
|
|
8632
8688
|
const msg = renderMessage(event);
|
|
8633
8689
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
8634
8690
|
if (event.Exception) {
|
|
8635
8691
|
for (const line of event.Exception.split("\n")) {
|
|
8636
|
-
lines.push(
|
|
8692
|
+
lines.push(chalk98.red(` ${line}`));
|
|
8637
8693
|
}
|
|
8638
8694
|
}
|
|
8639
8695
|
return lines.join("\n");
|
|
8640
8696
|
}
|
|
8641
8697
|
|
|
8642
8698
|
// src/commands/seq/resolveConnection.ts
|
|
8643
|
-
import
|
|
8699
|
+
import chalk99 from "chalk";
|
|
8644
8700
|
function resolveConnection2(name) {
|
|
8645
8701
|
const connections = loadConnections2();
|
|
8646
8702
|
if (connections.length === 0) {
|
|
8647
8703
|
console.error(
|
|
8648
|
-
|
|
8704
|
+
chalk99.red("No Seq connections configured. Run 'assist seq auth' first.")
|
|
8649
8705
|
);
|
|
8650
8706
|
process.exit(1);
|
|
8651
8707
|
}
|
|
8652
8708
|
const target = name ?? getDefaultConnection() ?? connections[0].name;
|
|
8653
8709
|
const connection = connections.find((c) => c.name === target);
|
|
8654
8710
|
if (!connection) {
|
|
8655
|
-
console.error(
|
|
8711
|
+
console.error(chalk99.red(`Seq connection "${target}" not found.`));
|
|
8656
8712
|
process.exit(1);
|
|
8657
8713
|
}
|
|
8658
8714
|
return connection;
|
|
@@ -8672,12 +8728,12 @@ async function seqQuery(filter, options2) {
|
|
|
8672
8728
|
});
|
|
8673
8729
|
if (!response.ok) {
|
|
8674
8730
|
const body = await response.text();
|
|
8675
|
-
console.error(
|
|
8731
|
+
console.error(chalk100.red(`Seq returned ${response.status}: ${body}`));
|
|
8676
8732
|
process.exit(1);
|
|
8677
8733
|
}
|
|
8678
8734
|
const events = await response.json();
|
|
8679
8735
|
if (events.length === 0) {
|
|
8680
|
-
console.log(
|
|
8736
|
+
console.log(chalk100.yellow("No events found."));
|
|
8681
8737
|
return;
|
|
8682
8738
|
}
|
|
8683
8739
|
if (options2.json) {
|
|
@@ -8688,11 +8744,11 @@ async function seqQuery(filter, options2) {
|
|
|
8688
8744
|
for (const event of chronological) {
|
|
8689
8745
|
console.log(formatEvent(event));
|
|
8690
8746
|
}
|
|
8691
|
-
console.log(
|
|
8747
|
+
console.log(chalk100.dim(`
|
|
8692
8748
|
${events.length} events`));
|
|
8693
8749
|
if (events.length >= count) {
|
|
8694
8750
|
console.log(
|
|
8695
|
-
|
|
8751
|
+
chalk100.yellow(
|
|
8696
8752
|
`Results limited to ${count}. Use --count to retrieve more.`
|
|
8697
8753
|
)
|
|
8698
8754
|
);
|
|
@@ -8700,11 +8756,11 @@ ${events.length} events`));
|
|
|
8700
8756
|
}
|
|
8701
8757
|
|
|
8702
8758
|
// src/commands/seq/seqSetConnection.ts
|
|
8703
|
-
import
|
|
8759
|
+
import chalk101 from "chalk";
|
|
8704
8760
|
function seqSetConnection(name) {
|
|
8705
8761
|
const connections = loadConnections2();
|
|
8706
8762
|
if (!connections.find((c) => c.name === name)) {
|
|
8707
|
-
console.error(
|
|
8763
|
+
console.error(chalk101.red(`Connection "${name}" not found.`));
|
|
8708
8764
|
process.exit(1);
|
|
8709
8765
|
}
|
|
8710
8766
|
setDefaultConnection(name);
|
|
@@ -9243,14 +9299,14 @@ import {
|
|
|
9243
9299
|
import { dirname as dirname20, join as join29 } from "path";
|
|
9244
9300
|
|
|
9245
9301
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
9246
|
-
import
|
|
9302
|
+
import chalk102 from "chalk";
|
|
9247
9303
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
9248
9304
|
function validateStagedContent(filename, content) {
|
|
9249
9305
|
const firstLine = content.split("\n")[0];
|
|
9250
9306
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
9251
9307
|
if (!match) {
|
|
9252
9308
|
console.error(
|
|
9253
|
-
|
|
9309
|
+
chalk102.red(
|
|
9254
9310
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
9255
9311
|
)
|
|
9256
9312
|
);
|
|
@@ -9259,7 +9315,7 @@ function validateStagedContent(filename, content) {
|
|
|
9259
9315
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
9260
9316
|
if (!contentAfterLink) {
|
|
9261
9317
|
console.error(
|
|
9262
|
-
|
|
9318
|
+
chalk102.red(
|
|
9263
9319
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
9264
9320
|
)
|
|
9265
9321
|
);
|
|
@@ -9652,7 +9708,7 @@ function registerVoice(program2) {
|
|
|
9652
9708
|
|
|
9653
9709
|
// src/commands/roam/auth.ts
|
|
9654
9710
|
import { randomBytes } from "crypto";
|
|
9655
|
-
import
|
|
9711
|
+
import chalk103 from "chalk";
|
|
9656
9712
|
|
|
9657
9713
|
// src/lib/openBrowser.ts
|
|
9658
9714
|
import { execSync as execSync37 } from "child_process";
|
|
@@ -9827,13 +9883,13 @@ async function auth() {
|
|
|
9827
9883
|
saveGlobalConfig(config);
|
|
9828
9884
|
const state = randomBytes(16).toString("hex");
|
|
9829
9885
|
console.log(
|
|
9830
|
-
|
|
9886
|
+
chalk103.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
9831
9887
|
);
|
|
9832
|
-
console.log(
|
|
9833
|
-
console.log(
|
|
9834
|
-
console.log(
|
|
9888
|
+
console.log(chalk103.white("http://localhost:14523/callback\n"));
|
|
9889
|
+
console.log(chalk103.blue("Opening browser for authorization..."));
|
|
9890
|
+
console.log(chalk103.dim("Waiting for authorization callback..."));
|
|
9835
9891
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
9836
|
-
console.log(
|
|
9892
|
+
console.log(chalk103.dim("Exchanging code for tokens..."));
|
|
9837
9893
|
const tokens = await exchangeToken({
|
|
9838
9894
|
code,
|
|
9839
9895
|
clientId,
|
|
@@ -9849,7 +9905,7 @@ async function auth() {
|
|
|
9849
9905
|
};
|
|
9850
9906
|
saveGlobalConfig(config);
|
|
9851
9907
|
console.log(
|
|
9852
|
-
|
|
9908
|
+
chalk103.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
9853
9909
|
);
|
|
9854
9910
|
}
|
|
9855
9911
|
|
|
@@ -10070,7 +10126,7 @@ import { execSync as execSync39 } from "child_process";
|
|
|
10070
10126
|
import { existsSync as existsSync38, mkdirSync as mkdirSync13, unlinkSync as unlinkSync10, writeFileSync as writeFileSync27 } from "fs";
|
|
10071
10127
|
import { tmpdir as tmpdir6 } from "os";
|
|
10072
10128
|
import { join as join38, resolve as resolve5 } from "path";
|
|
10073
|
-
import
|
|
10129
|
+
import chalk104 from "chalk";
|
|
10074
10130
|
|
|
10075
10131
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
10076
10132
|
var captureWindowPs1 = `
|
|
@@ -10221,22 +10277,22 @@ function screenshot(processName) {
|
|
|
10221
10277
|
const config = loadConfig();
|
|
10222
10278
|
const outputDir = resolve5(config.screenshot.outputDir);
|
|
10223
10279
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
10224
|
-
console.log(
|
|
10280
|
+
console.log(chalk104.gray(`Capturing window for process "${processName}" ...`));
|
|
10225
10281
|
try {
|
|
10226
10282
|
runPowerShellScript(processName, outputPath);
|
|
10227
|
-
console.log(
|
|
10283
|
+
console.log(chalk104.green(`Screenshot saved: ${outputPath}`));
|
|
10228
10284
|
} catch (error) {
|
|
10229
10285
|
const msg = error instanceof Error ? error.message : String(error);
|
|
10230
|
-
console.error(
|
|
10286
|
+
console.error(chalk104.red(`Failed to capture screenshot: ${msg}`));
|
|
10231
10287
|
process.exit(1);
|
|
10232
10288
|
}
|
|
10233
10289
|
}
|
|
10234
10290
|
|
|
10235
10291
|
// src/commands/statusLine.ts
|
|
10236
|
-
import
|
|
10292
|
+
import chalk106 from "chalk";
|
|
10237
10293
|
|
|
10238
10294
|
// src/commands/buildLimitsSegment.ts
|
|
10239
|
-
import
|
|
10295
|
+
import chalk105 from "chalk";
|
|
10240
10296
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
10241
10297
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
10242
10298
|
function formatTimeLeft(resetsAt) {
|
|
@@ -10259,10 +10315,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
10259
10315
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
10260
10316
|
const label2 = `${Math.round(pct)}%`;
|
|
10261
10317
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
10262
|
-
if (projected == null) return
|
|
10263
|
-
if (projected > 100) return
|
|
10264
|
-
if (projected > 75) return
|
|
10265
|
-
return
|
|
10318
|
+
if (projected == null) return chalk105.green(label2);
|
|
10319
|
+
if (projected > 100) return chalk105.red(label2);
|
|
10320
|
+
if (projected > 75) return chalk105.yellow(label2);
|
|
10321
|
+
return chalk105.green(label2);
|
|
10266
10322
|
}
|
|
10267
10323
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
10268
10324
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -10288,14 +10344,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
10288
10344
|
}
|
|
10289
10345
|
|
|
10290
10346
|
// src/commands/statusLine.ts
|
|
10291
|
-
|
|
10347
|
+
chalk106.level = 3;
|
|
10292
10348
|
function formatNumber(num) {
|
|
10293
10349
|
return num.toLocaleString("en-US");
|
|
10294
10350
|
}
|
|
10295
10351
|
function colorizePercent(pct) {
|
|
10296
10352
|
const label2 = `${Math.round(pct)}%`;
|
|
10297
|
-
if (pct > 80) return
|
|
10298
|
-
if (pct > 40) return
|
|
10353
|
+
if (pct > 80) return chalk106.red(label2);
|
|
10354
|
+
if (pct > 40) return chalk106.yellow(label2);
|
|
10299
10355
|
return label2;
|
|
10300
10356
|
}
|
|
10301
10357
|
async function statusLine() {
|
|
@@ -10318,7 +10374,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
10318
10374
|
// src/commands/sync/syncClaudeMd.ts
|
|
10319
10375
|
import * as fs23 from "fs";
|
|
10320
10376
|
import * as path46 from "path";
|
|
10321
|
-
import
|
|
10377
|
+
import chalk107 from "chalk";
|
|
10322
10378
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
10323
10379
|
const source = path46.join(claudeDir, "CLAUDE.md");
|
|
10324
10380
|
const target = path46.join(targetBase, "CLAUDE.md");
|
|
@@ -10327,12 +10383,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
10327
10383
|
const targetContent = fs23.readFileSync(target, "utf-8");
|
|
10328
10384
|
if (sourceContent !== targetContent) {
|
|
10329
10385
|
console.log(
|
|
10330
|
-
|
|
10386
|
+
chalk107.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
10331
10387
|
);
|
|
10332
10388
|
console.log();
|
|
10333
10389
|
printDiff(targetContent, sourceContent);
|
|
10334
10390
|
const confirm = options2?.yes || await promptConfirm(
|
|
10335
|
-
|
|
10391
|
+
chalk107.red("Overwrite existing CLAUDE.md?"),
|
|
10336
10392
|
false
|
|
10337
10393
|
);
|
|
10338
10394
|
if (!confirm) {
|
|
@@ -10348,7 +10404,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
10348
10404
|
// src/commands/sync/syncSettings.ts
|
|
10349
10405
|
import * as fs24 from "fs";
|
|
10350
10406
|
import * as path47 from "path";
|
|
10351
|
-
import
|
|
10407
|
+
import chalk108 from "chalk";
|
|
10352
10408
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
10353
10409
|
const source = path47.join(claudeDir, "settings.json");
|
|
10354
10410
|
const target = path47.join(targetBase, "settings.json");
|
|
@@ -10364,14 +10420,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
10364
10420
|
if (mergedContent !== normalizedTarget) {
|
|
10365
10421
|
if (!options2?.yes) {
|
|
10366
10422
|
console.log(
|
|
10367
|
-
|
|
10423
|
+
chalk108.yellow(
|
|
10368
10424
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
10369
10425
|
)
|
|
10370
10426
|
);
|
|
10371
10427
|
console.log();
|
|
10372
10428
|
printDiff(targetContent, mergedContent);
|
|
10373
10429
|
const confirm = await promptConfirm(
|
|
10374
|
-
|
|
10430
|
+
chalk108.red("Overwrite existing settings.json?"),
|
|
10375
10431
|
false
|
|
10376
10432
|
);
|
|
10377
10433
|
if (!confirm) {
|