@staff0rd/assist 0.174.2 → 0.175.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/claude/commands/devlog.md +19 -0
- package/dist/index.js +508 -489
- 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.175.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -84,7 +84,7 @@ var package_default = {
|
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
// src/commands/backlog/next.ts
|
|
87
|
-
import
|
|
87
|
+
import chalk8 from "chalk";
|
|
88
88
|
import enquirer2 from "enquirer";
|
|
89
89
|
|
|
90
90
|
// src/shared/exitOnCancel.ts
|
|
@@ -688,8 +688,33 @@ function printVerboseDetails(item) {
|
|
|
688
688
|
console.log();
|
|
689
689
|
}
|
|
690
690
|
|
|
691
|
+
// src/commands/backlog/findResumable.ts
|
|
692
|
+
function findResumable(items) {
|
|
693
|
+
return items.find(
|
|
694
|
+
(i) => i.status === "in-progress" && i.plan && !isLockedByOther(i.id) && !isBlocked(i, items)
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
// src/commands/backlog/findUnblockedTodos.ts
|
|
699
|
+
import chalk3 from "chalk";
|
|
700
|
+
function findUnblockedTodos(items) {
|
|
701
|
+
const todo = items.filter((i) => i.status === "todo");
|
|
702
|
+
if (todo.length === 0) {
|
|
703
|
+
console.log(chalk3.green("All backlog items complete."));
|
|
704
|
+
return void 0;
|
|
705
|
+
}
|
|
706
|
+
const unblocked = todo.filter((i) => !isBlocked(i, items));
|
|
707
|
+
if (unblocked.length === 0) {
|
|
708
|
+
console.log(
|
|
709
|
+
chalk3.yellow("All remaining todo items are blocked by dependencies.")
|
|
710
|
+
);
|
|
711
|
+
return void 0;
|
|
712
|
+
}
|
|
713
|
+
return unblocked;
|
|
714
|
+
}
|
|
715
|
+
|
|
691
716
|
// src/commands/backlog/run.ts
|
|
692
|
-
import
|
|
717
|
+
import chalk7 from "chalk";
|
|
693
718
|
|
|
694
719
|
// src/commands/backlog/buildCommentLines.ts
|
|
695
720
|
function buildCommentLines(comments2) {
|
|
@@ -804,11 +829,11 @@ function buildReviewPhase() {
|
|
|
804
829
|
}
|
|
805
830
|
|
|
806
831
|
// src/commands/backlog/executePhase.ts
|
|
807
|
-
import
|
|
832
|
+
import chalk5 from "chalk";
|
|
808
833
|
|
|
809
834
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
810
835
|
import { existsSync as existsSync5, unlinkSync as unlinkSync2 } from "fs";
|
|
811
|
-
import
|
|
836
|
+
import chalk4 from "chalk";
|
|
812
837
|
|
|
813
838
|
// src/commands/backlog/handleIncompletePhase.ts
|
|
814
839
|
import enquirer from "enquirer";
|
|
@@ -859,7 +884,7 @@ async function resolvePhaseResult(phaseIndex, itemId) {
|
|
|
859
884
|
return action === "skip" ? 1 : 0;
|
|
860
885
|
}
|
|
861
886
|
cleanupSignal();
|
|
862
|
-
console.log(
|
|
887
|
+
console.log(chalk4.green(`
|
|
863
888
|
Phase ${phaseIndex + 1} completed.`));
|
|
864
889
|
return 1;
|
|
865
890
|
}
|
|
@@ -917,7 +942,7 @@ function stopWatching() {
|
|
|
917
942
|
async function executePhase(item, phaseIndex, phases, spawnOptions) {
|
|
918
943
|
const phase = phases[phaseIndex];
|
|
919
944
|
console.log(
|
|
920
|
-
|
|
945
|
+
chalk5.bold(
|
|
921
946
|
`
|
|
922
947
|
--- Phase ${phaseIndex + 1}/${phases.length}: ${phase.name} ---
|
|
923
948
|
`
|
|
@@ -936,7 +961,7 @@ async function executePhase(item, phaseIndex, phases, spawnOptions) {
|
|
|
936
961
|
}
|
|
937
962
|
|
|
938
963
|
// src/commands/backlog/prepareRun.ts
|
|
939
|
-
import
|
|
964
|
+
import chalk6 from "chalk";
|
|
940
965
|
|
|
941
966
|
// src/commands/backlog/resolvePlan.ts
|
|
942
967
|
function resolvePlan(item) {
|
|
@@ -959,13 +984,13 @@ function prepareRun(id) {
|
|
|
959
984
|
const plan2 = resolvePlan(item);
|
|
960
985
|
const startPhase = item.currentPhase ?? 0;
|
|
961
986
|
if (item.status === "done") {
|
|
962
|
-
console.log(
|
|
987
|
+
console.log(chalk6.green(`Already done: #${id}: ${item.name}`));
|
|
963
988
|
return void 0;
|
|
964
989
|
}
|
|
965
990
|
if (startPhase > plan2.length) {
|
|
966
991
|
setStatus(id, "done");
|
|
967
992
|
console.log(
|
|
968
|
-
|
|
993
|
+
chalk6.green(`All phases already complete for #${id}: ${item.name}`)
|
|
969
994
|
);
|
|
970
995
|
return void 0;
|
|
971
996
|
}
|
|
@@ -990,12 +1015,12 @@ async function run(id, spawnOptions) {
|
|
|
990
1015
|
}
|
|
991
1016
|
}
|
|
992
1017
|
function logProgress(id, name, startPhase, total) {
|
|
993
|
-
console.log(
|
|
1018
|
+
console.log(chalk7.bold(`Running plan for #${id}: ${name}`));
|
|
994
1019
|
if (startPhase > 0) {
|
|
995
|
-
console.log(
|
|
1020
|
+
console.log(chalk7.dim(`Resuming from phase ${startPhase + 1}/${total}
|
|
996
1021
|
`));
|
|
997
1022
|
} else {
|
|
998
|
-
console.log(
|
|
1023
|
+
console.log(chalk7.dim(`${total} phase(s)
|
|
999
1024
|
`));
|
|
1000
1025
|
}
|
|
1001
1026
|
}
|
|
@@ -1026,14 +1051,9 @@ async function runReview(item, plan2, spawnOptions) {
|
|
|
1026
1051
|
}
|
|
1027
1052
|
|
|
1028
1053
|
// src/commands/backlog/next.ts
|
|
1029
|
-
function findResumable(items) {
|
|
1030
|
-
return items.find(
|
|
1031
|
-
(i) => i.status === "in-progress" && i.plan && !isLockedByOther(i.id) && !isBlocked(i, items)
|
|
1032
|
-
);
|
|
1033
|
-
}
|
|
1034
1054
|
function toChoice(item, items) {
|
|
1035
1055
|
const name = `${typeLabel(item.type)} #${item.id}: ${item.name}`;
|
|
1036
|
-
return isBlocked(item, items) ? { name, disabled:
|
|
1056
|
+
return isBlocked(item, items) ? { name, disabled: chalk8.red("[blocked]") } : { name };
|
|
1037
1057
|
}
|
|
1038
1058
|
async function selectItem(todo, items) {
|
|
1039
1059
|
const { selected } = await exitOnCancel(
|
|
@@ -1046,32 +1066,31 @@ async function selectItem(todo, items) {
|
|
|
1046
1066
|
);
|
|
1047
1067
|
return selected.match(/#(\d+)/)?.[1] ?? "";
|
|
1048
1068
|
}
|
|
1049
|
-
async function pickItem(items) {
|
|
1069
|
+
async function pickItem(items, firstPick = false) {
|
|
1050
1070
|
const resumable = findResumable(items);
|
|
1051
1071
|
if (resumable) {
|
|
1052
1072
|
console.log(
|
|
1053
|
-
|
|
1073
|
+
chalk8.bold(
|
|
1054
1074
|
`Resuming in-progress item #${resumable.id}: ${resumable.name}`
|
|
1055
1075
|
)
|
|
1056
1076
|
);
|
|
1057
1077
|
return String(resumable.id);
|
|
1058
1078
|
}
|
|
1059
|
-
const
|
|
1060
|
-
if (
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
console.log(
|
|
1066
|
-
chalk7.yellow("All remaining todo items are blocked by dependencies.")
|
|
1067
|
-
);
|
|
1068
|
-
return void 0;
|
|
1079
|
+
const unblocked = findUnblockedTodos(items);
|
|
1080
|
+
if (!unblocked) return void 0;
|
|
1081
|
+
if (firstPick && unblocked.length === 1) {
|
|
1082
|
+
const item = unblocked[0];
|
|
1083
|
+
console.log(chalk8.bold(`Auto-selecting item #${item.id}: ${item.name}`));
|
|
1084
|
+
return String(item.id);
|
|
1069
1085
|
}
|
|
1086
|
+
const todo = items.filter((i) => i.status === "todo");
|
|
1070
1087
|
return selectItem(todo, items);
|
|
1071
1088
|
}
|
|
1072
1089
|
async function next(options2) {
|
|
1090
|
+
let firstPick = true;
|
|
1073
1091
|
while (true) {
|
|
1074
|
-
const id = await pickItem(loadBacklog());
|
|
1092
|
+
const id = await pickItem(loadBacklog(), firstPick);
|
|
1093
|
+
firstPick = false;
|
|
1075
1094
|
if (id === void 0) return;
|
|
1076
1095
|
const completed = await run(id, options2);
|
|
1077
1096
|
if (!completed) return;
|
|
@@ -1079,7 +1098,7 @@ async function next(options2) {
|
|
|
1079
1098
|
}
|
|
1080
1099
|
|
|
1081
1100
|
// src/commands/backlog/phaseDone.ts
|
|
1082
|
-
import
|
|
1101
|
+
import chalk9 from "chalk";
|
|
1083
1102
|
|
|
1084
1103
|
// src/commands/backlog/addComment.ts
|
|
1085
1104
|
function addComment(item, text, phase) {
|
|
@@ -1113,7 +1132,7 @@ function phaseDone(id, phase, summary) {
|
|
|
1113
1132
|
});
|
|
1114
1133
|
const result = loadAndFindItem(id);
|
|
1115
1134
|
if (result?.item.status === "done") {
|
|
1116
|
-
console.log(
|
|
1135
|
+
console.log(chalk9.dim(`Item #${id} already done, skipping phase advance.`));
|
|
1117
1136
|
return;
|
|
1118
1137
|
}
|
|
1119
1138
|
if (result) {
|
|
@@ -1121,23 +1140,23 @@ function phaseDone(id, phase, summary) {
|
|
|
1121
1140
|
saveBacklog(result.items);
|
|
1122
1141
|
}
|
|
1123
1142
|
setCurrentPhase(id, phaseIndex + 1);
|
|
1124
|
-
console.log(
|
|
1143
|
+
console.log(chalk9.green(`Phase ${phase} of item #${id} marked as complete.`));
|
|
1125
1144
|
}
|
|
1126
1145
|
|
|
1127
1146
|
// src/commands/backlog/plan.ts
|
|
1128
|
-
import
|
|
1147
|
+
import chalk10 from "chalk";
|
|
1129
1148
|
function plan(id) {
|
|
1130
1149
|
const result = loadAndFindItem(id);
|
|
1131
1150
|
if (!result) return;
|
|
1132
1151
|
const { item } = result;
|
|
1133
1152
|
if (!item.plan || item.plan.length === 0) {
|
|
1134
|
-
console.log(
|
|
1153
|
+
console.log(chalk10.dim("No plan defined for this item."));
|
|
1135
1154
|
return;
|
|
1136
1155
|
}
|
|
1137
|
-
console.log(
|
|
1156
|
+
console.log(chalk10.bold(item.name));
|
|
1138
1157
|
console.log();
|
|
1139
1158
|
for (const [i, phase] of item.plan.entries()) {
|
|
1140
|
-
console.log(`${
|
|
1159
|
+
console.log(`${chalk10.bold(`Phase ${i + 1}:`)} ${phase.name}`);
|
|
1141
1160
|
for (const task of phase.tasks) {
|
|
1142
1161
|
console.log(` - ${task.task}`);
|
|
1143
1162
|
}
|
|
@@ -1146,34 +1165,34 @@ function plan(id) {
|
|
|
1146
1165
|
}
|
|
1147
1166
|
|
|
1148
1167
|
// src/commands/backlog/show/index.ts
|
|
1149
|
-
import
|
|
1168
|
+
import chalk14 from "chalk";
|
|
1150
1169
|
|
|
1151
1170
|
// src/commands/backlog/formatComment.ts
|
|
1152
|
-
import
|
|
1171
|
+
import chalk11 from "chalk";
|
|
1153
1172
|
function formatComment(entry) {
|
|
1154
|
-
const tag = entry.type === "summary" ?
|
|
1155
|
-
const phase = entry.phase !== void 0 ?
|
|
1156
|
-
const time =
|
|
1173
|
+
const tag = entry.type === "summary" ? chalk11.magenta("[summary]") : chalk11.cyan("[comment]");
|
|
1174
|
+
const phase = entry.phase !== void 0 ? chalk11.dim(` (phase ${entry.phase + 1})`) : "";
|
|
1175
|
+
const time = chalk11.dim(entry.timestamp);
|
|
1157
1176
|
return `${tag}${phase} ${time}
|
|
1158
1177
|
${entry.text}`;
|
|
1159
1178
|
}
|
|
1160
1179
|
|
|
1161
1180
|
// src/commands/backlog/show/printLinks.ts
|
|
1162
|
-
import
|
|
1181
|
+
import chalk12 from "chalk";
|
|
1163
1182
|
function printLinks(item, items) {
|
|
1164
1183
|
const links = item.links ?? [];
|
|
1165
1184
|
if (links.length === 0) return;
|
|
1166
|
-
console.log(
|
|
1185
|
+
console.log(chalk12.bold("Links"));
|
|
1167
1186
|
for (const link2 of links) {
|
|
1168
1187
|
const target = items.find((i) => i.id === link2.targetId);
|
|
1169
|
-
const typeLabel2 = link2.type === "depends-on" ?
|
|
1188
|
+
const typeLabel2 = link2.type === "depends-on" ? chalk12.red("depends-on") : chalk12.blue("relates-to");
|
|
1170
1189
|
if (target) {
|
|
1171
1190
|
console.log(
|
|
1172
|
-
` ${typeLabel2} #${target.id} ${target.name} ${
|
|
1191
|
+
` ${typeLabel2} #${target.id} ${target.name} ${chalk12.dim(`(${target.status})`)}`
|
|
1173
1192
|
);
|
|
1174
1193
|
} else {
|
|
1175
1194
|
console.log(
|
|
1176
|
-
` ${typeLabel2} #${link2.targetId} ${
|
|
1195
|
+
` ${typeLabel2} #${link2.targetId} ${chalk12.dim("(not found)")}`
|
|
1177
1196
|
);
|
|
1178
1197
|
}
|
|
1179
1198
|
}
|
|
@@ -1181,15 +1200,15 @@ function printLinks(item, items) {
|
|
|
1181
1200
|
}
|
|
1182
1201
|
|
|
1183
1202
|
// src/commands/backlog/show/printPhaseTasks.ts
|
|
1184
|
-
import
|
|
1203
|
+
import chalk13 from "chalk";
|
|
1185
1204
|
function printPhaseTasks(phase) {
|
|
1186
1205
|
for (const task of phase.tasks) {
|
|
1187
1206
|
console.log(` - ${task.task}`);
|
|
1188
1207
|
}
|
|
1189
1208
|
if (phase.manualChecks && phase.manualChecks.length > 0) {
|
|
1190
|
-
console.log(` ${
|
|
1209
|
+
console.log(` ${chalk13.dim("Manual checks:")}`);
|
|
1191
1210
|
for (const check2 of phase.manualChecks) {
|
|
1192
|
-
console.log(` ${
|
|
1211
|
+
console.log(` ${chalk13.dim(`- ${check2}`)}`);
|
|
1193
1212
|
}
|
|
1194
1213
|
}
|
|
1195
1214
|
}
|
|
@@ -1197,7 +1216,7 @@ function printPhaseTasks(phase) {
|
|
|
1197
1216
|
// src/commands/backlog/show/index.ts
|
|
1198
1217
|
function printPlan(item) {
|
|
1199
1218
|
if (!item.plan || item.plan.length === 0) return;
|
|
1200
|
-
console.log(
|
|
1219
|
+
console.log(chalk14.bold("Plan"));
|
|
1201
1220
|
for (const [i, phase] of item.plan.entries()) {
|
|
1202
1221
|
const isCurrent = item.currentPhase === i;
|
|
1203
1222
|
printPhase(phase, i, isCurrent);
|
|
@@ -1205,8 +1224,8 @@ function printPlan(item) {
|
|
|
1205
1224
|
console.log();
|
|
1206
1225
|
}
|
|
1207
1226
|
function phaseHeader(index, name, isCurrent) {
|
|
1208
|
-
const marker = isCurrent ?
|
|
1209
|
-
const label2 = isCurrent ?
|
|
1227
|
+
const marker = isCurrent ? chalk14.green("\u25B6 ") : " ";
|
|
1228
|
+
const label2 = isCurrent ? chalk14.green.bold(`Phase ${index + 1}: ${name}`) : `${chalk14.bold(`Phase ${index + 1}:`)} ${name}`;
|
|
1210
1229
|
return `${marker}${label2}`;
|
|
1211
1230
|
}
|
|
1212
1231
|
function printPhase(phase, index, isCurrent) {
|
|
@@ -1214,15 +1233,15 @@ function printPhase(phase, index, isCurrent) {
|
|
|
1214
1233
|
printPhaseTasks(phase);
|
|
1215
1234
|
}
|
|
1216
1235
|
function printHeader(item) {
|
|
1217
|
-
console.log(
|
|
1236
|
+
console.log(chalk14.bold(`#${item.id} ${item.name}`));
|
|
1218
1237
|
console.log(
|
|
1219
|
-
`${
|
|
1238
|
+
`${chalk14.dim("Type:")} ${item.type} ${chalk14.dim("Status:")} ${item.status}`
|
|
1220
1239
|
);
|
|
1221
1240
|
console.log();
|
|
1222
1241
|
}
|
|
1223
1242
|
function printAcceptanceCriteria(criteria) {
|
|
1224
1243
|
if (criteria.length === 0) return;
|
|
1225
|
-
console.log(
|
|
1244
|
+
console.log(chalk14.bold("Acceptance Criteria"));
|
|
1226
1245
|
for (const [i, ac] of criteria.entries()) {
|
|
1227
1246
|
console.log(` ${i + 1}. ${ac}`);
|
|
1228
1247
|
}
|
|
@@ -1234,7 +1253,7 @@ function show(id) {
|
|
|
1234
1253
|
const { item, items } = result;
|
|
1235
1254
|
printHeader(item);
|
|
1236
1255
|
if (item.description) {
|
|
1237
|
-
console.log(
|
|
1256
|
+
console.log(chalk14.bold("Description"));
|
|
1238
1257
|
console.log(item.description);
|
|
1239
1258
|
console.log();
|
|
1240
1259
|
}
|
|
@@ -1246,7 +1265,7 @@ function show(id) {
|
|
|
1246
1265
|
function printComments(item) {
|
|
1247
1266
|
const entries = item.comments ?? [];
|
|
1248
1267
|
if (entries.length === 0) return;
|
|
1249
|
-
console.log(
|
|
1268
|
+
console.log(chalk14.bold("Comments"));
|
|
1250
1269
|
for (const entry of entries) {
|
|
1251
1270
|
console.log(` ${formatComment(entry)}`);
|
|
1252
1271
|
}
|
|
@@ -1261,7 +1280,7 @@ import {
|
|
|
1261
1280
|
} from "http";
|
|
1262
1281
|
import { dirname, join as join7 } from "path";
|
|
1263
1282
|
import { fileURLToPath } from "url";
|
|
1264
|
-
import
|
|
1283
|
+
import chalk15 from "chalk";
|
|
1265
1284
|
function respondJson(res, status2, data) {
|
|
1266
1285
|
res.writeHead(status2, { "Content-Type": "application/json" });
|
|
1267
1286
|
res.end(JSON.stringify(data));
|
|
@@ -1305,8 +1324,8 @@ function startWebServer(label2, port, handler) {
|
|
|
1305
1324
|
handler(req, res, port);
|
|
1306
1325
|
});
|
|
1307
1326
|
server.listen(port, () => {
|
|
1308
|
-
console.log(
|
|
1309
|
-
console.log(
|
|
1327
|
+
console.log(chalk15.green(`${label2}: ${url}`));
|
|
1328
|
+
console.log(chalk15.dim("Press Ctrl+C to stop"));
|
|
1310
1329
|
exec(`open ${url}`);
|
|
1311
1330
|
});
|
|
1312
1331
|
}
|
|
@@ -1466,7 +1485,7 @@ async function web(options2) {
|
|
|
1466
1485
|
}
|
|
1467
1486
|
|
|
1468
1487
|
// src/commands/backlog/launchMode.ts
|
|
1469
|
-
import
|
|
1488
|
+
import chalk16 from "chalk";
|
|
1470
1489
|
async function launchMode(slashCommand) {
|
|
1471
1490
|
process.env.ASSIST_SESSION_ID = String(process.pid);
|
|
1472
1491
|
const { child, done: done2 } = spawnClaude(`/${slashCommand}`, { allowEdits: true });
|
|
@@ -1476,7 +1495,7 @@ async function launchMode(slashCommand) {
|
|
|
1476
1495
|
const signal = readSignal();
|
|
1477
1496
|
cleanupSignal();
|
|
1478
1497
|
if (signal?.event === "next") {
|
|
1479
|
-
console.log(
|
|
1498
|
+
console.log(chalk16.bold("\nChaining into assist next...\n"));
|
|
1480
1499
|
await next({ allowEdits: true });
|
|
1481
1500
|
}
|
|
1482
1501
|
}
|
|
@@ -1488,7 +1507,7 @@ import { execSync } from "child_process";
|
|
|
1488
1507
|
import { existsSync as existsSync9, readFileSync as readFileSync8, writeFileSync as writeFileSync5 } from "fs";
|
|
1489
1508
|
import { homedir } from "os";
|
|
1490
1509
|
import { basename, dirname as dirname2, join as join8 } from "path";
|
|
1491
|
-
import
|
|
1510
|
+
import chalk17 from "chalk";
|
|
1492
1511
|
import { stringify as stringifyYaml } from "yaml";
|
|
1493
1512
|
|
|
1494
1513
|
// src/shared/loadRawYaml.ts
|
|
@@ -1684,7 +1703,7 @@ function getTranscriptConfig() {
|
|
|
1684
1703
|
const config = loadConfig();
|
|
1685
1704
|
if (!config.transcript) {
|
|
1686
1705
|
console.error(
|
|
1687
|
-
|
|
1706
|
+
chalk17.red(
|
|
1688
1707
|
"Transcript directories not configured. Run 'assist transcript configure' first."
|
|
1689
1708
|
)
|
|
1690
1709
|
);
|
|
@@ -1773,7 +1792,7 @@ function commit(args) {
|
|
|
1773
1792
|
}
|
|
1774
1793
|
|
|
1775
1794
|
// src/commands/config/index.ts
|
|
1776
|
-
import
|
|
1795
|
+
import chalk18 from "chalk";
|
|
1777
1796
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
1778
1797
|
|
|
1779
1798
|
// src/commands/config/setNestedValue.ts
|
|
@@ -1836,7 +1855,7 @@ function formatIssuePath(issue, key) {
|
|
|
1836
1855
|
function printValidationErrors(issues, key) {
|
|
1837
1856
|
for (const issue of issues) {
|
|
1838
1857
|
console.error(
|
|
1839
|
-
|
|
1858
|
+
chalk18.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
1840
1859
|
);
|
|
1841
1860
|
}
|
|
1842
1861
|
}
|
|
@@ -1853,7 +1872,7 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
1853
1872
|
function assertNotGlobalOnly(key, global) {
|
|
1854
1873
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
1855
1874
|
console.error(
|
|
1856
|
-
|
|
1875
|
+
chalk18.red(
|
|
1857
1876
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
1858
1877
|
)
|
|
1859
1878
|
);
|
|
@@ -1876,7 +1895,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
1876
1895
|
applyConfigSet(key, coerced, options2.global ?? false);
|
|
1877
1896
|
const target = options2.global ? "global" : "project";
|
|
1878
1897
|
console.log(
|
|
1879
|
-
|
|
1898
|
+
chalk18.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
1880
1899
|
);
|
|
1881
1900
|
}
|
|
1882
1901
|
function configList() {
|
|
@@ -1885,7 +1904,7 @@ function configList() {
|
|
|
1885
1904
|
}
|
|
1886
1905
|
|
|
1887
1906
|
// src/commands/config/configGet.ts
|
|
1888
|
-
import
|
|
1907
|
+
import chalk19 from "chalk";
|
|
1889
1908
|
|
|
1890
1909
|
// src/commands/config/getNestedValue.ts
|
|
1891
1910
|
function isTraversable(value) {
|
|
@@ -1917,7 +1936,7 @@ function requireNestedValue(config, key) {
|
|
|
1917
1936
|
return value;
|
|
1918
1937
|
}
|
|
1919
1938
|
function exitKeyNotSet(key) {
|
|
1920
|
-
console.error(
|
|
1939
|
+
console.error(chalk19.red(`Key "${key}" is not set`));
|
|
1921
1940
|
process.exit(1);
|
|
1922
1941
|
}
|
|
1923
1942
|
|
|
@@ -1937,10 +1956,10 @@ function coverage() {
|
|
|
1937
1956
|
}
|
|
1938
1957
|
|
|
1939
1958
|
// src/commands/verify/init/index.ts
|
|
1940
|
-
import
|
|
1959
|
+
import chalk34 from "chalk";
|
|
1941
1960
|
|
|
1942
1961
|
// src/shared/promptMultiselect.ts
|
|
1943
|
-
import
|
|
1962
|
+
import chalk20 from "chalk";
|
|
1944
1963
|
import enquirer3 from "enquirer";
|
|
1945
1964
|
async function promptMultiselect(message, options2) {
|
|
1946
1965
|
const { selected } = await exitOnCancel(
|
|
@@ -1950,7 +1969,7 @@ async function promptMultiselect(message, options2) {
|
|
|
1950
1969
|
message,
|
|
1951
1970
|
choices: options2.map((opt) => ({
|
|
1952
1971
|
name: opt.value,
|
|
1953
|
-
message: `${opt.name} - ${
|
|
1972
|
+
message: `${opt.name} - ${chalk20.dim(opt.description)}`
|
|
1954
1973
|
})),
|
|
1955
1974
|
// @ts-expect-error - enquirer types don't include symbols but it's supported
|
|
1956
1975
|
symbols: {
|
|
@@ -1967,7 +1986,7 @@ async function promptMultiselect(message, options2) {
|
|
|
1967
1986
|
// src/shared/readPackageJson.ts
|
|
1968
1987
|
import * as fs from "fs";
|
|
1969
1988
|
import * as path from "path";
|
|
1970
|
-
import
|
|
1989
|
+
import chalk21 from "chalk";
|
|
1971
1990
|
function findPackageJson() {
|
|
1972
1991
|
const packageJsonPath = path.join(process.cwd(), "package.json");
|
|
1973
1992
|
if (fs.existsSync(packageJsonPath)) {
|
|
@@ -1981,7 +2000,7 @@ function readPackageJson(filePath) {
|
|
|
1981
2000
|
function requirePackageJson() {
|
|
1982
2001
|
const packageJsonPath = findPackageJson();
|
|
1983
2002
|
if (!packageJsonPath) {
|
|
1984
|
-
console.error(
|
|
2003
|
+
console.error(chalk21.red("No package.json found in current directory"));
|
|
1985
2004
|
process.exit(1);
|
|
1986
2005
|
}
|
|
1987
2006
|
const pkg = readPackageJson(packageJsonPath);
|
|
@@ -2012,7 +2031,7 @@ function findPackageJsonWithVerifyScripts(startDir) {
|
|
|
2012
2031
|
// src/commands/verify/installPackage.ts
|
|
2013
2032
|
import { execSync as execSync3 } from "child_process";
|
|
2014
2033
|
import { writeFileSync as writeFileSync6 } from "fs";
|
|
2015
|
-
import
|
|
2034
|
+
import chalk22 from "chalk";
|
|
2016
2035
|
function writePackageJson(filePath, pkg) {
|
|
2017
2036
|
writeFileSync6(filePath, `${JSON.stringify(pkg, null, 2)}
|
|
2018
2037
|
`);
|
|
@@ -2027,12 +2046,12 @@ function addScript(pkg, name, command) {
|
|
|
2027
2046
|
};
|
|
2028
2047
|
}
|
|
2029
2048
|
function installPackage(name, cwd) {
|
|
2030
|
-
console.log(
|
|
2049
|
+
console.log(chalk22.dim(`Installing ${name}...`));
|
|
2031
2050
|
try {
|
|
2032
2051
|
execSync3(`npm install -D ${name}`, { stdio: "inherit", cwd });
|
|
2033
2052
|
return true;
|
|
2034
2053
|
} catch {
|
|
2035
|
-
console.error(
|
|
2054
|
+
console.error(chalk22.red(`Failed to install ${name}`));
|
|
2036
2055
|
return false;
|
|
2037
2056
|
}
|
|
2038
2057
|
}
|
|
@@ -2079,9 +2098,9 @@ var expectedScripts = {
|
|
|
2079
2098
|
};
|
|
2080
2099
|
|
|
2081
2100
|
// src/commands/verify/setup/setupBuild.ts
|
|
2082
|
-
import
|
|
2101
|
+
import chalk23 from "chalk";
|
|
2083
2102
|
async function setupBuild(_packageJsonPath, writer, hasVite, hasTypescript) {
|
|
2084
|
-
console.log(
|
|
2103
|
+
console.log(chalk23.blue("\nSetting up build verification..."));
|
|
2085
2104
|
let command;
|
|
2086
2105
|
if (hasVite && hasTypescript) {
|
|
2087
2106
|
command = "tsc -b && vite build --logLevel error";
|
|
@@ -2090,21 +2109,21 @@ async function setupBuild(_packageJsonPath, writer, hasVite, hasTypescript) {
|
|
|
2090
2109
|
} else {
|
|
2091
2110
|
command = "npm run build";
|
|
2092
2111
|
}
|
|
2093
|
-
console.log(
|
|
2112
|
+
console.log(chalk23.dim(`Using: ${command}`));
|
|
2094
2113
|
writer("verify:build", command);
|
|
2095
2114
|
}
|
|
2096
2115
|
async function setupTypecheck(_packageJsonPath, writer) {
|
|
2097
|
-
console.log(
|
|
2116
|
+
console.log(chalk23.blue("\nSetting up typecheck verification..."));
|
|
2098
2117
|
const command = "tsc --noEmit";
|
|
2099
|
-
console.log(
|
|
2118
|
+
console.log(chalk23.dim(`Using: ${command}`));
|
|
2100
2119
|
writer("verify:typecheck", command);
|
|
2101
2120
|
}
|
|
2102
2121
|
|
|
2103
2122
|
// src/commands/verify/setup/setupDuplicateCode.ts
|
|
2104
2123
|
import * as path2 from "path";
|
|
2105
|
-
import
|
|
2124
|
+
import chalk24 from "chalk";
|
|
2106
2125
|
async function setupDuplicateCode(packageJsonPath, writer) {
|
|
2107
|
-
console.log(
|
|
2126
|
+
console.log(chalk24.blue("\nSetting up jscpd..."));
|
|
2108
2127
|
const cwd = path2.dirname(packageJsonPath);
|
|
2109
2128
|
const pkg = readPackageJson(packageJsonPath);
|
|
2110
2129
|
const hasJscpd = !!pkg.dependencies?.jscpd || !!pkg.devDependencies?.jscpd;
|
|
@@ -2116,12 +2135,12 @@ async function setupDuplicateCode(packageJsonPath, writer) {
|
|
|
2116
2135
|
|
|
2117
2136
|
// src/commands/verify/setup/setupHardcodedColors.ts
|
|
2118
2137
|
import * as path3 from "path";
|
|
2119
|
-
import
|
|
2138
|
+
import chalk26 from "chalk";
|
|
2120
2139
|
|
|
2121
2140
|
// src/commands/verify/addToKnipIgnoreBinaries.ts
|
|
2122
2141
|
import { existsSync as existsSync11, readFileSync as readFileSync10, writeFileSync as writeFileSync7 } from "fs";
|
|
2123
2142
|
import { join as join10 } from "path";
|
|
2124
|
-
import
|
|
2143
|
+
import chalk25 from "chalk";
|
|
2125
2144
|
function loadKnipConfig(knipJsonPath) {
|
|
2126
2145
|
if (existsSync11(knipJsonPath)) {
|
|
2127
2146
|
return JSON.parse(readFileSync10(knipJsonPath, "utf-8"));
|
|
@@ -2140,16 +2159,16 @@ function addToKnipIgnoreBinaries(cwd, binary) {
|
|
|
2140
2159
|
`${JSON.stringify(knipConfig, null, " ")}
|
|
2141
2160
|
`
|
|
2142
2161
|
);
|
|
2143
|
-
console.log(
|
|
2162
|
+
console.log(chalk25.dim(`Added '${binary}' to knip.json ignoreBinaries`));
|
|
2144
2163
|
}
|
|
2145
2164
|
} catch {
|
|
2146
|
-
console.log(
|
|
2165
|
+
console.log(chalk25.yellow("Warning: Could not update knip.json"));
|
|
2147
2166
|
}
|
|
2148
2167
|
}
|
|
2149
2168
|
|
|
2150
2169
|
// src/commands/verify/setup/setupHardcodedColors.ts
|
|
2151
2170
|
async function setupHardcodedColors(packageJsonPath, writer, hasOpenColor) {
|
|
2152
|
-
console.log(
|
|
2171
|
+
console.log(chalk26.blue("\nSetting up hardcoded colors check..."));
|
|
2153
2172
|
const cwd = path3.dirname(packageJsonPath);
|
|
2154
2173
|
if (!hasOpenColor) {
|
|
2155
2174
|
installPackage("open-color", cwd);
|
|
@@ -2160,9 +2179,9 @@ async function setupHardcodedColors(packageJsonPath, writer, hasOpenColor) {
|
|
|
2160
2179
|
|
|
2161
2180
|
// src/commands/verify/setup/setupKnip.ts
|
|
2162
2181
|
import * as path4 from "path";
|
|
2163
|
-
import
|
|
2182
|
+
import chalk27 from "chalk";
|
|
2164
2183
|
async function setupKnip(packageJsonPath, writer) {
|
|
2165
|
-
console.log(
|
|
2184
|
+
console.log(chalk27.blue("\nSetting up knip..."));
|
|
2166
2185
|
const cwd = path4.dirname(packageJsonPath);
|
|
2167
2186
|
const pkg = readPackageJson(packageJsonPath);
|
|
2168
2187
|
if (!pkg.devDependencies?.knip && !installPackage("knip", cwd)) {
|
|
@@ -2173,14 +2192,14 @@ async function setupKnip(packageJsonPath, writer) {
|
|
|
2173
2192
|
|
|
2174
2193
|
// src/commands/verify/setup/setupLint.ts
|
|
2175
2194
|
import * as path5 from "path";
|
|
2176
|
-
import
|
|
2195
|
+
import chalk30 from "chalk";
|
|
2177
2196
|
|
|
2178
2197
|
// src/commands/lint/init.ts
|
|
2179
2198
|
import { execSync as execSync5 } from "child_process";
|
|
2180
2199
|
import { existsSync as existsSync14, readFileSync as readFileSync12, writeFileSync as writeFileSync9 } from "fs";
|
|
2181
2200
|
import { dirname as dirname7, join as join11 } from "path";
|
|
2182
2201
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
2183
|
-
import
|
|
2202
|
+
import chalk29 from "chalk";
|
|
2184
2203
|
|
|
2185
2204
|
// src/shared/promptConfirm.ts
|
|
2186
2205
|
import enquirer4 from "enquirer";
|
|
@@ -2284,7 +2303,7 @@ function removeEslintScripts(scripts, options2) {
|
|
|
2284
2303
|
}
|
|
2285
2304
|
|
|
2286
2305
|
// src/utils/printDiff.ts
|
|
2287
|
-
import
|
|
2306
|
+
import chalk28 from "chalk";
|
|
2288
2307
|
import * as diff from "diff";
|
|
2289
2308
|
function normalizeJson(content) {
|
|
2290
2309
|
try {
|
|
@@ -2302,11 +2321,11 @@ function printDiff(oldContent, newContent) {
|
|
|
2302
2321
|
const lines = change.value.replace(/\n$/, "").split("\n");
|
|
2303
2322
|
for (const line of lines) {
|
|
2304
2323
|
if (change.added) {
|
|
2305
|
-
console.log(
|
|
2324
|
+
console.log(chalk28.green(`+ ${line}`));
|
|
2306
2325
|
} else if (change.removed) {
|
|
2307
|
-
console.log(
|
|
2326
|
+
console.log(chalk28.red(`- ${line}`));
|
|
2308
2327
|
} else {
|
|
2309
|
-
console.log(
|
|
2328
|
+
console.log(chalk28.dim(` ${line}`));
|
|
2310
2329
|
}
|
|
2311
2330
|
}
|
|
2312
2331
|
}
|
|
@@ -2340,10 +2359,10 @@ async function init() {
|
|
|
2340
2359
|
console.log("biome.json already has the correct linter config");
|
|
2341
2360
|
return;
|
|
2342
2361
|
}
|
|
2343
|
-
console.log(
|
|
2362
|
+
console.log(chalk29.yellow("\n\u26A0\uFE0F biome.json will be updated:"));
|
|
2344
2363
|
console.log();
|
|
2345
2364
|
printDiff(oldContent, newContent);
|
|
2346
|
-
const confirm = await promptConfirm(
|
|
2365
|
+
const confirm = await promptConfirm(chalk29.red("Update biome.json?"));
|
|
2347
2366
|
if (!confirm) {
|
|
2348
2367
|
console.log("Skipped biome.json update");
|
|
2349
2368
|
return;
|
|
@@ -2354,7 +2373,7 @@ async function init() {
|
|
|
2354
2373
|
|
|
2355
2374
|
// src/commands/verify/setup/setupLint.ts
|
|
2356
2375
|
async function setupLint(packageJsonPath, writer) {
|
|
2357
|
-
console.log(
|
|
2376
|
+
console.log(chalk30.blue("\nSetting up biome..."));
|
|
2358
2377
|
const cwd = path5.dirname(packageJsonPath);
|
|
2359
2378
|
const pkg = readPackageJson(packageJsonPath);
|
|
2360
2379
|
if (!pkg.devDependencies?.["@biomejs/biome"]) {
|
|
@@ -2368,9 +2387,9 @@ async function setupLint(packageJsonPath, writer) {
|
|
|
2368
2387
|
|
|
2369
2388
|
// src/commands/verify/setup/setupMadge.ts
|
|
2370
2389
|
import * as path6 from "path";
|
|
2371
|
-
import
|
|
2390
|
+
import chalk31 from "chalk";
|
|
2372
2391
|
async function setupMadge(packageJsonPath, writer) {
|
|
2373
|
-
console.log(
|
|
2392
|
+
console.log(chalk31.blue("\nSetting up madge..."));
|
|
2374
2393
|
const cwd = path6.dirname(packageJsonPath);
|
|
2375
2394
|
const pkg = readPackageJson(packageJsonPath);
|
|
2376
2395
|
const hasMadge = !!pkg.dependencies?.madge || !!pkg.devDependencies?.madge;
|
|
@@ -2382,18 +2401,18 @@ async function setupMadge(packageJsonPath, writer) {
|
|
|
2382
2401
|
|
|
2383
2402
|
// src/commands/verify/setup/setupMaintainability.ts
|
|
2384
2403
|
import * as path7 from "path";
|
|
2385
|
-
import
|
|
2404
|
+
import chalk32 from "chalk";
|
|
2386
2405
|
async function setupMaintainability(packageJsonPath, writer) {
|
|
2387
|
-
console.log(
|
|
2406
|
+
console.log(chalk32.blue("\nSetting up maintainability check..."));
|
|
2388
2407
|
addToKnipIgnoreBinaries(path7.dirname(packageJsonPath), "assist");
|
|
2389
2408
|
writer("verify:maintainability", expectedScripts["verify:maintainability"]);
|
|
2390
2409
|
}
|
|
2391
2410
|
|
|
2392
2411
|
// src/commands/verify/setup/setupTest.ts
|
|
2393
2412
|
import * as path8 from "path";
|
|
2394
|
-
import
|
|
2413
|
+
import chalk33 from "chalk";
|
|
2395
2414
|
async function setupTest(packageJsonPath, writer) {
|
|
2396
|
-
console.log(
|
|
2415
|
+
console.log(chalk33.blue("\nSetting up vitest..."));
|
|
2397
2416
|
const cwd = path8.dirname(packageJsonPath);
|
|
2398
2417
|
const pkg = readPackageJson(packageJsonPath);
|
|
2399
2418
|
if (!pkg.devDependencies?.vitest && !installPackage("vitest", cwd)) {
|
|
@@ -2562,25 +2581,25 @@ async function runSelectedSetups(selected, packageJsonPath, writer, handlers) {
|
|
|
2562
2581
|
for (const choice of selected) {
|
|
2563
2582
|
await handlers[choice]?.(packageJsonPath, writer);
|
|
2564
2583
|
}
|
|
2565
|
-
console.log(
|
|
2584
|
+
console.log(chalk34.green(`
|
|
2566
2585
|
Added ${selected.length} verify script(s):`));
|
|
2567
2586
|
for (const choice of selected) {
|
|
2568
|
-
console.log(
|
|
2587
|
+
console.log(chalk34.green(` - verify:${choice}`));
|
|
2569
2588
|
}
|
|
2570
|
-
console.log(
|
|
2589
|
+
console.log(chalk34.dim("\nRun 'assist verify' to run all verify scripts"));
|
|
2571
2590
|
}
|
|
2572
2591
|
async function promptForScripts(availableOptions) {
|
|
2573
2592
|
if (availableOptions.length === 0) {
|
|
2574
|
-
console.log(
|
|
2593
|
+
console.log(chalk34.green("All verify scripts are already configured!"));
|
|
2575
2594
|
return null;
|
|
2576
2595
|
}
|
|
2577
|
-
console.log(
|
|
2596
|
+
console.log(chalk34.bold("Available verify scripts to add:\n"));
|
|
2578
2597
|
const selected = await promptMultiselect(
|
|
2579
2598
|
"Select verify scripts to add:",
|
|
2580
2599
|
availableOptions
|
|
2581
2600
|
);
|
|
2582
2601
|
if (selected.length === 0) {
|
|
2583
|
-
console.log(
|
|
2602
|
+
console.log(chalk34.yellow("No scripts selected"));
|
|
2584
2603
|
return null;
|
|
2585
2604
|
}
|
|
2586
2605
|
return selected;
|
|
@@ -2600,17 +2619,17 @@ async function init2() {
|
|
|
2600
2619
|
}
|
|
2601
2620
|
|
|
2602
2621
|
// src/commands/vscode/init/index.ts
|
|
2603
|
-
import
|
|
2622
|
+
import chalk36 from "chalk";
|
|
2604
2623
|
|
|
2605
2624
|
// src/commands/vscode/init/createLaunchJson.ts
|
|
2606
2625
|
import * as fs2 from "fs";
|
|
2607
2626
|
import * as path9 from "path";
|
|
2608
|
-
import
|
|
2627
|
+
import chalk35 from "chalk";
|
|
2609
2628
|
function ensureVscodeFolder() {
|
|
2610
2629
|
const vscodeDir = path9.join(process.cwd(), ".vscode");
|
|
2611
2630
|
if (!fs2.existsSync(vscodeDir)) {
|
|
2612
2631
|
fs2.mkdirSync(vscodeDir);
|
|
2613
|
-
console.log(
|
|
2632
|
+
console.log(chalk35.dim("Created .vscode folder"));
|
|
2614
2633
|
}
|
|
2615
2634
|
}
|
|
2616
2635
|
function removeVscodeFromGitignore() {
|
|
@@ -2625,7 +2644,7 @@ function removeVscodeFromGitignore() {
|
|
|
2625
2644
|
);
|
|
2626
2645
|
if (filteredLines.length !== lines.length) {
|
|
2627
2646
|
fs2.writeFileSync(gitignorePath, filteredLines.join("\n"));
|
|
2628
|
-
console.log(
|
|
2647
|
+
console.log(chalk35.dim("Removed .vscode references from .gitignore"));
|
|
2629
2648
|
}
|
|
2630
2649
|
}
|
|
2631
2650
|
function createLaunchJson(type) {
|
|
@@ -2644,7 +2663,7 @@ function createLaunchJson(type) {
|
|
|
2644
2663
|
const launchPath = path9.join(process.cwd(), ".vscode", "launch.json");
|
|
2645
2664
|
fs2.writeFileSync(launchPath, `${JSON.stringify(launchConfig, null, " ")}
|
|
2646
2665
|
`);
|
|
2647
|
-
console.log(
|
|
2666
|
+
console.log(chalk35.green("Created .vscode/launch.json"));
|
|
2648
2667
|
}
|
|
2649
2668
|
function createSettingsJson() {
|
|
2650
2669
|
const settings = {
|
|
@@ -2657,7 +2676,7 @@ function createSettingsJson() {
|
|
|
2657
2676
|
const settingsPath = path9.join(process.cwd(), ".vscode", "settings.json");
|
|
2658
2677
|
fs2.writeFileSync(settingsPath, `${JSON.stringify(settings, null, " ")}
|
|
2659
2678
|
`);
|
|
2660
|
-
console.log(
|
|
2679
|
+
console.log(chalk35.green("Created .vscode/settings.json"));
|
|
2661
2680
|
}
|
|
2662
2681
|
function createExtensionsJson() {
|
|
2663
2682
|
const extensions = {
|
|
@@ -2669,7 +2688,7 @@ function createExtensionsJson() {
|
|
|
2669
2688
|
`${JSON.stringify(extensions, null, " ")}
|
|
2670
2689
|
`
|
|
2671
2690
|
);
|
|
2672
|
-
console.log(
|
|
2691
|
+
console.log(chalk35.green("Created .vscode/extensions.json"));
|
|
2673
2692
|
}
|
|
2674
2693
|
|
|
2675
2694
|
// src/commands/vscode/init/detectVscodeSetup.ts
|
|
@@ -2726,7 +2745,7 @@ function applySelections(selected, setup2) {
|
|
|
2726
2745
|
for (const choice of selected) handlers[choice]?.();
|
|
2727
2746
|
}
|
|
2728
2747
|
async function promptForOptions(options2) {
|
|
2729
|
-
console.log(
|
|
2748
|
+
console.log(chalk36.bold("Available VS Code configurations to add:\n"));
|
|
2730
2749
|
return promptMultiselect("Select configurations to add:", options2);
|
|
2731
2750
|
}
|
|
2732
2751
|
async function init3({ all = false } = {}) {
|
|
@@ -2734,17 +2753,17 @@ async function init3({ all = false } = {}) {
|
|
|
2734
2753
|
const setup2 = detectVscodeSetup(pkg);
|
|
2735
2754
|
const options2 = getAvailableOptions2(setup2);
|
|
2736
2755
|
if (options2.length === 0) {
|
|
2737
|
-
console.log(
|
|
2756
|
+
console.log(chalk36.green("VS Code configuration already exists!"));
|
|
2738
2757
|
return;
|
|
2739
2758
|
}
|
|
2740
2759
|
const selected = all ? options2.map((o) => o.value) : await promptForOptions(options2);
|
|
2741
2760
|
if (selected.length === 0) {
|
|
2742
|
-
console.log(
|
|
2761
|
+
console.log(chalk36.yellow("No configurations selected"));
|
|
2743
2762
|
return;
|
|
2744
2763
|
}
|
|
2745
2764
|
applySelections(selected, setup2);
|
|
2746
2765
|
console.log(
|
|
2747
|
-
|
|
2766
|
+
chalk36.green(`
|
|
2748
2767
|
Added ${selected.length} VS Code configuration(s)`)
|
|
2749
2768
|
);
|
|
2750
2769
|
}
|
|
@@ -2757,7 +2776,7 @@ async function init4() {
|
|
|
2757
2776
|
|
|
2758
2777
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
2759
2778
|
import path16 from "path";
|
|
2760
|
-
import
|
|
2779
|
+
import chalk38 from "chalk";
|
|
2761
2780
|
|
|
2762
2781
|
// src/commands/lint/lint/checkFileNames.ts
|
|
2763
2782
|
import fs5 from "fs";
|
|
@@ -2837,7 +2856,7 @@ function checkFileNames() {
|
|
|
2837
2856
|
}
|
|
2838
2857
|
|
|
2839
2858
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
2840
|
-
import
|
|
2859
|
+
import chalk37 from "chalk";
|
|
2841
2860
|
|
|
2842
2861
|
// src/commands/lint/lint/applyMoves.ts
|
|
2843
2862
|
import fs6 from "fs";
|
|
@@ -2922,25 +2941,25 @@ function fixFileNameViolations(moves) {
|
|
|
2922
2941
|
const start3 = performance.now();
|
|
2923
2942
|
const project = createLintProject();
|
|
2924
2943
|
const cwd = process.cwd();
|
|
2925
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
2944
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk37.green(line)));
|
|
2926
2945
|
const ms = (performance.now() - start3).toFixed(0);
|
|
2927
|
-
console.log(
|
|
2946
|
+
console.log(chalk37.dim(` Done in ${ms}ms`));
|
|
2928
2947
|
}
|
|
2929
2948
|
|
|
2930
2949
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
2931
2950
|
function reportViolations(violations) {
|
|
2932
|
-
console.error(
|
|
2951
|
+
console.error(chalk38.red("\nFile name check failed:\n"));
|
|
2933
2952
|
console.error(
|
|
2934
|
-
|
|
2953
|
+
chalk38.red(
|
|
2935
2954
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
2936
2955
|
)
|
|
2937
2956
|
);
|
|
2938
2957
|
for (const violation of violations) {
|
|
2939
|
-
console.error(
|
|
2940
|
-
console.error(
|
|
2958
|
+
console.error(chalk38.red(` ${violation.filePath}`));
|
|
2959
|
+
console.error(chalk38.gray(` Rename to: ${violation.suggestedName}
|
|
2941
2960
|
`));
|
|
2942
2961
|
}
|
|
2943
|
-
console.error(
|
|
2962
|
+
console.error(chalk38.dim(" Run with -f to auto-fix.\n"));
|
|
2944
2963
|
}
|
|
2945
2964
|
function runFileNameCheck(fix = false) {
|
|
2946
2965
|
const violations = checkFileNames();
|
|
@@ -2969,17 +2988,17 @@ function runFileNameCheck(fix = false) {
|
|
|
2969
2988
|
import fs8 from "fs";
|
|
2970
2989
|
|
|
2971
2990
|
// src/commands/lint/shared.ts
|
|
2972
|
-
import
|
|
2991
|
+
import chalk39 from "chalk";
|
|
2973
2992
|
function reportViolations2(violations, checkName, errorMessage, successMessage) {
|
|
2974
2993
|
if (violations.length > 0) {
|
|
2975
|
-
console.error(
|
|
2994
|
+
console.error(chalk39.red(`
|
|
2976
2995
|
${checkName} failed:
|
|
2977
2996
|
`));
|
|
2978
|
-
console.error(
|
|
2997
|
+
console.error(chalk39.red(` ${errorMessage}
|
|
2979
2998
|
`));
|
|
2980
2999
|
for (const violation of violations) {
|
|
2981
|
-
console.error(
|
|
2982
|
-
console.error(
|
|
3000
|
+
console.error(chalk39.red(` ${violation.filePath}:${violation.line}`));
|
|
3001
|
+
console.error(chalk39.gray(` ${violation.content}
|
|
2983
3002
|
`));
|
|
2984
3003
|
}
|
|
2985
3004
|
return false;
|
|
@@ -3459,14 +3478,14 @@ import { existsSync as existsSync18, readFileSync as readFileSync15, writeFileSy
|
|
|
3459
3478
|
|
|
3460
3479
|
// src/commands/deploy/init/index.ts
|
|
3461
3480
|
import { execSync as execSync12 } from "child_process";
|
|
3462
|
-
import
|
|
3481
|
+
import chalk41 from "chalk";
|
|
3463
3482
|
import enquirer5 from "enquirer";
|
|
3464
3483
|
|
|
3465
3484
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
3466
3485
|
import { existsSync as existsSync17, mkdirSync as mkdirSync4, readFileSync as readFileSync14, writeFileSync as writeFileSync13 } from "fs";
|
|
3467
3486
|
import { dirname as dirname13, join as join14 } from "path";
|
|
3468
3487
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
3469
|
-
import
|
|
3488
|
+
import chalk40 from "chalk";
|
|
3470
3489
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
3471
3490
|
var __dirname3 = dirname13(fileURLToPath3(import.meta.url));
|
|
3472
3491
|
function getExistingSiteId() {
|
|
@@ -3491,20 +3510,20 @@ async function updateWorkflow(siteId) {
|
|
|
3491
3510
|
if (existsSync17(WORKFLOW_PATH)) {
|
|
3492
3511
|
const oldContent = readFileSync14(WORKFLOW_PATH, "utf-8");
|
|
3493
3512
|
if (oldContent === newContent) {
|
|
3494
|
-
console.log(
|
|
3513
|
+
console.log(chalk40.green("build.yml is already up to date"));
|
|
3495
3514
|
return;
|
|
3496
3515
|
}
|
|
3497
|
-
console.log(
|
|
3516
|
+
console.log(chalk40.yellow("\nbuild.yml will be updated:"));
|
|
3498
3517
|
console.log();
|
|
3499
3518
|
printDiff(oldContent, newContent);
|
|
3500
|
-
const confirm = await promptConfirm(
|
|
3519
|
+
const confirm = await promptConfirm(chalk40.red("Update build.yml?"));
|
|
3501
3520
|
if (!confirm) {
|
|
3502
3521
|
console.log("Skipped build.yml update");
|
|
3503
3522
|
return;
|
|
3504
3523
|
}
|
|
3505
3524
|
}
|
|
3506
3525
|
writeFileSync13(WORKFLOW_PATH, newContent);
|
|
3507
|
-
console.log(
|
|
3526
|
+
console.log(chalk40.green(`
|
|
3508
3527
|
Created ${WORKFLOW_PATH}`));
|
|
3509
3528
|
}
|
|
3510
3529
|
|
|
@@ -3515,43 +3534,43 @@ async function ensureNetlifyCli() {
|
|
|
3515
3534
|
} catch (error) {
|
|
3516
3535
|
if (!(error instanceof Error) || !error.message.includes("command not found"))
|
|
3517
3536
|
throw error;
|
|
3518
|
-
console.error(
|
|
3537
|
+
console.error(chalk41.red("\nNetlify CLI is not installed.\n"));
|
|
3519
3538
|
const install = await promptConfirm("Would you like to install it now?");
|
|
3520
3539
|
if (!install) {
|
|
3521
3540
|
console.log(
|
|
3522
|
-
|
|
3541
|
+
chalk41.yellow(
|
|
3523
3542
|
"\nInstall it manually with: npm install -g netlify-cli\n"
|
|
3524
3543
|
)
|
|
3525
3544
|
);
|
|
3526
3545
|
process.exit(1);
|
|
3527
3546
|
}
|
|
3528
|
-
console.log(
|
|
3547
|
+
console.log(chalk41.dim("\nInstalling netlify-cli...\n"));
|
|
3529
3548
|
execSync12("npm install -g netlify-cli", { stdio: "inherit" });
|
|
3530
3549
|
console.log();
|
|
3531
3550
|
execSync12("netlify sites:create --disable-linking", { stdio: "inherit" });
|
|
3532
3551
|
}
|
|
3533
3552
|
}
|
|
3534
3553
|
function printSetupInstructions() {
|
|
3535
|
-
console.log(
|
|
3554
|
+
console.log(chalk41.bold("\nDeployment initialized successfully!"));
|
|
3536
3555
|
console.log(
|
|
3537
|
-
|
|
3556
|
+
chalk41.yellow("\nTo complete setup, create a personal access token at:")
|
|
3538
3557
|
);
|
|
3539
3558
|
console.log(
|
|
3540
|
-
|
|
3559
|
+
chalk41.cyan(
|
|
3541
3560
|
"https://app.netlify.com/user/applications#personal-access-tokens"
|
|
3542
3561
|
)
|
|
3543
3562
|
);
|
|
3544
3563
|
console.log(
|
|
3545
|
-
|
|
3564
|
+
chalk41.yellow(
|
|
3546
3565
|
"\nThen add it as NETLIFY_AUTH_TOKEN in your GitHub repository secrets."
|
|
3547
3566
|
)
|
|
3548
3567
|
);
|
|
3549
3568
|
}
|
|
3550
3569
|
async function init5() {
|
|
3551
|
-
console.log(
|
|
3570
|
+
console.log(chalk41.bold("Initializing Netlify deployment...\n"));
|
|
3552
3571
|
const existingSiteId = getExistingSiteId();
|
|
3553
3572
|
if (existingSiteId) {
|
|
3554
|
-
console.log(
|
|
3573
|
+
console.log(chalk41.dim(`Using existing site ID: ${existingSiteId}
|
|
3555
3574
|
`));
|
|
3556
3575
|
await updateWorkflow(existingSiteId);
|
|
3557
3576
|
return;
|
|
@@ -3730,27 +3749,27 @@ async function notify() {
|
|
|
3730
3749
|
}
|
|
3731
3750
|
|
|
3732
3751
|
// src/commands/backlog/comment/index.ts
|
|
3733
|
-
import
|
|
3752
|
+
import chalk42 from "chalk";
|
|
3734
3753
|
function comment(id, text) {
|
|
3735
3754
|
const result = loadAndFindItem(id);
|
|
3736
3755
|
if (!result) process.exit(1);
|
|
3737
3756
|
addComment(result.item, text);
|
|
3738
3757
|
saveBacklog(result.items);
|
|
3739
|
-
console.log(
|
|
3758
|
+
console.log(chalk42.green(`Comment added to item #${id}.`));
|
|
3740
3759
|
}
|
|
3741
3760
|
|
|
3742
3761
|
// src/commands/backlog/comments/index.ts
|
|
3743
|
-
import
|
|
3762
|
+
import chalk43 from "chalk";
|
|
3744
3763
|
function comments(id) {
|
|
3745
3764
|
const result = loadAndFindItem(id);
|
|
3746
3765
|
if (!result) process.exit(1);
|
|
3747
3766
|
const { item } = result;
|
|
3748
3767
|
const entries = item.comments ?? [];
|
|
3749
3768
|
if (entries.length === 0) {
|
|
3750
|
-
console.log(
|
|
3769
|
+
console.log(chalk43.dim(`No comments on item #${id}.`));
|
|
3751
3770
|
return;
|
|
3752
3771
|
}
|
|
3753
|
-
console.log(
|
|
3772
|
+
console.log(chalk43.bold(`Comments for #${id}: ${item.name}
|
|
3754
3773
|
`));
|
|
3755
3774
|
for (const entry of entries) {
|
|
3756
3775
|
console.log(`${formatComment(entry)}
|
|
@@ -3765,12 +3784,12 @@ function registerCommentCommands(cmd) {
|
|
|
3765
3784
|
}
|
|
3766
3785
|
|
|
3767
3786
|
// src/commands/backlog/add/index.ts
|
|
3768
|
-
import
|
|
3787
|
+
import chalk45 from "chalk";
|
|
3769
3788
|
|
|
3770
3789
|
// src/commands/backlog/commitBacklog.ts
|
|
3771
3790
|
import { execSync as execSync14 } from "child_process";
|
|
3772
3791
|
import { join as join15 } from "path";
|
|
3773
|
-
import
|
|
3792
|
+
import chalk44 from "chalk";
|
|
3774
3793
|
function commitBacklog(id, name) {
|
|
3775
3794
|
try {
|
|
3776
3795
|
const jsonlPath = join15(getBacklogDir(), ".assist", "backlog.jsonl");
|
|
@@ -3778,7 +3797,7 @@ function commitBacklog(id, name) {
|
|
|
3778
3797
|
execSync14(`git add ${shellQuote(jsonlPath)}`, { stdio: "ignore" });
|
|
3779
3798
|
execSync14(`git commit -m ${shellQuote(message)}`, { stdio: "ignore" });
|
|
3780
3799
|
} catch {
|
|
3781
|
-
console.log(
|
|
3800
|
+
console.log(chalk44.yellow("Warning: could not auto-commit backlog file."));
|
|
3782
3801
|
}
|
|
3783
3802
|
}
|
|
3784
3803
|
|
|
@@ -3870,12 +3889,12 @@ async function addFromOptions(options2) {
|
|
|
3870
3889
|
});
|
|
3871
3890
|
saveBacklog(items);
|
|
3872
3891
|
commitBacklog(id, name);
|
|
3873
|
-
console.log(
|
|
3892
|
+
console.log(chalk45.green(`Added item #${id}: ${name}`));
|
|
3874
3893
|
}
|
|
3875
3894
|
async function add(options2) {
|
|
3876
3895
|
if (!backlogExists()) {
|
|
3877
3896
|
console.log(
|
|
3878
|
-
|
|
3897
|
+
chalk45.yellow(
|
|
3879
3898
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
3880
3899
|
)
|
|
3881
3900
|
);
|
|
@@ -3885,13 +3904,13 @@ async function add(options2) {
|
|
|
3885
3904
|
}
|
|
3886
3905
|
|
|
3887
3906
|
// src/commands/backlog/addPhase.ts
|
|
3888
|
-
import
|
|
3907
|
+
import chalk46 from "chalk";
|
|
3889
3908
|
function addPhase(id, name, options2) {
|
|
3890
3909
|
const result = loadAndFindItem(id);
|
|
3891
3910
|
if (!result) return;
|
|
3892
3911
|
const tasks = options2.task ?? [];
|
|
3893
3912
|
if (tasks.length === 0) {
|
|
3894
|
-
console.log(
|
|
3913
|
+
console.log(chalk46.red("At least one --task is required."));
|
|
3895
3914
|
process.exitCode = 1;
|
|
3896
3915
|
return;
|
|
3897
3916
|
}
|
|
@@ -3913,25 +3932,25 @@ function addPhase(id, name, options2) {
|
|
|
3913
3932
|
exportToJsonl(db, dir);
|
|
3914
3933
|
commitBacklog(itemId, result.item.name);
|
|
3915
3934
|
console.log(
|
|
3916
|
-
|
|
3935
|
+
chalk46.green(
|
|
3917
3936
|
`Added phase ${phaseIdx + 1} "${name}" to item #${itemId} with ${tasks.length} task(s).`
|
|
3918
3937
|
)
|
|
3919
3938
|
);
|
|
3920
3939
|
}
|
|
3921
3940
|
|
|
3922
3941
|
// src/commands/backlog/init/index.ts
|
|
3923
|
-
import
|
|
3942
|
+
import chalk47 from "chalk";
|
|
3924
3943
|
async function init6() {
|
|
3925
3944
|
if (backlogExists()) {
|
|
3926
|
-
console.log(
|
|
3945
|
+
console.log(chalk47.yellow("Backlog already exists."));
|
|
3927
3946
|
return;
|
|
3928
3947
|
}
|
|
3929
3948
|
saveBacklog([]);
|
|
3930
|
-
console.log(
|
|
3949
|
+
console.log(chalk47.green("Created backlog."));
|
|
3931
3950
|
}
|
|
3932
3951
|
|
|
3933
3952
|
// src/commands/backlog/list/index.ts
|
|
3934
|
-
import
|
|
3953
|
+
import chalk48 from "chalk";
|
|
3935
3954
|
function filterItems(items, options2) {
|
|
3936
3955
|
if (options2.status) return items.filter((i) => i.status === options2.status);
|
|
3937
3956
|
if (!options2.all)
|
|
@@ -3941,7 +3960,7 @@ function filterItems(items, options2) {
|
|
|
3941
3960
|
async function list2(options2) {
|
|
3942
3961
|
if (!backlogExists()) {
|
|
3943
3962
|
console.log(
|
|
3944
|
-
|
|
3963
|
+
chalk48.yellow(
|
|
3945
3964
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
3946
3965
|
)
|
|
3947
3966
|
);
|
|
@@ -3950,12 +3969,12 @@ async function list2(options2) {
|
|
|
3950
3969
|
const allItems = loadBacklog();
|
|
3951
3970
|
const items = filterItems(allItems, options2);
|
|
3952
3971
|
if (items.length === 0) {
|
|
3953
|
-
console.log(
|
|
3972
|
+
console.log(chalk48.dim("Backlog is empty."));
|
|
3954
3973
|
return;
|
|
3955
3974
|
}
|
|
3956
3975
|
for (const item of items) {
|
|
3957
3976
|
console.log(
|
|
3958
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
3977
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk48.dim(`#${item.id}`)} ${item.name}${phaseLabel(item)}${dependencyLabel(item, allItems)}`
|
|
3959
3978
|
);
|
|
3960
3979
|
if (options2.verbose) {
|
|
3961
3980
|
printVerboseDetails(item);
|
|
@@ -3978,7 +3997,7 @@ function registerItemCommands(cmd) {
|
|
|
3978
3997
|
}
|
|
3979
3998
|
|
|
3980
3999
|
// src/commands/backlog/link.ts
|
|
3981
|
-
import
|
|
4000
|
+
import chalk50 from "chalk";
|
|
3982
4001
|
|
|
3983
4002
|
// src/commands/backlog/hasCycle.ts
|
|
3984
4003
|
function hasCycle(items, fromId, toId) {
|
|
@@ -4001,11 +4020,11 @@ function hasCycle(items, fromId, toId) {
|
|
|
4001
4020
|
}
|
|
4002
4021
|
|
|
4003
4022
|
// src/commands/backlog/validateLinkTarget.ts
|
|
4004
|
-
import
|
|
4023
|
+
import chalk49 from "chalk";
|
|
4005
4024
|
function validateLinkTarget(items, fromItem, fromId, toId, toNum, linkType) {
|
|
4006
4025
|
const toItem = items.find((i) => i.id === toNum);
|
|
4007
4026
|
if (!toItem) {
|
|
4008
|
-
console.log(
|
|
4027
|
+
console.log(chalk49.red(`Item #${toId} not found.`));
|
|
4009
4028
|
return void 0;
|
|
4010
4029
|
}
|
|
4011
4030
|
if (!fromItem.links) fromItem.links = [];
|
|
@@ -4014,7 +4033,7 @@ function validateLinkTarget(items, fromItem, fromId, toId, toNum, linkType) {
|
|
|
4014
4033
|
);
|
|
4015
4034
|
if (duplicate) {
|
|
4016
4035
|
console.log(
|
|
4017
|
-
|
|
4036
|
+
chalk49.yellow(`Link already exists: #${fromId} ${linkType} #${toId}`)
|
|
4018
4037
|
);
|
|
4019
4038
|
return void 0;
|
|
4020
4039
|
}
|
|
@@ -4025,13 +4044,13 @@ function validateLinkTarget(items, fromItem, fromId, toId, toNum, linkType) {
|
|
|
4025
4044
|
function link(fromId, toId, opts) {
|
|
4026
4045
|
const linkType = opts.type ?? "relates-to";
|
|
4027
4046
|
if (linkType !== "relates-to" && linkType !== "depends-on") {
|
|
4028
|
-
console.log(
|
|
4047
|
+
console.log(chalk50.red(`Invalid link type: ${linkType}`));
|
|
4029
4048
|
return;
|
|
4030
4049
|
}
|
|
4031
4050
|
const fromNum = Number.parseInt(fromId, 10);
|
|
4032
4051
|
const toNum = Number.parseInt(toId, 10);
|
|
4033
4052
|
if (fromNum === toNum) {
|
|
4034
|
-
console.log(
|
|
4053
|
+
console.log(chalk50.red("Cannot link an item to itself."));
|
|
4035
4054
|
return;
|
|
4036
4055
|
}
|
|
4037
4056
|
const result = loadAndFindItem(fromId);
|
|
@@ -4048,7 +4067,7 @@ function link(fromId, toId, opts) {
|
|
|
4048
4067
|
if (!toItem) return;
|
|
4049
4068
|
if (linkType === "depends-on" && hasCycle(items, fromNum, toNum)) {
|
|
4050
4069
|
console.log(
|
|
4051
|
-
|
|
4070
|
+
chalk50.red(
|
|
4052
4071
|
`Cannot add dependency: #${fromId} \u2192 #${toId} would create a circular dependency.`
|
|
4053
4072
|
)
|
|
4054
4073
|
);
|
|
@@ -4058,32 +4077,32 @@ function link(fromId, toId, opts) {
|
|
|
4058
4077
|
fromItem.links.push({ type: linkType, targetId: toNum });
|
|
4059
4078
|
saveBacklog(items);
|
|
4060
4079
|
console.log(
|
|
4061
|
-
|
|
4080
|
+
chalk50.green(`Linked #${fromId} ${linkType} #${toId} (${toItem.name})`)
|
|
4062
4081
|
);
|
|
4063
4082
|
}
|
|
4064
4083
|
|
|
4065
4084
|
// src/commands/backlog/unlink.ts
|
|
4066
|
-
import
|
|
4085
|
+
import chalk51 from "chalk";
|
|
4067
4086
|
function unlink(fromId, toId) {
|
|
4068
4087
|
const toNum = Number.parseInt(toId, 10);
|
|
4069
4088
|
const result = loadAndFindItem(fromId);
|
|
4070
4089
|
if (!result) return;
|
|
4071
4090
|
const { items, item: fromItem } = result;
|
|
4072
4091
|
if (!fromItem.links || fromItem.links.length === 0) {
|
|
4073
|
-
console.log(
|
|
4092
|
+
console.log(chalk51.yellow(`No links found on item #${fromId}.`));
|
|
4074
4093
|
return;
|
|
4075
4094
|
}
|
|
4076
4095
|
const before = fromItem.links.length;
|
|
4077
4096
|
fromItem.links = fromItem.links.filter((l) => l.targetId !== toNum);
|
|
4078
4097
|
if (fromItem.links.length === before) {
|
|
4079
|
-
console.log(
|
|
4098
|
+
console.log(chalk51.yellow(`No link from #${fromId} to #${toId} found.`));
|
|
4080
4099
|
return;
|
|
4081
4100
|
}
|
|
4082
4101
|
if (fromItem.links.length === 0) {
|
|
4083
4102
|
fromItem.links = void 0;
|
|
4084
4103
|
}
|
|
4085
4104
|
saveBacklog(items);
|
|
4086
|
-
console.log(
|
|
4105
|
+
console.log(chalk51.green(`Removed link from #${fromId} to #${toId}.`));
|
|
4087
4106
|
}
|
|
4088
4107
|
|
|
4089
4108
|
// src/commands/backlog/registerLinkCommands.ts
|
|
@@ -4097,11 +4116,11 @@ function registerLinkCommands(cmd) {
|
|
|
4097
4116
|
}
|
|
4098
4117
|
|
|
4099
4118
|
// src/commands/backlog/search/index.ts
|
|
4100
|
-
import
|
|
4119
|
+
import chalk52 from "chalk";
|
|
4101
4120
|
async function search(query) {
|
|
4102
4121
|
if (!backlogExists()) {
|
|
4103
4122
|
console.log(
|
|
4104
|
-
|
|
4123
|
+
chalk52.yellow(
|
|
4105
4124
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
4106
4125
|
)
|
|
4107
4126
|
);
|
|
@@ -4109,18 +4128,18 @@ async function search(query) {
|
|
|
4109
4128
|
}
|
|
4110
4129
|
const items = searchBacklog(query);
|
|
4111
4130
|
if (items.length === 0) {
|
|
4112
|
-
console.log(
|
|
4131
|
+
console.log(chalk52.dim(`No items matching "${query}".`));
|
|
4113
4132
|
return;
|
|
4114
4133
|
}
|
|
4115
4134
|
console.log(
|
|
4116
|
-
|
|
4135
|
+
chalk52.dim(
|
|
4117
4136
|
`${items.length} item${items.length === 1 ? "" : "s"} matching "${query}":
|
|
4118
4137
|
`
|
|
4119
4138
|
)
|
|
4120
4139
|
);
|
|
4121
4140
|
for (const item of items) {
|
|
4122
4141
|
console.log(
|
|
4123
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
4142
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk52.dim(`#${item.id}`)} ${item.name}`
|
|
4124
4143
|
);
|
|
4125
4144
|
}
|
|
4126
4145
|
}
|
|
@@ -4131,16 +4150,16 @@ function registerSearchCommand(cmd) {
|
|
|
4131
4150
|
}
|
|
4132
4151
|
|
|
4133
4152
|
// src/commands/backlog/delete/index.ts
|
|
4134
|
-
import
|
|
4153
|
+
import chalk53 from "chalk";
|
|
4135
4154
|
async function del(id) {
|
|
4136
4155
|
const name = removeItem(id);
|
|
4137
4156
|
if (name) {
|
|
4138
|
-
console.log(
|
|
4157
|
+
console.log(chalk53.green(`Deleted item #${id}: ${name}`));
|
|
4139
4158
|
}
|
|
4140
4159
|
}
|
|
4141
4160
|
|
|
4142
4161
|
// src/commands/backlog/done/index.ts
|
|
4143
|
-
import
|
|
4162
|
+
import chalk54 from "chalk";
|
|
4144
4163
|
async function done(id, summary) {
|
|
4145
4164
|
const result = loadAndFindItem(id);
|
|
4146
4165
|
if (!result) return;
|
|
@@ -4150,20 +4169,20 @@ async function done(id, summary) {
|
|
|
4150
4169
|
addPhaseSummary(result.item, summary, phase);
|
|
4151
4170
|
}
|
|
4152
4171
|
saveBacklog(result.items);
|
|
4153
|
-
console.log(
|
|
4172
|
+
console.log(chalk54.green(`Completed item #${id}: ${result.item.name}`));
|
|
4154
4173
|
}
|
|
4155
4174
|
|
|
4156
4175
|
// src/commands/backlog/start/index.ts
|
|
4157
|
-
import
|
|
4176
|
+
import chalk55 from "chalk";
|
|
4158
4177
|
async function start(id) {
|
|
4159
4178
|
const name = setStatus(id, "in-progress");
|
|
4160
4179
|
if (name) {
|
|
4161
|
-
console.log(
|
|
4180
|
+
console.log(chalk55.green(`Started item #${id}: ${name}`));
|
|
4162
4181
|
}
|
|
4163
4182
|
}
|
|
4164
4183
|
|
|
4165
4184
|
// src/commands/backlog/wontdo/index.ts
|
|
4166
|
-
import
|
|
4185
|
+
import chalk56 from "chalk";
|
|
4167
4186
|
async function wontdo(id, reason) {
|
|
4168
4187
|
const result = loadAndFindItem(id);
|
|
4169
4188
|
if (!result) return;
|
|
@@ -4173,7 +4192,7 @@ async function wontdo(id, reason) {
|
|
|
4173
4192
|
addPhaseSummary(result.item, reason, phase);
|
|
4174
4193
|
}
|
|
4175
4194
|
saveBacklog(result.items);
|
|
4176
|
-
console.log(
|
|
4195
|
+
console.log(chalk56.red(`Won't do item #${id}: ${result.item.name}`));
|
|
4177
4196
|
}
|
|
4178
4197
|
|
|
4179
4198
|
// src/commands/backlog/registerStatusCommands.ts
|
|
@@ -4628,48 +4647,48 @@ ${reasons.join("\n")}`);
|
|
|
4628
4647
|
}
|
|
4629
4648
|
|
|
4630
4649
|
// src/commands/deny/denyAdd.ts
|
|
4631
|
-
import
|
|
4650
|
+
import chalk57 from "chalk";
|
|
4632
4651
|
function denyAdd(pattern2, message) {
|
|
4633
4652
|
const config = loadProjectConfig();
|
|
4634
4653
|
const deny = config.deny ?? [];
|
|
4635
4654
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
4636
|
-
console.log(
|
|
4655
|
+
console.log(chalk57.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
4637
4656
|
return;
|
|
4638
4657
|
}
|
|
4639
4658
|
deny.push({ pattern: pattern2, message });
|
|
4640
4659
|
config.deny = deny;
|
|
4641
4660
|
saveConfig(config);
|
|
4642
|
-
console.log(
|
|
4661
|
+
console.log(chalk57.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
4643
4662
|
}
|
|
4644
4663
|
|
|
4645
4664
|
// src/commands/deny/denyList.ts
|
|
4646
|
-
import
|
|
4665
|
+
import chalk58 from "chalk";
|
|
4647
4666
|
function denyList() {
|
|
4648
4667
|
const config = loadConfig();
|
|
4649
4668
|
const deny = config.deny;
|
|
4650
4669
|
if (!deny || deny.length === 0) {
|
|
4651
|
-
console.log(
|
|
4670
|
+
console.log(chalk58.dim("No deny rules configured."));
|
|
4652
4671
|
return;
|
|
4653
4672
|
}
|
|
4654
4673
|
for (const rule of deny) {
|
|
4655
|
-
console.log(`${
|
|
4674
|
+
console.log(`${chalk58.red(rule.pattern)} \u2192 ${rule.message}`);
|
|
4656
4675
|
}
|
|
4657
4676
|
}
|
|
4658
4677
|
|
|
4659
4678
|
// src/commands/deny/denyRemove.ts
|
|
4660
|
-
import
|
|
4679
|
+
import chalk59 from "chalk";
|
|
4661
4680
|
function denyRemove(pattern2) {
|
|
4662
4681
|
const config = loadProjectConfig();
|
|
4663
4682
|
const deny = config.deny ?? [];
|
|
4664
4683
|
const index = deny.findIndex((r) => r.pattern === pattern2);
|
|
4665
4684
|
if (index === -1) {
|
|
4666
|
-
console.log(
|
|
4685
|
+
console.log(chalk59.yellow(`No deny rule found for: ${pattern2}`));
|
|
4667
4686
|
return;
|
|
4668
4687
|
}
|
|
4669
4688
|
deny.splice(index, 1);
|
|
4670
4689
|
config.deny = deny.length > 0 ? deny : void 0;
|
|
4671
4690
|
saveConfig(config);
|
|
4672
|
-
console.log(
|
|
4691
|
+
console.log(chalk59.green(`Removed deny rule: ${pattern2}`));
|
|
4673
4692
|
}
|
|
4674
4693
|
|
|
4675
4694
|
// src/commands/permitCliReads/index.ts
|
|
@@ -4719,11 +4738,11 @@ function assertCliExists(cli) {
|
|
|
4719
4738
|
}
|
|
4720
4739
|
|
|
4721
4740
|
// src/commands/permitCliReads/colorize.ts
|
|
4722
|
-
import
|
|
4741
|
+
import chalk60 from "chalk";
|
|
4723
4742
|
function colorize(plainOutput) {
|
|
4724
4743
|
return plainOutput.split("\n").map((line) => {
|
|
4725
|
-
if (line.startsWith(" R ")) return
|
|
4726
|
-
if (line.startsWith(" W ")) return
|
|
4744
|
+
if (line.startsWith(" R ")) return chalk60.green(line);
|
|
4745
|
+
if (line.startsWith(" W ")) return chalk60.red(line);
|
|
4727
4746
|
return line;
|
|
4728
4747
|
}).join("\n");
|
|
4729
4748
|
}
|
|
@@ -5041,15 +5060,15 @@ function registerCliHook(program2) {
|
|
|
5041
5060
|
}
|
|
5042
5061
|
|
|
5043
5062
|
// src/commands/complexity/analyze.ts
|
|
5044
|
-
import
|
|
5063
|
+
import chalk66 from "chalk";
|
|
5045
5064
|
|
|
5046
5065
|
// src/commands/complexity/cyclomatic.ts
|
|
5047
|
-
import
|
|
5066
|
+
import chalk62 from "chalk";
|
|
5048
5067
|
|
|
5049
5068
|
// src/commands/complexity/shared/index.ts
|
|
5050
5069
|
import fs12 from "fs";
|
|
5051
5070
|
import path20 from "path";
|
|
5052
|
-
import
|
|
5071
|
+
import chalk61 from "chalk";
|
|
5053
5072
|
import ts5 from "typescript";
|
|
5054
5073
|
|
|
5055
5074
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -5295,7 +5314,7 @@ function createSourceFromFile(filePath) {
|
|
|
5295
5314
|
function withSourceFiles(pattern2, callback) {
|
|
5296
5315
|
const files = findSourceFiles2(pattern2);
|
|
5297
5316
|
if (files.length === 0) {
|
|
5298
|
-
console.log(
|
|
5317
|
+
console.log(chalk61.yellow("No files found matching pattern"));
|
|
5299
5318
|
return void 0;
|
|
5300
5319
|
}
|
|
5301
5320
|
return callback(files);
|
|
@@ -5328,11 +5347,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5328
5347
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
5329
5348
|
for (const { file, name, complexity } of results) {
|
|
5330
5349
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
5331
|
-
const color = exceedsThreshold ?
|
|
5332
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
5350
|
+
const color = exceedsThreshold ? chalk62.red : chalk62.white;
|
|
5351
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk62.cyan(complexity)}`);
|
|
5333
5352
|
}
|
|
5334
5353
|
console.log(
|
|
5335
|
-
|
|
5354
|
+
chalk62.dim(
|
|
5336
5355
|
`
|
|
5337
5356
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
5338
5357
|
)
|
|
@@ -5344,7 +5363,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
5344
5363
|
}
|
|
5345
5364
|
|
|
5346
5365
|
// src/commands/complexity/halstead.ts
|
|
5347
|
-
import
|
|
5366
|
+
import chalk63 from "chalk";
|
|
5348
5367
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
5349
5368
|
withSourceFiles(pattern2, (files) => {
|
|
5350
5369
|
const results = [];
|
|
@@ -5359,13 +5378,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5359
5378
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
5360
5379
|
for (const { file, name, metrics } of results) {
|
|
5361
5380
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
5362
|
-
const color = exceedsThreshold ?
|
|
5381
|
+
const color = exceedsThreshold ? chalk63.red : chalk63.white;
|
|
5363
5382
|
console.log(
|
|
5364
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
5383
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk63.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk63.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk63.magenta(metrics.effort.toFixed(1))}`
|
|
5365
5384
|
);
|
|
5366
5385
|
}
|
|
5367
5386
|
console.log(
|
|
5368
|
-
|
|
5387
|
+
chalk63.dim(
|
|
5369
5388
|
`
|
|
5370
5389
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
5371
5390
|
)
|
|
@@ -5380,28 +5399,28 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
5380
5399
|
import fs13 from "fs";
|
|
5381
5400
|
|
|
5382
5401
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
5383
|
-
import
|
|
5402
|
+
import chalk64 from "chalk";
|
|
5384
5403
|
function displayMaintainabilityResults(results, threshold) {
|
|
5385
5404
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
5386
5405
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
5387
|
-
console.log(
|
|
5406
|
+
console.log(chalk64.green("All files pass maintainability threshold"));
|
|
5388
5407
|
} else {
|
|
5389
5408
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
5390
|
-
const color = threshold !== void 0 ?
|
|
5409
|
+
const color = threshold !== void 0 ? chalk64.red : chalk64.white;
|
|
5391
5410
|
console.log(
|
|
5392
|
-
`${color(file)} \u2192 avg: ${
|
|
5411
|
+
`${color(file)} \u2192 avg: ${chalk64.cyan(avgMaintainability.toFixed(1))}, min: ${chalk64.yellow(minMaintainability.toFixed(1))}`
|
|
5393
5412
|
);
|
|
5394
5413
|
}
|
|
5395
5414
|
}
|
|
5396
|
-
console.log(
|
|
5415
|
+
console.log(chalk64.dim(`
|
|
5397
5416
|
Analyzed ${results.length} files`));
|
|
5398
5417
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
5399
5418
|
console.error(
|
|
5400
|
-
|
|
5419
|
+
chalk64.red(
|
|
5401
5420
|
`
|
|
5402
5421
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
5403
5422
|
|
|
5404
|
-
\u26A0\uFE0F ${
|
|
5423
|
+
\u26A0\uFE0F ${chalk64.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.`
|
|
5405
5424
|
)
|
|
5406
5425
|
);
|
|
5407
5426
|
process.exit(1);
|
|
@@ -5458,7 +5477,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5458
5477
|
|
|
5459
5478
|
// src/commands/complexity/sloc.ts
|
|
5460
5479
|
import fs14 from "fs";
|
|
5461
|
-
import
|
|
5480
|
+
import chalk65 from "chalk";
|
|
5462
5481
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
5463
5482
|
withSourceFiles(pattern2, (files) => {
|
|
5464
5483
|
const results = [];
|
|
@@ -5474,12 +5493,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5474
5493
|
results.sort((a, b) => b.lines - a.lines);
|
|
5475
5494
|
for (const { file, lines } of results) {
|
|
5476
5495
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
5477
|
-
const color = exceedsThreshold ?
|
|
5478
|
-
console.log(`${color(file)} \u2192 ${
|
|
5496
|
+
const color = exceedsThreshold ? chalk65.red : chalk65.white;
|
|
5497
|
+
console.log(`${color(file)} \u2192 ${chalk65.cyan(lines)} lines`);
|
|
5479
5498
|
}
|
|
5480
5499
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
5481
5500
|
console.log(
|
|
5482
|
-
|
|
5501
|
+
chalk65.dim(`
|
|
5483
5502
|
Total: ${total} lines across ${files.length} files`)
|
|
5484
5503
|
);
|
|
5485
5504
|
if (hasViolation) {
|
|
@@ -5493,21 +5512,21 @@ async function analyze(pattern2) {
|
|
|
5493
5512
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
5494
5513
|
const files = findSourceFiles2(searchPattern);
|
|
5495
5514
|
if (files.length === 0) {
|
|
5496
|
-
console.log(
|
|
5515
|
+
console.log(chalk66.yellow("No files found matching pattern"));
|
|
5497
5516
|
return;
|
|
5498
5517
|
}
|
|
5499
5518
|
if (files.length === 1) {
|
|
5500
5519
|
const file = files[0];
|
|
5501
|
-
console.log(
|
|
5520
|
+
console.log(chalk66.bold.underline("SLOC"));
|
|
5502
5521
|
await sloc(file);
|
|
5503
5522
|
console.log();
|
|
5504
|
-
console.log(
|
|
5523
|
+
console.log(chalk66.bold.underline("Cyclomatic Complexity"));
|
|
5505
5524
|
await cyclomatic(file);
|
|
5506
5525
|
console.log();
|
|
5507
|
-
console.log(
|
|
5526
|
+
console.log(chalk66.bold.underline("Halstead Metrics"));
|
|
5508
5527
|
await halstead(file);
|
|
5509
5528
|
console.log();
|
|
5510
|
-
console.log(
|
|
5529
|
+
console.log(chalk66.bold.underline("Maintainability Index"));
|
|
5511
5530
|
await maintainability(file);
|
|
5512
5531
|
return;
|
|
5513
5532
|
}
|
|
@@ -5535,7 +5554,7 @@ function registerComplexity(program2) {
|
|
|
5535
5554
|
|
|
5536
5555
|
// src/commands/deploy/redirect.ts
|
|
5537
5556
|
import { existsSync as existsSync22, readFileSync as readFileSync20, writeFileSync as writeFileSync18 } from "fs";
|
|
5538
|
-
import
|
|
5557
|
+
import chalk67 from "chalk";
|
|
5539
5558
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
5540
5559
|
if (!window.location.pathname.endsWith('/')) {
|
|
5541
5560
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -5544,22 +5563,22 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
5544
5563
|
function redirect() {
|
|
5545
5564
|
const indexPath = "index.html";
|
|
5546
5565
|
if (!existsSync22(indexPath)) {
|
|
5547
|
-
console.log(
|
|
5566
|
+
console.log(chalk67.yellow("No index.html found"));
|
|
5548
5567
|
return;
|
|
5549
5568
|
}
|
|
5550
5569
|
const content = readFileSync20(indexPath, "utf-8");
|
|
5551
5570
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
5552
|
-
console.log(
|
|
5571
|
+
console.log(chalk67.dim("Trailing slash script already present"));
|
|
5553
5572
|
return;
|
|
5554
5573
|
}
|
|
5555
5574
|
const headCloseIndex = content.indexOf("</head>");
|
|
5556
5575
|
if (headCloseIndex === -1) {
|
|
5557
|
-
console.log(
|
|
5576
|
+
console.log(chalk67.red("Could not find </head> tag in index.html"));
|
|
5558
5577
|
return;
|
|
5559
5578
|
}
|
|
5560
5579
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
5561
5580
|
writeFileSync18(indexPath, newContent);
|
|
5562
|
-
console.log(
|
|
5581
|
+
console.log(chalk67.green("Added trailing slash redirect to index.html"));
|
|
5563
5582
|
}
|
|
5564
5583
|
|
|
5565
5584
|
// src/commands/registerDeploy.ts
|
|
@@ -5586,7 +5605,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
5586
5605
|
|
|
5587
5606
|
// src/commands/devlog/shared.ts
|
|
5588
5607
|
import { execSync as execSync17 } from "child_process";
|
|
5589
|
-
import
|
|
5608
|
+
import chalk68 from "chalk";
|
|
5590
5609
|
|
|
5591
5610
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
5592
5611
|
import { readdirSync, readFileSync as readFileSync21 } from "fs";
|
|
@@ -5673,13 +5692,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
5673
5692
|
}
|
|
5674
5693
|
function printCommitsWithFiles(commits, ignore2, verbose) {
|
|
5675
5694
|
for (const commit2 of commits) {
|
|
5676
|
-
console.log(` ${
|
|
5695
|
+
console.log(` ${chalk68.yellow(commit2.hash)} ${commit2.message}`);
|
|
5677
5696
|
if (verbose) {
|
|
5678
5697
|
const visibleFiles = commit2.files.filter(
|
|
5679
5698
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
5680
5699
|
);
|
|
5681
5700
|
for (const file of visibleFiles) {
|
|
5682
|
-
console.log(` ${
|
|
5701
|
+
console.log(` ${chalk68.dim(file)}`);
|
|
5683
5702
|
}
|
|
5684
5703
|
}
|
|
5685
5704
|
}
|
|
@@ -5704,15 +5723,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
5704
5723
|
}
|
|
5705
5724
|
|
|
5706
5725
|
// src/commands/devlog/list/printDateHeader.ts
|
|
5707
|
-
import
|
|
5726
|
+
import chalk69 from "chalk";
|
|
5708
5727
|
function printDateHeader(date, isSkipped, entries) {
|
|
5709
5728
|
if (isSkipped) {
|
|
5710
|
-
console.log(`${
|
|
5729
|
+
console.log(`${chalk69.bold.blue(date)} ${chalk69.dim("skipped")}`);
|
|
5711
5730
|
} else if (entries && entries.length > 0) {
|
|
5712
|
-
const entryInfo = entries.map((e) => `${
|
|
5713
|
-
console.log(`${
|
|
5731
|
+
const entryInfo = entries.map((e) => `${chalk69.green(e.version)} ${e.title}`).join(" | ");
|
|
5732
|
+
console.log(`${chalk69.bold.blue(date)} ${entryInfo}`);
|
|
5714
5733
|
} else {
|
|
5715
|
-
console.log(`${
|
|
5734
|
+
console.log(`${chalk69.bold.blue(date)} ${chalk69.red("\u26A0 devlog missing")}`);
|
|
5716
5735
|
}
|
|
5717
5736
|
}
|
|
5718
5737
|
|
|
@@ -5816,24 +5835,24 @@ function bumpVersion(version2, type) {
|
|
|
5816
5835
|
|
|
5817
5836
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
5818
5837
|
import { execSync as execSync20 } from "child_process";
|
|
5819
|
-
import
|
|
5838
|
+
import chalk71 from "chalk";
|
|
5820
5839
|
|
|
5821
5840
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
5822
|
-
import
|
|
5841
|
+
import chalk70 from "chalk";
|
|
5823
5842
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
5824
5843
|
if (conventional && firstHash) {
|
|
5825
5844
|
const version2 = getVersionAtCommit(firstHash);
|
|
5826
5845
|
if (version2) {
|
|
5827
|
-
console.log(`${
|
|
5846
|
+
console.log(`${chalk70.bold("version:")} ${stripToMinor(version2)}`);
|
|
5828
5847
|
} else {
|
|
5829
|
-
console.log(`${
|
|
5848
|
+
console.log(`${chalk70.bold("version:")} ${chalk70.red("unknown")}`);
|
|
5830
5849
|
}
|
|
5831
5850
|
} else if (patchVersion && minorVersion) {
|
|
5832
5851
|
console.log(
|
|
5833
|
-
`${
|
|
5852
|
+
`${chalk70.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
5834
5853
|
);
|
|
5835
5854
|
} else {
|
|
5836
|
-
console.log(`${
|
|
5855
|
+
console.log(`${chalk70.bold("version:")} v0.1 (initial)`);
|
|
5837
5856
|
}
|
|
5838
5857
|
}
|
|
5839
5858
|
|
|
@@ -5880,16 +5899,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
5880
5899
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
5881
5900
|
}
|
|
5882
5901
|
function logName(repoName) {
|
|
5883
|
-
console.log(`${
|
|
5902
|
+
console.log(`${chalk71.bold("name:")} ${repoName}`);
|
|
5884
5903
|
}
|
|
5885
5904
|
function displayNextEntry(ctx, targetDate, commits) {
|
|
5886
5905
|
logName(ctx.repoName);
|
|
5887
5906
|
printVersionInfo(ctx.config, ctx.lastInfo, commits[0]?.hash);
|
|
5888
|
-
console.log(
|
|
5907
|
+
console.log(chalk71.bold.blue(targetDate));
|
|
5889
5908
|
printCommitsWithFiles(commits, ctx.ignore, ctx.verbose);
|
|
5890
5909
|
}
|
|
5891
5910
|
function logNoCommits(lastInfo) {
|
|
5892
|
-
console.log(
|
|
5911
|
+
console.log(chalk71.dim(noCommitsMessage(!!lastInfo)));
|
|
5893
5912
|
}
|
|
5894
5913
|
|
|
5895
5914
|
// src/commands/devlog/next/index.ts
|
|
@@ -5930,11 +5949,11 @@ function next2(options2) {
|
|
|
5930
5949
|
import { execSync as execSync21 } from "child_process";
|
|
5931
5950
|
|
|
5932
5951
|
// src/commands/devlog/repos/printReposTable.ts
|
|
5933
|
-
import
|
|
5952
|
+
import chalk72 from "chalk";
|
|
5934
5953
|
function colorStatus(status2) {
|
|
5935
|
-
if (status2 === "missing") return
|
|
5936
|
-
if (status2 === "outdated") return
|
|
5937
|
-
return
|
|
5954
|
+
if (status2 === "missing") return chalk72.red(status2);
|
|
5955
|
+
if (status2 === "outdated") return chalk72.yellow(status2);
|
|
5956
|
+
return chalk72.green(status2);
|
|
5938
5957
|
}
|
|
5939
5958
|
function formatRow(row, nameWidth) {
|
|
5940
5959
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -5948,8 +5967,8 @@ function printReposTable(rows) {
|
|
|
5948
5967
|
"Last Devlog".padEnd(11),
|
|
5949
5968
|
"Status"
|
|
5950
5969
|
].join(" ");
|
|
5951
|
-
console.log(
|
|
5952
|
-
console.log(
|
|
5970
|
+
console.log(chalk72.dim(header));
|
|
5971
|
+
console.log(chalk72.dim("-".repeat(header.length)));
|
|
5953
5972
|
for (const row of rows) {
|
|
5954
5973
|
console.log(formatRow(row, nameWidth));
|
|
5955
5974
|
}
|
|
@@ -6007,14 +6026,14 @@ function repos(options2) {
|
|
|
6007
6026
|
// src/commands/devlog/skip.ts
|
|
6008
6027
|
import { writeFileSync as writeFileSync19 } from "fs";
|
|
6009
6028
|
import { join as join21 } from "path";
|
|
6010
|
-
import
|
|
6029
|
+
import chalk73 from "chalk";
|
|
6011
6030
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
6012
6031
|
function getBlogConfigPath() {
|
|
6013
6032
|
return join21(BLOG_REPO_ROOT, "assist.yml");
|
|
6014
6033
|
}
|
|
6015
6034
|
function skip(date) {
|
|
6016
6035
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
6017
|
-
console.log(
|
|
6036
|
+
console.log(chalk73.red("Invalid date format. Use YYYY-MM-DD"));
|
|
6018
6037
|
process.exit(1);
|
|
6019
6038
|
}
|
|
6020
6039
|
const repoName = getRepoName();
|
|
@@ -6025,7 +6044,7 @@ function skip(date) {
|
|
|
6025
6044
|
const skipDays = skip2[repoName] ?? [];
|
|
6026
6045
|
if (skipDays.includes(date)) {
|
|
6027
6046
|
console.log(
|
|
6028
|
-
|
|
6047
|
+
chalk73.yellow(`${date} is already in skip list for ${repoName}`)
|
|
6029
6048
|
);
|
|
6030
6049
|
return;
|
|
6031
6050
|
}
|
|
@@ -6035,20 +6054,20 @@ function skip(date) {
|
|
|
6035
6054
|
devlog.skip = skip2;
|
|
6036
6055
|
config.devlog = devlog;
|
|
6037
6056
|
writeFileSync19(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
6038
|
-
console.log(
|
|
6057
|
+
console.log(chalk73.green(`Added ${date} to skip list for ${repoName}`));
|
|
6039
6058
|
}
|
|
6040
6059
|
|
|
6041
6060
|
// src/commands/devlog/version.ts
|
|
6042
|
-
import
|
|
6061
|
+
import chalk74 from "chalk";
|
|
6043
6062
|
function version() {
|
|
6044
6063
|
const config = loadConfig();
|
|
6045
6064
|
const name = getRepoName();
|
|
6046
6065
|
const lastInfo = getLastVersionInfo(name, config);
|
|
6047
6066
|
const lastVersion = lastInfo?.version ?? null;
|
|
6048
6067
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
6049
|
-
console.log(`${
|
|
6050
|
-
console.log(`${
|
|
6051
|
-
console.log(`${
|
|
6068
|
+
console.log(`${chalk74.bold("name:")} ${name}`);
|
|
6069
|
+
console.log(`${chalk74.bold("last:")} ${lastVersion ?? chalk74.dim("none")}`);
|
|
6070
|
+
console.log(`${chalk74.bold("next:")} ${nextVersion ?? chalk74.dim("none")}`);
|
|
6052
6071
|
}
|
|
6053
6072
|
|
|
6054
6073
|
// src/commands/registerDevlog.ts
|
|
@@ -6072,7 +6091,7 @@ function registerDevlog(program2) {
|
|
|
6072
6091
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
6073
6092
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
6074
6093
|
import { join as join22 } from "path";
|
|
6075
|
-
import
|
|
6094
|
+
import chalk75 from "chalk";
|
|
6076
6095
|
|
|
6077
6096
|
// src/shared/findRepoRoot.ts
|
|
6078
6097
|
import { existsSync as existsSync23 } from "fs";
|
|
@@ -6135,14 +6154,14 @@ function checkBuildLocks(startDir) {
|
|
|
6135
6154
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
6136
6155
|
if (locked) {
|
|
6137
6156
|
console.error(
|
|
6138
|
-
|
|
6157
|
+
chalk75.red("Build output locked (is VS debugging?): ") + locked
|
|
6139
6158
|
);
|
|
6140
6159
|
process.exit(1);
|
|
6141
6160
|
}
|
|
6142
6161
|
}
|
|
6143
6162
|
async function checkBuildLocksCommand() {
|
|
6144
6163
|
checkBuildLocks();
|
|
6145
|
-
console.log(
|
|
6164
|
+
console.log(chalk75.green("No build locks detected"));
|
|
6146
6165
|
}
|
|
6147
6166
|
|
|
6148
6167
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -6241,30 +6260,30 @@ function escapeRegex(s) {
|
|
|
6241
6260
|
}
|
|
6242
6261
|
|
|
6243
6262
|
// src/commands/dotnet/printTree.ts
|
|
6244
|
-
import
|
|
6263
|
+
import chalk76 from "chalk";
|
|
6245
6264
|
function printNodes(nodes, prefix2) {
|
|
6246
6265
|
for (let i = 0; i < nodes.length; i++) {
|
|
6247
6266
|
const isLast = i === nodes.length - 1;
|
|
6248
6267
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
6249
6268
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
6250
6269
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
6251
|
-
const label2 = isMissing ?
|
|
6270
|
+
const label2 = isMissing ? chalk76.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
6252
6271
|
console.log(`${prefix2}${connector}${label2}`);
|
|
6253
6272
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
6254
6273
|
}
|
|
6255
6274
|
}
|
|
6256
6275
|
function printTree(tree, totalCount, solutions) {
|
|
6257
|
-
console.log(
|
|
6258
|
-
console.log(
|
|
6276
|
+
console.log(chalk76.bold("\nProject Dependency Tree"));
|
|
6277
|
+
console.log(chalk76.cyan(tree.relativePath));
|
|
6259
6278
|
printNodes(tree.children, "");
|
|
6260
|
-
console.log(
|
|
6279
|
+
console.log(chalk76.dim(`
|
|
6261
6280
|
${totalCount} projects total (including root)`));
|
|
6262
|
-
console.log(
|
|
6281
|
+
console.log(chalk76.bold("\nSolution Membership"));
|
|
6263
6282
|
if (solutions.length === 0) {
|
|
6264
|
-
console.log(
|
|
6283
|
+
console.log(chalk76.yellow(" Not found in any .sln"));
|
|
6265
6284
|
} else {
|
|
6266
6285
|
for (const sln of solutions) {
|
|
6267
|
-
console.log(` ${
|
|
6286
|
+
console.log(` ${chalk76.green(sln)}`);
|
|
6268
6287
|
}
|
|
6269
6288
|
}
|
|
6270
6289
|
console.log();
|
|
@@ -6293,16 +6312,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
6293
6312
|
// src/commands/dotnet/resolveCsproj.ts
|
|
6294
6313
|
import { existsSync as existsSync24 } from "fs";
|
|
6295
6314
|
import path24 from "path";
|
|
6296
|
-
import
|
|
6315
|
+
import chalk77 from "chalk";
|
|
6297
6316
|
function resolveCsproj(csprojPath) {
|
|
6298
6317
|
const resolved = path24.resolve(csprojPath);
|
|
6299
6318
|
if (!existsSync24(resolved)) {
|
|
6300
|
-
console.error(
|
|
6319
|
+
console.error(chalk77.red(`File not found: ${resolved}`));
|
|
6301
6320
|
process.exit(1);
|
|
6302
6321
|
}
|
|
6303
6322
|
const repoRoot = findRepoRoot(path24.dirname(resolved));
|
|
6304
6323
|
if (!repoRoot) {
|
|
6305
|
-
console.error(
|
|
6324
|
+
console.error(chalk77.red("Could not find git repository root"));
|
|
6306
6325
|
process.exit(1);
|
|
6307
6326
|
}
|
|
6308
6327
|
return { resolved, repoRoot };
|
|
@@ -6352,12 +6371,12 @@ function getChangedCsFiles(scope) {
|
|
|
6352
6371
|
}
|
|
6353
6372
|
|
|
6354
6373
|
// src/commands/dotnet/inSln.ts
|
|
6355
|
-
import
|
|
6374
|
+
import chalk78 from "chalk";
|
|
6356
6375
|
async function inSln(csprojPath) {
|
|
6357
6376
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
6358
6377
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
6359
6378
|
if (solutions.length === 0) {
|
|
6360
|
-
console.log(
|
|
6379
|
+
console.log(chalk78.yellow("Not found in any .sln file"));
|
|
6361
6380
|
process.exit(1);
|
|
6362
6381
|
}
|
|
6363
6382
|
for (const sln of solutions) {
|
|
@@ -6366,7 +6385,7 @@ async function inSln(csprojPath) {
|
|
|
6366
6385
|
}
|
|
6367
6386
|
|
|
6368
6387
|
// src/commands/dotnet/inspect.ts
|
|
6369
|
-
import
|
|
6388
|
+
import chalk84 from "chalk";
|
|
6370
6389
|
|
|
6371
6390
|
// src/shared/formatElapsed.ts
|
|
6372
6391
|
function formatElapsed(ms) {
|
|
@@ -6378,12 +6397,12 @@ function formatElapsed(ms) {
|
|
|
6378
6397
|
}
|
|
6379
6398
|
|
|
6380
6399
|
// src/commands/dotnet/displayIssues.ts
|
|
6381
|
-
import
|
|
6400
|
+
import chalk79 from "chalk";
|
|
6382
6401
|
var SEVERITY_COLOR = {
|
|
6383
|
-
ERROR:
|
|
6384
|
-
WARNING:
|
|
6385
|
-
SUGGESTION:
|
|
6386
|
-
HINT:
|
|
6402
|
+
ERROR: chalk79.red,
|
|
6403
|
+
WARNING: chalk79.yellow,
|
|
6404
|
+
SUGGESTION: chalk79.cyan,
|
|
6405
|
+
HINT: chalk79.dim
|
|
6387
6406
|
};
|
|
6388
6407
|
function groupByFile(issues) {
|
|
6389
6408
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -6399,15 +6418,15 @@ function groupByFile(issues) {
|
|
|
6399
6418
|
}
|
|
6400
6419
|
function displayIssues(issues) {
|
|
6401
6420
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
6402
|
-
console.log(
|
|
6421
|
+
console.log(chalk79.bold(file));
|
|
6403
6422
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
6404
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
6423
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk79.white;
|
|
6405
6424
|
console.log(
|
|
6406
|
-
` ${
|
|
6425
|
+
` ${chalk79.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
6407
6426
|
);
|
|
6408
6427
|
}
|
|
6409
6428
|
}
|
|
6410
|
-
console.log(
|
|
6429
|
+
console.log(chalk79.dim(`
|
|
6411
6430
|
${issues.length} issue(s) found`));
|
|
6412
6431
|
}
|
|
6413
6432
|
|
|
@@ -6466,12 +6485,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
6466
6485
|
// src/commands/dotnet/resolveSolution.ts
|
|
6467
6486
|
import { existsSync as existsSync25 } from "fs";
|
|
6468
6487
|
import path25 from "path";
|
|
6469
|
-
import
|
|
6488
|
+
import chalk81 from "chalk";
|
|
6470
6489
|
|
|
6471
6490
|
// src/commands/dotnet/findSolution.ts
|
|
6472
6491
|
import { readdirSync as readdirSync4 } from "fs";
|
|
6473
6492
|
import { dirname as dirname16, join as join23 } from "path";
|
|
6474
|
-
import
|
|
6493
|
+
import chalk80 from "chalk";
|
|
6475
6494
|
function findSlnInDir(dir) {
|
|
6476
6495
|
try {
|
|
6477
6496
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join23(dir, f));
|
|
@@ -6487,17 +6506,17 @@ function findSolution() {
|
|
|
6487
6506
|
const slnFiles = findSlnInDir(current);
|
|
6488
6507
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
6489
6508
|
if (slnFiles.length > 1) {
|
|
6490
|
-
console.error(
|
|
6509
|
+
console.error(chalk80.red(`Multiple .sln files found in ${current}:`));
|
|
6491
6510
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
6492
6511
|
console.error(
|
|
6493
|
-
|
|
6512
|
+
chalk80.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
6494
6513
|
);
|
|
6495
6514
|
process.exit(1);
|
|
6496
6515
|
}
|
|
6497
6516
|
if (current === ceiling) break;
|
|
6498
6517
|
current = dirname16(current);
|
|
6499
6518
|
}
|
|
6500
|
-
console.error(
|
|
6519
|
+
console.error(chalk80.red("No .sln file found between cwd and repo root"));
|
|
6501
6520
|
process.exit(1);
|
|
6502
6521
|
}
|
|
6503
6522
|
|
|
@@ -6506,7 +6525,7 @@ function resolveSolution(sln) {
|
|
|
6506
6525
|
if (sln) {
|
|
6507
6526
|
const resolved = path25.resolve(sln);
|
|
6508
6527
|
if (!existsSync25(resolved)) {
|
|
6509
|
-
console.error(
|
|
6528
|
+
console.error(chalk81.red(`Solution file not found: ${resolved}`));
|
|
6510
6529
|
process.exit(1);
|
|
6511
6530
|
}
|
|
6512
6531
|
return resolved;
|
|
@@ -6548,14 +6567,14 @@ import { execSync as execSync23 } from "child_process";
|
|
|
6548
6567
|
import { existsSync as existsSync26, readFileSync as readFileSync24, unlinkSync as unlinkSync5 } from "fs";
|
|
6549
6568
|
import { tmpdir as tmpdir2 } from "os";
|
|
6550
6569
|
import path26 from "path";
|
|
6551
|
-
import
|
|
6570
|
+
import chalk82 from "chalk";
|
|
6552
6571
|
function assertJbInstalled() {
|
|
6553
6572
|
try {
|
|
6554
6573
|
execSync23("jb inspectcode --version", { stdio: "pipe" });
|
|
6555
6574
|
} catch {
|
|
6556
|
-
console.error(
|
|
6575
|
+
console.error(chalk82.red("jb is not installed. Install with:"));
|
|
6557
6576
|
console.error(
|
|
6558
|
-
|
|
6577
|
+
chalk82.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
6559
6578
|
);
|
|
6560
6579
|
process.exit(1);
|
|
6561
6580
|
}
|
|
@@ -6573,11 +6592,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
6573
6592
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
6574
6593
|
process.stderr.write(err.stderr);
|
|
6575
6594
|
}
|
|
6576
|
-
console.error(
|
|
6595
|
+
console.error(chalk82.red("jb inspectcode failed"));
|
|
6577
6596
|
process.exit(1);
|
|
6578
6597
|
}
|
|
6579
6598
|
if (!existsSync26(reportPath)) {
|
|
6580
|
-
console.error(
|
|
6599
|
+
console.error(chalk82.red("Report file not generated"));
|
|
6581
6600
|
process.exit(1);
|
|
6582
6601
|
}
|
|
6583
6602
|
const xml = readFileSync24(reportPath, "utf-8");
|
|
@@ -6587,7 +6606,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
6587
6606
|
|
|
6588
6607
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
6589
6608
|
import { execSync as execSync24 } from "child_process";
|
|
6590
|
-
import
|
|
6609
|
+
import chalk83 from "chalk";
|
|
6591
6610
|
function resolveMsbuildPath() {
|
|
6592
6611
|
const config = loadConfig();
|
|
6593
6612
|
const buildConfig = config.run?.find((r) => r.name === "build");
|
|
@@ -6598,9 +6617,9 @@ function assertMsbuildInstalled() {
|
|
|
6598
6617
|
try {
|
|
6599
6618
|
execSync24(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
6600
6619
|
} catch {
|
|
6601
|
-
console.error(
|
|
6620
|
+
console.error(chalk83.red(`msbuild not found at: ${msbuild}`));
|
|
6602
6621
|
console.error(
|
|
6603
|
-
|
|
6622
|
+
chalk83.yellow(
|
|
6604
6623
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
6605
6624
|
)
|
|
6606
6625
|
);
|
|
@@ -6647,17 +6666,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
6647
6666
|
// src/commands/dotnet/inspect.ts
|
|
6648
6667
|
function logScope(changedFiles) {
|
|
6649
6668
|
if (changedFiles === null) {
|
|
6650
|
-
console.log(
|
|
6669
|
+
console.log(chalk84.dim("Inspecting full solution..."));
|
|
6651
6670
|
} else {
|
|
6652
6671
|
console.log(
|
|
6653
|
-
|
|
6672
|
+
chalk84.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
6654
6673
|
);
|
|
6655
6674
|
}
|
|
6656
6675
|
}
|
|
6657
6676
|
function reportResults(issues, elapsed) {
|
|
6658
6677
|
if (issues.length > 0) displayIssues(issues);
|
|
6659
|
-
else console.log(
|
|
6660
|
-
console.log(
|
|
6678
|
+
else console.log(chalk84.green("No issues found"));
|
|
6679
|
+
console.log(chalk84.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
6661
6680
|
if (issues.length > 0) process.exit(1);
|
|
6662
6681
|
}
|
|
6663
6682
|
async function inspect(sln, options2) {
|
|
@@ -6668,7 +6687,7 @@ async function inspect(sln, options2) {
|
|
|
6668
6687
|
const scope = parseScope(options2.scope);
|
|
6669
6688
|
const changedFiles = getChangedCsFiles(scope);
|
|
6670
6689
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
6671
|
-
console.log(
|
|
6690
|
+
console.log(chalk84.green("No changed .cs files found"));
|
|
6672
6691
|
return;
|
|
6673
6692
|
}
|
|
6674
6693
|
logScope(changedFiles);
|
|
@@ -6694,7 +6713,7 @@ function registerDotnet(program2) {
|
|
|
6694
6713
|
}
|
|
6695
6714
|
|
|
6696
6715
|
// src/commands/jira/acceptanceCriteria.ts
|
|
6697
|
-
import
|
|
6716
|
+
import chalk86 from "chalk";
|
|
6698
6717
|
|
|
6699
6718
|
// src/commands/jira/adfToText.ts
|
|
6700
6719
|
function renderInline(node) {
|
|
@@ -6755,7 +6774,7 @@ function adfToText(doc) {
|
|
|
6755
6774
|
|
|
6756
6775
|
// src/commands/jira/fetchIssue.ts
|
|
6757
6776
|
import { execSync as execSync25 } from "child_process";
|
|
6758
|
-
import
|
|
6777
|
+
import chalk85 from "chalk";
|
|
6759
6778
|
function fetchIssue(issueKey, fields) {
|
|
6760
6779
|
let result;
|
|
6761
6780
|
try {
|
|
@@ -6768,15 +6787,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
6768
6787
|
const stderr = error.stderr;
|
|
6769
6788
|
if (stderr.includes("unauthorized")) {
|
|
6770
6789
|
console.error(
|
|
6771
|
-
|
|
6790
|
+
chalk85.red("Jira authentication expired."),
|
|
6772
6791
|
"Run",
|
|
6773
|
-
|
|
6792
|
+
chalk85.cyan("assist jira auth"),
|
|
6774
6793
|
"to re-authenticate."
|
|
6775
6794
|
);
|
|
6776
6795
|
process.exit(1);
|
|
6777
6796
|
}
|
|
6778
6797
|
}
|
|
6779
|
-
console.error(
|
|
6798
|
+
console.error(chalk85.red(`Failed to fetch ${issueKey}.`));
|
|
6780
6799
|
process.exit(1);
|
|
6781
6800
|
}
|
|
6782
6801
|
return JSON.parse(result);
|
|
@@ -6790,7 +6809,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
6790
6809
|
const parsed = fetchIssue(issueKey, field);
|
|
6791
6810
|
const acValue = parsed?.fields?.[field];
|
|
6792
6811
|
if (!acValue) {
|
|
6793
|
-
console.log(
|
|
6812
|
+
console.log(chalk86.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
6794
6813
|
return;
|
|
6795
6814
|
}
|
|
6796
6815
|
if (typeof acValue === "string") {
|
|
@@ -6885,14 +6904,14 @@ async function jiraAuth() {
|
|
|
6885
6904
|
}
|
|
6886
6905
|
|
|
6887
6906
|
// src/commands/jira/viewIssue.ts
|
|
6888
|
-
import
|
|
6907
|
+
import chalk87 from "chalk";
|
|
6889
6908
|
function viewIssue(issueKey) {
|
|
6890
6909
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
6891
6910
|
const fields = parsed?.fields;
|
|
6892
6911
|
const summary = fields?.summary;
|
|
6893
6912
|
const description = fields?.description;
|
|
6894
6913
|
if (summary) {
|
|
6895
|
-
console.log(
|
|
6914
|
+
console.log(chalk87.bold(summary));
|
|
6896
6915
|
}
|
|
6897
6916
|
if (description) {
|
|
6898
6917
|
if (summary) console.log();
|
|
@@ -6906,7 +6925,7 @@ function viewIssue(issueKey) {
|
|
|
6906
6925
|
}
|
|
6907
6926
|
if (!summary && !description) {
|
|
6908
6927
|
console.log(
|
|
6909
|
-
|
|
6928
|
+
chalk87.yellow(`No summary or description found on ${issueKey}.`)
|
|
6910
6929
|
);
|
|
6911
6930
|
}
|
|
6912
6931
|
}
|
|
@@ -6920,7 +6939,7 @@ function registerJira(program2) {
|
|
|
6920
6939
|
}
|
|
6921
6940
|
|
|
6922
6941
|
// src/commands/news/add/index.ts
|
|
6923
|
-
import
|
|
6942
|
+
import chalk88 from "chalk";
|
|
6924
6943
|
import enquirer7 from "enquirer";
|
|
6925
6944
|
async function add2(url) {
|
|
6926
6945
|
if (!url) {
|
|
@@ -6943,17 +6962,17 @@ async function add2(url) {
|
|
|
6943
6962
|
const news = config.news ?? {};
|
|
6944
6963
|
const feeds = news.feeds ?? [];
|
|
6945
6964
|
if (feeds.includes(url)) {
|
|
6946
|
-
console.log(
|
|
6965
|
+
console.log(chalk88.yellow("Feed already exists in config"));
|
|
6947
6966
|
return;
|
|
6948
6967
|
}
|
|
6949
6968
|
feeds.push(url);
|
|
6950
6969
|
config.news = { ...news, feeds };
|
|
6951
6970
|
saveGlobalConfig(config);
|
|
6952
|
-
console.log(
|
|
6971
|
+
console.log(chalk88.green(`Added feed: ${url}`));
|
|
6953
6972
|
}
|
|
6954
6973
|
|
|
6955
6974
|
// src/commands/news/web/handleRequest.ts
|
|
6956
|
-
import
|
|
6975
|
+
import chalk89 from "chalk";
|
|
6957
6976
|
|
|
6958
6977
|
// src/commands/news/web/shared.ts
|
|
6959
6978
|
import { decodeHTML } from "entities";
|
|
@@ -7089,17 +7108,17 @@ function prefetch() {
|
|
|
7089
7108
|
const config = loadConfig();
|
|
7090
7109
|
const total = config.news.feeds.length;
|
|
7091
7110
|
if (total === 0) return;
|
|
7092
|
-
process.stdout.write(
|
|
7111
|
+
process.stdout.write(chalk89.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
7093
7112
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
7094
7113
|
const width = 20;
|
|
7095
7114
|
const filled = Math.round(done2 / t * width);
|
|
7096
7115
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
7097
7116
|
process.stdout.write(
|
|
7098
|
-
`\r${
|
|
7117
|
+
`\r${chalk89.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
7099
7118
|
);
|
|
7100
7119
|
}).then((items) => {
|
|
7101
7120
|
process.stdout.write(
|
|
7102
|
-
`\r${
|
|
7121
|
+
`\r${chalk89.green(`Fetched ${items.length} items from ${total} feed(s)`)}
|
|
7103
7122
|
`
|
|
7104
7123
|
);
|
|
7105
7124
|
cachedItems = items;
|
|
@@ -7460,20 +7479,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
7460
7479
|
}
|
|
7461
7480
|
|
|
7462
7481
|
// src/commands/prs/listComments/printComments.ts
|
|
7463
|
-
import
|
|
7482
|
+
import chalk90 from "chalk";
|
|
7464
7483
|
function formatForHuman(comment3) {
|
|
7465
7484
|
if (comment3.type === "review") {
|
|
7466
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
7485
|
+
const stateColor = comment3.state === "APPROVED" ? chalk90.green : comment3.state === "CHANGES_REQUESTED" ? chalk90.red : chalk90.yellow;
|
|
7467
7486
|
return [
|
|
7468
|
-
`${
|
|
7487
|
+
`${chalk90.cyan("Review")} by ${chalk90.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
7469
7488
|
comment3.body,
|
|
7470
7489
|
""
|
|
7471
7490
|
].join("\n");
|
|
7472
7491
|
}
|
|
7473
7492
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
7474
7493
|
return [
|
|
7475
|
-
`${
|
|
7476
|
-
|
|
7494
|
+
`${chalk90.cyan("Line comment")} by ${chalk90.bold(comment3.user)} on ${chalk90.dim(`${comment3.path}${location}`)}`,
|
|
7495
|
+
chalk90.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
7477
7496
|
comment3.body,
|
|
7478
7497
|
""
|
|
7479
7498
|
].join("\n");
|
|
@@ -7563,13 +7582,13 @@ import { execSync as execSync32 } from "child_process";
|
|
|
7563
7582
|
import enquirer8 from "enquirer";
|
|
7564
7583
|
|
|
7565
7584
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
7566
|
-
import
|
|
7585
|
+
import chalk91 from "chalk";
|
|
7567
7586
|
var STATUS_MAP = {
|
|
7568
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
7569
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
7587
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk91.magenta("merged"), date: pr.mergedAt } : null,
|
|
7588
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk91.red("closed"), date: pr.closedAt } : null
|
|
7570
7589
|
};
|
|
7571
7590
|
function defaultStatus(pr) {
|
|
7572
|
-
return { label:
|
|
7591
|
+
return { label: chalk91.green("opened"), date: pr.createdAt };
|
|
7573
7592
|
}
|
|
7574
7593
|
function getStatus2(pr) {
|
|
7575
7594
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -7578,11 +7597,11 @@ function formatDate(dateStr) {
|
|
|
7578
7597
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
7579
7598
|
}
|
|
7580
7599
|
function formatPrHeader(pr, status2) {
|
|
7581
|
-
return `${
|
|
7600
|
+
return `${chalk91.cyan(`#${pr.number}`)} ${pr.title} ${chalk91.dim(`(${pr.author.login},`)} ${status2.label} ${chalk91.dim(`${formatDate(status2.date)})`)}`;
|
|
7582
7601
|
}
|
|
7583
7602
|
function logPrDetails(pr) {
|
|
7584
7603
|
console.log(
|
|
7585
|
-
|
|
7604
|
+
chalk91.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
7586
7605
|
);
|
|
7587
7606
|
console.log();
|
|
7588
7607
|
}
|
|
@@ -7748,10 +7767,10 @@ function registerPrs(program2) {
|
|
|
7748
7767
|
}
|
|
7749
7768
|
|
|
7750
7769
|
// src/commands/ravendb/ravendbAuth.ts
|
|
7751
|
-
import
|
|
7770
|
+
import chalk97 from "chalk";
|
|
7752
7771
|
|
|
7753
7772
|
// src/shared/createConnectionAuth.ts
|
|
7754
|
-
import
|
|
7773
|
+
import chalk92 from "chalk";
|
|
7755
7774
|
function listConnections(connections, format2) {
|
|
7756
7775
|
if (connections.length === 0) {
|
|
7757
7776
|
console.log("No connections configured.");
|
|
@@ -7764,7 +7783,7 @@ function listConnections(connections, format2) {
|
|
|
7764
7783
|
function removeConnection(connections, name, save) {
|
|
7765
7784
|
const filtered = connections.filter((c) => c.name !== name);
|
|
7766
7785
|
if (filtered.length === connections.length) {
|
|
7767
|
-
console.error(
|
|
7786
|
+
console.error(chalk92.red(`Connection "${name}" not found.`));
|
|
7768
7787
|
process.exit(1);
|
|
7769
7788
|
}
|
|
7770
7789
|
save(filtered);
|
|
@@ -7810,15 +7829,15 @@ function saveConnections(connections) {
|
|
|
7810
7829
|
}
|
|
7811
7830
|
|
|
7812
7831
|
// src/commands/ravendb/promptConnection.ts
|
|
7813
|
-
import
|
|
7832
|
+
import chalk95 from "chalk";
|
|
7814
7833
|
|
|
7815
7834
|
// src/commands/ravendb/selectOpSecret.ts
|
|
7816
|
-
import
|
|
7835
|
+
import chalk94 from "chalk";
|
|
7817
7836
|
import Enquirer2 from "enquirer";
|
|
7818
7837
|
|
|
7819
7838
|
// src/commands/ravendb/searchItems.ts
|
|
7820
7839
|
import { execSync as execSync34 } from "child_process";
|
|
7821
|
-
import
|
|
7840
|
+
import chalk93 from "chalk";
|
|
7822
7841
|
function opExec(args) {
|
|
7823
7842
|
return execSync34(`op ${args}`, {
|
|
7824
7843
|
encoding: "utf-8",
|
|
@@ -7831,7 +7850,7 @@ function searchItems(search2) {
|
|
|
7831
7850
|
items = JSON.parse(opExec("item list --format=json"));
|
|
7832
7851
|
} catch {
|
|
7833
7852
|
console.error(
|
|
7834
|
-
|
|
7853
|
+
chalk93.red(
|
|
7835
7854
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
7836
7855
|
)
|
|
7837
7856
|
);
|
|
@@ -7845,7 +7864,7 @@ function getItemFields(itemId) {
|
|
|
7845
7864
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
7846
7865
|
return item.fields.filter((f) => f.reference && f.label);
|
|
7847
7866
|
} catch {
|
|
7848
|
-
console.error(
|
|
7867
|
+
console.error(chalk93.red("Failed to get item details from 1Password."));
|
|
7849
7868
|
process.exit(1);
|
|
7850
7869
|
}
|
|
7851
7870
|
}
|
|
@@ -7864,7 +7883,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7864
7883
|
}).run();
|
|
7865
7884
|
const items = searchItems(search2);
|
|
7866
7885
|
if (items.length === 0) {
|
|
7867
|
-
console.error(
|
|
7886
|
+
console.error(chalk94.red(`No items found matching "${search2}".`));
|
|
7868
7887
|
process.exit(1);
|
|
7869
7888
|
}
|
|
7870
7889
|
const itemId = await selectOne(
|
|
@@ -7873,7 +7892,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7873
7892
|
);
|
|
7874
7893
|
const fields = getItemFields(itemId);
|
|
7875
7894
|
if (fields.length === 0) {
|
|
7876
|
-
console.error(
|
|
7895
|
+
console.error(chalk94.red("No fields with references found on this item."));
|
|
7877
7896
|
process.exit(1);
|
|
7878
7897
|
}
|
|
7879
7898
|
const ref = await selectOne(
|
|
@@ -7887,7 +7906,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7887
7906
|
async function promptConnection(existingNames) {
|
|
7888
7907
|
const name = await promptInput("name", "Connection name:");
|
|
7889
7908
|
if (existingNames.includes(name)) {
|
|
7890
|
-
console.error(
|
|
7909
|
+
console.error(chalk95.red(`Connection "${name}" already exists.`));
|
|
7891
7910
|
process.exit(1);
|
|
7892
7911
|
}
|
|
7893
7912
|
const url = await promptInput(
|
|
@@ -7896,22 +7915,22 @@ async function promptConnection(existingNames) {
|
|
|
7896
7915
|
);
|
|
7897
7916
|
const database = await promptInput("database", "Database name:");
|
|
7898
7917
|
if (!name || !url || !database) {
|
|
7899
|
-
console.error(
|
|
7918
|
+
console.error(chalk95.red("All fields are required."));
|
|
7900
7919
|
process.exit(1);
|
|
7901
7920
|
}
|
|
7902
7921
|
const apiKeyRef = await selectOpSecret();
|
|
7903
|
-
console.log(
|
|
7922
|
+
console.log(chalk95.dim(`Using: ${apiKeyRef}`));
|
|
7904
7923
|
return { name, url, database, apiKeyRef };
|
|
7905
7924
|
}
|
|
7906
7925
|
|
|
7907
7926
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
7908
|
-
import
|
|
7927
|
+
import chalk96 from "chalk";
|
|
7909
7928
|
function ravendbSetConnection(name) {
|
|
7910
7929
|
const raw = loadGlobalConfigRaw();
|
|
7911
7930
|
const ravendb = raw.ravendb ?? {};
|
|
7912
7931
|
const connections = ravendb.connections ?? [];
|
|
7913
7932
|
if (!connections.some((c) => c.name === name)) {
|
|
7914
|
-
console.error(
|
|
7933
|
+
console.error(chalk96.red(`Connection "${name}" not found.`));
|
|
7915
7934
|
console.error(
|
|
7916
7935
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
7917
7936
|
);
|
|
@@ -7927,16 +7946,16 @@ function ravendbSetConnection(name) {
|
|
|
7927
7946
|
var ravendbAuth = createConnectionAuth({
|
|
7928
7947
|
load: loadConnections,
|
|
7929
7948
|
save: saveConnections,
|
|
7930
|
-
format: (c) => `${
|
|
7949
|
+
format: (c) => `${chalk97.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
7931
7950
|
promptNew: promptConnection,
|
|
7932
7951
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
7933
7952
|
});
|
|
7934
7953
|
|
|
7935
7954
|
// src/commands/ravendb/ravendbCollections.ts
|
|
7936
|
-
import
|
|
7955
|
+
import chalk101 from "chalk";
|
|
7937
7956
|
|
|
7938
7957
|
// src/commands/ravendb/ravenFetch.ts
|
|
7939
|
-
import
|
|
7958
|
+
import chalk99 from "chalk";
|
|
7940
7959
|
|
|
7941
7960
|
// src/commands/ravendb/getAccessToken.ts
|
|
7942
7961
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -7973,10 +7992,10 @@ ${errorText}`
|
|
|
7973
7992
|
|
|
7974
7993
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
7975
7994
|
import { execSync as execSync35 } from "child_process";
|
|
7976
|
-
import
|
|
7995
|
+
import chalk98 from "chalk";
|
|
7977
7996
|
function resolveOpSecret(reference) {
|
|
7978
7997
|
if (!reference.startsWith("op://")) {
|
|
7979
|
-
console.error(
|
|
7998
|
+
console.error(chalk98.red(`Invalid secret reference: must start with op://`));
|
|
7980
7999
|
process.exit(1);
|
|
7981
8000
|
}
|
|
7982
8001
|
try {
|
|
@@ -7986,7 +8005,7 @@ function resolveOpSecret(reference) {
|
|
|
7986
8005
|
}).trim();
|
|
7987
8006
|
} catch {
|
|
7988
8007
|
console.error(
|
|
7989
|
-
|
|
8008
|
+
chalk98.red(
|
|
7990
8009
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
7991
8010
|
)
|
|
7992
8011
|
);
|
|
@@ -8013,7 +8032,7 @@ async function ravenFetch(connection, path50) {
|
|
|
8013
8032
|
if (!response.ok) {
|
|
8014
8033
|
const body = await response.text();
|
|
8015
8034
|
console.error(
|
|
8016
|
-
|
|
8035
|
+
chalk99.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
8017
8036
|
);
|
|
8018
8037
|
console.error(body.substring(0, 500));
|
|
8019
8038
|
process.exit(1);
|
|
@@ -8022,7 +8041,7 @@ async function ravenFetch(connection, path50) {
|
|
|
8022
8041
|
}
|
|
8023
8042
|
|
|
8024
8043
|
// src/commands/ravendb/resolveConnection.ts
|
|
8025
|
-
import
|
|
8044
|
+
import chalk100 from "chalk";
|
|
8026
8045
|
function loadRavendb() {
|
|
8027
8046
|
const raw = loadGlobalConfigRaw();
|
|
8028
8047
|
const ravendb = raw.ravendb;
|
|
@@ -8036,7 +8055,7 @@ function resolveConnection(name) {
|
|
|
8036
8055
|
const connectionName = name ?? defaultConnection;
|
|
8037
8056
|
if (!connectionName) {
|
|
8038
8057
|
console.error(
|
|
8039
|
-
|
|
8058
|
+
chalk100.red(
|
|
8040
8059
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
8041
8060
|
)
|
|
8042
8061
|
);
|
|
@@ -8044,7 +8063,7 @@ function resolveConnection(name) {
|
|
|
8044
8063
|
}
|
|
8045
8064
|
const connection = connections.find((c) => c.name === connectionName);
|
|
8046
8065
|
if (!connection) {
|
|
8047
|
-
console.error(
|
|
8066
|
+
console.error(chalk100.red(`Connection "${connectionName}" not found.`));
|
|
8048
8067
|
console.error(
|
|
8049
8068
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
8050
8069
|
);
|
|
@@ -8075,15 +8094,15 @@ async function ravendbCollections(connectionName) {
|
|
|
8075
8094
|
return;
|
|
8076
8095
|
}
|
|
8077
8096
|
for (const c of collections) {
|
|
8078
|
-
console.log(`${
|
|
8097
|
+
console.log(`${chalk101.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
8079
8098
|
}
|
|
8080
8099
|
}
|
|
8081
8100
|
|
|
8082
8101
|
// src/commands/ravendb/ravendbQuery.ts
|
|
8083
|
-
import
|
|
8102
|
+
import chalk103 from "chalk";
|
|
8084
8103
|
|
|
8085
8104
|
// src/commands/ravendb/fetchAllPages.ts
|
|
8086
|
-
import
|
|
8105
|
+
import chalk102 from "chalk";
|
|
8087
8106
|
|
|
8088
8107
|
// src/commands/ravendb/buildQueryPath.ts
|
|
8089
8108
|
function buildQueryPath(opts) {
|
|
@@ -8121,7 +8140,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
8121
8140
|
allResults.push(...results);
|
|
8122
8141
|
start3 += results.length;
|
|
8123
8142
|
process.stderr.write(
|
|
8124
|
-
`\r${
|
|
8143
|
+
`\r${chalk102.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
8125
8144
|
);
|
|
8126
8145
|
if (start3 >= totalResults) break;
|
|
8127
8146
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -8136,7 +8155,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
8136
8155
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
8137
8156
|
const resolved = resolveArgs(connectionName, collection);
|
|
8138
8157
|
if (!resolved.collection && !options2.query) {
|
|
8139
|
-
console.error(
|
|
8158
|
+
console.error(chalk103.red("Provide a collection name or --query filter."));
|
|
8140
8159
|
process.exit(1);
|
|
8141
8160
|
}
|
|
8142
8161
|
const { collection: col } = resolved;
|
|
@@ -8174,7 +8193,7 @@ import { spawn as spawn4 } from "child_process";
|
|
|
8174
8193
|
import * as path27 from "path";
|
|
8175
8194
|
|
|
8176
8195
|
// src/commands/refactor/logViolations.ts
|
|
8177
|
-
import
|
|
8196
|
+
import chalk104 from "chalk";
|
|
8178
8197
|
var DEFAULT_MAX_LINES = 100;
|
|
8179
8198
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
8180
8199
|
if (violations.length === 0) {
|
|
@@ -8183,43 +8202,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
8183
8202
|
}
|
|
8184
8203
|
return;
|
|
8185
8204
|
}
|
|
8186
|
-
console.error(
|
|
8205
|
+
console.error(chalk104.red(`
|
|
8187
8206
|
Refactor check failed:
|
|
8188
8207
|
`));
|
|
8189
|
-
console.error(
|
|
8208
|
+
console.error(chalk104.red(` The following files exceed ${maxLines} lines:
|
|
8190
8209
|
`));
|
|
8191
8210
|
for (const violation of violations) {
|
|
8192
|
-
console.error(
|
|
8211
|
+
console.error(chalk104.red(` ${violation.file} (${violation.lines} lines)`));
|
|
8193
8212
|
}
|
|
8194
8213
|
console.error(
|
|
8195
|
-
|
|
8214
|
+
chalk104.yellow(
|
|
8196
8215
|
`
|
|
8197
8216
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
8198
8217
|
way to refactor it, ignore it with:
|
|
8199
8218
|
`
|
|
8200
8219
|
)
|
|
8201
8220
|
);
|
|
8202
|
-
console.error(
|
|
8221
|
+
console.error(chalk104.gray(` assist refactor ignore <file>
|
|
8203
8222
|
`));
|
|
8204
8223
|
if (process.env.CLAUDECODE) {
|
|
8205
|
-
console.error(
|
|
8224
|
+
console.error(chalk104.cyan(`
|
|
8206
8225
|
## Extracting Code to New Files
|
|
8207
8226
|
`));
|
|
8208
8227
|
console.error(
|
|
8209
|
-
|
|
8228
|
+
chalk104.cyan(
|
|
8210
8229
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
8211
8230
|
`
|
|
8212
8231
|
)
|
|
8213
8232
|
);
|
|
8214
8233
|
console.error(
|
|
8215
|
-
|
|
8234
|
+
chalk104.cyan(
|
|
8216
8235
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
8217
8236
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
8218
8237
|
`
|
|
8219
8238
|
)
|
|
8220
8239
|
);
|
|
8221
8240
|
console.error(
|
|
8222
|
-
|
|
8241
|
+
chalk104.cyan(
|
|
8223
8242
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
8224
8243
|
domains, move it to a common/shared folder.
|
|
8225
8244
|
`
|
|
@@ -8375,7 +8394,7 @@ async function check(pattern2, options2) {
|
|
|
8375
8394
|
|
|
8376
8395
|
// src/commands/refactor/extract/index.ts
|
|
8377
8396
|
import path33 from "path";
|
|
8378
|
-
import
|
|
8397
|
+
import chalk107 from "chalk";
|
|
8379
8398
|
|
|
8380
8399
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
8381
8400
|
import { SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
@@ -8922,23 +8941,23 @@ function buildPlan(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
8922
8941
|
|
|
8923
8942
|
// src/commands/refactor/extract/displayPlan.ts
|
|
8924
8943
|
import path31 from "path";
|
|
8925
|
-
import
|
|
8944
|
+
import chalk105 from "chalk";
|
|
8926
8945
|
function section(title) {
|
|
8927
8946
|
return `
|
|
8928
|
-
${
|
|
8947
|
+
${chalk105.cyan(title)}`;
|
|
8929
8948
|
}
|
|
8930
8949
|
function displayImporters(plan2, cwd) {
|
|
8931
8950
|
if (plan2.importersToUpdate.length === 0) return;
|
|
8932
8951
|
console.log(section("Update importers:"));
|
|
8933
8952
|
for (const imp of plan2.importersToUpdate) {
|
|
8934
8953
|
const rel = path31.relative(cwd, imp.file.getFilePath());
|
|
8935
|
-
console.log(` ${
|
|
8954
|
+
console.log(` ${chalk105.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
8936
8955
|
}
|
|
8937
8956
|
}
|
|
8938
8957
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
8939
|
-
console.log(
|
|
8958
|
+
console.log(chalk105.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
8940
8959
|
`));
|
|
8941
|
-
console.log(` ${
|
|
8960
|
+
console.log(` ${chalk105.cyan("Functions to move:")}`);
|
|
8942
8961
|
for (const name of plan2.extractedNames) {
|
|
8943
8962
|
console.log(` ${name}`);
|
|
8944
8963
|
}
|
|
@@ -8973,7 +8992,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
8973
8992
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
8974
8993
|
import fs17 from "fs";
|
|
8975
8994
|
import path32 from "path";
|
|
8976
|
-
import
|
|
8995
|
+
import chalk106 from "chalk";
|
|
8977
8996
|
import { Project as Project2 } from "ts-morph";
|
|
8978
8997
|
function findTsConfig(sourcePath) {
|
|
8979
8998
|
const rootConfig = path32.resolve("tsconfig.json");
|
|
@@ -9004,7 +9023,7 @@ function loadProjectFile(file) {
|
|
|
9004
9023
|
});
|
|
9005
9024
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
9006
9025
|
if (!sourceFile) {
|
|
9007
|
-
console.log(
|
|
9026
|
+
console.log(chalk106.red(`File not found in project: ${file}`));
|
|
9008
9027
|
process.exit(1);
|
|
9009
9028
|
}
|
|
9010
9029
|
return { project, sourceFile };
|
|
@@ -9027,19 +9046,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
9027
9046
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
9028
9047
|
if (options2.apply) {
|
|
9029
9048
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
9030
|
-
console.log(
|
|
9049
|
+
console.log(chalk107.green("\nExtraction complete"));
|
|
9031
9050
|
} else {
|
|
9032
|
-
console.log(
|
|
9051
|
+
console.log(chalk107.dim("\nDry run. Use --apply to execute."));
|
|
9033
9052
|
}
|
|
9034
9053
|
}
|
|
9035
9054
|
|
|
9036
9055
|
// src/commands/refactor/ignore.ts
|
|
9037
9056
|
import fs18 from "fs";
|
|
9038
|
-
import
|
|
9057
|
+
import chalk108 from "chalk";
|
|
9039
9058
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
9040
9059
|
function ignore(file) {
|
|
9041
9060
|
if (!fs18.existsSync(file)) {
|
|
9042
|
-
console.error(
|
|
9061
|
+
console.error(chalk108.red(`Error: File does not exist: ${file}`));
|
|
9043
9062
|
process.exit(1);
|
|
9044
9063
|
}
|
|
9045
9064
|
const content = fs18.readFileSync(file, "utf-8");
|
|
@@ -9055,7 +9074,7 @@ function ignore(file) {
|
|
|
9055
9074
|
fs18.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
9056
9075
|
}
|
|
9057
9076
|
console.log(
|
|
9058
|
-
|
|
9077
|
+
chalk108.green(
|
|
9059
9078
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
9060
9079
|
)
|
|
9061
9080
|
);
|
|
@@ -9063,26 +9082,26 @@ function ignore(file) {
|
|
|
9063
9082
|
|
|
9064
9083
|
// src/commands/refactor/rename/index.ts
|
|
9065
9084
|
import path34 from "path";
|
|
9066
|
-
import
|
|
9085
|
+
import chalk109 from "chalk";
|
|
9067
9086
|
async function rename(source, destination, options2 = {}) {
|
|
9068
9087
|
const destPath = path34.resolve(destination);
|
|
9069
9088
|
const cwd = process.cwd();
|
|
9070
9089
|
const relSource = path34.relative(cwd, path34.resolve(source));
|
|
9071
9090
|
const relDest = path34.relative(cwd, destPath);
|
|
9072
9091
|
const { project, sourceFile } = loadProjectFile(source);
|
|
9073
|
-
console.log(
|
|
9092
|
+
console.log(chalk109.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
9074
9093
|
if (options2.apply) {
|
|
9075
9094
|
sourceFile.move(destPath);
|
|
9076
9095
|
await project.save();
|
|
9077
|
-
console.log(
|
|
9096
|
+
console.log(chalk109.green("Done"));
|
|
9078
9097
|
} else {
|
|
9079
|
-
console.log(
|
|
9098
|
+
console.log(chalk109.dim("Dry run. Use --apply to execute."));
|
|
9080
9099
|
}
|
|
9081
9100
|
}
|
|
9082
9101
|
|
|
9083
9102
|
// src/commands/refactor/renameSymbol/index.ts
|
|
9084
9103
|
import path36 from "path";
|
|
9085
|
-
import
|
|
9104
|
+
import chalk110 from "chalk";
|
|
9086
9105
|
import { Project as Project3 } from "ts-morph";
|
|
9087
9106
|
|
|
9088
9107
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
@@ -9131,38 +9150,38 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
9131
9150
|
const project = new Project3({ tsConfigFilePath: tsConfigPath });
|
|
9132
9151
|
const sourceFile = project.getSourceFile(filePath);
|
|
9133
9152
|
if (!sourceFile) {
|
|
9134
|
-
console.log(
|
|
9153
|
+
console.log(chalk110.red(`File not found in project: ${file}`));
|
|
9135
9154
|
process.exit(1);
|
|
9136
9155
|
}
|
|
9137
9156
|
const symbol = findSymbol(sourceFile, oldName);
|
|
9138
9157
|
if (!symbol) {
|
|
9139
|
-
console.log(
|
|
9158
|
+
console.log(chalk110.red(`Symbol "${oldName}" not found in ${file}`));
|
|
9140
9159
|
process.exit(1);
|
|
9141
9160
|
}
|
|
9142
9161
|
const grouped = groupReferences(symbol, cwd);
|
|
9143
9162
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
9144
9163
|
console.log(
|
|
9145
|
-
|
|
9164
|
+
chalk110.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
9146
9165
|
`)
|
|
9147
9166
|
);
|
|
9148
9167
|
for (const [refFile, lines] of grouped) {
|
|
9149
9168
|
console.log(
|
|
9150
|
-
` ${
|
|
9169
|
+
` ${chalk110.dim(refFile)}: lines ${chalk110.cyan(lines.join(", "))}`
|
|
9151
9170
|
);
|
|
9152
9171
|
}
|
|
9153
9172
|
if (options2.apply) {
|
|
9154
9173
|
symbol.rename(newName);
|
|
9155
9174
|
await project.save();
|
|
9156
|
-
console.log(
|
|
9175
|
+
console.log(chalk110.green(`
|
|
9157
9176
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
9158
9177
|
} else {
|
|
9159
|
-
console.log(
|
|
9178
|
+
console.log(chalk110.dim("\nDry run. Use --apply to execute."));
|
|
9160
9179
|
}
|
|
9161
9180
|
}
|
|
9162
9181
|
|
|
9163
9182
|
// src/commands/refactor/restructure/index.ts
|
|
9164
9183
|
import path45 from "path";
|
|
9165
|
-
import
|
|
9184
|
+
import chalk113 from "chalk";
|
|
9166
9185
|
|
|
9167
9186
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
9168
9187
|
import path37 from "path";
|
|
@@ -9405,50 +9424,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
9405
9424
|
|
|
9406
9425
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
9407
9426
|
import path41 from "path";
|
|
9408
|
-
import
|
|
9427
|
+
import chalk111 from "chalk";
|
|
9409
9428
|
function relPath(filePath) {
|
|
9410
9429
|
return path41.relative(process.cwd(), filePath);
|
|
9411
9430
|
}
|
|
9412
9431
|
function displayMoves(plan2) {
|
|
9413
9432
|
if (plan2.moves.length === 0) return;
|
|
9414
|
-
console.log(
|
|
9433
|
+
console.log(chalk111.bold("\nFile moves:"));
|
|
9415
9434
|
for (const move of plan2.moves) {
|
|
9416
9435
|
console.log(
|
|
9417
|
-
` ${
|
|
9436
|
+
` ${chalk111.red(relPath(move.from))} \u2192 ${chalk111.green(relPath(move.to))}`
|
|
9418
9437
|
);
|
|
9419
|
-
console.log(
|
|
9438
|
+
console.log(chalk111.dim(` ${move.reason}`));
|
|
9420
9439
|
}
|
|
9421
9440
|
}
|
|
9422
9441
|
function displayRewrites(rewrites) {
|
|
9423
9442
|
if (rewrites.length === 0) return;
|
|
9424
9443
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
9425
|
-
console.log(
|
|
9444
|
+
console.log(chalk111.bold(`
|
|
9426
9445
|
Import rewrites (${affectedFiles.size} files):`));
|
|
9427
9446
|
for (const file of affectedFiles) {
|
|
9428
|
-
console.log(` ${
|
|
9447
|
+
console.log(` ${chalk111.cyan(relPath(file))}:`);
|
|
9429
9448
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
9430
9449
|
(r) => r.file === file
|
|
9431
9450
|
)) {
|
|
9432
9451
|
console.log(
|
|
9433
|
-
` ${
|
|
9452
|
+
` ${chalk111.red(`"${oldSpecifier}"`)} \u2192 ${chalk111.green(`"${newSpecifier}"`)}`
|
|
9434
9453
|
);
|
|
9435
9454
|
}
|
|
9436
9455
|
}
|
|
9437
9456
|
}
|
|
9438
9457
|
function displayPlan2(plan2) {
|
|
9439
9458
|
if (plan2.warnings.length > 0) {
|
|
9440
|
-
console.log(
|
|
9441
|
-
for (const w of plan2.warnings) console.log(
|
|
9459
|
+
console.log(chalk111.yellow("\nWarnings:"));
|
|
9460
|
+
for (const w of plan2.warnings) console.log(chalk111.yellow(` ${w}`));
|
|
9442
9461
|
}
|
|
9443
9462
|
if (plan2.newDirectories.length > 0) {
|
|
9444
|
-
console.log(
|
|
9463
|
+
console.log(chalk111.bold("\nNew directories:"));
|
|
9445
9464
|
for (const dir of plan2.newDirectories)
|
|
9446
|
-
console.log(
|
|
9465
|
+
console.log(chalk111.green(` ${dir}/`));
|
|
9447
9466
|
}
|
|
9448
9467
|
displayMoves(plan2);
|
|
9449
9468
|
displayRewrites(plan2.rewrites);
|
|
9450
9469
|
console.log(
|
|
9451
|
-
|
|
9470
|
+
chalk111.dim(
|
|
9452
9471
|
`
|
|
9453
9472
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
9454
9473
|
)
|
|
@@ -9458,18 +9477,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
9458
9477
|
// src/commands/refactor/restructure/executePlan.ts
|
|
9459
9478
|
import fs20 from "fs";
|
|
9460
9479
|
import path42 from "path";
|
|
9461
|
-
import
|
|
9480
|
+
import chalk112 from "chalk";
|
|
9462
9481
|
function executePlan(plan2) {
|
|
9463
9482
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
9464
9483
|
for (const [file, content] of updatedContents) {
|
|
9465
9484
|
fs20.writeFileSync(file, content, "utf-8");
|
|
9466
9485
|
console.log(
|
|
9467
|
-
|
|
9486
|
+
chalk112.cyan(` Rewrote imports in ${path42.relative(process.cwd(), file)}`)
|
|
9468
9487
|
);
|
|
9469
9488
|
}
|
|
9470
9489
|
for (const dir of plan2.newDirectories) {
|
|
9471
9490
|
fs20.mkdirSync(dir, { recursive: true });
|
|
9472
|
-
console.log(
|
|
9491
|
+
console.log(chalk112.green(` Created ${path42.relative(process.cwd(), dir)}/`));
|
|
9473
9492
|
}
|
|
9474
9493
|
for (const move of plan2.moves) {
|
|
9475
9494
|
const targetDir = path42.dirname(move.to);
|
|
@@ -9478,7 +9497,7 @@ function executePlan(plan2) {
|
|
|
9478
9497
|
}
|
|
9479
9498
|
fs20.renameSync(move.from, move.to);
|
|
9480
9499
|
console.log(
|
|
9481
|
-
|
|
9500
|
+
chalk112.white(
|
|
9482
9501
|
` Moved ${path42.relative(process.cwd(), move.from)} \u2192 ${path42.relative(process.cwd(), move.to)}`
|
|
9483
9502
|
)
|
|
9484
9503
|
);
|
|
@@ -9493,7 +9512,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
9493
9512
|
if (entries.length === 0) {
|
|
9494
9513
|
fs20.rmdirSync(dir);
|
|
9495
9514
|
console.log(
|
|
9496
|
-
|
|
9515
|
+
chalk112.dim(
|
|
9497
9516
|
` Removed empty directory ${path42.relative(process.cwd(), dir)}`
|
|
9498
9517
|
)
|
|
9499
9518
|
);
|
|
@@ -9626,22 +9645,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
9626
9645
|
const targetPattern = pattern2 ?? "src";
|
|
9627
9646
|
const files = findSourceFiles2(targetPattern);
|
|
9628
9647
|
if (files.length === 0) {
|
|
9629
|
-
console.log(
|
|
9648
|
+
console.log(chalk113.yellow("No files found matching pattern"));
|
|
9630
9649
|
return;
|
|
9631
9650
|
}
|
|
9632
9651
|
const tsConfigPath = path45.resolve("tsconfig.json");
|
|
9633
9652
|
const plan2 = buildPlan2(files, tsConfigPath);
|
|
9634
9653
|
if (plan2.moves.length === 0) {
|
|
9635
|
-
console.log(
|
|
9654
|
+
console.log(chalk113.green("No restructuring needed"));
|
|
9636
9655
|
return;
|
|
9637
9656
|
}
|
|
9638
9657
|
displayPlan2(plan2);
|
|
9639
9658
|
if (options2.apply) {
|
|
9640
|
-
console.log(
|
|
9659
|
+
console.log(chalk113.bold("\nApplying changes..."));
|
|
9641
9660
|
executePlan(plan2);
|
|
9642
|
-
console.log(
|
|
9661
|
+
console.log(chalk113.green("\nRestructuring complete"));
|
|
9643
9662
|
} else {
|
|
9644
|
-
console.log(
|
|
9663
|
+
console.log(chalk113.dim("\nDry run. Use --apply to execute."));
|
|
9645
9664
|
}
|
|
9646
9665
|
}
|
|
9647
9666
|
|
|
@@ -9681,7 +9700,7 @@ function registerRefactor(program2) {
|
|
|
9681
9700
|
}
|
|
9682
9701
|
|
|
9683
9702
|
// src/commands/seq/seqAuth.ts
|
|
9684
|
-
import
|
|
9703
|
+
import chalk115 from "chalk";
|
|
9685
9704
|
|
|
9686
9705
|
// src/commands/seq/loadConnections.ts
|
|
9687
9706
|
function loadConnections2() {
|
|
@@ -9710,11 +9729,11 @@ function setDefaultConnection(name) {
|
|
|
9710
9729
|
}
|
|
9711
9730
|
|
|
9712
9731
|
// src/commands/seq/promptConnection.ts
|
|
9713
|
-
import
|
|
9732
|
+
import chalk114 from "chalk";
|
|
9714
9733
|
async function promptConnection2(existingNames) {
|
|
9715
9734
|
const name = await promptInput("name", "Connection name:", "default");
|
|
9716
9735
|
if (existingNames.includes(name)) {
|
|
9717
|
-
console.error(
|
|
9736
|
+
console.error(chalk114.red(`Connection "${name}" already exists.`));
|
|
9718
9737
|
process.exit(1);
|
|
9719
9738
|
}
|
|
9720
9739
|
const url = await promptInput("url", "Seq URL:", "http://localhost:5341");
|
|
@@ -9726,16 +9745,16 @@ async function promptConnection2(existingNames) {
|
|
|
9726
9745
|
var seqAuth = createConnectionAuth({
|
|
9727
9746
|
load: loadConnections2,
|
|
9728
9747
|
save: saveConnections2,
|
|
9729
|
-
format: (c) => `${
|
|
9748
|
+
format: (c) => `${chalk115.bold(c.name)} ${c.url}`,
|
|
9730
9749
|
promptNew: promptConnection2,
|
|
9731
9750
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
9732
9751
|
});
|
|
9733
9752
|
|
|
9734
9753
|
// src/commands/seq/seqQuery.ts
|
|
9735
|
-
import
|
|
9754
|
+
import chalk119 from "chalk";
|
|
9736
9755
|
|
|
9737
9756
|
// src/commands/seq/fetchSeq.ts
|
|
9738
|
-
import
|
|
9757
|
+
import chalk116 from "chalk";
|
|
9739
9758
|
async function fetchSeq(conn, path50, params) {
|
|
9740
9759
|
const url = `${conn.url}${path50}?${params}`;
|
|
9741
9760
|
const response = await fetch(url, {
|
|
@@ -9746,7 +9765,7 @@ async function fetchSeq(conn, path50, params) {
|
|
|
9746
9765
|
});
|
|
9747
9766
|
if (!response.ok) {
|
|
9748
9767
|
const body = await response.text();
|
|
9749
|
-
console.error(
|
|
9768
|
+
console.error(chalk116.red(`Seq returned ${response.status}: ${body}`));
|
|
9750
9769
|
process.exit(1);
|
|
9751
9770
|
}
|
|
9752
9771
|
return response;
|
|
@@ -9799,23 +9818,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
9799
9818
|
}
|
|
9800
9819
|
|
|
9801
9820
|
// src/commands/seq/formatEvent.ts
|
|
9802
|
-
import
|
|
9821
|
+
import chalk117 from "chalk";
|
|
9803
9822
|
function levelColor(level) {
|
|
9804
9823
|
switch (level) {
|
|
9805
9824
|
case "Fatal":
|
|
9806
|
-
return
|
|
9825
|
+
return chalk117.bgRed.white;
|
|
9807
9826
|
case "Error":
|
|
9808
|
-
return
|
|
9827
|
+
return chalk117.red;
|
|
9809
9828
|
case "Warning":
|
|
9810
|
-
return
|
|
9829
|
+
return chalk117.yellow;
|
|
9811
9830
|
case "Information":
|
|
9812
|
-
return
|
|
9831
|
+
return chalk117.cyan;
|
|
9813
9832
|
case "Debug":
|
|
9814
|
-
return
|
|
9833
|
+
return chalk117.gray;
|
|
9815
9834
|
case "Verbose":
|
|
9816
|
-
return
|
|
9835
|
+
return chalk117.dim;
|
|
9817
9836
|
default:
|
|
9818
|
-
return
|
|
9837
|
+
return chalk117.white;
|
|
9819
9838
|
}
|
|
9820
9839
|
}
|
|
9821
9840
|
function levelAbbrev(level) {
|
|
@@ -9856,31 +9875,31 @@ function formatTimestamp(iso) {
|
|
|
9856
9875
|
function formatEvent(event) {
|
|
9857
9876
|
const color = levelColor(event.Level);
|
|
9858
9877
|
const abbrev = levelAbbrev(event.Level);
|
|
9859
|
-
const ts8 =
|
|
9878
|
+
const ts8 = chalk117.dim(formatTimestamp(event.Timestamp));
|
|
9860
9879
|
const msg = renderMessage(event);
|
|
9861
9880
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
9862
9881
|
if (event.Exception) {
|
|
9863
9882
|
for (const line of event.Exception.split("\n")) {
|
|
9864
|
-
lines.push(
|
|
9883
|
+
lines.push(chalk117.red(` ${line}`));
|
|
9865
9884
|
}
|
|
9866
9885
|
}
|
|
9867
9886
|
return lines.join("\n");
|
|
9868
9887
|
}
|
|
9869
9888
|
|
|
9870
9889
|
// src/commands/seq/resolveConnection.ts
|
|
9871
|
-
import
|
|
9890
|
+
import chalk118 from "chalk";
|
|
9872
9891
|
function resolveConnection2(name) {
|
|
9873
9892
|
const connections = loadConnections2();
|
|
9874
9893
|
if (connections.length === 0) {
|
|
9875
9894
|
console.error(
|
|
9876
|
-
|
|
9895
|
+
chalk118.red("No Seq connections configured. Run 'assist seq auth' first.")
|
|
9877
9896
|
);
|
|
9878
9897
|
process.exit(1);
|
|
9879
9898
|
}
|
|
9880
9899
|
const target = name ?? getDefaultConnection() ?? connections[0].name;
|
|
9881
9900
|
const connection = connections.find((c) => c.name === target);
|
|
9882
9901
|
if (!connection) {
|
|
9883
|
-
console.error(
|
|
9902
|
+
console.error(chalk118.red(`Seq connection "${target}" not found.`));
|
|
9884
9903
|
process.exit(1);
|
|
9885
9904
|
}
|
|
9886
9905
|
return connection;
|
|
@@ -9895,7 +9914,7 @@ async function seqQuery(filter, options2) {
|
|
|
9895
9914
|
new URLSearchParams({ filter, count: String(count) })
|
|
9896
9915
|
);
|
|
9897
9916
|
if (events.length === 0) {
|
|
9898
|
-
console.log(
|
|
9917
|
+
console.log(chalk119.yellow("No events found."));
|
|
9899
9918
|
return;
|
|
9900
9919
|
}
|
|
9901
9920
|
if (options2.json) {
|
|
@@ -9906,11 +9925,11 @@ async function seqQuery(filter, options2) {
|
|
|
9906
9925
|
for (const event of chronological) {
|
|
9907
9926
|
console.log(formatEvent(event));
|
|
9908
9927
|
}
|
|
9909
|
-
console.log(
|
|
9928
|
+
console.log(chalk119.dim(`
|
|
9910
9929
|
${events.length} events`));
|
|
9911
9930
|
if (events.length >= count) {
|
|
9912
9931
|
console.log(
|
|
9913
|
-
|
|
9932
|
+
chalk119.yellow(
|
|
9914
9933
|
`Results limited to ${count}. Use --count to retrieve more.`
|
|
9915
9934
|
)
|
|
9916
9935
|
);
|
|
@@ -9918,11 +9937,11 @@ ${events.length} events`));
|
|
|
9918
9937
|
}
|
|
9919
9938
|
|
|
9920
9939
|
// src/commands/seq/seqSetConnection.ts
|
|
9921
|
-
import
|
|
9940
|
+
import chalk120 from "chalk";
|
|
9922
9941
|
function seqSetConnection(name) {
|
|
9923
9942
|
const connections = loadConnections2();
|
|
9924
9943
|
if (!connections.find((c) => c.name === name)) {
|
|
9925
|
-
console.error(
|
|
9944
|
+
console.error(chalk120.red(`Connection "${name}" not found.`));
|
|
9926
9945
|
process.exit(1);
|
|
9927
9946
|
}
|
|
9928
9947
|
setDefaultConnection(name);
|
|
@@ -10461,14 +10480,14 @@ import {
|
|
|
10461
10480
|
import { dirname as dirname20, join as join34 } from "path";
|
|
10462
10481
|
|
|
10463
10482
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
10464
|
-
import
|
|
10483
|
+
import chalk121 from "chalk";
|
|
10465
10484
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
10466
10485
|
function validateStagedContent(filename, content) {
|
|
10467
10486
|
const firstLine = content.split("\n")[0];
|
|
10468
10487
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
10469
10488
|
if (!match) {
|
|
10470
10489
|
console.error(
|
|
10471
|
-
|
|
10490
|
+
chalk121.red(
|
|
10472
10491
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
10473
10492
|
)
|
|
10474
10493
|
);
|
|
@@ -10477,7 +10496,7 @@ function validateStagedContent(filename, content) {
|
|
|
10477
10496
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
10478
10497
|
if (!contentAfterLink) {
|
|
10479
10498
|
console.error(
|
|
10480
|
-
|
|
10499
|
+
chalk121.red(
|
|
10481
10500
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
10482
10501
|
)
|
|
10483
10502
|
);
|
|
@@ -10870,7 +10889,7 @@ function registerVoice(program2) {
|
|
|
10870
10889
|
|
|
10871
10890
|
// src/commands/roam/auth.ts
|
|
10872
10891
|
import { randomBytes } from "crypto";
|
|
10873
|
-
import
|
|
10892
|
+
import chalk122 from "chalk";
|
|
10874
10893
|
|
|
10875
10894
|
// src/lib/openBrowser.ts
|
|
10876
10895
|
import { execSync as execSync38 } from "child_process";
|
|
@@ -11045,13 +11064,13 @@ async function auth() {
|
|
|
11045
11064
|
saveGlobalConfig(config);
|
|
11046
11065
|
const state = randomBytes(16).toString("hex");
|
|
11047
11066
|
console.log(
|
|
11048
|
-
|
|
11067
|
+
chalk122.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
11049
11068
|
);
|
|
11050
|
-
console.log(
|
|
11051
|
-
console.log(
|
|
11052
|
-
console.log(
|
|
11069
|
+
console.log(chalk122.white("http://localhost:14523/callback\n"));
|
|
11070
|
+
console.log(chalk122.blue("Opening browser for authorization..."));
|
|
11071
|
+
console.log(chalk122.dim("Waiting for authorization callback..."));
|
|
11053
11072
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
11054
|
-
console.log(
|
|
11073
|
+
console.log(chalk122.dim("Exchanging code for tokens..."));
|
|
11055
11074
|
const tokens = await exchangeToken({
|
|
11056
11075
|
code,
|
|
11057
11076
|
clientId,
|
|
@@ -11067,7 +11086,7 @@ async function auth() {
|
|
|
11067
11086
|
};
|
|
11068
11087
|
saveGlobalConfig(config);
|
|
11069
11088
|
console.log(
|
|
11070
|
-
|
|
11089
|
+
chalk122.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
11071
11090
|
);
|
|
11072
11091
|
}
|
|
11073
11092
|
|
|
@@ -11280,7 +11299,7 @@ import { execSync as execSync40 } from "child_process";
|
|
|
11280
11299
|
import { existsSync as existsSync39, mkdirSync as mkdirSync14, unlinkSync as unlinkSync11, writeFileSync as writeFileSync29 } from "fs";
|
|
11281
11300
|
import { tmpdir as tmpdir6 } from "os";
|
|
11282
11301
|
import { join as join43, resolve as resolve5 } from "path";
|
|
11283
|
-
import
|
|
11302
|
+
import chalk123 from "chalk";
|
|
11284
11303
|
|
|
11285
11304
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
11286
11305
|
var captureWindowPs1 = `
|
|
@@ -11431,22 +11450,22 @@ function screenshot(processName) {
|
|
|
11431
11450
|
const config = loadConfig();
|
|
11432
11451
|
const outputDir = resolve5(config.screenshot.outputDir);
|
|
11433
11452
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
11434
|
-
console.log(
|
|
11453
|
+
console.log(chalk123.gray(`Capturing window for process "${processName}" ...`));
|
|
11435
11454
|
try {
|
|
11436
11455
|
runPowerShellScript(processName, outputPath);
|
|
11437
|
-
console.log(
|
|
11456
|
+
console.log(chalk123.green(`Screenshot saved: ${outputPath}`));
|
|
11438
11457
|
} catch (error) {
|
|
11439
11458
|
const msg = error instanceof Error ? error.message : String(error);
|
|
11440
|
-
console.error(
|
|
11459
|
+
console.error(chalk123.red(`Failed to capture screenshot: ${msg}`));
|
|
11441
11460
|
process.exit(1);
|
|
11442
11461
|
}
|
|
11443
11462
|
}
|
|
11444
11463
|
|
|
11445
11464
|
// src/commands/statusLine.ts
|
|
11446
|
-
import
|
|
11465
|
+
import chalk125 from "chalk";
|
|
11447
11466
|
|
|
11448
11467
|
// src/commands/buildLimitsSegment.ts
|
|
11449
|
-
import
|
|
11468
|
+
import chalk124 from "chalk";
|
|
11450
11469
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
11451
11470
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
11452
11471
|
function formatTimeLeft(resetsAt) {
|
|
@@ -11469,10 +11488,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
11469
11488
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
11470
11489
|
const label2 = `${Math.round(pct)}%`;
|
|
11471
11490
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
11472
|
-
if (projected == null) return
|
|
11473
|
-
if (projected > 100) return
|
|
11474
|
-
if (projected > 75) return
|
|
11475
|
-
return
|
|
11491
|
+
if (projected == null) return chalk124.green(label2);
|
|
11492
|
+
if (projected > 100) return chalk124.red(label2);
|
|
11493
|
+
if (projected > 75) return chalk124.yellow(label2);
|
|
11494
|
+
return chalk124.green(label2);
|
|
11476
11495
|
}
|
|
11477
11496
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
11478
11497
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -11498,14 +11517,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
11498
11517
|
}
|
|
11499
11518
|
|
|
11500
11519
|
// src/commands/statusLine.ts
|
|
11501
|
-
|
|
11520
|
+
chalk125.level = 3;
|
|
11502
11521
|
function formatNumber(num) {
|
|
11503
11522
|
return num.toLocaleString("en-US");
|
|
11504
11523
|
}
|
|
11505
11524
|
function colorizePercent(pct) {
|
|
11506
11525
|
const label2 = `${Math.round(pct)}%`;
|
|
11507
|
-
if (pct > 80) return
|
|
11508
|
-
if (pct > 40) return
|
|
11526
|
+
if (pct > 80) return chalk125.red(label2);
|
|
11527
|
+
if (pct > 40) return chalk125.yellow(label2);
|
|
11509
11528
|
return label2;
|
|
11510
11529
|
}
|
|
11511
11530
|
async function statusLine() {
|
|
@@ -11528,7 +11547,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
11528
11547
|
// src/commands/sync/syncClaudeMd.ts
|
|
11529
11548
|
import * as fs23 from "fs";
|
|
11530
11549
|
import * as path46 from "path";
|
|
11531
|
-
import
|
|
11550
|
+
import chalk126 from "chalk";
|
|
11532
11551
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
11533
11552
|
const source = path46.join(claudeDir, "CLAUDE.md");
|
|
11534
11553
|
const target = path46.join(targetBase, "CLAUDE.md");
|
|
@@ -11537,12 +11556,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
11537
11556
|
const targetContent = fs23.readFileSync(target, "utf-8");
|
|
11538
11557
|
if (sourceContent !== targetContent) {
|
|
11539
11558
|
console.log(
|
|
11540
|
-
|
|
11559
|
+
chalk126.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
11541
11560
|
);
|
|
11542
11561
|
console.log();
|
|
11543
11562
|
printDiff(targetContent, sourceContent);
|
|
11544
11563
|
const confirm = options2?.yes || await promptConfirm(
|
|
11545
|
-
|
|
11564
|
+
chalk126.red("Overwrite existing CLAUDE.md?"),
|
|
11546
11565
|
false
|
|
11547
11566
|
);
|
|
11548
11567
|
if (!confirm) {
|
|
@@ -11558,7 +11577,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
11558
11577
|
// src/commands/sync/syncSettings.ts
|
|
11559
11578
|
import * as fs24 from "fs";
|
|
11560
11579
|
import * as path47 from "path";
|
|
11561
|
-
import
|
|
11580
|
+
import chalk127 from "chalk";
|
|
11562
11581
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
11563
11582
|
const source = path47.join(claudeDir, "settings.json");
|
|
11564
11583
|
const target = path47.join(targetBase, "settings.json");
|
|
@@ -11574,14 +11593,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
11574
11593
|
if (mergedContent !== normalizedTarget) {
|
|
11575
11594
|
if (!options2?.yes) {
|
|
11576
11595
|
console.log(
|
|
11577
|
-
|
|
11596
|
+
chalk127.yellow(
|
|
11578
11597
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
11579
11598
|
)
|
|
11580
11599
|
);
|
|
11581
11600
|
console.log();
|
|
11582
11601
|
printDiff(targetContent, mergedContent);
|
|
11583
11602
|
const confirm = await promptConfirm(
|
|
11584
|
-
|
|
11603
|
+
chalk127.red("Overwrite existing settings.json?"),
|
|
11585
11604
|
false
|
|
11586
11605
|
);
|
|
11587
11606
|
if (!confirm) {
|