@staff0rd/assist 0.164.0 → 0.165.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/claude/commands/draft.md +3 -3
- package/dist/index.js +474 -443
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.165.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -3326,8 +3326,8 @@ function registerCommentCommands(cmd) {
|
|
|
3326
3326
|
}
|
|
3327
3327
|
|
|
3328
3328
|
// src/commands/backlog/add/index.ts
|
|
3329
|
-
import { existsSync as
|
|
3330
|
-
import
|
|
3329
|
+
import { existsSync as existsSync18 } from "fs";
|
|
3330
|
+
import chalk43 from "chalk";
|
|
3331
3331
|
|
|
3332
3332
|
// src/commands/backlog/commitBacklog.ts
|
|
3333
3333
|
import { execSync as execSync14 } from "child_process";
|
|
@@ -3343,19 +3343,58 @@ function commitBacklog(id, name) {
|
|
|
3343
3343
|
}
|
|
3344
3344
|
}
|
|
3345
3345
|
|
|
3346
|
-
// src/commands/backlog/
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3346
|
+
// src/commands/backlog/add/parseItemFile.ts
|
|
3347
|
+
import { existsSync as existsSync17, readFileSync as readFileSync14 } from "fs";
|
|
3348
|
+
import chalk42 from "chalk";
|
|
3349
|
+
import { ZodError } from "zod";
|
|
3350
|
+
var addItemSchema = backlogItemSchema.omit({ id: true, status: true });
|
|
3351
|
+
function readJsonFile(filePath) {
|
|
3352
|
+
if (!existsSync17(filePath)) {
|
|
3353
|
+
console.log(chalk42.red(`File not found: ${filePath}`));
|
|
3354
|
+
process.exitCode = 1;
|
|
3355
|
+
return void 0;
|
|
3356
|
+
}
|
|
3357
|
+
let raw;
|
|
3358
|
+
try {
|
|
3359
|
+
raw = readFileSync14(filePath, "utf-8");
|
|
3360
|
+
} catch {
|
|
3361
|
+
console.log(chalk42.red(`Failed to read file: ${filePath}`));
|
|
3362
|
+
process.exitCode = 1;
|
|
3363
|
+
return void 0;
|
|
3364
|
+
}
|
|
3365
|
+
try {
|
|
3366
|
+
return JSON.parse(raw);
|
|
3367
|
+
} catch {
|
|
3368
|
+
console.log(chalk42.red(`Invalid JSON in file: ${filePath}`));
|
|
3369
|
+
process.exitCode = 1;
|
|
3370
|
+
return void 0;
|
|
3371
|
+
}
|
|
3372
|
+
}
|
|
3373
|
+
function formatZodError(err) {
|
|
3374
|
+
if (err instanceof ZodError) {
|
|
3375
|
+
console.log(chalk42.red("Invalid backlog item schema:"));
|
|
3376
|
+
for (const issue of err.issues) {
|
|
3377
|
+
console.log(chalk42.red(` - ${issue.path.join(".")}: ${issue.message}`));
|
|
3378
|
+
}
|
|
3379
|
+
} else {
|
|
3380
|
+
console.log(chalk42.red("Invalid backlog item schema."));
|
|
3381
|
+
}
|
|
3382
|
+
}
|
|
3383
|
+
function parseItemFile(filePath) {
|
|
3384
|
+
const parsed = readJsonFile(filePath);
|
|
3385
|
+
if (parsed === void 0) return void 0;
|
|
3386
|
+
try {
|
|
3387
|
+
return addItemSchema.parse(parsed);
|
|
3388
|
+
} catch (err) {
|
|
3389
|
+
formatZodError(err);
|
|
3390
|
+
process.exitCode = 1;
|
|
3391
|
+
return void 0;
|
|
3392
|
+
}
|
|
3354
3393
|
}
|
|
3355
3394
|
|
|
3356
3395
|
// src/commands/backlog/add/shared.ts
|
|
3357
3396
|
import { spawnSync } from "child_process";
|
|
3358
|
-
import { mkdtempSync, readFileSync as
|
|
3397
|
+
import { mkdtempSync, readFileSync as readFileSync15, unlinkSync as unlinkSync4, writeFileSync as writeFileSync14 } from "fs";
|
|
3359
3398
|
import { tmpdir } from "os";
|
|
3360
3399
|
import { join as join12 } from "path";
|
|
3361
3400
|
import enquirer6 from "enquirer";
|
|
@@ -3405,7 +3444,7 @@ function openEditor() {
|
|
|
3405
3444
|
unlinkSync4(filePath);
|
|
3406
3445
|
return void 0;
|
|
3407
3446
|
}
|
|
3408
|
-
const content =
|
|
3447
|
+
const content = readFileSync15(filePath, "utf-8").trim();
|
|
3409
3448
|
unlinkSync4(filePath);
|
|
3410
3449
|
return content || void 0;
|
|
3411
3450
|
}
|
|
@@ -3424,24 +3463,15 @@ async function promptAcceptanceCriteria() {
|
|
|
3424
3463
|
}
|
|
3425
3464
|
|
|
3426
3465
|
// src/commands/backlog/add/index.ts
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
if (
|
|
3430
|
-
console.log(chalk42.red("--json requires piped input on stdin."));
|
|
3431
|
-
return;
|
|
3432
|
-
}
|
|
3433
|
-
const input = await readStdin2();
|
|
3434
|
-
const sanitised = input.replace(
|
|
3435
|
-
/"(?:[^"\\]|\\.)*"/g,
|
|
3436
|
-
(match) => match.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t")
|
|
3437
|
-
);
|
|
3438
|
-
const data = addItemSchema.parse(JSON.parse(sanitised));
|
|
3466
|
+
function addFromFile(filePath) {
|
|
3467
|
+
const data = parseItemFile(filePath);
|
|
3468
|
+
if (!data) return;
|
|
3439
3469
|
const items = loadBacklog();
|
|
3440
3470
|
const id = getNextId(items);
|
|
3441
3471
|
items.push({ ...data, id, status: "todo" });
|
|
3442
3472
|
saveBacklog(items);
|
|
3443
3473
|
commitBacklog(id, data.name);
|
|
3444
|
-
console.log(
|
|
3474
|
+
console.log(chalk43.green(`Added item #${id}: ${data.name}`));
|
|
3445
3475
|
}
|
|
3446
3476
|
async function addInteractive() {
|
|
3447
3477
|
const type = await promptType();
|
|
@@ -3460,49 +3490,49 @@ async function addInteractive() {
|
|
|
3460
3490
|
});
|
|
3461
3491
|
saveBacklog(items);
|
|
3462
3492
|
commitBacklog(id, name);
|
|
3463
|
-
console.log(
|
|
3493
|
+
console.log(chalk43.green(`Added item #${id}: ${name}`));
|
|
3464
3494
|
}
|
|
3465
3495
|
async function add(options2) {
|
|
3466
|
-
if (!
|
|
3496
|
+
if (!existsSync18(getBacklogPath())) {
|
|
3467
3497
|
console.log(
|
|
3468
|
-
|
|
3498
|
+
chalk43.yellow(
|
|
3469
3499
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
3470
3500
|
)
|
|
3471
3501
|
);
|
|
3472
3502
|
return;
|
|
3473
3503
|
}
|
|
3474
|
-
if (options2.
|
|
3475
|
-
|
|
3504
|
+
if (options2.file) {
|
|
3505
|
+
addFromFile(options2.file);
|
|
3476
3506
|
} else {
|
|
3477
3507
|
await addInteractive();
|
|
3478
3508
|
}
|
|
3479
3509
|
}
|
|
3480
3510
|
|
|
3481
3511
|
// src/commands/backlog/init/index.ts
|
|
3482
|
-
import { existsSync as
|
|
3483
|
-
import
|
|
3512
|
+
import { existsSync as existsSync19 } from "fs";
|
|
3513
|
+
import chalk44 from "chalk";
|
|
3484
3514
|
async function init6() {
|
|
3485
3515
|
const backlogPath = getBacklogPath();
|
|
3486
|
-
if (
|
|
3487
|
-
console.log(
|
|
3516
|
+
if (existsSync19(backlogPath)) {
|
|
3517
|
+
console.log(chalk44.yellow("assist.backlog.yml already exists."));
|
|
3488
3518
|
return;
|
|
3489
3519
|
}
|
|
3490
3520
|
saveBacklog([]);
|
|
3491
|
-
console.log(
|
|
3521
|
+
console.log(chalk44.green("Created assist.backlog.yml"));
|
|
3492
3522
|
}
|
|
3493
3523
|
|
|
3494
3524
|
// src/commands/backlog/list/index.ts
|
|
3495
|
-
import { existsSync as
|
|
3496
|
-
import
|
|
3525
|
+
import { existsSync as existsSync20 } from "fs";
|
|
3526
|
+
import chalk45 from "chalk";
|
|
3497
3527
|
function filterItems(items, options2) {
|
|
3498
3528
|
if (options2.status) return items.filter((i) => i.status === options2.status);
|
|
3499
3529
|
if (!options2.all) return items.filter((i) => i.status !== "done");
|
|
3500
3530
|
return items;
|
|
3501
3531
|
}
|
|
3502
3532
|
async function list2(options2) {
|
|
3503
|
-
if (!
|
|
3533
|
+
if (!existsSync20(getBacklogPath())) {
|
|
3504
3534
|
console.log(
|
|
3505
|
-
|
|
3535
|
+
chalk45.yellow(
|
|
3506
3536
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
3507
3537
|
)
|
|
3508
3538
|
);
|
|
@@ -3510,12 +3540,12 @@ async function list2(options2) {
|
|
|
3510
3540
|
}
|
|
3511
3541
|
const items = filterItems(loadBacklog(), options2);
|
|
3512
3542
|
if (items.length === 0) {
|
|
3513
|
-
console.log(
|
|
3543
|
+
console.log(chalk45.dim("Backlog is empty."));
|
|
3514
3544
|
return;
|
|
3515
3545
|
}
|
|
3516
3546
|
for (const item of items) {
|
|
3517
3547
|
console.log(
|
|
3518
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
3548
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk45.dim(`#${item.id}`)} ${item.name}${phaseLabel(item)}`
|
|
3519
3549
|
);
|
|
3520
3550
|
if (options2.verbose) {
|
|
3521
3551
|
printVerboseDetails(item);
|
|
@@ -3527,20 +3557,20 @@ async function list2(options2) {
|
|
|
3527
3557
|
function registerItemCommands(cmd) {
|
|
3528
3558
|
cmd.command("init").description("Create an empty assist.backlog.yml").action(init6);
|
|
3529
3559
|
cmd.command("list").alias("ls").description("List all backlog items").option("--status <type>", "Filter by status (todo, in-progress, done)").option("-a, --all", "Include done items").option("-v, --verbose", "Show all item details").action(list2);
|
|
3530
|
-
cmd.command("add").description("Add a new backlog item").option("--
|
|
3560
|
+
cmd.command("add").description("Add a new backlog item").option("--file <path>", "Read item as JSON from a file").action(add);
|
|
3531
3561
|
}
|
|
3532
3562
|
|
|
3533
3563
|
// src/commands/backlog/delete/index.ts
|
|
3534
|
-
import
|
|
3564
|
+
import chalk46 from "chalk";
|
|
3535
3565
|
async function del(id) {
|
|
3536
3566
|
const name = removeItem(id);
|
|
3537
3567
|
if (name) {
|
|
3538
|
-
console.log(
|
|
3568
|
+
console.log(chalk46.green(`Deleted item #${id}: ${name}`));
|
|
3539
3569
|
}
|
|
3540
3570
|
}
|
|
3541
3571
|
|
|
3542
3572
|
// src/commands/backlog/done/index.ts
|
|
3543
|
-
import
|
|
3573
|
+
import chalk47 from "chalk";
|
|
3544
3574
|
async function done(id, summary) {
|
|
3545
3575
|
const result = loadAndFindItem(id);
|
|
3546
3576
|
if (!result) return;
|
|
@@ -3550,15 +3580,15 @@ async function done(id, summary) {
|
|
|
3550
3580
|
addPhaseSummary(result.item, summary, phase);
|
|
3551
3581
|
}
|
|
3552
3582
|
saveBacklog(result.items);
|
|
3553
|
-
console.log(
|
|
3583
|
+
console.log(chalk47.green(`Completed item #${id}: ${result.item.name}`));
|
|
3554
3584
|
}
|
|
3555
3585
|
|
|
3556
3586
|
// src/commands/backlog/start/index.ts
|
|
3557
|
-
import
|
|
3587
|
+
import chalk48 from "chalk";
|
|
3558
3588
|
async function start(id) {
|
|
3559
3589
|
const name = setStatus(id, "in-progress");
|
|
3560
3590
|
if (name) {
|
|
3561
|
-
console.log(
|
|
3591
|
+
console.log(chalk48.green(`Started item #${id}: ${name}`));
|
|
3562
3592
|
}
|
|
3563
3593
|
}
|
|
3564
3594
|
|
|
@@ -3686,7 +3716,7 @@ function extractGraphqlQuery(args) {
|
|
|
3686
3716
|
}
|
|
3687
3717
|
|
|
3688
3718
|
// src/shared/loadCliReads.ts
|
|
3689
|
-
import { existsSync as
|
|
3719
|
+
import { existsSync as existsSync21, readFileSync as readFileSync16, writeFileSync as writeFileSync15 } from "fs";
|
|
3690
3720
|
import { dirname as dirname14, resolve as resolve2 } from "path";
|
|
3691
3721
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
3692
3722
|
var __filename2 = fileURLToPath4(import.meta.url);
|
|
@@ -3698,11 +3728,11 @@ var cachedLines;
|
|
|
3698
3728
|
function getCliReadsLines() {
|
|
3699
3729
|
if (cachedLines) return cachedLines;
|
|
3700
3730
|
const path50 = getCliReadsPath();
|
|
3701
|
-
if (!
|
|
3731
|
+
if (!existsSync21(path50)) {
|
|
3702
3732
|
cachedLines = [];
|
|
3703
3733
|
return cachedLines;
|
|
3704
3734
|
}
|
|
3705
|
-
cachedLines =
|
|
3735
|
+
cachedLines = readFileSync16(path50, "utf-8").split("\n").filter((line) => line.trim() !== "");
|
|
3706
3736
|
return cachedLines;
|
|
3707
3737
|
}
|
|
3708
3738
|
function loadCliReads() {
|
|
@@ -3726,39 +3756,11 @@ function findCliRead(command) {
|
|
|
3726
3756
|
return candidates.sort((a, b) => b.length - a.length).find((rc) => command === rc || command.startsWith(`${rc} `));
|
|
3727
3757
|
}
|
|
3728
3758
|
|
|
3729
|
-
// src/shared/
|
|
3730
|
-
import { existsSync as
|
|
3759
|
+
// src/shared/readSettingsPerms.ts
|
|
3760
|
+
import { existsSync as existsSync22, readFileSync as readFileSync17 } from "fs";
|
|
3731
3761
|
import { homedir as homedir3 } from "os";
|
|
3732
3762
|
import { join as join13 } from "path";
|
|
3733
|
-
|
|
3734
|
-
var denyCache;
|
|
3735
|
-
var TOOL_RE = /^(Bash|PowerShell)\((.+?)(?::.*)\)$/;
|
|
3736
|
-
function loadPrefixes(key) {
|
|
3737
|
-
const entries = collectEntries(key);
|
|
3738
|
-
return parsePrefixes(entries);
|
|
3739
|
-
}
|
|
3740
|
-
var SHELL_TOOLS = ["Bash", "PowerShell"];
|
|
3741
|
-
function shellPrefixes(map, toolName) {
|
|
3742
|
-
if (SHELL_TOOLS.includes(toolName)) {
|
|
3743
|
-
return SHELL_TOOLS.flatMap((t) => map.get(t) ?? []);
|
|
3744
|
-
}
|
|
3745
|
-
return map.get(toolName) ?? [];
|
|
3746
|
-
}
|
|
3747
|
-
function matchesAllow(toolName, command) {
|
|
3748
|
-
if (!allowCache) allowCache = loadPrefixes("allow");
|
|
3749
|
-
const prefixes = shellPrefixes(allowCache, toolName);
|
|
3750
|
-
return prefixes.find(
|
|
3751
|
-
(pfx) => command === pfx || command.startsWith(`${pfx} `)
|
|
3752
|
-
);
|
|
3753
|
-
}
|
|
3754
|
-
function matchesDeny(toolName, command) {
|
|
3755
|
-
if (!denyCache) denyCache = loadPrefixes("deny");
|
|
3756
|
-
const prefixes = shellPrefixes(denyCache, toolName);
|
|
3757
|
-
return prefixes.find(
|
|
3758
|
-
(pfx) => command === pfx || command.startsWith(`${pfx} `)
|
|
3759
|
-
);
|
|
3760
|
-
}
|
|
3761
|
-
function collectEntries(key) {
|
|
3763
|
+
function readSettingsPerms(key) {
|
|
3762
3764
|
const paths = [
|
|
3763
3765
|
join13(homedir3(), ".claude", "settings.json"),
|
|
3764
3766
|
join13(process.cwd(), ".claude", "settings.json"),
|
|
@@ -3771,24 +3773,53 @@ function collectEntries(key) {
|
|
|
3771
3773
|
return entries;
|
|
3772
3774
|
}
|
|
3773
3775
|
function readPermissionArray(filePath, key) {
|
|
3774
|
-
if (!
|
|
3776
|
+
if (!existsSync22(filePath)) return [];
|
|
3775
3777
|
try {
|
|
3776
|
-
const data = JSON.parse(
|
|
3778
|
+
const data = JSON.parse(readFileSync17(filePath, "utf-8"));
|
|
3777
3779
|
const arr = data?.permissions?.[key];
|
|
3778
3780
|
return Array.isArray(arr) ? arr.filter((e) => typeof e === "string") : [];
|
|
3779
3781
|
} catch {
|
|
3780
3782
|
return [];
|
|
3781
3783
|
}
|
|
3782
3784
|
}
|
|
3783
|
-
|
|
3785
|
+
|
|
3786
|
+
// src/shared/matchesAllow.ts
|
|
3787
|
+
var allowCache;
|
|
3788
|
+
var denyCache;
|
|
3789
|
+
var TOOL_RE = /^(Bash|PowerShell)\((.+?)(:.*)?\)$/;
|
|
3790
|
+
var SHELL_TOOLS = ["Bash", "PowerShell"];
|
|
3791
|
+
function loadPerms(key) {
|
|
3792
|
+
return parsePerms(readSettingsPerms(key));
|
|
3793
|
+
}
|
|
3794
|
+
function shellEntries(map, toolName) {
|
|
3795
|
+
if (SHELL_TOOLS.includes(toolName)) {
|
|
3796
|
+
return SHELL_TOOLS.flatMap((t) => map.get(t) ?? []);
|
|
3797
|
+
}
|
|
3798
|
+
return map.get(toolName) ?? [];
|
|
3799
|
+
}
|
|
3800
|
+
function findMatch(entries, command) {
|
|
3801
|
+
return entries.find(
|
|
3802
|
+
(e) => e.wildcard ? command === e.command || command.startsWith(`${e.command} `) : command === e.command
|
|
3803
|
+
)?.command;
|
|
3804
|
+
}
|
|
3805
|
+
function matchesAllow(toolName, command) {
|
|
3806
|
+
if (!allowCache) allowCache = loadPerms("allow");
|
|
3807
|
+
return findMatch(shellEntries(allowCache, toolName), command);
|
|
3808
|
+
}
|
|
3809
|
+
function matchesDeny(toolName, command) {
|
|
3810
|
+
if (!denyCache) denyCache = loadPerms("deny");
|
|
3811
|
+
return findMatch(shellEntries(denyCache, toolName), command);
|
|
3812
|
+
}
|
|
3813
|
+
function parsePerms(entries) {
|
|
3784
3814
|
const map = /* @__PURE__ */ new Map();
|
|
3785
3815
|
for (const entry of entries) {
|
|
3786
3816
|
const m = entry.match(TOOL_RE);
|
|
3787
3817
|
if (m) {
|
|
3788
3818
|
const tool = m[1];
|
|
3789
|
-
const
|
|
3819
|
+
const command = m[2];
|
|
3820
|
+
const wildcard = m[3] !== void 0;
|
|
3790
3821
|
const list4 = map.get(tool) ?? [];
|
|
3791
|
-
list4.push(
|
|
3822
|
+
list4.push({ command, wildcard });
|
|
3792
3823
|
map.set(tool, list4);
|
|
3793
3824
|
}
|
|
3794
3825
|
}
|
|
@@ -3977,52 +4008,52 @@ ${reasons.join("\n")}`);
|
|
|
3977
4008
|
}
|
|
3978
4009
|
|
|
3979
4010
|
// src/commands/deny/denyAdd.ts
|
|
3980
|
-
import
|
|
4011
|
+
import chalk49 from "chalk";
|
|
3981
4012
|
function denyAdd(pattern2, message) {
|
|
3982
4013
|
const config = loadProjectConfig();
|
|
3983
4014
|
const deny = config.deny ?? [];
|
|
3984
4015
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
3985
|
-
console.log(
|
|
4016
|
+
console.log(chalk49.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
3986
4017
|
return;
|
|
3987
4018
|
}
|
|
3988
4019
|
deny.push({ pattern: pattern2, message });
|
|
3989
4020
|
config.deny = deny;
|
|
3990
4021
|
saveConfig(config);
|
|
3991
|
-
console.log(
|
|
4022
|
+
console.log(chalk49.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
3992
4023
|
}
|
|
3993
4024
|
|
|
3994
4025
|
// src/commands/deny/denyList.ts
|
|
3995
|
-
import
|
|
4026
|
+
import chalk50 from "chalk";
|
|
3996
4027
|
function denyList() {
|
|
3997
4028
|
const config = loadConfig();
|
|
3998
4029
|
const deny = config.deny;
|
|
3999
4030
|
if (!deny || deny.length === 0) {
|
|
4000
|
-
console.log(
|
|
4031
|
+
console.log(chalk50.dim("No deny rules configured."));
|
|
4001
4032
|
return;
|
|
4002
4033
|
}
|
|
4003
4034
|
for (const rule of deny) {
|
|
4004
|
-
console.log(`${
|
|
4035
|
+
console.log(`${chalk50.red(rule.pattern)} \u2192 ${rule.message}`);
|
|
4005
4036
|
}
|
|
4006
4037
|
}
|
|
4007
4038
|
|
|
4008
4039
|
// src/commands/deny/denyRemove.ts
|
|
4009
|
-
import
|
|
4040
|
+
import chalk51 from "chalk";
|
|
4010
4041
|
function denyRemove(pattern2) {
|
|
4011
4042
|
const config = loadProjectConfig();
|
|
4012
4043
|
const deny = config.deny ?? [];
|
|
4013
4044
|
const index = deny.findIndex((r) => r.pattern === pattern2);
|
|
4014
4045
|
if (index === -1) {
|
|
4015
|
-
console.log(
|
|
4046
|
+
console.log(chalk51.yellow(`No deny rule found for: ${pattern2}`));
|
|
4016
4047
|
return;
|
|
4017
4048
|
}
|
|
4018
4049
|
deny.splice(index, 1);
|
|
4019
4050
|
config.deny = deny.length > 0 ? deny : void 0;
|
|
4020
4051
|
saveConfig(config);
|
|
4021
|
-
console.log(
|
|
4052
|
+
console.log(chalk51.green(`Removed deny rule: ${pattern2}`));
|
|
4022
4053
|
}
|
|
4023
4054
|
|
|
4024
4055
|
// src/commands/permitCliReads/index.ts
|
|
4025
|
-
import { existsSync as
|
|
4056
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync4, readFileSync as readFileSync18, writeFileSync as writeFileSync16 } from "fs";
|
|
4026
4057
|
import { homedir as homedir4 } from "os";
|
|
4027
4058
|
import { join as join14 } from "path";
|
|
4028
4059
|
|
|
@@ -4068,11 +4099,11 @@ function assertCliExists(cli) {
|
|
|
4068
4099
|
}
|
|
4069
4100
|
|
|
4070
4101
|
// src/commands/permitCliReads/colorize.ts
|
|
4071
|
-
import
|
|
4102
|
+
import chalk52 from "chalk";
|
|
4072
4103
|
function colorize(plainOutput) {
|
|
4073
4104
|
return plainOutput.split("\n").map((line) => {
|
|
4074
|
-
if (line.startsWith(" R ")) return
|
|
4075
|
-
if (line.startsWith(" W ")) return
|
|
4105
|
+
if (line.startsWith(" R ")) return chalk52.green(line);
|
|
4106
|
+
if (line.startsWith(" W ")) return chalk52.red(line);
|
|
4076
4107
|
return line;
|
|
4077
4108
|
}).join("\n");
|
|
4078
4109
|
}
|
|
@@ -4330,8 +4361,8 @@ function logPath(cli) {
|
|
|
4330
4361
|
}
|
|
4331
4362
|
function readCache(cli) {
|
|
4332
4363
|
const path50 = logPath(cli);
|
|
4333
|
-
if (!
|
|
4334
|
-
return
|
|
4364
|
+
if (!existsSync23(path50)) return void 0;
|
|
4365
|
+
return readFileSync18(path50, "utf-8");
|
|
4335
4366
|
}
|
|
4336
4367
|
function writeCache(cli, output) {
|
|
4337
4368
|
const dir = join14(homedir4(), ".assist");
|
|
@@ -4390,15 +4421,15 @@ function registerCliHook(program2) {
|
|
|
4390
4421
|
}
|
|
4391
4422
|
|
|
4392
4423
|
// src/commands/complexity/analyze.ts
|
|
4393
|
-
import
|
|
4424
|
+
import chalk58 from "chalk";
|
|
4394
4425
|
|
|
4395
4426
|
// src/commands/complexity/cyclomatic.ts
|
|
4396
|
-
import
|
|
4427
|
+
import chalk54 from "chalk";
|
|
4397
4428
|
|
|
4398
4429
|
// src/commands/complexity/shared/index.ts
|
|
4399
4430
|
import fs12 from "fs";
|
|
4400
4431
|
import path20 from "path";
|
|
4401
|
-
import
|
|
4432
|
+
import chalk53 from "chalk";
|
|
4402
4433
|
import ts5 from "typescript";
|
|
4403
4434
|
|
|
4404
4435
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -4644,7 +4675,7 @@ function createSourceFromFile(filePath) {
|
|
|
4644
4675
|
function withSourceFiles(pattern2, callback) {
|
|
4645
4676
|
const files = findSourceFiles2(pattern2);
|
|
4646
4677
|
if (files.length === 0) {
|
|
4647
|
-
console.log(
|
|
4678
|
+
console.log(chalk53.yellow("No files found matching pattern"));
|
|
4648
4679
|
return void 0;
|
|
4649
4680
|
}
|
|
4650
4681
|
return callback(files);
|
|
@@ -4677,11 +4708,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4677
4708
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
4678
4709
|
for (const { file, name, complexity } of results) {
|
|
4679
4710
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
4680
|
-
const color = exceedsThreshold ?
|
|
4681
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
4711
|
+
const color = exceedsThreshold ? chalk54.red : chalk54.white;
|
|
4712
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk54.cyan(complexity)}`);
|
|
4682
4713
|
}
|
|
4683
4714
|
console.log(
|
|
4684
|
-
|
|
4715
|
+
chalk54.dim(
|
|
4685
4716
|
`
|
|
4686
4717
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
4687
4718
|
)
|
|
@@ -4693,7 +4724,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
4693
4724
|
}
|
|
4694
4725
|
|
|
4695
4726
|
// src/commands/complexity/halstead.ts
|
|
4696
|
-
import
|
|
4727
|
+
import chalk55 from "chalk";
|
|
4697
4728
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
4698
4729
|
withSourceFiles(pattern2, (files) => {
|
|
4699
4730
|
const results = [];
|
|
@@ -4708,13 +4739,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4708
4739
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
4709
4740
|
for (const { file, name, metrics } of results) {
|
|
4710
4741
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
4711
|
-
const color = exceedsThreshold ?
|
|
4742
|
+
const color = exceedsThreshold ? chalk55.red : chalk55.white;
|
|
4712
4743
|
console.log(
|
|
4713
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
4744
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk55.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk55.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk55.magenta(metrics.effort.toFixed(1))}`
|
|
4714
4745
|
);
|
|
4715
4746
|
}
|
|
4716
4747
|
console.log(
|
|
4717
|
-
|
|
4748
|
+
chalk55.dim(
|
|
4718
4749
|
`
|
|
4719
4750
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
4720
4751
|
)
|
|
@@ -4729,28 +4760,28 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
4729
4760
|
import fs13 from "fs";
|
|
4730
4761
|
|
|
4731
4762
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
4732
|
-
import
|
|
4763
|
+
import chalk56 from "chalk";
|
|
4733
4764
|
function displayMaintainabilityResults(results, threshold) {
|
|
4734
4765
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
4735
4766
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
4736
|
-
console.log(
|
|
4767
|
+
console.log(chalk56.green("All files pass maintainability threshold"));
|
|
4737
4768
|
} else {
|
|
4738
4769
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
4739
|
-
const color = threshold !== void 0 ?
|
|
4770
|
+
const color = threshold !== void 0 ? chalk56.red : chalk56.white;
|
|
4740
4771
|
console.log(
|
|
4741
|
-
`${color(file)} \u2192 avg: ${
|
|
4772
|
+
`${color(file)} \u2192 avg: ${chalk56.cyan(avgMaintainability.toFixed(1))}, min: ${chalk56.yellow(minMaintainability.toFixed(1))}`
|
|
4742
4773
|
);
|
|
4743
4774
|
}
|
|
4744
4775
|
}
|
|
4745
|
-
console.log(
|
|
4776
|
+
console.log(chalk56.dim(`
|
|
4746
4777
|
Analyzed ${results.length} files`));
|
|
4747
4778
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
4748
4779
|
console.error(
|
|
4749
|
-
|
|
4780
|
+
chalk56.red(
|
|
4750
4781
|
`
|
|
4751
4782
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
4752
4783
|
|
|
4753
|
-
\u26A0\uFE0F ${
|
|
4784
|
+
\u26A0\uFE0F ${chalk56.bold("Diagnose and fix one file at a time")} \u2014 do not investigate or fix multiple files in parallel. Run 'assist complexity <file>' to see all metrics. For larger files, start by extracting responsibilities into smaller files.`
|
|
4754
4785
|
)
|
|
4755
4786
|
);
|
|
4756
4787
|
process.exit(1);
|
|
@@ -4807,7 +4838,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4807
4838
|
|
|
4808
4839
|
// src/commands/complexity/sloc.ts
|
|
4809
4840
|
import fs14 from "fs";
|
|
4810
|
-
import
|
|
4841
|
+
import chalk57 from "chalk";
|
|
4811
4842
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
4812
4843
|
withSourceFiles(pattern2, (files) => {
|
|
4813
4844
|
const results = [];
|
|
@@ -4823,12 +4854,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4823
4854
|
results.sort((a, b) => b.lines - a.lines);
|
|
4824
4855
|
for (const { file, lines } of results) {
|
|
4825
4856
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
4826
|
-
const color = exceedsThreshold ?
|
|
4827
|
-
console.log(`${color(file)} \u2192 ${
|
|
4857
|
+
const color = exceedsThreshold ? chalk57.red : chalk57.white;
|
|
4858
|
+
console.log(`${color(file)} \u2192 ${chalk57.cyan(lines)} lines`);
|
|
4828
4859
|
}
|
|
4829
4860
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
4830
4861
|
console.log(
|
|
4831
|
-
|
|
4862
|
+
chalk57.dim(`
|
|
4832
4863
|
Total: ${total} lines across ${files.length} files`)
|
|
4833
4864
|
);
|
|
4834
4865
|
if (hasViolation) {
|
|
@@ -4842,21 +4873,21 @@ async function analyze(pattern2) {
|
|
|
4842
4873
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
4843
4874
|
const files = findSourceFiles2(searchPattern);
|
|
4844
4875
|
if (files.length === 0) {
|
|
4845
|
-
console.log(
|
|
4876
|
+
console.log(chalk58.yellow("No files found matching pattern"));
|
|
4846
4877
|
return;
|
|
4847
4878
|
}
|
|
4848
4879
|
if (files.length === 1) {
|
|
4849
4880
|
const file = files[0];
|
|
4850
|
-
console.log(
|
|
4881
|
+
console.log(chalk58.bold.underline("SLOC"));
|
|
4851
4882
|
await sloc(file);
|
|
4852
4883
|
console.log();
|
|
4853
|
-
console.log(
|
|
4884
|
+
console.log(chalk58.bold.underline("Cyclomatic Complexity"));
|
|
4854
4885
|
await cyclomatic(file);
|
|
4855
4886
|
console.log();
|
|
4856
|
-
console.log(
|
|
4887
|
+
console.log(chalk58.bold.underline("Halstead Metrics"));
|
|
4857
4888
|
await halstead(file);
|
|
4858
4889
|
console.log();
|
|
4859
|
-
console.log(
|
|
4890
|
+
console.log(chalk58.bold.underline("Maintainability Index"));
|
|
4860
4891
|
await maintainability(file);
|
|
4861
4892
|
return;
|
|
4862
4893
|
}
|
|
@@ -4883,8 +4914,8 @@ function registerComplexity(program2) {
|
|
|
4883
4914
|
}
|
|
4884
4915
|
|
|
4885
4916
|
// src/commands/deploy/redirect.ts
|
|
4886
|
-
import { existsSync as
|
|
4887
|
-
import
|
|
4917
|
+
import { existsSync as existsSync24, readFileSync as readFileSync19, writeFileSync as writeFileSync17 } from "fs";
|
|
4918
|
+
import chalk59 from "chalk";
|
|
4888
4919
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
4889
4920
|
if (!window.location.pathname.endsWith('/')) {
|
|
4890
4921
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -4892,23 +4923,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
4892
4923
|
</script>`;
|
|
4893
4924
|
function redirect() {
|
|
4894
4925
|
const indexPath = "index.html";
|
|
4895
|
-
if (!
|
|
4896
|
-
console.log(
|
|
4926
|
+
if (!existsSync24(indexPath)) {
|
|
4927
|
+
console.log(chalk59.yellow("No index.html found"));
|
|
4897
4928
|
return;
|
|
4898
4929
|
}
|
|
4899
|
-
const content =
|
|
4930
|
+
const content = readFileSync19(indexPath, "utf-8");
|
|
4900
4931
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
4901
|
-
console.log(
|
|
4932
|
+
console.log(chalk59.dim("Trailing slash script already present"));
|
|
4902
4933
|
return;
|
|
4903
4934
|
}
|
|
4904
4935
|
const headCloseIndex = content.indexOf("</head>");
|
|
4905
4936
|
if (headCloseIndex === -1) {
|
|
4906
|
-
console.log(
|
|
4937
|
+
console.log(chalk59.red("Could not find </head> tag in index.html"));
|
|
4907
4938
|
return;
|
|
4908
4939
|
}
|
|
4909
4940
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
4910
4941
|
writeFileSync17(indexPath, newContent);
|
|
4911
|
-
console.log(
|
|
4942
|
+
console.log(chalk59.green("Added trailing slash redirect to index.html"));
|
|
4912
4943
|
}
|
|
4913
4944
|
|
|
4914
4945
|
// src/commands/registerDeploy.ts
|
|
@@ -4935,10 +4966,10 @@ function loadBlogSkipDays(repoName) {
|
|
|
4935
4966
|
|
|
4936
4967
|
// src/commands/devlog/shared.ts
|
|
4937
4968
|
import { execSync as execSync17 } from "child_process";
|
|
4938
|
-
import
|
|
4969
|
+
import chalk60 from "chalk";
|
|
4939
4970
|
|
|
4940
4971
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
4941
|
-
import { readdirSync, readFileSync as
|
|
4972
|
+
import { readdirSync, readFileSync as readFileSync20 } from "fs";
|
|
4942
4973
|
import { join as join16 } from "path";
|
|
4943
4974
|
var DEVLOG_DIR = join16(BLOG_REPO_ROOT, "src/content/devlog");
|
|
4944
4975
|
function extractFrontmatter(content) {
|
|
@@ -4968,7 +4999,7 @@ function readDevlogFiles(callback) {
|
|
|
4968
4999
|
try {
|
|
4969
5000
|
const files = readdirSync(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
4970
5001
|
for (const file of files) {
|
|
4971
|
-
const content =
|
|
5002
|
+
const content = readFileSync20(join16(DEVLOG_DIR, file), "utf-8");
|
|
4972
5003
|
const parsed = parseFrontmatter(content, file);
|
|
4973
5004
|
if (parsed) callback(parsed);
|
|
4974
5005
|
}
|
|
@@ -5022,13 +5053,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
5022
5053
|
}
|
|
5023
5054
|
function printCommitsWithFiles(commits, ignore2, verbose) {
|
|
5024
5055
|
for (const commit2 of commits) {
|
|
5025
|
-
console.log(` ${
|
|
5056
|
+
console.log(` ${chalk60.yellow(commit2.hash)} ${commit2.message}`);
|
|
5026
5057
|
if (verbose) {
|
|
5027
5058
|
const visibleFiles = commit2.files.filter(
|
|
5028
5059
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
5029
5060
|
);
|
|
5030
5061
|
for (const file of visibleFiles) {
|
|
5031
|
-
console.log(` ${
|
|
5062
|
+
console.log(` ${chalk60.dim(file)}`);
|
|
5032
5063
|
}
|
|
5033
5064
|
}
|
|
5034
5065
|
}
|
|
@@ -5053,15 +5084,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
5053
5084
|
}
|
|
5054
5085
|
|
|
5055
5086
|
// src/commands/devlog/list/printDateHeader.ts
|
|
5056
|
-
import
|
|
5087
|
+
import chalk61 from "chalk";
|
|
5057
5088
|
function printDateHeader(date, isSkipped, entries) {
|
|
5058
5089
|
if (isSkipped) {
|
|
5059
|
-
console.log(`${
|
|
5090
|
+
console.log(`${chalk61.bold.blue(date)} ${chalk61.dim("skipped")}`);
|
|
5060
5091
|
} else if (entries && entries.length > 0) {
|
|
5061
|
-
const entryInfo = entries.map((e) => `${
|
|
5062
|
-
console.log(`${
|
|
5092
|
+
const entryInfo = entries.map((e) => `${chalk61.green(e.version)} ${e.title}`).join(" | ");
|
|
5093
|
+
console.log(`${chalk61.bold.blue(date)} ${entryInfo}`);
|
|
5063
5094
|
} else {
|
|
5064
|
-
console.log(`${
|
|
5095
|
+
console.log(`${chalk61.bold.blue(date)} ${chalk61.red("\u26A0 devlog missing")}`);
|
|
5065
5096
|
}
|
|
5066
5097
|
}
|
|
5067
5098
|
|
|
@@ -5164,24 +5195,24 @@ function bumpVersion(version2, type) {
|
|
|
5164
5195
|
|
|
5165
5196
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
5166
5197
|
import { execSync as execSync20 } from "child_process";
|
|
5167
|
-
import
|
|
5198
|
+
import chalk63 from "chalk";
|
|
5168
5199
|
|
|
5169
5200
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
5170
|
-
import
|
|
5201
|
+
import chalk62 from "chalk";
|
|
5171
5202
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
5172
5203
|
if (conventional && firstHash) {
|
|
5173
5204
|
const version2 = getVersionAtCommit(firstHash);
|
|
5174
5205
|
if (version2) {
|
|
5175
|
-
console.log(`${
|
|
5206
|
+
console.log(`${chalk62.bold("version:")} ${stripToMinor(version2)}`);
|
|
5176
5207
|
} else {
|
|
5177
|
-
console.log(`${
|
|
5208
|
+
console.log(`${chalk62.bold("version:")} ${chalk62.red("unknown")}`);
|
|
5178
5209
|
}
|
|
5179
5210
|
} else if (patchVersion && minorVersion) {
|
|
5180
5211
|
console.log(
|
|
5181
|
-
`${
|
|
5212
|
+
`${chalk62.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
5182
5213
|
);
|
|
5183
5214
|
} else {
|
|
5184
|
-
console.log(`${
|
|
5215
|
+
console.log(`${chalk62.bold("version:")} v0.1 (initial)`);
|
|
5185
5216
|
}
|
|
5186
5217
|
}
|
|
5187
5218
|
|
|
@@ -5228,16 +5259,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
5228
5259
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
5229
5260
|
}
|
|
5230
5261
|
function logName(repoName) {
|
|
5231
|
-
console.log(`${
|
|
5262
|
+
console.log(`${chalk63.bold("name:")} ${repoName}`);
|
|
5232
5263
|
}
|
|
5233
5264
|
function displayNextEntry(ctx, targetDate, commits) {
|
|
5234
5265
|
logName(ctx.repoName);
|
|
5235
5266
|
printVersionInfo(ctx.config, ctx.lastInfo, commits[0]?.hash);
|
|
5236
|
-
console.log(
|
|
5267
|
+
console.log(chalk63.bold.blue(targetDate));
|
|
5237
5268
|
printCommitsWithFiles(commits, ctx.ignore, ctx.verbose);
|
|
5238
5269
|
}
|
|
5239
5270
|
function logNoCommits(lastInfo) {
|
|
5240
|
-
console.log(
|
|
5271
|
+
console.log(chalk63.dim(noCommitsMessage(!!lastInfo)));
|
|
5241
5272
|
}
|
|
5242
5273
|
|
|
5243
5274
|
// src/commands/devlog/next/index.ts
|
|
@@ -5278,11 +5309,11 @@ function next2(options2) {
|
|
|
5278
5309
|
import { execSync as execSync21 } from "child_process";
|
|
5279
5310
|
|
|
5280
5311
|
// src/commands/devlog/repos/printReposTable.ts
|
|
5281
|
-
import
|
|
5312
|
+
import chalk64 from "chalk";
|
|
5282
5313
|
function colorStatus(status2) {
|
|
5283
|
-
if (status2 === "missing") return
|
|
5284
|
-
if (status2 === "outdated") return
|
|
5285
|
-
return
|
|
5314
|
+
if (status2 === "missing") return chalk64.red(status2);
|
|
5315
|
+
if (status2 === "outdated") return chalk64.yellow(status2);
|
|
5316
|
+
return chalk64.green(status2);
|
|
5286
5317
|
}
|
|
5287
5318
|
function formatRow(row, nameWidth) {
|
|
5288
5319
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -5296,8 +5327,8 @@ function printReposTable(rows) {
|
|
|
5296
5327
|
"Last Devlog".padEnd(11),
|
|
5297
5328
|
"Status"
|
|
5298
5329
|
].join(" ");
|
|
5299
|
-
console.log(
|
|
5300
|
-
console.log(
|
|
5330
|
+
console.log(chalk64.dim(header));
|
|
5331
|
+
console.log(chalk64.dim("-".repeat(header.length)));
|
|
5301
5332
|
for (const row of rows) {
|
|
5302
5333
|
console.log(formatRow(row, nameWidth));
|
|
5303
5334
|
}
|
|
@@ -5355,14 +5386,14 @@ function repos(options2) {
|
|
|
5355
5386
|
// src/commands/devlog/skip.ts
|
|
5356
5387
|
import { writeFileSync as writeFileSync18 } from "fs";
|
|
5357
5388
|
import { join as join17 } from "path";
|
|
5358
|
-
import
|
|
5389
|
+
import chalk65 from "chalk";
|
|
5359
5390
|
import { stringify as stringifyYaml4 } from "yaml";
|
|
5360
5391
|
function getBlogConfigPath() {
|
|
5361
5392
|
return join17(BLOG_REPO_ROOT, "assist.yml");
|
|
5362
5393
|
}
|
|
5363
5394
|
function skip(date) {
|
|
5364
5395
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
5365
|
-
console.log(
|
|
5396
|
+
console.log(chalk65.red("Invalid date format. Use YYYY-MM-DD"));
|
|
5366
5397
|
process.exit(1);
|
|
5367
5398
|
}
|
|
5368
5399
|
const repoName = getRepoName();
|
|
@@ -5373,7 +5404,7 @@ function skip(date) {
|
|
|
5373
5404
|
const skipDays = skip2[repoName] ?? [];
|
|
5374
5405
|
if (skipDays.includes(date)) {
|
|
5375
5406
|
console.log(
|
|
5376
|
-
|
|
5407
|
+
chalk65.yellow(`${date} is already in skip list for ${repoName}`)
|
|
5377
5408
|
);
|
|
5378
5409
|
return;
|
|
5379
5410
|
}
|
|
@@ -5383,20 +5414,20 @@ function skip(date) {
|
|
|
5383
5414
|
devlog.skip = skip2;
|
|
5384
5415
|
config.devlog = devlog;
|
|
5385
5416
|
writeFileSync18(configPath, stringifyYaml4(config, { lineWidth: 0 }));
|
|
5386
|
-
console.log(
|
|
5417
|
+
console.log(chalk65.green(`Added ${date} to skip list for ${repoName}`));
|
|
5387
5418
|
}
|
|
5388
5419
|
|
|
5389
5420
|
// src/commands/devlog/version.ts
|
|
5390
|
-
import
|
|
5421
|
+
import chalk66 from "chalk";
|
|
5391
5422
|
function version() {
|
|
5392
5423
|
const config = loadConfig();
|
|
5393
5424
|
const name = getRepoName();
|
|
5394
5425
|
const lastInfo = getLastVersionInfo(name, config);
|
|
5395
5426
|
const lastVersion = lastInfo?.version ?? null;
|
|
5396
5427
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
5397
|
-
console.log(`${
|
|
5398
|
-
console.log(`${
|
|
5399
|
-
console.log(`${
|
|
5428
|
+
console.log(`${chalk66.bold("name:")} ${name}`);
|
|
5429
|
+
console.log(`${chalk66.bold("last:")} ${lastVersion ?? chalk66.dim("none")}`);
|
|
5430
|
+
console.log(`${chalk66.bold("next:")} ${nextVersion ?? chalk66.dim("none")}`);
|
|
5400
5431
|
}
|
|
5401
5432
|
|
|
5402
5433
|
// src/commands/registerDevlog.ts
|
|
@@ -5420,15 +5451,15 @@ function registerDevlog(program2) {
|
|
|
5420
5451
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
5421
5452
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
5422
5453
|
import { join as join18 } from "path";
|
|
5423
|
-
import
|
|
5454
|
+
import chalk67 from "chalk";
|
|
5424
5455
|
|
|
5425
5456
|
// src/shared/findRepoRoot.ts
|
|
5426
|
-
import { existsSync as
|
|
5457
|
+
import { existsSync as existsSync25 } from "fs";
|
|
5427
5458
|
import path21 from "path";
|
|
5428
5459
|
function findRepoRoot(dir) {
|
|
5429
5460
|
let current = dir;
|
|
5430
5461
|
while (current !== path21.dirname(current)) {
|
|
5431
|
-
if (
|
|
5462
|
+
if (existsSync25(path21.join(current, ".git"))) {
|
|
5432
5463
|
return current;
|
|
5433
5464
|
}
|
|
5434
5465
|
current = path21.dirname(current);
|
|
@@ -5483,22 +5514,22 @@ function checkBuildLocks(startDir) {
|
|
|
5483
5514
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
5484
5515
|
if (locked) {
|
|
5485
5516
|
console.error(
|
|
5486
|
-
|
|
5517
|
+
chalk67.red("Build output locked (is VS debugging?): ") + locked
|
|
5487
5518
|
);
|
|
5488
5519
|
process.exit(1);
|
|
5489
5520
|
}
|
|
5490
5521
|
}
|
|
5491
5522
|
async function checkBuildLocksCommand() {
|
|
5492
5523
|
checkBuildLocks();
|
|
5493
|
-
console.log(
|
|
5524
|
+
console.log(chalk67.green("No build locks detected"));
|
|
5494
5525
|
}
|
|
5495
5526
|
|
|
5496
5527
|
// src/commands/dotnet/buildTree.ts
|
|
5497
|
-
import { readFileSync as
|
|
5528
|
+
import { readFileSync as readFileSync21 } from "fs";
|
|
5498
5529
|
import path22 from "path";
|
|
5499
5530
|
var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
5500
5531
|
function getProjectRefs(csprojPath) {
|
|
5501
|
-
const content =
|
|
5532
|
+
const content = readFileSync21(csprojPath, "utf-8");
|
|
5502
5533
|
const refs = [];
|
|
5503
5534
|
for (const match of content.matchAll(PROJECT_REF_RE)) {
|
|
5504
5535
|
refs.push(match[1].replace(/\\/g, "/"));
|
|
@@ -5515,7 +5546,7 @@ function buildTree(csprojPath, repoRoot, visited = /* @__PURE__ */ new Set()) {
|
|
|
5515
5546
|
for (const ref of getProjectRefs(abs)) {
|
|
5516
5547
|
const childAbs = path22.resolve(dir, ref);
|
|
5517
5548
|
try {
|
|
5518
|
-
|
|
5549
|
+
readFileSync21(childAbs);
|
|
5519
5550
|
node.children.push(buildTree(childAbs, repoRoot, visited));
|
|
5520
5551
|
} catch {
|
|
5521
5552
|
node.children.push({
|
|
@@ -5540,7 +5571,7 @@ function collectAllDeps(node) {
|
|
|
5540
5571
|
}
|
|
5541
5572
|
|
|
5542
5573
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
5543
|
-
import { readdirSync as readdirSync3, readFileSync as
|
|
5574
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync22, statSync } from "fs";
|
|
5544
5575
|
import path23 from "path";
|
|
5545
5576
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
5546
5577
|
if (depth > maxDepth) return [];
|
|
@@ -5575,7 +5606,7 @@ function findContainingSolutions(csprojPath, repoRoot) {
|
|
|
5575
5606
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
5576
5607
|
for (const sln of slnFiles) {
|
|
5577
5608
|
try {
|
|
5578
|
-
const content =
|
|
5609
|
+
const content = readFileSync22(sln, "utf-8");
|
|
5579
5610
|
if (pattern2.test(content)) {
|
|
5580
5611
|
matches.push(path23.relative(repoRoot, sln));
|
|
5581
5612
|
}
|
|
@@ -5589,30 +5620,30 @@ function escapeRegex(s) {
|
|
|
5589
5620
|
}
|
|
5590
5621
|
|
|
5591
5622
|
// src/commands/dotnet/printTree.ts
|
|
5592
|
-
import
|
|
5623
|
+
import chalk68 from "chalk";
|
|
5593
5624
|
function printNodes(nodes, prefix2) {
|
|
5594
5625
|
for (let i = 0; i < nodes.length; i++) {
|
|
5595
5626
|
const isLast = i === nodes.length - 1;
|
|
5596
5627
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
5597
5628
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
5598
5629
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
5599
|
-
const label2 = isMissing ?
|
|
5630
|
+
const label2 = isMissing ? chalk68.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
5600
5631
|
console.log(`${prefix2}${connector}${label2}`);
|
|
5601
5632
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
5602
5633
|
}
|
|
5603
5634
|
}
|
|
5604
5635
|
function printTree(tree, totalCount, solutions) {
|
|
5605
|
-
console.log(
|
|
5606
|
-
console.log(
|
|
5636
|
+
console.log(chalk68.bold("\nProject Dependency Tree"));
|
|
5637
|
+
console.log(chalk68.cyan(tree.relativePath));
|
|
5607
5638
|
printNodes(tree.children, "");
|
|
5608
|
-
console.log(
|
|
5639
|
+
console.log(chalk68.dim(`
|
|
5609
5640
|
${totalCount} projects total (including root)`));
|
|
5610
|
-
console.log(
|
|
5641
|
+
console.log(chalk68.bold("\nSolution Membership"));
|
|
5611
5642
|
if (solutions.length === 0) {
|
|
5612
|
-
console.log(
|
|
5643
|
+
console.log(chalk68.yellow(" Not found in any .sln"));
|
|
5613
5644
|
} else {
|
|
5614
5645
|
for (const sln of solutions) {
|
|
5615
|
-
console.log(` ${
|
|
5646
|
+
console.log(` ${chalk68.green(sln)}`);
|
|
5616
5647
|
}
|
|
5617
5648
|
}
|
|
5618
5649
|
console.log();
|
|
@@ -5639,18 +5670,18 @@ function printJson(tree, totalCount, solutions) {
|
|
|
5639
5670
|
}
|
|
5640
5671
|
|
|
5641
5672
|
// src/commands/dotnet/resolveCsproj.ts
|
|
5642
|
-
import { existsSync as
|
|
5673
|
+
import { existsSync as existsSync26 } from "fs";
|
|
5643
5674
|
import path24 from "path";
|
|
5644
|
-
import
|
|
5675
|
+
import chalk69 from "chalk";
|
|
5645
5676
|
function resolveCsproj(csprojPath) {
|
|
5646
5677
|
const resolved = path24.resolve(csprojPath);
|
|
5647
|
-
if (!
|
|
5648
|
-
console.error(
|
|
5678
|
+
if (!existsSync26(resolved)) {
|
|
5679
|
+
console.error(chalk69.red(`File not found: ${resolved}`));
|
|
5649
5680
|
process.exit(1);
|
|
5650
5681
|
}
|
|
5651
5682
|
const repoRoot = findRepoRoot(path24.dirname(resolved));
|
|
5652
5683
|
if (!repoRoot) {
|
|
5653
|
-
console.error(
|
|
5684
|
+
console.error(chalk69.red("Could not find git repository root"));
|
|
5654
5685
|
process.exit(1);
|
|
5655
5686
|
}
|
|
5656
5687
|
return { resolved, repoRoot };
|
|
@@ -5700,12 +5731,12 @@ function getChangedCsFiles(scope) {
|
|
|
5700
5731
|
}
|
|
5701
5732
|
|
|
5702
5733
|
// src/commands/dotnet/inSln.ts
|
|
5703
|
-
import
|
|
5734
|
+
import chalk70 from "chalk";
|
|
5704
5735
|
async function inSln(csprojPath) {
|
|
5705
5736
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
5706
5737
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
5707
5738
|
if (solutions.length === 0) {
|
|
5708
|
-
console.log(
|
|
5739
|
+
console.log(chalk70.yellow("Not found in any .sln file"));
|
|
5709
5740
|
process.exit(1);
|
|
5710
5741
|
}
|
|
5711
5742
|
for (const sln of solutions) {
|
|
@@ -5714,7 +5745,7 @@ async function inSln(csprojPath) {
|
|
|
5714
5745
|
}
|
|
5715
5746
|
|
|
5716
5747
|
// src/commands/dotnet/inspect.ts
|
|
5717
|
-
import
|
|
5748
|
+
import chalk76 from "chalk";
|
|
5718
5749
|
|
|
5719
5750
|
// src/shared/formatElapsed.ts
|
|
5720
5751
|
function formatElapsed(ms) {
|
|
@@ -5726,12 +5757,12 @@ function formatElapsed(ms) {
|
|
|
5726
5757
|
}
|
|
5727
5758
|
|
|
5728
5759
|
// src/commands/dotnet/displayIssues.ts
|
|
5729
|
-
import
|
|
5760
|
+
import chalk71 from "chalk";
|
|
5730
5761
|
var SEVERITY_COLOR = {
|
|
5731
|
-
ERROR:
|
|
5732
|
-
WARNING:
|
|
5733
|
-
SUGGESTION:
|
|
5734
|
-
HINT:
|
|
5762
|
+
ERROR: chalk71.red,
|
|
5763
|
+
WARNING: chalk71.yellow,
|
|
5764
|
+
SUGGESTION: chalk71.cyan,
|
|
5765
|
+
HINT: chalk71.dim
|
|
5735
5766
|
};
|
|
5736
5767
|
function groupByFile(issues) {
|
|
5737
5768
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -5747,15 +5778,15 @@ function groupByFile(issues) {
|
|
|
5747
5778
|
}
|
|
5748
5779
|
function displayIssues(issues) {
|
|
5749
5780
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
5750
|
-
console.log(
|
|
5781
|
+
console.log(chalk71.bold(file));
|
|
5751
5782
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
5752
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
5783
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk71.white;
|
|
5753
5784
|
console.log(
|
|
5754
|
-
` ${
|
|
5785
|
+
` ${chalk71.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
5755
5786
|
);
|
|
5756
5787
|
}
|
|
5757
5788
|
}
|
|
5758
|
-
console.log(
|
|
5789
|
+
console.log(chalk71.dim(`
|
|
5759
5790
|
${issues.length} issue(s) found`));
|
|
5760
5791
|
}
|
|
5761
5792
|
|
|
@@ -5812,14 +5843,14 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
5812
5843
|
}
|
|
5813
5844
|
|
|
5814
5845
|
// src/commands/dotnet/resolveSolution.ts
|
|
5815
|
-
import { existsSync as
|
|
5846
|
+
import { existsSync as existsSync27 } from "fs";
|
|
5816
5847
|
import path25 from "path";
|
|
5817
|
-
import
|
|
5848
|
+
import chalk73 from "chalk";
|
|
5818
5849
|
|
|
5819
5850
|
// src/commands/dotnet/findSolution.ts
|
|
5820
5851
|
import { readdirSync as readdirSync4 } from "fs";
|
|
5821
5852
|
import { dirname as dirname16, join as join19 } from "path";
|
|
5822
|
-
import
|
|
5853
|
+
import chalk72 from "chalk";
|
|
5823
5854
|
function findSlnInDir(dir) {
|
|
5824
5855
|
try {
|
|
5825
5856
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join19(dir, f));
|
|
@@ -5835,17 +5866,17 @@ function findSolution() {
|
|
|
5835
5866
|
const slnFiles = findSlnInDir(current);
|
|
5836
5867
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
5837
5868
|
if (slnFiles.length > 1) {
|
|
5838
|
-
console.error(
|
|
5869
|
+
console.error(chalk72.red(`Multiple .sln files found in ${current}:`));
|
|
5839
5870
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
5840
5871
|
console.error(
|
|
5841
|
-
|
|
5872
|
+
chalk72.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
5842
5873
|
);
|
|
5843
5874
|
process.exit(1);
|
|
5844
5875
|
}
|
|
5845
5876
|
if (current === ceiling) break;
|
|
5846
5877
|
current = dirname16(current);
|
|
5847
5878
|
}
|
|
5848
|
-
console.error(
|
|
5879
|
+
console.error(chalk72.red("No .sln file found between cwd and repo root"));
|
|
5849
5880
|
process.exit(1);
|
|
5850
5881
|
}
|
|
5851
5882
|
|
|
@@ -5853,8 +5884,8 @@ function findSolution() {
|
|
|
5853
5884
|
function resolveSolution(sln) {
|
|
5854
5885
|
if (sln) {
|
|
5855
5886
|
const resolved = path25.resolve(sln);
|
|
5856
|
-
if (!
|
|
5857
|
-
console.error(
|
|
5887
|
+
if (!existsSync27(resolved)) {
|
|
5888
|
+
console.error(chalk73.red(`Solution file not found: ${resolved}`));
|
|
5858
5889
|
process.exit(1);
|
|
5859
5890
|
}
|
|
5860
5891
|
return resolved;
|
|
@@ -5893,17 +5924,17 @@ function parseInspectReport(json) {
|
|
|
5893
5924
|
|
|
5894
5925
|
// src/commands/dotnet/runInspectCode.ts
|
|
5895
5926
|
import { execSync as execSync23 } from "child_process";
|
|
5896
|
-
import { existsSync as
|
|
5927
|
+
import { existsSync as existsSync28, readFileSync as readFileSync23, unlinkSync as unlinkSync5 } from "fs";
|
|
5897
5928
|
import { tmpdir as tmpdir2 } from "os";
|
|
5898
5929
|
import path26 from "path";
|
|
5899
|
-
import
|
|
5930
|
+
import chalk74 from "chalk";
|
|
5900
5931
|
function assertJbInstalled() {
|
|
5901
5932
|
try {
|
|
5902
5933
|
execSync23("jb inspectcode --version", { stdio: "pipe" });
|
|
5903
5934
|
} catch {
|
|
5904
|
-
console.error(
|
|
5935
|
+
console.error(chalk74.red("jb is not installed. Install with:"));
|
|
5905
5936
|
console.error(
|
|
5906
|
-
|
|
5937
|
+
chalk74.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
5907
5938
|
);
|
|
5908
5939
|
process.exit(1);
|
|
5909
5940
|
}
|
|
@@ -5921,21 +5952,21 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
5921
5952
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
5922
5953
|
process.stderr.write(err.stderr);
|
|
5923
5954
|
}
|
|
5924
|
-
console.error(
|
|
5955
|
+
console.error(chalk74.red("jb inspectcode failed"));
|
|
5925
5956
|
process.exit(1);
|
|
5926
5957
|
}
|
|
5927
|
-
if (!
|
|
5928
|
-
console.error(
|
|
5958
|
+
if (!existsSync28(reportPath)) {
|
|
5959
|
+
console.error(chalk74.red("Report file not generated"));
|
|
5929
5960
|
process.exit(1);
|
|
5930
5961
|
}
|
|
5931
|
-
const xml =
|
|
5962
|
+
const xml = readFileSync23(reportPath, "utf-8");
|
|
5932
5963
|
unlinkSync5(reportPath);
|
|
5933
5964
|
return xml;
|
|
5934
5965
|
}
|
|
5935
5966
|
|
|
5936
5967
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
5937
5968
|
import { execSync as execSync24 } from "child_process";
|
|
5938
|
-
import
|
|
5969
|
+
import chalk75 from "chalk";
|
|
5939
5970
|
function resolveMsbuildPath() {
|
|
5940
5971
|
const config = loadConfig();
|
|
5941
5972
|
const buildConfig = config.run?.find((r) => r.name === "build");
|
|
@@ -5946,9 +5977,9 @@ function assertMsbuildInstalled() {
|
|
|
5946
5977
|
try {
|
|
5947
5978
|
execSync24(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
5948
5979
|
} catch {
|
|
5949
|
-
console.error(
|
|
5980
|
+
console.error(chalk75.red(`msbuild not found at: ${msbuild}`));
|
|
5950
5981
|
console.error(
|
|
5951
|
-
|
|
5982
|
+
chalk75.yellow(
|
|
5952
5983
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
5953
5984
|
)
|
|
5954
5985
|
);
|
|
@@ -5995,17 +6026,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
5995
6026
|
// src/commands/dotnet/inspect.ts
|
|
5996
6027
|
function logScope(changedFiles) {
|
|
5997
6028
|
if (changedFiles === null) {
|
|
5998
|
-
console.log(
|
|
6029
|
+
console.log(chalk76.dim("Inspecting full solution..."));
|
|
5999
6030
|
} else {
|
|
6000
6031
|
console.log(
|
|
6001
|
-
|
|
6032
|
+
chalk76.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
6002
6033
|
);
|
|
6003
6034
|
}
|
|
6004
6035
|
}
|
|
6005
6036
|
function reportResults(issues, elapsed) {
|
|
6006
6037
|
if (issues.length > 0) displayIssues(issues);
|
|
6007
|
-
else console.log(
|
|
6008
|
-
console.log(
|
|
6038
|
+
else console.log(chalk76.green("No issues found"));
|
|
6039
|
+
console.log(chalk76.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
6009
6040
|
if (issues.length > 0) process.exit(1);
|
|
6010
6041
|
}
|
|
6011
6042
|
async function inspect(sln, options2) {
|
|
@@ -6016,7 +6047,7 @@ async function inspect(sln, options2) {
|
|
|
6016
6047
|
const scope = parseScope(options2.scope);
|
|
6017
6048
|
const changedFiles = getChangedCsFiles(scope);
|
|
6018
6049
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
6019
|
-
console.log(
|
|
6050
|
+
console.log(chalk76.green("No changed .cs files found"));
|
|
6020
6051
|
return;
|
|
6021
6052
|
}
|
|
6022
6053
|
logScope(changedFiles);
|
|
@@ -6042,7 +6073,7 @@ function registerDotnet(program2) {
|
|
|
6042
6073
|
}
|
|
6043
6074
|
|
|
6044
6075
|
// src/commands/jira/acceptanceCriteria.ts
|
|
6045
|
-
import
|
|
6076
|
+
import chalk78 from "chalk";
|
|
6046
6077
|
|
|
6047
6078
|
// src/commands/jira/adfToText.ts
|
|
6048
6079
|
function renderInline(node) {
|
|
@@ -6103,7 +6134,7 @@ function adfToText(doc) {
|
|
|
6103
6134
|
|
|
6104
6135
|
// src/commands/jira/fetchIssue.ts
|
|
6105
6136
|
import { execSync as execSync25 } from "child_process";
|
|
6106
|
-
import
|
|
6137
|
+
import chalk77 from "chalk";
|
|
6107
6138
|
function fetchIssue(issueKey, fields) {
|
|
6108
6139
|
let result;
|
|
6109
6140
|
try {
|
|
@@ -6116,15 +6147,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
6116
6147
|
const stderr = error.stderr;
|
|
6117
6148
|
if (stderr.includes("unauthorized")) {
|
|
6118
6149
|
console.error(
|
|
6119
|
-
|
|
6150
|
+
chalk77.red("Jira authentication expired."),
|
|
6120
6151
|
"Run",
|
|
6121
|
-
|
|
6152
|
+
chalk77.cyan("assist jira auth"),
|
|
6122
6153
|
"to re-authenticate."
|
|
6123
6154
|
);
|
|
6124
6155
|
process.exit(1);
|
|
6125
6156
|
}
|
|
6126
6157
|
}
|
|
6127
|
-
console.error(
|
|
6158
|
+
console.error(chalk77.red(`Failed to fetch ${issueKey}.`));
|
|
6128
6159
|
process.exit(1);
|
|
6129
6160
|
}
|
|
6130
6161
|
return JSON.parse(result);
|
|
@@ -6138,7 +6169,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
6138
6169
|
const parsed = fetchIssue(issueKey, field);
|
|
6139
6170
|
const acValue = parsed?.fields?.[field];
|
|
6140
6171
|
if (!acValue) {
|
|
6141
|
-
console.log(
|
|
6172
|
+
console.log(chalk78.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
6142
6173
|
return;
|
|
6143
6174
|
}
|
|
6144
6175
|
if (typeof acValue === "string") {
|
|
@@ -6156,7 +6187,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
6156
6187
|
import { execSync as execSync26 } from "child_process";
|
|
6157
6188
|
|
|
6158
6189
|
// src/shared/loadJson.ts
|
|
6159
|
-
import { existsSync as
|
|
6190
|
+
import { existsSync as existsSync29, mkdirSync as mkdirSync5, readFileSync as readFileSync24, writeFileSync as writeFileSync19 } from "fs";
|
|
6160
6191
|
import { homedir as homedir6 } from "os";
|
|
6161
6192
|
import { join as join20 } from "path";
|
|
6162
6193
|
function getStoreDir() {
|
|
@@ -6167,9 +6198,9 @@ function getStorePath(filename) {
|
|
|
6167
6198
|
}
|
|
6168
6199
|
function loadJson(filename) {
|
|
6169
6200
|
const path50 = getStorePath(filename);
|
|
6170
|
-
if (
|
|
6201
|
+
if (existsSync29(path50)) {
|
|
6171
6202
|
try {
|
|
6172
|
-
return JSON.parse(
|
|
6203
|
+
return JSON.parse(readFileSync24(path50, "utf-8"));
|
|
6173
6204
|
} catch {
|
|
6174
6205
|
return {};
|
|
6175
6206
|
}
|
|
@@ -6178,7 +6209,7 @@ function loadJson(filename) {
|
|
|
6178
6209
|
}
|
|
6179
6210
|
function saveJson(filename, data) {
|
|
6180
6211
|
const dir = getStoreDir();
|
|
6181
|
-
if (!
|
|
6212
|
+
if (!existsSync29(dir)) {
|
|
6182
6213
|
mkdirSync5(dir, { recursive: true });
|
|
6183
6214
|
}
|
|
6184
6215
|
writeFileSync19(getStorePath(filename), JSON.stringify(data, null, 2));
|
|
@@ -6233,14 +6264,14 @@ async function jiraAuth() {
|
|
|
6233
6264
|
}
|
|
6234
6265
|
|
|
6235
6266
|
// src/commands/jira/viewIssue.ts
|
|
6236
|
-
import
|
|
6267
|
+
import chalk79 from "chalk";
|
|
6237
6268
|
function viewIssue(issueKey) {
|
|
6238
6269
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
6239
6270
|
const fields = parsed?.fields;
|
|
6240
6271
|
const summary = fields?.summary;
|
|
6241
6272
|
const description = fields?.description;
|
|
6242
6273
|
if (summary) {
|
|
6243
|
-
console.log(
|
|
6274
|
+
console.log(chalk79.bold(summary));
|
|
6244
6275
|
}
|
|
6245
6276
|
if (description) {
|
|
6246
6277
|
if (summary) console.log();
|
|
@@ -6254,7 +6285,7 @@ function viewIssue(issueKey) {
|
|
|
6254
6285
|
}
|
|
6255
6286
|
if (!summary && !description) {
|
|
6256
6287
|
console.log(
|
|
6257
|
-
|
|
6288
|
+
chalk79.yellow(`No summary or description found on ${issueKey}.`)
|
|
6258
6289
|
);
|
|
6259
6290
|
}
|
|
6260
6291
|
}
|
|
@@ -6268,7 +6299,7 @@ function registerJira(program2) {
|
|
|
6268
6299
|
}
|
|
6269
6300
|
|
|
6270
6301
|
// src/commands/news/add/index.ts
|
|
6271
|
-
import
|
|
6302
|
+
import chalk80 from "chalk";
|
|
6272
6303
|
import enquirer7 from "enquirer";
|
|
6273
6304
|
async function add2(url) {
|
|
6274
6305
|
if (!url) {
|
|
@@ -6291,17 +6322,17 @@ async function add2(url) {
|
|
|
6291
6322
|
const news = config.news ?? {};
|
|
6292
6323
|
const feeds = news.feeds ?? [];
|
|
6293
6324
|
if (feeds.includes(url)) {
|
|
6294
|
-
console.log(
|
|
6325
|
+
console.log(chalk80.yellow("Feed already exists in config"));
|
|
6295
6326
|
return;
|
|
6296
6327
|
}
|
|
6297
6328
|
feeds.push(url);
|
|
6298
6329
|
config.news = { ...news, feeds };
|
|
6299
6330
|
saveGlobalConfig(config);
|
|
6300
|
-
console.log(
|
|
6331
|
+
console.log(chalk80.green(`Added feed: ${url}`));
|
|
6301
6332
|
}
|
|
6302
6333
|
|
|
6303
6334
|
// src/commands/news/web/handleRequest.ts
|
|
6304
|
-
import
|
|
6335
|
+
import chalk81 from "chalk";
|
|
6305
6336
|
|
|
6306
6337
|
// src/commands/news/web/shared.ts
|
|
6307
6338
|
import { decodeHTML } from "entities";
|
|
@@ -6437,17 +6468,17 @@ function prefetch() {
|
|
|
6437
6468
|
const config = loadConfig();
|
|
6438
6469
|
const total = config.news.feeds.length;
|
|
6439
6470
|
if (total === 0) return;
|
|
6440
|
-
process.stdout.write(
|
|
6471
|
+
process.stdout.write(chalk81.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
6441
6472
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
6442
6473
|
const width = 20;
|
|
6443
6474
|
const filled = Math.round(done2 / t * width);
|
|
6444
6475
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
6445
6476
|
process.stdout.write(
|
|
6446
|
-
`\r${
|
|
6477
|
+
`\r${chalk81.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
6447
6478
|
);
|
|
6448
6479
|
}).then((items) => {
|
|
6449
6480
|
process.stdout.write(
|
|
6450
|
-
`\r${
|
|
6481
|
+
`\r${chalk81.green(`Fetched ${items.length} items from ${total} feed(s)`)}
|
|
6451
6482
|
`
|
|
6452
6483
|
);
|
|
6453
6484
|
cachedItems = items;
|
|
@@ -6615,7 +6646,7 @@ import { tmpdir as tmpdir4 } from "os";
|
|
|
6615
6646
|
import { join as join23 } from "path";
|
|
6616
6647
|
|
|
6617
6648
|
// src/commands/prs/loadCommentsCache.ts
|
|
6618
|
-
import { existsSync as
|
|
6649
|
+
import { existsSync as existsSync30, readFileSync as readFileSync25, unlinkSync as unlinkSync7 } from "fs";
|
|
6619
6650
|
import { join as join22 } from "path";
|
|
6620
6651
|
import { parse as parse2 } from "yaml";
|
|
6621
6652
|
function getCachePath(prNumber) {
|
|
@@ -6623,15 +6654,15 @@ function getCachePath(prNumber) {
|
|
|
6623
6654
|
}
|
|
6624
6655
|
function loadCommentsCache(prNumber) {
|
|
6625
6656
|
const cachePath = getCachePath(prNumber);
|
|
6626
|
-
if (!
|
|
6657
|
+
if (!existsSync30(cachePath)) {
|
|
6627
6658
|
return null;
|
|
6628
6659
|
}
|
|
6629
|
-
const content =
|
|
6660
|
+
const content = readFileSync25(cachePath, "utf-8");
|
|
6630
6661
|
return parse2(content);
|
|
6631
6662
|
}
|
|
6632
6663
|
function deleteCommentsCache(prNumber) {
|
|
6633
6664
|
const cachePath = getCachePath(prNumber);
|
|
6634
|
-
if (
|
|
6665
|
+
if (existsSync30(cachePath)) {
|
|
6635
6666
|
unlinkSync7(cachePath);
|
|
6636
6667
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
6637
6668
|
}
|
|
@@ -6728,7 +6759,7 @@ function fixed(commentId, sha) {
|
|
|
6728
6759
|
}
|
|
6729
6760
|
|
|
6730
6761
|
// src/commands/prs/listComments/index.ts
|
|
6731
|
-
import { existsSync as
|
|
6762
|
+
import { existsSync as existsSync31, mkdirSync as mkdirSync6, writeFileSync as writeFileSync23 } from "fs";
|
|
6732
6763
|
import { join as join25 } from "path";
|
|
6733
6764
|
import { stringify } from "yaml";
|
|
6734
6765
|
|
|
@@ -6808,20 +6839,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
6808
6839
|
}
|
|
6809
6840
|
|
|
6810
6841
|
// src/commands/prs/listComments/printComments.ts
|
|
6811
|
-
import
|
|
6842
|
+
import chalk82 from "chalk";
|
|
6812
6843
|
function formatForHuman(comment3) {
|
|
6813
6844
|
if (comment3.type === "review") {
|
|
6814
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
6845
|
+
const stateColor = comment3.state === "APPROVED" ? chalk82.green : comment3.state === "CHANGES_REQUESTED" ? chalk82.red : chalk82.yellow;
|
|
6815
6846
|
return [
|
|
6816
|
-
`${
|
|
6847
|
+
`${chalk82.cyan("Review")} by ${chalk82.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
6817
6848
|
comment3.body,
|
|
6818
6849
|
""
|
|
6819
6850
|
].join("\n");
|
|
6820
6851
|
}
|
|
6821
6852
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
6822
6853
|
return [
|
|
6823
|
-
`${
|
|
6824
|
-
|
|
6854
|
+
`${chalk82.cyan("Line comment")} by ${chalk82.bold(comment3.user)} on ${chalk82.dim(`${comment3.path}${location}`)}`,
|
|
6855
|
+
chalk82.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
6825
6856
|
comment3.body,
|
|
6826
6857
|
""
|
|
6827
6858
|
].join("\n");
|
|
@@ -6854,7 +6885,7 @@ function printComments2(result) {
|
|
|
6854
6885
|
// src/commands/prs/listComments/index.ts
|
|
6855
6886
|
function writeCommentsCache(prNumber, comments2) {
|
|
6856
6887
|
const assistDir = join25(process.cwd(), ".assist");
|
|
6857
|
-
if (!
|
|
6888
|
+
if (!existsSync31(assistDir)) {
|
|
6858
6889
|
mkdirSync6(assistDir, { recursive: true });
|
|
6859
6890
|
}
|
|
6860
6891
|
const cacheData = {
|
|
@@ -6911,13 +6942,13 @@ import { execSync as execSync32 } from "child_process";
|
|
|
6911
6942
|
import enquirer8 from "enquirer";
|
|
6912
6943
|
|
|
6913
6944
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
6914
|
-
import
|
|
6945
|
+
import chalk83 from "chalk";
|
|
6915
6946
|
var STATUS_MAP = {
|
|
6916
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
6917
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
6947
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk83.magenta("merged"), date: pr.mergedAt } : null,
|
|
6948
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk83.red("closed"), date: pr.closedAt } : null
|
|
6918
6949
|
};
|
|
6919
6950
|
function defaultStatus(pr) {
|
|
6920
|
-
return { label:
|
|
6951
|
+
return { label: chalk83.green("opened"), date: pr.createdAt };
|
|
6921
6952
|
}
|
|
6922
6953
|
function getStatus2(pr) {
|
|
6923
6954
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -6926,11 +6957,11 @@ function formatDate(dateStr) {
|
|
|
6926
6957
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
6927
6958
|
}
|
|
6928
6959
|
function formatPrHeader(pr, status2) {
|
|
6929
|
-
return `${
|
|
6960
|
+
return `${chalk83.cyan(`#${pr.number}`)} ${pr.title} ${chalk83.dim(`(${pr.author.login},`)} ${status2.label} ${chalk83.dim(`${formatDate(status2.date)})`)}`;
|
|
6930
6961
|
}
|
|
6931
6962
|
function logPrDetails(pr) {
|
|
6932
6963
|
console.log(
|
|
6933
|
-
|
|
6964
|
+
chalk83.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
6934
6965
|
);
|
|
6935
6966
|
console.log();
|
|
6936
6967
|
}
|
|
@@ -7096,10 +7127,10 @@ function registerPrs(program2) {
|
|
|
7096
7127
|
}
|
|
7097
7128
|
|
|
7098
7129
|
// src/commands/ravendb/ravendbAuth.ts
|
|
7099
|
-
import
|
|
7130
|
+
import chalk89 from "chalk";
|
|
7100
7131
|
|
|
7101
7132
|
// src/shared/createConnectionAuth.ts
|
|
7102
|
-
import
|
|
7133
|
+
import chalk84 from "chalk";
|
|
7103
7134
|
function listConnections(connections, format2) {
|
|
7104
7135
|
if (connections.length === 0) {
|
|
7105
7136
|
console.log("No connections configured.");
|
|
@@ -7112,7 +7143,7 @@ function listConnections(connections, format2) {
|
|
|
7112
7143
|
function removeConnection(connections, name, save) {
|
|
7113
7144
|
const filtered = connections.filter((c) => c.name !== name);
|
|
7114
7145
|
if (filtered.length === connections.length) {
|
|
7115
|
-
console.error(
|
|
7146
|
+
console.error(chalk84.red(`Connection "${name}" not found.`));
|
|
7116
7147
|
process.exit(1);
|
|
7117
7148
|
}
|
|
7118
7149
|
save(filtered);
|
|
@@ -7158,15 +7189,15 @@ function saveConnections(connections) {
|
|
|
7158
7189
|
}
|
|
7159
7190
|
|
|
7160
7191
|
// src/commands/ravendb/promptConnection.ts
|
|
7161
|
-
import
|
|
7192
|
+
import chalk87 from "chalk";
|
|
7162
7193
|
|
|
7163
7194
|
// src/commands/ravendb/selectOpSecret.ts
|
|
7164
|
-
import
|
|
7195
|
+
import chalk86 from "chalk";
|
|
7165
7196
|
import Enquirer2 from "enquirer";
|
|
7166
7197
|
|
|
7167
7198
|
// src/commands/ravendb/searchItems.ts
|
|
7168
7199
|
import { execSync as execSync34 } from "child_process";
|
|
7169
|
-
import
|
|
7200
|
+
import chalk85 from "chalk";
|
|
7170
7201
|
function opExec(args) {
|
|
7171
7202
|
return execSync34(`op ${args}`, {
|
|
7172
7203
|
encoding: "utf-8",
|
|
@@ -7179,7 +7210,7 @@ function searchItems(search) {
|
|
|
7179
7210
|
items = JSON.parse(opExec("item list --format=json"));
|
|
7180
7211
|
} catch {
|
|
7181
7212
|
console.error(
|
|
7182
|
-
|
|
7213
|
+
chalk85.red(
|
|
7183
7214
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
7184
7215
|
)
|
|
7185
7216
|
);
|
|
@@ -7193,7 +7224,7 @@ function getItemFields(itemId) {
|
|
|
7193
7224
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
7194
7225
|
return item.fields.filter((f) => f.reference && f.label);
|
|
7195
7226
|
} catch {
|
|
7196
|
-
console.error(
|
|
7227
|
+
console.error(chalk85.red("Failed to get item details from 1Password."));
|
|
7197
7228
|
process.exit(1);
|
|
7198
7229
|
}
|
|
7199
7230
|
}
|
|
@@ -7212,7 +7243,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7212
7243
|
}).run();
|
|
7213
7244
|
const items = searchItems(search);
|
|
7214
7245
|
if (items.length === 0) {
|
|
7215
|
-
console.error(
|
|
7246
|
+
console.error(chalk86.red(`No items found matching "${search}".`));
|
|
7216
7247
|
process.exit(1);
|
|
7217
7248
|
}
|
|
7218
7249
|
const itemId = await selectOne(
|
|
@@ -7221,7 +7252,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7221
7252
|
);
|
|
7222
7253
|
const fields = getItemFields(itemId);
|
|
7223
7254
|
if (fields.length === 0) {
|
|
7224
|
-
console.error(
|
|
7255
|
+
console.error(chalk86.red("No fields with references found on this item."));
|
|
7225
7256
|
process.exit(1);
|
|
7226
7257
|
}
|
|
7227
7258
|
const ref = await selectOne(
|
|
@@ -7235,7 +7266,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7235
7266
|
async function promptConnection(existingNames) {
|
|
7236
7267
|
const name = await promptInput("name", "Connection name:");
|
|
7237
7268
|
if (existingNames.includes(name)) {
|
|
7238
|
-
console.error(
|
|
7269
|
+
console.error(chalk87.red(`Connection "${name}" already exists.`));
|
|
7239
7270
|
process.exit(1);
|
|
7240
7271
|
}
|
|
7241
7272
|
const url = await promptInput(
|
|
@@ -7244,22 +7275,22 @@ async function promptConnection(existingNames) {
|
|
|
7244
7275
|
);
|
|
7245
7276
|
const database = await promptInput("database", "Database name:");
|
|
7246
7277
|
if (!name || !url || !database) {
|
|
7247
|
-
console.error(
|
|
7278
|
+
console.error(chalk87.red("All fields are required."));
|
|
7248
7279
|
process.exit(1);
|
|
7249
7280
|
}
|
|
7250
7281
|
const apiKeyRef = await selectOpSecret();
|
|
7251
|
-
console.log(
|
|
7282
|
+
console.log(chalk87.dim(`Using: ${apiKeyRef}`));
|
|
7252
7283
|
return { name, url, database, apiKeyRef };
|
|
7253
7284
|
}
|
|
7254
7285
|
|
|
7255
7286
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
7256
|
-
import
|
|
7287
|
+
import chalk88 from "chalk";
|
|
7257
7288
|
function ravendbSetConnection(name) {
|
|
7258
7289
|
const raw = loadGlobalConfigRaw();
|
|
7259
7290
|
const ravendb = raw.ravendb ?? {};
|
|
7260
7291
|
const connections = ravendb.connections ?? [];
|
|
7261
7292
|
if (!connections.some((c) => c.name === name)) {
|
|
7262
|
-
console.error(
|
|
7293
|
+
console.error(chalk88.red(`Connection "${name}" not found.`));
|
|
7263
7294
|
console.error(
|
|
7264
7295
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
7265
7296
|
);
|
|
@@ -7275,16 +7306,16 @@ function ravendbSetConnection(name) {
|
|
|
7275
7306
|
var ravendbAuth = createConnectionAuth({
|
|
7276
7307
|
load: loadConnections,
|
|
7277
7308
|
save: saveConnections,
|
|
7278
|
-
format: (c) => `${
|
|
7309
|
+
format: (c) => `${chalk89.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
7279
7310
|
promptNew: promptConnection,
|
|
7280
7311
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
7281
7312
|
});
|
|
7282
7313
|
|
|
7283
7314
|
// src/commands/ravendb/ravendbCollections.ts
|
|
7284
|
-
import
|
|
7315
|
+
import chalk93 from "chalk";
|
|
7285
7316
|
|
|
7286
7317
|
// src/commands/ravendb/ravenFetch.ts
|
|
7287
|
-
import
|
|
7318
|
+
import chalk91 from "chalk";
|
|
7288
7319
|
|
|
7289
7320
|
// src/commands/ravendb/getAccessToken.ts
|
|
7290
7321
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -7321,10 +7352,10 @@ ${errorText}`
|
|
|
7321
7352
|
|
|
7322
7353
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
7323
7354
|
import { execSync as execSync35 } from "child_process";
|
|
7324
|
-
import
|
|
7355
|
+
import chalk90 from "chalk";
|
|
7325
7356
|
function resolveOpSecret(reference) {
|
|
7326
7357
|
if (!reference.startsWith("op://")) {
|
|
7327
|
-
console.error(
|
|
7358
|
+
console.error(chalk90.red(`Invalid secret reference: must start with op://`));
|
|
7328
7359
|
process.exit(1);
|
|
7329
7360
|
}
|
|
7330
7361
|
try {
|
|
@@ -7334,7 +7365,7 @@ function resolveOpSecret(reference) {
|
|
|
7334
7365
|
}).trim();
|
|
7335
7366
|
} catch {
|
|
7336
7367
|
console.error(
|
|
7337
|
-
|
|
7368
|
+
chalk90.red(
|
|
7338
7369
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
7339
7370
|
)
|
|
7340
7371
|
);
|
|
@@ -7361,7 +7392,7 @@ async function ravenFetch(connection, path50) {
|
|
|
7361
7392
|
if (!response.ok) {
|
|
7362
7393
|
const body = await response.text();
|
|
7363
7394
|
console.error(
|
|
7364
|
-
|
|
7395
|
+
chalk91.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
7365
7396
|
);
|
|
7366
7397
|
console.error(body.substring(0, 500));
|
|
7367
7398
|
process.exit(1);
|
|
@@ -7370,7 +7401,7 @@ async function ravenFetch(connection, path50) {
|
|
|
7370
7401
|
}
|
|
7371
7402
|
|
|
7372
7403
|
// src/commands/ravendb/resolveConnection.ts
|
|
7373
|
-
import
|
|
7404
|
+
import chalk92 from "chalk";
|
|
7374
7405
|
function loadRavendb() {
|
|
7375
7406
|
const raw = loadGlobalConfigRaw();
|
|
7376
7407
|
const ravendb = raw.ravendb;
|
|
@@ -7384,7 +7415,7 @@ function resolveConnection(name) {
|
|
|
7384
7415
|
const connectionName = name ?? defaultConnection;
|
|
7385
7416
|
if (!connectionName) {
|
|
7386
7417
|
console.error(
|
|
7387
|
-
|
|
7418
|
+
chalk92.red(
|
|
7388
7419
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
7389
7420
|
)
|
|
7390
7421
|
);
|
|
@@ -7392,7 +7423,7 @@ function resolveConnection(name) {
|
|
|
7392
7423
|
}
|
|
7393
7424
|
const connection = connections.find((c) => c.name === connectionName);
|
|
7394
7425
|
if (!connection) {
|
|
7395
|
-
console.error(
|
|
7426
|
+
console.error(chalk92.red(`Connection "${connectionName}" not found.`));
|
|
7396
7427
|
console.error(
|
|
7397
7428
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
7398
7429
|
);
|
|
@@ -7423,15 +7454,15 @@ async function ravendbCollections(connectionName) {
|
|
|
7423
7454
|
return;
|
|
7424
7455
|
}
|
|
7425
7456
|
for (const c of collections) {
|
|
7426
|
-
console.log(`${
|
|
7457
|
+
console.log(`${chalk93.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
7427
7458
|
}
|
|
7428
7459
|
}
|
|
7429
7460
|
|
|
7430
7461
|
// src/commands/ravendb/ravendbQuery.ts
|
|
7431
|
-
import
|
|
7462
|
+
import chalk95 from "chalk";
|
|
7432
7463
|
|
|
7433
7464
|
// src/commands/ravendb/fetchAllPages.ts
|
|
7434
|
-
import
|
|
7465
|
+
import chalk94 from "chalk";
|
|
7435
7466
|
|
|
7436
7467
|
// src/commands/ravendb/buildQueryPath.ts
|
|
7437
7468
|
function buildQueryPath(opts) {
|
|
@@ -7469,7 +7500,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
7469
7500
|
allResults.push(...results);
|
|
7470
7501
|
start3 += results.length;
|
|
7471
7502
|
process.stderr.write(
|
|
7472
|
-
`\r${
|
|
7503
|
+
`\r${chalk94.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
7473
7504
|
);
|
|
7474
7505
|
if (start3 >= totalResults) break;
|
|
7475
7506
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -7484,7 +7515,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
7484
7515
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
7485
7516
|
const resolved = resolveArgs(connectionName, collection);
|
|
7486
7517
|
if (!resolved.collection && !options2.query) {
|
|
7487
|
-
console.error(
|
|
7518
|
+
console.error(chalk95.red("Provide a collection name or --query filter."));
|
|
7488
7519
|
process.exit(1);
|
|
7489
7520
|
}
|
|
7490
7521
|
const { collection: col } = resolved;
|
|
@@ -7522,7 +7553,7 @@ import { spawn as spawn4 } from "child_process";
|
|
|
7522
7553
|
import * as path27 from "path";
|
|
7523
7554
|
|
|
7524
7555
|
// src/commands/refactor/logViolations.ts
|
|
7525
|
-
import
|
|
7556
|
+
import chalk96 from "chalk";
|
|
7526
7557
|
var DEFAULT_MAX_LINES = 100;
|
|
7527
7558
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
7528
7559
|
if (violations.length === 0) {
|
|
@@ -7531,43 +7562,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
7531
7562
|
}
|
|
7532
7563
|
return;
|
|
7533
7564
|
}
|
|
7534
|
-
console.error(
|
|
7565
|
+
console.error(chalk96.red(`
|
|
7535
7566
|
Refactor check failed:
|
|
7536
7567
|
`));
|
|
7537
|
-
console.error(
|
|
7568
|
+
console.error(chalk96.red(` The following files exceed ${maxLines} lines:
|
|
7538
7569
|
`));
|
|
7539
7570
|
for (const violation of violations) {
|
|
7540
|
-
console.error(
|
|
7571
|
+
console.error(chalk96.red(` ${violation.file} (${violation.lines} lines)`));
|
|
7541
7572
|
}
|
|
7542
7573
|
console.error(
|
|
7543
|
-
|
|
7574
|
+
chalk96.yellow(
|
|
7544
7575
|
`
|
|
7545
7576
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
7546
7577
|
way to refactor it, ignore it with:
|
|
7547
7578
|
`
|
|
7548
7579
|
)
|
|
7549
7580
|
);
|
|
7550
|
-
console.error(
|
|
7581
|
+
console.error(chalk96.gray(` assist refactor ignore <file>
|
|
7551
7582
|
`));
|
|
7552
7583
|
if (process.env.CLAUDECODE) {
|
|
7553
|
-
console.error(
|
|
7584
|
+
console.error(chalk96.cyan(`
|
|
7554
7585
|
## Extracting Code to New Files
|
|
7555
7586
|
`));
|
|
7556
7587
|
console.error(
|
|
7557
|
-
|
|
7588
|
+
chalk96.cyan(
|
|
7558
7589
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
7559
7590
|
`
|
|
7560
7591
|
)
|
|
7561
7592
|
);
|
|
7562
7593
|
console.error(
|
|
7563
|
-
|
|
7594
|
+
chalk96.cyan(
|
|
7564
7595
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
7565
7596
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
7566
7597
|
`
|
|
7567
7598
|
)
|
|
7568
7599
|
);
|
|
7569
7600
|
console.error(
|
|
7570
|
-
|
|
7601
|
+
chalk96.cyan(
|
|
7571
7602
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
7572
7603
|
domains, move it to a common/shared folder.
|
|
7573
7604
|
`
|
|
@@ -7723,7 +7754,7 @@ async function check(pattern2, options2) {
|
|
|
7723
7754
|
|
|
7724
7755
|
// src/commands/refactor/extract/index.ts
|
|
7725
7756
|
import path33 from "path";
|
|
7726
|
-
import
|
|
7757
|
+
import chalk99 from "chalk";
|
|
7727
7758
|
|
|
7728
7759
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
7729
7760
|
import { SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
@@ -8249,23 +8280,23 @@ function buildPlan(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
8249
8280
|
|
|
8250
8281
|
// src/commands/refactor/extract/displayPlan.ts
|
|
8251
8282
|
import path31 from "path";
|
|
8252
|
-
import
|
|
8283
|
+
import chalk97 from "chalk";
|
|
8253
8284
|
function section(title) {
|
|
8254
8285
|
return `
|
|
8255
|
-
${
|
|
8286
|
+
${chalk97.cyan(title)}`;
|
|
8256
8287
|
}
|
|
8257
8288
|
function displayImporters(plan2, cwd) {
|
|
8258
8289
|
if (plan2.importersToUpdate.length === 0) return;
|
|
8259
8290
|
console.log(section("Update importers:"));
|
|
8260
8291
|
for (const imp of plan2.importersToUpdate) {
|
|
8261
8292
|
const rel = path31.relative(cwd, imp.file.getFilePath());
|
|
8262
|
-
console.log(` ${
|
|
8293
|
+
console.log(` ${chalk97.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
8263
8294
|
}
|
|
8264
8295
|
}
|
|
8265
8296
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
8266
|
-
console.log(
|
|
8297
|
+
console.log(chalk97.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
8267
8298
|
`));
|
|
8268
|
-
console.log(` ${
|
|
8299
|
+
console.log(` ${chalk97.cyan("Functions to move:")}`);
|
|
8269
8300
|
for (const name of plan2.extractedNames) {
|
|
8270
8301
|
console.log(` ${name}`);
|
|
8271
8302
|
}
|
|
@@ -8300,7 +8331,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
8300
8331
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
8301
8332
|
import fs17 from "fs";
|
|
8302
8333
|
import path32 from "path";
|
|
8303
|
-
import
|
|
8334
|
+
import chalk98 from "chalk";
|
|
8304
8335
|
import { Project as Project2 } from "ts-morph";
|
|
8305
8336
|
function findTsConfig(sourcePath) {
|
|
8306
8337
|
const rootConfig = path32.resolve("tsconfig.json");
|
|
@@ -8331,7 +8362,7 @@ function loadProjectFile(file) {
|
|
|
8331
8362
|
});
|
|
8332
8363
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
8333
8364
|
if (!sourceFile) {
|
|
8334
|
-
console.log(
|
|
8365
|
+
console.log(chalk98.red(`File not found in project: ${file}`));
|
|
8335
8366
|
process.exit(1);
|
|
8336
8367
|
}
|
|
8337
8368
|
return { project, sourceFile };
|
|
@@ -8354,19 +8385,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
8354
8385
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
8355
8386
|
if (options2.apply) {
|
|
8356
8387
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
8357
|
-
console.log(
|
|
8388
|
+
console.log(chalk99.green("\nExtraction complete"));
|
|
8358
8389
|
} else {
|
|
8359
|
-
console.log(
|
|
8390
|
+
console.log(chalk99.dim("\nDry run. Use --apply to execute."));
|
|
8360
8391
|
}
|
|
8361
8392
|
}
|
|
8362
8393
|
|
|
8363
8394
|
// src/commands/refactor/ignore.ts
|
|
8364
8395
|
import fs18 from "fs";
|
|
8365
|
-
import
|
|
8396
|
+
import chalk100 from "chalk";
|
|
8366
8397
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
8367
8398
|
function ignore(file) {
|
|
8368
8399
|
if (!fs18.existsSync(file)) {
|
|
8369
|
-
console.error(
|
|
8400
|
+
console.error(chalk100.red(`Error: File does not exist: ${file}`));
|
|
8370
8401
|
process.exit(1);
|
|
8371
8402
|
}
|
|
8372
8403
|
const content = fs18.readFileSync(file, "utf-8");
|
|
@@ -8382,7 +8413,7 @@ function ignore(file) {
|
|
|
8382
8413
|
fs18.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
8383
8414
|
}
|
|
8384
8415
|
console.log(
|
|
8385
|
-
|
|
8416
|
+
chalk100.green(
|
|
8386
8417
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
8387
8418
|
)
|
|
8388
8419
|
);
|
|
@@ -8390,26 +8421,26 @@ function ignore(file) {
|
|
|
8390
8421
|
|
|
8391
8422
|
// src/commands/refactor/rename/index.ts
|
|
8392
8423
|
import path34 from "path";
|
|
8393
|
-
import
|
|
8424
|
+
import chalk101 from "chalk";
|
|
8394
8425
|
async function rename(source, destination, options2 = {}) {
|
|
8395
8426
|
const destPath = path34.resolve(destination);
|
|
8396
8427
|
const cwd = process.cwd();
|
|
8397
8428
|
const relSource = path34.relative(cwd, path34.resolve(source));
|
|
8398
8429
|
const relDest = path34.relative(cwd, destPath);
|
|
8399
8430
|
const { project, sourceFile } = loadProjectFile(source);
|
|
8400
|
-
console.log(
|
|
8431
|
+
console.log(chalk101.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
8401
8432
|
if (options2.apply) {
|
|
8402
8433
|
sourceFile.move(destPath);
|
|
8403
8434
|
await project.save();
|
|
8404
|
-
console.log(
|
|
8435
|
+
console.log(chalk101.green("Done"));
|
|
8405
8436
|
} else {
|
|
8406
|
-
console.log(
|
|
8437
|
+
console.log(chalk101.dim("Dry run. Use --apply to execute."));
|
|
8407
8438
|
}
|
|
8408
8439
|
}
|
|
8409
8440
|
|
|
8410
8441
|
// src/commands/refactor/renameSymbol/index.ts
|
|
8411
8442
|
import path36 from "path";
|
|
8412
|
-
import
|
|
8443
|
+
import chalk102 from "chalk";
|
|
8413
8444
|
import { Project as Project3 } from "ts-morph";
|
|
8414
8445
|
|
|
8415
8446
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
@@ -8458,38 +8489,38 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
8458
8489
|
const project = new Project3({ tsConfigFilePath: tsConfigPath });
|
|
8459
8490
|
const sourceFile = project.getSourceFile(filePath);
|
|
8460
8491
|
if (!sourceFile) {
|
|
8461
|
-
console.log(
|
|
8492
|
+
console.log(chalk102.red(`File not found in project: ${file}`));
|
|
8462
8493
|
process.exit(1);
|
|
8463
8494
|
}
|
|
8464
8495
|
const symbol = findSymbol(sourceFile, oldName);
|
|
8465
8496
|
if (!symbol) {
|
|
8466
|
-
console.log(
|
|
8497
|
+
console.log(chalk102.red(`Symbol "${oldName}" not found in ${file}`));
|
|
8467
8498
|
process.exit(1);
|
|
8468
8499
|
}
|
|
8469
8500
|
const grouped = groupReferences(symbol, cwd);
|
|
8470
8501
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
8471
8502
|
console.log(
|
|
8472
|
-
|
|
8503
|
+
chalk102.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
8473
8504
|
`)
|
|
8474
8505
|
);
|
|
8475
8506
|
for (const [refFile, lines] of grouped) {
|
|
8476
8507
|
console.log(
|
|
8477
|
-
` ${
|
|
8508
|
+
` ${chalk102.dim(refFile)}: lines ${chalk102.cyan(lines.join(", "))}`
|
|
8478
8509
|
);
|
|
8479
8510
|
}
|
|
8480
8511
|
if (options2.apply) {
|
|
8481
8512
|
symbol.rename(newName);
|
|
8482
8513
|
await project.save();
|
|
8483
|
-
console.log(
|
|
8514
|
+
console.log(chalk102.green(`
|
|
8484
8515
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
8485
8516
|
} else {
|
|
8486
|
-
console.log(
|
|
8517
|
+
console.log(chalk102.dim("\nDry run. Use --apply to execute."));
|
|
8487
8518
|
}
|
|
8488
8519
|
}
|
|
8489
8520
|
|
|
8490
8521
|
// src/commands/refactor/restructure/index.ts
|
|
8491
8522
|
import path45 from "path";
|
|
8492
|
-
import
|
|
8523
|
+
import chalk105 from "chalk";
|
|
8493
8524
|
|
|
8494
8525
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
8495
8526
|
import path37 from "path";
|
|
@@ -8732,50 +8763,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
8732
8763
|
|
|
8733
8764
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
8734
8765
|
import path41 from "path";
|
|
8735
|
-
import
|
|
8766
|
+
import chalk103 from "chalk";
|
|
8736
8767
|
function relPath(filePath) {
|
|
8737
8768
|
return path41.relative(process.cwd(), filePath);
|
|
8738
8769
|
}
|
|
8739
8770
|
function displayMoves(plan2) {
|
|
8740
8771
|
if (plan2.moves.length === 0) return;
|
|
8741
|
-
console.log(
|
|
8772
|
+
console.log(chalk103.bold("\nFile moves:"));
|
|
8742
8773
|
for (const move of plan2.moves) {
|
|
8743
8774
|
console.log(
|
|
8744
|
-
` ${
|
|
8775
|
+
` ${chalk103.red(relPath(move.from))} \u2192 ${chalk103.green(relPath(move.to))}`
|
|
8745
8776
|
);
|
|
8746
|
-
console.log(
|
|
8777
|
+
console.log(chalk103.dim(` ${move.reason}`));
|
|
8747
8778
|
}
|
|
8748
8779
|
}
|
|
8749
8780
|
function displayRewrites(rewrites) {
|
|
8750
8781
|
if (rewrites.length === 0) return;
|
|
8751
8782
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
8752
|
-
console.log(
|
|
8783
|
+
console.log(chalk103.bold(`
|
|
8753
8784
|
Import rewrites (${affectedFiles.size} files):`));
|
|
8754
8785
|
for (const file of affectedFiles) {
|
|
8755
|
-
console.log(` ${
|
|
8786
|
+
console.log(` ${chalk103.cyan(relPath(file))}:`);
|
|
8756
8787
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
8757
8788
|
(r) => r.file === file
|
|
8758
8789
|
)) {
|
|
8759
8790
|
console.log(
|
|
8760
|
-
` ${
|
|
8791
|
+
` ${chalk103.red(`"${oldSpecifier}"`)} \u2192 ${chalk103.green(`"${newSpecifier}"`)}`
|
|
8761
8792
|
);
|
|
8762
8793
|
}
|
|
8763
8794
|
}
|
|
8764
8795
|
}
|
|
8765
8796
|
function displayPlan2(plan2) {
|
|
8766
8797
|
if (plan2.warnings.length > 0) {
|
|
8767
|
-
console.log(
|
|
8768
|
-
for (const w of plan2.warnings) console.log(
|
|
8798
|
+
console.log(chalk103.yellow("\nWarnings:"));
|
|
8799
|
+
for (const w of plan2.warnings) console.log(chalk103.yellow(` ${w}`));
|
|
8769
8800
|
}
|
|
8770
8801
|
if (plan2.newDirectories.length > 0) {
|
|
8771
|
-
console.log(
|
|
8802
|
+
console.log(chalk103.bold("\nNew directories:"));
|
|
8772
8803
|
for (const dir of plan2.newDirectories)
|
|
8773
|
-
console.log(
|
|
8804
|
+
console.log(chalk103.green(` ${dir}/`));
|
|
8774
8805
|
}
|
|
8775
8806
|
displayMoves(plan2);
|
|
8776
8807
|
displayRewrites(plan2.rewrites);
|
|
8777
8808
|
console.log(
|
|
8778
|
-
|
|
8809
|
+
chalk103.dim(
|
|
8779
8810
|
`
|
|
8780
8811
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
8781
8812
|
)
|
|
@@ -8785,18 +8816,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
8785
8816
|
// src/commands/refactor/restructure/executePlan.ts
|
|
8786
8817
|
import fs20 from "fs";
|
|
8787
8818
|
import path42 from "path";
|
|
8788
|
-
import
|
|
8819
|
+
import chalk104 from "chalk";
|
|
8789
8820
|
function executePlan(plan2) {
|
|
8790
8821
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
8791
8822
|
for (const [file, content] of updatedContents) {
|
|
8792
8823
|
fs20.writeFileSync(file, content, "utf-8");
|
|
8793
8824
|
console.log(
|
|
8794
|
-
|
|
8825
|
+
chalk104.cyan(` Rewrote imports in ${path42.relative(process.cwd(), file)}`)
|
|
8795
8826
|
);
|
|
8796
8827
|
}
|
|
8797
8828
|
for (const dir of plan2.newDirectories) {
|
|
8798
8829
|
fs20.mkdirSync(dir, { recursive: true });
|
|
8799
|
-
console.log(
|
|
8830
|
+
console.log(chalk104.green(` Created ${path42.relative(process.cwd(), dir)}/`));
|
|
8800
8831
|
}
|
|
8801
8832
|
for (const move of plan2.moves) {
|
|
8802
8833
|
const targetDir = path42.dirname(move.to);
|
|
@@ -8805,7 +8836,7 @@ function executePlan(plan2) {
|
|
|
8805
8836
|
}
|
|
8806
8837
|
fs20.renameSync(move.from, move.to);
|
|
8807
8838
|
console.log(
|
|
8808
|
-
|
|
8839
|
+
chalk104.white(
|
|
8809
8840
|
` Moved ${path42.relative(process.cwd(), move.from)} \u2192 ${path42.relative(process.cwd(), move.to)}`
|
|
8810
8841
|
)
|
|
8811
8842
|
);
|
|
@@ -8820,7 +8851,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
8820
8851
|
if (entries.length === 0) {
|
|
8821
8852
|
fs20.rmdirSync(dir);
|
|
8822
8853
|
console.log(
|
|
8823
|
-
|
|
8854
|
+
chalk104.dim(
|
|
8824
8855
|
` Removed empty directory ${path42.relative(process.cwd(), dir)}`
|
|
8825
8856
|
)
|
|
8826
8857
|
);
|
|
@@ -8953,22 +8984,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
8953
8984
|
const targetPattern = pattern2 ?? "src";
|
|
8954
8985
|
const files = findSourceFiles2(targetPattern);
|
|
8955
8986
|
if (files.length === 0) {
|
|
8956
|
-
console.log(
|
|
8987
|
+
console.log(chalk105.yellow("No files found matching pattern"));
|
|
8957
8988
|
return;
|
|
8958
8989
|
}
|
|
8959
8990
|
const tsConfigPath = path45.resolve("tsconfig.json");
|
|
8960
8991
|
const plan2 = buildPlan2(files, tsConfigPath);
|
|
8961
8992
|
if (plan2.moves.length === 0) {
|
|
8962
|
-
console.log(
|
|
8993
|
+
console.log(chalk105.green("No restructuring needed"));
|
|
8963
8994
|
return;
|
|
8964
8995
|
}
|
|
8965
8996
|
displayPlan2(plan2);
|
|
8966
8997
|
if (options2.apply) {
|
|
8967
|
-
console.log(
|
|
8998
|
+
console.log(chalk105.bold("\nApplying changes..."));
|
|
8968
8999
|
executePlan(plan2);
|
|
8969
|
-
console.log(
|
|
9000
|
+
console.log(chalk105.green("\nRestructuring complete"));
|
|
8970
9001
|
} else {
|
|
8971
|
-
console.log(
|
|
9002
|
+
console.log(chalk105.dim("\nDry run. Use --apply to execute."));
|
|
8972
9003
|
}
|
|
8973
9004
|
}
|
|
8974
9005
|
|
|
@@ -9008,7 +9039,7 @@ function registerRefactor(program2) {
|
|
|
9008
9039
|
}
|
|
9009
9040
|
|
|
9010
9041
|
// src/commands/seq/seqAuth.ts
|
|
9011
|
-
import
|
|
9042
|
+
import chalk107 from "chalk";
|
|
9012
9043
|
|
|
9013
9044
|
// src/commands/seq/loadConnections.ts
|
|
9014
9045
|
function loadConnections2() {
|
|
@@ -9037,11 +9068,11 @@ function setDefaultConnection(name) {
|
|
|
9037
9068
|
}
|
|
9038
9069
|
|
|
9039
9070
|
// src/commands/seq/promptConnection.ts
|
|
9040
|
-
import
|
|
9071
|
+
import chalk106 from "chalk";
|
|
9041
9072
|
async function promptConnection2(existingNames) {
|
|
9042
9073
|
const name = await promptInput("name", "Connection name:", "default");
|
|
9043
9074
|
if (existingNames.includes(name)) {
|
|
9044
|
-
console.error(
|
|
9075
|
+
console.error(chalk106.red(`Connection "${name}" already exists.`));
|
|
9045
9076
|
process.exit(1);
|
|
9046
9077
|
}
|
|
9047
9078
|
const url = await promptInput("url", "Seq URL:", "http://localhost:5341");
|
|
@@ -9053,16 +9084,16 @@ async function promptConnection2(existingNames) {
|
|
|
9053
9084
|
var seqAuth = createConnectionAuth({
|
|
9054
9085
|
load: loadConnections2,
|
|
9055
9086
|
save: saveConnections2,
|
|
9056
|
-
format: (c) => `${
|
|
9087
|
+
format: (c) => `${chalk107.bold(c.name)} ${c.url}`,
|
|
9057
9088
|
promptNew: promptConnection2,
|
|
9058
9089
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
9059
9090
|
});
|
|
9060
9091
|
|
|
9061
9092
|
// src/commands/seq/seqQuery.ts
|
|
9062
|
-
import
|
|
9093
|
+
import chalk111 from "chalk";
|
|
9063
9094
|
|
|
9064
9095
|
// src/commands/seq/fetchSeqEvents.ts
|
|
9065
|
-
import
|
|
9096
|
+
import chalk108 from "chalk";
|
|
9066
9097
|
async function fetchSeqEvents(conn, params) {
|
|
9067
9098
|
const url = `${conn.url}/api/events?${params}`;
|
|
9068
9099
|
const response = await fetch(url, {
|
|
@@ -9073,30 +9104,30 @@ async function fetchSeqEvents(conn, params) {
|
|
|
9073
9104
|
});
|
|
9074
9105
|
if (!response.ok) {
|
|
9075
9106
|
const body = await response.text();
|
|
9076
|
-
console.error(
|
|
9107
|
+
console.error(chalk108.red(`Seq returned ${response.status}: ${body}`));
|
|
9077
9108
|
process.exit(1);
|
|
9078
9109
|
}
|
|
9079
9110
|
return response.json();
|
|
9080
9111
|
}
|
|
9081
9112
|
|
|
9082
9113
|
// src/commands/seq/formatEvent.ts
|
|
9083
|
-
import
|
|
9114
|
+
import chalk109 from "chalk";
|
|
9084
9115
|
function levelColor(level) {
|
|
9085
9116
|
switch (level) {
|
|
9086
9117
|
case "Fatal":
|
|
9087
|
-
return
|
|
9118
|
+
return chalk109.bgRed.white;
|
|
9088
9119
|
case "Error":
|
|
9089
|
-
return
|
|
9120
|
+
return chalk109.red;
|
|
9090
9121
|
case "Warning":
|
|
9091
|
-
return
|
|
9122
|
+
return chalk109.yellow;
|
|
9092
9123
|
case "Information":
|
|
9093
|
-
return
|
|
9124
|
+
return chalk109.cyan;
|
|
9094
9125
|
case "Debug":
|
|
9095
|
-
return
|
|
9126
|
+
return chalk109.gray;
|
|
9096
9127
|
case "Verbose":
|
|
9097
|
-
return
|
|
9128
|
+
return chalk109.dim;
|
|
9098
9129
|
default:
|
|
9099
|
-
return
|
|
9130
|
+
return chalk109.white;
|
|
9100
9131
|
}
|
|
9101
9132
|
}
|
|
9102
9133
|
function levelAbbrev(level) {
|
|
@@ -9137,31 +9168,31 @@ function formatTimestamp(iso) {
|
|
|
9137
9168
|
function formatEvent(event) {
|
|
9138
9169
|
const color = levelColor(event.Level);
|
|
9139
9170
|
const abbrev = levelAbbrev(event.Level);
|
|
9140
|
-
const ts8 =
|
|
9171
|
+
const ts8 = chalk109.dim(formatTimestamp(event.Timestamp));
|
|
9141
9172
|
const msg = renderMessage(event);
|
|
9142
9173
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
9143
9174
|
if (event.Exception) {
|
|
9144
9175
|
for (const line of event.Exception.split("\n")) {
|
|
9145
|
-
lines.push(
|
|
9176
|
+
lines.push(chalk109.red(` ${line}`));
|
|
9146
9177
|
}
|
|
9147
9178
|
}
|
|
9148
9179
|
return lines.join("\n");
|
|
9149
9180
|
}
|
|
9150
9181
|
|
|
9151
9182
|
// src/commands/seq/resolveConnection.ts
|
|
9152
|
-
import
|
|
9183
|
+
import chalk110 from "chalk";
|
|
9153
9184
|
function resolveConnection2(name) {
|
|
9154
9185
|
const connections = loadConnections2();
|
|
9155
9186
|
if (connections.length === 0) {
|
|
9156
9187
|
console.error(
|
|
9157
|
-
|
|
9188
|
+
chalk110.red("No Seq connections configured. Run 'assist seq auth' first.")
|
|
9158
9189
|
);
|
|
9159
9190
|
process.exit(1);
|
|
9160
9191
|
}
|
|
9161
9192
|
const target = name ?? getDefaultConnection() ?? connections[0].name;
|
|
9162
9193
|
const connection = connections.find((c) => c.name === target);
|
|
9163
9194
|
if (!connection) {
|
|
9164
|
-
console.error(
|
|
9195
|
+
console.error(chalk110.red(`Seq connection "${target}" not found.`));
|
|
9165
9196
|
process.exit(1);
|
|
9166
9197
|
}
|
|
9167
9198
|
return connection;
|
|
@@ -9177,7 +9208,7 @@ async function seqQuery(filter, options2) {
|
|
|
9177
9208
|
}
|
|
9178
9209
|
const events = await fetchSeqEvents(conn, params);
|
|
9179
9210
|
if (events.length === 0) {
|
|
9180
|
-
console.log(
|
|
9211
|
+
console.log(chalk111.yellow("No events found."));
|
|
9181
9212
|
return;
|
|
9182
9213
|
}
|
|
9183
9214
|
if (options2.json) {
|
|
@@ -9188,11 +9219,11 @@ async function seqQuery(filter, options2) {
|
|
|
9188
9219
|
for (const event of chronological) {
|
|
9189
9220
|
console.log(formatEvent(event));
|
|
9190
9221
|
}
|
|
9191
|
-
console.log(
|
|
9222
|
+
console.log(chalk111.dim(`
|
|
9192
9223
|
${events.length} events`));
|
|
9193
9224
|
if (events.length >= count) {
|
|
9194
9225
|
console.log(
|
|
9195
|
-
|
|
9226
|
+
chalk111.yellow(
|
|
9196
9227
|
`Results limited to ${count}. Use --count to retrieve more.`
|
|
9197
9228
|
)
|
|
9198
9229
|
);
|
|
@@ -9200,11 +9231,11 @@ ${events.length} events`));
|
|
|
9200
9231
|
}
|
|
9201
9232
|
|
|
9202
9233
|
// src/commands/seq/seqSetConnection.ts
|
|
9203
|
-
import
|
|
9234
|
+
import chalk112 from "chalk";
|
|
9204
9235
|
function seqSetConnection(name) {
|
|
9205
9236
|
const connections = loadConnections2();
|
|
9206
9237
|
if (!connections.find((c) => c.name === name)) {
|
|
9207
|
-
console.error(
|
|
9238
|
+
console.error(chalk112.red(`Connection "${name}" not found.`));
|
|
9208
9239
|
process.exit(1);
|
|
9209
9240
|
}
|
|
9210
9241
|
setDefaultConnection(name);
|
|
@@ -9223,7 +9254,7 @@ function registerSeq(program2) {
|
|
|
9223
9254
|
}
|
|
9224
9255
|
|
|
9225
9256
|
// src/commands/transcript/shared.ts
|
|
9226
|
-
import { existsSync as
|
|
9257
|
+
import { existsSync as existsSync32, readdirSync as readdirSync5, statSync as statSync2 } from "fs";
|
|
9227
9258
|
import { basename as basename4, join as join26, relative } from "path";
|
|
9228
9259
|
import * as readline2 from "readline";
|
|
9229
9260
|
var DATE_PREFIX_REGEX = /^\d{4}-\d{2}-\d{2}/;
|
|
@@ -9239,7 +9270,7 @@ function isValidDatePrefix(filename) {
|
|
|
9239
9270
|
return DATE_PREFIX_REGEX.test(filename);
|
|
9240
9271
|
}
|
|
9241
9272
|
function collectFiles(dir, extension) {
|
|
9242
|
-
if (!
|
|
9273
|
+
if (!existsSync32(dir)) return [];
|
|
9243
9274
|
const results = [];
|
|
9244
9275
|
for (const entry of readdirSync5(dir)) {
|
|
9245
9276
|
const fullPath = join26(dir, entry);
|
|
@@ -9336,7 +9367,7 @@ async function configure() {
|
|
|
9336
9367
|
}
|
|
9337
9368
|
|
|
9338
9369
|
// src/commands/transcript/format/index.ts
|
|
9339
|
-
import { existsSync as
|
|
9370
|
+
import { existsSync as existsSync34 } from "fs";
|
|
9340
9371
|
|
|
9341
9372
|
// src/commands/transcript/format/fixInvalidDatePrefixes/index.ts
|
|
9342
9373
|
import { dirname as dirname18, join as join28 } from "path";
|
|
@@ -9410,7 +9441,7 @@ async function fixInvalidDatePrefixes(vttFiles) {
|
|
|
9410
9441
|
}
|
|
9411
9442
|
|
|
9412
9443
|
// src/commands/transcript/format/processVttFile/index.ts
|
|
9413
|
-
import { existsSync as
|
|
9444
|
+
import { existsSync as existsSync33, mkdirSync as mkdirSync7, readFileSync as readFileSync26, writeFileSync as writeFileSync24 } from "fs";
|
|
9414
9445
|
import { basename as basename5, dirname as dirname19, join as join29 } from "path";
|
|
9415
9446
|
|
|
9416
9447
|
// src/commands/transcript/cleanText.ts
|
|
@@ -9635,7 +9666,7 @@ function logSkipped(relativeDir, mdFile) {
|
|
|
9635
9666
|
return "skipped";
|
|
9636
9667
|
}
|
|
9637
9668
|
function ensureDirectory(dir, label2) {
|
|
9638
|
-
if (!
|
|
9669
|
+
if (!existsSync33(dir)) {
|
|
9639
9670
|
mkdirSync7(dir, { recursive: true });
|
|
9640
9671
|
console.log(`Created ${label2}: ${dir}`);
|
|
9641
9672
|
}
|
|
@@ -9658,7 +9689,7 @@ function logReduction(cueCount, messageCount) {
|
|
|
9658
9689
|
}
|
|
9659
9690
|
function readAndParseCues(inputPath) {
|
|
9660
9691
|
console.log(`Reading: ${inputPath}`);
|
|
9661
|
-
return processCues(
|
|
9692
|
+
return processCues(readFileSync26(inputPath, "utf-8"));
|
|
9662
9693
|
}
|
|
9663
9694
|
function writeFormatted(outputPath, content) {
|
|
9664
9695
|
writeFileSync24(outputPath, content, "utf-8");
|
|
@@ -9671,7 +9702,7 @@ function convertVttToMarkdown(inputPath, outputPath) {
|
|
|
9671
9702
|
logReduction(cues.length, chatMessages.length);
|
|
9672
9703
|
}
|
|
9673
9704
|
function tryProcessVtt(vttFile, paths) {
|
|
9674
|
-
if (
|
|
9705
|
+
if (existsSync33(paths.outputPath))
|
|
9675
9706
|
return logSkipped(paths.relativeDir, paths.mdFile);
|
|
9676
9707
|
convertVttToMarkdown(vttFile.absolutePath, paths.outputPath);
|
|
9677
9708
|
return "processed";
|
|
@@ -9697,7 +9728,7 @@ function processAllFiles(vttFiles, transcriptsDir) {
|
|
|
9697
9728
|
logSummary(counts);
|
|
9698
9729
|
}
|
|
9699
9730
|
function requireVttDir(vttDir) {
|
|
9700
|
-
if (!
|
|
9731
|
+
if (!existsSync34(vttDir)) {
|
|
9701
9732
|
console.error(`VTT directory not found: ${vttDir}`);
|
|
9702
9733
|
process.exit(1);
|
|
9703
9734
|
}
|
|
@@ -9729,28 +9760,28 @@ async function format() {
|
|
|
9729
9760
|
}
|
|
9730
9761
|
|
|
9731
9762
|
// src/commands/transcript/summarise/index.ts
|
|
9732
|
-
import { existsSync as
|
|
9763
|
+
import { existsSync as existsSync36 } from "fs";
|
|
9733
9764
|
import { basename as basename6, dirname as dirname21, join as join31, relative as relative2 } from "path";
|
|
9734
9765
|
|
|
9735
9766
|
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
9736
9767
|
import {
|
|
9737
|
-
existsSync as
|
|
9768
|
+
existsSync as existsSync35,
|
|
9738
9769
|
mkdirSync as mkdirSync8,
|
|
9739
|
-
readFileSync as
|
|
9770
|
+
readFileSync as readFileSync27,
|
|
9740
9771
|
renameSync as renameSync2,
|
|
9741
9772
|
rmSync
|
|
9742
9773
|
} from "fs";
|
|
9743
9774
|
import { dirname as dirname20, join as join30 } from "path";
|
|
9744
9775
|
|
|
9745
9776
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
9746
|
-
import
|
|
9777
|
+
import chalk113 from "chalk";
|
|
9747
9778
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
9748
9779
|
function validateStagedContent(filename, content) {
|
|
9749
9780
|
const firstLine = content.split("\n")[0];
|
|
9750
9781
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
9751
9782
|
if (!match) {
|
|
9752
9783
|
console.error(
|
|
9753
|
-
|
|
9784
|
+
chalk113.red(
|
|
9754
9785
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
9755
9786
|
)
|
|
9756
9787
|
);
|
|
@@ -9759,7 +9790,7 @@ function validateStagedContent(filename, content) {
|
|
|
9759
9790
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
9760
9791
|
if (!contentAfterLink) {
|
|
9761
9792
|
console.error(
|
|
9762
|
-
|
|
9793
|
+
chalk113.red(
|
|
9763
9794
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
9764
9795
|
)
|
|
9765
9796
|
);
|
|
@@ -9771,7 +9802,7 @@ function validateStagedContent(filename, content) {
|
|
|
9771
9802
|
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
9772
9803
|
var STAGING_DIR = join30(process.cwd(), ".assist", "transcript");
|
|
9773
9804
|
function processStagedFile() {
|
|
9774
|
-
if (!
|
|
9805
|
+
if (!existsSync35(STAGING_DIR)) {
|
|
9775
9806
|
return false;
|
|
9776
9807
|
}
|
|
9777
9808
|
const stagedFiles = findMdFilesRecursive(STAGING_DIR);
|
|
@@ -9780,7 +9811,7 @@ function processStagedFile() {
|
|
|
9780
9811
|
}
|
|
9781
9812
|
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
9782
9813
|
const stagedFile = stagedFiles[0];
|
|
9783
|
-
const content =
|
|
9814
|
+
const content = readFileSync27(stagedFile.absolutePath, "utf-8");
|
|
9784
9815
|
validateStagedContent(stagedFile.filename, content);
|
|
9785
9816
|
const stagedBaseName = getTranscriptBaseName(stagedFile.filename);
|
|
9786
9817
|
const transcriptFiles = findMdFilesRecursive(transcriptsDir);
|
|
@@ -9795,7 +9826,7 @@ function processStagedFile() {
|
|
|
9795
9826
|
}
|
|
9796
9827
|
const destPath = join30(summaryDir, matchingTranscript.relativePath);
|
|
9797
9828
|
const destDir = dirname20(destPath);
|
|
9798
|
-
if (!
|
|
9829
|
+
if (!existsSync35(destDir)) {
|
|
9799
9830
|
mkdirSync8(destDir, { recursive: true });
|
|
9800
9831
|
}
|
|
9801
9832
|
renameSync2(stagedFile.absolutePath, destPath);
|
|
@@ -9822,7 +9853,7 @@ function buildSummaryIndex(summaryDir) {
|
|
|
9822
9853
|
function summarise2() {
|
|
9823
9854
|
processStagedFile();
|
|
9824
9855
|
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
9825
|
-
if (!
|
|
9856
|
+
if (!existsSync36(transcriptsDir)) {
|
|
9826
9857
|
console.log("No transcripts directory found.");
|
|
9827
9858
|
return;
|
|
9828
9859
|
}
|
|
@@ -9926,14 +9957,14 @@ function devices() {
|
|
|
9926
9957
|
}
|
|
9927
9958
|
|
|
9928
9959
|
// src/commands/voice/logs.ts
|
|
9929
|
-
import { existsSync as
|
|
9960
|
+
import { existsSync as existsSync37, readFileSync as readFileSync28 } from "fs";
|
|
9930
9961
|
function logs(options2) {
|
|
9931
|
-
if (!
|
|
9962
|
+
if (!existsSync37(voicePaths.log)) {
|
|
9932
9963
|
console.log("No voice log file found");
|
|
9933
9964
|
return;
|
|
9934
9965
|
}
|
|
9935
9966
|
const count = Number.parseInt(options2.lines ?? "150", 10);
|
|
9936
|
-
const content =
|
|
9967
|
+
const content = readFileSync28(voicePaths.log, "utf-8").trim();
|
|
9937
9968
|
if (!content) {
|
|
9938
9969
|
console.log("Voice log is empty");
|
|
9939
9970
|
return;
|
|
@@ -9960,7 +9991,7 @@ import { join as join35 } from "path";
|
|
|
9960
9991
|
|
|
9961
9992
|
// src/commands/voice/checkLockFile.ts
|
|
9962
9993
|
import { execSync as execSync37 } from "child_process";
|
|
9963
|
-
import { existsSync as
|
|
9994
|
+
import { existsSync as existsSync38, mkdirSync as mkdirSync9, readFileSync as readFileSync29, writeFileSync as writeFileSync25 } from "fs";
|
|
9964
9995
|
import { join as join34 } from "path";
|
|
9965
9996
|
function isProcessAlive2(pid) {
|
|
9966
9997
|
try {
|
|
@@ -9972,9 +10003,9 @@ function isProcessAlive2(pid) {
|
|
|
9972
10003
|
}
|
|
9973
10004
|
function checkLockFile() {
|
|
9974
10005
|
const lockFile = getLockFile();
|
|
9975
|
-
if (!
|
|
10006
|
+
if (!existsSync38(lockFile)) return;
|
|
9976
10007
|
try {
|
|
9977
|
-
const lock = JSON.parse(
|
|
10008
|
+
const lock = JSON.parse(readFileSync29(lockFile, "utf-8"));
|
|
9978
10009
|
if (lock.pid && isProcessAlive2(lock.pid)) {
|
|
9979
10010
|
console.error(
|
|
9980
10011
|
`Voice daemon already running (PID ${lock.pid}, env: ${lock.env}). Stop it first with: assist voice stop`
|
|
@@ -9985,7 +10016,7 @@ function checkLockFile() {
|
|
|
9985
10016
|
}
|
|
9986
10017
|
}
|
|
9987
10018
|
function bootstrapVenv() {
|
|
9988
|
-
if (
|
|
10019
|
+
if (existsSync38(getVenvPython())) return;
|
|
9989
10020
|
console.log("Setting up Python environment...");
|
|
9990
10021
|
const pythonDir = getPythonDir();
|
|
9991
10022
|
execSync37(
|
|
@@ -10076,7 +10107,7 @@ function start2(options2) {
|
|
|
10076
10107
|
}
|
|
10077
10108
|
|
|
10078
10109
|
// src/commands/voice/status.ts
|
|
10079
|
-
import { existsSync as
|
|
10110
|
+
import { existsSync as existsSync39, readFileSync as readFileSync30 } from "fs";
|
|
10080
10111
|
function isProcessAlive3(pid) {
|
|
10081
10112
|
try {
|
|
10082
10113
|
process.kill(pid, 0);
|
|
@@ -10086,16 +10117,16 @@ function isProcessAlive3(pid) {
|
|
|
10086
10117
|
}
|
|
10087
10118
|
}
|
|
10088
10119
|
function readRecentLogs(count) {
|
|
10089
|
-
if (!
|
|
10090
|
-
const lines =
|
|
10120
|
+
if (!existsSync39(voicePaths.log)) return [];
|
|
10121
|
+
const lines = readFileSync30(voicePaths.log, "utf-8").trim().split("\n");
|
|
10091
10122
|
return lines.slice(-count);
|
|
10092
10123
|
}
|
|
10093
10124
|
function status() {
|
|
10094
|
-
if (!
|
|
10125
|
+
if (!existsSync39(voicePaths.pid)) {
|
|
10095
10126
|
console.log("Voice daemon: not running (no PID file)");
|
|
10096
10127
|
return;
|
|
10097
10128
|
}
|
|
10098
|
-
const pid = Number.parseInt(
|
|
10129
|
+
const pid = Number.parseInt(readFileSync30(voicePaths.pid, "utf-8").trim(), 10);
|
|
10099
10130
|
const alive = isProcessAlive3(pid);
|
|
10100
10131
|
console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
|
|
10101
10132
|
const recent = readRecentLogs(5);
|
|
@@ -10114,13 +10145,13 @@ function status() {
|
|
|
10114
10145
|
}
|
|
10115
10146
|
|
|
10116
10147
|
// src/commands/voice/stop.ts
|
|
10117
|
-
import { existsSync as
|
|
10148
|
+
import { existsSync as existsSync40, readFileSync as readFileSync31, unlinkSync as unlinkSync10 } from "fs";
|
|
10118
10149
|
function stop() {
|
|
10119
|
-
if (!
|
|
10150
|
+
if (!existsSync40(voicePaths.pid)) {
|
|
10120
10151
|
console.log("Voice daemon is not running (no PID file)");
|
|
10121
10152
|
return;
|
|
10122
10153
|
}
|
|
10123
|
-
const pid = Number.parseInt(
|
|
10154
|
+
const pid = Number.parseInt(readFileSync31(voicePaths.pid, "utf-8").trim(), 10);
|
|
10124
10155
|
try {
|
|
10125
10156
|
process.kill(pid, "SIGTERM");
|
|
10126
10157
|
console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
|
|
@@ -10133,7 +10164,7 @@ function stop() {
|
|
|
10133
10164
|
}
|
|
10134
10165
|
try {
|
|
10135
10166
|
const lockFile = getLockFile();
|
|
10136
|
-
if (
|
|
10167
|
+
if (existsSync40(lockFile)) unlinkSync10(lockFile);
|
|
10137
10168
|
} catch {
|
|
10138
10169
|
}
|
|
10139
10170
|
console.log("Voice daemon stopped");
|
|
@@ -10152,7 +10183,7 @@ function registerVoice(program2) {
|
|
|
10152
10183
|
|
|
10153
10184
|
// src/commands/roam/auth.ts
|
|
10154
10185
|
import { randomBytes } from "crypto";
|
|
10155
|
-
import
|
|
10186
|
+
import chalk114 from "chalk";
|
|
10156
10187
|
|
|
10157
10188
|
// src/lib/openBrowser.ts
|
|
10158
10189
|
import { execSync as execSync38 } from "child_process";
|
|
@@ -10327,13 +10358,13 @@ async function auth() {
|
|
|
10327
10358
|
saveGlobalConfig(config);
|
|
10328
10359
|
const state = randomBytes(16).toString("hex");
|
|
10329
10360
|
console.log(
|
|
10330
|
-
|
|
10361
|
+
chalk114.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
10331
10362
|
);
|
|
10332
|
-
console.log(
|
|
10333
|
-
console.log(
|
|
10334
|
-
console.log(
|
|
10363
|
+
console.log(chalk114.white("http://localhost:14523/callback\n"));
|
|
10364
|
+
console.log(chalk114.blue("Opening browser for authorization..."));
|
|
10365
|
+
console.log(chalk114.dim("Waiting for authorization callback..."));
|
|
10335
10366
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
10336
|
-
console.log(
|
|
10367
|
+
console.log(chalk114.dim("Exchanging code for tokens..."));
|
|
10337
10368
|
const tokens = await exchangeToken({
|
|
10338
10369
|
code,
|
|
10339
10370
|
clientId,
|
|
@@ -10349,12 +10380,12 @@ async function auth() {
|
|
|
10349
10380
|
};
|
|
10350
10381
|
saveGlobalConfig(config);
|
|
10351
10382
|
console.log(
|
|
10352
|
-
|
|
10383
|
+
chalk114.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
10353
10384
|
);
|
|
10354
10385
|
}
|
|
10355
10386
|
|
|
10356
10387
|
// src/commands/roam/showClaudeCodeIcon.ts
|
|
10357
|
-
import { readFileSync as
|
|
10388
|
+
import { readFileSync as readFileSync32 } from "fs";
|
|
10358
10389
|
import { join as join37 } from "path";
|
|
10359
10390
|
async function showClaudeCodeIcon() {
|
|
10360
10391
|
const appData = process.env.APPDATA;
|
|
@@ -10362,7 +10393,7 @@ async function showClaudeCodeIcon() {
|
|
|
10362
10393
|
const portFile = join37(appData, "Roam", "roam-local-api.port");
|
|
10363
10394
|
let port;
|
|
10364
10395
|
try {
|
|
10365
|
-
port =
|
|
10396
|
+
port = readFileSync32(portFile, "utf-8").trim();
|
|
10366
10397
|
} catch {
|
|
10367
10398
|
return;
|
|
10368
10399
|
}
|
|
@@ -10559,10 +10590,10 @@ function run3(name, args) {
|
|
|
10559
10590
|
|
|
10560
10591
|
// src/commands/screenshot/index.ts
|
|
10561
10592
|
import { execSync as execSync40 } from "child_process";
|
|
10562
|
-
import { existsSync as
|
|
10593
|
+
import { existsSync as existsSync41, mkdirSync as mkdirSync13, unlinkSync as unlinkSync11, writeFileSync as writeFileSync28 } from "fs";
|
|
10563
10594
|
import { tmpdir as tmpdir6 } from "os";
|
|
10564
10595
|
import { join as join39, resolve as resolve5 } from "path";
|
|
10565
|
-
import
|
|
10596
|
+
import chalk115 from "chalk";
|
|
10566
10597
|
|
|
10567
10598
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
10568
10599
|
var captureWindowPs1 = `
|
|
@@ -10691,7 +10722,7 @@ Write-Output $OutputPath
|
|
|
10691
10722
|
|
|
10692
10723
|
// src/commands/screenshot/index.ts
|
|
10693
10724
|
function buildOutputPath(outputDir, processName) {
|
|
10694
|
-
if (!
|
|
10725
|
+
if (!existsSync41(outputDir)) {
|
|
10695
10726
|
mkdirSync13(outputDir, { recursive: true });
|
|
10696
10727
|
}
|
|
10697
10728
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
@@ -10713,22 +10744,22 @@ function screenshot(processName) {
|
|
|
10713
10744
|
const config = loadConfig();
|
|
10714
10745
|
const outputDir = resolve5(config.screenshot.outputDir);
|
|
10715
10746
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
10716
|
-
console.log(
|
|
10747
|
+
console.log(chalk115.gray(`Capturing window for process "${processName}" ...`));
|
|
10717
10748
|
try {
|
|
10718
10749
|
runPowerShellScript(processName, outputPath);
|
|
10719
|
-
console.log(
|
|
10750
|
+
console.log(chalk115.green(`Screenshot saved: ${outputPath}`));
|
|
10720
10751
|
} catch (error) {
|
|
10721
10752
|
const msg = error instanceof Error ? error.message : String(error);
|
|
10722
|
-
console.error(
|
|
10753
|
+
console.error(chalk115.red(`Failed to capture screenshot: ${msg}`));
|
|
10723
10754
|
process.exit(1);
|
|
10724
10755
|
}
|
|
10725
10756
|
}
|
|
10726
10757
|
|
|
10727
10758
|
// src/commands/statusLine.ts
|
|
10728
|
-
import
|
|
10759
|
+
import chalk117 from "chalk";
|
|
10729
10760
|
|
|
10730
10761
|
// src/commands/buildLimitsSegment.ts
|
|
10731
|
-
import
|
|
10762
|
+
import chalk116 from "chalk";
|
|
10732
10763
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
10733
10764
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
10734
10765
|
function formatTimeLeft(resetsAt) {
|
|
@@ -10751,10 +10782,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
10751
10782
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
10752
10783
|
const label2 = `${Math.round(pct)}%`;
|
|
10753
10784
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
10754
|
-
if (projected == null) return
|
|
10755
|
-
if (projected > 100) return
|
|
10756
|
-
if (projected > 75) return
|
|
10757
|
-
return
|
|
10785
|
+
if (projected == null) return chalk116.green(label2);
|
|
10786
|
+
if (projected > 100) return chalk116.red(label2);
|
|
10787
|
+
if (projected > 75) return chalk116.yellow(label2);
|
|
10788
|
+
return chalk116.green(label2);
|
|
10758
10789
|
}
|
|
10759
10790
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
10760
10791
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -10780,14 +10811,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
10780
10811
|
}
|
|
10781
10812
|
|
|
10782
10813
|
// src/commands/statusLine.ts
|
|
10783
|
-
|
|
10814
|
+
chalk117.level = 3;
|
|
10784
10815
|
function formatNumber(num) {
|
|
10785
10816
|
return num.toLocaleString("en-US");
|
|
10786
10817
|
}
|
|
10787
10818
|
function colorizePercent(pct) {
|
|
10788
10819
|
const label2 = `${Math.round(pct)}%`;
|
|
10789
|
-
if (pct > 80) return
|
|
10790
|
-
if (pct > 40) return
|
|
10820
|
+
if (pct > 80) return chalk117.red(label2);
|
|
10821
|
+
if (pct > 40) return chalk117.yellow(label2);
|
|
10791
10822
|
return label2;
|
|
10792
10823
|
}
|
|
10793
10824
|
async function statusLine() {
|
|
@@ -10810,7 +10841,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
10810
10841
|
// src/commands/sync/syncClaudeMd.ts
|
|
10811
10842
|
import * as fs23 from "fs";
|
|
10812
10843
|
import * as path46 from "path";
|
|
10813
|
-
import
|
|
10844
|
+
import chalk118 from "chalk";
|
|
10814
10845
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
10815
10846
|
const source = path46.join(claudeDir, "CLAUDE.md");
|
|
10816
10847
|
const target = path46.join(targetBase, "CLAUDE.md");
|
|
@@ -10819,12 +10850,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
10819
10850
|
const targetContent = fs23.readFileSync(target, "utf-8");
|
|
10820
10851
|
if (sourceContent !== targetContent) {
|
|
10821
10852
|
console.log(
|
|
10822
|
-
|
|
10853
|
+
chalk118.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
10823
10854
|
);
|
|
10824
10855
|
console.log();
|
|
10825
10856
|
printDiff(targetContent, sourceContent);
|
|
10826
10857
|
const confirm = options2?.yes || await promptConfirm(
|
|
10827
|
-
|
|
10858
|
+
chalk118.red("Overwrite existing CLAUDE.md?"),
|
|
10828
10859
|
false
|
|
10829
10860
|
);
|
|
10830
10861
|
if (!confirm) {
|
|
@@ -10840,7 +10871,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
10840
10871
|
// src/commands/sync/syncSettings.ts
|
|
10841
10872
|
import * as fs24 from "fs";
|
|
10842
10873
|
import * as path47 from "path";
|
|
10843
|
-
import
|
|
10874
|
+
import chalk119 from "chalk";
|
|
10844
10875
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
10845
10876
|
const source = path47.join(claudeDir, "settings.json");
|
|
10846
10877
|
const target = path47.join(targetBase, "settings.json");
|
|
@@ -10856,14 +10887,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
10856
10887
|
if (mergedContent !== normalizedTarget) {
|
|
10857
10888
|
if (!options2?.yes) {
|
|
10858
10889
|
console.log(
|
|
10859
|
-
|
|
10890
|
+
chalk119.yellow(
|
|
10860
10891
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
10861
10892
|
)
|
|
10862
10893
|
);
|
|
10863
10894
|
console.log();
|
|
10864
10895
|
printDiff(targetContent, mergedContent);
|
|
10865
10896
|
const confirm = await promptConfirm(
|
|
10866
|
-
|
|
10897
|
+
chalk119.red("Overwrite existing settings.json?"),
|
|
10867
10898
|
false
|
|
10868
10899
|
);
|
|
10869
10900
|
if (!confirm) {
|