@staff0rd/assist 0.183.0 → 0.184.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +399 -343
- 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.184.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -875,7 +875,7 @@ function buildReviewPhase() {
|
|
|
875
875
|
import chalk5 from "chalk";
|
|
876
876
|
|
|
877
877
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
878
|
-
import { existsSync as
|
|
878
|
+
import { existsSync as existsSync6, unlinkSync as unlinkSync2 } from "fs";
|
|
879
879
|
import chalk4 from "chalk";
|
|
880
880
|
|
|
881
881
|
// src/commands/backlog/handleIncompletePhase.ts
|
|
@@ -894,6 +894,9 @@ async function handleIncompletePhase() {
|
|
|
894
894
|
return "abort";
|
|
895
895
|
}
|
|
896
896
|
|
|
897
|
+
// src/commands/backlog/readSignal.ts
|
|
898
|
+
import { existsSync as existsSync5, readFileSync as readFileSync5 } from "fs";
|
|
899
|
+
|
|
897
900
|
// src/commands/backlog/writeSignal.ts
|
|
898
901
|
import { writeFileSync as writeFileSync4 } from "fs";
|
|
899
902
|
import { join as join6 } from "path";
|
|
@@ -908,10 +911,21 @@ function writeSignal(event, data) {
|
|
|
908
911
|
writeFileSync4(getSignalPath(), JSON.stringify(signal));
|
|
909
912
|
}
|
|
910
913
|
|
|
914
|
+
// src/commands/backlog/readSignal.ts
|
|
915
|
+
function readSignal() {
|
|
916
|
+
const path50 = getSignalPath();
|
|
917
|
+
if (!existsSync5(path50)) return void 0;
|
|
918
|
+
try {
|
|
919
|
+
return JSON.parse(readFileSync5(path50, "utf-8"));
|
|
920
|
+
} catch {
|
|
921
|
+
return void 0;
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
|
|
911
925
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
912
926
|
function cleanupSignal() {
|
|
913
927
|
const statusPath = getSignalPath();
|
|
914
|
-
if (
|
|
928
|
+
if (existsSync6(statusPath)) {
|
|
915
929
|
unlinkSync2(statusPath);
|
|
916
930
|
}
|
|
917
931
|
}
|
|
@@ -921,16 +935,23 @@ function isTerminalStatus(itemId) {
|
|
|
921
935
|
return item?.status === "done" || item?.status === "wontdo";
|
|
922
936
|
}
|
|
923
937
|
async function resolvePhaseResult(phaseIndex, itemId) {
|
|
924
|
-
if (!
|
|
938
|
+
if (!existsSync6(getSignalPath())) {
|
|
925
939
|
if (isTerminalStatus(itemId)) return -1;
|
|
926
940
|
const action = await handleIncompletePhase();
|
|
927
941
|
if (action === "abort") return -1;
|
|
928
|
-
return action === "skip" ? 1 :
|
|
942
|
+
return action === "skip" ? phaseIndex + 1 : phaseIndex;
|
|
929
943
|
}
|
|
944
|
+
const signal = readSignal();
|
|
930
945
|
cleanupSignal();
|
|
946
|
+
if (signal?.event === "rewind") {
|
|
947
|
+
const targetPhase = signal.targetPhase;
|
|
948
|
+
console.log(chalk4.yellow(`
|
|
949
|
+
Rewinding to phase ${targetPhase + 1}.`));
|
|
950
|
+
return targetPhase;
|
|
951
|
+
}
|
|
931
952
|
console.log(chalk4.green(`
|
|
932
953
|
Phase ${phaseIndex + 1} completed.`));
|
|
933
|
-
return 1;
|
|
954
|
+
return phaseIndex + 1;
|
|
934
955
|
}
|
|
935
956
|
|
|
936
957
|
// src/commands/backlog/spawnClaude.ts
|
|
@@ -952,20 +973,6 @@ function spawnClaude(prompt, options2 = {}) {
|
|
|
952
973
|
|
|
953
974
|
// src/commands/backlog/watchForMarker.ts
|
|
954
975
|
import { existsSync as existsSync7, unwatchFile, watchFile } from "fs";
|
|
955
|
-
|
|
956
|
-
// src/commands/backlog/readSignal.ts
|
|
957
|
-
import { existsSync as existsSync6, readFileSync as readFileSync5 } from "fs";
|
|
958
|
-
function readSignal() {
|
|
959
|
-
const path50 = getSignalPath();
|
|
960
|
-
if (!existsSync6(path50)) return void 0;
|
|
961
|
-
try {
|
|
962
|
-
return JSON.parse(readFileSync5(path50, "utf-8"));
|
|
963
|
-
} catch {
|
|
964
|
-
return void 0;
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
// src/commands/backlog/watchForMarker.ts
|
|
969
976
|
function watchForMarker(child) {
|
|
970
977
|
const statusPath = getSignalPath();
|
|
971
978
|
watchFile(statusPath, { interval: 1e3 }, () => {
|
|
@@ -999,8 +1006,7 @@ async function executePhase(item, phaseIndex, phases, spawnOptions) {
|
|
|
999
1006
|
watchForMarker(child);
|
|
1000
1007
|
await done2;
|
|
1001
1008
|
stopWatching();
|
|
1002
|
-
|
|
1003
|
-
return delta < 0 ? -1 : phaseIndex + delta;
|
|
1009
|
+
return await resolvePhaseResult(phaseIndex, item.id);
|
|
1004
1010
|
}
|
|
1005
1011
|
|
|
1006
1012
|
// src/commands/backlog/prepareRun.ts
|
|
@@ -4192,6 +4198,55 @@ function registerLinkCommands(cmd) {
|
|
|
4192
4198
|
cmd.command("unlink <from> <to>").description("Remove a link between two backlog items").action(unlink);
|
|
4193
4199
|
}
|
|
4194
4200
|
|
|
4201
|
+
// src/commands/backlog/rewindPhase.ts
|
|
4202
|
+
import chalk52 from "chalk";
|
|
4203
|
+
function validateRewind(item, phaseIndex) {
|
|
4204
|
+
if (!item.plan || item.plan.length === 0) {
|
|
4205
|
+
return `Item #${item.id} has no plan phases.`;
|
|
4206
|
+
}
|
|
4207
|
+
if (phaseIndex < 0 || phaseIndex >= item.plan.length) {
|
|
4208
|
+
return `Phase ${phaseIndex} does not exist. Valid range: 0\u2013${item.plan.length - 1}.`;
|
|
4209
|
+
}
|
|
4210
|
+
const currentPhase = item.currentPhase ?? 0;
|
|
4211
|
+
if (phaseIndex >= currentPhase) {
|
|
4212
|
+
return `Phase ${phaseIndex} is not earlier than the current phase (${currentPhase}).`;
|
|
4213
|
+
}
|
|
4214
|
+
return void 0;
|
|
4215
|
+
}
|
|
4216
|
+
function rewindPhase(id, phase, opts) {
|
|
4217
|
+
const phaseIndex = Number.parseInt(phase, 10);
|
|
4218
|
+
const result = loadAndFindItem(id);
|
|
4219
|
+
if (!result) return;
|
|
4220
|
+
const { item } = result;
|
|
4221
|
+
const error = validateRewind(item, phaseIndex);
|
|
4222
|
+
if (error) {
|
|
4223
|
+
console.log(chalk52.red(error));
|
|
4224
|
+
process.exitCode = 1;
|
|
4225
|
+
return;
|
|
4226
|
+
}
|
|
4227
|
+
const phaseName = item.plan?.[phaseIndex].name;
|
|
4228
|
+
addComment(
|
|
4229
|
+
item,
|
|
4230
|
+
`Rewound to phase ${phaseIndex} (${phaseName}): ${opts.reason}`,
|
|
4231
|
+
phaseIndex
|
|
4232
|
+
);
|
|
4233
|
+
saveBacklog(result.items);
|
|
4234
|
+
setCurrentPhase(id, phaseIndex);
|
|
4235
|
+
setStatus(id, "in-progress");
|
|
4236
|
+
writeSignal("rewind", {
|
|
4237
|
+
itemId: Number.parseInt(id, 10),
|
|
4238
|
+
targetPhase: phaseIndex
|
|
4239
|
+
});
|
|
4240
|
+
console.log(
|
|
4241
|
+
chalk52.green(`Rewound item #${id} to phase ${phaseIndex} (${phaseName}).`)
|
|
4242
|
+
);
|
|
4243
|
+
}
|
|
4244
|
+
|
|
4245
|
+
// src/commands/backlog/registerRewindCommand.ts
|
|
4246
|
+
function registerRewindCommand(cmd) {
|
|
4247
|
+
cmd.command("rewind <id> <phase>").description("Rewind a backlog item to an earlier phase").requiredOption("--reason <reason>", "Reason for rewinding").action(rewindPhase);
|
|
4248
|
+
}
|
|
4249
|
+
|
|
4195
4250
|
// src/commands/backlog/registerRunCommand.ts
|
|
4196
4251
|
function registerRunCommand(cmd) {
|
|
4197
4252
|
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(async (id, opts) => {
|
|
@@ -4200,11 +4255,11 @@ function registerRunCommand(cmd) {
|
|
|
4200
4255
|
}
|
|
4201
4256
|
|
|
4202
4257
|
// src/commands/backlog/search/index.ts
|
|
4203
|
-
import
|
|
4258
|
+
import chalk53 from "chalk";
|
|
4204
4259
|
async function search(query) {
|
|
4205
4260
|
if (!backlogExists()) {
|
|
4206
4261
|
console.log(
|
|
4207
|
-
|
|
4262
|
+
chalk53.yellow(
|
|
4208
4263
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
4209
4264
|
)
|
|
4210
4265
|
);
|
|
@@ -4212,18 +4267,18 @@ async function search(query) {
|
|
|
4212
4267
|
}
|
|
4213
4268
|
const items = searchBacklog(query);
|
|
4214
4269
|
if (items.length === 0) {
|
|
4215
|
-
console.log(
|
|
4270
|
+
console.log(chalk53.dim(`No items matching "${query}".`));
|
|
4216
4271
|
return;
|
|
4217
4272
|
}
|
|
4218
4273
|
console.log(
|
|
4219
|
-
|
|
4274
|
+
chalk53.dim(
|
|
4220
4275
|
`${items.length} item${items.length === 1 ? "" : "s"} matching "${query}":
|
|
4221
4276
|
`
|
|
4222
4277
|
)
|
|
4223
4278
|
);
|
|
4224
4279
|
for (const item of items) {
|
|
4225
4280
|
console.log(
|
|
4226
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
4281
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk53.dim(`#${item.id}`)} ${item.name}`
|
|
4227
4282
|
);
|
|
4228
4283
|
}
|
|
4229
4284
|
}
|
|
@@ -4234,16 +4289,16 @@ function registerSearchCommand(cmd) {
|
|
|
4234
4289
|
}
|
|
4235
4290
|
|
|
4236
4291
|
// src/commands/backlog/delete/index.ts
|
|
4237
|
-
import
|
|
4292
|
+
import chalk54 from "chalk";
|
|
4238
4293
|
async function del(id) {
|
|
4239
4294
|
const name = removeItem(id);
|
|
4240
4295
|
if (name) {
|
|
4241
|
-
console.log(
|
|
4296
|
+
console.log(chalk54.green(`Deleted item #${id}: ${name}`));
|
|
4242
4297
|
}
|
|
4243
4298
|
}
|
|
4244
4299
|
|
|
4245
4300
|
// src/commands/backlog/done/index.ts
|
|
4246
|
-
import
|
|
4301
|
+
import chalk55 from "chalk";
|
|
4247
4302
|
async function done(id, summary) {
|
|
4248
4303
|
const result = loadAndFindItem(id);
|
|
4249
4304
|
if (!result) return;
|
|
@@ -4253,12 +4308,12 @@ async function done(id, summary) {
|
|
|
4253
4308
|
const pending = item.plan.slice(completed);
|
|
4254
4309
|
if (pending.length > 0) {
|
|
4255
4310
|
console.log(
|
|
4256
|
-
|
|
4311
|
+
chalk55.red(
|
|
4257
4312
|
`Cannot complete item #${id}: ${pending.length} pending phase(s):`
|
|
4258
4313
|
)
|
|
4259
4314
|
);
|
|
4260
4315
|
for (const phase of pending) {
|
|
4261
|
-
console.log(
|
|
4316
|
+
console.log(chalk55.yellow(` - ${phase.name}`));
|
|
4262
4317
|
}
|
|
4263
4318
|
process.exitCode = 1;
|
|
4264
4319
|
return;
|
|
@@ -4270,20 +4325,20 @@ async function done(id, summary) {
|
|
|
4270
4325
|
addPhaseSummary(item, summary, phase);
|
|
4271
4326
|
}
|
|
4272
4327
|
saveBacklog(result.items);
|
|
4273
|
-
console.log(
|
|
4328
|
+
console.log(chalk55.green(`Completed item #${id}: ${item.name}`));
|
|
4274
4329
|
}
|
|
4275
4330
|
|
|
4276
4331
|
// src/commands/backlog/start/index.ts
|
|
4277
|
-
import
|
|
4332
|
+
import chalk56 from "chalk";
|
|
4278
4333
|
async function start(id) {
|
|
4279
4334
|
const name = setStatus(id, "in-progress");
|
|
4280
4335
|
if (name) {
|
|
4281
|
-
console.log(
|
|
4336
|
+
console.log(chalk56.green(`Started item #${id}: ${name}`));
|
|
4282
4337
|
}
|
|
4283
4338
|
}
|
|
4284
4339
|
|
|
4285
4340
|
// src/commands/backlog/wontdo/index.ts
|
|
4286
|
-
import
|
|
4341
|
+
import chalk57 from "chalk";
|
|
4287
4342
|
async function wontdo(id, reason) {
|
|
4288
4343
|
const result = loadAndFindItem(id);
|
|
4289
4344
|
if (!result) return;
|
|
@@ -4293,7 +4348,7 @@ async function wontdo(id, reason) {
|
|
|
4293
4348
|
addPhaseSummary(result.item, reason, phase);
|
|
4294
4349
|
}
|
|
4295
4350
|
saveBacklog(result.items);
|
|
4296
|
-
console.log(
|
|
4351
|
+
console.log(chalk57.red(`Won't do item #${id}: ${result.item.name}`));
|
|
4297
4352
|
}
|
|
4298
4353
|
|
|
4299
4354
|
// src/commands/backlog/registerStatusCommands.ts
|
|
@@ -4305,10 +4360,10 @@ function registerStatusCommands(cmd) {
|
|
|
4305
4360
|
}
|
|
4306
4361
|
|
|
4307
4362
|
// src/commands/backlog/removePhase.ts
|
|
4308
|
-
import
|
|
4363
|
+
import chalk59 from "chalk";
|
|
4309
4364
|
|
|
4310
4365
|
// src/commands/backlog/findPhase.ts
|
|
4311
|
-
import
|
|
4366
|
+
import chalk58 from "chalk";
|
|
4312
4367
|
function findPhase(id, phase) {
|
|
4313
4368
|
const result = loadAndFindItem(id);
|
|
4314
4369
|
if (!result) return void 0;
|
|
@@ -4320,7 +4375,7 @@ function findPhase(id, phase) {
|
|
|
4320
4375
|
"SELECT COUNT(*) as cnt FROM plan_phases WHERE item_id = ? AND idx = ?"
|
|
4321
4376
|
).get(itemId, phaseIdx);
|
|
4322
4377
|
if (existing.cnt === 0) {
|
|
4323
|
-
console.log(
|
|
4378
|
+
console.log(chalk58.red(`Phase ${phaseIdx} not found on item #${itemId}.`));
|
|
4324
4379
|
process.exitCode = 1;
|
|
4325
4380
|
return void 0;
|
|
4326
4381
|
}
|
|
@@ -4376,23 +4431,23 @@ function removePhase(id, phase) {
|
|
|
4376
4431
|
run4();
|
|
4377
4432
|
exportToJsonl(db, dir);
|
|
4378
4433
|
commitBacklog(itemId, result.item.name);
|
|
4379
|
-
console.log(
|
|
4434
|
+
console.log(chalk59.green(`Removed phase ${phaseIdx} from item #${itemId}.`));
|
|
4380
4435
|
}
|
|
4381
4436
|
|
|
4382
4437
|
// src/commands/backlog/update/index.ts
|
|
4383
|
-
import
|
|
4438
|
+
import chalk61 from "chalk";
|
|
4384
4439
|
|
|
4385
4440
|
// src/commands/backlog/update/buildUpdateSql.ts
|
|
4386
|
-
import
|
|
4441
|
+
import chalk60 from "chalk";
|
|
4387
4442
|
function buildUpdateSql(options2) {
|
|
4388
4443
|
const { name, desc, type, ac } = options2;
|
|
4389
4444
|
if (!name && !desc && !type && !ac) {
|
|
4390
|
-
console.log(
|
|
4445
|
+
console.log(chalk60.red("Nothing to update. Provide at least one flag."));
|
|
4391
4446
|
process.exitCode = 1;
|
|
4392
4447
|
return void 0;
|
|
4393
4448
|
}
|
|
4394
4449
|
if (type && type !== "story" && type !== "bug") {
|
|
4395
|
-
console.log(
|
|
4450
|
+
console.log(chalk60.red('Invalid type. Must be "story" or "bug".'));
|
|
4396
4451
|
process.exitCode = 1;
|
|
4397
4452
|
return void 0;
|
|
4398
4453
|
}
|
|
@@ -4437,11 +4492,11 @@ function update(id, options2) {
|
|
|
4437
4492
|
);
|
|
4438
4493
|
exportToJsonl(db, dir);
|
|
4439
4494
|
commitBacklog(itemId, options2.name ?? result.item.name);
|
|
4440
|
-
console.log(
|
|
4495
|
+
console.log(chalk61.green(`Updated ${built.fields} on item #${itemId}.`));
|
|
4441
4496
|
}
|
|
4442
4497
|
|
|
4443
4498
|
// src/commands/backlog/updatePhase.ts
|
|
4444
|
-
import
|
|
4499
|
+
import chalk62 from "chalk";
|
|
4445
4500
|
|
|
4446
4501
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
4447
4502
|
function applyPhaseUpdate(db, itemId, phaseIdx, fields) {
|
|
@@ -4475,7 +4530,7 @@ function applyPhaseUpdate(db, itemId, phaseIdx, fields) {
|
|
|
4475
4530
|
function updatePhase(id, phase, options2) {
|
|
4476
4531
|
const { name, task, manualCheck } = options2;
|
|
4477
4532
|
if (!name && !task && !manualCheck) {
|
|
4478
|
-
console.log(
|
|
4533
|
+
console.log(chalk62.red("Nothing to update. Provide at least one flag."));
|
|
4479
4534
|
process.exitCode = 1;
|
|
4480
4535
|
return;
|
|
4481
4536
|
}
|
|
@@ -4491,7 +4546,7 @@ function updatePhase(id, phase, options2) {
|
|
|
4491
4546
|
manualCheck && "manual checks"
|
|
4492
4547
|
].filter(Boolean).join(", ");
|
|
4493
4548
|
console.log(
|
|
4494
|
-
|
|
4549
|
+
chalk62.green(`Updated ${fields} on phase ${phaseIdx} of item #${itemId}.`)
|
|
4495
4550
|
);
|
|
4496
4551
|
}
|
|
4497
4552
|
|
|
@@ -4529,6 +4584,7 @@ function registerBacklog(program2) {
|
|
|
4529
4584
|
registerCommentCommands(cmd);
|
|
4530
4585
|
registerLinkCommands(cmd);
|
|
4531
4586
|
registerPlanCommands(cmd);
|
|
4587
|
+
registerRewindCommand(cmd);
|
|
4532
4588
|
registerNextCommand(cmd);
|
|
4533
4589
|
registerRunCommand(cmd);
|
|
4534
4590
|
registerSearchCommand(cmd);
|
|
@@ -4988,11 +5044,11 @@ function assertCliExists(cli) {
|
|
|
4988
5044
|
}
|
|
4989
5045
|
|
|
4990
5046
|
// src/commands/permitCliReads/colorize.ts
|
|
4991
|
-
import
|
|
5047
|
+
import chalk63 from "chalk";
|
|
4992
5048
|
function colorize(plainOutput) {
|
|
4993
5049
|
return plainOutput.split("\n").map((line) => {
|
|
4994
|
-
if (line.startsWith(" R ")) return
|
|
4995
|
-
if (line.startsWith(" W ")) return
|
|
5050
|
+
if (line.startsWith(" R ")) return chalk63.green(line);
|
|
5051
|
+
if (line.startsWith(" W ")) return chalk63.red(line);
|
|
4996
5052
|
return line;
|
|
4997
5053
|
}).join("\n");
|
|
4998
5054
|
}
|
|
@@ -5290,48 +5346,48 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
5290
5346
|
}
|
|
5291
5347
|
|
|
5292
5348
|
// src/commands/deny/denyAdd.ts
|
|
5293
|
-
import
|
|
5349
|
+
import chalk64 from "chalk";
|
|
5294
5350
|
function denyAdd(pattern2, message) {
|
|
5295
5351
|
const config = loadProjectConfig();
|
|
5296
5352
|
const deny = config.deny ?? [];
|
|
5297
5353
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
5298
|
-
console.log(
|
|
5354
|
+
console.log(chalk64.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
5299
5355
|
return;
|
|
5300
5356
|
}
|
|
5301
5357
|
deny.push({ pattern: pattern2, message });
|
|
5302
5358
|
config.deny = deny;
|
|
5303
5359
|
saveConfig(config);
|
|
5304
|
-
console.log(
|
|
5360
|
+
console.log(chalk64.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
5305
5361
|
}
|
|
5306
5362
|
|
|
5307
5363
|
// src/commands/deny/denyList.ts
|
|
5308
|
-
import
|
|
5364
|
+
import chalk65 from "chalk";
|
|
5309
5365
|
function denyList() {
|
|
5310
5366
|
const config = loadConfig();
|
|
5311
5367
|
const deny = config.deny;
|
|
5312
5368
|
if (!deny || deny.length === 0) {
|
|
5313
|
-
console.log(
|
|
5369
|
+
console.log(chalk65.dim("No deny rules configured."));
|
|
5314
5370
|
return;
|
|
5315
5371
|
}
|
|
5316
5372
|
for (const rule of deny) {
|
|
5317
|
-
console.log(`${
|
|
5373
|
+
console.log(`${chalk65.red(rule.pattern)} \u2192 ${rule.message}`);
|
|
5318
5374
|
}
|
|
5319
5375
|
}
|
|
5320
5376
|
|
|
5321
5377
|
// src/commands/deny/denyRemove.ts
|
|
5322
|
-
import
|
|
5378
|
+
import chalk66 from "chalk";
|
|
5323
5379
|
function denyRemove(pattern2) {
|
|
5324
5380
|
const config = loadProjectConfig();
|
|
5325
5381
|
const deny = config.deny ?? [];
|
|
5326
5382
|
const index = deny.findIndex((r) => r.pattern === pattern2);
|
|
5327
5383
|
if (index === -1) {
|
|
5328
|
-
console.log(
|
|
5384
|
+
console.log(chalk66.yellow(`No deny rule found for: ${pattern2}`));
|
|
5329
5385
|
return;
|
|
5330
5386
|
}
|
|
5331
5387
|
deny.splice(index, 1);
|
|
5332
5388
|
config.deny = deny.length > 0 ? deny : void 0;
|
|
5333
5389
|
saveConfig(config);
|
|
5334
|
-
console.log(
|
|
5390
|
+
console.log(chalk66.green(`Removed deny rule: ${pattern2}`));
|
|
5335
5391
|
}
|
|
5336
5392
|
|
|
5337
5393
|
// src/commands/registerDeny.ts
|
|
@@ -5360,15 +5416,15 @@ function registerCliHook(program2) {
|
|
|
5360
5416
|
}
|
|
5361
5417
|
|
|
5362
5418
|
// src/commands/complexity/analyze.ts
|
|
5363
|
-
import
|
|
5419
|
+
import chalk72 from "chalk";
|
|
5364
5420
|
|
|
5365
5421
|
// src/commands/complexity/cyclomatic.ts
|
|
5366
|
-
import
|
|
5422
|
+
import chalk68 from "chalk";
|
|
5367
5423
|
|
|
5368
5424
|
// src/commands/complexity/shared/index.ts
|
|
5369
5425
|
import fs12 from "fs";
|
|
5370
5426
|
import path20 from "path";
|
|
5371
|
-
import
|
|
5427
|
+
import chalk67 from "chalk";
|
|
5372
5428
|
import ts5 from "typescript";
|
|
5373
5429
|
|
|
5374
5430
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -5614,7 +5670,7 @@ function createSourceFromFile(filePath) {
|
|
|
5614
5670
|
function withSourceFiles(pattern2, callback) {
|
|
5615
5671
|
const files = findSourceFiles2(pattern2);
|
|
5616
5672
|
if (files.length === 0) {
|
|
5617
|
-
console.log(
|
|
5673
|
+
console.log(chalk67.yellow("No files found matching pattern"));
|
|
5618
5674
|
return void 0;
|
|
5619
5675
|
}
|
|
5620
5676
|
return callback(files);
|
|
@@ -5647,11 +5703,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5647
5703
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
5648
5704
|
for (const { file, name, complexity } of results) {
|
|
5649
5705
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
5650
|
-
const color = exceedsThreshold ?
|
|
5651
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
5706
|
+
const color = exceedsThreshold ? chalk68.red : chalk68.white;
|
|
5707
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk68.cyan(complexity)}`);
|
|
5652
5708
|
}
|
|
5653
5709
|
console.log(
|
|
5654
|
-
|
|
5710
|
+
chalk68.dim(
|
|
5655
5711
|
`
|
|
5656
5712
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
5657
5713
|
)
|
|
@@ -5663,7 +5719,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
5663
5719
|
}
|
|
5664
5720
|
|
|
5665
5721
|
// src/commands/complexity/halstead.ts
|
|
5666
|
-
import
|
|
5722
|
+
import chalk69 from "chalk";
|
|
5667
5723
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
5668
5724
|
withSourceFiles(pattern2, (files) => {
|
|
5669
5725
|
const results = [];
|
|
@@ -5678,13 +5734,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5678
5734
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
5679
5735
|
for (const { file, name, metrics } of results) {
|
|
5680
5736
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
5681
|
-
const color = exceedsThreshold ?
|
|
5737
|
+
const color = exceedsThreshold ? chalk69.red : chalk69.white;
|
|
5682
5738
|
console.log(
|
|
5683
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
5739
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk69.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk69.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk69.magenta(metrics.effort.toFixed(1))}`
|
|
5684
5740
|
);
|
|
5685
5741
|
}
|
|
5686
5742
|
console.log(
|
|
5687
|
-
|
|
5743
|
+
chalk69.dim(
|
|
5688
5744
|
`
|
|
5689
5745
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
5690
5746
|
)
|
|
@@ -5699,28 +5755,28 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
5699
5755
|
import fs13 from "fs";
|
|
5700
5756
|
|
|
5701
5757
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
5702
|
-
import
|
|
5758
|
+
import chalk70 from "chalk";
|
|
5703
5759
|
function displayMaintainabilityResults(results, threshold) {
|
|
5704
5760
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
5705
5761
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
5706
|
-
console.log(
|
|
5762
|
+
console.log(chalk70.green("All files pass maintainability threshold"));
|
|
5707
5763
|
} else {
|
|
5708
5764
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
5709
|
-
const color = threshold !== void 0 ?
|
|
5765
|
+
const color = threshold !== void 0 ? chalk70.red : chalk70.white;
|
|
5710
5766
|
console.log(
|
|
5711
|
-
`${color(file)} \u2192 avg: ${
|
|
5767
|
+
`${color(file)} \u2192 avg: ${chalk70.cyan(avgMaintainability.toFixed(1))}, min: ${chalk70.yellow(minMaintainability.toFixed(1))}`
|
|
5712
5768
|
);
|
|
5713
5769
|
}
|
|
5714
5770
|
}
|
|
5715
|
-
console.log(
|
|
5771
|
+
console.log(chalk70.dim(`
|
|
5716
5772
|
Analyzed ${results.length} files`));
|
|
5717
5773
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
5718
5774
|
console.error(
|
|
5719
|
-
|
|
5775
|
+
chalk70.red(
|
|
5720
5776
|
`
|
|
5721
5777
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
5722
5778
|
|
|
5723
|
-
\u26A0\uFE0F ${
|
|
5779
|
+
\u26A0\uFE0F ${chalk70.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.`
|
|
5724
5780
|
)
|
|
5725
5781
|
);
|
|
5726
5782
|
process.exit(1);
|
|
@@ -5777,7 +5833,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5777
5833
|
|
|
5778
5834
|
// src/commands/complexity/sloc.ts
|
|
5779
5835
|
import fs14 from "fs";
|
|
5780
|
-
import
|
|
5836
|
+
import chalk71 from "chalk";
|
|
5781
5837
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
5782
5838
|
withSourceFiles(pattern2, (files) => {
|
|
5783
5839
|
const results = [];
|
|
@@ -5793,12 +5849,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5793
5849
|
results.sort((a, b) => b.lines - a.lines);
|
|
5794
5850
|
for (const { file, lines } of results) {
|
|
5795
5851
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
5796
|
-
const color = exceedsThreshold ?
|
|
5797
|
-
console.log(`${color(file)} \u2192 ${
|
|
5852
|
+
const color = exceedsThreshold ? chalk71.red : chalk71.white;
|
|
5853
|
+
console.log(`${color(file)} \u2192 ${chalk71.cyan(lines)} lines`);
|
|
5798
5854
|
}
|
|
5799
5855
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
5800
5856
|
console.log(
|
|
5801
|
-
|
|
5857
|
+
chalk71.dim(`
|
|
5802
5858
|
Total: ${total} lines across ${files.length} files`)
|
|
5803
5859
|
);
|
|
5804
5860
|
if (hasViolation) {
|
|
@@ -5812,21 +5868,21 @@ async function analyze(pattern2) {
|
|
|
5812
5868
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
5813
5869
|
const files = findSourceFiles2(searchPattern);
|
|
5814
5870
|
if (files.length === 0) {
|
|
5815
|
-
console.log(
|
|
5871
|
+
console.log(chalk72.yellow("No files found matching pattern"));
|
|
5816
5872
|
return;
|
|
5817
5873
|
}
|
|
5818
5874
|
if (files.length === 1) {
|
|
5819
5875
|
const file = files[0];
|
|
5820
|
-
console.log(
|
|
5876
|
+
console.log(chalk72.bold.underline("SLOC"));
|
|
5821
5877
|
await sloc(file);
|
|
5822
5878
|
console.log();
|
|
5823
|
-
console.log(
|
|
5879
|
+
console.log(chalk72.bold.underline("Cyclomatic Complexity"));
|
|
5824
5880
|
await cyclomatic(file);
|
|
5825
5881
|
console.log();
|
|
5826
|
-
console.log(
|
|
5882
|
+
console.log(chalk72.bold.underline("Halstead Metrics"));
|
|
5827
5883
|
await halstead(file);
|
|
5828
5884
|
console.log();
|
|
5829
|
-
console.log(
|
|
5885
|
+
console.log(chalk72.bold.underline("Maintainability Index"));
|
|
5830
5886
|
await maintainability(file);
|
|
5831
5887
|
return;
|
|
5832
5888
|
}
|
|
@@ -5853,7 +5909,7 @@ function registerComplexity(program2) {
|
|
|
5853
5909
|
}
|
|
5854
5910
|
|
|
5855
5911
|
// src/commands/config/index.ts
|
|
5856
|
-
import
|
|
5912
|
+
import chalk73 from "chalk";
|
|
5857
5913
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
5858
5914
|
|
|
5859
5915
|
// src/commands/config/setNestedValue.ts
|
|
@@ -5916,7 +5972,7 @@ function formatIssuePath(issue, key) {
|
|
|
5916
5972
|
function printValidationErrors(issues, key) {
|
|
5917
5973
|
for (const issue of issues) {
|
|
5918
5974
|
console.error(
|
|
5919
|
-
|
|
5975
|
+
chalk73.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
5920
5976
|
);
|
|
5921
5977
|
}
|
|
5922
5978
|
}
|
|
@@ -5933,7 +5989,7 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
5933
5989
|
function assertNotGlobalOnly(key, global) {
|
|
5934
5990
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
5935
5991
|
console.error(
|
|
5936
|
-
|
|
5992
|
+
chalk73.red(
|
|
5937
5993
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
5938
5994
|
)
|
|
5939
5995
|
);
|
|
@@ -5956,7 +6012,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
5956
6012
|
applyConfigSet(key, coerced, options2.global ?? false);
|
|
5957
6013
|
const target = options2.global ? "global" : "project";
|
|
5958
6014
|
console.log(
|
|
5959
|
-
|
|
6015
|
+
chalk73.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
5960
6016
|
);
|
|
5961
6017
|
}
|
|
5962
6018
|
function configList() {
|
|
@@ -5965,7 +6021,7 @@ function configList() {
|
|
|
5965
6021
|
}
|
|
5966
6022
|
|
|
5967
6023
|
// src/commands/config/configGet.ts
|
|
5968
|
-
import
|
|
6024
|
+
import chalk74 from "chalk";
|
|
5969
6025
|
|
|
5970
6026
|
// src/commands/config/getNestedValue.ts
|
|
5971
6027
|
function isTraversable(value) {
|
|
@@ -5997,7 +6053,7 @@ function requireNestedValue(config, key) {
|
|
|
5997
6053
|
return value;
|
|
5998
6054
|
}
|
|
5999
6055
|
function exitKeyNotSet(key) {
|
|
6000
|
-
console.error(
|
|
6056
|
+
console.error(chalk74.red(`Key "${key}" is not set`));
|
|
6001
6057
|
process.exit(1);
|
|
6002
6058
|
}
|
|
6003
6059
|
|
|
@@ -6011,7 +6067,7 @@ function registerConfig(program2) {
|
|
|
6011
6067
|
|
|
6012
6068
|
// src/commands/deploy/redirect.ts
|
|
6013
6069
|
import { existsSync as existsSync22, readFileSync as readFileSync19, writeFileSync as writeFileSync18 } from "fs";
|
|
6014
|
-
import
|
|
6070
|
+
import chalk75 from "chalk";
|
|
6015
6071
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
6016
6072
|
if (!window.location.pathname.endsWith('/')) {
|
|
6017
6073
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -6020,22 +6076,22 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
6020
6076
|
function redirect() {
|
|
6021
6077
|
const indexPath = "index.html";
|
|
6022
6078
|
if (!existsSync22(indexPath)) {
|
|
6023
|
-
console.log(
|
|
6079
|
+
console.log(chalk75.yellow("No index.html found"));
|
|
6024
6080
|
return;
|
|
6025
6081
|
}
|
|
6026
6082
|
const content = readFileSync19(indexPath, "utf-8");
|
|
6027
6083
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
6028
|
-
console.log(
|
|
6084
|
+
console.log(chalk75.dim("Trailing slash script already present"));
|
|
6029
6085
|
return;
|
|
6030
6086
|
}
|
|
6031
6087
|
const headCloseIndex = content.indexOf("</head>");
|
|
6032
6088
|
if (headCloseIndex === -1) {
|
|
6033
|
-
console.log(
|
|
6089
|
+
console.log(chalk75.red("Could not find </head> tag in index.html"));
|
|
6034
6090
|
return;
|
|
6035
6091
|
}
|
|
6036
6092
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
6037
6093
|
writeFileSync18(indexPath, newContent);
|
|
6038
|
-
console.log(
|
|
6094
|
+
console.log(chalk75.green("Added trailing slash redirect to index.html"));
|
|
6039
6095
|
}
|
|
6040
6096
|
|
|
6041
6097
|
// src/commands/registerDeploy.ts
|
|
@@ -6062,7 +6118,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
6062
6118
|
|
|
6063
6119
|
// src/commands/devlog/shared.ts
|
|
6064
6120
|
import { execSync as execSync18 } from "child_process";
|
|
6065
|
-
import
|
|
6121
|
+
import chalk76 from "chalk";
|
|
6066
6122
|
|
|
6067
6123
|
// src/shared/getRepoName.ts
|
|
6068
6124
|
import { existsSync as existsSync23, readFileSync as readFileSync20 } from "fs";
|
|
@@ -6171,13 +6227,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
6171
6227
|
}
|
|
6172
6228
|
function printCommitsWithFiles(commits, ignore2, verbose) {
|
|
6173
6229
|
for (const commit2 of commits) {
|
|
6174
|
-
console.log(` ${
|
|
6230
|
+
console.log(` ${chalk76.yellow(commit2.hash)} ${commit2.message}`);
|
|
6175
6231
|
if (verbose) {
|
|
6176
6232
|
const visibleFiles = commit2.files.filter(
|
|
6177
6233
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
6178
6234
|
);
|
|
6179
6235
|
for (const file of visibleFiles) {
|
|
6180
|
-
console.log(` ${
|
|
6236
|
+
console.log(` ${chalk76.dim(file)}`);
|
|
6181
6237
|
}
|
|
6182
6238
|
}
|
|
6183
6239
|
}
|
|
@@ -6202,15 +6258,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
6202
6258
|
}
|
|
6203
6259
|
|
|
6204
6260
|
// src/commands/devlog/list/printDateHeader.ts
|
|
6205
|
-
import
|
|
6261
|
+
import chalk77 from "chalk";
|
|
6206
6262
|
function printDateHeader(date, isSkipped, entries) {
|
|
6207
6263
|
if (isSkipped) {
|
|
6208
|
-
console.log(`${
|
|
6264
|
+
console.log(`${chalk77.bold.blue(date)} ${chalk77.dim("skipped")}`);
|
|
6209
6265
|
} else if (entries && entries.length > 0) {
|
|
6210
|
-
const entryInfo = entries.map((e) => `${
|
|
6211
|
-
console.log(`${
|
|
6266
|
+
const entryInfo = entries.map((e) => `${chalk77.green(e.version)} ${e.title}`).join(" | ");
|
|
6267
|
+
console.log(`${chalk77.bold.blue(date)} ${entryInfo}`);
|
|
6212
6268
|
} else {
|
|
6213
|
-
console.log(`${
|
|
6269
|
+
console.log(`${chalk77.bold.blue(date)} ${chalk77.red("\u26A0 devlog missing")}`);
|
|
6214
6270
|
}
|
|
6215
6271
|
}
|
|
6216
6272
|
|
|
@@ -6314,24 +6370,24 @@ function bumpVersion(version2, type) {
|
|
|
6314
6370
|
|
|
6315
6371
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
6316
6372
|
import { execSync as execSync21 } from "child_process";
|
|
6317
|
-
import
|
|
6373
|
+
import chalk79 from "chalk";
|
|
6318
6374
|
|
|
6319
6375
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
6320
|
-
import
|
|
6376
|
+
import chalk78 from "chalk";
|
|
6321
6377
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
6322
6378
|
if (conventional && firstHash) {
|
|
6323
6379
|
const version2 = getVersionAtCommit(firstHash);
|
|
6324
6380
|
if (version2) {
|
|
6325
|
-
console.log(`${
|
|
6381
|
+
console.log(`${chalk78.bold("version:")} ${stripToMinor(version2)}`);
|
|
6326
6382
|
} else {
|
|
6327
|
-
console.log(`${
|
|
6383
|
+
console.log(`${chalk78.bold("version:")} ${chalk78.red("unknown")}`);
|
|
6328
6384
|
}
|
|
6329
6385
|
} else if (patchVersion && minorVersion) {
|
|
6330
6386
|
console.log(
|
|
6331
|
-
`${
|
|
6387
|
+
`${chalk78.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
6332
6388
|
);
|
|
6333
6389
|
} else {
|
|
6334
|
-
console.log(`${
|
|
6390
|
+
console.log(`${chalk78.bold("version:")} v0.1 (initial)`);
|
|
6335
6391
|
}
|
|
6336
6392
|
}
|
|
6337
6393
|
|
|
@@ -6378,16 +6434,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
6378
6434
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
6379
6435
|
}
|
|
6380
6436
|
function logName(repoName) {
|
|
6381
|
-
console.log(`${
|
|
6437
|
+
console.log(`${chalk79.bold("name:")} ${repoName}`);
|
|
6382
6438
|
}
|
|
6383
6439
|
function displayNextEntry(ctx, targetDate, commits) {
|
|
6384
6440
|
logName(ctx.repoName);
|
|
6385
6441
|
printVersionInfo(ctx.config, ctx.lastInfo, commits[0]?.hash);
|
|
6386
|
-
console.log(
|
|
6442
|
+
console.log(chalk79.bold.blue(targetDate));
|
|
6387
6443
|
printCommitsWithFiles(commits, ctx.ignore, ctx.verbose);
|
|
6388
6444
|
}
|
|
6389
6445
|
function logNoCommits(lastInfo) {
|
|
6390
|
-
console.log(
|
|
6446
|
+
console.log(chalk79.dim(noCommitsMessage(!!lastInfo)));
|
|
6391
6447
|
}
|
|
6392
6448
|
|
|
6393
6449
|
// src/commands/devlog/next/index.ts
|
|
@@ -6428,11 +6484,11 @@ function next2(options2) {
|
|
|
6428
6484
|
import { execSync as execSync22 } from "child_process";
|
|
6429
6485
|
|
|
6430
6486
|
// src/commands/devlog/repos/printReposTable.ts
|
|
6431
|
-
import
|
|
6487
|
+
import chalk80 from "chalk";
|
|
6432
6488
|
function colorStatus(status2) {
|
|
6433
|
-
if (status2 === "missing") return
|
|
6434
|
-
if (status2 === "outdated") return
|
|
6435
|
-
return
|
|
6489
|
+
if (status2 === "missing") return chalk80.red(status2);
|
|
6490
|
+
if (status2 === "outdated") return chalk80.yellow(status2);
|
|
6491
|
+
return chalk80.green(status2);
|
|
6436
6492
|
}
|
|
6437
6493
|
function formatRow(row, nameWidth) {
|
|
6438
6494
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -6446,8 +6502,8 @@ function printReposTable(rows) {
|
|
|
6446
6502
|
"Last Devlog".padEnd(11),
|
|
6447
6503
|
"Status"
|
|
6448
6504
|
].join(" ");
|
|
6449
|
-
console.log(
|
|
6450
|
-
console.log(
|
|
6505
|
+
console.log(chalk80.dim(header));
|
|
6506
|
+
console.log(chalk80.dim("-".repeat(header.length)));
|
|
6451
6507
|
for (const row of rows) {
|
|
6452
6508
|
console.log(formatRow(row, nameWidth));
|
|
6453
6509
|
}
|
|
@@ -6505,14 +6561,14 @@ function repos(options2) {
|
|
|
6505
6561
|
// src/commands/devlog/skip.ts
|
|
6506
6562
|
import { writeFileSync as writeFileSync19 } from "fs";
|
|
6507
6563
|
import { join as join22 } from "path";
|
|
6508
|
-
import
|
|
6564
|
+
import chalk81 from "chalk";
|
|
6509
6565
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
6510
6566
|
function getBlogConfigPath() {
|
|
6511
6567
|
return join22(BLOG_REPO_ROOT, "assist.yml");
|
|
6512
6568
|
}
|
|
6513
6569
|
function skip(date) {
|
|
6514
6570
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
6515
|
-
console.log(
|
|
6571
|
+
console.log(chalk81.red("Invalid date format. Use YYYY-MM-DD"));
|
|
6516
6572
|
process.exit(1);
|
|
6517
6573
|
}
|
|
6518
6574
|
const repoName = getRepoName();
|
|
@@ -6523,7 +6579,7 @@ function skip(date) {
|
|
|
6523
6579
|
const skipDays = skip2[repoName] ?? [];
|
|
6524
6580
|
if (skipDays.includes(date)) {
|
|
6525
6581
|
console.log(
|
|
6526
|
-
|
|
6582
|
+
chalk81.yellow(`${date} is already in skip list for ${repoName}`)
|
|
6527
6583
|
);
|
|
6528
6584
|
return;
|
|
6529
6585
|
}
|
|
@@ -6533,20 +6589,20 @@ function skip(date) {
|
|
|
6533
6589
|
devlog.skip = skip2;
|
|
6534
6590
|
config.devlog = devlog;
|
|
6535
6591
|
writeFileSync19(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
6536
|
-
console.log(
|
|
6592
|
+
console.log(chalk81.green(`Added ${date} to skip list for ${repoName}`));
|
|
6537
6593
|
}
|
|
6538
6594
|
|
|
6539
6595
|
// src/commands/devlog/version.ts
|
|
6540
|
-
import
|
|
6596
|
+
import chalk82 from "chalk";
|
|
6541
6597
|
function version() {
|
|
6542
6598
|
const config = loadConfig();
|
|
6543
6599
|
const name = getRepoName();
|
|
6544
6600
|
const lastInfo = getLastVersionInfo(name, config);
|
|
6545
6601
|
const lastVersion = lastInfo?.version ?? null;
|
|
6546
6602
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
6547
|
-
console.log(`${
|
|
6548
|
-
console.log(`${
|
|
6549
|
-
console.log(`${
|
|
6603
|
+
console.log(`${chalk82.bold("name:")} ${name}`);
|
|
6604
|
+
console.log(`${chalk82.bold("last:")} ${lastVersion ?? chalk82.dim("none")}`);
|
|
6605
|
+
console.log(`${chalk82.bold("next:")} ${nextVersion ?? chalk82.dim("none")}`);
|
|
6550
6606
|
}
|
|
6551
6607
|
|
|
6552
6608
|
// src/commands/registerDevlog.ts
|
|
@@ -6570,7 +6626,7 @@ function registerDevlog(program2) {
|
|
|
6570
6626
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
6571
6627
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
6572
6628
|
import { join as join23 } from "path";
|
|
6573
|
-
import
|
|
6629
|
+
import chalk83 from "chalk";
|
|
6574
6630
|
|
|
6575
6631
|
// src/shared/findRepoRoot.ts
|
|
6576
6632
|
import { existsSync as existsSync24 } from "fs";
|
|
@@ -6633,14 +6689,14 @@ function checkBuildLocks(startDir) {
|
|
|
6633
6689
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
6634
6690
|
if (locked) {
|
|
6635
6691
|
console.error(
|
|
6636
|
-
|
|
6692
|
+
chalk83.red("Build output locked (is VS debugging?): ") + locked
|
|
6637
6693
|
);
|
|
6638
6694
|
process.exit(1);
|
|
6639
6695
|
}
|
|
6640
6696
|
}
|
|
6641
6697
|
async function checkBuildLocksCommand() {
|
|
6642
6698
|
checkBuildLocks();
|
|
6643
|
-
console.log(
|
|
6699
|
+
console.log(chalk83.green("No build locks detected"));
|
|
6644
6700
|
}
|
|
6645
6701
|
|
|
6646
6702
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -6739,30 +6795,30 @@ function escapeRegex(s) {
|
|
|
6739
6795
|
}
|
|
6740
6796
|
|
|
6741
6797
|
// src/commands/dotnet/printTree.ts
|
|
6742
|
-
import
|
|
6798
|
+
import chalk84 from "chalk";
|
|
6743
6799
|
function printNodes(nodes, prefix2) {
|
|
6744
6800
|
for (let i = 0; i < nodes.length; i++) {
|
|
6745
6801
|
const isLast = i === nodes.length - 1;
|
|
6746
6802
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
6747
6803
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
6748
6804
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
6749
|
-
const label2 = isMissing ?
|
|
6805
|
+
const label2 = isMissing ? chalk84.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
6750
6806
|
console.log(`${prefix2}${connector}${label2}`);
|
|
6751
6807
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
6752
6808
|
}
|
|
6753
6809
|
}
|
|
6754
6810
|
function printTree(tree, totalCount, solutions) {
|
|
6755
|
-
console.log(
|
|
6756
|
-
console.log(
|
|
6811
|
+
console.log(chalk84.bold("\nProject Dependency Tree"));
|
|
6812
|
+
console.log(chalk84.cyan(tree.relativePath));
|
|
6757
6813
|
printNodes(tree.children, "");
|
|
6758
|
-
console.log(
|
|
6814
|
+
console.log(chalk84.dim(`
|
|
6759
6815
|
${totalCount} projects total (including root)`));
|
|
6760
|
-
console.log(
|
|
6816
|
+
console.log(chalk84.bold("\nSolution Membership"));
|
|
6761
6817
|
if (solutions.length === 0) {
|
|
6762
|
-
console.log(
|
|
6818
|
+
console.log(chalk84.yellow(" Not found in any .sln"));
|
|
6763
6819
|
} else {
|
|
6764
6820
|
for (const sln of solutions) {
|
|
6765
|
-
console.log(` ${
|
|
6821
|
+
console.log(` ${chalk84.green(sln)}`);
|
|
6766
6822
|
}
|
|
6767
6823
|
}
|
|
6768
6824
|
console.log();
|
|
@@ -6791,16 +6847,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
6791
6847
|
// src/commands/dotnet/resolveCsproj.ts
|
|
6792
6848
|
import { existsSync as existsSync25 } from "fs";
|
|
6793
6849
|
import path24 from "path";
|
|
6794
|
-
import
|
|
6850
|
+
import chalk85 from "chalk";
|
|
6795
6851
|
function resolveCsproj(csprojPath) {
|
|
6796
6852
|
const resolved = path24.resolve(csprojPath);
|
|
6797
6853
|
if (!existsSync25(resolved)) {
|
|
6798
|
-
console.error(
|
|
6854
|
+
console.error(chalk85.red(`File not found: ${resolved}`));
|
|
6799
6855
|
process.exit(1);
|
|
6800
6856
|
}
|
|
6801
6857
|
const repoRoot = findRepoRoot(path24.dirname(resolved));
|
|
6802
6858
|
if (!repoRoot) {
|
|
6803
|
-
console.error(
|
|
6859
|
+
console.error(chalk85.red("Could not find git repository root"));
|
|
6804
6860
|
process.exit(1);
|
|
6805
6861
|
}
|
|
6806
6862
|
return { resolved, repoRoot };
|
|
@@ -6850,12 +6906,12 @@ function getChangedCsFiles(scope) {
|
|
|
6850
6906
|
}
|
|
6851
6907
|
|
|
6852
6908
|
// src/commands/dotnet/inSln.ts
|
|
6853
|
-
import
|
|
6909
|
+
import chalk86 from "chalk";
|
|
6854
6910
|
async function inSln(csprojPath) {
|
|
6855
6911
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
6856
6912
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
6857
6913
|
if (solutions.length === 0) {
|
|
6858
|
-
console.log(
|
|
6914
|
+
console.log(chalk86.yellow("Not found in any .sln file"));
|
|
6859
6915
|
process.exit(1);
|
|
6860
6916
|
}
|
|
6861
6917
|
for (const sln of solutions) {
|
|
@@ -6864,7 +6920,7 @@ async function inSln(csprojPath) {
|
|
|
6864
6920
|
}
|
|
6865
6921
|
|
|
6866
6922
|
// src/commands/dotnet/inspect.ts
|
|
6867
|
-
import
|
|
6923
|
+
import chalk92 from "chalk";
|
|
6868
6924
|
|
|
6869
6925
|
// src/shared/formatElapsed.ts
|
|
6870
6926
|
function formatElapsed(ms) {
|
|
@@ -6876,12 +6932,12 @@ function formatElapsed(ms) {
|
|
|
6876
6932
|
}
|
|
6877
6933
|
|
|
6878
6934
|
// src/commands/dotnet/displayIssues.ts
|
|
6879
|
-
import
|
|
6935
|
+
import chalk87 from "chalk";
|
|
6880
6936
|
var SEVERITY_COLOR = {
|
|
6881
|
-
ERROR:
|
|
6882
|
-
WARNING:
|
|
6883
|
-
SUGGESTION:
|
|
6884
|
-
HINT:
|
|
6937
|
+
ERROR: chalk87.red,
|
|
6938
|
+
WARNING: chalk87.yellow,
|
|
6939
|
+
SUGGESTION: chalk87.cyan,
|
|
6940
|
+
HINT: chalk87.dim
|
|
6885
6941
|
};
|
|
6886
6942
|
function groupByFile(issues) {
|
|
6887
6943
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -6897,15 +6953,15 @@ function groupByFile(issues) {
|
|
|
6897
6953
|
}
|
|
6898
6954
|
function displayIssues(issues) {
|
|
6899
6955
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
6900
|
-
console.log(
|
|
6956
|
+
console.log(chalk87.bold(file));
|
|
6901
6957
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
6902
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
6958
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk87.white;
|
|
6903
6959
|
console.log(
|
|
6904
|
-
` ${
|
|
6960
|
+
` ${chalk87.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
6905
6961
|
);
|
|
6906
6962
|
}
|
|
6907
6963
|
}
|
|
6908
|
-
console.log(
|
|
6964
|
+
console.log(chalk87.dim(`
|
|
6909
6965
|
${issues.length} issue(s) found`));
|
|
6910
6966
|
}
|
|
6911
6967
|
|
|
@@ -6964,12 +7020,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
6964
7020
|
// src/commands/dotnet/resolveSolution.ts
|
|
6965
7021
|
import { existsSync as existsSync26 } from "fs";
|
|
6966
7022
|
import path25 from "path";
|
|
6967
|
-
import
|
|
7023
|
+
import chalk89 from "chalk";
|
|
6968
7024
|
|
|
6969
7025
|
// src/commands/dotnet/findSolution.ts
|
|
6970
7026
|
import { readdirSync as readdirSync4 } from "fs";
|
|
6971
7027
|
import { dirname as dirname16, join as join24 } from "path";
|
|
6972
|
-
import
|
|
7028
|
+
import chalk88 from "chalk";
|
|
6973
7029
|
function findSlnInDir(dir) {
|
|
6974
7030
|
try {
|
|
6975
7031
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join24(dir, f));
|
|
@@ -6985,17 +7041,17 @@ function findSolution() {
|
|
|
6985
7041
|
const slnFiles = findSlnInDir(current);
|
|
6986
7042
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
6987
7043
|
if (slnFiles.length > 1) {
|
|
6988
|
-
console.error(
|
|
7044
|
+
console.error(chalk88.red(`Multiple .sln files found in ${current}:`));
|
|
6989
7045
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
6990
7046
|
console.error(
|
|
6991
|
-
|
|
7047
|
+
chalk88.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
6992
7048
|
);
|
|
6993
7049
|
process.exit(1);
|
|
6994
7050
|
}
|
|
6995
7051
|
if (current === ceiling) break;
|
|
6996
7052
|
current = dirname16(current);
|
|
6997
7053
|
}
|
|
6998
|
-
console.error(
|
|
7054
|
+
console.error(chalk88.red("No .sln file found between cwd and repo root"));
|
|
6999
7055
|
process.exit(1);
|
|
7000
7056
|
}
|
|
7001
7057
|
|
|
@@ -7004,7 +7060,7 @@ function resolveSolution(sln) {
|
|
|
7004
7060
|
if (sln) {
|
|
7005
7061
|
const resolved = path25.resolve(sln);
|
|
7006
7062
|
if (!existsSync26(resolved)) {
|
|
7007
|
-
console.error(
|
|
7063
|
+
console.error(chalk89.red(`Solution file not found: ${resolved}`));
|
|
7008
7064
|
process.exit(1);
|
|
7009
7065
|
}
|
|
7010
7066
|
return resolved;
|
|
@@ -7046,14 +7102,14 @@ import { execSync as execSync24 } from "child_process";
|
|
|
7046
7102
|
import { existsSync as existsSync27, readFileSync as readFileSync24, unlinkSync as unlinkSync5 } from "fs";
|
|
7047
7103
|
import { tmpdir as tmpdir2 } from "os";
|
|
7048
7104
|
import path26 from "path";
|
|
7049
|
-
import
|
|
7105
|
+
import chalk90 from "chalk";
|
|
7050
7106
|
function assertJbInstalled() {
|
|
7051
7107
|
try {
|
|
7052
7108
|
execSync24("jb inspectcode --version", { stdio: "pipe" });
|
|
7053
7109
|
} catch {
|
|
7054
|
-
console.error(
|
|
7110
|
+
console.error(chalk90.red("jb is not installed. Install with:"));
|
|
7055
7111
|
console.error(
|
|
7056
|
-
|
|
7112
|
+
chalk90.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
7057
7113
|
);
|
|
7058
7114
|
process.exit(1);
|
|
7059
7115
|
}
|
|
@@ -7071,11 +7127,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
7071
7127
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
7072
7128
|
process.stderr.write(err.stderr);
|
|
7073
7129
|
}
|
|
7074
|
-
console.error(
|
|
7130
|
+
console.error(chalk90.red("jb inspectcode failed"));
|
|
7075
7131
|
process.exit(1);
|
|
7076
7132
|
}
|
|
7077
7133
|
if (!existsSync27(reportPath)) {
|
|
7078
|
-
console.error(
|
|
7134
|
+
console.error(chalk90.red("Report file not generated"));
|
|
7079
7135
|
process.exit(1);
|
|
7080
7136
|
}
|
|
7081
7137
|
const xml = readFileSync24(reportPath, "utf-8");
|
|
@@ -7085,7 +7141,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
7085
7141
|
|
|
7086
7142
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
7087
7143
|
import { execSync as execSync25 } from "child_process";
|
|
7088
|
-
import
|
|
7144
|
+
import chalk91 from "chalk";
|
|
7089
7145
|
function resolveMsbuildPath() {
|
|
7090
7146
|
const config = loadConfig();
|
|
7091
7147
|
const buildConfig = config.run?.find((r) => r.name === "build");
|
|
@@ -7096,9 +7152,9 @@ function assertMsbuildInstalled() {
|
|
|
7096
7152
|
try {
|
|
7097
7153
|
execSync25(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
7098
7154
|
} catch {
|
|
7099
|
-
console.error(
|
|
7155
|
+
console.error(chalk91.red(`msbuild not found at: ${msbuild}`));
|
|
7100
7156
|
console.error(
|
|
7101
|
-
|
|
7157
|
+
chalk91.yellow(
|
|
7102
7158
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
7103
7159
|
)
|
|
7104
7160
|
);
|
|
@@ -7145,17 +7201,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
7145
7201
|
// src/commands/dotnet/inspect.ts
|
|
7146
7202
|
function logScope(changedFiles) {
|
|
7147
7203
|
if (changedFiles === null) {
|
|
7148
|
-
console.log(
|
|
7204
|
+
console.log(chalk92.dim("Inspecting full solution..."));
|
|
7149
7205
|
} else {
|
|
7150
7206
|
console.log(
|
|
7151
|
-
|
|
7207
|
+
chalk92.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
7152
7208
|
);
|
|
7153
7209
|
}
|
|
7154
7210
|
}
|
|
7155
7211
|
function reportResults(issues, elapsed) {
|
|
7156
7212
|
if (issues.length > 0) displayIssues(issues);
|
|
7157
|
-
else console.log(
|
|
7158
|
-
console.log(
|
|
7213
|
+
else console.log(chalk92.green("No issues found"));
|
|
7214
|
+
console.log(chalk92.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
7159
7215
|
if (issues.length > 0) process.exit(1);
|
|
7160
7216
|
}
|
|
7161
7217
|
async function inspect(sln, options2) {
|
|
@@ -7166,7 +7222,7 @@ async function inspect(sln, options2) {
|
|
|
7166
7222
|
const scope = parseScope(options2.scope);
|
|
7167
7223
|
const changedFiles = getChangedCsFiles(scope);
|
|
7168
7224
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
7169
|
-
console.log(
|
|
7225
|
+
console.log(chalk92.green("No changed .cs files found"));
|
|
7170
7226
|
return;
|
|
7171
7227
|
}
|
|
7172
7228
|
logScope(changedFiles);
|
|
@@ -7192,7 +7248,7 @@ function registerDotnet(program2) {
|
|
|
7192
7248
|
}
|
|
7193
7249
|
|
|
7194
7250
|
// src/commands/jira/acceptanceCriteria.ts
|
|
7195
|
-
import
|
|
7251
|
+
import chalk94 from "chalk";
|
|
7196
7252
|
|
|
7197
7253
|
// src/commands/jira/adfToText.ts
|
|
7198
7254
|
function renderInline(node) {
|
|
@@ -7253,7 +7309,7 @@ function adfToText(doc) {
|
|
|
7253
7309
|
|
|
7254
7310
|
// src/commands/jira/fetchIssue.ts
|
|
7255
7311
|
import { execSync as execSync26 } from "child_process";
|
|
7256
|
-
import
|
|
7312
|
+
import chalk93 from "chalk";
|
|
7257
7313
|
function fetchIssue(issueKey, fields) {
|
|
7258
7314
|
let result;
|
|
7259
7315
|
try {
|
|
@@ -7266,15 +7322,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
7266
7322
|
const stderr = error.stderr;
|
|
7267
7323
|
if (stderr.includes("unauthorized")) {
|
|
7268
7324
|
console.error(
|
|
7269
|
-
|
|
7325
|
+
chalk93.red("Jira authentication expired."),
|
|
7270
7326
|
"Run",
|
|
7271
|
-
|
|
7327
|
+
chalk93.cyan("assist jira auth"),
|
|
7272
7328
|
"to re-authenticate."
|
|
7273
7329
|
);
|
|
7274
7330
|
process.exit(1);
|
|
7275
7331
|
}
|
|
7276
7332
|
}
|
|
7277
|
-
console.error(
|
|
7333
|
+
console.error(chalk93.red(`Failed to fetch ${issueKey}.`));
|
|
7278
7334
|
process.exit(1);
|
|
7279
7335
|
}
|
|
7280
7336
|
return JSON.parse(result);
|
|
@@ -7288,7 +7344,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
7288
7344
|
const parsed = fetchIssue(issueKey, field);
|
|
7289
7345
|
const acValue = parsed?.fields?.[field];
|
|
7290
7346
|
if (!acValue) {
|
|
7291
|
-
console.log(
|
|
7347
|
+
console.log(chalk94.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
7292
7348
|
return;
|
|
7293
7349
|
}
|
|
7294
7350
|
if (typeof acValue === "string") {
|
|
@@ -7383,14 +7439,14 @@ async function jiraAuth() {
|
|
|
7383
7439
|
}
|
|
7384
7440
|
|
|
7385
7441
|
// src/commands/jira/viewIssue.ts
|
|
7386
|
-
import
|
|
7442
|
+
import chalk95 from "chalk";
|
|
7387
7443
|
function viewIssue(issueKey) {
|
|
7388
7444
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
7389
7445
|
const fields = parsed?.fields;
|
|
7390
7446
|
const summary = fields?.summary;
|
|
7391
7447
|
const description = fields?.description;
|
|
7392
7448
|
if (summary) {
|
|
7393
|
-
console.log(
|
|
7449
|
+
console.log(chalk95.bold(summary));
|
|
7394
7450
|
}
|
|
7395
7451
|
if (description) {
|
|
7396
7452
|
if (summary) console.log();
|
|
@@ -7404,7 +7460,7 @@ function viewIssue(issueKey) {
|
|
|
7404
7460
|
}
|
|
7405
7461
|
if (!summary && !description) {
|
|
7406
7462
|
console.log(
|
|
7407
|
-
|
|
7463
|
+
chalk95.yellow(`No summary or description found on ${issueKey}.`)
|
|
7408
7464
|
);
|
|
7409
7465
|
}
|
|
7410
7466
|
}
|
|
@@ -7418,7 +7474,7 @@ function registerJira(program2) {
|
|
|
7418
7474
|
}
|
|
7419
7475
|
|
|
7420
7476
|
// src/commands/news/add/index.ts
|
|
7421
|
-
import
|
|
7477
|
+
import chalk96 from "chalk";
|
|
7422
7478
|
import enquirer8 from "enquirer";
|
|
7423
7479
|
async function add2(url) {
|
|
7424
7480
|
if (!url) {
|
|
@@ -7441,17 +7497,17 @@ async function add2(url) {
|
|
|
7441
7497
|
const news = config.news ?? {};
|
|
7442
7498
|
const feeds = news.feeds ?? [];
|
|
7443
7499
|
if (feeds.includes(url)) {
|
|
7444
|
-
console.log(
|
|
7500
|
+
console.log(chalk96.yellow("Feed already exists in config"));
|
|
7445
7501
|
return;
|
|
7446
7502
|
}
|
|
7447
7503
|
feeds.push(url);
|
|
7448
7504
|
config.news = { ...news, feeds };
|
|
7449
7505
|
saveGlobalConfig(config);
|
|
7450
|
-
console.log(
|
|
7506
|
+
console.log(chalk96.green(`Added feed: ${url}`));
|
|
7451
7507
|
}
|
|
7452
7508
|
|
|
7453
7509
|
// src/commands/news/web/handleRequest.ts
|
|
7454
|
-
import
|
|
7510
|
+
import chalk97 from "chalk";
|
|
7455
7511
|
|
|
7456
7512
|
// src/commands/news/web/shared.ts
|
|
7457
7513
|
import { decodeHTML } from "entities";
|
|
@@ -7587,17 +7643,17 @@ function prefetch() {
|
|
|
7587
7643
|
const config = loadConfig();
|
|
7588
7644
|
const total = config.news.feeds.length;
|
|
7589
7645
|
if (total === 0) return;
|
|
7590
|
-
process.stdout.write(
|
|
7646
|
+
process.stdout.write(chalk97.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
7591
7647
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
7592
7648
|
const width = 20;
|
|
7593
7649
|
const filled = Math.round(done2 / t * width);
|
|
7594
7650
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
7595
7651
|
process.stdout.write(
|
|
7596
|
-
`\r${
|
|
7652
|
+
`\r${chalk97.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
7597
7653
|
);
|
|
7598
7654
|
}).then((items) => {
|
|
7599
7655
|
process.stdout.write(
|
|
7600
|
-
`\r${
|
|
7656
|
+
`\r${chalk97.green(`Fetched ${items.length} items from ${total} feed(s)`)}
|
|
7601
7657
|
`
|
|
7602
7658
|
);
|
|
7603
7659
|
cachedItems = items;
|
|
@@ -7958,20 +8014,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
7958
8014
|
}
|
|
7959
8015
|
|
|
7960
8016
|
// src/commands/prs/listComments/printComments.ts
|
|
7961
|
-
import
|
|
8017
|
+
import chalk98 from "chalk";
|
|
7962
8018
|
function formatForHuman(comment3) {
|
|
7963
8019
|
if (comment3.type === "review") {
|
|
7964
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
8020
|
+
const stateColor = comment3.state === "APPROVED" ? chalk98.green : comment3.state === "CHANGES_REQUESTED" ? chalk98.red : chalk98.yellow;
|
|
7965
8021
|
return [
|
|
7966
|
-
`${
|
|
8022
|
+
`${chalk98.cyan("Review")} by ${chalk98.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
7967
8023
|
comment3.body,
|
|
7968
8024
|
""
|
|
7969
8025
|
].join("\n");
|
|
7970
8026
|
}
|
|
7971
8027
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
7972
8028
|
return [
|
|
7973
|
-
`${
|
|
7974
|
-
|
|
8029
|
+
`${chalk98.cyan("Line comment")} by ${chalk98.bold(comment3.user)} on ${chalk98.dim(`${comment3.path}${location}`)}`,
|
|
8030
|
+
chalk98.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
7975
8031
|
comment3.body,
|
|
7976
8032
|
""
|
|
7977
8033
|
].join("\n");
|
|
@@ -8061,13 +8117,13 @@ import { execSync as execSync33 } from "child_process";
|
|
|
8061
8117
|
import enquirer9 from "enquirer";
|
|
8062
8118
|
|
|
8063
8119
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
8064
|
-
import
|
|
8120
|
+
import chalk99 from "chalk";
|
|
8065
8121
|
var STATUS_MAP = {
|
|
8066
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
8067
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
8122
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk99.magenta("merged"), date: pr.mergedAt } : null,
|
|
8123
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk99.red("closed"), date: pr.closedAt } : null
|
|
8068
8124
|
};
|
|
8069
8125
|
function defaultStatus(pr) {
|
|
8070
|
-
return { label:
|
|
8126
|
+
return { label: chalk99.green("opened"), date: pr.createdAt };
|
|
8071
8127
|
}
|
|
8072
8128
|
function getStatus2(pr) {
|
|
8073
8129
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -8076,11 +8132,11 @@ function formatDate(dateStr) {
|
|
|
8076
8132
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
8077
8133
|
}
|
|
8078
8134
|
function formatPrHeader(pr, status2) {
|
|
8079
|
-
return `${
|
|
8135
|
+
return `${chalk99.cyan(`#${pr.number}`)} ${pr.title} ${chalk99.dim(`(${pr.author.login},`)} ${status2.label} ${chalk99.dim(`${formatDate(status2.date)})`)}`;
|
|
8080
8136
|
}
|
|
8081
8137
|
function logPrDetails(pr) {
|
|
8082
8138
|
console.log(
|
|
8083
|
-
|
|
8139
|
+
chalk99.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
8084
8140
|
);
|
|
8085
8141
|
console.log();
|
|
8086
8142
|
}
|
|
@@ -8246,10 +8302,10 @@ function registerPrs(program2) {
|
|
|
8246
8302
|
}
|
|
8247
8303
|
|
|
8248
8304
|
// src/commands/ravendb/ravendbAuth.ts
|
|
8249
|
-
import
|
|
8305
|
+
import chalk105 from "chalk";
|
|
8250
8306
|
|
|
8251
8307
|
// src/shared/createConnectionAuth.ts
|
|
8252
|
-
import
|
|
8308
|
+
import chalk100 from "chalk";
|
|
8253
8309
|
function listConnections(connections, format2) {
|
|
8254
8310
|
if (connections.length === 0) {
|
|
8255
8311
|
console.log("No connections configured.");
|
|
@@ -8262,7 +8318,7 @@ function listConnections(connections, format2) {
|
|
|
8262
8318
|
function removeConnection(connections, name, save) {
|
|
8263
8319
|
const filtered = connections.filter((c) => c.name !== name);
|
|
8264
8320
|
if (filtered.length === connections.length) {
|
|
8265
|
-
console.error(
|
|
8321
|
+
console.error(chalk100.red(`Connection "${name}" not found.`));
|
|
8266
8322
|
process.exit(1);
|
|
8267
8323
|
}
|
|
8268
8324
|
save(filtered);
|
|
@@ -8308,15 +8364,15 @@ function saveConnections(connections) {
|
|
|
8308
8364
|
}
|
|
8309
8365
|
|
|
8310
8366
|
// src/commands/ravendb/promptConnection.ts
|
|
8311
|
-
import
|
|
8367
|
+
import chalk103 from "chalk";
|
|
8312
8368
|
|
|
8313
8369
|
// src/commands/ravendb/selectOpSecret.ts
|
|
8314
|
-
import
|
|
8370
|
+
import chalk102 from "chalk";
|
|
8315
8371
|
import Enquirer2 from "enquirer";
|
|
8316
8372
|
|
|
8317
8373
|
// src/commands/ravendb/searchItems.ts
|
|
8318
8374
|
import { execSync as execSync35 } from "child_process";
|
|
8319
|
-
import
|
|
8375
|
+
import chalk101 from "chalk";
|
|
8320
8376
|
function opExec(args) {
|
|
8321
8377
|
return execSync35(`op ${args}`, {
|
|
8322
8378
|
encoding: "utf-8",
|
|
@@ -8329,7 +8385,7 @@ function searchItems(search2) {
|
|
|
8329
8385
|
items = JSON.parse(opExec("item list --format=json"));
|
|
8330
8386
|
} catch {
|
|
8331
8387
|
console.error(
|
|
8332
|
-
|
|
8388
|
+
chalk101.red(
|
|
8333
8389
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
8334
8390
|
)
|
|
8335
8391
|
);
|
|
@@ -8343,7 +8399,7 @@ function getItemFields(itemId) {
|
|
|
8343
8399
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
8344
8400
|
return item.fields.filter((f) => f.reference && f.label);
|
|
8345
8401
|
} catch {
|
|
8346
|
-
console.error(
|
|
8402
|
+
console.error(chalk101.red("Failed to get item details from 1Password."));
|
|
8347
8403
|
process.exit(1);
|
|
8348
8404
|
}
|
|
8349
8405
|
}
|
|
@@ -8362,7 +8418,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
8362
8418
|
}).run();
|
|
8363
8419
|
const items = searchItems(search2);
|
|
8364
8420
|
if (items.length === 0) {
|
|
8365
|
-
console.error(
|
|
8421
|
+
console.error(chalk102.red(`No items found matching "${search2}".`));
|
|
8366
8422
|
process.exit(1);
|
|
8367
8423
|
}
|
|
8368
8424
|
const itemId = await selectOne(
|
|
@@ -8371,7 +8427,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
8371
8427
|
);
|
|
8372
8428
|
const fields = getItemFields(itemId);
|
|
8373
8429
|
if (fields.length === 0) {
|
|
8374
|
-
console.error(
|
|
8430
|
+
console.error(chalk102.red("No fields with references found on this item."));
|
|
8375
8431
|
process.exit(1);
|
|
8376
8432
|
}
|
|
8377
8433
|
const ref = await selectOne(
|
|
@@ -8385,7 +8441,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
8385
8441
|
async function promptConnection(existingNames) {
|
|
8386
8442
|
const name = await promptInput("name", "Connection name:");
|
|
8387
8443
|
if (existingNames.includes(name)) {
|
|
8388
|
-
console.error(
|
|
8444
|
+
console.error(chalk103.red(`Connection "${name}" already exists.`));
|
|
8389
8445
|
process.exit(1);
|
|
8390
8446
|
}
|
|
8391
8447
|
const url = await promptInput(
|
|
@@ -8394,22 +8450,22 @@ async function promptConnection(existingNames) {
|
|
|
8394
8450
|
);
|
|
8395
8451
|
const database = await promptInput("database", "Database name:");
|
|
8396
8452
|
if (!name || !url || !database) {
|
|
8397
|
-
console.error(
|
|
8453
|
+
console.error(chalk103.red("All fields are required."));
|
|
8398
8454
|
process.exit(1);
|
|
8399
8455
|
}
|
|
8400
8456
|
const apiKeyRef = await selectOpSecret();
|
|
8401
|
-
console.log(
|
|
8457
|
+
console.log(chalk103.dim(`Using: ${apiKeyRef}`));
|
|
8402
8458
|
return { name, url, database, apiKeyRef };
|
|
8403
8459
|
}
|
|
8404
8460
|
|
|
8405
8461
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
8406
|
-
import
|
|
8462
|
+
import chalk104 from "chalk";
|
|
8407
8463
|
function ravendbSetConnection(name) {
|
|
8408
8464
|
const raw = loadGlobalConfigRaw();
|
|
8409
8465
|
const ravendb = raw.ravendb ?? {};
|
|
8410
8466
|
const connections = ravendb.connections ?? [];
|
|
8411
8467
|
if (!connections.some((c) => c.name === name)) {
|
|
8412
|
-
console.error(
|
|
8468
|
+
console.error(chalk104.red(`Connection "${name}" not found.`));
|
|
8413
8469
|
console.error(
|
|
8414
8470
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
8415
8471
|
);
|
|
@@ -8425,16 +8481,16 @@ function ravendbSetConnection(name) {
|
|
|
8425
8481
|
var ravendbAuth = createConnectionAuth({
|
|
8426
8482
|
load: loadConnections,
|
|
8427
8483
|
save: saveConnections,
|
|
8428
|
-
format: (c) => `${
|
|
8484
|
+
format: (c) => `${chalk105.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
8429
8485
|
promptNew: promptConnection,
|
|
8430
8486
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
8431
8487
|
});
|
|
8432
8488
|
|
|
8433
8489
|
// src/commands/ravendb/ravendbCollections.ts
|
|
8434
|
-
import
|
|
8490
|
+
import chalk109 from "chalk";
|
|
8435
8491
|
|
|
8436
8492
|
// src/commands/ravendb/ravenFetch.ts
|
|
8437
|
-
import
|
|
8493
|
+
import chalk107 from "chalk";
|
|
8438
8494
|
|
|
8439
8495
|
// src/commands/ravendb/getAccessToken.ts
|
|
8440
8496
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -8471,10 +8527,10 @@ ${errorText}`
|
|
|
8471
8527
|
|
|
8472
8528
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
8473
8529
|
import { execSync as execSync36 } from "child_process";
|
|
8474
|
-
import
|
|
8530
|
+
import chalk106 from "chalk";
|
|
8475
8531
|
function resolveOpSecret(reference) {
|
|
8476
8532
|
if (!reference.startsWith("op://")) {
|
|
8477
|
-
console.error(
|
|
8533
|
+
console.error(chalk106.red(`Invalid secret reference: must start with op://`));
|
|
8478
8534
|
process.exit(1);
|
|
8479
8535
|
}
|
|
8480
8536
|
try {
|
|
@@ -8484,7 +8540,7 @@ function resolveOpSecret(reference) {
|
|
|
8484
8540
|
}).trim();
|
|
8485
8541
|
} catch {
|
|
8486
8542
|
console.error(
|
|
8487
|
-
|
|
8543
|
+
chalk106.red(
|
|
8488
8544
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
8489
8545
|
)
|
|
8490
8546
|
);
|
|
@@ -8511,7 +8567,7 @@ async function ravenFetch(connection, path50) {
|
|
|
8511
8567
|
if (!response.ok) {
|
|
8512
8568
|
const body = await response.text();
|
|
8513
8569
|
console.error(
|
|
8514
|
-
|
|
8570
|
+
chalk107.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
8515
8571
|
);
|
|
8516
8572
|
console.error(body.substring(0, 500));
|
|
8517
8573
|
process.exit(1);
|
|
@@ -8520,7 +8576,7 @@ async function ravenFetch(connection, path50) {
|
|
|
8520
8576
|
}
|
|
8521
8577
|
|
|
8522
8578
|
// src/commands/ravendb/resolveConnection.ts
|
|
8523
|
-
import
|
|
8579
|
+
import chalk108 from "chalk";
|
|
8524
8580
|
function loadRavendb() {
|
|
8525
8581
|
const raw = loadGlobalConfigRaw();
|
|
8526
8582
|
const ravendb = raw.ravendb;
|
|
@@ -8534,7 +8590,7 @@ function resolveConnection(name) {
|
|
|
8534
8590
|
const connectionName = name ?? defaultConnection;
|
|
8535
8591
|
if (!connectionName) {
|
|
8536
8592
|
console.error(
|
|
8537
|
-
|
|
8593
|
+
chalk108.red(
|
|
8538
8594
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
8539
8595
|
)
|
|
8540
8596
|
);
|
|
@@ -8542,7 +8598,7 @@ function resolveConnection(name) {
|
|
|
8542
8598
|
}
|
|
8543
8599
|
const connection = connections.find((c) => c.name === connectionName);
|
|
8544
8600
|
if (!connection) {
|
|
8545
|
-
console.error(
|
|
8601
|
+
console.error(chalk108.red(`Connection "${connectionName}" not found.`));
|
|
8546
8602
|
console.error(
|
|
8547
8603
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
8548
8604
|
);
|
|
@@ -8573,15 +8629,15 @@ async function ravendbCollections(connectionName) {
|
|
|
8573
8629
|
return;
|
|
8574
8630
|
}
|
|
8575
8631
|
for (const c of collections) {
|
|
8576
|
-
console.log(`${
|
|
8632
|
+
console.log(`${chalk109.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
8577
8633
|
}
|
|
8578
8634
|
}
|
|
8579
8635
|
|
|
8580
8636
|
// src/commands/ravendb/ravendbQuery.ts
|
|
8581
|
-
import
|
|
8637
|
+
import chalk111 from "chalk";
|
|
8582
8638
|
|
|
8583
8639
|
// src/commands/ravendb/fetchAllPages.ts
|
|
8584
|
-
import
|
|
8640
|
+
import chalk110 from "chalk";
|
|
8585
8641
|
|
|
8586
8642
|
// src/commands/ravendb/buildQueryPath.ts
|
|
8587
8643
|
function buildQueryPath(opts) {
|
|
@@ -8619,7 +8675,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
8619
8675
|
allResults.push(...results);
|
|
8620
8676
|
start3 += results.length;
|
|
8621
8677
|
process.stderr.write(
|
|
8622
|
-
`\r${
|
|
8678
|
+
`\r${chalk110.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
8623
8679
|
);
|
|
8624
8680
|
if (start3 >= totalResults) break;
|
|
8625
8681
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -8634,7 +8690,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
8634
8690
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
8635
8691
|
const resolved = resolveArgs(connectionName, collection);
|
|
8636
8692
|
if (!resolved.collection && !options2.query) {
|
|
8637
|
-
console.error(
|
|
8693
|
+
console.error(chalk111.red("Provide a collection name or --query filter."));
|
|
8638
8694
|
process.exit(1);
|
|
8639
8695
|
}
|
|
8640
8696
|
const { collection: col } = resolved;
|
|
@@ -8672,7 +8728,7 @@ import { spawn as spawn4 } from "child_process";
|
|
|
8672
8728
|
import * as path27 from "path";
|
|
8673
8729
|
|
|
8674
8730
|
// src/commands/refactor/logViolations.ts
|
|
8675
|
-
import
|
|
8731
|
+
import chalk112 from "chalk";
|
|
8676
8732
|
var DEFAULT_MAX_LINES = 100;
|
|
8677
8733
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
8678
8734
|
if (violations.length === 0) {
|
|
@@ -8681,43 +8737,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
8681
8737
|
}
|
|
8682
8738
|
return;
|
|
8683
8739
|
}
|
|
8684
|
-
console.error(
|
|
8740
|
+
console.error(chalk112.red(`
|
|
8685
8741
|
Refactor check failed:
|
|
8686
8742
|
`));
|
|
8687
|
-
console.error(
|
|
8743
|
+
console.error(chalk112.red(` The following files exceed ${maxLines} lines:
|
|
8688
8744
|
`));
|
|
8689
8745
|
for (const violation of violations) {
|
|
8690
|
-
console.error(
|
|
8746
|
+
console.error(chalk112.red(` ${violation.file} (${violation.lines} lines)`));
|
|
8691
8747
|
}
|
|
8692
8748
|
console.error(
|
|
8693
|
-
|
|
8749
|
+
chalk112.yellow(
|
|
8694
8750
|
`
|
|
8695
8751
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
8696
8752
|
way to refactor it, ignore it with:
|
|
8697
8753
|
`
|
|
8698
8754
|
)
|
|
8699
8755
|
);
|
|
8700
|
-
console.error(
|
|
8756
|
+
console.error(chalk112.gray(` assist refactor ignore <file>
|
|
8701
8757
|
`));
|
|
8702
8758
|
if (process.env.CLAUDECODE) {
|
|
8703
|
-
console.error(
|
|
8759
|
+
console.error(chalk112.cyan(`
|
|
8704
8760
|
## Extracting Code to New Files
|
|
8705
8761
|
`));
|
|
8706
8762
|
console.error(
|
|
8707
|
-
|
|
8763
|
+
chalk112.cyan(
|
|
8708
8764
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
8709
8765
|
`
|
|
8710
8766
|
)
|
|
8711
8767
|
);
|
|
8712
8768
|
console.error(
|
|
8713
|
-
|
|
8769
|
+
chalk112.cyan(
|
|
8714
8770
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
8715
8771
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
8716
8772
|
`
|
|
8717
8773
|
)
|
|
8718
8774
|
);
|
|
8719
8775
|
console.error(
|
|
8720
|
-
|
|
8776
|
+
chalk112.cyan(
|
|
8721
8777
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
8722
8778
|
domains, move it to a common/shared folder.
|
|
8723
8779
|
`
|
|
@@ -8873,7 +8929,7 @@ async function check(pattern2, options2) {
|
|
|
8873
8929
|
|
|
8874
8930
|
// src/commands/refactor/extract/index.ts
|
|
8875
8931
|
import path33 from "path";
|
|
8876
|
-
import
|
|
8932
|
+
import chalk115 from "chalk";
|
|
8877
8933
|
|
|
8878
8934
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
8879
8935
|
import { SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
@@ -9420,23 +9476,23 @@ function buildPlan(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
9420
9476
|
|
|
9421
9477
|
// src/commands/refactor/extract/displayPlan.ts
|
|
9422
9478
|
import path31 from "path";
|
|
9423
|
-
import
|
|
9479
|
+
import chalk113 from "chalk";
|
|
9424
9480
|
function section(title) {
|
|
9425
9481
|
return `
|
|
9426
|
-
${
|
|
9482
|
+
${chalk113.cyan(title)}`;
|
|
9427
9483
|
}
|
|
9428
9484
|
function displayImporters(plan2, cwd) {
|
|
9429
9485
|
if (plan2.importersToUpdate.length === 0) return;
|
|
9430
9486
|
console.log(section("Update importers:"));
|
|
9431
9487
|
for (const imp of plan2.importersToUpdate) {
|
|
9432
9488
|
const rel = path31.relative(cwd, imp.file.getFilePath());
|
|
9433
|
-
console.log(` ${
|
|
9489
|
+
console.log(` ${chalk113.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
9434
9490
|
}
|
|
9435
9491
|
}
|
|
9436
9492
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
9437
|
-
console.log(
|
|
9493
|
+
console.log(chalk113.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
9438
9494
|
`));
|
|
9439
|
-
console.log(` ${
|
|
9495
|
+
console.log(` ${chalk113.cyan("Functions to move:")}`);
|
|
9440
9496
|
for (const name of plan2.extractedNames) {
|
|
9441
9497
|
console.log(` ${name}`);
|
|
9442
9498
|
}
|
|
@@ -9471,7 +9527,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
9471
9527
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
9472
9528
|
import fs17 from "fs";
|
|
9473
9529
|
import path32 from "path";
|
|
9474
|
-
import
|
|
9530
|
+
import chalk114 from "chalk";
|
|
9475
9531
|
import { Project as Project2 } from "ts-morph";
|
|
9476
9532
|
function findTsConfig(sourcePath) {
|
|
9477
9533
|
const rootConfig = path32.resolve("tsconfig.json");
|
|
@@ -9502,7 +9558,7 @@ function loadProjectFile(file) {
|
|
|
9502
9558
|
});
|
|
9503
9559
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
9504
9560
|
if (!sourceFile) {
|
|
9505
|
-
console.log(
|
|
9561
|
+
console.log(chalk114.red(`File not found in project: ${file}`));
|
|
9506
9562
|
process.exit(1);
|
|
9507
9563
|
}
|
|
9508
9564
|
return { project, sourceFile };
|
|
@@ -9525,19 +9581,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
9525
9581
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
9526
9582
|
if (options2.apply) {
|
|
9527
9583
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
9528
|
-
console.log(
|
|
9584
|
+
console.log(chalk115.green("\nExtraction complete"));
|
|
9529
9585
|
} else {
|
|
9530
|
-
console.log(
|
|
9586
|
+
console.log(chalk115.dim("\nDry run. Use --apply to execute."));
|
|
9531
9587
|
}
|
|
9532
9588
|
}
|
|
9533
9589
|
|
|
9534
9590
|
// src/commands/refactor/ignore.ts
|
|
9535
9591
|
import fs18 from "fs";
|
|
9536
|
-
import
|
|
9592
|
+
import chalk116 from "chalk";
|
|
9537
9593
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
9538
9594
|
function ignore(file) {
|
|
9539
9595
|
if (!fs18.existsSync(file)) {
|
|
9540
|
-
console.error(
|
|
9596
|
+
console.error(chalk116.red(`Error: File does not exist: ${file}`));
|
|
9541
9597
|
process.exit(1);
|
|
9542
9598
|
}
|
|
9543
9599
|
const content = fs18.readFileSync(file, "utf-8");
|
|
@@ -9553,7 +9609,7 @@ function ignore(file) {
|
|
|
9553
9609
|
fs18.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
9554
9610
|
}
|
|
9555
9611
|
console.log(
|
|
9556
|
-
|
|
9612
|
+
chalk116.green(
|
|
9557
9613
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
9558
9614
|
)
|
|
9559
9615
|
);
|
|
@@ -9561,26 +9617,26 @@ function ignore(file) {
|
|
|
9561
9617
|
|
|
9562
9618
|
// src/commands/refactor/rename/index.ts
|
|
9563
9619
|
import path34 from "path";
|
|
9564
|
-
import
|
|
9620
|
+
import chalk117 from "chalk";
|
|
9565
9621
|
async function rename(source, destination, options2 = {}) {
|
|
9566
9622
|
const destPath = path34.resolve(destination);
|
|
9567
9623
|
const cwd = process.cwd();
|
|
9568
9624
|
const relSource = path34.relative(cwd, path34.resolve(source));
|
|
9569
9625
|
const relDest = path34.relative(cwd, destPath);
|
|
9570
9626
|
const { project, sourceFile } = loadProjectFile(source);
|
|
9571
|
-
console.log(
|
|
9627
|
+
console.log(chalk117.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
9572
9628
|
if (options2.apply) {
|
|
9573
9629
|
sourceFile.move(destPath);
|
|
9574
9630
|
await project.save();
|
|
9575
|
-
console.log(
|
|
9631
|
+
console.log(chalk117.green("Done"));
|
|
9576
9632
|
} else {
|
|
9577
|
-
console.log(
|
|
9633
|
+
console.log(chalk117.dim("Dry run. Use --apply to execute."));
|
|
9578
9634
|
}
|
|
9579
9635
|
}
|
|
9580
9636
|
|
|
9581
9637
|
// src/commands/refactor/renameSymbol/index.ts
|
|
9582
9638
|
import path36 from "path";
|
|
9583
|
-
import
|
|
9639
|
+
import chalk118 from "chalk";
|
|
9584
9640
|
import { Project as Project3 } from "ts-morph";
|
|
9585
9641
|
|
|
9586
9642
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
@@ -9629,38 +9685,38 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
9629
9685
|
const project = new Project3({ tsConfigFilePath: tsConfigPath });
|
|
9630
9686
|
const sourceFile = project.getSourceFile(filePath);
|
|
9631
9687
|
if (!sourceFile) {
|
|
9632
|
-
console.log(
|
|
9688
|
+
console.log(chalk118.red(`File not found in project: ${file}`));
|
|
9633
9689
|
process.exit(1);
|
|
9634
9690
|
}
|
|
9635
9691
|
const symbol = findSymbol(sourceFile, oldName);
|
|
9636
9692
|
if (!symbol) {
|
|
9637
|
-
console.log(
|
|
9693
|
+
console.log(chalk118.red(`Symbol "${oldName}" not found in ${file}`));
|
|
9638
9694
|
process.exit(1);
|
|
9639
9695
|
}
|
|
9640
9696
|
const grouped = groupReferences(symbol, cwd);
|
|
9641
9697
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
9642
9698
|
console.log(
|
|
9643
|
-
|
|
9699
|
+
chalk118.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
9644
9700
|
`)
|
|
9645
9701
|
);
|
|
9646
9702
|
for (const [refFile, lines] of grouped) {
|
|
9647
9703
|
console.log(
|
|
9648
|
-
` ${
|
|
9704
|
+
` ${chalk118.dim(refFile)}: lines ${chalk118.cyan(lines.join(", "))}`
|
|
9649
9705
|
);
|
|
9650
9706
|
}
|
|
9651
9707
|
if (options2.apply) {
|
|
9652
9708
|
symbol.rename(newName);
|
|
9653
9709
|
await project.save();
|
|
9654
|
-
console.log(
|
|
9710
|
+
console.log(chalk118.green(`
|
|
9655
9711
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
9656
9712
|
} else {
|
|
9657
|
-
console.log(
|
|
9713
|
+
console.log(chalk118.dim("\nDry run. Use --apply to execute."));
|
|
9658
9714
|
}
|
|
9659
9715
|
}
|
|
9660
9716
|
|
|
9661
9717
|
// src/commands/refactor/restructure/index.ts
|
|
9662
9718
|
import path45 from "path";
|
|
9663
|
-
import
|
|
9719
|
+
import chalk121 from "chalk";
|
|
9664
9720
|
|
|
9665
9721
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
9666
9722
|
import path37 from "path";
|
|
@@ -9903,50 +9959,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
9903
9959
|
|
|
9904
9960
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
9905
9961
|
import path41 from "path";
|
|
9906
|
-
import
|
|
9962
|
+
import chalk119 from "chalk";
|
|
9907
9963
|
function relPath(filePath) {
|
|
9908
9964
|
return path41.relative(process.cwd(), filePath);
|
|
9909
9965
|
}
|
|
9910
9966
|
function displayMoves(plan2) {
|
|
9911
9967
|
if (plan2.moves.length === 0) return;
|
|
9912
|
-
console.log(
|
|
9968
|
+
console.log(chalk119.bold("\nFile moves:"));
|
|
9913
9969
|
for (const move of plan2.moves) {
|
|
9914
9970
|
console.log(
|
|
9915
|
-
` ${
|
|
9971
|
+
` ${chalk119.red(relPath(move.from))} \u2192 ${chalk119.green(relPath(move.to))}`
|
|
9916
9972
|
);
|
|
9917
|
-
console.log(
|
|
9973
|
+
console.log(chalk119.dim(` ${move.reason}`));
|
|
9918
9974
|
}
|
|
9919
9975
|
}
|
|
9920
9976
|
function displayRewrites(rewrites) {
|
|
9921
9977
|
if (rewrites.length === 0) return;
|
|
9922
9978
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
9923
|
-
console.log(
|
|
9979
|
+
console.log(chalk119.bold(`
|
|
9924
9980
|
Import rewrites (${affectedFiles.size} files):`));
|
|
9925
9981
|
for (const file of affectedFiles) {
|
|
9926
|
-
console.log(` ${
|
|
9982
|
+
console.log(` ${chalk119.cyan(relPath(file))}:`);
|
|
9927
9983
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
9928
9984
|
(r) => r.file === file
|
|
9929
9985
|
)) {
|
|
9930
9986
|
console.log(
|
|
9931
|
-
` ${
|
|
9987
|
+
` ${chalk119.red(`"${oldSpecifier}"`)} \u2192 ${chalk119.green(`"${newSpecifier}"`)}`
|
|
9932
9988
|
);
|
|
9933
9989
|
}
|
|
9934
9990
|
}
|
|
9935
9991
|
}
|
|
9936
9992
|
function displayPlan2(plan2) {
|
|
9937
9993
|
if (plan2.warnings.length > 0) {
|
|
9938
|
-
console.log(
|
|
9939
|
-
for (const w of plan2.warnings) console.log(
|
|
9994
|
+
console.log(chalk119.yellow("\nWarnings:"));
|
|
9995
|
+
for (const w of plan2.warnings) console.log(chalk119.yellow(` ${w}`));
|
|
9940
9996
|
}
|
|
9941
9997
|
if (plan2.newDirectories.length > 0) {
|
|
9942
|
-
console.log(
|
|
9998
|
+
console.log(chalk119.bold("\nNew directories:"));
|
|
9943
9999
|
for (const dir of plan2.newDirectories)
|
|
9944
|
-
console.log(
|
|
10000
|
+
console.log(chalk119.green(` ${dir}/`));
|
|
9945
10001
|
}
|
|
9946
10002
|
displayMoves(plan2);
|
|
9947
10003
|
displayRewrites(plan2.rewrites);
|
|
9948
10004
|
console.log(
|
|
9949
|
-
|
|
10005
|
+
chalk119.dim(
|
|
9950
10006
|
`
|
|
9951
10007
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
9952
10008
|
)
|
|
@@ -9956,18 +10012,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
9956
10012
|
// src/commands/refactor/restructure/executePlan.ts
|
|
9957
10013
|
import fs20 from "fs";
|
|
9958
10014
|
import path42 from "path";
|
|
9959
|
-
import
|
|
10015
|
+
import chalk120 from "chalk";
|
|
9960
10016
|
function executePlan(plan2) {
|
|
9961
10017
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
9962
10018
|
for (const [file, content] of updatedContents) {
|
|
9963
10019
|
fs20.writeFileSync(file, content, "utf-8");
|
|
9964
10020
|
console.log(
|
|
9965
|
-
|
|
10021
|
+
chalk120.cyan(` Rewrote imports in ${path42.relative(process.cwd(), file)}`)
|
|
9966
10022
|
);
|
|
9967
10023
|
}
|
|
9968
10024
|
for (const dir of plan2.newDirectories) {
|
|
9969
10025
|
fs20.mkdirSync(dir, { recursive: true });
|
|
9970
|
-
console.log(
|
|
10026
|
+
console.log(chalk120.green(` Created ${path42.relative(process.cwd(), dir)}/`));
|
|
9971
10027
|
}
|
|
9972
10028
|
for (const move of plan2.moves) {
|
|
9973
10029
|
const targetDir = path42.dirname(move.to);
|
|
@@ -9976,7 +10032,7 @@ function executePlan(plan2) {
|
|
|
9976
10032
|
}
|
|
9977
10033
|
fs20.renameSync(move.from, move.to);
|
|
9978
10034
|
console.log(
|
|
9979
|
-
|
|
10035
|
+
chalk120.white(
|
|
9980
10036
|
` Moved ${path42.relative(process.cwd(), move.from)} \u2192 ${path42.relative(process.cwd(), move.to)}`
|
|
9981
10037
|
)
|
|
9982
10038
|
);
|
|
@@ -9991,7 +10047,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
9991
10047
|
if (entries.length === 0) {
|
|
9992
10048
|
fs20.rmdirSync(dir);
|
|
9993
10049
|
console.log(
|
|
9994
|
-
|
|
10050
|
+
chalk120.dim(
|
|
9995
10051
|
` Removed empty directory ${path42.relative(process.cwd(), dir)}`
|
|
9996
10052
|
)
|
|
9997
10053
|
);
|
|
@@ -10124,22 +10180,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
10124
10180
|
const targetPattern = pattern2 ?? "src";
|
|
10125
10181
|
const files = findSourceFiles2(targetPattern);
|
|
10126
10182
|
if (files.length === 0) {
|
|
10127
|
-
console.log(
|
|
10183
|
+
console.log(chalk121.yellow("No files found matching pattern"));
|
|
10128
10184
|
return;
|
|
10129
10185
|
}
|
|
10130
10186
|
const tsConfigPath = path45.resolve("tsconfig.json");
|
|
10131
10187
|
const plan2 = buildPlan2(files, tsConfigPath);
|
|
10132
10188
|
if (plan2.moves.length === 0) {
|
|
10133
|
-
console.log(
|
|
10189
|
+
console.log(chalk121.green("No restructuring needed"));
|
|
10134
10190
|
return;
|
|
10135
10191
|
}
|
|
10136
10192
|
displayPlan2(plan2);
|
|
10137
10193
|
if (options2.apply) {
|
|
10138
|
-
console.log(
|
|
10194
|
+
console.log(chalk121.bold("\nApplying changes..."));
|
|
10139
10195
|
executePlan(plan2);
|
|
10140
|
-
console.log(
|
|
10196
|
+
console.log(chalk121.green("\nRestructuring complete"));
|
|
10141
10197
|
} else {
|
|
10142
|
-
console.log(
|
|
10198
|
+
console.log(chalk121.dim("\nDry run. Use --apply to execute."));
|
|
10143
10199
|
}
|
|
10144
10200
|
}
|
|
10145
10201
|
|
|
@@ -10179,7 +10235,7 @@ function registerRefactor(program2) {
|
|
|
10179
10235
|
}
|
|
10180
10236
|
|
|
10181
10237
|
// src/commands/seq/seqAuth.ts
|
|
10182
|
-
import
|
|
10238
|
+
import chalk123 from "chalk";
|
|
10183
10239
|
|
|
10184
10240
|
// src/commands/seq/loadConnections.ts
|
|
10185
10241
|
function loadConnections2() {
|
|
@@ -10208,11 +10264,11 @@ function setDefaultConnection(name) {
|
|
|
10208
10264
|
}
|
|
10209
10265
|
|
|
10210
10266
|
// src/commands/seq/promptConnection.ts
|
|
10211
|
-
import
|
|
10267
|
+
import chalk122 from "chalk";
|
|
10212
10268
|
async function promptConnection2(existingNames) {
|
|
10213
10269
|
const name = await promptInput("name", "Connection name:", "default");
|
|
10214
10270
|
if (existingNames.includes(name)) {
|
|
10215
|
-
console.error(
|
|
10271
|
+
console.error(chalk122.red(`Connection "${name}" already exists.`));
|
|
10216
10272
|
process.exit(1);
|
|
10217
10273
|
}
|
|
10218
10274
|
const url = await promptInput("url", "Seq URL:", "http://localhost:5341");
|
|
@@ -10224,16 +10280,16 @@ async function promptConnection2(existingNames) {
|
|
|
10224
10280
|
var seqAuth = createConnectionAuth({
|
|
10225
10281
|
load: loadConnections2,
|
|
10226
10282
|
save: saveConnections2,
|
|
10227
|
-
format: (c) => `${
|
|
10283
|
+
format: (c) => `${chalk123.bold(c.name)} ${c.url}`,
|
|
10228
10284
|
promptNew: promptConnection2,
|
|
10229
10285
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
10230
10286
|
});
|
|
10231
10287
|
|
|
10232
10288
|
// src/commands/seq/seqQuery.ts
|
|
10233
|
-
import
|
|
10289
|
+
import chalk127 from "chalk";
|
|
10234
10290
|
|
|
10235
10291
|
// src/commands/seq/fetchSeq.ts
|
|
10236
|
-
import
|
|
10292
|
+
import chalk124 from "chalk";
|
|
10237
10293
|
async function fetchSeq(conn, path50, params) {
|
|
10238
10294
|
const url = `${conn.url}${path50}?${params}`;
|
|
10239
10295
|
const response = await fetch(url, {
|
|
@@ -10244,7 +10300,7 @@ async function fetchSeq(conn, path50, params) {
|
|
|
10244
10300
|
});
|
|
10245
10301
|
if (!response.ok) {
|
|
10246
10302
|
const body = await response.text();
|
|
10247
|
-
console.error(
|
|
10303
|
+
console.error(chalk124.red(`Seq returned ${response.status}: ${body}`));
|
|
10248
10304
|
process.exit(1);
|
|
10249
10305
|
}
|
|
10250
10306
|
return response;
|
|
@@ -10297,23 +10353,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
10297
10353
|
}
|
|
10298
10354
|
|
|
10299
10355
|
// src/commands/seq/formatEvent.ts
|
|
10300
|
-
import
|
|
10356
|
+
import chalk125 from "chalk";
|
|
10301
10357
|
function levelColor(level) {
|
|
10302
10358
|
switch (level) {
|
|
10303
10359
|
case "Fatal":
|
|
10304
|
-
return
|
|
10360
|
+
return chalk125.bgRed.white;
|
|
10305
10361
|
case "Error":
|
|
10306
|
-
return
|
|
10362
|
+
return chalk125.red;
|
|
10307
10363
|
case "Warning":
|
|
10308
|
-
return
|
|
10364
|
+
return chalk125.yellow;
|
|
10309
10365
|
case "Information":
|
|
10310
|
-
return
|
|
10366
|
+
return chalk125.cyan;
|
|
10311
10367
|
case "Debug":
|
|
10312
|
-
return
|
|
10368
|
+
return chalk125.gray;
|
|
10313
10369
|
case "Verbose":
|
|
10314
|
-
return
|
|
10370
|
+
return chalk125.dim;
|
|
10315
10371
|
default:
|
|
10316
|
-
return
|
|
10372
|
+
return chalk125.white;
|
|
10317
10373
|
}
|
|
10318
10374
|
}
|
|
10319
10375
|
function levelAbbrev(level) {
|
|
@@ -10354,31 +10410,31 @@ function formatTimestamp(iso) {
|
|
|
10354
10410
|
function formatEvent(event) {
|
|
10355
10411
|
const color = levelColor(event.Level);
|
|
10356
10412
|
const abbrev = levelAbbrev(event.Level);
|
|
10357
|
-
const ts8 =
|
|
10413
|
+
const ts8 = chalk125.dim(formatTimestamp(event.Timestamp));
|
|
10358
10414
|
const msg = renderMessage(event);
|
|
10359
10415
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
10360
10416
|
if (event.Exception) {
|
|
10361
10417
|
for (const line of event.Exception.split("\n")) {
|
|
10362
|
-
lines.push(
|
|
10418
|
+
lines.push(chalk125.red(` ${line}`));
|
|
10363
10419
|
}
|
|
10364
10420
|
}
|
|
10365
10421
|
return lines.join("\n");
|
|
10366
10422
|
}
|
|
10367
10423
|
|
|
10368
10424
|
// src/commands/seq/resolveConnection.ts
|
|
10369
|
-
import
|
|
10425
|
+
import chalk126 from "chalk";
|
|
10370
10426
|
function resolveConnection2(name) {
|
|
10371
10427
|
const connections = loadConnections2();
|
|
10372
10428
|
if (connections.length === 0) {
|
|
10373
10429
|
console.error(
|
|
10374
|
-
|
|
10430
|
+
chalk126.red("No Seq connections configured. Run 'assist seq auth' first.")
|
|
10375
10431
|
);
|
|
10376
10432
|
process.exit(1);
|
|
10377
10433
|
}
|
|
10378
10434
|
const target = name ?? getDefaultConnection() ?? connections[0].name;
|
|
10379
10435
|
const connection = connections.find((c) => c.name === target);
|
|
10380
10436
|
if (!connection) {
|
|
10381
|
-
console.error(
|
|
10437
|
+
console.error(chalk126.red(`Seq connection "${target}" not found.`));
|
|
10382
10438
|
process.exit(1);
|
|
10383
10439
|
}
|
|
10384
10440
|
return connection;
|
|
@@ -10393,7 +10449,7 @@ async function seqQuery(filter, options2) {
|
|
|
10393
10449
|
new URLSearchParams({ filter, count: String(count) })
|
|
10394
10450
|
);
|
|
10395
10451
|
if (events.length === 0) {
|
|
10396
|
-
console.log(
|
|
10452
|
+
console.log(chalk127.yellow("No events found."));
|
|
10397
10453
|
return;
|
|
10398
10454
|
}
|
|
10399
10455
|
if (options2.json) {
|
|
@@ -10404,11 +10460,11 @@ async function seqQuery(filter, options2) {
|
|
|
10404
10460
|
for (const event of chronological) {
|
|
10405
10461
|
console.log(formatEvent(event));
|
|
10406
10462
|
}
|
|
10407
|
-
console.log(
|
|
10463
|
+
console.log(chalk127.dim(`
|
|
10408
10464
|
${events.length} events`));
|
|
10409
10465
|
if (events.length >= count) {
|
|
10410
10466
|
console.log(
|
|
10411
|
-
|
|
10467
|
+
chalk127.yellow(
|
|
10412
10468
|
`Results limited to ${count}. Use --count to retrieve more.`
|
|
10413
10469
|
)
|
|
10414
10470
|
);
|
|
@@ -10416,11 +10472,11 @@ ${events.length} events`));
|
|
|
10416
10472
|
}
|
|
10417
10473
|
|
|
10418
10474
|
// src/commands/seq/seqSetConnection.ts
|
|
10419
|
-
import
|
|
10475
|
+
import chalk128 from "chalk";
|
|
10420
10476
|
function seqSetConnection(name) {
|
|
10421
10477
|
const connections = loadConnections2();
|
|
10422
10478
|
if (!connections.find((c) => c.name === name)) {
|
|
10423
|
-
console.error(
|
|
10479
|
+
console.error(chalk128.red(`Connection "${name}" not found.`));
|
|
10424
10480
|
process.exit(1);
|
|
10425
10481
|
}
|
|
10426
10482
|
setDefaultConnection(name);
|
|
@@ -10959,14 +11015,14 @@ import {
|
|
|
10959
11015
|
import { dirname as dirname20, join as join35 } from "path";
|
|
10960
11016
|
|
|
10961
11017
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
10962
|
-
import
|
|
11018
|
+
import chalk129 from "chalk";
|
|
10963
11019
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
10964
11020
|
function validateStagedContent(filename, content) {
|
|
10965
11021
|
const firstLine = content.split("\n")[0];
|
|
10966
11022
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
10967
11023
|
if (!match) {
|
|
10968
11024
|
console.error(
|
|
10969
|
-
|
|
11025
|
+
chalk129.red(
|
|
10970
11026
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
10971
11027
|
)
|
|
10972
11028
|
);
|
|
@@ -10975,7 +11031,7 @@ function validateStagedContent(filename, content) {
|
|
|
10975
11031
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
10976
11032
|
if (!contentAfterLink) {
|
|
10977
11033
|
console.error(
|
|
10978
|
-
|
|
11034
|
+
chalk129.red(
|
|
10979
11035
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
10980
11036
|
)
|
|
10981
11037
|
);
|
|
@@ -11368,7 +11424,7 @@ function registerVoice(program2) {
|
|
|
11368
11424
|
|
|
11369
11425
|
// src/commands/roam/auth.ts
|
|
11370
11426
|
import { randomBytes } from "crypto";
|
|
11371
|
-
import
|
|
11427
|
+
import chalk130 from "chalk";
|
|
11372
11428
|
|
|
11373
11429
|
// src/lib/openBrowser.ts
|
|
11374
11430
|
import { execSync as execSync39 } from "child_process";
|
|
@@ -11543,13 +11599,13 @@ async function auth() {
|
|
|
11543
11599
|
saveGlobalConfig(config);
|
|
11544
11600
|
const state = randomBytes(16).toString("hex");
|
|
11545
11601
|
console.log(
|
|
11546
|
-
|
|
11602
|
+
chalk130.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
11547
11603
|
);
|
|
11548
|
-
console.log(
|
|
11549
|
-
console.log(
|
|
11550
|
-
console.log(
|
|
11604
|
+
console.log(chalk130.white("http://localhost:14523/callback\n"));
|
|
11605
|
+
console.log(chalk130.blue("Opening browser for authorization..."));
|
|
11606
|
+
console.log(chalk130.dim("Waiting for authorization callback..."));
|
|
11551
11607
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
11552
|
-
console.log(
|
|
11608
|
+
console.log(chalk130.dim("Exchanging code for tokens..."));
|
|
11553
11609
|
const tokens = await exchangeToken({
|
|
11554
11610
|
code,
|
|
11555
11611
|
clientId,
|
|
@@ -11565,7 +11621,7 @@ async function auth() {
|
|
|
11565
11621
|
};
|
|
11566
11622
|
saveGlobalConfig(config);
|
|
11567
11623
|
console.log(
|
|
11568
|
-
|
|
11624
|
+
chalk130.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
11569
11625
|
);
|
|
11570
11626
|
}
|
|
11571
11627
|
|
|
@@ -11810,7 +11866,7 @@ import { execSync as execSync41 } from "child_process";
|
|
|
11810
11866
|
import { existsSync as existsSync40, mkdirSync as mkdirSync14, unlinkSync as unlinkSync11, writeFileSync as writeFileSync29 } from "fs";
|
|
11811
11867
|
import { tmpdir as tmpdir6 } from "os";
|
|
11812
11868
|
import { join as join44, resolve as resolve6 } from "path";
|
|
11813
|
-
import
|
|
11869
|
+
import chalk131 from "chalk";
|
|
11814
11870
|
|
|
11815
11871
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
11816
11872
|
var captureWindowPs1 = `
|
|
@@ -11961,22 +12017,22 @@ function screenshot(processName) {
|
|
|
11961
12017
|
const config = loadConfig();
|
|
11962
12018
|
const outputDir = resolve6(config.screenshot.outputDir);
|
|
11963
12019
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
11964
|
-
console.log(
|
|
12020
|
+
console.log(chalk131.gray(`Capturing window for process "${processName}" ...`));
|
|
11965
12021
|
try {
|
|
11966
12022
|
runPowerShellScript(processName, outputPath);
|
|
11967
|
-
console.log(
|
|
12023
|
+
console.log(chalk131.green(`Screenshot saved: ${outputPath}`));
|
|
11968
12024
|
} catch (error) {
|
|
11969
12025
|
const msg = error instanceof Error ? error.message : String(error);
|
|
11970
|
-
console.error(
|
|
12026
|
+
console.error(chalk131.red(`Failed to capture screenshot: ${msg}`));
|
|
11971
12027
|
process.exit(1);
|
|
11972
12028
|
}
|
|
11973
12029
|
}
|
|
11974
12030
|
|
|
11975
12031
|
// src/commands/statusLine.ts
|
|
11976
|
-
import
|
|
12032
|
+
import chalk133 from "chalk";
|
|
11977
12033
|
|
|
11978
12034
|
// src/commands/buildLimitsSegment.ts
|
|
11979
|
-
import
|
|
12035
|
+
import chalk132 from "chalk";
|
|
11980
12036
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
11981
12037
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
11982
12038
|
function formatTimeLeft(resetsAt) {
|
|
@@ -11999,10 +12055,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
11999
12055
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
12000
12056
|
const label2 = `${Math.round(pct)}%`;
|
|
12001
12057
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
12002
|
-
if (projected == null) return
|
|
12003
|
-
if (projected > 100) return
|
|
12004
|
-
if (projected > 75) return
|
|
12005
|
-
return
|
|
12058
|
+
if (projected == null) return chalk132.green(label2);
|
|
12059
|
+
if (projected > 100) return chalk132.red(label2);
|
|
12060
|
+
if (projected > 75) return chalk132.yellow(label2);
|
|
12061
|
+
return chalk132.green(label2);
|
|
12006
12062
|
}
|
|
12007
12063
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
12008
12064
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -12028,14 +12084,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
12028
12084
|
}
|
|
12029
12085
|
|
|
12030
12086
|
// src/commands/statusLine.ts
|
|
12031
|
-
|
|
12087
|
+
chalk133.level = 3;
|
|
12032
12088
|
function formatNumber(num) {
|
|
12033
12089
|
return num.toLocaleString("en-US");
|
|
12034
12090
|
}
|
|
12035
12091
|
function colorizePercent(pct) {
|
|
12036
12092
|
const label2 = `${Math.round(pct)}%`;
|
|
12037
|
-
if (pct > 80) return
|
|
12038
|
-
if (pct > 40) return
|
|
12093
|
+
if (pct > 80) return chalk133.red(label2);
|
|
12094
|
+
if (pct > 40) return chalk133.yellow(label2);
|
|
12039
12095
|
return label2;
|
|
12040
12096
|
}
|
|
12041
12097
|
async function statusLine() {
|
|
@@ -12058,7 +12114,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
12058
12114
|
// src/commands/sync/syncClaudeMd.ts
|
|
12059
12115
|
import * as fs23 from "fs";
|
|
12060
12116
|
import * as path46 from "path";
|
|
12061
|
-
import
|
|
12117
|
+
import chalk134 from "chalk";
|
|
12062
12118
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
12063
12119
|
const source = path46.join(claudeDir, "CLAUDE.md");
|
|
12064
12120
|
const target = path46.join(targetBase, "CLAUDE.md");
|
|
@@ -12067,12 +12123,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
12067
12123
|
const targetContent = fs23.readFileSync(target, "utf-8");
|
|
12068
12124
|
if (sourceContent !== targetContent) {
|
|
12069
12125
|
console.log(
|
|
12070
|
-
|
|
12126
|
+
chalk134.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
12071
12127
|
);
|
|
12072
12128
|
console.log();
|
|
12073
12129
|
printDiff(targetContent, sourceContent);
|
|
12074
12130
|
const confirm = options2?.yes || await promptConfirm(
|
|
12075
|
-
|
|
12131
|
+
chalk134.red("Overwrite existing CLAUDE.md?"),
|
|
12076
12132
|
false
|
|
12077
12133
|
);
|
|
12078
12134
|
if (!confirm) {
|
|
@@ -12088,7 +12144,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
12088
12144
|
// src/commands/sync/syncSettings.ts
|
|
12089
12145
|
import * as fs24 from "fs";
|
|
12090
12146
|
import * as path47 from "path";
|
|
12091
|
-
import
|
|
12147
|
+
import chalk135 from "chalk";
|
|
12092
12148
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
12093
12149
|
const source = path47.join(claudeDir, "settings.json");
|
|
12094
12150
|
const target = path47.join(targetBase, "settings.json");
|
|
@@ -12104,14 +12160,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
12104
12160
|
if (mergedContent !== normalizedTarget) {
|
|
12105
12161
|
if (!options2?.yes) {
|
|
12106
12162
|
console.log(
|
|
12107
|
-
|
|
12163
|
+
chalk135.yellow(
|
|
12108
12164
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
12109
12165
|
)
|
|
12110
12166
|
);
|
|
12111
12167
|
console.log();
|
|
12112
12168
|
printDiff(targetContent, mergedContent);
|
|
12113
12169
|
const confirm = await promptConfirm(
|
|
12114
|
-
|
|
12170
|
+
chalk135.red("Overwrite existing settings.json?"),
|
|
12115
12171
|
false
|
|
12116
12172
|
);
|
|
12117
12173
|
if (!confirm) {
|