@staff0rd/assist 0.277.0 → 0.279.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +738 -499
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.279.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -5092,6 +5092,290 @@ function withRepoCwd(line, repoCwd) {
|
|
|
5092
5092
|
}
|
|
5093
5093
|
}
|
|
5094
5094
|
|
|
5095
|
+
// src/commands/sessions/web/restartMenu/installRestartMenu.ts
|
|
5096
|
+
import chalk47 from "chalk";
|
|
5097
|
+
import { createLogUpdate } from "log-update";
|
|
5098
|
+
|
|
5099
|
+
// src/commands/sessions/web/restartMenu/runRestartItem.ts
|
|
5100
|
+
import chalk45 from "chalk";
|
|
5101
|
+
async function runRestartItem(item, { runRestartDaemon, reExec }) {
|
|
5102
|
+
if (item.disabled) return;
|
|
5103
|
+
try {
|
|
5104
|
+
if (item.action === "restart-daemon" || item.action === "restart-both") {
|
|
5105
|
+
console.log(chalk45.cyan("Restarting sessions daemon\u2026"));
|
|
5106
|
+
await runRestartDaemon();
|
|
5107
|
+
}
|
|
5108
|
+
if (item.action === "restart-webserver" || item.action === "restart-both") {
|
|
5109
|
+
console.log(chalk45.cyan("Restarting web server\u2026"));
|
|
5110
|
+
reExec();
|
|
5111
|
+
}
|
|
5112
|
+
} catch (error) {
|
|
5113
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
5114
|
+
console.error(chalk45.red(`Restart failed: ${message}`));
|
|
5115
|
+
}
|
|
5116
|
+
}
|
|
5117
|
+
|
|
5118
|
+
// src/commands/sessions/web/restartMenu/createActivate.ts
|
|
5119
|
+
function createActivate(menu, actions) {
|
|
5120
|
+
let busy = false;
|
|
5121
|
+
const run4 = async () => {
|
|
5122
|
+
const item = menu.selectedItem();
|
|
5123
|
+
if (!item || item.disabled) return;
|
|
5124
|
+
menu.close();
|
|
5125
|
+
busy = true;
|
|
5126
|
+
try {
|
|
5127
|
+
await runRestartItem(item, actions);
|
|
5128
|
+
} finally {
|
|
5129
|
+
busy = false;
|
|
5130
|
+
}
|
|
5131
|
+
};
|
|
5132
|
+
return { isBusy: () => busy, activate: () => void run4() };
|
|
5133
|
+
}
|
|
5134
|
+
|
|
5135
|
+
// src/commands/sessions/web/restartMenu/parseMenuKey.ts
|
|
5136
|
+
var CTRL_C = String.fromCharCode(3);
|
|
5137
|
+
var ESC = String.fromCharCode(27);
|
|
5138
|
+
var ARROW_UP = `${ESC}[A`;
|
|
5139
|
+
var ARROW_DOWN = `${ESC}[B`;
|
|
5140
|
+
var ARROW_UP_APP = `${ESC}OA`;
|
|
5141
|
+
var ARROW_DOWN_APP = `${ESC}OB`;
|
|
5142
|
+
function parseMenuKey(data, toggleKey) {
|
|
5143
|
+
if (data === toggleKey) return { key: "toggle" };
|
|
5144
|
+
switch (data) {
|
|
5145
|
+
case CTRL_C:
|
|
5146
|
+
return { key: "quit" };
|
|
5147
|
+
case ESC:
|
|
5148
|
+
return { key: "dismiss" };
|
|
5149
|
+
case "\r":
|
|
5150
|
+
case "\n":
|
|
5151
|
+
return { key: "select" };
|
|
5152
|
+
case ARROW_UP:
|
|
5153
|
+
case ARROW_UP_APP:
|
|
5154
|
+
return { key: "up" };
|
|
5155
|
+
case ARROW_DOWN:
|
|
5156
|
+
case ARROW_DOWN_APP:
|
|
5157
|
+
return { key: "down" };
|
|
5158
|
+
}
|
|
5159
|
+
if (/^[1-9]$/.test(data)) return { key: "digit", digit: Number(data) };
|
|
5160
|
+
return { key: "none" };
|
|
5161
|
+
}
|
|
5162
|
+
|
|
5163
|
+
// src/commands/sessions/web/restartMenu/createKeyHandler.ts
|
|
5164
|
+
function createKeyHandler(deps2) {
|
|
5165
|
+
const { menu, toggleKey, isBusy, activate, quit } = deps2;
|
|
5166
|
+
return (chunk) => {
|
|
5167
|
+
if (isBusy()) return;
|
|
5168
|
+
const { key, digit } = parseMenuKey(chunk, toggleKey);
|
|
5169
|
+
if (key === "quit") return quit();
|
|
5170
|
+
if (key === "toggle") {
|
|
5171
|
+
menu.isOpen() ? menu.close() : menu.open();
|
|
5172
|
+
return;
|
|
5173
|
+
}
|
|
5174
|
+
if (!menu.isOpen()) return;
|
|
5175
|
+
if (key === "up") menu.move(-1);
|
|
5176
|
+
else if (key === "down") menu.move(1);
|
|
5177
|
+
else if (key === "dismiss") menu.close();
|
|
5178
|
+
else if (key === "select") activate();
|
|
5179
|
+
else if (key === "digit" && menu.jumpTo((digit ?? 0) - 1)) activate();
|
|
5180
|
+
};
|
|
5181
|
+
}
|
|
5182
|
+
|
|
5183
|
+
// src/commands/sessions/web/restartMenu/nextIndex.ts
|
|
5184
|
+
function nextIndex(items2, current, direction) {
|
|
5185
|
+
const n = items2.length;
|
|
5186
|
+
if (n === 0) return current;
|
|
5187
|
+
return (current + direction + n) % n;
|
|
5188
|
+
}
|
|
5189
|
+
function firstEnabledIndex(items2) {
|
|
5190
|
+
const idx = items2.findIndex((item) => !item.disabled);
|
|
5191
|
+
return idx < 0 ? 0 : idx;
|
|
5192
|
+
}
|
|
5193
|
+
|
|
5194
|
+
// src/commands/sessions/web/restartMenu/renderRestartMenu.ts
|
|
5195
|
+
import chalk46 from "chalk";
|
|
5196
|
+
function renderRestartMenu(items2, selected) {
|
|
5197
|
+
const lines = [chalk46.bold.cyan("assist \u2014 restart menu")];
|
|
5198
|
+
items2.forEach((item, i) => {
|
|
5199
|
+
const active = i === selected;
|
|
5200
|
+
const pointer = active ? chalk46.cyan("\u276F ") : " ";
|
|
5201
|
+
const number = chalk46.dim(`${i + 1}. `);
|
|
5202
|
+
const note = item.note ? chalk46.dim(` (${item.note})`) : "";
|
|
5203
|
+
let label2 = item.label;
|
|
5204
|
+
if (item.disabled) label2 = chalk46.dim(label2);
|
|
5205
|
+
else if (active) label2 = chalk46.cyan.bold(label2);
|
|
5206
|
+
lines.push(`${pointer}${number}${label2}${note}`);
|
|
5207
|
+
});
|
|
5208
|
+
lines.push(chalk46.dim("\u2191/\u2193 move \xB7 1-3 jump \xB7 enter select \xB7 esc close"));
|
|
5209
|
+
return lines.join("\n");
|
|
5210
|
+
}
|
|
5211
|
+
|
|
5212
|
+
// src/commands/sessions/web/restartMenu/createMenuState.ts
|
|
5213
|
+
function createMenuState(items2, log) {
|
|
5214
|
+
let open = false;
|
|
5215
|
+
let selected = firstEnabledIndex(items2);
|
|
5216
|
+
const render = () => log(renderRestartMenu(items2, selected));
|
|
5217
|
+
return {
|
|
5218
|
+
isOpen: () => open,
|
|
5219
|
+
open() {
|
|
5220
|
+
open = true;
|
|
5221
|
+
selected = firstEnabledIndex(items2);
|
|
5222
|
+
render();
|
|
5223
|
+
},
|
|
5224
|
+
close() {
|
|
5225
|
+
if (!open) return;
|
|
5226
|
+
open = false;
|
|
5227
|
+
log.clear();
|
|
5228
|
+
},
|
|
5229
|
+
move(direction) {
|
|
5230
|
+
selected = nextIndex(items2, selected, direction);
|
|
5231
|
+
render();
|
|
5232
|
+
},
|
|
5233
|
+
selectedItem: () => items2[selected],
|
|
5234
|
+
jumpTo(index2) {
|
|
5235
|
+
const item = items2[index2];
|
|
5236
|
+
if (!item) return false;
|
|
5237
|
+
selected = index2;
|
|
5238
|
+
render();
|
|
5239
|
+
return !item.disabled;
|
|
5240
|
+
}
|
|
5241
|
+
};
|
|
5242
|
+
}
|
|
5243
|
+
|
|
5244
|
+
// src/commands/sessions/web/restartMenu/enableRawMode.ts
|
|
5245
|
+
function enableRawMode(stdin, onData) {
|
|
5246
|
+
const wasRaw = stdin.isRaw;
|
|
5247
|
+
stdin.setRawMode(true);
|
|
5248
|
+
stdin.resume();
|
|
5249
|
+
stdin.setEncoding("utf8");
|
|
5250
|
+
stdin.on("data", onData);
|
|
5251
|
+
return () => {
|
|
5252
|
+
stdin.removeListener("data", onData);
|
|
5253
|
+
if (stdin.isTTY) stdin.setRawMode(wasRaw ?? false);
|
|
5254
|
+
stdin.pause();
|
|
5255
|
+
};
|
|
5256
|
+
}
|
|
5257
|
+
|
|
5258
|
+
// src/commands/sessions/daemon/stopDaemon.ts
|
|
5259
|
+
var STOP_TIMEOUT_MS = 5e3;
|
|
5260
|
+
async function stopDaemon() {
|
|
5261
|
+
let socket;
|
|
5262
|
+
try {
|
|
5263
|
+
socket = await connectToDaemon();
|
|
5264
|
+
} catch {
|
|
5265
|
+
console.log("Sessions daemon is not running");
|
|
5266
|
+
return;
|
|
5267
|
+
}
|
|
5268
|
+
socket.write(`${JSON.stringify({ type: "shutdown" })}
|
|
5269
|
+
`);
|
|
5270
|
+
if (await closedBeforeTimeout(socket)) {
|
|
5271
|
+
console.log("Sessions daemon stopped");
|
|
5272
|
+
} else {
|
|
5273
|
+
console.error(
|
|
5274
|
+
`Sessions daemon did not stop within ${STOP_TIMEOUT_MS / 1e3}s`
|
|
5275
|
+
);
|
|
5276
|
+
process.exitCode = 1;
|
|
5277
|
+
}
|
|
5278
|
+
}
|
|
5279
|
+
function closedBeforeTimeout(socket) {
|
|
5280
|
+
return new Promise((resolve16) => {
|
|
5281
|
+
const timer = setTimeout(() => {
|
|
5282
|
+
socket.destroy();
|
|
5283
|
+
resolve16(false);
|
|
5284
|
+
}, STOP_TIMEOUT_MS);
|
|
5285
|
+
socket.resume();
|
|
5286
|
+
socket.on("error", () => {
|
|
5287
|
+
});
|
|
5288
|
+
socket.once("close", () => {
|
|
5289
|
+
clearTimeout(timer);
|
|
5290
|
+
resolve16(true);
|
|
5291
|
+
});
|
|
5292
|
+
});
|
|
5293
|
+
}
|
|
5294
|
+
|
|
5295
|
+
// src/commands/sessions/daemon/restartDaemon.ts
|
|
5296
|
+
async function restartDaemon() {
|
|
5297
|
+
await stopDaemon();
|
|
5298
|
+
await ensureDaemonRunning("daemon restart");
|
|
5299
|
+
console.log(
|
|
5300
|
+
"Sessions daemon restarted; previously running claude sessions will resume"
|
|
5301
|
+
);
|
|
5302
|
+
}
|
|
5303
|
+
|
|
5304
|
+
// src/commands/sessions/web/restartMenu/menuItems.ts
|
|
5305
|
+
var menuItems = [
|
|
5306
|
+
{ label: "Restart daemon", action: "restart-daemon" },
|
|
5307
|
+
{ label: "Restart webserver", action: "restart-webserver" },
|
|
5308
|
+
{ label: "Restart both", action: "restart-both" }
|
|
5309
|
+
];
|
|
5310
|
+
|
|
5311
|
+
// src/commands/sessions/web/restartMenu/reExecWebServer.ts
|
|
5312
|
+
import { spawn as spawn5 } from "child_process";
|
|
5313
|
+
function reExecWebServer(deps2 = {}) {
|
|
5314
|
+
const {
|
|
5315
|
+
beforeExec,
|
|
5316
|
+
spawnFn = spawn5,
|
|
5317
|
+
exit = (code) => process.exit(code)
|
|
5318
|
+
} = deps2;
|
|
5319
|
+
beforeExec?.();
|
|
5320
|
+
const [, ...args] = process.argv;
|
|
5321
|
+
const child = spawnFn(process.execPath, args, {
|
|
5322
|
+
stdio: "inherit",
|
|
5323
|
+
detached: true
|
|
5324
|
+
});
|
|
5325
|
+
child.unref();
|
|
5326
|
+
exit(0);
|
|
5327
|
+
}
|
|
5328
|
+
|
|
5329
|
+
// src/commands/sessions/web/restartMenu/resolveOptions.ts
|
|
5330
|
+
var CTRL_R = String.fromCharCode(18);
|
|
5331
|
+
function resolveOptions(options2) {
|
|
5332
|
+
return {
|
|
5333
|
+
stdin: options2.stdin ?? process.stdin,
|
|
5334
|
+
out: options2.out ?? process.stdout,
|
|
5335
|
+
toggleKey: options2.toggleKey ?? CTRL_R,
|
|
5336
|
+
exit: options2.exit ?? ((code) => process.exit(code)),
|
|
5337
|
+
restartDaemonFn: options2.restartDaemonFn ?? restartDaemon,
|
|
5338
|
+
reExecFn: options2.reExecFn ?? reExecWebServer,
|
|
5339
|
+
items: options2.items ?? menuItems
|
|
5340
|
+
};
|
|
5341
|
+
}
|
|
5342
|
+
|
|
5343
|
+
// src/commands/sessions/web/restartMenu/installRestartMenu.ts
|
|
5344
|
+
function installRestartMenu(options2 = {}) {
|
|
5345
|
+
const { stdin, out, toggleKey, exit, restartDaemonFn, reExecFn, items: items2 } = resolveOptions(options2);
|
|
5346
|
+
if (!stdin.isTTY) return () => {
|
|
5347
|
+
};
|
|
5348
|
+
const log = createLogUpdate(out);
|
|
5349
|
+
const menu = createMenuState(items2, log);
|
|
5350
|
+
const reExec = () => reExecFn({ beforeExec: () => cleanup(), exit });
|
|
5351
|
+
const { isBusy, activate } = createActivate(menu, {
|
|
5352
|
+
runRestartDaemon: restartDaemonFn,
|
|
5353
|
+
reExec
|
|
5354
|
+
});
|
|
5355
|
+
const handler = createKeyHandler({
|
|
5356
|
+
menu,
|
|
5357
|
+
toggleKey,
|
|
5358
|
+
isBusy,
|
|
5359
|
+
activate,
|
|
5360
|
+
quit: () => {
|
|
5361
|
+
cleanup();
|
|
5362
|
+
exit(130);
|
|
5363
|
+
}
|
|
5364
|
+
});
|
|
5365
|
+
const restoreRaw = enableRawMode(stdin, handler);
|
|
5366
|
+
console.log(chalk47.dim("Press Ctrl+R for the restart menu"));
|
|
5367
|
+
let cleaned = false;
|
|
5368
|
+
function cleanup() {
|
|
5369
|
+
if (cleaned) return;
|
|
5370
|
+
cleaned = true;
|
|
5371
|
+
menu.close();
|
|
5372
|
+
restoreRaw();
|
|
5373
|
+
process.removeListener("exit", cleanup);
|
|
5374
|
+
}
|
|
5375
|
+
process.on("exit", cleanup);
|
|
5376
|
+
return cleanup;
|
|
5377
|
+
}
|
|
5378
|
+
|
|
5095
5379
|
// src/commands/sessions/web/index.ts
|
|
5096
5380
|
async function web(options2) {
|
|
5097
5381
|
await ensureDaemonRunning("web server start");
|
|
@@ -5117,6 +5401,7 @@ async function web(options2) {
|
|
|
5117
5401
|
socket.destroy();
|
|
5118
5402
|
}
|
|
5119
5403
|
});
|
|
5404
|
+
installRestartMenu();
|
|
5120
5405
|
}
|
|
5121
5406
|
|
|
5122
5407
|
// src/commands/backlog/web/index.ts
|
|
@@ -5125,26 +5410,26 @@ async function web2(options2) {
|
|
|
5125
5410
|
}
|
|
5126
5411
|
|
|
5127
5412
|
// src/commands/backlog/comment/index.ts
|
|
5128
|
-
import
|
|
5413
|
+
import chalk48 from "chalk";
|
|
5129
5414
|
async function comment(id, text3) {
|
|
5130
5415
|
const found = await findOneItem(id);
|
|
5131
5416
|
if (!found) process.exit(1);
|
|
5132
5417
|
await appendComment(found.orm, found.item.id, text3);
|
|
5133
|
-
console.log(
|
|
5418
|
+
console.log(chalk48.green(`Comment added to item #${id}.`));
|
|
5134
5419
|
}
|
|
5135
5420
|
|
|
5136
5421
|
// src/commands/backlog/comments/index.ts
|
|
5137
|
-
import
|
|
5422
|
+
import chalk49 from "chalk";
|
|
5138
5423
|
async function comments2(id) {
|
|
5139
5424
|
const found = await findOneItem(id);
|
|
5140
5425
|
if (!found) process.exit(1);
|
|
5141
5426
|
const { item } = found;
|
|
5142
5427
|
const entries = item.comments ?? [];
|
|
5143
5428
|
if (entries.length === 0) {
|
|
5144
|
-
console.log(
|
|
5429
|
+
console.log(chalk49.dim(`No comments on item #${id}.`));
|
|
5145
5430
|
return;
|
|
5146
5431
|
}
|
|
5147
|
-
console.log(
|
|
5432
|
+
console.log(chalk49.bold(`Comments for #${id}: ${item.name}
|
|
5148
5433
|
`));
|
|
5149
5434
|
for (const entry of entries) {
|
|
5150
5435
|
console.log(`${formatComment(entry)}
|
|
@@ -5153,7 +5438,7 @@ async function comments2(id) {
|
|
|
5153
5438
|
}
|
|
5154
5439
|
|
|
5155
5440
|
// src/commands/backlog/delete-comment/index.ts
|
|
5156
|
-
import
|
|
5441
|
+
import chalk50 from "chalk";
|
|
5157
5442
|
async function deleteCommentCmd(id, commentId) {
|
|
5158
5443
|
const found = await findOneItem(id);
|
|
5159
5444
|
if (!found) process.exit(1);
|
|
@@ -5165,16 +5450,16 @@ async function deleteCommentCmd(id, commentId) {
|
|
|
5165
5450
|
switch (outcome) {
|
|
5166
5451
|
case "deleted":
|
|
5167
5452
|
console.log(
|
|
5168
|
-
|
|
5453
|
+
chalk50.green(`Comment #${commentId} deleted from item #${id}.`)
|
|
5169
5454
|
);
|
|
5170
5455
|
break;
|
|
5171
5456
|
case "not-found":
|
|
5172
|
-
console.log(
|
|
5457
|
+
console.log(chalk50.red(`Comment #${commentId} not found on item #${id}.`));
|
|
5173
5458
|
process.exit(1);
|
|
5174
5459
|
break;
|
|
5175
5460
|
case "is-summary":
|
|
5176
5461
|
console.log(
|
|
5177
|
-
|
|
5462
|
+
chalk50.red(
|
|
5178
5463
|
`Comment #${commentId} is a phase summary and cannot be deleted.`
|
|
5179
5464
|
)
|
|
5180
5465
|
);
|
|
@@ -5192,7 +5477,7 @@ function registerCommentCommands(cmd) {
|
|
|
5192
5477
|
|
|
5193
5478
|
// src/commands/backlog/export/index.ts
|
|
5194
5479
|
import { writeFile } from "fs/promises";
|
|
5195
|
-
import
|
|
5480
|
+
import chalk51 from "chalk";
|
|
5196
5481
|
|
|
5197
5482
|
// src/commands/backlog/dump/DumpTable.ts
|
|
5198
5483
|
var DUMP_FORMAT = "assist-backlog-dump";
|
|
@@ -5259,7 +5544,7 @@ async function exportBacklog(file) {
|
|
|
5259
5544
|
if (file) {
|
|
5260
5545
|
await writeFile(file, dump);
|
|
5261
5546
|
console.error(
|
|
5262
|
-
|
|
5547
|
+
chalk51.green(`Exported backlog to ${file} (${dump.length} bytes).`)
|
|
5263
5548
|
);
|
|
5264
5549
|
return;
|
|
5265
5550
|
}
|
|
@@ -5275,7 +5560,7 @@ function registerExportCommand(cmd) {
|
|
|
5275
5560
|
|
|
5276
5561
|
// src/commands/backlog/import/index.ts
|
|
5277
5562
|
import { readFile } from "fs/promises";
|
|
5278
|
-
import
|
|
5563
|
+
import chalk53 from "chalk";
|
|
5279
5564
|
|
|
5280
5565
|
// src/commands/backlog/dump/countCopyRows.ts
|
|
5281
5566
|
function countCopyRows(data) {
|
|
@@ -5352,7 +5637,7 @@ function validateDump({ header, sections }) {
|
|
|
5352
5637
|
}
|
|
5353
5638
|
|
|
5354
5639
|
// src/commands/backlog/import/confirmReplace.ts
|
|
5355
|
-
import
|
|
5640
|
+
import chalk52 from "chalk";
|
|
5356
5641
|
async function countRows(client, table) {
|
|
5357
5642
|
const { rows } = await client.query(
|
|
5358
5643
|
`SELECT count(*)::int AS n FROM ${table}`
|
|
@@ -5363,7 +5648,7 @@ function printSummary(current, incoming) {
|
|
|
5363
5648
|
const lines = DUMP_TABLES.map(
|
|
5364
5649
|
(t, i) => ` ${t.name}: ${current[i]} \u2192 ${incoming[i]} rows`
|
|
5365
5650
|
);
|
|
5366
|
-
console.error(
|
|
5651
|
+
console.error(chalk52.bold("\nThis will REPLACE all backlog data:"));
|
|
5367
5652
|
console.error(`${lines.join("\n")}
|
|
5368
5653
|
`);
|
|
5369
5654
|
}
|
|
@@ -5439,13 +5724,13 @@ async function importBacklog(file, options2 = {}) {
|
|
|
5439
5724
|
);
|
|
5440
5725
|
await withBacklogClient(async (client) => {
|
|
5441
5726
|
if (!options2.yes && !await confirmReplace(client, incoming, !file)) {
|
|
5442
|
-
console.error(
|
|
5727
|
+
console.error(chalk53.yellow("Import cancelled; no changes made."));
|
|
5443
5728
|
return;
|
|
5444
5729
|
}
|
|
5445
5730
|
await restore(client, parsed);
|
|
5446
5731
|
const total = incoming.reduce((sum, n) => sum + n, 0);
|
|
5447
5732
|
console.error(
|
|
5448
|
-
|
|
5733
|
+
chalk53.green(
|
|
5449
5734
|
`Imported backlog: ${total} rows restored across ${DUMP_TABLES.length} tables.`
|
|
5450
5735
|
)
|
|
5451
5736
|
);
|
|
@@ -5462,7 +5747,7 @@ function registerImportCommand(cmd) {
|
|
|
5462
5747
|
}
|
|
5463
5748
|
|
|
5464
5749
|
// src/commands/backlog/add/index.ts
|
|
5465
|
-
import
|
|
5750
|
+
import chalk54 from "chalk";
|
|
5466
5751
|
|
|
5467
5752
|
// src/commands/backlog/add/shared.ts
|
|
5468
5753
|
import { spawnSync } from "child_process";
|
|
@@ -5552,11 +5837,11 @@ async function add(options2) {
|
|
|
5552
5837
|
},
|
|
5553
5838
|
getOrigin()
|
|
5554
5839
|
);
|
|
5555
|
-
console.log(
|
|
5840
|
+
console.log(chalk54.green(`Added item #${id}: ${name}`));
|
|
5556
5841
|
}
|
|
5557
5842
|
|
|
5558
5843
|
// src/commands/backlog/addPhase.ts
|
|
5559
|
-
import
|
|
5844
|
+
import chalk56 from "chalk";
|
|
5560
5845
|
|
|
5561
5846
|
// src/commands/backlog/insertPhaseAt.ts
|
|
5562
5847
|
import { count, eq as eq16 } from "drizzle-orm";
|
|
@@ -5589,7 +5874,7 @@ async function insertPhaseAt(orm, itemId, phaseIdx, name, tasks, manualChecks, c
|
|
|
5589
5874
|
}
|
|
5590
5875
|
|
|
5591
5876
|
// src/commands/backlog/resolveInsertPosition.ts
|
|
5592
|
-
import
|
|
5877
|
+
import chalk55 from "chalk";
|
|
5593
5878
|
import { count as count2, eq as eq17 } from "drizzle-orm";
|
|
5594
5879
|
async function resolveInsertPosition(orm, itemId, position) {
|
|
5595
5880
|
const [row] = await orm.select({ cnt: count2() }).from(planPhases).where(eq17(planPhases.itemId, itemId));
|
|
@@ -5598,7 +5883,7 @@ async function resolveInsertPosition(orm, itemId, position) {
|
|
|
5598
5883
|
const pos = Number.parseInt(position, 10);
|
|
5599
5884
|
if (pos < 1 || pos > phaseCount + 1) {
|
|
5600
5885
|
console.log(
|
|
5601
|
-
|
|
5886
|
+
chalk55.red(
|
|
5602
5887
|
`Position ${pos} is out of range. Must be between 1 and ${phaseCount + 1}.`
|
|
5603
5888
|
)
|
|
5604
5889
|
);
|
|
@@ -5619,7 +5904,7 @@ async function addPhase(id, name, options2) {
|
|
|
5619
5904
|
if (!found) return;
|
|
5620
5905
|
const tasks = options2.task ?? [];
|
|
5621
5906
|
if (tasks.length === 0) {
|
|
5622
|
-
console.log(
|
|
5907
|
+
console.log(chalk56.red("At least one --task is required."));
|
|
5623
5908
|
process.exitCode = 1;
|
|
5624
5909
|
return;
|
|
5625
5910
|
}
|
|
@@ -5638,14 +5923,14 @@ async function addPhase(id, name, options2) {
|
|
|
5638
5923
|
);
|
|
5639
5924
|
const verb = options2.position !== void 0 ? "Inserted" : "Added";
|
|
5640
5925
|
console.log(
|
|
5641
|
-
|
|
5926
|
+
chalk56.green(
|
|
5642
5927
|
`${verb} phase ${phaseIdx + 1} "${name}" to item #${itemId} with ${tasks.length} task(s).`
|
|
5643
5928
|
)
|
|
5644
5929
|
);
|
|
5645
5930
|
}
|
|
5646
5931
|
|
|
5647
5932
|
// src/commands/backlog/list/index.ts
|
|
5648
|
-
import
|
|
5933
|
+
import chalk57 from "chalk";
|
|
5649
5934
|
|
|
5650
5935
|
// src/commands/backlog/originDisplayName.ts
|
|
5651
5936
|
function originDisplayName(origin) {
|
|
@@ -5697,7 +5982,7 @@ async function list2(options2) {
|
|
|
5697
5982
|
const allItems = await loadBacklog(options2.allRepos);
|
|
5698
5983
|
const items2 = filterItems(allItems, options2);
|
|
5699
5984
|
if (items2.length === 0) {
|
|
5700
|
-
console.log(
|
|
5985
|
+
console.log(chalk57.dim("Backlog is empty."));
|
|
5701
5986
|
return;
|
|
5702
5987
|
}
|
|
5703
5988
|
const labels = originDisplayLabels(
|
|
@@ -5706,9 +5991,9 @@ async function list2(options2) {
|
|
|
5706
5991
|
const repoNameOf = (item) => item.origin ? labels.get(item.origin) ?? "" : "";
|
|
5707
5992
|
const prefixWidth = options2.allRepos ? Math.max(0, ...items2.map((i) => repoNameOf(i).length)) : 0;
|
|
5708
5993
|
for (const item of items2) {
|
|
5709
|
-
const repoPrefix = options2.allRepos ? `${
|
|
5994
|
+
const repoPrefix = options2.allRepos ? `${chalk57.dim(repoNameOf(item).padEnd(prefixWidth))} ` : "";
|
|
5710
5995
|
console.log(
|
|
5711
|
-
`${repoPrefix}${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
5996
|
+
`${repoPrefix}${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk57.dim(`#${item.id}`)} ${item.name}${phaseLabel(item)}${dependencyLabel(item, allItems)}`
|
|
5712
5997
|
);
|
|
5713
5998
|
if (options2.verbose) {
|
|
5714
5999
|
printVerboseDetails(item);
|
|
@@ -5734,7 +6019,7 @@ function registerItemCommands(cmd) {
|
|
|
5734
6019
|
}
|
|
5735
6020
|
|
|
5736
6021
|
// src/commands/backlog/link.ts
|
|
5737
|
-
import
|
|
6022
|
+
import chalk59 from "chalk";
|
|
5738
6023
|
|
|
5739
6024
|
// src/commands/backlog/hasCycle.ts
|
|
5740
6025
|
function hasCycle(adjacency, fromId, toId) {
|
|
@@ -5766,14 +6051,14 @@ async function loadDependencyGraph(orm) {
|
|
|
5766
6051
|
}
|
|
5767
6052
|
|
|
5768
6053
|
// src/commands/backlog/validateLinkTarget.ts
|
|
5769
|
-
import
|
|
6054
|
+
import chalk58 from "chalk";
|
|
5770
6055
|
function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
5771
6056
|
const duplicate = (fromItem.links ?? []).some(
|
|
5772
6057
|
(l) => l.targetId === toNum && l.type === linkType
|
|
5773
6058
|
);
|
|
5774
6059
|
if (duplicate) {
|
|
5775
6060
|
console.log(
|
|
5776
|
-
|
|
6061
|
+
chalk58.yellow(`Link already exists: #${fromNum} ${linkType} #${toNum}`)
|
|
5777
6062
|
);
|
|
5778
6063
|
return false;
|
|
5779
6064
|
}
|
|
@@ -5782,7 +6067,7 @@ function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
|
5782
6067
|
|
|
5783
6068
|
// src/commands/backlog/link.ts
|
|
5784
6069
|
function fail(message) {
|
|
5785
|
-
console.log(
|
|
6070
|
+
console.log(chalk59.red(message));
|
|
5786
6071
|
return void 0;
|
|
5787
6072
|
}
|
|
5788
6073
|
function parseLinkType(type) {
|
|
@@ -5812,12 +6097,12 @@ async function link(fromId, toId, opts) {
|
|
|
5812
6097
|
if (await createsCycle(orm, linkType, fromNum, toNum)) return;
|
|
5813
6098
|
await orm.insert(links).values({ itemId: fromNum, type: linkType, targetId: toNum });
|
|
5814
6099
|
console.log(
|
|
5815
|
-
|
|
6100
|
+
chalk59.green(`Linked #${fromNum} ${linkType} #${toNum} (${toItem.name})`)
|
|
5816
6101
|
);
|
|
5817
6102
|
}
|
|
5818
6103
|
|
|
5819
6104
|
// src/commands/backlog/unlink.ts
|
|
5820
|
-
import
|
|
6105
|
+
import chalk60 from "chalk";
|
|
5821
6106
|
import { and as and4, eq as eq19 } from "drizzle-orm";
|
|
5822
6107
|
async function unlink(fromId, toId) {
|
|
5823
6108
|
const fromNum = Number.parseInt(fromId, 10);
|
|
@@ -5825,19 +6110,19 @@ async function unlink(fromId, toId) {
|
|
|
5825
6110
|
const { orm } = await getReady();
|
|
5826
6111
|
const fromItem = await loadItem(orm, fromNum);
|
|
5827
6112
|
if (!fromItem) {
|
|
5828
|
-
console.log(
|
|
6113
|
+
console.log(chalk60.red(`Item #${fromId} not found.`));
|
|
5829
6114
|
return;
|
|
5830
6115
|
}
|
|
5831
6116
|
if (!fromItem.links || fromItem.links.length === 0) {
|
|
5832
|
-
console.log(
|
|
6117
|
+
console.log(chalk60.yellow(`No links found on item #${fromId}.`));
|
|
5833
6118
|
return;
|
|
5834
6119
|
}
|
|
5835
6120
|
if (!fromItem.links.some((l) => l.targetId === toNum)) {
|
|
5836
|
-
console.log(
|
|
6121
|
+
console.log(chalk60.yellow(`No link from #${fromId} to #${toId} found.`));
|
|
5837
6122
|
return;
|
|
5838
6123
|
}
|
|
5839
6124
|
await orm.delete(links).where(and4(eq19(links.itemId, fromNum), eq19(links.targetId, toNum)));
|
|
5840
|
-
console.log(
|
|
6125
|
+
console.log(chalk60.green(`Removed link from #${fromId} to #${toId}.`));
|
|
5841
6126
|
}
|
|
5842
6127
|
|
|
5843
6128
|
// src/commands/backlog/registerLinkCommands.ts
|
|
@@ -5851,17 +6136,17 @@ function registerLinkCommands(cmd) {
|
|
|
5851
6136
|
}
|
|
5852
6137
|
|
|
5853
6138
|
// src/commands/backlog/move-repo/index.ts
|
|
5854
|
-
import
|
|
6139
|
+
import chalk62 from "chalk";
|
|
5855
6140
|
import { eq as eq21 } from "drizzle-orm";
|
|
5856
6141
|
|
|
5857
6142
|
// src/commands/backlog/move-repo/confirmMove.ts
|
|
5858
|
-
import
|
|
6143
|
+
import chalk61 from "chalk";
|
|
5859
6144
|
function pluralItems(n) {
|
|
5860
6145
|
return `${n} item${n === 1 ? "" : "s"}`;
|
|
5861
6146
|
}
|
|
5862
6147
|
async function confirmMove(cnt, oldOrigin, newOrigin) {
|
|
5863
6148
|
console.log(
|
|
5864
|
-
`${pluralItems(cnt)}: ${
|
|
6149
|
+
`${pluralItems(cnt)}: ${chalk61.cyan(oldOrigin)} \u2192 ${chalk61.cyan(newOrigin)}`
|
|
5865
6150
|
);
|
|
5866
6151
|
return promptConfirm(`Retag ${pluralItems(cnt)}?`);
|
|
5867
6152
|
}
|
|
@@ -5893,7 +6178,7 @@ Pass the full origin.`
|
|
|
5893
6178
|
|
|
5894
6179
|
// src/commands/backlog/move-repo/index.ts
|
|
5895
6180
|
function fail2(message) {
|
|
5896
|
-
console.log(
|
|
6181
|
+
console.log(chalk62.red(message));
|
|
5897
6182
|
process.exitCode = 1;
|
|
5898
6183
|
}
|
|
5899
6184
|
async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
@@ -5909,12 +6194,12 @@ async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
|
5909
6194
|
}
|
|
5910
6195
|
const cnt = await countByOrigin(orm, oldOrigin);
|
|
5911
6196
|
if (!options2.yes && !await confirmMove(cnt, oldOrigin, newOrigin)) {
|
|
5912
|
-
console.log(
|
|
6197
|
+
console.log(chalk62.yellow("Move cancelled; no changes made."));
|
|
5913
6198
|
return;
|
|
5914
6199
|
}
|
|
5915
6200
|
await orm.update(items).set({ origin: newOrigin }).where(eq21(items.origin, oldOrigin));
|
|
5916
6201
|
console.log(
|
|
5917
|
-
|
|
6202
|
+
chalk62.green(
|
|
5918
6203
|
`Moved ${pluralItems(cnt)} from "${oldOrigin}" to "${newOrigin}".`
|
|
5919
6204
|
)
|
|
5920
6205
|
);
|
|
@@ -5943,11 +6228,11 @@ function registerPlanCommands(cmd) {
|
|
|
5943
6228
|
}
|
|
5944
6229
|
|
|
5945
6230
|
// src/commands/backlog/refine.ts
|
|
5946
|
-
import
|
|
6231
|
+
import chalk65 from "chalk";
|
|
5947
6232
|
import enquirer7 from "enquirer";
|
|
5948
6233
|
|
|
5949
6234
|
// src/commands/backlog/launchMode.ts
|
|
5950
|
-
import
|
|
6235
|
+
import chalk64 from "chalk";
|
|
5951
6236
|
|
|
5952
6237
|
// src/commands/backlog/surfaceCreatedItem.ts
|
|
5953
6238
|
async function surfaceCreatedItem(slashCommand, id) {
|
|
@@ -5965,31 +6250,31 @@ async function surfaceCreatedItem(slashCommand, id) {
|
|
|
5965
6250
|
}
|
|
5966
6251
|
|
|
5967
6252
|
// src/commands/backlog/tryRunById.ts
|
|
5968
|
-
import
|
|
6253
|
+
import chalk63 from "chalk";
|
|
5969
6254
|
async function tryRunById(id, options2) {
|
|
5970
6255
|
const numericId = Number.parseInt(id, 10);
|
|
5971
6256
|
const { orm } = await getReady();
|
|
5972
6257
|
const item = Number.isNaN(numericId) ? void 0 : await loadItem(orm, numericId);
|
|
5973
6258
|
if (!item) {
|
|
5974
|
-
console.log(
|
|
6259
|
+
console.log(chalk63.red(`Item #${id} not found.`));
|
|
5975
6260
|
return false;
|
|
5976
6261
|
}
|
|
5977
6262
|
if (item.status === "done") {
|
|
5978
|
-
console.log(
|
|
6263
|
+
console.log(chalk63.red(`Item #${id} is already done.`));
|
|
5979
6264
|
return false;
|
|
5980
6265
|
}
|
|
5981
6266
|
if (item.status === "wontdo") {
|
|
5982
|
-
console.log(
|
|
6267
|
+
console.log(chalk63.red(`Item #${id} is marked won't do.`));
|
|
5983
6268
|
return false;
|
|
5984
6269
|
}
|
|
5985
6270
|
const hasDeps = (item.links ?? []).some((l) => l.type === "depends-on");
|
|
5986
6271
|
if (hasDeps && isBlocked(item, await loadItemSummaries(orm, getOrigin()))) {
|
|
5987
6272
|
console.log(
|
|
5988
|
-
|
|
6273
|
+
chalk63.red(`Item #${id} is blocked by unresolved dependencies.`)
|
|
5989
6274
|
);
|
|
5990
6275
|
return false;
|
|
5991
6276
|
}
|
|
5992
|
-
console.log(
|
|
6277
|
+
console.log(chalk63.bold(`
|
|
5993
6278
|
Running backlog item #${id}...
|
|
5994
6279
|
`));
|
|
5995
6280
|
await run2(id, options2);
|
|
@@ -6026,7 +6311,7 @@ async function launchMode(slashCommand, options2) {
|
|
|
6026
6311
|
if (typeof signal.id === "string" && signal.id) {
|
|
6027
6312
|
if (await tryRunById(signal.id, { allowEdits: true })) return;
|
|
6028
6313
|
}
|
|
6029
|
-
console.log(
|
|
6314
|
+
console.log(chalk64.bold("\nChaining into assist next...\n"));
|
|
6030
6315
|
await next({ allowEdits: true, once: options2?.once });
|
|
6031
6316
|
}
|
|
6032
6317
|
}
|
|
@@ -6038,12 +6323,12 @@ async function pickItemForRefine() {
|
|
|
6038
6323
|
(i) => i.status === "todo" || i.status === "in-progress"
|
|
6039
6324
|
);
|
|
6040
6325
|
if (active.length === 0) {
|
|
6041
|
-
console.log(
|
|
6326
|
+
console.log(chalk65.yellow("No active backlog items to refine."));
|
|
6042
6327
|
return void 0;
|
|
6043
6328
|
}
|
|
6044
6329
|
if (active.length === 1) {
|
|
6045
6330
|
const item = active[0];
|
|
6046
|
-
console.log(
|
|
6331
|
+
console.log(chalk65.bold(`Auto-selecting item #${item.id}: ${item.name}`));
|
|
6047
6332
|
return String(item.id);
|
|
6048
6333
|
}
|
|
6049
6334
|
const { selected } = await exitOnCancel(
|
|
@@ -6078,7 +6363,7 @@ function registerRefineCommand(cmd) {
|
|
|
6078
6363
|
}
|
|
6079
6364
|
|
|
6080
6365
|
// src/commands/backlog/rewindPhase.ts
|
|
6081
|
-
import
|
|
6366
|
+
import chalk66 from "chalk";
|
|
6082
6367
|
function validateRewind2(item, phaseNumber) {
|
|
6083
6368
|
if (!item.plan || item.plan.length === 0) {
|
|
6084
6369
|
return `Item #${item.id} has no plan phases.`;
|
|
@@ -6098,12 +6383,12 @@ async function rewindPhase(id, phase, opts) {
|
|
|
6098
6383
|
const { orm } = await getReady();
|
|
6099
6384
|
const item = await loadItem(orm, Number.parseInt(id, 10));
|
|
6100
6385
|
if (!item) {
|
|
6101
|
-
console.log(
|
|
6386
|
+
console.log(chalk66.red(`Item #${id} not found.`));
|
|
6102
6387
|
return;
|
|
6103
6388
|
}
|
|
6104
6389
|
const error = validateRewind2(item, phaseNumber);
|
|
6105
6390
|
if (error) {
|
|
6106
|
-
console.log(
|
|
6391
|
+
console.log(chalk66.red(error));
|
|
6107
6392
|
process.exitCode = 1;
|
|
6108
6393
|
return;
|
|
6109
6394
|
}
|
|
@@ -6121,7 +6406,7 @@ async function rewindPhase(id, phase, opts) {
|
|
|
6121
6406
|
targetPhase: phaseIndex
|
|
6122
6407
|
});
|
|
6123
6408
|
console.log(
|
|
6124
|
-
|
|
6409
|
+
chalk66.green(`Rewound item #${id} to phase ${phaseNumber} (${phaseName}).`)
|
|
6125
6410
|
);
|
|
6126
6411
|
}
|
|
6127
6412
|
|
|
@@ -6147,22 +6432,22 @@ function registerRunCommand(cmd) {
|
|
|
6147
6432
|
}
|
|
6148
6433
|
|
|
6149
6434
|
// src/commands/backlog/search/index.ts
|
|
6150
|
-
import
|
|
6435
|
+
import chalk67 from "chalk";
|
|
6151
6436
|
async function search(query) {
|
|
6152
6437
|
const items2 = await searchBacklog(query);
|
|
6153
6438
|
if (items2.length === 0) {
|
|
6154
|
-
console.log(
|
|
6439
|
+
console.log(chalk67.dim(`No items matching "${query}".`));
|
|
6155
6440
|
return;
|
|
6156
6441
|
}
|
|
6157
6442
|
console.log(
|
|
6158
|
-
|
|
6443
|
+
chalk67.dim(
|
|
6159
6444
|
`${items2.length} item${items2.length === 1 ? "" : "s"} matching "${query}":
|
|
6160
6445
|
`
|
|
6161
6446
|
)
|
|
6162
6447
|
);
|
|
6163
6448
|
for (const item of items2) {
|
|
6164
6449
|
console.log(
|
|
6165
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
6450
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk67.dim(`#${item.id}`)} ${item.name}`
|
|
6166
6451
|
);
|
|
6167
6452
|
}
|
|
6168
6453
|
}
|
|
@@ -6173,16 +6458,16 @@ function registerSearchCommand(cmd) {
|
|
|
6173
6458
|
}
|
|
6174
6459
|
|
|
6175
6460
|
// src/commands/backlog/delete/index.ts
|
|
6176
|
-
import
|
|
6461
|
+
import chalk68 from "chalk";
|
|
6177
6462
|
async function del(id) {
|
|
6178
6463
|
const name = await removeItem(id);
|
|
6179
6464
|
if (name) {
|
|
6180
|
-
console.log(
|
|
6465
|
+
console.log(chalk68.green(`Deleted item #${id}: ${name}`));
|
|
6181
6466
|
}
|
|
6182
6467
|
}
|
|
6183
6468
|
|
|
6184
6469
|
// src/commands/backlog/done/index.ts
|
|
6185
|
-
import
|
|
6470
|
+
import chalk69 from "chalk";
|
|
6186
6471
|
async function done(id, summary) {
|
|
6187
6472
|
const found = await findOneItem(id);
|
|
6188
6473
|
if (!found) return;
|
|
@@ -6192,12 +6477,12 @@ async function done(id, summary) {
|
|
|
6192
6477
|
const pending = item.plan.slice(completedCount);
|
|
6193
6478
|
if (pending.length > 0) {
|
|
6194
6479
|
console.log(
|
|
6195
|
-
|
|
6480
|
+
chalk69.red(
|
|
6196
6481
|
`Cannot complete item #${id}: ${pending.length} pending phase(s):`
|
|
6197
6482
|
)
|
|
6198
6483
|
);
|
|
6199
6484
|
for (const phase of pending) {
|
|
6200
|
-
console.log(
|
|
6485
|
+
console.log(chalk69.yellow(` - ${phase.name}`));
|
|
6201
6486
|
}
|
|
6202
6487
|
process.exitCode = 1;
|
|
6203
6488
|
return;
|
|
@@ -6208,35 +6493,35 @@ async function done(id, summary) {
|
|
|
6208
6493
|
const phase = item.currentPhase ?? 1;
|
|
6209
6494
|
await appendComment(orm, item.id, summary, { phase, type: "summary" });
|
|
6210
6495
|
}
|
|
6211
|
-
console.log(
|
|
6496
|
+
console.log(chalk69.green(`Completed item #${id}: ${item.name}`));
|
|
6212
6497
|
}
|
|
6213
6498
|
|
|
6214
6499
|
// src/commands/backlog/start/index.ts
|
|
6215
|
-
import
|
|
6500
|
+
import chalk70 from "chalk";
|
|
6216
6501
|
async function start(id) {
|
|
6217
6502
|
const name = await setStatus(id, "in-progress");
|
|
6218
6503
|
if (name) {
|
|
6219
|
-
console.log(
|
|
6504
|
+
console.log(chalk70.green(`Started item #${id}: ${name}`));
|
|
6220
6505
|
}
|
|
6221
6506
|
}
|
|
6222
6507
|
|
|
6223
6508
|
// src/commands/backlog/stop/index.ts
|
|
6224
|
-
import
|
|
6509
|
+
import chalk71 from "chalk";
|
|
6225
6510
|
import { and as and5, eq as eq22 } from "drizzle-orm";
|
|
6226
6511
|
async function stop() {
|
|
6227
6512
|
const { orm } = await getReady();
|
|
6228
6513
|
const stopped = await orm.update(items).set({ status: "todo", currentPhase: 1 }).where(and5(eq22(items.status, "in-progress"), eq22(items.origin, getOrigin()))).returning({ id: items.id, name: items.name });
|
|
6229
6514
|
if (stopped.length === 0) {
|
|
6230
|
-
console.log(
|
|
6515
|
+
console.log(chalk71.yellow("No in-progress items to stop."));
|
|
6231
6516
|
return;
|
|
6232
6517
|
}
|
|
6233
6518
|
for (const item of stopped) {
|
|
6234
|
-
console.log(
|
|
6519
|
+
console.log(chalk71.yellow(`Stopped item #${item.id}: ${item.name}`));
|
|
6235
6520
|
}
|
|
6236
6521
|
}
|
|
6237
6522
|
|
|
6238
6523
|
// src/commands/backlog/wontdo/index.ts
|
|
6239
|
-
import
|
|
6524
|
+
import chalk72 from "chalk";
|
|
6240
6525
|
async function wontdo(id, reason) {
|
|
6241
6526
|
const found = await findOneItem(id);
|
|
6242
6527
|
if (!found) return;
|
|
@@ -6246,7 +6531,7 @@ async function wontdo(id, reason) {
|
|
|
6246
6531
|
const phase = item.currentPhase ?? 1;
|
|
6247
6532
|
await appendComment(orm, item.id, reason, { phase, type: "summary" });
|
|
6248
6533
|
}
|
|
6249
|
-
console.log(
|
|
6534
|
+
console.log(chalk72.red(`Won't do item #${id}: ${item.name}`));
|
|
6250
6535
|
}
|
|
6251
6536
|
|
|
6252
6537
|
// src/commands/backlog/registerStatusCommands.ts
|
|
@@ -6259,11 +6544,11 @@ function registerStatusCommands(cmd) {
|
|
|
6259
6544
|
}
|
|
6260
6545
|
|
|
6261
6546
|
// src/commands/backlog/removePhase.ts
|
|
6262
|
-
import
|
|
6547
|
+
import chalk74 from "chalk";
|
|
6263
6548
|
import { and as and8, eq as eq25 } from "drizzle-orm";
|
|
6264
6549
|
|
|
6265
6550
|
// src/commands/backlog/findPhase.ts
|
|
6266
|
-
import
|
|
6551
|
+
import chalk73 from "chalk";
|
|
6267
6552
|
import { and as and6, count as count4, eq as eq23 } from "drizzle-orm";
|
|
6268
6553
|
async function findPhase(id, phase) {
|
|
6269
6554
|
const found = await findOneItem(id);
|
|
@@ -6274,7 +6559,7 @@ async function findPhase(id, phase) {
|
|
|
6274
6559
|
const [row] = await orm.select({ cnt: count4() }).from(planPhases).where(and6(eq23(planPhases.itemId, itemId), eq23(planPhases.idx, phaseIdx)));
|
|
6275
6560
|
if (!row || row.cnt === 0) {
|
|
6276
6561
|
console.log(
|
|
6277
|
-
|
|
6562
|
+
chalk73.red(`Phase ${phaseIdx + 1} not found on item #${itemId}.`)
|
|
6278
6563
|
);
|
|
6279
6564
|
process.exitCode = 1;
|
|
6280
6565
|
return void 0;
|
|
@@ -6321,12 +6606,12 @@ async function removePhase(id, phase) {
|
|
|
6321
6606
|
await adjustCurrentPhase(tx, item, phaseIdx);
|
|
6322
6607
|
});
|
|
6323
6608
|
console.log(
|
|
6324
|
-
|
|
6609
|
+
chalk74.green(`Removed phase ${phaseIdx + 1} from item #${itemId}.`)
|
|
6325
6610
|
);
|
|
6326
6611
|
}
|
|
6327
6612
|
|
|
6328
6613
|
// src/commands/backlog/update/index.ts
|
|
6329
|
-
import
|
|
6614
|
+
import chalk76 from "chalk";
|
|
6330
6615
|
import { eq as eq26 } from "drizzle-orm";
|
|
6331
6616
|
|
|
6332
6617
|
// src/commands/backlog/update/parseListIndex.ts
|
|
@@ -6402,16 +6687,16 @@ function applyAcMutations(current, options2) {
|
|
|
6402
6687
|
}
|
|
6403
6688
|
|
|
6404
6689
|
// src/commands/backlog/update/buildUpdateValues.ts
|
|
6405
|
-
import
|
|
6690
|
+
import chalk75 from "chalk";
|
|
6406
6691
|
function buildUpdateValues(options2) {
|
|
6407
6692
|
const { name, desc: desc2, type, ac } = options2;
|
|
6408
6693
|
if (!name && !desc2 && !type && !ac) {
|
|
6409
|
-
console.log(
|
|
6694
|
+
console.log(chalk75.red("Nothing to update. Provide at least one flag."));
|
|
6410
6695
|
process.exitCode = 1;
|
|
6411
6696
|
return void 0;
|
|
6412
6697
|
}
|
|
6413
6698
|
if (type && type !== "story" && type !== "bug") {
|
|
6414
|
-
console.log(
|
|
6699
|
+
console.log(chalk75.red('Invalid type. Must be "story" or "bug".'));
|
|
6415
6700
|
process.exitCode = 1;
|
|
6416
6701
|
return void 0;
|
|
6417
6702
|
}
|
|
@@ -6444,14 +6729,14 @@ async function update(id, options2) {
|
|
|
6444
6729
|
if (hasAcMutations(options2)) {
|
|
6445
6730
|
if (options2.ac) {
|
|
6446
6731
|
console.log(
|
|
6447
|
-
|
|
6732
|
+
chalk76.red("Cannot combine --ac with --add-ac/--edit-ac/--remove-ac.")
|
|
6448
6733
|
);
|
|
6449
6734
|
process.exitCode = 1;
|
|
6450
6735
|
return;
|
|
6451
6736
|
}
|
|
6452
6737
|
const mutation = applyAcMutations(found.item.acceptanceCriteria, options2);
|
|
6453
6738
|
if (!mutation.ok) {
|
|
6454
|
-
console.log(
|
|
6739
|
+
console.log(chalk76.red(mutation.error));
|
|
6455
6740
|
process.exitCode = 1;
|
|
6456
6741
|
return;
|
|
6457
6742
|
}
|
|
@@ -6462,11 +6747,11 @@ async function update(id, options2) {
|
|
|
6462
6747
|
const { orm } = found;
|
|
6463
6748
|
const itemId = found.item.id;
|
|
6464
6749
|
await orm.update(items).set(built.set).where(eq26(items.id, itemId));
|
|
6465
|
-
console.log(
|
|
6750
|
+
console.log(chalk76.green(`Updated ${built.fields} on item #${itemId}.`));
|
|
6466
6751
|
}
|
|
6467
6752
|
|
|
6468
6753
|
// src/commands/backlog/updatePhase.ts
|
|
6469
|
-
import
|
|
6754
|
+
import chalk77 from "chalk";
|
|
6470
6755
|
|
|
6471
6756
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
6472
6757
|
import { and as and9, eq as eq27 } from "drizzle-orm";
|
|
@@ -6570,7 +6855,7 @@ async function updatePhase(id, phase, options2) {
|
|
|
6570
6855
|
const { item, orm, itemId, phaseIdx } = found;
|
|
6571
6856
|
const resolved = resolvePhaseFields(options2, item.plan?.[phaseIdx]);
|
|
6572
6857
|
if (!resolved.ok) {
|
|
6573
|
-
console.log(
|
|
6858
|
+
console.log(chalk77.red(resolved.error));
|
|
6574
6859
|
process.exitCode = 1;
|
|
6575
6860
|
return;
|
|
6576
6861
|
}
|
|
@@ -6582,7 +6867,7 @@ async function updatePhase(id, phase, options2) {
|
|
|
6582
6867
|
manualCheck && "manual checks"
|
|
6583
6868
|
].filter(Boolean).join(", ");
|
|
6584
6869
|
console.log(
|
|
6585
|
-
|
|
6870
|
+
chalk77.green(
|
|
6586
6871
|
`Updated ${fields} on phase ${phaseIdx + 1} of item #${itemId}.`
|
|
6587
6872
|
)
|
|
6588
6873
|
);
|
|
@@ -7292,11 +7577,11 @@ function assertCliExists(cli) {
|
|
|
7292
7577
|
}
|
|
7293
7578
|
|
|
7294
7579
|
// src/commands/permitCliReads/colorize.ts
|
|
7295
|
-
import
|
|
7580
|
+
import chalk78 from "chalk";
|
|
7296
7581
|
function colorize(plainOutput) {
|
|
7297
7582
|
return plainOutput.split("\n").map((line) => {
|
|
7298
|
-
if (line.startsWith(" R ")) return
|
|
7299
|
-
if (line.startsWith(" W ")) return
|
|
7583
|
+
if (line.startsWith(" R ")) return chalk78.green(line);
|
|
7584
|
+
if (line.startsWith(" W ")) return chalk78.red(line);
|
|
7300
7585
|
return line;
|
|
7301
7586
|
}).join("\n");
|
|
7302
7587
|
}
|
|
@@ -7594,7 +7879,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
7594
7879
|
}
|
|
7595
7880
|
|
|
7596
7881
|
// src/commands/deny/denyAdd.ts
|
|
7597
|
-
import
|
|
7882
|
+
import chalk79 from "chalk";
|
|
7598
7883
|
|
|
7599
7884
|
// src/commands/deny/loadDenyConfig.ts
|
|
7600
7885
|
function loadDenyConfig(global) {
|
|
@@ -7614,16 +7899,16 @@ function loadDenyConfig(global) {
|
|
|
7614
7899
|
function denyAdd(pattern2, message, options2) {
|
|
7615
7900
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
7616
7901
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
7617
|
-
console.log(
|
|
7902
|
+
console.log(chalk79.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
7618
7903
|
return;
|
|
7619
7904
|
}
|
|
7620
7905
|
deny.push({ pattern: pattern2, message });
|
|
7621
7906
|
saveDeny(deny);
|
|
7622
|
-
console.log(
|
|
7907
|
+
console.log(chalk79.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
7623
7908
|
}
|
|
7624
7909
|
|
|
7625
7910
|
// src/commands/deny/denyList.ts
|
|
7626
|
-
import
|
|
7911
|
+
import chalk80 from "chalk";
|
|
7627
7912
|
function denyList() {
|
|
7628
7913
|
const globalRaw = loadGlobalConfigRaw();
|
|
7629
7914
|
const projectRaw = loadProjectConfig();
|
|
@@ -7634,7 +7919,7 @@ function denyList() {
|
|
|
7634
7919
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
7635
7920
|
);
|
|
7636
7921
|
if (!merged || merged.length === 0) {
|
|
7637
|
-
console.log(
|
|
7922
|
+
console.log(chalk80.dim("No deny rules configured."));
|
|
7638
7923
|
return;
|
|
7639
7924
|
}
|
|
7640
7925
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -7642,23 +7927,23 @@ function denyList() {
|
|
|
7642
7927
|
for (const rule of merged) {
|
|
7643
7928
|
const inProject = projectPatterns.has(rule.pattern);
|
|
7644
7929
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
7645
|
-
const label2 = inProject && inGlobal ?
|
|
7646
|
-
console.log(`${
|
|
7930
|
+
const label2 = inProject && inGlobal ? chalk80.dim(" (project, overrides global)") : inGlobal ? chalk80.dim(" (global)") : "";
|
|
7931
|
+
console.log(`${chalk80.red(rule.pattern)} \u2192 ${rule.message}${label2}`);
|
|
7647
7932
|
}
|
|
7648
7933
|
}
|
|
7649
7934
|
|
|
7650
7935
|
// src/commands/deny/denyRemove.ts
|
|
7651
|
-
import
|
|
7936
|
+
import chalk81 from "chalk";
|
|
7652
7937
|
function denyRemove(pattern2, options2) {
|
|
7653
7938
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
7654
7939
|
const index2 = deny.findIndex((r) => r.pattern === pattern2);
|
|
7655
7940
|
if (index2 === -1) {
|
|
7656
|
-
console.log(
|
|
7941
|
+
console.log(chalk81.yellow(`No deny rule found for: ${pattern2}`));
|
|
7657
7942
|
return;
|
|
7658
7943
|
}
|
|
7659
7944
|
deny.splice(index2, 1);
|
|
7660
7945
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
7661
|
-
console.log(
|
|
7946
|
+
console.log(chalk81.green(`Removed deny rule: ${pattern2}`));
|
|
7662
7947
|
}
|
|
7663
7948
|
|
|
7664
7949
|
// src/commands/registerDeny.ts
|
|
@@ -7687,15 +7972,15 @@ function registerCliHook(program2) {
|
|
|
7687
7972
|
}
|
|
7688
7973
|
|
|
7689
7974
|
// src/commands/complexity/analyze.ts
|
|
7690
|
-
import
|
|
7975
|
+
import chalk88 from "chalk";
|
|
7691
7976
|
|
|
7692
7977
|
// src/commands/complexity/cyclomatic.ts
|
|
7693
|
-
import
|
|
7978
|
+
import chalk83 from "chalk";
|
|
7694
7979
|
|
|
7695
7980
|
// src/commands/complexity/shared/index.ts
|
|
7696
7981
|
import fs13 from "fs";
|
|
7697
7982
|
import path19 from "path";
|
|
7698
|
-
import
|
|
7983
|
+
import chalk82 from "chalk";
|
|
7699
7984
|
import ts5 from "typescript";
|
|
7700
7985
|
|
|
7701
7986
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -7946,7 +8231,7 @@ function createSourceFromFile(filePath) {
|
|
|
7946
8231
|
function withSourceFiles(pattern2, callback, extraIgnore = []) {
|
|
7947
8232
|
const files = findSourceFiles2(pattern2, ".", extraIgnore);
|
|
7948
8233
|
if (files.length === 0) {
|
|
7949
|
-
console.log(
|
|
8234
|
+
console.log(chalk82.yellow("No files found matching pattern"));
|
|
7950
8235
|
return void 0;
|
|
7951
8236
|
}
|
|
7952
8237
|
return callback(files);
|
|
@@ -7979,11 +8264,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
7979
8264
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
7980
8265
|
for (const { file, name, complexity } of results) {
|
|
7981
8266
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
7982
|
-
const color = exceedsThreshold ?
|
|
7983
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
8267
|
+
const color = exceedsThreshold ? chalk83.red : chalk83.white;
|
|
8268
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk83.cyan(complexity)}`);
|
|
7984
8269
|
}
|
|
7985
8270
|
console.log(
|
|
7986
|
-
|
|
8271
|
+
chalk83.dim(
|
|
7987
8272
|
`
|
|
7988
8273
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
7989
8274
|
)
|
|
@@ -7995,7 +8280,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
7995
8280
|
}
|
|
7996
8281
|
|
|
7997
8282
|
// src/commands/complexity/halstead.ts
|
|
7998
|
-
import
|
|
8283
|
+
import chalk84 from "chalk";
|
|
7999
8284
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
8000
8285
|
withSourceFiles(pattern2, (files) => {
|
|
8001
8286
|
const results = [];
|
|
@@ -8010,13 +8295,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
8010
8295
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
8011
8296
|
for (const { file, name, metrics } of results) {
|
|
8012
8297
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
8013
|
-
const color = exceedsThreshold ?
|
|
8298
|
+
const color = exceedsThreshold ? chalk84.red : chalk84.white;
|
|
8014
8299
|
console.log(
|
|
8015
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
8300
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk84.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk84.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk84.magenta(metrics.effort.toFixed(1))}`
|
|
8016
8301
|
);
|
|
8017
8302
|
}
|
|
8018
8303
|
console.log(
|
|
8019
|
-
|
|
8304
|
+
chalk84.dim(
|
|
8020
8305
|
`
|
|
8021
8306
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
8022
8307
|
)
|
|
@@ -8040,28 +8325,28 @@ function calculateMaintainabilityIndex(halsteadVolume, cyclomaticComplexity, slo
|
|
|
8040
8325
|
}
|
|
8041
8326
|
|
|
8042
8327
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
8043
|
-
import
|
|
8328
|
+
import chalk85 from "chalk";
|
|
8044
8329
|
function displayMaintainabilityResults(results, threshold) {
|
|
8045
8330
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
8046
8331
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
8047
|
-
console.log(
|
|
8332
|
+
console.log(chalk85.green("All files pass maintainability threshold"));
|
|
8048
8333
|
} else {
|
|
8049
8334
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
8050
|
-
const color = threshold !== void 0 ?
|
|
8335
|
+
const color = threshold !== void 0 ? chalk85.red : chalk85.white;
|
|
8051
8336
|
console.log(
|
|
8052
|
-
`${color(file)} \u2192 avg: ${
|
|
8337
|
+
`${color(file)} \u2192 avg: ${chalk85.cyan(avgMaintainability.toFixed(1))}, min: ${chalk85.yellow(minMaintainability.toFixed(1))}`
|
|
8053
8338
|
);
|
|
8054
8339
|
}
|
|
8055
8340
|
}
|
|
8056
|
-
console.log(
|
|
8341
|
+
console.log(chalk85.dim(`
|
|
8057
8342
|
Analyzed ${results.length} files`));
|
|
8058
8343
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
8059
8344
|
console.error(
|
|
8060
|
-
|
|
8345
|
+
chalk85.red(
|
|
8061
8346
|
`
|
|
8062
8347
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
8063
8348
|
|
|
8064
|
-
\u26A0\uFE0F ${
|
|
8349
|
+
\u26A0\uFE0F ${chalk85.bold("Diagnose and fix one file at a time")} \u2014 do not investigate or fix multiple files in parallel. Run 'assist complexity <file>' to see all metrics. For larger files, start by extracting responsibilities into smaller files.`
|
|
8065
8350
|
)
|
|
8066
8351
|
);
|
|
8067
8352
|
process.exit(1);
|
|
@@ -8069,10 +8354,10 @@ Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability i
|
|
|
8069
8354
|
}
|
|
8070
8355
|
|
|
8071
8356
|
// src/commands/complexity/maintainability/printMaintainabilityFormula.ts
|
|
8072
|
-
import
|
|
8357
|
+
import chalk86 from "chalk";
|
|
8073
8358
|
var MI_FORMULA = "171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100";
|
|
8074
8359
|
function printMaintainabilityFormula() {
|
|
8075
|
-
console.log(
|
|
8360
|
+
console.log(chalk86.dim(MI_FORMULA));
|
|
8076
8361
|
}
|
|
8077
8362
|
|
|
8078
8363
|
// src/commands/complexity/maintainability/index.ts
|
|
@@ -8123,7 +8408,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
8123
8408
|
|
|
8124
8409
|
// src/commands/complexity/sloc.ts
|
|
8125
8410
|
import fs15 from "fs";
|
|
8126
|
-
import
|
|
8411
|
+
import chalk87 from "chalk";
|
|
8127
8412
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
8128
8413
|
withSourceFiles(pattern2, (files) => {
|
|
8129
8414
|
const results = [];
|
|
@@ -8139,12 +8424,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
8139
8424
|
results.sort((a, b) => b.lines - a.lines);
|
|
8140
8425
|
for (const { file, lines } of results) {
|
|
8141
8426
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
8142
|
-
const color = exceedsThreshold ?
|
|
8143
|
-
console.log(`${color(file)} \u2192 ${
|
|
8427
|
+
const color = exceedsThreshold ? chalk87.red : chalk87.white;
|
|
8428
|
+
console.log(`${color(file)} \u2192 ${chalk87.cyan(lines)} lines`);
|
|
8144
8429
|
}
|
|
8145
8430
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
8146
8431
|
console.log(
|
|
8147
|
-
|
|
8432
|
+
chalk87.dim(`
|
|
8148
8433
|
Total: ${total} lines across ${files.length} files`)
|
|
8149
8434
|
);
|
|
8150
8435
|
if (hasViolation) {
|
|
@@ -8158,21 +8443,21 @@ async function analyze(pattern2) {
|
|
|
8158
8443
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
8159
8444
|
const files = findSourceFiles2(searchPattern);
|
|
8160
8445
|
if (files.length === 0) {
|
|
8161
|
-
console.log(
|
|
8446
|
+
console.log(chalk88.yellow("No files found matching pattern"));
|
|
8162
8447
|
return;
|
|
8163
8448
|
}
|
|
8164
8449
|
if (files.length === 1) {
|
|
8165
8450
|
const file = files[0];
|
|
8166
|
-
console.log(
|
|
8451
|
+
console.log(chalk88.bold.underline("SLOC"));
|
|
8167
8452
|
await sloc(file);
|
|
8168
8453
|
console.log();
|
|
8169
|
-
console.log(
|
|
8454
|
+
console.log(chalk88.bold.underline("Cyclomatic Complexity"));
|
|
8170
8455
|
await cyclomatic(file);
|
|
8171
8456
|
console.log();
|
|
8172
|
-
console.log(
|
|
8457
|
+
console.log(chalk88.bold.underline("Halstead Metrics"));
|
|
8173
8458
|
await halstead(file);
|
|
8174
8459
|
console.log();
|
|
8175
|
-
console.log(
|
|
8460
|
+
console.log(chalk88.bold.underline("Maintainability Index"));
|
|
8176
8461
|
await maintainability(file);
|
|
8177
8462
|
return;
|
|
8178
8463
|
}
|
|
@@ -8204,7 +8489,7 @@ function registerComplexity(program2) {
|
|
|
8204
8489
|
}
|
|
8205
8490
|
|
|
8206
8491
|
// src/commands/config/index.ts
|
|
8207
|
-
import
|
|
8492
|
+
import chalk89 from "chalk";
|
|
8208
8493
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
8209
8494
|
|
|
8210
8495
|
// src/commands/config/setNestedValue.ts
|
|
@@ -8267,7 +8552,7 @@ function formatIssuePath(issue, key) {
|
|
|
8267
8552
|
function printValidationErrors(issues, key) {
|
|
8268
8553
|
for (const issue of issues) {
|
|
8269
8554
|
console.error(
|
|
8270
|
-
|
|
8555
|
+
chalk89.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
8271
8556
|
);
|
|
8272
8557
|
}
|
|
8273
8558
|
}
|
|
@@ -8284,7 +8569,7 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
8284
8569
|
function assertNotGlobalOnly(key, global) {
|
|
8285
8570
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
8286
8571
|
console.error(
|
|
8287
|
-
|
|
8572
|
+
chalk89.red(
|
|
8288
8573
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
8289
8574
|
)
|
|
8290
8575
|
);
|
|
@@ -8307,7 +8592,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
8307
8592
|
applyConfigSet(key, coerced, options2.global ?? false);
|
|
8308
8593
|
const target = options2.global ? "global" : "project";
|
|
8309
8594
|
console.log(
|
|
8310
|
-
|
|
8595
|
+
chalk89.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
8311
8596
|
);
|
|
8312
8597
|
}
|
|
8313
8598
|
function configList() {
|
|
@@ -8316,7 +8601,7 @@ function configList() {
|
|
|
8316
8601
|
}
|
|
8317
8602
|
|
|
8318
8603
|
// src/commands/config/configGet.ts
|
|
8319
|
-
import
|
|
8604
|
+
import chalk90 from "chalk";
|
|
8320
8605
|
|
|
8321
8606
|
// src/commands/config/getNestedValue.ts
|
|
8322
8607
|
function isTraversable(value) {
|
|
@@ -8348,7 +8633,7 @@ function requireNestedValue(config, key) {
|
|
|
8348
8633
|
return value;
|
|
8349
8634
|
}
|
|
8350
8635
|
function exitKeyNotSet(key) {
|
|
8351
|
-
console.error(
|
|
8636
|
+
console.error(chalk90.red(`Key "${key}" is not set`));
|
|
8352
8637
|
process.exit(1);
|
|
8353
8638
|
}
|
|
8354
8639
|
|
|
@@ -8362,7 +8647,7 @@ function registerConfig(program2) {
|
|
|
8362
8647
|
|
|
8363
8648
|
// src/commands/deploy/redirect.ts
|
|
8364
8649
|
import { existsSync as existsSync25, readFileSync as readFileSync19, writeFileSync as writeFileSync18 } from "fs";
|
|
8365
|
-
import
|
|
8650
|
+
import chalk91 from "chalk";
|
|
8366
8651
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
8367
8652
|
if (!window.location.pathname.endsWith('/')) {
|
|
8368
8653
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -8371,22 +8656,22 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
8371
8656
|
function redirect() {
|
|
8372
8657
|
const indexPath = "index.html";
|
|
8373
8658
|
if (!existsSync25(indexPath)) {
|
|
8374
|
-
console.log(
|
|
8659
|
+
console.log(chalk91.yellow("No index.html found"));
|
|
8375
8660
|
return;
|
|
8376
8661
|
}
|
|
8377
8662
|
const content = readFileSync19(indexPath, "utf-8");
|
|
8378
8663
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
8379
|
-
console.log(
|
|
8664
|
+
console.log(chalk91.dim("Trailing slash script already present"));
|
|
8380
8665
|
return;
|
|
8381
8666
|
}
|
|
8382
8667
|
const headCloseIndex = content.indexOf("</head>");
|
|
8383
8668
|
if (headCloseIndex === -1) {
|
|
8384
|
-
console.log(
|
|
8669
|
+
console.log(chalk91.red("Could not find </head> tag in index.html"));
|
|
8385
8670
|
return;
|
|
8386
8671
|
}
|
|
8387
8672
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
8388
8673
|
writeFileSync18(indexPath, newContent);
|
|
8389
|
-
console.log(
|
|
8674
|
+
console.log(chalk91.green("Added trailing slash redirect to index.html"));
|
|
8390
8675
|
}
|
|
8391
8676
|
|
|
8392
8677
|
// src/commands/registerDeploy.ts
|
|
@@ -8413,7 +8698,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
8413
8698
|
|
|
8414
8699
|
// src/commands/devlog/shared.ts
|
|
8415
8700
|
import { execSync as execSync23 } from "child_process";
|
|
8416
|
-
import
|
|
8701
|
+
import chalk92 from "chalk";
|
|
8417
8702
|
|
|
8418
8703
|
// src/shared/getRepoName.ts
|
|
8419
8704
|
import { existsSync as existsSync26, readFileSync as readFileSync20 } from "fs";
|
|
@@ -8522,13 +8807,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
8522
8807
|
}
|
|
8523
8808
|
function printCommitsWithFiles(commits2, ignore2, verbose) {
|
|
8524
8809
|
for (const commit2 of commits2) {
|
|
8525
|
-
console.log(` ${
|
|
8810
|
+
console.log(` ${chalk92.yellow(commit2.hash)} ${commit2.message}`);
|
|
8526
8811
|
if (verbose) {
|
|
8527
8812
|
const visibleFiles = commit2.files.filter(
|
|
8528
8813
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
8529
8814
|
);
|
|
8530
8815
|
for (const file of visibleFiles) {
|
|
8531
|
-
console.log(` ${
|
|
8816
|
+
console.log(` ${chalk92.dim(file)}`);
|
|
8532
8817
|
}
|
|
8533
8818
|
}
|
|
8534
8819
|
}
|
|
@@ -8553,15 +8838,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
8553
8838
|
}
|
|
8554
8839
|
|
|
8555
8840
|
// src/commands/devlog/list/printDateHeader.ts
|
|
8556
|
-
import
|
|
8841
|
+
import chalk93 from "chalk";
|
|
8557
8842
|
function printDateHeader(date, isSkipped, entries) {
|
|
8558
8843
|
if (isSkipped) {
|
|
8559
|
-
console.log(`${
|
|
8844
|
+
console.log(`${chalk93.bold.blue(date)} ${chalk93.dim("skipped")}`);
|
|
8560
8845
|
} else if (entries && entries.length > 0) {
|
|
8561
|
-
const entryInfo = entries.map((e) => `${
|
|
8562
|
-
console.log(`${
|
|
8846
|
+
const entryInfo = entries.map((e) => `${chalk93.green(e.version)} ${e.title}`).join(" | ");
|
|
8847
|
+
console.log(`${chalk93.bold.blue(date)} ${entryInfo}`);
|
|
8563
8848
|
} else {
|
|
8564
|
-
console.log(`${
|
|
8849
|
+
console.log(`${chalk93.bold.blue(date)} ${chalk93.red("\u26A0 devlog missing")}`);
|
|
8565
8850
|
}
|
|
8566
8851
|
}
|
|
8567
8852
|
|
|
@@ -8665,24 +8950,24 @@ function bumpVersion(version2, type) {
|
|
|
8665
8950
|
|
|
8666
8951
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
8667
8952
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
8668
|
-
import
|
|
8953
|
+
import chalk95 from "chalk";
|
|
8669
8954
|
|
|
8670
8955
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
8671
|
-
import
|
|
8956
|
+
import chalk94 from "chalk";
|
|
8672
8957
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
8673
8958
|
if (conventional && firstHash) {
|
|
8674
8959
|
const version2 = getVersionAtCommit(firstHash);
|
|
8675
8960
|
if (version2) {
|
|
8676
|
-
console.log(`${
|
|
8961
|
+
console.log(`${chalk94.bold("version:")} ${stripToMinor(version2)}`);
|
|
8677
8962
|
} else {
|
|
8678
|
-
console.log(`${
|
|
8963
|
+
console.log(`${chalk94.bold("version:")} ${chalk94.red("unknown")}`);
|
|
8679
8964
|
}
|
|
8680
8965
|
} else if (patchVersion && minorVersion) {
|
|
8681
8966
|
console.log(
|
|
8682
|
-
`${
|
|
8967
|
+
`${chalk94.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
8683
8968
|
);
|
|
8684
8969
|
} else {
|
|
8685
|
-
console.log(`${
|
|
8970
|
+
console.log(`${chalk94.bold("version:")} v0.1 (initial)`);
|
|
8686
8971
|
}
|
|
8687
8972
|
}
|
|
8688
8973
|
|
|
@@ -8730,16 +9015,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
8730
9015
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
8731
9016
|
}
|
|
8732
9017
|
function logName(repoName) {
|
|
8733
|
-
console.log(`${
|
|
9018
|
+
console.log(`${chalk95.bold("name:")} ${repoName}`);
|
|
8734
9019
|
}
|
|
8735
9020
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
8736
9021
|
logName(ctx.repoName);
|
|
8737
9022
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
8738
|
-
console.log(
|
|
9023
|
+
console.log(chalk95.bold.blue(targetDate));
|
|
8739
9024
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
8740
9025
|
}
|
|
8741
9026
|
function logNoCommits(lastInfo) {
|
|
8742
|
-
console.log(
|
|
9027
|
+
console.log(chalk95.dim(noCommitsMessage(!!lastInfo)));
|
|
8743
9028
|
}
|
|
8744
9029
|
|
|
8745
9030
|
// src/commands/devlog/next/index.ts
|
|
@@ -8780,11 +9065,11 @@ function next2(options2) {
|
|
|
8780
9065
|
import { execSync as execSync25 } from "child_process";
|
|
8781
9066
|
|
|
8782
9067
|
// src/commands/devlog/repos/printReposTable.ts
|
|
8783
|
-
import
|
|
9068
|
+
import chalk96 from "chalk";
|
|
8784
9069
|
function colorStatus(status2) {
|
|
8785
|
-
if (status2 === "missing") return
|
|
8786
|
-
if (status2 === "outdated") return
|
|
8787
|
-
return
|
|
9070
|
+
if (status2 === "missing") return chalk96.red(status2);
|
|
9071
|
+
if (status2 === "outdated") return chalk96.yellow(status2);
|
|
9072
|
+
return chalk96.green(status2);
|
|
8788
9073
|
}
|
|
8789
9074
|
function formatRow(row, nameWidth) {
|
|
8790
9075
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -8798,8 +9083,8 @@ function printReposTable(rows) {
|
|
|
8798
9083
|
"Last Devlog".padEnd(11),
|
|
8799
9084
|
"Status"
|
|
8800
9085
|
].join(" ");
|
|
8801
|
-
console.log(
|
|
8802
|
-
console.log(
|
|
9086
|
+
console.log(chalk96.dim(header));
|
|
9087
|
+
console.log(chalk96.dim("-".repeat(header.length)));
|
|
8803
9088
|
for (const row of rows) {
|
|
8804
9089
|
console.log(formatRow(row, nameWidth));
|
|
8805
9090
|
}
|
|
@@ -8857,14 +9142,14 @@ function repos(options2) {
|
|
|
8857
9142
|
// src/commands/devlog/skip.ts
|
|
8858
9143
|
import { writeFileSync as writeFileSync19 } from "fs";
|
|
8859
9144
|
import { join as join26 } from "path";
|
|
8860
|
-
import
|
|
9145
|
+
import chalk97 from "chalk";
|
|
8861
9146
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
8862
9147
|
function getBlogConfigPath() {
|
|
8863
9148
|
return join26(BLOG_REPO_ROOT, "assist.yml");
|
|
8864
9149
|
}
|
|
8865
9150
|
function skip(date) {
|
|
8866
9151
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
8867
|
-
console.log(
|
|
9152
|
+
console.log(chalk97.red("Invalid date format. Use YYYY-MM-DD"));
|
|
8868
9153
|
process.exit(1);
|
|
8869
9154
|
}
|
|
8870
9155
|
const repoName = getRepoName();
|
|
@@ -8875,7 +9160,7 @@ function skip(date) {
|
|
|
8875
9160
|
const skipDays = skip2[repoName] ?? [];
|
|
8876
9161
|
if (skipDays.includes(date)) {
|
|
8877
9162
|
console.log(
|
|
8878
|
-
|
|
9163
|
+
chalk97.yellow(`${date} is already in skip list for ${repoName}`)
|
|
8879
9164
|
);
|
|
8880
9165
|
return;
|
|
8881
9166
|
}
|
|
@@ -8885,20 +9170,20 @@ function skip(date) {
|
|
|
8885
9170
|
devlog.skip = skip2;
|
|
8886
9171
|
config.devlog = devlog;
|
|
8887
9172
|
writeFileSync19(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
8888
|
-
console.log(
|
|
9173
|
+
console.log(chalk97.green(`Added ${date} to skip list for ${repoName}`));
|
|
8889
9174
|
}
|
|
8890
9175
|
|
|
8891
9176
|
// src/commands/devlog/version.ts
|
|
8892
|
-
import
|
|
9177
|
+
import chalk98 from "chalk";
|
|
8893
9178
|
function version() {
|
|
8894
9179
|
const config = loadConfig();
|
|
8895
9180
|
const name = getRepoName();
|
|
8896
9181
|
const lastInfo = getLastVersionInfo(name, config);
|
|
8897
9182
|
const lastVersion = lastInfo?.version ?? null;
|
|
8898
9183
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
8899
|
-
console.log(`${
|
|
8900
|
-
console.log(`${
|
|
8901
|
-
console.log(`${
|
|
9184
|
+
console.log(`${chalk98.bold("name:")} ${name}`);
|
|
9185
|
+
console.log(`${chalk98.bold("last:")} ${lastVersion ?? chalk98.dim("none")}`);
|
|
9186
|
+
console.log(`${chalk98.bold("next:")} ${nextVersion ?? chalk98.dim("none")}`);
|
|
8902
9187
|
}
|
|
8903
9188
|
|
|
8904
9189
|
// src/commands/registerDevlog.ts
|
|
@@ -8922,7 +9207,7 @@ function registerDevlog(program2) {
|
|
|
8922
9207
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
8923
9208
|
import { closeSync as closeSync2, openSync as openSync2, readdirSync as readdirSync2 } from "fs";
|
|
8924
9209
|
import { join as join27 } from "path";
|
|
8925
|
-
import
|
|
9210
|
+
import chalk99 from "chalk";
|
|
8926
9211
|
|
|
8927
9212
|
// src/shared/findRepoRoot.ts
|
|
8928
9213
|
import { existsSync as existsSync27 } from "fs";
|
|
@@ -8985,14 +9270,14 @@ function checkBuildLocks(startDir) {
|
|
|
8985
9270
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
8986
9271
|
if (locked) {
|
|
8987
9272
|
console.error(
|
|
8988
|
-
|
|
9273
|
+
chalk99.red("Build output locked (is VS debugging?): ") + locked
|
|
8989
9274
|
);
|
|
8990
9275
|
process.exit(1);
|
|
8991
9276
|
}
|
|
8992
9277
|
}
|
|
8993
9278
|
async function checkBuildLocksCommand() {
|
|
8994
9279
|
checkBuildLocks();
|
|
8995
|
-
console.log(
|
|
9280
|
+
console.log(chalk99.green("No build locks detected"));
|
|
8996
9281
|
}
|
|
8997
9282
|
|
|
8998
9283
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -9091,30 +9376,30 @@ function escapeRegex(s) {
|
|
|
9091
9376
|
}
|
|
9092
9377
|
|
|
9093
9378
|
// src/commands/dotnet/printTree.ts
|
|
9094
|
-
import
|
|
9379
|
+
import chalk100 from "chalk";
|
|
9095
9380
|
function printNodes(nodes, prefix2) {
|
|
9096
9381
|
for (let i = 0; i < nodes.length; i++) {
|
|
9097
9382
|
const isLast = i === nodes.length - 1;
|
|
9098
9383
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
9099
9384
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
9100
9385
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
9101
|
-
const label2 = isMissing ?
|
|
9386
|
+
const label2 = isMissing ? chalk100.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
9102
9387
|
console.log(`${prefix2}${connector}${label2}`);
|
|
9103
9388
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
9104
9389
|
}
|
|
9105
9390
|
}
|
|
9106
9391
|
function printTree(tree, totalCount, solutions) {
|
|
9107
|
-
console.log(
|
|
9108
|
-
console.log(
|
|
9392
|
+
console.log(chalk100.bold("\nProject Dependency Tree"));
|
|
9393
|
+
console.log(chalk100.cyan(tree.relativePath));
|
|
9109
9394
|
printNodes(tree.children, "");
|
|
9110
|
-
console.log(
|
|
9395
|
+
console.log(chalk100.dim(`
|
|
9111
9396
|
${totalCount} projects total (including root)`));
|
|
9112
|
-
console.log(
|
|
9397
|
+
console.log(chalk100.bold("\nSolution Membership"));
|
|
9113
9398
|
if (solutions.length === 0) {
|
|
9114
|
-
console.log(
|
|
9399
|
+
console.log(chalk100.yellow(" Not found in any .sln"));
|
|
9115
9400
|
} else {
|
|
9116
9401
|
for (const sln of solutions) {
|
|
9117
|
-
console.log(` ${
|
|
9402
|
+
console.log(` ${chalk100.green(sln)}`);
|
|
9118
9403
|
}
|
|
9119
9404
|
}
|
|
9120
9405
|
console.log();
|
|
@@ -9143,16 +9428,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
9143
9428
|
// src/commands/dotnet/resolveCsproj.ts
|
|
9144
9429
|
import { existsSync as existsSync28 } from "fs";
|
|
9145
9430
|
import path23 from "path";
|
|
9146
|
-
import
|
|
9431
|
+
import chalk101 from "chalk";
|
|
9147
9432
|
function resolveCsproj(csprojPath) {
|
|
9148
9433
|
const resolved = path23.resolve(csprojPath);
|
|
9149
9434
|
if (!existsSync28(resolved)) {
|
|
9150
|
-
console.error(
|
|
9435
|
+
console.error(chalk101.red(`File not found: ${resolved}`));
|
|
9151
9436
|
process.exit(1);
|
|
9152
9437
|
}
|
|
9153
9438
|
const repoRoot = findRepoRoot(path23.dirname(resolved));
|
|
9154
9439
|
if (!repoRoot) {
|
|
9155
|
-
console.error(
|
|
9440
|
+
console.error(chalk101.red("Could not find git repository root"));
|
|
9156
9441
|
process.exit(1);
|
|
9157
9442
|
}
|
|
9158
9443
|
return { resolved, repoRoot };
|
|
@@ -9202,12 +9487,12 @@ function getChangedCsFiles(scope) {
|
|
|
9202
9487
|
}
|
|
9203
9488
|
|
|
9204
9489
|
// src/commands/dotnet/inSln.ts
|
|
9205
|
-
import
|
|
9490
|
+
import chalk102 from "chalk";
|
|
9206
9491
|
async function inSln(csprojPath) {
|
|
9207
9492
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
9208
9493
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
9209
9494
|
if (solutions.length === 0) {
|
|
9210
|
-
console.log(
|
|
9495
|
+
console.log(chalk102.yellow("Not found in any .sln file"));
|
|
9211
9496
|
process.exit(1);
|
|
9212
9497
|
}
|
|
9213
9498
|
for (const sln of solutions) {
|
|
@@ -9216,7 +9501,7 @@ async function inSln(csprojPath) {
|
|
|
9216
9501
|
}
|
|
9217
9502
|
|
|
9218
9503
|
// src/commands/dotnet/inspect.ts
|
|
9219
|
-
import
|
|
9504
|
+
import chalk108 from "chalk";
|
|
9220
9505
|
|
|
9221
9506
|
// src/shared/formatElapsed.ts
|
|
9222
9507
|
function formatElapsed(ms) {
|
|
@@ -9228,12 +9513,12 @@ function formatElapsed(ms) {
|
|
|
9228
9513
|
}
|
|
9229
9514
|
|
|
9230
9515
|
// src/commands/dotnet/displayIssues.ts
|
|
9231
|
-
import
|
|
9516
|
+
import chalk103 from "chalk";
|
|
9232
9517
|
var SEVERITY_COLOR = {
|
|
9233
|
-
ERROR:
|
|
9234
|
-
WARNING:
|
|
9235
|
-
SUGGESTION:
|
|
9236
|
-
HINT:
|
|
9518
|
+
ERROR: chalk103.red,
|
|
9519
|
+
WARNING: chalk103.yellow,
|
|
9520
|
+
SUGGESTION: chalk103.cyan,
|
|
9521
|
+
HINT: chalk103.dim
|
|
9237
9522
|
};
|
|
9238
9523
|
function groupByFile(issues) {
|
|
9239
9524
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -9249,15 +9534,15 @@ function groupByFile(issues) {
|
|
|
9249
9534
|
}
|
|
9250
9535
|
function displayIssues(issues) {
|
|
9251
9536
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
9252
|
-
console.log(
|
|
9537
|
+
console.log(chalk103.bold(file));
|
|
9253
9538
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
9254
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
9539
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk103.white;
|
|
9255
9540
|
console.log(
|
|
9256
|
-
` ${
|
|
9541
|
+
` ${chalk103.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
9257
9542
|
);
|
|
9258
9543
|
}
|
|
9259
9544
|
}
|
|
9260
|
-
console.log(
|
|
9545
|
+
console.log(chalk103.dim(`
|
|
9261
9546
|
${issues.length} issue(s) found`));
|
|
9262
9547
|
}
|
|
9263
9548
|
|
|
@@ -9316,12 +9601,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
9316
9601
|
// src/commands/dotnet/resolveSolution.ts
|
|
9317
9602
|
import { existsSync as existsSync29 } from "fs";
|
|
9318
9603
|
import path24 from "path";
|
|
9319
|
-
import
|
|
9604
|
+
import chalk105 from "chalk";
|
|
9320
9605
|
|
|
9321
9606
|
// src/commands/dotnet/findSolution.ts
|
|
9322
9607
|
import { readdirSync as readdirSync4 } from "fs";
|
|
9323
9608
|
import { dirname as dirname18, join as join28 } from "path";
|
|
9324
|
-
import
|
|
9609
|
+
import chalk104 from "chalk";
|
|
9325
9610
|
function findSlnInDir(dir) {
|
|
9326
9611
|
try {
|
|
9327
9612
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join28(dir, f));
|
|
@@ -9337,17 +9622,17 @@ function findSolution() {
|
|
|
9337
9622
|
const slnFiles = findSlnInDir(current);
|
|
9338
9623
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
9339
9624
|
if (slnFiles.length > 1) {
|
|
9340
|
-
console.error(
|
|
9625
|
+
console.error(chalk104.red(`Multiple .sln files found in ${current}:`));
|
|
9341
9626
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
9342
9627
|
console.error(
|
|
9343
|
-
|
|
9628
|
+
chalk104.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
9344
9629
|
);
|
|
9345
9630
|
process.exit(1);
|
|
9346
9631
|
}
|
|
9347
9632
|
if (current === ceiling) break;
|
|
9348
9633
|
current = dirname18(current);
|
|
9349
9634
|
}
|
|
9350
|
-
console.error(
|
|
9635
|
+
console.error(chalk104.red("No .sln file found between cwd and repo root"));
|
|
9351
9636
|
process.exit(1);
|
|
9352
9637
|
}
|
|
9353
9638
|
|
|
@@ -9356,7 +9641,7 @@ function resolveSolution(sln) {
|
|
|
9356
9641
|
if (sln) {
|
|
9357
9642
|
const resolved = path24.resolve(sln);
|
|
9358
9643
|
if (!existsSync29(resolved)) {
|
|
9359
|
-
console.error(
|
|
9644
|
+
console.error(chalk105.red(`Solution file not found: ${resolved}`));
|
|
9360
9645
|
process.exit(1);
|
|
9361
9646
|
}
|
|
9362
9647
|
return resolved;
|
|
@@ -9398,14 +9683,14 @@ import { execSync as execSync27 } from "child_process";
|
|
|
9398
9683
|
import { existsSync as existsSync30, readFileSync as readFileSync24, unlinkSync as unlinkSync7 } from "fs";
|
|
9399
9684
|
import { tmpdir as tmpdir3 } from "os";
|
|
9400
9685
|
import path25 from "path";
|
|
9401
|
-
import
|
|
9686
|
+
import chalk106 from "chalk";
|
|
9402
9687
|
function assertJbInstalled() {
|
|
9403
9688
|
try {
|
|
9404
9689
|
execSync27("jb inspectcode --version", { stdio: "pipe" });
|
|
9405
9690
|
} catch {
|
|
9406
|
-
console.error(
|
|
9691
|
+
console.error(chalk106.red("jb is not installed. Install with:"));
|
|
9407
9692
|
console.error(
|
|
9408
|
-
|
|
9693
|
+
chalk106.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
9409
9694
|
);
|
|
9410
9695
|
process.exit(1);
|
|
9411
9696
|
}
|
|
@@ -9423,11 +9708,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
9423
9708
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
9424
9709
|
process.stderr.write(err.stderr);
|
|
9425
9710
|
}
|
|
9426
|
-
console.error(
|
|
9711
|
+
console.error(chalk106.red("jb inspectcode failed"));
|
|
9427
9712
|
process.exit(1);
|
|
9428
9713
|
}
|
|
9429
9714
|
if (!existsSync30(reportPath)) {
|
|
9430
|
-
console.error(
|
|
9715
|
+
console.error(chalk106.red("Report file not generated"));
|
|
9431
9716
|
process.exit(1);
|
|
9432
9717
|
}
|
|
9433
9718
|
const xml = readFileSync24(reportPath, "utf-8");
|
|
@@ -9437,7 +9722,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
9437
9722
|
|
|
9438
9723
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
9439
9724
|
import { execSync as execSync28 } from "child_process";
|
|
9440
|
-
import
|
|
9725
|
+
import chalk107 from "chalk";
|
|
9441
9726
|
function resolveMsbuildPath() {
|
|
9442
9727
|
const { run: run4 } = loadConfig();
|
|
9443
9728
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -9449,9 +9734,9 @@ function assertMsbuildInstalled() {
|
|
|
9449
9734
|
try {
|
|
9450
9735
|
execSync28(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
9451
9736
|
} catch {
|
|
9452
|
-
console.error(
|
|
9737
|
+
console.error(chalk107.red(`msbuild not found at: ${msbuild}`));
|
|
9453
9738
|
console.error(
|
|
9454
|
-
|
|
9739
|
+
chalk107.yellow(
|
|
9455
9740
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
9456
9741
|
)
|
|
9457
9742
|
);
|
|
@@ -9498,17 +9783,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
9498
9783
|
// src/commands/dotnet/inspect.ts
|
|
9499
9784
|
function logScope(changedFiles) {
|
|
9500
9785
|
if (changedFiles === null) {
|
|
9501
|
-
console.log(
|
|
9786
|
+
console.log(chalk108.dim("Inspecting full solution..."));
|
|
9502
9787
|
} else {
|
|
9503
9788
|
console.log(
|
|
9504
|
-
|
|
9789
|
+
chalk108.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
9505
9790
|
);
|
|
9506
9791
|
}
|
|
9507
9792
|
}
|
|
9508
9793
|
function reportResults(issues, elapsed) {
|
|
9509
9794
|
if (issues.length > 0) displayIssues(issues);
|
|
9510
|
-
else console.log(
|
|
9511
|
-
console.log(
|
|
9795
|
+
else console.log(chalk108.green("No issues found"));
|
|
9796
|
+
console.log(chalk108.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
9512
9797
|
if (issues.length > 0) process.exit(1);
|
|
9513
9798
|
}
|
|
9514
9799
|
async function inspect(sln, options2) {
|
|
@@ -9519,7 +9804,7 @@ async function inspect(sln, options2) {
|
|
|
9519
9804
|
const scope = parseScope(options2.scope);
|
|
9520
9805
|
const changedFiles = getChangedCsFiles(scope);
|
|
9521
9806
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
9522
|
-
console.log(
|
|
9807
|
+
console.log(chalk108.green("No changed .cs files found"));
|
|
9523
9808
|
return;
|
|
9524
9809
|
}
|
|
9525
9810
|
logScope(changedFiles);
|
|
@@ -9648,25 +9933,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
9648
9933
|
}
|
|
9649
9934
|
|
|
9650
9935
|
// src/commands/github/printCountTable.ts
|
|
9651
|
-
import
|
|
9936
|
+
import chalk109 from "chalk";
|
|
9652
9937
|
function printCountTable(labelHeader, rows) {
|
|
9653
9938
|
const labelWidth = Math.max(
|
|
9654
9939
|
labelHeader.length,
|
|
9655
9940
|
...rows.map((row) => row.label.length)
|
|
9656
9941
|
);
|
|
9657
9942
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
9658
|
-
console.log(
|
|
9659
|
-
console.log(
|
|
9943
|
+
console.log(chalk109.dim(header));
|
|
9944
|
+
console.log(chalk109.dim("-".repeat(header.length)));
|
|
9660
9945
|
for (const row of rows) {
|
|
9661
9946
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
9662
9947
|
}
|
|
9663
9948
|
}
|
|
9664
9949
|
|
|
9665
9950
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
9666
|
-
import
|
|
9951
|
+
import chalk110 from "chalk";
|
|
9667
9952
|
function printRepoAuthorBreakdown(repos2) {
|
|
9668
9953
|
for (const repo of repos2) {
|
|
9669
|
-
console.log(
|
|
9954
|
+
console.log(chalk110.bold(repo.name));
|
|
9670
9955
|
const authorWidth = Math.max(
|
|
9671
9956
|
0,
|
|
9672
9957
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -9991,7 +10276,7 @@ function registerHandover(program2) {
|
|
|
9991
10276
|
}
|
|
9992
10277
|
|
|
9993
10278
|
// src/commands/jira/acceptanceCriteria.ts
|
|
9994
|
-
import
|
|
10279
|
+
import chalk112 from "chalk";
|
|
9995
10280
|
|
|
9996
10281
|
// src/commands/jira/adfToText.ts
|
|
9997
10282
|
function renderInline(node) {
|
|
@@ -10052,7 +10337,7 @@ function adfToText(doc) {
|
|
|
10052
10337
|
|
|
10053
10338
|
// src/commands/jira/fetchIssue.ts
|
|
10054
10339
|
import { execSync as execSync29 } from "child_process";
|
|
10055
|
-
import
|
|
10340
|
+
import chalk111 from "chalk";
|
|
10056
10341
|
function fetchIssue(issueKey, fields) {
|
|
10057
10342
|
let result;
|
|
10058
10343
|
try {
|
|
@@ -10065,15 +10350,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
10065
10350
|
const stderr = error.stderr;
|
|
10066
10351
|
if (stderr.includes("unauthorized")) {
|
|
10067
10352
|
console.error(
|
|
10068
|
-
|
|
10353
|
+
chalk111.red("Jira authentication expired."),
|
|
10069
10354
|
"Run",
|
|
10070
|
-
|
|
10355
|
+
chalk111.cyan("assist jira auth"),
|
|
10071
10356
|
"to re-authenticate."
|
|
10072
10357
|
);
|
|
10073
10358
|
process.exit(1);
|
|
10074
10359
|
}
|
|
10075
10360
|
}
|
|
10076
|
-
console.error(
|
|
10361
|
+
console.error(chalk111.red(`Failed to fetch ${issueKey}.`));
|
|
10077
10362
|
process.exit(1);
|
|
10078
10363
|
}
|
|
10079
10364
|
return JSON.parse(result);
|
|
@@ -10087,7 +10372,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
10087
10372
|
const parsed = fetchIssue(issueKey, field);
|
|
10088
10373
|
const acValue = parsed?.fields?.[field];
|
|
10089
10374
|
if (!acValue) {
|
|
10090
|
-
console.log(
|
|
10375
|
+
console.log(chalk112.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
10091
10376
|
return;
|
|
10092
10377
|
}
|
|
10093
10378
|
if (typeof acValue === "string") {
|
|
@@ -10182,14 +10467,14 @@ async function jiraAuth() {
|
|
|
10182
10467
|
}
|
|
10183
10468
|
|
|
10184
10469
|
// src/commands/jira/viewIssue.ts
|
|
10185
|
-
import
|
|
10470
|
+
import chalk113 from "chalk";
|
|
10186
10471
|
function viewIssue(issueKey) {
|
|
10187
10472
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
10188
10473
|
const fields = parsed?.fields;
|
|
10189
10474
|
const summary = fields?.summary;
|
|
10190
10475
|
const description = fields?.description;
|
|
10191
10476
|
if (summary) {
|
|
10192
|
-
console.log(
|
|
10477
|
+
console.log(chalk113.bold(summary));
|
|
10193
10478
|
}
|
|
10194
10479
|
if (description) {
|
|
10195
10480
|
if (summary) console.log();
|
|
@@ -10203,7 +10488,7 @@ function viewIssue(issueKey) {
|
|
|
10203
10488
|
}
|
|
10204
10489
|
if (!summary && !description) {
|
|
10205
10490
|
console.log(
|
|
10206
|
-
|
|
10491
|
+
chalk113.yellow(`No summary or description found on ${issueKey}.`)
|
|
10207
10492
|
);
|
|
10208
10493
|
}
|
|
10209
10494
|
}
|
|
@@ -10218,13 +10503,13 @@ function registerJira(program2) {
|
|
|
10218
10503
|
|
|
10219
10504
|
// src/commands/reviewComments.ts
|
|
10220
10505
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
10221
|
-
import
|
|
10506
|
+
import chalk114 from "chalk";
|
|
10222
10507
|
async function reviewComments(number) {
|
|
10223
10508
|
if (number) {
|
|
10224
10509
|
try {
|
|
10225
10510
|
execFileSync5("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
10226
10511
|
} catch {
|
|
10227
|
-
console.error(
|
|
10512
|
+
console.error(chalk114.red(`gh pr checkout ${number} failed; aborting.`));
|
|
10228
10513
|
process.exit(1);
|
|
10229
10514
|
}
|
|
10230
10515
|
}
|
|
@@ -10267,15 +10552,15 @@ function registerList(program2) {
|
|
|
10267
10552
|
// src/commands/mermaid/index.ts
|
|
10268
10553
|
import { mkdirSync as mkdirSync12, readdirSync as readdirSync5 } from "fs";
|
|
10269
10554
|
import { resolve as resolve10 } from "path";
|
|
10270
|
-
import
|
|
10555
|
+
import chalk117 from "chalk";
|
|
10271
10556
|
|
|
10272
10557
|
// src/commands/mermaid/exportFile.ts
|
|
10273
10558
|
import { readFileSync as readFileSync28, writeFileSync as writeFileSync22 } from "fs";
|
|
10274
10559
|
import { basename as basename5, extname, resolve as resolve9 } from "path";
|
|
10275
|
-
import
|
|
10560
|
+
import chalk116 from "chalk";
|
|
10276
10561
|
|
|
10277
10562
|
// src/commands/mermaid/renderBlock.ts
|
|
10278
|
-
import
|
|
10563
|
+
import chalk115 from "chalk";
|
|
10279
10564
|
async function renderBlock(krokiUrl, source) {
|
|
10280
10565
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
10281
10566
|
method: "POST",
|
|
@@ -10284,7 +10569,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
10284
10569
|
});
|
|
10285
10570
|
if (!response.ok) {
|
|
10286
10571
|
console.error(
|
|
10287
|
-
|
|
10572
|
+
chalk115.red(
|
|
10288
10573
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
10289
10574
|
)
|
|
10290
10575
|
);
|
|
@@ -10302,19 +10587,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
10302
10587
|
if (onlyIndex !== void 0) {
|
|
10303
10588
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
10304
10589
|
console.error(
|
|
10305
|
-
|
|
10590
|
+
chalk116.red(
|
|
10306
10591
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
10307
10592
|
)
|
|
10308
10593
|
);
|
|
10309
10594
|
process.exit(1);
|
|
10310
10595
|
}
|
|
10311
10596
|
console.log(
|
|
10312
|
-
|
|
10597
|
+
chalk116.gray(
|
|
10313
10598
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
10314
10599
|
)
|
|
10315
10600
|
);
|
|
10316
10601
|
} else {
|
|
10317
|
-
console.log(
|
|
10602
|
+
console.log(chalk116.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
10318
10603
|
}
|
|
10319
10604
|
for (const [i, source] of blocks.entries()) {
|
|
10320
10605
|
const idx = i + 1;
|
|
@@ -10322,7 +10607,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
10322
10607
|
const outPath = resolve9(outDir, `${stem}-${idx}.svg`);
|
|
10323
10608
|
const svg = await renderBlock(krokiUrl, source);
|
|
10324
10609
|
writeFileSync22(outPath, svg, "utf8");
|
|
10325
|
-
console.log(
|
|
10610
|
+
console.log(chalk116.green(` \u2192 ${outPath}`));
|
|
10326
10611
|
}
|
|
10327
10612
|
}
|
|
10328
10613
|
function extractMermaidBlocks(markdown) {
|
|
@@ -10338,18 +10623,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
10338
10623
|
if (options2.index !== void 0) {
|
|
10339
10624
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
10340
10625
|
console.error(
|
|
10341
|
-
|
|
10626
|
+
chalk117.red(`--index must be a positive integer (got ${options2.index})`)
|
|
10342
10627
|
);
|
|
10343
10628
|
process.exit(1);
|
|
10344
10629
|
}
|
|
10345
10630
|
if (!file) {
|
|
10346
|
-
console.error(
|
|
10631
|
+
console.error(chalk117.red("--index requires a file argument"));
|
|
10347
10632
|
process.exit(1);
|
|
10348
10633
|
}
|
|
10349
10634
|
}
|
|
10350
10635
|
const files = file ? [file] : readdirSync5(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
10351
10636
|
if (files.length === 0) {
|
|
10352
|
-
console.log(
|
|
10637
|
+
console.log(chalk117.gray("No markdown files found in current directory."));
|
|
10353
10638
|
return;
|
|
10354
10639
|
}
|
|
10355
10640
|
for (const f of files) {
|
|
@@ -10372,7 +10657,7 @@ function registerMermaid(program2) {
|
|
|
10372
10657
|
}
|
|
10373
10658
|
|
|
10374
10659
|
// src/commands/news/add/index.ts
|
|
10375
|
-
import
|
|
10660
|
+
import chalk118 from "chalk";
|
|
10376
10661
|
import enquirer8 from "enquirer";
|
|
10377
10662
|
async function add2(url) {
|
|
10378
10663
|
if (!url) {
|
|
@@ -10395,17 +10680,17 @@ async function add2(url) {
|
|
|
10395
10680
|
const news = config.news ?? {};
|
|
10396
10681
|
const feeds = news.feeds ?? [];
|
|
10397
10682
|
if (feeds.includes(url)) {
|
|
10398
|
-
console.log(
|
|
10683
|
+
console.log(chalk118.yellow("Feed already exists in config"));
|
|
10399
10684
|
return;
|
|
10400
10685
|
}
|
|
10401
10686
|
feeds.push(url);
|
|
10402
10687
|
config.news = { ...news, feeds };
|
|
10403
10688
|
saveGlobalConfig(config);
|
|
10404
|
-
console.log(
|
|
10689
|
+
console.log(chalk118.green(`Added feed: ${url}`));
|
|
10405
10690
|
}
|
|
10406
10691
|
|
|
10407
10692
|
// src/commands/news/web/handleRequest.ts
|
|
10408
|
-
import
|
|
10693
|
+
import chalk119 from "chalk";
|
|
10409
10694
|
|
|
10410
10695
|
// src/commands/news/web/shared.ts
|
|
10411
10696
|
import { decodeHTML } from "entities";
|
|
@@ -10541,17 +10826,17 @@ function prefetch() {
|
|
|
10541
10826
|
const config = loadConfig();
|
|
10542
10827
|
const total = config.news.feeds.length;
|
|
10543
10828
|
if (total === 0) return;
|
|
10544
|
-
process.stdout.write(
|
|
10829
|
+
process.stdout.write(chalk119.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
10545
10830
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
10546
10831
|
const width = 20;
|
|
10547
10832
|
const filled = Math.round(done2 / t * width);
|
|
10548
10833
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
10549
10834
|
process.stdout.write(
|
|
10550
|
-
`\r${
|
|
10835
|
+
`\r${chalk119.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
10551
10836
|
);
|
|
10552
10837
|
}).then((items2) => {
|
|
10553
10838
|
process.stdout.write(
|
|
10554
|
-
`\r${
|
|
10839
|
+
`\r${chalk119.green(`Fetched ${items2.length} items from ${total} feed(s)`)}
|
|
10555
10840
|
`
|
|
10556
10841
|
);
|
|
10557
10842
|
cachedItems = items2;
|
|
@@ -10596,7 +10881,7 @@ function registerNews(program2) {
|
|
|
10596
10881
|
}
|
|
10597
10882
|
|
|
10598
10883
|
// src/commands/prompts/printPromptsTable.ts
|
|
10599
|
-
import
|
|
10884
|
+
import chalk120 from "chalk";
|
|
10600
10885
|
function truncate(str, max) {
|
|
10601
10886
|
if (str.length <= max) return str;
|
|
10602
10887
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -10614,14 +10899,14 @@ function printPromptsTable(rows) {
|
|
|
10614
10899
|
"Command".padEnd(commandWidth),
|
|
10615
10900
|
"Repos"
|
|
10616
10901
|
].join(" ");
|
|
10617
|
-
console.log(
|
|
10618
|
-
console.log(
|
|
10902
|
+
console.log(chalk120.dim(header));
|
|
10903
|
+
console.log(chalk120.dim("-".repeat(header.length)));
|
|
10619
10904
|
for (const row of rows) {
|
|
10620
10905
|
const count6 = String(row.count).padStart(countWidth);
|
|
10621
10906
|
const tool = row.tool.padEnd(toolWidth);
|
|
10622
10907
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
10623
10908
|
console.log(
|
|
10624
|
-
`${
|
|
10909
|
+
`${chalk120.yellow(count6)} ${tool} ${command} ${chalk120.dim(row.repos)}`
|
|
10625
10910
|
);
|
|
10626
10911
|
}
|
|
10627
10912
|
}
|
|
@@ -11038,20 +11323,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
11038
11323
|
}
|
|
11039
11324
|
|
|
11040
11325
|
// src/commands/prs/listComments/printComments.ts
|
|
11041
|
-
import
|
|
11326
|
+
import chalk121 from "chalk";
|
|
11042
11327
|
function formatForHuman(comment3) {
|
|
11043
11328
|
if (comment3.type === "review") {
|
|
11044
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
11329
|
+
const stateColor = comment3.state === "APPROVED" ? chalk121.green : comment3.state === "CHANGES_REQUESTED" ? chalk121.red : chalk121.yellow;
|
|
11045
11330
|
return [
|
|
11046
|
-
`${
|
|
11331
|
+
`${chalk121.cyan("Review")} by ${chalk121.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
11047
11332
|
comment3.body,
|
|
11048
11333
|
""
|
|
11049
11334
|
].join("\n");
|
|
11050
11335
|
}
|
|
11051
11336
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
11052
11337
|
return [
|
|
11053
|
-
`${
|
|
11054
|
-
|
|
11338
|
+
`${chalk121.cyan("Line comment")} by ${chalk121.bold(comment3.user)} on ${chalk121.dim(`${comment3.path}${location}`)}`,
|
|
11339
|
+
chalk121.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
11055
11340
|
comment3.body,
|
|
11056
11341
|
""
|
|
11057
11342
|
].join("\n");
|
|
@@ -11141,13 +11426,13 @@ import { execSync as execSync37 } from "child_process";
|
|
|
11141
11426
|
import enquirer9 from "enquirer";
|
|
11142
11427
|
|
|
11143
11428
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
11144
|
-
import
|
|
11429
|
+
import chalk122 from "chalk";
|
|
11145
11430
|
var STATUS_MAP = {
|
|
11146
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
11147
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
11431
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk122.magenta("merged"), date: pr.mergedAt } : null,
|
|
11432
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk122.red("closed"), date: pr.closedAt } : null
|
|
11148
11433
|
};
|
|
11149
11434
|
function defaultStatus(pr) {
|
|
11150
|
-
return { label:
|
|
11435
|
+
return { label: chalk122.green("opened"), date: pr.createdAt };
|
|
11151
11436
|
}
|
|
11152
11437
|
function getStatus2(pr) {
|
|
11153
11438
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -11156,11 +11441,11 @@ function formatDate(dateStr) {
|
|
|
11156
11441
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
11157
11442
|
}
|
|
11158
11443
|
function formatPrHeader(pr, status2) {
|
|
11159
|
-
return `${
|
|
11444
|
+
return `${chalk122.cyan(`#${pr.number}`)} ${pr.title} ${chalk122.dim(`(${pr.author.login},`)} ${status2.label} ${chalk122.dim(`${formatDate(status2.date)})`)}`;
|
|
11160
11445
|
}
|
|
11161
11446
|
function logPrDetails(pr) {
|
|
11162
11447
|
console.log(
|
|
11163
|
-
|
|
11448
|
+
chalk122.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
11164
11449
|
);
|
|
11165
11450
|
console.log();
|
|
11166
11451
|
}
|
|
@@ -11348,10 +11633,10 @@ function registerPrs(program2) {
|
|
|
11348
11633
|
}
|
|
11349
11634
|
|
|
11350
11635
|
// src/commands/ravendb/ravendbAuth.ts
|
|
11351
|
-
import
|
|
11636
|
+
import chalk128 from "chalk";
|
|
11352
11637
|
|
|
11353
11638
|
// src/shared/createConnectionAuth.ts
|
|
11354
|
-
import
|
|
11639
|
+
import chalk123 from "chalk";
|
|
11355
11640
|
function listConnections(connections, format2) {
|
|
11356
11641
|
if (connections.length === 0) {
|
|
11357
11642
|
console.log("No connections configured.");
|
|
@@ -11364,7 +11649,7 @@ function listConnections(connections, format2) {
|
|
|
11364
11649
|
function removeConnection(connections, name, save) {
|
|
11365
11650
|
const filtered = connections.filter((c) => c.name !== name);
|
|
11366
11651
|
if (filtered.length === connections.length) {
|
|
11367
|
-
console.error(
|
|
11652
|
+
console.error(chalk123.red(`Connection "${name}" not found.`));
|
|
11368
11653
|
process.exit(1);
|
|
11369
11654
|
}
|
|
11370
11655
|
save(filtered);
|
|
@@ -11410,15 +11695,15 @@ function saveConnections(connections) {
|
|
|
11410
11695
|
}
|
|
11411
11696
|
|
|
11412
11697
|
// src/commands/ravendb/promptConnection.ts
|
|
11413
|
-
import
|
|
11698
|
+
import chalk126 from "chalk";
|
|
11414
11699
|
|
|
11415
11700
|
// src/commands/ravendb/selectOpSecret.ts
|
|
11416
|
-
import
|
|
11701
|
+
import chalk125 from "chalk";
|
|
11417
11702
|
import Enquirer2 from "enquirer";
|
|
11418
11703
|
|
|
11419
11704
|
// src/commands/ravendb/searchItems.ts
|
|
11420
11705
|
import { execSync as execSync39 } from "child_process";
|
|
11421
|
-
import
|
|
11706
|
+
import chalk124 from "chalk";
|
|
11422
11707
|
function opExec(args) {
|
|
11423
11708
|
return execSync39(`op ${args}`, {
|
|
11424
11709
|
encoding: "utf-8",
|
|
@@ -11431,7 +11716,7 @@ function searchItems(search2) {
|
|
|
11431
11716
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
11432
11717
|
} catch {
|
|
11433
11718
|
console.error(
|
|
11434
|
-
|
|
11719
|
+
chalk124.red(
|
|
11435
11720
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
11436
11721
|
)
|
|
11437
11722
|
);
|
|
@@ -11445,7 +11730,7 @@ function getItemFields(itemId) {
|
|
|
11445
11730
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
11446
11731
|
return item.fields.filter((f) => f.reference && f.label);
|
|
11447
11732
|
} catch {
|
|
11448
|
-
console.error(
|
|
11733
|
+
console.error(chalk124.red("Failed to get item details from 1Password."));
|
|
11449
11734
|
process.exit(1);
|
|
11450
11735
|
}
|
|
11451
11736
|
}
|
|
@@ -11464,7 +11749,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
11464
11749
|
}).run();
|
|
11465
11750
|
const items2 = searchItems(search2);
|
|
11466
11751
|
if (items2.length === 0) {
|
|
11467
|
-
console.error(
|
|
11752
|
+
console.error(chalk125.red(`No items found matching "${search2}".`));
|
|
11468
11753
|
process.exit(1);
|
|
11469
11754
|
}
|
|
11470
11755
|
const itemId = await selectOne(
|
|
@@ -11473,7 +11758,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
11473
11758
|
);
|
|
11474
11759
|
const fields = getItemFields(itemId);
|
|
11475
11760
|
if (fields.length === 0) {
|
|
11476
|
-
console.error(
|
|
11761
|
+
console.error(chalk125.red("No fields with references found on this item."));
|
|
11477
11762
|
process.exit(1);
|
|
11478
11763
|
}
|
|
11479
11764
|
const ref = await selectOne(
|
|
@@ -11487,7 +11772,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
11487
11772
|
async function promptConnection(existingNames) {
|
|
11488
11773
|
const name = await promptInput("name", "Connection name:");
|
|
11489
11774
|
if (existingNames.includes(name)) {
|
|
11490
|
-
console.error(
|
|
11775
|
+
console.error(chalk126.red(`Connection "${name}" already exists.`));
|
|
11491
11776
|
process.exit(1);
|
|
11492
11777
|
}
|
|
11493
11778
|
const url = await promptInput(
|
|
@@ -11496,22 +11781,22 @@ async function promptConnection(existingNames) {
|
|
|
11496
11781
|
);
|
|
11497
11782
|
const database = await promptInput("database", "Database name:");
|
|
11498
11783
|
if (!name || !url || !database) {
|
|
11499
|
-
console.error(
|
|
11784
|
+
console.error(chalk126.red("All fields are required."));
|
|
11500
11785
|
process.exit(1);
|
|
11501
11786
|
}
|
|
11502
11787
|
const apiKeyRef = await selectOpSecret();
|
|
11503
|
-
console.log(
|
|
11788
|
+
console.log(chalk126.dim(`Using: ${apiKeyRef}`));
|
|
11504
11789
|
return { name, url, database, apiKeyRef };
|
|
11505
11790
|
}
|
|
11506
11791
|
|
|
11507
11792
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
11508
|
-
import
|
|
11793
|
+
import chalk127 from "chalk";
|
|
11509
11794
|
function ravendbSetConnection(name) {
|
|
11510
11795
|
const raw = loadGlobalConfigRaw();
|
|
11511
11796
|
const ravendb = raw.ravendb ?? {};
|
|
11512
11797
|
const connections = ravendb.connections ?? [];
|
|
11513
11798
|
if (!connections.some((c) => c.name === name)) {
|
|
11514
|
-
console.error(
|
|
11799
|
+
console.error(chalk127.red(`Connection "${name}" not found.`));
|
|
11515
11800
|
console.error(
|
|
11516
11801
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
11517
11802
|
);
|
|
@@ -11527,16 +11812,16 @@ function ravendbSetConnection(name) {
|
|
|
11527
11812
|
var ravendbAuth = createConnectionAuth({
|
|
11528
11813
|
load: loadConnections,
|
|
11529
11814
|
save: saveConnections,
|
|
11530
|
-
format: (c) => `${
|
|
11815
|
+
format: (c) => `${chalk128.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
11531
11816
|
promptNew: promptConnection,
|
|
11532
11817
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
11533
11818
|
});
|
|
11534
11819
|
|
|
11535
11820
|
// src/commands/ravendb/ravendbCollections.ts
|
|
11536
|
-
import
|
|
11821
|
+
import chalk132 from "chalk";
|
|
11537
11822
|
|
|
11538
11823
|
// src/commands/ravendb/ravenFetch.ts
|
|
11539
|
-
import
|
|
11824
|
+
import chalk130 from "chalk";
|
|
11540
11825
|
|
|
11541
11826
|
// src/commands/ravendb/getAccessToken.ts
|
|
11542
11827
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -11573,10 +11858,10 @@ ${errorText}`
|
|
|
11573
11858
|
|
|
11574
11859
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
11575
11860
|
import { execSync as execSync40 } from "child_process";
|
|
11576
|
-
import
|
|
11861
|
+
import chalk129 from "chalk";
|
|
11577
11862
|
function resolveOpSecret(reference) {
|
|
11578
11863
|
if (!reference.startsWith("op://")) {
|
|
11579
|
-
console.error(
|
|
11864
|
+
console.error(chalk129.red(`Invalid secret reference: must start with op://`));
|
|
11580
11865
|
process.exit(1);
|
|
11581
11866
|
}
|
|
11582
11867
|
try {
|
|
@@ -11586,7 +11871,7 @@ function resolveOpSecret(reference) {
|
|
|
11586
11871
|
}).trim();
|
|
11587
11872
|
} catch {
|
|
11588
11873
|
console.error(
|
|
11589
|
-
|
|
11874
|
+
chalk129.red(
|
|
11590
11875
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
11591
11876
|
)
|
|
11592
11877
|
);
|
|
@@ -11613,7 +11898,7 @@ async function ravenFetch(connection, path54) {
|
|
|
11613
11898
|
if (!response.ok) {
|
|
11614
11899
|
const body = await response.text();
|
|
11615
11900
|
console.error(
|
|
11616
|
-
|
|
11901
|
+
chalk130.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
11617
11902
|
);
|
|
11618
11903
|
console.error(body.substring(0, 500));
|
|
11619
11904
|
process.exit(1);
|
|
@@ -11622,7 +11907,7 @@ async function ravenFetch(connection, path54) {
|
|
|
11622
11907
|
}
|
|
11623
11908
|
|
|
11624
11909
|
// src/commands/ravendb/resolveConnection.ts
|
|
11625
|
-
import
|
|
11910
|
+
import chalk131 from "chalk";
|
|
11626
11911
|
function loadRavendb() {
|
|
11627
11912
|
const raw = loadGlobalConfigRaw();
|
|
11628
11913
|
const ravendb = raw.ravendb;
|
|
@@ -11636,7 +11921,7 @@ function resolveConnection(name) {
|
|
|
11636
11921
|
const connectionName = name ?? defaultConnection;
|
|
11637
11922
|
if (!connectionName) {
|
|
11638
11923
|
console.error(
|
|
11639
|
-
|
|
11924
|
+
chalk131.red(
|
|
11640
11925
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
11641
11926
|
)
|
|
11642
11927
|
);
|
|
@@ -11644,7 +11929,7 @@ function resolveConnection(name) {
|
|
|
11644
11929
|
}
|
|
11645
11930
|
const connection = connections.find((c) => c.name === connectionName);
|
|
11646
11931
|
if (!connection) {
|
|
11647
|
-
console.error(
|
|
11932
|
+
console.error(chalk131.red(`Connection "${connectionName}" not found.`));
|
|
11648
11933
|
console.error(
|
|
11649
11934
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
11650
11935
|
);
|
|
@@ -11675,15 +11960,15 @@ async function ravendbCollections(connectionName) {
|
|
|
11675
11960
|
return;
|
|
11676
11961
|
}
|
|
11677
11962
|
for (const c of collections) {
|
|
11678
|
-
console.log(`${
|
|
11963
|
+
console.log(`${chalk132.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
11679
11964
|
}
|
|
11680
11965
|
}
|
|
11681
11966
|
|
|
11682
11967
|
// src/commands/ravendb/ravendbQuery.ts
|
|
11683
|
-
import
|
|
11968
|
+
import chalk134 from "chalk";
|
|
11684
11969
|
|
|
11685
11970
|
// src/commands/ravendb/fetchAllPages.ts
|
|
11686
|
-
import
|
|
11971
|
+
import chalk133 from "chalk";
|
|
11687
11972
|
|
|
11688
11973
|
// src/commands/ravendb/buildQueryPath.ts
|
|
11689
11974
|
function buildQueryPath(opts) {
|
|
@@ -11721,7 +12006,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
11721
12006
|
allResults.push(...results);
|
|
11722
12007
|
start3 += results.length;
|
|
11723
12008
|
process.stderr.write(
|
|
11724
|
-
`\r${
|
|
12009
|
+
`\r${chalk133.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
11725
12010
|
);
|
|
11726
12011
|
if (start3 >= totalResults) break;
|
|
11727
12012
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -11736,7 +12021,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
11736
12021
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
11737
12022
|
const resolved = resolveArgs(connectionName, collection);
|
|
11738
12023
|
if (!resolved.collection && !options2.query) {
|
|
11739
|
-
console.error(
|
|
12024
|
+
console.error(chalk134.red("Provide a collection name or --query filter."));
|
|
11740
12025
|
process.exit(1);
|
|
11741
12026
|
}
|
|
11742
12027
|
const { collection: col } = resolved;
|
|
@@ -11770,11 +12055,11 @@ function registerRavendb(program2) {
|
|
|
11770
12055
|
}
|
|
11771
12056
|
|
|
11772
12057
|
// src/commands/refactor/check/index.ts
|
|
11773
|
-
import { spawn as
|
|
12058
|
+
import { spawn as spawn6 } from "child_process";
|
|
11774
12059
|
import * as path26 from "path";
|
|
11775
12060
|
|
|
11776
12061
|
// src/commands/refactor/logViolations.ts
|
|
11777
|
-
import
|
|
12062
|
+
import chalk135 from "chalk";
|
|
11778
12063
|
var DEFAULT_MAX_LINES = 100;
|
|
11779
12064
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
11780
12065
|
if (violations.length === 0) {
|
|
@@ -11783,43 +12068,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
11783
12068
|
}
|
|
11784
12069
|
return;
|
|
11785
12070
|
}
|
|
11786
|
-
console.error(
|
|
12071
|
+
console.error(chalk135.red(`
|
|
11787
12072
|
Refactor check failed:
|
|
11788
12073
|
`));
|
|
11789
|
-
console.error(
|
|
12074
|
+
console.error(chalk135.red(` The following files exceed ${maxLines} lines:
|
|
11790
12075
|
`));
|
|
11791
12076
|
for (const violation of violations) {
|
|
11792
|
-
console.error(
|
|
12077
|
+
console.error(chalk135.red(` ${violation.file} (${violation.lines} lines)`));
|
|
11793
12078
|
}
|
|
11794
12079
|
console.error(
|
|
11795
|
-
|
|
12080
|
+
chalk135.yellow(
|
|
11796
12081
|
`
|
|
11797
12082
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
11798
12083
|
way to refactor it, ignore it with:
|
|
11799
12084
|
`
|
|
11800
12085
|
)
|
|
11801
12086
|
);
|
|
11802
|
-
console.error(
|
|
12087
|
+
console.error(chalk135.gray(` assist refactor ignore <file>
|
|
11803
12088
|
`));
|
|
11804
12089
|
if (process.env.CLAUDECODE) {
|
|
11805
|
-
console.error(
|
|
12090
|
+
console.error(chalk135.cyan(`
|
|
11806
12091
|
## Extracting Code to New Files
|
|
11807
12092
|
`));
|
|
11808
12093
|
console.error(
|
|
11809
|
-
|
|
12094
|
+
chalk135.cyan(
|
|
11810
12095
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
11811
12096
|
`
|
|
11812
12097
|
)
|
|
11813
12098
|
);
|
|
11814
12099
|
console.error(
|
|
11815
|
-
|
|
12100
|
+
chalk135.cyan(
|
|
11816
12101
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
11817
12102
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
11818
12103
|
`
|
|
11819
12104
|
)
|
|
11820
12105
|
);
|
|
11821
12106
|
console.error(
|
|
11822
|
-
|
|
12107
|
+
chalk135.cyan(
|
|
11823
12108
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
11824
12109
|
domains, move it to a common/shared folder.
|
|
11825
12110
|
`
|
|
@@ -11918,7 +12203,7 @@ function getViolations(pattern2, options2 = {}, maxLines = DEFAULT_MAX_LINES) {
|
|
|
11918
12203
|
// src/commands/refactor/check/index.ts
|
|
11919
12204
|
function runScript(script, cwd) {
|
|
11920
12205
|
return new Promise((resolve16) => {
|
|
11921
|
-
const child =
|
|
12206
|
+
const child = spawn6("npm", ["run", script], {
|
|
11922
12207
|
stdio: "pipe",
|
|
11923
12208
|
shell: true,
|
|
11924
12209
|
cwd
|
|
@@ -11975,7 +12260,7 @@ async function check(pattern2, options2) {
|
|
|
11975
12260
|
|
|
11976
12261
|
// src/commands/refactor/extract/index.ts
|
|
11977
12262
|
import path33 from "path";
|
|
11978
|
-
import
|
|
12263
|
+
import chalk138 from "chalk";
|
|
11979
12264
|
|
|
11980
12265
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
11981
12266
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -12550,23 +12835,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
12550
12835
|
|
|
12551
12836
|
// src/commands/refactor/extract/displayPlan.ts
|
|
12552
12837
|
import path30 from "path";
|
|
12553
|
-
import
|
|
12838
|
+
import chalk136 from "chalk";
|
|
12554
12839
|
function section(title) {
|
|
12555
12840
|
return `
|
|
12556
|
-
${
|
|
12841
|
+
${chalk136.cyan(title)}`;
|
|
12557
12842
|
}
|
|
12558
12843
|
function displayImporters(plan2, cwd) {
|
|
12559
12844
|
if (plan2.importersToUpdate.length === 0) return;
|
|
12560
12845
|
console.log(section("Update importers:"));
|
|
12561
12846
|
for (const imp of plan2.importersToUpdate) {
|
|
12562
12847
|
const rel = path30.relative(cwd, imp.file.getFilePath());
|
|
12563
|
-
console.log(` ${
|
|
12848
|
+
console.log(` ${chalk136.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
12564
12849
|
}
|
|
12565
12850
|
}
|
|
12566
12851
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
12567
|
-
console.log(
|
|
12852
|
+
console.log(chalk136.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
12568
12853
|
`));
|
|
12569
|
-
console.log(` ${
|
|
12854
|
+
console.log(` ${chalk136.cyan("Functions to move:")}`);
|
|
12570
12855
|
for (const name of plan2.extractedNames) {
|
|
12571
12856
|
console.log(` ${name}`);
|
|
12572
12857
|
}
|
|
@@ -12600,7 +12885,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
12600
12885
|
|
|
12601
12886
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
12602
12887
|
import path32 from "path";
|
|
12603
|
-
import
|
|
12888
|
+
import chalk137 from "chalk";
|
|
12604
12889
|
import { Project as Project4 } from "ts-morph";
|
|
12605
12890
|
|
|
12606
12891
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -12660,7 +12945,7 @@ function loadProjectFile(file) {
|
|
|
12660
12945
|
});
|
|
12661
12946
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
12662
12947
|
if (!sourceFile) {
|
|
12663
|
-
console.log(
|
|
12948
|
+
console.log(chalk137.red(`File not found in project: ${file}`));
|
|
12664
12949
|
process.exit(1);
|
|
12665
12950
|
}
|
|
12666
12951
|
return { project, sourceFile };
|
|
@@ -12683,19 +12968,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
12683
12968
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
12684
12969
|
if (options2.apply) {
|
|
12685
12970
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
12686
|
-
console.log(
|
|
12971
|
+
console.log(chalk138.green("\nExtraction complete"));
|
|
12687
12972
|
} else {
|
|
12688
|
-
console.log(
|
|
12973
|
+
console.log(chalk138.dim("\nDry run. Use --apply to execute."));
|
|
12689
12974
|
}
|
|
12690
12975
|
}
|
|
12691
12976
|
|
|
12692
12977
|
// src/commands/refactor/ignore.ts
|
|
12693
12978
|
import fs20 from "fs";
|
|
12694
|
-
import
|
|
12979
|
+
import chalk139 from "chalk";
|
|
12695
12980
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
12696
12981
|
function ignore(file) {
|
|
12697
12982
|
if (!fs20.existsSync(file)) {
|
|
12698
|
-
console.error(
|
|
12983
|
+
console.error(chalk139.red(`Error: File does not exist: ${file}`));
|
|
12699
12984
|
process.exit(1);
|
|
12700
12985
|
}
|
|
12701
12986
|
const content = fs20.readFileSync(file, "utf-8");
|
|
@@ -12711,7 +12996,7 @@ function ignore(file) {
|
|
|
12711
12996
|
fs20.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
12712
12997
|
}
|
|
12713
12998
|
console.log(
|
|
12714
|
-
|
|
12999
|
+
chalk139.green(
|
|
12715
13000
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
12716
13001
|
)
|
|
12717
13002
|
);
|
|
@@ -12719,25 +13004,25 @@ function ignore(file) {
|
|
|
12719
13004
|
|
|
12720
13005
|
// src/commands/refactor/rename/index.ts
|
|
12721
13006
|
import path34 from "path";
|
|
12722
|
-
import
|
|
13007
|
+
import chalk140 from "chalk";
|
|
12723
13008
|
async function rename(source, destination, options2 = {}) {
|
|
12724
13009
|
const destPath = path34.resolve(destination);
|
|
12725
13010
|
const cwd = process.cwd();
|
|
12726
13011
|
const relSource = path34.relative(cwd, path34.resolve(source));
|
|
12727
13012
|
const relDest = path34.relative(cwd, destPath);
|
|
12728
13013
|
const { project, sourceFile } = loadProjectFile(source);
|
|
12729
|
-
console.log(
|
|
13014
|
+
console.log(chalk140.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
12730
13015
|
if (options2.apply) {
|
|
12731
13016
|
sourceFile.move(destPath);
|
|
12732
13017
|
await project.save();
|
|
12733
|
-
console.log(
|
|
13018
|
+
console.log(chalk140.green("Done"));
|
|
12734
13019
|
} else {
|
|
12735
|
-
console.log(
|
|
13020
|
+
console.log(chalk140.dim("Dry run. Use --apply to execute."));
|
|
12736
13021
|
}
|
|
12737
13022
|
}
|
|
12738
13023
|
|
|
12739
13024
|
// src/commands/refactor/renameSymbol/index.ts
|
|
12740
|
-
import
|
|
13025
|
+
import chalk141 from "chalk";
|
|
12741
13026
|
|
|
12742
13027
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
12743
13028
|
import { SyntaxKind as SyntaxKind14 } from "ts-morph";
|
|
@@ -12783,33 +13068,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
12783
13068
|
const { project, sourceFile } = loadProjectFile(file);
|
|
12784
13069
|
const symbol = findSymbol(sourceFile, oldName);
|
|
12785
13070
|
if (!symbol) {
|
|
12786
|
-
console.log(
|
|
13071
|
+
console.log(chalk141.red(`Symbol "${oldName}" not found in ${file}`));
|
|
12787
13072
|
process.exit(1);
|
|
12788
13073
|
}
|
|
12789
13074
|
const grouped = groupReferences(symbol, cwd);
|
|
12790
13075
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
12791
13076
|
console.log(
|
|
12792
|
-
|
|
13077
|
+
chalk141.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
12793
13078
|
`)
|
|
12794
13079
|
);
|
|
12795
13080
|
for (const [refFile, lines] of grouped) {
|
|
12796
13081
|
console.log(
|
|
12797
|
-
` ${
|
|
13082
|
+
` ${chalk141.dim(refFile)}: lines ${chalk141.cyan(lines.join(", "))}`
|
|
12798
13083
|
);
|
|
12799
13084
|
}
|
|
12800
13085
|
if (options2.apply) {
|
|
12801
13086
|
symbol.rename(newName);
|
|
12802
13087
|
await project.save();
|
|
12803
|
-
console.log(
|
|
13088
|
+
console.log(chalk141.green(`
|
|
12804
13089
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
12805
13090
|
} else {
|
|
12806
|
-
console.log(
|
|
13091
|
+
console.log(chalk141.dim("\nDry run. Use --apply to execute."));
|
|
12807
13092
|
}
|
|
12808
13093
|
}
|
|
12809
13094
|
|
|
12810
13095
|
// src/commands/refactor/restructure/index.ts
|
|
12811
13096
|
import path44 from "path";
|
|
12812
|
-
import
|
|
13097
|
+
import chalk144 from "chalk";
|
|
12813
13098
|
|
|
12814
13099
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
12815
13100
|
import path36 from "path";
|
|
@@ -13052,50 +13337,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
13052
13337
|
|
|
13053
13338
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
13054
13339
|
import path40 from "path";
|
|
13055
|
-
import
|
|
13340
|
+
import chalk142 from "chalk";
|
|
13056
13341
|
function relPath(filePath) {
|
|
13057
13342
|
return path40.relative(process.cwd(), filePath);
|
|
13058
13343
|
}
|
|
13059
13344
|
function displayMoves(plan2) {
|
|
13060
13345
|
if (plan2.moves.length === 0) return;
|
|
13061
|
-
console.log(
|
|
13346
|
+
console.log(chalk142.bold("\nFile moves:"));
|
|
13062
13347
|
for (const move of plan2.moves) {
|
|
13063
13348
|
console.log(
|
|
13064
|
-
` ${
|
|
13349
|
+
` ${chalk142.red(relPath(move.from))} \u2192 ${chalk142.green(relPath(move.to))}`
|
|
13065
13350
|
);
|
|
13066
|
-
console.log(
|
|
13351
|
+
console.log(chalk142.dim(` ${move.reason}`));
|
|
13067
13352
|
}
|
|
13068
13353
|
}
|
|
13069
13354
|
function displayRewrites(rewrites) {
|
|
13070
13355
|
if (rewrites.length === 0) return;
|
|
13071
13356
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
13072
|
-
console.log(
|
|
13357
|
+
console.log(chalk142.bold(`
|
|
13073
13358
|
Import rewrites (${affectedFiles.size} files):`));
|
|
13074
13359
|
for (const file of affectedFiles) {
|
|
13075
|
-
console.log(` ${
|
|
13360
|
+
console.log(` ${chalk142.cyan(relPath(file))}:`);
|
|
13076
13361
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
13077
13362
|
(r) => r.file === file
|
|
13078
13363
|
)) {
|
|
13079
13364
|
console.log(
|
|
13080
|
-
` ${
|
|
13365
|
+
` ${chalk142.red(`"${oldSpecifier}"`)} \u2192 ${chalk142.green(`"${newSpecifier}"`)}`
|
|
13081
13366
|
);
|
|
13082
13367
|
}
|
|
13083
13368
|
}
|
|
13084
13369
|
}
|
|
13085
13370
|
function displayPlan2(plan2) {
|
|
13086
13371
|
if (plan2.warnings.length > 0) {
|
|
13087
|
-
console.log(
|
|
13088
|
-
for (const w of plan2.warnings) console.log(
|
|
13372
|
+
console.log(chalk142.yellow("\nWarnings:"));
|
|
13373
|
+
for (const w of plan2.warnings) console.log(chalk142.yellow(` ${w}`));
|
|
13089
13374
|
}
|
|
13090
13375
|
if (plan2.newDirectories.length > 0) {
|
|
13091
|
-
console.log(
|
|
13376
|
+
console.log(chalk142.bold("\nNew directories:"));
|
|
13092
13377
|
for (const dir of plan2.newDirectories)
|
|
13093
|
-
console.log(
|
|
13378
|
+
console.log(chalk142.green(` ${dir}/`));
|
|
13094
13379
|
}
|
|
13095
13380
|
displayMoves(plan2);
|
|
13096
13381
|
displayRewrites(plan2.rewrites);
|
|
13097
13382
|
console.log(
|
|
13098
|
-
|
|
13383
|
+
chalk142.dim(
|
|
13099
13384
|
`
|
|
13100
13385
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
13101
13386
|
)
|
|
@@ -13105,18 +13390,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
13105
13390
|
// src/commands/refactor/restructure/executePlan.ts
|
|
13106
13391
|
import fs22 from "fs";
|
|
13107
13392
|
import path41 from "path";
|
|
13108
|
-
import
|
|
13393
|
+
import chalk143 from "chalk";
|
|
13109
13394
|
function executePlan(plan2) {
|
|
13110
13395
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
13111
13396
|
for (const [file, content] of updatedContents) {
|
|
13112
13397
|
fs22.writeFileSync(file, content, "utf-8");
|
|
13113
13398
|
console.log(
|
|
13114
|
-
|
|
13399
|
+
chalk143.cyan(` Rewrote imports in ${path41.relative(process.cwd(), file)}`)
|
|
13115
13400
|
);
|
|
13116
13401
|
}
|
|
13117
13402
|
for (const dir of plan2.newDirectories) {
|
|
13118
13403
|
fs22.mkdirSync(dir, { recursive: true });
|
|
13119
|
-
console.log(
|
|
13404
|
+
console.log(chalk143.green(` Created ${path41.relative(process.cwd(), dir)}/`));
|
|
13120
13405
|
}
|
|
13121
13406
|
for (const move of plan2.moves) {
|
|
13122
13407
|
const targetDir = path41.dirname(move.to);
|
|
@@ -13125,7 +13410,7 @@ function executePlan(plan2) {
|
|
|
13125
13410
|
}
|
|
13126
13411
|
fs22.renameSync(move.from, move.to);
|
|
13127
13412
|
console.log(
|
|
13128
|
-
|
|
13413
|
+
chalk143.white(
|
|
13129
13414
|
` Moved ${path41.relative(process.cwd(), move.from)} \u2192 ${path41.relative(process.cwd(), move.to)}`
|
|
13130
13415
|
)
|
|
13131
13416
|
);
|
|
@@ -13140,7 +13425,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
13140
13425
|
if (entries.length === 0) {
|
|
13141
13426
|
fs22.rmdirSync(dir);
|
|
13142
13427
|
console.log(
|
|
13143
|
-
|
|
13428
|
+
chalk143.dim(
|
|
13144
13429
|
` Removed empty directory ${path41.relative(process.cwd(), dir)}`
|
|
13145
13430
|
)
|
|
13146
13431
|
);
|
|
@@ -13273,22 +13558,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
13273
13558
|
const targetPattern = pattern2 ?? "src";
|
|
13274
13559
|
const files = findSourceFiles2(targetPattern);
|
|
13275
13560
|
if (files.length === 0) {
|
|
13276
|
-
console.log(
|
|
13561
|
+
console.log(chalk144.yellow("No files found matching pattern"));
|
|
13277
13562
|
return;
|
|
13278
13563
|
}
|
|
13279
13564
|
const tsConfigPath = path44.resolve("tsconfig.json");
|
|
13280
13565
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
13281
13566
|
if (plan2.moves.length === 0) {
|
|
13282
|
-
console.log(
|
|
13567
|
+
console.log(chalk144.green("No restructuring needed"));
|
|
13283
13568
|
return;
|
|
13284
13569
|
}
|
|
13285
13570
|
displayPlan2(plan2);
|
|
13286
13571
|
if (options2.apply) {
|
|
13287
|
-
console.log(
|
|
13572
|
+
console.log(chalk144.bold("\nApplying changes..."));
|
|
13288
13573
|
executePlan(plan2);
|
|
13289
|
-
console.log(
|
|
13574
|
+
console.log(chalk144.green("\nRestructuring complete"));
|
|
13290
13575
|
} else {
|
|
13291
|
-
console.log(
|
|
13576
|
+
console.log(chalk144.dim("\nDry run. Use --apply to execute."));
|
|
13292
13577
|
}
|
|
13293
13578
|
}
|
|
13294
13579
|
|
|
@@ -13857,18 +14142,18 @@ function partitionFindingsByDiff(findings, index2) {
|
|
|
13857
14142
|
}
|
|
13858
14143
|
|
|
13859
14144
|
// src/commands/review/warnOutOfDiff.ts
|
|
13860
|
-
import
|
|
14145
|
+
import chalk145 from "chalk";
|
|
13861
14146
|
function warnOutOfDiff(outOfDiff) {
|
|
13862
14147
|
if (outOfDiff.length === 0) return;
|
|
13863
14148
|
console.warn(
|
|
13864
|
-
|
|
14149
|
+
chalk145.yellow(
|
|
13865
14150
|
`Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
|
|
13866
14151
|
)
|
|
13867
14152
|
);
|
|
13868
14153
|
for (const finding of outOfDiff) {
|
|
13869
14154
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
13870
14155
|
console.warn(
|
|
13871
|
-
` ${
|
|
14156
|
+
` ${chalk145.yellow("\xB7")} ${finding.title} ${chalk145.dim(
|
|
13872
14157
|
`(${finding.file}:${range})`
|
|
13873
14158
|
)}`
|
|
13874
14159
|
);
|
|
@@ -13887,18 +14172,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
13887
14172
|
}
|
|
13888
14173
|
|
|
13889
14174
|
// src/commands/review/warnUnlocated.ts
|
|
13890
|
-
import
|
|
14175
|
+
import chalk146 from "chalk";
|
|
13891
14176
|
function warnUnlocated(unlocated) {
|
|
13892
14177
|
if (unlocated.length === 0) return;
|
|
13893
14178
|
console.warn(
|
|
13894
|
-
|
|
14179
|
+
chalk146.yellow(
|
|
13895
14180
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
13896
14181
|
)
|
|
13897
14182
|
);
|
|
13898
14183
|
for (const finding of unlocated) {
|
|
13899
|
-
const where = finding.location ||
|
|
14184
|
+
const where = finding.location || chalk146.dim("missing");
|
|
13900
14185
|
console.warn(
|
|
13901
|
-
` ${
|
|
14186
|
+
` ${chalk146.yellow("\xB7")} ${finding.title} ${chalk146.dim(`(${where})`)}`
|
|
13902
14187
|
);
|
|
13903
14188
|
}
|
|
13904
14189
|
}
|
|
@@ -14078,7 +14363,7 @@ function cachedReviewerResult(name, outputPath) {
|
|
|
14078
14363
|
}
|
|
14079
14364
|
|
|
14080
14365
|
// src/commands/review/MultiSpinner.ts
|
|
14081
|
-
import { createLogUpdate } from "log-update";
|
|
14366
|
+
import { createLogUpdate as createLogUpdate2 } from "log-update";
|
|
14082
14367
|
|
|
14083
14368
|
// src/commands/review/renderEntries.ts
|
|
14084
14369
|
var SPINNER_FRAMES = [
|
|
@@ -14115,7 +14400,7 @@ function renderEntry(entry, frame) {
|
|
|
14115
14400
|
var TICK_MS = 80;
|
|
14116
14401
|
var MultiSpinner = class {
|
|
14117
14402
|
entries = [];
|
|
14118
|
-
log =
|
|
14403
|
+
log = createLogUpdate2(process.stdout);
|
|
14119
14404
|
timer;
|
|
14120
14405
|
frame = 0;
|
|
14121
14406
|
finished = false;
|
|
@@ -14475,7 +14760,7 @@ function reportReviewerToolUse(name, use, spinner) {
|
|
|
14475
14760
|
}
|
|
14476
14761
|
|
|
14477
14762
|
// src/commands/review/runStreamingChild.ts
|
|
14478
|
-
import { spawn as
|
|
14763
|
+
import { spawn as spawn7 } from "child_process";
|
|
14479
14764
|
|
|
14480
14765
|
// src/commands/review/attachLineParser.ts
|
|
14481
14766
|
function flushBuffer(buffer, onLine) {
|
|
@@ -14626,7 +14911,7 @@ function writeStdinSafely(child, payload) {
|
|
|
14626
14911
|
}
|
|
14627
14912
|
}
|
|
14628
14913
|
function startChild(spec) {
|
|
14629
|
-
const child =
|
|
14914
|
+
const child = spawn7(spec.command, spec.args, {
|
|
14630
14915
|
stdio: ["pipe", "pipe", "pipe"],
|
|
14631
14916
|
shell: process.platform === "win32"
|
|
14632
14917
|
});
|
|
@@ -15071,7 +15356,7 @@ function registerReview(program2) {
|
|
|
15071
15356
|
}
|
|
15072
15357
|
|
|
15073
15358
|
// src/commands/seq/seqAuth.ts
|
|
15074
|
-
import
|
|
15359
|
+
import chalk148 from "chalk";
|
|
15075
15360
|
|
|
15076
15361
|
// src/commands/seq/loadConnections.ts
|
|
15077
15362
|
function loadConnections2() {
|
|
@@ -15100,10 +15385,10 @@ function setDefaultConnection(name) {
|
|
|
15100
15385
|
}
|
|
15101
15386
|
|
|
15102
15387
|
// src/shared/assertUniqueName.ts
|
|
15103
|
-
import
|
|
15388
|
+
import chalk147 from "chalk";
|
|
15104
15389
|
function assertUniqueName(existingNames, name) {
|
|
15105
15390
|
if (existingNames.includes(name)) {
|
|
15106
|
-
console.error(
|
|
15391
|
+
console.error(chalk147.red(`Connection "${name}" already exists.`));
|
|
15107
15392
|
process.exit(1);
|
|
15108
15393
|
}
|
|
15109
15394
|
}
|
|
@@ -15121,16 +15406,16 @@ async function promptConnection2(existingNames) {
|
|
|
15121
15406
|
var seqAuth = createConnectionAuth({
|
|
15122
15407
|
load: loadConnections2,
|
|
15123
15408
|
save: saveConnections2,
|
|
15124
|
-
format: (c) => `${
|
|
15409
|
+
format: (c) => `${chalk148.bold(c.name)} ${c.url}`,
|
|
15125
15410
|
promptNew: promptConnection2,
|
|
15126
15411
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
15127
15412
|
});
|
|
15128
15413
|
|
|
15129
15414
|
// src/commands/seq/seqQuery.ts
|
|
15130
|
-
import
|
|
15415
|
+
import chalk152 from "chalk";
|
|
15131
15416
|
|
|
15132
15417
|
// src/commands/seq/fetchSeq.ts
|
|
15133
|
-
import
|
|
15418
|
+
import chalk149 from "chalk";
|
|
15134
15419
|
async function fetchSeq(conn, path54, params) {
|
|
15135
15420
|
const url = `${conn.url}${path54}?${params}`;
|
|
15136
15421
|
const response = await fetch(url, {
|
|
@@ -15141,7 +15426,7 @@ async function fetchSeq(conn, path54, params) {
|
|
|
15141
15426
|
});
|
|
15142
15427
|
if (!response.ok) {
|
|
15143
15428
|
const body = await response.text();
|
|
15144
|
-
console.error(
|
|
15429
|
+
console.error(chalk149.red(`Seq returned ${response.status}: ${body}`));
|
|
15145
15430
|
process.exit(1);
|
|
15146
15431
|
}
|
|
15147
15432
|
return response;
|
|
@@ -15196,23 +15481,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
15196
15481
|
}
|
|
15197
15482
|
|
|
15198
15483
|
// src/commands/seq/formatEvent.ts
|
|
15199
|
-
import
|
|
15484
|
+
import chalk150 from "chalk";
|
|
15200
15485
|
function levelColor(level) {
|
|
15201
15486
|
switch (level) {
|
|
15202
15487
|
case "Fatal":
|
|
15203
|
-
return
|
|
15488
|
+
return chalk150.bgRed.white;
|
|
15204
15489
|
case "Error":
|
|
15205
|
-
return
|
|
15490
|
+
return chalk150.red;
|
|
15206
15491
|
case "Warning":
|
|
15207
|
-
return
|
|
15492
|
+
return chalk150.yellow;
|
|
15208
15493
|
case "Information":
|
|
15209
|
-
return
|
|
15494
|
+
return chalk150.cyan;
|
|
15210
15495
|
case "Debug":
|
|
15211
|
-
return
|
|
15496
|
+
return chalk150.gray;
|
|
15212
15497
|
case "Verbose":
|
|
15213
|
-
return
|
|
15498
|
+
return chalk150.dim;
|
|
15214
15499
|
default:
|
|
15215
|
-
return
|
|
15500
|
+
return chalk150.white;
|
|
15216
15501
|
}
|
|
15217
15502
|
}
|
|
15218
15503
|
function levelAbbrev(level) {
|
|
@@ -15253,12 +15538,12 @@ function formatTimestamp(iso) {
|
|
|
15253
15538
|
function formatEvent(event) {
|
|
15254
15539
|
const color = levelColor(event.Level);
|
|
15255
15540
|
const abbrev = levelAbbrev(event.Level);
|
|
15256
|
-
const ts8 =
|
|
15541
|
+
const ts8 = chalk150.dim(formatTimestamp(event.Timestamp));
|
|
15257
15542
|
const msg = renderMessage(event);
|
|
15258
15543
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
15259
15544
|
if (event.Exception) {
|
|
15260
15545
|
for (const line of event.Exception.split("\n")) {
|
|
15261
|
-
lines.push(
|
|
15546
|
+
lines.push(chalk150.red(` ${line}`));
|
|
15262
15547
|
}
|
|
15263
15548
|
}
|
|
15264
15549
|
return lines.join("\n");
|
|
@@ -15291,11 +15576,11 @@ function rejectTimestampFilter(filter) {
|
|
|
15291
15576
|
}
|
|
15292
15577
|
|
|
15293
15578
|
// src/shared/resolveNamedConnection.ts
|
|
15294
|
-
import
|
|
15579
|
+
import chalk151 from "chalk";
|
|
15295
15580
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
15296
15581
|
if (connections.length === 0) {
|
|
15297
15582
|
console.error(
|
|
15298
|
-
|
|
15583
|
+
chalk151.red(
|
|
15299
15584
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
15300
15585
|
)
|
|
15301
15586
|
);
|
|
@@ -15304,7 +15589,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
15304
15589
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
15305
15590
|
const connection = connections.find((c) => c.name === target);
|
|
15306
15591
|
if (!connection) {
|
|
15307
|
-
console.error(
|
|
15592
|
+
console.error(chalk151.red(`${kind} connection "${target}" not found.`));
|
|
15308
15593
|
process.exit(1);
|
|
15309
15594
|
}
|
|
15310
15595
|
return connection;
|
|
@@ -15333,7 +15618,7 @@ async function seqQuery(filter, options2) {
|
|
|
15333
15618
|
new URLSearchParams({ filter, count: String(count6) })
|
|
15334
15619
|
);
|
|
15335
15620
|
if (events.length === 0) {
|
|
15336
|
-
console.log(
|
|
15621
|
+
console.log(chalk152.yellow("No events found."));
|
|
15337
15622
|
return;
|
|
15338
15623
|
}
|
|
15339
15624
|
if (options2.json) {
|
|
@@ -15344,11 +15629,11 @@ async function seqQuery(filter, options2) {
|
|
|
15344
15629
|
for (const event of chronological) {
|
|
15345
15630
|
console.log(formatEvent(event));
|
|
15346
15631
|
}
|
|
15347
|
-
console.log(
|
|
15632
|
+
console.log(chalk152.dim(`
|
|
15348
15633
|
${events.length} events`));
|
|
15349
15634
|
if (events.length >= count6) {
|
|
15350
15635
|
console.log(
|
|
15351
|
-
|
|
15636
|
+
chalk152.yellow(
|
|
15352
15637
|
`Results limited to ${count6}. Use --count to retrieve more.`
|
|
15353
15638
|
)
|
|
15354
15639
|
);
|
|
@@ -15356,10 +15641,10 @@ ${events.length} events`));
|
|
|
15356
15641
|
}
|
|
15357
15642
|
|
|
15358
15643
|
// src/shared/setNamedDefaultConnection.ts
|
|
15359
|
-
import
|
|
15644
|
+
import chalk153 from "chalk";
|
|
15360
15645
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
15361
15646
|
if (!connections.find((c) => c.name === name)) {
|
|
15362
|
-
console.error(
|
|
15647
|
+
console.error(chalk153.red(`Connection "${name}" not found.`));
|
|
15363
15648
|
process.exit(1);
|
|
15364
15649
|
}
|
|
15365
15650
|
setDefault(name);
|
|
@@ -15407,7 +15692,7 @@ function registerSignal(program2) {
|
|
|
15407
15692
|
}
|
|
15408
15693
|
|
|
15409
15694
|
// src/commands/sql/sqlAuth.ts
|
|
15410
|
-
import
|
|
15695
|
+
import chalk155 from "chalk";
|
|
15411
15696
|
|
|
15412
15697
|
// src/commands/sql/loadConnections.ts
|
|
15413
15698
|
function loadConnections3() {
|
|
@@ -15436,7 +15721,7 @@ function setDefaultConnection2(name) {
|
|
|
15436
15721
|
}
|
|
15437
15722
|
|
|
15438
15723
|
// src/commands/sql/promptConnection.ts
|
|
15439
|
-
import
|
|
15724
|
+
import chalk154 from "chalk";
|
|
15440
15725
|
async function promptConnection3(existingNames) {
|
|
15441
15726
|
const name = await promptInput("name", "Connection name:", "default");
|
|
15442
15727
|
assertUniqueName(existingNames, name);
|
|
@@ -15444,7 +15729,7 @@ async function promptConnection3(existingNames) {
|
|
|
15444
15729
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
15445
15730
|
const port = Number.parseInt(portStr, 10);
|
|
15446
15731
|
if (!Number.isFinite(port)) {
|
|
15447
|
-
console.error(
|
|
15732
|
+
console.error(chalk154.red(`Invalid port "${portStr}".`));
|
|
15448
15733
|
process.exit(1);
|
|
15449
15734
|
}
|
|
15450
15735
|
const user = await promptInput("user", "User:");
|
|
@@ -15457,13 +15742,13 @@ async function promptConnection3(existingNames) {
|
|
|
15457
15742
|
var sqlAuth = createConnectionAuth({
|
|
15458
15743
|
load: loadConnections3,
|
|
15459
15744
|
save: saveConnections3,
|
|
15460
|
-
format: (c) => `${
|
|
15745
|
+
format: (c) => `${chalk155.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
15461
15746
|
promptNew: promptConnection3,
|
|
15462
15747
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
15463
15748
|
});
|
|
15464
15749
|
|
|
15465
15750
|
// src/commands/sql/printTable.ts
|
|
15466
|
-
import
|
|
15751
|
+
import chalk156 from "chalk";
|
|
15467
15752
|
function formatCell(value) {
|
|
15468
15753
|
if (value === null || value === void 0) return "";
|
|
15469
15754
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -15472,7 +15757,7 @@ function formatCell(value) {
|
|
|
15472
15757
|
}
|
|
15473
15758
|
function printTable(rows) {
|
|
15474
15759
|
if (rows.length === 0) {
|
|
15475
|
-
console.log(
|
|
15760
|
+
console.log(chalk156.yellow("(no rows)"));
|
|
15476
15761
|
return;
|
|
15477
15762
|
}
|
|
15478
15763
|
const columns = Object.keys(rows[0]);
|
|
@@ -15480,13 +15765,13 @@ function printTable(rows) {
|
|
|
15480
15765
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
15481
15766
|
);
|
|
15482
15767
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
15483
|
-
console.log(
|
|
15484
|
-
console.log(
|
|
15768
|
+
console.log(chalk156.dim(header));
|
|
15769
|
+
console.log(chalk156.dim("-".repeat(header.length)));
|
|
15485
15770
|
for (const row of rows) {
|
|
15486
15771
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
15487
15772
|
console.log(line);
|
|
15488
15773
|
}
|
|
15489
|
-
console.log(
|
|
15774
|
+
console.log(chalk156.dim(`
|
|
15490
15775
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
15491
15776
|
}
|
|
15492
15777
|
|
|
@@ -15546,7 +15831,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
15546
15831
|
}
|
|
15547
15832
|
|
|
15548
15833
|
// src/commands/sql/sqlMutate.ts
|
|
15549
|
-
import
|
|
15834
|
+
import chalk157 from "chalk";
|
|
15550
15835
|
|
|
15551
15836
|
// src/commands/sql/isMutation.ts
|
|
15552
15837
|
var MUTATION_KEYWORDS = [
|
|
@@ -15580,7 +15865,7 @@ function isMutation(sql4) {
|
|
|
15580
15865
|
async function sqlMutate(query, connectionName) {
|
|
15581
15866
|
if (!isMutation(query)) {
|
|
15582
15867
|
console.error(
|
|
15583
|
-
|
|
15868
|
+
chalk157.red(
|
|
15584
15869
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
15585
15870
|
)
|
|
15586
15871
|
);
|
|
@@ -15590,18 +15875,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
15590
15875
|
const pool = await sqlConnect(conn);
|
|
15591
15876
|
try {
|
|
15592
15877
|
const result = await pool.request().query(query);
|
|
15593
|
-
console.log(
|
|
15878
|
+
console.log(chalk157.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
15594
15879
|
} finally {
|
|
15595
15880
|
await pool.close();
|
|
15596
15881
|
}
|
|
15597
15882
|
}
|
|
15598
15883
|
|
|
15599
15884
|
// src/commands/sql/sqlQuery.ts
|
|
15600
|
-
import
|
|
15885
|
+
import chalk158 from "chalk";
|
|
15601
15886
|
async function sqlQuery(query, connectionName) {
|
|
15602
15887
|
if (isMutation(query)) {
|
|
15603
15888
|
console.error(
|
|
15604
|
-
|
|
15889
|
+
chalk158.red(
|
|
15605
15890
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
15606
15891
|
)
|
|
15607
15892
|
);
|
|
@@ -15616,7 +15901,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
15616
15901
|
printTable(rows);
|
|
15617
15902
|
} else {
|
|
15618
15903
|
console.log(
|
|
15619
|
-
|
|
15904
|
+
chalk158.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
15620
15905
|
);
|
|
15621
15906
|
}
|
|
15622
15907
|
} finally {
|
|
@@ -16023,8 +16308,8 @@ function buildCue(startMs, endMs, fullText) {
|
|
|
16023
16308
|
}
|
|
16024
16309
|
function parseCueLine(lines, i) {
|
|
16025
16310
|
const { startMs, endMs } = parseTimestampLine(lines[i]);
|
|
16026
|
-
const { text: text3, nextIndex } = collectTextLines(lines, i + 1);
|
|
16027
|
-
return { cue: buildCue(startMs, endMs, text3), nextIndex };
|
|
16311
|
+
const { text: text3, nextIndex: nextIndex2 } = collectTextLines(lines, i + 1);
|
|
16312
|
+
return { cue: buildCue(startMs, endMs, text3), nextIndex: nextIndex2 };
|
|
16028
16313
|
}
|
|
16029
16314
|
function isCueSeparator(line) {
|
|
16030
16315
|
return line.trim().includes("-->");
|
|
@@ -16036,9 +16321,9 @@ function skipHeader(lines) {
|
|
|
16036
16321
|
}
|
|
16037
16322
|
function processLine(cues, lines, i) {
|
|
16038
16323
|
if (!isCueSeparator(lines[i])) return i + 1;
|
|
16039
|
-
const { cue, nextIndex } = parseCueLine(lines, i);
|
|
16324
|
+
const { cue, nextIndex: nextIndex2 } = parseCueLine(lines, i);
|
|
16040
16325
|
if (cue) cues.push(cue);
|
|
16041
|
-
return
|
|
16326
|
+
return nextIndex2;
|
|
16042
16327
|
}
|
|
16043
16328
|
function parseVtt(content) {
|
|
16044
16329
|
const cues = [];
|
|
@@ -16196,14 +16481,14 @@ import {
|
|
|
16196
16481
|
import { dirname as dirname22, join as join42 } from "path";
|
|
16197
16482
|
|
|
16198
16483
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
16199
|
-
import
|
|
16484
|
+
import chalk159 from "chalk";
|
|
16200
16485
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
16201
16486
|
function validateStagedContent(filename, content) {
|
|
16202
16487
|
const firstLine = content.split("\n")[0];
|
|
16203
16488
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
16204
16489
|
if (!match) {
|
|
16205
16490
|
console.error(
|
|
16206
|
-
|
|
16491
|
+
chalk159.red(
|
|
16207
16492
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
16208
16493
|
)
|
|
16209
16494
|
);
|
|
@@ -16212,7 +16497,7 @@ function validateStagedContent(filename, content) {
|
|
|
16212
16497
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
16213
16498
|
if (!contentAfterLink) {
|
|
16214
16499
|
console.error(
|
|
16215
|
-
|
|
16500
|
+
chalk159.red(
|
|
16216
16501
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
16217
16502
|
)
|
|
16218
16503
|
);
|
|
@@ -16483,7 +16768,7 @@ function setup() {
|
|
|
16483
16768
|
}
|
|
16484
16769
|
|
|
16485
16770
|
// src/commands/voice/start.ts
|
|
16486
|
-
import { spawn as
|
|
16771
|
+
import { spawn as spawn8 } from "child_process";
|
|
16487
16772
|
import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync30 } from "fs";
|
|
16488
16773
|
import { join as join48 } from "path";
|
|
16489
16774
|
|
|
@@ -16498,11 +16783,11 @@ function buildDaemonEnv(options2) {
|
|
|
16498
16783
|
// src/commands/voice/start.ts
|
|
16499
16784
|
function spawnForeground(python, script, env) {
|
|
16500
16785
|
console.log("Starting voice daemon in foreground...");
|
|
16501
|
-
const child =
|
|
16786
|
+
const child = spawn8(python, [script], { stdio: "inherit", env });
|
|
16502
16787
|
child.on("exit", (code) => process.exit(code ?? 0));
|
|
16503
16788
|
}
|
|
16504
16789
|
function spawnBackground(python, script, env) {
|
|
16505
|
-
const child =
|
|
16790
|
+
const child = spawn8(python, [script], {
|
|
16506
16791
|
detached: true,
|
|
16507
16792
|
stdio: "ignore",
|
|
16508
16793
|
env
|
|
@@ -16609,7 +16894,7 @@ function registerVoice(program2) {
|
|
|
16609
16894
|
|
|
16610
16895
|
// src/commands/roam/auth.ts
|
|
16611
16896
|
import { randomBytes } from "crypto";
|
|
16612
|
-
import
|
|
16897
|
+
import chalk160 from "chalk";
|
|
16613
16898
|
|
|
16614
16899
|
// src/lib/openBrowser.ts
|
|
16615
16900
|
import { execSync as execSync47 } from "child_process";
|
|
@@ -16784,13 +17069,13 @@ async function auth() {
|
|
|
16784
17069
|
saveGlobalConfig(config);
|
|
16785
17070
|
const state = randomBytes(16).toString("hex");
|
|
16786
17071
|
console.log(
|
|
16787
|
-
|
|
17072
|
+
chalk160.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
16788
17073
|
);
|
|
16789
|
-
console.log(
|
|
16790
|
-
console.log(
|
|
16791
|
-
console.log(
|
|
17074
|
+
console.log(chalk160.white("http://localhost:14523/callback\n"));
|
|
17075
|
+
console.log(chalk160.blue("Opening browser for authorization..."));
|
|
17076
|
+
console.log(chalk160.dim("Waiting for authorization callback..."));
|
|
16792
17077
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
16793
|
-
console.log(
|
|
17078
|
+
console.log(chalk160.dim("Exchanging code for tokens..."));
|
|
16794
17079
|
const tokens = await exchangeToken({
|
|
16795
17080
|
code,
|
|
16796
17081
|
clientId,
|
|
@@ -16806,7 +17091,7 @@ async function auth() {
|
|
|
16806
17091
|
};
|
|
16807
17092
|
saveGlobalConfig(config);
|
|
16808
17093
|
console.log(
|
|
16809
|
-
|
|
17094
|
+
chalk160.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
16810
17095
|
);
|
|
16811
17096
|
}
|
|
16812
17097
|
|
|
@@ -16979,7 +17264,7 @@ function runPreCommands(pre, cwd) {
|
|
|
16979
17264
|
}
|
|
16980
17265
|
|
|
16981
17266
|
// src/commands/run/spawnRunCommand.ts
|
|
16982
|
-
import { execFileSync as execFileSync8, spawn as
|
|
17267
|
+
import { execFileSync as execFileSync8, spawn as spawn9 } from "child_process";
|
|
16983
17268
|
import { existsSync as existsSync48 } from "fs";
|
|
16984
17269
|
import { dirname as dirname25, join as join50, resolve as resolve11 } from "path";
|
|
16985
17270
|
function resolveCommand2(command) {
|
|
@@ -16995,7 +17280,7 @@ function resolveCommand2(command) {
|
|
|
16995
17280
|
}
|
|
16996
17281
|
function spawnRunCommand(command, args, env, cwd, quiet) {
|
|
16997
17282
|
const start3 = Date.now();
|
|
16998
|
-
const child =
|
|
17283
|
+
const child = spawn9(resolveCommand2(command), args, {
|
|
16999
17284
|
stdio: quiet ? "pipe" : "inherit",
|
|
17000
17285
|
env: env ? { ...process.env, ...expandEnv(env) } : void 0,
|
|
17001
17286
|
cwd
|
|
@@ -17258,7 +17543,7 @@ import { execSync as execSync49 } from "child_process";
|
|
|
17258
17543
|
import { existsSync as existsSync50, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync32 } from "fs";
|
|
17259
17544
|
import { tmpdir as tmpdir7 } from "os";
|
|
17260
17545
|
import { join as join53, resolve as resolve13 } from "path";
|
|
17261
|
-
import
|
|
17546
|
+
import chalk161 from "chalk";
|
|
17262
17547
|
|
|
17263
17548
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
17264
17549
|
var captureWindowPs1 = `
|
|
@@ -17409,13 +17694,13 @@ function screenshot(processName) {
|
|
|
17409
17694
|
const config = loadConfig();
|
|
17410
17695
|
const outputDir = resolve13(config.screenshot.outputDir);
|
|
17411
17696
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
17412
|
-
console.log(
|
|
17697
|
+
console.log(chalk161.gray(`Capturing window for process "${processName}" ...`));
|
|
17413
17698
|
try {
|
|
17414
17699
|
runPowerShellScript(processName, outputPath);
|
|
17415
|
-
console.log(
|
|
17700
|
+
console.log(chalk161.green(`Screenshot saved: ${outputPath}`));
|
|
17416
17701
|
} catch (error) {
|
|
17417
17702
|
const msg = error instanceof Error ? error.message : String(error);
|
|
17418
|
-
console.error(
|
|
17703
|
+
console.error(chalk161.red(`Failed to capture screenshot: ${msg}`));
|
|
17419
17704
|
process.exit(1);
|
|
17420
17705
|
}
|
|
17421
17706
|
}
|
|
@@ -17523,52 +17808,6 @@ function reportStrays(pids) {
|
|
|
17523
17808
|
);
|
|
17524
17809
|
}
|
|
17525
17810
|
|
|
17526
|
-
// src/commands/sessions/daemon/stopDaemon.ts
|
|
17527
|
-
var STOP_TIMEOUT_MS = 5e3;
|
|
17528
|
-
async function stopDaemon() {
|
|
17529
|
-
let socket;
|
|
17530
|
-
try {
|
|
17531
|
-
socket = await connectToDaemon();
|
|
17532
|
-
} catch {
|
|
17533
|
-
console.log("Sessions daemon is not running");
|
|
17534
|
-
return;
|
|
17535
|
-
}
|
|
17536
|
-
socket.write(`${JSON.stringify({ type: "shutdown" })}
|
|
17537
|
-
`);
|
|
17538
|
-
if (await closedBeforeTimeout(socket)) {
|
|
17539
|
-
console.log("Sessions daemon stopped");
|
|
17540
|
-
} else {
|
|
17541
|
-
console.error(
|
|
17542
|
-
`Sessions daemon did not stop within ${STOP_TIMEOUT_MS / 1e3}s`
|
|
17543
|
-
);
|
|
17544
|
-
process.exitCode = 1;
|
|
17545
|
-
}
|
|
17546
|
-
}
|
|
17547
|
-
function closedBeforeTimeout(socket) {
|
|
17548
|
-
return new Promise((resolve16) => {
|
|
17549
|
-
const timer = setTimeout(() => {
|
|
17550
|
-
socket.destroy();
|
|
17551
|
-
resolve16(false);
|
|
17552
|
-
}, STOP_TIMEOUT_MS);
|
|
17553
|
-
socket.resume();
|
|
17554
|
-
socket.on("error", () => {
|
|
17555
|
-
});
|
|
17556
|
-
socket.once("close", () => {
|
|
17557
|
-
clearTimeout(timer);
|
|
17558
|
-
resolve16(true);
|
|
17559
|
-
});
|
|
17560
|
-
});
|
|
17561
|
-
}
|
|
17562
|
-
|
|
17563
|
-
// src/commands/sessions/daemon/restartDaemon.ts
|
|
17564
|
-
async function restartDaemon() {
|
|
17565
|
-
await stopDaemon();
|
|
17566
|
-
await ensureDaemonRunning("daemon restart");
|
|
17567
|
-
console.log(
|
|
17568
|
-
"Sessions daemon restarted; previously running claude sessions will resume"
|
|
17569
|
-
);
|
|
17570
|
-
}
|
|
17571
|
-
|
|
17572
17811
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
17573
17812
|
import { mkdirSync as mkdirSync23 } from "fs";
|
|
17574
17813
|
|
|
@@ -18741,7 +18980,7 @@ function registerDaemon(program2) {
|
|
|
18741
18980
|
|
|
18742
18981
|
// src/commands/sessions/summarise/index.ts
|
|
18743
18982
|
import * as fs31 from "fs";
|
|
18744
|
-
import
|
|
18983
|
+
import chalk162 from "chalk";
|
|
18745
18984
|
|
|
18746
18985
|
// src/commands/sessions/summarise/shared.ts
|
|
18747
18986
|
import * as fs29 from "fs";
|
|
@@ -18868,22 +19107,22 @@ ${firstMessage}`);
|
|
|
18868
19107
|
async function summarise4(options2) {
|
|
18869
19108
|
const files = await discoverSessionJsonlPaths();
|
|
18870
19109
|
if (files.length === 0) {
|
|
18871
|
-
console.log(
|
|
19110
|
+
console.log(chalk162.yellow("No sessions found."));
|
|
18872
19111
|
return;
|
|
18873
19112
|
}
|
|
18874
19113
|
const toProcess = selectCandidates(files, options2);
|
|
18875
19114
|
if (toProcess.length === 0) {
|
|
18876
|
-
console.log(
|
|
19115
|
+
console.log(chalk162.green("All sessions already summarised."));
|
|
18877
19116
|
return;
|
|
18878
19117
|
}
|
|
18879
19118
|
console.log(
|
|
18880
|
-
|
|
19119
|
+
chalk162.cyan(
|
|
18881
19120
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
18882
19121
|
)
|
|
18883
19122
|
);
|
|
18884
19123
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
18885
19124
|
console.log(
|
|
18886
|
-
|
|
19125
|
+
chalk162.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk162.yellow(`, ${failed2} skipped`) : "")
|
|
18887
19126
|
);
|
|
18888
19127
|
}
|
|
18889
19128
|
function selectCandidates(files, options2) {
|
|
@@ -18903,16 +19142,16 @@ function processSessions(files) {
|
|
|
18903
19142
|
let failed2 = 0;
|
|
18904
19143
|
for (let i = 0; i < files.length; i++) {
|
|
18905
19144
|
const file = files[i];
|
|
18906
|
-
process.stdout.write(
|
|
19145
|
+
process.stdout.write(chalk162.dim(` [${i + 1}/${files.length}] `));
|
|
18907
19146
|
const summary = summariseSession(file);
|
|
18908
19147
|
if (summary) {
|
|
18909
19148
|
writeSummary(file, summary);
|
|
18910
19149
|
succeeded++;
|
|
18911
|
-
process.stdout.write(`${
|
|
19150
|
+
process.stdout.write(`${chalk162.green("\u2713")} ${summary}
|
|
18912
19151
|
`);
|
|
18913
19152
|
} else {
|
|
18914
19153
|
failed2++;
|
|
18915
|
-
process.stdout.write(` ${
|
|
19154
|
+
process.stdout.write(` ${chalk162.yellow("skip")}
|
|
18916
19155
|
`);
|
|
18917
19156
|
}
|
|
18918
19157
|
}
|
|
@@ -18927,10 +19166,10 @@ function registerSessions(program2) {
|
|
|
18927
19166
|
}
|
|
18928
19167
|
|
|
18929
19168
|
// src/commands/statusLine.ts
|
|
18930
|
-
import
|
|
19169
|
+
import chalk164 from "chalk";
|
|
18931
19170
|
|
|
18932
19171
|
// src/commands/buildLimitsSegment.ts
|
|
18933
|
-
import
|
|
19172
|
+
import chalk163 from "chalk";
|
|
18934
19173
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
18935
19174
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
18936
19175
|
function formatTimeLeft(resetsAt) {
|
|
@@ -18953,10 +19192,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
18953
19192
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
18954
19193
|
const label2 = `${Math.round(pct)}%`;
|
|
18955
19194
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
18956
|
-
if (projected == null) return
|
|
18957
|
-
if (projected > 100) return
|
|
18958
|
-
if (projected > 75) return
|
|
18959
|
-
return
|
|
19195
|
+
if (projected == null) return chalk163.green(label2);
|
|
19196
|
+
if (projected > 100) return chalk163.red(label2);
|
|
19197
|
+
if (projected > 75) return chalk163.yellow(label2);
|
|
19198
|
+
return chalk163.green(label2);
|
|
18960
19199
|
}
|
|
18961
19200
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
18962
19201
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -18982,14 +19221,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
18982
19221
|
}
|
|
18983
19222
|
|
|
18984
19223
|
// src/commands/statusLine.ts
|
|
18985
|
-
|
|
19224
|
+
chalk164.level = 3;
|
|
18986
19225
|
function formatNumber(num) {
|
|
18987
19226
|
return num.toLocaleString("en-US");
|
|
18988
19227
|
}
|
|
18989
19228
|
function colorizePercent(pct) {
|
|
18990
19229
|
const label2 = `${Math.round(pct)}%`;
|
|
18991
|
-
if (pct > 80) return
|
|
18992
|
-
if (pct > 40) return
|
|
19230
|
+
if (pct > 80) return chalk164.red(label2);
|
|
19231
|
+
if (pct > 40) return chalk164.yellow(label2);
|
|
18993
19232
|
return label2;
|
|
18994
19233
|
}
|
|
18995
19234
|
async function statusLine() {
|
|
@@ -19012,7 +19251,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
19012
19251
|
// src/commands/sync/syncClaudeMd.ts
|
|
19013
19252
|
import * as fs32 from "fs";
|
|
19014
19253
|
import * as path50 from "path";
|
|
19015
|
-
import
|
|
19254
|
+
import chalk165 from "chalk";
|
|
19016
19255
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
19017
19256
|
const source = path50.join(claudeDir, "CLAUDE.md");
|
|
19018
19257
|
const target = path50.join(targetBase, "CLAUDE.md");
|
|
@@ -19021,12 +19260,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
19021
19260
|
const targetContent = fs32.readFileSync(target, "utf-8");
|
|
19022
19261
|
if (sourceContent !== targetContent) {
|
|
19023
19262
|
console.log(
|
|
19024
|
-
|
|
19263
|
+
chalk165.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
19025
19264
|
);
|
|
19026
19265
|
console.log();
|
|
19027
19266
|
printDiff(targetContent, sourceContent);
|
|
19028
19267
|
const confirm = options2?.yes || await promptConfirm(
|
|
19029
|
-
|
|
19268
|
+
chalk165.red("Overwrite existing CLAUDE.md?"),
|
|
19030
19269
|
false
|
|
19031
19270
|
);
|
|
19032
19271
|
if (!confirm) {
|
|
@@ -19042,7 +19281,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
19042
19281
|
// src/commands/sync/syncSettings.ts
|
|
19043
19282
|
import * as fs33 from "fs";
|
|
19044
19283
|
import * as path51 from "path";
|
|
19045
|
-
import
|
|
19284
|
+
import chalk166 from "chalk";
|
|
19046
19285
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
19047
19286
|
const source = path51.join(claudeDir, "settings.json");
|
|
19048
19287
|
const target = path51.join(targetBase, "settings.json");
|
|
@@ -19058,14 +19297,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
19058
19297
|
if (mergedContent !== normalizedTarget) {
|
|
19059
19298
|
if (!options2?.yes) {
|
|
19060
19299
|
console.log(
|
|
19061
|
-
|
|
19300
|
+
chalk166.yellow(
|
|
19062
19301
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
19063
19302
|
)
|
|
19064
19303
|
);
|
|
19065
19304
|
console.log();
|
|
19066
19305
|
printDiff(targetContent, mergedContent);
|
|
19067
19306
|
const confirm = await promptConfirm(
|
|
19068
|
-
|
|
19307
|
+
chalk166.red("Overwrite existing settings.json?"),
|
|
19069
19308
|
false
|
|
19070
19309
|
);
|
|
19071
19310
|
if (!confirm) {
|