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