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