@staff0rd/assist 0.558.3 → 0.560.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/commands/sessions/web/bundle.js +305 -305
- package/dist/index.js +727 -700
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.560.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -7452,7 +7452,8 @@ var gitRefKindSchema = z4.enum([
|
|
|
7452
7452
|
"commit",
|
|
7453
7453
|
"commit-parent",
|
|
7454
7454
|
"pr",
|
|
7455
|
-
"slack"
|
|
7455
|
+
"slack",
|
|
7456
|
+
"session"
|
|
7456
7457
|
]);
|
|
7457
7458
|
var gitRefSchema = z4.strictObject({
|
|
7458
7459
|
kind: gitRefKindSchema,
|
|
@@ -9369,18 +9370,7 @@ async function plan(id) {
|
|
|
9369
9370
|
}
|
|
9370
9371
|
|
|
9371
9372
|
// src/commands/backlog/show/index.ts
|
|
9372
|
-
import
|
|
9373
|
-
|
|
9374
|
-
// src/commands/backlog/formatComment.ts
|
|
9375
|
-
import chalk52 from "chalk";
|
|
9376
|
-
function formatComment(entry) {
|
|
9377
|
-
const id = entry.id !== void 0 ? chalk52.dim(`#${entry.id} `) : "";
|
|
9378
|
-
const tag = entry.type === "summary" ? chalk52.magenta("[summary]") : chalk52.cyan("[comment]");
|
|
9379
|
-
const phase = entry.phase !== void 0 ? chalk52.dim(` (phase ${entry.phase})`) : "";
|
|
9380
|
-
const time = chalk52.dim(entry.timestamp);
|
|
9381
|
-
return `${id}${tag}${phase} ${time}
|
|
9382
|
-
${entry.text}`;
|
|
9383
|
-
}
|
|
9373
|
+
import chalk60 from "chalk";
|
|
9384
9374
|
|
|
9385
9375
|
// src/shared/renderMarkdownTerminal.ts
|
|
9386
9376
|
import { Marked } from "marked";
|
|
@@ -9401,20 +9391,8 @@ function renderMarkdownTerminal(text18) {
|
|
|
9401
9391
|
return marked.parse(text18).trimEnd();
|
|
9402
9392
|
}
|
|
9403
9393
|
|
|
9404
|
-
// src/commands/backlog/shortenGithubIssue.ts
|
|
9405
|
-
var SHORTHAND = /^([^/\s]+)\/([^/\s]+)#(\d+)$/;
|
|
9406
|
-
function shortenGithubIssue(githubIssue, origin) {
|
|
9407
|
-
const match = SHORTHAND.exec(githubIssue);
|
|
9408
|
-
if (!match || !origin) return githubIssue;
|
|
9409
|
-
const [, owner, repo, number] = match;
|
|
9410
|
-
if (`github.com/${owner}/${repo}`.toLowerCase() === origin.toLowerCase()) {
|
|
9411
|
-
return `#${number}`;
|
|
9412
|
-
}
|
|
9413
|
-
return githubIssue;
|
|
9414
|
-
}
|
|
9415
|
-
|
|
9416
9394
|
// src/commands/backlog/show/printActivity.ts
|
|
9417
|
-
import
|
|
9395
|
+
import chalk52 from "chalk";
|
|
9418
9396
|
|
|
9419
9397
|
// src/commands/backlog/groupActivityRefs.ts
|
|
9420
9398
|
var ACTIVITY_COMMIT_LIMIT = 10;
|
|
@@ -9426,48 +9404,115 @@ function groupActivityRefs(refs, commitLimit = ACTIVITY_COMMIT_LIMIT) {
|
|
|
9426
9404
|
commits: commits2.slice(0, commitLimit),
|
|
9427
9405
|
overflowCommits: commits2.slice(commitLimit),
|
|
9428
9406
|
prs: newestFirst("pr"),
|
|
9429
|
-
slacks: newestFirst("slack")
|
|
9407
|
+
slacks: newestFirst("slack"),
|
|
9408
|
+
sessions: newestFirst("session")
|
|
9430
9409
|
};
|
|
9431
9410
|
}
|
|
9432
9411
|
|
|
9412
|
+
// src/commands/backlog/refLabel.ts
|
|
9413
|
+
function refLabel(ref) {
|
|
9414
|
+
if (ref.kind === "commit") {
|
|
9415
|
+
const subject = ref.title ? ` ${ref.title}` : "";
|
|
9416
|
+
return `${ref.ref.slice(0, 8)}${subject}`;
|
|
9417
|
+
}
|
|
9418
|
+
if (ref.kind === "pr") {
|
|
9419
|
+
const title = ref.title ? ` ${ref.title}` : "";
|
|
9420
|
+
const state = ref.state ? ` (${ref.state.toLowerCase()})` : "";
|
|
9421
|
+
return `#${ref.ref}${title}${state}`;
|
|
9422
|
+
}
|
|
9423
|
+
if (ref.kind === "slack" || ref.kind === "session") {
|
|
9424
|
+
return ref.title ?? ref.ref;
|
|
9425
|
+
}
|
|
9426
|
+
return ref.ref;
|
|
9427
|
+
}
|
|
9428
|
+
|
|
9433
9429
|
// src/commands/backlog/show/printActivity.ts
|
|
9434
|
-
function printRef(
|
|
9435
|
-
const url = ref.url ? ` ${
|
|
9436
|
-
console.log(` ${
|
|
9430
|
+
function printRef(ref) {
|
|
9431
|
+
const url = ref.url ? ` ${chalk52.dim(ref.url)}` : "";
|
|
9432
|
+
console.log(` ${chalk52.cyan(ref.kind)} ${refLabel(ref)}${url}`);
|
|
9437
9433
|
}
|
|
9438
9434
|
function printActivity(item, options2 = {}) {
|
|
9439
|
-
const { branches, commits: commits2, overflowCommits, prs: prs2, slacks } = groupActivityRefs(
|
|
9435
|
+
const { branches, commits: commits2, overflowCommits, prs: prs2, slacks, sessions } = groupActivityRefs(
|
|
9440
9436
|
item.gitRefs ?? [],
|
|
9441
9437
|
options2.allCommits ? Number.POSITIVE_INFINITY : void 0
|
|
9442
9438
|
);
|
|
9443
|
-
|
|
9444
|
-
|
|
9445
|
-
console.log(
|
|
9446
|
-
for (const branch2 of branches)
|
|
9447
|
-
|
|
9448
|
-
}
|
|
9449
|
-
for (const commit2 of commits2) {
|
|
9450
|
-
const subject = commit2.title ? ` ${commit2.title}` : "";
|
|
9451
|
-
printRef("commit", `${commit2.ref.slice(0, 8)}${subject}`, commit2);
|
|
9452
|
-
}
|
|
9439
|
+
const ordered = [...branches, ...commits2, ...prs2, ...slacks, ...sessions];
|
|
9440
|
+
if (ordered.length === 0) return;
|
|
9441
|
+
console.log(chalk52.bold("Activity"));
|
|
9442
|
+
for (const branch2 of branches) printRef(branch2);
|
|
9443
|
+
for (const commit2 of commits2) printRef(commit2);
|
|
9453
9444
|
if (overflowCommits.length > 0) {
|
|
9454
9445
|
console.log(
|
|
9455
|
-
` ${
|
|
9446
|
+
` ${chalk52.dim(`\u2026 and ${overflowCommits.length} more commits (--all-commits to show)`)}`
|
|
9456
9447
|
);
|
|
9457
9448
|
}
|
|
9458
|
-
for (const pr of prs2)
|
|
9459
|
-
|
|
9460
|
-
|
|
9461
|
-
|
|
9449
|
+
for (const pr of prs2) printRef(pr);
|
|
9450
|
+
for (const slack of slacks) printRef(slack);
|
|
9451
|
+
for (const session of sessions) printRef(session);
|
|
9452
|
+
console.log();
|
|
9453
|
+
}
|
|
9454
|
+
|
|
9455
|
+
// src/commands/backlog/show/printComments.ts
|
|
9456
|
+
import chalk54 from "chalk";
|
|
9457
|
+
|
|
9458
|
+
// src/commands/backlog/formatComment.ts
|
|
9459
|
+
import chalk53 from "chalk";
|
|
9460
|
+
function formatComment(entry) {
|
|
9461
|
+
const id = entry.id !== void 0 ? chalk53.dim(`#${entry.id} `) : "";
|
|
9462
|
+
const tag = entry.type === "summary" ? chalk53.magenta("[summary]") : chalk53.cyan("[comment]");
|
|
9463
|
+
const phase = entry.phase !== void 0 ? chalk53.dim(` (phase ${entry.phase})`) : "";
|
|
9464
|
+
const time = chalk53.dim(entry.timestamp);
|
|
9465
|
+
return `${id}${tag}${phase} ${time}
|
|
9466
|
+
${entry.text}`;
|
|
9467
|
+
}
|
|
9468
|
+
|
|
9469
|
+
// src/commands/backlog/show/printComments.ts
|
|
9470
|
+
function printComments(item) {
|
|
9471
|
+
const entries = item.comments ?? [];
|
|
9472
|
+
if (entries.length === 0) return;
|
|
9473
|
+
console.log(chalk54.bold("Comments"));
|
|
9474
|
+
for (const entry of entries) {
|
|
9475
|
+
console.log(` ${formatComment(entry)}`);
|
|
9462
9476
|
}
|
|
9463
|
-
|
|
9464
|
-
|
|
9477
|
+
console.log();
|
|
9478
|
+
}
|
|
9479
|
+
|
|
9480
|
+
// src/commands/backlog/show/printHeader.ts
|
|
9481
|
+
import chalk55 from "chalk";
|
|
9482
|
+
|
|
9483
|
+
// src/commands/backlog/shortenGithubIssue.ts
|
|
9484
|
+
var SHORTHAND = /^([^/\s]+)\/([^/\s]+)#(\d+)$/;
|
|
9485
|
+
function shortenGithubIssue(githubIssue, origin) {
|
|
9486
|
+
const match = SHORTHAND.exec(githubIssue);
|
|
9487
|
+
if (!match || !origin) return githubIssue;
|
|
9488
|
+
const [, owner, repo, number] = match;
|
|
9489
|
+
if (`github.com/${owner}/${repo}`.toLowerCase() === origin.toLowerCase()) {
|
|
9490
|
+
return `#${number}`;
|
|
9491
|
+
}
|
|
9492
|
+
return githubIssue;
|
|
9493
|
+
}
|
|
9494
|
+
|
|
9495
|
+
// src/commands/backlog/show/printHeader.ts
|
|
9496
|
+
function printHeader(item) {
|
|
9497
|
+
console.log(chalk55.bold(`${formatItemId(item.id)} ${item.name}`));
|
|
9498
|
+
const commentCount = item.comments?.length ?? 0;
|
|
9499
|
+
const comments3 = commentCount > 0 ? ` ${chalk55.dim("Comments:")} ${commentCount}` : "";
|
|
9500
|
+
console.log(
|
|
9501
|
+
`${chalk55.dim("Type:")} ${item.type} ${chalk55.dim("Status:")} ${item.status}${comments3}`
|
|
9502
|
+
);
|
|
9503
|
+
if (item.jiraKey) {
|
|
9504
|
+
console.log(`${chalk55.dim("Jira:")} ${item.jiraKey}`);
|
|
9505
|
+
}
|
|
9506
|
+
if (item.githubIssue) {
|
|
9507
|
+
console.log(
|
|
9508
|
+
`${chalk55.dim("GitHub:")} ${shortenGithubIssue(item.githubIssue, item.origin)}`
|
|
9509
|
+
);
|
|
9465
9510
|
}
|
|
9466
9511
|
console.log();
|
|
9467
9512
|
}
|
|
9468
9513
|
|
|
9469
9514
|
// src/commands/backlog/show/printLinks.ts
|
|
9470
|
-
import
|
|
9515
|
+
import chalk56 from "chalk";
|
|
9471
9516
|
|
|
9472
9517
|
// src/commands/backlog/show/loadLinkTargets.ts
|
|
9473
9518
|
import { inArray as inArray2 } from "drizzle-orm";
|
|
@@ -9489,17 +9534,17 @@ async function printLinks(orm, item) {
|
|
|
9489
9534
|
orm,
|
|
9490
9535
|
links2.map((l) => l.targetId)
|
|
9491
9536
|
);
|
|
9492
|
-
console.log(
|
|
9537
|
+
console.log(chalk56.bold("Links"));
|
|
9493
9538
|
for (const link3 of links2) {
|
|
9494
9539
|
const target = targets.find((i) => i.id === link3.targetId);
|
|
9495
|
-
const typeLabel2 = link3.type === "depends-on" ?
|
|
9540
|
+
const typeLabel2 = link3.type === "depends-on" ? chalk56.red("depends-on") : chalk56.blue("relates-to");
|
|
9496
9541
|
if (target) {
|
|
9497
9542
|
console.log(
|
|
9498
|
-
` ${typeLabel2} ${formatItemId(target.id)} ${target.name} ${
|
|
9543
|
+
` ${typeLabel2} ${formatItemId(target.id)} ${target.name} ${chalk56.dim(`(${target.status})`)}`
|
|
9499
9544
|
);
|
|
9500
9545
|
} else {
|
|
9501
9546
|
console.log(
|
|
9502
|
-
` ${typeLabel2} ${formatItemId(link3.targetId)} ${
|
|
9547
|
+
` ${typeLabel2} ${formatItemId(link3.targetId)} ${chalk56.dim("(not found)")}`
|
|
9503
9548
|
);
|
|
9504
9549
|
}
|
|
9505
9550
|
}
|
|
@@ -9507,18 +9552,18 @@ async function printLinks(orm, item) {
|
|
|
9507
9552
|
}
|
|
9508
9553
|
|
|
9509
9554
|
// src/commands/backlog/show/printPlan.ts
|
|
9510
|
-
import
|
|
9555
|
+
import chalk58 from "chalk";
|
|
9511
9556
|
|
|
9512
9557
|
// src/commands/backlog/show/printPhaseTasks.ts
|
|
9513
|
-
import
|
|
9558
|
+
import chalk57 from "chalk";
|
|
9514
9559
|
function printPhaseTasks(phase) {
|
|
9515
9560
|
for (const task of phase.tasks) {
|
|
9516
9561
|
console.log(` - ${task.task}`);
|
|
9517
9562
|
}
|
|
9518
9563
|
if (phase.manualChecks && phase.manualChecks.length > 0) {
|
|
9519
|
-
console.log(` ${
|
|
9564
|
+
console.log(` ${chalk57.dim("Manual checks:")}`);
|
|
9520
9565
|
for (const check2 of phase.manualChecks) {
|
|
9521
|
-
console.log(` ${
|
|
9566
|
+
console.log(` ${chalk57.dim(`- ${check2}`)}`);
|
|
9522
9567
|
}
|
|
9523
9568
|
}
|
|
9524
9569
|
}
|
|
@@ -9526,16 +9571,16 @@ function printPhaseTasks(phase) {
|
|
|
9526
9571
|
// src/commands/backlog/show/printPlan.ts
|
|
9527
9572
|
function phaseHeader(index3, name, isCurrent) {
|
|
9528
9573
|
const phaseNumber = index3 + 1;
|
|
9529
|
-
const marker2 = isCurrent ?
|
|
9530
|
-
const label2 = isCurrent ?
|
|
9574
|
+
const marker2 = isCurrent ? chalk58.green("\u25B6 ") : " ";
|
|
9575
|
+
const label2 = isCurrent ? chalk58.green.bold(`Phase ${phaseNumber}: ${name}`) : `${chalk58.bold(`Phase ${phaseNumber}:`)} ${name}`;
|
|
9531
9576
|
return `${marker2}${label2}`;
|
|
9532
9577
|
}
|
|
9533
9578
|
function printPhaseSessions(sessions) {
|
|
9534
9579
|
if (sessions.length === 0) return;
|
|
9535
|
-
console.log(` ${
|
|
9580
|
+
console.log(` ${chalk58.dim("Sessions:")}`);
|
|
9536
9581
|
for (const s of sessions) {
|
|
9537
9582
|
console.log(
|
|
9538
|
-
` ${
|
|
9583
|
+
` ${chalk58.dim(`- ${s.hostname} / ${s.osUser} / ${s.claudeSessionId}`)}`
|
|
9539
9584
|
);
|
|
9540
9585
|
}
|
|
9541
9586
|
}
|
|
@@ -9555,7 +9600,7 @@ function printReviewSessions(item, planLength) {
|
|
|
9555
9600
|
}
|
|
9556
9601
|
function printPlan(item) {
|
|
9557
9602
|
if (!item.plan || item.plan.length === 0) return;
|
|
9558
|
-
console.log(
|
|
9603
|
+
console.log(chalk58.bold("Plan"));
|
|
9559
9604
|
for (const [i, phase] of item.plan.entries()) {
|
|
9560
9605
|
const isCurrent = item.currentPhase === i + 1;
|
|
9561
9606
|
const sessions = (item.phaseSessions ?? []).filter((s) => s.phaseIdx === i);
|
|
@@ -9566,13 +9611,13 @@ function printPlan(item) {
|
|
|
9566
9611
|
}
|
|
9567
9612
|
|
|
9568
9613
|
// src/commands/backlog/show/printSubtasks.ts
|
|
9569
|
-
import
|
|
9614
|
+
import chalk59 from "chalk";
|
|
9570
9615
|
function printSubtasks(item) {
|
|
9571
9616
|
const subtasks = item.subtasks ?? [];
|
|
9572
9617
|
if (subtasks.length === 0) return;
|
|
9573
|
-
console.log(
|
|
9618
|
+
console.log(chalk59.bold("Sub-tasks"));
|
|
9574
9619
|
for (const [i, subtask] of subtasks.entries()) {
|
|
9575
|
-
const status3 =
|
|
9620
|
+
const status3 = chalk59.dim(`[${subtask.status}]`);
|
|
9576
9621
|
console.log(` ${i + 1}. ${status3} ${subtask.title}`);
|
|
9577
9622
|
if (subtask.description) {
|
|
9578
9623
|
const rendered = renderMarkdownTerminal(subtask.description);
|
|
@@ -9585,58 +9630,34 @@ function printSubtasks(item) {
|
|
|
9585
9630
|
}
|
|
9586
9631
|
|
|
9587
9632
|
// src/commands/backlog/show/index.ts
|
|
9588
|
-
function printHeader(item) {
|
|
9589
|
-
console.log(chalk58.bold(`${formatItemId(item.id)} ${item.name}`));
|
|
9590
|
-
console.log(
|
|
9591
|
-
`${chalk58.dim("Type:")} ${item.type} ${chalk58.dim("Status:")} ${item.status}`
|
|
9592
|
-
);
|
|
9593
|
-
if (item.jiraKey) {
|
|
9594
|
-
console.log(`${chalk58.dim("Jira:")} ${item.jiraKey}`);
|
|
9595
|
-
}
|
|
9596
|
-
if (item.githubIssue) {
|
|
9597
|
-
console.log(
|
|
9598
|
-
`${chalk58.dim("GitHub:")} ${shortenGithubIssue(item.githubIssue, item.origin)}`
|
|
9599
|
-
);
|
|
9600
|
-
}
|
|
9601
|
-
console.log();
|
|
9602
|
-
}
|
|
9603
9633
|
function printAcceptanceCriteria(criteria) {
|
|
9604
9634
|
if (criteria.length === 0) return;
|
|
9605
|
-
console.log(
|
|
9635
|
+
console.log(chalk60.bold("Acceptance Criteria"));
|
|
9606
9636
|
for (const [i, ac] of criteria.entries()) {
|
|
9607
9637
|
console.log(` ${i + 1}. ${ac}`);
|
|
9608
9638
|
}
|
|
9609
9639
|
console.log();
|
|
9610
9640
|
}
|
|
9611
|
-
function printComments(item) {
|
|
9612
|
-
const entries = item.comments ?? [];
|
|
9613
|
-
if (entries.length === 0) return;
|
|
9614
|
-
console.log(chalk58.bold("Comments"));
|
|
9615
|
-
for (const entry of entries) {
|
|
9616
|
-
console.log(` ${formatComment(entry)}`);
|
|
9617
|
-
}
|
|
9618
|
-
console.log();
|
|
9619
|
-
}
|
|
9620
9641
|
async function show(id, options2 = {}) {
|
|
9621
9642
|
const found = await findOneItem(id);
|
|
9622
9643
|
if (!found) process.exit(1);
|
|
9623
9644
|
const { orm, item } = found;
|
|
9624
9645
|
printHeader(item);
|
|
9625
9646
|
if (item.description) {
|
|
9626
|
-
console.log(
|
|
9647
|
+
console.log(chalk60.bold("Description"));
|
|
9627
9648
|
console.log(renderMarkdownTerminal(item.description));
|
|
9628
9649
|
console.log();
|
|
9629
9650
|
}
|
|
9630
9651
|
printAcceptanceCriteria(item.acceptanceCriteria);
|
|
9631
9652
|
printSubtasks(item);
|
|
9632
9653
|
await printLinks(orm, item);
|
|
9654
|
+
printComments(item);
|
|
9633
9655
|
printPlan(item);
|
|
9634
9656
|
printActivity(item, { allCommits: options2.allCommits });
|
|
9635
|
-
printComments(item);
|
|
9636
9657
|
}
|
|
9637
9658
|
|
|
9638
9659
|
// src/commands/sessions/web/index.ts
|
|
9639
|
-
import
|
|
9660
|
+
import chalk65 from "chalk";
|
|
9640
9661
|
import { WebSocketServer } from "ws";
|
|
9641
9662
|
|
|
9642
9663
|
// src/shared/getInstallDir.ts
|
|
@@ -9665,7 +9686,7 @@ function isGitRepo(dir) {
|
|
|
9665
9686
|
import {
|
|
9666
9687
|
createServer
|
|
9667
9688
|
} from "http";
|
|
9668
|
-
import
|
|
9689
|
+
import chalk61 from "chalk";
|
|
9669
9690
|
|
|
9670
9691
|
// src/lib/openBrowser.ts
|
|
9671
9692
|
import { execSync as execSync32 } from "child_process";
|
|
@@ -9775,8 +9796,8 @@ function startWebServer(label2, port, handler, initialPath, open = true) {
|
|
|
9775
9796
|
runHandler(handler, req, res, port);
|
|
9776
9797
|
});
|
|
9777
9798
|
server.listen(port, () => {
|
|
9778
|
-
console.log(
|
|
9779
|
-
console.log(
|
|
9799
|
+
console.log(chalk61.green(`${label2}: ${url}`));
|
|
9800
|
+
console.log(chalk61.dim("Press Ctrl+C to stop"));
|
|
9780
9801
|
if (open) {
|
|
9781
9802
|
openBrowser(url);
|
|
9782
9803
|
}
|
|
@@ -13072,25 +13093,25 @@ function withRepoCwd(line, repoCwd) {
|
|
|
13072
13093
|
}
|
|
13073
13094
|
|
|
13074
13095
|
// src/commands/sessions/web/restartMenu/installRestartMenu.ts
|
|
13075
|
-
import
|
|
13096
|
+
import chalk64 from "chalk";
|
|
13076
13097
|
import { createLogUpdate } from "log-update";
|
|
13077
13098
|
|
|
13078
13099
|
// src/commands/sessions/web/restartMenu/runRestartItem.ts
|
|
13079
|
-
import
|
|
13100
|
+
import chalk62 from "chalk";
|
|
13080
13101
|
async function runRestartItem(item, { runRestartDaemon, reExec }) {
|
|
13081
13102
|
if (item.disabled) return;
|
|
13082
13103
|
try {
|
|
13083
13104
|
if (item.action === "restart-daemon" || item.action === "restart-both") {
|
|
13084
|
-
console.log(
|
|
13105
|
+
console.log(chalk62.cyan("Restarting sessions daemon\u2026"));
|
|
13085
13106
|
await runRestartDaemon();
|
|
13086
13107
|
}
|
|
13087
13108
|
if (item.action === "restart-webserver" || item.action === "restart-both") {
|
|
13088
|
-
console.log(
|
|
13109
|
+
console.log(chalk62.cyan("Restarting web server\u2026"));
|
|
13089
13110
|
reExec();
|
|
13090
13111
|
}
|
|
13091
13112
|
} catch (error) {
|
|
13092
13113
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
13093
|
-
console.error(
|
|
13114
|
+
console.error(chalk62.red(`Restart failed: ${message3}`));
|
|
13094
13115
|
}
|
|
13095
13116
|
}
|
|
13096
13117
|
|
|
@@ -13172,20 +13193,20 @@ function firstEnabledIndex(items2) {
|
|
|
13172
13193
|
}
|
|
13173
13194
|
|
|
13174
13195
|
// src/commands/sessions/web/restartMenu/renderRestartMenu.ts
|
|
13175
|
-
import
|
|
13196
|
+
import chalk63 from "chalk";
|
|
13176
13197
|
function renderRestartMenu(items2, selected) {
|
|
13177
|
-
const lines2 = [
|
|
13198
|
+
const lines2 = [chalk63.bold.cyan("assist \u2014 restart menu")];
|
|
13178
13199
|
items2.forEach((item, i) => {
|
|
13179
13200
|
const active = i === selected;
|
|
13180
|
-
const pointer = active ?
|
|
13181
|
-
const number =
|
|
13182
|
-
const note = item.note ?
|
|
13201
|
+
const pointer = active ? chalk63.cyan("\u276F ") : " ";
|
|
13202
|
+
const number = chalk63.dim(`${i + 1}. `);
|
|
13203
|
+
const note = item.note ? chalk63.dim(` (${item.note})`) : "";
|
|
13183
13204
|
let label2 = item.label;
|
|
13184
|
-
if (item.disabled) label2 =
|
|
13185
|
-
else if (active) label2 =
|
|
13205
|
+
if (item.disabled) label2 = chalk63.dim(label2);
|
|
13206
|
+
else if (active) label2 = chalk63.cyan.bold(label2);
|
|
13186
13207
|
lines2.push(`${pointer}${number}${label2}${note}`);
|
|
13187
13208
|
});
|
|
13188
|
-
lines2.push(
|
|
13209
|
+
lines2.push(chalk63.dim("\u2191/\u2193 move \xB7 1-3 jump \xB7 enter select \xB7 esc close"));
|
|
13189
13210
|
return lines2.join("\n");
|
|
13190
13211
|
}
|
|
13191
13212
|
|
|
@@ -13279,7 +13300,7 @@ function installRestartMenu(options2 = {}) {
|
|
|
13279
13300
|
}
|
|
13280
13301
|
});
|
|
13281
13302
|
const restoreRaw = enableRawMode(stdin, handler);
|
|
13282
|
-
console.log(
|
|
13303
|
+
console.log(chalk64.dim("Press Ctrl+R for the restart menu"));
|
|
13283
13304
|
let cleaned = false;
|
|
13284
13305
|
function cleanup() {
|
|
13285
13306
|
if (cleaned) return;
|
|
@@ -13364,7 +13385,7 @@ async function web(options2) {
|
|
|
13364
13385
|
streamDaemonLogs();
|
|
13365
13386
|
void ensureDaemonRunning("web server start").catch((error) => {
|
|
13366
13387
|
console.error(
|
|
13367
|
-
|
|
13388
|
+
chalk65.yellow(
|
|
13368
13389
|
`sessions daemon not ready yet, will retry on connection: ${error instanceof Error ? error.message : String(error)}`
|
|
13369
13390
|
)
|
|
13370
13391
|
);
|
|
@@ -13381,12 +13402,12 @@ async function web2(options2) {
|
|
|
13381
13402
|
}
|
|
13382
13403
|
|
|
13383
13404
|
// src/commands/backlog/addActivity.ts
|
|
13384
|
-
import
|
|
13405
|
+
import chalk66 from "chalk";
|
|
13385
13406
|
async function addActivity(id, kind, ref, options2) {
|
|
13386
13407
|
const parsedKind = gitRefKindSchema.safeParse(kind);
|
|
13387
13408
|
if (!parsedKind.success) {
|
|
13388
13409
|
console.log(
|
|
13389
|
-
|
|
13410
|
+
chalk66.red(
|
|
13390
13411
|
`Invalid kind "${kind}". Expected one of: ${gitRefKindSchema.options.join(", ")}.`
|
|
13391
13412
|
)
|
|
13392
13413
|
);
|
|
@@ -13408,7 +13429,7 @@ async function addActivity(id, kind, ref, options2) {
|
|
|
13408
13429
|
state: options2.state
|
|
13409
13430
|
});
|
|
13410
13431
|
console.log(
|
|
13411
|
-
|
|
13432
|
+
chalk66.green(
|
|
13412
13433
|
`Attached ${parsedKind.data} "${ref}" to item ${formatItemId(item.id)}.`
|
|
13413
13434
|
)
|
|
13414
13435
|
);
|
|
@@ -13424,7 +13445,7 @@ async function recordSlack(url, options2) {
|
|
|
13424
13445
|
// src/commands/backlog/registerActivityCommands.ts
|
|
13425
13446
|
function registerActivityCommands(cmd) {
|
|
13426
13447
|
cmd.command("add-activity <id> <kind> <ref>").description(
|
|
13427
|
-
"Attach an activity ref (branch|commit|pr|slack) to a backlog item"
|
|
13448
|
+
"Attach an activity ref (branch|commit|pr|slack|session) to a backlog item"
|
|
13428
13449
|
).option("--title <title>", "Title metadata for the ref").option("--url <url>", "URL metadata (auto-filled for branch/commit)").option("--state <state>", "State metadata for the ref").action(addActivity);
|
|
13429
13450
|
cmd.command("record-slack <url>").description(
|
|
13430
13451
|
"Attach a Slack thread permalink to the current session's backlog item"
|
|
@@ -13432,11 +13453,11 @@ function registerActivityCommands(cmd) {
|
|
|
13432
13453
|
}
|
|
13433
13454
|
|
|
13434
13455
|
// src/commands/backlog/associate-github/index.ts
|
|
13435
|
-
import
|
|
13456
|
+
import chalk68 from "chalk";
|
|
13436
13457
|
import { eq as eq21 } from "drizzle-orm";
|
|
13437
13458
|
|
|
13438
13459
|
// src/commands/backlog/beginAssociation.ts
|
|
13439
|
-
import
|
|
13460
|
+
import chalk67 from "chalk";
|
|
13440
13461
|
import { eq as eq20 } from "drizzle-orm";
|
|
13441
13462
|
async function beginAssociation(id, options2, clearPatch, label2) {
|
|
13442
13463
|
const found = await findOneItem(id);
|
|
@@ -13449,7 +13470,7 @@ async function beginAssociation(id, options2, clearPatch, label2) {
|
|
|
13449
13470
|
if (options2.clear) {
|
|
13450
13471
|
await orm.update(items).set(clearPatch).where(eq20(items.id, itemId2));
|
|
13451
13472
|
console.log(
|
|
13452
|
-
|
|
13473
|
+
chalk67.green(
|
|
13453
13474
|
`Cleared ${label2} association on item ${formatItemId(itemId2)}.`
|
|
13454
13475
|
)
|
|
13455
13476
|
);
|
|
@@ -13499,7 +13520,7 @@ async function associateGithub(id, issue, options2) {
|
|
|
13499
13520
|
const { orm, itemId: itemId2 } = target;
|
|
13500
13521
|
if (!issue) {
|
|
13501
13522
|
console.log(
|
|
13502
|
-
|
|
13523
|
+
chalk68.red("Provide a GitHub issue, or use --clear to remove one.")
|
|
13503
13524
|
);
|
|
13504
13525
|
process.exitCode = 1;
|
|
13505
13526
|
return;
|
|
@@ -13507,7 +13528,7 @@ async function associateGithub(id, issue, options2) {
|
|
|
13507
13528
|
const normalized = normalizeGithubIssue(issue);
|
|
13508
13529
|
if (!normalized) {
|
|
13509
13530
|
console.log(
|
|
13510
|
-
|
|
13531
|
+
chalk68.red(
|
|
13511
13532
|
`Malformed GitHub issue "${issue}". Expected owner/repo#number or a github.com issue URL.`
|
|
13512
13533
|
)
|
|
13513
13534
|
);
|
|
@@ -13517,8 +13538,8 @@ async function associateGithub(id, issue, options2) {
|
|
|
13517
13538
|
const title = fetchGithubIssueTitle(normalized);
|
|
13518
13539
|
await orm.update(items).set({ githubIssue: normalized, jiraKey: null }).where(eq21(items.id, itemId2));
|
|
13519
13540
|
console.log(
|
|
13520
|
-
|
|
13521
|
-
title ?
|
|
13541
|
+
chalk68.green(`Associated ${normalized} with item ${formatItemId(itemId2)}.`),
|
|
13542
|
+
title ? chalk68.dim(`(${title})`) : ""
|
|
13522
13543
|
);
|
|
13523
13544
|
}
|
|
13524
13545
|
|
|
@@ -13528,12 +13549,12 @@ function registerAssociateGithubCommand(cmd) {
|
|
|
13528
13549
|
}
|
|
13529
13550
|
|
|
13530
13551
|
// src/commands/backlog/associate-jira/index.ts
|
|
13531
|
-
import
|
|
13552
|
+
import chalk70 from "chalk";
|
|
13532
13553
|
import { eq as eq22 } from "drizzle-orm";
|
|
13533
13554
|
|
|
13534
13555
|
// src/commands/jira/fetchIssue.ts
|
|
13535
13556
|
import { execSync as execSync34 } from "child_process";
|
|
13536
|
-
import
|
|
13557
|
+
import chalk69 from "chalk";
|
|
13537
13558
|
function fetchIssue(issueKey, fields) {
|
|
13538
13559
|
let result;
|
|
13539
13560
|
try {
|
|
@@ -13546,15 +13567,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
13546
13567
|
const stderr = error.stderr;
|
|
13547
13568
|
if (stderr.includes("unauthorized")) {
|
|
13548
13569
|
console.error(
|
|
13549
|
-
|
|
13570
|
+
chalk69.red("Jira authentication expired."),
|
|
13550
13571
|
"Run",
|
|
13551
|
-
|
|
13572
|
+
chalk69.cyan("assist jira auth"),
|
|
13552
13573
|
"to re-authenticate."
|
|
13553
13574
|
);
|
|
13554
13575
|
process.exit(1);
|
|
13555
13576
|
}
|
|
13556
13577
|
}
|
|
13557
|
-
console.error(
|
|
13578
|
+
console.error(chalk69.red(`Failed to fetch ${issueKey}.`));
|
|
13558
13579
|
process.exit(1);
|
|
13559
13580
|
}
|
|
13560
13581
|
return JSON.parse(result);
|
|
@@ -13577,14 +13598,14 @@ async function associateJira(id, key, options2) {
|
|
|
13577
13598
|
if (!target) return;
|
|
13578
13599
|
const { orm, itemId: itemId2 } = target;
|
|
13579
13600
|
if (!key) {
|
|
13580
|
-
console.log(
|
|
13601
|
+
console.log(chalk70.red("Provide a Jira key, or use --clear to remove one."));
|
|
13581
13602
|
process.exitCode = 1;
|
|
13582
13603
|
return;
|
|
13583
13604
|
}
|
|
13584
13605
|
const normalized = normalizeJiraKey(key);
|
|
13585
13606
|
if (!normalized) {
|
|
13586
13607
|
console.log(
|
|
13587
|
-
|
|
13608
|
+
chalk70.red(
|
|
13588
13609
|
`Malformed Jira key "${key}". Expected a key like PROJ-123 or a browse URL.`
|
|
13589
13610
|
)
|
|
13590
13611
|
);
|
|
@@ -13596,8 +13617,8 @@ async function associateJira(id, key, options2) {
|
|
|
13596
13617
|
const summary = fields?.summary;
|
|
13597
13618
|
await orm.update(items).set({ jiraKey: normalized, githubIssue: null }).where(eq22(items.id, itemId2));
|
|
13598
13619
|
console.log(
|
|
13599
|
-
|
|
13600
|
-
summary ?
|
|
13620
|
+
chalk70.green(`Associated ${normalized} with item ${formatItemId(itemId2)}.`),
|
|
13621
|
+
summary ? chalk70.dim(`(${summary})`) : ""
|
|
13601
13622
|
);
|
|
13602
13623
|
}
|
|
13603
13624
|
|
|
@@ -13610,7 +13631,7 @@ function registerAssociateJiraCommand(cmd) {
|
|
|
13610
13631
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
13611
13632
|
import { existsSync as existsSync32 } from "fs";
|
|
13612
13633
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
13613
|
-
import
|
|
13634
|
+
import chalk71 from "chalk";
|
|
13614
13635
|
|
|
13615
13636
|
// src/commands/backlog/originToSshUrl.ts
|
|
13616
13637
|
function originToSshUrl(origin) {
|
|
@@ -13625,7 +13646,7 @@ function originToSshUrl(origin) {
|
|
|
13625
13646
|
|
|
13626
13647
|
// src/commands/backlog/cloneRepo.ts
|
|
13627
13648
|
function fail2(message3) {
|
|
13628
|
-
console.log(
|
|
13649
|
+
console.log(chalk71.red(message3));
|
|
13629
13650
|
process.exitCode = 1;
|
|
13630
13651
|
}
|
|
13631
13652
|
async function cloneRepo(originRaw) {
|
|
@@ -13648,7 +13669,7 @@ async function cloneRepo(originRaw) {
|
|
|
13648
13669
|
return fail2(`Clone target already exists: ${target}`);
|
|
13649
13670
|
}
|
|
13650
13671
|
await mkdir3(baseDir, { recursive: true });
|
|
13651
|
-
console.error(
|
|
13672
|
+
console.error(chalk71.dim(`Cloning ${sshUrl} into ${target}`));
|
|
13652
13673
|
const result = spawnSync2("git", ["clone", sshUrl, target], {
|
|
13653
13674
|
stdio: "inherit"
|
|
13654
13675
|
});
|
|
@@ -13660,7 +13681,7 @@ async function cloneRepo(originRaw) {
|
|
|
13660
13681
|
`git clone failed with exit code ${result.status ?? "unknown"}.`
|
|
13661
13682
|
);
|
|
13662
13683
|
}
|
|
13663
|
-
console.error(
|
|
13684
|
+
console.error(chalk71.green(`Cloned ${origin} into ${target}`));
|
|
13664
13685
|
}
|
|
13665
13686
|
|
|
13666
13687
|
// src/commands/backlog/registerCloneCommand.ts
|
|
@@ -13671,29 +13692,29 @@ function registerCloneCommand(cmd) {
|
|
|
13671
13692
|
}
|
|
13672
13693
|
|
|
13673
13694
|
// src/commands/backlog/comment/index.ts
|
|
13674
|
-
import
|
|
13695
|
+
import chalk72 from "chalk";
|
|
13675
13696
|
async function comment(id, text18) {
|
|
13676
13697
|
const found = await findOneItem(id);
|
|
13677
13698
|
if (!found) process.exit(1);
|
|
13678
13699
|
await appendComment(found.orm, found.item.id, text18);
|
|
13679
13700
|
console.log(
|
|
13680
|
-
|
|
13701
|
+
chalk72.green(`Comment added to item ${formatItemId(found.item.id)}.`)
|
|
13681
13702
|
);
|
|
13682
13703
|
}
|
|
13683
13704
|
|
|
13684
13705
|
// src/commands/backlog/comments/index.ts
|
|
13685
|
-
import
|
|
13706
|
+
import chalk73 from "chalk";
|
|
13686
13707
|
async function comments2(id) {
|
|
13687
13708
|
const found = await findOneItem(id);
|
|
13688
13709
|
if (!found) process.exit(1);
|
|
13689
13710
|
const { item } = found;
|
|
13690
13711
|
const entries = item.comments ?? [];
|
|
13691
13712
|
if (entries.length === 0) {
|
|
13692
|
-
console.log(
|
|
13713
|
+
console.log(chalk73.dim(`No comments on item ${formatItemId(item.id)}.`));
|
|
13693
13714
|
return;
|
|
13694
13715
|
}
|
|
13695
13716
|
console.log(
|
|
13696
|
-
|
|
13717
|
+
chalk73.bold(`Comments for ${formatItemId(item.id)}: ${item.name}
|
|
13697
13718
|
`)
|
|
13698
13719
|
);
|
|
13699
13720
|
for (const entry of entries) {
|
|
@@ -13703,7 +13724,7 @@ async function comments2(id) {
|
|
|
13703
13724
|
}
|
|
13704
13725
|
|
|
13705
13726
|
// src/commands/backlog/delete-comment/index.ts
|
|
13706
|
-
import
|
|
13727
|
+
import chalk74 from "chalk";
|
|
13707
13728
|
async function deleteCommentCmd(id, commentId) {
|
|
13708
13729
|
const found = await findOneItem(id);
|
|
13709
13730
|
if (!found) process.exit(1);
|
|
@@ -13716,14 +13737,14 @@ async function deleteCommentCmd(id, commentId) {
|
|
|
13716
13737
|
switch (outcome) {
|
|
13717
13738
|
case "deleted":
|
|
13718
13739
|
console.log(
|
|
13719
|
-
|
|
13740
|
+
chalk74.green(
|
|
13720
13741
|
`Comment #${commentId} deleted from item ${formatItemId(itemId2)}.`
|
|
13721
13742
|
)
|
|
13722
13743
|
);
|
|
13723
13744
|
break;
|
|
13724
13745
|
case "not-found":
|
|
13725
13746
|
console.log(
|
|
13726
|
-
|
|
13747
|
+
chalk74.red(
|
|
13727
13748
|
`Comment #${commentId} not found on item ${formatItemId(itemId2)}.`
|
|
13728
13749
|
)
|
|
13729
13750
|
);
|
|
@@ -13731,7 +13752,7 @@ async function deleteCommentCmd(id, commentId) {
|
|
|
13731
13752
|
break;
|
|
13732
13753
|
case "is-summary":
|
|
13733
13754
|
console.log(
|
|
13734
|
-
|
|
13755
|
+
chalk74.red(
|
|
13735
13756
|
`Comment #${commentId} is a phase summary and cannot be deleted.`
|
|
13736
13757
|
)
|
|
13737
13758
|
);
|
|
@@ -13756,7 +13777,7 @@ function registerExportCommand(cmd) {
|
|
|
13756
13777
|
|
|
13757
13778
|
// src/commands/backlog/import/index.ts
|
|
13758
13779
|
import { readFile as readFile3 } from "fs/promises";
|
|
13759
|
-
import
|
|
13780
|
+
import chalk76 from "chalk";
|
|
13760
13781
|
|
|
13761
13782
|
// src/commands/backlog/dump/countCopyRows.ts
|
|
13762
13783
|
function countCopyRows(data) {
|
|
@@ -13828,7 +13849,7 @@ function validateDump({ header, sections }) {
|
|
|
13828
13849
|
}
|
|
13829
13850
|
|
|
13830
13851
|
// src/commands/backlog/import/confirmReplace.ts
|
|
13831
|
-
import
|
|
13852
|
+
import chalk75 from "chalk";
|
|
13832
13853
|
async function countRows(client, table) {
|
|
13833
13854
|
const { rows } = await client.query(
|
|
13834
13855
|
`SELECT count(*)::int AS n FROM ${table}`
|
|
@@ -13839,7 +13860,7 @@ function printSummary(tables, current, incoming) {
|
|
|
13839
13860
|
const lines2 = tables.map(
|
|
13840
13861
|
(t, i) => ` ${t.name}: ${current[i]} \u2192 ${incoming[i]} rows`
|
|
13841
13862
|
);
|
|
13842
|
-
console.error(
|
|
13863
|
+
console.error(chalk75.bold("\nThis will REPLACE all backlog data:"));
|
|
13843
13864
|
console.error(`${lines2.join("\n")}
|
|
13844
13865
|
`);
|
|
13845
13866
|
}
|
|
@@ -13941,13 +13962,13 @@ async function importBacklog(file, options2 = {}) {
|
|
|
13941
13962
|
);
|
|
13942
13963
|
await withDbClient(async (client) => {
|
|
13943
13964
|
if (!options2.yes && !await confirmReplace(client, tables, incoming, !file)) {
|
|
13944
|
-
console.error(
|
|
13965
|
+
console.error(chalk76.yellow("Import cancelled; no changes made."));
|
|
13945
13966
|
return;
|
|
13946
13967
|
}
|
|
13947
13968
|
await restore(client, parsed);
|
|
13948
13969
|
const total = incoming.reduce((sum, n) => sum + n, 0);
|
|
13949
13970
|
console.error(
|
|
13950
|
-
|
|
13971
|
+
chalk76.green(
|
|
13951
13972
|
`Imported backlog: ${total} rows restored across ${tables.length} tables.`
|
|
13952
13973
|
)
|
|
13953
13974
|
);
|
|
@@ -13964,7 +13985,7 @@ function registerImportCommand(cmd) {
|
|
|
13964
13985
|
}
|
|
13965
13986
|
|
|
13966
13987
|
// src/commands/backlog/add/index.ts
|
|
13967
|
-
import
|
|
13988
|
+
import chalk78 from "chalk";
|
|
13968
13989
|
|
|
13969
13990
|
// src/lib/isClaudeCode.ts
|
|
13970
13991
|
function isClaudeCode() {
|
|
@@ -14053,11 +14074,11 @@ async function createItemWithDefaults(fields) {
|
|
|
14053
14074
|
}
|
|
14054
14075
|
|
|
14055
14076
|
// src/commands/backlog/ensureRemoteOrigin.ts
|
|
14056
|
-
import
|
|
14077
|
+
import chalk77 from "chalk";
|
|
14057
14078
|
function ensureRemoteOrigin() {
|
|
14058
14079
|
if (getRemoteOriginUrl(getBacklogDir())) return true;
|
|
14059
14080
|
console.log(
|
|
14060
|
-
|
|
14081
|
+
chalk77.red(
|
|
14061
14082
|
"Backlog requires a git remote so items get a stable origin.\nAdd one with: git remote add origin <url>"
|
|
14062
14083
|
)
|
|
14063
14084
|
);
|
|
@@ -14139,7 +14160,7 @@ async function promptAcceptanceCriteria() {
|
|
|
14139
14160
|
async function add(options2) {
|
|
14140
14161
|
if (isClaudeCode()) {
|
|
14141
14162
|
console.error(
|
|
14142
|
-
|
|
14163
|
+
chalk78.red(
|
|
14143
14164
|
"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."
|
|
14144
14165
|
)
|
|
14145
14166
|
);
|
|
@@ -14157,14 +14178,14 @@ async function add(options2) {
|
|
|
14157
14178
|
description,
|
|
14158
14179
|
acceptanceCriteria: acceptanceCriteria2
|
|
14159
14180
|
});
|
|
14160
|
-
console.log(
|
|
14181
|
+
console.log(chalk78.green(`Added item ${formatItemId(id)}: ${name}`));
|
|
14161
14182
|
}
|
|
14162
14183
|
|
|
14163
14184
|
// src/commands/backlog/addPhase/index.ts
|
|
14164
|
-
import
|
|
14185
|
+
import chalk80 from "chalk";
|
|
14165
14186
|
|
|
14166
14187
|
// src/commands/backlog/resolveInsertPosition.ts
|
|
14167
|
-
import
|
|
14188
|
+
import chalk79 from "chalk";
|
|
14168
14189
|
import { count as count3, eq as eq25 } from "drizzle-orm";
|
|
14169
14190
|
async function resolveInsertPosition(orm, itemId2, position) {
|
|
14170
14191
|
const [row] = await orm.select({ cnt: count3() }).from(planPhases).where(eq25(planPhases.itemId, itemId2));
|
|
@@ -14173,7 +14194,7 @@ async function resolveInsertPosition(orm, itemId2, position) {
|
|
|
14173
14194
|
const pos = Number.parseInt(position, 10);
|
|
14174
14195
|
if (pos < 1 || pos > phaseCount + 1) {
|
|
14175
14196
|
console.log(
|
|
14176
|
-
|
|
14197
|
+
chalk79.red(
|
|
14177
14198
|
`Position ${pos} is out of range. Must be between 1 and ${phaseCount + 1}.`
|
|
14178
14199
|
)
|
|
14179
14200
|
);
|
|
@@ -14209,6 +14230,20 @@ ${quoted}
|
|
|
14209
14230
|
process.exit(1);
|
|
14210
14231
|
}
|
|
14211
14232
|
|
|
14233
|
+
// src/commands/sessions/shared/toPreviewDecision.ts
|
|
14234
|
+
function toPreviewDecision(msg) {
|
|
14235
|
+
if (msg.decision !== "approve" && msg.decision !== "reject") return null;
|
|
14236
|
+
return {
|
|
14237
|
+
decision: msg.decision,
|
|
14238
|
+
reason: msg.reason,
|
|
14239
|
+
comments: Array.isArray(msg.comments) ? msg.comments : void 0,
|
|
14240
|
+
screenshots: Array.isArray(msg.screenshots) ? msg.screenshots : void 0,
|
|
14241
|
+
reviewAfter: msg.reviewAfter === true,
|
|
14242
|
+
announceAfter: msg.announceAfter === true,
|
|
14243
|
+
draft: typeof msg.draft === "boolean" ? msg.draft : void 0
|
|
14244
|
+
};
|
|
14245
|
+
}
|
|
14246
|
+
|
|
14212
14247
|
// src/commands/sessions/shared/parsePreviewDecision.ts
|
|
14213
14248
|
function parsePreviewDecision(line, requestId) {
|
|
14214
14249
|
try {
|
|
@@ -14216,18 +14251,8 @@ function parsePreviewDecision(line, requestId) {
|
|
|
14216
14251
|
if (msg.type === "error" && (msg.message ?? "").includes("pr-preview"))
|
|
14217
14252
|
return { kind: "error", message: msg.message ?? "pr-preview failed" };
|
|
14218
14253
|
if (msg.type !== "pr-decision" || msg.requestId !== requestId) return null;
|
|
14219
|
-
|
|
14220
|
-
return {
|
|
14221
|
-
kind: "decision",
|
|
14222
|
-
decision: {
|
|
14223
|
-
decision: msg.decision,
|
|
14224
|
-
reason: msg.reason,
|
|
14225
|
-
comments: Array.isArray(msg.comments) ? msg.comments : void 0,
|
|
14226
|
-
screenshots: Array.isArray(msg.screenshots) ? msg.screenshots : void 0,
|
|
14227
|
-
reviewAfter: msg.reviewAfter === true,
|
|
14228
|
-
announceAfter: msg.announceAfter === true
|
|
14229
|
-
}
|
|
14230
|
-
};
|
|
14254
|
+
const decision = toPreviewDecision(msg);
|
|
14255
|
+
return decision ? { kind: "decision", decision } : null;
|
|
14231
14256
|
} catch {
|
|
14232
14257
|
return null;
|
|
14233
14258
|
}
|
|
@@ -14316,7 +14341,7 @@ async function addPhase(id, name, options2) {
|
|
|
14316
14341
|
if (!found) return;
|
|
14317
14342
|
const tasks = options2.task ?? [];
|
|
14318
14343
|
if (tasks.length === 0) {
|
|
14319
|
-
console.log(
|
|
14344
|
+
console.log(chalk80.red("At least one --task is required."));
|
|
14320
14345
|
process.exitCode = 1;
|
|
14321
14346
|
return;
|
|
14322
14347
|
}
|
|
@@ -14340,14 +14365,14 @@ async function addPhase(id, name, options2) {
|
|
|
14340
14365
|
);
|
|
14341
14366
|
const verb = options2.position !== void 0 ? "Inserted" : "Added";
|
|
14342
14367
|
console.log(
|
|
14343
|
-
|
|
14368
|
+
chalk80.green(
|
|
14344
14369
|
`${verb} phase ${phaseIdx + 1} "${name}" to item ${formatItemId(itemId2)} with ${tasks.length} task(s).`
|
|
14345
14370
|
)
|
|
14346
14371
|
);
|
|
14347
14372
|
}
|
|
14348
14373
|
|
|
14349
14374
|
// src/commands/backlog/list/index.ts
|
|
14350
|
-
import
|
|
14375
|
+
import chalk81 from "chalk";
|
|
14351
14376
|
function filterItems(items2, options2) {
|
|
14352
14377
|
if (options2.status) return items2.filter((i) => i.status === options2.status);
|
|
14353
14378
|
if (!options2.all)
|
|
@@ -14361,19 +14386,19 @@ function repoPrefixer(items2, allRepos) {
|
|
|
14361
14386
|
);
|
|
14362
14387
|
const repoNameOf = (item) => item.origin ? labels.get(item.origin) ?? "" : "";
|
|
14363
14388
|
const width = Math.max(0, ...items2.map((i) => repoNameOf(i).length));
|
|
14364
|
-
return (item) => `${
|
|
14389
|
+
return (item) => `${chalk81.dim(repoNameOf(item).padEnd(width))} `;
|
|
14365
14390
|
}
|
|
14366
14391
|
async function list2(options2) {
|
|
14367
14392
|
const allItems = await loadBacklog(options2.allRepos);
|
|
14368
14393
|
const items2 = filterItems(allItems, options2);
|
|
14369
14394
|
if (items2.length === 0) {
|
|
14370
|
-
console.log(
|
|
14395
|
+
console.log(chalk81.dim("Backlog is empty."));
|
|
14371
14396
|
return;
|
|
14372
14397
|
}
|
|
14373
14398
|
const prefixOf = repoPrefixer(items2, !!options2.allRepos);
|
|
14374
14399
|
for (const item of items2) {
|
|
14375
14400
|
console.log(
|
|
14376
|
-
`${prefixOf(item)}${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
14401
|
+
`${prefixOf(item)}${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk81.dim(formatItemId(item.id))} ${starMarker(item)}${item.name}${phaseLabel(item)}${dependencyLabel(item, allItems)}`
|
|
14377
14402
|
);
|
|
14378
14403
|
if (options2.verbose) {
|
|
14379
14404
|
printVerboseDetails(item);
|
|
@@ -14382,13 +14407,13 @@ async function list2(options2) {
|
|
|
14382
14407
|
}
|
|
14383
14408
|
|
|
14384
14409
|
// src/commands/backlog/propose/index.ts
|
|
14385
|
-
import
|
|
14410
|
+
import chalk84 from "chalk";
|
|
14386
14411
|
|
|
14387
14412
|
// src/commands/backlog/readJsonPayload.ts
|
|
14388
14413
|
import { readFileSync as readFileSync24 } from "fs";
|
|
14389
|
-
import
|
|
14414
|
+
import chalk82 from "chalk";
|
|
14390
14415
|
function fail3(message3) {
|
|
14391
|
-
console.error(
|
|
14416
|
+
console.error(chalk82.red(message3));
|
|
14392
14417
|
process.exit(1);
|
|
14393
14418
|
}
|
|
14394
14419
|
function describe(error) {
|
|
@@ -14443,7 +14468,7 @@ function readProposedItem(source) {
|
|
|
14443
14468
|
|
|
14444
14469
|
// src/commands/backlog/propose/reviewProposal.ts
|
|
14445
14470
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
14446
|
-
import
|
|
14471
|
+
import chalk83 from "chalk";
|
|
14447
14472
|
|
|
14448
14473
|
// src/commands/backlog/propose/renderProposedItem.ts
|
|
14449
14474
|
function renderProposedItem(item) {
|
|
@@ -14475,11 +14500,11 @@ async function reviewProposal(item, sessionId, confirmed) {
|
|
|
14475
14500
|
return true;
|
|
14476
14501
|
}
|
|
14477
14502
|
if (isClaudeCode() && confirmed) return true;
|
|
14478
|
-
console.log(
|
|
14503
|
+
console.log(chalk83.bold(item.name));
|
|
14479
14504
|
console.log(renderMarkdownTerminal(body));
|
|
14480
14505
|
if (!isClaudeCode()) return true;
|
|
14481
14506
|
console.log(
|
|
14482
|
-
|
|
14507
|
+
chalk83.yellow(
|
|
14483
14508
|
"Draft only \u2014 nothing was written to the backlog. Show this draft in the chat, apply any changes the user asks for, then re-run 'assist backlog propose --json <file|->' with --confirmed to create the item."
|
|
14484
14509
|
)
|
|
14485
14510
|
);
|
|
@@ -14492,7 +14517,7 @@ async function propose(options2) {
|
|
|
14492
14517
|
const sessionId = process.env.ASSIST_SESSION === "1" ? process.env.ASSIST_SESSION_ID : void 0;
|
|
14493
14518
|
if (sessionId && options2.confirmed) {
|
|
14494
14519
|
console.error(
|
|
14495
|
-
|
|
14520
|
+
chalk84.red(
|
|
14496
14521
|
"Error: --confirmed cannot be used in a web session. The preview pane is the gate \u2014 run 'assist backlog propose --json <file|->' without --confirmed and the item is created on approval."
|
|
14497
14522
|
)
|
|
14498
14523
|
);
|
|
@@ -14503,7 +14528,7 @@ async function propose(options2) {
|
|
|
14503
14528
|
if (!await reviewProposal(item, sessionId, options2.confirmed === true))
|
|
14504
14529
|
return;
|
|
14505
14530
|
const id = await createItemWithDefaults(item);
|
|
14506
|
-
console.log(
|
|
14531
|
+
console.log(chalk84.green(`Added item ${formatItemId(id)}: ${item.name}`));
|
|
14507
14532
|
}
|
|
14508
14533
|
|
|
14509
14534
|
// src/commands/backlog/registerItemCommands.ts
|
|
@@ -14535,7 +14560,7 @@ function registerItemCommands(cmd) {
|
|
|
14535
14560
|
}
|
|
14536
14561
|
|
|
14537
14562
|
// src/commands/backlog/link.ts
|
|
14538
|
-
import
|
|
14563
|
+
import chalk86 from "chalk";
|
|
14539
14564
|
|
|
14540
14565
|
// src/commands/backlog/hasCycle.ts
|
|
14541
14566
|
function hasCycle(adjacency, fromId, toId) {
|
|
@@ -14567,14 +14592,14 @@ async function loadDependencyGraph(orm) {
|
|
|
14567
14592
|
}
|
|
14568
14593
|
|
|
14569
14594
|
// src/commands/backlog/validateLinkTarget.ts
|
|
14570
|
-
import
|
|
14595
|
+
import chalk85 from "chalk";
|
|
14571
14596
|
function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
14572
14597
|
const duplicate = (fromItem.links ?? []).some(
|
|
14573
14598
|
(l) => l.targetId === toNum && l.type === linkType
|
|
14574
14599
|
);
|
|
14575
14600
|
if (duplicate) {
|
|
14576
14601
|
console.log(
|
|
14577
|
-
|
|
14602
|
+
chalk85.yellow(
|
|
14578
14603
|
`Link already exists: ${formatItemId(fromNum)} ${linkType} ${formatItemId(toNum)}`
|
|
14579
14604
|
)
|
|
14580
14605
|
);
|
|
@@ -14585,7 +14610,7 @@ function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
|
14585
14610
|
|
|
14586
14611
|
// src/commands/backlog/link.ts
|
|
14587
14612
|
function fail4(message3) {
|
|
14588
|
-
console.log(
|
|
14613
|
+
console.log(chalk86.red(message3));
|
|
14589
14614
|
return void 0;
|
|
14590
14615
|
}
|
|
14591
14616
|
function parseLinkType(type) {
|
|
@@ -14618,11 +14643,11 @@ async function link(fromId, toId, opts) {
|
|
|
14618
14643
|
if (!validateLinkTarget(fromItem, fromNum, toNum, linkType)) return;
|
|
14619
14644
|
if (await createsCycle(orm, linkType, fromNum, toNum)) return;
|
|
14620
14645
|
await orm.insert(links).values({ itemId: fromNum, type: linkType, targetId: toNum });
|
|
14621
|
-
console.log(
|
|
14646
|
+
console.log(chalk86.green(`Linked ${from} ${linkType} ${to} (${toItem.name})`));
|
|
14622
14647
|
}
|
|
14623
14648
|
|
|
14624
14649
|
// src/commands/backlog/unlink.ts
|
|
14625
|
-
import
|
|
14650
|
+
import chalk87 from "chalk";
|
|
14626
14651
|
import { and as and10, eq as eq27 } from "drizzle-orm";
|
|
14627
14652
|
async function unlink(fromId, toId) {
|
|
14628
14653
|
const fromNum = parseItemId(fromId);
|
|
@@ -14630,18 +14655,18 @@ async function unlink(fromId, toId) {
|
|
|
14630
14655
|
const { orm } = await getReady();
|
|
14631
14656
|
const fromItem = await loadItem(orm, fromNum);
|
|
14632
14657
|
if (!fromItem) {
|
|
14633
|
-
console.log(
|
|
14658
|
+
console.log(chalk87.red(`Item ${formatItemId(fromNum)} not found.`));
|
|
14634
14659
|
return;
|
|
14635
14660
|
}
|
|
14636
14661
|
if (!fromItem.links || fromItem.links.length === 0) {
|
|
14637
14662
|
console.log(
|
|
14638
|
-
|
|
14663
|
+
chalk87.yellow(`No links found on item ${formatItemId(fromNum)}.`)
|
|
14639
14664
|
);
|
|
14640
14665
|
return;
|
|
14641
14666
|
}
|
|
14642
14667
|
if (!fromItem.links.some((l) => l.targetId === toNum)) {
|
|
14643
14668
|
console.log(
|
|
14644
|
-
|
|
14669
|
+
chalk87.yellow(
|
|
14645
14670
|
`No link from ${formatItemId(fromNum)} to ${formatItemId(toNum)} found.`
|
|
14646
14671
|
)
|
|
14647
14672
|
);
|
|
@@ -14649,7 +14674,7 @@ async function unlink(fromId, toId) {
|
|
|
14649
14674
|
}
|
|
14650
14675
|
await orm.delete(links).where(and10(eq27(links.itemId, fromNum), eq27(links.targetId, toNum)));
|
|
14651
14676
|
console.log(
|
|
14652
|
-
|
|
14677
|
+
chalk87.green(
|
|
14653
14678
|
`Removed link from ${formatItemId(fromNum)} to ${formatItemId(toNum)}.`
|
|
14654
14679
|
)
|
|
14655
14680
|
);
|
|
@@ -14666,17 +14691,17 @@ function registerLinkCommands(cmd) {
|
|
|
14666
14691
|
}
|
|
14667
14692
|
|
|
14668
14693
|
// src/commands/backlog/move-repo/index.ts
|
|
14669
|
-
import
|
|
14694
|
+
import chalk89 from "chalk";
|
|
14670
14695
|
import { eq as eq29 } from "drizzle-orm";
|
|
14671
14696
|
|
|
14672
14697
|
// src/commands/backlog/move-repo/confirmMove.ts
|
|
14673
|
-
import
|
|
14698
|
+
import chalk88 from "chalk";
|
|
14674
14699
|
function pluralItems(n) {
|
|
14675
14700
|
return `${n} item${n === 1 ? "" : "s"}`;
|
|
14676
14701
|
}
|
|
14677
14702
|
async function confirmMove(cnt, oldOrigin, newOrigin) {
|
|
14678
14703
|
console.log(
|
|
14679
|
-
`${pluralItems(cnt)}: ${
|
|
14704
|
+
`${pluralItems(cnt)}: ${chalk88.cyan(oldOrigin)} \u2192 ${chalk88.cyan(newOrigin)}`
|
|
14680
14705
|
);
|
|
14681
14706
|
return promptConfirm(`Retag ${pluralItems(cnt)}?`);
|
|
14682
14707
|
}
|
|
@@ -14708,7 +14733,7 @@ Pass the full origin.`
|
|
|
14708
14733
|
|
|
14709
14734
|
// src/commands/backlog/move-repo/index.ts
|
|
14710
14735
|
function fail5(message3) {
|
|
14711
|
-
console.log(
|
|
14736
|
+
console.log(chalk89.red(message3));
|
|
14712
14737
|
process.exitCode = 1;
|
|
14713
14738
|
}
|
|
14714
14739
|
async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
@@ -14724,12 +14749,12 @@ async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
|
14724
14749
|
}
|
|
14725
14750
|
const cnt = await countByOrigin(orm, oldOrigin);
|
|
14726
14751
|
if (!options2.yes && !await confirmMove(cnt, oldOrigin, newOrigin)) {
|
|
14727
|
-
console.log(
|
|
14752
|
+
console.log(chalk89.yellow("Move cancelled; no changes made."));
|
|
14728
14753
|
return;
|
|
14729
14754
|
}
|
|
14730
14755
|
await orm.update(items).set({ origin: newOrigin }).where(eq29(items.origin, oldOrigin));
|
|
14731
14756
|
console.log(
|
|
14732
|
-
|
|
14757
|
+
chalk89.green(
|
|
14733
14758
|
`Moved ${pluralItems(cnt)} from "${oldOrigin}" to "${newOrigin}".`
|
|
14734
14759
|
)
|
|
14735
14760
|
);
|
|
@@ -14758,14 +14783,14 @@ function registerPlanCommands(cmd) {
|
|
|
14758
14783
|
}
|
|
14759
14784
|
|
|
14760
14785
|
// src/commands/backlog/refine.ts
|
|
14761
|
-
import
|
|
14786
|
+
import chalk92 from "chalk";
|
|
14762
14787
|
import enquirer7 from "enquirer";
|
|
14763
14788
|
|
|
14764
14789
|
// src/commands/backlog/launchMode.ts
|
|
14765
14790
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
14766
14791
|
|
|
14767
14792
|
// src/commands/backlog/handleLaunchSignal.ts
|
|
14768
|
-
import
|
|
14793
|
+
import chalk91 from "chalk";
|
|
14769
14794
|
|
|
14770
14795
|
// src/commands/backlog/surfaceCreatedItem.ts
|
|
14771
14796
|
async function surfaceCreatedItem(slashCommand, id) {
|
|
@@ -14788,32 +14813,32 @@ async function surfaceCreatedItem(slashCommand, id) {
|
|
|
14788
14813
|
}
|
|
14789
14814
|
|
|
14790
14815
|
// src/commands/backlog/tryRunById.ts
|
|
14791
|
-
import
|
|
14816
|
+
import chalk90 from "chalk";
|
|
14792
14817
|
async function tryRunById(id, options2) {
|
|
14793
14818
|
const numericId = parseItemId(id);
|
|
14794
14819
|
const label2 = formatItemId(numericId);
|
|
14795
14820
|
const { orm } = await getReady();
|
|
14796
14821
|
const item = await loadItem(orm, numericId);
|
|
14797
14822
|
if (!item) {
|
|
14798
|
-
console.log(
|
|
14823
|
+
console.log(chalk90.red(`Item ${label2} not found.`));
|
|
14799
14824
|
return false;
|
|
14800
14825
|
}
|
|
14801
14826
|
if (item.status === "done") {
|
|
14802
|
-
console.log(
|
|
14827
|
+
console.log(chalk90.red(`Item ${label2} is already done.`));
|
|
14803
14828
|
return false;
|
|
14804
14829
|
}
|
|
14805
14830
|
if (item.status === "wontdo") {
|
|
14806
|
-
console.log(
|
|
14831
|
+
console.log(chalk90.red(`Item ${label2} is marked won't do.`));
|
|
14807
14832
|
return false;
|
|
14808
14833
|
}
|
|
14809
14834
|
const hasDeps = (item.links ?? []).some((l) => l.type === "depends-on");
|
|
14810
14835
|
if (hasDeps && isBlocked(item, await loadItemSummaries(orm, getOrigin()))) {
|
|
14811
14836
|
console.log(
|
|
14812
|
-
|
|
14837
|
+
chalk90.red(`Item ${label2} is blocked by unresolved dependencies.`)
|
|
14813
14838
|
);
|
|
14814
14839
|
return false;
|
|
14815
14840
|
}
|
|
14816
|
-
console.log(
|
|
14841
|
+
console.log(chalk90.bold(`
|
|
14817
14842
|
Running backlog item ${label2}...
|
|
14818
14843
|
`));
|
|
14819
14844
|
await run2(id, options2);
|
|
@@ -14832,13 +14857,13 @@ async function handleLaunchSignal(slashCommand, once) {
|
|
|
14832
14857
|
if (typeof signal.id === "string" && signal.id) {
|
|
14833
14858
|
if (await tryRunById(signal.id, { allowEdits: true })) return;
|
|
14834
14859
|
}
|
|
14835
|
-
console.log(
|
|
14860
|
+
console.log(chalk91.bold("\nChaining into assist next...\n"));
|
|
14836
14861
|
await next({ allowEdits: true, once });
|
|
14837
14862
|
}
|
|
14838
14863
|
} catch (error) {
|
|
14839
14864
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
14840
14865
|
console.error(
|
|
14841
|
-
|
|
14866
|
+
chalk91.yellow(
|
|
14842
14867
|
`
|
|
14843
14868
|
Could not complete post-run step (${message3}).
|
|
14844
14869
|
This is usually a transient database/network blip \u2014 the work is saved and the session is safe to resume.`
|
|
@@ -14891,13 +14916,13 @@ async function pickItemForRefine() {
|
|
|
14891
14916
|
(i) => i.status === "todo" || i.status === "in-progress"
|
|
14892
14917
|
);
|
|
14893
14918
|
if (active.length === 0) {
|
|
14894
|
-
console.log(
|
|
14919
|
+
console.log(chalk92.yellow("No active backlog items to refine."));
|
|
14895
14920
|
return void 0;
|
|
14896
14921
|
}
|
|
14897
14922
|
if (active.length === 1) {
|
|
14898
14923
|
const item = active[0];
|
|
14899
14924
|
console.log(
|
|
14900
|
-
|
|
14925
|
+
chalk92.bold(`Auto-selecting item ${formatItemId(item.id)}: ${item.name}`)
|
|
14901
14926
|
);
|
|
14902
14927
|
return formatItemId(item.id);
|
|
14903
14928
|
}
|
|
@@ -14945,7 +14970,7 @@ function registerRefineCommand(cmd) {
|
|
|
14945
14970
|
}
|
|
14946
14971
|
|
|
14947
14972
|
// src/commands/backlog/rewindPhase.ts
|
|
14948
|
-
import
|
|
14973
|
+
import chalk93 from "chalk";
|
|
14949
14974
|
async function rewindPhase(id, phase, opts) {
|
|
14950
14975
|
const phaseNumber = Number.parseInt(phase, 10);
|
|
14951
14976
|
const found = await findOneItem(id);
|
|
@@ -14953,12 +14978,12 @@ async function rewindPhase(id, phase, opts) {
|
|
|
14953
14978
|
const { orm, item } = found;
|
|
14954
14979
|
const result = await rewindItemToPhase(orm, item, phaseNumber, opts.reason);
|
|
14955
14980
|
if (!result.ok) {
|
|
14956
|
-
console.log(
|
|
14981
|
+
console.log(chalk93.red(result.error));
|
|
14957
14982
|
process.exitCode = 1;
|
|
14958
14983
|
return;
|
|
14959
14984
|
}
|
|
14960
14985
|
console.log(
|
|
14961
|
-
|
|
14986
|
+
chalk93.green(
|
|
14962
14987
|
`Rewound item ${formatItemId(item.id)} to phase ${phaseNumber} (${result.phaseName}).`
|
|
14963
14988
|
)
|
|
14964
14989
|
);
|
|
@@ -14990,22 +15015,22 @@ function registerRunCommand(cmd) {
|
|
|
14990
15015
|
}
|
|
14991
15016
|
|
|
14992
15017
|
// src/commands/backlog/search/index.ts
|
|
14993
|
-
import
|
|
15018
|
+
import chalk94 from "chalk";
|
|
14994
15019
|
async function search(query) {
|
|
14995
15020
|
const items2 = await searchBacklog(query);
|
|
14996
15021
|
if (items2.length === 0) {
|
|
14997
|
-
console.log(
|
|
15022
|
+
console.log(chalk94.dim(`No items matching "${query}".`));
|
|
14998
15023
|
return;
|
|
14999
15024
|
}
|
|
15000
15025
|
console.log(
|
|
15001
|
-
|
|
15026
|
+
chalk94.dim(
|
|
15002
15027
|
`${items2.length} item${items2.length === 1 ? "" : "s"} matching "${query}":
|
|
15003
15028
|
`
|
|
15004
15029
|
)
|
|
15005
15030
|
);
|
|
15006
15031
|
for (const item of items2) {
|
|
15007
15032
|
console.log(
|
|
15008
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
15033
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk94.dim(formatItemId(item.id))} ${item.name}`
|
|
15009
15034
|
);
|
|
15010
15035
|
}
|
|
15011
15036
|
}
|
|
@@ -15016,18 +15041,18 @@ function registerSearchCommand(cmd) {
|
|
|
15016
15041
|
}
|
|
15017
15042
|
|
|
15018
15043
|
// src/commands/backlog/delete/index.ts
|
|
15019
|
-
import
|
|
15044
|
+
import chalk95 from "chalk";
|
|
15020
15045
|
async function del(id) {
|
|
15021
15046
|
const name = await removeItem(id);
|
|
15022
15047
|
if (name) {
|
|
15023
15048
|
console.log(
|
|
15024
|
-
|
|
15049
|
+
chalk95.green(`Deleted item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
15025
15050
|
);
|
|
15026
15051
|
}
|
|
15027
15052
|
}
|
|
15028
15053
|
|
|
15029
15054
|
// src/commands/backlog/done/index.ts
|
|
15030
|
-
import
|
|
15055
|
+
import chalk96 from "chalk";
|
|
15031
15056
|
async function done(id, summary) {
|
|
15032
15057
|
const found = await findOneItem(id);
|
|
15033
15058
|
if (!found) return;
|
|
@@ -15041,12 +15066,12 @@ async function done(id, summary) {
|
|
|
15041
15066
|
const pending = item.plan.slice(completedCount);
|
|
15042
15067
|
if (pending.length > 0) {
|
|
15043
15068
|
console.log(
|
|
15044
|
-
|
|
15069
|
+
chalk96.red(
|
|
15045
15070
|
`Cannot complete item ${formatItemId(item.id)}: ${pending.length} pending phase(s):`
|
|
15046
15071
|
)
|
|
15047
15072
|
);
|
|
15048
15073
|
for (const phase of pending) {
|
|
15049
|
-
console.log(
|
|
15074
|
+
console.log(chalk96.yellow(` - ${phase.name}`));
|
|
15050
15075
|
}
|
|
15051
15076
|
process.exitCode = 1;
|
|
15052
15077
|
return;
|
|
@@ -15058,12 +15083,12 @@ async function done(id, summary) {
|
|
|
15058
15083
|
await appendComment(orm, item.id, summary, { phase, type: "summary" });
|
|
15059
15084
|
}
|
|
15060
15085
|
console.log(
|
|
15061
|
-
|
|
15086
|
+
chalk96.green(`Completed item ${formatItemId(item.id)}: ${item.name}`)
|
|
15062
15087
|
);
|
|
15063
15088
|
}
|
|
15064
15089
|
|
|
15065
15090
|
// src/commands/backlog/set-status/index.ts
|
|
15066
|
-
import
|
|
15091
|
+
import chalk97 from "chalk";
|
|
15067
15092
|
var allowedStatuses = [
|
|
15068
15093
|
"todo",
|
|
15069
15094
|
"in-progress",
|
|
@@ -15073,7 +15098,7 @@ var allowedStatuses = [
|
|
|
15073
15098
|
async function setStatusCommand(id, status3) {
|
|
15074
15099
|
if (!allowedStatuses.includes(status3)) {
|
|
15075
15100
|
console.log(
|
|
15076
|
-
|
|
15101
|
+
chalk97.red(
|
|
15077
15102
|
`Invalid status "${status3}". Must be one of: ${allowedStatuses.join(", ")}.`
|
|
15078
15103
|
)
|
|
15079
15104
|
);
|
|
@@ -15083,7 +15108,7 @@ async function setStatusCommand(id, status3) {
|
|
|
15083
15108
|
const name = await setStatus(id, status3);
|
|
15084
15109
|
if (name) {
|
|
15085
15110
|
console.log(
|
|
15086
|
-
|
|
15111
|
+
chalk97.green(
|
|
15087
15112
|
`Set item ${formatItemId(parseItemId(id))} to ${status3}: ${name}`
|
|
15088
15113
|
)
|
|
15089
15114
|
);
|
|
@@ -15091,16 +15116,16 @@ async function setStatusCommand(id, status3) {
|
|
|
15091
15116
|
}
|
|
15092
15117
|
|
|
15093
15118
|
// src/commands/backlog/star/index.ts
|
|
15094
|
-
import
|
|
15119
|
+
import chalk99 from "chalk";
|
|
15095
15120
|
|
|
15096
15121
|
// src/commands/backlog/setStarred.ts
|
|
15097
|
-
import
|
|
15122
|
+
import chalk98 from "chalk";
|
|
15098
15123
|
async function setStarred(id, starred) {
|
|
15099
15124
|
const { orm } = await getReady();
|
|
15100
15125
|
const numId = parseItemId(id);
|
|
15101
15126
|
const name = await updateStarred(orm, numId, starred);
|
|
15102
15127
|
if (name === void 0)
|
|
15103
|
-
console.log(
|
|
15128
|
+
console.log(chalk98.red(`Item ${formatItemId(numId)} not found.`));
|
|
15104
15129
|
return name;
|
|
15105
15130
|
}
|
|
15106
15131
|
|
|
@@ -15109,52 +15134,52 @@ async function star(id) {
|
|
|
15109
15134
|
const name = await setStarred(id, true);
|
|
15110
15135
|
if (name) {
|
|
15111
15136
|
console.log(
|
|
15112
|
-
|
|
15137
|
+
chalk99.green(`Starred item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
15113
15138
|
);
|
|
15114
15139
|
}
|
|
15115
15140
|
}
|
|
15116
15141
|
|
|
15117
15142
|
// src/commands/backlog/start/index.ts
|
|
15118
|
-
import
|
|
15143
|
+
import chalk100 from "chalk";
|
|
15119
15144
|
async function start(id) {
|
|
15120
15145
|
const name = await setStatus(id, "in-progress");
|
|
15121
15146
|
if (name) {
|
|
15122
15147
|
console.log(
|
|
15123
|
-
|
|
15148
|
+
chalk100.green(`Started item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
15124
15149
|
);
|
|
15125
15150
|
}
|
|
15126
15151
|
}
|
|
15127
15152
|
|
|
15128
15153
|
// src/commands/backlog/stop/index.ts
|
|
15129
|
-
import
|
|
15154
|
+
import chalk101 from "chalk";
|
|
15130
15155
|
import { and as and11, eq as eq30 } from "drizzle-orm";
|
|
15131
15156
|
async function stop() {
|
|
15132
15157
|
const { orm } = await getReady();
|
|
15133
15158
|
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 });
|
|
15134
15159
|
if (stopped.length === 0) {
|
|
15135
|
-
console.log(
|
|
15160
|
+
console.log(chalk101.yellow("No in-progress items to stop."));
|
|
15136
15161
|
return;
|
|
15137
15162
|
}
|
|
15138
15163
|
for (const item of stopped) {
|
|
15139
15164
|
console.log(
|
|
15140
|
-
|
|
15165
|
+
chalk101.yellow(`Stopped item ${formatItemId(item.id)}: ${item.name}`)
|
|
15141
15166
|
);
|
|
15142
15167
|
}
|
|
15143
15168
|
}
|
|
15144
15169
|
|
|
15145
15170
|
// src/commands/backlog/unstar/index.ts
|
|
15146
|
-
import
|
|
15171
|
+
import chalk102 from "chalk";
|
|
15147
15172
|
async function unstar(id) {
|
|
15148
15173
|
const name = await setStarred(id, false);
|
|
15149
15174
|
if (name) {
|
|
15150
15175
|
console.log(
|
|
15151
|
-
|
|
15176
|
+
chalk102.green(`Unstarred item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
15152
15177
|
);
|
|
15153
15178
|
}
|
|
15154
15179
|
}
|
|
15155
15180
|
|
|
15156
15181
|
// src/commands/backlog/wontdo/index.ts
|
|
15157
|
-
import
|
|
15182
|
+
import chalk103 from "chalk";
|
|
15158
15183
|
async function wontdo(id, reason4) {
|
|
15159
15184
|
const found = await findOneItem(id);
|
|
15160
15185
|
if (!found) return;
|
|
@@ -15165,7 +15190,7 @@ async function wontdo(id, reason4) {
|
|
|
15165
15190
|
await appendComment(orm, item.id, reason4, { phase, type: "summary" });
|
|
15166
15191
|
}
|
|
15167
15192
|
console.log(
|
|
15168
|
-
|
|
15193
|
+
chalk103.red(`Won't do item ${formatItemId(item.id)}: ${item.name}`)
|
|
15169
15194
|
);
|
|
15170
15195
|
}
|
|
15171
15196
|
|
|
@@ -15184,17 +15209,17 @@ function registerStatusCommands(cmd) {
|
|
|
15184
15209
|
}
|
|
15185
15210
|
|
|
15186
15211
|
// src/commands/backlog/addSubtask.ts
|
|
15187
|
-
import
|
|
15212
|
+
import chalk104 from "chalk";
|
|
15188
15213
|
async function addSubtask(id, options2) {
|
|
15189
15214
|
const title = options2.title?.trim();
|
|
15190
15215
|
if (!title) {
|
|
15191
|
-
console.log(
|
|
15216
|
+
console.log(chalk104.red("A sub-task title is required (--title)."));
|
|
15192
15217
|
process.exitCode = 1;
|
|
15193
15218
|
return;
|
|
15194
15219
|
}
|
|
15195
15220
|
if (title.length > 50) {
|
|
15196
15221
|
console.log(
|
|
15197
|
-
|
|
15222
|
+
chalk104.red(
|
|
15198
15223
|
"A sub-task title must be 50 characters or fewer. Use --desc for longer detail."
|
|
15199
15224
|
)
|
|
15200
15225
|
);
|
|
@@ -15210,21 +15235,21 @@ async function addSubtask(id, options2) {
|
|
|
15210
15235
|
const description = options2.desc?.replaceAll(String.raw`\n`, "\n");
|
|
15211
15236
|
await insertSubtask(orm, item.id, title, description);
|
|
15212
15237
|
console.log(
|
|
15213
|
-
|
|
15238
|
+
chalk104.green(`Added sub-task to item ${formatItemId(item.id)}: ${title}`)
|
|
15214
15239
|
);
|
|
15215
15240
|
}
|
|
15216
15241
|
|
|
15217
15242
|
// src/commands/backlog/editSubtask.ts
|
|
15218
|
-
import
|
|
15243
|
+
import chalk106 from "chalk";
|
|
15219
15244
|
|
|
15220
15245
|
// src/commands/backlog/resolveSubtaskIndex.ts
|
|
15221
|
-
import
|
|
15246
|
+
import chalk105 from "chalk";
|
|
15222
15247
|
function resolveSubtaskIndex(index3, item) {
|
|
15223
15248
|
const position = Number.parseInt(index3, 10);
|
|
15224
15249
|
const subtasks = item.subtasks ?? [];
|
|
15225
15250
|
if (Number.isNaN(position) || position < 1 || position > subtasks.length) {
|
|
15226
15251
|
console.log(
|
|
15227
|
-
|
|
15252
|
+
chalk105.red(
|
|
15228
15253
|
`Item ${formatItemId(item.id)} has no sub-task ${index3}${subtasks.length > 0 ? ` (1-${subtasks.length})` : ""}.`
|
|
15229
15254
|
)
|
|
15230
15255
|
);
|
|
@@ -15291,21 +15316,21 @@ async function editSubtask(id, index3, options2) {
|
|
|
15291
15316
|
if (!found) return;
|
|
15292
15317
|
const fields = buildUpdate(options2);
|
|
15293
15318
|
if (typeof fields === "string") {
|
|
15294
|
-
console.log(
|
|
15319
|
+
console.log(chalk106.red(fields));
|
|
15295
15320
|
process.exitCode = 1;
|
|
15296
15321
|
return;
|
|
15297
15322
|
}
|
|
15298
15323
|
const { orm, item, idx } = found;
|
|
15299
15324
|
const title = await updateSubtask(orm, item.id, idx, fields);
|
|
15300
15325
|
console.log(
|
|
15301
|
-
|
|
15326
|
+
chalk106.green(
|
|
15302
15327
|
`Updated sub-task ${idx + 1} of item ${formatItemId(item.id)}: ${title}`
|
|
15303
15328
|
)
|
|
15304
15329
|
);
|
|
15305
15330
|
}
|
|
15306
15331
|
|
|
15307
15332
|
// src/commands/backlog/removeSubtask.ts
|
|
15308
|
-
import
|
|
15333
|
+
import chalk107 from "chalk";
|
|
15309
15334
|
|
|
15310
15335
|
// src/commands/backlog/deleteSubtask.ts
|
|
15311
15336
|
import { and as and13, asc as asc8, eq as eq32 } from "drizzle-orm";
|
|
@@ -15330,18 +15355,18 @@ async function removeSubtask(id, index3) {
|
|
|
15330
15355
|
const { orm, item, idx } = found;
|
|
15331
15356
|
const title = await deleteSubtask(orm, item.id, idx);
|
|
15332
15357
|
console.log(
|
|
15333
|
-
|
|
15358
|
+
chalk107.green(
|
|
15334
15359
|
`Removed sub-task ${idx + 1} of item ${formatItemId(item.id)}: ${title}`
|
|
15335
15360
|
)
|
|
15336
15361
|
);
|
|
15337
15362
|
}
|
|
15338
15363
|
|
|
15339
15364
|
// src/commands/backlog/subtaskStatus.ts
|
|
15340
|
-
import
|
|
15365
|
+
import chalk108 from "chalk";
|
|
15341
15366
|
async function subtaskStatus(id, index3, status3) {
|
|
15342
15367
|
if (!validSubtaskStatuses.includes(status3)) {
|
|
15343
15368
|
console.log(
|
|
15344
|
-
|
|
15369
|
+
chalk108.red(
|
|
15345
15370
|
`Invalid status "${status3}". Use one of: ${validSubtaskStatuses.join(", ")}.`
|
|
15346
15371
|
)
|
|
15347
15372
|
);
|
|
@@ -15358,7 +15383,7 @@ async function subtaskStatus(id, index3, status3) {
|
|
|
15358
15383
|
status3
|
|
15359
15384
|
);
|
|
15360
15385
|
console.log(
|
|
15361
|
-
|
|
15386
|
+
chalk108.green(
|
|
15362
15387
|
`Set sub-task ${idx + 1} of item ${formatItemId(item.id)} to ${status3}: ${title}`
|
|
15363
15388
|
)
|
|
15364
15389
|
);
|
|
@@ -15385,7 +15410,7 @@ function registerSubtaskCommands(cmd) {
|
|
|
15385
15410
|
}
|
|
15386
15411
|
|
|
15387
15412
|
// src/commands/backlog/movePhase.ts
|
|
15388
|
-
import
|
|
15413
|
+
import chalk109 from "chalk";
|
|
15389
15414
|
import { count as count6, eq as eq35 } from "drizzle-orm";
|
|
15390
15415
|
|
|
15391
15416
|
// src/commands/backlog/reorderPhaseRows.ts
|
|
@@ -15451,7 +15476,7 @@ function toIndex2(value, phaseCount) {
|
|
|
15451
15476
|
const pos = Number.parseInt(value, 10);
|
|
15452
15477
|
if (Number.isNaN(pos) || pos < 1 || pos > phaseCount) {
|
|
15453
15478
|
console.log(
|
|
15454
|
-
|
|
15479
|
+
chalk109.red(
|
|
15455
15480
|
`Position "${value}" is out of range. Must be between 1 and ${phaseCount}.`
|
|
15456
15481
|
)
|
|
15457
15482
|
);
|
|
@@ -15474,11 +15499,11 @@ async function movePhase(id, from, to) {
|
|
|
15474
15499
|
if (fromIdx !== toIdx) {
|
|
15475
15500
|
await reorderPhaseRows(orm, itemId2, fromIdx, toIdx);
|
|
15476
15501
|
}
|
|
15477
|
-
console.log(
|
|
15502
|
+
console.log(chalk109.green(`Moved phase ${from} to position ${to}.`));
|
|
15478
15503
|
}
|
|
15479
15504
|
|
|
15480
15505
|
// src/commands/backlog/updatePhase.ts
|
|
15481
|
-
import
|
|
15506
|
+
import chalk111 from "chalk";
|
|
15482
15507
|
|
|
15483
15508
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
15484
15509
|
import { and as and16, eq as eq36 } from "drizzle-orm";
|
|
@@ -15513,7 +15538,7 @@ async function applyPhaseUpdate(orm, itemId2, phaseIdx, fields) {
|
|
|
15513
15538
|
}
|
|
15514
15539
|
|
|
15515
15540
|
// src/commands/backlog/findPhase.ts
|
|
15516
|
-
import
|
|
15541
|
+
import chalk110 from "chalk";
|
|
15517
15542
|
import { and as and17, count as count7, eq as eq37 } from "drizzle-orm";
|
|
15518
15543
|
async function findPhase(id, phase) {
|
|
15519
15544
|
const found = await findOneItem(id);
|
|
@@ -15524,7 +15549,7 @@ async function findPhase(id, phase) {
|
|
|
15524
15549
|
const [row] = await orm.select({ cnt: count7() }).from(planPhases).where(and17(eq37(planPhases.itemId, itemId2), eq37(planPhases.idx, phaseIdx)));
|
|
15525
15550
|
if (!row || row.cnt === 0) {
|
|
15526
15551
|
console.log(
|
|
15527
|
-
|
|
15552
|
+
chalk110.red(
|
|
15528
15553
|
`Phase ${phaseIdx + 1} not found on item ${formatItemId(itemId2)}.`
|
|
15529
15554
|
)
|
|
15530
15555
|
);
|
|
@@ -15658,7 +15683,7 @@ async function updatePhase(id, phase, options2) {
|
|
|
15658
15683
|
const { item, orm, itemId: itemId2, phaseIdx } = found;
|
|
15659
15684
|
const resolved = resolvePhaseFields(options2, item.plan?.[phaseIdx]);
|
|
15660
15685
|
if (!resolved.ok) {
|
|
15661
|
-
console.log(
|
|
15686
|
+
console.log(chalk111.red(resolved.error));
|
|
15662
15687
|
process.exitCode = 1;
|
|
15663
15688
|
return;
|
|
15664
15689
|
}
|
|
@@ -15670,7 +15695,7 @@ async function updatePhase(id, phase, options2) {
|
|
|
15670
15695
|
manualCheck && "manual checks"
|
|
15671
15696
|
].filter(Boolean).join(", ");
|
|
15672
15697
|
console.log(
|
|
15673
|
-
|
|
15698
|
+
chalk111.green(
|
|
15674
15699
|
`Updated ${fields} on phase ${phaseIdx + 1} of item ${formatItemId(itemId2)}.`
|
|
15675
15700
|
)
|
|
15676
15701
|
);
|
|
@@ -15693,7 +15718,7 @@ function registerUpdatePhaseCommand(cmd) {
|
|
|
15693
15718
|
}
|
|
15694
15719
|
|
|
15695
15720
|
// src/commands/backlog/removePhase.ts
|
|
15696
|
-
import
|
|
15721
|
+
import chalk112 from "chalk";
|
|
15697
15722
|
import { and as and18, eq as eq38 } from "drizzle-orm";
|
|
15698
15723
|
async function removePhase(id, phase) {
|
|
15699
15724
|
const found = await findPhase(id, phase);
|
|
@@ -15708,27 +15733,27 @@ async function removePhase(id, phase) {
|
|
|
15708
15733
|
await adjustCurrentPhase(tx, item, phaseIdx);
|
|
15709
15734
|
});
|
|
15710
15735
|
console.log(
|
|
15711
|
-
|
|
15736
|
+
chalk112.green(
|
|
15712
15737
|
`Removed phase ${phaseIdx + 1} from item ${formatItemId(itemId2)}.`
|
|
15713
15738
|
)
|
|
15714
15739
|
);
|
|
15715
15740
|
}
|
|
15716
15741
|
|
|
15717
15742
|
// src/commands/backlog/update/update.ts
|
|
15718
|
-
import
|
|
15743
|
+
import chalk116 from "chalk";
|
|
15719
15744
|
import { eq as eq39 } from "drizzle-orm";
|
|
15720
15745
|
|
|
15721
15746
|
// src/commands/backlog/update/buildUpdateValues.ts
|
|
15722
|
-
import
|
|
15747
|
+
import chalk113 from "chalk";
|
|
15723
15748
|
function buildUpdateValues(options2) {
|
|
15724
15749
|
const { name, desc: desc6, type, ac, origin } = options2;
|
|
15725
15750
|
if (!name && !desc6 && !type && !ac && !origin) {
|
|
15726
|
-
console.log(
|
|
15751
|
+
console.log(chalk113.red("Nothing to update. Provide at least one flag."));
|
|
15727
15752
|
process.exitCode = 1;
|
|
15728
15753
|
return void 0;
|
|
15729
15754
|
}
|
|
15730
15755
|
if (type && type !== "story" && type !== "bug") {
|
|
15731
|
-
console.log(
|
|
15756
|
+
console.log(chalk113.red('Invalid type. Must be "story" or "bug".'));
|
|
15732
15757
|
process.exitCode = 1;
|
|
15733
15758
|
return void 0;
|
|
15734
15759
|
}
|
|
@@ -15758,7 +15783,7 @@ function buildUpdateValues(options2) {
|
|
|
15758
15783
|
}
|
|
15759
15784
|
|
|
15760
15785
|
// src/commands/backlog/update/resolveAcUpdate.ts
|
|
15761
|
-
import
|
|
15786
|
+
import chalk114 from "chalk";
|
|
15762
15787
|
|
|
15763
15788
|
// src/commands/backlog/update/applyAcMutations.ts
|
|
15764
15789
|
function hasAcMutations(options2) {
|
|
@@ -15783,14 +15808,14 @@ function resolveAcUpdate(options2, currentCriteria) {
|
|
|
15783
15808
|
if (!hasAcMutations(options2)) return { ok: true, ac: options2.ac };
|
|
15784
15809
|
if (options2.ac) {
|
|
15785
15810
|
console.log(
|
|
15786
|
-
|
|
15811
|
+
chalk114.red("Cannot combine --ac with --add-ac/--edit-ac/--remove-ac.")
|
|
15787
15812
|
);
|
|
15788
15813
|
process.exitCode = 1;
|
|
15789
15814
|
return { ok: false };
|
|
15790
15815
|
}
|
|
15791
15816
|
const mutation = applyAcMutations(currentCriteria, options2);
|
|
15792
15817
|
if (!mutation.ok) {
|
|
15793
|
-
console.log(
|
|
15818
|
+
console.log(chalk114.red(mutation.error));
|
|
15794
15819
|
process.exitCode = 1;
|
|
15795
15820
|
return { ok: false };
|
|
15796
15821
|
}
|
|
@@ -15798,14 +15823,14 @@ function resolveAcUpdate(options2, currentCriteria) {
|
|
|
15798
15823
|
}
|
|
15799
15824
|
|
|
15800
15825
|
// src/commands/backlog/update/resolveOriginUpdate.ts
|
|
15801
|
-
import
|
|
15826
|
+
import chalk115 from "chalk";
|
|
15802
15827
|
function resolveOriginUpdate(optionOrigin, item) {
|
|
15803
15828
|
if (optionOrigin === void 0 || optionOrigin === false)
|
|
15804
15829
|
return { kind: "none" };
|
|
15805
15830
|
const origin = typeof optionOrigin === "string" ? normalizeOrigin(optionOrigin) : getOrigin();
|
|
15806
15831
|
if (origin === item.origin) {
|
|
15807
15832
|
console.log(
|
|
15808
|
-
|
|
15833
|
+
chalk115.yellow(
|
|
15809
15834
|
`Item ${formatItemId(item.id)} is already on origin "${origin}"; nothing to change.`
|
|
15810
15835
|
)
|
|
15811
15836
|
);
|
|
@@ -15829,12 +15854,12 @@ async function update(id, options2) {
|
|
|
15829
15854
|
const itemId2 = found.item.id;
|
|
15830
15855
|
await orm.update(items).set(built.set).where(eq39(items.id, itemId2));
|
|
15831
15856
|
console.log(
|
|
15832
|
-
|
|
15857
|
+
chalk116.green(`Updated ${built.fields} on item ${formatItemId(itemId2)}.`)
|
|
15833
15858
|
);
|
|
15834
15859
|
}
|
|
15835
15860
|
|
|
15836
15861
|
// src/commands/backlog/updatePlan/index.ts
|
|
15837
|
-
import
|
|
15862
|
+
import chalk118 from "chalk";
|
|
15838
15863
|
|
|
15839
15864
|
// src/commands/backlog/updatePlan/planUpdateSchema.ts
|
|
15840
15865
|
import { z as z7 } from "zod";
|
|
@@ -15884,7 +15909,7 @@ async function replacePlan(orm, itemId2, phases, currentPhase) {
|
|
|
15884
15909
|
|
|
15885
15910
|
// src/commands/backlog/updatePlan/reviewPlanUpdate.ts
|
|
15886
15911
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
15887
|
-
import
|
|
15912
|
+
import chalk117 from "chalk";
|
|
15888
15913
|
|
|
15889
15914
|
// src/commands/backlog/updatePlan/isCompleted.ts
|
|
15890
15915
|
function isCompleted(previousPosition, currentPhase) {
|
|
@@ -16049,7 +16074,7 @@ async function reviewPlanUpdate(item, phases) {
|
|
|
16049
16074
|
});
|
|
16050
16075
|
return;
|
|
16051
16076
|
}
|
|
16052
|
-
console.log(
|
|
16077
|
+
console.log(chalk117.bold(item.name));
|
|
16053
16078
|
console.log(renderMarkdownTerminal(body));
|
|
16054
16079
|
}
|
|
16055
16080
|
|
|
@@ -16062,7 +16087,7 @@ async function updatePlan(id, options2) {
|
|
|
16062
16087
|
await reviewPlanUpdate(item, phases);
|
|
16063
16088
|
await replacePlan(orm, item.id, phases, item.currentPhase);
|
|
16064
16089
|
console.log(
|
|
16065
|
-
|
|
16090
|
+
chalk118.green(
|
|
16066
16091
|
`Replaced the plan on item ${formatItemId(item.id)} with ${phases.length} phase${phases.length === 1 ? "" : "s"}.`
|
|
16067
16092
|
)
|
|
16068
16093
|
);
|
|
@@ -16993,11 +17018,11 @@ function assertCliExists(cli) {
|
|
|
16993
17018
|
}
|
|
16994
17019
|
|
|
16995
17020
|
// src/commands/permitCliReads/colorize.ts
|
|
16996
|
-
import
|
|
17021
|
+
import chalk119 from "chalk";
|
|
16997
17022
|
function colorize(plainOutput) {
|
|
16998
17023
|
return plainOutput.split("\n").map((line) => {
|
|
16999
|
-
if (line.startsWith(" R ")) return
|
|
17000
|
-
if (line.startsWith(" W ")) return
|
|
17024
|
+
if (line.startsWith(" R ")) return chalk119.green(line);
|
|
17025
|
+
if (line.startsWith(" W ")) return chalk119.red(line);
|
|
17001
17026
|
return line;
|
|
17002
17027
|
}).join("\n");
|
|
17003
17028
|
}
|
|
@@ -17290,7 +17315,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
17290
17315
|
}
|
|
17291
17316
|
|
|
17292
17317
|
// src/commands/deny/denyAdd.ts
|
|
17293
|
-
import
|
|
17318
|
+
import chalk120 from "chalk";
|
|
17294
17319
|
|
|
17295
17320
|
// src/commands/deny/loadDenyConfig.ts
|
|
17296
17321
|
function loadDenyConfig(global) {
|
|
@@ -17310,16 +17335,16 @@ function loadDenyConfig(global) {
|
|
|
17310
17335
|
function denyAdd(pattern2, message3, options2) {
|
|
17311
17336
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
17312
17337
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
17313
|
-
console.log(
|
|
17338
|
+
console.log(chalk120.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
17314
17339
|
return;
|
|
17315
17340
|
}
|
|
17316
17341
|
deny.push({ pattern: pattern2, message: message3 });
|
|
17317
17342
|
saveDeny(deny);
|
|
17318
|
-
console.log(
|
|
17343
|
+
console.log(chalk120.green(`Added deny rule: ${pattern2} \u2192 ${message3}`));
|
|
17319
17344
|
}
|
|
17320
17345
|
|
|
17321
17346
|
// src/commands/deny/denyList.ts
|
|
17322
|
-
import
|
|
17347
|
+
import chalk121 from "chalk";
|
|
17323
17348
|
function denyList() {
|
|
17324
17349
|
const globalRaw = loadGlobalConfigRaw();
|
|
17325
17350
|
const projectRaw = loadProjectConfig();
|
|
@@ -17330,7 +17355,7 @@ function denyList() {
|
|
|
17330
17355
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
17331
17356
|
);
|
|
17332
17357
|
if (!merged || merged.length === 0) {
|
|
17333
|
-
console.log(
|
|
17358
|
+
console.log(chalk121.dim("No deny rules configured."));
|
|
17334
17359
|
return;
|
|
17335
17360
|
}
|
|
17336
17361
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -17338,23 +17363,23 @@ function denyList() {
|
|
|
17338
17363
|
for (const rule of merged) {
|
|
17339
17364
|
const inProject = projectPatterns.has(rule.pattern);
|
|
17340
17365
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
17341
|
-
const label2 = inProject && inGlobal ?
|
|
17342
|
-
console.log(`${
|
|
17366
|
+
const label2 = inProject && inGlobal ? chalk121.dim(" (project, overrides global)") : inGlobal ? chalk121.dim(" (global)") : "";
|
|
17367
|
+
console.log(`${chalk121.red(rule.pattern)} \u2192 ${rule.message}${label2}`);
|
|
17343
17368
|
}
|
|
17344
17369
|
}
|
|
17345
17370
|
|
|
17346
17371
|
// src/commands/deny/denyRemove.ts
|
|
17347
|
-
import
|
|
17372
|
+
import chalk122 from "chalk";
|
|
17348
17373
|
function denyRemove(pattern2, options2) {
|
|
17349
17374
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
17350
17375
|
const index3 = deny.findIndex((r) => r.pattern === pattern2);
|
|
17351
17376
|
if (index3 === -1) {
|
|
17352
|
-
console.log(
|
|
17377
|
+
console.log(chalk122.yellow(`No deny rule found for: ${pattern2}`));
|
|
17353
17378
|
return;
|
|
17354
17379
|
}
|
|
17355
17380
|
deny.splice(index3, 1);
|
|
17356
17381
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
17357
|
-
console.log(
|
|
17382
|
+
console.log(chalk122.green(`Removed deny rule: ${pattern2}`));
|
|
17358
17383
|
}
|
|
17359
17384
|
|
|
17360
17385
|
// src/commands/registerDeny.ts
|
|
@@ -17386,7 +17411,7 @@ function registerCliHook(program2) {
|
|
|
17386
17411
|
|
|
17387
17412
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
17388
17413
|
import { existsSync as existsSync37, readFileSync as readFileSync29, unlinkSync as unlinkSync8, writeFileSync as writeFileSync24 } from "fs";
|
|
17389
|
-
import
|
|
17414
|
+
import chalk123 from "chalk";
|
|
17390
17415
|
|
|
17391
17416
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
17392
17417
|
import { homedir as homedir17 } from "os";
|
|
@@ -17439,12 +17464,12 @@ function codeCommentConfirm(pin) {
|
|
|
17439
17464
|
sweepRestrictedDir();
|
|
17440
17465
|
const state = readPinState(pin);
|
|
17441
17466
|
if (!state) {
|
|
17442
|
-
console.error(
|
|
17467
|
+
console.error(chalk123.red(`No pending comment for pin: ${pin}`));
|
|
17443
17468
|
process.exitCode = 1;
|
|
17444
17469
|
return;
|
|
17445
17470
|
}
|
|
17446
17471
|
if (!existsSync37(state.file)) {
|
|
17447
|
-
console.error(
|
|
17472
|
+
console.error(chalk123.red(`Target file no longer exists: ${state.file}`));
|
|
17448
17473
|
process.exitCode = 1;
|
|
17449
17474
|
return;
|
|
17450
17475
|
}
|
|
@@ -17453,7 +17478,7 @@ function codeCommentConfirm(pin) {
|
|
|
17453
17478
|
const index3 = state.line - 1;
|
|
17454
17479
|
if (index3 > lines2.length) {
|
|
17455
17480
|
console.error(
|
|
17456
|
-
|
|
17481
|
+
chalk123.red(
|
|
17457
17482
|
`Line ${state.line} is beyond the end of ${state.file} (${lines2.length} lines).`
|
|
17458
17483
|
)
|
|
17459
17484
|
);
|
|
@@ -17467,14 +17492,14 @@ function codeCommentConfirm(pin) {
|
|
|
17467
17492
|
writeFileSync24(state.file, lines2.join("\n"));
|
|
17468
17493
|
unlinkSync8(getPinStatePath(pin));
|
|
17469
17494
|
console.log(
|
|
17470
|
-
|
|
17495
|
+
chalk123.green(
|
|
17471
17496
|
`Inserted "${marker2} ${state.text}" at ${state.file}:${state.line}`
|
|
17472
17497
|
)
|
|
17473
17498
|
);
|
|
17474
17499
|
}
|
|
17475
17500
|
|
|
17476
17501
|
// src/commands/codeComment/codeCommentSet.ts
|
|
17477
|
-
import
|
|
17502
|
+
import chalk124 from "chalk";
|
|
17478
17503
|
|
|
17479
17504
|
// src/commands/codeComment/validateCommentText.ts
|
|
17480
17505
|
var MAX_COMMENT_LENGTH = 50;
|
|
@@ -17525,7 +17550,7 @@ function generatePin() {
|
|
|
17525
17550
|
function codeCommentSet(file, line, text18) {
|
|
17526
17551
|
const lineNumber = Number.parseInt(line, 10);
|
|
17527
17552
|
if (!Number.isInteger(lineNumber) || lineNumber < 1) {
|
|
17528
|
-
console.error(
|
|
17553
|
+
console.error(chalk124.red(`Invalid line number: ${line}`));
|
|
17529
17554
|
process.exitCode = 1;
|
|
17530
17555
|
return;
|
|
17531
17556
|
}
|
|
@@ -17533,20 +17558,20 @@ function codeCommentSet(file, line, text18) {
|
|
|
17533
17558
|
const marker2 = hash ? "#" : "//";
|
|
17534
17559
|
const validation = validateCommentText(text18, hash);
|
|
17535
17560
|
if (!validation.ok) {
|
|
17536
|
-
console.error(
|
|
17537
|
-
console.error(
|
|
17561
|
+
console.error(chalk124.red(`Refused: ${validation.reason}`));
|
|
17562
|
+
console.error(chalk124.red("No pin issued."));
|
|
17538
17563
|
process.exitCode = 1;
|
|
17539
17564
|
return;
|
|
17540
17565
|
}
|
|
17541
17566
|
console.error(
|
|
17542
|
-
|
|
17567
|
+
chalk124.yellow.bold(
|
|
17543
17568
|
"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."
|
|
17544
17569
|
)
|
|
17545
17570
|
);
|
|
17546
17571
|
const delivered = issuePin(file, lineNumber, validation.text);
|
|
17547
17572
|
if (!delivered) {
|
|
17548
17573
|
console.error(
|
|
17549
|
-
|
|
17574
|
+
chalk124.red(
|
|
17550
17575
|
"Could not deliver the confirmation pin via notification.\nThe comment cannot be confirmed until the notification channel works."
|
|
17551
17576
|
)
|
|
17552
17577
|
);
|
|
@@ -17556,7 +17581,7 @@ function codeCommentSet(file, line, text18) {
|
|
|
17556
17581
|
console.log(
|
|
17557
17582
|
`A confirmation pin was sent to your desktop notifications.
|
|
17558
17583
|
To insert "${marker2} ${validation.text}" at ${file}:${lineNumber}, run:
|
|
17559
|
-
${
|
|
17584
|
+
${chalk124.cyan(" assist code-comment confirm <PIN>")}
|
|
17560
17585
|
using the pin from that notification.`
|
|
17561
17586
|
);
|
|
17562
17587
|
}
|
|
@@ -17655,15 +17680,15 @@ function registerCodexHook(program2) {
|
|
|
17655
17680
|
}
|
|
17656
17681
|
|
|
17657
17682
|
// src/commands/complexity/analyze.ts
|
|
17658
|
-
import
|
|
17683
|
+
import chalk133 from "chalk";
|
|
17659
17684
|
|
|
17660
17685
|
// src/commands/complexity/cyclomatic.ts
|
|
17661
|
-
import
|
|
17686
|
+
import chalk126 from "chalk";
|
|
17662
17687
|
|
|
17663
17688
|
// src/commands/complexity/shared/index.ts
|
|
17664
17689
|
import fs23 from "fs";
|
|
17665
17690
|
import path31 from "path";
|
|
17666
|
-
import
|
|
17691
|
+
import chalk125 from "chalk";
|
|
17667
17692
|
import ts5 from "typescript";
|
|
17668
17693
|
|
|
17669
17694
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -17914,7 +17939,7 @@ function createSourceFromFile(filePath) {
|
|
|
17914
17939
|
function withSourceFiles(pattern2, callback, extraIgnore = []) {
|
|
17915
17940
|
const files = findSourceFiles2(pattern2, ".", extraIgnore);
|
|
17916
17941
|
if (files.length === 0) {
|
|
17917
|
-
console.log(
|
|
17942
|
+
console.log(chalk125.yellow("No files found matching pattern"));
|
|
17918
17943
|
return void 0;
|
|
17919
17944
|
}
|
|
17920
17945
|
return callback(files);
|
|
@@ -17947,11 +17972,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
17947
17972
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
17948
17973
|
for (const { file, name, complexity } of results) {
|
|
17949
17974
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
17950
|
-
const color = exceedsThreshold ?
|
|
17951
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
17975
|
+
const color = exceedsThreshold ? chalk126.red : chalk126.white;
|
|
17976
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk126.cyan(complexity)}`);
|
|
17952
17977
|
}
|
|
17953
17978
|
console.log(
|
|
17954
|
-
|
|
17979
|
+
chalk126.dim(
|
|
17955
17980
|
`
|
|
17956
17981
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
17957
17982
|
)
|
|
@@ -17963,7 +17988,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
17963
17988
|
}
|
|
17964
17989
|
|
|
17965
17990
|
// src/commands/complexity/halstead.ts
|
|
17966
|
-
import
|
|
17991
|
+
import chalk127 from "chalk";
|
|
17967
17992
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
17968
17993
|
withSourceFiles(pattern2, (files) => {
|
|
17969
17994
|
const results = [];
|
|
@@ -17978,13 +18003,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
17978
18003
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
17979
18004
|
for (const { file, name, metrics } of results) {
|
|
17980
18005
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
17981
|
-
const color = exceedsThreshold ?
|
|
18006
|
+
const color = exceedsThreshold ? chalk127.red : chalk127.white;
|
|
17982
18007
|
console.log(
|
|
17983
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
18008
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk127.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk127.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk127.magenta(metrics.effort.toFixed(1))}`
|
|
17984
18009
|
);
|
|
17985
18010
|
}
|
|
17986
18011
|
console.log(
|
|
17987
|
-
|
|
18012
|
+
chalk127.dim(
|
|
17988
18013
|
`
|
|
17989
18014
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
17990
18015
|
)
|
|
@@ -18053,15 +18078,15 @@ function collectFileMetrics(files) {
|
|
|
18053
18078
|
}
|
|
18054
18079
|
|
|
18055
18080
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
18056
|
-
import
|
|
18081
|
+
import chalk131 from "chalk";
|
|
18057
18082
|
|
|
18058
18083
|
// src/commands/complexity/maintainability/formatResultLine.ts
|
|
18059
|
-
import
|
|
18084
|
+
import chalk128 from "chalk";
|
|
18060
18085
|
function formatResultLine(entry, failing) {
|
|
18061
18086
|
const { file, avgMaintainability, minMaintainability, override } = entry;
|
|
18062
|
-
const name = failing ?
|
|
18063
|
-
const suffix = override !== void 0 ?
|
|
18064
|
-
return `${name} \u2192 avg: ${
|
|
18087
|
+
const name = failing ? chalk128.red(file) : chalk128.white(file);
|
|
18088
|
+
const suffix = override !== void 0 ? chalk128.magenta(` (override: ${override})`) : "";
|
|
18089
|
+
return `${name} \u2192 avg: ${chalk128.cyan(avgMaintainability.toFixed(1))}, min: ${chalk128.yellow(minMaintainability.toFixed(1))}${suffix}`;
|
|
18065
18090
|
}
|
|
18066
18091
|
|
|
18067
18092
|
// src/commands/complexity/maintainability/getMaintainabilityGitState.ts
|
|
@@ -18112,38 +18137,38 @@ function getMaintainabilityGitState() {
|
|
|
18112
18137
|
|
|
18113
18138
|
// src/commands/complexity/maintainability/printMaintainabilityFailure.ts
|
|
18114
18139
|
import path33 from "path";
|
|
18115
|
-
import
|
|
18140
|
+
import chalk129 from "chalk";
|
|
18116
18141
|
var extractTemplate = "assist refactor extract <file> <functionName> <destination> --apply";
|
|
18117
18142
|
function remediationLine(entry) {
|
|
18118
|
-
return ` ${
|
|
18143
|
+
return ` ${chalk129.bold(entry.file)}
|
|
18119
18144
|
Pick a responsibility and extract it:
|
|
18120
|
-
${
|
|
18145
|
+
${chalk129.cyan(extractTemplate)}`;
|
|
18121
18146
|
}
|
|
18122
18147
|
function cheatLine(entry, gitState) {
|
|
18123
18148
|
const shrank = gitState.shrunkFiles.has(path33.resolve(entry.file));
|
|
18124
18149
|
if (!shrank || gitState.newFileCreated) return "";
|
|
18125
18150
|
return `
|
|
18126
|
-
${
|
|
18151
|
+
${chalk129.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.")}`;
|
|
18127
18152
|
}
|
|
18128
18153
|
function printMaintainabilityFailure(failing, gitState) {
|
|
18129
18154
|
const blocks = failing.map((entry) => `${remediationLine(entry)}${cheatLine(entry, gitState)}`).join("\n");
|
|
18130
18155
|
console.error(
|
|
18131
|
-
|
|
18156
|
+
chalk129.red(
|
|
18132
18157
|
`
|
|
18133
18158
|
Fail: ${failing.length} file(s) below threshold \u2192 extract a responsibility to a new file.
|
|
18134
18159
|
|
|
18135
18160
|
${blocks}
|
|
18136
18161
|
|
|
18137
|
-
${
|
|
18162
|
+
${chalk129.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.`
|
|
18138
18163
|
)
|
|
18139
18164
|
);
|
|
18140
18165
|
}
|
|
18141
18166
|
|
|
18142
18167
|
// src/commands/complexity/maintainability/printMaintainabilityFormula.ts
|
|
18143
|
-
import
|
|
18168
|
+
import chalk130 from "chalk";
|
|
18144
18169
|
var MI_FORMULA = "171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100";
|
|
18145
18170
|
function printMaintainabilityFormula() {
|
|
18146
|
-
console.log(
|
|
18171
|
+
console.log(chalk130.dim(MI_FORMULA));
|
|
18147
18172
|
}
|
|
18148
18173
|
|
|
18149
18174
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
@@ -18152,7 +18177,7 @@ function displayMaintainabilityResults(results, threshold, gitState = getMaintai
|
|
|
18152
18177
|
if (!gating) {
|
|
18153
18178
|
printMaintainabilityFormula();
|
|
18154
18179
|
for (const entry of results) console.log(formatResultLine(entry, false));
|
|
18155
|
-
console.log(
|
|
18180
|
+
console.log(chalk131.dim(`
|
|
18156
18181
|
Analyzed ${results.length} files`));
|
|
18157
18182
|
return;
|
|
18158
18183
|
}
|
|
@@ -18161,14 +18186,14 @@ Analyzed ${results.length} files`));
|
|
|
18161
18186
|
return limit !== void 0 && r.minMaintainability < limit;
|
|
18162
18187
|
});
|
|
18163
18188
|
if (failing.length === 0) {
|
|
18164
|
-
console.log(
|
|
18189
|
+
console.log(chalk131.green("All files pass maintainability threshold"));
|
|
18165
18190
|
}
|
|
18166
18191
|
const passingOverrides = results.filter(
|
|
18167
18192
|
(r) => r.override !== void 0 && !failing.includes(r)
|
|
18168
18193
|
);
|
|
18169
18194
|
for (const entry of passingOverrides)
|
|
18170
18195
|
console.log(formatResultLine(entry, false));
|
|
18171
|
-
console.log(
|
|
18196
|
+
console.log(chalk131.dim(`
|
|
18172
18197
|
Analyzed ${results.length} files`));
|
|
18173
18198
|
if (failing.length > 0) {
|
|
18174
18199
|
printMaintainabilityFailure(failing, gitState);
|
|
@@ -18191,7 +18216,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
18191
18216
|
|
|
18192
18217
|
// src/commands/complexity/sloc.ts
|
|
18193
18218
|
import fs25 from "fs";
|
|
18194
|
-
import
|
|
18219
|
+
import chalk132 from "chalk";
|
|
18195
18220
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
18196
18221
|
withSourceFiles(pattern2, (files) => {
|
|
18197
18222
|
const results = [];
|
|
@@ -18207,12 +18232,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
18207
18232
|
results.sort((a, b) => b.lines - a.lines);
|
|
18208
18233
|
for (const { file, lines: lines2 } of results) {
|
|
18209
18234
|
const exceedsThreshold = options2.threshold !== void 0 && lines2 > options2.threshold;
|
|
18210
|
-
const color = exceedsThreshold ?
|
|
18211
|
-
console.log(`${color(file)} \u2192 ${
|
|
18235
|
+
const color = exceedsThreshold ? chalk132.red : chalk132.white;
|
|
18236
|
+
console.log(`${color(file)} \u2192 ${chalk132.cyan(lines2)} lines`);
|
|
18212
18237
|
}
|
|
18213
18238
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
18214
18239
|
console.log(
|
|
18215
|
-
|
|
18240
|
+
chalk132.dim(`
|
|
18216
18241
|
Total: ${total} lines across ${files.length} files`)
|
|
18217
18242
|
);
|
|
18218
18243
|
if (hasViolation) {
|
|
@@ -18226,25 +18251,25 @@ async function analyze(pattern2) {
|
|
|
18226
18251
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
18227
18252
|
const files = findSourceFiles2(searchPattern);
|
|
18228
18253
|
if (files.length === 0) {
|
|
18229
|
-
console.log(
|
|
18254
|
+
console.log(chalk133.yellow("No files found matching pattern"));
|
|
18230
18255
|
return;
|
|
18231
18256
|
}
|
|
18232
18257
|
if (files.length === 1) {
|
|
18233
18258
|
const file = files[0];
|
|
18234
|
-
console.log(
|
|
18259
|
+
console.log(chalk133.bold.underline("SLOC"));
|
|
18235
18260
|
await sloc(file);
|
|
18236
18261
|
console.log();
|
|
18237
|
-
console.log(
|
|
18262
|
+
console.log(chalk133.bold.underline("Cyclomatic Complexity"));
|
|
18238
18263
|
await cyclomatic(file);
|
|
18239
18264
|
console.log();
|
|
18240
|
-
console.log(
|
|
18265
|
+
console.log(chalk133.bold.underline("Halstead Metrics"));
|
|
18241
18266
|
await halstead(file);
|
|
18242
18267
|
console.log();
|
|
18243
|
-
console.log(
|
|
18268
|
+
console.log(chalk133.bold.underline("Maintainability Index"));
|
|
18244
18269
|
await maintainability(file);
|
|
18245
18270
|
console.log();
|
|
18246
18271
|
console.log(
|
|
18247
|
-
|
|
18272
|
+
chalk133.dim(
|
|
18248
18273
|
"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."
|
|
18249
18274
|
)
|
|
18250
18275
|
);
|
|
@@ -18279,7 +18304,7 @@ function registerComplexity(program2) {
|
|
|
18279
18304
|
}
|
|
18280
18305
|
|
|
18281
18306
|
// src/commands/config/index.ts
|
|
18282
|
-
import
|
|
18307
|
+
import chalk134 from "chalk";
|
|
18283
18308
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
18284
18309
|
function configList() {
|
|
18285
18310
|
const config = maskConfigSecrets(
|
|
@@ -18287,7 +18312,7 @@ function configList() {
|
|
|
18287
18312
|
describeConfigNode(assistConfigSchema)
|
|
18288
18313
|
);
|
|
18289
18314
|
console.log(
|
|
18290
|
-
|
|
18315
|
+
chalk134.dim(
|
|
18291
18316
|
"# Only the keys that are set; run assist config keys for every key and its default"
|
|
18292
18317
|
)
|
|
18293
18318
|
);
|
|
@@ -18295,7 +18320,7 @@ function configList() {
|
|
|
18295
18320
|
}
|
|
18296
18321
|
|
|
18297
18322
|
// src/commands/config/configGet.ts
|
|
18298
|
-
import
|
|
18323
|
+
import chalk135 from "chalk";
|
|
18299
18324
|
|
|
18300
18325
|
// src/commands/config/formatConfigDefault.ts
|
|
18301
18326
|
function formatConfigDefault(leaf) {
|
|
@@ -18335,29 +18360,29 @@ function unsetLines(key) {
|
|
|
18335
18360
|
const leaf = describeConfigLeaves(assistConfigSchema).find(
|
|
18336
18361
|
(candidate) => candidate.key === key
|
|
18337
18362
|
);
|
|
18338
|
-
if (!leaf) return [
|
|
18363
|
+
if (!leaf) return [chalk135.red(`Key "${key}" is not set`)];
|
|
18339
18364
|
const lines2 = [
|
|
18340
|
-
|
|
18365
|
+
chalk135.red(
|
|
18341
18366
|
leaf.defaultValue === void 0 ? `Key "${key}" is not set and has no schema default` : `Key "${key}" is not set; the schema default is ${formatConfigDefault(leaf)}`
|
|
18342
18367
|
)
|
|
18343
18368
|
];
|
|
18344
18369
|
const help = configHelpForKey(key);
|
|
18345
|
-
if (help) lines2.push(help.note,
|
|
18370
|
+
if (help) lines2.push(help.note, chalk135.green(help.setter));
|
|
18346
18371
|
return lines2;
|
|
18347
18372
|
}
|
|
18348
18373
|
|
|
18349
18374
|
// src/commands/config/configKeys.ts
|
|
18350
|
-
import
|
|
18375
|
+
import chalk136 from "chalk";
|
|
18351
18376
|
function configKeys2(filter) {
|
|
18352
18377
|
const leaves = describeConfigLeaves(assistConfigSchema);
|
|
18353
18378
|
const matches = filter ? leaves.filter(matching(filter)) : leaves;
|
|
18354
18379
|
if (matches.length === 0) {
|
|
18355
|
-
console.error(
|
|
18380
|
+
console.error(chalk136.red(`No config key matches "${filter}"`));
|
|
18356
18381
|
process.exit(1);
|
|
18357
18382
|
}
|
|
18358
18383
|
console.log(headline(matches.length, leaves.length, filter));
|
|
18359
18384
|
console.log(
|
|
18360
|
-
|
|
18385
|
+
chalk136.dim(
|
|
18361
18386
|
"Defaults come from the schema; assist config list shows what is set."
|
|
18362
18387
|
)
|
|
18363
18388
|
);
|
|
@@ -18373,13 +18398,13 @@ function matching(filter) {
|
|
|
18373
18398
|
return (leaf) => leaf.key.toLowerCase().includes(needle);
|
|
18374
18399
|
}
|
|
18375
18400
|
function headline(shown, total, filter) {
|
|
18376
|
-
return filter ?
|
|
18401
|
+
return filter ? chalk136.bold(`${shown} of ${total} config keys matching "${filter}"`) : chalk136.bold(`${total} config keys`);
|
|
18377
18402
|
}
|
|
18378
18403
|
function formatLeaf(leaf, help) {
|
|
18379
18404
|
const meta = [typeText(leaf), `default: ${formatConfigDefault(leaf)}`];
|
|
18380
18405
|
if (leaf.secret) meta.push("secret");
|
|
18381
|
-
const lines2 = [`${
|
|
18382
|
-
if (help) lines2.push(` ${help.note}`, ` ${
|
|
18406
|
+
const lines2 = [`${chalk136.cyan(leaf.key)} ${chalk136.dim(meta.join(" "))}`];
|
|
18407
|
+
if (help) lines2.push(` ${help.note}`, ` ${chalk136.green(help.setter)}`);
|
|
18383
18408
|
return lines2;
|
|
18384
18409
|
}
|
|
18385
18410
|
function typeText(leaf) {
|
|
@@ -18390,7 +18415,7 @@ function typeText(leaf) {
|
|
|
18390
18415
|
}
|
|
18391
18416
|
|
|
18392
18417
|
// src/commands/config/configSet.ts
|
|
18393
|
-
import
|
|
18418
|
+
import chalk138 from "chalk";
|
|
18394
18419
|
|
|
18395
18420
|
// src/commands/config/coerceCliConfigValue.ts
|
|
18396
18421
|
function coerceCliConfigValue(key, raw) {
|
|
@@ -18411,9 +18436,9 @@ function coerceWithoutSchemaLeaf(raw) {
|
|
|
18411
18436
|
}
|
|
18412
18437
|
|
|
18413
18438
|
// src/commands/config/exitWithConfigErrors.ts
|
|
18414
|
-
import
|
|
18439
|
+
import chalk137 from "chalk";
|
|
18415
18440
|
function exitWithConfigErrors(errors) {
|
|
18416
|
-
for (const error of errors) console.error(
|
|
18441
|
+
for (const error of errors) console.error(chalk137.red(error));
|
|
18417
18442
|
process.exit(1);
|
|
18418
18443
|
}
|
|
18419
18444
|
|
|
@@ -18432,13 +18457,13 @@ function resolveRepoTarget(key, value, repo) {
|
|
|
18432
18457
|
function configSet(key, value, options2 = {}) {
|
|
18433
18458
|
if (options2.repo !== void 0 && !options2.global) {
|
|
18434
18459
|
console.error(
|
|
18435
|
-
|
|
18460
|
+
chalk138.red("--repo writes to the global config; add -g (e.g. -g --repo)")
|
|
18436
18461
|
);
|
|
18437
18462
|
process.exit(1);
|
|
18438
18463
|
}
|
|
18439
18464
|
const resolved = resolveRepoTarget(key, value, options2.repo);
|
|
18440
18465
|
if (resolved.value === void 0) {
|
|
18441
|
-
console.error(
|
|
18466
|
+
console.error(chalk138.red(`Missing required argument for '${resolved.key}'`));
|
|
18442
18467
|
process.exit(1);
|
|
18443
18468
|
}
|
|
18444
18469
|
const coercion = coerceCliConfigValue(resolved.key, resolved.value);
|
|
@@ -18446,7 +18471,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
18446
18471
|
const coerced = coercion.value;
|
|
18447
18472
|
const target = resolved.useRepo ? `repo: ${applyRepoOrExit(resolved.key, coerced, resolved.repoName)}` : applyOrExit(resolved.key, coerced, options2.global ?? false);
|
|
18448
18473
|
const shown = JSON.stringify(maskConfigKeySecrets(resolved.key, coerced));
|
|
18449
|
-
console.log(
|
|
18474
|
+
console.log(chalk138.green(`Set ${resolved.key} = ${shown} (${target})`));
|
|
18450
18475
|
}
|
|
18451
18476
|
function applyOrExit(key, coerced, global) {
|
|
18452
18477
|
const result = applyConfigSet(key, coerced, global);
|
|
@@ -18460,7 +18485,7 @@ function applyRepoOrExit(key, coerced, repoName) {
|
|
|
18460
18485
|
}
|
|
18461
18486
|
|
|
18462
18487
|
// src/commands/config/configUnset.ts
|
|
18463
|
-
import
|
|
18488
|
+
import chalk139 from "chalk";
|
|
18464
18489
|
|
|
18465
18490
|
// src/commands/config/resolveRepoUnsetTarget.ts
|
|
18466
18491
|
function resolveRepoUnsetTarget(key, repo) {
|
|
@@ -18476,7 +18501,7 @@ function resolveRepoUnsetTarget(key, repo) {
|
|
|
18476
18501
|
function configUnset(key, options2 = {}) {
|
|
18477
18502
|
if (options2.repo !== void 0 && !options2.global) {
|
|
18478
18503
|
console.error(
|
|
18479
|
-
|
|
18504
|
+
chalk139.red(
|
|
18480
18505
|
"--repo removes from the global config; add -g (e.g. -g --repo)"
|
|
18481
18506
|
)
|
|
18482
18507
|
);
|
|
@@ -18484,7 +18509,7 @@ function configUnset(key, options2 = {}) {
|
|
|
18484
18509
|
}
|
|
18485
18510
|
const resolved = resolveRepoUnsetTarget(key, options2.repo);
|
|
18486
18511
|
if (resolved.key === void 0) {
|
|
18487
|
-
console.error(
|
|
18512
|
+
console.error(chalk139.red("Missing required argument 'key'"));
|
|
18488
18513
|
process.exit(1);
|
|
18489
18514
|
return;
|
|
18490
18515
|
}
|
|
@@ -18492,11 +18517,11 @@ function configUnset(key, options2 = {}) {
|
|
|
18492
18517
|
if (!result.ok) exitWithConfigErrors(result.errors);
|
|
18493
18518
|
if (!result.removed) {
|
|
18494
18519
|
console.log(
|
|
18495
|
-
|
|
18520
|
+
chalk139.yellow(`${resolved.key} is not set in ${whereLabel(result)}`)
|
|
18496
18521
|
);
|
|
18497
18522
|
return;
|
|
18498
18523
|
}
|
|
18499
|
-
console.log(
|
|
18524
|
+
console.log(chalk139.green(`Unset ${resolved.key} (${targetLabel(result)})`));
|
|
18500
18525
|
}
|
|
18501
18526
|
function whereLabel(result) {
|
|
18502
18527
|
return result.target === "repo" ? `repos.${result.label}` : `the ${result.target} config`;
|
|
@@ -18530,40 +18555,40 @@ function registerConfig(program2) {
|
|
|
18530
18555
|
}
|
|
18531
18556
|
|
|
18532
18557
|
// src/commands/db/reportMigrationStatus.ts
|
|
18533
|
-
import
|
|
18558
|
+
import chalk140 from "chalk";
|
|
18534
18559
|
function reportApplied(applied) {
|
|
18535
18560
|
if (applied.length === 0) {
|
|
18536
|
-
console.error(
|
|
18561
|
+
console.error(chalk140.green("Database is up to date; nothing to apply."));
|
|
18537
18562
|
return;
|
|
18538
18563
|
}
|
|
18539
18564
|
for (const migration of applied) {
|
|
18540
18565
|
console.error(
|
|
18541
|
-
|
|
18566
|
+
chalk140.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
18542
18567
|
);
|
|
18543
18568
|
}
|
|
18544
18569
|
}
|
|
18545
18570
|
function reportMigrationStatus(status3) {
|
|
18546
18571
|
if (status3.state === "in-sync") {
|
|
18547
18572
|
console.error(
|
|
18548
|
-
|
|
18573
|
+
chalk140.green(`In sync at migration ${status3.version} (latest).`)
|
|
18549
18574
|
);
|
|
18550
18575
|
return;
|
|
18551
18576
|
}
|
|
18552
18577
|
if (status3.state === "behind") {
|
|
18553
18578
|
console.error(
|
|
18554
|
-
|
|
18579
|
+
chalk140.yellow(
|
|
18555
18580
|
`Behind: applied ${status3.applied}, build expects ${status3.expected}.`
|
|
18556
18581
|
)
|
|
18557
18582
|
);
|
|
18558
18583
|
console.error(
|
|
18559
|
-
|
|
18584
|
+
chalk140.yellow(
|
|
18560
18585
|
`Pending: ${status3.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
18561
18586
|
)
|
|
18562
18587
|
);
|
|
18563
18588
|
return;
|
|
18564
18589
|
}
|
|
18565
18590
|
console.error(
|
|
18566
|
-
|
|
18591
|
+
chalk140.red(
|
|
18567
18592
|
`Ahead: applied ${status3.applied}, build knows ${status3.expected}. Update assist.`
|
|
18568
18593
|
)
|
|
18569
18594
|
);
|
|
@@ -18598,7 +18623,7 @@ function registerDb(program2) {
|
|
|
18598
18623
|
|
|
18599
18624
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
18600
18625
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync26 } from "fs";
|
|
18601
|
-
import
|
|
18626
|
+
import chalk141 from "chalk";
|
|
18602
18627
|
|
|
18603
18628
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
18604
18629
|
import { join as join39 } from "path";
|
|
@@ -18629,7 +18654,7 @@ function dbMigrationConfirm(pin) {
|
|
|
18629
18654
|
sweepRestrictedDir();
|
|
18630
18655
|
const state = readMigrationPinState(pin);
|
|
18631
18656
|
if (!state) {
|
|
18632
|
-
console.error(
|
|
18657
|
+
console.error(chalk141.red(`No pending migration unlock for pin: ${pin}`));
|
|
18633
18658
|
process.exitCode = 1;
|
|
18634
18659
|
return;
|
|
18635
18660
|
}
|
|
@@ -18639,7 +18664,7 @@ function dbMigrationConfirm(pin) {
|
|
|
18639
18664
|
);
|
|
18640
18665
|
unlinkSync9(getMigrationPinPath(pin));
|
|
18641
18666
|
console.log(
|
|
18642
|
-
|
|
18667
|
+
chalk141.green(
|
|
18643
18668
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
18644
18669
|
)
|
|
18645
18670
|
);
|
|
@@ -18648,7 +18673,7 @@ function dbMigrationConfirm(pin) {
|
|
|
18648
18673
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
18649
18674
|
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync27 } from "fs";
|
|
18650
18675
|
import { randomInt as randomInt2 } from "crypto";
|
|
18651
|
-
import
|
|
18676
|
+
import chalk142 from "chalk";
|
|
18652
18677
|
|
|
18653
18678
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
18654
18679
|
function nextMigrationId() {
|
|
@@ -18663,7 +18688,7 @@ function dbMigrationUnlock() {
|
|
|
18663
18688
|
sweepRestrictedDir();
|
|
18664
18689
|
writeFileSync27(getMigrationPinPath(pin), JSON.stringify({ pin, migrationId }));
|
|
18665
18690
|
console.error(
|
|
18666
|
-
|
|
18691
|
+
chalk142.yellow.bold(
|
|
18667
18692
|
"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."
|
|
18668
18693
|
)
|
|
18669
18694
|
);
|
|
@@ -18673,7 +18698,7 @@ function dbMigrationUnlock() {
|
|
|
18673
18698
|
});
|
|
18674
18699
|
if (!delivered) {
|
|
18675
18700
|
console.error(
|
|
18676
|
-
|
|
18701
|
+
chalk142.red(
|
|
18677
18702
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
18678
18703
|
)
|
|
18679
18704
|
);
|
|
@@ -18683,7 +18708,7 @@ function dbMigrationUnlock() {
|
|
|
18683
18708
|
console.log(
|
|
18684
18709
|
`A confirmation pin was sent to your desktop notifications.
|
|
18685
18710
|
To approve creating migration ${migrationId}, run:
|
|
18686
|
-
${
|
|
18711
|
+
${chalk142.cyan(" assist db-migration confirm <PIN>")}
|
|
18687
18712
|
using the pin from that notification.`
|
|
18688
18713
|
);
|
|
18689
18714
|
}
|
|
@@ -18703,7 +18728,7 @@ function registerDbMigration(parent) {
|
|
|
18703
18728
|
|
|
18704
18729
|
// src/commands/deploy/redirect.ts
|
|
18705
18730
|
import { existsSync as existsSync39, readFileSync as readFileSync31, writeFileSync as writeFileSync28 } from "fs";
|
|
18706
|
-
import
|
|
18731
|
+
import chalk143 from "chalk";
|
|
18707
18732
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
18708
18733
|
if (!window.location.pathname.endsWith('/')) {
|
|
18709
18734
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -18712,23 +18737,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
18712
18737
|
function redirect() {
|
|
18713
18738
|
const indexPath = "index.html";
|
|
18714
18739
|
if (!existsSync39(indexPath)) {
|
|
18715
|
-
console.log(
|
|
18740
|
+
console.log(chalk143.yellow("No index.html found"));
|
|
18716
18741
|
return;
|
|
18717
18742
|
}
|
|
18718
18743
|
const content = readFileSync31(indexPath, "utf8");
|
|
18719
18744
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
18720
|
-
console.log(
|
|
18745
|
+
console.log(chalk143.dim("Trailing slash script already present"));
|
|
18721
18746
|
return;
|
|
18722
18747
|
}
|
|
18723
18748
|
const headCloseIndex = content.indexOf("</head>");
|
|
18724
18749
|
if (headCloseIndex === -1) {
|
|
18725
|
-
console.log(
|
|
18750
|
+
console.log(chalk143.red("Could not find </head> tag in index.html"));
|
|
18726
18751
|
return;
|
|
18727
18752
|
}
|
|
18728
18753
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
18729
18754
|
${content.slice(headCloseIndex)}`;
|
|
18730
18755
|
writeFileSync28(indexPath, newContent);
|
|
18731
|
-
console.log(
|
|
18756
|
+
console.log(chalk143.green("Added trailing slash redirect to index.html"));
|
|
18732
18757
|
}
|
|
18733
18758
|
|
|
18734
18759
|
// src/commands/registerDeploy.ts
|
|
@@ -18755,7 +18780,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
18755
18780
|
|
|
18756
18781
|
// src/commands/devlog/shared.ts
|
|
18757
18782
|
import { execSync as execSync36 } from "child_process";
|
|
18758
|
-
import
|
|
18783
|
+
import chalk144 from "chalk";
|
|
18759
18784
|
|
|
18760
18785
|
// src/shared/getRepoName.ts
|
|
18761
18786
|
import { existsSync as existsSync40, readFileSync as readFileSync32 } from "fs";
|
|
@@ -18864,13 +18889,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
18864
18889
|
}
|
|
18865
18890
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
18866
18891
|
for (const commit2 of commits2) {
|
|
18867
|
-
console.log(` ${
|
|
18892
|
+
console.log(` ${chalk144.yellow(commit2.hash)} ${commit2.message}`);
|
|
18868
18893
|
if (verbose) {
|
|
18869
18894
|
const visibleFiles = commit2.files.filter(
|
|
18870
18895
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
18871
18896
|
);
|
|
18872
18897
|
for (const file of visibleFiles) {
|
|
18873
|
-
console.log(` ${
|
|
18898
|
+
console.log(` ${chalk144.dim(file)}`);
|
|
18874
18899
|
}
|
|
18875
18900
|
}
|
|
18876
18901
|
}
|
|
@@ -18895,15 +18920,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
18895
18920
|
}
|
|
18896
18921
|
|
|
18897
18922
|
// src/commands/devlog/list/printDateHeader.ts
|
|
18898
|
-
import
|
|
18923
|
+
import chalk145 from "chalk";
|
|
18899
18924
|
function printDateHeader(date, isSkipped, entries) {
|
|
18900
18925
|
if (isSkipped) {
|
|
18901
|
-
console.log(`${
|
|
18926
|
+
console.log(`${chalk145.bold.blue(date)} ${chalk145.dim("skipped")}`);
|
|
18902
18927
|
} else if (entries && entries.length > 0) {
|
|
18903
|
-
const entryInfo = entries.map((e) => `${
|
|
18904
|
-
console.log(`${
|
|
18928
|
+
const entryInfo = entries.map((e) => `${chalk145.green(e.version)} ${e.title}`).join(" | ");
|
|
18929
|
+
console.log(`${chalk145.bold.blue(date)} ${entryInfo}`);
|
|
18905
18930
|
} else {
|
|
18906
|
-
console.log(`${
|
|
18931
|
+
console.log(`${chalk145.bold.blue(date)} ${chalk145.red("\u26A0 devlog missing")}`);
|
|
18907
18932
|
}
|
|
18908
18933
|
}
|
|
18909
18934
|
|
|
@@ -19007,24 +19032,24 @@ function bumpVersion(version2, type) {
|
|
|
19007
19032
|
|
|
19008
19033
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
19009
19034
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
19010
|
-
import
|
|
19035
|
+
import chalk147 from "chalk";
|
|
19011
19036
|
|
|
19012
19037
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
19013
|
-
import
|
|
19038
|
+
import chalk146 from "chalk";
|
|
19014
19039
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
19015
19040
|
if (conventional && firstHash) {
|
|
19016
19041
|
const version2 = getVersionAtCommit(firstHash);
|
|
19017
19042
|
if (version2) {
|
|
19018
|
-
console.log(`${
|
|
19043
|
+
console.log(`${chalk146.bold("version:")} ${stripToMinor(version2)}`);
|
|
19019
19044
|
} else {
|
|
19020
|
-
console.log(`${
|
|
19045
|
+
console.log(`${chalk146.bold("version:")} ${chalk146.red("unknown")}`);
|
|
19021
19046
|
}
|
|
19022
19047
|
} else if (patchVersion && minorVersion) {
|
|
19023
19048
|
console.log(
|
|
19024
|
-
`${
|
|
19049
|
+
`${chalk146.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
19025
19050
|
);
|
|
19026
19051
|
} else {
|
|
19027
|
-
console.log(`${
|
|
19052
|
+
console.log(`${chalk146.bold("version:")} v0.1 (initial)`);
|
|
19028
19053
|
}
|
|
19029
19054
|
}
|
|
19030
19055
|
|
|
@@ -19072,16 +19097,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
19072
19097
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
19073
19098
|
}
|
|
19074
19099
|
function logName(repoName) {
|
|
19075
|
-
console.log(`${
|
|
19100
|
+
console.log(`${chalk147.bold("name:")} ${repoName}`);
|
|
19076
19101
|
}
|
|
19077
19102
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
19078
19103
|
logName(ctx.repoName);
|
|
19079
19104
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
19080
|
-
console.log(
|
|
19105
|
+
console.log(chalk147.bold.blue(targetDate));
|
|
19081
19106
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
19082
19107
|
}
|
|
19083
19108
|
function logNoCommits(lastInfo) {
|
|
19084
|
-
console.log(
|
|
19109
|
+
console.log(chalk147.dim(noCommitsMessage(!!lastInfo)));
|
|
19085
19110
|
}
|
|
19086
19111
|
|
|
19087
19112
|
// src/commands/devlog/next/index.ts
|
|
@@ -19122,11 +19147,11 @@ function next2(options2) {
|
|
|
19122
19147
|
import { execSync as execSync38 } from "child_process";
|
|
19123
19148
|
|
|
19124
19149
|
// src/commands/devlog/repos/printReposTable.ts
|
|
19125
|
-
import
|
|
19150
|
+
import chalk148 from "chalk";
|
|
19126
19151
|
function colorStatus(status3) {
|
|
19127
|
-
if (status3 === "missing") return
|
|
19128
|
-
if (status3 === "outdated") return
|
|
19129
|
-
return
|
|
19152
|
+
if (status3 === "missing") return chalk148.red(status3);
|
|
19153
|
+
if (status3 === "outdated") return chalk148.yellow(status3);
|
|
19154
|
+
return chalk148.green(status3);
|
|
19130
19155
|
}
|
|
19131
19156
|
function formatRow(row, nameWidth) {
|
|
19132
19157
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -19140,8 +19165,8 @@ function printReposTable(rows) {
|
|
|
19140
19165
|
"Last Devlog".padEnd(11),
|
|
19141
19166
|
"Status"
|
|
19142
19167
|
].join(" ");
|
|
19143
|
-
console.log(
|
|
19144
|
-
console.log(
|
|
19168
|
+
console.log(chalk148.dim(header));
|
|
19169
|
+
console.log(chalk148.dim("-".repeat(header.length)));
|
|
19145
19170
|
for (const row of rows) {
|
|
19146
19171
|
console.log(formatRow(row, nameWidth));
|
|
19147
19172
|
}
|
|
@@ -19199,14 +19224,14 @@ function repos(options2) {
|
|
|
19199
19224
|
// src/commands/devlog/skip.ts
|
|
19200
19225
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
19201
19226
|
import { join as join43 } from "path";
|
|
19202
|
-
import
|
|
19227
|
+
import chalk149 from "chalk";
|
|
19203
19228
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
19204
19229
|
function getBlogConfigPath() {
|
|
19205
19230
|
return join43(BLOG_REPO_ROOT, "assist.yml");
|
|
19206
19231
|
}
|
|
19207
19232
|
function skip(date) {
|
|
19208
19233
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
19209
|
-
console.log(
|
|
19234
|
+
console.log(chalk149.red("Invalid date format. Use YYYY-MM-DD"));
|
|
19210
19235
|
process.exit(1);
|
|
19211
19236
|
}
|
|
19212
19237
|
const repoName = getRepoName();
|
|
@@ -19217,7 +19242,7 @@ function skip(date) {
|
|
|
19217
19242
|
const skipDays = skip2[repoName] ?? [];
|
|
19218
19243
|
if (skipDays.includes(date)) {
|
|
19219
19244
|
console.log(
|
|
19220
|
-
|
|
19245
|
+
chalk149.yellow(`${date} is already in skip list for ${repoName}`)
|
|
19221
19246
|
);
|
|
19222
19247
|
return;
|
|
19223
19248
|
}
|
|
@@ -19227,20 +19252,20 @@ function skip(date) {
|
|
|
19227
19252
|
devlog.skip = skip2;
|
|
19228
19253
|
config.devlog = devlog;
|
|
19229
19254
|
writeFileSync29(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
19230
|
-
console.log(
|
|
19255
|
+
console.log(chalk149.green(`Added ${date} to skip list for ${repoName}`));
|
|
19231
19256
|
}
|
|
19232
19257
|
|
|
19233
19258
|
// src/commands/devlog/version.ts
|
|
19234
|
-
import
|
|
19259
|
+
import chalk150 from "chalk";
|
|
19235
19260
|
function version() {
|
|
19236
19261
|
const config = loadConfig();
|
|
19237
19262
|
const name = getRepoName();
|
|
19238
19263
|
const lastInfo = getLastVersionInfo(name, config);
|
|
19239
19264
|
const lastVersion = lastInfo?.version ?? null;
|
|
19240
19265
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
19241
|
-
console.log(`${
|
|
19242
|
-
console.log(`${
|
|
19243
|
-
console.log(`${
|
|
19266
|
+
console.log(`${chalk150.bold("name:")} ${name}`);
|
|
19267
|
+
console.log(`${chalk150.bold("last:")} ${lastVersion ?? chalk150.dim("none")}`);
|
|
19268
|
+
console.log(`${chalk150.bold("next:")} ${nextVersion ?? chalk150.dim("none")}`);
|
|
19244
19269
|
}
|
|
19245
19270
|
|
|
19246
19271
|
// src/commands/registerDevlog.ts
|
|
@@ -19265,7 +19290,7 @@ function registerDevlog(program2) {
|
|
|
19265
19290
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
19266
19291
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync5 } from "fs";
|
|
19267
19292
|
import { join as join44 } from "path";
|
|
19268
|
-
import
|
|
19293
|
+
import chalk151 from "chalk";
|
|
19269
19294
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
19270
19295
|
function isLockedDll(debugDir) {
|
|
19271
19296
|
let files;
|
|
@@ -19312,14 +19337,14 @@ function checkBuildLocks(startDir) {
|
|
|
19312
19337
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
19313
19338
|
if (locked) {
|
|
19314
19339
|
console.error(
|
|
19315
|
-
|
|
19340
|
+
chalk151.red("Build output locked (is VS debugging?): ") + locked
|
|
19316
19341
|
);
|
|
19317
19342
|
process.exit(1);
|
|
19318
19343
|
}
|
|
19319
19344
|
}
|
|
19320
19345
|
async function checkBuildLocksCommand() {
|
|
19321
19346
|
checkBuildLocks();
|
|
19322
|
-
console.log(
|
|
19347
|
+
console.log(chalk151.green("No build locks detected"));
|
|
19323
19348
|
}
|
|
19324
19349
|
|
|
19325
19350
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -19418,30 +19443,30 @@ function escapeRegex(s) {
|
|
|
19418
19443
|
}
|
|
19419
19444
|
|
|
19420
19445
|
// src/commands/dotnet/printTree.ts
|
|
19421
|
-
import
|
|
19446
|
+
import chalk152 from "chalk";
|
|
19422
19447
|
function printNodes(nodes, prefix2) {
|
|
19423
19448
|
for (let i = 0; i < nodes.length; i++) {
|
|
19424
19449
|
const isLast = i === nodes.length - 1;
|
|
19425
19450
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
19426
19451
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
19427
19452
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
19428
|
-
const label2 = isMissing ?
|
|
19453
|
+
const label2 = isMissing ? chalk152.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
19429
19454
|
console.log(`${prefix2}${connector}${label2}`);
|
|
19430
19455
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
19431
19456
|
}
|
|
19432
19457
|
}
|
|
19433
19458
|
function printTree(tree, totalCount, solutions) {
|
|
19434
|
-
console.log(
|
|
19435
|
-
console.log(
|
|
19459
|
+
console.log(chalk152.bold("\nProject Dependency Tree"));
|
|
19460
|
+
console.log(chalk152.cyan(tree.relativePath));
|
|
19436
19461
|
printNodes(tree.children, "");
|
|
19437
|
-
console.log(
|
|
19462
|
+
console.log(chalk152.dim(`
|
|
19438
19463
|
${totalCount} projects total (including root)`));
|
|
19439
|
-
console.log(
|
|
19464
|
+
console.log(chalk152.bold("\nSolution Membership"));
|
|
19440
19465
|
if (solutions.length === 0) {
|
|
19441
|
-
console.log(
|
|
19466
|
+
console.log(chalk152.yellow(" Not found in any .sln"));
|
|
19442
19467
|
} else {
|
|
19443
19468
|
for (const sln of solutions) {
|
|
19444
|
-
console.log(` ${
|
|
19469
|
+
console.log(` ${chalk152.green(sln)}`);
|
|
19445
19470
|
}
|
|
19446
19471
|
}
|
|
19447
19472
|
console.log();
|
|
@@ -19470,16 +19495,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
19470
19495
|
// src/commands/dotnet/resolveCsproj.ts
|
|
19471
19496
|
import { existsSync as existsSync41 } from "fs";
|
|
19472
19497
|
import path36 from "path";
|
|
19473
|
-
import
|
|
19498
|
+
import chalk153 from "chalk";
|
|
19474
19499
|
function resolveCsproj(csprojPath) {
|
|
19475
19500
|
const resolved = path36.resolve(csprojPath);
|
|
19476
19501
|
if (!existsSync41(resolved)) {
|
|
19477
|
-
console.error(
|
|
19502
|
+
console.error(chalk153.red(`File not found: ${resolved}`));
|
|
19478
19503
|
process.exit(1);
|
|
19479
19504
|
}
|
|
19480
19505
|
const repoRoot2 = findRepoRoot(path36.dirname(resolved));
|
|
19481
19506
|
if (!repoRoot2) {
|
|
19482
|
-
console.error(
|
|
19507
|
+
console.error(chalk153.red("Could not find git repository root"));
|
|
19483
19508
|
process.exit(1);
|
|
19484
19509
|
}
|
|
19485
19510
|
return { resolved, repoRoot: repoRoot2 };
|
|
@@ -19529,12 +19554,12 @@ function getChangedCsFiles(scope) {
|
|
|
19529
19554
|
}
|
|
19530
19555
|
|
|
19531
19556
|
// src/commands/dotnet/inSln.ts
|
|
19532
|
-
import
|
|
19557
|
+
import chalk154 from "chalk";
|
|
19533
19558
|
async function inSln(csprojPath) {
|
|
19534
19559
|
const { resolved, repoRoot: repoRoot2 } = resolveCsproj(csprojPath);
|
|
19535
19560
|
const solutions = findContainingSolutions(resolved, repoRoot2);
|
|
19536
19561
|
if (solutions.length === 0) {
|
|
19537
|
-
console.log(
|
|
19562
|
+
console.log(chalk154.yellow("Not found in any .sln file"));
|
|
19538
19563
|
process.exit(1);
|
|
19539
19564
|
}
|
|
19540
19565
|
for (const sln of solutions) {
|
|
@@ -19543,7 +19568,7 @@ async function inSln(csprojPath) {
|
|
|
19543
19568
|
}
|
|
19544
19569
|
|
|
19545
19570
|
// src/commands/dotnet/inspect.ts
|
|
19546
|
-
import
|
|
19571
|
+
import chalk160 from "chalk";
|
|
19547
19572
|
|
|
19548
19573
|
// src/shared/formatElapsed.ts
|
|
19549
19574
|
function formatElapsed(ms) {
|
|
@@ -19555,12 +19580,12 @@ function formatElapsed(ms) {
|
|
|
19555
19580
|
}
|
|
19556
19581
|
|
|
19557
19582
|
// src/commands/dotnet/displayIssues.ts
|
|
19558
|
-
import
|
|
19583
|
+
import chalk155 from "chalk";
|
|
19559
19584
|
var SEVERITY_COLOR = {
|
|
19560
|
-
ERROR:
|
|
19561
|
-
WARNING:
|
|
19562
|
-
SUGGESTION:
|
|
19563
|
-
HINT:
|
|
19585
|
+
ERROR: chalk155.red,
|
|
19586
|
+
WARNING: chalk155.yellow,
|
|
19587
|
+
SUGGESTION: chalk155.cyan,
|
|
19588
|
+
HINT: chalk155.dim
|
|
19564
19589
|
};
|
|
19565
19590
|
function groupByFile(issues) {
|
|
19566
19591
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -19576,15 +19601,15 @@ function groupByFile(issues) {
|
|
|
19576
19601
|
}
|
|
19577
19602
|
function displayIssues(issues) {
|
|
19578
19603
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
19579
|
-
console.log(
|
|
19604
|
+
console.log(chalk155.bold(file));
|
|
19580
19605
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
19581
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
19606
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk155.white;
|
|
19582
19607
|
console.log(
|
|
19583
|
-
` ${
|
|
19608
|
+
` ${chalk155.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
19584
19609
|
);
|
|
19585
19610
|
}
|
|
19586
19611
|
}
|
|
19587
|
-
console.log(
|
|
19612
|
+
console.log(chalk155.dim(`
|
|
19588
19613
|
${issues.length} issue(s) found`));
|
|
19589
19614
|
}
|
|
19590
19615
|
|
|
@@ -19643,12 +19668,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
19643
19668
|
// src/commands/dotnet/resolveSolution.ts
|
|
19644
19669
|
import { existsSync as existsSync42 } from "fs";
|
|
19645
19670
|
import path37 from "path";
|
|
19646
|
-
import
|
|
19671
|
+
import chalk157 from "chalk";
|
|
19647
19672
|
|
|
19648
19673
|
// src/commands/dotnet/findSolution.ts
|
|
19649
19674
|
import { readdirSync as readdirSync7 } from "fs";
|
|
19650
19675
|
import { dirname as dirname24, join as join45 } from "path";
|
|
19651
|
-
import
|
|
19676
|
+
import chalk156 from "chalk";
|
|
19652
19677
|
function findSlnInDir(dir) {
|
|
19653
19678
|
try {
|
|
19654
19679
|
return readdirSync7(dir).filter((f) => f.endsWith(".sln")).map((f) => join45(dir, f));
|
|
@@ -19664,17 +19689,17 @@ function findSolution() {
|
|
|
19664
19689
|
const slnFiles = findSlnInDir(current);
|
|
19665
19690
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
19666
19691
|
if (slnFiles.length > 1) {
|
|
19667
|
-
console.error(
|
|
19692
|
+
console.error(chalk156.red(`Multiple .sln files found in ${current}:`));
|
|
19668
19693
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
19669
19694
|
console.error(
|
|
19670
|
-
|
|
19695
|
+
chalk156.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
19671
19696
|
);
|
|
19672
19697
|
process.exit(1);
|
|
19673
19698
|
}
|
|
19674
19699
|
if (current === ceiling) break;
|
|
19675
19700
|
current = dirname24(current);
|
|
19676
19701
|
}
|
|
19677
|
-
console.error(
|
|
19702
|
+
console.error(chalk156.red("No .sln file found between cwd and repo root"));
|
|
19678
19703
|
process.exit(1);
|
|
19679
19704
|
}
|
|
19680
19705
|
|
|
@@ -19683,7 +19708,7 @@ function resolveSolution(sln) {
|
|
|
19683
19708
|
if (sln) {
|
|
19684
19709
|
const resolved = path37.resolve(sln);
|
|
19685
19710
|
if (!existsSync42(resolved)) {
|
|
19686
|
-
console.error(
|
|
19711
|
+
console.error(chalk157.red(`Solution file not found: ${resolved}`));
|
|
19687
19712
|
process.exit(1);
|
|
19688
19713
|
}
|
|
19689
19714
|
return resolved;
|
|
@@ -19725,14 +19750,14 @@ import { execSync as execSync40 } from "child_process";
|
|
|
19725
19750
|
import { existsSync as existsSync43, readFileSync as readFileSync36, unlinkSync as unlinkSync10 } from "fs";
|
|
19726
19751
|
import { tmpdir as tmpdir4 } from "os";
|
|
19727
19752
|
import path38 from "path";
|
|
19728
|
-
import
|
|
19753
|
+
import chalk158 from "chalk";
|
|
19729
19754
|
function assertJbInstalled() {
|
|
19730
19755
|
try {
|
|
19731
19756
|
execSync40("jb inspectcode --version", { stdio: "pipe" });
|
|
19732
19757
|
} catch {
|
|
19733
|
-
console.error(
|
|
19758
|
+
console.error(chalk158.red("jb is not installed. Install with:"));
|
|
19734
19759
|
console.error(
|
|
19735
|
-
|
|
19760
|
+
chalk158.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
19736
19761
|
);
|
|
19737
19762
|
process.exit(1);
|
|
19738
19763
|
}
|
|
@@ -19750,11 +19775,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
19750
19775
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
19751
19776
|
process.stderr.write(error.stderr);
|
|
19752
19777
|
}
|
|
19753
|
-
console.error(
|
|
19778
|
+
console.error(chalk158.red("jb inspectcode failed"));
|
|
19754
19779
|
process.exit(1);
|
|
19755
19780
|
}
|
|
19756
19781
|
if (!existsSync43(reportPath)) {
|
|
19757
|
-
console.error(
|
|
19782
|
+
console.error(chalk158.red("Report file not generated"));
|
|
19758
19783
|
process.exit(1);
|
|
19759
19784
|
}
|
|
19760
19785
|
const xml = readFileSync36(reportPath, "utf8");
|
|
@@ -19764,7 +19789,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
19764
19789
|
|
|
19765
19790
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
19766
19791
|
import { execSync as execSync41 } from "child_process";
|
|
19767
|
-
import
|
|
19792
|
+
import chalk159 from "chalk";
|
|
19768
19793
|
function resolveMsbuildPath() {
|
|
19769
19794
|
const { run: run4 } = loadConfig();
|
|
19770
19795
|
const configs = resolveRunConfigs(run4, runConfigBaseDir());
|
|
@@ -19776,9 +19801,9 @@ function assertMsbuildInstalled() {
|
|
|
19776
19801
|
try {
|
|
19777
19802
|
execSync41(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
19778
19803
|
} catch {
|
|
19779
|
-
console.error(
|
|
19804
|
+
console.error(chalk159.red(`msbuild not found at: ${msbuild}`));
|
|
19780
19805
|
console.error(
|
|
19781
|
-
|
|
19806
|
+
chalk159.yellow(
|
|
19782
19807
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
19783
19808
|
)
|
|
19784
19809
|
);
|
|
@@ -19825,17 +19850,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
19825
19850
|
// src/commands/dotnet/inspect.ts
|
|
19826
19851
|
function logScope(changedFiles2) {
|
|
19827
19852
|
if (changedFiles2 === null) {
|
|
19828
|
-
console.log(
|
|
19853
|
+
console.log(chalk160.dim("Inspecting full solution..."));
|
|
19829
19854
|
} else {
|
|
19830
19855
|
console.log(
|
|
19831
|
-
|
|
19856
|
+
chalk160.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
19832
19857
|
);
|
|
19833
19858
|
}
|
|
19834
19859
|
}
|
|
19835
19860
|
function reportResults(issues, elapsed) {
|
|
19836
19861
|
if (issues.length > 0) displayIssues(issues);
|
|
19837
|
-
else console.log(
|
|
19838
|
-
console.log(
|
|
19862
|
+
else console.log(chalk160.green("No issues found"));
|
|
19863
|
+
console.log(chalk160.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
19839
19864
|
if (issues.length > 0) process.exit(1);
|
|
19840
19865
|
}
|
|
19841
19866
|
async function inspect(sln, options2) {
|
|
@@ -19846,7 +19871,7 @@ async function inspect(sln, options2) {
|
|
|
19846
19871
|
const scope = parseScope(options2.scope);
|
|
19847
19872
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
19848
19873
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
19849
|
-
console.log(
|
|
19874
|
+
console.log(chalk160.green("No changed .cs files found"));
|
|
19850
19875
|
return;
|
|
19851
19876
|
}
|
|
19852
19877
|
logScope(changedFiles2);
|
|
@@ -20256,25 +20281,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
20256
20281
|
}
|
|
20257
20282
|
|
|
20258
20283
|
// src/commands/github/printCountTable.ts
|
|
20259
|
-
import
|
|
20284
|
+
import chalk161 from "chalk";
|
|
20260
20285
|
function printCountTable(labelHeader, rows) {
|
|
20261
20286
|
const labelWidth = Math.max(
|
|
20262
20287
|
labelHeader.length,
|
|
20263
20288
|
...rows.map((row) => row.label.length)
|
|
20264
20289
|
);
|
|
20265
20290
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
20266
|
-
console.log(
|
|
20267
|
-
console.log(
|
|
20291
|
+
console.log(chalk161.dim(header));
|
|
20292
|
+
console.log(chalk161.dim("-".repeat(header.length)));
|
|
20268
20293
|
for (const row of rows) {
|
|
20269
20294
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
20270
20295
|
}
|
|
20271
20296
|
}
|
|
20272
20297
|
|
|
20273
20298
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
20274
|
-
import
|
|
20299
|
+
import chalk162 from "chalk";
|
|
20275
20300
|
function printRepoAuthorBreakdown(repos2) {
|
|
20276
20301
|
for (const repo of repos2) {
|
|
20277
|
-
console.log(
|
|
20302
|
+
console.log(chalk162.bold(repo.name));
|
|
20278
20303
|
const authorWidth = Math.max(
|
|
20279
20304
|
0,
|
|
20280
20305
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -20592,7 +20617,7 @@ function registerHandover(program2) {
|
|
|
20592
20617
|
}
|
|
20593
20618
|
|
|
20594
20619
|
// src/commands/jira/acceptanceCriteria.ts
|
|
20595
|
-
import
|
|
20620
|
+
import chalk163 from "chalk";
|
|
20596
20621
|
|
|
20597
20622
|
// src/commands/jira/adfToText.ts
|
|
20598
20623
|
function renderInline(node) {
|
|
@@ -20659,7 +20684,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
20659
20684
|
const parsed = fetchIssue(issueKey, field);
|
|
20660
20685
|
const acValue = parsed?.fields?.[field];
|
|
20661
20686
|
if (!acValue) {
|
|
20662
|
-
console.log(
|
|
20687
|
+
console.log(chalk163.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
20663
20688
|
return;
|
|
20664
20689
|
}
|
|
20665
20690
|
if (typeof acValue === "string") {
|
|
@@ -20725,14 +20750,14 @@ async function jiraAuth() {
|
|
|
20725
20750
|
}
|
|
20726
20751
|
|
|
20727
20752
|
// src/commands/jira/viewIssue.ts
|
|
20728
|
-
import
|
|
20753
|
+
import chalk164 from "chalk";
|
|
20729
20754
|
function viewIssue(issueKey) {
|
|
20730
20755
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
20731
20756
|
const fields = parsed?.fields;
|
|
20732
20757
|
const summary = fields?.summary;
|
|
20733
20758
|
const description = fields?.description;
|
|
20734
20759
|
if (summary) {
|
|
20735
|
-
console.log(
|
|
20760
|
+
console.log(chalk164.bold(summary));
|
|
20736
20761
|
}
|
|
20737
20762
|
if (description) {
|
|
20738
20763
|
if (summary) console.log();
|
|
@@ -20746,7 +20771,7 @@ function viewIssue(issueKey) {
|
|
|
20746
20771
|
}
|
|
20747
20772
|
if (!summary && !description) {
|
|
20748
20773
|
console.log(
|
|
20749
|
-
|
|
20774
|
+
chalk164.yellow(`No summary or description found on ${issueKey}.`)
|
|
20750
20775
|
);
|
|
20751
20776
|
}
|
|
20752
20777
|
}
|
|
@@ -20781,7 +20806,7 @@ import { randomUUID as randomUUID6 } from "crypto";
|
|
|
20781
20806
|
|
|
20782
20807
|
// src/commands/review/checkoutPr.ts
|
|
20783
20808
|
import { execFileSync as execFileSync7 } from "child_process";
|
|
20784
|
-
import
|
|
20809
|
+
import chalk165 from "chalk";
|
|
20785
20810
|
|
|
20786
20811
|
// src/commands/sessions/daemon/daemonLog.ts
|
|
20787
20812
|
var RING_CAPACITY = 1e3;
|
|
@@ -21389,7 +21414,7 @@ async function checkoutPr(number) {
|
|
|
21389
21414
|
try {
|
|
21390
21415
|
execFileSync7("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
21391
21416
|
} catch {
|
|
21392
|
-
console.error(
|
|
21417
|
+
console.error(chalk165.red(`gh pr checkout ${number} failed; aborting.`));
|
|
21393
21418
|
process.exit(1);
|
|
21394
21419
|
}
|
|
21395
21420
|
}
|
|
@@ -21526,15 +21551,15 @@ function registerList(program2) {
|
|
|
21526
21551
|
// src/commands/mermaid/index.ts
|
|
21527
21552
|
import { mkdirSync as mkdirSync17, readdirSync as readdirSync9 } from "fs";
|
|
21528
21553
|
import { resolve as resolve16 } from "path";
|
|
21529
|
-
import
|
|
21554
|
+
import chalk168 from "chalk";
|
|
21530
21555
|
|
|
21531
21556
|
// src/commands/mermaid/exportFile.ts
|
|
21532
21557
|
import { readFileSync as readFileSync38, writeFileSync as writeFileSync31 } from "fs";
|
|
21533
21558
|
import { basename as basename16, extname as extname2, resolve as resolve15 } from "path";
|
|
21534
|
-
import
|
|
21559
|
+
import chalk167 from "chalk";
|
|
21535
21560
|
|
|
21536
21561
|
// src/commands/mermaid/renderBlock.ts
|
|
21537
|
-
import
|
|
21562
|
+
import chalk166 from "chalk";
|
|
21538
21563
|
async function renderBlock(krokiUrl, source) {
|
|
21539
21564
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
21540
21565
|
method: "POST",
|
|
@@ -21543,7 +21568,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
21543
21568
|
});
|
|
21544
21569
|
if (!response.ok) {
|
|
21545
21570
|
console.error(
|
|
21546
|
-
|
|
21571
|
+
chalk166.red(
|
|
21547
21572
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
21548
21573
|
)
|
|
21549
21574
|
);
|
|
@@ -21561,19 +21586,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
21561
21586
|
if (onlyIndex !== void 0) {
|
|
21562
21587
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
21563
21588
|
console.error(
|
|
21564
|
-
|
|
21589
|
+
chalk167.red(
|
|
21565
21590
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
21566
21591
|
)
|
|
21567
21592
|
);
|
|
21568
21593
|
process.exit(1);
|
|
21569
21594
|
}
|
|
21570
21595
|
console.log(
|
|
21571
|
-
|
|
21596
|
+
chalk167.gray(
|
|
21572
21597
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
21573
21598
|
)
|
|
21574
21599
|
);
|
|
21575
21600
|
} else {
|
|
21576
|
-
console.log(
|
|
21601
|
+
console.log(chalk167.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
21577
21602
|
}
|
|
21578
21603
|
for (const [i, source] of blocks.entries()) {
|
|
21579
21604
|
const idx = i + 1;
|
|
@@ -21581,7 +21606,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
21581
21606
|
const outPath = resolve15(outDir, `${stem}-${idx}.svg`);
|
|
21582
21607
|
const svg = await renderBlock(krokiUrl, source);
|
|
21583
21608
|
writeFileSync31(outPath, svg, "utf8");
|
|
21584
|
-
console.log(
|
|
21609
|
+
console.log(chalk167.green(` \u2192 ${outPath}`));
|
|
21585
21610
|
}
|
|
21586
21611
|
}
|
|
21587
21612
|
function extractMermaidBlocks(markdown) {
|
|
@@ -21597,18 +21622,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
21597
21622
|
if (options2.index !== void 0) {
|
|
21598
21623
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
21599
21624
|
console.error(
|
|
21600
|
-
|
|
21625
|
+
chalk168.red(`--index must be a positive integer (got ${options2.index})`)
|
|
21601
21626
|
);
|
|
21602
21627
|
process.exit(1);
|
|
21603
21628
|
}
|
|
21604
21629
|
if (!file) {
|
|
21605
|
-
console.error(
|
|
21630
|
+
console.error(chalk168.red("--index requires a file argument"));
|
|
21606
21631
|
process.exit(1);
|
|
21607
21632
|
}
|
|
21608
21633
|
}
|
|
21609
21634
|
const files = file ? [file] : readdirSync9(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
21610
21635
|
if (files.length === 0) {
|
|
21611
|
-
console.log(
|
|
21636
|
+
console.log(chalk168.gray("No markdown files found in current directory."));
|
|
21612
21637
|
return;
|
|
21613
21638
|
}
|
|
21614
21639
|
for (const f of files) {
|
|
@@ -21635,7 +21660,7 @@ function registerMermaid(program2) {
|
|
|
21635
21660
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
21636
21661
|
import { createServer as createServer2 } from "http";
|
|
21637
21662
|
import { dirname as dirname28 } from "path";
|
|
21638
|
-
import
|
|
21663
|
+
import chalk170 from "chalk";
|
|
21639
21664
|
|
|
21640
21665
|
// src/commands/netcap/corsHeaders.ts
|
|
21641
21666
|
var corsHeaders = {
|
|
@@ -21714,7 +21739,7 @@ function createNetcapHandler(options2) {
|
|
|
21714
21739
|
import { cp, readFile as readFile4, writeFile as writeFile4 } from "fs/promises";
|
|
21715
21740
|
import { networkInterfaces } from "os";
|
|
21716
21741
|
import { join as join54 } from "path";
|
|
21717
|
-
import
|
|
21742
|
+
import chalk169 from "chalk";
|
|
21718
21743
|
|
|
21719
21744
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
21720
21745
|
import { dirname as dirname27, join as join53 } from "path";
|
|
@@ -21758,7 +21783,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
21758
21783
|
const host = lanIPv4();
|
|
21759
21784
|
if (!host) {
|
|
21760
21785
|
console.log(
|
|
21761
|
-
|
|
21786
|
+
chalk169.yellow("could not determine the WSL IP for the extension")
|
|
21762
21787
|
);
|
|
21763
21788
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
21764
21789
|
return source;
|
|
@@ -21769,7 +21794,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
21769
21794
|
return WSL_WINDOWS_PATH;
|
|
21770
21795
|
} catch {
|
|
21771
21796
|
console.log(
|
|
21772
|
-
|
|
21797
|
+
chalk169.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
21773
21798
|
);
|
|
21774
21799
|
return source;
|
|
21775
21800
|
}
|
|
@@ -21802,30 +21827,30 @@ async function netcap(options2) {
|
|
|
21802
21827
|
let count8 = 0;
|
|
21803
21828
|
const handler = createNetcapHandler({
|
|
21804
21829
|
outPath,
|
|
21805
|
-
onPing: () => console.log(
|
|
21830
|
+
onPing: () => console.log(chalk170.dim("ping from extension")),
|
|
21806
21831
|
onCapture: (entry) => {
|
|
21807
21832
|
count8 += 1;
|
|
21808
21833
|
console.log(
|
|
21809
|
-
|
|
21810
|
-
|
|
21834
|
+
chalk170.green(`captured #${count8}`),
|
|
21835
|
+
chalk170.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
21811
21836
|
);
|
|
21812
21837
|
}
|
|
21813
21838
|
});
|
|
21814
21839
|
const server = createServer2(handler);
|
|
21815
21840
|
server.listen(port, () => {
|
|
21816
21841
|
console.log(
|
|
21817
|
-
|
|
21842
|
+
chalk170.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
21818
21843
|
);
|
|
21819
|
-
console.log(
|
|
21844
|
+
console.log(chalk170.dim(`appending captures to ${outPath}`));
|
|
21820
21845
|
if (filter)
|
|
21821
|
-
console.log(
|
|
21822
|
-
console.log(
|
|
21823
|
-
console.log(
|
|
21846
|
+
console.log(chalk170.dim(`forwarding only URLs matching "${filter}"`));
|
|
21847
|
+
console.log(chalk170.dim(`load the unpacked extension from ${extensionPath}`));
|
|
21848
|
+
console.log(chalk170.dim("press Ctrl-C to stop"));
|
|
21824
21849
|
});
|
|
21825
21850
|
process.on("SIGINT", () => {
|
|
21826
21851
|
server.close();
|
|
21827
21852
|
console.log(
|
|
21828
|
-
|
|
21853
|
+
chalk170.bold(
|
|
21829
21854
|
`
|
|
21830
21855
|
netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
21831
21856
|
)
|
|
@@ -21837,7 +21862,7 @@ netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} t
|
|
|
21837
21862
|
// src/commands/netcap/netcapExtract.ts
|
|
21838
21863
|
import { writeFileSync as writeFileSync32 } from "fs";
|
|
21839
21864
|
import { join as join57 } from "path";
|
|
21840
|
-
import
|
|
21865
|
+
import chalk171 from "chalk";
|
|
21841
21866
|
|
|
21842
21867
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
21843
21868
|
import { readFileSync as readFileSync39 } from "fs";
|
|
@@ -22285,8 +22310,8 @@ function netcapExtract(file) {
|
|
|
22285
22310
|
writeFileSync32(outFile, `${JSON.stringify(posts, null, 2)}
|
|
22286
22311
|
`);
|
|
22287
22312
|
console.log(
|
|
22288
|
-
|
|
22289
|
-
|
|
22313
|
+
chalk171.green(`extracted ${posts.length} posts`),
|
|
22314
|
+
chalk171.dim(`-> ${outFile}`)
|
|
22290
22315
|
);
|
|
22291
22316
|
}
|
|
22292
22317
|
|
|
@@ -22307,7 +22332,7 @@ function registerNetcap(program2) {
|
|
|
22307
22332
|
}
|
|
22308
22333
|
|
|
22309
22334
|
// src/commands/news/add/index.ts
|
|
22310
|
-
import
|
|
22335
|
+
import chalk172 from "chalk";
|
|
22311
22336
|
import enquirer8 from "enquirer";
|
|
22312
22337
|
async function add2(url) {
|
|
22313
22338
|
if (!url) {
|
|
@@ -22329,10 +22354,10 @@ async function add2(url) {
|
|
|
22329
22354
|
const { orm } = await getReady();
|
|
22330
22355
|
const added = await addFeed(orm, url);
|
|
22331
22356
|
if (!added) {
|
|
22332
|
-
console.log(
|
|
22357
|
+
console.log(chalk172.yellow("Feed already exists"));
|
|
22333
22358
|
return;
|
|
22334
22359
|
}
|
|
22335
|
-
console.log(
|
|
22360
|
+
console.log(chalk172.green(`Added feed: ${url}`));
|
|
22336
22361
|
}
|
|
22337
22362
|
|
|
22338
22363
|
// src/commands/registerNews.ts
|
|
@@ -22379,7 +22404,7 @@ function registerPiHook(program2) {
|
|
|
22379
22404
|
}
|
|
22380
22405
|
|
|
22381
22406
|
// src/commands/prompts/printPromptsTable.ts
|
|
22382
|
-
import
|
|
22407
|
+
import chalk173 from "chalk";
|
|
22383
22408
|
function truncate(str, max) {
|
|
22384
22409
|
if (str.length <= max) return str;
|
|
22385
22410
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -22397,14 +22422,14 @@ function printPromptsTable(rows) {
|
|
|
22397
22422
|
"Command".padEnd(commandWidth),
|
|
22398
22423
|
"Repos"
|
|
22399
22424
|
].join(" ");
|
|
22400
|
-
console.log(
|
|
22401
|
-
console.log(
|
|
22425
|
+
console.log(chalk173.dim(header));
|
|
22426
|
+
console.log(chalk173.dim("-".repeat(header.length)));
|
|
22402
22427
|
for (const row of rows) {
|
|
22403
22428
|
const count8 = String(row.count).padStart(countWidth);
|
|
22404
22429
|
const tool = row.tool.padEnd(toolWidth);
|
|
22405
22430
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
22406
22431
|
console.log(
|
|
22407
|
-
`${
|
|
22432
|
+
`${chalk173.yellow(count8)} ${tool} ${command} ${chalk173.dim(row.repos)}`
|
|
22408
22433
|
);
|
|
22409
22434
|
}
|
|
22410
22435
|
}
|
|
@@ -23070,13 +23095,13 @@ function agentFooter(unresolvedCount) {
|
|
|
23070
23095
|
}
|
|
23071
23096
|
|
|
23072
23097
|
// src/commands/prs/listComments/commentStyle.ts
|
|
23073
|
-
import
|
|
23098
|
+
import chalk174 from "chalk";
|
|
23074
23099
|
var plain = (text18) => text18;
|
|
23075
23100
|
function colouredState(state) {
|
|
23076
23101
|
const label2 = `[${state}]`;
|
|
23077
|
-
if (state === "APPROVED") return
|
|
23078
|
-
if (state === "CHANGES_REQUESTED") return
|
|
23079
|
-
return
|
|
23102
|
+
if (state === "APPROVED") return chalk174.green(label2);
|
|
23103
|
+
if (state === "CHANGES_REQUESTED") return chalk174.red(label2);
|
|
23104
|
+
return chalk174.yellow(label2);
|
|
23080
23105
|
}
|
|
23081
23106
|
function commentStyle() {
|
|
23082
23107
|
if (isClaudeCode()) {
|
|
@@ -23090,9 +23115,9 @@ function commentStyle() {
|
|
|
23090
23115
|
};
|
|
23091
23116
|
}
|
|
23092
23117
|
return {
|
|
23093
|
-
cyan:
|
|
23094
|
-
bold:
|
|
23095
|
-
dim:
|
|
23118
|
+
cyan: chalk174.cyan,
|
|
23119
|
+
bold: chalk174.bold,
|
|
23120
|
+
dim: chalk174.dim,
|
|
23096
23121
|
state: colouredState,
|
|
23097
23122
|
diffHunk: true,
|
|
23098
23123
|
agent: false
|
|
@@ -23262,13 +23287,13 @@ import { execSync as execSync48 } from "child_process";
|
|
|
23262
23287
|
import enquirer9 from "enquirer";
|
|
23263
23288
|
|
|
23264
23289
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
23265
|
-
import
|
|
23290
|
+
import chalk175 from "chalk";
|
|
23266
23291
|
var STATUS_MAP = {
|
|
23267
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
23268
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
23292
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk175.magenta("merged"), date: pr.mergedAt } : null,
|
|
23293
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk175.red("closed"), date: pr.closedAt } : null
|
|
23269
23294
|
};
|
|
23270
23295
|
function defaultStatus(pr) {
|
|
23271
|
-
return { label:
|
|
23296
|
+
return { label: chalk175.green("opened"), date: pr.createdAt };
|
|
23272
23297
|
}
|
|
23273
23298
|
function getStatus2(pr) {
|
|
23274
23299
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -23277,11 +23302,11 @@ function formatDate(dateStr) {
|
|
|
23277
23302
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
23278
23303
|
}
|
|
23279
23304
|
function formatPrHeader(pr, status3) {
|
|
23280
|
-
return `${
|
|
23305
|
+
return `${chalk175.cyan(`#${pr.number}`)} ${pr.title} ${chalk175.dim(`(${pr.author.login},`)} ${status3.label} ${chalk175.dim(`${formatDate(status3.date)})`)}`;
|
|
23281
23306
|
}
|
|
23282
23307
|
function logPrDetails(pr) {
|
|
23283
23308
|
console.log(
|
|
23284
|
-
|
|
23309
|
+
chalk175.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
23285
23310
|
);
|
|
23286
23311
|
console.log();
|
|
23287
23312
|
}
|
|
@@ -23637,7 +23662,8 @@ async function previewAndPlace(args) {
|
|
|
23637
23662
|
draft: args.options.draft === true
|
|
23638
23663
|
});
|
|
23639
23664
|
const body = appendScreenshots(args.body, decision.screenshots ?? []);
|
|
23640
|
-
|
|
23665
|
+
const options2 = decision.draft === void 0 ? args.options : { ...args.options, draft: decision.draft };
|
|
23666
|
+
await placePr(args.prNumber, args.title, body, options2);
|
|
23641
23667
|
await chainAfterRaise(args.prNumber, decision);
|
|
23642
23668
|
}
|
|
23643
23669
|
|
|
@@ -23993,10 +24019,10 @@ function registerPrs(program2) {
|
|
|
23993
24019
|
}
|
|
23994
24020
|
|
|
23995
24021
|
// src/commands/ravendb/ravendbAuth.ts
|
|
23996
|
-
import
|
|
24022
|
+
import chalk181 from "chalk";
|
|
23997
24023
|
|
|
23998
24024
|
// src/shared/createConnectionAuth.ts
|
|
23999
|
-
import
|
|
24025
|
+
import chalk176 from "chalk";
|
|
24000
24026
|
function listConnections(connections, format) {
|
|
24001
24027
|
if (connections.length === 0) {
|
|
24002
24028
|
console.log("No connections configured.");
|
|
@@ -24009,7 +24035,7 @@ function listConnections(connections, format) {
|
|
|
24009
24035
|
function removeConnection(connections, name, save) {
|
|
24010
24036
|
const filtered = connections.filter((c) => c.name !== name);
|
|
24011
24037
|
if (filtered.length === connections.length) {
|
|
24012
|
-
console.error(
|
|
24038
|
+
console.error(chalk176.red(`Connection "${name}" not found.`));
|
|
24013
24039
|
process.exit(1);
|
|
24014
24040
|
}
|
|
24015
24041
|
save(filtered);
|
|
@@ -24055,15 +24081,15 @@ function saveConnections(connections) {
|
|
|
24055
24081
|
}
|
|
24056
24082
|
|
|
24057
24083
|
// src/commands/ravendb/promptConnection.ts
|
|
24058
|
-
import
|
|
24084
|
+
import chalk179 from "chalk";
|
|
24059
24085
|
|
|
24060
24086
|
// src/commands/ravendb/selectOpSecret.ts
|
|
24061
|
-
import
|
|
24087
|
+
import chalk178 from "chalk";
|
|
24062
24088
|
import Enquirer2 from "enquirer";
|
|
24063
24089
|
|
|
24064
24090
|
// src/commands/ravendb/searchItems.ts
|
|
24065
24091
|
import { execSync as execSync51 } from "child_process";
|
|
24066
|
-
import
|
|
24092
|
+
import chalk177 from "chalk";
|
|
24067
24093
|
function opExec(args) {
|
|
24068
24094
|
return execSync51(`op ${args}`, {
|
|
24069
24095
|
encoding: "utf8",
|
|
@@ -24076,7 +24102,7 @@ function searchItems(search2) {
|
|
|
24076
24102
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
24077
24103
|
} catch {
|
|
24078
24104
|
console.error(
|
|
24079
|
-
|
|
24105
|
+
chalk177.red(
|
|
24080
24106
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
24081
24107
|
)
|
|
24082
24108
|
);
|
|
@@ -24090,7 +24116,7 @@ function getItemFields(itemId2) {
|
|
|
24090
24116
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
24091
24117
|
return item.fields.filter((f) => f.reference && f.label);
|
|
24092
24118
|
} catch {
|
|
24093
|
-
console.error(
|
|
24119
|
+
console.error(chalk177.red("Failed to get item details from 1Password."));
|
|
24094
24120
|
process.exit(1);
|
|
24095
24121
|
}
|
|
24096
24122
|
}
|
|
@@ -24109,7 +24135,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
24109
24135
|
}).run();
|
|
24110
24136
|
const items2 = searchItems(search2);
|
|
24111
24137
|
if (items2.length === 0) {
|
|
24112
|
-
console.error(
|
|
24138
|
+
console.error(chalk178.red(`No items found matching "${search2}".`));
|
|
24113
24139
|
process.exit(1);
|
|
24114
24140
|
}
|
|
24115
24141
|
const itemId2 = await selectOne(
|
|
@@ -24118,7 +24144,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
24118
24144
|
);
|
|
24119
24145
|
const fields = getItemFields(itemId2);
|
|
24120
24146
|
if (fields.length === 0) {
|
|
24121
|
-
console.error(
|
|
24147
|
+
console.error(chalk178.red("No fields with references found on this item."));
|
|
24122
24148
|
process.exit(1);
|
|
24123
24149
|
}
|
|
24124
24150
|
const ref = await selectOne(
|
|
@@ -24132,7 +24158,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
24132
24158
|
async function promptConnection(existingNames) {
|
|
24133
24159
|
const name = await promptInput("name", "Connection name:");
|
|
24134
24160
|
if (existingNames.includes(name)) {
|
|
24135
|
-
console.error(
|
|
24161
|
+
console.error(chalk179.red(`Connection "${name}" already exists.`));
|
|
24136
24162
|
process.exit(1);
|
|
24137
24163
|
}
|
|
24138
24164
|
const url = await promptInput(
|
|
@@ -24141,22 +24167,22 @@ async function promptConnection(existingNames) {
|
|
|
24141
24167
|
);
|
|
24142
24168
|
const database = await promptInput("database", "Database name:");
|
|
24143
24169
|
if (!name || !url || !database) {
|
|
24144
|
-
console.error(
|
|
24170
|
+
console.error(chalk179.red("All fields are required."));
|
|
24145
24171
|
process.exit(1);
|
|
24146
24172
|
}
|
|
24147
24173
|
const apiKeyRef = await selectOpSecret();
|
|
24148
|
-
console.log(
|
|
24174
|
+
console.log(chalk179.dim(`Using: ${apiKeyRef}`));
|
|
24149
24175
|
return { name, url, database, apiKeyRef };
|
|
24150
24176
|
}
|
|
24151
24177
|
|
|
24152
24178
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
24153
|
-
import
|
|
24179
|
+
import chalk180 from "chalk";
|
|
24154
24180
|
function ravendbSetConnection(name) {
|
|
24155
24181
|
const raw = loadGlobalConfigRaw();
|
|
24156
24182
|
const ravendb = raw.ravendb ?? {};
|
|
24157
24183
|
const connections = ravendb.connections ?? [];
|
|
24158
24184
|
if (!connections.some((c) => c.name === name)) {
|
|
24159
|
-
console.error(
|
|
24185
|
+
console.error(chalk180.red(`Connection "${name}" not found.`));
|
|
24160
24186
|
console.error(
|
|
24161
24187
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
24162
24188
|
);
|
|
@@ -24172,16 +24198,16 @@ function ravendbSetConnection(name) {
|
|
|
24172
24198
|
var ravendbAuth = createConnectionAuth({
|
|
24173
24199
|
load: loadConnections,
|
|
24174
24200
|
save: saveConnections,
|
|
24175
|
-
format: (c) => `${
|
|
24201
|
+
format: (c) => `${chalk181.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
24176
24202
|
promptNew: promptConnection,
|
|
24177
24203
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
24178
24204
|
});
|
|
24179
24205
|
|
|
24180
24206
|
// src/commands/ravendb/ravendbCollections.ts
|
|
24181
|
-
import
|
|
24207
|
+
import chalk185 from "chalk";
|
|
24182
24208
|
|
|
24183
24209
|
// src/commands/ravendb/ravenFetch.ts
|
|
24184
|
-
import
|
|
24210
|
+
import chalk183 from "chalk";
|
|
24185
24211
|
|
|
24186
24212
|
// src/commands/ravendb/getAccessToken.ts
|
|
24187
24213
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -24218,10 +24244,10 @@ ${errorText}`
|
|
|
24218
24244
|
|
|
24219
24245
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
24220
24246
|
import { execSync as execSync52 } from "child_process";
|
|
24221
|
-
import
|
|
24247
|
+
import chalk182 from "chalk";
|
|
24222
24248
|
function resolveOpSecret(reference) {
|
|
24223
24249
|
if (!reference.startsWith("op://")) {
|
|
24224
|
-
console.error(
|
|
24250
|
+
console.error(chalk182.red(`Invalid secret reference: must start with op://`));
|
|
24225
24251
|
process.exit(1);
|
|
24226
24252
|
}
|
|
24227
24253
|
try {
|
|
@@ -24231,7 +24257,7 @@ function resolveOpSecret(reference) {
|
|
|
24231
24257
|
}).trim();
|
|
24232
24258
|
} catch {
|
|
24233
24259
|
console.error(
|
|
24234
|
-
|
|
24260
|
+
chalk182.red(
|
|
24235
24261
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
24236
24262
|
)
|
|
24237
24263
|
);
|
|
@@ -24258,7 +24284,7 @@ async function ravenFetch(connection, path77) {
|
|
|
24258
24284
|
if (!response.ok) {
|
|
24259
24285
|
const body = await response.text();
|
|
24260
24286
|
console.error(
|
|
24261
|
-
|
|
24287
|
+
chalk183.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
24262
24288
|
);
|
|
24263
24289
|
console.error(body.substring(0, 500));
|
|
24264
24290
|
process.exit(1);
|
|
@@ -24267,7 +24293,7 @@ async function ravenFetch(connection, path77) {
|
|
|
24267
24293
|
}
|
|
24268
24294
|
|
|
24269
24295
|
// src/commands/ravendb/resolveConnection.ts
|
|
24270
|
-
import
|
|
24296
|
+
import chalk184 from "chalk";
|
|
24271
24297
|
function loadRavendb() {
|
|
24272
24298
|
const raw = loadGlobalConfigRaw();
|
|
24273
24299
|
const ravendb = raw.ravendb;
|
|
@@ -24281,7 +24307,7 @@ function resolveConnection(name) {
|
|
|
24281
24307
|
const connectionName = name ?? defaultConnection;
|
|
24282
24308
|
if (!connectionName) {
|
|
24283
24309
|
console.error(
|
|
24284
|
-
|
|
24310
|
+
chalk184.red(
|
|
24285
24311
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
24286
24312
|
)
|
|
24287
24313
|
);
|
|
@@ -24289,7 +24315,7 @@ function resolveConnection(name) {
|
|
|
24289
24315
|
}
|
|
24290
24316
|
const connection = connections.find((c) => c.name === connectionName);
|
|
24291
24317
|
if (!connection) {
|
|
24292
|
-
console.error(
|
|
24318
|
+
console.error(chalk184.red(`Connection "${connectionName}" not found.`));
|
|
24293
24319
|
console.error(
|
|
24294
24320
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
24295
24321
|
);
|
|
@@ -24320,15 +24346,15 @@ async function ravendbCollections(connectionName) {
|
|
|
24320
24346
|
return;
|
|
24321
24347
|
}
|
|
24322
24348
|
for (const c of collections) {
|
|
24323
|
-
console.log(`${
|
|
24349
|
+
console.log(`${chalk185.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
24324
24350
|
}
|
|
24325
24351
|
}
|
|
24326
24352
|
|
|
24327
24353
|
// src/commands/ravendb/ravendbQuery.ts
|
|
24328
|
-
import
|
|
24354
|
+
import chalk187 from "chalk";
|
|
24329
24355
|
|
|
24330
24356
|
// src/commands/ravendb/fetchAllPages.ts
|
|
24331
|
-
import
|
|
24357
|
+
import chalk186 from "chalk";
|
|
24332
24358
|
|
|
24333
24359
|
// src/commands/ravendb/buildQueryPath.ts
|
|
24334
24360
|
function buildQueryPath(opts) {
|
|
@@ -24366,7 +24392,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
24366
24392
|
allResults.push(...results);
|
|
24367
24393
|
start3 += results.length;
|
|
24368
24394
|
process.stderr.write(
|
|
24369
|
-
`\r${
|
|
24395
|
+
`\r${chalk186.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
24370
24396
|
);
|
|
24371
24397
|
if (start3 >= totalResults) break;
|
|
24372
24398
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -24381,7 +24407,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
24381
24407
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
24382
24408
|
const resolved = resolveArgs(connectionName, collection);
|
|
24383
24409
|
if (!resolved.collection && !options2.query) {
|
|
24384
|
-
console.error(
|
|
24410
|
+
console.error(chalk187.red("Provide a collection name or --query filter."));
|
|
24385
24411
|
process.exit(1);
|
|
24386
24412
|
}
|
|
24387
24413
|
const { collection: col } = resolved;
|
|
@@ -24420,7 +24446,7 @@ import { spawn as spawn6 } from "child_process";
|
|
|
24420
24446
|
import * as path39 from "path";
|
|
24421
24447
|
|
|
24422
24448
|
// src/commands/refactor/logViolations.ts
|
|
24423
|
-
import
|
|
24449
|
+
import chalk188 from "chalk";
|
|
24424
24450
|
var DEFAULT_MAX_LINES2 = 100;
|
|
24425
24451
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
24426
24452
|
if (violations.length === 0) {
|
|
@@ -24429,43 +24455,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
24429
24455
|
}
|
|
24430
24456
|
return;
|
|
24431
24457
|
}
|
|
24432
|
-
console.error(
|
|
24458
|
+
console.error(chalk188.red(`
|
|
24433
24459
|
Refactor check failed:
|
|
24434
24460
|
`));
|
|
24435
|
-
console.error(
|
|
24461
|
+
console.error(chalk188.red(` The following files exceed ${maxLines} lines:
|
|
24436
24462
|
`));
|
|
24437
24463
|
for (const violation of violations) {
|
|
24438
|
-
console.error(
|
|
24464
|
+
console.error(chalk188.red(` ${violation.file} (${violation.lines} lines)`));
|
|
24439
24465
|
}
|
|
24440
24466
|
console.error(
|
|
24441
|
-
|
|
24467
|
+
chalk188.yellow(
|
|
24442
24468
|
`
|
|
24443
24469
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
24444
24470
|
way to refactor it, ignore it with:
|
|
24445
24471
|
`
|
|
24446
24472
|
)
|
|
24447
24473
|
);
|
|
24448
|
-
console.error(
|
|
24474
|
+
console.error(chalk188.gray(` assist refactor ignore <file>
|
|
24449
24475
|
`));
|
|
24450
24476
|
if (process.env.CLAUDECODE) {
|
|
24451
|
-
console.error(
|
|
24477
|
+
console.error(chalk188.cyan(`
|
|
24452
24478
|
## Extracting Code to New Files
|
|
24453
24479
|
`));
|
|
24454
24480
|
console.error(
|
|
24455
|
-
|
|
24481
|
+
chalk188.cyan(
|
|
24456
24482
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
24457
24483
|
`
|
|
24458
24484
|
)
|
|
24459
24485
|
);
|
|
24460
24486
|
console.error(
|
|
24461
|
-
|
|
24487
|
+
chalk188.cyan(
|
|
24462
24488
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
24463
24489
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
24464
24490
|
`
|
|
24465
24491
|
)
|
|
24466
24492
|
);
|
|
24467
24493
|
console.error(
|
|
24468
|
-
|
|
24494
|
+
chalk188.cyan(
|
|
24469
24495
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
24470
24496
|
domains, move it to a common/shared folder.
|
|
24471
24497
|
`
|
|
@@ -24621,7 +24647,7 @@ async function check(pattern2, options2) {
|
|
|
24621
24647
|
|
|
24622
24648
|
// src/commands/refactor/extract/index.ts
|
|
24623
24649
|
import path47 from "path";
|
|
24624
|
-
import
|
|
24650
|
+
import chalk191 from "chalk";
|
|
24625
24651
|
|
|
24626
24652
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
24627
24653
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -25220,23 +25246,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
25220
25246
|
|
|
25221
25247
|
// src/commands/refactor/extract/displayPlan.ts
|
|
25222
25248
|
import path43 from "path";
|
|
25223
|
-
import
|
|
25249
|
+
import chalk189 from "chalk";
|
|
25224
25250
|
function section2(title) {
|
|
25225
25251
|
return `
|
|
25226
|
-
${
|
|
25252
|
+
${chalk189.cyan(title)}`;
|
|
25227
25253
|
}
|
|
25228
25254
|
function displayImporters(plan2, cwd) {
|
|
25229
25255
|
if (plan2.importersToUpdate.length === 0) return;
|
|
25230
25256
|
console.log(section2("Update importers:"));
|
|
25231
25257
|
for (const imp of plan2.importersToUpdate) {
|
|
25232
25258
|
const rel = path43.relative(cwd, imp.file.getFilePath());
|
|
25233
|
-
console.log(` ${
|
|
25259
|
+
console.log(` ${chalk189.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
25234
25260
|
}
|
|
25235
25261
|
}
|
|
25236
25262
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
25237
|
-
console.log(
|
|
25263
|
+
console.log(chalk189.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
25238
25264
|
`));
|
|
25239
|
-
console.log(` ${
|
|
25265
|
+
console.log(` ${chalk189.cyan("Functions to move:")}`);
|
|
25240
25266
|
for (const name of plan2.extractedNames) {
|
|
25241
25267
|
console.log(` ${name}`);
|
|
25242
25268
|
}
|
|
@@ -25270,7 +25296,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
25270
25296
|
|
|
25271
25297
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
25272
25298
|
import path46 from "path";
|
|
25273
|
-
import
|
|
25299
|
+
import chalk190 from "chalk";
|
|
25274
25300
|
import { Project as Project4 } from "ts-morph";
|
|
25275
25301
|
|
|
25276
25302
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -25362,7 +25388,7 @@ function loadProjectFile(file) {
|
|
|
25362
25388
|
});
|
|
25363
25389
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
25364
25390
|
if (!sourceFile) {
|
|
25365
|
-
console.log(
|
|
25391
|
+
console.log(chalk190.red(`File not found in project: ${file}`));
|
|
25366
25392
|
process.exit(1);
|
|
25367
25393
|
}
|
|
25368
25394
|
return { project, sourceFile };
|
|
@@ -25385,19 +25411,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
25385
25411
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
25386
25412
|
if (options2.apply) {
|
|
25387
25413
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
25388
|
-
console.log(
|
|
25414
|
+
console.log(chalk191.green("\nExtraction complete"));
|
|
25389
25415
|
} else {
|
|
25390
|
-
console.log(
|
|
25416
|
+
console.log(chalk191.dim("\nDry run. Use --apply to execute."));
|
|
25391
25417
|
}
|
|
25392
25418
|
}
|
|
25393
25419
|
|
|
25394
25420
|
// src/commands/refactor/ignore.ts
|
|
25395
25421
|
import fs31 from "fs";
|
|
25396
|
-
import
|
|
25422
|
+
import chalk192 from "chalk";
|
|
25397
25423
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
25398
25424
|
function ignore2(file) {
|
|
25399
25425
|
if (!fs31.existsSync(file)) {
|
|
25400
|
-
console.error(
|
|
25426
|
+
console.error(chalk192.red(`Error: File does not exist: ${file}`));
|
|
25401
25427
|
process.exit(1);
|
|
25402
25428
|
}
|
|
25403
25429
|
const content = fs31.readFileSync(file, "utf8");
|
|
@@ -25413,7 +25439,7 @@ function ignore2(file) {
|
|
|
25413
25439
|
fs31.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
25414
25440
|
}
|
|
25415
25441
|
console.log(
|
|
25416
|
-
|
|
25442
|
+
chalk192.green(
|
|
25417
25443
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
25418
25444
|
)
|
|
25419
25445
|
);
|
|
@@ -25422,12 +25448,12 @@ function ignore2(file) {
|
|
|
25422
25448
|
// src/commands/refactor/rename/index.ts
|
|
25423
25449
|
import fs34 from "fs";
|
|
25424
25450
|
import path52 from "path";
|
|
25425
|
-
import
|
|
25451
|
+
import chalk195 from "chalk";
|
|
25426
25452
|
|
|
25427
25453
|
// src/commands/refactor/rename/applyRename.ts
|
|
25428
25454
|
import fs33 from "fs";
|
|
25429
25455
|
import path49 from "path";
|
|
25430
|
-
import
|
|
25456
|
+
import chalk193 from "chalk";
|
|
25431
25457
|
|
|
25432
25458
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
25433
25459
|
import path48 from "path";
|
|
@@ -25532,13 +25558,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
25532
25558
|
const updatedContents = applyRewrites(rewrites);
|
|
25533
25559
|
for (const [file, content] of updatedContents) {
|
|
25534
25560
|
fs33.writeFileSync(file, content, "utf8");
|
|
25535
|
-
console.log(
|
|
25561
|
+
console.log(chalk193.cyan(` Updated imports in ${path49.relative(cwd, file)}`));
|
|
25536
25562
|
}
|
|
25537
25563
|
const destDir = path49.dirname(destPath);
|
|
25538
25564
|
if (!fs33.existsSync(destDir)) fs33.mkdirSync(destDir, { recursive: true });
|
|
25539
25565
|
fs33.renameSync(sourcePath, destPath);
|
|
25540
25566
|
console.log(
|
|
25541
|
-
|
|
25567
|
+
chalk193.white(
|
|
25542
25568
|
` Moved ${path49.relative(cwd, sourcePath)} \u2192 ${path49.relative(cwd, destPath)}`
|
|
25543
25569
|
)
|
|
25544
25570
|
);
|
|
@@ -25625,16 +25651,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
25625
25651
|
|
|
25626
25652
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
25627
25653
|
import path51 from "path";
|
|
25628
|
-
import
|
|
25654
|
+
import chalk194 from "chalk";
|
|
25629
25655
|
function printRenamePreview(rewrites, cwd) {
|
|
25630
25656
|
for (const rewrite of rewrites) {
|
|
25631
25657
|
console.log(
|
|
25632
|
-
|
|
25658
|
+
chalk194.dim(
|
|
25633
25659
|
` ${path51.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
25634
25660
|
)
|
|
25635
25661
|
);
|
|
25636
25662
|
}
|
|
25637
|
-
console.log(
|
|
25663
|
+
console.log(chalk194.dim("Dry run. Use --apply to execute."));
|
|
25638
25664
|
}
|
|
25639
25665
|
|
|
25640
25666
|
// src/commands/refactor/rename/index.ts
|
|
@@ -25645,20 +25671,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
25645
25671
|
const relSource = path52.relative(cwd, sourcePath);
|
|
25646
25672
|
const relDest = path52.relative(cwd, destPath);
|
|
25647
25673
|
if (!fs34.existsSync(sourcePath)) {
|
|
25648
|
-
console.log(
|
|
25674
|
+
console.log(chalk195.red(`File not found: ${source}`));
|
|
25649
25675
|
process.exit(1);
|
|
25650
25676
|
}
|
|
25651
25677
|
if (destPath !== sourcePath && fs34.existsSync(destPath)) {
|
|
25652
|
-
console.log(
|
|
25678
|
+
console.log(chalk195.red(`Destination already exists: ${destination}`));
|
|
25653
25679
|
process.exit(1);
|
|
25654
25680
|
}
|
|
25655
|
-
console.log(
|
|
25656
|
-
console.log(
|
|
25657
|
-
console.log(
|
|
25681
|
+
console.log(chalk195.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
25682
|
+
console.log(chalk195.dim("Loading project..."));
|
|
25683
|
+
console.log(chalk195.dim("Scanning imports across the project..."));
|
|
25658
25684
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
25659
25685
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
25660
25686
|
console.log(
|
|
25661
|
-
|
|
25687
|
+
chalk195.dim(
|
|
25662
25688
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
25663
25689
|
)
|
|
25664
25690
|
);
|
|
@@ -25667,11 +25693,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
25667
25693
|
return;
|
|
25668
25694
|
}
|
|
25669
25695
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
25670
|
-
console.log(
|
|
25696
|
+
console.log(chalk195.green("Done"));
|
|
25671
25697
|
}
|
|
25672
25698
|
|
|
25673
25699
|
// src/commands/refactor/renameSymbol/index.ts
|
|
25674
|
-
import
|
|
25700
|
+
import chalk196 from "chalk";
|
|
25675
25701
|
|
|
25676
25702
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
25677
25703
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -25717,33 +25743,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
25717
25743
|
const { project, sourceFile } = loadProjectFile(file);
|
|
25718
25744
|
const symbol = findSymbol(sourceFile, oldName);
|
|
25719
25745
|
if (!symbol) {
|
|
25720
|
-
console.log(
|
|
25746
|
+
console.log(chalk196.red(`Symbol "${oldName}" not found in ${file}`));
|
|
25721
25747
|
process.exit(1);
|
|
25722
25748
|
}
|
|
25723
25749
|
const grouped = groupReferences(symbol, cwd);
|
|
25724
25750
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
25725
25751
|
console.log(
|
|
25726
|
-
|
|
25752
|
+
chalk196.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
25727
25753
|
`)
|
|
25728
25754
|
);
|
|
25729
25755
|
for (const [refFile, lines2] of grouped) {
|
|
25730
25756
|
console.log(
|
|
25731
|
-
` ${
|
|
25757
|
+
` ${chalk196.dim(refFile)}: lines ${chalk196.cyan(lines2.join(", "))}`
|
|
25732
25758
|
);
|
|
25733
25759
|
}
|
|
25734
25760
|
if (options2.apply) {
|
|
25735
25761
|
symbol.rename(newName);
|
|
25736
25762
|
await project.save();
|
|
25737
|
-
console.log(
|
|
25763
|
+
console.log(chalk196.green(`
|
|
25738
25764
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
25739
25765
|
} else {
|
|
25740
|
-
console.log(
|
|
25766
|
+
console.log(chalk196.dim("\nDry run. Use --apply to execute."));
|
|
25741
25767
|
}
|
|
25742
25768
|
}
|
|
25743
25769
|
|
|
25744
25770
|
// src/commands/refactor/restructure/index.ts
|
|
25745
25771
|
import path60 from "path";
|
|
25746
|
-
import
|
|
25772
|
+
import chalk199 from "chalk";
|
|
25747
25773
|
|
|
25748
25774
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
25749
25775
|
import path54 from "path";
|
|
@@ -25822,50 +25848,50 @@ function clusterFiles(graph) {
|
|
|
25822
25848
|
|
|
25823
25849
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
25824
25850
|
import path56 from "path";
|
|
25825
|
-
import
|
|
25851
|
+
import chalk197 from "chalk";
|
|
25826
25852
|
function relPath(filePath) {
|
|
25827
25853
|
return path56.relative(process.cwd(), filePath);
|
|
25828
25854
|
}
|
|
25829
25855
|
function displayMoves(plan2) {
|
|
25830
25856
|
if (plan2.moves.length === 0) return;
|
|
25831
|
-
console.log(
|
|
25857
|
+
console.log(chalk197.bold("\nFile moves:"));
|
|
25832
25858
|
for (const move2 of plan2.moves) {
|
|
25833
25859
|
console.log(
|
|
25834
|
-
` ${
|
|
25860
|
+
` ${chalk197.red(relPath(move2.from))} \u2192 ${chalk197.green(relPath(move2.to))}`
|
|
25835
25861
|
);
|
|
25836
|
-
console.log(
|
|
25862
|
+
console.log(chalk197.dim(` ${move2.reason}`));
|
|
25837
25863
|
}
|
|
25838
25864
|
}
|
|
25839
25865
|
function displayRewrites(rewrites) {
|
|
25840
25866
|
if (rewrites.length === 0) return;
|
|
25841
25867
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
25842
|
-
console.log(
|
|
25868
|
+
console.log(chalk197.bold(`
|
|
25843
25869
|
Import rewrites (${affectedFiles.size} files):`));
|
|
25844
25870
|
for (const file of affectedFiles) {
|
|
25845
|
-
console.log(` ${
|
|
25871
|
+
console.log(` ${chalk197.cyan(relPath(file))}:`);
|
|
25846
25872
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
25847
25873
|
(r) => r.file === file
|
|
25848
25874
|
)) {
|
|
25849
25875
|
console.log(
|
|
25850
|
-
` ${
|
|
25876
|
+
` ${chalk197.red(`"${oldSpecifier}"`)} \u2192 ${chalk197.green(`"${newSpecifier}"`)}`
|
|
25851
25877
|
);
|
|
25852
25878
|
}
|
|
25853
25879
|
}
|
|
25854
25880
|
}
|
|
25855
25881
|
function displayPlan2(plan2) {
|
|
25856
25882
|
if (plan2.warnings.length > 0) {
|
|
25857
|
-
console.log(
|
|
25858
|
-
for (const w of plan2.warnings) console.log(
|
|
25883
|
+
console.log(chalk197.yellow("\nWarnings:"));
|
|
25884
|
+
for (const w of plan2.warnings) console.log(chalk197.yellow(` ${w}`));
|
|
25859
25885
|
}
|
|
25860
25886
|
if (plan2.newDirectories.length > 0) {
|
|
25861
|
-
console.log(
|
|
25887
|
+
console.log(chalk197.bold("\nNew directories:"));
|
|
25862
25888
|
for (const dir of plan2.newDirectories)
|
|
25863
|
-
console.log(
|
|
25889
|
+
console.log(chalk197.green(` ${dir}/`));
|
|
25864
25890
|
}
|
|
25865
25891
|
displayMoves(plan2);
|
|
25866
25892
|
displayRewrites(plan2.rewrites);
|
|
25867
25893
|
console.log(
|
|
25868
|
-
|
|
25894
|
+
chalk197.dim(
|
|
25869
25895
|
`
|
|
25870
25896
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
25871
25897
|
)
|
|
@@ -25875,18 +25901,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
25875
25901
|
// src/commands/refactor/restructure/executePlan.ts
|
|
25876
25902
|
import fs35 from "fs";
|
|
25877
25903
|
import path57 from "path";
|
|
25878
|
-
import
|
|
25904
|
+
import chalk198 from "chalk";
|
|
25879
25905
|
function executePlan(plan2) {
|
|
25880
25906
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
25881
25907
|
for (const [file, content] of updatedContents) {
|
|
25882
25908
|
fs35.writeFileSync(file, content, "utf8");
|
|
25883
25909
|
console.log(
|
|
25884
|
-
|
|
25910
|
+
chalk198.cyan(` Rewrote imports in ${path57.relative(process.cwd(), file)}`)
|
|
25885
25911
|
);
|
|
25886
25912
|
}
|
|
25887
25913
|
for (const dir of plan2.newDirectories) {
|
|
25888
25914
|
fs35.mkdirSync(dir, { recursive: true });
|
|
25889
|
-
console.log(
|
|
25915
|
+
console.log(chalk198.green(` Created ${path57.relative(process.cwd(), dir)}/`));
|
|
25890
25916
|
}
|
|
25891
25917
|
for (const move2 of plan2.moves) {
|
|
25892
25918
|
const targetDir = path57.dirname(move2.to);
|
|
@@ -25895,7 +25921,7 @@ function executePlan(plan2) {
|
|
|
25895
25921
|
}
|
|
25896
25922
|
fs35.renameSync(move2.from, move2.to);
|
|
25897
25923
|
console.log(
|
|
25898
|
-
|
|
25924
|
+
chalk198.white(
|
|
25899
25925
|
` Moved ${path57.relative(process.cwd(), move2.from)} \u2192 ${path57.relative(process.cwd(), move2.to)}`
|
|
25900
25926
|
)
|
|
25901
25927
|
);
|
|
@@ -25910,7 +25936,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
25910
25936
|
if (entries.length === 0) {
|
|
25911
25937
|
fs35.rmdirSync(dir);
|
|
25912
25938
|
console.log(
|
|
25913
|
-
|
|
25939
|
+
chalk198.dim(
|
|
25914
25940
|
` Removed empty directory ${path57.relative(process.cwd(), dir)}`
|
|
25915
25941
|
)
|
|
25916
25942
|
);
|
|
@@ -26043,22 +26069,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
26043
26069
|
const targetPattern = pattern2 ?? "src";
|
|
26044
26070
|
const files = findSourceFiles2(targetPattern);
|
|
26045
26071
|
if (files.length === 0) {
|
|
26046
|
-
console.log(
|
|
26072
|
+
console.log(chalk199.yellow("No files found matching pattern"));
|
|
26047
26073
|
return;
|
|
26048
26074
|
}
|
|
26049
26075
|
const tsConfigPath = findTsConfig(path60.resolve(files[0]));
|
|
26050
26076
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
26051
26077
|
if (plan2.moves.length === 0) {
|
|
26052
|
-
console.log(
|
|
26078
|
+
console.log(chalk199.green("No restructuring needed"));
|
|
26053
26079
|
return;
|
|
26054
26080
|
}
|
|
26055
26081
|
displayPlan2(plan2);
|
|
26056
26082
|
if (options2.apply) {
|
|
26057
|
-
console.log(
|
|
26083
|
+
console.log(chalk199.bold("\nApplying changes..."));
|
|
26058
26084
|
executePlan(plan2);
|
|
26059
|
-
console.log(
|
|
26085
|
+
console.log(chalk199.green("\nRestructuring complete"));
|
|
26060
26086
|
} else {
|
|
26061
|
-
console.log(
|
|
26087
|
+
console.log(chalk199.dim("\nDry run. Use --apply to execute."));
|
|
26062
26088
|
}
|
|
26063
26089
|
}
|
|
26064
26090
|
|
|
@@ -26716,18 +26742,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
26716
26742
|
}
|
|
26717
26743
|
|
|
26718
26744
|
// src/commands/review/warnOutOfDiff.ts
|
|
26719
|
-
import
|
|
26745
|
+
import chalk200 from "chalk";
|
|
26720
26746
|
function warnOutOfDiff(outOfDiff) {
|
|
26721
26747
|
if (outOfDiff.length === 0) return;
|
|
26722
26748
|
console.warn(
|
|
26723
|
-
|
|
26749
|
+
chalk200.yellow(
|
|
26724
26750
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
26725
26751
|
)
|
|
26726
26752
|
);
|
|
26727
26753
|
for (const finding of outOfDiff) {
|
|
26728
26754
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
26729
26755
|
console.warn(
|
|
26730
|
-
` ${
|
|
26756
|
+
` ${chalk200.yellow("\xB7")} ${finding.title} ${chalk200.dim(
|
|
26731
26757
|
`(${finding.file}:${range})`
|
|
26732
26758
|
)}`
|
|
26733
26759
|
);
|
|
@@ -26751,18 +26777,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
26751
26777
|
}
|
|
26752
26778
|
|
|
26753
26779
|
// src/commands/review/warnUnlocated.ts
|
|
26754
|
-
import
|
|
26780
|
+
import chalk201 from "chalk";
|
|
26755
26781
|
function warnUnlocated(unlocated) {
|
|
26756
26782
|
if (unlocated.length === 0) return;
|
|
26757
26783
|
console.warn(
|
|
26758
|
-
|
|
26784
|
+
chalk201.yellow(
|
|
26759
26785
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
26760
26786
|
)
|
|
26761
26787
|
);
|
|
26762
26788
|
for (const finding of unlocated) {
|
|
26763
|
-
const where = finding.location ||
|
|
26789
|
+
const where = finding.location || chalk201.dim("missing");
|
|
26764
26790
|
console.warn(
|
|
26765
|
-
` ${
|
|
26791
|
+
` ${chalk201.yellow("\xB7")} ${finding.title} ${chalk201.dim(`(${where})`)}`
|
|
26766
26792
|
);
|
|
26767
26793
|
}
|
|
26768
26794
|
}
|
|
@@ -28017,7 +28043,7 @@ function registerReview(program2) {
|
|
|
28017
28043
|
}
|
|
28018
28044
|
|
|
28019
28045
|
// src/commands/seq/seqAuth.ts
|
|
28020
|
-
import
|
|
28046
|
+
import chalk203 from "chalk";
|
|
28021
28047
|
|
|
28022
28048
|
// src/commands/seq/loadConnections.ts
|
|
28023
28049
|
function loadConnections2() {
|
|
@@ -28046,10 +28072,10 @@ function setDefaultConnection(name) {
|
|
|
28046
28072
|
}
|
|
28047
28073
|
|
|
28048
28074
|
// src/shared/assertUniqueName.ts
|
|
28049
|
-
import
|
|
28075
|
+
import chalk202 from "chalk";
|
|
28050
28076
|
function assertUniqueName(existingNames, name) {
|
|
28051
28077
|
if (existingNames.includes(name)) {
|
|
28052
|
-
console.error(
|
|
28078
|
+
console.error(chalk202.red(`Connection "${name}" already exists.`));
|
|
28053
28079
|
process.exit(1);
|
|
28054
28080
|
}
|
|
28055
28081
|
}
|
|
@@ -28067,16 +28093,16 @@ async function promptConnection2(existingNames) {
|
|
|
28067
28093
|
var seqAuth = createConnectionAuth({
|
|
28068
28094
|
load: loadConnections2,
|
|
28069
28095
|
save: saveConnections2,
|
|
28070
|
-
format: (c) => `${
|
|
28096
|
+
format: (c) => `${chalk203.bold(c.name)} ${c.url}`,
|
|
28071
28097
|
promptNew: promptConnection2,
|
|
28072
28098
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
28073
28099
|
});
|
|
28074
28100
|
|
|
28075
28101
|
// src/commands/seq/seqQuery.ts
|
|
28076
|
-
import
|
|
28102
|
+
import chalk207 from "chalk";
|
|
28077
28103
|
|
|
28078
28104
|
// src/commands/seq/fetchSeq.ts
|
|
28079
|
-
import
|
|
28105
|
+
import chalk204 from "chalk";
|
|
28080
28106
|
async function fetchSeq(conn, path77, params) {
|
|
28081
28107
|
const url = `${conn.url}${path77}?${params}`;
|
|
28082
28108
|
const response = await fetch(url, {
|
|
@@ -28087,7 +28113,7 @@ async function fetchSeq(conn, path77, params) {
|
|
|
28087
28113
|
});
|
|
28088
28114
|
if (!response.ok) {
|
|
28089
28115
|
const body = await response.text();
|
|
28090
|
-
console.error(
|
|
28116
|
+
console.error(chalk204.red(`Seq returned ${response.status}: ${body}`));
|
|
28091
28117
|
process.exit(1);
|
|
28092
28118
|
}
|
|
28093
28119
|
return response;
|
|
@@ -28146,23 +28172,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
28146
28172
|
}
|
|
28147
28173
|
|
|
28148
28174
|
// src/commands/seq/formatEvent.ts
|
|
28149
|
-
import
|
|
28175
|
+
import chalk205 from "chalk";
|
|
28150
28176
|
function levelColor(level) {
|
|
28151
28177
|
switch (level) {
|
|
28152
28178
|
case "Fatal":
|
|
28153
|
-
return
|
|
28179
|
+
return chalk205.bgRed.white;
|
|
28154
28180
|
case "Error":
|
|
28155
|
-
return
|
|
28181
|
+
return chalk205.red;
|
|
28156
28182
|
case "Warning":
|
|
28157
|
-
return
|
|
28183
|
+
return chalk205.yellow;
|
|
28158
28184
|
case "Information":
|
|
28159
|
-
return
|
|
28185
|
+
return chalk205.cyan;
|
|
28160
28186
|
case "Debug":
|
|
28161
|
-
return
|
|
28187
|
+
return chalk205.gray;
|
|
28162
28188
|
case "Verbose":
|
|
28163
|
-
return
|
|
28189
|
+
return chalk205.dim;
|
|
28164
28190
|
default:
|
|
28165
|
-
return
|
|
28191
|
+
return chalk205.white;
|
|
28166
28192
|
}
|
|
28167
28193
|
}
|
|
28168
28194
|
function levelAbbrev(level) {
|
|
@@ -28203,12 +28229,12 @@ function formatTimestamp(iso) {
|
|
|
28203
28229
|
function formatEvent(event) {
|
|
28204
28230
|
const color = levelColor(event.Level);
|
|
28205
28231
|
const abbrev = levelAbbrev(event.Level);
|
|
28206
|
-
const ts8 =
|
|
28232
|
+
const ts8 = chalk205.dim(formatTimestamp(event.Timestamp));
|
|
28207
28233
|
const msg = renderMessage(event);
|
|
28208
28234
|
const lines2 = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
28209
28235
|
if (event.Exception) {
|
|
28210
28236
|
for (const line of event.Exception.split("\n")) {
|
|
28211
|
-
lines2.push(
|
|
28237
|
+
lines2.push(chalk205.red(` ${line}`));
|
|
28212
28238
|
}
|
|
28213
28239
|
}
|
|
28214
28240
|
return lines2.join("\n");
|
|
@@ -28241,11 +28267,11 @@ function rejectTimestampFilter(filter) {
|
|
|
28241
28267
|
}
|
|
28242
28268
|
|
|
28243
28269
|
// src/shared/resolveNamedConnection.ts
|
|
28244
|
-
import
|
|
28270
|
+
import chalk206 from "chalk";
|
|
28245
28271
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
28246
28272
|
if (connections.length === 0) {
|
|
28247
28273
|
console.error(
|
|
28248
|
-
|
|
28274
|
+
chalk206.red(
|
|
28249
28275
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
28250
28276
|
)
|
|
28251
28277
|
);
|
|
@@ -28254,7 +28280,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
28254
28280
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
28255
28281
|
const connection = connections.find((c) => c.name === target);
|
|
28256
28282
|
if (!connection) {
|
|
28257
|
-
console.error(
|
|
28283
|
+
console.error(chalk206.red(`${kind} connection "${target}" not found.`));
|
|
28258
28284
|
process.exit(1);
|
|
28259
28285
|
}
|
|
28260
28286
|
return connection;
|
|
@@ -28283,7 +28309,7 @@ async function seqQuery(filter, options2) {
|
|
|
28283
28309
|
new URLSearchParams({ filter, count: String(count8) })
|
|
28284
28310
|
);
|
|
28285
28311
|
if (events.length === 0) {
|
|
28286
|
-
console.log(
|
|
28312
|
+
console.log(chalk207.yellow("No events found."));
|
|
28287
28313
|
return;
|
|
28288
28314
|
}
|
|
28289
28315
|
if (options2.json) {
|
|
@@ -28294,11 +28320,11 @@ async function seqQuery(filter, options2) {
|
|
|
28294
28320
|
for (const event of chronological) {
|
|
28295
28321
|
console.log(formatEvent(event));
|
|
28296
28322
|
}
|
|
28297
|
-
console.log(
|
|
28323
|
+
console.log(chalk207.dim(`
|
|
28298
28324
|
${events.length} events`));
|
|
28299
28325
|
if (events.length >= count8) {
|
|
28300
28326
|
console.log(
|
|
28301
|
-
|
|
28327
|
+
chalk207.yellow(
|
|
28302
28328
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
28303
28329
|
)
|
|
28304
28330
|
);
|
|
@@ -28306,10 +28332,10 @@ ${events.length} events`));
|
|
|
28306
28332
|
}
|
|
28307
28333
|
|
|
28308
28334
|
// src/shared/setNamedDefaultConnection.ts
|
|
28309
|
-
import
|
|
28335
|
+
import chalk208 from "chalk";
|
|
28310
28336
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
28311
28337
|
if (!connections.find((c) => c.name === name)) {
|
|
28312
|
-
console.error(
|
|
28338
|
+
console.error(chalk208.red(`Connection "${name}" not found.`));
|
|
28313
28339
|
process.exit(1);
|
|
28314
28340
|
}
|
|
28315
28341
|
setDefault(name);
|
|
@@ -28358,7 +28384,7 @@ function registerSignal(program2) {
|
|
|
28358
28384
|
}
|
|
28359
28385
|
|
|
28360
28386
|
// src/commands/sql/sqlAuth.ts
|
|
28361
|
-
import
|
|
28387
|
+
import chalk210 from "chalk";
|
|
28362
28388
|
|
|
28363
28389
|
// src/commands/sql/loadConnections.ts
|
|
28364
28390
|
function loadConnections3() {
|
|
@@ -28387,7 +28413,7 @@ function setDefaultConnection2(name) {
|
|
|
28387
28413
|
}
|
|
28388
28414
|
|
|
28389
28415
|
// src/commands/sql/promptConnection.ts
|
|
28390
|
-
import
|
|
28416
|
+
import chalk209 from "chalk";
|
|
28391
28417
|
async function promptConnection3(existingNames) {
|
|
28392
28418
|
const name = await promptInput("name", "Connection name:", "default");
|
|
28393
28419
|
assertUniqueName(existingNames, name);
|
|
@@ -28395,7 +28421,7 @@ async function promptConnection3(existingNames) {
|
|
|
28395
28421
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
28396
28422
|
const port = Number.parseInt(portStr, 10);
|
|
28397
28423
|
if (!Number.isFinite(port)) {
|
|
28398
|
-
console.error(
|
|
28424
|
+
console.error(chalk209.red(`Invalid port "${portStr}".`));
|
|
28399
28425
|
process.exit(1);
|
|
28400
28426
|
}
|
|
28401
28427
|
const user = await promptInput("user", "User:");
|
|
@@ -28408,13 +28434,13 @@ async function promptConnection3(existingNames) {
|
|
|
28408
28434
|
var sqlAuth = createConnectionAuth({
|
|
28409
28435
|
load: loadConnections3,
|
|
28410
28436
|
save: saveConnections3,
|
|
28411
|
-
format: (c) => `${
|
|
28437
|
+
format: (c) => `${chalk210.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
28412
28438
|
promptNew: promptConnection3,
|
|
28413
28439
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
28414
28440
|
});
|
|
28415
28441
|
|
|
28416
28442
|
// src/commands/sql/printTable.ts
|
|
28417
|
-
import
|
|
28443
|
+
import chalk211 from "chalk";
|
|
28418
28444
|
function formatCell(value) {
|
|
28419
28445
|
if (value === null || value === void 0) return "";
|
|
28420
28446
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -28423,7 +28449,7 @@ function formatCell(value) {
|
|
|
28423
28449
|
}
|
|
28424
28450
|
function printTable(rows) {
|
|
28425
28451
|
if (rows.length === 0) {
|
|
28426
|
-
console.log(
|
|
28452
|
+
console.log(chalk211.yellow("(no rows)"));
|
|
28427
28453
|
return;
|
|
28428
28454
|
}
|
|
28429
28455
|
const columns = Object.keys(rows[0]);
|
|
@@ -28431,13 +28457,13 @@ function printTable(rows) {
|
|
|
28431
28457
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
28432
28458
|
);
|
|
28433
28459
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
28434
|
-
console.log(
|
|
28435
|
-
console.log(
|
|
28460
|
+
console.log(chalk211.dim(header));
|
|
28461
|
+
console.log(chalk211.dim("-".repeat(header.length)));
|
|
28436
28462
|
for (const row of rows) {
|
|
28437
28463
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
28438
28464
|
console.log(line);
|
|
28439
28465
|
}
|
|
28440
|
-
console.log(
|
|
28466
|
+
console.log(chalk211.dim(`
|
|
28441
28467
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
28442
28468
|
}
|
|
28443
28469
|
|
|
@@ -28497,7 +28523,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
28497
28523
|
}
|
|
28498
28524
|
|
|
28499
28525
|
// src/commands/sql/sqlMutate.ts
|
|
28500
|
-
import
|
|
28526
|
+
import chalk212 from "chalk";
|
|
28501
28527
|
|
|
28502
28528
|
// src/commands/sql/isMutation.ts
|
|
28503
28529
|
var MUTATION_KEYWORDS = [
|
|
@@ -28531,7 +28557,7 @@ function isMutation(sql25) {
|
|
|
28531
28557
|
async function sqlMutate(query, connectionName) {
|
|
28532
28558
|
if (!isMutation(query)) {
|
|
28533
28559
|
console.error(
|
|
28534
|
-
|
|
28560
|
+
chalk212.red(
|
|
28535
28561
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
28536
28562
|
)
|
|
28537
28563
|
);
|
|
@@ -28541,18 +28567,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
28541
28567
|
const pool = await sqlConnect(conn);
|
|
28542
28568
|
try {
|
|
28543
28569
|
const result = await pool.request().query(query);
|
|
28544
|
-
console.log(
|
|
28570
|
+
console.log(chalk212.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
28545
28571
|
} finally {
|
|
28546
28572
|
await pool.close();
|
|
28547
28573
|
}
|
|
28548
28574
|
}
|
|
28549
28575
|
|
|
28550
28576
|
// src/commands/sql/sqlQuery.ts
|
|
28551
|
-
import
|
|
28577
|
+
import chalk213 from "chalk";
|
|
28552
28578
|
async function sqlQuery(query, connectionName) {
|
|
28553
28579
|
if (isMutation(query)) {
|
|
28554
28580
|
console.error(
|
|
28555
|
-
|
|
28581
|
+
chalk213.red(
|
|
28556
28582
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
28557
28583
|
)
|
|
28558
28584
|
);
|
|
@@ -28567,7 +28593,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
28567
28593
|
printTable(rows);
|
|
28568
28594
|
} else {
|
|
28569
28595
|
console.log(
|
|
28570
|
-
|
|
28596
|
+
chalk213.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
28571
28597
|
);
|
|
28572
28598
|
}
|
|
28573
28599
|
} finally {
|
|
@@ -28712,7 +28738,7 @@ function reportPrune(label2, result, force) {
|
|
|
28712
28738
|
// src/commands/sync/syncClaudeMd.ts
|
|
28713
28739
|
import * as fs39 from "fs";
|
|
28714
28740
|
import * as path63 from "path";
|
|
28715
|
-
import
|
|
28741
|
+
import chalk214 from "chalk";
|
|
28716
28742
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
28717
28743
|
const source = path63.join(claudeDir, "CLAUDE.md");
|
|
28718
28744
|
const target = path63.join(targetBase, "CLAUDE.md");
|
|
@@ -28721,14 +28747,14 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
28721
28747
|
const targetContent = fs39.readFileSync(target, "utf8");
|
|
28722
28748
|
if (sourceContent !== targetContent) {
|
|
28723
28749
|
console.log(
|
|
28724
|
-
|
|
28750
|
+
chalk214.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
28725
28751
|
);
|
|
28726
28752
|
console.log();
|
|
28727
28753
|
printDiff(targetContent, sourceContent);
|
|
28728
28754
|
if (!options2?.yes) {
|
|
28729
28755
|
printAutoConfirmHint();
|
|
28730
28756
|
const confirm = await promptConfirm(
|
|
28731
|
-
|
|
28757
|
+
chalk214.red("Overwrite existing CLAUDE.md?"),
|
|
28732
28758
|
false
|
|
28733
28759
|
);
|
|
28734
28760
|
if (!confirm) {
|
|
@@ -28961,7 +28987,7 @@ function syncPi(claudeDir, options2) {
|
|
|
28961
28987
|
// src/commands/sync/syncSettings.ts
|
|
28962
28988
|
import * as fs45 from "fs";
|
|
28963
28989
|
import * as path70 from "path";
|
|
28964
|
-
import
|
|
28990
|
+
import chalk215 from "chalk";
|
|
28965
28991
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
28966
28992
|
const source = path70.join(claudeDir, "settings.json");
|
|
28967
28993
|
const target = path70.join(targetBase, "settings.json");
|
|
@@ -28980,7 +29006,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
28980
29006
|
if (mergedContent !== normalizedTarget) {
|
|
28981
29007
|
if (!options2?.yes) {
|
|
28982
29008
|
console.log(
|
|
28983
|
-
|
|
29009
|
+
chalk215.yellow(
|
|
28984
29010
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
28985
29011
|
)
|
|
28986
29012
|
);
|
|
@@ -28988,7 +29014,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
28988
29014
|
printDiff(targetContent, mergedContent);
|
|
28989
29015
|
printAutoConfirmHint();
|
|
28990
29016
|
const confirm = await promptConfirm(
|
|
28991
|
-
|
|
29017
|
+
chalk215.red("Overwrite existing settings.json?"),
|
|
28992
29018
|
false
|
|
28993
29019
|
);
|
|
28994
29020
|
if (!confirm) {
|
|
@@ -30346,7 +30372,7 @@ function registerWatch(program2) {
|
|
|
30346
30372
|
|
|
30347
30373
|
// src/commands/roam/auth.ts
|
|
30348
30374
|
import { randomBytes } from "crypto";
|
|
30349
|
-
import
|
|
30375
|
+
import chalk216 from "chalk";
|
|
30350
30376
|
|
|
30351
30377
|
// src/commands/roam/waitForCallback.ts
|
|
30352
30378
|
import { createServer as createServer3 } from "http";
|
|
@@ -30477,13 +30503,13 @@ async function auth() {
|
|
|
30477
30503
|
saveGlobalConfig(config);
|
|
30478
30504
|
const state = randomBytes(16).toString("hex");
|
|
30479
30505
|
console.log(
|
|
30480
|
-
|
|
30506
|
+
chalk216.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
30481
30507
|
);
|
|
30482
|
-
console.log(
|
|
30483
|
-
console.log(
|
|
30484
|
-
console.log(
|
|
30508
|
+
console.log(chalk216.white("http://localhost:14523/callback\n"));
|
|
30509
|
+
console.log(chalk216.blue("Opening browser for authorization..."));
|
|
30510
|
+
console.log(chalk216.dim("Waiting for authorization callback..."));
|
|
30485
30511
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
30486
|
-
console.log(
|
|
30512
|
+
console.log(chalk216.dim("Exchanging code for tokens..."));
|
|
30487
30513
|
const tokens = await exchangeToken({
|
|
30488
30514
|
code,
|
|
30489
30515
|
clientId,
|
|
@@ -30499,7 +30525,7 @@ async function auth() {
|
|
|
30499
30525
|
};
|
|
30500
30526
|
saveGlobalConfig(config);
|
|
30501
30527
|
console.log(
|
|
30502
|
-
|
|
30528
|
+
chalk216.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
30503
30529
|
);
|
|
30504
30530
|
}
|
|
30505
30531
|
|
|
@@ -30850,7 +30876,7 @@ import { execSync as execSync60 } from "child_process";
|
|
|
30850
30876
|
import { existsSync as existsSync68, mkdirSync as mkdirSync30, unlinkSync as unlinkSync22, writeFileSync as writeFileSync45 } from "fs";
|
|
30851
30877
|
import { tmpdir as tmpdir8 } from "os";
|
|
30852
30878
|
import { join as join85, resolve as resolve20 } from "path";
|
|
30853
|
-
import
|
|
30879
|
+
import chalk217 from "chalk";
|
|
30854
30880
|
|
|
30855
30881
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
30856
30882
|
var captureWindowPs1 = `
|
|
@@ -31001,13 +31027,13 @@ function screenshot(processName) {
|
|
|
31001
31027
|
const config = loadConfig();
|
|
31002
31028
|
const outputDir = resolve20(config.screenshot.outputDir);
|
|
31003
31029
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
31004
|
-
console.log(
|
|
31030
|
+
console.log(chalk217.gray(`Capturing window for process "${processName}" ...`));
|
|
31005
31031
|
try {
|
|
31006
31032
|
runPowerShellScript(processName, outputPath);
|
|
31007
|
-
console.log(
|
|
31033
|
+
console.log(chalk217.green(`Screenshot saved: ${outputPath}`));
|
|
31008
31034
|
} catch (error) {
|
|
31009
31035
|
const msg = error instanceof Error ? error.message : String(error);
|
|
31010
|
-
console.error(
|
|
31036
|
+
console.error(chalk217.red(`Failed to capture screenshot: ${msg}`));
|
|
31011
31037
|
process.exit(1);
|
|
31012
31038
|
}
|
|
31013
31039
|
}
|
|
@@ -32219,7 +32245,7 @@ function decidePrPreview(sessions, waiters, notify2, d) {
|
|
|
32219
32245
|
const commentCount = Array.isArray(d.comments) ? d.comments.length : 0;
|
|
32220
32246
|
const screenshotCount = Array.isArray(d.screenshots) ? d.screenshots.length : 0;
|
|
32221
32247
|
daemonLog(
|
|
32222
|
-
`pr-decision received: id=${id} requestId=${requestId} decision=${d.decision} comments=${commentCount} screenshots=${screenshotCount} reviewAfter=${d.reviewAfter === true} announceAfter=${d.announceAfter === true}`
|
|
32248
|
+
`pr-decision received: id=${id} requestId=${requestId} decision=${d.decision} comments=${commentCount} screenshots=${screenshotCount} reviewAfter=${d.reviewAfter === true} announceAfter=${d.announceAfter === true} draft=${d.draft}`
|
|
32223
32249
|
);
|
|
32224
32250
|
const waiter = waiters.get(id);
|
|
32225
32251
|
if (waiter)
|
|
@@ -32231,7 +32257,8 @@ function decidePrPreview(sessions, waiters, notify2, d) {
|
|
|
32231
32257
|
comments: d.comments,
|
|
32232
32258
|
screenshots: d.screenshots,
|
|
32233
32259
|
reviewAfter: d.reviewAfter,
|
|
32234
|
-
announceAfter: d.announceAfter
|
|
32260
|
+
announceAfter: d.announceAfter,
|
|
32261
|
+
draft: d.draft
|
|
32235
32262
|
});
|
|
32236
32263
|
waiters.delete(id);
|
|
32237
32264
|
session.pendingPrPreview = void 0;
|
|
@@ -36530,7 +36557,7 @@ function registerSetStatusCommand(cmd) {
|
|
|
36530
36557
|
|
|
36531
36558
|
// src/commands/sessions/summarise/index.ts
|
|
36532
36559
|
import * as fs54 from "fs";
|
|
36533
|
-
import
|
|
36560
|
+
import chalk218 from "chalk";
|
|
36534
36561
|
|
|
36535
36562
|
// src/commands/sessions/summarise/shared.ts
|
|
36536
36563
|
import * as fs53 from "fs";
|
|
@@ -36589,22 +36616,22 @@ ${firstMessage}`);
|
|
|
36589
36616
|
async function summarise2(options2) {
|
|
36590
36617
|
const files = await discoverSessionFiles();
|
|
36591
36618
|
if (files.length === 0) {
|
|
36592
|
-
console.log(
|
|
36619
|
+
console.log(chalk218.yellow("No sessions found."));
|
|
36593
36620
|
return;
|
|
36594
36621
|
}
|
|
36595
36622
|
const toProcess = selectCandidates(files, options2);
|
|
36596
36623
|
if (toProcess.length === 0) {
|
|
36597
|
-
console.log(
|
|
36624
|
+
console.log(chalk218.green("All sessions already summarised."));
|
|
36598
36625
|
return;
|
|
36599
36626
|
}
|
|
36600
36627
|
console.log(
|
|
36601
|
-
|
|
36628
|
+
chalk218.cyan(
|
|
36602
36629
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
36603
36630
|
)
|
|
36604
36631
|
);
|
|
36605
36632
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
36606
36633
|
console.log(
|
|
36607
|
-
|
|
36634
|
+
chalk218.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk218.yellow(`, ${failed2} skipped`) : "")
|
|
36608
36635
|
);
|
|
36609
36636
|
}
|
|
36610
36637
|
function selectCandidates(files, options2) {
|
|
@@ -36624,16 +36651,16 @@ function processSessions(files) {
|
|
|
36624
36651
|
let failed2 = 0;
|
|
36625
36652
|
for (let i = 0; i < files.length; i++) {
|
|
36626
36653
|
const file = files[i];
|
|
36627
|
-
process.stdout.write(
|
|
36654
|
+
process.stdout.write(chalk218.dim(` [${i + 1}/${files.length}] `));
|
|
36628
36655
|
const summary = summariseSession(file);
|
|
36629
36656
|
if (summary) {
|
|
36630
36657
|
writeSummary(file, summary);
|
|
36631
36658
|
succeeded++;
|
|
36632
|
-
process.stdout.write(`${
|
|
36659
|
+
process.stdout.write(`${chalk218.green("\u2713")} ${summary}
|
|
36633
36660
|
`);
|
|
36634
36661
|
} else {
|
|
36635
36662
|
failed2++;
|
|
36636
|
-
process.stdout.write(` ${
|
|
36663
|
+
process.stdout.write(` ${chalk218.yellow("skip")}
|
|
36637
36664
|
`);
|
|
36638
36665
|
}
|
|
36639
36666
|
}
|
|
@@ -36654,7 +36681,7 @@ function registerSessions(program2) {
|
|
|
36654
36681
|
}
|
|
36655
36682
|
|
|
36656
36683
|
// src/commands/statusLine.ts
|
|
36657
|
-
import
|
|
36684
|
+
import chalk220 from "chalk";
|
|
36658
36685
|
|
|
36659
36686
|
// src/shared/contextLevel.ts
|
|
36660
36687
|
function contextLevel(pct) {
|
|
@@ -36664,7 +36691,7 @@ function contextLevel(pct) {
|
|
|
36664
36691
|
}
|
|
36665
36692
|
|
|
36666
36693
|
// src/commands/buildLimitsSegment.ts
|
|
36667
|
-
import
|
|
36694
|
+
import chalk219 from "chalk";
|
|
36668
36695
|
|
|
36669
36696
|
// src/shared/rateLimitLevel.ts
|
|
36670
36697
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -36702,9 +36729,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
36702
36729
|
|
|
36703
36730
|
// src/commands/buildLimitsSegment.ts
|
|
36704
36731
|
var LEVEL_COLOR = {
|
|
36705
|
-
ok:
|
|
36706
|
-
warn:
|
|
36707
|
-
over:
|
|
36732
|
+
ok: chalk219.green,
|
|
36733
|
+
warn: chalk219.yellow,
|
|
36734
|
+
over: chalk219.red
|
|
36708
36735
|
};
|
|
36709
36736
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
36710
36737
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -36800,7 +36827,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
36800
36827
|
}
|
|
36801
36828
|
|
|
36802
36829
|
// src/commands/statusLine.ts
|
|
36803
|
-
|
|
36830
|
+
chalk220.level = 3;
|
|
36804
36831
|
function formatNumber(num) {
|
|
36805
36832
|
return num.toLocaleString("en-US");
|
|
36806
36833
|
}
|
|
@@ -36808,9 +36835,9 @@ function colorizePercent(pct) {
|
|
|
36808
36835
|
const label2 = `${Math.round(pct)}%`;
|
|
36809
36836
|
switch (contextLevel(pct)) {
|
|
36810
36837
|
case "red":
|
|
36811
|
-
return
|
|
36838
|
+
return chalk220.red(label2);
|
|
36812
36839
|
case "yellow":
|
|
36813
|
-
return
|
|
36840
|
+
return chalk220.yellow(label2);
|
|
36814
36841
|
default:
|
|
36815
36842
|
return label2;
|
|
36816
36843
|
}
|
|
@@ -36823,7 +36850,7 @@ async function statusLine() {
|
|
|
36823
36850
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
36824
36851
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
36825
36852
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
36826
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
36853
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk220.cyan(branch2)} | ` : "";
|
|
36827
36854
|
console.log(
|
|
36828
36855
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
36829
36856
|
);
|
|
@@ -36893,10 +36920,10 @@ async function update2() {
|
|
|
36893
36920
|
}
|
|
36894
36921
|
|
|
36895
36922
|
// src/reportCliError.ts
|
|
36896
|
-
import
|
|
36923
|
+
import chalk221 from "chalk";
|
|
36897
36924
|
function reportCliError(error) {
|
|
36898
36925
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError) {
|
|
36899
|
-
console.error(
|
|
36926
|
+
console.error(chalk221.red(error.message));
|
|
36900
36927
|
} else {
|
|
36901
36928
|
console.error(error);
|
|
36902
36929
|
}
|