@staff0rd/assist 0.114.0 → 0.115.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/index.js +172 -138
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -114,6 +114,7 @@ After installation, the `assist` command will be available globally. You can als
|
|
|
114
114
|
- `assist netframework in-sln <csproj>` - Check whether a .csproj is referenced by any .sln file
|
|
115
115
|
- `assist jira auth` - Authenticate with Jira via API token (saves site/email to ~/.assist/jira.json)
|
|
116
116
|
- `assist jira ac <issue-key>` - Print acceptance criteria for a Jira issue
|
|
117
|
+
- `assist jira view <issue-key>` - Print the title and description of a Jira issue
|
|
117
118
|
- `assist ravendb auth` - Configure a named RavenDB connection (prompts for name, URL, database, op:// secret reference)
|
|
118
119
|
- `assist ravendb auth --list` - List configured RavenDB connections
|
|
119
120
|
- `assist ravendb auth --remove <name>` - Remove a configured connection
|
package/claude/CLAUDE.md
CHANGED
|
@@ -6,3 +6,7 @@ When renaming TypeScript files or symbols, use the refactor commands instead of
|
|
|
6
6
|
- `assist refactor rename file <source> <destination>` — rename/move a file and update all imports
|
|
7
7
|
- `assist refactor rename symbol <file> <oldName> <newName>` — rename a variable, function, class, or type across the project
|
|
8
8
|
Both default to dry-run; add `--apply` to execute.
|
|
9
|
+
|
|
10
|
+
When the user mentions a Jira issue key (e.g. `BAD-671`, `PROJ-123`), use these commands to fetch context:
|
|
11
|
+
- `assist jira view <issue-key>` — print the title and description
|
|
12
|
+
- `assist jira ac <issue-key>` — print acceptance criteria
|
package/claude/settings.json
CHANGED
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.115.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -4417,8 +4417,7 @@ function registerDevlog(program2) {
|
|
|
4417
4417
|
}
|
|
4418
4418
|
|
|
4419
4419
|
// src/commands/jira/acceptanceCriteria.ts
|
|
4420
|
-
import
|
|
4421
|
-
import chalk48 from "chalk";
|
|
4420
|
+
import chalk49 from "chalk";
|
|
4422
4421
|
|
|
4423
4422
|
// src/commands/jira/adfToText.ts
|
|
4424
4423
|
function renderInline(node) {
|
|
@@ -4477,15 +4476,14 @@ function adfToText(doc) {
|
|
|
4477
4476
|
return renderNodes([doc], 0);
|
|
4478
4477
|
}
|
|
4479
4478
|
|
|
4480
|
-
// src/commands/jira/
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
const field = config.jira?.acField ?? DEFAULT_AC_FIELD;
|
|
4479
|
+
// src/commands/jira/fetchIssue.ts
|
|
4480
|
+
import { execSync as execSync20 } from "child_process";
|
|
4481
|
+
import chalk48 from "chalk";
|
|
4482
|
+
function fetchIssue(issueKey, fields) {
|
|
4485
4483
|
let result;
|
|
4486
4484
|
try {
|
|
4487
4485
|
result = execSync20(
|
|
4488
|
-
`acli jira workitem view ${issueKey} -f ${
|
|
4486
|
+
`acli jira workitem view ${issueKey} -f ${fields} --json`,
|
|
4489
4487
|
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
4490
4488
|
);
|
|
4491
4489
|
} catch (error) {
|
|
@@ -4504,10 +4502,18 @@ function acceptanceCriteria(issueKey) {
|
|
|
4504
4502
|
console.error(chalk48.red(`Failed to fetch ${issueKey}.`));
|
|
4505
4503
|
process.exit(1);
|
|
4506
4504
|
}
|
|
4507
|
-
|
|
4505
|
+
return JSON.parse(result);
|
|
4506
|
+
}
|
|
4507
|
+
|
|
4508
|
+
// src/commands/jira/acceptanceCriteria.ts
|
|
4509
|
+
var DEFAULT_AC_FIELD = "customfield_11937";
|
|
4510
|
+
function acceptanceCriteria(issueKey) {
|
|
4511
|
+
const config = loadConfig();
|
|
4512
|
+
const field = config.jira?.acField ?? DEFAULT_AC_FIELD;
|
|
4513
|
+
const parsed = fetchIssue(issueKey, field);
|
|
4508
4514
|
const acValue = parsed?.fields?.[field];
|
|
4509
4515
|
if (!acValue) {
|
|
4510
|
-
console.log(
|
|
4516
|
+
console.log(chalk49.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
4511
4517
|
return;
|
|
4512
4518
|
}
|
|
4513
4519
|
if (typeof acValue === "string") {
|
|
@@ -4597,11 +4603,39 @@ async function jiraAuth() {
|
|
|
4597
4603
|
}
|
|
4598
4604
|
}
|
|
4599
4605
|
|
|
4606
|
+
// src/commands/jira/viewIssue.ts
|
|
4607
|
+
import chalk50 from "chalk";
|
|
4608
|
+
function viewIssue(issueKey) {
|
|
4609
|
+
const parsed = fetchIssue(issueKey, "summary,description");
|
|
4610
|
+
const fields = parsed?.fields;
|
|
4611
|
+
const summary = fields?.summary;
|
|
4612
|
+
const description = fields?.description;
|
|
4613
|
+
if (summary) {
|
|
4614
|
+
console.log(chalk50.bold(summary));
|
|
4615
|
+
}
|
|
4616
|
+
if (description) {
|
|
4617
|
+
if (summary) console.log();
|
|
4618
|
+
if (typeof description === "string") {
|
|
4619
|
+
console.log(description);
|
|
4620
|
+
} else if (description.type === "doc") {
|
|
4621
|
+
console.log(adfToText(description));
|
|
4622
|
+
} else {
|
|
4623
|
+
console.log(JSON.stringify(description, null, 2));
|
|
4624
|
+
}
|
|
4625
|
+
}
|
|
4626
|
+
if (!summary && !description) {
|
|
4627
|
+
console.log(
|
|
4628
|
+
chalk50.yellow(`No summary or description found on ${issueKey}.`)
|
|
4629
|
+
);
|
|
4630
|
+
}
|
|
4631
|
+
}
|
|
4632
|
+
|
|
4600
4633
|
// src/commands/registerJira.ts
|
|
4601
4634
|
function registerJira(program2) {
|
|
4602
4635
|
const jiraCommand = program2.command("jira").description("Jira utilities");
|
|
4603
4636
|
jiraCommand.command("auth").description("Authenticate with Jira via API token").action(() => jiraAuth());
|
|
4604
4637
|
jiraCommand.command("ac <issue-key>").description("Print acceptance criteria for a Jira issue").action((issueKey) => acceptanceCriteria(issueKey));
|
|
4638
|
+
jiraCommand.command("view <issue-key>").description("Print the title and description of a Jira issue").action((issueKey) => viewIssue(issueKey));
|
|
4605
4639
|
}
|
|
4606
4640
|
|
|
4607
4641
|
// src/commands/netframework/buildTree.ts
|
|
@@ -4700,30 +4734,30 @@ function escapeRegex(s) {
|
|
|
4700
4734
|
}
|
|
4701
4735
|
|
|
4702
4736
|
// src/commands/netframework/printTree.ts
|
|
4703
|
-
import
|
|
4737
|
+
import chalk51 from "chalk";
|
|
4704
4738
|
function printNodes(nodes, prefix2) {
|
|
4705
4739
|
for (let i = 0; i < nodes.length; i++) {
|
|
4706
4740
|
const isLast = i === nodes.length - 1;
|
|
4707
4741
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
4708
4742
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
4709
4743
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
4710
|
-
const label2 = isMissing ?
|
|
4744
|
+
const label2 = isMissing ? chalk51.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
4711
4745
|
console.log(`${prefix2}${connector}${label2}`);
|
|
4712
4746
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
4713
4747
|
}
|
|
4714
4748
|
}
|
|
4715
4749
|
function printTree(tree, totalCount, solutions) {
|
|
4716
|
-
console.log(
|
|
4717
|
-
console.log(
|
|
4750
|
+
console.log(chalk51.bold("\nProject Dependency Tree"));
|
|
4751
|
+
console.log(chalk51.cyan(tree.relativePath));
|
|
4718
4752
|
printNodes(tree.children, "");
|
|
4719
|
-
console.log(
|
|
4753
|
+
console.log(chalk51.dim(`
|
|
4720
4754
|
${totalCount} projects total (including root)`));
|
|
4721
|
-
console.log(
|
|
4755
|
+
console.log(chalk51.bold("\nSolution Membership"));
|
|
4722
4756
|
if (solutions.length === 0) {
|
|
4723
|
-
console.log(
|
|
4757
|
+
console.log(chalk51.yellow(" Not found in any .sln"));
|
|
4724
4758
|
} else {
|
|
4725
4759
|
for (const sln of solutions) {
|
|
4726
|
-
console.log(` ${
|
|
4760
|
+
console.log(` ${chalk51.green(sln)}`);
|
|
4727
4761
|
}
|
|
4728
4762
|
}
|
|
4729
4763
|
console.log();
|
|
@@ -4752,7 +4786,7 @@ function printJson(tree, totalCount, solutions) {
|
|
|
4752
4786
|
// src/commands/netframework/resolveCsproj.ts
|
|
4753
4787
|
import { existsSync as existsSync22 } from "fs";
|
|
4754
4788
|
import path24 from "path";
|
|
4755
|
-
import
|
|
4789
|
+
import chalk52 from "chalk";
|
|
4756
4790
|
|
|
4757
4791
|
// src/commands/netframework/findRepoRoot.ts
|
|
4758
4792
|
import { existsSync as existsSync21 } from "fs";
|
|
@@ -4772,12 +4806,12 @@ function findRepoRoot(dir) {
|
|
|
4772
4806
|
function resolveCsproj(csprojPath) {
|
|
4773
4807
|
const resolved = path24.resolve(csprojPath);
|
|
4774
4808
|
if (!existsSync22(resolved)) {
|
|
4775
|
-
console.error(
|
|
4809
|
+
console.error(chalk52.red(`File not found: ${resolved}`));
|
|
4776
4810
|
process.exit(1);
|
|
4777
4811
|
}
|
|
4778
4812
|
const repoRoot = findRepoRoot(path24.dirname(resolved));
|
|
4779
4813
|
if (!repoRoot) {
|
|
4780
|
-
console.error(
|
|
4814
|
+
console.error(chalk52.red("Could not find git repository root"));
|
|
4781
4815
|
process.exit(1);
|
|
4782
4816
|
}
|
|
4783
4817
|
return { resolved, repoRoot };
|
|
@@ -4797,12 +4831,12 @@ async function deps(csprojPath, options2) {
|
|
|
4797
4831
|
}
|
|
4798
4832
|
|
|
4799
4833
|
// src/commands/netframework/inSln.ts
|
|
4800
|
-
import
|
|
4834
|
+
import chalk53 from "chalk";
|
|
4801
4835
|
async function inSln(csprojPath) {
|
|
4802
4836
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
4803
4837
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
4804
4838
|
if (solutions.length === 0) {
|
|
4805
|
-
console.log(
|
|
4839
|
+
console.log(chalk53.yellow("Not found in any .sln file"));
|
|
4806
4840
|
process.exit(1);
|
|
4807
4841
|
}
|
|
4808
4842
|
for (const sln of solutions) {
|
|
@@ -4818,7 +4852,7 @@ function registerNetframework(program2) {
|
|
|
4818
4852
|
}
|
|
4819
4853
|
|
|
4820
4854
|
// src/commands/news/add/index.ts
|
|
4821
|
-
import
|
|
4855
|
+
import chalk54 from "chalk";
|
|
4822
4856
|
import enquirer5 from "enquirer";
|
|
4823
4857
|
async function add2(url) {
|
|
4824
4858
|
if (!url) {
|
|
@@ -4841,17 +4875,17 @@ async function add2(url) {
|
|
|
4841
4875
|
const news = config.news ?? {};
|
|
4842
4876
|
const feeds = news.feeds ?? [];
|
|
4843
4877
|
if (feeds.includes(url)) {
|
|
4844
|
-
console.log(
|
|
4878
|
+
console.log(chalk54.yellow("Feed already exists in config"));
|
|
4845
4879
|
return;
|
|
4846
4880
|
}
|
|
4847
4881
|
feeds.push(url);
|
|
4848
4882
|
config.news = { ...news, feeds };
|
|
4849
4883
|
saveGlobalConfig(config);
|
|
4850
|
-
console.log(
|
|
4884
|
+
console.log(chalk54.green(`Added feed: ${url}`));
|
|
4851
4885
|
}
|
|
4852
4886
|
|
|
4853
4887
|
// src/commands/news/web/handleRequest.ts
|
|
4854
|
-
import
|
|
4888
|
+
import chalk55 from "chalk";
|
|
4855
4889
|
|
|
4856
4890
|
// src/commands/news/web/shared.ts
|
|
4857
4891
|
import { decodeHTML } from "entities";
|
|
@@ -4987,17 +5021,17 @@ function prefetch() {
|
|
|
4987
5021
|
const config = loadConfig();
|
|
4988
5022
|
const total = config.news.feeds.length;
|
|
4989
5023
|
if (total === 0) return;
|
|
4990
|
-
process.stdout.write(
|
|
5024
|
+
process.stdout.write(chalk55.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
4991
5025
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
4992
5026
|
const width = 20;
|
|
4993
5027
|
const filled = Math.round(done2 / t * width);
|
|
4994
5028
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
4995
5029
|
process.stdout.write(
|
|
4996
|
-
`\r${
|
|
5030
|
+
`\r${chalk55.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
4997
5031
|
);
|
|
4998
5032
|
}).then((items) => {
|
|
4999
5033
|
process.stdout.write(
|
|
5000
|
-
`\r${
|
|
5034
|
+
`\r${chalk55.green(`Fetched ${items.length} items from ${total} feed(s)`)}
|
|
5001
5035
|
`
|
|
5002
5036
|
);
|
|
5003
5037
|
cachedItems = items;
|
|
@@ -5358,20 +5392,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
5358
5392
|
}
|
|
5359
5393
|
|
|
5360
5394
|
// src/commands/prs/listComments/printComments.ts
|
|
5361
|
-
import
|
|
5395
|
+
import chalk56 from "chalk";
|
|
5362
5396
|
function formatForHuman(comment2) {
|
|
5363
5397
|
if (comment2.type === "review") {
|
|
5364
|
-
const stateColor = comment2.state === "APPROVED" ?
|
|
5398
|
+
const stateColor = comment2.state === "APPROVED" ? chalk56.green : comment2.state === "CHANGES_REQUESTED" ? chalk56.red : chalk56.yellow;
|
|
5365
5399
|
return [
|
|
5366
|
-
`${
|
|
5400
|
+
`${chalk56.cyan("Review")} by ${chalk56.bold(comment2.user)} ${stateColor(`[${comment2.state}]`)}`,
|
|
5367
5401
|
comment2.body,
|
|
5368
5402
|
""
|
|
5369
5403
|
].join("\n");
|
|
5370
5404
|
}
|
|
5371
5405
|
const location = comment2.line ? `:${comment2.line}` : "";
|
|
5372
5406
|
return [
|
|
5373
|
-
`${
|
|
5374
|
-
|
|
5407
|
+
`${chalk56.cyan("Line comment")} by ${chalk56.bold(comment2.user)} on ${chalk56.dim(`${comment2.path}${location}`)}`,
|
|
5408
|
+
chalk56.dim(comment2.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
5375
5409
|
comment2.body,
|
|
5376
5410
|
""
|
|
5377
5411
|
].join("\n");
|
|
@@ -5461,13 +5495,13 @@ import { execSync as execSync27 } from "child_process";
|
|
|
5461
5495
|
import enquirer6 from "enquirer";
|
|
5462
5496
|
|
|
5463
5497
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
5464
|
-
import
|
|
5498
|
+
import chalk57 from "chalk";
|
|
5465
5499
|
var STATUS_MAP = {
|
|
5466
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
5467
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
5500
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk57.magenta("merged"), date: pr.mergedAt } : null,
|
|
5501
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk57.red("closed"), date: pr.closedAt } : null
|
|
5468
5502
|
};
|
|
5469
5503
|
function defaultStatus(pr) {
|
|
5470
|
-
return { label:
|
|
5504
|
+
return { label: chalk57.green("opened"), date: pr.createdAt };
|
|
5471
5505
|
}
|
|
5472
5506
|
function getStatus2(pr) {
|
|
5473
5507
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -5476,11 +5510,11 @@ function formatDate(dateStr) {
|
|
|
5476
5510
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
5477
5511
|
}
|
|
5478
5512
|
function formatPrHeader(pr, status2) {
|
|
5479
|
-
return `${
|
|
5513
|
+
return `${chalk57.cyan(`#${pr.number}`)} ${pr.title} ${chalk57.dim(`(${pr.author.login},`)} ${status2.label} ${chalk57.dim(`${formatDate(status2.date)})`)}`;
|
|
5480
5514
|
}
|
|
5481
5515
|
function logPrDetails(pr) {
|
|
5482
5516
|
console.log(
|
|
5483
|
-
|
|
5517
|
+
chalk57.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
5484
5518
|
);
|
|
5485
5519
|
console.log();
|
|
5486
5520
|
}
|
|
@@ -5646,7 +5680,7 @@ function registerPrs(program2) {
|
|
|
5646
5680
|
}
|
|
5647
5681
|
|
|
5648
5682
|
// src/commands/ravendb/ravendbAuth.ts
|
|
5649
|
-
import
|
|
5683
|
+
import chalk62 from "chalk";
|
|
5650
5684
|
|
|
5651
5685
|
// src/commands/ravendb/loadConnections.ts
|
|
5652
5686
|
function loadConnections() {
|
|
@@ -5663,16 +5697,16 @@ function saveConnections(connections) {
|
|
|
5663
5697
|
}
|
|
5664
5698
|
|
|
5665
5699
|
// src/commands/ravendb/promptConnection.ts
|
|
5666
|
-
import
|
|
5700
|
+
import chalk60 from "chalk";
|
|
5667
5701
|
import Enquirer3 from "enquirer";
|
|
5668
5702
|
|
|
5669
5703
|
// src/commands/ravendb/selectOpSecret.ts
|
|
5670
|
-
import
|
|
5704
|
+
import chalk59 from "chalk";
|
|
5671
5705
|
import Enquirer2 from "enquirer";
|
|
5672
5706
|
|
|
5673
5707
|
// src/commands/ravendb/searchItems.ts
|
|
5674
5708
|
import { execSync as execSync29 } from "child_process";
|
|
5675
|
-
import
|
|
5709
|
+
import chalk58 from "chalk";
|
|
5676
5710
|
function opExec(args) {
|
|
5677
5711
|
return execSync29(`op ${args}`, {
|
|
5678
5712
|
encoding: "utf-8",
|
|
@@ -5685,7 +5719,7 @@ function searchItems(search) {
|
|
|
5685
5719
|
items = JSON.parse(opExec("item list --format=json"));
|
|
5686
5720
|
} catch {
|
|
5687
5721
|
console.error(
|
|
5688
|
-
|
|
5722
|
+
chalk58.red(
|
|
5689
5723
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
5690
5724
|
)
|
|
5691
5725
|
);
|
|
@@ -5699,7 +5733,7 @@ function getItemFields(itemId) {
|
|
|
5699
5733
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
5700
5734
|
return item.fields.filter((f) => f.reference && f.label);
|
|
5701
5735
|
} catch {
|
|
5702
|
-
console.error(
|
|
5736
|
+
console.error(chalk58.red("Failed to get item details from 1Password."));
|
|
5703
5737
|
process.exit(1);
|
|
5704
5738
|
}
|
|
5705
5739
|
}
|
|
@@ -5718,7 +5752,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
5718
5752
|
}).run();
|
|
5719
5753
|
const items = searchItems(search);
|
|
5720
5754
|
if (items.length === 0) {
|
|
5721
|
-
console.error(
|
|
5755
|
+
console.error(chalk59.red(`No items found matching "${search}".`));
|
|
5722
5756
|
process.exit(1);
|
|
5723
5757
|
}
|
|
5724
5758
|
const itemId = await selectOne(
|
|
@@ -5727,7 +5761,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
5727
5761
|
);
|
|
5728
5762
|
const fields = getItemFields(itemId);
|
|
5729
5763
|
if (fields.length === 0) {
|
|
5730
|
-
console.error(
|
|
5764
|
+
console.error(chalk59.red("No fields with references found on this item."));
|
|
5731
5765
|
process.exit(1);
|
|
5732
5766
|
}
|
|
5733
5767
|
const ref = await selectOne(
|
|
@@ -5745,7 +5779,7 @@ async function promptConnection(existingNames) {
|
|
|
5745
5779
|
message: "Connection name:"
|
|
5746
5780
|
}).run();
|
|
5747
5781
|
if (existingNames.includes(name)) {
|
|
5748
|
-
console.error(
|
|
5782
|
+
console.error(chalk60.red(`Connection "${name}" already exists.`));
|
|
5749
5783
|
process.exit(1);
|
|
5750
5784
|
}
|
|
5751
5785
|
const url = await new Input2({
|
|
@@ -5757,22 +5791,22 @@ async function promptConnection(existingNames) {
|
|
|
5757
5791
|
message: "Database name:"
|
|
5758
5792
|
}).run();
|
|
5759
5793
|
if (!name || !url || !database) {
|
|
5760
|
-
console.error(
|
|
5794
|
+
console.error(chalk60.red("All fields are required."));
|
|
5761
5795
|
process.exit(1);
|
|
5762
5796
|
}
|
|
5763
5797
|
const apiKeyRef = await selectOpSecret();
|
|
5764
|
-
console.log(
|
|
5798
|
+
console.log(chalk60.dim(`Using: ${apiKeyRef}`));
|
|
5765
5799
|
return { name, url, database, apiKeyRef };
|
|
5766
5800
|
}
|
|
5767
5801
|
|
|
5768
5802
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
5769
|
-
import
|
|
5803
|
+
import chalk61 from "chalk";
|
|
5770
5804
|
function ravendbSetConnection(name) {
|
|
5771
5805
|
const raw = loadGlobalConfigRaw();
|
|
5772
5806
|
const ravendb = raw.ravendb ?? {};
|
|
5773
5807
|
const connections = ravendb.connections ?? [];
|
|
5774
5808
|
if (!connections.some((c) => c.name === name)) {
|
|
5775
|
-
console.error(
|
|
5809
|
+
console.error(chalk61.red(`Connection "${name}" not found.`));
|
|
5776
5810
|
console.error(
|
|
5777
5811
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
5778
5812
|
);
|
|
@@ -5794,7 +5828,7 @@ async function ravendbAuth(options2) {
|
|
|
5794
5828
|
}
|
|
5795
5829
|
for (const c of connections) {
|
|
5796
5830
|
console.log(
|
|
5797
|
-
`${
|
|
5831
|
+
`${chalk62.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`
|
|
5798
5832
|
);
|
|
5799
5833
|
}
|
|
5800
5834
|
return;
|
|
@@ -5802,7 +5836,7 @@ async function ravendbAuth(options2) {
|
|
|
5802
5836
|
if (options2.remove) {
|
|
5803
5837
|
const filtered = connections.filter((c) => c.name !== options2.remove);
|
|
5804
5838
|
if (filtered.length === connections.length) {
|
|
5805
|
-
console.error(
|
|
5839
|
+
console.error(chalk62.red(`Connection "${options2.remove}" not found.`));
|
|
5806
5840
|
process.exit(1);
|
|
5807
5841
|
}
|
|
5808
5842
|
saveConnections(filtered);
|
|
@@ -5820,10 +5854,10 @@ async function ravendbAuth(options2) {
|
|
|
5820
5854
|
}
|
|
5821
5855
|
|
|
5822
5856
|
// src/commands/ravendb/ravendbCollections.ts
|
|
5823
|
-
import
|
|
5857
|
+
import chalk66 from "chalk";
|
|
5824
5858
|
|
|
5825
5859
|
// src/commands/ravendb/ravenFetch.ts
|
|
5826
|
-
import
|
|
5860
|
+
import chalk64 from "chalk";
|
|
5827
5861
|
|
|
5828
5862
|
// src/commands/ravendb/getAccessToken.ts
|
|
5829
5863
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -5860,10 +5894,10 @@ ${errorText}`
|
|
|
5860
5894
|
|
|
5861
5895
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
5862
5896
|
import { execSync as execSync30 } from "child_process";
|
|
5863
|
-
import
|
|
5897
|
+
import chalk63 from "chalk";
|
|
5864
5898
|
function resolveOpSecret(reference) {
|
|
5865
5899
|
if (!reference.startsWith("op://")) {
|
|
5866
|
-
console.error(
|
|
5900
|
+
console.error(chalk63.red(`Invalid secret reference: must start with op://`));
|
|
5867
5901
|
process.exit(1);
|
|
5868
5902
|
}
|
|
5869
5903
|
try {
|
|
@@ -5873,7 +5907,7 @@ function resolveOpSecret(reference) {
|
|
|
5873
5907
|
}).trim();
|
|
5874
5908
|
} catch {
|
|
5875
5909
|
console.error(
|
|
5876
|
-
|
|
5910
|
+
chalk63.red(
|
|
5877
5911
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
5878
5912
|
)
|
|
5879
5913
|
);
|
|
@@ -5900,7 +5934,7 @@ async function ravenFetch(connection, path42) {
|
|
|
5900
5934
|
if (!response.ok) {
|
|
5901
5935
|
const body = await response.text();
|
|
5902
5936
|
console.error(
|
|
5903
|
-
|
|
5937
|
+
chalk64.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
5904
5938
|
);
|
|
5905
5939
|
console.error(body.substring(0, 500));
|
|
5906
5940
|
process.exit(1);
|
|
@@ -5909,7 +5943,7 @@ async function ravenFetch(connection, path42) {
|
|
|
5909
5943
|
}
|
|
5910
5944
|
|
|
5911
5945
|
// src/commands/ravendb/resolveConnection.ts
|
|
5912
|
-
import
|
|
5946
|
+
import chalk65 from "chalk";
|
|
5913
5947
|
function loadRavendb() {
|
|
5914
5948
|
const raw = loadGlobalConfigRaw();
|
|
5915
5949
|
const ravendb = raw.ravendb;
|
|
@@ -5923,7 +5957,7 @@ function resolveConnection(name) {
|
|
|
5923
5957
|
const connectionName = name ?? defaultConnection;
|
|
5924
5958
|
if (!connectionName) {
|
|
5925
5959
|
console.error(
|
|
5926
|
-
|
|
5960
|
+
chalk65.red(
|
|
5927
5961
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
5928
5962
|
)
|
|
5929
5963
|
);
|
|
@@ -5931,7 +5965,7 @@ function resolveConnection(name) {
|
|
|
5931
5965
|
}
|
|
5932
5966
|
const connection = connections.find((c) => c.name === connectionName);
|
|
5933
5967
|
if (!connection) {
|
|
5934
|
-
console.error(
|
|
5968
|
+
console.error(chalk65.red(`Connection "${connectionName}" not found.`));
|
|
5935
5969
|
console.error(
|
|
5936
5970
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
5937
5971
|
);
|
|
@@ -5962,15 +5996,15 @@ async function ravendbCollections(connectionName) {
|
|
|
5962
5996
|
return;
|
|
5963
5997
|
}
|
|
5964
5998
|
for (const c of collections) {
|
|
5965
|
-
console.log(`${
|
|
5999
|
+
console.log(`${chalk66.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
5966
6000
|
}
|
|
5967
6001
|
}
|
|
5968
6002
|
|
|
5969
6003
|
// src/commands/ravendb/ravendbQuery.ts
|
|
5970
|
-
import
|
|
6004
|
+
import chalk68 from "chalk";
|
|
5971
6005
|
|
|
5972
6006
|
// src/commands/ravendb/fetchAllPages.ts
|
|
5973
|
-
import
|
|
6007
|
+
import chalk67 from "chalk";
|
|
5974
6008
|
|
|
5975
6009
|
// src/commands/ravendb/buildQueryPath.ts
|
|
5976
6010
|
function buildQueryPath(opts) {
|
|
@@ -6008,7 +6042,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
6008
6042
|
allResults.push(...results);
|
|
6009
6043
|
start3 += results.length;
|
|
6010
6044
|
process.stderr.write(
|
|
6011
|
-
`\r${
|
|
6045
|
+
`\r${chalk67.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
6012
6046
|
);
|
|
6013
6047
|
if (start3 >= totalResults) break;
|
|
6014
6048
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -6023,7 +6057,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
6023
6057
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
6024
6058
|
const resolved = resolveArgs(connectionName, collection);
|
|
6025
6059
|
if (!resolved.collection && !options2.query) {
|
|
6026
|
-
console.error(
|
|
6060
|
+
console.error(chalk68.red("Provide a collection name or --query filter."));
|
|
6027
6061
|
process.exit(1);
|
|
6028
6062
|
}
|
|
6029
6063
|
const { collection: col } = resolved;
|
|
@@ -6058,7 +6092,7 @@ import { spawn as spawn3 } from "child_process";
|
|
|
6058
6092
|
import * as path25 from "path";
|
|
6059
6093
|
|
|
6060
6094
|
// src/commands/refactor/logViolations.ts
|
|
6061
|
-
import
|
|
6095
|
+
import chalk69 from "chalk";
|
|
6062
6096
|
var DEFAULT_MAX_LINES = 100;
|
|
6063
6097
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
6064
6098
|
if (violations.length === 0) {
|
|
@@ -6067,43 +6101,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
6067
6101
|
}
|
|
6068
6102
|
return;
|
|
6069
6103
|
}
|
|
6070
|
-
console.error(
|
|
6104
|
+
console.error(chalk69.red(`
|
|
6071
6105
|
Refactor check failed:
|
|
6072
6106
|
`));
|
|
6073
|
-
console.error(
|
|
6107
|
+
console.error(chalk69.red(` The following files exceed ${maxLines} lines:
|
|
6074
6108
|
`));
|
|
6075
6109
|
for (const violation of violations) {
|
|
6076
|
-
console.error(
|
|
6110
|
+
console.error(chalk69.red(` ${violation.file} (${violation.lines} lines)`));
|
|
6077
6111
|
}
|
|
6078
6112
|
console.error(
|
|
6079
|
-
|
|
6113
|
+
chalk69.yellow(
|
|
6080
6114
|
`
|
|
6081
6115
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
6082
6116
|
way to refactor it, ignore it with:
|
|
6083
6117
|
`
|
|
6084
6118
|
)
|
|
6085
6119
|
);
|
|
6086
|
-
console.error(
|
|
6120
|
+
console.error(chalk69.gray(` assist refactor ignore <file>
|
|
6087
6121
|
`));
|
|
6088
6122
|
if (process.env.CLAUDECODE) {
|
|
6089
|
-
console.error(
|
|
6123
|
+
console.error(chalk69.cyan(`
|
|
6090
6124
|
## Extracting Code to New Files
|
|
6091
6125
|
`));
|
|
6092
6126
|
console.error(
|
|
6093
|
-
|
|
6127
|
+
chalk69.cyan(
|
|
6094
6128
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
6095
6129
|
`
|
|
6096
6130
|
)
|
|
6097
6131
|
);
|
|
6098
6132
|
console.error(
|
|
6099
|
-
|
|
6133
|
+
chalk69.cyan(
|
|
6100
6134
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
6101
6135
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
6102
6136
|
`
|
|
6103
6137
|
)
|
|
6104
6138
|
);
|
|
6105
6139
|
console.error(
|
|
6106
|
-
|
|
6140
|
+
chalk69.cyan(
|
|
6107
6141
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
6108
6142
|
domains, move it to a common/shared folder.
|
|
6109
6143
|
`
|
|
@@ -6259,11 +6293,11 @@ async function check(pattern2, options2) {
|
|
|
6259
6293
|
|
|
6260
6294
|
// src/commands/refactor/ignore.ts
|
|
6261
6295
|
import fs17 from "fs";
|
|
6262
|
-
import
|
|
6296
|
+
import chalk70 from "chalk";
|
|
6263
6297
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
6264
6298
|
function ignore(file) {
|
|
6265
6299
|
if (!fs17.existsSync(file)) {
|
|
6266
|
-
console.error(
|
|
6300
|
+
console.error(chalk70.red(`Error: File does not exist: ${file}`));
|
|
6267
6301
|
process.exit(1);
|
|
6268
6302
|
}
|
|
6269
6303
|
const content = fs17.readFileSync(file, "utf-8");
|
|
@@ -6279,7 +6313,7 @@ function ignore(file) {
|
|
|
6279
6313
|
fs17.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
6280
6314
|
}
|
|
6281
6315
|
console.log(
|
|
6282
|
-
|
|
6316
|
+
chalk70.green(
|
|
6283
6317
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
6284
6318
|
)
|
|
6285
6319
|
);
|
|
@@ -6287,7 +6321,7 @@ function ignore(file) {
|
|
|
6287
6321
|
|
|
6288
6322
|
// src/commands/refactor/rename/index.ts
|
|
6289
6323
|
import path26 from "path";
|
|
6290
|
-
import
|
|
6324
|
+
import chalk71 from "chalk";
|
|
6291
6325
|
import { Project as Project2 } from "ts-morph";
|
|
6292
6326
|
async function rename(source, destination, options2 = {}) {
|
|
6293
6327
|
const sourcePath = path26.resolve(source);
|
|
@@ -6300,22 +6334,22 @@ async function rename(source, destination, options2 = {}) {
|
|
|
6300
6334
|
});
|
|
6301
6335
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
6302
6336
|
if (!sourceFile) {
|
|
6303
|
-
console.log(
|
|
6337
|
+
console.log(chalk71.red(`File not found in project: ${source}`));
|
|
6304
6338
|
process.exit(1);
|
|
6305
6339
|
}
|
|
6306
|
-
console.log(
|
|
6340
|
+
console.log(chalk71.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
6307
6341
|
if (options2.apply) {
|
|
6308
6342
|
sourceFile.move(destPath);
|
|
6309
6343
|
await project.save();
|
|
6310
|
-
console.log(
|
|
6344
|
+
console.log(chalk71.green("Done"));
|
|
6311
6345
|
} else {
|
|
6312
|
-
console.log(
|
|
6346
|
+
console.log(chalk71.dim("Dry run. Use --apply to execute."));
|
|
6313
6347
|
}
|
|
6314
6348
|
}
|
|
6315
6349
|
|
|
6316
6350
|
// src/commands/refactor/renameSymbol/index.ts
|
|
6317
6351
|
import path28 from "path";
|
|
6318
|
-
import
|
|
6352
|
+
import chalk72 from "chalk";
|
|
6319
6353
|
import { Project as Project3 } from "ts-morph";
|
|
6320
6354
|
|
|
6321
6355
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
@@ -6364,38 +6398,38 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
6364
6398
|
const project = new Project3({ tsConfigFilePath: tsConfigPath });
|
|
6365
6399
|
const sourceFile = project.getSourceFile(filePath);
|
|
6366
6400
|
if (!sourceFile) {
|
|
6367
|
-
console.log(
|
|
6401
|
+
console.log(chalk72.red(`File not found in project: ${file}`));
|
|
6368
6402
|
process.exit(1);
|
|
6369
6403
|
}
|
|
6370
6404
|
const symbol = findSymbol(sourceFile, oldName);
|
|
6371
6405
|
if (!symbol) {
|
|
6372
|
-
console.log(
|
|
6406
|
+
console.log(chalk72.red(`Symbol "${oldName}" not found in ${file}`));
|
|
6373
6407
|
process.exit(1);
|
|
6374
6408
|
}
|
|
6375
6409
|
const grouped = groupReferences(symbol, cwd);
|
|
6376
6410
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
6377
6411
|
console.log(
|
|
6378
|
-
|
|
6412
|
+
chalk72.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
6379
6413
|
`)
|
|
6380
6414
|
);
|
|
6381
6415
|
for (const [refFile, lines] of grouped) {
|
|
6382
6416
|
console.log(
|
|
6383
|
-
` ${
|
|
6417
|
+
` ${chalk72.dim(refFile)}: lines ${chalk72.cyan(lines.join(", "))}`
|
|
6384
6418
|
);
|
|
6385
6419
|
}
|
|
6386
6420
|
if (options2.apply) {
|
|
6387
6421
|
symbol.rename(newName);
|
|
6388
6422
|
await project.save();
|
|
6389
|
-
console.log(
|
|
6423
|
+
console.log(chalk72.green(`
|
|
6390
6424
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
6391
6425
|
} else {
|
|
6392
|
-
console.log(
|
|
6426
|
+
console.log(chalk72.dim("\nDry run. Use --apply to execute."));
|
|
6393
6427
|
}
|
|
6394
6428
|
}
|
|
6395
6429
|
|
|
6396
6430
|
// src/commands/refactor/restructure/index.ts
|
|
6397
6431
|
import path37 from "path";
|
|
6398
|
-
import
|
|
6432
|
+
import chalk75 from "chalk";
|
|
6399
6433
|
|
|
6400
6434
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
6401
6435
|
import path29 from "path";
|
|
@@ -6638,50 +6672,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
6638
6672
|
|
|
6639
6673
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
6640
6674
|
import path33 from "path";
|
|
6641
|
-
import
|
|
6675
|
+
import chalk73 from "chalk";
|
|
6642
6676
|
function relPath(filePath) {
|
|
6643
6677
|
return path33.relative(process.cwd(), filePath);
|
|
6644
6678
|
}
|
|
6645
6679
|
function displayMoves(plan) {
|
|
6646
6680
|
if (plan.moves.length === 0) return;
|
|
6647
|
-
console.log(
|
|
6681
|
+
console.log(chalk73.bold("\nFile moves:"));
|
|
6648
6682
|
for (const move of plan.moves) {
|
|
6649
6683
|
console.log(
|
|
6650
|
-
` ${
|
|
6684
|
+
` ${chalk73.red(relPath(move.from))} \u2192 ${chalk73.green(relPath(move.to))}`
|
|
6651
6685
|
);
|
|
6652
|
-
console.log(
|
|
6686
|
+
console.log(chalk73.dim(` ${move.reason}`));
|
|
6653
6687
|
}
|
|
6654
6688
|
}
|
|
6655
6689
|
function displayRewrites(rewrites) {
|
|
6656
6690
|
if (rewrites.length === 0) return;
|
|
6657
6691
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
6658
|
-
console.log(
|
|
6692
|
+
console.log(chalk73.bold(`
|
|
6659
6693
|
Import rewrites (${affectedFiles.size} files):`));
|
|
6660
6694
|
for (const file of affectedFiles) {
|
|
6661
|
-
console.log(` ${
|
|
6695
|
+
console.log(` ${chalk73.cyan(relPath(file))}:`);
|
|
6662
6696
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
6663
6697
|
(r) => r.file === file
|
|
6664
6698
|
)) {
|
|
6665
6699
|
console.log(
|
|
6666
|
-
` ${
|
|
6700
|
+
` ${chalk73.red(`"${oldSpecifier}"`)} \u2192 ${chalk73.green(`"${newSpecifier}"`)}`
|
|
6667
6701
|
);
|
|
6668
6702
|
}
|
|
6669
6703
|
}
|
|
6670
6704
|
}
|
|
6671
6705
|
function displayPlan(plan) {
|
|
6672
6706
|
if (plan.warnings.length > 0) {
|
|
6673
|
-
console.log(
|
|
6674
|
-
for (const w of plan.warnings) console.log(
|
|
6707
|
+
console.log(chalk73.yellow("\nWarnings:"));
|
|
6708
|
+
for (const w of plan.warnings) console.log(chalk73.yellow(` ${w}`));
|
|
6675
6709
|
}
|
|
6676
6710
|
if (plan.newDirectories.length > 0) {
|
|
6677
|
-
console.log(
|
|
6711
|
+
console.log(chalk73.bold("\nNew directories:"));
|
|
6678
6712
|
for (const dir of plan.newDirectories)
|
|
6679
|
-
console.log(
|
|
6713
|
+
console.log(chalk73.green(` ${dir}/`));
|
|
6680
6714
|
}
|
|
6681
6715
|
displayMoves(plan);
|
|
6682
6716
|
displayRewrites(plan.rewrites);
|
|
6683
6717
|
console.log(
|
|
6684
|
-
|
|
6718
|
+
chalk73.dim(
|
|
6685
6719
|
`
|
|
6686
6720
|
Summary: ${plan.moves.length} file(s) moved, ${plan.rewrites.length} imports rewritten`
|
|
6687
6721
|
)
|
|
@@ -6691,18 +6725,18 @@ Summary: ${plan.moves.length} file(s) moved, ${plan.rewrites.length} imports rew
|
|
|
6691
6725
|
// src/commands/refactor/restructure/executePlan.ts
|
|
6692
6726
|
import fs19 from "fs";
|
|
6693
6727
|
import path34 from "path";
|
|
6694
|
-
import
|
|
6728
|
+
import chalk74 from "chalk";
|
|
6695
6729
|
function executePlan(plan) {
|
|
6696
6730
|
const updatedContents = applyRewrites(plan.rewrites);
|
|
6697
6731
|
for (const [file, content] of updatedContents) {
|
|
6698
6732
|
fs19.writeFileSync(file, content, "utf-8");
|
|
6699
6733
|
console.log(
|
|
6700
|
-
|
|
6734
|
+
chalk74.cyan(` Rewrote imports in ${path34.relative(process.cwd(), file)}`)
|
|
6701
6735
|
);
|
|
6702
6736
|
}
|
|
6703
6737
|
for (const dir of plan.newDirectories) {
|
|
6704
6738
|
fs19.mkdirSync(dir, { recursive: true });
|
|
6705
|
-
console.log(
|
|
6739
|
+
console.log(chalk74.green(` Created ${path34.relative(process.cwd(), dir)}/`));
|
|
6706
6740
|
}
|
|
6707
6741
|
for (const move of plan.moves) {
|
|
6708
6742
|
const targetDir = path34.dirname(move.to);
|
|
@@ -6711,7 +6745,7 @@ function executePlan(plan) {
|
|
|
6711
6745
|
}
|
|
6712
6746
|
fs19.renameSync(move.from, move.to);
|
|
6713
6747
|
console.log(
|
|
6714
|
-
|
|
6748
|
+
chalk74.white(
|
|
6715
6749
|
` Moved ${path34.relative(process.cwd(), move.from)} \u2192 ${path34.relative(process.cwd(), move.to)}`
|
|
6716
6750
|
)
|
|
6717
6751
|
);
|
|
@@ -6726,7 +6760,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
6726
6760
|
if (entries.length === 0) {
|
|
6727
6761
|
fs19.rmdirSync(dir);
|
|
6728
6762
|
console.log(
|
|
6729
|
-
|
|
6763
|
+
chalk74.dim(
|
|
6730
6764
|
` Removed empty directory ${path34.relative(process.cwd(), dir)}`
|
|
6731
6765
|
)
|
|
6732
6766
|
);
|
|
@@ -6859,22 +6893,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
6859
6893
|
const targetPattern = pattern2 ?? "src";
|
|
6860
6894
|
const files = findSourceFiles2(targetPattern);
|
|
6861
6895
|
if (files.length === 0) {
|
|
6862
|
-
console.log(
|
|
6896
|
+
console.log(chalk75.yellow("No files found matching pattern"));
|
|
6863
6897
|
return;
|
|
6864
6898
|
}
|
|
6865
6899
|
const tsConfigPath = path37.resolve("tsconfig.json");
|
|
6866
6900
|
const plan = buildPlan(files, tsConfigPath);
|
|
6867
6901
|
if (plan.moves.length === 0) {
|
|
6868
|
-
console.log(
|
|
6902
|
+
console.log(chalk75.green("No restructuring needed"));
|
|
6869
6903
|
return;
|
|
6870
6904
|
}
|
|
6871
6905
|
displayPlan(plan);
|
|
6872
6906
|
if (options2.apply) {
|
|
6873
|
-
console.log(
|
|
6907
|
+
console.log(chalk75.bold("\nApplying changes..."));
|
|
6874
6908
|
executePlan(plan);
|
|
6875
|
-
console.log(
|
|
6909
|
+
console.log(chalk75.green("\nRestructuring complete"));
|
|
6876
6910
|
} else {
|
|
6877
|
-
console.log(
|
|
6911
|
+
console.log(chalk75.dim("\nDry run. Use --apply to execute."));
|
|
6878
6912
|
}
|
|
6879
6913
|
}
|
|
6880
6914
|
|
|
@@ -7422,14 +7456,14 @@ import {
|
|
|
7422
7456
|
import { dirname as dirname18, join as join26 } from "path";
|
|
7423
7457
|
|
|
7424
7458
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
7425
|
-
import
|
|
7459
|
+
import chalk76 from "chalk";
|
|
7426
7460
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
7427
7461
|
function validateStagedContent(filename, content) {
|
|
7428
7462
|
const firstLine = content.split("\n")[0];
|
|
7429
7463
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
7430
7464
|
if (!match) {
|
|
7431
7465
|
console.error(
|
|
7432
|
-
|
|
7466
|
+
chalk76.red(
|
|
7433
7467
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
7434
7468
|
)
|
|
7435
7469
|
);
|
|
@@ -7438,7 +7472,7 @@ function validateStagedContent(filename, content) {
|
|
|
7438
7472
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
7439
7473
|
if (!contentAfterLink) {
|
|
7440
7474
|
console.error(
|
|
7441
|
-
|
|
7475
|
+
chalk76.red(
|
|
7442
7476
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
7443
7477
|
)
|
|
7444
7478
|
);
|
|
@@ -7831,7 +7865,7 @@ function registerVoice(program2) {
|
|
|
7831
7865
|
|
|
7832
7866
|
// src/commands/roam/auth.ts
|
|
7833
7867
|
import { randomBytes } from "crypto";
|
|
7834
|
-
import
|
|
7868
|
+
import chalk77 from "chalk";
|
|
7835
7869
|
|
|
7836
7870
|
// src/lib/openBrowser.ts
|
|
7837
7871
|
import { execSync as execSync33 } from "child_process";
|
|
@@ -8006,13 +8040,13 @@ async function auth() {
|
|
|
8006
8040
|
saveGlobalConfig(config);
|
|
8007
8041
|
const state = randomBytes(16).toString("hex");
|
|
8008
8042
|
console.log(
|
|
8009
|
-
|
|
8043
|
+
chalk77.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
8010
8044
|
);
|
|
8011
|
-
console.log(
|
|
8012
|
-
console.log(
|
|
8013
|
-
console.log(
|
|
8045
|
+
console.log(chalk77.white("http://localhost:14523/callback\n"));
|
|
8046
|
+
console.log(chalk77.blue("Opening browser for authorization..."));
|
|
8047
|
+
console.log(chalk77.dim("Waiting for authorization callback..."));
|
|
8014
8048
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
8015
|
-
console.log(
|
|
8049
|
+
console.log(chalk77.dim("Exchanging code for tokens..."));
|
|
8016
8050
|
const tokens = await exchangeToken({
|
|
8017
8051
|
code,
|
|
8018
8052
|
clientId,
|
|
@@ -8028,7 +8062,7 @@ async function auth() {
|
|
|
8028
8062
|
};
|
|
8029
8063
|
saveGlobalConfig(config);
|
|
8030
8064
|
console.log(
|
|
8031
|
-
|
|
8065
|
+
chalk77.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
8032
8066
|
);
|
|
8033
8067
|
}
|
|
8034
8068
|
|
|
@@ -8216,14 +8250,14 @@ function run2(name, args) {
|
|
|
8216
8250
|
}
|
|
8217
8251
|
|
|
8218
8252
|
// src/commands/statusLine.ts
|
|
8219
|
-
import
|
|
8253
|
+
import chalk78 from "chalk";
|
|
8220
8254
|
function formatNumber(num) {
|
|
8221
8255
|
return num.toLocaleString("en-US");
|
|
8222
8256
|
}
|
|
8223
8257
|
function colorizePercent(pct) {
|
|
8224
8258
|
const label2 = `${pct}%`;
|
|
8225
|
-
if (pct > 80) return
|
|
8226
|
-
if (pct > 40) return
|
|
8259
|
+
if (pct > 80) return chalk78.red(label2);
|
|
8260
|
+
if (pct > 40) return chalk78.yellow(label2);
|
|
8227
8261
|
return label2;
|
|
8228
8262
|
}
|
|
8229
8263
|
async function statusLine() {
|
|
@@ -8249,7 +8283,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
8249
8283
|
// src/commands/sync/syncClaudeMd.ts
|
|
8250
8284
|
import * as fs22 from "fs";
|
|
8251
8285
|
import * as path38 from "path";
|
|
8252
|
-
import
|
|
8286
|
+
import chalk79 from "chalk";
|
|
8253
8287
|
async function syncClaudeMd(claudeDir, targetBase) {
|
|
8254
8288
|
const source = path38.join(claudeDir, "CLAUDE.md");
|
|
8255
8289
|
const target = path38.join(targetBase, "CLAUDE.md");
|
|
@@ -8258,12 +8292,12 @@ async function syncClaudeMd(claudeDir, targetBase) {
|
|
|
8258
8292
|
const targetContent = fs22.readFileSync(target, "utf-8");
|
|
8259
8293
|
if (sourceContent !== targetContent) {
|
|
8260
8294
|
console.log(
|
|
8261
|
-
|
|
8295
|
+
chalk79.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
8262
8296
|
);
|
|
8263
8297
|
console.log();
|
|
8264
8298
|
printDiff(targetContent, sourceContent);
|
|
8265
8299
|
const confirm = await promptConfirm(
|
|
8266
|
-
|
|
8300
|
+
chalk79.red("Overwrite existing CLAUDE.md?"),
|
|
8267
8301
|
false
|
|
8268
8302
|
);
|
|
8269
8303
|
if (!confirm) {
|
|
@@ -8279,7 +8313,7 @@ async function syncClaudeMd(claudeDir, targetBase) {
|
|
|
8279
8313
|
// src/commands/sync/syncSettings.ts
|
|
8280
8314
|
import * as fs23 from "fs";
|
|
8281
8315
|
import * as path39 from "path";
|
|
8282
|
-
import
|
|
8316
|
+
import chalk80 from "chalk";
|
|
8283
8317
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
8284
8318
|
const source = path39.join(claudeDir, "settings.json");
|
|
8285
8319
|
const target = path39.join(targetBase, "settings.json");
|
|
@@ -8295,14 +8329,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
8295
8329
|
if (mergedContent !== normalizedTarget) {
|
|
8296
8330
|
if (!options2?.yes) {
|
|
8297
8331
|
console.log(
|
|
8298
|
-
|
|
8332
|
+
chalk80.yellow(
|
|
8299
8333
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
8300
8334
|
)
|
|
8301
8335
|
);
|
|
8302
8336
|
console.log();
|
|
8303
8337
|
printDiff(targetContent, mergedContent);
|
|
8304
8338
|
const confirm = await promptConfirm(
|
|
8305
|
-
|
|
8339
|
+
chalk80.red("Overwrite existing settings.json?"),
|
|
8306
8340
|
false
|
|
8307
8341
|
);
|
|
8308
8342
|
if (!confirm) {
|