@staff0rd/assist 0.369.0 → 0.370.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/claude/commands/refine.md +1 -1
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +547 -507
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.370.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -7752,13 +7752,52 @@ async function web2(options2) {
|
|
|
7752
7752
|
});
|
|
7753
7753
|
}
|
|
7754
7754
|
|
|
7755
|
+
// src/commands/backlog/addActivity.ts
|
|
7756
|
+
import chalk60 from "chalk";
|
|
7757
|
+
async function addActivity(id2, kind, ref, options2) {
|
|
7758
|
+
const parsedKind = gitRefKindSchema.safeParse(kind);
|
|
7759
|
+
if (!parsedKind.success) {
|
|
7760
|
+
console.log(
|
|
7761
|
+
chalk60.red(
|
|
7762
|
+
`Invalid kind "${kind}". Expected one of: ${gitRefKindSchema.options.join(", ")}.`
|
|
7763
|
+
)
|
|
7764
|
+
);
|
|
7765
|
+
process.exitCode = 1;
|
|
7766
|
+
return;
|
|
7767
|
+
}
|
|
7768
|
+
const found = await findOneItem(id2);
|
|
7769
|
+
if (!found) {
|
|
7770
|
+
process.exitCode = 1;
|
|
7771
|
+
return;
|
|
7772
|
+
}
|
|
7773
|
+
const { orm, item } = found;
|
|
7774
|
+
const url = options2.url ?? (parsedKind.data === "pr" ? void 0 : gitRefUrl(parsedKind.data, ref));
|
|
7775
|
+
await recordGitRef(orm, item.id, {
|
|
7776
|
+
kind: parsedKind.data,
|
|
7777
|
+
ref,
|
|
7778
|
+
title: options2.title,
|
|
7779
|
+
url,
|
|
7780
|
+
state: options2.state
|
|
7781
|
+
});
|
|
7782
|
+
console.log(
|
|
7783
|
+
chalk60.green(`Attached ${parsedKind.data} "${ref}" to item #${id2}.`)
|
|
7784
|
+
);
|
|
7785
|
+
}
|
|
7786
|
+
|
|
7787
|
+
// src/commands/backlog/registerActivityCommands.ts
|
|
7788
|
+
function registerActivityCommands(cmd) {
|
|
7789
|
+
cmd.command("add-activity <id> <kind> <ref>").description(
|
|
7790
|
+
"Attach a git activity ref (branch|commit|pr) to a backlog item"
|
|
7791
|
+
).option("--title <title>", "Title metadata for the ref").option("--url <url>", "URL metadata (auto-filled for branch/commit)").option("--state <state>", "State metadata for the ref").action(addActivity);
|
|
7792
|
+
}
|
|
7793
|
+
|
|
7755
7794
|
// src/commands/backlog/associate-jira/index.ts
|
|
7756
|
-
import
|
|
7795
|
+
import chalk62 from "chalk";
|
|
7757
7796
|
import { eq as eq16 } from "drizzle-orm";
|
|
7758
7797
|
|
|
7759
7798
|
// src/commands/jira/fetchIssue.ts
|
|
7760
7799
|
import { execSync as execSync25 } from "child_process";
|
|
7761
|
-
import
|
|
7800
|
+
import chalk61 from "chalk";
|
|
7762
7801
|
function fetchIssue(issueKey, fields) {
|
|
7763
7802
|
let result;
|
|
7764
7803
|
try {
|
|
@@ -7771,15 +7810,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
7771
7810
|
const stderr = error.stderr;
|
|
7772
7811
|
if (stderr.includes("unauthorized")) {
|
|
7773
7812
|
console.error(
|
|
7774
|
-
|
|
7813
|
+
chalk61.red("Jira authentication expired."),
|
|
7775
7814
|
"Run",
|
|
7776
|
-
|
|
7815
|
+
chalk61.cyan("assist jira auth"),
|
|
7777
7816
|
"to re-authenticate."
|
|
7778
7817
|
);
|
|
7779
7818
|
process.exit(1);
|
|
7780
7819
|
}
|
|
7781
7820
|
}
|
|
7782
|
-
console.error(
|
|
7821
|
+
console.error(chalk61.red(`Failed to fetch ${issueKey}.`));
|
|
7783
7822
|
process.exit(1);
|
|
7784
7823
|
}
|
|
7785
7824
|
return JSON.parse(result);
|
|
@@ -7797,17 +7836,17 @@ async function associateJira(id2, key, options2) {
|
|
|
7797
7836
|
const itemId = found.item.id;
|
|
7798
7837
|
if (options2.clear) {
|
|
7799
7838
|
await orm.update(items).set({ jiraKey: null }).where(eq16(items.id, itemId));
|
|
7800
|
-
console.log(
|
|
7839
|
+
console.log(chalk62.green(`Cleared Jira association on item #${itemId}.`));
|
|
7801
7840
|
return;
|
|
7802
7841
|
}
|
|
7803
7842
|
if (!key) {
|
|
7804
|
-
console.log(
|
|
7843
|
+
console.log(chalk62.red("Provide a Jira key, or use --clear to remove one."));
|
|
7805
7844
|
process.exitCode = 1;
|
|
7806
7845
|
return;
|
|
7807
7846
|
}
|
|
7808
7847
|
if (!JIRA_KEY_PATTERN.test(key)) {
|
|
7809
7848
|
console.log(
|
|
7810
|
-
|
|
7849
|
+
chalk62.red(`Malformed Jira key "${key}". Expected a key like PROJ-123.`)
|
|
7811
7850
|
);
|
|
7812
7851
|
process.exitCode = 1;
|
|
7813
7852
|
return;
|
|
@@ -7817,8 +7856,8 @@ async function associateJira(id2, key, options2) {
|
|
|
7817
7856
|
const summary = fields?.summary;
|
|
7818
7857
|
await orm.update(items).set({ jiraKey: key }).where(eq16(items.id, itemId));
|
|
7819
7858
|
console.log(
|
|
7820
|
-
|
|
7821
|
-
summary ?
|
|
7859
|
+
chalk62.green(`Associated ${key} with item #${itemId}.`),
|
|
7860
|
+
summary ? chalk62.dim(`(${summary})`) : ""
|
|
7822
7861
|
);
|
|
7823
7862
|
}
|
|
7824
7863
|
|
|
@@ -7828,26 +7867,26 @@ function registerAssociateJiraCommand(cmd) {
|
|
|
7828
7867
|
}
|
|
7829
7868
|
|
|
7830
7869
|
// src/commands/backlog/comment/index.ts
|
|
7831
|
-
import
|
|
7870
|
+
import chalk63 from "chalk";
|
|
7832
7871
|
async function comment(id2, text9) {
|
|
7833
7872
|
const found = await findOneItem(id2);
|
|
7834
7873
|
if (!found) process.exit(1);
|
|
7835
7874
|
await appendComment(found.orm, found.item.id, text9);
|
|
7836
|
-
console.log(
|
|
7875
|
+
console.log(chalk63.green(`Comment added to item #${id2}.`));
|
|
7837
7876
|
}
|
|
7838
7877
|
|
|
7839
7878
|
// src/commands/backlog/comments/index.ts
|
|
7840
|
-
import
|
|
7879
|
+
import chalk64 from "chalk";
|
|
7841
7880
|
async function comments2(id2) {
|
|
7842
7881
|
const found = await findOneItem(id2);
|
|
7843
7882
|
if (!found) process.exit(1);
|
|
7844
7883
|
const { item } = found;
|
|
7845
7884
|
const entries = item.comments ?? [];
|
|
7846
7885
|
if (entries.length === 0) {
|
|
7847
|
-
console.log(
|
|
7886
|
+
console.log(chalk64.dim(`No comments on item #${id2}.`));
|
|
7848
7887
|
return;
|
|
7849
7888
|
}
|
|
7850
|
-
console.log(
|
|
7889
|
+
console.log(chalk64.bold(`Comments for #${id2}: ${item.name}
|
|
7851
7890
|
`));
|
|
7852
7891
|
for (const entry of entries) {
|
|
7853
7892
|
console.log(`${formatComment(entry)}
|
|
@@ -7856,7 +7895,7 @@ async function comments2(id2) {
|
|
|
7856
7895
|
}
|
|
7857
7896
|
|
|
7858
7897
|
// src/commands/backlog/delete-comment/index.ts
|
|
7859
|
-
import
|
|
7898
|
+
import chalk65 from "chalk";
|
|
7860
7899
|
async function deleteCommentCmd(id2, commentId) {
|
|
7861
7900
|
const found = await findOneItem(id2);
|
|
7862
7901
|
if (!found) process.exit(1);
|
|
@@ -7868,16 +7907,16 @@ async function deleteCommentCmd(id2, commentId) {
|
|
|
7868
7907
|
switch (outcome) {
|
|
7869
7908
|
case "deleted":
|
|
7870
7909
|
console.log(
|
|
7871
|
-
|
|
7910
|
+
chalk65.green(`Comment #${commentId} deleted from item #${id2}.`)
|
|
7872
7911
|
);
|
|
7873
7912
|
break;
|
|
7874
7913
|
case "not-found":
|
|
7875
|
-
console.log(
|
|
7914
|
+
console.log(chalk65.red(`Comment #${commentId} not found on item #${id2}.`));
|
|
7876
7915
|
process.exit(1);
|
|
7877
7916
|
break;
|
|
7878
7917
|
case "is-summary":
|
|
7879
7918
|
console.log(
|
|
7880
|
-
|
|
7919
|
+
chalk65.red(
|
|
7881
7920
|
`Comment #${commentId} is a phase summary and cannot be deleted.`
|
|
7882
7921
|
)
|
|
7883
7922
|
);
|
|
@@ -7902,7 +7941,7 @@ function registerExportCommand(cmd) {
|
|
|
7902
7941
|
|
|
7903
7942
|
// src/commands/backlog/import/index.ts
|
|
7904
7943
|
import { readFile } from "fs/promises";
|
|
7905
|
-
import
|
|
7944
|
+
import chalk67 from "chalk";
|
|
7906
7945
|
|
|
7907
7946
|
// src/commands/backlog/dump/countCopyRows.ts
|
|
7908
7947
|
function countCopyRows(data) {
|
|
@@ -7974,7 +8013,7 @@ function validateDump({ header, sections }) {
|
|
|
7974
8013
|
}
|
|
7975
8014
|
|
|
7976
8015
|
// src/commands/backlog/import/confirmReplace.ts
|
|
7977
|
-
import
|
|
8016
|
+
import chalk66 from "chalk";
|
|
7978
8017
|
async function countRows(client, table) {
|
|
7979
8018
|
const { rows } = await client.query(
|
|
7980
8019
|
`SELECT count(*)::int AS n FROM ${table}`
|
|
@@ -7985,7 +8024,7 @@ function printSummary(tables, current, incoming) {
|
|
|
7985
8024
|
const lines = tables.map(
|
|
7986
8025
|
(t, i) => ` ${t.name}: ${current[i]} \u2192 ${incoming[i]} rows`
|
|
7987
8026
|
);
|
|
7988
|
-
console.error(
|
|
8027
|
+
console.error(chalk66.bold("\nThis will REPLACE all backlog data:"));
|
|
7989
8028
|
console.error(`${lines.join("\n")}
|
|
7990
8029
|
`);
|
|
7991
8030
|
}
|
|
@@ -8087,13 +8126,13 @@ async function importBacklog(file, options2 = {}) {
|
|
|
8087
8126
|
);
|
|
8088
8127
|
await withDbClient(async (client) => {
|
|
8089
8128
|
if (!options2.yes && !await confirmReplace(client, tables, incoming, !file)) {
|
|
8090
|
-
console.error(
|
|
8129
|
+
console.error(chalk67.yellow("Import cancelled; no changes made."));
|
|
8091
8130
|
return;
|
|
8092
8131
|
}
|
|
8093
8132
|
await restore(client, parsed);
|
|
8094
8133
|
const total = incoming.reduce((sum, n) => sum + n, 0);
|
|
8095
8134
|
console.error(
|
|
8096
|
-
|
|
8135
|
+
chalk67.green(
|
|
8097
8136
|
`Imported backlog: ${total} rows restored across ${tables.length} tables.`
|
|
8098
8137
|
)
|
|
8099
8138
|
);
|
|
@@ -8110,7 +8149,7 @@ function registerImportCommand(cmd) {
|
|
|
8110
8149
|
}
|
|
8111
8150
|
|
|
8112
8151
|
// src/commands/backlog/add/index.ts
|
|
8113
|
-
import
|
|
8152
|
+
import chalk69 from "chalk";
|
|
8114
8153
|
|
|
8115
8154
|
// src/commands/backlog/insertPhaseAt.ts
|
|
8116
8155
|
import { count as count2, eq as eq18 } from "drizzle-orm";
|
|
@@ -8155,11 +8194,11 @@ async function insertSubtask(orm, itemId, title, description) {
|
|
|
8155
8194
|
}
|
|
8156
8195
|
|
|
8157
8196
|
// src/commands/backlog/ensureRemoteOrigin.ts
|
|
8158
|
-
import
|
|
8197
|
+
import chalk68 from "chalk";
|
|
8159
8198
|
function ensureRemoteOrigin() {
|
|
8160
8199
|
if (getRemoteOriginUrl(getBacklogDir())) return true;
|
|
8161
8200
|
console.log(
|
|
8162
|
-
|
|
8201
|
+
chalk68.red(
|
|
8163
8202
|
"Backlog requires a git remote so items get a stable origin.\nAdd one with: git remote add origin <url>"
|
|
8164
8203
|
)
|
|
8165
8204
|
);
|
|
@@ -8263,14 +8302,14 @@ async function add(options2) {
|
|
|
8263
8302
|
for (const subtask of loadConfig().subtasks ?? []) {
|
|
8264
8303
|
await insertSubtask(orm, id2, subtask.title, subtask.description);
|
|
8265
8304
|
}
|
|
8266
|
-
console.log(
|
|
8305
|
+
console.log(chalk69.green(`Added item #${id2}: ${name}`));
|
|
8267
8306
|
}
|
|
8268
8307
|
|
|
8269
8308
|
// src/commands/backlog/addPhase.ts
|
|
8270
|
-
import
|
|
8309
|
+
import chalk71 from "chalk";
|
|
8271
8310
|
|
|
8272
8311
|
// src/commands/backlog/resolveInsertPosition.ts
|
|
8273
|
-
import
|
|
8312
|
+
import chalk70 from "chalk";
|
|
8274
8313
|
import { count as count3, eq as eq19 } from "drizzle-orm";
|
|
8275
8314
|
async function resolveInsertPosition(orm, itemId, position) {
|
|
8276
8315
|
const [row] = await orm.select({ cnt: count3() }).from(planPhases).where(eq19(planPhases.itemId, itemId));
|
|
@@ -8279,7 +8318,7 @@ async function resolveInsertPosition(orm, itemId, position) {
|
|
|
8279
8318
|
const pos = Number.parseInt(position, 10);
|
|
8280
8319
|
if (pos < 1 || pos > phaseCount + 1) {
|
|
8281
8320
|
console.log(
|
|
8282
|
-
|
|
8321
|
+
chalk70.red(
|
|
8283
8322
|
`Position ${pos} is out of range. Must be between 1 and ${phaseCount + 1}.`
|
|
8284
8323
|
)
|
|
8285
8324
|
);
|
|
@@ -8301,7 +8340,7 @@ async function addPhase(id2, name, options2) {
|
|
|
8301
8340
|
if (!found) return;
|
|
8302
8341
|
const tasks = options2.task ?? [];
|
|
8303
8342
|
if (tasks.length === 0) {
|
|
8304
|
-
console.log(
|
|
8343
|
+
console.log(chalk71.red("At least one --task is required."));
|
|
8305
8344
|
process.exitCode = 1;
|
|
8306
8345
|
return;
|
|
8307
8346
|
}
|
|
@@ -8320,14 +8359,14 @@ async function addPhase(id2, name, options2) {
|
|
|
8320
8359
|
);
|
|
8321
8360
|
const verb = options2.position !== void 0 ? "Inserted" : "Added";
|
|
8322
8361
|
console.log(
|
|
8323
|
-
|
|
8362
|
+
chalk71.green(
|
|
8324
8363
|
`${verb} phase ${phaseIdx + 1} "${name}" to item #${itemId} with ${tasks.length} task(s).`
|
|
8325
8364
|
)
|
|
8326
8365
|
);
|
|
8327
8366
|
}
|
|
8328
8367
|
|
|
8329
8368
|
// src/commands/backlog/list/index.ts
|
|
8330
|
-
import
|
|
8369
|
+
import chalk72 from "chalk";
|
|
8331
8370
|
function filterItems(items2, options2) {
|
|
8332
8371
|
if (options2.status) return items2.filter((i) => i.status === options2.status);
|
|
8333
8372
|
if (!options2.all)
|
|
@@ -8338,7 +8377,7 @@ async function list2(options2) {
|
|
|
8338
8377
|
const allItems = await loadBacklog(options2.allRepos);
|
|
8339
8378
|
const items2 = filterItems(allItems, options2);
|
|
8340
8379
|
if (items2.length === 0) {
|
|
8341
|
-
console.log(
|
|
8380
|
+
console.log(chalk72.dim("Backlog is empty."));
|
|
8342
8381
|
return;
|
|
8343
8382
|
}
|
|
8344
8383
|
const labels = originDisplayLabels(
|
|
@@ -8347,9 +8386,9 @@ async function list2(options2) {
|
|
|
8347
8386
|
const repoNameOf = (item) => item.origin ? labels.get(item.origin) ?? "" : "";
|
|
8348
8387
|
const prefixWidth = options2.allRepos ? Math.max(0, ...items2.map((i) => repoNameOf(i).length)) : 0;
|
|
8349
8388
|
for (const item of items2) {
|
|
8350
|
-
const repoPrefix = options2.allRepos ? `${
|
|
8389
|
+
const repoPrefix = options2.allRepos ? `${chalk72.dim(repoNameOf(item).padEnd(prefixWidth))} ` : "";
|
|
8351
8390
|
console.log(
|
|
8352
|
-
`${repoPrefix}${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
8391
|
+
`${repoPrefix}${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk72.dim(`#${item.id}`)} ${starMarker(item)}${item.name}${phaseLabel(item)}${dependencyLabel(item, allItems)}`
|
|
8353
8392
|
);
|
|
8354
8393
|
if (options2.verbose) {
|
|
8355
8394
|
printVerboseDetails(item);
|
|
@@ -8378,7 +8417,7 @@ function registerItemCommands(cmd) {
|
|
|
8378
8417
|
}
|
|
8379
8418
|
|
|
8380
8419
|
// src/commands/backlog/link.ts
|
|
8381
|
-
import
|
|
8420
|
+
import chalk74 from "chalk";
|
|
8382
8421
|
|
|
8383
8422
|
// src/commands/backlog/hasCycle.ts
|
|
8384
8423
|
function hasCycle(adjacency, fromId, toId) {
|
|
@@ -8410,14 +8449,14 @@ async function loadDependencyGraph(orm) {
|
|
|
8410
8449
|
}
|
|
8411
8450
|
|
|
8412
8451
|
// src/commands/backlog/validateLinkTarget.ts
|
|
8413
|
-
import
|
|
8452
|
+
import chalk73 from "chalk";
|
|
8414
8453
|
function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
8415
8454
|
const duplicate = (fromItem.links ?? []).some(
|
|
8416
8455
|
(l) => l.targetId === toNum && l.type === linkType
|
|
8417
8456
|
);
|
|
8418
8457
|
if (duplicate) {
|
|
8419
8458
|
console.log(
|
|
8420
|
-
|
|
8459
|
+
chalk73.yellow(`Link already exists: #${fromNum} ${linkType} #${toNum}`)
|
|
8421
8460
|
);
|
|
8422
8461
|
return false;
|
|
8423
8462
|
}
|
|
@@ -8426,7 +8465,7 @@ function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
|
8426
8465
|
|
|
8427
8466
|
// src/commands/backlog/link.ts
|
|
8428
8467
|
function fail2(message) {
|
|
8429
|
-
console.log(
|
|
8468
|
+
console.log(chalk74.red(message));
|
|
8430
8469
|
return void 0;
|
|
8431
8470
|
}
|
|
8432
8471
|
function parseLinkType(type) {
|
|
@@ -8456,12 +8495,12 @@ async function link(fromId, toId, opts) {
|
|
|
8456
8495
|
if (await createsCycle(orm, linkType, fromNum, toNum)) return;
|
|
8457
8496
|
await orm.insert(links).values({ itemId: fromNum, type: linkType, targetId: toNum });
|
|
8458
8497
|
console.log(
|
|
8459
|
-
|
|
8498
|
+
chalk74.green(`Linked #${fromNum} ${linkType} #${toNum} (${toItem.name})`)
|
|
8460
8499
|
);
|
|
8461
8500
|
}
|
|
8462
8501
|
|
|
8463
8502
|
// src/commands/backlog/unlink.ts
|
|
8464
|
-
import
|
|
8503
|
+
import chalk75 from "chalk";
|
|
8465
8504
|
import { and as and7, eq as eq21 } from "drizzle-orm";
|
|
8466
8505
|
async function unlink(fromId, toId) {
|
|
8467
8506
|
const fromNum = Number.parseInt(fromId, 10);
|
|
@@ -8469,19 +8508,19 @@ async function unlink(fromId, toId) {
|
|
|
8469
8508
|
const { orm } = await getReady();
|
|
8470
8509
|
const fromItem = await loadItem(orm, fromNum);
|
|
8471
8510
|
if (!fromItem) {
|
|
8472
|
-
console.log(
|
|
8511
|
+
console.log(chalk75.red(`Item #${fromId} not found.`));
|
|
8473
8512
|
return;
|
|
8474
8513
|
}
|
|
8475
8514
|
if (!fromItem.links || fromItem.links.length === 0) {
|
|
8476
|
-
console.log(
|
|
8515
|
+
console.log(chalk75.yellow(`No links found on item #${fromId}.`));
|
|
8477
8516
|
return;
|
|
8478
8517
|
}
|
|
8479
8518
|
if (!fromItem.links.some((l) => l.targetId === toNum)) {
|
|
8480
|
-
console.log(
|
|
8519
|
+
console.log(chalk75.yellow(`No link from #${fromId} to #${toId} found.`));
|
|
8481
8520
|
return;
|
|
8482
8521
|
}
|
|
8483
8522
|
await orm.delete(links).where(and7(eq21(links.itemId, fromNum), eq21(links.targetId, toNum)));
|
|
8484
|
-
console.log(
|
|
8523
|
+
console.log(chalk75.green(`Removed link from #${fromId} to #${toId}.`));
|
|
8485
8524
|
}
|
|
8486
8525
|
|
|
8487
8526
|
// src/commands/backlog/registerLinkCommands.ts
|
|
@@ -8495,17 +8534,17 @@ function registerLinkCommands(cmd) {
|
|
|
8495
8534
|
}
|
|
8496
8535
|
|
|
8497
8536
|
// src/commands/backlog/move-repo/index.ts
|
|
8498
|
-
import
|
|
8537
|
+
import chalk77 from "chalk";
|
|
8499
8538
|
import { eq as eq23 } from "drizzle-orm";
|
|
8500
8539
|
|
|
8501
8540
|
// src/commands/backlog/move-repo/confirmMove.ts
|
|
8502
|
-
import
|
|
8541
|
+
import chalk76 from "chalk";
|
|
8503
8542
|
function pluralItems(n) {
|
|
8504
8543
|
return `${n} item${n === 1 ? "" : "s"}`;
|
|
8505
8544
|
}
|
|
8506
8545
|
async function confirmMove(cnt, oldOrigin, newOrigin) {
|
|
8507
8546
|
console.log(
|
|
8508
|
-
`${pluralItems(cnt)}: ${
|
|
8547
|
+
`${pluralItems(cnt)}: ${chalk76.cyan(oldOrigin)} \u2192 ${chalk76.cyan(newOrigin)}`
|
|
8509
8548
|
);
|
|
8510
8549
|
return promptConfirm(`Retag ${pluralItems(cnt)}?`);
|
|
8511
8550
|
}
|
|
@@ -8537,7 +8576,7 @@ Pass the full origin.`
|
|
|
8537
8576
|
|
|
8538
8577
|
// src/commands/backlog/move-repo/index.ts
|
|
8539
8578
|
function fail3(message) {
|
|
8540
|
-
console.log(
|
|
8579
|
+
console.log(chalk77.red(message));
|
|
8541
8580
|
process.exitCode = 1;
|
|
8542
8581
|
}
|
|
8543
8582
|
async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
@@ -8553,12 +8592,12 @@ async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
|
8553
8592
|
}
|
|
8554
8593
|
const cnt = await countByOrigin(orm, oldOrigin);
|
|
8555
8594
|
if (!options2.yes && !await confirmMove(cnt, oldOrigin, newOrigin)) {
|
|
8556
|
-
console.log(
|
|
8595
|
+
console.log(chalk77.yellow("Move cancelled; no changes made."));
|
|
8557
8596
|
return;
|
|
8558
8597
|
}
|
|
8559
8598
|
await orm.update(items).set({ origin: newOrigin }).where(eq23(items.origin, oldOrigin));
|
|
8560
8599
|
console.log(
|
|
8561
|
-
|
|
8600
|
+
chalk77.green(
|
|
8562
8601
|
`Moved ${pluralItems(cnt)} from "${oldOrigin}" to "${newOrigin}".`
|
|
8563
8602
|
)
|
|
8564
8603
|
);
|
|
@@ -8587,14 +8626,14 @@ function registerPlanCommands(cmd) {
|
|
|
8587
8626
|
}
|
|
8588
8627
|
|
|
8589
8628
|
// src/commands/backlog/refine.ts
|
|
8590
|
-
import
|
|
8629
|
+
import chalk80 from "chalk";
|
|
8591
8630
|
import enquirer7 from "enquirer";
|
|
8592
8631
|
|
|
8593
8632
|
// src/commands/backlog/launchMode.ts
|
|
8594
8633
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
8595
8634
|
|
|
8596
8635
|
// src/commands/backlog/handleLaunchSignal.ts
|
|
8597
|
-
import
|
|
8636
|
+
import chalk79 from "chalk";
|
|
8598
8637
|
|
|
8599
8638
|
// src/commands/backlog/surfaceCreatedItem.ts
|
|
8600
8639
|
async function surfaceCreatedItem(slashCommand, id2) {
|
|
@@ -8612,31 +8651,31 @@ async function surfaceCreatedItem(slashCommand, id2) {
|
|
|
8612
8651
|
}
|
|
8613
8652
|
|
|
8614
8653
|
// src/commands/backlog/tryRunById.ts
|
|
8615
|
-
import
|
|
8654
|
+
import chalk78 from "chalk";
|
|
8616
8655
|
async function tryRunById(id2, options2) {
|
|
8617
8656
|
const numericId = Number.parseInt(id2, 10);
|
|
8618
8657
|
const { orm } = await getReady();
|
|
8619
8658
|
const item = Number.isNaN(numericId) ? void 0 : await loadItem(orm, numericId);
|
|
8620
8659
|
if (!item) {
|
|
8621
|
-
console.log(
|
|
8660
|
+
console.log(chalk78.red(`Item #${id2} not found.`));
|
|
8622
8661
|
return false;
|
|
8623
8662
|
}
|
|
8624
8663
|
if (item.status === "done") {
|
|
8625
|
-
console.log(
|
|
8664
|
+
console.log(chalk78.red(`Item #${id2} is already done.`));
|
|
8626
8665
|
return false;
|
|
8627
8666
|
}
|
|
8628
8667
|
if (item.status === "wontdo") {
|
|
8629
|
-
console.log(
|
|
8668
|
+
console.log(chalk78.red(`Item #${id2} is marked won't do.`));
|
|
8630
8669
|
return false;
|
|
8631
8670
|
}
|
|
8632
8671
|
const hasDeps = (item.links ?? []).some((l) => l.type === "depends-on");
|
|
8633
8672
|
if (hasDeps && isBlocked(item, await loadItemSummaries(orm, getOrigin()))) {
|
|
8634
8673
|
console.log(
|
|
8635
|
-
|
|
8674
|
+
chalk78.red(`Item #${id2} is blocked by unresolved dependencies.`)
|
|
8636
8675
|
);
|
|
8637
8676
|
return false;
|
|
8638
8677
|
}
|
|
8639
|
-
console.log(
|
|
8678
|
+
console.log(chalk78.bold(`
|
|
8640
8679
|
Running backlog item #${id2}...
|
|
8641
8680
|
`));
|
|
8642
8681
|
await run2(id2, options2);
|
|
@@ -8654,7 +8693,7 @@ async function handleLaunchSignal(slashCommand, once) {
|
|
|
8654
8693
|
if (typeof signal.id === "string" && signal.id) {
|
|
8655
8694
|
if (await tryRunById(signal.id, { allowEdits: true })) return;
|
|
8656
8695
|
}
|
|
8657
|
-
console.log(
|
|
8696
|
+
console.log(chalk79.bold("\nChaining into assist next...\n"));
|
|
8658
8697
|
await next({ allowEdits: true, once });
|
|
8659
8698
|
}
|
|
8660
8699
|
}
|
|
@@ -8695,12 +8734,12 @@ async function pickItemForRefine() {
|
|
|
8695
8734
|
(i) => i.status === "todo" || i.status === "in-progress"
|
|
8696
8735
|
);
|
|
8697
8736
|
if (active.length === 0) {
|
|
8698
|
-
console.log(
|
|
8737
|
+
console.log(chalk80.yellow("No active backlog items to refine."));
|
|
8699
8738
|
return void 0;
|
|
8700
8739
|
}
|
|
8701
8740
|
if (active.length === 1) {
|
|
8702
8741
|
const item = active[0];
|
|
8703
|
-
console.log(
|
|
8742
|
+
console.log(chalk80.bold(`Auto-selecting item #${item.id}: ${item.name}`));
|
|
8704
8743
|
return String(item.id);
|
|
8705
8744
|
}
|
|
8706
8745
|
const { selected } = await exitOnCancel(
|
|
@@ -8735,23 +8774,23 @@ function registerRefineCommand(cmd) {
|
|
|
8735
8774
|
}
|
|
8736
8775
|
|
|
8737
8776
|
// src/commands/backlog/rewindPhase.ts
|
|
8738
|
-
import
|
|
8777
|
+
import chalk81 from "chalk";
|
|
8739
8778
|
async function rewindPhase(id2, phase, opts) {
|
|
8740
8779
|
const phaseNumber = Number.parseInt(phase, 10);
|
|
8741
8780
|
const { orm } = await getReady();
|
|
8742
8781
|
const item = await loadItem(orm, Number.parseInt(id2, 10));
|
|
8743
8782
|
if (!item) {
|
|
8744
|
-
console.log(
|
|
8783
|
+
console.log(chalk81.red(`Item #${id2} not found.`));
|
|
8745
8784
|
return;
|
|
8746
8785
|
}
|
|
8747
8786
|
const result = await rewindItemToPhase(orm, item, phaseNumber, opts.reason);
|
|
8748
8787
|
if (!result.ok) {
|
|
8749
|
-
console.log(
|
|
8788
|
+
console.log(chalk81.red(result.error));
|
|
8750
8789
|
process.exitCode = 1;
|
|
8751
8790
|
return;
|
|
8752
8791
|
}
|
|
8753
8792
|
console.log(
|
|
8754
|
-
|
|
8793
|
+
chalk81.green(
|
|
8755
8794
|
`Rewound item #${id2} to phase ${phaseNumber} (${result.phaseName}).`
|
|
8756
8795
|
)
|
|
8757
8796
|
);
|
|
@@ -8779,22 +8818,22 @@ function registerRunCommand(cmd) {
|
|
|
8779
8818
|
}
|
|
8780
8819
|
|
|
8781
8820
|
// src/commands/backlog/search/index.ts
|
|
8782
|
-
import
|
|
8821
|
+
import chalk82 from "chalk";
|
|
8783
8822
|
async function search(query) {
|
|
8784
8823
|
const items2 = await searchBacklog(query);
|
|
8785
8824
|
if (items2.length === 0) {
|
|
8786
|
-
console.log(
|
|
8825
|
+
console.log(chalk82.dim(`No items matching "${query}".`));
|
|
8787
8826
|
return;
|
|
8788
8827
|
}
|
|
8789
8828
|
console.log(
|
|
8790
|
-
|
|
8829
|
+
chalk82.dim(
|
|
8791
8830
|
`${items2.length} item${items2.length === 1 ? "" : "s"} matching "${query}":
|
|
8792
8831
|
`
|
|
8793
8832
|
)
|
|
8794
8833
|
);
|
|
8795
8834
|
for (const item of items2) {
|
|
8796
8835
|
console.log(
|
|
8797
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
8836
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk82.dim(`#${item.id}`)} ${item.name}`
|
|
8798
8837
|
);
|
|
8799
8838
|
}
|
|
8800
8839
|
}
|
|
@@ -8805,16 +8844,16 @@ function registerSearchCommand(cmd) {
|
|
|
8805
8844
|
}
|
|
8806
8845
|
|
|
8807
8846
|
// src/commands/backlog/delete/index.ts
|
|
8808
|
-
import
|
|
8847
|
+
import chalk83 from "chalk";
|
|
8809
8848
|
async function del(id2) {
|
|
8810
8849
|
const name = await removeItem(id2);
|
|
8811
8850
|
if (name) {
|
|
8812
|
-
console.log(
|
|
8851
|
+
console.log(chalk83.green(`Deleted item #${id2}: ${name}`));
|
|
8813
8852
|
}
|
|
8814
8853
|
}
|
|
8815
8854
|
|
|
8816
8855
|
// src/commands/backlog/done/index.ts
|
|
8817
|
-
import
|
|
8856
|
+
import chalk84 from "chalk";
|
|
8818
8857
|
async function done(id2, summary) {
|
|
8819
8858
|
const found = await findOneItem(id2);
|
|
8820
8859
|
if (!found) return;
|
|
@@ -8828,12 +8867,12 @@ async function done(id2, summary) {
|
|
|
8828
8867
|
const pending = item.plan.slice(completedCount);
|
|
8829
8868
|
if (pending.length > 0) {
|
|
8830
8869
|
console.log(
|
|
8831
|
-
|
|
8870
|
+
chalk84.red(
|
|
8832
8871
|
`Cannot complete item #${id2}: ${pending.length} pending phase(s):`
|
|
8833
8872
|
)
|
|
8834
8873
|
);
|
|
8835
8874
|
for (const phase of pending) {
|
|
8836
|
-
console.log(
|
|
8875
|
+
console.log(chalk84.yellow(` - ${phase.name}`));
|
|
8837
8876
|
}
|
|
8838
8877
|
process.exitCode = 1;
|
|
8839
8878
|
return;
|
|
@@ -8844,11 +8883,11 @@ async function done(id2, summary) {
|
|
|
8844
8883
|
const phase = item.currentPhase ?? 1;
|
|
8845
8884
|
await appendComment(orm, item.id, summary, { phase, type: "summary" });
|
|
8846
8885
|
}
|
|
8847
|
-
console.log(
|
|
8886
|
+
console.log(chalk84.green(`Completed item #${id2}: ${item.name}`));
|
|
8848
8887
|
}
|
|
8849
8888
|
|
|
8850
8889
|
// src/commands/backlog/set-status/index.ts
|
|
8851
|
-
import
|
|
8890
|
+
import chalk85 from "chalk";
|
|
8852
8891
|
var allowedStatuses = [
|
|
8853
8892
|
"todo",
|
|
8854
8893
|
"in-progress",
|
|
@@ -8858,7 +8897,7 @@ var allowedStatuses = [
|
|
|
8858
8897
|
async function setStatusCommand(id2, status2) {
|
|
8859
8898
|
if (!allowedStatuses.includes(status2)) {
|
|
8860
8899
|
console.log(
|
|
8861
|
-
|
|
8900
|
+
chalk85.red(
|
|
8862
8901
|
`Invalid status "${status2}". Must be one of: ${allowedStatuses.join(", ")}.`
|
|
8863
8902
|
)
|
|
8864
8903
|
);
|
|
@@ -8867,19 +8906,19 @@ async function setStatusCommand(id2, status2) {
|
|
|
8867
8906
|
}
|
|
8868
8907
|
const name = await setStatus(id2, status2);
|
|
8869
8908
|
if (name) {
|
|
8870
|
-
console.log(
|
|
8909
|
+
console.log(chalk85.green(`Set item #${id2} to ${status2}: ${name}`));
|
|
8871
8910
|
}
|
|
8872
8911
|
}
|
|
8873
8912
|
|
|
8874
8913
|
// src/commands/backlog/star/index.ts
|
|
8875
|
-
import
|
|
8914
|
+
import chalk87 from "chalk";
|
|
8876
8915
|
|
|
8877
8916
|
// src/commands/backlog/setStarred.ts
|
|
8878
|
-
import
|
|
8917
|
+
import chalk86 from "chalk";
|
|
8879
8918
|
async function setStarred(id2, starred) {
|
|
8880
8919
|
const { orm } = await getReady();
|
|
8881
8920
|
const name = await updateStarred(orm, Number.parseInt(id2, 10), starred);
|
|
8882
|
-
if (name === void 0) console.log(
|
|
8921
|
+
if (name === void 0) console.log(chalk86.red(`Item #${id2} not found.`));
|
|
8883
8922
|
return name;
|
|
8884
8923
|
}
|
|
8885
8924
|
|
|
@@ -8887,45 +8926,45 @@ async function setStarred(id2, starred) {
|
|
|
8887
8926
|
async function star(id2) {
|
|
8888
8927
|
const name = await setStarred(id2, true);
|
|
8889
8928
|
if (name) {
|
|
8890
|
-
console.log(
|
|
8929
|
+
console.log(chalk87.green(`Starred item #${id2}: ${name}`));
|
|
8891
8930
|
}
|
|
8892
8931
|
}
|
|
8893
8932
|
|
|
8894
8933
|
// src/commands/backlog/start/index.ts
|
|
8895
|
-
import
|
|
8934
|
+
import chalk88 from "chalk";
|
|
8896
8935
|
async function start(id2) {
|
|
8897
8936
|
const name = await setStatus(id2, "in-progress");
|
|
8898
8937
|
if (name) {
|
|
8899
|
-
console.log(
|
|
8938
|
+
console.log(chalk88.green(`Started item #${id2}: ${name}`));
|
|
8900
8939
|
}
|
|
8901
8940
|
}
|
|
8902
8941
|
|
|
8903
8942
|
// src/commands/backlog/stop/index.ts
|
|
8904
|
-
import
|
|
8943
|
+
import chalk89 from "chalk";
|
|
8905
8944
|
import { and as and8, eq as eq24 } from "drizzle-orm";
|
|
8906
8945
|
async function stop() {
|
|
8907
8946
|
const { orm } = await getReady();
|
|
8908
8947
|
const stopped = await orm.update(items).set({ status: "todo", currentPhase: 1 }).where(and8(eq24(items.status, "in-progress"), eq24(items.origin, getOrigin()))).returning({ id: items.id, name: items.name });
|
|
8909
8948
|
if (stopped.length === 0) {
|
|
8910
|
-
console.log(
|
|
8949
|
+
console.log(chalk89.yellow("No in-progress items to stop."));
|
|
8911
8950
|
return;
|
|
8912
8951
|
}
|
|
8913
8952
|
for (const item of stopped) {
|
|
8914
|
-
console.log(
|
|
8953
|
+
console.log(chalk89.yellow(`Stopped item #${item.id}: ${item.name}`));
|
|
8915
8954
|
}
|
|
8916
8955
|
}
|
|
8917
8956
|
|
|
8918
8957
|
// src/commands/backlog/unstar/index.ts
|
|
8919
|
-
import
|
|
8958
|
+
import chalk90 from "chalk";
|
|
8920
8959
|
async function unstar(id2) {
|
|
8921
8960
|
const name = await setStarred(id2, false);
|
|
8922
8961
|
if (name) {
|
|
8923
|
-
console.log(
|
|
8962
|
+
console.log(chalk90.green(`Unstarred item #${id2}: ${name}`));
|
|
8924
8963
|
}
|
|
8925
8964
|
}
|
|
8926
8965
|
|
|
8927
8966
|
// src/commands/backlog/wontdo/index.ts
|
|
8928
|
-
import
|
|
8967
|
+
import chalk91 from "chalk";
|
|
8929
8968
|
async function wontdo(id2, reason) {
|
|
8930
8969
|
const found = await findOneItem(id2);
|
|
8931
8970
|
if (!found) return;
|
|
@@ -8935,7 +8974,7 @@ async function wontdo(id2, reason) {
|
|
|
8935
8974
|
const phase = item.currentPhase ?? 1;
|
|
8936
8975
|
await appendComment(orm, item.id, reason, { phase, type: "summary" });
|
|
8937
8976
|
}
|
|
8938
|
-
console.log(
|
|
8977
|
+
console.log(chalk91.red(`Won't do item #${id2}: ${item.name}`));
|
|
8939
8978
|
}
|
|
8940
8979
|
|
|
8941
8980
|
// src/commands/backlog/registerStatusCommands.ts
|
|
@@ -8953,17 +8992,17 @@ function registerStatusCommands(cmd) {
|
|
|
8953
8992
|
}
|
|
8954
8993
|
|
|
8955
8994
|
// src/commands/backlog/addSubtask.ts
|
|
8956
|
-
import
|
|
8995
|
+
import chalk92 from "chalk";
|
|
8957
8996
|
async function addSubtask(id2, options2) {
|
|
8958
8997
|
const title = options2.title?.trim();
|
|
8959
8998
|
if (!title) {
|
|
8960
|
-
console.log(
|
|
8999
|
+
console.log(chalk92.red("A sub-task title is required (--title)."));
|
|
8961
9000
|
process.exitCode = 1;
|
|
8962
9001
|
return;
|
|
8963
9002
|
}
|
|
8964
9003
|
if (title.length > 50) {
|
|
8965
9004
|
console.log(
|
|
8966
|
-
|
|
9005
|
+
chalk92.red(
|
|
8967
9006
|
"A sub-task title must be 50 characters or fewer. Use --desc for longer detail."
|
|
8968
9007
|
)
|
|
8969
9008
|
);
|
|
@@ -8978,20 +9017,20 @@ async function addSubtask(id2, options2) {
|
|
|
8978
9017
|
const { orm, item } = found;
|
|
8979
9018
|
const description = options2.desc?.replaceAll(String.raw`\n`, "\n");
|
|
8980
9019
|
await insertSubtask(orm, item.id, title, description);
|
|
8981
|
-
console.log(
|
|
9020
|
+
console.log(chalk92.green(`Added sub-task to item #${id2}: ${title}`));
|
|
8982
9021
|
}
|
|
8983
9022
|
|
|
8984
9023
|
// src/commands/backlog/editSubtask.ts
|
|
8985
|
-
import
|
|
9024
|
+
import chalk94 from "chalk";
|
|
8986
9025
|
|
|
8987
9026
|
// src/commands/backlog/resolveSubtaskIndex.ts
|
|
8988
|
-
import
|
|
9027
|
+
import chalk93 from "chalk";
|
|
8989
9028
|
function resolveSubtaskIndex(id2, index3, item) {
|
|
8990
9029
|
const position = Number.parseInt(index3, 10);
|
|
8991
9030
|
const subtasks = item.subtasks ?? [];
|
|
8992
9031
|
if (Number.isNaN(position) || position < 1 || position > subtasks.length) {
|
|
8993
9032
|
console.log(
|
|
8994
|
-
|
|
9033
|
+
chalk93.red(
|
|
8995
9034
|
`Item #${id2} has no sub-task ${index3}${subtasks.length > 0 ? ` (1-${subtasks.length})` : ""}.`
|
|
8996
9035
|
)
|
|
8997
9036
|
);
|
|
@@ -9058,19 +9097,19 @@ async function editSubtask(id2, index3, options2) {
|
|
|
9058
9097
|
if (!found) return;
|
|
9059
9098
|
const fields = buildUpdate(options2);
|
|
9060
9099
|
if (typeof fields === "string") {
|
|
9061
|
-
console.log(
|
|
9100
|
+
console.log(chalk94.red(fields));
|
|
9062
9101
|
process.exitCode = 1;
|
|
9063
9102
|
return;
|
|
9064
9103
|
}
|
|
9065
9104
|
const { orm, item, idx } = found;
|
|
9066
9105
|
const title = await updateSubtask(orm, item.id, idx, fields);
|
|
9067
9106
|
console.log(
|
|
9068
|
-
|
|
9107
|
+
chalk94.green(`Updated sub-task ${idx + 1} of item #${id2}: ${title}`)
|
|
9069
9108
|
);
|
|
9070
9109
|
}
|
|
9071
9110
|
|
|
9072
9111
|
// src/commands/backlog/removeSubtask.ts
|
|
9073
|
-
import
|
|
9112
|
+
import chalk95 from "chalk";
|
|
9074
9113
|
|
|
9075
9114
|
// src/commands/backlog/deleteSubtask.ts
|
|
9076
9115
|
import { and as and10, asc as asc6, eq as eq26 } from "drizzle-orm";
|
|
@@ -9095,16 +9134,16 @@ async function removeSubtask(id2, index3) {
|
|
|
9095
9134
|
const { orm, item, idx } = found;
|
|
9096
9135
|
const title = await deleteSubtask(orm, item.id, idx);
|
|
9097
9136
|
console.log(
|
|
9098
|
-
|
|
9137
|
+
chalk95.green(`Removed sub-task ${idx + 1} of item #${id2}: ${title}`)
|
|
9099
9138
|
);
|
|
9100
9139
|
}
|
|
9101
9140
|
|
|
9102
9141
|
// src/commands/backlog/subtaskStatus.ts
|
|
9103
|
-
import
|
|
9142
|
+
import chalk96 from "chalk";
|
|
9104
9143
|
async function subtaskStatus(id2, index3, status2) {
|
|
9105
9144
|
if (!validSubtaskStatuses.includes(status2)) {
|
|
9106
9145
|
console.log(
|
|
9107
|
-
|
|
9146
|
+
chalk96.red(
|
|
9108
9147
|
`Invalid status "${status2}". Use one of: ${validSubtaskStatuses.join(", ")}.`
|
|
9109
9148
|
)
|
|
9110
9149
|
);
|
|
@@ -9121,7 +9160,7 @@ async function subtaskStatus(id2, index3, status2) {
|
|
|
9121
9160
|
status2
|
|
9122
9161
|
);
|
|
9123
9162
|
console.log(
|
|
9124
|
-
|
|
9163
|
+
chalk96.green(
|
|
9125
9164
|
`Set sub-task ${idx + 1} of item #${id2} to ${status2}: ${title}`
|
|
9126
9165
|
)
|
|
9127
9166
|
);
|
|
@@ -9148,7 +9187,7 @@ function registerSubtaskCommands(cmd) {
|
|
|
9148
9187
|
}
|
|
9149
9188
|
|
|
9150
9189
|
// src/commands/backlog/movePhase.ts
|
|
9151
|
-
import
|
|
9190
|
+
import chalk97 from "chalk";
|
|
9152
9191
|
import { count as count6, eq as eq29 } from "drizzle-orm";
|
|
9153
9192
|
|
|
9154
9193
|
// src/commands/backlog/reorderPhaseRows.ts
|
|
@@ -9214,7 +9253,7 @@ function toIndex(value, phaseCount) {
|
|
|
9214
9253
|
const pos = Number.parseInt(value, 10);
|
|
9215
9254
|
if (Number.isNaN(pos) || pos < 1 || pos > phaseCount) {
|
|
9216
9255
|
console.log(
|
|
9217
|
-
|
|
9256
|
+
chalk97.red(
|
|
9218
9257
|
`Position "${value}" is out of range. Must be between 1 and ${phaseCount}.`
|
|
9219
9258
|
)
|
|
9220
9259
|
);
|
|
@@ -9237,11 +9276,11 @@ async function movePhase(id2, from, to) {
|
|
|
9237
9276
|
if (fromIdx !== toIdx) {
|
|
9238
9277
|
await reorderPhaseRows(orm, itemId, fromIdx, toIdx);
|
|
9239
9278
|
}
|
|
9240
|
-
console.log(
|
|
9279
|
+
console.log(chalk97.green(`Moved phase ${from} to position ${to}.`));
|
|
9241
9280
|
}
|
|
9242
9281
|
|
|
9243
9282
|
// src/commands/backlog/updatePhase.ts
|
|
9244
|
-
import
|
|
9283
|
+
import chalk99 from "chalk";
|
|
9245
9284
|
|
|
9246
9285
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
9247
9286
|
import { and as and13, eq as eq30 } from "drizzle-orm";
|
|
@@ -9276,7 +9315,7 @@ async function applyPhaseUpdate(orm, itemId, phaseIdx, fields) {
|
|
|
9276
9315
|
}
|
|
9277
9316
|
|
|
9278
9317
|
// src/commands/backlog/findPhase.ts
|
|
9279
|
-
import
|
|
9318
|
+
import chalk98 from "chalk";
|
|
9280
9319
|
import { and as and14, count as count7, eq as eq31 } from "drizzle-orm";
|
|
9281
9320
|
async function findPhase(id2, phase) {
|
|
9282
9321
|
const found = await findOneItem(id2);
|
|
@@ -9287,7 +9326,7 @@ async function findPhase(id2, phase) {
|
|
|
9287
9326
|
const [row] = await orm.select({ cnt: count7() }).from(planPhases).where(and14(eq31(planPhases.itemId, itemId), eq31(planPhases.idx, phaseIdx)));
|
|
9288
9327
|
if (!row || row.cnt === 0) {
|
|
9289
9328
|
console.log(
|
|
9290
|
-
|
|
9329
|
+
chalk98.red(`Phase ${phaseIdx + 1} not found on item #${itemId}.`)
|
|
9291
9330
|
);
|
|
9292
9331
|
process.exitCode = 1;
|
|
9293
9332
|
return void 0;
|
|
@@ -9419,7 +9458,7 @@ async function updatePhase(id2, phase, options2) {
|
|
|
9419
9458
|
const { item, orm, itemId, phaseIdx } = found;
|
|
9420
9459
|
const resolved = resolvePhaseFields(options2, item.plan?.[phaseIdx]);
|
|
9421
9460
|
if (!resolved.ok) {
|
|
9422
|
-
console.log(
|
|
9461
|
+
console.log(chalk99.red(resolved.error));
|
|
9423
9462
|
process.exitCode = 1;
|
|
9424
9463
|
return;
|
|
9425
9464
|
}
|
|
@@ -9431,7 +9470,7 @@ async function updatePhase(id2, phase, options2) {
|
|
|
9431
9470
|
manualCheck && "manual checks"
|
|
9432
9471
|
].filter(Boolean).join(", ");
|
|
9433
9472
|
console.log(
|
|
9434
|
-
|
|
9473
|
+
chalk99.green(
|
|
9435
9474
|
`Updated ${fields} on phase ${phaseIdx + 1} of item #${itemId}.`
|
|
9436
9475
|
)
|
|
9437
9476
|
);
|
|
@@ -9454,7 +9493,7 @@ function registerUpdatePhaseCommand(cmd) {
|
|
|
9454
9493
|
}
|
|
9455
9494
|
|
|
9456
9495
|
// src/commands/backlog/removePhase.ts
|
|
9457
|
-
import
|
|
9496
|
+
import chalk100 from "chalk";
|
|
9458
9497
|
import { and as and15, eq as eq32 } from "drizzle-orm";
|
|
9459
9498
|
async function removePhase(id2, phase) {
|
|
9460
9499
|
const found = await findPhase(id2, phase);
|
|
@@ -9469,12 +9508,12 @@ async function removePhase(id2, phase) {
|
|
|
9469
9508
|
await adjustCurrentPhase(tx, item, phaseIdx);
|
|
9470
9509
|
});
|
|
9471
9510
|
console.log(
|
|
9472
|
-
|
|
9511
|
+
chalk100.green(`Removed phase ${phaseIdx + 1} from item #${itemId}.`)
|
|
9473
9512
|
);
|
|
9474
9513
|
}
|
|
9475
9514
|
|
|
9476
9515
|
// src/commands/backlog/update/index.ts
|
|
9477
|
-
import
|
|
9516
|
+
import chalk102 from "chalk";
|
|
9478
9517
|
import { eq as eq33 } from "drizzle-orm";
|
|
9479
9518
|
|
|
9480
9519
|
// src/commands/backlog/update/applyAcMutations.ts
|
|
@@ -9496,16 +9535,16 @@ function applyAcMutations(current, options2) {
|
|
|
9496
9535
|
}
|
|
9497
9536
|
|
|
9498
9537
|
// src/commands/backlog/update/buildUpdateValues.ts
|
|
9499
|
-
import
|
|
9538
|
+
import chalk101 from "chalk";
|
|
9500
9539
|
function buildUpdateValues(options2) {
|
|
9501
9540
|
const { name, desc: desc6, type, ac } = options2;
|
|
9502
9541
|
if (!name && !desc6 && !type && !ac) {
|
|
9503
|
-
console.log(
|
|
9542
|
+
console.log(chalk101.red("Nothing to update. Provide at least one flag."));
|
|
9504
9543
|
process.exitCode = 1;
|
|
9505
9544
|
return void 0;
|
|
9506
9545
|
}
|
|
9507
9546
|
if (type && type !== "story" && type !== "bug") {
|
|
9508
|
-
console.log(
|
|
9547
|
+
console.log(chalk101.red('Invalid type. Must be "story" or "bug".'));
|
|
9509
9548
|
process.exitCode = 1;
|
|
9510
9549
|
return void 0;
|
|
9511
9550
|
}
|
|
@@ -9538,14 +9577,14 @@ async function update(id2, options2) {
|
|
|
9538
9577
|
if (hasAcMutations(options2)) {
|
|
9539
9578
|
if (options2.ac) {
|
|
9540
9579
|
console.log(
|
|
9541
|
-
|
|
9580
|
+
chalk102.red("Cannot combine --ac with --add-ac/--edit-ac/--remove-ac.")
|
|
9542
9581
|
);
|
|
9543
9582
|
process.exitCode = 1;
|
|
9544
9583
|
return;
|
|
9545
9584
|
}
|
|
9546
9585
|
const mutation = applyAcMutations(found.item.acceptanceCriteria, options2);
|
|
9547
9586
|
if (!mutation.ok) {
|
|
9548
|
-
console.log(
|
|
9587
|
+
console.log(chalk102.red(mutation.error));
|
|
9549
9588
|
process.exitCode = 1;
|
|
9550
9589
|
return;
|
|
9551
9590
|
}
|
|
@@ -9556,7 +9595,7 @@ async function update(id2, options2) {
|
|
|
9556
9595
|
const { orm } = found;
|
|
9557
9596
|
const itemId = found.item.id;
|
|
9558
9597
|
await orm.update(items).set(built.set).where(eq33(items.id, itemId));
|
|
9559
|
-
console.log(
|
|
9598
|
+
console.log(chalk102.green(`Updated ${built.fields} on item #${itemId}.`));
|
|
9560
9599
|
}
|
|
9561
9600
|
|
|
9562
9601
|
// src/commands/backlog/registerUpdateCommands.ts
|
|
@@ -9608,7 +9647,8 @@ var registrars = [
|
|
|
9608
9647
|
registerExportCommand,
|
|
9609
9648
|
registerImportCommand,
|
|
9610
9649
|
registerMoveRepoCommand,
|
|
9611
|
-
registerAssociateJiraCommand
|
|
9650
|
+
registerAssociateJiraCommand,
|
|
9651
|
+
registerActivityCommands
|
|
9612
9652
|
];
|
|
9613
9653
|
function registerBacklog(program2) {
|
|
9614
9654
|
const cmd = program2.command("backlog").description("Manage a backlog of work items").option("--dir <path>", "Override directory for backlog file discovery").option("--no-open", "Do not open a browser on startup").hook("preAction", (thisCommand) => {
|
|
@@ -10358,11 +10398,11 @@ function assertCliExists(cli) {
|
|
|
10358
10398
|
}
|
|
10359
10399
|
|
|
10360
10400
|
// src/commands/permitCliReads/colorize.ts
|
|
10361
|
-
import
|
|
10401
|
+
import chalk103 from "chalk";
|
|
10362
10402
|
function colorize(plainOutput) {
|
|
10363
10403
|
return plainOutput.split("\n").map((line) => {
|
|
10364
|
-
if (line.startsWith(" R ")) return
|
|
10365
|
-
if (line.startsWith(" W ")) return
|
|
10404
|
+
if (line.startsWith(" R ")) return chalk103.green(line);
|
|
10405
|
+
if (line.startsWith(" W ")) return chalk103.red(line);
|
|
10366
10406
|
return line;
|
|
10367
10407
|
}).join("\n");
|
|
10368
10408
|
}
|
|
@@ -10660,7 +10700,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
10660
10700
|
}
|
|
10661
10701
|
|
|
10662
10702
|
// src/commands/deny/denyAdd.ts
|
|
10663
|
-
import
|
|
10703
|
+
import chalk104 from "chalk";
|
|
10664
10704
|
|
|
10665
10705
|
// src/commands/deny/loadDenyConfig.ts
|
|
10666
10706
|
function loadDenyConfig(global) {
|
|
@@ -10680,16 +10720,16 @@ function loadDenyConfig(global) {
|
|
|
10680
10720
|
function denyAdd(pattern2, message, options2) {
|
|
10681
10721
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
10682
10722
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
10683
|
-
console.log(
|
|
10723
|
+
console.log(chalk104.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
10684
10724
|
return;
|
|
10685
10725
|
}
|
|
10686
10726
|
deny.push({ pattern: pattern2, message });
|
|
10687
10727
|
saveDeny(deny);
|
|
10688
|
-
console.log(
|
|
10728
|
+
console.log(chalk104.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
10689
10729
|
}
|
|
10690
10730
|
|
|
10691
10731
|
// src/commands/deny/denyList.ts
|
|
10692
|
-
import
|
|
10732
|
+
import chalk105 from "chalk";
|
|
10693
10733
|
function denyList() {
|
|
10694
10734
|
const globalRaw = loadGlobalConfigRaw();
|
|
10695
10735
|
const projectRaw = loadProjectConfig();
|
|
@@ -10700,7 +10740,7 @@ function denyList() {
|
|
|
10700
10740
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
10701
10741
|
);
|
|
10702
10742
|
if (!merged || merged.length === 0) {
|
|
10703
|
-
console.log(
|
|
10743
|
+
console.log(chalk105.dim("No deny rules configured."));
|
|
10704
10744
|
return;
|
|
10705
10745
|
}
|
|
10706
10746
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -10708,23 +10748,23 @@ function denyList() {
|
|
|
10708
10748
|
for (const rule of merged) {
|
|
10709
10749
|
const inProject = projectPatterns.has(rule.pattern);
|
|
10710
10750
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
10711
|
-
const label2 = inProject && inGlobal ?
|
|
10712
|
-
console.log(`${
|
|
10751
|
+
const label2 = inProject && inGlobal ? chalk105.dim(" (project, overrides global)") : inGlobal ? chalk105.dim(" (global)") : "";
|
|
10752
|
+
console.log(`${chalk105.red(rule.pattern)} \u2192 ${rule.message}${label2}`);
|
|
10713
10753
|
}
|
|
10714
10754
|
}
|
|
10715
10755
|
|
|
10716
10756
|
// src/commands/deny/denyRemove.ts
|
|
10717
|
-
import
|
|
10757
|
+
import chalk106 from "chalk";
|
|
10718
10758
|
function denyRemove(pattern2, options2) {
|
|
10719
10759
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
10720
10760
|
const index3 = deny.findIndex((r) => r.pattern === pattern2);
|
|
10721
10761
|
if (index3 === -1) {
|
|
10722
|
-
console.log(
|
|
10762
|
+
console.log(chalk106.yellow(`No deny rule found for: ${pattern2}`));
|
|
10723
10763
|
return;
|
|
10724
10764
|
}
|
|
10725
10765
|
deny.splice(index3, 1);
|
|
10726
10766
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
10727
|
-
console.log(
|
|
10767
|
+
console.log(chalk106.green(`Removed deny rule: ${pattern2}`));
|
|
10728
10768
|
}
|
|
10729
10769
|
|
|
10730
10770
|
// src/commands/registerDeny.ts
|
|
@@ -10754,7 +10794,7 @@ function registerCliHook(program2) {
|
|
|
10754
10794
|
|
|
10755
10795
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
10756
10796
|
import { existsSync as existsSync30, readFileSync as readFileSync25, unlinkSync as unlinkSync8, writeFileSync as writeFileSync23 } from "fs";
|
|
10757
|
-
import
|
|
10797
|
+
import chalk107 from "chalk";
|
|
10758
10798
|
|
|
10759
10799
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
10760
10800
|
import { homedir as homedir14 } from "os";
|
|
@@ -10807,12 +10847,12 @@ function codeCommentConfirm(pin) {
|
|
|
10807
10847
|
sweepRestrictedDir();
|
|
10808
10848
|
const state = readPinState(pin);
|
|
10809
10849
|
if (!state) {
|
|
10810
|
-
console.error(
|
|
10850
|
+
console.error(chalk107.red(`No pending comment for pin: ${pin}`));
|
|
10811
10851
|
process.exitCode = 1;
|
|
10812
10852
|
return;
|
|
10813
10853
|
}
|
|
10814
10854
|
if (!existsSync30(state.file)) {
|
|
10815
|
-
console.error(
|
|
10855
|
+
console.error(chalk107.red(`Target file no longer exists: ${state.file}`));
|
|
10816
10856
|
process.exitCode = 1;
|
|
10817
10857
|
return;
|
|
10818
10858
|
}
|
|
@@ -10821,7 +10861,7 @@ function codeCommentConfirm(pin) {
|
|
|
10821
10861
|
const index3 = state.line - 1;
|
|
10822
10862
|
if (index3 > lines.length) {
|
|
10823
10863
|
console.error(
|
|
10824
|
-
|
|
10864
|
+
chalk107.red(
|
|
10825
10865
|
`Line ${state.line} is beyond the end of ${state.file} (${lines.length} lines).`
|
|
10826
10866
|
)
|
|
10827
10867
|
);
|
|
@@ -10835,14 +10875,14 @@ function codeCommentConfirm(pin) {
|
|
|
10835
10875
|
writeFileSync23(state.file, lines.join("\n"));
|
|
10836
10876
|
unlinkSync8(getPinStatePath(pin));
|
|
10837
10877
|
console.log(
|
|
10838
|
-
|
|
10878
|
+
chalk107.green(
|
|
10839
10879
|
`Inserted "${marker} ${state.text}" at ${state.file}:${state.line}`
|
|
10840
10880
|
)
|
|
10841
10881
|
);
|
|
10842
10882
|
}
|
|
10843
10883
|
|
|
10844
10884
|
// src/commands/codeComment/codeCommentSet.ts
|
|
10845
|
-
import
|
|
10885
|
+
import chalk108 from "chalk";
|
|
10846
10886
|
|
|
10847
10887
|
// src/commands/codeComment/validateCommentText.ts
|
|
10848
10888
|
var MAX_COMMENT_LENGTH = 50;
|
|
@@ -10893,27 +10933,27 @@ function generatePin() {
|
|
|
10893
10933
|
function codeCommentSet(file, line, text9) {
|
|
10894
10934
|
const lineNumber = Number.parseInt(line, 10);
|
|
10895
10935
|
if (!Number.isInteger(lineNumber) || lineNumber < 1) {
|
|
10896
|
-
console.error(
|
|
10936
|
+
console.error(chalk108.red(`Invalid line number: ${line}`));
|
|
10897
10937
|
process.exitCode = 1;
|
|
10898
10938
|
return;
|
|
10899
10939
|
}
|
|
10900
10940
|
const marker = isYamlFile(file) ? "#" : "//";
|
|
10901
10941
|
const validation = validateCommentText(text9, isYamlFile(file));
|
|
10902
10942
|
if (!validation.ok) {
|
|
10903
|
-
console.error(
|
|
10904
|
-
console.error(
|
|
10943
|
+
console.error(chalk108.red(`Refused: ${validation.reason}`));
|
|
10944
|
+
console.error(chalk108.red("No pin issued."));
|
|
10905
10945
|
process.exitCode = 1;
|
|
10906
10946
|
return;
|
|
10907
10947
|
}
|
|
10908
10948
|
console.error(
|
|
10909
|
-
|
|
10949
|
+
chalk108.yellow.bold(
|
|
10910
10950
|
"THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a comment. DO NOT WASTE THEIR TIME.\nYou had BETTER BE RIGHT that this comment is genuinely necessary.\n\nComments are a last resort, not a habit. Almost every comment you reach for is a sign\nthe code should be clearer instead. Before a human is pulled in, ask whether a better\nname, a smaller function, or a test would make the comment redundant. ONLY if you are\ncertain this one line earns its keep should you proceed to the confirm step below."
|
|
10911
10951
|
)
|
|
10912
10952
|
);
|
|
10913
10953
|
const delivered = issuePin(file, lineNumber, validation.text);
|
|
10914
10954
|
if (!delivered) {
|
|
10915
10955
|
console.error(
|
|
10916
|
-
|
|
10956
|
+
chalk108.red(
|
|
10917
10957
|
"Could not deliver the confirmation pin via notification.\nThe comment cannot be confirmed until the notification channel works."
|
|
10918
10958
|
)
|
|
10919
10959
|
);
|
|
@@ -10923,7 +10963,7 @@ function codeCommentSet(file, line, text9) {
|
|
|
10923
10963
|
console.log(
|
|
10924
10964
|
`A confirmation pin was sent to your desktop notifications.
|
|
10925
10965
|
To insert "${marker} ${validation.text}" at ${file}:${lineNumber}, run:
|
|
10926
|
-
${
|
|
10966
|
+
${chalk108.cyan(" assist code-comment confirm <PIN>")}
|
|
10927
10967
|
using the pin from that notification.`
|
|
10928
10968
|
);
|
|
10929
10969
|
}
|
|
@@ -10943,15 +10983,15 @@ function registerCodeComment(parent) {
|
|
|
10943
10983
|
}
|
|
10944
10984
|
|
|
10945
10985
|
// src/commands/complexity/analyze.ts
|
|
10946
|
-
import
|
|
10986
|
+
import chalk117 from "chalk";
|
|
10947
10987
|
|
|
10948
10988
|
// src/commands/complexity/cyclomatic.ts
|
|
10949
|
-
import
|
|
10989
|
+
import chalk110 from "chalk";
|
|
10950
10990
|
|
|
10951
10991
|
// src/commands/complexity/shared/index.ts
|
|
10952
10992
|
import fs17 from "fs";
|
|
10953
10993
|
import path21 from "path";
|
|
10954
|
-
import
|
|
10994
|
+
import chalk109 from "chalk";
|
|
10955
10995
|
import ts5 from "typescript";
|
|
10956
10996
|
|
|
10957
10997
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -11202,7 +11242,7 @@ function createSourceFromFile(filePath) {
|
|
|
11202
11242
|
function withSourceFiles(pattern2, callback, extraIgnore = []) {
|
|
11203
11243
|
const files = findSourceFiles2(pattern2, ".", extraIgnore);
|
|
11204
11244
|
if (files.length === 0) {
|
|
11205
|
-
console.log(
|
|
11245
|
+
console.log(chalk109.yellow("No files found matching pattern"));
|
|
11206
11246
|
return void 0;
|
|
11207
11247
|
}
|
|
11208
11248
|
return callback(files);
|
|
@@ -11235,11 +11275,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
11235
11275
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
11236
11276
|
for (const { file, name, complexity } of results) {
|
|
11237
11277
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
11238
|
-
const color = exceedsThreshold ?
|
|
11239
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
11278
|
+
const color = exceedsThreshold ? chalk110.red : chalk110.white;
|
|
11279
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk110.cyan(complexity)}`);
|
|
11240
11280
|
}
|
|
11241
11281
|
console.log(
|
|
11242
|
-
|
|
11282
|
+
chalk110.dim(
|
|
11243
11283
|
`
|
|
11244
11284
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
11245
11285
|
)
|
|
@@ -11251,7 +11291,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
11251
11291
|
}
|
|
11252
11292
|
|
|
11253
11293
|
// src/commands/complexity/halstead.ts
|
|
11254
|
-
import
|
|
11294
|
+
import chalk111 from "chalk";
|
|
11255
11295
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
11256
11296
|
withSourceFiles(pattern2, (files) => {
|
|
11257
11297
|
const results = [];
|
|
@@ -11266,13 +11306,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
11266
11306
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
11267
11307
|
for (const { file, name, metrics } of results) {
|
|
11268
11308
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
11269
|
-
const color = exceedsThreshold ?
|
|
11309
|
+
const color = exceedsThreshold ? chalk111.red : chalk111.white;
|
|
11270
11310
|
console.log(
|
|
11271
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
11311
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk111.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk111.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk111.magenta(metrics.effort.toFixed(1))}`
|
|
11272
11312
|
);
|
|
11273
11313
|
}
|
|
11274
11314
|
console.log(
|
|
11275
|
-
|
|
11315
|
+
chalk111.dim(
|
|
11276
11316
|
`
|
|
11277
11317
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
11278
11318
|
)
|
|
@@ -11284,27 +11324,27 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
11284
11324
|
}
|
|
11285
11325
|
|
|
11286
11326
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
11287
|
-
import
|
|
11327
|
+
import chalk114 from "chalk";
|
|
11288
11328
|
|
|
11289
11329
|
// src/commands/complexity/maintainability/formatResultLine.ts
|
|
11290
|
-
import
|
|
11330
|
+
import chalk112 from "chalk";
|
|
11291
11331
|
function formatResultLine(entry, failing) {
|
|
11292
11332
|
const { file, avgMaintainability, minMaintainability, override } = entry;
|
|
11293
|
-
const name = failing ?
|
|
11294
|
-
const suffix = override !== void 0 ?
|
|
11295
|
-
return `${name} \u2192 avg: ${
|
|
11333
|
+
const name = failing ? chalk112.red(file) : chalk112.white(file);
|
|
11334
|
+
const suffix = override !== void 0 ? chalk112.magenta(` (override: ${override})`) : "";
|
|
11335
|
+
return `${name} \u2192 avg: ${chalk112.cyan(avgMaintainability.toFixed(1))}, min: ${chalk112.yellow(minMaintainability.toFixed(1))}${suffix}`;
|
|
11296
11336
|
}
|
|
11297
11337
|
|
|
11298
11338
|
// src/commands/complexity/maintainability/printMaintainabilityFailure.ts
|
|
11299
|
-
import
|
|
11339
|
+
import chalk113 from "chalk";
|
|
11300
11340
|
function printMaintainabilityFailure(failingCount, threshold) {
|
|
11301
11341
|
const thresholdLabel = threshold !== void 0 ? ` ${threshold}` : "";
|
|
11302
11342
|
console.error(
|
|
11303
|
-
|
|
11343
|
+
chalk113.red(
|
|
11304
11344
|
`
|
|
11305
11345
|
Fail: ${failingCount} file(s) below threshold${thresholdLabel} (files marked "(override: N)" were judged against their own marker). Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
11306
11346
|
|
|
11307
|
-
\u26A0\uFE0F ${
|
|
11347
|
+
\u26A0\uFE0F ${chalk113.bold("Diagnose and fix one file at a time")} \u2014 do not investigate or fix multiple files in parallel.
|
|
11308
11348
|
|
|
11309
11349
|
The score is a property of the whole file, not your diff: any existing logic counts, so the fix is to shrink the file \u2014 not to revert or micro-optimize the lines you just changed. Identify the largest cohesive responsibility (often the biggest function, or a related group of functions) and move it to a new file with 'assist refactor extract'. Run 'assist complexity <file>' for per-function metrics only to locate that responsibility, not to tweak individual lines.`
|
|
11310
11350
|
)
|
|
@@ -11316,7 +11356,7 @@ function displayMaintainabilityResults(results, threshold) {
|
|
|
11316
11356
|
const gating = threshold !== void 0 || results.some((r) => r.override !== void 0);
|
|
11317
11357
|
if (!gating) {
|
|
11318
11358
|
for (const entry of results) console.log(formatResultLine(entry, false));
|
|
11319
|
-
console.log(
|
|
11359
|
+
console.log(chalk114.dim(`
|
|
11320
11360
|
Analyzed ${results.length} files`));
|
|
11321
11361
|
return;
|
|
11322
11362
|
}
|
|
@@ -11325,7 +11365,7 @@ Analyzed ${results.length} files`));
|
|
|
11325
11365
|
return limit !== void 0 && r.minMaintainability < limit;
|
|
11326
11366
|
});
|
|
11327
11367
|
if (failing.length === 0) {
|
|
11328
|
-
console.log(
|
|
11368
|
+
console.log(chalk114.green("All files pass maintainability threshold"));
|
|
11329
11369
|
} else {
|
|
11330
11370
|
for (const entry of failing) console.log(formatResultLine(entry, true));
|
|
11331
11371
|
}
|
|
@@ -11334,7 +11374,7 @@ Analyzed ${results.length} files`));
|
|
|
11334
11374
|
);
|
|
11335
11375
|
for (const entry of passingOverrides)
|
|
11336
11376
|
console.log(formatResultLine(entry, false));
|
|
11337
|
-
console.log(
|
|
11377
|
+
console.log(chalk114.dim(`
|
|
11338
11378
|
Analyzed ${results.length} files`));
|
|
11339
11379
|
if (failing.length > 0) {
|
|
11340
11380
|
printMaintainabilityFailure(failing.length, threshold);
|
|
@@ -11343,10 +11383,10 @@ Analyzed ${results.length} files`));
|
|
|
11343
11383
|
}
|
|
11344
11384
|
|
|
11345
11385
|
// src/commands/complexity/maintainability/printMaintainabilityFormula.ts
|
|
11346
|
-
import
|
|
11386
|
+
import chalk115 from "chalk";
|
|
11347
11387
|
var MI_FORMULA = "171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100";
|
|
11348
11388
|
function printMaintainabilityFormula() {
|
|
11349
|
-
console.log(
|
|
11389
|
+
console.log(chalk115.dim(MI_FORMULA));
|
|
11350
11390
|
}
|
|
11351
11391
|
|
|
11352
11392
|
// src/commands/complexity/maintainability/collectFileMetrics.ts
|
|
@@ -11422,7 +11462,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
11422
11462
|
|
|
11423
11463
|
// src/commands/complexity/sloc.ts
|
|
11424
11464
|
import fs19 from "fs";
|
|
11425
|
-
import
|
|
11465
|
+
import chalk116 from "chalk";
|
|
11426
11466
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
11427
11467
|
withSourceFiles(pattern2, (files) => {
|
|
11428
11468
|
const results = [];
|
|
@@ -11438,12 +11478,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
11438
11478
|
results.sort((a, b) => b.lines - a.lines);
|
|
11439
11479
|
for (const { file, lines } of results) {
|
|
11440
11480
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
11441
|
-
const color = exceedsThreshold ?
|
|
11442
|
-
console.log(`${color(file)} \u2192 ${
|
|
11481
|
+
const color = exceedsThreshold ? chalk116.red : chalk116.white;
|
|
11482
|
+
console.log(`${color(file)} \u2192 ${chalk116.cyan(lines)} lines`);
|
|
11443
11483
|
}
|
|
11444
11484
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
11445
11485
|
console.log(
|
|
11446
|
-
|
|
11486
|
+
chalk116.dim(`
|
|
11447
11487
|
Total: ${total} lines across ${files.length} files`)
|
|
11448
11488
|
);
|
|
11449
11489
|
if (hasViolation) {
|
|
@@ -11457,25 +11497,25 @@ async function analyze(pattern2) {
|
|
|
11457
11497
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
11458
11498
|
const files = findSourceFiles2(searchPattern);
|
|
11459
11499
|
if (files.length === 0) {
|
|
11460
|
-
console.log(
|
|
11500
|
+
console.log(chalk117.yellow("No files found matching pattern"));
|
|
11461
11501
|
return;
|
|
11462
11502
|
}
|
|
11463
11503
|
if (files.length === 1) {
|
|
11464
11504
|
const file = files[0];
|
|
11465
|
-
console.log(
|
|
11505
|
+
console.log(chalk117.bold.underline("SLOC"));
|
|
11466
11506
|
await sloc(file);
|
|
11467
11507
|
console.log();
|
|
11468
|
-
console.log(
|
|
11508
|
+
console.log(chalk117.bold.underline("Cyclomatic Complexity"));
|
|
11469
11509
|
await cyclomatic(file);
|
|
11470
11510
|
console.log();
|
|
11471
|
-
console.log(
|
|
11511
|
+
console.log(chalk117.bold.underline("Halstead Metrics"));
|
|
11472
11512
|
await halstead(file);
|
|
11473
11513
|
console.log();
|
|
11474
|
-
console.log(
|
|
11514
|
+
console.log(chalk117.bold.underline("Maintainability Index"));
|
|
11475
11515
|
await maintainability(file);
|
|
11476
11516
|
console.log();
|
|
11477
11517
|
console.log(
|
|
11478
|
-
|
|
11518
|
+
chalk117.dim(
|
|
11479
11519
|
"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."
|
|
11480
11520
|
)
|
|
11481
11521
|
);
|
|
@@ -11509,7 +11549,7 @@ function registerComplexity(program2) {
|
|
|
11509
11549
|
}
|
|
11510
11550
|
|
|
11511
11551
|
// src/commands/config/index.ts
|
|
11512
|
-
import
|
|
11552
|
+
import chalk118 from "chalk";
|
|
11513
11553
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
11514
11554
|
|
|
11515
11555
|
// src/commands/config/setNestedValue.ts
|
|
@@ -11572,7 +11612,7 @@ function formatIssuePath(issue, key) {
|
|
|
11572
11612
|
function printValidationErrors(issues, key) {
|
|
11573
11613
|
for (const issue of issues) {
|
|
11574
11614
|
console.error(
|
|
11575
|
-
|
|
11615
|
+
chalk118.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
11576
11616
|
);
|
|
11577
11617
|
}
|
|
11578
11618
|
}
|
|
@@ -11589,7 +11629,7 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
11589
11629
|
function assertNotGlobalOnly(key, global) {
|
|
11590
11630
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
11591
11631
|
console.error(
|
|
11592
|
-
|
|
11632
|
+
chalk118.red(
|
|
11593
11633
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
11594
11634
|
)
|
|
11595
11635
|
);
|
|
@@ -11612,7 +11652,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
11612
11652
|
applyConfigSet(key, coerced, options2.global ?? false);
|
|
11613
11653
|
const target = options2.global ? "global" : "project";
|
|
11614
11654
|
console.log(
|
|
11615
|
-
|
|
11655
|
+
chalk118.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
11616
11656
|
);
|
|
11617
11657
|
}
|
|
11618
11658
|
function configList() {
|
|
@@ -11621,7 +11661,7 @@ function configList() {
|
|
|
11621
11661
|
}
|
|
11622
11662
|
|
|
11623
11663
|
// src/commands/config/configGet.ts
|
|
11624
|
-
import
|
|
11664
|
+
import chalk119 from "chalk";
|
|
11625
11665
|
|
|
11626
11666
|
// src/commands/config/getNestedValue.ts
|
|
11627
11667
|
function isTraversable(value) {
|
|
@@ -11653,7 +11693,7 @@ function requireNestedValue(config, key) {
|
|
|
11653
11693
|
return value;
|
|
11654
11694
|
}
|
|
11655
11695
|
function exitKeyNotSet(key) {
|
|
11656
|
-
console.error(
|
|
11696
|
+
console.error(chalk119.red(`Key "${key}" is not set`));
|
|
11657
11697
|
process.exit(1);
|
|
11658
11698
|
}
|
|
11659
11699
|
|
|
@@ -11667,7 +11707,7 @@ function registerConfig(program2) {
|
|
|
11667
11707
|
|
|
11668
11708
|
// src/commands/deploy/redirect.ts
|
|
11669
11709
|
import { existsSync as existsSync31, readFileSync as readFileSync26, writeFileSync as writeFileSync25 } from "fs";
|
|
11670
|
-
import
|
|
11710
|
+
import chalk120 from "chalk";
|
|
11671
11711
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
11672
11712
|
if (!window.location.pathname.endsWith('/')) {
|
|
11673
11713
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -11676,23 +11716,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
11676
11716
|
function redirect() {
|
|
11677
11717
|
const indexPath = "index.html";
|
|
11678
11718
|
if (!existsSync31(indexPath)) {
|
|
11679
|
-
console.log(
|
|
11719
|
+
console.log(chalk120.yellow("No index.html found"));
|
|
11680
11720
|
return;
|
|
11681
11721
|
}
|
|
11682
11722
|
const content = readFileSync26(indexPath, "utf8");
|
|
11683
11723
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
11684
|
-
console.log(
|
|
11724
|
+
console.log(chalk120.dim("Trailing slash script already present"));
|
|
11685
11725
|
return;
|
|
11686
11726
|
}
|
|
11687
11727
|
const headCloseIndex = content.indexOf("</head>");
|
|
11688
11728
|
if (headCloseIndex === -1) {
|
|
11689
|
-
console.log(
|
|
11729
|
+
console.log(chalk120.red("Could not find </head> tag in index.html"));
|
|
11690
11730
|
return;
|
|
11691
11731
|
}
|
|
11692
11732
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
11693
11733
|
${content.slice(headCloseIndex)}`;
|
|
11694
11734
|
writeFileSync25(indexPath, newContent);
|
|
11695
|
-
console.log(
|
|
11735
|
+
console.log(chalk120.green("Added trailing slash redirect to index.html"));
|
|
11696
11736
|
}
|
|
11697
11737
|
|
|
11698
11738
|
// src/commands/registerDeploy.ts
|
|
@@ -11719,7 +11759,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
11719
11759
|
|
|
11720
11760
|
// src/commands/devlog/shared.ts
|
|
11721
11761
|
import { execSync as execSync27 } from "child_process";
|
|
11722
|
-
import
|
|
11762
|
+
import chalk121 from "chalk";
|
|
11723
11763
|
|
|
11724
11764
|
// src/shared/getRepoName.ts
|
|
11725
11765
|
import { existsSync as existsSync32, readFileSync as readFileSync27 } from "fs";
|
|
@@ -11828,13 +11868,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
11828
11868
|
}
|
|
11829
11869
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
11830
11870
|
for (const commit2 of commits2) {
|
|
11831
|
-
console.log(` ${
|
|
11871
|
+
console.log(` ${chalk121.yellow(commit2.hash)} ${commit2.message}`);
|
|
11832
11872
|
if (verbose) {
|
|
11833
11873
|
const visibleFiles = commit2.files.filter(
|
|
11834
11874
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
11835
11875
|
);
|
|
11836
11876
|
for (const file of visibleFiles) {
|
|
11837
|
-
console.log(` ${
|
|
11877
|
+
console.log(` ${chalk121.dim(file)}`);
|
|
11838
11878
|
}
|
|
11839
11879
|
}
|
|
11840
11880
|
}
|
|
@@ -11859,15 +11899,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
11859
11899
|
}
|
|
11860
11900
|
|
|
11861
11901
|
// src/commands/devlog/list/printDateHeader.ts
|
|
11862
|
-
import
|
|
11902
|
+
import chalk122 from "chalk";
|
|
11863
11903
|
function printDateHeader(date, isSkipped, entries) {
|
|
11864
11904
|
if (isSkipped) {
|
|
11865
|
-
console.log(`${
|
|
11905
|
+
console.log(`${chalk122.bold.blue(date)} ${chalk122.dim("skipped")}`);
|
|
11866
11906
|
} else if (entries && entries.length > 0) {
|
|
11867
|
-
const entryInfo = entries.map((e) => `${
|
|
11868
|
-
console.log(`${
|
|
11907
|
+
const entryInfo = entries.map((e) => `${chalk122.green(e.version)} ${e.title}`).join(" | ");
|
|
11908
|
+
console.log(`${chalk122.bold.blue(date)} ${entryInfo}`);
|
|
11869
11909
|
} else {
|
|
11870
|
-
console.log(`${
|
|
11910
|
+
console.log(`${chalk122.bold.blue(date)} ${chalk122.red("\u26A0 devlog missing")}`);
|
|
11871
11911
|
}
|
|
11872
11912
|
}
|
|
11873
11913
|
|
|
@@ -11971,24 +12011,24 @@ function bumpVersion(version2, type) {
|
|
|
11971
12011
|
|
|
11972
12012
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
11973
12013
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
11974
|
-
import
|
|
12014
|
+
import chalk124 from "chalk";
|
|
11975
12015
|
|
|
11976
12016
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
11977
|
-
import
|
|
12017
|
+
import chalk123 from "chalk";
|
|
11978
12018
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
11979
12019
|
if (conventional && firstHash) {
|
|
11980
12020
|
const version2 = getVersionAtCommit(firstHash);
|
|
11981
12021
|
if (version2) {
|
|
11982
|
-
console.log(`${
|
|
12022
|
+
console.log(`${chalk123.bold("version:")} ${stripToMinor(version2)}`);
|
|
11983
12023
|
} else {
|
|
11984
|
-
console.log(`${
|
|
12024
|
+
console.log(`${chalk123.bold("version:")} ${chalk123.red("unknown")}`);
|
|
11985
12025
|
}
|
|
11986
12026
|
} else if (patchVersion && minorVersion) {
|
|
11987
12027
|
console.log(
|
|
11988
|
-
`${
|
|
12028
|
+
`${chalk123.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
11989
12029
|
);
|
|
11990
12030
|
} else {
|
|
11991
|
-
console.log(`${
|
|
12031
|
+
console.log(`${chalk123.bold("version:")} v0.1 (initial)`);
|
|
11992
12032
|
}
|
|
11993
12033
|
}
|
|
11994
12034
|
|
|
@@ -12036,16 +12076,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
12036
12076
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
12037
12077
|
}
|
|
12038
12078
|
function logName(repoName) {
|
|
12039
|
-
console.log(`${
|
|
12079
|
+
console.log(`${chalk124.bold("name:")} ${repoName}`);
|
|
12040
12080
|
}
|
|
12041
12081
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
12042
12082
|
logName(ctx.repoName);
|
|
12043
12083
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
12044
|
-
console.log(
|
|
12084
|
+
console.log(chalk124.bold.blue(targetDate));
|
|
12045
12085
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
12046
12086
|
}
|
|
12047
12087
|
function logNoCommits(lastInfo) {
|
|
12048
|
-
console.log(
|
|
12088
|
+
console.log(chalk124.dim(noCommitsMessage(!!lastInfo)));
|
|
12049
12089
|
}
|
|
12050
12090
|
|
|
12051
12091
|
// src/commands/devlog/next/index.ts
|
|
@@ -12086,11 +12126,11 @@ function next2(options2) {
|
|
|
12086
12126
|
import { execSync as execSync29 } from "child_process";
|
|
12087
12127
|
|
|
12088
12128
|
// src/commands/devlog/repos/printReposTable.ts
|
|
12089
|
-
import
|
|
12129
|
+
import chalk125 from "chalk";
|
|
12090
12130
|
function colorStatus(status2) {
|
|
12091
|
-
if (status2 === "missing") return
|
|
12092
|
-
if (status2 === "outdated") return
|
|
12093
|
-
return
|
|
12131
|
+
if (status2 === "missing") return chalk125.red(status2);
|
|
12132
|
+
if (status2 === "outdated") return chalk125.yellow(status2);
|
|
12133
|
+
return chalk125.green(status2);
|
|
12094
12134
|
}
|
|
12095
12135
|
function formatRow(row, nameWidth) {
|
|
12096
12136
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -12104,8 +12144,8 @@ function printReposTable(rows) {
|
|
|
12104
12144
|
"Last Devlog".padEnd(11),
|
|
12105
12145
|
"Status"
|
|
12106
12146
|
].join(" ");
|
|
12107
|
-
console.log(
|
|
12108
|
-
console.log(
|
|
12147
|
+
console.log(chalk125.dim(header));
|
|
12148
|
+
console.log(chalk125.dim("-".repeat(header.length)));
|
|
12109
12149
|
for (const row of rows) {
|
|
12110
12150
|
console.log(formatRow(row, nameWidth));
|
|
12111
12151
|
}
|
|
@@ -12163,14 +12203,14 @@ function repos(options2) {
|
|
|
12163
12203
|
// src/commands/devlog/skip.ts
|
|
12164
12204
|
import { writeFileSync as writeFileSync26 } from "fs";
|
|
12165
12205
|
import { join as join33 } from "path";
|
|
12166
|
-
import
|
|
12206
|
+
import chalk126 from "chalk";
|
|
12167
12207
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
12168
12208
|
function getBlogConfigPath() {
|
|
12169
12209
|
return join33(BLOG_REPO_ROOT, "assist.yml");
|
|
12170
12210
|
}
|
|
12171
12211
|
function skip(date) {
|
|
12172
12212
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
12173
|
-
console.log(
|
|
12213
|
+
console.log(chalk126.red("Invalid date format. Use YYYY-MM-DD"));
|
|
12174
12214
|
process.exit(1);
|
|
12175
12215
|
}
|
|
12176
12216
|
const repoName = getRepoName();
|
|
@@ -12181,7 +12221,7 @@ function skip(date) {
|
|
|
12181
12221
|
const skipDays = skip2[repoName] ?? [];
|
|
12182
12222
|
if (skipDays.includes(date)) {
|
|
12183
12223
|
console.log(
|
|
12184
|
-
|
|
12224
|
+
chalk126.yellow(`${date} is already in skip list for ${repoName}`)
|
|
12185
12225
|
);
|
|
12186
12226
|
return;
|
|
12187
12227
|
}
|
|
@@ -12191,20 +12231,20 @@ function skip(date) {
|
|
|
12191
12231
|
devlog.skip = skip2;
|
|
12192
12232
|
config.devlog = devlog;
|
|
12193
12233
|
writeFileSync26(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
12194
|
-
console.log(
|
|
12234
|
+
console.log(chalk126.green(`Added ${date} to skip list for ${repoName}`));
|
|
12195
12235
|
}
|
|
12196
12236
|
|
|
12197
12237
|
// src/commands/devlog/version.ts
|
|
12198
|
-
import
|
|
12238
|
+
import chalk127 from "chalk";
|
|
12199
12239
|
function version() {
|
|
12200
12240
|
const config = loadConfig();
|
|
12201
12241
|
const name = getRepoName();
|
|
12202
12242
|
const lastInfo = getLastVersionInfo(name, config);
|
|
12203
12243
|
const lastVersion = lastInfo?.version ?? null;
|
|
12204
12244
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
12205
|
-
console.log(`${
|
|
12206
|
-
console.log(`${
|
|
12207
|
-
console.log(`${
|
|
12245
|
+
console.log(`${chalk127.bold("name:")} ${name}`);
|
|
12246
|
+
console.log(`${chalk127.bold("last:")} ${lastVersion ?? chalk127.dim("none")}`);
|
|
12247
|
+
console.log(`${chalk127.bold("next:")} ${nextVersion ?? chalk127.dim("none")}`);
|
|
12208
12248
|
}
|
|
12209
12249
|
|
|
12210
12250
|
// src/commands/registerDevlog.ts
|
|
@@ -12228,7 +12268,7 @@ function registerDevlog(program2) {
|
|
|
12228
12268
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
12229
12269
|
import { closeSync as closeSync2, openSync as openSync2, readdirSync as readdirSync4 } from "fs";
|
|
12230
12270
|
import { join as join34 } from "path";
|
|
12231
|
-
import
|
|
12271
|
+
import chalk128 from "chalk";
|
|
12232
12272
|
|
|
12233
12273
|
// src/shared/findRepoRoot.ts
|
|
12234
12274
|
import { existsSync as existsSync33 } from "fs";
|
|
@@ -12291,14 +12331,14 @@ function checkBuildLocks(startDir) {
|
|
|
12291
12331
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
12292
12332
|
if (locked) {
|
|
12293
12333
|
console.error(
|
|
12294
|
-
|
|
12334
|
+
chalk128.red("Build output locked (is VS debugging?): ") + locked
|
|
12295
12335
|
);
|
|
12296
12336
|
process.exit(1);
|
|
12297
12337
|
}
|
|
12298
12338
|
}
|
|
12299
12339
|
async function checkBuildLocksCommand() {
|
|
12300
12340
|
checkBuildLocks();
|
|
12301
|
-
console.log(
|
|
12341
|
+
console.log(chalk128.green("No build locks detected"));
|
|
12302
12342
|
}
|
|
12303
12343
|
|
|
12304
12344
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -12397,30 +12437,30 @@ function escapeRegex(s) {
|
|
|
12397
12437
|
}
|
|
12398
12438
|
|
|
12399
12439
|
// src/commands/dotnet/printTree.ts
|
|
12400
|
-
import
|
|
12440
|
+
import chalk129 from "chalk";
|
|
12401
12441
|
function printNodes(nodes, prefix2) {
|
|
12402
12442
|
for (let i = 0; i < nodes.length; i++) {
|
|
12403
12443
|
const isLast = i === nodes.length - 1;
|
|
12404
12444
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
12405
12445
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
12406
12446
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
12407
|
-
const label2 = isMissing ?
|
|
12447
|
+
const label2 = isMissing ? chalk129.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
12408
12448
|
console.log(`${prefix2}${connector}${label2}`);
|
|
12409
12449
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
12410
12450
|
}
|
|
12411
12451
|
}
|
|
12412
12452
|
function printTree(tree, totalCount, solutions) {
|
|
12413
|
-
console.log(
|
|
12414
|
-
console.log(
|
|
12453
|
+
console.log(chalk129.bold("\nProject Dependency Tree"));
|
|
12454
|
+
console.log(chalk129.cyan(tree.relativePath));
|
|
12415
12455
|
printNodes(tree.children, "");
|
|
12416
|
-
console.log(
|
|
12456
|
+
console.log(chalk129.dim(`
|
|
12417
12457
|
${totalCount} projects total (including root)`));
|
|
12418
|
-
console.log(
|
|
12458
|
+
console.log(chalk129.bold("\nSolution Membership"));
|
|
12419
12459
|
if (solutions.length === 0) {
|
|
12420
|
-
console.log(
|
|
12460
|
+
console.log(chalk129.yellow(" Not found in any .sln"));
|
|
12421
12461
|
} else {
|
|
12422
12462
|
for (const sln of solutions) {
|
|
12423
|
-
console.log(` ${
|
|
12463
|
+
console.log(` ${chalk129.green(sln)}`);
|
|
12424
12464
|
}
|
|
12425
12465
|
}
|
|
12426
12466
|
console.log();
|
|
@@ -12449,16 +12489,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
12449
12489
|
// src/commands/dotnet/resolveCsproj.ts
|
|
12450
12490
|
import { existsSync as existsSync34 } from "fs";
|
|
12451
12491
|
import path25 from "path";
|
|
12452
|
-
import
|
|
12492
|
+
import chalk130 from "chalk";
|
|
12453
12493
|
function resolveCsproj(csprojPath) {
|
|
12454
12494
|
const resolved = path25.resolve(csprojPath);
|
|
12455
12495
|
if (!existsSync34(resolved)) {
|
|
12456
|
-
console.error(
|
|
12496
|
+
console.error(chalk130.red(`File not found: ${resolved}`));
|
|
12457
12497
|
process.exit(1);
|
|
12458
12498
|
}
|
|
12459
12499
|
const repoRoot = findRepoRoot(path25.dirname(resolved));
|
|
12460
12500
|
if (!repoRoot) {
|
|
12461
|
-
console.error(
|
|
12501
|
+
console.error(chalk130.red("Could not find git repository root"));
|
|
12462
12502
|
process.exit(1);
|
|
12463
12503
|
}
|
|
12464
12504
|
return { resolved, repoRoot };
|
|
@@ -12508,12 +12548,12 @@ function getChangedCsFiles(scope) {
|
|
|
12508
12548
|
}
|
|
12509
12549
|
|
|
12510
12550
|
// src/commands/dotnet/inSln.ts
|
|
12511
|
-
import
|
|
12551
|
+
import chalk131 from "chalk";
|
|
12512
12552
|
async function inSln(csprojPath) {
|
|
12513
12553
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
12514
12554
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
12515
12555
|
if (solutions.length === 0) {
|
|
12516
|
-
console.log(
|
|
12556
|
+
console.log(chalk131.yellow("Not found in any .sln file"));
|
|
12517
12557
|
process.exit(1);
|
|
12518
12558
|
}
|
|
12519
12559
|
for (const sln of solutions) {
|
|
@@ -12522,7 +12562,7 @@ async function inSln(csprojPath) {
|
|
|
12522
12562
|
}
|
|
12523
12563
|
|
|
12524
12564
|
// src/commands/dotnet/inspect.ts
|
|
12525
|
-
import
|
|
12565
|
+
import chalk137 from "chalk";
|
|
12526
12566
|
|
|
12527
12567
|
// src/shared/formatElapsed.ts
|
|
12528
12568
|
function formatElapsed(ms) {
|
|
@@ -12534,12 +12574,12 @@ function formatElapsed(ms) {
|
|
|
12534
12574
|
}
|
|
12535
12575
|
|
|
12536
12576
|
// src/commands/dotnet/displayIssues.ts
|
|
12537
|
-
import
|
|
12577
|
+
import chalk132 from "chalk";
|
|
12538
12578
|
var SEVERITY_COLOR = {
|
|
12539
|
-
ERROR:
|
|
12540
|
-
WARNING:
|
|
12541
|
-
SUGGESTION:
|
|
12542
|
-
HINT:
|
|
12579
|
+
ERROR: chalk132.red,
|
|
12580
|
+
WARNING: chalk132.yellow,
|
|
12581
|
+
SUGGESTION: chalk132.cyan,
|
|
12582
|
+
HINT: chalk132.dim
|
|
12543
12583
|
};
|
|
12544
12584
|
function groupByFile(issues) {
|
|
12545
12585
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -12555,15 +12595,15 @@ function groupByFile(issues) {
|
|
|
12555
12595
|
}
|
|
12556
12596
|
function displayIssues(issues) {
|
|
12557
12597
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
12558
|
-
console.log(
|
|
12598
|
+
console.log(chalk132.bold(file));
|
|
12559
12599
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
12560
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
12600
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk132.white;
|
|
12561
12601
|
console.log(
|
|
12562
|
-
` ${
|
|
12602
|
+
` ${chalk132.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
12563
12603
|
);
|
|
12564
12604
|
}
|
|
12565
12605
|
}
|
|
12566
|
-
console.log(
|
|
12606
|
+
console.log(chalk132.dim(`
|
|
12567
12607
|
${issues.length} issue(s) found`));
|
|
12568
12608
|
}
|
|
12569
12609
|
|
|
@@ -12622,12 +12662,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
12622
12662
|
// src/commands/dotnet/resolveSolution.ts
|
|
12623
12663
|
import { existsSync as existsSync35 } from "fs";
|
|
12624
12664
|
import path26 from "path";
|
|
12625
|
-
import
|
|
12665
|
+
import chalk134 from "chalk";
|
|
12626
12666
|
|
|
12627
12667
|
// src/commands/dotnet/findSolution.ts
|
|
12628
12668
|
import { readdirSync as readdirSync6 } from "fs";
|
|
12629
12669
|
import { dirname as dirname20, join as join35 } from "path";
|
|
12630
|
-
import
|
|
12670
|
+
import chalk133 from "chalk";
|
|
12631
12671
|
function findSlnInDir(dir) {
|
|
12632
12672
|
try {
|
|
12633
12673
|
return readdirSync6(dir).filter((f) => f.endsWith(".sln")).map((f) => join35(dir, f));
|
|
@@ -12643,17 +12683,17 @@ function findSolution() {
|
|
|
12643
12683
|
const slnFiles = findSlnInDir(current);
|
|
12644
12684
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
12645
12685
|
if (slnFiles.length > 1) {
|
|
12646
|
-
console.error(
|
|
12686
|
+
console.error(chalk133.red(`Multiple .sln files found in ${current}:`));
|
|
12647
12687
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
12648
12688
|
console.error(
|
|
12649
|
-
|
|
12689
|
+
chalk133.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
12650
12690
|
);
|
|
12651
12691
|
process.exit(1);
|
|
12652
12692
|
}
|
|
12653
12693
|
if (current === ceiling) break;
|
|
12654
12694
|
current = dirname20(current);
|
|
12655
12695
|
}
|
|
12656
|
-
console.error(
|
|
12696
|
+
console.error(chalk133.red("No .sln file found between cwd and repo root"));
|
|
12657
12697
|
process.exit(1);
|
|
12658
12698
|
}
|
|
12659
12699
|
|
|
@@ -12662,7 +12702,7 @@ function resolveSolution(sln) {
|
|
|
12662
12702
|
if (sln) {
|
|
12663
12703
|
const resolved = path26.resolve(sln);
|
|
12664
12704
|
if (!existsSync35(resolved)) {
|
|
12665
|
-
console.error(
|
|
12705
|
+
console.error(chalk134.red(`Solution file not found: ${resolved}`));
|
|
12666
12706
|
process.exit(1);
|
|
12667
12707
|
}
|
|
12668
12708
|
return resolved;
|
|
@@ -12704,14 +12744,14 @@ import { execSync as execSync31 } from "child_process";
|
|
|
12704
12744
|
import { existsSync as existsSync36, readFileSync as readFileSync31, unlinkSync as unlinkSync9 } from "fs";
|
|
12705
12745
|
import { tmpdir as tmpdir3 } from "os";
|
|
12706
12746
|
import path27 from "path";
|
|
12707
|
-
import
|
|
12747
|
+
import chalk135 from "chalk";
|
|
12708
12748
|
function assertJbInstalled() {
|
|
12709
12749
|
try {
|
|
12710
12750
|
execSync31("jb inspectcode --version", { stdio: "pipe" });
|
|
12711
12751
|
} catch {
|
|
12712
|
-
console.error(
|
|
12752
|
+
console.error(chalk135.red("jb is not installed. Install with:"));
|
|
12713
12753
|
console.error(
|
|
12714
|
-
|
|
12754
|
+
chalk135.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
12715
12755
|
);
|
|
12716
12756
|
process.exit(1);
|
|
12717
12757
|
}
|
|
@@ -12729,11 +12769,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
12729
12769
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
12730
12770
|
process.stderr.write(error.stderr);
|
|
12731
12771
|
}
|
|
12732
|
-
console.error(
|
|
12772
|
+
console.error(chalk135.red("jb inspectcode failed"));
|
|
12733
12773
|
process.exit(1);
|
|
12734
12774
|
}
|
|
12735
12775
|
if (!existsSync36(reportPath)) {
|
|
12736
|
-
console.error(
|
|
12776
|
+
console.error(chalk135.red("Report file not generated"));
|
|
12737
12777
|
process.exit(1);
|
|
12738
12778
|
}
|
|
12739
12779
|
const xml = readFileSync31(reportPath, "utf8");
|
|
@@ -12743,7 +12783,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
12743
12783
|
|
|
12744
12784
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
12745
12785
|
import { execSync as execSync32 } from "child_process";
|
|
12746
|
-
import
|
|
12786
|
+
import chalk136 from "chalk";
|
|
12747
12787
|
function resolveMsbuildPath() {
|
|
12748
12788
|
const { run: run4 } = loadConfig();
|
|
12749
12789
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -12755,9 +12795,9 @@ function assertMsbuildInstalled() {
|
|
|
12755
12795
|
try {
|
|
12756
12796
|
execSync32(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
12757
12797
|
} catch {
|
|
12758
|
-
console.error(
|
|
12798
|
+
console.error(chalk136.red(`msbuild not found at: ${msbuild}`));
|
|
12759
12799
|
console.error(
|
|
12760
|
-
|
|
12800
|
+
chalk136.yellow(
|
|
12761
12801
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
12762
12802
|
)
|
|
12763
12803
|
);
|
|
@@ -12804,17 +12844,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
12804
12844
|
// src/commands/dotnet/inspect.ts
|
|
12805
12845
|
function logScope(changedFiles) {
|
|
12806
12846
|
if (changedFiles === null) {
|
|
12807
|
-
console.log(
|
|
12847
|
+
console.log(chalk137.dim("Inspecting full solution..."));
|
|
12808
12848
|
} else {
|
|
12809
12849
|
console.log(
|
|
12810
|
-
|
|
12850
|
+
chalk137.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
12811
12851
|
);
|
|
12812
12852
|
}
|
|
12813
12853
|
}
|
|
12814
12854
|
function reportResults(issues, elapsed) {
|
|
12815
12855
|
if (issues.length > 0) displayIssues(issues);
|
|
12816
|
-
else console.log(
|
|
12817
|
-
console.log(
|
|
12856
|
+
else console.log(chalk137.green("No issues found"));
|
|
12857
|
+
console.log(chalk137.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
12818
12858
|
if (issues.length > 0) process.exit(1);
|
|
12819
12859
|
}
|
|
12820
12860
|
async function inspect(sln, options2) {
|
|
@@ -12825,7 +12865,7 @@ async function inspect(sln, options2) {
|
|
|
12825
12865
|
const scope = parseScope(options2.scope);
|
|
12826
12866
|
const changedFiles = getChangedCsFiles(scope);
|
|
12827
12867
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
12828
|
-
console.log(
|
|
12868
|
+
console.log(chalk137.green("No changed .cs files found"));
|
|
12829
12869
|
return;
|
|
12830
12870
|
}
|
|
12831
12871
|
logScope(changedFiles);
|
|
@@ -13150,25 +13190,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
13150
13190
|
}
|
|
13151
13191
|
|
|
13152
13192
|
// src/commands/github/printCountTable.ts
|
|
13153
|
-
import
|
|
13193
|
+
import chalk138 from "chalk";
|
|
13154
13194
|
function printCountTable(labelHeader, rows) {
|
|
13155
13195
|
const labelWidth = Math.max(
|
|
13156
13196
|
labelHeader.length,
|
|
13157
13197
|
...rows.map((row) => row.label.length)
|
|
13158
13198
|
);
|
|
13159
13199
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
13160
|
-
console.log(
|
|
13161
|
-
console.log(
|
|
13200
|
+
console.log(chalk138.dim(header));
|
|
13201
|
+
console.log(chalk138.dim("-".repeat(header.length)));
|
|
13162
13202
|
for (const row of rows) {
|
|
13163
13203
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
13164
13204
|
}
|
|
13165
13205
|
}
|
|
13166
13206
|
|
|
13167
13207
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
13168
|
-
import
|
|
13208
|
+
import chalk139 from "chalk";
|
|
13169
13209
|
function printRepoAuthorBreakdown(repos2) {
|
|
13170
13210
|
for (const repo of repos2) {
|
|
13171
|
-
console.log(
|
|
13211
|
+
console.log(chalk139.bold(repo.name));
|
|
13172
13212
|
const authorWidth = Math.max(
|
|
13173
13213
|
0,
|
|
13174
13214
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -13486,7 +13526,7 @@ function registerHandover(program2) {
|
|
|
13486
13526
|
}
|
|
13487
13527
|
|
|
13488
13528
|
// src/commands/jira/acceptanceCriteria.ts
|
|
13489
|
-
import
|
|
13529
|
+
import chalk140 from "chalk";
|
|
13490
13530
|
|
|
13491
13531
|
// src/commands/jira/adfToText.ts
|
|
13492
13532
|
function renderInline(node) {
|
|
@@ -13553,7 +13593,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
13553
13593
|
const parsed = fetchIssue(issueKey, field);
|
|
13554
13594
|
const acValue = parsed?.fields?.[field];
|
|
13555
13595
|
if (!acValue) {
|
|
13556
|
-
console.log(
|
|
13596
|
+
console.log(chalk140.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
13557
13597
|
return;
|
|
13558
13598
|
}
|
|
13559
13599
|
if (typeof acValue === "string") {
|
|
@@ -13619,14 +13659,14 @@ async function jiraAuth() {
|
|
|
13619
13659
|
}
|
|
13620
13660
|
|
|
13621
13661
|
// src/commands/jira/viewIssue.ts
|
|
13622
|
-
import
|
|
13662
|
+
import chalk141 from "chalk";
|
|
13623
13663
|
function viewIssue(issueKey) {
|
|
13624
13664
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
13625
13665
|
const fields = parsed?.fields;
|
|
13626
13666
|
const summary = fields?.summary;
|
|
13627
13667
|
const description = fields?.description;
|
|
13628
13668
|
if (summary) {
|
|
13629
|
-
console.log(
|
|
13669
|
+
console.log(chalk141.bold(summary));
|
|
13630
13670
|
}
|
|
13631
13671
|
if (description) {
|
|
13632
13672
|
if (summary) console.log();
|
|
@@ -13640,7 +13680,7 @@ function viewIssue(issueKey) {
|
|
|
13640
13680
|
}
|
|
13641
13681
|
if (!summary && !description) {
|
|
13642
13682
|
console.log(
|
|
13643
|
-
|
|
13683
|
+
chalk141.yellow(`No summary or description found on ${issueKey}.`)
|
|
13644
13684
|
);
|
|
13645
13685
|
}
|
|
13646
13686
|
}
|
|
@@ -13656,13 +13696,13 @@ function registerJira(program2) {
|
|
|
13656
13696
|
// src/commands/reviewComments.ts
|
|
13657
13697
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
13658
13698
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
13659
|
-
import
|
|
13699
|
+
import chalk142 from "chalk";
|
|
13660
13700
|
async function reviewComments(number) {
|
|
13661
13701
|
if (number) {
|
|
13662
13702
|
try {
|
|
13663
13703
|
execFileSync5("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
13664
13704
|
} catch {
|
|
13665
|
-
console.error(
|
|
13705
|
+
console.error(chalk142.red(`gh pr checkout ${number} failed; aborting.`));
|
|
13666
13706
|
process.exit(1);
|
|
13667
13707
|
}
|
|
13668
13708
|
}
|
|
@@ -13736,15 +13776,15 @@ function registerList(program2) {
|
|
|
13736
13776
|
// src/commands/mermaid/index.ts
|
|
13737
13777
|
import { mkdirSync as mkdirSync14, readdirSync as readdirSync8 } from "fs";
|
|
13738
13778
|
import { resolve as resolve11 } from "path";
|
|
13739
|
-
import
|
|
13779
|
+
import chalk145 from "chalk";
|
|
13740
13780
|
|
|
13741
13781
|
// src/commands/mermaid/exportFile.ts
|
|
13742
13782
|
import { readFileSync as readFileSync33, writeFileSync as writeFileSync28 } from "fs";
|
|
13743
13783
|
import { basename as basename8, extname, resolve as resolve10 } from "path";
|
|
13744
|
-
import
|
|
13784
|
+
import chalk144 from "chalk";
|
|
13745
13785
|
|
|
13746
13786
|
// src/commands/mermaid/renderBlock.ts
|
|
13747
|
-
import
|
|
13787
|
+
import chalk143 from "chalk";
|
|
13748
13788
|
async function renderBlock(krokiUrl, source) {
|
|
13749
13789
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
13750
13790
|
method: "POST",
|
|
@@ -13753,7 +13793,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
13753
13793
|
});
|
|
13754
13794
|
if (!response.ok) {
|
|
13755
13795
|
console.error(
|
|
13756
|
-
|
|
13796
|
+
chalk143.red(
|
|
13757
13797
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
13758
13798
|
)
|
|
13759
13799
|
);
|
|
@@ -13771,19 +13811,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
13771
13811
|
if (onlyIndex !== void 0) {
|
|
13772
13812
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
13773
13813
|
console.error(
|
|
13774
|
-
|
|
13814
|
+
chalk144.red(
|
|
13775
13815
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
13776
13816
|
)
|
|
13777
13817
|
);
|
|
13778
13818
|
process.exit(1);
|
|
13779
13819
|
}
|
|
13780
13820
|
console.log(
|
|
13781
|
-
|
|
13821
|
+
chalk144.gray(
|
|
13782
13822
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
13783
13823
|
)
|
|
13784
13824
|
);
|
|
13785
13825
|
} else {
|
|
13786
|
-
console.log(
|
|
13826
|
+
console.log(chalk144.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
13787
13827
|
}
|
|
13788
13828
|
for (const [i, source] of blocks.entries()) {
|
|
13789
13829
|
const idx = i + 1;
|
|
@@ -13791,7 +13831,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
13791
13831
|
const outPath = resolve10(outDir, `${stem}-${idx}.svg`);
|
|
13792
13832
|
const svg = await renderBlock(krokiUrl, source);
|
|
13793
13833
|
writeFileSync28(outPath, svg, "utf8");
|
|
13794
|
-
console.log(
|
|
13834
|
+
console.log(chalk144.green(` \u2192 ${outPath}`));
|
|
13795
13835
|
}
|
|
13796
13836
|
}
|
|
13797
13837
|
function extractMermaidBlocks(markdown) {
|
|
@@ -13807,18 +13847,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
13807
13847
|
if (options2.index !== void 0) {
|
|
13808
13848
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
13809
13849
|
console.error(
|
|
13810
|
-
|
|
13850
|
+
chalk145.red(`--index must be a positive integer (got ${options2.index})`)
|
|
13811
13851
|
);
|
|
13812
13852
|
process.exit(1);
|
|
13813
13853
|
}
|
|
13814
13854
|
if (!file) {
|
|
13815
|
-
console.error(
|
|
13855
|
+
console.error(chalk145.red("--index requires a file argument"));
|
|
13816
13856
|
process.exit(1);
|
|
13817
13857
|
}
|
|
13818
13858
|
}
|
|
13819
13859
|
const files = file ? [file] : readdirSync8(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
13820
13860
|
if (files.length === 0) {
|
|
13821
|
-
console.log(
|
|
13861
|
+
console.log(chalk145.gray("No markdown files found in current directory."));
|
|
13822
13862
|
return;
|
|
13823
13863
|
}
|
|
13824
13864
|
for (const f of files) {
|
|
@@ -13844,7 +13884,7 @@ function registerMermaid(program2) {
|
|
|
13844
13884
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
13845
13885
|
import { createServer as createServer2 } from "http";
|
|
13846
13886
|
import { dirname as dirname22 } from "path";
|
|
13847
|
-
import
|
|
13887
|
+
import chalk147 from "chalk";
|
|
13848
13888
|
|
|
13849
13889
|
// src/commands/netcap/corsHeaders.ts
|
|
13850
13890
|
var corsHeaders = {
|
|
@@ -13923,7 +13963,7 @@ function createNetcapHandler(options2) {
|
|
|
13923
13963
|
import { cp, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
|
|
13924
13964
|
import { networkInterfaces } from "os";
|
|
13925
13965
|
import { join as join41 } from "path";
|
|
13926
|
-
import
|
|
13966
|
+
import chalk146 from "chalk";
|
|
13927
13967
|
|
|
13928
13968
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
13929
13969
|
import { dirname as dirname21, join as join40 } from "path";
|
|
@@ -13967,7 +14007,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
13967
14007
|
const host = lanIPv4();
|
|
13968
14008
|
if (!host) {
|
|
13969
14009
|
console.log(
|
|
13970
|
-
|
|
14010
|
+
chalk146.yellow("could not determine the WSL IP for the extension")
|
|
13971
14011
|
);
|
|
13972
14012
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
13973
14013
|
return source;
|
|
@@ -13978,7 +14018,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
13978
14018
|
return WSL_WINDOWS_PATH;
|
|
13979
14019
|
} catch {
|
|
13980
14020
|
console.log(
|
|
13981
|
-
|
|
14021
|
+
chalk146.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
13982
14022
|
);
|
|
13983
14023
|
return source;
|
|
13984
14024
|
}
|
|
@@ -14011,30 +14051,30 @@ async function netcap(options2) {
|
|
|
14011
14051
|
let count8 = 0;
|
|
14012
14052
|
const handler = createNetcapHandler({
|
|
14013
14053
|
outPath,
|
|
14014
|
-
onPing: () => console.log(
|
|
14054
|
+
onPing: () => console.log(chalk147.dim("ping from extension")),
|
|
14015
14055
|
onCapture: (entry) => {
|
|
14016
14056
|
count8 += 1;
|
|
14017
14057
|
console.log(
|
|
14018
|
-
|
|
14019
|
-
|
|
14058
|
+
chalk147.green(`captured #${count8}`),
|
|
14059
|
+
chalk147.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
14020
14060
|
);
|
|
14021
14061
|
}
|
|
14022
14062
|
});
|
|
14023
14063
|
const server = createServer2(handler);
|
|
14024
14064
|
server.listen(port, () => {
|
|
14025
14065
|
console.log(
|
|
14026
|
-
|
|
14066
|
+
chalk147.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
14027
14067
|
);
|
|
14028
|
-
console.log(
|
|
14068
|
+
console.log(chalk147.dim(`appending captures to ${outPath}`));
|
|
14029
14069
|
if (filter)
|
|
14030
|
-
console.log(
|
|
14031
|
-
console.log(
|
|
14032
|
-
console.log(
|
|
14070
|
+
console.log(chalk147.dim(`forwarding only URLs matching "${filter}"`));
|
|
14071
|
+
console.log(chalk147.dim(`load the unpacked extension from ${extensionPath}`));
|
|
14072
|
+
console.log(chalk147.dim("press Ctrl-C to stop"));
|
|
14033
14073
|
});
|
|
14034
14074
|
process.on("SIGINT", () => {
|
|
14035
14075
|
server.close();
|
|
14036
14076
|
console.log(
|
|
14037
|
-
|
|
14077
|
+
chalk147.bold(
|
|
14038
14078
|
`
|
|
14039
14079
|
netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
14040
14080
|
)
|
|
@@ -14046,7 +14086,7 @@ netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} t
|
|
|
14046
14086
|
// src/commands/netcap/netcapExtract.ts
|
|
14047
14087
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
14048
14088
|
import { join as join44 } from "path";
|
|
14049
|
-
import
|
|
14089
|
+
import chalk148 from "chalk";
|
|
14050
14090
|
|
|
14051
14091
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
14052
14092
|
import { readFileSync as readFileSync34 } from "fs";
|
|
@@ -14494,8 +14534,8 @@ function netcapExtract(file) {
|
|
|
14494
14534
|
writeFileSync29(outFile, `${JSON.stringify(posts, null, 2)}
|
|
14495
14535
|
`);
|
|
14496
14536
|
console.log(
|
|
14497
|
-
|
|
14498
|
-
|
|
14537
|
+
chalk148.green(`extracted ${posts.length} posts`),
|
|
14538
|
+
chalk148.dim(`-> ${outFile}`)
|
|
14499
14539
|
);
|
|
14500
14540
|
}
|
|
14501
14541
|
|
|
@@ -14516,7 +14556,7 @@ function registerNetcap(program2) {
|
|
|
14516
14556
|
}
|
|
14517
14557
|
|
|
14518
14558
|
// src/commands/news/add/index.ts
|
|
14519
|
-
import
|
|
14559
|
+
import chalk149 from "chalk";
|
|
14520
14560
|
import enquirer8 from "enquirer";
|
|
14521
14561
|
async function add2(url) {
|
|
14522
14562
|
if (!url) {
|
|
@@ -14538,10 +14578,10 @@ async function add2(url) {
|
|
|
14538
14578
|
const { orm } = await getReady();
|
|
14539
14579
|
const added = await addFeed(orm, url);
|
|
14540
14580
|
if (!added) {
|
|
14541
|
-
console.log(
|
|
14581
|
+
console.log(chalk149.yellow("Feed already exists"));
|
|
14542
14582
|
return;
|
|
14543
14583
|
}
|
|
14544
|
-
console.log(
|
|
14584
|
+
console.log(chalk149.green(`Added feed: ${url}`));
|
|
14545
14585
|
}
|
|
14546
14586
|
|
|
14547
14587
|
// src/commands/registerNews.ts
|
|
@@ -14551,7 +14591,7 @@ function registerNews(program2) {
|
|
|
14551
14591
|
}
|
|
14552
14592
|
|
|
14553
14593
|
// src/commands/prompts/printPromptsTable.ts
|
|
14554
|
-
import
|
|
14594
|
+
import chalk150 from "chalk";
|
|
14555
14595
|
function truncate(str, max) {
|
|
14556
14596
|
if (str.length <= max) return str;
|
|
14557
14597
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -14569,14 +14609,14 @@ function printPromptsTable(rows) {
|
|
|
14569
14609
|
"Command".padEnd(commandWidth),
|
|
14570
14610
|
"Repos"
|
|
14571
14611
|
].join(" ");
|
|
14572
|
-
console.log(
|
|
14573
|
-
console.log(
|
|
14612
|
+
console.log(chalk150.dim(header));
|
|
14613
|
+
console.log(chalk150.dim("-".repeat(header.length)));
|
|
14574
14614
|
for (const row of rows) {
|
|
14575
14615
|
const count8 = String(row.count).padStart(countWidth);
|
|
14576
14616
|
const tool = row.tool.padEnd(toolWidth);
|
|
14577
14617
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
14578
14618
|
console.log(
|
|
14579
|
-
`${
|
|
14619
|
+
`${chalk150.yellow(count8)} ${tool} ${command} ${chalk150.dim(row.repos)}`
|
|
14580
14620
|
);
|
|
14581
14621
|
}
|
|
14582
14622
|
}
|
|
@@ -15125,20 +15165,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
15125
15165
|
}
|
|
15126
15166
|
|
|
15127
15167
|
// src/commands/prs/listComments/printComments.ts
|
|
15128
|
-
import
|
|
15168
|
+
import chalk151 from "chalk";
|
|
15129
15169
|
function formatForHuman(comment3) {
|
|
15130
15170
|
if (comment3.type === "review") {
|
|
15131
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
15171
|
+
const stateColor = comment3.state === "APPROVED" ? chalk151.green : comment3.state === "CHANGES_REQUESTED" ? chalk151.red : chalk151.yellow;
|
|
15132
15172
|
return [
|
|
15133
|
-
`${
|
|
15173
|
+
`${chalk151.cyan("Review")} by ${chalk151.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
15134
15174
|
comment3.body,
|
|
15135
15175
|
""
|
|
15136
15176
|
].join("\n");
|
|
15137
15177
|
}
|
|
15138
15178
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
15139
15179
|
return [
|
|
15140
|
-
`${
|
|
15141
|
-
|
|
15180
|
+
`${chalk151.cyan("Line comment")} by ${chalk151.bold(comment3.user)} on ${chalk151.dim(`${comment3.path}${location}`)}`,
|
|
15181
|
+
chalk151.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
15142
15182
|
comment3.body,
|
|
15143
15183
|
""
|
|
15144
15184
|
].join("\n");
|
|
@@ -15228,13 +15268,13 @@ import { execSync as execSync41 } from "child_process";
|
|
|
15228
15268
|
import enquirer9 from "enquirer";
|
|
15229
15269
|
|
|
15230
15270
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
15231
|
-
import
|
|
15271
|
+
import chalk152 from "chalk";
|
|
15232
15272
|
var STATUS_MAP = {
|
|
15233
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
15234
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
15273
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk152.magenta("merged"), date: pr.mergedAt } : null,
|
|
15274
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk152.red("closed"), date: pr.closedAt } : null
|
|
15235
15275
|
};
|
|
15236
15276
|
function defaultStatus(pr) {
|
|
15237
|
-
return { label:
|
|
15277
|
+
return { label: chalk152.green("opened"), date: pr.createdAt };
|
|
15238
15278
|
}
|
|
15239
15279
|
function getStatus2(pr) {
|
|
15240
15280
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -15243,11 +15283,11 @@ function formatDate(dateStr) {
|
|
|
15243
15283
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
15244
15284
|
}
|
|
15245
15285
|
function formatPrHeader(pr, status2) {
|
|
15246
|
-
return `${
|
|
15286
|
+
return `${chalk152.cyan(`#${pr.number}`)} ${pr.title} ${chalk152.dim(`(${pr.author.login},`)} ${status2.label} ${chalk152.dim(`${formatDate(status2.date)})`)}`;
|
|
15247
15287
|
}
|
|
15248
15288
|
function logPrDetails(pr) {
|
|
15249
15289
|
console.log(
|
|
15250
|
-
|
|
15290
|
+
chalk152.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
15251
15291
|
);
|
|
15252
15292
|
console.log();
|
|
15253
15293
|
}
|
|
@@ -15586,10 +15626,10 @@ function registerPrs(program2) {
|
|
|
15586
15626
|
}
|
|
15587
15627
|
|
|
15588
15628
|
// src/commands/ravendb/ravendbAuth.ts
|
|
15589
|
-
import
|
|
15629
|
+
import chalk158 from "chalk";
|
|
15590
15630
|
|
|
15591
15631
|
// src/shared/createConnectionAuth.ts
|
|
15592
|
-
import
|
|
15632
|
+
import chalk153 from "chalk";
|
|
15593
15633
|
function listConnections(connections, format) {
|
|
15594
15634
|
if (connections.length === 0) {
|
|
15595
15635
|
console.log("No connections configured.");
|
|
@@ -15602,7 +15642,7 @@ function listConnections(connections, format) {
|
|
|
15602
15642
|
function removeConnection(connections, name, save) {
|
|
15603
15643
|
const filtered = connections.filter((c) => c.name !== name);
|
|
15604
15644
|
if (filtered.length === connections.length) {
|
|
15605
|
-
console.error(
|
|
15645
|
+
console.error(chalk153.red(`Connection "${name}" not found.`));
|
|
15606
15646
|
process.exit(1);
|
|
15607
15647
|
}
|
|
15608
15648
|
save(filtered);
|
|
@@ -15648,15 +15688,15 @@ function saveConnections(connections) {
|
|
|
15648
15688
|
}
|
|
15649
15689
|
|
|
15650
15690
|
// src/commands/ravendb/promptConnection.ts
|
|
15651
|
-
import
|
|
15691
|
+
import chalk156 from "chalk";
|
|
15652
15692
|
|
|
15653
15693
|
// src/commands/ravendb/selectOpSecret.ts
|
|
15654
|
-
import
|
|
15694
|
+
import chalk155 from "chalk";
|
|
15655
15695
|
import Enquirer2 from "enquirer";
|
|
15656
15696
|
|
|
15657
15697
|
// src/commands/ravendb/searchItems.ts
|
|
15658
15698
|
import { execSync as execSync45 } from "child_process";
|
|
15659
|
-
import
|
|
15699
|
+
import chalk154 from "chalk";
|
|
15660
15700
|
function opExec(args) {
|
|
15661
15701
|
return execSync45(`op ${args}`, {
|
|
15662
15702
|
encoding: "utf8",
|
|
@@ -15669,7 +15709,7 @@ function searchItems(search2) {
|
|
|
15669
15709
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
15670
15710
|
} catch {
|
|
15671
15711
|
console.error(
|
|
15672
|
-
|
|
15712
|
+
chalk154.red(
|
|
15673
15713
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
15674
15714
|
)
|
|
15675
15715
|
);
|
|
@@ -15683,7 +15723,7 @@ function getItemFields(itemId) {
|
|
|
15683
15723
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
15684
15724
|
return item.fields.filter((f) => f.reference && f.label);
|
|
15685
15725
|
} catch {
|
|
15686
|
-
console.error(
|
|
15726
|
+
console.error(chalk154.red("Failed to get item details from 1Password."));
|
|
15687
15727
|
process.exit(1);
|
|
15688
15728
|
}
|
|
15689
15729
|
}
|
|
@@ -15702,7 +15742,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
15702
15742
|
}).run();
|
|
15703
15743
|
const items2 = searchItems(search2);
|
|
15704
15744
|
if (items2.length === 0) {
|
|
15705
|
-
console.error(
|
|
15745
|
+
console.error(chalk155.red(`No items found matching "${search2}".`));
|
|
15706
15746
|
process.exit(1);
|
|
15707
15747
|
}
|
|
15708
15748
|
const itemId = await selectOne(
|
|
@@ -15711,7 +15751,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
15711
15751
|
);
|
|
15712
15752
|
const fields = getItemFields(itemId);
|
|
15713
15753
|
if (fields.length === 0) {
|
|
15714
|
-
console.error(
|
|
15754
|
+
console.error(chalk155.red("No fields with references found on this item."));
|
|
15715
15755
|
process.exit(1);
|
|
15716
15756
|
}
|
|
15717
15757
|
const ref = await selectOne(
|
|
@@ -15725,7 +15765,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
15725
15765
|
async function promptConnection(existingNames) {
|
|
15726
15766
|
const name = await promptInput("name", "Connection name:");
|
|
15727
15767
|
if (existingNames.includes(name)) {
|
|
15728
|
-
console.error(
|
|
15768
|
+
console.error(chalk156.red(`Connection "${name}" already exists.`));
|
|
15729
15769
|
process.exit(1);
|
|
15730
15770
|
}
|
|
15731
15771
|
const url = await promptInput(
|
|
@@ -15734,22 +15774,22 @@ async function promptConnection(existingNames) {
|
|
|
15734
15774
|
);
|
|
15735
15775
|
const database = await promptInput("database", "Database name:");
|
|
15736
15776
|
if (!name || !url || !database) {
|
|
15737
|
-
console.error(
|
|
15777
|
+
console.error(chalk156.red("All fields are required."));
|
|
15738
15778
|
process.exit(1);
|
|
15739
15779
|
}
|
|
15740
15780
|
const apiKeyRef = await selectOpSecret();
|
|
15741
|
-
console.log(
|
|
15781
|
+
console.log(chalk156.dim(`Using: ${apiKeyRef}`));
|
|
15742
15782
|
return { name, url, database, apiKeyRef };
|
|
15743
15783
|
}
|
|
15744
15784
|
|
|
15745
15785
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
15746
|
-
import
|
|
15786
|
+
import chalk157 from "chalk";
|
|
15747
15787
|
function ravendbSetConnection(name) {
|
|
15748
15788
|
const raw = loadGlobalConfigRaw();
|
|
15749
15789
|
const ravendb = raw.ravendb ?? {};
|
|
15750
15790
|
const connections = ravendb.connections ?? [];
|
|
15751
15791
|
if (!connections.some((c) => c.name === name)) {
|
|
15752
|
-
console.error(
|
|
15792
|
+
console.error(chalk157.red(`Connection "${name}" not found.`));
|
|
15753
15793
|
console.error(
|
|
15754
15794
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
15755
15795
|
);
|
|
@@ -15765,16 +15805,16 @@ function ravendbSetConnection(name) {
|
|
|
15765
15805
|
var ravendbAuth = createConnectionAuth({
|
|
15766
15806
|
load: loadConnections,
|
|
15767
15807
|
save: saveConnections,
|
|
15768
|
-
format: (c) => `${
|
|
15808
|
+
format: (c) => `${chalk158.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
15769
15809
|
promptNew: promptConnection,
|
|
15770
15810
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
15771
15811
|
});
|
|
15772
15812
|
|
|
15773
15813
|
// src/commands/ravendb/ravendbCollections.ts
|
|
15774
|
-
import
|
|
15814
|
+
import chalk162 from "chalk";
|
|
15775
15815
|
|
|
15776
15816
|
// src/commands/ravendb/ravenFetch.ts
|
|
15777
|
-
import
|
|
15817
|
+
import chalk160 from "chalk";
|
|
15778
15818
|
|
|
15779
15819
|
// src/commands/ravendb/getAccessToken.ts
|
|
15780
15820
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -15811,10 +15851,10 @@ ${errorText}`
|
|
|
15811
15851
|
|
|
15812
15852
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
15813
15853
|
import { execSync as execSync46 } from "child_process";
|
|
15814
|
-
import
|
|
15854
|
+
import chalk159 from "chalk";
|
|
15815
15855
|
function resolveOpSecret(reference) {
|
|
15816
15856
|
if (!reference.startsWith("op://")) {
|
|
15817
|
-
console.error(
|
|
15857
|
+
console.error(chalk159.red(`Invalid secret reference: must start with op://`));
|
|
15818
15858
|
process.exit(1);
|
|
15819
15859
|
}
|
|
15820
15860
|
try {
|
|
@@ -15824,7 +15864,7 @@ function resolveOpSecret(reference) {
|
|
|
15824
15864
|
}).trim();
|
|
15825
15865
|
} catch {
|
|
15826
15866
|
console.error(
|
|
15827
|
-
|
|
15867
|
+
chalk159.red(
|
|
15828
15868
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
15829
15869
|
)
|
|
15830
15870
|
);
|
|
@@ -15851,7 +15891,7 @@ async function ravenFetch(connection, path57) {
|
|
|
15851
15891
|
if (!response.ok) {
|
|
15852
15892
|
const body = await response.text();
|
|
15853
15893
|
console.error(
|
|
15854
|
-
|
|
15894
|
+
chalk160.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
15855
15895
|
);
|
|
15856
15896
|
console.error(body.substring(0, 500));
|
|
15857
15897
|
process.exit(1);
|
|
@@ -15860,7 +15900,7 @@ async function ravenFetch(connection, path57) {
|
|
|
15860
15900
|
}
|
|
15861
15901
|
|
|
15862
15902
|
// src/commands/ravendb/resolveConnection.ts
|
|
15863
|
-
import
|
|
15903
|
+
import chalk161 from "chalk";
|
|
15864
15904
|
function loadRavendb() {
|
|
15865
15905
|
const raw = loadGlobalConfigRaw();
|
|
15866
15906
|
const ravendb = raw.ravendb;
|
|
@@ -15874,7 +15914,7 @@ function resolveConnection(name) {
|
|
|
15874
15914
|
const connectionName = name ?? defaultConnection;
|
|
15875
15915
|
if (!connectionName) {
|
|
15876
15916
|
console.error(
|
|
15877
|
-
|
|
15917
|
+
chalk161.red(
|
|
15878
15918
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
15879
15919
|
)
|
|
15880
15920
|
);
|
|
@@ -15882,7 +15922,7 @@ function resolveConnection(name) {
|
|
|
15882
15922
|
}
|
|
15883
15923
|
const connection = connections.find((c) => c.name === connectionName);
|
|
15884
15924
|
if (!connection) {
|
|
15885
|
-
console.error(
|
|
15925
|
+
console.error(chalk161.red(`Connection "${connectionName}" not found.`));
|
|
15886
15926
|
console.error(
|
|
15887
15927
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
15888
15928
|
);
|
|
@@ -15913,15 +15953,15 @@ async function ravendbCollections(connectionName) {
|
|
|
15913
15953
|
return;
|
|
15914
15954
|
}
|
|
15915
15955
|
for (const c of collections) {
|
|
15916
|
-
console.log(`${
|
|
15956
|
+
console.log(`${chalk162.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
15917
15957
|
}
|
|
15918
15958
|
}
|
|
15919
15959
|
|
|
15920
15960
|
// src/commands/ravendb/ravendbQuery.ts
|
|
15921
|
-
import
|
|
15961
|
+
import chalk164 from "chalk";
|
|
15922
15962
|
|
|
15923
15963
|
// src/commands/ravendb/fetchAllPages.ts
|
|
15924
|
-
import
|
|
15964
|
+
import chalk163 from "chalk";
|
|
15925
15965
|
|
|
15926
15966
|
// src/commands/ravendb/buildQueryPath.ts
|
|
15927
15967
|
function buildQueryPath(opts) {
|
|
@@ -15959,7 +15999,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
15959
15999
|
allResults.push(...results);
|
|
15960
16000
|
start3 += results.length;
|
|
15961
16001
|
process.stderr.write(
|
|
15962
|
-
`\r${
|
|
16002
|
+
`\r${chalk163.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
15963
16003
|
);
|
|
15964
16004
|
if (start3 >= totalResults) break;
|
|
15965
16005
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -15974,7 +16014,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
15974
16014
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
15975
16015
|
const resolved = resolveArgs(connectionName, collection);
|
|
15976
16016
|
if (!resolved.collection && !options2.query) {
|
|
15977
|
-
console.error(
|
|
16017
|
+
console.error(chalk164.red("Provide a collection name or --query filter."));
|
|
15978
16018
|
process.exit(1);
|
|
15979
16019
|
}
|
|
15980
16020
|
const { collection: col } = resolved;
|
|
@@ -16012,7 +16052,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
16012
16052
|
import * as path28 from "path";
|
|
16013
16053
|
|
|
16014
16054
|
// src/commands/refactor/logViolations.ts
|
|
16015
|
-
import
|
|
16055
|
+
import chalk165 from "chalk";
|
|
16016
16056
|
var DEFAULT_MAX_LINES = 100;
|
|
16017
16057
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
16018
16058
|
if (violations.length === 0) {
|
|
@@ -16021,43 +16061,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
16021
16061
|
}
|
|
16022
16062
|
return;
|
|
16023
16063
|
}
|
|
16024
|
-
console.error(
|
|
16064
|
+
console.error(chalk165.red(`
|
|
16025
16065
|
Refactor check failed:
|
|
16026
16066
|
`));
|
|
16027
|
-
console.error(
|
|
16067
|
+
console.error(chalk165.red(` The following files exceed ${maxLines} lines:
|
|
16028
16068
|
`));
|
|
16029
16069
|
for (const violation of violations) {
|
|
16030
|
-
console.error(
|
|
16070
|
+
console.error(chalk165.red(` ${violation.file} (${violation.lines} lines)`));
|
|
16031
16071
|
}
|
|
16032
16072
|
console.error(
|
|
16033
|
-
|
|
16073
|
+
chalk165.yellow(
|
|
16034
16074
|
`
|
|
16035
16075
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
16036
16076
|
way to refactor it, ignore it with:
|
|
16037
16077
|
`
|
|
16038
16078
|
)
|
|
16039
16079
|
);
|
|
16040
|
-
console.error(
|
|
16080
|
+
console.error(chalk165.gray(` assist refactor ignore <file>
|
|
16041
16081
|
`));
|
|
16042
16082
|
if (process.env.CLAUDECODE) {
|
|
16043
|
-
console.error(
|
|
16083
|
+
console.error(chalk165.cyan(`
|
|
16044
16084
|
## Extracting Code to New Files
|
|
16045
16085
|
`));
|
|
16046
16086
|
console.error(
|
|
16047
|
-
|
|
16087
|
+
chalk165.cyan(
|
|
16048
16088
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
16049
16089
|
`
|
|
16050
16090
|
)
|
|
16051
16091
|
);
|
|
16052
16092
|
console.error(
|
|
16053
|
-
|
|
16093
|
+
chalk165.cyan(
|
|
16054
16094
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
16055
16095
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
16056
16096
|
`
|
|
16057
16097
|
)
|
|
16058
16098
|
);
|
|
16059
16099
|
console.error(
|
|
16060
|
-
|
|
16100
|
+
chalk165.cyan(
|
|
16061
16101
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
16062
16102
|
domains, move it to a common/shared folder.
|
|
16063
16103
|
`
|
|
@@ -16213,7 +16253,7 @@ async function check(pattern2, options2) {
|
|
|
16213
16253
|
|
|
16214
16254
|
// src/commands/refactor/extract/index.ts
|
|
16215
16255
|
import path35 from "path";
|
|
16216
|
-
import
|
|
16256
|
+
import chalk168 from "chalk";
|
|
16217
16257
|
|
|
16218
16258
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
16219
16259
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -16788,23 +16828,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
16788
16828
|
|
|
16789
16829
|
// src/commands/refactor/extract/displayPlan.ts
|
|
16790
16830
|
import path32 from "path";
|
|
16791
|
-
import
|
|
16831
|
+
import chalk166 from "chalk";
|
|
16792
16832
|
function section(title) {
|
|
16793
16833
|
return `
|
|
16794
|
-
${
|
|
16834
|
+
${chalk166.cyan(title)}`;
|
|
16795
16835
|
}
|
|
16796
16836
|
function displayImporters(plan2, cwd) {
|
|
16797
16837
|
if (plan2.importersToUpdate.length === 0) return;
|
|
16798
16838
|
console.log(section("Update importers:"));
|
|
16799
16839
|
for (const imp of plan2.importersToUpdate) {
|
|
16800
16840
|
const rel = path32.relative(cwd, imp.file.getFilePath());
|
|
16801
|
-
console.log(` ${
|
|
16841
|
+
console.log(` ${chalk166.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
16802
16842
|
}
|
|
16803
16843
|
}
|
|
16804
16844
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
16805
|
-
console.log(
|
|
16845
|
+
console.log(chalk166.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
16806
16846
|
`));
|
|
16807
|
-
console.log(` ${
|
|
16847
|
+
console.log(` ${chalk166.cyan("Functions to move:")}`);
|
|
16808
16848
|
for (const name of plan2.extractedNames) {
|
|
16809
16849
|
console.log(` ${name}`);
|
|
16810
16850
|
}
|
|
@@ -16838,7 +16878,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
16838
16878
|
|
|
16839
16879
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
16840
16880
|
import path34 from "path";
|
|
16841
|
-
import
|
|
16881
|
+
import chalk167 from "chalk";
|
|
16842
16882
|
import { Project as Project4 } from "ts-morph";
|
|
16843
16883
|
|
|
16844
16884
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -16898,7 +16938,7 @@ function loadProjectFile(file) {
|
|
|
16898
16938
|
});
|
|
16899
16939
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
16900
16940
|
if (!sourceFile) {
|
|
16901
|
-
console.log(
|
|
16941
|
+
console.log(chalk167.red(`File not found in project: ${file}`));
|
|
16902
16942
|
process.exit(1);
|
|
16903
16943
|
}
|
|
16904
16944
|
return { project, sourceFile };
|
|
@@ -16921,19 +16961,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
16921
16961
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
16922
16962
|
if (options2.apply) {
|
|
16923
16963
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
16924
|
-
console.log(
|
|
16964
|
+
console.log(chalk168.green("\nExtraction complete"));
|
|
16925
16965
|
} else {
|
|
16926
|
-
console.log(
|
|
16966
|
+
console.log(chalk168.dim("\nDry run. Use --apply to execute."));
|
|
16927
16967
|
}
|
|
16928
16968
|
}
|
|
16929
16969
|
|
|
16930
16970
|
// src/commands/refactor/ignore.ts
|
|
16931
16971
|
import fs24 from "fs";
|
|
16932
|
-
import
|
|
16972
|
+
import chalk169 from "chalk";
|
|
16933
16973
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
16934
16974
|
function ignore2(file) {
|
|
16935
16975
|
if (!fs24.existsSync(file)) {
|
|
16936
|
-
console.error(
|
|
16976
|
+
console.error(chalk169.red(`Error: File does not exist: ${file}`));
|
|
16937
16977
|
process.exit(1);
|
|
16938
16978
|
}
|
|
16939
16979
|
const content = fs24.readFileSync(file, "utf8");
|
|
@@ -16949,7 +16989,7 @@ function ignore2(file) {
|
|
|
16949
16989
|
fs24.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
16950
16990
|
}
|
|
16951
16991
|
console.log(
|
|
16952
|
-
|
|
16992
|
+
chalk169.green(
|
|
16953
16993
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
16954
16994
|
)
|
|
16955
16995
|
);
|
|
@@ -16958,12 +16998,12 @@ function ignore2(file) {
|
|
|
16958
16998
|
// src/commands/refactor/rename/index.ts
|
|
16959
16999
|
import fs27 from "fs";
|
|
16960
17000
|
import path40 from "path";
|
|
16961
|
-
import
|
|
17001
|
+
import chalk172 from "chalk";
|
|
16962
17002
|
|
|
16963
17003
|
// src/commands/refactor/rename/applyRename.ts
|
|
16964
17004
|
import fs26 from "fs";
|
|
16965
17005
|
import path37 from "path";
|
|
16966
|
-
import
|
|
17006
|
+
import chalk170 from "chalk";
|
|
16967
17007
|
|
|
16968
17008
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
16969
17009
|
import path36 from "path";
|
|
@@ -17068,13 +17108,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
17068
17108
|
const updatedContents = applyRewrites(rewrites);
|
|
17069
17109
|
for (const [file, content] of updatedContents) {
|
|
17070
17110
|
fs26.writeFileSync(file, content, "utf8");
|
|
17071
|
-
console.log(
|
|
17111
|
+
console.log(chalk170.cyan(` Updated imports in ${path37.relative(cwd, file)}`));
|
|
17072
17112
|
}
|
|
17073
17113
|
const destDir = path37.dirname(destPath);
|
|
17074
17114
|
if (!fs26.existsSync(destDir)) fs26.mkdirSync(destDir, { recursive: true });
|
|
17075
17115
|
fs26.renameSync(sourcePath, destPath);
|
|
17076
17116
|
console.log(
|
|
17077
|
-
|
|
17117
|
+
chalk170.white(
|
|
17078
17118
|
` Moved ${path37.relative(cwd, sourcePath)} \u2192 ${path37.relative(cwd, destPath)}`
|
|
17079
17119
|
)
|
|
17080
17120
|
);
|
|
@@ -17161,16 +17201,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
17161
17201
|
|
|
17162
17202
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
17163
17203
|
import path39 from "path";
|
|
17164
|
-
import
|
|
17204
|
+
import chalk171 from "chalk";
|
|
17165
17205
|
function printRenamePreview(rewrites, cwd) {
|
|
17166
17206
|
for (const rewrite of rewrites) {
|
|
17167
17207
|
console.log(
|
|
17168
|
-
|
|
17208
|
+
chalk171.dim(
|
|
17169
17209
|
` ${path39.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
17170
17210
|
)
|
|
17171
17211
|
);
|
|
17172
17212
|
}
|
|
17173
|
-
console.log(
|
|
17213
|
+
console.log(chalk171.dim("Dry run. Use --apply to execute."));
|
|
17174
17214
|
}
|
|
17175
17215
|
|
|
17176
17216
|
// src/commands/refactor/rename/index.ts
|
|
@@ -17181,20 +17221,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
17181
17221
|
const relSource = path40.relative(cwd, sourcePath);
|
|
17182
17222
|
const relDest = path40.relative(cwd, destPath);
|
|
17183
17223
|
if (!fs27.existsSync(sourcePath)) {
|
|
17184
|
-
console.log(
|
|
17224
|
+
console.log(chalk172.red(`File not found: ${source}`));
|
|
17185
17225
|
process.exit(1);
|
|
17186
17226
|
}
|
|
17187
17227
|
if (destPath !== sourcePath && fs27.existsSync(destPath)) {
|
|
17188
|
-
console.log(
|
|
17228
|
+
console.log(chalk172.red(`Destination already exists: ${destination}`));
|
|
17189
17229
|
process.exit(1);
|
|
17190
17230
|
}
|
|
17191
|
-
console.log(
|
|
17192
|
-
console.log(
|
|
17193
|
-
console.log(
|
|
17231
|
+
console.log(chalk172.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
17232
|
+
console.log(chalk172.dim("Loading project..."));
|
|
17233
|
+
console.log(chalk172.dim("Scanning imports across the project..."));
|
|
17194
17234
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
17195
17235
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
17196
17236
|
console.log(
|
|
17197
|
-
|
|
17237
|
+
chalk172.dim(
|
|
17198
17238
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
17199
17239
|
)
|
|
17200
17240
|
);
|
|
@@ -17203,11 +17243,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
17203
17243
|
return;
|
|
17204
17244
|
}
|
|
17205
17245
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
17206
|
-
console.log(
|
|
17246
|
+
console.log(chalk172.green("Done"));
|
|
17207
17247
|
}
|
|
17208
17248
|
|
|
17209
17249
|
// src/commands/refactor/renameSymbol/index.ts
|
|
17210
|
-
import
|
|
17250
|
+
import chalk173 from "chalk";
|
|
17211
17251
|
|
|
17212
17252
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
17213
17253
|
import { SyntaxKind as SyntaxKind14 } from "ts-morph";
|
|
@@ -17253,33 +17293,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
17253
17293
|
const { project, sourceFile } = loadProjectFile(file);
|
|
17254
17294
|
const symbol = findSymbol(sourceFile, oldName);
|
|
17255
17295
|
if (!symbol) {
|
|
17256
|
-
console.log(
|
|
17296
|
+
console.log(chalk173.red(`Symbol "${oldName}" not found in ${file}`));
|
|
17257
17297
|
process.exit(1);
|
|
17258
17298
|
}
|
|
17259
17299
|
const grouped = groupReferences(symbol, cwd);
|
|
17260
17300
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
17261
17301
|
console.log(
|
|
17262
|
-
|
|
17302
|
+
chalk173.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
17263
17303
|
`)
|
|
17264
17304
|
);
|
|
17265
17305
|
for (const [refFile, lines] of grouped) {
|
|
17266
17306
|
console.log(
|
|
17267
|
-
` ${
|
|
17307
|
+
` ${chalk173.dim(refFile)}: lines ${chalk173.cyan(lines.join(", "))}`
|
|
17268
17308
|
);
|
|
17269
17309
|
}
|
|
17270
17310
|
if (options2.apply) {
|
|
17271
17311
|
symbol.rename(newName);
|
|
17272
17312
|
await project.save();
|
|
17273
|
-
console.log(
|
|
17313
|
+
console.log(chalk173.green(`
|
|
17274
17314
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
17275
17315
|
} else {
|
|
17276
|
-
console.log(
|
|
17316
|
+
console.log(chalk173.dim("\nDry run. Use --apply to execute."));
|
|
17277
17317
|
}
|
|
17278
17318
|
}
|
|
17279
17319
|
|
|
17280
17320
|
// src/commands/refactor/restructure/index.ts
|
|
17281
17321
|
import path48 from "path";
|
|
17282
|
-
import
|
|
17322
|
+
import chalk176 from "chalk";
|
|
17283
17323
|
|
|
17284
17324
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
17285
17325
|
import path42 from "path";
|
|
@@ -17358,50 +17398,50 @@ function clusterFiles(graph) {
|
|
|
17358
17398
|
|
|
17359
17399
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
17360
17400
|
import path44 from "path";
|
|
17361
|
-
import
|
|
17401
|
+
import chalk174 from "chalk";
|
|
17362
17402
|
function relPath(filePath) {
|
|
17363
17403
|
return path44.relative(process.cwd(), filePath);
|
|
17364
17404
|
}
|
|
17365
17405
|
function displayMoves(plan2) {
|
|
17366
17406
|
if (plan2.moves.length === 0) return;
|
|
17367
|
-
console.log(
|
|
17407
|
+
console.log(chalk174.bold("\nFile moves:"));
|
|
17368
17408
|
for (const move2 of plan2.moves) {
|
|
17369
17409
|
console.log(
|
|
17370
|
-
` ${
|
|
17410
|
+
` ${chalk174.red(relPath(move2.from))} \u2192 ${chalk174.green(relPath(move2.to))}`
|
|
17371
17411
|
);
|
|
17372
|
-
console.log(
|
|
17412
|
+
console.log(chalk174.dim(` ${move2.reason}`));
|
|
17373
17413
|
}
|
|
17374
17414
|
}
|
|
17375
17415
|
function displayRewrites(rewrites) {
|
|
17376
17416
|
if (rewrites.length === 0) return;
|
|
17377
17417
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
17378
|
-
console.log(
|
|
17418
|
+
console.log(chalk174.bold(`
|
|
17379
17419
|
Import rewrites (${affectedFiles.size} files):`));
|
|
17380
17420
|
for (const file of affectedFiles) {
|
|
17381
|
-
console.log(` ${
|
|
17421
|
+
console.log(` ${chalk174.cyan(relPath(file))}:`);
|
|
17382
17422
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
17383
17423
|
(r) => r.file === file
|
|
17384
17424
|
)) {
|
|
17385
17425
|
console.log(
|
|
17386
|
-
` ${
|
|
17426
|
+
` ${chalk174.red(`"${oldSpecifier}"`)} \u2192 ${chalk174.green(`"${newSpecifier}"`)}`
|
|
17387
17427
|
);
|
|
17388
17428
|
}
|
|
17389
17429
|
}
|
|
17390
17430
|
}
|
|
17391
17431
|
function displayPlan2(plan2) {
|
|
17392
17432
|
if (plan2.warnings.length > 0) {
|
|
17393
|
-
console.log(
|
|
17394
|
-
for (const w of plan2.warnings) console.log(
|
|
17433
|
+
console.log(chalk174.yellow("\nWarnings:"));
|
|
17434
|
+
for (const w of plan2.warnings) console.log(chalk174.yellow(` ${w}`));
|
|
17395
17435
|
}
|
|
17396
17436
|
if (plan2.newDirectories.length > 0) {
|
|
17397
|
-
console.log(
|
|
17437
|
+
console.log(chalk174.bold("\nNew directories:"));
|
|
17398
17438
|
for (const dir of plan2.newDirectories)
|
|
17399
|
-
console.log(
|
|
17439
|
+
console.log(chalk174.green(` ${dir}/`));
|
|
17400
17440
|
}
|
|
17401
17441
|
displayMoves(plan2);
|
|
17402
17442
|
displayRewrites(plan2.rewrites);
|
|
17403
17443
|
console.log(
|
|
17404
|
-
|
|
17444
|
+
chalk174.dim(
|
|
17405
17445
|
`
|
|
17406
17446
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
17407
17447
|
)
|
|
@@ -17411,18 +17451,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
17411
17451
|
// src/commands/refactor/restructure/executePlan.ts
|
|
17412
17452
|
import fs28 from "fs";
|
|
17413
17453
|
import path45 from "path";
|
|
17414
|
-
import
|
|
17454
|
+
import chalk175 from "chalk";
|
|
17415
17455
|
function executePlan(plan2) {
|
|
17416
17456
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
17417
17457
|
for (const [file, content] of updatedContents) {
|
|
17418
17458
|
fs28.writeFileSync(file, content, "utf8");
|
|
17419
17459
|
console.log(
|
|
17420
|
-
|
|
17460
|
+
chalk175.cyan(` Rewrote imports in ${path45.relative(process.cwd(), file)}`)
|
|
17421
17461
|
);
|
|
17422
17462
|
}
|
|
17423
17463
|
for (const dir of plan2.newDirectories) {
|
|
17424
17464
|
fs28.mkdirSync(dir, { recursive: true });
|
|
17425
|
-
console.log(
|
|
17465
|
+
console.log(chalk175.green(` Created ${path45.relative(process.cwd(), dir)}/`));
|
|
17426
17466
|
}
|
|
17427
17467
|
for (const move2 of plan2.moves) {
|
|
17428
17468
|
const targetDir = path45.dirname(move2.to);
|
|
@@ -17431,7 +17471,7 @@ function executePlan(plan2) {
|
|
|
17431
17471
|
}
|
|
17432
17472
|
fs28.renameSync(move2.from, move2.to);
|
|
17433
17473
|
console.log(
|
|
17434
|
-
|
|
17474
|
+
chalk175.white(
|
|
17435
17475
|
` Moved ${path45.relative(process.cwd(), move2.from)} \u2192 ${path45.relative(process.cwd(), move2.to)}`
|
|
17436
17476
|
)
|
|
17437
17477
|
);
|
|
@@ -17446,7 +17486,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
17446
17486
|
if (entries.length === 0) {
|
|
17447
17487
|
fs28.rmdirSync(dir);
|
|
17448
17488
|
console.log(
|
|
17449
|
-
|
|
17489
|
+
chalk175.dim(
|
|
17450
17490
|
` Removed empty directory ${path45.relative(process.cwd(), dir)}`
|
|
17451
17491
|
)
|
|
17452
17492
|
);
|
|
@@ -17579,22 +17619,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
17579
17619
|
const targetPattern = pattern2 ?? "src";
|
|
17580
17620
|
const files = findSourceFiles2(targetPattern);
|
|
17581
17621
|
if (files.length === 0) {
|
|
17582
|
-
console.log(
|
|
17622
|
+
console.log(chalk176.yellow("No files found matching pattern"));
|
|
17583
17623
|
return;
|
|
17584
17624
|
}
|
|
17585
17625
|
const tsConfigPath = path48.resolve("tsconfig.json");
|
|
17586
17626
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
17587
17627
|
if (plan2.moves.length === 0) {
|
|
17588
|
-
console.log(
|
|
17628
|
+
console.log(chalk176.green("No restructuring needed"));
|
|
17589
17629
|
return;
|
|
17590
17630
|
}
|
|
17591
17631
|
displayPlan2(plan2);
|
|
17592
17632
|
if (options2.apply) {
|
|
17593
|
-
console.log(
|
|
17633
|
+
console.log(chalk176.bold("\nApplying changes..."));
|
|
17594
17634
|
executePlan(plan2);
|
|
17595
|
-
console.log(
|
|
17635
|
+
console.log(chalk176.green("\nRestructuring complete"));
|
|
17596
17636
|
} else {
|
|
17597
|
-
console.log(
|
|
17637
|
+
console.log(chalk176.dim("\nDry run. Use --apply to execute."));
|
|
17598
17638
|
}
|
|
17599
17639
|
}
|
|
17600
17640
|
|
|
@@ -18167,18 +18207,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
18167
18207
|
}
|
|
18168
18208
|
|
|
18169
18209
|
// src/commands/review/warnOutOfDiff.ts
|
|
18170
|
-
import
|
|
18210
|
+
import chalk177 from "chalk";
|
|
18171
18211
|
function warnOutOfDiff(outOfDiff) {
|
|
18172
18212
|
if (outOfDiff.length === 0) return;
|
|
18173
18213
|
console.warn(
|
|
18174
|
-
|
|
18214
|
+
chalk177.yellow(
|
|
18175
18215
|
`Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
|
|
18176
18216
|
)
|
|
18177
18217
|
);
|
|
18178
18218
|
for (const finding of outOfDiff) {
|
|
18179
18219
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
18180
18220
|
console.warn(
|
|
18181
|
-
` ${
|
|
18221
|
+
` ${chalk177.yellow("\xB7")} ${finding.title} ${chalk177.dim(
|
|
18182
18222
|
`(${finding.file}:${range})`
|
|
18183
18223
|
)}`
|
|
18184
18224
|
);
|
|
@@ -18197,18 +18237,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
18197
18237
|
}
|
|
18198
18238
|
|
|
18199
18239
|
// src/commands/review/warnUnlocated.ts
|
|
18200
|
-
import
|
|
18240
|
+
import chalk178 from "chalk";
|
|
18201
18241
|
function warnUnlocated(unlocated) {
|
|
18202
18242
|
if (unlocated.length === 0) return;
|
|
18203
18243
|
console.warn(
|
|
18204
|
-
|
|
18244
|
+
chalk178.yellow(
|
|
18205
18245
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
18206
18246
|
)
|
|
18207
18247
|
);
|
|
18208
18248
|
for (const finding of unlocated) {
|
|
18209
|
-
const where = finding.location ||
|
|
18249
|
+
const where = finding.location || chalk178.dim("missing");
|
|
18210
18250
|
console.warn(
|
|
18211
|
-
` ${
|
|
18251
|
+
` ${chalk178.yellow("\xB7")} ${finding.title} ${chalk178.dim(`(${where})`)}`
|
|
18212
18252
|
);
|
|
18213
18253
|
}
|
|
18214
18254
|
}
|
|
@@ -19380,7 +19420,7 @@ function registerReview(program2) {
|
|
|
19380
19420
|
}
|
|
19381
19421
|
|
|
19382
19422
|
// src/commands/seq/seqAuth.ts
|
|
19383
|
-
import
|
|
19423
|
+
import chalk180 from "chalk";
|
|
19384
19424
|
|
|
19385
19425
|
// src/commands/seq/loadConnections.ts
|
|
19386
19426
|
function loadConnections2() {
|
|
@@ -19409,10 +19449,10 @@ function setDefaultConnection(name) {
|
|
|
19409
19449
|
}
|
|
19410
19450
|
|
|
19411
19451
|
// src/shared/assertUniqueName.ts
|
|
19412
|
-
import
|
|
19452
|
+
import chalk179 from "chalk";
|
|
19413
19453
|
function assertUniqueName(existingNames, name) {
|
|
19414
19454
|
if (existingNames.includes(name)) {
|
|
19415
|
-
console.error(
|
|
19455
|
+
console.error(chalk179.red(`Connection "${name}" already exists.`));
|
|
19416
19456
|
process.exit(1);
|
|
19417
19457
|
}
|
|
19418
19458
|
}
|
|
@@ -19430,16 +19470,16 @@ async function promptConnection2(existingNames) {
|
|
|
19430
19470
|
var seqAuth = createConnectionAuth({
|
|
19431
19471
|
load: loadConnections2,
|
|
19432
19472
|
save: saveConnections2,
|
|
19433
|
-
format: (c) => `${
|
|
19473
|
+
format: (c) => `${chalk180.bold(c.name)} ${c.url}`,
|
|
19434
19474
|
promptNew: promptConnection2,
|
|
19435
19475
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
19436
19476
|
});
|
|
19437
19477
|
|
|
19438
19478
|
// src/commands/seq/seqQuery.ts
|
|
19439
|
-
import
|
|
19479
|
+
import chalk184 from "chalk";
|
|
19440
19480
|
|
|
19441
19481
|
// src/commands/seq/fetchSeq.ts
|
|
19442
|
-
import
|
|
19482
|
+
import chalk181 from "chalk";
|
|
19443
19483
|
async function fetchSeq(conn, path57, params) {
|
|
19444
19484
|
const url = `${conn.url}${path57}?${params}`;
|
|
19445
19485
|
const response = await fetch(url, {
|
|
@@ -19450,7 +19490,7 @@ async function fetchSeq(conn, path57, params) {
|
|
|
19450
19490
|
});
|
|
19451
19491
|
if (!response.ok) {
|
|
19452
19492
|
const body = await response.text();
|
|
19453
|
-
console.error(
|
|
19493
|
+
console.error(chalk181.red(`Seq returned ${response.status}: ${body}`));
|
|
19454
19494
|
process.exit(1);
|
|
19455
19495
|
}
|
|
19456
19496
|
return response;
|
|
@@ -19509,23 +19549,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
19509
19549
|
}
|
|
19510
19550
|
|
|
19511
19551
|
// src/commands/seq/formatEvent.ts
|
|
19512
|
-
import
|
|
19552
|
+
import chalk182 from "chalk";
|
|
19513
19553
|
function levelColor(level) {
|
|
19514
19554
|
switch (level) {
|
|
19515
19555
|
case "Fatal":
|
|
19516
|
-
return
|
|
19556
|
+
return chalk182.bgRed.white;
|
|
19517
19557
|
case "Error":
|
|
19518
|
-
return
|
|
19558
|
+
return chalk182.red;
|
|
19519
19559
|
case "Warning":
|
|
19520
|
-
return
|
|
19560
|
+
return chalk182.yellow;
|
|
19521
19561
|
case "Information":
|
|
19522
|
-
return
|
|
19562
|
+
return chalk182.cyan;
|
|
19523
19563
|
case "Debug":
|
|
19524
|
-
return
|
|
19564
|
+
return chalk182.gray;
|
|
19525
19565
|
case "Verbose":
|
|
19526
|
-
return
|
|
19566
|
+
return chalk182.dim;
|
|
19527
19567
|
default:
|
|
19528
|
-
return
|
|
19568
|
+
return chalk182.white;
|
|
19529
19569
|
}
|
|
19530
19570
|
}
|
|
19531
19571
|
function levelAbbrev(level) {
|
|
@@ -19566,12 +19606,12 @@ function formatTimestamp(iso) {
|
|
|
19566
19606
|
function formatEvent(event) {
|
|
19567
19607
|
const color = levelColor(event.Level);
|
|
19568
19608
|
const abbrev = levelAbbrev(event.Level);
|
|
19569
|
-
const ts8 =
|
|
19609
|
+
const ts8 = chalk182.dim(formatTimestamp(event.Timestamp));
|
|
19570
19610
|
const msg = renderMessage(event);
|
|
19571
19611
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
19572
19612
|
if (event.Exception) {
|
|
19573
19613
|
for (const line of event.Exception.split("\n")) {
|
|
19574
|
-
lines.push(
|
|
19614
|
+
lines.push(chalk182.red(` ${line}`));
|
|
19575
19615
|
}
|
|
19576
19616
|
}
|
|
19577
19617
|
return lines.join("\n");
|
|
@@ -19604,11 +19644,11 @@ function rejectTimestampFilter(filter) {
|
|
|
19604
19644
|
}
|
|
19605
19645
|
|
|
19606
19646
|
// src/shared/resolveNamedConnection.ts
|
|
19607
|
-
import
|
|
19647
|
+
import chalk183 from "chalk";
|
|
19608
19648
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
19609
19649
|
if (connections.length === 0) {
|
|
19610
19650
|
console.error(
|
|
19611
|
-
|
|
19651
|
+
chalk183.red(
|
|
19612
19652
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
19613
19653
|
)
|
|
19614
19654
|
);
|
|
@@ -19617,7 +19657,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
19617
19657
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
19618
19658
|
const connection = connections.find((c) => c.name === target);
|
|
19619
19659
|
if (!connection) {
|
|
19620
|
-
console.error(
|
|
19660
|
+
console.error(chalk183.red(`${kind} connection "${target}" not found.`));
|
|
19621
19661
|
process.exit(1);
|
|
19622
19662
|
}
|
|
19623
19663
|
return connection;
|
|
@@ -19646,7 +19686,7 @@ async function seqQuery(filter, options2) {
|
|
|
19646
19686
|
new URLSearchParams({ filter, count: String(count8) })
|
|
19647
19687
|
);
|
|
19648
19688
|
if (events.length === 0) {
|
|
19649
|
-
console.log(
|
|
19689
|
+
console.log(chalk184.yellow("No events found."));
|
|
19650
19690
|
return;
|
|
19651
19691
|
}
|
|
19652
19692
|
if (options2.json) {
|
|
@@ -19657,11 +19697,11 @@ async function seqQuery(filter, options2) {
|
|
|
19657
19697
|
for (const event of chronological) {
|
|
19658
19698
|
console.log(formatEvent(event));
|
|
19659
19699
|
}
|
|
19660
|
-
console.log(
|
|
19700
|
+
console.log(chalk184.dim(`
|
|
19661
19701
|
${events.length} events`));
|
|
19662
19702
|
if (events.length >= count8) {
|
|
19663
19703
|
console.log(
|
|
19664
|
-
|
|
19704
|
+
chalk184.yellow(
|
|
19665
19705
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
19666
19706
|
)
|
|
19667
19707
|
);
|
|
@@ -19669,10 +19709,10 @@ ${events.length} events`));
|
|
|
19669
19709
|
}
|
|
19670
19710
|
|
|
19671
19711
|
// src/shared/setNamedDefaultConnection.ts
|
|
19672
|
-
import
|
|
19712
|
+
import chalk185 from "chalk";
|
|
19673
19713
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
19674
19714
|
if (!connections.find((c) => c.name === name)) {
|
|
19675
|
-
console.error(
|
|
19715
|
+
console.error(chalk185.red(`Connection "${name}" not found.`));
|
|
19676
19716
|
process.exit(1);
|
|
19677
19717
|
}
|
|
19678
19718
|
setDefault(name);
|
|
@@ -19720,7 +19760,7 @@ function registerSignal(program2) {
|
|
|
19720
19760
|
}
|
|
19721
19761
|
|
|
19722
19762
|
// src/commands/sql/sqlAuth.ts
|
|
19723
|
-
import
|
|
19763
|
+
import chalk187 from "chalk";
|
|
19724
19764
|
|
|
19725
19765
|
// src/commands/sql/loadConnections.ts
|
|
19726
19766
|
function loadConnections3() {
|
|
@@ -19749,7 +19789,7 @@ function setDefaultConnection2(name) {
|
|
|
19749
19789
|
}
|
|
19750
19790
|
|
|
19751
19791
|
// src/commands/sql/promptConnection.ts
|
|
19752
|
-
import
|
|
19792
|
+
import chalk186 from "chalk";
|
|
19753
19793
|
async function promptConnection3(existingNames) {
|
|
19754
19794
|
const name = await promptInput("name", "Connection name:", "default");
|
|
19755
19795
|
assertUniqueName(existingNames, name);
|
|
@@ -19757,7 +19797,7 @@ async function promptConnection3(existingNames) {
|
|
|
19757
19797
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
19758
19798
|
const port = Number.parseInt(portStr, 10);
|
|
19759
19799
|
if (!Number.isFinite(port)) {
|
|
19760
|
-
console.error(
|
|
19800
|
+
console.error(chalk186.red(`Invalid port "${portStr}".`));
|
|
19761
19801
|
process.exit(1);
|
|
19762
19802
|
}
|
|
19763
19803
|
const user = await promptInput("user", "User:");
|
|
@@ -19770,13 +19810,13 @@ async function promptConnection3(existingNames) {
|
|
|
19770
19810
|
var sqlAuth = createConnectionAuth({
|
|
19771
19811
|
load: loadConnections3,
|
|
19772
19812
|
save: saveConnections3,
|
|
19773
|
-
format: (c) => `${
|
|
19813
|
+
format: (c) => `${chalk187.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
19774
19814
|
promptNew: promptConnection3,
|
|
19775
19815
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
19776
19816
|
});
|
|
19777
19817
|
|
|
19778
19818
|
// src/commands/sql/printTable.ts
|
|
19779
|
-
import
|
|
19819
|
+
import chalk188 from "chalk";
|
|
19780
19820
|
function formatCell(value) {
|
|
19781
19821
|
if (value === null || value === void 0) return "";
|
|
19782
19822
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -19785,7 +19825,7 @@ function formatCell(value) {
|
|
|
19785
19825
|
}
|
|
19786
19826
|
function printTable(rows) {
|
|
19787
19827
|
if (rows.length === 0) {
|
|
19788
|
-
console.log(
|
|
19828
|
+
console.log(chalk188.yellow("(no rows)"));
|
|
19789
19829
|
return;
|
|
19790
19830
|
}
|
|
19791
19831
|
const columns = Object.keys(rows[0]);
|
|
@@ -19793,13 +19833,13 @@ function printTable(rows) {
|
|
|
19793
19833
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
19794
19834
|
);
|
|
19795
19835
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
19796
|
-
console.log(
|
|
19797
|
-
console.log(
|
|
19836
|
+
console.log(chalk188.dim(header));
|
|
19837
|
+
console.log(chalk188.dim("-".repeat(header.length)));
|
|
19798
19838
|
for (const row of rows) {
|
|
19799
19839
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
19800
19840
|
console.log(line);
|
|
19801
19841
|
}
|
|
19802
|
-
console.log(
|
|
19842
|
+
console.log(chalk188.dim(`
|
|
19803
19843
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
19804
19844
|
}
|
|
19805
19845
|
|
|
@@ -19859,7 +19899,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
19859
19899
|
}
|
|
19860
19900
|
|
|
19861
19901
|
// src/commands/sql/sqlMutate.ts
|
|
19862
|
-
import
|
|
19902
|
+
import chalk189 from "chalk";
|
|
19863
19903
|
|
|
19864
19904
|
// src/commands/sql/isMutation.ts
|
|
19865
19905
|
var MUTATION_KEYWORDS = [
|
|
@@ -19893,7 +19933,7 @@ function isMutation(sql11) {
|
|
|
19893
19933
|
async function sqlMutate(query, connectionName) {
|
|
19894
19934
|
if (!isMutation(query)) {
|
|
19895
19935
|
console.error(
|
|
19896
|
-
|
|
19936
|
+
chalk189.red(
|
|
19897
19937
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
19898
19938
|
)
|
|
19899
19939
|
);
|
|
@@ -19903,18 +19943,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
19903
19943
|
const pool = await sqlConnect(conn);
|
|
19904
19944
|
try {
|
|
19905
19945
|
const result = await pool.request().query(query);
|
|
19906
|
-
console.log(
|
|
19946
|
+
console.log(chalk189.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
19907
19947
|
} finally {
|
|
19908
19948
|
await pool.close();
|
|
19909
19949
|
}
|
|
19910
19950
|
}
|
|
19911
19951
|
|
|
19912
19952
|
// src/commands/sql/sqlQuery.ts
|
|
19913
|
-
import
|
|
19953
|
+
import chalk190 from "chalk";
|
|
19914
19954
|
async function sqlQuery(query, connectionName) {
|
|
19915
19955
|
if (isMutation(query)) {
|
|
19916
19956
|
console.error(
|
|
19917
|
-
|
|
19957
|
+
chalk190.red(
|
|
19918
19958
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
19919
19959
|
)
|
|
19920
19960
|
);
|
|
@@ -19929,7 +19969,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
19929
19969
|
printTable(rows);
|
|
19930
19970
|
} else {
|
|
19931
19971
|
console.log(
|
|
19932
|
-
|
|
19972
|
+
chalk190.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
19933
19973
|
);
|
|
19934
19974
|
}
|
|
19935
19975
|
} finally {
|
|
@@ -20626,7 +20666,7 @@ function registerVoice(program2) {
|
|
|
20626
20666
|
|
|
20627
20667
|
// src/commands/roam/auth.ts
|
|
20628
20668
|
import { randomBytes } from "crypto";
|
|
20629
|
-
import
|
|
20669
|
+
import chalk191 from "chalk";
|
|
20630
20670
|
|
|
20631
20671
|
// src/commands/roam/waitForCallback.ts
|
|
20632
20672
|
import { createServer as createServer3 } from "http";
|
|
@@ -20757,13 +20797,13 @@ async function auth() {
|
|
|
20757
20797
|
saveGlobalConfig(config);
|
|
20758
20798
|
const state = randomBytes(16).toString("hex");
|
|
20759
20799
|
console.log(
|
|
20760
|
-
|
|
20800
|
+
chalk191.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
20761
20801
|
);
|
|
20762
|
-
console.log(
|
|
20763
|
-
console.log(
|
|
20764
|
-
console.log(
|
|
20802
|
+
console.log(chalk191.white("http://localhost:14523/callback\n"));
|
|
20803
|
+
console.log(chalk191.blue("Opening browser for authorization..."));
|
|
20804
|
+
console.log(chalk191.dim("Waiting for authorization callback..."));
|
|
20765
20805
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
20766
|
-
console.log(
|
|
20806
|
+
console.log(chalk191.dim("Exchanging code for tokens..."));
|
|
20767
20807
|
const tokens = await exchangeToken({
|
|
20768
20808
|
code,
|
|
20769
20809
|
clientId,
|
|
@@ -20779,7 +20819,7 @@ async function auth() {
|
|
|
20779
20819
|
};
|
|
20780
20820
|
saveGlobalConfig(config);
|
|
20781
20821
|
console.log(
|
|
20782
|
-
|
|
20822
|
+
chalk191.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
20783
20823
|
);
|
|
20784
20824
|
}
|
|
20785
20825
|
|
|
@@ -21231,7 +21271,7 @@ import { execSync as execSync54 } from "child_process";
|
|
|
21231
21271
|
import { existsSync as existsSync51, mkdirSync as mkdirSync22, unlinkSync as unlinkSync19, writeFileSync as writeFileSync39 } from "fs";
|
|
21232
21272
|
import { tmpdir as tmpdir7 } from "os";
|
|
21233
21273
|
import { join as join61, resolve as resolve15 } from "path";
|
|
21234
|
-
import
|
|
21274
|
+
import chalk192 from "chalk";
|
|
21235
21275
|
|
|
21236
21276
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
21237
21277
|
var captureWindowPs1 = `
|
|
@@ -21382,13 +21422,13 @@ function screenshot(processName) {
|
|
|
21382
21422
|
const config = loadConfig();
|
|
21383
21423
|
const outputDir = resolve15(config.screenshot.outputDir);
|
|
21384
21424
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
21385
|
-
console.log(
|
|
21425
|
+
console.log(chalk192.gray(`Capturing window for process "${processName}" ...`));
|
|
21386
21426
|
try {
|
|
21387
21427
|
runPowerShellScript(processName, outputPath);
|
|
21388
|
-
console.log(
|
|
21428
|
+
console.log(chalk192.green(`Screenshot saved: ${outputPath}`));
|
|
21389
21429
|
} catch (error) {
|
|
21390
21430
|
const msg = error instanceof Error ? error.message : String(error);
|
|
21391
|
-
console.error(
|
|
21431
|
+
console.error(chalk192.red(`Failed to capture screenshot: ${msg}`));
|
|
21392
21432
|
process.exit(1);
|
|
21393
21433
|
}
|
|
21394
21434
|
}
|
|
@@ -24049,7 +24089,7 @@ function registerDaemon(program2) {
|
|
|
24049
24089
|
|
|
24050
24090
|
// src/commands/sessions/summarise/index.ts
|
|
24051
24091
|
import * as fs36 from "fs";
|
|
24052
|
-
import
|
|
24092
|
+
import chalk193 from "chalk";
|
|
24053
24093
|
|
|
24054
24094
|
// src/commands/sessions/summarise/shared.ts
|
|
24055
24095
|
import * as fs34 from "fs";
|
|
@@ -24203,22 +24243,22 @@ ${firstMessage}`);
|
|
|
24203
24243
|
async function summarise2(options2) {
|
|
24204
24244
|
const files = await discoverSessionFiles();
|
|
24205
24245
|
if (files.length === 0) {
|
|
24206
|
-
console.log(
|
|
24246
|
+
console.log(chalk193.yellow("No sessions found."));
|
|
24207
24247
|
return;
|
|
24208
24248
|
}
|
|
24209
24249
|
const toProcess = selectCandidates(files, options2);
|
|
24210
24250
|
if (toProcess.length === 0) {
|
|
24211
|
-
console.log(
|
|
24251
|
+
console.log(chalk193.green("All sessions already summarised."));
|
|
24212
24252
|
return;
|
|
24213
24253
|
}
|
|
24214
24254
|
console.log(
|
|
24215
|
-
|
|
24255
|
+
chalk193.cyan(
|
|
24216
24256
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
24217
24257
|
)
|
|
24218
24258
|
);
|
|
24219
24259
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
24220
24260
|
console.log(
|
|
24221
|
-
|
|
24261
|
+
chalk193.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk193.yellow(`, ${failed2} skipped`) : "")
|
|
24222
24262
|
);
|
|
24223
24263
|
}
|
|
24224
24264
|
function selectCandidates(files, options2) {
|
|
@@ -24238,16 +24278,16 @@ function processSessions(files) {
|
|
|
24238
24278
|
let failed2 = 0;
|
|
24239
24279
|
for (let i = 0; i < files.length; i++) {
|
|
24240
24280
|
const file = files[i];
|
|
24241
|
-
process.stdout.write(
|
|
24281
|
+
process.stdout.write(chalk193.dim(` [${i + 1}/${files.length}] `));
|
|
24242
24282
|
const summary = summariseSession(file);
|
|
24243
24283
|
if (summary) {
|
|
24244
24284
|
writeSummary(file, summary);
|
|
24245
24285
|
succeeded++;
|
|
24246
|
-
process.stdout.write(`${
|
|
24286
|
+
process.stdout.write(`${chalk193.green("\u2713")} ${summary}
|
|
24247
24287
|
`);
|
|
24248
24288
|
} else {
|
|
24249
24289
|
failed2++;
|
|
24250
|
-
process.stdout.write(` ${
|
|
24290
|
+
process.stdout.write(` ${chalk193.yellow("skip")}
|
|
24251
24291
|
`);
|
|
24252
24292
|
}
|
|
24253
24293
|
}
|
|
@@ -24265,10 +24305,10 @@ function registerSessions(program2) {
|
|
|
24265
24305
|
}
|
|
24266
24306
|
|
|
24267
24307
|
// src/commands/statusLine.ts
|
|
24268
|
-
import
|
|
24308
|
+
import chalk195 from "chalk";
|
|
24269
24309
|
|
|
24270
24310
|
// src/commands/buildLimitsSegment.ts
|
|
24271
|
-
import
|
|
24311
|
+
import chalk194 from "chalk";
|
|
24272
24312
|
|
|
24273
24313
|
// src/shared/rateLimitLevel.ts
|
|
24274
24314
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -24299,9 +24339,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
24299
24339
|
|
|
24300
24340
|
// src/commands/buildLimitsSegment.ts
|
|
24301
24341
|
var LEVEL_COLOR = {
|
|
24302
|
-
ok:
|
|
24303
|
-
warn:
|
|
24304
|
-
over:
|
|
24342
|
+
ok: chalk194.green,
|
|
24343
|
+
warn: chalk194.yellow,
|
|
24344
|
+
over: chalk194.red
|
|
24305
24345
|
};
|
|
24306
24346
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
24307
24347
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -24392,14 +24432,14 @@ async function relayUsage(claudeSessionId, totalIn, totalOut) {
|
|
|
24392
24432
|
}
|
|
24393
24433
|
|
|
24394
24434
|
// src/commands/statusLine.ts
|
|
24395
|
-
|
|
24435
|
+
chalk195.level = 3;
|
|
24396
24436
|
function formatNumber(num) {
|
|
24397
24437
|
return num.toLocaleString("en-US");
|
|
24398
24438
|
}
|
|
24399
24439
|
function colorizePercent(pct) {
|
|
24400
24440
|
const label2 = `${Math.round(pct)}%`;
|
|
24401
|
-
if (pct > 80) return
|
|
24402
|
-
if (pct > 40) return
|
|
24441
|
+
if (pct > 80) return chalk195.red(label2);
|
|
24442
|
+
if (pct > 40) return chalk195.yellow(label2);
|
|
24403
24443
|
return label2;
|
|
24404
24444
|
}
|
|
24405
24445
|
async function statusLine() {
|
|
@@ -24410,7 +24450,7 @@ async function statusLine() {
|
|
|
24410
24450
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
24411
24451
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
24412
24452
|
const branch2 = dir ? readGitBranch(windowsCwdToWslPath(dir)) : null;
|
|
24413
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
24453
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk195.cyan(branch2)} | ` : "";
|
|
24414
24454
|
console.log(
|
|
24415
24455
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalOut)} \u2191 : ${formatNumber(totalIn)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
24416
24456
|
);
|
|
@@ -24427,7 +24467,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
24427
24467
|
// src/commands/sync/syncClaudeMd.ts
|
|
24428
24468
|
import * as fs37 from "fs";
|
|
24429
24469
|
import * as path53 from "path";
|
|
24430
|
-
import
|
|
24470
|
+
import chalk196 from "chalk";
|
|
24431
24471
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
24432
24472
|
const source = path53.join(claudeDir, "CLAUDE.md");
|
|
24433
24473
|
const target = path53.join(targetBase, "CLAUDE.md");
|
|
@@ -24436,12 +24476,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
24436
24476
|
const targetContent = fs37.readFileSync(target, "utf8");
|
|
24437
24477
|
if (sourceContent !== targetContent) {
|
|
24438
24478
|
console.log(
|
|
24439
|
-
|
|
24479
|
+
chalk196.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
24440
24480
|
);
|
|
24441
24481
|
console.log();
|
|
24442
24482
|
printDiff(targetContent, sourceContent);
|
|
24443
24483
|
const confirm = options2?.yes || await promptConfirm(
|
|
24444
|
-
|
|
24484
|
+
chalk196.red("Overwrite existing CLAUDE.md?"),
|
|
24445
24485
|
false
|
|
24446
24486
|
);
|
|
24447
24487
|
if (!confirm) {
|
|
@@ -24457,7 +24497,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
24457
24497
|
// src/commands/sync/syncSettings.ts
|
|
24458
24498
|
import * as fs38 from "fs";
|
|
24459
24499
|
import * as path54 from "path";
|
|
24460
|
-
import
|
|
24500
|
+
import chalk197 from "chalk";
|
|
24461
24501
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
24462
24502
|
const source = path54.join(claudeDir, "settings.json");
|
|
24463
24503
|
const target = path54.join(targetBase, "settings.json");
|
|
@@ -24476,14 +24516,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
24476
24516
|
if (mergedContent !== normalizedTarget) {
|
|
24477
24517
|
if (!options2?.yes) {
|
|
24478
24518
|
console.log(
|
|
24479
|
-
|
|
24519
|
+
chalk197.yellow(
|
|
24480
24520
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
24481
24521
|
)
|
|
24482
24522
|
);
|
|
24483
24523
|
console.log();
|
|
24484
24524
|
printDiff(targetContent, mergedContent);
|
|
24485
24525
|
const confirm = await promptConfirm(
|
|
24486
|
-
|
|
24526
|
+
chalk197.red("Overwrite existing settings.json?"),
|
|
24487
24527
|
false
|
|
24488
24528
|
);
|
|
24489
24529
|
if (!confirm) {
|