@staff0rd/assist 0.186.1 → 0.187.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 +420 -358
- 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.187.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -4008,53 +4008,112 @@ async function add(options2) {
|
|
|
4008
4008
|
}
|
|
4009
4009
|
|
|
4010
4010
|
// src/commands/backlog/addPhase.ts
|
|
4011
|
+
import chalk47 from "chalk";
|
|
4012
|
+
|
|
4013
|
+
// src/commands/backlog/insertPhaseAt.ts
|
|
4014
|
+
function insertPhaseAt(db, itemId, phaseIdx, name, tasks, manualChecks, currentPhase) {
|
|
4015
|
+
const run4 = db.transaction(() => {
|
|
4016
|
+
db.pragma("defer_foreign_keys = ON");
|
|
4017
|
+
const toShift = db.prepare(
|
|
4018
|
+
"SELECT idx FROM plan_phases WHERE item_id = ? AND idx >= ? ORDER BY idx DESC"
|
|
4019
|
+
).all(itemId, phaseIdx);
|
|
4020
|
+
for (const p of toShift) {
|
|
4021
|
+
db.prepare(
|
|
4022
|
+
"UPDATE plan_tasks SET phase_idx = ? WHERE item_id = ? AND phase_idx = ?"
|
|
4023
|
+
).run(p.idx + 1, itemId, p.idx);
|
|
4024
|
+
db.prepare(
|
|
4025
|
+
"UPDATE plan_phases SET idx = ? WHERE item_id = ? AND idx = ?"
|
|
4026
|
+
).run(p.idx + 1, itemId, p.idx);
|
|
4027
|
+
}
|
|
4028
|
+
db.prepare(
|
|
4029
|
+
"INSERT INTO plan_phases (item_id, idx, name, manual_checks) VALUES (?, ?, ?, ?)"
|
|
4030
|
+
).run(itemId, phaseIdx, name, manualChecks);
|
|
4031
|
+
const taskStmt = db.prepare(
|
|
4032
|
+
"INSERT INTO plan_tasks (item_id, phase_idx, idx, task) VALUES (?, ?, ?, ?)"
|
|
4033
|
+
);
|
|
4034
|
+
for (let i = 0; i < tasks.length; i++) {
|
|
4035
|
+
taskStmt.run(itemId, phaseIdx, i, tasks[i]);
|
|
4036
|
+
}
|
|
4037
|
+
if (currentPhase !== void 0 && currentPhase - 1 >= phaseIdx) {
|
|
4038
|
+
db.prepare("UPDATE items SET current_phase = ? WHERE id = ?").run(
|
|
4039
|
+
currentPhase + 1,
|
|
4040
|
+
itemId
|
|
4041
|
+
);
|
|
4042
|
+
}
|
|
4043
|
+
});
|
|
4044
|
+
run4();
|
|
4045
|
+
}
|
|
4046
|
+
|
|
4047
|
+
// src/commands/backlog/resolveInsertPosition.ts
|
|
4011
4048
|
import chalk46 from "chalk";
|
|
4049
|
+
function resolveInsertPosition(db, itemId, position) {
|
|
4050
|
+
const { cnt: phaseCount } = db.prepare("SELECT COUNT(*) as cnt FROM plan_phases WHERE item_id = ?").get(itemId);
|
|
4051
|
+
if (position === void 0) return phaseCount;
|
|
4052
|
+
const pos = Number.parseInt(position, 10);
|
|
4053
|
+
if (pos < 1 || pos > phaseCount + 1) {
|
|
4054
|
+
console.log(
|
|
4055
|
+
chalk46.red(
|
|
4056
|
+
`Position ${pos} is out of range. Must be between 1 and ${phaseCount + 1}.`
|
|
4057
|
+
)
|
|
4058
|
+
);
|
|
4059
|
+
process.exitCode = 1;
|
|
4060
|
+
return void 0;
|
|
4061
|
+
}
|
|
4062
|
+
return pos - 1;
|
|
4063
|
+
}
|
|
4064
|
+
|
|
4065
|
+
// src/commands/backlog/serializeManualChecks.ts
|
|
4066
|
+
function serializeManualChecks(manualCheck) {
|
|
4067
|
+
return manualCheck && manualCheck.length > 0 ? JSON.stringify(manualCheck) : null;
|
|
4068
|
+
}
|
|
4069
|
+
|
|
4070
|
+
// src/commands/backlog/addPhase.ts
|
|
4012
4071
|
function addPhase(id, name, options2) {
|
|
4013
4072
|
const result = loadAndFindItem(id);
|
|
4014
4073
|
if (!result) return;
|
|
4015
4074
|
const tasks = options2.task ?? [];
|
|
4016
4075
|
if (tasks.length === 0) {
|
|
4017
|
-
console.log(
|
|
4076
|
+
console.log(chalk47.red("At least one --task is required."));
|
|
4018
4077
|
process.exitCode = 1;
|
|
4019
4078
|
return;
|
|
4020
4079
|
}
|
|
4021
4080
|
const dir = getBacklogDir();
|
|
4022
4081
|
const db = openDb(dir);
|
|
4023
4082
|
const itemId = result.item.id;
|
|
4024
|
-
const
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4083
|
+
const phaseIdx = resolveInsertPosition(db, itemId, options2.position);
|
|
4084
|
+
if (phaseIdx === void 0) return;
|
|
4085
|
+
insertPhaseAt(
|
|
4086
|
+
db,
|
|
4087
|
+
itemId,
|
|
4088
|
+
phaseIdx,
|
|
4089
|
+
name,
|
|
4090
|
+
tasks,
|
|
4091
|
+
serializeManualChecks(options2.manualCheck),
|
|
4092
|
+
result.item.currentPhase
|
|
4032
4093
|
);
|
|
4033
|
-
for (let i = 0; i < tasks.length; i++) {
|
|
4034
|
-
taskStmt.run(itemId, phaseIdx, i, tasks[i]);
|
|
4035
|
-
}
|
|
4036
4094
|
exportToJsonl(db, dir);
|
|
4037
4095
|
commitBacklog(itemId, result.item.name);
|
|
4096
|
+
const verb = options2.position !== void 0 ? "Inserted" : "Added";
|
|
4038
4097
|
console.log(
|
|
4039
|
-
|
|
4040
|
-
|
|
4098
|
+
chalk47.green(
|
|
4099
|
+
`${verb} phase ${phaseIdx + 1} "${name}" to item #${itemId} with ${tasks.length} task(s).`
|
|
4041
4100
|
)
|
|
4042
4101
|
);
|
|
4043
4102
|
}
|
|
4044
4103
|
|
|
4045
4104
|
// src/commands/backlog/init/index.ts
|
|
4046
|
-
import
|
|
4105
|
+
import chalk48 from "chalk";
|
|
4047
4106
|
async function init6() {
|
|
4048
4107
|
if (backlogExists()) {
|
|
4049
|
-
console.log(
|
|
4108
|
+
console.log(chalk48.yellow("Backlog already exists."));
|
|
4050
4109
|
return;
|
|
4051
4110
|
}
|
|
4052
4111
|
saveBacklog([]);
|
|
4053
|
-
console.log(
|
|
4112
|
+
console.log(chalk48.green("Created backlog."));
|
|
4054
4113
|
}
|
|
4055
4114
|
|
|
4056
4115
|
// src/commands/backlog/list/index.ts
|
|
4057
|
-
import
|
|
4116
|
+
import chalk49 from "chalk";
|
|
4058
4117
|
function filterItems(items, options2) {
|
|
4059
4118
|
if (options2.status) return items.filter((i) => i.status === options2.status);
|
|
4060
4119
|
if (!options2.all)
|
|
@@ -4064,7 +4123,7 @@ function filterItems(items, options2) {
|
|
|
4064
4123
|
async function list2(options2) {
|
|
4065
4124
|
if (!backlogExists()) {
|
|
4066
4125
|
console.log(
|
|
4067
|
-
|
|
4126
|
+
chalk49.yellow(
|
|
4068
4127
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
4069
4128
|
)
|
|
4070
4129
|
);
|
|
@@ -4073,12 +4132,12 @@ async function list2(options2) {
|
|
|
4073
4132
|
const allItems = loadBacklog();
|
|
4074
4133
|
const items = filterItems(allItems, options2);
|
|
4075
4134
|
if (items.length === 0) {
|
|
4076
|
-
console.log(
|
|
4135
|
+
console.log(chalk49.dim("Backlog is empty."));
|
|
4077
4136
|
return;
|
|
4078
4137
|
}
|
|
4079
4138
|
for (const item of items) {
|
|
4080
4139
|
console.log(
|
|
4081
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
4140
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk49.dim(`#${item.id}`)} ${item.name}${phaseLabel(item)}${dependencyLabel(item, allItems)}`
|
|
4082
4141
|
);
|
|
4083
4142
|
if (options2.verbose) {
|
|
4084
4143
|
printVerboseDetails(item);
|
|
@@ -4097,11 +4156,14 @@ function registerItemCommands(cmd) {
|
|
|
4097
4156
|
cmd.command("add-phase <id> <name>").description("Add a phase to an existing backlog item").option("--task <task...>", "Task description (repeatable)").option(
|
|
4098
4157
|
"--manual-check <check...>",
|
|
4099
4158
|
"Manual check description (repeatable)"
|
|
4159
|
+
).option(
|
|
4160
|
+
"--position <position>",
|
|
4161
|
+
"1-indexed position to insert at (default: append)"
|
|
4100
4162
|
).action(addPhase);
|
|
4101
4163
|
}
|
|
4102
4164
|
|
|
4103
4165
|
// src/commands/backlog/link.ts
|
|
4104
|
-
import
|
|
4166
|
+
import chalk51 from "chalk";
|
|
4105
4167
|
|
|
4106
4168
|
// src/commands/backlog/hasCycle.ts
|
|
4107
4169
|
function hasCycle(items, fromId, toId) {
|
|
@@ -4124,11 +4186,11 @@ function hasCycle(items, fromId, toId) {
|
|
|
4124
4186
|
}
|
|
4125
4187
|
|
|
4126
4188
|
// src/commands/backlog/validateLinkTarget.ts
|
|
4127
|
-
import
|
|
4189
|
+
import chalk50 from "chalk";
|
|
4128
4190
|
function validateLinkTarget(items, fromItem, fromId, toId, toNum, linkType) {
|
|
4129
4191
|
const toItem = items.find((i) => i.id === toNum);
|
|
4130
4192
|
if (!toItem) {
|
|
4131
|
-
console.log(
|
|
4193
|
+
console.log(chalk50.red(`Item #${toId} not found.`));
|
|
4132
4194
|
return void 0;
|
|
4133
4195
|
}
|
|
4134
4196
|
if (!fromItem.links) fromItem.links = [];
|
|
@@ -4137,7 +4199,7 @@ function validateLinkTarget(items, fromItem, fromId, toId, toNum, linkType) {
|
|
|
4137
4199
|
);
|
|
4138
4200
|
if (duplicate) {
|
|
4139
4201
|
console.log(
|
|
4140
|
-
|
|
4202
|
+
chalk50.yellow(`Link already exists: #${fromId} ${linkType} #${toId}`)
|
|
4141
4203
|
);
|
|
4142
4204
|
return void 0;
|
|
4143
4205
|
}
|
|
@@ -4148,13 +4210,13 @@ function validateLinkTarget(items, fromItem, fromId, toId, toNum, linkType) {
|
|
|
4148
4210
|
function link(fromId, toId, opts) {
|
|
4149
4211
|
const linkType = opts.type ?? "relates-to";
|
|
4150
4212
|
if (linkType !== "relates-to" && linkType !== "depends-on") {
|
|
4151
|
-
console.log(
|
|
4213
|
+
console.log(chalk51.red(`Invalid link type: ${linkType}`));
|
|
4152
4214
|
return;
|
|
4153
4215
|
}
|
|
4154
4216
|
const fromNum = Number.parseInt(fromId, 10);
|
|
4155
4217
|
const toNum = Number.parseInt(toId, 10);
|
|
4156
4218
|
if (fromNum === toNum) {
|
|
4157
|
-
console.log(
|
|
4219
|
+
console.log(chalk51.red("Cannot link an item to itself."));
|
|
4158
4220
|
return;
|
|
4159
4221
|
}
|
|
4160
4222
|
const result = loadAndFindItem(fromId);
|
|
@@ -4171,7 +4233,7 @@ function link(fromId, toId, opts) {
|
|
|
4171
4233
|
if (!toItem) return;
|
|
4172
4234
|
if (linkType === "depends-on" && hasCycle(items, fromNum, toNum)) {
|
|
4173
4235
|
console.log(
|
|
4174
|
-
|
|
4236
|
+
chalk51.red(
|
|
4175
4237
|
`Cannot add dependency: #${fromId} \u2192 #${toId} would create a circular dependency.`
|
|
4176
4238
|
)
|
|
4177
4239
|
);
|
|
@@ -4181,32 +4243,32 @@ function link(fromId, toId, opts) {
|
|
|
4181
4243
|
fromItem.links.push({ type: linkType, targetId: toNum });
|
|
4182
4244
|
saveBacklog(items);
|
|
4183
4245
|
console.log(
|
|
4184
|
-
|
|
4246
|
+
chalk51.green(`Linked #${fromId} ${linkType} #${toId} (${toItem.name})`)
|
|
4185
4247
|
);
|
|
4186
4248
|
}
|
|
4187
4249
|
|
|
4188
4250
|
// src/commands/backlog/unlink.ts
|
|
4189
|
-
import
|
|
4251
|
+
import chalk52 from "chalk";
|
|
4190
4252
|
function unlink(fromId, toId) {
|
|
4191
4253
|
const toNum = Number.parseInt(toId, 10);
|
|
4192
4254
|
const result = loadAndFindItem(fromId);
|
|
4193
4255
|
if (!result) return;
|
|
4194
4256
|
const { items, item: fromItem } = result;
|
|
4195
4257
|
if (!fromItem.links || fromItem.links.length === 0) {
|
|
4196
|
-
console.log(
|
|
4258
|
+
console.log(chalk52.yellow(`No links found on item #${fromId}.`));
|
|
4197
4259
|
return;
|
|
4198
4260
|
}
|
|
4199
4261
|
const before = fromItem.links.length;
|
|
4200
4262
|
fromItem.links = fromItem.links.filter((l) => l.targetId !== toNum);
|
|
4201
4263
|
if (fromItem.links.length === before) {
|
|
4202
|
-
console.log(
|
|
4264
|
+
console.log(chalk52.yellow(`No link from #${fromId} to #${toId} found.`));
|
|
4203
4265
|
return;
|
|
4204
4266
|
}
|
|
4205
4267
|
if (fromItem.links.length === 0) {
|
|
4206
4268
|
fromItem.links = void 0;
|
|
4207
4269
|
}
|
|
4208
4270
|
saveBacklog(items);
|
|
4209
|
-
console.log(
|
|
4271
|
+
console.log(chalk52.green(`Removed link from #${fromId} to #${toId}.`));
|
|
4210
4272
|
}
|
|
4211
4273
|
|
|
4212
4274
|
// src/commands/backlog/registerLinkCommands.ts
|
|
@@ -4220,7 +4282,7 @@ function registerLinkCommands(cmd) {
|
|
|
4220
4282
|
}
|
|
4221
4283
|
|
|
4222
4284
|
// src/commands/backlog/rewindPhase.ts
|
|
4223
|
-
import
|
|
4285
|
+
import chalk53 from "chalk";
|
|
4224
4286
|
function validateRewind(item, phaseNumber) {
|
|
4225
4287
|
if (!item.plan || item.plan.length === 0) {
|
|
4226
4288
|
return `Item #${item.id} has no plan phases.`;
|
|
@@ -4242,7 +4304,7 @@ function rewindPhase(id, phase, opts) {
|
|
|
4242
4304
|
const { item } = result;
|
|
4243
4305
|
const error = validateRewind(item, phaseNumber);
|
|
4244
4306
|
if (error) {
|
|
4245
|
-
console.log(
|
|
4307
|
+
console.log(chalk53.red(error));
|
|
4246
4308
|
process.exitCode = 1;
|
|
4247
4309
|
return;
|
|
4248
4310
|
}
|
|
@@ -4260,7 +4322,7 @@ function rewindPhase(id, phase, opts) {
|
|
|
4260
4322
|
targetPhase: phaseIndex
|
|
4261
4323
|
});
|
|
4262
4324
|
console.log(
|
|
4263
|
-
|
|
4325
|
+
chalk53.green(`Rewound item #${id} to phase ${phaseNumber} (${phaseName}).`)
|
|
4264
4326
|
);
|
|
4265
4327
|
}
|
|
4266
4328
|
|
|
@@ -4277,11 +4339,11 @@ function registerRunCommand(cmd) {
|
|
|
4277
4339
|
}
|
|
4278
4340
|
|
|
4279
4341
|
// src/commands/backlog/search/index.ts
|
|
4280
|
-
import
|
|
4342
|
+
import chalk54 from "chalk";
|
|
4281
4343
|
async function search(query) {
|
|
4282
4344
|
if (!backlogExists()) {
|
|
4283
4345
|
console.log(
|
|
4284
|
-
|
|
4346
|
+
chalk54.yellow(
|
|
4285
4347
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
4286
4348
|
)
|
|
4287
4349
|
);
|
|
@@ -4289,18 +4351,18 @@ async function search(query) {
|
|
|
4289
4351
|
}
|
|
4290
4352
|
const items = searchBacklog(query);
|
|
4291
4353
|
if (items.length === 0) {
|
|
4292
|
-
console.log(
|
|
4354
|
+
console.log(chalk54.dim(`No items matching "${query}".`));
|
|
4293
4355
|
return;
|
|
4294
4356
|
}
|
|
4295
4357
|
console.log(
|
|
4296
|
-
|
|
4358
|
+
chalk54.dim(
|
|
4297
4359
|
`${items.length} item${items.length === 1 ? "" : "s"} matching "${query}":
|
|
4298
4360
|
`
|
|
4299
4361
|
)
|
|
4300
4362
|
);
|
|
4301
4363
|
for (const item of items) {
|
|
4302
4364
|
console.log(
|
|
4303
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
4365
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk54.dim(`#${item.id}`)} ${item.name}`
|
|
4304
4366
|
);
|
|
4305
4367
|
}
|
|
4306
4368
|
}
|
|
@@ -4311,16 +4373,16 @@ function registerSearchCommand(cmd) {
|
|
|
4311
4373
|
}
|
|
4312
4374
|
|
|
4313
4375
|
// src/commands/backlog/delete/index.ts
|
|
4314
|
-
import
|
|
4376
|
+
import chalk55 from "chalk";
|
|
4315
4377
|
async function del(id) {
|
|
4316
4378
|
const name = removeItem(id);
|
|
4317
4379
|
if (name) {
|
|
4318
|
-
console.log(
|
|
4380
|
+
console.log(chalk55.green(`Deleted item #${id}: ${name}`));
|
|
4319
4381
|
}
|
|
4320
4382
|
}
|
|
4321
4383
|
|
|
4322
4384
|
// src/commands/backlog/done/index.ts
|
|
4323
|
-
import
|
|
4385
|
+
import chalk56 from "chalk";
|
|
4324
4386
|
async function done(id, summary) {
|
|
4325
4387
|
const result = loadAndFindItem(id);
|
|
4326
4388
|
if (!result) return;
|
|
@@ -4330,12 +4392,12 @@ async function done(id, summary) {
|
|
|
4330
4392
|
const pending = item.plan.slice(completedCount);
|
|
4331
4393
|
if (pending.length > 0) {
|
|
4332
4394
|
console.log(
|
|
4333
|
-
|
|
4395
|
+
chalk56.red(
|
|
4334
4396
|
`Cannot complete item #${id}: ${pending.length} pending phase(s):`
|
|
4335
4397
|
)
|
|
4336
4398
|
);
|
|
4337
4399
|
for (const phase of pending) {
|
|
4338
|
-
console.log(
|
|
4400
|
+
console.log(chalk56.yellow(` - ${phase.name}`));
|
|
4339
4401
|
}
|
|
4340
4402
|
process.exitCode = 1;
|
|
4341
4403
|
return;
|
|
@@ -4347,20 +4409,20 @@ async function done(id, summary) {
|
|
|
4347
4409
|
addPhaseSummary(item, summary, phase);
|
|
4348
4410
|
}
|
|
4349
4411
|
saveBacklog(result.items);
|
|
4350
|
-
console.log(
|
|
4412
|
+
console.log(chalk56.green(`Completed item #${id}: ${item.name}`));
|
|
4351
4413
|
}
|
|
4352
4414
|
|
|
4353
4415
|
// src/commands/backlog/start/index.ts
|
|
4354
|
-
import
|
|
4416
|
+
import chalk57 from "chalk";
|
|
4355
4417
|
async function start(id) {
|
|
4356
4418
|
const name = setStatus(id, "in-progress");
|
|
4357
4419
|
if (name) {
|
|
4358
|
-
console.log(
|
|
4420
|
+
console.log(chalk57.green(`Started item #${id}: ${name}`));
|
|
4359
4421
|
}
|
|
4360
4422
|
}
|
|
4361
4423
|
|
|
4362
4424
|
// src/commands/backlog/wontdo/index.ts
|
|
4363
|
-
import
|
|
4425
|
+
import chalk58 from "chalk";
|
|
4364
4426
|
async function wontdo(id, reason) {
|
|
4365
4427
|
const result = loadAndFindItem(id);
|
|
4366
4428
|
if (!result) return;
|
|
@@ -4370,7 +4432,7 @@ async function wontdo(id, reason) {
|
|
|
4370
4432
|
addPhaseSummary(result.item, reason, phase);
|
|
4371
4433
|
}
|
|
4372
4434
|
saveBacklog(result.items);
|
|
4373
|
-
console.log(
|
|
4435
|
+
console.log(chalk58.red(`Won't do item #${id}: ${result.item.name}`));
|
|
4374
4436
|
}
|
|
4375
4437
|
|
|
4376
4438
|
// src/commands/backlog/registerStatusCommands.ts
|
|
@@ -4382,10 +4444,10 @@ function registerStatusCommands(cmd) {
|
|
|
4382
4444
|
}
|
|
4383
4445
|
|
|
4384
4446
|
// src/commands/backlog/removePhase.ts
|
|
4385
|
-
import
|
|
4447
|
+
import chalk60 from "chalk";
|
|
4386
4448
|
|
|
4387
4449
|
// src/commands/backlog/findPhase.ts
|
|
4388
|
-
import
|
|
4450
|
+
import chalk59 from "chalk";
|
|
4389
4451
|
function findPhase(id, phase) {
|
|
4390
4452
|
const result = loadAndFindItem(id);
|
|
4391
4453
|
if (!result) return void 0;
|
|
@@ -4399,7 +4461,7 @@ function findPhase(id, phase) {
|
|
|
4399
4461
|
).get(itemId, phaseIdx);
|
|
4400
4462
|
if (existing.cnt === 0) {
|
|
4401
4463
|
console.log(
|
|
4402
|
-
|
|
4464
|
+
chalk59.red(`Phase ${phaseNumber} not found on item #${itemId}.`)
|
|
4403
4465
|
);
|
|
4404
4466
|
process.exitCode = 1;
|
|
4405
4467
|
return void 0;
|
|
@@ -4458,24 +4520,24 @@ function removePhase(id, phase) {
|
|
|
4458
4520
|
exportToJsonl(db, dir);
|
|
4459
4521
|
commitBacklog(itemId, result.item.name);
|
|
4460
4522
|
console.log(
|
|
4461
|
-
|
|
4523
|
+
chalk60.green(`Removed phase ${phaseIdx + 1} from item #${itemId}.`)
|
|
4462
4524
|
);
|
|
4463
4525
|
}
|
|
4464
4526
|
|
|
4465
4527
|
// src/commands/backlog/update/index.ts
|
|
4466
|
-
import
|
|
4528
|
+
import chalk62 from "chalk";
|
|
4467
4529
|
|
|
4468
4530
|
// src/commands/backlog/update/buildUpdateSql.ts
|
|
4469
|
-
import
|
|
4531
|
+
import chalk61 from "chalk";
|
|
4470
4532
|
function buildUpdateSql(options2) {
|
|
4471
4533
|
const { name, desc, type, ac } = options2;
|
|
4472
4534
|
if (!name && !desc && !type && !ac) {
|
|
4473
|
-
console.log(
|
|
4535
|
+
console.log(chalk61.red("Nothing to update. Provide at least one flag."));
|
|
4474
4536
|
process.exitCode = 1;
|
|
4475
4537
|
return void 0;
|
|
4476
4538
|
}
|
|
4477
4539
|
if (type && type !== "story" && type !== "bug") {
|
|
4478
|
-
console.log(
|
|
4540
|
+
console.log(chalk61.red('Invalid type. Must be "story" or "bug".'));
|
|
4479
4541
|
process.exitCode = 1;
|
|
4480
4542
|
return void 0;
|
|
4481
4543
|
}
|
|
@@ -4520,11 +4582,11 @@ function update(id, options2) {
|
|
|
4520
4582
|
);
|
|
4521
4583
|
exportToJsonl(db, dir);
|
|
4522
4584
|
commitBacklog(itemId, options2.name ?? result.item.name);
|
|
4523
|
-
console.log(
|
|
4585
|
+
console.log(chalk62.green(`Updated ${built.fields} on item #${itemId}.`));
|
|
4524
4586
|
}
|
|
4525
4587
|
|
|
4526
4588
|
// src/commands/backlog/updatePhase.ts
|
|
4527
|
-
import
|
|
4589
|
+
import chalk63 from "chalk";
|
|
4528
4590
|
|
|
4529
4591
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
4530
4592
|
function applyPhaseUpdate(db, itemId, phaseIdx, fields) {
|
|
@@ -4558,7 +4620,7 @@ function applyPhaseUpdate(db, itemId, phaseIdx, fields) {
|
|
|
4558
4620
|
function updatePhase(id, phase, options2) {
|
|
4559
4621
|
const { name, task, manualCheck } = options2;
|
|
4560
4622
|
if (!name && !task && !manualCheck) {
|
|
4561
|
-
console.log(
|
|
4623
|
+
console.log(chalk63.red("Nothing to update. Provide at least one flag."));
|
|
4562
4624
|
process.exitCode = 1;
|
|
4563
4625
|
return;
|
|
4564
4626
|
}
|
|
@@ -4574,7 +4636,7 @@ function updatePhase(id, phase, options2) {
|
|
|
4574
4636
|
manualCheck && "manual checks"
|
|
4575
4637
|
].filter(Boolean).join(", ");
|
|
4576
4638
|
console.log(
|
|
4577
|
-
|
|
4639
|
+
chalk63.green(
|
|
4578
4640
|
`Updated ${fields} on phase ${phaseIdx + 1} of item #${itemId}.`
|
|
4579
4641
|
)
|
|
4580
4642
|
);
|
|
@@ -5079,11 +5141,11 @@ function assertCliExists(cli) {
|
|
|
5079
5141
|
}
|
|
5080
5142
|
|
|
5081
5143
|
// src/commands/permitCliReads/colorize.ts
|
|
5082
|
-
import
|
|
5144
|
+
import chalk64 from "chalk";
|
|
5083
5145
|
function colorize(plainOutput) {
|
|
5084
5146
|
return plainOutput.split("\n").map((line) => {
|
|
5085
|
-
if (line.startsWith(" R ")) return
|
|
5086
|
-
if (line.startsWith(" W ")) return
|
|
5147
|
+
if (line.startsWith(" R ")) return chalk64.green(line);
|
|
5148
|
+
if (line.startsWith(" W ")) return chalk64.red(line);
|
|
5087
5149
|
return line;
|
|
5088
5150
|
}).join("\n");
|
|
5089
5151
|
}
|
|
@@ -5381,48 +5443,48 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
5381
5443
|
}
|
|
5382
5444
|
|
|
5383
5445
|
// src/commands/deny/denyAdd.ts
|
|
5384
|
-
import
|
|
5446
|
+
import chalk65 from "chalk";
|
|
5385
5447
|
function denyAdd(pattern2, message) {
|
|
5386
5448
|
const config = loadProjectConfig();
|
|
5387
5449
|
const deny = config.deny ?? [];
|
|
5388
5450
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
5389
|
-
console.log(
|
|
5451
|
+
console.log(chalk65.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
5390
5452
|
return;
|
|
5391
5453
|
}
|
|
5392
5454
|
deny.push({ pattern: pattern2, message });
|
|
5393
5455
|
config.deny = deny;
|
|
5394
5456
|
saveConfig(config);
|
|
5395
|
-
console.log(
|
|
5457
|
+
console.log(chalk65.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
5396
5458
|
}
|
|
5397
5459
|
|
|
5398
5460
|
// src/commands/deny/denyList.ts
|
|
5399
|
-
import
|
|
5461
|
+
import chalk66 from "chalk";
|
|
5400
5462
|
function denyList() {
|
|
5401
5463
|
const config = loadConfig();
|
|
5402
5464
|
const deny = config.deny;
|
|
5403
5465
|
if (!deny || deny.length === 0) {
|
|
5404
|
-
console.log(
|
|
5466
|
+
console.log(chalk66.dim("No deny rules configured."));
|
|
5405
5467
|
return;
|
|
5406
5468
|
}
|
|
5407
5469
|
for (const rule of deny) {
|
|
5408
|
-
console.log(`${
|
|
5470
|
+
console.log(`${chalk66.red(rule.pattern)} \u2192 ${rule.message}`);
|
|
5409
5471
|
}
|
|
5410
5472
|
}
|
|
5411
5473
|
|
|
5412
5474
|
// src/commands/deny/denyRemove.ts
|
|
5413
|
-
import
|
|
5475
|
+
import chalk67 from "chalk";
|
|
5414
5476
|
function denyRemove(pattern2) {
|
|
5415
5477
|
const config = loadProjectConfig();
|
|
5416
5478
|
const deny = config.deny ?? [];
|
|
5417
5479
|
const index = deny.findIndex((r) => r.pattern === pattern2);
|
|
5418
5480
|
if (index === -1) {
|
|
5419
|
-
console.log(
|
|
5481
|
+
console.log(chalk67.yellow(`No deny rule found for: ${pattern2}`));
|
|
5420
5482
|
return;
|
|
5421
5483
|
}
|
|
5422
5484
|
deny.splice(index, 1);
|
|
5423
5485
|
config.deny = deny.length > 0 ? deny : void 0;
|
|
5424
5486
|
saveConfig(config);
|
|
5425
|
-
console.log(
|
|
5487
|
+
console.log(chalk67.green(`Removed deny rule: ${pattern2}`));
|
|
5426
5488
|
}
|
|
5427
5489
|
|
|
5428
5490
|
// src/commands/registerDeny.ts
|
|
@@ -5451,15 +5513,15 @@ function registerCliHook(program2) {
|
|
|
5451
5513
|
}
|
|
5452
5514
|
|
|
5453
5515
|
// src/commands/complexity/analyze.ts
|
|
5454
|
-
import
|
|
5516
|
+
import chalk73 from "chalk";
|
|
5455
5517
|
|
|
5456
5518
|
// src/commands/complexity/cyclomatic.ts
|
|
5457
|
-
import
|
|
5519
|
+
import chalk69 from "chalk";
|
|
5458
5520
|
|
|
5459
5521
|
// src/commands/complexity/shared/index.ts
|
|
5460
5522
|
import fs12 from "fs";
|
|
5461
5523
|
import path20 from "path";
|
|
5462
|
-
import
|
|
5524
|
+
import chalk68 from "chalk";
|
|
5463
5525
|
import ts5 from "typescript";
|
|
5464
5526
|
|
|
5465
5527
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -5705,7 +5767,7 @@ function createSourceFromFile(filePath) {
|
|
|
5705
5767
|
function withSourceFiles(pattern2, callback) {
|
|
5706
5768
|
const files = findSourceFiles2(pattern2);
|
|
5707
5769
|
if (files.length === 0) {
|
|
5708
|
-
console.log(
|
|
5770
|
+
console.log(chalk68.yellow("No files found matching pattern"));
|
|
5709
5771
|
return void 0;
|
|
5710
5772
|
}
|
|
5711
5773
|
return callback(files);
|
|
@@ -5738,11 +5800,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5738
5800
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
5739
5801
|
for (const { file, name, complexity } of results) {
|
|
5740
5802
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
5741
|
-
const color = exceedsThreshold ?
|
|
5742
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
5803
|
+
const color = exceedsThreshold ? chalk69.red : chalk69.white;
|
|
5804
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk69.cyan(complexity)}`);
|
|
5743
5805
|
}
|
|
5744
5806
|
console.log(
|
|
5745
|
-
|
|
5807
|
+
chalk69.dim(
|
|
5746
5808
|
`
|
|
5747
5809
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
5748
5810
|
)
|
|
@@ -5754,7 +5816,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
5754
5816
|
}
|
|
5755
5817
|
|
|
5756
5818
|
// src/commands/complexity/halstead.ts
|
|
5757
|
-
import
|
|
5819
|
+
import chalk70 from "chalk";
|
|
5758
5820
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
5759
5821
|
withSourceFiles(pattern2, (files) => {
|
|
5760
5822
|
const results = [];
|
|
@@ -5769,13 +5831,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5769
5831
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
5770
5832
|
for (const { file, name, metrics } of results) {
|
|
5771
5833
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
5772
|
-
const color = exceedsThreshold ?
|
|
5834
|
+
const color = exceedsThreshold ? chalk70.red : chalk70.white;
|
|
5773
5835
|
console.log(
|
|
5774
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
5836
|
+
`${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
5837
|
);
|
|
5776
5838
|
}
|
|
5777
5839
|
console.log(
|
|
5778
|
-
|
|
5840
|
+
chalk70.dim(
|
|
5779
5841
|
`
|
|
5780
5842
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
5781
5843
|
)
|
|
@@ -5790,28 +5852,28 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
5790
5852
|
import fs13 from "fs";
|
|
5791
5853
|
|
|
5792
5854
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
5793
|
-
import
|
|
5855
|
+
import chalk71 from "chalk";
|
|
5794
5856
|
function displayMaintainabilityResults(results, threshold) {
|
|
5795
5857
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
5796
5858
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
5797
|
-
console.log(
|
|
5859
|
+
console.log(chalk71.green("All files pass maintainability threshold"));
|
|
5798
5860
|
} else {
|
|
5799
5861
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
5800
|
-
const color = threshold !== void 0 ?
|
|
5862
|
+
const color = threshold !== void 0 ? chalk71.red : chalk71.white;
|
|
5801
5863
|
console.log(
|
|
5802
|
-
`${color(file)} \u2192 avg: ${
|
|
5864
|
+
`${color(file)} \u2192 avg: ${chalk71.cyan(avgMaintainability.toFixed(1))}, min: ${chalk71.yellow(minMaintainability.toFixed(1))}`
|
|
5803
5865
|
);
|
|
5804
5866
|
}
|
|
5805
5867
|
}
|
|
5806
|
-
console.log(
|
|
5868
|
+
console.log(chalk71.dim(`
|
|
5807
5869
|
Analyzed ${results.length} files`));
|
|
5808
5870
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
5809
5871
|
console.error(
|
|
5810
|
-
|
|
5872
|
+
chalk71.red(
|
|
5811
5873
|
`
|
|
5812
5874
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
5813
5875
|
|
|
5814
|
-
\u26A0\uFE0F ${
|
|
5876
|
+
\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
5877
|
)
|
|
5816
5878
|
);
|
|
5817
5879
|
process.exit(1);
|
|
@@ -5868,7 +5930,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5868
5930
|
|
|
5869
5931
|
// src/commands/complexity/sloc.ts
|
|
5870
5932
|
import fs14 from "fs";
|
|
5871
|
-
import
|
|
5933
|
+
import chalk72 from "chalk";
|
|
5872
5934
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
5873
5935
|
withSourceFiles(pattern2, (files) => {
|
|
5874
5936
|
const results = [];
|
|
@@ -5884,12 +5946,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5884
5946
|
results.sort((a, b) => b.lines - a.lines);
|
|
5885
5947
|
for (const { file, lines } of results) {
|
|
5886
5948
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
5887
|
-
const color = exceedsThreshold ?
|
|
5888
|
-
console.log(`${color(file)} \u2192 ${
|
|
5949
|
+
const color = exceedsThreshold ? chalk72.red : chalk72.white;
|
|
5950
|
+
console.log(`${color(file)} \u2192 ${chalk72.cyan(lines)} lines`);
|
|
5889
5951
|
}
|
|
5890
5952
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
5891
5953
|
console.log(
|
|
5892
|
-
|
|
5954
|
+
chalk72.dim(`
|
|
5893
5955
|
Total: ${total} lines across ${files.length} files`)
|
|
5894
5956
|
);
|
|
5895
5957
|
if (hasViolation) {
|
|
@@ -5903,21 +5965,21 @@ async function analyze(pattern2) {
|
|
|
5903
5965
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
5904
5966
|
const files = findSourceFiles2(searchPattern);
|
|
5905
5967
|
if (files.length === 0) {
|
|
5906
|
-
console.log(
|
|
5968
|
+
console.log(chalk73.yellow("No files found matching pattern"));
|
|
5907
5969
|
return;
|
|
5908
5970
|
}
|
|
5909
5971
|
if (files.length === 1) {
|
|
5910
5972
|
const file = files[0];
|
|
5911
|
-
console.log(
|
|
5973
|
+
console.log(chalk73.bold.underline("SLOC"));
|
|
5912
5974
|
await sloc(file);
|
|
5913
5975
|
console.log();
|
|
5914
|
-
console.log(
|
|
5976
|
+
console.log(chalk73.bold.underline("Cyclomatic Complexity"));
|
|
5915
5977
|
await cyclomatic(file);
|
|
5916
5978
|
console.log();
|
|
5917
|
-
console.log(
|
|
5979
|
+
console.log(chalk73.bold.underline("Halstead Metrics"));
|
|
5918
5980
|
await halstead(file);
|
|
5919
5981
|
console.log();
|
|
5920
|
-
console.log(
|
|
5982
|
+
console.log(chalk73.bold.underline("Maintainability Index"));
|
|
5921
5983
|
await maintainability(file);
|
|
5922
5984
|
return;
|
|
5923
5985
|
}
|
|
@@ -5944,7 +6006,7 @@ function registerComplexity(program2) {
|
|
|
5944
6006
|
}
|
|
5945
6007
|
|
|
5946
6008
|
// src/commands/config/index.ts
|
|
5947
|
-
import
|
|
6009
|
+
import chalk74 from "chalk";
|
|
5948
6010
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
5949
6011
|
|
|
5950
6012
|
// src/commands/config/setNestedValue.ts
|
|
@@ -6007,7 +6069,7 @@ function formatIssuePath(issue, key) {
|
|
|
6007
6069
|
function printValidationErrors(issues, key) {
|
|
6008
6070
|
for (const issue of issues) {
|
|
6009
6071
|
console.error(
|
|
6010
|
-
|
|
6072
|
+
chalk74.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
6011
6073
|
);
|
|
6012
6074
|
}
|
|
6013
6075
|
}
|
|
@@ -6024,7 +6086,7 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
6024
6086
|
function assertNotGlobalOnly(key, global) {
|
|
6025
6087
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
6026
6088
|
console.error(
|
|
6027
|
-
|
|
6089
|
+
chalk74.red(
|
|
6028
6090
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
6029
6091
|
)
|
|
6030
6092
|
);
|
|
@@ -6047,7 +6109,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
6047
6109
|
applyConfigSet(key, coerced, options2.global ?? false);
|
|
6048
6110
|
const target = options2.global ? "global" : "project";
|
|
6049
6111
|
console.log(
|
|
6050
|
-
|
|
6112
|
+
chalk74.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
6051
6113
|
);
|
|
6052
6114
|
}
|
|
6053
6115
|
function configList() {
|
|
@@ -6056,7 +6118,7 @@ function configList() {
|
|
|
6056
6118
|
}
|
|
6057
6119
|
|
|
6058
6120
|
// src/commands/config/configGet.ts
|
|
6059
|
-
import
|
|
6121
|
+
import chalk75 from "chalk";
|
|
6060
6122
|
|
|
6061
6123
|
// src/commands/config/getNestedValue.ts
|
|
6062
6124
|
function isTraversable(value) {
|
|
@@ -6088,7 +6150,7 @@ function requireNestedValue(config, key) {
|
|
|
6088
6150
|
return value;
|
|
6089
6151
|
}
|
|
6090
6152
|
function exitKeyNotSet(key) {
|
|
6091
|
-
console.error(
|
|
6153
|
+
console.error(chalk75.red(`Key "${key}" is not set`));
|
|
6092
6154
|
process.exit(1);
|
|
6093
6155
|
}
|
|
6094
6156
|
|
|
@@ -6102,7 +6164,7 @@ function registerConfig(program2) {
|
|
|
6102
6164
|
|
|
6103
6165
|
// src/commands/deploy/redirect.ts
|
|
6104
6166
|
import { existsSync as existsSync22, readFileSync as readFileSync19, writeFileSync as writeFileSync18 } from "fs";
|
|
6105
|
-
import
|
|
6167
|
+
import chalk76 from "chalk";
|
|
6106
6168
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
6107
6169
|
if (!window.location.pathname.endsWith('/')) {
|
|
6108
6170
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -6111,22 +6173,22 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
6111
6173
|
function redirect() {
|
|
6112
6174
|
const indexPath = "index.html";
|
|
6113
6175
|
if (!existsSync22(indexPath)) {
|
|
6114
|
-
console.log(
|
|
6176
|
+
console.log(chalk76.yellow("No index.html found"));
|
|
6115
6177
|
return;
|
|
6116
6178
|
}
|
|
6117
6179
|
const content = readFileSync19(indexPath, "utf-8");
|
|
6118
6180
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
6119
|
-
console.log(
|
|
6181
|
+
console.log(chalk76.dim("Trailing slash script already present"));
|
|
6120
6182
|
return;
|
|
6121
6183
|
}
|
|
6122
6184
|
const headCloseIndex = content.indexOf("</head>");
|
|
6123
6185
|
if (headCloseIndex === -1) {
|
|
6124
|
-
console.log(
|
|
6186
|
+
console.log(chalk76.red("Could not find </head> tag in index.html"));
|
|
6125
6187
|
return;
|
|
6126
6188
|
}
|
|
6127
6189
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
6128
6190
|
writeFileSync18(indexPath, newContent);
|
|
6129
|
-
console.log(
|
|
6191
|
+
console.log(chalk76.green("Added trailing slash redirect to index.html"));
|
|
6130
6192
|
}
|
|
6131
6193
|
|
|
6132
6194
|
// src/commands/registerDeploy.ts
|
|
@@ -6153,7 +6215,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
6153
6215
|
|
|
6154
6216
|
// src/commands/devlog/shared.ts
|
|
6155
6217
|
import { execSync as execSync18 } from "child_process";
|
|
6156
|
-
import
|
|
6218
|
+
import chalk77 from "chalk";
|
|
6157
6219
|
|
|
6158
6220
|
// src/shared/getRepoName.ts
|
|
6159
6221
|
import { existsSync as existsSync23, readFileSync as readFileSync20 } from "fs";
|
|
@@ -6262,13 +6324,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
6262
6324
|
}
|
|
6263
6325
|
function printCommitsWithFiles(commits, ignore2, verbose) {
|
|
6264
6326
|
for (const commit2 of commits) {
|
|
6265
|
-
console.log(` ${
|
|
6327
|
+
console.log(` ${chalk77.yellow(commit2.hash)} ${commit2.message}`);
|
|
6266
6328
|
if (verbose) {
|
|
6267
6329
|
const visibleFiles = commit2.files.filter(
|
|
6268
6330
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
6269
6331
|
);
|
|
6270
6332
|
for (const file of visibleFiles) {
|
|
6271
|
-
console.log(` ${
|
|
6333
|
+
console.log(` ${chalk77.dim(file)}`);
|
|
6272
6334
|
}
|
|
6273
6335
|
}
|
|
6274
6336
|
}
|
|
@@ -6293,15 +6355,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
6293
6355
|
}
|
|
6294
6356
|
|
|
6295
6357
|
// src/commands/devlog/list/printDateHeader.ts
|
|
6296
|
-
import
|
|
6358
|
+
import chalk78 from "chalk";
|
|
6297
6359
|
function printDateHeader(date, isSkipped, entries) {
|
|
6298
6360
|
if (isSkipped) {
|
|
6299
|
-
console.log(`${
|
|
6361
|
+
console.log(`${chalk78.bold.blue(date)} ${chalk78.dim("skipped")}`);
|
|
6300
6362
|
} else if (entries && entries.length > 0) {
|
|
6301
|
-
const entryInfo = entries.map((e) => `${
|
|
6302
|
-
console.log(`${
|
|
6363
|
+
const entryInfo = entries.map((e) => `${chalk78.green(e.version)} ${e.title}`).join(" | ");
|
|
6364
|
+
console.log(`${chalk78.bold.blue(date)} ${entryInfo}`);
|
|
6303
6365
|
} else {
|
|
6304
|
-
console.log(`${
|
|
6366
|
+
console.log(`${chalk78.bold.blue(date)} ${chalk78.red("\u26A0 devlog missing")}`);
|
|
6305
6367
|
}
|
|
6306
6368
|
}
|
|
6307
6369
|
|
|
@@ -6405,24 +6467,24 @@ function bumpVersion(version2, type) {
|
|
|
6405
6467
|
|
|
6406
6468
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
6407
6469
|
import { execSync as execSync21 } from "child_process";
|
|
6408
|
-
import
|
|
6470
|
+
import chalk80 from "chalk";
|
|
6409
6471
|
|
|
6410
6472
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
6411
|
-
import
|
|
6473
|
+
import chalk79 from "chalk";
|
|
6412
6474
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
6413
6475
|
if (conventional && firstHash) {
|
|
6414
6476
|
const version2 = getVersionAtCommit(firstHash);
|
|
6415
6477
|
if (version2) {
|
|
6416
|
-
console.log(`${
|
|
6478
|
+
console.log(`${chalk79.bold("version:")} ${stripToMinor(version2)}`);
|
|
6417
6479
|
} else {
|
|
6418
|
-
console.log(`${
|
|
6480
|
+
console.log(`${chalk79.bold("version:")} ${chalk79.red("unknown")}`);
|
|
6419
6481
|
}
|
|
6420
6482
|
} else if (patchVersion && minorVersion) {
|
|
6421
6483
|
console.log(
|
|
6422
|
-
`${
|
|
6484
|
+
`${chalk79.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
6423
6485
|
);
|
|
6424
6486
|
} else {
|
|
6425
|
-
console.log(`${
|
|
6487
|
+
console.log(`${chalk79.bold("version:")} v0.1 (initial)`);
|
|
6426
6488
|
}
|
|
6427
6489
|
}
|
|
6428
6490
|
|
|
@@ -6469,16 +6531,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
6469
6531
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
6470
6532
|
}
|
|
6471
6533
|
function logName(repoName) {
|
|
6472
|
-
console.log(`${
|
|
6534
|
+
console.log(`${chalk80.bold("name:")} ${repoName}`);
|
|
6473
6535
|
}
|
|
6474
6536
|
function displayNextEntry(ctx, targetDate, commits) {
|
|
6475
6537
|
logName(ctx.repoName);
|
|
6476
6538
|
printVersionInfo(ctx.config, ctx.lastInfo, commits[0]?.hash);
|
|
6477
|
-
console.log(
|
|
6539
|
+
console.log(chalk80.bold.blue(targetDate));
|
|
6478
6540
|
printCommitsWithFiles(commits, ctx.ignore, ctx.verbose);
|
|
6479
6541
|
}
|
|
6480
6542
|
function logNoCommits(lastInfo) {
|
|
6481
|
-
console.log(
|
|
6543
|
+
console.log(chalk80.dim(noCommitsMessage(!!lastInfo)));
|
|
6482
6544
|
}
|
|
6483
6545
|
|
|
6484
6546
|
// src/commands/devlog/next/index.ts
|
|
@@ -6519,11 +6581,11 @@ function next2(options2) {
|
|
|
6519
6581
|
import { execSync as execSync22 } from "child_process";
|
|
6520
6582
|
|
|
6521
6583
|
// src/commands/devlog/repos/printReposTable.ts
|
|
6522
|
-
import
|
|
6584
|
+
import chalk81 from "chalk";
|
|
6523
6585
|
function colorStatus(status2) {
|
|
6524
|
-
if (status2 === "missing") return
|
|
6525
|
-
if (status2 === "outdated") return
|
|
6526
|
-
return
|
|
6586
|
+
if (status2 === "missing") return chalk81.red(status2);
|
|
6587
|
+
if (status2 === "outdated") return chalk81.yellow(status2);
|
|
6588
|
+
return chalk81.green(status2);
|
|
6527
6589
|
}
|
|
6528
6590
|
function formatRow(row, nameWidth) {
|
|
6529
6591
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -6537,8 +6599,8 @@ function printReposTable(rows) {
|
|
|
6537
6599
|
"Last Devlog".padEnd(11),
|
|
6538
6600
|
"Status"
|
|
6539
6601
|
].join(" ");
|
|
6540
|
-
console.log(
|
|
6541
|
-
console.log(
|
|
6602
|
+
console.log(chalk81.dim(header));
|
|
6603
|
+
console.log(chalk81.dim("-".repeat(header.length)));
|
|
6542
6604
|
for (const row of rows) {
|
|
6543
6605
|
console.log(formatRow(row, nameWidth));
|
|
6544
6606
|
}
|
|
@@ -6596,14 +6658,14 @@ function repos(options2) {
|
|
|
6596
6658
|
// src/commands/devlog/skip.ts
|
|
6597
6659
|
import { writeFileSync as writeFileSync19 } from "fs";
|
|
6598
6660
|
import { join as join22 } from "path";
|
|
6599
|
-
import
|
|
6661
|
+
import chalk82 from "chalk";
|
|
6600
6662
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
6601
6663
|
function getBlogConfigPath() {
|
|
6602
6664
|
return join22(BLOG_REPO_ROOT, "assist.yml");
|
|
6603
6665
|
}
|
|
6604
6666
|
function skip(date) {
|
|
6605
6667
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
6606
|
-
console.log(
|
|
6668
|
+
console.log(chalk82.red("Invalid date format. Use YYYY-MM-DD"));
|
|
6607
6669
|
process.exit(1);
|
|
6608
6670
|
}
|
|
6609
6671
|
const repoName = getRepoName();
|
|
@@ -6614,7 +6676,7 @@ function skip(date) {
|
|
|
6614
6676
|
const skipDays = skip2[repoName] ?? [];
|
|
6615
6677
|
if (skipDays.includes(date)) {
|
|
6616
6678
|
console.log(
|
|
6617
|
-
|
|
6679
|
+
chalk82.yellow(`${date} is already in skip list for ${repoName}`)
|
|
6618
6680
|
);
|
|
6619
6681
|
return;
|
|
6620
6682
|
}
|
|
@@ -6624,20 +6686,20 @@ function skip(date) {
|
|
|
6624
6686
|
devlog.skip = skip2;
|
|
6625
6687
|
config.devlog = devlog;
|
|
6626
6688
|
writeFileSync19(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
6627
|
-
console.log(
|
|
6689
|
+
console.log(chalk82.green(`Added ${date} to skip list for ${repoName}`));
|
|
6628
6690
|
}
|
|
6629
6691
|
|
|
6630
6692
|
// src/commands/devlog/version.ts
|
|
6631
|
-
import
|
|
6693
|
+
import chalk83 from "chalk";
|
|
6632
6694
|
function version() {
|
|
6633
6695
|
const config = loadConfig();
|
|
6634
6696
|
const name = getRepoName();
|
|
6635
6697
|
const lastInfo = getLastVersionInfo(name, config);
|
|
6636
6698
|
const lastVersion = lastInfo?.version ?? null;
|
|
6637
6699
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
6638
|
-
console.log(`${
|
|
6639
|
-
console.log(`${
|
|
6640
|
-
console.log(`${
|
|
6700
|
+
console.log(`${chalk83.bold("name:")} ${name}`);
|
|
6701
|
+
console.log(`${chalk83.bold("last:")} ${lastVersion ?? chalk83.dim("none")}`);
|
|
6702
|
+
console.log(`${chalk83.bold("next:")} ${nextVersion ?? chalk83.dim("none")}`);
|
|
6641
6703
|
}
|
|
6642
6704
|
|
|
6643
6705
|
// src/commands/registerDevlog.ts
|
|
@@ -6661,7 +6723,7 @@ function registerDevlog(program2) {
|
|
|
6661
6723
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
6662
6724
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
6663
6725
|
import { join as join23 } from "path";
|
|
6664
|
-
import
|
|
6726
|
+
import chalk84 from "chalk";
|
|
6665
6727
|
|
|
6666
6728
|
// src/shared/findRepoRoot.ts
|
|
6667
6729
|
import { existsSync as existsSync24 } from "fs";
|
|
@@ -6724,14 +6786,14 @@ function checkBuildLocks(startDir) {
|
|
|
6724
6786
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
6725
6787
|
if (locked) {
|
|
6726
6788
|
console.error(
|
|
6727
|
-
|
|
6789
|
+
chalk84.red("Build output locked (is VS debugging?): ") + locked
|
|
6728
6790
|
);
|
|
6729
6791
|
process.exit(1);
|
|
6730
6792
|
}
|
|
6731
6793
|
}
|
|
6732
6794
|
async function checkBuildLocksCommand() {
|
|
6733
6795
|
checkBuildLocks();
|
|
6734
|
-
console.log(
|
|
6796
|
+
console.log(chalk84.green("No build locks detected"));
|
|
6735
6797
|
}
|
|
6736
6798
|
|
|
6737
6799
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -6830,30 +6892,30 @@ function escapeRegex(s) {
|
|
|
6830
6892
|
}
|
|
6831
6893
|
|
|
6832
6894
|
// src/commands/dotnet/printTree.ts
|
|
6833
|
-
import
|
|
6895
|
+
import chalk85 from "chalk";
|
|
6834
6896
|
function printNodes(nodes, prefix2) {
|
|
6835
6897
|
for (let i = 0; i < nodes.length; i++) {
|
|
6836
6898
|
const isLast = i === nodes.length - 1;
|
|
6837
6899
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
6838
6900
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
6839
6901
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
6840
|
-
const label2 = isMissing ?
|
|
6902
|
+
const label2 = isMissing ? chalk85.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
6841
6903
|
console.log(`${prefix2}${connector}${label2}`);
|
|
6842
6904
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
6843
6905
|
}
|
|
6844
6906
|
}
|
|
6845
6907
|
function printTree(tree, totalCount, solutions) {
|
|
6846
|
-
console.log(
|
|
6847
|
-
console.log(
|
|
6908
|
+
console.log(chalk85.bold("\nProject Dependency Tree"));
|
|
6909
|
+
console.log(chalk85.cyan(tree.relativePath));
|
|
6848
6910
|
printNodes(tree.children, "");
|
|
6849
|
-
console.log(
|
|
6911
|
+
console.log(chalk85.dim(`
|
|
6850
6912
|
${totalCount} projects total (including root)`));
|
|
6851
|
-
console.log(
|
|
6913
|
+
console.log(chalk85.bold("\nSolution Membership"));
|
|
6852
6914
|
if (solutions.length === 0) {
|
|
6853
|
-
console.log(
|
|
6915
|
+
console.log(chalk85.yellow(" Not found in any .sln"));
|
|
6854
6916
|
} else {
|
|
6855
6917
|
for (const sln of solutions) {
|
|
6856
|
-
console.log(` ${
|
|
6918
|
+
console.log(` ${chalk85.green(sln)}`);
|
|
6857
6919
|
}
|
|
6858
6920
|
}
|
|
6859
6921
|
console.log();
|
|
@@ -6882,16 +6944,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
6882
6944
|
// src/commands/dotnet/resolveCsproj.ts
|
|
6883
6945
|
import { existsSync as existsSync25 } from "fs";
|
|
6884
6946
|
import path24 from "path";
|
|
6885
|
-
import
|
|
6947
|
+
import chalk86 from "chalk";
|
|
6886
6948
|
function resolveCsproj(csprojPath) {
|
|
6887
6949
|
const resolved = path24.resolve(csprojPath);
|
|
6888
6950
|
if (!existsSync25(resolved)) {
|
|
6889
|
-
console.error(
|
|
6951
|
+
console.error(chalk86.red(`File not found: ${resolved}`));
|
|
6890
6952
|
process.exit(1);
|
|
6891
6953
|
}
|
|
6892
6954
|
const repoRoot = findRepoRoot(path24.dirname(resolved));
|
|
6893
6955
|
if (!repoRoot) {
|
|
6894
|
-
console.error(
|
|
6956
|
+
console.error(chalk86.red("Could not find git repository root"));
|
|
6895
6957
|
process.exit(1);
|
|
6896
6958
|
}
|
|
6897
6959
|
return { resolved, repoRoot };
|
|
@@ -6941,12 +7003,12 @@ function getChangedCsFiles(scope) {
|
|
|
6941
7003
|
}
|
|
6942
7004
|
|
|
6943
7005
|
// src/commands/dotnet/inSln.ts
|
|
6944
|
-
import
|
|
7006
|
+
import chalk87 from "chalk";
|
|
6945
7007
|
async function inSln(csprojPath) {
|
|
6946
7008
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
6947
7009
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
6948
7010
|
if (solutions.length === 0) {
|
|
6949
|
-
console.log(
|
|
7011
|
+
console.log(chalk87.yellow("Not found in any .sln file"));
|
|
6950
7012
|
process.exit(1);
|
|
6951
7013
|
}
|
|
6952
7014
|
for (const sln of solutions) {
|
|
@@ -6955,7 +7017,7 @@ async function inSln(csprojPath) {
|
|
|
6955
7017
|
}
|
|
6956
7018
|
|
|
6957
7019
|
// src/commands/dotnet/inspect.ts
|
|
6958
|
-
import
|
|
7020
|
+
import chalk93 from "chalk";
|
|
6959
7021
|
|
|
6960
7022
|
// src/shared/formatElapsed.ts
|
|
6961
7023
|
function formatElapsed(ms) {
|
|
@@ -6967,12 +7029,12 @@ function formatElapsed(ms) {
|
|
|
6967
7029
|
}
|
|
6968
7030
|
|
|
6969
7031
|
// src/commands/dotnet/displayIssues.ts
|
|
6970
|
-
import
|
|
7032
|
+
import chalk88 from "chalk";
|
|
6971
7033
|
var SEVERITY_COLOR = {
|
|
6972
|
-
ERROR:
|
|
6973
|
-
WARNING:
|
|
6974
|
-
SUGGESTION:
|
|
6975
|
-
HINT:
|
|
7034
|
+
ERROR: chalk88.red,
|
|
7035
|
+
WARNING: chalk88.yellow,
|
|
7036
|
+
SUGGESTION: chalk88.cyan,
|
|
7037
|
+
HINT: chalk88.dim
|
|
6976
7038
|
};
|
|
6977
7039
|
function groupByFile(issues) {
|
|
6978
7040
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -6988,15 +7050,15 @@ function groupByFile(issues) {
|
|
|
6988
7050
|
}
|
|
6989
7051
|
function displayIssues(issues) {
|
|
6990
7052
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
6991
|
-
console.log(
|
|
7053
|
+
console.log(chalk88.bold(file));
|
|
6992
7054
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
6993
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
7055
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk88.white;
|
|
6994
7056
|
console.log(
|
|
6995
|
-
` ${
|
|
7057
|
+
` ${chalk88.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
6996
7058
|
);
|
|
6997
7059
|
}
|
|
6998
7060
|
}
|
|
6999
|
-
console.log(
|
|
7061
|
+
console.log(chalk88.dim(`
|
|
7000
7062
|
${issues.length} issue(s) found`));
|
|
7001
7063
|
}
|
|
7002
7064
|
|
|
@@ -7055,12 +7117,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
7055
7117
|
// src/commands/dotnet/resolveSolution.ts
|
|
7056
7118
|
import { existsSync as existsSync26 } from "fs";
|
|
7057
7119
|
import path25 from "path";
|
|
7058
|
-
import
|
|
7120
|
+
import chalk90 from "chalk";
|
|
7059
7121
|
|
|
7060
7122
|
// src/commands/dotnet/findSolution.ts
|
|
7061
7123
|
import { readdirSync as readdirSync4 } from "fs";
|
|
7062
7124
|
import { dirname as dirname16, join as join24 } from "path";
|
|
7063
|
-
import
|
|
7125
|
+
import chalk89 from "chalk";
|
|
7064
7126
|
function findSlnInDir(dir) {
|
|
7065
7127
|
try {
|
|
7066
7128
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join24(dir, f));
|
|
@@ -7076,17 +7138,17 @@ function findSolution() {
|
|
|
7076
7138
|
const slnFiles = findSlnInDir(current);
|
|
7077
7139
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
7078
7140
|
if (slnFiles.length > 1) {
|
|
7079
|
-
console.error(
|
|
7141
|
+
console.error(chalk89.red(`Multiple .sln files found in ${current}:`));
|
|
7080
7142
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
7081
7143
|
console.error(
|
|
7082
|
-
|
|
7144
|
+
chalk89.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
7083
7145
|
);
|
|
7084
7146
|
process.exit(1);
|
|
7085
7147
|
}
|
|
7086
7148
|
if (current === ceiling) break;
|
|
7087
7149
|
current = dirname16(current);
|
|
7088
7150
|
}
|
|
7089
|
-
console.error(
|
|
7151
|
+
console.error(chalk89.red("No .sln file found between cwd and repo root"));
|
|
7090
7152
|
process.exit(1);
|
|
7091
7153
|
}
|
|
7092
7154
|
|
|
@@ -7095,7 +7157,7 @@ function resolveSolution(sln) {
|
|
|
7095
7157
|
if (sln) {
|
|
7096
7158
|
const resolved = path25.resolve(sln);
|
|
7097
7159
|
if (!existsSync26(resolved)) {
|
|
7098
|
-
console.error(
|
|
7160
|
+
console.error(chalk90.red(`Solution file not found: ${resolved}`));
|
|
7099
7161
|
process.exit(1);
|
|
7100
7162
|
}
|
|
7101
7163
|
return resolved;
|
|
@@ -7137,14 +7199,14 @@ import { execSync as execSync24 } from "child_process";
|
|
|
7137
7199
|
import { existsSync as existsSync27, readFileSync as readFileSync24, unlinkSync as unlinkSync5 } from "fs";
|
|
7138
7200
|
import { tmpdir as tmpdir2 } from "os";
|
|
7139
7201
|
import path26 from "path";
|
|
7140
|
-
import
|
|
7202
|
+
import chalk91 from "chalk";
|
|
7141
7203
|
function assertJbInstalled() {
|
|
7142
7204
|
try {
|
|
7143
7205
|
execSync24("jb inspectcode --version", { stdio: "pipe" });
|
|
7144
7206
|
} catch {
|
|
7145
|
-
console.error(
|
|
7207
|
+
console.error(chalk91.red("jb is not installed. Install with:"));
|
|
7146
7208
|
console.error(
|
|
7147
|
-
|
|
7209
|
+
chalk91.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
7148
7210
|
);
|
|
7149
7211
|
process.exit(1);
|
|
7150
7212
|
}
|
|
@@ -7162,11 +7224,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
7162
7224
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
7163
7225
|
process.stderr.write(err.stderr);
|
|
7164
7226
|
}
|
|
7165
|
-
console.error(
|
|
7227
|
+
console.error(chalk91.red("jb inspectcode failed"));
|
|
7166
7228
|
process.exit(1);
|
|
7167
7229
|
}
|
|
7168
7230
|
if (!existsSync27(reportPath)) {
|
|
7169
|
-
console.error(
|
|
7231
|
+
console.error(chalk91.red("Report file not generated"));
|
|
7170
7232
|
process.exit(1);
|
|
7171
7233
|
}
|
|
7172
7234
|
const xml = readFileSync24(reportPath, "utf-8");
|
|
@@ -7176,7 +7238,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
7176
7238
|
|
|
7177
7239
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
7178
7240
|
import { execSync as execSync25 } from "child_process";
|
|
7179
|
-
import
|
|
7241
|
+
import chalk92 from "chalk";
|
|
7180
7242
|
function resolveMsbuildPath() {
|
|
7181
7243
|
const config = loadConfig();
|
|
7182
7244
|
const buildConfig = config.run?.find((r) => r.name === "build");
|
|
@@ -7187,9 +7249,9 @@ function assertMsbuildInstalled() {
|
|
|
7187
7249
|
try {
|
|
7188
7250
|
execSync25(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
7189
7251
|
} catch {
|
|
7190
|
-
console.error(
|
|
7252
|
+
console.error(chalk92.red(`msbuild not found at: ${msbuild}`));
|
|
7191
7253
|
console.error(
|
|
7192
|
-
|
|
7254
|
+
chalk92.yellow(
|
|
7193
7255
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
7194
7256
|
)
|
|
7195
7257
|
);
|
|
@@ -7236,17 +7298,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
7236
7298
|
// src/commands/dotnet/inspect.ts
|
|
7237
7299
|
function logScope(changedFiles) {
|
|
7238
7300
|
if (changedFiles === null) {
|
|
7239
|
-
console.log(
|
|
7301
|
+
console.log(chalk93.dim("Inspecting full solution..."));
|
|
7240
7302
|
} else {
|
|
7241
7303
|
console.log(
|
|
7242
|
-
|
|
7304
|
+
chalk93.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
7243
7305
|
);
|
|
7244
7306
|
}
|
|
7245
7307
|
}
|
|
7246
7308
|
function reportResults(issues, elapsed) {
|
|
7247
7309
|
if (issues.length > 0) displayIssues(issues);
|
|
7248
|
-
else console.log(
|
|
7249
|
-
console.log(
|
|
7310
|
+
else console.log(chalk93.green("No issues found"));
|
|
7311
|
+
console.log(chalk93.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
7250
7312
|
if (issues.length > 0) process.exit(1);
|
|
7251
7313
|
}
|
|
7252
7314
|
async function inspect(sln, options2) {
|
|
@@ -7257,7 +7319,7 @@ async function inspect(sln, options2) {
|
|
|
7257
7319
|
const scope = parseScope(options2.scope);
|
|
7258
7320
|
const changedFiles = getChangedCsFiles(scope);
|
|
7259
7321
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
7260
|
-
console.log(
|
|
7322
|
+
console.log(chalk93.green("No changed .cs files found"));
|
|
7261
7323
|
return;
|
|
7262
7324
|
}
|
|
7263
7325
|
logScope(changedFiles);
|
|
@@ -7283,7 +7345,7 @@ function registerDotnet(program2) {
|
|
|
7283
7345
|
}
|
|
7284
7346
|
|
|
7285
7347
|
// src/commands/jira/acceptanceCriteria.ts
|
|
7286
|
-
import
|
|
7348
|
+
import chalk95 from "chalk";
|
|
7287
7349
|
|
|
7288
7350
|
// src/commands/jira/adfToText.ts
|
|
7289
7351
|
function renderInline(node) {
|
|
@@ -7344,7 +7406,7 @@ function adfToText(doc) {
|
|
|
7344
7406
|
|
|
7345
7407
|
// src/commands/jira/fetchIssue.ts
|
|
7346
7408
|
import { execSync as execSync26 } from "child_process";
|
|
7347
|
-
import
|
|
7409
|
+
import chalk94 from "chalk";
|
|
7348
7410
|
function fetchIssue(issueKey, fields) {
|
|
7349
7411
|
let result;
|
|
7350
7412
|
try {
|
|
@@ -7357,15 +7419,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
7357
7419
|
const stderr = error.stderr;
|
|
7358
7420
|
if (stderr.includes("unauthorized")) {
|
|
7359
7421
|
console.error(
|
|
7360
|
-
|
|
7422
|
+
chalk94.red("Jira authentication expired."),
|
|
7361
7423
|
"Run",
|
|
7362
|
-
|
|
7424
|
+
chalk94.cyan("assist jira auth"),
|
|
7363
7425
|
"to re-authenticate."
|
|
7364
7426
|
);
|
|
7365
7427
|
process.exit(1);
|
|
7366
7428
|
}
|
|
7367
7429
|
}
|
|
7368
|
-
console.error(
|
|
7430
|
+
console.error(chalk94.red(`Failed to fetch ${issueKey}.`));
|
|
7369
7431
|
process.exit(1);
|
|
7370
7432
|
}
|
|
7371
7433
|
return JSON.parse(result);
|
|
@@ -7379,7 +7441,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
7379
7441
|
const parsed = fetchIssue(issueKey, field);
|
|
7380
7442
|
const acValue = parsed?.fields?.[field];
|
|
7381
7443
|
if (!acValue) {
|
|
7382
|
-
console.log(
|
|
7444
|
+
console.log(chalk95.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
7383
7445
|
return;
|
|
7384
7446
|
}
|
|
7385
7447
|
if (typeof acValue === "string") {
|
|
@@ -7474,14 +7536,14 @@ async function jiraAuth() {
|
|
|
7474
7536
|
}
|
|
7475
7537
|
|
|
7476
7538
|
// src/commands/jira/viewIssue.ts
|
|
7477
|
-
import
|
|
7539
|
+
import chalk96 from "chalk";
|
|
7478
7540
|
function viewIssue(issueKey) {
|
|
7479
7541
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
7480
7542
|
const fields = parsed?.fields;
|
|
7481
7543
|
const summary = fields?.summary;
|
|
7482
7544
|
const description = fields?.description;
|
|
7483
7545
|
if (summary) {
|
|
7484
|
-
console.log(
|
|
7546
|
+
console.log(chalk96.bold(summary));
|
|
7485
7547
|
}
|
|
7486
7548
|
if (description) {
|
|
7487
7549
|
if (summary) console.log();
|
|
@@ -7495,7 +7557,7 @@ function viewIssue(issueKey) {
|
|
|
7495
7557
|
}
|
|
7496
7558
|
if (!summary && !description) {
|
|
7497
7559
|
console.log(
|
|
7498
|
-
|
|
7560
|
+
chalk96.yellow(`No summary or description found on ${issueKey}.`)
|
|
7499
7561
|
);
|
|
7500
7562
|
}
|
|
7501
7563
|
}
|
|
@@ -7509,7 +7571,7 @@ function registerJira(program2) {
|
|
|
7509
7571
|
}
|
|
7510
7572
|
|
|
7511
7573
|
// src/commands/news/add/index.ts
|
|
7512
|
-
import
|
|
7574
|
+
import chalk97 from "chalk";
|
|
7513
7575
|
import enquirer8 from "enquirer";
|
|
7514
7576
|
async function add2(url) {
|
|
7515
7577
|
if (!url) {
|
|
@@ -7532,17 +7594,17 @@ async function add2(url) {
|
|
|
7532
7594
|
const news = config.news ?? {};
|
|
7533
7595
|
const feeds = news.feeds ?? [];
|
|
7534
7596
|
if (feeds.includes(url)) {
|
|
7535
|
-
console.log(
|
|
7597
|
+
console.log(chalk97.yellow("Feed already exists in config"));
|
|
7536
7598
|
return;
|
|
7537
7599
|
}
|
|
7538
7600
|
feeds.push(url);
|
|
7539
7601
|
config.news = { ...news, feeds };
|
|
7540
7602
|
saveGlobalConfig(config);
|
|
7541
|
-
console.log(
|
|
7603
|
+
console.log(chalk97.green(`Added feed: ${url}`));
|
|
7542
7604
|
}
|
|
7543
7605
|
|
|
7544
7606
|
// src/commands/news/web/handleRequest.ts
|
|
7545
|
-
import
|
|
7607
|
+
import chalk98 from "chalk";
|
|
7546
7608
|
|
|
7547
7609
|
// src/commands/news/web/shared.ts
|
|
7548
7610
|
import { decodeHTML } from "entities";
|
|
@@ -7678,17 +7740,17 @@ function prefetch() {
|
|
|
7678
7740
|
const config = loadConfig();
|
|
7679
7741
|
const total = config.news.feeds.length;
|
|
7680
7742
|
if (total === 0) return;
|
|
7681
|
-
process.stdout.write(
|
|
7743
|
+
process.stdout.write(chalk98.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
7682
7744
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
7683
7745
|
const width = 20;
|
|
7684
7746
|
const filled = Math.round(done2 / t * width);
|
|
7685
7747
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
7686
7748
|
process.stdout.write(
|
|
7687
|
-
`\r${
|
|
7749
|
+
`\r${chalk98.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
7688
7750
|
);
|
|
7689
7751
|
}).then((items) => {
|
|
7690
7752
|
process.stdout.write(
|
|
7691
|
-
`\r${
|
|
7753
|
+
`\r${chalk98.green(`Fetched ${items.length} items from ${total} feed(s)`)}
|
|
7692
7754
|
`
|
|
7693
7755
|
);
|
|
7694
7756
|
cachedItems = items;
|
|
@@ -8049,20 +8111,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
8049
8111
|
}
|
|
8050
8112
|
|
|
8051
8113
|
// src/commands/prs/listComments/printComments.ts
|
|
8052
|
-
import
|
|
8114
|
+
import chalk99 from "chalk";
|
|
8053
8115
|
function formatForHuman(comment3) {
|
|
8054
8116
|
if (comment3.type === "review") {
|
|
8055
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
8117
|
+
const stateColor = comment3.state === "APPROVED" ? chalk99.green : comment3.state === "CHANGES_REQUESTED" ? chalk99.red : chalk99.yellow;
|
|
8056
8118
|
return [
|
|
8057
|
-
`${
|
|
8119
|
+
`${chalk99.cyan("Review")} by ${chalk99.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
8058
8120
|
comment3.body,
|
|
8059
8121
|
""
|
|
8060
8122
|
].join("\n");
|
|
8061
8123
|
}
|
|
8062
8124
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
8063
8125
|
return [
|
|
8064
|
-
`${
|
|
8065
|
-
|
|
8126
|
+
`${chalk99.cyan("Line comment")} by ${chalk99.bold(comment3.user)} on ${chalk99.dim(`${comment3.path}${location}`)}`,
|
|
8127
|
+
chalk99.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
8066
8128
|
comment3.body,
|
|
8067
8129
|
""
|
|
8068
8130
|
].join("\n");
|
|
@@ -8152,13 +8214,13 @@ import { execSync as execSync33 } from "child_process";
|
|
|
8152
8214
|
import enquirer9 from "enquirer";
|
|
8153
8215
|
|
|
8154
8216
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
8155
|
-
import
|
|
8217
|
+
import chalk100 from "chalk";
|
|
8156
8218
|
var STATUS_MAP = {
|
|
8157
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
8158
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
8219
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk100.magenta("merged"), date: pr.mergedAt } : null,
|
|
8220
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk100.red("closed"), date: pr.closedAt } : null
|
|
8159
8221
|
};
|
|
8160
8222
|
function defaultStatus(pr) {
|
|
8161
|
-
return { label:
|
|
8223
|
+
return { label: chalk100.green("opened"), date: pr.createdAt };
|
|
8162
8224
|
}
|
|
8163
8225
|
function getStatus2(pr) {
|
|
8164
8226
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -8167,11 +8229,11 @@ function formatDate(dateStr) {
|
|
|
8167
8229
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
8168
8230
|
}
|
|
8169
8231
|
function formatPrHeader(pr, status2) {
|
|
8170
|
-
return `${
|
|
8232
|
+
return `${chalk100.cyan(`#${pr.number}`)} ${pr.title} ${chalk100.dim(`(${pr.author.login},`)} ${status2.label} ${chalk100.dim(`${formatDate(status2.date)})`)}`;
|
|
8171
8233
|
}
|
|
8172
8234
|
function logPrDetails(pr) {
|
|
8173
8235
|
console.log(
|
|
8174
|
-
|
|
8236
|
+
chalk100.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
8175
8237
|
);
|
|
8176
8238
|
console.log();
|
|
8177
8239
|
}
|
|
@@ -8337,10 +8399,10 @@ function registerPrs(program2) {
|
|
|
8337
8399
|
}
|
|
8338
8400
|
|
|
8339
8401
|
// src/commands/ravendb/ravendbAuth.ts
|
|
8340
|
-
import
|
|
8402
|
+
import chalk106 from "chalk";
|
|
8341
8403
|
|
|
8342
8404
|
// src/shared/createConnectionAuth.ts
|
|
8343
|
-
import
|
|
8405
|
+
import chalk101 from "chalk";
|
|
8344
8406
|
function listConnections(connections, format2) {
|
|
8345
8407
|
if (connections.length === 0) {
|
|
8346
8408
|
console.log("No connections configured.");
|
|
@@ -8353,7 +8415,7 @@ function listConnections(connections, format2) {
|
|
|
8353
8415
|
function removeConnection(connections, name, save) {
|
|
8354
8416
|
const filtered = connections.filter((c) => c.name !== name);
|
|
8355
8417
|
if (filtered.length === connections.length) {
|
|
8356
|
-
console.error(
|
|
8418
|
+
console.error(chalk101.red(`Connection "${name}" not found.`));
|
|
8357
8419
|
process.exit(1);
|
|
8358
8420
|
}
|
|
8359
8421
|
save(filtered);
|
|
@@ -8399,15 +8461,15 @@ function saveConnections(connections) {
|
|
|
8399
8461
|
}
|
|
8400
8462
|
|
|
8401
8463
|
// src/commands/ravendb/promptConnection.ts
|
|
8402
|
-
import
|
|
8464
|
+
import chalk104 from "chalk";
|
|
8403
8465
|
|
|
8404
8466
|
// src/commands/ravendb/selectOpSecret.ts
|
|
8405
|
-
import
|
|
8467
|
+
import chalk103 from "chalk";
|
|
8406
8468
|
import Enquirer2 from "enquirer";
|
|
8407
8469
|
|
|
8408
8470
|
// src/commands/ravendb/searchItems.ts
|
|
8409
8471
|
import { execSync as execSync35 } from "child_process";
|
|
8410
|
-
import
|
|
8472
|
+
import chalk102 from "chalk";
|
|
8411
8473
|
function opExec(args) {
|
|
8412
8474
|
return execSync35(`op ${args}`, {
|
|
8413
8475
|
encoding: "utf-8",
|
|
@@ -8420,7 +8482,7 @@ function searchItems(search2) {
|
|
|
8420
8482
|
items = JSON.parse(opExec("item list --format=json"));
|
|
8421
8483
|
} catch {
|
|
8422
8484
|
console.error(
|
|
8423
|
-
|
|
8485
|
+
chalk102.red(
|
|
8424
8486
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
8425
8487
|
)
|
|
8426
8488
|
);
|
|
@@ -8434,7 +8496,7 @@ function getItemFields(itemId) {
|
|
|
8434
8496
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
8435
8497
|
return item.fields.filter((f) => f.reference && f.label);
|
|
8436
8498
|
} catch {
|
|
8437
|
-
console.error(
|
|
8499
|
+
console.error(chalk102.red("Failed to get item details from 1Password."));
|
|
8438
8500
|
process.exit(1);
|
|
8439
8501
|
}
|
|
8440
8502
|
}
|
|
@@ -8453,7 +8515,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
8453
8515
|
}).run();
|
|
8454
8516
|
const items = searchItems(search2);
|
|
8455
8517
|
if (items.length === 0) {
|
|
8456
|
-
console.error(
|
|
8518
|
+
console.error(chalk103.red(`No items found matching "${search2}".`));
|
|
8457
8519
|
process.exit(1);
|
|
8458
8520
|
}
|
|
8459
8521
|
const itemId = await selectOne(
|
|
@@ -8462,7 +8524,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
8462
8524
|
);
|
|
8463
8525
|
const fields = getItemFields(itemId);
|
|
8464
8526
|
if (fields.length === 0) {
|
|
8465
|
-
console.error(
|
|
8527
|
+
console.error(chalk103.red("No fields with references found on this item."));
|
|
8466
8528
|
process.exit(1);
|
|
8467
8529
|
}
|
|
8468
8530
|
const ref = await selectOne(
|
|
@@ -8476,7 +8538,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
8476
8538
|
async function promptConnection(existingNames) {
|
|
8477
8539
|
const name = await promptInput("name", "Connection name:");
|
|
8478
8540
|
if (existingNames.includes(name)) {
|
|
8479
|
-
console.error(
|
|
8541
|
+
console.error(chalk104.red(`Connection "${name}" already exists.`));
|
|
8480
8542
|
process.exit(1);
|
|
8481
8543
|
}
|
|
8482
8544
|
const url = await promptInput(
|
|
@@ -8485,22 +8547,22 @@ async function promptConnection(existingNames) {
|
|
|
8485
8547
|
);
|
|
8486
8548
|
const database = await promptInput("database", "Database name:");
|
|
8487
8549
|
if (!name || !url || !database) {
|
|
8488
|
-
console.error(
|
|
8550
|
+
console.error(chalk104.red("All fields are required."));
|
|
8489
8551
|
process.exit(1);
|
|
8490
8552
|
}
|
|
8491
8553
|
const apiKeyRef = await selectOpSecret();
|
|
8492
|
-
console.log(
|
|
8554
|
+
console.log(chalk104.dim(`Using: ${apiKeyRef}`));
|
|
8493
8555
|
return { name, url, database, apiKeyRef };
|
|
8494
8556
|
}
|
|
8495
8557
|
|
|
8496
8558
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
8497
|
-
import
|
|
8559
|
+
import chalk105 from "chalk";
|
|
8498
8560
|
function ravendbSetConnection(name) {
|
|
8499
8561
|
const raw = loadGlobalConfigRaw();
|
|
8500
8562
|
const ravendb = raw.ravendb ?? {};
|
|
8501
8563
|
const connections = ravendb.connections ?? [];
|
|
8502
8564
|
if (!connections.some((c) => c.name === name)) {
|
|
8503
|
-
console.error(
|
|
8565
|
+
console.error(chalk105.red(`Connection "${name}" not found.`));
|
|
8504
8566
|
console.error(
|
|
8505
8567
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
8506
8568
|
);
|
|
@@ -8516,16 +8578,16 @@ function ravendbSetConnection(name) {
|
|
|
8516
8578
|
var ravendbAuth = createConnectionAuth({
|
|
8517
8579
|
load: loadConnections,
|
|
8518
8580
|
save: saveConnections,
|
|
8519
|
-
format: (c) => `${
|
|
8581
|
+
format: (c) => `${chalk106.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
8520
8582
|
promptNew: promptConnection,
|
|
8521
8583
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
8522
8584
|
});
|
|
8523
8585
|
|
|
8524
8586
|
// src/commands/ravendb/ravendbCollections.ts
|
|
8525
|
-
import
|
|
8587
|
+
import chalk110 from "chalk";
|
|
8526
8588
|
|
|
8527
8589
|
// src/commands/ravendb/ravenFetch.ts
|
|
8528
|
-
import
|
|
8590
|
+
import chalk108 from "chalk";
|
|
8529
8591
|
|
|
8530
8592
|
// src/commands/ravendb/getAccessToken.ts
|
|
8531
8593
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -8562,10 +8624,10 @@ ${errorText}`
|
|
|
8562
8624
|
|
|
8563
8625
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
8564
8626
|
import { execSync as execSync36 } from "child_process";
|
|
8565
|
-
import
|
|
8627
|
+
import chalk107 from "chalk";
|
|
8566
8628
|
function resolveOpSecret(reference) {
|
|
8567
8629
|
if (!reference.startsWith("op://")) {
|
|
8568
|
-
console.error(
|
|
8630
|
+
console.error(chalk107.red(`Invalid secret reference: must start with op://`));
|
|
8569
8631
|
process.exit(1);
|
|
8570
8632
|
}
|
|
8571
8633
|
try {
|
|
@@ -8575,7 +8637,7 @@ function resolveOpSecret(reference) {
|
|
|
8575
8637
|
}).trim();
|
|
8576
8638
|
} catch {
|
|
8577
8639
|
console.error(
|
|
8578
|
-
|
|
8640
|
+
chalk107.red(
|
|
8579
8641
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
8580
8642
|
)
|
|
8581
8643
|
);
|
|
@@ -8602,7 +8664,7 @@ async function ravenFetch(connection, path50) {
|
|
|
8602
8664
|
if (!response.ok) {
|
|
8603
8665
|
const body = await response.text();
|
|
8604
8666
|
console.error(
|
|
8605
|
-
|
|
8667
|
+
chalk108.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
8606
8668
|
);
|
|
8607
8669
|
console.error(body.substring(0, 500));
|
|
8608
8670
|
process.exit(1);
|
|
@@ -8611,7 +8673,7 @@ async function ravenFetch(connection, path50) {
|
|
|
8611
8673
|
}
|
|
8612
8674
|
|
|
8613
8675
|
// src/commands/ravendb/resolveConnection.ts
|
|
8614
|
-
import
|
|
8676
|
+
import chalk109 from "chalk";
|
|
8615
8677
|
function loadRavendb() {
|
|
8616
8678
|
const raw = loadGlobalConfigRaw();
|
|
8617
8679
|
const ravendb = raw.ravendb;
|
|
@@ -8625,7 +8687,7 @@ function resolveConnection(name) {
|
|
|
8625
8687
|
const connectionName = name ?? defaultConnection;
|
|
8626
8688
|
if (!connectionName) {
|
|
8627
8689
|
console.error(
|
|
8628
|
-
|
|
8690
|
+
chalk109.red(
|
|
8629
8691
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
8630
8692
|
)
|
|
8631
8693
|
);
|
|
@@ -8633,7 +8695,7 @@ function resolveConnection(name) {
|
|
|
8633
8695
|
}
|
|
8634
8696
|
const connection = connections.find((c) => c.name === connectionName);
|
|
8635
8697
|
if (!connection) {
|
|
8636
|
-
console.error(
|
|
8698
|
+
console.error(chalk109.red(`Connection "${connectionName}" not found.`));
|
|
8637
8699
|
console.error(
|
|
8638
8700
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
8639
8701
|
);
|
|
@@ -8664,15 +8726,15 @@ async function ravendbCollections(connectionName) {
|
|
|
8664
8726
|
return;
|
|
8665
8727
|
}
|
|
8666
8728
|
for (const c of collections) {
|
|
8667
|
-
console.log(`${
|
|
8729
|
+
console.log(`${chalk110.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
8668
8730
|
}
|
|
8669
8731
|
}
|
|
8670
8732
|
|
|
8671
8733
|
// src/commands/ravendb/ravendbQuery.ts
|
|
8672
|
-
import
|
|
8734
|
+
import chalk112 from "chalk";
|
|
8673
8735
|
|
|
8674
8736
|
// src/commands/ravendb/fetchAllPages.ts
|
|
8675
|
-
import
|
|
8737
|
+
import chalk111 from "chalk";
|
|
8676
8738
|
|
|
8677
8739
|
// src/commands/ravendb/buildQueryPath.ts
|
|
8678
8740
|
function buildQueryPath(opts) {
|
|
@@ -8710,7 +8772,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
8710
8772
|
allResults.push(...results);
|
|
8711
8773
|
start3 += results.length;
|
|
8712
8774
|
process.stderr.write(
|
|
8713
|
-
`\r${
|
|
8775
|
+
`\r${chalk111.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
8714
8776
|
);
|
|
8715
8777
|
if (start3 >= totalResults) break;
|
|
8716
8778
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -8725,7 +8787,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
8725
8787
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
8726
8788
|
const resolved = resolveArgs(connectionName, collection);
|
|
8727
8789
|
if (!resolved.collection && !options2.query) {
|
|
8728
|
-
console.error(
|
|
8790
|
+
console.error(chalk112.red("Provide a collection name or --query filter."));
|
|
8729
8791
|
process.exit(1);
|
|
8730
8792
|
}
|
|
8731
8793
|
const { collection: col } = resolved;
|
|
@@ -8763,7 +8825,7 @@ import { spawn as spawn4 } from "child_process";
|
|
|
8763
8825
|
import * as path27 from "path";
|
|
8764
8826
|
|
|
8765
8827
|
// src/commands/refactor/logViolations.ts
|
|
8766
|
-
import
|
|
8828
|
+
import chalk113 from "chalk";
|
|
8767
8829
|
var DEFAULT_MAX_LINES = 100;
|
|
8768
8830
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
8769
8831
|
if (violations.length === 0) {
|
|
@@ -8772,43 +8834,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
8772
8834
|
}
|
|
8773
8835
|
return;
|
|
8774
8836
|
}
|
|
8775
|
-
console.error(
|
|
8837
|
+
console.error(chalk113.red(`
|
|
8776
8838
|
Refactor check failed:
|
|
8777
8839
|
`));
|
|
8778
|
-
console.error(
|
|
8840
|
+
console.error(chalk113.red(` The following files exceed ${maxLines} lines:
|
|
8779
8841
|
`));
|
|
8780
8842
|
for (const violation of violations) {
|
|
8781
|
-
console.error(
|
|
8843
|
+
console.error(chalk113.red(` ${violation.file} (${violation.lines} lines)`));
|
|
8782
8844
|
}
|
|
8783
8845
|
console.error(
|
|
8784
|
-
|
|
8846
|
+
chalk113.yellow(
|
|
8785
8847
|
`
|
|
8786
8848
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
8787
8849
|
way to refactor it, ignore it with:
|
|
8788
8850
|
`
|
|
8789
8851
|
)
|
|
8790
8852
|
);
|
|
8791
|
-
console.error(
|
|
8853
|
+
console.error(chalk113.gray(` assist refactor ignore <file>
|
|
8792
8854
|
`));
|
|
8793
8855
|
if (process.env.CLAUDECODE) {
|
|
8794
|
-
console.error(
|
|
8856
|
+
console.error(chalk113.cyan(`
|
|
8795
8857
|
## Extracting Code to New Files
|
|
8796
8858
|
`));
|
|
8797
8859
|
console.error(
|
|
8798
|
-
|
|
8860
|
+
chalk113.cyan(
|
|
8799
8861
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
8800
8862
|
`
|
|
8801
8863
|
)
|
|
8802
8864
|
);
|
|
8803
8865
|
console.error(
|
|
8804
|
-
|
|
8866
|
+
chalk113.cyan(
|
|
8805
8867
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
8806
8868
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
8807
8869
|
`
|
|
8808
8870
|
)
|
|
8809
8871
|
);
|
|
8810
8872
|
console.error(
|
|
8811
|
-
|
|
8873
|
+
chalk113.cyan(
|
|
8812
8874
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
8813
8875
|
domains, move it to a common/shared folder.
|
|
8814
8876
|
`
|
|
@@ -8964,7 +9026,7 @@ async function check(pattern2, options2) {
|
|
|
8964
9026
|
|
|
8965
9027
|
// src/commands/refactor/extract/index.ts
|
|
8966
9028
|
import path33 from "path";
|
|
8967
|
-
import
|
|
9029
|
+
import chalk116 from "chalk";
|
|
8968
9030
|
|
|
8969
9031
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
8970
9032
|
import { SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
@@ -9511,23 +9573,23 @@ function buildPlan(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
9511
9573
|
|
|
9512
9574
|
// src/commands/refactor/extract/displayPlan.ts
|
|
9513
9575
|
import path31 from "path";
|
|
9514
|
-
import
|
|
9576
|
+
import chalk114 from "chalk";
|
|
9515
9577
|
function section(title) {
|
|
9516
9578
|
return `
|
|
9517
|
-
${
|
|
9579
|
+
${chalk114.cyan(title)}`;
|
|
9518
9580
|
}
|
|
9519
9581
|
function displayImporters(plan2, cwd) {
|
|
9520
9582
|
if (plan2.importersToUpdate.length === 0) return;
|
|
9521
9583
|
console.log(section("Update importers:"));
|
|
9522
9584
|
for (const imp of plan2.importersToUpdate) {
|
|
9523
9585
|
const rel = path31.relative(cwd, imp.file.getFilePath());
|
|
9524
|
-
console.log(` ${
|
|
9586
|
+
console.log(` ${chalk114.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
9525
9587
|
}
|
|
9526
9588
|
}
|
|
9527
9589
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
9528
|
-
console.log(
|
|
9590
|
+
console.log(chalk114.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
9529
9591
|
`));
|
|
9530
|
-
console.log(` ${
|
|
9592
|
+
console.log(` ${chalk114.cyan("Functions to move:")}`);
|
|
9531
9593
|
for (const name of plan2.extractedNames) {
|
|
9532
9594
|
console.log(` ${name}`);
|
|
9533
9595
|
}
|
|
@@ -9562,7 +9624,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
9562
9624
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
9563
9625
|
import fs17 from "fs";
|
|
9564
9626
|
import path32 from "path";
|
|
9565
|
-
import
|
|
9627
|
+
import chalk115 from "chalk";
|
|
9566
9628
|
import { Project as Project2 } from "ts-morph";
|
|
9567
9629
|
function findTsConfig(sourcePath) {
|
|
9568
9630
|
const rootConfig = path32.resolve("tsconfig.json");
|
|
@@ -9593,7 +9655,7 @@ function loadProjectFile(file) {
|
|
|
9593
9655
|
});
|
|
9594
9656
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
9595
9657
|
if (!sourceFile) {
|
|
9596
|
-
console.log(
|
|
9658
|
+
console.log(chalk115.red(`File not found in project: ${file}`));
|
|
9597
9659
|
process.exit(1);
|
|
9598
9660
|
}
|
|
9599
9661
|
return { project, sourceFile };
|
|
@@ -9616,19 +9678,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
9616
9678
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
9617
9679
|
if (options2.apply) {
|
|
9618
9680
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
9619
|
-
console.log(
|
|
9681
|
+
console.log(chalk116.green("\nExtraction complete"));
|
|
9620
9682
|
} else {
|
|
9621
|
-
console.log(
|
|
9683
|
+
console.log(chalk116.dim("\nDry run. Use --apply to execute."));
|
|
9622
9684
|
}
|
|
9623
9685
|
}
|
|
9624
9686
|
|
|
9625
9687
|
// src/commands/refactor/ignore.ts
|
|
9626
9688
|
import fs18 from "fs";
|
|
9627
|
-
import
|
|
9689
|
+
import chalk117 from "chalk";
|
|
9628
9690
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
9629
9691
|
function ignore(file) {
|
|
9630
9692
|
if (!fs18.existsSync(file)) {
|
|
9631
|
-
console.error(
|
|
9693
|
+
console.error(chalk117.red(`Error: File does not exist: ${file}`));
|
|
9632
9694
|
process.exit(1);
|
|
9633
9695
|
}
|
|
9634
9696
|
const content = fs18.readFileSync(file, "utf-8");
|
|
@@ -9644,7 +9706,7 @@ function ignore(file) {
|
|
|
9644
9706
|
fs18.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
9645
9707
|
}
|
|
9646
9708
|
console.log(
|
|
9647
|
-
|
|
9709
|
+
chalk117.green(
|
|
9648
9710
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
9649
9711
|
)
|
|
9650
9712
|
);
|
|
@@ -9652,26 +9714,26 @@ function ignore(file) {
|
|
|
9652
9714
|
|
|
9653
9715
|
// src/commands/refactor/rename/index.ts
|
|
9654
9716
|
import path34 from "path";
|
|
9655
|
-
import
|
|
9717
|
+
import chalk118 from "chalk";
|
|
9656
9718
|
async function rename(source, destination, options2 = {}) {
|
|
9657
9719
|
const destPath = path34.resolve(destination);
|
|
9658
9720
|
const cwd = process.cwd();
|
|
9659
9721
|
const relSource = path34.relative(cwd, path34.resolve(source));
|
|
9660
9722
|
const relDest = path34.relative(cwd, destPath);
|
|
9661
9723
|
const { project, sourceFile } = loadProjectFile(source);
|
|
9662
|
-
console.log(
|
|
9724
|
+
console.log(chalk118.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
9663
9725
|
if (options2.apply) {
|
|
9664
9726
|
sourceFile.move(destPath);
|
|
9665
9727
|
await project.save();
|
|
9666
|
-
console.log(
|
|
9728
|
+
console.log(chalk118.green("Done"));
|
|
9667
9729
|
} else {
|
|
9668
|
-
console.log(
|
|
9730
|
+
console.log(chalk118.dim("Dry run. Use --apply to execute."));
|
|
9669
9731
|
}
|
|
9670
9732
|
}
|
|
9671
9733
|
|
|
9672
9734
|
// src/commands/refactor/renameSymbol/index.ts
|
|
9673
9735
|
import path36 from "path";
|
|
9674
|
-
import
|
|
9736
|
+
import chalk119 from "chalk";
|
|
9675
9737
|
import { Project as Project3 } from "ts-morph";
|
|
9676
9738
|
|
|
9677
9739
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
@@ -9720,38 +9782,38 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
9720
9782
|
const project = new Project3({ tsConfigFilePath: tsConfigPath });
|
|
9721
9783
|
const sourceFile = project.getSourceFile(filePath);
|
|
9722
9784
|
if (!sourceFile) {
|
|
9723
|
-
console.log(
|
|
9785
|
+
console.log(chalk119.red(`File not found in project: ${file}`));
|
|
9724
9786
|
process.exit(1);
|
|
9725
9787
|
}
|
|
9726
9788
|
const symbol = findSymbol(sourceFile, oldName);
|
|
9727
9789
|
if (!symbol) {
|
|
9728
|
-
console.log(
|
|
9790
|
+
console.log(chalk119.red(`Symbol "${oldName}" not found in ${file}`));
|
|
9729
9791
|
process.exit(1);
|
|
9730
9792
|
}
|
|
9731
9793
|
const grouped = groupReferences(symbol, cwd);
|
|
9732
9794
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
9733
9795
|
console.log(
|
|
9734
|
-
|
|
9796
|
+
chalk119.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
9735
9797
|
`)
|
|
9736
9798
|
);
|
|
9737
9799
|
for (const [refFile, lines] of grouped) {
|
|
9738
9800
|
console.log(
|
|
9739
|
-
` ${
|
|
9801
|
+
` ${chalk119.dim(refFile)}: lines ${chalk119.cyan(lines.join(", "))}`
|
|
9740
9802
|
);
|
|
9741
9803
|
}
|
|
9742
9804
|
if (options2.apply) {
|
|
9743
9805
|
symbol.rename(newName);
|
|
9744
9806
|
await project.save();
|
|
9745
|
-
console.log(
|
|
9807
|
+
console.log(chalk119.green(`
|
|
9746
9808
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
9747
9809
|
} else {
|
|
9748
|
-
console.log(
|
|
9810
|
+
console.log(chalk119.dim("\nDry run. Use --apply to execute."));
|
|
9749
9811
|
}
|
|
9750
9812
|
}
|
|
9751
9813
|
|
|
9752
9814
|
// src/commands/refactor/restructure/index.ts
|
|
9753
9815
|
import path45 from "path";
|
|
9754
|
-
import
|
|
9816
|
+
import chalk122 from "chalk";
|
|
9755
9817
|
|
|
9756
9818
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
9757
9819
|
import path37 from "path";
|
|
@@ -9994,50 +10056,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
9994
10056
|
|
|
9995
10057
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
9996
10058
|
import path41 from "path";
|
|
9997
|
-
import
|
|
10059
|
+
import chalk120 from "chalk";
|
|
9998
10060
|
function relPath(filePath) {
|
|
9999
10061
|
return path41.relative(process.cwd(), filePath);
|
|
10000
10062
|
}
|
|
10001
10063
|
function displayMoves(plan2) {
|
|
10002
10064
|
if (plan2.moves.length === 0) return;
|
|
10003
|
-
console.log(
|
|
10065
|
+
console.log(chalk120.bold("\nFile moves:"));
|
|
10004
10066
|
for (const move of plan2.moves) {
|
|
10005
10067
|
console.log(
|
|
10006
|
-
` ${
|
|
10068
|
+
` ${chalk120.red(relPath(move.from))} \u2192 ${chalk120.green(relPath(move.to))}`
|
|
10007
10069
|
);
|
|
10008
|
-
console.log(
|
|
10070
|
+
console.log(chalk120.dim(` ${move.reason}`));
|
|
10009
10071
|
}
|
|
10010
10072
|
}
|
|
10011
10073
|
function displayRewrites(rewrites) {
|
|
10012
10074
|
if (rewrites.length === 0) return;
|
|
10013
10075
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
10014
|
-
console.log(
|
|
10076
|
+
console.log(chalk120.bold(`
|
|
10015
10077
|
Import rewrites (${affectedFiles.size} files):`));
|
|
10016
10078
|
for (const file of affectedFiles) {
|
|
10017
|
-
console.log(` ${
|
|
10079
|
+
console.log(` ${chalk120.cyan(relPath(file))}:`);
|
|
10018
10080
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
10019
10081
|
(r) => r.file === file
|
|
10020
10082
|
)) {
|
|
10021
10083
|
console.log(
|
|
10022
|
-
` ${
|
|
10084
|
+
` ${chalk120.red(`"${oldSpecifier}"`)} \u2192 ${chalk120.green(`"${newSpecifier}"`)}`
|
|
10023
10085
|
);
|
|
10024
10086
|
}
|
|
10025
10087
|
}
|
|
10026
10088
|
}
|
|
10027
10089
|
function displayPlan2(plan2) {
|
|
10028
10090
|
if (plan2.warnings.length > 0) {
|
|
10029
|
-
console.log(
|
|
10030
|
-
for (const w of plan2.warnings) console.log(
|
|
10091
|
+
console.log(chalk120.yellow("\nWarnings:"));
|
|
10092
|
+
for (const w of plan2.warnings) console.log(chalk120.yellow(` ${w}`));
|
|
10031
10093
|
}
|
|
10032
10094
|
if (plan2.newDirectories.length > 0) {
|
|
10033
|
-
console.log(
|
|
10095
|
+
console.log(chalk120.bold("\nNew directories:"));
|
|
10034
10096
|
for (const dir of plan2.newDirectories)
|
|
10035
|
-
console.log(
|
|
10097
|
+
console.log(chalk120.green(` ${dir}/`));
|
|
10036
10098
|
}
|
|
10037
10099
|
displayMoves(plan2);
|
|
10038
10100
|
displayRewrites(plan2.rewrites);
|
|
10039
10101
|
console.log(
|
|
10040
|
-
|
|
10102
|
+
chalk120.dim(
|
|
10041
10103
|
`
|
|
10042
10104
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
10043
10105
|
)
|
|
@@ -10047,18 +10109,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
10047
10109
|
// src/commands/refactor/restructure/executePlan.ts
|
|
10048
10110
|
import fs20 from "fs";
|
|
10049
10111
|
import path42 from "path";
|
|
10050
|
-
import
|
|
10112
|
+
import chalk121 from "chalk";
|
|
10051
10113
|
function executePlan(plan2) {
|
|
10052
10114
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
10053
10115
|
for (const [file, content] of updatedContents) {
|
|
10054
10116
|
fs20.writeFileSync(file, content, "utf-8");
|
|
10055
10117
|
console.log(
|
|
10056
|
-
|
|
10118
|
+
chalk121.cyan(` Rewrote imports in ${path42.relative(process.cwd(), file)}`)
|
|
10057
10119
|
);
|
|
10058
10120
|
}
|
|
10059
10121
|
for (const dir of plan2.newDirectories) {
|
|
10060
10122
|
fs20.mkdirSync(dir, { recursive: true });
|
|
10061
|
-
console.log(
|
|
10123
|
+
console.log(chalk121.green(` Created ${path42.relative(process.cwd(), dir)}/`));
|
|
10062
10124
|
}
|
|
10063
10125
|
for (const move of plan2.moves) {
|
|
10064
10126
|
const targetDir = path42.dirname(move.to);
|
|
@@ -10067,7 +10129,7 @@ function executePlan(plan2) {
|
|
|
10067
10129
|
}
|
|
10068
10130
|
fs20.renameSync(move.from, move.to);
|
|
10069
10131
|
console.log(
|
|
10070
|
-
|
|
10132
|
+
chalk121.white(
|
|
10071
10133
|
` Moved ${path42.relative(process.cwd(), move.from)} \u2192 ${path42.relative(process.cwd(), move.to)}`
|
|
10072
10134
|
)
|
|
10073
10135
|
);
|
|
@@ -10082,7 +10144,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
10082
10144
|
if (entries.length === 0) {
|
|
10083
10145
|
fs20.rmdirSync(dir);
|
|
10084
10146
|
console.log(
|
|
10085
|
-
|
|
10147
|
+
chalk121.dim(
|
|
10086
10148
|
` Removed empty directory ${path42.relative(process.cwd(), dir)}`
|
|
10087
10149
|
)
|
|
10088
10150
|
);
|
|
@@ -10215,22 +10277,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
10215
10277
|
const targetPattern = pattern2 ?? "src";
|
|
10216
10278
|
const files = findSourceFiles2(targetPattern);
|
|
10217
10279
|
if (files.length === 0) {
|
|
10218
|
-
console.log(
|
|
10280
|
+
console.log(chalk122.yellow("No files found matching pattern"));
|
|
10219
10281
|
return;
|
|
10220
10282
|
}
|
|
10221
10283
|
const tsConfigPath = path45.resolve("tsconfig.json");
|
|
10222
10284
|
const plan2 = buildPlan2(files, tsConfigPath);
|
|
10223
10285
|
if (plan2.moves.length === 0) {
|
|
10224
|
-
console.log(
|
|
10286
|
+
console.log(chalk122.green("No restructuring needed"));
|
|
10225
10287
|
return;
|
|
10226
10288
|
}
|
|
10227
10289
|
displayPlan2(plan2);
|
|
10228
10290
|
if (options2.apply) {
|
|
10229
|
-
console.log(
|
|
10291
|
+
console.log(chalk122.bold("\nApplying changes..."));
|
|
10230
10292
|
executePlan(plan2);
|
|
10231
|
-
console.log(
|
|
10293
|
+
console.log(chalk122.green("\nRestructuring complete"));
|
|
10232
10294
|
} else {
|
|
10233
|
-
console.log(
|
|
10295
|
+
console.log(chalk122.dim("\nDry run. Use --apply to execute."));
|
|
10234
10296
|
}
|
|
10235
10297
|
}
|
|
10236
10298
|
|
|
@@ -10270,7 +10332,7 @@ function registerRefactor(program2) {
|
|
|
10270
10332
|
}
|
|
10271
10333
|
|
|
10272
10334
|
// src/commands/seq/seqAuth.ts
|
|
10273
|
-
import
|
|
10335
|
+
import chalk124 from "chalk";
|
|
10274
10336
|
|
|
10275
10337
|
// src/commands/seq/loadConnections.ts
|
|
10276
10338
|
function loadConnections2() {
|
|
@@ -10299,11 +10361,11 @@ function setDefaultConnection(name) {
|
|
|
10299
10361
|
}
|
|
10300
10362
|
|
|
10301
10363
|
// src/commands/seq/promptConnection.ts
|
|
10302
|
-
import
|
|
10364
|
+
import chalk123 from "chalk";
|
|
10303
10365
|
async function promptConnection2(existingNames) {
|
|
10304
10366
|
const name = await promptInput("name", "Connection name:", "default");
|
|
10305
10367
|
if (existingNames.includes(name)) {
|
|
10306
|
-
console.error(
|
|
10368
|
+
console.error(chalk123.red(`Connection "${name}" already exists.`));
|
|
10307
10369
|
process.exit(1);
|
|
10308
10370
|
}
|
|
10309
10371
|
const url = await promptInput("url", "Seq URL:", "http://localhost:5341");
|
|
@@ -10315,16 +10377,16 @@ async function promptConnection2(existingNames) {
|
|
|
10315
10377
|
var seqAuth = createConnectionAuth({
|
|
10316
10378
|
load: loadConnections2,
|
|
10317
10379
|
save: saveConnections2,
|
|
10318
|
-
format: (c) => `${
|
|
10380
|
+
format: (c) => `${chalk124.bold(c.name)} ${c.url}`,
|
|
10319
10381
|
promptNew: promptConnection2,
|
|
10320
10382
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
10321
10383
|
});
|
|
10322
10384
|
|
|
10323
10385
|
// src/commands/seq/seqQuery.ts
|
|
10324
|
-
import
|
|
10386
|
+
import chalk128 from "chalk";
|
|
10325
10387
|
|
|
10326
10388
|
// src/commands/seq/fetchSeq.ts
|
|
10327
|
-
import
|
|
10389
|
+
import chalk125 from "chalk";
|
|
10328
10390
|
async function fetchSeq(conn, path50, params) {
|
|
10329
10391
|
const url = `${conn.url}${path50}?${params}`;
|
|
10330
10392
|
const response = await fetch(url, {
|
|
@@ -10335,7 +10397,7 @@ async function fetchSeq(conn, path50, params) {
|
|
|
10335
10397
|
});
|
|
10336
10398
|
if (!response.ok) {
|
|
10337
10399
|
const body = await response.text();
|
|
10338
|
-
console.error(
|
|
10400
|
+
console.error(chalk125.red(`Seq returned ${response.status}: ${body}`));
|
|
10339
10401
|
process.exit(1);
|
|
10340
10402
|
}
|
|
10341
10403
|
return response;
|
|
@@ -10388,23 +10450,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
10388
10450
|
}
|
|
10389
10451
|
|
|
10390
10452
|
// src/commands/seq/formatEvent.ts
|
|
10391
|
-
import
|
|
10453
|
+
import chalk126 from "chalk";
|
|
10392
10454
|
function levelColor(level) {
|
|
10393
10455
|
switch (level) {
|
|
10394
10456
|
case "Fatal":
|
|
10395
|
-
return
|
|
10457
|
+
return chalk126.bgRed.white;
|
|
10396
10458
|
case "Error":
|
|
10397
|
-
return
|
|
10459
|
+
return chalk126.red;
|
|
10398
10460
|
case "Warning":
|
|
10399
|
-
return
|
|
10461
|
+
return chalk126.yellow;
|
|
10400
10462
|
case "Information":
|
|
10401
|
-
return
|
|
10463
|
+
return chalk126.cyan;
|
|
10402
10464
|
case "Debug":
|
|
10403
|
-
return
|
|
10465
|
+
return chalk126.gray;
|
|
10404
10466
|
case "Verbose":
|
|
10405
|
-
return
|
|
10467
|
+
return chalk126.dim;
|
|
10406
10468
|
default:
|
|
10407
|
-
return
|
|
10469
|
+
return chalk126.white;
|
|
10408
10470
|
}
|
|
10409
10471
|
}
|
|
10410
10472
|
function levelAbbrev(level) {
|
|
@@ -10445,31 +10507,31 @@ function formatTimestamp(iso) {
|
|
|
10445
10507
|
function formatEvent(event) {
|
|
10446
10508
|
const color = levelColor(event.Level);
|
|
10447
10509
|
const abbrev = levelAbbrev(event.Level);
|
|
10448
|
-
const ts8 =
|
|
10510
|
+
const ts8 = chalk126.dim(formatTimestamp(event.Timestamp));
|
|
10449
10511
|
const msg = renderMessage(event);
|
|
10450
10512
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
10451
10513
|
if (event.Exception) {
|
|
10452
10514
|
for (const line of event.Exception.split("\n")) {
|
|
10453
|
-
lines.push(
|
|
10515
|
+
lines.push(chalk126.red(` ${line}`));
|
|
10454
10516
|
}
|
|
10455
10517
|
}
|
|
10456
10518
|
return lines.join("\n");
|
|
10457
10519
|
}
|
|
10458
10520
|
|
|
10459
10521
|
// src/commands/seq/resolveConnection.ts
|
|
10460
|
-
import
|
|
10522
|
+
import chalk127 from "chalk";
|
|
10461
10523
|
function resolveConnection2(name) {
|
|
10462
10524
|
const connections = loadConnections2();
|
|
10463
10525
|
if (connections.length === 0) {
|
|
10464
10526
|
console.error(
|
|
10465
|
-
|
|
10527
|
+
chalk127.red("No Seq connections configured. Run 'assist seq auth' first.")
|
|
10466
10528
|
);
|
|
10467
10529
|
process.exit(1);
|
|
10468
10530
|
}
|
|
10469
10531
|
const target = name ?? getDefaultConnection() ?? connections[0].name;
|
|
10470
10532
|
const connection = connections.find((c) => c.name === target);
|
|
10471
10533
|
if (!connection) {
|
|
10472
|
-
console.error(
|
|
10534
|
+
console.error(chalk127.red(`Seq connection "${target}" not found.`));
|
|
10473
10535
|
process.exit(1);
|
|
10474
10536
|
}
|
|
10475
10537
|
return connection;
|
|
@@ -10484,7 +10546,7 @@ async function seqQuery(filter, options2) {
|
|
|
10484
10546
|
new URLSearchParams({ filter, count: String(count) })
|
|
10485
10547
|
);
|
|
10486
10548
|
if (events.length === 0) {
|
|
10487
|
-
console.log(
|
|
10549
|
+
console.log(chalk128.yellow("No events found."));
|
|
10488
10550
|
return;
|
|
10489
10551
|
}
|
|
10490
10552
|
if (options2.json) {
|
|
@@ -10495,11 +10557,11 @@ async function seqQuery(filter, options2) {
|
|
|
10495
10557
|
for (const event of chronological) {
|
|
10496
10558
|
console.log(formatEvent(event));
|
|
10497
10559
|
}
|
|
10498
|
-
console.log(
|
|
10560
|
+
console.log(chalk128.dim(`
|
|
10499
10561
|
${events.length} events`));
|
|
10500
10562
|
if (events.length >= count) {
|
|
10501
10563
|
console.log(
|
|
10502
|
-
|
|
10564
|
+
chalk128.yellow(
|
|
10503
10565
|
`Results limited to ${count}. Use --count to retrieve more.`
|
|
10504
10566
|
)
|
|
10505
10567
|
);
|
|
@@ -10507,11 +10569,11 @@ ${events.length} events`));
|
|
|
10507
10569
|
}
|
|
10508
10570
|
|
|
10509
10571
|
// src/commands/seq/seqSetConnection.ts
|
|
10510
|
-
import
|
|
10572
|
+
import chalk129 from "chalk";
|
|
10511
10573
|
function seqSetConnection(name) {
|
|
10512
10574
|
const connections = loadConnections2();
|
|
10513
10575
|
if (!connections.find((c) => c.name === name)) {
|
|
10514
|
-
console.error(
|
|
10576
|
+
console.error(chalk129.red(`Connection "${name}" not found.`));
|
|
10515
10577
|
process.exit(1);
|
|
10516
10578
|
}
|
|
10517
10579
|
setDefaultConnection(name);
|
|
@@ -11050,14 +11112,14 @@ import {
|
|
|
11050
11112
|
import { dirname as dirname20, join as join35 } from "path";
|
|
11051
11113
|
|
|
11052
11114
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
11053
|
-
import
|
|
11115
|
+
import chalk130 from "chalk";
|
|
11054
11116
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
11055
11117
|
function validateStagedContent(filename, content) {
|
|
11056
11118
|
const firstLine = content.split("\n")[0];
|
|
11057
11119
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
11058
11120
|
if (!match) {
|
|
11059
11121
|
console.error(
|
|
11060
|
-
|
|
11122
|
+
chalk130.red(
|
|
11061
11123
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
11062
11124
|
)
|
|
11063
11125
|
);
|
|
@@ -11066,7 +11128,7 @@ function validateStagedContent(filename, content) {
|
|
|
11066
11128
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
11067
11129
|
if (!contentAfterLink) {
|
|
11068
11130
|
console.error(
|
|
11069
|
-
|
|
11131
|
+
chalk130.red(
|
|
11070
11132
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
11071
11133
|
)
|
|
11072
11134
|
);
|
|
@@ -11459,7 +11521,7 @@ function registerVoice(program2) {
|
|
|
11459
11521
|
|
|
11460
11522
|
// src/commands/roam/auth.ts
|
|
11461
11523
|
import { randomBytes } from "crypto";
|
|
11462
|
-
import
|
|
11524
|
+
import chalk131 from "chalk";
|
|
11463
11525
|
|
|
11464
11526
|
// src/lib/openBrowser.ts
|
|
11465
11527
|
import { execSync as execSync39 } from "child_process";
|
|
@@ -11634,13 +11696,13 @@ async function auth() {
|
|
|
11634
11696
|
saveGlobalConfig(config);
|
|
11635
11697
|
const state = randomBytes(16).toString("hex");
|
|
11636
11698
|
console.log(
|
|
11637
|
-
|
|
11699
|
+
chalk131.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
11638
11700
|
);
|
|
11639
|
-
console.log(
|
|
11640
|
-
console.log(
|
|
11641
|
-
console.log(
|
|
11701
|
+
console.log(chalk131.white("http://localhost:14523/callback\n"));
|
|
11702
|
+
console.log(chalk131.blue("Opening browser for authorization..."));
|
|
11703
|
+
console.log(chalk131.dim("Waiting for authorization callback..."));
|
|
11642
11704
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
11643
|
-
console.log(
|
|
11705
|
+
console.log(chalk131.dim("Exchanging code for tokens..."));
|
|
11644
11706
|
const tokens = await exchangeToken({
|
|
11645
11707
|
code,
|
|
11646
11708
|
clientId,
|
|
@@ -11656,7 +11718,7 @@ async function auth() {
|
|
|
11656
11718
|
};
|
|
11657
11719
|
saveGlobalConfig(config);
|
|
11658
11720
|
console.log(
|
|
11659
|
-
|
|
11721
|
+
chalk131.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
11660
11722
|
);
|
|
11661
11723
|
}
|
|
11662
11724
|
|
|
@@ -11952,7 +12014,7 @@ import { execSync as execSync41 } from "child_process";
|
|
|
11952
12014
|
import { existsSync as existsSync41, mkdirSync as mkdirSync14, unlinkSync as unlinkSync12, writeFileSync as writeFileSync29 } from "fs";
|
|
11953
12015
|
import { tmpdir as tmpdir6 } from "os";
|
|
11954
12016
|
import { join as join45, resolve as resolve6 } from "path";
|
|
11955
|
-
import
|
|
12017
|
+
import chalk132 from "chalk";
|
|
11956
12018
|
|
|
11957
12019
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
11958
12020
|
var captureWindowPs1 = `
|
|
@@ -12103,22 +12165,22 @@ function screenshot(processName) {
|
|
|
12103
12165
|
const config = loadConfig();
|
|
12104
12166
|
const outputDir = resolve6(config.screenshot.outputDir);
|
|
12105
12167
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
12106
|
-
console.log(
|
|
12168
|
+
console.log(chalk132.gray(`Capturing window for process "${processName}" ...`));
|
|
12107
12169
|
try {
|
|
12108
12170
|
runPowerShellScript(processName, outputPath);
|
|
12109
|
-
console.log(
|
|
12171
|
+
console.log(chalk132.green(`Screenshot saved: ${outputPath}`));
|
|
12110
12172
|
} catch (error) {
|
|
12111
12173
|
const msg = error instanceof Error ? error.message : String(error);
|
|
12112
|
-
console.error(
|
|
12174
|
+
console.error(chalk132.red(`Failed to capture screenshot: ${msg}`));
|
|
12113
12175
|
process.exit(1);
|
|
12114
12176
|
}
|
|
12115
12177
|
}
|
|
12116
12178
|
|
|
12117
12179
|
// src/commands/statusLine.ts
|
|
12118
|
-
import
|
|
12180
|
+
import chalk134 from "chalk";
|
|
12119
12181
|
|
|
12120
12182
|
// src/commands/buildLimitsSegment.ts
|
|
12121
|
-
import
|
|
12183
|
+
import chalk133 from "chalk";
|
|
12122
12184
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
12123
12185
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
12124
12186
|
function formatTimeLeft(resetsAt) {
|
|
@@ -12141,10 +12203,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
12141
12203
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
12142
12204
|
const label2 = `${Math.round(pct)}%`;
|
|
12143
12205
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
12144
|
-
if (projected == null) return
|
|
12145
|
-
if (projected > 100) return
|
|
12146
|
-
if (projected > 75) return
|
|
12147
|
-
return
|
|
12206
|
+
if (projected == null) return chalk133.green(label2);
|
|
12207
|
+
if (projected > 100) return chalk133.red(label2);
|
|
12208
|
+
if (projected > 75) return chalk133.yellow(label2);
|
|
12209
|
+
return chalk133.green(label2);
|
|
12148
12210
|
}
|
|
12149
12211
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
12150
12212
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -12170,14 +12232,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
12170
12232
|
}
|
|
12171
12233
|
|
|
12172
12234
|
// src/commands/statusLine.ts
|
|
12173
|
-
|
|
12235
|
+
chalk134.level = 3;
|
|
12174
12236
|
function formatNumber(num) {
|
|
12175
12237
|
return num.toLocaleString("en-US");
|
|
12176
12238
|
}
|
|
12177
12239
|
function colorizePercent(pct) {
|
|
12178
12240
|
const label2 = `${Math.round(pct)}%`;
|
|
12179
|
-
if (pct > 80) return
|
|
12180
|
-
if (pct > 40) return
|
|
12241
|
+
if (pct > 80) return chalk134.red(label2);
|
|
12242
|
+
if (pct > 40) return chalk134.yellow(label2);
|
|
12181
12243
|
return label2;
|
|
12182
12244
|
}
|
|
12183
12245
|
async function statusLine() {
|
|
@@ -12200,7 +12262,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
12200
12262
|
// src/commands/sync/syncClaudeMd.ts
|
|
12201
12263
|
import * as fs23 from "fs";
|
|
12202
12264
|
import * as path46 from "path";
|
|
12203
|
-
import
|
|
12265
|
+
import chalk135 from "chalk";
|
|
12204
12266
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
12205
12267
|
const source = path46.join(claudeDir, "CLAUDE.md");
|
|
12206
12268
|
const target = path46.join(targetBase, "CLAUDE.md");
|
|
@@ -12209,12 +12271,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
12209
12271
|
const targetContent = fs23.readFileSync(target, "utf-8");
|
|
12210
12272
|
if (sourceContent !== targetContent) {
|
|
12211
12273
|
console.log(
|
|
12212
|
-
|
|
12274
|
+
chalk135.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
12213
12275
|
);
|
|
12214
12276
|
console.log();
|
|
12215
12277
|
printDiff(targetContent, sourceContent);
|
|
12216
12278
|
const confirm = options2?.yes || await promptConfirm(
|
|
12217
|
-
|
|
12279
|
+
chalk135.red("Overwrite existing CLAUDE.md?"),
|
|
12218
12280
|
false
|
|
12219
12281
|
);
|
|
12220
12282
|
if (!confirm) {
|
|
@@ -12230,7 +12292,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
12230
12292
|
// src/commands/sync/syncSettings.ts
|
|
12231
12293
|
import * as fs24 from "fs";
|
|
12232
12294
|
import * as path47 from "path";
|
|
12233
|
-
import
|
|
12295
|
+
import chalk136 from "chalk";
|
|
12234
12296
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
12235
12297
|
const source = path47.join(claudeDir, "settings.json");
|
|
12236
12298
|
const target = path47.join(targetBase, "settings.json");
|
|
@@ -12246,14 +12308,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
12246
12308
|
if (mergedContent !== normalizedTarget) {
|
|
12247
12309
|
if (!options2?.yes) {
|
|
12248
12310
|
console.log(
|
|
12249
|
-
|
|
12311
|
+
chalk136.yellow(
|
|
12250
12312
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
12251
12313
|
)
|
|
12252
12314
|
);
|
|
12253
12315
|
console.log();
|
|
12254
12316
|
printDiff(targetContent, mergedContent);
|
|
12255
12317
|
const confirm = await promptConfirm(
|
|
12256
|
-
|
|
12318
|
+
chalk136.red("Overwrite existing settings.json?"),
|
|
12257
12319
|
false
|
|
12258
12320
|
);
|
|
12259
12321
|
if (!confirm) {
|