@staff0rd/assist 0.1098.0 → 0.1099.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/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.1099.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -5594,13 +5594,48 @@ function parseAzureDevopsPrUrl(url) {
|
|
|
5594
5594
|
return { org, project, repo, id, url: `${parsed.origin}${matched.path}` };
|
|
5595
5595
|
}
|
|
5596
5596
|
|
|
5597
|
+
// src/shared/harnessAdapters/prFeatures.ts
|
|
5598
|
+
var fixConflictFeature = {
|
|
5599
|
+
id: "fixConflict",
|
|
5600
|
+
label: "Fix conflicts",
|
|
5601
|
+
requires: ["skills.native"]
|
|
5602
|
+
};
|
|
5603
|
+
var reviewPrCommentsFeature = {
|
|
5604
|
+
id: "reviewPrComments",
|
|
5605
|
+
label: "Address comments",
|
|
5606
|
+
requires: ["skills.native"]
|
|
5607
|
+
};
|
|
5608
|
+
var prFeatures = [
|
|
5609
|
+
fixConflictFeature,
|
|
5610
|
+
reviewPrCommentsFeature
|
|
5611
|
+
];
|
|
5612
|
+
|
|
5597
5613
|
// src/shared/prActions.ts
|
|
5614
|
+
var addressCommentsActions = [
|
|
5615
|
+
{
|
|
5616
|
+
label: "Address Comments",
|
|
5617
|
+
args: ["review-pr-comments"],
|
|
5618
|
+
featureId: reviewPrCommentsFeature.id
|
|
5619
|
+
},
|
|
5620
|
+
{
|
|
5621
|
+
label: "Address Comments (auto)",
|
|
5622
|
+
args: ["review-pr-comments", "--auto"],
|
|
5623
|
+
featureId: reviewPrCommentsFeature.id
|
|
5624
|
+
}
|
|
5625
|
+
];
|
|
5598
5626
|
var prActions = [
|
|
5599
5627
|
{ label: "Checkout", args: ["review", "--checkout-only"] },
|
|
5600
|
-
|
|
5601
|
-
{
|
|
5602
|
-
|
|
5603
|
-
|
|
5628
|
+
...addressCommentsActions,
|
|
5629
|
+
{
|
|
5630
|
+
label: "Fix conflicts (merge)",
|
|
5631
|
+
args: ["fix-conflict"],
|
|
5632
|
+
featureId: fixConflictFeature.id
|
|
5633
|
+
},
|
|
5634
|
+
{
|
|
5635
|
+
label: "Fix conflicts (rebase)",
|
|
5636
|
+
args: ["fix-conflict", "--rebase"],
|
|
5637
|
+
featureId: fixConflictFeature.id
|
|
5638
|
+
}
|
|
5604
5639
|
];
|
|
5605
5640
|
|
|
5606
5641
|
// src/shared/azureDevops/azureDevopsPrActions.ts
|
|
@@ -5802,7 +5837,10 @@ function withoutHarness(mode, rest) {
|
|
|
5802
5837
|
}
|
|
5803
5838
|
function isAllowedPrArgs(args) {
|
|
5804
5839
|
if (!Array.isArray(args)) return false;
|
|
5805
|
-
|
|
5840
|
+
const isAction = prActions.some(
|
|
5841
|
+
(action) => sameArgs(action.args, args.slice(0, action.args.length)) && withoutHarness(action, args.slice(action.args.length))?.length === 0
|
|
5842
|
+
);
|
|
5843
|
+
if (isAction) return true;
|
|
5806
5844
|
return reviewButtonModes.some((mode) => {
|
|
5807
5845
|
if (!sameArgs(mode.args, args.slice(0, mode.args.length))) return false;
|
|
5808
5846
|
const flags2 = withoutHarness(mode, args.slice(mode.args.length));
|
|
@@ -9239,7 +9277,8 @@ var harnessFeatures = [
|
|
|
9239
9277
|
branchSlugFeature,
|
|
9240
9278
|
sessionTitleFeature,
|
|
9241
9279
|
usageLimitsFeature,
|
|
9242
|
-
...reviewFeatures
|
|
9280
|
+
...reviewFeatures,
|
|
9281
|
+
...prFeatures
|
|
9243
9282
|
];
|
|
9244
9283
|
|
|
9245
9284
|
// src/shared/harnessAdapters/resolveCapability.ts
|
|
@@ -34610,8 +34649,8 @@ function registerRefineLaunch(program, resumeFlag) {
|
|
|
34610
34649
|
configHelp(command, harnessConfigHelp);
|
|
34611
34650
|
}
|
|
34612
34651
|
|
|
34613
|
-
// src/commands/
|
|
34614
|
-
import
|
|
34652
|
+
// src/commands/launchPrSkill.ts
|
|
34653
|
+
import chalk197 from "chalk";
|
|
34615
34654
|
|
|
34616
34655
|
// src/commands/review/checkoutPr.ts
|
|
34617
34656
|
import { execFileSync as execFileSync18 } from "child_process";
|
|
@@ -35419,49 +35458,71 @@ async function checkoutPr(number) {
|
|
|
35419
35458
|
}
|
|
35420
35459
|
}
|
|
35421
35460
|
|
|
35422
|
-
// src/commands/
|
|
35423
|
-
function
|
|
35424
|
-
|
|
35425
|
-
|
|
35426
|
-
|
|
35427
|
-
|
|
35461
|
+
// src/commands/launchPrSkill.ts
|
|
35462
|
+
async function launchPrSkill({
|
|
35463
|
+
feature,
|
|
35464
|
+
skill,
|
|
35465
|
+
args,
|
|
35466
|
+
number,
|
|
35467
|
+
harness,
|
|
35468
|
+
resumeSessionId
|
|
35469
|
+
}) {
|
|
35470
|
+
const adapter = harnessAdapter(harness);
|
|
35471
|
+
const blocker = launchBlocker(adapter, feature, resumeSessionId);
|
|
35472
|
+
if (blocker) {
|
|
35473
|
+
console.error(chalk197.red(blocker));
|
|
35474
|
+
process.exitCode = 1;
|
|
35475
|
+
return;
|
|
35476
|
+
}
|
|
35428
35477
|
if (number && !resumeSessionId) await checkoutPr(number);
|
|
35429
|
-
const
|
|
35478
|
+
const conversationId = resumeSessionId ?? preassignedId(adapter);
|
|
35430
35479
|
emitActivity({
|
|
35431
35480
|
kind: "command",
|
|
35432
|
-
name:
|
|
35433
|
-
|
|
35481
|
+
name: skill,
|
|
35482
|
+
...adapter.activityIdentity(conversationId, resumeSessionId)
|
|
35483
|
+
});
|
|
35484
|
+
const cwd = process.cwd();
|
|
35485
|
+
const { done: done2 } = resumeSessionId ? adapter.resume(resumeSessionId, resumeNudge(), { cwd }) : adapter.launchSkill(skill, args, { conversationId, cwd });
|
|
35486
|
+
const exitCode = await awaitHarness(done2, `/${skill}`, adapter.label);
|
|
35487
|
+
if (exitCode === HARNESS_SPAWN_FAILED) process.exitCode = 1;
|
|
35488
|
+
}
|
|
35489
|
+
|
|
35490
|
+
// src/commands/fixConflict.ts
|
|
35491
|
+
function fixConflict(number, options2 = {}) {
|
|
35492
|
+
return launchPrSkill({
|
|
35493
|
+
feature: fixConflictFeature,
|
|
35494
|
+
skill: "fix-conflict",
|
|
35495
|
+
args: options2.rebase ? "--rebase" : void 0,
|
|
35496
|
+
number,
|
|
35497
|
+
harness: options2.harness,
|
|
35498
|
+
resumeSessionId: options2.resumeSessionId
|
|
35434
35499
|
});
|
|
35435
|
-
const { done: done2 } = spawnClaude2(
|
|
35436
|
-
resumeSessionId ? resumeNudge() : buildPrompt2(options2.rebase === true),
|
|
35437
|
-
{
|
|
35438
|
-
permissionMode: "auto",
|
|
35439
|
-
sessionId: claudeSessionId,
|
|
35440
|
-
resumeSessionId
|
|
35441
|
-
}
|
|
35442
|
-
);
|
|
35443
|
-
await done2;
|
|
35444
35500
|
}
|
|
35445
35501
|
|
|
35446
35502
|
// src/commands/registerFixConflict.ts
|
|
35447
35503
|
function registerFixConflict(program, resumeFlag) {
|
|
35448
|
-
program.command("fix-conflict").argument("[number]", "PR number to check out first").option("--rebase", "Rebase onto the remote default instead of merging").option("--resume-session <id>", resumeFlag).
|
|
35504
|
+
const command = program.command("fix-conflict").argument("[number]", "PR number to check out first").option("--rebase", "Rebase onto the remote default instead of merging").option("--resume-session <id>", resumeFlag).option(
|
|
35505
|
+
"--harness <kind>",
|
|
35506
|
+
"Coding harness to launch (claude|codex|pi); defaults to the configured harness.engine. Exits with the reasons, before checking the PR out, when Fix conflicts is unavailable on it"
|
|
35507
|
+
).description(
|
|
35508
|
+
"Launch a coding harness in /fix-conflict mode (single session)"
|
|
35509
|
+
).action(
|
|
35449
35510
|
(number, options2) => fixConflict(number, {
|
|
35450
35511
|
rebase: options2.rebase,
|
|
35451
|
-
resumeSessionId: options2.resumeSession
|
|
35512
|
+
resumeSessionId: options2.resumeSession,
|
|
35513
|
+
harness: resolveHarness2(options2.harness)
|
|
35452
35514
|
})
|
|
35453
35515
|
);
|
|
35516
|
+
configHelp(command, harnessConfigHelp);
|
|
35454
35517
|
}
|
|
35455
35518
|
|
|
35456
35519
|
// src/commands/reviewPrComments.ts
|
|
35457
|
-
|
|
35458
|
-
function buildPrompt3(number, announce, options2) {
|
|
35520
|
+
function buildArgs4(number, announce, options2) {
|
|
35459
35521
|
const args = [
|
|
35460
|
-
"/review-pr-comments",
|
|
35461
35522
|
...options2.auto ? ["--auto"] : [],
|
|
35462
35523
|
...announce ? [`--announce ${number}`] : []
|
|
35463
35524
|
];
|
|
35464
|
-
return args.join(" ");
|
|
35525
|
+
return args.length ? args.join(" ") : void 0;
|
|
35465
35526
|
}
|
|
35466
35527
|
function validateAnnounce(number, announce) {
|
|
35467
35528
|
if (!announce || number) return;
|
|
@@ -35470,41 +35531,39 @@ function validateAnnounce(number, announce) {
|
|
|
35470
35531
|
}
|
|
35471
35532
|
async function reviewPrComments(number, options2 = {}) {
|
|
35472
35533
|
const announce = options2.announce === true;
|
|
35473
|
-
const resumeSessionId = options2.resumeSessionId;
|
|
35474
35534
|
validateAnnounce(number, announce);
|
|
35475
|
-
|
|
35476
|
-
|
|
35477
|
-
|
|
35478
|
-
|
|
35479
|
-
|
|
35480
|
-
|
|
35535
|
+
await launchPrSkill({
|
|
35536
|
+
feature: reviewPrCommentsFeature,
|
|
35537
|
+
skill: "review-pr-comments",
|
|
35538
|
+
args: buildArgs4(number, announce, options2),
|
|
35539
|
+
number,
|
|
35540
|
+
harness: options2.harness,
|
|
35541
|
+
resumeSessionId: options2.resumeSessionId
|
|
35481
35542
|
});
|
|
35482
|
-
const { done: done2 } = spawnClaude2(
|
|
35483
|
-
resumeSessionId ? resumeNudge() : buildPrompt3(number, announce, options2),
|
|
35484
|
-
{
|
|
35485
|
-
permissionMode: "auto",
|
|
35486
|
-
sessionId: claudeSessionId,
|
|
35487
|
-
resumeSessionId
|
|
35488
|
-
}
|
|
35489
|
-
);
|
|
35490
|
-
await done2;
|
|
35491
35543
|
}
|
|
35492
35544
|
|
|
35493
35545
|
// src/commands/registerReviewPrComments.ts
|
|
35494
35546
|
function registerReviewPrComments(program, resumeFlag) {
|
|
35495
|
-
program.command("review-pr-comments").argument("[number]", "PR number to check out first").description(
|
|
35547
|
+
const command = program.command("review-pr-comments").argument("[number]", "PR number to check out first").description(
|
|
35548
|
+
"Launch a coding harness in /review-pr-comments mode (single session)"
|
|
35549
|
+
).option(
|
|
35496
35550
|
"--announce",
|
|
35497
35551
|
"After every comment thread is processed, announce the PR in Slack via /prs-slack <number> --no-confirm (requires a PR number)"
|
|
35498
35552
|
).option(
|
|
35499
35553
|
"--auto",
|
|
35500
|
-
"Accept
|
|
35501
|
-
).option("--resume-session <id>", resumeFlag).
|
|
35554
|
+
"Accept the harness's own recommendation for each thread without asking, falling back to asking only for threads it cannot confidently decide"
|
|
35555
|
+
).option("--resume-session <id>", resumeFlag).option(
|
|
35556
|
+
"--harness <kind>",
|
|
35557
|
+
"Coding harness to launch (claude|codex|pi); defaults to the configured harness.engine. Exits with the reasons, before checking the PR out, when Address comments is unavailable on it"
|
|
35558
|
+
).action(
|
|
35502
35559
|
(number, opts) => reviewPrComments(number, {
|
|
35503
35560
|
announce: opts.announce,
|
|
35504
35561
|
auto: opts.auto,
|
|
35505
|
-
resumeSessionId: opts.resumeSession
|
|
35562
|
+
resumeSessionId: opts.resumeSession,
|
|
35563
|
+
harness: resolveHarness2(opts.harness)
|
|
35506
35564
|
})
|
|
35507
35565
|
);
|
|
35566
|
+
configHelp(command, harnessConfigHelp);
|
|
35508
35567
|
}
|
|
35509
35568
|
|
|
35510
35569
|
// src/commands/registerLaunch.ts
|
|
@@ -35559,18 +35618,18 @@ function registerList(program) {
|
|
|
35559
35618
|
}
|
|
35560
35619
|
|
|
35561
35620
|
// src/commands/litellm/listModels.ts
|
|
35562
|
-
import
|
|
35621
|
+
import chalk199 from "chalk";
|
|
35563
35622
|
|
|
35564
35623
|
// src/commands/litellm/resolveLitellmConfig.ts
|
|
35565
|
-
import
|
|
35624
|
+
import chalk198 from "chalk";
|
|
35566
35625
|
function resolveLitellmConfig() {
|
|
35567
35626
|
const { config, missing } = readLitellmConfig();
|
|
35568
35627
|
if (!config) {
|
|
35569
|
-
console.error(
|
|
35628
|
+
console.error(chalk198.red("LiteLLM is not configured"));
|
|
35570
35629
|
for (const key of missing) {
|
|
35571
35630
|
const entry = litellmConfigHelp.find((help) => help.key === key);
|
|
35572
35631
|
console.error(
|
|
35573
|
-
|
|
35632
|
+
chalk198.red(` ${key} is not set. Set it with: ${entry?.setter}`)
|
|
35574
35633
|
);
|
|
35575
35634
|
}
|
|
35576
35635
|
process.exit(1);
|
|
@@ -35596,13 +35655,13 @@ async function listModels(options2) {
|
|
|
35596
35655
|
} catch (error) {
|
|
35597
35656
|
const reason4 = error instanceof Error ? error.message : String(error);
|
|
35598
35657
|
console.error(
|
|
35599
|
-
|
|
35658
|
+
chalk199.red(`Failed to reach LiteLLM at ${baseUrl2}: ${reason4}`)
|
|
35600
35659
|
);
|
|
35601
35660
|
process.exit(1);
|
|
35602
35661
|
}
|
|
35603
35662
|
const body = await response.text();
|
|
35604
35663
|
if (!response.ok) {
|
|
35605
|
-
console.error(
|
|
35664
|
+
console.error(chalk199.red(`LiteLLM returned ${response.status}: ${body}`));
|
|
35606
35665
|
process.exit(1);
|
|
35607
35666
|
}
|
|
35608
35667
|
if (options2.json) {
|
|
@@ -35622,15 +35681,15 @@ function registerLitellm(program) {
|
|
|
35622
35681
|
// src/commands/mermaidExport.ts
|
|
35623
35682
|
import { mkdirSync as mkdirSync28, readdirSync as readdirSync17 } from "fs";
|
|
35624
35683
|
import { resolve as resolve24 } from "path";
|
|
35625
|
-
import
|
|
35684
|
+
import chalk202 from "chalk";
|
|
35626
35685
|
|
|
35627
35686
|
// src/commands/mermaid/exportFile.ts
|
|
35628
35687
|
import { readFileSync as readFileSync52, writeFileSync as writeFileSync42 } from "fs";
|
|
35629
35688
|
import { basename as basename23, extname as extname4, resolve as resolve23 } from "path";
|
|
35630
|
-
import
|
|
35689
|
+
import chalk201 from "chalk";
|
|
35631
35690
|
|
|
35632
35691
|
// src/commands/mermaid/renderBlock.ts
|
|
35633
|
-
import
|
|
35692
|
+
import chalk200 from "chalk";
|
|
35634
35693
|
async function renderBlock(krokiUrl, source) {
|
|
35635
35694
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
35636
35695
|
method: "POST",
|
|
@@ -35639,7 +35698,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
35639
35698
|
});
|
|
35640
35699
|
if (!response.ok) {
|
|
35641
35700
|
console.error(
|
|
35642
|
-
|
|
35701
|
+
chalk200.red(
|
|
35643
35702
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
35644
35703
|
)
|
|
35645
35704
|
);
|
|
@@ -35657,19 +35716,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
35657
35716
|
if (onlyIndex !== void 0) {
|
|
35658
35717
|
if (onlyIndex < 1 || onlyIndex > blocks2.length) {
|
|
35659
35718
|
console.error(
|
|
35660
|
-
|
|
35719
|
+
chalk201.red(
|
|
35661
35720
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks2.length} diagram(s))`
|
|
35662
35721
|
)
|
|
35663
35722
|
);
|
|
35664
35723
|
process.exit(1);
|
|
35665
35724
|
}
|
|
35666
35725
|
console.log(
|
|
35667
|
-
|
|
35726
|
+
chalk201.gray(
|
|
35668
35727
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks2.length}`
|
|
35669
35728
|
)
|
|
35670
35729
|
);
|
|
35671
35730
|
} else {
|
|
35672
|
-
console.log(
|
|
35731
|
+
console.log(chalk201.gray(`${file} \u2014 ${blocks2.length} diagram(s)`));
|
|
35673
35732
|
}
|
|
35674
35733
|
for (const [i, source] of blocks2.entries()) {
|
|
35675
35734
|
const idx = i + 1;
|
|
@@ -35677,7 +35736,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
35677
35736
|
const outPath = resolve23(outDir, `${stem}-${idx}.svg`);
|
|
35678
35737
|
const svg = await renderBlock(krokiUrl, source);
|
|
35679
35738
|
writeFileSync42(outPath, svg, "utf8");
|
|
35680
|
-
console.log(
|
|
35739
|
+
console.log(chalk201.green(` \u2192 ${outPath}`));
|
|
35681
35740
|
}
|
|
35682
35741
|
}
|
|
35683
35742
|
function extractMermaidBlocks(markdown) {
|
|
@@ -35693,18 +35752,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
35693
35752
|
if (options2.index !== void 0) {
|
|
35694
35753
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
35695
35754
|
console.error(
|
|
35696
|
-
|
|
35755
|
+
chalk202.red(`--index must be a positive integer (got ${options2.index})`)
|
|
35697
35756
|
);
|
|
35698
35757
|
process.exit(1);
|
|
35699
35758
|
}
|
|
35700
35759
|
if (!file) {
|
|
35701
|
-
console.error(
|
|
35760
|
+
console.error(chalk202.red("--index requires a file argument"));
|
|
35702
35761
|
process.exit(1);
|
|
35703
35762
|
}
|
|
35704
35763
|
}
|
|
35705
35764
|
const files = file ? [file] : readdirSync17(process.cwd()).filter((name2) => name2.toLowerCase().endsWith(".md")).sort();
|
|
35706
35765
|
if (files.length === 0) {
|
|
35707
|
-
console.log(
|
|
35766
|
+
console.log(chalk202.gray("No markdown files found in current directory."));
|
|
35708
35767
|
return;
|
|
35709
35768
|
}
|
|
35710
35769
|
for (const f of files) {
|
|
@@ -35850,7 +35909,7 @@ function extractToSave(details, cwd = process.cwd()) {
|
|
|
35850
35909
|
}
|
|
35851
35910
|
|
|
35852
35911
|
// src/commands/miro/keptTexts.ts
|
|
35853
|
-
import
|
|
35912
|
+
import chalk203 from "chalk";
|
|
35854
35913
|
|
|
35855
35914
|
// src/commands/miro/applyIgnore.ts
|
|
35856
35915
|
function applyIgnore(texts, ignore3) {
|
|
@@ -35889,7 +35948,7 @@ function warnUnmatched(file, unmatched) {
|
|
|
35889
35948
|
if (unmatched.length === 0) return;
|
|
35890
35949
|
const entries = unmatched.map((entry) => ` - ${entry}`).join("\n");
|
|
35891
35950
|
console.error(
|
|
35892
|
-
|
|
35951
|
+
chalk203.yellow(
|
|
35893
35952
|
`${unmatched.length} ${unmatched.length === 1 ? "entry" : "entries"} in ${file} matched no box text:
|
|
35894
35953
|
${entries}`
|
|
35895
35954
|
)
|
|
@@ -36011,7 +36070,7 @@ async function offerSaveExtract(extract2, options2, paths = {}) {
|
|
|
36011
36070
|
}
|
|
36012
36071
|
|
|
36013
36072
|
// src/commands/miro/pickAnchors.ts
|
|
36014
|
-
import { randomUUID as
|
|
36073
|
+
import { randomUUID as randomUUID19 } from "crypto";
|
|
36015
36074
|
|
|
36016
36075
|
// src/commands/miro/isBox.ts
|
|
36017
36076
|
var boxTypes = /* @__PURE__ */ new Set(["shape", "sticky_note"]);
|
|
@@ -36032,7 +36091,7 @@ async function pickAnchors(sessionId2, items3) {
|
|
|
36032
36091
|
"Miro anchor selection",
|
|
36033
36092
|
{
|
|
36034
36093
|
sessionId: sessionId2,
|
|
36035
|
-
requestId:
|
|
36094
|
+
requestId: randomUUID19(),
|
|
36036
36095
|
title: "Pick the top-left then the bottom-right box",
|
|
36037
36096
|
body: encodeMiroBoardPreview(items3),
|
|
36038
36097
|
prNumber: null,
|
|
@@ -36090,7 +36149,7 @@ function readMiroItems(file) {
|
|
|
36090
36149
|
}
|
|
36091
36150
|
|
|
36092
36151
|
// src/commands/miro/resolveExtractOptions.ts
|
|
36093
|
-
import
|
|
36152
|
+
import chalk204 from "chalk";
|
|
36094
36153
|
|
|
36095
36154
|
// src/commands/miro/extractLayers.ts
|
|
36096
36155
|
function extractsIn(layer) {
|
|
@@ -36168,7 +36227,7 @@ function resolveExtractOptions(name2, options2, paths) {
|
|
|
36168
36227
|
paths.cwd,
|
|
36169
36228
|
paths.globalConfigPath
|
|
36170
36229
|
);
|
|
36171
|
-
console.error(
|
|
36230
|
+
console.error(chalk204.dim(`Extract "${name2}" from ${resolved.from}`));
|
|
36172
36231
|
return resolved.options;
|
|
36173
36232
|
}
|
|
36174
36233
|
|
|
@@ -36273,7 +36332,7 @@ function registerMiro(program) {
|
|
|
36273
36332
|
import { mkdir as mkdir6 } from "fs/promises";
|
|
36274
36333
|
import { createServer as createServer2 } from "http";
|
|
36275
36334
|
import { dirname as dirname40 } from "path";
|
|
36276
|
-
import
|
|
36335
|
+
import chalk206 from "chalk";
|
|
36277
36336
|
|
|
36278
36337
|
// src/commands/netcap/corsHeaders.ts
|
|
36279
36338
|
var corsHeaders = {
|
|
@@ -36352,7 +36411,7 @@ function createNetcapHandler(options2) {
|
|
|
36352
36411
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
36353
36412
|
import { networkInterfaces } from "os";
|
|
36354
36413
|
import { join as join86 } from "path";
|
|
36355
|
-
import
|
|
36414
|
+
import chalk205 from "chalk";
|
|
36356
36415
|
|
|
36357
36416
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
36358
36417
|
import { dirname as dirname39, join as join85 } from "path";
|
|
@@ -36396,7 +36455,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
36396
36455
|
const host = lanIPv4();
|
|
36397
36456
|
if (!host) {
|
|
36398
36457
|
console.log(
|
|
36399
|
-
|
|
36458
|
+
chalk205.yellow("could not determine the WSL IP for the extension")
|
|
36400
36459
|
);
|
|
36401
36460
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
36402
36461
|
return source;
|
|
@@ -36407,7 +36466,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
36407
36466
|
return WSL_WINDOWS_PATH3;
|
|
36408
36467
|
} catch {
|
|
36409
36468
|
console.log(
|
|
36410
|
-
|
|
36469
|
+
chalk205.yellow(`could not copy extension to ${WSL_WINDOWS_PATH3}`)
|
|
36411
36470
|
);
|
|
36412
36471
|
return source;
|
|
36413
36472
|
}
|
|
@@ -36440,30 +36499,30 @@ async function netcap(options2) {
|
|
|
36440
36499
|
let count10 = 0;
|
|
36441
36500
|
const handler = createNetcapHandler({
|
|
36442
36501
|
outPath,
|
|
36443
|
-
onPing: () => console.log(
|
|
36502
|
+
onPing: () => console.log(chalk206.dim("ping from extension")),
|
|
36444
36503
|
onCapture: (entry) => {
|
|
36445
36504
|
count10 += 1;
|
|
36446
36505
|
console.log(
|
|
36447
|
-
|
|
36448
|
-
|
|
36506
|
+
chalk206.green(`captured #${count10}`),
|
|
36507
|
+
chalk206.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
36449
36508
|
);
|
|
36450
36509
|
}
|
|
36451
36510
|
});
|
|
36452
36511
|
const server = createServer2(handler);
|
|
36453
36512
|
server.listen(port, () => {
|
|
36454
36513
|
console.log(
|
|
36455
|
-
|
|
36514
|
+
chalk206.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
36456
36515
|
);
|
|
36457
|
-
console.log(
|
|
36516
|
+
console.log(chalk206.dim(`appending captures to ${outPath}`));
|
|
36458
36517
|
if (filter)
|
|
36459
|
-
console.log(
|
|
36460
|
-
console.log(
|
|
36461
|
-
console.log(
|
|
36518
|
+
console.log(chalk206.dim(`forwarding only URLs matching "${filter}"`));
|
|
36519
|
+
console.log(chalk206.dim(`load the unpacked extension from ${extensionPath}`));
|
|
36520
|
+
console.log(chalk206.dim("press Ctrl-C to stop"));
|
|
36462
36521
|
});
|
|
36463
36522
|
process.on("SIGINT", () => {
|
|
36464
36523
|
server.close();
|
|
36465
36524
|
console.log(
|
|
36466
|
-
|
|
36525
|
+
chalk206.bold(
|
|
36467
36526
|
`
|
|
36468
36527
|
netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
36469
36528
|
)
|
|
@@ -36475,7 +36534,7 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
36475
36534
|
// src/commands/netcap/netcapExtract.ts
|
|
36476
36535
|
import { writeFileSync as writeFileSync44 } from "fs";
|
|
36477
36536
|
import { join as join89 } from "path";
|
|
36478
|
-
import
|
|
36537
|
+
import chalk207 from "chalk";
|
|
36479
36538
|
|
|
36480
36539
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
36481
36540
|
import { readFileSync as readFileSync55 } from "fs";
|
|
@@ -36923,8 +36982,8 @@ function netcapExtract(file) {
|
|
|
36923
36982
|
writeFileSync44(outFile, `${JSON.stringify(posts, null, 2)}
|
|
36924
36983
|
`);
|
|
36925
36984
|
console.log(
|
|
36926
|
-
|
|
36927
|
-
|
|
36985
|
+
chalk207.green(`extracted ${posts.length} posts`),
|
|
36986
|
+
chalk207.dim(`-> ${outFile}`)
|
|
36928
36987
|
);
|
|
36929
36988
|
}
|
|
36930
36989
|
|
|
@@ -36945,7 +37004,7 @@ function registerNetcap(program) {
|
|
|
36945
37004
|
}
|
|
36946
37005
|
|
|
36947
37006
|
// src/commands/news/add.ts
|
|
36948
|
-
import
|
|
37007
|
+
import chalk208 from "chalk";
|
|
36949
37008
|
import enquirer8 from "enquirer";
|
|
36950
37009
|
async function add2(url) {
|
|
36951
37010
|
if (!url) {
|
|
@@ -36966,25 +37025,25 @@ async function add2(url) {
|
|
|
36966
37025
|
}
|
|
36967
37026
|
const added = await addFeed(await getDb(), url);
|
|
36968
37027
|
if (!added) {
|
|
36969
|
-
console.log(
|
|
37028
|
+
console.log(chalk208.yellow("Feed already exists"));
|
|
36970
37029
|
return;
|
|
36971
37030
|
}
|
|
36972
|
-
console.log(
|
|
37031
|
+
console.log(chalk208.green(`Added feed: ${url}`));
|
|
36973
37032
|
}
|
|
36974
37033
|
|
|
36975
37034
|
// src/commands/news/list.ts
|
|
36976
|
-
import
|
|
37035
|
+
import chalk209 from "chalk";
|
|
36977
37036
|
async function list4() {
|
|
36978
37037
|
const urls = await listFeeds(await getDb());
|
|
36979
37038
|
if (urls.length === 0) {
|
|
36980
|
-
console.log(
|
|
37039
|
+
console.log(chalk209.dim("No feeds; add one with assist news add <url>"));
|
|
36981
37040
|
return;
|
|
36982
37041
|
}
|
|
36983
37042
|
for (const url of urls) console.log(url);
|
|
36984
37043
|
}
|
|
36985
37044
|
|
|
36986
37045
|
// src/commands/news/remove.ts
|
|
36987
|
-
import
|
|
37046
|
+
import chalk210 from "chalk";
|
|
36988
37047
|
|
|
36989
37048
|
// src/commands/backlog/removeFeed.ts
|
|
36990
37049
|
import { eq as eq56 } from "drizzle-orm";
|
|
@@ -36997,10 +37056,10 @@ async function removeFeed(db, url) {
|
|
|
36997
37056
|
async function remove(url) {
|
|
36998
37057
|
const removed = await removeFeed(await getDb(), url);
|
|
36999
37058
|
if (!removed) {
|
|
37000
|
-
console.log(
|
|
37059
|
+
console.log(chalk210.yellow(`No feed matches ${url}`));
|
|
37001
37060
|
return;
|
|
37002
37061
|
}
|
|
37003
|
-
console.log(
|
|
37062
|
+
console.log(chalk210.green(`Removed feed: ${url}`));
|
|
37004
37063
|
}
|
|
37005
37064
|
|
|
37006
37065
|
// src/commands/registerNews.ts
|
|
@@ -37053,7 +37112,7 @@ function registerPiHook(program) {
|
|
|
37053
37112
|
}
|
|
37054
37113
|
|
|
37055
37114
|
// src/commands/prompts/printPromptsTable.ts
|
|
37056
|
-
import
|
|
37115
|
+
import chalk211 from "chalk";
|
|
37057
37116
|
function truncate3(str, max) {
|
|
37058
37117
|
if (str.length <= max) return str;
|
|
37059
37118
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -37071,14 +37130,14 @@ function printPromptsTable(rows) {
|
|
|
37071
37130
|
"Command".padEnd(commandWidth),
|
|
37072
37131
|
"Repos"
|
|
37073
37132
|
].join(" ");
|
|
37074
|
-
console.log(
|
|
37075
|
-
console.log(
|
|
37133
|
+
console.log(chalk211.dim(header));
|
|
37134
|
+
console.log(chalk211.dim("-".repeat(header.length)));
|
|
37076
37135
|
for (const row2 of rows) {
|
|
37077
37136
|
const count10 = String(row2.count).padStart(countWidth);
|
|
37078
37137
|
const tool = row2.tool.padEnd(toolWidth);
|
|
37079
37138
|
const command = truncate3(row2.command, 60).padEnd(commandWidth);
|
|
37080
37139
|
console.log(
|
|
37081
|
-
`${
|
|
37140
|
+
`${chalk211.yellow(count10)} ${tool} ${command} ${chalk211.dim(row2.repos)}`
|
|
37082
37141
|
);
|
|
37083
37142
|
}
|
|
37084
37143
|
}
|
|
@@ -37116,13 +37175,13 @@ import { execSync as execSync44 } from "child_process";
|
|
|
37116
37175
|
import enquirer9 from "enquirer";
|
|
37117
37176
|
|
|
37118
37177
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
37119
|
-
import
|
|
37178
|
+
import chalk212 from "chalk";
|
|
37120
37179
|
var STATUS_MAP = {
|
|
37121
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
37122
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
37180
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk212.magenta("merged"), date: pr.mergedAt } : null,
|
|
37181
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk212.red("closed"), date: pr.closedAt } : null
|
|
37123
37182
|
};
|
|
37124
37183
|
function defaultStatus(pr) {
|
|
37125
|
-
return { label:
|
|
37184
|
+
return { label: chalk212.green("opened"), date: pr.createdAt };
|
|
37126
37185
|
}
|
|
37127
37186
|
function getStatus(pr) {
|
|
37128
37187
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -37131,11 +37190,11 @@ function formatDate2(dateStr) {
|
|
|
37131
37190
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
37132
37191
|
}
|
|
37133
37192
|
function formatPrHeader(pr, status2) {
|
|
37134
|
-
return `${
|
|
37193
|
+
return `${chalk212.cyan(`#${pr.number}`)} ${pr.title} ${chalk212.dim(`(${pr.author.login},`)} ${status2.label} ${chalk212.dim(`${formatDate2(status2.date)})`)}`;
|
|
37135
37194
|
}
|
|
37136
37195
|
function logPrDetails(pr) {
|
|
37137
37196
|
console.log(
|
|
37138
|
-
|
|
37197
|
+
chalk212.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
37139
37198
|
);
|
|
37140
37199
|
console.log();
|
|
37141
37200
|
}
|
|
@@ -37263,13 +37322,13 @@ function postReviewComment(vars) {
|
|
|
37263
37322
|
}
|
|
37264
37323
|
|
|
37265
37324
|
// src/commands/prs/reviewProposedPrComment.ts
|
|
37266
|
-
import { randomUUID as
|
|
37325
|
+
import { randomUUID as randomUUID20 } from "crypto";
|
|
37267
37326
|
async function reviewProposedPrComment(title, body, prNumber) {
|
|
37268
37327
|
const sessionId2 = process.env.ASSIST_SESSION_ID;
|
|
37269
37328
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId2) return;
|
|
37270
37329
|
await awaitPreviewApproval("PR comment preview", {
|
|
37271
37330
|
sessionId: sessionId2,
|
|
37272
|
-
requestId:
|
|
37331
|
+
requestId: randomUUID20(),
|
|
37273
37332
|
title,
|
|
37274
37333
|
body,
|
|
37275
37334
|
prNumber,
|
|
@@ -37703,13 +37762,13 @@ function agentFooter(unresolvedCount) {
|
|
|
37703
37762
|
}
|
|
37704
37763
|
|
|
37705
37764
|
// src/commands/prs/listComments/commentStyle.ts
|
|
37706
|
-
import
|
|
37765
|
+
import chalk213 from "chalk";
|
|
37707
37766
|
var plain = (text20) => text20;
|
|
37708
37767
|
function colouredState(state) {
|
|
37709
37768
|
const label = `[${state}]`;
|
|
37710
|
-
if (state === "APPROVED") return
|
|
37711
|
-
if (state === "CHANGES_REQUESTED") return
|
|
37712
|
-
return
|
|
37769
|
+
if (state === "APPROVED") return chalk213.green(label);
|
|
37770
|
+
if (state === "CHANGES_REQUESTED") return chalk213.red(label);
|
|
37771
|
+
return chalk213.yellow(label);
|
|
37713
37772
|
}
|
|
37714
37773
|
function commentStyle() {
|
|
37715
37774
|
if (isAgentHarness()) {
|
|
@@ -37723,9 +37782,9 @@ function commentStyle() {
|
|
|
37723
37782
|
};
|
|
37724
37783
|
}
|
|
37725
37784
|
return {
|
|
37726
|
-
cyan:
|
|
37727
|
-
bold:
|
|
37728
|
-
dim:
|
|
37785
|
+
cyan: chalk213.cyan,
|
|
37786
|
+
bold: chalk213.bold,
|
|
37787
|
+
dim: chalk213.dim,
|
|
37729
37788
|
state: colouredState,
|
|
37730
37789
|
diffHunk: true,
|
|
37731
37790
|
agent: false
|
|
@@ -38305,7 +38364,7 @@ function parseScreenshotSpecs(specs) {
|
|
|
38305
38364
|
}
|
|
38306
38365
|
|
|
38307
38366
|
// src/commands/prs/previewAndApplyEdit.ts
|
|
38308
|
-
import { randomUUID as
|
|
38367
|
+
import { randomUUID as randomUUID21 } from "crypto";
|
|
38309
38368
|
|
|
38310
38369
|
// src/commands/prs/stageScreenshots.ts
|
|
38311
38370
|
import { readFile as readFile8 } from "fs/promises";
|
|
@@ -38327,7 +38386,7 @@ function stageScreenshots(screenshots = []) {
|
|
|
38327
38386
|
async function previewAndApplyEdit(args) {
|
|
38328
38387
|
const decision = await awaitPreviewApproval("PR preview", {
|
|
38329
38388
|
sessionId: args.sessionId,
|
|
38330
|
-
requestId:
|
|
38389
|
+
requestId: randomUUID21(),
|
|
38331
38390
|
title: args.title ?? args.currentTitle,
|
|
38332
38391
|
body: args.body,
|
|
38333
38392
|
prNumber: args.number,
|
|
@@ -38662,7 +38721,7 @@ async function placePr(prNumber, title, body, options2, attachments = []) {
|
|
|
38662
38721
|
}
|
|
38663
38722
|
|
|
38664
38723
|
// src/commands/prs/previewAndPlace.ts
|
|
38665
|
-
import { randomUUID as
|
|
38724
|
+
import { randomUUID as randomUUID22 } from "crypto";
|
|
38666
38725
|
|
|
38667
38726
|
// src/commands/review/announcePr.ts
|
|
38668
38727
|
function announcePr(prNumber) {
|
|
@@ -38738,7 +38797,7 @@ function enableAutoMerge() {
|
|
|
38738
38797
|
async function previewAndPlace(args) {
|
|
38739
38798
|
const decision = await awaitPreviewApproval("PR preview", {
|
|
38740
38799
|
sessionId: args.sessionId,
|
|
38741
|
-
requestId:
|
|
38800
|
+
requestId: randomUUID22(),
|
|
38742
38801
|
title: args.title,
|
|
38743
38802
|
body: args.body,
|
|
38744
38803
|
prNumber: args.prNumber,
|
|
@@ -39203,16 +39262,16 @@ function buildPrsStatusReport(repoArguments, now = Date.now()) {
|
|
|
39203
39262
|
}
|
|
39204
39263
|
|
|
39205
39264
|
// src/commands/prs/status/printPrsStatus.ts
|
|
39206
|
-
import
|
|
39265
|
+
import chalk215 from "chalk";
|
|
39207
39266
|
|
|
39208
39267
|
// src/commands/prs/status/printPrStatus.ts
|
|
39209
|
-
import
|
|
39268
|
+
import chalk214 from "chalk";
|
|
39210
39269
|
function flags(pr) {
|
|
39211
39270
|
const markers = [];
|
|
39212
39271
|
if (pr.isDraft) markers.push("draft");
|
|
39213
39272
|
if (pr.isDoNotMerge) markers.push("do not merge");
|
|
39214
39273
|
if (pr.isBot) markers.push("bot");
|
|
39215
|
-
return markers.length ? ` ${
|
|
39274
|
+
return markers.length ? ` ${chalk214.yellow(`[${markers.join(", ")}]`)}` : "";
|
|
39216
39275
|
}
|
|
39217
39276
|
function updated(pr) {
|
|
39218
39277
|
return pr.ageHours === null ? "updated unknown" : `updated ${pr.age} ago`;
|
|
@@ -39226,35 +39285,35 @@ function reviewLine(pr) {
|
|
|
39226
39285
|
function checkLines(pr) {
|
|
39227
39286
|
const lines = [];
|
|
39228
39287
|
if (pr.checks.failing.length) {
|
|
39229
|
-
lines.push(
|
|
39288
|
+
lines.push(chalk214.red(`failing: ${pr.checks.failing.join(", ")}`));
|
|
39230
39289
|
}
|
|
39231
39290
|
if (pr.checks.pending.length) {
|
|
39232
|
-
lines.push(
|
|
39291
|
+
lines.push(chalk214.yellow(`pending: ${pr.checks.pending.join(", ")}`));
|
|
39233
39292
|
}
|
|
39234
39293
|
return lines;
|
|
39235
39294
|
}
|
|
39236
39295
|
function threadsLine(pr) {
|
|
39237
39296
|
if (pr.unresolvedThreads === null) {
|
|
39238
|
-
return
|
|
39297
|
+
return chalk214.dim("unresolved comments: unknown");
|
|
39239
39298
|
}
|
|
39240
39299
|
if (pr.unresolvedThreads === 0) return null;
|
|
39241
|
-
return
|
|
39300
|
+
return chalk214.yellow(`unresolved comments: ${pr.unresolvedThreads}`);
|
|
39242
39301
|
}
|
|
39243
39302
|
function mergeableLine(pr) {
|
|
39244
|
-
if (pr.mergeable === "CONFLICTING") return
|
|
39303
|
+
if (pr.mergeable === "CONFLICTING") return chalk214.red("conflicting");
|
|
39245
39304
|
if (pr.mergeable === "MERGEABLE") return null;
|
|
39246
|
-
return
|
|
39305
|
+
return chalk214.dim(`mergeable: ${pr.mergeable.toLowerCase()}`);
|
|
39247
39306
|
}
|
|
39248
39307
|
function printPrStatus(pr) {
|
|
39249
39308
|
console.log(
|
|
39250
|
-
` ${
|
|
39309
|
+
` ${chalk214.cyan(`#${pr.number}`)} ${pr.title} ${chalk214.dim(`(${pr.author}, ${updated(pr)})`)}${flags(pr)}`
|
|
39251
39310
|
);
|
|
39252
39311
|
const details = [
|
|
39253
39312
|
reviewLine(pr),
|
|
39254
39313
|
...checkLines(pr),
|
|
39255
39314
|
threadsLine(pr),
|
|
39256
39315
|
mergeableLine(pr),
|
|
39257
|
-
|
|
39316
|
+
chalk214.dim(pr.url)
|
|
39258
39317
|
];
|
|
39259
39318
|
for (const detail of details) {
|
|
39260
39319
|
if (detail) console.log(` ${detail}`);
|
|
@@ -39265,17 +39324,17 @@ function printPrStatus(pr) {
|
|
|
39265
39324
|
function printPrsStatus(report) {
|
|
39266
39325
|
for (const repo of report.repos) {
|
|
39267
39326
|
const count10 = repo.pullRequests.length;
|
|
39268
|
-
console.log(`${
|
|
39327
|
+
console.log(`${chalk215.bold(repo.repo)} ${chalk215.dim(`(${count10} open)`)}`);
|
|
39269
39328
|
for (const pr of repo.pullRequests) {
|
|
39270
39329
|
printPrStatus(pr);
|
|
39271
39330
|
}
|
|
39272
|
-
if (count10 === 0) console.log(
|
|
39331
|
+
if (count10 === 0) console.log(chalk215.dim(" no open pull requests"));
|
|
39273
39332
|
console.log();
|
|
39274
39333
|
}
|
|
39275
39334
|
if (report.errors.length === 0) return;
|
|
39276
|
-
console.log(
|
|
39335
|
+
console.log(chalk215.bold("Errors"));
|
|
39277
39336
|
for (const failure2 of report.errors) {
|
|
39278
|
-
console.log(` ${
|
|
39337
|
+
console.log(` ${chalk215.red(failure2.repo)}: ${failure2.error}`);
|
|
39279
39338
|
}
|
|
39280
39339
|
console.log();
|
|
39281
39340
|
}
|
|
@@ -39503,10 +39562,10 @@ function registerPrs(program) {
|
|
|
39503
39562
|
}
|
|
39504
39563
|
|
|
39505
39564
|
// src/commands/ravendb/ravendbAuth.ts
|
|
39506
|
-
import
|
|
39565
|
+
import chalk221 from "chalk";
|
|
39507
39566
|
|
|
39508
39567
|
// src/shared/createConnectionAuth.ts
|
|
39509
|
-
import
|
|
39568
|
+
import chalk216 from "chalk";
|
|
39510
39569
|
function listConnections(connections, format2) {
|
|
39511
39570
|
if (connections.length === 0) {
|
|
39512
39571
|
console.log("No connections configured.");
|
|
@@ -39519,7 +39578,7 @@ function listConnections(connections, format2) {
|
|
|
39519
39578
|
function removeConnection(connections, name2, save) {
|
|
39520
39579
|
const filtered = connections.filter((c) => c.name !== name2);
|
|
39521
39580
|
if (filtered.length === connections.length) {
|
|
39522
|
-
console.error(
|
|
39581
|
+
console.error(chalk216.red(`Connection "${name2}" not found.`));
|
|
39523
39582
|
process.exit(1);
|
|
39524
39583
|
}
|
|
39525
39584
|
save(filtered);
|
|
@@ -39565,15 +39624,15 @@ function saveConnections(connections) {
|
|
|
39565
39624
|
}
|
|
39566
39625
|
|
|
39567
39626
|
// src/commands/ravendb/promptConnection.ts
|
|
39568
|
-
import
|
|
39627
|
+
import chalk219 from "chalk";
|
|
39569
39628
|
|
|
39570
39629
|
// src/commands/ravendb/selectOpSecret.ts
|
|
39571
|
-
import
|
|
39630
|
+
import chalk218 from "chalk";
|
|
39572
39631
|
import Enquirer2 from "enquirer";
|
|
39573
39632
|
|
|
39574
39633
|
// src/commands/ravendb/searchItems.ts
|
|
39575
39634
|
import { execSync as execSync51 } from "child_process";
|
|
39576
|
-
import
|
|
39635
|
+
import chalk217 from "chalk";
|
|
39577
39636
|
function opExec(args) {
|
|
39578
39637
|
return execSync51(`op ${args}`, {
|
|
39579
39638
|
encoding: "utf8",
|
|
@@ -39586,7 +39645,7 @@ function searchItems(search2) {
|
|
|
39586
39645
|
items3 = JSON.parse(opExec("item list --format=json"));
|
|
39587
39646
|
} catch {
|
|
39588
39647
|
console.error(
|
|
39589
|
-
|
|
39648
|
+
chalk217.red(
|
|
39590
39649
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
39591
39650
|
)
|
|
39592
39651
|
);
|
|
@@ -39600,7 +39659,7 @@ function getItemFields(itemId2) {
|
|
|
39600
39659
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
39601
39660
|
return item.fields.filter((f) => f.reference && f.label);
|
|
39602
39661
|
} catch {
|
|
39603
|
-
console.error(
|
|
39662
|
+
console.error(chalk217.red("Failed to get item details from 1Password."));
|
|
39604
39663
|
process.exit(1);
|
|
39605
39664
|
}
|
|
39606
39665
|
}
|
|
@@ -39619,7 +39678,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
39619
39678
|
}).run();
|
|
39620
39679
|
const items3 = searchItems(search2);
|
|
39621
39680
|
if (items3.length === 0) {
|
|
39622
|
-
console.error(
|
|
39681
|
+
console.error(chalk218.red(`No items found matching "${search2}".`));
|
|
39623
39682
|
process.exit(1);
|
|
39624
39683
|
}
|
|
39625
39684
|
const itemId2 = await selectOne(
|
|
@@ -39628,7 +39687,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
39628
39687
|
);
|
|
39629
39688
|
const fields = getItemFields(itemId2);
|
|
39630
39689
|
if (fields.length === 0) {
|
|
39631
|
-
console.error(
|
|
39690
|
+
console.error(chalk218.red("No fields with references found on this item."));
|
|
39632
39691
|
process.exit(1);
|
|
39633
39692
|
}
|
|
39634
39693
|
const ref = await selectOne(
|
|
@@ -39642,7 +39701,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
39642
39701
|
async function promptConnection(existingNames) {
|
|
39643
39702
|
const name2 = await promptInput("name", "Connection name:");
|
|
39644
39703
|
if (existingNames.includes(name2)) {
|
|
39645
|
-
console.error(
|
|
39704
|
+
console.error(chalk219.red(`Connection "${name2}" already exists.`));
|
|
39646
39705
|
process.exit(1);
|
|
39647
39706
|
}
|
|
39648
39707
|
const url = await promptInput(
|
|
@@ -39651,22 +39710,22 @@ async function promptConnection(existingNames) {
|
|
|
39651
39710
|
);
|
|
39652
39711
|
const database = await promptInput("database", "Database name:");
|
|
39653
39712
|
if (!name2 || !url || !database) {
|
|
39654
|
-
console.error(
|
|
39713
|
+
console.error(chalk219.red("All fields are required."));
|
|
39655
39714
|
process.exit(1);
|
|
39656
39715
|
}
|
|
39657
39716
|
const apiKeyRef = await selectOpSecret();
|
|
39658
|
-
console.log(
|
|
39717
|
+
console.log(chalk219.dim(`Using: ${apiKeyRef}`));
|
|
39659
39718
|
return { name: name2, url, database, apiKeyRef };
|
|
39660
39719
|
}
|
|
39661
39720
|
|
|
39662
39721
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
39663
|
-
import
|
|
39722
|
+
import chalk220 from "chalk";
|
|
39664
39723
|
function ravendbSetConnection(name2) {
|
|
39665
39724
|
const raw = loadGlobalConfigRaw();
|
|
39666
39725
|
const ravendb = raw.ravendb ?? {};
|
|
39667
39726
|
const connections = ravendb.connections ?? [];
|
|
39668
39727
|
if (!connections.some((c) => c.name === name2)) {
|
|
39669
|
-
console.error(
|
|
39728
|
+
console.error(chalk220.red(`Connection "${name2}" not found.`));
|
|
39670
39729
|
console.error(
|
|
39671
39730
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
39672
39731
|
);
|
|
@@ -39682,16 +39741,16 @@ function ravendbSetConnection(name2) {
|
|
|
39682
39741
|
var ravendbAuth = createConnectionAuth({
|
|
39683
39742
|
load: loadConnections,
|
|
39684
39743
|
save: saveConnections,
|
|
39685
|
-
format: (c) => `${
|
|
39744
|
+
format: (c) => `${chalk221.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
39686
39745
|
promptNew: promptConnection,
|
|
39687
39746
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
39688
39747
|
});
|
|
39689
39748
|
|
|
39690
39749
|
// src/commands/ravendb/ravendbCollections.ts
|
|
39691
|
-
import
|
|
39750
|
+
import chalk225 from "chalk";
|
|
39692
39751
|
|
|
39693
39752
|
// src/commands/ravendb/ravenFetch.ts
|
|
39694
|
-
import
|
|
39753
|
+
import chalk223 from "chalk";
|
|
39695
39754
|
|
|
39696
39755
|
// src/commands/ravendb/getAccessToken.ts
|
|
39697
39756
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -39728,10 +39787,10 @@ ${errorText}`
|
|
|
39728
39787
|
|
|
39729
39788
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
39730
39789
|
import { execSync as execSync52 } from "child_process";
|
|
39731
|
-
import
|
|
39790
|
+
import chalk222 from "chalk";
|
|
39732
39791
|
function resolveOpSecret(reference) {
|
|
39733
39792
|
if (!reference.startsWith("op://")) {
|
|
39734
|
-
console.error(
|
|
39793
|
+
console.error(chalk222.red(`Invalid secret reference: must start with op://`));
|
|
39735
39794
|
process.exit(1);
|
|
39736
39795
|
}
|
|
39737
39796
|
try {
|
|
@@ -39741,7 +39800,7 @@ function resolveOpSecret(reference) {
|
|
|
39741
39800
|
}).trim();
|
|
39742
39801
|
} catch {
|
|
39743
39802
|
console.error(
|
|
39744
|
-
|
|
39803
|
+
chalk222.red(
|
|
39745
39804
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
39746
39805
|
)
|
|
39747
39806
|
);
|
|
@@ -39768,7 +39827,7 @@ async function ravenFetch(connection, path110) {
|
|
|
39768
39827
|
if (!response.ok) {
|
|
39769
39828
|
const body = await response.text();
|
|
39770
39829
|
console.error(
|
|
39771
|
-
|
|
39830
|
+
chalk223.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
39772
39831
|
);
|
|
39773
39832
|
console.error(body.substring(0, 500));
|
|
39774
39833
|
process.exit(1);
|
|
@@ -39777,7 +39836,7 @@ async function ravenFetch(connection, path110) {
|
|
|
39777
39836
|
}
|
|
39778
39837
|
|
|
39779
39838
|
// src/commands/ravendb/resolveConnection.ts
|
|
39780
|
-
import
|
|
39839
|
+
import chalk224 from "chalk";
|
|
39781
39840
|
function loadRavendb() {
|
|
39782
39841
|
const raw = loadGlobalConfigRaw();
|
|
39783
39842
|
const ravendb = raw.ravendb;
|
|
@@ -39791,7 +39850,7 @@ function resolveConnection(name2) {
|
|
|
39791
39850
|
const connectionName = name2 ?? defaultConnection;
|
|
39792
39851
|
if (!connectionName) {
|
|
39793
39852
|
console.error(
|
|
39794
|
-
|
|
39853
|
+
chalk224.red(
|
|
39795
39854
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
39796
39855
|
)
|
|
39797
39856
|
);
|
|
@@ -39799,7 +39858,7 @@ function resolveConnection(name2) {
|
|
|
39799
39858
|
}
|
|
39800
39859
|
const connection = connections.find((c) => c.name === connectionName);
|
|
39801
39860
|
if (!connection) {
|
|
39802
|
-
console.error(
|
|
39861
|
+
console.error(chalk224.red(`Connection "${connectionName}" not found.`));
|
|
39803
39862
|
console.error(
|
|
39804
39863
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
39805
39864
|
);
|
|
@@ -39830,15 +39889,15 @@ async function ravendbCollections(connectionName) {
|
|
|
39830
39889
|
return;
|
|
39831
39890
|
}
|
|
39832
39891
|
for (const c of collections) {
|
|
39833
|
-
console.log(`${
|
|
39892
|
+
console.log(`${chalk225.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
39834
39893
|
}
|
|
39835
39894
|
}
|
|
39836
39895
|
|
|
39837
39896
|
// src/commands/ravendb/ravendbQuery.ts
|
|
39838
|
-
import
|
|
39897
|
+
import chalk227 from "chalk";
|
|
39839
39898
|
|
|
39840
39899
|
// src/commands/ravendb/fetchAllPages.ts
|
|
39841
|
-
import
|
|
39900
|
+
import chalk226 from "chalk";
|
|
39842
39901
|
|
|
39843
39902
|
// src/commands/ravendb/buildQueryPath.ts
|
|
39844
39903
|
function buildQueryPath(opts) {
|
|
@@ -39876,7 +39935,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
39876
39935
|
allResults.push(...results);
|
|
39877
39936
|
start2 += results.length;
|
|
39878
39937
|
process.stderr.write(
|
|
39879
|
-
`\r${
|
|
39938
|
+
`\r${chalk226.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
39880
39939
|
);
|
|
39881
39940
|
if (start2 >= totalResults) break;
|
|
39882
39941
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -39891,7 +39950,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
39891
39950
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
39892
39951
|
const resolved = resolveArgs(connectionName, collection);
|
|
39893
39952
|
if (!resolved.collection && !options2.query) {
|
|
39894
|
-
console.error(
|
|
39953
|
+
console.error(chalk227.red("Provide a collection name or --query filter."));
|
|
39895
39954
|
process.exit(1);
|
|
39896
39955
|
}
|
|
39897
39956
|
const { collection: col } = resolved;
|
|
@@ -39926,7 +39985,7 @@ function registerRavendb(program) {
|
|
|
39926
39985
|
}
|
|
39927
39986
|
|
|
39928
39987
|
// src/commands/releases/releasesConfigure.ts
|
|
39929
|
-
import
|
|
39988
|
+
import chalk229 from "chalk";
|
|
39930
39989
|
|
|
39931
39990
|
// src/commands/config/parseRepoScopeFlag.ts
|
|
39932
39991
|
var REPO_SCOPE_FLAGS = {
|
|
@@ -39997,26 +40056,26 @@ function readStreamsInput(source) {
|
|
|
39997
40056
|
}
|
|
39998
40057
|
|
|
39999
40058
|
// src/commands/releases/reportDerivedStreams.ts
|
|
40000
|
-
import
|
|
40059
|
+
import chalk228 from "chalk";
|
|
40001
40060
|
function printDerived(stream) {
|
|
40002
40061
|
const environments = stream.nodes.flatMap((n) => n.environment ?? []);
|
|
40003
40062
|
const steps = stream.nodes.filter((n) => !n.environment);
|
|
40004
40063
|
console.log(
|
|
40005
|
-
`${
|
|
40064
|
+
`${chalk228.bold(stream.name)} ${chalk228.dim(`${stream.repo} \xB7 ${stream.workflow}`)}`
|
|
40006
40065
|
);
|
|
40007
40066
|
console.log(
|
|
40008
|
-
` environments: ${environments.join(", ") ||
|
|
40067
|
+
` environments: ${environments.join(", ") || chalk228.dim("none")}`
|
|
40009
40068
|
);
|
|
40010
40069
|
if (steps.length > 0)
|
|
40011
40070
|
console.log(
|
|
40012
40071
|
` steps: ${steps.map((n) => `${n.id} [${n.kind ?? "step"}]`).join(", ")}`
|
|
40013
40072
|
);
|
|
40014
40073
|
const edges = stream.edges.map(([from, to]) => `${from} \u2192 ${to}`);
|
|
40015
|
-
console.log(` edges: ${edges.join(", ") ||
|
|
40074
|
+
console.log(` edges: ${edges.join(", ") || chalk228.dim("none")}`);
|
|
40016
40075
|
}
|
|
40017
40076
|
function reportDerivedStreams(streams, target) {
|
|
40018
40077
|
for (const stream of streams) printDerived(stream);
|
|
40019
|
-
console.log(
|
|
40078
|
+
console.log(chalk228.dim(`Written to ${target}`));
|
|
40020
40079
|
}
|
|
40021
40080
|
|
|
40022
40081
|
// src/commands/releases/withCurrentRepo.ts
|
|
@@ -40107,8 +40166,8 @@ async function writeReleaseStreams(incoming, scope) {
|
|
|
40107
40166
|
|
|
40108
40167
|
// src/commands/releases/releasesConfigure.ts
|
|
40109
40168
|
function fail11(message3, details = []) {
|
|
40110
|
-
console.error(
|
|
40111
|
-
for (const detail of details) console.error(
|
|
40169
|
+
console.error(chalk229.red(message3));
|
|
40170
|
+
for (const detail of details) console.error(chalk229.red(` ${detail}`));
|
|
40112
40171
|
process.exitCode = 1;
|
|
40113
40172
|
}
|
|
40114
40173
|
function reportWritten(incoming, target) {
|
|
@@ -40141,23 +40200,23 @@ async function releasesConfigure(options2 = {}) {
|
|
|
40141
40200
|
}
|
|
40142
40201
|
|
|
40143
40202
|
// src/commands/releases/releasesList.ts
|
|
40144
|
-
import
|
|
40203
|
+
import chalk230 from "chalk";
|
|
40145
40204
|
function describeNode(node) {
|
|
40146
40205
|
if (node.environment) return `${node.id} \u2192 ${node.environment}`;
|
|
40147
40206
|
return `${node.id} (${node.kind ?? "step"})`;
|
|
40148
40207
|
}
|
|
40149
40208
|
function printStream(stream) {
|
|
40150
|
-
console.log(`${
|
|
40151
|
-
console.log(
|
|
40209
|
+
console.log(`${chalk230.bold(stream.name)} ${chalk230.dim(stream.repo)}`);
|
|
40210
|
+
console.log(chalk230.dim(` workflow: ${stream.workflow}`));
|
|
40152
40211
|
for (const node of stream.nodes) console.log(` ${describeNode(node)}`);
|
|
40153
40212
|
for (const [from, to] of stream.edges)
|
|
40154
|
-
console.log(
|
|
40213
|
+
console.log(chalk230.dim(` ${from} \u2192 ${to}`));
|
|
40155
40214
|
}
|
|
40156
40215
|
function releasesList() {
|
|
40157
40216
|
const streams = loadConfig().releases?.streams ?? [];
|
|
40158
40217
|
if (streams.length === 0) {
|
|
40159
40218
|
console.log(
|
|
40160
|
-
|
|
40219
|
+
chalk230.dim("No release streams configured under releases.streams.")
|
|
40161
40220
|
);
|
|
40162
40221
|
return;
|
|
40163
40222
|
}
|
|
@@ -40205,7 +40264,7 @@ function coverage() {
|
|
|
40205
40264
|
|
|
40206
40265
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
40207
40266
|
import path50 from "path";
|
|
40208
|
-
import
|
|
40267
|
+
import chalk232 from "chalk";
|
|
40209
40268
|
|
|
40210
40269
|
// src/commands/lint/lint/checkFileNames.ts
|
|
40211
40270
|
import fs26 from "fs";
|
|
@@ -40285,7 +40344,7 @@ function checkFileNames() {
|
|
|
40285
40344
|
}
|
|
40286
40345
|
|
|
40287
40346
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
40288
|
-
import
|
|
40347
|
+
import chalk231 from "chalk";
|
|
40289
40348
|
|
|
40290
40349
|
// src/commands/lint/lint/applyMoves.ts
|
|
40291
40350
|
import fs27 from "fs";
|
|
@@ -40370,25 +40429,25 @@ function fixFileNameViolations(moves) {
|
|
|
40370
40429
|
const start2 = performance.now();
|
|
40371
40430
|
const project = createLintProject();
|
|
40372
40431
|
const cwd = process.cwd();
|
|
40373
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
40432
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk231.green(line)));
|
|
40374
40433
|
const ms = (performance.now() - start2).toFixed(0);
|
|
40375
|
-
console.log(
|
|
40434
|
+
console.log(chalk231.dim(` Done in ${ms}ms`));
|
|
40376
40435
|
}
|
|
40377
40436
|
|
|
40378
40437
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
40379
40438
|
function reportViolations(violations) {
|
|
40380
|
-
console.error(
|
|
40439
|
+
console.error(chalk232.red("\nFile name check failed:\n"));
|
|
40381
40440
|
console.error(
|
|
40382
|
-
|
|
40441
|
+
chalk232.red(
|
|
40383
40442
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
40384
40443
|
)
|
|
40385
40444
|
);
|
|
40386
40445
|
for (const violation of violations) {
|
|
40387
|
-
console.error(
|
|
40388
|
-
console.error(
|
|
40446
|
+
console.error(chalk232.red(` ${violation.filePath}`));
|
|
40447
|
+
console.error(chalk232.gray(` Rename to: ${violation.suggestedName}
|
|
40389
40448
|
`));
|
|
40390
40449
|
}
|
|
40391
|
-
console.error(
|
|
40450
|
+
console.error(chalk232.dim(" Run with -f to auto-fix.\n"));
|
|
40392
40451
|
}
|
|
40393
40452
|
function runFileNameCheck(fix = false) {
|
|
40394
40453
|
const violations = checkFileNames();
|
|
@@ -40417,17 +40476,17 @@ function runFileNameCheck(fix = false) {
|
|
|
40417
40476
|
import fs29 from "fs";
|
|
40418
40477
|
|
|
40419
40478
|
// src/commands/lint/shared.ts
|
|
40420
|
-
import
|
|
40479
|
+
import chalk233 from "chalk";
|
|
40421
40480
|
function reportViolations2(violations, checkName2, errorMessage3, successMessage) {
|
|
40422
40481
|
if (violations.length > 0) {
|
|
40423
|
-
console.error(
|
|
40482
|
+
console.error(chalk233.red(`
|
|
40424
40483
|
${checkName2} failed:
|
|
40425
40484
|
`));
|
|
40426
|
-
console.error(
|
|
40485
|
+
console.error(chalk233.red(` ${errorMessage3}
|
|
40427
40486
|
`));
|
|
40428
40487
|
for (const violation of violations) {
|
|
40429
|
-
console.error(
|
|
40430
|
-
console.error(
|
|
40488
|
+
console.error(chalk233.red(` ${violation.filePath}:${violation.line}`));
|
|
40489
|
+
console.error(chalk233.gray(` ${violation.content}
|
|
40431
40490
|
`));
|
|
40432
40491
|
}
|
|
40433
40492
|
return false;
|
|
@@ -40654,7 +40713,7 @@ import { execSync as execSync54 } from "child_process";
|
|
|
40654
40713
|
import { existsSync as existsSync74, mkdirSync as mkdirSync31, unlinkSync as unlinkSync17, writeFileSync as writeFileSync47 } from "fs";
|
|
40655
40714
|
import { tmpdir as tmpdir8 } from "os";
|
|
40656
40715
|
import { join as join93, resolve as resolve28 } from "path";
|
|
40657
|
-
import
|
|
40716
|
+
import chalk234 from "chalk";
|
|
40658
40717
|
|
|
40659
40718
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
40660
40719
|
var captureWindowPs1 = `
|
|
@@ -40805,22 +40864,22 @@ function screenshot(processName) {
|
|
|
40805
40864
|
const config = loadConfig();
|
|
40806
40865
|
const outputDir = resolve28(config.screenshot.outputDir);
|
|
40807
40866
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
40808
|
-
console.log(
|
|
40867
|
+
console.log(chalk234.gray(`Capturing window for process "${processName}" ...`));
|
|
40809
40868
|
try {
|
|
40810
40869
|
runPowerShellScript(processName, outputPath);
|
|
40811
|
-
console.log(
|
|
40870
|
+
console.log(chalk234.green(`Screenshot saved: ${outputPath}`));
|
|
40812
40871
|
} catch (error) {
|
|
40813
40872
|
const msg = error instanceof Error ? error.message : String(error);
|
|
40814
|
-
console.error(
|
|
40873
|
+
console.error(chalk234.red(`Failed to capture screenshot: ${msg}`));
|
|
40815
40874
|
process.exit(1);
|
|
40816
40875
|
}
|
|
40817
40876
|
}
|
|
40818
40877
|
|
|
40819
40878
|
// src/commands/statusLine.ts
|
|
40820
|
-
import
|
|
40879
|
+
import chalk237 from "chalk";
|
|
40821
40880
|
|
|
40822
40881
|
// src/commands/buildLimitsSegment.ts
|
|
40823
|
-
import
|
|
40882
|
+
import chalk235 from "chalk";
|
|
40824
40883
|
|
|
40825
40884
|
// src/shared/rateLimitLevel.ts
|
|
40826
40885
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -40858,9 +40917,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
40858
40917
|
|
|
40859
40918
|
// src/commands/buildLimitsSegment.ts
|
|
40860
40919
|
var LEVEL_COLOR = {
|
|
40861
|
-
ok:
|
|
40862
|
-
warn:
|
|
40863
|
-
over:
|
|
40920
|
+
ok: chalk235.green,
|
|
40921
|
+
warn: chalk235.yellow,
|
|
40922
|
+
over: chalk235.red
|
|
40864
40923
|
};
|
|
40865
40924
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
40866
40925
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -40956,7 +41015,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
40956
41015
|
}
|
|
40957
41016
|
|
|
40958
41017
|
// src/commands/colorizePercent.ts
|
|
40959
|
-
import
|
|
41018
|
+
import chalk236 from "chalk";
|
|
40960
41019
|
|
|
40961
41020
|
// src/shared/contextLevel.ts
|
|
40962
41021
|
var THRESHOLDS = {
|
|
@@ -40976,16 +41035,16 @@ function colorizePercent(pct) {
|
|
|
40976
41035
|
const label = `${Math.round(pct)}%`;
|
|
40977
41036
|
switch (contextLevel(pct)) {
|
|
40978
41037
|
case "red":
|
|
40979
|
-
return
|
|
41038
|
+
return chalk236.red(label);
|
|
40980
41039
|
case "yellow":
|
|
40981
|
-
return
|
|
41040
|
+
return chalk236.yellow(label);
|
|
40982
41041
|
default:
|
|
40983
41042
|
return label;
|
|
40984
41043
|
}
|
|
40985
41044
|
}
|
|
40986
41045
|
|
|
40987
41046
|
// src/commands/statusLine.ts
|
|
40988
|
-
|
|
41047
|
+
chalk237.level = 3;
|
|
40989
41048
|
function formatNumber(num) {
|
|
40990
41049
|
return num.toLocaleString("en-US");
|
|
40991
41050
|
}
|
|
@@ -40997,7 +41056,7 @@ async function statusLine() {
|
|
|
40997
41056
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
40998
41057
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
40999
41058
|
const branch2 = dir ? readGitBranch(dir) : null;
|
|
41000
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
41059
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk237.cyan(branch2)} | ` : "";
|
|
41001
41060
|
const limitsSegment = process.env.ASSIST_SESSION === "1" ? "" : buildLimitsSegment(data.rate_limits);
|
|
41002
41061
|
console.log(
|
|
41003
41062
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${limitsSegment}`
|
|
@@ -41105,7 +41164,7 @@ import { spawn as spawn10 } from "child_process";
|
|
|
41105
41164
|
import * as path53 from "path";
|
|
41106
41165
|
|
|
41107
41166
|
// src/commands/refactor/logViolations.ts
|
|
41108
|
-
import
|
|
41167
|
+
import chalk238 from "chalk";
|
|
41109
41168
|
var DEFAULT_MAX_LINES2 = 100;
|
|
41110
41169
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
41111
41170
|
if (violations.length === 0) {
|
|
@@ -41114,43 +41173,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
41114
41173
|
}
|
|
41115
41174
|
return;
|
|
41116
41175
|
}
|
|
41117
|
-
console.error(
|
|
41176
|
+
console.error(chalk238.red(`
|
|
41118
41177
|
Refactor check failed:
|
|
41119
41178
|
`));
|
|
41120
|
-
console.error(
|
|
41179
|
+
console.error(chalk238.red(` The following files exceed ${maxLines} lines:
|
|
41121
41180
|
`));
|
|
41122
41181
|
for (const violation of violations) {
|
|
41123
|
-
console.error(
|
|
41182
|
+
console.error(chalk238.red(` ${violation.file} (${violation.lines} lines)`));
|
|
41124
41183
|
}
|
|
41125
41184
|
console.error(
|
|
41126
|
-
|
|
41185
|
+
chalk238.yellow(
|
|
41127
41186
|
`
|
|
41128
41187
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
41129
41188
|
way to refactor it, ignore it with:
|
|
41130
41189
|
`
|
|
41131
41190
|
)
|
|
41132
41191
|
);
|
|
41133
|
-
console.error(
|
|
41192
|
+
console.error(chalk238.gray(` assist refactor ignore <file>
|
|
41134
41193
|
`));
|
|
41135
41194
|
if (isAgentHarness()) {
|
|
41136
|
-
console.error(
|
|
41195
|
+
console.error(chalk238.cyan(`
|
|
41137
41196
|
## Extracting Code to New Files
|
|
41138
41197
|
`));
|
|
41139
41198
|
console.error(
|
|
41140
|
-
|
|
41199
|
+
chalk238.cyan(
|
|
41141
41200
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
41142
41201
|
`
|
|
41143
41202
|
)
|
|
41144
41203
|
);
|
|
41145
41204
|
console.error(
|
|
41146
|
-
|
|
41205
|
+
chalk238.cyan(
|
|
41147
41206
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
41148
41207
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
41149
41208
|
`
|
|
41150
41209
|
)
|
|
41151
41210
|
);
|
|
41152
41211
|
console.error(
|
|
41153
|
-
|
|
41212
|
+
chalk238.cyan(
|
|
41154
41213
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
41155
41214
|
domains, move it to a common/shared folder.
|
|
41156
41215
|
`
|
|
@@ -41306,7 +41365,7 @@ async function check(pattern2, options2) {
|
|
|
41306
41365
|
|
|
41307
41366
|
// src/commands/refactor/extract.ts
|
|
41308
41367
|
import path61 from "path";
|
|
41309
|
-
import
|
|
41368
|
+
import chalk241 from "chalk";
|
|
41310
41369
|
|
|
41311
41370
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
41312
41371
|
import { SyntaxKind as SyntaxKind8 } from "ts-morph";
|
|
@@ -41914,23 +41973,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
41914
41973
|
|
|
41915
41974
|
// src/commands/refactor/extract/displayPlan.ts
|
|
41916
41975
|
import path57 from "path";
|
|
41917
|
-
import
|
|
41976
|
+
import chalk239 from "chalk";
|
|
41918
41977
|
function section(title) {
|
|
41919
41978
|
return `
|
|
41920
|
-
${
|
|
41979
|
+
${chalk239.cyan(title)}`;
|
|
41921
41980
|
}
|
|
41922
41981
|
function displayImporters(plan2, cwd) {
|
|
41923
41982
|
if (plan2.importersToUpdate.length === 0) return;
|
|
41924
41983
|
console.log(section("Update importers:"));
|
|
41925
41984
|
for (const imp of plan2.importersToUpdate) {
|
|
41926
41985
|
const rel = path57.relative(cwd, imp.file.getFilePath());
|
|
41927
|
-
console.log(` ${
|
|
41986
|
+
console.log(` ${chalk239.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
41928
41987
|
}
|
|
41929
41988
|
}
|
|
41930
41989
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
41931
|
-
console.log(
|
|
41990
|
+
console.log(chalk239.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
41932
41991
|
`));
|
|
41933
|
-
console.log(` ${
|
|
41992
|
+
console.log(` ${chalk239.cyan("Functions to move:")}`);
|
|
41934
41993
|
for (const name2 of plan2.extractedNames) {
|
|
41935
41994
|
console.log(` ${name2}`);
|
|
41936
41995
|
}
|
|
@@ -41964,7 +42023,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
41964
42023
|
|
|
41965
42024
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
41966
42025
|
import path60 from "path";
|
|
41967
|
-
import
|
|
42026
|
+
import chalk240 from "chalk";
|
|
41968
42027
|
import { Project as Project4 } from "ts-morph";
|
|
41969
42028
|
|
|
41970
42029
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -42056,7 +42115,7 @@ function loadProjectFile(file) {
|
|
|
42056
42115
|
});
|
|
42057
42116
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
42058
42117
|
if (!sourceFile) {
|
|
42059
|
-
console.log(
|
|
42118
|
+
console.log(chalk240.red(`File not found in project: ${file}`));
|
|
42060
42119
|
process.exit(1);
|
|
42061
42120
|
}
|
|
42062
42121
|
return { project, sourceFile };
|
|
@@ -42079,19 +42138,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
42079
42138
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
42080
42139
|
if (options2.apply) {
|
|
42081
42140
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
42082
|
-
console.log(
|
|
42141
|
+
console.log(chalk241.green("\nExtraction complete"));
|
|
42083
42142
|
} else {
|
|
42084
|
-
console.log(
|
|
42143
|
+
console.log(chalk241.dim("\nDry run. Use --apply to execute."));
|
|
42085
42144
|
}
|
|
42086
42145
|
}
|
|
42087
42146
|
|
|
42088
42147
|
// src/commands/refactor/ignore.ts
|
|
42089
42148
|
import fs36 from "fs";
|
|
42090
|
-
import
|
|
42149
|
+
import chalk242 from "chalk";
|
|
42091
42150
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
42092
42151
|
function ignore2(file) {
|
|
42093
42152
|
if (!fs36.existsSync(file)) {
|
|
42094
|
-
console.error(
|
|
42153
|
+
console.error(chalk242.red(`Error: File does not exist: ${file}`));
|
|
42095
42154
|
process.exit(1);
|
|
42096
42155
|
}
|
|
42097
42156
|
const content = fs36.readFileSync(file, "utf8");
|
|
@@ -42107,7 +42166,7 @@ function ignore2(file) {
|
|
|
42107
42166
|
fs36.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
42108
42167
|
}
|
|
42109
42168
|
console.log(
|
|
42110
|
-
|
|
42169
|
+
chalk242.green(
|
|
42111
42170
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
42112
42171
|
)
|
|
42113
42172
|
);
|
|
@@ -42116,12 +42175,12 @@ function ignore2(file) {
|
|
|
42116
42175
|
// src/commands/refactor/rename.ts
|
|
42117
42176
|
import fs39 from "fs";
|
|
42118
42177
|
import path67 from "path";
|
|
42119
|
-
import
|
|
42178
|
+
import chalk245 from "chalk";
|
|
42120
42179
|
|
|
42121
42180
|
// src/commands/refactor/rename/applyRename.ts
|
|
42122
42181
|
import fs38 from "fs";
|
|
42123
42182
|
import path63 from "path";
|
|
42124
|
-
import
|
|
42183
|
+
import chalk243 from "chalk";
|
|
42125
42184
|
|
|
42126
42185
|
// src/commands/refactor/restructure/computeRewrites.ts
|
|
42127
42186
|
import path62 from "path";
|
|
@@ -42227,13 +42286,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
42227
42286
|
const updatedContents = applyRewrites(rewrites);
|
|
42228
42287
|
for (const [file, content] of updatedContents) {
|
|
42229
42288
|
fs38.writeFileSync(file, content, "utf8");
|
|
42230
|
-
console.log(
|
|
42289
|
+
console.log(chalk243.cyan(` Updated imports in ${path63.relative(cwd, file)}`));
|
|
42231
42290
|
}
|
|
42232
42291
|
const destDir = path63.dirname(destPath);
|
|
42233
42292
|
if (!fs38.existsSync(destDir)) fs38.mkdirSync(destDir, { recursive: true });
|
|
42234
42293
|
fs38.renameSync(sourcePath, destPath);
|
|
42235
42294
|
console.log(
|
|
42236
|
-
|
|
42295
|
+
chalk243.white(
|
|
42237
42296
|
` Moved ${path63.relative(cwd, sourcePath)} \u2192 ${path63.relative(cwd, destPath)}`
|
|
42238
42297
|
)
|
|
42239
42298
|
);
|
|
@@ -42383,16 +42442,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
42383
42442
|
|
|
42384
42443
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
42385
42444
|
import path66 from "path";
|
|
42386
|
-
import
|
|
42445
|
+
import chalk244 from "chalk";
|
|
42387
42446
|
function printRenamePreview(rewrites, cwd) {
|
|
42388
42447
|
for (const rewrite of rewrites) {
|
|
42389
42448
|
console.log(
|
|
42390
|
-
|
|
42449
|
+
chalk244.dim(
|
|
42391
42450
|
` ${path66.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
42392
42451
|
)
|
|
42393
42452
|
);
|
|
42394
42453
|
}
|
|
42395
|
-
console.log(
|
|
42454
|
+
console.log(chalk244.dim("Dry run. Use --apply to execute."));
|
|
42396
42455
|
}
|
|
42397
42456
|
|
|
42398
42457
|
// src/commands/refactor/rename.ts
|
|
@@ -42403,20 +42462,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
42403
42462
|
const relSource = path67.relative(cwd, sourcePath);
|
|
42404
42463
|
const relDest = path67.relative(cwd, destPath);
|
|
42405
42464
|
if (!fs39.existsSync(sourcePath)) {
|
|
42406
|
-
console.log(
|
|
42465
|
+
console.log(chalk245.red(`File not found: ${source}`));
|
|
42407
42466
|
process.exit(1);
|
|
42408
42467
|
}
|
|
42409
42468
|
if (destPath !== sourcePath && fs39.existsSync(destPath)) {
|
|
42410
|
-
console.log(
|
|
42469
|
+
console.log(chalk245.red(`Destination already exists: ${destination}`));
|
|
42411
42470
|
process.exit(1);
|
|
42412
42471
|
}
|
|
42413
|
-
console.log(
|
|
42414
|
-
console.log(
|
|
42415
|
-
console.log(
|
|
42472
|
+
console.log(chalk245.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
42473
|
+
console.log(chalk245.dim("Loading project..."));
|
|
42474
|
+
console.log(chalk245.dim("Scanning imports across the project..."));
|
|
42416
42475
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
42417
42476
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
42418
42477
|
console.log(
|
|
42419
|
-
|
|
42478
|
+
chalk245.dim(
|
|
42420
42479
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
42421
42480
|
)
|
|
42422
42481
|
);
|
|
@@ -42425,11 +42484,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
42425
42484
|
return;
|
|
42426
42485
|
}
|
|
42427
42486
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
42428
|
-
console.log(
|
|
42487
|
+
console.log(chalk245.green("Done"));
|
|
42429
42488
|
}
|
|
42430
42489
|
|
|
42431
42490
|
// src/commands/refactor/renameSymbol.ts
|
|
42432
|
-
import
|
|
42491
|
+
import chalk246 from "chalk";
|
|
42433
42492
|
|
|
42434
42493
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
42435
42494
|
import { SyntaxKind as SyntaxKind19 } from "ts-morph";
|
|
@@ -42475,34 +42534,34 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
42475
42534
|
const { project, sourceFile } = loadProjectFile(file);
|
|
42476
42535
|
const symbol = findSymbol(sourceFile, oldName);
|
|
42477
42536
|
if (!symbol) {
|
|
42478
|
-
console.log(
|
|
42537
|
+
console.log(chalk246.red(`Symbol "${oldName}" not found in ${file}`));
|
|
42479
42538
|
process.exit(1);
|
|
42480
42539
|
}
|
|
42481
42540
|
const grouped = groupReferences(symbol, cwd);
|
|
42482
42541
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
42483
42542
|
console.log(
|
|
42484
|
-
|
|
42543
|
+
chalk246.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
42485
42544
|
`)
|
|
42486
42545
|
);
|
|
42487
42546
|
for (const [refFile, lines] of grouped) {
|
|
42488
42547
|
console.log(
|
|
42489
|
-
` ${
|
|
42548
|
+
` ${chalk246.dim(refFile)}: lines ${chalk246.cyan(lines.join(", "))}`
|
|
42490
42549
|
);
|
|
42491
42550
|
}
|
|
42492
42551
|
if (options2.apply) {
|
|
42493
42552
|
symbol.rename(newName);
|
|
42494
42553
|
await project.save();
|
|
42495
|
-
console.log(
|
|
42554
|
+
console.log(chalk246.green(`
|
|
42496
42555
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
42497
42556
|
} else {
|
|
42498
|
-
console.log(
|
|
42557
|
+
console.log(chalk246.dim("\nDry run. Use --apply to execute."));
|
|
42499
42558
|
}
|
|
42500
42559
|
}
|
|
42501
42560
|
|
|
42502
42561
|
// src/commands/refactor/restructure.ts
|
|
42503
42562
|
import fs41 from "fs";
|
|
42504
42563
|
import path88 from "path";
|
|
42505
|
-
import
|
|
42564
|
+
import chalk256 from "chalk";
|
|
42506
42565
|
|
|
42507
42566
|
// src/commands/refactor/restructure/buildPlan.ts
|
|
42508
42567
|
import path78 from "path";
|
|
@@ -42839,7 +42898,7 @@ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
|
|
|
42839
42898
|
}
|
|
42840
42899
|
|
|
42841
42900
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
42842
|
-
import
|
|
42901
|
+
import chalk251 from "chalk";
|
|
42843
42902
|
|
|
42844
42903
|
// src/commands/refactor/restructure/applyCommand.ts
|
|
42845
42904
|
import path79 from "path";
|
|
@@ -42850,13 +42909,13 @@ function applyCommand(scopeRoot) {
|
|
|
42850
42909
|
|
|
42851
42910
|
// src/commands/refactor/restructure/displayDrift.ts
|
|
42852
42911
|
import path80 from "path";
|
|
42853
|
-
import
|
|
42912
|
+
import chalk247 from "chalk";
|
|
42854
42913
|
var shownMoves = 20;
|
|
42855
42914
|
function displayDrift(plan2, listMoves) {
|
|
42856
42915
|
const rel = (file) => path80.relative(process.cwd(), file);
|
|
42857
42916
|
if (plan2.moves.length > 0) {
|
|
42858
42917
|
console.log(
|
|
42859
|
-
|
|
42918
|
+
chalk247.red(
|
|
42860
42919
|
`${plan2.moves.length} file(s) drift from the plan${listMoves ? ":" : "."}`
|
|
42861
42920
|
)
|
|
42862
42921
|
);
|
|
@@ -42864,17 +42923,17 @@ function displayDrift(plan2, listMoves) {
|
|
|
42864
42923
|
for (const move2 of plan2.moves.slice(0, shownMoves))
|
|
42865
42924
|
console.log(` ${rel(move2.from)} \u2192 ${rel(move2.to)}`);
|
|
42866
42925
|
if (plan2.moves.length > shownMoves)
|
|
42867
|
-
console.log(
|
|
42926
|
+
console.log(chalk247.dim(` \u2026and ${plan2.moves.length - shownMoves} more`));
|
|
42868
42927
|
}
|
|
42869
42928
|
}
|
|
42870
|
-
for (const error of plan2.errors) console.log(
|
|
42929
|
+
for (const error of plan2.errors) console.log(chalk247.red(error));
|
|
42871
42930
|
}
|
|
42872
42931
|
|
|
42873
42932
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
42874
|
-
import
|
|
42933
|
+
import chalk250 from "chalk";
|
|
42875
42934
|
|
|
42876
42935
|
// src/commands/refactor/restructure/displayDeepChains.ts
|
|
42877
|
-
import
|
|
42936
|
+
import chalk248 from "chalk";
|
|
42878
42937
|
var shownChains = 10;
|
|
42879
42938
|
function formatChain(chain2) {
|
|
42880
42939
|
const folders = chain2.folders.map((f) => `${f.name} (${f.files})`).join(" > ");
|
|
@@ -42884,28 +42943,28 @@ function displayDeepChains(chains, maxDepth) {
|
|
|
42884
42943
|
if (chains.length === 0) return;
|
|
42885
42944
|
const tooDeep = chains.reduce((sum3, c) => sum3 + c.tooDeep, 0);
|
|
42886
42945
|
console.log(
|
|
42887
|
-
|
|
42946
|
+
chalk248.red(
|
|
42888
42947
|
`
|
|
42889
42948
|
Plan exceeds restructure.maxDepth ${maxDepth}: ${tooDeep} file(s) deeper.`
|
|
42890
42949
|
)
|
|
42891
42950
|
);
|
|
42892
42951
|
console.log(
|
|
42893
|
-
|
|
42952
|
+
chalk248.bold(
|
|
42894
42953
|
"Deep chains, as folder (files beneath), most files too deep first:"
|
|
42895
42954
|
)
|
|
42896
42955
|
);
|
|
42897
42956
|
for (const chain2 of chains.slice(0, shownChains))
|
|
42898
42957
|
console.log(formatChain(chain2));
|
|
42899
42958
|
if (chains.length > shownChains)
|
|
42900
|
-
console.log(
|
|
42959
|
+
console.log(chalk248.dim(` \u2026and ${chains.length - shownChains} more`));
|
|
42901
42960
|
}
|
|
42902
42961
|
|
|
42903
42962
|
// src/commands/refactor/restructure/displayLongPaths.ts
|
|
42904
|
-
import
|
|
42963
|
+
import chalk249 from "chalk";
|
|
42905
42964
|
function displayLongPaths(longPaths, maxPathLength) {
|
|
42906
42965
|
if (longPaths.length === 0) return;
|
|
42907
42966
|
console.log(
|
|
42908
|
-
|
|
42967
|
+
chalk249.red(
|
|
42909
42968
|
`
|
|
42910
42969
|
Plan exceeds restructure.maxPathLength ${maxPathLength}: ${longPaths.length} repo-relative path(s) longer.`
|
|
42911
42970
|
)
|
|
@@ -42933,7 +42992,7 @@ function displayLayoutLimits(limits, apply) {
|
|
|
42933
42992
|
displayDeepChains(limits.chains, limits.maxDepth);
|
|
42934
42993
|
displayLongPaths(limits.longPaths, limits.maxPathLength);
|
|
42935
42994
|
console.log("");
|
|
42936
|
-
for (const line of pinSteps(apply)) console.log(
|
|
42995
|
+
for (const line of pinSteps(apply)) console.log(chalk250.yellow(line));
|
|
42937
42996
|
}
|
|
42938
42997
|
|
|
42939
42998
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
@@ -42945,14 +43004,14 @@ function checkPlan(plan2, limits) {
|
|
|
42945
43004
|
if (exceeds || plan2.errors.length > 0) process.exit(1);
|
|
42946
43005
|
if (plan2.moves.length > 0) {
|
|
42947
43006
|
console.log(
|
|
42948
|
-
|
|
43007
|
+
chalk251.yellow(
|
|
42949
43008
|
`
|
|
42950
43009
|
Run \`${apply}\` to move the files and rewrite their imports.`
|
|
42951
43010
|
)
|
|
42952
43011
|
);
|
|
42953
43012
|
process.exit(1);
|
|
42954
43013
|
}
|
|
42955
|
-
console.log(
|
|
43014
|
+
console.log(chalk251.green("Layout matches the restructure plan"));
|
|
42956
43015
|
}
|
|
42957
43016
|
|
|
42958
43017
|
// src/commands/refactor/restructure/findDeepChains.ts
|
|
@@ -43022,15 +43081,15 @@ function partitionIgnored(files) {
|
|
|
43022
43081
|
}
|
|
43023
43082
|
|
|
43024
43083
|
// src/commands/refactor/restructure/runPlan.ts
|
|
43025
|
-
import
|
|
43084
|
+
import chalk255 from "chalk";
|
|
43026
43085
|
|
|
43027
43086
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
43028
|
-
import
|
|
43087
|
+
import chalk253 from "chalk";
|
|
43029
43088
|
|
|
43030
43089
|
// src/commands/refactor/restructure/executePlan.ts
|
|
43031
43090
|
import fs40 from "fs";
|
|
43032
43091
|
import path84 from "path";
|
|
43033
|
-
import
|
|
43092
|
+
import chalk252 from "chalk";
|
|
43034
43093
|
function relPath(file) {
|
|
43035
43094
|
return path84.relative(process.cwd(), file);
|
|
43036
43095
|
}
|
|
@@ -43047,14 +43106,14 @@ function moveFiles(moves) {
|
|
|
43047
43106
|
fs40.mkdirSync(path84.dirname(move2.to), { recursive: true });
|
|
43048
43107
|
fs40.renameSync(staging, move2.to);
|
|
43049
43108
|
console.log(
|
|
43050
|
-
|
|
43109
|
+
chalk252.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
|
|
43051
43110
|
);
|
|
43052
43111
|
}
|
|
43053
43112
|
}
|
|
43054
43113
|
function removeIfEmpty(dir) {
|
|
43055
43114
|
if (!fs40.existsSync(dir) || fs40.readdirSync(dir).length > 0) return false;
|
|
43056
43115
|
fs40.rmdirSync(dir);
|
|
43057
|
-
console.log(
|
|
43116
|
+
console.log(chalk252.dim(` Removed empty directory ${relPath(dir)}`));
|
|
43058
43117
|
return true;
|
|
43059
43118
|
}
|
|
43060
43119
|
function removeEmptyDirectories(dirs, scopeRoot) {
|
|
@@ -43067,7 +43126,7 @@ function removeEmptyDirectories(dirs, scopeRoot) {
|
|
|
43067
43126
|
function executePlan(plan2) {
|
|
43068
43127
|
for (const [file, content] of applyRewrites(plan2.rewrites)) {
|
|
43069
43128
|
fs40.writeFileSync(file, content, "utf8");
|
|
43070
|
-
console.log(
|
|
43129
|
+
console.log(chalk252.cyan(` Rewrote imports in ${relPath(file)}`));
|
|
43071
43130
|
}
|
|
43072
43131
|
moveFiles(plan2.moves);
|
|
43073
43132
|
removeEmptyDirectories(
|
|
@@ -43079,17 +43138,17 @@ function executePlan(plan2) {
|
|
|
43079
43138
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
43080
43139
|
function applyPlan(plan2) {
|
|
43081
43140
|
if (plan2.errors.length > 0) {
|
|
43082
|
-
console.log(
|
|
43141
|
+
console.log(chalk253.red("\nResolve the errors above before applying."));
|
|
43083
43142
|
process.exit(1);
|
|
43084
43143
|
}
|
|
43085
|
-
console.log(
|
|
43144
|
+
console.log(chalk253.bold("\nApplying changes..."));
|
|
43086
43145
|
executePlan(plan2);
|
|
43087
|
-
console.log(
|
|
43146
|
+
console.log(chalk253.green("\nRestructuring complete"));
|
|
43088
43147
|
}
|
|
43089
43148
|
|
|
43090
43149
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
43091
43150
|
import path87 from "path";
|
|
43092
|
-
import
|
|
43151
|
+
import chalk254 from "chalk";
|
|
43093
43152
|
|
|
43094
43153
|
// src/commands/refactor/restructure/computeDepthStats.ts
|
|
43095
43154
|
import path85 from "path";
|
|
@@ -43140,17 +43199,17 @@ function relPath2(filePath) {
|
|
|
43140
43199
|
}
|
|
43141
43200
|
function displayMoves(plan2) {
|
|
43142
43201
|
if (plan2.moves.length === 0) return;
|
|
43143
|
-
console.log(
|
|
43202
|
+
console.log(chalk254.bold("\nFile moves:"));
|
|
43144
43203
|
for (const move2 of plan2.moves) {
|
|
43145
43204
|
console.log(
|
|
43146
|
-
` ${
|
|
43205
|
+
` ${chalk254.red(relPath2(move2.from))} \u2192 ${chalk254.green(relPath2(move2.to))}`
|
|
43147
43206
|
);
|
|
43148
|
-
console.log(
|
|
43207
|
+
console.log(chalk254.dim(` ${move2.reason}`));
|
|
43149
43208
|
}
|
|
43150
43209
|
}
|
|
43151
43210
|
function displayTree(plan2) {
|
|
43152
43211
|
console.log(
|
|
43153
|
-
|
|
43212
|
+
chalk254.bold(`
|
|
43154
43213
|
Resulting tree (${relPath2(plan2.scopeRoot) || "."}/):`)
|
|
43155
43214
|
);
|
|
43156
43215
|
for (const line of formatTree(plan2.targets.values(), plan2.scopeRoot))
|
|
@@ -43161,15 +43220,15 @@ function displayDepthStats(plan2) {
|
|
|
43161
43220
|
plan2.targets.values(),
|
|
43162
43221
|
plan2.scopeRoot
|
|
43163
43222
|
);
|
|
43164
|
-
console.log(
|
|
43223
|
+
console.log(chalk254.bold(`
|
|
43165
43224
|
Depth (max ${max}):`));
|
|
43166
43225
|
for (const depth of [...distribution.keys()].sort((a, b) => a - b))
|
|
43167
43226
|
console.log(` ${depth}: ${distribution.get(depth)} file(s)`);
|
|
43168
43227
|
}
|
|
43169
43228
|
function displayErrors(errors) {
|
|
43170
43229
|
if (errors.length === 0) return;
|
|
43171
|
-
console.log(
|
|
43172
|
-
for (const error of errors) console.log(
|
|
43230
|
+
console.log(chalk254.red("\nErrors:"));
|
|
43231
|
+
for (const error of errors) console.log(chalk254.red(` ${error}`));
|
|
43173
43232
|
}
|
|
43174
43233
|
function displayPlan2(plan2) {
|
|
43175
43234
|
displayMoves(plan2);
|
|
@@ -43178,7 +43237,7 @@ function displayPlan2(plan2) {
|
|
|
43178
43237
|
displayErrors(plan2.errors);
|
|
43179
43238
|
const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
|
|
43180
43239
|
console.log(
|
|
43181
|
-
|
|
43240
|
+
chalk254.dim(
|
|
43182
43241
|
`
|
|
43183
43242
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
|
|
43184
43243
|
)
|
|
@@ -43190,11 +43249,11 @@ function runPlan(plan2, limits, apply) {
|
|
|
43190
43249
|
displayPlan2(plan2);
|
|
43191
43250
|
displayLayoutLimits(limits, applyCommand(plan2.scopeRoot));
|
|
43192
43251
|
if (plan2.moves.length === 0 && plan2.errors.length === 0) {
|
|
43193
|
-
console.log(
|
|
43252
|
+
console.log(chalk255.green("No restructuring needed"));
|
|
43194
43253
|
return;
|
|
43195
43254
|
}
|
|
43196
43255
|
if (!apply) {
|
|
43197
|
-
console.log(
|
|
43256
|
+
console.log(chalk255.dim("\nDry run. Use --apply to execute."));
|
|
43198
43257
|
return;
|
|
43199
43258
|
}
|
|
43200
43259
|
applyPlan(plan2);
|
|
@@ -43204,14 +43263,14 @@ function runPlan(plan2, limits, apply) {
|
|
|
43204
43263
|
async function restructure(root2, options2 = {}) {
|
|
43205
43264
|
const scopeRoot = path88.resolve(root2 ?? "src");
|
|
43206
43265
|
if (!fs41.existsSync(scopeRoot) || !fs41.statSync(scopeRoot).isDirectory()) {
|
|
43207
|
-
console.log(
|
|
43266
|
+
console.log(chalk256.red(`Not a directory: ${root2 ?? "src"}`));
|
|
43208
43267
|
process.exit(1);
|
|
43209
43268
|
}
|
|
43210
43269
|
const found = [];
|
|
43211
43270
|
walkSourceFiles(scopeRoot, found);
|
|
43212
43271
|
const { scoped, ignored } = partitionIgnored(found);
|
|
43213
43272
|
if (scoped.length === 0) {
|
|
43214
|
-
console.log(
|
|
43273
|
+
console.log(chalk256.yellow("No files found under root"));
|
|
43215
43274
|
return;
|
|
43216
43275
|
}
|
|
43217
43276
|
const {
|
|
@@ -43284,7 +43343,7 @@ async function checkoutPrSession(number, { harness, skill } = {}) {
|
|
|
43284
43343
|
}
|
|
43285
43344
|
|
|
43286
43345
|
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
43287
|
-
import
|
|
43346
|
+
import chalk260 from "chalk";
|
|
43288
43347
|
|
|
43289
43348
|
// src/commands/config/promptConfigScope.ts
|
|
43290
43349
|
import Enquirer3 from "enquirer";
|
|
@@ -43310,7 +43369,7 @@ async function promptConfigScope() {
|
|
|
43310
43369
|
}
|
|
43311
43370
|
|
|
43312
43371
|
// src/commands/config/resolveConfigKeyAnswer.ts
|
|
43313
|
-
import
|
|
43372
|
+
import chalk257 from "chalk";
|
|
43314
43373
|
async function resolveConfigKeyAnswer(question, supplied) {
|
|
43315
43374
|
if (supplied !== void 0) return coerceSupplied(question.key, supplied);
|
|
43316
43375
|
for (; ; ) {
|
|
@@ -43318,7 +43377,7 @@ async function resolveConfigKeyAnswer(question, supplied) {
|
|
|
43318
43377
|
if (answer === "") return void 0;
|
|
43319
43378
|
const coercion = coerceCliConfigValue(question.key, answer);
|
|
43320
43379
|
if (coercion.ok) return coercion.value;
|
|
43321
|
-
console.error(
|
|
43380
|
+
console.error(chalk257.red(coercion.error));
|
|
43322
43381
|
}
|
|
43323
43382
|
}
|
|
43324
43383
|
function coerceSupplied(key, supplied) {
|
|
@@ -43398,7 +43457,7 @@ function suggestGlobs(current2, proposed) {
|
|
|
43398
43457
|
}
|
|
43399
43458
|
|
|
43400
43459
|
// src/commands/review/highLevel/parseConfigureAnswers.ts
|
|
43401
|
-
import
|
|
43460
|
+
import chalk258 from "chalk";
|
|
43402
43461
|
function parseConfigureAnswers(answers) {
|
|
43403
43462
|
const known = Object.values(highLevelConfigKeys);
|
|
43404
43463
|
const parsed = {};
|
|
@@ -43416,12 +43475,12 @@ function answersCoverEveryKey(answers) {
|
|
|
43416
43475
|
return Object.values(highLevelConfigKeys).every((key) => key in answers);
|
|
43417
43476
|
}
|
|
43418
43477
|
function exitWith(message3) {
|
|
43419
|
-
console.error(
|
|
43478
|
+
console.error(chalk258.red(`Error: ${message3}.`));
|
|
43420
43479
|
process.exit(1);
|
|
43421
43480
|
}
|
|
43422
43481
|
|
|
43423
43482
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
43424
|
-
import
|
|
43483
|
+
import chalk259 from "chalk";
|
|
43425
43484
|
|
|
43426
43485
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
43427
43486
|
function buildGlobProposalPrompt(tree) {
|
|
@@ -43517,7 +43576,7 @@ async function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
43517
43576
|
const harness = resolveOneShotHarness();
|
|
43518
43577
|
const label = harnessLabel(harness);
|
|
43519
43578
|
console.log(
|
|
43520
|
-
|
|
43579
|
+
chalk259.dim(`Asking ${label} to propose globs from the repo's own tree...`)
|
|
43521
43580
|
);
|
|
43522
43581
|
try {
|
|
43523
43582
|
const output = await runOneShotPrompt(
|
|
@@ -43528,9 +43587,9 @@ async function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
43528
43587
|
return parseProposedGlobs(output);
|
|
43529
43588
|
} catch (error) {
|
|
43530
43589
|
if (error instanceof OneShotUnavailableError)
|
|
43531
|
-
console.log(
|
|
43590
|
+
console.log(chalk259.yellow(error.message));
|
|
43532
43591
|
console.log(
|
|
43533
|
-
|
|
43592
|
+
chalk259.yellow(
|
|
43534
43593
|
`${label} proposed nothing; answer each key from its current value.`
|
|
43535
43594
|
)
|
|
43536
43595
|
);
|
|
@@ -43577,14 +43636,14 @@ async function configureHighLevelReview(options2 = {}) {
|
|
|
43577
43636
|
function reportConfigured(result) {
|
|
43578
43637
|
for (const write2 of result.written)
|
|
43579
43638
|
console.log(
|
|
43580
|
-
|
|
43639
|
+
chalk260.green(`Set ${write2.key} = ${JSON.stringify(write2.value)}`)
|
|
43581
43640
|
);
|
|
43582
|
-
for (const key of result.skipped) console.log(
|
|
43583
|
-
console.log(
|
|
43641
|
+
for (const key of result.skipped) console.log(chalk260.dim(`Left ${key} unset`));
|
|
43642
|
+
console.log(chalk260.dim(`Written to ${result.target}`));
|
|
43584
43643
|
}
|
|
43585
43644
|
|
|
43586
43645
|
// src/commands/review/highLevel/announceSavedReview.ts
|
|
43587
|
-
import
|
|
43646
|
+
import chalk261 from "chalk";
|
|
43588
43647
|
function savedMessage(subject) {
|
|
43589
43648
|
const head = subject.headSha.slice(0, 7);
|
|
43590
43649
|
if (subject.draft)
|
|
@@ -43595,10 +43654,10 @@ function savedMessage(subject) {
|
|
|
43595
43654
|
}
|
|
43596
43655
|
function announceSavedReview(subject, force) {
|
|
43597
43656
|
const message3 = savedMessage(subject);
|
|
43598
|
-
if (message3) console.log(
|
|
43657
|
+
if (message3) console.log(chalk261.dim(message3));
|
|
43599
43658
|
else if (force)
|
|
43600
43659
|
console.log(
|
|
43601
|
-
|
|
43660
|
+
chalk261.dim(
|
|
43602
43661
|
`Discarding any review saved for ${subject.headSha.slice(0, 7)} and starting fresh (--force).`
|
|
43603
43662
|
)
|
|
43604
43663
|
);
|
|
@@ -44607,7 +44666,7 @@ function gatherHighLevelSubject(prNumber, force, slicing) {
|
|
|
44607
44666
|
}
|
|
44608
44667
|
|
|
44609
44668
|
// src/commands/review/highLevel/openHighLevelOverlay.ts
|
|
44610
|
-
import { randomUUID as
|
|
44669
|
+
import { randomUUID as randomUUID23 } from "crypto";
|
|
44611
44670
|
|
|
44612
44671
|
// src/commands/review/highLevel/isHighLevelSliceCheck.ts
|
|
44613
44672
|
var SLICE_CHECKS = /* @__PURE__ */ new Set([
|
|
@@ -44948,7 +45007,7 @@ async function openHighLevelOverlay(sessionId2, subject, onRestart = async () =>
|
|
|
44948
45007
|
"High-level review",
|
|
44949
45008
|
{
|
|
44950
45009
|
sessionId: sessionId2,
|
|
44951
|
-
requestId:
|
|
45010
|
+
requestId: randomUUID23(),
|
|
44952
45011
|
title: `${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`,
|
|
44953
45012
|
body: JSON.stringify(highLevelPreviewPayload(subject)),
|
|
44954
45013
|
prNumber: subject.prNumber,
|
|
@@ -44978,55 +45037,55 @@ async function openHighLevelOverlay(sessionId2, subject, onRestart = async () =>
|
|
|
44978
45037
|
}
|
|
44979
45038
|
|
|
44980
45039
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
44981
|
-
import
|
|
45040
|
+
import chalk266 from "chalk";
|
|
44982
45041
|
|
|
44983
45042
|
// src/commands/review/highLevel/formatCriticalDiffs.ts
|
|
44984
|
-
import
|
|
45043
|
+
import chalk262 from "chalk";
|
|
44985
45044
|
var PATCH_LINE_COLOURS = {
|
|
44986
|
-
"+":
|
|
44987
|
-
"-":
|
|
44988
|
-
"@":
|
|
45045
|
+
"+": chalk262.green,
|
|
45046
|
+
"-": chalk262.red,
|
|
45047
|
+
"@": chalk262.cyan
|
|
44989
45048
|
};
|
|
44990
45049
|
function formatPatch(patch2) {
|
|
44991
45050
|
return patch2.split("\n").map(
|
|
44992
|
-
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ??
|
|
45051
|
+
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk262.dim)(line)}`
|
|
44993
45052
|
);
|
|
44994
45053
|
}
|
|
44995
45054
|
function formatDiff(diff3) {
|
|
44996
45055
|
return [
|
|
44997
45056
|
"",
|
|
44998
|
-
` ${
|
|
44999
|
-
...diff3.patch === null ? [` ${
|
|
45057
|
+
` ${chalk262.bold(diff3.path)} ${chalk262.dim(`(${diff3.status})`)} ${chalk262.green(`+${diff3.additions}`)} ${chalk262.red(`-${diff3.deletions}`)}`,
|
|
45058
|
+
...diff3.patch === null ? [` ${chalk262.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
|
|
45000
45059
|
];
|
|
45001
45060
|
}
|
|
45002
45061
|
function formatCriticalDiffs(diffs, criticalPaths) {
|
|
45003
45062
|
if (criticalPaths.length === 0)
|
|
45004
|
-
return `${
|
|
45005
|
-
${
|
|
45063
|
+
return `${chalk262.bold.underline("Critical diffs")}
|
|
45064
|
+
${chalk262.dim("review.highLevel.criticalPaths is empty, so no diffs are shown")}`;
|
|
45006
45065
|
if (diffs.length === 0)
|
|
45007
|
-
return `${
|
|
45008
|
-
${
|
|
45066
|
+
return `${chalk262.bold.underline("Critical diffs")}
|
|
45067
|
+
${chalk262.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
|
|
45009
45068
|
return [
|
|
45010
|
-
|
|
45069
|
+
chalk262.bold.underline("Critical diffs"),
|
|
45011
45070
|
...diffs.flatMap(formatDiff)
|
|
45012
45071
|
].join("\n");
|
|
45013
45072
|
}
|
|
45014
45073
|
|
|
45015
45074
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
45016
|
-
import
|
|
45075
|
+
import chalk263 from "chalk";
|
|
45017
45076
|
var MARKERS = {
|
|
45018
|
-
pass: () =>
|
|
45019
|
-
fail: () =>
|
|
45020
|
-
manual: () =>
|
|
45077
|
+
pass: () => chalk263.green("\u2714"),
|
|
45078
|
+
fail: () => chalk263.red("\u2718"),
|
|
45079
|
+
manual: () => chalk263.yellow("\u25A1")
|
|
45021
45080
|
};
|
|
45022
45081
|
function formatCheck(check2) {
|
|
45023
|
-
const title = check2.status === "fail" ?
|
|
45082
|
+
const title = check2.status === "fail" ? chalk263.red(check2.title) : chalk263.bold(check2.title);
|
|
45024
45083
|
return ` ${MARKERS[check2.status]()} ${title}
|
|
45025
|
-
${
|
|
45084
|
+
${chalk263.dim(check2.reason)}`;
|
|
45026
45085
|
}
|
|
45027
45086
|
function formatGroup(heading2, checks2) {
|
|
45028
45087
|
if (checks2.length === 0) return [];
|
|
45029
|
-
return ["",
|
|
45088
|
+
return ["", chalk263.bold.underline(heading2), ...checks2.map(formatCheck)];
|
|
45030
45089
|
}
|
|
45031
45090
|
function formatHighLevelChecklist(checks2) {
|
|
45032
45091
|
const deterministic = checks2.filter(
|
|
@@ -45035,7 +45094,7 @@ function formatHighLevelChecklist(checks2) {
|
|
|
45035
45094
|
const failed3 = deterministic.filter(
|
|
45036
45095
|
(check2) => check2.status === "fail"
|
|
45037
45096
|
).length;
|
|
45038
|
-
const summary = failed3 === 0 ?
|
|
45097
|
+
const summary = failed3 === 0 ? chalk263.green(`All ${deterministic.length} deterministic checks pass`) : chalk263.red(
|
|
45039
45098
|
`${failed3} of ${deterministic.length} deterministic checks fail`
|
|
45040
45099
|
);
|
|
45041
45100
|
return [
|
|
@@ -45050,37 +45109,37 @@ function formatHighLevelChecklist(checks2) {
|
|
|
45050
45109
|
}
|
|
45051
45110
|
|
|
45052
45111
|
// src/commands/review/highLevel/formatHighLevelStructure.ts
|
|
45053
|
-
import
|
|
45112
|
+
import chalk264 from "chalk";
|
|
45054
45113
|
var STATUS_MARKERS = {
|
|
45055
|
-
added: () =>
|
|
45056
|
-
removed: () =>
|
|
45057
|
-
modified: () =>
|
|
45114
|
+
added: () => chalk264.green("A"),
|
|
45115
|
+
removed: () => chalk264.red("D"),
|
|
45116
|
+
modified: () => chalk264.yellow("M")
|
|
45058
45117
|
};
|
|
45059
45118
|
function counts(additions, deletions) {
|
|
45060
|
-
return `${
|
|
45119
|
+
return `${chalk264.green(`+${additions}`)} ${chalk264.red(`-${deletions}`)}`;
|
|
45061
45120
|
}
|
|
45062
45121
|
function formatNode(node, indent4) {
|
|
45063
45122
|
if (node.kind === "file")
|
|
45064
45123
|
return [
|
|
45065
|
-
`${indent4}${STATUS_MARKERS[node.status]()} ${node.name} ${
|
|
45124
|
+
`${indent4}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk264.dim(counts(node.additions, node.deletions))}`
|
|
45066
45125
|
];
|
|
45067
45126
|
const dir = node;
|
|
45068
45127
|
return [
|
|
45069
|
-
`${indent4}${
|
|
45128
|
+
`${indent4}${chalk264.bold(`${dir.name}/`)} ${chalk264.dim(counts(dir.additions, dir.deletions))}`,
|
|
45070
45129
|
...dir.children.flatMap((child) => formatNode(child, `${indent4} `))
|
|
45071
45130
|
];
|
|
45072
45131
|
}
|
|
45073
45132
|
function formatHighLevelStructure(structure) {
|
|
45074
45133
|
const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
|
|
45075
45134
|
return [
|
|
45076
|
-
|
|
45135
|
+
chalk264.bold.underline("Structure"),
|
|
45077
45136
|
` ${summary}`,
|
|
45078
45137
|
...structure.tree.flatMap((node) => formatNode(node, " "))
|
|
45079
45138
|
].join("\n");
|
|
45080
45139
|
}
|
|
45081
45140
|
|
|
45082
45141
|
// src/commands/review/highLevel/formatHighLevelTests.ts
|
|
45083
|
-
import
|
|
45142
|
+
import chalk265 from "chalk";
|
|
45084
45143
|
function changeMarker(change) {
|
|
45085
45144
|
if (change === "added") return "A";
|
|
45086
45145
|
if (change === "modified") return "M";
|
|
@@ -45089,22 +45148,22 @@ function changeMarker(change) {
|
|
|
45089
45148
|
function formatNode2(node, depth) {
|
|
45090
45149
|
const indent4 = " ".repeat(depth + 2);
|
|
45091
45150
|
if (node.kind === "it")
|
|
45092
|
-
return [`${indent4}${
|
|
45151
|
+
return [`${indent4}${chalk265.dim(changeMarker(node.change))} ${node.name}`];
|
|
45093
45152
|
return [
|
|
45094
|
-
`${indent4}${
|
|
45153
|
+
`${indent4}${chalk265.bold(node.name)}`,
|
|
45095
45154
|
...node.children.flatMap((child) => formatNode2(child, depth + 1))
|
|
45096
45155
|
];
|
|
45097
45156
|
}
|
|
45098
45157
|
function formatHighLevelTests(files, testPaths) {
|
|
45099
|
-
const heading2 =
|
|
45158
|
+
const heading2 = chalk265.bold.underline("Changed tests");
|
|
45100
45159
|
if (files.length === 0)
|
|
45101
45160
|
return `${heading2}
|
|
45102
|
-
${
|
|
45161
|
+
${chalk265.dim(`no changed test in files matching ${testPaths.join(", ")}`)}`;
|
|
45103
45162
|
return [
|
|
45104
45163
|
heading2,
|
|
45105
45164
|
...files.flatMap((file) => [
|
|
45106
45165
|
"",
|
|
45107
|
-
` ${
|
|
45166
|
+
` ${chalk265.bold(file.path)} ${chalk265.dim(`(${file.status})`)}`,
|
|
45108
45167
|
...file.tests.flatMap((node) => formatNode2(node, 0))
|
|
45109
45168
|
])
|
|
45110
45169
|
].join("\n");
|
|
@@ -45118,10 +45177,10 @@ function highLevelChangedFileCount(structure) {
|
|
|
45118
45177
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
45119
45178
|
function printHighLevelChecklist(subject) {
|
|
45120
45179
|
console.log(
|
|
45121
|
-
|
|
45180
|
+
chalk266.bold(
|
|
45122
45181
|
`High-level review of ${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`
|
|
45123
45182
|
),
|
|
45124
|
-
|
|
45183
|
+
chalk266.dim(
|
|
45125
45184
|
`\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
|
|
45126
45185
|
)
|
|
45127
45186
|
);
|
|
@@ -45135,12 +45194,12 @@ function printHighLevelChecklist(subject) {
|
|
|
45135
45194
|
console.log("");
|
|
45136
45195
|
console.log(formatHighLevelTests(subject.tests, subject.testPaths));
|
|
45137
45196
|
console.log(
|
|
45138
|
-
|
|
45197
|
+
chalk266.dim(
|
|
45139
45198
|
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
45140
45199
|
)
|
|
45141
45200
|
);
|
|
45142
45201
|
console.log(
|
|
45143
|
-
|
|
45202
|
+
chalk266.dim(
|
|
45144
45203
|
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
45145
45204
|
)
|
|
45146
45205
|
);
|
|
@@ -45186,7 +45245,7 @@ async function runHighLevelReview(number, options2 = {}) {
|
|
|
45186
45245
|
|
|
45187
45246
|
// src/commands/review/reviewPr.ts
|
|
45188
45247
|
import { basename as basename28 } from "path";
|
|
45189
|
-
import
|
|
45248
|
+
import chalk269 from "chalk";
|
|
45190
45249
|
|
|
45191
45250
|
// src/commands/review/resolveSynthesisHarness.ts
|
|
45192
45251
|
var DEFAULT_SYNTHESIS_HARNESS = "claude";
|
|
@@ -46615,18 +46674,18 @@ function partitionFindingsByDiff(findings2, index3) {
|
|
|
46615
46674
|
}
|
|
46616
46675
|
|
|
46617
46676
|
// src/commands/review/warnOutOfDiff.ts
|
|
46618
|
-
import
|
|
46677
|
+
import chalk267 from "chalk";
|
|
46619
46678
|
function warnOutOfDiff(outOfDiff) {
|
|
46620
46679
|
if (outOfDiff.length === 0) return;
|
|
46621
46680
|
console.warn(
|
|
46622
|
-
|
|
46681
|
+
chalk267.yellow(
|
|
46623
46682
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
46624
46683
|
)
|
|
46625
46684
|
);
|
|
46626
46685
|
for (const finding of outOfDiff) {
|
|
46627
46686
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
46628
46687
|
console.warn(
|
|
46629
|
-
` ${
|
|
46688
|
+
` ${chalk267.yellow("\xB7")} ${finding.title} ${chalk267.dim(
|
|
46630
46689
|
`(${finding.file}:${range})`
|
|
46631
46690
|
)}`
|
|
46632
46691
|
);
|
|
@@ -46651,18 +46710,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
46651
46710
|
}
|
|
46652
46711
|
|
|
46653
46712
|
// src/commands/review/warnUnlocated.ts
|
|
46654
|
-
import
|
|
46713
|
+
import chalk268 from "chalk";
|
|
46655
46714
|
function warnUnlocated(unlocated) {
|
|
46656
46715
|
if (unlocated.length === 0) return;
|
|
46657
46716
|
console.warn(
|
|
46658
|
-
|
|
46717
|
+
chalk268.yellow(
|
|
46659
46718
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
46660
46719
|
)
|
|
46661
46720
|
);
|
|
46662
46721
|
for (const finding of unlocated) {
|
|
46663
|
-
const where = finding.location ||
|
|
46722
|
+
const where = finding.location || chalk268.dim("missing");
|
|
46664
46723
|
console.warn(
|
|
46665
|
-
` ${
|
|
46724
|
+
` ${chalk268.yellow("\xB7")} ${finding.title} ${chalk268.dim(`(${where})`)}`
|
|
46666
46725
|
);
|
|
46667
46726
|
}
|
|
46668
46727
|
}
|
|
@@ -46792,7 +46851,7 @@ function runPostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
46792
46851
|
async function reviewPr(repoRoot2, options2) {
|
|
46793
46852
|
const blocker = synthesisBlocker(resolveSynthesisHarness());
|
|
46794
46853
|
if (blocker) {
|
|
46795
|
-
console.error(
|
|
46854
|
+
console.error(chalk269.red(blocker));
|
|
46796
46855
|
process.exitCode = 1;
|
|
46797
46856
|
return;
|
|
46798
46857
|
}
|
|
@@ -46876,7 +46935,7 @@ function validateHighLevel(options2) {
|
|
|
46876
46935
|
}
|
|
46877
46936
|
|
|
46878
46937
|
// src/commands/review/sessionBlocked.ts
|
|
46879
|
-
import
|
|
46938
|
+
import chalk270 from "chalk";
|
|
46880
46939
|
|
|
46881
46940
|
// src/commands/review/reviewSessionFeature.ts
|
|
46882
46941
|
function reviewSessionFeature(options2) {
|
|
@@ -46892,7 +46951,7 @@ function sessionBlocked(options2) {
|
|
|
46892
46951
|
if (!feature) return false;
|
|
46893
46952
|
const blocker = launchBlocker(harnessAdapter(options2.harness), feature);
|
|
46894
46953
|
if (!blocker) return false;
|
|
46895
|
-
console.error(
|
|
46954
|
+
console.error(chalk270.red(blocker));
|
|
46896
46955
|
process.exitCode = 1;
|
|
46897
46956
|
return true;
|
|
46898
46957
|
}
|
|
@@ -47025,7 +47084,7 @@ function registerReview(program) {
|
|
|
47025
47084
|
|
|
47026
47085
|
// src/commands/rules/indexRules.ts
|
|
47027
47086
|
import path92 from "path";
|
|
47028
|
-
import
|
|
47087
|
+
import chalk271 from "chalk";
|
|
47029
47088
|
|
|
47030
47089
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
47031
47090
|
import { existsSync as existsSync78, readFileSync as readFileSync65, writeFileSync as writeFileSync50 } from "fs";
|
|
@@ -47112,24 +47171,24 @@ function indexRules() {
|
|
|
47112
47171
|
const rootFile = path92.relative(process.cwd(), path92.join(root2, "CLAUDE.md"));
|
|
47113
47172
|
if (directories.length === 0) {
|
|
47114
47173
|
console.log(
|
|
47115
|
-
|
|
47174
|
+
chalk271.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
47116
47175
|
);
|
|
47117
47176
|
return;
|
|
47118
47177
|
}
|
|
47119
47178
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
47120
47179
|
for (const directory of directories)
|
|
47121
|
-
console.log(` ${
|
|
47180
|
+
console.log(` ${chalk271.cyan(directory)}`);
|
|
47122
47181
|
}
|
|
47123
47182
|
|
|
47124
47183
|
// src/commands/rules/listRules.ts
|
|
47125
47184
|
import path93 from "path";
|
|
47126
|
-
import
|
|
47185
|
+
import chalk272 from "chalk";
|
|
47127
47186
|
function listRules(target, options2 = {}) {
|
|
47128
47187
|
const resolved = path93.resolve(target ?? process.cwd());
|
|
47129
47188
|
const rules2 = readScopedRules(resolved);
|
|
47130
47189
|
if (rules2.length === 0) {
|
|
47131
47190
|
const label = path93.relative(process.cwd(), resolved) || ".";
|
|
47132
|
-
console.log(
|
|
47191
|
+
console.log(chalk272.gray(`No rules in scope for ${label}`));
|
|
47133
47192
|
return;
|
|
47134
47193
|
}
|
|
47135
47194
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -47139,21 +47198,21 @@ function listRules(target, options2 = {}) {
|
|
|
47139
47198
|
if (rule.source !== shown) {
|
|
47140
47199
|
shown = rule.source;
|
|
47141
47200
|
console.log(
|
|
47142
|
-
|
|
47201
|
+
chalk272.dim(base ? path93.relative(base, rule.source) : rule.source)
|
|
47143
47202
|
);
|
|
47144
47203
|
}
|
|
47145
47204
|
console.log(
|
|
47146
|
-
` ${
|
|
47205
|
+
` ${chalk272.cyan(rule.code.padEnd(width2))} ${rule.title ?? rule.text}`
|
|
47147
47206
|
);
|
|
47148
47207
|
if (options2.full && rule.title)
|
|
47149
|
-
console.log(` ${" ".repeat(width2)} ${
|
|
47208
|
+
console.log(` ${" ".repeat(width2)} ${chalk272.dim(rule.text)}`);
|
|
47150
47209
|
}
|
|
47151
47210
|
}
|
|
47152
47211
|
|
|
47153
47212
|
// src/commands/rules/addRule.ts
|
|
47154
47213
|
import { existsSync as existsSync80, readFileSync as readFileSync67, writeFileSync as writeFileSync51 } from "fs";
|
|
47155
47214
|
import path95 from "path";
|
|
47156
|
-
import
|
|
47215
|
+
import chalk273 from "chalk";
|
|
47157
47216
|
|
|
47158
47217
|
// src/commands/rules/insertRuleBullet.ts
|
|
47159
47218
|
function ruleBullet({ code, title, text: text20 }) {
|
|
@@ -47212,7 +47271,7 @@ function read3(file) {
|
|
|
47212
47271
|
function addRule(text20, options2) {
|
|
47213
47272
|
const rule = text20.trim();
|
|
47214
47273
|
if (rule === "") {
|
|
47215
|
-
console.error(
|
|
47274
|
+
console.error(chalk273.red("Rule text is required"));
|
|
47216
47275
|
process.exitCode = 1;
|
|
47217
47276
|
return;
|
|
47218
47277
|
}
|
|
@@ -47230,14 +47289,14 @@ function addRule(text20, options2) {
|
|
|
47230
47289
|
);
|
|
47231
47290
|
updateScopedRulesIndex(root2);
|
|
47232
47291
|
console.log(
|
|
47233
|
-
`Added ${
|
|
47292
|
+
`Added ${chalk273.cyan(code)} to ${path95.relative(process.cwd(), target) || target}`
|
|
47234
47293
|
);
|
|
47235
47294
|
}
|
|
47236
47295
|
|
|
47237
47296
|
// src/commands/rules/addUserRule.ts
|
|
47238
|
-
import
|
|
47297
|
+
import chalk274 from "chalk";
|
|
47239
47298
|
function fail12(message3) {
|
|
47240
|
-
console.error(
|
|
47299
|
+
console.error(chalk274.red(message3));
|
|
47241
47300
|
process.exitCode = 1;
|
|
47242
47301
|
}
|
|
47243
47302
|
function asRules(value) {
|
|
@@ -47256,7 +47315,7 @@ async function addToUserDb(rule) {
|
|
|
47256
47315
|
rule
|
|
47257
47316
|
]);
|
|
47258
47317
|
if (!result.ok) return fail12(result.errors.join("\n"));
|
|
47259
|
-
console.log(`Added ${
|
|
47318
|
+
console.log(`Added ${chalk274.cyan(rule.title)} to advice.rules in user (db)`);
|
|
47260
47319
|
}
|
|
47261
47320
|
function addToUserNode(rule, globalConfigPath) {
|
|
47262
47321
|
const advice = loadGlobalConfigRaw(globalConfigPath).advice;
|
|
@@ -47269,7 +47328,7 @@ function addToUserNode(rule, globalConfigPath) {
|
|
|
47269
47328
|
);
|
|
47270
47329
|
if (!result.ok) return fail12(result.errors.join("\n"));
|
|
47271
47330
|
console.log(
|
|
47272
|
-
`Added ${
|
|
47331
|
+
`Added ${chalk274.cyan(rule.title)} to advice.rules in user (node) (${globalConfigFileLabel(globalConfigPath)})`
|
|
47273
47332
|
);
|
|
47274
47333
|
}
|
|
47275
47334
|
async function addUserRule(text20, options2, globalConfigPath = getGlobalConfigPath()) {
|
|
@@ -47324,7 +47383,7 @@ function registerRules(program) {
|
|
|
47324
47383
|
}
|
|
47325
47384
|
|
|
47326
47385
|
// src/commands/seq/seqAuth.ts
|
|
47327
|
-
import
|
|
47386
|
+
import chalk276 from "chalk";
|
|
47328
47387
|
|
|
47329
47388
|
// src/commands/seq/loadConnections.ts
|
|
47330
47389
|
function loadConnections2() {
|
|
@@ -47353,10 +47412,10 @@ function setDefaultConnection(name2) {
|
|
|
47353
47412
|
}
|
|
47354
47413
|
|
|
47355
47414
|
// src/shared/assertUniqueName.ts
|
|
47356
|
-
import
|
|
47415
|
+
import chalk275 from "chalk";
|
|
47357
47416
|
function assertUniqueName(existingNames, name2) {
|
|
47358
47417
|
if (existingNames.includes(name2)) {
|
|
47359
|
-
console.error(
|
|
47418
|
+
console.error(chalk275.red(`Connection "${name2}" already exists.`));
|
|
47360
47419
|
process.exit(1);
|
|
47361
47420
|
}
|
|
47362
47421
|
}
|
|
@@ -47374,16 +47433,16 @@ async function promptConnection2(existingNames) {
|
|
|
47374
47433
|
var seqAuth = createConnectionAuth({
|
|
47375
47434
|
load: loadConnections2,
|
|
47376
47435
|
save: saveConnections2,
|
|
47377
|
-
format: (c) => `${
|
|
47436
|
+
format: (c) => `${chalk276.bold(c.name)} ${c.url}`,
|
|
47378
47437
|
promptNew: promptConnection2,
|
|
47379
47438
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
47380
47439
|
});
|
|
47381
47440
|
|
|
47382
47441
|
// src/commands/seq/seqQuery.ts
|
|
47383
|
-
import
|
|
47442
|
+
import chalk280 from "chalk";
|
|
47384
47443
|
|
|
47385
47444
|
// src/commands/seq/fetchSeq.ts
|
|
47386
|
-
import
|
|
47445
|
+
import chalk277 from "chalk";
|
|
47387
47446
|
async function fetchSeq(conn, path110, params) {
|
|
47388
47447
|
const url = `${conn.url}${path110}?${params}`;
|
|
47389
47448
|
const response = await fetch(url, {
|
|
@@ -47394,7 +47453,7 @@ async function fetchSeq(conn, path110, params) {
|
|
|
47394
47453
|
});
|
|
47395
47454
|
if (!response.ok) {
|
|
47396
47455
|
const body = await response.text();
|
|
47397
|
-
console.error(
|
|
47456
|
+
console.error(chalk277.red(`Seq returned ${response.status}: ${body}`));
|
|
47398
47457
|
process.exit(1);
|
|
47399
47458
|
}
|
|
47400
47459
|
return response;
|
|
@@ -47453,23 +47512,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
47453
47512
|
}
|
|
47454
47513
|
|
|
47455
47514
|
// src/commands/seq/formatEvent.ts
|
|
47456
|
-
import
|
|
47515
|
+
import chalk278 from "chalk";
|
|
47457
47516
|
function levelColor(level) {
|
|
47458
47517
|
switch (level) {
|
|
47459
47518
|
case "Fatal":
|
|
47460
|
-
return
|
|
47519
|
+
return chalk278.bgRed.white;
|
|
47461
47520
|
case "Error":
|
|
47462
|
-
return
|
|
47521
|
+
return chalk278.red;
|
|
47463
47522
|
case "Warning":
|
|
47464
|
-
return
|
|
47523
|
+
return chalk278.yellow;
|
|
47465
47524
|
case "Information":
|
|
47466
|
-
return
|
|
47525
|
+
return chalk278.cyan;
|
|
47467
47526
|
case "Debug":
|
|
47468
|
-
return
|
|
47527
|
+
return chalk278.gray;
|
|
47469
47528
|
case "Verbose":
|
|
47470
|
-
return
|
|
47529
|
+
return chalk278.dim;
|
|
47471
47530
|
default:
|
|
47472
|
-
return
|
|
47531
|
+
return chalk278.white;
|
|
47473
47532
|
}
|
|
47474
47533
|
}
|
|
47475
47534
|
function levelAbbrev(level) {
|
|
@@ -47510,12 +47569,12 @@ function formatTimestamp(iso) {
|
|
|
47510
47569
|
function formatEvent(event) {
|
|
47511
47570
|
const color = levelColor(event.Level);
|
|
47512
47571
|
const abbrev = levelAbbrev(event.Level);
|
|
47513
|
-
const ts10 =
|
|
47572
|
+
const ts10 = chalk278.dim(formatTimestamp(event.Timestamp));
|
|
47514
47573
|
const msg = renderMessage(event);
|
|
47515
47574
|
const lines = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
|
|
47516
47575
|
if (event.Exception) {
|
|
47517
47576
|
for (const line of event.Exception.split("\n")) {
|
|
47518
|
-
lines.push(
|
|
47577
|
+
lines.push(chalk278.red(` ${line}`));
|
|
47519
47578
|
}
|
|
47520
47579
|
}
|
|
47521
47580
|
return lines.join("\n");
|
|
@@ -47548,11 +47607,11 @@ function rejectTimestampFilter(filter) {
|
|
|
47548
47607
|
}
|
|
47549
47608
|
|
|
47550
47609
|
// src/shared/resolveNamedConnection.ts
|
|
47551
|
-
import
|
|
47610
|
+
import chalk279 from "chalk";
|
|
47552
47611
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
47553
47612
|
if (connections.length === 0) {
|
|
47554
47613
|
console.error(
|
|
47555
|
-
|
|
47614
|
+
chalk279.red(
|
|
47556
47615
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
47557
47616
|
)
|
|
47558
47617
|
);
|
|
@@ -47561,7 +47620,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
47561
47620
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
47562
47621
|
const connection = connections.find((c) => c.name === target);
|
|
47563
47622
|
if (!connection) {
|
|
47564
|
-
console.error(
|
|
47623
|
+
console.error(chalk279.red(`${kind} connection "${target}" not found.`));
|
|
47565
47624
|
process.exit(1);
|
|
47566
47625
|
}
|
|
47567
47626
|
return connection;
|
|
@@ -47590,7 +47649,7 @@ async function seqQuery(filter, options2) {
|
|
|
47590
47649
|
new URLSearchParams({ filter, count: String(count10) })
|
|
47591
47650
|
);
|
|
47592
47651
|
if (events.length === 0) {
|
|
47593
|
-
console.log(
|
|
47652
|
+
console.log(chalk280.yellow("No events found."));
|
|
47594
47653
|
return;
|
|
47595
47654
|
}
|
|
47596
47655
|
if (options2.json) {
|
|
@@ -47601,11 +47660,11 @@ async function seqQuery(filter, options2) {
|
|
|
47601
47660
|
for (const event of chronological) {
|
|
47602
47661
|
console.log(formatEvent(event));
|
|
47603
47662
|
}
|
|
47604
|
-
console.log(
|
|
47663
|
+
console.log(chalk280.dim(`
|
|
47605
47664
|
${events.length} events`));
|
|
47606
47665
|
if (events.length >= count10) {
|
|
47607
47666
|
console.log(
|
|
47608
|
-
|
|
47667
|
+
chalk280.yellow(
|
|
47609
47668
|
`Results limited to ${count10}. Use --count to retrieve more.`
|
|
47610
47669
|
)
|
|
47611
47670
|
);
|
|
@@ -47613,10 +47672,10 @@ ${events.length} events`));
|
|
|
47613
47672
|
}
|
|
47614
47673
|
|
|
47615
47674
|
// src/shared/setNamedDefaultConnection.ts
|
|
47616
|
-
import
|
|
47675
|
+
import chalk281 from "chalk";
|
|
47617
47676
|
function setNamedDefaultConnection(connections, name2, setDefault, kind) {
|
|
47618
47677
|
if (!connections.find((c) => c.name === name2)) {
|
|
47619
|
-
console.error(
|
|
47678
|
+
console.error(chalk281.red(`Connection "${name2}" not found.`));
|
|
47620
47679
|
process.exit(1);
|
|
47621
47680
|
}
|
|
47622
47681
|
setDefault(name2);
|
|
@@ -47652,7 +47711,7 @@ function registerSeq(program) {
|
|
|
47652
47711
|
}
|
|
47653
47712
|
|
|
47654
47713
|
// src/commands/show.ts
|
|
47655
|
-
import { randomUUID as
|
|
47714
|
+
import { randomUUID as randomUUID24 } from "crypto";
|
|
47656
47715
|
|
|
47657
47716
|
// src/commands/sessions/shared/sendShowPreview.ts
|
|
47658
47717
|
async function sendShowPreview(request) {
|
|
@@ -47811,7 +47870,7 @@ async function show3(options2) {
|
|
|
47811
47870
|
try {
|
|
47812
47871
|
await sendShowPreview({
|
|
47813
47872
|
sessionId: sessionId2,
|
|
47814
|
-
requestId:
|
|
47873
|
+
requestId: randomUUID24(),
|
|
47815
47874
|
title: options2.title ?? "Show",
|
|
47816
47875
|
body
|
|
47817
47876
|
});
|
|
@@ -47898,7 +47957,7 @@ function registerSlack(program) {
|
|
|
47898
47957
|
}
|
|
47899
47958
|
|
|
47900
47959
|
// src/commands/sql/sqlAuth.ts
|
|
47901
|
-
import
|
|
47960
|
+
import chalk283 from "chalk";
|
|
47902
47961
|
|
|
47903
47962
|
// src/commands/sql/loadConnections.ts
|
|
47904
47963
|
function loadConnections3() {
|
|
@@ -47927,7 +47986,7 @@ function setDefaultConnection2(name2) {
|
|
|
47927
47986
|
}
|
|
47928
47987
|
|
|
47929
47988
|
// src/commands/sql/promptConnection.ts
|
|
47930
|
-
import
|
|
47989
|
+
import chalk282 from "chalk";
|
|
47931
47990
|
async function promptConnection3(existingNames) {
|
|
47932
47991
|
const name2 = await promptInput("name", "Connection name:", "default");
|
|
47933
47992
|
assertUniqueName(existingNames, name2);
|
|
@@ -47935,7 +47994,7 @@ async function promptConnection3(existingNames) {
|
|
|
47935
47994
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
47936
47995
|
const port = Number.parseInt(portStr, 10);
|
|
47937
47996
|
if (!Number.isFinite(port)) {
|
|
47938
|
-
console.error(
|
|
47997
|
+
console.error(chalk282.red(`Invalid port "${portStr}".`));
|
|
47939
47998
|
process.exit(1);
|
|
47940
47999
|
}
|
|
47941
48000
|
const user = await promptInput("user", "User:");
|
|
@@ -47948,13 +48007,13 @@ async function promptConnection3(existingNames) {
|
|
|
47948
48007
|
var sqlAuth = createConnectionAuth({
|
|
47949
48008
|
load: loadConnections3,
|
|
47950
48009
|
save: saveConnections3,
|
|
47951
|
-
format: (c) => `${
|
|
48010
|
+
format: (c) => `${chalk283.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
47952
48011
|
promptNew: promptConnection3,
|
|
47953
48012
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
47954
48013
|
});
|
|
47955
48014
|
|
|
47956
48015
|
// src/commands/sql/printTable.ts
|
|
47957
|
-
import
|
|
48016
|
+
import chalk284 from "chalk";
|
|
47958
48017
|
function formatCell(value) {
|
|
47959
48018
|
if (value === null || value === void 0) return "";
|
|
47960
48019
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -47963,7 +48022,7 @@ function formatCell(value) {
|
|
|
47963
48022
|
}
|
|
47964
48023
|
function printTable(rows) {
|
|
47965
48024
|
if (rows.length === 0) {
|
|
47966
|
-
console.log(
|
|
48025
|
+
console.log(chalk284.yellow("(no rows)"));
|
|
47967
48026
|
return;
|
|
47968
48027
|
}
|
|
47969
48028
|
const columns = Object.keys(rows[0]);
|
|
@@ -47971,13 +48030,13 @@ function printTable(rows) {
|
|
|
47971
48030
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
47972
48031
|
);
|
|
47973
48032
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
47974
|
-
console.log(
|
|
47975
|
-
console.log(
|
|
48033
|
+
console.log(chalk284.dim(header));
|
|
48034
|
+
console.log(chalk284.dim("-".repeat(header.length)));
|
|
47976
48035
|
for (const row2 of rows) {
|
|
47977
48036
|
const line = columns.map((c, i) => formatCell(row2[c]).padEnd(widths[i])).join(" ");
|
|
47978
48037
|
console.log(line);
|
|
47979
48038
|
}
|
|
47980
|
-
console.log(
|
|
48039
|
+
console.log(chalk284.dim(`
|
|
47981
48040
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
47982
48041
|
}
|
|
47983
48042
|
|
|
@@ -48037,7 +48096,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
48037
48096
|
}
|
|
48038
48097
|
|
|
48039
48098
|
// src/commands/sql/sqlMutate.ts
|
|
48040
|
-
import
|
|
48099
|
+
import chalk285 from "chalk";
|
|
48041
48100
|
|
|
48042
48101
|
// src/commands/sql/isMutation.ts
|
|
48043
48102
|
var MUTATION_KEYWORDS = [
|
|
@@ -48071,7 +48130,7 @@ function isMutation(sql33) {
|
|
|
48071
48130
|
async function sqlMutate(query, connectionName) {
|
|
48072
48131
|
if (!isMutation(query)) {
|
|
48073
48132
|
console.error(
|
|
48074
|
-
|
|
48133
|
+
chalk285.red(
|
|
48075
48134
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
48076
48135
|
)
|
|
48077
48136
|
);
|
|
@@ -48081,18 +48140,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
48081
48140
|
const pool = await sqlConnect(conn);
|
|
48082
48141
|
try {
|
|
48083
48142
|
const result = await pool.request().query(query);
|
|
48084
|
-
console.log(
|
|
48143
|
+
console.log(chalk285.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
48085
48144
|
} finally {
|
|
48086
48145
|
await pool.close();
|
|
48087
48146
|
}
|
|
48088
48147
|
}
|
|
48089
48148
|
|
|
48090
48149
|
// src/commands/sql/sqlQuery.ts
|
|
48091
|
-
import
|
|
48150
|
+
import chalk286 from "chalk";
|
|
48092
48151
|
async function sqlQuery(query, connectionName) {
|
|
48093
48152
|
if (isMutation(query)) {
|
|
48094
48153
|
console.error(
|
|
48095
|
-
|
|
48154
|
+
chalk286.red(
|
|
48096
48155
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
48097
48156
|
)
|
|
48098
48157
|
);
|
|
@@ -48107,7 +48166,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
48107
48166
|
printTable(rows);
|
|
48108
48167
|
} else {
|
|
48109
48168
|
console.log(
|
|
48110
|
-
|
|
48169
|
+
chalk286.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
48111
48170
|
);
|
|
48112
48171
|
}
|
|
48113
48172
|
} finally {
|
|
@@ -48522,7 +48581,7 @@ function syncPi(claudeDir, options2) {
|
|
|
48522
48581
|
// src/commands/sync/syncSettings.ts
|
|
48523
48582
|
import * as fs50 from "fs";
|
|
48524
48583
|
import * as path106 from "path";
|
|
48525
|
-
import
|
|
48584
|
+
import chalk287 from "chalk";
|
|
48526
48585
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
48527
48586
|
const source = path106.join(claudeDir, "settings.json");
|
|
48528
48587
|
const target = path106.join(targetBase, "settings.json");
|
|
@@ -48541,7 +48600,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
48541
48600
|
if (mergedContent !== normalizedTarget) {
|
|
48542
48601
|
if (!options2?.yes) {
|
|
48543
48602
|
console.log(
|
|
48544
|
-
|
|
48603
|
+
chalk287.yellow(
|
|
48545
48604
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
48546
48605
|
)
|
|
48547
48606
|
);
|
|
@@ -48549,7 +48608,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
48549
48608
|
printDiff(targetContent, mergedContent);
|
|
48550
48609
|
printAutoConfirmHint();
|
|
48551
48610
|
const confirm = await promptConfirm(
|
|
48552
|
-
|
|
48611
|
+
chalk287.red("Overwrite existing settings.json?"),
|
|
48553
48612
|
false
|
|
48554
48613
|
);
|
|
48555
48614
|
if (!confirm) {
|
|
@@ -48617,17 +48676,17 @@ function registerSync(program) {
|
|
|
48617
48676
|
}
|
|
48618
48677
|
|
|
48619
48678
|
// src/commands/testflight/testflightAdd.ts
|
|
48620
|
-
import
|
|
48679
|
+
import chalk288 from "chalk";
|
|
48621
48680
|
async function testflightAdd(email, options2) {
|
|
48622
48681
|
try {
|
|
48623
48682
|
const config = readTestflightConfig(loadConfig());
|
|
48624
48683
|
const { message: message3, waiting: waiting2 } = await addTesterOutcome(config, email, {
|
|
48625
48684
|
internal: options2.internal
|
|
48626
48685
|
});
|
|
48627
|
-
console.log(waiting2 ?
|
|
48686
|
+
console.log(waiting2 ? chalk288.yellow(message3) : chalk288.green(message3));
|
|
48628
48687
|
} catch (error) {
|
|
48629
48688
|
if (!(error instanceof TestflightError)) throw error;
|
|
48630
|
-
console.error(
|
|
48689
|
+
console.error(chalk288.red(error.message));
|
|
48631
48690
|
process.exit(1);
|
|
48632
48691
|
}
|
|
48633
48692
|
}
|
|
@@ -48954,7 +49013,7 @@ function askQuestion2(rl, question) {
|
|
|
48954
49013
|
}
|
|
48955
49014
|
|
|
48956
49015
|
// src/commands/transcript/configure.ts
|
|
48957
|
-
function
|
|
49016
|
+
function buildPrompt2(label, current2) {
|
|
48958
49017
|
return current2 ? `${label} [${current2}]: ` : `${label}: `;
|
|
48959
49018
|
}
|
|
48960
49019
|
function printExisting(existing) {
|
|
@@ -48967,15 +49026,15 @@ function printExisting(existing) {
|
|
|
48967
49026
|
async function promptDirectories(rl, existing) {
|
|
48968
49027
|
const vttDir = await askQuestion2(
|
|
48969
49028
|
rl,
|
|
48970
|
-
|
|
49029
|
+
buildPrompt2("VTT directory", existing?.vttDir)
|
|
48971
49030
|
);
|
|
48972
49031
|
const transcriptsDir = await askQuestion2(
|
|
48973
49032
|
rl,
|
|
48974
|
-
|
|
49033
|
+
buildPrompt2("Transcripts directory", existing?.transcriptsDir)
|
|
48975
49034
|
);
|
|
48976
49035
|
const summaryDir = await askQuestion2(
|
|
48977
49036
|
rl,
|
|
48978
|
-
|
|
49037
|
+
buildPrompt2("Summary directory", existing?.summaryDir)
|
|
48979
49038
|
);
|
|
48980
49039
|
return {
|
|
48981
49040
|
vttDir: vttDir || existing?.vttDir || "",
|
|
@@ -51556,18 +51615,18 @@ function registerRun(program) {
|
|
|
51556
51615
|
}
|
|
51557
51616
|
|
|
51558
51617
|
// src/commands/sessions/nodes/formatLink.ts
|
|
51559
|
-
import
|
|
51618
|
+
import chalk289 from "chalk";
|
|
51560
51619
|
var STATE_COLOURS = {
|
|
51561
|
-
connected:
|
|
51562
|
-
connecting:
|
|
51563
|
-
disconnected:
|
|
51564
|
-
"version-blocked":
|
|
51620
|
+
connected: chalk289.green,
|
|
51621
|
+
connecting: chalk289.yellow,
|
|
51622
|
+
disconnected: chalk289.red,
|
|
51623
|
+
"version-blocked": chalk289.red
|
|
51565
51624
|
};
|
|
51566
51625
|
function formatLink(link3) {
|
|
51567
|
-
const colour = STATE_COLOURS[link3.state] ??
|
|
51626
|
+
const colour = STATE_COLOURS[link3.state] ?? chalk289.white;
|
|
51568
51627
|
const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
|
|
51569
51628
|
const error = link3.error ? `
|
|
51570
|
-
${
|
|
51629
|
+
${chalk289.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
|
|
51571
51630
|
return ` ${link3.name} ${colour(link3.state)} ${link3.url}${peer}${error}`;
|
|
51572
51631
|
}
|
|
51573
51632
|
|
|
@@ -54778,7 +54837,7 @@ var SESSION_TITLE_MAX_LENGTH = 48;
|
|
|
54778
54837
|
async function generateSessionTitle(prompt, harness) {
|
|
54779
54838
|
try {
|
|
54780
54839
|
const stdout = await runOneShotPrompt(
|
|
54781
|
-
|
|
54840
|
+
buildPrompt3(prompt),
|
|
54782
54841
|
sessionTitleFeature,
|
|
54783
54842
|
{ harness }
|
|
54784
54843
|
);
|
|
@@ -54793,7 +54852,7 @@ function normaliseTitle(stdout) {
|
|
|
54793
54852
|
const title = (stdout.trim().split(/\r?\n/)[0] ?? "").trim().replace(/^["'`]+/, "").replace(/["'`]+$/, "").replace(/[.,:;!?]+$/, "").trim().slice(0, SESSION_TITLE_MAX_LENGTH).trim();
|
|
54794
54853
|
return title || void 0;
|
|
54795
54854
|
}
|
|
54796
|
-
function
|
|
54855
|
+
function buildPrompt3(prompt) {
|
|
54797
54856
|
return [
|
|
54798
54857
|
"Summarise the task below as a short title for a session card.",
|
|
54799
54858
|
"Rules:",
|
|
@@ -56501,7 +56560,7 @@ function codexRespawnPlan(session) {
|
|
|
56501
56560
|
}
|
|
56502
56561
|
|
|
56503
56562
|
// src/commands/sessions/daemon/interactiveRespawnPlan.ts
|
|
56504
|
-
import { randomUUID as
|
|
56563
|
+
import { randomUUID as randomUUID25 } from "crypto";
|
|
56505
56564
|
function interactiveRespawnPlan(session, resumes) {
|
|
56506
56565
|
const { claudeSessionId, cwd, initialPrompt, design, auto } = session;
|
|
56507
56566
|
if (!resumes) return null;
|
|
@@ -56521,7 +56580,7 @@ function interactiveRespawnPlan(session, resumes) {
|
|
|
56521
56580
|
return null;
|
|
56522
56581
|
}
|
|
56523
56582
|
function freshClaudePlan(session, prompt, cwd) {
|
|
56524
|
-
const claudeSessionId =
|
|
56583
|
+
const claudeSessionId = randomUUID25();
|
|
56525
56584
|
return {
|
|
56526
56585
|
spawn: () => {
|
|
56527
56586
|
session.claudeSessionId = claudeSessionId;
|
|
@@ -60761,7 +60820,7 @@ async function closeSession2() {
|
|
|
60761
60820
|
}
|
|
60762
60821
|
|
|
60763
60822
|
// src/commands/sessions/nodes/listNodes.ts
|
|
60764
|
-
import
|
|
60823
|
+
import chalk290 from "chalk";
|
|
60765
60824
|
async function nodesReport() {
|
|
60766
60825
|
const live = await queryNodes();
|
|
60767
60826
|
if (live)
|
|
@@ -60778,10 +60837,10 @@ async function listNodes(options2) {
|
|
|
60778
60837
|
console.log(JSON.stringify(report, null, 2));
|
|
60779
60838
|
return;
|
|
60780
60839
|
}
|
|
60781
|
-
console.log(`${report.local} ${
|
|
60840
|
+
console.log(`${report.local} ${chalk290.dim("(this node)")}`);
|
|
60782
60841
|
if (!report.daemonRunning)
|
|
60783
|
-
console.log(
|
|
60784
|
-
if (report.links.length === 0) console.log(
|
|
60842
|
+
console.log(chalk290.dim(" daemon not running; showing configured links"));
|
|
60843
|
+
if (report.links.length === 0) console.log(chalk290.dim(" no links"));
|
|
60785
60844
|
for (const link3 of report.links) console.log(formatLink(link3));
|
|
60786
60845
|
}
|
|
60787
60846
|
|
|
@@ -60803,7 +60862,7 @@ async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
|
60803
60862
|
}
|
|
60804
60863
|
|
|
60805
60864
|
// src/commands/sessions/nodes/printReport.ts
|
|
60806
|
-
import
|
|
60865
|
+
import chalk291 from "chalk";
|
|
60807
60866
|
function printReport(report) {
|
|
60808
60867
|
if (report.links.length === 0) {
|
|
60809
60868
|
console.log(`${report.local} has no links`);
|
|
@@ -60817,11 +60876,11 @@ function printReport(report) {
|
|
|
60817
60876
|
for (const diagnosis of report.links) printDiagnosis(diagnosis);
|
|
60818
60877
|
}
|
|
60819
60878
|
function printDiagnosis(diagnosis) {
|
|
60820
|
-
console.log(`${
|
|
60879
|
+
console.log(`${chalk291.bold(diagnosis.name)} ${chalk291.dim(diagnosis.url)}`);
|
|
60821
60880
|
for (const hop of diagnosis.hops) {
|
|
60822
|
-
const mark = hop.ok ?
|
|
60881
|
+
const mark = hop.ok ? chalk291.green("\u2713") : chalk291.red("\u2717");
|
|
60823
60882
|
console.log(` ${mark} ${hop.hop.padEnd(9)} ${hop.detail ?? hop.error}`);
|
|
60824
|
-
if (hop.remediation) console.log(` ${
|
|
60883
|
+
if (hop.remediation) console.log(` ${chalk291.yellow(hop.remediation)}`);
|
|
60825
60884
|
}
|
|
60826
60885
|
}
|
|
60827
60886
|
|
|
@@ -60893,14 +60952,14 @@ function registerDiagnoseCommands(nodes, calledBy5) {
|
|
|
60893
60952
|
}
|
|
60894
60953
|
|
|
60895
60954
|
// src/commands/sessions/nodes/linkNode.ts
|
|
60896
|
-
import
|
|
60955
|
+
import chalk294 from "chalk";
|
|
60897
60956
|
|
|
60898
60957
|
// src/commands/sessions/nodes/notifyDaemonLinks.ts
|
|
60899
|
-
import
|
|
60958
|
+
import chalk292 from "chalk";
|
|
60900
60959
|
async function notifyDaemonLinks() {
|
|
60901
60960
|
if (!await isDaemonRunning()) {
|
|
60902
60961
|
console.log(
|
|
60903
|
-
|
|
60962
|
+
chalk292.yellow(
|
|
60904
60963
|
"The sessions daemon is not running; it loads the links when it starts."
|
|
60905
60964
|
)
|
|
60906
60965
|
);
|
|
@@ -60908,11 +60967,11 @@ async function notifyDaemonLinks() {
|
|
|
60908
60967
|
}
|
|
60909
60968
|
try {
|
|
60910
60969
|
await sendToDaemonAwaitAck({ type: "reload-links" });
|
|
60911
|
-
console.log(
|
|
60970
|
+
console.log(chalk292.dim("The sessions daemon reloaded its links."));
|
|
60912
60971
|
} catch (error) {
|
|
60913
60972
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
60914
60973
|
console.log(
|
|
60915
|
-
|
|
60974
|
+
chalk292.yellow(
|
|
60916
60975
|
`Could not notify the sessions daemon (${message3}); run \`assist daemon restart\` to apply the change.`
|
|
60917
60976
|
)
|
|
60918
60977
|
);
|
|
@@ -60920,7 +60979,7 @@ async function notifyDaemonLinks() {
|
|
|
60920
60979
|
}
|
|
60921
60980
|
|
|
60922
60981
|
// src/commands/sessions/nodes/readLinks.ts
|
|
60923
|
-
import
|
|
60982
|
+
import chalk293 from "chalk";
|
|
60924
60983
|
|
|
60925
60984
|
// src/commands/sessions/nodes/writeLinks.ts
|
|
60926
60985
|
async function writeLinks(links2) {
|
|
@@ -60943,7 +61002,7 @@ async function readLinks() {
|
|
|
60943
61002
|
await writeLinks(links2);
|
|
60944
61003
|
const dropped = stored.filter((link3) => !link3.url).map((link3) => link3.name);
|
|
60945
61004
|
console.log(
|
|
60946
|
-
|
|
61005
|
+
chalk293.yellow(`Removed ${dropped.join(", ")}: ${SSH_LINK_RETIRED}`)
|
|
60947
61006
|
);
|
|
60948
61007
|
return links2;
|
|
60949
61008
|
}
|
|
@@ -60999,7 +61058,7 @@ async function linkNode(name2, url, options2) {
|
|
|
60999
61058
|
throw new Error(`${name2} is this node; link to a different node`);
|
|
61000
61059
|
const link3 = await buildLink(name2, url, options2);
|
|
61001
61060
|
await writeLinks([...others, link3]);
|
|
61002
|
-
console.log(
|
|
61061
|
+
console.log(chalk294.green(`Linked ${name2} (${link3.url})`));
|
|
61003
61062
|
await notifyDaemonLinks();
|
|
61004
61063
|
}
|
|
61005
61064
|
|
|
@@ -61182,16 +61241,16 @@ function registerPeerActionCommands(nodes, calledBy5) {
|
|
|
61182
61241
|
}
|
|
61183
61242
|
|
|
61184
61243
|
// src/commands/sessions/nodes/unlinkNode.ts
|
|
61185
|
-
import
|
|
61244
|
+
import chalk295 from "chalk";
|
|
61186
61245
|
async function unlinkNode(name2) {
|
|
61187
61246
|
const links2 = await readLinks();
|
|
61188
61247
|
const remaining = links2.filter((link3) => link3.name !== name2);
|
|
61189
61248
|
if (remaining.length === links2.length) {
|
|
61190
|
-
console.log(
|
|
61249
|
+
console.log(chalk295.yellow(`No link named ${name2}`));
|
|
61191
61250
|
return;
|
|
61192
61251
|
}
|
|
61193
61252
|
await writeLinks(remaining);
|
|
61194
|
-
console.log(
|
|
61253
|
+
console.log(chalk295.green(`Unlinked ${name2}`));
|
|
61195
61254
|
await notifyDaemonLinks();
|
|
61196
61255
|
}
|
|
61197
61256
|
|
|
@@ -61440,10 +61499,10 @@ function createProgram() {
|
|
|
61440
61499
|
}
|
|
61441
61500
|
|
|
61442
61501
|
// src/reportCliError.ts
|
|
61443
|
-
import
|
|
61502
|
+
import chalk296 from "chalk";
|
|
61444
61503
|
function reportCliError(error) {
|
|
61445
61504
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError || error instanceof MissingDatabaseUrlError) {
|
|
61446
|
-
console.error(
|
|
61505
|
+
console.error(chalk296.red(error.message));
|
|
61447
61506
|
} else {
|
|
61448
61507
|
console.error(error);
|
|
61449
61508
|
}
|