@staff0rd/assist 0.167.0 → 0.169.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +597 -440
- 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.169.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -126,6 +126,11 @@ var backlogCommentSchema = z.strictObject({
|
|
|
126
126
|
timestamp: z.string(),
|
|
127
127
|
type: backlogCommentTypeSchema
|
|
128
128
|
});
|
|
129
|
+
var backlogLinkTypeSchema = z.enum(["relates-to", "depends-on"]);
|
|
130
|
+
var backlogLinkSchema = z.strictObject({
|
|
131
|
+
type: backlogLinkTypeSchema,
|
|
132
|
+
targetId: z.number()
|
|
133
|
+
});
|
|
129
134
|
var backlogItemSchema = z.strictObject({
|
|
130
135
|
id: z.number(),
|
|
131
136
|
type: backlogTypeSchema.default("story"),
|
|
@@ -135,7 +140,8 @@ var backlogItemSchema = z.strictObject({
|
|
|
135
140
|
plan: z.array(planPhaseSchema).optional(),
|
|
136
141
|
currentPhase: z.number().optional(),
|
|
137
142
|
status: backlogStatusSchema,
|
|
138
|
-
comments: z.array(backlogCommentSchema).optional()
|
|
143
|
+
comments: z.array(backlogCommentSchema).optional(),
|
|
144
|
+
links: z.array(backlogLinkSchema).optional()
|
|
139
145
|
});
|
|
140
146
|
var backlogFileSchema = z.array(backlogItemSchema);
|
|
141
147
|
|
|
@@ -274,6 +280,11 @@ function phaseLabel(item) {
|
|
|
274
280
|
` (phase ${(item.currentPhase ?? 0) + 1}/${item.plan.length})`
|
|
275
281
|
);
|
|
276
282
|
}
|
|
283
|
+
function dependencyLabel(item) {
|
|
284
|
+
const deps2 = (item.links ?? []).filter((l) => l.type === "depends-on");
|
|
285
|
+
if (deps2.length === 0) return "";
|
|
286
|
+
return chalk2.dim(` [${deps2.length} dep${deps2.length > 1 ? "s" : ""}]`);
|
|
287
|
+
}
|
|
277
288
|
function printVerboseDetails(item) {
|
|
278
289
|
if (item.description) {
|
|
279
290
|
console.log(` ${chalk2.dim("Description:")} ${item.description}`);
|
|
@@ -743,7 +754,7 @@ function plan(id) {
|
|
|
743
754
|
}
|
|
744
755
|
|
|
745
756
|
// src/commands/backlog/show/index.ts
|
|
746
|
-
import
|
|
757
|
+
import chalk13 from "chalk";
|
|
747
758
|
|
|
748
759
|
// src/commands/backlog/formatComment.ts
|
|
749
760
|
import chalk10 from "chalk";
|
|
@@ -755,49 +766,74 @@ function formatComment(entry) {
|
|
|
755
766
|
${entry.text}`;
|
|
756
767
|
}
|
|
757
768
|
|
|
758
|
-
// src/commands/backlog/show/
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
769
|
+
// src/commands/backlog/show/printLinks.ts
|
|
770
|
+
import chalk11 from "chalk";
|
|
771
|
+
function printLinks(item, items) {
|
|
772
|
+
const links = item.links ?? [];
|
|
773
|
+
if (links.length === 0) return;
|
|
774
|
+
console.log(chalk11.bold("Links"));
|
|
775
|
+
for (const link2 of links) {
|
|
776
|
+
const target = items.find((i) => i.id === link2.targetId);
|
|
777
|
+
const typeLabel2 = link2.type === "depends-on" ? chalk11.red("depends-on") : chalk11.blue("relates-to");
|
|
778
|
+
if (target) {
|
|
779
|
+
console.log(
|
|
780
|
+
` ${typeLabel2} #${target.id} ${target.name} ${chalk11.dim(`(${target.status})`)}`
|
|
781
|
+
);
|
|
782
|
+
} else {
|
|
783
|
+
console.log(
|
|
784
|
+
` ${typeLabel2} #${link2.targetId} ${chalk11.dim("(not found)")}`
|
|
785
|
+
);
|
|
786
|
+
}
|
|
765
787
|
}
|
|
766
788
|
console.log();
|
|
767
789
|
}
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
return `${marker}${label2}`;
|
|
772
|
-
}
|
|
790
|
+
|
|
791
|
+
// src/commands/backlog/show/printPhaseTasks.ts
|
|
792
|
+
import chalk12 from "chalk";
|
|
773
793
|
function printPhaseTasks(phase) {
|
|
774
794
|
for (const task of phase.tasks) {
|
|
775
795
|
console.log(` - ${task.task}`);
|
|
776
796
|
if (task.verify) {
|
|
777
|
-
console.log(` ${
|
|
797
|
+
console.log(` ${chalk12.dim(`verify: ${task.verify}`)}`);
|
|
778
798
|
}
|
|
779
799
|
}
|
|
780
800
|
if (phase.manualChecks && phase.manualChecks.length > 0) {
|
|
781
|
-
console.log(` ${
|
|
801
|
+
console.log(` ${chalk12.dim("Manual checks:")}`);
|
|
782
802
|
for (const check2 of phase.manualChecks) {
|
|
783
|
-
console.log(` ${
|
|
803
|
+
console.log(` ${chalk12.dim(`- ${check2}`)}`);
|
|
784
804
|
}
|
|
785
805
|
}
|
|
786
806
|
}
|
|
807
|
+
|
|
808
|
+
// src/commands/backlog/show/index.ts
|
|
809
|
+
function printPlan(item) {
|
|
810
|
+
if (!item.plan || item.plan.length === 0) return;
|
|
811
|
+
console.log(chalk13.bold("Plan"));
|
|
812
|
+
for (const [i, phase] of item.plan.entries()) {
|
|
813
|
+
const isCurrent = item.currentPhase === i;
|
|
814
|
+
printPhase(phase, i, isCurrent);
|
|
815
|
+
}
|
|
816
|
+
console.log();
|
|
817
|
+
}
|
|
818
|
+
function phaseHeader(index, name, isCurrent) {
|
|
819
|
+
const marker = isCurrent ? chalk13.green("\u25B6 ") : " ";
|
|
820
|
+
const label2 = isCurrent ? chalk13.green.bold(`Phase ${index + 1}: ${name}`) : `${chalk13.bold(`Phase ${index + 1}:`)} ${name}`;
|
|
821
|
+
return `${marker}${label2}`;
|
|
822
|
+
}
|
|
787
823
|
function printPhase(phase, index, isCurrent) {
|
|
788
824
|
console.log(phaseHeader(index, phase.name, isCurrent));
|
|
789
825
|
printPhaseTasks(phase);
|
|
790
826
|
}
|
|
791
827
|
function printHeader(item) {
|
|
792
|
-
console.log(
|
|
828
|
+
console.log(chalk13.bold(`#${item.id} ${item.name}`));
|
|
793
829
|
console.log(
|
|
794
|
-
`${
|
|
830
|
+
`${chalk13.dim("Type:")} ${item.type} ${chalk13.dim("Status:")} ${item.status}`
|
|
795
831
|
);
|
|
796
832
|
console.log();
|
|
797
833
|
}
|
|
798
834
|
function printAcceptanceCriteria(criteria) {
|
|
799
835
|
if (criteria.length === 0) return;
|
|
800
|
-
console.log(
|
|
836
|
+
console.log(chalk13.bold("Acceptance Criteria"));
|
|
801
837
|
for (const [i, ac] of criteria.entries()) {
|
|
802
838
|
console.log(` ${i + 1}. ${ac}`);
|
|
803
839
|
}
|
|
@@ -806,21 +842,22 @@ function printAcceptanceCriteria(criteria) {
|
|
|
806
842
|
function show(id) {
|
|
807
843
|
const result = loadAndFindItem(id);
|
|
808
844
|
if (!result) process.exit(1);
|
|
809
|
-
const { item } = result;
|
|
845
|
+
const { item, items } = result;
|
|
810
846
|
printHeader(item);
|
|
811
847
|
if (item.description) {
|
|
812
|
-
console.log(
|
|
848
|
+
console.log(chalk13.bold("Description"));
|
|
813
849
|
console.log(item.description);
|
|
814
850
|
console.log();
|
|
815
851
|
}
|
|
816
852
|
printAcceptanceCriteria(item.acceptanceCriteria);
|
|
853
|
+
printLinks(item, items);
|
|
817
854
|
printPlan(item);
|
|
818
855
|
printComments(item);
|
|
819
856
|
}
|
|
820
857
|
function printComments(item) {
|
|
821
858
|
const entries = item.comments ?? [];
|
|
822
859
|
if (entries.length === 0) return;
|
|
823
|
-
console.log(
|
|
860
|
+
console.log(chalk13.bold("Comments"));
|
|
824
861
|
for (const entry of entries) {
|
|
825
862
|
console.log(` ${formatComment(entry)}`);
|
|
826
863
|
}
|
|
@@ -835,7 +872,7 @@ import {
|
|
|
835
872
|
} from "http";
|
|
836
873
|
import { dirname, join as join4 } from "path";
|
|
837
874
|
import { fileURLToPath } from "url";
|
|
838
|
-
import
|
|
875
|
+
import chalk14 from "chalk";
|
|
839
876
|
function respondJson(res, status2, data) {
|
|
840
877
|
res.writeHead(status2, { "Content-Type": "application/json" });
|
|
841
878
|
res.end(JSON.stringify(data));
|
|
@@ -879,8 +916,8 @@ function startWebServer(label2, port, handler) {
|
|
|
879
916
|
handler(req, res, port);
|
|
880
917
|
});
|
|
881
918
|
server.listen(port, () => {
|
|
882
|
-
console.log(
|
|
883
|
-
console.log(
|
|
919
|
+
console.log(chalk14.green(`${label2}: ${url}`));
|
|
920
|
+
console.log(chalk14.dim("Press Ctrl+C to stop"));
|
|
884
921
|
exec(`open ${url}`);
|
|
885
922
|
});
|
|
886
923
|
}
|
|
@@ -1028,17 +1065,17 @@ async function web(options2) {
|
|
|
1028
1065
|
}
|
|
1029
1066
|
|
|
1030
1067
|
// src/commands/backlog/launchMode.ts
|
|
1031
|
-
import
|
|
1068
|
+
import chalk15 from "chalk";
|
|
1032
1069
|
async function launchMode(slashCommand) {
|
|
1033
1070
|
process.env.ASSIST_SESSION_ID = String(process.pid);
|
|
1034
|
-
const { child, done: done2 } = spawnClaude(`/${slashCommand}
|
|
1071
|
+
const { child, done: done2 } = spawnClaude(`/${slashCommand}`, { allowEdits: true });
|
|
1035
1072
|
watchForMarker(child);
|
|
1036
1073
|
await done2;
|
|
1037
1074
|
stopWatching();
|
|
1038
1075
|
const signal = readSignal();
|
|
1039
1076
|
cleanupSignal();
|
|
1040
1077
|
if (signal?.event === "next") {
|
|
1041
|
-
console.log(
|
|
1078
|
+
console.log(chalk15.bold("\nChaining into assist next...\n"));
|
|
1042
1079
|
await next({ allowEdits: true });
|
|
1043
1080
|
}
|
|
1044
1081
|
}
|
|
@@ -1050,7 +1087,7 @@ import { execSync } from "child_process";
|
|
|
1050
1087
|
import { existsSync as existsSync7, readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "fs";
|
|
1051
1088
|
import { homedir } from "os";
|
|
1052
1089
|
import { basename, dirname as dirname2, join as join5 } from "path";
|
|
1053
|
-
import
|
|
1090
|
+
import chalk16 from "chalk";
|
|
1054
1091
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
1055
1092
|
|
|
1056
1093
|
// src/shared/loadRawYaml.ts
|
|
@@ -1246,7 +1283,7 @@ function getTranscriptConfig() {
|
|
|
1246
1283
|
const config = loadConfig();
|
|
1247
1284
|
if (!config.transcript) {
|
|
1248
1285
|
console.error(
|
|
1249
|
-
|
|
1286
|
+
chalk16.red(
|
|
1250
1287
|
"Transcript directories not configured. Run 'assist transcript configure' first."
|
|
1251
1288
|
)
|
|
1252
1289
|
);
|
|
@@ -1335,7 +1372,7 @@ function commit(args) {
|
|
|
1335
1372
|
}
|
|
1336
1373
|
|
|
1337
1374
|
// src/commands/config/index.ts
|
|
1338
|
-
import
|
|
1375
|
+
import chalk17 from "chalk";
|
|
1339
1376
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
1340
1377
|
|
|
1341
1378
|
// src/commands/config/setNestedValue.ts
|
|
@@ -1398,7 +1435,7 @@ function formatIssuePath(issue, key) {
|
|
|
1398
1435
|
function printValidationErrors(issues, key) {
|
|
1399
1436
|
for (const issue of issues) {
|
|
1400
1437
|
console.error(
|
|
1401
|
-
|
|
1438
|
+
chalk17.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
1402
1439
|
);
|
|
1403
1440
|
}
|
|
1404
1441
|
}
|
|
@@ -1415,7 +1452,7 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
1415
1452
|
function assertNotGlobalOnly(key, global) {
|
|
1416
1453
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
1417
1454
|
console.error(
|
|
1418
|
-
|
|
1455
|
+
chalk17.red(
|
|
1419
1456
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
1420
1457
|
)
|
|
1421
1458
|
);
|
|
@@ -1438,7 +1475,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
1438
1475
|
applyConfigSet(key, coerced, options2.global ?? false);
|
|
1439
1476
|
const target = options2.global ? "global" : "project";
|
|
1440
1477
|
console.log(
|
|
1441
|
-
|
|
1478
|
+
chalk17.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
1442
1479
|
);
|
|
1443
1480
|
}
|
|
1444
1481
|
function configList() {
|
|
@@ -1447,7 +1484,7 @@ function configList() {
|
|
|
1447
1484
|
}
|
|
1448
1485
|
|
|
1449
1486
|
// src/commands/config/configGet.ts
|
|
1450
|
-
import
|
|
1487
|
+
import chalk18 from "chalk";
|
|
1451
1488
|
|
|
1452
1489
|
// src/commands/config/getNestedValue.ts
|
|
1453
1490
|
function isTraversable(value) {
|
|
@@ -1479,7 +1516,7 @@ function requireNestedValue(config, key) {
|
|
|
1479
1516
|
return value;
|
|
1480
1517
|
}
|
|
1481
1518
|
function exitKeyNotSet(key) {
|
|
1482
|
-
console.error(
|
|
1519
|
+
console.error(chalk18.red(`Key "${key}" is not set`));
|
|
1483
1520
|
process.exit(1);
|
|
1484
1521
|
}
|
|
1485
1522
|
|
|
@@ -1499,10 +1536,10 @@ function coverage() {
|
|
|
1499
1536
|
}
|
|
1500
1537
|
|
|
1501
1538
|
// src/commands/verify/init/index.ts
|
|
1502
|
-
import
|
|
1539
|
+
import chalk33 from "chalk";
|
|
1503
1540
|
|
|
1504
1541
|
// src/shared/promptMultiselect.ts
|
|
1505
|
-
import
|
|
1542
|
+
import chalk19 from "chalk";
|
|
1506
1543
|
import enquirer3 from "enquirer";
|
|
1507
1544
|
async function promptMultiselect(message, options2) {
|
|
1508
1545
|
const { selected } = await exitOnCancel(
|
|
@@ -1512,7 +1549,7 @@ async function promptMultiselect(message, options2) {
|
|
|
1512
1549
|
message,
|
|
1513
1550
|
choices: options2.map((opt) => ({
|
|
1514
1551
|
name: opt.value,
|
|
1515
|
-
message: `${opt.name} - ${
|
|
1552
|
+
message: `${opt.name} - ${chalk19.dim(opt.description)}`
|
|
1516
1553
|
})),
|
|
1517
1554
|
// @ts-expect-error - enquirer types don't include symbols but it's supported
|
|
1518
1555
|
symbols: {
|
|
@@ -1529,7 +1566,7 @@ async function promptMultiselect(message, options2) {
|
|
|
1529
1566
|
// src/shared/readPackageJson.ts
|
|
1530
1567
|
import * as fs from "fs";
|
|
1531
1568
|
import * as path from "path";
|
|
1532
|
-
import
|
|
1569
|
+
import chalk20 from "chalk";
|
|
1533
1570
|
function findPackageJson() {
|
|
1534
1571
|
const packageJsonPath = path.join(process.cwd(), "package.json");
|
|
1535
1572
|
if (fs.existsSync(packageJsonPath)) {
|
|
@@ -1543,7 +1580,7 @@ function readPackageJson(filePath) {
|
|
|
1543
1580
|
function requirePackageJson() {
|
|
1544
1581
|
const packageJsonPath = findPackageJson();
|
|
1545
1582
|
if (!packageJsonPath) {
|
|
1546
|
-
console.error(
|
|
1583
|
+
console.error(chalk20.red("No package.json found in current directory"));
|
|
1547
1584
|
process.exit(1);
|
|
1548
1585
|
}
|
|
1549
1586
|
const pkg = readPackageJson(packageJsonPath);
|
|
@@ -1574,7 +1611,7 @@ function findPackageJsonWithVerifyScripts(startDir) {
|
|
|
1574
1611
|
// src/commands/verify/installPackage.ts
|
|
1575
1612
|
import { execSync as execSync3 } from "child_process";
|
|
1576
1613
|
import { writeFileSync as writeFileSync5 } from "fs";
|
|
1577
|
-
import
|
|
1614
|
+
import chalk21 from "chalk";
|
|
1578
1615
|
function writePackageJson(filePath, pkg) {
|
|
1579
1616
|
writeFileSync5(filePath, `${JSON.stringify(pkg, null, 2)}
|
|
1580
1617
|
`);
|
|
@@ -1589,12 +1626,12 @@ function addScript(pkg, name, command) {
|
|
|
1589
1626
|
};
|
|
1590
1627
|
}
|
|
1591
1628
|
function installPackage(name, cwd) {
|
|
1592
|
-
console.log(
|
|
1629
|
+
console.log(chalk21.dim(`Installing ${name}...`));
|
|
1593
1630
|
try {
|
|
1594
1631
|
execSync3(`npm install -D ${name}`, { stdio: "inherit", cwd });
|
|
1595
1632
|
return true;
|
|
1596
1633
|
} catch {
|
|
1597
|
-
console.error(
|
|
1634
|
+
console.error(chalk21.red(`Failed to install ${name}`));
|
|
1598
1635
|
return false;
|
|
1599
1636
|
}
|
|
1600
1637
|
}
|
|
@@ -1641,9 +1678,9 @@ var expectedScripts = {
|
|
|
1641
1678
|
};
|
|
1642
1679
|
|
|
1643
1680
|
// src/commands/verify/setup/setupBuild.ts
|
|
1644
|
-
import
|
|
1681
|
+
import chalk22 from "chalk";
|
|
1645
1682
|
async function setupBuild(_packageJsonPath, writer, hasVite, hasTypescript) {
|
|
1646
|
-
console.log(
|
|
1683
|
+
console.log(chalk22.blue("\nSetting up build verification..."));
|
|
1647
1684
|
let command;
|
|
1648
1685
|
if (hasVite && hasTypescript) {
|
|
1649
1686
|
command = "tsc -b && vite build --logLevel error";
|
|
@@ -1652,21 +1689,21 @@ async function setupBuild(_packageJsonPath, writer, hasVite, hasTypescript) {
|
|
|
1652
1689
|
} else {
|
|
1653
1690
|
command = "npm run build";
|
|
1654
1691
|
}
|
|
1655
|
-
console.log(
|
|
1692
|
+
console.log(chalk22.dim(`Using: ${command}`));
|
|
1656
1693
|
writer("verify:build", command);
|
|
1657
1694
|
}
|
|
1658
1695
|
async function setupTypecheck(_packageJsonPath, writer) {
|
|
1659
|
-
console.log(
|
|
1696
|
+
console.log(chalk22.blue("\nSetting up typecheck verification..."));
|
|
1660
1697
|
const command = "tsc --noEmit";
|
|
1661
|
-
console.log(
|
|
1698
|
+
console.log(chalk22.dim(`Using: ${command}`));
|
|
1662
1699
|
writer("verify:typecheck", command);
|
|
1663
1700
|
}
|
|
1664
1701
|
|
|
1665
1702
|
// src/commands/verify/setup/setupDuplicateCode.ts
|
|
1666
1703
|
import * as path2 from "path";
|
|
1667
|
-
import
|
|
1704
|
+
import chalk23 from "chalk";
|
|
1668
1705
|
async function setupDuplicateCode(packageJsonPath, writer) {
|
|
1669
|
-
console.log(
|
|
1706
|
+
console.log(chalk23.blue("\nSetting up jscpd..."));
|
|
1670
1707
|
const cwd = path2.dirname(packageJsonPath);
|
|
1671
1708
|
const pkg = readPackageJson(packageJsonPath);
|
|
1672
1709
|
const hasJscpd = !!pkg.dependencies?.jscpd || !!pkg.devDependencies?.jscpd;
|
|
@@ -1678,12 +1715,12 @@ async function setupDuplicateCode(packageJsonPath, writer) {
|
|
|
1678
1715
|
|
|
1679
1716
|
// src/commands/verify/setup/setupHardcodedColors.ts
|
|
1680
1717
|
import * as path3 from "path";
|
|
1681
|
-
import
|
|
1718
|
+
import chalk25 from "chalk";
|
|
1682
1719
|
|
|
1683
1720
|
// src/commands/verify/addToKnipIgnoreBinaries.ts
|
|
1684
1721
|
import { existsSync as existsSync9, readFileSync as readFileSync8, writeFileSync as writeFileSync6 } from "fs";
|
|
1685
1722
|
import { join as join7 } from "path";
|
|
1686
|
-
import
|
|
1723
|
+
import chalk24 from "chalk";
|
|
1687
1724
|
function loadKnipConfig(knipJsonPath) {
|
|
1688
1725
|
if (existsSync9(knipJsonPath)) {
|
|
1689
1726
|
return JSON.parse(readFileSync8(knipJsonPath, "utf-8"));
|
|
@@ -1702,16 +1739,16 @@ function addToKnipIgnoreBinaries(cwd, binary) {
|
|
|
1702
1739
|
`${JSON.stringify(knipConfig, null, " ")}
|
|
1703
1740
|
`
|
|
1704
1741
|
);
|
|
1705
|
-
console.log(
|
|
1742
|
+
console.log(chalk24.dim(`Added '${binary}' to knip.json ignoreBinaries`));
|
|
1706
1743
|
}
|
|
1707
1744
|
} catch {
|
|
1708
|
-
console.log(
|
|
1745
|
+
console.log(chalk24.yellow("Warning: Could not update knip.json"));
|
|
1709
1746
|
}
|
|
1710
1747
|
}
|
|
1711
1748
|
|
|
1712
1749
|
// src/commands/verify/setup/setupHardcodedColors.ts
|
|
1713
1750
|
async function setupHardcodedColors(packageJsonPath, writer, hasOpenColor) {
|
|
1714
|
-
console.log(
|
|
1751
|
+
console.log(chalk25.blue("\nSetting up hardcoded colors check..."));
|
|
1715
1752
|
const cwd = path3.dirname(packageJsonPath);
|
|
1716
1753
|
if (!hasOpenColor) {
|
|
1717
1754
|
installPackage("open-color", cwd);
|
|
@@ -1722,9 +1759,9 @@ async function setupHardcodedColors(packageJsonPath, writer, hasOpenColor) {
|
|
|
1722
1759
|
|
|
1723
1760
|
// src/commands/verify/setup/setupKnip.ts
|
|
1724
1761
|
import * as path4 from "path";
|
|
1725
|
-
import
|
|
1762
|
+
import chalk26 from "chalk";
|
|
1726
1763
|
async function setupKnip(packageJsonPath, writer) {
|
|
1727
|
-
console.log(
|
|
1764
|
+
console.log(chalk26.blue("\nSetting up knip..."));
|
|
1728
1765
|
const cwd = path4.dirname(packageJsonPath);
|
|
1729
1766
|
const pkg = readPackageJson(packageJsonPath);
|
|
1730
1767
|
if (!pkg.devDependencies?.knip && !installPackage("knip", cwd)) {
|
|
@@ -1735,14 +1772,14 @@ async function setupKnip(packageJsonPath, writer) {
|
|
|
1735
1772
|
|
|
1736
1773
|
// src/commands/verify/setup/setupLint.ts
|
|
1737
1774
|
import * as path5 from "path";
|
|
1738
|
-
import
|
|
1775
|
+
import chalk29 from "chalk";
|
|
1739
1776
|
|
|
1740
1777
|
// src/commands/lint/init.ts
|
|
1741
1778
|
import { execSync as execSync5 } from "child_process";
|
|
1742
1779
|
import { existsSync as existsSync12, readFileSync as readFileSync10, writeFileSync as writeFileSync8 } from "fs";
|
|
1743
1780
|
import { dirname as dirname7, join as join8 } from "path";
|
|
1744
1781
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
1745
|
-
import
|
|
1782
|
+
import chalk28 from "chalk";
|
|
1746
1783
|
|
|
1747
1784
|
// src/shared/promptConfirm.ts
|
|
1748
1785
|
import enquirer4 from "enquirer";
|
|
@@ -1846,7 +1883,7 @@ function removeEslintScripts(scripts, options2) {
|
|
|
1846
1883
|
}
|
|
1847
1884
|
|
|
1848
1885
|
// src/utils/printDiff.ts
|
|
1849
|
-
import
|
|
1886
|
+
import chalk27 from "chalk";
|
|
1850
1887
|
import * as diff from "diff";
|
|
1851
1888
|
function normalizeJson(content) {
|
|
1852
1889
|
try {
|
|
@@ -1864,11 +1901,11 @@ function printDiff(oldContent, newContent) {
|
|
|
1864
1901
|
const lines = change.value.replace(/\n$/, "").split("\n");
|
|
1865
1902
|
for (const line of lines) {
|
|
1866
1903
|
if (change.added) {
|
|
1867
|
-
console.log(
|
|
1904
|
+
console.log(chalk27.green(`+ ${line}`));
|
|
1868
1905
|
} else if (change.removed) {
|
|
1869
|
-
console.log(
|
|
1906
|
+
console.log(chalk27.red(`- ${line}`));
|
|
1870
1907
|
} else {
|
|
1871
|
-
console.log(
|
|
1908
|
+
console.log(chalk27.dim(` ${line}`));
|
|
1872
1909
|
}
|
|
1873
1910
|
}
|
|
1874
1911
|
}
|
|
@@ -1902,10 +1939,10 @@ async function init() {
|
|
|
1902
1939
|
console.log("biome.json already has the correct linter config");
|
|
1903
1940
|
return;
|
|
1904
1941
|
}
|
|
1905
|
-
console.log(
|
|
1942
|
+
console.log(chalk28.yellow("\n\u26A0\uFE0F biome.json will be updated:"));
|
|
1906
1943
|
console.log();
|
|
1907
1944
|
printDiff(oldContent, newContent);
|
|
1908
|
-
const confirm = await promptConfirm(
|
|
1945
|
+
const confirm = await promptConfirm(chalk28.red("Update biome.json?"));
|
|
1909
1946
|
if (!confirm) {
|
|
1910
1947
|
console.log("Skipped biome.json update");
|
|
1911
1948
|
return;
|
|
@@ -1916,7 +1953,7 @@ async function init() {
|
|
|
1916
1953
|
|
|
1917
1954
|
// src/commands/verify/setup/setupLint.ts
|
|
1918
1955
|
async function setupLint(packageJsonPath, writer) {
|
|
1919
|
-
console.log(
|
|
1956
|
+
console.log(chalk29.blue("\nSetting up biome..."));
|
|
1920
1957
|
const cwd = path5.dirname(packageJsonPath);
|
|
1921
1958
|
const pkg = readPackageJson(packageJsonPath);
|
|
1922
1959
|
if (!pkg.devDependencies?.["@biomejs/biome"]) {
|
|
@@ -1930,9 +1967,9 @@ async function setupLint(packageJsonPath, writer) {
|
|
|
1930
1967
|
|
|
1931
1968
|
// src/commands/verify/setup/setupMadge.ts
|
|
1932
1969
|
import * as path6 from "path";
|
|
1933
|
-
import
|
|
1970
|
+
import chalk30 from "chalk";
|
|
1934
1971
|
async function setupMadge(packageJsonPath, writer) {
|
|
1935
|
-
console.log(
|
|
1972
|
+
console.log(chalk30.blue("\nSetting up madge..."));
|
|
1936
1973
|
const cwd = path6.dirname(packageJsonPath);
|
|
1937
1974
|
const pkg = readPackageJson(packageJsonPath);
|
|
1938
1975
|
const hasMadge = !!pkg.dependencies?.madge || !!pkg.devDependencies?.madge;
|
|
@@ -1944,18 +1981,18 @@ async function setupMadge(packageJsonPath, writer) {
|
|
|
1944
1981
|
|
|
1945
1982
|
// src/commands/verify/setup/setupMaintainability.ts
|
|
1946
1983
|
import * as path7 from "path";
|
|
1947
|
-
import
|
|
1984
|
+
import chalk31 from "chalk";
|
|
1948
1985
|
async function setupMaintainability(packageJsonPath, writer) {
|
|
1949
|
-
console.log(
|
|
1986
|
+
console.log(chalk31.blue("\nSetting up maintainability check..."));
|
|
1950
1987
|
addToKnipIgnoreBinaries(path7.dirname(packageJsonPath), "assist");
|
|
1951
1988
|
writer("verify:maintainability", expectedScripts["verify:maintainability"]);
|
|
1952
1989
|
}
|
|
1953
1990
|
|
|
1954
1991
|
// src/commands/verify/setup/setupTest.ts
|
|
1955
1992
|
import * as path8 from "path";
|
|
1956
|
-
import
|
|
1993
|
+
import chalk32 from "chalk";
|
|
1957
1994
|
async function setupTest(packageJsonPath, writer) {
|
|
1958
|
-
console.log(
|
|
1995
|
+
console.log(chalk32.blue("\nSetting up vitest..."));
|
|
1959
1996
|
const cwd = path8.dirname(packageJsonPath);
|
|
1960
1997
|
const pkg = readPackageJson(packageJsonPath);
|
|
1961
1998
|
if (!pkg.devDependencies?.vitest && !installPackage("vitest", cwd)) {
|
|
@@ -2124,25 +2161,25 @@ async function runSelectedSetups(selected, packageJsonPath, writer, handlers) {
|
|
|
2124
2161
|
for (const choice of selected) {
|
|
2125
2162
|
await handlers[choice]?.(packageJsonPath, writer);
|
|
2126
2163
|
}
|
|
2127
|
-
console.log(
|
|
2164
|
+
console.log(chalk33.green(`
|
|
2128
2165
|
Added ${selected.length} verify script(s):`));
|
|
2129
2166
|
for (const choice of selected) {
|
|
2130
|
-
console.log(
|
|
2167
|
+
console.log(chalk33.green(` - verify:${choice}`));
|
|
2131
2168
|
}
|
|
2132
|
-
console.log(
|
|
2169
|
+
console.log(chalk33.dim("\nRun 'assist verify' to run all verify scripts"));
|
|
2133
2170
|
}
|
|
2134
2171
|
async function promptForScripts(availableOptions) {
|
|
2135
2172
|
if (availableOptions.length === 0) {
|
|
2136
|
-
console.log(
|
|
2173
|
+
console.log(chalk33.green("All verify scripts are already configured!"));
|
|
2137
2174
|
return null;
|
|
2138
2175
|
}
|
|
2139
|
-
console.log(
|
|
2176
|
+
console.log(chalk33.bold("Available verify scripts to add:\n"));
|
|
2140
2177
|
const selected = await promptMultiselect(
|
|
2141
2178
|
"Select verify scripts to add:",
|
|
2142
2179
|
availableOptions
|
|
2143
2180
|
);
|
|
2144
2181
|
if (selected.length === 0) {
|
|
2145
|
-
console.log(
|
|
2182
|
+
console.log(chalk33.yellow("No scripts selected"));
|
|
2146
2183
|
return null;
|
|
2147
2184
|
}
|
|
2148
2185
|
return selected;
|
|
@@ -2162,17 +2199,17 @@ async function init2() {
|
|
|
2162
2199
|
}
|
|
2163
2200
|
|
|
2164
2201
|
// src/commands/vscode/init/index.ts
|
|
2165
|
-
import
|
|
2202
|
+
import chalk35 from "chalk";
|
|
2166
2203
|
|
|
2167
2204
|
// src/commands/vscode/init/createLaunchJson.ts
|
|
2168
2205
|
import * as fs2 from "fs";
|
|
2169
2206
|
import * as path9 from "path";
|
|
2170
|
-
import
|
|
2207
|
+
import chalk34 from "chalk";
|
|
2171
2208
|
function ensureVscodeFolder() {
|
|
2172
2209
|
const vscodeDir = path9.join(process.cwd(), ".vscode");
|
|
2173
2210
|
if (!fs2.existsSync(vscodeDir)) {
|
|
2174
2211
|
fs2.mkdirSync(vscodeDir);
|
|
2175
|
-
console.log(
|
|
2212
|
+
console.log(chalk34.dim("Created .vscode folder"));
|
|
2176
2213
|
}
|
|
2177
2214
|
}
|
|
2178
2215
|
function removeVscodeFromGitignore() {
|
|
@@ -2187,7 +2224,7 @@ function removeVscodeFromGitignore() {
|
|
|
2187
2224
|
);
|
|
2188
2225
|
if (filteredLines.length !== lines.length) {
|
|
2189
2226
|
fs2.writeFileSync(gitignorePath, filteredLines.join("\n"));
|
|
2190
|
-
console.log(
|
|
2227
|
+
console.log(chalk34.dim("Removed .vscode references from .gitignore"));
|
|
2191
2228
|
}
|
|
2192
2229
|
}
|
|
2193
2230
|
function createLaunchJson(type) {
|
|
@@ -2206,7 +2243,7 @@ function createLaunchJson(type) {
|
|
|
2206
2243
|
const launchPath = path9.join(process.cwd(), ".vscode", "launch.json");
|
|
2207
2244
|
fs2.writeFileSync(launchPath, `${JSON.stringify(launchConfig, null, " ")}
|
|
2208
2245
|
`);
|
|
2209
|
-
console.log(
|
|
2246
|
+
console.log(chalk34.green("Created .vscode/launch.json"));
|
|
2210
2247
|
}
|
|
2211
2248
|
function createSettingsJson() {
|
|
2212
2249
|
const settings = {
|
|
@@ -2219,7 +2256,7 @@ function createSettingsJson() {
|
|
|
2219
2256
|
const settingsPath = path9.join(process.cwd(), ".vscode", "settings.json");
|
|
2220
2257
|
fs2.writeFileSync(settingsPath, `${JSON.stringify(settings, null, " ")}
|
|
2221
2258
|
`);
|
|
2222
|
-
console.log(
|
|
2259
|
+
console.log(chalk34.green("Created .vscode/settings.json"));
|
|
2223
2260
|
}
|
|
2224
2261
|
function createExtensionsJson() {
|
|
2225
2262
|
const extensions = {
|
|
@@ -2231,7 +2268,7 @@ function createExtensionsJson() {
|
|
|
2231
2268
|
`${JSON.stringify(extensions, null, " ")}
|
|
2232
2269
|
`
|
|
2233
2270
|
);
|
|
2234
|
-
console.log(
|
|
2271
|
+
console.log(chalk34.green("Created .vscode/extensions.json"));
|
|
2235
2272
|
}
|
|
2236
2273
|
|
|
2237
2274
|
// src/commands/vscode/init/detectVscodeSetup.ts
|
|
@@ -2288,7 +2325,7 @@ function applySelections(selected, setup2) {
|
|
|
2288
2325
|
for (const choice of selected) handlers[choice]?.();
|
|
2289
2326
|
}
|
|
2290
2327
|
async function promptForOptions(options2) {
|
|
2291
|
-
console.log(
|
|
2328
|
+
console.log(chalk35.bold("Available VS Code configurations to add:\n"));
|
|
2292
2329
|
return promptMultiselect("Select configurations to add:", options2);
|
|
2293
2330
|
}
|
|
2294
2331
|
async function init3({ all = false } = {}) {
|
|
@@ -2296,17 +2333,17 @@ async function init3({ all = false } = {}) {
|
|
|
2296
2333
|
const setup2 = detectVscodeSetup(pkg);
|
|
2297
2334
|
const options2 = getAvailableOptions2(setup2);
|
|
2298
2335
|
if (options2.length === 0) {
|
|
2299
|
-
console.log(
|
|
2336
|
+
console.log(chalk35.green("VS Code configuration already exists!"));
|
|
2300
2337
|
return;
|
|
2301
2338
|
}
|
|
2302
2339
|
const selected = all ? options2.map((o) => o.value) : await promptForOptions(options2);
|
|
2303
2340
|
if (selected.length === 0) {
|
|
2304
|
-
console.log(
|
|
2341
|
+
console.log(chalk35.yellow("No configurations selected"));
|
|
2305
2342
|
return;
|
|
2306
2343
|
}
|
|
2307
2344
|
applySelections(selected, setup2);
|
|
2308
2345
|
console.log(
|
|
2309
|
-
|
|
2346
|
+
chalk35.green(`
|
|
2310
2347
|
Added ${selected.length} VS Code configuration(s)`)
|
|
2311
2348
|
);
|
|
2312
2349
|
}
|
|
@@ -2319,7 +2356,7 @@ async function init4() {
|
|
|
2319
2356
|
|
|
2320
2357
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
2321
2358
|
import path16 from "path";
|
|
2322
|
-
import
|
|
2359
|
+
import chalk37 from "chalk";
|
|
2323
2360
|
|
|
2324
2361
|
// src/commands/lint/lint/checkFileNames.ts
|
|
2325
2362
|
import fs5 from "fs";
|
|
@@ -2399,7 +2436,7 @@ function checkFileNames() {
|
|
|
2399
2436
|
}
|
|
2400
2437
|
|
|
2401
2438
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
2402
|
-
import
|
|
2439
|
+
import chalk36 from "chalk";
|
|
2403
2440
|
|
|
2404
2441
|
// src/commands/lint/lint/applyMoves.ts
|
|
2405
2442
|
import fs6 from "fs";
|
|
@@ -2484,25 +2521,25 @@ function fixFileNameViolations(moves) {
|
|
|
2484
2521
|
const start3 = performance.now();
|
|
2485
2522
|
const project = createLintProject();
|
|
2486
2523
|
const cwd = process.cwd();
|
|
2487
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
2524
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk36.green(line)));
|
|
2488
2525
|
const ms = (performance.now() - start3).toFixed(0);
|
|
2489
|
-
console.log(
|
|
2526
|
+
console.log(chalk36.dim(` Done in ${ms}ms`));
|
|
2490
2527
|
}
|
|
2491
2528
|
|
|
2492
2529
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
2493
2530
|
function reportViolations(violations) {
|
|
2494
|
-
console.error(
|
|
2531
|
+
console.error(chalk37.red("\nFile name check failed:\n"));
|
|
2495
2532
|
console.error(
|
|
2496
|
-
|
|
2533
|
+
chalk37.red(
|
|
2497
2534
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
2498
2535
|
)
|
|
2499
2536
|
);
|
|
2500
2537
|
for (const violation of violations) {
|
|
2501
|
-
console.error(
|
|
2502
|
-
console.error(
|
|
2538
|
+
console.error(chalk37.red(` ${violation.filePath}`));
|
|
2539
|
+
console.error(chalk37.gray(` Rename to: ${violation.suggestedName}
|
|
2503
2540
|
`));
|
|
2504
2541
|
}
|
|
2505
|
-
console.error(
|
|
2542
|
+
console.error(chalk37.dim(" Run with -f to auto-fix.\n"));
|
|
2506
2543
|
}
|
|
2507
2544
|
function runFileNameCheck(fix = false) {
|
|
2508
2545
|
const violations = checkFileNames();
|
|
@@ -2531,17 +2568,17 @@ function runFileNameCheck(fix = false) {
|
|
|
2531
2568
|
import fs8 from "fs";
|
|
2532
2569
|
|
|
2533
2570
|
// src/commands/lint/shared.ts
|
|
2534
|
-
import
|
|
2571
|
+
import chalk38 from "chalk";
|
|
2535
2572
|
function reportViolations2(violations, checkName, errorMessage, successMessage) {
|
|
2536
2573
|
if (violations.length > 0) {
|
|
2537
|
-
console.error(
|
|
2574
|
+
console.error(chalk38.red(`
|
|
2538
2575
|
${checkName} failed:
|
|
2539
2576
|
`));
|
|
2540
|
-
console.error(
|
|
2577
|
+
console.error(chalk38.red(` ${errorMessage}
|
|
2541
2578
|
`));
|
|
2542
2579
|
for (const violation of violations) {
|
|
2543
|
-
console.error(
|
|
2544
|
-
console.error(
|
|
2580
|
+
console.error(chalk38.red(` ${violation.filePath}:${violation.line}`));
|
|
2581
|
+
console.error(chalk38.gray(` ${violation.content}
|
|
2545
2582
|
`));
|
|
2546
2583
|
}
|
|
2547
2584
|
return false;
|
|
@@ -3021,14 +3058,14 @@ import { existsSync as existsSync16, readFileSync as readFileSync13, writeFileSy
|
|
|
3021
3058
|
|
|
3022
3059
|
// src/commands/deploy/init/index.ts
|
|
3023
3060
|
import { execSync as execSync12 } from "child_process";
|
|
3024
|
-
import
|
|
3061
|
+
import chalk40 from "chalk";
|
|
3025
3062
|
import enquirer5 from "enquirer";
|
|
3026
3063
|
|
|
3027
3064
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
3028
3065
|
import { existsSync as existsSync15, mkdirSync as mkdirSync3, readFileSync as readFileSync12, writeFileSync as writeFileSync12 } from "fs";
|
|
3029
3066
|
import { dirname as dirname13, join as join11 } from "path";
|
|
3030
3067
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
3031
|
-
import
|
|
3068
|
+
import chalk39 from "chalk";
|
|
3032
3069
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
3033
3070
|
var __dirname3 = dirname13(fileURLToPath3(import.meta.url));
|
|
3034
3071
|
function getExistingSiteId() {
|
|
@@ -3053,20 +3090,20 @@ async function updateWorkflow(siteId) {
|
|
|
3053
3090
|
if (existsSync15(WORKFLOW_PATH)) {
|
|
3054
3091
|
const oldContent = readFileSync12(WORKFLOW_PATH, "utf-8");
|
|
3055
3092
|
if (oldContent === newContent) {
|
|
3056
|
-
console.log(
|
|
3093
|
+
console.log(chalk39.green("build.yml is already up to date"));
|
|
3057
3094
|
return;
|
|
3058
3095
|
}
|
|
3059
|
-
console.log(
|
|
3096
|
+
console.log(chalk39.yellow("\nbuild.yml will be updated:"));
|
|
3060
3097
|
console.log();
|
|
3061
3098
|
printDiff(oldContent, newContent);
|
|
3062
|
-
const confirm = await promptConfirm(
|
|
3099
|
+
const confirm = await promptConfirm(chalk39.red("Update build.yml?"));
|
|
3063
3100
|
if (!confirm) {
|
|
3064
3101
|
console.log("Skipped build.yml update");
|
|
3065
3102
|
return;
|
|
3066
3103
|
}
|
|
3067
3104
|
}
|
|
3068
3105
|
writeFileSync12(WORKFLOW_PATH, newContent);
|
|
3069
|
-
console.log(
|
|
3106
|
+
console.log(chalk39.green(`
|
|
3070
3107
|
Created ${WORKFLOW_PATH}`));
|
|
3071
3108
|
}
|
|
3072
3109
|
|
|
@@ -3077,43 +3114,43 @@ async function ensureNetlifyCli() {
|
|
|
3077
3114
|
} catch (error) {
|
|
3078
3115
|
if (!(error instanceof Error) || !error.message.includes("command not found"))
|
|
3079
3116
|
throw error;
|
|
3080
|
-
console.error(
|
|
3117
|
+
console.error(chalk40.red("\nNetlify CLI is not installed.\n"));
|
|
3081
3118
|
const install = await promptConfirm("Would you like to install it now?");
|
|
3082
3119
|
if (!install) {
|
|
3083
3120
|
console.log(
|
|
3084
|
-
|
|
3121
|
+
chalk40.yellow(
|
|
3085
3122
|
"\nInstall it manually with: npm install -g netlify-cli\n"
|
|
3086
3123
|
)
|
|
3087
3124
|
);
|
|
3088
3125
|
process.exit(1);
|
|
3089
3126
|
}
|
|
3090
|
-
console.log(
|
|
3127
|
+
console.log(chalk40.dim("\nInstalling netlify-cli...\n"));
|
|
3091
3128
|
execSync12("npm install -g netlify-cli", { stdio: "inherit" });
|
|
3092
3129
|
console.log();
|
|
3093
3130
|
execSync12("netlify sites:create --disable-linking", { stdio: "inherit" });
|
|
3094
3131
|
}
|
|
3095
3132
|
}
|
|
3096
3133
|
function printSetupInstructions() {
|
|
3097
|
-
console.log(
|
|
3134
|
+
console.log(chalk40.bold("\nDeployment initialized successfully!"));
|
|
3098
3135
|
console.log(
|
|
3099
|
-
|
|
3136
|
+
chalk40.yellow("\nTo complete setup, create a personal access token at:")
|
|
3100
3137
|
);
|
|
3101
3138
|
console.log(
|
|
3102
|
-
|
|
3139
|
+
chalk40.cyan(
|
|
3103
3140
|
"https://app.netlify.com/user/applications#personal-access-tokens"
|
|
3104
3141
|
)
|
|
3105
3142
|
);
|
|
3106
3143
|
console.log(
|
|
3107
|
-
|
|
3144
|
+
chalk40.yellow(
|
|
3108
3145
|
"\nThen add it as NETLIFY_AUTH_TOKEN in your GitHub repository secrets."
|
|
3109
3146
|
)
|
|
3110
3147
|
);
|
|
3111
3148
|
}
|
|
3112
3149
|
async function init5() {
|
|
3113
|
-
console.log(
|
|
3150
|
+
console.log(chalk40.bold("Initializing Netlify deployment...\n"));
|
|
3114
3151
|
const existingSiteId = getExistingSiteId();
|
|
3115
3152
|
if (existingSiteId) {
|
|
3116
|
-
console.log(
|
|
3153
|
+
console.log(chalk40.dim(`Using existing site ID: ${existingSiteId}
|
|
3117
3154
|
`));
|
|
3118
3155
|
await updateWorkflow(existingSiteId);
|
|
3119
3156
|
return;
|
|
@@ -3292,27 +3329,27 @@ async function notify() {
|
|
|
3292
3329
|
}
|
|
3293
3330
|
|
|
3294
3331
|
// src/commands/backlog/comment/index.ts
|
|
3295
|
-
import
|
|
3332
|
+
import chalk41 from "chalk";
|
|
3296
3333
|
function comment(id, text) {
|
|
3297
3334
|
const result = loadAndFindItem(id);
|
|
3298
3335
|
if (!result) process.exit(1);
|
|
3299
3336
|
addComment(result.item, text);
|
|
3300
3337
|
saveBacklog(result.items);
|
|
3301
|
-
console.log(
|
|
3338
|
+
console.log(chalk41.green(`Comment added to item #${id}.`));
|
|
3302
3339
|
}
|
|
3303
3340
|
|
|
3304
3341
|
// src/commands/backlog/comments/index.ts
|
|
3305
|
-
import
|
|
3342
|
+
import chalk42 from "chalk";
|
|
3306
3343
|
function comments(id) {
|
|
3307
3344
|
const result = loadAndFindItem(id);
|
|
3308
3345
|
if (!result) process.exit(1);
|
|
3309
3346
|
const { item } = result;
|
|
3310
3347
|
const entries = item.comments ?? [];
|
|
3311
3348
|
if (entries.length === 0) {
|
|
3312
|
-
console.log(
|
|
3349
|
+
console.log(chalk42.dim(`No comments on item #${id}.`));
|
|
3313
3350
|
return;
|
|
3314
3351
|
}
|
|
3315
|
-
console.log(
|
|
3352
|
+
console.log(chalk42.bold(`Comments for #${id}: ${item.name}
|
|
3316
3353
|
`));
|
|
3317
3354
|
for (const entry of entries) {
|
|
3318
3355
|
console.log(`${formatComment(entry)}
|
|
@@ -3328,11 +3365,11 @@ function registerCommentCommands(cmd) {
|
|
|
3328
3365
|
|
|
3329
3366
|
// src/commands/backlog/add/index.ts
|
|
3330
3367
|
import { existsSync as existsSync18 } from "fs";
|
|
3331
|
-
import
|
|
3368
|
+
import chalk45 from "chalk";
|
|
3332
3369
|
|
|
3333
3370
|
// src/commands/backlog/commitBacklog.ts
|
|
3334
3371
|
import { execSync as execSync14 } from "child_process";
|
|
3335
|
-
import
|
|
3372
|
+
import chalk43 from "chalk";
|
|
3336
3373
|
function commitBacklog(id, name) {
|
|
3337
3374
|
try {
|
|
3338
3375
|
const backlogPath = getBacklogPath();
|
|
@@ -3340,18 +3377,18 @@ function commitBacklog(id, name) {
|
|
|
3340
3377
|
execSync14(`git add ${shellQuote(backlogPath)}`, { stdio: "ignore" });
|
|
3341
3378
|
execSync14(`git commit -m ${shellQuote(message)}`, { stdio: "ignore" });
|
|
3342
3379
|
} catch {
|
|
3343
|
-
console.log(
|
|
3380
|
+
console.log(chalk43.yellow("Warning: could not auto-commit backlog file."));
|
|
3344
3381
|
}
|
|
3345
3382
|
}
|
|
3346
3383
|
|
|
3347
3384
|
// src/commands/backlog/add/parseItemFile.ts
|
|
3348
3385
|
import { existsSync as existsSync17, readFileSync as readFileSync14 } from "fs";
|
|
3349
|
-
import
|
|
3386
|
+
import chalk44 from "chalk";
|
|
3350
3387
|
import { ZodError } from "zod";
|
|
3351
3388
|
var addItemSchema = backlogItemSchema.omit({ id: true, status: true });
|
|
3352
3389
|
function readJsonFile(filePath) {
|
|
3353
3390
|
if (!existsSync17(filePath)) {
|
|
3354
|
-
console.log(
|
|
3391
|
+
console.log(chalk44.red(`File not found: ${filePath}`));
|
|
3355
3392
|
process.exitCode = 1;
|
|
3356
3393
|
return void 0;
|
|
3357
3394
|
}
|
|
@@ -3359,26 +3396,26 @@ function readJsonFile(filePath) {
|
|
|
3359
3396
|
try {
|
|
3360
3397
|
raw = readFileSync14(filePath, "utf-8");
|
|
3361
3398
|
} catch {
|
|
3362
|
-
console.log(
|
|
3399
|
+
console.log(chalk44.red(`Failed to read file: ${filePath}`));
|
|
3363
3400
|
process.exitCode = 1;
|
|
3364
3401
|
return void 0;
|
|
3365
3402
|
}
|
|
3366
3403
|
try {
|
|
3367
3404
|
return JSON.parse(raw);
|
|
3368
3405
|
} catch {
|
|
3369
|
-
console.log(
|
|
3406
|
+
console.log(chalk44.red(`Invalid JSON in file: ${filePath}`));
|
|
3370
3407
|
process.exitCode = 1;
|
|
3371
3408
|
return void 0;
|
|
3372
3409
|
}
|
|
3373
3410
|
}
|
|
3374
3411
|
function formatZodError(err) {
|
|
3375
3412
|
if (err instanceof ZodError) {
|
|
3376
|
-
console.log(
|
|
3413
|
+
console.log(chalk44.red("Invalid backlog item schema:"));
|
|
3377
3414
|
for (const issue of err.issues) {
|
|
3378
|
-
console.log(
|
|
3415
|
+
console.log(chalk44.red(` - ${issue.path.join(".")}: ${issue.message}`));
|
|
3379
3416
|
}
|
|
3380
3417
|
} else {
|
|
3381
|
-
console.log(
|
|
3418
|
+
console.log(chalk44.red("Invalid backlog item schema."));
|
|
3382
3419
|
}
|
|
3383
3420
|
}
|
|
3384
3421
|
function parseItemFile(filePath) {
|
|
@@ -3472,7 +3509,7 @@ function addFromFile(filePath) {
|
|
|
3472
3509
|
items.push({ ...data, id, status: "todo" });
|
|
3473
3510
|
saveBacklog(items);
|
|
3474
3511
|
commitBacklog(id, data.name);
|
|
3475
|
-
console.log(
|
|
3512
|
+
console.log(chalk45.green(`Added item #${id}: ${data.name}`));
|
|
3476
3513
|
}
|
|
3477
3514
|
async function addInteractive() {
|
|
3478
3515
|
const type = await promptType();
|
|
@@ -3491,12 +3528,12 @@ async function addInteractive() {
|
|
|
3491
3528
|
});
|
|
3492
3529
|
saveBacklog(items);
|
|
3493
3530
|
commitBacklog(id, name);
|
|
3494
|
-
console.log(
|
|
3531
|
+
console.log(chalk45.green(`Added item #${id}: ${name}`));
|
|
3495
3532
|
}
|
|
3496
3533
|
async function add(options2) {
|
|
3497
3534
|
if (!existsSync18(getBacklogPath())) {
|
|
3498
3535
|
console.log(
|
|
3499
|
-
|
|
3536
|
+
chalk45.yellow(
|
|
3500
3537
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
3501
3538
|
)
|
|
3502
3539
|
);
|
|
@@ -3511,20 +3548,20 @@ async function add(options2) {
|
|
|
3511
3548
|
|
|
3512
3549
|
// src/commands/backlog/init/index.ts
|
|
3513
3550
|
import { existsSync as existsSync19 } from "fs";
|
|
3514
|
-
import
|
|
3551
|
+
import chalk46 from "chalk";
|
|
3515
3552
|
async function init6() {
|
|
3516
3553
|
const backlogPath = getBacklogPath();
|
|
3517
3554
|
if (existsSync19(backlogPath)) {
|
|
3518
|
-
console.log(
|
|
3555
|
+
console.log(chalk46.yellow("assist.backlog.yml already exists."));
|
|
3519
3556
|
return;
|
|
3520
3557
|
}
|
|
3521
3558
|
saveBacklog([]);
|
|
3522
|
-
console.log(
|
|
3559
|
+
console.log(chalk46.green("Created assist.backlog.yml"));
|
|
3523
3560
|
}
|
|
3524
3561
|
|
|
3525
3562
|
// src/commands/backlog/list/index.ts
|
|
3526
3563
|
import { existsSync as existsSync20 } from "fs";
|
|
3527
|
-
import
|
|
3564
|
+
import chalk47 from "chalk";
|
|
3528
3565
|
function filterItems(items, options2) {
|
|
3529
3566
|
if (options2.status) return items.filter((i) => i.status === options2.status);
|
|
3530
3567
|
if (!options2.all) return items.filter((i) => i.status !== "done");
|
|
@@ -3533,7 +3570,7 @@ function filterItems(items, options2) {
|
|
|
3533
3570
|
async function list2(options2) {
|
|
3534
3571
|
if (!existsSync20(getBacklogPath())) {
|
|
3535
3572
|
console.log(
|
|
3536
|
-
|
|
3573
|
+
chalk47.yellow(
|
|
3537
3574
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
3538
3575
|
)
|
|
3539
3576
|
);
|
|
@@ -3541,12 +3578,12 @@ async function list2(options2) {
|
|
|
3541
3578
|
}
|
|
3542
3579
|
const items = filterItems(loadBacklog(), options2);
|
|
3543
3580
|
if (items.length === 0) {
|
|
3544
|
-
console.log(
|
|
3581
|
+
console.log(chalk47.dim("Backlog is empty."));
|
|
3545
3582
|
return;
|
|
3546
3583
|
}
|
|
3547
3584
|
for (const item of items) {
|
|
3548
3585
|
console.log(
|
|
3549
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
3586
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk47.dim(`#${item.id}`)} ${item.name}${phaseLabel(item)}${dependencyLabel(item)}`
|
|
3550
3587
|
);
|
|
3551
3588
|
if (options2.verbose) {
|
|
3552
3589
|
printVerboseDetails(item);
|
|
@@ -3561,17 +3598,136 @@ function registerItemCommands(cmd) {
|
|
|
3561
3598
|
cmd.command("add").description("Add a new backlog item").option("--file <path>", "Read item as JSON from a file").action(add);
|
|
3562
3599
|
}
|
|
3563
3600
|
|
|
3601
|
+
// src/commands/backlog/link.ts
|
|
3602
|
+
import chalk49 from "chalk";
|
|
3603
|
+
|
|
3604
|
+
// src/commands/backlog/hasCycle.ts
|
|
3605
|
+
function hasCycle(items, fromId, toId) {
|
|
3606
|
+
const visited = /* @__PURE__ */ new Set();
|
|
3607
|
+
const stack = [toId];
|
|
3608
|
+
while (stack.length > 0) {
|
|
3609
|
+
const current = stack.pop();
|
|
3610
|
+
if (current === fromId) return true;
|
|
3611
|
+
if (visited.has(current)) continue;
|
|
3612
|
+
visited.add(current);
|
|
3613
|
+
const item = items.find((i) => i.id === current);
|
|
3614
|
+
if (!item?.links) continue;
|
|
3615
|
+
for (const link2 of item.links) {
|
|
3616
|
+
if (link2.type === "depends-on") {
|
|
3617
|
+
stack.push(link2.targetId);
|
|
3618
|
+
}
|
|
3619
|
+
}
|
|
3620
|
+
}
|
|
3621
|
+
return false;
|
|
3622
|
+
}
|
|
3623
|
+
|
|
3624
|
+
// src/commands/backlog/validateLinkTarget.ts
|
|
3625
|
+
import chalk48 from "chalk";
|
|
3626
|
+
function validateLinkTarget(items, fromItem, fromId, toId, toNum, linkType) {
|
|
3627
|
+
const toItem = items.find((i) => i.id === toNum);
|
|
3628
|
+
if (!toItem) {
|
|
3629
|
+
console.log(chalk48.red(`Item #${toId} not found.`));
|
|
3630
|
+
return void 0;
|
|
3631
|
+
}
|
|
3632
|
+
if (!fromItem.links) fromItem.links = [];
|
|
3633
|
+
const duplicate = fromItem.links.some(
|
|
3634
|
+
(l) => l.targetId === toNum && l.type === linkType
|
|
3635
|
+
);
|
|
3636
|
+
if (duplicate) {
|
|
3637
|
+
console.log(
|
|
3638
|
+
chalk48.yellow(`Link already exists: #${fromId} ${linkType} #${toId}`)
|
|
3639
|
+
);
|
|
3640
|
+
return void 0;
|
|
3641
|
+
}
|
|
3642
|
+
return toItem;
|
|
3643
|
+
}
|
|
3644
|
+
|
|
3645
|
+
// src/commands/backlog/link.ts
|
|
3646
|
+
function link(fromId, toId, opts) {
|
|
3647
|
+
const linkType = opts.type ?? "relates-to";
|
|
3648
|
+
if (linkType !== "relates-to" && linkType !== "depends-on") {
|
|
3649
|
+
console.log(chalk49.red(`Invalid link type: ${linkType}`));
|
|
3650
|
+
return;
|
|
3651
|
+
}
|
|
3652
|
+
const fromNum = Number.parseInt(fromId, 10);
|
|
3653
|
+
const toNum = Number.parseInt(toId, 10);
|
|
3654
|
+
if (fromNum === toNum) {
|
|
3655
|
+
console.log(chalk49.red("Cannot link an item to itself."));
|
|
3656
|
+
return;
|
|
3657
|
+
}
|
|
3658
|
+
const result = loadAndFindItem(fromId);
|
|
3659
|
+
if (!result) return;
|
|
3660
|
+
const { items, item: fromItem } = result;
|
|
3661
|
+
const toItem = validateLinkTarget(
|
|
3662
|
+
items,
|
|
3663
|
+
fromItem,
|
|
3664
|
+
fromId,
|
|
3665
|
+
toId,
|
|
3666
|
+
toNum,
|
|
3667
|
+
linkType
|
|
3668
|
+
);
|
|
3669
|
+
if (!toItem) return;
|
|
3670
|
+
if (linkType === "depends-on" && hasCycle(items, fromNum, toNum)) {
|
|
3671
|
+
console.log(
|
|
3672
|
+
chalk49.red(
|
|
3673
|
+
`Cannot add dependency: #${fromId} \u2192 #${toId} would create a circular dependency.`
|
|
3674
|
+
)
|
|
3675
|
+
);
|
|
3676
|
+
return;
|
|
3677
|
+
}
|
|
3678
|
+
if (!fromItem.links) fromItem.links = [];
|
|
3679
|
+
fromItem.links.push({ type: linkType, targetId: toNum });
|
|
3680
|
+
saveBacklog(items);
|
|
3681
|
+
console.log(
|
|
3682
|
+
chalk49.green(`Linked #${fromId} ${linkType} #${toId} (${toItem.name})`)
|
|
3683
|
+
);
|
|
3684
|
+
}
|
|
3685
|
+
|
|
3686
|
+
// src/commands/backlog/unlink.ts
|
|
3687
|
+
import chalk50 from "chalk";
|
|
3688
|
+
function unlink(fromId, toId) {
|
|
3689
|
+
const toNum = Number.parseInt(toId, 10);
|
|
3690
|
+
const result = loadAndFindItem(fromId);
|
|
3691
|
+
if (!result) return;
|
|
3692
|
+
const { items, item: fromItem } = result;
|
|
3693
|
+
if (!fromItem.links || fromItem.links.length === 0) {
|
|
3694
|
+
console.log(chalk50.yellow(`No links found on item #${fromId}.`));
|
|
3695
|
+
return;
|
|
3696
|
+
}
|
|
3697
|
+
const before = fromItem.links.length;
|
|
3698
|
+
fromItem.links = fromItem.links.filter((l) => l.targetId !== toNum);
|
|
3699
|
+
if (fromItem.links.length === before) {
|
|
3700
|
+
console.log(chalk50.yellow(`No link from #${fromId} to #${toId} found.`));
|
|
3701
|
+
return;
|
|
3702
|
+
}
|
|
3703
|
+
if (fromItem.links.length === 0) {
|
|
3704
|
+
fromItem.links = void 0;
|
|
3705
|
+
}
|
|
3706
|
+
saveBacklog(items);
|
|
3707
|
+
console.log(chalk50.green(`Removed link from #${fromId} to #${toId}.`));
|
|
3708
|
+
}
|
|
3709
|
+
|
|
3710
|
+
// src/commands/backlog/registerLinkCommands.ts
|
|
3711
|
+
function registerLinkCommands(cmd) {
|
|
3712
|
+
cmd.command("link <from> <to>").description("Link two backlog items").option(
|
|
3713
|
+
"--type <type>",
|
|
3714
|
+
"Link type (relates-to or depends-on)",
|
|
3715
|
+
"relates-to"
|
|
3716
|
+
).action(link);
|
|
3717
|
+
cmd.command("unlink <from> <to>").description("Remove a link between two backlog items").action(unlink);
|
|
3718
|
+
}
|
|
3719
|
+
|
|
3564
3720
|
// src/commands/backlog/delete/index.ts
|
|
3565
|
-
import
|
|
3721
|
+
import chalk51 from "chalk";
|
|
3566
3722
|
async function del(id) {
|
|
3567
3723
|
const name = removeItem(id);
|
|
3568
3724
|
if (name) {
|
|
3569
|
-
console.log(
|
|
3725
|
+
console.log(chalk51.green(`Deleted item #${id}: ${name}`));
|
|
3570
3726
|
}
|
|
3571
3727
|
}
|
|
3572
3728
|
|
|
3573
3729
|
// src/commands/backlog/done/index.ts
|
|
3574
|
-
import
|
|
3730
|
+
import chalk52 from "chalk";
|
|
3575
3731
|
async function done(id, summary) {
|
|
3576
3732
|
const result = loadAndFindItem(id);
|
|
3577
3733
|
if (!result) return;
|
|
@@ -3581,15 +3737,15 @@ async function done(id, summary) {
|
|
|
3581
3737
|
addPhaseSummary(result.item, summary, phase);
|
|
3582
3738
|
}
|
|
3583
3739
|
saveBacklog(result.items);
|
|
3584
|
-
console.log(
|
|
3740
|
+
console.log(chalk52.green(`Completed item #${id}: ${result.item.name}`));
|
|
3585
3741
|
}
|
|
3586
3742
|
|
|
3587
3743
|
// src/commands/backlog/start/index.ts
|
|
3588
|
-
import
|
|
3744
|
+
import chalk53 from "chalk";
|
|
3589
3745
|
async function start(id) {
|
|
3590
3746
|
const name = setStatus(id, "in-progress");
|
|
3591
3747
|
if (name) {
|
|
3592
|
-
console.log(
|
|
3748
|
+
console.log(chalk53.green(`Started item #${id}: ${name}`));
|
|
3593
3749
|
}
|
|
3594
3750
|
}
|
|
3595
3751
|
|
|
@@ -3630,6 +3786,7 @@ function registerBacklog(program2) {
|
|
|
3630
3786
|
registerStatusCommands(cmd);
|
|
3631
3787
|
registerWebCommand(cmd);
|
|
3632
3788
|
registerCommentCommands(cmd);
|
|
3789
|
+
registerLinkCommands(cmd);
|
|
3633
3790
|
registerPlanCommands(cmd);
|
|
3634
3791
|
registerNextCommand(cmd);
|
|
3635
3792
|
registerRunCommand(cmd);
|
|
@@ -4031,48 +4188,48 @@ ${reasons.join("\n")}`);
|
|
|
4031
4188
|
}
|
|
4032
4189
|
|
|
4033
4190
|
// src/commands/deny/denyAdd.ts
|
|
4034
|
-
import
|
|
4191
|
+
import chalk54 from "chalk";
|
|
4035
4192
|
function denyAdd(pattern2, message) {
|
|
4036
4193
|
const config = loadProjectConfig();
|
|
4037
4194
|
const deny = config.deny ?? [];
|
|
4038
4195
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
4039
|
-
console.log(
|
|
4196
|
+
console.log(chalk54.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
4040
4197
|
return;
|
|
4041
4198
|
}
|
|
4042
4199
|
deny.push({ pattern: pattern2, message });
|
|
4043
4200
|
config.deny = deny;
|
|
4044
4201
|
saveConfig(config);
|
|
4045
|
-
console.log(
|
|
4202
|
+
console.log(chalk54.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
4046
4203
|
}
|
|
4047
4204
|
|
|
4048
4205
|
// src/commands/deny/denyList.ts
|
|
4049
|
-
import
|
|
4206
|
+
import chalk55 from "chalk";
|
|
4050
4207
|
function denyList() {
|
|
4051
4208
|
const config = loadConfig();
|
|
4052
4209
|
const deny = config.deny;
|
|
4053
4210
|
if (!deny || deny.length === 0) {
|
|
4054
|
-
console.log(
|
|
4211
|
+
console.log(chalk55.dim("No deny rules configured."));
|
|
4055
4212
|
return;
|
|
4056
4213
|
}
|
|
4057
4214
|
for (const rule of deny) {
|
|
4058
|
-
console.log(`${
|
|
4215
|
+
console.log(`${chalk55.red(rule.pattern)} \u2192 ${rule.message}`);
|
|
4059
4216
|
}
|
|
4060
4217
|
}
|
|
4061
4218
|
|
|
4062
4219
|
// src/commands/deny/denyRemove.ts
|
|
4063
|
-
import
|
|
4220
|
+
import chalk56 from "chalk";
|
|
4064
4221
|
function denyRemove(pattern2) {
|
|
4065
4222
|
const config = loadProjectConfig();
|
|
4066
4223
|
const deny = config.deny ?? [];
|
|
4067
4224
|
const index = deny.findIndex((r) => r.pattern === pattern2);
|
|
4068
4225
|
if (index === -1) {
|
|
4069
|
-
console.log(
|
|
4226
|
+
console.log(chalk56.yellow(`No deny rule found for: ${pattern2}`));
|
|
4070
4227
|
return;
|
|
4071
4228
|
}
|
|
4072
4229
|
deny.splice(index, 1);
|
|
4073
4230
|
config.deny = deny.length > 0 ? deny : void 0;
|
|
4074
4231
|
saveConfig(config);
|
|
4075
|
-
console.log(
|
|
4232
|
+
console.log(chalk56.green(`Removed deny rule: ${pattern2}`));
|
|
4076
4233
|
}
|
|
4077
4234
|
|
|
4078
4235
|
// src/commands/permitCliReads/index.ts
|
|
@@ -4122,11 +4279,11 @@ function assertCliExists(cli) {
|
|
|
4122
4279
|
}
|
|
4123
4280
|
|
|
4124
4281
|
// src/commands/permitCliReads/colorize.ts
|
|
4125
|
-
import
|
|
4282
|
+
import chalk57 from "chalk";
|
|
4126
4283
|
function colorize(plainOutput) {
|
|
4127
4284
|
return plainOutput.split("\n").map((line) => {
|
|
4128
|
-
if (line.startsWith(" R ")) return
|
|
4129
|
-
if (line.startsWith(" W ")) return
|
|
4285
|
+
if (line.startsWith(" R ")) return chalk57.green(line);
|
|
4286
|
+
if (line.startsWith(" W ")) return chalk57.red(line);
|
|
4130
4287
|
return line;
|
|
4131
4288
|
}).join("\n");
|
|
4132
4289
|
}
|
|
@@ -4444,15 +4601,15 @@ function registerCliHook(program2) {
|
|
|
4444
4601
|
}
|
|
4445
4602
|
|
|
4446
4603
|
// src/commands/complexity/analyze.ts
|
|
4447
|
-
import
|
|
4604
|
+
import chalk63 from "chalk";
|
|
4448
4605
|
|
|
4449
4606
|
// src/commands/complexity/cyclomatic.ts
|
|
4450
|
-
import
|
|
4607
|
+
import chalk59 from "chalk";
|
|
4451
4608
|
|
|
4452
4609
|
// src/commands/complexity/shared/index.ts
|
|
4453
4610
|
import fs12 from "fs";
|
|
4454
4611
|
import path20 from "path";
|
|
4455
|
-
import
|
|
4612
|
+
import chalk58 from "chalk";
|
|
4456
4613
|
import ts5 from "typescript";
|
|
4457
4614
|
|
|
4458
4615
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -4698,7 +4855,7 @@ function createSourceFromFile(filePath) {
|
|
|
4698
4855
|
function withSourceFiles(pattern2, callback) {
|
|
4699
4856
|
const files = findSourceFiles2(pattern2);
|
|
4700
4857
|
if (files.length === 0) {
|
|
4701
|
-
console.log(
|
|
4858
|
+
console.log(chalk58.yellow("No files found matching pattern"));
|
|
4702
4859
|
return void 0;
|
|
4703
4860
|
}
|
|
4704
4861
|
return callback(files);
|
|
@@ -4731,11 +4888,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4731
4888
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
4732
4889
|
for (const { file, name, complexity } of results) {
|
|
4733
4890
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
4734
|
-
const color = exceedsThreshold ?
|
|
4735
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
4891
|
+
const color = exceedsThreshold ? chalk59.red : chalk59.white;
|
|
4892
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk59.cyan(complexity)}`);
|
|
4736
4893
|
}
|
|
4737
4894
|
console.log(
|
|
4738
|
-
|
|
4895
|
+
chalk59.dim(
|
|
4739
4896
|
`
|
|
4740
4897
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
4741
4898
|
)
|
|
@@ -4747,7 +4904,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
4747
4904
|
}
|
|
4748
4905
|
|
|
4749
4906
|
// src/commands/complexity/halstead.ts
|
|
4750
|
-
import
|
|
4907
|
+
import chalk60 from "chalk";
|
|
4751
4908
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
4752
4909
|
withSourceFiles(pattern2, (files) => {
|
|
4753
4910
|
const results = [];
|
|
@@ -4762,13 +4919,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4762
4919
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
4763
4920
|
for (const { file, name, metrics } of results) {
|
|
4764
4921
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
4765
|
-
const color = exceedsThreshold ?
|
|
4922
|
+
const color = exceedsThreshold ? chalk60.red : chalk60.white;
|
|
4766
4923
|
console.log(
|
|
4767
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
4924
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk60.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk60.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk60.magenta(metrics.effort.toFixed(1))}`
|
|
4768
4925
|
);
|
|
4769
4926
|
}
|
|
4770
4927
|
console.log(
|
|
4771
|
-
|
|
4928
|
+
chalk60.dim(
|
|
4772
4929
|
`
|
|
4773
4930
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
4774
4931
|
)
|
|
@@ -4783,28 +4940,28 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
4783
4940
|
import fs13 from "fs";
|
|
4784
4941
|
|
|
4785
4942
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
4786
|
-
import
|
|
4943
|
+
import chalk61 from "chalk";
|
|
4787
4944
|
function displayMaintainabilityResults(results, threshold) {
|
|
4788
4945
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
4789
4946
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
4790
|
-
console.log(
|
|
4947
|
+
console.log(chalk61.green("All files pass maintainability threshold"));
|
|
4791
4948
|
} else {
|
|
4792
4949
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
4793
|
-
const color = threshold !== void 0 ?
|
|
4950
|
+
const color = threshold !== void 0 ? chalk61.red : chalk61.white;
|
|
4794
4951
|
console.log(
|
|
4795
|
-
`${color(file)} \u2192 avg: ${
|
|
4952
|
+
`${color(file)} \u2192 avg: ${chalk61.cyan(avgMaintainability.toFixed(1))}, min: ${chalk61.yellow(minMaintainability.toFixed(1))}`
|
|
4796
4953
|
);
|
|
4797
4954
|
}
|
|
4798
4955
|
}
|
|
4799
|
-
console.log(
|
|
4956
|
+
console.log(chalk61.dim(`
|
|
4800
4957
|
Analyzed ${results.length} files`));
|
|
4801
4958
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
4802
4959
|
console.error(
|
|
4803
|
-
|
|
4960
|
+
chalk61.red(
|
|
4804
4961
|
`
|
|
4805
4962
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
4806
4963
|
|
|
4807
|
-
\u26A0\uFE0F ${
|
|
4964
|
+
\u26A0\uFE0F ${chalk61.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.`
|
|
4808
4965
|
)
|
|
4809
4966
|
);
|
|
4810
4967
|
process.exit(1);
|
|
@@ -4861,7 +5018,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4861
5018
|
|
|
4862
5019
|
// src/commands/complexity/sloc.ts
|
|
4863
5020
|
import fs14 from "fs";
|
|
4864
|
-
import
|
|
5021
|
+
import chalk62 from "chalk";
|
|
4865
5022
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
4866
5023
|
withSourceFiles(pattern2, (files) => {
|
|
4867
5024
|
const results = [];
|
|
@@ -4877,12 +5034,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4877
5034
|
results.sort((a, b) => b.lines - a.lines);
|
|
4878
5035
|
for (const { file, lines } of results) {
|
|
4879
5036
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
4880
|
-
const color = exceedsThreshold ?
|
|
4881
|
-
console.log(`${color(file)} \u2192 ${
|
|
5037
|
+
const color = exceedsThreshold ? chalk62.red : chalk62.white;
|
|
5038
|
+
console.log(`${color(file)} \u2192 ${chalk62.cyan(lines)} lines`);
|
|
4882
5039
|
}
|
|
4883
5040
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
4884
5041
|
console.log(
|
|
4885
|
-
|
|
5042
|
+
chalk62.dim(`
|
|
4886
5043
|
Total: ${total} lines across ${files.length} files`)
|
|
4887
5044
|
);
|
|
4888
5045
|
if (hasViolation) {
|
|
@@ -4896,21 +5053,21 @@ async function analyze(pattern2) {
|
|
|
4896
5053
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
4897
5054
|
const files = findSourceFiles2(searchPattern);
|
|
4898
5055
|
if (files.length === 0) {
|
|
4899
|
-
console.log(
|
|
5056
|
+
console.log(chalk63.yellow("No files found matching pattern"));
|
|
4900
5057
|
return;
|
|
4901
5058
|
}
|
|
4902
5059
|
if (files.length === 1) {
|
|
4903
5060
|
const file = files[0];
|
|
4904
|
-
console.log(
|
|
5061
|
+
console.log(chalk63.bold.underline("SLOC"));
|
|
4905
5062
|
await sloc(file);
|
|
4906
5063
|
console.log();
|
|
4907
|
-
console.log(
|
|
5064
|
+
console.log(chalk63.bold.underline("Cyclomatic Complexity"));
|
|
4908
5065
|
await cyclomatic(file);
|
|
4909
5066
|
console.log();
|
|
4910
|
-
console.log(
|
|
5067
|
+
console.log(chalk63.bold.underline("Halstead Metrics"));
|
|
4911
5068
|
await halstead(file);
|
|
4912
5069
|
console.log();
|
|
4913
|
-
console.log(
|
|
5070
|
+
console.log(chalk63.bold.underline("Maintainability Index"));
|
|
4914
5071
|
await maintainability(file);
|
|
4915
5072
|
return;
|
|
4916
5073
|
}
|
|
@@ -4938,7 +5095,7 @@ function registerComplexity(program2) {
|
|
|
4938
5095
|
|
|
4939
5096
|
// src/commands/deploy/redirect.ts
|
|
4940
5097
|
import { existsSync as existsSync24, readFileSync as readFileSync19, writeFileSync as writeFileSync17 } from "fs";
|
|
4941
|
-
import
|
|
5098
|
+
import chalk64 from "chalk";
|
|
4942
5099
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
4943
5100
|
if (!window.location.pathname.endsWith('/')) {
|
|
4944
5101
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -4947,22 +5104,22 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
4947
5104
|
function redirect() {
|
|
4948
5105
|
const indexPath = "index.html";
|
|
4949
5106
|
if (!existsSync24(indexPath)) {
|
|
4950
|
-
console.log(
|
|
5107
|
+
console.log(chalk64.yellow("No index.html found"));
|
|
4951
5108
|
return;
|
|
4952
5109
|
}
|
|
4953
5110
|
const content = readFileSync19(indexPath, "utf-8");
|
|
4954
5111
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
4955
|
-
console.log(
|
|
5112
|
+
console.log(chalk64.dim("Trailing slash script already present"));
|
|
4956
5113
|
return;
|
|
4957
5114
|
}
|
|
4958
5115
|
const headCloseIndex = content.indexOf("</head>");
|
|
4959
5116
|
if (headCloseIndex === -1) {
|
|
4960
|
-
console.log(
|
|
5117
|
+
console.log(chalk64.red("Could not find </head> tag in index.html"));
|
|
4961
5118
|
return;
|
|
4962
5119
|
}
|
|
4963
5120
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
4964
5121
|
writeFileSync17(indexPath, newContent);
|
|
4965
|
-
console.log(
|
|
5122
|
+
console.log(chalk64.green("Added trailing slash redirect to index.html"));
|
|
4966
5123
|
}
|
|
4967
5124
|
|
|
4968
5125
|
// src/commands/registerDeploy.ts
|
|
@@ -4989,7 +5146,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
4989
5146
|
|
|
4990
5147
|
// src/commands/devlog/shared.ts
|
|
4991
5148
|
import { execSync as execSync17 } from "child_process";
|
|
4992
|
-
import
|
|
5149
|
+
import chalk65 from "chalk";
|
|
4993
5150
|
|
|
4994
5151
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
4995
5152
|
import { readdirSync, readFileSync as readFileSync20 } from "fs";
|
|
@@ -5076,13 +5233,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
5076
5233
|
}
|
|
5077
5234
|
function printCommitsWithFiles(commits, ignore2, verbose) {
|
|
5078
5235
|
for (const commit2 of commits) {
|
|
5079
|
-
console.log(` ${
|
|
5236
|
+
console.log(` ${chalk65.yellow(commit2.hash)} ${commit2.message}`);
|
|
5080
5237
|
if (verbose) {
|
|
5081
5238
|
const visibleFiles = commit2.files.filter(
|
|
5082
5239
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
5083
5240
|
);
|
|
5084
5241
|
for (const file of visibleFiles) {
|
|
5085
|
-
console.log(` ${
|
|
5242
|
+
console.log(` ${chalk65.dim(file)}`);
|
|
5086
5243
|
}
|
|
5087
5244
|
}
|
|
5088
5245
|
}
|
|
@@ -5107,15 +5264,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
5107
5264
|
}
|
|
5108
5265
|
|
|
5109
5266
|
// src/commands/devlog/list/printDateHeader.ts
|
|
5110
|
-
import
|
|
5267
|
+
import chalk66 from "chalk";
|
|
5111
5268
|
function printDateHeader(date, isSkipped, entries) {
|
|
5112
5269
|
if (isSkipped) {
|
|
5113
|
-
console.log(`${
|
|
5270
|
+
console.log(`${chalk66.bold.blue(date)} ${chalk66.dim("skipped")}`);
|
|
5114
5271
|
} else if (entries && entries.length > 0) {
|
|
5115
|
-
const entryInfo = entries.map((e) => `${
|
|
5116
|
-
console.log(`${
|
|
5272
|
+
const entryInfo = entries.map((e) => `${chalk66.green(e.version)} ${e.title}`).join(" | ");
|
|
5273
|
+
console.log(`${chalk66.bold.blue(date)} ${entryInfo}`);
|
|
5117
5274
|
} else {
|
|
5118
|
-
console.log(`${
|
|
5275
|
+
console.log(`${chalk66.bold.blue(date)} ${chalk66.red("\u26A0 devlog missing")}`);
|
|
5119
5276
|
}
|
|
5120
5277
|
}
|
|
5121
5278
|
|
|
@@ -5218,24 +5375,24 @@ function bumpVersion(version2, type) {
|
|
|
5218
5375
|
|
|
5219
5376
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
5220
5377
|
import { execSync as execSync20 } from "child_process";
|
|
5221
|
-
import
|
|
5378
|
+
import chalk68 from "chalk";
|
|
5222
5379
|
|
|
5223
5380
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
5224
|
-
import
|
|
5381
|
+
import chalk67 from "chalk";
|
|
5225
5382
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
5226
5383
|
if (conventional && firstHash) {
|
|
5227
5384
|
const version2 = getVersionAtCommit(firstHash);
|
|
5228
5385
|
if (version2) {
|
|
5229
|
-
console.log(`${
|
|
5386
|
+
console.log(`${chalk67.bold("version:")} ${stripToMinor(version2)}`);
|
|
5230
5387
|
} else {
|
|
5231
|
-
console.log(`${
|
|
5388
|
+
console.log(`${chalk67.bold("version:")} ${chalk67.red("unknown")}`);
|
|
5232
5389
|
}
|
|
5233
5390
|
} else if (patchVersion && minorVersion) {
|
|
5234
5391
|
console.log(
|
|
5235
|
-
`${
|
|
5392
|
+
`${chalk67.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
5236
5393
|
);
|
|
5237
5394
|
} else {
|
|
5238
|
-
console.log(`${
|
|
5395
|
+
console.log(`${chalk67.bold("version:")} v0.1 (initial)`);
|
|
5239
5396
|
}
|
|
5240
5397
|
}
|
|
5241
5398
|
|
|
@@ -5282,16 +5439,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
5282
5439
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
5283
5440
|
}
|
|
5284
5441
|
function logName(repoName) {
|
|
5285
|
-
console.log(`${
|
|
5442
|
+
console.log(`${chalk68.bold("name:")} ${repoName}`);
|
|
5286
5443
|
}
|
|
5287
5444
|
function displayNextEntry(ctx, targetDate, commits) {
|
|
5288
5445
|
logName(ctx.repoName);
|
|
5289
5446
|
printVersionInfo(ctx.config, ctx.lastInfo, commits[0]?.hash);
|
|
5290
|
-
console.log(
|
|
5447
|
+
console.log(chalk68.bold.blue(targetDate));
|
|
5291
5448
|
printCommitsWithFiles(commits, ctx.ignore, ctx.verbose);
|
|
5292
5449
|
}
|
|
5293
5450
|
function logNoCommits(lastInfo) {
|
|
5294
|
-
console.log(
|
|
5451
|
+
console.log(chalk68.dim(noCommitsMessage(!!lastInfo)));
|
|
5295
5452
|
}
|
|
5296
5453
|
|
|
5297
5454
|
// src/commands/devlog/next/index.ts
|
|
@@ -5332,11 +5489,11 @@ function next2(options2) {
|
|
|
5332
5489
|
import { execSync as execSync21 } from "child_process";
|
|
5333
5490
|
|
|
5334
5491
|
// src/commands/devlog/repos/printReposTable.ts
|
|
5335
|
-
import
|
|
5492
|
+
import chalk69 from "chalk";
|
|
5336
5493
|
function colorStatus(status2) {
|
|
5337
|
-
if (status2 === "missing") return
|
|
5338
|
-
if (status2 === "outdated") return
|
|
5339
|
-
return
|
|
5494
|
+
if (status2 === "missing") return chalk69.red(status2);
|
|
5495
|
+
if (status2 === "outdated") return chalk69.yellow(status2);
|
|
5496
|
+
return chalk69.green(status2);
|
|
5340
5497
|
}
|
|
5341
5498
|
function formatRow(row, nameWidth) {
|
|
5342
5499
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -5350,8 +5507,8 @@ function printReposTable(rows) {
|
|
|
5350
5507
|
"Last Devlog".padEnd(11),
|
|
5351
5508
|
"Status"
|
|
5352
5509
|
].join(" ");
|
|
5353
|
-
console.log(
|
|
5354
|
-
console.log(
|
|
5510
|
+
console.log(chalk69.dim(header));
|
|
5511
|
+
console.log(chalk69.dim("-".repeat(header.length)));
|
|
5355
5512
|
for (const row of rows) {
|
|
5356
5513
|
console.log(formatRow(row, nameWidth));
|
|
5357
5514
|
}
|
|
@@ -5409,14 +5566,14 @@ function repos(options2) {
|
|
|
5409
5566
|
// src/commands/devlog/skip.ts
|
|
5410
5567
|
import { writeFileSync as writeFileSync18 } from "fs";
|
|
5411
5568
|
import { join as join17 } from "path";
|
|
5412
|
-
import
|
|
5569
|
+
import chalk70 from "chalk";
|
|
5413
5570
|
import { stringify as stringifyYaml4 } from "yaml";
|
|
5414
5571
|
function getBlogConfigPath() {
|
|
5415
5572
|
return join17(BLOG_REPO_ROOT, "assist.yml");
|
|
5416
5573
|
}
|
|
5417
5574
|
function skip(date) {
|
|
5418
5575
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
5419
|
-
console.log(
|
|
5576
|
+
console.log(chalk70.red("Invalid date format. Use YYYY-MM-DD"));
|
|
5420
5577
|
process.exit(1);
|
|
5421
5578
|
}
|
|
5422
5579
|
const repoName = getRepoName();
|
|
@@ -5427,7 +5584,7 @@ function skip(date) {
|
|
|
5427
5584
|
const skipDays = skip2[repoName] ?? [];
|
|
5428
5585
|
if (skipDays.includes(date)) {
|
|
5429
5586
|
console.log(
|
|
5430
|
-
|
|
5587
|
+
chalk70.yellow(`${date} is already in skip list for ${repoName}`)
|
|
5431
5588
|
);
|
|
5432
5589
|
return;
|
|
5433
5590
|
}
|
|
@@ -5437,20 +5594,20 @@ function skip(date) {
|
|
|
5437
5594
|
devlog.skip = skip2;
|
|
5438
5595
|
config.devlog = devlog;
|
|
5439
5596
|
writeFileSync18(configPath, stringifyYaml4(config, { lineWidth: 0 }));
|
|
5440
|
-
console.log(
|
|
5597
|
+
console.log(chalk70.green(`Added ${date} to skip list for ${repoName}`));
|
|
5441
5598
|
}
|
|
5442
5599
|
|
|
5443
5600
|
// src/commands/devlog/version.ts
|
|
5444
|
-
import
|
|
5601
|
+
import chalk71 from "chalk";
|
|
5445
5602
|
function version() {
|
|
5446
5603
|
const config = loadConfig();
|
|
5447
5604
|
const name = getRepoName();
|
|
5448
5605
|
const lastInfo = getLastVersionInfo(name, config);
|
|
5449
5606
|
const lastVersion = lastInfo?.version ?? null;
|
|
5450
5607
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
5451
|
-
console.log(`${
|
|
5452
|
-
console.log(`${
|
|
5453
|
-
console.log(`${
|
|
5608
|
+
console.log(`${chalk71.bold("name:")} ${name}`);
|
|
5609
|
+
console.log(`${chalk71.bold("last:")} ${lastVersion ?? chalk71.dim("none")}`);
|
|
5610
|
+
console.log(`${chalk71.bold("next:")} ${nextVersion ?? chalk71.dim("none")}`);
|
|
5454
5611
|
}
|
|
5455
5612
|
|
|
5456
5613
|
// src/commands/registerDevlog.ts
|
|
@@ -5474,7 +5631,7 @@ function registerDevlog(program2) {
|
|
|
5474
5631
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
5475
5632
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
5476
5633
|
import { join as join18 } from "path";
|
|
5477
|
-
import
|
|
5634
|
+
import chalk72 from "chalk";
|
|
5478
5635
|
|
|
5479
5636
|
// src/shared/findRepoRoot.ts
|
|
5480
5637
|
import { existsSync as existsSync25 } from "fs";
|
|
@@ -5537,14 +5694,14 @@ function checkBuildLocks(startDir) {
|
|
|
5537
5694
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
5538
5695
|
if (locked) {
|
|
5539
5696
|
console.error(
|
|
5540
|
-
|
|
5697
|
+
chalk72.red("Build output locked (is VS debugging?): ") + locked
|
|
5541
5698
|
);
|
|
5542
5699
|
process.exit(1);
|
|
5543
5700
|
}
|
|
5544
5701
|
}
|
|
5545
5702
|
async function checkBuildLocksCommand() {
|
|
5546
5703
|
checkBuildLocks();
|
|
5547
|
-
console.log(
|
|
5704
|
+
console.log(chalk72.green("No build locks detected"));
|
|
5548
5705
|
}
|
|
5549
5706
|
|
|
5550
5707
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -5643,30 +5800,30 @@ function escapeRegex(s) {
|
|
|
5643
5800
|
}
|
|
5644
5801
|
|
|
5645
5802
|
// src/commands/dotnet/printTree.ts
|
|
5646
|
-
import
|
|
5803
|
+
import chalk73 from "chalk";
|
|
5647
5804
|
function printNodes(nodes, prefix2) {
|
|
5648
5805
|
for (let i = 0; i < nodes.length; i++) {
|
|
5649
5806
|
const isLast = i === nodes.length - 1;
|
|
5650
5807
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
5651
5808
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
5652
5809
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
5653
|
-
const label2 = isMissing ?
|
|
5810
|
+
const label2 = isMissing ? chalk73.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
5654
5811
|
console.log(`${prefix2}${connector}${label2}`);
|
|
5655
5812
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
5656
5813
|
}
|
|
5657
5814
|
}
|
|
5658
5815
|
function printTree(tree, totalCount, solutions) {
|
|
5659
|
-
console.log(
|
|
5660
|
-
console.log(
|
|
5816
|
+
console.log(chalk73.bold("\nProject Dependency Tree"));
|
|
5817
|
+
console.log(chalk73.cyan(tree.relativePath));
|
|
5661
5818
|
printNodes(tree.children, "");
|
|
5662
|
-
console.log(
|
|
5819
|
+
console.log(chalk73.dim(`
|
|
5663
5820
|
${totalCount} projects total (including root)`));
|
|
5664
|
-
console.log(
|
|
5821
|
+
console.log(chalk73.bold("\nSolution Membership"));
|
|
5665
5822
|
if (solutions.length === 0) {
|
|
5666
|
-
console.log(
|
|
5823
|
+
console.log(chalk73.yellow(" Not found in any .sln"));
|
|
5667
5824
|
} else {
|
|
5668
5825
|
for (const sln of solutions) {
|
|
5669
|
-
console.log(` ${
|
|
5826
|
+
console.log(` ${chalk73.green(sln)}`);
|
|
5670
5827
|
}
|
|
5671
5828
|
}
|
|
5672
5829
|
console.log();
|
|
@@ -5695,16 +5852,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
5695
5852
|
// src/commands/dotnet/resolveCsproj.ts
|
|
5696
5853
|
import { existsSync as existsSync26 } from "fs";
|
|
5697
5854
|
import path24 from "path";
|
|
5698
|
-
import
|
|
5855
|
+
import chalk74 from "chalk";
|
|
5699
5856
|
function resolveCsproj(csprojPath) {
|
|
5700
5857
|
const resolved = path24.resolve(csprojPath);
|
|
5701
5858
|
if (!existsSync26(resolved)) {
|
|
5702
|
-
console.error(
|
|
5859
|
+
console.error(chalk74.red(`File not found: ${resolved}`));
|
|
5703
5860
|
process.exit(1);
|
|
5704
5861
|
}
|
|
5705
5862
|
const repoRoot = findRepoRoot(path24.dirname(resolved));
|
|
5706
5863
|
if (!repoRoot) {
|
|
5707
|
-
console.error(
|
|
5864
|
+
console.error(chalk74.red("Could not find git repository root"));
|
|
5708
5865
|
process.exit(1);
|
|
5709
5866
|
}
|
|
5710
5867
|
return { resolved, repoRoot };
|
|
@@ -5754,12 +5911,12 @@ function getChangedCsFiles(scope) {
|
|
|
5754
5911
|
}
|
|
5755
5912
|
|
|
5756
5913
|
// src/commands/dotnet/inSln.ts
|
|
5757
|
-
import
|
|
5914
|
+
import chalk75 from "chalk";
|
|
5758
5915
|
async function inSln(csprojPath) {
|
|
5759
5916
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
5760
5917
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
5761
5918
|
if (solutions.length === 0) {
|
|
5762
|
-
console.log(
|
|
5919
|
+
console.log(chalk75.yellow("Not found in any .sln file"));
|
|
5763
5920
|
process.exit(1);
|
|
5764
5921
|
}
|
|
5765
5922
|
for (const sln of solutions) {
|
|
@@ -5768,7 +5925,7 @@ async function inSln(csprojPath) {
|
|
|
5768
5925
|
}
|
|
5769
5926
|
|
|
5770
5927
|
// src/commands/dotnet/inspect.ts
|
|
5771
|
-
import
|
|
5928
|
+
import chalk81 from "chalk";
|
|
5772
5929
|
|
|
5773
5930
|
// src/shared/formatElapsed.ts
|
|
5774
5931
|
function formatElapsed(ms) {
|
|
@@ -5780,12 +5937,12 @@ function formatElapsed(ms) {
|
|
|
5780
5937
|
}
|
|
5781
5938
|
|
|
5782
5939
|
// src/commands/dotnet/displayIssues.ts
|
|
5783
|
-
import
|
|
5940
|
+
import chalk76 from "chalk";
|
|
5784
5941
|
var SEVERITY_COLOR = {
|
|
5785
|
-
ERROR:
|
|
5786
|
-
WARNING:
|
|
5787
|
-
SUGGESTION:
|
|
5788
|
-
HINT:
|
|
5942
|
+
ERROR: chalk76.red,
|
|
5943
|
+
WARNING: chalk76.yellow,
|
|
5944
|
+
SUGGESTION: chalk76.cyan,
|
|
5945
|
+
HINT: chalk76.dim
|
|
5789
5946
|
};
|
|
5790
5947
|
function groupByFile(issues) {
|
|
5791
5948
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -5801,15 +5958,15 @@ function groupByFile(issues) {
|
|
|
5801
5958
|
}
|
|
5802
5959
|
function displayIssues(issues) {
|
|
5803
5960
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
5804
|
-
console.log(
|
|
5961
|
+
console.log(chalk76.bold(file));
|
|
5805
5962
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
5806
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
5963
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk76.white;
|
|
5807
5964
|
console.log(
|
|
5808
|
-
` ${
|
|
5965
|
+
` ${chalk76.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
5809
5966
|
);
|
|
5810
5967
|
}
|
|
5811
5968
|
}
|
|
5812
|
-
console.log(
|
|
5969
|
+
console.log(chalk76.dim(`
|
|
5813
5970
|
${issues.length} issue(s) found`));
|
|
5814
5971
|
}
|
|
5815
5972
|
|
|
@@ -5868,12 +6025,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
5868
6025
|
// src/commands/dotnet/resolveSolution.ts
|
|
5869
6026
|
import { existsSync as existsSync27 } from "fs";
|
|
5870
6027
|
import path25 from "path";
|
|
5871
|
-
import
|
|
6028
|
+
import chalk78 from "chalk";
|
|
5872
6029
|
|
|
5873
6030
|
// src/commands/dotnet/findSolution.ts
|
|
5874
6031
|
import { readdirSync as readdirSync4 } from "fs";
|
|
5875
6032
|
import { dirname as dirname16, join as join19 } from "path";
|
|
5876
|
-
import
|
|
6033
|
+
import chalk77 from "chalk";
|
|
5877
6034
|
function findSlnInDir(dir) {
|
|
5878
6035
|
try {
|
|
5879
6036
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join19(dir, f));
|
|
@@ -5889,17 +6046,17 @@ function findSolution() {
|
|
|
5889
6046
|
const slnFiles = findSlnInDir(current);
|
|
5890
6047
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
5891
6048
|
if (slnFiles.length > 1) {
|
|
5892
|
-
console.error(
|
|
6049
|
+
console.error(chalk77.red(`Multiple .sln files found in ${current}:`));
|
|
5893
6050
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
5894
6051
|
console.error(
|
|
5895
|
-
|
|
6052
|
+
chalk77.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
5896
6053
|
);
|
|
5897
6054
|
process.exit(1);
|
|
5898
6055
|
}
|
|
5899
6056
|
if (current === ceiling) break;
|
|
5900
6057
|
current = dirname16(current);
|
|
5901
6058
|
}
|
|
5902
|
-
console.error(
|
|
6059
|
+
console.error(chalk77.red("No .sln file found between cwd and repo root"));
|
|
5903
6060
|
process.exit(1);
|
|
5904
6061
|
}
|
|
5905
6062
|
|
|
@@ -5908,7 +6065,7 @@ function resolveSolution(sln) {
|
|
|
5908
6065
|
if (sln) {
|
|
5909
6066
|
const resolved = path25.resolve(sln);
|
|
5910
6067
|
if (!existsSync27(resolved)) {
|
|
5911
|
-
console.error(
|
|
6068
|
+
console.error(chalk78.red(`Solution file not found: ${resolved}`));
|
|
5912
6069
|
process.exit(1);
|
|
5913
6070
|
}
|
|
5914
6071
|
return resolved;
|
|
@@ -5950,14 +6107,14 @@ import { execSync as execSync23 } from "child_process";
|
|
|
5950
6107
|
import { existsSync as existsSync28, readFileSync as readFileSync23, unlinkSync as unlinkSync5 } from "fs";
|
|
5951
6108
|
import { tmpdir as tmpdir2 } from "os";
|
|
5952
6109
|
import path26 from "path";
|
|
5953
|
-
import
|
|
6110
|
+
import chalk79 from "chalk";
|
|
5954
6111
|
function assertJbInstalled() {
|
|
5955
6112
|
try {
|
|
5956
6113
|
execSync23("jb inspectcode --version", { stdio: "pipe" });
|
|
5957
6114
|
} catch {
|
|
5958
|
-
console.error(
|
|
6115
|
+
console.error(chalk79.red("jb is not installed. Install with:"));
|
|
5959
6116
|
console.error(
|
|
5960
|
-
|
|
6117
|
+
chalk79.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
5961
6118
|
);
|
|
5962
6119
|
process.exit(1);
|
|
5963
6120
|
}
|
|
@@ -5975,11 +6132,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
5975
6132
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
5976
6133
|
process.stderr.write(err.stderr);
|
|
5977
6134
|
}
|
|
5978
|
-
console.error(
|
|
6135
|
+
console.error(chalk79.red("jb inspectcode failed"));
|
|
5979
6136
|
process.exit(1);
|
|
5980
6137
|
}
|
|
5981
6138
|
if (!existsSync28(reportPath)) {
|
|
5982
|
-
console.error(
|
|
6139
|
+
console.error(chalk79.red("Report file not generated"));
|
|
5983
6140
|
process.exit(1);
|
|
5984
6141
|
}
|
|
5985
6142
|
const xml = readFileSync23(reportPath, "utf-8");
|
|
@@ -5989,7 +6146,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
5989
6146
|
|
|
5990
6147
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
5991
6148
|
import { execSync as execSync24 } from "child_process";
|
|
5992
|
-
import
|
|
6149
|
+
import chalk80 from "chalk";
|
|
5993
6150
|
function resolveMsbuildPath() {
|
|
5994
6151
|
const config = loadConfig();
|
|
5995
6152
|
const buildConfig = config.run?.find((r) => r.name === "build");
|
|
@@ -6000,9 +6157,9 @@ function assertMsbuildInstalled() {
|
|
|
6000
6157
|
try {
|
|
6001
6158
|
execSync24(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
6002
6159
|
} catch {
|
|
6003
|
-
console.error(
|
|
6160
|
+
console.error(chalk80.red(`msbuild not found at: ${msbuild}`));
|
|
6004
6161
|
console.error(
|
|
6005
|
-
|
|
6162
|
+
chalk80.yellow(
|
|
6006
6163
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
6007
6164
|
)
|
|
6008
6165
|
);
|
|
@@ -6049,17 +6206,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
6049
6206
|
// src/commands/dotnet/inspect.ts
|
|
6050
6207
|
function logScope(changedFiles) {
|
|
6051
6208
|
if (changedFiles === null) {
|
|
6052
|
-
console.log(
|
|
6209
|
+
console.log(chalk81.dim("Inspecting full solution..."));
|
|
6053
6210
|
} else {
|
|
6054
6211
|
console.log(
|
|
6055
|
-
|
|
6212
|
+
chalk81.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
6056
6213
|
);
|
|
6057
6214
|
}
|
|
6058
6215
|
}
|
|
6059
6216
|
function reportResults(issues, elapsed) {
|
|
6060
6217
|
if (issues.length > 0) displayIssues(issues);
|
|
6061
|
-
else console.log(
|
|
6062
|
-
console.log(
|
|
6218
|
+
else console.log(chalk81.green("No issues found"));
|
|
6219
|
+
console.log(chalk81.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
6063
6220
|
if (issues.length > 0) process.exit(1);
|
|
6064
6221
|
}
|
|
6065
6222
|
async function inspect(sln, options2) {
|
|
@@ -6070,7 +6227,7 @@ async function inspect(sln, options2) {
|
|
|
6070
6227
|
const scope = parseScope(options2.scope);
|
|
6071
6228
|
const changedFiles = getChangedCsFiles(scope);
|
|
6072
6229
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
6073
|
-
console.log(
|
|
6230
|
+
console.log(chalk81.green("No changed .cs files found"));
|
|
6074
6231
|
return;
|
|
6075
6232
|
}
|
|
6076
6233
|
logScope(changedFiles);
|
|
@@ -6096,7 +6253,7 @@ function registerDotnet(program2) {
|
|
|
6096
6253
|
}
|
|
6097
6254
|
|
|
6098
6255
|
// src/commands/jira/acceptanceCriteria.ts
|
|
6099
|
-
import
|
|
6256
|
+
import chalk83 from "chalk";
|
|
6100
6257
|
|
|
6101
6258
|
// src/commands/jira/adfToText.ts
|
|
6102
6259
|
function renderInline(node) {
|
|
@@ -6157,7 +6314,7 @@ function adfToText(doc) {
|
|
|
6157
6314
|
|
|
6158
6315
|
// src/commands/jira/fetchIssue.ts
|
|
6159
6316
|
import { execSync as execSync25 } from "child_process";
|
|
6160
|
-
import
|
|
6317
|
+
import chalk82 from "chalk";
|
|
6161
6318
|
function fetchIssue(issueKey, fields) {
|
|
6162
6319
|
let result;
|
|
6163
6320
|
try {
|
|
@@ -6170,15 +6327,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
6170
6327
|
const stderr = error.stderr;
|
|
6171
6328
|
if (stderr.includes("unauthorized")) {
|
|
6172
6329
|
console.error(
|
|
6173
|
-
|
|
6330
|
+
chalk82.red("Jira authentication expired."),
|
|
6174
6331
|
"Run",
|
|
6175
|
-
|
|
6332
|
+
chalk82.cyan("assist jira auth"),
|
|
6176
6333
|
"to re-authenticate."
|
|
6177
6334
|
);
|
|
6178
6335
|
process.exit(1);
|
|
6179
6336
|
}
|
|
6180
6337
|
}
|
|
6181
|
-
console.error(
|
|
6338
|
+
console.error(chalk82.red(`Failed to fetch ${issueKey}.`));
|
|
6182
6339
|
process.exit(1);
|
|
6183
6340
|
}
|
|
6184
6341
|
return JSON.parse(result);
|
|
@@ -6192,7 +6349,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
6192
6349
|
const parsed = fetchIssue(issueKey, field);
|
|
6193
6350
|
const acValue = parsed?.fields?.[field];
|
|
6194
6351
|
if (!acValue) {
|
|
6195
|
-
console.log(
|
|
6352
|
+
console.log(chalk83.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
6196
6353
|
return;
|
|
6197
6354
|
}
|
|
6198
6355
|
if (typeof acValue === "string") {
|
|
@@ -6287,14 +6444,14 @@ async function jiraAuth() {
|
|
|
6287
6444
|
}
|
|
6288
6445
|
|
|
6289
6446
|
// src/commands/jira/viewIssue.ts
|
|
6290
|
-
import
|
|
6447
|
+
import chalk84 from "chalk";
|
|
6291
6448
|
function viewIssue(issueKey) {
|
|
6292
6449
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
6293
6450
|
const fields = parsed?.fields;
|
|
6294
6451
|
const summary = fields?.summary;
|
|
6295
6452
|
const description = fields?.description;
|
|
6296
6453
|
if (summary) {
|
|
6297
|
-
console.log(
|
|
6454
|
+
console.log(chalk84.bold(summary));
|
|
6298
6455
|
}
|
|
6299
6456
|
if (description) {
|
|
6300
6457
|
if (summary) console.log();
|
|
@@ -6308,7 +6465,7 @@ function viewIssue(issueKey) {
|
|
|
6308
6465
|
}
|
|
6309
6466
|
if (!summary && !description) {
|
|
6310
6467
|
console.log(
|
|
6311
|
-
|
|
6468
|
+
chalk84.yellow(`No summary or description found on ${issueKey}.`)
|
|
6312
6469
|
);
|
|
6313
6470
|
}
|
|
6314
6471
|
}
|
|
@@ -6322,7 +6479,7 @@ function registerJira(program2) {
|
|
|
6322
6479
|
}
|
|
6323
6480
|
|
|
6324
6481
|
// src/commands/news/add/index.ts
|
|
6325
|
-
import
|
|
6482
|
+
import chalk85 from "chalk";
|
|
6326
6483
|
import enquirer7 from "enquirer";
|
|
6327
6484
|
async function add2(url) {
|
|
6328
6485
|
if (!url) {
|
|
@@ -6345,17 +6502,17 @@ async function add2(url) {
|
|
|
6345
6502
|
const news = config.news ?? {};
|
|
6346
6503
|
const feeds = news.feeds ?? [];
|
|
6347
6504
|
if (feeds.includes(url)) {
|
|
6348
|
-
console.log(
|
|
6505
|
+
console.log(chalk85.yellow("Feed already exists in config"));
|
|
6349
6506
|
return;
|
|
6350
6507
|
}
|
|
6351
6508
|
feeds.push(url);
|
|
6352
6509
|
config.news = { ...news, feeds };
|
|
6353
6510
|
saveGlobalConfig(config);
|
|
6354
|
-
console.log(
|
|
6511
|
+
console.log(chalk85.green(`Added feed: ${url}`));
|
|
6355
6512
|
}
|
|
6356
6513
|
|
|
6357
6514
|
// src/commands/news/web/handleRequest.ts
|
|
6358
|
-
import
|
|
6515
|
+
import chalk86 from "chalk";
|
|
6359
6516
|
|
|
6360
6517
|
// src/commands/news/web/shared.ts
|
|
6361
6518
|
import { decodeHTML } from "entities";
|
|
@@ -6491,17 +6648,17 @@ function prefetch() {
|
|
|
6491
6648
|
const config = loadConfig();
|
|
6492
6649
|
const total = config.news.feeds.length;
|
|
6493
6650
|
if (total === 0) return;
|
|
6494
|
-
process.stdout.write(
|
|
6651
|
+
process.stdout.write(chalk86.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
6495
6652
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
6496
6653
|
const width = 20;
|
|
6497
6654
|
const filled = Math.round(done2 / t * width);
|
|
6498
6655
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
6499
6656
|
process.stdout.write(
|
|
6500
|
-
`\r${
|
|
6657
|
+
`\r${chalk86.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
6501
6658
|
);
|
|
6502
6659
|
}).then((items) => {
|
|
6503
6660
|
process.stdout.write(
|
|
6504
|
-
`\r${
|
|
6661
|
+
`\r${chalk86.green(`Fetched ${items.length} items from ${total} feed(s)`)}
|
|
6505
6662
|
`
|
|
6506
6663
|
);
|
|
6507
6664
|
cachedItems = items;
|
|
@@ -6862,20 +7019,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
6862
7019
|
}
|
|
6863
7020
|
|
|
6864
7021
|
// src/commands/prs/listComments/printComments.ts
|
|
6865
|
-
import
|
|
7022
|
+
import chalk87 from "chalk";
|
|
6866
7023
|
function formatForHuman(comment3) {
|
|
6867
7024
|
if (comment3.type === "review") {
|
|
6868
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
7025
|
+
const stateColor = comment3.state === "APPROVED" ? chalk87.green : comment3.state === "CHANGES_REQUESTED" ? chalk87.red : chalk87.yellow;
|
|
6869
7026
|
return [
|
|
6870
|
-
`${
|
|
7027
|
+
`${chalk87.cyan("Review")} by ${chalk87.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
6871
7028
|
comment3.body,
|
|
6872
7029
|
""
|
|
6873
7030
|
].join("\n");
|
|
6874
7031
|
}
|
|
6875
7032
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
6876
7033
|
return [
|
|
6877
|
-
`${
|
|
6878
|
-
|
|
7034
|
+
`${chalk87.cyan("Line comment")} by ${chalk87.bold(comment3.user)} on ${chalk87.dim(`${comment3.path}${location}`)}`,
|
|
7035
|
+
chalk87.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
6879
7036
|
comment3.body,
|
|
6880
7037
|
""
|
|
6881
7038
|
].join("\n");
|
|
@@ -6965,13 +7122,13 @@ import { execSync as execSync32 } from "child_process";
|
|
|
6965
7122
|
import enquirer8 from "enquirer";
|
|
6966
7123
|
|
|
6967
7124
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
6968
|
-
import
|
|
7125
|
+
import chalk88 from "chalk";
|
|
6969
7126
|
var STATUS_MAP = {
|
|
6970
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
6971
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
7127
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk88.magenta("merged"), date: pr.mergedAt } : null,
|
|
7128
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk88.red("closed"), date: pr.closedAt } : null
|
|
6972
7129
|
};
|
|
6973
7130
|
function defaultStatus(pr) {
|
|
6974
|
-
return { label:
|
|
7131
|
+
return { label: chalk88.green("opened"), date: pr.createdAt };
|
|
6975
7132
|
}
|
|
6976
7133
|
function getStatus2(pr) {
|
|
6977
7134
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -6980,11 +7137,11 @@ function formatDate(dateStr) {
|
|
|
6980
7137
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
6981
7138
|
}
|
|
6982
7139
|
function formatPrHeader(pr, status2) {
|
|
6983
|
-
return `${
|
|
7140
|
+
return `${chalk88.cyan(`#${pr.number}`)} ${pr.title} ${chalk88.dim(`(${pr.author.login},`)} ${status2.label} ${chalk88.dim(`${formatDate(status2.date)})`)}`;
|
|
6984
7141
|
}
|
|
6985
7142
|
function logPrDetails(pr) {
|
|
6986
7143
|
console.log(
|
|
6987
|
-
|
|
7144
|
+
chalk88.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
6988
7145
|
);
|
|
6989
7146
|
console.log();
|
|
6990
7147
|
}
|
|
@@ -7150,10 +7307,10 @@ function registerPrs(program2) {
|
|
|
7150
7307
|
}
|
|
7151
7308
|
|
|
7152
7309
|
// src/commands/ravendb/ravendbAuth.ts
|
|
7153
|
-
import
|
|
7310
|
+
import chalk94 from "chalk";
|
|
7154
7311
|
|
|
7155
7312
|
// src/shared/createConnectionAuth.ts
|
|
7156
|
-
import
|
|
7313
|
+
import chalk89 from "chalk";
|
|
7157
7314
|
function listConnections(connections, format2) {
|
|
7158
7315
|
if (connections.length === 0) {
|
|
7159
7316
|
console.log("No connections configured.");
|
|
@@ -7166,7 +7323,7 @@ function listConnections(connections, format2) {
|
|
|
7166
7323
|
function removeConnection(connections, name, save) {
|
|
7167
7324
|
const filtered = connections.filter((c) => c.name !== name);
|
|
7168
7325
|
if (filtered.length === connections.length) {
|
|
7169
|
-
console.error(
|
|
7326
|
+
console.error(chalk89.red(`Connection "${name}" not found.`));
|
|
7170
7327
|
process.exit(1);
|
|
7171
7328
|
}
|
|
7172
7329
|
save(filtered);
|
|
@@ -7212,15 +7369,15 @@ function saveConnections(connections) {
|
|
|
7212
7369
|
}
|
|
7213
7370
|
|
|
7214
7371
|
// src/commands/ravendb/promptConnection.ts
|
|
7215
|
-
import
|
|
7372
|
+
import chalk92 from "chalk";
|
|
7216
7373
|
|
|
7217
7374
|
// src/commands/ravendb/selectOpSecret.ts
|
|
7218
|
-
import
|
|
7375
|
+
import chalk91 from "chalk";
|
|
7219
7376
|
import Enquirer2 from "enquirer";
|
|
7220
7377
|
|
|
7221
7378
|
// src/commands/ravendb/searchItems.ts
|
|
7222
7379
|
import { execSync as execSync34 } from "child_process";
|
|
7223
|
-
import
|
|
7380
|
+
import chalk90 from "chalk";
|
|
7224
7381
|
function opExec(args) {
|
|
7225
7382
|
return execSync34(`op ${args}`, {
|
|
7226
7383
|
encoding: "utf-8",
|
|
@@ -7233,7 +7390,7 @@ function searchItems(search) {
|
|
|
7233
7390
|
items = JSON.parse(opExec("item list --format=json"));
|
|
7234
7391
|
} catch {
|
|
7235
7392
|
console.error(
|
|
7236
|
-
|
|
7393
|
+
chalk90.red(
|
|
7237
7394
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
7238
7395
|
)
|
|
7239
7396
|
);
|
|
@@ -7247,7 +7404,7 @@ function getItemFields(itemId) {
|
|
|
7247
7404
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
7248
7405
|
return item.fields.filter((f) => f.reference && f.label);
|
|
7249
7406
|
} catch {
|
|
7250
|
-
console.error(
|
|
7407
|
+
console.error(chalk90.red("Failed to get item details from 1Password."));
|
|
7251
7408
|
process.exit(1);
|
|
7252
7409
|
}
|
|
7253
7410
|
}
|
|
@@ -7266,7 +7423,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7266
7423
|
}).run();
|
|
7267
7424
|
const items = searchItems(search);
|
|
7268
7425
|
if (items.length === 0) {
|
|
7269
|
-
console.error(
|
|
7426
|
+
console.error(chalk91.red(`No items found matching "${search}".`));
|
|
7270
7427
|
process.exit(1);
|
|
7271
7428
|
}
|
|
7272
7429
|
const itemId = await selectOne(
|
|
@@ -7275,7 +7432,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7275
7432
|
);
|
|
7276
7433
|
const fields = getItemFields(itemId);
|
|
7277
7434
|
if (fields.length === 0) {
|
|
7278
|
-
console.error(
|
|
7435
|
+
console.error(chalk91.red("No fields with references found on this item."));
|
|
7279
7436
|
process.exit(1);
|
|
7280
7437
|
}
|
|
7281
7438
|
const ref = await selectOne(
|
|
@@ -7289,7 +7446,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7289
7446
|
async function promptConnection(existingNames) {
|
|
7290
7447
|
const name = await promptInput("name", "Connection name:");
|
|
7291
7448
|
if (existingNames.includes(name)) {
|
|
7292
|
-
console.error(
|
|
7449
|
+
console.error(chalk92.red(`Connection "${name}" already exists.`));
|
|
7293
7450
|
process.exit(1);
|
|
7294
7451
|
}
|
|
7295
7452
|
const url = await promptInput(
|
|
@@ -7298,22 +7455,22 @@ async function promptConnection(existingNames) {
|
|
|
7298
7455
|
);
|
|
7299
7456
|
const database = await promptInput("database", "Database name:");
|
|
7300
7457
|
if (!name || !url || !database) {
|
|
7301
|
-
console.error(
|
|
7458
|
+
console.error(chalk92.red("All fields are required."));
|
|
7302
7459
|
process.exit(1);
|
|
7303
7460
|
}
|
|
7304
7461
|
const apiKeyRef = await selectOpSecret();
|
|
7305
|
-
console.log(
|
|
7462
|
+
console.log(chalk92.dim(`Using: ${apiKeyRef}`));
|
|
7306
7463
|
return { name, url, database, apiKeyRef };
|
|
7307
7464
|
}
|
|
7308
7465
|
|
|
7309
7466
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
7310
|
-
import
|
|
7467
|
+
import chalk93 from "chalk";
|
|
7311
7468
|
function ravendbSetConnection(name) {
|
|
7312
7469
|
const raw = loadGlobalConfigRaw();
|
|
7313
7470
|
const ravendb = raw.ravendb ?? {};
|
|
7314
7471
|
const connections = ravendb.connections ?? [];
|
|
7315
7472
|
if (!connections.some((c) => c.name === name)) {
|
|
7316
|
-
console.error(
|
|
7473
|
+
console.error(chalk93.red(`Connection "${name}" not found.`));
|
|
7317
7474
|
console.error(
|
|
7318
7475
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
7319
7476
|
);
|
|
@@ -7329,16 +7486,16 @@ function ravendbSetConnection(name) {
|
|
|
7329
7486
|
var ravendbAuth = createConnectionAuth({
|
|
7330
7487
|
load: loadConnections,
|
|
7331
7488
|
save: saveConnections,
|
|
7332
|
-
format: (c) => `${
|
|
7489
|
+
format: (c) => `${chalk94.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
7333
7490
|
promptNew: promptConnection,
|
|
7334
7491
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
7335
7492
|
});
|
|
7336
7493
|
|
|
7337
7494
|
// src/commands/ravendb/ravendbCollections.ts
|
|
7338
|
-
import
|
|
7495
|
+
import chalk98 from "chalk";
|
|
7339
7496
|
|
|
7340
7497
|
// src/commands/ravendb/ravenFetch.ts
|
|
7341
|
-
import
|
|
7498
|
+
import chalk96 from "chalk";
|
|
7342
7499
|
|
|
7343
7500
|
// src/commands/ravendb/getAccessToken.ts
|
|
7344
7501
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -7375,10 +7532,10 @@ ${errorText}`
|
|
|
7375
7532
|
|
|
7376
7533
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
7377
7534
|
import { execSync as execSync35 } from "child_process";
|
|
7378
|
-
import
|
|
7535
|
+
import chalk95 from "chalk";
|
|
7379
7536
|
function resolveOpSecret(reference) {
|
|
7380
7537
|
if (!reference.startsWith("op://")) {
|
|
7381
|
-
console.error(
|
|
7538
|
+
console.error(chalk95.red(`Invalid secret reference: must start with op://`));
|
|
7382
7539
|
process.exit(1);
|
|
7383
7540
|
}
|
|
7384
7541
|
try {
|
|
@@ -7388,7 +7545,7 @@ function resolveOpSecret(reference) {
|
|
|
7388
7545
|
}).trim();
|
|
7389
7546
|
} catch {
|
|
7390
7547
|
console.error(
|
|
7391
|
-
|
|
7548
|
+
chalk95.red(
|
|
7392
7549
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
7393
7550
|
)
|
|
7394
7551
|
);
|
|
@@ -7415,7 +7572,7 @@ async function ravenFetch(connection, path50) {
|
|
|
7415
7572
|
if (!response.ok) {
|
|
7416
7573
|
const body = await response.text();
|
|
7417
7574
|
console.error(
|
|
7418
|
-
|
|
7575
|
+
chalk96.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
7419
7576
|
);
|
|
7420
7577
|
console.error(body.substring(0, 500));
|
|
7421
7578
|
process.exit(1);
|
|
@@ -7424,7 +7581,7 @@ async function ravenFetch(connection, path50) {
|
|
|
7424
7581
|
}
|
|
7425
7582
|
|
|
7426
7583
|
// src/commands/ravendb/resolveConnection.ts
|
|
7427
|
-
import
|
|
7584
|
+
import chalk97 from "chalk";
|
|
7428
7585
|
function loadRavendb() {
|
|
7429
7586
|
const raw = loadGlobalConfigRaw();
|
|
7430
7587
|
const ravendb = raw.ravendb;
|
|
@@ -7438,7 +7595,7 @@ function resolveConnection(name) {
|
|
|
7438
7595
|
const connectionName = name ?? defaultConnection;
|
|
7439
7596
|
if (!connectionName) {
|
|
7440
7597
|
console.error(
|
|
7441
|
-
|
|
7598
|
+
chalk97.red(
|
|
7442
7599
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
7443
7600
|
)
|
|
7444
7601
|
);
|
|
@@ -7446,7 +7603,7 @@ function resolveConnection(name) {
|
|
|
7446
7603
|
}
|
|
7447
7604
|
const connection = connections.find((c) => c.name === connectionName);
|
|
7448
7605
|
if (!connection) {
|
|
7449
|
-
console.error(
|
|
7606
|
+
console.error(chalk97.red(`Connection "${connectionName}" not found.`));
|
|
7450
7607
|
console.error(
|
|
7451
7608
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
7452
7609
|
);
|
|
@@ -7477,15 +7634,15 @@ async function ravendbCollections(connectionName) {
|
|
|
7477
7634
|
return;
|
|
7478
7635
|
}
|
|
7479
7636
|
for (const c of collections) {
|
|
7480
|
-
console.log(`${
|
|
7637
|
+
console.log(`${chalk98.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
7481
7638
|
}
|
|
7482
7639
|
}
|
|
7483
7640
|
|
|
7484
7641
|
// src/commands/ravendb/ravendbQuery.ts
|
|
7485
|
-
import
|
|
7642
|
+
import chalk100 from "chalk";
|
|
7486
7643
|
|
|
7487
7644
|
// src/commands/ravendb/fetchAllPages.ts
|
|
7488
|
-
import
|
|
7645
|
+
import chalk99 from "chalk";
|
|
7489
7646
|
|
|
7490
7647
|
// src/commands/ravendb/buildQueryPath.ts
|
|
7491
7648
|
function buildQueryPath(opts) {
|
|
@@ -7523,7 +7680,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
7523
7680
|
allResults.push(...results);
|
|
7524
7681
|
start3 += results.length;
|
|
7525
7682
|
process.stderr.write(
|
|
7526
|
-
`\r${
|
|
7683
|
+
`\r${chalk99.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
7527
7684
|
);
|
|
7528
7685
|
if (start3 >= totalResults) break;
|
|
7529
7686
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -7538,7 +7695,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
7538
7695
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
7539
7696
|
const resolved = resolveArgs(connectionName, collection);
|
|
7540
7697
|
if (!resolved.collection && !options2.query) {
|
|
7541
|
-
console.error(
|
|
7698
|
+
console.error(chalk100.red("Provide a collection name or --query filter."));
|
|
7542
7699
|
process.exit(1);
|
|
7543
7700
|
}
|
|
7544
7701
|
const { collection: col } = resolved;
|
|
@@ -7576,7 +7733,7 @@ import { spawn as spawn4 } from "child_process";
|
|
|
7576
7733
|
import * as path27 from "path";
|
|
7577
7734
|
|
|
7578
7735
|
// src/commands/refactor/logViolations.ts
|
|
7579
|
-
import
|
|
7736
|
+
import chalk101 from "chalk";
|
|
7580
7737
|
var DEFAULT_MAX_LINES = 100;
|
|
7581
7738
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
7582
7739
|
if (violations.length === 0) {
|
|
@@ -7585,43 +7742,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
7585
7742
|
}
|
|
7586
7743
|
return;
|
|
7587
7744
|
}
|
|
7588
|
-
console.error(
|
|
7745
|
+
console.error(chalk101.red(`
|
|
7589
7746
|
Refactor check failed:
|
|
7590
7747
|
`));
|
|
7591
|
-
console.error(
|
|
7748
|
+
console.error(chalk101.red(` The following files exceed ${maxLines} lines:
|
|
7592
7749
|
`));
|
|
7593
7750
|
for (const violation of violations) {
|
|
7594
|
-
console.error(
|
|
7751
|
+
console.error(chalk101.red(` ${violation.file} (${violation.lines} lines)`));
|
|
7595
7752
|
}
|
|
7596
7753
|
console.error(
|
|
7597
|
-
|
|
7754
|
+
chalk101.yellow(
|
|
7598
7755
|
`
|
|
7599
7756
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
7600
7757
|
way to refactor it, ignore it with:
|
|
7601
7758
|
`
|
|
7602
7759
|
)
|
|
7603
7760
|
);
|
|
7604
|
-
console.error(
|
|
7761
|
+
console.error(chalk101.gray(` assist refactor ignore <file>
|
|
7605
7762
|
`));
|
|
7606
7763
|
if (process.env.CLAUDECODE) {
|
|
7607
|
-
console.error(
|
|
7764
|
+
console.error(chalk101.cyan(`
|
|
7608
7765
|
## Extracting Code to New Files
|
|
7609
7766
|
`));
|
|
7610
7767
|
console.error(
|
|
7611
|
-
|
|
7768
|
+
chalk101.cyan(
|
|
7612
7769
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
7613
7770
|
`
|
|
7614
7771
|
)
|
|
7615
7772
|
);
|
|
7616
7773
|
console.error(
|
|
7617
|
-
|
|
7774
|
+
chalk101.cyan(
|
|
7618
7775
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
7619
7776
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
7620
7777
|
`
|
|
7621
7778
|
)
|
|
7622
7779
|
);
|
|
7623
7780
|
console.error(
|
|
7624
|
-
|
|
7781
|
+
chalk101.cyan(
|
|
7625
7782
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
7626
7783
|
domains, move it to a common/shared folder.
|
|
7627
7784
|
`
|
|
@@ -7777,7 +7934,7 @@ async function check(pattern2, options2) {
|
|
|
7777
7934
|
|
|
7778
7935
|
// src/commands/refactor/extract/index.ts
|
|
7779
7936
|
import path33 from "path";
|
|
7780
|
-
import
|
|
7937
|
+
import chalk104 from "chalk";
|
|
7781
7938
|
|
|
7782
7939
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
7783
7940
|
import { SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
@@ -8303,23 +8460,23 @@ function buildPlan(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
8303
8460
|
|
|
8304
8461
|
// src/commands/refactor/extract/displayPlan.ts
|
|
8305
8462
|
import path31 from "path";
|
|
8306
|
-
import
|
|
8463
|
+
import chalk102 from "chalk";
|
|
8307
8464
|
function section(title) {
|
|
8308
8465
|
return `
|
|
8309
|
-
${
|
|
8466
|
+
${chalk102.cyan(title)}`;
|
|
8310
8467
|
}
|
|
8311
8468
|
function displayImporters(plan2, cwd) {
|
|
8312
8469
|
if (plan2.importersToUpdate.length === 0) return;
|
|
8313
8470
|
console.log(section("Update importers:"));
|
|
8314
8471
|
for (const imp of plan2.importersToUpdate) {
|
|
8315
8472
|
const rel = path31.relative(cwd, imp.file.getFilePath());
|
|
8316
|
-
console.log(` ${
|
|
8473
|
+
console.log(` ${chalk102.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
8317
8474
|
}
|
|
8318
8475
|
}
|
|
8319
8476
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
8320
|
-
console.log(
|
|
8477
|
+
console.log(chalk102.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
8321
8478
|
`));
|
|
8322
|
-
console.log(` ${
|
|
8479
|
+
console.log(` ${chalk102.cyan("Functions to move:")}`);
|
|
8323
8480
|
for (const name of plan2.extractedNames) {
|
|
8324
8481
|
console.log(` ${name}`);
|
|
8325
8482
|
}
|
|
@@ -8354,7 +8511,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
8354
8511
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
8355
8512
|
import fs17 from "fs";
|
|
8356
8513
|
import path32 from "path";
|
|
8357
|
-
import
|
|
8514
|
+
import chalk103 from "chalk";
|
|
8358
8515
|
import { Project as Project2 } from "ts-morph";
|
|
8359
8516
|
function findTsConfig(sourcePath) {
|
|
8360
8517
|
const rootConfig = path32.resolve("tsconfig.json");
|
|
@@ -8385,7 +8542,7 @@ function loadProjectFile(file) {
|
|
|
8385
8542
|
});
|
|
8386
8543
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
8387
8544
|
if (!sourceFile) {
|
|
8388
|
-
console.log(
|
|
8545
|
+
console.log(chalk103.red(`File not found in project: ${file}`));
|
|
8389
8546
|
process.exit(1);
|
|
8390
8547
|
}
|
|
8391
8548
|
return { project, sourceFile };
|
|
@@ -8408,19 +8565,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
8408
8565
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
8409
8566
|
if (options2.apply) {
|
|
8410
8567
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
8411
|
-
console.log(
|
|
8568
|
+
console.log(chalk104.green("\nExtraction complete"));
|
|
8412
8569
|
} else {
|
|
8413
|
-
console.log(
|
|
8570
|
+
console.log(chalk104.dim("\nDry run. Use --apply to execute."));
|
|
8414
8571
|
}
|
|
8415
8572
|
}
|
|
8416
8573
|
|
|
8417
8574
|
// src/commands/refactor/ignore.ts
|
|
8418
8575
|
import fs18 from "fs";
|
|
8419
|
-
import
|
|
8576
|
+
import chalk105 from "chalk";
|
|
8420
8577
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
8421
8578
|
function ignore(file) {
|
|
8422
8579
|
if (!fs18.existsSync(file)) {
|
|
8423
|
-
console.error(
|
|
8580
|
+
console.error(chalk105.red(`Error: File does not exist: ${file}`));
|
|
8424
8581
|
process.exit(1);
|
|
8425
8582
|
}
|
|
8426
8583
|
const content = fs18.readFileSync(file, "utf-8");
|
|
@@ -8436,7 +8593,7 @@ function ignore(file) {
|
|
|
8436
8593
|
fs18.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
8437
8594
|
}
|
|
8438
8595
|
console.log(
|
|
8439
|
-
|
|
8596
|
+
chalk105.green(
|
|
8440
8597
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
8441
8598
|
)
|
|
8442
8599
|
);
|
|
@@ -8444,26 +8601,26 @@ function ignore(file) {
|
|
|
8444
8601
|
|
|
8445
8602
|
// src/commands/refactor/rename/index.ts
|
|
8446
8603
|
import path34 from "path";
|
|
8447
|
-
import
|
|
8604
|
+
import chalk106 from "chalk";
|
|
8448
8605
|
async function rename(source, destination, options2 = {}) {
|
|
8449
8606
|
const destPath = path34.resolve(destination);
|
|
8450
8607
|
const cwd = process.cwd();
|
|
8451
8608
|
const relSource = path34.relative(cwd, path34.resolve(source));
|
|
8452
8609
|
const relDest = path34.relative(cwd, destPath);
|
|
8453
8610
|
const { project, sourceFile } = loadProjectFile(source);
|
|
8454
|
-
console.log(
|
|
8611
|
+
console.log(chalk106.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
8455
8612
|
if (options2.apply) {
|
|
8456
8613
|
sourceFile.move(destPath);
|
|
8457
8614
|
await project.save();
|
|
8458
|
-
console.log(
|
|
8615
|
+
console.log(chalk106.green("Done"));
|
|
8459
8616
|
} else {
|
|
8460
|
-
console.log(
|
|
8617
|
+
console.log(chalk106.dim("Dry run. Use --apply to execute."));
|
|
8461
8618
|
}
|
|
8462
8619
|
}
|
|
8463
8620
|
|
|
8464
8621
|
// src/commands/refactor/renameSymbol/index.ts
|
|
8465
8622
|
import path36 from "path";
|
|
8466
|
-
import
|
|
8623
|
+
import chalk107 from "chalk";
|
|
8467
8624
|
import { Project as Project3 } from "ts-morph";
|
|
8468
8625
|
|
|
8469
8626
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
@@ -8512,38 +8669,38 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
8512
8669
|
const project = new Project3({ tsConfigFilePath: tsConfigPath });
|
|
8513
8670
|
const sourceFile = project.getSourceFile(filePath);
|
|
8514
8671
|
if (!sourceFile) {
|
|
8515
|
-
console.log(
|
|
8672
|
+
console.log(chalk107.red(`File not found in project: ${file}`));
|
|
8516
8673
|
process.exit(1);
|
|
8517
8674
|
}
|
|
8518
8675
|
const symbol = findSymbol(sourceFile, oldName);
|
|
8519
8676
|
if (!symbol) {
|
|
8520
|
-
console.log(
|
|
8677
|
+
console.log(chalk107.red(`Symbol "${oldName}" not found in ${file}`));
|
|
8521
8678
|
process.exit(1);
|
|
8522
8679
|
}
|
|
8523
8680
|
const grouped = groupReferences(symbol, cwd);
|
|
8524
8681
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
8525
8682
|
console.log(
|
|
8526
|
-
|
|
8683
|
+
chalk107.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
8527
8684
|
`)
|
|
8528
8685
|
);
|
|
8529
8686
|
for (const [refFile, lines] of grouped) {
|
|
8530
8687
|
console.log(
|
|
8531
|
-
` ${
|
|
8688
|
+
` ${chalk107.dim(refFile)}: lines ${chalk107.cyan(lines.join(", "))}`
|
|
8532
8689
|
);
|
|
8533
8690
|
}
|
|
8534
8691
|
if (options2.apply) {
|
|
8535
8692
|
symbol.rename(newName);
|
|
8536
8693
|
await project.save();
|
|
8537
|
-
console.log(
|
|
8694
|
+
console.log(chalk107.green(`
|
|
8538
8695
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
8539
8696
|
} else {
|
|
8540
|
-
console.log(
|
|
8697
|
+
console.log(chalk107.dim("\nDry run. Use --apply to execute."));
|
|
8541
8698
|
}
|
|
8542
8699
|
}
|
|
8543
8700
|
|
|
8544
8701
|
// src/commands/refactor/restructure/index.ts
|
|
8545
8702
|
import path45 from "path";
|
|
8546
|
-
import
|
|
8703
|
+
import chalk110 from "chalk";
|
|
8547
8704
|
|
|
8548
8705
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
8549
8706
|
import path37 from "path";
|
|
@@ -8786,50 +8943,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
8786
8943
|
|
|
8787
8944
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
8788
8945
|
import path41 from "path";
|
|
8789
|
-
import
|
|
8946
|
+
import chalk108 from "chalk";
|
|
8790
8947
|
function relPath(filePath) {
|
|
8791
8948
|
return path41.relative(process.cwd(), filePath);
|
|
8792
8949
|
}
|
|
8793
8950
|
function displayMoves(plan2) {
|
|
8794
8951
|
if (plan2.moves.length === 0) return;
|
|
8795
|
-
console.log(
|
|
8952
|
+
console.log(chalk108.bold("\nFile moves:"));
|
|
8796
8953
|
for (const move of plan2.moves) {
|
|
8797
8954
|
console.log(
|
|
8798
|
-
` ${
|
|
8955
|
+
` ${chalk108.red(relPath(move.from))} \u2192 ${chalk108.green(relPath(move.to))}`
|
|
8799
8956
|
);
|
|
8800
|
-
console.log(
|
|
8957
|
+
console.log(chalk108.dim(` ${move.reason}`));
|
|
8801
8958
|
}
|
|
8802
8959
|
}
|
|
8803
8960
|
function displayRewrites(rewrites) {
|
|
8804
8961
|
if (rewrites.length === 0) return;
|
|
8805
8962
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
8806
|
-
console.log(
|
|
8963
|
+
console.log(chalk108.bold(`
|
|
8807
8964
|
Import rewrites (${affectedFiles.size} files):`));
|
|
8808
8965
|
for (const file of affectedFiles) {
|
|
8809
|
-
console.log(` ${
|
|
8966
|
+
console.log(` ${chalk108.cyan(relPath(file))}:`);
|
|
8810
8967
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
8811
8968
|
(r) => r.file === file
|
|
8812
8969
|
)) {
|
|
8813
8970
|
console.log(
|
|
8814
|
-
` ${
|
|
8971
|
+
` ${chalk108.red(`"${oldSpecifier}"`)} \u2192 ${chalk108.green(`"${newSpecifier}"`)}`
|
|
8815
8972
|
);
|
|
8816
8973
|
}
|
|
8817
8974
|
}
|
|
8818
8975
|
}
|
|
8819
8976
|
function displayPlan2(plan2) {
|
|
8820
8977
|
if (plan2.warnings.length > 0) {
|
|
8821
|
-
console.log(
|
|
8822
|
-
for (const w of plan2.warnings) console.log(
|
|
8978
|
+
console.log(chalk108.yellow("\nWarnings:"));
|
|
8979
|
+
for (const w of plan2.warnings) console.log(chalk108.yellow(` ${w}`));
|
|
8823
8980
|
}
|
|
8824
8981
|
if (plan2.newDirectories.length > 0) {
|
|
8825
|
-
console.log(
|
|
8982
|
+
console.log(chalk108.bold("\nNew directories:"));
|
|
8826
8983
|
for (const dir of plan2.newDirectories)
|
|
8827
|
-
console.log(
|
|
8984
|
+
console.log(chalk108.green(` ${dir}/`));
|
|
8828
8985
|
}
|
|
8829
8986
|
displayMoves(plan2);
|
|
8830
8987
|
displayRewrites(plan2.rewrites);
|
|
8831
8988
|
console.log(
|
|
8832
|
-
|
|
8989
|
+
chalk108.dim(
|
|
8833
8990
|
`
|
|
8834
8991
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
8835
8992
|
)
|
|
@@ -8839,18 +8996,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
8839
8996
|
// src/commands/refactor/restructure/executePlan.ts
|
|
8840
8997
|
import fs20 from "fs";
|
|
8841
8998
|
import path42 from "path";
|
|
8842
|
-
import
|
|
8999
|
+
import chalk109 from "chalk";
|
|
8843
9000
|
function executePlan(plan2) {
|
|
8844
9001
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
8845
9002
|
for (const [file, content] of updatedContents) {
|
|
8846
9003
|
fs20.writeFileSync(file, content, "utf-8");
|
|
8847
9004
|
console.log(
|
|
8848
|
-
|
|
9005
|
+
chalk109.cyan(` Rewrote imports in ${path42.relative(process.cwd(), file)}`)
|
|
8849
9006
|
);
|
|
8850
9007
|
}
|
|
8851
9008
|
for (const dir of plan2.newDirectories) {
|
|
8852
9009
|
fs20.mkdirSync(dir, { recursive: true });
|
|
8853
|
-
console.log(
|
|
9010
|
+
console.log(chalk109.green(` Created ${path42.relative(process.cwd(), dir)}/`));
|
|
8854
9011
|
}
|
|
8855
9012
|
for (const move of plan2.moves) {
|
|
8856
9013
|
const targetDir = path42.dirname(move.to);
|
|
@@ -8859,7 +9016,7 @@ function executePlan(plan2) {
|
|
|
8859
9016
|
}
|
|
8860
9017
|
fs20.renameSync(move.from, move.to);
|
|
8861
9018
|
console.log(
|
|
8862
|
-
|
|
9019
|
+
chalk109.white(
|
|
8863
9020
|
` Moved ${path42.relative(process.cwd(), move.from)} \u2192 ${path42.relative(process.cwd(), move.to)}`
|
|
8864
9021
|
)
|
|
8865
9022
|
);
|
|
@@ -8874,7 +9031,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
8874
9031
|
if (entries.length === 0) {
|
|
8875
9032
|
fs20.rmdirSync(dir);
|
|
8876
9033
|
console.log(
|
|
8877
|
-
|
|
9034
|
+
chalk109.dim(
|
|
8878
9035
|
` Removed empty directory ${path42.relative(process.cwd(), dir)}`
|
|
8879
9036
|
)
|
|
8880
9037
|
);
|
|
@@ -9007,22 +9164,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
9007
9164
|
const targetPattern = pattern2 ?? "src";
|
|
9008
9165
|
const files = findSourceFiles2(targetPattern);
|
|
9009
9166
|
if (files.length === 0) {
|
|
9010
|
-
console.log(
|
|
9167
|
+
console.log(chalk110.yellow("No files found matching pattern"));
|
|
9011
9168
|
return;
|
|
9012
9169
|
}
|
|
9013
9170
|
const tsConfigPath = path45.resolve("tsconfig.json");
|
|
9014
9171
|
const plan2 = buildPlan2(files, tsConfigPath);
|
|
9015
9172
|
if (plan2.moves.length === 0) {
|
|
9016
|
-
console.log(
|
|
9173
|
+
console.log(chalk110.green("No restructuring needed"));
|
|
9017
9174
|
return;
|
|
9018
9175
|
}
|
|
9019
9176
|
displayPlan2(plan2);
|
|
9020
9177
|
if (options2.apply) {
|
|
9021
|
-
console.log(
|
|
9178
|
+
console.log(chalk110.bold("\nApplying changes..."));
|
|
9022
9179
|
executePlan(plan2);
|
|
9023
|
-
console.log(
|
|
9180
|
+
console.log(chalk110.green("\nRestructuring complete"));
|
|
9024
9181
|
} else {
|
|
9025
|
-
console.log(
|
|
9182
|
+
console.log(chalk110.dim("\nDry run. Use --apply to execute."));
|
|
9026
9183
|
}
|
|
9027
9184
|
}
|
|
9028
9185
|
|
|
@@ -9062,7 +9219,7 @@ function registerRefactor(program2) {
|
|
|
9062
9219
|
}
|
|
9063
9220
|
|
|
9064
9221
|
// src/commands/seq/seqAuth.ts
|
|
9065
|
-
import
|
|
9222
|
+
import chalk112 from "chalk";
|
|
9066
9223
|
|
|
9067
9224
|
// src/commands/seq/loadConnections.ts
|
|
9068
9225
|
function loadConnections2() {
|
|
@@ -9091,11 +9248,11 @@ function setDefaultConnection(name) {
|
|
|
9091
9248
|
}
|
|
9092
9249
|
|
|
9093
9250
|
// src/commands/seq/promptConnection.ts
|
|
9094
|
-
import
|
|
9251
|
+
import chalk111 from "chalk";
|
|
9095
9252
|
async function promptConnection2(existingNames) {
|
|
9096
9253
|
const name = await promptInput("name", "Connection name:", "default");
|
|
9097
9254
|
if (existingNames.includes(name)) {
|
|
9098
|
-
console.error(
|
|
9255
|
+
console.error(chalk111.red(`Connection "${name}" already exists.`));
|
|
9099
9256
|
process.exit(1);
|
|
9100
9257
|
}
|
|
9101
9258
|
const url = await promptInput("url", "Seq URL:", "http://localhost:5341");
|
|
@@ -9107,16 +9264,16 @@ async function promptConnection2(existingNames) {
|
|
|
9107
9264
|
var seqAuth = createConnectionAuth({
|
|
9108
9265
|
load: loadConnections2,
|
|
9109
9266
|
save: saveConnections2,
|
|
9110
|
-
format: (c) => `${
|
|
9267
|
+
format: (c) => `${chalk112.bold(c.name)} ${c.url}`,
|
|
9111
9268
|
promptNew: promptConnection2,
|
|
9112
9269
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
9113
9270
|
});
|
|
9114
9271
|
|
|
9115
9272
|
// src/commands/seq/seqQuery.ts
|
|
9116
|
-
import
|
|
9273
|
+
import chalk116 from "chalk";
|
|
9117
9274
|
|
|
9118
9275
|
// src/commands/seq/fetchSeq.ts
|
|
9119
|
-
import
|
|
9276
|
+
import chalk113 from "chalk";
|
|
9120
9277
|
async function fetchSeq(conn, path50, params) {
|
|
9121
9278
|
const url = `${conn.url}${path50}?${params}`;
|
|
9122
9279
|
const response = await fetch(url, {
|
|
@@ -9127,7 +9284,7 @@ async function fetchSeq(conn, path50, params) {
|
|
|
9127
9284
|
});
|
|
9128
9285
|
if (!response.ok) {
|
|
9129
9286
|
const body = await response.text();
|
|
9130
|
-
console.error(
|
|
9287
|
+
console.error(chalk113.red(`Seq returned ${response.status}: ${body}`));
|
|
9131
9288
|
process.exit(1);
|
|
9132
9289
|
}
|
|
9133
9290
|
return response;
|
|
@@ -9180,23 +9337,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
9180
9337
|
}
|
|
9181
9338
|
|
|
9182
9339
|
// src/commands/seq/formatEvent.ts
|
|
9183
|
-
import
|
|
9340
|
+
import chalk114 from "chalk";
|
|
9184
9341
|
function levelColor(level) {
|
|
9185
9342
|
switch (level) {
|
|
9186
9343
|
case "Fatal":
|
|
9187
|
-
return
|
|
9344
|
+
return chalk114.bgRed.white;
|
|
9188
9345
|
case "Error":
|
|
9189
|
-
return
|
|
9346
|
+
return chalk114.red;
|
|
9190
9347
|
case "Warning":
|
|
9191
|
-
return
|
|
9348
|
+
return chalk114.yellow;
|
|
9192
9349
|
case "Information":
|
|
9193
|
-
return
|
|
9350
|
+
return chalk114.cyan;
|
|
9194
9351
|
case "Debug":
|
|
9195
|
-
return
|
|
9352
|
+
return chalk114.gray;
|
|
9196
9353
|
case "Verbose":
|
|
9197
|
-
return
|
|
9354
|
+
return chalk114.dim;
|
|
9198
9355
|
default:
|
|
9199
|
-
return
|
|
9356
|
+
return chalk114.white;
|
|
9200
9357
|
}
|
|
9201
9358
|
}
|
|
9202
9359
|
function levelAbbrev(level) {
|
|
@@ -9237,31 +9394,31 @@ function formatTimestamp(iso) {
|
|
|
9237
9394
|
function formatEvent(event) {
|
|
9238
9395
|
const color = levelColor(event.Level);
|
|
9239
9396
|
const abbrev = levelAbbrev(event.Level);
|
|
9240
|
-
const ts8 =
|
|
9397
|
+
const ts8 = chalk114.dim(formatTimestamp(event.Timestamp));
|
|
9241
9398
|
const msg = renderMessage(event);
|
|
9242
9399
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
9243
9400
|
if (event.Exception) {
|
|
9244
9401
|
for (const line of event.Exception.split("\n")) {
|
|
9245
|
-
lines.push(
|
|
9402
|
+
lines.push(chalk114.red(` ${line}`));
|
|
9246
9403
|
}
|
|
9247
9404
|
}
|
|
9248
9405
|
return lines.join("\n");
|
|
9249
9406
|
}
|
|
9250
9407
|
|
|
9251
9408
|
// src/commands/seq/resolveConnection.ts
|
|
9252
|
-
import
|
|
9409
|
+
import chalk115 from "chalk";
|
|
9253
9410
|
function resolveConnection2(name) {
|
|
9254
9411
|
const connections = loadConnections2();
|
|
9255
9412
|
if (connections.length === 0) {
|
|
9256
9413
|
console.error(
|
|
9257
|
-
|
|
9414
|
+
chalk115.red("No Seq connections configured. Run 'assist seq auth' first.")
|
|
9258
9415
|
);
|
|
9259
9416
|
process.exit(1);
|
|
9260
9417
|
}
|
|
9261
9418
|
const target = name ?? getDefaultConnection() ?? connections[0].name;
|
|
9262
9419
|
const connection = connections.find((c) => c.name === target);
|
|
9263
9420
|
if (!connection) {
|
|
9264
|
-
console.error(
|
|
9421
|
+
console.error(chalk115.red(`Seq connection "${target}" not found.`));
|
|
9265
9422
|
process.exit(1);
|
|
9266
9423
|
}
|
|
9267
9424
|
return connection;
|
|
@@ -9276,7 +9433,7 @@ async function seqQuery(filter, options2) {
|
|
|
9276
9433
|
new URLSearchParams({ filter, count: String(count) })
|
|
9277
9434
|
);
|
|
9278
9435
|
if (events.length === 0) {
|
|
9279
|
-
console.log(
|
|
9436
|
+
console.log(chalk116.yellow("No events found."));
|
|
9280
9437
|
return;
|
|
9281
9438
|
}
|
|
9282
9439
|
if (options2.json) {
|
|
@@ -9287,11 +9444,11 @@ async function seqQuery(filter, options2) {
|
|
|
9287
9444
|
for (const event of chronological) {
|
|
9288
9445
|
console.log(formatEvent(event));
|
|
9289
9446
|
}
|
|
9290
|
-
console.log(
|
|
9447
|
+
console.log(chalk116.dim(`
|
|
9291
9448
|
${events.length} events`));
|
|
9292
9449
|
if (events.length >= count) {
|
|
9293
9450
|
console.log(
|
|
9294
|
-
|
|
9451
|
+
chalk116.yellow(
|
|
9295
9452
|
`Results limited to ${count}. Use --count to retrieve more.`
|
|
9296
9453
|
)
|
|
9297
9454
|
);
|
|
@@ -9299,11 +9456,11 @@ ${events.length} events`));
|
|
|
9299
9456
|
}
|
|
9300
9457
|
|
|
9301
9458
|
// src/commands/seq/seqSetConnection.ts
|
|
9302
|
-
import
|
|
9459
|
+
import chalk117 from "chalk";
|
|
9303
9460
|
function seqSetConnection(name) {
|
|
9304
9461
|
const connections = loadConnections2();
|
|
9305
9462
|
if (!connections.find((c) => c.name === name)) {
|
|
9306
|
-
console.error(
|
|
9463
|
+
console.error(chalk117.red(`Connection "${name}" not found.`));
|
|
9307
9464
|
process.exit(1);
|
|
9308
9465
|
}
|
|
9309
9466
|
setDefaultConnection(name);
|
|
@@ -9842,14 +9999,14 @@ import {
|
|
|
9842
9999
|
import { dirname as dirname20, join as join30 } from "path";
|
|
9843
10000
|
|
|
9844
10001
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
9845
|
-
import
|
|
10002
|
+
import chalk118 from "chalk";
|
|
9846
10003
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
9847
10004
|
function validateStagedContent(filename, content) {
|
|
9848
10005
|
const firstLine = content.split("\n")[0];
|
|
9849
10006
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
9850
10007
|
if (!match) {
|
|
9851
10008
|
console.error(
|
|
9852
|
-
|
|
10009
|
+
chalk118.red(
|
|
9853
10010
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
9854
10011
|
)
|
|
9855
10012
|
);
|
|
@@ -9858,7 +10015,7 @@ function validateStagedContent(filename, content) {
|
|
|
9858
10015
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
9859
10016
|
if (!contentAfterLink) {
|
|
9860
10017
|
console.error(
|
|
9861
|
-
|
|
10018
|
+
chalk118.red(
|
|
9862
10019
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
9863
10020
|
)
|
|
9864
10021
|
);
|
|
@@ -10251,7 +10408,7 @@ function registerVoice(program2) {
|
|
|
10251
10408
|
|
|
10252
10409
|
// src/commands/roam/auth.ts
|
|
10253
10410
|
import { randomBytes } from "crypto";
|
|
10254
|
-
import
|
|
10411
|
+
import chalk119 from "chalk";
|
|
10255
10412
|
|
|
10256
10413
|
// src/lib/openBrowser.ts
|
|
10257
10414
|
import { execSync as execSync38 } from "child_process";
|
|
@@ -10426,13 +10583,13 @@ async function auth() {
|
|
|
10426
10583
|
saveGlobalConfig(config);
|
|
10427
10584
|
const state = randomBytes(16).toString("hex");
|
|
10428
10585
|
console.log(
|
|
10429
|
-
|
|
10586
|
+
chalk119.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
10430
10587
|
);
|
|
10431
|
-
console.log(
|
|
10432
|
-
console.log(
|
|
10433
|
-
console.log(
|
|
10588
|
+
console.log(chalk119.white("http://localhost:14523/callback\n"));
|
|
10589
|
+
console.log(chalk119.blue("Opening browser for authorization..."));
|
|
10590
|
+
console.log(chalk119.dim("Waiting for authorization callback..."));
|
|
10434
10591
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
10435
|
-
console.log(
|
|
10592
|
+
console.log(chalk119.dim("Exchanging code for tokens..."));
|
|
10436
10593
|
const tokens = await exchangeToken({
|
|
10437
10594
|
code,
|
|
10438
10595
|
clientId,
|
|
@@ -10448,7 +10605,7 @@ async function auth() {
|
|
|
10448
10605
|
};
|
|
10449
10606
|
saveGlobalConfig(config);
|
|
10450
10607
|
console.log(
|
|
10451
|
-
|
|
10608
|
+
chalk119.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
10452
10609
|
);
|
|
10453
10610
|
}
|
|
10454
10611
|
|
|
@@ -10661,7 +10818,7 @@ import { execSync as execSync40 } from "child_process";
|
|
|
10661
10818
|
import { existsSync as existsSync41, mkdirSync as mkdirSync13, unlinkSync as unlinkSync11, writeFileSync as writeFileSync28 } from "fs";
|
|
10662
10819
|
import { tmpdir as tmpdir6 } from "os";
|
|
10663
10820
|
import { join as join39, resolve as resolve5 } from "path";
|
|
10664
|
-
import
|
|
10821
|
+
import chalk120 from "chalk";
|
|
10665
10822
|
|
|
10666
10823
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
10667
10824
|
var captureWindowPs1 = `
|
|
@@ -10812,22 +10969,22 @@ function screenshot(processName) {
|
|
|
10812
10969
|
const config = loadConfig();
|
|
10813
10970
|
const outputDir = resolve5(config.screenshot.outputDir);
|
|
10814
10971
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
10815
|
-
console.log(
|
|
10972
|
+
console.log(chalk120.gray(`Capturing window for process "${processName}" ...`));
|
|
10816
10973
|
try {
|
|
10817
10974
|
runPowerShellScript(processName, outputPath);
|
|
10818
|
-
console.log(
|
|
10975
|
+
console.log(chalk120.green(`Screenshot saved: ${outputPath}`));
|
|
10819
10976
|
} catch (error) {
|
|
10820
10977
|
const msg = error instanceof Error ? error.message : String(error);
|
|
10821
|
-
console.error(
|
|
10978
|
+
console.error(chalk120.red(`Failed to capture screenshot: ${msg}`));
|
|
10822
10979
|
process.exit(1);
|
|
10823
10980
|
}
|
|
10824
10981
|
}
|
|
10825
10982
|
|
|
10826
10983
|
// src/commands/statusLine.ts
|
|
10827
|
-
import
|
|
10984
|
+
import chalk122 from "chalk";
|
|
10828
10985
|
|
|
10829
10986
|
// src/commands/buildLimitsSegment.ts
|
|
10830
|
-
import
|
|
10987
|
+
import chalk121 from "chalk";
|
|
10831
10988
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
10832
10989
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
10833
10990
|
function formatTimeLeft(resetsAt) {
|
|
@@ -10850,10 +11007,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
10850
11007
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
10851
11008
|
const label2 = `${Math.round(pct)}%`;
|
|
10852
11009
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
10853
|
-
if (projected == null) return
|
|
10854
|
-
if (projected > 100) return
|
|
10855
|
-
if (projected > 75) return
|
|
10856
|
-
return
|
|
11010
|
+
if (projected == null) return chalk121.green(label2);
|
|
11011
|
+
if (projected > 100) return chalk121.red(label2);
|
|
11012
|
+
if (projected > 75) return chalk121.yellow(label2);
|
|
11013
|
+
return chalk121.green(label2);
|
|
10857
11014
|
}
|
|
10858
11015
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
10859
11016
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -10879,14 +11036,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
10879
11036
|
}
|
|
10880
11037
|
|
|
10881
11038
|
// src/commands/statusLine.ts
|
|
10882
|
-
|
|
11039
|
+
chalk122.level = 3;
|
|
10883
11040
|
function formatNumber(num) {
|
|
10884
11041
|
return num.toLocaleString("en-US");
|
|
10885
11042
|
}
|
|
10886
11043
|
function colorizePercent(pct) {
|
|
10887
11044
|
const label2 = `${Math.round(pct)}%`;
|
|
10888
|
-
if (pct > 80) return
|
|
10889
|
-
if (pct > 40) return
|
|
11045
|
+
if (pct > 80) return chalk122.red(label2);
|
|
11046
|
+
if (pct > 40) return chalk122.yellow(label2);
|
|
10890
11047
|
return label2;
|
|
10891
11048
|
}
|
|
10892
11049
|
async function statusLine() {
|
|
@@ -10909,7 +11066,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
10909
11066
|
// src/commands/sync/syncClaudeMd.ts
|
|
10910
11067
|
import * as fs23 from "fs";
|
|
10911
11068
|
import * as path46 from "path";
|
|
10912
|
-
import
|
|
11069
|
+
import chalk123 from "chalk";
|
|
10913
11070
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
10914
11071
|
const source = path46.join(claudeDir, "CLAUDE.md");
|
|
10915
11072
|
const target = path46.join(targetBase, "CLAUDE.md");
|
|
@@ -10918,12 +11075,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
10918
11075
|
const targetContent = fs23.readFileSync(target, "utf-8");
|
|
10919
11076
|
if (sourceContent !== targetContent) {
|
|
10920
11077
|
console.log(
|
|
10921
|
-
|
|
11078
|
+
chalk123.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
10922
11079
|
);
|
|
10923
11080
|
console.log();
|
|
10924
11081
|
printDiff(targetContent, sourceContent);
|
|
10925
11082
|
const confirm = options2?.yes || await promptConfirm(
|
|
10926
|
-
|
|
11083
|
+
chalk123.red("Overwrite existing CLAUDE.md?"),
|
|
10927
11084
|
false
|
|
10928
11085
|
);
|
|
10929
11086
|
if (!confirm) {
|
|
@@ -10939,7 +11096,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
10939
11096
|
// src/commands/sync/syncSettings.ts
|
|
10940
11097
|
import * as fs24 from "fs";
|
|
10941
11098
|
import * as path47 from "path";
|
|
10942
|
-
import
|
|
11099
|
+
import chalk124 from "chalk";
|
|
10943
11100
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
10944
11101
|
const source = path47.join(claudeDir, "settings.json");
|
|
10945
11102
|
const target = path47.join(targetBase, "settings.json");
|
|
@@ -10955,14 +11112,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
10955
11112
|
if (mergedContent !== normalizedTarget) {
|
|
10956
11113
|
if (!options2?.yes) {
|
|
10957
11114
|
console.log(
|
|
10958
|
-
|
|
11115
|
+
chalk124.yellow(
|
|
10959
11116
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
10960
11117
|
)
|
|
10961
11118
|
);
|
|
10962
11119
|
console.log();
|
|
10963
11120
|
printDiff(targetContent, mergedContent);
|
|
10964
11121
|
const confirm = await promptConfirm(
|
|
10965
|
-
|
|
11122
|
+
chalk124.red("Overwrite existing settings.json?"),
|
|
10966
11123
|
false
|
|
10967
11124
|
);
|
|
10968
11125
|
if (!confirm) {
|