@staff0rd/assist 0.558.2 → 0.559.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 +2 -2
- package/dist/index.js +717 -690
- 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.559.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)}`);
|
|
9476
|
+
}
|
|
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}`);
|
|
9462
9505
|
}
|
|
9463
|
-
|
|
9464
|
-
|
|
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
|
);
|
|
@@ -14316,7 +14337,7 @@ async function addPhase(id, name, options2) {
|
|
|
14316
14337
|
if (!found) return;
|
|
14317
14338
|
const tasks = options2.task ?? [];
|
|
14318
14339
|
if (tasks.length === 0) {
|
|
14319
|
-
console.log(
|
|
14340
|
+
console.log(chalk80.red("At least one --task is required."));
|
|
14320
14341
|
process.exitCode = 1;
|
|
14321
14342
|
return;
|
|
14322
14343
|
}
|
|
@@ -14340,14 +14361,14 @@ async function addPhase(id, name, options2) {
|
|
|
14340
14361
|
);
|
|
14341
14362
|
const verb = options2.position !== void 0 ? "Inserted" : "Added";
|
|
14342
14363
|
console.log(
|
|
14343
|
-
|
|
14364
|
+
chalk80.green(
|
|
14344
14365
|
`${verb} phase ${phaseIdx + 1} "${name}" to item ${formatItemId(itemId2)} with ${tasks.length} task(s).`
|
|
14345
14366
|
)
|
|
14346
14367
|
);
|
|
14347
14368
|
}
|
|
14348
14369
|
|
|
14349
14370
|
// src/commands/backlog/list/index.ts
|
|
14350
|
-
import
|
|
14371
|
+
import chalk81 from "chalk";
|
|
14351
14372
|
function filterItems(items2, options2) {
|
|
14352
14373
|
if (options2.status) return items2.filter((i) => i.status === options2.status);
|
|
14353
14374
|
if (!options2.all)
|
|
@@ -14361,19 +14382,19 @@ function repoPrefixer(items2, allRepos) {
|
|
|
14361
14382
|
);
|
|
14362
14383
|
const repoNameOf = (item) => item.origin ? labels.get(item.origin) ?? "" : "";
|
|
14363
14384
|
const width = Math.max(0, ...items2.map((i) => repoNameOf(i).length));
|
|
14364
|
-
return (item) => `${
|
|
14385
|
+
return (item) => `${chalk81.dim(repoNameOf(item).padEnd(width))} `;
|
|
14365
14386
|
}
|
|
14366
14387
|
async function list2(options2) {
|
|
14367
14388
|
const allItems = await loadBacklog(options2.allRepos);
|
|
14368
14389
|
const items2 = filterItems(allItems, options2);
|
|
14369
14390
|
if (items2.length === 0) {
|
|
14370
|
-
console.log(
|
|
14391
|
+
console.log(chalk81.dim("Backlog is empty."));
|
|
14371
14392
|
return;
|
|
14372
14393
|
}
|
|
14373
14394
|
const prefixOf = repoPrefixer(items2, !!options2.allRepos);
|
|
14374
14395
|
for (const item of items2) {
|
|
14375
14396
|
console.log(
|
|
14376
|
-
`${prefixOf(item)}${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
14397
|
+
`${prefixOf(item)}${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk81.dim(formatItemId(item.id))} ${starMarker(item)}${item.name}${phaseLabel(item)}${dependencyLabel(item, allItems)}`
|
|
14377
14398
|
);
|
|
14378
14399
|
if (options2.verbose) {
|
|
14379
14400
|
printVerboseDetails(item);
|
|
@@ -14382,13 +14403,13 @@ async function list2(options2) {
|
|
|
14382
14403
|
}
|
|
14383
14404
|
|
|
14384
14405
|
// src/commands/backlog/propose/index.ts
|
|
14385
|
-
import
|
|
14406
|
+
import chalk84 from "chalk";
|
|
14386
14407
|
|
|
14387
14408
|
// src/commands/backlog/readJsonPayload.ts
|
|
14388
14409
|
import { readFileSync as readFileSync24 } from "fs";
|
|
14389
|
-
import
|
|
14410
|
+
import chalk82 from "chalk";
|
|
14390
14411
|
function fail3(message3) {
|
|
14391
|
-
console.error(
|
|
14412
|
+
console.error(chalk82.red(message3));
|
|
14392
14413
|
process.exit(1);
|
|
14393
14414
|
}
|
|
14394
14415
|
function describe(error) {
|
|
@@ -14443,7 +14464,7 @@ function readProposedItem(source) {
|
|
|
14443
14464
|
|
|
14444
14465
|
// src/commands/backlog/propose/reviewProposal.ts
|
|
14445
14466
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
14446
|
-
import
|
|
14467
|
+
import chalk83 from "chalk";
|
|
14447
14468
|
|
|
14448
14469
|
// src/commands/backlog/propose/renderProposedItem.ts
|
|
14449
14470
|
function renderProposedItem(item) {
|
|
@@ -14475,11 +14496,11 @@ async function reviewProposal(item, sessionId, confirmed) {
|
|
|
14475
14496
|
return true;
|
|
14476
14497
|
}
|
|
14477
14498
|
if (isClaudeCode() && confirmed) return true;
|
|
14478
|
-
console.log(
|
|
14499
|
+
console.log(chalk83.bold(item.name));
|
|
14479
14500
|
console.log(renderMarkdownTerminal(body));
|
|
14480
14501
|
if (!isClaudeCode()) return true;
|
|
14481
14502
|
console.log(
|
|
14482
|
-
|
|
14503
|
+
chalk83.yellow(
|
|
14483
14504
|
"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
14505
|
)
|
|
14485
14506
|
);
|
|
@@ -14492,7 +14513,7 @@ async function propose(options2) {
|
|
|
14492
14513
|
const sessionId = process.env.ASSIST_SESSION === "1" ? process.env.ASSIST_SESSION_ID : void 0;
|
|
14493
14514
|
if (sessionId && options2.confirmed) {
|
|
14494
14515
|
console.error(
|
|
14495
|
-
|
|
14516
|
+
chalk84.red(
|
|
14496
14517
|
"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
14518
|
)
|
|
14498
14519
|
);
|
|
@@ -14503,7 +14524,7 @@ async function propose(options2) {
|
|
|
14503
14524
|
if (!await reviewProposal(item, sessionId, options2.confirmed === true))
|
|
14504
14525
|
return;
|
|
14505
14526
|
const id = await createItemWithDefaults(item);
|
|
14506
|
-
console.log(
|
|
14527
|
+
console.log(chalk84.green(`Added item ${formatItemId(id)}: ${item.name}`));
|
|
14507
14528
|
}
|
|
14508
14529
|
|
|
14509
14530
|
// src/commands/backlog/registerItemCommands.ts
|
|
@@ -14535,7 +14556,7 @@ function registerItemCommands(cmd) {
|
|
|
14535
14556
|
}
|
|
14536
14557
|
|
|
14537
14558
|
// src/commands/backlog/link.ts
|
|
14538
|
-
import
|
|
14559
|
+
import chalk86 from "chalk";
|
|
14539
14560
|
|
|
14540
14561
|
// src/commands/backlog/hasCycle.ts
|
|
14541
14562
|
function hasCycle(adjacency, fromId, toId) {
|
|
@@ -14567,14 +14588,14 @@ async function loadDependencyGraph(orm) {
|
|
|
14567
14588
|
}
|
|
14568
14589
|
|
|
14569
14590
|
// src/commands/backlog/validateLinkTarget.ts
|
|
14570
|
-
import
|
|
14591
|
+
import chalk85 from "chalk";
|
|
14571
14592
|
function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
14572
14593
|
const duplicate = (fromItem.links ?? []).some(
|
|
14573
14594
|
(l) => l.targetId === toNum && l.type === linkType
|
|
14574
14595
|
);
|
|
14575
14596
|
if (duplicate) {
|
|
14576
14597
|
console.log(
|
|
14577
|
-
|
|
14598
|
+
chalk85.yellow(
|
|
14578
14599
|
`Link already exists: ${formatItemId(fromNum)} ${linkType} ${formatItemId(toNum)}`
|
|
14579
14600
|
)
|
|
14580
14601
|
);
|
|
@@ -14585,7 +14606,7 @@ function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
|
14585
14606
|
|
|
14586
14607
|
// src/commands/backlog/link.ts
|
|
14587
14608
|
function fail4(message3) {
|
|
14588
|
-
console.log(
|
|
14609
|
+
console.log(chalk86.red(message3));
|
|
14589
14610
|
return void 0;
|
|
14590
14611
|
}
|
|
14591
14612
|
function parseLinkType(type) {
|
|
@@ -14618,11 +14639,11 @@ async function link(fromId, toId, opts) {
|
|
|
14618
14639
|
if (!validateLinkTarget(fromItem, fromNum, toNum, linkType)) return;
|
|
14619
14640
|
if (await createsCycle(orm, linkType, fromNum, toNum)) return;
|
|
14620
14641
|
await orm.insert(links).values({ itemId: fromNum, type: linkType, targetId: toNum });
|
|
14621
|
-
console.log(
|
|
14642
|
+
console.log(chalk86.green(`Linked ${from} ${linkType} ${to} (${toItem.name})`));
|
|
14622
14643
|
}
|
|
14623
14644
|
|
|
14624
14645
|
// src/commands/backlog/unlink.ts
|
|
14625
|
-
import
|
|
14646
|
+
import chalk87 from "chalk";
|
|
14626
14647
|
import { and as and10, eq as eq27 } from "drizzle-orm";
|
|
14627
14648
|
async function unlink(fromId, toId) {
|
|
14628
14649
|
const fromNum = parseItemId(fromId);
|
|
@@ -14630,18 +14651,18 @@ async function unlink(fromId, toId) {
|
|
|
14630
14651
|
const { orm } = await getReady();
|
|
14631
14652
|
const fromItem = await loadItem(orm, fromNum);
|
|
14632
14653
|
if (!fromItem) {
|
|
14633
|
-
console.log(
|
|
14654
|
+
console.log(chalk87.red(`Item ${formatItemId(fromNum)} not found.`));
|
|
14634
14655
|
return;
|
|
14635
14656
|
}
|
|
14636
14657
|
if (!fromItem.links || fromItem.links.length === 0) {
|
|
14637
14658
|
console.log(
|
|
14638
|
-
|
|
14659
|
+
chalk87.yellow(`No links found on item ${formatItemId(fromNum)}.`)
|
|
14639
14660
|
);
|
|
14640
14661
|
return;
|
|
14641
14662
|
}
|
|
14642
14663
|
if (!fromItem.links.some((l) => l.targetId === toNum)) {
|
|
14643
14664
|
console.log(
|
|
14644
|
-
|
|
14665
|
+
chalk87.yellow(
|
|
14645
14666
|
`No link from ${formatItemId(fromNum)} to ${formatItemId(toNum)} found.`
|
|
14646
14667
|
)
|
|
14647
14668
|
);
|
|
@@ -14649,7 +14670,7 @@ async function unlink(fromId, toId) {
|
|
|
14649
14670
|
}
|
|
14650
14671
|
await orm.delete(links).where(and10(eq27(links.itemId, fromNum), eq27(links.targetId, toNum)));
|
|
14651
14672
|
console.log(
|
|
14652
|
-
|
|
14673
|
+
chalk87.green(
|
|
14653
14674
|
`Removed link from ${formatItemId(fromNum)} to ${formatItemId(toNum)}.`
|
|
14654
14675
|
)
|
|
14655
14676
|
);
|
|
@@ -14666,17 +14687,17 @@ function registerLinkCommands(cmd) {
|
|
|
14666
14687
|
}
|
|
14667
14688
|
|
|
14668
14689
|
// src/commands/backlog/move-repo/index.ts
|
|
14669
|
-
import
|
|
14690
|
+
import chalk89 from "chalk";
|
|
14670
14691
|
import { eq as eq29 } from "drizzle-orm";
|
|
14671
14692
|
|
|
14672
14693
|
// src/commands/backlog/move-repo/confirmMove.ts
|
|
14673
|
-
import
|
|
14694
|
+
import chalk88 from "chalk";
|
|
14674
14695
|
function pluralItems(n) {
|
|
14675
14696
|
return `${n} item${n === 1 ? "" : "s"}`;
|
|
14676
14697
|
}
|
|
14677
14698
|
async function confirmMove(cnt, oldOrigin, newOrigin) {
|
|
14678
14699
|
console.log(
|
|
14679
|
-
`${pluralItems(cnt)}: ${
|
|
14700
|
+
`${pluralItems(cnt)}: ${chalk88.cyan(oldOrigin)} \u2192 ${chalk88.cyan(newOrigin)}`
|
|
14680
14701
|
);
|
|
14681
14702
|
return promptConfirm(`Retag ${pluralItems(cnt)}?`);
|
|
14682
14703
|
}
|
|
@@ -14708,7 +14729,7 @@ Pass the full origin.`
|
|
|
14708
14729
|
|
|
14709
14730
|
// src/commands/backlog/move-repo/index.ts
|
|
14710
14731
|
function fail5(message3) {
|
|
14711
|
-
console.log(
|
|
14732
|
+
console.log(chalk89.red(message3));
|
|
14712
14733
|
process.exitCode = 1;
|
|
14713
14734
|
}
|
|
14714
14735
|
async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
@@ -14724,12 +14745,12 @@ async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
|
14724
14745
|
}
|
|
14725
14746
|
const cnt = await countByOrigin(orm, oldOrigin);
|
|
14726
14747
|
if (!options2.yes && !await confirmMove(cnt, oldOrigin, newOrigin)) {
|
|
14727
|
-
console.log(
|
|
14748
|
+
console.log(chalk89.yellow("Move cancelled; no changes made."));
|
|
14728
14749
|
return;
|
|
14729
14750
|
}
|
|
14730
14751
|
await orm.update(items).set({ origin: newOrigin }).where(eq29(items.origin, oldOrigin));
|
|
14731
14752
|
console.log(
|
|
14732
|
-
|
|
14753
|
+
chalk89.green(
|
|
14733
14754
|
`Moved ${pluralItems(cnt)} from "${oldOrigin}" to "${newOrigin}".`
|
|
14734
14755
|
)
|
|
14735
14756
|
);
|
|
@@ -14758,14 +14779,14 @@ function registerPlanCommands(cmd) {
|
|
|
14758
14779
|
}
|
|
14759
14780
|
|
|
14760
14781
|
// src/commands/backlog/refine.ts
|
|
14761
|
-
import
|
|
14782
|
+
import chalk92 from "chalk";
|
|
14762
14783
|
import enquirer7 from "enquirer";
|
|
14763
14784
|
|
|
14764
14785
|
// src/commands/backlog/launchMode.ts
|
|
14765
14786
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
14766
14787
|
|
|
14767
14788
|
// src/commands/backlog/handleLaunchSignal.ts
|
|
14768
|
-
import
|
|
14789
|
+
import chalk91 from "chalk";
|
|
14769
14790
|
|
|
14770
14791
|
// src/commands/backlog/surfaceCreatedItem.ts
|
|
14771
14792
|
async function surfaceCreatedItem(slashCommand, id) {
|
|
@@ -14788,32 +14809,32 @@ async function surfaceCreatedItem(slashCommand, id) {
|
|
|
14788
14809
|
}
|
|
14789
14810
|
|
|
14790
14811
|
// src/commands/backlog/tryRunById.ts
|
|
14791
|
-
import
|
|
14812
|
+
import chalk90 from "chalk";
|
|
14792
14813
|
async function tryRunById(id, options2) {
|
|
14793
14814
|
const numericId = parseItemId(id);
|
|
14794
14815
|
const label2 = formatItemId(numericId);
|
|
14795
14816
|
const { orm } = await getReady();
|
|
14796
14817
|
const item = await loadItem(orm, numericId);
|
|
14797
14818
|
if (!item) {
|
|
14798
|
-
console.log(
|
|
14819
|
+
console.log(chalk90.red(`Item ${label2} not found.`));
|
|
14799
14820
|
return false;
|
|
14800
14821
|
}
|
|
14801
14822
|
if (item.status === "done") {
|
|
14802
|
-
console.log(
|
|
14823
|
+
console.log(chalk90.red(`Item ${label2} is already done.`));
|
|
14803
14824
|
return false;
|
|
14804
14825
|
}
|
|
14805
14826
|
if (item.status === "wontdo") {
|
|
14806
|
-
console.log(
|
|
14827
|
+
console.log(chalk90.red(`Item ${label2} is marked won't do.`));
|
|
14807
14828
|
return false;
|
|
14808
14829
|
}
|
|
14809
14830
|
const hasDeps = (item.links ?? []).some((l) => l.type === "depends-on");
|
|
14810
14831
|
if (hasDeps && isBlocked(item, await loadItemSummaries(orm, getOrigin()))) {
|
|
14811
14832
|
console.log(
|
|
14812
|
-
|
|
14833
|
+
chalk90.red(`Item ${label2} is blocked by unresolved dependencies.`)
|
|
14813
14834
|
);
|
|
14814
14835
|
return false;
|
|
14815
14836
|
}
|
|
14816
|
-
console.log(
|
|
14837
|
+
console.log(chalk90.bold(`
|
|
14817
14838
|
Running backlog item ${label2}...
|
|
14818
14839
|
`));
|
|
14819
14840
|
await run2(id, options2);
|
|
@@ -14832,13 +14853,13 @@ async function handleLaunchSignal(slashCommand, once) {
|
|
|
14832
14853
|
if (typeof signal.id === "string" && signal.id) {
|
|
14833
14854
|
if (await tryRunById(signal.id, { allowEdits: true })) return;
|
|
14834
14855
|
}
|
|
14835
|
-
console.log(
|
|
14856
|
+
console.log(chalk91.bold("\nChaining into assist next...\n"));
|
|
14836
14857
|
await next({ allowEdits: true, once });
|
|
14837
14858
|
}
|
|
14838
14859
|
} catch (error) {
|
|
14839
14860
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
14840
14861
|
console.error(
|
|
14841
|
-
|
|
14862
|
+
chalk91.yellow(
|
|
14842
14863
|
`
|
|
14843
14864
|
Could not complete post-run step (${message3}).
|
|
14844
14865
|
This is usually a transient database/network blip \u2014 the work is saved and the session is safe to resume.`
|
|
@@ -14891,13 +14912,13 @@ async function pickItemForRefine() {
|
|
|
14891
14912
|
(i) => i.status === "todo" || i.status === "in-progress"
|
|
14892
14913
|
);
|
|
14893
14914
|
if (active.length === 0) {
|
|
14894
|
-
console.log(
|
|
14915
|
+
console.log(chalk92.yellow("No active backlog items to refine."));
|
|
14895
14916
|
return void 0;
|
|
14896
14917
|
}
|
|
14897
14918
|
if (active.length === 1) {
|
|
14898
14919
|
const item = active[0];
|
|
14899
14920
|
console.log(
|
|
14900
|
-
|
|
14921
|
+
chalk92.bold(`Auto-selecting item ${formatItemId(item.id)}: ${item.name}`)
|
|
14901
14922
|
);
|
|
14902
14923
|
return formatItemId(item.id);
|
|
14903
14924
|
}
|
|
@@ -14945,7 +14966,7 @@ function registerRefineCommand(cmd) {
|
|
|
14945
14966
|
}
|
|
14946
14967
|
|
|
14947
14968
|
// src/commands/backlog/rewindPhase.ts
|
|
14948
|
-
import
|
|
14969
|
+
import chalk93 from "chalk";
|
|
14949
14970
|
async function rewindPhase(id, phase, opts) {
|
|
14950
14971
|
const phaseNumber = Number.parseInt(phase, 10);
|
|
14951
14972
|
const found = await findOneItem(id);
|
|
@@ -14953,12 +14974,12 @@ async function rewindPhase(id, phase, opts) {
|
|
|
14953
14974
|
const { orm, item } = found;
|
|
14954
14975
|
const result = await rewindItemToPhase(orm, item, phaseNumber, opts.reason);
|
|
14955
14976
|
if (!result.ok) {
|
|
14956
|
-
console.log(
|
|
14977
|
+
console.log(chalk93.red(result.error));
|
|
14957
14978
|
process.exitCode = 1;
|
|
14958
14979
|
return;
|
|
14959
14980
|
}
|
|
14960
14981
|
console.log(
|
|
14961
|
-
|
|
14982
|
+
chalk93.green(
|
|
14962
14983
|
`Rewound item ${formatItemId(item.id)} to phase ${phaseNumber} (${result.phaseName}).`
|
|
14963
14984
|
)
|
|
14964
14985
|
);
|
|
@@ -14990,22 +15011,22 @@ function registerRunCommand(cmd) {
|
|
|
14990
15011
|
}
|
|
14991
15012
|
|
|
14992
15013
|
// src/commands/backlog/search/index.ts
|
|
14993
|
-
import
|
|
15014
|
+
import chalk94 from "chalk";
|
|
14994
15015
|
async function search(query) {
|
|
14995
15016
|
const items2 = await searchBacklog(query);
|
|
14996
15017
|
if (items2.length === 0) {
|
|
14997
|
-
console.log(
|
|
15018
|
+
console.log(chalk94.dim(`No items matching "${query}".`));
|
|
14998
15019
|
return;
|
|
14999
15020
|
}
|
|
15000
15021
|
console.log(
|
|
15001
|
-
|
|
15022
|
+
chalk94.dim(
|
|
15002
15023
|
`${items2.length} item${items2.length === 1 ? "" : "s"} matching "${query}":
|
|
15003
15024
|
`
|
|
15004
15025
|
)
|
|
15005
15026
|
);
|
|
15006
15027
|
for (const item of items2) {
|
|
15007
15028
|
console.log(
|
|
15008
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
15029
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk94.dim(formatItemId(item.id))} ${item.name}`
|
|
15009
15030
|
);
|
|
15010
15031
|
}
|
|
15011
15032
|
}
|
|
@@ -15016,18 +15037,18 @@ function registerSearchCommand(cmd) {
|
|
|
15016
15037
|
}
|
|
15017
15038
|
|
|
15018
15039
|
// src/commands/backlog/delete/index.ts
|
|
15019
|
-
import
|
|
15040
|
+
import chalk95 from "chalk";
|
|
15020
15041
|
async function del(id) {
|
|
15021
15042
|
const name = await removeItem(id);
|
|
15022
15043
|
if (name) {
|
|
15023
15044
|
console.log(
|
|
15024
|
-
|
|
15045
|
+
chalk95.green(`Deleted item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
15025
15046
|
);
|
|
15026
15047
|
}
|
|
15027
15048
|
}
|
|
15028
15049
|
|
|
15029
15050
|
// src/commands/backlog/done/index.ts
|
|
15030
|
-
import
|
|
15051
|
+
import chalk96 from "chalk";
|
|
15031
15052
|
async function done(id, summary) {
|
|
15032
15053
|
const found = await findOneItem(id);
|
|
15033
15054
|
if (!found) return;
|
|
@@ -15041,12 +15062,12 @@ async function done(id, summary) {
|
|
|
15041
15062
|
const pending = item.plan.slice(completedCount);
|
|
15042
15063
|
if (pending.length > 0) {
|
|
15043
15064
|
console.log(
|
|
15044
|
-
|
|
15065
|
+
chalk96.red(
|
|
15045
15066
|
`Cannot complete item ${formatItemId(item.id)}: ${pending.length} pending phase(s):`
|
|
15046
15067
|
)
|
|
15047
15068
|
);
|
|
15048
15069
|
for (const phase of pending) {
|
|
15049
|
-
console.log(
|
|
15070
|
+
console.log(chalk96.yellow(` - ${phase.name}`));
|
|
15050
15071
|
}
|
|
15051
15072
|
process.exitCode = 1;
|
|
15052
15073
|
return;
|
|
@@ -15058,12 +15079,12 @@ async function done(id, summary) {
|
|
|
15058
15079
|
await appendComment(orm, item.id, summary, { phase, type: "summary" });
|
|
15059
15080
|
}
|
|
15060
15081
|
console.log(
|
|
15061
|
-
|
|
15082
|
+
chalk96.green(`Completed item ${formatItemId(item.id)}: ${item.name}`)
|
|
15062
15083
|
);
|
|
15063
15084
|
}
|
|
15064
15085
|
|
|
15065
15086
|
// src/commands/backlog/set-status/index.ts
|
|
15066
|
-
import
|
|
15087
|
+
import chalk97 from "chalk";
|
|
15067
15088
|
var allowedStatuses = [
|
|
15068
15089
|
"todo",
|
|
15069
15090
|
"in-progress",
|
|
@@ -15073,7 +15094,7 @@ var allowedStatuses = [
|
|
|
15073
15094
|
async function setStatusCommand(id, status3) {
|
|
15074
15095
|
if (!allowedStatuses.includes(status3)) {
|
|
15075
15096
|
console.log(
|
|
15076
|
-
|
|
15097
|
+
chalk97.red(
|
|
15077
15098
|
`Invalid status "${status3}". Must be one of: ${allowedStatuses.join(", ")}.`
|
|
15078
15099
|
)
|
|
15079
15100
|
);
|
|
@@ -15083,7 +15104,7 @@ async function setStatusCommand(id, status3) {
|
|
|
15083
15104
|
const name = await setStatus(id, status3);
|
|
15084
15105
|
if (name) {
|
|
15085
15106
|
console.log(
|
|
15086
|
-
|
|
15107
|
+
chalk97.green(
|
|
15087
15108
|
`Set item ${formatItemId(parseItemId(id))} to ${status3}: ${name}`
|
|
15088
15109
|
)
|
|
15089
15110
|
);
|
|
@@ -15091,16 +15112,16 @@ async function setStatusCommand(id, status3) {
|
|
|
15091
15112
|
}
|
|
15092
15113
|
|
|
15093
15114
|
// src/commands/backlog/star/index.ts
|
|
15094
|
-
import
|
|
15115
|
+
import chalk99 from "chalk";
|
|
15095
15116
|
|
|
15096
15117
|
// src/commands/backlog/setStarred.ts
|
|
15097
|
-
import
|
|
15118
|
+
import chalk98 from "chalk";
|
|
15098
15119
|
async function setStarred(id, starred) {
|
|
15099
15120
|
const { orm } = await getReady();
|
|
15100
15121
|
const numId = parseItemId(id);
|
|
15101
15122
|
const name = await updateStarred(orm, numId, starred);
|
|
15102
15123
|
if (name === void 0)
|
|
15103
|
-
console.log(
|
|
15124
|
+
console.log(chalk98.red(`Item ${formatItemId(numId)} not found.`));
|
|
15104
15125
|
return name;
|
|
15105
15126
|
}
|
|
15106
15127
|
|
|
@@ -15109,52 +15130,52 @@ async function star(id) {
|
|
|
15109
15130
|
const name = await setStarred(id, true);
|
|
15110
15131
|
if (name) {
|
|
15111
15132
|
console.log(
|
|
15112
|
-
|
|
15133
|
+
chalk99.green(`Starred item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
15113
15134
|
);
|
|
15114
15135
|
}
|
|
15115
15136
|
}
|
|
15116
15137
|
|
|
15117
15138
|
// src/commands/backlog/start/index.ts
|
|
15118
|
-
import
|
|
15139
|
+
import chalk100 from "chalk";
|
|
15119
15140
|
async function start(id) {
|
|
15120
15141
|
const name = await setStatus(id, "in-progress");
|
|
15121
15142
|
if (name) {
|
|
15122
15143
|
console.log(
|
|
15123
|
-
|
|
15144
|
+
chalk100.green(`Started item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
15124
15145
|
);
|
|
15125
15146
|
}
|
|
15126
15147
|
}
|
|
15127
15148
|
|
|
15128
15149
|
// src/commands/backlog/stop/index.ts
|
|
15129
|
-
import
|
|
15150
|
+
import chalk101 from "chalk";
|
|
15130
15151
|
import { and as and11, eq as eq30 } from "drizzle-orm";
|
|
15131
15152
|
async function stop() {
|
|
15132
15153
|
const { orm } = await getReady();
|
|
15133
15154
|
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
15155
|
if (stopped.length === 0) {
|
|
15135
|
-
console.log(
|
|
15156
|
+
console.log(chalk101.yellow("No in-progress items to stop."));
|
|
15136
15157
|
return;
|
|
15137
15158
|
}
|
|
15138
15159
|
for (const item of stopped) {
|
|
15139
15160
|
console.log(
|
|
15140
|
-
|
|
15161
|
+
chalk101.yellow(`Stopped item ${formatItemId(item.id)}: ${item.name}`)
|
|
15141
15162
|
);
|
|
15142
15163
|
}
|
|
15143
15164
|
}
|
|
15144
15165
|
|
|
15145
15166
|
// src/commands/backlog/unstar/index.ts
|
|
15146
|
-
import
|
|
15167
|
+
import chalk102 from "chalk";
|
|
15147
15168
|
async function unstar(id) {
|
|
15148
15169
|
const name = await setStarred(id, false);
|
|
15149
15170
|
if (name) {
|
|
15150
15171
|
console.log(
|
|
15151
|
-
|
|
15172
|
+
chalk102.green(`Unstarred item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
15152
15173
|
);
|
|
15153
15174
|
}
|
|
15154
15175
|
}
|
|
15155
15176
|
|
|
15156
15177
|
// src/commands/backlog/wontdo/index.ts
|
|
15157
|
-
import
|
|
15178
|
+
import chalk103 from "chalk";
|
|
15158
15179
|
async function wontdo(id, reason4) {
|
|
15159
15180
|
const found = await findOneItem(id);
|
|
15160
15181
|
if (!found) return;
|
|
@@ -15165,7 +15186,7 @@ async function wontdo(id, reason4) {
|
|
|
15165
15186
|
await appendComment(orm, item.id, reason4, { phase, type: "summary" });
|
|
15166
15187
|
}
|
|
15167
15188
|
console.log(
|
|
15168
|
-
|
|
15189
|
+
chalk103.red(`Won't do item ${formatItemId(item.id)}: ${item.name}`)
|
|
15169
15190
|
);
|
|
15170
15191
|
}
|
|
15171
15192
|
|
|
@@ -15184,17 +15205,17 @@ function registerStatusCommands(cmd) {
|
|
|
15184
15205
|
}
|
|
15185
15206
|
|
|
15186
15207
|
// src/commands/backlog/addSubtask.ts
|
|
15187
|
-
import
|
|
15208
|
+
import chalk104 from "chalk";
|
|
15188
15209
|
async function addSubtask(id, options2) {
|
|
15189
15210
|
const title = options2.title?.trim();
|
|
15190
15211
|
if (!title) {
|
|
15191
|
-
console.log(
|
|
15212
|
+
console.log(chalk104.red("A sub-task title is required (--title)."));
|
|
15192
15213
|
process.exitCode = 1;
|
|
15193
15214
|
return;
|
|
15194
15215
|
}
|
|
15195
15216
|
if (title.length > 50) {
|
|
15196
15217
|
console.log(
|
|
15197
|
-
|
|
15218
|
+
chalk104.red(
|
|
15198
15219
|
"A sub-task title must be 50 characters or fewer. Use --desc for longer detail."
|
|
15199
15220
|
)
|
|
15200
15221
|
);
|
|
@@ -15210,21 +15231,21 @@ async function addSubtask(id, options2) {
|
|
|
15210
15231
|
const description = options2.desc?.replaceAll(String.raw`\n`, "\n");
|
|
15211
15232
|
await insertSubtask(orm, item.id, title, description);
|
|
15212
15233
|
console.log(
|
|
15213
|
-
|
|
15234
|
+
chalk104.green(`Added sub-task to item ${formatItemId(item.id)}: ${title}`)
|
|
15214
15235
|
);
|
|
15215
15236
|
}
|
|
15216
15237
|
|
|
15217
15238
|
// src/commands/backlog/editSubtask.ts
|
|
15218
|
-
import
|
|
15239
|
+
import chalk106 from "chalk";
|
|
15219
15240
|
|
|
15220
15241
|
// src/commands/backlog/resolveSubtaskIndex.ts
|
|
15221
|
-
import
|
|
15242
|
+
import chalk105 from "chalk";
|
|
15222
15243
|
function resolveSubtaskIndex(index3, item) {
|
|
15223
15244
|
const position = Number.parseInt(index3, 10);
|
|
15224
15245
|
const subtasks = item.subtasks ?? [];
|
|
15225
15246
|
if (Number.isNaN(position) || position < 1 || position > subtasks.length) {
|
|
15226
15247
|
console.log(
|
|
15227
|
-
|
|
15248
|
+
chalk105.red(
|
|
15228
15249
|
`Item ${formatItemId(item.id)} has no sub-task ${index3}${subtasks.length > 0 ? ` (1-${subtasks.length})` : ""}.`
|
|
15229
15250
|
)
|
|
15230
15251
|
);
|
|
@@ -15291,21 +15312,21 @@ async function editSubtask(id, index3, options2) {
|
|
|
15291
15312
|
if (!found) return;
|
|
15292
15313
|
const fields = buildUpdate(options2);
|
|
15293
15314
|
if (typeof fields === "string") {
|
|
15294
|
-
console.log(
|
|
15315
|
+
console.log(chalk106.red(fields));
|
|
15295
15316
|
process.exitCode = 1;
|
|
15296
15317
|
return;
|
|
15297
15318
|
}
|
|
15298
15319
|
const { orm, item, idx } = found;
|
|
15299
15320
|
const title = await updateSubtask(orm, item.id, idx, fields);
|
|
15300
15321
|
console.log(
|
|
15301
|
-
|
|
15322
|
+
chalk106.green(
|
|
15302
15323
|
`Updated sub-task ${idx + 1} of item ${formatItemId(item.id)}: ${title}`
|
|
15303
15324
|
)
|
|
15304
15325
|
);
|
|
15305
15326
|
}
|
|
15306
15327
|
|
|
15307
15328
|
// src/commands/backlog/removeSubtask.ts
|
|
15308
|
-
import
|
|
15329
|
+
import chalk107 from "chalk";
|
|
15309
15330
|
|
|
15310
15331
|
// src/commands/backlog/deleteSubtask.ts
|
|
15311
15332
|
import { and as and13, asc as asc8, eq as eq32 } from "drizzle-orm";
|
|
@@ -15330,18 +15351,18 @@ async function removeSubtask(id, index3) {
|
|
|
15330
15351
|
const { orm, item, idx } = found;
|
|
15331
15352
|
const title = await deleteSubtask(orm, item.id, idx);
|
|
15332
15353
|
console.log(
|
|
15333
|
-
|
|
15354
|
+
chalk107.green(
|
|
15334
15355
|
`Removed sub-task ${idx + 1} of item ${formatItemId(item.id)}: ${title}`
|
|
15335
15356
|
)
|
|
15336
15357
|
);
|
|
15337
15358
|
}
|
|
15338
15359
|
|
|
15339
15360
|
// src/commands/backlog/subtaskStatus.ts
|
|
15340
|
-
import
|
|
15361
|
+
import chalk108 from "chalk";
|
|
15341
15362
|
async function subtaskStatus(id, index3, status3) {
|
|
15342
15363
|
if (!validSubtaskStatuses.includes(status3)) {
|
|
15343
15364
|
console.log(
|
|
15344
|
-
|
|
15365
|
+
chalk108.red(
|
|
15345
15366
|
`Invalid status "${status3}". Use one of: ${validSubtaskStatuses.join(", ")}.`
|
|
15346
15367
|
)
|
|
15347
15368
|
);
|
|
@@ -15358,7 +15379,7 @@ async function subtaskStatus(id, index3, status3) {
|
|
|
15358
15379
|
status3
|
|
15359
15380
|
);
|
|
15360
15381
|
console.log(
|
|
15361
|
-
|
|
15382
|
+
chalk108.green(
|
|
15362
15383
|
`Set sub-task ${idx + 1} of item ${formatItemId(item.id)} to ${status3}: ${title}`
|
|
15363
15384
|
)
|
|
15364
15385
|
);
|
|
@@ -15385,7 +15406,7 @@ function registerSubtaskCommands(cmd) {
|
|
|
15385
15406
|
}
|
|
15386
15407
|
|
|
15387
15408
|
// src/commands/backlog/movePhase.ts
|
|
15388
|
-
import
|
|
15409
|
+
import chalk109 from "chalk";
|
|
15389
15410
|
import { count as count6, eq as eq35 } from "drizzle-orm";
|
|
15390
15411
|
|
|
15391
15412
|
// src/commands/backlog/reorderPhaseRows.ts
|
|
@@ -15451,7 +15472,7 @@ function toIndex2(value, phaseCount) {
|
|
|
15451
15472
|
const pos = Number.parseInt(value, 10);
|
|
15452
15473
|
if (Number.isNaN(pos) || pos < 1 || pos > phaseCount) {
|
|
15453
15474
|
console.log(
|
|
15454
|
-
|
|
15475
|
+
chalk109.red(
|
|
15455
15476
|
`Position "${value}" is out of range. Must be between 1 and ${phaseCount}.`
|
|
15456
15477
|
)
|
|
15457
15478
|
);
|
|
@@ -15474,11 +15495,11 @@ async function movePhase(id, from, to) {
|
|
|
15474
15495
|
if (fromIdx !== toIdx) {
|
|
15475
15496
|
await reorderPhaseRows(orm, itemId2, fromIdx, toIdx);
|
|
15476
15497
|
}
|
|
15477
|
-
console.log(
|
|
15498
|
+
console.log(chalk109.green(`Moved phase ${from} to position ${to}.`));
|
|
15478
15499
|
}
|
|
15479
15500
|
|
|
15480
15501
|
// src/commands/backlog/updatePhase.ts
|
|
15481
|
-
import
|
|
15502
|
+
import chalk111 from "chalk";
|
|
15482
15503
|
|
|
15483
15504
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
15484
15505
|
import { and as and16, eq as eq36 } from "drizzle-orm";
|
|
@@ -15513,7 +15534,7 @@ async function applyPhaseUpdate(orm, itemId2, phaseIdx, fields) {
|
|
|
15513
15534
|
}
|
|
15514
15535
|
|
|
15515
15536
|
// src/commands/backlog/findPhase.ts
|
|
15516
|
-
import
|
|
15537
|
+
import chalk110 from "chalk";
|
|
15517
15538
|
import { and as and17, count as count7, eq as eq37 } from "drizzle-orm";
|
|
15518
15539
|
async function findPhase(id, phase) {
|
|
15519
15540
|
const found = await findOneItem(id);
|
|
@@ -15524,7 +15545,7 @@ async function findPhase(id, phase) {
|
|
|
15524
15545
|
const [row] = await orm.select({ cnt: count7() }).from(planPhases).where(and17(eq37(planPhases.itemId, itemId2), eq37(planPhases.idx, phaseIdx)));
|
|
15525
15546
|
if (!row || row.cnt === 0) {
|
|
15526
15547
|
console.log(
|
|
15527
|
-
|
|
15548
|
+
chalk110.red(
|
|
15528
15549
|
`Phase ${phaseIdx + 1} not found on item ${formatItemId(itemId2)}.`
|
|
15529
15550
|
)
|
|
15530
15551
|
);
|
|
@@ -15658,7 +15679,7 @@ async function updatePhase(id, phase, options2) {
|
|
|
15658
15679
|
const { item, orm, itemId: itemId2, phaseIdx } = found;
|
|
15659
15680
|
const resolved = resolvePhaseFields(options2, item.plan?.[phaseIdx]);
|
|
15660
15681
|
if (!resolved.ok) {
|
|
15661
|
-
console.log(
|
|
15682
|
+
console.log(chalk111.red(resolved.error));
|
|
15662
15683
|
process.exitCode = 1;
|
|
15663
15684
|
return;
|
|
15664
15685
|
}
|
|
@@ -15670,7 +15691,7 @@ async function updatePhase(id, phase, options2) {
|
|
|
15670
15691
|
manualCheck && "manual checks"
|
|
15671
15692
|
].filter(Boolean).join(", ");
|
|
15672
15693
|
console.log(
|
|
15673
|
-
|
|
15694
|
+
chalk111.green(
|
|
15674
15695
|
`Updated ${fields} on phase ${phaseIdx + 1} of item ${formatItemId(itemId2)}.`
|
|
15675
15696
|
)
|
|
15676
15697
|
);
|
|
@@ -15693,7 +15714,7 @@ function registerUpdatePhaseCommand(cmd) {
|
|
|
15693
15714
|
}
|
|
15694
15715
|
|
|
15695
15716
|
// src/commands/backlog/removePhase.ts
|
|
15696
|
-
import
|
|
15717
|
+
import chalk112 from "chalk";
|
|
15697
15718
|
import { and as and18, eq as eq38 } from "drizzle-orm";
|
|
15698
15719
|
async function removePhase(id, phase) {
|
|
15699
15720
|
const found = await findPhase(id, phase);
|
|
@@ -15708,27 +15729,27 @@ async function removePhase(id, phase) {
|
|
|
15708
15729
|
await adjustCurrentPhase(tx, item, phaseIdx);
|
|
15709
15730
|
});
|
|
15710
15731
|
console.log(
|
|
15711
|
-
|
|
15732
|
+
chalk112.green(
|
|
15712
15733
|
`Removed phase ${phaseIdx + 1} from item ${formatItemId(itemId2)}.`
|
|
15713
15734
|
)
|
|
15714
15735
|
);
|
|
15715
15736
|
}
|
|
15716
15737
|
|
|
15717
15738
|
// src/commands/backlog/update/update.ts
|
|
15718
|
-
import
|
|
15739
|
+
import chalk116 from "chalk";
|
|
15719
15740
|
import { eq as eq39 } from "drizzle-orm";
|
|
15720
15741
|
|
|
15721
15742
|
// src/commands/backlog/update/buildUpdateValues.ts
|
|
15722
|
-
import
|
|
15743
|
+
import chalk113 from "chalk";
|
|
15723
15744
|
function buildUpdateValues(options2) {
|
|
15724
15745
|
const { name, desc: desc6, type, ac, origin } = options2;
|
|
15725
15746
|
if (!name && !desc6 && !type && !ac && !origin) {
|
|
15726
|
-
console.log(
|
|
15747
|
+
console.log(chalk113.red("Nothing to update. Provide at least one flag."));
|
|
15727
15748
|
process.exitCode = 1;
|
|
15728
15749
|
return void 0;
|
|
15729
15750
|
}
|
|
15730
15751
|
if (type && type !== "story" && type !== "bug") {
|
|
15731
|
-
console.log(
|
|
15752
|
+
console.log(chalk113.red('Invalid type. Must be "story" or "bug".'));
|
|
15732
15753
|
process.exitCode = 1;
|
|
15733
15754
|
return void 0;
|
|
15734
15755
|
}
|
|
@@ -15758,7 +15779,7 @@ function buildUpdateValues(options2) {
|
|
|
15758
15779
|
}
|
|
15759
15780
|
|
|
15760
15781
|
// src/commands/backlog/update/resolveAcUpdate.ts
|
|
15761
|
-
import
|
|
15782
|
+
import chalk114 from "chalk";
|
|
15762
15783
|
|
|
15763
15784
|
// src/commands/backlog/update/applyAcMutations.ts
|
|
15764
15785
|
function hasAcMutations(options2) {
|
|
@@ -15783,14 +15804,14 @@ function resolveAcUpdate(options2, currentCriteria) {
|
|
|
15783
15804
|
if (!hasAcMutations(options2)) return { ok: true, ac: options2.ac };
|
|
15784
15805
|
if (options2.ac) {
|
|
15785
15806
|
console.log(
|
|
15786
|
-
|
|
15807
|
+
chalk114.red("Cannot combine --ac with --add-ac/--edit-ac/--remove-ac.")
|
|
15787
15808
|
);
|
|
15788
15809
|
process.exitCode = 1;
|
|
15789
15810
|
return { ok: false };
|
|
15790
15811
|
}
|
|
15791
15812
|
const mutation = applyAcMutations(currentCriteria, options2);
|
|
15792
15813
|
if (!mutation.ok) {
|
|
15793
|
-
console.log(
|
|
15814
|
+
console.log(chalk114.red(mutation.error));
|
|
15794
15815
|
process.exitCode = 1;
|
|
15795
15816
|
return { ok: false };
|
|
15796
15817
|
}
|
|
@@ -15798,14 +15819,14 @@ function resolveAcUpdate(options2, currentCriteria) {
|
|
|
15798
15819
|
}
|
|
15799
15820
|
|
|
15800
15821
|
// src/commands/backlog/update/resolveOriginUpdate.ts
|
|
15801
|
-
import
|
|
15822
|
+
import chalk115 from "chalk";
|
|
15802
15823
|
function resolveOriginUpdate(optionOrigin, item) {
|
|
15803
15824
|
if (optionOrigin === void 0 || optionOrigin === false)
|
|
15804
15825
|
return { kind: "none" };
|
|
15805
15826
|
const origin = typeof optionOrigin === "string" ? normalizeOrigin(optionOrigin) : getOrigin();
|
|
15806
15827
|
if (origin === item.origin) {
|
|
15807
15828
|
console.log(
|
|
15808
|
-
|
|
15829
|
+
chalk115.yellow(
|
|
15809
15830
|
`Item ${formatItemId(item.id)} is already on origin "${origin}"; nothing to change.`
|
|
15810
15831
|
)
|
|
15811
15832
|
);
|
|
@@ -15829,12 +15850,12 @@ async function update(id, options2) {
|
|
|
15829
15850
|
const itemId2 = found.item.id;
|
|
15830
15851
|
await orm.update(items).set(built.set).where(eq39(items.id, itemId2));
|
|
15831
15852
|
console.log(
|
|
15832
|
-
|
|
15853
|
+
chalk116.green(`Updated ${built.fields} on item ${formatItemId(itemId2)}.`)
|
|
15833
15854
|
);
|
|
15834
15855
|
}
|
|
15835
15856
|
|
|
15836
15857
|
// src/commands/backlog/updatePlan/index.ts
|
|
15837
|
-
import
|
|
15858
|
+
import chalk118 from "chalk";
|
|
15838
15859
|
|
|
15839
15860
|
// src/commands/backlog/updatePlan/planUpdateSchema.ts
|
|
15840
15861
|
import { z as z7 } from "zod";
|
|
@@ -15884,7 +15905,7 @@ async function replacePlan(orm, itemId2, phases, currentPhase) {
|
|
|
15884
15905
|
|
|
15885
15906
|
// src/commands/backlog/updatePlan/reviewPlanUpdate.ts
|
|
15886
15907
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
15887
|
-
import
|
|
15908
|
+
import chalk117 from "chalk";
|
|
15888
15909
|
|
|
15889
15910
|
// src/commands/backlog/updatePlan/isCompleted.ts
|
|
15890
15911
|
function isCompleted(previousPosition, currentPhase) {
|
|
@@ -16049,7 +16070,7 @@ async function reviewPlanUpdate(item, phases) {
|
|
|
16049
16070
|
});
|
|
16050
16071
|
return;
|
|
16051
16072
|
}
|
|
16052
|
-
console.log(
|
|
16073
|
+
console.log(chalk117.bold(item.name));
|
|
16053
16074
|
console.log(renderMarkdownTerminal(body));
|
|
16054
16075
|
}
|
|
16055
16076
|
|
|
@@ -16062,7 +16083,7 @@ async function updatePlan(id, options2) {
|
|
|
16062
16083
|
await reviewPlanUpdate(item, phases);
|
|
16063
16084
|
await replacePlan(orm, item.id, phases, item.currentPhase);
|
|
16064
16085
|
console.log(
|
|
16065
|
-
|
|
16086
|
+
chalk118.green(
|
|
16066
16087
|
`Replaced the plan on item ${formatItemId(item.id)} with ${phases.length} phase${phases.length === 1 ? "" : "s"}.`
|
|
16067
16088
|
)
|
|
16068
16089
|
);
|
|
@@ -16993,11 +17014,11 @@ function assertCliExists(cli) {
|
|
|
16993
17014
|
}
|
|
16994
17015
|
|
|
16995
17016
|
// src/commands/permitCliReads/colorize.ts
|
|
16996
|
-
import
|
|
17017
|
+
import chalk119 from "chalk";
|
|
16997
17018
|
function colorize(plainOutput) {
|
|
16998
17019
|
return plainOutput.split("\n").map((line) => {
|
|
16999
|
-
if (line.startsWith(" R ")) return
|
|
17000
|
-
if (line.startsWith(" W ")) return
|
|
17020
|
+
if (line.startsWith(" R ")) return chalk119.green(line);
|
|
17021
|
+
if (line.startsWith(" W ")) return chalk119.red(line);
|
|
17001
17022
|
return line;
|
|
17002
17023
|
}).join("\n");
|
|
17003
17024
|
}
|
|
@@ -17290,7 +17311,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
17290
17311
|
}
|
|
17291
17312
|
|
|
17292
17313
|
// src/commands/deny/denyAdd.ts
|
|
17293
|
-
import
|
|
17314
|
+
import chalk120 from "chalk";
|
|
17294
17315
|
|
|
17295
17316
|
// src/commands/deny/loadDenyConfig.ts
|
|
17296
17317
|
function loadDenyConfig(global) {
|
|
@@ -17310,16 +17331,16 @@ function loadDenyConfig(global) {
|
|
|
17310
17331
|
function denyAdd(pattern2, message3, options2) {
|
|
17311
17332
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
17312
17333
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
17313
|
-
console.log(
|
|
17334
|
+
console.log(chalk120.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
17314
17335
|
return;
|
|
17315
17336
|
}
|
|
17316
17337
|
deny.push({ pattern: pattern2, message: message3 });
|
|
17317
17338
|
saveDeny(deny);
|
|
17318
|
-
console.log(
|
|
17339
|
+
console.log(chalk120.green(`Added deny rule: ${pattern2} \u2192 ${message3}`));
|
|
17319
17340
|
}
|
|
17320
17341
|
|
|
17321
17342
|
// src/commands/deny/denyList.ts
|
|
17322
|
-
import
|
|
17343
|
+
import chalk121 from "chalk";
|
|
17323
17344
|
function denyList() {
|
|
17324
17345
|
const globalRaw = loadGlobalConfigRaw();
|
|
17325
17346
|
const projectRaw = loadProjectConfig();
|
|
@@ -17330,7 +17351,7 @@ function denyList() {
|
|
|
17330
17351
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
17331
17352
|
);
|
|
17332
17353
|
if (!merged || merged.length === 0) {
|
|
17333
|
-
console.log(
|
|
17354
|
+
console.log(chalk121.dim("No deny rules configured."));
|
|
17334
17355
|
return;
|
|
17335
17356
|
}
|
|
17336
17357
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -17338,23 +17359,23 @@ function denyList() {
|
|
|
17338
17359
|
for (const rule of merged) {
|
|
17339
17360
|
const inProject = projectPatterns.has(rule.pattern);
|
|
17340
17361
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
17341
|
-
const label2 = inProject && inGlobal ?
|
|
17342
|
-
console.log(`${
|
|
17362
|
+
const label2 = inProject && inGlobal ? chalk121.dim(" (project, overrides global)") : inGlobal ? chalk121.dim(" (global)") : "";
|
|
17363
|
+
console.log(`${chalk121.red(rule.pattern)} \u2192 ${rule.message}${label2}`);
|
|
17343
17364
|
}
|
|
17344
17365
|
}
|
|
17345
17366
|
|
|
17346
17367
|
// src/commands/deny/denyRemove.ts
|
|
17347
|
-
import
|
|
17368
|
+
import chalk122 from "chalk";
|
|
17348
17369
|
function denyRemove(pattern2, options2) {
|
|
17349
17370
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
17350
17371
|
const index3 = deny.findIndex((r) => r.pattern === pattern2);
|
|
17351
17372
|
if (index3 === -1) {
|
|
17352
|
-
console.log(
|
|
17373
|
+
console.log(chalk122.yellow(`No deny rule found for: ${pattern2}`));
|
|
17353
17374
|
return;
|
|
17354
17375
|
}
|
|
17355
17376
|
deny.splice(index3, 1);
|
|
17356
17377
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
17357
|
-
console.log(
|
|
17378
|
+
console.log(chalk122.green(`Removed deny rule: ${pattern2}`));
|
|
17358
17379
|
}
|
|
17359
17380
|
|
|
17360
17381
|
// src/commands/registerDeny.ts
|
|
@@ -17386,7 +17407,7 @@ function registerCliHook(program2) {
|
|
|
17386
17407
|
|
|
17387
17408
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
17388
17409
|
import { existsSync as existsSync37, readFileSync as readFileSync29, unlinkSync as unlinkSync8, writeFileSync as writeFileSync24 } from "fs";
|
|
17389
|
-
import
|
|
17410
|
+
import chalk123 from "chalk";
|
|
17390
17411
|
|
|
17391
17412
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
17392
17413
|
import { homedir as homedir17 } from "os";
|
|
@@ -17439,12 +17460,12 @@ function codeCommentConfirm(pin) {
|
|
|
17439
17460
|
sweepRestrictedDir();
|
|
17440
17461
|
const state = readPinState(pin);
|
|
17441
17462
|
if (!state) {
|
|
17442
|
-
console.error(
|
|
17463
|
+
console.error(chalk123.red(`No pending comment for pin: ${pin}`));
|
|
17443
17464
|
process.exitCode = 1;
|
|
17444
17465
|
return;
|
|
17445
17466
|
}
|
|
17446
17467
|
if (!existsSync37(state.file)) {
|
|
17447
|
-
console.error(
|
|
17468
|
+
console.error(chalk123.red(`Target file no longer exists: ${state.file}`));
|
|
17448
17469
|
process.exitCode = 1;
|
|
17449
17470
|
return;
|
|
17450
17471
|
}
|
|
@@ -17453,7 +17474,7 @@ function codeCommentConfirm(pin) {
|
|
|
17453
17474
|
const index3 = state.line - 1;
|
|
17454
17475
|
if (index3 > lines2.length) {
|
|
17455
17476
|
console.error(
|
|
17456
|
-
|
|
17477
|
+
chalk123.red(
|
|
17457
17478
|
`Line ${state.line} is beyond the end of ${state.file} (${lines2.length} lines).`
|
|
17458
17479
|
)
|
|
17459
17480
|
);
|
|
@@ -17467,14 +17488,14 @@ function codeCommentConfirm(pin) {
|
|
|
17467
17488
|
writeFileSync24(state.file, lines2.join("\n"));
|
|
17468
17489
|
unlinkSync8(getPinStatePath(pin));
|
|
17469
17490
|
console.log(
|
|
17470
|
-
|
|
17491
|
+
chalk123.green(
|
|
17471
17492
|
`Inserted "${marker2} ${state.text}" at ${state.file}:${state.line}`
|
|
17472
17493
|
)
|
|
17473
17494
|
);
|
|
17474
17495
|
}
|
|
17475
17496
|
|
|
17476
17497
|
// src/commands/codeComment/codeCommentSet.ts
|
|
17477
|
-
import
|
|
17498
|
+
import chalk124 from "chalk";
|
|
17478
17499
|
|
|
17479
17500
|
// src/commands/codeComment/validateCommentText.ts
|
|
17480
17501
|
var MAX_COMMENT_LENGTH = 50;
|
|
@@ -17525,7 +17546,7 @@ function generatePin() {
|
|
|
17525
17546
|
function codeCommentSet(file, line, text18) {
|
|
17526
17547
|
const lineNumber = Number.parseInt(line, 10);
|
|
17527
17548
|
if (!Number.isInteger(lineNumber) || lineNumber < 1) {
|
|
17528
|
-
console.error(
|
|
17549
|
+
console.error(chalk124.red(`Invalid line number: ${line}`));
|
|
17529
17550
|
process.exitCode = 1;
|
|
17530
17551
|
return;
|
|
17531
17552
|
}
|
|
@@ -17533,20 +17554,20 @@ function codeCommentSet(file, line, text18) {
|
|
|
17533
17554
|
const marker2 = hash ? "#" : "//";
|
|
17534
17555
|
const validation = validateCommentText(text18, hash);
|
|
17535
17556
|
if (!validation.ok) {
|
|
17536
|
-
console.error(
|
|
17537
|
-
console.error(
|
|
17557
|
+
console.error(chalk124.red(`Refused: ${validation.reason}`));
|
|
17558
|
+
console.error(chalk124.red("No pin issued."));
|
|
17538
17559
|
process.exitCode = 1;
|
|
17539
17560
|
return;
|
|
17540
17561
|
}
|
|
17541
17562
|
console.error(
|
|
17542
|
-
|
|
17563
|
+
chalk124.yellow.bold(
|
|
17543
17564
|
"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
17565
|
)
|
|
17545
17566
|
);
|
|
17546
17567
|
const delivered = issuePin(file, lineNumber, validation.text);
|
|
17547
17568
|
if (!delivered) {
|
|
17548
17569
|
console.error(
|
|
17549
|
-
|
|
17570
|
+
chalk124.red(
|
|
17550
17571
|
"Could not deliver the confirmation pin via notification.\nThe comment cannot be confirmed until the notification channel works."
|
|
17551
17572
|
)
|
|
17552
17573
|
);
|
|
@@ -17556,7 +17577,7 @@ function codeCommentSet(file, line, text18) {
|
|
|
17556
17577
|
console.log(
|
|
17557
17578
|
`A confirmation pin was sent to your desktop notifications.
|
|
17558
17579
|
To insert "${marker2} ${validation.text}" at ${file}:${lineNumber}, run:
|
|
17559
|
-
${
|
|
17580
|
+
${chalk124.cyan(" assist code-comment confirm <PIN>")}
|
|
17560
17581
|
using the pin from that notification.`
|
|
17561
17582
|
);
|
|
17562
17583
|
}
|
|
@@ -17655,15 +17676,15 @@ function registerCodexHook(program2) {
|
|
|
17655
17676
|
}
|
|
17656
17677
|
|
|
17657
17678
|
// src/commands/complexity/analyze.ts
|
|
17658
|
-
import
|
|
17679
|
+
import chalk133 from "chalk";
|
|
17659
17680
|
|
|
17660
17681
|
// src/commands/complexity/cyclomatic.ts
|
|
17661
|
-
import
|
|
17682
|
+
import chalk126 from "chalk";
|
|
17662
17683
|
|
|
17663
17684
|
// src/commands/complexity/shared/index.ts
|
|
17664
17685
|
import fs23 from "fs";
|
|
17665
17686
|
import path31 from "path";
|
|
17666
|
-
import
|
|
17687
|
+
import chalk125 from "chalk";
|
|
17667
17688
|
import ts5 from "typescript";
|
|
17668
17689
|
|
|
17669
17690
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -17914,7 +17935,7 @@ function createSourceFromFile(filePath) {
|
|
|
17914
17935
|
function withSourceFiles(pattern2, callback, extraIgnore = []) {
|
|
17915
17936
|
const files = findSourceFiles2(pattern2, ".", extraIgnore);
|
|
17916
17937
|
if (files.length === 0) {
|
|
17917
|
-
console.log(
|
|
17938
|
+
console.log(chalk125.yellow("No files found matching pattern"));
|
|
17918
17939
|
return void 0;
|
|
17919
17940
|
}
|
|
17920
17941
|
return callback(files);
|
|
@@ -17947,11 +17968,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
17947
17968
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
17948
17969
|
for (const { file, name, complexity } of results) {
|
|
17949
17970
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
17950
|
-
const color = exceedsThreshold ?
|
|
17951
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
17971
|
+
const color = exceedsThreshold ? chalk126.red : chalk126.white;
|
|
17972
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk126.cyan(complexity)}`);
|
|
17952
17973
|
}
|
|
17953
17974
|
console.log(
|
|
17954
|
-
|
|
17975
|
+
chalk126.dim(
|
|
17955
17976
|
`
|
|
17956
17977
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
17957
17978
|
)
|
|
@@ -17963,7 +17984,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
17963
17984
|
}
|
|
17964
17985
|
|
|
17965
17986
|
// src/commands/complexity/halstead.ts
|
|
17966
|
-
import
|
|
17987
|
+
import chalk127 from "chalk";
|
|
17967
17988
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
17968
17989
|
withSourceFiles(pattern2, (files) => {
|
|
17969
17990
|
const results = [];
|
|
@@ -17978,13 +17999,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
17978
17999
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
17979
18000
|
for (const { file, name, metrics } of results) {
|
|
17980
18001
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
17981
|
-
const color = exceedsThreshold ?
|
|
18002
|
+
const color = exceedsThreshold ? chalk127.red : chalk127.white;
|
|
17982
18003
|
console.log(
|
|
17983
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
18004
|
+
`${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
18005
|
);
|
|
17985
18006
|
}
|
|
17986
18007
|
console.log(
|
|
17987
|
-
|
|
18008
|
+
chalk127.dim(
|
|
17988
18009
|
`
|
|
17989
18010
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
17990
18011
|
)
|
|
@@ -18053,15 +18074,15 @@ function collectFileMetrics(files) {
|
|
|
18053
18074
|
}
|
|
18054
18075
|
|
|
18055
18076
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
18056
|
-
import
|
|
18077
|
+
import chalk131 from "chalk";
|
|
18057
18078
|
|
|
18058
18079
|
// src/commands/complexity/maintainability/formatResultLine.ts
|
|
18059
|
-
import
|
|
18080
|
+
import chalk128 from "chalk";
|
|
18060
18081
|
function formatResultLine(entry, failing) {
|
|
18061
18082
|
const { file, avgMaintainability, minMaintainability, override } = entry;
|
|
18062
|
-
const name = failing ?
|
|
18063
|
-
const suffix = override !== void 0 ?
|
|
18064
|
-
return `${name} \u2192 avg: ${
|
|
18083
|
+
const name = failing ? chalk128.red(file) : chalk128.white(file);
|
|
18084
|
+
const suffix = override !== void 0 ? chalk128.magenta(` (override: ${override})`) : "";
|
|
18085
|
+
return `${name} \u2192 avg: ${chalk128.cyan(avgMaintainability.toFixed(1))}, min: ${chalk128.yellow(minMaintainability.toFixed(1))}${suffix}`;
|
|
18065
18086
|
}
|
|
18066
18087
|
|
|
18067
18088
|
// src/commands/complexity/maintainability/getMaintainabilityGitState.ts
|
|
@@ -18112,38 +18133,38 @@ function getMaintainabilityGitState() {
|
|
|
18112
18133
|
|
|
18113
18134
|
// src/commands/complexity/maintainability/printMaintainabilityFailure.ts
|
|
18114
18135
|
import path33 from "path";
|
|
18115
|
-
import
|
|
18136
|
+
import chalk129 from "chalk";
|
|
18116
18137
|
var extractTemplate = "assist refactor extract <file> <functionName> <destination> --apply";
|
|
18117
18138
|
function remediationLine(entry) {
|
|
18118
|
-
return ` ${
|
|
18139
|
+
return ` ${chalk129.bold(entry.file)}
|
|
18119
18140
|
Pick a responsibility and extract it:
|
|
18120
|
-
${
|
|
18141
|
+
${chalk129.cyan(extractTemplate)}`;
|
|
18121
18142
|
}
|
|
18122
18143
|
function cheatLine(entry, gitState) {
|
|
18123
18144
|
const shrank = gitState.shrunkFiles.has(path33.resolve(entry.file));
|
|
18124
18145
|
if (!shrank || gitState.newFileCreated) return "";
|
|
18125
18146
|
return `
|
|
18126
|
-
${
|
|
18147
|
+
${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
18148
|
}
|
|
18128
18149
|
function printMaintainabilityFailure(failing, gitState) {
|
|
18129
18150
|
const blocks = failing.map((entry) => `${remediationLine(entry)}${cheatLine(entry, gitState)}`).join("\n");
|
|
18130
18151
|
console.error(
|
|
18131
|
-
|
|
18152
|
+
chalk129.red(
|
|
18132
18153
|
`
|
|
18133
18154
|
Fail: ${failing.length} file(s) below threshold \u2192 extract a responsibility to a new file.
|
|
18134
18155
|
|
|
18135
18156
|
${blocks}
|
|
18136
18157
|
|
|
18137
|
-
${
|
|
18158
|
+
${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
18159
|
)
|
|
18139
18160
|
);
|
|
18140
18161
|
}
|
|
18141
18162
|
|
|
18142
18163
|
// src/commands/complexity/maintainability/printMaintainabilityFormula.ts
|
|
18143
|
-
import
|
|
18164
|
+
import chalk130 from "chalk";
|
|
18144
18165
|
var MI_FORMULA = "171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100";
|
|
18145
18166
|
function printMaintainabilityFormula() {
|
|
18146
|
-
console.log(
|
|
18167
|
+
console.log(chalk130.dim(MI_FORMULA));
|
|
18147
18168
|
}
|
|
18148
18169
|
|
|
18149
18170
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
@@ -18152,7 +18173,7 @@ function displayMaintainabilityResults(results, threshold, gitState = getMaintai
|
|
|
18152
18173
|
if (!gating) {
|
|
18153
18174
|
printMaintainabilityFormula();
|
|
18154
18175
|
for (const entry of results) console.log(formatResultLine(entry, false));
|
|
18155
|
-
console.log(
|
|
18176
|
+
console.log(chalk131.dim(`
|
|
18156
18177
|
Analyzed ${results.length} files`));
|
|
18157
18178
|
return;
|
|
18158
18179
|
}
|
|
@@ -18161,14 +18182,14 @@ Analyzed ${results.length} files`));
|
|
|
18161
18182
|
return limit !== void 0 && r.minMaintainability < limit;
|
|
18162
18183
|
});
|
|
18163
18184
|
if (failing.length === 0) {
|
|
18164
|
-
console.log(
|
|
18185
|
+
console.log(chalk131.green("All files pass maintainability threshold"));
|
|
18165
18186
|
}
|
|
18166
18187
|
const passingOverrides = results.filter(
|
|
18167
18188
|
(r) => r.override !== void 0 && !failing.includes(r)
|
|
18168
18189
|
);
|
|
18169
18190
|
for (const entry of passingOverrides)
|
|
18170
18191
|
console.log(formatResultLine(entry, false));
|
|
18171
|
-
console.log(
|
|
18192
|
+
console.log(chalk131.dim(`
|
|
18172
18193
|
Analyzed ${results.length} files`));
|
|
18173
18194
|
if (failing.length > 0) {
|
|
18174
18195
|
printMaintainabilityFailure(failing, gitState);
|
|
@@ -18191,7 +18212,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
18191
18212
|
|
|
18192
18213
|
// src/commands/complexity/sloc.ts
|
|
18193
18214
|
import fs25 from "fs";
|
|
18194
|
-
import
|
|
18215
|
+
import chalk132 from "chalk";
|
|
18195
18216
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
18196
18217
|
withSourceFiles(pattern2, (files) => {
|
|
18197
18218
|
const results = [];
|
|
@@ -18207,12 +18228,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
18207
18228
|
results.sort((a, b) => b.lines - a.lines);
|
|
18208
18229
|
for (const { file, lines: lines2 } of results) {
|
|
18209
18230
|
const exceedsThreshold = options2.threshold !== void 0 && lines2 > options2.threshold;
|
|
18210
|
-
const color = exceedsThreshold ?
|
|
18211
|
-
console.log(`${color(file)} \u2192 ${
|
|
18231
|
+
const color = exceedsThreshold ? chalk132.red : chalk132.white;
|
|
18232
|
+
console.log(`${color(file)} \u2192 ${chalk132.cyan(lines2)} lines`);
|
|
18212
18233
|
}
|
|
18213
18234
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
18214
18235
|
console.log(
|
|
18215
|
-
|
|
18236
|
+
chalk132.dim(`
|
|
18216
18237
|
Total: ${total} lines across ${files.length} files`)
|
|
18217
18238
|
);
|
|
18218
18239
|
if (hasViolation) {
|
|
@@ -18226,25 +18247,25 @@ async function analyze(pattern2) {
|
|
|
18226
18247
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
18227
18248
|
const files = findSourceFiles2(searchPattern);
|
|
18228
18249
|
if (files.length === 0) {
|
|
18229
|
-
console.log(
|
|
18250
|
+
console.log(chalk133.yellow("No files found matching pattern"));
|
|
18230
18251
|
return;
|
|
18231
18252
|
}
|
|
18232
18253
|
if (files.length === 1) {
|
|
18233
18254
|
const file = files[0];
|
|
18234
|
-
console.log(
|
|
18255
|
+
console.log(chalk133.bold.underline("SLOC"));
|
|
18235
18256
|
await sloc(file);
|
|
18236
18257
|
console.log();
|
|
18237
|
-
console.log(
|
|
18258
|
+
console.log(chalk133.bold.underline("Cyclomatic Complexity"));
|
|
18238
18259
|
await cyclomatic(file);
|
|
18239
18260
|
console.log();
|
|
18240
|
-
console.log(
|
|
18261
|
+
console.log(chalk133.bold.underline("Halstead Metrics"));
|
|
18241
18262
|
await halstead(file);
|
|
18242
18263
|
console.log();
|
|
18243
|
-
console.log(
|
|
18264
|
+
console.log(chalk133.bold.underline("Maintainability Index"));
|
|
18244
18265
|
await maintainability(file);
|
|
18245
18266
|
console.log();
|
|
18246
18267
|
console.log(
|
|
18247
|
-
|
|
18268
|
+
chalk133.dim(
|
|
18248
18269
|
"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
18270
|
)
|
|
18250
18271
|
);
|
|
@@ -18279,7 +18300,7 @@ function registerComplexity(program2) {
|
|
|
18279
18300
|
}
|
|
18280
18301
|
|
|
18281
18302
|
// src/commands/config/index.ts
|
|
18282
|
-
import
|
|
18303
|
+
import chalk134 from "chalk";
|
|
18283
18304
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
18284
18305
|
function configList() {
|
|
18285
18306
|
const config = maskConfigSecrets(
|
|
@@ -18287,7 +18308,7 @@ function configList() {
|
|
|
18287
18308
|
describeConfigNode(assistConfigSchema)
|
|
18288
18309
|
);
|
|
18289
18310
|
console.log(
|
|
18290
|
-
|
|
18311
|
+
chalk134.dim(
|
|
18291
18312
|
"# Only the keys that are set; run assist config keys for every key and its default"
|
|
18292
18313
|
)
|
|
18293
18314
|
);
|
|
@@ -18295,7 +18316,7 @@ function configList() {
|
|
|
18295
18316
|
}
|
|
18296
18317
|
|
|
18297
18318
|
// src/commands/config/configGet.ts
|
|
18298
|
-
import
|
|
18319
|
+
import chalk135 from "chalk";
|
|
18299
18320
|
|
|
18300
18321
|
// src/commands/config/formatConfigDefault.ts
|
|
18301
18322
|
function formatConfigDefault(leaf) {
|
|
@@ -18335,29 +18356,29 @@ function unsetLines(key) {
|
|
|
18335
18356
|
const leaf = describeConfigLeaves(assistConfigSchema).find(
|
|
18336
18357
|
(candidate) => candidate.key === key
|
|
18337
18358
|
);
|
|
18338
|
-
if (!leaf) return [
|
|
18359
|
+
if (!leaf) return [chalk135.red(`Key "${key}" is not set`)];
|
|
18339
18360
|
const lines2 = [
|
|
18340
|
-
|
|
18361
|
+
chalk135.red(
|
|
18341
18362
|
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
18363
|
)
|
|
18343
18364
|
];
|
|
18344
18365
|
const help = configHelpForKey(key);
|
|
18345
|
-
if (help) lines2.push(help.note,
|
|
18366
|
+
if (help) lines2.push(help.note, chalk135.green(help.setter));
|
|
18346
18367
|
return lines2;
|
|
18347
18368
|
}
|
|
18348
18369
|
|
|
18349
18370
|
// src/commands/config/configKeys.ts
|
|
18350
|
-
import
|
|
18371
|
+
import chalk136 from "chalk";
|
|
18351
18372
|
function configKeys2(filter) {
|
|
18352
18373
|
const leaves = describeConfigLeaves(assistConfigSchema);
|
|
18353
18374
|
const matches = filter ? leaves.filter(matching(filter)) : leaves;
|
|
18354
18375
|
if (matches.length === 0) {
|
|
18355
|
-
console.error(
|
|
18376
|
+
console.error(chalk136.red(`No config key matches "${filter}"`));
|
|
18356
18377
|
process.exit(1);
|
|
18357
18378
|
}
|
|
18358
18379
|
console.log(headline(matches.length, leaves.length, filter));
|
|
18359
18380
|
console.log(
|
|
18360
|
-
|
|
18381
|
+
chalk136.dim(
|
|
18361
18382
|
"Defaults come from the schema; assist config list shows what is set."
|
|
18362
18383
|
)
|
|
18363
18384
|
);
|
|
@@ -18373,13 +18394,13 @@ function matching(filter) {
|
|
|
18373
18394
|
return (leaf) => leaf.key.toLowerCase().includes(needle);
|
|
18374
18395
|
}
|
|
18375
18396
|
function headline(shown, total, filter) {
|
|
18376
|
-
return filter ?
|
|
18397
|
+
return filter ? chalk136.bold(`${shown} of ${total} config keys matching "${filter}"`) : chalk136.bold(`${total} config keys`);
|
|
18377
18398
|
}
|
|
18378
18399
|
function formatLeaf(leaf, help) {
|
|
18379
18400
|
const meta = [typeText(leaf), `default: ${formatConfigDefault(leaf)}`];
|
|
18380
18401
|
if (leaf.secret) meta.push("secret");
|
|
18381
|
-
const lines2 = [`${
|
|
18382
|
-
if (help) lines2.push(` ${help.note}`, ` ${
|
|
18402
|
+
const lines2 = [`${chalk136.cyan(leaf.key)} ${chalk136.dim(meta.join(" "))}`];
|
|
18403
|
+
if (help) lines2.push(` ${help.note}`, ` ${chalk136.green(help.setter)}`);
|
|
18383
18404
|
return lines2;
|
|
18384
18405
|
}
|
|
18385
18406
|
function typeText(leaf) {
|
|
@@ -18390,7 +18411,7 @@ function typeText(leaf) {
|
|
|
18390
18411
|
}
|
|
18391
18412
|
|
|
18392
18413
|
// src/commands/config/configSet.ts
|
|
18393
|
-
import
|
|
18414
|
+
import chalk138 from "chalk";
|
|
18394
18415
|
|
|
18395
18416
|
// src/commands/config/coerceCliConfigValue.ts
|
|
18396
18417
|
function coerceCliConfigValue(key, raw) {
|
|
@@ -18411,9 +18432,9 @@ function coerceWithoutSchemaLeaf(raw) {
|
|
|
18411
18432
|
}
|
|
18412
18433
|
|
|
18413
18434
|
// src/commands/config/exitWithConfigErrors.ts
|
|
18414
|
-
import
|
|
18435
|
+
import chalk137 from "chalk";
|
|
18415
18436
|
function exitWithConfigErrors(errors) {
|
|
18416
|
-
for (const error of errors) console.error(
|
|
18437
|
+
for (const error of errors) console.error(chalk137.red(error));
|
|
18417
18438
|
process.exit(1);
|
|
18418
18439
|
}
|
|
18419
18440
|
|
|
@@ -18432,13 +18453,13 @@ function resolveRepoTarget(key, value, repo) {
|
|
|
18432
18453
|
function configSet(key, value, options2 = {}) {
|
|
18433
18454
|
if (options2.repo !== void 0 && !options2.global) {
|
|
18434
18455
|
console.error(
|
|
18435
|
-
|
|
18456
|
+
chalk138.red("--repo writes to the global config; add -g (e.g. -g --repo)")
|
|
18436
18457
|
);
|
|
18437
18458
|
process.exit(1);
|
|
18438
18459
|
}
|
|
18439
18460
|
const resolved = resolveRepoTarget(key, value, options2.repo);
|
|
18440
18461
|
if (resolved.value === void 0) {
|
|
18441
|
-
console.error(
|
|
18462
|
+
console.error(chalk138.red(`Missing required argument for '${resolved.key}'`));
|
|
18442
18463
|
process.exit(1);
|
|
18443
18464
|
}
|
|
18444
18465
|
const coercion = coerceCliConfigValue(resolved.key, resolved.value);
|
|
@@ -18446,7 +18467,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
18446
18467
|
const coerced = coercion.value;
|
|
18447
18468
|
const target = resolved.useRepo ? `repo: ${applyRepoOrExit(resolved.key, coerced, resolved.repoName)}` : applyOrExit(resolved.key, coerced, options2.global ?? false);
|
|
18448
18469
|
const shown = JSON.stringify(maskConfigKeySecrets(resolved.key, coerced));
|
|
18449
|
-
console.log(
|
|
18470
|
+
console.log(chalk138.green(`Set ${resolved.key} = ${shown} (${target})`));
|
|
18450
18471
|
}
|
|
18451
18472
|
function applyOrExit(key, coerced, global) {
|
|
18452
18473
|
const result = applyConfigSet(key, coerced, global);
|
|
@@ -18460,7 +18481,7 @@ function applyRepoOrExit(key, coerced, repoName) {
|
|
|
18460
18481
|
}
|
|
18461
18482
|
|
|
18462
18483
|
// src/commands/config/configUnset.ts
|
|
18463
|
-
import
|
|
18484
|
+
import chalk139 from "chalk";
|
|
18464
18485
|
|
|
18465
18486
|
// src/commands/config/resolveRepoUnsetTarget.ts
|
|
18466
18487
|
function resolveRepoUnsetTarget(key, repo) {
|
|
@@ -18476,7 +18497,7 @@ function resolveRepoUnsetTarget(key, repo) {
|
|
|
18476
18497
|
function configUnset(key, options2 = {}) {
|
|
18477
18498
|
if (options2.repo !== void 0 && !options2.global) {
|
|
18478
18499
|
console.error(
|
|
18479
|
-
|
|
18500
|
+
chalk139.red(
|
|
18480
18501
|
"--repo removes from the global config; add -g (e.g. -g --repo)"
|
|
18481
18502
|
)
|
|
18482
18503
|
);
|
|
@@ -18484,7 +18505,7 @@ function configUnset(key, options2 = {}) {
|
|
|
18484
18505
|
}
|
|
18485
18506
|
const resolved = resolveRepoUnsetTarget(key, options2.repo);
|
|
18486
18507
|
if (resolved.key === void 0) {
|
|
18487
|
-
console.error(
|
|
18508
|
+
console.error(chalk139.red("Missing required argument 'key'"));
|
|
18488
18509
|
process.exit(1);
|
|
18489
18510
|
return;
|
|
18490
18511
|
}
|
|
@@ -18492,11 +18513,11 @@ function configUnset(key, options2 = {}) {
|
|
|
18492
18513
|
if (!result.ok) exitWithConfigErrors(result.errors);
|
|
18493
18514
|
if (!result.removed) {
|
|
18494
18515
|
console.log(
|
|
18495
|
-
|
|
18516
|
+
chalk139.yellow(`${resolved.key} is not set in ${whereLabel(result)}`)
|
|
18496
18517
|
);
|
|
18497
18518
|
return;
|
|
18498
18519
|
}
|
|
18499
|
-
console.log(
|
|
18520
|
+
console.log(chalk139.green(`Unset ${resolved.key} (${targetLabel(result)})`));
|
|
18500
18521
|
}
|
|
18501
18522
|
function whereLabel(result) {
|
|
18502
18523
|
return result.target === "repo" ? `repos.${result.label}` : `the ${result.target} config`;
|
|
@@ -18530,40 +18551,40 @@ function registerConfig(program2) {
|
|
|
18530
18551
|
}
|
|
18531
18552
|
|
|
18532
18553
|
// src/commands/db/reportMigrationStatus.ts
|
|
18533
|
-
import
|
|
18554
|
+
import chalk140 from "chalk";
|
|
18534
18555
|
function reportApplied(applied) {
|
|
18535
18556
|
if (applied.length === 0) {
|
|
18536
|
-
console.error(
|
|
18557
|
+
console.error(chalk140.green("Database is up to date; nothing to apply."));
|
|
18537
18558
|
return;
|
|
18538
18559
|
}
|
|
18539
18560
|
for (const migration of applied) {
|
|
18540
18561
|
console.error(
|
|
18541
|
-
|
|
18562
|
+
chalk140.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
18542
18563
|
);
|
|
18543
18564
|
}
|
|
18544
18565
|
}
|
|
18545
18566
|
function reportMigrationStatus(status3) {
|
|
18546
18567
|
if (status3.state === "in-sync") {
|
|
18547
18568
|
console.error(
|
|
18548
|
-
|
|
18569
|
+
chalk140.green(`In sync at migration ${status3.version} (latest).`)
|
|
18549
18570
|
);
|
|
18550
18571
|
return;
|
|
18551
18572
|
}
|
|
18552
18573
|
if (status3.state === "behind") {
|
|
18553
18574
|
console.error(
|
|
18554
|
-
|
|
18575
|
+
chalk140.yellow(
|
|
18555
18576
|
`Behind: applied ${status3.applied}, build expects ${status3.expected}.`
|
|
18556
18577
|
)
|
|
18557
18578
|
);
|
|
18558
18579
|
console.error(
|
|
18559
|
-
|
|
18580
|
+
chalk140.yellow(
|
|
18560
18581
|
`Pending: ${status3.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
18561
18582
|
)
|
|
18562
18583
|
);
|
|
18563
18584
|
return;
|
|
18564
18585
|
}
|
|
18565
18586
|
console.error(
|
|
18566
|
-
|
|
18587
|
+
chalk140.red(
|
|
18567
18588
|
`Ahead: applied ${status3.applied}, build knows ${status3.expected}. Update assist.`
|
|
18568
18589
|
)
|
|
18569
18590
|
);
|
|
@@ -18598,7 +18619,7 @@ function registerDb(program2) {
|
|
|
18598
18619
|
|
|
18599
18620
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
18600
18621
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync26 } from "fs";
|
|
18601
|
-
import
|
|
18622
|
+
import chalk141 from "chalk";
|
|
18602
18623
|
|
|
18603
18624
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
18604
18625
|
import { join as join39 } from "path";
|
|
@@ -18629,7 +18650,7 @@ function dbMigrationConfirm(pin) {
|
|
|
18629
18650
|
sweepRestrictedDir();
|
|
18630
18651
|
const state = readMigrationPinState(pin);
|
|
18631
18652
|
if (!state) {
|
|
18632
|
-
console.error(
|
|
18653
|
+
console.error(chalk141.red(`No pending migration unlock for pin: ${pin}`));
|
|
18633
18654
|
process.exitCode = 1;
|
|
18634
18655
|
return;
|
|
18635
18656
|
}
|
|
@@ -18639,7 +18660,7 @@ function dbMigrationConfirm(pin) {
|
|
|
18639
18660
|
);
|
|
18640
18661
|
unlinkSync9(getMigrationPinPath(pin));
|
|
18641
18662
|
console.log(
|
|
18642
|
-
|
|
18663
|
+
chalk141.green(
|
|
18643
18664
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
18644
18665
|
)
|
|
18645
18666
|
);
|
|
@@ -18648,7 +18669,7 @@ function dbMigrationConfirm(pin) {
|
|
|
18648
18669
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
18649
18670
|
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync27 } from "fs";
|
|
18650
18671
|
import { randomInt as randomInt2 } from "crypto";
|
|
18651
|
-
import
|
|
18672
|
+
import chalk142 from "chalk";
|
|
18652
18673
|
|
|
18653
18674
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
18654
18675
|
function nextMigrationId() {
|
|
@@ -18663,7 +18684,7 @@ function dbMigrationUnlock() {
|
|
|
18663
18684
|
sweepRestrictedDir();
|
|
18664
18685
|
writeFileSync27(getMigrationPinPath(pin), JSON.stringify({ pin, migrationId }));
|
|
18665
18686
|
console.error(
|
|
18666
|
-
|
|
18687
|
+
chalk142.yellow.bold(
|
|
18667
18688
|
"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
18689
|
)
|
|
18669
18690
|
);
|
|
@@ -18673,7 +18694,7 @@ function dbMigrationUnlock() {
|
|
|
18673
18694
|
});
|
|
18674
18695
|
if (!delivered) {
|
|
18675
18696
|
console.error(
|
|
18676
|
-
|
|
18697
|
+
chalk142.red(
|
|
18677
18698
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
18678
18699
|
)
|
|
18679
18700
|
);
|
|
@@ -18683,7 +18704,7 @@ function dbMigrationUnlock() {
|
|
|
18683
18704
|
console.log(
|
|
18684
18705
|
`A confirmation pin was sent to your desktop notifications.
|
|
18685
18706
|
To approve creating migration ${migrationId}, run:
|
|
18686
|
-
${
|
|
18707
|
+
${chalk142.cyan(" assist db-migration confirm <PIN>")}
|
|
18687
18708
|
using the pin from that notification.`
|
|
18688
18709
|
);
|
|
18689
18710
|
}
|
|
@@ -18703,7 +18724,7 @@ function registerDbMigration(parent) {
|
|
|
18703
18724
|
|
|
18704
18725
|
// src/commands/deploy/redirect.ts
|
|
18705
18726
|
import { existsSync as existsSync39, readFileSync as readFileSync31, writeFileSync as writeFileSync28 } from "fs";
|
|
18706
|
-
import
|
|
18727
|
+
import chalk143 from "chalk";
|
|
18707
18728
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
18708
18729
|
if (!window.location.pathname.endsWith('/')) {
|
|
18709
18730
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -18712,23 +18733,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
18712
18733
|
function redirect() {
|
|
18713
18734
|
const indexPath = "index.html";
|
|
18714
18735
|
if (!existsSync39(indexPath)) {
|
|
18715
|
-
console.log(
|
|
18736
|
+
console.log(chalk143.yellow("No index.html found"));
|
|
18716
18737
|
return;
|
|
18717
18738
|
}
|
|
18718
18739
|
const content = readFileSync31(indexPath, "utf8");
|
|
18719
18740
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
18720
|
-
console.log(
|
|
18741
|
+
console.log(chalk143.dim("Trailing slash script already present"));
|
|
18721
18742
|
return;
|
|
18722
18743
|
}
|
|
18723
18744
|
const headCloseIndex = content.indexOf("</head>");
|
|
18724
18745
|
if (headCloseIndex === -1) {
|
|
18725
|
-
console.log(
|
|
18746
|
+
console.log(chalk143.red("Could not find </head> tag in index.html"));
|
|
18726
18747
|
return;
|
|
18727
18748
|
}
|
|
18728
18749
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
18729
18750
|
${content.slice(headCloseIndex)}`;
|
|
18730
18751
|
writeFileSync28(indexPath, newContent);
|
|
18731
|
-
console.log(
|
|
18752
|
+
console.log(chalk143.green("Added trailing slash redirect to index.html"));
|
|
18732
18753
|
}
|
|
18733
18754
|
|
|
18734
18755
|
// src/commands/registerDeploy.ts
|
|
@@ -18755,7 +18776,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
18755
18776
|
|
|
18756
18777
|
// src/commands/devlog/shared.ts
|
|
18757
18778
|
import { execSync as execSync36 } from "child_process";
|
|
18758
|
-
import
|
|
18779
|
+
import chalk144 from "chalk";
|
|
18759
18780
|
|
|
18760
18781
|
// src/shared/getRepoName.ts
|
|
18761
18782
|
import { existsSync as existsSync40, readFileSync as readFileSync32 } from "fs";
|
|
@@ -18864,13 +18885,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
18864
18885
|
}
|
|
18865
18886
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
18866
18887
|
for (const commit2 of commits2) {
|
|
18867
|
-
console.log(` ${
|
|
18888
|
+
console.log(` ${chalk144.yellow(commit2.hash)} ${commit2.message}`);
|
|
18868
18889
|
if (verbose) {
|
|
18869
18890
|
const visibleFiles = commit2.files.filter(
|
|
18870
18891
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
18871
18892
|
);
|
|
18872
18893
|
for (const file of visibleFiles) {
|
|
18873
|
-
console.log(` ${
|
|
18894
|
+
console.log(` ${chalk144.dim(file)}`);
|
|
18874
18895
|
}
|
|
18875
18896
|
}
|
|
18876
18897
|
}
|
|
@@ -18895,15 +18916,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
18895
18916
|
}
|
|
18896
18917
|
|
|
18897
18918
|
// src/commands/devlog/list/printDateHeader.ts
|
|
18898
|
-
import
|
|
18919
|
+
import chalk145 from "chalk";
|
|
18899
18920
|
function printDateHeader(date, isSkipped, entries) {
|
|
18900
18921
|
if (isSkipped) {
|
|
18901
|
-
console.log(`${
|
|
18922
|
+
console.log(`${chalk145.bold.blue(date)} ${chalk145.dim("skipped")}`);
|
|
18902
18923
|
} else if (entries && entries.length > 0) {
|
|
18903
|
-
const entryInfo = entries.map((e) => `${
|
|
18904
|
-
console.log(`${
|
|
18924
|
+
const entryInfo = entries.map((e) => `${chalk145.green(e.version)} ${e.title}`).join(" | ");
|
|
18925
|
+
console.log(`${chalk145.bold.blue(date)} ${entryInfo}`);
|
|
18905
18926
|
} else {
|
|
18906
|
-
console.log(`${
|
|
18927
|
+
console.log(`${chalk145.bold.blue(date)} ${chalk145.red("\u26A0 devlog missing")}`);
|
|
18907
18928
|
}
|
|
18908
18929
|
}
|
|
18909
18930
|
|
|
@@ -19007,24 +19028,24 @@ function bumpVersion(version2, type) {
|
|
|
19007
19028
|
|
|
19008
19029
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
19009
19030
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
19010
|
-
import
|
|
19031
|
+
import chalk147 from "chalk";
|
|
19011
19032
|
|
|
19012
19033
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
19013
|
-
import
|
|
19034
|
+
import chalk146 from "chalk";
|
|
19014
19035
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
19015
19036
|
if (conventional && firstHash) {
|
|
19016
19037
|
const version2 = getVersionAtCommit(firstHash);
|
|
19017
19038
|
if (version2) {
|
|
19018
|
-
console.log(`${
|
|
19039
|
+
console.log(`${chalk146.bold("version:")} ${stripToMinor(version2)}`);
|
|
19019
19040
|
} else {
|
|
19020
|
-
console.log(`${
|
|
19041
|
+
console.log(`${chalk146.bold("version:")} ${chalk146.red("unknown")}`);
|
|
19021
19042
|
}
|
|
19022
19043
|
} else if (patchVersion && minorVersion) {
|
|
19023
19044
|
console.log(
|
|
19024
|
-
`${
|
|
19045
|
+
`${chalk146.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
19025
19046
|
);
|
|
19026
19047
|
} else {
|
|
19027
|
-
console.log(`${
|
|
19048
|
+
console.log(`${chalk146.bold("version:")} v0.1 (initial)`);
|
|
19028
19049
|
}
|
|
19029
19050
|
}
|
|
19030
19051
|
|
|
@@ -19072,16 +19093,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
19072
19093
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
19073
19094
|
}
|
|
19074
19095
|
function logName(repoName) {
|
|
19075
|
-
console.log(`${
|
|
19096
|
+
console.log(`${chalk147.bold("name:")} ${repoName}`);
|
|
19076
19097
|
}
|
|
19077
19098
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
19078
19099
|
logName(ctx.repoName);
|
|
19079
19100
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
19080
|
-
console.log(
|
|
19101
|
+
console.log(chalk147.bold.blue(targetDate));
|
|
19081
19102
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
19082
19103
|
}
|
|
19083
19104
|
function logNoCommits(lastInfo) {
|
|
19084
|
-
console.log(
|
|
19105
|
+
console.log(chalk147.dim(noCommitsMessage(!!lastInfo)));
|
|
19085
19106
|
}
|
|
19086
19107
|
|
|
19087
19108
|
// src/commands/devlog/next/index.ts
|
|
@@ -19122,11 +19143,11 @@ function next2(options2) {
|
|
|
19122
19143
|
import { execSync as execSync38 } from "child_process";
|
|
19123
19144
|
|
|
19124
19145
|
// src/commands/devlog/repos/printReposTable.ts
|
|
19125
|
-
import
|
|
19146
|
+
import chalk148 from "chalk";
|
|
19126
19147
|
function colorStatus(status3) {
|
|
19127
|
-
if (status3 === "missing") return
|
|
19128
|
-
if (status3 === "outdated") return
|
|
19129
|
-
return
|
|
19148
|
+
if (status3 === "missing") return chalk148.red(status3);
|
|
19149
|
+
if (status3 === "outdated") return chalk148.yellow(status3);
|
|
19150
|
+
return chalk148.green(status3);
|
|
19130
19151
|
}
|
|
19131
19152
|
function formatRow(row, nameWidth) {
|
|
19132
19153
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -19140,8 +19161,8 @@ function printReposTable(rows) {
|
|
|
19140
19161
|
"Last Devlog".padEnd(11),
|
|
19141
19162
|
"Status"
|
|
19142
19163
|
].join(" ");
|
|
19143
|
-
console.log(
|
|
19144
|
-
console.log(
|
|
19164
|
+
console.log(chalk148.dim(header));
|
|
19165
|
+
console.log(chalk148.dim("-".repeat(header.length)));
|
|
19145
19166
|
for (const row of rows) {
|
|
19146
19167
|
console.log(formatRow(row, nameWidth));
|
|
19147
19168
|
}
|
|
@@ -19199,14 +19220,14 @@ function repos(options2) {
|
|
|
19199
19220
|
// src/commands/devlog/skip.ts
|
|
19200
19221
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
19201
19222
|
import { join as join43 } from "path";
|
|
19202
|
-
import
|
|
19223
|
+
import chalk149 from "chalk";
|
|
19203
19224
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
19204
19225
|
function getBlogConfigPath() {
|
|
19205
19226
|
return join43(BLOG_REPO_ROOT, "assist.yml");
|
|
19206
19227
|
}
|
|
19207
19228
|
function skip(date) {
|
|
19208
19229
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
19209
|
-
console.log(
|
|
19230
|
+
console.log(chalk149.red("Invalid date format. Use YYYY-MM-DD"));
|
|
19210
19231
|
process.exit(1);
|
|
19211
19232
|
}
|
|
19212
19233
|
const repoName = getRepoName();
|
|
@@ -19217,7 +19238,7 @@ function skip(date) {
|
|
|
19217
19238
|
const skipDays = skip2[repoName] ?? [];
|
|
19218
19239
|
if (skipDays.includes(date)) {
|
|
19219
19240
|
console.log(
|
|
19220
|
-
|
|
19241
|
+
chalk149.yellow(`${date} is already in skip list for ${repoName}`)
|
|
19221
19242
|
);
|
|
19222
19243
|
return;
|
|
19223
19244
|
}
|
|
@@ -19227,20 +19248,20 @@ function skip(date) {
|
|
|
19227
19248
|
devlog.skip = skip2;
|
|
19228
19249
|
config.devlog = devlog;
|
|
19229
19250
|
writeFileSync29(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
19230
|
-
console.log(
|
|
19251
|
+
console.log(chalk149.green(`Added ${date} to skip list for ${repoName}`));
|
|
19231
19252
|
}
|
|
19232
19253
|
|
|
19233
19254
|
// src/commands/devlog/version.ts
|
|
19234
|
-
import
|
|
19255
|
+
import chalk150 from "chalk";
|
|
19235
19256
|
function version() {
|
|
19236
19257
|
const config = loadConfig();
|
|
19237
19258
|
const name = getRepoName();
|
|
19238
19259
|
const lastInfo = getLastVersionInfo(name, config);
|
|
19239
19260
|
const lastVersion = lastInfo?.version ?? null;
|
|
19240
19261
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
19241
|
-
console.log(`${
|
|
19242
|
-
console.log(`${
|
|
19243
|
-
console.log(`${
|
|
19262
|
+
console.log(`${chalk150.bold("name:")} ${name}`);
|
|
19263
|
+
console.log(`${chalk150.bold("last:")} ${lastVersion ?? chalk150.dim("none")}`);
|
|
19264
|
+
console.log(`${chalk150.bold("next:")} ${nextVersion ?? chalk150.dim("none")}`);
|
|
19244
19265
|
}
|
|
19245
19266
|
|
|
19246
19267
|
// src/commands/registerDevlog.ts
|
|
@@ -19265,7 +19286,7 @@ function registerDevlog(program2) {
|
|
|
19265
19286
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
19266
19287
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync5 } from "fs";
|
|
19267
19288
|
import { join as join44 } from "path";
|
|
19268
|
-
import
|
|
19289
|
+
import chalk151 from "chalk";
|
|
19269
19290
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
19270
19291
|
function isLockedDll(debugDir) {
|
|
19271
19292
|
let files;
|
|
@@ -19312,14 +19333,14 @@ function checkBuildLocks(startDir) {
|
|
|
19312
19333
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
19313
19334
|
if (locked) {
|
|
19314
19335
|
console.error(
|
|
19315
|
-
|
|
19336
|
+
chalk151.red("Build output locked (is VS debugging?): ") + locked
|
|
19316
19337
|
);
|
|
19317
19338
|
process.exit(1);
|
|
19318
19339
|
}
|
|
19319
19340
|
}
|
|
19320
19341
|
async function checkBuildLocksCommand() {
|
|
19321
19342
|
checkBuildLocks();
|
|
19322
|
-
console.log(
|
|
19343
|
+
console.log(chalk151.green("No build locks detected"));
|
|
19323
19344
|
}
|
|
19324
19345
|
|
|
19325
19346
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -19418,30 +19439,30 @@ function escapeRegex(s) {
|
|
|
19418
19439
|
}
|
|
19419
19440
|
|
|
19420
19441
|
// src/commands/dotnet/printTree.ts
|
|
19421
|
-
import
|
|
19442
|
+
import chalk152 from "chalk";
|
|
19422
19443
|
function printNodes(nodes, prefix2) {
|
|
19423
19444
|
for (let i = 0; i < nodes.length; i++) {
|
|
19424
19445
|
const isLast = i === nodes.length - 1;
|
|
19425
19446
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
19426
19447
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
19427
19448
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
19428
|
-
const label2 = isMissing ?
|
|
19449
|
+
const label2 = isMissing ? chalk152.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
19429
19450
|
console.log(`${prefix2}${connector}${label2}`);
|
|
19430
19451
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
19431
19452
|
}
|
|
19432
19453
|
}
|
|
19433
19454
|
function printTree(tree, totalCount, solutions) {
|
|
19434
|
-
console.log(
|
|
19435
|
-
console.log(
|
|
19455
|
+
console.log(chalk152.bold("\nProject Dependency Tree"));
|
|
19456
|
+
console.log(chalk152.cyan(tree.relativePath));
|
|
19436
19457
|
printNodes(tree.children, "");
|
|
19437
|
-
console.log(
|
|
19458
|
+
console.log(chalk152.dim(`
|
|
19438
19459
|
${totalCount} projects total (including root)`));
|
|
19439
|
-
console.log(
|
|
19460
|
+
console.log(chalk152.bold("\nSolution Membership"));
|
|
19440
19461
|
if (solutions.length === 0) {
|
|
19441
|
-
console.log(
|
|
19462
|
+
console.log(chalk152.yellow(" Not found in any .sln"));
|
|
19442
19463
|
} else {
|
|
19443
19464
|
for (const sln of solutions) {
|
|
19444
|
-
console.log(` ${
|
|
19465
|
+
console.log(` ${chalk152.green(sln)}`);
|
|
19445
19466
|
}
|
|
19446
19467
|
}
|
|
19447
19468
|
console.log();
|
|
@@ -19470,16 +19491,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
19470
19491
|
// src/commands/dotnet/resolveCsproj.ts
|
|
19471
19492
|
import { existsSync as existsSync41 } from "fs";
|
|
19472
19493
|
import path36 from "path";
|
|
19473
|
-
import
|
|
19494
|
+
import chalk153 from "chalk";
|
|
19474
19495
|
function resolveCsproj(csprojPath) {
|
|
19475
19496
|
const resolved = path36.resolve(csprojPath);
|
|
19476
19497
|
if (!existsSync41(resolved)) {
|
|
19477
|
-
console.error(
|
|
19498
|
+
console.error(chalk153.red(`File not found: ${resolved}`));
|
|
19478
19499
|
process.exit(1);
|
|
19479
19500
|
}
|
|
19480
19501
|
const repoRoot2 = findRepoRoot(path36.dirname(resolved));
|
|
19481
19502
|
if (!repoRoot2) {
|
|
19482
|
-
console.error(
|
|
19503
|
+
console.error(chalk153.red("Could not find git repository root"));
|
|
19483
19504
|
process.exit(1);
|
|
19484
19505
|
}
|
|
19485
19506
|
return { resolved, repoRoot: repoRoot2 };
|
|
@@ -19529,12 +19550,12 @@ function getChangedCsFiles(scope) {
|
|
|
19529
19550
|
}
|
|
19530
19551
|
|
|
19531
19552
|
// src/commands/dotnet/inSln.ts
|
|
19532
|
-
import
|
|
19553
|
+
import chalk154 from "chalk";
|
|
19533
19554
|
async function inSln(csprojPath) {
|
|
19534
19555
|
const { resolved, repoRoot: repoRoot2 } = resolveCsproj(csprojPath);
|
|
19535
19556
|
const solutions = findContainingSolutions(resolved, repoRoot2);
|
|
19536
19557
|
if (solutions.length === 0) {
|
|
19537
|
-
console.log(
|
|
19558
|
+
console.log(chalk154.yellow("Not found in any .sln file"));
|
|
19538
19559
|
process.exit(1);
|
|
19539
19560
|
}
|
|
19540
19561
|
for (const sln of solutions) {
|
|
@@ -19543,7 +19564,7 @@ async function inSln(csprojPath) {
|
|
|
19543
19564
|
}
|
|
19544
19565
|
|
|
19545
19566
|
// src/commands/dotnet/inspect.ts
|
|
19546
|
-
import
|
|
19567
|
+
import chalk160 from "chalk";
|
|
19547
19568
|
|
|
19548
19569
|
// src/shared/formatElapsed.ts
|
|
19549
19570
|
function formatElapsed(ms) {
|
|
@@ -19555,12 +19576,12 @@ function formatElapsed(ms) {
|
|
|
19555
19576
|
}
|
|
19556
19577
|
|
|
19557
19578
|
// src/commands/dotnet/displayIssues.ts
|
|
19558
|
-
import
|
|
19579
|
+
import chalk155 from "chalk";
|
|
19559
19580
|
var SEVERITY_COLOR = {
|
|
19560
|
-
ERROR:
|
|
19561
|
-
WARNING:
|
|
19562
|
-
SUGGESTION:
|
|
19563
|
-
HINT:
|
|
19581
|
+
ERROR: chalk155.red,
|
|
19582
|
+
WARNING: chalk155.yellow,
|
|
19583
|
+
SUGGESTION: chalk155.cyan,
|
|
19584
|
+
HINT: chalk155.dim
|
|
19564
19585
|
};
|
|
19565
19586
|
function groupByFile(issues) {
|
|
19566
19587
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -19576,15 +19597,15 @@ function groupByFile(issues) {
|
|
|
19576
19597
|
}
|
|
19577
19598
|
function displayIssues(issues) {
|
|
19578
19599
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
19579
|
-
console.log(
|
|
19600
|
+
console.log(chalk155.bold(file));
|
|
19580
19601
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
19581
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
19602
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk155.white;
|
|
19582
19603
|
console.log(
|
|
19583
|
-
` ${
|
|
19604
|
+
` ${chalk155.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
19584
19605
|
);
|
|
19585
19606
|
}
|
|
19586
19607
|
}
|
|
19587
|
-
console.log(
|
|
19608
|
+
console.log(chalk155.dim(`
|
|
19588
19609
|
${issues.length} issue(s) found`));
|
|
19589
19610
|
}
|
|
19590
19611
|
|
|
@@ -19643,12 +19664,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
19643
19664
|
// src/commands/dotnet/resolveSolution.ts
|
|
19644
19665
|
import { existsSync as existsSync42 } from "fs";
|
|
19645
19666
|
import path37 from "path";
|
|
19646
|
-
import
|
|
19667
|
+
import chalk157 from "chalk";
|
|
19647
19668
|
|
|
19648
19669
|
// src/commands/dotnet/findSolution.ts
|
|
19649
19670
|
import { readdirSync as readdirSync7 } from "fs";
|
|
19650
19671
|
import { dirname as dirname24, join as join45 } from "path";
|
|
19651
|
-
import
|
|
19672
|
+
import chalk156 from "chalk";
|
|
19652
19673
|
function findSlnInDir(dir) {
|
|
19653
19674
|
try {
|
|
19654
19675
|
return readdirSync7(dir).filter((f) => f.endsWith(".sln")).map((f) => join45(dir, f));
|
|
@@ -19664,17 +19685,17 @@ function findSolution() {
|
|
|
19664
19685
|
const slnFiles = findSlnInDir(current);
|
|
19665
19686
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
19666
19687
|
if (slnFiles.length > 1) {
|
|
19667
|
-
console.error(
|
|
19688
|
+
console.error(chalk156.red(`Multiple .sln files found in ${current}:`));
|
|
19668
19689
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
19669
19690
|
console.error(
|
|
19670
|
-
|
|
19691
|
+
chalk156.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
19671
19692
|
);
|
|
19672
19693
|
process.exit(1);
|
|
19673
19694
|
}
|
|
19674
19695
|
if (current === ceiling) break;
|
|
19675
19696
|
current = dirname24(current);
|
|
19676
19697
|
}
|
|
19677
|
-
console.error(
|
|
19698
|
+
console.error(chalk156.red("No .sln file found between cwd and repo root"));
|
|
19678
19699
|
process.exit(1);
|
|
19679
19700
|
}
|
|
19680
19701
|
|
|
@@ -19683,7 +19704,7 @@ function resolveSolution(sln) {
|
|
|
19683
19704
|
if (sln) {
|
|
19684
19705
|
const resolved = path37.resolve(sln);
|
|
19685
19706
|
if (!existsSync42(resolved)) {
|
|
19686
|
-
console.error(
|
|
19707
|
+
console.error(chalk157.red(`Solution file not found: ${resolved}`));
|
|
19687
19708
|
process.exit(1);
|
|
19688
19709
|
}
|
|
19689
19710
|
return resolved;
|
|
@@ -19725,14 +19746,14 @@ import { execSync as execSync40 } from "child_process";
|
|
|
19725
19746
|
import { existsSync as existsSync43, readFileSync as readFileSync36, unlinkSync as unlinkSync10 } from "fs";
|
|
19726
19747
|
import { tmpdir as tmpdir4 } from "os";
|
|
19727
19748
|
import path38 from "path";
|
|
19728
|
-
import
|
|
19749
|
+
import chalk158 from "chalk";
|
|
19729
19750
|
function assertJbInstalled() {
|
|
19730
19751
|
try {
|
|
19731
19752
|
execSync40("jb inspectcode --version", { stdio: "pipe" });
|
|
19732
19753
|
} catch {
|
|
19733
|
-
console.error(
|
|
19754
|
+
console.error(chalk158.red("jb is not installed. Install with:"));
|
|
19734
19755
|
console.error(
|
|
19735
|
-
|
|
19756
|
+
chalk158.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
19736
19757
|
);
|
|
19737
19758
|
process.exit(1);
|
|
19738
19759
|
}
|
|
@@ -19750,11 +19771,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
19750
19771
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
19751
19772
|
process.stderr.write(error.stderr);
|
|
19752
19773
|
}
|
|
19753
|
-
console.error(
|
|
19774
|
+
console.error(chalk158.red("jb inspectcode failed"));
|
|
19754
19775
|
process.exit(1);
|
|
19755
19776
|
}
|
|
19756
19777
|
if (!existsSync43(reportPath)) {
|
|
19757
|
-
console.error(
|
|
19778
|
+
console.error(chalk158.red("Report file not generated"));
|
|
19758
19779
|
process.exit(1);
|
|
19759
19780
|
}
|
|
19760
19781
|
const xml = readFileSync36(reportPath, "utf8");
|
|
@@ -19764,7 +19785,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
19764
19785
|
|
|
19765
19786
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
19766
19787
|
import { execSync as execSync41 } from "child_process";
|
|
19767
|
-
import
|
|
19788
|
+
import chalk159 from "chalk";
|
|
19768
19789
|
function resolveMsbuildPath() {
|
|
19769
19790
|
const { run: run4 } = loadConfig();
|
|
19770
19791
|
const configs = resolveRunConfigs(run4, runConfigBaseDir());
|
|
@@ -19776,9 +19797,9 @@ function assertMsbuildInstalled() {
|
|
|
19776
19797
|
try {
|
|
19777
19798
|
execSync41(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
19778
19799
|
} catch {
|
|
19779
|
-
console.error(
|
|
19800
|
+
console.error(chalk159.red(`msbuild not found at: ${msbuild}`));
|
|
19780
19801
|
console.error(
|
|
19781
|
-
|
|
19802
|
+
chalk159.yellow(
|
|
19782
19803
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
19783
19804
|
)
|
|
19784
19805
|
);
|
|
@@ -19825,17 +19846,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
19825
19846
|
// src/commands/dotnet/inspect.ts
|
|
19826
19847
|
function logScope(changedFiles2) {
|
|
19827
19848
|
if (changedFiles2 === null) {
|
|
19828
|
-
console.log(
|
|
19849
|
+
console.log(chalk160.dim("Inspecting full solution..."));
|
|
19829
19850
|
} else {
|
|
19830
19851
|
console.log(
|
|
19831
|
-
|
|
19852
|
+
chalk160.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
19832
19853
|
);
|
|
19833
19854
|
}
|
|
19834
19855
|
}
|
|
19835
19856
|
function reportResults(issues, elapsed) {
|
|
19836
19857
|
if (issues.length > 0) displayIssues(issues);
|
|
19837
|
-
else console.log(
|
|
19838
|
-
console.log(
|
|
19858
|
+
else console.log(chalk160.green("No issues found"));
|
|
19859
|
+
console.log(chalk160.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
19839
19860
|
if (issues.length > 0) process.exit(1);
|
|
19840
19861
|
}
|
|
19841
19862
|
async function inspect(sln, options2) {
|
|
@@ -19846,7 +19867,7 @@ async function inspect(sln, options2) {
|
|
|
19846
19867
|
const scope = parseScope(options2.scope);
|
|
19847
19868
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
19848
19869
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
19849
|
-
console.log(
|
|
19870
|
+
console.log(chalk160.green("No changed .cs files found"));
|
|
19850
19871
|
return;
|
|
19851
19872
|
}
|
|
19852
19873
|
logScope(changedFiles2);
|
|
@@ -20256,25 +20277,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
20256
20277
|
}
|
|
20257
20278
|
|
|
20258
20279
|
// src/commands/github/printCountTable.ts
|
|
20259
|
-
import
|
|
20280
|
+
import chalk161 from "chalk";
|
|
20260
20281
|
function printCountTable(labelHeader, rows) {
|
|
20261
20282
|
const labelWidth = Math.max(
|
|
20262
20283
|
labelHeader.length,
|
|
20263
20284
|
...rows.map((row) => row.label.length)
|
|
20264
20285
|
);
|
|
20265
20286
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
20266
|
-
console.log(
|
|
20267
|
-
console.log(
|
|
20287
|
+
console.log(chalk161.dim(header));
|
|
20288
|
+
console.log(chalk161.dim("-".repeat(header.length)));
|
|
20268
20289
|
for (const row of rows) {
|
|
20269
20290
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
20270
20291
|
}
|
|
20271
20292
|
}
|
|
20272
20293
|
|
|
20273
20294
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
20274
|
-
import
|
|
20295
|
+
import chalk162 from "chalk";
|
|
20275
20296
|
function printRepoAuthorBreakdown(repos2) {
|
|
20276
20297
|
for (const repo of repos2) {
|
|
20277
|
-
console.log(
|
|
20298
|
+
console.log(chalk162.bold(repo.name));
|
|
20278
20299
|
const authorWidth = Math.max(
|
|
20279
20300
|
0,
|
|
20280
20301
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -20592,7 +20613,7 @@ function registerHandover(program2) {
|
|
|
20592
20613
|
}
|
|
20593
20614
|
|
|
20594
20615
|
// src/commands/jira/acceptanceCriteria.ts
|
|
20595
|
-
import
|
|
20616
|
+
import chalk163 from "chalk";
|
|
20596
20617
|
|
|
20597
20618
|
// src/commands/jira/adfToText.ts
|
|
20598
20619
|
function renderInline(node) {
|
|
@@ -20659,7 +20680,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
20659
20680
|
const parsed = fetchIssue(issueKey, field);
|
|
20660
20681
|
const acValue = parsed?.fields?.[field];
|
|
20661
20682
|
if (!acValue) {
|
|
20662
|
-
console.log(
|
|
20683
|
+
console.log(chalk163.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
20663
20684
|
return;
|
|
20664
20685
|
}
|
|
20665
20686
|
if (typeof acValue === "string") {
|
|
@@ -20725,14 +20746,14 @@ async function jiraAuth() {
|
|
|
20725
20746
|
}
|
|
20726
20747
|
|
|
20727
20748
|
// src/commands/jira/viewIssue.ts
|
|
20728
|
-
import
|
|
20749
|
+
import chalk164 from "chalk";
|
|
20729
20750
|
function viewIssue(issueKey) {
|
|
20730
20751
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
20731
20752
|
const fields = parsed?.fields;
|
|
20732
20753
|
const summary = fields?.summary;
|
|
20733
20754
|
const description = fields?.description;
|
|
20734
20755
|
if (summary) {
|
|
20735
|
-
console.log(
|
|
20756
|
+
console.log(chalk164.bold(summary));
|
|
20736
20757
|
}
|
|
20737
20758
|
if (description) {
|
|
20738
20759
|
if (summary) console.log();
|
|
@@ -20746,7 +20767,7 @@ function viewIssue(issueKey) {
|
|
|
20746
20767
|
}
|
|
20747
20768
|
if (!summary && !description) {
|
|
20748
20769
|
console.log(
|
|
20749
|
-
|
|
20770
|
+
chalk164.yellow(`No summary or description found on ${issueKey}.`)
|
|
20750
20771
|
);
|
|
20751
20772
|
}
|
|
20752
20773
|
}
|
|
@@ -20781,7 +20802,7 @@ import { randomUUID as randomUUID6 } from "crypto";
|
|
|
20781
20802
|
|
|
20782
20803
|
// src/commands/review/checkoutPr.ts
|
|
20783
20804
|
import { execFileSync as execFileSync7 } from "child_process";
|
|
20784
|
-
import
|
|
20805
|
+
import chalk165 from "chalk";
|
|
20785
20806
|
|
|
20786
20807
|
// src/commands/sessions/daemon/daemonLog.ts
|
|
20787
20808
|
var RING_CAPACITY = 1e3;
|
|
@@ -21389,7 +21410,7 @@ async function checkoutPr(number) {
|
|
|
21389
21410
|
try {
|
|
21390
21411
|
execFileSync7("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
21391
21412
|
} catch {
|
|
21392
|
-
console.error(
|
|
21413
|
+
console.error(chalk165.red(`gh pr checkout ${number} failed; aborting.`));
|
|
21393
21414
|
process.exit(1);
|
|
21394
21415
|
}
|
|
21395
21416
|
}
|
|
@@ -21526,15 +21547,15 @@ function registerList(program2) {
|
|
|
21526
21547
|
// src/commands/mermaid/index.ts
|
|
21527
21548
|
import { mkdirSync as mkdirSync17, readdirSync as readdirSync9 } from "fs";
|
|
21528
21549
|
import { resolve as resolve16 } from "path";
|
|
21529
|
-
import
|
|
21550
|
+
import chalk168 from "chalk";
|
|
21530
21551
|
|
|
21531
21552
|
// src/commands/mermaid/exportFile.ts
|
|
21532
21553
|
import { readFileSync as readFileSync38, writeFileSync as writeFileSync31 } from "fs";
|
|
21533
21554
|
import { basename as basename16, extname as extname2, resolve as resolve15 } from "path";
|
|
21534
|
-
import
|
|
21555
|
+
import chalk167 from "chalk";
|
|
21535
21556
|
|
|
21536
21557
|
// src/commands/mermaid/renderBlock.ts
|
|
21537
|
-
import
|
|
21558
|
+
import chalk166 from "chalk";
|
|
21538
21559
|
async function renderBlock(krokiUrl, source) {
|
|
21539
21560
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
21540
21561
|
method: "POST",
|
|
@@ -21543,7 +21564,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
21543
21564
|
});
|
|
21544
21565
|
if (!response.ok) {
|
|
21545
21566
|
console.error(
|
|
21546
|
-
|
|
21567
|
+
chalk166.red(
|
|
21547
21568
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
21548
21569
|
)
|
|
21549
21570
|
);
|
|
@@ -21561,19 +21582,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
21561
21582
|
if (onlyIndex !== void 0) {
|
|
21562
21583
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
21563
21584
|
console.error(
|
|
21564
|
-
|
|
21585
|
+
chalk167.red(
|
|
21565
21586
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
21566
21587
|
)
|
|
21567
21588
|
);
|
|
21568
21589
|
process.exit(1);
|
|
21569
21590
|
}
|
|
21570
21591
|
console.log(
|
|
21571
|
-
|
|
21592
|
+
chalk167.gray(
|
|
21572
21593
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
21573
21594
|
)
|
|
21574
21595
|
);
|
|
21575
21596
|
} else {
|
|
21576
|
-
console.log(
|
|
21597
|
+
console.log(chalk167.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
21577
21598
|
}
|
|
21578
21599
|
for (const [i, source] of blocks.entries()) {
|
|
21579
21600
|
const idx = i + 1;
|
|
@@ -21581,7 +21602,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
21581
21602
|
const outPath = resolve15(outDir, `${stem}-${idx}.svg`);
|
|
21582
21603
|
const svg = await renderBlock(krokiUrl, source);
|
|
21583
21604
|
writeFileSync31(outPath, svg, "utf8");
|
|
21584
|
-
console.log(
|
|
21605
|
+
console.log(chalk167.green(` \u2192 ${outPath}`));
|
|
21585
21606
|
}
|
|
21586
21607
|
}
|
|
21587
21608
|
function extractMermaidBlocks(markdown) {
|
|
@@ -21597,18 +21618,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
21597
21618
|
if (options2.index !== void 0) {
|
|
21598
21619
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
21599
21620
|
console.error(
|
|
21600
|
-
|
|
21621
|
+
chalk168.red(`--index must be a positive integer (got ${options2.index})`)
|
|
21601
21622
|
);
|
|
21602
21623
|
process.exit(1);
|
|
21603
21624
|
}
|
|
21604
21625
|
if (!file) {
|
|
21605
|
-
console.error(
|
|
21626
|
+
console.error(chalk168.red("--index requires a file argument"));
|
|
21606
21627
|
process.exit(1);
|
|
21607
21628
|
}
|
|
21608
21629
|
}
|
|
21609
21630
|
const files = file ? [file] : readdirSync9(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
21610
21631
|
if (files.length === 0) {
|
|
21611
|
-
console.log(
|
|
21632
|
+
console.log(chalk168.gray("No markdown files found in current directory."));
|
|
21612
21633
|
return;
|
|
21613
21634
|
}
|
|
21614
21635
|
for (const f of files) {
|
|
@@ -21635,7 +21656,7 @@ function registerMermaid(program2) {
|
|
|
21635
21656
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
21636
21657
|
import { createServer as createServer2 } from "http";
|
|
21637
21658
|
import { dirname as dirname28 } from "path";
|
|
21638
|
-
import
|
|
21659
|
+
import chalk170 from "chalk";
|
|
21639
21660
|
|
|
21640
21661
|
// src/commands/netcap/corsHeaders.ts
|
|
21641
21662
|
var corsHeaders = {
|
|
@@ -21714,7 +21735,7 @@ function createNetcapHandler(options2) {
|
|
|
21714
21735
|
import { cp, readFile as readFile4, writeFile as writeFile4 } from "fs/promises";
|
|
21715
21736
|
import { networkInterfaces } from "os";
|
|
21716
21737
|
import { join as join54 } from "path";
|
|
21717
|
-
import
|
|
21738
|
+
import chalk169 from "chalk";
|
|
21718
21739
|
|
|
21719
21740
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
21720
21741
|
import { dirname as dirname27, join as join53 } from "path";
|
|
@@ -21758,7 +21779,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
21758
21779
|
const host = lanIPv4();
|
|
21759
21780
|
if (!host) {
|
|
21760
21781
|
console.log(
|
|
21761
|
-
|
|
21782
|
+
chalk169.yellow("could not determine the WSL IP for the extension")
|
|
21762
21783
|
);
|
|
21763
21784
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
21764
21785
|
return source;
|
|
@@ -21769,7 +21790,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
21769
21790
|
return WSL_WINDOWS_PATH;
|
|
21770
21791
|
} catch {
|
|
21771
21792
|
console.log(
|
|
21772
|
-
|
|
21793
|
+
chalk169.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
21773
21794
|
);
|
|
21774
21795
|
return source;
|
|
21775
21796
|
}
|
|
@@ -21802,30 +21823,30 @@ async function netcap(options2) {
|
|
|
21802
21823
|
let count8 = 0;
|
|
21803
21824
|
const handler = createNetcapHandler({
|
|
21804
21825
|
outPath,
|
|
21805
|
-
onPing: () => console.log(
|
|
21826
|
+
onPing: () => console.log(chalk170.dim("ping from extension")),
|
|
21806
21827
|
onCapture: (entry) => {
|
|
21807
21828
|
count8 += 1;
|
|
21808
21829
|
console.log(
|
|
21809
|
-
|
|
21810
|
-
|
|
21830
|
+
chalk170.green(`captured #${count8}`),
|
|
21831
|
+
chalk170.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
21811
21832
|
);
|
|
21812
21833
|
}
|
|
21813
21834
|
});
|
|
21814
21835
|
const server = createServer2(handler);
|
|
21815
21836
|
server.listen(port, () => {
|
|
21816
21837
|
console.log(
|
|
21817
|
-
|
|
21838
|
+
chalk170.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
21818
21839
|
);
|
|
21819
|
-
console.log(
|
|
21840
|
+
console.log(chalk170.dim(`appending captures to ${outPath}`));
|
|
21820
21841
|
if (filter)
|
|
21821
|
-
console.log(
|
|
21822
|
-
console.log(
|
|
21823
|
-
console.log(
|
|
21842
|
+
console.log(chalk170.dim(`forwarding only URLs matching "${filter}"`));
|
|
21843
|
+
console.log(chalk170.dim(`load the unpacked extension from ${extensionPath}`));
|
|
21844
|
+
console.log(chalk170.dim("press Ctrl-C to stop"));
|
|
21824
21845
|
});
|
|
21825
21846
|
process.on("SIGINT", () => {
|
|
21826
21847
|
server.close();
|
|
21827
21848
|
console.log(
|
|
21828
|
-
|
|
21849
|
+
chalk170.bold(
|
|
21829
21850
|
`
|
|
21830
21851
|
netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
21831
21852
|
)
|
|
@@ -21837,7 +21858,7 @@ netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} t
|
|
|
21837
21858
|
// src/commands/netcap/netcapExtract.ts
|
|
21838
21859
|
import { writeFileSync as writeFileSync32 } from "fs";
|
|
21839
21860
|
import { join as join57 } from "path";
|
|
21840
|
-
import
|
|
21861
|
+
import chalk171 from "chalk";
|
|
21841
21862
|
|
|
21842
21863
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
21843
21864
|
import { readFileSync as readFileSync39 } from "fs";
|
|
@@ -22285,8 +22306,8 @@ function netcapExtract(file) {
|
|
|
22285
22306
|
writeFileSync32(outFile, `${JSON.stringify(posts, null, 2)}
|
|
22286
22307
|
`);
|
|
22287
22308
|
console.log(
|
|
22288
|
-
|
|
22289
|
-
|
|
22309
|
+
chalk171.green(`extracted ${posts.length} posts`),
|
|
22310
|
+
chalk171.dim(`-> ${outFile}`)
|
|
22290
22311
|
);
|
|
22291
22312
|
}
|
|
22292
22313
|
|
|
@@ -22307,7 +22328,7 @@ function registerNetcap(program2) {
|
|
|
22307
22328
|
}
|
|
22308
22329
|
|
|
22309
22330
|
// src/commands/news/add/index.ts
|
|
22310
|
-
import
|
|
22331
|
+
import chalk172 from "chalk";
|
|
22311
22332
|
import enquirer8 from "enquirer";
|
|
22312
22333
|
async function add2(url) {
|
|
22313
22334
|
if (!url) {
|
|
@@ -22329,10 +22350,10 @@ async function add2(url) {
|
|
|
22329
22350
|
const { orm } = await getReady();
|
|
22330
22351
|
const added = await addFeed(orm, url);
|
|
22331
22352
|
if (!added) {
|
|
22332
|
-
console.log(
|
|
22353
|
+
console.log(chalk172.yellow("Feed already exists"));
|
|
22333
22354
|
return;
|
|
22334
22355
|
}
|
|
22335
|
-
console.log(
|
|
22356
|
+
console.log(chalk172.green(`Added feed: ${url}`));
|
|
22336
22357
|
}
|
|
22337
22358
|
|
|
22338
22359
|
// src/commands/registerNews.ts
|
|
@@ -22379,7 +22400,7 @@ function registerPiHook(program2) {
|
|
|
22379
22400
|
}
|
|
22380
22401
|
|
|
22381
22402
|
// src/commands/prompts/printPromptsTable.ts
|
|
22382
|
-
import
|
|
22403
|
+
import chalk173 from "chalk";
|
|
22383
22404
|
function truncate(str, max) {
|
|
22384
22405
|
if (str.length <= max) return str;
|
|
22385
22406
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -22397,14 +22418,14 @@ function printPromptsTable(rows) {
|
|
|
22397
22418
|
"Command".padEnd(commandWidth),
|
|
22398
22419
|
"Repos"
|
|
22399
22420
|
].join(" ");
|
|
22400
|
-
console.log(
|
|
22401
|
-
console.log(
|
|
22421
|
+
console.log(chalk173.dim(header));
|
|
22422
|
+
console.log(chalk173.dim("-".repeat(header.length)));
|
|
22402
22423
|
for (const row of rows) {
|
|
22403
22424
|
const count8 = String(row.count).padStart(countWidth);
|
|
22404
22425
|
const tool = row.tool.padEnd(toolWidth);
|
|
22405
22426
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
22406
22427
|
console.log(
|
|
22407
|
-
`${
|
|
22428
|
+
`${chalk173.yellow(count8)} ${tool} ${command} ${chalk173.dim(row.repos)}`
|
|
22408
22429
|
);
|
|
22409
22430
|
}
|
|
22410
22431
|
}
|
|
@@ -23070,13 +23091,13 @@ function agentFooter(unresolvedCount) {
|
|
|
23070
23091
|
}
|
|
23071
23092
|
|
|
23072
23093
|
// src/commands/prs/listComments/commentStyle.ts
|
|
23073
|
-
import
|
|
23094
|
+
import chalk174 from "chalk";
|
|
23074
23095
|
var plain = (text18) => text18;
|
|
23075
23096
|
function colouredState(state) {
|
|
23076
23097
|
const label2 = `[${state}]`;
|
|
23077
|
-
if (state === "APPROVED") return
|
|
23078
|
-
if (state === "CHANGES_REQUESTED") return
|
|
23079
|
-
return
|
|
23098
|
+
if (state === "APPROVED") return chalk174.green(label2);
|
|
23099
|
+
if (state === "CHANGES_REQUESTED") return chalk174.red(label2);
|
|
23100
|
+
return chalk174.yellow(label2);
|
|
23080
23101
|
}
|
|
23081
23102
|
function commentStyle() {
|
|
23082
23103
|
if (isClaudeCode()) {
|
|
@@ -23090,9 +23111,9 @@ function commentStyle() {
|
|
|
23090
23111
|
};
|
|
23091
23112
|
}
|
|
23092
23113
|
return {
|
|
23093
|
-
cyan:
|
|
23094
|
-
bold:
|
|
23095
|
-
dim:
|
|
23114
|
+
cyan: chalk174.cyan,
|
|
23115
|
+
bold: chalk174.bold,
|
|
23116
|
+
dim: chalk174.dim,
|
|
23096
23117
|
state: colouredState,
|
|
23097
23118
|
diffHunk: true,
|
|
23098
23119
|
agent: false
|
|
@@ -23262,13 +23283,13 @@ import { execSync as execSync48 } from "child_process";
|
|
|
23262
23283
|
import enquirer9 from "enquirer";
|
|
23263
23284
|
|
|
23264
23285
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
23265
|
-
import
|
|
23286
|
+
import chalk175 from "chalk";
|
|
23266
23287
|
var STATUS_MAP = {
|
|
23267
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
23268
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
23288
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk175.magenta("merged"), date: pr.mergedAt } : null,
|
|
23289
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk175.red("closed"), date: pr.closedAt } : null
|
|
23269
23290
|
};
|
|
23270
23291
|
function defaultStatus(pr) {
|
|
23271
|
-
return { label:
|
|
23292
|
+
return { label: chalk175.green("opened"), date: pr.createdAt };
|
|
23272
23293
|
}
|
|
23273
23294
|
function getStatus2(pr) {
|
|
23274
23295
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -23277,11 +23298,11 @@ function formatDate(dateStr) {
|
|
|
23277
23298
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
23278
23299
|
}
|
|
23279
23300
|
function formatPrHeader(pr, status3) {
|
|
23280
|
-
return `${
|
|
23301
|
+
return `${chalk175.cyan(`#${pr.number}`)} ${pr.title} ${chalk175.dim(`(${pr.author.login},`)} ${status3.label} ${chalk175.dim(`${formatDate(status3.date)})`)}`;
|
|
23281
23302
|
}
|
|
23282
23303
|
function logPrDetails(pr) {
|
|
23283
23304
|
console.log(
|
|
23284
|
-
|
|
23305
|
+
chalk175.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
23285
23306
|
);
|
|
23286
23307
|
console.log();
|
|
23287
23308
|
}
|
|
@@ -23993,10 +24014,10 @@ function registerPrs(program2) {
|
|
|
23993
24014
|
}
|
|
23994
24015
|
|
|
23995
24016
|
// src/commands/ravendb/ravendbAuth.ts
|
|
23996
|
-
import
|
|
24017
|
+
import chalk181 from "chalk";
|
|
23997
24018
|
|
|
23998
24019
|
// src/shared/createConnectionAuth.ts
|
|
23999
|
-
import
|
|
24020
|
+
import chalk176 from "chalk";
|
|
24000
24021
|
function listConnections(connections, format) {
|
|
24001
24022
|
if (connections.length === 0) {
|
|
24002
24023
|
console.log("No connections configured.");
|
|
@@ -24009,7 +24030,7 @@ function listConnections(connections, format) {
|
|
|
24009
24030
|
function removeConnection(connections, name, save) {
|
|
24010
24031
|
const filtered = connections.filter((c) => c.name !== name);
|
|
24011
24032
|
if (filtered.length === connections.length) {
|
|
24012
|
-
console.error(
|
|
24033
|
+
console.error(chalk176.red(`Connection "${name}" not found.`));
|
|
24013
24034
|
process.exit(1);
|
|
24014
24035
|
}
|
|
24015
24036
|
save(filtered);
|
|
@@ -24055,15 +24076,15 @@ function saveConnections(connections) {
|
|
|
24055
24076
|
}
|
|
24056
24077
|
|
|
24057
24078
|
// src/commands/ravendb/promptConnection.ts
|
|
24058
|
-
import
|
|
24079
|
+
import chalk179 from "chalk";
|
|
24059
24080
|
|
|
24060
24081
|
// src/commands/ravendb/selectOpSecret.ts
|
|
24061
|
-
import
|
|
24082
|
+
import chalk178 from "chalk";
|
|
24062
24083
|
import Enquirer2 from "enquirer";
|
|
24063
24084
|
|
|
24064
24085
|
// src/commands/ravendb/searchItems.ts
|
|
24065
24086
|
import { execSync as execSync51 } from "child_process";
|
|
24066
|
-
import
|
|
24087
|
+
import chalk177 from "chalk";
|
|
24067
24088
|
function opExec(args) {
|
|
24068
24089
|
return execSync51(`op ${args}`, {
|
|
24069
24090
|
encoding: "utf8",
|
|
@@ -24076,7 +24097,7 @@ function searchItems(search2) {
|
|
|
24076
24097
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
24077
24098
|
} catch {
|
|
24078
24099
|
console.error(
|
|
24079
|
-
|
|
24100
|
+
chalk177.red(
|
|
24080
24101
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
24081
24102
|
)
|
|
24082
24103
|
);
|
|
@@ -24090,7 +24111,7 @@ function getItemFields(itemId2) {
|
|
|
24090
24111
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
24091
24112
|
return item.fields.filter((f) => f.reference && f.label);
|
|
24092
24113
|
} catch {
|
|
24093
|
-
console.error(
|
|
24114
|
+
console.error(chalk177.red("Failed to get item details from 1Password."));
|
|
24094
24115
|
process.exit(1);
|
|
24095
24116
|
}
|
|
24096
24117
|
}
|
|
@@ -24109,7 +24130,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
24109
24130
|
}).run();
|
|
24110
24131
|
const items2 = searchItems(search2);
|
|
24111
24132
|
if (items2.length === 0) {
|
|
24112
|
-
console.error(
|
|
24133
|
+
console.error(chalk178.red(`No items found matching "${search2}".`));
|
|
24113
24134
|
process.exit(1);
|
|
24114
24135
|
}
|
|
24115
24136
|
const itemId2 = await selectOne(
|
|
@@ -24118,7 +24139,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
24118
24139
|
);
|
|
24119
24140
|
const fields = getItemFields(itemId2);
|
|
24120
24141
|
if (fields.length === 0) {
|
|
24121
|
-
console.error(
|
|
24142
|
+
console.error(chalk178.red("No fields with references found on this item."));
|
|
24122
24143
|
process.exit(1);
|
|
24123
24144
|
}
|
|
24124
24145
|
const ref = await selectOne(
|
|
@@ -24132,7 +24153,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
24132
24153
|
async function promptConnection(existingNames) {
|
|
24133
24154
|
const name = await promptInput("name", "Connection name:");
|
|
24134
24155
|
if (existingNames.includes(name)) {
|
|
24135
|
-
console.error(
|
|
24156
|
+
console.error(chalk179.red(`Connection "${name}" already exists.`));
|
|
24136
24157
|
process.exit(1);
|
|
24137
24158
|
}
|
|
24138
24159
|
const url = await promptInput(
|
|
@@ -24141,22 +24162,22 @@ async function promptConnection(existingNames) {
|
|
|
24141
24162
|
);
|
|
24142
24163
|
const database = await promptInput("database", "Database name:");
|
|
24143
24164
|
if (!name || !url || !database) {
|
|
24144
|
-
console.error(
|
|
24165
|
+
console.error(chalk179.red("All fields are required."));
|
|
24145
24166
|
process.exit(1);
|
|
24146
24167
|
}
|
|
24147
24168
|
const apiKeyRef = await selectOpSecret();
|
|
24148
|
-
console.log(
|
|
24169
|
+
console.log(chalk179.dim(`Using: ${apiKeyRef}`));
|
|
24149
24170
|
return { name, url, database, apiKeyRef };
|
|
24150
24171
|
}
|
|
24151
24172
|
|
|
24152
24173
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
24153
|
-
import
|
|
24174
|
+
import chalk180 from "chalk";
|
|
24154
24175
|
function ravendbSetConnection(name) {
|
|
24155
24176
|
const raw = loadGlobalConfigRaw();
|
|
24156
24177
|
const ravendb = raw.ravendb ?? {};
|
|
24157
24178
|
const connections = ravendb.connections ?? [];
|
|
24158
24179
|
if (!connections.some((c) => c.name === name)) {
|
|
24159
|
-
console.error(
|
|
24180
|
+
console.error(chalk180.red(`Connection "${name}" not found.`));
|
|
24160
24181
|
console.error(
|
|
24161
24182
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
24162
24183
|
);
|
|
@@ -24172,16 +24193,16 @@ function ravendbSetConnection(name) {
|
|
|
24172
24193
|
var ravendbAuth = createConnectionAuth({
|
|
24173
24194
|
load: loadConnections,
|
|
24174
24195
|
save: saveConnections,
|
|
24175
|
-
format: (c) => `${
|
|
24196
|
+
format: (c) => `${chalk181.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
24176
24197
|
promptNew: promptConnection,
|
|
24177
24198
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
24178
24199
|
});
|
|
24179
24200
|
|
|
24180
24201
|
// src/commands/ravendb/ravendbCollections.ts
|
|
24181
|
-
import
|
|
24202
|
+
import chalk185 from "chalk";
|
|
24182
24203
|
|
|
24183
24204
|
// src/commands/ravendb/ravenFetch.ts
|
|
24184
|
-
import
|
|
24205
|
+
import chalk183 from "chalk";
|
|
24185
24206
|
|
|
24186
24207
|
// src/commands/ravendb/getAccessToken.ts
|
|
24187
24208
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -24218,10 +24239,10 @@ ${errorText}`
|
|
|
24218
24239
|
|
|
24219
24240
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
24220
24241
|
import { execSync as execSync52 } from "child_process";
|
|
24221
|
-
import
|
|
24242
|
+
import chalk182 from "chalk";
|
|
24222
24243
|
function resolveOpSecret(reference) {
|
|
24223
24244
|
if (!reference.startsWith("op://")) {
|
|
24224
|
-
console.error(
|
|
24245
|
+
console.error(chalk182.red(`Invalid secret reference: must start with op://`));
|
|
24225
24246
|
process.exit(1);
|
|
24226
24247
|
}
|
|
24227
24248
|
try {
|
|
@@ -24231,7 +24252,7 @@ function resolveOpSecret(reference) {
|
|
|
24231
24252
|
}).trim();
|
|
24232
24253
|
} catch {
|
|
24233
24254
|
console.error(
|
|
24234
|
-
|
|
24255
|
+
chalk182.red(
|
|
24235
24256
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
24236
24257
|
)
|
|
24237
24258
|
);
|
|
@@ -24258,7 +24279,7 @@ async function ravenFetch(connection, path77) {
|
|
|
24258
24279
|
if (!response.ok) {
|
|
24259
24280
|
const body = await response.text();
|
|
24260
24281
|
console.error(
|
|
24261
|
-
|
|
24282
|
+
chalk183.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
24262
24283
|
);
|
|
24263
24284
|
console.error(body.substring(0, 500));
|
|
24264
24285
|
process.exit(1);
|
|
@@ -24267,7 +24288,7 @@ async function ravenFetch(connection, path77) {
|
|
|
24267
24288
|
}
|
|
24268
24289
|
|
|
24269
24290
|
// src/commands/ravendb/resolveConnection.ts
|
|
24270
|
-
import
|
|
24291
|
+
import chalk184 from "chalk";
|
|
24271
24292
|
function loadRavendb() {
|
|
24272
24293
|
const raw = loadGlobalConfigRaw();
|
|
24273
24294
|
const ravendb = raw.ravendb;
|
|
@@ -24281,7 +24302,7 @@ function resolveConnection(name) {
|
|
|
24281
24302
|
const connectionName = name ?? defaultConnection;
|
|
24282
24303
|
if (!connectionName) {
|
|
24283
24304
|
console.error(
|
|
24284
|
-
|
|
24305
|
+
chalk184.red(
|
|
24285
24306
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
24286
24307
|
)
|
|
24287
24308
|
);
|
|
@@ -24289,7 +24310,7 @@ function resolveConnection(name) {
|
|
|
24289
24310
|
}
|
|
24290
24311
|
const connection = connections.find((c) => c.name === connectionName);
|
|
24291
24312
|
if (!connection) {
|
|
24292
|
-
console.error(
|
|
24313
|
+
console.error(chalk184.red(`Connection "${connectionName}" not found.`));
|
|
24293
24314
|
console.error(
|
|
24294
24315
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
24295
24316
|
);
|
|
@@ -24320,15 +24341,15 @@ async function ravendbCollections(connectionName) {
|
|
|
24320
24341
|
return;
|
|
24321
24342
|
}
|
|
24322
24343
|
for (const c of collections) {
|
|
24323
|
-
console.log(`${
|
|
24344
|
+
console.log(`${chalk185.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
24324
24345
|
}
|
|
24325
24346
|
}
|
|
24326
24347
|
|
|
24327
24348
|
// src/commands/ravendb/ravendbQuery.ts
|
|
24328
|
-
import
|
|
24349
|
+
import chalk187 from "chalk";
|
|
24329
24350
|
|
|
24330
24351
|
// src/commands/ravendb/fetchAllPages.ts
|
|
24331
|
-
import
|
|
24352
|
+
import chalk186 from "chalk";
|
|
24332
24353
|
|
|
24333
24354
|
// src/commands/ravendb/buildQueryPath.ts
|
|
24334
24355
|
function buildQueryPath(opts) {
|
|
@@ -24366,7 +24387,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
24366
24387
|
allResults.push(...results);
|
|
24367
24388
|
start3 += results.length;
|
|
24368
24389
|
process.stderr.write(
|
|
24369
|
-
`\r${
|
|
24390
|
+
`\r${chalk186.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
24370
24391
|
);
|
|
24371
24392
|
if (start3 >= totalResults) break;
|
|
24372
24393
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -24381,7 +24402,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
24381
24402
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
24382
24403
|
const resolved = resolveArgs(connectionName, collection);
|
|
24383
24404
|
if (!resolved.collection && !options2.query) {
|
|
24384
|
-
console.error(
|
|
24405
|
+
console.error(chalk187.red("Provide a collection name or --query filter."));
|
|
24385
24406
|
process.exit(1);
|
|
24386
24407
|
}
|
|
24387
24408
|
const { collection: col } = resolved;
|
|
@@ -24420,7 +24441,7 @@ import { spawn as spawn6 } from "child_process";
|
|
|
24420
24441
|
import * as path39 from "path";
|
|
24421
24442
|
|
|
24422
24443
|
// src/commands/refactor/logViolations.ts
|
|
24423
|
-
import
|
|
24444
|
+
import chalk188 from "chalk";
|
|
24424
24445
|
var DEFAULT_MAX_LINES2 = 100;
|
|
24425
24446
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
24426
24447
|
if (violations.length === 0) {
|
|
@@ -24429,43 +24450,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
24429
24450
|
}
|
|
24430
24451
|
return;
|
|
24431
24452
|
}
|
|
24432
|
-
console.error(
|
|
24453
|
+
console.error(chalk188.red(`
|
|
24433
24454
|
Refactor check failed:
|
|
24434
24455
|
`));
|
|
24435
|
-
console.error(
|
|
24456
|
+
console.error(chalk188.red(` The following files exceed ${maxLines} lines:
|
|
24436
24457
|
`));
|
|
24437
24458
|
for (const violation of violations) {
|
|
24438
|
-
console.error(
|
|
24459
|
+
console.error(chalk188.red(` ${violation.file} (${violation.lines} lines)`));
|
|
24439
24460
|
}
|
|
24440
24461
|
console.error(
|
|
24441
|
-
|
|
24462
|
+
chalk188.yellow(
|
|
24442
24463
|
`
|
|
24443
24464
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
24444
24465
|
way to refactor it, ignore it with:
|
|
24445
24466
|
`
|
|
24446
24467
|
)
|
|
24447
24468
|
);
|
|
24448
|
-
console.error(
|
|
24469
|
+
console.error(chalk188.gray(` assist refactor ignore <file>
|
|
24449
24470
|
`));
|
|
24450
24471
|
if (process.env.CLAUDECODE) {
|
|
24451
|
-
console.error(
|
|
24472
|
+
console.error(chalk188.cyan(`
|
|
24452
24473
|
## Extracting Code to New Files
|
|
24453
24474
|
`));
|
|
24454
24475
|
console.error(
|
|
24455
|
-
|
|
24476
|
+
chalk188.cyan(
|
|
24456
24477
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
24457
24478
|
`
|
|
24458
24479
|
)
|
|
24459
24480
|
);
|
|
24460
24481
|
console.error(
|
|
24461
|
-
|
|
24482
|
+
chalk188.cyan(
|
|
24462
24483
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
24463
24484
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
24464
24485
|
`
|
|
24465
24486
|
)
|
|
24466
24487
|
);
|
|
24467
24488
|
console.error(
|
|
24468
|
-
|
|
24489
|
+
chalk188.cyan(
|
|
24469
24490
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
24470
24491
|
domains, move it to a common/shared folder.
|
|
24471
24492
|
`
|
|
@@ -24621,7 +24642,7 @@ async function check(pattern2, options2) {
|
|
|
24621
24642
|
|
|
24622
24643
|
// src/commands/refactor/extract/index.ts
|
|
24623
24644
|
import path47 from "path";
|
|
24624
|
-
import
|
|
24645
|
+
import chalk191 from "chalk";
|
|
24625
24646
|
|
|
24626
24647
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
24627
24648
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -25220,23 +25241,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
25220
25241
|
|
|
25221
25242
|
// src/commands/refactor/extract/displayPlan.ts
|
|
25222
25243
|
import path43 from "path";
|
|
25223
|
-
import
|
|
25244
|
+
import chalk189 from "chalk";
|
|
25224
25245
|
function section2(title) {
|
|
25225
25246
|
return `
|
|
25226
|
-
${
|
|
25247
|
+
${chalk189.cyan(title)}`;
|
|
25227
25248
|
}
|
|
25228
25249
|
function displayImporters(plan2, cwd) {
|
|
25229
25250
|
if (plan2.importersToUpdate.length === 0) return;
|
|
25230
25251
|
console.log(section2("Update importers:"));
|
|
25231
25252
|
for (const imp of plan2.importersToUpdate) {
|
|
25232
25253
|
const rel = path43.relative(cwd, imp.file.getFilePath());
|
|
25233
|
-
console.log(` ${
|
|
25254
|
+
console.log(` ${chalk189.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
25234
25255
|
}
|
|
25235
25256
|
}
|
|
25236
25257
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
25237
|
-
console.log(
|
|
25258
|
+
console.log(chalk189.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
25238
25259
|
`));
|
|
25239
|
-
console.log(` ${
|
|
25260
|
+
console.log(` ${chalk189.cyan("Functions to move:")}`);
|
|
25240
25261
|
for (const name of plan2.extractedNames) {
|
|
25241
25262
|
console.log(` ${name}`);
|
|
25242
25263
|
}
|
|
@@ -25270,7 +25291,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
25270
25291
|
|
|
25271
25292
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
25272
25293
|
import path46 from "path";
|
|
25273
|
-
import
|
|
25294
|
+
import chalk190 from "chalk";
|
|
25274
25295
|
import { Project as Project4 } from "ts-morph";
|
|
25275
25296
|
|
|
25276
25297
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -25362,7 +25383,7 @@ function loadProjectFile(file) {
|
|
|
25362
25383
|
});
|
|
25363
25384
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
25364
25385
|
if (!sourceFile) {
|
|
25365
|
-
console.log(
|
|
25386
|
+
console.log(chalk190.red(`File not found in project: ${file}`));
|
|
25366
25387
|
process.exit(1);
|
|
25367
25388
|
}
|
|
25368
25389
|
return { project, sourceFile };
|
|
@@ -25385,19 +25406,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
25385
25406
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
25386
25407
|
if (options2.apply) {
|
|
25387
25408
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
25388
|
-
console.log(
|
|
25409
|
+
console.log(chalk191.green("\nExtraction complete"));
|
|
25389
25410
|
} else {
|
|
25390
|
-
console.log(
|
|
25411
|
+
console.log(chalk191.dim("\nDry run. Use --apply to execute."));
|
|
25391
25412
|
}
|
|
25392
25413
|
}
|
|
25393
25414
|
|
|
25394
25415
|
// src/commands/refactor/ignore.ts
|
|
25395
25416
|
import fs31 from "fs";
|
|
25396
|
-
import
|
|
25417
|
+
import chalk192 from "chalk";
|
|
25397
25418
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
25398
25419
|
function ignore2(file) {
|
|
25399
25420
|
if (!fs31.existsSync(file)) {
|
|
25400
|
-
console.error(
|
|
25421
|
+
console.error(chalk192.red(`Error: File does not exist: ${file}`));
|
|
25401
25422
|
process.exit(1);
|
|
25402
25423
|
}
|
|
25403
25424
|
const content = fs31.readFileSync(file, "utf8");
|
|
@@ -25413,7 +25434,7 @@ function ignore2(file) {
|
|
|
25413
25434
|
fs31.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
25414
25435
|
}
|
|
25415
25436
|
console.log(
|
|
25416
|
-
|
|
25437
|
+
chalk192.green(
|
|
25417
25438
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
25418
25439
|
)
|
|
25419
25440
|
);
|
|
@@ -25422,12 +25443,12 @@ function ignore2(file) {
|
|
|
25422
25443
|
// src/commands/refactor/rename/index.ts
|
|
25423
25444
|
import fs34 from "fs";
|
|
25424
25445
|
import path52 from "path";
|
|
25425
|
-
import
|
|
25446
|
+
import chalk195 from "chalk";
|
|
25426
25447
|
|
|
25427
25448
|
// src/commands/refactor/rename/applyRename.ts
|
|
25428
25449
|
import fs33 from "fs";
|
|
25429
25450
|
import path49 from "path";
|
|
25430
|
-
import
|
|
25451
|
+
import chalk193 from "chalk";
|
|
25431
25452
|
|
|
25432
25453
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
25433
25454
|
import path48 from "path";
|
|
@@ -25532,13 +25553,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
25532
25553
|
const updatedContents = applyRewrites(rewrites);
|
|
25533
25554
|
for (const [file, content] of updatedContents) {
|
|
25534
25555
|
fs33.writeFileSync(file, content, "utf8");
|
|
25535
|
-
console.log(
|
|
25556
|
+
console.log(chalk193.cyan(` Updated imports in ${path49.relative(cwd, file)}`));
|
|
25536
25557
|
}
|
|
25537
25558
|
const destDir = path49.dirname(destPath);
|
|
25538
25559
|
if (!fs33.existsSync(destDir)) fs33.mkdirSync(destDir, { recursive: true });
|
|
25539
25560
|
fs33.renameSync(sourcePath, destPath);
|
|
25540
25561
|
console.log(
|
|
25541
|
-
|
|
25562
|
+
chalk193.white(
|
|
25542
25563
|
` Moved ${path49.relative(cwd, sourcePath)} \u2192 ${path49.relative(cwd, destPath)}`
|
|
25543
25564
|
)
|
|
25544
25565
|
);
|
|
@@ -25625,16 +25646,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
25625
25646
|
|
|
25626
25647
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
25627
25648
|
import path51 from "path";
|
|
25628
|
-
import
|
|
25649
|
+
import chalk194 from "chalk";
|
|
25629
25650
|
function printRenamePreview(rewrites, cwd) {
|
|
25630
25651
|
for (const rewrite of rewrites) {
|
|
25631
25652
|
console.log(
|
|
25632
|
-
|
|
25653
|
+
chalk194.dim(
|
|
25633
25654
|
` ${path51.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
25634
25655
|
)
|
|
25635
25656
|
);
|
|
25636
25657
|
}
|
|
25637
|
-
console.log(
|
|
25658
|
+
console.log(chalk194.dim("Dry run. Use --apply to execute."));
|
|
25638
25659
|
}
|
|
25639
25660
|
|
|
25640
25661
|
// src/commands/refactor/rename/index.ts
|
|
@@ -25645,20 +25666,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
25645
25666
|
const relSource = path52.relative(cwd, sourcePath);
|
|
25646
25667
|
const relDest = path52.relative(cwd, destPath);
|
|
25647
25668
|
if (!fs34.existsSync(sourcePath)) {
|
|
25648
|
-
console.log(
|
|
25669
|
+
console.log(chalk195.red(`File not found: ${source}`));
|
|
25649
25670
|
process.exit(1);
|
|
25650
25671
|
}
|
|
25651
25672
|
if (destPath !== sourcePath && fs34.existsSync(destPath)) {
|
|
25652
|
-
console.log(
|
|
25673
|
+
console.log(chalk195.red(`Destination already exists: ${destination}`));
|
|
25653
25674
|
process.exit(1);
|
|
25654
25675
|
}
|
|
25655
|
-
console.log(
|
|
25656
|
-
console.log(
|
|
25657
|
-
console.log(
|
|
25676
|
+
console.log(chalk195.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
25677
|
+
console.log(chalk195.dim("Loading project..."));
|
|
25678
|
+
console.log(chalk195.dim("Scanning imports across the project..."));
|
|
25658
25679
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
25659
25680
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
25660
25681
|
console.log(
|
|
25661
|
-
|
|
25682
|
+
chalk195.dim(
|
|
25662
25683
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
25663
25684
|
)
|
|
25664
25685
|
);
|
|
@@ -25667,11 +25688,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
25667
25688
|
return;
|
|
25668
25689
|
}
|
|
25669
25690
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
25670
|
-
console.log(
|
|
25691
|
+
console.log(chalk195.green("Done"));
|
|
25671
25692
|
}
|
|
25672
25693
|
|
|
25673
25694
|
// src/commands/refactor/renameSymbol/index.ts
|
|
25674
|
-
import
|
|
25695
|
+
import chalk196 from "chalk";
|
|
25675
25696
|
|
|
25676
25697
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
25677
25698
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -25717,33 +25738,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
25717
25738
|
const { project, sourceFile } = loadProjectFile(file);
|
|
25718
25739
|
const symbol = findSymbol(sourceFile, oldName);
|
|
25719
25740
|
if (!symbol) {
|
|
25720
|
-
console.log(
|
|
25741
|
+
console.log(chalk196.red(`Symbol "${oldName}" not found in ${file}`));
|
|
25721
25742
|
process.exit(1);
|
|
25722
25743
|
}
|
|
25723
25744
|
const grouped = groupReferences(symbol, cwd);
|
|
25724
25745
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
25725
25746
|
console.log(
|
|
25726
|
-
|
|
25747
|
+
chalk196.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
25727
25748
|
`)
|
|
25728
25749
|
);
|
|
25729
25750
|
for (const [refFile, lines2] of grouped) {
|
|
25730
25751
|
console.log(
|
|
25731
|
-
` ${
|
|
25752
|
+
` ${chalk196.dim(refFile)}: lines ${chalk196.cyan(lines2.join(", "))}`
|
|
25732
25753
|
);
|
|
25733
25754
|
}
|
|
25734
25755
|
if (options2.apply) {
|
|
25735
25756
|
symbol.rename(newName);
|
|
25736
25757
|
await project.save();
|
|
25737
|
-
console.log(
|
|
25758
|
+
console.log(chalk196.green(`
|
|
25738
25759
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
25739
25760
|
} else {
|
|
25740
|
-
console.log(
|
|
25761
|
+
console.log(chalk196.dim("\nDry run. Use --apply to execute."));
|
|
25741
25762
|
}
|
|
25742
25763
|
}
|
|
25743
25764
|
|
|
25744
25765
|
// src/commands/refactor/restructure/index.ts
|
|
25745
25766
|
import path60 from "path";
|
|
25746
|
-
import
|
|
25767
|
+
import chalk199 from "chalk";
|
|
25747
25768
|
|
|
25748
25769
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
25749
25770
|
import path54 from "path";
|
|
@@ -25822,50 +25843,50 @@ function clusterFiles(graph) {
|
|
|
25822
25843
|
|
|
25823
25844
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
25824
25845
|
import path56 from "path";
|
|
25825
|
-
import
|
|
25846
|
+
import chalk197 from "chalk";
|
|
25826
25847
|
function relPath(filePath) {
|
|
25827
25848
|
return path56.relative(process.cwd(), filePath);
|
|
25828
25849
|
}
|
|
25829
25850
|
function displayMoves(plan2) {
|
|
25830
25851
|
if (plan2.moves.length === 0) return;
|
|
25831
|
-
console.log(
|
|
25852
|
+
console.log(chalk197.bold("\nFile moves:"));
|
|
25832
25853
|
for (const move2 of plan2.moves) {
|
|
25833
25854
|
console.log(
|
|
25834
|
-
` ${
|
|
25855
|
+
` ${chalk197.red(relPath(move2.from))} \u2192 ${chalk197.green(relPath(move2.to))}`
|
|
25835
25856
|
);
|
|
25836
|
-
console.log(
|
|
25857
|
+
console.log(chalk197.dim(` ${move2.reason}`));
|
|
25837
25858
|
}
|
|
25838
25859
|
}
|
|
25839
25860
|
function displayRewrites(rewrites) {
|
|
25840
25861
|
if (rewrites.length === 0) return;
|
|
25841
25862
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
25842
|
-
console.log(
|
|
25863
|
+
console.log(chalk197.bold(`
|
|
25843
25864
|
Import rewrites (${affectedFiles.size} files):`));
|
|
25844
25865
|
for (const file of affectedFiles) {
|
|
25845
|
-
console.log(` ${
|
|
25866
|
+
console.log(` ${chalk197.cyan(relPath(file))}:`);
|
|
25846
25867
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
25847
25868
|
(r) => r.file === file
|
|
25848
25869
|
)) {
|
|
25849
25870
|
console.log(
|
|
25850
|
-
` ${
|
|
25871
|
+
` ${chalk197.red(`"${oldSpecifier}"`)} \u2192 ${chalk197.green(`"${newSpecifier}"`)}`
|
|
25851
25872
|
);
|
|
25852
25873
|
}
|
|
25853
25874
|
}
|
|
25854
25875
|
}
|
|
25855
25876
|
function displayPlan2(plan2) {
|
|
25856
25877
|
if (plan2.warnings.length > 0) {
|
|
25857
|
-
console.log(
|
|
25858
|
-
for (const w of plan2.warnings) console.log(
|
|
25878
|
+
console.log(chalk197.yellow("\nWarnings:"));
|
|
25879
|
+
for (const w of plan2.warnings) console.log(chalk197.yellow(` ${w}`));
|
|
25859
25880
|
}
|
|
25860
25881
|
if (plan2.newDirectories.length > 0) {
|
|
25861
|
-
console.log(
|
|
25882
|
+
console.log(chalk197.bold("\nNew directories:"));
|
|
25862
25883
|
for (const dir of plan2.newDirectories)
|
|
25863
|
-
console.log(
|
|
25884
|
+
console.log(chalk197.green(` ${dir}/`));
|
|
25864
25885
|
}
|
|
25865
25886
|
displayMoves(plan2);
|
|
25866
25887
|
displayRewrites(plan2.rewrites);
|
|
25867
25888
|
console.log(
|
|
25868
|
-
|
|
25889
|
+
chalk197.dim(
|
|
25869
25890
|
`
|
|
25870
25891
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
25871
25892
|
)
|
|
@@ -25875,18 +25896,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
25875
25896
|
// src/commands/refactor/restructure/executePlan.ts
|
|
25876
25897
|
import fs35 from "fs";
|
|
25877
25898
|
import path57 from "path";
|
|
25878
|
-
import
|
|
25899
|
+
import chalk198 from "chalk";
|
|
25879
25900
|
function executePlan(plan2) {
|
|
25880
25901
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
25881
25902
|
for (const [file, content] of updatedContents) {
|
|
25882
25903
|
fs35.writeFileSync(file, content, "utf8");
|
|
25883
25904
|
console.log(
|
|
25884
|
-
|
|
25905
|
+
chalk198.cyan(` Rewrote imports in ${path57.relative(process.cwd(), file)}`)
|
|
25885
25906
|
);
|
|
25886
25907
|
}
|
|
25887
25908
|
for (const dir of plan2.newDirectories) {
|
|
25888
25909
|
fs35.mkdirSync(dir, { recursive: true });
|
|
25889
|
-
console.log(
|
|
25910
|
+
console.log(chalk198.green(` Created ${path57.relative(process.cwd(), dir)}/`));
|
|
25890
25911
|
}
|
|
25891
25912
|
for (const move2 of plan2.moves) {
|
|
25892
25913
|
const targetDir = path57.dirname(move2.to);
|
|
@@ -25895,7 +25916,7 @@ function executePlan(plan2) {
|
|
|
25895
25916
|
}
|
|
25896
25917
|
fs35.renameSync(move2.from, move2.to);
|
|
25897
25918
|
console.log(
|
|
25898
|
-
|
|
25919
|
+
chalk198.white(
|
|
25899
25920
|
` Moved ${path57.relative(process.cwd(), move2.from)} \u2192 ${path57.relative(process.cwd(), move2.to)}`
|
|
25900
25921
|
)
|
|
25901
25922
|
);
|
|
@@ -25910,7 +25931,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
25910
25931
|
if (entries.length === 0) {
|
|
25911
25932
|
fs35.rmdirSync(dir);
|
|
25912
25933
|
console.log(
|
|
25913
|
-
|
|
25934
|
+
chalk198.dim(
|
|
25914
25935
|
` Removed empty directory ${path57.relative(process.cwd(), dir)}`
|
|
25915
25936
|
)
|
|
25916
25937
|
);
|
|
@@ -26043,22 +26064,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
26043
26064
|
const targetPattern = pattern2 ?? "src";
|
|
26044
26065
|
const files = findSourceFiles2(targetPattern);
|
|
26045
26066
|
if (files.length === 0) {
|
|
26046
|
-
console.log(
|
|
26067
|
+
console.log(chalk199.yellow("No files found matching pattern"));
|
|
26047
26068
|
return;
|
|
26048
26069
|
}
|
|
26049
26070
|
const tsConfigPath = findTsConfig(path60.resolve(files[0]));
|
|
26050
26071
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
26051
26072
|
if (plan2.moves.length === 0) {
|
|
26052
|
-
console.log(
|
|
26073
|
+
console.log(chalk199.green("No restructuring needed"));
|
|
26053
26074
|
return;
|
|
26054
26075
|
}
|
|
26055
26076
|
displayPlan2(plan2);
|
|
26056
26077
|
if (options2.apply) {
|
|
26057
|
-
console.log(
|
|
26078
|
+
console.log(chalk199.bold("\nApplying changes..."));
|
|
26058
26079
|
executePlan(plan2);
|
|
26059
|
-
console.log(
|
|
26080
|
+
console.log(chalk199.green("\nRestructuring complete"));
|
|
26060
26081
|
} else {
|
|
26061
|
-
console.log(
|
|
26082
|
+
console.log(chalk199.dim("\nDry run. Use --apply to execute."));
|
|
26062
26083
|
}
|
|
26063
26084
|
}
|
|
26064
26085
|
|
|
@@ -26716,18 +26737,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
26716
26737
|
}
|
|
26717
26738
|
|
|
26718
26739
|
// src/commands/review/warnOutOfDiff.ts
|
|
26719
|
-
import
|
|
26740
|
+
import chalk200 from "chalk";
|
|
26720
26741
|
function warnOutOfDiff(outOfDiff) {
|
|
26721
26742
|
if (outOfDiff.length === 0) return;
|
|
26722
26743
|
console.warn(
|
|
26723
|
-
|
|
26744
|
+
chalk200.yellow(
|
|
26724
26745
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
26725
26746
|
)
|
|
26726
26747
|
);
|
|
26727
26748
|
for (const finding of outOfDiff) {
|
|
26728
26749
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
26729
26750
|
console.warn(
|
|
26730
|
-
` ${
|
|
26751
|
+
` ${chalk200.yellow("\xB7")} ${finding.title} ${chalk200.dim(
|
|
26731
26752
|
`(${finding.file}:${range})`
|
|
26732
26753
|
)}`
|
|
26733
26754
|
);
|
|
@@ -26751,18 +26772,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
26751
26772
|
}
|
|
26752
26773
|
|
|
26753
26774
|
// src/commands/review/warnUnlocated.ts
|
|
26754
|
-
import
|
|
26775
|
+
import chalk201 from "chalk";
|
|
26755
26776
|
function warnUnlocated(unlocated) {
|
|
26756
26777
|
if (unlocated.length === 0) return;
|
|
26757
26778
|
console.warn(
|
|
26758
|
-
|
|
26779
|
+
chalk201.yellow(
|
|
26759
26780
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
26760
26781
|
)
|
|
26761
26782
|
);
|
|
26762
26783
|
for (const finding of unlocated) {
|
|
26763
|
-
const where = finding.location ||
|
|
26784
|
+
const where = finding.location || chalk201.dim("missing");
|
|
26764
26785
|
console.warn(
|
|
26765
|
-
` ${
|
|
26786
|
+
` ${chalk201.yellow("\xB7")} ${finding.title} ${chalk201.dim(`(${where})`)}`
|
|
26766
26787
|
);
|
|
26767
26788
|
}
|
|
26768
26789
|
}
|
|
@@ -28017,7 +28038,7 @@ function registerReview(program2) {
|
|
|
28017
28038
|
}
|
|
28018
28039
|
|
|
28019
28040
|
// src/commands/seq/seqAuth.ts
|
|
28020
|
-
import
|
|
28041
|
+
import chalk203 from "chalk";
|
|
28021
28042
|
|
|
28022
28043
|
// src/commands/seq/loadConnections.ts
|
|
28023
28044
|
function loadConnections2() {
|
|
@@ -28046,10 +28067,10 @@ function setDefaultConnection(name) {
|
|
|
28046
28067
|
}
|
|
28047
28068
|
|
|
28048
28069
|
// src/shared/assertUniqueName.ts
|
|
28049
|
-
import
|
|
28070
|
+
import chalk202 from "chalk";
|
|
28050
28071
|
function assertUniqueName(existingNames, name) {
|
|
28051
28072
|
if (existingNames.includes(name)) {
|
|
28052
|
-
console.error(
|
|
28073
|
+
console.error(chalk202.red(`Connection "${name}" already exists.`));
|
|
28053
28074
|
process.exit(1);
|
|
28054
28075
|
}
|
|
28055
28076
|
}
|
|
@@ -28067,16 +28088,16 @@ async function promptConnection2(existingNames) {
|
|
|
28067
28088
|
var seqAuth = createConnectionAuth({
|
|
28068
28089
|
load: loadConnections2,
|
|
28069
28090
|
save: saveConnections2,
|
|
28070
|
-
format: (c) => `${
|
|
28091
|
+
format: (c) => `${chalk203.bold(c.name)} ${c.url}`,
|
|
28071
28092
|
promptNew: promptConnection2,
|
|
28072
28093
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
28073
28094
|
});
|
|
28074
28095
|
|
|
28075
28096
|
// src/commands/seq/seqQuery.ts
|
|
28076
|
-
import
|
|
28097
|
+
import chalk207 from "chalk";
|
|
28077
28098
|
|
|
28078
28099
|
// src/commands/seq/fetchSeq.ts
|
|
28079
|
-
import
|
|
28100
|
+
import chalk204 from "chalk";
|
|
28080
28101
|
async function fetchSeq(conn, path77, params) {
|
|
28081
28102
|
const url = `${conn.url}${path77}?${params}`;
|
|
28082
28103
|
const response = await fetch(url, {
|
|
@@ -28087,7 +28108,7 @@ async function fetchSeq(conn, path77, params) {
|
|
|
28087
28108
|
});
|
|
28088
28109
|
if (!response.ok) {
|
|
28089
28110
|
const body = await response.text();
|
|
28090
|
-
console.error(
|
|
28111
|
+
console.error(chalk204.red(`Seq returned ${response.status}: ${body}`));
|
|
28091
28112
|
process.exit(1);
|
|
28092
28113
|
}
|
|
28093
28114
|
return response;
|
|
@@ -28146,23 +28167,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
28146
28167
|
}
|
|
28147
28168
|
|
|
28148
28169
|
// src/commands/seq/formatEvent.ts
|
|
28149
|
-
import
|
|
28170
|
+
import chalk205 from "chalk";
|
|
28150
28171
|
function levelColor(level) {
|
|
28151
28172
|
switch (level) {
|
|
28152
28173
|
case "Fatal":
|
|
28153
|
-
return
|
|
28174
|
+
return chalk205.bgRed.white;
|
|
28154
28175
|
case "Error":
|
|
28155
|
-
return
|
|
28176
|
+
return chalk205.red;
|
|
28156
28177
|
case "Warning":
|
|
28157
|
-
return
|
|
28178
|
+
return chalk205.yellow;
|
|
28158
28179
|
case "Information":
|
|
28159
|
-
return
|
|
28180
|
+
return chalk205.cyan;
|
|
28160
28181
|
case "Debug":
|
|
28161
|
-
return
|
|
28182
|
+
return chalk205.gray;
|
|
28162
28183
|
case "Verbose":
|
|
28163
|
-
return
|
|
28184
|
+
return chalk205.dim;
|
|
28164
28185
|
default:
|
|
28165
|
-
return
|
|
28186
|
+
return chalk205.white;
|
|
28166
28187
|
}
|
|
28167
28188
|
}
|
|
28168
28189
|
function levelAbbrev(level) {
|
|
@@ -28203,12 +28224,12 @@ function formatTimestamp(iso) {
|
|
|
28203
28224
|
function formatEvent(event) {
|
|
28204
28225
|
const color = levelColor(event.Level);
|
|
28205
28226
|
const abbrev = levelAbbrev(event.Level);
|
|
28206
|
-
const ts8 =
|
|
28227
|
+
const ts8 = chalk205.dim(formatTimestamp(event.Timestamp));
|
|
28207
28228
|
const msg = renderMessage(event);
|
|
28208
28229
|
const lines2 = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
28209
28230
|
if (event.Exception) {
|
|
28210
28231
|
for (const line of event.Exception.split("\n")) {
|
|
28211
|
-
lines2.push(
|
|
28232
|
+
lines2.push(chalk205.red(` ${line}`));
|
|
28212
28233
|
}
|
|
28213
28234
|
}
|
|
28214
28235
|
return lines2.join("\n");
|
|
@@ -28241,11 +28262,11 @@ function rejectTimestampFilter(filter) {
|
|
|
28241
28262
|
}
|
|
28242
28263
|
|
|
28243
28264
|
// src/shared/resolveNamedConnection.ts
|
|
28244
|
-
import
|
|
28265
|
+
import chalk206 from "chalk";
|
|
28245
28266
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
28246
28267
|
if (connections.length === 0) {
|
|
28247
28268
|
console.error(
|
|
28248
|
-
|
|
28269
|
+
chalk206.red(
|
|
28249
28270
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
28250
28271
|
)
|
|
28251
28272
|
);
|
|
@@ -28254,7 +28275,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
28254
28275
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
28255
28276
|
const connection = connections.find((c) => c.name === target);
|
|
28256
28277
|
if (!connection) {
|
|
28257
|
-
console.error(
|
|
28278
|
+
console.error(chalk206.red(`${kind} connection "${target}" not found.`));
|
|
28258
28279
|
process.exit(1);
|
|
28259
28280
|
}
|
|
28260
28281
|
return connection;
|
|
@@ -28283,7 +28304,7 @@ async function seqQuery(filter, options2) {
|
|
|
28283
28304
|
new URLSearchParams({ filter, count: String(count8) })
|
|
28284
28305
|
);
|
|
28285
28306
|
if (events.length === 0) {
|
|
28286
|
-
console.log(
|
|
28307
|
+
console.log(chalk207.yellow("No events found."));
|
|
28287
28308
|
return;
|
|
28288
28309
|
}
|
|
28289
28310
|
if (options2.json) {
|
|
@@ -28294,11 +28315,11 @@ async function seqQuery(filter, options2) {
|
|
|
28294
28315
|
for (const event of chronological) {
|
|
28295
28316
|
console.log(formatEvent(event));
|
|
28296
28317
|
}
|
|
28297
|
-
console.log(
|
|
28318
|
+
console.log(chalk207.dim(`
|
|
28298
28319
|
${events.length} events`));
|
|
28299
28320
|
if (events.length >= count8) {
|
|
28300
28321
|
console.log(
|
|
28301
|
-
|
|
28322
|
+
chalk207.yellow(
|
|
28302
28323
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
28303
28324
|
)
|
|
28304
28325
|
);
|
|
@@ -28306,10 +28327,10 @@ ${events.length} events`));
|
|
|
28306
28327
|
}
|
|
28307
28328
|
|
|
28308
28329
|
// src/shared/setNamedDefaultConnection.ts
|
|
28309
|
-
import
|
|
28330
|
+
import chalk208 from "chalk";
|
|
28310
28331
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
28311
28332
|
if (!connections.find((c) => c.name === name)) {
|
|
28312
|
-
console.error(
|
|
28333
|
+
console.error(chalk208.red(`Connection "${name}" not found.`));
|
|
28313
28334
|
process.exit(1);
|
|
28314
28335
|
}
|
|
28315
28336
|
setDefault(name);
|
|
@@ -28358,7 +28379,7 @@ function registerSignal(program2) {
|
|
|
28358
28379
|
}
|
|
28359
28380
|
|
|
28360
28381
|
// src/commands/sql/sqlAuth.ts
|
|
28361
|
-
import
|
|
28382
|
+
import chalk210 from "chalk";
|
|
28362
28383
|
|
|
28363
28384
|
// src/commands/sql/loadConnections.ts
|
|
28364
28385
|
function loadConnections3() {
|
|
@@ -28387,7 +28408,7 @@ function setDefaultConnection2(name) {
|
|
|
28387
28408
|
}
|
|
28388
28409
|
|
|
28389
28410
|
// src/commands/sql/promptConnection.ts
|
|
28390
|
-
import
|
|
28411
|
+
import chalk209 from "chalk";
|
|
28391
28412
|
async function promptConnection3(existingNames) {
|
|
28392
28413
|
const name = await promptInput("name", "Connection name:", "default");
|
|
28393
28414
|
assertUniqueName(existingNames, name);
|
|
@@ -28395,7 +28416,7 @@ async function promptConnection3(existingNames) {
|
|
|
28395
28416
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
28396
28417
|
const port = Number.parseInt(portStr, 10);
|
|
28397
28418
|
if (!Number.isFinite(port)) {
|
|
28398
|
-
console.error(
|
|
28419
|
+
console.error(chalk209.red(`Invalid port "${portStr}".`));
|
|
28399
28420
|
process.exit(1);
|
|
28400
28421
|
}
|
|
28401
28422
|
const user = await promptInput("user", "User:");
|
|
@@ -28408,13 +28429,13 @@ async function promptConnection3(existingNames) {
|
|
|
28408
28429
|
var sqlAuth = createConnectionAuth({
|
|
28409
28430
|
load: loadConnections3,
|
|
28410
28431
|
save: saveConnections3,
|
|
28411
|
-
format: (c) => `${
|
|
28432
|
+
format: (c) => `${chalk210.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
28412
28433
|
promptNew: promptConnection3,
|
|
28413
28434
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
28414
28435
|
});
|
|
28415
28436
|
|
|
28416
28437
|
// src/commands/sql/printTable.ts
|
|
28417
|
-
import
|
|
28438
|
+
import chalk211 from "chalk";
|
|
28418
28439
|
function formatCell(value) {
|
|
28419
28440
|
if (value === null || value === void 0) return "";
|
|
28420
28441
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -28423,7 +28444,7 @@ function formatCell(value) {
|
|
|
28423
28444
|
}
|
|
28424
28445
|
function printTable(rows) {
|
|
28425
28446
|
if (rows.length === 0) {
|
|
28426
|
-
console.log(
|
|
28447
|
+
console.log(chalk211.yellow("(no rows)"));
|
|
28427
28448
|
return;
|
|
28428
28449
|
}
|
|
28429
28450
|
const columns = Object.keys(rows[0]);
|
|
@@ -28431,13 +28452,13 @@ function printTable(rows) {
|
|
|
28431
28452
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
28432
28453
|
);
|
|
28433
28454
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
28434
|
-
console.log(
|
|
28435
|
-
console.log(
|
|
28455
|
+
console.log(chalk211.dim(header));
|
|
28456
|
+
console.log(chalk211.dim("-".repeat(header.length)));
|
|
28436
28457
|
for (const row of rows) {
|
|
28437
28458
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
28438
28459
|
console.log(line);
|
|
28439
28460
|
}
|
|
28440
|
-
console.log(
|
|
28461
|
+
console.log(chalk211.dim(`
|
|
28441
28462
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
28442
28463
|
}
|
|
28443
28464
|
|
|
@@ -28497,7 +28518,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
28497
28518
|
}
|
|
28498
28519
|
|
|
28499
28520
|
// src/commands/sql/sqlMutate.ts
|
|
28500
|
-
import
|
|
28521
|
+
import chalk212 from "chalk";
|
|
28501
28522
|
|
|
28502
28523
|
// src/commands/sql/isMutation.ts
|
|
28503
28524
|
var MUTATION_KEYWORDS = [
|
|
@@ -28531,7 +28552,7 @@ function isMutation(sql25) {
|
|
|
28531
28552
|
async function sqlMutate(query, connectionName) {
|
|
28532
28553
|
if (!isMutation(query)) {
|
|
28533
28554
|
console.error(
|
|
28534
|
-
|
|
28555
|
+
chalk212.red(
|
|
28535
28556
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
28536
28557
|
)
|
|
28537
28558
|
);
|
|
@@ -28541,18 +28562,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
28541
28562
|
const pool = await sqlConnect(conn);
|
|
28542
28563
|
try {
|
|
28543
28564
|
const result = await pool.request().query(query);
|
|
28544
|
-
console.log(
|
|
28565
|
+
console.log(chalk212.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
28545
28566
|
} finally {
|
|
28546
28567
|
await pool.close();
|
|
28547
28568
|
}
|
|
28548
28569
|
}
|
|
28549
28570
|
|
|
28550
28571
|
// src/commands/sql/sqlQuery.ts
|
|
28551
|
-
import
|
|
28572
|
+
import chalk213 from "chalk";
|
|
28552
28573
|
async function sqlQuery(query, connectionName) {
|
|
28553
28574
|
if (isMutation(query)) {
|
|
28554
28575
|
console.error(
|
|
28555
|
-
|
|
28576
|
+
chalk213.red(
|
|
28556
28577
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
28557
28578
|
)
|
|
28558
28579
|
);
|
|
@@ -28567,7 +28588,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
28567
28588
|
printTable(rows);
|
|
28568
28589
|
} else {
|
|
28569
28590
|
console.log(
|
|
28570
|
-
|
|
28591
|
+
chalk213.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
28571
28592
|
);
|
|
28572
28593
|
}
|
|
28573
28594
|
} finally {
|
|
@@ -28712,7 +28733,7 @@ function reportPrune(label2, result, force) {
|
|
|
28712
28733
|
// src/commands/sync/syncClaudeMd.ts
|
|
28713
28734
|
import * as fs39 from "fs";
|
|
28714
28735
|
import * as path63 from "path";
|
|
28715
|
-
import
|
|
28736
|
+
import chalk214 from "chalk";
|
|
28716
28737
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
28717
28738
|
const source = path63.join(claudeDir, "CLAUDE.md");
|
|
28718
28739
|
const target = path63.join(targetBase, "CLAUDE.md");
|
|
@@ -28721,14 +28742,14 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
28721
28742
|
const targetContent = fs39.readFileSync(target, "utf8");
|
|
28722
28743
|
if (sourceContent !== targetContent) {
|
|
28723
28744
|
console.log(
|
|
28724
|
-
|
|
28745
|
+
chalk214.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
28725
28746
|
);
|
|
28726
28747
|
console.log();
|
|
28727
28748
|
printDiff(targetContent, sourceContent);
|
|
28728
28749
|
if (!options2?.yes) {
|
|
28729
28750
|
printAutoConfirmHint();
|
|
28730
28751
|
const confirm = await promptConfirm(
|
|
28731
|
-
|
|
28752
|
+
chalk214.red("Overwrite existing CLAUDE.md?"),
|
|
28732
28753
|
false
|
|
28733
28754
|
);
|
|
28734
28755
|
if (!confirm) {
|
|
@@ -28961,7 +28982,7 @@ function syncPi(claudeDir, options2) {
|
|
|
28961
28982
|
// src/commands/sync/syncSettings.ts
|
|
28962
28983
|
import * as fs45 from "fs";
|
|
28963
28984
|
import * as path70 from "path";
|
|
28964
|
-
import
|
|
28985
|
+
import chalk215 from "chalk";
|
|
28965
28986
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
28966
28987
|
const source = path70.join(claudeDir, "settings.json");
|
|
28967
28988
|
const target = path70.join(targetBase, "settings.json");
|
|
@@ -28980,7 +29001,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
28980
29001
|
if (mergedContent !== normalizedTarget) {
|
|
28981
29002
|
if (!options2?.yes) {
|
|
28982
29003
|
console.log(
|
|
28983
|
-
|
|
29004
|
+
chalk215.yellow(
|
|
28984
29005
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
28985
29006
|
)
|
|
28986
29007
|
);
|
|
@@ -28988,7 +29009,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
28988
29009
|
printDiff(targetContent, mergedContent);
|
|
28989
29010
|
printAutoConfirmHint();
|
|
28990
29011
|
const confirm = await promptConfirm(
|
|
28991
|
-
|
|
29012
|
+
chalk215.red("Overwrite existing settings.json?"),
|
|
28992
29013
|
false
|
|
28993
29014
|
);
|
|
28994
29015
|
if (!confirm) {
|
|
@@ -30346,7 +30367,7 @@ function registerWatch(program2) {
|
|
|
30346
30367
|
|
|
30347
30368
|
// src/commands/roam/auth.ts
|
|
30348
30369
|
import { randomBytes } from "crypto";
|
|
30349
|
-
import
|
|
30370
|
+
import chalk216 from "chalk";
|
|
30350
30371
|
|
|
30351
30372
|
// src/commands/roam/waitForCallback.ts
|
|
30352
30373
|
import { createServer as createServer3 } from "http";
|
|
@@ -30477,13 +30498,13 @@ async function auth() {
|
|
|
30477
30498
|
saveGlobalConfig(config);
|
|
30478
30499
|
const state = randomBytes(16).toString("hex");
|
|
30479
30500
|
console.log(
|
|
30480
|
-
|
|
30501
|
+
chalk216.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
30481
30502
|
);
|
|
30482
|
-
console.log(
|
|
30483
|
-
console.log(
|
|
30484
|
-
console.log(
|
|
30503
|
+
console.log(chalk216.white("http://localhost:14523/callback\n"));
|
|
30504
|
+
console.log(chalk216.blue("Opening browser for authorization..."));
|
|
30505
|
+
console.log(chalk216.dim("Waiting for authorization callback..."));
|
|
30485
30506
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
30486
|
-
console.log(
|
|
30507
|
+
console.log(chalk216.dim("Exchanging code for tokens..."));
|
|
30487
30508
|
const tokens = await exchangeToken({
|
|
30488
30509
|
code,
|
|
30489
30510
|
clientId,
|
|
@@ -30499,7 +30520,7 @@ async function auth() {
|
|
|
30499
30520
|
};
|
|
30500
30521
|
saveGlobalConfig(config);
|
|
30501
30522
|
console.log(
|
|
30502
|
-
|
|
30523
|
+
chalk216.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
30503
30524
|
);
|
|
30504
30525
|
}
|
|
30505
30526
|
|
|
@@ -30850,7 +30871,7 @@ import { execSync as execSync60 } from "child_process";
|
|
|
30850
30871
|
import { existsSync as existsSync68, mkdirSync as mkdirSync30, unlinkSync as unlinkSync22, writeFileSync as writeFileSync45 } from "fs";
|
|
30851
30872
|
import { tmpdir as tmpdir8 } from "os";
|
|
30852
30873
|
import { join as join85, resolve as resolve20 } from "path";
|
|
30853
|
-
import
|
|
30874
|
+
import chalk217 from "chalk";
|
|
30854
30875
|
|
|
30855
30876
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
30856
30877
|
var captureWindowPs1 = `
|
|
@@ -31001,13 +31022,13 @@ function screenshot(processName) {
|
|
|
31001
31022
|
const config = loadConfig();
|
|
31002
31023
|
const outputDir = resolve20(config.screenshot.outputDir);
|
|
31003
31024
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
31004
|
-
console.log(
|
|
31025
|
+
console.log(chalk217.gray(`Capturing window for process "${processName}" ...`));
|
|
31005
31026
|
try {
|
|
31006
31027
|
runPowerShellScript(processName, outputPath);
|
|
31007
|
-
console.log(
|
|
31028
|
+
console.log(chalk217.green(`Screenshot saved: ${outputPath}`));
|
|
31008
31029
|
} catch (error) {
|
|
31009
31030
|
const msg = error instanceof Error ? error.message : String(error);
|
|
31010
|
-
console.error(
|
|
31031
|
+
console.error(chalk217.red(`Failed to capture screenshot: ${msg}`));
|
|
31011
31032
|
process.exit(1);
|
|
31012
31033
|
}
|
|
31013
31034
|
}
|
|
@@ -35176,10 +35197,15 @@ function isHello(msg) {
|
|
|
35176
35197
|
return msg.type === "hello" && typeof msg.version === "string" && (msg.protocol === void 0 || typeof msg.protocol === "number");
|
|
35177
35198
|
}
|
|
35178
35199
|
function helloCompatible(msg) {
|
|
35179
|
-
if (
|
|
35180
|
-
return msg.protocol === PROTOCOL_VERSION;
|
|
35200
|
+
if (protocolMismatched(msg)) return false;
|
|
35181
35201
|
return msg.version === ASSIST_VERSION;
|
|
35182
35202
|
}
|
|
35203
|
+
function helloMismatchKind(msg) {
|
|
35204
|
+
return protocolMismatched(msg) ? "protocol" : "version";
|
|
35205
|
+
}
|
|
35206
|
+
function protocolMismatched(msg) {
|
|
35207
|
+
return typeof msg.protocol === "number" && msg.protocol !== PROTOCOL_VERSION;
|
|
35208
|
+
}
|
|
35183
35209
|
|
|
35184
35210
|
// src/commands/sessions/daemon/windowsVersionCheck.ts
|
|
35185
35211
|
function windowsVersionCheck() {
|
|
@@ -35190,20 +35216,21 @@ function windowsVersionCheck() {
|
|
|
35190
35216
|
function handleHello(state, msg) {
|
|
35191
35217
|
if (!isHello(msg) || helloCompatible(msg)) return;
|
|
35192
35218
|
const mode = windowsVersionCheck();
|
|
35219
|
+
const mismatch = `windows daemon ${helloMismatchKind(msg)} mismatch`;
|
|
35193
35220
|
const detail = `protocol ${msg.protocol ?? "legacy"} version ${msg.version} (wsl protocol ${PROTOCOL_VERSION} version ${ASSIST_VERSION})`;
|
|
35194
35221
|
if (mode === "off") {
|
|
35195
35222
|
daemonLog(
|
|
35196
|
-
|
|
35223
|
+
`${mismatch}: ${detail}; check disabled (sessions.windowsVersionCheck=off), proceeding`
|
|
35197
35224
|
);
|
|
35198
35225
|
return;
|
|
35199
35226
|
}
|
|
35200
35227
|
if (mode === "warn") {
|
|
35201
35228
|
daemonLog(
|
|
35202
|
-
|
|
35229
|
+
`${mismatch}: ${detail}; proceeding with warning (sessions.windowsVersionCheck=warn)`
|
|
35203
35230
|
);
|
|
35204
35231
|
return;
|
|
35205
35232
|
}
|
|
35206
|
-
daemonLog(
|
|
35233
|
+
daemonLog(`${mismatch}: ${detail}`);
|
|
35207
35234
|
state.onVersionMismatch(msg.version);
|
|
35208
35235
|
}
|
|
35209
35236
|
|
|
@@ -36524,7 +36551,7 @@ function registerSetStatusCommand(cmd) {
|
|
|
36524
36551
|
|
|
36525
36552
|
// src/commands/sessions/summarise/index.ts
|
|
36526
36553
|
import * as fs54 from "fs";
|
|
36527
|
-
import
|
|
36554
|
+
import chalk218 from "chalk";
|
|
36528
36555
|
|
|
36529
36556
|
// src/commands/sessions/summarise/shared.ts
|
|
36530
36557
|
import * as fs53 from "fs";
|
|
@@ -36583,22 +36610,22 @@ ${firstMessage}`);
|
|
|
36583
36610
|
async function summarise2(options2) {
|
|
36584
36611
|
const files = await discoverSessionFiles();
|
|
36585
36612
|
if (files.length === 0) {
|
|
36586
|
-
console.log(
|
|
36613
|
+
console.log(chalk218.yellow("No sessions found."));
|
|
36587
36614
|
return;
|
|
36588
36615
|
}
|
|
36589
36616
|
const toProcess = selectCandidates(files, options2);
|
|
36590
36617
|
if (toProcess.length === 0) {
|
|
36591
|
-
console.log(
|
|
36618
|
+
console.log(chalk218.green("All sessions already summarised."));
|
|
36592
36619
|
return;
|
|
36593
36620
|
}
|
|
36594
36621
|
console.log(
|
|
36595
|
-
|
|
36622
|
+
chalk218.cyan(
|
|
36596
36623
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
36597
36624
|
)
|
|
36598
36625
|
);
|
|
36599
36626
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
36600
36627
|
console.log(
|
|
36601
|
-
|
|
36628
|
+
chalk218.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk218.yellow(`, ${failed2} skipped`) : "")
|
|
36602
36629
|
);
|
|
36603
36630
|
}
|
|
36604
36631
|
function selectCandidates(files, options2) {
|
|
@@ -36618,16 +36645,16 @@ function processSessions(files) {
|
|
|
36618
36645
|
let failed2 = 0;
|
|
36619
36646
|
for (let i = 0; i < files.length; i++) {
|
|
36620
36647
|
const file = files[i];
|
|
36621
|
-
process.stdout.write(
|
|
36648
|
+
process.stdout.write(chalk218.dim(` [${i + 1}/${files.length}] `));
|
|
36622
36649
|
const summary = summariseSession(file);
|
|
36623
36650
|
if (summary) {
|
|
36624
36651
|
writeSummary(file, summary);
|
|
36625
36652
|
succeeded++;
|
|
36626
|
-
process.stdout.write(`${
|
|
36653
|
+
process.stdout.write(`${chalk218.green("\u2713")} ${summary}
|
|
36627
36654
|
`);
|
|
36628
36655
|
} else {
|
|
36629
36656
|
failed2++;
|
|
36630
|
-
process.stdout.write(` ${
|
|
36657
|
+
process.stdout.write(` ${chalk218.yellow("skip")}
|
|
36631
36658
|
`);
|
|
36632
36659
|
}
|
|
36633
36660
|
}
|
|
@@ -36648,7 +36675,7 @@ function registerSessions(program2) {
|
|
|
36648
36675
|
}
|
|
36649
36676
|
|
|
36650
36677
|
// src/commands/statusLine.ts
|
|
36651
|
-
import
|
|
36678
|
+
import chalk220 from "chalk";
|
|
36652
36679
|
|
|
36653
36680
|
// src/shared/contextLevel.ts
|
|
36654
36681
|
function contextLevel(pct) {
|
|
@@ -36658,7 +36685,7 @@ function contextLevel(pct) {
|
|
|
36658
36685
|
}
|
|
36659
36686
|
|
|
36660
36687
|
// src/commands/buildLimitsSegment.ts
|
|
36661
|
-
import
|
|
36688
|
+
import chalk219 from "chalk";
|
|
36662
36689
|
|
|
36663
36690
|
// src/shared/rateLimitLevel.ts
|
|
36664
36691
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -36696,9 +36723,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
36696
36723
|
|
|
36697
36724
|
// src/commands/buildLimitsSegment.ts
|
|
36698
36725
|
var LEVEL_COLOR = {
|
|
36699
|
-
ok:
|
|
36700
|
-
warn:
|
|
36701
|
-
over:
|
|
36726
|
+
ok: chalk219.green,
|
|
36727
|
+
warn: chalk219.yellow,
|
|
36728
|
+
over: chalk219.red
|
|
36702
36729
|
};
|
|
36703
36730
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
36704
36731
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -36794,7 +36821,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
36794
36821
|
}
|
|
36795
36822
|
|
|
36796
36823
|
// src/commands/statusLine.ts
|
|
36797
|
-
|
|
36824
|
+
chalk220.level = 3;
|
|
36798
36825
|
function formatNumber(num) {
|
|
36799
36826
|
return num.toLocaleString("en-US");
|
|
36800
36827
|
}
|
|
@@ -36802,9 +36829,9 @@ function colorizePercent(pct) {
|
|
|
36802
36829
|
const label2 = `${Math.round(pct)}%`;
|
|
36803
36830
|
switch (contextLevel(pct)) {
|
|
36804
36831
|
case "red":
|
|
36805
|
-
return
|
|
36832
|
+
return chalk220.red(label2);
|
|
36806
36833
|
case "yellow":
|
|
36807
|
-
return
|
|
36834
|
+
return chalk220.yellow(label2);
|
|
36808
36835
|
default:
|
|
36809
36836
|
return label2;
|
|
36810
36837
|
}
|
|
@@ -36817,7 +36844,7 @@ async function statusLine() {
|
|
|
36817
36844
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
36818
36845
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
36819
36846
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
36820
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
36847
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk220.cyan(branch2)} | ` : "";
|
|
36821
36848
|
console.log(
|
|
36822
36849
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
36823
36850
|
);
|
|
@@ -36887,10 +36914,10 @@ async function update2() {
|
|
|
36887
36914
|
}
|
|
36888
36915
|
|
|
36889
36916
|
// src/reportCliError.ts
|
|
36890
|
-
import
|
|
36917
|
+
import chalk221 from "chalk";
|
|
36891
36918
|
function reportCliError(error) {
|
|
36892
36919
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError) {
|
|
36893
|
-
console.error(
|
|
36920
|
+
console.error(chalk221.red(error.message));
|
|
36894
36921
|
} else {
|
|
36895
36922
|
console.error(error);
|
|
36896
36923
|
}
|