@staff0rd/assist 0.174.1 → 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 +514 -493
- 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
|
|
@@ -4391,6 +4410,8 @@ var denyCache;
|
|
|
4391
4410
|
var TOOL_RE = /^(Bash|PowerShell)\((.+?)(:.*)?\)$/;
|
|
4392
4411
|
var SHELL_TOOLS = ["Bash", "PowerShell"];
|
|
4393
4412
|
var DOTSLASH_RE = /^\.[\\/]/;
|
|
4413
|
+
var FD_REDIRECT_RE = /\d+>&\d+/g;
|
|
4414
|
+
var FD_DEVNULL_RE = /\d*>\/dev\/null/g;
|
|
4394
4415
|
function loadPerms(key) {
|
|
4395
4416
|
return parsePerms(readSettingsPerms(key));
|
|
4396
4417
|
}
|
|
@@ -4401,7 +4422,7 @@ function shellEntries(map, toolName) {
|
|
|
4401
4422
|
return map.get(toolName) ?? [];
|
|
4402
4423
|
}
|
|
4403
4424
|
function normCmd(cmd) {
|
|
4404
|
-
return cmd.replace(DOTSLASH_RE, "");
|
|
4425
|
+
return cmd.replace(FD_DEVNULL_RE, "").replace(FD_REDIRECT_RE, "").trim().replace(DOTSLASH_RE, "");
|
|
4405
4426
|
}
|
|
4406
4427
|
function findMatch2(entries, command) {
|
|
4407
4428
|
const norm = normCmd(command);
|
|
@@ -4482,8 +4503,8 @@ function hasUnquotedBackticks(command) {
|
|
|
4482
4503
|
// src/shared/splitCompound.ts
|
|
4483
4504
|
var SEPARATOR_OPS = /* @__PURE__ */ new Set(["|", "&&", "||", ";"]);
|
|
4484
4505
|
var UNSAFE_OPS = /* @__PURE__ */ new Set(["(", ")", ">", ">>", "<", "<&", "|&", ">&"]);
|
|
4485
|
-
var
|
|
4486
|
-
var
|
|
4506
|
+
var FD_REDIRECT_RE2 = /\d+>&\d+/g;
|
|
4507
|
+
var FD_DEVNULL_RE2 = /\d*>\/dev\/null/g;
|
|
4487
4508
|
function splitCompound(command) {
|
|
4488
4509
|
const tokens = tokenizeCommand(command);
|
|
4489
4510
|
if (!tokens) return void 0;
|
|
@@ -4493,7 +4514,7 @@ function splitCompound(command) {
|
|
|
4493
4514
|
return result.length > 0 ? result : void 0;
|
|
4494
4515
|
}
|
|
4495
4516
|
function tokenizeCommand(command) {
|
|
4496
|
-
const trimmed = command.trim().replace(
|
|
4517
|
+
const trimmed = command.trim().replace(FD_DEVNULL_RE2, "").replace(FD_REDIRECT_RE2, "");
|
|
4497
4518
|
if (!trimmed) return void 0;
|
|
4498
4519
|
if (hasUnquotedBackticks(trimmed)) return void 0;
|
|
4499
4520
|
try {
|
|
@@ -4626,48 +4647,48 @@ ${reasons.join("\n")}`);
|
|
|
4626
4647
|
}
|
|
4627
4648
|
|
|
4628
4649
|
// src/commands/deny/denyAdd.ts
|
|
4629
|
-
import
|
|
4650
|
+
import chalk57 from "chalk";
|
|
4630
4651
|
function denyAdd(pattern2, message) {
|
|
4631
4652
|
const config = loadProjectConfig();
|
|
4632
4653
|
const deny = config.deny ?? [];
|
|
4633
4654
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
4634
|
-
console.log(
|
|
4655
|
+
console.log(chalk57.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
4635
4656
|
return;
|
|
4636
4657
|
}
|
|
4637
4658
|
deny.push({ pattern: pattern2, message });
|
|
4638
4659
|
config.deny = deny;
|
|
4639
4660
|
saveConfig(config);
|
|
4640
|
-
console.log(
|
|
4661
|
+
console.log(chalk57.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
4641
4662
|
}
|
|
4642
4663
|
|
|
4643
4664
|
// src/commands/deny/denyList.ts
|
|
4644
|
-
import
|
|
4665
|
+
import chalk58 from "chalk";
|
|
4645
4666
|
function denyList() {
|
|
4646
4667
|
const config = loadConfig();
|
|
4647
4668
|
const deny = config.deny;
|
|
4648
4669
|
if (!deny || deny.length === 0) {
|
|
4649
|
-
console.log(
|
|
4670
|
+
console.log(chalk58.dim("No deny rules configured."));
|
|
4650
4671
|
return;
|
|
4651
4672
|
}
|
|
4652
4673
|
for (const rule of deny) {
|
|
4653
|
-
console.log(`${
|
|
4674
|
+
console.log(`${chalk58.red(rule.pattern)} \u2192 ${rule.message}`);
|
|
4654
4675
|
}
|
|
4655
4676
|
}
|
|
4656
4677
|
|
|
4657
4678
|
// src/commands/deny/denyRemove.ts
|
|
4658
|
-
import
|
|
4679
|
+
import chalk59 from "chalk";
|
|
4659
4680
|
function denyRemove(pattern2) {
|
|
4660
4681
|
const config = loadProjectConfig();
|
|
4661
4682
|
const deny = config.deny ?? [];
|
|
4662
4683
|
const index = deny.findIndex((r) => r.pattern === pattern2);
|
|
4663
4684
|
if (index === -1) {
|
|
4664
|
-
console.log(
|
|
4685
|
+
console.log(chalk59.yellow(`No deny rule found for: ${pattern2}`));
|
|
4665
4686
|
return;
|
|
4666
4687
|
}
|
|
4667
4688
|
deny.splice(index, 1);
|
|
4668
4689
|
config.deny = deny.length > 0 ? deny : void 0;
|
|
4669
4690
|
saveConfig(config);
|
|
4670
|
-
console.log(
|
|
4691
|
+
console.log(chalk59.green(`Removed deny rule: ${pattern2}`));
|
|
4671
4692
|
}
|
|
4672
4693
|
|
|
4673
4694
|
// src/commands/permitCliReads/index.ts
|
|
@@ -4717,11 +4738,11 @@ function assertCliExists(cli) {
|
|
|
4717
4738
|
}
|
|
4718
4739
|
|
|
4719
4740
|
// src/commands/permitCliReads/colorize.ts
|
|
4720
|
-
import
|
|
4741
|
+
import chalk60 from "chalk";
|
|
4721
4742
|
function colorize(plainOutput) {
|
|
4722
4743
|
return plainOutput.split("\n").map((line) => {
|
|
4723
|
-
if (line.startsWith(" R ")) return
|
|
4724
|
-
if (line.startsWith(" W ")) return
|
|
4744
|
+
if (line.startsWith(" R ")) return chalk60.green(line);
|
|
4745
|
+
if (line.startsWith(" W ")) return chalk60.red(line);
|
|
4725
4746
|
return line;
|
|
4726
4747
|
}).join("\n");
|
|
4727
4748
|
}
|
|
@@ -5039,15 +5060,15 @@ function registerCliHook(program2) {
|
|
|
5039
5060
|
}
|
|
5040
5061
|
|
|
5041
5062
|
// src/commands/complexity/analyze.ts
|
|
5042
|
-
import
|
|
5063
|
+
import chalk66 from "chalk";
|
|
5043
5064
|
|
|
5044
5065
|
// src/commands/complexity/cyclomatic.ts
|
|
5045
|
-
import
|
|
5066
|
+
import chalk62 from "chalk";
|
|
5046
5067
|
|
|
5047
5068
|
// src/commands/complexity/shared/index.ts
|
|
5048
5069
|
import fs12 from "fs";
|
|
5049
5070
|
import path20 from "path";
|
|
5050
|
-
import
|
|
5071
|
+
import chalk61 from "chalk";
|
|
5051
5072
|
import ts5 from "typescript";
|
|
5052
5073
|
|
|
5053
5074
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -5293,7 +5314,7 @@ function createSourceFromFile(filePath) {
|
|
|
5293
5314
|
function withSourceFiles(pattern2, callback) {
|
|
5294
5315
|
const files = findSourceFiles2(pattern2);
|
|
5295
5316
|
if (files.length === 0) {
|
|
5296
|
-
console.log(
|
|
5317
|
+
console.log(chalk61.yellow("No files found matching pattern"));
|
|
5297
5318
|
return void 0;
|
|
5298
5319
|
}
|
|
5299
5320
|
return callback(files);
|
|
@@ -5326,11 +5347,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5326
5347
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
5327
5348
|
for (const { file, name, complexity } of results) {
|
|
5328
5349
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
5329
|
-
const color = exceedsThreshold ?
|
|
5330
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
5350
|
+
const color = exceedsThreshold ? chalk62.red : chalk62.white;
|
|
5351
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk62.cyan(complexity)}`);
|
|
5331
5352
|
}
|
|
5332
5353
|
console.log(
|
|
5333
|
-
|
|
5354
|
+
chalk62.dim(
|
|
5334
5355
|
`
|
|
5335
5356
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
5336
5357
|
)
|
|
@@ -5342,7 +5363,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
5342
5363
|
}
|
|
5343
5364
|
|
|
5344
5365
|
// src/commands/complexity/halstead.ts
|
|
5345
|
-
import
|
|
5366
|
+
import chalk63 from "chalk";
|
|
5346
5367
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
5347
5368
|
withSourceFiles(pattern2, (files) => {
|
|
5348
5369
|
const results = [];
|
|
@@ -5357,13 +5378,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5357
5378
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
5358
5379
|
for (const { file, name, metrics } of results) {
|
|
5359
5380
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
5360
|
-
const color = exceedsThreshold ?
|
|
5381
|
+
const color = exceedsThreshold ? chalk63.red : chalk63.white;
|
|
5361
5382
|
console.log(
|
|
5362
|
-
`${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))}`
|
|
5363
5384
|
);
|
|
5364
5385
|
}
|
|
5365
5386
|
console.log(
|
|
5366
|
-
|
|
5387
|
+
chalk63.dim(
|
|
5367
5388
|
`
|
|
5368
5389
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
5369
5390
|
)
|
|
@@ -5378,28 +5399,28 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
5378
5399
|
import fs13 from "fs";
|
|
5379
5400
|
|
|
5380
5401
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
5381
|
-
import
|
|
5402
|
+
import chalk64 from "chalk";
|
|
5382
5403
|
function displayMaintainabilityResults(results, threshold) {
|
|
5383
5404
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
5384
5405
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
5385
|
-
console.log(
|
|
5406
|
+
console.log(chalk64.green("All files pass maintainability threshold"));
|
|
5386
5407
|
} else {
|
|
5387
5408
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
5388
|
-
const color = threshold !== void 0 ?
|
|
5409
|
+
const color = threshold !== void 0 ? chalk64.red : chalk64.white;
|
|
5389
5410
|
console.log(
|
|
5390
|
-
`${color(file)} \u2192 avg: ${
|
|
5411
|
+
`${color(file)} \u2192 avg: ${chalk64.cyan(avgMaintainability.toFixed(1))}, min: ${chalk64.yellow(minMaintainability.toFixed(1))}`
|
|
5391
5412
|
);
|
|
5392
5413
|
}
|
|
5393
5414
|
}
|
|
5394
|
-
console.log(
|
|
5415
|
+
console.log(chalk64.dim(`
|
|
5395
5416
|
Analyzed ${results.length} files`));
|
|
5396
5417
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
5397
5418
|
console.error(
|
|
5398
|
-
|
|
5419
|
+
chalk64.red(
|
|
5399
5420
|
`
|
|
5400
5421
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
5401
5422
|
|
|
5402
|
-
\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.`
|
|
5403
5424
|
)
|
|
5404
5425
|
);
|
|
5405
5426
|
process.exit(1);
|
|
@@ -5456,7 +5477,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5456
5477
|
|
|
5457
5478
|
// src/commands/complexity/sloc.ts
|
|
5458
5479
|
import fs14 from "fs";
|
|
5459
|
-
import
|
|
5480
|
+
import chalk65 from "chalk";
|
|
5460
5481
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
5461
5482
|
withSourceFiles(pattern2, (files) => {
|
|
5462
5483
|
const results = [];
|
|
@@ -5472,12 +5493,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5472
5493
|
results.sort((a, b) => b.lines - a.lines);
|
|
5473
5494
|
for (const { file, lines } of results) {
|
|
5474
5495
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
5475
|
-
const color = exceedsThreshold ?
|
|
5476
|
-
console.log(`${color(file)} \u2192 ${
|
|
5496
|
+
const color = exceedsThreshold ? chalk65.red : chalk65.white;
|
|
5497
|
+
console.log(`${color(file)} \u2192 ${chalk65.cyan(lines)} lines`);
|
|
5477
5498
|
}
|
|
5478
5499
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
5479
5500
|
console.log(
|
|
5480
|
-
|
|
5501
|
+
chalk65.dim(`
|
|
5481
5502
|
Total: ${total} lines across ${files.length} files`)
|
|
5482
5503
|
);
|
|
5483
5504
|
if (hasViolation) {
|
|
@@ -5491,21 +5512,21 @@ async function analyze(pattern2) {
|
|
|
5491
5512
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
5492
5513
|
const files = findSourceFiles2(searchPattern);
|
|
5493
5514
|
if (files.length === 0) {
|
|
5494
|
-
console.log(
|
|
5515
|
+
console.log(chalk66.yellow("No files found matching pattern"));
|
|
5495
5516
|
return;
|
|
5496
5517
|
}
|
|
5497
5518
|
if (files.length === 1) {
|
|
5498
5519
|
const file = files[0];
|
|
5499
|
-
console.log(
|
|
5520
|
+
console.log(chalk66.bold.underline("SLOC"));
|
|
5500
5521
|
await sloc(file);
|
|
5501
5522
|
console.log();
|
|
5502
|
-
console.log(
|
|
5523
|
+
console.log(chalk66.bold.underline("Cyclomatic Complexity"));
|
|
5503
5524
|
await cyclomatic(file);
|
|
5504
5525
|
console.log();
|
|
5505
|
-
console.log(
|
|
5526
|
+
console.log(chalk66.bold.underline("Halstead Metrics"));
|
|
5506
5527
|
await halstead(file);
|
|
5507
5528
|
console.log();
|
|
5508
|
-
console.log(
|
|
5529
|
+
console.log(chalk66.bold.underline("Maintainability Index"));
|
|
5509
5530
|
await maintainability(file);
|
|
5510
5531
|
return;
|
|
5511
5532
|
}
|
|
@@ -5533,7 +5554,7 @@ function registerComplexity(program2) {
|
|
|
5533
5554
|
|
|
5534
5555
|
// src/commands/deploy/redirect.ts
|
|
5535
5556
|
import { existsSync as existsSync22, readFileSync as readFileSync20, writeFileSync as writeFileSync18 } from "fs";
|
|
5536
|
-
import
|
|
5557
|
+
import chalk67 from "chalk";
|
|
5537
5558
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
5538
5559
|
if (!window.location.pathname.endsWith('/')) {
|
|
5539
5560
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -5542,22 +5563,22 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
5542
5563
|
function redirect() {
|
|
5543
5564
|
const indexPath = "index.html";
|
|
5544
5565
|
if (!existsSync22(indexPath)) {
|
|
5545
|
-
console.log(
|
|
5566
|
+
console.log(chalk67.yellow("No index.html found"));
|
|
5546
5567
|
return;
|
|
5547
5568
|
}
|
|
5548
5569
|
const content = readFileSync20(indexPath, "utf-8");
|
|
5549
5570
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
5550
|
-
console.log(
|
|
5571
|
+
console.log(chalk67.dim("Trailing slash script already present"));
|
|
5551
5572
|
return;
|
|
5552
5573
|
}
|
|
5553
5574
|
const headCloseIndex = content.indexOf("</head>");
|
|
5554
5575
|
if (headCloseIndex === -1) {
|
|
5555
|
-
console.log(
|
|
5576
|
+
console.log(chalk67.red("Could not find </head> tag in index.html"));
|
|
5556
5577
|
return;
|
|
5557
5578
|
}
|
|
5558
5579
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
5559
5580
|
writeFileSync18(indexPath, newContent);
|
|
5560
|
-
console.log(
|
|
5581
|
+
console.log(chalk67.green("Added trailing slash redirect to index.html"));
|
|
5561
5582
|
}
|
|
5562
5583
|
|
|
5563
5584
|
// src/commands/registerDeploy.ts
|
|
@@ -5584,7 +5605,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
5584
5605
|
|
|
5585
5606
|
// src/commands/devlog/shared.ts
|
|
5586
5607
|
import { execSync as execSync17 } from "child_process";
|
|
5587
|
-
import
|
|
5608
|
+
import chalk68 from "chalk";
|
|
5588
5609
|
|
|
5589
5610
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
5590
5611
|
import { readdirSync, readFileSync as readFileSync21 } from "fs";
|
|
@@ -5671,13 +5692,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
5671
5692
|
}
|
|
5672
5693
|
function printCommitsWithFiles(commits, ignore2, verbose) {
|
|
5673
5694
|
for (const commit2 of commits) {
|
|
5674
|
-
console.log(` ${
|
|
5695
|
+
console.log(` ${chalk68.yellow(commit2.hash)} ${commit2.message}`);
|
|
5675
5696
|
if (verbose) {
|
|
5676
5697
|
const visibleFiles = commit2.files.filter(
|
|
5677
5698
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
5678
5699
|
);
|
|
5679
5700
|
for (const file of visibleFiles) {
|
|
5680
|
-
console.log(` ${
|
|
5701
|
+
console.log(` ${chalk68.dim(file)}`);
|
|
5681
5702
|
}
|
|
5682
5703
|
}
|
|
5683
5704
|
}
|
|
@@ -5702,15 +5723,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
5702
5723
|
}
|
|
5703
5724
|
|
|
5704
5725
|
// src/commands/devlog/list/printDateHeader.ts
|
|
5705
|
-
import
|
|
5726
|
+
import chalk69 from "chalk";
|
|
5706
5727
|
function printDateHeader(date, isSkipped, entries) {
|
|
5707
5728
|
if (isSkipped) {
|
|
5708
|
-
console.log(`${
|
|
5729
|
+
console.log(`${chalk69.bold.blue(date)} ${chalk69.dim("skipped")}`);
|
|
5709
5730
|
} else if (entries && entries.length > 0) {
|
|
5710
|
-
const entryInfo = entries.map((e) => `${
|
|
5711
|
-
console.log(`${
|
|
5731
|
+
const entryInfo = entries.map((e) => `${chalk69.green(e.version)} ${e.title}`).join(" | ");
|
|
5732
|
+
console.log(`${chalk69.bold.blue(date)} ${entryInfo}`);
|
|
5712
5733
|
} else {
|
|
5713
|
-
console.log(`${
|
|
5734
|
+
console.log(`${chalk69.bold.blue(date)} ${chalk69.red("\u26A0 devlog missing")}`);
|
|
5714
5735
|
}
|
|
5715
5736
|
}
|
|
5716
5737
|
|
|
@@ -5814,24 +5835,24 @@ function bumpVersion(version2, type) {
|
|
|
5814
5835
|
|
|
5815
5836
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
5816
5837
|
import { execSync as execSync20 } from "child_process";
|
|
5817
|
-
import
|
|
5838
|
+
import chalk71 from "chalk";
|
|
5818
5839
|
|
|
5819
5840
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
5820
|
-
import
|
|
5841
|
+
import chalk70 from "chalk";
|
|
5821
5842
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
5822
5843
|
if (conventional && firstHash) {
|
|
5823
5844
|
const version2 = getVersionAtCommit(firstHash);
|
|
5824
5845
|
if (version2) {
|
|
5825
|
-
console.log(`${
|
|
5846
|
+
console.log(`${chalk70.bold("version:")} ${stripToMinor(version2)}`);
|
|
5826
5847
|
} else {
|
|
5827
|
-
console.log(`${
|
|
5848
|
+
console.log(`${chalk70.bold("version:")} ${chalk70.red("unknown")}`);
|
|
5828
5849
|
}
|
|
5829
5850
|
} else if (patchVersion && minorVersion) {
|
|
5830
5851
|
console.log(
|
|
5831
|
-
`${
|
|
5852
|
+
`${chalk70.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
5832
5853
|
);
|
|
5833
5854
|
} else {
|
|
5834
|
-
console.log(`${
|
|
5855
|
+
console.log(`${chalk70.bold("version:")} v0.1 (initial)`);
|
|
5835
5856
|
}
|
|
5836
5857
|
}
|
|
5837
5858
|
|
|
@@ -5878,16 +5899,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
5878
5899
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
5879
5900
|
}
|
|
5880
5901
|
function logName(repoName) {
|
|
5881
|
-
console.log(`${
|
|
5902
|
+
console.log(`${chalk71.bold("name:")} ${repoName}`);
|
|
5882
5903
|
}
|
|
5883
5904
|
function displayNextEntry(ctx, targetDate, commits) {
|
|
5884
5905
|
logName(ctx.repoName);
|
|
5885
5906
|
printVersionInfo(ctx.config, ctx.lastInfo, commits[0]?.hash);
|
|
5886
|
-
console.log(
|
|
5907
|
+
console.log(chalk71.bold.blue(targetDate));
|
|
5887
5908
|
printCommitsWithFiles(commits, ctx.ignore, ctx.verbose);
|
|
5888
5909
|
}
|
|
5889
5910
|
function logNoCommits(lastInfo) {
|
|
5890
|
-
console.log(
|
|
5911
|
+
console.log(chalk71.dim(noCommitsMessage(!!lastInfo)));
|
|
5891
5912
|
}
|
|
5892
5913
|
|
|
5893
5914
|
// src/commands/devlog/next/index.ts
|
|
@@ -5928,11 +5949,11 @@ function next2(options2) {
|
|
|
5928
5949
|
import { execSync as execSync21 } from "child_process";
|
|
5929
5950
|
|
|
5930
5951
|
// src/commands/devlog/repos/printReposTable.ts
|
|
5931
|
-
import
|
|
5952
|
+
import chalk72 from "chalk";
|
|
5932
5953
|
function colorStatus(status2) {
|
|
5933
|
-
if (status2 === "missing") return
|
|
5934
|
-
if (status2 === "outdated") return
|
|
5935
|
-
return
|
|
5954
|
+
if (status2 === "missing") return chalk72.red(status2);
|
|
5955
|
+
if (status2 === "outdated") return chalk72.yellow(status2);
|
|
5956
|
+
return chalk72.green(status2);
|
|
5936
5957
|
}
|
|
5937
5958
|
function formatRow(row, nameWidth) {
|
|
5938
5959
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -5946,8 +5967,8 @@ function printReposTable(rows) {
|
|
|
5946
5967
|
"Last Devlog".padEnd(11),
|
|
5947
5968
|
"Status"
|
|
5948
5969
|
].join(" ");
|
|
5949
|
-
console.log(
|
|
5950
|
-
console.log(
|
|
5970
|
+
console.log(chalk72.dim(header));
|
|
5971
|
+
console.log(chalk72.dim("-".repeat(header.length)));
|
|
5951
5972
|
for (const row of rows) {
|
|
5952
5973
|
console.log(formatRow(row, nameWidth));
|
|
5953
5974
|
}
|
|
@@ -6005,14 +6026,14 @@ function repos(options2) {
|
|
|
6005
6026
|
// src/commands/devlog/skip.ts
|
|
6006
6027
|
import { writeFileSync as writeFileSync19 } from "fs";
|
|
6007
6028
|
import { join as join21 } from "path";
|
|
6008
|
-
import
|
|
6029
|
+
import chalk73 from "chalk";
|
|
6009
6030
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
6010
6031
|
function getBlogConfigPath() {
|
|
6011
6032
|
return join21(BLOG_REPO_ROOT, "assist.yml");
|
|
6012
6033
|
}
|
|
6013
6034
|
function skip(date) {
|
|
6014
6035
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
6015
|
-
console.log(
|
|
6036
|
+
console.log(chalk73.red("Invalid date format. Use YYYY-MM-DD"));
|
|
6016
6037
|
process.exit(1);
|
|
6017
6038
|
}
|
|
6018
6039
|
const repoName = getRepoName();
|
|
@@ -6023,7 +6044,7 @@ function skip(date) {
|
|
|
6023
6044
|
const skipDays = skip2[repoName] ?? [];
|
|
6024
6045
|
if (skipDays.includes(date)) {
|
|
6025
6046
|
console.log(
|
|
6026
|
-
|
|
6047
|
+
chalk73.yellow(`${date} is already in skip list for ${repoName}`)
|
|
6027
6048
|
);
|
|
6028
6049
|
return;
|
|
6029
6050
|
}
|
|
@@ -6033,20 +6054,20 @@ function skip(date) {
|
|
|
6033
6054
|
devlog.skip = skip2;
|
|
6034
6055
|
config.devlog = devlog;
|
|
6035
6056
|
writeFileSync19(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
6036
|
-
console.log(
|
|
6057
|
+
console.log(chalk73.green(`Added ${date} to skip list for ${repoName}`));
|
|
6037
6058
|
}
|
|
6038
6059
|
|
|
6039
6060
|
// src/commands/devlog/version.ts
|
|
6040
|
-
import
|
|
6061
|
+
import chalk74 from "chalk";
|
|
6041
6062
|
function version() {
|
|
6042
6063
|
const config = loadConfig();
|
|
6043
6064
|
const name = getRepoName();
|
|
6044
6065
|
const lastInfo = getLastVersionInfo(name, config);
|
|
6045
6066
|
const lastVersion = lastInfo?.version ?? null;
|
|
6046
6067
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
6047
|
-
console.log(`${
|
|
6048
|
-
console.log(`${
|
|
6049
|
-
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")}`);
|
|
6050
6071
|
}
|
|
6051
6072
|
|
|
6052
6073
|
// src/commands/registerDevlog.ts
|
|
@@ -6070,7 +6091,7 @@ function registerDevlog(program2) {
|
|
|
6070
6091
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
6071
6092
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
6072
6093
|
import { join as join22 } from "path";
|
|
6073
|
-
import
|
|
6094
|
+
import chalk75 from "chalk";
|
|
6074
6095
|
|
|
6075
6096
|
// src/shared/findRepoRoot.ts
|
|
6076
6097
|
import { existsSync as existsSync23 } from "fs";
|
|
@@ -6133,14 +6154,14 @@ function checkBuildLocks(startDir) {
|
|
|
6133
6154
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
6134
6155
|
if (locked) {
|
|
6135
6156
|
console.error(
|
|
6136
|
-
|
|
6157
|
+
chalk75.red("Build output locked (is VS debugging?): ") + locked
|
|
6137
6158
|
);
|
|
6138
6159
|
process.exit(1);
|
|
6139
6160
|
}
|
|
6140
6161
|
}
|
|
6141
6162
|
async function checkBuildLocksCommand() {
|
|
6142
6163
|
checkBuildLocks();
|
|
6143
|
-
console.log(
|
|
6164
|
+
console.log(chalk75.green("No build locks detected"));
|
|
6144
6165
|
}
|
|
6145
6166
|
|
|
6146
6167
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -6239,30 +6260,30 @@ function escapeRegex(s) {
|
|
|
6239
6260
|
}
|
|
6240
6261
|
|
|
6241
6262
|
// src/commands/dotnet/printTree.ts
|
|
6242
|
-
import
|
|
6263
|
+
import chalk76 from "chalk";
|
|
6243
6264
|
function printNodes(nodes, prefix2) {
|
|
6244
6265
|
for (let i = 0; i < nodes.length; i++) {
|
|
6245
6266
|
const isLast = i === nodes.length - 1;
|
|
6246
6267
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
6247
6268
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
6248
6269
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
6249
|
-
const label2 = isMissing ?
|
|
6270
|
+
const label2 = isMissing ? chalk76.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
6250
6271
|
console.log(`${prefix2}${connector}${label2}`);
|
|
6251
6272
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
6252
6273
|
}
|
|
6253
6274
|
}
|
|
6254
6275
|
function printTree(tree, totalCount, solutions) {
|
|
6255
|
-
console.log(
|
|
6256
|
-
console.log(
|
|
6276
|
+
console.log(chalk76.bold("\nProject Dependency Tree"));
|
|
6277
|
+
console.log(chalk76.cyan(tree.relativePath));
|
|
6257
6278
|
printNodes(tree.children, "");
|
|
6258
|
-
console.log(
|
|
6279
|
+
console.log(chalk76.dim(`
|
|
6259
6280
|
${totalCount} projects total (including root)`));
|
|
6260
|
-
console.log(
|
|
6281
|
+
console.log(chalk76.bold("\nSolution Membership"));
|
|
6261
6282
|
if (solutions.length === 0) {
|
|
6262
|
-
console.log(
|
|
6283
|
+
console.log(chalk76.yellow(" Not found in any .sln"));
|
|
6263
6284
|
} else {
|
|
6264
6285
|
for (const sln of solutions) {
|
|
6265
|
-
console.log(` ${
|
|
6286
|
+
console.log(` ${chalk76.green(sln)}`);
|
|
6266
6287
|
}
|
|
6267
6288
|
}
|
|
6268
6289
|
console.log();
|
|
@@ -6291,16 +6312,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
6291
6312
|
// src/commands/dotnet/resolveCsproj.ts
|
|
6292
6313
|
import { existsSync as existsSync24 } from "fs";
|
|
6293
6314
|
import path24 from "path";
|
|
6294
|
-
import
|
|
6315
|
+
import chalk77 from "chalk";
|
|
6295
6316
|
function resolveCsproj(csprojPath) {
|
|
6296
6317
|
const resolved = path24.resolve(csprojPath);
|
|
6297
6318
|
if (!existsSync24(resolved)) {
|
|
6298
|
-
console.error(
|
|
6319
|
+
console.error(chalk77.red(`File not found: ${resolved}`));
|
|
6299
6320
|
process.exit(1);
|
|
6300
6321
|
}
|
|
6301
6322
|
const repoRoot = findRepoRoot(path24.dirname(resolved));
|
|
6302
6323
|
if (!repoRoot) {
|
|
6303
|
-
console.error(
|
|
6324
|
+
console.error(chalk77.red("Could not find git repository root"));
|
|
6304
6325
|
process.exit(1);
|
|
6305
6326
|
}
|
|
6306
6327
|
return { resolved, repoRoot };
|
|
@@ -6350,12 +6371,12 @@ function getChangedCsFiles(scope) {
|
|
|
6350
6371
|
}
|
|
6351
6372
|
|
|
6352
6373
|
// src/commands/dotnet/inSln.ts
|
|
6353
|
-
import
|
|
6374
|
+
import chalk78 from "chalk";
|
|
6354
6375
|
async function inSln(csprojPath) {
|
|
6355
6376
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
6356
6377
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
6357
6378
|
if (solutions.length === 0) {
|
|
6358
|
-
console.log(
|
|
6379
|
+
console.log(chalk78.yellow("Not found in any .sln file"));
|
|
6359
6380
|
process.exit(1);
|
|
6360
6381
|
}
|
|
6361
6382
|
for (const sln of solutions) {
|
|
@@ -6364,7 +6385,7 @@ async function inSln(csprojPath) {
|
|
|
6364
6385
|
}
|
|
6365
6386
|
|
|
6366
6387
|
// src/commands/dotnet/inspect.ts
|
|
6367
|
-
import
|
|
6388
|
+
import chalk84 from "chalk";
|
|
6368
6389
|
|
|
6369
6390
|
// src/shared/formatElapsed.ts
|
|
6370
6391
|
function formatElapsed(ms) {
|
|
@@ -6376,12 +6397,12 @@ function formatElapsed(ms) {
|
|
|
6376
6397
|
}
|
|
6377
6398
|
|
|
6378
6399
|
// src/commands/dotnet/displayIssues.ts
|
|
6379
|
-
import
|
|
6400
|
+
import chalk79 from "chalk";
|
|
6380
6401
|
var SEVERITY_COLOR = {
|
|
6381
|
-
ERROR:
|
|
6382
|
-
WARNING:
|
|
6383
|
-
SUGGESTION:
|
|
6384
|
-
HINT:
|
|
6402
|
+
ERROR: chalk79.red,
|
|
6403
|
+
WARNING: chalk79.yellow,
|
|
6404
|
+
SUGGESTION: chalk79.cyan,
|
|
6405
|
+
HINT: chalk79.dim
|
|
6385
6406
|
};
|
|
6386
6407
|
function groupByFile(issues) {
|
|
6387
6408
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -6397,15 +6418,15 @@ function groupByFile(issues) {
|
|
|
6397
6418
|
}
|
|
6398
6419
|
function displayIssues(issues) {
|
|
6399
6420
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
6400
|
-
console.log(
|
|
6421
|
+
console.log(chalk79.bold(file));
|
|
6401
6422
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
6402
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
6423
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk79.white;
|
|
6403
6424
|
console.log(
|
|
6404
|
-
` ${
|
|
6425
|
+
` ${chalk79.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
6405
6426
|
);
|
|
6406
6427
|
}
|
|
6407
6428
|
}
|
|
6408
|
-
console.log(
|
|
6429
|
+
console.log(chalk79.dim(`
|
|
6409
6430
|
${issues.length} issue(s) found`));
|
|
6410
6431
|
}
|
|
6411
6432
|
|
|
@@ -6464,12 +6485,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
6464
6485
|
// src/commands/dotnet/resolveSolution.ts
|
|
6465
6486
|
import { existsSync as existsSync25 } from "fs";
|
|
6466
6487
|
import path25 from "path";
|
|
6467
|
-
import
|
|
6488
|
+
import chalk81 from "chalk";
|
|
6468
6489
|
|
|
6469
6490
|
// src/commands/dotnet/findSolution.ts
|
|
6470
6491
|
import { readdirSync as readdirSync4 } from "fs";
|
|
6471
6492
|
import { dirname as dirname16, join as join23 } from "path";
|
|
6472
|
-
import
|
|
6493
|
+
import chalk80 from "chalk";
|
|
6473
6494
|
function findSlnInDir(dir) {
|
|
6474
6495
|
try {
|
|
6475
6496
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join23(dir, f));
|
|
@@ -6485,17 +6506,17 @@ function findSolution() {
|
|
|
6485
6506
|
const slnFiles = findSlnInDir(current);
|
|
6486
6507
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
6487
6508
|
if (slnFiles.length > 1) {
|
|
6488
|
-
console.error(
|
|
6509
|
+
console.error(chalk80.red(`Multiple .sln files found in ${current}:`));
|
|
6489
6510
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
6490
6511
|
console.error(
|
|
6491
|
-
|
|
6512
|
+
chalk80.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
6492
6513
|
);
|
|
6493
6514
|
process.exit(1);
|
|
6494
6515
|
}
|
|
6495
6516
|
if (current === ceiling) break;
|
|
6496
6517
|
current = dirname16(current);
|
|
6497
6518
|
}
|
|
6498
|
-
console.error(
|
|
6519
|
+
console.error(chalk80.red("No .sln file found between cwd and repo root"));
|
|
6499
6520
|
process.exit(1);
|
|
6500
6521
|
}
|
|
6501
6522
|
|
|
@@ -6504,7 +6525,7 @@ function resolveSolution(sln) {
|
|
|
6504
6525
|
if (sln) {
|
|
6505
6526
|
const resolved = path25.resolve(sln);
|
|
6506
6527
|
if (!existsSync25(resolved)) {
|
|
6507
|
-
console.error(
|
|
6528
|
+
console.error(chalk81.red(`Solution file not found: ${resolved}`));
|
|
6508
6529
|
process.exit(1);
|
|
6509
6530
|
}
|
|
6510
6531
|
return resolved;
|
|
@@ -6546,14 +6567,14 @@ import { execSync as execSync23 } from "child_process";
|
|
|
6546
6567
|
import { existsSync as existsSync26, readFileSync as readFileSync24, unlinkSync as unlinkSync5 } from "fs";
|
|
6547
6568
|
import { tmpdir as tmpdir2 } from "os";
|
|
6548
6569
|
import path26 from "path";
|
|
6549
|
-
import
|
|
6570
|
+
import chalk82 from "chalk";
|
|
6550
6571
|
function assertJbInstalled() {
|
|
6551
6572
|
try {
|
|
6552
6573
|
execSync23("jb inspectcode --version", { stdio: "pipe" });
|
|
6553
6574
|
} catch {
|
|
6554
|
-
console.error(
|
|
6575
|
+
console.error(chalk82.red("jb is not installed. Install with:"));
|
|
6555
6576
|
console.error(
|
|
6556
|
-
|
|
6577
|
+
chalk82.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
6557
6578
|
);
|
|
6558
6579
|
process.exit(1);
|
|
6559
6580
|
}
|
|
@@ -6571,11 +6592,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
6571
6592
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
6572
6593
|
process.stderr.write(err.stderr);
|
|
6573
6594
|
}
|
|
6574
|
-
console.error(
|
|
6595
|
+
console.error(chalk82.red("jb inspectcode failed"));
|
|
6575
6596
|
process.exit(1);
|
|
6576
6597
|
}
|
|
6577
6598
|
if (!existsSync26(reportPath)) {
|
|
6578
|
-
console.error(
|
|
6599
|
+
console.error(chalk82.red("Report file not generated"));
|
|
6579
6600
|
process.exit(1);
|
|
6580
6601
|
}
|
|
6581
6602
|
const xml = readFileSync24(reportPath, "utf-8");
|
|
@@ -6585,7 +6606,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
6585
6606
|
|
|
6586
6607
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
6587
6608
|
import { execSync as execSync24 } from "child_process";
|
|
6588
|
-
import
|
|
6609
|
+
import chalk83 from "chalk";
|
|
6589
6610
|
function resolveMsbuildPath() {
|
|
6590
6611
|
const config = loadConfig();
|
|
6591
6612
|
const buildConfig = config.run?.find((r) => r.name === "build");
|
|
@@ -6596,9 +6617,9 @@ function assertMsbuildInstalled() {
|
|
|
6596
6617
|
try {
|
|
6597
6618
|
execSync24(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
6598
6619
|
} catch {
|
|
6599
|
-
console.error(
|
|
6620
|
+
console.error(chalk83.red(`msbuild not found at: ${msbuild}`));
|
|
6600
6621
|
console.error(
|
|
6601
|
-
|
|
6622
|
+
chalk83.yellow(
|
|
6602
6623
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
6603
6624
|
)
|
|
6604
6625
|
);
|
|
@@ -6645,17 +6666,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
6645
6666
|
// src/commands/dotnet/inspect.ts
|
|
6646
6667
|
function logScope(changedFiles) {
|
|
6647
6668
|
if (changedFiles === null) {
|
|
6648
|
-
console.log(
|
|
6669
|
+
console.log(chalk84.dim("Inspecting full solution..."));
|
|
6649
6670
|
} else {
|
|
6650
6671
|
console.log(
|
|
6651
|
-
|
|
6672
|
+
chalk84.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
6652
6673
|
);
|
|
6653
6674
|
}
|
|
6654
6675
|
}
|
|
6655
6676
|
function reportResults(issues, elapsed) {
|
|
6656
6677
|
if (issues.length > 0) displayIssues(issues);
|
|
6657
|
-
else console.log(
|
|
6658
|
-
console.log(
|
|
6678
|
+
else console.log(chalk84.green("No issues found"));
|
|
6679
|
+
console.log(chalk84.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
6659
6680
|
if (issues.length > 0) process.exit(1);
|
|
6660
6681
|
}
|
|
6661
6682
|
async function inspect(sln, options2) {
|
|
@@ -6666,7 +6687,7 @@ async function inspect(sln, options2) {
|
|
|
6666
6687
|
const scope = parseScope(options2.scope);
|
|
6667
6688
|
const changedFiles = getChangedCsFiles(scope);
|
|
6668
6689
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
6669
|
-
console.log(
|
|
6690
|
+
console.log(chalk84.green("No changed .cs files found"));
|
|
6670
6691
|
return;
|
|
6671
6692
|
}
|
|
6672
6693
|
logScope(changedFiles);
|
|
@@ -6692,7 +6713,7 @@ function registerDotnet(program2) {
|
|
|
6692
6713
|
}
|
|
6693
6714
|
|
|
6694
6715
|
// src/commands/jira/acceptanceCriteria.ts
|
|
6695
|
-
import
|
|
6716
|
+
import chalk86 from "chalk";
|
|
6696
6717
|
|
|
6697
6718
|
// src/commands/jira/adfToText.ts
|
|
6698
6719
|
function renderInline(node) {
|
|
@@ -6753,7 +6774,7 @@ function adfToText(doc) {
|
|
|
6753
6774
|
|
|
6754
6775
|
// src/commands/jira/fetchIssue.ts
|
|
6755
6776
|
import { execSync as execSync25 } from "child_process";
|
|
6756
|
-
import
|
|
6777
|
+
import chalk85 from "chalk";
|
|
6757
6778
|
function fetchIssue(issueKey, fields) {
|
|
6758
6779
|
let result;
|
|
6759
6780
|
try {
|
|
@@ -6766,15 +6787,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
6766
6787
|
const stderr = error.stderr;
|
|
6767
6788
|
if (stderr.includes("unauthorized")) {
|
|
6768
6789
|
console.error(
|
|
6769
|
-
|
|
6790
|
+
chalk85.red("Jira authentication expired."),
|
|
6770
6791
|
"Run",
|
|
6771
|
-
|
|
6792
|
+
chalk85.cyan("assist jira auth"),
|
|
6772
6793
|
"to re-authenticate."
|
|
6773
6794
|
);
|
|
6774
6795
|
process.exit(1);
|
|
6775
6796
|
}
|
|
6776
6797
|
}
|
|
6777
|
-
console.error(
|
|
6798
|
+
console.error(chalk85.red(`Failed to fetch ${issueKey}.`));
|
|
6778
6799
|
process.exit(1);
|
|
6779
6800
|
}
|
|
6780
6801
|
return JSON.parse(result);
|
|
@@ -6788,7 +6809,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
6788
6809
|
const parsed = fetchIssue(issueKey, field);
|
|
6789
6810
|
const acValue = parsed?.fields?.[field];
|
|
6790
6811
|
if (!acValue) {
|
|
6791
|
-
console.log(
|
|
6812
|
+
console.log(chalk86.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
6792
6813
|
return;
|
|
6793
6814
|
}
|
|
6794
6815
|
if (typeof acValue === "string") {
|
|
@@ -6883,14 +6904,14 @@ async function jiraAuth() {
|
|
|
6883
6904
|
}
|
|
6884
6905
|
|
|
6885
6906
|
// src/commands/jira/viewIssue.ts
|
|
6886
|
-
import
|
|
6907
|
+
import chalk87 from "chalk";
|
|
6887
6908
|
function viewIssue(issueKey) {
|
|
6888
6909
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
6889
6910
|
const fields = parsed?.fields;
|
|
6890
6911
|
const summary = fields?.summary;
|
|
6891
6912
|
const description = fields?.description;
|
|
6892
6913
|
if (summary) {
|
|
6893
|
-
console.log(
|
|
6914
|
+
console.log(chalk87.bold(summary));
|
|
6894
6915
|
}
|
|
6895
6916
|
if (description) {
|
|
6896
6917
|
if (summary) console.log();
|
|
@@ -6904,7 +6925,7 @@ function viewIssue(issueKey) {
|
|
|
6904
6925
|
}
|
|
6905
6926
|
if (!summary && !description) {
|
|
6906
6927
|
console.log(
|
|
6907
|
-
|
|
6928
|
+
chalk87.yellow(`No summary or description found on ${issueKey}.`)
|
|
6908
6929
|
);
|
|
6909
6930
|
}
|
|
6910
6931
|
}
|
|
@@ -6918,7 +6939,7 @@ function registerJira(program2) {
|
|
|
6918
6939
|
}
|
|
6919
6940
|
|
|
6920
6941
|
// src/commands/news/add/index.ts
|
|
6921
|
-
import
|
|
6942
|
+
import chalk88 from "chalk";
|
|
6922
6943
|
import enquirer7 from "enquirer";
|
|
6923
6944
|
async function add2(url) {
|
|
6924
6945
|
if (!url) {
|
|
@@ -6941,17 +6962,17 @@ async function add2(url) {
|
|
|
6941
6962
|
const news = config.news ?? {};
|
|
6942
6963
|
const feeds = news.feeds ?? [];
|
|
6943
6964
|
if (feeds.includes(url)) {
|
|
6944
|
-
console.log(
|
|
6965
|
+
console.log(chalk88.yellow("Feed already exists in config"));
|
|
6945
6966
|
return;
|
|
6946
6967
|
}
|
|
6947
6968
|
feeds.push(url);
|
|
6948
6969
|
config.news = { ...news, feeds };
|
|
6949
6970
|
saveGlobalConfig(config);
|
|
6950
|
-
console.log(
|
|
6971
|
+
console.log(chalk88.green(`Added feed: ${url}`));
|
|
6951
6972
|
}
|
|
6952
6973
|
|
|
6953
6974
|
// src/commands/news/web/handleRequest.ts
|
|
6954
|
-
import
|
|
6975
|
+
import chalk89 from "chalk";
|
|
6955
6976
|
|
|
6956
6977
|
// src/commands/news/web/shared.ts
|
|
6957
6978
|
import { decodeHTML } from "entities";
|
|
@@ -7087,17 +7108,17 @@ function prefetch() {
|
|
|
7087
7108
|
const config = loadConfig();
|
|
7088
7109
|
const total = config.news.feeds.length;
|
|
7089
7110
|
if (total === 0) return;
|
|
7090
|
-
process.stdout.write(
|
|
7111
|
+
process.stdout.write(chalk89.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
7091
7112
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
7092
7113
|
const width = 20;
|
|
7093
7114
|
const filled = Math.round(done2 / t * width);
|
|
7094
7115
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
7095
7116
|
process.stdout.write(
|
|
7096
|
-
`\r${
|
|
7117
|
+
`\r${chalk89.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
7097
7118
|
);
|
|
7098
7119
|
}).then((items) => {
|
|
7099
7120
|
process.stdout.write(
|
|
7100
|
-
`\r${
|
|
7121
|
+
`\r${chalk89.green(`Fetched ${items.length} items from ${total} feed(s)`)}
|
|
7101
7122
|
`
|
|
7102
7123
|
);
|
|
7103
7124
|
cachedItems = items;
|
|
@@ -7458,20 +7479,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
7458
7479
|
}
|
|
7459
7480
|
|
|
7460
7481
|
// src/commands/prs/listComments/printComments.ts
|
|
7461
|
-
import
|
|
7482
|
+
import chalk90 from "chalk";
|
|
7462
7483
|
function formatForHuman(comment3) {
|
|
7463
7484
|
if (comment3.type === "review") {
|
|
7464
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
7485
|
+
const stateColor = comment3.state === "APPROVED" ? chalk90.green : comment3.state === "CHANGES_REQUESTED" ? chalk90.red : chalk90.yellow;
|
|
7465
7486
|
return [
|
|
7466
|
-
`${
|
|
7487
|
+
`${chalk90.cyan("Review")} by ${chalk90.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
7467
7488
|
comment3.body,
|
|
7468
7489
|
""
|
|
7469
7490
|
].join("\n");
|
|
7470
7491
|
}
|
|
7471
7492
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
7472
7493
|
return [
|
|
7473
|
-
`${
|
|
7474
|
-
|
|
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")),
|
|
7475
7496
|
comment3.body,
|
|
7476
7497
|
""
|
|
7477
7498
|
].join("\n");
|
|
@@ -7561,13 +7582,13 @@ import { execSync as execSync32 } from "child_process";
|
|
|
7561
7582
|
import enquirer8 from "enquirer";
|
|
7562
7583
|
|
|
7563
7584
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
7564
|
-
import
|
|
7585
|
+
import chalk91 from "chalk";
|
|
7565
7586
|
var STATUS_MAP = {
|
|
7566
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
7567
|
-
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
|
|
7568
7589
|
};
|
|
7569
7590
|
function defaultStatus(pr) {
|
|
7570
|
-
return { label:
|
|
7591
|
+
return { label: chalk91.green("opened"), date: pr.createdAt };
|
|
7571
7592
|
}
|
|
7572
7593
|
function getStatus2(pr) {
|
|
7573
7594
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -7576,11 +7597,11 @@ function formatDate(dateStr) {
|
|
|
7576
7597
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
7577
7598
|
}
|
|
7578
7599
|
function formatPrHeader(pr, status2) {
|
|
7579
|
-
return `${
|
|
7600
|
+
return `${chalk91.cyan(`#${pr.number}`)} ${pr.title} ${chalk91.dim(`(${pr.author.login},`)} ${status2.label} ${chalk91.dim(`${formatDate(status2.date)})`)}`;
|
|
7580
7601
|
}
|
|
7581
7602
|
function logPrDetails(pr) {
|
|
7582
7603
|
console.log(
|
|
7583
|
-
|
|
7604
|
+
chalk91.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
7584
7605
|
);
|
|
7585
7606
|
console.log();
|
|
7586
7607
|
}
|
|
@@ -7746,10 +7767,10 @@ function registerPrs(program2) {
|
|
|
7746
7767
|
}
|
|
7747
7768
|
|
|
7748
7769
|
// src/commands/ravendb/ravendbAuth.ts
|
|
7749
|
-
import
|
|
7770
|
+
import chalk97 from "chalk";
|
|
7750
7771
|
|
|
7751
7772
|
// src/shared/createConnectionAuth.ts
|
|
7752
|
-
import
|
|
7773
|
+
import chalk92 from "chalk";
|
|
7753
7774
|
function listConnections(connections, format2) {
|
|
7754
7775
|
if (connections.length === 0) {
|
|
7755
7776
|
console.log("No connections configured.");
|
|
@@ -7762,7 +7783,7 @@ function listConnections(connections, format2) {
|
|
|
7762
7783
|
function removeConnection(connections, name, save) {
|
|
7763
7784
|
const filtered = connections.filter((c) => c.name !== name);
|
|
7764
7785
|
if (filtered.length === connections.length) {
|
|
7765
|
-
console.error(
|
|
7786
|
+
console.error(chalk92.red(`Connection "${name}" not found.`));
|
|
7766
7787
|
process.exit(1);
|
|
7767
7788
|
}
|
|
7768
7789
|
save(filtered);
|
|
@@ -7808,15 +7829,15 @@ function saveConnections(connections) {
|
|
|
7808
7829
|
}
|
|
7809
7830
|
|
|
7810
7831
|
// src/commands/ravendb/promptConnection.ts
|
|
7811
|
-
import
|
|
7832
|
+
import chalk95 from "chalk";
|
|
7812
7833
|
|
|
7813
7834
|
// src/commands/ravendb/selectOpSecret.ts
|
|
7814
|
-
import
|
|
7835
|
+
import chalk94 from "chalk";
|
|
7815
7836
|
import Enquirer2 from "enquirer";
|
|
7816
7837
|
|
|
7817
7838
|
// src/commands/ravendb/searchItems.ts
|
|
7818
7839
|
import { execSync as execSync34 } from "child_process";
|
|
7819
|
-
import
|
|
7840
|
+
import chalk93 from "chalk";
|
|
7820
7841
|
function opExec(args) {
|
|
7821
7842
|
return execSync34(`op ${args}`, {
|
|
7822
7843
|
encoding: "utf-8",
|
|
@@ -7829,7 +7850,7 @@ function searchItems(search2) {
|
|
|
7829
7850
|
items = JSON.parse(opExec("item list --format=json"));
|
|
7830
7851
|
} catch {
|
|
7831
7852
|
console.error(
|
|
7832
|
-
|
|
7853
|
+
chalk93.red(
|
|
7833
7854
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
7834
7855
|
)
|
|
7835
7856
|
);
|
|
@@ -7843,7 +7864,7 @@ function getItemFields(itemId) {
|
|
|
7843
7864
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
7844
7865
|
return item.fields.filter((f) => f.reference && f.label);
|
|
7845
7866
|
} catch {
|
|
7846
|
-
console.error(
|
|
7867
|
+
console.error(chalk93.red("Failed to get item details from 1Password."));
|
|
7847
7868
|
process.exit(1);
|
|
7848
7869
|
}
|
|
7849
7870
|
}
|
|
@@ -7862,7 +7883,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7862
7883
|
}).run();
|
|
7863
7884
|
const items = searchItems(search2);
|
|
7864
7885
|
if (items.length === 0) {
|
|
7865
|
-
console.error(
|
|
7886
|
+
console.error(chalk94.red(`No items found matching "${search2}".`));
|
|
7866
7887
|
process.exit(1);
|
|
7867
7888
|
}
|
|
7868
7889
|
const itemId = await selectOne(
|
|
@@ -7871,7 +7892,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7871
7892
|
);
|
|
7872
7893
|
const fields = getItemFields(itemId);
|
|
7873
7894
|
if (fields.length === 0) {
|
|
7874
|
-
console.error(
|
|
7895
|
+
console.error(chalk94.red("No fields with references found on this item."));
|
|
7875
7896
|
process.exit(1);
|
|
7876
7897
|
}
|
|
7877
7898
|
const ref = await selectOne(
|
|
@@ -7885,7 +7906,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7885
7906
|
async function promptConnection(existingNames) {
|
|
7886
7907
|
const name = await promptInput("name", "Connection name:");
|
|
7887
7908
|
if (existingNames.includes(name)) {
|
|
7888
|
-
console.error(
|
|
7909
|
+
console.error(chalk95.red(`Connection "${name}" already exists.`));
|
|
7889
7910
|
process.exit(1);
|
|
7890
7911
|
}
|
|
7891
7912
|
const url = await promptInput(
|
|
@@ -7894,22 +7915,22 @@ async function promptConnection(existingNames) {
|
|
|
7894
7915
|
);
|
|
7895
7916
|
const database = await promptInput("database", "Database name:");
|
|
7896
7917
|
if (!name || !url || !database) {
|
|
7897
|
-
console.error(
|
|
7918
|
+
console.error(chalk95.red("All fields are required."));
|
|
7898
7919
|
process.exit(1);
|
|
7899
7920
|
}
|
|
7900
7921
|
const apiKeyRef = await selectOpSecret();
|
|
7901
|
-
console.log(
|
|
7922
|
+
console.log(chalk95.dim(`Using: ${apiKeyRef}`));
|
|
7902
7923
|
return { name, url, database, apiKeyRef };
|
|
7903
7924
|
}
|
|
7904
7925
|
|
|
7905
7926
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
7906
|
-
import
|
|
7927
|
+
import chalk96 from "chalk";
|
|
7907
7928
|
function ravendbSetConnection(name) {
|
|
7908
7929
|
const raw = loadGlobalConfigRaw();
|
|
7909
7930
|
const ravendb = raw.ravendb ?? {};
|
|
7910
7931
|
const connections = ravendb.connections ?? [];
|
|
7911
7932
|
if (!connections.some((c) => c.name === name)) {
|
|
7912
|
-
console.error(
|
|
7933
|
+
console.error(chalk96.red(`Connection "${name}" not found.`));
|
|
7913
7934
|
console.error(
|
|
7914
7935
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
7915
7936
|
);
|
|
@@ -7925,16 +7946,16 @@ function ravendbSetConnection(name) {
|
|
|
7925
7946
|
var ravendbAuth = createConnectionAuth({
|
|
7926
7947
|
load: loadConnections,
|
|
7927
7948
|
save: saveConnections,
|
|
7928
|
-
format: (c) => `${
|
|
7949
|
+
format: (c) => `${chalk97.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
7929
7950
|
promptNew: promptConnection,
|
|
7930
7951
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
7931
7952
|
});
|
|
7932
7953
|
|
|
7933
7954
|
// src/commands/ravendb/ravendbCollections.ts
|
|
7934
|
-
import
|
|
7955
|
+
import chalk101 from "chalk";
|
|
7935
7956
|
|
|
7936
7957
|
// src/commands/ravendb/ravenFetch.ts
|
|
7937
|
-
import
|
|
7958
|
+
import chalk99 from "chalk";
|
|
7938
7959
|
|
|
7939
7960
|
// src/commands/ravendb/getAccessToken.ts
|
|
7940
7961
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -7971,10 +7992,10 @@ ${errorText}`
|
|
|
7971
7992
|
|
|
7972
7993
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
7973
7994
|
import { execSync as execSync35 } from "child_process";
|
|
7974
|
-
import
|
|
7995
|
+
import chalk98 from "chalk";
|
|
7975
7996
|
function resolveOpSecret(reference) {
|
|
7976
7997
|
if (!reference.startsWith("op://")) {
|
|
7977
|
-
console.error(
|
|
7998
|
+
console.error(chalk98.red(`Invalid secret reference: must start with op://`));
|
|
7978
7999
|
process.exit(1);
|
|
7979
8000
|
}
|
|
7980
8001
|
try {
|
|
@@ -7984,7 +8005,7 @@ function resolveOpSecret(reference) {
|
|
|
7984
8005
|
}).trim();
|
|
7985
8006
|
} catch {
|
|
7986
8007
|
console.error(
|
|
7987
|
-
|
|
8008
|
+
chalk98.red(
|
|
7988
8009
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
7989
8010
|
)
|
|
7990
8011
|
);
|
|
@@ -8011,7 +8032,7 @@ async function ravenFetch(connection, path50) {
|
|
|
8011
8032
|
if (!response.ok) {
|
|
8012
8033
|
const body = await response.text();
|
|
8013
8034
|
console.error(
|
|
8014
|
-
|
|
8035
|
+
chalk99.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
8015
8036
|
);
|
|
8016
8037
|
console.error(body.substring(0, 500));
|
|
8017
8038
|
process.exit(1);
|
|
@@ -8020,7 +8041,7 @@ async function ravenFetch(connection, path50) {
|
|
|
8020
8041
|
}
|
|
8021
8042
|
|
|
8022
8043
|
// src/commands/ravendb/resolveConnection.ts
|
|
8023
|
-
import
|
|
8044
|
+
import chalk100 from "chalk";
|
|
8024
8045
|
function loadRavendb() {
|
|
8025
8046
|
const raw = loadGlobalConfigRaw();
|
|
8026
8047
|
const ravendb = raw.ravendb;
|
|
@@ -8034,7 +8055,7 @@ function resolveConnection(name) {
|
|
|
8034
8055
|
const connectionName = name ?? defaultConnection;
|
|
8035
8056
|
if (!connectionName) {
|
|
8036
8057
|
console.error(
|
|
8037
|
-
|
|
8058
|
+
chalk100.red(
|
|
8038
8059
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
8039
8060
|
)
|
|
8040
8061
|
);
|
|
@@ -8042,7 +8063,7 @@ function resolveConnection(name) {
|
|
|
8042
8063
|
}
|
|
8043
8064
|
const connection = connections.find((c) => c.name === connectionName);
|
|
8044
8065
|
if (!connection) {
|
|
8045
|
-
console.error(
|
|
8066
|
+
console.error(chalk100.red(`Connection "${connectionName}" not found.`));
|
|
8046
8067
|
console.error(
|
|
8047
8068
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
8048
8069
|
);
|
|
@@ -8073,15 +8094,15 @@ async function ravendbCollections(connectionName) {
|
|
|
8073
8094
|
return;
|
|
8074
8095
|
}
|
|
8075
8096
|
for (const c of collections) {
|
|
8076
|
-
console.log(`${
|
|
8097
|
+
console.log(`${chalk101.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
8077
8098
|
}
|
|
8078
8099
|
}
|
|
8079
8100
|
|
|
8080
8101
|
// src/commands/ravendb/ravendbQuery.ts
|
|
8081
|
-
import
|
|
8102
|
+
import chalk103 from "chalk";
|
|
8082
8103
|
|
|
8083
8104
|
// src/commands/ravendb/fetchAllPages.ts
|
|
8084
|
-
import
|
|
8105
|
+
import chalk102 from "chalk";
|
|
8085
8106
|
|
|
8086
8107
|
// src/commands/ravendb/buildQueryPath.ts
|
|
8087
8108
|
function buildQueryPath(opts) {
|
|
@@ -8119,7 +8140,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
8119
8140
|
allResults.push(...results);
|
|
8120
8141
|
start3 += results.length;
|
|
8121
8142
|
process.stderr.write(
|
|
8122
|
-
`\r${
|
|
8143
|
+
`\r${chalk102.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
8123
8144
|
);
|
|
8124
8145
|
if (start3 >= totalResults) break;
|
|
8125
8146
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -8134,7 +8155,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
8134
8155
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
8135
8156
|
const resolved = resolveArgs(connectionName, collection);
|
|
8136
8157
|
if (!resolved.collection && !options2.query) {
|
|
8137
|
-
console.error(
|
|
8158
|
+
console.error(chalk103.red("Provide a collection name or --query filter."));
|
|
8138
8159
|
process.exit(1);
|
|
8139
8160
|
}
|
|
8140
8161
|
const { collection: col } = resolved;
|
|
@@ -8172,7 +8193,7 @@ import { spawn as spawn4 } from "child_process";
|
|
|
8172
8193
|
import * as path27 from "path";
|
|
8173
8194
|
|
|
8174
8195
|
// src/commands/refactor/logViolations.ts
|
|
8175
|
-
import
|
|
8196
|
+
import chalk104 from "chalk";
|
|
8176
8197
|
var DEFAULT_MAX_LINES = 100;
|
|
8177
8198
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
8178
8199
|
if (violations.length === 0) {
|
|
@@ -8181,43 +8202,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
8181
8202
|
}
|
|
8182
8203
|
return;
|
|
8183
8204
|
}
|
|
8184
|
-
console.error(
|
|
8205
|
+
console.error(chalk104.red(`
|
|
8185
8206
|
Refactor check failed:
|
|
8186
8207
|
`));
|
|
8187
|
-
console.error(
|
|
8208
|
+
console.error(chalk104.red(` The following files exceed ${maxLines} lines:
|
|
8188
8209
|
`));
|
|
8189
8210
|
for (const violation of violations) {
|
|
8190
|
-
console.error(
|
|
8211
|
+
console.error(chalk104.red(` ${violation.file} (${violation.lines} lines)`));
|
|
8191
8212
|
}
|
|
8192
8213
|
console.error(
|
|
8193
|
-
|
|
8214
|
+
chalk104.yellow(
|
|
8194
8215
|
`
|
|
8195
8216
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
8196
8217
|
way to refactor it, ignore it with:
|
|
8197
8218
|
`
|
|
8198
8219
|
)
|
|
8199
8220
|
);
|
|
8200
|
-
console.error(
|
|
8221
|
+
console.error(chalk104.gray(` assist refactor ignore <file>
|
|
8201
8222
|
`));
|
|
8202
8223
|
if (process.env.CLAUDECODE) {
|
|
8203
|
-
console.error(
|
|
8224
|
+
console.error(chalk104.cyan(`
|
|
8204
8225
|
## Extracting Code to New Files
|
|
8205
8226
|
`));
|
|
8206
8227
|
console.error(
|
|
8207
|
-
|
|
8228
|
+
chalk104.cyan(
|
|
8208
8229
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
8209
8230
|
`
|
|
8210
8231
|
)
|
|
8211
8232
|
);
|
|
8212
8233
|
console.error(
|
|
8213
|
-
|
|
8234
|
+
chalk104.cyan(
|
|
8214
8235
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
8215
8236
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
8216
8237
|
`
|
|
8217
8238
|
)
|
|
8218
8239
|
);
|
|
8219
8240
|
console.error(
|
|
8220
|
-
|
|
8241
|
+
chalk104.cyan(
|
|
8221
8242
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
8222
8243
|
domains, move it to a common/shared folder.
|
|
8223
8244
|
`
|
|
@@ -8373,7 +8394,7 @@ async function check(pattern2, options2) {
|
|
|
8373
8394
|
|
|
8374
8395
|
// src/commands/refactor/extract/index.ts
|
|
8375
8396
|
import path33 from "path";
|
|
8376
|
-
import
|
|
8397
|
+
import chalk107 from "chalk";
|
|
8377
8398
|
|
|
8378
8399
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
8379
8400
|
import { SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
@@ -8920,23 +8941,23 @@ function buildPlan(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
8920
8941
|
|
|
8921
8942
|
// src/commands/refactor/extract/displayPlan.ts
|
|
8922
8943
|
import path31 from "path";
|
|
8923
|
-
import
|
|
8944
|
+
import chalk105 from "chalk";
|
|
8924
8945
|
function section(title) {
|
|
8925
8946
|
return `
|
|
8926
|
-
${
|
|
8947
|
+
${chalk105.cyan(title)}`;
|
|
8927
8948
|
}
|
|
8928
8949
|
function displayImporters(plan2, cwd) {
|
|
8929
8950
|
if (plan2.importersToUpdate.length === 0) return;
|
|
8930
8951
|
console.log(section("Update importers:"));
|
|
8931
8952
|
for (const imp of plan2.importersToUpdate) {
|
|
8932
8953
|
const rel = path31.relative(cwd, imp.file.getFilePath());
|
|
8933
|
-
console.log(` ${
|
|
8954
|
+
console.log(` ${chalk105.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
8934
8955
|
}
|
|
8935
8956
|
}
|
|
8936
8957
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
8937
|
-
console.log(
|
|
8958
|
+
console.log(chalk105.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
8938
8959
|
`));
|
|
8939
|
-
console.log(` ${
|
|
8960
|
+
console.log(` ${chalk105.cyan("Functions to move:")}`);
|
|
8940
8961
|
for (const name of plan2.extractedNames) {
|
|
8941
8962
|
console.log(` ${name}`);
|
|
8942
8963
|
}
|
|
@@ -8971,7 +8992,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
8971
8992
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
8972
8993
|
import fs17 from "fs";
|
|
8973
8994
|
import path32 from "path";
|
|
8974
|
-
import
|
|
8995
|
+
import chalk106 from "chalk";
|
|
8975
8996
|
import { Project as Project2 } from "ts-morph";
|
|
8976
8997
|
function findTsConfig(sourcePath) {
|
|
8977
8998
|
const rootConfig = path32.resolve("tsconfig.json");
|
|
@@ -9002,7 +9023,7 @@ function loadProjectFile(file) {
|
|
|
9002
9023
|
});
|
|
9003
9024
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
9004
9025
|
if (!sourceFile) {
|
|
9005
|
-
console.log(
|
|
9026
|
+
console.log(chalk106.red(`File not found in project: ${file}`));
|
|
9006
9027
|
process.exit(1);
|
|
9007
9028
|
}
|
|
9008
9029
|
return { project, sourceFile };
|
|
@@ -9025,19 +9046,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
9025
9046
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
9026
9047
|
if (options2.apply) {
|
|
9027
9048
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
9028
|
-
console.log(
|
|
9049
|
+
console.log(chalk107.green("\nExtraction complete"));
|
|
9029
9050
|
} else {
|
|
9030
|
-
console.log(
|
|
9051
|
+
console.log(chalk107.dim("\nDry run. Use --apply to execute."));
|
|
9031
9052
|
}
|
|
9032
9053
|
}
|
|
9033
9054
|
|
|
9034
9055
|
// src/commands/refactor/ignore.ts
|
|
9035
9056
|
import fs18 from "fs";
|
|
9036
|
-
import
|
|
9057
|
+
import chalk108 from "chalk";
|
|
9037
9058
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
9038
9059
|
function ignore(file) {
|
|
9039
9060
|
if (!fs18.existsSync(file)) {
|
|
9040
|
-
console.error(
|
|
9061
|
+
console.error(chalk108.red(`Error: File does not exist: ${file}`));
|
|
9041
9062
|
process.exit(1);
|
|
9042
9063
|
}
|
|
9043
9064
|
const content = fs18.readFileSync(file, "utf-8");
|
|
@@ -9053,7 +9074,7 @@ function ignore(file) {
|
|
|
9053
9074
|
fs18.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
9054
9075
|
}
|
|
9055
9076
|
console.log(
|
|
9056
|
-
|
|
9077
|
+
chalk108.green(
|
|
9057
9078
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
9058
9079
|
)
|
|
9059
9080
|
);
|
|
@@ -9061,26 +9082,26 @@ function ignore(file) {
|
|
|
9061
9082
|
|
|
9062
9083
|
// src/commands/refactor/rename/index.ts
|
|
9063
9084
|
import path34 from "path";
|
|
9064
|
-
import
|
|
9085
|
+
import chalk109 from "chalk";
|
|
9065
9086
|
async function rename(source, destination, options2 = {}) {
|
|
9066
9087
|
const destPath = path34.resolve(destination);
|
|
9067
9088
|
const cwd = process.cwd();
|
|
9068
9089
|
const relSource = path34.relative(cwd, path34.resolve(source));
|
|
9069
9090
|
const relDest = path34.relative(cwd, destPath);
|
|
9070
9091
|
const { project, sourceFile } = loadProjectFile(source);
|
|
9071
|
-
console.log(
|
|
9092
|
+
console.log(chalk109.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
9072
9093
|
if (options2.apply) {
|
|
9073
9094
|
sourceFile.move(destPath);
|
|
9074
9095
|
await project.save();
|
|
9075
|
-
console.log(
|
|
9096
|
+
console.log(chalk109.green("Done"));
|
|
9076
9097
|
} else {
|
|
9077
|
-
console.log(
|
|
9098
|
+
console.log(chalk109.dim("Dry run. Use --apply to execute."));
|
|
9078
9099
|
}
|
|
9079
9100
|
}
|
|
9080
9101
|
|
|
9081
9102
|
// src/commands/refactor/renameSymbol/index.ts
|
|
9082
9103
|
import path36 from "path";
|
|
9083
|
-
import
|
|
9104
|
+
import chalk110 from "chalk";
|
|
9084
9105
|
import { Project as Project3 } from "ts-morph";
|
|
9085
9106
|
|
|
9086
9107
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
@@ -9129,38 +9150,38 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
9129
9150
|
const project = new Project3({ tsConfigFilePath: tsConfigPath });
|
|
9130
9151
|
const sourceFile = project.getSourceFile(filePath);
|
|
9131
9152
|
if (!sourceFile) {
|
|
9132
|
-
console.log(
|
|
9153
|
+
console.log(chalk110.red(`File not found in project: ${file}`));
|
|
9133
9154
|
process.exit(1);
|
|
9134
9155
|
}
|
|
9135
9156
|
const symbol = findSymbol(sourceFile, oldName);
|
|
9136
9157
|
if (!symbol) {
|
|
9137
|
-
console.log(
|
|
9158
|
+
console.log(chalk110.red(`Symbol "${oldName}" not found in ${file}`));
|
|
9138
9159
|
process.exit(1);
|
|
9139
9160
|
}
|
|
9140
9161
|
const grouped = groupReferences(symbol, cwd);
|
|
9141
9162
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
9142
9163
|
console.log(
|
|
9143
|
-
|
|
9164
|
+
chalk110.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
9144
9165
|
`)
|
|
9145
9166
|
);
|
|
9146
9167
|
for (const [refFile, lines] of grouped) {
|
|
9147
9168
|
console.log(
|
|
9148
|
-
` ${
|
|
9169
|
+
` ${chalk110.dim(refFile)}: lines ${chalk110.cyan(lines.join(", "))}`
|
|
9149
9170
|
);
|
|
9150
9171
|
}
|
|
9151
9172
|
if (options2.apply) {
|
|
9152
9173
|
symbol.rename(newName);
|
|
9153
9174
|
await project.save();
|
|
9154
|
-
console.log(
|
|
9175
|
+
console.log(chalk110.green(`
|
|
9155
9176
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
9156
9177
|
} else {
|
|
9157
|
-
console.log(
|
|
9178
|
+
console.log(chalk110.dim("\nDry run. Use --apply to execute."));
|
|
9158
9179
|
}
|
|
9159
9180
|
}
|
|
9160
9181
|
|
|
9161
9182
|
// src/commands/refactor/restructure/index.ts
|
|
9162
9183
|
import path45 from "path";
|
|
9163
|
-
import
|
|
9184
|
+
import chalk113 from "chalk";
|
|
9164
9185
|
|
|
9165
9186
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
9166
9187
|
import path37 from "path";
|
|
@@ -9403,50 +9424,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
9403
9424
|
|
|
9404
9425
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
9405
9426
|
import path41 from "path";
|
|
9406
|
-
import
|
|
9427
|
+
import chalk111 from "chalk";
|
|
9407
9428
|
function relPath(filePath) {
|
|
9408
9429
|
return path41.relative(process.cwd(), filePath);
|
|
9409
9430
|
}
|
|
9410
9431
|
function displayMoves(plan2) {
|
|
9411
9432
|
if (plan2.moves.length === 0) return;
|
|
9412
|
-
console.log(
|
|
9433
|
+
console.log(chalk111.bold("\nFile moves:"));
|
|
9413
9434
|
for (const move of plan2.moves) {
|
|
9414
9435
|
console.log(
|
|
9415
|
-
` ${
|
|
9436
|
+
` ${chalk111.red(relPath(move.from))} \u2192 ${chalk111.green(relPath(move.to))}`
|
|
9416
9437
|
);
|
|
9417
|
-
console.log(
|
|
9438
|
+
console.log(chalk111.dim(` ${move.reason}`));
|
|
9418
9439
|
}
|
|
9419
9440
|
}
|
|
9420
9441
|
function displayRewrites(rewrites) {
|
|
9421
9442
|
if (rewrites.length === 0) return;
|
|
9422
9443
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
9423
|
-
console.log(
|
|
9444
|
+
console.log(chalk111.bold(`
|
|
9424
9445
|
Import rewrites (${affectedFiles.size} files):`));
|
|
9425
9446
|
for (const file of affectedFiles) {
|
|
9426
|
-
console.log(` ${
|
|
9447
|
+
console.log(` ${chalk111.cyan(relPath(file))}:`);
|
|
9427
9448
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
9428
9449
|
(r) => r.file === file
|
|
9429
9450
|
)) {
|
|
9430
9451
|
console.log(
|
|
9431
|
-
` ${
|
|
9452
|
+
` ${chalk111.red(`"${oldSpecifier}"`)} \u2192 ${chalk111.green(`"${newSpecifier}"`)}`
|
|
9432
9453
|
);
|
|
9433
9454
|
}
|
|
9434
9455
|
}
|
|
9435
9456
|
}
|
|
9436
9457
|
function displayPlan2(plan2) {
|
|
9437
9458
|
if (plan2.warnings.length > 0) {
|
|
9438
|
-
console.log(
|
|
9439
|
-
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}`));
|
|
9440
9461
|
}
|
|
9441
9462
|
if (plan2.newDirectories.length > 0) {
|
|
9442
|
-
console.log(
|
|
9463
|
+
console.log(chalk111.bold("\nNew directories:"));
|
|
9443
9464
|
for (const dir of plan2.newDirectories)
|
|
9444
|
-
console.log(
|
|
9465
|
+
console.log(chalk111.green(` ${dir}/`));
|
|
9445
9466
|
}
|
|
9446
9467
|
displayMoves(plan2);
|
|
9447
9468
|
displayRewrites(plan2.rewrites);
|
|
9448
9469
|
console.log(
|
|
9449
|
-
|
|
9470
|
+
chalk111.dim(
|
|
9450
9471
|
`
|
|
9451
9472
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
9452
9473
|
)
|
|
@@ -9456,18 +9477,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
9456
9477
|
// src/commands/refactor/restructure/executePlan.ts
|
|
9457
9478
|
import fs20 from "fs";
|
|
9458
9479
|
import path42 from "path";
|
|
9459
|
-
import
|
|
9480
|
+
import chalk112 from "chalk";
|
|
9460
9481
|
function executePlan(plan2) {
|
|
9461
9482
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
9462
9483
|
for (const [file, content] of updatedContents) {
|
|
9463
9484
|
fs20.writeFileSync(file, content, "utf-8");
|
|
9464
9485
|
console.log(
|
|
9465
|
-
|
|
9486
|
+
chalk112.cyan(` Rewrote imports in ${path42.relative(process.cwd(), file)}`)
|
|
9466
9487
|
);
|
|
9467
9488
|
}
|
|
9468
9489
|
for (const dir of plan2.newDirectories) {
|
|
9469
9490
|
fs20.mkdirSync(dir, { recursive: true });
|
|
9470
|
-
console.log(
|
|
9491
|
+
console.log(chalk112.green(` Created ${path42.relative(process.cwd(), dir)}/`));
|
|
9471
9492
|
}
|
|
9472
9493
|
for (const move of plan2.moves) {
|
|
9473
9494
|
const targetDir = path42.dirname(move.to);
|
|
@@ -9476,7 +9497,7 @@ function executePlan(plan2) {
|
|
|
9476
9497
|
}
|
|
9477
9498
|
fs20.renameSync(move.from, move.to);
|
|
9478
9499
|
console.log(
|
|
9479
|
-
|
|
9500
|
+
chalk112.white(
|
|
9480
9501
|
` Moved ${path42.relative(process.cwd(), move.from)} \u2192 ${path42.relative(process.cwd(), move.to)}`
|
|
9481
9502
|
)
|
|
9482
9503
|
);
|
|
@@ -9491,7 +9512,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
9491
9512
|
if (entries.length === 0) {
|
|
9492
9513
|
fs20.rmdirSync(dir);
|
|
9493
9514
|
console.log(
|
|
9494
|
-
|
|
9515
|
+
chalk112.dim(
|
|
9495
9516
|
` Removed empty directory ${path42.relative(process.cwd(), dir)}`
|
|
9496
9517
|
)
|
|
9497
9518
|
);
|
|
@@ -9624,22 +9645,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
9624
9645
|
const targetPattern = pattern2 ?? "src";
|
|
9625
9646
|
const files = findSourceFiles2(targetPattern);
|
|
9626
9647
|
if (files.length === 0) {
|
|
9627
|
-
console.log(
|
|
9648
|
+
console.log(chalk113.yellow("No files found matching pattern"));
|
|
9628
9649
|
return;
|
|
9629
9650
|
}
|
|
9630
9651
|
const tsConfigPath = path45.resolve("tsconfig.json");
|
|
9631
9652
|
const plan2 = buildPlan2(files, tsConfigPath);
|
|
9632
9653
|
if (plan2.moves.length === 0) {
|
|
9633
|
-
console.log(
|
|
9654
|
+
console.log(chalk113.green("No restructuring needed"));
|
|
9634
9655
|
return;
|
|
9635
9656
|
}
|
|
9636
9657
|
displayPlan2(plan2);
|
|
9637
9658
|
if (options2.apply) {
|
|
9638
|
-
console.log(
|
|
9659
|
+
console.log(chalk113.bold("\nApplying changes..."));
|
|
9639
9660
|
executePlan(plan2);
|
|
9640
|
-
console.log(
|
|
9661
|
+
console.log(chalk113.green("\nRestructuring complete"));
|
|
9641
9662
|
} else {
|
|
9642
|
-
console.log(
|
|
9663
|
+
console.log(chalk113.dim("\nDry run. Use --apply to execute."));
|
|
9643
9664
|
}
|
|
9644
9665
|
}
|
|
9645
9666
|
|
|
@@ -9679,7 +9700,7 @@ function registerRefactor(program2) {
|
|
|
9679
9700
|
}
|
|
9680
9701
|
|
|
9681
9702
|
// src/commands/seq/seqAuth.ts
|
|
9682
|
-
import
|
|
9703
|
+
import chalk115 from "chalk";
|
|
9683
9704
|
|
|
9684
9705
|
// src/commands/seq/loadConnections.ts
|
|
9685
9706
|
function loadConnections2() {
|
|
@@ -9708,11 +9729,11 @@ function setDefaultConnection(name) {
|
|
|
9708
9729
|
}
|
|
9709
9730
|
|
|
9710
9731
|
// src/commands/seq/promptConnection.ts
|
|
9711
|
-
import
|
|
9732
|
+
import chalk114 from "chalk";
|
|
9712
9733
|
async function promptConnection2(existingNames) {
|
|
9713
9734
|
const name = await promptInput("name", "Connection name:", "default");
|
|
9714
9735
|
if (existingNames.includes(name)) {
|
|
9715
|
-
console.error(
|
|
9736
|
+
console.error(chalk114.red(`Connection "${name}" already exists.`));
|
|
9716
9737
|
process.exit(1);
|
|
9717
9738
|
}
|
|
9718
9739
|
const url = await promptInput("url", "Seq URL:", "http://localhost:5341");
|
|
@@ -9724,16 +9745,16 @@ async function promptConnection2(existingNames) {
|
|
|
9724
9745
|
var seqAuth = createConnectionAuth({
|
|
9725
9746
|
load: loadConnections2,
|
|
9726
9747
|
save: saveConnections2,
|
|
9727
|
-
format: (c) => `${
|
|
9748
|
+
format: (c) => `${chalk115.bold(c.name)} ${c.url}`,
|
|
9728
9749
|
promptNew: promptConnection2,
|
|
9729
9750
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
9730
9751
|
});
|
|
9731
9752
|
|
|
9732
9753
|
// src/commands/seq/seqQuery.ts
|
|
9733
|
-
import
|
|
9754
|
+
import chalk119 from "chalk";
|
|
9734
9755
|
|
|
9735
9756
|
// src/commands/seq/fetchSeq.ts
|
|
9736
|
-
import
|
|
9757
|
+
import chalk116 from "chalk";
|
|
9737
9758
|
async function fetchSeq(conn, path50, params) {
|
|
9738
9759
|
const url = `${conn.url}${path50}?${params}`;
|
|
9739
9760
|
const response = await fetch(url, {
|
|
@@ -9744,7 +9765,7 @@ async function fetchSeq(conn, path50, params) {
|
|
|
9744
9765
|
});
|
|
9745
9766
|
if (!response.ok) {
|
|
9746
9767
|
const body = await response.text();
|
|
9747
|
-
console.error(
|
|
9768
|
+
console.error(chalk116.red(`Seq returned ${response.status}: ${body}`));
|
|
9748
9769
|
process.exit(1);
|
|
9749
9770
|
}
|
|
9750
9771
|
return response;
|
|
@@ -9797,23 +9818,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
9797
9818
|
}
|
|
9798
9819
|
|
|
9799
9820
|
// src/commands/seq/formatEvent.ts
|
|
9800
|
-
import
|
|
9821
|
+
import chalk117 from "chalk";
|
|
9801
9822
|
function levelColor(level) {
|
|
9802
9823
|
switch (level) {
|
|
9803
9824
|
case "Fatal":
|
|
9804
|
-
return
|
|
9825
|
+
return chalk117.bgRed.white;
|
|
9805
9826
|
case "Error":
|
|
9806
|
-
return
|
|
9827
|
+
return chalk117.red;
|
|
9807
9828
|
case "Warning":
|
|
9808
|
-
return
|
|
9829
|
+
return chalk117.yellow;
|
|
9809
9830
|
case "Information":
|
|
9810
|
-
return
|
|
9831
|
+
return chalk117.cyan;
|
|
9811
9832
|
case "Debug":
|
|
9812
|
-
return
|
|
9833
|
+
return chalk117.gray;
|
|
9813
9834
|
case "Verbose":
|
|
9814
|
-
return
|
|
9835
|
+
return chalk117.dim;
|
|
9815
9836
|
default:
|
|
9816
|
-
return
|
|
9837
|
+
return chalk117.white;
|
|
9817
9838
|
}
|
|
9818
9839
|
}
|
|
9819
9840
|
function levelAbbrev(level) {
|
|
@@ -9854,31 +9875,31 @@ function formatTimestamp(iso) {
|
|
|
9854
9875
|
function formatEvent(event) {
|
|
9855
9876
|
const color = levelColor(event.Level);
|
|
9856
9877
|
const abbrev = levelAbbrev(event.Level);
|
|
9857
|
-
const ts8 =
|
|
9878
|
+
const ts8 = chalk117.dim(formatTimestamp(event.Timestamp));
|
|
9858
9879
|
const msg = renderMessage(event);
|
|
9859
9880
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
9860
9881
|
if (event.Exception) {
|
|
9861
9882
|
for (const line of event.Exception.split("\n")) {
|
|
9862
|
-
lines.push(
|
|
9883
|
+
lines.push(chalk117.red(` ${line}`));
|
|
9863
9884
|
}
|
|
9864
9885
|
}
|
|
9865
9886
|
return lines.join("\n");
|
|
9866
9887
|
}
|
|
9867
9888
|
|
|
9868
9889
|
// src/commands/seq/resolveConnection.ts
|
|
9869
|
-
import
|
|
9890
|
+
import chalk118 from "chalk";
|
|
9870
9891
|
function resolveConnection2(name) {
|
|
9871
9892
|
const connections = loadConnections2();
|
|
9872
9893
|
if (connections.length === 0) {
|
|
9873
9894
|
console.error(
|
|
9874
|
-
|
|
9895
|
+
chalk118.red("No Seq connections configured. Run 'assist seq auth' first.")
|
|
9875
9896
|
);
|
|
9876
9897
|
process.exit(1);
|
|
9877
9898
|
}
|
|
9878
9899
|
const target = name ?? getDefaultConnection() ?? connections[0].name;
|
|
9879
9900
|
const connection = connections.find((c) => c.name === target);
|
|
9880
9901
|
if (!connection) {
|
|
9881
|
-
console.error(
|
|
9902
|
+
console.error(chalk118.red(`Seq connection "${target}" not found.`));
|
|
9882
9903
|
process.exit(1);
|
|
9883
9904
|
}
|
|
9884
9905
|
return connection;
|
|
@@ -9893,7 +9914,7 @@ async function seqQuery(filter, options2) {
|
|
|
9893
9914
|
new URLSearchParams({ filter, count: String(count) })
|
|
9894
9915
|
);
|
|
9895
9916
|
if (events.length === 0) {
|
|
9896
|
-
console.log(
|
|
9917
|
+
console.log(chalk119.yellow("No events found."));
|
|
9897
9918
|
return;
|
|
9898
9919
|
}
|
|
9899
9920
|
if (options2.json) {
|
|
@@ -9904,11 +9925,11 @@ async function seqQuery(filter, options2) {
|
|
|
9904
9925
|
for (const event of chronological) {
|
|
9905
9926
|
console.log(formatEvent(event));
|
|
9906
9927
|
}
|
|
9907
|
-
console.log(
|
|
9928
|
+
console.log(chalk119.dim(`
|
|
9908
9929
|
${events.length} events`));
|
|
9909
9930
|
if (events.length >= count) {
|
|
9910
9931
|
console.log(
|
|
9911
|
-
|
|
9932
|
+
chalk119.yellow(
|
|
9912
9933
|
`Results limited to ${count}. Use --count to retrieve more.`
|
|
9913
9934
|
)
|
|
9914
9935
|
);
|
|
@@ -9916,11 +9937,11 @@ ${events.length} events`));
|
|
|
9916
9937
|
}
|
|
9917
9938
|
|
|
9918
9939
|
// src/commands/seq/seqSetConnection.ts
|
|
9919
|
-
import
|
|
9940
|
+
import chalk120 from "chalk";
|
|
9920
9941
|
function seqSetConnection(name) {
|
|
9921
9942
|
const connections = loadConnections2();
|
|
9922
9943
|
if (!connections.find((c) => c.name === name)) {
|
|
9923
|
-
console.error(
|
|
9944
|
+
console.error(chalk120.red(`Connection "${name}" not found.`));
|
|
9924
9945
|
process.exit(1);
|
|
9925
9946
|
}
|
|
9926
9947
|
setDefaultConnection(name);
|
|
@@ -10459,14 +10480,14 @@ import {
|
|
|
10459
10480
|
import { dirname as dirname20, join as join34 } from "path";
|
|
10460
10481
|
|
|
10461
10482
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
10462
|
-
import
|
|
10483
|
+
import chalk121 from "chalk";
|
|
10463
10484
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
10464
10485
|
function validateStagedContent(filename, content) {
|
|
10465
10486
|
const firstLine = content.split("\n")[0];
|
|
10466
10487
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
10467
10488
|
if (!match) {
|
|
10468
10489
|
console.error(
|
|
10469
|
-
|
|
10490
|
+
chalk121.red(
|
|
10470
10491
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
10471
10492
|
)
|
|
10472
10493
|
);
|
|
@@ -10475,7 +10496,7 @@ function validateStagedContent(filename, content) {
|
|
|
10475
10496
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
10476
10497
|
if (!contentAfterLink) {
|
|
10477
10498
|
console.error(
|
|
10478
|
-
|
|
10499
|
+
chalk121.red(
|
|
10479
10500
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
10480
10501
|
)
|
|
10481
10502
|
);
|
|
@@ -10868,7 +10889,7 @@ function registerVoice(program2) {
|
|
|
10868
10889
|
|
|
10869
10890
|
// src/commands/roam/auth.ts
|
|
10870
10891
|
import { randomBytes } from "crypto";
|
|
10871
|
-
import
|
|
10892
|
+
import chalk122 from "chalk";
|
|
10872
10893
|
|
|
10873
10894
|
// src/lib/openBrowser.ts
|
|
10874
10895
|
import { execSync as execSync38 } from "child_process";
|
|
@@ -11043,13 +11064,13 @@ async function auth() {
|
|
|
11043
11064
|
saveGlobalConfig(config);
|
|
11044
11065
|
const state = randomBytes(16).toString("hex");
|
|
11045
11066
|
console.log(
|
|
11046
|
-
|
|
11067
|
+
chalk122.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
11047
11068
|
);
|
|
11048
|
-
console.log(
|
|
11049
|
-
console.log(
|
|
11050
|
-
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..."));
|
|
11051
11072
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
11052
|
-
console.log(
|
|
11073
|
+
console.log(chalk122.dim("Exchanging code for tokens..."));
|
|
11053
11074
|
const tokens = await exchangeToken({
|
|
11054
11075
|
code,
|
|
11055
11076
|
clientId,
|
|
@@ -11065,7 +11086,7 @@ async function auth() {
|
|
|
11065
11086
|
};
|
|
11066
11087
|
saveGlobalConfig(config);
|
|
11067
11088
|
console.log(
|
|
11068
|
-
|
|
11089
|
+
chalk122.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
11069
11090
|
);
|
|
11070
11091
|
}
|
|
11071
11092
|
|
|
@@ -11278,7 +11299,7 @@ import { execSync as execSync40 } from "child_process";
|
|
|
11278
11299
|
import { existsSync as existsSync39, mkdirSync as mkdirSync14, unlinkSync as unlinkSync11, writeFileSync as writeFileSync29 } from "fs";
|
|
11279
11300
|
import { tmpdir as tmpdir6 } from "os";
|
|
11280
11301
|
import { join as join43, resolve as resolve5 } from "path";
|
|
11281
|
-
import
|
|
11302
|
+
import chalk123 from "chalk";
|
|
11282
11303
|
|
|
11283
11304
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
11284
11305
|
var captureWindowPs1 = `
|
|
@@ -11429,22 +11450,22 @@ function screenshot(processName) {
|
|
|
11429
11450
|
const config = loadConfig();
|
|
11430
11451
|
const outputDir = resolve5(config.screenshot.outputDir);
|
|
11431
11452
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
11432
|
-
console.log(
|
|
11453
|
+
console.log(chalk123.gray(`Capturing window for process "${processName}" ...`));
|
|
11433
11454
|
try {
|
|
11434
11455
|
runPowerShellScript(processName, outputPath);
|
|
11435
|
-
console.log(
|
|
11456
|
+
console.log(chalk123.green(`Screenshot saved: ${outputPath}`));
|
|
11436
11457
|
} catch (error) {
|
|
11437
11458
|
const msg = error instanceof Error ? error.message : String(error);
|
|
11438
|
-
console.error(
|
|
11459
|
+
console.error(chalk123.red(`Failed to capture screenshot: ${msg}`));
|
|
11439
11460
|
process.exit(1);
|
|
11440
11461
|
}
|
|
11441
11462
|
}
|
|
11442
11463
|
|
|
11443
11464
|
// src/commands/statusLine.ts
|
|
11444
|
-
import
|
|
11465
|
+
import chalk125 from "chalk";
|
|
11445
11466
|
|
|
11446
11467
|
// src/commands/buildLimitsSegment.ts
|
|
11447
|
-
import
|
|
11468
|
+
import chalk124 from "chalk";
|
|
11448
11469
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
11449
11470
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
11450
11471
|
function formatTimeLeft(resetsAt) {
|
|
@@ -11467,10 +11488,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
11467
11488
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
11468
11489
|
const label2 = `${Math.round(pct)}%`;
|
|
11469
11490
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
11470
|
-
if (projected == null) return
|
|
11471
|
-
if (projected > 100) return
|
|
11472
|
-
if (projected > 75) return
|
|
11473
|
-
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);
|
|
11474
11495
|
}
|
|
11475
11496
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
11476
11497
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -11496,14 +11517,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
11496
11517
|
}
|
|
11497
11518
|
|
|
11498
11519
|
// src/commands/statusLine.ts
|
|
11499
|
-
|
|
11520
|
+
chalk125.level = 3;
|
|
11500
11521
|
function formatNumber(num) {
|
|
11501
11522
|
return num.toLocaleString("en-US");
|
|
11502
11523
|
}
|
|
11503
11524
|
function colorizePercent(pct) {
|
|
11504
11525
|
const label2 = `${Math.round(pct)}%`;
|
|
11505
|
-
if (pct > 80) return
|
|
11506
|
-
if (pct > 40) return
|
|
11526
|
+
if (pct > 80) return chalk125.red(label2);
|
|
11527
|
+
if (pct > 40) return chalk125.yellow(label2);
|
|
11507
11528
|
return label2;
|
|
11508
11529
|
}
|
|
11509
11530
|
async function statusLine() {
|
|
@@ -11526,7 +11547,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
11526
11547
|
// src/commands/sync/syncClaudeMd.ts
|
|
11527
11548
|
import * as fs23 from "fs";
|
|
11528
11549
|
import * as path46 from "path";
|
|
11529
|
-
import
|
|
11550
|
+
import chalk126 from "chalk";
|
|
11530
11551
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
11531
11552
|
const source = path46.join(claudeDir, "CLAUDE.md");
|
|
11532
11553
|
const target = path46.join(targetBase, "CLAUDE.md");
|
|
@@ -11535,12 +11556,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
11535
11556
|
const targetContent = fs23.readFileSync(target, "utf-8");
|
|
11536
11557
|
if (sourceContent !== targetContent) {
|
|
11537
11558
|
console.log(
|
|
11538
|
-
|
|
11559
|
+
chalk126.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
11539
11560
|
);
|
|
11540
11561
|
console.log();
|
|
11541
11562
|
printDiff(targetContent, sourceContent);
|
|
11542
11563
|
const confirm = options2?.yes || await promptConfirm(
|
|
11543
|
-
|
|
11564
|
+
chalk126.red("Overwrite existing CLAUDE.md?"),
|
|
11544
11565
|
false
|
|
11545
11566
|
);
|
|
11546
11567
|
if (!confirm) {
|
|
@@ -11556,7 +11577,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
11556
11577
|
// src/commands/sync/syncSettings.ts
|
|
11557
11578
|
import * as fs24 from "fs";
|
|
11558
11579
|
import * as path47 from "path";
|
|
11559
|
-
import
|
|
11580
|
+
import chalk127 from "chalk";
|
|
11560
11581
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
11561
11582
|
const source = path47.join(claudeDir, "settings.json");
|
|
11562
11583
|
const target = path47.join(targetBase, "settings.json");
|
|
@@ -11572,14 +11593,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
11572
11593
|
if (mergedContent !== normalizedTarget) {
|
|
11573
11594
|
if (!options2?.yes) {
|
|
11574
11595
|
console.log(
|
|
11575
|
-
|
|
11596
|
+
chalk127.yellow(
|
|
11576
11597
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
11577
11598
|
)
|
|
11578
11599
|
);
|
|
11579
11600
|
console.log();
|
|
11580
11601
|
printDiff(targetContent, mergedContent);
|
|
11581
11602
|
const confirm = await promptConfirm(
|
|
11582
|
-
|
|
11603
|
+
chalk127.red("Overwrite existing settings.json?"),
|
|
11583
11604
|
false
|
|
11584
11605
|
);
|
|
11585
11606
|
if (!confirm) {
|