@staff0rd/assist 0.182.0 → 0.183.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/allowed.cli-writes +1 -0
- package/dist/allowed.cli-writes +1 -0
- package/dist/commands/backlog/web/bundle.js +6 -6
- package/dist/index.js +445 -357
- 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.183.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -136,10 +136,11 @@ import { join } from "path";
|
|
|
136
136
|
// src/commands/backlog/loadComments.ts
|
|
137
137
|
function loadComments(db, itemId) {
|
|
138
138
|
const rows = db.prepare(
|
|
139
|
-
"SELECT text, phase, timestamp, type FROM comments WHERE item_id = ? ORDER BY idx"
|
|
139
|
+
"SELECT id, text, phase, timestamp, type FROM comments WHERE item_id = ? ORDER BY idx"
|
|
140
140
|
).all(itemId);
|
|
141
141
|
return rows.map((r) => {
|
|
142
142
|
const c = {
|
|
143
|
+
id: r.id,
|
|
143
144
|
text: r.text,
|
|
144
145
|
timestamp: r.timestamp,
|
|
145
146
|
type: r.type
|
|
@@ -220,12 +221,27 @@ import { readFileSync, statSync as statSync2 } from "fs";
|
|
|
220
221
|
// src/commands/backlog/insertItemRelations.ts
|
|
221
222
|
function insertComments(db, item) {
|
|
222
223
|
if (!item.comments) return;
|
|
223
|
-
const
|
|
224
|
+
const stmtWithId = db.prepare(
|
|
225
|
+
"INSERT INTO comments (id, item_id, idx, text, phase, timestamp, type) VALUES (?, ?, ?, ?, ?, ?, ?)"
|
|
226
|
+
);
|
|
227
|
+
const stmtNoId = db.prepare(
|
|
224
228
|
"INSERT INTO comments (item_id, idx, text, phase, timestamp, type) VALUES (?, ?, ?, ?, ?, ?)"
|
|
225
229
|
);
|
|
226
230
|
for (let i = 0; i < item.comments.length; i++) {
|
|
227
231
|
const c = item.comments[i];
|
|
228
|
-
|
|
232
|
+
if (c.id !== void 0) {
|
|
233
|
+
stmtWithId.run(
|
|
234
|
+
c.id,
|
|
235
|
+
item.id,
|
|
236
|
+
i,
|
|
237
|
+
c.text,
|
|
238
|
+
c.phase ?? null,
|
|
239
|
+
c.timestamp,
|
|
240
|
+
c.type
|
|
241
|
+
);
|
|
242
|
+
} else {
|
|
243
|
+
stmtNoId.run(item.id, i, c.text, c.phase ?? null, c.timestamp, c.type);
|
|
244
|
+
}
|
|
229
245
|
}
|
|
230
246
|
}
|
|
231
247
|
function insertLinks(db, item) {
|
|
@@ -320,6 +336,7 @@ var planPhaseSchema = z.strictObject({
|
|
|
320
336
|
});
|
|
321
337
|
var backlogCommentTypeSchema = z.enum(["comment", "summary"]);
|
|
322
338
|
var backlogCommentSchema = z.strictObject({
|
|
339
|
+
id: z.number().optional(),
|
|
323
340
|
text: z.string(),
|
|
324
341
|
phase: z.number().optional(),
|
|
325
342
|
timestamp: z.string(),
|
|
@@ -427,6 +444,25 @@ var _db;
|
|
|
427
444
|
function getDbPath(dir) {
|
|
428
445
|
return join3(dir, ".assist", "backlog.db");
|
|
429
446
|
}
|
|
447
|
+
function migrateCommentsAddId(db) {
|
|
448
|
+
const cols = db.pragma("table_info(comments)");
|
|
449
|
+
if (cols.length === 0 || cols.some((c) => c.name === "id")) return;
|
|
450
|
+
db.exec(`
|
|
451
|
+
CREATE TABLE comments_new (
|
|
452
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
453
|
+
item_id INTEGER NOT NULL REFERENCES items(id) ON DELETE CASCADE,
|
|
454
|
+
idx INTEGER NOT NULL,
|
|
455
|
+
text TEXT NOT NULL,
|
|
456
|
+
phase INTEGER,
|
|
457
|
+
timestamp TEXT NOT NULL,
|
|
458
|
+
type TEXT NOT NULL DEFAULT 'comment'
|
|
459
|
+
);
|
|
460
|
+
INSERT INTO comments_new (item_id, idx, text, phase, timestamp, type)
|
|
461
|
+
SELECT item_id, idx, text, phase, timestamp, type FROM comments;
|
|
462
|
+
DROP TABLE comments;
|
|
463
|
+
ALTER TABLE comments_new RENAME TO comments;
|
|
464
|
+
`);
|
|
465
|
+
}
|
|
430
466
|
function initSchema(db) {
|
|
431
467
|
db.exec(`
|
|
432
468
|
CREATE TABLE IF NOT EXISTS items (
|
|
@@ -440,13 +476,13 @@ function initSchema(db) {
|
|
|
440
476
|
);
|
|
441
477
|
|
|
442
478
|
CREATE TABLE IF NOT EXISTS comments (
|
|
479
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
443
480
|
item_id INTEGER NOT NULL REFERENCES items(id) ON DELETE CASCADE,
|
|
444
481
|
idx INTEGER NOT NULL,
|
|
445
482
|
text TEXT NOT NULL,
|
|
446
483
|
phase INTEGER,
|
|
447
484
|
timestamp TEXT NOT NULL,
|
|
448
|
-
type TEXT NOT NULL DEFAULT 'comment'
|
|
449
|
-
PRIMARY KEY (item_id, idx)
|
|
485
|
+
type TEXT NOT NULL DEFAULT 'comment'
|
|
450
486
|
);
|
|
451
487
|
|
|
452
488
|
CREATE TABLE IF NOT EXISTS links (
|
|
@@ -487,6 +523,7 @@ function openDb(dir) {
|
|
|
487
523
|
db.pragma("journal_mode = WAL");
|
|
488
524
|
db.pragma("foreign_keys = ON");
|
|
489
525
|
initSchema(db);
|
|
526
|
+
migrateCommentsAddId(db);
|
|
490
527
|
ensureGitignore(dir);
|
|
491
528
|
_db = db;
|
|
492
529
|
return db;
|
|
@@ -727,9 +764,10 @@ function buildCommentLines(comments2) {
|
|
|
727
764
|
return ["", "Comments:", ...comments2.map(formatPromptComment)];
|
|
728
765
|
}
|
|
729
766
|
function formatPromptComment(entry) {
|
|
767
|
+
const id = entry.id !== void 0 ? `#${entry.id} ` : "";
|
|
730
768
|
const tag = entry.type === "summary" ? "[summary]" : "[comment]";
|
|
731
769
|
const phase = entry.phase !== void 0 ? ` (phase ${entry.phase + 1})` : "";
|
|
732
|
-
return `${tag}${phase} ${entry.timestamp}
|
|
770
|
+
return `${id}${tag}${phase} ${entry.timestamp}
|
|
733
771
|
${entry.text}`;
|
|
734
772
|
}
|
|
735
773
|
|
|
@@ -1175,10 +1213,11 @@ import chalk14 from "chalk";
|
|
|
1175
1213
|
// src/commands/backlog/formatComment.ts
|
|
1176
1214
|
import chalk11 from "chalk";
|
|
1177
1215
|
function formatComment(entry) {
|
|
1216
|
+
const id = entry.id !== void 0 ? chalk11.dim(`#${entry.id} `) : "";
|
|
1178
1217
|
const tag = entry.type === "summary" ? chalk11.magenta("[summary]") : chalk11.cyan("[comment]");
|
|
1179
1218
|
const phase = entry.phase !== void 0 ? chalk11.dim(` (phase ${entry.phase + 1})`) : "";
|
|
1180
1219
|
const time = chalk11.dim(entry.timestamp);
|
|
1181
|
-
return `${tag}${phase} ${time}
|
|
1220
|
+
return `${id}${tag}${phase} ${time}
|
|
1182
1221
|
${entry.text}`;
|
|
1183
1222
|
}
|
|
1184
1223
|
|
|
@@ -3757,24 +3796,73 @@ function comments(id) {
|
|
|
3757
3796
|
}
|
|
3758
3797
|
}
|
|
3759
3798
|
|
|
3799
|
+
// src/commands/backlog/delete-comment/index.ts
|
|
3800
|
+
import chalk43 from "chalk";
|
|
3801
|
+
|
|
3802
|
+
// src/commands/backlog/deleteComment.ts
|
|
3803
|
+
function deleteComment(db, itemId, commentId) {
|
|
3804
|
+
const row = db.prepare("SELECT type FROM comments WHERE id = ? AND item_id = ?").get(commentId, itemId);
|
|
3805
|
+
if (!row) return "not-found";
|
|
3806
|
+
if (row.type === "summary") return "is-summary";
|
|
3807
|
+
db.prepare("DELETE FROM comments WHERE id = ? AND item_id = ?").run(
|
|
3808
|
+
commentId,
|
|
3809
|
+
itemId
|
|
3810
|
+
);
|
|
3811
|
+
return "deleted";
|
|
3812
|
+
}
|
|
3813
|
+
|
|
3814
|
+
// src/commands/backlog/delete-comment/index.ts
|
|
3815
|
+
function deleteCommentCmd(id, commentId) {
|
|
3816
|
+
const result = loadAndFindItem(id);
|
|
3817
|
+
if (!result) process.exit(1);
|
|
3818
|
+
const dir = getBacklogDir();
|
|
3819
|
+
const db = openDb(dir);
|
|
3820
|
+
const outcome = deleteComment(
|
|
3821
|
+
db,
|
|
3822
|
+
result.item.id,
|
|
3823
|
+
Number.parseInt(commentId, 10)
|
|
3824
|
+
);
|
|
3825
|
+
switch (outcome) {
|
|
3826
|
+
case "deleted":
|
|
3827
|
+
exportToJsonl(db, dir);
|
|
3828
|
+
console.log(
|
|
3829
|
+
chalk43.green(`Comment #${commentId} deleted from item #${id}.`)
|
|
3830
|
+
);
|
|
3831
|
+
break;
|
|
3832
|
+
case "not-found":
|
|
3833
|
+
console.log(chalk43.red(`Comment #${commentId} not found on item #${id}.`));
|
|
3834
|
+
process.exit(1);
|
|
3835
|
+
break;
|
|
3836
|
+
case "is-summary":
|
|
3837
|
+
console.log(
|
|
3838
|
+
chalk43.red(
|
|
3839
|
+
`Comment #${commentId} is a phase summary and cannot be deleted.`
|
|
3840
|
+
)
|
|
3841
|
+
);
|
|
3842
|
+
process.exit(1);
|
|
3843
|
+
break;
|
|
3844
|
+
}
|
|
3845
|
+
}
|
|
3846
|
+
|
|
3760
3847
|
// src/commands/backlog/registerCommentCommands.ts
|
|
3761
3848
|
function registerCommentCommands(cmd) {
|
|
3762
3849
|
cmd.command("comment <id> <text>").description("Add a comment to a backlog item").action(comment);
|
|
3763
3850
|
cmd.command("comments <id>").description("List comments and summaries for a backlog item").action(comments);
|
|
3851
|
+
cmd.command("delete-comment <id> <comment-id>").description("Delete a comment from a backlog item").action(deleteCommentCmd);
|
|
3764
3852
|
}
|
|
3765
3853
|
|
|
3766
3854
|
// src/commands/backlog/add/index.ts
|
|
3767
|
-
import
|
|
3855
|
+
import chalk45 from "chalk";
|
|
3768
3856
|
|
|
3769
3857
|
// src/commands/backlog/commitBacklog.ts
|
|
3770
3858
|
import { execSync as execSync15 } from "child_process";
|
|
3771
3859
|
import { join as join15 } from "path";
|
|
3772
|
-
import
|
|
3860
|
+
import chalk44 from "chalk";
|
|
3773
3861
|
function commitBacklog(id, name) {
|
|
3774
3862
|
const config = loadConfig();
|
|
3775
3863
|
if (!config.backlog.autoCommit) {
|
|
3776
3864
|
console.log(
|
|
3777
|
-
|
|
3865
|
+
chalk44.yellow(
|
|
3778
3866
|
"Warning: auto-commit is disabled. Stage and commit the backlog file manually."
|
|
3779
3867
|
)
|
|
3780
3868
|
);
|
|
@@ -3786,7 +3874,7 @@ function commitBacklog(id, name) {
|
|
|
3786
3874
|
execSync15(`git add ${shellQuote(jsonlPath)}`, { stdio: "ignore" });
|
|
3787
3875
|
execSync15(`git commit -m ${shellQuote(message)}`, { stdio: "ignore" });
|
|
3788
3876
|
} catch {
|
|
3789
|
-
console.log(
|
|
3877
|
+
console.log(chalk44.yellow("Warning: could not auto-commit backlog file."));
|
|
3790
3878
|
}
|
|
3791
3879
|
}
|
|
3792
3880
|
|
|
@@ -3878,12 +3966,12 @@ async function addFromOptions(options2) {
|
|
|
3878
3966
|
});
|
|
3879
3967
|
saveBacklog(items);
|
|
3880
3968
|
commitBacklog(id, name);
|
|
3881
|
-
console.log(
|
|
3969
|
+
console.log(chalk45.green(`Added item #${id}: ${name}`));
|
|
3882
3970
|
}
|
|
3883
3971
|
async function add(options2) {
|
|
3884
3972
|
if (!backlogExists()) {
|
|
3885
3973
|
console.log(
|
|
3886
|
-
|
|
3974
|
+
chalk45.yellow(
|
|
3887
3975
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
3888
3976
|
)
|
|
3889
3977
|
);
|
|
@@ -3893,13 +3981,13 @@ async function add(options2) {
|
|
|
3893
3981
|
}
|
|
3894
3982
|
|
|
3895
3983
|
// src/commands/backlog/addPhase.ts
|
|
3896
|
-
import
|
|
3984
|
+
import chalk46 from "chalk";
|
|
3897
3985
|
function addPhase(id, name, options2) {
|
|
3898
3986
|
const result = loadAndFindItem(id);
|
|
3899
3987
|
if (!result) return;
|
|
3900
3988
|
const tasks = options2.task ?? [];
|
|
3901
3989
|
if (tasks.length === 0) {
|
|
3902
|
-
console.log(
|
|
3990
|
+
console.log(chalk46.red("At least one --task is required."));
|
|
3903
3991
|
process.exitCode = 1;
|
|
3904
3992
|
return;
|
|
3905
3993
|
}
|
|
@@ -3921,25 +4009,25 @@ function addPhase(id, name, options2) {
|
|
|
3921
4009
|
exportToJsonl(db, dir);
|
|
3922
4010
|
commitBacklog(itemId, result.item.name);
|
|
3923
4011
|
console.log(
|
|
3924
|
-
|
|
4012
|
+
chalk46.green(
|
|
3925
4013
|
`Added phase ${phaseIdx + 1} "${name}" to item #${itemId} with ${tasks.length} task(s).`
|
|
3926
4014
|
)
|
|
3927
4015
|
);
|
|
3928
4016
|
}
|
|
3929
4017
|
|
|
3930
4018
|
// src/commands/backlog/init/index.ts
|
|
3931
|
-
import
|
|
4019
|
+
import chalk47 from "chalk";
|
|
3932
4020
|
async function init6() {
|
|
3933
4021
|
if (backlogExists()) {
|
|
3934
|
-
console.log(
|
|
4022
|
+
console.log(chalk47.yellow("Backlog already exists."));
|
|
3935
4023
|
return;
|
|
3936
4024
|
}
|
|
3937
4025
|
saveBacklog([]);
|
|
3938
|
-
console.log(
|
|
4026
|
+
console.log(chalk47.green("Created backlog."));
|
|
3939
4027
|
}
|
|
3940
4028
|
|
|
3941
4029
|
// src/commands/backlog/list/index.ts
|
|
3942
|
-
import
|
|
4030
|
+
import chalk48 from "chalk";
|
|
3943
4031
|
function filterItems(items, options2) {
|
|
3944
4032
|
if (options2.status) return items.filter((i) => i.status === options2.status);
|
|
3945
4033
|
if (!options2.all)
|
|
@@ -3949,7 +4037,7 @@ function filterItems(items, options2) {
|
|
|
3949
4037
|
async function list2(options2) {
|
|
3950
4038
|
if (!backlogExists()) {
|
|
3951
4039
|
console.log(
|
|
3952
|
-
|
|
4040
|
+
chalk48.yellow(
|
|
3953
4041
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
3954
4042
|
)
|
|
3955
4043
|
);
|
|
@@ -3958,12 +4046,12 @@ async function list2(options2) {
|
|
|
3958
4046
|
const allItems = loadBacklog();
|
|
3959
4047
|
const items = filterItems(allItems, options2);
|
|
3960
4048
|
if (items.length === 0) {
|
|
3961
|
-
console.log(
|
|
4049
|
+
console.log(chalk48.dim("Backlog is empty."));
|
|
3962
4050
|
return;
|
|
3963
4051
|
}
|
|
3964
4052
|
for (const item of items) {
|
|
3965
4053
|
console.log(
|
|
3966
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
4054
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk48.dim(`#${item.id}`)} ${item.name}${phaseLabel(item)}${dependencyLabel(item, allItems)}`
|
|
3967
4055
|
);
|
|
3968
4056
|
if (options2.verbose) {
|
|
3969
4057
|
printVerboseDetails(item);
|
|
@@ -3986,7 +4074,7 @@ function registerItemCommands(cmd) {
|
|
|
3986
4074
|
}
|
|
3987
4075
|
|
|
3988
4076
|
// src/commands/backlog/link.ts
|
|
3989
|
-
import
|
|
4077
|
+
import chalk50 from "chalk";
|
|
3990
4078
|
|
|
3991
4079
|
// src/commands/backlog/hasCycle.ts
|
|
3992
4080
|
function hasCycle(items, fromId, toId) {
|
|
@@ -4009,11 +4097,11 @@ function hasCycle(items, fromId, toId) {
|
|
|
4009
4097
|
}
|
|
4010
4098
|
|
|
4011
4099
|
// src/commands/backlog/validateLinkTarget.ts
|
|
4012
|
-
import
|
|
4100
|
+
import chalk49 from "chalk";
|
|
4013
4101
|
function validateLinkTarget(items, fromItem, fromId, toId, toNum, linkType) {
|
|
4014
4102
|
const toItem = items.find((i) => i.id === toNum);
|
|
4015
4103
|
if (!toItem) {
|
|
4016
|
-
console.log(
|
|
4104
|
+
console.log(chalk49.red(`Item #${toId} not found.`));
|
|
4017
4105
|
return void 0;
|
|
4018
4106
|
}
|
|
4019
4107
|
if (!fromItem.links) fromItem.links = [];
|
|
@@ -4022,7 +4110,7 @@ function validateLinkTarget(items, fromItem, fromId, toId, toNum, linkType) {
|
|
|
4022
4110
|
);
|
|
4023
4111
|
if (duplicate) {
|
|
4024
4112
|
console.log(
|
|
4025
|
-
|
|
4113
|
+
chalk49.yellow(`Link already exists: #${fromId} ${linkType} #${toId}`)
|
|
4026
4114
|
);
|
|
4027
4115
|
return void 0;
|
|
4028
4116
|
}
|
|
@@ -4033,13 +4121,13 @@ function validateLinkTarget(items, fromItem, fromId, toId, toNum, linkType) {
|
|
|
4033
4121
|
function link(fromId, toId, opts) {
|
|
4034
4122
|
const linkType = opts.type ?? "relates-to";
|
|
4035
4123
|
if (linkType !== "relates-to" && linkType !== "depends-on") {
|
|
4036
|
-
console.log(
|
|
4124
|
+
console.log(chalk50.red(`Invalid link type: ${linkType}`));
|
|
4037
4125
|
return;
|
|
4038
4126
|
}
|
|
4039
4127
|
const fromNum = Number.parseInt(fromId, 10);
|
|
4040
4128
|
const toNum = Number.parseInt(toId, 10);
|
|
4041
4129
|
if (fromNum === toNum) {
|
|
4042
|
-
console.log(
|
|
4130
|
+
console.log(chalk50.red("Cannot link an item to itself."));
|
|
4043
4131
|
return;
|
|
4044
4132
|
}
|
|
4045
4133
|
const result = loadAndFindItem(fromId);
|
|
@@ -4056,7 +4144,7 @@ function link(fromId, toId, opts) {
|
|
|
4056
4144
|
if (!toItem) return;
|
|
4057
4145
|
if (linkType === "depends-on" && hasCycle(items, fromNum, toNum)) {
|
|
4058
4146
|
console.log(
|
|
4059
|
-
|
|
4147
|
+
chalk50.red(
|
|
4060
4148
|
`Cannot add dependency: #${fromId} \u2192 #${toId} would create a circular dependency.`
|
|
4061
4149
|
)
|
|
4062
4150
|
);
|
|
@@ -4066,32 +4154,32 @@ function link(fromId, toId, opts) {
|
|
|
4066
4154
|
fromItem.links.push({ type: linkType, targetId: toNum });
|
|
4067
4155
|
saveBacklog(items);
|
|
4068
4156
|
console.log(
|
|
4069
|
-
|
|
4157
|
+
chalk50.green(`Linked #${fromId} ${linkType} #${toId} (${toItem.name})`)
|
|
4070
4158
|
);
|
|
4071
4159
|
}
|
|
4072
4160
|
|
|
4073
4161
|
// src/commands/backlog/unlink.ts
|
|
4074
|
-
import
|
|
4162
|
+
import chalk51 from "chalk";
|
|
4075
4163
|
function unlink(fromId, toId) {
|
|
4076
4164
|
const toNum = Number.parseInt(toId, 10);
|
|
4077
4165
|
const result = loadAndFindItem(fromId);
|
|
4078
4166
|
if (!result) return;
|
|
4079
4167
|
const { items, item: fromItem } = result;
|
|
4080
4168
|
if (!fromItem.links || fromItem.links.length === 0) {
|
|
4081
|
-
console.log(
|
|
4169
|
+
console.log(chalk51.yellow(`No links found on item #${fromId}.`));
|
|
4082
4170
|
return;
|
|
4083
4171
|
}
|
|
4084
4172
|
const before = fromItem.links.length;
|
|
4085
4173
|
fromItem.links = fromItem.links.filter((l) => l.targetId !== toNum);
|
|
4086
4174
|
if (fromItem.links.length === before) {
|
|
4087
|
-
console.log(
|
|
4175
|
+
console.log(chalk51.yellow(`No link from #${fromId} to #${toId} found.`));
|
|
4088
4176
|
return;
|
|
4089
4177
|
}
|
|
4090
4178
|
if (fromItem.links.length === 0) {
|
|
4091
4179
|
fromItem.links = void 0;
|
|
4092
4180
|
}
|
|
4093
4181
|
saveBacklog(items);
|
|
4094
|
-
console.log(
|
|
4182
|
+
console.log(chalk51.green(`Removed link from #${fromId} to #${toId}.`));
|
|
4095
4183
|
}
|
|
4096
4184
|
|
|
4097
4185
|
// src/commands/backlog/registerLinkCommands.ts
|
|
@@ -4112,11 +4200,11 @@ function registerRunCommand(cmd) {
|
|
|
4112
4200
|
}
|
|
4113
4201
|
|
|
4114
4202
|
// src/commands/backlog/search/index.ts
|
|
4115
|
-
import
|
|
4203
|
+
import chalk52 from "chalk";
|
|
4116
4204
|
async function search(query) {
|
|
4117
4205
|
if (!backlogExists()) {
|
|
4118
4206
|
console.log(
|
|
4119
|
-
|
|
4207
|
+
chalk52.yellow(
|
|
4120
4208
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
4121
4209
|
)
|
|
4122
4210
|
);
|
|
@@ -4124,18 +4212,18 @@ async function search(query) {
|
|
|
4124
4212
|
}
|
|
4125
4213
|
const items = searchBacklog(query);
|
|
4126
4214
|
if (items.length === 0) {
|
|
4127
|
-
console.log(
|
|
4215
|
+
console.log(chalk52.dim(`No items matching "${query}".`));
|
|
4128
4216
|
return;
|
|
4129
4217
|
}
|
|
4130
4218
|
console.log(
|
|
4131
|
-
|
|
4219
|
+
chalk52.dim(
|
|
4132
4220
|
`${items.length} item${items.length === 1 ? "" : "s"} matching "${query}":
|
|
4133
4221
|
`
|
|
4134
4222
|
)
|
|
4135
4223
|
);
|
|
4136
4224
|
for (const item of items) {
|
|
4137
4225
|
console.log(
|
|
4138
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
4226
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk52.dim(`#${item.id}`)} ${item.name}`
|
|
4139
4227
|
);
|
|
4140
4228
|
}
|
|
4141
4229
|
}
|
|
@@ -4146,16 +4234,16 @@ function registerSearchCommand(cmd) {
|
|
|
4146
4234
|
}
|
|
4147
4235
|
|
|
4148
4236
|
// src/commands/backlog/delete/index.ts
|
|
4149
|
-
import
|
|
4237
|
+
import chalk53 from "chalk";
|
|
4150
4238
|
async function del(id) {
|
|
4151
4239
|
const name = removeItem(id);
|
|
4152
4240
|
if (name) {
|
|
4153
|
-
console.log(
|
|
4241
|
+
console.log(chalk53.green(`Deleted item #${id}: ${name}`));
|
|
4154
4242
|
}
|
|
4155
4243
|
}
|
|
4156
4244
|
|
|
4157
4245
|
// src/commands/backlog/done/index.ts
|
|
4158
|
-
import
|
|
4246
|
+
import chalk54 from "chalk";
|
|
4159
4247
|
async function done(id, summary) {
|
|
4160
4248
|
const result = loadAndFindItem(id);
|
|
4161
4249
|
if (!result) return;
|
|
@@ -4165,12 +4253,12 @@ async function done(id, summary) {
|
|
|
4165
4253
|
const pending = item.plan.slice(completed);
|
|
4166
4254
|
if (pending.length > 0) {
|
|
4167
4255
|
console.log(
|
|
4168
|
-
|
|
4256
|
+
chalk54.red(
|
|
4169
4257
|
`Cannot complete item #${id}: ${pending.length} pending phase(s):`
|
|
4170
4258
|
)
|
|
4171
4259
|
);
|
|
4172
4260
|
for (const phase of pending) {
|
|
4173
|
-
console.log(
|
|
4261
|
+
console.log(chalk54.yellow(` - ${phase.name}`));
|
|
4174
4262
|
}
|
|
4175
4263
|
process.exitCode = 1;
|
|
4176
4264
|
return;
|
|
@@ -4182,20 +4270,20 @@ async function done(id, summary) {
|
|
|
4182
4270
|
addPhaseSummary(item, summary, phase);
|
|
4183
4271
|
}
|
|
4184
4272
|
saveBacklog(result.items);
|
|
4185
|
-
console.log(
|
|
4273
|
+
console.log(chalk54.green(`Completed item #${id}: ${item.name}`));
|
|
4186
4274
|
}
|
|
4187
4275
|
|
|
4188
4276
|
// src/commands/backlog/start/index.ts
|
|
4189
|
-
import
|
|
4277
|
+
import chalk55 from "chalk";
|
|
4190
4278
|
async function start(id) {
|
|
4191
4279
|
const name = setStatus(id, "in-progress");
|
|
4192
4280
|
if (name) {
|
|
4193
|
-
console.log(
|
|
4281
|
+
console.log(chalk55.green(`Started item #${id}: ${name}`));
|
|
4194
4282
|
}
|
|
4195
4283
|
}
|
|
4196
4284
|
|
|
4197
4285
|
// src/commands/backlog/wontdo/index.ts
|
|
4198
|
-
import
|
|
4286
|
+
import chalk56 from "chalk";
|
|
4199
4287
|
async function wontdo(id, reason) {
|
|
4200
4288
|
const result = loadAndFindItem(id);
|
|
4201
4289
|
if (!result) return;
|
|
@@ -4205,7 +4293,7 @@ async function wontdo(id, reason) {
|
|
|
4205
4293
|
addPhaseSummary(result.item, reason, phase);
|
|
4206
4294
|
}
|
|
4207
4295
|
saveBacklog(result.items);
|
|
4208
|
-
console.log(
|
|
4296
|
+
console.log(chalk56.red(`Won't do item #${id}: ${result.item.name}`));
|
|
4209
4297
|
}
|
|
4210
4298
|
|
|
4211
4299
|
// src/commands/backlog/registerStatusCommands.ts
|
|
@@ -4217,10 +4305,10 @@ function registerStatusCommands(cmd) {
|
|
|
4217
4305
|
}
|
|
4218
4306
|
|
|
4219
4307
|
// src/commands/backlog/removePhase.ts
|
|
4220
|
-
import
|
|
4308
|
+
import chalk58 from "chalk";
|
|
4221
4309
|
|
|
4222
4310
|
// src/commands/backlog/findPhase.ts
|
|
4223
|
-
import
|
|
4311
|
+
import chalk57 from "chalk";
|
|
4224
4312
|
function findPhase(id, phase) {
|
|
4225
4313
|
const result = loadAndFindItem(id);
|
|
4226
4314
|
if (!result) return void 0;
|
|
@@ -4232,7 +4320,7 @@ function findPhase(id, phase) {
|
|
|
4232
4320
|
"SELECT COUNT(*) as cnt FROM plan_phases WHERE item_id = ? AND idx = ?"
|
|
4233
4321
|
).get(itemId, phaseIdx);
|
|
4234
4322
|
if (existing.cnt === 0) {
|
|
4235
|
-
console.log(
|
|
4323
|
+
console.log(chalk57.red(`Phase ${phaseIdx} not found on item #${itemId}.`));
|
|
4236
4324
|
process.exitCode = 1;
|
|
4237
4325
|
return void 0;
|
|
4238
4326
|
}
|
|
@@ -4288,23 +4376,23 @@ function removePhase(id, phase) {
|
|
|
4288
4376
|
run4();
|
|
4289
4377
|
exportToJsonl(db, dir);
|
|
4290
4378
|
commitBacklog(itemId, result.item.name);
|
|
4291
|
-
console.log(
|
|
4379
|
+
console.log(chalk58.green(`Removed phase ${phaseIdx} from item #${itemId}.`));
|
|
4292
4380
|
}
|
|
4293
4381
|
|
|
4294
4382
|
// src/commands/backlog/update/index.ts
|
|
4295
|
-
import
|
|
4383
|
+
import chalk60 from "chalk";
|
|
4296
4384
|
|
|
4297
4385
|
// src/commands/backlog/update/buildUpdateSql.ts
|
|
4298
|
-
import
|
|
4386
|
+
import chalk59 from "chalk";
|
|
4299
4387
|
function buildUpdateSql(options2) {
|
|
4300
4388
|
const { name, desc, type, ac } = options2;
|
|
4301
4389
|
if (!name && !desc && !type && !ac) {
|
|
4302
|
-
console.log(
|
|
4390
|
+
console.log(chalk59.red("Nothing to update. Provide at least one flag."));
|
|
4303
4391
|
process.exitCode = 1;
|
|
4304
4392
|
return void 0;
|
|
4305
4393
|
}
|
|
4306
4394
|
if (type && type !== "story" && type !== "bug") {
|
|
4307
|
-
console.log(
|
|
4395
|
+
console.log(chalk59.red('Invalid type. Must be "story" or "bug".'));
|
|
4308
4396
|
process.exitCode = 1;
|
|
4309
4397
|
return void 0;
|
|
4310
4398
|
}
|
|
@@ -4349,11 +4437,11 @@ function update(id, options2) {
|
|
|
4349
4437
|
);
|
|
4350
4438
|
exportToJsonl(db, dir);
|
|
4351
4439
|
commitBacklog(itemId, options2.name ?? result.item.name);
|
|
4352
|
-
console.log(
|
|
4440
|
+
console.log(chalk60.green(`Updated ${built.fields} on item #${itemId}.`));
|
|
4353
4441
|
}
|
|
4354
4442
|
|
|
4355
4443
|
// src/commands/backlog/updatePhase.ts
|
|
4356
|
-
import
|
|
4444
|
+
import chalk61 from "chalk";
|
|
4357
4445
|
|
|
4358
4446
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
4359
4447
|
function applyPhaseUpdate(db, itemId, phaseIdx, fields) {
|
|
@@ -4387,7 +4475,7 @@ function applyPhaseUpdate(db, itemId, phaseIdx, fields) {
|
|
|
4387
4475
|
function updatePhase(id, phase, options2) {
|
|
4388
4476
|
const { name, task, manualCheck } = options2;
|
|
4389
4477
|
if (!name && !task && !manualCheck) {
|
|
4390
|
-
console.log(
|
|
4478
|
+
console.log(chalk61.red("Nothing to update. Provide at least one flag."));
|
|
4391
4479
|
process.exitCode = 1;
|
|
4392
4480
|
return;
|
|
4393
4481
|
}
|
|
@@ -4403,7 +4491,7 @@ function updatePhase(id, phase, options2) {
|
|
|
4403
4491
|
manualCheck && "manual checks"
|
|
4404
4492
|
].filter(Boolean).join(", ");
|
|
4405
4493
|
console.log(
|
|
4406
|
-
|
|
4494
|
+
chalk61.green(`Updated ${fields} on phase ${phaseIdx} of item #${itemId}.`)
|
|
4407
4495
|
);
|
|
4408
4496
|
}
|
|
4409
4497
|
|
|
@@ -4900,11 +4988,11 @@ function assertCliExists(cli) {
|
|
|
4900
4988
|
}
|
|
4901
4989
|
|
|
4902
4990
|
// src/commands/permitCliReads/colorize.ts
|
|
4903
|
-
import
|
|
4991
|
+
import chalk62 from "chalk";
|
|
4904
4992
|
function colorize(plainOutput) {
|
|
4905
4993
|
return plainOutput.split("\n").map((line) => {
|
|
4906
|
-
if (line.startsWith(" R ")) return
|
|
4907
|
-
if (line.startsWith(" W ")) return
|
|
4994
|
+
if (line.startsWith(" R ")) return chalk62.green(line);
|
|
4995
|
+
if (line.startsWith(" W ")) return chalk62.red(line);
|
|
4908
4996
|
return line;
|
|
4909
4997
|
}).join("\n");
|
|
4910
4998
|
}
|
|
@@ -5202,48 +5290,48 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
5202
5290
|
}
|
|
5203
5291
|
|
|
5204
5292
|
// src/commands/deny/denyAdd.ts
|
|
5205
|
-
import
|
|
5293
|
+
import chalk63 from "chalk";
|
|
5206
5294
|
function denyAdd(pattern2, message) {
|
|
5207
5295
|
const config = loadProjectConfig();
|
|
5208
5296
|
const deny = config.deny ?? [];
|
|
5209
5297
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
5210
|
-
console.log(
|
|
5298
|
+
console.log(chalk63.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
5211
5299
|
return;
|
|
5212
5300
|
}
|
|
5213
5301
|
deny.push({ pattern: pattern2, message });
|
|
5214
5302
|
config.deny = deny;
|
|
5215
5303
|
saveConfig(config);
|
|
5216
|
-
console.log(
|
|
5304
|
+
console.log(chalk63.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
5217
5305
|
}
|
|
5218
5306
|
|
|
5219
5307
|
// src/commands/deny/denyList.ts
|
|
5220
|
-
import
|
|
5308
|
+
import chalk64 from "chalk";
|
|
5221
5309
|
function denyList() {
|
|
5222
5310
|
const config = loadConfig();
|
|
5223
5311
|
const deny = config.deny;
|
|
5224
5312
|
if (!deny || deny.length === 0) {
|
|
5225
|
-
console.log(
|
|
5313
|
+
console.log(chalk64.dim("No deny rules configured."));
|
|
5226
5314
|
return;
|
|
5227
5315
|
}
|
|
5228
5316
|
for (const rule of deny) {
|
|
5229
|
-
console.log(`${
|
|
5317
|
+
console.log(`${chalk64.red(rule.pattern)} \u2192 ${rule.message}`);
|
|
5230
5318
|
}
|
|
5231
5319
|
}
|
|
5232
5320
|
|
|
5233
5321
|
// src/commands/deny/denyRemove.ts
|
|
5234
|
-
import
|
|
5322
|
+
import chalk65 from "chalk";
|
|
5235
5323
|
function denyRemove(pattern2) {
|
|
5236
5324
|
const config = loadProjectConfig();
|
|
5237
5325
|
const deny = config.deny ?? [];
|
|
5238
5326
|
const index = deny.findIndex((r) => r.pattern === pattern2);
|
|
5239
5327
|
if (index === -1) {
|
|
5240
|
-
console.log(
|
|
5328
|
+
console.log(chalk65.yellow(`No deny rule found for: ${pattern2}`));
|
|
5241
5329
|
return;
|
|
5242
5330
|
}
|
|
5243
5331
|
deny.splice(index, 1);
|
|
5244
5332
|
config.deny = deny.length > 0 ? deny : void 0;
|
|
5245
5333
|
saveConfig(config);
|
|
5246
|
-
console.log(
|
|
5334
|
+
console.log(chalk65.green(`Removed deny rule: ${pattern2}`));
|
|
5247
5335
|
}
|
|
5248
5336
|
|
|
5249
5337
|
// src/commands/registerDeny.ts
|
|
@@ -5272,15 +5360,15 @@ function registerCliHook(program2) {
|
|
|
5272
5360
|
}
|
|
5273
5361
|
|
|
5274
5362
|
// src/commands/complexity/analyze.ts
|
|
5275
|
-
import
|
|
5363
|
+
import chalk71 from "chalk";
|
|
5276
5364
|
|
|
5277
5365
|
// src/commands/complexity/cyclomatic.ts
|
|
5278
|
-
import
|
|
5366
|
+
import chalk67 from "chalk";
|
|
5279
5367
|
|
|
5280
5368
|
// src/commands/complexity/shared/index.ts
|
|
5281
5369
|
import fs12 from "fs";
|
|
5282
5370
|
import path20 from "path";
|
|
5283
|
-
import
|
|
5371
|
+
import chalk66 from "chalk";
|
|
5284
5372
|
import ts5 from "typescript";
|
|
5285
5373
|
|
|
5286
5374
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -5526,7 +5614,7 @@ function createSourceFromFile(filePath) {
|
|
|
5526
5614
|
function withSourceFiles(pattern2, callback) {
|
|
5527
5615
|
const files = findSourceFiles2(pattern2);
|
|
5528
5616
|
if (files.length === 0) {
|
|
5529
|
-
console.log(
|
|
5617
|
+
console.log(chalk66.yellow("No files found matching pattern"));
|
|
5530
5618
|
return void 0;
|
|
5531
5619
|
}
|
|
5532
5620
|
return callback(files);
|
|
@@ -5559,11 +5647,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5559
5647
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
5560
5648
|
for (const { file, name, complexity } of results) {
|
|
5561
5649
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
5562
|
-
const color = exceedsThreshold ?
|
|
5563
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
5650
|
+
const color = exceedsThreshold ? chalk67.red : chalk67.white;
|
|
5651
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk67.cyan(complexity)}`);
|
|
5564
5652
|
}
|
|
5565
5653
|
console.log(
|
|
5566
|
-
|
|
5654
|
+
chalk67.dim(
|
|
5567
5655
|
`
|
|
5568
5656
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
5569
5657
|
)
|
|
@@ -5575,7 +5663,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
5575
5663
|
}
|
|
5576
5664
|
|
|
5577
5665
|
// src/commands/complexity/halstead.ts
|
|
5578
|
-
import
|
|
5666
|
+
import chalk68 from "chalk";
|
|
5579
5667
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
5580
5668
|
withSourceFiles(pattern2, (files) => {
|
|
5581
5669
|
const results = [];
|
|
@@ -5590,13 +5678,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5590
5678
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
5591
5679
|
for (const { file, name, metrics } of results) {
|
|
5592
5680
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
5593
|
-
const color = exceedsThreshold ?
|
|
5681
|
+
const color = exceedsThreshold ? chalk68.red : chalk68.white;
|
|
5594
5682
|
console.log(
|
|
5595
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
5683
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk68.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk68.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk68.magenta(metrics.effort.toFixed(1))}`
|
|
5596
5684
|
);
|
|
5597
5685
|
}
|
|
5598
5686
|
console.log(
|
|
5599
|
-
|
|
5687
|
+
chalk68.dim(
|
|
5600
5688
|
`
|
|
5601
5689
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
5602
5690
|
)
|
|
@@ -5611,28 +5699,28 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
5611
5699
|
import fs13 from "fs";
|
|
5612
5700
|
|
|
5613
5701
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
5614
|
-
import
|
|
5702
|
+
import chalk69 from "chalk";
|
|
5615
5703
|
function displayMaintainabilityResults(results, threshold) {
|
|
5616
5704
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
5617
5705
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
5618
|
-
console.log(
|
|
5706
|
+
console.log(chalk69.green("All files pass maintainability threshold"));
|
|
5619
5707
|
} else {
|
|
5620
5708
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
5621
|
-
const color = threshold !== void 0 ?
|
|
5709
|
+
const color = threshold !== void 0 ? chalk69.red : chalk69.white;
|
|
5622
5710
|
console.log(
|
|
5623
|
-
`${color(file)} \u2192 avg: ${
|
|
5711
|
+
`${color(file)} \u2192 avg: ${chalk69.cyan(avgMaintainability.toFixed(1))}, min: ${chalk69.yellow(minMaintainability.toFixed(1))}`
|
|
5624
5712
|
);
|
|
5625
5713
|
}
|
|
5626
5714
|
}
|
|
5627
|
-
console.log(
|
|
5715
|
+
console.log(chalk69.dim(`
|
|
5628
5716
|
Analyzed ${results.length} files`));
|
|
5629
5717
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
5630
5718
|
console.error(
|
|
5631
|
-
|
|
5719
|
+
chalk69.red(
|
|
5632
5720
|
`
|
|
5633
5721
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
5634
5722
|
|
|
5635
|
-
\u26A0\uFE0F ${
|
|
5723
|
+
\u26A0\uFE0F ${chalk69.bold("Diagnose and fix one file at a time")} \u2014 do not investigate or fix multiple files in parallel. Run 'assist complexity <file>' to see all metrics. For larger files, start by extracting responsibilities into smaller files.`
|
|
5636
5724
|
)
|
|
5637
5725
|
);
|
|
5638
5726
|
process.exit(1);
|
|
@@ -5689,7 +5777,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5689
5777
|
|
|
5690
5778
|
// src/commands/complexity/sloc.ts
|
|
5691
5779
|
import fs14 from "fs";
|
|
5692
|
-
import
|
|
5780
|
+
import chalk70 from "chalk";
|
|
5693
5781
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
5694
5782
|
withSourceFiles(pattern2, (files) => {
|
|
5695
5783
|
const results = [];
|
|
@@ -5705,12 +5793,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5705
5793
|
results.sort((a, b) => b.lines - a.lines);
|
|
5706
5794
|
for (const { file, lines } of results) {
|
|
5707
5795
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
5708
|
-
const color = exceedsThreshold ?
|
|
5709
|
-
console.log(`${color(file)} \u2192 ${
|
|
5796
|
+
const color = exceedsThreshold ? chalk70.red : chalk70.white;
|
|
5797
|
+
console.log(`${color(file)} \u2192 ${chalk70.cyan(lines)} lines`);
|
|
5710
5798
|
}
|
|
5711
5799
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
5712
5800
|
console.log(
|
|
5713
|
-
|
|
5801
|
+
chalk70.dim(`
|
|
5714
5802
|
Total: ${total} lines across ${files.length} files`)
|
|
5715
5803
|
);
|
|
5716
5804
|
if (hasViolation) {
|
|
@@ -5724,21 +5812,21 @@ async function analyze(pattern2) {
|
|
|
5724
5812
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
5725
5813
|
const files = findSourceFiles2(searchPattern);
|
|
5726
5814
|
if (files.length === 0) {
|
|
5727
|
-
console.log(
|
|
5815
|
+
console.log(chalk71.yellow("No files found matching pattern"));
|
|
5728
5816
|
return;
|
|
5729
5817
|
}
|
|
5730
5818
|
if (files.length === 1) {
|
|
5731
5819
|
const file = files[0];
|
|
5732
|
-
console.log(
|
|
5820
|
+
console.log(chalk71.bold.underline("SLOC"));
|
|
5733
5821
|
await sloc(file);
|
|
5734
5822
|
console.log();
|
|
5735
|
-
console.log(
|
|
5823
|
+
console.log(chalk71.bold.underline("Cyclomatic Complexity"));
|
|
5736
5824
|
await cyclomatic(file);
|
|
5737
5825
|
console.log();
|
|
5738
|
-
console.log(
|
|
5826
|
+
console.log(chalk71.bold.underline("Halstead Metrics"));
|
|
5739
5827
|
await halstead(file);
|
|
5740
5828
|
console.log();
|
|
5741
|
-
console.log(
|
|
5829
|
+
console.log(chalk71.bold.underline("Maintainability Index"));
|
|
5742
5830
|
await maintainability(file);
|
|
5743
5831
|
return;
|
|
5744
5832
|
}
|
|
@@ -5765,7 +5853,7 @@ function registerComplexity(program2) {
|
|
|
5765
5853
|
}
|
|
5766
5854
|
|
|
5767
5855
|
// src/commands/config/index.ts
|
|
5768
|
-
import
|
|
5856
|
+
import chalk72 from "chalk";
|
|
5769
5857
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
5770
5858
|
|
|
5771
5859
|
// src/commands/config/setNestedValue.ts
|
|
@@ -5828,7 +5916,7 @@ function formatIssuePath(issue, key) {
|
|
|
5828
5916
|
function printValidationErrors(issues, key) {
|
|
5829
5917
|
for (const issue of issues) {
|
|
5830
5918
|
console.error(
|
|
5831
|
-
|
|
5919
|
+
chalk72.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
5832
5920
|
);
|
|
5833
5921
|
}
|
|
5834
5922
|
}
|
|
@@ -5845,7 +5933,7 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
5845
5933
|
function assertNotGlobalOnly(key, global) {
|
|
5846
5934
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
5847
5935
|
console.error(
|
|
5848
|
-
|
|
5936
|
+
chalk72.red(
|
|
5849
5937
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
5850
5938
|
)
|
|
5851
5939
|
);
|
|
@@ -5868,7 +5956,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
5868
5956
|
applyConfigSet(key, coerced, options2.global ?? false);
|
|
5869
5957
|
const target = options2.global ? "global" : "project";
|
|
5870
5958
|
console.log(
|
|
5871
|
-
|
|
5959
|
+
chalk72.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
5872
5960
|
);
|
|
5873
5961
|
}
|
|
5874
5962
|
function configList() {
|
|
@@ -5877,7 +5965,7 @@ function configList() {
|
|
|
5877
5965
|
}
|
|
5878
5966
|
|
|
5879
5967
|
// src/commands/config/configGet.ts
|
|
5880
|
-
import
|
|
5968
|
+
import chalk73 from "chalk";
|
|
5881
5969
|
|
|
5882
5970
|
// src/commands/config/getNestedValue.ts
|
|
5883
5971
|
function isTraversable(value) {
|
|
@@ -5909,7 +5997,7 @@ function requireNestedValue(config, key) {
|
|
|
5909
5997
|
return value;
|
|
5910
5998
|
}
|
|
5911
5999
|
function exitKeyNotSet(key) {
|
|
5912
|
-
console.error(
|
|
6000
|
+
console.error(chalk73.red(`Key "${key}" is not set`));
|
|
5913
6001
|
process.exit(1);
|
|
5914
6002
|
}
|
|
5915
6003
|
|
|
@@ -5923,7 +6011,7 @@ function registerConfig(program2) {
|
|
|
5923
6011
|
|
|
5924
6012
|
// src/commands/deploy/redirect.ts
|
|
5925
6013
|
import { existsSync as existsSync22, readFileSync as readFileSync19, writeFileSync as writeFileSync18 } from "fs";
|
|
5926
|
-
import
|
|
6014
|
+
import chalk74 from "chalk";
|
|
5927
6015
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
5928
6016
|
if (!window.location.pathname.endsWith('/')) {
|
|
5929
6017
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -5932,22 +6020,22 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
5932
6020
|
function redirect() {
|
|
5933
6021
|
const indexPath = "index.html";
|
|
5934
6022
|
if (!existsSync22(indexPath)) {
|
|
5935
|
-
console.log(
|
|
6023
|
+
console.log(chalk74.yellow("No index.html found"));
|
|
5936
6024
|
return;
|
|
5937
6025
|
}
|
|
5938
6026
|
const content = readFileSync19(indexPath, "utf-8");
|
|
5939
6027
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
5940
|
-
console.log(
|
|
6028
|
+
console.log(chalk74.dim("Trailing slash script already present"));
|
|
5941
6029
|
return;
|
|
5942
6030
|
}
|
|
5943
6031
|
const headCloseIndex = content.indexOf("</head>");
|
|
5944
6032
|
if (headCloseIndex === -1) {
|
|
5945
|
-
console.log(
|
|
6033
|
+
console.log(chalk74.red("Could not find </head> tag in index.html"));
|
|
5946
6034
|
return;
|
|
5947
6035
|
}
|
|
5948
6036
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
5949
6037
|
writeFileSync18(indexPath, newContent);
|
|
5950
|
-
console.log(
|
|
6038
|
+
console.log(chalk74.green("Added trailing slash redirect to index.html"));
|
|
5951
6039
|
}
|
|
5952
6040
|
|
|
5953
6041
|
// src/commands/registerDeploy.ts
|
|
@@ -5974,7 +6062,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
5974
6062
|
|
|
5975
6063
|
// src/commands/devlog/shared.ts
|
|
5976
6064
|
import { execSync as execSync18 } from "child_process";
|
|
5977
|
-
import
|
|
6065
|
+
import chalk75 from "chalk";
|
|
5978
6066
|
|
|
5979
6067
|
// src/shared/getRepoName.ts
|
|
5980
6068
|
import { existsSync as existsSync23, readFileSync as readFileSync20 } from "fs";
|
|
@@ -6083,13 +6171,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
6083
6171
|
}
|
|
6084
6172
|
function printCommitsWithFiles(commits, ignore2, verbose) {
|
|
6085
6173
|
for (const commit2 of commits) {
|
|
6086
|
-
console.log(` ${
|
|
6174
|
+
console.log(` ${chalk75.yellow(commit2.hash)} ${commit2.message}`);
|
|
6087
6175
|
if (verbose) {
|
|
6088
6176
|
const visibleFiles = commit2.files.filter(
|
|
6089
6177
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
6090
6178
|
);
|
|
6091
6179
|
for (const file of visibleFiles) {
|
|
6092
|
-
console.log(` ${
|
|
6180
|
+
console.log(` ${chalk75.dim(file)}`);
|
|
6093
6181
|
}
|
|
6094
6182
|
}
|
|
6095
6183
|
}
|
|
@@ -6114,15 +6202,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
6114
6202
|
}
|
|
6115
6203
|
|
|
6116
6204
|
// src/commands/devlog/list/printDateHeader.ts
|
|
6117
|
-
import
|
|
6205
|
+
import chalk76 from "chalk";
|
|
6118
6206
|
function printDateHeader(date, isSkipped, entries) {
|
|
6119
6207
|
if (isSkipped) {
|
|
6120
|
-
console.log(`${
|
|
6208
|
+
console.log(`${chalk76.bold.blue(date)} ${chalk76.dim("skipped")}`);
|
|
6121
6209
|
} else if (entries && entries.length > 0) {
|
|
6122
|
-
const entryInfo = entries.map((e) => `${
|
|
6123
|
-
console.log(`${
|
|
6210
|
+
const entryInfo = entries.map((e) => `${chalk76.green(e.version)} ${e.title}`).join(" | ");
|
|
6211
|
+
console.log(`${chalk76.bold.blue(date)} ${entryInfo}`);
|
|
6124
6212
|
} else {
|
|
6125
|
-
console.log(`${
|
|
6213
|
+
console.log(`${chalk76.bold.blue(date)} ${chalk76.red("\u26A0 devlog missing")}`);
|
|
6126
6214
|
}
|
|
6127
6215
|
}
|
|
6128
6216
|
|
|
@@ -6226,24 +6314,24 @@ function bumpVersion(version2, type) {
|
|
|
6226
6314
|
|
|
6227
6315
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
6228
6316
|
import { execSync as execSync21 } from "child_process";
|
|
6229
|
-
import
|
|
6317
|
+
import chalk78 from "chalk";
|
|
6230
6318
|
|
|
6231
6319
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
6232
|
-
import
|
|
6320
|
+
import chalk77 from "chalk";
|
|
6233
6321
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
6234
6322
|
if (conventional && firstHash) {
|
|
6235
6323
|
const version2 = getVersionAtCommit(firstHash);
|
|
6236
6324
|
if (version2) {
|
|
6237
|
-
console.log(`${
|
|
6325
|
+
console.log(`${chalk77.bold("version:")} ${stripToMinor(version2)}`);
|
|
6238
6326
|
} else {
|
|
6239
|
-
console.log(`${
|
|
6327
|
+
console.log(`${chalk77.bold("version:")} ${chalk77.red("unknown")}`);
|
|
6240
6328
|
}
|
|
6241
6329
|
} else if (patchVersion && minorVersion) {
|
|
6242
6330
|
console.log(
|
|
6243
|
-
`${
|
|
6331
|
+
`${chalk77.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
6244
6332
|
);
|
|
6245
6333
|
} else {
|
|
6246
|
-
console.log(`${
|
|
6334
|
+
console.log(`${chalk77.bold("version:")} v0.1 (initial)`);
|
|
6247
6335
|
}
|
|
6248
6336
|
}
|
|
6249
6337
|
|
|
@@ -6290,16 +6378,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
6290
6378
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
6291
6379
|
}
|
|
6292
6380
|
function logName(repoName) {
|
|
6293
|
-
console.log(`${
|
|
6381
|
+
console.log(`${chalk78.bold("name:")} ${repoName}`);
|
|
6294
6382
|
}
|
|
6295
6383
|
function displayNextEntry(ctx, targetDate, commits) {
|
|
6296
6384
|
logName(ctx.repoName);
|
|
6297
6385
|
printVersionInfo(ctx.config, ctx.lastInfo, commits[0]?.hash);
|
|
6298
|
-
console.log(
|
|
6386
|
+
console.log(chalk78.bold.blue(targetDate));
|
|
6299
6387
|
printCommitsWithFiles(commits, ctx.ignore, ctx.verbose);
|
|
6300
6388
|
}
|
|
6301
6389
|
function logNoCommits(lastInfo) {
|
|
6302
|
-
console.log(
|
|
6390
|
+
console.log(chalk78.dim(noCommitsMessage(!!lastInfo)));
|
|
6303
6391
|
}
|
|
6304
6392
|
|
|
6305
6393
|
// src/commands/devlog/next/index.ts
|
|
@@ -6340,11 +6428,11 @@ function next2(options2) {
|
|
|
6340
6428
|
import { execSync as execSync22 } from "child_process";
|
|
6341
6429
|
|
|
6342
6430
|
// src/commands/devlog/repos/printReposTable.ts
|
|
6343
|
-
import
|
|
6431
|
+
import chalk79 from "chalk";
|
|
6344
6432
|
function colorStatus(status2) {
|
|
6345
|
-
if (status2 === "missing") return
|
|
6346
|
-
if (status2 === "outdated") return
|
|
6347
|
-
return
|
|
6433
|
+
if (status2 === "missing") return chalk79.red(status2);
|
|
6434
|
+
if (status2 === "outdated") return chalk79.yellow(status2);
|
|
6435
|
+
return chalk79.green(status2);
|
|
6348
6436
|
}
|
|
6349
6437
|
function formatRow(row, nameWidth) {
|
|
6350
6438
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -6358,8 +6446,8 @@ function printReposTable(rows) {
|
|
|
6358
6446
|
"Last Devlog".padEnd(11),
|
|
6359
6447
|
"Status"
|
|
6360
6448
|
].join(" ");
|
|
6361
|
-
console.log(
|
|
6362
|
-
console.log(
|
|
6449
|
+
console.log(chalk79.dim(header));
|
|
6450
|
+
console.log(chalk79.dim("-".repeat(header.length)));
|
|
6363
6451
|
for (const row of rows) {
|
|
6364
6452
|
console.log(formatRow(row, nameWidth));
|
|
6365
6453
|
}
|
|
@@ -6417,14 +6505,14 @@ function repos(options2) {
|
|
|
6417
6505
|
// src/commands/devlog/skip.ts
|
|
6418
6506
|
import { writeFileSync as writeFileSync19 } from "fs";
|
|
6419
6507
|
import { join as join22 } from "path";
|
|
6420
|
-
import
|
|
6508
|
+
import chalk80 from "chalk";
|
|
6421
6509
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
6422
6510
|
function getBlogConfigPath() {
|
|
6423
6511
|
return join22(BLOG_REPO_ROOT, "assist.yml");
|
|
6424
6512
|
}
|
|
6425
6513
|
function skip(date) {
|
|
6426
6514
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
6427
|
-
console.log(
|
|
6515
|
+
console.log(chalk80.red("Invalid date format. Use YYYY-MM-DD"));
|
|
6428
6516
|
process.exit(1);
|
|
6429
6517
|
}
|
|
6430
6518
|
const repoName = getRepoName();
|
|
@@ -6435,7 +6523,7 @@ function skip(date) {
|
|
|
6435
6523
|
const skipDays = skip2[repoName] ?? [];
|
|
6436
6524
|
if (skipDays.includes(date)) {
|
|
6437
6525
|
console.log(
|
|
6438
|
-
|
|
6526
|
+
chalk80.yellow(`${date} is already in skip list for ${repoName}`)
|
|
6439
6527
|
);
|
|
6440
6528
|
return;
|
|
6441
6529
|
}
|
|
@@ -6445,20 +6533,20 @@ function skip(date) {
|
|
|
6445
6533
|
devlog.skip = skip2;
|
|
6446
6534
|
config.devlog = devlog;
|
|
6447
6535
|
writeFileSync19(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
6448
|
-
console.log(
|
|
6536
|
+
console.log(chalk80.green(`Added ${date} to skip list for ${repoName}`));
|
|
6449
6537
|
}
|
|
6450
6538
|
|
|
6451
6539
|
// src/commands/devlog/version.ts
|
|
6452
|
-
import
|
|
6540
|
+
import chalk81 from "chalk";
|
|
6453
6541
|
function version() {
|
|
6454
6542
|
const config = loadConfig();
|
|
6455
6543
|
const name = getRepoName();
|
|
6456
6544
|
const lastInfo = getLastVersionInfo(name, config);
|
|
6457
6545
|
const lastVersion = lastInfo?.version ?? null;
|
|
6458
6546
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
6459
|
-
console.log(`${
|
|
6460
|
-
console.log(`${
|
|
6461
|
-
console.log(`${
|
|
6547
|
+
console.log(`${chalk81.bold("name:")} ${name}`);
|
|
6548
|
+
console.log(`${chalk81.bold("last:")} ${lastVersion ?? chalk81.dim("none")}`);
|
|
6549
|
+
console.log(`${chalk81.bold("next:")} ${nextVersion ?? chalk81.dim("none")}`);
|
|
6462
6550
|
}
|
|
6463
6551
|
|
|
6464
6552
|
// src/commands/registerDevlog.ts
|
|
@@ -6482,7 +6570,7 @@ function registerDevlog(program2) {
|
|
|
6482
6570
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
6483
6571
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
6484
6572
|
import { join as join23 } from "path";
|
|
6485
|
-
import
|
|
6573
|
+
import chalk82 from "chalk";
|
|
6486
6574
|
|
|
6487
6575
|
// src/shared/findRepoRoot.ts
|
|
6488
6576
|
import { existsSync as existsSync24 } from "fs";
|
|
@@ -6545,14 +6633,14 @@ function checkBuildLocks(startDir) {
|
|
|
6545
6633
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
6546
6634
|
if (locked) {
|
|
6547
6635
|
console.error(
|
|
6548
|
-
|
|
6636
|
+
chalk82.red("Build output locked (is VS debugging?): ") + locked
|
|
6549
6637
|
);
|
|
6550
6638
|
process.exit(1);
|
|
6551
6639
|
}
|
|
6552
6640
|
}
|
|
6553
6641
|
async function checkBuildLocksCommand() {
|
|
6554
6642
|
checkBuildLocks();
|
|
6555
|
-
console.log(
|
|
6643
|
+
console.log(chalk82.green("No build locks detected"));
|
|
6556
6644
|
}
|
|
6557
6645
|
|
|
6558
6646
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -6651,30 +6739,30 @@ function escapeRegex(s) {
|
|
|
6651
6739
|
}
|
|
6652
6740
|
|
|
6653
6741
|
// src/commands/dotnet/printTree.ts
|
|
6654
|
-
import
|
|
6742
|
+
import chalk83 from "chalk";
|
|
6655
6743
|
function printNodes(nodes, prefix2) {
|
|
6656
6744
|
for (let i = 0; i < nodes.length; i++) {
|
|
6657
6745
|
const isLast = i === nodes.length - 1;
|
|
6658
6746
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
6659
6747
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
6660
6748
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
6661
|
-
const label2 = isMissing ?
|
|
6749
|
+
const label2 = isMissing ? chalk83.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
6662
6750
|
console.log(`${prefix2}${connector}${label2}`);
|
|
6663
6751
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
6664
6752
|
}
|
|
6665
6753
|
}
|
|
6666
6754
|
function printTree(tree, totalCount, solutions) {
|
|
6667
|
-
console.log(
|
|
6668
|
-
console.log(
|
|
6755
|
+
console.log(chalk83.bold("\nProject Dependency Tree"));
|
|
6756
|
+
console.log(chalk83.cyan(tree.relativePath));
|
|
6669
6757
|
printNodes(tree.children, "");
|
|
6670
|
-
console.log(
|
|
6758
|
+
console.log(chalk83.dim(`
|
|
6671
6759
|
${totalCount} projects total (including root)`));
|
|
6672
|
-
console.log(
|
|
6760
|
+
console.log(chalk83.bold("\nSolution Membership"));
|
|
6673
6761
|
if (solutions.length === 0) {
|
|
6674
|
-
console.log(
|
|
6762
|
+
console.log(chalk83.yellow(" Not found in any .sln"));
|
|
6675
6763
|
} else {
|
|
6676
6764
|
for (const sln of solutions) {
|
|
6677
|
-
console.log(` ${
|
|
6765
|
+
console.log(` ${chalk83.green(sln)}`);
|
|
6678
6766
|
}
|
|
6679
6767
|
}
|
|
6680
6768
|
console.log();
|
|
@@ -6703,16 +6791,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
6703
6791
|
// src/commands/dotnet/resolveCsproj.ts
|
|
6704
6792
|
import { existsSync as existsSync25 } from "fs";
|
|
6705
6793
|
import path24 from "path";
|
|
6706
|
-
import
|
|
6794
|
+
import chalk84 from "chalk";
|
|
6707
6795
|
function resolveCsproj(csprojPath) {
|
|
6708
6796
|
const resolved = path24.resolve(csprojPath);
|
|
6709
6797
|
if (!existsSync25(resolved)) {
|
|
6710
|
-
console.error(
|
|
6798
|
+
console.error(chalk84.red(`File not found: ${resolved}`));
|
|
6711
6799
|
process.exit(1);
|
|
6712
6800
|
}
|
|
6713
6801
|
const repoRoot = findRepoRoot(path24.dirname(resolved));
|
|
6714
6802
|
if (!repoRoot) {
|
|
6715
|
-
console.error(
|
|
6803
|
+
console.error(chalk84.red("Could not find git repository root"));
|
|
6716
6804
|
process.exit(1);
|
|
6717
6805
|
}
|
|
6718
6806
|
return { resolved, repoRoot };
|
|
@@ -6762,12 +6850,12 @@ function getChangedCsFiles(scope) {
|
|
|
6762
6850
|
}
|
|
6763
6851
|
|
|
6764
6852
|
// src/commands/dotnet/inSln.ts
|
|
6765
|
-
import
|
|
6853
|
+
import chalk85 from "chalk";
|
|
6766
6854
|
async function inSln(csprojPath) {
|
|
6767
6855
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
6768
6856
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
6769
6857
|
if (solutions.length === 0) {
|
|
6770
|
-
console.log(
|
|
6858
|
+
console.log(chalk85.yellow("Not found in any .sln file"));
|
|
6771
6859
|
process.exit(1);
|
|
6772
6860
|
}
|
|
6773
6861
|
for (const sln of solutions) {
|
|
@@ -6776,7 +6864,7 @@ async function inSln(csprojPath) {
|
|
|
6776
6864
|
}
|
|
6777
6865
|
|
|
6778
6866
|
// src/commands/dotnet/inspect.ts
|
|
6779
|
-
import
|
|
6867
|
+
import chalk91 from "chalk";
|
|
6780
6868
|
|
|
6781
6869
|
// src/shared/formatElapsed.ts
|
|
6782
6870
|
function formatElapsed(ms) {
|
|
@@ -6788,12 +6876,12 @@ function formatElapsed(ms) {
|
|
|
6788
6876
|
}
|
|
6789
6877
|
|
|
6790
6878
|
// src/commands/dotnet/displayIssues.ts
|
|
6791
|
-
import
|
|
6879
|
+
import chalk86 from "chalk";
|
|
6792
6880
|
var SEVERITY_COLOR = {
|
|
6793
|
-
ERROR:
|
|
6794
|
-
WARNING:
|
|
6795
|
-
SUGGESTION:
|
|
6796
|
-
HINT:
|
|
6881
|
+
ERROR: chalk86.red,
|
|
6882
|
+
WARNING: chalk86.yellow,
|
|
6883
|
+
SUGGESTION: chalk86.cyan,
|
|
6884
|
+
HINT: chalk86.dim
|
|
6797
6885
|
};
|
|
6798
6886
|
function groupByFile(issues) {
|
|
6799
6887
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -6809,15 +6897,15 @@ function groupByFile(issues) {
|
|
|
6809
6897
|
}
|
|
6810
6898
|
function displayIssues(issues) {
|
|
6811
6899
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
6812
|
-
console.log(
|
|
6900
|
+
console.log(chalk86.bold(file));
|
|
6813
6901
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
6814
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
6902
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk86.white;
|
|
6815
6903
|
console.log(
|
|
6816
|
-
` ${
|
|
6904
|
+
` ${chalk86.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
6817
6905
|
);
|
|
6818
6906
|
}
|
|
6819
6907
|
}
|
|
6820
|
-
console.log(
|
|
6908
|
+
console.log(chalk86.dim(`
|
|
6821
6909
|
${issues.length} issue(s) found`));
|
|
6822
6910
|
}
|
|
6823
6911
|
|
|
@@ -6876,12 +6964,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
6876
6964
|
// src/commands/dotnet/resolveSolution.ts
|
|
6877
6965
|
import { existsSync as existsSync26 } from "fs";
|
|
6878
6966
|
import path25 from "path";
|
|
6879
|
-
import
|
|
6967
|
+
import chalk88 from "chalk";
|
|
6880
6968
|
|
|
6881
6969
|
// src/commands/dotnet/findSolution.ts
|
|
6882
6970
|
import { readdirSync as readdirSync4 } from "fs";
|
|
6883
6971
|
import { dirname as dirname16, join as join24 } from "path";
|
|
6884
|
-
import
|
|
6972
|
+
import chalk87 from "chalk";
|
|
6885
6973
|
function findSlnInDir(dir) {
|
|
6886
6974
|
try {
|
|
6887
6975
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join24(dir, f));
|
|
@@ -6897,17 +6985,17 @@ function findSolution() {
|
|
|
6897
6985
|
const slnFiles = findSlnInDir(current);
|
|
6898
6986
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
6899
6987
|
if (slnFiles.length > 1) {
|
|
6900
|
-
console.error(
|
|
6988
|
+
console.error(chalk87.red(`Multiple .sln files found in ${current}:`));
|
|
6901
6989
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
6902
6990
|
console.error(
|
|
6903
|
-
|
|
6991
|
+
chalk87.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
6904
6992
|
);
|
|
6905
6993
|
process.exit(1);
|
|
6906
6994
|
}
|
|
6907
6995
|
if (current === ceiling) break;
|
|
6908
6996
|
current = dirname16(current);
|
|
6909
6997
|
}
|
|
6910
|
-
console.error(
|
|
6998
|
+
console.error(chalk87.red("No .sln file found between cwd and repo root"));
|
|
6911
6999
|
process.exit(1);
|
|
6912
7000
|
}
|
|
6913
7001
|
|
|
@@ -6916,7 +7004,7 @@ function resolveSolution(sln) {
|
|
|
6916
7004
|
if (sln) {
|
|
6917
7005
|
const resolved = path25.resolve(sln);
|
|
6918
7006
|
if (!existsSync26(resolved)) {
|
|
6919
|
-
console.error(
|
|
7007
|
+
console.error(chalk88.red(`Solution file not found: ${resolved}`));
|
|
6920
7008
|
process.exit(1);
|
|
6921
7009
|
}
|
|
6922
7010
|
return resolved;
|
|
@@ -6958,14 +7046,14 @@ import { execSync as execSync24 } from "child_process";
|
|
|
6958
7046
|
import { existsSync as existsSync27, readFileSync as readFileSync24, unlinkSync as unlinkSync5 } from "fs";
|
|
6959
7047
|
import { tmpdir as tmpdir2 } from "os";
|
|
6960
7048
|
import path26 from "path";
|
|
6961
|
-
import
|
|
7049
|
+
import chalk89 from "chalk";
|
|
6962
7050
|
function assertJbInstalled() {
|
|
6963
7051
|
try {
|
|
6964
7052
|
execSync24("jb inspectcode --version", { stdio: "pipe" });
|
|
6965
7053
|
} catch {
|
|
6966
|
-
console.error(
|
|
7054
|
+
console.error(chalk89.red("jb is not installed. Install with:"));
|
|
6967
7055
|
console.error(
|
|
6968
|
-
|
|
7056
|
+
chalk89.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
6969
7057
|
);
|
|
6970
7058
|
process.exit(1);
|
|
6971
7059
|
}
|
|
@@ -6983,11 +7071,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
6983
7071
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
6984
7072
|
process.stderr.write(err.stderr);
|
|
6985
7073
|
}
|
|
6986
|
-
console.error(
|
|
7074
|
+
console.error(chalk89.red("jb inspectcode failed"));
|
|
6987
7075
|
process.exit(1);
|
|
6988
7076
|
}
|
|
6989
7077
|
if (!existsSync27(reportPath)) {
|
|
6990
|
-
console.error(
|
|
7078
|
+
console.error(chalk89.red("Report file not generated"));
|
|
6991
7079
|
process.exit(1);
|
|
6992
7080
|
}
|
|
6993
7081
|
const xml = readFileSync24(reportPath, "utf-8");
|
|
@@ -6997,7 +7085,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
6997
7085
|
|
|
6998
7086
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
6999
7087
|
import { execSync as execSync25 } from "child_process";
|
|
7000
|
-
import
|
|
7088
|
+
import chalk90 from "chalk";
|
|
7001
7089
|
function resolveMsbuildPath() {
|
|
7002
7090
|
const config = loadConfig();
|
|
7003
7091
|
const buildConfig = config.run?.find((r) => r.name === "build");
|
|
@@ -7008,9 +7096,9 @@ function assertMsbuildInstalled() {
|
|
|
7008
7096
|
try {
|
|
7009
7097
|
execSync25(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
7010
7098
|
} catch {
|
|
7011
|
-
console.error(
|
|
7099
|
+
console.error(chalk90.red(`msbuild not found at: ${msbuild}`));
|
|
7012
7100
|
console.error(
|
|
7013
|
-
|
|
7101
|
+
chalk90.yellow(
|
|
7014
7102
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
7015
7103
|
)
|
|
7016
7104
|
);
|
|
@@ -7057,17 +7145,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
7057
7145
|
// src/commands/dotnet/inspect.ts
|
|
7058
7146
|
function logScope(changedFiles) {
|
|
7059
7147
|
if (changedFiles === null) {
|
|
7060
|
-
console.log(
|
|
7148
|
+
console.log(chalk91.dim("Inspecting full solution..."));
|
|
7061
7149
|
} else {
|
|
7062
7150
|
console.log(
|
|
7063
|
-
|
|
7151
|
+
chalk91.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
7064
7152
|
);
|
|
7065
7153
|
}
|
|
7066
7154
|
}
|
|
7067
7155
|
function reportResults(issues, elapsed) {
|
|
7068
7156
|
if (issues.length > 0) displayIssues(issues);
|
|
7069
|
-
else console.log(
|
|
7070
|
-
console.log(
|
|
7157
|
+
else console.log(chalk91.green("No issues found"));
|
|
7158
|
+
console.log(chalk91.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
7071
7159
|
if (issues.length > 0) process.exit(1);
|
|
7072
7160
|
}
|
|
7073
7161
|
async function inspect(sln, options2) {
|
|
@@ -7078,7 +7166,7 @@ async function inspect(sln, options2) {
|
|
|
7078
7166
|
const scope = parseScope(options2.scope);
|
|
7079
7167
|
const changedFiles = getChangedCsFiles(scope);
|
|
7080
7168
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
7081
|
-
console.log(
|
|
7169
|
+
console.log(chalk91.green("No changed .cs files found"));
|
|
7082
7170
|
return;
|
|
7083
7171
|
}
|
|
7084
7172
|
logScope(changedFiles);
|
|
@@ -7104,7 +7192,7 @@ function registerDotnet(program2) {
|
|
|
7104
7192
|
}
|
|
7105
7193
|
|
|
7106
7194
|
// src/commands/jira/acceptanceCriteria.ts
|
|
7107
|
-
import
|
|
7195
|
+
import chalk93 from "chalk";
|
|
7108
7196
|
|
|
7109
7197
|
// src/commands/jira/adfToText.ts
|
|
7110
7198
|
function renderInline(node) {
|
|
@@ -7165,7 +7253,7 @@ function adfToText(doc) {
|
|
|
7165
7253
|
|
|
7166
7254
|
// src/commands/jira/fetchIssue.ts
|
|
7167
7255
|
import { execSync as execSync26 } from "child_process";
|
|
7168
|
-
import
|
|
7256
|
+
import chalk92 from "chalk";
|
|
7169
7257
|
function fetchIssue(issueKey, fields) {
|
|
7170
7258
|
let result;
|
|
7171
7259
|
try {
|
|
@@ -7178,15 +7266,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
7178
7266
|
const stderr = error.stderr;
|
|
7179
7267
|
if (stderr.includes("unauthorized")) {
|
|
7180
7268
|
console.error(
|
|
7181
|
-
|
|
7269
|
+
chalk92.red("Jira authentication expired."),
|
|
7182
7270
|
"Run",
|
|
7183
|
-
|
|
7271
|
+
chalk92.cyan("assist jira auth"),
|
|
7184
7272
|
"to re-authenticate."
|
|
7185
7273
|
);
|
|
7186
7274
|
process.exit(1);
|
|
7187
7275
|
}
|
|
7188
7276
|
}
|
|
7189
|
-
console.error(
|
|
7277
|
+
console.error(chalk92.red(`Failed to fetch ${issueKey}.`));
|
|
7190
7278
|
process.exit(1);
|
|
7191
7279
|
}
|
|
7192
7280
|
return JSON.parse(result);
|
|
@@ -7200,7 +7288,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
7200
7288
|
const parsed = fetchIssue(issueKey, field);
|
|
7201
7289
|
const acValue = parsed?.fields?.[field];
|
|
7202
7290
|
if (!acValue) {
|
|
7203
|
-
console.log(
|
|
7291
|
+
console.log(chalk93.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
7204
7292
|
return;
|
|
7205
7293
|
}
|
|
7206
7294
|
if (typeof acValue === "string") {
|
|
@@ -7295,14 +7383,14 @@ async function jiraAuth() {
|
|
|
7295
7383
|
}
|
|
7296
7384
|
|
|
7297
7385
|
// src/commands/jira/viewIssue.ts
|
|
7298
|
-
import
|
|
7386
|
+
import chalk94 from "chalk";
|
|
7299
7387
|
function viewIssue(issueKey) {
|
|
7300
7388
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
7301
7389
|
const fields = parsed?.fields;
|
|
7302
7390
|
const summary = fields?.summary;
|
|
7303
7391
|
const description = fields?.description;
|
|
7304
7392
|
if (summary) {
|
|
7305
|
-
console.log(
|
|
7393
|
+
console.log(chalk94.bold(summary));
|
|
7306
7394
|
}
|
|
7307
7395
|
if (description) {
|
|
7308
7396
|
if (summary) console.log();
|
|
@@ -7316,7 +7404,7 @@ function viewIssue(issueKey) {
|
|
|
7316
7404
|
}
|
|
7317
7405
|
if (!summary && !description) {
|
|
7318
7406
|
console.log(
|
|
7319
|
-
|
|
7407
|
+
chalk94.yellow(`No summary or description found on ${issueKey}.`)
|
|
7320
7408
|
);
|
|
7321
7409
|
}
|
|
7322
7410
|
}
|
|
@@ -7330,7 +7418,7 @@ function registerJira(program2) {
|
|
|
7330
7418
|
}
|
|
7331
7419
|
|
|
7332
7420
|
// src/commands/news/add/index.ts
|
|
7333
|
-
import
|
|
7421
|
+
import chalk95 from "chalk";
|
|
7334
7422
|
import enquirer8 from "enquirer";
|
|
7335
7423
|
async function add2(url) {
|
|
7336
7424
|
if (!url) {
|
|
@@ -7353,17 +7441,17 @@ async function add2(url) {
|
|
|
7353
7441
|
const news = config.news ?? {};
|
|
7354
7442
|
const feeds = news.feeds ?? [];
|
|
7355
7443
|
if (feeds.includes(url)) {
|
|
7356
|
-
console.log(
|
|
7444
|
+
console.log(chalk95.yellow("Feed already exists in config"));
|
|
7357
7445
|
return;
|
|
7358
7446
|
}
|
|
7359
7447
|
feeds.push(url);
|
|
7360
7448
|
config.news = { ...news, feeds };
|
|
7361
7449
|
saveGlobalConfig(config);
|
|
7362
|
-
console.log(
|
|
7450
|
+
console.log(chalk95.green(`Added feed: ${url}`));
|
|
7363
7451
|
}
|
|
7364
7452
|
|
|
7365
7453
|
// src/commands/news/web/handleRequest.ts
|
|
7366
|
-
import
|
|
7454
|
+
import chalk96 from "chalk";
|
|
7367
7455
|
|
|
7368
7456
|
// src/commands/news/web/shared.ts
|
|
7369
7457
|
import { decodeHTML } from "entities";
|
|
@@ -7499,17 +7587,17 @@ function prefetch() {
|
|
|
7499
7587
|
const config = loadConfig();
|
|
7500
7588
|
const total = config.news.feeds.length;
|
|
7501
7589
|
if (total === 0) return;
|
|
7502
|
-
process.stdout.write(
|
|
7590
|
+
process.stdout.write(chalk96.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
7503
7591
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
7504
7592
|
const width = 20;
|
|
7505
7593
|
const filled = Math.round(done2 / t * width);
|
|
7506
7594
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
7507
7595
|
process.stdout.write(
|
|
7508
|
-
`\r${
|
|
7596
|
+
`\r${chalk96.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
7509
7597
|
);
|
|
7510
7598
|
}).then((items) => {
|
|
7511
7599
|
process.stdout.write(
|
|
7512
|
-
`\r${
|
|
7600
|
+
`\r${chalk96.green(`Fetched ${items.length} items from ${total} feed(s)`)}
|
|
7513
7601
|
`
|
|
7514
7602
|
);
|
|
7515
7603
|
cachedItems = items;
|
|
@@ -7870,20 +7958,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
7870
7958
|
}
|
|
7871
7959
|
|
|
7872
7960
|
// src/commands/prs/listComments/printComments.ts
|
|
7873
|
-
import
|
|
7961
|
+
import chalk97 from "chalk";
|
|
7874
7962
|
function formatForHuman(comment3) {
|
|
7875
7963
|
if (comment3.type === "review") {
|
|
7876
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
7964
|
+
const stateColor = comment3.state === "APPROVED" ? chalk97.green : comment3.state === "CHANGES_REQUESTED" ? chalk97.red : chalk97.yellow;
|
|
7877
7965
|
return [
|
|
7878
|
-
`${
|
|
7966
|
+
`${chalk97.cyan("Review")} by ${chalk97.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
7879
7967
|
comment3.body,
|
|
7880
7968
|
""
|
|
7881
7969
|
].join("\n");
|
|
7882
7970
|
}
|
|
7883
7971
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
7884
7972
|
return [
|
|
7885
|
-
`${
|
|
7886
|
-
|
|
7973
|
+
`${chalk97.cyan("Line comment")} by ${chalk97.bold(comment3.user)} on ${chalk97.dim(`${comment3.path}${location}`)}`,
|
|
7974
|
+
chalk97.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
7887
7975
|
comment3.body,
|
|
7888
7976
|
""
|
|
7889
7977
|
].join("\n");
|
|
@@ -7973,13 +8061,13 @@ import { execSync as execSync33 } from "child_process";
|
|
|
7973
8061
|
import enquirer9 from "enquirer";
|
|
7974
8062
|
|
|
7975
8063
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
7976
|
-
import
|
|
8064
|
+
import chalk98 from "chalk";
|
|
7977
8065
|
var STATUS_MAP = {
|
|
7978
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
7979
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
8066
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk98.magenta("merged"), date: pr.mergedAt } : null,
|
|
8067
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk98.red("closed"), date: pr.closedAt } : null
|
|
7980
8068
|
};
|
|
7981
8069
|
function defaultStatus(pr) {
|
|
7982
|
-
return { label:
|
|
8070
|
+
return { label: chalk98.green("opened"), date: pr.createdAt };
|
|
7983
8071
|
}
|
|
7984
8072
|
function getStatus2(pr) {
|
|
7985
8073
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -7988,11 +8076,11 @@ function formatDate(dateStr) {
|
|
|
7988
8076
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
7989
8077
|
}
|
|
7990
8078
|
function formatPrHeader(pr, status2) {
|
|
7991
|
-
return `${
|
|
8079
|
+
return `${chalk98.cyan(`#${pr.number}`)} ${pr.title} ${chalk98.dim(`(${pr.author.login},`)} ${status2.label} ${chalk98.dim(`${formatDate(status2.date)})`)}`;
|
|
7992
8080
|
}
|
|
7993
8081
|
function logPrDetails(pr) {
|
|
7994
8082
|
console.log(
|
|
7995
|
-
|
|
8083
|
+
chalk98.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
7996
8084
|
);
|
|
7997
8085
|
console.log();
|
|
7998
8086
|
}
|
|
@@ -8158,10 +8246,10 @@ function registerPrs(program2) {
|
|
|
8158
8246
|
}
|
|
8159
8247
|
|
|
8160
8248
|
// src/commands/ravendb/ravendbAuth.ts
|
|
8161
|
-
import
|
|
8249
|
+
import chalk104 from "chalk";
|
|
8162
8250
|
|
|
8163
8251
|
// src/shared/createConnectionAuth.ts
|
|
8164
|
-
import
|
|
8252
|
+
import chalk99 from "chalk";
|
|
8165
8253
|
function listConnections(connections, format2) {
|
|
8166
8254
|
if (connections.length === 0) {
|
|
8167
8255
|
console.log("No connections configured.");
|
|
@@ -8174,7 +8262,7 @@ function listConnections(connections, format2) {
|
|
|
8174
8262
|
function removeConnection(connections, name, save) {
|
|
8175
8263
|
const filtered = connections.filter((c) => c.name !== name);
|
|
8176
8264
|
if (filtered.length === connections.length) {
|
|
8177
|
-
console.error(
|
|
8265
|
+
console.error(chalk99.red(`Connection "${name}" not found.`));
|
|
8178
8266
|
process.exit(1);
|
|
8179
8267
|
}
|
|
8180
8268
|
save(filtered);
|
|
@@ -8220,15 +8308,15 @@ function saveConnections(connections) {
|
|
|
8220
8308
|
}
|
|
8221
8309
|
|
|
8222
8310
|
// src/commands/ravendb/promptConnection.ts
|
|
8223
|
-
import
|
|
8311
|
+
import chalk102 from "chalk";
|
|
8224
8312
|
|
|
8225
8313
|
// src/commands/ravendb/selectOpSecret.ts
|
|
8226
|
-
import
|
|
8314
|
+
import chalk101 from "chalk";
|
|
8227
8315
|
import Enquirer2 from "enquirer";
|
|
8228
8316
|
|
|
8229
8317
|
// src/commands/ravendb/searchItems.ts
|
|
8230
8318
|
import { execSync as execSync35 } from "child_process";
|
|
8231
|
-
import
|
|
8319
|
+
import chalk100 from "chalk";
|
|
8232
8320
|
function opExec(args) {
|
|
8233
8321
|
return execSync35(`op ${args}`, {
|
|
8234
8322
|
encoding: "utf-8",
|
|
@@ -8241,7 +8329,7 @@ function searchItems(search2) {
|
|
|
8241
8329
|
items = JSON.parse(opExec("item list --format=json"));
|
|
8242
8330
|
} catch {
|
|
8243
8331
|
console.error(
|
|
8244
|
-
|
|
8332
|
+
chalk100.red(
|
|
8245
8333
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
8246
8334
|
)
|
|
8247
8335
|
);
|
|
@@ -8255,7 +8343,7 @@ function getItemFields(itemId) {
|
|
|
8255
8343
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
8256
8344
|
return item.fields.filter((f) => f.reference && f.label);
|
|
8257
8345
|
} catch {
|
|
8258
|
-
console.error(
|
|
8346
|
+
console.error(chalk100.red("Failed to get item details from 1Password."));
|
|
8259
8347
|
process.exit(1);
|
|
8260
8348
|
}
|
|
8261
8349
|
}
|
|
@@ -8274,7 +8362,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
8274
8362
|
}).run();
|
|
8275
8363
|
const items = searchItems(search2);
|
|
8276
8364
|
if (items.length === 0) {
|
|
8277
|
-
console.error(
|
|
8365
|
+
console.error(chalk101.red(`No items found matching "${search2}".`));
|
|
8278
8366
|
process.exit(1);
|
|
8279
8367
|
}
|
|
8280
8368
|
const itemId = await selectOne(
|
|
@@ -8283,7 +8371,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
8283
8371
|
);
|
|
8284
8372
|
const fields = getItemFields(itemId);
|
|
8285
8373
|
if (fields.length === 0) {
|
|
8286
|
-
console.error(
|
|
8374
|
+
console.error(chalk101.red("No fields with references found on this item."));
|
|
8287
8375
|
process.exit(1);
|
|
8288
8376
|
}
|
|
8289
8377
|
const ref = await selectOne(
|
|
@@ -8297,7 +8385,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
8297
8385
|
async function promptConnection(existingNames) {
|
|
8298
8386
|
const name = await promptInput("name", "Connection name:");
|
|
8299
8387
|
if (existingNames.includes(name)) {
|
|
8300
|
-
console.error(
|
|
8388
|
+
console.error(chalk102.red(`Connection "${name}" already exists.`));
|
|
8301
8389
|
process.exit(1);
|
|
8302
8390
|
}
|
|
8303
8391
|
const url = await promptInput(
|
|
@@ -8306,22 +8394,22 @@ async function promptConnection(existingNames) {
|
|
|
8306
8394
|
);
|
|
8307
8395
|
const database = await promptInput("database", "Database name:");
|
|
8308
8396
|
if (!name || !url || !database) {
|
|
8309
|
-
console.error(
|
|
8397
|
+
console.error(chalk102.red("All fields are required."));
|
|
8310
8398
|
process.exit(1);
|
|
8311
8399
|
}
|
|
8312
8400
|
const apiKeyRef = await selectOpSecret();
|
|
8313
|
-
console.log(
|
|
8401
|
+
console.log(chalk102.dim(`Using: ${apiKeyRef}`));
|
|
8314
8402
|
return { name, url, database, apiKeyRef };
|
|
8315
8403
|
}
|
|
8316
8404
|
|
|
8317
8405
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
8318
|
-
import
|
|
8406
|
+
import chalk103 from "chalk";
|
|
8319
8407
|
function ravendbSetConnection(name) {
|
|
8320
8408
|
const raw = loadGlobalConfigRaw();
|
|
8321
8409
|
const ravendb = raw.ravendb ?? {};
|
|
8322
8410
|
const connections = ravendb.connections ?? [];
|
|
8323
8411
|
if (!connections.some((c) => c.name === name)) {
|
|
8324
|
-
console.error(
|
|
8412
|
+
console.error(chalk103.red(`Connection "${name}" not found.`));
|
|
8325
8413
|
console.error(
|
|
8326
8414
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
8327
8415
|
);
|
|
@@ -8337,16 +8425,16 @@ function ravendbSetConnection(name) {
|
|
|
8337
8425
|
var ravendbAuth = createConnectionAuth({
|
|
8338
8426
|
load: loadConnections,
|
|
8339
8427
|
save: saveConnections,
|
|
8340
|
-
format: (c) => `${
|
|
8428
|
+
format: (c) => `${chalk104.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
8341
8429
|
promptNew: promptConnection,
|
|
8342
8430
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
8343
8431
|
});
|
|
8344
8432
|
|
|
8345
8433
|
// src/commands/ravendb/ravendbCollections.ts
|
|
8346
|
-
import
|
|
8434
|
+
import chalk108 from "chalk";
|
|
8347
8435
|
|
|
8348
8436
|
// src/commands/ravendb/ravenFetch.ts
|
|
8349
|
-
import
|
|
8437
|
+
import chalk106 from "chalk";
|
|
8350
8438
|
|
|
8351
8439
|
// src/commands/ravendb/getAccessToken.ts
|
|
8352
8440
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -8383,10 +8471,10 @@ ${errorText}`
|
|
|
8383
8471
|
|
|
8384
8472
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
8385
8473
|
import { execSync as execSync36 } from "child_process";
|
|
8386
|
-
import
|
|
8474
|
+
import chalk105 from "chalk";
|
|
8387
8475
|
function resolveOpSecret(reference) {
|
|
8388
8476
|
if (!reference.startsWith("op://")) {
|
|
8389
|
-
console.error(
|
|
8477
|
+
console.error(chalk105.red(`Invalid secret reference: must start with op://`));
|
|
8390
8478
|
process.exit(1);
|
|
8391
8479
|
}
|
|
8392
8480
|
try {
|
|
@@ -8396,7 +8484,7 @@ function resolveOpSecret(reference) {
|
|
|
8396
8484
|
}).trim();
|
|
8397
8485
|
} catch {
|
|
8398
8486
|
console.error(
|
|
8399
|
-
|
|
8487
|
+
chalk105.red(
|
|
8400
8488
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
8401
8489
|
)
|
|
8402
8490
|
);
|
|
@@ -8423,7 +8511,7 @@ async function ravenFetch(connection, path50) {
|
|
|
8423
8511
|
if (!response.ok) {
|
|
8424
8512
|
const body = await response.text();
|
|
8425
8513
|
console.error(
|
|
8426
|
-
|
|
8514
|
+
chalk106.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
8427
8515
|
);
|
|
8428
8516
|
console.error(body.substring(0, 500));
|
|
8429
8517
|
process.exit(1);
|
|
@@ -8432,7 +8520,7 @@ async function ravenFetch(connection, path50) {
|
|
|
8432
8520
|
}
|
|
8433
8521
|
|
|
8434
8522
|
// src/commands/ravendb/resolveConnection.ts
|
|
8435
|
-
import
|
|
8523
|
+
import chalk107 from "chalk";
|
|
8436
8524
|
function loadRavendb() {
|
|
8437
8525
|
const raw = loadGlobalConfigRaw();
|
|
8438
8526
|
const ravendb = raw.ravendb;
|
|
@@ -8446,7 +8534,7 @@ function resolveConnection(name) {
|
|
|
8446
8534
|
const connectionName = name ?? defaultConnection;
|
|
8447
8535
|
if (!connectionName) {
|
|
8448
8536
|
console.error(
|
|
8449
|
-
|
|
8537
|
+
chalk107.red(
|
|
8450
8538
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
8451
8539
|
)
|
|
8452
8540
|
);
|
|
@@ -8454,7 +8542,7 @@ function resolveConnection(name) {
|
|
|
8454
8542
|
}
|
|
8455
8543
|
const connection = connections.find((c) => c.name === connectionName);
|
|
8456
8544
|
if (!connection) {
|
|
8457
|
-
console.error(
|
|
8545
|
+
console.error(chalk107.red(`Connection "${connectionName}" not found.`));
|
|
8458
8546
|
console.error(
|
|
8459
8547
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
8460
8548
|
);
|
|
@@ -8485,15 +8573,15 @@ async function ravendbCollections(connectionName) {
|
|
|
8485
8573
|
return;
|
|
8486
8574
|
}
|
|
8487
8575
|
for (const c of collections) {
|
|
8488
|
-
console.log(`${
|
|
8576
|
+
console.log(`${chalk108.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
8489
8577
|
}
|
|
8490
8578
|
}
|
|
8491
8579
|
|
|
8492
8580
|
// src/commands/ravendb/ravendbQuery.ts
|
|
8493
|
-
import
|
|
8581
|
+
import chalk110 from "chalk";
|
|
8494
8582
|
|
|
8495
8583
|
// src/commands/ravendb/fetchAllPages.ts
|
|
8496
|
-
import
|
|
8584
|
+
import chalk109 from "chalk";
|
|
8497
8585
|
|
|
8498
8586
|
// src/commands/ravendb/buildQueryPath.ts
|
|
8499
8587
|
function buildQueryPath(opts) {
|
|
@@ -8531,7 +8619,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
8531
8619
|
allResults.push(...results);
|
|
8532
8620
|
start3 += results.length;
|
|
8533
8621
|
process.stderr.write(
|
|
8534
|
-
`\r${
|
|
8622
|
+
`\r${chalk109.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
8535
8623
|
);
|
|
8536
8624
|
if (start3 >= totalResults) break;
|
|
8537
8625
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -8546,7 +8634,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
8546
8634
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
8547
8635
|
const resolved = resolveArgs(connectionName, collection);
|
|
8548
8636
|
if (!resolved.collection && !options2.query) {
|
|
8549
|
-
console.error(
|
|
8637
|
+
console.error(chalk110.red("Provide a collection name or --query filter."));
|
|
8550
8638
|
process.exit(1);
|
|
8551
8639
|
}
|
|
8552
8640
|
const { collection: col } = resolved;
|
|
@@ -8584,7 +8672,7 @@ import { spawn as spawn4 } from "child_process";
|
|
|
8584
8672
|
import * as path27 from "path";
|
|
8585
8673
|
|
|
8586
8674
|
// src/commands/refactor/logViolations.ts
|
|
8587
|
-
import
|
|
8675
|
+
import chalk111 from "chalk";
|
|
8588
8676
|
var DEFAULT_MAX_LINES = 100;
|
|
8589
8677
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
8590
8678
|
if (violations.length === 0) {
|
|
@@ -8593,43 +8681,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
8593
8681
|
}
|
|
8594
8682
|
return;
|
|
8595
8683
|
}
|
|
8596
|
-
console.error(
|
|
8684
|
+
console.error(chalk111.red(`
|
|
8597
8685
|
Refactor check failed:
|
|
8598
8686
|
`));
|
|
8599
|
-
console.error(
|
|
8687
|
+
console.error(chalk111.red(` The following files exceed ${maxLines} lines:
|
|
8600
8688
|
`));
|
|
8601
8689
|
for (const violation of violations) {
|
|
8602
|
-
console.error(
|
|
8690
|
+
console.error(chalk111.red(` ${violation.file} (${violation.lines} lines)`));
|
|
8603
8691
|
}
|
|
8604
8692
|
console.error(
|
|
8605
|
-
|
|
8693
|
+
chalk111.yellow(
|
|
8606
8694
|
`
|
|
8607
8695
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
8608
8696
|
way to refactor it, ignore it with:
|
|
8609
8697
|
`
|
|
8610
8698
|
)
|
|
8611
8699
|
);
|
|
8612
|
-
console.error(
|
|
8700
|
+
console.error(chalk111.gray(` assist refactor ignore <file>
|
|
8613
8701
|
`));
|
|
8614
8702
|
if (process.env.CLAUDECODE) {
|
|
8615
|
-
console.error(
|
|
8703
|
+
console.error(chalk111.cyan(`
|
|
8616
8704
|
## Extracting Code to New Files
|
|
8617
8705
|
`));
|
|
8618
8706
|
console.error(
|
|
8619
|
-
|
|
8707
|
+
chalk111.cyan(
|
|
8620
8708
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
8621
8709
|
`
|
|
8622
8710
|
)
|
|
8623
8711
|
);
|
|
8624
8712
|
console.error(
|
|
8625
|
-
|
|
8713
|
+
chalk111.cyan(
|
|
8626
8714
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
8627
8715
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
8628
8716
|
`
|
|
8629
8717
|
)
|
|
8630
8718
|
);
|
|
8631
8719
|
console.error(
|
|
8632
|
-
|
|
8720
|
+
chalk111.cyan(
|
|
8633
8721
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
8634
8722
|
domains, move it to a common/shared folder.
|
|
8635
8723
|
`
|
|
@@ -8785,7 +8873,7 @@ async function check(pattern2, options2) {
|
|
|
8785
8873
|
|
|
8786
8874
|
// src/commands/refactor/extract/index.ts
|
|
8787
8875
|
import path33 from "path";
|
|
8788
|
-
import
|
|
8876
|
+
import chalk114 from "chalk";
|
|
8789
8877
|
|
|
8790
8878
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
8791
8879
|
import { SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
@@ -9332,23 +9420,23 @@ function buildPlan(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
9332
9420
|
|
|
9333
9421
|
// src/commands/refactor/extract/displayPlan.ts
|
|
9334
9422
|
import path31 from "path";
|
|
9335
|
-
import
|
|
9423
|
+
import chalk112 from "chalk";
|
|
9336
9424
|
function section(title) {
|
|
9337
9425
|
return `
|
|
9338
|
-
${
|
|
9426
|
+
${chalk112.cyan(title)}`;
|
|
9339
9427
|
}
|
|
9340
9428
|
function displayImporters(plan2, cwd) {
|
|
9341
9429
|
if (plan2.importersToUpdate.length === 0) return;
|
|
9342
9430
|
console.log(section("Update importers:"));
|
|
9343
9431
|
for (const imp of plan2.importersToUpdate) {
|
|
9344
9432
|
const rel = path31.relative(cwd, imp.file.getFilePath());
|
|
9345
|
-
console.log(` ${
|
|
9433
|
+
console.log(` ${chalk112.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
9346
9434
|
}
|
|
9347
9435
|
}
|
|
9348
9436
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
9349
|
-
console.log(
|
|
9437
|
+
console.log(chalk112.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
9350
9438
|
`));
|
|
9351
|
-
console.log(` ${
|
|
9439
|
+
console.log(` ${chalk112.cyan("Functions to move:")}`);
|
|
9352
9440
|
for (const name of plan2.extractedNames) {
|
|
9353
9441
|
console.log(` ${name}`);
|
|
9354
9442
|
}
|
|
@@ -9383,7 +9471,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
9383
9471
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
9384
9472
|
import fs17 from "fs";
|
|
9385
9473
|
import path32 from "path";
|
|
9386
|
-
import
|
|
9474
|
+
import chalk113 from "chalk";
|
|
9387
9475
|
import { Project as Project2 } from "ts-morph";
|
|
9388
9476
|
function findTsConfig(sourcePath) {
|
|
9389
9477
|
const rootConfig = path32.resolve("tsconfig.json");
|
|
@@ -9414,7 +9502,7 @@ function loadProjectFile(file) {
|
|
|
9414
9502
|
});
|
|
9415
9503
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
9416
9504
|
if (!sourceFile) {
|
|
9417
|
-
console.log(
|
|
9505
|
+
console.log(chalk113.red(`File not found in project: ${file}`));
|
|
9418
9506
|
process.exit(1);
|
|
9419
9507
|
}
|
|
9420
9508
|
return { project, sourceFile };
|
|
@@ -9437,19 +9525,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
9437
9525
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
9438
9526
|
if (options2.apply) {
|
|
9439
9527
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
9440
|
-
console.log(
|
|
9528
|
+
console.log(chalk114.green("\nExtraction complete"));
|
|
9441
9529
|
} else {
|
|
9442
|
-
console.log(
|
|
9530
|
+
console.log(chalk114.dim("\nDry run. Use --apply to execute."));
|
|
9443
9531
|
}
|
|
9444
9532
|
}
|
|
9445
9533
|
|
|
9446
9534
|
// src/commands/refactor/ignore.ts
|
|
9447
9535
|
import fs18 from "fs";
|
|
9448
|
-
import
|
|
9536
|
+
import chalk115 from "chalk";
|
|
9449
9537
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
9450
9538
|
function ignore(file) {
|
|
9451
9539
|
if (!fs18.existsSync(file)) {
|
|
9452
|
-
console.error(
|
|
9540
|
+
console.error(chalk115.red(`Error: File does not exist: ${file}`));
|
|
9453
9541
|
process.exit(1);
|
|
9454
9542
|
}
|
|
9455
9543
|
const content = fs18.readFileSync(file, "utf-8");
|
|
@@ -9465,7 +9553,7 @@ function ignore(file) {
|
|
|
9465
9553
|
fs18.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
9466
9554
|
}
|
|
9467
9555
|
console.log(
|
|
9468
|
-
|
|
9556
|
+
chalk115.green(
|
|
9469
9557
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
9470
9558
|
)
|
|
9471
9559
|
);
|
|
@@ -9473,26 +9561,26 @@ function ignore(file) {
|
|
|
9473
9561
|
|
|
9474
9562
|
// src/commands/refactor/rename/index.ts
|
|
9475
9563
|
import path34 from "path";
|
|
9476
|
-
import
|
|
9564
|
+
import chalk116 from "chalk";
|
|
9477
9565
|
async function rename(source, destination, options2 = {}) {
|
|
9478
9566
|
const destPath = path34.resolve(destination);
|
|
9479
9567
|
const cwd = process.cwd();
|
|
9480
9568
|
const relSource = path34.relative(cwd, path34.resolve(source));
|
|
9481
9569
|
const relDest = path34.relative(cwd, destPath);
|
|
9482
9570
|
const { project, sourceFile } = loadProjectFile(source);
|
|
9483
|
-
console.log(
|
|
9571
|
+
console.log(chalk116.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
9484
9572
|
if (options2.apply) {
|
|
9485
9573
|
sourceFile.move(destPath);
|
|
9486
9574
|
await project.save();
|
|
9487
|
-
console.log(
|
|
9575
|
+
console.log(chalk116.green("Done"));
|
|
9488
9576
|
} else {
|
|
9489
|
-
console.log(
|
|
9577
|
+
console.log(chalk116.dim("Dry run. Use --apply to execute."));
|
|
9490
9578
|
}
|
|
9491
9579
|
}
|
|
9492
9580
|
|
|
9493
9581
|
// src/commands/refactor/renameSymbol/index.ts
|
|
9494
9582
|
import path36 from "path";
|
|
9495
|
-
import
|
|
9583
|
+
import chalk117 from "chalk";
|
|
9496
9584
|
import { Project as Project3 } from "ts-morph";
|
|
9497
9585
|
|
|
9498
9586
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
@@ -9541,38 +9629,38 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
9541
9629
|
const project = new Project3({ tsConfigFilePath: tsConfigPath });
|
|
9542
9630
|
const sourceFile = project.getSourceFile(filePath);
|
|
9543
9631
|
if (!sourceFile) {
|
|
9544
|
-
console.log(
|
|
9632
|
+
console.log(chalk117.red(`File not found in project: ${file}`));
|
|
9545
9633
|
process.exit(1);
|
|
9546
9634
|
}
|
|
9547
9635
|
const symbol = findSymbol(sourceFile, oldName);
|
|
9548
9636
|
if (!symbol) {
|
|
9549
|
-
console.log(
|
|
9637
|
+
console.log(chalk117.red(`Symbol "${oldName}" not found in ${file}`));
|
|
9550
9638
|
process.exit(1);
|
|
9551
9639
|
}
|
|
9552
9640
|
const grouped = groupReferences(symbol, cwd);
|
|
9553
9641
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
9554
9642
|
console.log(
|
|
9555
|
-
|
|
9643
|
+
chalk117.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
9556
9644
|
`)
|
|
9557
9645
|
);
|
|
9558
9646
|
for (const [refFile, lines] of grouped) {
|
|
9559
9647
|
console.log(
|
|
9560
|
-
` ${
|
|
9648
|
+
` ${chalk117.dim(refFile)}: lines ${chalk117.cyan(lines.join(", "))}`
|
|
9561
9649
|
);
|
|
9562
9650
|
}
|
|
9563
9651
|
if (options2.apply) {
|
|
9564
9652
|
symbol.rename(newName);
|
|
9565
9653
|
await project.save();
|
|
9566
|
-
console.log(
|
|
9654
|
+
console.log(chalk117.green(`
|
|
9567
9655
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
9568
9656
|
} else {
|
|
9569
|
-
console.log(
|
|
9657
|
+
console.log(chalk117.dim("\nDry run. Use --apply to execute."));
|
|
9570
9658
|
}
|
|
9571
9659
|
}
|
|
9572
9660
|
|
|
9573
9661
|
// src/commands/refactor/restructure/index.ts
|
|
9574
9662
|
import path45 from "path";
|
|
9575
|
-
import
|
|
9663
|
+
import chalk120 from "chalk";
|
|
9576
9664
|
|
|
9577
9665
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
9578
9666
|
import path37 from "path";
|
|
@@ -9815,50 +9903,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
9815
9903
|
|
|
9816
9904
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
9817
9905
|
import path41 from "path";
|
|
9818
|
-
import
|
|
9906
|
+
import chalk118 from "chalk";
|
|
9819
9907
|
function relPath(filePath) {
|
|
9820
9908
|
return path41.relative(process.cwd(), filePath);
|
|
9821
9909
|
}
|
|
9822
9910
|
function displayMoves(plan2) {
|
|
9823
9911
|
if (plan2.moves.length === 0) return;
|
|
9824
|
-
console.log(
|
|
9912
|
+
console.log(chalk118.bold("\nFile moves:"));
|
|
9825
9913
|
for (const move of plan2.moves) {
|
|
9826
9914
|
console.log(
|
|
9827
|
-
` ${
|
|
9915
|
+
` ${chalk118.red(relPath(move.from))} \u2192 ${chalk118.green(relPath(move.to))}`
|
|
9828
9916
|
);
|
|
9829
|
-
console.log(
|
|
9917
|
+
console.log(chalk118.dim(` ${move.reason}`));
|
|
9830
9918
|
}
|
|
9831
9919
|
}
|
|
9832
9920
|
function displayRewrites(rewrites) {
|
|
9833
9921
|
if (rewrites.length === 0) return;
|
|
9834
9922
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
9835
|
-
console.log(
|
|
9923
|
+
console.log(chalk118.bold(`
|
|
9836
9924
|
Import rewrites (${affectedFiles.size} files):`));
|
|
9837
9925
|
for (const file of affectedFiles) {
|
|
9838
|
-
console.log(` ${
|
|
9926
|
+
console.log(` ${chalk118.cyan(relPath(file))}:`);
|
|
9839
9927
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
9840
9928
|
(r) => r.file === file
|
|
9841
9929
|
)) {
|
|
9842
9930
|
console.log(
|
|
9843
|
-
` ${
|
|
9931
|
+
` ${chalk118.red(`"${oldSpecifier}"`)} \u2192 ${chalk118.green(`"${newSpecifier}"`)}`
|
|
9844
9932
|
);
|
|
9845
9933
|
}
|
|
9846
9934
|
}
|
|
9847
9935
|
}
|
|
9848
9936
|
function displayPlan2(plan2) {
|
|
9849
9937
|
if (plan2.warnings.length > 0) {
|
|
9850
|
-
console.log(
|
|
9851
|
-
for (const w of plan2.warnings) console.log(
|
|
9938
|
+
console.log(chalk118.yellow("\nWarnings:"));
|
|
9939
|
+
for (const w of plan2.warnings) console.log(chalk118.yellow(` ${w}`));
|
|
9852
9940
|
}
|
|
9853
9941
|
if (plan2.newDirectories.length > 0) {
|
|
9854
|
-
console.log(
|
|
9942
|
+
console.log(chalk118.bold("\nNew directories:"));
|
|
9855
9943
|
for (const dir of plan2.newDirectories)
|
|
9856
|
-
console.log(
|
|
9944
|
+
console.log(chalk118.green(` ${dir}/`));
|
|
9857
9945
|
}
|
|
9858
9946
|
displayMoves(plan2);
|
|
9859
9947
|
displayRewrites(plan2.rewrites);
|
|
9860
9948
|
console.log(
|
|
9861
|
-
|
|
9949
|
+
chalk118.dim(
|
|
9862
9950
|
`
|
|
9863
9951
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
9864
9952
|
)
|
|
@@ -9868,18 +9956,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
9868
9956
|
// src/commands/refactor/restructure/executePlan.ts
|
|
9869
9957
|
import fs20 from "fs";
|
|
9870
9958
|
import path42 from "path";
|
|
9871
|
-
import
|
|
9959
|
+
import chalk119 from "chalk";
|
|
9872
9960
|
function executePlan(plan2) {
|
|
9873
9961
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
9874
9962
|
for (const [file, content] of updatedContents) {
|
|
9875
9963
|
fs20.writeFileSync(file, content, "utf-8");
|
|
9876
9964
|
console.log(
|
|
9877
|
-
|
|
9965
|
+
chalk119.cyan(` Rewrote imports in ${path42.relative(process.cwd(), file)}`)
|
|
9878
9966
|
);
|
|
9879
9967
|
}
|
|
9880
9968
|
for (const dir of plan2.newDirectories) {
|
|
9881
9969
|
fs20.mkdirSync(dir, { recursive: true });
|
|
9882
|
-
console.log(
|
|
9970
|
+
console.log(chalk119.green(` Created ${path42.relative(process.cwd(), dir)}/`));
|
|
9883
9971
|
}
|
|
9884
9972
|
for (const move of plan2.moves) {
|
|
9885
9973
|
const targetDir = path42.dirname(move.to);
|
|
@@ -9888,7 +9976,7 @@ function executePlan(plan2) {
|
|
|
9888
9976
|
}
|
|
9889
9977
|
fs20.renameSync(move.from, move.to);
|
|
9890
9978
|
console.log(
|
|
9891
|
-
|
|
9979
|
+
chalk119.white(
|
|
9892
9980
|
` Moved ${path42.relative(process.cwd(), move.from)} \u2192 ${path42.relative(process.cwd(), move.to)}`
|
|
9893
9981
|
)
|
|
9894
9982
|
);
|
|
@@ -9903,7 +9991,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
9903
9991
|
if (entries.length === 0) {
|
|
9904
9992
|
fs20.rmdirSync(dir);
|
|
9905
9993
|
console.log(
|
|
9906
|
-
|
|
9994
|
+
chalk119.dim(
|
|
9907
9995
|
` Removed empty directory ${path42.relative(process.cwd(), dir)}`
|
|
9908
9996
|
)
|
|
9909
9997
|
);
|
|
@@ -10036,22 +10124,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
10036
10124
|
const targetPattern = pattern2 ?? "src";
|
|
10037
10125
|
const files = findSourceFiles2(targetPattern);
|
|
10038
10126
|
if (files.length === 0) {
|
|
10039
|
-
console.log(
|
|
10127
|
+
console.log(chalk120.yellow("No files found matching pattern"));
|
|
10040
10128
|
return;
|
|
10041
10129
|
}
|
|
10042
10130
|
const tsConfigPath = path45.resolve("tsconfig.json");
|
|
10043
10131
|
const plan2 = buildPlan2(files, tsConfigPath);
|
|
10044
10132
|
if (plan2.moves.length === 0) {
|
|
10045
|
-
console.log(
|
|
10133
|
+
console.log(chalk120.green("No restructuring needed"));
|
|
10046
10134
|
return;
|
|
10047
10135
|
}
|
|
10048
10136
|
displayPlan2(plan2);
|
|
10049
10137
|
if (options2.apply) {
|
|
10050
|
-
console.log(
|
|
10138
|
+
console.log(chalk120.bold("\nApplying changes..."));
|
|
10051
10139
|
executePlan(plan2);
|
|
10052
|
-
console.log(
|
|
10140
|
+
console.log(chalk120.green("\nRestructuring complete"));
|
|
10053
10141
|
} else {
|
|
10054
|
-
console.log(
|
|
10142
|
+
console.log(chalk120.dim("\nDry run. Use --apply to execute."));
|
|
10055
10143
|
}
|
|
10056
10144
|
}
|
|
10057
10145
|
|
|
@@ -10091,7 +10179,7 @@ function registerRefactor(program2) {
|
|
|
10091
10179
|
}
|
|
10092
10180
|
|
|
10093
10181
|
// src/commands/seq/seqAuth.ts
|
|
10094
|
-
import
|
|
10182
|
+
import chalk122 from "chalk";
|
|
10095
10183
|
|
|
10096
10184
|
// src/commands/seq/loadConnections.ts
|
|
10097
10185
|
function loadConnections2() {
|
|
@@ -10120,11 +10208,11 @@ function setDefaultConnection(name) {
|
|
|
10120
10208
|
}
|
|
10121
10209
|
|
|
10122
10210
|
// src/commands/seq/promptConnection.ts
|
|
10123
|
-
import
|
|
10211
|
+
import chalk121 from "chalk";
|
|
10124
10212
|
async function promptConnection2(existingNames) {
|
|
10125
10213
|
const name = await promptInput("name", "Connection name:", "default");
|
|
10126
10214
|
if (existingNames.includes(name)) {
|
|
10127
|
-
console.error(
|
|
10215
|
+
console.error(chalk121.red(`Connection "${name}" already exists.`));
|
|
10128
10216
|
process.exit(1);
|
|
10129
10217
|
}
|
|
10130
10218
|
const url = await promptInput("url", "Seq URL:", "http://localhost:5341");
|
|
@@ -10136,16 +10224,16 @@ async function promptConnection2(existingNames) {
|
|
|
10136
10224
|
var seqAuth = createConnectionAuth({
|
|
10137
10225
|
load: loadConnections2,
|
|
10138
10226
|
save: saveConnections2,
|
|
10139
|
-
format: (c) => `${
|
|
10227
|
+
format: (c) => `${chalk122.bold(c.name)} ${c.url}`,
|
|
10140
10228
|
promptNew: promptConnection2,
|
|
10141
10229
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
10142
10230
|
});
|
|
10143
10231
|
|
|
10144
10232
|
// src/commands/seq/seqQuery.ts
|
|
10145
|
-
import
|
|
10233
|
+
import chalk126 from "chalk";
|
|
10146
10234
|
|
|
10147
10235
|
// src/commands/seq/fetchSeq.ts
|
|
10148
|
-
import
|
|
10236
|
+
import chalk123 from "chalk";
|
|
10149
10237
|
async function fetchSeq(conn, path50, params) {
|
|
10150
10238
|
const url = `${conn.url}${path50}?${params}`;
|
|
10151
10239
|
const response = await fetch(url, {
|
|
@@ -10156,7 +10244,7 @@ async function fetchSeq(conn, path50, params) {
|
|
|
10156
10244
|
});
|
|
10157
10245
|
if (!response.ok) {
|
|
10158
10246
|
const body = await response.text();
|
|
10159
|
-
console.error(
|
|
10247
|
+
console.error(chalk123.red(`Seq returned ${response.status}: ${body}`));
|
|
10160
10248
|
process.exit(1);
|
|
10161
10249
|
}
|
|
10162
10250
|
return response;
|
|
@@ -10209,23 +10297,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
10209
10297
|
}
|
|
10210
10298
|
|
|
10211
10299
|
// src/commands/seq/formatEvent.ts
|
|
10212
|
-
import
|
|
10300
|
+
import chalk124 from "chalk";
|
|
10213
10301
|
function levelColor(level) {
|
|
10214
10302
|
switch (level) {
|
|
10215
10303
|
case "Fatal":
|
|
10216
|
-
return
|
|
10304
|
+
return chalk124.bgRed.white;
|
|
10217
10305
|
case "Error":
|
|
10218
|
-
return
|
|
10306
|
+
return chalk124.red;
|
|
10219
10307
|
case "Warning":
|
|
10220
|
-
return
|
|
10308
|
+
return chalk124.yellow;
|
|
10221
10309
|
case "Information":
|
|
10222
|
-
return
|
|
10310
|
+
return chalk124.cyan;
|
|
10223
10311
|
case "Debug":
|
|
10224
|
-
return
|
|
10312
|
+
return chalk124.gray;
|
|
10225
10313
|
case "Verbose":
|
|
10226
|
-
return
|
|
10314
|
+
return chalk124.dim;
|
|
10227
10315
|
default:
|
|
10228
|
-
return
|
|
10316
|
+
return chalk124.white;
|
|
10229
10317
|
}
|
|
10230
10318
|
}
|
|
10231
10319
|
function levelAbbrev(level) {
|
|
@@ -10266,31 +10354,31 @@ function formatTimestamp(iso) {
|
|
|
10266
10354
|
function formatEvent(event) {
|
|
10267
10355
|
const color = levelColor(event.Level);
|
|
10268
10356
|
const abbrev = levelAbbrev(event.Level);
|
|
10269
|
-
const ts8 =
|
|
10357
|
+
const ts8 = chalk124.dim(formatTimestamp(event.Timestamp));
|
|
10270
10358
|
const msg = renderMessage(event);
|
|
10271
10359
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
10272
10360
|
if (event.Exception) {
|
|
10273
10361
|
for (const line of event.Exception.split("\n")) {
|
|
10274
|
-
lines.push(
|
|
10362
|
+
lines.push(chalk124.red(` ${line}`));
|
|
10275
10363
|
}
|
|
10276
10364
|
}
|
|
10277
10365
|
return lines.join("\n");
|
|
10278
10366
|
}
|
|
10279
10367
|
|
|
10280
10368
|
// src/commands/seq/resolveConnection.ts
|
|
10281
|
-
import
|
|
10369
|
+
import chalk125 from "chalk";
|
|
10282
10370
|
function resolveConnection2(name) {
|
|
10283
10371
|
const connections = loadConnections2();
|
|
10284
10372
|
if (connections.length === 0) {
|
|
10285
10373
|
console.error(
|
|
10286
|
-
|
|
10374
|
+
chalk125.red("No Seq connections configured. Run 'assist seq auth' first.")
|
|
10287
10375
|
);
|
|
10288
10376
|
process.exit(1);
|
|
10289
10377
|
}
|
|
10290
10378
|
const target = name ?? getDefaultConnection() ?? connections[0].name;
|
|
10291
10379
|
const connection = connections.find((c) => c.name === target);
|
|
10292
10380
|
if (!connection) {
|
|
10293
|
-
console.error(
|
|
10381
|
+
console.error(chalk125.red(`Seq connection "${target}" not found.`));
|
|
10294
10382
|
process.exit(1);
|
|
10295
10383
|
}
|
|
10296
10384
|
return connection;
|
|
@@ -10305,7 +10393,7 @@ async function seqQuery(filter, options2) {
|
|
|
10305
10393
|
new URLSearchParams({ filter, count: String(count) })
|
|
10306
10394
|
);
|
|
10307
10395
|
if (events.length === 0) {
|
|
10308
|
-
console.log(
|
|
10396
|
+
console.log(chalk126.yellow("No events found."));
|
|
10309
10397
|
return;
|
|
10310
10398
|
}
|
|
10311
10399
|
if (options2.json) {
|
|
@@ -10316,11 +10404,11 @@ async function seqQuery(filter, options2) {
|
|
|
10316
10404
|
for (const event of chronological) {
|
|
10317
10405
|
console.log(formatEvent(event));
|
|
10318
10406
|
}
|
|
10319
|
-
console.log(
|
|
10407
|
+
console.log(chalk126.dim(`
|
|
10320
10408
|
${events.length} events`));
|
|
10321
10409
|
if (events.length >= count) {
|
|
10322
10410
|
console.log(
|
|
10323
|
-
|
|
10411
|
+
chalk126.yellow(
|
|
10324
10412
|
`Results limited to ${count}. Use --count to retrieve more.`
|
|
10325
10413
|
)
|
|
10326
10414
|
);
|
|
@@ -10328,11 +10416,11 @@ ${events.length} events`));
|
|
|
10328
10416
|
}
|
|
10329
10417
|
|
|
10330
10418
|
// src/commands/seq/seqSetConnection.ts
|
|
10331
|
-
import
|
|
10419
|
+
import chalk127 from "chalk";
|
|
10332
10420
|
function seqSetConnection(name) {
|
|
10333
10421
|
const connections = loadConnections2();
|
|
10334
10422
|
if (!connections.find((c) => c.name === name)) {
|
|
10335
|
-
console.error(
|
|
10423
|
+
console.error(chalk127.red(`Connection "${name}" not found.`));
|
|
10336
10424
|
process.exit(1);
|
|
10337
10425
|
}
|
|
10338
10426
|
setDefaultConnection(name);
|
|
@@ -10871,14 +10959,14 @@ import {
|
|
|
10871
10959
|
import { dirname as dirname20, join as join35 } from "path";
|
|
10872
10960
|
|
|
10873
10961
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
10874
|
-
import
|
|
10962
|
+
import chalk128 from "chalk";
|
|
10875
10963
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
10876
10964
|
function validateStagedContent(filename, content) {
|
|
10877
10965
|
const firstLine = content.split("\n")[0];
|
|
10878
10966
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
10879
10967
|
if (!match) {
|
|
10880
10968
|
console.error(
|
|
10881
|
-
|
|
10969
|
+
chalk128.red(
|
|
10882
10970
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
10883
10971
|
)
|
|
10884
10972
|
);
|
|
@@ -10887,7 +10975,7 @@ function validateStagedContent(filename, content) {
|
|
|
10887
10975
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
10888
10976
|
if (!contentAfterLink) {
|
|
10889
10977
|
console.error(
|
|
10890
|
-
|
|
10978
|
+
chalk128.red(
|
|
10891
10979
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
10892
10980
|
)
|
|
10893
10981
|
);
|
|
@@ -11280,7 +11368,7 @@ function registerVoice(program2) {
|
|
|
11280
11368
|
|
|
11281
11369
|
// src/commands/roam/auth.ts
|
|
11282
11370
|
import { randomBytes } from "crypto";
|
|
11283
|
-
import
|
|
11371
|
+
import chalk129 from "chalk";
|
|
11284
11372
|
|
|
11285
11373
|
// src/lib/openBrowser.ts
|
|
11286
11374
|
import { execSync as execSync39 } from "child_process";
|
|
@@ -11455,13 +11543,13 @@ async function auth() {
|
|
|
11455
11543
|
saveGlobalConfig(config);
|
|
11456
11544
|
const state = randomBytes(16).toString("hex");
|
|
11457
11545
|
console.log(
|
|
11458
|
-
|
|
11546
|
+
chalk129.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
11459
11547
|
);
|
|
11460
|
-
console.log(
|
|
11461
|
-
console.log(
|
|
11462
|
-
console.log(
|
|
11548
|
+
console.log(chalk129.white("http://localhost:14523/callback\n"));
|
|
11549
|
+
console.log(chalk129.blue("Opening browser for authorization..."));
|
|
11550
|
+
console.log(chalk129.dim("Waiting for authorization callback..."));
|
|
11463
11551
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
11464
|
-
console.log(
|
|
11552
|
+
console.log(chalk129.dim("Exchanging code for tokens..."));
|
|
11465
11553
|
const tokens = await exchangeToken({
|
|
11466
11554
|
code,
|
|
11467
11555
|
clientId,
|
|
@@ -11477,7 +11565,7 @@ async function auth() {
|
|
|
11477
11565
|
};
|
|
11478
11566
|
saveGlobalConfig(config);
|
|
11479
11567
|
console.log(
|
|
11480
|
-
|
|
11568
|
+
chalk129.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
11481
11569
|
);
|
|
11482
11570
|
}
|
|
11483
11571
|
|
|
@@ -11722,7 +11810,7 @@ import { execSync as execSync41 } from "child_process";
|
|
|
11722
11810
|
import { existsSync as existsSync40, mkdirSync as mkdirSync14, unlinkSync as unlinkSync11, writeFileSync as writeFileSync29 } from "fs";
|
|
11723
11811
|
import { tmpdir as tmpdir6 } from "os";
|
|
11724
11812
|
import { join as join44, resolve as resolve6 } from "path";
|
|
11725
|
-
import
|
|
11813
|
+
import chalk130 from "chalk";
|
|
11726
11814
|
|
|
11727
11815
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
11728
11816
|
var captureWindowPs1 = `
|
|
@@ -11873,22 +11961,22 @@ function screenshot(processName) {
|
|
|
11873
11961
|
const config = loadConfig();
|
|
11874
11962
|
const outputDir = resolve6(config.screenshot.outputDir);
|
|
11875
11963
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
11876
|
-
console.log(
|
|
11964
|
+
console.log(chalk130.gray(`Capturing window for process "${processName}" ...`));
|
|
11877
11965
|
try {
|
|
11878
11966
|
runPowerShellScript(processName, outputPath);
|
|
11879
|
-
console.log(
|
|
11967
|
+
console.log(chalk130.green(`Screenshot saved: ${outputPath}`));
|
|
11880
11968
|
} catch (error) {
|
|
11881
11969
|
const msg = error instanceof Error ? error.message : String(error);
|
|
11882
|
-
console.error(
|
|
11970
|
+
console.error(chalk130.red(`Failed to capture screenshot: ${msg}`));
|
|
11883
11971
|
process.exit(1);
|
|
11884
11972
|
}
|
|
11885
11973
|
}
|
|
11886
11974
|
|
|
11887
11975
|
// src/commands/statusLine.ts
|
|
11888
|
-
import
|
|
11976
|
+
import chalk132 from "chalk";
|
|
11889
11977
|
|
|
11890
11978
|
// src/commands/buildLimitsSegment.ts
|
|
11891
|
-
import
|
|
11979
|
+
import chalk131 from "chalk";
|
|
11892
11980
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
11893
11981
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
11894
11982
|
function formatTimeLeft(resetsAt) {
|
|
@@ -11911,10 +11999,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
11911
11999
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
11912
12000
|
const label2 = `${Math.round(pct)}%`;
|
|
11913
12001
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
11914
|
-
if (projected == null) return
|
|
11915
|
-
if (projected > 100) return
|
|
11916
|
-
if (projected > 75) return
|
|
11917
|
-
return
|
|
12002
|
+
if (projected == null) return chalk131.green(label2);
|
|
12003
|
+
if (projected > 100) return chalk131.red(label2);
|
|
12004
|
+
if (projected > 75) return chalk131.yellow(label2);
|
|
12005
|
+
return chalk131.green(label2);
|
|
11918
12006
|
}
|
|
11919
12007
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
11920
12008
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -11940,14 +12028,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
11940
12028
|
}
|
|
11941
12029
|
|
|
11942
12030
|
// src/commands/statusLine.ts
|
|
11943
|
-
|
|
12031
|
+
chalk132.level = 3;
|
|
11944
12032
|
function formatNumber(num) {
|
|
11945
12033
|
return num.toLocaleString("en-US");
|
|
11946
12034
|
}
|
|
11947
12035
|
function colorizePercent(pct) {
|
|
11948
12036
|
const label2 = `${Math.round(pct)}%`;
|
|
11949
|
-
if (pct > 80) return
|
|
11950
|
-
if (pct > 40) return
|
|
12037
|
+
if (pct > 80) return chalk132.red(label2);
|
|
12038
|
+
if (pct > 40) return chalk132.yellow(label2);
|
|
11951
12039
|
return label2;
|
|
11952
12040
|
}
|
|
11953
12041
|
async function statusLine() {
|
|
@@ -11970,7 +12058,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
11970
12058
|
// src/commands/sync/syncClaudeMd.ts
|
|
11971
12059
|
import * as fs23 from "fs";
|
|
11972
12060
|
import * as path46 from "path";
|
|
11973
|
-
import
|
|
12061
|
+
import chalk133 from "chalk";
|
|
11974
12062
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
11975
12063
|
const source = path46.join(claudeDir, "CLAUDE.md");
|
|
11976
12064
|
const target = path46.join(targetBase, "CLAUDE.md");
|
|
@@ -11979,12 +12067,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
11979
12067
|
const targetContent = fs23.readFileSync(target, "utf-8");
|
|
11980
12068
|
if (sourceContent !== targetContent) {
|
|
11981
12069
|
console.log(
|
|
11982
|
-
|
|
12070
|
+
chalk133.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
11983
12071
|
);
|
|
11984
12072
|
console.log();
|
|
11985
12073
|
printDiff(targetContent, sourceContent);
|
|
11986
12074
|
const confirm = options2?.yes || await promptConfirm(
|
|
11987
|
-
|
|
12075
|
+
chalk133.red("Overwrite existing CLAUDE.md?"),
|
|
11988
12076
|
false
|
|
11989
12077
|
);
|
|
11990
12078
|
if (!confirm) {
|
|
@@ -12000,7 +12088,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
12000
12088
|
// src/commands/sync/syncSettings.ts
|
|
12001
12089
|
import * as fs24 from "fs";
|
|
12002
12090
|
import * as path47 from "path";
|
|
12003
|
-
import
|
|
12091
|
+
import chalk134 from "chalk";
|
|
12004
12092
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
12005
12093
|
const source = path47.join(claudeDir, "settings.json");
|
|
12006
12094
|
const target = path47.join(targetBase, "settings.json");
|
|
@@ -12016,14 +12104,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
12016
12104
|
if (mergedContent !== normalizedTarget) {
|
|
12017
12105
|
if (!options2?.yes) {
|
|
12018
12106
|
console.log(
|
|
12019
|
-
|
|
12107
|
+
chalk134.yellow(
|
|
12020
12108
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
12021
12109
|
)
|
|
12022
12110
|
);
|
|
12023
12111
|
console.log();
|
|
12024
12112
|
printDiff(targetContent, mergedContent);
|
|
12025
12113
|
const confirm = await promptConfirm(
|
|
12026
|
-
|
|
12114
|
+
chalk134.red("Overwrite existing settings.json?"),
|
|
12027
12115
|
false
|
|
12028
12116
|
);
|
|
12029
12117
|
if (!confirm) {
|