@staff0rd/assist 0.489.1 → 0.489.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/sessions/web/bundle.js +324 -324
- package/dist/index.js +641 -624
- 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.489.
|
|
9
|
+
version: "0.489.2",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -8073,7 +8073,7 @@ async function next(options2, startId) {
|
|
|
8073
8073
|
}
|
|
8074
8074
|
|
|
8075
8075
|
// src/commands/backlog/phaseDone.ts
|
|
8076
|
-
import
|
|
8076
|
+
import chalk49 from "chalk";
|
|
8077
8077
|
|
|
8078
8078
|
// src/commands/backlog/checkSubtasksComplete.ts
|
|
8079
8079
|
import chalk47 from "chalk";
|
|
@@ -8091,16 +8091,33 @@ function checkSubtasksComplete(item) {
|
|
|
8091
8091
|
return false;
|
|
8092
8092
|
}
|
|
8093
8093
|
|
|
8094
|
+
// src/commands/backlog/parsePhaseNumber.ts
|
|
8095
|
+
import chalk48 from "chalk";
|
|
8096
|
+
function parsePhaseNumber(phase) {
|
|
8097
|
+
const trimmed = phase.trim();
|
|
8098
|
+
if (!/^\d+$/.test(trimmed) || Number.parseInt(trimmed, 10) < 1) {
|
|
8099
|
+
console.log(
|
|
8100
|
+
chalk48.red(
|
|
8101
|
+
`Invalid phase "${phase}". <phase> must be a phase number (1-based), not a phase name.`
|
|
8102
|
+
)
|
|
8103
|
+
);
|
|
8104
|
+
process.exitCode = 1;
|
|
8105
|
+
return void 0;
|
|
8106
|
+
}
|
|
8107
|
+
return Number.parseInt(trimmed, 10);
|
|
8108
|
+
}
|
|
8109
|
+
|
|
8094
8110
|
// src/commands/backlog/phaseDone.ts
|
|
8095
8111
|
async function phaseDone(id, phase, summary) {
|
|
8096
|
-
const phaseNumber =
|
|
8112
|
+
const phaseNumber = parsePhaseNumber(phase);
|
|
8113
|
+
if (phaseNumber === void 0) return;
|
|
8097
8114
|
const phaseIndex = phaseNumber - 1;
|
|
8098
8115
|
const itemId2 = parseItemId(id);
|
|
8099
8116
|
const label2 = formatItemId(itemId2);
|
|
8100
8117
|
const { orm } = await getReady();
|
|
8101
8118
|
const item = await loadItem(orm, itemId2);
|
|
8102
8119
|
if (item === void 0) {
|
|
8103
|
-
console.log(
|
|
8120
|
+
console.log(chalk49.red(`Item ${label2} not found.`));
|
|
8104
8121
|
return;
|
|
8105
8122
|
}
|
|
8106
8123
|
function signal() {
|
|
@@ -8113,7 +8130,7 @@ async function phaseDone(id, phase, summary) {
|
|
|
8113
8130
|
if (item.status === "done") {
|
|
8114
8131
|
signal();
|
|
8115
8132
|
console.log(
|
|
8116
|
-
|
|
8133
|
+
chalk49.dim(`Item ${label2} already done, skipping phase advance.`)
|
|
8117
8134
|
);
|
|
8118
8135
|
return;
|
|
8119
8136
|
}
|
|
@@ -8129,24 +8146,24 @@ async function phaseDone(id, phase, summary) {
|
|
|
8129
8146
|
await setCurrentPhase(id, phaseNumber + 1);
|
|
8130
8147
|
signal();
|
|
8131
8148
|
console.log(
|
|
8132
|
-
|
|
8149
|
+
chalk49.green(`Phase ${phaseNumber} of item ${label2} marked as complete.`)
|
|
8133
8150
|
);
|
|
8134
8151
|
}
|
|
8135
8152
|
|
|
8136
8153
|
// src/commands/backlog/plan.ts
|
|
8137
|
-
import
|
|
8154
|
+
import chalk50 from "chalk";
|
|
8138
8155
|
async function plan(id) {
|
|
8139
8156
|
const found = await findOneItem(id);
|
|
8140
8157
|
if (!found) return;
|
|
8141
8158
|
const { item } = found;
|
|
8142
8159
|
if (!item.plan || item.plan.length === 0) {
|
|
8143
|
-
console.log(
|
|
8160
|
+
console.log(chalk50.dim("No plan defined for this item."));
|
|
8144
8161
|
return;
|
|
8145
8162
|
}
|
|
8146
|
-
console.log(
|
|
8163
|
+
console.log(chalk50.bold(item.name));
|
|
8147
8164
|
console.log();
|
|
8148
8165
|
for (const [i, phase] of item.plan.entries()) {
|
|
8149
|
-
console.log(`${
|
|
8166
|
+
console.log(`${chalk50.bold(`Phase ${i + 1}:`)} ${phase.name}`);
|
|
8150
8167
|
for (const task of phase.tasks) {
|
|
8151
8168
|
console.log(` - ${task.task}`);
|
|
8152
8169
|
}
|
|
@@ -8155,15 +8172,15 @@ async function plan(id) {
|
|
|
8155
8172
|
}
|
|
8156
8173
|
|
|
8157
8174
|
// src/commands/backlog/show/index.ts
|
|
8158
|
-
import
|
|
8175
|
+
import chalk57 from "chalk";
|
|
8159
8176
|
|
|
8160
8177
|
// src/commands/backlog/formatComment.ts
|
|
8161
|
-
import
|
|
8178
|
+
import chalk51 from "chalk";
|
|
8162
8179
|
function formatComment(entry) {
|
|
8163
|
-
const id = entry.id !== void 0 ?
|
|
8164
|
-
const tag = entry.type === "summary" ?
|
|
8165
|
-
const phase = entry.phase !== void 0 ?
|
|
8166
|
-
const time =
|
|
8180
|
+
const id = entry.id !== void 0 ? chalk51.dim(`#${entry.id} `) : "";
|
|
8181
|
+
const tag = entry.type === "summary" ? chalk51.magenta("[summary]") : chalk51.cyan("[comment]");
|
|
8182
|
+
const phase = entry.phase !== void 0 ? chalk51.dim(` (phase ${entry.phase})`) : "";
|
|
8183
|
+
const time = chalk51.dim(entry.timestamp);
|
|
8167
8184
|
return `${id}${tag}${phase} ${time}
|
|
8168
8185
|
${entry.text}`;
|
|
8169
8186
|
}
|
|
@@ -8200,7 +8217,7 @@ function shortenGithubIssue(githubIssue, origin) {
|
|
|
8200
8217
|
}
|
|
8201
8218
|
|
|
8202
8219
|
// src/commands/backlog/show/printActivity.ts
|
|
8203
|
-
import
|
|
8220
|
+
import chalk52 from "chalk";
|
|
8204
8221
|
|
|
8205
8222
|
// src/commands/backlog/groupActivityRefs.ts
|
|
8206
8223
|
var ACTIVITY_COMMIT_LIMIT = 10;
|
|
@@ -8218,8 +8235,8 @@ function groupActivityRefs(refs, commitLimit = ACTIVITY_COMMIT_LIMIT) {
|
|
|
8218
8235
|
|
|
8219
8236
|
// src/commands/backlog/show/printActivity.ts
|
|
8220
8237
|
function printRef(label2, text17, ref) {
|
|
8221
|
-
const url = ref.url ? ` ${
|
|
8222
|
-
console.log(` ${
|
|
8238
|
+
const url = ref.url ? ` ${chalk52.dim(ref.url)}` : "";
|
|
8239
|
+
console.log(` ${chalk52.cyan(label2)} ${text17}${url}`);
|
|
8223
8240
|
}
|
|
8224
8241
|
function printActivity(item, options2 = {}) {
|
|
8225
8242
|
const { branches, commits: commits2, overflowCommits, prs: prs2, slacks } = groupActivityRefs(
|
|
@@ -8228,7 +8245,7 @@ function printActivity(item, options2 = {}) {
|
|
|
8228
8245
|
);
|
|
8229
8246
|
if (branches.length + commits2.length + prs2.length + slacks.length === 0)
|
|
8230
8247
|
return;
|
|
8231
|
-
console.log(
|
|
8248
|
+
console.log(chalk52.bold("Activity"));
|
|
8232
8249
|
for (const branch2 of branches) {
|
|
8233
8250
|
printRef("branch", branch2.ref, branch2);
|
|
8234
8251
|
}
|
|
@@ -8238,12 +8255,12 @@ function printActivity(item, options2 = {}) {
|
|
|
8238
8255
|
}
|
|
8239
8256
|
if (overflowCommits.length > 0) {
|
|
8240
8257
|
console.log(
|
|
8241
|
-
` ${
|
|
8258
|
+
` ${chalk52.dim(`\u2026 and ${overflowCommits.length} more commits (--all-commits to show)`)}`
|
|
8242
8259
|
);
|
|
8243
8260
|
}
|
|
8244
8261
|
for (const pr of prs2) {
|
|
8245
8262
|
const title = pr.title ? ` ${pr.title}` : "";
|
|
8246
|
-
const state = pr.state ? ` ${
|
|
8263
|
+
const state = pr.state ? ` ${chalk52.dim(`(${pr.state.toLowerCase()})`)}` : "";
|
|
8247
8264
|
printRef("pr", `#${pr.ref}${title}${state}`, pr);
|
|
8248
8265
|
}
|
|
8249
8266
|
for (const slack of slacks) {
|
|
@@ -8253,7 +8270,7 @@ function printActivity(item, options2 = {}) {
|
|
|
8253
8270
|
}
|
|
8254
8271
|
|
|
8255
8272
|
// src/commands/backlog/show/printLinks.ts
|
|
8256
|
-
import
|
|
8273
|
+
import chalk53 from "chalk";
|
|
8257
8274
|
|
|
8258
8275
|
// src/commands/backlog/show/loadLinkTargets.ts
|
|
8259
8276
|
import { inArray as inArray2 } from "drizzle-orm";
|
|
@@ -8275,17 +8292,17 @@ async function printLinks(orm, item) {
|
|
|
8275
8292
|
orm,
|
|
8276
8293
|
links2.map((l) => l.targetId)
|
|
8277
8294
|
);
|
|
8278
|
-
console.log(
|
|
8295
|
+
console.log(chalk53.bold("Links"));
|
|
8279
8296
|
for (const link3 of links2) {
|
|
8280
8297
|
const target = targets.find((i) => i.id === link3.targetId);
|
|
8281
|
-
const typeLabel2 = link3.type === "depends-on" ?
|
|
8298
|
+
const typeLabel2 = link3.type === "depends-on" ? chalk53.red("depends-on") : chalk53.blue("relates-to");
|
|
8282
8299
|
if (target) {
|
|
8283
8300
|
console.log(
|
|
8284
|
-
` ${typeLabel2} ${formatItemId(target.id)} ${target.name} ${
|
|
8301
|
+
` ${typeLabel2} ${formatItemId(target.id)} ${target.name} ${chalk53.dim(`(${target.status})`)}`
|
|
8285
8302
|
);
|
|
8286
8303
|
} else {
|
|
8287
8304
|
console.log(
|
|
8288
|
-
` ${typeLabel2} ${formatItemId(link3.targetId)} ${
|
|
8305
|
+
` ${typeLabel2} ${formatItemId(link3.targetId)} ${chalk53.dim("(not found)")}`
|
|
8289
8306
|
);
|
|
8290
8307
|
}
|
|
8291
8308
|
}
|
|
@@ -8293,18 +8310,18 @@ async function printLinks(orm, item) {
|
|
|
8293
8310
|
}
|
|
8294
8311
|
|
|
8295
8312
|
// src/commands/backlog/show/printPlan.ts
|
|
8296
|
-
import
|
|
8313
|
+
import chalk55 from "chalk";
|
|
8297
8314
|
|
|
8298
8315
|
// src/commands/backlog/show/printPhaseTasks.ts
|
|
8299
|
-
import
|
|
8316
|
+
import chalk54 from "chalk";
|
|
8300
8317
|
function printPhaseTasks(phase) {
|
|
8301
8318
|
for (const task of phase.tasks) {
|
|
8302
8319
|
console.log(` - ${task.task}`);
|
|
8303
8320
|
}
|
|
8304
8321
|
if (phase.manualChecks && phase.manualChecks.length > 0) {
|
|
8305
|
-
console.log(` ${
|
|
8322
|
+
console.log(` ${chalk54.dim("Manual checks:")}`);
|
|
8306
8323
|
for (const check2 of phase.manualChecks) {
|
|
8307
|
-
console.log(` ${
|
|
8324
|
+
console.log(` ${chalk54.dim(`- ${check2}`)}`);
|
|
8308
8325
|
}
|
|
8309
8326
|
}
|
|
8310
8327
|
}
|
|
@@ -8312,16 +8329,16 @@ function printPhaseTasks(phase) {
|
|
|
8312
8329
|
// src/commands/backlog/show/printPlan.ts
|
|
8313
8330
|
function phaseHeader(index3, name, isCurrent) {
|
|
8314
8331
|
const phaseNumber = index3 + 1;
|
|
8315
|
-
const marker = isCurrent ?
|
|
8316
|
-
const label2 = isCurrent ?
|
|
8332
|
+
const marker = isCurrent ? chalk55.green("\u25B6 ") : " ";
|
|
8333
|
+
const label2 = isCurrent ? chalk55.green.bold(`Phase ${phaseNumber}: ${name}`) : `${chalk55.bold(`Phase ${phaseNumber}:`)} ${name}`;
|
|
8317
8334
|
return `${marker}${label2}`;
|
|
8318
8335
|
}
|
|
8319
8336
|
function printPhaseSessions(sessions) {
|
|
8320
8337
|
if (sessions.length === 0) return;
|
|
8321
|
-
console.log(` ${
|
|
8338
|
+
console.log(` ${chalk55.dim("Sessions:")}`);
|
|
8322
8339
|
for (const s of sessions) {
|
|
8323
8340
|
console.log(
|
|
8324
|
-
` ${
|
|
8341
|
+
` ${chalk55.dim(`- ${s.hostname} / ${s.osUser} / ${s.claudeSessionId}`)}`
|
|
8325
8342
|
);
|
|
8326
8343
|
}
|
|
8327
8344
|
}
|
|
@@ -8341,7 +8358,7 @@ function printReviewSessions(item, planLength) {
|
|
|
8341
8358
|
}
|
|
8342
8359
|
function printPlan(item) {
|
|
8343
8360
|
if (!item.plan || item.plan.length === 0) return;
|
|
8344
|
-
console.log(
|
|
8361
|
+
console.log(chalk55.bold("Plan"));
|
|
8345
8362
|
for (const [i, phase] of item.plan.entries()) {
|
|
8346
8363
|
const isCurrent = item.currentPhase === i + 1;
|
|
8347
8364
|
const sessions = (item.phaseSessions ?? []).filter((s) => s.phaseIdx === i);
|
|
@@ -8352,13 +8369,13 @@ function printPlan(item) {
|
|
|
8352
8369
|
}
|
|
8353
8370
|
|
|
8354
8371
|
// src/commands/backlog/show/printSubtasks.ts
|
|
8355
|
-
import
|
|
8372
|
+
import chalk56 from "chalk";
|
|
8356
8373
|
function printSubtasks(item) {
|
|
8357
8374
|
const subtasks = item.subtasks ?? [];
|
|
8358
8375
|
if (subtasks.length === 0) return;
|
|
8359
|
-
console.log(
|
|
8376
|
+
console.log(chalk56.bold("Sub-tasks"));
|
|
8360
8377
|
for (const [i, subtask] of subtasks.entries()) {
|
|
8361
|
-
const status3 =
|
|
8378
|
+
const status3 = chalk56.dim(`[${subtask.status}]`);
|
|
8362
8379
|
console.log(` ${i + 1}. ${status3} ${subtask.title}`);
|
|
8363
8380
|
if (subtask.description) {
|
|
8364
8381
|
const rendered = renderMarkdownTerminal(subtask.description);
|
|
@@ -8372,23 +8389,23 @@ function printSubtasks(item) {
|
|
|
8372
8389
|
|
|
8373
8390
|
// src/commands/backlog/show/index.ts
|
|
8374
8391
|
function printHeader(item) {
|
|
8375
|
-
console.log(
|
|
8392
|
+
console.log(chalk57.bold(`${formatItemId(item.id)} ${item.name}`));
|
|
8376
8393
|
console.log(
|
|
8377
|
-
`${
|
|
8394
|
+
`${chalk57.dim("Type:")} ${item.type} ${chalk57.dim("Status:")} ${item.status}`
|
|
8378
8395
|
);
|
|
8379
8396
|
if (item.jiraKey) {
|
|
8380
|
-
console.log(`${
|
|
8397
|
+
console.log(`${chalk57.dim("Jira:")} ${item.jiraKey}`);
|
|
8381
8398
|
}
|
|
8382
8399
|
if (item.githubIssue) {
|
|
8383
8400
|
console.log(
|
|
8384
|
-
`${
|
|
8401
|
+
`${chalk57.dim("GitHub:")} ${shortenGithubIssue(item.githubIssue, item.origin)}`
|
|
8385
8402
|
);
|
|
8386
8403
|
}
|
|
8387
8404
|
console.log();
|
|
8388
8405
|
}
|
|
8389
8406
|
function printAcceptanceCriteria(criteria) {
|
|
8390
8407
|
if (criteria.length === 0) return;
|
|
8391
|
-
console.log(
|
|
8408
|
+
console.log(chalk57.bold("Acceptance Criteria"));
|
|
8392
8409
|
for (const [i, ac] of criteria.entries()) {
|
|
8393
8410
|
console.log(` ${i + 1}. ${ac}`);
|
|
8394
8411
|
}
|
|
@@ -8397,7 +8414,7 @@ function printAcceptanceCriteria(criteria) {
|
|
|
8397
8414
|
function printComments(item) {
|
|
8398
8415
|
const entries = item.comments ?? [];
|
|
8399
8416
|
if (entries.length === 0) return;
|
|
8400
|
-
console.log(
|
|
8417
|
+
console.log(chalk57.bold("Comments"));
|
|
8401
8418
|
for (const entry of entries) {
|
|
8402
8419
|
console.log(` ${formatComment(entry)}`);
|
|
8403
8420
|
}
|
|
@@ -8409,7 +8426,7 @@ async function show(id, options2 = {}) {
|
|
|
8409
8426
|
const { orm, item } = found;
|
|
8410
8427
|
printHeader(item);
|
|
8411
8428
|
if (item.description) {
|
|
8412
|
-
console.log(
|
|
8429
|
+
console.log(chalk57.bold("Description"));
|
|
8413
8430
|
console.log(renderMarkdownTerminal(item.description));
|
|
8414
8431
|
console.log();
|
|
8415
8432
|
}
|
|
@@ -8422,7 +8439,7 @@ async function show(id, options2 = {}) {
|
|
|
8422
8439
|
}
|
|
8423
8440
|
|
|
8424
8441
|
// src/commands/sessions/web/index.ts
|
|
8425
|
-
import
|
|
8442
|
+
import chalk62 from "chalk";
|
|
8426
8443
|
import { WebSocketServer } from "ws";
|
|
8427
8444
|
|
|
8428
8445
|
// src/shared/getInstallDir.ts
|
|
@@ -8450,7 +8467,7 @@ function isGitRepo(dir) {
|
|
|
8450
8467
|
import {
|
|
8451
8468
|
createServer
|
|
8452
8469
|
} from "http";
|
|
8453
|
-
import
|
|
8470
|
+
import chalk58 from "chalk";
|
|
8454
8471
|
|
|
8455
8472
|
// src/lib/openBrowser.ts
|
|
8456
8473
|
import { execSync as execSync32 } from "child_process";
|
|
@@ -8560,8 +8577,8 @@ function startWebServer(label2, port, handler, initialPath, open = true) {
|
|
|
8560
8577
|
runHandler(handler, req, res, port);
|
|
8561
8578
|
});
|
|
8562
8579
|
server.listen(port, () => {
|
|
8563
|
-
console.log(
|
|
8564
|
-
console.log(
|
|
8580
|
+
console.log(chalk58.green(`${label2}: ${url}`));
|
|
8581
|
+
console.log(chalk58.dim("Press Ctrl+C to stop"));
|
|
8565
8582
|
if (open) {
|
|
8566
8583
|
openBrowser(url);
|
|
8567
8584
|
}
|
|
@@ -11420,25 +11437,25 @@ function withRepoCwd(line, repoCwd) {
|
|
|
11420
11437
|
}
|
|
11421
11438
|
|
|
11422
11439
|
// src/commands/sessions/web/restartMenu/installRestartMenu.ts
|
|
11423
|
-
import
|
|
11440
|
+
import chalk61 from "chalk";
|
|
11424
11441
|
import { createLogUpdate } from "log-update";
|
|
11425
11442
|
|
|
11426
11443
|
// src/commands/sessions/web/restartMenu/runRestartItem.ts
|
|
11427
|
-
import
|
|
11444
|
+
import chalk59 from "chalk";
|
|
11428
11445
|
async function runRestartItem(item, { runRestartDaemon, reExec }) {
|
|
11429
11446
|
if (item.disabled) return;
|
|
11430
11447
|
try {
|
|
11431
11448
|
if (item.action === "restart-daemon" || item.action === "restart-both") {
|
|
11432
|
-
console.log(
|
|
11449
|
+
console.log(chalk59.cyan("Restarting sessions daemon\u2026"));
|
|
11433
11450
|
await runRestartDaemon();
|
|
11434
11451
|
}
|
|
11435
11452
|
if (item.action === "restart-webserver" || item.action === "restart-both") {
|
|
11436
|
-
console.log(
|
|
11453
|
+
console.log(chalk59.cyan("Restarting web server\u2026"));
|
|
11437
11454
|
reExec();
|
|
11438
11455
|
}
|
|
11439
11456
|
} catch (error) {
|
|
11440
11457
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
11441
|
-
console.error(
|
|
11458
|
+
console.error(chalk59.red(`Restart failed: ${message3}`));
|
|
11442
11459
|
}
|
|
11443
11460
|
}
|
|
11444
11461
|
|
|
@@ -11520,20 +11537,20 @@ function firstEnabledIndex(items2) {
|
|
|
11520
11537
|
}
|
|
11521
11538
|
|
|
11522
11539
|
// src/commands/sessions/web/restartMenu/renderRestartMenu.ts
|
|
11523
|
-
import
|
|
11540
|
+
import chalk60 from "chalk";
|
|
11524
11541
|
function renderRestartMenu(items2, selected) {
|
|
11525
|
-
const lines2 = [
|
|
11542
|
+
const lines2 = [chalk60.bold.cyan("assist \u2014 restart menu")];
|
|
11526
11543
|
items2.forEach((item, i) => {
|
|
11527
11544
|
const active = i === selected;
|
|
11528
|
-
const pointer = active ?
|
|
11529
|
-
const number =
|
|
11530
|
-
const note = item.note ?
|
|
11545
|
+
const pointer = active ? chalk60.cyan("\u276F ") : " ";
|
|
11546
|
+
const number = chalk60.dim(`${i + 1}. `);
|
|
11547
|
+
const note = item.note ? chalk60.dim(` (${item.note})`) : "";
|
|
11531
11548
|
let label2 = item.label;
|
|
11532
|
-
if (item.disabled) label2 =
|
|
11533
|
-
else if (active) label2 =
|
|
11549
|
+
if (item.disabled) label2 = chalk60.dim(label2);
|
|
11550
|
+
else if (active) label2 = chalk60.cyan.bold(label2);
|
|
11534
11551
|
lines2.push(`${pointer}${number}${label2}${note}`);
|
|
11535
11552
|
});
|
|
11536
|
-
lines2.push(
|
|
11553
|
+
lines2.push(chalk60.dim("\u2191/\u2193 move \xB7 1-3 jump \xB7 enter select \xB7 esc close"));
|
|
11537
11554
|
return lines2.join("\n");
|
|
11538
11555
|
}
|
|
11539
11556
|
|
|
@@ -11627,7 +11644,7 @@ function installRestartMenu(options2 = {}) {
|
|
|
11627
11644
|
}
|
|
11628
11645
|
});
|
|
11629
11646
|
const restoreRaw = enableRawMode(stdin, handler);
|
|
11630
|
-
console.log(
|
|
11647
|
+
console.log(chalk61.dim("Press Ctrl+R for the restart menu"));
|
|
11631
11648
|
let cleaned = false;
|
|
11632
11649
|
function cleanup() {
|
|
11633
11650
|
if (cleaned) return;
|
|
@@ -11712,7 +11729,7 @@ async function web(options2) {
|
|
|
11712
11729
|
streamDaemonLogs();
|
|
11713
11730
|
void ensureDaemonRunning("web server start").catch((error) => {
|
|
11714
11731
|
console.error(
|
|
11715
|
-
|
|
11732
|
+
chalk62.yellow(
|
|
11716
11733
|
`sessions daemon not ready yet, will retry on connection: ${error instanceof Error ? error.message : String(error)}`
|
|
11717
11734
|
)
|
|
11718
11735
|
);
|
|
@@ -11748,12 +11765,12 @@ var backlogConfigHelp = [
|
|
|
11748
11765
|
];
|
|
11749
11766
|
|
|
11750
11767
|
// src/commands/backlog/addActivity.ts
|
|
11751
|
-
import
|
|
11768
|
+
import chalk63 from "chalk";
|
|
11752
11769
|
async function addActivity(id, kind, ref, options2) {
|
|
11753
11770
|
const parsedKind = gitRefKindSchema.safeParse(kind);
|
|
11754
11771
|
if (!parsedKind.success) {
|
|
11755
11772
|
console.log(
|
|
11756
|
-
|
|
11773
|
+
chalk63.red(
|
|
11757
11774
|
`Invalid kind "${kind}". Expected one of: ${gitRefKindSchema.options.join(", ")}.`
|
|
11758
11775
|
)
|
|
11759
11776
|
);
|
|
@@ -11775,7 +11792,7 @@ async function addActivity(id, kind, ref, options2) {
|
|
|
11775
11792
|
state: options2.state
|
|
11776
11793
|
});
|
|
11777
11794
|
console.log(
|
|
11778
|
-
|
|
11795
|
+
chalk63.green(
|
|
11779
11796
|
`Attached ${parsedKind.data} "${ref}" to item ${formatItemId(item.id)}.`
|
|
11780
11797
|
)
|
|
11781
11798
|
);
|
|
@@ -11799,11 +11816,11 @@ function registerActivityCommands(cmd) {
|
|
|
11799
11816
|
}
|
|
11800
11817
|
|
|
11801
11818
|
// src/commands/backlog/associate-github/index.ts
|
|
11802
|
-
import
|
|
11819
|
+
import chalk65 from "chalk";
|
|
11803
11820
|
import { eq as eq21 } from "drizzle-orm";
|
|
11804
11821
|
|
|
11805
11822
|
// src/commands/backlog/beginAssociation.ts
|
|
11806
|
-
import
|
|
11823
|
+
import chalk64 from "chalk";
|
|
11807
11824
|
import { eq as eq20 } from "drizzle-orm";
|
|
11808
11825
|
async function beginAssociation(id, options2, clearPatch, label2) {
|
|
11809
11826
|
const found = await findOneItem(id);
|
|
@@ -11816,7 +11833,7 @@ async function beginAssociation(id, options2, clearPatch, label2) {
|
|
|
11816
11833
|
if (options2.clear) {
|
|
11817
11834
|
await orm.update(items).set(clearPatch).where(eq20(items.id, itemId2));
|
|
11818
11835
|
console.log(
|
|
11819
|
-
|
|
11836
|
+
chalk64.green(
|
|
11820
11837
|
`Cleared ${label2} association on item ${formatItemId(itemId2)}.`
|
|
11821
11838
|
)
|
|
11822
11839
|
);
|
|
@@ -11866,7 +11883,7 @@ async function associateGithub(id, issue, options2) {
|
|
|
11866
11883
|
const { orm, itemId: itemId2 } = target;
|
|
11867
11884
|
if (!issue) {
|
|
11868
11885
|
console.log(
|
|
11869
|
-
|
|
11886
|
+
chalk65.red("Provide a GitHub issue, or use --clear to remove one.")
|
|
11870
11887
|
);
|
|
11871
11888
|
process.exitCode = 1;
|
|
11872
11889
|
return;
|
|
@@ -11874,7 +11891,7 @@ async function associateGithub(id, issue, options2) {
|
|
|
11874
11891
|
const normalized = normalizeGithubIssue(issue);
|
|
11875
11892
|
if (!normalized) {
|
|
11876
11893
|
console.log(
|
|
11877
|
-
|
|
11894
|
+
chalk65.red(
|
|
11878
11895
|
`Malformed GitHub issue "${issue}". Expected owner/repo#number or a github.com issue URL.`
|
|
11879
11896
|
)
|
|
11880
11897
|
);
|
|
@@ -11884,8 +11901,8 @@ async function associateGithub(id, issue, options2) {
|
|
|
11884
11901
|
const title = fetchGithubIssueTitle(normalized);
|
|
11885
11902
|
await orm.update(items).set({ githubIssue: normalized, jiraKey: null }).where(eq21(items.id, itemId2));
|
|
11886
11903
|
console.log(
|
|
11887
|
-
|
|
11888
|
-
title ?
|
|
11904
|
+
chalk65.green(`Associated ${normalized} with item ${formatItemId(itemId2)}.`),
|
|
11905
|
+
title ? chalk65.dim(`(${title})`) : ""
|
|
11889
11906
|
);
|
|
11890
11907
|
}
|
|
11891
11908
|
|
|
@@ -11895,12 +11912,12 @@ function registerAssociateGithubCommand(cmd) {
|
|
|
11895
11912
|
}
|
|
11896
11913
|
|
|
11897
11914
|
// src/commands/backlog/associate-jira/index.ts
|
|
11898
|
-
import
|
|
11915
|
+
import chalk67 from "chalk";
|
|
11899
11916
|
import { eq as eq22 } from "drizzle-orm";
|
|
11900
11917
|
|
|
11901
11918
|
// src/commands/jira/fetchIssue.ts
|
|
11902
11919
|
import { execSync as execSync34 } from "child_process";
|
|
11903
|
-
import
|
|
11920
|
+
import chalk66 from "chalk";
|
|
11904
11921
|
function fetchIssue(issueKey, fields) {
|
|
11905
11922
|
let result;
|
|
11906
11923
|
try {
|
|
@@ -11913,15 +11930,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
11913
11930
|
const stderr = error.stderr;
|
|
11914
11931
|
if (stderr.includes("unauthorized")) {
|
|
11915
11932
|
console.error(
|
|
11916
|
-
|
|
11933
|
+
chalk66.red("Jira authentication expired."),
|
|
11917
11934
|
"Run",
|
|
11918
|
-
|
|
11935
|
+
chalk66.cyan("assist jira auth"),
|
|
11919
11936
|
"to re-authenticate."
|
|
11920
11937
|
);
|
|
11921
11938
|
process.exit(1);
|
|
11922
11939
|
}
|
|
11923
11940
|
}
|
|
11924
|
-
console.error(
|
|
11941
|
+
console.error(chalk66.red(`Failed to fetch ${issueKey}.`));
|
|
11925
11942
|
process.exit(1);
|
|
11926
11943
|
}
|
|
11927
11944
|
return JSON.parse(result);
|
|
@@ -11944,14 +11961,14 @@ async function associateJira(id, key, options2) {
|
|
|
11944
11961
|
if (!target) return;
|
|
11945
11962
|
const { orm, itemId: itemId2 } = target;
|
|
11946
11963
|
if (!key) {
|
|
11947
|
-
console.log(
|
|
11964
|
+
console.log(chalk67.red("Provide a Jira key, or use --clear to remove one."));
|
|
11948
11965
|
process.exitCode = 1;
|
|
11949
11966
|
return;
|
|
11950
11967
|
}
|
|
11951
11968
|
const normalized = normalizeJiraKey(key);
|
|
11952
11969
|
if (!normalized) {
|
|
11953
11970
|
console.log(
|
|
11954
|
-
|
|
11971
|
+
chalk67.red(
|
|
11955
11972
|
`Malformed Jira key "${key}". Expected a key like PROJ-123 or a browse URL.`
|
|
11956
11973
|
)
|
|
11957
11974
|
);
|
|
@@ -11963,8 +11980,8 @@ async function associateJira(id, key, options2) {
|
|
|
11963
11980
|
const summary = fields?.summary;
|
|
11964
11981
|
await orm.update(items).set({ jiraKey: normalized, githubIssue: null }).where(eq22(items.id, itemId2));
|
|
11965
11982
|
console.log(
|
|
11966
|
-
|
|
11967
|
-
summary ?
|
|
11983
|
+
chalk67.green(`Associated ${normalized} with item ${formatItemId(itemId2)}.`),
|
|
11984
|
+
summary ? chalk67.dim(`(${summary})`) : ""
|
|
11968
11985
|
);
|
|
11969
11986
|
}
|
|
11970
11987
|
|
|
@@ -11977,7 +11994,7 @@ function registerAssociateJiraCommand(cmd) {
|
|
|
11977
11994
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
11978
11995
|
import { existsSync as existsSync29 } from "fs";
|
|
11979
11996
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
11980
|
-
import
|
|
11997
|
+
import chalk68 from "chalk";
|
|
11981
11998
|
|
|
11982
11999
|
// src/commands/backlog/originToSshUrl.ts
|
|
11983
12000
|
function originToSshUrl(origin) {
|
|
@@ -11992,7 +12009,7 @@ function originToSshUrl(origin) {
|
|
|
11992
12009
|
|
|
11993
12010
|
// src/commands/backlog/cloneRepo.ts
|
|
11994
12011
|
function fail2(message3) {
|
|
11995
|
-
console.log(
|
|
12012
|
+
console.log(chalk68.red(message3));
|
|
11996
12013
|
process.exitCode = 1;
|
|
11997
12014
|
}
|
|
11998
12015
|
async function cloneRepo(originRaw) {
|
|
@@ -12015,7 +12032,7 @@ async function cloneRepo(originRaw) {
|
|
|
12015
12032
|
return fail2(`Clone target already exists: ${target}`);
|
|
12016
12033
|
}
|
|
12017
12034
|
await mkdir3(baseDir, { recursive: true });
|
|
12018
|
-
console.error(
|
|
12035
|
+
console.error(chalk68.dim(`Cloning ${sshUrl} into ${target}`));
|
|
12019
12036
|
const result = spawnSync2("git", ["clone", sshUrl, target], {
|
|
12020
12037
|
stdio: "inherit"
|
|
12021
12038
|
});
|
|
@@ -12027,7 +12044,7 @@ async function cloneRepo(originRaw) {
|
|
|
12027
12044
|
`git clone failed with exit code ${result.status ?? "unknown"}.`
|
|
12028
12045
|
);
|
|
12029
12046
|
}
|
|
12030
|
-
console.error(
|
|
12047
|
+
console.error(chalk68.green(`Cloned ${origin} into ${target}`));
|
|
12031
12048
|
}
|
|
12032
12049
|
|
|
12033
12050
|
// src/commands/backlog/registerCloneCommand.ts
|
|
@@ -12038,29 +12055,29 @@ function registerCloneCommand(cmd) {
|
|
|
12038
12055
|
}
|
|
12039
12056
|
|
|
12040
12057
|
// src/commands/backlog/comment/index.ts
|
|
12041
|
-
import
|
|
12058
|
+
import chalk69 from "chalk";
|
|
12042
12059
|
async function comment(id, text17) {
|
|
12043
12060
|
const found = await findOneItem(id);
|
|
12044
12061
|
if (!found) process.exit(1);
|
|
12045
12062
|
await appendComment(found.orm, found.item.id, text17);
|
|
12046
12063
|
console.log(
|
|
12047
|
-
|
|
12064
|
+
chalk69.green(`Comment added to item ${formatItemId(found.item.id)}.`)
|
|
12048
12065
|
);
|
|
12049
12066
|
}
|
|
12050
12067
|
|
|
12051
12068
|
// src/commands/backlog/comments/index.ts
|
|
12052
|
-
import
|
|
12069
|
+
import chalk70 from "chalk";
|
|
12053
12070
|
async function comments2(id) {
|
|
12054
12071
|
const found = await findOneItem(id);
|
|
12055
12072
|
if (!found) process.exit(1);
|
|
12056
12073
|
const { item } = found;
|
|
12057
12074
|
const entries = item.comments ?? [];
|
|
12058
12075
|
if (entries.length === 0) {
|
|
12059
|
-
console.log(
|
|
12076
|
+
console.log(chalk70.dim(`No comments on item ${formatItemId(item.id)}.`));
|
|
12060
12077
|
return;
|
|
12061
12078
|
}
|
|
12062
12079
|
console.log(
|
|
12063
|
-
|
|
12080
|
+
chalk70.bold(`Comments for ${formatItemId(item.id)}: ${item.name}
|
|
12064
12081
|
`)
|
|
12065
12082
|
);
|
|
12066
12083
|
for (const entry of entries) {
|
|
@@ -12070,7 +12087,7 @@ async function comments2(id) {
|
|
|
12070
12087
|
}
|
|
12071
12088
|
|
|
12072
12089
|
// src/commands/backlog/delete-comment/index.ts
|
|
12073
|
-
import
|
|
12090
|
+
import chalk71 from "chalk";
|
|
12074
12091
|
async function deleteCommentCmd(id, commentId) {
|
|
12075
12092
|
const found = await findOneItem(id);
|
|
12076
12093
|
if (!found) process.exit(1);
|
|
@@ -12083,14 +12100,14 @@ async function deleteCommentCmd(id, commentId) {
|
|
|
12083
12100
|
switch (outcome) {
|
|
12084
12101
|
case "deleted":
|
|
12085
12102
|
console.log(
|
|
12086
|
-
|
|
12103
|
+
chalk71.green(
|
|
12087
12104
|
`Comment #${commentId} deleted from item ${formatItemId(itemId2)}.`
|
|
12088
12105
|
)
|
|
12089
12106
|
);
|
|
12090
12107
|
break;
|
|
12091
12108
|
case "not-found":
|
|
12092
12109
|
console.log(
|
|
12093
|
-
|
|
12110
|
+
chalk71.red(
|
|
12094
12111
|
`Comment #${commentId} not found on item ${formatItemId(itemId2)}.`
|
|
12095
12112
|
)
|
|
12096
12113
|
);
|
|
@@ -12098,7 +12115,7 @@ async function deleteCommentCmd(id, commentId) {
|
|
|
12098
12115
|
break;
|
|
12099
12116
|
case "is-summary":
|
|
12100
12117
|
console.log(
|
|
12101
|
-
|
|
12118
|
+
chalk71.red(
|
|
12102
12119
|
`Comment #${commentId} is a phase summary and cannot be deleted.`
|
|
12103
12120
|
)
|
|
12104
12121
|
);
|
|
@@ -12123,7 +12140,7 @@ function registerExportCommand(cmd) {
|
|
|
12123
12140
|
|
|
12124
12141
|
// src/commands/backlog/import/index.ts
|
|
12125
12142
|
import { readFile as readFile2 } from "fs/promises";
|
|
12126
|
-
import
|
|
12143
|
+
import chalk73 from "chalk";
|
|
12127
12144
|
|
|
12128
12145
|
// src/commands/backlog/dump/countCopyRows.ts
|
|
12129
12146
|
function countCopyRows(data) {
|
|
@@ -12195,7 +12212,7 @@ function validateDump({ header, sections }) {
|
|
|
12195
12212
|
}
|
|
12196
12213
|
|
|
12197
12214
|
// src/commands/backlog/import/confirmReplace.ts
|
|
12198
|
-
import
|
|
12215
|
+
import chalk72 from "chalk";
|
|
12199
12216
|
async function countRows(client, table) {
|
|
12200
12217
|
const { rows } = await client.query(
|
|
12201
12218
|
`SELECT count(*)::int AS n FROM ${table}`
|
|
@@ -12206,7 +12223,7 @@ function printSummary(tables, current, incoming) {
|
|
|
12206
12223
|
const lines2 = tables.map(
|
|
12207
12224
|
(t, i) => ` ${t.name}: ${current[i]} \u2192 ${incoming[i]} rows`
|
|
12208
12225
|
);
|
|
12209
|
-
console.error(
|
|
12226
|
+
console.error(chalk72.bold("\nThis will REPLACE all backlog data:"));
|
|
12210
12227
|
console.error(`${lines2.join("\n")}
|
|
12211
12228
|
`);
|
|
12212
12229
|
}
|
|
@@ -12308,13 +12325,13 @@ async function importBacklog(file, options2 = {}) {
|
|
|
12308
12325
|
);
|
|
12309
12326
|
await withDbClient(async (client) => {
|
|
12310
12327
|
if (!options2.yes && !await confirmReplace(client, tables, incoming, !file)) {
|
|
12311
|
-
console.error(
|
|
12328
|
+
console.error(chalk73.yellow("Import cancelled; no changes made."));
|
|
12312
12329
|
return;
|
|
12313
12330
|
}
|
|
12314
12331
|
await restore(client, parsed);
|
|
12315
12332
|
const total = incoming.reduce((sum, n) => sum + n, 0);
|
|
12316
12333
|
console.error(
|
|
12317
|
-
|
|
12334
|
+
chalk73.green(
|
|
12318
12335
|
`Imported backlog: ${total} rows restored across ${tables.length} tables.`
|
|
12319
12336
|
)
|
|
12320
12337
|
);
|
|
@@ -12331,7 +12348,7 @@ function registerImportCommand(cmd) {
|
|
|
12331
12348
|
}
|
|
12332
12349
|
|
|
12333
12350
|
// src/commands/backlog/add/index.ts
|
|
12334
|
-
import
|
|
12351
|
+
import chalk75 from "chalk";
|
|
12335
12352
|
|
|
12336
12353
|
// src/lib/isClaudeCode.ts
|
|
12337
12354
|
function isClaudeCode() {
|
|
@@ -12420,11 +12437,11 @@ async function createItemWithDefaults(fields) {
|
|
|
12420
12437
|
}
|
|
12421
12438
|
|
|
12422
12439
|
// src/commands/backlog/ensureRemoteOrigin.ts
|
|
12423
|
-
import
|
|
12440
|
+
import chalk74 from "chalk";
|
|
12424
12441
|
function ensureRemoteOrigin() {
|
|
12425
12442
|
if (getRemoteOriginUrl(getBacklogDir())) return true;
|
|
12426
12443
|
console.log(
|
|
12427
|
-
|
|
12444
|
+
chalk74.red(
|
|
12428
12445
|
"Backlog requires a git remote so items get a stable origin.\nAdd one with: git remote add origin <url>"
|
|
12429
12446
|
)
|
|
12430
12447
|
);
|
|
@@ -12506,7 +12523,7 @@ async function promptAcceptanceCriteria() {
|
|
|
12506
12523
|
async function add(options2) {
|
|
12507
12524
|
if (isClaudeCode()) {
|
|
12508
12525
|
console.error(
|
|
12509
|
-
|
|
12526
|
+
chalk75.red(
|
|
12510
12527
|
"Error: 'assist backlog add' is for human use. Compose the whole item \u2014 name, type, description, acceptance criteria and every phase \u2014 and run 'assist backlog propose --json <file|->' so it is previewed and approved before anything is written."
|
|
12511
12528
|
)
|
|
12512
12529
|
);
|
|
@@ -12524,14 +12541,14 @@ async function add(options2) {
|
|
|
12524
12541
|
description,
|
|
12525
12542
|
acceptanceCriteria: acceptanceCriteria2
|
|
12526
12543
|
});
|
|
12527
|
-
console.log(
|
|
12544
|
+
console.log(chalk75.green(`Added item ${formatItemId(id)}: ${name}`));
|
|
12528
12545
|
}
|
|
12529
12546
|
|
|
12530
12547
|
// src/commands/backlog/addPhase/index.ts
|
|
12531
|
-
import
|
|
12548
|
+
import chalk77 from "chalk";
|
|
12532
12549
|
|
|
12533
12550
|
// src/commands/backlog/resolveInsertPosition.ts
|
|
12534
|
-
import
|
|
12551
|
+
import chalk76 from "chalk";
|
|
12535
12552
|
import { count as count3, eq as eq25 } from "drizzle-orm";
|
|
12536
12553
|
async function resolveInsertPosition(orm, itemId2, position) {
|
|
12537
12554
|
const [row] = await orm.select({ cnt: count3() }).from(planPhases).where(eq25(planPhases.itemId, itemId2));
|
|
@@ -12540,7 +12557,7 @@ async function resolveInsertPosition(orm, itemId2, position) {
|
|
|
12540
12557
|
const pos = Number.parseInt(position, 10);
|
|
12541
12558
|
if (pos < 1 || pos > phaseCount + 1) {
|
|
12542
12559
|
console.log(
|
|
12543
|
-
|
|
12560
|
+
chalk76.red(
|
|
12544
12561
|
`Position ${pos} is out of range. Must be between 1 and ${phaseCount + 1}.`
|
|
12545
12562
|
)
|
|
12546
12563
|
);
|
|
@@ -12681,7 +12698,7 @@ async function addPhase(id, name, options2) {
|
|
|
12681
12698
|
if (!found) return;
|
|
12682
12699
|
const tasks = options2.task ?? [];
|
|
12683
12700
|
if (tasks.length === 0) {
|
|
12684
|
-
console.log(
|
|
12701
|
+
console.log(chalk77.red("At least one --task is required."));
|
|
12685
12702
|
process.exitCode = 1;
|
|
12686
12703
|
return;
|
|
12687
12704
|
}
|
|
@@ -12705,14 +12722,14 @@ async function addPhase(id, name, options2) {
|
|
|
12705
12722
|
);
|
|
12706
12723
|
const verb = options2.position !== void 0 ? "Inserted" : "Added";
|
|
12707
12724
|
console.log(
|
|
12708
|
-
|
|
12725
|
+
chalk77.green(
|
|
12709
12726
|
`${verb} phase ${phaseIdx + 1} "${name}" to item ${formatItemId(itemId2)} with ${tasks.length} task(s).`
|
|
12710
12727
|
)
|
|
12711
12728
|
);
|
|
12712
12729
|
}
|
|
12713
12730
|
|
|
12714
12731
|
// src/commands/backlog/list/index.ts
|
|
12715
|
-
import
|
|
12732
|
+
import chalk78 from "chalk";
|
|
12716
12733
|
function filterItems(items2, options2) {
|
|
12717
12734
|
if (options2.status) return items2.filter((i) => i.status === options2.status);
|
|
12718
12735
|
if (!options2.all)
|
|
@@ -12726,19 +12743,19 @@ function repoPrefixer(items2, allRepos) {
|
|
|
12726
12743
|
);
|
|
12727
12744
|
const repoNameOf = (item) => item.origin ? labels.get(item.origin) ?? "" : "";
|
|
12728
12745
|
const width = Math.max(0, ...items2.map((i) => repoNameOf(i).length));
|
|
12729
|
-
return (item) => `${
|
|
12746
|
+
return (item) => `${chalk78.dim(repoNameOf(item).padEnd(width))} `;
|
|
12730
12747
|
}
|
|
12731
12748
|
async function list2(options2) {
|
|
12732
12749
|
const allItems = await loadBacklog(options2.allRepos);
|
|
12733
12750
|
const items2 = filterItems(allItems, options2);
|
|
12734
12751
|
if (items2.length === 0) {
|
|
12735
|
-
console.log(
|
|
12752
|
+
console.log(chalk78.dim("Backlog is empty."));
|
|
12736
12753
|
return;
|
|
12737
12754
|
}
|
|
12738
12755
|
const prefixOf = repoPrefixer(items2, !!options2.allRepos);
|
|
12739
12756
|
for (const item of items2) {
|
|
12740
12757
|
console.log(
|
|
12741
|
-
`${prefixOf(item)}${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
12758
|
+
`${prefixOf(item)}${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk78.dim(formatItemId(item.id))} ${starMarker(item)}${item.name}${phaseLabel(item)}${dependencyLabel(item, allItems)}`
|
|
12742
12759
|
);
|
|
12743
12760
|
if (options2.verbose) {
|
|
12744
12761
|
printVerboseDetails(item);
|
|
@@ -12748,13 +12765,13 @@ async function list2(options2) {
|
|
|
12748
12765
|
|
|
12749
12766
|
// src/commands/backlog/propose/index.ts
|
|
12750
12767
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
12751
|
-
import
|
|
12768
|
+
import chalk80 from "chalk";
|
|
12752
12769
|
|
|
12753
12770
|
// src/commands/backlog/readJsonPayload.ts
|
|
12754
12771
|
import { readFileSync as readFileSync24 } from "fs";
|
|
12755
|
-
import
|
|
12772
|
+
import chalk79 from "chalk";
|
|
12756
12773
|
function fail3(message3) {
|
|
12757
|
-
console.error(
|
|
12774
|
+
console.error(chalk79.red(message3));
|
|
12758
12775
|
process.exit(1);
|
|
12759
12776
|
}
|
|
12760
12777
|
function describe(error) {
|
|
@@ -12837,7 +12854,7 @@ async function reviewProposal(item) {
|
|
|
12837
12854
|
});
|
|
12838
12855
|
return;
|
|
12839
12856
|
}
|
|
12840
|
-
console.log(
|
|
12857
|
+
console.log(chalk80.bold(item.name));
|
|
12841
12858
|
console.log(renderMarkdownTerminal(body));
|
|
12842
12859
|
}
|
|
12843
12860
|
async function propose(options2) {
|
|
@@ -12845,7 +12862,7 @@ async function propose(options2) {
|
|
|
12845
12862
|
const item = await readProposedItem(options2.json);
|
|
12846
12863
|
await reviewProposal(item);
|
|
12847
12864
|
const id = await createItemWithDefaults(item);
|
|
12848
|
-
console.log(
|
|
12865
|
+
console.log(chalk80.green(`Added item ${formatItemId(id)}: ${item.name}`));
|
|
12849
12866
|
}
|
|
12850
12867
|
|
|
12851
12868
|
// src/commands/backlog/registerItemCommands.ts
|
|
@@ -12874,7 +12891,7 @@ function registerItemCommands(cmd) {
|
|
|
12874
12891
|
}
|
|
12875
12892
|
|
|
12876
12893
|
// src/commands/backlog/link.ts
|
|
12877
|
-
import
|
|
12894
|
+
import chalk82 from "chalk";
|
|
12878
12895
|
|
|
12879
12896
|
// src/commands/backlog/hasCycle.ts
|
|
12880
12897
|
function hasCycle(adjacency, fromId, toId) {
|
|
@@ -12906,14 +12923,14 @@ async function loadDependencyGraph(orm) {
|
|
|
12906
12923
|
}
|
|
12907
12924
|
|
|
12908
12925
|
// src/commands/backlog/validateLinkTarget.ts
|
|
12909
|
-
import
|
|
12926
|
+
import chalk81 from "chalk";
|
|
12910
12927
|
function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
12911
12928
|
const duplicate = (fromItem.links ?? []).some(
|
|
12912
12929
|
(l) => l.targetId === toNum && l.type === linkType
|
|
12913
12930
|
);
|
|
12914
12931
|
if (duplicate) {
|
|
12915
12932
|
console.log(
|
|
12916
|
-
|
|
12933
|
+
chalk81.yellow(
|
|
12917
12934
|
`Link already exists: ${formatItemId(fromNum)} ${linkType} ${formatItemId(toNum)}`
|
|
12918
12935
|
)
|
|
12919
12936
|
);
|
|
@@ -12924,7 +12941,7 @@ function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
|
12924
12941
|
|
|
12925
12942
|
// src/commands/backlog/link.ts
|
|
12926
12943
|
function fail4(message3) {
|
|
12927
|
-
console.log(
|
|
12944
|
+
console.log(chalk82.red(message3));
|
|
12928
12945
|
return void 0;
|
|
12929
12946
|
}
|
|
12930
12947
|
function parseLinkType(type) {
|
|
@@ -12957,11 +12974,11 @@ async function link(fromId, toId, opts) {
|
|
|
12957
12974
|
if (!validateLinkTarget(fromItem, fromNum, toNum, linkType)) return;
|
|
12958
12975
|
if (await createsCycle(orm, linkType, fromNum, toNum)) return;
|
|
12959
12976
|
await orm.insert(links).values({ itemId: fromNum, type: linkType, targetId: toNum });
|
|
12960
|
-
console.log(
|
|
12977
|
+
console.log(chalk82.green(`Linked ${from} ${linkType} ${to} (${toItem.name})`));
|
|
12961
12978
|
}
|
|
12962
12979
|
|
|
12963
12980
|
// src/commands/backlog/unlink.ts
|
|
12964
|
-
import
|
|
12981
|
+
import chalk83 from "chalk";
|
|
12965
12982
|
import { and as and10, eq as eq27 } from "drizzle-orm";
|
|
12966
12983
|
async function unlink(fromId, toId) {
|
|
12967
12984
|
const fromNum = parseItemId(fromId);
|
|
@@ -12969,18 +12986,18 @@ async function unlink(fromId, toId) {
|
|
|
12969
12986
|
const { orm } = await getReady();
|
|
12970
12987
|
const fromItem = await loadItem(orm, fromNum);
|
|
12971
12988
|
if (!fromItem) {
|
|
12972
|
-
console.log(
|
|
12989
|
+
console.log(chalk83.red(`Item ${formatItemId(fromNum)} not found.`));
|
|
12973
12990
|
return;
|
|
12974
12991
|
}
|
|
12975
12992
|
if (!fromItem.links || fromItem.links.length === 0) {
|
|
12976
12993
|
console.log(
|
|
12977
|
-
|
|
12994
|
+
chalk83.yellow(`No links found on item ${formatItemId(fromNum)}.`)
|
|
12978
12995
|
);
|
|
12979
12996
|
return;
|
|
12980
12997
|
}
|
|
12981
12998
|
if (!fromItem.links.some((l) => l.targetId === toNum)) {
|
|
12982
12999
|
console.log(
|
|
12983
|
-
|
|
13000
|
+
chalk83.yellow(
|
|
12984
13001
|
`No link from ${formatItemId(fromNum)} to ${formatItemId(toNum)} found.`
|
|
12985
13002
|
)
|
|
12986
13003
|
);
|
|
@@ -12988,7 +13005,7 @@ async function unlink(fromId, toId) {
|
|
|
12988
13005
|
}
|
|
12989
13006
|
await orm.delete(links).where(and10(eq27(links.itemId, fromNum), eq27(links.targetId, toNum)));
|
|
12990
13007
|
console.log(
|
|
12991
|
-
|
|
13008
|
+
chalk83.green(
|
|
12992
13009
|
`Removed link from ${formatItemId(fromNum)} to ${formatItemId(toNum)}.`
|
|
12993
13010
|
)
|
|
12994
13011
|
);
|
|
@@ -13005,17 +13022,17 @@ function registerLinkCommands(cmd) {
|
|
|
13005
13022
|
}
|
|
13006
13023
|
|
|
13007
13024
|
// src/commands/backlog/move-repo/index.ts
|
|
13008
|
-
import
|
|
13025
|
+
import chalk85 from "chalk";
|
|
13009
13026
|
import { eq as eq29 } from "drizzle-orm";
|
|
13010
13027
|
|
|
13011
13028
|
// src/commands/backlog/move-repo/confirmMove.ts
|
|
13012
|
-
import
|
|
13029
|
+
import chalk84 from "chalk";
|
|
13013
13030
|
function pluralItems(n) {
|
|
13014
13031
|
return `${n} item${n === 1 ? "" : "s"}`;
|
|
13015
13032
|
}
|
|
13016
13033
|
async function confirmMove(cnt, oldOrigin, newOrigin) {
|
|
13017
13034
|
console.log(
|
|
13018
|
-
`${pluralItems(cnt)}: ${
|
|
13035
|
+
`${pluralItems(cnt)}: ${chalk84.cyan(oldOrigin)} \u2192 ${chalk84.cyan(newOrigin)}`
|
|
13019
13036
|
);
|
|
13020
13037
|
return promptConfirm(`Retag ${pluralItems(cnt)}?`);
|
|
13021
13038
|
}
|
|
@@ -13047,7 +13064,7 @@ Pass the full origin.`
|
|
|
13047
13064
|
|
|
13048
13065
|
// src/commands/backlog/move-repo/index.ts
|
|
13049
13066
|
function fail5(message3) {
|
|
13050
|
-
console.log(
|
|
13067
|
+
console.log(chalk85.red(message3));
|
|
13051
13068
|
process.exitCode = 1;
|
|
13052
13069
|
}
|
|
13053
13070
|
async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
@@ -13063,12 +13080,12 @@ async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
|
13063
13080
|
}
|
|
13064
13081
|
const cnt = await countByOrigin(orm, oldOrigin);
|
|
13065
13082
|
if (!options2.yes && !await confirmMove(cnt, oldOrigin, newOrigin)) {
|
|
13066
|
-
console.log(
|
|
13083
|
+
console.log(chalk85.yellow("Move cancelled; no changes made."));
|
|
13067
13084
|
return;
|
|
13068
13085
|
}
|
|
13069
13086
|
await orm.update(items).set({ origin: newOrigin }).where(eq29(items.origin, oldOrigin));
|
|
13070
13087
|
console.log(
|
|
13071
|
-
|
|
13088
|
+
chalk85.green(
|
|
13072
13089
|
`Moved ${pluralItems(cnt)} from "${oldOrigin}" to "${newOrigin}".`
|
|
13073
13090
|
)
|
|
13074
13091
|
);
|
|
@@ -13097,14 +13114,14 @@ function registerPlanCommands(cmd) {
|
|
|
13097
13114
|
}
|
|
13098
13115
|
|
|
13099
13116
|
// src/commands/backlog/refine.ts
|
|
13100
|
-
import
|
|
13117
|
+
import chalk88 from "chalk";
|
|
13101
13118
|
import enquirer7 from "enquirer";
|
|
13102
13119
|
|
|
13103
13120
|
// src/commands/backlog/launchMode.ts
|
|
13104
13121
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
13105
13122
|
|
|
13106
13123
|
// src/commands/backlog/handleLaunchSignal.ts
|
|
13107
|
-
import
|
|
13124
|
+
import chalk87 from "chalk";
|
|
13108
13125
|
|
|
13109
13126
|
// src/commands/backlog/surfaceCreatedItem.ts
|
|
13110
13127
|
async function surfaceCreatedItem(slashCommand, id) {
|
|
@@ -13127,32 +13144,32 @@ async function surfaceCreatedItem(slashCommand, id) {
|
|
|
13127
13144
|
}
|
|
13128
13145
|
|
|
13129
13146
|
// src/commands/backlog/tryRunById.ts
|
|
13130
|
-
import
|
|
13147
|
+
import chalk86 from "chalk";
|
|
13131
13148
|
async function tryRunById(id, options2) {
|
|
13132
13149
|
const numericId = parseItemId(id);
|
|
13133
13150
|
const label2 = formatItemId(numericId);
|
|
13134
13151
|
const { orm } = await getReady();
|
|
13135
13152
|
const item = await loadItem(orm, numericId);
|
|
13136
13153
|
if (!item) {
|
|
13137
|
-
console.log(
|
|
13154
|
+
console.log(chalk86.red(`Item ${label2} not found.`));
|
|
13138
13155
|
return false;
|
|
13139
13156
|
}
|
|
13140
13157
|
if (item.status === "done") {
|
|
13141
|
-
console.log(
|
|
13158
|
+
console.log(chalk86.red(`Item ${label2} is already done.`));
|
|
13142
13159
|
return false;
|
|
13143
13160
|
}
|
|
13144
13161
|
if (item.status === "wontdo") {
|
|
13145
|
-
console.log(
|
|
13162
|
+
console.log(chalk86.red(`Item ${label2} is marked won't do.`));
|
|
13146
13163
|
return false;
|
|
13147
13164
|
}
|
|
13148
13165
|
const hasDeps = (item.links ?? []).some((l) => l.type === "depends-on");
|
|
13149
13166
|
if (hasDeps && isBlocked(item, await loadItemSummaries(orm, getOrigin()))) {
|
|
13150
13167
|
console.log(
|
|
13151
|
-
|
|
13168
|
+
chalk86.red(`Item ${label2} is blocked by unresolved dependencies.`)
|
|
13152
13169
|
);
|
|
13153
13170
|
return false;
|
|
13154
13171
|
}
|
|
13155
|
-
console.log(
|
|
13172
|
+
console.log(chalk86.bold(`
|
|
13156
13173
|
Running backlog item ${label2}...
|
|
13157
13174
|
`));
|
|
13158
13175
|
await run2(id, options2);
|
|
@@ -13171,13 +13188,13 @@ async function handleLaunchSignal(slashCommand, once) {
|
|
|
13171
13188
|
if (typeof signal.id === "string" && signal.id) {
|
|
13172
13189
|
if (await tryRunById(signal.id, { allowEdits: true })) return;
|
|
13173
13190
|
}
|
|
13174
|
-
console.log(
|
|
13191
|
+
console.log(chalk87.bold("\nChaining into assist next...\n"));
|
|
13175
13192
|
await next({ allowEdits: true, once });
|
|
13176
13193
|
}
|
|
13177
13194
|
} catch (error) {
|
|
13178
13195
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
13179
13196
|
console.error(
|
|
13180
|
-
|
|
13197
|
+
chalk87.yellow(
|
|
13181
13198
|
`
|
|
13182
13199
|
Could not complete post-run step (${message3}).
|
|
13183
13200
|
This is usually a transient database/network blip \u2014 the work is saved and the session is safe to resume.`
|
|
@@ -13224,13 +13241,13 @@ async function pickItemForRefine() {
|
|
|
13224
13241
|
(i) => i.status === "todo" || i.status === "in-progress"
|
|
13225
13242
|
);
|
|
13226
13243
|
if (active.length === 0) {
|
|
13227
|
-
console.log(
|
|
13244
|
+
console.log(chalk88.yellow("No active backlog items to refine."));
|
|
13228
13245
|
return void 0;
|
|
13229
13246
|
}
|
|
13230
13247
|
if (active.length === 1) {
|
|
13231
13248
|
const item = active[0];
|
|
13232
13249
|
console.log(
|
|
13233
|
-
|
|
13250
|
+
chalk88.bold(`Auto-selecting item ${formatItemId(item.id)}: ${item.name}`)
|
|
13234
13251
|
);
|
|
13235
13252
|
return formatItemId(item.id);
|
|
13236
13253
|
}
|
|
@@ -13278,7 +13295,7 @@ function registerRefineCommand(cmd) {
|
|
|
13278
13295
|
}
|
|
13279
13296
|
|
|
13280
13297
|
// src/commands/backlog/rewindPhase.ts
|
|
13281
|
-
import
|
|
13298
|
+
import chalk89 from "chalk";
|
|
13282
13299
|
async function rewindPhase(id, phase, opts) {
|
|
13283
13300
|
const phaseNumber = Number.parseInt(phase, 10);
|
|
13284
13301
|
const found = await findOneItem(id);
|
|
@@ -13286,12 +13303,12 @@ async function rewindPhase(id, phase, opts) {
|
|
|
13286
13303
|
const { orm, item } = found;
|
|
13287
13304
|
const result = await rewindItemToPhase(orm, item, phaseNumber, opts.reason);
|
|
13288
13305
|
if (!result.ok) {
|
|
13289
|
-
console.log(
|
|
13306
|
+
console.log(chalk89.red(result.error));
|
|
13290
13307
|
process.exitCode = 1;
|
|
13291
13308
|
return;
|
|
13292
13309
|
}
|
|
13293
13310
|
console.log(
|
|
13294
|
-
|
|
13311
|
+
chalk89.green(
|
|
13295
13312
|
`Rewound item ${formatItemId(item.id)} to phase ${phaseNumber} (${result.phaseName}).`
|
|
13296
13313
|
)
|
|
13297
13314
|
);
|
|
@@ -13323,22 +13340,22 @@ function registerRunCommand(cmd) {
|
|
|
13323
13340
|
}
|
|
13324
13341
|
|
|
13325
13342
|
// src/commands/backlog/search/index.ts
|
|
13326
|
-
import
|
|
13343
|
+
import chalk90 from "chalk";
|
|
13327
13344
|
async function search(query) {
|
|
13328
13345
|
const items2 = await searchBacklog(query);
|
|
13329
13346
|
if (items2.length === 0) {
|
|
13330
|
-
console.log(
|
|
13347
|
+
console.log(chalk90.dim(`No items matching "${query}".`));
|
|
13331
13348
|
return;
|
|
13332
13349
|
}
|
|
13333
13350
|
console.log(
|
|
13334
|
-
|
|
13351
|
+
chalk90.dim(
|
|
13335
13352
|
`${items2.length} item${items2.length === 1 ? "" : "s"} matching "${query}":
|
|
13336
13353
|
`
|
|
13337
13354
|
)
|
|
13338
13355
|
);
|
|
13339
13356
|
for (const item of items2) {
|
|
13340
13357
|
console.log(
|
|
13341
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
13358
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk90.dim(formatItemId(item.id))} ${item.name}`
|
|
13342
13359
|
);
|
|
13343
13360
|
}
|
|
13344
13361
|
}
|
|
@@ -13349,18 +13366,18 @@ function registerSearchCommand(cmd) {
|
|
|
13349
13366
|
}
|
|
13350
13367
|
|
|
13351
13368
|
// src/commands/backlog/delete/index.ts
|
|
13352
|
-
import
|
|
13369
|
+
import chalk91 from "chalk";
|
|
13353
13370
|
async function del(id) {
|
|
13354
13371
|
const name = await removeItem(id);
|
|
13355
13372
|
if (name) {
|
|
13356
13373
|
console.log(
|
|
13357
|
-
|
|
13374
|
+
chalk91.green(`Deleted item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
13358
13375
|
);
|
|
13359
13376
|
}
|
|
13360
13377
|
}
|
|
13361
13378
|
|
|
13362
13379
|
// src/commands/backlog/done/index.ts
|
|
13363
|
-
import
|
|
13380
|
+
import chalk92 from "chalk";
|
|
13364
13381
|
async function done(id, summary) {
|
|
13365
13382
|
const found = await findOneItem(id);
|
|
13366
13383
|
if (!found) return;
|
|
@@ -13374,12 +13391,12 @@ async function done(id, summary) {
|
|
|
13374
13391
|
const pending = item.plan.slice(completedCount);
|
|
13375
13392
|
if (pending.length > 0) {
|
|
13376
13393
|
console.log(
|
|
13377
|
-
|
|
13394
|
+
chalk92.red(
|
|
13378
13395
|
`Cannot complete item ${formatItemId(item.id)}: ${pending.length} pending phase(s):`
|
|
13379
13396
|
)
|
|
13380
13397
|
);
|
|
13381
13398
|
for (const phase of pending) {
|
|
13382
|
-
console.log(
|
|
13399
|
+
console.log(chalk92.yellow(` - ${phase.name}`));
|
|
13383
13400
|
}
|
|
13384
13401
|
process.exitCode = 1;
|
|
13385
13402
|
return;
|
|
@@ -13391,12 +13408,12 @@ async function done(id, summary) {
|
|
|
13391
13408
|
await appendComment(orm, item.id, summary, { phase, type: "summary" });
|
|
13392
13409
|
}
|
|
13393
13410
|
console.log(
|
|
13394
|
-
|
|
13411
|
+
chalk92.green(`Completed item ${formatItemId(item.id)}: ${item.name}`)
|
|
13395
13412
|
);
|
|
13396
13413
|
}
|
|
13397
13414
|
|
|
13398
13415
|
// src/commands/backlog/set-status/index.ts
|
|
13399
|
-
import
|
|
13416
|
+
import chalk93 from "chalk";
|
|
13400
13417
|
var allowedStatuses = [
|
|
13401
13418
|
"todo",
|
|
13402
13419
|
"in-progress",
|
|
@@ -13406,7 +13423,7 @@ var allowedStatuses = [
|
|
|
13406
13423
|
async function setStatusCommand(id, status3) {
|
|
13407
13424
|
if (!allowedStatuses.includes(status3)) {
|
|
13408
13425
|
console.log(
|
|
13409
|
-
|
|
13426
|
+
chalk93.red(
|
|
13410
13427
|
`Invalid status "${status3}". Must be one of: ${allowedStatuses.join(", ")}.`
|
|
13411
13428
|
)
|
|
13412
13429
|
);
|
|
@@ -13416,7 +13433,7 @@ async function setStatusCommand(id, status3) {
|
|
|
13416
13433
|
const name = await setStatus(id, status3);
|
|
13417
13434
|
if (name) {
|
|
13418
13435
|
console.log(
|
|
13419
|
-
|
|
13436
|
+
chalk93.green(
|
|
13420
13437
|
`Set item ${formatItemId(parseItemId(id))} to ${status3}: ${name}`
|
|
13421
13438
|
)
|
|
13422
13439
|
);
|
|
@@ -13424,16 +13441,16 @@ async function setStatusCommand(id, status3) {
|
|
|
13424
13441
|
}
|
|
13425
13442
|
|
|
13426
13443
|
// src/commands/backlog/star/index.ts
|
|
13427
|
-
import
|
|
13444
|
+
import chalk95 from "chalk";
|
|
13428
13445
|
|
|
13429
13446
|
// src/commands/backlog/setStarred.ts
|
|
13430
|
-
import
|
|
13447
|
+
import chalk94 from "chalk";
|
|
13431
13448
|
async function setStarred(id, starred) {
|
|
13432
13449
|
const { orm } = await getReady();
|
|
13433
13450
|
const numId = parseItemId(id);
|
|
13434
13451
|
const name = await updateStarred(orm, numId, starred);
|
|
13435
13452
|
if (name === void 0)
|
|
13436
|
-
console.log(
|
|
13453
|
+
console.log(chalk94.red(`Item ${formatItemId(numId)} not found.`));
|
|
13437
13454
|
return name;
|
|
13438
13455
|
}
|
|
13439
13456
|
|
|
@@ -13442,52 +13459,52 @@ async function star(id) {
|
|
|
13442
13459
|
const name = await setStarred(id, true);
|
|
13443
13460
|
if (name) {
|
|
13444
13461
|
console.log(
|
|
13445
|
-
|
|
13462
|
+
chalk95.green(`Starred item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
13446
13463
|
);
|
|
13447
13464
|
}
|
|
13448
13465
|
}
|
|
13449
13466
|
|
|
13450
13467
|
// src/commands/backlog/start/index.ts
|
|
13451
|
-
import
|
|
13468
|
+
import chalk96 from "chalk";
|
|
13452
13469
|
async function start(id) {
|
|
13453
13470
|
const name = await setStatus(id, "in-progress");
|
|
13454
13471
|
if (name) {
|
|
13455
13472
|
console.log(
|
|
13456
|
-
|
|
13473
|
+
chalk96.green(`Started item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
13457
13474
|
);
|
|
13458
13475
|
}
|
|
13459
13476
|
}
|
|
13460
13477
|
|
|
13461
13478
|
// src/commands/backlog/stop/index.ts
|
|
13462
|
-
import
|
|
13479
|
+
import chalk97 from "chalk";
|
|
13463
13480
|
import { and as and11, eq as eq30 } from "drizzle-orm";
|
|
13464
13481
|
async function stop() {
|
|
13465
13482
|
const { orm } = await getReady();
|
|
13466
13483
|
const stopped = await orm.update(items).set({ status: "todo", currentPhase: 1 }).where(and11(eq30(items.status, "in-progress"), eq30(items.origin, getOrigin()))).returning({ id: items.id, name: items.name });
|
|
13467
13484
|
if (stopped.length === 0) {
|
|
13468
|
-
console.log(
|
|
13485
|
+
console.log(chalk97.yellow("No in-progress items to stop."));
|
|
13469
13486
|
return;
|
|
13470
13487
|
}
|
|
13471
13488
|
for (const item of stopped) {
|
|
13472
13489
|
console.log(
|
|
13473
|
-
|
|
13490
|
+
chalk97.yellow(`Stopped item ${formatItemId(item.id)}: ${item.name}`)
|
|
13474
13491
|
);
|
|
13475
13492
|
}
|
|
13476
13493
|
}
|
|
13477
13494
|
|
|
13478
13495
|
// src/commands/backlog/unstar/index.ts
|
|
13479
|
-
import
|
|
13496
|
+
import chalk98 from "chalk";
|
|
13480
13497
|
async function unstar(id) {
|
|
13481
13498
|
const name = await setStarred(id, false);
|
|
13482
13499
|
if (name) {
|
|
13483
13500
|
console.log(
|
|
13484
|
-
|
|
13501
|
+
chalk98.green(`Unstarred item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
13485
13502
|
);
|
|
13486
13503
|
}
|
|
13487
13504
|
}
|
|
13488
13505
|
|
|
13489
13506
|
// src/commands/backlog/wontdo/index.ts
|
|
13490
|
-
import
|
|
13507
|
+
import chalk99 from "chalk";
|
|
13491
13508
|
async function wontdo(id, reason4) {
|
|
13492
13509
|
const found = await findOneItem(id);
|
|
13493
13510
|
if (!found) return;
|
|
@@ -13498,7 +13515,7 @@ async function wontdo(id, reason4) {
|
|
|
13498
13515
|
await appendComment(orm, item.id, reason4, { phase, type: "summary" });
|
|
13499
13516
|
}
|
|
13500
13517
|
console.log(
|
|
13501
|
-
|
|
13518
|
+
chalk99.red(`Won't do item ${formatItemId(item.id)}: ${item.name}`)
|
|
13502
13519
|
);
|
|
13503
13520
|
}
|
|
13504
13521
|
|
|
@@ -13517,17 +13534,17 @@ function registerStatusCommands(cmd) {
|
|
|
13517
13534
|
}
|
|
13518
13535
|
|
|
13519
13536
|
// src/commands/backlog/addSubtask.ts
|
|
13520
|
-
import
|
|
13537
|
+
import chalk100 from "chalk";
|
|
13521
13538
|
async function addSubtask(id, options2) {
|
|
13522
13539
|
const title = options2.title?.trim();
|
|
13523
13540
|
if (!title) {
|
|
13524
|
-
console.log(
|
|
13541
|
+
console.log(chalk100.red("A sub-task title is required (--title)."));
|
|
13525
13542
|
process.exitCode = 1;
|
|
13526
13543
|
return;
|
|
13527
13544
|
}
|
|
13528
13545
|
if (title.length > 50) {
|
|
13529
13546
|
console.log(
|
|
13530
|
-
|
|
13547
|
+
chalk100.red(
|
|
13531
13548
|
"A sub-task title must be 50 characters or fewer. Use --desc for longer detail."
|
|
13532
13549
|
)
|
|
13533
13550
|
);
|
|
@@ -13543,21 +13560,21 @@ async function addSubtask(id, options2) {
|
|
|
13543
13560
|
const description = options2.desc?.replaceAll(String.raw`\n`, "\n");
|
|
13544
13561
|
await insertSubtask(orm, item.id, title, description);
|
|
13545
13562
|
console.log(
|
|
13546
|
-
|
|
13563
|
+
chalk100.green(`Added sub-task to item ${formatItemId(item.id)}: ${title}`)
|
|
13547
13564
|
);
|
|
13548
13565
|
}
|
|
13549
13566
|
|
|
13550
13567
|
// src/commands/backlog/editSubtask.ts
|
|
13551
|
-
import
|
|
13568
|
+
import chalk102 from "chalk";
|
|
13552
13569
|
|
|
13553
13570
|
// src/commands/backlog/resolveSubtaskIndex.ts
|
|
13554
|
-
import
|
|
13571
|
+
import chalk101 from "chalk";
|
|
13555
13572
|
function resolveSubtaskIndex(index3, item) {
|
|
13556
13573
|
const position = Number.parseInt(index3, 10);
|
|
13557
13574
|
const subtasks = item.subtasks ?? [];
|
|
13558
13575
|
if (Number.isNaN(position) || position < 1 || position > subtasks.length) {
|
|
13559
13576
|
console.log(
|
|
13560
|
-
|
|
13577
|
+
chalk101.red(
|
|
13561
13578
|
`Item ${formatItemId(item.id)} has no sub-task ${index3}${subtasks.length > 0 ? ` (1-${subtasks.length})` : ""}.`
|
|
13562
13579
|
)
|
|
13563
13580
|
);
|
|
@@ -13624,21 +13641,21 @@ async function editSubtask(id, index3, options2) {
|
|
|
13624
13641
|
if (!found) return;
|
|
13625
13642
|
const fields = buildUpdate(options2);
|
|
13626
13643
|
if (typeof fields === "string") {
|
|
13627
|
-
console.log(
|
|
13644
|
+
console.log(chalk102.red(fields));
|
|
13628
13645
|
process.exitCode = 1;
|
|
13629
13646
|
return;
|
|
13630
13647
|
}
|
|
13631
13648
|
const { orm, item, idx } = found;
|
|
13632
13649
|
const title = await updateSubtask(orm, item.id, idx, fields);
|
|
13633
13650
|
console.log(
|
|
13634
|
-
|
|
13651
|
+
chalk102.green(
|
|
13635
13652
|
`Updated sub-task ${idx + 1} of item ${formatItemId(item.id)}: ${title}`
|
|
13636
13653
|
)
|
|
13637
13654
|
);
|
|
13638
13655
|
}
|
|
13639
13656
|
|
|
13640
13657
|
// src/commands/backlog/removeSubtask.ts
|
|
13641
|
-
import
|
|
13658
|
+
import chalk103 from "chalk";
|
|
13642
13659
|
|
|
13643
13660
|
// src/commands/backlog/deleteSubtask.ts
|
|
13644
13661
|
import { and as and13, asc as asc8, eq as eq32 } from "drizzle-orm";
|
|
@@ -13663,18 +13680,18 @@ async function removeSubtask(id, index3) {
|
|
|
13663
13680
|
const { orm, item, idx } = found;
|
|
13664
13681
|
const title = await deleteSubtask(orm, item.id, idx);
|
|
13665
13682
|
console.log(
|
|
13666
|
-
|
|
13683
|
+
chalk103.green(
|
|
13667
13684
|
`Removed sub-task ${idx + 1} of item ${formatItemId(item.id)}: ${title}`
|
|
13668
13685
|
)
|
|
13669
13686
|
);
|
|
13670
13687
|
}
|
|
13671
13688
|
|
|
13672
13689
|
// src/commands/backlog/subtaskStatus.ts
|
|
13673
|
-
import
|
|
13690
|
+
import chalk104 from "chalk";
|
|
13674
13691
|
async function subtaskStatus(id, index3, status3) {
|
|
13675
13692
|
if (!validSubtaskStatuses.includes(status3)) {
|
|
13676
13693
|
console.log(
|
|
13677
|
-
|
|
13694
|
+
chalk104.red(
|
|
13678
13695
|
`Invalid status "${status3}". Use one of: ${validSubtaskStatuses.join(", ")}.`
|
|
13679
13696
|
)
|
|
13680
13697
|
);
|
|
@@ -13691,7 +13708,7 @@ async function subtaskStatus(id, index3, status3) {
|
|
|
13691
13708
|
status3
|
|
13692
13709
|
);
|
|
13693
13710
|
console.log(
|
|
13694
|
-
|
|
13711
|
+
chalk104.green(
|
|
13695
13712
|
`Set sub-task ${idx + 1} of item ${formatItemId(item.id)} to ${status3}: ${title}`
|
|
13696
13713
|
)
|
|
13697
13714
|
);
|
|
@@ -13718,7 +13735,7 @@ function registerSubtaskCommands(cmd) {
|
|
|
13718
13735
|
}
|
|
13719
13736
|
|
|
13720
13737
|
// src/commands/backlog/movePhase.ts
|
|
13721
|
-
import
|
|
13738
|
+
import chalk105 from "chalk";
|
|
13722
13739
|
import { count as count6, eq as eq35 } from "drizzle-orm";
|
|
13723
13740
|
|
|
13724
13741
|
// src/commands/backlog/reorderPhaseRows.ts
|
|
@@ -13784,7 +13801,7 @@ function toIndex2(value, phaseCount) {
|
|
|
13784
13801
|
const pos = Number.parseInt(value, 10);
|
|
13785
13802
|
if (Number.isNaN(pos) || pos < 1 || pos > phaseCount) {
|
|
13786
13803
|
console.log(
|
|
13787
|
-
|
|
13804
|
+
chalk105.red(
|
|
13788
13805
|
`Position "${value}" is out of range. Must be between 1 and ${phaseCount}.`
|
|
13789
13806
|
)
|
|
13790
13807
|
);
|
|
@@ -13807,11 +13824,11 @@ async function movePhase(id, from, to) {
|
|
|
13807
13824
|
if (fromIdx !== toIdx) {
|
|
13808
13825
|
await reorderPhaseRows(orm, itemId2, fromIdx, toIdx);
|
|
13809
13826
|
}
|
|
13810
|
-
console.log(
|
|
13827
|
+
console.log(chalk105.green(`Moved phase ${from} to position ${to}.`));
|
|
13811
13828
|
}
|
|
13812
13829
|
|
|
13813
13830
|
// src/commands/backlog/updatePhase.ts
|
|
13814
|
-
import
|
|
13831
|
+
import chalk107 from "chalk";
|
|
13815
13832
|
|
|
13816
13833
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
13817
13834
|
import { and as and16, eq as eq36 } from "drizzle-orm";
|
|
@@ -13846,7 +13863,7 @@ async function applyPhaseUpdate(orm, itemId2, phaseIdx, fields) {
|
|
|
13846
13863
|
}
|
|
13847
13864
|
|
|
13848
13865
|
// src/commands/backlog/findPhase.ts
|
|
13849
|
-
import
|
|
13866
|
+
import chalk106 from "chalk";
|
|
13850
13867
|
import { and as and17, count as count7, eq as eq37 } from "drizzle-orm";
|
|
13851
13868
|
async function findPhase(id, phase) {
|
|
13852
13869
|
const found = await findOneItem(id);
|
|
@@ -13857,7 +13874,7 @@ async function findPhase(id, phase) {
|
|
|
13857
13874
|
const [row] = await orm.select({ cnt: count7() }).from(planPhases).where(and17(eq37(planPhases.itemId, itemId2), eq37(planPhases.idx, phaseIdx)));
|
|
13858
13875
|
if (!row || row.cnt === 0) {
|
|
13859
13876
|
console.log(
|
|
13860
|
-
|
|
13877
|
+
chalk106.red(
|
|
13861
13878
|
`Phase ${phaseIdx + 1} not found on item ${formatItemId(itemId2)}.`
|
|
13862
13879
|
)
|
|
13863
13880
|
);
|
|
@@ -13991,7 +14008,7 @@ async function updatePhase(id, phase, options2) {
|
|
|
13991
14008
|
const { item, orm, itemId: itemId2, phaseIdx } = found;
|
|
13992
14009
|
const resolved = resolvePhaseFields(options2, item.plan?.[phaseIdx]);
|
|
13993
14010
|
if (!resolved.ok) {
|
|
13994
|
-
console.log(
|
|
14011
|
+
console.log(chalk107.red(resolved.error));
|
|
13995
14012
|
process.exitCode = 1;
|
|
13996
14013
|
return;
|
|
13997
14014
|
}
|
|
@@ -14003,7 +14020,7 @@ async function updatePhase(id, phase, options2) {
|
|
|
14003
14020
|
manualCheck && "manual checks"
|
|
14004
14021
|
].filter(Boolean).join(", ");
|
|
14005
14022
|
console.log(
|
|
14006
|
-
|
|
14023
|
+
chalk107.green(
|
|
14007
14024
|
`Updated ${fields} on phase ${phaseIdx + 1} of item ${formatItemId(itemId2)}.`
|
|
14008
14025
|
)
|
|
14009
14026
|
);
|
|
@@ -14026,7 +14043,7 @@ function registerUpdatePhaseCommand(cmd) {
|
|
|
14026
14043
|
}
|
|
14027
14044
|
|
|
14028
14045
|
// src/commands/backlog/removePhase.ts
|
|
14029
|
-
import
|
|
14046
|
+
import chalk108 from "chalk";
|
|
14030
14047
|
import { and as and18, eq as eq38 } from "drizzle-orm";
|
|
14031
14048
|
async function removePhase(id, phase) {
|
|
14032
14049
|
const found = await findPhase(id, phase);
|
|
@@ -14041,27 +14058,27 @@ async function removePhase(id, phase) {
|
|
|
14041
14058
|
await adjustCurrentPhase(tx, item, phaseIdx);
|
|
14042
14059
|
});
|
|
14043
14060
|
console.log(
|
|
14044
|
-
|
|
14061
|
+
chalk108.green(
|
|
14045
14062
|
`Removed phase ${phaseIdx + 1} from item ${formatItemId(itemId2)}.`
|
|
14046
14063
|
)
|
|
14047
14064
|
);
|
|
14048
14065
|
}
|
|
14049
14066
|
|
|
14050
14067
|
// src/commands/backlog/update/update.ts
|
|
14051
|
-
import
|
|
14068
|
+
import chalk112 from "chalk";
|
|
14052
14069
|
import { eq as eq39 } from "drizzle-orm";
|
|
14053
14070
|
|
|
14054
14071
|
// src/commands/backlog/update/buildUpdateValues.ts
|
|
14055
|
-
import
|
|
14072
|
+
import chalk109 from "chalk";
|
|
14056
14073
|
function buildUpdateValues(options2) {
|
|
14057
14074
|
const { name, desc: desc6, type, ac, origin } = options2;
|
|
14058
14075
|
if (!name && !desc6 && !type && !ac && !origin) {
|
|
14059
|
-
console.log(
|
|
14076
|
+
console.log(chalk109.red("Nothing to update. Provide at least one flag."));
|
|
14060
14077
|
process.exitCode = 1;
|
|
14061
14078
|
return void 0;
|
|
14062
14079
|
}
|
|
14063
14080
|
if (type && type !== "story" && type !== "bug") {
|
|
14064
|
-
console.log(
|
|
14081
|
+
console.log(chalk109.red('Invalid type. Must be "story" or "bug".'));
|
|
14065
14082
|
process.exitCode = 1;
|
|
14066
14083
|
return void 0;
|
|
14067
14084
|
}
|
|
@@ -14091,7 +14108,7 @@ function buildUpdateValues(options2) {
|
|
|
14091
14108
|
}
|
|
14092
14109
|
|
|
14093
14110
|
// src/commands/backlog/update/resolveAcUpdate.ts
|
|
14094
|
-
import
|
|
14111
|
+
import chalk110 from "chalk";
|
|
14095
14112
|
|
|
14096
14113
|
// src/commands/backlog/update/applyAcMutations.ts
|
|
14097
14114
|
function hasAcMutations(options2) {
|
|
@@ -14116,14 +14133,14 @@ function resolveAcUpdate(options2, currentCriteria) {
|
|
|
14116
14133
|
if (!hasAcMutations(options2)) return { ok: true, ac: options2.ac };
|
|
14117
14134
|
if (options2.ac) {
|
|
14118
14135
|
console.log(
|
|
14119
|
-
|
|
14136
|
+
chalk110.red("Cannot combine --ac with --add-ac/--edit-ac/--remove-ac.")
|
|
14120
14137
|
);
|
|
14121
14138
|
process.exitCode = 1;
|
|
14122
14139
|
return { ok: false };
|
|
14123
14140
|
}
|
|
14124
14141
|
const mutation = applyAcMutations(currentCriteria, options2);
|
|
14125
14142
|
if (!mutation.ok) {
|
|
14126
|
-
console.log(
|
|
14143
|
+
console.log(chalk110.red(mutation.error));
|
|
14127
14144
|
process.exitCode = 1;
|
|
14128
14145
|
return { ok: false };
|
|
14129
14146
|
}
|
|
@@ -14131,14 +14148,14 @@ function resolveAcUpdate(options2, currentCriteria) {
|
|
|
14131
14148
|
}
|
|
14132
14149
|
|
|
14133
14150
|
// src/commands/backlog/update/resolveOriginUpdate.ts
|
|
14134
|
-
import
|
|
14151
|
+
import chalk111 from "chalk";
|
|
14135
14152
|
function resolveOriginUpdate(optionOrigin, item) {
|
|
14136
14153
|
if (optionOrigin === void 0 || optionOrigin === false)
|
|
14137
14154
|
return { kind: "none" };
|
|
14138
14155
|
const origin = typeof optionOrigin === "string" ? normalizeOrigin(optionOrigin) : getOrigin();
|
|
14139
14156
|
if (origin === item.origin) {
|
|
14140
14157
|
console.log(
|
|
14141
|
-
|
|
14158
|
+
chalk111.yellow(
|
|
14142
14159
|
`Item ${formatItemId(item.id)} is already on origin "${origin}"; nothing to change.`
|
|
14143
14160
|
)
|
|
14144
14161
|
);
|
|
@@ -14162,12 +14179,12 @@ async function update(id, options2) {
|
|
|
14162
14179
|
const itemId2 = found.item.id;
|
|
14163
14180
|
await orm.update(items).set(built.set).where(eq39(items.id, itemId2));
|
|
14164
14181
|
console.log(
|
|
14165
|
-
|
|
14182
|
+
chalk112.green(`Updated ${built.fields} on item ${formatItemId(itemId2)}.`)
|
|
14166
14183
|
);
|
|
14167
14184
|
}
|
|
14168
14185
|
|
|
14169
14186
|
// src/commands/backlog/updatePlan/index.ts
|
|
14170
|
-
import
|
|
14187
|
+
import chalk114 from "chalk";
|
|
14171
14188
|
|
|
14172
14189
|
// src/commands/backlog/updatePlan/planUpdateSchema.ts
|
|
14173
14190
|
import { z as z6 } from "zod";
|
|
@@ -14217,7 +14234,7 @@ async function replacePlan(orm, itemId2, phases, currentPhase) {
|
|
|
14217
14234
|
|
|
14218
14235
|
// src/commands/backlog/updatePlan/reviewPlanUpdate.ts
|
|
14219
14236
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
14220
|
-
import
|
|
14237
|
+
import chalk113 from "chalk";
|
|
14221
14238
|
|
|
14222
14239
|
// src/commands/backlog/updatePlan/isCompleted.ts
|
|
14223
14240
|
function isCompleted(previousPosition, currentPhase) {
|
|
@@ -14382,7 +14399,7 @@ async function reviewPlanUpdate(item, phases) {
|
|
|
14382
14399
|
});
|
|
14383
14400
|
return;
|
|
14384
14401
|
}
|
|
14385
|
-
console.log(
|
|
14402
|
+
console.log(chalk113.bold(item.name));
|
|
14386
14403
|
console.log(renderMarkdownTerminal(body));
|
|
14387
14404
|
}
|
|
14388
14405
|
|
|
@@ -14395,7 +14412,7 @@ async function updatePlan(id, options2) {
|
|
|
14395
14412
|
await reviewPlanUpdate(item, phases);
|
|
14396
14413
|
await replacePlan(orm, item.id, phases, item.currentPhase);
|
|
14397
14414
|
console.log(
|
|
14398
|
-
|
|
14415
|
+
chalk114.green(
|
|
14399
14416
|
`Replaced the plan on item ${formatItemId(item.id)} with ${phases.length} phase${phases.length === 1 ? "" : "s"}.`
|
|
14400
14417
|
)
|
|
14401
14418
|
);
|
|
@@ -15218,11 +15235,11 @@ function assertCliExists(cli) {
|
|
|
15218
15235
|
}
|
|
15219
15236
|
|
|
15220
15237
|
// src/commands/permitCliReads/colorize.ts
|
|
15221
|
-
import
|
|
15238
|
+
import chalk115 from "chalk";
|
|
15222
15239
|
function colorize(plainOutput) {
|
|
15223
15240
|
return plainOutput.split("\n").map((line) => {
|
|
15224
|
-
if (line.startsWith(" R ")) return
|
|
15225
|
-
if (line.startsWith(" W ")) return
|
|
15241
|
+
if (line.startsWith(" R ")) return chalk115.green(line);
|
|
15242
|
+
if (line.startsWith(" W ")) return chalk115.red(line);
|
|
15226
15243
|
return line;
|
|
15227
15244
|
}).join("\n");
|
|
15228
15245
|
}
|
|
@@ -15515,7 +15532,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
15515
15532
|
}
|
|
15516
15533
|
|
|
15517
15534
|
// src/commands/deny/denyAdd.ts
|
|
15518
|
-
import
|
|
15535
|
+
import chalk116 from "chalk";
|
|
15519
15536
|
|
|
15520
15537
|
// src/commands/deny/loadDenyConfig.ts
|
|
15521
15538
|
function loadDenyConfig(global) {
|
|
@@ -15535,16 +15552,16 @@ function loadDenyConfig(global) {
|
|
|
15535
15552
|
function denyAdd(pattern2, message3, options2) {
|
|
15536
15553
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
15537
15554
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
15538
|
-
console.log(
|
|
15555
|
+
console.log(chalk116.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
15539
15556
|
return;
|
|
15540
15557
|
}
|
|
15541
15558
|
deny.push({ pattern: pattern2, message: message3 });
|
|
15542
15559
|
saveDeny(deny);
|
|
15543
|
-
console.log(
|
|
15560
|
+
console.log(chalk116.green(`Added deny rule: ${pattern2} \u2192 ${message3}`));
|
|
15544
15561
|
}
|
|
15545
15562
|
|
|
15546
15563
|
// src/commands/deny/denyList.ts
|
|
15547
|
-
import
|
|
15564
|
+
import chalk117 from "chalk";
|
|
15548
15565
|
function denyList() {
|
|
15549
15566
|
const globalRaw = loadGlobalConfigRaw();
|
|
15550
15567
|
const projectRaw = loadProjectConfig();
|
|
@@ -15555,7 +15572,7 @@ function denyList() {
|
|
|
15555
15572
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
15556
15573
|
);
|
|
15557
15574
|
if (!merged || merged.length === 0) {
|
|
15558
|
-
console.log(
|
|
15575
|
+
console.log(chalk117.dim("No deny rules configured."));
|
|
15559
15576
|
return;
|
|
15560
15577
|
}
|
|
15561
15578
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -15563,23 +15580,23 @@ function denyList() {
|
|
|
15563
15580
|
for (const rule of merged) {
|
|
15564
15581
|
const inProject = projectPatterns.has(rule.pattern);
|
|
15565
15582
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
15566
|
-
const label2 = inProject && inGlobal ?
|
|
15567
|
-
console.log(`${
|
|
15583
|
+
const label2 = inProject && inGlobal ? chalk117.dim(" (project, overrides global)") : inGlobal ? chalk117.dim(" (global)") : "";
|
|
15584
|
+
console.log(`${chalk117.red(rule.pattern)} \u2192 ${rule.message}${label2}`);
|
|
15568
15585
|
}
|
|
15569
15586
|
}
|
|
15570
15587
|
|
|
15571
15588
|
// src/commands/deny/denyRemove.ts
|
|
15572
|
-
import
|
|
15589
|
+
import chalk118 from "chalk";
|
|
15573
15590
|
function denyRemove(pattern2, options2) {
|
|
15574
15591
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
15575
15592
|
const index3 = deny.findIndex((r) => r.pattern === pattern2);
|
|
15576
15593
|
if (index3 === -1) {
|
|
15577
|
-
console.log(
|
|
15594
|
+
console.log(chalk118.yellow(`No deny rule found for: ${pattern2}`));
|
|
15578
15595
|
return;
|
|
15579
15596
|
}
|
|
15580
15597
|
deny.splice(index3, 1);
|
|
15581
15598
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
15582
|
-
console.log(
|
|
15599
|
+
console.log(chalk118.green(`Removed deny rule: ${pattern2}`));
|
|
15583
15600
|
}
|
|
15584
15601
|
|
|
15585
15602
|
// src/commands/registerDeny.ts
|
|
@@ -15623,7 +15640,7 @@ function registerCliHook(program2) {
|
|
|
15623
15640
|
|
|
15624
15641
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
15625
15642
|
import { existsSync as existsSync34, readFileSync as readFileSync29, unlinkSync as unlinkSync8, writeFileSync as writeFileSync24 } from "fs";
|
|
15626
|
-
import
|
|
15643
|
+
import chalk119 from "chalk";
|
|
15627
15644
|
|
|
15628
15645
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
15629
15646
|
import { homedir as homedir17 } from "os";
|
|
@@ -15676,12 +15693,12 @@ function codeCommentConfirm(pin) {
|
|
|
15676
15693
|
sweepRestrictedDir();
|
|
15677
15694
|
const state = readPinState(pin);
|
|
15678
15695
|
if (!state) {
|
|
15679
|
-
console.error(
|
|
15696
|
+
console.error(chalk119.red(`No pending comment for pin: ${pin}`));
|
|
15680
15697
|
process.exitCode = 1;
|
|
15681
15698
|
return;
|
|
15682
15699
|
}
|
|
15683
15700
|
if (!existsSync34(state.file)) {
|
|
15684
|
-
console.error(
|
|
15701
|
+
console.error(chalk119.red(`Target file no longer exists: ${state.file}`));
|
|
15685
15702
|
process.exitCode = 1;
|
|
15686
15703
|
return;
|
|
15687
15704
|
}
|
|
@@ -15690,7 +15707,7 @@ function codeCommentConfirm(pin) {
|
|
|
15690
15707
|
const index3 = state.line - 1;
|
|
15691
15708
|
if (index3 > lines2.length) {
|
|
15692
15709
|
console.error(
|
|
15693
|
-
|
|
15710
|
+
chalk119.red(
|
|
15694
15711
|
`Line ${state.line} is beyond the end of ${state.file} (${lines2.length} lines).`
|
|
15695
15712
|
)
|
|
15696
15713
|
);
|
|
@@ -15704,14 +15721,14 @@ function codeCommentConfirm(pin) {
|
|
|
15704
15721
|
writeFileSync24(state.file, lines2.join("\n"));
|
|
15705
15722
|
unlinkSync8(getPinStatePath(pin));
|
|
15706
15723
|
console.log(
|
|
15707
|
-
|
|
15724
|
+
chalk119.green(
|
|
15708
15725
|
`Inserted "${marker} ${state.text}" at ${state.file}:${state.line}`
|
|
15709
15726
|
)
|
|
15710
15727
|
);
|
|
15711
15728
|
}
|
|
15712
15729
|
|
|
15713
15730
|
// src/commands/codeComment/codeCommentSet.ts
|
|
15714
|
-
import
|
|
15731
|
+
import chalk120 from "chalk";
|
|
15715
15732
|
|
|
15716
15733
|
// src/commands/codeComment/validateCommentText.ts
|
|
15717
15734
|
var MAX_COMMENT_LENGTH = 50;
|
|
@@ -15762,7 +15779,7 @@ function generatePin() {
|
|
|
15762
15779
|
function codeCommentSet(file, line, text17) {
|
|
15763
15780
|
const lineNumber = Number.parseInt(line, 10);
|
|
15764
15781
|
if (!Number.isInteger(lineNumber) || lineNumber < 1) {
|
|
15765
|
-
console.error(
|
|
15782
|
+
console.error(chalk120.red(`Invalid line number: ${line}`));
|
|
15766
15783
|
process.exitCode = 1;
|
|
15767
15784
|
return;
|
|
15768
15785
|
}
|
|
@@ -15770,20 +15787,20 @@ function codeCommentSet(file, line, text17) {
|
|
|
15770
15787
|
const marker = hash ? "#" : "//";
|
|
15771
15788
|
const validation = validateCommentText(text17, hash);
|
|
15772
15789
|
if (!validation.ok) {
|
|
15773
|
-
console.error(
|
|
15774
|
-
console.error(
|
|
15790
|
+
console.error(chalk120.red(`Refused: ${validation.reason}`));
|
|
15791
|
+
console.error(chalk120.red("No pin issued."));
|
|
15775
15792
|
process.exitCode = 1;
|
|
15776
15793
|
return;
|
|
15777
15794
|
}
|
|
15778
15795
|
console.error(
|
|
15779
|
-
|
|
15796
|
+
chalk120.yellow.bold(
|
|
15780
15797
|
"THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a comment. DO NOT WASTE THEIR TIME.\nYou had BETTER BE RIGHT that this comment is genuinely necessary.\n\nComments are a last resort, not a habit. Almost every comment you reach for is a sign\nthe code should be clearer instead. Before a human is pulled in, ask whether a better\nname, a smaller function, or a test would make the comment redundant. ONLY if you are\ncertain this one line earns its keep should you proceed to the confirm step below."
|
|
15781
15798
|
)
|
|
15782
15799
|
);
|
|
15783
15800
|
const delivered = issuePin(file, lineNumber, validation.text);
|
|
15784
15801
|
if (!delivered) {
|
|
15785
15802
|
console.error(
|
|
15786
|
-
|
|
15803
|
+
chalk120.red(
|
|
15787
15804
|
"Could not deliver the confirmation pin via notification.\nThe comment cannot be confirmed until the notification channel works."
|
|
15788
15805
|
)
|
|
15789
15806
|
);
|
|
@@ -15793,7 +15810,7 @@ function codeCommentSet(file, line, text17) {
|
|
|
15793
15810
|
console.log(
|
|
15794
15811
|
`A confirmation pin was sent to your desktop notifications.
|
|
15795
15812
|
To insert "${marker} ${validation.text}" at ${file}:${lineNumber}, run:
|
|
15796
|
-
${
|
|
15813
|
+
${chalk120.cyan(" assist code-comment confirm <PIN>")}
|
|
15797
15814
|
using the pin from that notification.`
|
|
15798
15815
|
);
|
|
15799
15816
|
}
|
|
@@ -15870,15 +15887,15 @@ function registerCodexHook(program2) {
|
|
|
15870
15887
|
}
|
|
15871
15888
|
|
|
15872
15889
|
// src/commands/complexity/analyze.ts
|
|
15873
|
-
import
|
|
15890
|
+
import chalk129 from "chalk";
|
|
15874
15891
|
|
|
15875
15892
|
// src/commands/complexity/cyclomatic.ts
|
|
15876
|
-
import
|
|
15893
|
+
import chalk122 from "chalk";
|
|
15877
15894
|
|
|
15878
15895
|
// src/commands/complexity/shared/index.ts
|
|
15879
15896
|
import fs20 from "fs";
|
|
15880
15897
|
import path27 from "path";
|
|
15881
|
-
import
|
|
15898
|
+
import chalk121 from "chalk";
|
|
15882
15899
|
import ts5 from "typescript";
|
|
15883
15900
|
|
|
15884
15901
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -16129,7 +16146,7 @@ function createSourceFromFile(filePath) {
|
|
|
16129
16146
|
function withSourceFiles(pattern2, callback, extraIgnore = []) {
|
|
16130
16147
|
const files = findSourceFiles2(pattern2, ".", extraIgnore);
|
|
16131
16148
|
if (files.length === 0) {
|
|
16132
|
-
console.log(
|
|
16149
|
+
console.log(chalk121.yellow("No files found matching pattern"));
|
|
16133
16150
|
return void 0;
|
|
16134
16151
|
}
|
|
16135
16152
|
return callback(files);
|
|
@@ -16162,11 +16179,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
16162
16179
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
16163
16180
|
for (const { file, name, complexity } of results) {
|
|
16164
16181
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
16165
|
-
const color = exceedsThreshold ?
|
|
16166
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
16182
|
+
const color = exceedsThreshold ? chalk122.red : chalk122.white;
|
|
16183
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk122.cyan(complexity)}`);
|
|
16167
16184
|
}
|
|
16168
16185
|
console.log(
|
|
16169
|
-
|
|
16186
|
+
chalk122.dim(
|
|
16170
16187
|
`
|
|
16171
16188
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
16172
16189
|
)
|
|
@@ -16178,7 +16195,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
16178
16195
|
}
|
|
16179
16196
|
|
|
16180
16197
|
// src/commands/complexity/halstead.ts
|
|
16181
|
-
import
|
|
16198
|
+
import chalk123 from "chalk";
|
|
16182
16199
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
16183
16200
|
withSourceFiles(pattern2, (files) => {
|
|
16184
16201
|
const results = [];
|
|
@@ -16193,13 +16210,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
16193
16210
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
16194
16211
|
for (const { file, name, metrics } of results) {
|
|
16195
16212
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
16196
|
-
const color = exceedsThreshold ?
|
|
16213
|
+
const color = exceedsThreshold ? chalk123.red : chalk123.white;
|
|
16197
16214
|
console.log(
|
|
16198
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
16215
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk123.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk123.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk123.magenta(metrics.effort.toFixed(1))}`
|
|
16199
16216
|
);
|
|
16200
16217
|
}
|
|
16201
16218
|
console.log(
|
|
16202
|
-
|
|
16219
|
+
chalk123.dim(
|
|
16203
16220
|
`
|
|
16204
16221
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
16205
16222
|
)
|
|
@@ -16268,15 +16285,15 @@ function collectFileMetrics(files) {
|
|
|
16268
16285
|
}
|
|
16269
16286
|
|
|
16270
16287
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
16271
|
-
import
|
|
16288
|
+
import chalk127 from "chalk";
|
|
16272
16289
|
|
|
16273
16290
|
// src/commands/complexity/maintainability/formatResultLine.ts
|
|
16274
|
-
import
|
|
16291
|
+
import chalk124 from "chalk";
|
|
16275
16292
|
function formatResultLine(entry, failing) {
|
|
16276
16293
|
const { file, avgMaintainability, minMaintainability, override } = entry;
|
|
16277
|
-
const name = failing ?
|
|
16278
|
-
const suffix = override !== void 0 ?
|
|
16279
|
-
return `${name} \u2192 avg: ${
|
|
16294
|
+
const name = failing ? chalk124.red(file) : chalk124.white(file);
|
|
16295
|
+
const suffix = override !== void 0 ? chalk124.magenta(` (override: ${override})`) : "";
|
|
16296
|
+
return `${name} \u2192 avg: ${chalk124.cyan(avgMaintainability.toFixed(1))}, min: ${chalk124.yellow(minMaintainability.toFixed(1))}${suffix}`;
|
|
16280
16297
|
}
|
|
16281
16298
|
|
|
16282
16299
|
// src/commands/complexity/maintainability/getMaintainabilityGitState.ts
|
|
@@ -16327,38 +16344,38 @@ function getMaintainabilityGitState() {
|
|
|
16327
16344
|
|
|
16328
16345
|
// src/commands/complexity/maintainability/printMaintainabilityFailure.ts
|
|
16329
16346
|
import path29 from "path";
|
|
16330
|
-
import
|
|
16347
|
+
import chalk125 from "chalk";
|
|
16331
16348
|
var extractTemplate = "assist refactor extract <file> <functionName> <destination> --apply";
|
|
16332
16349
|
function remediationLine(entry) {
|
|
16333
|
-
return ` ${
|
|
16350
|
+
return ` ${chalk125.bold(entry.file)}
|
|
16334
16351
|
Pick a responsibility and extract it:
|
|
16335
|
-
${
|
|
16352
|
+
${chalk125.cyan(extractTemplate)}`;
|
|
16336
16353
|
}
|
|
16337
16354
|
function cheatLine(entry, gitState) {
|
|
16338
16355
|
const shrank = gitState.shrunkFiles.has(path29.resolve(entry.file));
|
|
16339
16356
|
if (!shrank || gitState.newFileCreated) return "";
|
|
16340
16357
|
return `
|
|
16341
|
-
${
|
|
16358
|
+
${chalk125.red("\u2717 You shrank existing lines in this file without creating a new file. That cannot clear the gate \u2014 extract a responsibility to a new file.")}`;
|
|
16342
16359
|
}
|
|
16343
16360
|
function printMaintainabilityFailure(failing, gitState) {
|
|
16344
16361
|
const blocks = failing.map((entry) => `${remediationLine(entry)}${cheatLine(entry, gitState)}`).join("\n");
|
|
16345
16362
|
console.error(
|
|
16346
|
-
|
|
16363
|
+
chalk125.red(
|
|
16347
16364
|
`
|
|
16348
16365
|
Fail: ${failing.length} file(s) below threshold \u2192 extract a responsibility to a new file.
|
|
16349
16366
|
|
|
16350
16367
|
${blocks}
|
|
16351
16368
|
|
|
16352
|
-
${
|
|
16369
|
+
${chalk125.bold("Diagnose and fix one file at a time.")} Only a new file (Write) or 'assist refactor extract' clears this gate \u2014 editing the existing lines does not.`
|
|
16353
16370
|
)
|
|
16354
16371
|
);
|
|
16355
16372
|
}
|
|
16356
16373
|
|
|
16357
16374
|
// src/commands/complexity/maintainability/printMaintainabilityFormula.ts
|
|
16358
|
-
import
|
|
16375
|
+
import chalk126 from "chalk";
|
|
16359
16376
|
var MI_FORMULA = "171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100";
|
|
16360
16377
|
function printMaintainabilityFormula() {
|
|
16361
|
-
console.log(
|
|
16378
|
+
console.log(chalk126.dim(MI_FORMULA));
|
|
16362
16379
|
}
|
|
16363
16380
|
|
|
16364
16381
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
@@ -16367,7 +16384,7 @@ function displayMaintainabilityResults(results, threshold, gitState = getMaintai
|
|
|
16367
16384
|
if (!gating) {
|
|
16368
16385
|
printMaintainabilityFormula();
|
|
16369
16386
|
for (const entry of results) console.log(formatResultLine(entry, false));
|
|
16370
|
-
console.log(
|
|
16387
|
+
console.log(chalk127.dim(`
|
|
16371
16388
|
Analyzed ${results.length} files`));
|
|
16372
16389
|
return;
|
|
16373
16390
|
}
|
|
@@ -16376,14 +16393,14 @@ Analyzed ${results.length} files`));
|
|
|
16376
16393
|
return limit !== void 0 && r.minMaintainability < limit;
|
|
16377
16394
|
});
|
|
16378
16395
|
if (failing.length === 0) {
|
|
16379
|
-
console.log(
|
|
16396
|
+
console.log(chalk127.green("All files pass maintainability threshold"));
|
|
16380
16397
|
}
|
|
16381
16398
|
const passingOverrides = results.filter(
|
|
16382
16399
|
(r) => r.override !== void 0 && !failing.includes(r)
|
|
16383
16400
|
);
|
|
16384
16401
|
for (const entry of passingOverrides)
|
|
16385
16402
|
console.log(formatResultLine(entry, false));
|
|
16386
|
-
console.log(
|
|
16403
|
+
console.log(chalk127.dim(`
|
|
16387
16404
|
Analyzed ${results.length} files`));
|
|
16388
16405
|
if (failing.length > 0) {
|
|
16389
16406
|
printMaintainabilityFailure(failing, gitState);
|
|
@@ -16406,7 +16423,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
16406
16423
|
|
|
16407
16424
|
// src/commands/complexity/sloc.ts
|
|
16408
16425
|
import fs22 from "fs";
|
|
16409
|
-
import
|
|
16426
|
+
import chalk128 from "chalk";
|
|
16410
16427
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
16411
16428
|
withSourceFiles(pattern2, (files) => {
|
|
16412
16429
|
const results = [];
|
|
@@ -16422,12 +16439,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
16422
16439
|
results.sort((a, b) => b.lines - a.lines);
|
|
16423
16440
|
for (const { file, lines: lines2 } of results) {
|
|
16424
16441
|
const exceedsThreshold = options2.threshold !== void 0 && lines2 > options2.threshold;
|
|
16425
|
-
const color = exceedsThreshold ?
|
|
16426
|
-
console.log(`${color(file)} \u2192 ${
|
|
16442
|
+
const color = exceedsThreshold ? chalk128.red : chalk128.white;
|
|
16443
|
+
console.log(`${color(file)} \u2192 ${chalk128.cyan(lines2)} lines`);
|
|
16427
16444
|
}
|
|
16428
16445
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
16429
16446
|
console.log(
|
|
16430
|
-
|
|
16447
|
+
chalk128.dim(`
|
|
16431
16448
|
Total: ${total} lines across ${files.length} files`)
|
|
16432
16449
|
);
|
|
16433
16450
|
if (hasViolation) {
|
|
@@ -16441,25 +16458,25 @@ async function analyze(pattern2) {
|
|
|
16441
16458
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
16442
16459
|
const files = findSourceFiles2(searchPattern);
|
|
16443
16460
|
if (files.length === 0) {
|
|
16444
|
-
console.log(
|
|
16461
|
+
console.log(chalk129.yellow("No files found matching pattern"));
|
|
16445
16462
|
return;
|
|
16446
16463
|
}
|
|
16447
16464
|
if (files.length === 1) {
|
|
16448
16465
|
const file = files[0];
|
|
16449
|
-
console.log(
|
|
16466
|
+
console.log(chalk129.bold.underline("SLOC"));
|
|
16450
16467
|
await sloc(file);
|
|
16451
16468
|
console.log();
|
|
16452
|
-
console.log(
|
|
16469
|
+
console.log(chalk129.bold.underline("Cyclomatic Complexity"));
|
|
16453
16470
|
await cyclomatic(file);
|
|
16454
16471
|
console.log();
|
|
16455
|
-
console.log(
|
|
16472
|
+
console.log(chalk129.bold.underline("Halstead Metrics"));
|
|
16456
16473
|
await halstead(file);
|
|
16457
16474
|
console.log();
|
|
16458
|
-
console.log(
|
|
16475
|
+
console.log(chalk129.bold.underline("Maintainability Index"));
|
|
16459
16476
|
await maintainability(file);
|
|
16460
16477
|
console.log();
|
|
16461
16478
|
console.log(
|
|
16462
|
-
|
|
16479
|
+
chalk129.dim(
|
|
16463
16480
|
"To improve the maintainability index, extract functions and logic out of this file into separate, smaller modules. Collapsing whitespace or removing comments is not the goal."
|
|
16464
16481
|
)
|
|
16465
16482
|
);
|
|
@@ -16510,7 +16527,7 @@ function configList() {
|
|
|
16510
16527
|
}
|
|
16511
16528
|
|
|
16512
16529
|
// src/commands/config/configGet.ts
|
|
16513
|
-
import
|
|
16530
|
+
import chalk130 from "chalk";
|
|
16514
16531
|
function configGet(key) {
|
|
16515
16532
|
console.log(
|
|
16516
16533
|
formatOutput(
|
|
@@ -16527,12 +16544,12 @@ function requireNestedValue(config, key) {
|
|
|
16527
16544
|
return value;
|
|
16528
16545
|
}
|
|
16529
16546
|
function exitKeyNotSet(key) {
|
|
16530
|
-
console.error(
|
|
16547
|
+
console.error(chalk130.red(`Key "${key}" is not set`));
|
|
16531
16548
|
process.exit(1);
|
|
16532
16549
|
}
|
|
16533
16550
|
|
|
16534
16551
|
// src/commands/config/configSet.ts
|
|
16535
|
-
import
|
|
16552
|
+
import chalk132 from "chalk";
|
|
16536
16553
|
|
|
16537
16554
|
// src/commands/config/coerceCliConfigValue.ts
|
|
16538
16555
|
function coerceCliConfigValue(key, raw) {
|
|
@@ -16553,9 +16570,9 @@ function coerceWithoutSchemaLeaf(raw) {
|
|
|
16553
16570
|
}
|
|
16554
16571
|
|
|
16555
16572
|
// src/commands/config/exitWithConfigErrors.ts
|
|
16556
|
-
import
|
|
16573
|
+
import chalk131 from "chalk";
|
|
16557
16574
|
function exitWithConfigErrors(errors) {
|
|
16558
|
-
for (const error of errors) console.error(
|
|
16575
|
+
for (const error of errors) console.error(chalk131.red(error));
|
|
16559
16576
|
process.exit(1);
|
|
16560
16577
|
}
|
|
16561
16578
|
|
|
@@ -16574,13 +16591,13 @@ function resolveRepoTarget(key, value, repo) {
|
|
|
16574
16591
|
function configSet(key, value, options2 = {}) {
|
|
16575
16592
|
if (options2.repo !== void 0 && !options2.global) {
|
|
16576
16593
|
console.error(
|
|
16577
|
-
|
|
16594
|
+
chalk132.red("--repo writes to the global config; add -g (e.g. -g --repo)")
|
|
16578
16595
|
);
|
|
16579
16596
|
process.exit(1);
|
|
16580
16597
|
}
|
|
16581
16598
|
const resolved = resolveRepoTarget(key, value, options2.repo);
|
|
16582
16599
|
if (resolved.value === void 0) {
|
|
16583
|
-
console.error(
|
|
16600
|
+
console.error(chalk132.red(`Missing required argument for '${resolved.key}'`));
|
|
16584
16601
|
process.exit(1);
|
|
16585
16602
|
}
|
|
16586
16603
|
const coercion = coerceCliConfigValue(resolved.key, resolved.value);
|
|
@@ -16588,7 +16605,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
16588
16605
|
const coerced = coercion.value;
|
|
16589
16606
|
const target = resolved.useRepo ? `repo: ${applyRepoOrExit(resolved.key, coerced, resolved.repoName)}` : applyOrExit(resolved.key, coerced, options2.global ?? false);
|
|
16590
16607
|
console.log(
|
|
16591
|
-
|
|
16608
|
+
chalk132.green(`Set ${resolved.key} = ${JSON.stringify(coerced)} (${target})`)
|
|
16592
16609
|
);
|
|
16593
16610
|
}
|
|
16594
16611
|
function applyOrExit(key, coerced, global) {
|
|
@@ -16603,7 +16620,7 @@ function applyRepoOrExit(key, coerced, repoName) {
|
|
|
16603
16620
|
}
|
|
16604
16621
|
|
|
16605
16622
|
// src/commands/config/configUnset.ts
|
|
16606
|
-
import
|
|
16623
|
+
import chalk133 from "chalk";
|
|
16607
16624
|
|
|
16608
16625
|
// src/commands/config/resolveRepoUnsetTarget.ts
|
|
16609
16626
|
function resolveRepoUnsetTarget(key, repo) {
|
|
@@ -16619,7 +16636,7 @@ function resolveRepoUnsetTarget(key, repo) {
|
|
|
16619
16636
|
function configUnset(key, options2 = {}) {
|
|
16620
16637
|
if (options2.repo !== void 0 && !options2.global) {
|
|
16621
16638
|
console.error(
|
|
16622
|
-
|
|
16639
|
+
chalk133.red(
|
|
16623
16640
|
"--repo removes from the global config; add -g (e.g. -g --repo)"
|
|
16624
16641
|
)
|
|
16625
16642
|
);
|
|
@@ -16627,7 +16644,7 @@ function configUnset(key, options2 = {}) {
|
|
|
16627
16644
|
}
|
|
16628
16645
|
const resolved = resolveRepoUnsetTarget(key, options2.repo);
|
|
16629
16646
|
if (resolved.key === void 0) {
|
|
16630
|
-
console.error(
|
|
16647
|
+
console.error(chalk133.red("Missing required argument 'key'"));
|
|
16631
16648
|
process.exit(1);
|
|
16632
16649
|
return;
|
|
16633
16650
|
}
|
|
@@ -16635,11 +16652,11 @@ function configUnset(key, options2 = {}) {
|
|
|
16635
16652
|
if (!result.ok) exitWithConfigErrors(result.errors);
|
|
16636
16653
|
if (!result.removed) {
|
|
16637
16654
|
console.log(
|
|
16638
|
-
|
|
16655
|
+
chalk133.yellow(`${resolved.key} is not set in ${whereLabel(result)}`)
|
|
16639
16656
|
);
|
|
16640
16657
|
return;
|
|
16641
16658
|
}
|
|
16642
|
-
console.log(
|
|
16659
|
+
console.log(chalk133.green(`Unset ${resolved.key} (${targetLabel(result)})`));
|
|
16643
16660
|
}
|
|
16644
16661
|
function whereLabel(result) {
|
|
16645
16662
|
return result.target === "repo" ? `repos.${result.label}` : `the ${result.target} config`;
|
|
@@ -16664,40 +16681,40 @@ function registerConfig(program2) {
|
|
|
16664
16681
|
}
|
|
16665
16682
|
|
|
16666
16683
|
// src/commands/db/reportMigrationStatus.ts
|
|
16667
|
-
import
|
|
16684
|
+
import chalk134 from "chalk";
|
|
16668
16685
|
function reportApplied(applied) {
|
|
16669
16686
|
if (applied.length === 0) {
|
|
16670
|
-
console.error(
|
|
16687
|
+
console.error(chalk134.green("Database is up to date; nothing to apply."));
|
|
16671
16688
|
return;
|
|
16672
16689
|
}
|
|
16673
16690
|
for (const migration of applied) {
|
|
16674
16691
|
console.error(
|
|
16675
|
-
|
|
16692
|
+
chalk134.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
16676
16693
|
);
|
|
16677
16694
|
}
|
|
16678
16695
|
}
|
|
16679
16696
|
function reportMigrationStatus(status3) {
|
|
16680
16697
|
if (status3.state === "in-sync") {
|
|
16681
16698
|
console.error(
|
|
16682
|
-
|
|
16699
|
+
chalk134.green(`In sync at migration ${status3.version} (latest).`)
|
|
16683
16700
|
);
|
|
16684
16701
|
return;
|
|
16685
16702
|
}
|
|
16686
16703
|
if (status3.state === "behind") {
|
|
16687
16704
|
console.error(
|
|
16688
|
-
|
|
16705
|
+
chalk134.yellow(
|
|
16689
16706
|
`Behind: applied ${status3.applied}, build expects ${status3.expected}.`
|
|
16690
16707
|
)
|
|
16691
16708
|
);
|
|
16692
16709
|
console.error(
|
|
16693
|
-
|
|
16710
|
+
chalk134.yellow(
|
|
16694
16711
|
`Pending: ${status3.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
16695
16712
|
)
|
|
16696
16713
|
);
|
|
16697
16714
|
return;
|
|
16698
16715
|
}
|
|
16699
16716
|
console.error(
|
|
16700
|
-
|
|
16717
|
+
chalk134.red(
|
|
16701
16718
|
`Ahead: applied ${status3.applied}, build knows ${status3.expected}. Update assist.`
|
|
16702
16719
|
)
|
|
16703
16720
|
);
|
|
@@ -16732,7 +16749,7 @@ function registerDb(program2) {
|
|
|
16732
16749
|
|
|
16733
16750
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
16734
16751
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync26 } from "fs";
|
|
16735
|
-
import
|
|
16752
|
+
import chalk135 from "chalk";
|
|
16736
16753
|
|
|
16737
16754
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
16738
16755
|
import { join as join36 } from "path";
|
|
@@ -16763,7 +16780,7 @@ function dbMigrationConfirm(pin) {
|
|
|
16763
16780
|
sweepRestrictedDir();
|
|
16764
16781
|
const state = readMigrationPinState(pin);
|
|
16765
16782
|
if (!state) {
|
|
16766
|
-
console.error(
|
|
16783
|
+
console.error(chalk135.red(`No pending migration unlock for pin: ${pin}`));
|
|
16767
16784
|
process.exitCode = 1;
|
|
16768
16785
|
return;
|
|
16769
16786
|
}
|
|
@@ -16773,7 +16790,7 @@ function dbMigrationConfirm(pin) {
|
|
|
16773
16790
|
);
|
|
16774
16791
|
unlinkSync9(getMigrationPinPath(pin));
|
|
16775
16792
|
console.log(
|
|
16776
|
-
|
|
16793
|
+
chalk135.green(
|
|
16777
16794
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
16778
16795
|
)
|
|
16779
16796
|
);
|
|
@@ -16782,7 +16799,7 @@ function dbMigrationConfirm(pin) {
|
|
|
16782
16799
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
16783
16800
|
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync27 } from "fs";
|
|
16784
16801
|
import { randomInt as randomInt2 } from "crypto";
|
|
16785
|
-
import
|
|
16802
|
+
import chalk136 from "chalk";
|
|
16786
16803
|
|
|
16787
16804
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
16788
16805
|
function nextMigrationId() {
|
|
@@ -16797,7 +16814,7 @@ function dbMigrationUnlock() {
|
|
|
16797
16814
|
sweepRestrictedDir();
|
|
16798
16815
|
writeFileSync27(getMigrationPinPath(pin), JSON.stringify({ pin, migrationId }));
|
|
16799
16816
|
console.error(
|
|
16800
|
-
|
|
16817
|
+
chalk136.yellow.bold(
|
|
16801
16818
|
"THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a new database migration.\nA schema change is hard to reverse once shipped. You had BETTER have confirmed\nthe change with the user and be certain this migration is genuinely necessary."
|
|
16802
16819
|
)
|
|
16803
16820
|
);
|
|
@@ -16807,7 +16824,7 @@ function dbMigrationUnlock() {
|
|
|
16807
16824
|
});
|
|
16808
16825
|
if (!delivered) {
|
|
16809
16826
|
console.error(
|
|
16810
|
-
|
|
16827
|
+
chalk136.red(
|
|
16811
16828
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
16812
16829
|
)
|
|
16813
16830
|
);
|
|
@@ -16817,7 +16834,7 @@ function dbMigrationUnlock() {
|
|
|
16817
16834
|
console.log(
|
|
16818
16835
|
`A confirmation pin was sent to your desktop notifications.
|
|
16819
16836
|
To approve creating migration ${migrationId}, run:
|
|
16820
|
-
${
|
|
16837
|
+
${chalk136.cyan(" assist db-migration confirm <PIN>")}
|
|
16821
16838
|
using the pin from that notification.`
|
|
16822
16839
|
);
|
|
16823
16840
|
}
|
|
@@ -16837,7 +16854,7 @@ function registerDbMigration(parent) {
|
|
|
16837
16854
|
|
|
16838
16855
|
// src/commands/deploy/redirect.ts
|
|
16839
16856
|
import { existsSync as existsSync36, readFileSync as readFileSync31, writeFileSync as writeFileSync28 } from "fs";
|
|
16840
|
-
import
|
|
16857
|
+
import chalk137 from "chalk";
|
|
16841
16858
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
16842
16859
|
if (!window.location.pathname.endsWith('/')) {
|
|
16843
16860
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -16846,23 +16863,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
16846
16863
|
function redirect() {
|
|
16847
16864
|
const indexPath = "index.html";
|
|
16848
16865
|
if (!existsSync36(indexPath)) {
|
|
16849
|
-
console.log(
|
|
16866
|
+
console.log(chalk137.yellow("No index.html found"));
|
|
16850
16867
|
return;
|
|
16851
16868
|
}
|
|
16852
16869
|
const content = readFileSync31(indexPath, "utf8");
|
|
16853
16870
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
16854
|
-
console.log(
|
|
16871
|
+
console.log(chalk137.dim("Trailing slash script already present"));
|
|
16855
16872
|
return;
|
|
16856
16873
|
}
|
|
16857
16874
|
const headCloseIndex = content.indexOf("</head>");
|
|
16858
16875
|
if (headCloseIndex === -1) {
|
|
16859
|
-
console.log(
|
|
16876
|
+
console.log(chalk137.red("Could not find </head> tag in index.html"));
|
|
16860
16877
|
return;
|
|
16861
16878
|
}
|
|
16862
16879
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
16863
16880
|
${content.slice(headCloseIndex)}`;
|
|
16864
16881
|
writeFileSync28(indexPath, newContent);
|
|
16865
|
-
console.log(
|
|
16882
|
+
console.log(chalk137.green("Added trailing slash redirect to index.html"));
|
|
16866
16883
|
}
|
|
16867
16884
|
|
|
16868
16885
|
// src/commands/registerDeploy.ts
|
|
@@ -16889,7 +16906,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
16889
16906
|
|
|
16890
16907
|
// src/commands/devlog/shared.ts
|
|
16891
16908
|
import { execSync as execSync36 } from "child_process";
|
|
16892
|
-
import
|
|
16909
|
+
import chalk138 from "chalk";
|
|
16893
16910
|
|
|
16894
16911
|
// src/shared/getRepoName.ts
|
|
16895
16912
|
import { existsSync as existsSync37, readFileSync as readFileSync32 } from "fs";
|
|
@@ -16998,13 +17015,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
16998
17015
|
}
|
|
16999
17016
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
17000
17017
|
for (const commit2 of commits2) {
|
|
17001
|
-
console.log(` ${
|
|
17018
|
+
console.log(` ${chalk138.yellow(commit2.hash)} ${commit2.message}`);
|
|
17002
17019
|
if (verbose) {
|
|
17003
17020
|
const visibleFiles = commit2.files.filter(
|
|
17004
17021
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
17005
17022
|
);
|
|
17006
17023
|
for (const file of visibleFiles) {
|
|
17007
|
-
console.log(` ${
|
|
17024
|
+
console.log(` ${chalk138.dim(file)}`);
|
|
17008
17025
|
}
|
|
17009
17026
|
}
|
|
17010
17027
|
}
|
|
@@ -17029,15 +17046,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
17029
17046
|
}
|
|
17030
17047
|
|
|
17031
17048
|
// src/commands/devlog/list/printDateHeader.ts
|
|
17032
|
-
import
|
|
17049
|
+
import chalk139 from "chalk";
|
|
17033
17050
|
function printDateHeader(date, isSkipped, entries) {
|
|
17034
17051
|
if (isSkipped) {
|
|
17035
|
-
console.log(`${
|
|
17052
|
+
console.log(`${chalk139.bold.blue(date)} ${chalk139.dim("skipped")}`);
|
|
17036
17053
|
} else if (entries && entries.length > 0) {
|
|
17037
|
-
const entryInfo = entries.map((e) => `${
|
|
17038
|
-
console.log(`${
|
|
17054
|
+
const entryInfo = entries.map((e) => `${chalk139.green(e.version)} ${e.title}`).join(" | ");
|
|
17055
|
+
console.log(`${chalk139.bold.blue(date)} ${entryInfo}`);
|
|
17039
17056
|
} else {
|
|
17040
|
-
console.log(`${
|
|
17057
|
+
console.log(`${chalk139.bold.blue(date)} ${chalk139.red("\u26A0 devlog missing")}`);
|
|
17041
17058
|
}
|
|
17042
17059
|
}
|
|
17043
17060
|
|
|
@@ -17141,24 +17158,24 @@ function bumpVersion(version2, type) {
|
|
|
17141
17158
|
|
|
17142
17159
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
17143
17160
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
17144
|
-
import
|
|
17161
|
+
import chalk141 from "chalk";
|
|
17145
17162
|
|
|
17146
17163
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
17147
|
-
import
|
|
17164
|
+
import chalk140 from "chalk";
|
|
17148
17165
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
17149
17166
|
if (conventional && firstHash) {
|
|
17150
17167
|
const version2 = getVersionAtCommit(firstHash);
|
|
17151
17168
|
if (version2) {
|
|
17152
|
-
console.log(`${
|
|
17169
|
+
console.log(`${chalk140.bold("version:")} ${stripToMinor(version2)}`);
|
|
17153
17170
|
} else {
|
|
17154
|
-
console.log(`${
|
|
17171
|
+
console.log(`${chalk140.bold("version:")} ${chalk140.red("unknown")}`);
|
|
17155
17172
|
}
|
|
17156
17173
|
} else if (patchVersion && minorVersion) {
|
|
17157
17174
|
console.log(
|
|
17158
|
-
`${
|
|
17175
|
+
`${chalk140.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
17159
17176
|
);
|
|
17160
17177
|
} else {
|
|
17161
|
-
console.log(`${
|
|
17178
|
+
console.log(`${chalk140.bold("version:")} v0.1 (initial)`);
|
|
17162
17179
|
}
|
|
17163
17180
|
}
|
|
17164
17181
|
|
|
@@ -17206,16 +17223,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
17206
17223
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
17207
17224
|
}
|
|
17208
17225
|
function logName(repoName) {
|
|
17209
|
-
console.log(`${
|
|
17226
|
+
console.log(`${chalk141.bold("name:")} ${repoName}`);
|
|
17210
17227
|
}
|
|
17211
17228
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
17212
17229
|
logName(ctx.repoName);
|
|
17213
17230
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
17214
|
-
console.log(
|
|
17231
|
+
console.log(chalk141.bold.blue(targetDate));
|
|
17215
17232
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
17216
17233
|
}
|
|
17217
17234
|
function logNoCommits(lastInfo) {
|
|
17218
|
-
console.log(
|
|
17235
|
+
console.log(chalk141.dim(noCommitsMessage(!!lastInfo)));
|
|
17219
17236
|
}
|
|
17220
17237
|
|
|
17221
17238
|
// src/commands/devlog/next/index.ts
|
|
@@ -17256,11 +17273,11 @@ function next2(options2) {
|
|
|
17256
17273
|
import { execSync as execSync38 } from "child_process";
|
|
17257
17274
|
|
|
17258
17275
|
// src/commands/devlog/repos/printReposTable.ts
|
|
17259
|
-
import
|
|
17276
|
+
import chalk142 from "chalk";
|
|
17260
17277
|
function colorStatus(status3) {
|
|
17261
|
-
if (status3 === "missing") return
|
|
17262
|
-
if (status3 === "outdated") return
|
|
17263
|
-
return
|
|
17278
|
+
if (status3 === "missing") return chalk142.red(status3);
|
|
17279
|
+
if (status3 === "outdated") return chalk142.yellow(status3);
|
|
17280
|
+
return chalk142.green(status3);
|
|
17264
17281
|
}
|
|
17265
17282
|
function formatRow(row, nameWidth) {
|
|
17266
17283
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -17274,8 +17291,8 @@ function printReposTable(rows) {
|
|
|
17274
17291
|
"Last Devlog".padEnd(11),
|
|
17275
17292
|
"Status"
|
|
17276
17293
|
].join(" ");
|
|
17277
|
-
console.log(
|
|
17278
|
-
console.log(
|
|
17294
|
+
console.log(chalk142.dim(header));
|
|
17295
|
+
console.log(chalk142.dim("-".repeat(header.length)));
|
|
17279
17296
|
for (const row of rows) {
|
|
17280
17297
|
console.log(formatRow(row, nameWidth));
|
|
17281
17298
|
}
|
|
@@ -17333,14 +17350,14 @@ function repos(options2) {
|
|
|
17333
17350
|
// src/commands/devlog/skip.ts
|
|
17334
17351
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
17335
17352
|
import { join as join40 } from "path";
|
|
17336
|
-
import
|
|
17353
|
+
import chalk143 from "chalk";
|
|
17337
17354
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
17338
17355
|
function getBlogConfigPath() {
|
|
17339
17356
|
return join40(BLOG_REPO_ROOT, "assist.yml");
|
|
17340
17357
|
}
|
|
17341
17358
|
function skip(date) {
|
|
17342
17359
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
17343
|
-
console.log(
|
|
17360
|
+
console.log(chalk143.red("Invalid date format. Use YYYY-MM-DD"));
|
|
17344
17361
|
process.exit(1);
|
|
17345
17362
|
}
|
|
17346
17363
|
const repoName = getRepoName();
|
|
@@ -17351,7 +17368,7 @@ function skip(date) {
|
|
|
17351
17368
|
const skipDays = skip2[repoName] ?? [];
|
|
17352
17369
|
if (skipDays.includes(date)) {
|
|
17353
17370
|
console.log(
|
|
17354
|
-
|
|
17371
|
+
chalk143.yellow(`${date} is already in skip list for ${repoName}`)
|
|
17355
17372
|
);
|
|
17356
17373
|
return;
|
|
17357
17374
|
}
|
|
@@ -17361,20 +17378,20 @@ function skip(date) {
|
|
|
17361
17378
|
devlog.skip = skip2;
|
|
17362
17379
|
config.devlog = devlog;
|
|
17363
17380
|
writeFileSync29(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
17364
|
-
console.log(
|
|
17381
|
+
console.log(chalk143.green(`Added ${date} to skip list for ${repoName}`));
|
|
17365
17382
|
}
|
|
17366
17383
|
|
|
17367
17384
|
// src/commands/devlog/version.ts
|
|
17368
|
-
import
|
|
17385
|
+
import chalk144 from "chalk";
|
|
17369
17386
|
function version() {
|
|
17370
17387
|
const config = loadConfig();
|
|
17371
17388
|
const name = getRepoName();
|
|
17372
17389
|
const lastInfo = getLastVersionInfo(name, config);
|
|
17373
17390
|
const lastVersion = lastInfo?.version ?? null;
|
|
17374
17391
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
17375
|
-
console.log(`${
|
|
17376
|
-
console.log(`${
|
|
17377
|
-
console.log(`${
|
|
17392
|
+
console.log(`${chalk144.bold("name:")} ${name}`);
|
|
17393
|
+
console.log(`${chalk144.bold("last:")} ${lastVersion ?? chalk144.dim("none")}`);
|
|
17394
|
+
console.log(`${chalk144.bold("next:")} ${nextVersion ?? chalk144.dim("none")}`);
|
|
17378
17395
|
}
|
|
17379
17396
|
|
|
17380
17397
|
// src/commands/devlog/devlogConfigHelp.ts
|
|
@@ -17418,7 +17435,7 @@ function registerDevlog(program2) {
|
|
|
17418
17435
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
17419
17436
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync5 } from "fs";
|
|
17420
17437
|
import { join as join41 } from "path";
|
|
17421
|
-
import
|
|
17438
|
+
import chalk145 from "chalk";
|
|
17422
17439
|
|
|
17423
17440
|
// src/shared/findRepoRoot.ts
|
|
17424
17441
|
import { existsSync as existsSync38 } from "fs";
|
|
@@ -17481,14 +17498,14 @@ function checkBuildLocks(startDir) {
|
|
|
17481
17498
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
17482
17499
|
if (locked) {
|
|
17483
17500
|
console.error(
|
|
17484
|
-
|
|
17501
|
+
chalk145.red("Build output locked (is VS debugging?): ") + locked
|
|
17485
17502
|
);
|
|
17486
17503
|
process.exit(1);
|
|
17487
17504
|
}
|
|
17488
17505
|
}
|
|
17489
17506
|
async function checkBuildLocksCommand() {
|
|
17490
17507
|
checkBuildLocks();
|
|
17491
|
-
console.log(
|
|
17508
|
+
console.log(chalk145.green("No build locks detected"));
|
|
17492
17509
|
}
|
|
17493
17510
|
|
|
17494
17511
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -17587,30 +17604,30 @@ function escapeRegex(s) {
|
|
|
17587
17604
|
}
|
|
17588
17605
|
|
|
17589
17606
|
// src/commands/dotnet/printTree.ts
|
|
17590
|
-
import
|
|
17607
|
+
import chalk146 from "chalk";
|
|
17591
17608
|
function printNodes(nodes, prefix2) {
|
|
17592
17609
|
for (let i = 0; i < nodes.length; i++) {
|
|
17593
17610
|
const isLast = i === nodes.length - 1;
|
|
17594
17611
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
17595
17612
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
17596
17613
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
17597
|
-
const label2 = isMissing ?
|
|
17614
|
+
const label2 = isMissing ? chalk146.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
17598
17615
|
console.log(`${prefix2}${connector}${label2}`);
|
|
17599
17616
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
17600
17617
|
}
|
|
17601
17618
|
}
|
|
17602
17619
|
function printTree(tree, totalCount, solutions) {
|
|
17603
|
-
console.log(
|
|
17604
|
-
console.log(
|
|
17620
|
+
console.log(chalk146.bold("\nProject Dependency Tree"));
|
|
17621
|
+
console.log(chalk146.cyan(tree.relativePath));
|
|
17605
17622
|
printNodes(tree.children, "");
|
|
17606
|
-
console.log(
|
|
17623
|
+
console.log(chalk146.dim(`
|
|
17607
17624
|
${totalCount} projects total (including root)`));
|
|
17608
|
-
console.log(
|
|
17625
|
+
console.log(chalk146.bold("\nSolution Membership"));
|
|
17609
17626
|
if (solutions.length === 0) {
|
|
17610
|
-
console.log(
|
|
17627
|
+
console.log(chalk146.yellow(" Not found in any .sln"));
|
|
17611
17628
|
} else {
|
|
17612
17629
|
for (const sln of solutions) {
|
|
17613
|
-
console.log(` ${
|
|
17630
|
+
console.log(` ${chalk146.green(sln)}`);
|
|
17614
17631
|
}
|
|
17615
17632
|
}
|
|
17616
17633
|
console.log();
|
|
@@ -17639,16 +17656,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
17639
17656
|
// src/commands/dotnet/resolveCsproj.ts
|
|
17640
17657
|
import { existsSync as existsSync39 } from "fs";
|
|
17641
17658
|
import path33 from "path";
|
|
17642
|
-
import
|
|
17659
|
+
import chalk147 from "chalk";
|
|
17643
17660
|
function resolveCsproj(csprojPath) {
|
|
17644
17661
|
const resolved = path33.resolve(csprojPath);
|
|
17645
17662
|
if (!existsSync39(resolved)) {
|
|
17646
|
-
console.error(
|
|
17663
|
+
console.error(chalk147.red(`File not found: ${resolved}`));
|
|
17647
17664
|
process.exit(1);
|
|
17648
17665
|
}
|
|
17649
17666
|
const repoRoot = findRepoRoot(path33.dirname(resolved));
|
|
17650
17667
|
if (!repoRoot) {
|
|
17651
|
-
console.error(
|
|
17668
|
+
console.error(chalk147.red("Could not find git repository root"));
|
|
17652
17669
|
process.exit(1);
|
|
17653
17670
|
}
|
|
17654
17671
|
return { resolved, repoRoot };
|
|
@@ -17698,12 +17715,12 @@ function getChangedCsFiles(scope) {
|
|
|
17698
17715
|
}
|
|
17699
17716
|
|
|
17700
17717
|
// src/commands/dotnet/inSln.ts
|
|
17701
|
-
import
|
|
17718
|
+
import chalk148 from "chalk";
|
|
17702
17719
|
async function inSln(csprojPath) {
|
|
17703
17720
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
17704
17721
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
17705
17722
|
if (solutions.length === 0) {
|
|
17706
|
-
console.log(
|
|
17723
|
+
console.log(chalk148.yellow("Not found in any .sln file"));
|
|
17707
17724
|
process.exit(1);
|
|
17708
17725
|
}
|
|
17709
17726
|
for (const sln of solutions) {
|
|
@@ -17712,7 +17729,7 @@ async function inSln(csprojPath) {
|
|
|
17712
17729
|
}
|
|
17713
17730
|
|
|
17714
17731
|
// src/commands/dotnet/inspect.ts
|
|
17715
|
-
import
|
|
17732
|
+
import chalk154 from "chalk";
|
|
17716
17733
|
|
|
17717
17734
|
// src/shared/formatElapsed.ts
|
|
17718
17735
|
function formatElapsed(ms) {
|
|
@@ -17724,12 +17741,12 @@ function formatElapsed(ms) {
|
|
|
17724
17741
|
}
|
|
17725
17742
|
|
|
17726
17743
|
// src/commands/dotnet/displayIssues.ts
|
|
17727
|
-
import
|
|
17744
|
+
import chalk149 from "chalk";
|
|
17728
17745
|
var SEVERITY_COLOR = {
|
|
17729
|
-
ERROR:
|
|
17730
|
-
WARNING:
|
|
17731
|
-
SUGGESTION:
|
|
17732
|
-
HINT:
|
|
17746
|
+
ERROR: chalk149.red,
|
|
17747
|
+
WARNING: chalk149.yellow,
|
|
17748
|
+
SUGGESTION: chalk149.cyan,
|
|
17749
|
+
HINT: chalk149.dim
|
|
17733
17750
|
};
|
|
17734
17751
|
function groupByFile(issues) {
|
|
17735
17752
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -17745,15 +17762,15 @@ function groupByFile(issues) {
|
|
|
17745
17762
|
}
|
|
17746
17763
|
function displayIssues(issues) {
|
|
17747
17764
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
17748
|
-
console.log(
|
|
17765
|
+
console.log(chalk149.bold(file));
|
|
17749
17766
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
17750
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
17767
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk149.white;
|
|
17751
17768
|
console.log(
|
|
17752
|
-
` ${
|
|
17769
|
+
` ${chalk149.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
17753
17770
|
);
|
|
17754
17771
|
}
|
|
17755
17772
|
}
|
|
17756
|
-
console.log(
|
|
17773
|
+
console.log(chalk149.dim(`
|
|
17757
17774
|
${issues.length} issue(s) found`));
|
|
17758
17775
|
}
|
|
17759
17776
|
|
|
@@ -17812,12 +17829,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
17812
17829
|
// src/commands/dotnet/resolveSolution.ts
|
|
17813
17830
|
import { existsSync as existsSync40 } from "fs";
|
|
17814
17831
|
import path34 from "path";
|
|
17815
|
-
import
|
|
17832
|
+
import chalk151 from "chalk";
|
|
17816
17833
|
|
|
17817
17834
|
// src/commands/dotnet/findSolution.ts
|
|
17818
17835
|
import { readdirSync as readdirSync7 } from "fs";
|
|
17819
17836
|
import { dirname as dirname23, join as join42 } from "path";
|
|
17820
|
-
import
|
|
17837
|
+
import chalk150 from "chalk";
|
|
17821
17838
|
function findSlnInDir(dir) {
|
|
17822
17839
|
try {
|
|
17823
17840
|
return readdirSync7(dir).filter((f) => f.endsWith(".sln")).map((f) => join42(dir, f));
|
|
@@ -17833,17 +17850,17 @@ function findSolution() {
|
|
|
17833
17850
|
const slnFiles = findSlnInDir(current);
|
|
17834
17851
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
17835
17852
|
if (slnFiles.length > 1) {
|
|
17836
|
-
console.error(
|
|
17853
|
+
console.error(chalk150.red(`Multiple .sln files found in ${current}:`));
|
|
17837
17854
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
17838
17855
|
console.error(
|
|
17839
|
-
|
|
17856
|
+
chalk150.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
17840
17857
|
);
|
|
17841
17858
|
process.exit(1);
|
|
17842
17859
|
}
|
|
17843
17860
|
if (current === ceiling) break;
|
|
17844
17861
|
current = dirname23(current);
|
|
17845
17862
|
}
|
|
17846
|
-
console.error(
|
|
17863
|
+
console.error(chalk150.red("No .sln file found between cwd and repo root"));
|
|
17847
17864
|
process.exit(1);
|
|
17848
17865
|
}
|
|
17849
17866
|
|
|
@@ -17852,7 +17869,7 @@ function resolveSolution(sln) {
|
|
|
17852
17869
|
if (sln) {
|
|
17853
17870
|
const resolved = path34.resolve(sln);
|
|
17854
17871
|
if (!existsSync40(resolved)) {
|
|
17855
|
-
console.error(
|
|
17872
|
+
console.error(chalk151.red(`Solution file not found: ${resolved}`));
|
|
17856
17873
|
process.exit(1);
|
|
17857
17874
|
}
|
|
17858
17875
|
return resolved;
|
|
@@ -17894,14 +17911,14 @@ import { execSync as execSync40 } from "child_process";
|
|
|
17894
17911
|
import { existsSync as existsSync41, readFileSync as readFileSync36, unlinkSync as unlinkSync10 } from "fs";
|
|
17895
17912
|
import { tmpdir as tmpdir4 } from "os";
|
|
17896
17913
|
import path35 from "path";
|
|
17897
|
-
import
|
|
17914
|
+
import chalk152 from "chalk";
|
|
17898
17915
|
function assertJbInstalled() {
|
|
17899
17916
|
try {
|
|
17900
17917
|
execSync40("jb inspectcode --version", { stdio: "pipe" });
|
|
17901
17918
|
} catch {
|
|
17902
|
-
console.error(
|
|
17919
|
+
console.error(chalk152.red("jb is not installed. Install with:"));
|
|
17903
17920
|
console.error(
|
|
17904
|
-
|
|
17921
|
+
chalk152.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
17905
17922
|
);
|
|
17906
17923
|
process.exit(1);
|
|
17907
17924
|
}
|
|
@@ -17919,11 +17936,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
17919
17936
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
17920
17937
|
process.stderr.write(error.stderr);
|
|
17921
17938
|
}
|
|
17922
|
-
console.error(
|
|
17939
|
+
console.error(chalk152.red("jb inspectcode failed"));
|
|
17923
17940
|
process.exit(1);
|
|
17924
17941
|
}
|
|
17925
17942
|
if (!existsSync41(reportPath)) {
|
|
17926
|
-
console.error(
|
|
17943
|
+
console.error(chalk152.red("Report file not generated"));
|
|
17927
17944
|
process.exit(1);
|
|
17928
17945
|
}
|
|
17929
17946
|
const xml = readFileSync36(reportPath, "utf8");
|
|
@@ -17933,7 +17950,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
17933
17950
|
|
|
17934
17951
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
17935
17952
|
import { execSync as execSync41 } from "child_process";
|
|
17936
|
-
import
|
|
17953
|
+
import chalk153 from "chalk";
|
|
17937
17954
|
function resolveMsbuildPath() {
|
|
17938
17955
|
const { run: run4 } = loadConfig();
|
|
17939
17956
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -17945,9 +17962,9 @@ function assertMsbuildInstalled() {
|
|
|
17945
17962
|
try {
|
|
17946
17963
|
execSync41(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
17947
17964
|
} catch {
|
|
17948
|
-
console.error(
|
|
17965
|
+
console.error(chalk153.red(`msbuild not found at: ${msbuild}`));
|
|
17949
17966
|
console.error(
|
|
17950
|
-
|
|
17967
|
+
chalk153.yellow(
|
|
17951
17968
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
17952
17969
|
)
|
|
17953
17970
|
);
|
|
@@ -17994,17 +18011,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
17994
18011
|
// src/commands/dotnet/inspect.ts
|
|
17995
18012
|
function logScope(changedFiles2) {
|
|
17996
18013
|
if (changedFiles2 === null) {
|
|
17997
|
-
console.log(
|
|
18014
|
+
console.log(chalk154.dim("Inspecting full solution..."));
|
|
17998
18015
|
} else {
|
|
17999
18016
|
console.log(
|
|
18000
|
-
|
|
18017
|
+
chalk154.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
18001
18018
|
);
|
|
18002
18019
|
}
|
|
18003
18020
|
}
|
|
18004
18021
|
function reportResults(issues, elapsed) {
|
|
18005
18022
|
if (issues.length > 0) displayIssues(issues);
|
|
18006
|
-
else console.log(
|
|
18007
|
-
console.log(
|
|
18023
|
+
else console.log(chalk154.green("No issues found"));
|
|
18024
|
+
console.log(chalk154.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
18008
18025
|
if (issues.length > 0) process.exit(1);
|
|
18009
18026
|
}
|
|
18010
18027
|
async function inspect(sln, options2) {
|
|
@@ -18015,7 +18032,7 @@ async function inspect(sln, options2) {
|
|
|
18015
18032
|
const scope = parseScope(options2.scope);
|
|
18016
18033
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
18017
18034
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
18018
|
-
console.log(
|
|
18035
|
+
console.log(chalk154.green("No changed .cs files found"));
|
|
18019
18036
|
return;
|
|
18020
18037
|
}
|
|
18021
18038
|
logScope(changedFiles2);
|
|
@@ -18398,25 +18415,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
18398
18415
|
}
|
|
18399
18416
|
|
|
18400
18417
|
// src/commands/github/printCountTable.ts
|
|
18401
|
-
import
|
|
18418
|
+
import chalk155 from "chalk";
|
|
18402
18419
|
function printCountTable(labelHeader, rows) {
|
|
18403
18420
|
const labelWidth = Math.max(
|
|
18404
18421
|
labelHeader.length,
|
|
18405
18422
|
...rows.map((row) => row.label.length)
|
|
18406
18423
|
);
|
|
18407
18424
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
18408
|
-
console.log(
|
|
18409
|
-
console.log(
|
|
18425
|
+
console.log(chalk155.dim(header));
|
|
18426
|
+
console.log(chalk155.dim("-".repeat(header.length)));
|
|
18410
18427
|
for (const row of rows) {
|
|
18411
18428
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
18412
18429
|
}
|
|
18413
18430
|
}
|
|
18414
18431
|
|
|
18415
18432
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
18416
|
-
import
|
|
18433
|
+
import chalk156 from "chalk";
|
|
18417
18434
|
function printRepoAuthorBreakdown(repos2) {
|
|
18418
18435
|
for (const repo of repos2) {
|
|
18419
|
-
console.log(
|
|
18436
|
+
console.log(chalk156.bold(repo.name));
|
|
18420
18437
|
const authorWidth = Math.max(
|
|
18421
18438
|
0,
|
|
18422
18439
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -18734,7 +18751,7 @@ function registerHandover(program2) {
|
|
|
18734
18751
|
}
|
|
18735
18752
|
|
|
18736
18753
|
// src/commands/jira/acceptanceCriteria.ts
|
|
18737
|
-
import
|
|
18754
|
+
import chalk157 from "chalk";
|
|
18738
18755
|
|
|
18739
18756
|
// src/commands/jira/adfToText.ts
|
|
18740
18757
|
function renderInline(node) {
|
|
@@ -18801,7 +18818,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
18801
18818
|
const parsed = fetchIssue(issueKey, field);
|
|
18802
18819
|
const acValue = parsed?.fields?.[field];
|
|
18803
18820
|
if (!acValue) {
|
|
18804
|
-
console.log(
|
|
18821
|
+
console.log(chalk157.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
18805
18822
|
return;
|
|
18806
18823
|
}
|
|
18807
18824
|
if (typeof acValue === "string") {
|
|
@@ -18867,14 +18884,14 @@ async function jiraAuth() {
|
|
|
18867
18884
|
}
|
|
18868
18885
|
|
|
18869
18886
|
// src/commands/jira/viewIssue.ts
|
|
18870
|
-
import
|
|
18887
|
+
import chalk158 from "chalk";
|
|
18871
18888
|
function viewIssue(issueKey) {
|
|
18872
18889
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
18873
18890
|
const fields = parsed?.fields;
|
|
18874
18891
|
const summary = fields?.summary;
|
|
18875
18892
|
const description = fields?.description;
|
|
18876
18893
|
if (summary) {
|
|
18877
|
-
console.log(
|
|
18894
|
+
console.log(chalk158.bold(summary));
|
|
18878
18895
|
}
|
|
18879
18896
|
if (description) {
|
|
18880
18897
|
if (summary) console.log();
|
|
@@ -18888,7 +18905,7 @@ function viewIssue(issueKey) {
|
|
|
18888
18905
|
}
|
|
18889
18906
|
if (!summary && !description) {
|
|
18890
18907
|
console.log(
|
|
18891
|
-
|
|
18908
|
+
chalk158.yellow(`No summary or description found on ${issueKey}.`)
|
|
18892
18909
|
);
|
|
18893
18910
|
}
|
|
18894
18911
|
}
|
|
@@ -18946,7 +18963,7 @@ import { randomUUID as randomUUID6 } from "crypto";
|
|
|
18946
18963
|
|
|
18947
18964
|
// src/commands/review/checkoutPr.ts
|
|
18948
18965
|
import { execFileSync as execFileSync7 } from "child_process";
|
|
18949
|
-
import
|
|
18966
|
+
import chalk159 from "chalk";
|
|
18950
18967
|
|
|
18951
18968
|
// src/commands/sessions/daemon/daemonLog.ts
|
|
18952
18969
|
var RING_CAPACITY = 1e3;
|
|
@@ -19495,7 +19512,7 @@ async function checkoutPr(number) {
|
|
|
19495
19512
|
try {
|
|
19496
19513
|
execFileSync7("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
19497
19514
|
} catch {
|
|
19498
|
-
console.error(
|
|
19515
|
+
console.error(chalk159.red(`gh pr checkout ${number} failed; aborting.`));
|
|
19499
19516
|
process.exit(1);
|
|
19500
19517
|
}
|
|
19501
19518
|
}
|
|
@@ -19572,15 +19589,15 @@ function registerList(program2) {
|
|
|
19572
19589
|
// src/commands/mermaid/index.ts
|
|
19573
19590
|
import { mkdirSync as mkdirSync17, readdirSync as readdirSync9 } from "fs";
|
|
19574
19591
|
import { resolve as resolve14 } from "path";
|
|
19575
|
-
import
|
|
19592
|
+
import chalk162 from "chalk";
|
|
19576
19593
|
|
|
19577
19594
|
// src/commands/mermaid/exportFile.ts
|
|
19578
19595
|
import { readFileSync as readFileSync38, writeFileSync as writeFileSync31 } from "fs";
|
|
19579
19596
|
import { basename as basename15, extname as extname2, resolve as resolve13 } from "path";
|
|
19580
|
-
import
|
|
19597
|
+
import chalk161 from "chalk";
|
|
19581
19598
|
|
|
19582
19599
|
// src/commands/mermaid/renderBlock.ts
|
|
19583
|
-
import
|
|
19600
|
+
import chalk160 from "chalk";
|
|
19584
19601
|
async function renderBlock(krokiUrl, source) {
|
|
19585
19602
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
19586
19603
|
method: "POST",
|
|
@@ -19589,7 +19606,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
19589
19606
|
});
|
|
19590
19607
|
if (!response.ok) {
|
|
19591
19608
|
console.error(
|
|
19592
|
-
|
|
19609
|
+
chalk160.red(
|
|
19593
19610
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
19594
19611
|
)
|
|
19595
19612
|
);
|
|
@@ -19607,19 +19624,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
19607
19624
|
if (onlyIndex !== void 0) {
|
|
19608
19625
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
19609
19626
|
console.error(
|
|
19610
|
-
|
|
19627
|
+
chalk161.red(
|
|
19611
19628
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
19612
19629
|
)
|
|
19613
19630
|
);
|
|
19614
19631
|
process.exit(1);
|
|
19615
19632
|
}
|
|
19616
19633
|
console.log(
|
|
19617
|
-
|
|
19634
|
+
chalk161.gray(
|
|
19618
19635
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
19619
19636
|
)
|
|
19620
19637
|
);
|
|
19621
19638
|
} else {
|
|
19622
|
-
console.log(
|
|
19639
|
+
console.log(chalk161.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
19623
19640
|
}
|
|
19624
19641
|
for (const [i, source] of blocks.entries()) {
|
|
19625
19642
|
const idx = i + 1;
|
|
@@ -19627,7 +19644,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
19627
19644
|
const outPath = resolve13(outDir, `${stem}-${idx}.svg`);
|
|
19628
19645
|
const svg = await renderBlock(krokiUrl, source);
|
|
19629
19646
|
writeFileSync31(outPath, svg, "utf8");
|
|
19630
|
-
console.log(
|
|
19647
|
+
console.log(chalk161.green(` \u2192 ${outPath}`));
|
|
19631
19648
|
}
|
|
19632
19649
|
}
|
|
19633
19650
|
function extractMermaidBlocks(markdown) {
|
|
@@ -19643,18 +19660,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
19643
19660
|
if (options2.index !== void 0) {
|
|
19644
19661
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
19645
19662
|
console.error(
|
|
19646
|
-
|
|
19663
|
+
chalk162.red(`--index must be a positive integer (got ${options2.index})`)
|
|
19647
19664
|
);
|
|
19648
19665
|
process.exit(1);
|
|
19649
19666
|
}
|
|
19650
19667
|
if (!file) {
|
|
19651
|
-
console.error(
|
|
19668
|
+
console.error(chalk162.red("--index requires a file argument"));
|
|
19652
19669
|
process.exit(1);
|
|
19653
19670
|
}
|
|
19654
19671
|
}
|
|
19655
19672
|
const files = file ? [file] : readdirSync9(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
19656
19673
|
if (files.length === 0) {
|
|
19657
|
-
console.log(
|
|
19674
|
+
console.log(chalk162.gray("No markdown files found in current directory."));
|
|
19658
19675
|
return;
|
|
19659
19676
|
}
|
|
19660
19677
|
for (const f of files) {
|
|
@@ -19687,7 +19704,7 @@ function registerMermaid(program2) {
|
|
|
19687
19704
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
19688
19705
|
import { createServer as createServer2 } from "http";
|
|
19689
19706
|
import { dirname as dirname27 } from "path";
|
|
19690
|
-
import
|
|
19707
|
+
import chalk164 from "chalk";
|
|
19691
19708
|
|
|
19692
19709
|
// src/commands/netcap/corsHeaders.ts
|
|
19693
19710
|
var corsHeaders = {
|
|
@@ -19766,7 +19783,7 @@ function createNetcapHandler(options2) {
|
|
|
19766
19783
|
import { cp, readFile as readFile3, writeFile as writeFile3 } from "fs/promises";
|
|
19767
19784
|
import { networkInterfaces } from "os";
|
|
19768
19785
|
import { join as join51 } from "path";
|
|
19769
|
-
import
|
|
19786
|
+
import chalk163 from "chalk";
|
|
19770
19787
|
|
|
19771
19788
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
19772
19789
|
import { dirname as dirname26, join as join50 } from "path";
|
|
@@ -19810,7 +19827,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
19810
19827
|
const host = lanIPv4();
|
|
19811
19828
|
if (!host) {
|
|
19812
19829
|
console.log(
|
|
19813
|
-
|
|
19830
|
+
chalk163.yellow("could not determine the WSL IP for the extension")
|
|
19814
19831
|
);
|
|
19815
19832
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
19816
19833
|
return source;
|
|
@@ -19821,7 +19838,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
19821
19838
|
return WSL_WINDOWS_PATH;
|
|
19822
19839
|
} catch {
|
|
19823
19840
|
console.log(
|
|
19824
|
-
|
|
19841
|
+
chalk163.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
19825
19842
|
);
|
|
19826
19843
|
return source;
|
|
19827
19844
|
}
|
|
@@ -19854,30 +19871,30 @@ async function netcap(options2) {
|
|
|
19854
19871
|
let count8 = 0;
|
|
19855
19872
|
const handler = createNetcapHandler({
|
|
19856
19873
|
outPath,
|
|
19857
|
-
onPing: () => console.log(
|
|
19874
|
+
onPing: () => console.log(chalk164.dim("ping from extension")),
|
|
19858
19875
|
onCapture: (entry) => {
|
|
19859
19876
|
count8 += 1;
|
|
19860
19877
|
console.log(
|
|
19861
|
-
|
|
19862
|
-
|
|
19878
|
+
chalk164.green(`captured #${count8}`),
|
|
19879
|
+
chalk164.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
19863
19880
|
);
|
|
19864
19881
|
}
|
|
19865
19882
|
});
|
|
19866
19883
|
const server = createServer2(handler);
|
|
19867
19884
|
server.listen(port, () => {
|
|
19868
19885
|
console.log(
|
|
19869
|
-
|
|
19886
|
+
chalk164.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
19870
19887
|
);
|
|
19871
|
-
console.log(
|
|
19888
|
+
console.log(chalk164.dim(`appending captures to ${outPath}`));
|
|
19872
19889
|
if (filter)
|
|
19873
|
-
console.log(
|
|
19874
|
-
console.log(
|
|
19875
|
-
console.log(
|
|
19890
|
+
console.log(chalk164.dim(`forwarding only URLs matching "${filter}"`));
|
|
19891
|
+
console.log(chalk164.dim(`load the unpacked extension from ${extensionPath}`));
|
|
19892
|
+
console.log(chalk164.dim("press Ctrl-C to stop"));
|
|
19876
19893
|
});
|
|
19877
19894
|
process.on("SIGINT", () => {
|
|
19878
19895
|
server.close();
|
|
19879
19896
|
console.log(
|
|
19880
|
-
|
|
19897
|
+
chalk164.bold(
|
|
19881
19898
|
`
|
|
19882
19899
|
netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
19883
19900
|
)
|
|
@@ -19889,7 +19906,7 @@ netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} t
|
|
|
19889
19906
|
// src/commands/netcap/netcapExtract.ts
|
|
19890
19907
|
import { writeFileSync as writeFileSync32 } from "fs";
|
|
19891
19908
|
import { join as join54 } from "path";
|
|
19892
|
-
import
|
|
19909
|
+
import chalk165 from "chalk";
|
|
19893
19910
|
|
|
19894
19911
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
19895
19912
|
import { readFileSync as readFileSync39 } from "fs";
|
|
@@ -20337,8 +20354,8 @@ function netcapExtract(file) {
|
|
|
20337
20354
|
writeFileSync32(outFile, `${JSON.stringify(posts, null, 2)}
|
|
20338
20355
|
`);
|
|
20339
20356
|
console.log(
|
|
20340
|
-
|
|
20341
|
-
|
|
20357
|
+
chalk165.green(`extracted ${posts.length} posts`),
|
|
20358
|
+
chalk165.dim(`-> ${outFile}`)
|
|
20342
20359
|
);
|
|
20343
20360
|
}
|
|
20344
20361
|
|
|
@@ -20359,7 +20376,7 @@ function registerNetcap(program2) {
|
|
|
20359
20376
|
}
|
|
20360
20377
|
|
|
20361
20378
|
// src/commands/news/add/index.ts
|
|
20362
|
-
import
|
|
20379
|
+
import chalk166 from "chalk";
|
|
20363
20380
|
import enquirer8 from "enquirer";
|
|
20364
20381
|
async function add2(url) {
|
|
20365
20382
|
if (!url) {
|
|
@@ -20381,10 +20398,10 @@ async function add2(url) {
|
|
|
20381
20398
|
const { orm } = await getReady();
|
|
20382
20399
|
const added = await addFeed(orm, url);
|
|
20383
20400
|
if (!added) {
|
|
20384
|
-
console.log(
|
|
20401
|
+
console.log(chalk166.yellow("Feed already exists"));
|
|
20385
20402
|
return;
|
|
20386
20403
|
}
|
|
20387
|
-
console.log(
|
|
20404
|
+
console.log(chalk166.green(`Added feed: ${url}`));
|
|
20388
20405
|
}
|
|
20389
20406
|
|
|
20390
20407
|
// src/commands/registerNews.ts
|
|
@@ -20431,7 +20448,7 @@ function registerPiHook(program2) {
|
|
|
20431
20448
|
}
|
|
20432
20449
|
|
|
20433
20450
|
// src/commands/prompts/printPromptsTable.ts
|
|
20434
|
-
import
|
|
20451
|
+
import chalk167 from "chalk";
|
|
20435
20452
|
function truncate(str, max) {
|
|
20436
20453
|
if (str.length <= max) return str;
|
|
20437
20454
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -20449,14 +20466,14 @@ function printPromptsTable(rows) {
|
|
|
20449
20466
|
"Command".padEnd(commandWidth),
|
|
20450
20467
|
"Repos"
|
|
20451
20468
|
].join(" ");
|
|
20452
|
-
console.log(
|
|
20453
|
-
console.log(
|
|
20469
|
+
console.log(chalk167.dim(header));
|
|
20470
|
+
console.log(chalk167.dim("-".repeat(header.length)));
|
|
20454
20471
|
for (const row of rows) {
|
|
20455
20472
|
const count8 = String(row.count).padStart(countWidth);
|
|
20456
20473
|
const tool = row.tool.padEnd(toolWidth);
|
|
20457
20474
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
20458
20475
|
console.log(
|
|
20459
|
-
`${
|
|
20476
|
+
`${chalk167.yellow(count8)} ${tool} ${command} ${chalk167.dim(row.repos)}`
|
|
20460
20477
|
);
|
|
20461
20478
|
}
|
|
20462
20479
|
}
|
|
@@ -21072,20 +21089,20 @@ function updateCommentsCache(org, repo, prNumber, comments3) {
|
|
|
21072
21089
|
}
|
|
21073
21090
|
|
|
21074
21091
|
// src/commands/prs/listComments/printComments.ts
|
|
21075
|
-
import
|
|
21092
|
+
import chalk168 from "chalk";
|
|
21076
21093
|
function formatForHuman(comment3) {
|
|
21077
21094
|
if (comment3.type === "review") {
|
|
21078
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
21095
|
+
const stateColor = comment3.state === "APPROVED" ? chalk168.green : comment3.state === "CHANGES_REQUESTED" ? chalk168.red : chalk168.yellow;
|
|
21079
21096
|
return [
|
|
21080
|
-
`${
|
|
21097
|
+
`${chalk168.cyan("Review")} by ${chalk168.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
21081
21098
|
comment3.body,
|
|
21082
21099
|
""
|
|
21083
21100
|
].join("\n");
|
|
21084
21101
|
}
|
|
21085
21102
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
21086
21103
|
return [
|
|
21087
|
-
`${
|
|
21088
|
-
|
|
21104
|
+
`${chalk168.cyan("Line comment")} by ${chalk168.bold(comment3.user)} on ${chalk168.dim(`${comment3.path}${location}`)}`,
|
|
21105
|
+
chalk168.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
21089
21106
|
comment3.body,
|
|
21090
21107
|
""
|
|
21091
21108
|
].join("\n");
|
|
@@ -21155,13 +21172,13 @@ import { execSync as execSync49 } from "child_process";
|
|
|
21155
21172
|
import enquirer9 from "enquirer";
|
|
21156
21173
|
|
|
21157
21174
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
21158
|
-
import
|
|
21175
|
+
import chalk169 from "chalk";
|
|
21159
21176
|
var STATUS_MAP = {
|
|
21160
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
21161
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
21177
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk169.magenta("merged"), date: pr.mergedAt } : null,
|
|
21178
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk169.red("closed"), date: pr.closedAt } : null
|
|
21162
21179
|
};
|
|
21163
21180
|
function defaultStatus(pr) {
|
|
21164
|
-
return { label:
|
|
21181
|
+
return { label: chalk169.green("opened"), date: pr.createdAt };
|
|
21165
21182
|
}
|
|
21166
21183
|
function getStatus2(pr) {
|
|
21167
21184
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -21170,11 +21187,11 @@ function formatDate(dateStr) {
|
|
|
21170
21187
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
21171
21188
|
}
|
|
21172
21189
|
function formatPrHeader(pr, status3) {
|
|
21173
|
-
return `${
|
|
21190
|
+
return `${chalk169.cyan(`#${pr.number}`)} ${pr.title} ${chalk169.dim(`(${pr.author.login},`)} ${status3.label} ${chalk169.dim(`${formatDate(status3.date)})`)}`;
|
|
21174
21191
|
}
|
|
21175
21192
|
function logPrDetails(pr) {
|
|
21176
21193
|
console.log(
|
|
21177
|
-
|
|
21194
|
+
chalk169.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
21178
21195
|
);
|
|
21179
21196
|
console.log();
|
|
21180
21197
|
}
|
|
@@ -21689,10 +21706,10 @@ function registerPrs(program2) {
|
|
|
21689
21706
|
}
|
|
21690
21707
|
|
|
21691
21708
|
// src/commands/ravendb/ravendbAuth.ts
|
|
21692
|
-
import
|
|
21709
|
+
import chalk175 from "chalk";
|
|
21693
21710
|
|
|
21694
21711
|
// src/shared/createConnectionAuth.ts
|
|
21695
|
-
import
|
|
21712
|
+
import chalk170 from "chalk";
|
|
21696
21713
|
function listConnections(connections, format) {
|
|
21697
21714
|
if (connections.length === 0) {
|
|
21698
21715
|
console.log("No connections configured.");
|
|
@@ -21705,7 +21722,7 @@ function listConnections(connections, format) {
|
|
|
21705
21722
|
function removeConnection(connections, name, save) {
|
|
21706
21723
|
const filtered = connections.filter((c) => c.name !== name);
|
|
21707
21724
|
if (filtered.length === connections.length) {
|
|
21708
|
-
console.error(
|
|
21725
|
+
console.error(chalk170.red(`Connection "${name}" not found.`));
|
|
21709
21726
|
process.exit(1);
|
|
21710
21727
|
}
|
|
21711
21728
|
save(filtered);
|
|
@@ -21751,15 +21768,15 @@ function saveConnections(connections) {
|
|
|
21751
21768
|
}
|
|
21752
21769
|
|
|
21753
21770
|
// src/commands/ravendb/promptConnection.ts
|
|
21754
|
-
import
|
|
21771
|
+
import chalk173 from "chalk";
|
|
21755
21772
|
|
|
21756
21773
|
// src/commands/ravendb/selectOpSecret.ts
|
|
21757
|
-
import
|
|
21774
|
+
import chalk172 from "chalk";
|
|
21758
21775
|
import Enquirer2 from "enquirer";
|
|
21759
21776
|
|
|
21760
21777
|
// src/commands/ravendb/searchItems.ts
|
|
21761
21778
|
import { execSync as execSync52 } from "child_process";
|
|
21762
|
-
import
|
|
21779
|
+
import chalk171 from "chalk";
|
|
21763
21780
|
function opExec(args) {
|
|
21764
21781
|
return execSync52(`op ${args}`, {
|
|
21765
21782
|
encoding: "utf8",
|
|
@@ -21772,7 +21789,7 @@ function searchItems(search2) {
|
|
|
21772
21789
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
21773
21790
|
} catch {
|
|
21774
21791
|
console.error(
|
|
21775
|
-
|
|
21792
|
+
chalk171.red(
|
|
21776
21793
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
21777
21794
|
)
|
|
21778
21795
|
);
|
|
@@ -21786,7 +21803,7 @@ function getItemFields(itemId2) {
|
|
|
21786
21803
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
21787
21804
|
return item.fields.filter((f) => f.reference && f.label);
|
|
21788
21805
|
} catch {
|
|
21789
|
-
console.error(
|
|
21806
|
+
console.error(chalk171.red("Failed to get item details from 1Password."));
|
|
21790
21807
|
process.exit(1);
|
|
21791
21808
|
}
|
|
21792
21809
|
}
|
|
@@ -21805,7 +21822,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
21805
21822
|
}).run();
|
|
21806
21823
|
const items2 = searchItems(search2);
|
|
21807
21824
|
if (items2.length === 0) {
|
|
21808
|
-
console.error(
|
|
21825
|
+
console.error(chalk172.red(`No items found matching "${search2}".`));
|
|
21809
21826
|
process.exit(1);
|
|
21810
21827
|
}
|
|
21811
21828
|
const itemId2 = await selectOne(
|
|
@@ -21814,7 +21831,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
21814
21831
|
);
|
|
21815
21832
|
const fields = getItemFields(itemId2);
|
|
21816
21833
|
if (fields.length === 0) {
|
|
21817
|
-
console.error(
|
|
21834
|
+
console.error(chalk172.red("No fields with references found on this item."));
|
|
21818
21835
|
process.exit(1);
|
|
21819
21836
|
}
|
|
21820
21837
|
const ref = await selectOne(
|
|
@@ -21828,7 +21845,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
21828
21845
|
async function promptConnection(existingNames) {
|
|
21829
21846
|
const name = await promptInput("name", "Connection name:");
|
|
21830
21847
|
if (existingNames.includes(name)) {
|
|
21831
|
-
console.error(
|
|
21848
|
+
console.error(chalk173.red(`Connection "${name}" already exists.`));
|
|
21832
21849
|
process.exit(1);
|
|
21833
21850
|
}
|
|
21834
21851
|
const url = await promptInput(
|
|
@@ -21837,22 +21854,22 @@ async function promptConnection(existingNames) {
|
|
|
21837
21854
|
);
|
|
21838
21855
|
const database = await promptInput("database", "Database name:");
|
|
21839
21856
|
if (!name || !url || !database) {
|
|
21840
|
-
console.error(
|
|
21857
|
+
console.error(chalk173.red("All fields are required."));
|
|
21841
21858
|
process.exit(1);
|
|
21842
21859
|
}
|
|
21843
21860
|
const apiKeyRef = await selectOpSecret();
|
|
21844
|
-
console.log(
|
|
21861
|
+
console.log(chalk173.dim(`Using: ${apiKeyRef}`));
|
|
21845
21862
|
return { name, url, database, apiKeyRef };
|
|
21846
21863
|
}
|
|
21847
21864
|
|
|
21848
21865
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
21849
|
-
import
|
|
21866
|
+
import chalk174 from "chalk";
|
|
21850
21867
|
function ravendbSetConnection(name) {
|
|
21851
21868
|
const raw = loadGlobalConfigRaw();
|
|
21852
21869
|
const ravendb = raw.ravendb ?? {};
|
|
21853
21870
|
const connections = ravendb.connections ?? [];
|
|
21854
21871
|
if (!connections.some((c) => c.name === name)) {
|
|
21855
|
-
console.error(
|
|
21872
|
+
console.error(chalk174.red(`Connection "${name}" not found.`));
|
|
21856
21873
|
console.error(
|
|
21857
21874
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
21858
21875
|
);
|
|
@@ -21868,16 +21885,16 @@ function ravendbSetConnection(name) {
|
|
|
21868
21885
|
var ravendbAuth = createConnectionAuth({
|
|
21869
21886
|
load: loadConnections,
|
|
21870
21887
|
save: saveConnections,
|
|
21871
|
-
format: (c) => `${
|
|
21888
|
+
format: (c) => `${chalk175.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
21872
21889
|
promptNew: promptConnection,
|
|
21873
21890
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
21874
21891
|
});
|
|
21875
21892
|
|
|
21876
21893
|
// src/commands/ravendb/ravendbCollections.ts
|
|
21877
|
-
import
|
|
21894
|
+
import chalk179 from "chalk";
|
|
21878
21895
|
|
|
21879
21896
|
// src/commands/ravendb/ravenFetch.ts
|
|
21880
|
-
import
|
|
21897
|
+
import chalk177 from "chalk";
|
|
21881
21898
|
|
|
21882
21899
|
// src/commands/ravendb/getAccessToken.ts
|
|
21883
21900
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -21914,10 +21931,10 @@ ${errorText}`
|
|
|
21914
21931
|
|
|
21915
21932
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
21916
21933
|
import { execSync as execSync53 } from "child_process";
|
|
21917
|
-
import
|
|
21934
|
+
import chalk176 from "chalk";
|
|
21918
21935
|
function resolveOpSecret(reference) {
|
|
21919
21936
|
if (!reference.startsWith("op://")) {
|
|
21920
|
-
console.error(
|
|
21937
|
+
console.error(chalk176.red(`Invalid secret reference: must start with op://`));
|
|
21921
21938
|
process.exit(1);
|
|
21922
21939
|
}
|
|
21923
21940
|
try {
|
|
@@ -21927,7 +21944,7 @@ function resolveOpSecret(reference) {
|
|
|
21927
21944
|
}).trim();
|
|
21928
21945
|
} catch {
|
|
21929
21946
|
console.error(
|
|
21930
|
-
|
|
21947
|
+
chalk176.red(
|
|
21931
21948
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
21932
21949
|
)
|
|
21933
21950
|
);
|
|
@@ -21954,7 +21971,7 @@ async function ravenFetch(connection, path71) {
|
|
|
21954
21971
|
if (!response.ok) {
|
|
21955
21972
|
const body = await response.text();
|
|
21956
21973
|
console.error(
|
|
21957
|
-
|
|
21974
|
+
chalk177.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
21958
21975
|
);
|
|
21959
21976
|
console.error(body.substring(0, 500));
|
|
21960
21977
|
process.exit(1);
|
|
@@ -21963,7 +21980,7 @@ async function ravenFetch(connection, path71) {
|
|
|
21963
21980
|
}
|
|
21964
21981
|
|
|
21965
21982
|
// src/commands/ravendb/resolveConnection.ts
|
|
21966
|
-
import
|
|
21983
|
+
import chalk178 from "chalk";
|
|
21967
21984
|
function loadRavendb() {
|
|
21968
21985
|
const raw = loadGlobalConfigRaw();
|
|
21969
21986
|
const ravendb = raw.ravendb;
|
|
@@ -21977,7 +21994,7 @@ function resolveConnection(name) {
|
|
|
21977
21994
|
const connectionName = name ?? defaultConnection;
|
|
21978
21995
|
if (!connectionName) {
|
|
21979
21996
|
console.error(
|
|
21980
|
-
|
|
21997
|
+
chalk178.red(
|
|
21981
21998
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
21982
21999
|
)
|
|
21983
22000
|
);
|
|
@@ -21985,7 +22002,7 @@ function resolveConnection(name) {
|
|
|
21985
22002
|
}
|
|
21986
22003
|
const connection = connections.find((c) => c.name === connectionName);
|
|
21987
22004
|
if (!connection) {
|
|
21988
|
-
console.error(
|
|
22005
|
+
console.error(chalk178.red(`Connection "${connectionName}" not found.`));
|
|
21989
22006
|
console.error(
|
|
21990
22007
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
21991
22008
|
);
|
|
@@ -22016,7 +22033,7 @@ async function ravendbCollections(connectionName) {
|
|
|
22016
22033
|
return;
|
|
22017
22034
|
}
|
|
22018
22035
|
for (const c of collections) {
|
|
22019
|
-
console.log(`${
|
|
22036
|
+
console.log(`${chalk179.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
22020
22037
|
}
|
|
22021
22038
|
}
|
|
22022
22039
|
|
|
@@ -22035,10 +22052,10 @@ var ravendbConfigHelp = [
|
|
|
22035
22052
|
];
|
|
22036
22053
|
|
|
22037
22054
|
// src/commands/ravendb/ravendbQuery.ts
|
|
22038
|
-
import
|
|
22055
|
+
import chalk181 from "chalk";
|
|
22039
22056
|
|
|
22040
22057
|
// src/commands/ravendb/fetchAllPages.ts
|
|
22041
|
-
import
|
|
22058
|
+
import chalk180 from "chalk";
|
|
22042
22059
|
|
|
22043
22060
|
// src/commands/ravendb/buildQueryPath.ts
|
|
22044
22061
|
function buildQueryPath(opts) {
|
|
@@ -22076,7 +22093,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
22076
22093
|
allResults.push(...results);
|
|
22077
22094
|
start3 += results.length;
|
|
22078
22095
|
process.stderr.write(
|
|
22079
|
-
`\r${
|
|
22096
|
+
`\r${chalk180.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
22080
22097
|
);
|
|
22081
22098
|
if (start3 >= totalResults) break;
|
|
22082
22099
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -22091,7 +22108,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
22091
22108
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
22092
22109
|
const resolved = resolveArgs(connectionName, collection);
|
|
22093
22110
|
if (!resolved.collection && !options2.query) {
|
|
22094
|
-
console.error(
|
|
22111
|
+
console.error(chalk181.red("Provide a collection name or --query filter."));
|
|
22095
22112
|
process.exit(1);
|
|
22096
22113
|
}
|
|
22097
22114
|
const { collection: col } = resolved;
|
|
@@ -22130,7 +22147,7 @@ import { spawn as spawn6 } from "child_process";
|
|
|
22130
22147
|
import * as path36 from "path";
|
|
22131
22148
|
|
|
22132
22149
|
// src/commands/refactor/logViolations.ts
|
|
22133
|
-
import
|
|
22150
|
+
import chalk182 from "chalk";
|
|
22134
22151
|
var DEFAULT_MAX_LINES = 100;
|
|
22135
22152
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
22136
22153
|
if (violations.length === 0) {
|
|
@@ -22139,43 +22156,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
22139
22156
|
}
|
|
22140
22157
|
return;
|
|
22141
22158
|
}
|
|
22142
|
-
console.error(
|
|
22159
|
+
console.error(chalk182.red(`
|
|
22143
22160
|
Refactor check failed:
|
|
22144
22161
|
`));
|
|
22145
|
-
console.error(
|
|
22162
|
+
console.error(chalk182.red(` The following files exceed ${maxLines} lines:
|
|
22146
22163
|
`));
|
|
22147
22164
|
for (const violation of violations) {
|
|
22148
|
-
console.error(
|
|
22165
|
+
console.error(chalk182.red(` ${violation.file} (${violation.lines} lines)`));
|
|
22149
22166
|
}
|
|
22150
22167
|
console.error(
|
|
22151
|
-
|
|
22168
|
+
chalk182.yellow(
|
|
22152
22169
|
`
|
|
22153
22170
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
22154
22171
|
way to refactor it, ignore it with:
|
|
22155
22172
|
`
|
|
22156
22173
|
)
|
|
22157
22174
|
);
|
|
22158
|
-
console.error(
|
|
22175
|
+
console.error(chalk182.gray(` assist refactor ignore <file>
|
|
22159
22176
|
`));
|
|
22160
22177
|
if (process.env.CLAUDECODE) {
|
|
22161
|
-
console.error(
|
|
22178
|
+
console.error(chalk182.cyan(`
|
|
22162
22179
|
## Extracting Code to New Files
|
|
22163
22180
|
`));
|
|
22164
22181
|
console.error(
|
|
22165
|
-
|
|
22182
|
+
chalk182.cyan(
|
|
22166
22183
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
22167
22184
|
`
|
|
22168
22185
|
)
|
|
22169
22186
|
);
|
|
22170
22187
|
console.error(
|
|
22171
|
-
|
|
22188
|
+
chalk182.cyan(
|
|
22172
22189
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
22173
22190
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
22174
22191
|
`
|
|
22175
22192
|
)
|
|
22176
22193
|
);
|
|
22177
22194
|
console.error(
|
|
22178
|
-
|
|
22195
|
+
chalk182.cyan(
|
|
22179
22196
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
22180
22197
|
domains, move it to a common/shared folder.
|
|
22181
22198
|
`
|
|
@@ -22331,7 +22348,7 @@ async function check(pattern2, options2) {
|
|
|
22331
22348
|
|
|
22332
22349
|
// src/commands/refactor/extract/index.ts
|
|
22333
22350
|
import path44 from "path";
|
|
22334
|
-
import
|
|
22351
|
+
import chalk185 from "chalk";
|
|
22335
22352
|
|
|
22336
22353
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
22337
22354
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -22930,23 +22947,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
22930
22947
|
|
|
22931
22948
|
// src/commands/refactor/extract/displayPlan.ts
|
|
22932
22949
|
import path40 from "path";
|
|
22933
|
-
import
|
|
22950
|
+
import chalk183 from "chalk";
|
|
22934
22951
|
function section2(title) {
|
|
22935
22952
|
return `
|
|
22936
|
-
${
|
|
22953
|
+
${chalk183.cyan(title)}`;
|
|
22937
22954
|
}
|
|
22938
22955
|
function displayImporters(plan2, cwd) {
|
|
22939
22956
|
if (plan2.importersToUpdate.length === 0) return;
|
|
22940
22957
|
console.log(section2("Update importers:"));
|
|
22941
22958
|
for (const imp of plan2.importersToUpdate) {
|
|
22942
22959
|
const rel = path40.relative(cwd, imp.file.getFilePath());
|
|
22943
|
-
console.log(` ${
|
|
22960
|
+
console.log(` ${chalk183.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
22944
22961
|
}
|
|
22945
22962
|
}
|
|
22946
22963
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
22947
|
-
console.log(
|
|
22964
|
+
console.log(chalk183.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
22948
22965
|
`));
|
|
22949
|
-
console.log(` ${
|
|
22966
|
+
console.log(` ${chalk183.cyan("Functions to move:")}`);
|
|
22950
22967
|
for (const name of plan2.extractedNames) {
|
|
22951
22968
|
console.log(` ${name}`);
|
|
22952
22969
|
}
|
|
@@ -22980,7 +22997,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
22980
22997
|
|
|
22981
22998
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
22982
22999
|
import path43 from "path";
|
|
22983
|
-
import
|
|
23000
|
+
import chalk184 from "chalk";
|
|
22984
23001
|
import { Project as Project4 } from "ts-morph";
|
|
22985
23002
|
|
|
22986
23003
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -23072,7 +23089,7 @@ function loadProjectFile(file) {
|
|
|
23072
23089
|
});
|
|
23073
23090
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
23074
23091
|
if (!sourceFile) {
|
|
23075
|
-
console.log(
|
|
23092
|
+
console.log(chalk184.red(`File not found in project: ${file}`));
|
|
23076
23093
|
process.exit(1);
|
|
23077
23094
|
}
|
|
23078
23095
|
return { project, sourceFile };
|
|
@@ -23095,19 +23112,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
23095
23112
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
23096
23113
|
if (options2.apply) {
|
|
23097
23114
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
23098
|
-
console.log(
|
|
23115
|
+
console.log(chalk185.green("\nExtraction complete"));
|
|
23099
23116
|
} else {
|
|
23100
|
-
console.log(
|
|
23117
|
+
console.log(chalk185.dim("\nDry run. Use --apply to execute."));
|
|
23101
23118
|
}
|
|
23102
23119
|
}
|
|
23103
23120
|
|
|
23104
23121
|
// src/commands/refactor/ignore.ts
|
|
23105
23122
|
import fs28 from "fs";
|
|
23106
|
-
import
|
|
23123
|
+
import chalk186 from "chalk";
|
|
23107
23124
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
23108
23125
|
function ignore2(file) {
|
|
23109
23126
|
if (!fs28.existsSync(file)) {
|
|
23110
|
-
console.error(
|
|
23127
|
+
console.error(chalk186.red(`Error: File does not exist: ${file}`));
|
|
23111
23128
|
process.exit(1);
|
|
23112
23129
|
}
|
|
23113
23130
|
const content = fs28.readFileSync(file, "utf8");
|
|
@@ -23123,7 +23140,7 @@ function ignore2(file) {
|
|
|
23123
23140
|
fs28.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
23124
23141
|
}
|
|
23125
23142
|
console.log(
|
|
23126
|
-
|
|
23143
|
+
chalk186.green(
|
|
23127
23144
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
23128
23145
|
)
|
|
23129
23146
|
);
|
|
@@ -23132,12 +23149,12 @@ function ignore2(file) {
|
|
|
23132
23149
|
// src/commands/refactor/rename/index.ts
|
|
23133
23150
|
import fs31 from "fs";
|
|
23134
23151
|
import path49 from "path";
|
|
23135
|
-
import
|
|
23152
|
+
import chalk189 from "chalk";
|
|
23136
23153
|
|
|
23137
23154
|
// src/commands/refactor/rename/applyRename.ts
|
|
23138
23155
|
import fs30 from "fs";
|
|
23139
23156
|
import path46 from "path";
|
|
23140
|
-
import
|
|
23157
|
+
import chalk187 from "chalk";
|
|
23141
23158
|
|
|
23142
23159
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
23143
23160
|
import path45 from "path";
|
|
@@ -23242,13 +23259,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
23242
23259
|
const updatedContents = applyRewrites(rewrites);
|
|
23243
23260
|
for (const [file, content] of updatedContents) {
|
|
23244
23261
|
fs30.writeFileSync(file, content, "utf8");
|
|
23245
|
-
console.log(
|
|
23262
|
+
console.log(chalk187.cyan(` Updated imports in ${path46.relative(cwd, file)}`));
|
|
23246
23263
|
}
|
|
23247
23264
|
const destDir = path46.dirname(destPath);
|
|
23248
23265
|
if (!fs30.existsSync(destDir)) fs30.mkdirSync(destDir, { recursive: true });
|
|
23249
23266
|
fs30.renameSync(sourcePath, destPath);
|
|
23250
23267
|
console.log(
|
|
23251
|
-
|
|
23268
|
+
chalk187.white(
|
|
23252
23269
|
` Moved ${path46.relative(cwd, sourcePath)} \u2192 ${path46.relative(cwd, destPath)}`
|
|
23253
23270
|
)
|
|
23254
23271
|
);
|
|
@@ -23335,16 +23352,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
23335
23352
|
|
|
23336
23353
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
23337
23354
|
import path48 from "path";
|
|
23338
|
-
import
|
|
23355
|
+
import chalk188 from "chalk";
|
|
23339
23356
|
function printRenamePreview(rewrites, cwd) {
|
|
23340
23357
|
for (const rewrite of rewrites) {
|
|
23341
23358
|
console.log(
|
|
23342
|
-
|
|
23359
|
+
chalk188.dim(
|
|
23343
23360
|
` ${path48.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
23344
23361
|
)
|
|
23345
23362
|
);
|
|
23346
23363
|
}
|
|
23347
|
-
console.log(
|
|
23364
|
+
console.log(chalk188.dim("Dry run. Use --apply to execute."));
|
|
23348
23365
|
}
|
|
23349
23366
|
|
|
23350
23367
|
// src/commands/refactor/rename/index.ts
|
|
@@ -23355,20 +23372,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
23355
23372
|
const relSource = path49.relative(cwd, sourcePath);
|
|
23356
23373
|
const relDest = path49.relative(cwd, destPath);
|
|
23357
23374
|
if (!fs31.existsSync(sourcePath)) {
|
|
23358
|
-
console.log(
|
|
23375
|
+
console.log(chalk189.red(`File not found: ${source}`));
|
|
23359
23376
|
process.exit(1);
|
|
23360
23377
|
}
|
|
23361
23378
|
if (destPath !== sourcePath && fs31.existsSync(destPath)) {
|
|
23362
|
-
console.log(
|
|
23379
|
+
console.log(chalk189.red(`Destination already exists: ${destination}`));
|
|
23363
23380
|
process.exit(1);
|
|
23364
23381
|
}
|
|
23365
|
-
console.log(
|
|
23366
|
-
console.log(
|
|
23367
|
-
console.log(
|
|
23382
|
+
console.log(chalk189.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
23383
|
+
console.log(chalk189.dim("Loading project..."));
|
|
23384
|
+
console.log(chalk189.dim("Scanning imports across the project..."));
|
|
23368
23385
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
23369
23386
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
23370
23387
|
console.log(
|
|
23371
|
-
|
|
23388
|
+
chalk189.dim(
|
|
23372
23389
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
23373
23390
|
)
|
|
23374
23391
|
);
|
|
@@ -23377,11 +23394,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
23377
23394
|
return;
|
|
23378
23395
|
}
|
|
23379
23396
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
23380
|
-
console.log(
|
|
23397
|
+
console.log(chalk189.green("Done"));
|
|
23381
23398
|
}
|
|
23382
23399
|
|
|
23383
23400
|
// src/commands/refactor/renameSymbol/index.ts
|
|
23384
|
-
import
|
|
23401
|
+
import chalk190 from "chalk";
|
|
23385
23402
|
|
|
23386
23403
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
23387
23404
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -23427,33 +23444,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
23427
23444
|
const { project, sourceFile } = loadProjectFile(file);
|
|
23428
23445
|
const symbol = findSymbol(sourceFile, oldName);
|
|
23429
23446
|
if (!symbol) {
|
|
23430
|
-
console.log(
|
|
23447
|
+
console.log(chalk190.red(`Symbol "${oldName}" not found in ${file}`));
|
|
23431
23448
|
process.exit(1);
|
|
23432
23449
|
}
|
|
23433
23450
|
const grouped = groupReferences(symbol, cwd);
|
|
23434
23451
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
23435
23452
|
console.log(
|
|
23436
|
-
|
|
23453
|
+
chalk190.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
23437
23454
|
`)
|
|
23438
23455
|
);
|
|
23439
23456
|
for (const [refFile, lines2] of grouped) {
|
|
23440
23457
|
console.log(
|
|
23441
|
-
` ${
|
|
23458
|
+
` ${chalk190.dim(refFile)}: lines ${chalk190.cyan(lines2.join(", "))}`
|
|
23442
23459
|
);
|
|
23443
23460
|
}
|
|
23444
23461
|
if (options2.apply) {
|
|
23445
23462
|
symbol.rename(newName);
|
|
23446
23463
|
await project.save();
|
|
23447
|
-
console.log(
|
|
23464
|
+
console.log(chalk190.green(`
|
|
23448
23465
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
23449
23466
|
} else {
|
|
23450
|
-
console.log(
|
|
23467
|
+
console.log(chalk190.dim("\nDry run. Use --apply to execute."));
|
|
23451
23468
|
}
|
|
23452
23469
|
}
|
|
23453
23470
|
|
|
23454
23471
|
// src/commands/refactor/restructure/index.ts
|
|
23455
23472
|
import path57 from "path";
|
|
23456
|
-
import
|
|
23473
|
+
import chalk193 from "chalk";
|
|
23457
23474
|
|
|
23458
23475
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
23459
23476
|
import path51 from "path";
|
|
@@ -23532,50 +23549,50 @@ function clusterFiles(graph) {
|
|
|
23532
23549
|
|
|
23533
23550
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
23534
23551
|
import path53 from "path";
|
|
23535
|
-
import
|
|
23552
|
+
import chalk191 from "chalk";
|
|
23536
23553
|
function relPath(filePath) {
|
|
23537
23554
|
return path53.relative(process.cwd(), filePath);
|
|
23538
23555
|
}
|
|
23539
23556
|
function displayMoves(plan2) {
|
|
23540
23557
|
if (plan2.moves.length === 0) return;
|
|
23541
|
-
console.log(
|
|
23558
|
+
console.log(chalk191.bold("\nFile moves:"));
|
|
23542
23559
|
for (const move2 of plan2.moves) {
|
|
23543
23560
|
console.log(
|
|
23544
|
-
` ${
|
|
23561
|
+
` ${chalk191.red(relPath(move2.from))} \u2192 ${chalk191.green(relPath(move2.to))}`
|
|
23545
23562
|
);
|
|
23546
|
-
console.log(
|
|
23563
|
+
console.log(chalk191.dim(` ${move2.reason}`));
|
|
23547
23564
|
}
|
|
23548
23565
|
}
|
|
23549
23566
|
function displayRewrites(rewrites) {
|
|
23550
23567
|
if (rewrites.length === 0) return;
|
|
23551
23568
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
23552
|
-
console.log(
|
|
23569
|
+
console.log(chalk191.bold(`
|
|
23553
23570
|
Import rewrites (${affectedFiles.size} files):`));
|
|
23554
23571
|
for (const file of affectedFiles) {
|
|
23555
|
-
console.log(` ${
|
|
23572
|
+
console.log(` ${chalk191.cyan(relPath(file))}:`);
|
|
23556
23573
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
23557
23574
|
(r) => r.file === file
|
|
23558
23575
|
)) {
|
|
23559
23576
|
console.log(
|
|
23560
|
-
` ${
|
|
23577
|
+
` ${chalk191.red(`"${oldSpecifier}"`)} \u2192 ${chalk191.green(`"${newSpecifier}"`)}`
|
|
23561
23578
|
);
|
|
23562
23579
|
}
|
|
23563
23580
|
}
|
|
23564
23581
|
}
|
|
23565
23582
|
function displayPlan2(plan2) {
|
|
23566
23583
|
if (plan2.warnings.length > 0) {
|
|
23567
|
-
console.log(
|
|
23568
|
-
for (const w of plan2.warnings) console.log(
|
|
23584
|
+
console.log(chalk191.yellow("\nWarnings:"));
|
|
23585
|
+
for (const w of plan2.warnings) console.log(chalk191.yellow(` ${w}`));
|
|
23569
23586
|
}
|
|
23570
23587
|
if (plan2.newDirectories.length > 0) {
|
|
23571
|
-
console.log(
|
|
23588
|
+
console.log(chalk191.bold("\nNew directories:"));
|
|
23572
23589
|
for (const dir of plan2.newDirectories)
|
|
23573
|
-
console.log(
|
|
23590
|
+
console.log(chalk191.green(` ${dir}/`));
|
|
23574
23591
|
}
|
|
23575
23592
|
displayMoves(plan2);
|
|
23576
23593
|
displayRewrites(plan2.rewrites);
|
|
23577
23594
|
console.log(
|
|
23578
|
-
|
|
23595
|
+
chalk191.dim(
|
|
23579
23596
|
`
|
|
23580
23597
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
23581
23598
|
)
|
|
@@ -23585,18 +23602,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
23585
23602
|
// src/commands/refactor/restructure/executePlan.ts
|
|
23586
23603
|
import fs32 from "fs";
|
|
23587
23604
|
import path54 from "path";
|
|
23588
|
-
import
|
|
23605
|
+
import chalk192 from "chalk";
|
|
23589
23606
|
function executePlan(plan2) {
|
|
23590
23607
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
23591
23608
|
for (const [file, content] of updatedContents) {
|
|
23592
23609
|
fs32.writeFileSync(file, content, "utf8");
|
|
23593
23610
|
console.log(
|
|
23594
|
-
|
|
23611
|
+
chalk192.cyan(` Rewrote imports in ${path54.relative(process.cwd(), file)}`)
|
|
23595
23612
|
);
|
|
23596
23613
|
}
|
|
23597
23614
|
for (const dir of plan2.newDirectories) {
|
|
23598
23615
|
fs32.mkdirSync(dir, { recursive: true });
|
|
23599
|
-
console.log(
|
|
23616
|
+
console.log(chalk192.green(` Created ${path54.relative(process.cwd(), dir)}/`));
|
|
23600
23617
|
}
|
|
23601
23618
|
for (const move2 of plan2.moves) {
|
|
23602
23619
|
const targetDir = path54.dirname(move2.to);
|
|
@@ -23605,7 +23622,7 @@ function executePlan(plan2) {
|
|
|
23605
23622
|
}
|
|
23606
23623
|
fs32.renameSync(move2.from, move2.to);
|
|
23607
23624
|
console.log(
|
|
23608
|
-
|
|
23625
|
+
chalk192.white(
|
|
23609
23626
|
` Moved ${path54.relative(process.cwd(), move2.from)} \u2192 ${path54.relative(process.cwd(), move2.to)}`
|
|
23610
23627
|
)
|
|
23611
23628
|
);
|
|
@@ -23620,7 +23637,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
23620
23637
|
if (entries.length === 0) {
|
|
23621
23638
|
fs32.rmdirSync(dir);
|
|
23622
23639
|
console.log(
|
|
23623
|
-
|
|
23640
|
+
chalk192.dim(
|
|
23624
23641
|
` Removed empty directory ${path54.relative(process.cwd(), dir)}`
|
|
23625
23642
|
)
|
|
23626
23643
|
);
|
|
@@ -23753,22 +23770,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
23753
23770
|
const targetPattern = pattern2 ?? "src";
|
|
23754
23771
|
const files = findSourceFiles2(targetPattern);
|
|
23755
23772
|
if (files.length === 0) {
|
|
23756
|
-
console.log(
|
|
23773
|
+
console.log(chalk193.yellow("No files found matching pattern"));
|
|
23757
23774
|
return;
|
|
23758
23775
|
}
|
|
23759
23776
|
const tsConfigPath = findTsConfig(path57.resolve(files[0]));
|
|
23760
23777
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
23761
23778
|
if (plan2.moves.length === 0) {
|
|
23762
|
-
console.log(
|
|
23779
|
+
console.log(chalk193.green("No restructuring needed"));
|
|
23763
23780
|
return;
|
|
23764
23781
|
}
|
|
23765
23782
|
displayPlan2(plan2);
|
|
23766
23783
|
if (options2.apply) {
|
|
23767
|
-
console.log(
|
|
23784
|
+
console.log(chalk193.bold("\nApplying changes..."));
|
|
23768
23785
|
executePlan(plan2);
|
|
23769
|
-
console.log(
|
|
23786
|
+
console.log(chalk193.green("\nRestructuring complete"));
|
|
23770
23787
|
} else {
|
|
23771
|
-
console.log(
|
|
23788
|
+
console.log(chalk193.dim("\nDry run. Use --apply to execute."));
|
|
23772
23789
|
}
|
|
23773
23790
|
}
|
|
23774
23791
|
|
|
@@ -24348,18 +24365,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
24348
24365
|
}
|
|
24349
24366
|
|
|
24350
24367
|
// src/commands/review/warnOutOfDiff.ts
|
|
24351
|
-
import
|
|
24368
|
+
import chalk194 from "chalk";
|
|
24352
24369
|
function warnOutOfDiff(outOfDiff) {
|
|
24353
24370
|
if (outOfDiff.length === 0) return;
|
|
24354
24371
|
console.warn(
|
|
24355
|
-
|
|
24372
|
+
chalk194.yellow(
|
|
24356
24373
|
`Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
|
|
24357
24374
|
)
|
|
24358
24375
|
);
|
|
24359
24376
|
for (const finding of outOfDiff) {
|
|
24360
24377
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
24361
24378
|
console.warn(
|
|
24362
|
-
` ${
|
|
24379
|
+
` ${chalk194.yellow("\xB7")} ${finding.title} ${chalk194.dim(
|
|
24363
24380
|
`(${finding.file}:${range})`
|
|
24364
24381
|
)}`
|
|
24365
24382
|
);
|
|
@@ -24378,18 +24395,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
24378
24395
|
}
|
|
24379
24396
|
|
|
24380
24397
|
// src/commands/review/warnUnlocated.ts
|
|
24381
|
-
import
|
|
24398
|
+
import chalk195 from "chalk";
|
|
24382
24399
|
function warnUnlocated(unlocated) {
|
|
24383
24400
|
if (unlocated.length === 0) return;
|
|
24384
24401
|
console.warn(
|
|
24385
|
-
|
|
24402
|
+
chalk195.yellow(
|
|
24386
24403
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
24387
24404
|
)
|
|
24388
24405
|
);
|
|
24389
24406
|
for (const finding of unlocated) {
|
|
24390
|
-
const where = finding.location ||
|
|
24407
|
+
const where = finding.location || chalk195.dim("missing");
|
|
24391
24408
|
console.warn(
|
|
24392
|
-
` ${
|
|
24409
|
+
` ${chalk195.yellow("\xB7")} ${finding.title} ${chalk195.dim(`(${where})`)}`
|
|
24393
24410
|
);
|
|
24394
24411
|
}
|
|
24395
24412
|
}
|
|
@@ -25554,7 +25571,7 @@ function registerReview(program2) {
|
|
|
25554
25571
|
}
|
|
25555
25572
|
|
|
25556
25573
|
// src/commands/seq/seqAuth.ts
|
|
25557
|
-
import
|
|
25574
|
+
import chalk197 from "chalk";
|
|
25558
25575
|
|
|
25559
25576
|
// src/commands/seq/loadConnections.ts
|
|
25560
25577
|
function loadConnections2() {
|
|
@@ -25583,10 +25600,10 @@ function setDefaultConnection(name) {
|
|
|
25583
25600
|
}
|
|
25584
25601
|
|
|
25585
25602
|
// src/shared/assertUniqueName.ts
|
|
25586
|
-
import
|
|
25603
|
+
import chalk196 from "chalk";
|
|
25587
25604
|
function assertUniqueName(existingNames, name) {
|
|
25588
25605
|
if (existingNames.includes(name)) {
|
|
25589
|
-
console.error(
|
|
25606
|
+
console.error(chalk196.red(`Connection "${name}" already exists.`));
|
|
25590
25607
|
process.exit(1);
|
|
25591
25608
|
}
|
|
25592
25609
|
}
|
|
@@ -25604,7 +25621,7 @@ async function promptConnection2(existingNames) {
|
|
|
25604
25621
|
var seqAuth = createConnectionAuth({
|
|
25605
25622
|
load: loadConnections2,
|
|
25606
25623
|
save: saveConnections2,
|
|
25607
|
-
format: (c) => `${
|
|
25624
|
+
format: (c) => `${chalk197.bold(c.name)} ${c.url}`,
|
|
25608
25625
|
promptNew: promptConnection2,
|
|
25609
25626
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
25610
25627
|
});
|
|
@@ -25624,10 +25641,10 @@ var seqConfigHelp = [
|
|
|
25624
25641
|
];
|
|
25625
25642
|
|
|
25626
25643
|
// src/commands/seq/seqQuery.ts
|
|
25627
|
-
import
|
|
25644
|
+
import chalk201 from "chalk";
|
|
25628
25645
|
|
|
25629
25646
|
// src/commands/seq/fetchSeq.ts
|
|
25630
|
-
import
|
|
25647
|
+
import chalk198 from "chalk";
|
|
25631
25648
|
async function fetchSeq(conn, path71, params) {
|
|
25632
25649
|
const url = `${conn.url}${path71}?${params}`;
|
|
25633
25650
|
const response = await fetch(url, {
|
|
@@ -25638,7 +25655,7 @@ async function fetchSeq(conn, path71, params) {
|
|
|
25638
25655
|
});
|
|
25639
25656
|
if (!response.ok) {
|
|
25640
25657
|
const body = await response.text();
|
|
25641
|
-
console.error(
|
|
25658
|
+
console.error(chalk198.red(`Seq returned ${response.status}: ${body}`));
|
|
25642
25659
|
process.exit(1);
|
|
25643
25660
|
}
|
|
25644
25661
|
return response;
|
|
@@ -25697,23 +25714,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
25697
25714
|
}
|
|
25698
25715
|
|
|
25699
25716
|
// src/commands/seq/formatEvent.ts
|
|
25700
|
-
import
|
|
25717
|
+
import chalk199 from "chalk";
|
|
25701
25718
|
function levelColor(level) {
|
|
25702
25719
|
switch (level) {
|
|
25703
25720
|
case "Fatal":
|
|
25704
|
-
return
|
|
25721
|
+
return chalk199.bgRed.white;
|
|
25705
25722
|
case "Error":
|
|
25706
|
-
return
|
|
25723
|
+
return chalk199.red;
|
|
25707
25724
|
case "Warning":
|
|
25708
|
-
return
|
|
25725
|
+
return chalk199.yellow;
|
|
25709
25726
|
case "Information":
|
|
25710
|
-
return
|
|
25727
|
+
return chalk199.cyan;
|
|
25711
25728
|
case "Debug":
|
|
25712
|
-
return
|
|
25729
|
+
return chalk199.gray;
|
|
25713
25730
|
case "Verbose":
|
|
25714
|
-
return
|
|
25731
|
+
return chalk199.dim;
|
|
25715
25732
|
default:
|
|
25716
|
-
return
|
|
25733
|
+
return chalk199.white;
|
|
25717
25734
|
}
|
|
25718
25735
|
}
|
|
25719
25736
|
function levelAbbrev(level) {
|
|
@@ -25754,12 +25771,12 @@ function formatTimestamp(iso) {
|
|
|
25754
25771
|
function formatEvent(event) {
|
|
25755
25772
|
const color = levelColor(event.Level);
|
|
25756
25773
|
const abbrev = levelAbbrev(event.Level);
|
|
25757
|
-
const ts8 =
|
|
25774
|
+
const ts8 = chalk199.dim(formatTimestamp(event.Timestamp));
|
|
25758
25775
|
const msg = renderMessage(event);
|
|
25759
25776
|
const lines2 = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
25760
25777
|
if (event.Exception) {
|
|
25761
25778
|
for (const line of event.Exception.split("\n")) {
|
|
25762
|
-
lines2.push(
|
|
25779
|
+
lines2.push(chalk199.red(` ${line}`));
|
|
25763
25780
|
}
|
|
25764
25781
|
}
|
|
25765
25782
|
return lines2.join("\n");
|
|
@@ -25792,11 +25809,11 @@ function rejectTimestampFilter(filter) {
|
|
|
25792
25809
|
}
|
|
25793
25810
|
|
|
25794
25811
|
// src/shared/resolveNamedConnection.ts
|
|
25795
|
-
import
|
|
25812
|
+
import chalk200 from "chalk";
|
|
25796
25813
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
25797
25814
|
if (connections.length === 0) {
|
|
25798
25815
|
console.error(
|
|
25799
|
-
|
|
25816
|
+
chalk200.red(
|
|
25800
25817
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
25801
25818
|
)
|
|
25802
25819
|
);
|
|
@@ -25805,7 +25822,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
25805
25822
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
25806
25823
|
const connection = connections.find((c) => c.name === target);
|
|
25807
25824
|
if (!connection) {
|
|
25808
|
-
console.error(
|
|
25825
|
+
console.error(chalk200.red(`${kind} connection "${target}" not found.`));
|
|
25809
25826
|
process.exit(1);
|
|
25810
25827
|
}
|
|
25811
25828
|
return connection;
|
|
@@ -25834,7 +25851,7 @@ async function seqQuery(filter, options2) {
|
|
|
25834
25851
|
new URLSearchParams({ filter, count: String(count8) })
|
|
25835
25852
|
);
|
|
25836
25853
|
if (events.length === 0) {
|
|
25837
|
-
console.log(
|
|
25854
|
+
console.log(chalk201.yellow("No events found."));
|
|
25838
25855
|
return;
|
|
25839
25856
|
}
|
|
25840
25857
|
if (options2.json) {
|
|
@@ -25845,11 +25862,11 @@ async function seqQuery(filter, options2) {
|
|
|
25845
25862
|
for (const event of chronological) {
|
|
25846
25863
|
console.log(formatEvent(event));
|
|
25847
25864
|
}
|
|
25848
|
-
console.log(
|
|
25865
|
+
console.log(chalk201.dim(`
|
|
25849
25866
|
${events.length} events`));
|
|
25850
25867
|
if (events.length >= count8) {
|
|
25851
25868
|
console.log(
|
|
25852
|
-
|
|
25869
|
+
chalk201.yellow(
|
|
25853
25870
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
25854
25871
|
)
|
|
25855
25872
|
);
|
|
@@ -25857,10 +25874,10 @@ ${events.length} events`));
|
|
|
25857
25874
|
}
|
|
25858
25875
|
|
|
25859
25876
|
// src/shared/setNamedDefaultConnection.ts
|
|
25860
|
-
import
|
|
25877
|
+
import chalk202 from "chalk";
|
|
25861
25878
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
25862
25879
|
if (!connections.find((c) => c.name === name)) {
|
|
25863
|
-
console.error(
|
|
25880
|
+
console.error(chalk202.red(`Connection "${name}" not found.`));
|
|
25864
25881
|
process.exit(1);
|
|
25865
25882
|
}
|
|
25866
25883
|
setDefault(name);
|
|
@@ -25909,7 +25926,7 @@ function registerSignal(program2) {
|
|
|
25909
25926
|
}
|
|
25910
25927
|
|
|
25911
25928
|
// src/commands/sql/sqlAuth.ts
|
|
25912
|
-
import
|
|
25929
|
+
import chalk204 from "chalk";
|
|
25913
25930
|
|
|
25914
25931
|
// src/commands/sql/loadConnections.ts
|
|
25915
25932
|
function loadConnections3() {
|
|
@@ -25938,7 +25955,7 @@ function setDefaultConnection2(name) {
|
|
|
25938
25955
|
}
|
|
25939
25956
|
|
|
25940
25957
|
// src/commands/sql/promptConnection.ts
|
|
25941
|
-
import
|
|
25958
|
+
import chalk203 from "chalk";
|
|
25942
25959
|
async function promptConnection3(existingNames) {
|
|
25943
25960
|
const name = await promptInput("name", "Connection name:", "default");
|
|
25944
25961
|
assertUniqueName(existingNames, name);
|
|
@@ -25946,7 +25963,7 @@ async function promptConnection3(existingNames) {
|
|
|
25946
25963
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
25947
25964
|
const port = Number.parseInt(portStr, 10);
|
|
25948
25965
|
if (!Number.isFinite(port)) {
|
|
25949
|
-
console.error(
|
|
25966
|
+
console.error(chalk203.red(`Invalid port "${portStr}".`));
|
|
25950
25967
|
process.exit(1);
|
|
25951
25968
|
}
|
|
25952
25969
|
const user = await promptInput("user", "User:");
|
|
@@ -25959,13 +25976,13 @@ async function promptConnection3(existingNames) {
|
|
|
25959
25976
|
var sqlAuth = createConnectionAuth({
|
|
25960
25977
|
load: loadConnections3,
|
|
25961
25978
|
save: saveConnections3,
|
|
25962
|
-
format: (c) => `${
|
|
25979
|
+
format: (c) => `${chalk204.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
25963
25980
|
promptNew: promptConnection3,
|
|
25964
25981
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
25965
25982
|
});
|
|
25966
25983
|
|
|
25967
25984
|
// src/commands/sql/printTable.ts
|
|
25968
|
-
import
|
|
25985
|
+
import chalk205 from "chalk";
|
|
25969
25986
|
function formatCell(value) {
|
|
25970
25987
|
if (value === null || value === void 0) return "";
|
|
25971
25988
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -25974,7 +25991,7 @@ function formatCell(value) {
|
|
|
25974
25991
|
}
|
|
25975
25992
|
function printTable(rows) {
|
|
25976
25993
|
if (rows.length === 0) {
|
|
25977
|
-
console.log(
|
|
25994
|
+
console.log(chalk205.yellow("(no rows)"));
|
|
25978
25995
|
return;
|
|
25979
25996
|
}
|
|
25980
25997
|
const columns = Object.keys(rows[0]);
|
|
@@ -25982,13 +25999,13 @@ function printTable(rows) {
|
|
|
25982
25999
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
25983
26000
|
);
|
|
25984
26001
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
25985
|
-
console.log(
|
|
25986
|
-
console.log(
|
|
26002
|
+
console.log(chalk205.dim(header));
|
|
26003
|
+
console.log(chalk205.dim("-".repeat(header.length)));
|
|
25987
26004
|
for (const row of rows) {
|
|
25988
26005
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
25989
26006
|
console.log(line);
|
|
25990
26007
|
}
|
|
25991
|
-
console.log(
|
|
26008
|
+
console.log(chalk205.dim(`
|
|
25992
26009
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
25993
26010
|
}
|
|
25994
26011
|
|
|
@@ -26062,7 +26079,7 @@ var sqlConfigHelp = [
|
|
|
26062
26079
|
];
|
|
26063
26080
|
|
|
26064
26081
|
// src/commands/sql/sqlMutate.ts
|
|
26065
|
-
import
|
|
26082
|
+
import chalk206 from "chalk";
|
|
26066
26083
|
|
|
26067
26084
|
// src/commands/sql/isMutation.ts
|
|
26068
26085
|
var MUTATION_KEYWORDS = [
|
|
@@ -26096,7 +26113,7 @@ function isMutation(sql25) {
|
|
|
26096
26113
|
async function sqlMutate(query, connectionName) {
|
|
26097
26114
|
if (!isMutation(query)) {
|
|
26098
26115
|
console.error(
|
|
26099
|
-
|
|
26116
|
+
chalk206.red(
|
|
26100
26117
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
26101
26118
|
)
|
|
26102
26119
|
);
|
|
@@ -26106,18 +26123,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
26106
26123
|
const pool = await sqlConnect(conn);
|
|
26107
26124
|
try {
|
|
26108
26125
|
const result = await pool.request().query(query);
|
|
26109
|
-
console.log(
|
|
26126
|
+
console.log(chalk206.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
26110
26127
|
} finally {
|
|
26111
26128
|
await pool.close();
|
|
26112
26129
|
}
|
|
26113
26130
|
}
|
|
26114
26131
|
|
|
26115
26132
|
// src/commands/sql/sqlQuery.ts
|
|
26116
|
-
import
|
|
26133
|
+
import chalk207 from "chalk";
|
|
26117
26134
|
async function sqlQuery(query, connectionName) {
|
|
26118
26135
|
if (isMutation(query)) {
|
|
26119
26136
|
console.error(
|
|
26120
|
-
|
|
26137
|
+
chalk207.red(
|
|
26121
26138
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
26122
26139
|
)
|
|
26123
26140
|
);
|
|
@@ -26132,7 +26149,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
26132
26149
|
printTable(rows);
|
|
26133
26150
|
} else {
|
|
26134
26151
|
console.log(
|
|
26135
|
-
|
|
26152
|
+
chalk207.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
26136
26153
|
);
|
|
26137
26154
|
}
|
|
26138
26155
|
} finally {
|
|
@@ -27527,7 +27544,7 @@ function registerWatch(program2) {
|
|
|
27527
27544
|
|
|
27528
27545
|
// src/commands/roam/auth.ts
|
|
27529
27546
|
import { randomBytes } from "crypto";
|
|
27530
|
-
import
|
|
27547
|
+
import chalk208 from "chalk";
|
|
27531
27548
|
|
|
27532
27549
|
// src/commands/roam/waitForCallback.ts
|
|
27533
27550
|
import { createServer as createServer3 } from "http";
|
|
@@ -27658,13 +27675,13 @@ async function auth() {
|
|
|
27658
27675
|
saveGlobalConfig(config);
|
|
27659
27676
|
const state = randomBytes(16).toString("hex");
|
|
27660
27677
|
console.log(
|
|
27661
|
-
|
|
27678
|
+
chalk208.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
27662
27679
|
);
|
|
27663
|
-
console.log(
|
|
27664
|
-
console.log(
|
|
27665
|
-
console.log(
|
|
27680
|
+
console.log(chalk208.white("http://localhost:14523/callback\n"));
|
|
27681
|
+
console.log(chalk208.blue("Opening browser for authorization..."));
|
|
27682
|
+
console.log(chalk208.dim("Waiting for authorization callback..."));
|
|
27666
27683
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
27667
|
-
console.log(
|
|
27684
|
+
console.log(chalk208.dim("Exchanging code for tokens..."));
|
|
27668
27685
|
const tokens = await exchangeToken({
|
|
27669
27686
|
code,
|
|
27670
27687
|
clientId,
|
|
@@ -27680,7 +27697,7 @@ async function auth() {
|
|
|
27680
27697
|
};
|
|
27681
27698
|
saveGlobalConfig(config);
|
|
27682
27699
|
console.log(
|
|
27683
|
-
|
|
27700
|
+
chalk208.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
27684
27701
|
);
|
|
27685
27702
|
}
|
|
27686
27703
|
|
|
@@ -27783,11 +27800,11 @@ function registerRoam(program2) {
|
|
|
27783
27800
|
}
|
|
27784
27801
|
|
|
27785
27802
|
// src/commands/sync/printAutoConfirmHint.ts
|
|
27786
|
-
import
|
|
27803
|
+
import chalk209 from "chalk";
|
|
27787
27804
|
var autoConfirmHintCommand = "assist config set sync.autoConfirm true --global";
|
|
27788
27805
|
function printAutoConfirmHint() {
|
|
27789
27806
|
console.log(
|
|
27790
|
-
|
|
27807
|
+
chalk209.dim(
|
|
27791
27808
|
`Tip: run \`${autoConfirmHintCommand}\` to overwrite automatically next time`
|
|
27792
27809
|
)
|
|
27793
27810
|
);
|
|
@@ -28128,7 +28145,7 @@ import { execSync as execSync61 } from "child_process";
|
|
|
28128
28145
|
import { existsSync as existsSync60, mkdirSync as mkdirSync25, unlinkSync as unlinkSync22, writeFileSync as writeFileSync42 } from "fs";
|
|
28129
28146
|
import { tmpdir as tmpdir8 } from "os";
|
|
28130
28147
|
import { join as join72, resolve as resolve19 } from "path";
|
|
28131
|
-
import
|
|
28148
|
+
import chalk210 from "chalk";
|
|
28132
28149
|
|
|
28133
28150
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
28134
28151
|
var captureWindowPs1 = `
|
|
@@ -28279,13 +28296,13 @@ function screenshot(processName) {
|
|
|
28279
28296
|
const config = loadConfig();
|
|
28280
28297
|
const outputDir = resolve19(config.screenshot.outputDir);
|
|
28281
28298
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
28282
|
-
console.log(
|
|
28299
|
+
console.log(chalk210.gray(`Capturing window for process "${processName}" ...`));
|
|
28283
28300
|
try {
|
|
28284
28301
|
runPowerShellScript(processName, outputPath);
|
|
28285
|
-
console.log(
|
|
28302
|
+
console.log(chalk210.green(`Screenshot saved: ${outputPath}`));
|
|
28286
28303
|
} catch (error) {
|
|
28287
28304
|
const msg = error instanceof Error ? error.message : String(error);
|
|
28288
|
-
console.error(
|
|
28305
|
+
console.error(chalk210.red(`Failed to capture screenshot: ${msg}`));
|
|
28289
28306
|
process.exit(1);
|
|
28290
28307
|
}
|
|
28291
28308
|
}
|
|
@@ -32994,7 +33011,7 @@ var sessionsConfigHelp = [
|
|
|
32994
33011
|
|
|
32995
33012
|
// src/commands/sessions/summarise/index.ts
|
|
32996
33013
|
import * as fs41 from "fs";
|
|
32997
|
-
import
|
|
33014
|
+
import chalk211 from "chalk";
|
|
32998
33015
|
|
|
32999
33016
|
// src/commands/sessions/summarise/shared.ts
|
|
33000
33017
|
import * as fs40 from "fs";
|
|
@@ -33053,22 +33070,22 @@ ${firstMessage}`);
|
|
|
33053
33070
|
async function summarise2(options2) {
|
|
33054
33071
|
const files = await discoverSessionFiles();
|
|
33055
33072
|
if (files.length === 0) {
|
|
33056
|
-
console.log(
|
|
33073
|
+
console.log(chalk211.yellow("No sessions found."));
|
|
33057
33074
|
return;
|
|
33058
33075
|
}
|
|
33059
33076
|
const toProcess = selectCandidates(files, options2);
|
|
33060
33077
|
if (toProcess.length === 0) {
|
|
33061
|
-
console.log(
|
|
33078
|
+
console.log(chalk211.green("All sessions already summarised."));
|
|
33062
33079
|
return;
|
|
33063
33080
|
}
|
|
33064
33081
|
console.log(
|
|
33065
|
-
|
|
33082
|
+
chalk211.cyan(
|
|
33066
33083
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
33067
33084
|
)
|
|
33068
33085
|
);
|
|
33069
33086
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
33070
33087
|
console.log(
|
|
33071
|
-
|
|
33088
|
+
chalk211.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk211.yellow(`, ${failed2} skipped`) : "")
|
|
33072
33089
|
);
|
|
33073
33090
|
}
|
|
33074
33091
|
function selectCandidates(files, options2) {
|
|
@@ -33088,16 +33105,16 @@ function processSessions(files) {
|
|
|
33088
33105
|
let failed2 = 0;
|
|
33089
33106
|
for (let i = 0; i < files.length; i++) {
|
|
33090
33107
|
const file = files[i];
|
|
33091
|
-
process.stdout.write(
|
|
33108
|
+
process.stdout.write(chalk211.dim(` [${i + 1}/${files.length}] `));
|
|
33092
33109
|
const summary = summariseSession(file);
|
|
33093
33110
|
if (summary) {
|
|
33094
33111
|
writeSummary(file, summary);
|
|
33095
33112
|
succeeded++;
|
|
33096
|
-
process.stdout.write(`${
|
|
33113
|
+
process.stdout.write(`${chalk211.green("\u2713")} ${summary}
|
|
33097
33114
|
`);
|
|
33098
33115
|
} else {
|
|
33099
33116
|
failed2++;
|
|
33100
|
-
process.stdout.write(` ${
|
|
33117
|
+
process.stdout.write(` ${chalk211.yellow("skip")}
|
|
33101
33118
|
`);
|
|
33102
33119
|
}
|
|
33103
33120
|
}
|
|
@@ -33118,7 +33135,7 @@ function registerSessions(program2) {
|
|
|
33118
33135
|
}
|
|
33119
33136
|
|
|
33120
33137
|
// src/commands/statusLine.ts
|
|
33121
|
-
import
|
|
33138
|
+
import chalk213 from "chalk";
|
|
33122
33139
|
|
|
33123
33140
|
// src/shared/contextLevel.ts
|
|
33124
33141
|
function contextLevel(pct) {
|
|
@@ -33128,7 +33145,7 @@ function contextLevel(pct) {
|
|
|
33128
33145
|
}
|
|
33129
33146
|
|
|
33130
33147
|
// src/commands/buildLimitsSegment.ts
|
|
33131
|
-
import
|
|
33148
|
+
import chalk212 from "chalk";
|
|
33132
33149
|
|
|
33133
33150
|
// src/shared/rateLimitLevel.ts
|
|
33134
33151
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -33159,9 +33176,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
33159
33176
|
|
|
33160
33177
|
// src/commands/buildLimitsSegment.ts
|
|
33161
33178
|
var LEVEL_COLOR = {
|
|
33162
|
-
ok:
|
|
33163
|
-
warn:
|
|
33164
|
-
over:
|
|
33179
|
+
ok: chalk212.green,
|
|
33180
|
+
warn: chalk212.yellow,
|
|
33181
|
+
over: chalk212.red
|
|
33165
33182
|
};
|
|
33166
33183
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
33167
33184
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -33257,7 +33274,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
33257
33274
|
}
|
|
33258
33275
|
|
|
33259
33276
|
// src/commands/statusLine.ts
|
|
33260
|
-
|
|
33277
|
+
chalk213.level = 3;
|
|
33261
33278
|
function formatNumber(num) {
|
|
33262
33279
|
return num.toLocaleString("en-US");
|
|
33263
33280
|
}
|
|
@@ -33265,9 +33282,9 @@ function colorizePercent(pct) {
|
|
|
33265
33282
|
const label2 = `${Math.round(pct)}%`;
|
|
33266
33283
|
switch (contextLevel(pct)) {
|
|
33267
33284
|
case "red":
|
|
33268
|
-
return
|
|
33285
|
+
return chalk213.red(label2);
|
|
33269
33286
|
case "yellow":
|
|
33270
|
-
return
|
|
33287
|
+
return chalk213.yellow(label2);
|
|
33271
33288
|
default:
|
|
33272
33289
|
return label2;
|
|
33273
33290
|
}
|
|
@@ -33280,7 +33297,7 @@ async function statusLine() {
|
|
|
33280
33297
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
33281
33298
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
33282
33299
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
33283
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
33300
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk213.cyan(branch2)} | ` : "";
|
|
33284
33301
|
console.log(
|
|
33285
33302
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
33286
33303
|
);
|
|
@@ -33301,7 +33318,7 @@ import { fileURLToPath as fileURLToPath9 } from "url";
|
|
|
33301
33318
|
// src/commands/sync/syncClaudeMd.ts
|
|
33302
33319
|
import * as fs42 from "fs";
|
|
33303
33320
|
import * as path61 from "path";
|
|
33304
|
-
import
|
|
33321
|
+
import chalk214 from "chalk";
|
|
33305
33322
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
33306
33323
|
const source = path61.join(claudeDir, "CLAUDE.md");
|
|
33307
33324
|
const target = path61.join(targetBase, "CLAUDE.md");
|
|
@@ -33310,14 +33327,14 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
33310
33327
|
const targetContent = fs42.readFileSync(target, "utf8");
|
|
33311
33328
|
if (sourceContent !== targetContent) {
|
|
33312
33329
|
console.log(
|
|
33313
|
-
|
|
33330
|
+
chalk214.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
33314
33331
|
);
|
|
33315
33332
|
console.log();
|
|
33316
33333
|
printDiff(targetContent, sourceContent);
|
|
33317
33334
|
if (!options2?.yes) {
|
|
33318
33335
|
printAutoConfirmHint();
|
|
33319
33336
|
const confirm = await promptConfirm(
|
|
33320
|
-
|
|
33337
|
+
chalk214.red("Overwrite existing CLAUDE.md?"),
|
|
33321
33338
|
false
|
|
33322
33339
|
);
|
|
33323
33340
|
if (!confirm) {
|
|
@@ -33512,7 +33529,7 @@ function syncPi(claudeDir) {
|
|
|
33512
33529
|
// src/commands/sync/syncSettings.ts
|
|
33513
33530
|
import * as fs47 from "fs";
|
|
33514
33531
|
import * as path68 from "path";
|
|
33515
|
-
import
|
|
33532
|
+
import chalk215 from "chalk";
|
|
33516
33533
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
33517
33534
|
const source = path68.join(claudeDir, "settings.json");
|
|
33518
33535
|
const target = path68.join(targetBase, "settings.json");
|
|
@@ -33531,7 +33548,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
33531
33548
|
if (mergedContent !== normalizedTarget) {
|
|
33532
33549
|
if (!options2?.yes) {
|
|
33533
33550
|
console.log(
|
|
33534
|
-
|
|
33551
|
+
chalk215.yellow(
|
|
33535
33552
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
33536
33553
|
)
|
|
33537
33554
|
);
|
|
@@ -33539,7 +33556,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
33539
33556
|
printDiff(targetContent, mergedContent);
|
|
33540
33557
|
printAutoConfirmHint();
|
|
33541
33558
|
const confirm = await promptConfirm(
|
|
33542
|
-
|
|
33559
|
+
chalk215.red("Overwrite existing settings.json?"),
|
|
33543
33560
|
false
|
|
33544
33561
|
);
|
|
33545
33562
|
if (!confirm) {
|
|
@@ -33638,10 +33655,10 @@ async function update2() {
|
|
|
33638
33655
|
}
|
|
33639
33656
|
|
|
33640
33657
|
// src/reportCliError.ts
|
|
33641
|
-
import
|
|
33658
|
+
import chalk216 from "chalk";
|
|
33642
33659
|
function reportCliError(error) {
|
|
33643
33660
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError) {
|
|
33644
|
-
console.error(
|
|
33661
|
+
console.error(chalk216.red(error.message));
|
|
33645
33662
|
} else {
|
|
33646
33663
|
console.error(error);
|
|
33647
33664
|
}
|