@staff0rd/assist 0.404.0 → 0.404.2
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 +0 -1
- package/dist/commands/sessions/web/bundle.js +74 -74
- package/dist/index.js +665 -667
- 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.404.
|
|
9
|
+
version: "0.404.2",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -7564,7 +7564,7 @@ async function show(id) {
|
|
|
7564
7564
|
}
|
|
7565
7565
|
|
|
7566
7566
|
// src/commands/sessions/web/index.ts
|
|
7567
|
-
import
|
|
7567
|
+
import chalk60 from "chalk";
|
|
7568
7568
|
import { WebSocketServer } from "ws";
|
|
7569
7569
|
|
|
7570
7570
|
// src/shared/getInstallDir.ts
|
|
@@ -7839,9 +7839,6 @@ function createFallbackHandler(routes3, htmlHandler2, extra) {
|
|
|
7839
7839
|
};
|
|
7840
7840
|
}
|
|
7841
7841
|
|
|
7842
|
-
// src/commands/backlog/loadBacklogSummaries.ts
|
|
7843
|
-
import { eq as eq13 } from "drizzle-orm";
|
|
7844
|
-
|
|
7845
7842
|
// src/commands/backlog/loadItemSummaries.ts
|
|
7846
7843
|
import { asc as asc5, eq as eq12 } from "drizzle-orm";
|
|
7847
7844
|
|
|
@@ -7915,36 +7912,6 @@ async function loadItemSummaries(orm, origin) {
|
|
|
7915
7912
|
return rows.map(rowToItemSummary);
|
|
7916
7913
|
}
|
|
7917
7914
|
|
|
7918
|
-
// src/commands/backlog/loadBacklogSummaries.ts
|
|
7919
|
-
async function loadBacklogSummaries(allRepos = false) {
|
|
7920
|
-
const { orm } = await getReady();
|
|
7921
|
-
return loadItemSummaries(orm, allRepos ? void 0 : getOrigin());
|
|
7922
|
-
}
|
|
7923
|
-
async function searchBacklogSummaries(query) {
|
|
7924
|
-
const { orm } = await getReady();
|
|
7925
|
-
const origin = getOrigin();
|
|
7926
|
-
const ids = await searchItemIds(orm, query, origin);
|
|
7927
|
-
const summaries = await loadItemSummaries(orm, origin);
|
|
7928
|
-
return summaries.filter((item) => ids.includes(item.id));
|
|
7929
|
-
}
|
|
7930
|
-
async function backlogHasItems() {
|
|
7931
|
-
const { orm } = await getReady();
|
|
7932
|
-
const [row] = await orm.select({ id: items.id }).from(items).where(eq13(items.origin, getOrigin())).limit(1);
|
|
7933
|
-
return row !== void 0;
|
|
7934
|
-
}
|
|
7935
|
-
|
|
7936
|
-
// src/commands/backlog/web/applyCwdFromReq.ts
|
|
7937
|
-
function applyCwdFromReq(req) {
|
|
7938
|
-
const url = new URL(req.url ?? "/", "http://localhost");
|
|
7939
|
-
setBacklogDir(url.searchParams.get("cwd") ?? void 0);
|
|
7940
|
-
}
|
|
7941
|
-
|
|
7942
|
-
// src/commands/backlog/web/getBacklogExists.ts
|
|
7943
|
-
async function getBacklogExists(req, res) {
|
|
7944
|
-
applyCwdFromReq(req);
|
|
7945
|
-
respondJson(res, 200, { exists: await backlogHasItems() });
|
|
7946
|
-
}
|
|
7947
|
-
|
|
7948
7915
|
// src/commands/backlog/originDisplayName.ts
|
|
7949
7916
|
function originDisplayName(origin) {
|
|
7950
7917
|
if (origin.startsWith("local:")) {
|
|
@@ -8018,23 +7985,42 @@ async function getBacklogSummary(req, res) {
|
|
|
8018
7985
|
respondJson(res, 200, await loadRepoSummaries(currentOrigin, knownCwds));
|
|
8019
7986
|
}
|
|
8020
7987
|
|
|
7988
|
+
// src/commands/backlog/web/applyCwdFromReq.ts
|
|
7989
|
+
function applyCwdFromReq(req) {
|
|
7990
|
+
const url = new URL(req.url ?? "/", "http://localhost");
|
|
7991
|
+
setBacklogDir(url.searchParams.get("cwd") ?? void 0);
|
|
7992
|
+
}
|
|
7993
|
+
|
|
8021
7994
|
// src/commands/backlog/deleteComment.ts
|
|
8022
|
-
import { and as and5, eq as
|
|
7995
|
+
import { and as and5, eq as eq13 } from "drizzle-orm";
|
|
8023
7996
|
async function deleteComment(orm, itemId2, commentId) {
|
|
8024
|
-
const [row] = await orm.select({ type: comments.type }).from(comments).where(and5(
|
|
7997
|
+
const [row] = await orm.select({ type: comments.type }).from(comments).where(and5(eq13(comments.id, commentId), eq13(comments.itemId, itemId2)));
|
|
8025
7998
|
if (!row) return "not-found";
|
|
8026
7999
|
if (row.type === "summary") return "is-summary";
|
|
8027
|
-
await orm.delete(comments).where(and5(
|
|
8000
|
+
await orm.delete(comments).where(and5(eq13(comments.id, commentId), eq13(comments.itemId, itemId2)));
|
|
8028
8001
|
return "deleted";
|
|
8029
8002
|
}
|
|
8030
8003
|
|
|
8031
8004
|
// src/commands/backlog/updateStarred.ts
|
|
8032
|
-
import { eq as
|
|
8005
|
+
import { eq as eq14 } from "drizzle-orm";
|
|
8033
8006
|
async function updateStarred(orm, id, starred) {
|
|
8034
|
-
const [row] = await orm.update(items).set({ starred }).where(
|
|
8007
|
+
const [row] = await orm.update(items).set({ starred }).where(eq14(items.id, id)).returning({ name: items.name });
|
|
8035
8008
|
return row?.name;
|
|
8036
8009
|
}
|
|
8037
8010
|
|
|
8011
|
+
// src/commands/backlog/loadBacklogSummaries.ts
|
|
8012
|
+
async function loadBacklogSummaries(allRepos = false) {
|
|
8013
|
+
const { orm } = await getReady();
|
|
8014
|
+
return loadItemSummaries(orm, allRepos ? void 0 : getOrigin());
|
|
8015
|
+
}
|
|
8016
|
+
async function searchBacklogSummaries(query) {
|
|
8017
|
+
const { orm } = await getReady();
|
|
8018
|
+
const origin = getOrigin();
|
|
8019
|
+
const ids = await searchItemIds(orm, query, origin);
|
|
8020
|
+
const summaries = await loadItemSummaries(orm, origin);
|
|
8021
|
+
return summaries.filter((item) => ids.includes(item.id));
|
|
8022
|
+
}
|
|
8023
|
+
|
|
8038
8024
|
// src/commands/backlog/web/parseBacklogFilter.ts
|
|
8039
8025
|
var validFilters = /* @__PURE__ */ new Set(["todo", "done", "all"]);
|
|
8040
8026
|
function parseBacklogFilter(value) {
|
|
@@ -8152,9 +8138,9 @@ async function deleteItemComment(res, itemId2, commentId) {
|
|
|
8152
8138
|
}
|
|
8153
8139
|
|
|
8154
8140
|
// src/commands/backlog/updateSubtaskStatus.ts
|
|
8155
|
-
import { and as and6, eq as
|
|
8141
|
+
import { and as and6, eq as eq15 } from "drizzle-orm";
|
|
8156
8142
|
async function updateSubtaskStatus(orm, itemId2, idx, status3) {
|
|
8157
|
-
const [row] = await orm.update(itemSubtasks).set({ status: status3 }).where(and6(
|
|
8143
|
+
const [row] = await orm.update(itemSubtasks).set({ status: status3 }).where(and6(eq15(itemSubtasks.itemId, itemId2), eq15(itemSubtasks.idx, idx))).returning({ title: itemSubtasks.title });
|
|
8158
8144
|
return row?.title;
|
|
8159
8145
|
}
|
|
8160
8146
|
|
|
@@ -8277,24 +8263,6 @@ async function handleItemRoute(req, res, pathname) {
|
|
|
8277
8263
|
return false;
|
|
8278
8264
|
}
|
|
8279
8265
|
|
|
8280
|
-
// src/commands/backlog/init/index.ts
|
|
8281
|
-
import chalk57 from "chalk";
|
|
8282
|
-
async function init7() {
|
|
8283
|
-
await getDb();
|
|
8284
|
-
console.log(
|
|
8285
|
-
chalk57.green(
|
|
8286
|
-
`Backlog database ready. This repository maps to origin: ${getOrigin()}`
|
|
8287
|
-
)
|
|
8288
|
-
);
|
|
8289
|
-
}
|
|
8290
|
-
|
|
8291
|
-
// src/commands/backlog/web/initBacklog.ts
|
|
8292
|
-
async function initBacklog(req, res) {
|
|
8293
|
-
applyCwdFromReq(req);
|
|
8294
|
-
await init7();
|
|
8295
|
-
respondJson(res, 200, { ok: true });
|
|
8296
|
-
}
|
|
8297
|
-
|
|
8298
8266
|
// src/shared/db/listBackups.ts
|
|
8299
8267
|
import { desc } from "drizzle-orm";
|
|
8300
8268
|
async function listBackups(db) {
|
|
@@ -8706,7 +8674,7 @@ async function listNewsItems(_req, res) {
|
|
|
8706
8674
|
}
|
|
8707
8675
|
|
|
8708
8676
|
// src/shared/db/listUsagePeaks.ts
|
|
8709
|
-
import { and as and7, count, desc as desc2, eq as
|
|
8677
|
+
import { and as and7, count, desc as desc2, eq as eq16, getTableColumns, sql as sql14 } from "drizzle-orm";
|
|
8710
8678
|
async function listUsagePeaks(db, paging) {
|
|
8711
8679
|
const avgContext = db.select({
|
|
8712
8680
|
window: phaseCycleContext.window,
|
|
@@ -8723,8 +8691,8 @@ async function listUsagePeaks(db, paging) {
|
|
|
8723
8691
|
}).from(usagePeaks).leftJoin(
|
|
8724
8692
|
avgContext,
|
|
8725
8693
|
and7(
|
|
8726
|
-
|
|
8727
|
-
|
|
8694
|
+
eq16(usagePeaks.window, avgContext.window),
|
|
8695
|
+
eq16(usagePeaks.resetsAt, avgContext.resetsAt)
|
|
8728
8696
|
)
|
|
8729
8697
|
).orderBy(
|
|
8730
8698
|
desc2(usagePeaks.resetsAt),
|
|
@@ -9027,9 +8995,7 @@ var routes2 = {
|
|
|
9027
8995
|
),
|
|
9028
8996
|
"GET /xterm.css": createCssHandler("@xterm/xterm/css/xterm.css"),
|
|
9029
8997
|
"GET /api/items": listItems,
|
|
9030
|
-
"GET /api/backlog/exists": getBacklogExists,
|
|
9031
8998
|
"GET /api/backlog/summary": getBacklogSummary,
|
|
9032
|
-
"POST /api/backlog/init": initBacklog,
|
|
9033
8999
|
"POST /api/open-in-code": openInCode,
|
|
9034
9000
|
"POST /api/restart": restartWeb,
|
|
9035
9001
|
"GET /api/github-url": githubUrl,
|
|
@@ -9121,25 +9087,25 @@ function withRepoCwd(line, repoCwd) {
|
|
|
9121
9087
|
}
|
|
9122
9088
|
|
|
9123
9089
|
// src/commands/sessions/web/restartMenu/installRestartMenu.ts
|
|
9124
|
-
import
|
|
9090
|
+
import chalk59 from "chalk";
|
|
9125
9091
|
import { createLogUpdate } from "log-update";
|
|
9126
9092
|
|
|
9127
9093
|
// src/commands/sessions/web/restartMenu/runRestartItem.ts
|
|
9128
|
-
import
|
|
9094
|
+
import chalk57 from "chalk";
|
|
9129
9095
|
async function runRestartItem(item, { runRestartDaemon, reExec }) {
|
|
9130
9096
|
if (item.disabled) return;
|
|
9131
9097
|
try {
|
|
9132
9098
|
if (item.action === "restart-daemon" || item.action === "restart-both") {
|
|
9133
|
-
console.log(
|
|
9099
|
+
console.log(chalk57.cyan("Restarting sessions daemon\u2026"));
|
|
9134
9100
|
await runRestartDaemon();
|
|
9135
9101
|
}
|
|
9136
9102
|
if (item.action === "restart-webserver" || item.action === "restart-both") {
|
|
9137
|
-
console.log(
|
|
9103
|
+
console.log(chalk57.cyan("Restarting web server\u2026"));
|
|
9138
9104
|
reExec();
|
|
9139
9105
|
}
|
|
9140
9106
|
} catch (error) {
|
|
9141
9107
|
const message = error instanceof Error ? error.message : String(error);
|
|
9142
|
-
console.error(
|
|
9108
|
+
console.error(chalk57.red(`Restart failed: ${message}`));
|
|
9143
9109
|
}
|
|
9144
9110
|
}
|
|
9145
9111
|
|
|
@@ -9221,20 +9187,20 @@ function firstEnabledIndex(items2) {
|
|
|
9221
9187
|
}
|
|
9222
9188
|
|
|
9223
9189
|
// src/commands/sessions/web/restartMenu/renderRestartMenu.ts
|
|
9224
|
-
import
|
|
9190
|
+
import chalk58 from "chalk";
|
|
9225
9191
|
function renderRestartMenu(items2, selected) {
|
|
9226
|
-
const lines = [
|
|
9192
|
+
const lines = [chalk58.bold.cyan("assist \u2014 restart menu")];
|
|
9227
9193
|
items2.forEach((item, i) => {
|
|
9228
9194
|
const active = i === selected;
|
|
9229
|
-
const pointer = active ?
|
|
9230
|
-
const number =
|
|
9231
|
-
const note = item.note ?
|
|
9195
|
+
const pointer = active ? chalk58.cyan("\u276F ") : " ";
|
|
9196
|
+
const number = chalk58.dim(`${i + 1}. `);
|
|
9197
|
+
const note = item.note ? chalk58.dim(` (${item.note})`) : "";
|
|
9232
9198
|
let label2 = item.label;
|
|
9233
|
-
if (item.disabled) label2 =
|
|
9234
|
-
else if (active) label2 =
|
|
9199
|
+
if (item.disabled) label2 = chalk58.dim(label2);
|
|
9200
|
+
else if (active) label2 = chalk58.cyan.bold(label2);
|
|
9235
9201
|
lines.push(`${pointer}${number}${label2}${note}`);
|
|
9236
9202
|
});
|
|
9237
|
-
lines.push(
|
|
9203
|
+
lines.push(chalk58.dim("\u2191/\u2193 move \xB7 1-3 jump \xB7 enter select \xB7 esc close"));
|
|
9238
9204
|
return lines.join("\n");
|
|
9239
9205
|
}
|
|
9240
9206
|
|
|
@@ -9328,7 +9294,7 @@ function installRestartMenu(options2 = {}) {
|
|
|
9328
9294
|
}
|
|
9329
9295
|
});
|
|
9330
9296
|
const restoreRaw = enableRawMode(stdin, handler);
|
|
9331
|
-
console.log(
|
|
9297
|
+
console.log(chalk59.dim("Press Ctrl+R for the restart menu"));
|
|
9332
9298
|
let cleaned = false;
|
|
9333
9299
|
function cleanup() {
|
|
9334
9300
|
if (cleaned) return;
|
|
@@ -9410,7 +9376,7 @@ async function web(options2) {
|
|
|
9410
9376
|
streamDaemonLogs();
|
|
9411
9377
|
void ensureDaemonRunning("web server start").catch((error) => {
|
|
9412
9378
|
console.error(
|
|
9413
|
-
|
|
9379
|
+
chalk60.yellow(
|
|
9414
9380
|
`sessions daemon not ready yet, will retry on connection: ${error instanceof Error ? error.message : String(error)}`
|
|
9415
9381
|
)
|
|
9416
9382
|
);
|
|
@@ -9441,12 +9407,12 @@ var backlogConfigHelp = [
|
|
|
9441
9407
|
];
|
|
9442
9408
|
|
|
9443
9409
|
// src/commands/backlog/addActivity.ts
|
|
9444
|
-
import
|
|
9410
|
+
import chalk61 from "chalk";
|
|
9445
9411
|
async function addActivity(id, kind, ref, options2) {
|
|
9446
9412
|
const parsedKind = gitRefKindSchema.safeParse(kind);
|
|
9447
9413
|
if (!parsedKind.success) {
|
|
9448
9414
|
console.log(
|
|
9449
|
-
|
|
9415
|
+
chalk61.red(
|
|
9450
9416
|
`Invalid kind "${kind}". Expected one of: ${gitRefKindSchema.options.join(", ")}.`
|
|
9451
9417
|
)
|
|
9452
9418
|
);
|
|
@@ -9468,7 +9434,7 @@ async function addActivity(id, kind, ref, options2) {
|
|
|
9468
9434
|
state: options2.state
|
|
9469
9435
|
});
|
|
9470
9436
|
console.log(
|
|
9471
|
-
|
|
9437
|
+
chalk61.green(
|
|
9472
9438
|
`Attached ${parsedKind.data} "${ref}" to item ${formatItemId(item.id)}.`
|
|
9473
9439
|
)
|
|
9474
9440
|
);
|
|
@@ -9482,12 +9448,12 @@ function registerActivityCommands(cmd) {
|
|
|
9482
9448
|
}
|
|
9483
9449
|
|
|
9484
9450
|
// src/commands/backlog/associate-jira/index.ts
|
|
9485
|
-
import
|
|
9486
|
-
import { eq as
|
|
9451
|
+
import chalk63 from "chalk";
|
|
9452
|
+
import { eq as eq17 } from "drizzle-orm";
|
|
9487
9453
|
|
|
9488
9454
|
// src/commands/jira/fetchIssue.ts
|
|
9489
9455
|
import { execSync as execSync30 } from "child_process";
|
|
9490
|
-
import
|
|
9456
|
+
import chalk62 from "chalk";
|
|
9491
9457
|
function fetchIssue(issueKey, fields) {
|
|
9492
9458
|
let result;
|
|
9493
9459
|
try {
|
|
@@ -9500,15 +9466,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
9500
9466
|
const stderr = error.stderr;
|
|
9501
9467
|
if (stderr.includes("unauthorized")) {
|
|
9502
9468
|
console.error(
|
|
9503
|
-
|
|
9469
|
+
chalk62.red("Jira authentication expired."),
|
|
9504
9470
|
"Run",
|
|
9505
|
-
|
|
9471
|
+
chalk62.cyan("assist jira auth"),
|
|
9506
9472
|
"to re-authenticate."
|
|
9507
9473
|
);
|
|
9508
9474
|
process.exit(1);
|
|
9509
9475
|
}
|
|
9510
9476
|
}
|
|
9511
|
-
console.error(
|
|
9477
|
+
console.error(chalk62.red(`Failed to fetch ${issueKey}.`));
|
|
9512
9478
|
process.exit(1);
|
|
9513
9479
|
}
|
|
9514
9480
|
return JSON.parse(result);
|
|
@@ -9525,20 +9491,20 @@ async function associateJira(id, key, options2) {
|
|
|
9525
9491
|
const { orm } = found;
|
|
9526
9492
|
const itemId2 = found.item.id;
|
|
9527
9493
|
if (options2.clear) {
|
|
9528
|
-
await orm.update(items).set({ jiraKey: null }).where(
|
|
9494
|
+
await orm.update(items).set({ jiraKey: null }).where(eq17(items.id, itemId2));
|
|
9529
9495
|
console.log(
|
|
9530
|
-
|
|
9496
|
+
chalk63.green(`Cleared Jira association on item ${formatItemId(itemId2)}.`)
|
|
9531
9497
|
);
|
|
9532
9498
|
return;
|
|
9533
9499
|
}
|
|
9534
9500
|
if (!key) {
|
|
9535
|
-
console.log(
|
|
9501
|
+
console.log(chalk63.red("Provide a Jira key, or use --clear to remove one."));
|
|
9536
9502
|
process.exitCode = 1;
|
|
9537
9503
|
return;
|
|
9538
9504
|
}
|
|
9539
9505
|
if (!JIRA_KEY_PATTERN.test(key)) {
|
|
9540
9506
|
console.log(
|
|
9541
|
-
|
|
9507
|
+
chalk63.red(`Malformed Jira key "${key}". Expected a key like PROJ-123.`)
|
|
9542
9508
|
);
|
|
9543
9509
|
process.exitCode = 1;
|
|
9544
9510
|
return;
|
|
@@ -9546,10 +9512,10 @@ async function associateJira(id, key, options2) {
|
|
|
9546
9512
|
const parsed = fetchIssue(key, "summary");
|
|
9547
9513
|
const fields = parsed?.fields;
|
|
9548
9514
|
const summary = fields?.summary;
|
|
9549
|
-
await orm.update(items).set({ jiraKey: key }).where(
|
|
9515
|
+
await orm.update(items).set({ jiraKey: key }).where(eq17(items.id, itemId2));
|
|
9550
9516
|
console.log(
|
|
9551
|
-
|
|
9552
|
-
summary ?
|
|
9517
|
+
chalk63.green(`Associated ${key} with item ${formatItemId(itemId2)}.`),
|
|
9518
|
+
summary ? chalk63.dim(`(${summary})`) : ""
|
|
9553
9519
|
);
|
|
9554
9520
|
}
|
|
9555
9521
|
|
|
@@ -9559,29 +9525,29 @@ function registerAssociateJiraCommand(cmd) {
|
|
|
9559
9525
|
}
|
|
9560
9526
|
|
|
9561
9527
|
// src/commands/backlog/comment/index.ts
|
|
9562
|
-
import
|
|
9528
|
+
import chalk64 from "chalk";
|
|
9563
9529
|
async function comment(id, text17) {
|
|
9564
9530
|
const found = await findOneItem(id);
|
|
9565
9531
|
if (!found) process.exit(1);
|
|
9566
9532
|
await appendComment(found.orm, found.item.id, text17);
|
|
9567
9533
|
console.log(
|
|
9568
|
-
|
|
9534
|
+
chalk64.green(`Comment added to item ${formatItemId(found.item.id)}.`)
|
|
9569
9535
|
);
|
|
9570
9536
|
}
|
|
9571
9537
|
|
|
9572
9538
|
// src/commands/backlog/comments/index.ts
|
|
9573
|
-
import
|
|
9539
|
+
import chalk65 from "chalk";
|
|
9574
9540
|
async function comments2(id) {
|
|
9575
9541
|
const found = await findOneItem(id);
|
|
9576
9542
|
if (!found) process.exit(1);
|
|
9577
9543
|
const { item } = found;
|
|
9578
9544
|
const entries = item.comments ?? [];
|
|
9579
9545
|
if (entries.length === 0) {
|
|
9580
|
-
console.log(
|
|
9546
|
+
console.log(chalk65.dim(`No comments on item ${formatItemId(item.id)}.`));
|
|
9581
9547
|
return;
|
|
9582
9548
|
}
|
|
9583
9549
|
console.log(
|
|
9584
|
-
|
|
9550
|
+
chalk65.bold(`Comments for ${formatItemId(item.id)}: ${item.name}
|
|
9585
9551
|
`)
|
|
9586
9552
|
);
|
|
9587
9553
|
for (const entry of entries) {
|
|
@@ -9591,7 +9557,7 @@ async function comments2(id) {
|
|
|
9591
9557
|
}
|
|
9592
9558
|
|
|
9593
9559
|
// src/commands/backlog/delete-comment/index.ts
|
|
9594
|
-
import
|
|
9560
|
+
import chalk66 from "chalk";
|
|
9595
9561
|
async function deleteCommentCmd(id, commentId) {
|
|
9596
9562
|
const found = await findOneItem(id);
|
|
9597
9563
|
if (!found) process.exit(1);
|
|
@@ -9604,14 +9570,14 @@ async function deleteCommentCmd(id, commentId) {
|
|
|
9604
9570
|
switch (outcome) {
|
|
9605
9571
|
case "deleted":
|
|
9606
9572
|
console.log(
|
|
9607
|
-
|
|
9573
|
+
chalk66.green(
|
|
9608
9574
|
`Comment #${commentId} deleted from item ${formatItemId(itemId2)}.`
|
|
9609
9575
|
)
|
|
9610
9576
|
);
|
|
9611
9577
|
break;
|
|
9612
9578
|
case "not-found":
|
|
9613
9579
|
console.log(
|
|
9614
|
-
|
|
9580
|
+
chalk66.red(
|
|
9615
9581
|
`Comment #${commentId} not found on item ${formatItemId(itemId2)}.`
|
|
9616
9582
|
)
|
|
9617
9583
|
);
|
|
@@ -9619,7 +9585,7 @@ async function deleteCommentCmd(id, commentId) {
|
|
|
9619
9585
|
break;
|
|
9620
9586
|
case "is-summary":
|
|
9621
9587
|
console.log(
|
|
9622
|
-
|
|
9588
|
+
chalk66.red(
|
|
9623
9589
|
`Comment #${commentId} is a phase summary and cannot be deleted.`
|
|
9624
9590
|
)
|
|
9625
9591
|
);
|
|
@@ -9644,7 +9610,7 @@ function registerExportCommand(cmd) {
|
|
|
9644
9610
|
|
|
9645
9611
|
// src/commands/backlog/import/index.ts
|
|
9646
9612
|
import { readFile } from "fs/promises";
|
|
9647
|
-
import
|
|
9613
|
+
import chalk68 from "chalk";
|
|
9648
9614
|
|
|
9649
9615
|
// src/commands/backlog/dump/countCopyRows.ts
|
|
9650
9616
|
function countCopyRows(data) {
|
|
@@ -9716,7 +9682,7 @@ function validateDump({ header, sections }) {
|
|
|
9716
9682
|
}
|
|
9717
9683
|
|
|
9718
9684
|
// src/commands/backlog/import/confirmReplace.ts
|
|
9719
|
-
import
|
|
9685
|
+
import chalk67 from "chalk";
|
|
9720
9686
|
async function countRows(client, table) {
|
|
9721
9687
|
const { rows } = await client.query(
|
|
9722
9688
|
`SELECT count(*)::int AS n FROM ${table}`
|
|
@@ -9727,7 +9693,7 @@ function printSummary(tables, current, incoming) {
|
|
|
9727
9693
|
const lines = tables.map(
|
|
9728
9694
|
(t, i) => ` ${t.name}: ${current[i]} \u2192 ${incoming[i]} rows`
|
|
9729
9695
|
);
|
|
9730
|
-
console.error(
|
|
9696
|
+
console.error(chalk67.bold("\nThis will REPLACE all backlog data:"));
|
|
9731
9697
|
console.error(`${lines.join("\n")}
|
|
9732
9698
|
`);
|
|
9733
9699
|
}
|
|
@@ -9829,13 +9795,13 @@ async function importBacklog(file, options2 = {}) {
|
|
|
9829
9795
|
);
|
|
9830
9796
|
await withDbClient(async (client) => {
|
|
9831
9797
|
if (!options2.yes && !await confirmReplace(client, tables, incoming, !file)) {
|
|
9832
|
-
console.error(
|
|
9798
|
+
console.error(chalk68.yellow("Import cancelled; no changes made."));
|
|
9833
9799
|
return;
|
|
9834
9800
|
}
|
|
9835
9801
|
await restore(client, parsed);
|
|
9836
9802
|
const total = incoming.reduce((sum, n) => sum + n, 0);
|
|
9837
9803
|
console.error(
|
|
9838
|
-
|
|
9804
|
+
chalk68.green(
|
|
9839
9805
|
`Imported backlog: ${total} rows restored across ${tables.length} tables.`
|
|
9840
9806
|
)
|
|
9841
9807
|
);
|
|
@@ -9852,18 +9818,18 @@ function registerImportCommand(cmd) {
|
|
|
9852
9818
|
}
|
|
9853
9819
|
|
|
9854
9820
|
// src/commands/backlog/add/index.ts
|
|
9855
|
-
import
|
|
9821
|
+
import chalk70 from "chalk";
|
|
9856
9822
|
|
|
9857
9823
|
// src/commands/backlog/insertPhaseAt.ts
|
|
9858
|
-
import { eq as
|
|
9824
|
+
import { eq as eq19 } from "drizzle-orm";
|
|
9859
9825
|
|
|
9860
9826
|
// src/commands/backlog/shiftPhasesUp.ts
|
|
9861
|
-
import { and as and8, desc as desc3, eq as
|
|
9827
|
+
import { and as and8, desc as desc3, eq as eq18, gte } from "drizzle-orm";
|
|
9862
9828
|
async function shiftPhasesUp(db, itemId2, fromIdx) {
|
|
9863
|
-
const toShift = await db.select({ idx: planPhases.idx }).from(planPhases).where(and8(
|
|
9829
|
+
const toShift = await db.select({ idx: planPhases.idx }).from(planPhases).where(and8(eq18(planPhases.itemId, itemId2), gte(planPhases.idx, fromIdx))).orderBy(desc3(planPhases.idx));
|
|
9864
9830
|
for (const p of toShift) {
|
|
9865
|
-
await db.update(planTasks).set({ phaseIdx: p.idx + 1 }).where(and8(
|
|
9866
|
-
await db.update(planPhases).set({ idx: p.idx + 1 }).where(and8(
|
|
9831
|
+
await db.update(planTasks).set({ phaseIdx: p.idx + 1 }).where(and8(eq18(planTasks.itemId, itemId2), eq18(planTasks.phaseIdx, p.idx)));
|
|
9832
|
+
await db.update(planPhases).set({ idx: p.idx + 1 }).where(and8(eq18(planPhases.itemId, itemId2), eq18(planPhases.idx, p.idx)));
|
|
9867
9833
|
}
|
|
9868
9834
|
}
|
|
9869
9835
|
|
|
@@ -9876,7 +9842,7 @@ async function insertPhaseAt(orm, itemId2, phaseIdx, name, tasks, manualChecks,
|
|
|
9876
9842
|
await tx.insert(planTasks).values(tasks.map((task, i) => ({ itemId: itemId2, phaseIdx, idx: i, task })));
|
|
9877
9843
|
}
|
|
9878
9844
|
if (currentPhase !== void 0 && currentPhase - 1 >= phaseIdx) {
|
|
9879
|
-
await tx.update(items).set({ currentPhase: phaseIdx + 1 }).where(
|
|
9845
|
+
await tx.update(items).set({ currentPhase: phaseIdx + 1 }).where(eq19(items.id, itemId2));
|
|
9880
9846
|
}
|
|
9881
9847
|
});
|
|
9882
9848
|
}
|
|
@@ -9894,11 +9860,11 @@ async function insertSubtask(orm, itemId2, title, description) {
|
|
|
9894
9860
|
}
|
|
9895
9861
|
|
|
9896
9862
|
// src/commands/backlog/ensureRemoteOrigin.ts
|
|
9897
|
-
import
|
|
9863
|
+
import chalk69 from "chalk";
|
|
9898
9864
|
function ensureRemoteOrigin() {
|
|
9899
9865
|
if (getRemoteOriginUrl(getBacklogDir())) return true;
|
|
9900
9866
|
console.log(
|
|
9901
|
-
|
|
9867
|
+
chalk69.red(
|
|
9902
9868
|
"Backlog requires a git remote so items get a stable origin.\nAdd one with: git remote add origin <url>"
|
|
9903
9869
|
)
|
|
9904
9870
|
);
|
|
@@ -10002,23 +9968,23 @@ async function add(options2) {
|
|
|
10002
9968
|
for (const subtask of loadConfig().subtasks ?? []) {
|
|
10003
9969
|
await insertSubtask(orm, id, subtask.title, subtask.description);
|
|
10004
9970
|
}
|
|
10005
|
-
console.log(
|
|
9971
|
+
console.log(chalk70.green(`Added item ${formatItemId(id)}: ${name}`));
|
|
10006
9972
|
}
|
|
10007
9973
|
|
|
10008
9974
|
// src/commands/backlog/addPhase.ts
|
|
10009
|
-
import
|
|
9975
|
+
import chalk72 from "chalk";
|
|
10010
9976
|
|
|
10011
9977
|
// src/commands/backlog/resolveInsertPosition.ts
|
|
10012
|
-
import
|
|
10013
|
-
import { count as count2, eq as
|
|
9978
|
+
import chalk71 from "chalk";
|
|
9979
|
+
import { count as count2, eq as eq20 } from "drizzle-orm";
|
|
10014
9980
|
async function resolveInsertPosition(orm, itemId2, position) {
|
|
10015
|
-
const [row] = await orm.select({ cnt: count2() }).from(planPhases).where(
|
|
9981
|
+
const [row] = await orm.select({ cnt: count2() }).from(planPhases).where(eq20(planPhases.itemId, itemId2));
|
|
10016
9982
|
const phaseCount = row?.cnt ?? 0;
|
|
10017
9983
|
if (position === void 0) return phaseCount;
|
|
10018
9984
|
const pos = Number.parseInt(position, 10);
|
|
10019
9985
|
if (pos < 1 || pos > phaseCount + 1) {
|
|
10020
9986
|
console.log(
|
|
10021
|
-
|
|
9987
|
+
chalk71.red(
|
|
10022
9988
|
`Position ${pos} is out of range. Must be between 1 and ${phaseCount + 1}.`
|
|
10023
9989
|
)
|
|
10024
9990
|
);
|
|
@@ -10040,7 +10006,7 @@ async function addPhase(id, name, options2) {
|
|
|
10040
10006
|
if (!found) return;
|
|
10041
10007
|
const tasks = options2.task ?? [];
|
|
10042
10008
|
if (tasks.length === 0) {
|
|
10043
|
-
console.log(
|
|
10009
|
+
console.log(chalk72.red("At least one --task is required."));
|
|
10044
10010
|
process.exitCode = 1;
|
|
10045
10011
|
return;
|
|
10046
10012
|
}
|
|
@@ -10059,14 +10025,14 @@ async function addPhase(id, name, options2) {
|
|
|
10059
10025
|
);
|
|
10060
10026
|
const verb = options2.position !== void 0 ? "Inserted" : "Added";
|
|
10061
10027
|
console.log(
|
|
10062
|
-
|
|
10028
|
+
chalk72.green(
|
|
10063
10029
|
`${verb} phase ${phaseIdx + 1} "${name}" to item ${formatItemId(itemId2)} with ${tasks.length} task(s).`
|
|
10064
10030
|
)
|
|
10065
10031
|
);
|
|
10066
10032
|
}
|
|
10067
10033
|
|
|
10068
10034
|
// src/commands/backlog/list/index.ts
|
|
10069
|
-
import
|
|
10035
|
+
import chalk73 from "chalk";
|
|
10070
10036
|
function filterItems(items2, options2) {
|
|
10071
10037
|
if (options2.status) return items2.filter((i) => i.status === options2.status);
|
|
10072
10038
|
if (!options2.all)
|
|
@@ -10080,19 +10046,19 @@ function repoPrefixer(items2, allRepos) {
|
|
|
10080
10046
|
);
|
|
10081
10047
|
const repoNameOf = (item) => item.origin ? labels.get(item.origin) ?? "" : "";
|
|
10082
10048
|
const width = Math.max(0, ...items2.map((i) => repoNameOf(i).length));
|
|
10083
|
-
return (item) => `${
|
|
10049
|
+
return (item) => `${chalk73.dim(repoNameOf(item).padEnd(width))} `;
|
|
10084
10050
|
}
|
|
10085
10051
|
async function list2(options2) {
|
|
10086
10052
|
const allItems = await loadBacklog(options2.allRepos);
|
|
10087
10053
|
const items2 = filterItems(allItems, options2);
|
|
10088
10054
|
if (items2.length === 0) {
|
|
10089
|
-
console.log(
|
|
10055
|
+
console.log(chalk73.dim("Backlog is empty."));
|
|
10090
10056
|
return;
|
|
10091
10057
|
}
|
|
10092
10058
|
const prefixOf = repoPrefixer(items2, !!options2.allRepos);
|
|
10093
10059
|
for (const item of items2) {
|
|
10094
10060
|
console.log(
|
|
10095
|
-
`${prefixOf(item)}${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
10061
|
+
`${prefixOf(item)}${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk73.dim(formatItemId(item.id))} ${starMarker(item)}${item.name}${phaseLabel(item)}${dependencyLabel(item, allItems)}`
|
|
10096
10062
|
);
|
|
10097
10063
|
if (options2.verbose) {
|
|
10098
10064
|
printVerboseDetails(item);
|
|
@@ -10102,7 +10068,6 @@ async function list2(options2) {
|
|
|
10102
10068
|
|
|
10103
10069
|
// src/commands/backlog/registerItemCommands.ts
|
|
10104
10070
|
function registerItemCommands(cmd) {
|
|
10105
|
-
cmd.command("init").description("Create an empty backlog").action(init7);
|
|
10106
10071
|
cmd.command("list").alias("ls").description("List all backlog items").option(
|
|
10107
10072
|
"--status <type>",
|
|
10108
10073
|
"Filter by status (todo, in-progress, done, wontdo)"
|
|
@@ -10121,7 +10086,7 @@ function registerItemCommands(cmd) {
|
|
|
10121
10086
|
}
|
|
10122
10087
|
|
|
10123
10088
|
// src/commands/backlog/link.ts
|
|
10124
|
-
import
|
|
10089
|
+
import chalk75 from "chalk";
|
|
10125
10090
|
|
|
10126
10091
|
// src/commands/backlog/hasCycle.ts
|
|
10127
10092
|
function hasCycle(adjacency, fromId, toId) {
|
|
@@ -10140,9 +10105,9 @@ function hasCycle(adjacency, fromId, toId) {
|
|
|
10140
10105
|
}
|
|
10141
10106
|
|
|
10142
10107
|
// src/commands/backlog/loadDependencyGraph.ts
|
|
10143
|
-
import { eq as
|
|
10108
|
+
import { eq as eq21 } from "drizzle-orm";
|
|
10144
10109
|
async function loadDependencyGraph(orm) {
|
|
10145
|
-
const rows = await orm.select({ itemId: links.itemId, targetId: links.targetId }).from(links).where(
|
|
10110
|
+
const rows = await orm.select({ itemId: links.itemId, targetId: links.targetId }).from(links).where(eq21(links.type, "depends-on"));
|
|
10146
10111
|
const graph = /* @__PURE__ */ new Map();
|
|
10147
10112
|
for (const { itemId: itemId2, targetId } of rows) {
|
|
10148
10113
|
const bucket = graph.get(itemId2);
|
|
@@ -10153,14 +10118,14 @@ async function loadDependencyGraph(orm) {
|
|
|
10153
10118
|
}
|
|
10154
10119
|
|
|
10155
10120
|
// src/commands/backlog/validateLinkTarget.ts
|
|
10156
|
-
import
|
|
10121
|
+
import chalk74 from "chalk";
|
|
10157
10122
|
function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
10158
10123
|
const duplicate = (fromItem.links ?? []).some(
|
|
10159
10124
|
(l) => l.targetId === toNum && l.type === linkType
|
|
10160
10125
|
);
|
|
10161
10126
|
if (duplicate) {
|
|
10162
10127
|
console.log(
|
|
10163
|
-
|
|
10128
|
+
chalk74.yellow(
|
|
10164
10129
|
`Link already exists: ${formatItemId(fromNum)} ${linkType} ${formatItemId(toNum)}`
|
|
10165
10130
|
)
|
|
10166
10131
|
);
|
|
@@ -10171,7 +10136,7 @@ function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
|
10171
10136
|
|
|
10172
10137
|
// src/commands/backlog/link.ts
|
|
10173
10138
|
function fail2(message) {
|
|
10174
|
-
console.log(
|
|
10139
|
+
console.log(chalk75.red(message));
|
|
10175
10140
|
return void 0;
|
|
10176
10141
|
}
|
|
10177
10142
|
function parseLinkType(type) {
|
|
@@ -10204,38 +10169,38 @@ async function link(fromId, toId, opts) {
|
|
|
10204
10169
|
if (!validateLinkTarget(fromItem, fromNum, toNum, linkType)) return;
|
|
10205
10170
|
if (await createsCycle(orm, linkType, fromNum, toNum)) return;
|
|
10206
10171
|
await orm.insert(links).values({ itemId: fromNum, type: linkType, targetId: toNum });
|
|
10207
|
-
console.log(
|
|
10172
|
+
console.log(chalk75.green(`Linked ${from} ${linkType} ${to} (${toItem.name})`));
|
|
10208
10173
|
}
|
|
10209
10174
|
|
|
10210
10175
|
// src/commands/backlog/unlink.ts
|
|
10211
|
-
import
|
|
10212
|
-
import { and as and9, eq as
|
|
10176
|
+
import chalk76 from "chalk";
|
|
10177
|
+
import { and as and9, eq as eq22 } from "drizzle-orm";
|
|
10213
10178
|
async function unlink(fromId, toId) {
|
|
10214
10179
|
const fromNum = parseItemId(fromId);
|
|
10215
10180
|
const toNum = parseItemId(toId);
|
|
10216
10181
|
const { orm } = await getReady();
|
|
10217
10182
|
const fromItem = await loadItem(orm, fromNum);
|
|
10218
10183
|
if (!fromItem) {
|
|
10219
|
-
console.log(
|
|
10184
|
+
console.log(chalk76.red(`Item ${formatItemId(fromNum)} not found.`));
|
|
10220
10185
|
return;
|
|
10221
10186
|
}
|
|
10222
10187
|
if (!fromItem.links || fromItem.links.length === 0) {
|
|
10223
10188
|
console.log(
|
|
10224
|
-
|
|
10189
|
+
chalk76.yellow(`No links found on item ${formatItemId(fromNum)}.`)
|
|
10225
10190
|
);
|
|
10226
10191
|
return;
|
|
10227
10192
|
}
|
|
10228
10193
|
if (!fromItem.links.some((l) => l.targetId === toNum)) {
|
|
10229
10194
|
console.log(
|
|
10230
|
-
|
|
10195
|
+
chalk76.yellow(
|
|
10231
10196
|
`No link from ${formatItemId(fromNum)} to ${formatItemId(toNum)} found.`
|
|
10232
10197
|
)
|
|
10233
10198
|
);
|
|
10234
10199
|
return;
|
|
10235
10200
|
}
|
|
10236
|
-
await orm.delete(links).where(and9(
|
|
10201
|
+
await orm.delete(links).where(and9(eq22(links.itemId, fromNum), eq22(links.targetId, toNum)));
|
|
10237
10202
|
console.log(
|
|
10238
|
-
|
|
10203
|
+
chalk76.green(
|
|
10239
10204
|
`Removed link from ${formatItemId(fromNum)} to ${formatItemId(toNum)}.`
|
|
10240
10205
|
)
|
|
10241
10206
|
);
|
|
@@ -10252,25 +10217,25 @@ function registerLinkCommands(cmd) {
|
|
|
10252
10217
|
}
|
|
10253
10218
|
|
|
10254
10219
|
// src/commands/backlog/move-repo/index.ts
|
|
10255
|
-
import
|
|
10256
|
-
import { eq as
|
|
10220
|
+
import chalk78 from "chalk";
|
|
10221
|
+
import { eq as eq24 } from "drizzle-orm";
|
|
10257
10222
|
|
|
10258
10223
|
// src/commands/backlog/move-repo/confirmMove.ts
|
|
10259
|
-
import
|
|
10224
|
+
import chalk77 from "chalk";
|
|
10260
10225
|
function pluralItems(n) {
|
|
10261
10226
|
return `${n} item${n === 1 ? "" : "s"}`;
|
|
10262
10227
|
}
|
|
10263
10228
|
async function confirmMove(cnt, oldOrigin, newOrigin) {
|
|
10264
10229
|
console.log(
|
|
10265
|
-
`${pluralItems(cnt)}: ${
|
|
10230
|
+
`${pluralItems(cnt)}: ${chalk77.cyan(oldOrigin)} \u2192 ${chalk77.cyan(newOrigin)}`
|
|
10266
10231
|
);
|
|
10267
10232
|
return promptConfirm(`Retag ${pluralItems(cnt)}?`);
|
|
10268
10233
|
}
|
|
10269
10234
|
|
|
10270
10235
|
// src/commands/backlog/move-repo/countByOrigin.ts
|
|
10271
|
-
import { count as count3, eq as
|
|
10236
|
+
import { count as count3, eq as eq23 } from "drizzle-orm";
|
|
10272
10237
|
async function countByOrigin(orm, origin) {
|
|
10273
|
-
const [{ cnt }] = await orm.select({ cnt: count3() }).from(items).where(
|
|
10238
|
+
const [{ cnt }] = await orm.select({ cnt: count3() }).from(items).where(eq23(items.origin, origin));
|
|
10274
10239
|
return cnt;
|
|
10275
10240
|
}
|
|
10276
10241
|
|
|
@@ -10294,7 +10259,7 @@ Pass the full origin.`
|
|
|
10294
10259
|
|
|
10295
10260
|
// src/commands/backlog/move-repo/index.ts
|
|
10296
10261
|
function fail3(message) {
|
|
10297
|
-
console.log(
|
|
10262
|
+
console.log(chalk78.red(message));
|
|
10298
10263
|
process.exitCode = 1;
|
|
10299
10264
|
}
|
|
10300
10265
|
async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
@@ -10310,12 +10275,12 @@ async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
|
10310
10275
|
}
|
|
10311
10276
|
const cnt = await countByOrigin(orm, oldOrigin);
|
|
10312
10277
|
if (!options2.yes && !await confirmMove(cnt, oldOrigin, newOrigin)) {
|
|
10313
|
-
console.log(
|
|
10278
|
+
console.log(chalk78.yellow("Move cancelled; no changes made."));
|
|
10314
10279
|
return;
|
|
10315
10280
|
}
|
|
10316
|
-
await orm.update(items).set({ origin: newOrigin }).where(
|
|
10281
|
+
await orm.update(items).set({ origin: newOrigin }).where(eq24(items.origin, oldOrigin));
|
|
10317
10282
|
console.log(
|
|
10318
|
-
|
|
10283
|
+
chalk78.green(
|
|
10319
10284
|
`Moved ${pluralItems(cnt)} from "${oldOrigin}" to "${newOrigin}".`
|
|
10320
10285
|
)
|
|
10321
10286
|
);
|
|
@@ -10344,7 +10309,7 @@ function registerPlanCommands(cmd) {
|
|
|
10344
10309
|
}
|
|
10345
10310
|
|
|
10346
10311
|
// src/commands/backlog/refine.ts
|
|
10347
|
-
import
|
|
10312
|
+
import chalk81 from "chalk";
|
|
10348
10313
|
import enquirer7 from "enquirer";
|
|
10349
10314
|
|
|
10350
10315
|
// src/commands/backlog/launchMode.ts
|
|
@@ -10378,7 +10343,7 @@ function spawnHarness(harness, prompt, options2 = {}) {
|
|
|
10378
10343
|
}
|
|
10379
10344
|
|
|
10380
10345
|
// src/commands/backlog/handleLaunchSignal.ts
|
|
10381
|
-
import
|
|
10346
|
+
import chalk80 from "chalk";
|
|
10382
10347
|
|
|
10383
10348
|
// src/commands/backlog/surfaceCreatedItem.ts
|
|
10384
10349
|
async function surfaceCreatedItem(slashCommand, id) {
|
|
@@ -10401,32 +10366,32 @@ async function surfaceCreatedItem(slashCommand, id) {
|
|
|
10401
10366
|
}
|
|
10402
10367
|
|
|
10403
10368
|
// src/commands/backlog/tryRunById.ts
|
|
10404
|
-
import
|
|
10369
|
+
import chalk79 from "chalk";
|
|
10405
10370
|
async function tryRunById(id, options2) {
|
|
10406
10371
|
const numericId = parseItemId(id);
|
|
10407
10372
|
const label2 = formatItemId(numericId);
|
|
10408
10373
|
const { orm } = await getReady();
|
|
10409
10374
|
const item = await loadItem(orm, numericId);
|
|
10410
10375
|
if (!item) {
|
|
10411
|
-
console.log(
|
|
10376
|
+
console.log(chalk79.red(`Item ${label2} not found.`));
|
|
10412
10377
|
return false;
|
|
10413
10378
|
}
|
|
10414
10379
|
if (item.status === "done") {
|
|
10415
|
-
console.log(
|
|
10380
|
+
console.log(chalk79.red(`Item ${label2} is already done.`));
|
|
10416
10381
|
return false;
|
|
10417
10382
|
}
|
|
10418
10383
|
if (item.status === "wontdo") {
|
|
10419
|
-
console.log(
|
|
10384
|
+
console.log(chalk79.red(`Item ${label2} is marked won't do.`));
|
|
10420
10385
|
return false;
|
|
10421
10386
|
}
|
|
10422
10387
|
const hasDeps = (item.links ?? []).some((l) => l.type === "depends-on");
|
|
10423
10388
|
if (hasDeps && isBlocked(item, await loadItemSummaries(orm, getOrigin()))) {
|
|
10424
10389
|
console.log(
|
|
10425
|
-
|
|
10390
|
+
chalk79.red(`Item ${label2} is blocked by unresolved dependencies.`)
|
|
10426
10391
|
);
|
|
10427
10392
|
return false;
|
|
10428
10393
|
}
|
|
10429
|
-
console.log(
|
|
10394
|
+
console.log(chalk79.bold(`
|
|
10430
10395
|
Running backlog item ${label2}...
|
|
10431
10396
|
`));
|
|
10432
10397
|
await run2(id, options2);
|
|
@@ -10445,13 +10410,13 @@ async function handleLaunchSignal(slashCommand, once) {
|
|
|
10445
10410
|
if (typeof signal.id === "string" && signal.id) {
|
|
10446
10411
|
if (await tryRunById(signal.id, { allowEdits: true })) return;
|
|
10447
10412
|
}
|
|
10448
|
-
console.log(
|
|
10413
|
+
console.log(chalk80.bold("\nChaining into assist next...\n"));
|
|
10449
10414
|
await next({ allowEdits: true, once });
|
|
10450
10415
|
}
|
|
10451
10416
|
} catch (error) {
|
|
10452
10417
|
const message = error instanceof Error ? error.message : String(error);
|
|
10453
10418
|
console.error(
|
|
10454
|
-
|
|
10419
|
+
chalk80.yellow(
|
|
10455
10420
|
`
|
|
10456
10421
|
Could not complete post-run step (${message}).
|
|
10457
10422
|
This is usually a transient database/network blip \u2014 the work is saved and the session is safe to resume.`
|
|
@@ -10498,13 +10463,13 @@ async function pickItemForRefine() {
|
|
|
10498
10463
|
(i) => i.status === "todo" || i.status === "in-progress"
|
|
10499
10464
|
);
|
|
10500
10465
|
if (active.length === 0) {
|
|
10501
|
-
console.log(
|
|
10466
|
+
console.log(chalk81.yellow("No active backlog items to refine."));
|
|
10502
10467
|
return void 0;
|
|
10503
10468
|
}
|
|
10504
10469
|
if (active.length === 1) {
|
|
10505
10470
|
const item = active[0];
|
|
10506
10471
|
console.log(
|
|
10507
|
-
|
|
10472
|
+
chalk81.bold(`Auto-selecting item ${formatItemId(item.id)}: ${item.name}`)
|
|
10508
10473
|
);
|
|
10509
10474
|
return formatItemId(item.id);
|
|
10510
10475
|
}
|
|
@@ -10552,7 +10517,7 @@ function registerRefineCommand(cmd) {
|
|
|
10552
10517
|
}
|
|
10553
10518
|
|
|
10554
10519
|
// src/commands/backlog/rewindPhase.ts
|
|
10555
|
-
import
|
|
10520
|
+
import chalk82 from "chalk";
|
|
10556
10521
|
async function rewindPhase(id, phase, opts) {
|
|
10557
10522
|
const phaseNumber = Number.parseInt(phase, 10);
|
|
10558
10523
|
const found = await findOneItem(id);
|
|
@@ -10560,12 +10525,12 @@ async function rewindPhase(id, phase, opts) {
|
|
|
10560
10525
|
const { orm, item } = found;
|
|
10561
10526
|
const result = await rewindItemToPhase(orm, item, phaseNumber, opts.reason);
|
|
10562
10527
|
if (!result.ok) {
|
|
10563
|
-
console.log(
|
|
10528
|
+
console.log(chalk82.red(result.error));
|
|
10564
10529
|
process.exitCode = 1;
|
|
10565
10530
|
return;
|
|
10566
10531
|
}
|
|
10567
10532
|
console.log(
|
|
10568
|
-
|
|
10533
|
+
chalk82.green(
|
|
10569
10534
|
`Rewound item ${formatItemId(item.id)} to phase ${phaseNumber} (${result.phaseName}).`
|
|
10570
10535
|
)
|
|
10571
10536
|
);
|
|
@@ -10593,22 +10558,22 @@ function registerRunCommand(cmd) {
|
|
|
10593
10558
|
}
|
|
10594
10559
|
|
|
10595
10560
|
// src/commands/backlog/search/index.ts
|
|
10596
|
-
import
|
|
10561
|
+
import chalk83 from "chalk";
|
|
10597
10562
|
async function search(query) {
|
|
10598
10563
|
const items2 = await searchBacklog(query);
|
|
10599
10564
|
if (items2.length === 0) {
|
|
10600
|
-
console.log(
|
|
10565
|
+
console.log(chalk83.dim(`No items matching "${query}".`));
|
|
10601
10566
|
return;
|
|
10602
10567
|
}
|
|
10603
10568
|
console.log(
|
|
10604
|
-
|
|
10569
|
+
chalk83.dim(
|
|
10605
10570
|
`${items2.length} item${items2.length === 1 ? "" : "s"} matching "${query}":
|
|
10606
10571
|
`
|
|
10607
10572
|
)
|
|
10608
10573
|
);
|
|
10609
10574
|
for (const item of items2) {
|
|
10610
10575
|
console.log(
|
|
10611
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
10576
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk83.dim(formatItemId(item.id))} ${item.name}`
|
|
10612
10577
|
);
|
|
10613
10578
|
}
|
|
10614
10579
|
}
|
|
@@ -10619,18 +10584,18 @@ function registerSearchCommand(cmd) {
|
|
|
10619
10584
|
}
|
|
10620
10585
|
|
|
10621
10586
|
// src/commands/backlog/delete/index.ts
|
|
10622
|
-
import
|
|
10587
|
+
import chalk84 from "chalk";
|
|
10623
10588
|
async function del(id) {
|
|
10624
10589
|
const name = await removeItem(id);
|
|
10625
10590
|
if (name) {
|
|
10626
10591
|
console.log(
|
|
10627
|
-
|
|
10592
|
+
chalk84.green(`Deleted item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
10628
10593
|
);
|
|
10629
10594
|
}
|
|
10630
10595
|
}
|
|
10631
10596
|
|
|
10632
10597
|
// src/commands/backlog/done/index.ts
|
|
10633
|
-
import
|
|
10598
|
+
import chalk85 from "chalk";
|
|
10634
10599
|
async function done(id, summary) {
|
|
10635
10600
|
const found = await findOneItem(id);
|
|
10636
10601
|
if (!found) return;
|
|
@@ -10644,12 +10609,12 @@ async function done(id, summary) {
|
|
|
10644
10609
|
const pending = item.plan.slice(completedCount);
|
|
10645
10610
|
if (pending.length > 0) {
|
|
10646
10611
|
console.log(
|
|
10647
|
-
|
|
10612
|
+
chalk85.red(
|
|
10648
10613
|
`Cannot complete item ${formatItemId(item.id)}: ${pending.length} pending phase(s):`
|
|
10649
10614
|
)
|
|
10650
10615
|
);
|
|
10651
10616
|
for (const phase of pending) {
|
|
10652
|
-
console.log(
|
|
10617
|
+
console.log(chalk85.yellow(` - ${phase.name}`));
|
|
10653
10618
|
}
|
|
10654
10619
|
process.exitCode = 1;
|
|
10655
10620
|
return;
|
|
@@ -10661,12 +10626,12 @@ async function done(id, summary) {
|
|
|
10661
10626
|
await appendComment(orm, item.id, summary, { phase, type: "summary" });
|
|
10662
10627
|
}
|
|
10663
10628
|
console.log(
|
|
10664
|
-
|
|
10629
|
+
chalk85.green(`Completed item ${formatItemId(item.id)}: ${item.name}`)
|
|
10665
10630
|
);
|
|
10666
10631
|
}
|
|
10667
10632
|
|
|
10668
10633
|
// src/commands/backlog/set-status/index.ts
|
|
10669
|
-
import
|
|
10634
|
+
import chalk86 from "chalk";
|
|
10670
10635
|
var allowedStatuses = [
|
|
10671
10636
|
"todo",
|
|
10672
10637
|
"in-progress",
|
|
@@ -10676,7 +10641,7 @@ var allowedStatuses = [
|
|
|
10676
10641
|
async function setStatusCommand(id, status3) {
|
|
10677
10642
|
if (!allowedStatuses.includes(status3)) {
|
|
10678
10643
|
console.log(
|
|
10679
|
-
|
|
10644
|
+
chalk86.red(
|
|
10680
10645
|
`Invalid status "${status3}". Must be one of: ${allowedStatuses.join(", ")}.`
|
|
10681
10646
|
)
|
|
10682
10647
|
);
|
|
@@ -10686,7 +10651,7 @@ async function setStatusCommand(id, status3) {
|
|
|
10686
10651
|
const name = await setStatus(id, status3);
|
|
10687
10652
|
if (name) {
|
|
10688
10653
|
console.log(
|
|
10689
|
-
|
|
10654
|
+
chalk86.green(
|
|
10690
10655
|
`Set item ${formatItemId(parseItemId(id))} to ${status3}: ${name}`
|
|
10691
10656
|
)
|
|
10692
10657
|
);
|
|
@@ -10694,16 +10659,16 @@ async function setStatusCommand(id, status3) {
|
|
|
10694
10659
|
}
|
|
10695
10660
|
|
|
10696
10661
|
// src/commands/backlog/star/index.ts
|
|
10697
|
-
import
|
|
10662
|
+
import chalk88 from "chalk";
|
|
10698
10663
|
|
|
10699
10664
|
// src/commands/backlog/setStarred.ts
|
|
10700
|
-
import
|
|
10665
|
+
import chalk87 from "chalk";
|
|
10701
10666
|
async function setStarred(id, starred) {
|
|
10702
10667
|
const { orm } = await getReady();
|
|
10703
10668
|
const numId = parseItemId(id);
|
|
10704
10669
|
const name = await updateStarred(orm, numId, starred);
|
|
10705
10670
|
if (name === void 0)
|
|
10706
|
-
console.log(
|
|
10671
|
+
console.log(chalk87.red(`Item ${formatItemId(numId)} not found.`));
|
|
10707
10672
|
return name;
|
|
10708
10673
|
}
|
|
10709
10674
|
|
|
@@ -10712,52 +10677,52 @@ async function star(id) {
|
|
|
10712
10677
|
const name = await setStarred(id, true);
|
|
10713
10678
|
if (name) {
|
|
10714
10679
|
console.log(
|
|
10715
|
-
|
|
10680
|
+
chalk88.green(`Starred item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
10716
10681
|
);
|
|
10717
10682
|
}
|
|
10718
10683
|
}
|
|
10719
10684
|
|
|
10720
10685
|
// src/commands/backlog/start/index.ts
|
|
10721
|
-
import
|
|
10686
|
+
import chalk89 from "chalk";
|
|
10722
10687
|
async function start(id) {
|
|
10723
10688
|
const name = await setStatus(id, "in-progress");
|
|
10724
10689
|
if (name) {
|
|
10725
10690
|
console.log(
|
|
10726
|
-
|
|
10691
|
+
chalk89.green(`Started item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
10727
10692
|
);
|
|
10728
10693
|
}
|
|
10729
10694
|
}
|
|
10730
10695
|
|
|
10731
10696
|
// src/commands/backlog/stop/index.ts
|
|
10732
|
-
import
|
|
10733
|
-
import { and as and10, eq as
|
|
10697
|
+
import chalk90 from "chalk";
|
|
10698
|
+
import { and as and10, eq as eq25 } from "drizzle-orm";
|
|
10734
10699
|
async function stop() {
|
|
10735
10700
|
const { orm } = await getReady();
|
|
10736
|
-
const stopped = await orm.update(items).set({ status: "todo", currentPhase: 1 }).where(and10(
|
|
10701
|
+
const stopped = await orm.update(items).set({ status: "todo", currentPhase: 1 }).where(and10(eq25(items.status, "in-progress"), eq25(items.origin, getOrigin()))).returning({ id: items.id, name: items.name });
|
|
10737
10702
|
if (stopped.length === 0) {
|
|
10738
|
-
console.log(
|
|
10703
|
+
console.log(chalk90.yellow("No in-progress items to stop."));
|
|
10739
10704
|
return;
|
|
10740
10705
|
}
|
|
10741
10706
|
for (const item of stopped) {
|
|
10742
10707
|
console.log(
|
|
10743
|
-
|
|
10708
|
+
chalk90.yellow(`Stopped item ${formatItemId(item.id)}: ${item.name}`)
|
|
10744
10709
|
);
|
|
10745
10710
|
}
|
|
10746
10711
|
}
|
|
10747
10712
|
|
|
10748
10713
|
// src/commands/backlog/unstar/index.ts
|
|
10749
|
-
import
|
|
10714
|
+
import chalk91 from "chalk";
|
|
10750
10715
|
async function unstar(id) {
|
|
10751
10716
|
const name = await setStarred(id, false);
|
|
10752
10717
|
if (name) {
|
|
10753
10718
|
console.log(
|
|
10754
|
-
|
|
10719
|
+
chalk91.green(`Unstarred item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
10755
10720
|
);
|
|
10756
10721
|
}
|
|
10757
10722
|
}
|
|
10758
10723
|
|
|
10759
10724
|
// src/commands/backlog/wontdo/index.ts
|
|
10760
|
-
import
|
|
10725
|
+
import chalk92 from "chalk";
|
|
10761
10726
|
async function wontdo(id, reason) {
|
|
10762
10727
|
const found = await findOneItem(id);
|
|
10763
10728
|
if (!found) return;
|
|
@@ -10768,7 +10733,7 @@ async function wontdo(id, reason) {
|
|
|
10768
10733
|
await appendComment(orm, item.id, reason, { phase, type: "summary" });
|
|
10769
10734
|
}
|
|
10770
10735
|
console.log(
|
|
10771
|
-
|
|
10736
|
+
chalk92.red(`Won't do item ${formatItemId(item.id)}: ${item.name}`)
|
|
10772
10737
|
);
|
|
10773
10738
|
}
|
|
10774
10739
|
|
|
@@ -10787,17 +10752,17 @@ function registerStatusCommands(cmd) {
|
|
|
10787
10752
|
}
|
|
10788
10753
|
|
|
10789
10754
|
// src/commands/backlog/addSubtask.ts
|
|
10790
|
-
import
|
|
10755
|
+
import chalk93 from "chalk";
|
|
10791
10756
|
async function addSubtask(id, options2) {
|
|
10792
10757
|
const title = options2.title?.trim();
|
|
10793
10758
|
if (!title) {
|
|
10794
|
-
console.log(
|
|
10759
|
+
console.log(chalk93.red("A sub-task title is required (--title)."));
|
|
10795
10760
|
process.exitCode = 1;
|
|
10796
10761
|
return;
|
|
10797
10762
|
}
|
|
10798
10763
|
if (title.length > 50) {
|
|
10799
10764
|
console.log(
|
|
10800
|
-
|
|
10765
|
+
chalk93.red(
|
|
10801
10766
|
"A sub-task title must be 50 characters or fewer. Use --desc for longer detail."
|
|
10802
10767
|
)
|
|
10803
10768
|
);
|
|
@@ -10813,21 +10778,21 @@ async function addSubtask(id, options2) {
|
|
|
10813
10778
|
const description = options2.desc?.replaceAll(String.raw`\n`, "\n");
|
|
10814
10779
|
await insertSubtask(orm, item.id, title, description);
|
|
10815
10780
|
console.log(
|
|
10816
|
-
|
|
10781
|
+
chalk93.green(`Added sub-task to item ${formatItemId(item.id)}: ${title}`)
|
|
10817
10782
|
);
|
|
10818
10783
|
}
|
|
10819
10784
|
|
|
10820
10785
|
// src/commands/backlog/editSubtask.ts
|
|
10821
|
-
import
|
|
10786
|
+
import chalk95 from "chalk";
|
|
10822
10787
|
|
|
10823
10788
|
// src/commands/backlog/resolveSubtaskIndex.ts
|
|
10824
|
-
import
|
|
10789
|
+
import chalk94 from "chalk";
|
|
10825
10790
|
function resolveSubtaskIndex(index3, item) {
|
|
10826
10791
|
const position = Number.parseInt(index3, 10);
|
|
10827
10792
|
const subtasks = item.subtasks ?? [];
|
|
10828
10793
|
if (Number.isNaN(position) || position < 1 || position > subtasks.length) {
|
|
10829
10794
|
console.log(
|
|
10830
|
-
|
|
10795
|
+
chalk94.red(
|
|
10831
10796
|
`Item ${formatItemId(item.id)} has no sub-task ${index3}${subtasks.length > 0 ? ` (1-${subtasks.length})` : ""}.`
|
|
10832
10797
|
)
|
|
10833
10798
|
);
|
|
@@ -10850,13 +10815,13 @@ async function findSubtask(id, index3) {
|
|
|
10850
10815
|
}
|
|
10851
10816
|
|
|
10852
10817
|
// src/commands/backlog/updateSubtask.ts
|
|
10853
|
-
import { and as and11, eq as
|
|
10818
|
+
import { and as and11, eq as eq26 } from "drizzle-orm";
|
|
10854
10819
|
async function updateSubtask(orm, itemId2, idx, fields) {
|
|
10855
10820
|
const set = {};
|
|
10856
10821
|
if (fields.title !== void 0) set.title = fields.title;
|
|
10857
10822
|
if (fields.description !== void 0) set.description = fields.description;
|
|
10858
10823
|
if (fields.status !== void 0) set.status = fields.status;
|
|
10859
|
-
const [row] = await orm.update(itemSubtasks).set(set).where(and11(
|
|
10824
|
+
const [row] = await orm.update(itemSubtasks).set(set).where(and11(eq26(itemSubtasks.itemId, itemId2), eq26(itemSubtasks.idx, idx))).returning({ title: itemSubtasks.title });
|
|
10860
10825
|
return row?.title;
|
|
10861
10826
|
}
|
|
10862
10827
|
|
|
@@ -10894,33 +10859,33 @@ async function editSubtask(id, index3, options2) {
|
|
|
10894
10859
|
if (!found) return;
|
|
10895
10860
|
const fields = buildUpdate(options2);
|
|
10896
10861
|
if (typeof fields === "string") {
|
|
10897
|
-
console.log(
|
|
10862
|
+
console.log(chalk95.red(fields));
|
|
10898
10863
|
process.exitCode = 1;
|
|
10899
10864
|
return;
|
|
10900
10865
|
}
|
|
10901
10866
|
const { orm, item, idx } = found;
|
|
10902
10867
|
const title = await updateSubtask(orm, item.id, idx, fields);
|
|
10903
10868
|
console.log(
|
|
10904
|
-
|
|
10869
|
+
chalk95.green(
|
|
10905
10870
|
`Updated sub-task ${idx + 1} of item ${formatItemId(item.id)}: ${title}`
|
|
10906
10871
|
)
|
|
10907
10872
|
);
|
|
10908
10873
|
}
|
|
10909
10874
|
|
|
10910
10875
|
// src/commands/backlog/removeSubtask.ts
|
|
10911
|
-
import
|
|
10876
|
+
import chalk96 from "chalk";
|
|
10912
10877
|
|
|
10913
10878
|
// src/commands/backlog/deleteSubtask.ts
|
|
10914
|
-
import { and as and12, asc as asc6, eq as
|
|
10879
|
+
import { and as and12, asc as asc6, eq as eq27 } from "drizzle-orm";
|
|
10915
10880
|
async function deleteSubtask(orm, itemId2, idx) {
|
|
10916
|
-
const [row] = await orm.delete(itemSubtasks).where(and12(
|
|
10881
|
+
const [row] = await orm.delete(itemSubtasks).where(and12(eq27(itemSubtasks.itemId, itemId2), eq27(itemSubtasks.idx, idx))).returning({ title: itemSubtasks.title });
|
|
10917
10882
|
if (!row) return void 0;
|
|
10918
|
-
const remaining = await orm.select({ idx: itemSubtasks.idx }).from(itemSubtasks).where(
|
|
10883
|
+
const remaining = await orm.select({ idx: itemSubtasks.idx }).from(itemSubtasks).where(eq27(itemSubtasks.itemId, itemId2)).orderBy(asc6(itemSubtasks.idx));
|
|
10919
10884
|
for (let i = 0; i < remaining.length; i++) {
|
|
10920
10885
|
const oldIdx = remaining[i].idx;
|
|
10921
10886
|
if (oldIdx === i) continue;
|
|
10922
10887
|
await orm.update(itemSubtasks).set({ idx: i }).where(
|
|
10923
|
-
and12(
|
|
10888
|
+
and12(eq27(itemSubtasks.itemId, itemId2), eq27(itemSubtasks.idx, oldIdx))
|
|
10924
10889
|
);
|
|
10925
10890
|
}
|
|
10926
10891
|
return row.title;
|
|
@@ -10933,18 +10898,18 @@ async function removeSubtask(id, index3) {
|
|
|
10933
10898
|
const { orm, item, idx } = found;
|
|
10934
10899
|
const title = await deleteSubtask(orm, item.id, idx);
|
|
10935
10900
|
console.log(
|
|
10936
|
-
|
|
10901
|
+
chalk96.green(
|
|
10937
10902
|
`Removed sub-task ${idx + 1} of item ${formatItemId(item.id)}: ${title}`
|
|
10938
10903
|
)
|
|
10939
10904
|
);
|
|
10940
10905
|
}
|
|
10941
10906
|
|
|
10942
10907
|
// src/commands/backlog/subtaskStatus.ts
|
|
10943
|
-
import
|
|
10908
|
+
import chalk97 from "chalk";
|
|
10944
10909
|
async function subtaskStatus(id, index3, status3) {
|
|
10945
10910
|
if (!validSubtaskStatuses.includes(status3)) {
|
|
10946
10911
|
console.log(
|
|
10947
|
-
|
|
10912
|
+
chalk97.red(
|
|
10948
10913
|
`Invalid status "${status3}". Use one of: ${validSubtaskStatuses.join(", ")}.`
|
|
10949
10914
|
)
|
|
10950
10915
|
);
|
|
@@ -10961,7 +10926,7 @@ async function subtaskStatus(id, index3, status3) {
|
|
|
10961
10926
|
status3
|
|
10962
10927
|
);
|
|
10963
10928
|
console.log(
|
|
10964
|
-
|
|
10929
|
+
chalk97.green(
|
|
10965
10930
|
`Set sub-task ${idx + 1} of item ${formatItemId(item.id)} to ${status3}: ${title}`
|
|
10966
10931
|
)
|
|
10967
10932
|
);
|
|
@@ -10988,21 +10953,21 @@ function registerSubtaskCommands(cmd) {
|
|
|
10988
10953
|
}
|
|
10989
10954
|
|
|
10990
10955
|
// src/commands/backlog/movePhase.ts
|
|
10991
|
-
import
|
|
10992
|
-
import { count as count5, eq as
|
|
10956
|
+
import chalk98 from "chalk";
|
|
10957
|
+
import { count as count5, eq as eq30 } from "drizzle-orm";
|
|
10993
10958
|
|
|
10994
10959
|
// src/commands/backlog/reorderPhaseRows.ts
|
|
10995
|
-
import { and as and14, asc as asc8, eq as
|
|
10960
|
+
import { and as and14, asc as asc8, eq as eq29 } from "drizzle-orm";
|
|
10996
10961
|
|
|
10997
10962
|
// src/commands/backlog/reindexPhases.ts
|
|
10998
|
-
import { and as and13, asc as asc7, count as count4, eq as
|
|
10963
|
+
import { and as and13, asc as asc7, count as count4, eq as eq28 } from "drizzle-orm";
|
|
10999
10964
|
async function reindexPhases(db, itemId2) {
|
|
11000
|
-
const remaining = await db.select({ idx: planPhases.idx }).from(planPhases).where(
|
|
10965
|
+
const remaining = await db.select({ idx: planPhases.idx }).from(planPhases).where(eq28(planPhases.itemId, itemId2)).orderBy(asc7(planPhases.idx));
|
|
11001
10966
|
for (let i = 0; i < remaining.length; i++) {
|
|
11002
10967
|
const oldIdx = remaining[i].idx;
|
|
11003
10968
|
if (oldIdx === i) continue;
|
|
11004
|
-
await db.update(planTasks).set({ phaseIdx: i }).where(and13(
|
|
11005
|
-
await db.update(planPhases).set({ idx: i }).where(and13(
|
|
10969
|
+
await db.update(planTasks).set({ phaseIdx: i }).where(and13(eq28(planTasks.itemId, itemId2), eq28(planTasks.phaseIdx, oldIdx)));
|
|
10970
|
+
await db.update(planPhases).set({ idx: i }).where(and13(eq28(planPhases.itemId, itemId2), eq28(planPhases.idx, oldIdx)));
|
|
11006
10971
|
}
|
|
11007
10972
|
}
|
|
11008
10973
|
async function adjustCurrentPhase(db, item, removedIdx) {
|
|
@@ -11010,24 +10975,24 @@ async function adjustCurrentPhase(db, item, removedIdx) {
|
|
|
11010
10975
|
if (currentPhase === void 0) return;
|
|
11011
10976
|
const currentIdx = currentPhase - 1;
|
|
11012
10977
|
if (removedIdx < currentIdx) {
|
|
11013
|
-
await db.update(items).set({ currentPhase: currentPhase - 1 }).where(
|
|
10978
|
+
await db.update(items).set({ currentPhase: currentPhase - 1 }).where(eq28(items.id, item.id));
|
|
11014
10979
|
return;
|
|
11015
10980
|
}
|
|
11016
10981
|
if (removedIdx !== currentIdx) return;
|
|
11017
|
-
const [row] = await db.select({ cnt: count4() }).from(planPhases).where(
|
|
10982
|
+
const [row] = await db.select({ cnt: count4() }).from(planPhases).where(eq28(planPhases.itemId, item.id));
|
|
11018
10983
|
const cnt = row?.cnt ?? 0;
|
|
11019
|
-
await db.update(items).set({ currentPhase: cnt === 0 ? null : Math.min(currentPhase, cnt) }).where(
|
|
10984
|
+
await db.update(items).set({ currentPhase: cnt === 0 ? null : Math.min(currentPhase, cnt) }).where(eq28(items.id, item.id));
|
|
11020
10985
|
}
|
|
11021
10986
|
|
|
11022
10987
|
// src/commands/backlog/reorderPhaseRows.ts
|
|
11023
10988
|
async function reorderPhaseRows(orm, itemId2, fromIdx, toIdx) {
|
|
11024
10989
|
await orm.transaction(async (tx) => {
|
|
11025
|
-
const [phaseRow] = await tx.select({ name: planPhases.name, manualChecks: planPhases.manualChecks }).from(planPhases).where(and14(
|
|
11026
|
-
const tasks = await tx.select({ idx: planTasks.idx, task: planTasks.task }).from(planTasks).where(and14(
|
|
10990
|
+
const [phaseRow] = await tx.select({ name: planPhases.name, manualChecks: planPhases.manualChecks }).from(planPhases).where(and14(eq29(planPhases.itemId, itemId2), eq29(planPhases.idx, fromIdx)));
|
|
10991
|
+
const tasks = await tx.select({ idx: planTasks.idx, task: planTasks.task }).from(planTasks).where(and14(eq29(planTasks.itemId, itemId2), eq29(planTasks.phaseIdx, fromIdx))).orderBy(asc8(planTasks.idx));
|
|
11027
10992
|
await tx.delete(planTasks).where(
|
|
11028
|
-
and14(
|
|
10993
|
+
and14(eq29(planTasks.itemId, itemId2), eq29(planTasks.phaseIdx, fromIdx))
|
|
11029
10994
|
);
|
|
11030
|
-
await tx.delete(planPhases).where(and14(
|
|
10995
|
+
await tx.delete(planPhases).where(and14(eq29(planPhases.itemId, itemId2), eq29(planPhases.idx, fromIdx)));
|
|
11031
10996
|
await reindexPhases(tx, itemId2);
|
|
11032
10997
|
await shiftPhasesUp(tx, itemId2, toIdx);
|
|
11033
10998
|
await tx.insert(planPhases).values({
|
|
@@ -11054,7 +11019,7 @@ function toIndex(value, phaseCount) {
|
|
|
11054
11019
|
const pos = Number.parseInt(value, 10);
|
|
11055
11020
|
if (Number.isNaN(pos) || pos < 1 || pos > phaseCount) {
|
|
11056
11021
|
console.log(
|
|
11057
|
-
|
|
11022
|
+
chalk98.red(
|
|
11058
11023
|
`Position "${value}" is out of range. Must be between 1 and ${phaseCount}.`
|
|
11059
11024
|
)
|
|
11060
11025
|
);
|
|
@@ -11068,7 +11033,7 @@ async function movePhase(id, from, to) {
|
|
|
11068
11033
|
if (!found) return;
|
|
11069
11034
|
const { orm, item } = found;
|
|
11070
11035
|
const itemId2 = item.id;
|
|
11071
|
-
const [row] = await orm.select({ cnt: count5() }).from(planPhases).where(
|
|
11036
|
+
const [row] = await orm.select({ cnt: count5() }).from(planPhases).where(eq30(planPhases.itemId, itemId2));
|
|
11072
11037
|
const phaseCount = row?.cnt ?? 0;
|
|
11073
11038
|
const fromIdx = toIndex(from, phaseCount);
|
|
11074
11039
|
if (fromIdx === void 0) return;
|
|
@@ -11077,29 +11042,29 @@ async function movePhase(id, from, to) {
|
|
|
11077
11042
|
if (fromIdx !== toIdx) {
|
|
11078
11043
|
await reorderPhaseRows(orm, itemId2, fromIdx, toIdx);
|
|
11079
11044
|
}
|
|
11080
|
-
console.log(
|
|
11045
|
+
console.log(chalk98.green(`Moved phase ${from} to position ${to}.`));
|
|
11081
11046
|
}
|
|
11082
11047
|
|
|
11083
11048
|
// src/commands/backlog/updatePhase.ts
|
|
11084
|
-
import
|
|
11049
|
+
import chalk100 from "chalk";
|
|
11085
11050
|
|
|
11086
11051
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
11087
|
-
import { and as and15, eq as
|
|
11052
|
+
import { and as and15, eq as eq31 } from "drizzle-orm";
|
|
11088
11053
|
async function applyPhaseUpdate(orm, itemId2, phaseIdx, fields) {
|
|
11089
11054
|
await orm.transaction(async (tx) => {
|
|
11090
11055
|
if (fields.name) {
|
|
11091
11056
|
await tx.update(planPhases).set({ name: fields.name }).where(
|
|
11092
|
-
and15(
|
|
11057
|
+
and15(eq31(planPhases.itemId, itemId2), eq31(planPhases.idx, phaseIdx))
|
|
11093
11058
|
);
|
|
11094
11059
|
}
|
|
11095
11060
|
if (fields.manualCheck) {
|
|
11096
11061
|
await tx.update(planPhases).set({ manualChecks: JSON.stringify(fields.manualCheck) }).where(
|
|
11097
|
-
and15(
|
|
11062
|
+
and15(eq31(planPhases.itemId, itemId2), eq31(planPhases.idx, phaseIdx))
|
|
11098
11063
|
);
|
|
11099
11064
|
}
|
|
11100
11065
|
if (fields.task) {
|
|
11101
11066
|
await tx.delete(planTasks).where(
|
|
11102
|
-
and15(
|
|
11067
|
+
and15(eq31(planTasks.itemId, itemId2), eq31(planTasks.phaseIdx, phaseIdx))
|
|
11103
11068
|
);
|
|
11104
11069
|
if (fields.task.length) {
|
|
11105
11070
|
await tx.insert(planTasks).values(
|
|
@@ -11116,18 +11081,18 @@ async function applyPhaseUpdate(orm, itemId2, phaseIdx, fields) {
|
|
|
11116
11081
|
}
|
|
11117
11082
|
|
|
11118
11083
|
// src/commands/backlog/findPhase.ts
|
|
11119
|
-
import
|
|
11120
|
-
import { and as and16, count as count6, eq as
|
|
11084
|
+
import chalk99 from "chalk";
|
|
11085
|
+
import { and as and16, count as count6, eq as eq32 } from "drizzle-orm";
|
|
11121
11086
|
async function findPhase(id, phase) {
|
|
11122
11087
|
const found = await findOneItem(id);
|
|
11123
11088
|
if (!found) return void 0;
|
|
11124
11089
|
const { orm, item } = found;
|
|
11125
11090
|
const itemId2 = item.id;
|
|
11126
11091
|
const phaseIdx = Number.parseInt(phase, 10) - 1;
|
|
11127
|
-
const [row] = await orm.select({ cnt: count6() }).from(planPhases).where(and16(
|
|
11092
|
+
const [row] = await orm.select({ cnt: count6() }).from(planPhases).where(and16(eq32(planPhases.itemId, itemId2), eq32(planPhases.idx, phaseIdx)));
|
|
11128
11093
|
if (!row || row.cnt === 0) {
|
|
11129
11094
|
console.log(
|
|
11130
|
-
|
|
11095
|
+
chalk99.red(
|
|
11131
11096
|
`Phase ${phaseIdx + 1} not found on item ${formatItemId(itemId2)}.`
|
|
11132
11097
|
)
|
|
11133
11098
|
);
|
|
@@ -11261,7 +11226,7 @@ async function updatePhase(id, phase, options2) {
|
|
|
11261
11226
|
const { item, orm, itemId: itemId2, phaseIdx } = found;
|
|
11262
11227
|
const resolved = resolvePhaseFields(options2, item.plan?.[phaseIdx]);
|
|
11263
11228
|
if (!resolved.ok) {
|
|
11264
|
-
console.log(
|
|
11229
|
+
console.log(chalk100.red(resolved.error));
|
|
11265
11230
|
process.exitCode = 1;
|
|
11266
11231
|
return;
|
|
11267
11232
|
}
|
|
@@ -11273,7 +11238,7 @@ async function updatePhase(id, phase, options2) {
|
|
|
11273
11238
|
manualCheck && "manual checks"
|
|
11274
11239
|
].filter(Boolean).join(", ");
|
|
11275
11240
|
console.log(
|
|
11276
|
-
|
|
11241
|
+
chalk100.green(
|
|
11277
11242
|
`Updated ${fields} on phase ${phaseIdx + 1} of item ${formatItemId(itemId2)}.`
|
|
11278
11243
|
)
|
|
11279
11244
|
);
|
|
@@ -11296,30 +11261,30 @@ function registerUpdatePhaseCommand(cmd) {
|
|
|
11296
11261
|
}
|
|
11297
11262
|
|
|
11298
11263
|
// src/commands/backlog/removePhase.ts
|
|
11299
|
-
import
|
|
11300
|
-
import { and as and17, eq as
|
|
11264
|
+
import chalk101 from "chalk";
|
|
11265
|
+
import { and as and17, eq as eq33 } from "drizzle-orm";
|
|
11301
11266
|
async function removePhase(id, phase) {
|
|
11302
11267
|
const found = await findPhase(id, phase);
|
|
11303
11268
|
if (!found) return;
|
|
11304
11269
|
const { item, orm, itemId: itemId2, phaseIdx } = found;
|
|
11305
11270
|
await orm.transaction(async (tx) => {
|
|
11306
11271
|
await tx.delete(planTasks).where(
|
|
11307
|
-
and17(
|
|
11272
|
+
and17(eq33(planTasks.itemId, itemId2), eq33(planTasks.phaseIdx, phaseIdx))
|
|
11308
11273
|
);
|
|
11309
|
-
await tx.delete(planPhases).where(and17(
|
|
11274
|
+
await tx.delete(planPhases).where(and17(eq33(planPhases.itemId, itemId2), eq33(planPhases.idx, phaseIdx)));
|
|
11310
11275
|
await reindexPhases(tx, itemId2);
|
|
11311
11276
|
await adjustCurrentPhase(tx, item, phaseIdx);
|
|
11312
11277
|
});
|
|
11313
11278
|
console.log(
|
|
11314
|
-
|
|
11279
|
+
chalk101.green(
|
|
11315
11280
|
`Removed phase ${phaseIdx + 1} from item ${formatItemId(itemId2)}.`
|
|
11316
11281
|
)
|
|
11317
11282
|
);
|
|
11318
11283
|
}
|
|
11319
11284
|
|
|
11320
11285
|
// src/commands/backlog/update/index.ts
|
|
11321
|
-
import
|
|
11322
|
-
import { eq as
|
|
11286
|
+
import chalk103 from "chalk";
|
|
11287
|
+
import { eq as eq34 } from "drizzle-orm";
|
|
11323
11288
|
|
|
11324
11289
|
// src/commands/backlog/update/applyAcMutations.ts
|
|
11325
11290
|
function hasAcMutations(options2) {
|
|
@@ -11340,16 +11305,16 @@ function applyAcMutations(current, options2) {
|
|
|
11340
11305
|
}
|
|
11341
11306
|
|
|
11342
11307
|
// src/commands/backlog/update/buildUpdateValues.ts
|
|
11343
|
-
import
|
|
11308
|
+
import chalk102 from "chalk";
|
|
11344
11309
|
function buildUpdateValues(options2) {
|
|
11345
11310
|
const { name, desc: desc6, type, ac } = options2;
|
|
11346
11311
|
if (!name && !desc6 && !type && !ac) {
|
|
11347
|
-
console.log(
|
|
11312
|
+
console.log(chalk102.red("Nothing to update. Provide at least one flag."));
|
|
11348
11313
|
process.exitCode = 1;
|
|
11349
11314
|
return void 0;
|
|
11350
11315
|
}
|
|
11351
11316
|
if (type && type !== "story" && type !== "bug") {
|
|
11352
|
-
console.log(
|
|
11317
|
+
console.log(chalk102.red('Invalid type. Must be "story" or "bug".'));
|
|
11353
11318
|
process.exitCode = 1;
|
|
11354
11319
|
return void 0;
|
|
11355
11320
|
}
|
|
@@ -11382,14 +11347,14 @@ async function update(id, options2) {
|
|
|
11382
11347
|
if (hasAcMutations(options2)) {
|
|
11383
11348
|
if (options2.ac) {
|
|
11384
11349
|
console.log(
|
|
11385
|
-
|
|
11350
|
+
chalk103.red("Cannot combine --ac with --add-ac/--edit-ac/--remove-ac.")
|
|
11386
11351
|
);
|
|
11387
11352
|
process.exitCode = 1;
|
|
11388
11353
|
return;
|
|
11389
11354
|
}
|
|
11390
11355
|
const mutation = applyAcMutations(found.item.acceptanceCriteria, options2);
|
|
11391
11356
|
if (!mutation.ok) {
|
|
11392
|
-
console.log(
|
|
11357
|
+
console.log(chalk103.red(mutation.error));
|
|
11393
11358
|
process.exitCode = 1;
|
|
11394
11359
|
return;
|
|
11395
11360
|
}
|
|
@@ -11399,9 +11364,9 @@ async function update(id, options2) {
|
|
|
11399
11364
|
if (!built) return;
|
|
11400
11365
|
const { orm } = found;
|
|
11401
11366
|
const itemId2 = found.item.id;
|
|
11402
|
-
await orm.update(items).set(built.set).where(
|
|
11367
|
+
await orm.update(items).set(built.set).where(eq34(items.id, itemId2));
|
|
11403
11368
|
console.log(
|
|
11404
|
-
|
|
11369
|
+
chalk103.green(`Updated ${built.fields} on item ${formatItemId(itemId2)}.`)
|
|
11405
11370
|
);
|
|
11406
11371
|
}
|
|
11407
11372
|
|
|
@@ -12204,11 +12169,11 @@ function assertCliExists(cli) {
|
|
|
12204
12169
|
}
|
|
12205
12170
|
|
|
12206
12171
|
// src/commands/permitCliReads/colorize.ts
|
|
12207
|
-
import
|
|
12172
|
+
import chalk104 from "chalk";
|
|
12208
12173
|
function colorize(plainOutput) {
|
|
12209
12174
|
return plainOutput.split("\n").map((line) => {
|
|
12210
|
-
if (line.startsWith(" R ")) return
|
|
12211
|
-
if (line.startsWith(" W ")) return
|
|
12175
|
+
if (line.startsWith(" R ")) return chalk104.green(line);
|
|
12176
|
+
if (line.startsWith(" W ")) return chalk104.red(line);
|
|
12212
12177
|
return line;
|
|
12213
12178
|
}).join("\n");
|
|
12214
12179
|
}
|
|
@@ -12506,7 +12471,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
12506
12471
|
}
|
|
12507
12472
|
|
|
12508
12473
|
// src/commands/deny/denyAdd.ts
|
|
12509
|
-
import
|
|
12474
|
+
import chalk105 from "chalk";
|
|
12510
12475
|
|
|
12511
12476
|
// src/commands/deny/loadDenyConfig.ts
|
|
12512
12477
|
function loadDenyConfig(global) {
|
|
@@ -12526,16 +12491,16 @@ function loadDenyConfig(global) {
|
|
|
12526
12491
|
function denyAdd(pattern2, message, options2) {
|
|
12527
12492
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
12528
12493
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
12529
|
-
console.log(
|
|
12494
|
+
console.log(chalk105.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
12530
12495
|
return;
|
|
12531
12496
|
}
|
|
12532
12497
|
deny.push({ pattern: pattern2, message });
|
|
12533
12498
|
saveDeny(deny);
|
|
12534
|
-
console.log(
|
|
12499
|
+
console.log(chalk105.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
12535
12500
|
}
|
|
12536
12501
|
|
|
12537
12502
|
// src/commands/deny/denyList.ts
|
|
12538
|
-
import
|
|
12503
|
+
import chalk106 from "chalk";
|
|
12539
12504
|
function denyList() {
|
|
12540
12505
|
const globalRaw = loadGlobalConfigRaw();
|
|
12541
12506
|
const projectRaw = loadProjectConfig();
|
|
@@ -12546,7 +12511,7 @@ function denyList() {
|
|
|
12546
12511
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
12547
12512
|
);
|
|
12548
12513
|
if (!merged || merged.length === 0) {
|
|
12549
|
-
console.log(
|
|
12514
|
+
console.log(chalk106.dim("No deny rules configured."));
|
|
12550
12515
|
return;
|
|
12551
12516
|
}
|
|
12552
12517
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -12554,23 +12519,23 @@ function denyList() {
|
|
|
12554
12519
|
for (const rule of merged) {
|
|
12555
12520
|
const inProject = projectPatterns.has(rule.pattern);
|
|
12556
12521
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
12557
|
-
const label2 = inProject && inGlobal ?
|
|
12558
|
-
console.log(`${
|
|
12522
|
+
const label2 = inProject && inGlobal ? chalk106.dim(" (project, overrides global)") : inGlobal ? chalk106.dim(" (global)") : "";
|
|
12523
|
+
console.log(`${chalk106.red(rule.pattern)} \u2192 ${rule.message}${label2}`);
|
|
12559
12524
|
}
|
|
12560
12525
|
}
|
|
12561
12526
|
|
|
12562
12527
|
// src/commands/deny/denyRemove.ts
|
|
12563
|
-
import
|
|
12528
|
+
import chalk107 from "chalk";
|
|
12564
12529
|
function denyRemove(pattern2, options2) {
|
|
12565
12530
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
12566
12531
|
const index3 = deny.findIndex((r) => r.pattern === pattern2);
|
|
12567
12532
|
if (index3 === -1) {
|
|
12568
|
-
console.log(
|
|
12533
|
+
console.log(chalk107.yellow(`No deny rule found for: ${pattern2}`));
|
|
12569
12534
|
return;
|
|
12570
12535
|
}
|
|
12571
12536
|
deny.splice(index3, 1);
|
|
12572
12537
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
12573
|
-
console.log(
|
|
12538
|
+
console.log(chalk107.green(`Removed deny rule: ${pattern2}`));
|
|
12574
12539
|
}
|
|
12575
12540
|
|
|
12576
12541
|
// src/commands/registerDeny.ts
|
|
@@ -12614,7 +12579,7 @@ function registerCliHook(program2) {
|
|
|
12614
12579
|
|
|
12615
12580
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
12616
12581
|
import { existsSync as existsSync31, readFileSync as readFileSync27, unlinkSync as unlinkSync8, writeFileSync as writeFileSync24 } from "fs";
|
|
12617
|
-
import
|
|
12582
|
+
import chalk108 from "chalk";
|
|
12618
12583
|
|
|
12619
12584
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
12620
12585
|
import { homedir as homedir17 } from "os";
|
|
@@ -12667,12 +12632,12 @@ function codeCommentConfirm(pin) {
|
|
|
12667
12632
|
sweepRestrictedDir();
|
|
12668
12633
|
const state = readPinState(pin);
|
|
12669
12634
|
if (!state) {
|
|
12670
|
-
console.error(
|
|
12635
|
+
console.error(chalk108.red(`No pending comment for pin: ${pin}`));
|
|
12671
12636
|
process.exitCode = 1;
|
|
12672
12637
|
return;
|
|
12673
12638
|
}
|
|
12674
12639
|
if (!existsSync31(state.file)) {
|
|
12675
|
-
console.error(
|
|
12640
|
+
console.error(chalk108.red(`Target file no longer exists: ${state.file}`));
|
|
12676
12641
|
process.exitCode = 1;
|
|
12677
12642
|
return;
|
|
12678
12643
|
}
|
|
@@ -12681,7 +12646,7 @@ function codeCommentConfirm(pin) {
|
|
|
12681
12646
|
const index3 = state.line - 1;
|
|
12682
12647
|
if (index3 > lines.length) {
|
|
12683
12648
|
console.error(
|
|
12684
|
-
|
|
12649
|
+
chalk108.red(
|
|
12685
12650
|
`Line ${state.line} is beyond the end of ${state.file} (${lines.length} lines).`
|
|
12686
12651
|
)
|
|
12687
12652
|
);
|
|
@@ -12695,14 +12660,14 @@ function codeCommentConfirm(pin) {
|
|
|
12695
12660
|
writeFileSync24(state.file, lines.join("\n"));
|
|
12696
12661
|
unlinkSync8(getPinStatePath(pin));
|
|
12697
12662
|
console.log(
|
|
12698
|
-
|
|
12663
|
+
chalk108.green(
|
|
12699
12664
|
`Inserted "${marker} ${state.text}" at ${state.file}:${state.line}`
|
|
12700
12665
|
)
|
|
12701
12666
|
);
|
|
12702
12667
|
}
|
|
12703
12668
|
|
|
12704
12669
|
// src/commands/codeComment/codeCommentSet.ts
|
|
12705
|
-
import
|
|
12670
|
+
import chalk109 from "chalk";
|
|
12706
12671
|
|
|
12707
12672
|
// src/commands/codeComment/validateCommentText.ts
|
|
12708
12673
|
var MAX_COMMENT_LENGTH = 50;
|
|
@@ -12753,7 +12718,7 @@ function generatePin() {
|
|
|
12753
12718
|
function codeCommentSet(file, line, text17) {
|
|
12754
12719
|
const lineNumber = Number.parseInt(line, 10);
|
|
12755
12720
|
if (!Number.isInteger(lineNumber) || lineNumber < 1) {
|
|
12756
|
-
console.error(
|
|
12721
|
+
console.error(chalk109.red(`Invalid line number: ${line}`));
|
|
12757
12722
|
process.exitCode = 1;
|
|
12758
12723
|
return;
|
|
12759
12724
|
}
|
|
@@ -12761,20 +12726,20 @@ function codeCommentSet(file, line, text17) {
|
|
|
12761
12726
|
const marker = hash ? "#" : "//";
|
|
12762
12727
|
const validation = validateCommentText(text17, hash);
|
|
12763
12728
|
if (!validation.ok) {
|
|
12764
|
-
console.error(
|
|
12765
|
-
console.error(
|
|
12729
|
+
console.error(chalk109.red(`Refused: ${validation.reason}`));
|
|
12730
|
+
console.error(chalk109.red("No pin issued."));
|
|
12766
12731
|
process.exitCode = 1;
|
|
12767
12732
|
return;
|
|
12768
12733
|
}
|
|
12769
12734
|
console.error(
|
|
12770
|
-
|
|
12735
|
+
chalk109.yellow.bold(
|
|
12771
12736
|
"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."
|
|
12772
12737
|
)
|
|
12773
12738
|
);
|
|
12774
12739
|
const delivered = issuePin(file, lineNumber, validation.text);
|
|
12775
12740
|
if (!delivered) {
|
|
12776
12741
|
console.error(
|
|
12777
|
-
|
|
12742
|
+
chalk109.red(
|
|
12778
12743
|
"Could not deliver the confirmation pin via notification.\nThe comment cannot be confirmed until the notification channel works."
|
|
12779
12744
|
)
|
|
12780
12745
|
);
|
|
@@ -12784,7 +12749,7 @@ function codeCommentSet(file, line, text17) {
|
|
|
12784
12749
|
console.log(
|
|
12785
12750
|
`A confirmation pin was sent to your desktop notifications.
|
|
12786
12751
|
To insert "${marker} ${validation.text}" at ${file}:${lineNumber}, run:
|
|
12787
|
-
${
|
|
12752
|
+
${chalk109.cyan(" assist code-comment confirm <PIN>")}
|
|
12788
12753
|
using the pin from that notification.`
|
|
12789
12754
|
);
|
|
12790
12755
|
}
|
|
@@ -12863,15 +12828,15 @@ function registerCodexHook(program2) {
|
|
|
12863
12828
|
}
|
|
12864
12829
|
|
|
12865
12830
|
// src/commands/complexity/analyze.ts
|
|
12866
|
-
import
|
|
12831
|
+
import chalk118 from "chalk";
|
|
12867
12832
|
|
|
12868
12833
|
// src/commands/complexity/cyclomatic.ts
|
|
12869
|
-
import
|
|
12834
|
+
import chalk111 from "chalk";
|
|
12870
12835
|
|
|
12871
12836
|
// src/commands/complexity/shared/index.ts
|
|
12872
12837
|
import fs20 from "fs";
|
|
12873
12838
|
import path27 from "path";
|
|
12874
|
-
import
|
|
12839
|
+
import chalk110 from "chalk";
|
|
12875
12840
|
import ts5 from "typescript";
|
|
12876
12841
|
|
|
12877
12842
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -13122,7 +13087,7 @@ function createSourceFromFile(filePath) {
|
|
|
13122
13087
|
function withSourceFiles(pattern2, callback, extraIgnore = []) {
|
|
13123
13088
|
const files = findSourceFiles2(pattern2, ".", extraIgnore);
|
|
13124
13089
|
if (files.length === 0) {
|
|
13125
|
-
console.log(
|
|
13090
|
+
console.log(chalk110.yellow("No files found matching pattern"));
|
|
13126
13091
|
return void 0;
|
|
13127
13092
|
}
|
|
13128
13093
|
return callback(files);
|
|
@@ -13155,11 +13120,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
13155
13120
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
13156
13121
|
for (const { file, name, complexity } of results) {
|
|
13157
13122
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
13158
|
-
const color = exceedsThreshold ?
|
|
13159
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
13123
|
+
const color = exceedsThreshold ? chalk111.red : chalk111.white;
|
|
13124
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk111.cyan(complexity)}`);
|
|
13160
13125
|
}
|
|
13161
13126
|
console.log(
|
|
13162
|
-
|
|
13127
|
+
chalk111.dim(
|
|
13163
13128
|
`
|
|
13164
13129
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
13165
13130
|
)
|
|
@@ -13171,7 +13136,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
13171
13136
|
}
|
|
13172
13137
|
|
|
13173
13138
|
// src/commands/complexity/halstead.ts
|
|
13174
|
-
import
|
|
13139
|
+
import chalk112 from "chalk";
|
|
13175
13140
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
13176
13141
|
withSourceFiles(pattern2, (files) => {
|
|
13177
13142
|
const results = [];
|
|
@@ -13186,13 +13151,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
13186
13151
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
13187
13152
|
for (const { file, name, metrics } of results) {
|
|
13188
13153
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
13189
|
-
const color = exceedsThreshold ?
|
|
13154
|
+
const color = exceedsThreshold ? chalk112.red : chalk112.white;
|
|
13190
13155
|
console.log(
|
|
13191
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
13156
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk112.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk112.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk112.magenta(metrics.effort.toFixed(1))}`
|
|
13192
13157
|
);
|
|
13193
13158
|
}
|
|
13194
13159
|
console.log(
|
|
13195
|
-
|
|
13160
|
+
chalk112.dim(
|
|
13196
13161
|
`
|
|
13197
13162
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
13198
13163
|
)
|
|
@@ -13204,27 +13169,27 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
13204
13169
|
}
|
|
13205
13170
|
|
|
13206
13171
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
13207
|
-
import
|
|
13172
|
+
import chalk115 from "chalk";
|
|
13208
13173
|
|
|
13209
13174
|
// src/commands/complexity/maintainability/formatResultLine.ts
|
|
13210
|
-
import
|
|
13175
|
+
import chalk113 from "chalk";
|
|
13211
13176
|
function formatResultLine(entry, failing) {
|
|
13212
13177
|
const { file, avgMaintainability, minMaintainability, override } = entry;
|
|
13213
|
-
const name = failing ?
|
|
13214
|
-
const suffix = override !== void 0 ?
|
|
13215
|
-
return `${name} \u2192 avg: ${
|
|
13178
|
+
const name = failing ? chalk113.red(file) : chalk113.white(file);
|
|
13179
|
+
const suffix = override !== void 0 ? chalk113.magenta(` (override: ${override})`) : "";
|
|
13180
|
+
return `${name} \u2192 avg: ${chalk113.cyan(avgMaintainability.toFixed(1))}, min: ${chalk113.yellow(minMaintainability.toFixed(1))}${suffix}`;
|
|
13216
13181
|
}
|
|
13217
13182
|
|
|
13218
13183
|
// src/commands/complexity/maintainability/printMaintainabilityFailure.ts
|
|
13219
|
-
import
|
|
13184
|
+
import chalk114 from "chalk";
|
|
13220
13185
|
function printMaintainabilityFailure(failingCount, threshold) {
|
|
13221
13186
|
const thresholdLabel = threshold !== void 0 ? ` ${threshold}` : "";
|
|
13222
13187
|
console.error(
|
|
13223
|
-
|
|
13188
|
+
chalk114.red(
|
|
13224
13189
|
`
|
|
13225
13190
|
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.
|
|
13226
13191
|
|
|
13227
|
-
\u26A0\uFE0F ${
|
|
13192
|
+
\u26A0\uFE0F ${chalk114.bold("Diagnose and fix one file at a time")} \u2014 do not investigate or fix multiple files in parallel.
|
|
13228
13193
|
|
|
13229
13194
|
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.`
|
|
13230
13195
|
)
|
|
@@ -13236,7 +13201,7 @@ function displayMaintainabilityResults(results, threshold) {
|
|
|
13236
13201
|
const gating = threshold !== void 0 || results.some((r) => r.override !== void 0);
|
|
13237
13202
|
if (!gating) {
|
|
13238
13203
|
for (const entry of results) console.log(formatResultLine(entry, false));
|
|
13239
|
-
console.log(
|
|
13204
|
+
console.log(chalk115.dim(`
|
|
13240
13205
|
Analyzed ${results.length} files`));
|
|
13241
13206
|
return;
|
|
13242
13207
|
}
|
|
@@ -13245,7 +13210,7 @@ Analyzed ${results.length} files`));
|
|
|
13245
13210
|
return limit !== void 0 && r.minMaintainability < limit;
|
|
13246
13211
|
});
|
|
13247
13212
|
if (failing.length === 0) {
|
|
13248
|
-
console.log(
|
|
13213
|
+
console.log(chalk115.green("All files pass maintainability threshold"));
|
|
13249
13214
|
} else {
|
|
13250
13215
|
for (const entry of failing) console.log(formatResultLine(entry, true));
|
|
13251
13216
|
}
|
|
@@ -13254,7 +13219,7 @@ Analyzed ${results.length} files`));
|
|
|
13254
13219
|
);
|
|
13255
13220
|
for (const entry of passingOverrides)
|
|
13256
13221
|
console.log(formatResultLine(entry, false));
|
|
13257
|
-
console.log(
|
|
13222
|
+
console.log(chalk115.dim(`
|
|
13258
13223
|
Analyzed ${results.length} files`));
|
|
13259
13224
|
if (failing.length > 0) {
|
|
13260
13225
|
printMaintainabilityFailure(failing.length, threshold);
|
|
@@ -13263,10 +13228,10 @@ Analyzed ${results.length} files`));
|
|
|
13263
13228
|
}
|
|
13264
13229
|
|
|
13265
13230
|
// src/commands/complexity/maintainability/printMaintainabilityFormula.ts
|
|
13266
|
-
import
|
|
13231
|
+
import chalk116 from "chalk";
|
|
13267
13232
|
var MI_FORMULA = "171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100";
|
|
13268
13233
|
function printMaintainabilityFormula() {
|
|
13269
|
-
console.log(
|
|
13234
|
+
console.log(chalk116.dim(MI_FORMULA));
|
|
13270
13235
|
}
|
|
13271
13236
|
|
|
13272
13237
|
// src/commands/complexity/maintainability/collectFileMetrics.ts
|
|
@@ -13342,7 +13307,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
13342
13307
|
|
|
13343
13308
|
// src/commands/complexity/sloc.ts
|
|
13344
13309
|
import fs22 from "fs";
|
|
13345
|
-
import
|
|
13310
|
+
import chalk117 from "chalk";
|
|
13346
13311
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
13347
13312
|
withSourceFiles(pattern2, (files) => {
|
|
13348
13313
|
const results = [];
|
|
@@ -13358,12 +13323,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
13358
13323
|
results.sort((a, b) => b.lines - a.lines);
|
|
13359
13324
|
for (const { file, lines } of results) {
|
|
13360
13325
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
13361
|
-
const color = exceedsThreshold ?
|
|
13362
|
-
console.log(`${color(file)} \u2192 ${
|
|
13326
|
+
const color = exceedsThreshold ? chalk117.red : chalk117.white;
|
|
13327
|
+
console.log(`${color(file)} \u2192 ${chalk117.cyan(lines)} lines`);
|
|
13363
13328
|
}
|
|
13364
13329
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
13365
13330
|
console.log(
|
|
13366
|
-
|
|
13331
|
+
chalk117.dim(`
|
|
13367
13332
|
Total: ${total} lines across ${files.length} files`)
|
|
13368
13333
|
);
|
|
13369
13334
|
if (hasViolation) {
|
|
@@ -13377,25 +13342,25 @@ async function analyze(pattern2) {
|
|
|
13377
13342
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
13378
13343
|
const files = findSourceFiles2(searchPattern);
|
|
13379
13344
|
if (files.length === 0) {
|
|
13380
|
-
console.log(
|
|
13345
|
+
console.log(chalk118.yellow("No files found matching pattern"));
|
|
13381
13346
|
return;
|
|
13382
13347
|
}
|
|
13383
13348
|
if (files.length === 1) {
|
|
13384
13349
|
const file = files[0];
|
|
13385
|
-
console.log(
|
|
13350
|
+
console.log(chalk118.bold.underline("SLOC"));
|
|
13386
13351
|
await sloc(file);
|
|
13387
13352
|
console.log();
|
|
13388
|
-
console.log(
|
|
13353
|
+
console.log(chalk118.bold.underline("Cyclomatic Complexity"));
|
|
13389
13354
|
await cyclomatic(file);
|
|
13390
13355
|
console.log();
|
|
13391
|
-
console.log(
|
|
13356
|
+
console.log(chalk118.bold.underline("Halstead Metrics"));
|
|
13392
13357
|
await halstead(file);
|
|
13393
13358
|
console.log();
|
|
13394
|
-
console.log(
|
|
13359
|
+
console.log(chalk118.bold.underline("Maintainability Index"));
|
|
13395
13360
|
await maintainability(file);
|
|
13396
13361
|
console.log();
|
|
13397
13362
|
console.log(
|
|
13398
|
-
|
|
13363
|
+
chalk118.dim(
|
|
13399
13364
|
"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."
|
|
13400
13365
|
)
|
|
13401
13366
|
);
|
|
@@ -13439,7 +13404,7 @@ function registerComplexity(program2) {
|
|
|
13439
13404
|
}
|
|
13440
13405
|
|
|
13441
13406
|
// src/commands/config/index.ts
|
|
13442
|
-
import
|
|
13407
|
+
import chalk119 from "chalk";
|
|
13443
13408
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
13444
13409
|
|
|
13445
13410
|
// src/commands/config/setNestedValue.ts
|
|
@@ -13502,7 +13467,7 @@ function formatIssuePath(issue, key) {
|
|
|
13502
13467
|
function printValidationErrors(issues, key) {
|
|
13503
13468
|
for (const issue of issues) {
|
|
13504
13469
|
console.error(
|
|
13505
|
-
|
|
13470
|
+
chalk119.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
13506
13471
|
);
|
|
13507
13472
|
}
|
|
13508
13473
|
}
|
|
@@ -13519,7 +13484,7 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
13519
13484
|
function assertNotGlobalOnly(key, global) {
|
|
13520
13485
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
13521
13486
|
console.error(
|
|
13522
|
-
|
|
13487
|
+
chalk119.red(
|
|
13523
13488
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
13524
13489
|
)
|
|
13525
13490
|
);
|
|
@@ -13542,7 +13507,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
13542
13507
|
applyConfigSet(key, coerced, options2.global ?? false);
|
|
13543
13508
|
const target = options2.global ? "global" : "project";
|
|
13544
13509
|
console.log(
|
|
13545
|
-
|
|
13510
|
+
chalk119.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
13546
13511
|
);
|
|
13547
13512
|
}
|
|
13548
13513
|
function configList() {
|
|
@@ -13551,7 +13516,7 @@ function configList() {
|
|
|
13551
13516
|
}
|
|
13552
13517
|
|
|
13553
13518
|
// src/commands/config/configGet.ts
|
|
13554
|
-
import
|
|
13519
|
+
import chalk120 from "chalk";
|
|
13555
13520
|
|
|
13556
13521
|
// src/commands/config/getNestedValue.ts
|
|
13557
13522
|
function isTraversable(value) {
|
|
@@ -13583,7 +13548,7 @@ function requireNestedValue(config, key) {
|
|
|
13583
13548
|
return value;
|
|
13584
13549
|
}
|
|
13585
13550
|
function exitKeyNotSet(key) {
|
|
13586
|
-
console.error(
|
|
13551
|
+
console.error(chalk120.red(`Key "${key}" is not set`));
|
|
13587
13552
|
process.exit(1);
|
|
13588
13553
|
}
|
|
13589
13554
|
|
|
@@ -13596,40 +13561,40 @@ function registerConfig(program2) {
|
|
|
13596
13561
|
}
|
|
13597
13562
|
|
|
13598
13563
|
// src/commands/db/reportMigrationStatus.ts
|
|
13599
|
-
import
|
|
13564
|
+
import chalk121 from "chalk";
|
|
13600
13565
|
function reportApplied(applied) {
|
|
13601
13566
|
if (applied.length === 0) {
|
|
13602
|
-
console.error(
|
|
13567
|
+
console.error(chalk121.green("Database is up to date; nothing to apply."));
|
|
13603
13568
|
return;
|
|
13604
13569
|
}
|
|
13605
13570
|
for (const migration of applied) {
|
|
13606
13571
|
console.error(
|
|
13607
|
-
|
|
13572
|
+
chalk121.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
13608
13573
|
);
|
|
13609
13574
|
}
|
|
13610
13575
|
}
|
|
13611
13576
|
function reportMigrationStatus(status3) {
|
|
13612
13577
|
if (status3.state === "in-sync") {
|
|
13613
13578
|
console.error(
|
|
13614
|
-
|
|
13579
|
+
chalk121.green(`In sync at migration ${status3.version} (latest).`)
|
|
13615
13580
|
);
|
|
13616
13581
|
return;
|
|
13617
13582
|
}
|
|
13618
13583
|
if (status3.state === "behind") {
|
|
13619
13584
|
console.error(
|
|
13620
|
-
|
|
13585
|
+
chalk121.yellow(
|
|
13621
13586
|
`Behind: applied ${status3.applied}, build expects ${status3.expected}.`
|
|
13622
13587
|
)
|
|
13623
13588
|
);
|
|
13624
13589
|
console.error(
|
|
13625
|
-
|
|
13590
|
+
chalk121.yellow(
|
|
13626
13591
|
`Pending: ${status3.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
13627
13592
|
)
|
|
13628
13593
|
);
|
|
13629
13594
|
return;
|
|
13630
13595
|
}
|
|
13631
13596
|
console.error(
|
|
13632
|
-
|
|
13597
|
+
chalk121.red(
|
|
13633
13598
|
`Ahead: applied ${status3.applied}, build knows ${status3.expected}. Update assist.`
|
|
13634
13599
|
)
|
|
13635
13600
|
);
|
|
@@ -13664,7 +13629,7 @@ function registerDb(program2) {
|
|
|
13664
13629
|
|
|
13665
13630
|
// src/commands/deploy/redirect.ts
|
|
13666
13631
|
import { existsSync as existsSync32, readFileSync as readFileSync28, writeFileSync as writeFileSync26 } from "fs";
|
|
13667
|
-
import
|
|
13632
|
+
import chalk122 from "chalk";
|
|
13668
13633
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
13669
13634
|
if (!window.location.pathname.endsWith('/')) {
|
|
13670
13635
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -13673,23 +13638,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
13673
13638
|
function redirect() {
|
|
13674
13639
|
const indexPath = "index.html";
|
|
13675
13640
|
if (!existsSync32(indexPath)) {
|
|
13676
|
-
console.log(
|
|
13641
|
+
console.log(chalk122.yellow("No index.html found"));
|
|
13677
13642
|
return;
|
|
13678
13643
|
}
|
|
13679
13644
|
const content = readFileSync28(indexPath, "utf8");
|
|
13680
13645
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
13681
|
-
console.log(
|
|
13646
|
+
console.log(chalk122.dim("Trailing slash script already present"));
|
|
13682
13647
|
return;
|
|
13683
13648
|
}
|
|
13684
13649
|
const headCloseIndex = content.indexOf("</head>");
|
|
13685
13650
|
if (headCloseIndex === -1) {
|
|
13686
|
-
console.log(
|
|
13651
|
+
console.log(chalk122.red("Could not find </head> tag in index.html"));
|
|
13687
13652
|
return;
|
|
13688
13653
|
}
|
|
13689
13654
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
13690
13655
|
${content.slice(headCloseIndex)}`;
|
|
13691
13656
|
writeFileSync26(indexPath, newContent);
|
|
13692
|
-
console.log(
|
|
13657
|
+
console.log(chalk122.green("Added trailing slash redirect to index.html"));
|
|
13693
13658
|
}
|
|
13694
13659
|
|
|
13695
13660
|
// src/commands/registerDeploy.ts
|
|
@@ -13716,7 +13681,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
13716
13681
|
|
|
13717
13682
|
// src/commands/devlog/shared.ts
|
|
13718
13683
|
import { execSync as execSync31 } from "child_process";
|
|
13719
|
-
import
|
|
13684
|
+
import chalk123 from "chalk";
|
|
13720
13685
|
|
|
13721
13686
|
// src/shared/getRepoName.ts
|
|
13722
13687
|
import { existsSync as existsSync33, readFileSync as readFileSync29 } from "fs";
|
|
@@ -13825,13 +13790,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
13825
13790
|
}
|
|
13826
13791
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
13827
13792
|
for (const commit2 of commits2) {
|
|
13828
|
-
console.log(` ${
|
|
13793
|
+
console.log(` ${chalk123.yellow(commit2.hash)} ${commit2.message}`);
|
|
13829
13794
|
if (verbose) {
|
|
13830
13795
|
const visibleFiles = commit2.files.filter(
|
|
13831
13796
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
13832
13797
|
);
|
|
13833
13798
|
for (const file of visibleFiles) {
|
|
13834
|
-
console.log(` ${
|
|
13799
|
+
console.log(` ${chalk123.dim(file)}`);
|
|
13835
13800
|
}
|
|
13836
13801
|
}
|
|
13837
13802
|
}
|
|
@@ -13856,15 +13821,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
13856
13821
|
}
|
|
13857
13822
|
|
|
13858
13823
|
// src/commands/devlog/list/printDateHeader.ts
|
|
13859
|
-
import
|
|
13824
|
+
import chalk124 from "chalk";
|
|
13860
13825
|
function printDateHeader(date, isSkipped, entries) {
|
|
13861
13826
|
if (isSkipped) {
|
|
13862
|
-
console.log(`${
|
|
13827
|
+
console.log(`${chalk124.bold.blue(date)} ${chalk124.dim("skipped")}`);
|
|
13863
13828
|
} else if (entries && entries.length > 0) {
|
|
13864
|
-
const entryInfo = entries.map((e) => `${
|
|
13865
|
-
console.log(`${
|
|
13829
|
+
const entryInfo = entries.map((e) => `${chalk124.green(e.version)} ${e.title}`).join(" | ");
|
|
13830
|
+
console.log(`${chalk124.bold.blue(date)} ${entryInfo}`);
|
|
13866
13831
|
} else {
|
|
13867
|
-
console.log(`${
|
|
13832
|
+
console.log(`${chalk124.bold.blue(date)} ${chalk124.red("\u26A0 devlog missing")}`);
|
|
13868
13833
|
}
|
|
13869
13834
|
}
|
|
13870
13835
|
|
|
@@ -13968,24 +13933,24 @@ function bumpVersion(version2, type) {
|
|
|
13968
13933
|
|
|
13969
13934
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
13970
13935
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
13971
|
-
import
|
|
13936
|
+
import chalk126 from "chalk";
|
|
13972
13937
|
|
|
13973
13938
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
13974
|
-
import
|
|
13939
|
+
import chalk125 from "chalk";
|
|
13975
13940
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
13976
13941
|
if (conventional && firstHash) {
|
|
13977
13942
|
const version2 = getVersionAtCommit(firstHash);
|
|
13978
13943
|
if (version2) {
|
|
13979
|
-
console.log(`${
|
|
13944
|
+
console.log(`${chalk125.bold("version:")} ${stripToMinor(version2)}`);
|
|
13980
13945
|
} else {
|
|
13981
|
-
console.log(`${
|
|
13946
|
+
console.log(`${chalk125.bold("version:")} ${chalk125.red("unknown")}`);
|
|
13982
13947
|
}
|
|
13983
13948
|
} else if (patchVersion && minorVersion) {
|
|
13984
13949
|
console.log(
|
|
13985
|
-
`${
|
|
13950
|
+
`${chalk125.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
13986
13951
|
);
|
|
13987
13952
|
} else {
|
|
13988
|
-
console.log(`${
|
|
13953
|
+
console.log(`${chalk125.bold("version:")} v0.1 (initial)`);
|
|
13989
13954
|
}
|
|
13990
13955
|
}
|
|
13991
13956
|
|
|
@@ -14033,16 +13998,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
14033
13998
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
14034
13999
|
}
|
|
14035
14000
|
function logName(repoName) {
|
|
14036
|
-
console.log(`${
|
|
14001
|
+
console.log(`${chalk126.bold("name:")} ${repoName}`);
|
|
14037
14002
|
}
|
|
14038
14003
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
14039
14004
|
logName(ctx.repoName);
|
|
14040
14005
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
14041
|
-
console.log(
|
|
14006
|
+
console.log(chalk126.bold.blue(targetDate));
|
|
14042
14007
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
14043
14008
|
}
|
|
14044
14009
|
function logNoCommits(lastInfo) {
|
|
14045
|
-
console.log(
|
|
14010
|
+
console.log(chalk126.dim(noCommitsMessage(!!lastInfo)));
|
|
14046
14011
|
}
|
|
14047
14012
|
|
|
14048
14013
|
// src/commands/devlog/next/index.ts
|
|
@@ -14083,11 +14048,11 @@ function next2(options2) {
|
|
|
14083
14048
|
import { execSync as execSync33 } from "child_process";
|
|
14084
14049
|
|
|
14085
14050
|
// src/commands/devlog/repos/printReposTable.ts
|
|
14086
|
-
import
|
|
14051
|
+
import chalk127 from "chalk";
|
|
14087
14052
|
function colorStatus(status3) {
|
|
14088
|
-
if (status3 === "missing") return
|
|
14089
|
-
if (status3 === "outdated") return
|
|
14090
|
-
return
|
|
14053
|
+
if (status3 === "missing") return chalk127.red(status3);
|
|
14054
|
+
if (status3 === "outdated") return chalk127.yellow(status3);
|
|
14055
|
+
return chalk127.green(status3);
|
|
14091
14056
|
}
|
|
14092
14057
|
function formatRow(row, nameWidth) {
|
|
14093
14058
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -14101,8 +14066,8 @@ function printReposTable(rows) {
|
|
|
14101
14066
|
"Last Devlog".padEnd(11),
|
|
14102
14067
|
"Status"
|
|
14103
14068
|
].join(" ");
|
|
14104
|
-
console.log(
|
|
14105
|
-
console.log(
|
|
14069
|
+
console.log(chalk127.dim(header));
|
|
14070
|
+
console.log(chalk127.dim("-".repeat(header.length)));
|
|
14106
14071
|
for (const row of rows) {
|
|
14107
14072
|
console.log(formatRow(row, nameWidth));
|
|
14108
14073
|
}
|
|
@@ -14160,14 +14125,14 @@ function repos(options2) {
|
|
|
14160
14125
|
// src/commands/devlog/skip.ts
|
|
14161
14126
|
import { writeFileSync as writeFileSync27 } from "fs";
|
|
14162
14127
|
import { join as join36 } from "path";
|
|
14163
|
-
import
|
|
14128
|
+
import chalk128 from "chalk";
|
|
14164
14129
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
14165
14130
|
function getBlogConfigPath() {
|
|
14166
14131
|
return join36(BLOG_REPO_ROOT, "assist.yml");
|
|
14167
14132
|
}
|
|
14168
14133
|
function skip(date) {
|
|
14169
14134
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
14170
|
-
console.log(
|
|
14135
|
+
console.log(chalk128.red("Invalid date format. Use YYYY-MM-DD"));
|
|
14171
14136
|
process.exit(1);
|
|
14172
14137
|
}
|
|
14173
14138
|
const repoName = getRepoName();
|
|
@@ -14178,7 +14143,7 @@ function skip(date) {
|
|
|
14178
14143
|
const skipDays = skip2[repoName] ?? [];
|
|
14179
14144
|
if (skipDays.includes(date)) {
|
|
14180
14145
|
console.log(
|
|
14181
|
-
|
|
14146
|
+
chalk128.yellow(`${date} is already in skip list for ${repoName}`)
|
|
14182
14147
|
);
|
|
14183
14148
|
return;
|
|
14184
14149
|
}
|
|
@@ -14188,20 +14153,20 @@ function skip(date) {
|
|
|
14188
14153
|
devlog.skip = skip2;
|
|
14189
14154
|
config.devlog = devlog;
|
|
14190
14155
|
writeFileSync27(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
14191
|
-
console.log(
|
|
14156
|
+
console.log(chalk128.green(`Added ${date} to skip list for ${repoName}`));
|
|
14192
14157
|
}
|
|
14193
14158
|
|
|
14194
14159
|
// src/commands/devlog/version.ts
|
|
14195
|
-
import
|
|
14160
|
+
import chalk129 from "chalk";
|
|
14196
14161
|
function version() {
|
|
14197
14162
|
const config = loadConfig();
|
|
14198
14163
|
const name = getRepoName();
|
|
14199
14164
|
const lastInfo = getLastVersionInfo(name, config);
|
|
14200
14165
|
const lastVersion = lastInfo?.version ?? null;
|
|
14201
14166
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
14202
|
-
console.log(`${
|
|
14203
|
-
console.log(`${
|
|
14204
|
-
console.log(`${
|
|
14167
|
+
console.log(`${chalk129.bold("name:")} ${name}`);
|
|
14168
|
+
console.log(`${chalk129.bold("last:")} ${lastVersion ?? chalk129.dim("none")}`);
|
|
14169
|
+
console.log(`${chalk129.bold("next:")} ${nextVersion ?? chalk129.dim("none")}`);
|
|
14205
14170
|
}
|
|
14206
14171
|
|
|
14207
14172
|
// src/commands/devlog/devlogConfigHelp.ts
|
|
@@ -14245,7 +14210,7 @@ function registerDevlog(program2) {
|
|
|
14245
14210
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
14246
14211
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync5 } from "fs";
|
|
14247
14212
|
import { join as join37 } from "path";
|
|
14248
|
-
import
|
|
14213
|
+
import chalk130 from "chalk";
|
|
14249
14214
|
|
|
14250
14215
|
// src/shared/findRepoRoot.ts
|
|
14251
14216
|
import { existsSync as existsSync34 } from "fs";
|
|
@@ -14308,14 +14273,14 @@ function checkBuildLocks(startDir) {
|
|
|
14308
14273
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
14309
14274
|
if (locked) {
|
|
14310
14275
|
console.error(
|
|
14311
|
-
|
|
14276
|
+
chalk130.red("Build output locked (is VS debugging?): ") + locked
|
|
14312
14277
|
);
|
|
14313
14278
|
process.exit(1);
|
|
14314
14279
|
}
|
|
14315
14280
|
}
|
|
14316
14281
|
async function checkBuildLocksCommand() {
|
|
14317
14282
|
checkBuildLocks();
|
|
14318
|
-
console.log(
|
|
14283
|
+
console.log(chalk130.green("No build locks detected"));
|
|
14319
14284
|
}
|
|
14320
14285
|
|
|
14321
14286
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -14414,30 +14379,30 @@ function escapeRegex(s) {
|
|
|
14414
14379
|
}
|
|
14415
14380
|
|
|
14416
14381
|
// src/commands/dotnet/printTree.ts
|
|
14417
|
-
import
|
|
14382
|
+
import chalk131 from "chalk";
|
|
14418
14383
|
function printNodes(nodes, prefix2) {
|
|
14419
14384
|
for (let i = 0; i < nodes.length; i++) {
|
|
14420
14385
|
const isLast = i === nodes.length - 1;
|
|
14421
14386
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
14422
14387
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
14423
14388
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
14424
|
-
const label2 = isMissing ?
|
|
14389
|
+
const label2 = isMissing ? chalk131.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
14425
14390
|
console.log(`${prefix2}${connector}${label2}`);
|
|
14426
14391
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
14427
14392
|
}
|
|
14428
14393
|
}
|
|
14429
14394
|
function printTree(tree, totalCount, solutions) {
|
|
14430
|
-
console.log(
|
|
14431
|
-
console.log(
|
|
14395
|
+
console.log(chalk131.bold("\nProject Dependency Tree"));
|
|
14396
|
+
console.log(chalk131.cyan(tree.relativePath));
|
|
14432
14397
|
printNodes(tree.children, "");
|
|
14433
|
-
console.log(
|
|
14398
|
+
console.log(chalk131.dim(`
|
|
14434
14399
|
${totalCount} projects total (including root)`));
|
|
14435
|
-
console.log(
|
|
14400
|
+
console.log(chalk131.bold("\nSolution Membership"));
|
|
14436
14401
|
if (solutions.length === 0) {
|
|
14437
|
-
console.log(
|
|
14402
|
+
console.log(chalk131.yellow(" Not found in any .sln"));
|
|
14438
14403
|
} else {
|
|
14439
14404
|
for (const sln of solutions) {
|
|
14440
|
-
console.log(` ${
|
|
14405
|
+
console.log(` ${chalk131.green(sln)}`);
|
|
14441
14406
|
}
|
|
14442
14407
|
}
|
|
14443
14408
|
console.log();
|
|
@@ -14466,16 +14431,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
14466
14431
|
// src/commands/dotnet/resolveCsproj.ts
|
|
14467
14432
|
import { existsSync as existsSync35 } from "fs";
|
|
14468
14433
|
import path31 from "path";
|
|
14469
|
-
import
|
|
14434
|
+
import chalk132 from "chalk";
|
|
14470
14435
|
function resolveCsproj(csprojPath) {
|
|
14471
14436
|
const resolved = path31.resolve(csprojPath);
|
|
14472
14437
|
if (!existsSync35(resolved)) {
|
|
14473
|
-
console.error(
|
|
14438
|
+
console.error(chalk132.red(`File not found: ${resolved}`));
|
|
14474
14439
|
process.exit(1);
|
|
14475
14440
|
}
|
|
14476
14441
|
const repoRoot = findRepoRoot(path31.dirname(resolved));
|
|
14477
14442
|
if (!repoRoot) {
|
|
14478
|
-
console.error(
|
|
14443
|
+
console.error(chalk132.red("Could not find git repository root"));
|
|
14479
14444
|
process.exit(1);
|
|
14480
14445
|
}
|
|
14481
14446
|
return { resolved, repoRoot };
|
|
@@ -14525,12 +14490,12 @@ function getChangedCsFiles(scope) {
|
|
|
14525
14490
|
}
|
|
14526
14491
|
|
|
14527
14492
|
// src/commands/dotnet/inSln.ts
|
|
14528
|
-
import
|
|
14493
|
+
import chalk133 from "chalk";
|
|
14529
14494
|
async function inSln(csprojPath) {
|
|
14530
14495
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
14531
14496
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
14532
14497
|
if (solutions.length === 0) {
|
|
14533
|
-
console.log(
|
|
14498
|
+
console.log(chalk133.yellow("Not found in any .sln file"));
|
|
14534
14499
|
process.exit(1);
|
|
14535
14500
|
}
|
|
14536
14501
|
for (const sln of solutions) {
|
|
@@ -14539,7 +14504,7 @@ async function inSln(csprojPath) {
|
|
|
14539
14504
|
}
|
|
14540
14505
|
|
|
14541
14506
|
// src/commands/dotnet/inspect.ts
|
|
14542
|
-
import
|
|
14507
|
+
import chalk139 from "chalk";
|
|
14543
14508
|
|
|
14544
14509
|
// src/shared/formatElapsed.ts
|
|
14545
14510
|
function formatElapsed(ms) {
|
|
@@ -14551,12 +14516,12 @@ function formatElapsed(ms) {
|
|
|
14551
14516
|
}
|
|
14552
14517
|
|
|
14553
14518
|
// src/commands/dotnet/displayIssues.ts
|
|
14554
|
-
import
|
|
14519
|
+
import chalk134 from "chalk";
|
|
14555
14520
|
var SEVERITY_COLOR = {
|
|
14556
|
-
ERROR:
|
|
14557
|
-
WARNING:
|
|
14558
|
-
SUGGESTION:
|
|
14559
|
-
HINT:
|
|
14521
|
+
ERROR: chalk134.red,
|
|
14522
|
+
WARNING: chalk134.yellow,
|
|
14523
|
+
SUGGESTION: chalk134.cyan,
|
|
14524
|
+
HINT: chalk134.dim
|
|
14560
14525
|
};
|
|
14561
14526
|
function groupByFile(issues) {
|
|
14562
14527
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -14572,15 +14537,15 @@ function groupByFile(issues) {
|
|
|
14572
14537
|
}
|
|
14573
14538
|
function displayIssues(issues) {
|
|
14574
14539
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
14575
|
-
console.log(
|
|
14540
|
+
console.log(chalk134.bold(file));
|
|
14576
14541
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
14577
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
14542
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk134.white;
|
|
14578
14543
|
console.log(
|
|
14579
|
-
` ${
|
|
14544
|
+
` ${chalk134.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
14580
14545
|
);
|
|
14581
14546
|
}
|
|
14582
14547
|
}
|
|
14583
|
-
console.log(
|
|
14548
|
+
console.log(chalk134.dim(`
|
|
14584
14549
|
${issues.length} issue(s) found`));
|
|
14585
14550
|
}
|
|
14586
14551
|
|
|
@@ -14639,12 +14604,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
14639
14604
|
// src/commands/dotnet/resolveSolution.ts
|
|
14640
14605
|
import { existsSync as existsSync36 } from "fs";
|
|
14641
14606
|
import path32 from "path";
|
|
14642
|
-
import
|
|
14607
|
+
import chalk136 from "chalk";
|
|
14643
14608
|
|
|
14644
14609
|
// src/commands/dotnet/findSolution.ts
|
|
14645
14610
|
import { readdirSync as readdirSync7 } from "fs";
|
|
14646
14611
|
import { dirname as dirname22, join as join38 } from "path";
|
|
14647
|
-
import
|
|
14612
|
+
import chalk135 from "chalk";
|
|
14648
14613
|
function findSlnInDir(dir) {
|
|
14649
14614
|
try {
|
|
14650
14615
|
return readdirSync7(dir).filter((f) => f.endsWith(".sln")).map((f) => join38(dir, f));
|
|
@@ -14660,17 +14625,17 @@ function findSolution() {
|
|
|
14660
14625
|
const slnFiles = findSlnInDir(current);
|
|
14661
14626
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
14662
14627
|
if (slnFiles.length > 1) {
|
|
14663
|
-
console.error(
|
|
14628
|
+
console.error(chalk135.red(`Multiple .sln files found in ${current}:`));
|
|
14664
14629
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
14665
14630
|
console.error(
|
|
14666
|
-
|
|
14631
|
+
chalk135.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
14667
14632
|
);
|
|
14668
14633
|
process.exit(1);
|
|
14669
14634
|
}
|
|
14670
14635
|
if (current === ceiling) break;
|
|
14671
14636
|
current = dirname22(current);
|
|
14672
14637
|
}
|
|
14673
|
-
console.error(
|
|
14638
|
+
console.error(chalk135.red("No .sln file found between cwd and repo root"));
|
|
14674
14639
|
process.exit(1);
|
|
14675
14640
|
}
|
|
14676
14641
|
|
|
@@ -14679,7 +14644,7 @@ function resolveSolution(sln) {
|
|
|
14679
14644
|
if (sln) {
|
|
14680
14645
|
const resolved = path32.resolve(sln);
|
|
14681
14646
|
if (!existsSync36(resolved)) {
|
|
14682
|
-
console.error(
|
|
14647
|
+
console.error(chalk136.red(`Solution file not found: ${resolved}`));
|
|
14683
14648
|
process.exit(1);
|
|
14684
14649
|
}
|
|
14685
14650
|
return resolved;
|
|
@@ -14721,14 +14686,14 @@ import { execSync as execSync35 } from "child_process";
|
|
|
14721
14686
|
import { existsSync as existsSync37, readFileSync as readFileSync33, unlinkSync as unlinkSync9 } from "fs";
|
|
14722
14687
|
import { tmpdir as tmpdir3 } from "os";
|
|
14723
14688
|
import path33 from "path";
|
|
14724
|
-
import
|
|
14689
|
+
import chalk137 from "chalk";
|
|
14725
14690
|
function assertJbInstalled() {
|
|
14726
14691
|
try {
|
|
14727
14692
|
execSync35("jb inspectcode --version", { stdio: "pipe" });
|
|
14728
14693
|
} catch {
|
|
14729
|
-
console.error(
|
|
14694
|
+
console.error(chalk137.red("jb is not installed. Install with:"));
|
|
14730
14695
|
console.error(
|
|
14731
|
-
|
|
14696
|
+
chalk137.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
14732
14697
|
);
|
|
14733
14698
|
process.exit(1);
|
|
14734
14699
|
}
|
|
@@ -14746,11 +14711,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
14746
14711
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
14747
14712
|
process.stderr.write(error.stderr);
|
|
14748
14713
|
}
|
|
14749
|
-
console.error(
|
|
14714
|
+
console.error(chalk137.red("jb inspectcode failed"));
|
|
14750
14715
|
process.exit(1);
|
|
14751
14716
|
}
|
|
14752
14717
|
if (!existsSync37(reportPath)) {
|
|
14753
|
-
console.error(
|
|
14718
|
+
console.error(chalk137.red("Report file not generated"));
|
|
14754
14719
|
process.exit(1);
|
|
14755
14720
|
}
|
|
14756
14721
|
const xml = readFileSync33(reportPath, "utf8");
|
|
@@ -14760,7 +14725,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
14760
14725
|
|
|
14761
14726
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
14762
14727
|
import { execSync as execSync36 } from "child_process";
|
|
14763
|
-
import
|
|
14728
|
+
import chalk138 from "chalk";
|
|
14764
14729
|
function resolveMsbuildPath() {
|
|
14765
14730
|
const { run: run4 } = loadConfig();
|
|
14766
14731
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -14772,9 +14737,9 @@ function assertMsbuildInstalled() {
|
|
|
14772
14737
|
try {
|
|
14773
14738
|
execSync36(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
14774
14739
|
} catch {
|
|
14775
|
-
console.error(
|
|
14740
|
+
console.error(chalk138.red(`msbuild not found at: ${msbuild}`));
|
|
14776
14741
|
console.error(
|
|
14777
|
-
|
|
14742
|
+
chalk138.yellow(
|
|
14778
14743
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
14779
14744
|
)
|
|
14780
14745
|
);
|
|
@@ -14821,17 +14786,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
14821
14786
|
// src/commands/dotnet/inspect.ts
|
|
14822
14787
|
function logScope(changedFiles) {
|
|
14823
14788
|
if (changedFiles === null) {
|
|
14824
|
-
console.log(
|
|
14789
|
+
console.log(chalk139.dim("Inspecting full solution..."));
|
|
14825
14790
|
} else {
|
|
14826
14791
|
console.log(
|
|
14827
|
-
|
|
14792
|
+
chalk139.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
14828
14793
|
);
|
|
14829
14794
|
}
|
|
14830
14795
|
}
|
|
14831
14796
|
function reportResults(issues, elapsed) {
|
|
14832
14797
|
if (issues.length > 0) displayIssues(issues);
|
|
14833
|
-
else console.log(
|
|
14834
|
-
console.log(
|
|
14798
|
+
else console.log(chalk139.green("No issues found"));
|
|
14799
|
+
console.log(chalk139.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
14835
14800
|
if (issues.length > 0) process.exit(1);
|
|
14836
14801
|
}
|
|
14837
14802
|
async function inspect(sln, options2) {
|
|
@@ -14842,7 +14807,7 @@ async function inspect(sln, options2) {
|
|
|
14842
14807
|
const scope = parseScope(options2.scope);
|
|
14843
14808
|
const changedFiles = getChangedCsFiles(scope);
|
|
14844
14809
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
14845
|
-
console.log(
|
|
14810
|
+
console.log(chalk139.green("No changed .cs files found"));
|
|
14846
14811
|
return;
|
|
14847
14812
|
}
|
|
14848
14813
|
logScope(changedFiles);
|
|
@@ -15190,25 +15155,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
15190
15155
|
}
|
|
15191
15156
|
|
|
15192
15157
|
// src/commands/github/printCountTable.ts
|
|
15193
|
-
import
|
|
15158
|
+
import chalk140 from "chalk";
|
|
15194
15159
|
function printCountTable(labelHeader, rows) {
|
|
15195
15160
|
const labelWidth = Math.max(
|
|
15196
15161
|
labelHeader.length,
|
|
15197
15162
|
...rows.map((row) => row.label.length)
|
|
15198
15163
|
);
|
|
15199
15164
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
15200
|
-
console.log(
|
|
15201
|
-
console.log(
|
|
15165
|
+
console.log(chalk140.dim(header));
|
|
15166
|
+
console.log(chalk140.dim("-".repeat(header.length)));
|
|
15202
15167
|
for (const row of rows) {
|
|
15203
15168
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
15204
15169
|
}
|
|
15205
15170
|
}
|
|
15206
15171
|
|
|
15207
15172
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
15208
|
-
import
|
|
15173
|
+
import chalk141 from "chalk";
|
|
15209
15174
|
function printRepoAuthorBreakdown(repos2) {
|
|
15210
15175
|
for (const repo of repos2) {
|
|
15211
|
-
console.log(
|
|
15176
|
+
console.log(chalk141.bold(repo.name));
|
|
15212
15177
|
const authorWidth = Math.max(
|
|
15213
15178
|
0,
|
|
15214
15179
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -15305,9 +15270,9 @@ function registerGithub(program2) {
|
|
|
15305
15270
|
}
|
|
15306
15271
|
|
|
15307
15272
|
// src/commands/handover/countPendingHandovers.ts
|
|
15308
|
-
import { and as and18, eq as
|
|
15273
|
+
import { and as and18, eq as eq35, isNull, sql as sql16 } from "drizzle-orm";
|
|
15309
15274
|
async function countPendingHandovers(orm, origin) {
|
|
15310
|
-
const [row] = await orm.select({ count: sql16`count(*)::int` }).from(handovers).where(and18(
|
|
15275
|
+
const [row] = await orm.select({ count: sql16`count(*)::int` }).from(handovers).where(and18(eq35(handovers.origin, origin), isNull(handovers.recalledAt)));
|
|
15311
15276
|
return row?.count ?? 0;
|
|
15312
15277
|
}
|
|
15313
15278
|
|
|
@@ -15447,13 +15412,13 @@ async function load2(options2 = {}) {
|
|
|
15447
15412
|
}
|
|
15448
15413
|
|
|
15449
15414
|
// src/commands/handover/listPendingHandovers.ts
|
|
15450
|
-
import { and as and19, desc as desc4, eq as
|
|
15415
|
+
import { and as and19, desc as desc4, eq as eq36, isNull as isNull2 } from "drizzle-orm";
|
|
15451
15416
|
async function listPendingHandovers(orm, origin) {
|
|
15452
15417
|
return orm.select({
|
|
15453
15418
|
id: handovers.id,
|
|
15454
15419
|
summary: handovers.summary,
|
|
15455
15420
|
createdAt: handovers.createdAt
|
|
15456
|
-
}).from(handovers).where(and19(
|
|
15421
|
+
}).from(handovers).where(and19(eq36(handovers.origin, origin), isNull2(handovers.recalledAt))).orderBy(desc4(handovers.createdAt), desc4(handovers.id));
|
|
15457
15422
|
}
|
|
15458
15423
|
|
|
15459
15424
|
// src/commands/handover/printPendingHandovers.ts
|
|
@@ -15466,17 +15431,17 @@ async function printPendingHandovers() {
|
|
|
15466
15431
|
}
|
|
15467
15432
|
|
|
15468
15433
|
// src/commands/handover/recallHandover.ts
|
|
15469
|
-
import { and as and20, desc as desc5, eq as
|
|
15434
|
+
import { and as and20, desc as desc5, eq as eq37, isNull as isNull3 } from "drizzle-orm";
|
|
15470
15435
|
async function recallHandover(orm, origin, id) {
|
|
15471
15436
|
const [row] = await orm.select().from(handovers).where(
|
|
15472
15437
|
and20(
|
|
15473
|
-
|
|
15438
|
+
eq37(handovers.origin, origin),
|
|
15474
15439
|
isNull3(handovers.recalledAt),
|
|
15475
|
-
...id === void 0 ? [] : [
|
|
15440
|
+
...id === void 0 ? [] : [eq37(handovers.id, id)]
|
|
15476
15441
|
)
|
|
15477
15442
|
).orderBy(desc5(handovers.createdAt), desc5(handovers.id)).limit(1);
|
|
15478
15443
|
if (!row) return void 0;
|
|
15479
|
-
await orm.update(handovers).set({ recalledAt: /* @__PURE__ */ new Date() }).where(
|
|
15444
|
+
await orm.update(handovers).set({ recalledAt: /* @__PURE__ */ new Date() }).where(eq37(handovers.id, row.id));
|
|
15480
15445
|
return row.content;
|
|
15481
15446
|
}
|
|
15482
15447
|
|
|
@@ -15526,7 +15491,7 @@ function registerHandover(program2) {
|
|
|
15526
15491
|
}
|
|
15527
15492
|
|
|
15528
15493
|
// src/commands/jira/acceptanceCriteria.ts
|
|
15529
|
-
import
|
|
15494
|
+
import chalk142 from "chalk";
|
|
15530
15495
|
|
|
15531
15496
|
// src/commands/jira/adfToText.ts
|
|
15532
15497
|
function renderInline(node) {
|
|
@@ -15593,7 +15558,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
15593
15558
|
const parsed = fetchIssue(issueKey, field);
|
|
15594
15559
|
const acValue = parsed?.fields?.[field];
|
|
15595
15560
|
if (!acValue) {
|
|
15596
|
-
console.log(
|
|
15561
|
+
console.log(chalk142.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
15597
15562
|
return;
|
|
15598
15563
|
}
|
|
15599
15564
|
if (typeof acValue === "string") {
|
|
@@ -15659,14 +15624,14 @@ async function jiraAuth() {
|
|
|
15659
15624
|
}
|
|
15660
15625
|
|
|
15661
15626
|
// src/commands/jira/viewIssue.ts
|
|
15662
|
-
import
|
|
15627
|
+
import chalk143 from "chalk";
|
|
15663
15628
|
function viewIssue(issueKey) {
|
|
15664
15629
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
15665
15630
|
const fields = parsed?.fields;
|
|
15666
15631
|
const summary = fields?.summary;
|
|
15667
15632
|
const description = fields?.description;
|
|
15668
15633
|
if (summary) {
|
|
15669
|
-
console.log(
|
|
15634
|
+
console.log(chalk143.bold(summary));
|
|
15670
15635
|
}
|
|
15671
15636
|
if (description) {
|
|
15672
15637
|
if (summary) console.log();
|
|
@@ -15680,7 +15645,7 @@ function viewIssue(issueKey) {
|
|
|
15680
15645
|
}
|
|
15681
15646
|
if (!summary && !description) {
|
|
15682
15647
|
console.log(
|
|
15683
|
-
|
|
15648
|
+
chalk143.yellow(`No summary or description found on ${issueKey}.`)
|
|
15684
15649
|
);
|
|
15685
15650
|
}
|
|
15686
15651
|
}
|
|
@@ -15736,13 +15701,13 @@ function registerRefineLaunch(program2, resumeFlag) {
|
|
|
15736
15701
|
// src/commands/reviewPrComments.ts
|
|
15737
15702
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
15738
15703
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
15739
|
-
import
|
|
15704
|
+
import chalk144 from "chalk";
|
|
15740
15705
|
async function reviewPrComments(number) {
|
|
15741
15706
|
if (number) {
|
|
15742
15707
|
try {
|
|
15743
15708
|
execFileSync5("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
15744
15709
|
} catch {
|
|
15745
|
-
console.error(
|
|
15710
|
+
console.error(chalk144.red(`gh pr checkout ${number} failed; aborting.`));
|
|
15746
15711
|
process.exit(1);
|
|
15747
15712
|
}
|
|
15748
15713
|
}
|
|
@@ -15815,15 +15780,15 @@ function registerList(program2) {
|
|
|
15815
15780
|
// src/commands/mermaid/index.ts
|
|
15816
15781
|
import { mkdirSync as mkdirSync15, readdirSync as readdirSync9 } from "fs";
|
|
15817
15782
|
import { resolve as resolve11 } from "path";
|
|
15818
|
-
import
|
|
15783
|
+
import chalk147 from "chalk";
|
|
15819
15784
|
|
|
15820
15785
|
// src/commands/mermaid/exportFile.ts
|
|
15821
15786
|
import { readFileSync as readFileSync35, writeFileSync as writeFileSync29 } from "fs";
|
|
15822
15787
|
import { basename as basename11, extname, resolve as resolve10 } from "path";
|
|
15823
|
-
import
|
|
15788
|
+
import chalk146 from "chalk";
|
|
15824
15789
|
|
|
15825
15790
|
// src/commands/mermaid/renderBlock.ts
|
|
15826
|
-
import
|
|
15791
|
+
import chalk145 from "chalk";
|
|
15827
15792
|
async function renderBlock(krokiUrl, source) {
|
|
15828
15793
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
15829
15794
|
method: "POST",
|
|
@@ -15832,7 +15797,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
15832
15797
|
});
|
|
15833
15798
|
if (!response.ok) {
|
|
15834
15799
|
console.error(
|
|
15835
|
-
|
|
15800
|
+
chalk145.red(
|
|
15836
15801
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
15837
15802
|
)
|
|
15838
15803
|
);
|
|
@@ -15850,19 +15815,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
15850
15815
|
if (onlyIndex !== void 0) {
|
|
15851
15816
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
15852
15817
|
console.error(
|
|
15853
|
-
|
|
15818
|
+
chalk146.red(
|
|
15854
15819
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
15855
15820
|
)
|
|
15856
15821
|
);
|
|
15857
15822
|
process.exit(1);
|
|
15858
15823
|
}
|
|
15859
15824
|
console.log(
|
|
15860
|
-
|
|
15825
|
+
chalk146.gray(
|
|
15861
15826
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
15862
15827
|
)
|
|
15863
15828
|
);
|
|
15864
15829
|
} else {
|
|
15865
|
-
console.log(
|
|
15830
|
+
console.log(chalk146.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
15866
15831
|
}
|
|
15867
15832
|
for (const [i, source] of blocks.entries()) {
|
|
15868
15833
|
const idx = i + 1;
|
|
@@ -15870,7 +15835,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
15870
15835
|
const outPath = resolve10(outDir, `${stem}-${idx}.svg`);
|
|
15871
15836
|
const svg = await renderBlock(krokiUrl, source);
|
|
15872
15837
|
writeFileSync29(outPath, svg, "utf8");
|
|
15873
|
-
console.log(
|
|
15838
|
+
console.log(chalk146.green(` \u2192 ${outPath}`));
|
|
15874
15839
|
}
|
|
15875
15840
|
}
|
|
15876
15841
|
function extractMermaidBlocks(markdown) {
|
|
@@ -15886,18 +15851,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
15886
15851
|
if (options2.index !== void 0) {
|
|
15887
15852
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
15888
15853
|
console.error(
|
|
15889
|
-
|
|
15854
|
+
chalk147.red(`--index must be a positive integer (got ${options2.index})`)
|
|
15890
15855
|
);
|
|
15891
15856
|
process.exit(1);
|
|
15892
15857
|
}
|
|
15893
15858
|
if (!file) {
|
|
15894
|
-
console.error(
|
|
15859
|
+
console.error(chalk147.red("--index requires a file argument"));
|
|
15895
15860
|
process.exit(1);
|
|
15896
15861
|
}
|
|
15897
15862
|
}
|
|
15898
15863
|
const files = file ? [file] : readdirSync9(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
15899
15864
|
if (files.length === 0) {
|
|
15900
|
-
console.log(
|
|
15865
|
+
console.log(chalk147.gray("No markdown files found in current directory."));
|
|
15901
15866
|
return;
|
|
15902
15867
|
}
|
|
15903
15868
|
for (const f of files) {
|
|
@@ -15930,7 +15895,7 @@ function registerMermaid(program2) {
|
|
|
15930
15895
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
15931
15896
|
import { createServer as createServer2 } from "http";
|
|
15932
15897
|
import { dirname as dirname24 } from "path";
|
|
15933
|
-
import
|
|
15898
|
+
import chalk149 from "chalk";
|
|
15934
15899
|
|
|
15935
15900
|
// src/commands/netcap/corsHeaders.ts
|
|
15936
15901
|
var corsHeaders = {
|
|
@@ -16009,7 +15974,7 @@ function createNetcapHandler(options2) {
|
|
|
16009
15974
|
import { cp, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
|
|
16010
15975
|
import { networkInterfaces } from "os";
|
|
16011
15976
|
import { join as join44 } from "path";
|
|
16012
|
-
import
|
|
15977
|
+
import chalk148 from "chalk";
|
|
16013
15978
|
|
|
16014
15979
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
16015
15980
|
import { dirname as dirname23, join as join43 } from "path";
|
|
@@ -16053,7 +16018,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
16053
16018
|
const host = lanIPv4();
|
|
16054
16019
|
if (!host) {
|
|
16055
16020
|
console.log(
|
|
16056
|
-
|
|
16021
|
+
chalk148.yellow("could not determine the WSL IP for the extension")
|
|
16057
16022
|
);
|
|
16058
16023
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
16059
16024
|
return source;
|
|
@@ -16064,7 +16029,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
16064
16029
|
return WSL_WINDOWS_PATH;
|
|
16065
16030
|
} catch {
|
|
16066
16031
|
console.log(
|
|
16067
|
-
|
|
16032
|
+
chalk148.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
16068
16033
|
);
|
|
16069
16034
|
return source;
|
|
16070
16035
|
}
|
|
@@ -16097,30 +16062,30 @@ async function netcap(options2) {
|
|
|
16097
16062
|
let count7 = 0;
|
|
16098
16063
|
const handler = createNetcapHandler({
|
|
16099
16064
|
outPath,
|
|
16100
|
-
onPing: () => console.log(
|
|
16065
|
+
onPing: () => console.log(chalk149.dim("ping from extension")),
|
|
16101
16066
|
onCapture: (entry) => {
|
|
16102
16067
|
count7 += 1;
|
|
16103
16068
|
console.log(
|
|
16104
|
-
|
|
16105
|
-
|
|
16069
|
+
chalk149.green(`captured #${count7}`),
|
|
16070
|
+
chalk149.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
16106
16071
|
);
|
|
16107
16072
|
}
|
|
16108
16073
|
});
|
|
16109
16074
|
const server = createServer2(handler);
|
|
16110
16075
|
server.listen(port, () => {
|
|
16111
16076
|
console.log(
|
|
16112
|
-
|
|
16077
|
+
chalk149.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
16113
16078
|
);
|
|
16114
|
-
console.log(
|
|
16079
|
+
console.log(chalk149.dim(`appending captures to ${outPath}`));
|
|
16115
16080
|
if (filter)
|
|
16116
|
-
console.log(
|
|
16117
|
-
console.log(
|
|
16118
|
-
console.log(
|
|
16081
|
+
console.log(chalk149.dim(`forwarding only URLs matching "${filter}"`));
|
|
16082
|
+
console.log(chalk149.dim(`load the unpacked extension from ${extensionPath}`));
|
|
16083
|
+
console.log(chalk149.dim("press Ctrl-C to stop"));
|
|
16119
16084
|
});
|
|
16120
16085
|
process.on("SIGINT", () => {
|
|
16121
16086
|
server.close();
|
|
16122
16087
|
console.log(
|
|
16123
|
-
|
|
16088
|
+
chalk149.bold(
|
|
16124
16089
|
`
|
|
16125
16090
|
netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
16126
16091
|
)
|
|
@@ -16132,7 +16097,7 @@ netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} t
|
|
|
16132
16097
|
// src/commands/netcap/netcapExtract.ts
|
|
16133
16098
|
import { writeFileSync as writeFileSync30 } from "fs";
|
|
16134
16099
|
import { join as join47 } from "path";
|
|
16135
|
-
import
|
|
16100
|
+
import chalk150 from "chalk";
|
|
16136
16101
|
|
|
16137
16102
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
16138
16103
|
import { readFileSync as readFileSync36 } from "fs";
|
|
@@ -16580,8 +16545,8 @@ function netcapExtract(file) {
|
|
|
16580
16545
|
writeFileSync30(outFile, `${JSON.stringify(posts, null, 2)}
|
|
16581
16546
|
`);
|
|
16582
16547
|
console.log(
|
|
16583
|
-
|
|
16584
|
-
|
|
16548
|
+
chalk150.green(`extracted ${posts.length} posts`),
|
|
16549
|
+
chalk150.dim(`-> ${outFile}`)
|
|
16585
16550
|
);
|
|
16586
16551
|
}
|
|
16587
16552
|
|
|
@@ -16602,7 +16567,7 @@ function registerNetcap(program2) {
|
|
|
16602
16567
|
}
|
|
16603
16568
|
|
|
16604
16569
|
// src/commands/news/add/index.ts
|
|
16605
|
-
import
|
|
16570
|
+
import chalk151 from "chalk";
|
|
16606
16571
|
import enquirer8 from "enquirer";
|
|
16607
16572
|
async function add2(url) {
|
|
16608
16573
|
if (!url) {
|
|
@@ -16624,10 +16589,10 @@ async function add2(url) {
|
|
|
16624
16589
|
const { orm } = await getReady();
|
|
16625
16590
|
const added = await addFeed(orm, url);
|
|
16626
16591
|
if (!added) {
|
|
16627
|
-
console.log(
|
|
16592
|
+
console.log(chalk151.yellow("Feed already exists"));
|
|
16628
16593
|
return;
|
|
16629
16594
|
}
|
|
16630
|
-
console.log(
|
|
16595
|
+
console.log(chalk151.green(`Added feed: ${url}`));
|
|
16631
16596
|
}
|
|
16632
16597
|
|
|
16633
16598
|
// src/commands/registerNews.ts
|
|
@@ -16674,7 +16639,7 @@ function registerPiHook(program2) {
|
|
|
16674
16639
|
}
|
|
16675
16640
|
|
|
16676
16641
|
// src/commands/prompts/printPromptsTable.ts
|
|
16677
|
-
import
|
|
16642
|
+
import chalk152 from "chalk";
|
|
16678
16643
|
function truncate(str, max) {
|
|
16679
16644
|
if (str.length <= max) return str;
|
|
16680
16645
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -16692,14 +16657,14 @@ function printPromptsTable(rows) {
|
|
|
16692
16657
|
"Command".padEnd(commandWidth),
|
|
16693
16658
|
"Repos"
|
|
16694
16659
|
].join(" ");
|
|
16695
|
-
console.log(
|
|
16696
|
-
console.log(
|
|
16660
|
+
console.log(chalk152.dim(header));
|
|
16661
|
+
console.log(chalk152.dim("-".repeat(header.length)));
|
|
16697
16662
|
for (const row of rows) {
|
|
16698
16663
|
const count7 = String(row.count).padStart(countWidth);
|
|
16699
16664
|
const tool = row.tool.padEnd(toolWidth);
|
|
16700
16665
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
16701
16666
|
console.log(
|
|
16702
|
-
`${
|
|
16667
|
+
`${chalk152.yellow(count7)} ${tool} ${command} ${chalk152.dim(row.repos)}`
|
|
16703
16668
|
);
|
|
16704
16669
|
}
|
|
16705
16670
|
}
|
|
@@ -17266,20 +17231,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
17266
17231
|
}
|
|
17267
17232
|
|
|
17268
17233
|
// src/commands/prs/listComments/printComments.ts
|
|
17269
|
-
import
|
|
17234
|
+
import chalk153 from "chalk";
|
|
17270
17235
|
function formatForHuman(comment3) {
|
|
17271
17236
|
if (comment3.type === "review") {
|
|
17272
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
17237
|
+
const stateColor = comment3.state === "APPROVED" ? chalk153.green : comment3.state === "CHANGES_REQUESTED" ? chalk153.red : chalk153.yellow;
|
|
17273
17238
|
return [
|
|
17274
|
-
`${
|
|
17239
|
+
`${chalk153.cyan("Review")} by ${chalk153.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
17275
17240
|
comment3.body,
|
|
17276
17241
|
""
|
|
17277
17242
|
].join("\n");
|
|
17278
17243
|
}
|
|
17279
17244
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
17280
17245
|
return [
|
|
17281
|
-
`${
|
|
17282
|
-
|
|
17246
|
+
`${chalk153.cyan("Line comment")} by ${chalk153.bold(comment3.user)} on ${chalk153.dim(`${comment3.path}${location}`)}`,
|
|
17247
|
+
chalk153.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
17283
17248
|
comment3.body,
|
|
17284
17249
|
""
|
|
17285
17250
|
].join("\n");
|
|
@@ -17369,13 +17334,13 @@ import { execSync as execSync44 } from "child_process";
|
|
|
17369
17334
|
import enquirer9 from "enquirer";
|
|
17370
17335
|
|
|
17371
17336
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
17372
|
-
import
|
|
17337
|
+
import chalk154 from "chalk";
|
|
17373
17338
|
var STATUS_MAP = {
|
|
17374
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
17375
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
17339
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk154.magenta("merged"), date: pr.mergedAt } : null,
|
|
17340
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk154.red("closed"), date: pr.closedAt } : null
|
|
17376
17341
|
};
|
|
17377
17342
|
function defaultStatus(pr) {
|
|
17378
|
-
return { label:
|
|
17343
|
+
return { label: chalk154.green("opened"), date: pr.createdAt };
|
|
17379
17344
|
}
|
|
17380
17345
|
function getStatus2(pr) {
|
|
17381
17346
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -17384,11 +17349,11 @@ function formatDate(dateStr) {
|
|
|
17384
17349
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
17385
17350
|
}
|
|
17386
17351
|
function formatPrHeader(pr, status3) {
|
|
17387
|
-
return `${
|
|
17352
|
+
return `${chalk154.cyan(`#${pr.number}`)} ${pr.title} ${chalk154.dim(`(${pr.author.login},`)} ${status3.label} ${chalk154.dim(`${formatDate(status3.date)})`)}`;
|
|
17388
17353
|
}
|
|
17389
17354
|
function logPrDetails(pr) {
|
|
17390
17355
|
console.log(
|
|
17391
|
-
|
|
17356
|
+
chalk154.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
17392
17357
|
);
|
|
17393
17358
|
console.log();
|
|
17394
17359
|
}
|
|
@@ -17737,10 +17702,10 @@ function registerPrs(program2) {
|
|
|
17737
17702
|
}
|
|
17738
17703
|
|
|
17739
17704
|
// src/commands/ravendb/ravendbAuth.ts
|
|
17740
|
-
import
|
|
17705
|
+
import chalk160 from "chalk";
|
|
17741
17706
|
|
|
17742
17707
|
// src/shared/createConnectionAuth.ts
|
|
17743
|
-
import
|
|
17708
|
+
import chalk155 from "chalk";
|
|
17744
17709
|
function listConnections(connections, format) {
|
|
17745
17710
|
if (connections.length === 0) {
|
|
17746
17711
|
console.log("No connections configured.");
|
|
@@ -17753,7 +17718,7 @@ function listConnections(connections, format) {
|
|
|
17753
17718
|
function removeConnection(connections, name, save) {
|
|
17754
17719
|
const filtered = connections.filter((c) => c.name !== name);
|
|
17755
17720
|
if (filtered.length === connections.length) {
|
|
17756
|
-
console.error(
|
|
17721
|
+
console.error(chalk155.red(`Connection "${name}" not found.`));
|
|
17757
17722
|
process.exit(1);
|
|
17758
17723
|
}
|
|
17759
17724
|
save(filtered);
|
|
@@ -17799,15 +17764,15 @@ function saveConnections(connections) {
|
|
|
17799
17764
|
}
|
|
17800
17765
|
|
|
17801
17766
|
// src/commands/ravendb/promptConnection.ts
|
|
17802
|
-
import
|
|
17767
|
+
import chalk158 from "chalk";
|
|
17803
17768
|
|
|
17804
17769
|
// src/commands/ravendb/selectOpSecret.ts
|
|
17805
|
-
import
|
|
17770
|
+
import chalk157 from "chalk";
|
|
17806
17771
|
import Enquirer2 from "enquirer";
|
|
17807
17772
|
|
|
17808
17773
|
// src/commands/ravendb/searchItems.ts
|
|
17809
17774
|
import { execSync as execSync47 } from "child_process";
|
|
17810
|
-
import
|
|
17775
|
+
import chalk156 from "chalk";
|
|
17811
17776
|
function opExec(args) {
|
|
17812
17777
|
return execSync47(`op ${args}`, {
|
|
17813
17778
|
encoding: "utf8",
|
|
@@ -17820,7 +17785,7 @@ function searchItems(search2) {
|
|
|
17820
17785
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
17821
17786
|
} catch {
|
|
17822
17787
|
console.error(
|
|
17823
|
-
|
|
17788
|
+
chalk156.red(
|
|
17824
17789
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
17825
17790
|
)
|
|
17826
17791
|
);
|
|
@@ -17834,7 +17799,7 @@ function getItemFields(itemId2) {
|
|
|
17834
17799
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
17835
17800
|
return item.fields.filter((f) => f.reference && f.label);
|
|
17836
17801
|
} catch {
|
|
17837
|
-
console.error(
|
|
17802
|
+
console.error(chalk156.red("Failed to get item details from 1Password."));
|
|
17838
17803
|
process.exit(1);
|
|
17839
17804
|
}
|
|
17840
17805
|
}
|
|
@@ -17853,7 +17818,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
17853
17818
|
}).run();
|
|
17854
17819
|
const items2 = searchItems(search2);
|
|
17855
17820
|
if (items2.length === 0) {
|
|
17856
|
-
console.error(
|
|
17821
|
+
console.error(chalk157.red(`No items found matching "${search2}".`));
|
|
17857
17822
|
process.exit(1);
|
|
17858
17823
|
}
|
|
17859
17824
|
const itemId2 = await selectOne(
|
|
@@ -17862,7 +17827,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
17862
17827
|
);
|
|
17863
17828
|
const fields = getItemFields(itemId2);
|
|
17864
17829
|
if (fields.length === 0) {
|
|
17865
|
-
console.error(
|
|
17830
|
+
console.error(chalk157.red("No fields with references found on this item."));
|
|
17866
17831
|
process.exit(1);
|
|
17867
17832
|
}
|
|
17868
17833
|
const ref = await selectOne(
|
|
@@ -17876,7 +17841,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
17876
17841
|
async function promptConnection(existingNames) {
|
|
17877
17842
|
const name = await promptInput("name", "Connection name:");
|
|
17878
17843
|
if (existingNames.includes(name)) {
|
|
17879
|
-
console.error(
|
|
17844
|
+
console.error(chalk158.red(`Connection "${name}" already exists.`));
|
|
17880
17845
|
process.exit(1);
|
|
17881
17846
|
}
|
|
17882
17847
|
const url = await promptInput(
|
|
@@ -17885,22 +17850,22 @@ async function promptConnection(existingNames) {
|
|
|
17885
17850
|
);
|
|
17886
17851
|
const database = await promptInput("database", "Database name:");
|
|
17887
17852
|
if (!name || !url || !database) {
|
|
17888
|
-
console.error(
|
|
17853
|
+
console.error(chalk158.red("All fields are required."));
|
|
17889
17854
|
process.exit(1);
|
|
17890
17855
|
}
|
|
17891
17856
|
const apiKeyRef = await selectOpSecret();
|
|
17892
|
-
console.log(
|
|
17857
|
+
console.log(chalk158.dim(`Using: ${apiKeyRef}`));
|
|
17893
17858
|
return { name, url, database, apiKeyRef };
|
|
17894
17859
|
}
|
|
17895
17860
|
|
|
17896
17861
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
17897
|
-
import
|
|
17862
|
+
import chalk159 from "chalk";
|
|
17898
17863
|
function ravendbSetConnection(name) {
|
|
17899
17864
|
const raw = loadGlobalConfigRaw();
|
|
17900
17865
|
const ravendb = raw.ravendb ?? {};
|
|
17901
17866
|
const connections = ravendb.connections ?? [];
|
|
17902
17867
|
if (!connections.some((c) => c.name === name)) {
|
|
17903
|
-
console.error(
|
|
17868
|
+
console.error(chalk159.red(`Connection "${name}" not found.`));
|
|
17904
17869
|
console.error(
|
|
17905
17870
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
17906
17871
|
);
|
|
@@ -17916,16 +17881,16 @@ function ravendbSetConnection(name) {
|
|
|
17916
17881
|
var ravendbAuth = createConnectionAuth({
|
|
17917
17882
|
load: loadConnections,
|
|
17918
17883
|
save: saveConnections,
|
|
17919
|
-
format: (c) => `${
|
|
17884
|
+
format: (c) => `${chalk160.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
17920
17885
|
promptNew: promptConnection,
|
|
17921
17886
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
17922
17887
|
});
|
|
17923
17888
|
|
|
17924
17889
|
// src/commands/ravendb/ravendbCollections.ts
|
|
17925
|
-
import
|
|
17890
|
+
import chalk164 from "chalk";
|
|
17926
17891
|
|
|
17927
17892
|
// src/commands/ravendb/ravenFetch.ts
|
|
17928
|
-
import
|
|
17893
|
+
import chalk162 from "chalk";
|
|
17929
17894
|
|
|
17930
17895
|
// src/commands/ravendb/getAccessToken.ts
|
|
17931
17896
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -17962,10 +17927,10 @@ ${errorText}`
|
|
|
17962
17927
|
|
|
17963
17928
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
17964
17929
|
import { execSync as execSync48 } from "child_process";
|
|
17965
|
-
import
|
|
17930
|
+
import chalk161 from "chalk";
|
|
17966
17931
|
function resolveOpSecret(reference) {
|
|
17967
17932
|
if (!reference.startsWith("op://")) {
|
|
17968
|
-
console.error(
|
|
17933
|
+
console.error(chalk161.red(`Invalid secret reference: must start with op://`));
|
|
17969
17934
|
process.exit(1);
|
|
17970
17935
|
}
|
|
17971
17936
|
try {
|
|
@@ -17975,7 +17940,7 @@ function resolveOpSecret(reference) {
|
|
|
17975
17940
|
}).trim();
|
|
17976
17941
|
} catch {
|
|
17977
17942
|
console.error(
|
|
17978
|
-
|
|
17943
|
+
chalk161.red(
|
|
17979
17944
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
17980
17945
|
)
|
|
17981
17946
|
);
|
|
@@ -18002,7 +17967,7 @@ async function ravenFetch(connection, path67) {
|
|
|
18002
17967
|
if (!response.ok) {
|
|
18003
17968
|
const body = await response.text();
|
|
18004
17969
|
console.error(
|
|
18005
|
-
|
|
17970
|
+
chalk162.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
18006
17971
|
);
|
|
18007
17972
|
console.error(body.substring(0, 500));
|
|
18008
17973
|
process.exit(1);
|
|
@@ -18011,7 +17976,7 @@ async function ravenFetch(connection, path67) {
|
|
|
18011
17976
|
}
|
|
18012
17977
|
|
|
18013
17978
|
// src/commands/ravendb/resolveConnection.ts
|
|
18014
|
-
import
|
|
17979
|
+
import chalk163 from "chalk";
|
|
18015
17980
|
function loadRavendb() {
|
|
18016
17981
|
const raw = loadGlobalConfigRaw();
|
|
18017
17982
|
const ravendb = raw.ravendb;
|
|
@@ -18025,7 +17990,7 @@ function resolveConnection(name) {
|
|
|
18025
17990
|
const connectionName = name ?? defaultConnection;
|
|
18026
17991
|
if (!connectionName) {
|
|
18027
17992
|
console.error(
|
|
18028
|
-
|
|
17993
|
+
chalk163.red(
|
|
18029
17994
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
18030
17995
|
)
|
|
18031
17996
|
);
|
|
@@ -18033,7 +17998,7 @@ function resolveConnection(name) {
|
|
|
18033
17998
|
}
|
|
18034
17999
|
const connection = connections.find((c) => c.name === connectionName);
|
|
18035
18000
|
if (!connection) {
|
|
18036
|
-
console.error(
|
|
18001
|
+
console.error(chalk163.red(`Connection "${connectionName}" not found.`));
|
|
18037
18002
|
console.error(
|
|
18038
18003
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
18039
18004
|
);
|
|
@@ -18064,7 +18029,7 @@ async function ravendbCollections(connectionName) {
|
|
|
18064
18029
|
return;
|
|
18065
18030
|
}
|
|
18066
18031
|
for (const c of collections) {
|
|
18067
|
-
console.log(`${
|
|
18032
|
+
console.log(`${chalk164.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
18068
18033
|
}
|
|
18069
18034
|
}
|
|
18070
18035
|
|
|
@@ -18083,10 +18048,10 @@ var ravendbConfigHelp = [
|
|
|
18083
18048
|
];
|
|
18084
18049
|
|
|
18085
18050
|
// src/commands/ravendb/ravendbQuery.ts
|
|
18086
|
-
import
|
|
18051
|
+
import chalk166 from "chalk";
|
|
18087
18052
|
|
|
18088
18053
|
// src/commands/ravendb/fetchAllPages.ts
|
|
18089
|
-
import
|
|
18054
|
+
import chalk165 from "chalk";
|
|
18090
18055
|
|
|
18091
18056
|
// src/commands/ravendb/buildQueryPath.ts
|
|
18092
18057
|
function buildQueryPath(opts) {
|
|
@@ -18124,7 +18089,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
18124
18089
|
allResults.push(...results);
|
|
18125
18090
|
start3 += results.length;
|
|
18126
18091
|
process.stderr.write(
|
|
18127
|
-
`\r${
|
|
18092
|
+
`\r${chalk165.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
18128
18093
|
);
|
|
18129
18094
|
if (start3 >= totalResults) break;
|
|
18130
18095
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -18139,7 +18104,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
18139
18104
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
18140
18105
|
const resolved = resolveArgs(connectionName, collection);
|
|
18141
18106
|
if (!resolved.collection && !options2.query) {
|
|
18142
|
-
console.error(
|
|
18107
|
+
console.error(chalk166.red("Provide a collection name or --query filter."));
|
|
18143
18108
|
process.exit(1);
|
|
18144
18109
|
}
|
|
18145
18110
|
const { collection: col } = resolved;
|
|
@@ -18178,7 +18143,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
18178
18143
|
import * as path34 from "path";
|
|
18179
18144
|
|
|
18180
18145
|
// src/commands/refactor/logViolations.ts
|
|
18181
|
-
import
|
|
18146
|
+
import chalk167 from "chalk";
|
|
18182
18147
|
var DEFAULT_MAX_LINES = 100;
|
|
18183
18148
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
18184
18149
|
if (violations.length === 0) {
|
|
@@ -18187,43 +18152,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
18187
18152
|
}
|
|
18188
18153
|
return;
|
|
18189
18154
|
}
|
|
18190
|
-
console.error(
|
|
18155
|
+
console.error(chalk167.red(`
|
|
18191
18156
|
Refactor check failed:
|
|
18192
18157
|
`));
|
|
18193
|
-
console.error(
|
|
18158
|
+
console.error(chalk167.red(` The following files exceed ${maxLines} lines:
|
|
18194
18159
|
`));
|
|
18195
18160
|
for (const violation of violations) {
|
|
18196
|
-
console.error(
|
|
18161
|
+
console.error(chalk167.red(` ${violation.file} (${violation.lines} lines)`));
|
|
18197
18162
|
}
|
|
18198
18163
|
console.error(
|
|
18199
|
-
|
|
18164
|
+
chalk167.yellow(
|
|
18200
18165
|
`
|
|
18201
18166
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
18202
18167
|
way to refactor it, ignore it with:
|
|
18203
18168
|
`
|
|
18204
18169
|
)
|
|
18205
18170
|
);
|
|
18206
|
-
console.error(
|
|
18171
|
+
console.error(chalk167.gray(` assist refactor ignore <file>
|
|
18207
18172
|
`));
|
|
18208
18173
|
if (process.env.CLAUDECODE) {
|
|
18209
|
-
console.error(
|
|
18174
|
+
console.error(chalk167.cyan(`
|
|
18210
18175
|
## Extracting Code to New Files
|
|
18211
18176
|
`));
|
|
18212
18177
|
console.error(
|
|
18213
|
-
|
|
18178
|
+
chalk167.cyan(
|
|
18214
18179
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
18215
18180
|
`
|
|
18216
18181
|
)
|
|
18217
18182
|
);
|
|
18218
18183
|
console.error(
|
|
18219
|
-
|
|
18184
|
+
chalk167.cyan(
|
|
18220
18185
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
18221
18186
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
18222
18187
|
`
|
|
18223
18188
|
)
|
|
18224
18189
|
);
|
|
18225
18190
|
console.error(
|
|
18226
|
-
|
|
18191
|
+
chalk167.cyan(
|
|
18227
18192
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
18228
18193
|
domains, move it to a common/shared folder.
|
|
18229
18194
|
`
|
|
@@ -18379,7 +18344,7 @@ async function check(pattern2, options2) {
|
|
|
18379
18344
|
|
|
18380
18345
|
// src/commands/refactor/extract/index.ts
|
|
18381
18346
|
import path41 from "path";
|
|
18382
|
-
import
|
|
18347
|
+
import chalk170 from "chalk";
|
|
18383
18348
|
|
|
18384
18349
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
18385
18350
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -18653,8 +18618,8 @@ function findTarget(sourceFile, name) {
|
|
|
18653
18618
|
for (const stmt of sourceFile.getVariableStatements()) {
|
|
18654
18619
|
for (const decl of stmt.getDeclarations()) {
|
|
18655
18620
|
if (decl.getName() !== name) continue;
|
|
18656
|
-
const
|
|
18657
|
-
const kind =
|
|
18621
|
+
const init7 = decl.getInitializer();
|
|
18622
|
+
const kind = init7?.getKind();
|
|
18658
18623
|
if (kind === SyntaxKind10.ArrowFunction || kind === SyntaxKind10.FunctionExpression) {
|
|
18659
18624
|
return stmt;
|
|
18660
18625
|
}
|
|
@@ -18978,23 +18943,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
18978
18943
|
|
|
18979
18944
|
// src/commands/refactor/extract/displayPlan.ts
|
|
18980
18945
|
import path38 from "path";
|
|
18981
|
-
import
|
|
18946
|
+
import chalk168 from "chalk";
|
|
18982
18947
|
function section2(title) {
|
|
18983
18948
|
return `
|
|
18984
|
-
${
|
|
18949
|
+
${chalk168.cyan(title)}`;
|
|
18985
18950
|
}
|
|
18986
18951
|
function displayImporters(plan2, cwd) {
|
|
18987
18952
|
if (plan2.importersToUpdate.length === 0) return;
|
|
18988
18953
|
console.log(section2("Update importers:"));
|
|
18989
18954
|
for (const imp of plan2.importersToUpdate) {
|
|
18990
18955
|
const rel = path38.relative(cwd, imp.file.getFilePath());
|
|
18991
|
-
console.log(` ${
|
|
18956
|
+
console.log(` ${chalk168.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
18992
18957
|
}
|
|
18993
18958
|
}
|
|
18994
18959
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
18995
|
-
console.log(
|
|
18960
|
+
console.log(chalk168.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
18996
18961
|
`));
|
|
18997
|
-
console.log(` ${
|
|
18962
|
+
console.log(` ${chalk168.cyan("Functions to move:")}`);
|
|
18998
18963
|
for (const name of plan2.extractedNames) {
|
|
18999
18964
|
console.log(` ${name}`);
|
|
19000
18965
|
}
|
|
@@ -19028,7 +18993,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
19028
18993
|
|
|
19029
18994
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
19030
18995
|
import path40 from "path";
|
|
19031
|
-
import
|
|
18996
|
+
import chalk169 from "chalk";
|
|
19032
18997
|
import { Project as Project4 } from "ts-morph";
|
|
19033
18998
|
|
|
19034
18999
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -19088,7 +19053,7 @@ function loadProjectFile(file) {
|
|
|
19088
19053
|
});
|
|
19089
19054
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
19090
19055
|
if (!sourceFile) {
|
|
19091
|
-
console.log(
|
|
19056
|
+
console.log(chalk169.red(`File not found in project: ${file}`));
|
|
19092
19057
|
process.exit(1);
|
|
19093
19058
|
}
|
|
19094
19059
|
return { project, sourceFile };
|
|
@@ -19111,19 +19076,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
19111
19076
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
19112
19077
|
if (options2.apply) {
|
|
19113
19078
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
19114
|
-
console.log(
|
|
19079
|
+
console.log(chalk170.green("\nExtraction complete"));
|
|
19115
19080
|
} else {
|
|
19116
|
-
console.log(
|
|
19081
|
+
console.log(chalk170.dim("\nDry run. Use --apply to execute."));
|
|
19117
19082
|
}
|
|
19118
19083
|
}
|
|
19119
19084
|
|
|
19120
19085
|
// src/commands/refactor/ignore.ts
|
|
19121
19086
|
import fs27 from "fs";
|
|
19122
|
-
import
|
|
19087
|
+
import chalk171 from "chalk";
|
|
19123
19088
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
19124
19089
|
function ignore2(file) {
|
|
19125
19090
|
if (!fs27.existsSync(file)) {
|
|
19126
|
-
console.error(
|
|
19091
|
+
console.error(chalk171.red(`Error: File does not exist: ${file}`));
|
|
19127
19092
|
process.exit(1);
|
|
19128
19093
|
}
|
|
19129
19094
|
const content = fs27.readFileSync(file, "utf8");
|
|
@@ -19139,7 +19104,7 @@ function ignore2(file) {
|
|
|
19139
19104
|
fs27.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
19140
19105
|
}
|
|
19141
19106
|
console.log(
|
|
19142
|
-
|
|
19107
|
+
chalk171.green(
|
|
19143
19108
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
19144
19109
|
)
|
|
19145
19110
|
);
|
|
@@ -19148,12 +19113,12 @@ function ignore2(file) {
|
|
|
19148
19113
|
// src/commands/refactor/rename/index.ts
|
|
19149
19114
|
import fs30 from "fs";
|
|
19150
19115
|
import path46 from "path";
|
|
19151
|
-
import
|
|
19116
|
+
import chalk174 from "chalk";
|
|
19152
19117
|
|
|
19153
19118
|
// src/commands/refactor/rename/applyRename.ts
|
|
19154
19119
|
import fs29 from "fs";
|
|
19155
19120
|
import path43 from "path";
|
|
19156
|
-
import
|
|
19121
|
+
import chalk172 from "chalk";
|
|
19157
19122
|
|
|
19158
19123
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
19159
19124
|
import path42 from "path";
|
|
@@ -19258,13 +19223,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
19258
19223
|
const updatedContents = applyRewrites(rewrites);
|
|
19259
19224
|
for (const [file, content] of updatedContents) {
|
|
19260
19225
|
fs29.writeFileSync(file, content, "utf8");
|
|
19261
|
-
console.log(
|
|
19226
|
+
console.log(chalk172.cyan(` Updated imports in ${path43.relative(cwd, file)}`));
|
|
19262
19227
|
}
|
|
19263
19228
|
const destDir = path43.dirname(destPath);
|
|
19264
19229
|
if (!fs29.existsSync(destDir)) fs29.mkdirSync(destDir, { recursive: true });
|
|
19265
19230
|
fs29.renameSync(sourcePath, destPath);
|
|
19266
19231
|
console.log(
|
|
19267
|
-
|
|
19232
|
+
chalk172.white(
|
|
19268
19233
|
` Moved ${path43.relative(cwd, sourcePath)} \u2192 ${path43.relative(cwd, destPath)}`
|
|
19269
19234
|
)
|
|
19270
19235
|
);
|
|
@@ -19351,16 +19316,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
19351
19316
|
|
|
19352
19317
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
19353
19318
|
import path45 from "path";
|
|
19354
|
-
import
|
|
19319
|
+
import chalk173 from "chalk";
|
|
19355
19320
|
function printRenamePreview(rewrites, cwd) {
|
|
19356
19321
|
for (const rewrite of rewrites) {
|
|
19357
19322
|
console.log(
|
|
19358
|
-
|
|
19323
|
+
chalk173.dim(
|
|
19359
19324
|
` ${path45.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
19360
19325
|
)
|
|
19361
19326
|
);
|
|
19362
19327
|
}
|
|
19363
|
-
console.log(
|
|
19328
|
+
console.log(chalk173.dim("Dry run. Use --apply to execute."));
|
|
19364
19329
|
}
|
|
19365
19330
|
|
|
19366
19331
|
// src/commands/refactor/rename/index.ts
|
|
@@ -19371,20 +19336,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
19371
19336
|
const relSource = path46.relative(cwd, sourcePath);
|
|
19372
19337
|
const relDest = path46.relative(cwd, destPath);
|
|
19373
19338
|
if (!fs30.existsSync(sourcePath)) {
|
|
19374
|
-
console.log(
|
|
19339
|
+
console.log(chalk174.red(`File not found: ${source}`));
|
|
19375
19340
|
process.exit(1);
|
|
19376
19341
|
}
|
|
19377
19342
|
if (destPath !== sourcePath && fs30.existsSync(destPath)) {
|
|
19378
|
-
console.log(
|
|
19343
|
+
console.log(chalk174.red(`Destination already exists: ${destination}`));
|
|
19379
19344
|
process.exit(1);
|
|
19380
19345
|
}
|
|
19381
|
-
console.log(
|
|
19382
|
-
console.log(
|
|
19383
|
-
console.log(
|
|
19346
|
+
console.log(chalk174.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
19347
|
+
console.log(chalk174.dim("Loading project..."));
|
|
19348
|
+
console.log(chalk174.dim("Scanning imports across the project..."));
|
|
19384
19349
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
19385
19350
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
19386
19351
|
console.log(
|
|
19387
|
-
|
|
19352
|
+
chalk174.dim(
|
|
19388
19353
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
19389
19354
|
)
|
|
19390
19355
|
);
|
|
@@ -19393,11 +19358,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
19393
19358
|
return;
|
|
19394
19359
|
}
|
|
19395
19360
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
19396
|
-
console.log(
|
|
19361
|
+
console.log(chalk174.green("Done"));
|
|
19397
19362
|
}
|
|
19398
19363
|
|
|
19399
19364
|
// src/commands/refactor/renameSymbol/index.ts
|
|
19400
|
-
import
|
|
19365
|
+
import chalk175 from "chalk";
|
|
19401
19366
|
|
|
19402
19367
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
19403
19368
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -19443,33 +19408,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
19443
19408
|
const { project, sourceFile } = loadProjectFile(file);
|
|
19444
19409
|
const symbol = findSymbol(sourceFile, oldName);
|
|
19445
19410
|
if (!symbol) {
|
|
19446
|
-
console.log(
|
|
19411
|
+
console.log(chalk175.red(`Symbol "${oldName}" not found in ${file}`));
|
|
19447
19412
|
process.exit(1);
|
|
19448
19413
|
}
|
|
19449
19414
|
const grouped = groupReferences(symbol, cwd);
|
|
19450
19415
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
19451
19416
|
console.log(
|
|
19452
|
-
|
|
19417
|
+
chalk175.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
19453
19418
|
`)
|
|
19454
19419
|
);
|
|
19455
19420
|
for (const [refFile, lines] of grouped) {
|
|
19456
19421
|
console.log(
|
|
19457
|
-
` ${
|
|
19422
|
+
` ${chalk175.dim(refFile)}: lines ${chalk175.cyan(lines.join(", "))}`
|
|
19458
19423
|
);
|
|
19459
19424
|
}
|
|
19460
19425
|
if (options2.apply) {
|
|
19461
19426
|
symbol.rename(newName);
|
|
19462
19427
|
await project.save();
|
|
19463
|
-
console.log(
|
|
19428
|
+
console.log(chalk175.green(`
|
|
19464
19429
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
19465
19430
|
} else {
|
|
19466
|
-
console.log(
|
|
19431
|
+
console.log(chalk175.dim("\nDry run. Use --apply to execute."));
|
|
19467
19432
|
}
|
|
19468
19433
|
}
|
|
19469
19434
|
|
|
19470
19435
|
// src/commands/refactor/restructure/index.ts
|
|
19471
19436
|
import path54 from "path";
|
|
19472
|
-
import
|
|
19437
|
+
import chalk178 from "chalk";
|
|
19473
19438
|
|
|
19474
19439
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
19475
19440
|
import path48 from "path";
|
|
@@ -19548,50 +19513,50 @@ function clusterFiles(graph) {
|
|
|
19548
19513
|
|
|
19549
19514
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
19550
19515
|
import path50 from "path";
|
|
19551
|
-
import
|
|
19516
|
+
import chalk176 from "chalk";
|
|
19552
19517
|
function relPath(filePath) {
|
|
19553
19518
|
return path50.relative(process.cwd(), filePath);
|
|
19554
19519
|
}
|
|
19555
19520
|
function displayMoves(plan2) {
|
|
19556
19521
|
if (plan2.moves.length === 0) return;
|
|
19557
|
-
console.log(
|
|
19522
|
+
console.log(chalk176.bold("\nFile moves:"));
|
|
19558
19523
|
for (const move2 of plan2.moves) {
|
|
19559
19524
|
console.log(
|
|
19560
|
-
` ${
|
|
19525
|
+
` ${chalk176.red(relPath(move2.from))} \u2192 ${chalk176.green(relPath(move2.to))}`
|
|
19561
19526
|
);
|
|
19562
|
-
console.log(
|
|
19527
|
+
console.log(chalk176.dim(` ${move2.reason}`));
|
|
19563
19528
|
}
|
|
19564
19529
|
}
|
|
19565
19530
|
function displayRewrites(rewrites) {
|
|
19566
19531
|
if (rewrites.length === 0) return;
|
|
19567
19532
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
19568
|
-
console.log(
|
|
19533
|
+
console.log(chalk176.bold(`
|
|
19569
19534
|
Import rewrites (${affectedFiles.size} files):`));
|
|
19570
19535
|
for (const file of affectedFiles) {
|
|
19571
|
-
console.log(` ${
|
|
19536
|
+
console.log(` ${chalk176.cyan(relPath(file))}:`);
|
|
19572
19537
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
19573
19538
|
(r) => r.file === file
|
|
19574
19539
|
)) {
|
|
19575
19540
|
console.log(
|
|
19576
|
-
` ${
|
|
19541
|
+
` ${chalk176.red(`"${oldSpecifier}"`)} \u2192 ${chalk176.green(`"${newSpecifier}"`)}`
|
|
19577
19542
|
);
|
|
19578
19543
|
}
|
|
19579
19544
|
}
|
|
19580
19545
|
}
|
|
19581
19546
|
function displayPlan2(plan2) {
|
|
19582
19547
|
if (plan2.warnings.length > 0) {
|
|
19583
|
-
console.log(
|
|
19584
|
-
for (const w of plan2.warnings) console.log(
|
|
19548
|
+
console.log(chalk176.yellow("\nWarnings:"));
|
|
19549
|
+
for (const w of plan2.warnings) console.log(chalk176.yellow(` ${w}`));
|
|
19585
19550
|
}
|
|
19586
19551
|
if (plan2.newDirectories.length > 0) {
|
|
19587
|
-
console.log(
|
|
19552
|
+
console.log(chalk176.bold("\nNew directories:"));
|
|
19588
19553
|
for (const dir of plan2.newDirectories)
|
|
19589
|
-
console.log(
|
|
19554
|
+
console.log(chalk176.green(` ${dir}/`));
|
|
19590
19555
|
}
|
|
19591
19556
|
displayMoves(plan2);
|
|
19592
19557
|
displayRewrites(plan2.rewrites);
|
|
19593
19558
|
console.log(
|
|
19594
|
-
|
|
19559
|
+
chalk176.dim(
|
|
19595
19560
|
`
|
|
19596
19561
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
19597
19562
|
)
|
|
@@ -19601,18 +19566,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
19601
19566
|
// src/commands/refactor/restructure/executePlan.ts
|
|
19602
19567
|
import fs31 from "fs";
|
|
19603
19568
|
import path51 from "path";
|
|
19604
|
-
import
|
|
19569
|
+
import chalk177 from "chalk";
|
|
19605
19570
|
function executePlan(plan2) {
|
|
19606
19571
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
19607
19572
|
for (const [file, content] of updatedContents) {
|
|
19608
19573
|
fs31.writeFileSync(file, content, "utf8");
|
|
19609
19574
|
console.log(
|
|
19610
|
-
|
|
19575
|
+
chalk177.cyan(` Rewrote imports in ${path51.relative(process.cwd(), file)}`)
|
|
19611
19576
|
);
|
|
19612
19577
|
}
|
|
19613
19578
|
for (const dir of plan2.newDirectories) {
|
|
19614
19579
|
fs31.mkdirSync(dir, { recursive: true });
|
|
19615
|
-
console.log(
|
|
19580
|
+
console.log(chalk177.green(` Created ${path51.relative(process.cwd(), dir)}/`));
|
|
19616
19581
|
}
|
|
19617
19582
|
for (const move2 of plan2.moves) {
|
|
19618
19583
|
const targetDir = path51.dirname(move2.to);
|
|
@@ -19621,7 +19586,7 @@ function executePlan(plan2) {
|
|
|
19621
19586
|
}
|
|
19622
19587
|
fs31.renameSync(move2.from, move2.to);
|
|
19623
19588
|
console.log(
|
|
19624
|
-
|
|
19589
|
+
chalk177.white(
|
|
19625
19590
|
` Moved ${path51.relative(process.cwd(), move2.from)} \u2192 ${path51.relative(process.cwd(), move2.to)}`
|
|
19626
19591
|
)
|
|
19627
19592
|
);
|
|
@@ -19636,7 +19601,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
19636
19601
|
if (entries.length === 0) {
|
|
19637
19602
|
fs31.rmdirSync(dir);
|
|
19638
19603
|
console.log(
|
|
19639
|
-
|
|
19604
|
+
chalk177.dim(
|
|
19640
19605
|
` Removed empty directory ${path51.relative(process.cwd(), dir)}`
|
|
19641
19606
|
)
|
|
19642
19607
|
);
|
|
@@ -19769,22 +19734,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
19769
19734
|
const targetPattern = pattern2 ?? "src";
|
|
19770
19735
|
const files = findSourceFiles2(targetPattern);
|
|
19771
19736
|
if (files.length === 0) {
|
|
19772
|
-
console.log(
|
|
19737
|
+
console.log(chalk178.yellow("No files found matching pattern"));
|
|
19773
19738
|
return;
|
|
19774
19739
|
}
|
|
19775
19740
|
const tsConfigPath = path54.resolve("tsconfig.json");
|
|
19776
19741
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
19777
19742
|
if (plan2.moves.length === 0) {
|
|
19778
|
-
console.log(
|
|
19743
|
+
console.log(chalk178.green("No restructuring needed"));
|
|
19779
19744
|
return;
|
|
19780
19745
|
}
|
|
19781
19746
|
displayPlan2(plan2);
|
|
19782
19747
|
if (options2.apply) {
|
|
19783
|
-
console.log(
|
|
19748
|
+
console.log(chalk178.bold("\nApplying changes..."));
|
|
19784
19749
|
executePlan(plan2);
|
|
19785
|
-
console.log(
|
|
19750
|
+
console.log(chalk178.green("\nRestructuring complete"));
|
|
19786
19751
|
} else {
|
|
19787
|
-
console.log(
|
|
19752
|
+
console.log(chalk178.dim("\nDry run. Use --apply to execute."));
|
|
19788
19753
|
}
|
|
19789
19754
|
}
|
|
19790
19755
|
|
|
@@ -20367,18 +20332,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
20367
20332
|
}
|
|
20368
20333
|
|
|
20369
20334
|
// src/commands/review/warnOutOfDiff.ts
|
|
20370
|
-
import
|
|
20335
|
+
import chalk179 from "chalk";
|
|
20371
20336
|
function warnOutOfDiff(outOfDiff) {
|
|
20372
20337
|
if (outOfDiff.length === 0) return;
|
|
20373
20338
|
console.warn(
|
|
20374
|
-
|
|
20339
|
+
chalk179.yellow(
|
|
20375
20340
|
`Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
|
|
20376
20341
|
)
|
|
20377
20342
|
);
|
|
20378
20343
|
for (const finding of outOfDiff) {
|
|
20379
20344
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
20380
20345
|
console.warn(
|
|
20381
|
-
` ${
|
|
20346
|
+
` ${chalk179.yellow("\xB7")} ${finding.title} ${chalk179.dim(
|
|
20382
20347
|
`(${finding.file}:${range})`
|
|
20383
20348
|
)}`
|
|
20384
20349
|
);
|
|
@@ -20397,18 +20362,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
20397
20362
|
}
|
|
20398
20363
|
|
|
20399
20364
|
// src/commands/review/warnUnlocated.ts
|
|
20400
|
-
import
|
|
20365
|
+
import chalk180 from "chalk";
|
|
20401
20366
|
function warnUnlocated(unlocated) {
|
|
20402
20367
|
if (unlocated.length === 0) return;
|
|
20403
20368
|
console.warn(
|
|
20404
|
-
|
|
20369
|
+
chalk180.yellow(
|
|
20405
20370
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
20406
20371
|
)
|
|
20407
20372
|
);
|
|
20408
20373
|
for (const finding of unlocated) {
|
|
20409
|
-
const where = finding.location ||
|
|
20374
|
+
const where = finding.location || chalk180.dim("missing");
|
|
20410
20375
|
console.warn(
|
|
20411
|
-
` ${
|
|
20376
|
+
` ${chalk180.yellow("\xB7")} ${finding.title} ${chalk180.dim(`(${where})`)}`
|
|
20412
20377
|
);
|
|
20413
20378
|
}
|
|
20414
20379
|
}
|
|
@@ -21580,7 +21545,7 @@ function registerReview(program2) {
|
|
|
21580
21545
|
}
|
|
21581
21546
|
|
|
21582
21547
|
// src/commands/seq/seqAuth.ts
|
|
21583
|
-
import
|
|
21548
|
+
import chalk182 from "chalk";
|
|
21584
21549
|
|
|
21585
21550
|
// src/commands/seq/loadConnections.ts
|
|
21586
21551
|
function loadConnections2() {
|
|
@@ -21609,10 +21574,10 @@ function setDefaultConnection(name) {
|
|
|
21609
21574
|
}
|
|
21610
21575
|
|
|
21611
21576
|
// src/shared/assertUniqueName.ts
|
|
21612
|
-
import
|
|
21577
|
+
import chalk181 from "chalk";
|
|
21613
21578
|
function assertUniqueName(existingNames, name) {
|
|
21614
21579
|
if (existingNames.includes(name)) {
|
|
21615
|
-
console.error(
|
|
21580
|
+
console.error(chalk181.red(`Connection "${name}" already exists.`));
|
|
21616
21581
|
process.exit(1);
|
|
21617
21582
|
}
|
|
21618
21583
|
}
|
|
@@ -21630,7 +21595,7 @@ async function promptConnection2(existingNames) {
|
|
|
21630
21595
|
var seqAuth = createConnectionAuth({
|
|
21631
21596
|
load: loadConnections2,
|
|
21632
21597
|
save: saveConnections2,
|
|
21633
|
-
format: (c) => `${
|
|
21598
|
+
format: (c) => `${chalk182.bold(c.name)} ${c.url}`,
|
|
21634
21599
|
promptNew: promptConnection2,
|
|
21635
21600
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
21636
21601
|
});
|
|
@@ -21650,10 +21615,10 @@ var seqConfigHelp = [
|
|
|
21650
21615
|
];
|
|
21651
21616
|
|
|
21652
21617
|
// src/commands/seq/seqQuery.ts
|
|
21653
|
-
import
|
|
21618
|
+
import chalk186 from "chalk";
|
|
21654
21619
|
|
|
21655
21620
|
// src/commands/seq/fetchSeq.ts
|
|
21656
|
-
import
|
|
21621
|
+
import chalk183 from "chalk";
|
|
21657
21622
|
async function fetchSeq(conn, path67, params) {
|
|
21658
21623
|
const url = `${conn.url}${path67}?${params}`;
|
|
21659
21624
|
const response = await fetch(url, {
|
|
@@ -21664,7 +21629,7 @@ async function fetchSeq(conn, path67, params) {
|
|
|
21664
21629
|
});
|
|
21665
21630
|
if (!response.ok) {
|
|
21666
21631
|
const body = await response.text();
|
|
21667
|
-
console.error(
|
|
21632
|
+
console.error(chalk183.red(`Seq returned ${response.status}: ${body}`));
|
|
21668
21633
|
process.exit(1);
|
|
21669
21634
|
}
|
|
21670
21635
|
return response;
|
|
@@ -21723,23 +21688,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
21723
21688
|
}
|
|
21724
21689
|
|
|
21725
21690
|
// src/commands/seq/formatEvent.ts
|
|
21726
|
-
import
|
|
21691
|
+
import chalk184 from "chalk";
|
|
21727
21692
|
function levelColor(level) {
|
|
21728
21693
|
switch (level) {
|
|
21729
21694
|
case "Fatal":
|
|
21730
|
-
return
|
|
21695
|
+
return chalk184.bgRed.white;
|
|
21731
21696
|
case "Error":
|
|
21732
|
-
return
|
|
21697
|
+
return chalk184.red;
|
|
21733
21698
|
case "Warning":
|
|
21734
|
-
return
|
|
21699
|
+
return chalk184.yellow;
|
|
21735
21700
|
case "Information":
|
|
21736
|
-
return
|
|
21701
|
+
return chalk184.cyan;
|
|
21737
21702
|
case "Debug":
|
|
21738
|
-
return
|
|
21703
|
+
return chalk184.gray;
|
|
21739
21704
|
case "Verbose":
|
|
21740
|
-
return
|
|
21705
|
+
return chalk184.dim;
|
|
21741
21706
|
default:
|
|
21742
|
-
return
|
|
21707
|
+
return chalk184.white;
|
|
21743
21708
|
}
|
|
21744
21709
|
}
|
|
21745
21710
|
function levelAbbrev(level) {
|
|
@@ -21780,12 +21745,12 @@ function formatTimestamp(iso) {
|
|
|
21780
21745
|
function formatEvent(event) {
|
|
21781
21746
|
const color = levelColor(event.Level);
|
|
21782
21747
|
const abbrev = levelAbbrev(event.Level);
|
|
21783
|
-
const ts8 =
|
|
21748
|
+
const ts8 = chalk184.dim(formatTimestamp(event.Timestamp));
|
|
21784
21749
|
const msg = renderMessage(event);
|
|
21785
21750
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
21786
21751
|
if (event.Exception) {
|
|
21787
21752
|
for (const line of event.Exception.split("\n")) {
|
|
21788
|
-
lines.push(
|
|
21753
|
+
lines.push(chalk184.red(` ${line}`));
|
|
21789
21754
|
}
|
|
21790
21755
|
}
|
|
21791
21756
|
return lines.join("\n");
|
|
@@ -21818,11 +21783,11 @@ function rejectTimestampFilter(filter) {
|
|
|
21818
21783
|
}
|
|
21819
21784
|
|
|
21820
21785
|
// src/shared/resolveNamedConnection.ts
|
|
21821
|
-
import
|
|
21786
|
+
import chalk185 from "chalk";
|
|
21822
21787
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
21823
21788
|
if (connections.length === 0) {
|
|
21824
21789
|
console.error(
|
|
21825
|
-
|
|
21790
|
+
chalk185.red(
|
|
21826
21791
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
21827
21792
|
)
|
|
21828
21793
|
);
|
|
@@ -21831,7 +21796,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
21831
21796
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
21832
21797
|
const connection = connections.find((c) => c.name === target);
|
|
21833
21798
|
if (!connection) {
|
|
21834
|
-
console.error(
|
|
21799
|
+
console.error(chalk185.red(`${kind} connection "${target}" not found.`));
|
|
21835
21800
|
process.exit(1);
|
|
21836
21801
|
}
|
|
21837
21802
|
return connection;
|
|
@@ -21860,7 +21825,7 @@ async function seqQuery(filter, options2) {
|
|
|
21860
21825
|
new URLSearchParams({ filter, count: String(count7) })
|
|
21861
21826
|
);
|
|
21862
21827
|
if (events.length === 0) {
|
|
21863
|
-
console.log(
|
|
21828
|
+
console.log(chalk186.yellow("No events found."));
|
|
21864
21829
|
return;
|
|
21865
21830
|
}
|
|
21866
21831
|
if (options2.json) {
|
|
@@ -21871,11 +21836,11 @@ async function seqQuery(filter, options2) {
|
|
|
21871
21836
|
for (const event of chronological) {
|
|
21872
21837
|
console.log(formatEvent(event));
|
|
21873
21838
|
}
|
|
21874
|
-
console.log(
|
|
21839
|
+
console.log(chalk186.dim(`
|
|
21875
21840
|
${events.length} events`));
|
|
21876
21841
|
if (events.length >= count7) {
|
|
21877
21842
|
console.log(
|
|
21878
|
-
|
|
21843
|
+
chalk186.yellow(
|
|
21879
21844
|
`Results limited to ${count7}. Use --count to retrieve more.`
|
|
21880
21845
|
)
|
|
21881
21846
|
);
|
|
@@ -21883,10 +21848,10 @@ ${events.length} events`));
|
|
|
21883
21848
|
}
|
|
21884
21849
|
|
|
21885
21850
|
// src/shared/setNamedDefaultConnection.ts
|
|
21886
|
-
import
|
|
21851
|
+
import chalk187 from "chalk";
|
|
21887
21852
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
21888
21853
|
if (!connections.find((c) => c.name === name)) {
|
|
21889
|
-
console.error(
|
|
21854
|
+
console.error(chalk187.red(`Connection "${name}" not found.`));
|
|
21890
21855
|
process.exit(1);
|
|
21891
21856
|
}
|
|
21892
21857
|
setDefault(name);
|
|
@@ -21935,7 +21900,7 @@ function registerSignal(program2) {
|
|
|
21935
21900
|
}
|
|
21936
21901
|
|
|
21937
21902
|
// src/commands/sql/sqlAuth.ts
|
|
21938
|
-
import
|
|
21903
|
+
import chalk189 from "chalk";
|
|
21939
21904
|
|
|
21940
21905
|
// src/commands/sql/loadConnections.ts
|
|
21941
21906
|
function loadConnections3() {
|
|
@@ -21964,7 +21929,7 @@ function setDefaultConnection2(name) {
|
|
|
21964
21929
|
}
|
|
21965
21930
|
|
|
21966
21931
|
// src/commands/sql/promptConnection.ts
|
|
21967
|
-
import
|
|
21932
|
+
import chalk188 from "chalk";
|
|
21968
21933
|
async function promptConnection3(existingNames) {
|
|
21969
21934
|
const name = await promptInput("name", "Connection name:", "default");
|
|
21970
21935
|
assertUniqueName(existingNames, name);
|
|
@@ -21972,7 +21937,7 @@ async function promptConnection3(existingNames) {
|
|
|
21972
21937
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
21973
21938
|
const port = Number.parseInt(portStr, 10);
|
|
21974
21939
|
if (!Number.isFinite(port)) {
|
|
21975
|
-
console.error(
|
|
21940
|
+
console.error(chalk188.red(`Invalid port "${portStr}".`));
|
|
21976
21941
|
process.exit(1);
|
|
21977
21942
|
}
|
|
21978
21943
|
const user = await promptInput("user", "User:");
|
|
@@ -21985,13 +21950,13 @@ async function promptConnection3(existingNames) {
|
|
|
21985
21950
|
var sqlAuth = createConnectionAuth({
|
|
21986
21951
|
load: loadConnections3,
|
|
21987
21952
|
save: saveConnections3,
|
|
21988
|
-
format: (c) => `${
|
|
21953
|
+
format: (c) => `${chalk189.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
21989
21954
|
promptNew: promptConnection3,
|
|
21990
21955
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
21991
21956
|
});
|
|
21992
21957
|
|
|
21993
21958
|
// src/commands/sql/printTable.ts
|
|
21994
|
-
import
|
|
21959
|
+
import chalk190 from "chalk";
|
|
21995
21960
|
function formatCell(value) {
|
|
21996
21961
|
if (value === null || value === void 0) return "";
|
|
21997
21962
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -22000,7 +21965,7 @@ function formatCell(value) {
|
|
|
22000
21965
|
}
|
|
22001
21966
|
function printTable(rows) {
|
|
22002
21967
|
if (rows.length === 0) {
|
|
22003
|
-
console.log(
|
|
21968
|
+
console.log(chalk190.yellow("(no rows)"));
|
|
22004
21969
|
return;
|
|
22005
21970
|
}
|
|
22006
21971
|
const columns = Object.keys(rows[0]);
|
|
@@ -22008,13 +21973,13 @@ function printTable(rows) {
|
|
|
22008
21973
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
22009
21974
|
);
|
|
22010
21975
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
22011
|
-
console.log(
|
|
22012
|
-
console.log(
|
|
21976
|
+
console.log(chalk190.dim(header));
|
|
21977
|
+
console.log(chalk190.dim("-".repeat(header.length)));
|
|
22013
21978
|
for (const row of rows) {
|
|
22014
21979
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
22015
21980
|
console.log(line);
|
|
22016
21981
|
}
|
|
22017
|
-
console.log(
|
|
21982
|
+
console.log(chalk190.dim(`
|
|
22018
21983
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
22019
21984
|
}
|
|
22020
21985
|
|
|
@@ -22088,7 +22053,7 @@ var sqlConfigHelp = [
|
|
|
22088
22053
|
];
|
|
22089
22054
|
|
|
22090
22055
|
// src/commands/sql/sqlMutate.ts
|
|
22091
|
-
import
|
|
22056
|
+
import chalk191 from "chalk";
|
|
22092
22057
|
|
|
22093
22058
|
// src/commands/sql/isMutation.ts
|
|
22094
22059
|
var MUTATION_KEYWORDS = [
|
|
@@ -22122,7 +22087,7 @@ function isMutation(sql23) {
|
|
|
22122
22087
|
async function sqlMutate(query, connectionName) {
|
|
22123
22088
|
if (!isMutation(query)) {
|
|
22124
22089
|
console.error(
|
|
22125
|
-
|
|
22090
|
+
chalk191.red(
|
|
22126
22091
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
22127
22092
|
)
|
|
22128
22093
|
);
|
|
@@ -22132,18 +22097,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
22132
22097
|
const pool = await sqlConnect(conn);
|
|
22133
22098
|
try {
|
|
22134
22099
|
const result = await pool.request().query(query);
|
|
22135
|
-
console.log(
|
|
22100
|
+
console.log(chalk191.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
22136
22101
|
} finally {
|
|
22137
22102
|
await pool.close();
|
|
22138
22103
|
}
|
|
22139
22104
|
}
|
|
22140
22105
|
|
|
22141
22106
|
// src/commands/sql/sqlQuery.ts
|
|
22142
|
-
import
|
|
22107
|
+
import chalk192 from "chalk";
|
|
22143
22108
|
async function sqlQuery(query, connectionName) {
|
|
22144
22109
|
if (isMutation(query)) {
|
|
22145
22110
|
console.error(
|
|
22146
|
-
|
|
22111
|
+
chalk192.red(
|
|
22147
22112
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
22148
22113
|
)
|
|
22149
22114
|
);
|
|
@@ -22158,7 +22123,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
22158
22123
|
printTable(rows);
|
|
22159
22124
|
} else {
|
|
22160
22125
|
console.log(
|
|
22161
|
-
|
|
22126
|
+
chalk192.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
22162
22127
|
);
|
|
22163
22128
|
}
|
|
22164
22129
|
} finally {
|
|
@@ -22973,7 +22938,7 @@ function registerVoice(program2) {
|
|
|
22973
22938
|
|
|
22974
22939
|
// src/commands/roam/auth.ts
|
|
22975
22940
|
import { randomBytes } from "crypto";
|
|
22976
|
-
import
|
|
22941
|
+
import chalk193 from "chalk";
|
|
22977
22942
|
|
|
22978
22943
|
// src/commands/roam/waitForCallback.ts
|
|
22979
22944
|
import { createServer as createServer3 } from "http";
|
|
@@ -23104,13 +23069,13 @@ async function auth() {
|
|
|
23104
23069
|
saveGlobalConfig(config);
|
|
23105
23070
|
const state = randomBytes(16).toString("hex");
|
|
23106
23071
|
console.log(
|
|
23107
|
-
|
|
23072
|
+
chalk193.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
23108
23073
|
);
|
|
23109
|
-
console.log(
|
|
23110
|
-
console.log(
|
|
23111
|
-
console.log(
|
|
23074
|
+
console.log(chalk193.white("http://localhost:14523/callback\n"));
|
|
23075
|
+
console.log(chalk193.blue("Opening browser for authorization..."));
|
|
23076
|
+
console.log(chalk193.dim("Waiting for authorization callback..."));
|
|
23112
23077
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
23113
|
-
console.log(
|
|
23078
|
+
console.log(chalk193.dim("Exchanging code for tokens..."));
|
|
23114
23079
|
const tokens = await exchangeToken({
|
|
23115
23080
|
code,
|
|
23116
23081
|
clientId,
|
|
@@ -23126,7 +23091,7 @@ async function auth() {
|
|
|
23126
23091
|
};
|
|
23127
23092
|
saveGlobalConfig(config);
|
|
23128
23093
|
console.log(
|
|
23129
|
-
|
|
23094
|
+
chalk193.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
23130
23095
|
);
|
|
23131
23096
|
}
|
|
23132
23097
|
|
|
@@ -23669,7 +23634,7 @@ import { execSync as execSync56 } from "child_process";
|
|
|
23669
23634
|
import { existsSync as existsSync52, mkdirSync as mkdirSync23, unlinkSync as unlinkSync19, writeFileSync as writeFileSync40 } from "fs";
|
|
23670
23635
|
import { tmpdir as tmpdir7 } from "os";
|
|
23671
23636
|
import { join as join64, resolve as resolve15 } from "path";
|
|
23672
|
-
import
|
|
23637
|
+
import chalk194 from "chalk";
|
|
23673
23638
|
|
|
23674
23639
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
23675
23640
|
var captureWindowPs1 = `
|
|
@@ -23820,13 +23785,13 @@ function screenshot(processName) {
|
|
|
23820
23785
|
const config = loadConfig();
|
|
23821
23786
|
const outputDir = resolve15(config.screenshot.outputDir);
|
|
23822
23787
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
23823
|
-
console.log(
|
|
23788
|
+
console.log(chalk194.gray(`Capturing window for process "${processName}" ...`));
|
|
23824
23789
|
try {
|
|
23825
23790
|
runPowerShellScript(processName, outputPath);
|
|
23826
|
-
console.log(
|
|
23791
|
+
console.log(chalk194.green(`Screenshot saved: ${outputPath}`));
|
|
23827
23792
|
} catch (error) {
|
|
23828
23793
|
const msg = error instanceof Error ? error.message : String(error);
|
|
23829
|
-
console.error(
|
|
23794
|
+
console.error(chalk194.red(`Failed to capture screenshot: ${msg}`));
|
|
23830
23795
|
process.exit(1);
|
|
23831
23796
|
}
|
|
23832
23797
|
}
|
|
@@ -24156,6 +24121,7 @@ function toSessionInfo({
|
|
|
24156
24121
|
cwd,
|
|
24157
24122
|
restored,
|
|
24158
24123
|
error,
|
|
24124
|
+
errorOutput,
|
|
24159
24125
|
activity: activity2,
|
|
24160
24126
|
autoRun,
|
|
24161
24127
|
autoAdvance,
|
|
@@ -24180,6 +24146,7 @@ function toSessionInfo({
|
|
|
24180
24146
|
cwd,
|
|
24181
24147
|
restored,
|
|
24182
24148
|
error,
|
|
24149
|
+
errorOutput,
|
|
24183
24150
|
activity: activity2,
|
|
24184
24151
|
autoRun,
|
|
24185
24152
|
autoAdvance,
|
|
@@ -24719,7 +24686,7 @@ async function recordPhaseTranscriptUsage(db, itemId2, phaseIdx, responses) {
|
|
|
24719
24686
|
}
|
|
24720
24687
|
|
|
24721
24688
|
// src/shared/db/recordWindowTokens.ts
|
|
24722
|
-
import { and as and21, eq as
|
|
24689
|
+
import { and as and21, eq as eq38, sql as sql22 } from "drizzle-orm";
|
|
24723
24690
|
async function recordWindowTokens(db, window, resetsAt, tokensUp, tokensDown) {
|
|
24724
24691
|
if (tokensUp <= 0 && tokensDown <= 0) return;
|
|
24725
24692
|
await db.update(usagePeaks).set({
|
|
@@ -24727,9 +24694,9 @@ async function recordWindowTokens(db, window, resetsAt, tokensUp, tokensDown) {
|
|
|
24727
24694
|
tokensDown: sql22`${usagePeaks.tokensDown} + ${tokensDown}`
|
|
24728
24695
|
}).where(
|
|
24729
24696
|
and21(
|
|
24730
|
-
|
|
24731
|
-
|
|
24732
|
-
|
|
24697
|
+
eq38(usagePeaks.window, window),
|
|
24698
|
+
eq38(usagePeaks.resetsAt, resetsAt),
|
|
24699
|
+
eq38(usagePeaks.segment, 0)
|
|
24733
24700
|
)
|
|
24734
24701
|
);
|
|
24735
24702
|
}
|
|
@@ -24817,6 +24784,26 @@ function recordSessionUsage(sessions, claudeSessionId, transcriptPath, usedPct,
|
|
|
24817
24784
|
return false;
|
|
24818
24785
|
}
|
|
24819
24786
|
|
|
24787
|
+
// src/commands/sessions/daemon/errorTail.ts
|
|
24788
|
+
var ESC4 = String.fromCharCode(27);
|
|
24789
|
+
var CSI = String.fromCharCode(155);
|
|
24790
|
+
var BEL = String.fromCharCode(7);
|
|
24791
|
+
var ANSI = new RegExp(
|
|
24792
|
+
String.raw`[${ESC4}${CSI}][[\]()#;?]*(?:(?:[a-zA-Z\d]*(?:;[a-zA-Z\d]*)*)?${BEL}|(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-ntqry=><~])`,
|
|
24793
|
+
"g"
|
|
24794
|
+
);
|
|
24795
|
+
var MAX_TAIL_LINES = 40;
|
|
24796
|
+
var MAX_TAIL_CHARS = 4e3;
|
|
24797
|
+
function stripAnsi(text17) {
|
|
24798
|
+
return text17.replace(ANSI, "");
|
|
24799
|
+
}
|
|
24800
|
+
function errorTail(scrollback) {
|
|
24801
|
+
const clean = stripAnsi(scrollback).replace(/\r\n?/g, "\n").replace(/[ \t]+\n/g, "\n").trimEnd();
|
|
24802
|
+
if (clean.length === 0) return "";
|
|
24803
|
+
const tail = clean.split("\n").slice(-MAX_TAIL_LINES).join("\n");
|
|
24804
|
+
return tail.length > MAX_TAIL_CHARS ? tail.slice(-MAX_TAIL_CHARS) : tail;
|
|
24805
|
+
}
|
|
24806
|
+
|
|
24820
24807
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
24821
24808
|
import { existsSync as existsSync54, mkdirSync as mkdirSync24, watch } from "fs";
|
|
24822
24809
|
import { dirname as dirname29 } from "path";
|
|
@@ -24833,10 +24820,10 @@ function applyReviewPause(session, activity2) {
|
|
|
24833
24820
|
}
|
|
24834
24821
|
|
|
24835
24822
|
// src/shared/db/getPhaseActiveMs.ts
|
|
24836
|
-
import { and as and22, eq as
|
|
24823
|
+
import { and as and22, eq as eq39 } from "drizzle-orm";
|
|
24837
24824
|
async function getPhaseActiveMs(db, itemId2, phaseIdx) {
|
|
24838
24825
|
const [row] = await db.select({ activeMs: phaseUsage.activeMs }).from(phaseUsage).where(
|
|
24839
|
-
and22(
|
|
24826
|
+
and22(eq39(phaseUsage.itemId, itemId2), eq39(phaseUsage.phaseIdx, phaseIdx))
|
|
24840
24827
|
);
|
|
24841
24828
|
return row?.activeMs ?? 0;
|
|
24842
24829
|
}
|
|
@@ -24930,7 +24917,18 @@ function handlePtyExit(session, exitCode, onStatusChange) {
|
|
|
24930
24917
|
return;
|
|
24931
24918
|
}
|
|
24932
24919
|
const priorStatus = session.status;
|
|
24933
|
-
|
|
24920
|
+
if (exitCode !== 0) {
|
|
24921
|
+
const tail = errorTail(session.scrollback);
|
|
24922
|
+
session.error = `process exited with code ${exitCode}`;
|
|
24923
|
+
session.errorOutput = tail || void 0;
|
|
24924
|
+
daemonLog(
|
|
24925
|
+
`session ${session.id} ("${session.name}") pty exited with code ${exitCode} from status "${priorStatus}" \u2014 unexpected exit, marking error; error output:
|
|
24926
|
+
${tail || "(no output captured)"}`
|
|
24927
|
+
);
|
|
24928
|
+
onStatusChange(session, "error", exitCode);
|
|
24929
|
+
return;
|
|
24930
|
+
}
|
|
24931
|
+
const unexpected = priorStatus === "waiting";
|
|
24934
24932
|
daemonLog(
|
|
24935
24933
|
`session ${session.id} ("${session.name}") pty exited with code ${exitCode} from status "${priorStatus}" (${session.scrollback.length} bytes of output) \u2014 ${unexpected ? "unexpected exit, process died mid-session" : "expected completion"}; marking done`
|
|
24936
24934
|
);
|
|
@@ -26599,7 +26597,7 @@ function registerDaemon(program2) {
|
|
|
26599
26597
|
|
|
26600
26598
|
// src/commands/sessions/summarise/index.ts
|
|
26601
26599
|
import * as fs38 from "fs";
|
|
26602
|
-
import
|
|
26600
|
+
import chalk195 from "chalk";
|
|
26603
26601
|
|
|
26604
26602
|
// src/commands/sessions/summarise/shared.ts
|
|
26605
26603
|
import * as fs37 from "fs";
|
|
@@ -26673,22 +26671,22 @@ ${firstMessage}`);
|
|
|
26673
26671
|
async function summarise2(options2) {
|
|
26674
26672
|
const files = await discoverSessionFiles();
|
|
26675
26673
|
if (files.length === 0) {
|
|
26676
|
-
console.log(
|
|
26674
|
+
console.log(chalk195.yellow("No sessions found."));
|
|
26677
26675
|
return;
|
|
26678
26676
|
}
|
|
26679
26677
|
const toProcess = selectCandidates(files, options2);
|
|
26680
26678
|
if (toProcess.length === 0) {
|
|
26681
|
-
console.log(
|
|
26679
|
+
console.log(chalk195.green("All sessions already summarised."));
|
|
26682
26680
|
return;
|
|
26683
26681
|
}
|
|
26684
26682
|
console.log(
|
|
26685
|
-
|
|
26683
|
+
chalk195.cyan(
|
|
26686
26684
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
26687
26685
|
)
|
|
26688
26686
|
);
|
|
26689
26687
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
26690
26688
|
console.log(
|
|
26691
|
-
|
|
26689
|
+
chalk195.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk195.yellow(`, ${failed2} skipped`) : "")
|
|
26692
26690
|
);
|
|
26693
26691
|
}
|
|
26694
26692
|
function selectCandidates(files, options2) {
|
|
@@ -26708,16 +26706,16 @@ function processSessions(files) {
|
|
|
26708
26706
|
let failed2 = 0;
|
|
26709
26707
|
for (let i = 0; i < files.length; i++) {
|
|
26710
26708
|
const file = files[i];
|
|
26711
|
-
process.stdout.write(
|
|
26709
|
+
process.stdout.write(chalk195.dim(` [${i + 1}/${files.length}] `));
|
|
26712
26710
|
const summary = summariseSession(file);
|
|
26713
26711
|
if (summary) {
|
|
26714
26712
|
writeSummary(file, summary);
|
|
26715
26713
|
succeeded++;
|
|
26716
|
-
process.stdout.write(`${
|
|
26714
|
+
process.stdout.write(`${chalk195.green("\u2713")} ${summary}
|
|
26717
26715
|
`);
|
|
26718
26716
|
} else {
|
|
26719
26717
|
failed2++;
|
|
26720
|
-
process.stdout.write(` ${
|
|
26718
|
+
process.stdout.write(` ${chalk195.yellow("skip")}
|
|
26721
26719
|
`);
|
|
26722
26720
|
}
|
|
26723
26721
|
}
|
|
@@ -26761,7 +26759,7 @@ function registerSessions(program2) {
|
|
|
26761
26759
|
}
|
|
26762
26760
|
|
|
26763
26761
|
// src/commands/statusLine.ts
|
|
26764
|
-
import
|
|
26762
|
+
import chalk197 from "chalk";
|
|
26765
26763
|
|
|
26766
26764
|
// src/shared/contextLevel.ts
|
|
26767
26765
|
function contextLevel(pct) {
|
|
@@ -26771,7 +26769,7 @@ function contextLevel(pct) {
|
|
|
26771
26769
|
}
|
|
26772
26770
|
|
|
26773
26771
|
// src/commands/buildLimitsSegment.ts
|
|
26774
|
-
import
|
|
26772
|
+
import chalk196 from "chalk";
|
|
26775
26773
|
|
|
26776
26774
|
// src/shared/rateLimitLevel.ts
|
|
26777
26775
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -26802,9 +26800,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
26802
26800
|
|
|
26803
26801
|
// src/commands/buildLimitsSegment.ts
|
|
26804
26802
|
var LEVEL_COLOR = {
|
|
26805
|
-
ok:
|
|
26806
|
-
warn:
|
|
26807
|
-
over:
|
|
26803
|
+
ok: chalk196.green,
|
|
26804
|
+
warn: chalk196.yellow,
|
|
26805
|
+
over: chalk196.red
|
|
26808
26806
|
};
|
|
26809
26807
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
26810
26808
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -26900,7 +26898,7 @@ async function relayUsage(claudeSessionId, transcriptPath, usedPct) {
|
|
|
26900
26898
|
}
|
|
26901
26899
|
|
|
26902
26900
|
// src/commands/statusLine.ts
|
|
26903
|
-
|
|
26901
|
+
chalk197.level = 3;
|
|
26904
26902
|
function formatNumber(num) {
|
|
26905
26903
|
return num.toLocaleString("en-US");
|
|
26906
26904
|
}
|
|
@@ -26908,9 +26906,9 @@ function colorizePercent(pct) {
|
|
|
26908
26906
|
const label2 = `${Math.round(pct)}%`;
|
|
26909
26907
|
switch (contextLevel(pct)) {
|
|
26910
26908
|
case "red":
|
|
26911
|
-
return
|
|
26909
|
+
return chalk197.red(label2);
|
|
26912
26910
|
case "yellow":
|
|
26913
|
-
return
|
|
26911
|
+
return chalk197.yellow(label2);
|
|
26914
26912
|
default:
|
|
26915
26913
|
return label2;
|
|
26916
26914
|
}
|
|
@@ -26923,7 +26921,7 @@ async function statusLine() {
|
|
|
26923
26921
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
26924
26922
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
26925
26923
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
26926
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
26924
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk197.cyan(branch2)} | ` : "";
|
|
26927
26925
|
console.log(
|
|
26928
26926
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
26929
26927
|
);
|
|
@@ -26944,7 +26942,7 @@ import { fileURLToPath as fileURLToPath9 } from "url";
|
|
|
26944
26942
|
// src/commands/sync/syncClaudeMd.ts
|
|
26945
26943
|
import * as fs39 from "fs";
|
|
26946
26944
|
import * as path57 from "path";
|
|
26947
|
-
import
|
|
26945
|
+
import chalk198 from "chalk";
|
|
26948
26946
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
26949
26947
|
const source = path57.join(claudeDir, "CLAUDE.md");
|
|
26950
26948
|
const target = path57.join(targetBase, "CLAUDE.md");
|
|
@@ -26953,12 +26951,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
26953
26951
|
const targetContent = fs39.readFileSync(target, "utf8");
|
|
26954
26952
|
if (sourceContent !== targetContent) {
|
|
26955
26953
|
console.log(
|
|
26956
|
-
|
|
26954
|
+
chalk198.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
26957
26955
|
);
|
|
26958
26956
|
console.log();
|
|
26959
26957
|
printDiff(targetContent, sourceContent);
|
|
26960
26958
|
const confirm = options2?.yes || await promptConfirm(
|
|
26961
|
-
|
|
26959
|
+
chalk198.red("Overwrite existing CLAUDE.md?"),
|
|
26962
26960
|
false
|
|
26963
26961
|
);
|
|
26964
26962
|
if (!confirm) {
|
|
@@ -27152,7 +27150,7 @@ function syncPi(claudeDir) {
|
|
|
27152
27150
|
// src/commands/sync/syncSettings.ts
|
|
27153
27151
|
import * as fs44 from "fs";
|
|
27154
27152
|
import * as path64 from "path";
|
|
27155
|
-
import
|
|
27153
|
+
import chalk199 from "chalk";
|
|
27156
27154
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
27157
27155
|
const source = path64.join(claudeDir, "settings.json");
|
|
27158
27156
|
const target = path64.join(targetBase, "settings.json");
|
|
@@ -27171,14 +27169,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
27171
27169
|
if (mergedContent !== normalizedTarget) {
|
|
27172
27170
|
if (!options2?.yes) {
|
|
27173
27171
|
console.log(
|
|
27174
|
-
|
|
27172
|
+
chalk199.yellow(
|
|
27175
27173
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
27176
27174
|
)
|
|
27177
27175
|
);
|
|
27178
27176
|
console.log();
|
|
27179
27177
|
printDiff(targetContent, mergedContent);
|
|
27180
27178
|
const confirm = await promptConfirm(
|
|
27181
|
-
|
|
27179
|
+
chalk199.red("Overwrite existing settings.json?"),
|
|
27182
27180
|
false
|
|
27183
27181
|
);
|
|
27184
27182
|
if (!confirm) {
|
|
@@ -27277,10 +27275,10 @@ async function update2() {
|
|
|
27277
27275
|
}
|
|
27278
27276
|
|
|
27279
27277
|
// src/reportCliError.ts
|
|
27280
|
-
import
|
|
27278
|
+
import chalk200 from "chalk";
|
|
27281
27279
|
function reportCliError(error) {
|
|
27282
27280
|
if (error instanceof InvalidItemIdError) {
|
|
27283
|
-
console.error(
|
|
27281
|
+
console.error(chalk200.red(error.message));
|
|
27284
27282
|
} else {
|
|
27285
27283
|
console.error(error);
|
|
27286
27284
|
}
|