@staff0rd/assist 0.186.1 → 0.188.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +421 -365
- 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.188.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -421,13 +421,7 @@ import Database from "better-sqlite3";
|
|
|
421
421
|
// src/commands/backlog/ensureGitignore.ts
|
|
422
422
|
import { existsSync as existsSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
423
423
|
import { join as join2 } from "path";
|
|
424
|
-
var gitignoreEntries = [
|
|
425
|
-
".assist/backlog.db",
|
|
426
|
-
".assist/backlog.db-shm",
|
|
427
|
-
".assist/backlog.db-wal",
|
|
428
|
-
".assist-signal*.json",
|
|
429
|
-
".assist-lock-*.json"
|
|
430
|
-
];
|
|
424
|
+
var gitignoreEntries = [".assist-*", ".assist/*.db*"];
|
|
431
425
|
function ensureGitignore(dir) {
|
|
432
426
|
const gitignorePath = join2(dir, ".gitignore");
|
|
433
427
|
const existing = existsSync2(gitignorePath) ? readFileSync3(gitignorePath, "utf-8") : "";
|
|
@@ -4008,53 +4002,112 @@ async function add(options2) {
|
|
|
4008
4002
|
}
|
|
4009
4003
|
|
|
4010
4004
|
// src/commands/backlog/addPhase.ts
|
|
4005
|
+
import chalk47 from "chalk";
|
|
4006
|
+
|
|
4007
|
+
// src/commands/backlog/insertPhaseAt.ts
|
|
4008
|
+
function insertPhaseAt(db, itemId, phaseIdx, name, tasks, manualChecks, currentPhase) {
|
|
4009
|
+
const run4 = db.transaction(() => {
|
|
4010
|
+
db.pragma("defer_foreign_keys = ON");
|
|
4011
|
+
const toShift = db.prepare(
|
|
4012
|
+
"SELECT idx FROM plan_phases WHERE item_id = ? AND idx >= ? ORDER BY idx DESC"
|
|
4013
|
+
).all(itemId, phaseIdx);
|
|
4014
|
+
for (const p of toShift) {
|
|
4015
|
+
db.prepare(
|
|
4016
|
+
"UPDATE plan_tasks SET phase_idx = ? WHERE item_id = ? AND phase_idx = ?"
|
|
4017
|
+
).run(p.idx + 1, itemId, p.idx);
|
|
4018
|
+
db.prepare(
|
|
4019
|
+
"UPDATE plan_phases SET idx = ? WHERE item_id = ? AND idx = ?"
|
|
4020
|
+
).run(p.idx + 1, itemId, p.idx);
|
|
4021
|
+
}
|
|
4022
|
+
db.prepare(
|
|
4023
|
+
"INSERT INTO plan_phases (item_id, idx, name, manual_checks) VALUES (?, ?, ?, ?)"
|
|
4024
|
+
).run(itemId, phaseIdx, name, manualChecks);
|
|
4025
|
+
const taskStmt = db.prepare(
|
|
4026
|
+
"INSERT INTO plan_tasks (item_id, phase_idx, idx, task) VALUES (?, ?, ?, ?)"
|
|
4027
|
+
);
|
|
4028
|
+
for (let i = 0; i < tasks.length; i++) {
|
|
4029
|
+
taskStmt.run(itemId, phaseIdx, i, tasks[i]);
|
|
4030
|
+
}
|
|
4031
|
+
if (currentPhase !== void 0 && currentPhase - 1 >= phaseIdx) {
|
|
4032
|
+
db.prepare("UPDATE items SET current_phase = ? WHERE id = ?").run(
|
|
4033
|
+
currentPhase + 1,
|
|
4034
|
+
itemId
|
|
4035
|
+
);
|
|
4036
|
+
}
|
|
4037
|
+
});
|
|
4038
|
+
run4();
|
|
4039
|
+
}
|
|
4040
|
+
|
|
4041
|
+
// src/commands/backlog/resolveInsertPosition.ts
|
|
4011
4042
|
import chalk46 from "chalk";
|
|
4043
|
+
function resolveInsertPosition(db, itemId, position) {
|
|
4044
|
+
const { cnt: phaseCount } = db.prepare("SELECT COUNT(*) as cnt FROM plan_phases WHERE item_id = ?").get(itemId);
|
|
4045
|
+
if (position === void 0) return phaseCount;
|
|
4046
|
+
const pos = Number.parseInt(position, 10);
|
|
4047
|
+
if (pos < 1 || pos > phaseCount + 1) {
|
|
4048
|
+
console.log(
|
|
4049
|
+
chalk46.red(
|
|
4050
|
+
`Position ${pos} is out of range. Must be between 1 and ${phaseCount + 1}.`
|
|
4051
|
+
)
|
|
4052
|
+
);
|
|
4053
|
+
process.exitCode = 1;
|
|
4054
|
+
return void 0;
|
|
4055
|
+
}
|
|
4056
|
+
return pos - 1;
|
|
4057
|
+
}
|
|
4058
|
+
|
|
4059
|
+
// src/commands/backlog/serializeManualChecks.ts
|
|
4060
|
+
function serializeManualChecks(manualCheck) {
|
|
4061
|
+
return manualCheck && manualCheck.length > 0 ? JSON.stringify(manualCheck) : null;
|
|
4062
|
+
}
|
|
4063
|
+
|
|
4064
|
+
// src/commands/backlog/addPhase.ts
|
|
4012
4065
|
function addPhase(id, name, options2) {
|
|
4013
4066
|
const result = loadAndFindItem(id);
|
|
4014
4067
|
if (!result) return;
|
|
4015
4068
|
const tasks = options2.task ?? [];
|
|
4016
4069
|
if (tasks.length === 0) {
|
|
4017
|
-
console.log(
|
|
4070
|
+
console.log(chalk47.red("At least one --task is required."));
|
|
4018
4071
|
process.exitCode = 1;
|
|
4019
4072
|
return;
|
|
4020
4073
|
}
|
|
4021
4074
|
const dir = getBacklogDir();
|
|
4022
4075
|
const db = openDb(dir);
|
|
4023
4076
|
const itemId = result.item.id;
|
|
4024
|
-
const
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4077
|
+
const phaseIdx = resolveInsertPosition(db, itemId, options2.position);
|
|
4078
|
+
if (phaseIdx === void 0) return;
|
|
4079
|
+
insertPhaseAt(
|
|
4080
|
+
db,
|
|
4081
|
+
itemId,
|
|
4082
|
+
phaseIdx,
|
|
4083
|
+
name,
|
|
4084
|
+
tasks,
|
|
4085
|
+
serializeManualChecks(options2.manualCheck),
|
|
4086
|
+
result.item.currentPhase
|
|
4032
4087
|
);
|
|
4033
|
-
for (let i = 0; i < tasks.length; i++) {
|
|
4034
|
-
taskStmt.run(itemId, phaseIdx, i, tasks[i]);
|
|
4035
|
-
}
|
|
4036
4088
|
exportToJsonl(db, dir);
|
|
4037
4089
|
commitBacklog(itemId, result.item.name);
|
|
4090
|
+
const verb = options2.position !== void 0 ? "Inserted" : "Added";
|
|
4038
4091
|
console.log(
|
|
4039
|
-
|
|
4040
|
-
|
|
4092
|
+
chalk47.green(
|
|
4093
|
+
`${verb} phase ${phaseIdx + 1} "${name}" to item #${itemId} with ${tasks.length} task(s).`
|
|
4041
4094
|
)
|
|
4042
4095
|
);
|
|
4043
4096
|
}
|
|
4044
4097
|
|
|
4045
4098
|
// src/commands/backlog/init/index.ts
|
|
4046
|
-
import
|
|
4099
|
+
import chalk48 from "chalk";
|
|
4047
4100
|
async function init6() {
|
|
4048
4101
|
if (backlogExists()) {
|
|
4049
|
-
console.log(
|
|
4102
|
+
console.log(chalk48.yellow("Backlog already exists."));
|
|
4050
4103
|
return;
|
|
4051
4104
|
}
|
|
4052
4105
|
saveBacklog([]);
|
|
4053
|
-
console.log(
|
|
4106
|
+
console.log(chalk48.green("Created backlog."));
|
|
4054
4107
|
}
|
|
4055
4108
|
|
|
4056
4109
|
// src/commands/backlog/list/index.ts
|
|
4057
|
-
import
|
|
4110
|
+
import chalk49 from "chalk";
|
|
4058
4111
|
function filterItems(items, options2) {
|
|
4059
4112
|
if (options2.status) return items.filter((i) => i.status === options2.status);
|
|
4060
4113
|
if (!options2.all)
|
|
@@ -4064,7 +4117,7 @@ function filterItems(items, options2) {
|
|
|
4064
4117
|
async function list2(options2) {
|
|
4065
4118
|
if (!backlogExists()) {
|
|
4066
4119
|
console.log(
|
|
4067
|
-
|
|
4120
|
+
chalk49.yellow(
|
|
4068
4121
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
4069
4122
|
)
|
|
4070
4123
|
);
|
|
@@ -4073,12 +4126,12 @@ async function list2(options2) {
|
|
|
4073
4126
|
const allItems = loadBacklog();
|
|
4074
4127
|
const items = filterItems(allItems, options2);
|
|
4075
4128
|
if (items.length === 0) {
|
|
4076
|
-
console.log(
|
|
4129
|
+
console.log(chalk49.dim("Backlog is empty."));
|
|
4077
4130
|
return;
|
|
4078
4131
|
}
|
|
4079
4132
|
for (const item of items) {
|
|
4080
4133
|
console.log(
|
|
4081
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
4134
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk49.dim(`#${item.id}`)} ${item.name}${phaseLabel(item)}${dependencyLabel(item, allItems)}`
|
|
4082
4135
|
);
|
|
4083
4136
|
if (options2.verbose) {
|
|
4084
4137
|
printVerboseDetails(item);
|
|
@@ -4097,11 +4150,14 @@ function registerItemCommands(cmd) {
|
|
|
4097
4150
|
cmd.command("add-phase <id> <name>").description("Add a phase to an existing backlog item").option("--task <task...>", "Task description (repeatable)").option(
|
|
4098
4151
|
"--manual-check <check...>",
|
|
4099
4152
|
"Manual check description (repeatable)"
|
|
4153
|
+
).option(
|
|
4154
|
+
"--position <position>",
|
|
4155
|
+
"1-indexed position to insert at (default: append)"
|
|
4100
4156
|
).action(addPhase);
|
|
4101
4157
|
}
|
|
4102
4158
|
|
|
4103
4159
|
// src/commands/backlog/link.ts
|
|
4104
|
-
import
|
|
4160
|
+
import chalk51 from "chalk";
|
|
4105
4161
|
|
|
4106
4162
|
// src/commands/backlog/hasCycle.ts
|
|
4107
4163
|
function hasCycle(items, fromId, toId) {
|
|
@@ -4124,11 +4180,11 @@ function hasCycle(items, fromId, toId) {
|
|
|
4124
4180
|
}
|
|
4125
4181
|
|
|
4126
4182
|
// src/commands/backlog/validateLinkTarget.ts
|
|
4127
|
-
import
|
|
4183
|
+
import chalk50 from "chalk";
|
|
4128
4184
|
function validateLinkTarget(items, fromItem, fromId, toId, toNum, linkType) {
|
|
4129
4185
|
const toItem = items.find((i) => i.id === toNum);
|
|
4130
4186
|
if (!toItem) {
|
|
4131
|
-
console.log(
|
|
4187
|
+
console.log(chalk50.red(`Item #${toId} not found.`));
|
|
4132
4188
|
return void 0;
|
|
4133
4189
|
}
|
|
4134
4190
|
if (!fromItem.links) fromItem.links = [];
|
|
@@ -4137,7 +4193,7 @@ function validateLinkTarget(items, fromItem, fromId, toId, toNum, linkType) {
|
|
|
4137
4193
|
);
|
|
4138
4194
|
if (duplicate) {
|
|
4139
4195
|
console.log(
|
|
4140
|
-
|
|
4196
|
+
chalk50.yellow(`Link already exists: #${fromId} ${linkType} #${toId}`)
|
|
4141
4197
|
);
|
|
4142
4198
|
return void 0;
|
|
4143
4199
|
}
|
|
@@ -4148,13 +4204,13 @@ function validateLinkTarget(items, fromItem, fromId, toId, toNum, linkType) {
|
|
|
4148
4204
|
function link(fromId, toId, opts) {
|
|
4149
4205
|
const linkType = opts.type ?? "relates-to";
|
|
4150
4206
|
if (linkType !== "relates-to" && linkType !== "depends-on") {
|
|
4151
|
-
console.log(
|
|
4207
|
+
console.log(chalk51.red(`Invalid link type: ${linkType}`));
|
|
4152
4208
|
return;
|
|
4153
4209
|
}
|
|
4154
4210
|
const fromNum = Number.parseInt(fromId, 10);
|
|
4155
4211
|
const toNum = Number.parseInt(toId, 10);
|
|
4156
4212
|
if (fromNum === toNum) {
|
|
4157
|
-
console.log(
|
|
4213
|
+
console.log(chalk51.red("Cannot link an item to itself."));
|
|
4158
4214
|
return;
|
|
4159
4215
|
}
|
|
4160
4216
|
const result = loadAndFindItem(fromId);
|
|
@@ -4171,7 +4227,7 @@ function link(fromId, toId, opts) {
|
|
|
4171
4227
|
if (!toItem) return;
|
|
4172
4228
|
if (linkType === "depends-on" && hasCycle(items, fromNum, toNum)) {
|
|
4173
4229
|
console.log(
|
|
4174
|
-
|
|
4230
|
+
chalk51.red(
|
|
4175
4231
|
`Cannot add dependency: #${fromId} \u2192 #${toId} would create a circular dependency.`
|
|
4176
4232
|
)
|
|
4177
4233
|
);
|
|
@@ -4181,32 +4237,32 @@ function link(fromId, toId, opts) {
|
|
|
4181
4237
|
fromItem.links.push({ type: linkType, targetId: toNum });
|
|
4182
4238
|
saveBacklog(items);
|
|
4183
4239
|
console.log(
|
|
4184
|
-
|
|
4240
|
+
chalk51.green(`Linked #${fromId} ${linkType} #${toId} (${toItem.name})`)
|
|
4185
4241
|
);
|
|
4186
4242
|
}
|
|
4187
4243
|
|
|
4188
4244
|
// src/commands/backlog/unlink.ts
|
|
4189
|
-
import
|
|
4245
|
+
import chalk52 from "chalk";
|
|
4190
4246
|
function unlink(fromId, toId) {
|
|
4191
4247
|
const toNum = Number.parseInt(toId, 10);
|
|
4192
4248
|
const result = loadAndFindItem(fromId);
|
|
4193
4249
|
if (!result) return;
|
|
4194
4250
|
const { items, item: fromItem } = result;
|
|
4195
4251
|
if (!fromItem.links || fromItem.links.length === 0) {
|
|
4196
|
-
console.log(
|
|
4252
|
+
console.log(chalk52.yellow(`No links found on item #${fromId}.`));
|
|
4197
4253
|
return;
|
|
4198
4254
|
}
|
|
4199
4255
|
const before = fromItem.links.length;
|
|
4200
4256
|
fromItem.links = fromItem.links.filter((l) => l.targetId !== toNum);
|
|
4201
4257
|
if (fromItem.links.length === before) {
|
|
4202
|
-
console.log(
|
|
4258
|
+
console.log(chalk52.yellow(`No link from #${fromId} to #${toId} found.`));
|
|
4203
4259
|
return;
|
|
4204
4260
|
}
|
|
4205
4261
|
if (fromItem.links.length === 0) {
|
|
4206
4262
|
fromItem.links = void 0;
|
|
4207
4263
|
}
|
|
4208
4264
|
saveBacklog(items);
|
|
4209
|
-
console.log(
|
|
4265
|
+
console.log(chalk52.green(`Removed link from #${fromId} to #${toId}.`));
|
|
4210
4266
|
}
|
|
4211
4267
|
|
|
4212
4268
|
// src/commands/backlog/registerLinkCommands.ts
|
|
@@ -4220,7 +4276,7 @@ function registerLinkCommands(cmd) {
|
|
|
4220
4276
|
}
|
|
4221
4277
|
|
|
4222
4278
|
// src/commands/backlog/rewindPhase.ts
|
|
4223
|
-
import
|
|
4279
|
+
import chalk53 from "chalk";
|
|
4224
4280
|
function validateRewind(item, phaseNumber) {
|
|
4225
4281
|
if (!item.plan || item.plan.length === 0) {
|
|
4226
4282
|
return `Item #${item.id} has no plan phases.`;
|
|
@@ -4242,7 +4298,7 @@ function rewindPhase(id, phase, opts) {
|
|
|
4242
4298
|
const { item } = result;
|
|
4243
4299
|
const error = validateRewind(item, phaseNumber);
|
|
4244
4300
|
if (error) {
|
|
4245
|
-
console.log(
|
|
4301
|
+
console.log(chalk53.red(error));
|
|
4246
4302
|
process.exitCode = 1;
|
|
4247
4303
|
return;
|
|
4248
4304
|
}
|
|
@@ -4260,7 +4316,7 @@ function rewindPhase(id, phase, opts) {
|
|
|
4260
4316
|
targetPhase: phaseIndex
|
|
4261
4317
|
});
|
|
4262
4318
|
console.log(
|
|
4263
|
-
|
|
4319
|
+
chalk53.green(`Rewound item #${id} to phase ${phaseNumber} (${phaseName}).`)
|
|
4264
4320
|
);
|
|
4265
4321
|
}
|
|
4266
4322
|
|
|
@@ -4277,11 +4333,11 @@ function registerRunCommand(cmd) {
|
|
|
4277
4333
|
}
|
|
4278
4334
|
|
|
4279
4335
|
// src/commands/backlog/search/index.ts
|
|
4280
|
-
import
|
|
4336
|
+
import chalk54 from "chalk";
|
|
4281
4337
|
async function search(query) {
|
|
4282
4338
|
if (!backlogExists()) {
|
|
4283
4339
|
console.log(
|
|
4284
|
-
|
|
4340
|
+
chalk54.yellow(
|
|
4285
4341
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
4286
4342
|
)
|
|
4287
4343
|
);
|
|
@@ -4289,18 +4345,18 @@ async function search(query) {
|
|
|
4289
4345
|
}
|
|
4290
4346
|
const items = searchBacklog(query);
|
|
4291
4347
|
if (items.length === 0) {
|
|
4292
|
-
console.log(
|
|
4348
|
+
console.log(chalk54.dim(`No items matching "${query}".`));
|
|
4293
4349
|
return;
|
|
4294
4350
|
}
|
|
4295
4351
|
console.log(
|
|
4296
|
-
|
|
4352
|
+
chalk54.dim(
|
|
4297
4353
|
`${items.length} item${items.length === 1 ? "" : "s"} matching "${query}":
|
|
4298
4354
|
`
|
|
4299
4355
|
)
|
|
4300
4356
|
);
|
|
4301
4357
|
for (const item of items) {
|
|
4302
4358
|
console.log(
|
|
4303
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
4359
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk54.dim(`#${item.id}`)} ${item.name}`
|
|
4304
4360
|
);
|
|
4305
4361
|
}
|
|
4306
4362
|
}
|
|
@@ -4311,16 +4367,16 @@ function registerSearchCommand(cmd) {
|
|
|
4311
4367
|
}
|
|
4312
4368
|
|
|
4313
4369
|
// src/commands/backlog/delete/index.ts
|
|
4314
|
-
import
|
|
4370
|
+
import chalk55 from "chalk";
|
|
4315
4371
|
async function del(id) {
|
|
4316
4372
|
const name = removeItem(id);
|
|
4317
4373
|
if (name) {
|
|
4318
|
-
console.log(
|
|
4374
|
+
console.log(chalk55.green(`Deleted item #${id}: ${name}`));
|
|
4319
4375
|
}
|
|
4320
4376
|
}
|
|
4321
4377
|
|
|
4322
4378
|
// src/commands/backlog/done/index.ts
|
|
4323
|
-
import
|
|
4379
|
+
import chalk56 from "chalk";
|
|
4324
4380
|
async function done(id, summary) {
|
|
4325
4381
|
const result = loadAndFindItem(id);
|
|
4326
4382
|
if (!result) return;
|
|
@@ -4330,12 +4386,12 @@ async function done(id, summary) {
|
|
|
4330
4386
|
const pending = item.plan.slice(completedCount);
|
|
4331
4387
|
if (pending.length > 0) {
|
|
4332
4388
|
console.log(
|
|
4333
|
-
|
|
4389
|
+
chalk56.red(
|
|
4334
4390
|
`Cannot complete item #${id}: ${pending.length} pending phase(s):`
|
|
4335
4391
|
)
|
|
4336
4392
|
);
|
|
4337
4393
|
for (const phase of pending) {
|
|
4338
|
-
console.log(
|
|
4394
|
+
console.log(chalk56.yellow(` - ${phase.name}`));
|
|
4339
4395
|
}
|
|
4340
4396
|
process.exitCode = 1;
|
|
4341
4397
|
return;
|
|
@@ -4347,20 +4403,20 @@ async function done(id, summary) {
|
|
|
4347
4403
|
addPhaseSummary(item, summary, phase);
|
|
4348
4404
|
}
|
|
4349
4405
|
saveBacklog(result.items);
|
|
4350
|
-
console.log(
|
|
4406
|
+
console.log(chalk56.green(`Completed item #${id}: ${item.name}`));
|
|
4351
4407
|
}
|
|
4352
4408
|
|
|
4353
4409
|
// src/commands/backlog/start/index.ts
|
|
4354
|
-
import
|
|
4410
|
+
import chalk57 from "chalk";
|
|
4355
4411
|
async function start(id) {
|
|
4356
4412
|
const name = setStatus(id, "in-progress");
|
|
4357
4413
|
if (name) {
|
|
4358
|
-
console.log(
|
|
4414
|
+
console.log(chalk57.green(`Started item #${id}: ${name}`));
|
|
4359
4415
|
}
|
|
4360
4416
|
}
|
|
4361
4417
|
|
|
4362
4418
|
// src/commands/backlog/wontdo/index.ts
|
|
4363
|
-
import
|
|
4419
|
+
import chalk58 from "chalk";
|
|
4364
4420
|
async function wontdo(id, reason) {
|
|
4365
4421
|
const result = loadAndFindItem(id);
|
|
4366
4422
|
if (!result) return;
|
|
@@ -4370,7 +4426,7 @@ async function wontdo(id, reason) {
|
|
|
4370
4426
|
addPhaseSummary(result.item, reason, phase);
|
|
4371
4427
|
}
|
|
4372
4428
|
saveBacklog(result.items);
|
|
4373
|
-
console.log(
|
|
4429
|
+
console.log(chalk58.red(`Won't do item #${id}: ${result.item.name}`));
|
|
4374
4430
|
}
|
|
4375
4431
|
|
|
4376
4432
|
// src/commands/backlog/registerStatusCommands.ts
|
|
@@ -4382,10 +4438,10 @@ function registerStatusCommands(cmd) {
|
|
|
4382
4438
|
}
|
|
4383
4439
|
|
|
4384
4440
|
// src/commands/backlog/removePhase.ts
|
|
4385
|
-
import
|
|
4441
|
+
import chalk60 from "chalk";
|
|
4386
4442
|
|
|
4387
4443
|
// src/commands/backlog/findPhase.ts
|
|
4388
|
-
import
|
|
4444
|
+
import chalk59 from "chalk";
|
|
4389
4445
|
function findPhase(id, phase) {
|
|
4390
4446
|
const result = loadAndFindItem(id);
|
|
4391
4447
|
if (!result) return void 0;
|
|
@@ -4399,7 +4455,7 @@ function findPhase(id, phase) {
|
|
|
4399
4455
|
).get(itemId, phaseIdx);
|
|
4400
4456
|
if (existing.cnt === 0) {
|
|
4401
4457
|
console.log(
|
|
4402
|
-
|
|
4458
|
+
chalk59.red(`Phase ${phaseNumber} not found on item #${itemId}.`)
|
|
4403
4459
|
);
|
|
4404
4460
|
process.exitCode = 1;
|
|
4405
4461
|
return void 0;
|
|
@@ -4458,24 +4514,24 @@ function removePhase(id, phase) {
|
|
|
4458
4514
|
exportToJsonl(db, dir);
|
|
4459
4515
|
commitBacklog(itemId, result.item.name);
|
|
4460
4516
|
console.log(
|
|
4461
|
-
|
|
4517
|
+
chalk60.green(`Removed phase ${phaseIdx + 1} from item #${itemId}.`)
|
|
4462
4518
|
);
|
|
4463
4519
|
}
|
|
4464
4520
|
|
|
4465
4521
|
// src/commands/backlog/update/index.ts
|
|
4466
|
-
import
|
|
4522
|
+
import chalk62 from "chalk";
|
|
4467
4523
|
|
|
4468
4524
|
// src/commands/backlog/update/buildUpdateSql.ts
|
|
4469
|
-
import
|
|
4525
|
+
import chalk61 from "chalk";
|
|
4470
4526
|
function buildUpdateSql(options2) {
|
|
4471
4527
|
const { name, desc, type, ac } = options2;
|
|
4472
4528
|
if (!name && !desc && !type && !ac) {
|
|
4473
|
-
console.log(
|
|
4529
|
+
console.log(chalk61.red("Nothing to update. Provide at least one flag."));
|
|
4474
4530
|
process.exitCode = 1;
|
|
4475
4531
|
return void 0;
|
|
4476
4532
|
}
|
|
4477
4533
|
if (type && type !== "story" && type !== "bug") {
|
|
4478
|
-
console.log(
|
|
4534
|
+
console.log(chalk61.red('Invalid type. Must be "story" or "bug".'));
|
|
4479
4535
|
process.exitCode = 1;
|
|
4480
4536
|
return void 0;
|
|
4481
4537
|
}
|
|
@@ -4520,11 +4576,11 @@ function update(id, options2) {
|
|
|
4520
4576
|
);
|
|
4521
4577
|
exportToJsonl(db, dir);
|
|
4522
4578
|
commitBacklog(itemId, options2.name ?? result.item.name);
|
|
4523
|
-
console.log(
|
|
4579
|
+
console.log(chalk62.green(`Updated ${built.fields} on item #${itemId}.`));
|
|
4524
4580
|
}
|
|
4525
4581
|
|
|
4526
4582
|
// src/commands/backlog/updatePhase.ts
|
|
4527
|
-
import
|
|
4583
|
+
import chalk63 from "chalk";
|
|
4528
4584
|
|
|
4529
4585
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
4530
4586
|
function applyPhaseUpdate(db, itemId, phaseIdx, fields) {
|
|
@@ -4558,7 +4614,7 @@ function applyPhaseUpdate(db, itemId, phaseIdx, fields) {
|
|
|
4558
4614
|
function updatePhase(id, phase, options2) {
|
|
4559
4615
|
const { name, task, manualCheck } = options2;
|
|
4560
4616
|
if (!name && !task && !manualCheck) {
|
|
4561
|
-
console.log(
|
|
4617
|
+
console.log(chalk63.red("Nothing to update. Provide at least one flag."));
|
|
4562
4618
|
process.exitCode = 1;
|
|
4563
4619
|
return;
|
|
4564
4620
|
}
|
|
@@ -4574,7 +4630,7 @@ function updatePhase(id, phase, options2) {
|
|
|
4574
4630
|
manualCheck && "manual checks"
|
|
4575
4631
|
].filter(Boolean).join(", ");
|
|
4576
4632
|
console.log(
|
|
4577
|
-
|
|
4633
|
+
chalk63.green(
|
|
4578
4634
|
`Updated ${fields} on phase ${phaseIdx + 1} of item #${itemId}.`
|
|
4579
4635
|
)
|
|
4580
4636
|
);
|
|
@@ -5079,11 +5135,11 @@ function assertCliExists(cli) {
|
|
|
5079
5135
|
}
|
|
5080
5136
|
|
|
5081
5137
|
// src/commands/permitCliReads/colorize.ts
|
|
5082
|
-
import
|
|
5138
|
+
import chalk64 from "chalk";
|
|
5083
5139
|
function colorize(plainOutput) {
|
|
5084
5140
|
return plainOutput.split("\n").map((line) => {
|
|
5085
|
-
if (line.startsWith(" R ")) return
|
|
5086
|
-
if (line.startsWith(" W ")) return
|
|
5141
|
+
if (line.startsWith(" R ")) return chalk64.green(line);
|
|
5142
|
+
if (line.startsWith(" W ")) return chalk64.red(line);
|
|
5087
5143
|
return line;
|
|
5088
5144
|
}).join("\n");
|
|
5089
5145
|
}
|
|
@@ -5381,48 +5437,48 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
5381
5437
|
}
|
|
5382
5438
|
|
|
5383
5439
|
// src/commands/deny/denyAdd.ts
|
|
5384
|
-
import
|
|
5440
|
+
import chalk65 from "chalk";
|
|
5385
5441
|
function denyAdd(pattern2, message) {
|
|
5386
5442
|
const config = loadProjectConfig();
|
|
5387
5443
|
const deny = config.deny ?? [];
|
|
5388
5444
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
5389
|
-
console.log(
|
|
5445
|
+
console.log(chalk65.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
5390
5446
|
return;
|
|
5391
5447
|
}
|
|
5392
5448
|
deny.push({ pattern: pattern2, message });
|
|
5393
5449
|
config.deny = deny;
|
|
5394
5450
|
saveConfig(config);
|
|
5395
|
-
console.log(
|
|
5451
|
+
console.log(chalk65.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
5396
5452
|
}
|
|
5397
5453
|
|
|
5398
5454
|
// src/commands/deny/denyList.ts
|
|
5399
|
-
import
|
|
5455
|
+
import chalk66 from "chalk";
|
|
5400
5456
|
function denyList() {
|
|
5401
5457
|
const config = loadConfig();
|
|
5402
5458
|
const deny = config.deny;
|
|
5403
5459
|
if (!deny || deny.length === 0) {
|
|
5404
|
-
console.log(
|
|
5460
|
+
console.log(chalk66.dim("No deny rules configured."));
|
|
5405
5461
|
return;
|
|
5406
5462
|
}
|
|
5407
5463
|
for (const rule of deny) {
|
|
5408
|
-
console.log(`${
|
|
5464
|
+
console.log(`${chalk66.red(rule.pattern)} \u2192 ${rule.message}`);
|
|
5409
5465
|
}
|
|
5410
5466
|
}
|
|
5411
5467
|
|
|
5412
5468
|
// src/commands/deny/denyRemove.ts
|
|
5413
|
-
import
|
|
5469
|
+
import chalk67 from "chalk";
|
|
5414
5470
|
function denyRemove(pattern2) {
|
|
5415
5471
|
const config = loadProjectConfig();
|
|
5416
5472
|
const deny = config.deny ?? [];
|
|
5417
5473
|
const index = deny.findIndex((r) => r.pattern === pattern2);
|
|
5418
5474
|
if (index === -1) {
|
|
5419
|
-
console.log(
|
|
5475
|
+
console.log(chalk67.yellow(`No deny rule found for: ${pattern2}`));
|
|
5420
5476
|
return;
|
|
5421
5477
|
}
|
|
5422
5478
|
deny.splice(index, 1);
|
|
5423
5479
|
config.deny = deny.length > 0 ? deny : void 0;
|
|
5424
5480
|
saveConfig(config);
|
|
5425
|
-
console.log(
|
|
5481
|
+
console.log(chalk67.green(`Removed deny rule: ${pattern2}`));
|
|
5426
5482
|
}
|
|
5427
5483
|
|
|
5428
5484
|
// src/commands/registerDeny.ts
|
|
@@ -5451,15 +5507,15 @@ function registerCliHook(program2) {
|
|
|
5451
5507
|
}
|
|
5452
5508
|
|
|
5453
5509
|
// src/commands/complexity/analyze.ts
|
|
5454
|
-
import
|
|
5510
|
+
import chalk73 from "chalk";
|
|
5455
5511
|
|
|
5456
5512
|
// src/commands/complexity/cyclomatic.ts
|
|
5457
|
-
import
|
|
5513
|
+
import chalk69 from "chalk";
|
|
5458
5514
|
|
|
5459
5515
|
// src/commands/complexity/shared/index.ts
|
|
5460
5516
|
import fs12 from "fs";
|
|
5461
5517
|
import path20 from "path";
|
|
5462
|
-
import
|
|
5518
|
+
import chalk68 from "chalk";
|
|
5463
5519
|
import ts5 from "typescript";
|
|
5464
5520
|
|
|
5465
5521
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -5705,7 +5761,7 @@ function createSourceFromFile(filePath) {
|
|
|
5705
5761
|
function withSourceFiles(pattern2, callback) {
|
|
5706
5762
|
const files = findSourceFiles2(pattern2);
|
|
5707
5763
|
if (files.length === 0) {
|
|
5708
|
-
console.log(
|
|
5764
|
+
console.log(chalk68.yellow("No files found matching pattern"));
|
|
5709
5765
|
return void 0;
|
|
5710
5766
|
}
|
|
5711
5767
|
return callback(files);
|
|
@@ -5738,11 +5794,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5738
5794
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
5739
5795
|
for (const { file, name, complexity } of results) {
|
|
5740
5796
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
5741
|
-
const color = exceedsThreshold ?
|
|
5742
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
5797
|
+
const color = exceedsThreshold ? chalk69.red : chalk69.white;
|
|
5798
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk69.cyan(complexity)}`);
|
|
5743
5799
|
}
|
|
5744
5800
|
console.log(
|
|
5745
|
-
|
|
5801
|
+
chalk69.dim(
|
|
5746
5802
|
`
|
|
5747
5803
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
5748
5804
|
)
|
|
@@ -5754,7 +5810,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
5754
5810
|
}
|
|
5755
5811
|
|
|
5756
5812
|
// src/commands/complexity/halstead.ts
|
|
5757
|
-
import
|
|
5813
|
+
import chalk70 from "chalk";
|
|
5758
5814
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
5759
5815
|
withSourceFiles(pattern2, (files) => {
|
|
5760
5816
|
const results = [];
|
|
@@ -5769,13 +5825,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5769
5825
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
5770
5826
|
for (const { file, name, metrics } of results) {
|
|
5771
5827
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
5772
|
-
const color = exceedsThreshold ?
|
|
5828
|
+
const color = exceedsThreshold ? chalk70.red : chalk70.white;
|
|
5773
5829
|
console.log(
|
|
5774
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
5830
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk70.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk70.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk70.magenta(metrics.effort.toFixed(1))}`
|
|
5775
5831
|
);
|
|
5776
5832
|
}
|
|
5777
5833
|
console.log(
|
|
5778
|
-
|
|
5834
|
+
chalk70.dim(
|
|
5779
5835
|
`
|
|
5780
5836
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
5781
5837
|
)
|
|
@@ -5790,28 +5846,28 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
5790
5846
|
import fs13 from "fs";
|
|
5791
5847
|
|
|
5792
5848
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
5793
|
-
import
|
|
5849
|
+
import chalk71 from "chalk";
|
|
5794
5850
|
function displayMaintainabilityResults(results, threshold) {
|
|
5795
5851
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
5796
5852
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
5797
|
-
console.log(
|
|
5853
|
+
console.log(chalk71.green("All files pass maintainability threshold"));
|
|
5798
5854
|
} else {
|
|
5799
5855
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
5800
|
-
const color = threshold !== void 0 ?
|
|
5856
|
+
const color = threshold !== void 0 ? chalk71.red : chalk71.white;
|
|
5801
5857
|
console.log(
|
|
5802
|
-
`${color(file)} \u2192 avg: ${
|
|
5858
|
+
`${color(file)} \u2192 avg: ${chalk71.cyan(avgMaintainability.toFixed(1))}, min: ${chalk71.yellow(minMaintainability.toFixed(1))}`
|
|
5803
5859
|
);
|
|
5804
5860
|
}
|
|
5805
5861
|
}
|
|
5806
|
-
console.log(
|
|
5862
|
+
console.log(chalk71.dim(`
|
|
5807
5863
|
Analyzed ${results.length} files`));
|
|
5808
5864
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
5809
5865
|
console.error(
|
|
5810
|
-
|
|
5866
|
+
chalk71.red(
|
|
5811
5867
|
`
|
|
5812
5868
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
5813
5869
|
|
|
5814
|
-
\u26A0\uFE0F ${
|
|
5870
|
+
\u26A0\uFE0F ${chalk71.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.`
|
|
5815
5871
|
)
|
|
5816
5872
|
);
|
|
5817
5873
|
process.exit(1);
|
|
@@ -5868,7 +5924,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5868
5924
|
|
|
5869
5925
|
// src/commands/complexity/sloc.ts
|
|
5870
5926
|
import fs14 from "fs";
|
|
5871
|
-
import
|
|
5927
|
+
import chalk72 from "chalk";
|
|
5872
5928
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
5873
5929
|
withSourceFiles(pattern2, (files) => {
|
|
5874
5930
|
const results = [];
|
|
@@ -5884,12 +5940,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5884
5940
|
results.sort((a, b) => b.lines - a.lines);
|
|
5885
5941
|
for (const { file, lines } of results) {
|
|
5886
5942
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
5887
|
-
const color = exceedsThreshold ?
|
|
5888
|
-
console.log(`${color(file)} \u2192 ${
|
|
5943
|
+
const color = exceedsThreshold ? chalk72.red : chalk72.white;
|
|
5944
|
+
console.log(`${color(file)} \u2192 ${chalk72.cyan(lines)} lines`);
|
|
5889
5945
|
}
|
|
5890
5946
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
5891
5947
|
console.log(
|
|
5892
|
-
|
|
5948
|
+
chalk72.dim(`
|
|
5893
5949
|
Total: ${total} lines across ${files.length} files`)
|
|
5894
5950
|
);
|
|
5895
5951
|
if (hasViolation) {
|
|
@@ -5903,21 +5959,21 @@ async function analyze(pattern2) {
|
|
|
5903
5959
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
5904
5960
|
const files = findSourceFiles2(searchPattern);
|
|
5905
5961
|
if (files.length === 0) {
|
|
5906
|
-
console.log(
|
|
5962
|
+
console.log(chalk73.yellow("No files found matching pattern"));
|
|
5907
5963
|
return;
|
|
5908
5964
|
}
|
|
5909
5965
|
if (files.length === 1) {
|
|
5910
5966
|
const file = files[0];
|
|
5911
|
-
console.log(
|
|
5967
|
+
console.log(chalk73.bold.underline("SLOC"));
|
|
5912
5968
|
await sloc(file);
|
|
5913
5969
|
console.log();
|
|
5914
|
-
console.log(
|
|
5970
|
+
console.log(chalk73.bold.underline("Cyclomatic Complexity"));
|
|
5915
5971
|
await cyclomatic(file);
|
|
5916
5972
|
console.log();
|
|
5917
|
-
console.log(
|
|
5973
|
+
console.log(chalk73.bold.underline("Halstead Metrics"));
|
|
5918
5974
|
await halstead(file);
|
|
5919
5975
|
console.log();
|
|
5920
|
-
console.log(
|
|
5976
|
+
console.log(chalk73.bold.underline("Maintainability Index"));
|
|
5921
5977
|
await maintainability(file);
|
|
5922
5978
|
return;
|
|
5923
5979
|
}
|
|
@@ -5944,7 +6000,7 @@ function registerComplexity(program2) {
|
|
|
5944
6000
|
}
|
|
5945
6001
|
|
|
5946
6002
|
// src/commands/config/index.ts
|
|
5947
|
-
import
|
|
6003
|
+
import chalk74 from "chalk";
|
|
5948
6004
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
5949
6005
|
|
|
5950
6006
|
// src/commands/config/setNestedValue.ts
|
|
@@ -6007,7 +6063,7 @@ function formatIssuePath(issue, key) {
|
|
|
6007
6063
|
function printValidationErrors(issues, key) {
|
|
6008
6064
|
for (const issue of issues) {
|
|
6009
6065
|
console.error(
|
|
6010
|
-
|
|
6066
|
+
chalk74.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
6011
6067
|
);
|
|
6012
6068
|
}
|
|
6013
6069
|
}
|
|
@@ -6024,7 +6080,7 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
6024
6080
|
function assertNotGlobalOnly(key, global) {
|
|
6025
6081
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
6026
6082
|
console.error(
|
|
6027
|
-
|
|
6083
|
+
chalk74.red(
|
|
6028
6084
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
6029
6085
|
)
|
|
6030
6086
|
);
|
|
@@ -6047,7 +6103,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
6047
6103
|
applyConfigSet(key, coerced, options2.global ?? false);
|
|
6048
6104
|
const target = options2.global ? "global" : "project";
|
|
6049
6105
|
console.log(
|
|
6050
|
-
|
|
6106
|
+
chalk74.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
6051
6107
|
);
|
|
6052
6108
|
}
|
|
6053
6109
|
function configList() {
|
|
@@ -6056,7 +6112,7 @@ function configList() {
|
|
|
6056
6112
|
}
|
|
6057
6113
|
|
|
6058
6114
|
// src/commands/config/configGet.ts
|
|
6059
|
-
import
|
|
6115
|
+
import chalk75 from "chalk";
|
|
6060
6116
|
|
|
6061
6117
|
// src/commands/config/getNestedValue.ts
|
|
6062
6118
|
function isTraversable(value) {
|
|
@@ -6088,7 +6144,7 @@ function requireNestedValue(config, key) {
|
|
|
6088
6144
|
return value;
|
|
6089
6145
|
}
|
|
6090
6146
|
function exitKeyNotSet(key) {
|
|
6091
|
-
console.error(
|
|
6147
|
+
console.error(chalk75.red(`Key "${key}" is not set`));
|
|
6092
6148
|
process.exit(1);
|
|
6093
6149
|
}
|
|
6094
6150
|
|
|
@@ -6102,7 +6158,7 @@ function registerConfig(program2) {
|
|
|
6102
6158
|
|
|
6103
6159
|
// src/commands/deploy/redirect.ts
|
|
6104
6160
|
import { existsSync as existsSync22, readFileSync as readFileSync19, writeFileSync as writeFileSync18 } from "fs";
|
|
6105
|
-
import
|
|
6161
|
+
import chalk76 from "chalk";
|
|
6106
6162
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
6107
6163
|
if (!window.location.pathname.endsWith('/')) {
|
|
6108
6164
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -6111,22 +6167,22 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
6111
6167
|
function redirect() {
|
|
6112
6168
|
const indexPath = "index.html";
|
|
6113
6169
|
if (!existsSync22(indexPath)) {
|
|
6114
|
-
console.log(
|
|
6170
|
+
console.log(chalk76.yellow("No index.html found"));
|
|
6115
6171
|
return;
|
|
6116
6172
|
}
|
|
6117
6173
|
const content = readFileSync19(indexPath, "utf-8");
|
|
6118
6174
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
6119
|
-
console.log(
|
|
6175
|
+
console.log(chalk76.dim("Trailing slash script already present"));
|
|
6120
6176
|
return;
|
|
6121
6177
|
}
|
|
6122
6178
|
const headCloseIndex = content.indexOf("</head>");
|
|
6123
6179
|
if (headCloseIndex === -1) {
|
|
6124
|
-
console.log(
|
|
6180
|
+
console.log(chalk76.red("Could not find </head> tag in index.html"));
|
|
6125
6181
|
return;
|
|
6126
6182
|
}
|
|
6127
6183
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
6128
6184
|
writeFileSync18(indexPath, newContent);
|
|
6129
|
-
console.log(
|
|
6185
|
+
console.log(chalk76.green("Added trailing slash redirect to index.html"));
|
|
6130
6186
|
}
|
|
6131
6187
|
|
|
6132
6188
|
// src/commands/registerDeploy.ts
|
|
@@ -6153,7 +6209,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
6153
6209
|
|
|
6154
6210
|
// src/commands/devlog/shared.ts
|
|
6155
6211
|
import { execSync as execSync18 } from "child_process";
|
|
6156
|
-
import
|
|
6212
|
+
import chalk77 from "chalk";
|
|
6157
6213
|
|
|
6158
6214
|
// src/shared/getRepoName.ts
|
|
6159
6215
|
import { existsSync as existsSync23, readFileSync as readFileSync20 } from "fs";
|
|
@@ -6262,13 +6318,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
6262
6318
|
}
|
|
6263
6319
|
function printCommitsWithFiles(commits, ignore2, verbose) {
|
|
6264
6320
|
for (const commit2 of commits) {
|
|
6265
|
-
console.log(` ${
|
|
6321
|
+
console.log(` ${chalk77.yellow(commit2.hash)} ${commit2.message}`);
|
|
6266
6322
|
if (verbose) {
|
|
6267
6323
|
const visibleFiles = commit2.files.filter(
|
|
6268
6324
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
6269
6325
|
);
|
|
6270
6326
|
for (const file of visibleFiles) {
|
|
6271
|
-
console.log(` ${
|
|
6327
|
+
console.log(` ${chalk77.dim(file)}`);
|
|
6272
6328
|
}
|
|
6273
6329
|
}
|
|
6274
6330
|
}
|
|
@@ -6293,15 +6349,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
6293
6349
|
}
|
|
6294
6350
|
|
|
6295
6351
|
// src/commands/devlog/list/printDateHeader.ts
|
|
6296
|
-
import
|
|
6352
|
+
import chalk78 from "chalk";
|
|
6297
6353
|
function printDateHeader(date, isSkipped, entries) {
|
|
6298
6354
|
if (isSkipped) {
|
|
6299
|
-
console.log(`${
|
|
6355
|
+
console.log(`${chalk78.bold.blue(date)} ${chalk78.dim("skipped")}`);
|
|
6300
6356
|
} else if (entries && entries.length > 0) {
|
|
6301
|
-
const entryInfo = entries.map((e) => `${
|
|
6302
|
-
console.log(`${
|
|
6357
|
+
const entryInfo = entries.map((e) => `${chalk78.green(e.version)} ${e.title}`).join(" | ");
|
|
6358
|
+
console.log(`${chalk78.bold.blue(date)} ${entryInfo}`);
|
|
6303
6359
|
} else {
|
|
6304
|
-
console.log(`${
|
|
6360
|
+
console.log(`${chalk78.bold.blue(date)} ${chalk78.red("\u26A0 devlog missing")}`);
|
|
6305
6361
|
}
|
|
6306
6362
|
}
|
|
6307
6363
|
|
|
@@ -6405,24 +6461,24 @@ function bumpVersion(version2, type) {
|
|
|
6405
6461
|
|
|
6406
6462
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
6407
6463
|
import { execSync as execSync21 } from "child_process";
|
|
6408
|
-
import
|
|
6464
|
+
import chalk80 from "chalk";
|
|
6409
6465
|
|
|
6410
6466
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
6411
|
-
import
|
|
6467
|
+
import chalk79 from "chalk";
|
|
6412
6468
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
6413
6469
|
if (conventional && firstHash) {
|
|
6414
6470
|
const version2 = getVersionAtCommit(firstHash);
|
|
6415
6471
|
if (version2) {
|
|
6416
|
-
console.log(`${
|
|
6472
|
+
console.log(`${chalk79.bold("version:")} ${stripToMinor(version2)}`);
|
|
6417
6473
|
} else {
|
|
6418
|
-
console.log(`${
|
|
6474
|
+
console.log(`${chalk79.bold("version:")} ${chalk79.red("unknown")}`);
|
|
6419
6475
|
}
|
|
6420
6476
|
} else if (patchVersion && minorVersion) {
|
|
6421
6477
|
console.log(
|
|
6422
|
-
`${
|
|
6478
|
+
`${chalk79.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
6423
6479
|
);
|
|
6424
6480
|
} else {
|
|
6425
|
-
console.log(`${
|
|
6481
|
+
console.log(`${chalk79.bold("version:")} v0.1 (initial)`);
|
|
6426
6482
|
}
|
|
6427
6483
|
}
|
|
6428
6484
|
|
|
@@ -6469,16 +6525,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
6469
6525
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
6470
6526
|
}
|
|
6471
6527
|
function logName(repoName) {
|
|
6472
|
-
console.log(`${
|
|
6528
|
+
console.log(`${chalk80.bold("name:")} ${repoName}`);
|
|
6473
6529
|
}
|
|
6474
6530
|
function displayNextEntry(ctx, targetDate, commits) {
|
|
6475
6531
|
logName(ctx.repoName);
|
|
6476
6532
|
printVersionInfo(ctx.config, ctx.lastInfo, commits[0]?.hash);
|
|
6477
|
-
console.log(
|
|
6533
|
+
console.log(chalk80.bold.blue(targetDate));
|
|
6478
6534
|
printCommitsWithFiles(commits, ctx.ignore, ctx.verbose);
|
|
6479
6535
|
}
|
|
6480
6536
|
function logNoCommits(lastInfo) {
|
|
6481
|
-
console.log(
|
|
6537
|
+
console.log(chalk80.dim(noCommitsMessage(!!lastInfo)));
|
|
6482
6538
|
}
|
|
6483
6539
|
|
|
6484
6540
|
// src/commands/devlog/next/index.ts
|
|
@@ -6519,11 +6575,11 @@ function next2(options2) {
|
|
|
6519
6575
|
import { execSync as execSync22 } from "child_process";
|
|
6520
6576
|
|
|
6521
6577
|
// src/commands/devlog/repos/printReposTable.ts
|
|
6522
|
-
import
|
|
6578
|
+
import chalk81 from "chalk";
|
|
6523
6579
|
function colorStatus(status2) {
|
|
6524
|
-
if (status2 === "missing") return
|
|
6525
|
-
if (status2 === "outdated") return
|
|
6526
|
-
return
|
|
6580
|
+
if (status2 === "missing") return chalk81.red(status2);
|
|
6581
|
+
if (status2 === "outdated") return chalk81.yellow(status2);
|
|
6582
|
+
return chalk81.green(status2);
|
|
6527
6583
|
}
|
|
6528
6584
|
function formatRow(row, nameWidth) {
|
|
6529
6585
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -6537,8 +6593,8 @@ function printReposTable(rows) {
|
|
|
6537
6593
|
"Last Devlog".padEnd(11),
|
|
6538
6594
|
"Status"
|
|
6539
6595
|
].join(" ");
|
|
6540
|
-
console.log(
|
|
6541
|
-
console.log(
|
|
6596
|
+
console.log(chalk81.dim(header));
|
|
6597
|
+
console.log(chalk81.dim("-".repeat(header.length)));
|
|
6542
6598
|
for (const row of rows) {
|
|
6543
6599
|
console.log(formatRow(row, nameWidth));
|
|
6544
6600
|
}
|
|
@@ -6596,14 +6652,14 @@ function repos(options2) {
|
|
|
6596
6652
|
// src/commands/devlog/skip.ts
|
|
6597
6653
|
import { writeFileSync as writeFileSync19 } from "fs";
|
|
6598
6654
|
import { join as join22 } from "path";
|
|
6599
|
-
import
|
|
6655
|
+
import chalk82 from "chalk";
|
|
6600
6656
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
6601
6657
|
function getBlogConfigPath() {
|
|
6602
6658
|
return join22(BLOG_REPO_ROOT, "assist.yml");
|
|
6603
6659
|
}
|
|
6604
6660
|
function skip(date) {
|
|
6605
6661
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
6606
|
-
console.log(
|
|
6662
|
+
console.log(chalk82.red("Invalid date format. Use YYYY-MM-DD"));
|
|
6607
6663
|
process.exit(1);
|
|
6608
6664
|
}
|
|
6609
6665
|
const repoName = getRepoName();
|
|
@@ -6614,7 +6670,7 @@ function skip(date) {
|
|
|
6614
6670
|
const skipDays = skip2[repoName] ?? [];
|
|
6615
6671
|
if (skipDays.includes(date)) {
|
|
6616
6672
|
console.log(
|
|
6617
|
-
|
|
6673
|
+
chalk82.yellow(`${date} is already in skip list for ${repoName}`)
|
|
6618
6674
|
);
|
|
6619
6675
|
return;
|
|
6620
6676
|
}
|
|
@@ -6624,20 +6680,20 @@ function skip(date) {
|
|
|
6624
6680
|
devlog.skip = skip2;
|
|
6625
6681
|
config.devlog = devlog;
|
|
6626
6682
|
writeFileSync19(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
6627
|
-
console.log(
|
|
6683
|
+
console.log(chalk82.green(`Added ${date} to skip list for ${repoName}`));
|
|
6628
6684
|
}
|
|
6629
6685
|
|
|
6630
6686
|
// src/commands/devlog/version.ts
|
|
6631
|
-
import
|
|
6687
|
+
import chalk83 from "chalk";
|
|
6632
6688
|
function version() {
|
|
6633
6689
|
const config = loadConfig();
|
|
6634
6690
|
const name = getRepoName();
|
|
6635
6691
|
const lastInfo = getLastVersionInfo(name, config);
|
|
6636
6692
|
const lastVersion = lastInfo?.version ?? null;
|
|
6637
6693
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
6638
|
-
console.log(`${
|
|
6639
|
-
console.log(`${
|
|
6640
|
-
console.log(`${
|
|
6694
|
+
console.log(`${chalk83.bold("name:")} ${name}`);
|
|
6695
|
+
console.log(`${chalk83.bold("last:")} ${lastVersion ?? chalk83.dim("none")}`);
|
|
6696
|
+
console.log(`${chalk83.bold("next:")} ${nextVersion ?? chalk83.dim("none")}`);
|
|
6641
6697
|
}
|
|
6642
6698
|
|
|
6643
6699
|
// src/commands/registerDevlog.ts
|
|
@@ -6661,7 +6717,7 @@ function registerDevlog(program2) {
|
|
|
6661
6717
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
6662
6718
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
6663
6719
|
import { join as join23 } from "path";
|
|
6664
|
-
import
|
|
6720
|
+
import chalk84 from "chalk";
|
|
6665
6721
|
|
|
6666
6722
|
// src/shared/findRepoRoot.ts
|
|
6667
6723
|
import { existsSync as existsSync24 } from "fs";
|
|
@@ -6724,14 +6780,14 @@ function checkBuildLocks(startDir) {
|
|
|
6724
6780
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
6725
6781
|
if (locked) {
|
|
6726
6782
|
console.error(
|
|
6727
|
-
|
|
6783
|
+
chalk84.red("Build output locked (is VS debugging?): ") + locked
|
|
6728
6784
|
);
|
|
6729
6785
|
process.exit(1);
|
|
6730
6786
|
}
|
|
6731
6787
|
}
|
|
6732
6788
|
async function checkBuildLocksCommand() {
|
|
6733
6789
|
checkBuildLocks();
|
|
6734
|
-
console.log(
|
|
6790
|
+
console.log(chalk84.green("No build locks detected"));
|
|
6735
6791
|
}
|
|
6736
6792
|
|
|
6737
6793
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -6830,30 +6886,30 @@ function escapeRegex(s) {
|
|
|
6830
6886
|
}
|
|
6831
6887
|
|
|
6832
6888
|
// src/commands/dotnet/printTree.ts
|
|
6833
|
-
import
|
|
6889
|
+
import chalk85 from "chalk";
|
|
6834
6890
|
function printNodes(nodes, prefix2) {
|
|
6835
6891
|
for (let i = 0; i < nodes.length; i++) {
|
|
6836
6892
|
const isLast = i === nodes.length - 1;
|
|
6837
6893
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
6838
6894
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
6839
6895
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
6840
|
-
const label2 = isMissing ?
|
|
6896
|
+
const label2 = isMissing ? chalk85.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
6841
6897
|
console.log(`${prefix2}${connector}${label2}`);
|
|
6842
6898
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
6843
6899
|
}
|
|
6844
6900
|
}
|
|
6845
6901
|
function printTree(tree, totalCount, solutions) {
|
|
6846
|
-
console.log(
|
|
6847
|
-
console.log(
|
|
6902
|
+
console.log(chalk85.bold("\nProject Dependency Tree"));
|
|
6903
|
+
console.log(chalk85.cyan(tree.relativePath));
|
|
6848
6904
|
printNodes(tree.children, "");
|
|
6849
|
-
console.log(
|
|
6905
|
+
console.log(chalk85.dim(`
|
|
6850
6906
|
${totalCount} projects total (including root)`));
|
|
6851
|
-
console.log(
|
|
6907
|
+
console.log(chalk85.bold("\nSolution Membership"));
|
|
6852
6908
|
if (solutions.length === 0) {
|
|
6853
|
-
console.log(
|
|
6909
|
+
console.log(chalk85.yellow(" Not found in any .sln"));
|
|
6854
6910
|
} else {
|
|
6855
6911
|
for (const sln of solutions) {
|
|
6856
|
-
console.log(` ${
|
|
6912
|
+
console.log(` ${chalk85.green(sln)}`);
|
|
6857
6913
|
}
|
|
6858
6914
|
}
|
|
6859
6915
|
console.log();
|
|
@@ -6882,16 +6938,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
6882
6938
|
// src/commands/dotnet/resolveCsproj.ts
|
|
6883
6939
|
import { existsSync as existsSync25 } from "fs";
|
|
6884
6940
|
import path24 from "path";
|
|
6885
|
-
import
|
|
6941
|
+
import chalk86 from "chalk";
|
|
6886
6942
|
function resolveCsproj(csprojPath) {
|
|
6887
6943
|
const resolved = path24.resolve(csprojPath);
|
|
6888
6944
|
if (!existsSync25(resolved)) {
|
|
6889
|
-
console.error(
|
|
6945
|
+
console.error(chalk86.red(`File not found: ${resolved}`));
|
|
6890
6946
|
process.exit(1);
|
|
6891
6947
|
}
|
|
6892
6948
|
const repoRoot = findRepoRoot(path24.dirname(resolved));
|
|
6893
6949
|
if (!repoRoot) {
|
|
6894
|
-
console.error(
|
|
6950
|
+
console.error(chalk86.red("Could not find git repository root"));
|
|
6895
6951
|
process.exit(1);
|
|
6896
6952
|
}
|
|
6897
6953
|
return { resolved, repoRoot };
|
|
@@ -6941,12 +6997,12 @@ function getChangedCsFiles(scope) {
|
|
|
6941
6997
|
}
|
|
6942
6998
|
|
|
6943
6999
|
// src/commands/dotnet/inSln.ts
|
|
6944
|
-
import
|
|
7000
|
+
import chalk87 from "chalk";
|
|
6945
7001
|
async function inSln(csprojPath) {
|
|
6946
7002
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
6947
7003
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
6948
7004
|
if (solutions.length === 0) {
|
|
6949
|
-
console.log(
|
|
7005
|
+
console.log(chalk87.yellow("Not found in any .sln file"));
|
|
6950
7006
|
process.exit(1);
|
|
6951
7007
|
}
|
|
6952
7008
|
for (const sln of solutions) {
|
|
@@ -6955,7 +7011,7 @@ async function inSln(csprojPath) {
|
|
|
6955
7011
|
}
|
|
6956
7012
|
|
|
6957
7013
|
// src/commands/dotnet/inspect.ts
|
|
6958
|
-
import
|
|
7014
|
+
import chalk93 from "chalk";
|
|
6959
7015
|
|
|
6960
7016
|
// src/shared/formatElapsed.ts
|
|
6961
7017
|
function formatElapsed(ms) {
|
|
@@ -6967,12 +7023,12 @@ function formatElapsed(ms) {
|
|
|
6967
7023
|
}
|
|
6968
7024
|
|
|
6969
7025
|
// src/commands/dotnet/displayIssues.ts
|
|
6970
|
-
import
|
|
7026
|
+
import chalk88 from "chalk";
|
|
6971
7027
|
var SEVERITY_COLOR = {
|
|
6972
|
-
ERROR:
|
|
6973
|
-
WARNING:
|
|
6974
|
-
SUGGESTION:
|
|
6975
|
-
HINT:
|
|
7028
|
+
ERROR: chalk88.red,
|
|
7029
|
+
WARNING: chalk88.yellow,
|
|
7030
|
+
SUGGESTION: chalk88.cyan,
|
|
7031
|
+
HINT: chalk88.dim
|
|
6976
7032
|
};
|
|
6977
7033
|
function groupByFile(issues) {
|
|
6978
7034
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -6988,15 +7044,15 @@ function groupByFile(issues) {
|
|
|
6988
7044
|
}
|
|
6989
7045
|
function displayIssues(issues) {
|
|
6990
7046
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
6991
|
-
console.log(
|
|
7047
|
+
console.log(chalk88.bold(file));
|
|
6992
7048
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
6993
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
7049
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk88.white;
|
|
6994
7050
|
console.log(
|
|
6995
|
-
` ${
|
|
7051
|
+
` ${chalk88.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
6996
7052
|
);
|
|
6997
7053
|
}
|
|
6998
7054
|
}
|
|
6999
|
-
console.log(
|
|
7055
|
+
console.log(chalk88.dim(`
|
|
7000
7056
|
${issues.length} issue(s) found`));
|
|
7001
7057
|
}
|
|
7002
7058
|
|
|
@@ -7055,12 +7111,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
7055
7111
|
// src/commands/dotnet/resolveSolution.ts
|
|
7056
7112
|
import { existsSync as existsSync26 } from "fs";
|
|
7057
7113
|
import path25 from "path";
|
|
7058
|
-
import
|
|
7114
|
+
import chalk90 from "chalk";
|
|
7059
7115
|
|
|
7060
7116
|
// src/commands/dotnet/findSolution.ts
|
|
7061
7117
|
import { readdirSync as readdirSync4 } from "fs";
|
|
7062
7118
|
import { dirname as dirname16, join as join24 } from "path";
|
|
7063
|
-
import
|
|
7119
|
+
import chalk89 from "chalk";
|
|
7064
7120
|
function findSlnInDir(dir) {
|
|
7065
7121
|
try {
|
|
7066
7122
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join24(dir, f));
|
|
@@ -7076,17 +7132,17 @@ function findSolution() {
|
|
|
7076
7132
|
const slnFiles = findSlnInDir(current);
|
|
7077
7133
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
7078
7134
|
if (slnFiles.length > 1) {
|
|
7079
|
-
console.error(
|
|
7135
|
+
console.error(chalk89.red(`Multiple .sln files found in ${current}:`));
|
|
7080
7136
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
7081
7137
|
console.error(
|
|
7082
|
-
|
|
7138
|
+
chalk89.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
7083
7139
|
);
|
|
7084
7140
|
process.exit(1);
|
|
7085
7141
|
}
|
|
7086
7142
|
if (current === ceiling) break;
|
|
7087
7143
|
current = dirname16(current);
|
|
7088
7144
|
}
|
|
7089
|
-
console.error(
|
|
7145
|
+
console.error(chalk89.red("No .sln file found between cwd and repo root"));
|
|
7090
7146
|
process.exit(1);
|
|
7091
7147
|
}
|
|
7092
7148
|
|
|
@@ -7095,7 +7151,7 @@ function resolveSolution(sln) {
|
|
|
7095
7151
|
if (sln) {
|
|
7096
7152
|
const resolved = path25.resolve(sln);
|
|
7097
7153
|
if (!existsSync26(resolved)) {
|
|
7098
|
-
console.error(
|
|
7154
|
+
console.error(chalk90.red(`Solution file not found: ${resolved}`));
|
|
7099
7155
|
process.exit(1);
|
|
7100
7156
|
}
|
|
7101
7157
|
return resolved;
|
|
@@ -7137,14 +7193,14 @@ import { execSync as execSync24 } from "child_process";
|
|
|
7137
7193
|
import { existsSync as existsSync27, readFileSync as readFileSync24, unlinkSync as unlinkSync5 } from "fs";
|
|
7138
7194
|
import { tmpdir as tmpdir2 } from "os";
|
|
7139
7195
|
import path26 from "path";
|
|
7140
|
-
import
|
|
7196
|
+
import chalk91 from "chalk";
|
|
7141
7197
|
function assertJbInstalled() {
|
|
7142
7198
|
try {
|
|
7143
7199
|
execSync24("jb inspectcode --version", { stdio: "pipe" });
|
|
7144
7200
|
} catch {
|
|
7145
|
-
console.error(
|
|
7201
|
+
console.error(chalk91.red("jb is not installed. Install with:"));
|
|
7146
7202
|
console.error(
|
|
7147
|
-
|
|
7203
|
+
chalk91.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
7148
7204
|
);
|
|
7149
7205
|
process.exit(1);
|
|
7150
7206
|
}
|
|
@@ -7162,11 +7218,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
7162
7218
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
7163
7219
|
process.stderr.write(err.stderr);
|
|
7164
7220
|
}
|
|
7165
|
-
console.error(
|
|
7221
|
+
console.error(chalk91.red("jb inspectcode failed"));
|
|
7166
7222
|
process.exit(1);
|
|
7167
7223
|
}
|
|
7168
7224
|
if (!existsSync27(reportPath)) {
|
|
7169
|
-
console.error(
|
|
7225
|
+
console.error(chalk91.red("Report file not generated"));
|
|
7170
7226
|
process.exit(1);
|
|
7171
7227
|
}
|
|
7172
7228
|
const xml = readFileSync24(reportPath, "utf-8");
|
|
@@ -7176,7 +7232,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
7176
7232
|
|
|
7177
7233
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
7178
7234
|
import { execSync as execSync25 } from "child_process";
|
|
7179
|
-
import
|
|
7235
|
+
import chalk92 from "chalk";
|
|
7180
7236
|
function resolveMsbuildPath() {
|
|
7181
7237
|
const config = loadConfig();
|
|
7182
7238
|
const buildConfig = config.run?.find((r) => r.name === "build");
|
|
@@ -7187,9 +7243,9 @@ function assertMsbuildInstalled() {
|
|
|
7187
7243
|
try {
|
|
7188
7244
|
execSync25(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
7189
7245
|
} catch {
|
|
7190
|
-
console.error(
|
|
7246
|
+
console.error(chalk92.red(`msbuild not found at: ${msbuild}`));
|
|
7191
7247
|
console.error(
|
|
7192
|
-
|
|
7248
|
+
chalk92.yellow(
|
|
7193
7249
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
7194
7250
|
)
|
|
7195
7251
|
);
|
|
@@ -7236,17 +7292,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
7236
7292
|
// src/commands/dotnet/inspect.ts
|
|
7237
7293
|
function logScope(changedFiles) {
|
|
7238
7294
|
if (changedFiles === null) {
|
|
7239
|
-
console.log(
|
|
7295
|
+
console.log(chalk93.dim("Inspecting full solution..."));
|
|
7240
7296
|
} else {
|
|
7241
7297
|
console.log(
|
|
7242
|
-
|
|
7298
|
+
chalk93.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
7243
7299
|
);
|
|
7244
7300
|
}
|
|
7245
7301
|
}
|
|
7246
7302
|
function reportResults(issues, elapsed) {
|
|
7247
7303
|
if (issues.length > 0) displayIssues(issues);
|
|
7248
|
-
else console.log(
|
|
7249
|
-
console.log(
|
|
7304
|
+
else console.log(chalk93.green("No issues found"));
|
|
7305
|
+
console.log(chalk93.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
7250
7306
|
if (issues.length > 0) process.exit(1);
|
|
7251
7307
|
}
|
|
7252
7308
|
async function inspect(sln, options2) {
|
|
@@ -7257,7 +7313,7 @@ async function inspect(sln, options2) {
|
|
|
7257
7313
|
const scope = parseScope(options2.scope);
|
|
7258
7314
|
const changedFiles = getChangedCsFiles(scope);
|
|
7259
7315
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
7260
|
-
console.log(
|
|
7316
|
+
console.log(chalk93.green("No changed .cs files found"));
|
|
7261
7317
|
return;
|
|
7262
7318
|
}
|
|
7263
7319
|
logScope(changedFiles);
|
|
@@ -7283,7 +7339,7 @@ function registerDotnet(program2) {
|
|
|
7283
7339
|
}
|
|
7284
7340
|
|
|
7285
7341
|
// src/commands/jira/acceptanceCriteria.ts
|
|
7286
|
-
import
|
|
7342
|
+
import chalk95 from "chalk";
|
|
7287
7343
|
|
|
7288
7344
|
// src/commands/jira/adfToText.ts
|
|
7289
7345
|
function renderInline(node) {
|
|
@@ -7344,7 +7400,7 @@ function adfToText(doc) {
|
|
|
7344
7400
|
|
|
7345
7401
|
// src/commands/jira/fetchIssue.ts
|
|
7346
7402
|
import { execSync as execSync26 } from "child_process";
|
|
7347
|
-
import
|
|
7403
|
+
import chalk94 from "chalk";
|
|
7348
7404
|
function fetchIssue(issueKey, fields) {
|
|
7349
7405
|
let result;
|
|
7350
7406
|
try {
|
|
@@ -7357,15 +7413,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
7357
7413
|
const stderr = error.stderr;
|
|
7358
7414
|
if (stderr.includes("unauthorized")) {
|
|
7359
7415
|
console.error(
|
|
7360
|
-
|
|
7416
|
+
chalk94.red("Jira authentication expired."),
|
|
7361
7417
|
"Run",
|
|
7362
|
-
|
|
7418
|
+
chalk94.cyan("assist jira auth"),
|
|
7363
7419
|
"to re-authenticate."
|
|
7364
7420
|
);
|
|
7365
7421
|
process.exit(1);
|
|
7366
7422
|
}
|
|
7367
7423
|
}
|
|
7368
|
-
console.error(
|
|
7424
|
+
console.error(chalk94.red(`Failed to fetch ${issueKey}.`));
|
|
7369
7425
|
process.exit(1);
|
|
7370
7426
|
}
|
|
7371
7427
|
return JSON.parse(result);
|
|
@@ -7379,7 +7435,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
7379
7435
|
const parsed = fetchIssue(issueKey, field);
|
|
7380
7436
|
const acValue = parsed?.fields?.[field];
|
|
7381
7437
|
if (!acValue) {
|
|
7382
|
-
console.log(
|
|
7438
|
+
console.log(chalk95.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
7383
7439
|
return;
|
|
7384
7440
|
}
|
|
7385
7441
|
if (typeof acValue === "string") {
|
|
@@ -7474,14 +7530,14 @@ async function jiraAuth() {
|
|
|
7474
7530
|
}
|
|
7475
7531
|
|
|
7476
7532
|
// src/commands/jira/viewIssue.ts
|
|
7477
|
-
import
|
|
7533
|
+
import chalk96 from "chalk";
|
|
7478
7534
|
function viewIssue(issueKey) {
|
|
7479
7535
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
7480
7536
|
const fields = parsed?.fields;
|
|
7481
7537
|
const summary = fields?.summary;
|
|
7482
7538
|
const description = fields?.description;
|
|
7483
7539
|
if (summary) {
|
|
7484
|
-
console.log(
|
|
7540
|
+
console.log(chalk96.bold(summary));
|
|
7485
7541
|
}
|
|
7486
7542
|
if (description) {
|
|
7487
7543
|
if (summary) console.log();
|
|
@@ -7495,7 +7551,7 @@ function viewIssue(issueKey) {
|
|
|
7495
7551
|
}
|
|
7496
7552
|
if (!summary && !description) {
|
|
7497
7553
|
console.log(
|
|
7498
|
-
|
|
7554
|
+
chalk96.yellow(`No summary or description found on ${issueKey}.`)
|
|
7499
7555
|
);
|
|
7500
7556
|
}
|
|
7501
7557
|
}
|
|
@@ -7509,7 +7565,7 @@ function registerJira(program2) {
|
|
|
7509
7565
|
}
|
|
7510
7566
|
|
|
7511
7567
|
// src/commands/news/add/index.ts
|
|
7512
|
-
import
|
|
7568
|
+
import chalk97 from "chalk";
|
|
7513
7569
|
import enquirer8 from "enquirer";
|
|
7514
7570
|
async function add2(url) {
|
|
7515
7571
|
if (!url) {
|
|
@@ -7532,17 +7588,17 @@ async function add2(url) {
|
|
|
7532
7588
|
const news = config.news ?? {};
|
|
7533
7589
|
const feeds = news.feeds ?? [];
|
|
7534
7590
|
if (feeds.includes(url)) {
|
|
7535
|
-
console.log(
|
|
7591
|
+
console.log(chalk97.yellow("Feed already exists in config"));
|
|
7536
7592
|
return;
|
|
7537
7593
|
}
|
|
7538
7594
|
feeds.push(url);
|
|
7539
7595
|
config.news = { ...news, feeds };
|
|
7540
7596
|
saveGlobalConfig(config);
|
|
7541
|
-
console.log(
|
|
7597
|
+
console.log(chalk97.green(`Added feed: ${url}`));
|
|
7542
7598
|
}
|
|
7543
7599
|
|
|
7544
7600
|
// src/commands/news/web/handleRequest.ts
|
|
7545
|
-
import
|
|
7601
|
+
import chalk98 from "chalk";
|
|
7546
7602
|
|
|
7547
7603
|
// src/commands/news/web/shared.ts
|
|
7548
7604
|
import { decodeHTML } from "entities";
|
|
@@ -7678,17 +7734,17 @@ function prefetch() {
|
|
|
7678
7734
|
const config = loadConfig();
|
|
7679
7735
|
const total = config.news.feeds.length;
|
|
7680
7736
|
if (total === 0) return;
|
|
7681
|
-
process.stdout.write(
|
|
7737
|
+
process.stdout.write(chalk98.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
7682
7738
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
7683
7739
|
const width = 20;
|
|
7684
7740
|
const filled = Math.round(done2 / t * width);
|
|
7685
7741
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
7686
7742
|
process.stdout.write(
|
|
7687
|
-
`\r${
|
|
7743
|
+
`\r${chalk98.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
7688
7744
|
);
|
|
7689
7745
|
}).then((items) => {
|
|
7690
7746
|
process.stdout.write(
|
|
7691
|
-
`\r${
|
|
7747
|
+
`\r${chalk98.green(`Fetched ${items.length} items from ${total} feed(s)`)}
|
|
7692
7748
|
`
|
|
7693
7749
|
);
|
|
7694
7750
|
cachedItems = items;
|
|
@@ -8049,20 +8105,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
8049
8105
|
}
|
|
8050
8106
|
|
|
8051
8107
|
// src/commands/prs/listComments/printComments.ts
|
|
8052
|
-
import
|
|
8108
|
+
import chalk99 from "chalk";
|
|
8053
8109
|
function formatForHuman(comment3) {
|
|
8054
8110
|
if (comment3.type === "review") {
|
|
8055
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
8111
|
+
const stateColor = comment3.state === "APPROVED" ? chalk99.green : comment3.state === "CHANGES_REQUESTED" ? chalk99.red : chalk99.yellow;
|
|
8056
8112
|
return [
|
|
8057
|
-
`${
|
|
8113
|
+
`${chalk99.cyan("Review")} by ${chalk99.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
8058
8114
|
comment3.body,
|
|
8059
8115
|
""
|
|
8060
8116
|
].join("\n");
|
|
8061
8117
|
}
|
|
8062
8118
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
8063
8119
|
return [
|
|
8064
|
-
`${
|
|
8065
|
-
|
|
8120
|
+
`${chalk99.cyan("Line comment")} by ${chalk99.bold(comment3.user)} on ${chalk99.dim(`${comment3.path}${location}`)}`,
|
|
8121
|
+
chalk99.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
8066
8122
|
comment3.body,
|
|
8067
8123
|
""
|
|
8068
8124
|
].join("\n");
|
|
@@ -8152,13 +8208,13 @@ import { execSync as execSync33 } from "child_process";
|
|
|
8152
8208
|
import enquirer9 from "enquirer";
|
|
8153
8209
|
|
|
8154
8210
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
8155
|
-
import
|
|
8211
|
+
import chalk100 from "chalk";
|
|
8156
8212
|
var STATUS_MAP = {
|
|
8157
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
8158
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
8213
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk100.magenta("merged"), date: pr.mergedAt } : null,
|
|
8214
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk100.red("closed"), date: pr.closedAt } : null
|
|
8159
8215
|
};
|
|
8160
8216
|
function defaultStatus(pr) {
|
|
8161
|
-
return { label:
|
|
8217
|
+
return { label: chalk100.green("opened"), date: pr.createdAt };
|
|
8162
8218
|
}
|
|
8163
8219
|
function getStatus2(pr) {
|
|
8164
8220
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -8167,11 +8223,11 @@ function formatDate(dateStr) {
|
|
|
8167
8223
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
8168
8224
|
}
|
|
8169
8225
|
function formatPrHeader(pr, status2) {
|
|
8170
|
-
return `${
|
|
8226
|
+
return `${chalk100.cyan(`#${pr.number}`)} ${pr.title} ${chalk100.dim(`(${pr.author.login},`)} ${status2.label} ${chalk100.dim(`${formatDate(status2.date)})`)}`;
|
|
8171
8227
|
}
|
|
8172
8228
|
function logPrDetails(pr) {
|
|
8173
8229
|
console.log(
|
|
8174
|
-
|
|
8230
|
+
chalk100.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
8175
8231
|
);
|
|
8176
8232
|
console.log();
|
|
8177
8233
|
}
|
|
@@ -8337,10 +8393,10 @@ function registerPrs(program2) {
|
|
|
8337
8393
|
}
|
|
8338
8394
|
|
|
8339
8395
|
// src/commands/ravendb/ravendbAuth.ts
|
|
8340
|
-
import
|
|
8396
|
+
import chalk106 from "chalk";
|
|
8341
8397
|
|
|
8342
8398
|
// src/shared/createConnectionAuth.ts
|
|
8343
|
-
import
|
|
8399
|
+
import chalk101 from "chalk";
|
|
8344
8400
|
function listConnections(connections, format2) {
|
|
8345
8401
|
if (connections.length === 0) {
|
|
8346
8402
|
console.log("No connections configured.");
|
|
@@ -8353,7 +8409,7 @@ function listConnections(connections, format2) {
|
|
|
8353
8409
|
function removeConnection(connections, name, save) {
|
|
8354
8410
|
const filtered = connections.filter((c) => c.name !== name);
|
|
8355
8411
|
if (filtered.length === connections.length) {
|
|
8356
|
-
console.error(
|
|
8412
|
+
console.error(chalk101.red(`Connection "${name}" not found.`));
|
|
8357
8413
|
process.exit(1);
|
|
8358
8414
|
}
|
|
8359
8415
|
save(filtered);
|
|
@@ -8399,15 +8455,15 @@ function saveConnections(connections) {
|
|
|
8399
8455
|
}
|
|
8400
8456
|
|
|
8401
8457
|
// src/commands/ravendb/promptConnection.ts
|
|
8402
|
-
import
|
|
8458
|
+
import chalk104 from "chalk";
|
|
8403
8459
|
|
|
8404
8460
|
// src/commands/ravendb/selectOpSecret.ts
|
|
8405
|
-
import
|
|
8461
|
+
import chalk103 from "chalk";
|
|
8406
8462
|
import Enquirer2 from "enquirer";
|
|
8407
8463
|
|
|
8408
8464
|
// src/commands/ravendb/searchItems.ts
|
|
8409
8465
|
import { execSync as execSync35 } from "child_process";
|
|
8410
|
-
import
|
|
8466
|
+
import chalk102 from "chalk";
|
|
8411
8467
|
function opExec(args) {
|
|
8412
8468
|
return execSync35(`op ${args}`, {
|
|
8413
8469
|
encoding: "utf-8",
|
|
@@ -8420,7 +8476,7 @@ function searchItems(search2) {
|
|
|
8420
8476
|
items = JSON.parse(opExec("item list --format=json"));
|
|
8421
8477
|
} catch {
|
|
8422
8478
|
console.error(
|
|
8423
|
-
|
|
8479
|
+
chalk102.red(
|
|
8424
8480
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
8425
8481
|
)
|
|
8426
8482
|
);
|
|
@@ -8434,7 +8490,7 @@ function getItemFields(itemId) {
|
|
|
8434
8490
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
8435
8491
|
return item.fields.filter((f) => f.reference && f.label);
|
|
8436
8492
|
} catch {
|
|
8437
|
-
console.error(
|
|
8493
|
+
console.error(chalk102.red("Failed to get item details from 1Password."));
|
|
8438
8494
|
process.exit(1);
|
|
8439
8495
|
}
|
|
8440
8496
|
}
|
|
@@ -8453,7 +8509,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
8453
8509
|
}).run();
|
|
8454
8510
|
const items = searchItems(search2);
|
|
8455
8511
|
if (items.length === 0) {
|
|
8456
|
-
console.error(
|
|
8512
|
+
console.error(chalk103.red(`No items found matching "${search2}".`));
|
|
8457
8513
|
process.exit(1);
|
|
8458
8514
|
}
|
|
8459
8515
|
const itemId = await selectOne(
|
|
@@ -8462,7 +8518,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
8462
8518
|
);
|
|
8463
8519
|
const fields = getItemFields(itemId);
|
|
8464
8520
|
if (fields.length === 0) {
|
|
8465
|
-
console.error(
|
|
8521
|
+
console.error(chalk103.red("No fields with references found on this item."));
|
|
8466
8522
|
process.exit(1);
|
|
8467
8523
|
}
|
|
8468
8524
|
const ref = await selectOne(
|
|
@@ -8476,7 +8532,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
8476
8532
|
async function promptConnection(existingNames) {
|
|
8477
8533
|
const name = await promptInput("name", "Connection name:");
|
|
8478
8534
|
if (existingNames.includes(name)) {
|
|
8479
|
-
console.error(
|
|
8535
|
+
console.error(chalk104.red(`Connection "${name}" already exists.`));
|
|
8480
8536
|
process.exit(1);
|
|
8481
8537
|
}
|
|
8482
8538
|
const url = await promptInput(
|
|
@@ -8485,22 +8541,22 @@ async function promptConnection(existingNames) {
|
|
|
8485
8541
|
);
|
|
8486
8542
|
const database = await promptInput("database", "Database name:");
|
|
8487
8543
|
if (!name || !url || !database) {
|
|
8488
|
-
console.error(
|
|
8544
|
+
console.error(chalk104.red("All fields are required."));
|
|
8489
8545
|
process.exit(1);
|
|
8490
8546
|
}
|
|
8491
8547
|
const apiKeyRef = await selectOpSecret();
|
|
8492
|
-
console.log(
|
|
8548
|
+
console.log(chalk104.dim(`Using: ${apiKeyRef}`));
|
|
8493
8549
|
return { name, url, database, apiKeyRef };
|
|
8494
8550
|
}
|
|
8495
8551
|
|
|
8496
8552
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
8497
|
-
import
|
|
8553
|
+
import chalk105 from "chalk";
|
|
8498
8554
|
function ravendbSetConnection(name) {
|
|
8499
8555
|
const raw = loadGlobalConfigRaw();
|
|
8500
8556
|
const ravendb = raw.ravendb ?? {};
|
|
8501
8557
|
const connections = ravendb.connections ?? [];
|
|
8502
8558
|
if (!connections.some((c) => c.name === name)) {
|
|
8503
|
-
console.error(
|
|
8559
|
+
console.error(chalk105.red(`Connection "${name}" not found.`));
|
|
8504
8560
|
console.error(
|
|
8505
8561
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
8506
8562
|
);
|
|
@@ -8516,16 +8572,16 @@ function ravendbSetConnection(name) {
|
|
|
8516
8572
|
var ravendbAuth = createConnectionAuth({
|
|
8517
8573
|
load: loadConnections,
|
|
8518
8574
|
save: saveConnections,
|
|
8519
|
-
format: (c) => `${
|
|
8575
|
+
format: (c) => `${chalk106.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
8520
8576
|
promptNew: promptConnection,
|
|
8521
8577
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
8522
8578
|
});
|
|
8523
8579
|
|
|
8524
8580
|
// src/commands/ravendb/ravendbCollections.ts
|
|
8525
|
-
import
|
|
8581
|
+
import chalk110 from "chalk";
|
|
8526
8582
|
|
|
8527
8583
|
// src/commands/ravendb/ravenFetch.ts
|
|
8528
|
-
import
|
|
8584
|
+
import chalk108 from "chalk";
|
|
8529
8585
|
|
|
8530
8586
|
// src/commands/ravendb/getAccessToken.ts
|
|
8531
8587
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -8562,10 +8618,10 @@ ${errorText}`
|
|
|
8562
8618
|
|
|
8563
8619
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
8564
8620
|
import { execSync as execSync36 } from "child_process";
|
|
8565
|
-
import
|
|
8621
|
+
import chalk107 from "chalk";
|
|
8566
8622
|
function resolveOpSecret(reference) {
|
|
8567
8623
|
if (!reference.startsWith("op://")) {
|
|
8568
|
-
console.error(
|
|
8624
|
+
console.error(chalk107.red(`Invalid secret reference: must start with op://`));
|
|
8569
8625
|
process.exit(1);
|
|
8570
8626
|
}
|
|
8571
8627
|
try {
|
|
@@ -8575,7 +8631,7 @@ function resolveOpSecret(reference) {
|
|
|
8575
8631
|
}).trim();
|
|
8576
8632
|
} catch {
|
|
8577
8633
|
console.error(
|
|
8578
|
-
|
|
8634
|
+
chalk107.red(
|
|
8579
8635
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
8580
8636
|
)
|
|
8581
8637
|
);
|
|
@@ -8602,7 +8658,7 @@ async function ravenFetch(connection, path50) {
|
|
|
8602
8658
|
if (!response.ok) {
|
|
8603
8659
|
const body = await response.text();
|
|
8604
8660
|
console.error(
|
|
8605
|
-
|
|
8661
|
+
chalk108.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
8606
8662
|
);
|
|
8607
8663
|
console.error(body.substring(0, 500));
|
|
8608
8664
|
process.exit(1);
|
|
@@ -8611,7 +8667,7 @@ async function ravenFetch(connection, path50) {
|
|
|
8611
8667
|
}
|
|
8612
8668
|
|
|
8613
8669
|
// src/commands/ravendb/resolveConnection.ts
|
|
8614
|
-
import
|
|
8670
|
+
import chalk109 from "chalk";
|
|
8615
8671
|
function loadRavendb() {
|
|
8616
8672
|
const raw = loadGlobalConfigRaw();
|
|
8617
8673
|
const ravendb = raw.ravendb;
|
|
@@ -8625,7 +8681,7 @@ function resolveConnection(name) {
|
|
|
8625
8681
|
const connectionName = name ?? defaultConnection;
|
|
8626
8682
|
if (!connectionName) {
|
|
8627
8683
|
console.error(
|
|
8628
|
-
|
|
8684
|
+
chalk109.red(
|
|
8629
8685
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
8630
8686
|
)
|
|
8631
8687
|
);
|
|
@@ -8633,7 +8689,7 @@ function resolveConnection(name) {
|
|
|
8633
8689
|
}
|
|
8634
8690
|
const connection = connections.find((c) => c.name === connectionName);
|
|
8635
8691
|
if (!connection) {
|
|
8636
|
-
console.error(
|
|
8692
|
+
console.error(chalk109.red(`Connection "${connectionName}" not found.`));
|
|
8637
8693
|
console.error(
|
|
8638
8694
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
8639
8695
|
);
|
|
@@ -8664,15 +8720,15 @@ async function ravendbCollections(connectionName) {
|
|
|
8664
8720
|
return;
|
|
8665
8721
|
}
|
|
8666
8722
|
for (const c of collections) {
|
|
8667
|
-
console.log(`${
|
|
8723
|
+
console.log(`${chalk110.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
8668
8724
|
}
|
|
8669
8725
|
}
|
|
8670
8726
|
|
|
8671
8727
|
// src/commands/ravendb/ravendbQuery.ts
|
|
8672
|
-
import
|
|
8728
|
+
import chalk112 from "chalk";
|
|
8673
8729
|
|
|
8674
8730
|
// src/commands/ravendb/fetchAllPages.ts
|
|
8675
|
-
import
|
|
8731
|
+
import chalk111 from "chalk";
|
|
8676
8732
|
|
|
8677
8733
|
// src/commands/ravendb/buildQueryPath.ts
|
|
8678
8734
|
function buildQueryPath(opts) {
|
|
@@ -8710,7 +8766,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
8710
8766
|
allResults.push(...results);
|
|
8711
8767
|
start3 += results.length;
|
|
8712
8768
|
process.stderr.write(
|
|
8713
|
-
`\r${
|
|
8769
|
+
`\r${chalk111.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
8714
8770
|
);
|
|
8715
8771
|
if (start3 >= totalResults) break;
|
|
8716
8772
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -8725,7 +8781,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
8725
8781
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
8726
8782
|
const resolved = resolveArgs(connectionName, collection);
|
|
8727
8783
|
if (!resolved.collection && !options2.query) {
|
|
8728
|
-
console.error(
|
|
8784
|
+
console.error(chalk112.red("Provide a collection name or --query filter."));
|
|
8729
8785
|
process.exit(1);
|
|
8730
8786
|
}
|
|
8731
8787
|
const { collection: col } = resolved;
|
|
@@ -8763,7 +8819,7 @@ import { spawn as spawn4 } from "child_process";
|
|
|
8763
8819
|
import * as path27 from "path";
|
|
8764
8820
|
|
|
8765
8821
|
// src/commands/refactor/logViolations.ts
|
|
8766
|
-
import
|
|
8822
|
+
import chalk113 from "chalk";
|
|
8767
8823
|
var DEFAULT_MAX_LINES = 100;
|
|
8768
8824
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
8769
8825
|
if (violations.length === 0) {
|
|
@@ -8772,43 +8828,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
8772
8828
|
}
|
|
8773
8829
|
return;
|
|
8774
8830
|
}
|
|
8775
|
-
console.error(
|
|
8831
|
+
console.error(chalk113.red(`
|
|
8776
8832
|
Refactor check failed:
|
|
8777
8833
|
`));
|
|
8778
|
-
console.error(
|
|
8834
|
+
console.error(chalk113.red(` The following files exceed ${maxLines} lines:
|
|
8779
8835
|
`));
|
|
8780
8836
|
for (const violation of violations) {
|
|
8781
|
-
console.error(
|
|
8837
|
+
console.error(chalk113.red(` ${violation.file} (${violation.lines} lines)`));
|
|
8782
8838
|
}
|
|
8783
8839
|
console.error(
|
|
8784
|
-
|
|
8840
|
+
chalk113.yellow(
|
|
8785
8841
|
`
|
|
8786
8842
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
8787
8843
|
way to refactor it, ignore it with:
|
|
8788
8844
|
`
|
|
8789
8845
|
)
|
|
8790
8846
|
);
|
|
8791
|
-
console.error(
|
|
8847
|
+
console.error(chalk113.gray(` assist refactor ignore <file>
|
|
8792
8848
|
`));
|
|
8793
8849
|
if (process.env.CLAUDECODE) {
|
|
8794
|
-
console.error(
|
|
8850
|
+
console.error(chalk113.cyan(`
|
|
8795
8851
|
## Extracting Code to New Files
|
|
8796
8852
|
`));
|
|
8797
8853
|
console.error(
|
|
8798
|
-
|
|
8854
|
+
chalk113.cyan(
|
|
8799
8855
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
8800
8856
|
`
|
|
8801
8857
|
)
|
|
8802
8858
|
);
|
|
8803
8859
|
console.error(
|
|
8804
|
-
|
|
8860
|
+
chalk113.cyan(
|
|
8805
8861
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
8806
8862
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
8807
8863
|
`
|
|
8808
8864
|
)
|
|
8809
8865
|
);
|
|
8810
8866
|
console.error(
|
|
8811
|
-
|
|
8867
|
+
chalk113.cyan(
|
|
8812
8868
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
8813
8869
|
domains, move it to a common/shared folder.
|
|
8814
8870
|
`
|
|
@@ -8964,7 +9020,7 @@ async function check(pattern2, options2) {
|
|
|
8964
9020
|
|
|
8965
9021
|
// src/commands/refactor/extract/index.ts
|
|
8966
9022
|
import path33 from "path";
|
|
8967
|
-
import
|
|
9023
|
+
import chalk116 from "chalk";
|
|
8968
9024
|
|
|
8969
9025
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
8970
9026
|
import { SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
@@ -9511,23 +9567,23 @@ function buildPlan(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
9511
9567
|
|
|
9512
9568
|
// src/commands/refactor/extract/displayPlan.ts
|
|
9513
9569
|
import path31 from "path";
|
|
9514
|
-
import
|
|
9570
|
+
import chalk114 from "chalk";
|
|
9515
9571
|
function section(title) {
|
|
9516
9572
|
return `
|
|
9517
|
-
${
|
|
9573
|
+
${chalk114.cyan(title)}`;
|
|
9518
9574
|
}
|
|
9519
9575
|
function displayImporters(plan2, cwd) {
|
|
9520
9576
|
if (plan2.importersToUpdate.length === 0) return;
|
|
9521
9577
|
console.log(section("Update importers:"));
|
|
9522
9578
|
for (const imp of plan2.importersToUpdate) {
|
|
9523
9579
|
const rel = path31.relative(cwd, imp.file.getFilePath());
|
|
9524
|
-
console.log(` ${
|
|
9580
|
+
console.log(` ${chalk114.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
9525
9581
|
}
|
|
9526
9582
|
}
|
|
9527
9583
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
9528
|
-
console.log(
|
|
9584
|
+
console.log(chalk114.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
9529
9585
|
`));
|
|
9530
|
-
console.log(` ${
|
|
9586
|
+
console.log(` ${chalk114.cyan("Functions to move:")}`);
|
|
9531
9587
|
for (const name of plan2.extractedNames) {
|
|
9532
9588
|
console.log(` ${name}`);
|
|
9533
9589
|
}
|
|
@@ -9562,7 +9618,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
9562
9618
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
9563
9619
|
import fs17 from "fs";
|
|
9564
9620
|
import path32 from "path";
|
|
9565
|
-
import
|
|
9621
|
+
import chalk115 from "chalk";
|
|
9566
9622
|
import { Project as Project2 } from "ts-morph";
|
|
9567
9623
|
function findTsConfig(sourcePath) {
|
|
9568
9624
|
const rootConfig = path32.resolve("tsconfig.json");
|
|
@@ -9593,7 +9649,7 @@ function loadProjectFile(file) {
|
|
|
9593
9649
|
});
|
|
9594
9650
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
9595
9651
|
if (!sourceFile) {
|
|
9596
|
-
console.log(
|
|
9652
|
+
console.log(chalk115.red(`File not found in project: ${file}`));
|
|
9597
9653
|
process.exit(1);
|
|
9598
9654
|
}
|
|
9599
9655
|
return { project, sourceFile };
|
|
@@ -9616,19 +9672,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
9616
9672
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
9617
9673
|
if (options2.apply) {
|
|
9618
9674
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
9619
|
-
console.log(
|
|
9675
|
+
console.log(chalk116.green("\nExtraction complete"));
|
|
9620
9676
|
} else {
|
|
9621
|
-
console.log(
|
|
9677
|
+
console.log(chalk116.dim("\nDry run. Use --apply to execute."));
|
|
9622
9678
|
}
|
|
9623
9679
|
}
|
|
9624
9680
|
|
|
9625
9681
|
// src/commands/refactor/ignore.ts
|
|
9626
9682
|
import fs18 from "fs";
|
|
9627
|
-
import
|
|
9683
|
+
import chalk117 from "chalk";
|
|
9628
9684
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
9629
9685
|
function ignore(file) {
|
|
9630
9686
|
if (!fs18.existsSync(file)) {
|
|
9631
|
-
console.error(
|
|
9687
|
+
console.error(chalk117.red(`Error: File does not exist: ${file}`));
|
|
9632
9688
|
process.exit(1);
|
|
9633
9689
|
}
|
|
9634
9690
|
const content = fs18.readFileSync(file, "utf-8");
|
|
@@ -9644,7 +9700,7 @@ function ignore(file) {
|
|
|
9644
9700
|
fs18.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
9645
9701
|
}
|
|
9646
9702
|
console.log(
|
|
9647
|
-
|
|
9703
|
+
chalk117.green(
|
|
9648
9704
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
9649
9705
|
)
|
|
9650
9706
|
);
|
|
@@ -9652,26 +9708,26 @@ function ignore(file) {
|
|
|
9652
9708
|
|
|
9653
9709
|
// src/commands/refactor/rename/index.ts
|
|
9654
9710
|
import path34 from "path";
|
|
9655
|
-
import
|
|
9711
|
+
import chalk118 from "chalk";
|
|
9656
9712
|
async function rename(source, destination, options2 = {}) {
|
|
9657
9713
|
const destPath = path34.resolve(destination);
|
|
9658
9714
|
const cwd = process.cwd();
|
|
9659
9715
|
const relSource = path34.relative(cwd, path34.resolve(source));
|
|
9660
9716
|
const relDest = path34.relative(cwd, destPath);
|
|
9661
9717
|
const { project, sourceFile } = loadProjectFile(source);
|
|
9662
|
-
console.log(
|
|
9718
|
+
console.log(chalk118.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
9663
9719
|
if (options2.apply) {
|
|
9664
9720
|
sourceFile.move(destPath);
|
|
9665
9721
|
await project.save();
|
|
9666
|
-
console.log(
|
|
9722
|
+
console.log(chalk118.green("Done"));
|
|
9667
9723
|
} else {
|
|
9668
|
-
console.log(
|
|
9724
|
+
console.log(chalk118.dim("Dry run. Use --apply to execute."));
|
|
9669
9725
|
}
|
|
9670
9726
|
}
|
|
9671
9727
|
|
|
9672
9728
|
// src/commands/refactor/renameSymbol/index.ts
|
|
9673
9729
|
import path36 from "path";
|
|
9674
|
-
import
|
|
9730
|
+
import chalk119 from "chalk";
|
|
9675
9731
|
import { Project as Project3 } from "ts-morph";
|
|
9676
9732
|
|
|
9677
9733
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
@@ -9720,38 +9776,38 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
9720
9776
|
const project = new Project3({ tsConfigFilePath: tsConfigPath });
|
|
9721
9777
|
const sourceFile = project.getSourceFile(filePath);
|
|
9722
9778
|
if (!sourceFile) {
|
|
9723
|
-
console.log(
|
|
9779
|
+
console.log(chalk119.red(`File not found in project: ${file}`));
|
|
9724
9780
|
process.exit(1);
|
|
9725
9781
|
}
|
|
9726
9782
|
const symbol = findSymbol(sourceFile, oldName);
|
|
9727
9783
|
if (!symbol) {
|
|
9728
|
-
console.log(
|
|
9784
|
+
console.log(chalk119.red(`Symbol "${oldName}" not found in ${file}`));
|
|
9729
9785
|
process.exit(1);
|
|
9730
9786
|
}
|
|
9731
9787
|
const grouped = groupReferences(symbol, cwd);
|
|
9732
9788
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
9733
9789
|
console.log(
|
|
9734
|
-
|
|
9790
|
+
chalk119.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
9735
9791
|
`)
|
|
9736
9792
|
);
|
|
9737
9793
|
for (const [refFile, lines] of grouped) {
|
|
9738
9794
|
console.log(
|
|
9739
|
-
` ${
|
|
9795
|
+
` ${chalk119.dim(refFile)}: lines ${chalk119.cyan(lines.join(", "))}`
|
|
9740
9796
|
);
|
|
9741
9797
|
}
|
|
9742
9798
|
if (options2.apply) {
|
|
9743
9799
|
symbol.rename(newName);
|
|
9744
9800
|
await project.save();
|
|
9745
|
-
console.log(
|
|
9801
|
+
console.log(chalk119.green(`
|
|
9746
9802
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
9747
9803
|
} else {
|
|
9748
|
-
console.log(
|
|
9804
|
+
console.log(chalk119.dim("\nDry run. Use --apply to execute."));
|
|
9749
9805
|
}
|
|
9750
9806
|
}
|
|
9751
9807
|
|
|
9752
9808
|
// src/commands/refactor/restructure/index.ts
|
|
9753
9809
|
import path45 from "path";
|
|
9754
|
-
import
|
|
9810
|
+
import chalk122 from "chalk";
|
|
9755
9811
|
|
|
9756
9812
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
9757
9813
|
import path37 from "path";
|
|
@@ -9994,50 +10050,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
9994
10050
|
|
|
9995
10051
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
9996
10052
|
import path41 from "path";
|
|
9997
|
-
import
|
|
10053
|
+
import chalk120 from "chalk";
|
|
9998
10054
|
function relPath(filePath) {
|
|
9999
10055
|
return path41.relative(process.cwd(), filePath);
|
|
10000
10056
|
}
|
|
10001
10057
|
function displayMoves(plan2) {
|
|
10002
10058
|
if (plan2.moves.length === 0) return;
|
|
10003
|
-
console.log(
|
|
10059
|
+
console.log(chalk120.bold("\nFile moves:"));
|
|
10004
10060
|
for (const move of plan2.moves) {
|
|
10005
10061
|
console.log(
|
|
10006
|
-
` ${
|
|
10062
|
+
` ${chalk120.red(relPath(move.from))} \u2192 ${chalk120.green(relPath(move.to))}`
|
|
10007
10063
|
);
|
|
10008
|
-
console.log(
|
|
10064
|
+
console.log(chalk120.dim(` ${move.reason}`));
|
|
10009
10065
|
}
|
|
10010
10066
|
}
|
|
10011
10067
|
function displayRewrites(rewrites) {
|
|
10012
10068
|
if (rewrites.length === 0) return;
|
|
10013
10069
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
10014
|
-
console.log(
|
|
10070
|
+
console.log(chalk120.bold(`
|
|
10015
10071
|
Import rewrites (${affectedFiles.size} files):`));
|
|
10016
10072
|
for (const file of affectedFiles) {
|
|
10017
|
-
console.log(` ${
|
|
10073
|
+
console.log(` ${chalk120.cyan(relPath(file))}:`);
|
|
10018
10074
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
10019
10075
|
(r) => r.file === file
|
|
10020
10076
|
)) {
|
|
10021
10077
|
console.log(
|
|
10022
|
-
` ${
|
|
10078
|
+
` ${chalk120.red(`"${oldSpecifier}"`)} \u2192 ${chalk120.green(`"${newSpecifier}"`)}`
|
|
10023
10079
|
);
|
|
10024
10080
|
}
|
|
10025
10081
|
}
|
|
10026
10082
|
}
|
|
10027
10083
|
function displayPlan2(plan2) {
|
|
10028
10084
|
if (plan2.warnings.length > 0) {
|
|
10029
|
-
console.log(
|
|
10030
|
-
for (const w of plan2.warnings) console.log(
|
|
10085
|
+
console.log(chalk120.yellow("\nWarnings:"));
|
|
10086
|
+
for (const w of plan2.warnings) console.log(chalk120.yellow(` ${w}`));
|
|
10031
10087
|
}
|
|
10032
10088
|
if (plan2.newDirectories.length > 0) {
|
|
10033
|
-
console.log(
|
|
10089
|
+
console.log(chalk120.bold("\nNew directories:"));
|
|
10034
10090
|
for (const dir of plan2.newDirectories)
|
|
10035
|
-
console.log(
|
|
10091
|
+
console.log(chalk120.green(` ${dir}/`));
|
|
10036
10092
|
}
|
|
10037
10093
|
displayMoves(plan2);
|
|
10038
10094
|
displayRewrites(plan2.rewrites);
|
|
10039
10095
|
console.log(
|
|
10040
|
-
|
|
10096
|
+
chalk120.dim(
|
|
10041
10097
|
`
|
|
10042
10098
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
10043
10099
|
)
|
|
@@ -10047,18 +10103,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
10047
10103
|
// src/commands/refactor/restructure/executePlan.ts
|
|
10048
10104
|
import fs20 from "fs";
|
|
10049
10105
|
import path42 from "path";
|
|
10050
|
-
import
|
|
10106
|
+
import chalk121 from "chalk";
|
|
10051
10107
|
function executePlan(plan2) {
|
|
10052
10108
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
10053
10109
|
for (const [file, content] of updatedContents) {
|
|
10054
10110
|
fs20.writeFileSync(file, content, "utf-8");
|
|
10055
10111
|
console.log(
|
|
10056
|
-
|
|
10112
|
+
chalk121.cyan(` Rewrote imports in ${path42.relative(process.cwd(), file)}`)
|
|
10057
10113
|
);
|
|
10058
10114
|
}
|
|
10059
10115
|
for (const dir of plan2.newDirectories) {
|
|
10060
10116
|
fs20.mkdirSync(dir, { recursive: true });
|
|
10061
|
-
console.log(
|
|
10117
|
+
console.log(chalk121.green(` Created ${path42.relative(process.cwd(), dir)}/`));
|
|
10062
10118
|
}
|
|
10063
10119
|
for (const move of plan2.moves) {
|
|
10064
10120
|
const targetDir = path42.dirname(move.to);
|
|
@@ -10067,7 +10123,7 @@ function executePlan(plan2) {
|
|
|
10067
10123
|
}
|
|
10068
10124
|
fs20.renameSync(move.from, move.to);
|
|
10069
10125
|
console.log(
|
|
10070
|
-
|
|
10126
|
+
chalk121.white(
|
|
10071
10127
|
` Moved ${path42.relative(process.cwd(), move.from)} \u2192 ${path42.relative(process.cwd(), move.to)}`
|
|
10072
10128
|
)
|
|
10073
10129
|
);
|
|
@@ -10082,7 +10138,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
10082
10138
|
if (entries.length === 0) {
|
|
10083
10139
|
fs20.rmdirSync(dir);
|
|
10084
10140
|
console.log(
|
|
10085
|
-
|
|
10141
|
+
chalk121.dim(
|
|
10086
10142
|
` Removed empty directory ${path42.relative(process.cwd(), dir)}`
|
|
10087
10143
|
)
|
|
10088
10144
|
);
|
|
@@ -10215,22 +10271,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
10215
10271
|
const targetPattern = pattern2 ?? "src";
|
|
10216
10272
|
const files = findSourceFiles2(targetPattern);
|
|
10217
10273
|
if (files.length === 0) {
|
|
10218
|
-
console.log(
|
|
10274
|
+
console.log(chalk122.yellow("No files found matching pattern"));
|
|
10219
10275
|
return;
|
|
10220
10276
|
}
|
|
10221
10277
|
const tsConfigPath = path45.resolve("tsconfig.json");
|
|
10222
10278
|
const plan2 = buildPlan2(files, tsConfigPath);
|
|
10223
10279
|
if (plan2.moves.length === 0) {
|
|
10224
|
-
console.log(
|
|
10280
|
+
console.log(chalk122.green("No restructuring needed"));
|
|
10225
10281
|
return;
|
|
10226
10282
|
}
|
|
10227
10283
|
displayPlan2(plan2);
|
|
10228
10284
|
if (options2.apply) {
|
|
10229
|
-
console.log(
|
|
10285
|
+
console.log(chalk122.bold("\nApplying changes..."));
|
|
10230
10286
|
executePlan(plan2);
|
|
10231
|
-
console.log(
|
|
10287
|
+
console.log(chalk122.green("\nRestructuring complete"));
|
|
10232
10288
|
} else {
|
|
10233
|
-
console.log(
|
|
10289
|
+
console.log(chalk122.dim("\nDry run. Use --apply to execute."));
|
|
10234
10290
|
}
|
|
10235
10291
|
}
|
|
10236
10292
|
|
|
@@ -10270,7 +10326,7 @@ function registerRefactor(program2) {
|
|
|
10270
10326
|
}
|
|
10271
10327
|
|
|
10272
10328
|
// src/commands/seq/seqAuth.ts
|
|
10273
|
-
import
|
|
10329
|
+
import chalk124 from "chalk";
|
|
10274
10330
|
|
|
10275
10331
|
// src/commands/seq/loadConnections.ts
|
|
10276
10332
|
function loadConnections2() {
|
|
@@ -10299,11 +10355,11 @@ function setDefaultConnection(name) {
|
|
|
10299
10355
|
}
|
|
10300
10356
|
|
|
10301
10357
|
// src/commands/seq/promptConnection.ts
|
|
10302
|
-
import
|
|
10358
|
+
import chalk123 from "chalk";
|
|
10303
10359
|
async function promptConnection2(existingNames) {
|
|
10304
10360
|
const name = await promptInput("name", "Connection name:", "default");
|
|
10305
10361
|
if (existingNames.includes(name)) {
|
|
10306
|
-
console.error(
|
|
10362
|
+
console.error(chalk123.red(`Connection "${name}" already exists.`));
|
|
10307
10363
|
process.exit(1);
|
|
10308
10364
|
}
|
|
10309
10365
|
const url = await promptInput("url", "Seq URL:", "http://localhost:5341");
|
|
@@ -10315,16 +10371,16 @@ async function promptConnection2(existingNames) {
|
|
|
10315
10371
|
var seqAuth = createConnectionAuth({
|
|
10316
10372
|
load: loadConnections2,
|
|
10317
10373
|
save: saveConnections2,
|
|
10318
|
-
format: (c) => `${
|
|
10374
|
+
format: (c) => `${chalk124.bold(c.name)} ${c.url}`,
|
|
10319
10375
|
promptNew: promptConnection2,
|
|
10320
10376
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
10321
10377
|
});
|
|
10322
10378
|
|
|
10323
10379
|
// src/commands/seq/seqQuery.ts
|
|
10324
|
-
import
|
|
10380
|
+
import chalk128 from "chalk";
|
|
10325
10381
|
|
|
10326
10382
|
// src/commands/seq/fetchSeq.ts
|
|
10327
|
-
import
|
|
10383
|
+
import chalk125 from "chalk";
|
|
10328
10384
|
async function fetchSeq(conn, path50, params) {
|
|
10329
10385
|
const url = `${conn.url}${path50}?${params}`;
|
|
10330
10386
|
const response = await fetch(url, {
|
|
@@ -10335,7 +10391,7 @@ async function fetchSeq(conn, path50, params) {
|
|
|
10335
10391
|
});
|
|
10336
10392
|
if (!response.ok) {
|
|
10337
10393
|
const body = await response.text();
|
|
10338
|
-
console.error(
|
|
10394
|
+
console.error(chalk125.red(`Seq returned ${response.status}: ${body}`));
|
|
10339
10395
|
process.exit(1);
|
|
10340
10396
|
}
|
|
10341
10397
|
return response;
|
|
@@ -10388,23 +10444,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
10388
10444
|
}
|
|
10389
10445
|
|
|
10390
10446
|
// src/commands/seq/formatEvent.ts
|
|
10391
|
-
import
|
|
10447
|
+
import chalk126 from "chalk";
|
|
10392
10448
|
function levelColor(level) {
|
|
10393
10449
|
switch (level) {
|
|
10394
10450
|
case "Fatal":
|
|
10395
|
-
return
|
|
10451
|
+
return chalk126.bgRed.white;
|
|
10396
10452
|
case "Error":
|
|
10397
|
-
return
|
|
10453
|
+
return chalk126.red;
|
|
10398
10454
|
case "Warning":
|
|
10399
|
-
return
|
|
10455
|
+
return chalk126.yellow;
|
|
10400
10456
|
case "Information":
|
|
10401
|
-
return
|
|
10457
|
+
return chalk126.cyan;
|
|
10402
10458
|
case "Debug":
|
|
10403
|
-
return
|
|
10459
|
+
return chalk126.gray;
|
|
10404
10460
|
case "Verbose":
|
|
10405
|
-
return
|
|
10461
|
+
return chalk126.dim;
|
|
10406
10462
|
default:
|
|
10407
|
-
return
|
|
10463
|
+
return chalk126.white;
|
|
10408
10464
|
}
|
|
10409
10465
|
}
|
|
10410
10466
|
function levelAbbrev(level) {
|
|
@@ -10445,31 +10501,31 @@ function formatTimestamp(iso) {
|
|
|
10445
10501
|
function formatEvent(event) {
|
|
10446
10502
|
const color = levelColor(event.Level);
|
|
10447
10503
|
const abbrev = levelAbbrev(event.Level);
|
|
10448
|
-
const ts8 =
|
|
10504
|
+
const ts8 = chalk126.dim(formatTimestamp(event.Timestamp));
|
|
10449
10505
|
const msg = renderMessage(event);
|
|
10450
10506
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
10451
10507
|
if (event.Exception) {
|
|
10452
10508
|
for (const line of event.Exception.split("\n")) {
|
|
10453
|
-
lines.push(
|
|
10509
|
+
lines.push(chalk126.red(` ${line}`));
|
|
10454
10510
|
}
|
|
10455
10511
|
}
|
|
10456
10512
|
return lines.join("\n");
|
|
10457
10513
|
}
|
|
10458
10514
|
|
|
10459
10515
|
// src/commands/seq/resolveConnection.ts
|
|
10460
|
-
import
|
|
10516
|
+
import chalk127 from "chalk";
|
|
10461
10517
|
function resolveConnection2(name) {
|
|
10462
10518
|
const connections = loadConnections2();
|
|
10463
10519
|
if (connections.length === 0) {
|
|
10464
10520
|
console.error(
|
|
10465
|
-
|
|
10521
|
+
chalk127.red("No Seq connections configured. Run 'assist seq auth' first.")
|
|
10466
10522
|
);
|
|
10467
10523
|
process.exit(1);
|
|
10468
10524
|
}
|
|
10469
10525
|
const target = name ?? getDefaultConnection() ?? connections[0].name;
|
|
10470
10526
|
const connection = connections.find((c) => c.name === target);
|
|
10471
10527
|
if (!connection) {
|
|
10472
|
-
console.error(
|
|
10528
|
+
console.error(chalk127.red(`Seq connection "${target}" not found.`));
|
|
10473
10529
|
process.exit(1);
|
|
10474
10530
|
}
|
|
10475
10531
|
return connection;
|
|
@@ -10484,7 +10540,7 @@ async function seqQuery(filter, options2) {
|
|
|
10484
10540
|
new URLSearchParams({ filter, count: String(count) })
|
|
10485
10541
|
);
|
|
10486
10542
|
if (events.length === 0) {
|
|
10487
|
-
console.log(
|
|
10543
|
+
console.log(chalk128.yellow("No events found."));
|
|
10488
10544
|
return;
|
|
10489
10545
|
}
|
|
10490
10546
|
if (options2.json) {
|
|
@@ -10495,11 +10551,11 @@ async function seqQuery(filter, options2) {
|
|
|
10495
10551
|
for (const event of chronological) {
|
|
10496
10552
|
console.log(formatEvent(event));
|
|
10497
10553
|
}
|
|
10498
|
-
console.log(
|
|
10554
|
+
console.log(chalk128.dim(`
|
|
10499
10555
|
${events.length} events`));
|
|
10500
10556
|
if (events.length >= count) {
|
|
10501
10557
|
console.log(
|
|
10502
|
-
|
|
10558
|
+
chalk128.yellow(
|
|
10503
10559
|
`Results limited to ${count}. Use --count to retrieve more.`
|
|
10504
10560
|
)
|
|
10505
10561
|
);
|
|
@@ -10507,11 +10563,11 @@ ${events.length} events`));
|
|
|
10507
10563
|
}
|
|
10508
10564
|
|
|
10509
10565
|
// src/commands/seq/seqSetConnection.ts
|
|
10510
|
-
import
|
|
10566
|
+
import chalk129 from "chalk";
|
|
10511
10567
|
function seqSetConnection(name) {
|
|
10512
10568
|
const connections = loadConnections2();
|
|
10513
10569
|
if (!connections.find((c) => c.name === name)) {
|
|
10514
|
-
console.error(
|
|
10570
|
+
console.error(chalk129.red(`Connection "${name}" not found.`));
|
|
10515
10571
|
process.exit(1);
|
|
10516
10572
|
}
|
|
10517
10573
|
setDefaultConnection(name);
|
|
@@ -11050,14 +11106,14 @@ import {
|
|
|
11050
11106
|
import { dirname as dirname20, join as join35 } from "path";
|
|
11051
11107
|
|
|
11052
11108
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
11053
|
-
import
|
|
11109
|
+
import chalk130 from "chalk";
|
|
11054
11110
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
11055
11111
|
function validateStagedContent(filename, content) {
|
|
11056
11112
|
const firstLine = content.split("\n")[0];
|
|
11057
11113
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
11058
11114
|
if (!match) {
|
|
11059
11115
|
console.error(
|
|
11060
|
-
|
|
11116
|
+
chalk130.red(
|
|
11061
11117
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
11062
11118
|
)
|
|
11063
11119
|
);
|
|
@@ -11066,7 +11122,7 @@ function validateStagedContent(filename, content) {
|
|
|
11066
11122
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
11067
11123
|
if (!contentAfterLink) {
|
|
11068
11124
|
console.error(
|
|
11069
|
-
|
|
11125
|
+
chalk130.red(
|
|
11070
11126
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
11071
11127
|
)
|
|
11072
11128
|
);
|
|
@@ -11459,7 +11515,7 @@ function registerVoice(program2) {
|
|
|
11459
11515
|
|
|
11460
11516
|
// src/commands/roam/auth.ts
|
|
11461
11517
|
import { randomBytes } from "crypto";
|
|
11462
|
-
import
|
|
11518
|
+
import chalk131 from "chalk";
|
|
11463
11519
|
|
|
11464
11520
|
// src/lib/openBrowser.ts
|
|
11465
11521
|
import { execSync as execSync39 } from "child_process";
|
|
@@ -11634,13 +11690,13 @@ async function auth() {
|
|
|
11634
11690
|
saveGlobalConfig(config);
|
|
11635
11691
|
const state = randomBytes(16).toString("hex");
|
|
11636
11692
|
console.log(
|
|
11637
|
-
|
|
11693
|
+
chalk131.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
11638
11694
|
);
|
|
11639
|
-
console.log(
|
|
11640
|
-
console.log(
|
|
11641
|
-
console.log(
|
|
11695
|
+
console.log(chalk131.white("http://localhost:14523/callback\n"));
|
|
11696
|
+
console.log(chalk131.blue("Opening browser for authorization..."));
|
|
11697
|
+
console.log(chalk131.dim("Waiting for authorization callback..."));
|
|
11642
11698
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
11643
|
-
console.log(
|
|
11699
|
+
console.log(chalk131.dim("Exchanging code for tokens..."));
|
|
11644
11700
|
const tokens = await exchangeToken({
|
|
11645
11701
|
code,
|
|
11646
11702
|
clientId,
|
|
@@ -11656,7 +11712,7 @@ async function auth() {
|
|
|
11656
11712
|
};
|
|
11657
11713
|
saveGlobalConfig(config);
|
|
11658
11714
|
console.log(
|
|
11659
|
-
|
|
11715
|
+
chalk131.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
11660
11716
|
);
|
|
11661
11717
|
}
|
|
11662
11718
|
|
|
@@ -11952,7 +12008,7 @@ import { execSync as execSync41 } from "child_process";
|
|
|
11952
12008
|
import { existsSync as existsSync41, mkdirSync as mkdirSync14, unlinkSync as unlinkSync12, writeFileSync as writeFileSync29 } from "fs";
|
|
11953
12009
|
import { tmpdir as tmpdir6 } from "os";
|
|
11954
12010
|
import { join as join45, resolve as resolve6 } from "path";
|
|
11955
|
-
import
|
|
12011
|
+
import chalk132 from "chalk";
|
|
11956
12012
|
|
|
11957
12013
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
11958
12014
|
var captureWindowPs1 = `
|
|
@@ -12103,22 +12159,22 @@ function screenshot(processName) {
|
|
|
12103
12159
|
const config = loadConfig();
|
|
12104
12160
|
const outputDir = resolve6(config.screenshot.outputDir);
|
|
12105
12161
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
12106
|
-
console.log(
|
|
12162
|
+
console.log(chalk132.gray(`Capturing window for process "${processName}" ...`));
|
|
12107
12163
|
try {
|
|
12108
12164
|
runPowerShellScript(processName, outputPath);
|
|
12109
|
-
console.log(
|
|
12165
|
+
console.log(chalk132.green(`Screenshot saved: ${outputPath}`));
|
|
12110
12166
|
} catch (error) {
|
|
12111
12167
|
const msg = error instanceof Error ? error.message : String(error);
|
|
12112
|
-
console.error(
|
|
12168
|
+
console.error(chalk132.red(`Failed to capture screenshot: ${msg}`));
|
|
12113
12169
|
process.exit(1);
|
|
12114
12170
|
}
|
|
12115
12171
|
}
|
|
12116
12172
|
|
|
12117
12173
|
// src/commands/statusLine.ts
|
|
12118
|
-
import
|
|
12174
|
+
import chalk134 from "chalk";
|
|
12119
12175
|
|
|
12120
12176
|
// src/commands/buildLimitsSegment.ts
|
|
12121
|
-
import
|
|
12177
|
+
import chalk133 from "chalk";
|
|
12122
12178
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
12123
12179
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
12124
12180
|
function formatTimeLeft(resetsAt) {
|
|
@@ -12141,10 +12197,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
12141
12197
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
12142
12198
|
const label2 = `${Math.round(pct)}%`;
|
|
12143
12199
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
12144
|
-
if (projected == null) return
|
|
12145
|
-
if (projected > 100) return
|
|
12146
|
-
if (projected > 75) return
|
|
12147
|
-
return
|
|
12200
|
+
if (projected == null) return chalk133.green(label2);
|
|
12201
|
+
if (projected > 100) return chalk133.red(label2);
|
|
12202
|
+
if (projected > 75) return chalk133.yellow(label2);
|
|
12203
|
+
return chalk133.green(label2);
|
|
12148
12204
|
}
|
|
12149
12205
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
12150
12206
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -12170,14 +12226,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
12170
12226
|
}
|
|
12171
12227
|
|
|
12172
12228
|
// src/commands/statusLine.ts
|
|
12173
|
-
|
|
12229
|
+
chalk134.level = 3;
|
|
12174
12230
|
function formatNumber(num) {
|
|
12175
12231
|
return num.toLocaleString("en-US");
|
|
12176
12232
|
}
|
|
12177
12233
|
function colorizePercent(pct) {
|
|
12178
12234
|
const label2 = `${Math.round(pct)}%`;
|
|
12179
|
-
if (pct > 80) return
|
|
12180
|
-
if (pct > 40) return
|
|
12235
|
+
if (pct > 80) return chalk134.red(label2);
|
|
12236
|
+
if (pct > 40) return chalk134.yellow(label2);
|
|
12181
12237
|
return label2;
|
|
12182
12238
|
}
|
|
12183
12239
|
async function statusLine() {
|
|
@@ -12200,7 +12256,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
12200
12256
|
// src/commands/sync/syncClaudeMd.ts
|
|
12201
12257
|
import * as fs23 from "fs";
|
|
12202
12258
|
import * as path46 from "path";
|
|
12203
|
-
import
|
|
12259
|
+
import chalk135 from "chalk";
|
|
12204
12260
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
12205
12261
|
const source = path46.join(claudeDir, "CLAUDE.md");
|
|
12206
12262
|
const target = path46.join(targetBase, "CLAUDE.md");
|
|
@@ -12209,12 +12265,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
12209
12265
|
const targetContent = fs23.readFileSync(target, "utf-8");
|
|
12210
12266
|
if (sourceContent !== targetContent) {
|
|
12211
12267
|
console.log(
|
|
12212
|
-
|
|
12268
|
+
chalk135.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
12213
12269
|
);
|
|
12214
12270
|
console.log();
|
|
12215
12271
|
printDiff(targetContent, sourceContent);
|
|
12216
12272
|
const confirm = options2?.yes || await promptConfirm(
|
|
12217
|
-
|
|
12273
|
+
chalk135.red("Overwrite existing CLAUDE.md?"),
|
|
12218
12274
|
false
|
|
12219
12275
|
);
|
|
12220
12276
|
if (!confirm) {
|
|
@@ -12230,7 +12286,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
12230
12286
|
// src/commands/sync/syncSettings.ts
|
|
12231
12287
|
import * as fs24 from "fs";
|
|
12232
12288
|
import * as path47 from "path";
|
|
12233
|
-
import
|
|
12289
|
+
import chalk136 from "chalk";
|
|
12234
12290
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
12235
12291
|
const source = path47.join(claudeDir, "settings.json");
|
|
12236
12292
|
const target = path47.join(targetBase, "settings.json");
|
|
@@ -12246,14 +12302,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
12246
12302
|
if (mergedContent !== normalizedTarget) {
|
|
12247
12303
|
if (!options2?.yes) {
|
|
12248
12304
|
console.log(
|
|
12249
|
-
|
|
12305
|
+
chalk136.yellow(
|
|
12250
12306
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
12251
12307
|
)
|
|
12252
12308
|
);
|
|
12253
12309
|
console.log();
|
|
12254
12310
|
printDiff(targetContent, mergedContent);
|
|
12255
12311
|
const confirm = await promptConfirm(
|
|
12256
|
-
|
|
12312
|
+
chalk136.red("Overwrite existing settings.json?"),
|
|
12257
12313
|
false
|
|
12258
12314
|
);
|
|
12259
12315
|
if (!confirm) {
|