@staff0rd/assist 0.113.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/assist.cli-reads +29 -0
- package/claude/CLAUDE.md +4 -0
- package/claude/settings.json +1 -0
- package/dist/index.js +182 -145
- 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/assist.cli-reads
CHANGED
|
@@ -127,6 +127,7 @@ az afd security-policy list
|
|
|
127
127
|
az afd security-policy show
|
|
128
128
|
az afd waf-log-analytic metric list
|
|
129
129
|
az afd waf-log-analytic ranking list
|
|
130
|
+
az afd waf-policy list
|
|
130
131
|
az aks approuting zone list
|
|
131
132
|
az aks browse
|
|
132
133
|
az aks connection list
|
|
@@ -1086,6 +1087,34 @@ az network express-route port link show
|
|
|
1086
1087
|
az network express-route port list
|
|
1087
1088
|
az network express-route port show
|
|
1088
1089
|
az network express-route show
|
|
1090
|
+
az network front-door backend-pool backend list
|
|
1091
|
+
az network front-door backend-pool list
|
|
1092
|
+
az network front-door backend-pool show
|
|
1093
|
+
az network front-door frontend-endpoint list
|
|
1094
|
+
az network front-door frontend-endpoint show
|
|
1095
|
+
az network front-door list
|
|
1096
|
+
az network front-door load-balancing list
|
|
1097
|
+
az network front-door load-balancing show
|
|
1098
|
+
az network front-door probe list
|
|
1099
|
+
az network front-door probe show
|
|
1100
|
+
az network front-door routing-rule list
|
|
1101
|
+
az network front-door routing-rule show
|
|
1102
|
+
az network front-door rules-engine list
|
|
1103
|
+
az network front-door rules-engine rule action list
|
|
1104
|
+
az network front-door rules-engine rule condition list
|
|
1105
|
+
az network front-door rules-engine rule list
|
|
1106
|
+
az network front-door rules-engine rule show
|
|
1107
|
+
az network front-door rules-engine show
|
|
1108
|
+
az network front-door show
|
|
1109
|
+
az network front-door waf-policy list
|
|
1110
|
+
az network front-door waf-policy managed-rule-definition list
|
|
1111
|
+
az network front-door waf-policy managed-rules exclusion list
|
|
1112
|
+
az network front-door waf-policy managed-rules list
|
|
1113
|
+
az network front-door waf-policy managed-rules override list
|
|
1114
|
+
az network front-door waf-policy rule list
|
|
1115
|
+
az network front-door waf-policy rule match-condition list
|
|
1116
|
+
az network front-door waf-policy rule show
|
|
1117
|
+
az network front-door waf-policy show
|
|
1089
1118
|
az network lb address-pool address list
|
|
1090
1119
|
az network lb address-pool address show
|
|
1091
1120
|
az network lb address-pool list
|
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: {
|
|
@@ -3198,14 +3198,14 @@ async function discoverAt(cli, parentPath, depth, p) {
|
|
|
3198
3198
|
);
|
|
3199
3199
|
return results.flat();
|
|
3200
3200
|
}
|
|
3201
|
-
async function discoverAll(cli) {
|
|
3202
|
-
const topLevel = parseCommands(await runHelp([cli]));
|
|
3201
|
+
async function discoverAll(cli, prefixPath = []) {
|
|
3202
|
+
const topLevel = parseCommands(await runHelp([cli, ...prefixPath]));
|
|
3203
3203
|
const p = { done: 0, total: topLevel.length };
|
|
3204
3204
|
const results = await mapAsync(topLevel, CONCURRENCY, async (cmd) => {
|
|
3205
3205
|
showProgress(p, cmd.name);
|
|
3206
3206
|
const resolved = await resolveCommand(
|
|
3207
3207
|
cli,
|
|
3208
|
-
[cmd.name],
|
|
3208
|
+
[...prefixPath, cmd.name],
|
|
3209
3209
|
cmd.description,
|
|
3210
3210
|
1,
|
|
3211
3211
|
p
|
|
@@ -3353,20 +3353,23 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
3353
3353
|
);
|
|
3354
3354
|
process.exit(1);
|
|
3355
3355
|
}
|
|
3356
|
+
const parts = cli.split(/\s+/);
|
|
3357
|
+
const binary = parts[0];
|
|
3358
|
+
const prefixPath = parts.slice(1);
|
|
3356
3359
|
if (!options2.noCache) {
|
|
3357
3360
|
const cached2 = readCache(cli);
|
|
3358
3361
|
if (cached2) {
|
|
3359
3362
|
console.log(colorize(cached2));
|
|
3360
|
-
updateSettings(
|
|
3363
|
+
updateSettings(binary, parseCached(binary, cached2));
|
|
3361
3364
|
return;
|
|
3362
3365
|
}
|
|
3363
3366
|
}
|
|
3364
3367
|
assertCliExists(cli);
|
|
3365
|
-
const commands = await discoverAll(
|
|
3366
|
-
const output = formatHuman(
|
|
3368
|
+
const commands = await discoverAll(binary, prefixPath);
|
|
3369
|
+
const output = formatHuman(binary, commands);
|
|
3367
3370
|
console.log(colorize(output));
|
|
3368
3371
|
writeCache(cli, output);
|
|
3369
|
-
updateSettings(
|
|
3372
|
+
updateSettings(binary, commands);
|
|
3370
3373
|
}
|
|
3371
3374
|
|
|
3372
3375
|
// src/commands/registerCliHook.ts
|
|
@@ -4414,8 +4417,7 @@ function registerDevlog(program2) {
|
|
|
4414
4417
|
}
|
|
4415
4418
|
|
|
4416
4419
|
// src/commands/jira/acceptanceCriteria.ts
|
|
4417
|
-
import
|
|
4418
|
-
import chalk48 from "chalk";
|
|
4420
|
+
import chalk49 from "chalk";
|
|
4419
4421
|
|
|
4420
4422
|
// src/commands/jira/adfToText.ts
|
|
4421
4423
|
function renderInline(node) {
|
|
@@ -4474,15 +4476,14 @@ function adfToText(doc) {
|
|
|
4474
4476
|
return renderNodes([doc], 0);
|
|
4475
4477
|
}
|
|
4476
4478
|
|
|
4477
|
-
// src/commands/jira/
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
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) {
|
|
4482
4483
|
let result;
|
|
4483
4484
|
try {
|
|
4484
4485
|
result = execSync20(
|
|
4485
|
-
`acli jira workitem view ${issueKey} -f ${
|
|
4486
|
+
`acli jira workitem view ${issueKey} -f ${fields} --json`,
|
|
4486
4487
|
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
4487
4488
|
);
|
|
4488
4489
|
} catch (error) {
|
|
@@ -4501,10 +4502,18 @@ function acceptanceCriteria(issueKey) {
|
|
|
4501
4502
|
console.error(chalk48.red(`Failed to fetch ${issueKey}.`));
|
|
4502
4503
|
process.exit(1);
|
|
4503
4504
|
}
|
|
4504
|
-
|
|
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);
|
|
4505
4514
|
const acValue = parsed?.fields?.[field];
|
|
4506
4515
|
if (!acValue) {
|
|
4507
|
-
console.log(
|
|
4516
|
+
console.log(chalk49.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
4508
4517
|
return;
|
|
4509
4518
|
}
|
|
4510
4519
|
if (typeof acValue === "string") {
|
|
@@ -4594,11 +4603,39 @@ async function jiraAuth() {
|
|
|
4594
4603
|
}
|
|
4595
4604
|
}
|
|
4596
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
|
+
|
|
4597
4633
|
// src/commands/registerJira.ts
|
|
4598
4634
|
function registerJira(program2) {
|
|
4599
4635
|
const jiraCommand = program2.command("jira").description("Jira utilities");
|
|
4600
4636
|
jiraCommand.command("auth").description("Authenticate with Jira via API token").action(() => jiraAuth());
|
|
4601
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));
|
|
4602
4639
|
}
|
|
4603
4640
|
|
|
4604
4641
|
// src/commands/netframework/buildTree.ts
|
|
@@ -4697,30 +4734,30 @@ function escapeRegex(s) {
|
|
|
4697
4734
|
}
|
|
4698
4735
|
|
|
4699
4736
|
// src/commands/netframework/printTree.ts
|
|
4700
|
-
import
|
|
4737
|
+
import chalk51 from "chalk";
|
|
4701
4738
|
function printNodes(nodes, prefix2) {
|
|
4702
4739
|
for (let i = 0; i < nodes.length; i++) {
|
|
4703
4740
|
const isLast = i === nodes.length - 1;
|
|
4704
4741
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
4705
4742
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
4706
4743
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
4707
|
-
const label2 = isMissing ?
|
|
4744
|
+
const label2 = isMissing ? chalk51.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
4708
4745
|
console.log(`${prefix2}${connector}${label2}`);
|
|
4709
4746
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
4710
4747
|
}
|
|
4711
4748
|
}
|
|
4712
4749
|
function printTree(tree, totalCount, solutions) {
|
|
4713
|
-
console.log(
|
|
4714
|
-
console.log(
|
|
4750
|
+
console.log(chalk51.bold("\nProject Dependency Tree"));
|
|
4751
|
+
console.log(chalk51.cyan(tree.relativePath));
|
|
4715
4752
|
printNodes(tree.children, "");
|
|
4716
|
-
console.log(
|
|
4753
|
+
console.log(chalk51.dim(`
|
|
4717
4754
|
${totalCount} projects total (including root)`));
|
|
4718
|
-
console.log(
|
|
4755
|
+
console.log(chalk51.bold("\nSolution Membership"));
|
|
4719
4756
|
if (solutions.length === 0) {
|
|
4720
|
-
console.log(
|
|
4757
|
+
console.log(chalk51.yellow(" Not found in any .sln"));
|
|
4721
4758
|
} else {
|
|
4722
4759
|
for (const sln of solutions) {
|
|
4723
|
-
console.log(` ${
|
|
4760
|
+
console.log(` ${chalk51.green(sln)}`);
|
|
4724
4761
|
}
|
|
4725
4762
|
}
|
|
4726
4763
|
console.log();
|
|
@@ -4749,7 +4786,7 @@ function printJson(tree, totalCount, solutions) {
|
|
|
4749
4786
|
// src/commands/netframework/resolveCsproj.ts
|
|
4750
4787
|
import { existsSync as existsSync22 } from "fs";
|
|
4751
4788
|
import path24 from "path";
|
|
4752
|
-
import
|
|
4789
|
+
import chalk52 from "chalk";
|
|
4753
4790
|
|
|
4754
4791
|
// src/commands/netframework/findRepoRoot.ts
|
|
4755
4792
|
import { existsSync as existsSync21 } from "fs";
|
|
@@ -4769,12 +4806,12 @@ function findRepoRoot(dir) {
|
|
|
4769
4806
|
function resolveCsproj(csprojPath) {
|
|
4770
4807
|
const resolved = path24.resolve(csprojPath);
|
|
4771
4808
|
if (!existsSync22(resolved)) {
|
|
4772
|
-
console.error(
|
|
4809
|
+
console.error(chalk52.red(`File not found: ${resolved}`));
|
|
4773
4810
|
process.exit(1);
|
|
4774
4811
|
}
|
|
4775
4812
|
const repoRoot = findRepoRoot(path24.dirname(resolved));
|
|
4776
4813
|
if (!repoRoot) {
|
|
4777
|
-
console.error(
|
|
4814
|
+
console.error(chalk52.red("Could not find git repository root"));
|
|
4778
4815
|
process.exit(1);
|
|
4779
4816
|
}
|
|
4780
4817
|
return { resolved, repoRoot };
|
|
@@ -4794,12 +4831,12 @@ async function deps(csprojPath, options2) {
|
|
|
4794
4831
|
}
|
|
4795
4832
|
|
|
4796
4833
|
// src/commands/netframework/inSln.ts
|
|
4797
|
-
import
|
|
4834
|
+
import chalk53 from "chalk";
|
|
4798
4835
|
async function inSln(csprojPath) {
|
|
4799
4836
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
4800
4837
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
4801
4838
|
if (solutions.length === 0) {
|
|
4802
|
-
console.log(
|
|
4839
|
+
console.log(chalk53.yellow("Not found in any .sln file"));
|
|
4803
4840
|
process.exit(1);
|
|
4804
4841
|
}
|
|
4805
4842
|
for (const sln of solutions) {
|
|
@@ -4815,7 +4852,7 @@ function registerNetframework(program2) {
|
|
|
4815
4852
|
}
|
|
4816
4853
|
|
|
4817
4854
|
// src/commands/news/add/index.ts
|
|
4818
|
-
import
|
|
4855
|
+
import chalk54 from "chalk";
|
|
4819
4856
|
import enquirer5 from "enquirer";
|
|
4820
4857
|
async function add2(url) {
|
|
4821
4858
|
if (!url) {
|
|
@@ -4838,17 +4875,17 @@ async function add2(url) {
|
|
|
4838
4875
|
const news = config.news ?? {};
|
|
4839
4876
|
const feeds = news.feeds ?? [];
|
|
4840
4877
|
if (feeds.includes(url)) {
|
|
4841
|
-
console.log(
|
|
4878
|
+
console.log(chalk54.yellow("Feed already exists in config"));
|
|
4842
4879
|
return;
|
|
4843
4880
|
}
|
|
4844
4881
|
feeds.push(url);
|
|
4845
4882
|
config.news = { ...news, feeds };
|
|
4846
4883
|
saveGlobalConfig(config);
|
|
4847
|
-
console.log(
|
|
4884
|
+
console.log(chalk54.green(`Added feed: ${url}`));
|
|
4848
4885
|
}
|
|
4849
4886
|
|
|
4850
4887
|
// src/commands/news/web/handleRequest.ts
|
|
4851
|
-
import
|
|
4888
|
+
import chalk55 from "chalk";
|
|
4852
4889
|
|
|
4853
4890
|
// src/commands/news/web/shared.ts
|
|
4854
4891
|
import { decodeHTML } from "entities";
|
|
@@ -4984,17 +5021,17 @@ function prefetch() {
|
|
|
4984
5021
|
const config = loadConfig();
|
|
4985
5022
|
const total = config.news.feeds.length;
|
|
4986
5023
|
if (total === 0) return;
|
|
4987
|
-
process.stdout.write(
|
|
5024
|
+
process.stdout.write(chalk55.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
4988
5025
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
4989
5026
|
const width = 20;
|
|
4990
5027
|
const filled = Math.round(done2 / t * width);
|
|
4991
5028
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
4992
5029
|
process.stdout.write(
|
|
4993
|
-
`\r${
|
|
5030
|
+
`\r${chalk55.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
4994
5031
|
);
|
|
4995
5032
|
}).then((items) => {
|
|
4996
5033
|
process.stdout.write(
|
|
4997
|
-
`\r${
|
|
5034
|
+
`\r${chalk55.green(`Fetched ${items.length} items from ${total} feed(s)`)}
|
|
4998
5035
|
`
|
|
4999
5036
|
);
|
|
5000
5037
|
cachedItems = items;
|
|
@@ -5355,20 +5392,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
5355
5392
|
}
|
|
5356
5393
|
|
|
5357
5394
|
// src/commands/prs/listComments/printComments.ts
|
|
5358
|
-
import
|
|
5395
|
+
import chalk56 from "chalk";
|
|
5359
5396
|
function formatForHuman(comment2) {
|
|
5360
5397
|
if (comment2.type === "review") {
|
|
5361
|
-
const stateColor = comment2.state === "APPROVED" ?
|
|
5398
|
+
const stateColor = comment2.state === "APPROVED" ? chalk56.green : comment2.state === "CHANGES_REQUESTED" ? chalk56.red : chalk56.yellow;
|
|
5362
5399
|
return [
|
|
5363
|
-
`${
|
|
5400
|
+
`${chalk56.cyan("Review")} by ${chalk56.bold(comment2.user)} ${stateColor(`[${comment2.state}]`)}`,
|
|
5364
5401
|
comment2.body,
|
|
5365
5402
|
""
|
|
5366
5403
|
].join("\n");
|
|
5367
5404
|
}
|
|
5368
5405
|
const location = comment2.line ? `:${comment2.line}` : "";
|
|
5369
5406
|
return [
|
|
5370
|
-
`${
|
|
5371
|
-
|
|
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")),
|
|
5372
5409
|
comment2.body,
|
|
5373
5410
|
""
|
|
5374
5411
|
].join("\n");
|
|
@@ -5458,13 +5495,13 @@ import { execSync as execSync27 } from "child_process";
|
|
|
5458
5495
|
import enquirer6 from "enquirer";
|
|
5459
5496
|
|
|
5460
5497
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
5461
|
-
import
|
|
5498
|
+
import chalk57 from "chalk";
|
|
5462
5499
|
var STATUS_MAP = {
|
|
5463
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
5464
|
-
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
|
|
5465
5502
|
};
|
|
5466
5503
|
function defaultStatus(pr) {
|
|
5467
|
-
return { label:
|
|
5504
|
+
return { label: chalk57.green("opened"), date: pr.createdAt };
|
|
5468
5505
|
}
|
|
5469
5506
|
function getStatus2(pr) {
|
|
5470
5507
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -5473,11 +5510,11 @@ function formatDate(dateStr) {
|
|
|
5473
5510
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
5474
5511
|
}
|
|
5475
5512
|
function formatPrHeader(pr, status2) {
|
|
5476
|
-
return `${
|
|
5513
|
+
return `${chalk57.cyan(`#${pr.number}`)} ${pr.title} ${chalk57.dim(`(${pr.author.login},`)} ${status2.label} ${chalk57.dim(`${formatDate(status2.date)})`)}`;
|
|
5477
5514
|
}
|
|
5478
5515
|
function logPrDetails(pr) {
|
|
5479
5516
|
console.log(
|
|
5480
|
-
|
|
5517
|
+
chalk57.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
5481
5518
|
);
|
|
5482
5519
|
console.log();
|
|
5483
5520
|
}
|
|
@@ -5643,7 +5680,7 @@ function registerPrs(program2) {
|
|
|
5643
5680
|
}
|
|
5644
5681
|
|
|
5645
5682
|
// src/commands/ravendb/ravendbAuth.ts
|
|
5646
|
-
import
|
|
5683
|
+
import chalk62 from "chalk";
|
|
5647
5684
|
|
|
5648
5685
|
// src/commands/ravendb/loadConnections.ts
|
|
5649
5686
|
function loadConnections() {
|
|
@@ -5660,16 +5697,16 @@ function saveConnections(connections) {
|
|
|
5660
5697
|
}
|
|
5661
5698
|
|
|
5662
5699
|
// src/commands/ravendb/promptConnection.ts
|
|
5663
|
-
import
|
|
5700
|
+
import chalk60 from "chalk";
|
|
5664
5701
|
import Enquirer3 from "enquirer";
|
|
5665
5702
|
|
|
5666
5703
|
// src/commands/ravendb/selectOpSecret.ts
|
|
5667
|
-
import
|
|
5704
|
+
import chalk59 from "chalk";
|
|
5668
5705
|
import Enquirer2 from "enquirer";
|
|
5669
5706
|
|
|
5670
5707
|
// src/commands/ravendb/searchItems.ts
|
|
5671
5708
|
import { execSync as execSync29 } from "child_process";
|
|
5672
|
-
import
|
|
5709
|
+
import chalk58 from "chalk";
|
|
5673
5710
|
function opExec(args) {
|
|
5674
5711
|
return execSync29(`op ${args}`, {
|
|
5675
5712
|
encoding: "utf-8",
|
|
@@ -5682,7 +5719,7 @@ function searchItems(search) {
|
|
|
5682
5719
|
items = JSON.parse(opExec("item list --format=json"));
|
|
5683
5720
|
} catch {
|
|
5684
5721
|
console.error(
|
|
5685
|
-
|
|
5722
|
+
chalk58.red(
|
|
5686
5723
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
5687
5724
|
)
|
|
5688
5725
|
);
|
|
@@ -5696,7 +5733,7 @@ function getItemFields(itemId) {
|
|
|
5696
5733
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
5697
5734
|
return item.fields.filter((f) => f.reference && f.label);
|
|
5698
5735
|
} catch {
|
|
5699
|
-
console.error(
|
|
5736
|
+
console.error(chalk58.red("Failed to get item details from 1Password."));
|
|
5700
5737
|
process.exit(1);
|
|
5701
5738
|
}
|
|
5702
5739
|
}
|
|
@@ -5715,7 +5752,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
5715
5752
|
}).run();
|
|
5716
5753
|
const items = searchItems(search);
|
|
5717
5754
|
if (items.length === 0) {
|
|
5718
|
-
console.error(
|
|
5755
|
+
console.error(chalk59.red(`No items found matching "${search}".`));
|
|
5719
5756
|
process.exit(1);
|
|
5720
5757
|
}
|
|
5721
5758
|
const itemId = await selectOne(
|
|
@@ -5724,7 +5761,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
5724
5761
|
);
|
|
5725
5762
|
const fields = getItemFields(itemId);
|
|
5726
5763
|
if (fields.length === 0) {
|
|
5727
|
-
console.error(
|
|
5764
|
+
console.error(chalk59.red("No fields with references found on this item."));
|
|
5728
5765
|
process.exit(1);
|
|
5729
5766
|
}
|
|
5730
5767
|
const ref = await selectOne(
|
|
@@ -5742,7 +5779,7 @@ async function promptConnection(existingNames) {
|
|
|
5742
5779
|
message: "Connection name:"
|
|
5743
5780
|
}).run();
|
|
5744
5781
|
if (existingNames.includes(name)) {
|
|
5745
|
-
console.error(
|
|
5782
|
+
console.error(chalk60.red(`Connection "${name}" already exists.`));
|
|
5746
5783
|
process.exit(1);
|
|
5747
5784
|
}
|
|
5748
5785
|
const url = await new Input2({
|
|
@@ -5754,22 +5791,22 @@ async function promptConnection(existingNames) {
|
|
|
5754
5791
|
message: "Database name:"
|
|
5755
5792
|
}).run();
|
|
5756
5793
|
if (!name || !url || !database) {
|
|
5757
|
-
console.error(
|
|
5794
|
+
console.error(chalk60.red("All fields are required."));
|
|
5758
5795
|
process.exit(1);
|
|
5759
5796
|
}
|
|
5760
5797
|
const apiKeyRef = await selectOpSecret();
|
|
5761
|
-
console.log(
|
|
5798
|
+
console.log(chalk60.dim(`Using: ${apiKeyRef}`));
|
|
5762
5799
|
return { name, url, database, apiKeyRef };
|
|
5763
5800
|
}
|
|
5764
5801
|
|
|
5765
5802
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
5766
|
-
import
|
|
5803
|
+
import chalk61 from "chalk";
|
|
5767
5804
|
function ravendbSetConnection(name) {
|
|
5768
5805
|
const raw = loadGlobalConfigRaw();
|
|
5769
5806
|
const ravendb = raw.ravendb ?? {};
|
|
5770
5807
|
const connections = ravendb.connections ?? [];
|
|
5771
5808
|
if (!connections.some((c) => c.name === name)) {
|
|
5772
|
-
console.error(
|
|
5809
|
+
console.error(chalk61.red(`Connection "${name}" not found.`));
|
|
5773
5810
|
console.error(
|
|
5774
5811
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
5775
5812
|
);
|
|
@@ -5791,7 +5828,7 @@ async function ravendbAuth(options2) {
|
|
|
5791
5828
|
}
|
|
5792
5829
|
for (const c of connections) {
|
|
5793
5830
|
console.log(
|
|
5794
|
-
`${
|
|
5831
|
+
`${chalk62.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`
|
|
5795
5832
|
);
|
|
5796
5833
|
}
|
|
5797
5834
|
return;
|
|
@@ -5799,7 +5836,7 @@ async function ravendbAuth(options2) {
|
|
|
5799
5836
|
if (options2.remove) {
|
|
5800
5837
|
const filtered = connections.filter((c) => c.name !== options2.remove);
|
|
5801
5838
|
if (filtered.length === connections.length) {
|
|
5802
|
-
console.error(
|
|
5839
|
+
console.error(chalk62.red(`Connection "${options2.remove}" not found.`));
|
|
5803
5840
|
process.exit(1);
|
|
5804
5841
|
}
|
|
5805
5842
|
saveConnections(filtered);
|
|
@@ -5817,10 +5854,10 @@ async function ravendbAuth(options2) {
|
|
|
5817
5854
|
}
|
|
5818
5855
|
|
|
5819
5856
|
// src/commands/ravendb/ravendbCollections.ts
|
|
5820
|
-
import
|
|
5857
|
+
import chalk66 from "chalk";
|
|
5821
5858
|
|
|
5822
5859
|
// src/commands/ravendb/ravenFetch.ts
|
|
5823
|
-
import
|
|
5860
|
+
import chalk64 from "chalk";
|
|
5824
5861
|
|
|
5825
5862
|
// src/commands/ravendb/getAccessToken.ts
|
|
5826
5863
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -5857,10 +5894,10 @@ ${errorText}`
|
|
|
5857
5894
|
|
|
5858
5895
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
5859
5896
|
import { execSync as execSync30 } from "child_process";
|
|
5860
|
-
import
|
|
5897
|
+
import chalk63 from "chalk";
|
|
5861
5898
|
function resolveOpSecret(reference) {
|
|
5862
5899
|
if (!reference.startsWith("op://")) {
|
|
5863
|
-
console.error(
|
|
5900
|
+
console.error(chalk63.red(`Invalid secret reference: must start with op://`));
|
|
5864
5901
|
process.exit(1);
|
|
5865
5902
|
}
|
|
5866
5903
|
try {
|
|
@@ -5870,7 +5907,7 @@ function resolveOpSecret(reference) {
|
|
|
5870
5907
|
}).trim();
|
|
5871
5908
|
} catch {
|
|
5872
5909
|
console.error(
|
|
5873
|
-
|
|
5910
|
+
chalk63.red(
|
|
5874
5911
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
5875
5912
|
)
|
|
5876
5913
|
);
|
|
@@ -5897,7 +5934,7 @@ async function ravenFetch(connection, path42) {
|
|
|
5897
5934
|
if (!response.ok) {
|
|
5898
5935
|
const body = await response.text();
|
|
5899
5936
|
console.error(
|
|
5900
|
-
|
|
5937
|
+
chalk64.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
5901
5938
|
);
|
|
5902
5939
|
console.error(body.substring(0, 500));
|
|
5903
5940
|
process.exit(1);
|
|
@@ -5906,7 +5943,7 @@ async function ravenFetch(connection, path42) {
|
|
|
5906
5943
|
}
|
|
5907
5944
|
|
|
5908
5945
|
// src/commands/ravendb/resolveConnection.ts
|
|
5909
|
-
import
|
|
5946
|
+
import chalk65 from "chalk";
|
|
5910
5947
|
function loadRavendb() {
|
|
5911
5948
|
const raw = loadGlobalConfigRaw();
|
|
5912
5949
|
const ravendb = raw.ravendb;
|
|
@@ -5920,7 +5957,7 @@ function resolveConnection(name) {
|
|
|
5920
5957
|
const connectionName = name ?? defaultConnection;
|
|
5921
5958
|
if (!connectionName) {
|
|
5922
5959
|
console.error(
|
|
5923
|
-
|
|
5960
|
+
chalk65.red(
|
|
5924
5961
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
5925
5962
|
)
|
|
5926
5963
|
);
|
|
@@ -5928,7 +5965,7 @@ function resolveConnection(name) {
|
|
|
5928
5965
|
}
|
|
5929
5966
|
const connection = connections.find((c) => c.name === connectionName);
|
|
5930
5967
|
if (!connection) {
|
|
5931
|
-
console.error(
|
|
5968
|
+
console.error(chalk65.red(`Connection "${connectionName}" not found.`));
|
|
5932
5969
|
console.error(
|
|
5933
5970
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
5934
5971
|
);
|
|
@@ -5959,15 +5996,15 @@ async function ravendbCollections(connectionName) {
|
|
|
5959
5996
|
return;
|
|
5960
5997
|
}
|
|
5961
5998
|
for (const c of collections) {
|
|
5962
|
-
console.log(`${
|
|
5999
|
+
console.log(`${chalk66.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
5963
6000
|
}
|
|
5964
6001
|
}
|
|
5965
6002
|
|
|
5966
6003
|
// src/commands/ravendb/ravendbQuery.ts
|
|
5967
|
-
import
|
|
6004
|
+
import chalk68 from "chalk";
|
|
5968
6005
|
|
|
5969
6006
|
// src/commands/ravendb/fetchAllPages.ts
|
|
5970
|
-
import
|
|
6007
|
+
import chalk67 from "chalk";
|
|
5971
6008
|
|
|
5972
6009
|
// src/commands/ravendb/buildQueryPath.ts
|
|
5973
6010
|
function buildQueryPath(opts) {
|
|
@@ -6005,7 +6042,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
6005
6042
|
allResults.push(...results);
|
|
6006
6043
|
start3 += results.length;
|
|
6007
6044
|
process.stderr.write(
|
|
6008
|
-
`\r${
|
|
6045
|
+
`\r${chalk67.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
6009
6046
|
);
|
|
6010
6047
|
if (start3 >= totalResults) break;
|
|
6011
6048
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -6020,7 +6057,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
6020
6057
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
6021
6058
|
const resolved = resolveArgs(connectionName, collection);
|
|
6022
6059
|
if (!resolved.collection && !options2.query) {
|
|
6023
|
-
console.error(
|
|
6060
|
+
console.error(chalk68.red("Provide a collection name or --query filter."));
|
|
6024
6061
|
process.exit(1);
|
|
6025
6062
|
}
|
|
6026
6063
|
const { collection: col } = resolved;
|
|
@@ -6055,7 +6092,7 @@ import { spawn as spawn3 } from "child_process";
|
|
|
6055
6092
|
import * as path25 from "path";
|
|
6056
6093
|
|
|
6057
6094
|
// src/commands/refactor/logViolations.ts
|
|
6058
|
-
import
|
|
6095
|
+
import chalk69 from "chalk";
|
|
6059
6096
|
var DEFAULT_MAX_LINES = 100;
|
|
6060
6097
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
6061
6098
|
if (violations.length === 0) {
|
|
@@ -6064,43 +6101,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
6064
6101
|
}
|
|
6065
6102
|
return;
|
|
6066
6103
|
}
|
|
6067
|
-
console.error(
|
|
6104
|
+
console.error(chalk69.red(`
|
|
6068
6105
|
Refactor check failed:
|
|
6069
6106
|
`));
|
|
6070
|
-
console.error(
|
|
6107
|
+
console.error(chalk69.red(` The following files exceed ${maxLines} lines:
|
|
6071
6108
|
`));
|
|
6072
6109
|
for (const violation of violations) {
|
|
6073
|
-
console.error(
|
|
6110
|
+
console.error(chalk69.red(` ${violation.file} (${violation.lines} lines)`));
|
|
6074
6111
|
}
|
|
6075
6112
|
console.error(
|
|
6076
|
-
|
|
6113
|
+
chalk69.yellow(
|
|
6077
6114
|
`
|
|
6078
6115
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
6079
6116
|
way to refactor it, ignore it with:
|
|
6080
6117
|
`
|
|
6081
6118
|
)
|
|
6082
6119
|
);
|
|
6083
|
-
console.error(
|
|
6120
|
+
console.error(chalk69.gray(` assist refactor ignore <file>
|
|
6084
6121
|
`));
|
|
6085
6122
|
if (process.env.CLAUDECODE) {
|
|
6086
|
-
console.error(
|
|
6123
|
+
console.error(chalk69.cyan(`
|
|
6087
6124
|
## Extracting Code to New Files
|
|
6088
6125
|
`));
|
|
6089
6126
|
console.error(
|
|
6090
|
-
|
|
6127
|
+
chalk69.cyan(
|
|
6091
6128
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
6092
6129
|
`
|
|
6093
6130
|
)
|
|
6094
6131
|
);
|
|
6095
6132
|
console.error(
|
|
6096
|
-
|
|
6133
|
+
chalk69.cyan(
|
|
6097
6134
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
6098
6135
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
6099
6136
|
`
|
|
6100
6137
|
)
|
|
6101
6138
|
);
|
|
6102
6139
|
console.error(
|
|
6103
|
-
|
|
6140
|
+
chalk69.cyan(
|
|
6104
6141
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
6105
6142
|
domains, move it to a common/shared folder.
|
|
6106
6143
|
`
|
|
@@ -6256,11 +6293,11 @@ async function check(pattern2, options2) {
|
|
|
6256
6293
|
|
|
6257
6294
|
// src/commands/refactor/ignore.ts
|
|
6258
6295
|
import fs17 from "fs";
|
|
6259
|
-
import
|
|
6296
|
+
import chalk70 from "chalk";
|
|
6260
6297
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
6261
6298
|
function ignore(file) {
|
|
6262
6299
|
if (!fs17.existsSync(file)) {
|
|
6263
|
-
console.error(
|
|
6300
|
+
console.error(chalk70.red(`Error: File does not exist: ${file}`));
|
|
6264
6301
|
process.exit(1);
|
|
6265
6302
|
}
|
|
6266
6303
|
const content = fs17.readFileSync(file, "utf-8");
|
|
@@ -6276,7 +6313,7 @@ function ignore(file) {
|
|
|
6276
6313
|
fs17.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
6277
6314
|
}
|
|
6278
6315
|
console.log(
|
|
6279
|
-
|
|
6316
|
+
chalk70.green(
|
|
6280
6317
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
6281
6318
|
)
|
|
6282
6319
|
);
|
|
@@ -6284,7 +6321,7 @@ function ignore(file) {
|
|
|
6284
6321
|
|
|
6285
6322
|
// src/commands/refactor/rename/index.ts
|
|
6286
6323
|
import path26 from "path";
|
|
6287
|
-
import
|
|
6324
|
+
import chalk71 from "chalk";
|
|
6288
6325
|
import { Project as Project2 } from "ts-morph";
|
|
6289
6326
|
async function rename(source, destination, options2 = {}) {
|
|
6290
6327
|
const sourcePath = path26.resolve(source);
|
|
@@ -6297,22 +6334,22 @@ async function rename(source, destination, options2 = {}) {
|
|
|
6297
6334
|
});
|
|
6298
6335
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
6299
6336
|
if (!sourceFile) {
|
|
6300
|
-
console.log(
|
|
6337
|
+
console.log(chalk71.red(`File not found in project: ${source}`));
|
|
6301
6338
|
process.exit(1);
|
|
6302
6339
|
}
|
|
6303
|
-
console.log(
|
|
6340
|
+
console.log(chalk71.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
6304
6341
|
if (options2.apply) {
|
|
6305
6342
|
sourceFile.move(destPath);
|
|
6306
6343
|
await project.save();
|
|
6307
|
-
console.log(
|
|
6344
|
+
console.log(chalk71.green("Done"));
|
|
6308
6345
|
} else {
|
|
6309
|
-
console.log(
|
|
6346
|
+
console.log(chalk71.dim("Dry run. Use --apply to execute."));
|
|
6310
6347
|
}
|
|
6311
6348
|
}
|
|
6312
6349
|
|
|
6313
6350
|
// src/commands/refactor/renameSymbol/index.ts
|
|
6314
6351
|
import path28 from "path";
|
|
6315
|
-
import
|
|
6352
|
+
import chalk72 from "chalk";
|
|
6316
6353
|
import { Project as Project3 } from "ts-morph";
|
|
6317
6354
|
|
|
6318
6355
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
@@ -6361,38 +6398,38 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
6361
6398
|
const project = new Project3({ tsConfigFilePath: tsConfigPath });
|
|
6362
6399
|
const sourceFile = project.getSourceFile(filePath);
|
|
6363
6400
|
if (!sourceFile) {
|
|
6364
|
-
console.log(
|
|
6401
|
+
console.log(chalk72.red(`File not found in project: ${file}`));
|
|
6365
6402
|
process.exit(1);
|
|
6366
6403
|
}
|
|
6367
6404
|
const symbol = findSymbol(sourceFile, oldName);
|
|
6368
6405
|
if (!symbol) {
|
|
6369
|
-
console.log(
|
|
6406
|
+
console.log(chalk72.red(`Symbol "${oldName}" not found in ${file}`));
|
|
6370
6407
|
process.exit(1);
|
|
6371
6408
|
}
|
|
6372
6409
|
const grouped = groupReferences(symbol, cwd);
|
|
6373
6410
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
6374
6411
|
console.log(
|
|
6375
|
-
|
|
6412
|
+
chalk72.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
6376
6413
|
`)
|
|
6377
6414
|
);
|
|
6378
6415
|
for (const [refFile, lines] of grouped) {
|
|
6379
6416
|
console.log(
|
|
6380
|
-
` ${
|
|
6417
|
+
` ${chalk72.dim(refFile)}: lines ${chalk72.cyan(lines.join(", "))}`
|
|
6381
6418
|
);
|
|
6382
6419
|
}
|
|
6383
6420
|
if (options2.apply) {
|
|
6384
6421
|
symbol.rename(newName);
|
|
6385
6422
|
await project.save();
|
|
6386
|
-
console.log(
|
|
6423
|
+
console.log(chalk72.green(`
|
|
6387
6424
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
6388
6425
|
} else {
|
|
6389
|
-
console.log(
|
|
6426
|
+
console.log(chalk72.dim("\nDry run. Use --apply to execute."));
|
|
6390
6427
|
}
|
|
6391
6428
|
}
|
|
6392
6429
|
|
|
6393
6430
|
// src/commands/refactor/restructure/index.ts
|
|
6394
6431
|
import path37 from "path";
|
|
6395
|
-
import
|
|
6432
|
+
import chalk75 from "chalk";
|
|
6396
6433
|
|
|
6397
6434
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
6398
6435
|
import path29 from "path";
|
|
@@ -6635,50 +6672,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
6635
6672
|
|
|
6636
6673
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
6637
6674
|
import path33 from "path";
|
|
6638
|
-
import
|
|
6675
|
+
import chalk73 from "chalk";
|
|
6639
6676
|
function relPath(filePath) {
|
|
6640
6677
|
return path33.relative(process.cwd(), filePath);
|
|
6641
6678
|
}
|
|
6642
6679
|
function displayMoves(plan) {
|
|
6643
6680
|
if (plan.moves.length === 0) return;
|
|
6644
|
-
console.log(
|
|
6681
|
+
console.log(chalk73.bold("\nFile moves:"));
|
|
6645
6682
|
for (const move of plan.moves) {
|
|
6646
6683
|
console.log(
|
|
6647
|
-
` ${
|
|
6684
|
+
` ${chalk73.red(relPath(move.from))} \u2192 ${chalk73.green(relPath(move.to))}`
|
|
6648
6685
|
);
|
|
6649
|
-
console.log(
|
|
6686
|
+
console.log(chalk73.dim(` ${move.reason}`));
|
|
6650
6687
|
}
|
|
6651
6688
|
}
|
|
6652
6689
|
function displayRewrites(rewrites) {
|
|
6653
6690
|
if (rewrites.length === 0) return;
|
|
6654
6691
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
6655
|
-
console.log(
|
|
6692
|
+
console.log(chalk73.bold(`
|
|
6656
6693
|
Import rewrites (${affectedFiles.size} files):`));
|
|
6657
6694
|
for (const file of affectedFiles) {
|
|
6658
|
-
console.log(` ${
|
|
6695
|
+
console.log(` ${chalk73.cyan(relPath(file))}:`);
|
|
6659
6696
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
6660
6697
|
(r) => r.file === file
|
|
6661
6698
|
)) {
|
|
6662
6699
|
console.log(
|
|
6663
|
-
` ${
|
|
6700
|
+
` ${chalk73.red(`"${oldSpecifier}"`)} \u2192 ${chalk73.green(`"${newSpecifier}"`)}`
|
|
6664
6701
|
);
|
|
6665
6702
|
}
|
|
6666
6703
|
}
|
|
6667
6704
|
}
|
|
6668
6705
|
function displayPlan(plan) {
|
|
6669
6706
|
if (plan.warnings.length > 0) {
|
|
6670
|
-
console.log(
|
|
6671
|
-
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}`));
|
|
6672
6709
|
}
|
|
6673
6710
|
if (plan.newDirectories.length > 0) {
|
|
6674
|
-
console.log(
|
|
6711
|
+
console.log(chalk73.bold("\nNew directories:"));
|
|
6675
6712
|
for (const dir of plan.newDirectories)
|
|
6676
|
-
console.log(
|
|
6713
|
+
console.log(chalk73.green(` ${dir}/`));
|
|
6677
6714
|
}
|
|
6678
6715
|
displayMoves(plan);
|
|
6679
6716
|
displayRewrites(plan.rewrites);
|
|
6680
6717
|
console.log(
|
|
6681
|
-
|
|
6718
|
+
chalk73.dim(
|
|
6682
6719
|
`
|
|
6683
6720
|
Summary: ${plan.moves.length} file(s) moved, ${plan.rewrites.length} imports rewritten`
|
|
6684
6721
|
)
|
|
@@ -6688,18 +6725,18 @@ Summary: ${plan.moves.length} file(s) moved, ${plan.rewrites.length} imports rew
|
|
|
6688
6725
|
// src/commands/refactor/restructure/executePlan.ts
|
|
6689
6726
|
import fs19 from "fs";
|
|
6690
6727
|
import path34 from "path";
|
|
6691
|
-
import
|
|
6728
|
+
import chalk74 from "chalk";
|
|
6692
6729
|
function executePlan(plan) {
|
|
6693
6730
|
const updatedContents = applyRewrites(plan.rewrites);
|
|
6694
6731
|
for (const [file, content] of updatedContents) {
|
|
6695
6732
|
fs19.writeFileSync(file, content, "utf-8");
|
|
6696
6733
|
console.log(
|
|
6697
|
-
|
|
6734
|
+
chalk74.cyan(` Rewrote imports in ${path34.relative(process.cwd(), file)}`)
|
|
6698
6735
|
);
|
|
6699
6736
|
}
|
|
6700
6737
|
for (const dir of plan.newDirectories) {
|
|
6701
6738
|
fs19.mkdirSync(dir, { recursive: true });
|
|
6702
|
-
console.log(
|
|
6739
|
+
console.log(chalk74.green(` Created ${path34.relative(process.cwd(), dir)}/`));
|
|
6703
6740
|
}
|
|
6704
6741
|
for (const move of plan.moves) {
|
|
6705
6742
|
const targetDir = path34.dirname(move.to);
|
|
@@ -6708,7 +6745,7 @@ function executePlan(plan) {
|
|
|
6708
6745
|
}
|
|
6709
6746
|
fs19.renameSync(move.from, move.to);
|
|
6710
6747
|
console.log(
|
|
6711
|
-
|
|
6748
|
+
chalk74.white(
|
|
6712
6749
|
` Moved ${path34.relative(process.cwd(), move.from)} \u2192 ${path34.relative(process.cwd(), move.to)}`
|
|
6713
6750
|
)
|
|
6714
6751
|
);
|
|
@@ -6723,7 +6760,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
6723
6760
|
if (entries.length === 0) {
|
|
6724
6761
|
fs19.rmdirSync(dir);
|
|
6725
6762
|
console.log(
|
|
6726
|
-
|
|
6763
|
+
chalk74.dim(
|
|
6727
6764
|
` Removed empty directory ${path34.relative(process.cwd(), dir)}`
|
|
6728
6765
|
)
|
|
6729
6766
|
);
|
|
@@ -6856,22 +6893,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
6856
6893
|
const targetPattern = pattern2 ?? "src";
|
|
6857
6894
|
const files = findSourceFiles2(targetPattern);
|
|
6858
6895
|
if (files.length === 0) {
|
|
6859
|
-
console.log(
|
|
6896
|
+
console.log(chalk75.yellow("No files found matching pattern"));
|
|
6860
6897
|
return;
|
|
6861
6898
|
}
|
|
6862
6899
|
const tsConfigPath = path37.resolve("tsconfig.json");
|
|
6863
6900
|
const plan = buildPlan(files, tsConfigPath);
|
|
6864
6901
|
if (plan.moves.length === 0) {
|
|
6865
|
-
console.log(
|
|
6902
|
+
console.log(chalk75.green("No restructuring needed"));
|
|
6866
6903
|
return;
|
|
6867
6904
|
}
|
|
6868
6905
|
displayPlan(plan);
|
|
6869
6906
|
if (options2.apply) {
|
|
6870
|
-
console.log(
|
|
6907
|
+
console.log(chalk75.bold("\nApplying changes..."));
|
|
6871
6908
|
executePlan(plan);
|
|
6872
|
-
console.log(
|
|
6909
|
+
console.log(chalk75.green("\nRestructuring complete"));
|
|
6873
6910
|
} else {
|
|
6874
|
-
console.log(
|
|
6911
|
+
console.log(chalk75.dim("\nDry run. Use --apply to execute."));
|
|
6875
6912
|
}
|
|
6876
6913
|
}
|
|
6877
6914
|
|
|
@@ -7419,14 +7456,14 @@ import {
|
|
|
7419
7456
|
import { dirname as dirname18, join as join26 } from "path";
|
|
7420
7457
|
|
|
7421
7458
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
7422
|
-
import
|
|
7459
|
+
import chalk76 from "chalk";
|
|
7423
7460
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
7424
7461
|
function validateStagedContent(filename, content) {
|
|
7425
7462
|
const firstLine = content.split("\n")[0];
|
|
7426
7463
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
7427
7464
|
if (!match) {
|
|
7428
7465
|
console.error(
|
|
7429
|
-
|
|
7466
|
+
chalk76.red(
|
|
7430
7467
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
7431
7468
|
)
|
|
7432
7469
|
);
|
|
@@ -7435,7 +7472,7 @@ function validateStagedContent(filename, content) {
|
|
|
7435
7472
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
7436
7473
|
if (!contentAfterLink) {
|
|
7437
7474
|
console.error(
|
|
7438
|
-
|
|
7475
|
+
chalk76.red(
|
|
7439
7476
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
7440
7477
|
)
|
|
7441
7478
|
);
|
|
@@ -7828,7 +7865,7 @@ function registerVoice(program2) {
|
|
|
7828
7865
|
|
|
7829
7866
|
// src/commands/roam/auth.ts
|
|
7830
7867
|
import { randomBytes } from "crypto";
|
|
7831
|
-
import
|
|
7868
|
+
import chalk77 from "chalk";
|
|
7832
7869
|
|
|
7833
7870
|
// src/lib/openBrowser.ts
|
|
7834
7871
|
import { execSync as execSync33 } from "child_process";
|
|
@@ -8003,13 +8040,13 @@ async function auth() {
|
|
|
8003
8040
|
saveGlobalConfig(config);
|
|
8004
8041
|
const state = randomBytes(16).toString("hex");
|
|
8005
8042
|
console.log(
|
|
8006
|
-
|
|
8043
|
+
chalk77.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
8007
8044
|
);
|
|
8008
|
-
console.log(
|
|
8009
|
-
console.log(
|
|
8010
|
-
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..."));
|
|
8011
8048
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
8012
|
-
console.log(
|
|
8049
|
+
console.log(chalk77.dim("Exchanging code for tokens..."));
|
|
8013
8050
|
const tokens = await exchangeToken({
|
|
8014
8051
|
code,
|
|
8015
8052
|
clientId,
|
|
@@ -8025,7 +8062,7 @@ async function auth() {
|
|
|
8025
8062
|
};
|
|
8026
8063
|
saveGlobalConfig(config);
|
|
8027
8064
|
console.log(
|
|
8028
|
-
|
|
8065
|
+
chalk77.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
8029
8066
|
);
|
|
8030
8067
|
}
|
|
8031
8068
|
|
|
@@ -8213,14 +8250,14 @@ function run2(name, args) {
|
|
|
8213
8250
|
}
|
|
8214
8251
|
|
|
8215
8252
|
// src/commands/statusLine.ts
|
|
8216
|
-
import
|
|
8253
|
+
import chalk78 from "chalk";
|
|
8217
8254
|
function formatNumber(num) {
|
|
8218
8255
|
return num.toLocaleString("en-US");
|
|
8219
8256
|
}
|
|
8220
8257
|
function colorizePercent(pct) {
|
|
8221
8258
|
const label2 = `${pct}%`;
|
|
8222
|
-
if (pct > 80) return
|
|
8223
|
-
if (pct > 40) return
|
|
8259
|
+
if (pct > 80) return chalk78.red(label2);
|
|
8260
|
+
if (pct > 40) return chalk78.yellow(label2);
|
|
8224
8261
|
return label2;
|
|
8225
8262
|
}
|
|
8226
8263
|
async function statusLine() {
|
|
@@ -8246,7 +8283,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
8246
8283
|
// src/commands/sync/syncClaudeMd.ts
|
|
8247
8284
|
import * as fs22 from "fs";
|
|
8248
8285
|
import * as path38 from "path";
|
|
8249
|
-
import
|
|
8286
|
+
import chalk79 from "chalk";
|
|
8250
8287
|
async function syncClaudeMd(claudeDir, targetBase) {
|
|
8251
8288
|
const source = path38.join(claudeDir, "CLAUDE.md");
|
|
8252
8289
|
const target = path38.join(targetBase, "CLAUDE.md");
|
|
@@ -8255,12 +8292,12 @@ async function syncClaudeMd(claudeDir, targetBase) {
|
|
|
8255
8292
|
const targetContent = fs22.readFileSync(target, "utf-8");
|
|
8256
8293
|
if (sourceContent !== targetContent) {
|
|
8257
8294
|
console.log(
|
|
8258
|
-
|
|
8295
|
+
chalk79.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
8259
8296
|
);
|
|
8260
8297
|
console.log();
|
|
8261
8298
|
printDiff(targetContent, sourceContent);
|
|
8262
8299
|
const confirm = await promptConfirm(
|
|
8263
|
-
|
|
8300
|
+
chalk79.red("Overwrite existing CLAUDE.md?"),
|
|
8264
8301
|
false
|
|
8265
8302
|
);
|
|
8266
8303
|
if (!confirm) {
|
|
@@ -8276,7 +8313,7 @@ async function syncClaudeMd(claudeDir, targetBase) {
|
|
|
8276
8313
|
// src/commands/sync/syncSettings.ts
|
|
8277
8314
|
import * as fs23 from "fs";
|
|
8278
8315
|
import * as path39 from "path";
|
|
8279
|
-
import
|
|
8316
|
+
import chalk80 from "chalk";
|
|
8280
8317
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
8281
8318
|
const source = path39.join(claudeDir, "settings.json");
|
|
8282
8319
|
const target = path39.join(targetBase, "settings.json");
|
|
@@ -8292,14 +8329,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
8292
8329
|
if (mergedContent !== normalizedTarget) {
|
|
8293
8330
|
if (!options2?.yes) {
|
|
8294
8331
|
console.log(
|
|
8295
|
-
|
|
8332
|
+
chalk80.yellow(
|
|
8296
8333
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
8297
8334
|
)
|
|
8298
8335
|
);
|
|
8299
8336
|
console.log();
|
|
8300
8337
|
printDiff(targetContent, mergedContent);
|
|
8301
8338
|
const confirm = await promptConfirm(
|
|
8302
|
-
|
|
8339
|
+
chalk80.red("Overwrite existing settings.json?"),
|
|
8303
8340
|
false
|
|
8304
8341
|
);
|
|
8305
8342
|
if (!confirm) {
|