@staff0rd/assist 0.152.0 → 0.153.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/claude/settings.json +2 -0
- package/dist/commands/backlog/web/bundle.js +23 -23
- package/dist/index.js +567 -449
- 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.153.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -100,6 +100,13 @@ var planPhaseSchema = z.strictObject({
|
|
|
100
100
|
tasks: z.array(planTaskSchema),
|
|
101
101
|
manualChecks: z.array(z.string()).optional()
|
|
102
102
|
});
|
|
103
|
+
var backlogCommentTypeSchema = z.enum(["comment", "summary"]);
|
|
104
|
+
var backlogCommentSchema = z.strictObject({
|
|
105
|
+
text: z.string(),
|
|
106
|
+
phase: z.number().optional(),
|
|
107
|
+
timestamp: z.string(),
|
|
108
|
+
type: backlogCommentTypeSchema
|
|
109
|
+
});
|
|
103
110
|
var backlogItemSchema = z.strictObject({
|
|
104
111
|
id: z.number(),
|
|
105
112
|
type: backlogTypeSchema.default("story"),
|
|
@@ -108,7 +115,8 @@ var backlogItemSchema = z.strictObject({
|
|
|
108
115
|
acceptanceCriteria: z.array(z.string()),
|
|
109
116
|
plan: z.array(planPhaseSchema).optional(),
|
|
110
117
|
currentPhase: z.number().optional(),
|
|
111
|
-
status: backlogStatusSchema
|
|
118
|
+
status: backlogStatusSchema,
|
|
119
|
+
comments: z.array(backlogCommentSchema).optional()
|
|
112
120
|
});
|
|
113
121
|
var backlogFileSchema = z.array(backlogItemSchema);
|
|
114
122
|
|
|
@@ -260,7 +268,11 @@ function buildAuthoredPhasePrompt(item, phaseIndex, phase) {
|
|
|
260
268
|
"When you have completed all tasks for this phase, run /verify to check your work.",
|
|
261
269
|
...buildManualCheckLines(manualChecks),
|
|
262
270
|
"",
|
|
263
|
-
`
|
|
271
|
+
`You can run \`assist backlog comments ${item.id}\` to read prior phase notes and comments.`,
|
|
272
|
+
`You can run \`assist backlog comment ${item.id} "<text>"\` to post findings or changes worth noting.`,
|
|
273
|
+
"",
|
|
274
|
+
`Once verify passes${confirmSuffix}, run: assist backlog phase-done ${item.id} ${phaseIndex} "<summary>"`,
|
|
275
|
+
"Replace <summary> with a concise summary of what was done in this phase."
|
|
264
276
|
].filter((line) => line !== void 0).join("\n");
|
|
265
277
|
}
|
|
266
278
|
function buildContextLines(item, phaseIndex, phase) {
|
|
@@ -313,6 +325,9 @@ function buildReviewPrompt(item, phaseIndex) {
|
|
|
313
325
|
"",
|
|
314
326
|
"If any criterion fails, fix the issue and re-verify before proceeding.",
|
|
315
327
|
"",
|
|
328
|
+
`You can run \`assist backlog comments ${item.id}\` to read prior phase notes and comments.`,
|
|
329
|
+
`You can run \`assist backlog comment ${item.id} "<text>"\` to post findings or changes worth noting.`,
|
|
330
|
+
"",
|
|
316
331
|
"After all criteria pass, ask the user to confirm any manual checks",
|
|
317
332
|
"(e.g. end-to-end behaviour they need to verify themselves).",
|
|
318
333
|
"Wait for the user to confirm before proceeding.",
|
|
@@ -320,7 +335,7 @@ function buildReviewPrompt(item, phaseIndex) {
|
|
|
320
335
|
"Once the user confirms:",
|
|
321
336
|
`1. Run: assist backlog done ${item.id}`,
|
|
322
337
|
"2. Run: /commit",
|
|
323
|
-
`3. Run: assist backlog phase-done ${item.id} ${phaseIndex}`
|
|
338
|
+
`3. Run: assist backlog phase-done ${item.id} ${phaseIndex} "<summary>"`
|
|
324
339
|
].filter((line) => line !== void 0).join("\n");
|
|
325
340
|
}
|
|
326
341
|
|
|
@@ -370,11 +385,35 @@ async function handleIncompletePhase() {
|
|
|
370
385
|
import { writeFileSync as writeFileSync2 } from "fs";
|
|
371
386
|
import { join as join2 } from "path";
|
|
372
387
|
import chalk5 from "chalk";
|
|
388
|
+
|
|
389
|
+
// src/commands/backlog/addComment.ts
|
|
390
|
+
function addComment(item, text, phase) {
|
|
391
|
+
const entry = {
|
|
392
|
+
text,
|
|
393
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
394
|
+
type: "comment",
|
|
395
|
+
...phase !== void 0 && { phase }
|
|
396
|
+
};
|
|
397
|
+
if (!item.comments) item.comments = [];
|
|
398
|
+
item.comments.push(entry);
|
|
399
|
+
}
|
|
400
|
+
function addPhaseSummary(item, text, phase) {
|
|
401
|
+
const entry = {
|
|
402
|
+
text,
|
|
403
|
+
phase,
|
|
404
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
405
|
+
type: "summary"
|
|
406
|
+
};
|
|
407
|
+
if (!item.comments) item.comments = [];
|
|
408
|
+
item.comments.push(entry);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
// src/commands/backlog/phaseDone.ts
|
|
373
412
|
var PHASE_STATUS_FILE = ".assist-phase-status.json";
|
|
374
413
|
function getPhaseStatusPath() {
|
|
375
414
|
return join2(process.cwd(), PHASE_STATUS_FILE);
|
|
376
415
|
}
|
|
377
|
-
function phaseDone(id, phase) {
|
|
416
|
+
function phaseDone(id, phase, summary) {
|
|
378
417
|
const phaseIndex = Number.parseInt(phase, 10);
|
|
379
418
|
const statusPath = getPhaseStatusPath();
|
|
380
419
|
writeFileSync2(
|
|
@@ -390,6 +429,10 @@ function phaseDone(id, phase) {
|
|
|
390
429
|
console.log(chalk5.dim(`Item #${id} already done, skipping phase advance.`));
|
|
391
430
|
return;
|
|
392
431
|
}
|
|
432
|
+
if (result) {
|
|
433
|
+
addPhaseSummary(result.item, summary, phaseIndex);
|
|
434
|
+
saveBacklog(result.items);
|
|
435
|
+
}
|
|
393
436
|
setCurrentPhase(id, phaseIndex + 1);
|
|
394
437
|
console.log(chalk5.green(`Phase ${phase} of item #${id} marked as complete.`));
|
|
395
438
|
}
|
|
@@ -610,63 +653,96 @@ function plan(id) {
|
|
|
610
653
|
}
|
|
611
654
|
|
|
612
655
|
// src/commands/backlog/show/index.ts
|
|
656
|
+
import chalk13 from "chalk";
|
|
657
|
+
|
|
658
|
+
// src/commands/backlog/formatComment.ts
|
|
613
659
|
import chalk12 from "chalk";
|
|
660
|
+
function formatComment(entry) {
|
|
661
|
+
const tag = entry.type === "summary" ? chalk12.magenta("[summary]") : chalk12.cyan("[comment]");
|
|
662
|
+
const phase = entry.phase !== void 0 ? chalk12.dim(` (phase ${entry.phase + 1})`) : "";
|
|
663
|
+
const time = chalk12.dim(entry.timestamp);
|
|
664
|
+
return `${tag}${phase} ${time}
|
|
665
|
+
${entry.text}`;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
// src/commands/backlog/show/index.ts
|
|
614
669
|
function printPlan(item) {
|
|
615
670
|
if (!item.plan || item.plan.length === 0) return;
|
|
616
|
-
console.log(
|
|
671
|
+
console.log(chalk13.bold("Plan"));
|
|
617
672
|
for (const [i, phase] of item.plan.entries()) {
|
|
618
673
|
const isCurrent = item.currentPhase === i;
|
|
619
674
|
printPhase(phase, i, isCurrent);
|
|
620
675
|
}
|
|
621
676
|
console.log();
|
|
622
677
|
}
|
|
623
|
-
function
|
|
624
|
-
const marker = isCurrent ?
|
|
625
|
-
const label2 = isCurrent ?
|
|
626
|
-
|
|
678
|
+
function phaseHeader(index, name, isCurrent) {
|
|
679
|
+
const marker = isCurrent ? chalk13.green("\u25B6 ") : " ";
|
|
680
|
+
const label2 = isCurrent ? chalk13.green.bold(`Phase ${index + 1}: ${name}`) : `${chalk13.bold(`Phase ${index + 1}:`)} ${name}`;
|
|
681
|
+
return `${marker}${label2}`;
|
|
682
|
+
}
|
|
683
|
+
function printPhaseTasks(phase) {
|
|
627
684
|
for (const task of phase.tasks) {
|
|
628
685
|
console.log(` - ${task.task}`);
|
|
629
686
|
if (task.verify) {
|
|
630
|
-
console.log(` ${
|
|
687
|
+
console.log(` ${chalk13.dim(`verify: ${task.verify}`)}`);
|
|
631
688
|
}
|
|
632
689
|
}
|
|
633
690
|
if (phase.manualChecks && phase.manualChecks.length > 0) {
|
|
634
|
-
console.log(` ${
|
|
691
|
+
console.log(` ${chalk13.dim("Manual checks:")}`);
|
|
635
692
|
for (const check2 of phase.manualChecks) {
|
|
636
|
-
console.log(` ${
|
|
693
|
+
console.log(` ${chalk13.dim(`- ${check2}`)}`);
|
|
637
694
|
}
|
|
638
695
|
}
|
|
639
696
|
}
|
|
697
|
+
function printPhase(phase, index, isCurrent) {
|
|
698
|
+
console.log(phaseHeader(index, phase.name, isCurrent));
|
|
699
|
+
printPhaseTasks(phase);
|
|
700
|
+
}
|
|
701
|
+
function printHeader(item) {
|
|
702
|
+
console.log(chalk13.bold(`#${item.id} ${item.name}`));
|
|
703
|
+
console.log(
|
|
704
|
+
`${chalk13.dim("Type:")} ${item.type} ${chalk13.dim("Status:")} ${item.status}`
|
|
705
|
+
);
|
|
706
|
+
console.log();
|
|
707
|
+
}
|
|
708
|
+
function printAcceptanceCriteria(criteria) {
|
|
709
|
+
if (criteria.length === 0) return;
|
|
710
|
+
console.log(chalk13.bold("Acceptance Criteria"));
|
|
711
|
+
for (const [i, ac] of criteria.entries()) {
|
|
712
|
+
console.log(` ${i + 1}. ${ac}`);
|
|
713
|
+
}
|
|
714
|
+
console.log();
|
|
715
|
+
}
|
|
640
716
|
function show(id) {
|
|
641
717
|
const result = loadAndFindItem(id);
|
|
642
718
|
if (!result) process.exit(1);
|
|
643
719
|
const { item } = result;
|
|
644
|
-
|
|
645
|
-
console.log(
|
|
646
|
-
`${chalk12.dim("Type:")} ${item.type} ${chalk12.dim("Status:")} ${item.status}`
|
|
647
|
-
);
|
|
648
|
-
console.log();
|
|
720
|
+
printHeader(item);
|
|
649
721
|
if (item.description) {
|
|
650
|
-
console.log(
|
|
722
|
+
console.log(chalk13.bold("Description"));
|
|
651
723
|
console.log(item.description);
|
|
652
724
|
console.log();
|
|
653
725
|
}
|
|
654
|
-
|
|
655
|
-
console.log(chalk12.bold("Acceptance Criteria"));
|
|
656
|
-
for (const [i, ac] of item.acceptanceCriteria.entries()) {
|
|
657
|
-
console.log(` ${i + 1}. ${ac}`);
|
|
658
|
-
}
|
|
659
|
-
console.log();
|
|
660
|
-
}
|
|
726
|
+
printAcceptanceCriteria(item.acceptanceCriteria);
|
|
661
727
|
printPlan(item);
|
|
728
|
+
printComments(item);
|
|
729
|
+
}
|
|
730
|
+
function printComments(item) {
|
|
731
|
+
const entries = item.comments ?? [];
|
|
732
|
+
if (entries.length === 0) return;
|
|
733
|
+
console.log(chalk13.bold("Comments"));
|
|
734
|
+
for (const entry of entries) {
|
|
735
|
+
console.log(` ${formatComment(entry)}`);
|
|
736
|
+
}
|
|
737
|
+
console.log();
|
|
662
738
|
}
|
|
663
739
|
|
|
664
740
|
// src/commands/backlog/start/index.ts
|
|
665
|
-
import
|
|
741
|
+
import chalk14 from "chalk";
|
|
666
742
|
async function start(id) {
|
|
667
743
|
const name = setStatus(id, "in-progress");
|
|
668
744
|
if (name) {
|
|
669
|
-
console.log(
|
|
745
|
+
console.log(chalk14.green(`Started item #${id}: ${name}`));
|
|
670
746
|
}
|
|
671
747
|
}
|
|
672
748
|
|
|
@@ -678,7 +754,7 @@ import {
|
|
|
678
754
|
} from "http";
|
|
679
755
|
import { dirname, join as join3 } from "path";
|
|
680
756
|
import { fileURLToPath } from "url";
|
|
681
|
-
import
|
|
757
|
+
import chalk15 from "chalk";
|
|
682
758
|
function respondJson(res, status2, data) {
|
|
683
759
|
res.writeHead(status2, { "Content-Type": "application/json" });
|
|
684
760
|
res.end(JSON.stringify(data));
|
|
@@ -722,8 +798,8 @@ function startWebServer(label2, port, handler) {
|
|
|
722
798
|
handler(req, res, port);
|
|
723
799
|
});
|
|
724
800
|
server.listen(port, () => {
|
|
725
|
-
console.log(
|
|
726
|
-
console.log(
|
|
801
|
+
console.log(chalk15.green(`${label2}: ${url}`));
|
|
802
|
+
console.log(chalk15.dim("Press Ctrl+C to stop"));
|
|
727
803
|
exec(`open ${url}`);
|
|
728
804
|
});
|
|
729
805
|
}
|
|
@@ -877,7 +953,7 @@ import { execSync } from "child_process";
|
|
|
877
953
|
import { existsSync as existsSync5, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
|
|
878
954
|
import { homedir } from "os";
|
|
879
955
|
import { basename, dirname as dirname2, join as join4 } from "path";
|
|
880
|
-
import
|
|
956
|
+
import chalk16 from "chalk";
|
|
881
957
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
882
958
|
|
|
883
959
|
// src/shared/loadRawYaml.ts
|
|
@@ -1064,7 +1140,7 @@ function getTranscriptConfig() {
|
|
|
1064
1140
|
const config = loadConfig();
|
|
1065
1141
|
if (!config.transcript) {
|
|
1066
1142
|
console.error(
|
|
1067
|
-
|
|
1143
|
+
chalk16.red(
|
|
1068
1144
|
"Transcript directories not configured. Run 'assist transcript configure' first."
|
|
1069
1145
|
)
|
|
1070
1146
|
);
|
|
@@ -1153,7 +1229,7 @@ function commit(args) {
|
|
|
1153
1229
|
}
|
|
1154
1230
|
|
|
1155
1231
|
// src/commands/config/index.ts
|
|
1156
|
-
import
|
|
1232
|
+
import chalk17 from "chalk";
|
|
1157
1233
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
1158
1234
|
|
|
1159
1235
|
// src/commands/config/getNestedValue.ts
|
|
@@ -1229,7 +1305,7 @@ function formatIssuePath(issue, key) {
|
|
|
1229
1305
|
function printValidationErrors(issues, key) {
|
|
1230
1306
|
for (const issue of issues) {
|
|
1231
1307
|
console.error(
|
|
1232
|
-
|
|
1308
|
+
chalk17.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
1233
1309
|
);
|
|
1234
1310
|
}
|
|
1235
1311
|
}
|
|
@@ -1249,13 +1325,13 @@ function applyConfigSet(key, coerced) {
|
|
|
1249
1325
|
function configSet(key, value) {
|
|
1250
1326
|
const coerced = coerceValue(value);
|
|
1251
1327
|
applyConfigSet(key, coerced);
|
|
1252
|
-
console.log(
|
|
1328
|
+
console.log(chalk17.green(`Set ${key} = ${JSON.stringify(coerced)}`));
|
|
1253
1329
|
}
|
|
1254
1330
|
function formatOutput(value) {
|
|
1255
1331
|
return typeof value === "object" && value !== null ? JSON.stringify(value, null, 2) : String(value);
|
|
1256
1332
|
}
|
|
1257
1333
|
function exitKeyNotSet(key) {
|
|
1258
|
-
console.error(
|
|
1334
|
+
console.error(chalk17.red(`Key "${key}" is not set`));
|
|
1259
1335
|
process.exit(1);
|
|
1260
1336
|
}
|
|
1261
1337
|
function requireNestedValue(config, key) {
|
|
@@ -1291,10 +1367,10 @@ function coverage() {
|
|
|
1291
1367
|
}
|
|
1292
1368
|
|
|
1293
1369
|
// src/commands/verify/init/index.ts
|
|
1294
|
-
import
|
|
1370
|
+
import chalk32 from "chalk";
|
|
1295
1371
|
|
|
1296
1372
|
// src/shared/promptMultiselect.ts
|
|
1297
|
-
import
|
|
1373
|
+
import chalk18 from "chalk";
|
|
1298
1374
|
import enquirer3 from "enquirer";
|
|
1299
1375
|
async function promptMultiselect(message, options2) {
|
|
1300
1376
|
const { selected } = await enquirer3.prompt({
|
|
@@ -1303,7 +1379,7 @@ async function promptMultiselect(message, options2) {
|
|
|
1303
1379
|
message,
|
|
1304
1380
|
choices: options2.map((opt) => ({
|
|
1305
1381
|
name: opt.value,
|
|
1306
|
-
message: `${opt.name} - ${
|
|
1382
|
+
message: `${opt.name} - ${chalk18.dim(opt.description)}`
|
|
1307
1383
|
})),
|
|
1308
1384
|
// @ts-expect-error - enquirer types don't include symbols but it's supported
|
|
1309
1385
|
symbols: {
|
|
@@ -1319,7 +1395,7 @@ async function promptMultiselect(message, options2) {
|
|
|
1319
1395
|
// src/shared/readPackageJson.ts
|
|
1320
1396
|
import * as fs from "fs";
|
|
1321
1397
|
import * as path from "path";
|
|
1322
|
-
import
|
|
1398
|
+
import chalk19 from "chalk";
|
|
1323
1399
|
function findPackageJson() {
|
|
1324
1400
|
const packageJsonPath = path.join(process.cwd(), "package.json");
|
|
1325
1401
|
if (fs.existsSync(packageJsonPath)) {
|
|
@@ -1333,7 +1409,7 @@ function readPackageJson(filePath) {
|
|
|
1333
1409
|
function requirePackageJson() {
|
|
1334
1410
|
const packageJsonPath = findPackageJson();
|
|
1335
1411
|
if (!packageJsonPath) {
|
|
1336
|
-
console.error(
|
|
1412
|
+
console.error(chalk19.red("No package.json found in current directory"));
|
|
1337
1413
|
process.exit(1);
|
|
1338
1414
|
}
|
|
1339
1415
|
const pkg = readPackageJson(packageJsonPath);
|
|
@@ -1364,7 +1440,7 @@ function findPackageJsonWithVerifyScripts(startDir) {
|
|
|
1364
1440
|
// src/commands/verify/installPackage.ts
|
|
1365
1441
|
import { execSync as execSync3 } from "child_process";
|
|
1366
1442
|
import { writeFileSync as writeFileSync4 } from "fs";
|
|
1367
|
-
import
|
|
1443
|
+
import chalk20 from "chalk";
|
|
1368
1444
|
function writePackageJson(filePath, pkg) {
|
|
1369
1445
|
writeFileSync4(filePath, `${JSON.stringify(pkg, null, 2)}
|
|
1370
1446
|
`);
|
|
@@ -1379,12 +1455,12 @@ function addScript(pkg, name, command) {
|
|
|
1379
1455
|
};
|
|
1380
1456
|
}
|
|
1381
1457
|
function installPackage(name, cwd) {
|
|
1382
|
-
console.log(
|
|
1458
|
+
console.log(chalk20.dim(`Installing ${name}...`));
|
|
1383
1459
|
try {
|
|
1384
1460
|
execSync3(`npm install -D ${name}`, { stdio: "inherit", cwd });
|
|
1385
1461
|
return true;
|
|
1386
1462
|
} catch {
|
|
1387
|
-
console.error(
|
|
1463
|
+
console.error(chalk20.red(`Failed to install ${name}`));
|
|
1388
1464
|
return false;
|
|
1389
1465
|
}
|
|
1390
1466
|
}
|
|
@@ -1431,9 +1507,9 @@ var expectedScripts = {
|
|
|
1431
1507
|
};
|
|
1432
1508
|
|
|
1433
1509
|
// src/commands/verify/setup/setupBuild.ts
|
|
1434
|
-
import
|
|
1510
|
+
import chalk21 from "chalk";
|
|
1435
1511
|
async function setupBuild(_packageJsonPath, writer, hasVite, hasTypescript) {
|
|
1436
|
-
console.log(
|
|
1512
|
+
console.log(chalk21.blue("\nSetting up build verification..."));
|
|
1437
1513
|
let command;
|
|
1438
1514
|
if (hasVite && hasTypescript) {
|
|
1439
1515
|
command = "tsc -b && vite build --logLevel error";
|
|
@@ -1442,21 +1518,21 @@ async function setupBuild(_packageJsonPath, writer, hasVite, hasTypescript) {
|
|
|
1442
1518
|
} else {
|
|
1443
1519
|
command = "npm run build";
|
|
1444
1520
|
}
|
|
1445
|
-
console.log(
|
|
1521
|
+
console.log(chalk21.dim(`Using: ${command}`));
|
|
1446
1522
|
writer("verify:build", command);
|
|
1447
1523
|
}
|
|
1448
1524
|
async function setupTypecheck(_packageJsonPath, writer) {
|
|
1449
|
-
console.log(
|
|
1525
|
+
console.log(chalk21.blue("\nSetting up typecheck verification..."));
|
|
1450
1526
|
const command = "tsc --noEmit";
|
|
1451
|
-
console.log(
|
|
1527
|
+
console.log(chalk21.dim(`Using: ${command}`));
|
|
1452
1528
|
writer("verify:typecheck", command);
|
|
1453
1529
|
}
|
|
1454
1530
|
|
|
1455
1531
|
// src/commands/verify/setup/setupDuplicateCode.ts
|
|
1456
1532
|
import * as path2 from "path";
|
|
1457
|
-
import
|
|
1533
|
+
import chalk22 from "chalk";
|
|
1458
1534
|
async function setupDuplicateCode(packageJsonPath, writer) {
|
|
1459
|
-
console.log(
|
|
1535
|
+
console.log(chalk22.blue("\nSetting up jscpd..."));
|
|
1460
1536
|
const cwd = path2.dirname(packageJsonPath);
|
|
1461
1537
|
const pkg = readPackageJson(packageJsonPath);
|
|
1462
1538
|
const hasJscpd = !!pkg.dependencies?.jscpd || !!pkg.devDependencies?.jscpd;
|
|
@@ -1468,12 +1544,12 @@ async function setupDuplicateCode(packageJsonPath, writer) {
|
|
|
1468
1544
|
|
|
1469
1545
|
// src/commands/verify/setup/setupHardcodedColors.ts
|
|
1470
1546
|
import * as path3 from "path";
|
|
1471
|
-
import
|
|
1547
|
+
import chalk24 from "chalk";
|
|
1472
1548
|
|
|
1473
1549
|
// src/commands/verify/addToKnipIgnoreBinaries.ts
|
|
1474
1550
|
import { existsSync as existsSync7, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "fs";
|
|
1475
1551
|
import { join as join6 } from "path";
|
|
1476
|
-
import
|
|
1552
|
+
import chalk23 from "chalk";
|
|
1477
1553
|
function loadKnipConfig(knipJsonPath) {
|
|
1478
1554
|
if (existsSync7(knipJsonPath)) {
|
|
1479
1555
|
return JSON.parse(readFileSync6(knipJsonPath, "utf-8"));
|
|
@@ -1492,16 +1568,16 @@ function addToKnipIgnoreBinaries(cwd, binary) {
|
|
|
1492
1568
|
`${JSON.stringify(knipConfig, null, " ")}
|
|
1493
1569
|
`
|
|
1494
1570
|
);
|
|
1495
|
-
console.log(
|
|
1571
|
+
console.log(chalk23.dim(`Added '${binary}' to knip.json ignoreBinaries`));
|
|
1496
1572
|
}
|
|
1497
1573
|
} catch {
|
|
1498
|
-
console.log(
|
|
1574
|
+
console.log(chalk23.yellow("Warning: Could not update knip.json"));
|
|
1499
1575
|
}
|
|
1500
1576
|
}
|
|
1501
1577
|
|
|
1502
1578
|
// src/commands/verify/setup/setupHardcodedColors.ts
|
|
1503
1579
|
async function setupHardcodedColors(packageJsonPath, writer, hasOpenColor) {
|
|
1504
|
-
console.log(
|
|
1580
|
+
console.log(chalk24.blue("\nSetting up hardcoded colors check..."));
|
|
1505
1581
|
const cwd = path3.dirname(packageJsonPath);
|
|
1506
1582
|
if (!hasOpenColor) {
|
|
1507
1583
|
installPackage("open-color", cwd);
|
|
@@ -1512,9 +1588,9 @@ async function setupHardcodedColors(packageJsonPath, writer, hasOpenColor) {
|
|
|
1512
1588
|
|
|
1513
1589
|
// src/commands/verify/setup/setupKnip.ts
|
|
1514
1590
|
import * as path4 from "path";
|
|
1515
|
-
import
|
|
1591
|
+
import chalk25 from "chalk";
|
|
1516
1592
|
async function setupKnip(packageJsonPath, writer) {
|
|
1517
|
-
console.log(
|
|
1593
|
+
console.log(chalk25.blue("\nSetting up knip..."));
|
|
1518
1594
|
const cwd = path4.dirname(packageJsonPath);
|
|
1519
1595
|
const pkg = readPackageJson(packageJsonPath);
|
|
1520
1596
|
if (!pkg.devDependencies?.knip && !installPackage("knip", cwd)) {
|
|
@@ -1525,14 +1601,14 @@ async function setupKnip(packageJsonPath, writer) {
|
|
|
1525
1601
|
|
|
1526
1602
|
// src/commands/verify/setup/setupLint.ts
|
|
1527
1603
|
import * as path5 from "path";
|
|
1528
|
-
import
|
|
1604
|
+
import chalk28 from "chalk";
|
|
1529
1605
|
|
|
1530
1606
|
// src/commands/lint/init.ts
|
|
1531
1607
|
import { execSync as execSync5 } from "child_process";
|
|
1532
1608
|
import { existsSync as existsSync10, readFileSync as readFileSync8, writeFileSync as writeFileSync7 } from "fs";
|
|
1533
1609
|
import { dirname as dirname7, join as join7 } from "path";
|
|
1534
1610
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
1535
|
-
import
|
|
1611
|
+
import chalk27 from "chalk";
|
|
1536
1612
|
|
|
1537
1613
|
// src/shared/promptConfirm.ts
|
|
1538
1614
|
import enquirer4 from "enquirer";
|
|
@@ -1634,7 +1710,7 @@ function removeEslintScripts(scripts, options2) {
|
|
|
1634
1710
|
}
|
|
1635
1711
|
|
|
1636
1712
|
// src/utils/printDiff.ts
|
|
1637
|
-
import
|
|
1713
|
+
import chalk26 from "chalk";
|
|
1638
1714
|
import * as diff from "diff";
|
|
1639
1715
|
function normalizeJson(content) {
|
|
1640
1716
|
try {
|
|
@@ -1652,11 +1728,11 @@ function printDiff(oldContent, newContent) {
|
|
|
1652
1728
|
const lines = change.value.replace(/\n$/, "").split("\n");
|
|
1653
1729
|
for (const line of lines) {
|
|
1654
1730
|
if (change.added) {
|
|
1655
|
-
console.log(
|
|
1731
|
+
console.log(chalk26.green(`+ ${line}`));
|
|
1656
1732
|
} else if (change.removed) {
|
|
1657
|
-
console.log(
|
|
1733
|
+
console.log(chalk26.red(`- ${line}`));
|
|
1658
1734
|
} else {
|
|
1659
|
-
console.log(
|
|
1735
|
+
console.log(chalk26.dim(` ${line}`));
|
|
1660
1736
|
}
|
|
1661
1737
|
}
|
|
1662
1738
|
}
|
|
@@ -1690,10 +1766,10 @@ async function init() {
|
|
|
1690
1766
|
console.log("biome.json already has the correct linter config");
|
|
1691
1767
|
return;
|
|
1692
1768
|
}
|
|
1693
|
-
console.log(
|
|
1769
|
+
console.log(chalk27.yellow("\n\u26A0\uFE0F biome.json will be updated:"));
|
|
1694
1770
|
console.log();
|
|
1695
1771
|
printDiff(oldContent, newContent);
|
|
1696
|
-
const confirm = await promptConfirm(
|
|
1772
|
+
const confirm = await promptConfirm(chalk27.red("Update biome.json?"));
|
|
1697
1773
|
if (!confirm) {
|
|
1698
1774
|
console.log("Skipped biome.json update");
|
|
1699
1775
|
return;
|
|
@@ -1704,7 +1780,7 @@ async function init() {
|
|
|
1704
1780
|
|
|
1705
1781
|
// src/commands/verify/setup/setupLint.ts
|
|
1706
1782
|
async function setupLint(packageJsonPath, writer) {
|
|
1707
|
-
console.log(
|
|
1783
|
+
console.log(chalk28.blue("\nSetting up biome..."));
|
|
1708
1784
|
const cwd = path5.dirname(packageJsonPath);
|
|
1709
1785
|
const pkg = readPackageJson(packageJsonPath);
|
|
1710
1786
|
if (!pkg.devDependencies?.["@biomejs/biome"]) {
|
|
@@ -1718,9 +1794,9 @@ async function setupLint(packageJsonPath, writer) {
|
|
|
1718
1794
|
|
|
1719
1795
|
// src/commands/verify/setup/setupMadge.ts
|
|
1720
1796
|
import * as path6 from "path";
|
|
1721
|
-
import
|
|
1797
|
+
import chalk29 from "chalk";
|
|
1722
1798
|
async function setupMadge(packageJsonPath, writer) {
|
|
1723
|
-
console.log(
|
|
1799
|
+
console.log(chalk29.blue("\nSetting up madge..."));
|
|
1724
1800
|
const cwd = path6.dirname(packageJsonPath);
|
|
1725
1801
|
const pkg = readPackageJson(packageJsonPath);
|
|
1726
1802
|
const hasMadge = !!pkg.dependencies?.madge || !!pkg.devDependencies?.madge;
|
|
@@ -1732,18 +1808,18 @@ async function setupMadge(packageJsonPath, writer) {
|
|
|
1732
1808
|
|
|
1733
1809
|
// src/commands/verify/setup/setupMaintainability.ts
|
|
1734
1810
|
import * as path7 from "path";
|
|
1735
|
-
import
|
|
1811
|
+
import chalk30 from "chalk";
|
|
1736
1812
|
async function setupMaintainability(packageJsonPath, writer) {
|
|
1737
|
-
console.log(
|
|
1813
|
+
console.log(chalk30.blue("\nSetting up maintainability check..."));
|
|
1738
1814
|
addToKnipIgnoreBinaries(path7.dirname(packageJsonPath), "assist");
|
|
1739
1815
|
writer("verify:maintainability", expectedScripts["verify:maintainability"]);
|
|
1740
1816
|
}
|
|
1741
1817
|
|
|
1742
1818
|
// src/commands/verify/setup/setupTest.ts
|
|
1743
1819
|
import * as path8 from "path";
|
|
1744
|
-
import
|
|
1820
|
+
import chalk31 from "chalk";
|
|
1745
1821
|
async function setupTest(packageJsonPath, writer) {
|
|
1746
|
-
console.log(
|
|
1822
|
+
console.log(chalk31.blue("\nSetting up vitest..."));
|
|
1747
1823
|
const cwd = path8.dirname(packageJsonPath);
|
|
1748
1824
|
const pkg = readPackageJson(packageJsonPath);
|
|
1749
1825
|
if (!pkg.devDependencies?.vitest && !installPackage("vitest", cwd)) {
|
|
@@ -1912,25 +1988,25 @@ async function runSelectedSetups(selected, packageJsonPath, writer, handlers) {
|
|
|
1912
1988
|
for (const choice of selected) {
|
|
1913
1989
|
await handlers[choice]?.(packageJsonPath, writer);
|
|
1914
1990
|
}
|
|
1915
|
-
console.log(
|
|
1991
|
+
console.log(chalk32.green(`
|
|
1916
1992
|
Added ${selected.length} verify script(s):`));
|
|
1917
1993
|
for (const choice of selected) {
|
|
1918
|
-
console.log(
|
|
1994
|
+
console.log(chalk32.green(` - verify:${choice}`));
|
|
1919
1995
|
}
|
|
1920
|
-
console.log(
|
|
1996
|
+
console.log(chalk32.dim("\nRun 'assist verify' to run all verify scripts"));
|
|
1921
1997
|
}
|
|
1922
1998
|
async function promptForScripts(availableOptions) {
|
|
1923
1999
|
if (availableOptions.length === 0) {
|
|
1924
|
-
console.log(
|
|
2000
|
+
console.log(chalk32.green("All verify scripts are already configured!"));
|
|
1925
2001
|
return null;
|
|
1926
2002
|
}
|
|
1927
|
-
console.log(
|
|
2003
|
+
console.log(chalk32.bold("Available verify scripts to add:\n"));
|
|
1928
2004
|
const selected = await promptMultiselect(
|
|
1929
2005
|
"Select verify scripts to add:",
|
|
1930
2006
|
availableOptions
|
|
1931
2007
|
);
|
|
1932
2008
|
if (selected.length === 0) {
|
|
1933
|
-
console.log(
|
|
2009
|
+
console.log(chalk32.yellow("No scripts selected"));
|
|
1934
2010
|
return null;
|
|
1935
2011
|
}
|
|
1936
2012
|
return selected;
|
|
@@ -1950,17 +2026,17 @@ async function init2() {
|
|
|
1950
2026
|
}
|
|
1951
2027
|
|
|
1952
2028
|
// src/commands/vscode/init/index.ts
|
|
1953
|
-
import
|
|
2029
|
+
import chalk34 from "chalk";
|
|
1954
2030
|
|
|
1955
2031
|
// src/commands/vscode/init/createLaunchJson.ts
|
|
1956
2032
|
import * as fs2 from "fs";
|
|
1957
2033
|
import * as path9 from "path";
|
|
1958
|
-
import
|
|
2034
|
+
import chalk33 from "chalk";
|
|
1959
2035
|
function ensureVscodeFolder() {
|
|
1960
2036
|
const vscodeDir = path9.join(process.cwd(), ".vscode");
|
|
1961
2037
|
if (!fs2.existsSync(vscodeDir)) {
|
|
1962
2038
|
fs2.mkdirSync(vscodeDir);
|
|
1963
|
-
console.log(
|
|
2039
|
+
console.log(chalk33.dim("Created .vscode folder"));
|
|
1964
2040
|
}
|
|
1965
2041
|
}
|
|
1966
2042
|
function removeVscodeFromGitignore() {
|
|
@@ -1975,7 +2051,7 @@ function removeVscodeFromGitignore() {
|
|
|
1975
2051
|
);
|
|
1976
2052
|
if (filteredLines.length !== lines.length) {
|
|
1977
2053
|
fs2.writeFileSync(gitignorePath, filteredLines.join("\n"));
|
|
1978
|
-
console.log(
|
|
2054
|
+
console.log(chalk33.dim("Removed .vscode references from .gitignore"));
|
|
1979
2055
|
}
|
|
1980
2056
|
}
|
|
1981
2057
|
function createLaunchJson(type) {
|
|
@@ -1994,7 +2070,7 @@ function createLaunchJson(type) {
|
|
|
1994
2070
|
const launchPath = path9.join(process.cwd(), ".vscode", "launch.json");
|
|
1995
2071
|
fs2.writeFileSync(launchPath, `${JSON.stringify(launchConfig, null, " ")}
|
|
1996
2072
|
`);
|
|
1997
|
-
console.log(
|
|
2073
|
+
console.log(chalk33.green("Created .vscode/launch.json"));
|
|
1998
2074
|
}
|
|
1999
2075
|
function createSettingsJson() {
|
|
2000
2076
|
const settings = {
|
|
@@ -2007,7 +2083,7 @@ function createSettingsJson() {
|
|
|
2007
2083
|
const settingsPath = path9.join(process.cwd(), ".vscode", "settings.json");
|
|
2008
2084
|
fs2.writeFileSync(settingsPath, `${JSON.stringify(settings, null, " ")}
|
|
2009
2085
|
`);
|
|
2010
|
-
console.log(
|
|
2086
|
+
console.log(chalk33.green("Created .vscode/settings.json"));
|
|
2011
2087
|
}
|
|
2012
2088
|
function createExtensionsJson() {
|
|
2013
2089
|
const extensions = {
|
|
@@ -2019,7 +2095,7 @@ function createExtensionsJson() {
|
|
|
2019
2095
|
`${JSON.stringify(extensions, null, " ")}
|
|
2020
2096
|
`
|
|
2021
2097
|
);
|
|
2022
|
-
console.log(
|
|
2098
|
+
console.log(chalk33.green("Created .vscode/extensions.json"));
|
|
2023
2099
|
}
|
|
2024
2100
|
|
|
2025
2101
|
// src/commands/vscode/init/detectVscodeSetup.ts
|
|
@@ -2076,7 +2152,7 @@ function applySelections(selected, setup2) {
|
|
|
2076
2152
|
for (const choice of selected) handlers[choice]?.();
|
|
2077
2153
|
}
|
|
2078
2154
|
async function promptForOptions(options2) {
|
|
2079
|
-
console.log(
|
|
2155
|
+
console.log(chalk34.bold("Available VS Code configurations to add:\n"));
|
|
2080
2156
|
return promptMultiselect("Select configurations to add:", options2);
|
|
2081
2157
|
}
|
|
2082
2158
|
async function init3({ all = false } = {}) {
|
|
@@ -2084,17 +2160,17 @@ async function init3({ all = false } = {}) {
|
|
|
2084
2160
|
const setup2 = detectVscodeSetup(pkg);
|
|
2085
2161
|
const options2 = getAvailableOptions2(setup2);
|
|
2086
2162
|
if (options2.length === 0) {
|
|
2087
|
-
console.log(
|
|
2163
|
+
console.log(chalk34.green("VS Code configuration already exists!"));
|
|
2088
2164
|
return;
|
|
2089
2165
|
}
|
|
2090
2166
|
const selected = all ? options2.map((o) => o.value) : await promptForOptions(options2);
|
|
2091
2167
|
if (selected.length === 0) {
|
|
2092
|
-
console.log(
|
|
2168
|
+
console.log(chalk34.yellow("No configurations selected"));
|
|
2093
2169
|
return;
|
|
2094
2170
|
}
|
|
2095
2171
|
applySelections(selected, setup2);
|
|
2096
2172
|
console.log(
|
|
2097
|
-
|
|
2173
|
+
chalk34.green(`
|
|
2098
2174
|
Added ${selected.length} VS Code configuration(s)`)
|
|
2099
2175
|
);
|
|
2100
2176
|
}
|
|
@@ -2107,7 +2183,7 @@ async function init4() {
|
|
|
2107
2183
|
|
|
2108
2184
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
2109
2185
|
import path16 from "path";
|
|
2110
|
-
import
|
|
2186
|
+
import chalk36 from "chalk";
|
|
2111
2187
|
|
|
2112
2188
|
// src/commands/lint/lint/checkFileNames.ts
|
|
2113
2189
|
import fs5 from "fs";
|
|
@@ -2187,7 +2263,7 @@ function checkFileNames() {
|
|
|
2187
2263
|
}
|
|
2188
2264
|
|
|
2189
2265
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
2190
|
-
import
|
|
2266
|
+
import chalk35 from "chalk";
|
|
2191
2267
|
|
|
2192
2268
|
// src/commands/lint/lint/applyMoves.ts
|
|
2193
2269
|
import fs6 from "fs";
|
|
@@ -2272,25 +2348,25 @@ function fixFileNameViolations(moves) {
|
|
|
2272
2348
|
const start3 = performance.now();
|
|
2273
2349
|
const project = createLintProject();
|
|
2274
2350
|
const cwd = process.cwd();
|
|
2275
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
2351
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk35.green(line)));
|
|
2276
2352
|
const ms = (performance.now() - start3).toFixed(0);
|
|
2277
|
-
console.log(
|
|
2353
|
+
console.log(chalk35.dim(` Done in ${ms}ms`));
|
|
2278
2354
|
}
|
|
2279
2355
|
|
|
2280
2356
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
2281
2357
|
function reportViolations(violations) {
|
|
2282
|
-
console.error(
|
|
2358
|
+
console.error(chalk36.red("\nFile name check failed:\n"));
|
|
2283
2359
|
console.error(
|
|
2284
|
-
|
|
2360
|
+
chalk36.red(
|
|
2285
2361
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
2286
2362
|
)
|
|
2287
2363
|
);
|
|
2288
2364
|
for (const violation of violations) {
|
|
2289
|
-
console.error(
|
|
2290
|
-
console.error(
|
|
2365
|
+
console.error(chalk36.red(` ${violation.filePath}`));
|
|
2366
|
+
console.error(chalk36.gray(` Rename to: ${violation.suggestedName}
|
|
2291
2367
|
`));
|
|
2292
2368
|
}
|
|
2293
|
-
console.error(
|
|
2369
|
+
console.error(chalk36.dim(" Run with -f to auto-fix.\n"));
|
|
2294
2370
|
}
|
|
2295
2371
|
function runFileNameCheck(fix = false) {
|
|
2296
2372
|
const violations = checkFileNames();
|
|
@@ -2319,17 +2395,17 @@ function runFileNameCheck(fix = false) {
|
|
|
2319
2395
|
import fs8 from "fs";
|
|
2320
2396
|
|
|
2321
2397
|
// src/commands/lint/shared.ts
|
|
2322
|
-
import
|
|
2398
|
+
import chalk37 from "chalk";
|
|
2323
2399
|
function reportViolations2(violations, checkName, errorMessage, successMessage) {
|
|
2324
2400
|
if (violations.length > 0) {
|
|
2325
|
-
console.error(
|
|
2401
|
+
console.error(chalk37.red(`
|
|
2326
2402
|
${checkName} failed:
|
|
2327
2403
|
`));
|
|
2328
|
-
console.error(
|
|
2404
|
+
console.error(chalk37.red(` ${errorMessage}
|
|
2329
2405
|
`));
|
|
2330
2406
|
for (const violation of violations) {
|
|
2331
|
-
console.error(
|
|
2332
|
-
console.error(
|
|
2407
|
+
console.error(chalk37.red(` ${violation.filePath}:${violation.line}`));
|
|
2408
|
+
console.error(chalk37.gray(` ${violation.content}
|
|
2333
2409
|
`));
|
|
2334
2410
|
}
|
|
2335
2411
|
return false;
|
|
@@ -2809,14 +2885,14 @@ import { existsSync as existsSync14, readFileSync as readFileSync11, writeFileSy
|
|
|
2809
2885
|
|
|
2810
2886
|
// src/commands/deploy/init/index.ts
|
|
2811
2887
|
import { execSync as execSync12 } from "child_process";
|
|
2812
|
-
import
|
|
2888
|
+
import chalk39 from "chalk";
|
|
2813
2889
|
import enquirer5 from "enquirer";
|
|
2814
2890
|
|
|
2815
2891
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
2816
2892
|
import { existsSync as existsSync13, mkdirSync as mkdirSync3, readFileSync as readFileSync10, writeFileSync as writeFileSync11 } from "fs";
|
|
2817
2893
|
import { dirname as dirname13, join as join10 } from "path";
|
|
2818
2894
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
2819
|
-
import
|
|
2895
|
+
import chalk38 from "chalk";
|
|
2820
2896
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
2821
2897
|
var __dirname3 = dirname13(fileURLToPath3(import.meta.url));
|
|
2822
2898
|
function getExistingSiteId() {
|
|
@@ -2841,20 +2917,20 @@ async function updateWorkflow(siteId) {
|
|
|
2841
2917
|
if (existsSync13(WORKFLOW_PATH)) {
|
|
2842
2918
|
const oldContent = readFileSync10(WORKFLOW_PATH, "utf-8");
|
|
2843
2919
|
if (oldContent === newContent) {
|
|
2844
|
-
console.log(
|
|
2920
|
+
console.log(chalk38.green("build.yml is already up to date"));
|
|
2845
2921
|
return;
|
|
2846
2922
|
}
|
|
2847
|
-
console.log(
|
|
2923
|
+
console.log(chalk38.yellow("\nbuild.yml will be updated:"));
|
|
2848
2924
|
console.log();
|
|
2849
2925
|
printDiff(oldContent, newContent);
|
|
2850
|
-
const confirm = await promptConfirm(
|
|
2926
|
+
const confirm = await promptConfirm(chalk38.red("Update build.yml?"));
|
|
2851
2927
|
if (!confirm) {
|
|
2852
2928
|
console.log("Skipped build.yml update");
|
|
2853
2929
|
return;
|
|
2854
2930
|
}
|
|
2855
2931
|
}
|
|
2856
2932
|
writeFileSync11(WORKFLOW_PATH, newContent);
|
|
2857
|
-
console.log(
|
|
2933
|
+
console.log(chalk38.green(`
|
|
2858
2934
|
Created ${WORKFLOW_PATH}`));
|
|
2859
2935
|
}
|
|
2860
2936
|
|
|
@@ -2865,43 +2941,43 @@ async function ensureNetlifyCli() {
|
|
|
2865
2941
|
} catch (error) {
|
|
2866
2942
|
if (!(error instanceof Error) || !error.message.includes("command not found"))
|
|
2867
2943
|
throw error;
|
|
2868
|
-
console.error(
|
|
2944
|
+
console.error(chalk39.red("\nNetlify CLI is not installed.\n"));
|
|
2869
2945
|
const install = await promptConfirm("Would you like to install it now?");
|
|
2870
2946
|
if (!install) {
|
|
2871
2947
|
console.log(
|
|
2872
|
-
|
|
2948
|
+
chalk39.yellow(
|
|
2873
2949
|
"\nInstall it manually with: npm install -g netlify-cli\n"
|
|
2874
2950
|
)
|
|
2875
2951
|
);
|
|
2876
2952
|
process.exit(1);
|
|
2877
2953
|
}
|
|
2878
|
-
console.log(
|
|
2954
|
+
console.log(chalk39.dim("\nInstalling netlify-cli...\n"));
|
|
2879
2955
|
execSync12("npm install -g netlify-cli", { stdio: "inherit" });
|
|
2880
2956
|
console.log();
|
|
2881
2957
|
execSync12("netlify sites:create --disable-linking", { stdio: "inherit" });
|
|
2882
2958
|
}
|
|
2883
2959
|
}
|
|
2884
2960
|
function printSetupInstructions() {
|
|
2885
|
-
console.log(
|
|
2961
|
+
console.log(chalk39.bold("\nDeployment initialized successfully!"));
|
|
2886
2962
|
console.log(
|
|
2887
|
-
|
|
2963
|
+
chalk39.yellow("\nTo complete setup, create a personal access token at:")
|
|
2888
2964
|
);
|
|
2889
2965
|
console.log(
|
|
2890
|
-
|
|
2966
|
+
chalk39.cyan(
|
|
2891
2967
|
"https://app.netlify.com/user/applications#personal-access-tokens"
|
|
2892
2968
|
)
|
|
2893
2969
|
);
|
|
2894
2970
|
console.log(
|
|
2895
|
-
|
|
2971
|
+
chalk39.yellow(
|
|
2896
2972
|
"\nThen add it as NETLIFY_AUTH_TOKEN in your GitHub repository secrets."
|
|
2897
2973
|
)
|
|
2898
2974
|
);
|
|
2899
2975
|
}
|
|
2900
2976
|
async function init5() {
|
|
2901
|
-
console.log(
|
|
2977
|
+
console.log(chalk39.bold("Initializing Netlify deployment...\n"));
|
|
2902
2978
|
const existingSiteId = getExistingSiteId();
|
|
2903
2979
|
if (existingSiteId) {
|
|
2904
|
-
console.log(
|
|
2980
|
+
console.log(chalk39.dim(`Using existing site ID: ${existingSiteId}
|
|
2905
2981
|
`));
|
|
2906
2982
|
await updateWorkflow(existingSiteId);
|
|
2907
2983
|
return;
|
|
@@ -3079,13 +3155,48 @@ async function notify() {
|
|
|
3079
3155
|
console.log(`Notification sent: ${notification_type} for ${projectName}`);
|
|
3080
3156
|
}
|
|
3081
3157
|
|
|
3158
|
+
// src/commands/backlog/comment/index.ts
|
|
3159
|
+
import chalk40 from "chalk";
|
|
3160
|
+
function comment(id, text) {
|
|
3161
|
+
const result = loadAndFindItem(id);
|
|
3162
|
+
if (!result) process.exit(1);
|
|
3163
|
+
addComment(result.item, text);
|
|
3164
|
+
saveBacklog(result.items);
|
|
3165
|
+
console.log(chalk40.green(`Comment added to item #${id}.`));
|
|
3166
|
+
}
|
|
3167
|
+
|
|
3168
|
+
// src/commands/backlog/comments/index.ts
|
|
3169
|
+
import chalk41 from "chalk";
|
|
3170
|
+
function comments(id) {
|
|
3171
|
+
const result = loadAndFindItem(id);
|
|
3172
|
+
if (!result) process.exit(1);
|
|
3173
|
+
const { item } = result;
|
|
3174
|
+
const entries = item.comments ?? [];
|
|
3175
|
+
if (entries.length === 0) {
|
|
3176
|
+
console.log(chalk41.dim(`No comments on item #${id}.`));
|
|
3177
|
+
return;
|
|
3178
|
+
}
|
|
3179
|
+
console.log(chalk41.bold(`Comments for #${id}: ${item.name}
|
|
3180
|
+
`));
|
|
3181
|
+
for (const entry of entries) {
|
|
3182
|
+
console.log(`${formatComment(entry)}
|
|
3183
|
+
`);
|
|
3184
|
+
}
|
|
3185
|
+
}
|
|
3186
|
+
|
|
3187
|
+
// src/commands/backlog/registerCommentCommands.ts
|
|
3188
|
+
function registerCommentCommands(cmd) {
|
|
3189
|
+
cmd.command("comment <id> <text>").description("Add a comment to a backlog item").action(comment);
|
|
3190
|
+
cmd.command("comments <id>").description("List comments and summaries for a backlog item").action(comments);
|
|
3191
|
+
}
|
|
3192
|
+
|
|
3082
3193
|
// src/commands/backlog/add/index.ts
|
|
3083
3194
|
import { existsSync as existsSync15 } from "fs";
|
|
3084
|
-
import
|
|
3195
|
+
import chalk43 from "chalk";
|
|
3085
3196
|
|
|
3086
3197
|
// src/commands/backlog/commitBacklog.ts
|
|
3087
3198
|
import { execSync as execSync14 } from "child_process";
|
|
3088
|
-
import
|
|
3199
|
+
import chalk42 from "chalk";
|
|
3089
3200
|
function commitBacklog(id, name) {
|
|
3090
3201
|
try {
|
|
3091
3202
|
const backlogPath = getBacklogPath();
|
|
@@ -3093,7 +3204,7 @@ function commitBacklog(id, name) {
|
|
|
3093
3204
|
execSync14(`git add ${shellQuote(backlogPath)}`, { stdio: "ignore" });
|
|
3094
3205
|
execSync14(`git commit -m ${shellQuote(message)}`, { stdio: "ignore" });
|
|
3095
3206
|
} catch {
|
|
3096
|
-
console.log(
|
|
3207
|
+
console.log(chalk42.yellow("Warning: could not auto-commit backlog file."));
|
|
3097
3208
|
}
|
|
3098
3209
|
}
|
|
3099
3210
|
|
|
@@ -3171,7 +3282,7 @@ async function promptAcceptanceCriteria() {
|
|
|
3171
3282
|
var addItemSchema = backlogItemSchema.omit({ id: true, status: true });
|
|
3172
3283
|
async function addFromJson() {
|
|
3173
3284
|
if (process.stdin.isTTY) {
|
|
3174
|
-
console.log(
|
|
3285
|
+
console.log(chalk43.red("--json requires piped input on stdin."));
|
|
3175
3286
|
return;
|
|
3176
3287
|
}
|
|
3177
3288
|
const input = await readStdin();
|
|
@@ -3185,7 +3296,7 @@ async function addFromJson() {
|
|
|
3185
3296
|
items.push({ ...data, id, status: "todo" });
|
|
3186
3297
|
saveBacklog(items);
|
|
3187
3298
|
commitBacklog(id, data.name);
|
|
3188
|
-
console.log(
|
|
3299
|
+
console.log(chalk43.green(`Added item #${id}: ${data.name}`));
|
|
3189
3300
|
}
|
|
3190
3301
|
async function addInteractive() {
|
|
3191
3302
|
const type = await promptType();
|
|
@@ -3204,12 +3315,12 @@ async function addInteractive() {
|
|
|
3204
3315
|
});
|
|
3205
3316
|
saveBacklog(items);
|
|
3206
3317
|
commitBacklog(id, name);
|
|
3207
|
-
console.log(
|
|
3318
|
+
console.log(chalk43.green(`Added item #${id}: ${name}`));
|
|
3208
3319
|
}
|
|
3209
3320
|
async function add(options2) {
|
|
3210
3321
|
if (!existsSync15(getBacklogPath())) {
|
|
3211
3322
|
console.log(
|
|
3212
|
-
|
|
3323
|
+
chalk43.yellow(
|
|
3213
3324
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
3214
3325
|
)
|
|
3215
3326
|
);
|
|
@@ -3224,20 +3335,20 @@ async function add(options2) {
|
|
|
3224
3335
|
|
|
3225
3336
|
// src/commands/backlog/init/index.ts
|
|
3226
3337
|
import { existsSync as existsSync16 } from "fs";
|
|
3227
|
-
import
|
|
3338
|
+
import chalk44 from "chalk";
|
|
3228
3339
|
async function init6() {
|
|
3229
3340
|
const backlogPath = getBacklogPath();
|
|
3230
3341
|
if (existsSync16(backlogPath)) {
|
|
3231
|
-
console.log(
|
|
3342
|
+
console.log(chalk44.yellow("assist.backlog.yml already exists."));
|
|
3232
3343
|
return;
|
|
3233
3344
|
}
|
|
3234
3345
|
saveBacklog([]);
|
|
3235
|
-
console.log(
|
|
3346
|
+
console.log(chalk44.green("Created assist.backlog.yml"));
|
|
3236
3347
|
}
|
|
3237
3348
|
|
|
3238
3349
|
// src/commands/backlog/list/index.ts
|
|
3239
3350
|
import { existsSync as existsSync17 } from "fs";
|
|
3240
|
-
import
|
|
3351
|
+
import chalk45 from "chalk";
|
|
3241
3352
|
function filterItems(items, options2) {
|
|
3242
3353
|
if (options2.status) return items.filter((i) => i.status === options2.status);
|
|
3243
3354
|
if (!options2.all) return items.filter((i) => i.status !== "done");
|
|
@@ -3246,7 +3357,7 @@ function filterItems(items, options2) {
|
|
|
3246
3357
|
async function list2(options2) {
|
|
3247
3358
|
if (!existsSync17(getBacklogPath())) {
|
|
3248
3359
|
console.log(
|
|
3249
|
-
|
|
3360
|
+
chalk45.yellow(
|
|
3250
3361
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
3251
3362
|
)
|
|
3252
3363
|
);
|
|
@@ -3254,12 +3365,12 @@ async function list2(options2) {
|
|
|
3254
3365
|
}
|
|
3255
3366
|
const items = filterItems(loadBacklog(), options2);
|
|
3256
3367
|
if (items.length === 0) {
|
|
3257
|
-
console.log(
|
|
3368
|
+
console.log(chalk45.dim("Backlog is empty."));
|
|
3258
3369
|
return;
|
|
3259
3370
|
}
|
|
3260
3371
|
for (const item of items) {
|
|
3261
3372
|
console.log(
|
|
3262
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
3373
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk45.dim(`#${item.id}`)} ${item.name}${phaseLabel(item)}`
|
|
3263
3374
|
);
|
|
3264
3375
|
if (options2.verbose) {
|
|
3265
3376
|
printVerboseDetails(item);
|
|
@@ -3282,16 +3393,20 @@ function registerStatusCommands(cmd) {
|
|
|
3282
3393
|
cmd.command("start <id>").description("Set a backlog item to in-progress").action(start);
|
|
3283
3394
|
cmd.command("done <id>").description("Set a backlog item to done").action(done);
|
|
3284
3395
|
cmd.command("delete <id>").alias("remove").description("Delete a backlog item").action(del);
|
|
3396
|
+
}
|
|
3397
|
+
function registerWebCommand(cmd) {
|
|
3285
3398
|
cmd.command("web").description("Start a web view of the backlog").option("-p, --port <number>", "Port to listen on", "3000").action(web);
|
|
3286
3399
|
}
|
|
3287
3400
|
function registerPlanCommands(cmd) {
|
|
3288
3401
|
cmd.command("plan <id>").description("Display the plan for a backlog item").action(plan);
|
|
3289
|
-
cmd.command("phase-done <id> <phase>").description("Signal that a plan phase is complete").action(phaseDone);
|
|
3402
|
+
cmd.command("phase-done <id> <phase> <summary>").description("Signal that a plan phase is complete").action(phaseDone);
|
|
3290
3403
|
}
|
|
3291
|
-
function
|
|
3404
|
+
function registerNextCommand(cmd) {
|
|
3292
3405
|
cmd.command("next").description("Pick and run the next backlog item, or open /draft if none").option("-w, --write", "Run Claude with acceptEdits permission mode").action(
|
|
3293
3406
|
(opts) => next({ allowEdits: opts.write })
|
|
3294
3407
|
);
|
|
3408
|
+
}
|
|
3409
|
+
function registerRunCommand(cmd) {
|
|
3295
3410
|
cmd.command("run <id>").description("Run a backlog item's plan phase-by-phase with Claude").option("-w, --write", "Run Claude with acceptEdits permission mode").action(
|
|
3296
3411
|
(id, opts) => run(id, { allowEdits: opts.write })
|
|
3297
3412
|
);
|
|
@@ -3301,8 +3416,11 @@ function registerBacklog(program2) {
|
|
|
3301
3416
|
registerItemCommands(cmd);
|
|
3302
3417
|
registerShowCommands(cmd);
|
|
3303
3418
|
registerStatusCommands(cmd);
|
|
3419
|
+
registerWebCommand(cmd);
|
|
3420
|
+
registerCommentCommands(cmd);
|
|
3304
3421
|
registerPlanCommands(cmd);
|
|
3305
|
-
|
|
3422
|
+
registerNextCommand(cmd);
|
|
3423
|
+
registerRunCommand(cmd);
|
|
3306
3424
|
}
|
|
3307
3425
|
|
|
3308
3426
|
// src/shared/isApprovedRead.ts
|
|
@@ -3654,11 +3772,11 @@ function assertCliExists(cli) {
|
|
|
3654
3772
|
}
|
|
3655
3773
|
|
|
3656
3774
|
// src/commands/permitCliReads/colorize.ts
|
|
3657
|
-
import
|
|
3775
|
+
import chalk46 from "chalk";
|
|
3658
3776
|
function colorize(plainOutput) {
|
|
3659
3777
|
return plainOutput.split("\n").map((line) => {
|
|
3660
|
-
if (line.startsWith(" R ")) return
|
|
3661
|
-
if (line.startsWith(" W ")) return
|
|
3778
|
+
if (line.startsWith(" R ")) return chalk46.green(line);
|
|
3779
|
+
if (line.startsWith(" W ")) return chalk46.red(line);
|
|
3662
3780
|
return line;
|
|
3663
3781
|
}).join("\n");
|
|
3664
3782
|
}
|
|
@@ -3972,15 +4090,15 @@ function registerCliHook(program2) {
|
|
|
3972
4090
|
}
|
|
3973
4091
|
|
|
3974
4092
|
// src/commands/complexity/analyze.ts
|
|
3975
|
-
import
|
|
4093
|
+
import chalk52 from "chalk";
|
|
3976
4094
|
|
|
3977
4095
|
// src/commands/complexity/cyclomatic.ts
|
|
3978
|
-
import
|
|
4096
|
+
import chalk48 from "chalk";
|
|
3979
4097
|
|
|
3980
4098
|
// src/commands/complexity/shared/index.ts
|
|
3981
4099
|
import fs12 from "fs";
|
|
3982
4100
|
import path20 from "path";
|
|
3983
|
-
import
|
|
4101
|
+
import chalk47 from "chalk";
|
|
3984
4102
|
import ts5 from "typescript";
|
|
3985
4103
|
|
|
3986
4104
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -4226,7 +4344,7 @@ function createSourceFromFile(filePath) {
|
|
|
4226
4344
|
function withSourceFiles(pattern2, callback) {
|
|
4227
4345
|
const files = findSourceFiles2(pattern2);
|
|
4228
4346
|
if (files.length === 0) {
|
|
4229
|
-
console.log(
|
|
4347
|
+
console.log(chalk47.yellow("No files found matching pattern"));
|
|
4230
4348
|
return void 0;
|
|
4231
4349
|
}
|
|
4232
4350
|
return callback(files);
|
|
@@ -4259,11 +4377,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4259
4377
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
4260
4378
|
for (const { file, name, complexity } of results) {
|
|
4261
4379
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
4262
|
-
const color = exceedsThreshold ?
|
|
4263
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
4380
|
+
const color = exceedsThreshold ? chalk48.red : chalk48.white;
|
|
4381
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk48.cyan(complexity)}`);
|
|
4264
4382
|
}
|
|
4265
4383
|
console.log(
|
|
4266
|
-
|
|
4384
|
+
chalk48.dim(
|
|
4267
4385
|
`
|
|
4268
4386
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
4269
4387
|
)
|
|
@@ -4275,7 +4393,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
4275
4393
|
}
|
|
4276
4394
|
|
|
4277
4395
|
// src/commands/complexity/halstead.ts
|
|
4278
|
-
import
|
|
4396
|
+
import chalk49 from "chalk";
|
|
4279
4397
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
4280
4398
|
withSourceFiles(pattern2, (files) => {
|
|
4281
4399
|
const results = [];
|
|
@@ -4290,13 +4408,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4290
4408
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
4291
4409
|
for (const { file, name, metrics } of results) {
|
|
4292
4410
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
4293
|
-
const color = exceedsThreshold ?
|
|
4411
|
+
const color = exceedsThreshold ? chalk49.red : chalk49.white;
|
|
4294
4412
|
console.log(
|
|
4295
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
4413
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk49.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk49.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk49.magenta(metrics.effort.toFixed(1))}`
|
|
4296
4414
|
);
|
|
4297
4415
|
}
|
|
4298
4416
|
console.log(
|
|
4299
|
-
|
|
4417
|
+
chalk49.dim(
|
|
4300
4418
|
`
|
|
4301
4419
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
4302
4420
|
)
|
|
@@ -4311,28 +4429,28 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
4311
4429
|
import fs13 from "fs";
|
|
4312
4430
|
|
|
4313
4431
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
4314
|
-
import
|
|
4432
|
+
import chalk50 from "chalk";
|
|
4315
4433
|
function displayMaintainabilityResults(results, threshold) {
|
|
4316
4434
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
4317
4435
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
4318
|
-
console.log(
|
|
4436
|
+
console.log(chalk50.green("All files pass maintainability threshold"));
|
|
4319
4437
|
} else {
|
|
4320
4438
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
4321
|
-
const color = threshold !== void 0 ?
|
|
4439
|
+
const color = threshold !== void 0 ? chalk50.red : chalk50.white;
|
|
4322
4440
|
console.log(
|
|
4323
|
-
`${color(file)} \u2192 avg: ${
|
|
4441
|
+
`${color(file)} \u2192 avg: ${chalk50.cyan(avgMaintainability.toFixed(1))}, min: ${chalk50.yellow(minMaintainability.toFixed(1))}`
|
|
4324
4442
|
);
|
|
4325
4443
|
}
|
|
4326
4444
|
}
|
|
4327
|
-
console.log(
|
|
4445
|
+
console.log(chalk50.dim(`
|
|
4328
4446
|
Analyzed ${results.length} files`));
|
|
4329
4447
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
4330
4448
|
console.error(
|
|
4331
|
-
|
|
4449
|
+
chalk50.red(
|
|
4332
4450
|
`
|
|
4333
4451
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
4334
4452
|
|
|
4335
|
-
\u26A0\uFE0F ${
|
|
4453
|
+
\u26A0\uFE0F ${chalk50.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.`
|
|
4336
4454
|
)
|
|
4337
4455
|
);
|
|
4338
4456
|
process.exit(1);
|
|
@@ -4389,7 +4507,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4389
4507
|
|
|
4390
4508
|
// src/commands/complexity/sloc.ts
|
|
4391
4509
|
import fs14 from "fs";
|
|
4392
|
-
import
|
|
4510
|
+
import chalk51 from "chalk";
|
|
4393
4511
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
4394
4512
|
withSourceFiles(pattern2, (files) => {
|
|
4395
4513
|
const results = [];
|
|
@@ -4405,12 +4523,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4405
4523
|
results.sort((a, b) => b.lines - a.lines);
|
|
4406
4524
|
for (const { file, lines } of results) {
|
|
4407
4525
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
4408
|
-
const color = exceedsThreshold ?
|
|
4409
|
-
console.log(`${color(file)} \u2192 ${
|
|
4526
|
+
const color = exceedsThreshold ? chalk51.red : chalk51.white;
|
|
4527
|
+
console.log(`${color(file)} \u2192 ${chalk51.cyan(lines)} lines`);
|
|
4410
4528
|
}
|
|
4411
4529
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
4412
4530
|
console.log(
|
|
4413
|
-
|
|
4531
|
+
chalk51.dim(`
|
|
4414
4532
|
Total: ${total} lines across ${files.length} files`)
|
|
4415
4533
|
);
|
|
4416
4534
|
if (hasViolation) {
|
|
@@ -4424,21 +4542,21 @@ async function analyze(pattern2) {
|
|
|
4424
4542
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
4425
4543
|
const files = findSourceFiles2(searchPattern);
|
|
4426
4544
|
if (files.length === 0) {
|
|
4427
|
-
console.log(
|
|
4545
|
+
console.log(chalk52.yellow("No files found matching pattern"));
|
|
4428
4546
|
return;
|
|
4429
4547
|
}
|
|
4430
4548
|
if (files.length === 1) {
|
|
4431
4549
|
const file = files[0];
|
|
4432
|
-
console.log(
|
|
4550
|
+
console.log(chalk52.bold.underline("SLOC"));
|
|
4433
4551
|
await sloc(file);
|
|
4434
4552
|
console.log();
|
|
4435
|
-
console.log(
|
|
4553
|
+
console.log(chalk52.bold.underline("Cyclomatic Complexity"));
|
|
4436
4554
|
await cyclomatic(file);
|
|
4437
4555
|
console.log();
|
|
4438
|
-
console.log(
|
|
4556
|
+
console.log(chalk52.bold.underline("Halstead Metrics"));
|
|
4439
4557
|
await halstead(file);
|
|
4440
4558
|
console.log();
|
|
4441
|
-
console.log(
|
|
4559
|
+
console.log(chalk52.bold.underline("Maintainability Index"));
|
|
4442
4560
|
await maintainability(file);
|
|
4443
4561
|
return;
|
|
4444
4562
|
}
|
|
@@ -4466,7 +4584,7 @@ function registerComplexity(program2) {
|
|
|
4466
4584
|
|
|
4467
4585
|
// src/commands/deploy/redirect.ts
|
|
4468
4586
|
import { existsSync as existsSync21, readFileSync as readFileSync16, writeFileSync as writeFileSync16 } from "fs";
|
|
4469
|
-
import
|
|
4587
|
+
import chalk53 from "chalk";
|
|
4470
4588
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
4471
4589
|
if (!window.location.pathname.endsWith('/')) {
|
|
4472
4590
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -4475,22 +4593,22 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
4475
4593
|
function redirect() {
|
|
4476
4594
|
const indexPath = "index.html";
|
|
4477
4595
|
if (!existsSync21(indexPath)) {
|
|
4478
|
-
console.log(
|
|
4596
|
+
console.log(chalk53.yellow("No index.html found"));
|
|
4479
4597
|
return;
|
|
4480
4598
|
}
|
|
4481
4599
|
const content = readFileSync16(indexPath, "utf-8");
|
|
4482
4600
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
4483
|
-
console.log(
|
|
4601
|
+
console.log(chalk53.dim("Trailing slash script already present"));
|
|
4484
4602
|
return;
|
|
4485
4603
|
}
|
|
4486
4604
|
const headCloseIndex = content.indexOf("</head>");
|
|
4487
4605
|
if (headCloseIndex === -1) {
|
|
4488
|
-
console.log(
|
|
4606
|
+
console.log(chalk53.red("Could not find </head> tag in index.html"));
|
|
4489
4607
|
return;
|
|
4490
4608
|
}
|
|
4491
4609
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
4492
4610
|
writeFileSync16(indexPath, newContent);
|
|
4493
|
-
console.log(
|
|
4611
|
+
console.log(chalk53.green("Added trailing slash redirect to index.html"));
|
|
4494
4612
|
}
|
|
4495
4613
|
|
|
4496
4614
|
// src/commands/registerDeploy.ts
|
|
@@ -4517,7 +4635,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
4517
4635
|
|
|
4518
4636
|
// src/commands/devlog/shared.ts
|
|
4519
4637
|
import { execSync as execSync17 } from "child_process";
|
|
4520
|
-
import
|
|
4638
|
+
import chalk54 from "chalk";
|
|
4521
4639
|
|
|
4522
4640
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
4523
4641
|
import { readdirSync, readFileSync as readFileSync17 } from "fs";
|
|
@@ -4604,13 +4722,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
4604
4722
|
}
|
|
4605
4723
|
function printCommitsWithFiles(commits, ignore2, verbose) {
|
|
4606
4724
|
for (const commit2 of commits) {
|
|
4607
|
-
console.log(` ${
|
|
4725
|
+
console.log(` ${chalk54.yellow(commit2.hash)} ${commit2.message}`);
|
|
4608
4726
|
if (verbose) {
|
|
4609
4727
|
const visibleFiles = commit2.files.filter(
|
|
4610
4728
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
4611
4729
|
);
|
|
4612
4730
|
for (const file of visibleFiles) {
|
|
4613
|
-
console.log(` ${
|
|
4731
|
+
console.log(` ${chalk54.dim(file)}`);
|
|
4614
4732
|
}
|
|
4615
4733
|
}
|
|
4616
4734
|
}
|
|
@@ -4635,15 +4753,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
4635
4753
|
}
|
|
4636
4754
|
|
|
4637
4755
|
// src/commands/devlog/list/printDateHeader.ts
|
|
4638
|
-
import
|
|
4756
|
+
import chalk55 from "chalk";
|
|
4639
4757
|
function printDateHeader(date, isSkipped, entries) {
|
|
4640
4758
|
if (isSkipped) {
|
|
4641
|
-
console.log(`${
|
|
4759
|
+
console.log(`${chalk55.bold.blue(date)} ${chalk55.dim("skipped")}`);
|
|
4642
4760
|
} else if (entries && entries.length > 0) {
|
|
4643
|
-
const entryInfo = entries.map((e) => `${
|
|
4644
|
-
console.log(`${
|
|
4761
|
+
const entryInfo = entries.map((e) => `${chalk55.green(e.version)} ${e.title}`).join(" | ");
|
|
4762
|
+
console.log(`${chalk55.bold.blue(date)} ${entryInfo}`);
|
|
4645
4763
|
} else {
|
|
4646
|
-
console.log(`${
|
|
4764
|
+
console.log(`${chalk55.bold.blue(date)} ${chalk55.red("\u26A0 devlog missing")}`);
|
|
4647
4765
|
}
|
|
4648
4766
|
}
|
|
4649
4767
|
|
|
@@ -4746,24 +4864,24 @@ function bumpVersion(version2, type) {
|
|
|
4746
4864
|
|
|
4747
4865
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
4748
4866
|
import { execSync as execSync20 } from "child_process";
|
|
4749
|
-
import
|
|
4867
|
+
import chalk57 from "chalk";
|
|
4750
4868
|
|
|
4751
4869
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
4752
|
-
import
|
|
4870
|
+
import chalk56 from "chalk";
|
|
4753
4871
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
4754
4872
|
if (conventional && firstHash) {
|
|
4755
4873
|
const version2 = getVersionAtCommit(firstHash);
|
|
4756
4874
|
if (version2) {
|
|
4757
|
-
console.log(`${
|
|
4875
|
+
console.log(`${chalk56.bold("version:")} ${stripToMinor(version2)}`);
|
|
4758
4876
|
} else {
|
|
4759
|
-
console.log(`${
|
|
4877
|
+
console.log(`${chalk56.bold("version:")} ${chalk56.red("unknown")}`);
|
|
4760
4878
|
}
|
|
4761
4879
|
} else if (patchVersion && minorVersion) {
|
|
4762
4880
|
console.log(
|
|
4763
|
-
`${
|
|
4881
|
+
`${chalk56.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
4764
4882
|
);
|
|
4765
4883
|
} else {
|
|
4766
|
-
console.log(`${
|
|
4884
|
+
console.log(`${chalk56.bold("version:")} v0.1 (initial)`);
|
|
4767
4885
|
}
|
|
4768
4886
|
}
|
|
4769
4887
|
|
|
@@ -4810,16 +4928,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
4810
4928
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
4811
4929
|
}
|
|
4812
4930
|
function logName(repoName) {
|
|
4813
|
-
console.log(`${
|
|
4931
|
+
console.log(`${chalk57.bold("name:")} ${repoName}`);
|
|
4814
4932
|
}
|
|
4815
4933
|
function displayNextEntry(ctx, targetDate, commits) {
|
|
4816
4934
|
logName(ctx.repoName);
|
|
4817
4935
|
printVersionInfo(ctx.config, ctx.lastInfo, commits[0]?.hash);
|
|
4818
|
-
console.log(
|
|
4936
|
+
console.log(chalk57.bold.blue(targetDate));
|
|
4819
4937
|
printCommitsWithFiles(commits, ctx.ignore, ctx.verbose);
|
|
4820
4938
|
}
|
|
4821
4939
|
function logNoCommits(lastInfo) {
|
|
4822
|
-
console.log(
|
|
4940
|
+
console.log(chalk57.dim(noCommitsMessage(!!lastInfo)));
|
|
4823
4941
|
}
|
|
4824
4942
|
|
|
4825
4943
|
// src/commands/devlog/next/index.ts
|
|
@@ -4860,11 +4978,11 @@ function next2(options2) {
|
|
|
4860
4978
|
import { execSync as execSync21 } from "child_process";
|
|
4861
4979
|
|
|
4862
4980
|
// src/commands/devlog/repos/printReposTable.ts
|
|
4863
|
-
import
|
|
4981
|
+
import chalk58 from "chalk";
|
|
4864
4982
|
function colorStatus(status2) {
|
|
4865
|
-
if (status2 === "missing") return
|
|
4866
|
-
if (status2 === "outdated") return
|
|
4867
|
-
return
|
|
4983
|
+
if (status2 === "missing") return chalk58.red(status2);
|
|
4984
|
+
if (status2 === "outdated") return chalk58.yellow(status2);
|
|
4985
|
+
return chalk58.green(status2);
|
|
4868
4986
|
}
|
|
4869
4987
|
function formatRow(row, nameWidth) {
|
|
4870
4988
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -4878,8 +4996,8 @@ function printReposTable(rows) {
|
|
|
4878
4996
|
"Last Devlog".padEnd(11),
|
|
4879
4997
|
"Status"
|
|
4880
4998
|
].join(" ");
|
|
4881
|
-
console.log(
|
|
4882
|
-
console.log(
|
|
4999
|
+
console.log(chalk58.dim(header));
|
|
5000
|
+
console.log(chalk58.dim("-".repeat(header.length)));
|
|
4883
5001
|
for (const row of rows) {
|
|
4884
5002
|
console.log(formatRow(row, nameWidth));
|
|
4885
5003
|
}
|
|
@@ -4937,14 +5055,14 @@ function repos(options2) {
|
|
|
4937
5055
|
// src/commands/devlog/skip.ts
|
|
4938
5056
|
import { writeFileSync as writeFileSync17 } from "fs";
|
|
4939
5057
|
import { join as join16 } from "path";
|
|
4940
|
-
import
|
|
5058
|
+
import chalk59 from "chalk";
|
|
4941
5059
|
import { stringify as stringifyYaml4 } from "yaml";
|
|
4942
5060
|
function getBlogConfigPath() {
|
|
4943
5061
|
return join16(BLOG_REPO_ROOT, "assist.yml");
|
|
4944
5062
|
}
|
|
4945
5063
|
function skip(date) {
|
|
4946
5064
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
4947
|
-
console.log(
|
|
5065
|
+
console.log(chalk59.red("Invalid date format. Use YYYY-MM-DD"));
|
|
4948
5066
|
process.exit(1);
|
|
4949
5067
|
}
|
|
4950
5068
|
const repoName = getRepoName();
|
|
@@ -4955,7 +5073,7 @@ function skip(date) {
|
|
|
4955
5073
|
const skipDays = skip2[repoName] ?? [];
|
|
4956
5074
|
if (skipDays.includes(date)) {
|
|
4957
5075
|
console.log(
|
|
4958
|
-
|
|
5076
|
+
chalk59.yellow(`${date} is already in skip list for ${repoName}`)
|
|
4959
5077
|
);
|
|
4960
5078
|
return;
|
|
4961
5079
|
}
|
|
@@ -4965,20 +5083,20 @@ function skip(date) {
|
|
|
4965
5083
|
devlog.skip = skip2;
|
|
4966
5084
|
config.devlog = devlog;
|
|
4967
5085
|
writeFileSync17(configPath, stringifyYaml4(config, { lineWidth: 0 }));
|
|
4968
|
-
console.log(
|
|
5086
|
+
console.log(chalk59.green(`Added ${date} to skip list for ${repoName}`));
|
|
4969
5087
|
}
|
|
4970
5088
|
|
|
4971
5089
|
// src/commands/devlog/version.ts
|
|
4972
|
-
import
|
|
5090
|
+
import chalk60 from "chalk";
|
|
4973
5091
|
function version() {
|
|
4974
5092
|
const config = loadConfig();
|
|
4975
5093
|
const name = getRepoName();
|
|
4976
5094
|
const lastInfo = getLastVersionInfo(name, config);
|
|
4977
5095
|
const lastVersion = lastInfo?.version ?? null;
|
|
4978
5096
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
4979
|
-
console.log(`${
|
|
4980
|
-
console.log(`${
|
|
4981
|
-
console.log(`${
|
|
5097
|
+
console.log(`${chalk60.bold("name:")} ${name}`);
|
|
5098
|
+
console.log(`${chalk60.bold("last:")} ${lastVersion ?? chalk60.dim("none")}`);
|
|
5099
|
+
console.log(`${chalk60.bold("next:")} ${nextVersion ?? chalk60.dim("none")}`);
|
|
4982
5100
|
}
|
|
4983
5101
|
|
|
4984
5102
|
// src/commands/registerDevlog.ts
|
|
@@ -5002,7 +5120,7 @@ function registerDevlog(program2) {
|
|
|
5002
5120
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
5003
5121
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
5004
5122
|
import { join as join17 } from "path";
|
|
5005
|
-
import
|
|
5123
|
+
import chalk61 from "chalk";
|
|
5006
5124
|
|
|
5007
5125
|
// src/shared/findRepoRoot.ts
|
|
5008
5126
|
import { existsSync as existsSync22 } from "fs";
|
|
@@ -5065,14 +5183,14 @@ function checkBuildLocks(startDir) {
|
|
|
5065
5183
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
5066
5184
|
if (locked) {
|
|
5067
5185
|
console.error(
|
|
5068
|
-
|
|
5186
|
+
chalk61.red("Build output locked (is VS debugging?): ") + locked
|
|
5069
5187
|
);
|
|
5070
5188
|
process.exit(1);
|
|
5071
5189
|
}
|
|
5072
5190
|
}
|
|
5073
5191
|
async function checkBuildLocksCommand() {
|
|
5074
5192
|
checkBuildLocks();
|
|
5075
|
-
console.log(
|
|
5193
|
+
console.log(chalk61.green("No build locks detected"));
|
|
5076
5194
|
}
|
|
5077
5195
|
|
|
5078
5196
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -5171,30 +5289,30 @@ function escapeRegex(s) {
|
|
|
5171
5289
|
}
|
|
5172
5290
|
|
|
5173
5291
|
// src/commands/dotnet/printTree.ts
|
|
5174
|
-
import
|
|
5292
|
+
import chalk62 from "chalk";
|
|
5175
5293
|
function printNodes(nodes, prefix2) {
|
|
5176
5294
|
for (let i = 0; i < nodes.length; i++) {
|
|
5177
5295
|
const isLast = i === nodes.length - 1;
|
|
5178
5296
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
5179
5297
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
5180
5298
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
5181
|
-
const label2 = isMissing ?
|
|
5299
|
+
const label2 = isMissing ? chalk62.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
5182
5300
|
console.log(`${prefix2}${connector}${label2}`);
|
|
5183
5301
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
5184
5302
|
}
|
|
5185
5303
|
}
|
|
5186
5304
|
function printTree(tree, totalCount, solutions) {
|
|
5187
|
-
console.log(
|
|
5188
|
-
console.log(
|
|
5305
|
+
console.log(chalk62.bold("\nProject Dependency Tree"));
|
|
5306
|
+
console.log(chalk62.cyan(tree.relativePath));
|
|
5189
5307
|
printNodes(tree.children, "");
|
|
5190
|
-
console.log(
|
|
5308
|
+
console.log(chalk62.dim(`
|
|
5191
5309
|
${totalCount} projects total (including root)`));
|
|
5192
|
-
console.log(
|
|
5310
|
+
console.log(chalk62.bold("\nSolution Membership"));
|
|
5193
5311
|
if (solutions.length === 0) {
|
|
5194
|
-
console.log(
|
|
5312
|
+
console.log(chalk62.yellow(" Not found in any .sln"));
|
|
5195
5313
|
} else {
|
|
5196
5314
|
for (const sln of solutions) {
|
|
5197
|
-
console.log(` ${
|
|
5315
|
+
console.log(` ${chalk62.green(sln)}`);
|
|
5198
5316
|
}
|
|
5199
5317
|
}
|
|
5200
5318
|
console.log();
|
|
@@ -5223,16 +5341,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
5223
5341
|
// src/commands/dotnet/resolveCsproj.ts
|
|
5224
5342
|
import { existsSync as existsSync23 } from "fs";
|
|
5225
5343
|
import path24 from "path";
|
|
5226
|
-
import
|
|
5344
|
+
import chalk63 from "chalk";
|
|
5227
5345
|
function resolveCsproj(csprojPath) {
|
|
5228
5346
|
const resolved = path24.resolve(csprojPath);
|
|
5229
5347
|
if (!existsSync23(resolved)) {
|
|
5230
|
-
console.error(
|
|
5348
|
+
console.error(chalk63.red(`File not found: ${resolved}`));
|
|
5231
5349
|
process.exit(1);
|
|
5232
5350
|
}
|
|
5233
5351
|
const repoRoot = findRepoRoot(path24.dirname(resolved));
|
|
5234
5352
|
if (!repoRoot) {
|
|
5235
|
-
console.error(
|
|
5353
|
+
console.error(chalk63.red("Could not find git repository root"));
|
|
5236
5354
|
process.exit(1);
|
|
5237
5355
|
}
|
|
5238
5356
|
return { resolved, repoRoot };
|
|
@@ -5282,12 +5400,12 @@ function getChangedCsFiles(scope) {
|
|
|
5282
5400
|
}
|
|
5283
5401
|
|
|
5284
5402
|
// src/commands/dotnet/inSln.ts
|
|
5285
|
-
import
|
|
5403
|
+
import chalk64 from "chalk";
|
|
5286
5404
|
async function inSln(csprojPath) {
|
|
5287
5405
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
5288
5406
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
5289
5407
|
if (solutions.length === 0) {
|
|
5290
|
-
console.log(
|
|
5408
|
+
console.log(chalk64.yellow("Not found in any .sln file"));
|
|
5291
5409
|
process.exit(1);
|
|
5292
5410
|
}
|
|
5293
5411
|
for (const sln of solutions) {
|
|
@@ -5296,7 +5414,7 @@ async function inSln(csprojPath) {
|
|
|
5296
5414
|
}
|
|
5297
5415
|
|
|
5298
5416
|
// src/commands/dotnet/inspect.ts
|
|
5299
|
-
import
|
|
5417
|
+
import chalk70 from "chalk";
|
|
5300
5418
|
|
|
5301
5419
|
// src/shared/formatElapsed.ts
|
|
5302
5420
|
function formatElapsed(ms) {
|
|
@@ -5308,12 +5426,12 @@ function formatElapsed(ms) {
|
|
|
5308
5426
|
}
|
|
5309
5427
|
|
|
5310
5428
|
// src/commands/dotnet/displayIssues.ts
|
|
5311
|
-
import
|
|
5429
|
+
import chalk65 from "chalk";
|
|
5312
5430
|
var SEVERITY_COLOR = {
|
|
5313
|
-
ERROR:
|
|
5314
|
-
WARNING:
|
|
5315
|
-
SUGGESTION:
|
|
5316
|
-
HINT:
|
|
5431
|
+
ERROR: chalk65.red,
|
|
5432
|
+
WARNING: chalk65.yellow,
|
|
5433
|
+
SUGGESTION: chalk65.cyan,
|
|
5434
|
+
HINT: chalk65.dim
|
|
5317
5435
|
};
|
|
5318
5436
|
function groupByFile(issues) {
|
|
5319
5437
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -5329,15 +5447,15 @@ function groupByFile(issues) {
|
|
|
5329
5447
|
}
|
|
5330
5448
|
function displayIssues(issues) {
|
|
5331
5449
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
5332
|
-
console.log(
|
|
5450
|
+
console.log(chalk65.bold(file));
|
|
5333
5451
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
5334
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
5452
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk65.white;
|
|
5335
5453
|
console.log(
|
|
5336
|
-
` ${
|
|
5454
|
+
` ${chalk65.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
5337
5455
|
);
|
|
5338
5456
|
}
|
|
5339
5457
|
}
|
|
5340
|
-
console.log(
|
|
5458
|
+
console.log(chalk65.dim(`
|
|
5341
5459
|
${issues.length} issue(s) found`));
|
|
5342
5460
|
}
|
|
5343
5461
|
|
|
@@ -5396,12 +5514,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
5396
5514
|
// src/commands/dotnet/resolveSolution.ts
|
|
5397
5515
|
import { existsSync as existsSync24 } from "fs";
|
|
5398
5516
|
import path25 from "path";
|
|
5399
|
-
import
|
|
5517
|
+
import chalk67 from "chalk";
|
|
5400
5518
|
|
|
5401
5519
|
// src/commands/dotnet/findSolution.ts
|
|
5402
5520
|
import { readdirSync as readdirSync4 } from "fs";
|
|
5403
5521
|
import { dirname as dirname16, join as join18 } from "path";
|
|
5404
|
-
import
|
|
5522
|
+
import chalk66 from "chalk";
|
|
5405
5523
|
function findSlnInDir(dir) {
|
|
5406
5524
|
try {
|
|
5407
5525
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join18(dir, f));
|
|
@@ -5417,17 +5535,17 @@ function findSolution() {
|
|
|
5417
5535
|
const slnFiles = findSlnInDir(current);
|
|
5418
5536
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
5419
5537
|
if (slnFiles.length > 1) {
|
|
5420
|
-
console.error(
|
|
5538
|
+
console.error(chalk66.red(`Multiple .sln files found in ${current}:`));
|
|
5421
5539
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
5422
5540
|
console.error(
|
|
5423
|
-
|
|
5541
|
+
chalk66.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
5424
5542
|
);
|
|
5425
5543
|
process.exit(1);
|
|
5426
5544
|
}
|
|
5427
5545
|
if (current === ceiling) break;
|
|
5428
5546
|
current = dirname16(current);
|
|
5429
5547
|
}
|
|
5430
|
-
console.error(
|
|
5548
|
+
console.error(chalk66.red("No .sln file found between cwd and repo root"));
|
|
5431
5549
|
process.exit(1);
|
|
5432
5550
|
}
|
|
5433
5551
|
|
|
@@ -5436,7 +5554,7 @@ function resolveSolution(sln) {
|
|
|
5436
5554
|
if (sln) {
|
|
5437
5555
|
const resolved = path25.resolve(sln);
|
|
5438
5556
|
if (!existsSync24(resolved)) {
|
|
5439
|
-
console.error(
|
|
5557
|
+
console.error(chalk67.red(`Solution file not found: ${resolved}`));
|
|
5440
5558
|
process.exit(1);
|
|
5441
5559
|
}
|
|
5442
5560
|
return resolved;
|
|
@@ -5478,14 +5596,14 @@ import { execSync as execSync23 } from "child_process";
|
|
|
5478
5596
|
import { existsSync as existsSync25, readFileSync as readFileSync20, unlinkSync as unlinkSync4 } from "fs";
|
|
5479
5597
|
import { tmpdir as tmpdir2 } from "os";
|
|
5480
5598
|
import path26 from "path";
|
|
5481
|
-
import
|
|
5599
|
+
import chalk68 from "chalk";
|
|
5482
5600
|
function assertJbInstalled() {
|
|
5483
5601
|
try {
|
|
5484
5602
|
execSync23("jb inspectcode --version", { stdio: "pipe" });
|
|
5485
5603
|
} catch {
|
|
5486
|
-
console.error(
|
|
5604
|
+
console.error(chalk68.red("jb is not installed. Install with:"));
|
|
5487
5605
|
console.error(
|
|
5488
|
-
|
|
5606
|
+
chalk68.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
5489
5607
|
);
|
|
5490
5608
|
process.exit(1);
|
|
5491
5609
|
}
|
|
@@ -5503,11 +5621,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
5503
5621
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
5504
5622
|
process.stderr.write(err.stderr);
|
|
5505
5623
|
}
|
|
5506
|
-
console.error(
|
|
5624
|
+
console.error(chalk68.red("jb inspectcode failed"));
|
|
5507
5625
|
process.exit(1);
|
|
5508
5626
|
}
|
|
5509
5627
|
if (!existsSync25(reportPath)) {
|
|
5510
|
-
console.error(
|
|
5628
|
+
console.error(chalk68.red("Report file not generated"));
|
|
5511
5629
|
process.exit(1);
|
|
5512
5630
|
}
|
|
5513
5631
|
const xml = readFileSync20(reportPath, "utf-8");
|
|
@@ -5517,7 +5635,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
5517
5635
|
|
|
5518
5636
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
5519
5637
|
import { execSync as execSync24 } from "child_process";
|
|
5520
|
-
import
|
|
5638
|
+
import chalk69 from "chalk";
|
|
5521
5639
|
function resolveMsbuildPath() {
|
|
5522
5640
|
const config = loadConfig();
|
|
5523
5641
|
const buildConfig = config.run?.find((r) => r.name === "build");
|
|
@@ -5528,9 +5646,9 @@ function assertMsbuildInstalled() {
|
|
|
5528
5646
|
try {
|
|
5529
5647
|
execSync24(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
5530
5648
|
} catch {
|
|
5531
|
-
console.error(
|
|
5649
|
+
console.error(chalk69.red(`msbuild not found at: ${msbuild}`));
|
|
5532
5650
|
console.error(
|
|
5533
|
-
|
|
5651
|
+
chalk69.yellow(
|
|
5534
5652
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
5535
5653
|
)
|
|
5536
5654
|
);
|
|
@@ -5577,17 +5695,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
5577
5695
|
// src/commands/dotnet/inspect.ts
|
|
5578
5696
|
function logScope(changedFiles) {
|
|
5579
5697
|
if (changedFiles === null) {
|
|
5580
|
-
console.log(
|
|
5698
|
+
console.log(chalk70.dim("Inspecting full solution..."));
|
|
5581
5699
|
} else {
|
|
5582
5700
|
console.log(
|
|
5583
|
-
|
|
5701
|
+
chalk70.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
5584
5702
|
);
|
|
5585
5703
|
}
|
|
5586
5704
|
}
|
|
5587
5705
|
function reportResults(issues, elapsed) {
|
|
5588
5706
|
if (issues.length > 0) displayIssues(issues);
|
|
5589
|
-
else console.log(
|
|
5590
|
-
console.log(
|
|
5707
|
+
else console.log(chalk70.green("No issues found"));
|
|
5708
|
+
console.log(chalk70.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
5591
5709
|
if (issues.length > 0) process.exit(1);
|
|
5592
5710
|
}
|
|
5593
5711
|
async function inspect(sln, options2) {
|
|
@@ -5598,7 +5716,7 @@ async function inspect(sln, options2) {
|
|
|
5598
5716
|
const scope = parseScope(options2.scope);
|
|
5599
5717
|
const changedFiles = getChangedCsFiles(scope);
|
|
5600
5718
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
5601
|
-
console.log(
|
|
5719
|
+
console.log(chalk70.green("No changed .cs files found"));
|
|
5602
5720
|
return;
|
|
5603
5721
|
}
|
|
5604
5722
|
logScope(changedFiles);
|
|
@@ -5624,7 +5742,7 @@ function registerDotnet(program2) {
|
|
|
5624
5742
|
}
|
|
5625
5743
|
|
|
5626
5744
|
// src/commands/jira/acceptanceCriteria.ts
|
|
5627
|
-
import
|
|
5745
|
+
import chalk72 from "chalk";
|
|
5628
5746
|
|
|
5629
5747
|
// src/commands/jira/adfToText.ts
|
|
5630
5748
|
function renderInline(node) {
|
|
@@ -5685,7 +5803,7 @@ function adfToText(doc) {
|
|
|
5685
5803
|
|
|
5686
5804
|
// src/commands/jira/fetchIssue.ts
|
|
5687
5805
|
import { execSync as execSync25 } from "child_process";
|
|
5688
|
-
import
|
|
5806
|
+
import chalk71 from "chalk";
|
|
5689
5807
|
function fetchIssue(issueKey, fields) {
|
|
5690
5808
|
let result;
|
|
5691
5809
|
try {
|
|
@@ -5698,15 +5816,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
5698
5816
|
const stderr = error.stderr;
|
|
5699
5817
|
if (stderr.includes("unauthorized")) {
|
|
5700
5818
|
console.error(
|
|
5701
|
-
|
|
5819
|
+
chalk71.red("Jira authentication expired."),
|
|
5702
5820
|
"Run",
|
|
5703
|
-
|
|
5821
|
+
chalk71.cyan("assist jira auth"),
|
|
5704
5822
|
"to re-authenticate."
|
|
5705
5823
|
);
|
|
5706
5824
|
process.exit(1);
|
|
5707
5825
|
}
|
|
5708
5826
|
}
|
|
5709
|
-
console.error(
|
|
5827
|
+
console.error(chalk71.red(`Failed to fetch ${issueKey}.`));
|
|
5710
5828
|
process.exit(1);
|
|
5711
5829
|
}
|
|
5712
5830
|
return JSON.parse(result);
|
|
@@ -5720,7 +5838,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
5720
5838
|
const parsed = fetchIssue(issueKey, field);
|
|
5721
5839
|
const acValue = parsed?.fields?.[field];
|
|
5722
5840
|
if (!acValue) {
|
|
5723
|
-
console.log(
|
|
5841
|
+
console.log(chalk72.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
5724
5842
|
return;
|
|
5725
5843
|
}
|
|
5726
5844
|
if (typeof acValue === "string") {
|
|
@@ -5815,14 +5933,14 @@ async function jiraAuth() {
|
|
|
5815
5933
|
}
|
|
5816
5934
|
|
|
5817
5935
|
// src/commands/jira/viewIssue.ts
|
|
5818
|
-
import
|
|
5936
|
+
import chalk73 from "chalk";
|
|
5819
5937
|
function viewIssue(issueKey) {
|
|
5820
5938
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
5821
5939
|
const fields = parsed?.fields;
|
|
5822
5940
|
const summary = fields?.summary;
|
|
5823
5941
|
const description = fields?.description;
|
|
5824
5942
|
if (summary) {
|
|
5825
|
-
console.log(
|
|
5943
|
+
console.log(chalk73.bold(summary));
|
|
5826
5944
|
}
|
|
5827
5945
|
if (description) {
|
|
5828
5946
|
if (summary) console.log();
|
|
@@ -5836,7 +5954,7 @@ function viewIssue(issueKey) {
|
|
|
5836
5954
|
}
|
|
5837
5955
|
if (!summary && !description) {
|
|
5838
5956
|
console.log(
|
|
5839
|
-
|
|
5957
|
+
chalk73.yellow(`No summary or description found on ${issueKey}.`)
|
|
5840
5958
|
);
|
|
5841
5959
|
}
|
|
5842
5960
|
}
|
|
@@ -5850,7 +5968,7 @@ function registerJira(program2) {
|
|
|
5850
5968
|
}
|
|
5851
5969
|
|
|
5852
5970
|
// src/commands/news/add/index.ts
|
|
5853
|
-
import
|
|
5971
|
+
import chalk74 from "chalk";
|
|
5854
5972
|
import enquirer7 from "enquirer";
|
|
5855
5973
|
async function add2(url) {
|
|
5856
5974
|
if (!url) {
|
|
@@ -5873,17 +5991,17 @@ async function add2(url) {
|
|
|
5873
5991
|
const news = config.news ?? {};
|
|
5874
5992
|
const feeds = news.feeds ?? [];
|
|
5875
5993
|
if (feeds.includes(url)) {
|
|
5876
|
-
console.log(
|
|
5994
|
+
console.log(chalk74.yellow("Feed already exists in config"));
|
|
5877
5995
|
return;
|
|
5878
5996
|
}
|
|
5879
5997
|
feeds.push(url);
|
|
5880
5998
|
config.news = { ...news, feeds };
|
|
5881
5999
|
saveGlobalConfig(config);
|
|
5882
|
-
console.log(
|
|
6000
|
+
console.log(chalk74.green(`Added feed: ${url}`));
|
|
5883
6001
|
}
|
|
5884
6002
|
|
|
5885
6003
|
// src/commands/news/web/handleRequest.ts
|
|
5886
|
-
import
|
|
6004
|
+
import chalk75 from "chalk";
|
|
5887
6005
|
|
|
5888
6006
|
// src/commands/news/web/shared.ts
|
|
5889
6007
|
import { decodeHTML } from "entities";
|
|
@@ -6019,17 +6137,17 @@ function prefetch() {
|
|
|
6019
6137
|
const config = loadConfig();
|
|
6020
6138
|
const total = config.news.feeds.length;
|
|
6021
6139
|
if (total === 0) return;
|
|
6022
|
-
process.stdout.write(
|
|
6140
|
+
process.stdout.write(chalk75.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
6023
6141
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
6024
6142
|
const width = 20;
|
|
6025
6143
|
const filled = Math.round(done2 / t * width);
|
|
6026
6144
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
6027
6145
|
process.stdout.write(
|
|
6028
|
-
`\r${
|
|
6146
|
+
`\r${chalk75.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
6029
6147
|
);
|
|
6030
6148
|
}).then((items) => {
|
|
6031
6149
|
process.stdout.write(
|
|
6032
|
-
`\r${
|
|
6150
|
+
`\r${chalk75.green(`Fetched ${items.length} items from ${total} feed(s)`)}
|
|
6033
6151
|
`
|
|
6034
6152
|
);
|
|
6035
6153
|
cachedItems = items;
|
|
@@ -6144,7 +6262,7 @@ function validateLine(line) {
|
|
|
6144
6262
|
process.exit(1);
|
|
6145
6263
|
}
|
|
6146
6264
|
}
|
|
6147
|
-
function
|
|
6265
|
+
function comment2(path50, line, body) {
|
|
6148
6266
|
validateBody(body);
|
|
6149
6267
|
validateLine(line);
|
|
6150
6268
|
try {
|
|
@@ -6249,18 +6367,18 @@ function requireCache(prNumber) {
|
|
|
6249
6367
|
}
|
|
6250
6368
|
return cache;
|
|
6251
6369
|
}
|
|
6252
|
-
function findLineComment(
|
|
6253
|
-
return
|
|
6370
|
+
function findLineComment(comments2, commentId) {
|
|
6371
|
+
return comments2.find((c) => c.type === "line" && c.id === commentId);
|
|
6254
6372
|
}
|
|
6255
6373
|
function requireLineComment(cache, commentId) {
|
|
6256
|
-
const
|
|
6257
|
-
if (!
|
|
6374
|
+
const comment3 = findLineComment(cache.comments, commentId);
|
|
6375
|
+
if (!comment3 || comment3.type !== "line" || !comment3.threadId) {
|
|
6258
6376
|
console.error(
|
|
6259
6377
|
`Error: Comment #${commentId} not found or has no thread ID.`
|
|
6260
6378
|
);
|
|
6261
6379
|
process.exit(1);
|
|
6262
6380
|
}
|
|
6263
|
-
return
|
|
6381
|
+
return comment3;
|
|
6264
6382
|
}
|
|
6265
6383
|
function cleanupCacheIfDone(cache, prNumber, commentId) {
|
|
6266
6384
|
const hasRemaining = cache.comments.some(
|
|
@@ -6272,10 +6390,10 @@ function resolveCommentWithReply(commentId, message) {
|
|
|
6272
6390
|
const prNumber = getCurrentPrNumber();
|
|
6273
6391
|
const { org, repo } = getRepoInfo();
|
|
6274
6392
|
const cache = requireCache(prNumber);
|
|
6275
|
-
const
|
|
6393
|
+
const comment3 = requireLineComment(cache, commentId);
|
|
6276
6394
|
replyToComment(org, repo, prNumber, commentId, message);
|
|
6277
6395
|
console.log("Reply posted successfully.");
|
|
6278
|
-
resolveThread(
|
|
6396
|
+
resolveThread(comment3.threadId);
|
|
6279
6397
|
console.log("Thread resolved successfully.");
|
|
6280
6398
|
cleanupCacheIfDone(cache, prNumber, commentId);
|
|
6281
6399
|
}
|
|
@@ -6335,8 +6453,8 @@ function fetchThreadIds(org, repo, prNumber) {
|
|
|
6335
6453
|
if (thread.isResolved) {
|
|
6336
6454
|
resolvedThreadIds.add(thread.id);
|
|
6337
6455
|
}
|
|
6338
|
-
for (const
|
|
6339
|
-
threadMap.set(
|
|
6456
|
+
for (const comment3 of thread.comments.nodes) {
|
|
6457
|
+
threadMap.set(comment3.databaseId, thread.id);
|
|
6340
6458
|
}
|
|
6341
6459
|
}
|
|
6342
6460
|
return { threadMap, resolvedThreadIds };
|
|
@@ -6383,58 +6501,58 @@ function mapLineComment(c, threadInfo) {
|
|
|
6383
6501
|
};
|
|
6384
6502
|
}
|
|
6385
6503
|
function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
6386
|
-
const
|
|
6387
|
-
return
|
|
6504
|
+
const comments2 = fetchJson(`repos/${org}/${repo}/pulls/${prNumber}/comments`);
|
|
6505
|
+
return comments2.map(
|
|
6388
6506
|
(c) => mapLineComment(c, threadInfo)
|
|
6389
6507
|
);
|
|
6390
6508
|
}
|
|
6391
6509
|
|
|
6392
6510
|
// src/commands/prs/listComments/printComments.ts
|
|
6393
|
-
import
|
|
6394
|
-
function formatForHuman(
|
|
6395
|
-
if (
|
|
6396
|
-
const stateColor =
|
|
6511
|
+
import chalk76 from "chalk";
|
|
6512
|
+
function formatForHuman(comment3) {
|
|
6513
|
+
if (comment3.type === "review") {
|
|
6514
|
+
const stateColor = comment3.state === "APPROVED" ? chalk76.green : comment3.state === "CHANGES_REQUESTED" ? chalk76.red : chalk76.yellow;
|
|
6397
6515
|
return [
|
|
6398
|
-
`${
|
|
6399
|
-
|
|
6516
|
+
`${chalk76.cyan("Review")} by ${chalk76.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
6517
|
+
comment3.body,
|
|
6400
6518
|
""
|
|
6401
6519
|
].join("\n");
|
|
6402
6520
|
}
|
|
6403
|
-
const location =
|
|
6521
|
+
const location = comment3.line ? `:${comment3.line}` : "";
|
|
6404
6522
|
return [
|
|
6405
|
-
`${
|
|
6406
|
-
|
|
6407
|
-
|
|
6523
|
+
`${chalk76.cyan("Line comment")} by ${chalk76.bold(comment3.user)} on ${chalk76.dim(`${comment3.path}${location}`)}`,
|
|
6524
|
+
chalk76.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
6525
|
+
comment3.body,
|
|
6408
6526
|
""
|
|
6409
6527
|
].join("\n");
|
|
6410
6528
|
}
|
|
6411
|
-
function summarise(
|
|
6412
|
-
const lineCount =
|
|
6413
|
-
const reviewCount =
|
|
6529
|
+
function summarise(comments2) {
|
|
6530
|
+
const lineCount = comments2.filter((c) => c.type === "line").length;
|
|
6531
|
+
const reviewCount = comments2.filter((c) => c.type === "review").length;
|
|
6414
6532
|
const parts = [];
|
|
6415
6533
|
if (lineCount > 0) parts.push(`${lineCount} line`);
|
|
6416
6534
|
if (reviewCount > 0) parts.push(`${reviewCount} review`);
|
|
6417
|
-
return `Found ${parts.join(" and ")} comment${
|
|
6535
|
+
return `Found ${parts.join(" and ")} comment${comments2.length === 1 ? "" : "s"}.`;
|
|
6418
6536
|
}
|
|
6419
|
-
function
|
|
6420
|
-
const { comments, cachePath } = result;
|
|
6421
|
-
if (
|
|
6537
|
+
function printComments2(result) {
|
|
6538
|
+
const { comments: comments2, cachePath } = result;
|
|
6539
|
+
if (comments2.length === 0) {
|
|
6422
6540
|
console.log("No comments found.");
|
|
6423
6541
|
return;
|
|
6424
6542
|
}
|
|
6425
6543
|
if (!isClaudeCode()) {
|
|
6426
|
-
for (const
|
|
6427
|
-
console.log(formatForHuman(
|
|
6544
|
+
for (const comment3 of comments2) {
|
|
6545
|
+
console.log(formatForHuman(comment3));
|
|
6428
6546
|
}
|
|
6429
6547
|
}
|
|
6430
|
-
console.log(summarise(
|
|
6548
|
+
console.log(summarise(comments2));
|
|
6431
6549
|
if (cachePath) {
|
|
6432
6550
|
console.log(`Saved to ${cachePath}`);
|
|
6433
6551
|
}
|
|
6434
6552
|
}
|
|
6435
6553
|
|
|
6436
6554
|
// src/commands/prs/listComments/index.ts
|
|
6437
|
-
function writeCommentsCache(prNumber,
|
|
6555
|
+
function writeCommentsCache(prNumber, comments2) {
|
|
6438
6556
|
const assistDir = join24(process.cwd(), ".assist");
|
|
6439
6557
|
if (!existsSync28(assistDir)) {
|
|
6440
6558
|
mkdirSync6(assistDir, { recursive: true });
|
|
@@ -6442,7 +6560,7 @@ function writeCommentsCache(prNumber, comments) {
|
|
|
6442
6560
|
const cacheData = {
|
|
6443
6561
|
prNumber,
|
|
6444
6562
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6445
|
-
comments
|
|
6563
|
+
comments: comments2
|
|
6446
6564
|
};
|
|
6447
6565
|
const cachePath = join24(assistDir, `pr-${prNumber}-comments.yaml`);
|
|
6448
6566
|
writeFileSync22(cachePath, stringify(cacheData));
|
|
@@ -6459,9 +6577,9 @@ function handleKnownErrors(error) {
|
|
|
6459
6577
|
}
|
|
6460
6578
|
return null;
|
|
6461
6579
|
}
|
|
6462
|
-
function updateCache(prNumber,
|
|
6463
|
-
if (
|
|
6464
|
-
writeCommentsCache(prNumber,
|
|
6580
|
+
function updateCache(prNumber, comments2) {
|
|
6581
|
+
if (comments2.some((c) => c.type === "line")) {
|
|
6582
|
+
writeCommentsCache(prNumber, comments2);
|
|
6465
6583
|
} else {
|
|
6466
6584
|
deleteCommentsCache(prNumber);
|
|
6467
6585
|
}
|
|
@@ -6493,13 +6611,13 @@ import { execSync as execSync32 } from "child_process";
|
|
|
6493
6611
|
import enquirer8 from "enquirer";
|
|
6494
6612
|
|
|
6495
6613
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
6496
|
-
import
|
|
6614
|
+
import chalk77 from "chalk";
|
|
6497
6615
|
var STATUS_MAP = {
|
|
6498
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
6499
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
6616
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk77.magenta("merged"), date: pr.mergedAt } : null,
|
|
6617
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk77.red("closed"), date: pr.closedAt } : null
|
|
6500
6618
|
};
|
|
6501
6619
|
function defaultStatus(pr) {
|
|
6502
|
-
return { label:
|
|
6620
|
+
return { label: chalk77.green("opened"), date: pr.createdAt };
|
|
6503
6621
|
}
|
|
6504
6622
|
function getStatus2(pr) {
|
|
6505
6623
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -6508,11 +6626,11 @@ function formatDate(dateStr) {
|
|
|
6508
6626
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
6509
6627
|
}
|
|
6510
6628
|
function formatPrHeader(pr, status2) {
|
|
6511
|
-
return `${
|
|
6629
|
+
return `${chalk77.cyan(`#${pr.number}`)} ${pr.title} ${chalk77.dim(`(${pr.author.login},`)} ${status2.label} ${chalk77.dim(`${formatDate(status2.date)})`)}`;
|
|
6512
6630
|
}
|
|
6513
6631
|
function logPrDetails(pr) {
|
|
6514
6632
|
console.log(
|
|
6515
|
-
|
|
6633
|
+
chalk77.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
6516
6634
|
);
|
|
6517
6635
|
console.log();
|
|
6518
6636
|
}
|
|
@@ -6664,7 +6782,7 @@ function wontfix(commentId, reason) {
|
|
|
6664
6782
|
function registerPrs(program2) {
|
|
6665
6783
|
const prsCommand = program2.command("prs").description("Pull request utilities").option("--open", "List only open pull requests").option("--closed", "List only closed pull requests").action(prs);
|
|
6666
6784
|
prsCommand.command("list-comments").description("List all comments on the current branch's pull request").action(() => {
|
|
6667
|
-
listComments().then(
|
|
6785
|
+
listComments().then(printComments2);
|
|
6668
6786
|
});
|
|
6669
6787
|
prsCommand.command("fixed <comment-id> <sha>").description("Reply with commit link and resolve thread").action((commentId, sha) => {
|
|
6670
6788
|
fixed(Number.parseInt(commentId, 10), sha);
|
|
@@ -6673,15 +6791,15 @@ function registerPrs(program2) {
|
|
|
6673
6791
|
wontfix(Number.parseInt(commentId, 10), reason);
|
|
6674
6792
|
});
|
|
6675
6793
|
prsCommand.command("comment <path> <line> <body>").description("Add a line comment to the pending review").action((path50, line, body) => {
|
|
6676
|
-
|
|
6794
|
+
comment2(path50, Number.parseInt(line, 10), body);
|
|
6677
6795
|
});
|
|
6678
6796
|
}
|
|
6679
6797
|
|
|
6680
6798
|
// src/commands/ravendb/ravendbAuth.ts
|
|
6681
|
-
import
|
|
6799
|
+
import chalk83 from "chalk";
|
|
6682
6800
|
|
|
6683
6801
|
// src/shared/createConnectionAuth.ts
|
|
6684
|
-
import
|
|
6802
|
+
import chalk78 from "chalk";
|
|
6685
6803
|
function listConnections(connections, format2) {
|
|
6686
6804
|
if (connections.length === 0) {
|
|
6687
6805
|
console.log("No connections configured.");
|
|
@@ -6694,7 +6812,7 @@ function listConnections(connections, format2) {
|
|
|
6694
6812
|
function removeConnection(connections, name, save) {
|
|
6695
6813
|
const filtered = connections.filter((c) => c.name !== name);
|
|
6696
6814
|
if (filtered.length === connections.length) {
|
|
6697
|
-
console.error(
|
|
6815
|
+
console.error(chalk78.red(`Connection "${name}" not found.`));
|
|
6698
6816
|
process.exit(1);
|
|
6699
6817
|
}
|
|
6700
6818
|
save(filtered);
|
|
@@ -6740,15 +6858,15 @@ function saveConnections(connections) {
|
|
|
6740
6858
|
}
|
|
6741
6859
|
|
|
6742
6860
|
// src/commands/ravendb/promptConnection.ts
|
|
6743
|
-
import
|
|
6861
|
+
import chalk81 from "chalk";
|
|
6744
6862
|
|
|
6745
6863
|
// src/commands/ravendb/selectOpSecret.ts
|
|
6746
|
-
import
|
|
6864
|
+
import chalk80 from "chalk";
|
|
6747
6865
|
import Enquirer2 from "enquirer";
|
|
6748
6866
|
|
|
6749
6867
|
// src/commands/ravendb/searchItems.ts
|
|
6750
6868
|
import { execSync as execSync34 } from "child_process";
|
|
6751
|
-
import
|
|
6869
|
+
import chalk79 from "chalk";
|
|
6752
6870
|
function opExec(args) {
|
|
6753
6871
|
return execSync34(`op ${args}`, {
|
|
6754
6872
|
encoding: "utf-8",
|
|
@@ -6761,7 +6879,7 @@ function searchItems(search) {
|
|
|
6761
6879
|
items = JSON.parse(opExec("item list --format=json"));
|
|
6762
6880
|
} catch {
|
|
6763
6881
|
console.error(
|
|
6764
|
-
|
|
6882
|
+
chalk79.red(
|
|
6765
6883
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
6766
6884
|
)
|
|
6767
6885
|
);
|
|
@@ -6775,7 +6893,7 @@ function getItemFields(itemId) {
|
|
|
6775
6893
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
6776
6894
|
return item.fields.filter((f) => f.reference && f.label);
|
|
6777
6895
|
} catch {
|
|
6778
|
-
console.error(
|
|
6896
|
+
console.error(chalk79.red("Failed to get item details from 1Password."));
|
|
6779
6897
|
process.exit(1);
|
|
6780
6898
|
}
|
|
6781
6899
|
}
|
|
@@ -6794,7 +6912,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
6794
6912
|
}).run();
|
|
6795
6913
|
const items = searchItems(search);
|
|
6796
6914
|
if (items.length === 0) {
|
|
6797
|
-
console.error(
|
|
6915
|
+
console.error(chalk80.red(`No items found matching "${search}".`));
|
|
6798
6916
|
process.exit(1);
|
|
6799
6917
|
}
|
|
6800
6918
|
const itemId = await selectOne(
|
|
@@ -6803,7 +6921,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
6803
6921
|
);
|
|
6804
6922
|
const fields = getItemFields(itemId);
|
|
6805
6923
|
if (fields.length === 0) {
|
|
6806
|
-
console.error(
|
|
6924
|
+
console.error(chalk80.red("No fields with references found on this item."));
|
|
6807
6925
|
process.exit(1);
|
|
6808
6926
|
}
|
|
6809
6927
|
const ref = await selectOne(
|
|
@@ -6817,7 +6935,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
6817
6935
|
async function promptConnection(existingNames) {
|
|
6818
6936
|
const name = await promptInput("name", "Connection name:");
|
|
6819
6937
|
if (existingNames.includes(name)) {
|
|
6820
|
-
console.error(
|
|
6938
|
+
console.error(chalk81.red(`Connection "${name}" already exists.`));
|
|
6821
6939
|
process.exit(1);
|
|
6822
6940
|
}
|
|
6823
6941
|
const url = await promptInput(
|
|
@@ -6826,22 +6944,22 @@ async function promptConnection(existingNames) {
|
|
|
6826
6944
|
);
|
|
6827
6945
|
const database = await promptInput("database", "Database name:");
|
|
6828
6946
|
if (!name || !url || !database) {
|
|
6829
|
-
console.error(
|
|
6947
|
+
console.error(chalk81.red("All fields are required."));
|
|
6830
6948
|
process.exit(1);
|
|
6831
6949
|
}
|
|
6832
6950
|
const apiKeyRef = await selectOpSecret();
|
|
6833
|
-
console.log(
|
|
6951
|
+
console.log(chalk81.dim(`Using: ${apiKeyRef}`));
|
|
6834
6952
|
return { name, url, database, apiKeyRef };
|
|
6835
6953
|
}
|
|
6836
6954
|
|
|
6837
6955
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
6838
|
-
import
|
|
6956
|
+
import chalk82 from "chalk";
|
|
6839
6957
|
function ravendbSetConnection(name) {
|
|
6840
6958
|
const raw = loadGlobalConfigRaw();
|
|
6841
6959
|
const ravendb = raw.ravendb ?? {};
|
|
6842
6960
|
const connections = ravendb.connections ?? [];
|
|
6843
6961
|
if (!connections.some((c) => c.name === name)) {
|
|
6844
|
-
console.error(
|
|
6962
|
+
console.error(chalk82.red(`Connection "${name}" not found.`));
|
|
6845
6963
|
console.error(
|
|
6846
6964
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
6847
6965
|
);
|
|
@@ -6857,16 +6975,16 @@ function ravendbSetConnection(name) {
|
|
|
6857
6975
|
var ravendbAuth = createConnectionAuth({
|
|
6858
6976
|
load: loadConnections,
|
|
6859
6977
|
save: saveConnections,
|
|
6860
|
-
format: (c) => `${
|
|
6978
|
+
format: (c) => `${chalk83.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
6861
6979
|
promptNew: promptConnection,
|
|
6862
6980
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
6863
6981
|
});
|
|
6864
6982
|
|
|
6865
6983
|
// src/commands/ravendb/ravendbCollections.ts
|
|
6866
|
-
import
|
|
6984
|
+
import chalk87 from "chalk";
|
|
6867
6985
|
|
|
6868
6986
|
// src/commands/ravendb/ravenFetch.ts
|
|
6869
|
-
import
|
|
6987
|
+
import chalk85 from "chalk";
|
|
6870
6988
|
|
|
6871
6989
|
// src/commands/ravendb/getAccessToken.ts
|
|
6872
6990
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -6903,10 +7021,10 @@ ${errorText}`
|
|
|
6903
7021
|
|
|
6904
7022
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
6905
7023
|
import { execSync as execSync35 } from "child_process";
|
|
6906
|
-
import
|
|
7024
|
+
import chalk84 from "chalk";
|
|
6907
7025
|
function resolveOpSecret(reference) {
|
|
6908
7026
|
if (!reference.startsWith("op://")) {
|
|
6909
|
-
console.error(
|
|
7027
|
+
console.error(chalk84.red(`Invalid secret reference: must start with op://`));
|
|
6910
7028
|
process.exit(1);
|
|
6911
7029
|
}
|
|
6912
7030
|
try {
|
|
@@ -6916,7 +7034,7 @@ function resolveOpSecret(reference) {
|
|
|
6916
7034
|
}).trim();
|
|
6917
7035
|
} catch {
|
|
6918
7036
|
console.error(
|
|
6919
|
-
|
|
7037
|
+
chalk84.red(
|
|
6920
7038
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
6921
7039
|
)
|
|
6922
7040
|
);
|
|
@@ -6943,7 +7061,7 @@ async function ravenFetch(connection, path50) {
|
|
|
6943
7061
|
if (!response.ok) {
|
|
6944
7062
|
const body = await response.text();
|
|
6945
7063
|
console.error(
|
|
6946
|
-
|
|
7064
|
+
chalk85.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
6947
7065
|
);
|
|
6948
7066
|
console.error(body.substring(0, 500));
|
|
6949
7067
|
process.exit(1);
|
|
@@ -6952,7 +7070,7 @@ async function ravenFetch(connection, path50) {
|
|
|
6952
7070
|
}
|
|
6953
7071
|
|
|
6954
7072
|
// src/commands/ravendb/resolveConnection.ts
|
|
6955
|
-
import
|
|
7073
|
+
import chalk86 from "chalk";
|
|
6956
7074
|
function loadRavendb() {
|
|
6957
7075
|
const raw = loadGlobalConfigRaw();
|
|
6958
7076
|
const ravendb = raw.ravendb;
|
|
@@ -6966,7 +7084,7 @@ function resolveConnection(name) {
|
|
|
6966
7084
|
const connectionName = name ?? defaultConnection;
|
|
6967
7085
|
if (!connectionName) {
|
|
6968
7086
|
console.error(
|
|
6969
|
-
|
|
7087
|
+
chalk86.red(
|
|
6970
7088
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
6971
7089
|
)
|
|
6972
7090
|
);
|
|
@@ -6974,7 +7092,7 @@ function resolveConnection(name) {
|
|
|
6974
7092
|
}
|
|
6975
7093
|
const connection = connections.find((c) => c.name === connectionName);
|
|
6976
7094
|
if (!connection) {
|
|
6977
|
-
console.error(
|
|
7095
|
+
console.error(chalk86.red(`Connection "${connectionName}" not found.`));
|
|
6978
7096
|
console.error(
|
|
6979
7097
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
6980
7098
|
);
|
|
@@ -7005,15 +7123,15 @@ async function ravendbCollections(connectionName) {
|
|
|
7005
7123
|
return;
|
|
7006
7124
|
}
|
|
7007
7125
|
for (const c of collections) {
|
|
7008
|
-
console.log(`${
|
|
7126
|
+
console.log(`${chalk87.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
7009
7127
|
}
|
|
7010
7128
|
}
|
|
7011
7129
|
|
|
7012
7130
|
// src/commands/ravendb/ravendbQuery.ts
|
|
7013
|
-
import
|
|
7131
|
+
import chalk89 from "chalk";
|
|
7014
7132
|
|
|
7015
7133
|
// src/commands/ravendb/fetchAllPages.ts
|
|
7016
|
-
import
|
|
7134
|
+
import chalk88 from "chalk";
|
|
7017
7135
|
|
|
7018
7136
|
// src/commands/ravendb/buildQueryPath.ts
|
|
7019
7137
|
function buildQueryPath(opts) {
|
|
@@ -7051,7 +7169,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
7051
7169
|
allResults.push(...results);
|
|
7052
7170
|
start3 += results.length;
|
|
7053
7171
|
process.stderr.write(
|
|
7054
|
-
`\r${
|
|
7172
|
+
`\r${chalk88.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
7055
7173
|
);
|
|
7056
7174
|
if (start3 >= totalResults) break;
|
|
7057
7175
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -7066,7 +7184,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
7066
7184
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
7067
7185
|
const resolved = resolveArgs(connectionName, collection);
|
|
7068
7186
|
if (!resolved.collection && !options2.query) {
|
|
7069
|
-
console.error(
|
|
7187
|
+
console.error(chalk89.red("Provide a collection name or --query filter."));
|
|
7070
7188
|
process.exit(1);
|
|
7071
7189
|
}
|
|
7072
7190
|
const { collection: col } = resolved;
|
|
@@ -7104,7 +7222,7 @@ import { spawn as spawn4 } from "child_process";
|
|
|
7104
7222
|
import * as path27 from "path";
|
|
7105
7223
|
|
|
7106
7224
|
// src/commands/refactor/logViolations.ts
|
|
7107
|
-
import
|
|
7225
|
+
import chalk90 from "chalk";
|
|
7108
7226
|
var DEFAULT_MAX_LINES = 100;
|
|
7109
7227
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
7110
7228
|
if (violations.length === 0) {
|
|
@@ -7113,43 +7231,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
7113
7231
|
}
|
|
7114
7232
|
return;
|
|
7115
7233
|
}
|
|
7116
|
-
console.error(
|
|
7234
|
+
console.error(chalk90.red(`
|
|
7117
7235
|
Refactor check failed:
|
|
7118
7236
|
`));
|
|
7119
|
-
console.error(
|
|
7237
|
+
console.error(chalk90.red(` The following files exceed ${maxLines} lines:
|
|
7120
7238
|
`));
|
|
7121
7239
|
for (const violation of violations) {
|
|
7122
|
-
console.error(
|
|
7240
|
+
console.error(chalk90.red(` ${violation.file} (${violation.lines} lines)`));
|
|
7123
7241
|
}
|
|
7124
7242
|
console.error(
|
|
7125
|
-
|
|
7243
|
+
chalk90.yellow(
|
|
7126
7244
|
`
|
|
7127
7245
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
7128
7246
|
way to refactor it, ignore it with:
|
|
7129
7247
|
`
|
|
7130
7248
|
)
|
|
7131
7249
|
);
|
|
7132
|
-
console.error(
|
|
7250
|
+
console.error(chalk90.gray(` assist refactor ignore <file>
|
|
7133
7251
|
`));
|
|
7134
7252
|
if (process.env.CLAUDECODE) {
|
|
7135
|
-
console.error(
|
|
7253
|
+
console.error(chalk90.cyan(`
|
|
7136
7254
|
## Extracting Code to New Files
|
|
7137
7255
|
`));
|
|
7138
7256
|
console.error(
|
|
7139
|
-
|
|
7257
|
+
chalk90.cyan(
|
|
7140
7258
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
7141
7259
|
`
|
|
7142
7260
|
)
|
|
7143
7261
|
);
|
|
7144
7262
|
console.error(
|
|
7145
|
-
|
|
7263
|
+
chalk90.cyan(
|
|
7146
7264
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
7147
7265
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
7148
7266
|
`
|
|
7149
7267
|
)
|
|
7150
7268
|
);
|
|
7151
7269
|
console.error(
|
|
7152
|
-
|
|
7270
|
+
chalk90.cyan(
|
|
7153
7271
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
7154
7272
|
domains, move it to a common/shared folder.
|
|
7155
7273
|
`
|
|
@@ -7305,7 +7423,7 @@ async function check(pattern2, options2) {
|
|
|
7305
7423
|
|
|
7306
7424
|
// src/commands/refactor/extract/index.ts
|
|
7307
7425
|
import path33 from "path";
|
|
7308
|
-
import
|
|
7426
|
+
import chalk93 from "chalk";
|
|
7309
7427
|
|
|
7310
7428
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
7311
7429
|
import { SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
@@ -7831,23 +7949,23 @@ function buildPlan(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
7831
7949
|
|
|
7832
7950
|
// src/commands/refactor/extract/displayPlan.ts
|
|
7833
7951
|
import path31 from "path";
|
|
7834
|
-
import
|
|
7952
|
+
import chalk91 from "chalk";
|
|
7835
7953
|
function section(title) {
|
|
7836
7954
|
return `
|
|
7837
|
-
${
|
|
7955
|
+
${chalk91.cyan(title)}`;
|
|
7838
7956
|
}
|
|
7839
7957
|
function displayImporters(plan2, cwd) {
|
|
7840
7958
|
if (plan2.importersToUpdate.length === 0) return;
|
|
7841
7959
|
console.log(section("Update importers:"));
|
|
7842
7960
|
for (const imp of plan2.importersToUpdate) {
|
|
7843
7961
|
const rel = path31.relative(cwd, imp.file.getFilePath());
|
|
7844
|
-
console.log(` ${
|
|
7962
|
+
console.log(` ${chalk91.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
7845
7963
|
}
|
|
7846
7964
|
}
|
|
7847
7965
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
7848
|
-
console.log(
|
|
7966
|
+
console.log(chalk91.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
7849
7967
|
`));
|
|
7850
|
-
console.log(` ${
|
|
7968
|
+
console.log(` ${chalk91.cyan("Functions to move:")}`);
|
|
7851
7969
|
for (const name of plan2.extractedNames) {
|
|
7852
7970
|
console.log(` ${name}`);
|
|
7853
7971
|
}
|
|
@@ -7882,7 +8000,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
7882
8000
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
7883
8001
|
import fs17 from "fs";
|
|
7884
8002
|
import path32 from "path";
|
|
7885
|
-
import
|
|
8003
|
+
import chalk92 from "chalk";
|
|
7886
8004
|
import { Project as Project2 } from "ts-morph";
|
|
7887
8005
|
function findTsConfig(sourcePath) {
|
|
7888
8006
|
const rootConfig = path32.resolve("tsconfig.json");
|
|
@@ -7913,7 +8031,7 @@ function loadProjectFile(file) {
|
|
|
7913
8031
|
});
|
|
7914
8032
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
7915
8033
|
if (!sourceFile) {
|
|
7916
|
-
console.log(
|
|
8034
|
+
console.log(chalk92.red(`File not found in project: ${file}`));
|
|
7917
8035
|
process.exit(1);
|
|
7918
8036
|
}
|
|
7919
8037
|
return { project, sourceFile };
|
|
@@ -7936,19 +8054,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
7936
8054
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
7937
8055
|
if (options2.apply) {
|
|
7938
8056
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
7939
|
-
console.log(
|
|
8057
|
+
console.log(chalk93.green("\nExtraction complete"));
|
|
7940
8058
|
} else {
|
|
7941
|
-
console.log(
|
|
8059
|
+
console.log(chalk93.dim("\nDry run. Use --apply to execute."));
|
|
7942
8060
|
}
|
|
7943
8061
|
}
|
|
7944
8062
|
|
|
7945
8063
|
// src/commands/refactor/ignore.ts
|
|
7946
8064
|
import fs18 from "fs";
|
|
7947
|
-
import
|
|
8065
|
+
import chalk94 from "chalk";
|
|
7948
8066
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
7949
8067
|
function ignore(file) {
|
|
7950
8068
|
if (!fs18.existsSync(file)) {
|
|
7951
|
-
console.error(
|
|
8069
|
+
console.error(chalk94.red(`Error: File does not exist: ${file}`));
|
|
7952
8070
|
process.exit(1);
|
|
7953
8071
|
}
|
|
7954
8072
|
const content = fs18.readFileSync(file, "utf-8");
|
|
@@ -7964,7 +8082,7 @@ function ignore(file) {
|
|
|
7964
8082
|
fs18.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
7965
8083
|
}
|
|
7966
8084
|
console.log(
|
|
7967
|
-
|
|
8085
|
+
chalk94.green(
|
|
7968
8086
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
7969
8087
|
)
|
|
7970
8088
|
);
|
|
@@ -7972,26 +8090,26 @@ function ignore(file) {
|
|
|
7972
8090
|
|
|
7973
8091
|
// src/commands/refactor/rename/index.ts
|
|
7974
8092
|
import path34 from "path";
|
|
7975
|
-
import
|
|
8093
|
+
import chalk95 from "chalk";
|
|
7976
8094
|
async function rename(source, destination, options2 = {}) {
|
|
7977
8095
|
const destPath = path34.resolve(destination);
|
|
7978
8096
|
const cwd = process.cwd();
|
|
7979
8097
|
const relSource = path34.relative(cwd, path34.resolve(source));
|
|
7980
8098
|
const relDest = path34.relative(cwd, destPath);
|
|
7981
8099
|
const { project, sourceFile } = loadProjectFile(source);
|
|
7982
|
-
console.log(
|
|
8100
|
+
console.log(chalk95.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
7983
8101
|
if (options2.apply) {
|
|
7984
8102
|
sourceFile.move(destPath);
|
|
7985
8103
|
await project.save();
|
|
7986
|
-
console.log(
|
|
8104
|
+
console.log(chalk95.green("Done"));
|
|
7987
8105
|
} else {
|
|
7988
|
-
console.log(
|
|
8106
|
+
console.log(chalk95.dim("Dry run. Use --apply to execute."));
|
|
7989
8107
|
}
|
|
7990
8108
|
}
|
|
7991
8109
|
|
|
7992
8110
|
// src/commands/refactor/renameSymbol/index.ts
|
|
7993
8111
|
import path36 from "path";
|
|
7994
|
-
import
|
|
8112
|
+
import chalk96 from "chalk";
|
|
7995
8113
|
import { Project as Project3 } from "ts-morph";
|
|
7996
8114
|
|
|
7997
8115
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
@@ -8040,38 +8158,38 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
8040
8158
|
const project = new Project3({ tsConfigFilePath: tsConfigPath });
|
|
8041
8159
|
const sourceFile = project.getSourceFile(filePath);
|
|
8042
8160
|
if (!sourceFile) {
|
|
8043
|
-
console.log(
|
|
8161
|
+
console.log(chalk96.red(`File not found in project: ${file}`));
|
|
8044
8162
|
process.exit(1);
|
|
8045
8163
|
}
|
|
8046
8164
|
const symbol = findSymbol(sourceFile, oldName);
|
|
8047
8165
|
if (!symbol) {
|
|
8048
|
-
console.log(
|
|
8166
|
+
console.log(chalk96.red(`Symbol "${oldName}" not found in ${file}`));
|
|
8049
8167
|
process.exit(1);
|
|
8050
8168
|
}
|
|
8051
8169
|
const grouped = groupReferences(symbol, cwd);
|
|
8052
8170
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
8053
8171
|
console.log(
|
|
8054
|
-
|
|
8172
|
+
chalk96.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
8055
8173
|
`)
|
|
8056
8174
|
);
|
|
8057
8175
|
for (const [refFile, lines] of grouped) {
|
|
8058
8176
|
console.log(
|
|
8059
|
-
` ${
|
|
8177
|
+
` ${chalk96.dim(refFile)}: lines ${chalk96.cyan(lines.join(", "))}`
|
|
8060
8178
|
);
|
|
8061
8179
|
}
|
|
8062
8180
|
if (options2.apply) {
|
|
8063
8181
|
symbol.rename(newName);
|
|
8064
8182
|
await project.save();
|
|
8065
|
-
console.log(
|
|
8183
|
+
console.log(chalk96.green(`
|
|
8066
8184
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
8067
8185
|
} else {
|
|
8068
|
-
console.log(
|
|
8186
|
+
console.log(chalk96.dim("\nDry run. Use --apply to execute."));
|
|
8069
8187
|
}
|
|
8070
8188
|
}
|
|
8071
8189
|
|
|
8072
8190
|
// src/commands/refactor/restructure/index.ts
|
|
8073
8191
|
import path45 from "path";
|
|
8074
|
-
import
|
|
8192
|
+
import chalk99 from "chalk";
|
|
8075
8193
|
|
|
8076
8194
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
8077
8195
|
import path37 from "path";
|
|
@@ -8314,50 +8432,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
8314
8432
|
|
|
8315
8433
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
8316
8434
|
import path41 from "path";
|
|
8317
|
-
import
|
|
8435
|
+
import chalk97 from "chalk";
|
|
8318
8436
|
function relPath(filePath) {
|
|
8319
8437
|
return path41.relative(process.cwd(), filePath);
|
|
8320
8438
|
}
|
|
8321
8439
|
function displayMoves(plan2) {
|
|
8322
8440
|
if (plan2.moves.length === 0) return;
|
|
8323
|
-
console.log(
|
|
8441
|
+
console.log(chalk97.bold("\nFile moves:"));
|
|
8324
8442
|
for (const move of plan2.moves) {
|
|
8325
8443
|
console.log(
|
|
8326
|
-
` ${
|
|
8444
|
+
` ${chalk97.red(relPath(move.from))} \u2192 ${chalk97.green(relPath(move.to))}`
|
|
8327
8445
|
);
|
|
8328
|
-
console.log(
|
|
8446
|
+
console.log(chalk97.dim(` ${move.reason}`));
|
|
8329
8447
|
}
|
|
8330
8448
|
}
|
|
8331
8449
|
function displayRewrites(rewrites) {
|
|
8332
8450
|
if (rewrites.length === 0) return;
|
|
8333
8451
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
8334
|
-
console.log(
|
|
8452
|
+
console.log(chalk97.bold(`
|
|
8335
8453
|
Import rewrites (${affectedFiles.size} files):`));
|
|
8336
8454
|
for (const file of affectedFiles) {
|
|
8337
|
-
console.log(` ${
|
|
8455
|
+
console.log(` ${chalk97.cyan(relPath(file))}:`);
|
|
8338
8456
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
8339
8457
|
(r) => r.file === file
|
|
8340
8458
|
)) {
|
|
8341
8459
|
console.log(
|
|
8342
|
-
` ${
|
|
8460
|
+
` ${chalk97.red(`"${oldSpecifier}"`)} \u2192 ${chalk97.green(`"${newSpecifier}"`)}`
|
|
8343
8461
|
);
|
|
8344
8462
|
}
|
|
8345
8463
|
}
|
|
8346
8464
|
}
|
|
8347
8465
|
function displayPlan2(plan2) {
|
|
8348
8466
|
if (plan2.warnings.length > 0) {
|
|
8349
|
-
console.log(
|
|
8350
|
-
for (const w of plan2.warnings) console.log(
|
|
8467
|
+
console.log(chalk97.yellow("\nWarnings:"));
|
|
8468
|
+
for (const w of plan2.warnings) console.log(chalk97.yellow(` ${w}`));
|
|
8351
8469
|
}
|
|
8352
8470
|
if (plan2.newDirectories.length > 0) {
|
|
8353
|
-
console.log(
|
|
8471
|
+
console.log(chalk97.bold("\nNew directories:"));
|
|
8354
8472
|
for (const dir of plan2.newDirectories)
|
|
8355
|
-
console.log(
|
|
8473
|
+
console.log(chalk97.green(` ${dir}/`));
|
|
8356
8474
|
}
|
|
8357
8475
|
displayMoves(plan2);
|
|
8358
8476
|
displayRewrites(plan2.rewrites);
|
|
8359
8477
|
console.log(
|
|
8360
|
-
|
|
8478
|
+
chalk97.dim(
|
|
8361
8479
|
`
|
|
8362
8480
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
8363
8481
|
)
|
|
@@ -8367,18 +8485,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
8367
8485
|
// src/commands/refactor/restructure/executePlan.ts
|
|
8368
8486
|
import fs20 from "fs";
|
|
8369
8487
|
import path42 from "path";
|
|
8370
|
-
import
|
|
8488
|
+
import chalk98 from "chalk";
|
|
8371
8489
|
function executePlan(plan2) {
|
|
8372
8490
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
8373
8491
|
for (const [file, content] of updatedContents) {
|
|
8374
8492
|
fs20.writeFileSync(file, content, "utf-8");
|
|
8375
8493
|
console.log(
|
|
8376
|
-
|
|
8494
|
+
chalk98.cyan(` Rewrote imports in ${path42.relative(process.cwd(), file)}`)
|
|
8377
8495
|
);
|
|
8378
8496
|
}
|
|
8379
8497
|
for (const dir of plan2.newDirectories) {
|
|
8380
8498
|
fs20.mkdirSync(dir, { recursive: true });
|
|
8381
|
-
console.log(
|
|
8499
|
+
console.log(chalk98.green(` Created ${path42.relative(process.cwd(), dir)}/`));
|
|
8382
8500
|
}
|
|
8383
8501
|
for (const move of plan2.moves) {
|
|
8384
8502
|
const targetDir = path42.dirname(move.to);
|
|
@@ -8387,7 +8505,7 @@ function executePlan(plan2) {
|
|
|
8387
8505
|
}
|
|
8388
8506
|
fs20.renameSync(move.from, move.to);
|
|
8389
8507
|
console.log(
|
|
8390
|
-
|
|
8508
|
+
chalk98.white(
|
|
8391
8509
|
` Moved ${path42.relative(process.cwd(), move.from)} \u2192 ${path42.relative(process.cwd(), move.to)}`
|
|
8392
8510
|
)
|
|
8393
8511
|
);
|
|
@@ -8402,7 +8520,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
8402
8520
|
if (entries.length === 0) {
|
|
8403
8521
|
fs20.rmdirSync(dir);
|
|
8404
8522
|
console.log(
|
|
8405
|
-
|
|
8523
|
+
chalk98.dim(
|
|
8406
8524
|
` Removed empty directory ${path42.relative(process.cwd(), dir)}`
|
|
8407
8525
|
)
|
|
8408
8526
|
);
|
|
@@ -8535,22 +8653,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
8535
8653
|
const targetPattern = pattern2 ?? "src";
|
|
8536
8654
|
const files = findSourceFiles2(targetPattern);
|
|
8537
8655
|
if (files.length === 0) {
|
|
8538
|
-
console.log(
|
|
8656
|
+
console.log(chalk99.yellow("No files found matching pattern"));
|
|
8539
8657
|
return;
|
|
8540
8658
|
}
|
|
8541
8659
|
const tsConfigPath = path45.resolve("tsconfig.json");
|
|
8542
8660
|
const plan2 = buildPlan2(files, tsConfigPath);
|
|
8543
8661
|
if (plan2.moves.length === 0) {
|
|
8544
|
-
console.log(
|
|
8662
|
+
console.log(chalk99.green("No restructuring needed"));
|
|
8545
8663
|
return;
|
|
8546
8664
|
}
|
|
8547
8665
|
displayPlan2(plan2);
|
|
8548
8666
|
if (options2.apply) {
|
|
8549
|
-
console.log(
|
|
8667
|
+
console.log(chalk99.bold("\nApplying changes..."));
|
|
8550
8668
|
executePlan(plan2);
|
|
8551
|
-
console.log(
|
|
8669
|
+
console.log(chalk99.green("\nRestructuring complete"));
|
|
8552
8670
|
} else {
|
|
8553
|
-
console.log(
|
|
8671
|
+
console.log(chalk99.dim("\nDry run. Use --apply to execute."));
|
|
8554
8672
|
}
|
|
8555
8673
|
}
|
|
8556
8674
|
|
|
@@ -8590,7 +8708,7 @@ function registerRefactor(program2) {
|
|
|
8590
8708
|
}
|
|
8591
8709
|
|
|
8592
8710
|
// src/commands/seq/seqAuth.ts
|
|
8593
|
-
import
|
|
8711
|
+
import chalk101 from "chalk";
|
|
8594
8712
|
|
|
8595
8713
|
// src/commands/seq/loadConnections.ts
|
|
8596
8714
|
function loadConnections2() {
|
|
@@ -8619,11 +8737,11 @@ function setDefaultConnection(name) {
|
|
|
8619
8737
|
}
|
|
8620
8738
|
|
|
8621
8739
|
// src/commands/seq/promptConnection.ts
|
|
8622
|
-
import
|
|
8740
|
+
import chalk100 from "chalk";
|
|
8623
8741
|
async function promptConnection2(existingNames) {
|
|
8624
8742
|
const name = await promptInput("name", "Connection name:", "default");
|
|
8625
8743
|
if (existingNames.includes(name)) {
|
|
8626
|
-
console.error(
|
|
8744
|
+
console.error(chalk100.red(`Connection "${name}" already exists.`));
|
|
8627
8745
|
process.exit(1);
|
|
8628
8746
|
}
|
|
8629
8747
|
const url = await promptInput("url", "Seq URL:", "http://localhost:5341");
|
|
@@ -8635,32 +8753,32 @@ async function promptConnection2(existingNames) {
|
|
|
8635
8753
|
var seqAuth = createConnectionAuth({
|
|
8636
8754
|
load: loadConnections2,
|
|
8637
8755
|
save: saveConnections2,
|
|
8638
|
-
format: (c) => `${
|
|
8756
|
+
format: (c) => `${chalk101.bold(c.name)} ${c.url}`,
|
|
8639
8757
|
promptNew: promptConnection2,
|
|
8640
8758
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
8641
8759
|
});
|
|
8642
8760
|
|
|
8643
8761
|
// src/commands/seq/seqQuery.ts
|
|
8644
|
-
import
|
|
8762
|
+
import chalk104 from "chalk";
|
|
8645
8763
|
|
|
8646
8764
|
// src/commands/seq/formatEvent.ts
|
|
8647
|
-
import
|
|
8765
|
+
import chalk102 from "chalk";
|
|
8648
8766
|
function levelColor(level) {
|
|
8649
8767
|
switch (level) {
|
|
8650
8768
|
case "Fatal":
|
|
8651
|
-
return
|
|
8769
|
+
return chalk102.bgRed.white;
|
|
8652
8770
|
case "Error":
|
|
8653
|
-
return
|
|
8771
|
+
return chalk102.red;
|
|
8654
8772
|
case "Warning":
|
|
8655
|
-
return
|
|
8773
|
+
return chalk102.yellow;
|
|
8656
8774
|
case "Information":
|
|
8657
|
-
return
|
|
8775
|
+
return chalk102.cyan;
|
|
8658
8776
|
case "Debug":
|
|
8659
|
-
return
|
|
8777
|
+
return chalk102.gray;
|
|
8660
8778
|
case "Verbose":
|
|
8661
|
-
return
|
|
8779
|
+
return chalk102.dim;
|
|
8662
8780
|
default:
|
|
8663
|
-
return
|
|
8781
|
+
return chalk102.white;
|
|
8664
8782
|
}
|
|
8665
8783
|
}
|
|
8666
8784
|
function levelAbbrev(level) {
|
|
@@ -8701,31 +8819,31 @@ function formatTimestamp(iso) {
|
|
|
8701
8819
|
function formatEvent(event) {
|
|
8702
8820
|
const color = levelColor(event.Level);
|
|
8703
8821
|
const abbrev = levelAbbrev(event.Level);
|
|
8704
|
-
const ts8 =
|
|
8822
|
+
const ts8 = chalk102.dim(formatTimestamp(event.Timestamp));
|
|
8705
8823
|
const msg = renderMessage(event);
|
|
8706
8824
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
8707
8825
|
if (event.Exception) {
|
|
8708
8826
|
for (const line of event.Exception.split("\n")) {
|
|
8709
|
-
lines.push(
|
|
8827
|
+
lines.push(chalk102.red(` ${line}`));
|
|
8710
8828
|
}
|
|
8711
8829
|
}
|
|
8712
8830
|
return lines.join("\n");
|
|
8713
8831
|
}
|
|
8714
8832
|
|
|
8715
8833
|
// src/commands/seq/resolveConnection.ts
|
|
8716
|
-
import
|
|
8834
|
+
import chalk103 from "chalk";
|
|
8717
8835
|
function resolveConnection2(name) {
|
|
8718
8836
|
const connections = loadConnections2();
|
|
8719
8837
|
if (connections.length === 0) {
|
|
8720
8838
|
console.error(
|
|
8721
|
-
|
|
8839
|
+
chalk103.red("No Seq connections configured. Run 'assist seq auth' first.")
|
|
8722
8840
|
);
|
|
8723
8841
|
process.exit(1);
|
|
8724
8842
|
}
|
|
8725
8843
|
const target = name ?? getDefaultConnection() ?? connections[0].name;
|
|
8726
8844
|
const connection = connections.find((c) => c.name === target);
|
|
8727
8845
|
if (!connection) {
|
|
8728
|
-
console.error(
|
|
8846
|
+
console.error(chalk103.red(`Seq connection "${target}" not found.`));
|
|
8729
8847
|
process.exit(1);
|
|
8730
8848
|
}
|
|
8731
8849
|
return connection;
|
|
@@ -8745,12 +8863,12 @@ async function seqQuery(filter, options2) {
|
|
|
8745
8863
|
});
|
|
8746
8864
|
if (!response.ok) {
|
|
8747
8865
|
const body = await response.text();
|
|
8748
|
-
console.error(
|
|
8866
|
+
console.error(chalk104.red(`Seq returned ${response.status}: ${body}`));
|
|
8749
8867
|
process.exit(1);
|
|
8750
8868
|
}
|
|
8751
8869
|
const events = await response.json();
|
|
8752
8870
|
if (events.length === 0) {
|
|
8753
|
-
console.log(
|
|
8871
|
+
console.log(chalk104.yellow("No events found."));
|
|
8754
8872
|
return;
|
|
8755
8873
|
}
|
|
8756
8874
|
if (options2.json) {
|
|
@@ -8761,11 +8879,11 @@ async function seqQuery(filter, options2) {
|
|
|
8761
8879
|
for (const event of chronological) {
|
|
8762
8880
|
console.log(formatEvent(event));
|
|
8763
8881
|
}
|
|
8764
|
-
console.log(
|
|
8882
|
+
console.log(chalk104.dim(`
|
|
8765
8883
|
${events.length} events`));
|
|
8766
8884
|
if (events.length >= count) {
|
|
8767
8885
|
console.log(
|
|
8768
|
-
|
|
8886
|
+
chalk104.yellow(
|
|
8769
8887
|
`Results limited to ${count}. Use --count to retrieve more.`
|
|
8770
8888
|
)
|
|
8771
8889
|
);
|
|
@@ -8773,11 +8891,11 @@ ${events.length} events`));
|
|
|
8773
8891
|
}
|
|
8774
8892
|
|
|
8775
8893
|
// src/commands/seq/seqSetConnection.ts
|
|
8776
|
-
import
|
|
8894
|
+
import chalk105 from "chalk";
|
|
8777
8895
|
function seqSetConnection(name) {
|
|
8778
8896
|
const connections = loadConnections2();
|
|
8779
8897
|
if (!connections.find((c) => c.name === name)) {
|
|
8780
|
-
console.error(
|
|
8898
|
+
console.error(chalk105.red(`Connection "${name}" not found.`));
|
|
8781
8899
|
process.exit(1);
|
|
8782
8900
|
}
|
|
8783
8901
|
setDefaultConnection(name);
|
|
@@ -9316,14 +9434,14 @@ import {
|
|
|
9316
9434
|
import { dirname as dirname20, join as join29 } from "path";
|
|
9317
9435
|
|
|
9318
9436
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
9319
|
-
import
|
|
9437
|
+
import chalk106 from "chalk";
|
|
9320
9438
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
9321
9439
|
function validateStagedContent(filename, content) {
|
|
9322
9440
|
const firstLine = content.split("\n")[0];
|
|
9323
9441
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
9324
9442
|
if (!match) {
|
|
9325
9443
|
console.error(
|
|
9326
|
-
|
|
9444
|
+
chalk106.red(
|
|
9327
9445
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
9328
9446
|
)
|
|
9329
9447
|
);
|
|
@@ -9332,7 +9450,7 @@ function validateStagedContent(filename, content) {
|
|
|
9332
9450
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
9333
9451
|
if (!contentAfterLink) {
|
|
9334
9452
|
console.error(
|
|
9335
|
-
|
|
9453
|
+
chalk106.red(
|
|
9336
9454
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
9337
9455
|
)
|
|
9338
9456
|
);
|
|
@@ -9725,7 +9843,7 @@ function registerVoice(program2) {
|
|
|
9725
9843
|
|
|
9726
9844
|
// src/commands/roam/auth.ts
|
|
9727
9845
|
import { randomBytes } from "crypto";
|
|
9728
|
-
import
|
|
9846
|
+
import chalk107 from "chalk";
|
|
9729
9847
|
|
|
9730
9848
|
// src/lib/openBrowser.ts
|
|
9731
9849
|
import { execSync as execSync38 } from "child_process";
|
|
@@ -9900,13 +10018,13 @@ async function auth() {
|
|
|
9900
10018
|
saveGlobalConfig(config);
|
|
9901
10019
|
const state = randomBytes(16).toString("hex");
|
|
9902
10020
|
console.log(
|
|
9903
|
-
|
|
10021
|
+
chalk107.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
9904
10022
|
);
|
|
9905
|
-
console.log(
|
|
9906
|
-
console.log(
|
|
9907
|
-
console.log(
|
|
10023
|
+
console.log(chalk107.white("http://localhost:14523/callback\n"));
|
|
10024
|
+
console.log(chalk107.blue("Opening browser for authorization..."));
|
|
10025
|
+
console.log(chalk107.dim("Waiting for authorization callback..."));
|
|
9908
10026
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
9909
|
-
console.log(
|
|
10027
|
+
console.log(chalk107.dim("Exchanging code for tokens..."));
|
|
9910
10028
|
const tokens = await exchangeToken({
|
|
9911
10029
|
code,
|
|
9912
10030
|
clientId,
|
|
@@ -9922,7 +10040,7 @@ async function auth() {
|
|
|
9922
10040
|
};
|
|
9923
10041
|
saveGlobalConfig(config);
|
|
9924
10042
|
console.log(
|
|
9925
|
-
|
|
10043
|
+
chalk107.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
9926
10044
|
);
|
|
9927
10045
|
}
|
|
9928
10046
|
|
|
@@ -10135,7 +10253,7 @@ import { execSync as execSync40 } from "child_process";
|
|
|
10135
10253
|
import { existsSync as existsSync38, mkdirSync as mkdirSync13, unlinkSync as unlinkSync10, writeFileSync as writeFileSync27 } from "fs";
|
|
10136
10254
|
import { tmpdir as tmpdir6 } from "os";
|
|
10137
10255
|
import { join as join38, resolve as resolve5 } from "path";
|
|
10138
|
-
import
|
|
10256
|
+
import chalk108 from "chalk";
|
|
10139
10257
|
|
|
10140
10258
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
10141
10259
|
var captureWindowPs1 = `
|
|
@@ -10286,22 +10404,22 @@ function screenshot(processName) {
|
|
|
10286
10404
|
const config = loadConfig();
|
|
10287
10405
|
const outputDir = resolve5(config.screenshot.outputDir);
|
|
10288
10406
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
10289
|
-
console.log(
|
|
10407
|
+
console.log(chalk108.gray(`Capturing window for process "${processName}" ...`));
|
|
10290
10408
|
try {
|
|
10291
10409
|
runPowerShellScript(processName, outputPath);
|
|
10292
|
-
console.log(
|
|
10410
|
+
console.log(chalk108.green(`Screenshot saved: ${outputPath}`));
|
|
10293
10411
|
} catch (error) {
|
|
10294
10412
|
const msg = error instanceof Error ? error.message : String(error);
|
|
10295
|
-
console.error(
|
|
10413
|
+
console.error(chalk108.red(`Failed to capture screenshot: ${msg}`));
|
|
10296
10414
|
process.exit(1);
|
|
10297
10415
|
}
|
|
10298
10416
|
}
|
|
10299
10417
|
|
|
10300
10418
|
// src/commands/statusLine.ts
|
|
10301
|
-
import
|
|
10419
|
+
import chalk110 from "chalk";
|
|
10302
10420
|
|
|
10303
10421
|
// src/commands/buildLimitsSegment.ts
|
|
10304
|
-
import
|
|
10422
|
+
import chalk109 from "chalk";
|
|
10305
10423
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
10306
10424
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
10307
10425
|
function formatTimeLeft(resetsAt) {
|
|
@@ -10324,10 +10442,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
10324
10442
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
10325
10443
|
const label2 = `${Math.round(pct)}%`;
|
|
10326
10444
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
10327
|
-
if (projected == null) return
|
|
10328
|
-
if (projected > 100) return
|
|
10329
|
-
if (projected > 75) return
|
|
10330
|
-
return
|
|
10445
|
+
if (projected == null) return chalk109.green(label2);
|
|
10446
|
+
if (projected > 100) return chalk109.red(label2);
|
|
10447
|
+
if (projected > 75) return chalk109.yellow(label2);
|
|
10448
|
+
return chalk109.green(label2);
|
|
10331
10449
|
}
|
|
10332
10450
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
10333
10451
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -10353,14 +10471,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
10353
10471
|
}
|
|
10354
10472
|
|
|
10355
10473
|
// src/commands/statusLine.ts
|
|
10356
|
-
|
|
10474
|
+
chalk110.level = 3;
|
|
10357
10475
|
function formatNumber(num) {
|
|
10358
10476
|
return num.toLocaleString("en-US");
|
|
10359
10477
|
}
|
|
10360
10478
|
function colorizePercent(pct) {
|
|
10361
10479
|
const label2 = `${Math.round(pct)}%`;
|
|
10362
|
-
if (pct > 80) return
|
|
10363
|
-
if (pct > 40) return
|
|
10480
|
+
if (pct > 80) return chalk110.red(label2);
|
|
10481
|
+
if (pct > 40) return chalk110.yellow(label2);
|
|
10364
10482
|
return label2;
|
|
10365
10483
|
}
|
|
10366
10484
|
async function statusLine() {
|
|
@@ -10383,7 +10501,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
10383
10501
|
// src/commands/sync/syncClaudeMd.ts
|
|
10384
10502
|
import * as fs23 from "fs";
|
|
10385
10503
|
import * as path46 from "path";
|
|
10386
|
-
import
|
|
10504
|
+
import chalk111 from "chalk";
|
|
10387
10505
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
10388
10506
|
const source = path46.join(claudeDir, "CLAUDE.md");
|
|
10389
10507
|
const target = path46.join(targetBase, "CLAUDE.md");
|
|
@@ -10392,12 +10510,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
10392
10510
|
const targetContent = fs23.readFileSync(target, "utf-8");
|
|
10393
10511
|
if (sourceContent !== targetContent) {
|
|
10394
10512
|
console.log(
|
|
10395
|
-
|
|
10513
|
+
chalk111.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
10396
10514
|
);
|
|
10397
10515
|
console.log();
|
|
10398
10516
|
printDiff(targetContent, sourceContent);
|
|
10399
10517
|
const confirm = options2?.yes || await promptConfirm(
|
|
10400
|
-
|
|
10518
|
+
chalk111.red("Overwrite existing CLAUDE.md?"),
|
|
10401
10519
|
false
|
|
10402
10520
|
);
|
|
10403
10521
|
if (!confirm) {
|
|
@@ -10413,7 +10531,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
10413
10531
|
// src/commands/sync/syncSettings.ts
|
|
10414
10532
|
import * as fs24 from "fs";
|
|
10415
10533
|
import * as path47 from "path";
|
|
10416
|
-
import
|
|
10534
|
+
import chalk112 from "chalk";
|
|
10417
10535
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
10418
10536
|
const source = path47.join(claudeDir, "settings.json");
|
|
10419
10537
|
const target = path47.join(targetBase, "settings.json");
|
|
@@ -10429,14 +10547,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
10429
10547
|
if (mergedContent !== normalizedTarget) {
|
|
10430
10548
|
if (!options2?.yes) {
|
|
10431
10549
|
console.log(
|
|
10432
|
-
|
|
10550
|
+
chalk112.yellow(
|
|
10433
10551
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
10434
10552
|
)
|
|
10435
10553
|
);
|
|
10436
10554
|
console.log();
|
|
10437
10555
|
printDiff(targetContent, mergedContent);
|
|
10438
10556
|
const confirm = await promptConfirm(
|
|
10439
|
-
|
|
10557
|
+
chalk112.red("Overwrite existing settings.json?"),
|
|
10440
10558
|
false
|
|
10441
10559
|
);
|
|
10442
10560
|
if (!confirm) {
|