@staff0rd/assist 0.114.0 → 0.116.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/claude/CLAUDE.md +4 -0
- package/claude/settings.json +1 -0
- package/dist/commands/backlog/web/bundle.js +14 -14
- package/dist/index.js +184 -138
- 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.116.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -2622,6 +2622,9 @@ function readBody(req) {
|
|
|
2622
2622
|
async function parseItemBody(req) {
|
|
2623
2623
|
return JSON.parse(await readBody(req));
|
|
2624
2624
|
}
|
|
2625
|
+
async function parseStatusBody(req) {
|
|
2626
|
+
return JSON.parse(await readBody(req));
|
|
2627
|
+
}
|
|
2625
2628
|
|
|
2626
2629
|
// src/commands/backlog/web/shared.ts
|
|
2627
2630
|
function listItems(_req, res) {
|
|
@@ -2674,6 +2677,14 @@ async function updateItem(req, res, id) {
|
|
|
2674
2677
|
saveBacklog(result.items);
|
|
2675
2678
|
respondJson(res, 200, result.item);
|
|
2676
2679
|
}
|
|
2680
|
+
async function patchItemStatus(req, res, id) {
|
|
2681
|
+
const { status: status2 } = await parseStatusBody(req);
|
|
2682
|
+
const result = findItemOr404(res, id);
|
|
2683
|
+
if (!result) return;
|
|
2684
|
+
result.item.status = status2;
|
|
2685
|
+
saveBacklog(result.items);
|
|
2686
|
+
respondJson(res, 200, result.item);
|
|
2687
|
+
}
|
|
2677
2688
|
|
|
2678
2689
|
// src/commands/backlog/web/handleRequest.ts
|
|
2679
2690
|
var routes = {
|
|
@@ -2688,6 +2699,7 @@ var routes = {
|
|
|
2688
2699
|
var itemRoutes = {
|
|
2689
2700
|
GET: (_req, res, id) => getItemById(res, id),
|
|
2690
2701
|
PUT: (req, res, id) => updateItem(req, res, id),
|
|
2702
|
+
PATCH: (req, res, id) => patchItemStatus(req, res, id),
|
|
2691
2703
|
DELETE: (_req, res, id) => deleteItem(res, id)
|
|
2692
2704
|
};
|
|
2693
2705
|
var baseHandler = createRouteHandler(routes);
|
|
@@ -4417,8 +4429,7 @@ function registerDevlog(program2) {
|
|
|
4417
4429
|
}
|
|
4418
4430
|
|
|
4419
4431
|
// src/commands/jira/acceptanceCriteria.ts
|
|
4420
|
-
import
|
|
4421
|
-
import chalk48 from "chalk";
|
|
4432
|
+
import chalk49 from "chalk";
|
|
4422
4433
|
|
|
4423
4434
|
// src/commands/jira/adfToText.ts
|
|
4424
4435
|
function renderInline(node) {
|
|
@@ -4477,15 +4488,14 @@ function adfToText(doc) {
|
|
|
4477
4488
|
return renderNodes([doc], 0);
|
|
4478
4489
|
}
|
|
4479
4490
|
|
|
4480
|
-
// src/commands/jira/
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
const field = config.jira?.acField ?? DEFAULT_AC_FIELD;
|
|
4491
|
+
// src/commands/jira/fetchIssue.ts
|
|
4492
|
+
import { execSync as execSync20 } from "child_process";
|
|
4493
|
+
import chalk48 from "chalk";
|
|
4494
|
+
function fetchIssue(issueKey, fields) {
|
|
4485
4495
|
let result;
|
|
4486
4496
|
try {
|
|
4487
4497
|
result = execSync20(
|
|
4488
|
-
`acli jira workitem view ${issueKey} -f ${
|
|
4498
|
+
`acli jira workitem view ${issueKey} -f ${fields} --json`,
|
|
4489
4499
|
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
4490
4500
|
);
|
|
4491
4501
|
} catch (error) {
|
|
@@ -4504,10 +4514,18 @@ function acceptanceCriteria(issueKey) {
|
|
|
4504
4514
|
console.error(chalk48.red(`Failed to fetch ${issueKey}.`));
|
|
4505
4515
|
process.exit(1);
|
|
4506
4516
|
}
|
|
4507
|
-
|
|
4517
|
+
return JSON.parse(result);
|
|
4518
|
+
}
|
|
4519
|
+
|
|
4520
|
+
// src/commands/jira/acceptanceCriteria.ts
|
|
4521
|
+
var DEFAULT_AC_FIELD = "customfield_11937";
|
|
4522
|
+
function acceptanceCriteria(issueKey) {
|
|
4523
|
+
const config = loadConfig();
|
|
4524
|
+
const field = config.jira?.acField ?? DEFAULT_AC_FIELD;
|
|
4525
|
+
const parsed = fetchIssue(issueKey, field);
|
|
4508
4526
|
const acValue = parsed?.fields?.[field];
|
|
4509
4527
|
if (!acValue) {
|
|
4510
|
-
console.log(
|
|
4528
|
+
console.log(chalk49.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
4511
4529
|
return;
|
|
4512
4530
|
}
|
|
4513
4531
|
if (typeof acValue === "string") {
|
|
@@ -4597,11 +4615,39 @@ async function jiraAuth() {
|
|
|
4597
4615
|
}
|
|
4598
4616
|
}
|
|
4599
4617
|
|
|
4618
|
+
// src/commands/jira/viewIssue.ts
|
|
4619
|
+
import chalk50 from "chalk";
|
|
4620
|
+
function viewIssue(issueKey) {
|
|
4621
|
+
const parsed = fetchIssue(issueKey, "summary,description");
|
|
4622
|
+
const fields = parsed?.fields;
|
|
4623
|
+
const summary = fields?.summary;
|
|
4624
|
+
const description = fields?.description;
|
|
4625
|
+
if (summary) {
|
|
4626
|
+
console.log(chalk50.bold(summary));
|
|
4627
|
+
}
|
|
4628
|
+
if (description) {
|
|
4629
|
+
if (summary) console.log();
|
|
4630
|
+
if (typeof description === "string") {
|
|
4631
|
+
console.log(description);
|
|
4632
|
+
} else if (description.type === "doc") {
|
|
4633
|
+
console.log(adfToText(description));
|
|
4634
|
+
} else {
|
|
4635
|
+
console.log(JSON.stringify(description, null, 2));
|
|
4636
|
+
}
|
|
4637
|
+
}
|
|
4638
|
+
if (!summary && !description) {
|
|
4639
|
+
console.log(
|
|
4640
|
+
chalk50.yellow(`No summary or description found on ${issueKey}.`)
|
|
4641
|
+
);
|
|
4642
|
+
}
|
|
4643
|
+
}
|
|
4644
|
+
|
|
4600
4645
|
// src/commands/registerJira.ts
|
|
4601
4646
|
function registerJira(program2) {
|
|
4602
4647
|
const jiraCommand = program2.command("jira").description("Jira utilities");
|
|
4603
4648
|
jiraCommand.command("auth").description("Authenticate with Jira via API token").action(() => jiraAuth());
|
|
4604
4649
|
jiraCommand.command("ac <issue-key>").description("Print acceptance criteria for a Jira issue").action((issueKey) => acceptanceCriteria(issueKey));
|
|
4650
|
+
jiraCommand.command("view <issue-key>").description("Print the title and description of a Jira issue").action((issueKey) => viewIssue(issueKey));
|
|
4605
4651
|
}
|
|
4606
4652
|
|
|
4607
4653
|
// src/commands/netframework/buildTree.ts
|
|
@@ -4700,30 +4746,30 @@ function escapeRegex(s) {
|
|
|
4700
4746
|
}
|
|
4701
4747
|
|
|
4702
4748
|
// src/commands/netframework/printTree.ts
|
|
4703
|
-
import
|
|
4749
|
+
import chalk51 from "chalk";
|
|
4704
4750
|
function printNodes(nodes, prefix2) {
|
|
4705
4751
|
for (let i = 0; i < nodes.length; i++) {
|
|
4706
4752
|
const isLast = i === nodes.length - 1;
|
|
4707
4753
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
4708
4754
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
4709
4755
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
4710
|
-
const label2 = isMissing ?
|
|
4756
|
+
const label2 = isMissing ? chalk51.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
4711
4757
|
console.log(`${prefix2}${connector}${label2}`);
|
|
4712
4758
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
4713
4759
|
}
|
|
4714
4760
|
}
|
|
4715
4761
|
function printTree(tree, totalCount, solutions) {
|
|
4716
|
-
console.log(
|
|
4717
|
-
console.log(
|
|
4762
|
+
console.log(chalk51.bold("\nProject Dependency Tree"));
|
|
4763
|
+
console.log(chalk51.cyan(tree.relativePath));
|
|
4718
4764
|
printNodes(tree.children, "");
|
|
4719
|
-
console.log(
|
|
4765
|
+
console.log(chalk51.dim(`
|
|
4720
4766
|
${totalCount} projects total (including root)`));
|
|
4721
|
-
console.log(
|
|
4767
|
+
console.log(chalk51.bold("\nSolution Membership"));
|
|
4722
4768
|
if (solutions.length === 0) {
|
|
4723
|
-
console.log(
|
|
4769
|
+
console.log(chalk51.yellow(" Not found in any .sln"));
|
|
4724
4770
|
} else {
|
|
4725
4771
|
for (const sln of solutions) {
|
|
4726
|
-
console.log(` ${
|
|
4772
|
+
console.log(` ${chalk51.green(sln)}`);
|
|
4727
4773
|
}
|
|
4728
4774
|
}
|
|
4729
4775
|
console.log();
|
|
@@ -4752,7 +4798,7 @@ function printJson(tree, totalCount, solutions) {
|
|
|
4752
4798
|
// src/commands/netframework/resolveCsproj.ts
|
|
4753
4799
|
import { existsSync as existsSync22 } from "fs";
|
|
4754
4800
|
import path24 from "path";
|
|
4755
|
-
import
|
|
4801
|
+
import chalk52 from "chalk";
|
|
4756
4802
|
|
|
4757
4803
|
// src/commands/netframework/findRepoRoot.ts
|
|
4758
4804
|
import { existsSync as existsSync21 } from "fs";
|
|
@@ -4772,12 +4818,12 @@ function findRepoRoot(dir) {
|
|
|
4772
4818
|
function resolveCsproj(csprojPath) {
|
|
4773
4819
|
const resolved = path24.resolve(csprojPath);
|
|
4774
4820
|
if (!existsSync22(resolved)) {
|
|
4775
|
-
console.error(
|
|
4821
|
+
console.error(chalk52.red(`File not found: ${resolved}`));
|
|
4776
4822
|
process.exit(1);
|
|
4777
4823
|
}
|
|
4778
4824
|
const repoRoot = findRepoRoot(path24.dirname(resolved));
|
|
4779
4825
|
if (!repoRoot) {
|
|
4780
|
-
console.error(
|
|
4826
|
+
console.error(chalk52.red("Could not find git repository root"));
|
|
4781
4827
|
process.exit(1);
|
|
4782
4828
|
}
|
|
4783
4829
|
return { resolved, repoRoot };
|
|
@@ -4797,12 +4843,12 @@ async function deps(csprojPath, options2) {
|
|
|
4797
4843
|
}
|
|
4798
4844
|
|
|
4799
4845
|
// src/commands/netframework/inSln.ts
|
|
4800
|
-
import
|
|
4846
|
+
import chalk53 from "chalk";
|
|
4801
4847
|
async function inSln(csprojPath) {
|
|
4802
4848
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
4803
4849
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
4804
4850
|
if (solutions.length === 0) {
|
|
4805
|
-
console.log(
|
|
4851
|
+
console.log(chalk53.yellow("Not found in any .sln file"));
|
|
4806
4852
|
process.exit(1);
|
|
4807
4853
|
}
|
|
4808
4854
|
for (const sln of solutions) {
|
|
@@ -4818,7 +4864,7 @@ function registerNetframework(program2) {
|
|
|
4818
4864
|
}
|
|
4819
4865
|
|
|
4820
4866
|
// src/commands/news/add/index.ts
|
|
4821
|
-
import
|
|
4867
|
+
import chalk54 from "chalk";
|
|
4822
4868
|
import enquirer5 from "enquirer";
|
|
4823
4869
|
async function add2(url) {
|
|
4824
4870
|
if (!url) {
|
|
@@ -4841,17 +4887,17 @@ async function add2(url) {
|
|
|
4841
4887
|
const news = config.news ?? {};
|
|
4842
4888
|
const feeds = news.feeds ?? [];
|
|
4843
4889
|
if (feeds.includes(url)) {
|
|
4844
|
-
console.log(
|
|
4890
|
+
console.log(chalk54.yellow("Feed already exists in config"));
|
|
4845
4891
|
return;
|
|
4846
4892
|
}
|
|
4847
4893
|
feeds.push(url);
|
|
4848
4894
|
config.news = { ...news, feeds };
|
|
4849
4895
|
saveGlobalConfig(config);
|
|
4850
|
-
console.log(
|
|
4896
|
+
console.log(chalk54.green(`Added feed: ${url}`));
|
|
4851
4897
|
}
|
|
4852
4898
|
|
|
4853
4899
|
// src/commands/news/web/handleRequest.ts
|
|
4854
|
-
import
|
|
4900
|
+
import chalk55 from "chalk";
|
|
4855
4901
|
|
|
4856
4902
|
// src/commands/news/web/shared.ts
|
|
4857
4903
|
import { decodeHTML } from "entities";
|
|
@@ -4987,17 +5033,17 @@ function prefetch() {
|
|
|
4987
5033
|
const config = loadConfig();
|
|
4988
5034
|
const total = config.news.feeds.length;
|
|
4989
5035
|
if (total === 0) return;
|
|
4990
|
-
process.stdout.write(
|
|
5036
|
+
process.stdout.write(chalk55.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
4991
5037
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
4992
5038
|
const width = 20;
|
|
4993
5039
|
const filled = Math.round(done2 / t * width);
|
|
4994
5040
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
4995
5041
|
process.stdout.write(
|
|
4996
|
-
`\r${
|
|
5042
|
+
`\r${chalk55.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
4997
5043
|
);
|
|
4998
5044
|
}).then((items) => {
|
|
4999
5045
|
process.stdout.write(
|
|
5000
|
-
`\r${
|
|
5046
|
+
`\r${chalk55.green(`Fetched ${items.length} items from ${total} feed(s)`)}
|
|
5001
5047
|
`
|
|
5002
5048
|
);
|
|
5003
5049
|
cachedItems = items;
|
|
@@ -5358,20 +5404,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
5358
5404
|
}
|
|
5359
5405
|
|
|
5360
5406
|
// src/commands/prs/listComments/printComments.ts
|
|
5361
|
-
import
|
|
5407
|
+
import chalk56 from "chalk";
|
|
5362
5408
|
function formatForHuman(comment2) {
|
|
5363
5409
|
if (comment2.type === "review") {
|
|
5364
|
-
const stateColor = comment2.state === "APPROVED" ?
|
|
5410
|
+
const stateColor = comment2.state === "APPROVED" ? chalk56.green : comment2.state === "CHANGES_REQUESTED" ? chalk56.red : chalk56.yellow;
|
|
5365
5411
|
return [
|
|
5366
|
-
`${
|
|
5412
|
+
`${chalk56.cyan("Review")} by ${chalk56.bold(comment2.user)} ${stateColor(`[${comment2.state}]`)}`,
|
|
5367
5413
|
comment2.body,
|
|
5368
5414
|
""
|
|
5369
5415
|
].join("\n");
|
|
5370
5416
|
}
|
|
5371
5417
|
const location = comment2.line ? `:${comment2.line}` : "";
|
|
5372
5418
|
return [
|
|
5373
|
-
`${
|
|
5374
|
-
|
|
5419
|
+
`${chalk56.cyan("Line comment")} by ${chalk56.bold(comment2.user)} on ${chalk56.dim(`${comment2.path}${location}`)}`,
|
|
5420
|
+
chalk56.dim(comment2.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
5375
5421
|
comment2.body,
|
|
5376
5422
|
""
|
|
5377
5423
|
].join("\n");
|
|
@@ -5461,13 +5507,13 @@ import { execSync as execSync27 } from "child_process";
|
|
|
5461
5507
|
import enquirer6 from "enquirer";
|
|
5462
5508
|
|
|
5463
5509
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
5464
|
-
import
|
|
5510
|
+
import chalk57 from "chalk";
|
|
5465
5511
|
var STATUS_MAP = {
|
|
5466
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
5467
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
5512
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk57.magenta("merged"), date: pr.mergedAt } : null,
|
|
5513
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk57.red("closed"), date: pr.closedAt } : null
|
|
5468
5514
|
};
|
|
5469
5515
|
function defaultStatus(pr) {
|
|
5470
|
-
return { label:
|
|
5516
|
+
return { label: chalk57.green("opened"), date: pr.createdAt };
|
|
5471
5517
|
}
|
|
5472
5518
|
function getStatus2(pr) {
|
|
5473
5519
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -5476,11 +5522,11 @@ function formatDate(dateStr) {
|
|
|
5476
5522
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
5477
5523
|
}
|
|
5478
5524
|
function formatPrHeader(pr, status2) {
|
|
5479
|
-
return `${
|
|
5525
|
+
return `${chalk57.cyan(`#${pr.number}`)} ${pr.title} ${chalk57.dim(`(${pr.author.login},`)} ${status2.label} ${chalk57.dim(`${formatDate(status2.date)})`)}`;
|
|
5480
5526
|
}
|
|
5481
5527
|
function logPrDetails(pr) {
|
|
5482
5528
|
console.log(
|
|
5483
|
-
|
|
5529
|
+
chalk57.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
5484
5530
|
);
|
|
5485
5531
|
console.log();
|
|
5486
5532
|
}
|
|
@@ -5646,7 +5692,7 @@ function registerPrs(program2) {
|
|
|
5646
5692
|
}
|
|
5647
5693
|
|
|
5648
5694
|
// src/commands/ravendb/ravendbAuth.ts
|
|
5649
|
-
import
|
|
5695
|
+
import chalk62 from "chalk";
|
|
5650
5696
|
|
|
5651
5697
|
// src/commands/ravendb/loadConnections.ts
|
|
5652
5698
|
function loadConnections() {
|
|
@@ -5663,16 +5709,16 @@ function saveConnections(connections) {
|
|
|
5663
5709
|
}
|
|
5664
5710
|
|
|
5665
5711
|
// src/commands/ravendb/promptConnection.ts
|
|
5666
|
-
import
|
|
5712
|
+
import chalk60 from "chalk";
|
|
5667
5713
|
import Enquirer3 from "enquirer";
|
|
5668
5714
|
|
|
5669
5715
|
// src/commands/ravendb/selectOpSecret.ts
|
|
5670
|
-
import
|
|
5716
|
+
import chalk59 from "chalk";
|
|
5671
5717
|
import Enquirer2 from "enquirer";
|
|
5672
5718
|
|
|
5673
5719
|
// src/commands/ravendb/searchItems.ts
|
|
5674
5720
|
import { execSync as execSync29 } from "child_process";
|
|
5675
|
-
import
|
|
5721
|
+
import chalk58 from "chalk";
|
|
5676
5722
|
function opExec(args) {
|
|
5677
5723
|
return execSync29(`op ${args}`, {
|
|
5678
5724
|
encoding: "utf-8",
|
|
@@ -5685,7 +5731,7 @@ function searchItems(search) {
|
|
|
5685
5731
|
items = JSON.parse(opExec("item list --format=json"));
|
|
5686
5732
|
} catch {
|
|
5687
5733
|
console.error(
|
|
5688
|
-
|
|
5734
|
+
chalk58.red(
|
|
5689
5735
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
5690
5736
|
)
|
|
5691
5737
|
);
|
|
@@ -5699,7 +5745,7 @@ function getItemFields(itemId) {
|
|
|
5699
5745
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
5700
5746
|
return item.fields.filter((f) => f.reference && f.label);
|
|
5701
5747
|
} catch {
|
|
5702
|
-
console.error(
|
|
5748
|
+
console.error(chalk58.red("Failed to get item details from 1Password."));
|
|
5703
5749
|
process.exit(1);
|
|
5704
5750
|
}
|
|
5705
5751
|
}
|
|
@@ -5718,7 +5764,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
5718
5764
|
}).run();
|
|
5719
5765
|
const items = searchItems(search);
|
|
5720
5766
|
if (items.length === 0) {
|
|
5721
|
-
console.error(
|
|
5767
|
+
console.error(chalk59.red(`No items found matching "${search}".`));
|
|
5722
5768
|
process.exit(1);
|
|
5723
5769
|
}
|
|
5724
5770
|
const itemId = await selectOne(
|
|
@@ -5727,7 +5773,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
5727
5773
|
);
|
|
5728
5774
|
const fields = getItemFields(itemId);
|
|
5729
5775
|
if (fields.length === 0) {
|
|
5730
|
-
console.error(
|
|
5776
|
+
console.error(chalk59.red("No fields with references found on this item."));
|
|
5731
5777
|
process.exit(1);
|
|
5732
5778
|
}
|
|
5733
5779
|
const ref = await selectOne(
|
|
@@ -5745,7 +5791,7 @@ async function promptConnection(existingNames) {
|
|
|
5745
5791
|
message: "Connection name:"
|
|
5746
5792
|
}).run();
|
|
5747
5793
|
if (existingNames.includes(name)) {
|
|
5748
|
-
console.error(
|
|
5794
|
+
console.error(chalk60.red(`Connection "${name}" already exists.`));
|
|
5749
5795
|
process.exit(1);
|
|
5750
5796
|
}
|
|
5751
5797
|
const url = await new Input2({
|
|
@@ -5757,22 +5803,22 @@ async function promptConnection(existingNames) {
|
|
|
5757
5803
|
message: "Database name:"
|
|
5758
5804
|
}).run();
|
|
5759
5805
|
if (!name || !url || !database) {
|
|
5760
|
-
console.error(
|
|
5806
|
+
console.error(chalk60.red("All fields are required."));
|
|
5761
5807
|
process.exit(1);
|
|
5762
5808
|
}
|
|
5763
5809
|
const apiKeyRef = await selectOpSecret();
|
|
5764
|
-
console.log(
|
|
5810
|
+
console.log(chalk60.dim(`Using: ${apiKeyRef}`));
|
|
5765
5811
|
return { name, url, database, apiKeyRef };
|
|
5766
5812
|
}
|
|
5767
5813
|
|
|
5768
5814
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
5769
|
-
import
|
|
5815
|
+
import chalk61 from "chalk";
|
|
5770
5816
|
function ravendbSetConnection(name) {
|
|
5771
5817
|
const raw = loadGlobalConfigRaw();
|
|
5772
5818
|
const ravendb = raw.ravendb ?? {};
|
|
5773
5819
|
const connections = ravendb.connections ?? [];
|
|
5774
5820
|
if (!connections.some((c) => c.name === name)) {
|
|
5775
|
-
console.error(
|
|
5821
|
+
console.error(chalk61.red(`Connection "${name}" not found.`));
|
|
5776
5822
|
console.error(
|
|
5777
5823
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
5778
5824
|
);
|
|
@@ -5794,7 +5840,7 @@ async function ravendbAuth(options2) {
|
|
|
5794
5840
|
}
|
|
5795
5841
|
for (const c of connections) {
|
|
5796
5842
|
console.log(
|
|
5797
|
-
`${
|
|
5843
|
+
`${chalk62.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`
|
|
5798
5844
|
);
|
|
5799
5845
|
}
|
|
5800
5846
|
return;
|
|
@@ -5802,7 +5848,7 @@ async function ravendbAuth(options2) {
|
|
|
5802
5848
|
if (options2.remove) {
|
|
5803
5849
|
const filtered = connections.filter((c) => c.name !== options2.remove);
|
|
5804
5850
|
if (filtered.length === connections.length) {
|
|
5805
|
-
console.error(
|
|
5851
|
+
console.error(chalk62.red(`Connection "${options2.remove}" not found.`));
|
|
5806
5852
|
process.exit(1);
|
|
5807
5853
|
}
|
|
5808
5854
|
saveConnections(filtered);
|
|
@@ -5820,10 +5866,10 @@ async function ravendbAuth(options2) {
|
|
|
5820
5866
|
}
|
|
5821
5867
|
|
|
5822
5868
|
// src/commands/ravendb/ravendbCollections.ts
|
|
5823
|
-
import
|
|
5869
|
+
import chalk66 from "chalk";
|
|
5824
5870
|
|
|
5825
5871
|
// src/commands/ravendb/ravenFetch.ts
|
|
5826
|
-
import
|
|
5872
|
+
import chalk64 from "chalk";
|
|
5827
5873
|
|
|
5828
5874
|
// src/commands/ravendb/getAccessToken.ts
|
|
5829
5875
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -5860,10 +5906,10 @@ ${errorText}`
|
|
|
5860
5906
|
|
|
5861
5907
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
5862
5908
|
import { execSync as execSync30 } from "child_process";
|
|
5863
|
-
import
|
|
5909
|
+
import chalk63 from "chalk";
|
|
5864
5910
|
function resolveOpSecret(reference) {
|
|
5865
5911
|
if (!reference.startsWith("op://")) {
|
|
5866
|
-
console.error(
|
|
5912
|
+
console.error(chalk63.red(`Invalid secret reference: must start with op://`));
|
|
5867
5913
|
process.exit(1);
|
|
5868
5914
|
}
|
|
5869
5915
|
try {
|
|
@@ -5873,7 +5919,7 @@ function resolveOpSecret(reference) {
|
|
|
5873
5919
|
}).trim();
|
|
5874
5920
|
} catch {
|
|
5875
5921
|
console.error(
|
|
5876
|
-
|
|
5922
|
+
chalk63.red(
|
|
5877
5923
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
5878
5924
|
)
|
|
5879
5925
|
);
|
|
@@ -5900,7 +5946,7 @@ async function ravenFetch(connection, path42) {
|
|
|
5900
5946
|
if (!response.ok) {
|
|
5901
5947
|
const body = await response.text();
|
|
5902
5948
|
console.error(
|
|
5903
|
-
|
|
5949
|
+
chalk64.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
5904
5950
|
);
|
|
5905
5951
|
console.error(body.substring(0, 500));
|
|
5906
5952
|
process.exit(1);
|
|
@@ -5909,7 +5955,7 @@ async function ravenFetch(connection, path42) {
|
|
|
5909
5955
|
}
|
|
5910
5956
|
|
|
5911
5957
|
// src/commands/ravendb/resolveConnection.ts
|
|
5912
|
-
import
|
|
5958
|
+
import chalk65 from "chalk";
|
|
5913
5959
|
function loadRavendb() {
|
|
5914
5960
|
const raw = loadGlobalConfigRaw();
|
|
5915
5961
|
const ravendb = raw.ravendb;
|
|
@@ -5923,7 +5969,7 @@ function resolveConnection(name) {
|
|
|
5923
5969
|
const connectionName = name ?? defaultConnection;
|
|
5924
5970
|
if (!connectionName) {
|
|
5925
5971
|
console.error(
|
|
5926
|
-
|
|
5972
|
+
chalk65.red(
|
|
5927
5973
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
5928
5974
|
)
|
|
5929
5975
|
);
|
|
@@ -5931,7 +5977,7 @@ function resolveConnection(name) {
|
|
|
5931
5977
|
}
|
|
5932
5978
|
const connection = connections.find((c) => c.name === connectionName);
|
|
5933
5979
|
if (!connection) {
|
|
5934
|
-
console.error(
|
|
5980
|
+
console.error(chalk65.red(`Connection "${connectionName}" not found.`));
|
|
5935
5981
|
console.error(
|
|
5936
5982
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
5937
5983
|
);
|
|
@@ -5962,15 +6008,15 @@ async function ravendbCollections(connectionName) {
|
|
|
5962
6008
|
return;
|
|
5963
6009
|
}
|
|
5964
6010
|
for (const c of collections) {
|
|
5965
|
-
console.log(`${
|
|
6011
|
+
console.log(`${chalk66.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
5966
6012
|
}
|
|
5967
6013
|
}
|
|
5968
6014
|
|
|
5969
6015
|
// src/commands/ravendb/ravendbQuery.ts
|
|
5970
|
-
import
|
|
6016
|
+
import chalk68 from "chalk";
|
|
5971
6017
|
|
|
5972
6018
|
// src/commands/ravendb/fetchAllPages.ts
|
|
5973
|
-
import
|
|
6019
|
+
import chalk67 from "chalk";
|
|
5974
6020
|
|
|
5975
6021
|
// src/commands/ravendb/buildQueryPath.ts
|
|
5976
6022
|
function buildQueryPath(opts) {
|
|
@@ -6008,7 +6054,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
6008
6054
|
allResults.push(...results);
|
|
6009
6055
|
start3 += results.length;
|
|
6010
6056
|
process.stderr.write(
|
|
6011
|
-
`\r${
|
|
6057
|
+
`\r${chalk67.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
6012
6058
|
);
|
|
6013
6059
|
if (start3 >= totalResults) break;
|
|
6014
6060
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -6023,7 +6069,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
6023
6069
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
6024
6070
|
const resolved = resolveArgs(connectionName, collection);
|
|
6025
6071
|
if (!resolved.collection && !options2.query) {
|
|
6026
|
-
console.error(
|
|
6072
|
+
console.error(chalk68.red("Provide a collection name or --query filter."));
|
|
6027
6073
|
process.exit(1);
|
|
6028
6074
|
}
|
|
6029
6075
|
const { collection: col } = resolved;
|
|
@@ -6058,7 +6104,7 @@ import { spawn as spawn3 } from "child_process";
|
|
|
6058
6104
|
import * as path25 from "path";
|
|
6059
6105
|
|
|
6060
6106
|
// src/commands/refactor/logViolations.ts
|
|
6061
|
-
import
|
|
6107
|
+
import chalk69 from "chalk";
|
|
6062
6108
|
var DEFAULT_MAX_LINES = 100;
|
|
6063
6109
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
6064
6110
|
if (violations.length === 0) {
|
|
@@ -6067,43 +6113,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
6067
6113
|
}
|
|
6068
6114
|
return;
|
|
6069
6115
|
}
|
|
6070
|
-
console.error(
|
|
6116
|
+
console.error(chalk69.red(`
|
|
6071
6117
|
Refactor check failed:
|
|
6072
6118
|
`));
|
|
6073
|
-
console.error(
|
|
6119
|
+
console.error(chalk69.red(` The following files exceed ${maxLines} lines:
|
|
6074
6120
|
`));
|
|
6075
6121
|
for (const violation of violations) {
|
|
6076
|
-
console.error(
|
|
6122
|
+
console.error(chalk69.red(` ${violation.file} (${violation.lines} lines)`));
|
|
6077
6123
|
}
|
|
6078
6124
|
console.error(
|
|
6079
|
-
|
|
6125
|
+
chalk69.yellow(
|
|
6080
6126
|
`
|
|
6081
6127
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
6082
6128
|
way to refactor it, ignore it with:
|
|
6083
6129
|
`
|
|
6084
6130
|
)
|
|
6085
6131
|
);
|
|
6086
|
-
console.error(
|
|
6132
|
+
console.error(chalk69.gray(` assist refactor ignore <file>
|
|
6087
6133
|
`));
|
|
6088
6134
|
if (process.env.CLAUDECODE) {
|
|
6089
|
-
console.error(
|
|
6135
|
+
console.error(chalk69.cyan(`
|
|
6090
6136
|
## Extracting Code to New Files
|
|
6091
6137
|
`));
|
|
6092
6138
|
console.error(
|
|
6093
|
-
|
|
6139
|
+
chalk69.cyan(
|
|
6094
6140
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
6095
6141
|
`
|
|
6096
6142
|
)
|
|
6097
6143
|
);
|
|
6098
6144
|
console.error(
|
|
6099
|
-
|
|
6145
|
+
chalk69.cyan(
|
|
6100
6146
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
6101
6147
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
6102
6148
|
`
|
|
6103
6149
|
)
|
|
6104
6150
|
);
|
|
6105
6151
|
console.error(
|
|
6106
|
-
|
|
6152
|
+
chalk69.cyan(
|
|
6107
6153
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
6108
6154
|
domains, move it to a common/shared folder.
|
|
6109
6155
|
`
|
|
@@ -6259,11 +6305,11 @@ async function check(pattern2, options2) {
|
|
|
6259
6305
|
|
|
6260
6306
|
// src/commands/refactor/ignore.ts
|
|
6261
6307
|
import fs17 from "fs";
|
|
6262
|
-
import
|
|
6308
|
+
import chalk70 from "chalk";
|
|
6263
6309
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
6264
6310
|
function ignore(file) {
|
|
6265
6311
|
if (!fs17.existsSync(file)) {
|
|
6266
|
-
console.error(
|
|
6312
|
+
console.error(chalk70.red(`Error: File does not exist: ${file}`));
|
|
6267
6313
|
process.exit(1);
|
|
6268
6314
|
}
|
|
6269
6315
|
const content = fs17.readFileSync(file, "utf-8");
|
|
@@ -6279,7 +6325,7 @@ function ignore(file) {
|
|
|
6279
6325
|
fs17.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
6280
6326
|
}
|
|
6281
6327
|
console.log(
|
|
6282
|
-
|
|
6328
|
+
chalk70.green(
|
|
6283
6329
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
6284
6330
|
)
|
|
6285
6331
|
);
|
|
@@ -6287,7 +6333,7 @@ function ignore(file) {
|
|
|
6287
6333
|
|
|
6288
6334
|
// src/commands/refactor/rename/index.ts
|
|
6289
6335
|
import path26 from "path";
|
|
6290
|
-
import
|
|
6336
|
+
import chalk71 from "chalk";
|
|
6291
6337
|
import { Project as Project2 } from "ts-morph";
|
|
6292
6338
|
async function rename(source, destination, options2 = {}) {
|
|
6293
6339
|
const sourcePath = path26.resolve(source);
|
|
@@ -6300,22 +6346,22 @@ async function rename(source, destination, options2 = {}) {
|
|
|
6300
6346
|
});
|
|
6301
6347
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
6302
6348
|
if (!sourceFile) {
|
|
6303
|
-
console.log(
|
|
6349
|
+
console.log(chalk71.red(`File not found in project: ${source}`));
|
|
6304
6350
|
process.exit(1);
|
|
6305
6351
|
}
|
|
6306
|
-
console.log(
|
|
6352
|
+
console.log(chalk71.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
6307
6353
|
if (options2.apply) {
|
|
6308
6354
|
sourceFile.move(destPath);
|
|
6309
6355
|
await project.save();
|
|
6310
|
-
console.log(
|
|
6356
|
+
console.log(chalk71.green("Done"));
|
|
6311
6357
|
} else {
|
|
6312
|
-
console.log(
|
|
6358
|
+
console.log(chalk71.dim("Dry run. Use --apply to execute."));
|
|
6313
6359
|
}
|
|
6314
6360
|
}
|
|
6315
6361
|
|
|
6316
6362
|
// src/commands/refactor/renameSymbol/index.ts
|
|
6317
6363
|
import path28 from "path";
|
|
6318
|
-
import
|
|
6364
|
+
import chalk72 from "chalk";
|
|
6319
6365
|
import { Project as Project3 } from "ts-morph";
|
|
6320
6366
|
|
|
6321
6367
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
@@ -6364,38 +6410,38 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
6364
6410
|
const project = new Project3({ tsConfigFilePath: tsConfigPath });
|
|
6365
6411
|
const sourceFile = project.getSourceFile(filePath);
|
|
6366
6412
|
if (!sourceFile) {
|
|
6367
|
-
console.log(
|
|
6413
|
+
console.log(chalk72.red(`File not found in project: ${file}`));
|
|
6368
6414
|
process.exit(1);
|
|
6369
6415
|
}
|
|
6370
6416
|
const symbol = findSymbol(sourceFile, oldName);
|
|
6371
6417
|
if (!symbol) {
|
|
6372
|
-
console.log(
|
|
6418
|
+
console.log(chalk72.red(`Symbol "${oldName}" not found in ${file}`));
|
|
6373
6419
|
process.exit(1);
|
|
6374
6420
|
}
|
|
6375
6421
|
const grouped = groupReferences(symbol, cwd);
|
|
6376
6422
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
6377
6423
|
console.log(
|
|
6378
|
-
|
|
6424
|
+
chalk72.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
6379
6425
|
`)
|
|
6380
6426
|
);
|
|
6381
6427
|
for (const [refFile, lines] of grouped) {
|
|
6382
6428
|
console.log(
|
|
6383
|
-
` ${
|
|
6429
|
+
` ${chalk72.dim(refFile)}: lines ${chalk72.cyan(lines.join(", "))}`
|
|
6384
6430
|
);
|
|
6385
6431
|
}
|
|
6386
6432
|
if (options2.apply) {
|
|
6387
6433
|
symbol.rename(newName);
|
|
6388
6434
|
await project.save();
|
|
6389
|
-
console.log(
|
|
6435
|
+
console.log(chalk72.green(`
|
|
6390
6436
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
6391
6437
|
} else {
|
|
6392
|
-
console.log(
|
|
6438
|
+
console.log(chalk72.dim("\nDry run. Use --apply to execute."));
|
|
6393
6439
|
}
|
|
6394
6440
|
}
|
|
6395
6441
|
|
|
6396
6442
|
// src/commands/refactor/restructure/index.ts
|
|
6397
6443
|
import path37 from "path";
|
|
6398
|
-
import
|
|
6444
|
+
import chalk75 from "chalk";
|
|
6399
6445
|
|
|
6400
6446
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
6401
6447
|
import path29 from "path";
|
|
@@ -6638,50 +6684,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
6638
6684
|
|
|
6639
6685
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
6640
6686
|
import path33 from "path";
|
|
6641
|
-
import
|
|
6687
|
+
import chalk73 from "chalk";
|
|
6642
6688
|
function relPath(filePath) {
|
|
6643
6689
|
return path33.relative(process.cwd(), filePath);
|
|
6644
6690
|
}
|
|
6645
6691
|
function displayMoves(plan) {
|
|
6646
6692
|
if (plan.moves.length === 0) return;
|
|
6647
|
-
console.log(
|
|
6693
|
+
console.log(chalk73.bold("\nFile moves:"));
|
|
6648
6694
|
for (const move of plan.moves) {
|
|
6649
6695
|
console.log(
|
|
6650
|
-
` ${
|
|
6696
|
+
` ${chalk73.red(relPath(move.from))} \u2192 ${chalk73.green(relPath(move.to))}`
|
|
6651
6697
|
);
|
|
6652
|
-
console.log(
|
|
6698
|
+
console.log(chalk73.dim(` ${move.reason}`));
|
|
6653
6699
|
}
|
|
6654
6700
|
}
|
|
6655
6701
|
function displayRewrites(rewrites) {
|
|
6656
6702
|
if (rewrites.length === 0) return;
|
|
6657
6703
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
6658
|
-
console.log(
|
|
6704
|
+
console.log(chalk73.bold(`
|
|
6659
6705
|
Import rewrites (${affectedFiles.size} files):`));
|
|
6660
6706
|
for (const file of affectedFiles) {
|
|
6661
|
-
console.log(` ${
|
|
6707
|
+
console.log(` ${chalk73.cyan(relPath(file))}:`);
|
|
6662
6708
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
6663
6709
|
(r) => r.file === file
|
|
6664
6710
|
)) {
|
|
6665
6711
|
console.log(
|
|
6666
|
-
` ${
|
|
6712
|
+
` ${chalk73.red(`"${oldSpecifier}"`)} \u2192 ${chalk73.green(`"${newSpecifier}"`)}`
|
|
6667
6713
|
);
|
|
6668
6714
|
}
|
|
6669
6715
|
}
|
|
6670
6716
|
}
|
|
6671
6717
|
function displayPlan(plan) {
|
|
6672
6718
|
if (plan.warnings.length > 0) {
|
|
6673
|
-
console.log(
|
|
6674
|
-
for (const w of plan.warnings) console.log(
|
|
6719
|
+
console.log(chalk73.yellow("\nWarnings:"));
|
|
6720
|
+
for (const w of plan.warnings) console.log(chalk73.yellow(` ${w}`));
|
|
6675
6721
|
}
|
|
6676
6722
|
if (plan.newDirectories.length > 0) {
|
|
6677
|
-
console.log(
|
|
6723
|
+
console.log(chalk73.bold("\nNew directories:"));
|
|
6678
6724
|
for (const dir of plan.newDirectories)
|
|
6679
|
-
console.log(
|
|
6725
|
+
console.log(chalk73.green(` ${dir}/`));
|
|
6680
6726
|
}
|
|
6681
6727
|
displayMoves(plan);
|
|
6682
6728
|
displayRewrites(plan.rewrites);
|
|
6683
6729
|
console.log(
|
|
6684
|
-
|
|
6730
|
+
chalk73.dim(
|
|
6685
6731
|
`
|
|
6686
6732
|
Summary: ${plan.moves.length} file(s) moved, ${plan.rewrites.length} imports rewritten`
|
|
6687
6733
|
)
|
|
@@ -6691,18 +6737,18 @@ Summary: ${plan.moves.length} file(s) moved, ${plan.rewrites.length} imports rew
|
|
|
6691
6737
|
// src/commands/refactor/restructure/executePlan.ts
|
|
6692
6738
|
import fs19 from "fs";
|
|
6693
6739
|
import path34 from "path";
|
|
6694
|
-
import
|
|
6740
|
+
import chalk74 from "chalk";
|
|
6695
6741
|
function executePlan(plan) {
|
|
6696
6742
|
const updatedContents = applyRewrites(plan.rewrites);
|
|
6697
6743
|
for (const [file, content] of updatedContents) {
|
|
6698
6744
|
fs19.writeFileSync(file, content, "utf-8");
|
|
6699
6745
|
console.log(
|
|
6700
|
-
|
|
6746
|
+
chalk74.cyan(` Rewrote imports in ${path34.relative(process.cwd(), file)}`)
|
|
6701
6747
|
);
|
|
6702
6748
|
}
|
|
6703
6749
|
for (const dir of plan.newDirectories) {
|
|
6704
6750
|
fs19.mkdirSync(dir, { recursive: true });
|
|
6705
|
-
console.log(
|
|
6751
|
+
console.log(chalk74.green(` Created ${path34.relative(process.cwd(), dir)}/`));
|
|
6706
6752
|
}
|
|
6707
6753
|
for (const move of plan.moves) {
|
|
6708
6754
|
const targetDir = path34.dirname(move.to);
|
|
@@ -6711,7 +6757,7 @@ function executePlan(plan) {
|
|
|
6711
6757
|
}
|
|
6712
6758
|
fs19.renameSync(move.from, move.to);
|
|
6713
6759
|
console.log(
|
|
6714
|
-
|
|
6760
|
+
chalk74.white(
|
|
6715
6761
|
` Moved ${path34.relative(process.cwd(), move.from)} \u2192 ${path34.relative(process.cwd(), move.to)}`
|
|
6716
6762
|
)
|
|
6717
6763
|
);
|
|
@@ -6726,7 +6772,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
6726
6772
|
if (entries.length === 0) {
|
|
6727
6773
|
fs19.rmdirSync(dir);
|
|
6728
6774
|
console.log(
|
|
6729
|
-
|
|
6775
|
+
chalk74.dim(
|
|
6730
6776
|
` Removed empty directory ${path34.relative(process.cwd(), dir)}`
|
|
6731
6777
|
)
|
|
6732
6778
|
);
|
|
@@ -6859,22 +6905,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
6859
6905
|
const targetPattern = pattern2 ?? "src";
|
|
6860
6906
|
const files = findSourceFiles2(targetPattern);
|
|
6861
6907
|
if (files.length === 0) {
|
|
6862
|
-
console.log(
|
|
6908
|
+
console.log(chalk75.yellow("No files found matching pattern"));
|
|
6863
6909
|
return;
|
|
6864
6910
|
}
|
|
6865
6911
|
const tsConfigPath = path37.resolve("tsconfig.json");
|
|
6866
6912
|
const plan = buildPlan(files, tsConfigPath);
|
|
6867
6913
|
if (plan.moves.length === 0) {
|
|
6868
|
-
console.log(
|
|
6914
|
+
console.log(chalk75.green("No restructuring needed"));
|
|
6869
6915
|
return;
|
|
6870
6916
|
}
|
|
6871
6917
|
displayPlan(plan);
|
|
6872
6918
|
if (options2.apply) {
|
|
6873
|
-
console.log(
|
|
6919
|
+
console.log(chalk75.bold("\nApplying changes..."));
|
|
6874
6920
|
executePlan(plan);
|
|
6875
|
-
console.log(
|
|
6921
|
+
console.log(chalk75.green("\nRestructuring complete"));
|
|
6876
6922
|
} else {
|
|
6877
|
-
console.log(
|
|
6923
|
+
console.log(chalk75.dim("\nDry run. Use --apply to execute."));
|
|
6878
6924
|
}
|
|
6879
6925
|
}
|
|
6880
6926
|
|
|
@@ -7422,14 +7468,14 @@ import {
|
|
|
7422
7468
|
import { dirname as dirname18, join as join26 } from "path";
|
|
7423
7469
|
|
|
7424
7470
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
7425
|
-
import
|
|
7471
|
+
import chalk76 from "chalk";
|
|
7426
7472
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
7427
7473
|
function validateStagedContent(filename, content) {
|
|
7428
7474
|
const firstLine = content.split("\n")[0];
|
|
7429
7475
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
7430
7476
|
if (!match) {
|
|
7431
7477
|
console.error(
|
|
7432
|
-
|
|
7478
|
+
chalk76.red(
|
|
7433
7479
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
7434
7480
|
)
|
|
7435
7481
|
);
|
|
@@ -7438,7 +7484,7 @@ function validateStagedContent(filename, content) {
|
|
|
7438
7484
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
7439
7485
|
if (!contentAfterLink) {
|
|
7440
7486
|
console.error(
|
|
7441
|
-
|
|
7487
|
+
chalk76.red(
|
|
7442
7488
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
7443
7489
|
)
|
|
7444
7490
|
);
|
|
@@ -7831,7 +7877,7 @@ function registerVoice(program2) {
|
|
|
7831
7877
|
|
|
7832
7878
|
// src/commands/roam/auth.ts
|
|
7833
7879
|
import { randomBytes } from "crypto";
|
|
7834
|
-
import
|
|
7880
|
+
import chalk77 from "chalk";
|
|
7835
7881
|
|
|
7836
7882
|
// src/lib/openBrowser.ts
|
|
7837
7883
|
import { execSync as execSync33 } from "child_process";
|
|
@@ -8006,13 +8052,13 @@ async function auth() {
|
|
|
8006
8052
|
saveGlobalConfig(config);
|
|
8007
8053
|
const state = randomBytes(16).toString("hex");
|
|
8008
8054
|
console.log(
|
|
8009
|
-
|
|
8055
|
+
chalk77.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
8010
8056
|
);
|
|
8011
|
-
console.log(
|
|
8012
|
-
console.log(
|
|
8013
|
-
console.log(
|
|
8057
|
+
console.log(chalk77.white("http://localhost:14523/callback\n"));
|
|
8058
|
+
console.log(chalk77.blue("Opening browser for authorization..."));
|
|
8059
|
+
console.log(chalk77.dim("Waiting for authorization callback..."));
|
|
8014
8060
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
8015
|
-
console.log(
|
|
8061
|
+
console.log(chalk77.dim("Exchanging code for tokens..."));
|
|
8016
8062
|
const tokens = await exchangeToken({
|
|
8017
8063
|
code,
|
|
8018
8064
|
clientId,
|
|
@@ -8028,7 +8074,7 @@ async function auth() {
|
|
|
8028
8074
|
};
|
|
8029
8075
|
saveGlobalConfig(config);
|
|
8030
8076
|
console.log(
|
|
8031
|
-
|
|
8077
|
+
chalk77.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
8032
8078
|
);
|
|
8033
8079
|
}
|
|
8034
8080
|
|
|
@@ -8216,14 +8262,14 @@ function run2(name, args) {
|
|
|
8216
8262
|
}
|
|
8217
8263
|
|
|
8218
8264
|
// src/commands/statusLine.ts
|
|
8219
|
-
import
|
|
8265
|
+
import chalk78 from "chalk";
|
|
8220
8266
|
function formatNumber(num) {
|
|
8221
8267
|
return num.toLocaleString("en-US");
|
|
8222
8268
|
}
|
|
8223
8269
|
function colorizePercent(pct) {
|
|
8224
8270
|
const label2 = `${pct}%`;
|
|
8225
|
-
if (pct > 80) return
|
|
8226
|
-
if (pct > 40) return
|
|
8271
|
+
if (pct > 80) return chalk78.red(label2);
|
|
8272
|
+
if (pct > 40) return chalk78.yellow(label2);
|
|
8227
8273
|
return label2;
|
|
8228
8274
|
}
|
|
8229
8275
|
async function statusLine() {
|
|
@@ -8249,7 +8295,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
8249
8295
|
// src/commands/sync/syncClaudeMd.ts
|
|
8250
8296
|
import * as fs22 from "fs";
|
|
8251
8297
|
import * as path38 from "path";
|
|
8252
|
-
import
|
|
8298
|
+
import chalk79 from "chalk";
|
|
8253
8299
|
async function syncClaudeMd(claudeDir, targetBase) {
|
|
8254
8300
|
const source = path38.join(claudeDir, "CLAUDE.md");
|
|
8255
8301
|
const target = path38.join(targetBase, "CLAUDE.md");
|
|
@@ -8258,12 +8304,12 @@ async function syncClaudeMd(claudeDir, targetBase) {
|
|
|
8258
8304
|
const targetContent = fs22.readFileSync(target, "utf-8");
|
|
8259
8305
|
if (sourceContent !== targetContent) {
|
|
8260
8306
|
console.log(
|
|
8261
|
-
|
|
8307
|
+
chalk79.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
8262
8308
|
);
|
|
8263
8309
|
console.log();
|
|
8264
8310
|
printDiff(targetContent, sourceContent);
|
|
8265
8311
|
const confirm = await promptConfirm(
|
|
8266
|
-
|
|
8312
|
+
chalk79.red("Overwrite existing CLAUDE.md?"),
|
|
8267
8313
|
false
|
|
8268
8314
|
);
|
|
8269
8315
|
if (!confirm) {
|
|
@@ -8279,7 +8325,7 @@ async function syncClaudeMd(claudeDir, targetBase) {
|
|
|
8279
8325
|
// src/commands/sync/syncSettings.ts
|
|
8280
8326
|
import * as fs23 from "fs";
|
|
8281
8327
|
import * as path39 from "path";
|
|
8282
|
-
import
|
|
8328
|
+
import chalk80 from "chalk";
|
|
8283
8329
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
8284
8330
|
const source = path39.join(claudeDir, "settings.json");
|
|
8285
8331
|
const target = path39.join(targetBase, "settings.json");
|
|
@@ -8295,14 +8341,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
8295
8341
|
if (mergedContent !== normalizedTarget) {
|
|
8296
8342
|
if (!options2?.yes) {
|
|
8297
8343
|
console.log(
|
|
8298
|
-
|
|
8344
|
+
chalk80.yellow(
|
|
8299
8345
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
8300
8346
|
)
|
|
8301
8347
|
);
|
|
8302
8348
|
console.log();
|
|
8303
8349
|
printDiff(targetContent, mergedContent);
|
|
8304
8350
|
const confirm = await promptConfirm(
|
|
8305
|
-
|
|
8351
|
+
chalk80.red("Overwrite existing settings.json?"),
|
|
8306
8352
|
false
|
|
8307
8353
|
);
|
|
8308
8354
|
if (!confirm) {
|