@staff0rd/assist 0.318.5 → 0.318.6
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 +472 -465
- 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.318.
|
|
9
|
+
version: "0.318.6",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -5314,6 +5314,7 @@ function printComments(item) {
|
|
|
5314
5314
|
}
|
|
5315
5315
|
|
|
5316
5316
|
// src/commands/sessions/web/index.ts
|
|
5317
|
+
import chalk55 from "chalk";
|
|
5317
5318
|
import { WebSocketServer } from "ws";
|
|
5318
5319
|
|
|
5319
5320
|
// src/shared/getInstallDir.ts
|
|
@@ -6709,7 +6710,6 @@ function installRestartMenu(options2 = {}) {
|
|
|
6709
6710
|
|
|
6710
6711
|
// src/commands/sessions/web/index.ts
|
|
6711
6712
|
async function web(options2) {
|
|
6712
|
-
await ensureDaemonRunning("web server start");
|
|
6713
6713
|
const port = Number.parseInt(options2.port, 10);
|
|
6714
6714
|
const server = startWebServer(
|
|
6715
6715
|
"Assist",
|
|
@@ -6734,6 +6734,13 @@ async function web(options2) {
|
|
|
6734
6734
|
}
|
|
6735
6735
|
});
|
|
6736
6736
|
installRestartMenu();
|
|
6737
|
+
void ensureDaemonRunning("web server start").catch((error) => {
|
|
6738
|
+
console.error(
|
|
6739
|
+
chalk55.yellow(
|
|
6740
|
+
`sessions daemon not ready yet, will retry on connection: ${error instanceof Error ? error.message : String(error)}`
|
|
6741
|
+
)
|
|
6742
|
+
);
|
|
6743
|
+
});
|
|
6737
6744
|
}
|
|
6738
6745
|
|
|
6739
6746
|
// src/commands/backlog/web/index.ts
|
|
@@ -6746,26 +6753,26 @@ async function web2(options2) {
|
|
|
6746
6753
|
}
|
|
6747
6754
|
|
|
6748
6755
|
// src/commands/backlog/comment/index.ts
|
|
6749
|
-
import
|
|
6756
|
+
import chalk56 from "chalk";
|
|
6750
6757
|
async function comment(id2, text6) {
|
|
6751
6758
|
const found = await findOneItem(id2);
|
|
6752
6759
|
if (!found) process.exit(1);
|
|
6753
6760
|
await appendComment(found.orm, found.item.id, text6);
|
|
6754
|
-
console.log(
|
|
6761
|
+
console.log(chalk56.green(`Comment added to item #${id2}.`));
|
|
6755
6762
|
}
|
|
6756
6763
|
|
|
6757
6764
|
// src/commands/backlog/comments/index.ts
|
|
6758
|
-
import
|
|
6765
|
+
import chalk57 from "chalk";
|
|
6759
6766
|
async function comments2(id2) {
|
|
6760
6767
|
const found = await findOneItem(id2);
|
|
6761
6768
|
if (!found) process.exit(1);
|
|
6762
6769
|
const { item } = found;
|
|
6763
6770
|
const entries = item.comments ?? [];
|
|
6764
6771
|
if (entries.length === 0) {
|
|
6765
|
-
console.log(
|
|
6772
|
+
console.log(chalk57.dim(`No comments on item #${id2}.`));
|
|
6766
6773
|
return;
|
|
6767
6774
|
}
|
|
6768
|
-
console.log(
|
|
6775
|
+
console.log(chalk57.bold(`Comments for #${id2}: ${item.name}
|
|
6769
6776
|
`));
|
|
6770
6777
|
for (const entry of entries) {
|
|
6771
6778
|
console.log(`${formatComment(entry)}
|
|
@@ -6774,7 +6781,7 @@ async function comments2(id2) {
|
|
|
6774
6781
|
}
|
|
6775
6782
|
|
|
6776
6783
|
// src/commands/backlog/delete-comment/index.ts
|
|
6777
|
-
import
|
|
6784
|
+
import chalk58 from "chalk";
|
|
6778
6785
|
async function deleteCommentCmd(id2, commentId) {
|
|
6779
6786
|
const found = await findOneItem(id2);
|
|
6780
6787
|
if (!found) process.exit(1);
|
|
@@ -6786,16 +6793,16 @@ async function deleteCommentCmd(id2, commentId) {
|
|
|
6786
6793
|
switch (outcome) {
|
|
6787
6794
|
case "deleted":
|
|
6788
6795
|
console.log(
|
|
6789
|
-
|
|
6796
|
+
chalk58.green(`Comment #${commentId} deleted from item #${id2}.`)
|
|
6790
6797
|
);
|
|
6791
6798
|
break;
|
|
6792
6799
|
case "not-found":
|
|
6793
|
-
console.log(
|
|
6800
|
+
console.log(chalk58.red(`Comment #${commentId} not found on item #${id2}.`));
|
|
6794
6801
|
process.exit(1);
|
|
6795
6802
|
break;
|
|
6796
6803
|
case "is-summary":
|
|
6797
6804
|
console.log(
|
|
6798
|
-
|
|
6805
|
+
chalk58.red(
|
|
6799
6806
|
`Comment #${commentId} is a phase summary and cannot be deleted.`
|
|
6800
6807
|
)
|
|
6801
6808
|
);
|
|
@@ -6820,7 +6827,7 @@ function registerExportCommand(cmd) {
|
|
|
6820
6827
|
|
|
6821
6828
|
// src/commands/backlog/import/index.ts
|
|
6822
6829
|
import { readFile } from "fs/promises";
|
|
6823
|
-
import
|
|
6830
|
+
import chalk60 from "chalk";
|
|
6824
6831
|
|
|
6825
6832
|
// src/commands/backlog/dump/countCopyRows.ts
|
|
6826
6833
|
function countCopyRows(data) {
|
|
@@ -6892,7 +6899,7 @@ function validateDump({ header, sections }) {
|
|
|
6892
6899
|
}
|
|
6893
6900
|
|
|
6894
6901
|
// src/commands/backlog/import/confirmReplace.ts
|
|
6895
|
-
import
|
|
6902
|
+
import chalk59 from "chalk";
|
|
6896
6903
|
async function countRows(client, table) {
|
|
6897
6904
|
const { rows } = await client.query(
|
|
6898
6905
|
`SELECT count(*)::int AS n FROM ${table}`
|
|
@@ -6903,7 +6910,7 @@ function printSummary(tables, current, incoming) {
|
|
|
6903
6910
|
const lines = tables.map(
|
|
6904
6911
|
(t, i) => ` ${t.name}: ${current[i]} \u2192 ${incoming[i]} rows`
|
|
6905
6912
|
);
|
|
6906
|
-
console.error(
|
|
6913
|
+
console.error(chalk59.bold("\nThis will REPLACE all backlog data:"));
|
|
6907
6914
|
console.error(`${lines.join("\n")}
|
|
6908
6915
|
`);
|
|
6909
6916
|
}
|
|
@@ -7005,13 +7012,13 @@ async function importBacklog(file, options2 = {}) {
|
|
|
7005
7012
|
);
|
|
7006
7013
|
await withDbClient(async (client) => {
|
|
7007
7014
|
if (!options2.yes && !await confirmReplace(client, tables, incoming, !file)) {
|
|
7008
|
-
console.error(
|
|
7015
|
+
console.error(chalk60.yellow("Import cancelled; no changes made."));
|
|
7009
7016
|
return;
|
|
7010
7017
|
}
|
|
7011
7018
|
await restore(client, parsed);
|
|
7012
7019
|
const total = incoming.reduce((sum, n) => sum + n, 0);
|
|
7013
7020
|
console.error(
|
|
7014
|
-
|
|
7021
|
+
chalk60.green(
|
|
7015
7022
|
`Imported backlog: ${total} rows restored across ${tables.length} tables.`
|
|
7016
7023
|
)
|
|
7017
7024
|
);
|
|
@@ -7028,7 +7035,7 @@ function registerImportCommand(cmd) {
|
|
|
7028
7035
|
}
|
|
7029
7036
|
|
|
7030
7037
|
// src/commands/backlog/add/index.ts
|
|
7031
|
-
import
|
|
7038
|
+
import chalk61 from "chalk";
|
|
7032
7039
|
|
|
7033
7040
|
// src/commands/backlog/add/shared.ts
|
|
7034
7041
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
@@ -7119,11 +7126,11 @@ async function add(options2) {
|
|
|
7119
7126
|
},
|
|
7120
7127
|
getOrigin()
|
|
7121
7128
|
);
|
|
7122
|
-
console.log(
|
|
7129
|
+
console.log(chalk61.green(`Added item #${id2}: ${name}`));
|
|
7123
7130
|
}
|
|
7124
7131
|
|
|
7125
7132
|
// src/commands/backlog/addPhase.ts
|
|
7126
|
-
import
|
|
7133
|
+
import chalk63 from "chalk";
|
|
7127
7134
|
|
|
7128
7135
|
// src/commands/backlog/insertPhaseAt.ts
|
|
7129
7136
|
import { count, eq as eq18 } from "drizzle-orm";
|
|
@@ -7156,7 +7163,7 @@ async function insertPhaseAt(orm, itemId, phaseIdx, name, tasks, manualChecks, c
|
|
|
7156
7163
|
}
|
|
7157
7164
|
|
|
7158
7165
|
// src/commands/backlog/resolveInsertPosition.ts
|
|
7159
|
-
import
|
|
7166
|
+
import chalk62 from "chalk";
|
|
7160
7167
|
import { count as count2, eq as eq19 } from "drizzle-orm";
|
|
7161
7168
|
async function resolveInsertPosition(orm, itemId, position) {
|
|
7162
7169
|
const [row] = await orm.select({ cnt: count2() }).from(planPhases).where(eq19(planPhases.itemId, itemId));
|
|
@@ -7165,7 +7172,7 @@ async function resolveInsertPosition(orm, itemId, position) {
|
|
|
7165
7172
|
const pos = Number.parseInt(position, 10);
|
|
7166
7173
|
if (pos < 1 || pos > phaseCount + 1) {
|
|
7167
7174
|
console.log(
|
|
7168
|
-
|
|
7175
|
+
chalk62.red(
|
|
7169
7176
|
`Position ${pos} is out of range. Must be between 1 and ${phaseCount + 1}.`
|
|
7170
7177
|
)
|
|
7171
7178
|
);
|
|
@@ -7186,7 +7193,7 @@ async function addPhase(id2, name, options2) {
|
|
|
7186
7193
|
if (!found) return;
|
|
7187
7194
|
const tasks = options2.task ?? [];
|
|
7188
7195
|
if (tasks.length === 0) {
|
|
7189
|
-
console.log(
|
|
7196
|
+
console.log(chalk63.red("At least one --task is required."));
|
|
7190
7197
|
process.exitCode = 1;
|
|
7191
7198
|
return;
|
|
7192
7199
|
}
|
|
@@ -7205,14 +7212,14 @@ async function addPhase(id2, name, options2) {
|
|
|
7205
7212
|
);
|
|
7206
7213
|
const verb = options2.position !== void 0 ? "Inserted" : "Added";
|
|
7207
7214
|
console.log(
|
|
7208
|
-
|
|
7215
|
+
chalk63.green(
|
|
7209
7216
|
`${verb} phase ${phaseIdx + 1} "${name}" to item #${itemId} with ${tasks.length} task(s).`
|
|
7210
7217
|
)
|
|
7211
7218
|
);
|
|
7212
7219
|
}
|
|
7213
7220
|
|
|
7214
7221
|
// src/commands/backlog/list/index.ts
|
|
7215
|
-
import
|
|
7222
|
+
import chalk64 from "chalk";
|
|
7216
7223
|
|
|
7217
7224
|
// src/commands/backlog/originDisplayName.ts
|
|
7218
7225
|
function originDisplayName(origin) {
|
|
@@ -7264,7 +7271,7 @@ async function list2(options2) {
|
|
|
7264
7271
|
const allItems = await loadBacklog(options2.allRepos);
|
|
7265
7272
|
const items2 = filterItems(allItems, options2);
|
|
7266
7273
|
if (items2.length === 0) {
|
|
7267
|
-
console.log(
|
|
7274
|
+
console.log(chalk64.dim("Backlog is empty."));
|
|
7268
7275
|
return;
|
|
7269
7276
|
}
|
|
7270
7277
|
const labels = originDisplayLabels(
|
|
@@ -7273,9 +7280,9 @@ async function list2(options2) {
|
|
|
7273
7280
|
const repoNameOf = (item) => item.origin ? labels.get(item.origin) ?? "" : "";
|
|
7274
7281
|
const prefixWidth = options2.allRepos ? Math.max(0, ...items2.map((i) => repoNameOf(i).length)) : 0;
|
|
7275
7282
|
for (const item of items2) {
|
|
7276
|
-
const repoPrefix = options2.allRepos ? `${
|
|
7283
|
+
const repoPrefix = options2.allRepos ? `${chalk64.dim(repoNameOf(item).padEnd(prefixWidth))} ` : "";
|
|
7277
7284
|
console.log(
|
|
7278
|
-
`${repoPrefix}${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
7285
|
+
`${repoPrefix}${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk64.dim(`#${item.id}`)} ${starMarker(item)}${item.name}${phaseLabel(item)}${dependencyLabel(item, allItems)}`
|
|
7279
7286
|
);
|
|
7280
7287
|
if (options2.verbose) {
|
|
7281
7288
|
printVerboseDetails(item);
|
|
@@ -7301,7 +7308,7 @@ function registerItemCommands(cmd) {
|
|
|
7301
7308
|
}
|
|
7302
7309
|
|
|
7303
7310
|
// src/commands/backlog/link.ts
|
|
7304
|
-
import
|
|
7311
|
+
import chalk66 from "chalk";
|
|
7305
7312
|
|
|
7306
7313
|
// src/commands/backlog/hasCycle.ts
|
|
7307
7314
|
function hasCycle(adjacency, fromId, toId) {
|
|
@@ -7333,14 +7340,14 @@ async function loadDependencyGraph(orm) {
|
|
|
7333
7340
|
}
|
|
7334
7341
|
|
|
7335
7342
|
// src/commands/backlog/validateLinkTarget.ts
|
|
7336
|
-
import
|
|
7343
|
+
import chalk65 from "chalk";
|
|
7337
7344
|
function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
7338
7345
|
const duplicate = (fromItem.links ?? []).some(
|
|
7339
7346
|
(l) => l.targetId === toNum && l.type === linkType
|
|
7340
7347
|
);
|
|
7341
7348
|
if (duplicate) {
|
|
7342
7349
|
console.log(
|
|
7343
|
-
|
|
7350
|
+
chalk65.yellow(`Link already exists: #${fromNum} ${linkType} #${toNum}`)
|
|
7344
7351
|
);
|
|
7345
7352
|
return false;
|
|
7346
7353
|
}
|
|
@@ -7349,7 +7356,7 @@ function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
|
7349
7356
|
|
|
7350
7357
|
// src/commands/backlog/link.ts
|
|
7351
7358
|
function fail2(message) {
|
|
7352
|
-
console.log(
|
|
7359
|
+
console.log(chalk66.red(message));
|
|
7353
7360
|
return void 0;
|
|
7354
7361
|
}
|
|
7355
7362
|
function parseLinkType(type) {
|
|
@@ -7379,12 +7386,12 @@ async function link(fromId, toId, opts) {
|
|
|
7379
7386
|
if (await createsCycle(orm, linkType, fromNum, toNum)) return;
|
|
7380
7387
|
await orm.insert(links).values({ itemId: fromNum, type: linkType, targetId: toNum });
|
|
7381
7388
|
console.log(
|
|
7382
|
-
|
|
7389
|
+
chalk66.green(`Linked #${fromNum} ${linkType} #${toNum} (${toItem.name})`)
|
|
7383
7390
|
);
|
|
7384
7391
|
}
|
|
7385
7392
|
|
|
7386
7393
|
// src/commands/backlog/unlink.ts
|
|
7387
|
-
import
|
|
7394
|
+
import chalk67 from "chalk";
|
|
7388
7395
|
import { and as and6, eq as eq21 } from "drizzle-orm";
|
|
7389
7396
|
async function unlink(fromId, toId) {
|
|
7390
7397
|
const fromNum = Number.parseInt(fromId, 10);
|
|
@@ -7392,19 +7399,19 @@ async function unlink(fromId, toId) {
|
|
|
7392
7399
|
const { orm } = await getReady();
|
|
7393
7400
|
const fromItem = await loadItem(orm, fromNum);
|
|
7394
7401
|
if (!fromItem) {
|
|
7395
|
-
console.log(
|
|
7402
|
+
console.log(chalk67.red(`Item #${fromId} not found.`));
|
|
7396
7403
|
return;
|
|
7397
7404
|
}
|
|
7398
7405
|
if (!fromItem.links || fromItem.links.length === 0) {
|
|
7399
|
-
console.log(
|
|
7406
|
+
console.log(chalk67.yellow(`No links found on item #${fromId}.`));
|
|
7400
7407
|
return;
|
|
7401
7408
|
}
|
|
7402
7409
|
if (!fromItem.links.some((l) => l.targetId === toNum)) {
|
|
7403
|
-
console.log(
|
|
7410
|
+
console.log(chalk67.yellow(`No link from #${fromId} to #${toId} found.`));
|
|
7404
7411
|
return;
|
|
7405
7412
|
}
|
|
7406
7413
|
await orm.delete(links).where(and6(eq21(links.itemId, fromNum), eq21(links.targetId, toNum)));
|
|
7407
|
-
console.log(
|
|
7414
|
+
console.log(chalk67.green(`Removed link from #${fromId} to #${toId}.`));
|
|
7408
7415
|
}
|
|
7409
7416
|
|
|
7410
7417
|
// src/commands/backlog/registerLinkCommands.ts
|
|
@@ -7418,17 +7425,17 @@ function registerLinkCommands(cmd) {
|
|
|
7418
7425
|
}
|
|
7419
7426
|
|
|
7420
7427
|
// src/commands/backlog/move-repo/index.ts
|
|
7421
|
-
import
|
|
7428
|
+
import chalk69 from "chalk";
|
|
7422
7429
|
import { eq as eq23 } from "drizzle-orm";
|
|
7423
7430
|
|
|
7424
7431
|
// src/commands/backlog/move-repo/confirmMove.ts
|
|
7425
|
-
import
|
|
7432
|
+
import chalk68 from "chalk";
|
|
7426
7433
|
function pluralItems(n) {
|
|
7427
7434
|
return `${n} item${n === 1 ? "" : "s"}`;
|
|
7428
7435
|
}
|
|
7429
7436
|
async function confirmMove(cnt, oldOrigin, newOrigin) {
|
|
7430
7437
|
console.log(
|
|
7431
|
-
`${pluralItems(cnt)}: ${
|
|
7438
|
+
`${pluralItems(cnt)}: ${chalk68.cyan(oldOrigin)} \u2192 ${chalk68.cyan(newOrigin)}`
|
|
7432
7439
|
);
|
|
7433
7440
|
return promptConfirm(`Retag ${pluralItems(cnt)}?`);
|
|
7434
7441
|
}
|
|
@@ -7460,7 +7467,7 @@ Pass the full origin.`
|
|
|
7460
7467
|
|
|
7461
7468
|
// src/commands/backlog/move-repo/index.ts
|
|
7462
7469
|
function fail3(message) {
|
|
7463
|
-
console.log(
|
|
7470
|
+
console.log(chalk69.red(message));
|
|
7464
7471
|
process.exitCode = 1;
|
|
7465
7472
|
}
|
|
7466
7473
|
async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
@@ -7476,12 +7483,12 @@ async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
|
7476
7483
|
}
|
|
7477
7484
|
const cnt = await countByOrigin(orm, oldOrigin);
|
|
7478
7485
|
if (!options2.yes && !await confirmMove(cnt, oldOrigin, newOrigin)) {
|
|
7479
|
-
console.log(
|
|
7486
|
+
console.log(chalk69.yellow("Move cancelled; no changes made."));
|
|
7480
7487
|
return;
|
|
7481
7488
|
}
|
|
7482
7489
|
await orm.update(items).set({ origin: newOrigin }).where(eq23(items.origin, oldOrigin));
|
|
7483
7490
|
console.log(
|
|
7484
|
-
|
|
7491
|
+
chalk69.green(
|
|
7485
7492
|
`Moved ${pluralItems(cnt)} from "${oldOrigin}" to "${newOrigin}".`
|
|
7486
7493
|
)
|
|
7487
7494
|
);
|
|
@@ -7510,14 +7517,14 @@ function registerPlanCommands(cmd) {
|
|
|
7510
7517
|
}
|
|
7511
7518
|
|
|
7512
7519
|
// src/commands/backlog/refine.ts
|
|
7513
|
-
import
|
|
7520
|
+
import chalk72 from "chalk";
|
|
7514
7521
|
import enquirer7 from "enquirer";
|
|
7515
7522
|
|
|
7516
7523
|
// src/commands/backlog/launchMode.ts
|
|
7517
7524
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
7518
7525
|
|
|
7519
7526
|
// src/commands/backlog/handleLaunchSignal.ts
|
|
7520
|
-
import
|
|
7527
|
+
import chalk71 from "chalk";
|
|
7521
7528
|
|
|
7522
7529
|
// src/commands/backlog/surfaceCreatedItem.ts
|
|
7523
7530
|
async function surfaceCreatedItem(slashCommand, id2) {
|
|
@@ -7535,31 +7542,31 @@ async function surfaceCreatedItem(slashCommand, id2) {
|
|
|
7535
7542
|
}
|
|
7536
7543
|
|
|
7537
7544
|
// src/commands/backlog/tryRunById.ts
|
|
7538
|
-
import
|
|
7545
|
+
import chalk70 from "chalk";
|
|
7539
7546
|
async function tryRunById(id2, options2) {
|
|
7540
7547
|
const numericId = Number.parseInt(id2, 10);
|
|
7541
7548
|
const { orm } = await getReady();
|
|
7542
7549
|
const item = Number.isNaN(numericId) ? void 0 : await loadItem(orm, numericId);
|
|
7543
7550
|
if (!item) {
|
|
7544
|
-
console.log(
|
|
7551
|
+
console.log(chalk70.red(`Item #${id2} not found.`));
|
|
7545
7552
|
return false;
|
|
7546
7553
|
}
|
|
7547
7554
|
if (item.status === "done") {
|
|
7548
|
-
console.log(
|
|
7555
|
+
console.log(chalk70.red(`Item #${id2} is already done.`));
|
|
7549
7556
|
return false;
|
|
7550
7557
|
}
|
|
7551
7558
|
if (item.status === "wontdo") {
|
|
7552
|
-
console.log(
|
|
7559
|
+
console.log(chalk70.red(`Item #${id2} is marked won't do.`));
|
|
7553
7560
|
return false;
|
|
7554
7561
|
}
|
|
7555
7562
|
const hasDeps = (item.links ?? []).some((l) => l.type === "depends-on");
|
|
7556
7563
|
if (hasDeps && isBlocked(item, await loadItemSummaries(orm, getOrigin()))) {
|
|
7557
7564
|
console.log(
|
|
7558
|
-
|
|
7565
|
+
chalk70.red(`Item #${id2} is blocked by unresolved dependencies.`)
|
|
7559
7566
|
);
|
|
7560
7567
|
return false;
|
|
7561
7568
|
}
|
|
7562
|
-
console.log(
|
|
7569
|
+
console.log(chalk70.bold(`
|
|
7563
7570
|
Running backlog item #${id2}...
|
|
7564
7571
|
`));
|
|
7565
7572
|
await run2(id2, options2);
|
|
@@ -7577,7 +7584,7 @@ async function handleLaunchSignal(slashCommand, once) {
|
|
|
7577
7584
|
if (typeof signal.id === "string" && signal.id) {
|
|
7578
7585
|
if (await tryRunById(signal.id, { allowEdits: true })) return;
|
|
7579
7586
|
}
|
|
7580
|
-
console.log(
|
|
7587
|
+
console.log(chalk71.bold("\nChaining into assist next...\n"));
|
|
7581
7588
|
await next({ allowEdits: true, once });
|
|
7582
7589
|
}
|
|
7583
7590
|
}
|
|
@@ -7616,12 +7623,12 @@ async function pickItemForRefine() {
|
|
|
7616
7623
|
(i) => i.status === "todo" || i.status === "in-progress"
|
|
7617
7624
|
);
|
|
7618
7625
|
if (active.length === 0) {
|
|
7619
|
-
console.log(
|
|
7626
|
+
console.log(chalk72.yellow("No active backlog items to refine."));
|
|
7620
7627
|
return void 0;
|
|
7621
7628
|
}
|
|
7622
7629
|
if (active.length === 1) {
|
|
7623
7630
|
const item = active[0];
|
|
7624
|
-
console.log(
|
|
7631
|
+
console.log(chalk72.bold(`Auto-selecting item #${item.id}: ${item.name}`));
|
|
7625
7632
|
return String(item.id);
|
|
7626
7633
|
}
|
|
7627
7634
|
const { selected } = await exitOnCancel(
|
|
@@ -7656,7 +7663,7 @@ function registerRefineCommand(cmd) {
|
|
|
7656
7663
|
}
|
|
7657
7664
|
|
|
7658
7665
|
// src/commands/backlog/rewindPhase.ts
|
|
7659
|
-
import
|
|
7666
|
+
import chalk73 from "chalk";
|
|
7660
7667
|
function validateRewind2(item, plan2, phaseNumber) {
|
|
7661
7668
|
if (phaseNumber < 1 || phaseNumber > plan2.length) {
|
|
7662
7669
|
return `Phase ${phaseNumber} does not exist. Valid range: 1\u2013${plan2.length}.`;
|
|
@@ -7673,13 +7680,13 @@ async function rewindPhase(id2, phase, opts) {
|
|
|
7673
7680
|
const { orm } = await getReady();
|
|
7674
7681
|
const item = await loadItem(orm, Number.parseInt(id2, 10));
|
|
7675
7682
|
if (!item) {
|
|
7676
|
-
console.log(
|
|
7683
|
+
console.log(chalk73.red(`Item #${id2} not found.`));
|
|
7677
7684
|
return;
|
|
7678
7685
|
}
|
|
7679
7686
|
const plan2 = resolveRewindPlan(item);
|
|
7680
7687
|
const error = validateRewind2(item, plan2, phaseNumber);
|
|
7681
7688
|
if (error) {
|
|
7682
|
-
console.log(
|
|
7689
|
+
console.log(chalk73.red(error));
|
|
7683
7690
|
process.exitCode = 1;
|
|
7684
7691
|
return;
|
|
7685
7692
|
}
|
|
@@ -7697,7 +7704,7 @@ async function rewindPhase(id2, phase, opts) {
|
|
|
7697
7704
|
targetPhase: phaseIndex
|
|
7698
7705
|
});
|
|
7699
7706
|
console.log(
|
|
7700
|
-
|
|
7707
|
+
chalk73.green(`Rewound item #${id2} to phase ${phaseNumber} (${phaseName}).`)
|
|
7701
7708
|
);
|
|
7702
7709
|
}
|
|
7703
7710
|
|
|
@@ -7723,22 +7730,22 @@ function registerRunCommand(cmd) {
|
|
|
7723
7730
|
}
|
|
7724
7731
|
|
|
7725
7732
|
// src/commands/backlog/search/index.ts
|
|
7726
|
-
import
|
|
7733
|
+
import chalk74 from "chalk";
|
|
7727
7734
|
async function search(query) {
|
|
7728
7735
|
const items2 = await searchBacklog(query);
|
|
7729
7736
|
if (items2.length === 0) {
|
|
7730
|
-
console.log(
|
|
7737
|
+
console.log(chalk74.dim(`No items matching "${query}".`));
|
|
7731
7738
|
return;
|
|
7732
7739
|
}
|
|
7733
7740
|
console.log(
|
|
7734
|
-
|
|
7741
|
+
chalk74.dim(
|
|
7735
7742
|
`${items2.length} item${items2.length === 1 ? "" : "s"} matching "${query}":
|
|
7736
7743
|
`
|
|
7737
7744
|
)
|
|
7738
7745
|
);
|
|
7739
7746
|
for (const item of items2) {
|
|
7740
7747
|
console.log(
|
|
7741
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
7748
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk74.dim(`#${item.id}`)} ${item.name}`
|
|
7742
7749
|
);
|
|
7743
7750
|
}
|
|
7744
7751
|
}
|
|
@@ -7749,16 +7756,16 @@ function registerSearchCommand(cmd) {
|
|
|
7749
7756
|
}
|
|
7750
7757
|
|
|
7751
7758
|
// src/commands/backlog/delete/index.ts
|
|
7752
|
-
import
|
|
7759
|
+
import chalk75 from "chalk";
|
|
7753
7760
|
async function del(id2) {
|
|
7754
7761
|
const name = await removeItem(id2);
|
|
7755
7762
|
if (name) {
|
|
7756
|
-
console.log(
|
|
7763
|
+
console.log(chalk75.green(`Deleted item #${id2}: ${name}`));
|
|
7757
7764
|
}
|
|
7758
7765
|
}
|
|
7759
7766
|
|
|
7760
7767
|
// src/commands/backlog/done/index.ts
|
|
7761
|
-
import
|
|
7768
|
+
import chalk76 from "chalk";
|
|
7762
7769
|
async function done(id2, summary) {
|
|
7763
7770
|
const found = await findOneItem(id2);
|
|
7764
7771
|
if (!found) return;
|
|
@@ -7768,12 +7775,12 @@ async function done(id2, summary) {
|
|
|
7768
7775
|
const pending = item.plan.slice(completedCount);
|
|
7769
7776
|
if (pending.length > 0) {
|
|
7770
7777
|
console.log(
|
|
7771
|
-
|
|
7778
|
+
chalk76.red(
|
|
7772
7779
|
`Cannot complete item #${id2}: ${pending.length} pending phase(s):`
|
|
7773
7780
|
)
|
|
7774
7781
|
);
|
|
7775
7782
|
for (const phase of pending) {
|
|
7776
|
-
console.log(
|
|
7783
|
+
console.log(chalk76.yellow(` - ${phase.name}`));
|
|
7777
7784
|
}
|
|
7778
7785
|
process.exitCode = 1;
|
|
7779
7786
|
return;
|
|
@@ -7784,18 +7791,18 @@ async function done(id2, summary) {
|
|
|
7784
7791
|
const phase = item.currentPhase ?? 1;
|
|
7785
7792
|
await appendComment(orm, item.id, summary, { phase, type: "summary" });
|
|
7786
7793
|
}
|
|
7787
|
-
console.log(
|
|
7794
|
+
console.log(chalk76.green(`Completed item #${id2}: ${item.name}`));
|
|
7788
7795
|
}
|
|
7789
7796
|
|
|
7790
7797
|
// src/commands/backlog/star/index.ts
|
|
7791
|
-
import
|
|
7798
|
+
import chalk78 from "chalk";
|
|
7792
7799
|
|
|
7793
7800
|
// src/commands/backlog/setStarred.ts
|
|
7794
|
-
import
|
|
7801
|
+
import chalk77 from "chalk";
|
|
7795
7802
|
async function setStarred(id2, starred) {
|
|
7796
7803
|
const { orm } = await getReady();
|
|
7797
7804
|
const name = await updateStarred(orm, Number.parseInt(id2, 10), starred);
|
|
7798
|
-
if (name === void 0) console.log(
|
|
7805
|
+
if (name === void 0) console.log(chalk77.red(`Item #${id2} not found.`));
|
|
7799
7806
|
return name;
|
|
7800
7807
|
}
|
|
7801
7808
|
|
|
@@ -7803,45 +7810,45 @@ async function setStarred(id2, starred) {
|
|
|
7803
7810
|
async function star(id2) {
|
|
7804
7811
|
const name = await setStarred(id2, true);
|
|
7805
7812
|
if (name) {
|
|
7806
|
-
console.log(
|
|
7813
|
+
console.log(chalk78.green(`Starred item #${id2}: ${name}`));
|
|
7807
7814
|
}
|
|
7808
7815
|
}
|
|
7809
7816
|
|
|
7810
7817
|
// src/commands/backlog/start/index.ts
|
|
7811
|
-
import
|
|
7818
|
+
import chalk79 from "chalk";
|
|
7812
7819
|
async function start(id2) {
|
|
7813
7820
|
const name = await setStatus(id2, "in-progress");
|
|
7814
7821
|
if (name) {
|
|
7815
|
-
console.log(
|
|
7822
|
+
console.log(chalk79.green(`Started item #${id2}: ${name}`));
|
|
7816
7823
|
}
|
|
7817
7824
|
}
|
|
7818
7825
|
|
|
7819
7826
|
// src/commands/backlog/stop/index.ts
|
|
7820
|
-
import
|
|
7827
|
+
import chalk80 from "chalk";
|
|
7821
7828
|
import { and as and7, eq as eq24 } from "drizzle-orm";
|
|
7822
7829
|
async function stop() {
|
|
7823
7830
|
const { orm } = await getReady();
|
|
7824
7831
|
const stopped = await orm.update(items).set({ status: "todo", currentPhase: 1 }).where(and7(eq24(items.status, "in-progress"), eq24(items.origin, getOrigin()))).returning({ id: items.id, name: items.name });
|
|
7825
7832
|
if (stopped.length === 0) {
|
|
7826
|
-
console.log(
|
|
7833
|
+
console.log(chalk80.yellow("No in-progress items to stop."));
|
|
7827
7834
|
return;
|
|
7828
7835
|
}
|
|
7829
7836
|
for (const item of stopped) {
|
|
7830
|
-
console.log(
|
|
7837
|
+
console.log(chalk80.yellow(`Stopped item #${item.id}: ${item.name}`));
|
|
7831
7838
|
}
|
|
7832
7839
|
}
|
|
7833
7840
|
|
|
7834
7841
|
// src/commands/backlog/unstar/index.ts
|
|
7835
|
-
import
|
|
7842
|
+
import chalk81 from "chalk";
|
|
7836
7843
|
async function unstar(id2) {
|
|
7837
7844
|
const name = await setStarred(id2, false);
|
|
7838
7845
|
if (name) {
|
|
7839
|
-
console.log(
|
|
7846
|
+
console.log(chalk81.green(`Unstarred item #${id2}: ${name}`));
|
|
7840
7847
|
}
|
|
7841
7848
|
}
|
|
7842
7849
|
|
|
7843
7850
|
// src/commands/backlog/wontdo/index.ts
|
|
7844
|
-
import
|
|
7851
|
+
import chalk82 from "chalk";
|
|
7845
7852
|
async function wontdo(id2, reason) {
|
|
7846
7853
|
const found = await findOneItem(id2);
|
|
7847
7854
|
if (!found) return;
|
|
@@ -7851,7 +7858,7 @@ async function wontdo(id2, reason) {
|
|
|
7851
7858
|
const phase = item.currentPhase ?? 1;
|
|
7852
7859
|
await appendComment(orm, item.id, reason, { phase, type: "summary" });
|
|
7853
7860
|
}
|
|
7854
|
-
console.log(
|
|
7861
|
+
console.log(chalk82.red(`Won't do item #${id2}: ${item.name}`));
|
|
7855
7862
|
}
|
|
7856
7863
|
|
|
7857
7864
|
// src/commands/backlog/registerStatusCommands.ts
|
|
@@ -7866,11 +7873,11 @@ function registerStatusCommands(cmd) {
|
|
|
7866
7873
|
}
|
|
7867
7874
|
|
|
7868
7875
|
// src/commands/backlog/removePhase.ts
|
|
7869
|
-
import
|
|
7876
|
+
import chalk84 from "chalk";
|
|
7870
7877
|
import { and as and10, eq as eq27 } from "drizzle-orm";
|
|
7871
7878
|
|
|
7872
7879
|
// src/commands/backlog/findPhase.ts
|
|
7873
|
-
import
|
|
7880
|
+
import chalk83 from "chalk";
|
|
7874
7881
|
import { and as and8, count as count4, eq as eq25 } from "drizzle-orm";
|
|
7875
7882
|
async function findPhase(id2, phase) {
|
|
7876
7883
|
const found = await findOneItem(id2);
|
|
@@ -7881,7 +7888,7 @@ async function findPhase(id2, phase) {
|
|
|
7881
7888
|
const [row] = await orm.select({ cnt: count4() }).from(planPhases).where(and8(eq25(planPhases.itemId, itemId), eq25(planPhases.idx, phaseIdx)));
|
|
7882
7889
|
if (!row || row.cnt === 0) {
|
|
7883
7890
|
console.log(
|
|
7884
|
-
|
|
7891
|
+
chalk83.red(`Phase ${phaseIdx + 1} not found on item #${itemId}.`)
|
|
7885
7892
|
);
|
|
7886
7893
|
process.exitCode = 1;
|
|
7887
7894
|
return void 0;
|
|
@@ -7928,12 +7935,12 @@ async function removePhase(id2, phase) {
|
|
|
7928
7935
|
await adjustCurrentPhase(tx, item, phaseIdx);
|
|
7929
7936
|
});
|
|
7930
7937
|
console.log(
|
|
7931
|
-
|
|
7938
|
+
chalk84.green(`Removed phase ${phaseIdx + 1} from item #${itemId}.`)
|
|
7932
7939
|
);
|
|
7933
7940
|
}
|
|
7934
7941
|
|
|
7935
7942
|
// src/commands/backlog/update/index.ts
|
|
7936
|
-
import
|
|
7943
|
+
import chalk86 from "chalk";
|
|
7937
7944
|
import { eq as eq28 } from "drizzle-orm";
|
|
7938
7945
|
|
|
7939
7946
|
// src/commands/backlog/update/parseListIndex.ts
|
|
@@ -8009,16 +8016,16 @@ function applyAcMutations(current, options2) {
|
|
|
8009
8016
|
}
|
|
8010
8017
|
|
|
8011
8018
|
// src/commands/backlog/update/buildUpdateValues.ts
|
|
8012
|
-
import
|
|
8019
|
+
import chalk85 from "chalk";
|
|
8013
8020
|
function buildUpdateValues(options2) {
|
|
8014
8021
|
const { name, desc: desc6, type, ac } = options2;
|
|
8015
8022
|
if (!name && !desc6 && !type && !ac) {
|
|
8016
|
-
console.log(
|
|
8023
|
+
console.log(chalk85.red("Nothing to update. Provide at least one flag."));
|
|
8017
8024
|
process.exitCode = 1;
|
|
8018
8025
|
return void 0;
|
|
8019
8026
|
}
|
|
8020
8027
|
if (type && type !== "story" && type !== "bug") {
|
|
8021
|
-
console.log(
|
|
8028
|
+
console.log(chalk85.red('Invalid type. Must be "story" or "bug".'));
|
|
8022
8029
|
process.exitCode = 1;
|
|
8023
8030
|
return void 0;
|
|
8024
8031
|
}
|
|
@@ -8051,14 +8058,14 @@ async function update(id2, options2) {
|
|
|
8051
8058
|
if (hasAcMutations(options2)) {
|
|
8052
8059
|
if (options2.ac) {
|
|
8053
8060
|
console.log(
|
|
8054
|
-
|
|
8061
|
+
chalk86.red("Cannot combine --ac with --add-ac/--edit-ac/--remove-ac.")
|
|
8055
8062
|
);
|
|
8056
8063
|
process.exitCode = 1;
|
|
8057
8064
|
return;
|
|
8058
8065
|
}
|
|
8059
8066
|
const mutation = applyAcMutations(found.item.acceptanceCriteria, options2);
|
|
8060
8067
|
if (!mutation.ok) {
|
|
8061
|
-
console.log(
|
|
8068
|
+
console.log(chalk86.red(mutation.error));
|
|
8062
8069
|
process.exitCode = 1;
|
|
8063
8070
|
return;
|
|
8064
8071
|
}
|
|
@@ -8069,11 +8076,11 @@ async function update(id2, options2) {
|
|
|
8069
8076
|
const { orm } = found;
|
|
8070
8077
|
const itemId = found.item.id;
|
|
8071
8078
|
await orm.update(items).set(built.set).where(eq28(items.id, itemId));
|
|
8072
|
-
console.log(
|
|
8079
|
+
console.log(chalk86.green(`Updated ${built.fields} on item #${itemId}.`));
|
|
8073
8080
|
}
|
|
8074
8081
|
|
|
8075
8082
|
// src/commands/backlog/updatePhase.ts
|
|
8076
|
-
import
|
|
8083
|
+
import chalk87 from "chalk";
|
|
8077
8084
|
|
|
8078
8085
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
8079
8086
|
import { and as and11, eq as eq29 } from "drizzle-orm";
|
|
@@ -8177,7 +8184,7 @@ async function updatePhase(id2, phase, options2) {
|
|
|
8177
8184
|
const { item, orm, itemId, phaseIdx } = found;
|
|
8178
8185
|
const resolved = resolvePhaseFields(options2, item.plan?.[phaseIdx]);
|
|
8179
8186
|
if (!resolved.ok) {
|
|
8180
|
-
console.log(
|
|
8187
|
+
console.log(chalk87.red(resolved.error));
|
|
8181
8188
|
process.exitCode = 1;
|
|
8182
8189
|
return;
|
|
8183
8190
|
}
|
|
@@ -8189,7 +8196,7 @@ async function updatePhase(id2, phase, options2) {
|
|
|
8189
8196
|
manualCheck && "manual checks"
|
|
8190
8197
|
].filter(Boolean).join(", ");
|
|
8191
8198
|
console.log(
|
|
8192
|
-
|
|
8199
|
+
chalk87.green(
|
|
8193
8200
|
`Updated ${fields} on phase ${phaseIdx + 1} of item #${itemId}.`
|
|
8194
8201
|
)
|
|
8195
8202
|
);
|
|
@@ -8922,11 +8929,11 @@ function assertCliExists(cli) {
|
|
|
8922
8929
|
}
|
|
8923
8930
|
|
|
8924
8931
|
// src/commands/permitCliReads/colorize.ts
|
|
8925
|
-
import
|
|
8932
|
+
import chalk88 from "chalk";
|
|
8926
8933
|
function colorize(plainOutput) {
|
|
8927
8934
|
return plainOutput.split("\n").map((line) => {
|
|
8928
|
-
if (line.startsWith(" R ")) return
|
|
8929
|
-
if (line.startsWith(" W ")) return
|
|
8935
|
+
if (line.startsWith(" R ")) return chalk88.green(line);
|
|
8936
|
+
if (line.startsWith(" W ")) return chalk88.red(line);
|
|
8930
8937
|
return line;
|
|
8931
8938
|
}).join("\n");
|
|
8932
8939
|
}
|
|
@@ -9224,7 +9231,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
9224
9231
|
}
|
|
9225
9232
|
|
|
9226
9233
|
// src/commands/deny/denyAdd.ts
|
|
9227
|
-
import
|
|
9234
|
+
import chalk89 from "chalk";
|
|
9228
9235
|
|
|
9229
9236
|
// src/commands/deny/loadDenyConfig.ts
|
|
9230
9237
|
function loadDenyConfig(global) {
|
|
@@ -9244,16 +9251,16 @@ function loadDenyConfig(global) {
|
|
|
9244
9251
|
function denyAdd(pattern2, message, options2) {
|
|
9245
9252
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
9246
9253
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
9247
|
-
console.log(
|
|
9254
|
+
console.log(chalk89.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
9248
9255
|
return;
|
|
9249
9256
|
}
|
|
9250
9257
|
deny.push({ pattern: pattern2, message });
|
|
9251
9258
|
saveDeny(deny);
|
|
9252
|
-
console.log(
|
|
9259
|
+
console.log(chalk89.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
9253
9260
|
}
|
|
9254
9261
|
|
|
9255
9262
|
// src/commands/deny/denyList.ts
|
|
9256
|
-
import
|
|
9263
|
+
import chalk90 from "chalk";
|
|
9257
9264
|
function denyList() {
|
|
9258
9265
|
const globalRaw = loadGlobalConfigRaw();
|
|
9259
9266
|
const projectRaw = loadProjectConfig();
|
|
@@ -9264,7 +9271,7 @@ function denyList() {
|
|
|
9264
9271
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
9265
9272
|
);
|
|
9266
9273
|
if (!merged || merged.length === 0) {
|
|
9267
|
-
console.log(
|
|
9274
|
+
console.log(chalk90.dim("No deny rules configured."));
|
|
9268
9275
|
return;
|
|
9269
9276
|
}
|
|
9270
9277
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -9272,23 +9279,23 @@ function denyList() {
|
|
|
9272
9279
|
for (const rule of merged) {
|
|
9273
9280
|
const inProject = projectPatterns.has(rule.pattern);
|
|
9274
9281
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
9275
|
-
const label2 = inProject && inGlobal ?
|
|
9276
|
-
console.log(`${
|
|
9282
|
+
const label2 = inProject && inGlobal ? chalk90.dim(" (project, overrides global)") : inGlobal ? chalk90.dim(" (global)") : "";
|
|
9283
|
+
console.log(`${chalk90.red(rule.pattern)} \u2192 ${rule.message}${label2}`);
|
|
9277
9284
|
}
|
|
9278
9285
|
}
|
|
9279
9286
|
|
|
9280
9287
|
// src/commands/deny/denyRemove.ts
|
|
9281
|
-
import
|
|
9288
|
+
import chalk91 from "chalk";
|
|
9282
9289
|
function denyRemove(pattern2, options2) {
|
|
9283
9290
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
9284
9291
|
const index3 = deny.findIndex((r) => r.pattern === pattern2);
|
|
9285
9292
|
if (index3 === -1) {
|
|
9286
|
-
console.log(
|
|
9293
|
+
console.log(chalk91.yellow(`No deny rule found for: ${pattern2}`));
|
|
9287
9294
|
return;
|
|
9288
9295
|
}
|
|
9289
9296
|
deny.splice(index3, 1);
|
|
9290
9297
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
9291
|
-
console.log(
|
|
9298
|
+
console.log(chalk91.green(`Removed deny rule: ${pattern2}`));
|
|
9292
9299
|
}
|
|
9293
9300
|
|
|
9294
9301
|
// src/commands/registerDeny.ts
|
|
@@ -9317,15 +9324,15 @@ function registerCliHook(program2) {
|
|
|
9317
9324
|
}
|
|
9318
9325
|
|
|
9319
9326
|
// src/commands/complexity/analyze.ts
|
|
9320
|
-
import
|
|
9327
|
+
import chalk98 from "chalk";
|
|
9321
9328
|
|
|
9322
9329
|
// src/commands/complexity/cyclomatic.ts
|
|
9323
|
-
import
|
|
9330
|
+
import chalk93 from "chalk";
|
|
9324
9331
|
|
|
9325
9332
|
// src/commands/complexity/shared/index.ts
|
|
9326
9333
|
import fs16 from "fs";
|
|
9327
9334
|
import path21 from "path";
|
|
9328
|
-
import
|
|
9335
|
+
import chalk92 from "chalk";
|
|
9329
9336
|
import ts5 from "typescript";
|
|
9330
9337
|
|
|
9331
9338
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -9576,7 +9583,7 @@ function createSourceFromFile(filePath) {
|
|
|
9576
9583
|
function withSourceFiles(pattern2, callback, extraIgnore = []) {
|
|
9577
9584
|
const files = findSourceFiles2(pattern2, ".", extraIgnore);
|
|
9578
9585
|
if (files.length === 0) {
|
|
9579
|
-
console.log(
|
|
9586
|
+
console.log(chalk92.yellow("No files found matching pattern"));
|
|
9580
9587
|
return void 0;
|
|
9581
9588
|
}
|
|
9582
9589
|
return callback(files);
|
|
@@ -9609,11 +9616,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
9609
9616
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
9610
9617
|
for (const { file, name, complexity } of results) {
|
|
9611
9618
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
9612
|
-
const color = exceedsThreshold ?
|
|
9613
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
9619
|
+
const color = exceedsThreshold ? chalk93.red : chalk93.white;
|
|
9620
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk93.cyan(complexity)}`);
|
|
9614
9621
|
}
|
|
9615
9622
|
console.log(
|
|
9616
|
-
|
|
9623
|
+
chalk93.dim(
|
|
9617
9624
|
`
|
|
9618
9625
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
9619
9626
|
)
|
|
@@ -9625,7 +9632,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
9625
9632
|
}
|
|
9626
9633
|
|
|
9627
9634
|
// src/commands/complexity/halstead.ts
|
|
9628
|
-
import
|
|
9635
|
+
import chalk94 from "chalk";
|
|
9629
9636
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
9630
9637
|
withSourceFiles(pattern2, (files) => {
|
|
9631
9638
|
const results = [];
|
|
@@ -9640,13 +9647,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
9640
9647
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
9641
9648
|
for (const { file, name, metrics } of results) {
|
|
9642
9649
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
9643
|
-
const color = exceedsThreshold ?
|
|
9650
|
+
const color = exceedsThreshold ? chalk94.red : chalk94.white;
|
|
9644
9651
|
console.log(
|
|
9645
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
9652
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk94.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk94.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk94.magenta(metrics.effort.toFixed(1))}`
|
|
9646
9653
|
);
|
|
9647
9654
|
}
|
|
9648
9655
|
console.log(
|
|
9649
|
-
|
|
9656
|
+
chalk94.dim(
|
|
9650
9657
|
`
|
|
9651
9658
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
9652
9659
|
)
|
|
@@ -9670,28 +9677,28 @@ function calculateMaintainabilityIndex(halsteadVolume, cyclomaticComplexity, slo
|
|
|
9670
9677
|
}
|
|
9671
9678
|
|
|
9672
9679
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
9673
|
-
import
|
|
9680
|
+
import chalk95 from "chalk";
|
|
9674
9681
|
function displayMaintainabilityResults(results, threshold) {
|
|
9675
9682
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
9676
9683
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
9677
|
-
console.log(
|
|
9684
|
+
console.log(chalk95.green("All files pass maintainability threshold"));
|
|
9678
9685
|
} else {
|
|
9679
9686
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
9680
|
-
const color = threshold !== void 0 ?
|
|
9687
|
+
const color = threshold !== void 0 ? chalk95.red : chalk95.white;
|
|
9681
9688
|
console.log(
|
|
9682
|
-
`${color(file)} \u2192 avg: ${
|
|
9689
|
+
`${color(file)} \u2192 avg: ${chalk95.cyan(avgMaintainability.toFixed(1))}, min: ${chalk95.yellow(minMaintainability.toFixed(1))}`
|
|
9683
9690
|
);
|
|
9684
9691
|
}
|
|
9685
9692
|
}
|
|
9686
|
-
console.log(
|
|
9693
|
+
console.log(chalk95.dim(`
|
|
9687
9694
|
Analyzed ${results.length} files`));
|
|
9688
9695
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
9689
9696
|
console.error(
|
|
9690
|
-
|
|
9697
|
+
chalk95.red(
|
|
9691
9698
|
`
|
|
9692
9699
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
9693
9700
|
|
|
9694
|
-
\u26A0\uFE0F ${
|
|
9701
|
+
\u26A0\uFE0F ${chalk95.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.`
|
|
9695
9702
|
)
|
|
9696
9703
|
);
|
|
9697
9704
|
process.exit(1);
|
|
@@ -9699,10 +9706,10 @@ Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability i
|
|
|
9699
9706
|
}
|
|
9700
9707
|
|
|
9701
9708
|
// src/commands/complexity/maintainability/printMaintainabilityFormula.ts
|
|
9702
|
-
import
|
|
9709
|
+
import chalk96 from "chalk";
|
|
9703
9710
|
var MI_FORMULA = "171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100";
|
|
9704
9711
|
function printMaintainabilityFormula() {
|
|
9705
|
-
console.log(
|
|
9712
|
+
console.log(chalk96.dim(MI_FORMULA));
|
|
9706
9713
|
}
|
|
9707
9714
|
|
|
9708
9715
|
// src/commands/complexity/maintainability/index.ts
|
|
@@ -9753,7 +9760,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
9753
9760
|
|
|
9754
9761
|
// src/commands/complexity/sloc.ts
|
|
9755
9762
|
import fs18 from "fs";
|
|
9756
|
-
import
|
|
9763
|
+
import chalk97 from "chalk";
|
|
9757
9764
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
9758
9765
|
withSourceFiles(pattern2, (files) => {
|
|
9759
9766
|
const results = [];
|
|
@@ -9769,12 +9776,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
9769
9776
|
results.sort((a, b) => b.lines - a.lines);
|
|
9770
9777
|
for (const { file, lines } of results) {
|
|
9771
9778
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
9772
|
-
const color = exceedsThreshold ?
|
|
9773
|
-
console.log(`${color(file)} \u2192 ${
|
|
9779
|
+
const color = exceedsThreshold ? chalk97.red : chalk97.white;
|
|
9780
|
+
console.log(`${color(file)} \u2192 ${chalk97.cyan(lines)} lines`);
|
|
9774
9781
|
}
|
|
9775
9782
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
9776
9783
|
console.log(
|
|
9777
|
-
|
|
9784
|
+
chalk97.dim(`
|
|
9778
9785
|
Total: ${total} lines across ${files.length} files`)
|
|
9779
9786
|
);
|
|
9780
9787
|
if (hasViolation) {
|
|
@@ -9788,25 +9795,25 @@ async function analyze(pattern2) {
|
|
|
9788
9795
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
9789
9796
|
const files = findSourceFiles2(searchPattern);
|
|
9790
9797
|
if (files.length === 0) {
|
|
9791
|
-
console.log(
|
|
9798
|
+
console.log(chalk98.yellow("No files found matching pattern"));
|
|
9792
9799
|
return;
|
|
9793
9800
|
}
|
|
9794
9801
|
if (files.length === 1) {
|
|
9795
9802
|
const file = files[0];
|
|
9796
|
-
console.log(
|
|
9803
|
+
console.log(chalk98.bold.underline("SLOC"));
|
|
9797
9804
|
await sloc(file);
|
|
9798
9805
|
console.log();
|
|
9799
|
-
console.log(
|
|
9806
|
+
console.log(chalk98.bold.underline("Cyclomatic Complexity"));
|
|
9800
9807
|
await cyclomatic(file);
|
|
9801
9808
|
console.log();
|
|
9802
|
-
console.log(
|
|
9809
|
+
console.log(chalk98.bold.underline("Halstead Metrics"));
|
|
9803
9810
|
await halstead(file);
|
|
9804
9811
|
console.log();
|
|
9805
|
-
console.log(
|
|
9812
|
+
console.log(chalk98.bold.underline("Maintainability Index"));
|
|
9806
9813
|
await maintainability(file);
|
|
9807
9814
|
console.log();
|
|
9808
9815
|
console.log(
|
|
9809
|
-
|
|
9816
|
+
chalk98.dim(
|
|
9810
9817
|
"To improve the maintainability index, extract functions and logic out of this file into separate, smaller modules. Collapsing whitespace or removing comments is not the goal."
|
|
9811
9818
|
)
|
|
9812
9819
|
);
|
|
@@ -9840,7 +9847,7 @@ function registerComplexity(program2) {
|
|
|
9840
9847
|
}
|
|
9841
9848
|
|
|
9842
9849
|
// src/commands/config/index.ts
|
|
9843
|
-
import
|
|
9850
|
+
import chalk99 from "chalk";
|
|
9844
9851
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
9845
9852
|
|
|
9846
9853
|
// src/commands/config/setNestedValue.ts
|
|
@@ -9903,7 +9910,7 @@ function formatIssuePath(issue, key) {
|
|
|
9903
9910
|
function printValidationErrors(issues, key) {
|
|
9904
9911
|
for (const issue of issues) {
|
|
9905
9912
|
console.error(
|
|
9906
|
-
|
|
9913
|
+
chalk99.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
9907
9914
|
);
|
|
9908
9915
|
}
|
|
9909
9916
|
}
|
|
@@ -9920,7 +9927,7 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
9920
9927
|
function assertNotGlobalOnly(key, global) {
|
|
9921
9928
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
9922
9929
|
console.error(
|
|
9923
|
-
|
|
9930
|
+
chalk99.red(
|
|
9924
9931
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
9925
9932
|
)
|
|
9926
9933
|
);
|
|
@@ -9943,7 +9950,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
9943
9950
|
applyConfigSet(key, coerced, options2.global ?? false);
|
|
9944
9951
|
const target = options2.global ? "global" : "project";
|
|
9945
9952
|
console.log(
|
|
9946
|
-
|
|
9953
|
+
chalk99.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
9947
9954
|
);
|
|
9948
9955
|
}
|
|
9949
9956
|
function configList() {
|
|
@@ -9952,7 +9959,7 @@ function configList() {
|
|
|
9952
9959
|
}
|
|
9953
9960
|
|
|
9954
9961
|
// src/commands/config/configGet.ts
|
|
9955
|
-
import
|
|
9962
|
+
import chalk100 from "chalk";
|
|
9956
9963
|
|
|
9957
9964
|
// src/commands/config/getNestedValue.ts
|
|
9958
9965
|
function isTraversable(value) {
|
|
@@ -9984,7 +9991,7 @@ function requireNestedValue(config, key) {
|
|
|
9984
9991
|
return value;
|
|
9985
9992
|
}
|
|
9986
9993
|
function exitKeyNotSet(key) {
|
|
9987
|
-
console.error(
|
|
9994
|
+
console.error(chalk100.red(`Key "${key}" is not set`));
|
|
9988
9995
|
process.exit(1);
|
|
9989
9996
|
}
|
|
9990
9997
|
|
|
@@ -9998,7 +10005,7 @@ function registerConfig(program2) {
|
|
|
9998
10005
|
|
|
9999
10006
|
// src/commands/deploy/redirect.ts
|
|
10000
10007
|
import { existsSync as existsSync27, readFileSync as readFileSync22, writeFileSync as writeFileSync22 } from "fs";
|
|
10001
|
-
import
|
|
10008
|
+
import chalk101 from "chalk";
|
|
10002
10009
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
10003
10010
|
if (!window.location.pathname.endsWith('/')) {
|
|
10004
10011
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -10007,23 +10014,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
10007
10014
|
function redirect() {
|
|
10008
10015
|
const indexPath = "index.html";
|
|
10009
10016
|
if (!existsSync27(indexPath)) {
|
|
10010
|
-
console.log(
|
|
10017
|
+
console.log(chalk101.yellow("No index.html found"));
|
|
10011
10018
|
return;
|
|
10012
10019
|
}
|
|
10013
10020
|
const content = readFileSync22(indexPath, "utf8");
|
|
10014
10021
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
10015
|
-
console.log(
|
|
10022
|
+
console.log(chalk101.dim("Trailing slash script already present"));
|
|
10016
10023
|
return;
|
|
10017
10024
|
}
|
|
10018
10025
|
const headCloseIndex = content.indexOf("</head>");
|
|
10019
10026
|
if (headCloseIndex === -1) {
|
|
10020
|
-
console.log(
|
|
10027
|
+
console.log(chalk101.red("Could not find </head> tag in index.html"));
|
|
10021
10028
|
return;
|
|
10022
10029
|
}
|
|
10023
10030
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
10024
10031
|
${content.slice(headCloseIndex)}`;
|
|
10025
10032
|
writeFileSync22(indexPath, newContent);
|
|
10026
|
-
console.log(
|
|
10033
|
+
console.log(chalk101.green("Added trailing slash redirect to index.html"));
|
|
10027
10034
|
}
|
|
10028
10035
|
|
|
10029
10036
|
// src/commands/registerDeploy.ts
|
|
@@ -10050,7 +10057,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
10050
10057
|
|
|
10051
10058
|
// src/commands/devlog/shared.ts
|
|
10052
10059
|
import { execSync as execSync23 } from "child_process";
|
|
10053
|
-
import
|
|
10060
|
+
import chalk102 from "chalk";
|
|
10054
10061
|
|
|
10055
10062
|
// src/shared/getRepoName.ts
|
|
10056
10063
|
import { existsSync as existsSync28, readFileSync as readFileSync23 } from "fs";
|
|
@@ -10159,13 +10166,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
10159
10166
|
}
|
|
10160
10167
|
function printCommitsWithFiles(commits2, ignore2, verbose) {
|
|
10161
10168
|
for (const commit2 of commits2) {
|
|
10162
|
-
console.log(` ${
|
|
10169
|
+
console.log(` ${chalk102.yellow(commit2.hash)} ${commit2.message}`);
|
|
10163
10170
|
if (verbose) {
|
|
10164
10171
|
const visibleFiles = commit2.files.filter(
|
|
10165
10172
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
10166
10173
|
);
|
|
10167
10174
|
for (const file of visibleFiles) {
|
|
10168
|
-
console.log(` ${
|
|
10175
|
+
console.log(` ${chalk102.dim(file)}`);
|
|
10169
10176
|
}
|
|
10170
10177
|
}
|
|
10171
10178
|
}
|
|
@@ -10190,15 +10197,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
10190
10197
|
}
|
|
10191
10198
|
|
|
10192
10199
|
// src/commands/devlog/list/printDateHeader.ts
|
|
10193
|
-
import
|
|
10200
|
+
import chalk103 from "chalk";
|
|
10194
10201
|
function printDateHeader(date, isSkipped, entries) {
|
|
10195
10202
|
if (isSkipped) {
|
|
10196
|
-
console.log(`${
|
|
10203
|
+
console.log(`${chalk103.bold.blue(date)} ${chalk103.dim("skipped")}`);
|
|
10197
10204
|
} else if (entries && entries.length > 0) {
|
|
10198
|
-
const entryInfo = entries.map((e) => `${
|
|
10199
|
-
console.log(`${
|
|
10205
|
+
const entryInfo = entries.map((e) => `${chalk103.green(e.version)} ${e.title}`).join(" | ");
|
|
10206
|
+
console.log(`${chalk103.bold.blue(date)} ${entryInfo}`);
|
|
10200
10207
|
} else {
|
|
10201
|
-
console.log(`${
|
|
10208
|
+
console.log(`${chalk103.bold.blue(date)} ${chalk103.red("\u26A0 devlog missing")}`);
|
|
10202
10209
|
}
|
|
10203
10210
|
}
|
|
10204
10211
|
|
|
@@ -10302,24 +10309,24 @@ function bumpVersion(version2, type) {
|
|
|
10302
10309
|
|
|
10303
10310
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
10304
10311
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
10305
|
-
import
|
|
10312
|
+
import chalk105 from "chalk";
|
|
10306
10313
|
|
|
10307
10314
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
10308
|
-
import
|
|
10315
|
+
import chalk104 from "chalk";
|
|
10309
10316
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
10310
10317
|
if (conventional && firstHash) {
|
|
10311
10318
|
const version2 = getVersionAtCommit(firstHash);
|
|
10312
10319
|
if (version2) {
|
|
10313
|
-
console.log(`${
|
|
10320
|
+
console.log(`${chalk104.bold("version:")} ${stripToMinor(version2)}`);
|
|
10314
10321
|
} else {
|
|
10315
|
-
console.log(`${
|
|
10322
|
+
console.log(`${chalk104.bold("version:")} ${chalk104.red("unknown")}`);
|
|
10316
10323
|
}
|
|
10317
10324
|
} else if (patchVersion && minorVersion) {
|
|
10318
10325
|
console.log(
|
|
10319
|
-
`${
|
|
10326
|
+
`${chalk104.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
10320
10327
|
);
|
|
10321
10328
|
} else {
|
|
10322
|
-
console.log(`${
|
|
10329
|
+
console.log(`${chalk104.bold("version:")} v0.1 (initial)`);
|
|
10323
10330
|
}
|
|
10324
10331
|
}
|
|
10325
10332
|
|
|
@@ -10367,16 +10374,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
10367
10374
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
10368
10375
|
}
|
|
10369
10376
|
function logName(repoName) {
|
|
10370
|
-
console.log(`${
|
|
10377
|
+
console.log(`${chalk105.bold("name:")} ${repoName}`);
|
|
10371
10378
|
}
|
|
10372
10379
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
10373
10380
|
logName(ctx.repoName);
|
|
10374
10381
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
10375
|
-
console.log(
|
|
10382
|
+
console.log(chalk105.bold.blue(targetDate));
|
|
10376
10383
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
10377
10384
|
}
|
|
10378
10385
|
function logNoCommits(lastInfo) {
|
|
10379
|
-
console.log(
|
|
10386
|
+
console.log(chalk105.dim(noCommitsMessage(!!lastInfo)));
|
|
10380
10387
|
}
|
|
10381
10388
|
|
|
10382
10389
|
// src/commands/devlog/next/index.ts
|
|
@@ -10417,11 +10424,11 @@ function next2(options2) {
|
|
|
10417
10424
|
import { execSync as execSync25 } from "child_process";
|
|
10418
10425
|
|
|
10419
10426
|
// src/commands/devlog/repos/printReposTable.ts
|
|
10420
|
-
import
|
|
10427
|
+
import chalk106 from "chalk";
|
|
10421
10428
|
function colorStatus(status2) {
|
|
10422
|
-
if (status2 === "missing") return
|
|
10423
|
-
if (status2 === "outdated") return
|
|
10424
|
-
return
|
|
10429
|
+
if (status2 === "missing") return chalk106.red(status2);
|
|
10430
|
+
if (status2 === "outdated") return chalk106.yellow(status2);
|
|
10431
|
+
return chalk106.green(status2);
|
|
10425
10432
|
}
|
|
10426
10433
|
function formatRow(row, nameWidth) {
|
|
10427
10434
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -10435,8 +10442,8 @@ function printReposTable(rows) {
|
|
|
10435
10442
|
"Last Devlog".padEnd(11),
|
|
10436
10443
|
"Status"
|
|
10437
10444
|
].join(" ");
|
|
10438
|
-
console.log(
|
|
10439
|
-
console.log(
|
|
10445
|
+
console.log(chalk106.dim(header));
|
|
10446
|
+
console.log(chalk106.dim("-".repeat(header.length)));
|
|
10440
10447
|
for (const row of rows) {
|
|
10441
10448
|
console.log(formatRow(row, nameWidth));
|
|
10442
10449
|
}
|
|
@@ -10494,14 +10501,14 @@ function repos(options2) {
|
|
|
10494
10501
|
// src/commands/devlog/skip.ts
|
|
10495
10502
|
import { writeFileSync as writeFileSync23 } from "fs";
|
|
10496
10503
|
import { join as join28 } from "path";
|
|
10497
|
-
import
|
|
10504
|
+
import chalk107 from "chalk";
|
|
10498
10505
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
10499
10506
|
function getBlogConfigPath() {
|
|
10500
10507
|
return join28(BLOG_REPO_ROOT, "assist.yml");
|
|
10501
10508
|
}
|
|
10502
10509
|
function skip(date) {
|
|
10503
10510
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
10504
|
-
console.log(
|
|
10511
|
+
console.log(chalk107.red("Invalid date format. Use YYYY-MM-DD"));
|
|
10505
10512
|
process.exit(1);
|
|
10506
10513
|
}
|
|
10507
10514
|
const repoName = getRepoName();
|
|
@@ -10512,7 +10519,7 @@ function skip(date) {
|
|
|
10512
10519
|
const skipDays = skip2[repoName] ?? [];
|
|
10513
10520
|
if (skipDays.includes(date)) {
|
|
10514
10521
|
console.log(
|
|
10515
|
-
|
|
10522
|
+
chalk107.yellow(`${date} is already in skip list for ${repoName}`)
|
|
10516
10523
|
);
|
|
10517
10524
|
return;
|
|
10518
10525
|
}
|
|
@@ -10522,20 +10529,20 @@ function skip(date) {
|
|
|
10522
10529
|
devlog.skip = skip2;
|
|
10523
10530
|
config.devlog = devlog;
|
|
10524
10531
|
writeFileSync23(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
10525
|
-
console.log(
|
|
10532
|
+
console.log(chalk107.green(`Added ${date} to skip list for ${repoName}`));
|
|
10526
10533
|
}
|
|
10527
10534
|
|
|
10528
10535
|
// src/commands/devlog/version.ts
|
|
10529
|
-
import
|
|
10536
|
+
import chalk108 from "chalk";
|
|
10530
10537
|
function version() {
|
|
10531
10538
|
const config = loadConfig();
|
|
10532
10539
|
const name = getRepoName();
|
|
10533
10540
|
const lastInfo = getLastVersionInfo(name, config);
|
|
10534
10541
|
const lastVersion = lastInfo?.version ?? null;
|
|
10535
10542
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
10536
|
-
console.log(`${
|
|
10537
|
-
console.log(`${
|
|
10538
|
-
console.log(`${
|
|
10543
|
+
console.log(`${chalk108.bold("name:")} ${name}`);
|
|
10544
|
+
console.log(`${chalk108.bold("last:")} ${lastVersion ?? chalk108.dim("none")}`);
|
|
10545
|
+
console.log(`${chalk108.bold("next:")} ${nextVersion ?? chalk108.dim("none")}`);
|
|
10539
10546
|
}
|
|
10540
10547
|
|
|
10541
10548
|
// src/commands/registerDevlog.ts
|
|
@@ -10559,7 +10566,7 @@ function registerDevlog(program2) {
|
|
|
10559
10566
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
10560
10567
|
import { closeSync as closeSync2, openSync as openSync2, readdirSync as readdirSync2 } from "fs";
|
|
10561
10568
|
import { join as join29 } from "path";
|
|
10562
|
-
import
|
|
10569
|
+
import chalk109 from "chalk";
|
|
10563
10570
|
|
|
10564
10571
|
// src/shared/findRepoRoot.ts
|
|
10565
10572
|
import { existsSync as existsSync29 } from "fs";
|
|
@@ -10622,14 +10629,14 @@ function checkBuildLocks(startDir) {
|
|
|
10622
10629
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
10623
10630
|
if (locked) {
|
|
10624
10631
|
console.error(
|
|
10625
|
-
|
|
10632
|
+
chalk109.red("Build output locked (is VS debugging?): ") + locked
|
|
10626
10633
|
);
|
|
10627
10634
|
process.exit(1);
|
|
10628
10635
|
}
|
|
10629
10636
|
}
|
|
10630
10637
|
async function checkBuildLocksCommand() {
|
|
10631
10638
|
checkBuildLocks();
|
|
10632
|
-
console.log(
|
|
10639
|
+
console.log(chalk109.green("No build locks detected"));
|
|
10633
10640
|
}
|
|
10634
10641
|
|
|
10635
10642
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -10728,30 +10735,30 @@ function escapeRegex(s) {
|
|
|
10728
10735
|
}
|
|
10729
10736
|
|
|
10730
10737
|
// src/commands/dotnet/printTree.ts
|
|
10731
|
-
import
|
|
10738
|
+
import chalk110 from "chalk";
|
|
10732
10739
|
function printNodes(nodes, prefix2) {
|
|
10733
10740
|
for (let i = 0; i < nodes.length; i++) {
|
|
10734
10741
|
const isLast = i === nodes.length - 1;
|
|
10735
10742
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
10736
10743
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
10737
10744
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
10738
|
-
const label2 = isMissing ?
|
|
10745
|
+
const label2 = isMissing ? chalk110.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
10739
10746
|
console.log(`${prefix2}${connector}${label2}`);
|
|
10740
10747
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
10741
10748
|
}
|
|
10742
10749
|
}
|
|
10743
10750
|
function printTree(tree, totalCount, solutions) {
|
|
10744
|
-
console.log(
|
|
10745
|
-
console.log(
|
|
10751
|
+
console.log(chalk110.bold("\nProject Dependency Tree"));
|
|
10752
|
+
console.log(chalk110.cyan(tree.relativePath));
|
|
10746
10753
|
printNodes(tree.children, "");
|
|
10747
|
-
console.log(
|
|
10754
|
+
console.log(chalk110.dim(`
|
|
10748
10755
|
${totalCount} projects total (including root)`));
|
|
10749
|
-
console.log(
|
|
10756
|
+
console.log(chalk110.bold("\nSolution Membership"));
|
|
10750
10757
|
if (solutions.length === 0) {
|
|
10751
|
-
console.log(
|
|
10758
|
+
console.log(chalk110.yellow(" Not found in any .sln"));
|
|
10752
10759
|
} else {
|
|
10753
10760
|
for (const sln of solutions) {
|
|
10754
|
-
console.log(` ${
|
|
10761
|
+
console.log(` ${chalk110.green(sln)}`);
|
|
10755
10762
|
}
|
|
10756
10763
|
}
|
|
10757
10764
|
console.log();
|
|
@@ -10780,16 +10787,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
10780
10787
|
// src/commands/dotnet/resolveCsproj.ts
|
|
10781
10788
|
import { existsSync as existsSync30 } from "fs";
|
|
10782
10789
|
import path25 from "path";
|
|
10783
|
-
import
|
|
10790
|
+
import chalk111 from "chalk";
|
|
10784
10791
|
function resolveCsproj(csprojPath) {
|
|
10785
10792
|
const resolved = path25.resolve(csprojPath);
|
|
10786
10793
|
if (!existsSync30(resolved)) {
|
|
10787
|
-
console.error(
|
|
10794
|
+
console.error(chalk111.red(`File not found: ${resolved}`));
|
|
10788
10795
|
process.exit(1);
|
|
10789
10796
|
}
|
|
10790
10797
|
const repoRoot = findRepoRoot(path25.dirname(resolved));
|
|
10791
10798
|
if (!repoRoot) {
|
|
10792
|
-
console.error(
|
|
10799
|
+
console.error(chalk111.red("Could not find git repository root"));
|
|
10793
10800
|
process.exit(1);
|
|
10794
10801
|
}
|
|
10795
10802
|
return { resolved, repoRoot };
|
|
@@ -10839,12 +10846,12 @@ function getChangedCsFiles(scope) {
|
|
|
10839
10846
|
}
|
|
10840
10847
|
|
|
10841
10848
|
// src/commands/dotnet/inSln.ts
|
|
10842
|
-
import
|
|
10849
|
+
import chalk112 from "chalk";
|
|
10843
10850
|
async function inSln(csprojPath) {
|
|
10844
10851
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
10845
10852
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
10846
10853
|
if (solutions.length === 0) {
|
|
10847
|
-
console.log(
|
|
10854
|
+
console.log(chalk112.yellow("Not found in any .sln file"));
|
|
10848
10855
|
process.exit(1);
|
|
10849
10856
|
}
|
|
10850
10857
|
for (const sln of solutions) {
|
|
@@ -10853,7 +10860,7 @@ async function inSln(csprojPath) {
|
|
|
10853
10860
|
}
|
|
10854
10861
|
|
|
10855
10862
|
// src/commands/dotnet/inspect.ts
|
|
10856
|
-
import
|
|
10863
|
+
import chalk118 from "chalk";
|
|
10857
10864
|
|
|
10858
10865
|
// src/shared/formatElapsed.ts
|
|
10859
10866
|
function formatElapsed(ms) {
|
|
@@ -10865,12 +10872,12 @@ function formatElapsed(ms) {
|
|
|
10865
10872
|
}
|
|
10866
10873
|
|
|
10867
10874
|
// src/commands/dotnet/displayIssues.ts
|
|
10868
|
-
import
|
|
10875
|
+
import chalk113 from "chalk";
|
|
10869
10876
|
var SEVERITY_COLOR = {
|
|
10870
|
-
ERROR:
|
|
10871
|
-
WARNING:
|
|
10872
|
-
SUGGESTION:
|
|
10873
|
-
HINT:
|
|
10877
|
+
ERROR: chalk113.red,
|
|
10878
|
+
WARNING: chalk113.yellow,
|
|
10879
|
+
SUGGESTION: chalk113.cyan,
|
|
10880
|
+
HINT: chalk113.dim
|
|
10874
10881
|
};
|
|
10875
10882
|
function groupByFile(issues) {
|
|
10876
10883
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -10886,15 +10893,15 @@ function groupByFile(issues) {
|
|
|
10886
10893
|
}
|
|
10887
10894
|
function displayIssues(issues) {
|
|
10888
10895
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
10889
|
-
console.log(
|
|
10896
|
+
console.log(chalk113.bold(file));
|
|
10890
10897
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
10891
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
10898
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk113.white;
|
|
10892
10899
|
console.log(
|
|
10893
|
-
` ${
|
|
10900
|
+
` ${chalk113.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
10894
10901
|
);
|
|
10895
10902
|
}
|
|
10896
10903
|
}
|
|
10897
|
-
console.log(
|
|
10904
|
+
console.log(chalk113.dim(`
|
|
10898
10905
|
${issues.length} issue(s) found`));
|
|
10899
10906
|
}
|
|
10900
10907
|
|
|
@@ -10953,12 +10960,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
10953
10960
|
// src/commands/dotnet/resolveSolution.ts
|
|
10954
10961
|
import { existsSync as existsSync31 } from "fs";
|
|
10955
10962
|
import path26 from "path";
|
|
10956
|
-
import
|
|
10963
|
+
import chalk115 from "chalk";
|
|
10957
10964
|
|
|
10958
10965
|
// src/commands/dotnet/findSolution.ts
|
|
10959
10966
|
import { readdirSync as readdirSync4 } from "fs";
|
|
10960
10967
|
import { dirname as dirname18, join as join30 } from "path";
|
|
10961
|
-
import
|
|
10968
|
+
import chalk114 from "chalk";
|
|
10962
10969
|
function findSlnInDir(dir) {
|
|
10963
10970
|
try {
|
|
10964
10971
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join30(dir, f));
|
|
@@ -10974,17 +10981,17 @@ function findSolution() {
|
|
|
10974
10981
|
const slnFiles = findSlnInDir(current);
|
|
10975
10982
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
10976
10983
|
if (slnFiles.length > 1) {
|
|
10977
|
-
console.error(
|
|
10984
|
+
console.error(chalk114.red(`Multiple .sln files found in ${current}:`));
|
|
10978
10985
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
10979
10986
|
console.error(
|
|
10980
|
-
|
|
10987
|
+
chalk114.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
10981
10988
|
);
|
|
10982
10989
|
process.exit(1);
|
|
10983
10990
|
}
|
|
10984
10991
|
if (current === ceiling) break;
|
|
10985
10992
|
current = dirname18(current);
|
|
10986
10993
|
}
|
|
10987
|
-
console.error(
|
|
10994
|
+
console.error(chalk114.red("No .sln file found between cwd and repo root"));
|
|
10988
10995
|
process.exit(1);
|
|
10989
10996
|
}
|
|
10990
10997
|
|
|
@@ -10993,7 +11000,7 @@ function resolveSolution(sln) {
|
|
|
10993
11000
|
if (sln) {
|
|
10994
11001
|
const resolved = path26.resolve(sln);
|
|
10995
11002
|
if (!existsSync31(resolved)) {
|
|
10996
|
-
console.error(
|
|
11003
|
+
console.error(chalk115.red(`Solution file not found: ${resolved}`));
|
|
10997
11004
|
process.exit(1);
|
|
10998
11005
|
}
|
|
10999
11006
|
return resolved;
|
|
@@ -11035,14 +11042,14 @@ import { execSync as execSync27 } from "child_process";
|
|
|
11035
11042
|
import { existsSync as existsSync32, readFileSync as readFileSync27, unlinkSync as unlinkSync7 } from "fs";
|
|
11036
11043
|
import { tmpdir as tmpdir3 } from "os";
|
|
11037
11044
|
import path27 from "path";
|
|
11038
|
-
import
|
|
11045
|
+
import chalk116 from "chalk";
|
|
11039
11046
|
function assertJbInstalled() {
|
|
11040
11047
|
try {
|
|
11041
11048
|
execSync27("jb inspectcode --version", { stdio: "pipe" });
|
|
11042
11049
|
} catch {
|
|
11043
|
-
console.error(
|
|
11050
|
+
console.error(chalk116.red("jb is not installed. Install with:"));
|
|
11044
11051
|
console.error(
|
|
11045
|
-
|
|
11052
|
+
chalk116.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
11046
11053
|
);
|
|
11047
11054
|
process.exit(1);
|
|
11048
11055
|
}
|
|
@@ -11060,11 +11067,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
11060
11067
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
11061
11068
|
process.stderr.write(error.stderr);
|
|
11062
11069
|
}
|
|
11063
|
-
console.error(
|
|
11070
|
+
console.error(chalk116.red("jb inspectcode failed"));
|
|
11064
11071
|
process.exit(1);
|
|
11065
11072
|
}
|
|
11066
11073
|
if (!existsSync32(reportPath)) {
|
|
11067
|
-
console.error(
|
|
11074
|
+
console.error(chalk116.red("Report file not generated"));
|
|
11068
11075
|
process.exit(1);
|
|
11069
11076
|
}
|
|
11070
11077
|
const xml = readFileSync27(reportPath, "utf8");
|
|
@@ -11074,7 +11081,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
11074
11081
|
|
|
11075
11082
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
11076
11083
|
import { execSync as execSync28 } from "child_process";
|
|
11077
|
-
import
|
|
11084
|
+
import chalk117 from "chalk";
|
|
11078
11085
|
function resolveMsbuildPath() {
|
|
11079
11086
|
const { run: run4 } = loadConfig();
|
|
11080
11087
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -11086,9 +11093,9 @@ function assertMsbuildInstalled() {
|
|
|
11086
11093
|
try {
|
|
11087
11094
|
execSync28(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
11088
11095
|
} catch {
|
|
11089
|
-
console.error(
|
|
11096
|
+
console.error(chalk117.red(`msbuild not found at: ${msbuild}`));
|
|
11090
11097
|
console.error(
|
|
11091
|
-
|
|
11098
|
+
chalk117.yellow(
|
|
11092
11099
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
11093
11100
|
)
|
|
11094
11101
|
);
|
|
@@ -11135,17 +11142,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
11135
11142
|
// src/commands/dotnet/inspect.ts
|
|
11136
11143
|
function logScope(changedFiles) {
|
|
11137
11144
|
if (changedFiles === null) {
|
|
11138
|
-
console.log(
|
|
11145
|
+
console.log(chalk118.dim("Inspecting full solution..."));
|
|
11139
11146
|
} else {
|
|
11140
11147
|
console.log(
|
|
11141
|
-
|
|
11148
|
+
chalk118.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
11142
11149
|
);
|
|
11143
11150
|
}
|
|
11144
11151
|
}
|
|
11145
11152
|
function reportResults(issues, elapsed) {
|
|
11146
11153
|
if (issues.length > 0) displayIssues(issues);
|
|
11147
|
-
else console.log(
|
|
11148
|
-
console.log(
|
|
11154
|
+
else console.log(chalk118.green("No issues found"));
|
|
11155
|
+
console.log(chalk118.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
11149
11156
|
if (issues.length > 0) process.exit(1);
|
|
11150
11157
|
}
|
|
11151
11158
|
async function inspect(sln, options2) {
|
|
@@ -11156,7 +11163,7 @@ async function inspect(sln, options2) {
|
|
|
11156
11163
|
const scope = parseScope(options2.scope);
|
|
11157
11164
|
const changedFiles = getChangedCsFiles(scope);
|
|
11158
11165
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
11159
|
-
console.log(
|
|
11166
|
+
console.log(chalk118.green("No changed .cs files found"));
|
|
11160
11167
|
return;
|
|
11161
11168
|
}
|
|
11162
11169
|
logScope(changedFiles);
|
|
@@ -11285,25 +11292,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
11285
11292
|
}
|
|
11286
11293
|
|
|
11287
11294
|
// src/commands/github/printCountTable.ts
|
|
11288
|
-
import
|
|
11295
|
+
import chalk119 from "chalk";
|
|
11289
11296
|
function printCountTable(labelHeader, rows) {
|
|
11290
11297
|
const labelWidth = Math.max(
|
|
11291
11298
|
labelHeader.length,
|
|
11292
11299
|
...rows.map((row) => row.label.length)
|
|
11293
11300
|
);
|
|
11294
11301
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
11295
|
-
console.log(
|
|
11296
|
-
console.log(
|
|
11302
|
+
console.log(chalk119.dim(header));
|
|
11303
|
+
console.log(chalk119.dim("-".repeat(header.length)));
|
|
11297
11304
|
for (const row of rows) {
|
|
11298
11305
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
11299
11306
|
}
|
|
11300
11307
|
}
|
|
11301
11308
|
|
|
11302
11309
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
11303
|
-
import
|
|
11310
|
+
import chalk120 from "chalk";
|
|
11304
11311
|
function printRepoAuthorBreakdown(repos2) {
|
|
11305
11312
|
for (const repo of repos2) {
|
|
11306
|
-
console.log(
|
|
11313
|
+
console.log(chalk120.bold(repo.name));
|
|
11307
11314
|
const authorWidth = Math.max(
|
|
11308
11315
|
0,
|
|
11309
11316
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -11621,7 +11628,7 @@ function registerHandover(program2) {
|
|
|
11621
11628
|
}
|
|
11622
11629
|
|
|
11623
11630
|
// src/commands/jira/acceptanceCriteria.ts
|
|
11624
|
-
import
|
|
11631
|
+
import chalk122 from "chalk";
|
|
11625
11632
|
|
|
11626
11633
|
// src/commands/jira/adfToText.ts
|
|
11627
11634
|
function renderInline(node) {
|
|
@@ -11682,7 +11689,7 @@ function adfToText(doc) {
|
|
|
11682
11689
|
|
|
11683
11690
|
// src/commands/jira/fetchIssue.ts
|
|
11684
11691
|
import { execSync as execSync29 } from "child_process";
|
|
11685
|
-
import
|
|
11692
|
+
import chalk121 from "chalk";
|
|
11686
11693
|
function fetchIssue(issueKey, fields) {
|
|
11687
11694
|
let result;
|
|
11688
11695
|
try {
|
|
@@ -11695,15 +11702,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
11695
11702
|
const stderr = error.stderr;
|
|
11696
11703
|
if (stderr.includes("unauthorized")) {
|
|
11697
11704
|
console.error(
|
|
11698
|
-
|
|
11705
|
+
chalk121.red("Jira authentication expired."),
|
|
11699
11706
|
"Run",
|
|
11700
|
-
|
|
11707
|
+
chalk121.cyan("assist jira auth"),
|
|
11701
11708
|
"to re-authenticate."
|
|
11702
11709
|
);
|
|
11703
11710
|
process.exit(1);
|
|
11704
11711
|
}
|
|
11705
11712
|
}
|
|
11706
|
-
console.error(
|
|
11713
|
+
console.error(chalk121.red(`Failed to fetch ${issueKey}.`));
|
|
11707
11714
|
process.exit(1);
|
|
11708
11715
|
}
|
|
11709
11716
|
return JSON.parse(result);
|
|
@@ -11717,7 +11724,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
11717
11724
|
const parsed = fetchIssue(issueKey, field);
|
|
11718
11725
|
const acValue = parsed?.fields?.[field];
|
|
11719
11726
|
if (!acValue) {
|
|
11720
|
-
console.log(
|
|
11727
|
+
console.log(chalk122.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
11721
11728
|
return;
|
|
11722
11729
|
}
|
|
11723
11730
|
if (typeof acValue === "string") {
|
|
@@ -11812,14 +11819,14 @@ async function jiraAuth() {
|
|
|
11812
11819
|
}
|
|
11813
11820
|
|
|
11814
11821
|
// src/commands/jira/viewIssue.ts
|
|
11815
|
-
import
|
|
11822
|
+
import chalk123 from "chalk";
|
|
11816
11823
|
function viewIssue(issueKey) {
|
|
11817
11824
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
11818
11825
|
const fields = parsed?.fields;
|
|
11819
11826
|
const summary = fields?.summary;
|
|
11820
11827
|
const description = fields?.description;
|
|
11821
11828
|
if (summary) {
|
|
11822
|
-
console.log(
|
|
11829
|
+
console.log(chalk123.bold(summary));
|
|
11823
11830
|
}
|
|
11824
11831
|
if (description) {
|
|
11825
11832
|
if (summary) console.log();
|
|
@@ -11833,7 +11840,7 @@ function viewIssue(issueKey) {
|
|
|
11833
11840
|
}
|
|
11834
11841
|
if (!summary && !description) {
|
|
11835
11842
|
console.log(
|
|
11836
|
-
|
|
11843
|
+
chalk123.yellow(`No summary or description found on ${issueKey}.`)
|
|
11837
11844
|
);
|
|
11838
11845
|
}
|
|
11839
11846
|
}
|
|
@@ -11849,13 +11856,13 @@ function registerJira(program2) {
|
|
|
11849
11856
|
// src/commands/reviewComments.ts
|
|
11850
11857
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
11851
11858
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
11852
|
-
import
|
|
11859
|
+
import chalk124 from "chalk";
|
|
11853
11860
|
async function reviewComments(number) {
|
|
11854
11861
|
if (number) {
|
|
11855
11862
|
try {
|
|
11856
11863
|
execFileSync5("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
11857
11864
|
} catch {
|
|
11858
|
-
console.error(
|
|
11865
|
+
console.error(chalk124.red(`gh pr checkout ${number} failed; aborting.`));
|
|
11859
11866
|
process.exit(1);
|
|
11860
11867
|
}
|
|
11861
11868
|
}
|
|
@@ -11901,15 +11908,15 @@ function registerList(program2) {
|
|
|
11901
11908
|
// src/commands/mermaid/index.ts
|
|
11902
11909
|
import { mkdirSync as mkdirSync12, readdirSync as readdirSync6 } from "fs";
|
|
11903
11910
|
import { resolve as resolve11 } from "path";
|
|
11904
|
-
import
|
|
11911
|
+
import chalk127 from "chalk";
|
|
11905
11912
|
|
|
11906
11913
|
// src/commands/mermaid/exportFile.ts
|
|
11907
11914
|
import { readFileSync as readFileSync30, writeFileSync as writeFileSync26 } from "fs";
|
|
11908
11915
|
import { basename as basename6, extname, resolve as resolve10 } from "path";
|
|
11909
|
-
import
|
|
11916
|
+
import chalk126 from "chalk";
|
|
11910
11917
|
|
|
11911
11918
|
// src/commands/mermaid/renderBlock.ts
|
|
11912
|
-
import
|
|
11919
|
+
import chalk125 from "chalk";
|
|
11913
11920
|
async function renderBlock(krokiUrl, source) {
|
|
11914
11921
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
11915
11922
|
method: "POST",
|
|
@@ -11918,7 +11925,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
11918
11925
|
});
|
|
11919
11926
|
if (!response.ok) {
|
|
11920
11927
|
console.error(
|
|
11921
|
-
|
|
11928
|
+
chalk125.red(
|
|
11922
11929
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
11923
11930
|
)
|
|
11924
11931
|
);
|
|
@@ -11936,19 +11943,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
11936
11943
|
if (onlyIndex !== void 0) {
|
|
11937
11944
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
11938
11945
|
console.error(
|
|
11939
|
-
|
|
11946
|
+
chalk126.red(
|
|
11940
11947
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
11941
11948
|
)
|
|
11942
11949
|
);
|
|
11943
11950
|
process.exit(1);
|
|
11944
11951
|
}
|
|
11945
11952
|
console.log(
|
|
11946
|
-
|
|
11953
|
+
chalk126.gray(
|
|
11947
11954
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
11948
11955
|
)
|
|
11949
11956
|
);
|
|
11950
11957
|
} else {
|
|
11951
|
-
console.log(
|
|
11958
|
+
console.log(chalk126.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
11952
11959
|
}
|
|
11953
11960
|
for (const [i, source] of blocks.entries()) {
|
|
11954
11961
|
const idx = i + 1;
|
|
@@ -11956,7 +11963,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
11956
11963
|
const outPath = resolve10(outDir, `${stem}-${idx}.svg`);
|
|
11957
11964
|
const svg = await renderBlock(krokiUrl, source);
|
|
11958
11965
|
writeFileSync26(outPath, svg, "utf8");
|
|
11959
|
-
console.log(
|
|
11966
|
+
console.log(chalk126.green(` \u2192 ${outPath}`));
|
|
11960
11967
|
}
|
|
11961
11968
|
}
|
|
11962
11969
|
function extractMermaidBlocks(markdown) {
|
|
@@ -11972,18 +11979,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
11972
11979
|
if (options2.index !== void 0) {
|
|
11973
11980
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
11974
11981
|
console.error(
|
|
11975
|
-
|
|
11982
|
+
chalk127.red(`--index must be a positive integer (got ${options2.index})`)
|
|
11976
11983
|
);
|
|
11977
11984
|
process.exit(1);
|
|
11978
11985
|
}
|
|
11979
11986
|
if (!file) {
|
|
11980
|
-
console.error(
|
|
11987
|
+
console.error(chalk127.red("--index requires a file argument"));
|
|
11981
11988
|
process.exit(1);
|
|
11982
11989
|
}
|
|
11983
11990
|
}
|
|
11984
11991
|
const files = file ? [file] : readdirSync6(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
11985
11992
|
if (files.length === 0) {
|
|
11986
|
-
console.log(
|
|
11993
|
+
console.log(chalk127.gray("No markdown files found in current directory."));
|
|
11987
11994
|
return;
|
|
11988
11995
|
}
|
|
11989
11996
|
for (const f of files) {
|
|
@@ -12009,7 +12016,7 @@ function registerMermaid(program2) {
|
|
|
12009
12016
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
12010
12017
|
import { createServer as createServer2 } from "http";
|
|
12011
12018
|
import { dirname as dirname20 } from "path";
|
|
12012
|
-
import
|
|
12019
|
+
import chalk129 from "chalk";
|
|
12013
12020
|
|
|
12014
12021
|
// src/commands/netcap/corsHeaders.ts
|
|
12015
12022
|
var corsHeaders = {
|
|
@@ -12088,7 +12095,7 @@ function createNetcapHandler(options2) {
|
|
|
12088
12095
|
import { cp, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
|
|
12089
12096
|
import { networkInterfaces } from "os";
|
|
12090
12097
|
import { join as join37 } from "path";
|
|
12091
|
-
import
|
|
12098
|
+
import chalk128 from "chalk";
|
|
12092
12099
|
|
|
12093
12100
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
12094
12101
|
import { dirname as dirname19, join as join36 } from "path";
|
|
@@ -12132,7 +12139,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
12132
12139
|
const host = lanIPv4();
|
|
12133
12140
|
if (!host) {
|
|
12134
12141
|
console.log(
|
|
12135
|
-
|
|
12142
|
+
chalk128.yellow("could not determine the WSL IP for the extension")
|
|
12136
12143
|
);
|
|
12137
12144
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
12138
12145
|
return source;
|
|
@@ -12143,7 +12150,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
12143
12150
|
return WSL_WINDOWS_PATH;
|
|
12144
12151
|
} catch {
|
|
12145
12152
|
console.log(
|
|
12146
|
-
|
|
12153
|
+
chalk128.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
12147
12154
|
);
|
|
12148
12155
|
return source;
|
|
12149
12156
|
}
|
|
@@ -12176,30 +12183,30 @@ async function netcap(options2) {
|
|
|
12176
12183
|
let count6 = 0;
|
|
12177
12184
|
const handler = createNetcapHandler({
|
|
12178
12185
|
outPath,
|
|
12179
|
-
onPing: () => console.log(
|
|
12186
|
+
onPing: () => console.log(chalk129.dim("ping from extension")),
|
|
12180
12187
|
onCapture: (entry) => {
|
|
12181
12188
|
count6 += 1;
|
|
12182
12189
|
console.log(
|
|
12183
|
-
|
|
12184
|
-
|
|
12190
|
+
chalk129.green(`captured #${count6}`),
|
|
12191
|
+
chalk129.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
12185
12192
|
);
|
|
12186
12193
|
}
|
|
12187
12194
|
});
|
|
12188
12195
|
const server = createServer2(handler);
|
|
12189
12196
|
server.listen(port, () => {
|
|
12190
12197
|
console.log(
|
|
12191
|
-
|
|
12198
|
+
chalk129.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
12192
12199
|
);
|
|
12193
|
-
console.log(
|
|
12200
|
+
console.log(chalk129.dim(`appending captures to ${outPath}`));
|
|
12194
12201
|
if (filter)
|
|
12195
|
-
console.log(
|
|
12196
|
-
console.log(
|
|
12197
|
-
console.log(
|
|
12202
|
+
console.log(chalk129.dim(`forwarding only URLs matching "${filter}"`));
|
|
12203
|
+
console.log(chalk129.dim(`load the unpacked extension from ${extensionPath}`));
|
|
12204
|
+
console.log(chalk129.dim("press Ctrl-C to stop"));
|
|
12198
12205
|
});
|
|
12199
12206
|
process.on("SIGINT", () => {
|
|
12200
12207
|
server.close();
|
|
12201
12208
|
console.log(
|
|
12202
|
-
|
|
12209
|
+
chalk129.bold(
|
|
12203
12210
|
`
|
|
12204
12211
|
netcap stopped \u2014 captured ${count6} ${count6 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
12205
12212
|
)
|
|
@@ -12211,7 +12218,7 @@ netcap stopped \u2014 captured ${count6} ${count6 === 1 ? "entry" : "entries"} t
|
|
|
12211
12218
|
// src/commands/netcap/netcapExtract.ts
|
|
12212
12219
|
import { writeFileSync as writeFileSync27 } from "fs";
|
|
12213
12220
|
import { join as join40 } from "path";
|
|
12214
|
-
import
|
|
12221
|
+
import chalk130 from "chalk";
|
|
12215
12222
|
|
|
12216
12223
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
12217
12224
|
import { readFileSync as readFileSync31 } from "fs";
|
|
@@ -12659,8 +12666,8 @@ function netcapExtract(file) {
|
|
|
12659
12666
|
writeFileSync27(outFile, `${JSON.stringify(posts, null, 2)}
|
|
12660
12667
|
`);
|
|
12661
12668
|
console.log(
|
|
12662
|
-
|
|
12663
|
-
|
|
12669
|
+
chalk130.green(`extracted ${posts.length} posts`),
|
|
12670
|
+
chalk130.dim(`-> ${outFile}`)
|
|
12664
12671
|
);
|
|
12665
12672
|
}
|
|
12666
12673
|
|
|
@@ -12681,7 +12688,7 @@ function registerNetcap(program2) {
|
|
|
12681
12688
|
}
|
|
12682
12689
|
|
|
12683
12690
|
// src/commands/news/add/index.ts
|
|
12684
|
-
import
|
|
12691
|
+
import chalk131 from "chalk";
|
|
12685
12692
|
import enquirer8 from "enquirer";
|
|
12686
12693
|
async function add2(url) {
|
|
12687
12694
|
if (!url) {
|
|
@@ -12703,10 +12710,10 @@ async function add2(url) {
|
|
|
12703
12710
|
const { orm } = await getReady();
|
|
12704
12711
|
const added = await addFeed(orm, url);
|
|
12705
12712
|
if (!added) {
|
|
12706
|
-
console.log(
|
|
12713
|
+
console.log(chalk131.yellow("Feed already exists"));
|
|
12707
12714
|
return;
|
|
12708
12715
|
}
|
|
12709
|
-
console.log(
|
|
12716
|
+
console.log(chalk131.green(`Added feed: ${url}`));
|
|
12710
12717
|
}
|
|
12711
12718
|
|
|
12712
12719
|
// src/commands/registerNews.ts
|
|
@@ -12716,7 +12723,7 @@ function registerNews(program2) {
|
|
|
12716
12723
|
}
|
|
12717
12724
|
|
|
12718
12725
|
// src/commands/prompts/printPromptsTable.ts
|
|
12719
|
-
import
|
|
12726
|
+
import chalk132 from "chalk";
|
|
12720
12727
|
function truncate(str, max) {
|
|
12721
12728
|
if (str.length <= max) return str;
|
|
12722
12729
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -12734,14 +12741,14 @@ function printPromptsTable(rows) {
|
|
|
12734
12741
|
"Command".padEnd(commandWidth),
|
|
12735
12742
|
"Repos"
|
|
12736
12743
|
].join(" ");
|
|
12737
|
-
console.log(
|
|
12738
|
-
console.log(
|
|
12744
|
+
console.log(chalk132.dim(header));
|
|
12745
|
+
console.log(chalk132.dim("-".repeat(header.length)));
|
|
12739
12746
|
for (const row of rows) {
|
|
12740
12747
|
const count6 = String(row.count).padStart(countWidth);
|
|
12741
12748
|
const tool = row.tool.padEnd(toolWidth);
|
|
12742
12749
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
12743
12750
|
console.log(
|
|
12744
|
-
`${
|
|
12751
|
+
`${chalk132.yellow(count6)} ${tool} ${command} ${chalk132.dim(row.repos)}`
|
|
12745
12752
|
);
|
|
12746
12753
|
}
|
|
12747
12754
|
}
|
|
@@ -13290,20 +13297,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
13290
13297
|
}
|
|
13291
13298
|
|
|
13292
13299
|
// src/commands/prs/listComments/printComments.ts
|
|
13293
|
-
import
|
|
13300
|
+
import chalk133 from "chalk";
|
|
13294
13301
|
function formatForHuman(comment3) {
|
|
13295
13302
|
if (comment3.type === "review") {
|
|
13296
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
13303
|
+
const stateColor = comment3.state === "APPROVED" ? chalk133.green : comment3.state === "CHANGES_REQUESTED" ? chalk133.red : chalk133.yellow;
|
|
13297
13304
|
return [
|
|
13298
|
-
`${
|
|
13305
|
+
`${chalk133.cyan("Review")} by ${chalk133.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
13299
13306
|
comment3.body,
|
|
13300
13307
|
""
|
|
13301
13308
|
].join("\n");
|
|
13302
13309
|
}
|
|
13303
13310
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
13304
13311
|
return [
|
|
13305
|
-
`${
|
|
13306
|
-
|
|
13312
|
+
`${chalk133.cyan("Line comment")} by ${chalk133.bold(comment3.user)} on ${chalk133.dim(`${comment3.path}${location}`)}`,
|
|
13313
|
+
chalk133.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
13307
13314
|
comment3.body,
|
|
13308
13315
|
""
|
|
13309
13316
|
].join("\n");
|
|
@@ -13393,13 +13400,13 @@ import { execSync as execSync38 } from "child_process";
|
|
|
13393
13400
|
import enquirer9 from "enquirer";
|
|
13394
13401
|
|
|
13395
13402
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
13396
|
-
import
|
|
13403
|
+
import chalk134 from "chalk";
|
|
13397
13404
|
var STATUS_MAP = {
|
|
13398
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
13399
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
13405
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk134.magenta("merged"), date: pr.mergedAt } : null,
|
|
13406
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk134.red("closed"), date: pr.closedAt } : null
|
|
13400
13407
|
};
|
|
13401
13408
|
function defaultStatus(pr) {
|
|
13402
|
-
return { label:
|
|
13409
|
+
return { label: chalk134.green("opened"), date: pr.createdAt };
|
|
13403
13410
|
}
|
|
13404
13411
|
function getStatus2(pr) {
|
|
13405
13412
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -13408,11 +13415,11 @@ function formatDate(dateStr) {
|
|
|
13408
13415
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
13409
13416
|
}
|
|
13410
13417
|
function formatPrHeader(pr, status2) {
|
|
13411
|
-
return `${
|
|
13418
|
+
return `${chalk134.cyan(`#${pr.number}`)} ${pr.title} ${chalk134.dim(`(${pr.author.login},`)} ${status2.label} ${chalk134.dim(`${formatDate(status2.date)})`)}`;
|
|
13412
13419
|
}
|
|
13413
13420
|
function logPrDetails(pr) {
|
|
13414
13421
|
console.log(
|
|
13415
|
-
|
|
13422
|
+
chalk134.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
13416
13423
|
);
|
|
13417
13424
|
console.log();
|
|
13418
13425
|
}
|
|
@@ -13719,10 +13726,10 @@ function registerPrs(program2) {
|
|
|
13719
13726
|
}
|
|
13720
13727
|
|
|
13721
13728
|
// src/commands/ravendb/ravendbAuth.ts
|
|
13722
|
-
import
|
|
13729
|
+
import chalk140 from "chalk";
|
|
13723
13730
|
|
|
13724
13731
|
// src/shared/createConnectionAuth.ts
|
|
13725
|
-
import
|
|
13732
|
+
import chalk135 from "chalk";
|
|
13726
13733
|
function listConnections(connections, format2) {
|
|
13727
13734
|
if (connections.length === 0) {
|
|
13728
13735
|
console.log("No connections configured.");
|
|
@@ -13735,7 +13742,7 @@ function listConnections(connections, format2) {
|
|
|
13735
13742
|
function removeConnection(connections, name, save) {
|
|
13736
13743
|
const filtered = connections.filter((c) => c.name !== name);
|
|
13737
13744
|
if (filtered.length === connections.length) {
|
|
13738
|
-
console.error(
|
|
13745
|
+
console.error(chalk135.red(`Connection "${name}" not found.`));
|
|
13739
13746
|
process.exit(1);
|
|
13740
13747
|
}
|
|
13741
13748
|
save(filtered);
|
|
@@ -13781,15 +13788,15 @@ function saveConnections(connections) {
|
|
|
13781
13788
|
}
|
|
13782
13789
|
|
|
13783
13790
|
// src/commands/ravendb/promptConnection.ts
|
|
13784
|
-
import
|
|
13791
|
+
import chalk138 from "chalk";
|
|
13785
13792
|
|
|
13786
13793
|
// src/commands/ravendb/selectOpSecret.ts
|
|
13787
|
-
import
|
|
13794
|
+
import chalk137 from "chalk";
|
|
13788
13795
|
import Enquirer2 from "enquirer";
|
|
13789
13796
|
|
|
13790
13797
|
// src/commands/ravendb/searchItems.ts
|
|
13791
13798
|
import { execSync as execSync41 } from "child_process";
|
|
13792
|
-
import
|
|
13799
|
+
import chalk136 from "chalk";
|
|
13793
13800
|
function opExec(args) {
|
|
13794
13801
|
return execSync41(`op ${args}`, {
|
|
13795
13802
|
encoding: "utf8",
|
|
@@ -13802,7 +13809,7 @@ function searchItems(search2) {
|
|
|
13802
13809
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
13803
13810
|
} catch {
|
|
13804
13811
|
console.error(
|
|
13805
|
-
|
|
13812
|
+
chalk136.red(
|
|
13806
13813
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
13807
13814
|
)
|
|
13808
13815
|
);
|
|
@@ -13816,7 +13823,7 @@ function getItemFields(itemId) {
|
|
|
13816
13823
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
13817
13824
|
return item.fields.filter((f) => f.reference && f.label);
|
|
13818
13825
|
} catch {
|
|
13819
|
-
console.error(
|
|
13826
|
+
console.error(chalk136.red("Failed to get item details from 1Password."));
|
|
13820
13827
|
process.exit(1);
|
|
13821
13828
|
}
|
|
13822
13829
|
}
|
|
@@ -13835,7 +13842,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
13835
13842
|
}).run();
|
|
13836
13843
|
const items2 = searchItems(search2);
|
|
13837
13844
|
if (items2.length === 0) {
|
|
13838
|
-
console.error(
|
|
13845
|
+
console.error(chalk137.red(`No items found matching "${search2}".`));
|
|
13839
13846
|
process.exit(1);
|
|
13840
13847
|
}
|
|
13841
13848
|
const itemId = await selectOne(
|
|
@@ -13844,7 +13851,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
13844
13851
|
);
|
|
13845
13852
|
const fields = getItemFields(itemId);
|
|
13846
13853
|
if (fields.length === 0) {
|
|
13847
|
-
console.error(
|
|
13854
|
+
console.error(chalk137.red("No fields with references found on this item."));
|
|
13848
13855
|
process.exit(1);
|
|
13849
13856
|
}
|
|
13850
13857
|
const ref = await selectOne(
|
|
@@ -13858,7 +13865,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
13858
13865
|
async function promptConnection(existingNames) {
|
|
13859
13866
|
const name = await promptInput("name", "Connection name:");
|
|
13860
13867
|
if (existingNames.includes(name)) {
|
|
13861
|
-
console.error(
|
|
13868
|
+
console.error(chalk138.red(`Connection "${name}" already exists.`));
|
|
13862
13869
|
process.exit(1);
|
|
13863
13870
|
}
|
|
13864
13871
|
const url = await promptInput(
|
|
@@ -13867,22 +13874,22 @@ async function promptConnection(existingNames) {
|
|
|
13867
13874
|
);
|
|
13868
13875
|
const database = await promptInput("database", "Database name:");
|
|
13869
13876
|
if (!name || !url || !database) {
|
|
13870
|
-
console.error(
|
|
13877
|
+
console.error(chalk138.red("All fields are required."));
|
|
13871
13878
|
process.exit(1);
|
|
13872
13879
|
}
|
|
13873
13880
|
const apiKeyRef = await selectOpSecret();
|
|
13874
|
-
console.log(
|
|
13881
|
+
console.log(chalk138.dim(`Using: ${apiKeyRef}`));
|
|
13875
13882
|
return { name, url, database, apiKeyRef };
|
|
13876
13883
|
}
|
|
13877
13884
|
|
|
13878
13885
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
13879
|
-
import
|
|
13886
|
+
import chalk139 from "chalk";
|
|
13880
13887
|
function ravendbSetConnection(name) {
|
|
13881
13888
|
const raw = loadGlobalConfigRaw();
|
|
13882
13889
|
const ravendb = raw.ravendb ?? {};
|
|
13883
13890
|
const connections = ravendb.connections ?? [];
|
|
13884
13891
|
if (!connections.some((c) => c.name === name)) {
|
|
13885
|
-
console.error(
|
|
13892
|
+
console.error(chalk139.red(`Connection "${name}" not found.`));
|
|
13886
13893
|
console.error(
|
|
13887
13894
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
13888
13895
|
);
|
|
@@ -13898,16 +13905,16 @@ function ravendbSetConnection(name) {
|
|
|
13898
13905
|
var ravendbAuth = createConnectionAuth({
|
|
13899
13906
|
load: loadConnections,
|
|
13900
13907
|
save: saveConnections,
|
|
13901
|
-
format: (c) => `${
|
|
13908
|
+
format: (c) => `${chalk140.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
13902
13909
|
promptNew: promptConnection,
|
|
13903
13910
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
13904
13911
|
});
|
|
13905
13912
|
|
|
13906
13913
|
// src/commands/ravendb/ravendbCollections.ts
|
|
13907
|
-
import
|
|
13914
|
+
import chalk144 from "chalk";
|
|
13908
13915
|
|
|
13909
13916
|
// src/commands/ravendb/ravenFetch.ts
|
|
13910
|
-
import
|
|
13917
|
+
import chalk142 from "chalk";
|
|
13911
13918
|
|
|
13912
13919
|
// src/commands/ravendb/getAccessToken.ts
|
|
13913
13920
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -13944,10 +13951,10 @@ ${errorText}`
|
|
|
13944
13951
|
|
|
13945
13952
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
13946
13953
|
import { execSync as execSync42 } from "child_process";
|
|
13947
|
-
import
|
|
13954
|
+
import chalk141 from "chalk";
|
|
13948
13955
|
function resolveOpSecret(reference) {
|
|
13949
13956
|
if (!reference.startsWith("op://")) {
|
|
13950
|
-
console.error(
|
|
13957
|
+
console.error(chalk141.red(`Invalid secret reference: must start with op://`));
|
|
13951
13958
|
process.exit(1);
|
|
13952
13959
|
}
|
|
13953
13960
|
try {
|
|
@@ -13957,7 +13964,7 @@ function resolveOpSecret(reference) {
|
|
|
13957
13964
|
}).trim();
|
|
13958
13965
|
} catch {
|
|
13959
13966
|
console.error(
|
|
13960
|
-
|
|
13967
|
+
chalk141.red(
|
|
13961
13968
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
13962
13969
|
)
|
|
13963
13970
|
);
|
|
@@ -13984,7 +13991,7 @@ async function ravenFetch(connection, path57) {
|
|
|
13984
13991
|
if (!response.ok) {
|
|
13985
13992
|
const body = await response.text();
|
|
13986
13993
|
console.error(
|
|
13987
|
-
|
|
13994
|
+
chalk142.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
13988
13995
|
);
|
|
13989
13996
|
console.error(body.substring(0, 500));
|
|
13990
13997
|
process.exit(1);
|
|
@@ -13993,7 +14000,7 @@ async function ravenFetch(connection, path57) {
|
|
|
13993
14000
|
}
|
|
13994
14001
|
|
|
13995
14002
|
// src/commands/ravendb/resolveConnection.ts
|
|
13996
|
-
import
|
|
14003
|
+
import chalk143 from "chalk";
|
|
13997
14004
|
function loadRavendb() {
|
|
13998
14005
|
const raw = loadGlobalConfigRaw();
|
|
13999
14006
|
const ravendb = raw.ravendb;
|
|
@@ -14007,7 +14014,7 @@ function resolveConnection(name) {
|
|
|
14007
14014
|
const connectionName = name ?? defaultConnection;
|
|
14008
14015
|
if (!connectionName) {
|
|
14009
14016
|
console.error(
|
|
14010
|
-
|
|
14017
|
+
chalk143.red(
|
|
14011
14018
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
14012
14019
|
)
|
|
14013
14020
|
);
|
|
@@ -14015,7 +14022,7 @@ function resolveConnection(name) {
|
|
|
14015
14022
|
}
|
|
14016
14023
|
const connection = connections.find((c) => c.name === connectionName);
|
|
14017
14024
|
if (!connection) {
|
|
14018
|
-
console.error(
|
|
14025
|
+
console.error(chalk143.red(`Connection "${connectionName}" not found.`));
|
|
14019
14026
|
console.error(
|
|
14020
14027
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
14021
14028
|
);
|
|
@@ -14046,15 +14053,15 @@ async function ravendbCollections(connectionName) {
|
|
|
14046
14053
|
return;
|
|
14047
14054
|
}
|
|
14048
14055
|
for (const c of collections) {
|
|
14049
|
-
console.log(`${
|
|
14056
|
+
console.log(`${chalk144.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
14050
14057
|
}
|
|
14051
14058
|
}
|
|
14052
14059
|
|
|
14053
14060
|
// src/commands/ravendb/ravendbQuery.ts
|
|
14054
|
-
import
|
|
14061
|
+
import chalk146 from "chalk";
|
|
14055
14062
|
|
|
14056
14063
|
// src/commands/ravendb/fetchAllPages.ts
|
|
14057
|
-
import
|
|
14064
|
+
import chalk145 from "chalk";
|
|
14058
14065
|
|
|
14059
14066
|
// src/commands/ravendb/buildQueryPath.ts
|
|
14060
14067
|
function buildQueryPath(opts) {
|
|
@@ -14092,7 +14099,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
14092
14099
|
allResults.push(...results);
|
|
14093
14100
|
start3 += results.length;
|
|
14094
14101
|
process.stderr.write(
|
|
14095
|
-
`\r${
|
|
14102
|
+
`\r${chalk145.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
14096
14103
|
);
|
|
14097
14104
|
if (start3 >= totalResults) break;
|
|
14098
14105
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -14107,7 +14114,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
14107
14114
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
14108
14115
|
const resolved = resolveArgs(connectionName, collection);
|
|
14109
14116
|
if (!resolved.collection && !options2.query) {
|
|
14110
|
-
console.error(
|
|
14117
|
+
console.error(chalk146.red("Provide a collection name or --query filter."));
|
|
14111
14118
|
process.exit(1);
|
|
14112
14119
|
}
|
|
14113
14120
|
const { collection: col } = resolved;
|
|
@@ -14145,7 +14152,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
14145
14152
|
import * as path28 from "path";
|
|
14146
14153
|
|
|
14147
14154
|
// src/commands/refactor/logViolations.ts
|
|
14148
|
-
import
|
|
14155
|
+
import chalk147 from "chalk";
|
|
14149
14156
|
var DEFAULT_MAX_LINES = 100;
|
|
14150
14157
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
14151
14158
|
if (violations.length === 0) {
|
|
@@ -14154,43 +14161,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
14154
14161
|
}
|
|
14155
14162
|
return;
|
|
14156
14163
|
}
|
|
14157
|
-
console.error(
|
|
14164
|
+
console.error(chalk147.red(`
|
|
14158
14165
|
Refactor check failed:
|
|
14159
14166
|
`));
|
|
14160
|
-
console.error(
|
|
14167
|
+
console.error(chalk147.red(` The following files exceed ${maxLines} lines:
|
|
14161
14168
|
`));
|
|
14162
14169
|
for (const violation of violations) {
|
|
14163
|
-
console.error(
|
|
14170
|
+
console.error(chalk147.red(` ${violation.file} (${violation.lines} lines)`));
|
|
14164
14171
|
}
|
|
14165
14172
|
console.error(
|
|
14166
|
-
|
|
14173
|
+
chalk147.yellow(
|
|
14167
14174
|
`
|
|
14168
14175
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
14169
14176
|
way to refactor it, ignore it with:
|
|
14170
14177
|
`
|
|
14171
14178
|
)
|
|
14172
14179
|
);
|
|
14173
|
-
console.error(
|
|
14180
|
+
console.error(chalk147.gray(` assist refactor ignore <file>
|
|
14174
14181
|
`));
|
|
14175
14182
|
if (process.env.CLAUDECODE) {
|
|
14176
|
-
console.error(
|
|
14183
|
+
console.error(chalk147.cyan(`
|
|
14177
14184
|
## Extracting Code to New Files
|
|
14178
14185
|
`));
|
|
14179
14186
|
console.error(
|
|
14180
|
-
|
|
14187
|
+
chalk147.cyan(
|
|
14181
14188
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
14182
14189
|
`
|
|
14183
14190
|
)
|
|
14184
14191
|
);
|
|
14185
14192
|
console.error(
|
|
14186
|
-
|
|
14193
|
+
chalk147.cyan(
|
|
14187
14194
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
14188
14195
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
14189
14196
|
`
|
|
14190
14197
|
)
|
|
14191
14198
|
);
|
|
14192
14199
|
console.error(
|
|
14193
|
-
|
|
14200
|
+
chalk147.cyan(
|
|
14194
14201
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
14195
14202
|
domains, move it to a common/shared folder.
|
|
14196
14203
|
`
|
|
@@ -14346,7 +14353,7 @@ async function check(pattern2, options2) {
|
|
|
14346
14353
|
|
|
14347
14354
|
// src/commands/refactor/extract/index.ts
|
|
14348
14355
|
import path35 from "path";
|
|
14349
|
-
import
|
|
14356
|
+
import chalk150 from "chalk";
|
|
14350
14357
|
|
|
14351
14358
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
14352
14359
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -14921,23 +14928,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
14921
14928
|
|
|
14922
14929
|
// src/commands/refactor/extract/displayPlan.ts
|
|
14923
14930
|
import path32 from "path";
|
|
14924
|
-
import
|
|
14931
|
+
import chalk148 from "chalk";
|
|
14925
14932
|
function section(title) {
|
|
14926
14933
|
return `
|
|
14927
|
-
${
|
|
14934
|
+
${chalk148.cyan(title)}`;
|
|
14928
14935
|
}
|
|
14929
14936
|
function displayImporters(plan2, cwd) {
|
|
14930
14937
|
if (plan2.importersToUpdate.length === 0) return;
|
|
14931
14938
|
console.log(section("Update importers:"));
|
|
14932
14939
|
for (const imp of plan2.importersToUpdate) {
|
|
14933
14940
|
const rel = path32.relative(cwd, imp.file.getFilePath());
|
|
14934
|
-
console.log(` ${
|
|
14941
|
+
console.log(` ${chalk148.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
14935
14942
|
}
|
|
14936
14943
|
}
|
|
14937
14944
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
14938
|
-
console.log(
|
|
14945
|
+
console.log(chalk148.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
14939
14946
|
`));
|
|
14940
|
-
console.log(` ${
|
|
14947
|
+
console.log(` ${chalk148.cyan("Functions to move:")}`);
|
|
14941
14948
|
for (const name of plan2.extractedNames) {
|
|
14942
14949
|
console.log(` ${name}`);
|
|
14943
14950
|
}
|
|
@@ -14971,7 +14978,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
14971
14978
|
|
|
14972
14979
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
14973
14980
|
import path34 from "path";
|
|
14974
|
-
import
|
|
14981
|
+
import chalk149 from "chalk";
|
|
14975
14982
|
import { Project as Project4 } from "ts-morph";
|
|
14976
14983
|
|
|
14977
14984
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -15031,7 +15038,7 @@ function loadProjectFile(file) {
|
|
|
15031
15038
|
});
|
|
15032
15039
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
15033
15040
|
if (!sourceFile) {
|
|
15034
|
-
console.log(
|
|
15041
|
+
console.log(chalk149.red(`File not found in project: ${file}`));
|
|
15035
15042
|
process.exit(1);
|
|
15036
15043
|
}
|
|
15037
15044
|
return { project, sourceFile };
|
|
@@ -15054,19 +15061,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
15054
15061
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
15055
15062
|
if (options2.apply) {
|
|
15056
15063
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
15057
|
-
console.log(
|
|
15064
|
+
console.log(chalk150.green("\nExtraction complete"));
|
|
15058
15065
|
} else {
|
|
15059
|
-
console.log(
|
|
15066
|
+
console.log(chalk150.dim("\nDry run. Use --apply to execute."));
|
|
15060
15067
|
}
|
|
15061
15068
|
}
|
|
15062
15069
|
|
|
15063
15070
|
// src/commands/refactor/ignore.ts
|
|
15064
15071
|
import fs22 from "fs";
|
|
15065
|
-
import
|
|
15072
|
+
import chalk151 from "chalk";
|
|
15066
15073
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
15067
15074
|
function ignore(file) {
|
|
15068
15075
|
if (!fs22.existsSync(file)) {
|
|
15069
|
-
console.error(
|
|
15076
|
+
console.error(chalk151.red(`Error: File does not exist: ${file}`));
|
|
15070
15077
|
process.exit(1);
|
|
15071
15078
|
}
|
|
15072
15079
|
const content = fs22.readFileSync(file, "utf8");
|
|
@@ -15082,7 +15089,7 @@ function ignore(file) {
|
|
|
15082
15089
|
fs22.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
15083
15090
|
}
|
|
15084
15091
|
console.log(
|
|
15085
|
-
|
|
15092
|
+
chalk151.green(
|
|
15086
15093
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
15087
15094
|
)
|
|
15088
15095
|
);
|
|
@@ -15091,12 +15098,12 @@ function ignore(file) {
|
|
|
15091
15098
|
// src/commands/refactor/rename/index.ts
|
|
15092
15099
|
import fs25 from "fs";
|
|
15093
15100
|
import path40 from "path";
|
|
15094
|
-
import
|
|
15101
|
+
import chalk154 from "chalk";
|
|
15095
15102
|
|
|
15096
15103
|
// src/commands/refactor/rename/applyRename.ts
|
|
15097
15104
|
import fs24 from "fs";
|
|
15098
15105
|
import path37 from "path";
|
|
15099
|
-
import
|
|
15106
|
+
import chalk152 from "chalk";
|
|
15100
15107
|
|
|
15101
15108
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
15102
15109
|
import path36 from "path";
|
|
@@ -15201,13 +15208,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
15201
15208
|
const updatedContents = applyRewrites(rewrites);
|
|
15202
15209
|
for (const [file, content] of updatedContents) {
|
|
15203
15210
|
fs24.writeFileSync(file, content, "utf8");
|
|
15204
|
-
console.log(
|
|
15211
|
+
console.log(chalk152.cyan(` Updated imports in ${path37.relative(cwd, file)}`));
|
|
15205
15212
|
}
|
|
15206
15213
|
const destDir = path37.dirname(destPath);
|
|
15207
15214
|
if (!fs24.existsSync(destDir)) fs24.mkdirSync(destDir, { recursive: true });
|
|
15208
15215
|
fs24.renameSync(sourcePath, destPath);
|
|
15209
15216
|
console.log(
|
|
15210
|
-
|
|
15217
|
+
chalk152.white(
|
|
15211
15218
|
` Moved ${path37.relative(cwd, sourcePath)} \u2192 ${path37.relative(cwd, destPath)}`
|
|
15212
15219
|
)
|
|
15213
15220
|
);
|
|
@@ -15294,16 +15301,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
15294
15301
|
|
|
15295
15302
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
15296
15303
|
import path39 from "path";
|
|
15297
|
-
import
|
|
15304
|
+
import chalk153 from "chalk";
|
|
15298
15305
|
function printRenamePreview(rewrites, cwd) {
|
|
15299
15306
|
for (const rewrite of rewrites) {
|
|
15300
15307
|
console.log(
|
|
15301
|
-
|
|
15308
|
+
chalk153.dim(
|
|
15302
15309
|
` ${path39.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
15303
15310
|
)
|
|
15304
15311
|
);
|
|
15305
15312
|
}
|
|
15306
|
-
console.log(
|
|
15313
|
+
console.log(chalk153.dim("Dry run. Use --apply to execute."));
|
|
15307
15314
|
}
|
|
15308
15315
|
|
|
15309
15316
|
// src/commands/refactor/rename/index.ts
|
|
@@ -15314,20 +15321,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
15314
15321
|
const relSource = path40.relative(cwd, sourcePath);
|
|
15315
15322
|
const relDest = path40.relative(cwd, destPath);
|
|
15316
15323
|
if (!fs25.existsSync(sourcePath)) {
|
|
15317
|
-
console.log(
|
|
15324
|
+
console.log(chalk154.red(`File not found: ${source}`));
|
|
15318
15325
|
process.exit(1);
|
|
15319
15326
|
}
|
|
15320
15327
|
if (destPath !== sourcePath && fs25.existsSync(destPath)) {
|
|
15321
|
-
console.log(
|
|
15328
|
+
console.log(chalk154.red(`Destination already exists: ${destination}`));
|
|
15322
15329
|
process.exit(1);
|
|
15323
15330
|
}
|
|
15324
|
-
console.log(
|
|
15325
|
-
console.log(
|
|
15326
|
-
console.log(
|
|
15331
|
+
console.log(chalk154.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
15332
|
+
console.log(chalk154.dim("Loading project..."));
|
|
15333
|
+
console.log(chalk154.dim("Scanning imports across the project..."));
|
|
15327
15334
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
15328
15335
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
15329
15336
|
console.log(
|
|
15330
|
-
|
|
15337
|
+
chalk154.dim(
|
|
15331
15338
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
15332
15339
|
)
|
|
15333
15340
|
);
|
|
@@ -15336,11 +15343,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
15336
15343
|
return;
|
|
15337
15344
|
}
|
|
15338
15345
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
15339
|
-
console.log(
|
|
15346
|
+
console.log(chalk154.green("Done"));
|
|
15340
15347
|
}
|
|
15341
15348
|
|
|
15342
15349
|
// src/commands/refactor/renameSymbol/index.ts
|
|
15343
|
-
import
|
|
15350
|
+
import chalk155 from "chalk";
|
|
15344
15351
|
|
|
15345
15352
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
15346
15353
|
import { SyntaxKind as SyntaxKind14 } from "ts-morph";
|
|
@@ -15386,33 +15393,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
15386
15393
|
const { project, sourceFile } = loadProjectFile(file);
|
|
15387
15394
|
const symbol = findSymbol(sourceFile, oldName);
|
|
15388
15395
|
if (!symbol) {
|
|
15389
|
-
console.log(
|
|
15396
|
+
console.log(chalk155.red(`Symbol "${oldName}" not found in ${file}`));
|
|
15390
15397
|
process.exit(1);
|
|
15391
15398
|
}
|
|
15392
15399
|
const grouped = groupReferences(symbol, cwd);
|
|
15393
15400
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
15394
15401
|
console.log(
|
|
15395
|
-
|
|
15402
|
+
chalk155.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
15396
15403
|
`)
|
|
15397
15404
|
);
|
|
15398
15405
|
for (const [refFile, lines] of grouped) {
|
|
15399
15406
|
console.log(
|
|
15400
|
-
` ${
|
|
15407
|
+
` ${chalk155.dim(refFile)}: lines ${chalk155.cyan(lines.join(", "))}`
|
|
15401
15408
|
);
|
|
15402
15409
|
}
|
|
15403
15410
|
if (options2.apply) {
|
|
15404
15411
|
symbol.rename(newName);
|
|
15405
15412
|
await project.save();
|
|
15406
|
-
console.log(
|
|
15413
|
+
console.log(chalk155.green(`
|
|
15407
15414
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
15408
15415
|
} else {
|
|
15409
|
-
console.log(
|
|
15416
|
+
console.log(chalk155.dim("\nDry run. Use --apply to execute."));
|
|
15410
15417
|
}
|
|
15411
15418
|
}
|
|
15412
15419
|
|
|
15413
15420
|
// src/commands/refactor/restructure/index.ts
|
|
15414
15421
|
import path48 from "path";
|
|
15415
|
-
import
|
|
15422
|
+
import chalk158 from "chalk";
|
|
15416
15423
|
|
|
15417
15424
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
15418
15425
|
import path42 from "path";
|
|
@@ -15491,50 +15498,50 @@ function clusterFiles(graph) {
|
|
|
15491
15498
|
|
|
15492
15499
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
15493
15500
|
import path44 from "path";
|
|
15494
|
-
import
|
|
15501
|
+
import chalk156 from "chalk";
|
|
15495
15502
|
function relPath(filePath) {
|
|
15496
15503
|
return path44.relative(process.cwd(), filePath);
|
|
15497
15504
|
}
|
|
15498
15505
|
function displayMoves(plan2) {
|
|
15499
15506
|
if (plan2.moves.length === 0) return;
|
|
15500
|
-
console.log(
|
|
15507
|
+
console.log(chalk156.bold("\nFile moves:"));
|
|
15501
15508
|
for (const move of plan2.moves) {
|
|
15502
15509
|
console.log(
|
|
15503
|
-
` ${
|
|
15510
|
+
` ${chalk156.red(relPath(move.from))} \u2192 ${chalk156.green(relPath(move.to))}`
|
|
15504
15511
|
);
|
|
15505
|
-
console.log(
|
|
15512
|
+
console.log(chalk156.dim(` ${move.reason}`));
|
|
15506
15513
|
}
|
|
15507
15514
|
}
|
|
15508
15515
|
function displayRewrites(rewrites) {
|
|
15509
15516
|
if (rewrites.length === 0) return;
|
|
15510
15517
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
15511
|
-
console.log(
|
|
15518
|
+
console.log(chalk156.bold(`
|
|
15512
15519
|
Import rewrites (${affectedFiles.size} files):`));
|
|
15513
15520
|
for (const file of affectedFiles) {
|
|
15514
|
-
console.log(` ${
|
|
15521
|
+
console.log(` ${chalk156.cyan(relPath(file))}:`);
|
|
15515
15522
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
15516
15523
|
(r) => r.file === file
|
|
15517
15524
|
)) {
|
|
15518
15525
|
console.log(
|
|
15519
|
-
` ${
|
|
15526
|
+
` ${chalk156.red(`"${oldSpecifier}"`)} \u2192 ${chalk156.green(`"${newSpecifier}"`)}`
|
|
15520
15527
|
);
|
|
15521
15528
|
}
|
|
15522
15529
|
}
|
|
15523
15530
|
}
|
|
15524
15531
|
function displayPlan2(plan2) {
|
|
15525
15532
|
if (plan2.warnings.length > 0) {
|
|
15526
|
-
console.log(
|
|
15527
|
-
for (const w of plan2.warnings) console.log(
|
|
15533
|
+
console.log(chalk156.yellow("\nWarnings:"));
|
|
15534
|
+
for (const w of plan2.warnings) console.log(chalk156.yellow(` ${w}`));
|
|
15528
15535
|
}
|
|
15529
15536
|
if (plan2.newDirectories.length > 0) {
|
|
15530
|
-
console.log(
|
|
15537
|
+
console.log(chalk156.bold("\nNew directories:"));
|
|
15531
15538
|
for (const dir of plan2.newDirectories)
|
|
15532
|
-
console.log(
|
|
15539
|
+
console.log(chalk156.green(` ${dir}/`));
|
|
15533
15540
|
}
|
|
15534
15541
|
displayMoves(plan2);
|
|
15535
15542
|
displayRewrites(plan2.rewrites);
|
|
15536
15543
|
console.log(
|
|
15537
|
-
|
|
15544
|
+
chalk156.dim(
|
|
15538
15545
|
`
|
|
15539
15546
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
15540
15547
|
)
|
|
@@ -15544,18 +15551,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
15544
15551
|
// src/commands/refactor/restructure/executePlan.ts
|
|
15545
15552
|
import fs26 from "fs";
|
|
15546
15553
|
import path45 from "path";
|
|
15547
|
-
import
|
|
15554
|
+
import chalk157 from "chalk";
|
|
15548
15555
|
function executePlan(plan2) {
|
|
15549
15556
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
15550
15557
|
for (const [file, content] of updatedContents) {
|
|
15551
15558
|
fs26.writeFileSync(file, content, "utf8");
|
|
15552
15559
|
console.log(
|
|
15553
|
-
|
|
15560
|
+
chalk157.cyan(` Rewrote imports in ${path45.relative(process.cwd(), file)}`)
|
|
15554
15561
|
);
|
|
15555
15562
|
}
|
|
15556
15563
|
for (const dir of plan2.newDirectories) {
|
|
15557
15564
|
fs26.mkdirSync(dir, { recursive: true });
|
|
15558
|
-
console.log(
|
|
15565
|
+
console.log(chalk157.green(` Created ${path45.relative(process.cwd(), dir)}/`));
|
|
15559
15566
|
}
|
|
15560
15567
|
for (const move of plan2.moves) {
|
|
15561
15568
|
const targetDir = path45.dirname(move.to);
|
|
@@ -15564,7 +15571,7 @@ function executePlan(plan2) {
|
|
|
15564
15571
|
}
|
|
15565
15572
|
fs26.renameSync(move.from, move.to);
|
|
15566
15573
|
console.log(
|
|
15567
|
-
|
|
15574
|
+
chalk157.white(
|
|
15568
15575
|
` Moved ${path45.relative(process.cwd(), move.from)} \u2192 ${path45.relative(process.cwd(), move.to)}`
|
|
15569
15576
|
)
|
|
15570
15577
|
);
|
|
@@ -15579,7 +15586,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
15579
15586
|
if (entries.length === 0) {
|
|
15580
15587
|
fs26.rmdirSync(dir);
|
|
15581
15588
|
console.log(
|
|
15582
|
-
|
|
15589
|
+
chalk157.dim(
|
|
15583
15590
|
` Removed empty directory ${path45.relative(process.cwd(), dir)}`
|
|
15584
15591
|
)
|
|
15585
15592
|
);
|
|
@@ -15712,22 +15719,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
15712
15719
|
const targetPattern = pattern2 ?? "src";
|
|
15713
15720
|
const files = findSourceFiles2(targetPattern);
|
|
15714
15721
|
if (files.length === 0) {
|
|
15715
|
-
console.log(
|
|
15722
|
+
console.log(chalk158.yellow("No files found matching pattern"));
|
|
15716
15723
|
return;
|
|
15717
15724
|
}
|
|
15718
15725
|
const tsConfigPath = path48.resolve("tsconfig.json");
|
|
15719
15726
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
15720
15727
|
if (plan2.moves.length === 0) {
|
|
15721
|
-
console.log(
|
|
15728
|
+
console.log(chalk158.green("No restructuring needed"));
|
|
15722
15729
|
return;
|
|
15723
15730
|
}
|
|
15724
15731
|
displayPlan2(plan2);
|
|
15725
15732
|
if (options2.apply) {
|
|
15726
|
-
console.log(
|
|
15733
|
+
console.log(chalk158.bold("\nApplying changes..."));
|
|
15727
15734
|
executePlan(plan2);
|
|
15728
|
-
console.log(
|
|
15735
|
+
console.log(chalk158.green("\nRestructuring complete"));
|
|
15729
15736
|
} else {
|
|
15730
|
-
console.log(
|
|
15737
|
+
console.log(chalk158.dim("\nDry run. Use --apply to execute."));
|
|
15731
15738
|
}
|
|
15732
15739
|
}
|
|
15733
15740
|
|
|
@@ -16296,18 +16303,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
16296
16303
|
}
|
|
16297
16304
|
|
|
16298
16305
|
// src/commands/review/warnOutOfDiff.ts
|
|
16299
|
-
import
|
|
16306
|
+
import chalk159 from "chalk";
|
|
16300
16307
|
function warnOutOfDiff(outOfDiff) {
|
|
16301
16308
|
if (outOfDiff.length === 0) return;
|
|
16302
16309
|
console.warn(
|
|
16303
|
-
|
|
16310
|
+
chalk159.yellow(
|
|
16304
16311
|
`Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
|
|
16305
16312
|
)
|
|
16306
16313
|
);
|
|
16307
16314
|
for (const finding of outOfDiff) {
|
|
16308
16315
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
16309
16316
|
console.warn(
|
|
16310
|
-
` ${
|
|
16317
|
+
` ${chalk159.yellow("\xB7")} ${finding.title} ${chalk159.dim(
|
|
16311
16318
|
`(${finding.file}:${range})`
|
|
16312
16319
|
)}`
|
|
16313
16320
|
);
|
|
@@ -16326,18 +16333,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
16326
16333
|
}
|
|
16327
16334
|
|
|
16328
16335
|
// src/commands/review/warnUnlocated.ts
|
|
16329
|
-
import
|
|
16336
|
+
import chalk160 from "chalk";
|
|
16330
16337
|
function warnUnlocated(unlocated) {
|
|
16331
16338
|
if (unlocated.length === 0) return;
|
|
16332
16339
|
console.warn(
|
|
16333
|
-
|
|
16340
|
+
chalk160.yellow(
|
|
16334
16341
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
16335
16342
|
)
|
|
16336
16343
|
);
|
|
16337
16344
|
for (const finding of unlocated) {
|
|
16338
|
-
const where = finding.location ||
|
|
16345
|
+
const where = finding.location || chalk160.dim("missing");
|
|
16339
16346
|
console.warn(
|
|
16340
|
-
` ${
|
|
16347
|
+
` ${chalk160.yellow("\xB7")} ${finding.title} ${chalk160.dim(`(${where})`)}`
|
|
16341
16348
|
);
|
|
16342
16349
|
}
|
|
16343
16350
|
}
|
|
@@ -17508,7 +17515,7 @@ function registerReview(program2) {
|
|
|
17508
17515
|
}
|
|
17509
17516
|
|
|
17510
17517
|
// src/commands/seq/seqAuth.ts
|
|
17511
|
-
import
|
|
17518
|
+
import chalk162 from "chalk";
|
|
17512
17519
|
|
|
17513
17520
|
// src/commands/seq/loadConnections.ts
|
|
17514
17521
|
function loadConnections2() {
|
|
@@ -17537,10 +17544,10 @@ function setDefaultConnection(name) {
|
|
|
17537
17544
|
}
|
|
17538
17545
|
|
|
17539
17546
|
// src/shared/assertUniqueName.ts
|
|
17540
|
-
import
|
|
17547
|
+
import chalk161 from "chalk";
|
|
17541
17548
|
function assertUniqueName(existingNames, name) {
|
|
17542
17549
|
if (existingNames.includes(name)) {
|
|
17543
|
-
console.error(
|
|
17550
|
+
console.error(chalk161.red(`Connection "${name}" already exists.`));
|
|
17544
17551
|
process.exit(1);
|
|
17545
17552
|
}
|
|
17546
17553
|
}
|
|
@@ -17558,16 +17565,16 @@ async function promptConnection2(existingNames) {
|
|
|
17558
17565
|
var seqAuth = createConnectionAuth({
|
|
17559
17566
|
load: loadConnections2,
|
|
17560
17567
|
save: saveConnections2,
|
|
17561
|
-
format: (c) => `${
|
|
17568
|
+
format: (c) => `${chalk162.bold(c.name)} ${c.url}`,
|
|
17562
17569
|
promptNew: promptConnection2,
|
|
17563
17570
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
17564
17571
|
});
|
|
17565
17572
|
|
|
17566
17573
|
// src/commands/seq/seqQuery.ts
|
|
17567
|
-
import
|
|
17574
|
+
import chalk166 from "chalk";
|
|
17568
17575
|
|
|
17569
17576
|
// src/commands/seq/fetchSeq.ts
|
|
17570
|
-
import
|
|
17577
|
+
import chalk163 from "chalk";
|
|
17571
17578
|
async function fetchSeq(conn, path57, params) {
|
|
17572
17579
|
const url = `${conn.url}${path57}?${params}`;
|
|
17573
17580
|
const response = await fetch(url, {
|
|
@@ -17578,7 +17585,7 @@ async function fetchSeq(conn, path57, params) {
|
|
|
17578
17585
|
});
|
|
17579
17586
|
if (!response.ok) {
|
|
17580
17587
|
const body = await response.text();
|
|
17581
|
-
console.error(
|
|
17588
|
+
console.error(chalk163.red(`Seq returned ${response.status}: ${body}`));
|
|
17582
17589
|
process.exit(1);
|
|
17583
17590
|
}
|
|
17584
17591
|
return response;
|
|
@@ -17637,23 +17644,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
17637
17644
|
}
|
|
17638
17645
|
|
|
17639
17646
|
// src/commands/seq/formatEvent.ts
|
|
17640
|
-
import
|
|
17647
|
+
import chalk164 from "chalk";
|
|
17641
17648
|
function levelColor(level) {
|
|
17642
17649
|
switch (level) {
|
|
17643
17650
|
case "Fatal":
|
|
17644
|
-
return
|
|
17651
|
+
return chalk164.bgRed.white;
|
|
17645
17652
|
case "Error":
|
|
17646
|
-
return
|
|
17653
|
+
return chalk164.red;
|
|
17647
17654
|
case "Warning":
|
|
17648
|
-
return
|
|
17655
|
+
return chalk164.yellow;
|
|
17649
17656
|
case "Information":
|
|
17650
|
-
return
|
|
17657
|
+
return chalk164.cyan;
|
|
17651
17658
|
case "Debug":
|
|
17652
|
-
return
|
|
17659
|
+
return chalk164.gray;
|
|
17653
17660
|
case "Verbose":
|
|
17654
|
-
return
|
|
17661
|
+
return chalk164.dim;
|
|
17655
17662
|
default:
|
|
17656
|
-
return
|
|
17663
|
+
return chalk164.white;
|
|
17657
17664
|
}
|
|
17658
17665
|
}
|
|
17659
17666
|
function levelAbbrev(level) {
|
|
@@ -17694,12 +17701,12 @@ function formatTimestamp(iso) {
|
|
|
17694
17701
|
function formatEvent(event) {
|
|
17695
17702
|
const color = levelColor(event.Level);
|
|
17696
17703
|
const abbrev = levelAbbrev(event.Level);
|
|
17697
|
-
const ts8 =
|
|
17704
|
+
const ts8 = chalk164.dim(formatTimestamp(event.Timestamp));
|
|
17698
17705
|
const msg = renderMessage(event);
|
|
17699
17706
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
17700
17707
|
if (event.Exception) {
|
|
17701
17708
|
for (const line of event.Exception.split("\n")) {
|
|
17702
|
-
lines.push(
|
|
17709
|
+
lines.push(chalk164.red(` ${line}`));
|
|
17703
17710
|
}
|
|
17704
17711
|
}
|
|
17705
17712
|
return lines.join("\n");
|
|
@@ -17732,11 +17739,11 @@ function rejectTimestampFilter(filter) {
|
|
|
17732
17739
|
}
|
|
17733
17740
|
|
|
17734
17741
|
// src/shared/resolveNamedConnection.ts
|
|
17735
|
-
import
|
|
17742
|
+
import chalk165 from "chalk";
|
|
17736
17743
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
17737
17744
|
if (connections.length === 0) {
|
|
17738
17745
|
console.error(
|
|
17739
|
-
|
|
17746
|
+
chalk165.red(
|
|
17740
17747
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
17741
17748
|
)
|
|
17742
17749
|
);
|
|
@@ -17745,7 +17752,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
17745
17752
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
17746
17753
|
const connection = connections.find((c) => c.name === target);
|
|
17747
17754
|
if (!connection) {
|
|
17748
|
-
console.error(
|
|
17755
|
+
console.error(chalk165.red(`${kind} connection "${target}" not found.`));
|
|
17749
17756
|
process.exit(1);
|
|
17750
17757
|
}
|
|
17751
17758
|
return connection;
|
|
@@ -17774,7 +17781,7 @@ async function seqQuery(filter, options2) {
|
|
|
17774
17781
|
new URLSearchParams({ filter, count: String(count6) })
|
|
17775
17782
|
);
|
|
17776
17783
|
if (events.length === 0) {
|
|
17777
|
-
console.log(
|
|
17784
|
+
console.log(chalk166.yellow("No events found."));
|
|
17778
17785
|
return;
|
|
17779
17786
|
}
|
|
17780
17787
|
if (options2.json) {
|
|
@@ -17785,11 +17792,11 @@ async function seqQuery(filter, options2) {
|
|
|
17785
17792
|
for (const event of chronological) {
|
|
17786
17793
|
console.log(formatEvent(event));
|
|
17787
17794
|
}
|
|
17788
|
-
console.log(
|
|
17795
|
+
console.log(chalk166.dim(`
|
|
17789
17796
|
${events.length} events`));
|
|
17790
17797
|
if (events.length >= count6) {
|
|
17791
17798
|
console.log(
|
|
17792
|
-
|
|
17799
|
+
chalk166.yellow(
|
|
17793
17800
|
`Results limited to ${count6}. Use --count to retrieve more.`
|
|
17794
17801
|
)
|
|
17795
17802
|
);
|
|
@@ -17797,10 +17804,10 @@ ${events.length} events`));
|
|
|
17797
17804
|
}
|
|
17798
17805
|
|
|
17799
17806
|
// src/shared/setNamedDefaultConnection.ts
|
|
17800
|
-
import
|
|
17807
|
+
import chalk167 from "chalk";
|
|
17801
17808
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
17802
17809
|
if (!connections.find((c) => c.name === name)) {
|
|
17803
|
-
console.error(
|
|
17810
|
+
console.error(chalk167.red(`Connection "${name}" not found.`));
|
|
17804
17811
|
process.exit(1);
|
|
17805
17812
|
}
|
|
17806
17813
|
setDefault(name);
|
|
@@ -17848,7 +17855,7 @@ function registerSignal(program2) {
|
|
|
17848
17855
|
}
|
|
17849
17856
|
|
|
17850
17857
|
// src/commands/sql/sqlAuth.ts
|
|
17851
|
-
import
|
|
17858
|
+
import chalk169 from "chalk";
|
|
17852
17859
|
|
|
17853
17860
|
// src/commands/sql/loadConnections.ts
|
|
17854
17861
|
function loadConnections3() {
|
|
@@ -17877,7 +17884,7 @@ function setDefaultConnection2(name) {
|
|
|
17877
17884
|
}
|
|
17878
17885
|
|
|
17879
17886
|
// src/commands/sql/promptConnection.ts
|
|
17880
|
-
import
|
|
17887
|
+
import chalk168 from "chalk";
|
|
17881
17888
|
async function promptConnection3(existingNames) {
|
|
17882
17889
|
const name = await promptInput("name", "Connection name:", "default");
|
|
17883
17890
|
assertUniqueName(existingNames, name);
|
|
@@ -17885,7 +17892,7 @@ async function promptConnection3(existingNames) {
|
|
|
17885
17892
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
17886
17893
|
const port = Number.parseInt(portStr, 10);
|
|
17887
17894
|
if (!Number.isFinite(port)) {
|
|
17888
|
-
console.error(
|
|
17895
|
+
console.error(chalk168.red(`Invalid port "${portStr}".`));
|
|
17889
17896
|
process.exit(1);
|
|
17890
17897
|
}
|
|
17891
17898
|
const user = await promptInput("user", "User:");
|
|
@@ -17898,13 +17905,13 @@ async function promptConnection3(existingNames) {
|
|
|
17898
17905
|
var sqlAuth = createConnectionAuth({
|
|
17899
17906
|
load: loadConnections3,
|
|
17900
17907
|
save: saveConnections3,
|
|
17901
|
-
format: (c) => `${
|
|
17908
|
+
format: (c) => `${chalk169.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
17902
17909
|
promptNew: promptConnection3,
|
|
17903
17910
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
17904
17911
|
});
|
|
17905
17912
|
|
|
17906
17913
|
// src/commands/sql/printTable.ts
|
|
17907
|
-
import
|
|
17914
|
+
import chalk170 from "chalk";
|
|
17908
17915
|
function formatCell(value) {
|
|
17909
17916
|
if (value === null || value === void 0) return "";
|
|
17910
17917
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -17913,7 +17920,7 @@ function formatCell(value) {
|
|
|
17913
17920
|
}
|
|
17914
17921
|
function printTable(rows) {
|
|
17915
17922
|
if (rows.length === 0) {
|
|
17916
|
-
console.log(
|
|
17923
|
+
console.log(chalk170.yellow("(no rows)"));
|
|
17917
17924
|
return;
|
|
17918
17925
|
}
|
|
17919
17926
|
const columns = Object.keys(rows[0]);
|
|
@@ -17921,13 +17928,13 @@ function printTable(rows) {
|
|
|
17921
17928
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
17922
17929
|
);
|
|
17923
17930
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
17924
|
-
console.log(
|
|
17925
|
-
console.log(
|
|
17931
|
+
console.log(chalk170.dim(header));
|
|
17932
|
+
console.log(chalk170.dim("-".repeat(header.length)));
|
|
17926
17933
|
for (const row of rows) {
|
|
17927
17934
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
17928
17935
|
console.log(line);
|
|
17929
17936
|
}
|
|
17930
|
-
console.log(
|
|
17937
|
+
console.log(chalk170.dim(`
|
|
17931
17938
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
17932
17939
|
}
|
|
17933
17940
|
|
|
@@ -17987,7 +17994,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
17987
17994
|
}
|
|
17988
17995
|
|
|
17989
17996
|
// src/commands/sql/sqlMutate.ts
|
|
17990
|
-
import
|
|
17997
|
+
import chalk171 from "chalk";
|
|
17991
17998
|
|
|
17992
17999
|
// src/commands/sql/isMutation.ts
|
|
17993
18000
|
var MUTATION_KEYWORDS = [
|
|
@@ -18021,7 +18028,7 @@ function isMutation(sql6) {
|
|
|
18021
18028
|
async function sqlMutate(query, connectionName) {
|
|
18022
18029
|
if (!isMutation(query)) {
|
|
18023
18030
|
console.error(
|
|
18024
|
-
|
|
18031
|
+
chalk171.red(
|
|
18025
18032
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
18026
18033
|
)
|
|
18027
18034
|
);
|
|
@@ -18031,18 +18038,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
18031
18038
|
const pool = await sqlConnect(conn);
|
|
18032
18039
|
try {
|
|
18033
18040
|
const result = await pool.request().query(query);
|
|
18034
|
-
console.log(
|
|
18041
|
+
console.log(chalk171.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
18035
18042
|
} finally {
|
|
18036
18043
|
await pool.close();
|
|
18037
18044
|
}
|
|
18038
18045
|
}
|
|
18039
18046
|
|
|
18040
18047
|
// src/commands/sql/sqlQuery.ts
|
|
18041
|
-
import
|
|
18048
|
+
import chalk172 from "chalk";
|
|
18042
18049
|
async function sqlQuery(query, connectionName) {
|
|
18043
18050
|
if (isMutation(query)) {
|
|
18044
18051
|
console.error(
|
|
18045
|
-
|
|
18052
|
+
chalk172.red(
|
|
18046
18053
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
18047
18054
|
)
|
|
18048
18055
|
);
|
|
@@ -18057,7 +18064,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
18057
18064
|
printTable(rows);
|
|
18058
18065
|
} else {
|
|
18059
18066
|
console.log(
|
|
18060
|
-
|
|
18067
|
+
chalk172.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
18061
18068
|
);
|
|
18062
18069
|
}
|
|
18063
18070
|
} finally {
|
|
@@ -18637,14 +18644,14 @@ import {
|
|
|
18637
18644
|
import { dirname as dirname24, join as join50 } from "path";
|
|
18638
18645
|
|
|
18639
18646
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
18640
|
-
import
|
|
18647
|
+
import chalk173 from "chalk";
|
|
18641
18648
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
18642
18649
|
function validateStagedContent(filename, content) {
|
|
18643
18650
|
const firstLine = content.split("\n")[0];
|
|
18644
18651
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
18645
18652
|
if (!match) {
|
|
18646
18653
|
console.error(
|
|
18647
|
-
|
|
18654
|
+
chalk173.red(
|
|
18648
18655
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
18649
18656
|
)
|
|
18650
18657
|
);
|
|
@@ -18653,7 +18660,7 @@ function validateStagedContent(filename, content) {
|
|
|
18653
18660
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
18654
18661
|
if (!contentAfterLink) {
|
|
18655
18662
|
console.error(
|
|
18656
|
-
|
|
18663
|
+
chalk173.red(
|
|
18657
18664
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
18658
18665
|
)
|
|
18659
18666
|
);
|
|
@@ -19055,7 +19062,7 @@ function registerVoice(program2) {
|
|
|
19055
19062
|
|
|
19056
19063
|
// src/commands/roam/auth.ts
|
|
19057
19064
|
import { randomBytes } from "crypto";
|
|
19058
|
-
import
|
|
19065
|
+
import chalk174 from "chalk";
|
|
19059
19066
|
|
|
19060
19067
|
// src/commands/roam/waitForCallback.ts
|
|
19061
19068
|
import { createServer as createServer3 } from "http";
|
|
@@ -19186,13 +19193,13 @@ async function auth() {
|
|
|
19186
19193
|
saveGlobalConfig(config);
|
|
19187
19194
|
const state = randomBytes(16).toString("hex");
|
|
19188
19195
|
console.log(
|
|
19189
|
-
|
|
19196
|
+
chalk174.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
19190
19197
|
);
|
|
19191
|
-
console.log(
|
|
19192
|
-
console.log(
|
|
19193
|
-
console.log(
|
|
19198
|
+
console.log(chalk174.white("http://localhost:14523/callback\n"));
|
|
19199
|
+
console.log(chalk174.blue("Opening browser for authorization..."));
|
|
19200
|
+
console.log(chalk174.dim("Waiting for authorization callback..."));
|
|
19194
19201
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
19195
|
-
console.log(
|
|
19202
|
+
console.log(chalk174.dim("Exchanging code for tokens..."));
|
|
19196
19203
|
const tokens = await exchangeToken({
|
|
19197
19204
|
code,
|
|
19198
19205
|
clientId,
|
|
@@ -19208,7 +19215,7 @@ async function auth() {
|
|
|
19208
19215
|
};
|
|
19209
19216
|
saveGlobalConfig(config);
|
|
19210
19217
|
console.log(
|
|
19211
|
-
|
|
19218
|
+
chalk174.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
19212
19219
|
);
|
|
19213
19220
|
}
|
|
19214
19221
|
|
|
@@ -19660,7 +19667,7 @@ import { execSync as execSync50 } from "child_process";
|
|
|
19660
19667
|
import { existsSync as existsSync51, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync37 } from "fs";
|
|
19661
19668
|
import { tmpdir as tmpdir7 } from "os";
|
|
19662
19669
|
import { join as join61, resolve as resolve15 } from "path";
|
|
19663
|
-
import
|
|
19670
|
+
import chalk175 from "chalk";
|
|
19664
19671
|
|
|
19665
19672
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
19666
19673
|
var captureWindowPs1 = `
|
|
@@ -19811,13 +19818,13 @@ function screenshot(processName) {
|
|
|
19811
19818
|
const config = loadConfig();
|
|
19812
19819
|
const outputDir = resolve15(config.screenshot.outputDir);
|
|
19813
19820
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
19814
|
-
console.log(
|
|
19821
|
+
console.log(chalk175.gray(`Capturing window for process "${processName}" ...`));
|
|
19815
19822
|
try {
|
|
19816
19823
|
runPowerShellScript(processName, outputPath);
|
|
19817
|
-
console.log(
|
|
19824
|
+
console.log(chalk175.green(`Screenshot saved: ${outputPath}`));
|
|
19818
19825
|
} catch (error) {
|
|
19819
19826
|
const msg = error instanceof Error ? error.message : String(error);
|
|
19820
|
-
console.error(
|
|
19827
|
+
console.error(chalk175.red(`Failed to capture screenshot: ${msg}`));
|
|
19821
19828
|
process.exit(1);
|
|
19822
19829
|
}
|
|
19823
19830
|
}
|
|
@@ -21847,7 +21854,7 @@ function registerDaemon(program2) {
|
|
|
21847
21854
|
|
|
21848
21855
|
// src/commands/sessions/summarise/index.ts
|
|
21849
21856
|
import * as fs34 from "fs";
|
|
21850
|
-
import
|
|
21857
|
+
import chalk176 from "chalk";
|
|
21851
21858
|
|
|
21852
21859
|
// src/commands/sessions/summarise/shared.ts
|
|
21853
21860
|
import * as fs32 from "fs";
|
|
@@ -22001,22 +22008,22 @@ ${firstMessage}`);
|
|
|
22001
22008
|
async function summarise3(options2) {
|
|
22002
22009
|
const files = await discoverSessionFiles();
|
|
22003
22010
|
if (files.length === 0) {
|
|
22004
|
-
console.log(
|
|
22011
|
+
console.log(chalk176.yellow("No sessions found."));
|
|
22005
22012
|
return;
|
|
22006
22013
|
}
|
|
22007
22014
|
const toProcess = selectCandidates(files, options2);
|
|
22008
22015
|
if (toProcess.length === 0) {
|
|
22009
|
-
console.log(
|
|
22016
|
+
console.log(chalk176.green("All sessions already summarised."));
|
|
22010
22017
|
return;
|
|
22011
22018
|
}
|
|
22012
22019
|
console.log(
|
|
22013
|
-
|
|
22020
|
+
chalk176.cyan(
|
|
22014
22021
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
22015
22022
|
)
|
|
22016
22023
|
);
|
|
22017
22024
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
22018
22025
|
console.log(
|
|
22019
|
-
|
|
22026
|
+
chalk176.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk176.yellow(`, ${failed2} skipped`) : "")
|
|
22020
22027
|
);
|
|
22021
22028
|
}
|
|
22022
22029
|
function selectCandidates(files, options2) {
|
|
@@ -22036,16 +22043,16 @@ function processSessions(files) {
|
|
|
22036
22043
|
let failed2 = 0;
|
|
22037
22044
|
for (let i = 0; i < files.length; i++) {
|
|
22038
22045
|
const file = files[i];
|
|
22039
|
-
process.stdout.write(
|
|
22046
|
+
process.stdout.write(chalk176.dim(` [${i + 1}/${files.length}] `));
|
|
22040
22047
|
const summary = summariseSession(file);
|
|
22041
22048
|
if (summary) {
|
|
22042
22049
|
writeSummary(file, summary);
|
|
22043
22050
|
succeeded++;
|
|
22044
|
-
process.stdout.write(`${
|
|
22051
|
+
process.stdout.write(`${chalk176.green("\u2713")} ${summary}
|
|
22045
22052
|
`);
|
|
22046
22053
|
} else {
|
|
22047
22054
|
failed2++;
|
|
22048
|
-
process.stdout.write(` ${
|
|
22055
|
+
process.stdout.write(` ${chalk176.yellow("skip")}
|
|
22049
22056
|
`);
|
|
22050
22057
|
}
|
|
22051
22058
|
}
|
|
@@ -22063,10 +22070,10 @@ function registerSessions(program2) {
|
|
|
22063
22070
|
}
|
|
22064
22071
|
|
|
22065
22072
|
// src/commands/statusLine.ts
|
|
22066
|
-
import
|
|
22073
|
+
import chalk178 from "chalk";
|
|
22067
22074
|
|
|
22068
22075
|
// src/commands/buildLimitsSegment.ts
|
|
22069
|
-
import
|
|
22076
|
+
import chalk177 from "chalk";
|
|
22070
22077
|
|
|
22071
22078
|
// src/shared/rateLimitLevel.ts
|
|
22072
22079
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -22097,9 +22104,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
22097
22104
|
|
|
22098
22105
|
// src/commands/buildLimitsSegment.ts
|
|
22099
22106
|
var LEVEL_COLOR = {
|
|
22100
|
-
ok:
|
|
22101
|
-
warn:
|
|
22102
|
-
over:
|
|
22107
|
+
ok: chalk177.green,
|
|
22108
|
+
warn: chalk177.yellow,
|
|
22109
|
+
over: chalk177.red
|
|
22103
22110
|
};
|
|
22104
22111
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
22105
22112
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -22139,14 +22146,14 @@ async function relayRateLimits(rateLimits) {
|
|
|
22139
22146
|
}
|
|
22140
22147
|
|
|
22141
22148
|
// src/commands/statusLine.ts
|
|
22142
|
-
|
|
22149
|
+
chalk178.level = 3;
|
|
22143
22150
|
function formatNumber(num) {
|
|
22144
22151
|
return num.toLocaleString("en-US");
|
|
22145
22152
|
}
|
|
22146
22153
|
function colorizePercent(pct) {
|
|
22147
22154
|
const label2 = `${Math.round(pct)}%`;
|
|
22148
|
-
if (pct > 80) return
|
|
22149
|
-
if (pct > 40) return
|
|
22155
|
+
if (pct > 80) return chalk178.red(label2);
|
|
22156
|
+
if (pct > 40) return chalk178.yellow(label2);
|
|
22150
22157
|
return label2;
|
|
22151
22158
|
}
|
|
22152
22159
|
async function statusLine() {
|
|
@@ -22170,7 +22177,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
22170
22177
|
// src/commands/sync/syncClaudeMd.ts
|
|
22171
22178
|
import * as fs35 from "fs";
|
|
22172
22179
|
import * as path53 from "path";
|
|
22173
|
-
import
|
|
22180
|
+
import chalk179 from "chalk";
|
|
22174
22181
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
22175
22182
|
const source = path53.join(claudeDir, "CLAUDE.md");
|
|
22176
22183
|
const target = path53.join(targetBase, "CLAUDE.md");
|
|
@@ -22179,12 +22186,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
22179
22186
|
const targetContent = fs35.readFileSync(target, "utf8");
|
|
22180
22187
|
if (sourceContent !== targetContent) {
|
|
22181
22188
|
console.log(
|
|
22182
|
-
|
|
22189
|
+
chalk179.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
22183
22190
|
);
|
|
22184
22191
|
console.log();
|
|
22185
22192
|
printDiff(targetContent, sourceContent);
|
|
22186
22193
|
const confirm = options2?.yes || await promptConfirm(
|
|
22187
|
-
|
|
22194
|
+
chalk179.red("Overwrite existing CLAUDE.md?"),
|
|
22188
22195
|
false
|
|
22189
22196
|
);
|
|
22190
22197
|
if (!confirm) {
|
|
@@ -22200,7 +22207,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
22200
22207
|
// src/commands/sync/syncSettings.ts
|
|
22201
22208
|
import * as fs36 from "fs";
|
|
22202
22209
|
import * as path54 from "path";
|
|
22203
|
-
import
|
|
22210
|
+
import chalk180 from "chalk";
|
|
22204
22211
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
22205
22212
|
const source = path54.join(claudeDir, "settings.json");
|
|
22206
22213
|
const target = path54.join(targetBase, "settings.json");
|
|
@@ -22216,14 +22223,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
22216
22223
|
if (mergedContent !== normalizedTarget) {
|
|
22217
22224
|
if (!options2?.yes) {
|
|
22218
22225
|
console.log(
|
|
22219
|
-
|
|
22226
|
+
chalk180.yellow(
|
|
22220
22227
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
22221
22228
|
)
|
|
22222
22229
|
);
|
|
22223
22230
|
console.log();
|
|
22224
22231
|
printDiff(targetContent, mergedContent);
|
|
22225
22232
|
const confirm = await promptConfirm(
|
|
22226
|
-
|
|
22233
|
+
chalk180.red("Overwrite existing settings.json?"),
|
|
22227
22234
|
false
|
|
22228
22235
|
);
|
|
22229
22236
|
if (!confirm) {
|