@staff0rd/assist 0.364.0 → 0.366.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/claude/commands/bug.md +18 -1
- package/claude/commands/draft.md +15 -2
- package/claude/commands/refine.md +3 -1
- package/claude/commands/subtask.md +6 -0
- package/dist/commands/sessions/web/bundle.js +76 -76
- package/dist/index.js +587 -452
- package/package.json +3 -2
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.366.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -55,6 +55,8 @@ var package_default = {
|
|
|
55
55
|
entities: "^7.0.1",
|
|
56
56
|
"is-wsl": "^3.1.0",
|
|
57
57
|
"log-update": "^8.0.0",
|
|
58
|
+
marked: "^15.0.12",
|
|
59
|
+
"marked-terminal": "^7.3.0",
|
|
58
60
|
minimatch: "^10.1.1",
|
|
59
61
|
mssql: "^12.5.0",
|
|
60
62
|
"node-notifier": "^10.0.1",
|
|
@@ -99,7 +101,6 @@ var package_default = {
|
|
|
99
101
|
jscpd: "^4.0.5",
|
|
100
102
|
jsdom: "^29.1.1",
|
|
101
103
|
knip: "^5.71.0",
|
|
102
|
-
marked: "^15.0.12",
|
|
103
104
|
oxfmt: "^0.54.0",
|
|
104
105
|
oxlint: "^1.69.0",
|
|
105
106
|
react: "^19.2.4",
|
|
@@ -5821,6 +5822,25 @@ function formatComment(entry) {
|
|
|
5821
5822
|
${entry.text}`;
|
|
5822
5823
|
}
|
|
5823
5824
|
|
|
5825
|
+
// src/shared/renderMarkdownTerminal.ts
|
|
5826
|
+
import { Marked } from "marked";
|
|
5827
|
+
import { markedTerminal } from "marked-terminal";
|
|
5828
|
+
function renderMarkdownTerminal(text9) {
|
|
5829
|
+
const width = process.stdout.columns || 80;
|
|
5830
|
+
const marked = new Marked(markedTerminal({ width, reflowText: true }));
|
|
5831
|
+
marked.use({
|
|
5832
|
+
renderer: {
|
|
5833
|
+
text(token) {
|
|
5834
|
+
if (token && typeof token === "object" && "tokens" in token && token.tokens) {
|
|
5835
|
+
return this.parser.parseInline(token.tokens);
|
|
5836
|
+
}
|
|
5837
|
+
return false;
|
|
5838
|
+
}
|
|
5839
|
+
}
|
|
5840
|
+
});
|
|
5841
|
+
return marked.parse(text9).trimEnd();
|
|
5842
|
+
}
|
|
5843
|
+
|
|
5824
5844
|
// src/commands/backlog/show/printActivity.ts
|
|
5825
5845
|
import chalk48 from "chalk";
|
|
5826
5846
|
|
|
@@ -5954,7 +5974,10 @@ function printSubtasks(item) {
|
|
|
5954
5974
|
const status2 = chalk52.dim(`[${subtask.status}]`);
|
|
5955
5975
|
console.log(` ${i + 1}. ${status2} ${subtask.title}`);
|
|
5956
5976
|
if (subtask.description) {
|
|
5957
|
-
|
|
5977
|
+
const rendered = renderMarkdownTerminal(subtask.description);
|
|
5978
|
+
for (const line of rendered.split("\n")) {
|
|
5979
|
+
console.log(` ${line}`);
|
|
5980
|
+
}
|
|
5958
5981
|
}
|
|
5959
5982
|
}
|
|
5960
5983
|
console.log();
|
|
@@ -5995,7 +6018,7 @@ async function show(id2) {
|
|
|
5995
6018
|
printHeader(item);
|
|
5996
6019
|
if (item.description) {
|
|
5997
6020
|
console.log(chalk53.bold("Description"));
|
|
5998
|
-
console.log(item.description);
|
|
6021
|
+
console.log(renderMarkdownTerminal(item.description));
|
|
5999
6022
|
console.log();
|
|
6000
6023
|
}
|
|
6001
6024
|
printAcceptanceCriteria(item.acceptanceCriteria);
|
|
@@ -8941,45 +8964,148 @@ async function addSubtask(id2, options2) {
|
|
|
8941
8964
|
console.log(chalk91.green(`Added sub-task to item #${id2}: ${title}`));
|
|
8942
8965
|
}
|
|
8943
8966
|
|
|
8944
|
-
// src/commands/backlog/
|
|
8967
|
+
// src/commands/backlog/editSubtask.ts
|
|
8968
|
+
import chalk93 from "chalk";
|
|
8969
|
+
|
|
8970
|
+
// src/commands/backlog/resolveSubtaskIndex.ts
|
|
8945
8971
|
import chalk92 from "chalk";
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8972
|
+
function resolveSubtaskIndex(id2, index3, item) {
|
|
8973
|
+
const position = Number.parseInt(index3, 10);
|
|
8974
|
+
const subtasks = item.subtasks ?? [];
|
|
8975
|
+
if (Number.isNaN(position) || position < 1 || position > subtasks.length) {
|
|
8949
8976
|
console.log(
|
|
8950
8977
|
chalk92.red(
|
|
8951
|
-
`
|
|
8978
|
+
`Item #${id2} has no sub-task ${index3}${subtasks.length > 0 ? ` (1-${subtasks.length})` : ""}.`
|
|
8952
8979
|
)
|
|
8953
8980
|
);
|
|
8954
8981
|
process.exitCode = 1;
|
|
8955
|
-
return;
|
|
8982
|
+
return void 0;
|
|
8956
8983
|
}
|
|
8957
|
-
|
|
8984
|
+
return position - 1;
|
|
8985
|
+
}
|
|
8986
|
+
|
|
8987
|
+
// src/commands/backlog/findSubtask.ts
|
|
8988
|
+
async function findSubtask(id2, index3) {
|
|
8958
8989
|
const found = await findOneItem(id2);
|
|
8959
8990
|
if (!found) {
|
|
8991
|
+
process.exitCode = 1;
|
|
8992
|
+
return void 0;
|
|
8993
|
+
}
|
|
8994
|
+
const idx = resolveSubtaskIndex(id2, index3, found.item);
|
|
8995
|
+
if (idx === void 0) return void 0;
|
|
8996
|
+
return { orm: found.orm, item: found.item, idx };
|
|
8997
|
+
}
|
|
8998
|
+
|
|
8999
|
+
// src/commands/backlog/updateSubtask.ts
|
|
9000
|
+
import { and as and9, eq as eq26 } from "drizzle-orm";
|
|
9001
|
+
async function updateSubtask(orm, itemId, idx, fields) {
|
|
9002
|
+
const set = {};
|
|
9003
|
+
if (fields.title !== void 0) set.title = fields.title;
|
|
9004
|
+
if (fields.description !== void 0) set.description = fields.description;
|
|
9005
|
+
if (fields.status !== void 0) set.status = fields.status;
|
|
9006
|
+
const [row] = await orm.update(itemSubtasks).set(set).where(and9(eq26(itemSubtasks.itemId, itemId), eq26(itemSubtasks.idx, idx))).returning({ title: itemSubtasks.title });
|
|
9007
|
+
return row?.title;
|
|
9008
|
+
}
|
|
9009
|
+
|
|
9010
|
+
// src/commands/backlog/validSubtaskStatuses.ts
|
|
9011
|
+
var validSubtaskStatuses = [
|
|
9012
|
+
"todo",
|
|
9013
|
+
"in-progress",
|
|
9014
|
+
"done"
|
|
9015
|
+
];
|
|
9016
|
+
|
|
9017
|
+
// src/commands/backlog/editSubtask.ts
|
|
9018
|
+
function buildUpdate(options2) {
|
|
9019
|
+
const fields = {};
|
|
9020
|
+
if (options2.title !== void 0) {
|
|
9021
|
+
const title = options2.title.trim();
|
|
9022
|
+
if (!title) return "A sub-task title cannot be empty (--title).";
|
|
9023
|
+
fields.title = title;
|
|
9024
|
+
}
|
|
9025
|
+
if (options2.status !== void 0) {
|
|
9026
|
+
if (!validSubtaskStatuses.includes(options2.status)) {
|
|
9027
|
+
return `Invalid status "${options2.status}". Use one of: ${validSubtaskStatuses.join(", ")}.`;
|
|
9028
|
+
}
|
|
9029
|
+
fields.status = options2.status;
|
|
9030
|
+
}
|
|
9031
|
+
if (options2.desc !== void 0) {
|
|
9032
|
+
fields.description = options2.desc === "" ? null : options2.desc.replaceAll(String.raw`\n`, "\n");
|
|
9033
|
+
}
|
|
9034
|
+
if (Object.keys(fields).length === 0) {
|
|
9035
|
+
return "Nothing to update. Provide at least one of --title, --desc, --status.";
|
|
9036
|
+
}
|
|
9037
|
+
return fields;
|
|
9038
|
+
}
|
|
9039
|
+
async function editSubtask(id2, index3, options2) {
|
|
9040
|
+
const found = await findSubtask(id2, index3);
|
|
9041
|
+
if (!found) return;
|
|
9042
|
+
const fields = buildUpdate(options2);
|
|
9043
|
+
if (typeof fields === "string") {
|
|
9044
|
+
console.log(chalk93.red(fields));
|
|
8960
9045
|
process.exitCode = 1;
|
|
8961
9046
|
return;
|
|
8962
9047
|
}
|
|
8963
|
-
const { orm, item } = found;
|
|
8964
|
-
const
|
|
8965
|
-
|
|
9048
|
+
const { orm, item, idx } = found;
|
|
9049
|
+
const title = await updateSubtask(orm, item.id, idx, fields);
|
|
9050
|
+
console.log(
|
|
9051
|
+
chalk93.green(`Updated sub-task ${idx + 1} of item #${id2}: ${title}`)
|
|
9052
|
+
);
|
|
9053
|
+
}
|
|
9054
|
+
|
|
9055
|
+
// src/commands/backlog/removeSubtask.ts
|
|
9056
|
+
import chalk94 from "chalk";
|
|
9057
|
+
|
|
9058
|
+
// src/commands/backlog/deleteSubtask.ts
|
|
9059
|
+
import { and as and10, asc as asc6, eq as eq27 } from "drizzle-orm";
|
|
9060
|
+
async function deleteSubtask(orm, itemId, idx) {
|
|
9061
|
+
const [row] = await orm.delete(itemSubtasks).where(and10(eq27(itemSubtasks.itemId, itemId), eq27(itemSubtasks.idx, idx))).returning({ title: itemSubtasks.title });
|
|
9062
|
+
if (!row) return void 0;
|
|
9063
|
+
const remaining = await orm.select({ idx: itemSubtasks.idx }).from(itemSubtasks).where(eq27(itemSubtasks.itemId, itemId)).orderBy(asc6(itemSubtasks.idx));
|
|
9064
|
+
for (let i = 0; i < remaining.length; i++) {
|
|
9065
|
+
const oldIdx = remaining[i].idx;
|
|
9066
|
+
if (oldIdx === i) continue;
|
|
9067
|
+
await orm.update(itemSubtasks).set({ idx: i }).where(
|
|
9068
|
+
and10(eq27(itemSubtasks.itemId, itemId), eq27(itemSubtasks.idx, oldIdx))
|
|
9069
|
+
);
|
|
9070
|
+
}
|
|
9071
|
+
return row.title;
|
|
9072
|
+
}
|
|
9073
|
+
|
|
9074
|
+
// src/commands/backlog/removeSubtask.ts
|
|
9075
|
+
async function removeSubtask(id2, index3) {
|
|
9076
|
+
const found = await findSubtask(id2, index3);
|
|
9077
|
+
if (!found) return;
|
|
9078
|
+
const { orm, item, idx } = found;
|
|
9079
|
+
const title = await deleteSubtask(orm, item.id, idx);
|
|
9080
|
+
console.log(
|
|
9081
|
+
chalk94.green(`Removed sub-task ${idx + 1} of item #${id2}: ${title}`)
|
|
9082
|
+
);
|
|
9083
|
+
}
|
|
9084
|
+
|
|
9085
|
+
// src/commands/backlog/subtaskStatus.ts
|
|
9086
|
+
import chalk95 from "chalk";
|
|
9087
|
+
async function subtaskStatus(id2, index3, status2) {
|
|
9088
|
+
if (!validSubtaskStatuses.includes(status2)) {
|
|
8966
9089
|
console.log(
|
|
8967
|
-
|
|
8968
|
-
`
|
|
9090
|
+
chalk95.red(
|
|
9091
|
+
`Invalid status "${status2}". Use one of: ${validSubtaskStatuses.join(", ")}.`
|
|
8969
9092
|
)
|
|
8970
9093
|
);
|
|
8971
9094
|
process.exitCode = 1;
|
|
8972
9095
|
return;
|
|
8973
9096
|
}
|
|
9097
|
+
const found = await findSubtask(id2, index3);
|
|
9098
|
+
if (!found) return;
|
|
9099
|
+
const { orm, item, idx } = found;
|
|
8974
9100
|
const title = await updateSubtaskStatus(
|
|
8975
9101
|
orm,
|
|
8976
9102
|
item.id,
|
|
8977
|
-
|
|
9103
|
+
idx,
|
|
8978
9104
|
status2
|
|
8979
9105
|
);
|
|
8980
9106
|
console.log(
|
|
8981
|
-
|
|
8982
|
-
`Set sub-task ${
|
|
9107
|
+
chalk95.green(
|
|
9108
|
+
`Set sub-task ${idx + 1} of item #${id2} to ${status2}: ${title}`
|
|
8983
9109
|
)
|
|
8984
9110
|
);
|
|
8985
9111
|
}
|
|
@@ -8990,27 +9116,36 @@ function registerSubtaskCommands(cmd) {
|
|
|
8990
9116
|
"--desc <description>",
|
|
8991
9117
|
String.raw`Sub-task description (Markdown supported; use \n for line breaks)`
|
|
8992
9118
|
).action(addSubtask);
|
|
9119
|
+
cmd.command("edit-subtask <id> <idx>").description(
|
|
9120
|
+
"Edit a sub-task's title, description, and/or status by its 1-based index"
|
|
9121
|
+
).option("--title <title>", "New sub-task title").option(
|
|
9122
|
+
"--desc <description>",
|
|
9123
|
+
String.raw`New sub-task description (Markdown supported; use \n for line breaks; pass "" to clear)`
|
|
9124
|
+
).option("--status <status>", "New status (todo, in-progress, done)").action(editSubtask);
|
|
9125
|
+
cmd.command("remove-subtask <id> <idx>").description(
|
|
9126
|
+
"Remove a sub-task by its 1-based index and re-index the remaining sub-tasks"
|
|
9127
|
+
).action(removeSubtask);
|
|
8993
9128
|
cmd.command("subtask-status <id> <idx> <status>").description(
|
|
8994
9129
|
"Set a sub-task's status (todo, in-progress, done) by its 1-based index"
|
|
8995
9130
|
).action(subtaskStatus);
|
|
8996
9131
|
}
|
|
8997
9132
|
|
|
8998
9133
|
// src/commands/backlog/movePhase.ts
|
|
8999
|
-
import
|
|
9000
|
-
import { count as count6, eq as
|
|
9134
|
+
import chalk96 from "chalk";
|
|
9135
|
+
import { count as count6, eq as eq30 } from "drizzle-orm";
|
|
9001
9136
|
|
|
9002
9137
|
// src/commands/backlog/reorderPhaseRows.ts
|
|
9003
|
-
import { and as
|
|
9138
|
+
import { and as and12, asc as asc8, eq as eq29 } from "drizzle-orm";
|
|
9004
9139
|
|
|
9005
9140
|
// src/commands/backlog/reindexPhases.ts
|
|
9006
|
-
import { and as
|
|
9141
|
+
import { and as and11, asc as asc7, count as count5, eq as eq28 } from "drizzle-orm";
|
|
9007
9142
|
async function reindexPhases(db, itemId) {
|
|
9008
|
-
const remaining = await db.select({ idx: planPhases.idx }).from(planPhases).where(
|
|
9143
|
+
const remaining = await db.select({ idx: planPhases.idx }).from(planPhases).where(eq28(planPhases.itemId, itemId)).orderBy(asc7(planPhases.idx));
|
|
9009
9144
|
for (let i = 0; i < remaining.length; i++) {
|
|
9010
9145
|
const oldIdx = remaining[i].idx;
|
|
9011
9146
|
if (oldIdx === i) continue;
|
|
9012
|
-
await db.update(planTasks).set({ phaseIdx: i }).where(
|
|
9013
|
-
await db.update(planPhases).set({ idx: i }).where(
|
|
9147
|
+
await db.update(planTasks).set({ phaseIdx: i }).where(and11(eq28(planTasks.itemId, itemId), eq28(planTasks.phaseIdx, oldIdx)));
|
|
9148
|
+
await db.update(planPhases).set({ idx: i }).where(and11(eq28(planPhases.itemId, itemId), eq28(planPhases.idx, oldIdx)));
|
|
9014
9149
|
}
|
|
9015
9150
|
}
|
|
9016
9151
|
async function adjustCurrentPhase(db, item, removedIdx) {
|
|
@@ -9018,24 +9153,24 @@ async function adjustCurrentPhase(db, item, removedIdx) {
|
|
|
9018
9153
|
if (currentPhase === void 0) return;
|
|
9019
9154
|
const currentIdx = currentPhase - 1;
|
|
9020
9155
|
if (removedIdx < currentIdx) {
|
|
9021
|
-
await db.update(items).set({ currentPhase: currentPhase - 1 }).where(
|
|
9156
|
+
await db.update(items).set({ currentPhase: currentPhase - 1 }).where(eq28(items.id, item.id));
|
|
9022
9157
|
return;
|
|
9023
9158
|
}
|
|
9024
9159
|
if (removedIdx !== currentIdx) return;
|
|
9025
|
-
const [row] = await db.select({ cnt: count5() }).from(planPhases).where(
|
|
9160
|
+
const [row] = await db.select({ cnt: count5() }).from(planPhases).where(eq28(planPhases.itemId, item.id));
|
|
9026
9161
|
const cnt = row?.cnt ?? 0;
|
|
9027
|
-
await db.update(items).set({ currentPhase: cnt === 0 ? null : Math.min(currentPhase, cnt) }).where(
|
|
9162
|
+
await db.update(items).set({ currentPhase: cnt === 0 ? null : Math.min(currentPhase, cnt) }).where(eq28(items.id, item.id));
|
|
9028
9163
|
}
|
|
9029
9164
|
|
|
9030
9165
|
// src/commands/backlog/reorderPhaseRows.ts
|
|
9031
9166
|
async function reorderPhaseRows(orm, itemId, fromIdx, toIdx) {
|
|
9032
9167
|
await orm.transaction(async (tx) => {
|
|
9033
|
-
const [phaseRow] = await tx.select({ name: planPhases.name, manualChecks: planPhases.manualChecks }).from(planPhases).where(
|
|
9034
|
-
const tasks = await tx.select({ idx: planTasks.idx, task: planTasks.task }).from(planTasks).where(
|
|
9168
|
+
const [phaseRow] = await tx.select({ name: planPhases.name, manualChecks: planPhases.manualChecks }).from(planPhases).where(and12(eq29(planPhases.itemId, itemId), eq29(planPhases.idx, fromIdx)));
|
|
9169
|
+
const tasks = await tx.select({ idx: planTasks.idx, task: planTasks.task }).from(planTasks).where(and12(eq29(planTasks.itemId, itemId), eq29(planTasks.phaseIdx, fromIdx))).orderBy(asc8(planTasks.idx));
|
|
9035
9170
|
await tx.delete(planTasks).where(
|
|
9036
|
-
|
|
9171
|
+
and12(eq29(planTasks.itemId, itemId), eq29(planTasks.phaseIdx, fromIdx))
|
|
9037
9172
|
);
|
|
9038
|
-
await tx.delete(planPhases).where(
|
|
9173
|
+
await tx.delete(planPhases).where(and12(eq29(planPhases.itemId, itemId), eq29(planPhases.idx, fromIdx)));
|
|
9039
9174
|
await reindexPhases(tx, itemId);
|
|
9040
9175
|
await shiftPhasesUp(tx, itemId, toIdx);
|
|
9041
9176
|
await tx.insert(planPhases).values({
|
|
@@ -9062,7 +9197,7 @@ function toIndex(value, phaseCount) {
|
|
|
9062
9197
|
const pos = Number.parseInt(value, 10);
|
|
9063
9198
|
if (Number.isNaN(pos) || pos < 1 || pos > phaseCount) {
|
|
9064
9199
|
console.log(
|
|
9065
|
-
|
|
9200
|
+
chalk96.red(
|
|
9066
9201
|
`Position "${value}" is out of range. Must be between 1 and ${phaseCount}.`
|
|
9067
9202
|
)
|
|
9068
9203
|
);
|
|
@@ -9076,7 +9211,7 @@ async function movePhase(id2, from, to) {
|
|
|
9076
9211
|
if (!found) return;
|
|
9077
9212
|
const { orm, item } = found;
|
|
9078
9213
|
const itemId = item.id;
|
|
9079
|
-
const [row] = await orm.select({ cnt: count6() }).from(planPhases).where(
|
|
9214
|
+
const [row] = await orm.select({ cnt: count6() }).from(planPhases).where(eq30(planPhases.itemId, itemId));
|
|
9080
9215
|
const phaseCount = row?.cnt ?? 0;
|
|
9081
9216
|
const fromIdx = toIndex(from, phaseCount);
|
|
9082
9217
|
if (fromIdx === void 0) return;
|
|
@@ -9085,29 +9220,29 @@ async function movePhase(id2, from, to) {
|
|
|
9085
9220
|
if (fromIdx !== toIdx) {
|
|
9086
9221
|
await reorderPhaseRows(orm, itemId, fromIdx, toIdx);
|
|
9087
9222
|
}
|
|
9088
|
-
console.log(
|
|
9223
|
+
console.log(chalk96.green(`Moved phase ${from} to position ${to}.`));
|
|
9089
9224
|
}
|
|
9090
9225
|
|
|
9091
9226
|
// src/commands/backlog/updatePhase.ts
|
|
9092
|
-
import
|
|
9227
|
+
import chalk98 from "chalk";
|
|
9093
9228
|
|
|
9094
9229
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
9095
|
-
import { and as
|
|
9230
|
+
import { and as and13, eq as eq31 } from "drizzle-orm";
|
|
9096
9231
|
async function applyPhaseUpdate(orm, itemId, phaseIdx, fields) {
|
|
9097
9232
|
await orm.transaction(async (tx) => {
|
|
9098
9233
|
if (fields.name) {
|
|
9099
9234
|
await tx.update(planPhases).set({ name: fields.name }).where(
|
|
9100
|
-
|
|
9235
|
+
and13(eq31(planPhases.itemId, itemId), eq31(planPhases.idx, phaseIdx))
|
|
9101
9236
|
);
|
|
9102
9237
|
}
|
|
9103
9238
|
if (fields.manualCheck) {
|
|
9104
9239
|
await tx.update(planPhases).set({ manualChecks: JSON.stringify(fields.manualCheck) }).where(
|
|
9105
|
-
|
|
9240
|
+
and13(eq31(planPhases.itemId, itemId), eq31(planPhases.idx, phaseIdx))
|
|
9106
9241
|
);
|
|
9107
9242
|
}
|
|
9108
9243
|
if (fields.task) {
|
|
9109
9244
|
await tx.delete(planTasks).where(
|
|
9110
|
-
|
|
9245
|
+
and13(eq31(planTasks.itemId, itemId), eq31(planTasks.phaseIdx, phaseIdx))
|
|
9111
9246
|
);
|
|
9112
9247
|
if (fields.task.length) {
|
|
9113
9248
|
await tx.insert(planTasks).values(
|
|
@@ -9124,18 +9259,18 @@ async function applyPhaseUpdate(orm, itemId, phaseIdx, fields) {
|
|
|
9124
9259
|
}
|
|
9125
9260
|
|
|
9126
9261
|
// src/commands/backlog/findPhase.ts
|
|
9127
|
-
import
|
|
9128
|
-
import { and as
|
|
9262
|
+
import chalk97 from "chalk";
|
|
9263
|
+
import { and as and14, count as count7, eq as eq32 } from "drizzle-orm";
|
|
9129
9264
|
async function findPhase(id2, phase) {
|
|
9130
9265
|
const found = await findOneItem(id2);
|
|
9131
9266
|
if (!found) return void 0;
|
|
9132
9267
|
const { orm, item } = found;
|
|
9133
9268
|
const itemId = item.id;
|
|
9134
9269
|
const phaseIdx = Number.parseInt(phase, 10) - 1;
|
|
9135
|
-
const [row] = await orm.select({ cnt: count7() }).from(planPhases).where(
|
|
9270
|
+
const [row] = await orm.select({ cnt: count7() }).from(planPhases).where(and14(eq32(planPhases.itemId, itemId), eq32(planPhases.idx, phaseIdx)));
|
|
9136
9271
|
if (!row || row.cnt === 0) {
|
|
9137
9272
|
console.log(
|
|
9138
|
-
|
|
9273
|
+
chalk97.red(`Phase ${phaseIdx + 1} not found on item #${itemId}.`)
|
|
9139
9274
|
);
|
|
9140
9275
|
process.exitCode = 1;
|
|
9141
9276
|
return void 0;
|
|
@@ -9267,7 +9402,7 @@ async function updatePhase(id2, phase, options2) {
|
|
|
9267
9402
|
const { item, orm, itemId, phaseIdx } = found;
|
|
9268
9403
|
const resolved = resolvePhaseFields(options2, item.plan?.[phaseIdx]);
|
|
9269
9404
|
if (!resolved.ok) {
|
|
9270
|
-
console.log(
|
|
9405
|
+
console.log(chalk98.red(resolved.error));
|
|
9271
9406
|
process.exitCode = 1;
|
|
9272
9407
|
return;
|
|
9273
9408
|
}
|
|
@@ -9279,7 +9414,7 @@ async function updatePhase(id2, phase, options2) {
|
|
|
9279
9414
|
manualCheck && "manual checks"
|
|
9280
9415
|
].filter(Boolean).join(", ");
|
|
9281
9416
|
console.log(
|
|
9282
|
-
|
|
9417
|
+
chalk98.green(
|
|
9283
9418
|
`Updated ${fields} on phase ${phaseIdx + 1} of item #${itemId}.`
|
|
9284
9419
|
)
|
|
9285
9420
|
);
|
|
@@ -9302,28 +9437,28 @@ function registerUpdatePhaseCommand(cmd) {
|
|
|
9302
9437
|
}
|
|
9303
9438
|
|
|
9304
9439
|
// src/commands/backlog/removePhase.ts
|
|
9305
|
-
import
|
|
9306
|
-
import { and as
|
|
9440
|
+
import chalk99 from "chalk";
|
|
9441
|
+
import { and as and15, eq as eq33 } from "drizzle-orm";
|
|
9307
9442
|
async function removePhase(id2, phase) {
|
|
9308
9443
|
const found = await findPhase(id2, phase);
|
|
9309
9444
|
if (!found) return;
|
|
9310
9445
|
const { item, orm, itemId, phaseIdx } = found;
|
|
9311
9446
|
await orm.transaction(async (tx) => {
|
|
9312
9447
|
await tx.delete(planTasks).where(
|
|
9313
|
-
|
|
9448
|
+
and15(eq33(planTasks.itemId, itemId), eq33(planTasks.phaseIdx, phaseIdx))
|
|
9314
9449
|
);
|
|
9315
|
-
await tx.delete(planPhases).where(
|
|
9450
|
+
await tx.delete(planPhases).where(and15(eq33(planPhases.itemId, itemId), eq33(planPhases.idx, phaseIdx)));
|
|
9316
9451
|
await reindexPhases(tx, itemId);
|
|
9317
9452
|
await adjustCurrentPhase(tx, item, phaseIdx);
|
|
9318
9453
|
});
|
|
9319
9454
|
console.log(
|
|
9320
|
-
|
|
9455
|
+
chalk99.green(`Removed phase ${phaseIdx + 1} from item #${itemId}.`)
|
|
9321
9456
|
);
|
|
9322
9457
|
}
|
|
9323
9458
|
|
|
9324
9459
|
// src/commands/backlog/update/index.ts
|
|
9325
|
-
import
|
|
9326
|
-
import { eq as
|
|
9460
|
+
import chalk101 from "chalk";
|
|
9461
|
+
import { eq as eq34 } from "drizzle-orm";
|
|
9327
9462
|
|
|
9328
9463
|
// src/commands/backlog/update/applyAcMutations.ts
|
|
9329
9464
|
function hasAcMutations(options2) {
|
|
@@ -9344,16 +9479,16 @@ function applyAcMutations(current, options2) {
|
|
|
9344
9479
|
}
|
|
9345
9480
|
|
|
9346
9481
|
// src/commands/backlog/update/buildUpdateValues.ts
|
|
9347
|
-
import
|
|
9482
|
+
import chalk100 from "chalk";
|
|
9348
9483
|
function buildUpdateValues(options2) {
|
|
9349
9484
|
const { name, desc: desc6, type, ac } = options2;
|
|
9350
9485
|
if (!name && !desc6 && !type && !ac) {
|
|
9351
|
-
console.log(
|
|
9486
|
+
console.log(chalk100.red("Nothing to update. Provide at least one flag."));
|
|
9352
9487
|
process.exitCode = 1;
|
|
9353
9488
|
return void 0;
|
|
9354
9489
|
}
|
|
9355
9490
|
if (type && type !== "story" && type !== "bug") {
|
|
9356
|
-
console.log(
|
|
9491
|
+
console.log(chalk100.red('Invalid type. Must be "story" or "bug".'));
|
|
9357
9492
|
process.exitCode = 1;
|
|
9358
9493
|
return void 0;
|
|
9359
9494
|
}
|
|
@@ -9386,14 +9521,14 @@ async function update(id2, options2) {
|
|
|
9386
9521
|
if (hasAcMutations(options2)) {
|
|
9387
9522
|
if (options2.ac) {
|
|
9388
9523
|
console.log(
|
|
9389
|
-
|
|
9524
|
+
chalk101.red("Cannot combine --ac with --add-ac/--edit-ac/--remove-ac.")
|
|
9390
9525
|
);
|
|
9391
9526
|
process.exitCode = 1;
|
|
9392
9527
|
return;
|
|
9393
9528
|
}
|
|
9394
9529
|
const mutation = applyAcMutations(found.item.acceptanceCriteria, options2);
|
|
9395
9530
|
if (!mutation.ok) {
|
|
9396
|
-
console.log(
|
|
9531
|
+
console.log(chalk101.red(mutation.error));
|
|
9397
9532
|
process.exitCode = 1;
|
|
9398
9533
|
return;
|
|
9399
9534
|
}
|
|
@@ -9403,8 +9538,8 @@ async function update(id2, options2) {
|
|
|
9403
9538
|
if (!built) return;
|
|
9404
9539
|
const { orm } = found;
|
|
9405
9540
|
const itemId = found.item.id;
|
|
9406
|
-
await orm.update(items).set(built.set).where(
|
|
9407
|
-
console.log(
|
|
9541
|
+
await orm.update(items).set(built.set).where(eq34(items.id, itemId));
|
|
9542
|
+
console.log(chalk101.green(`Updated ${built.fields} on item #${itemId}.`));
|
|
9408
9543
|
}
|
|
9409
9544
|
|
|
9410
9545
|
// src/commands/backlog/registerUpdateCommands.ts
|
|
@@ -10206,11 +10341,11 @@ function assertCliExists(cli) {
|
|
|
10206
10341
|
}
|
|
10207
10342
|
|
|
10208
10343
|
// src/commands/permitCliReads/colorize.ts
|
|
10209
|
-
import
|
|
10344
|
+
import chalk102 from "chalk";
|
|
10210
10345
|
function colorize(plainOutput) {
|
|
10211
10346
|
return plainOutput.split("\n").map((line) => {
|
|
10212
|
-
if (line.startsWith(" R ")) return
|
|
10213
|
-
if (line.startsWith(" W ")) return
|
|
10347
|
+
if (line.startsWith(" R ")) return chalk102.green(line);
|
|
10348
|
+
if (line.startsWith(" W ")) return chalk102.red(line);
|
|
10214
10349
|
return line;
|
|
10215
10350
|
}).join("\n");
|
|
10216
10351
|
}
|
|
@@ -10508,7 +10643,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
10508
10643
|
}
|
|
10509
10644
|
|
|
10510
10645
|
// src/commands/deny/denyAdd.ts
|
|
10511
|
-
import
|
|
10646
|
+
import chalk103 from "chalk";
|
|
10512
10647
|
|
|
10513
10648
|
// src/commands/deny/loadDenyConfig.ts
|
|
10514
10649
|
function loadDenyConfig(global) {
|
|
@@ -10528,16 +10663,16 @@ function loadDenyConfig(global) {
|
|
|
10528
10663
|
function denyAdd(pattern2, message, options2) {
|
|
10529
10664
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
10530
10665
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
10531
|
-
console.log(
|
|
10666
|
+
console.log(chalk103.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
10532
10667
|
return;
|
|
10533
10668
|
}
|
|
10534
10669
|
deny.push({ pattern: pattern2, message });
|
|
10535
10670
|
saveDeny(deny);
|
|
10536
|
-
console.log(
|
|
10671
|
+
console.log(chalk103.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
10537
10672
|
}
|
|
10538
10673
|
|
|
10539
10674
|
// src/commands/deny/denyList.ts
|
|
10540
|
-
import
|
|
10675
|
+
import chalk104 from "chalk";
|
|
10541
10676
|
function denyList() {
|
|
10542
10677
|
const globalRaw = loadGlobalConfigRaw();
|
|
10543
10678
|
const projectRaw = loadProjectConfig();
|
|
@@ -10548,7 +10683,7 @@ function denyList() {
|
|
|
10548
10683
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
10549
10684
|
);
|
|
10550
10685
|
if (!merged || merged.length === 0) {
|
|
10551
|
-
console.log(
|
|
10686
|
+
console.log(chalk104.dim("No deny rules configured."));
|
|
10552
10687
|
return;
|
|
10553
10688
|
}
|
|
10554
10689
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -10556,23 +10691,23 @@ function denyList() {
|
|
|
10556
10691
|
for (const rule of merged) {
|
|
10557
10692
|
const inProject = projectPatterns.has(rule.pattern);
|
|
10558
10693
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
10559
|
-
const label2 = inProject && inGlobal ?
|
|
10560
|
-
console.log(`${
|
|
10694
|
+
const label2 = inProject && inGlobal ? chalk104.dim(" (project, overrides global)") : inGlobal ? chalk104.dim(" (global)") : "";
|
|
10695
|
+
console.log(`${chalk104.red(rule.pattern)} \u2192 ${rule.message}${label2}`);
|
|
10561
10696
|
}
|
|
10562
10697
|
}
|
|
10563
10698
|
|
|
10564
10699
|
// src/commands/deny/denyRemove.ts
|
|
10565
|
-
import
|
|
10700
|
+
import chalk105 from "chalk";
|
|
10566
10701
|
function denyRemove(pattern2, options2) {
|
|
10567
10702
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
10568
10703
|
const index3 = deny.findIndex((r) => r.pattern === pattern2);
|
|
10569
10704
|
if (index3 === -1) {
|
|
10570
|
-
console.log(
|
|
10705
|
+
console.log(chalk105.yellow(`No deny rule found for: ${pattern2}`));
|
|
10571
10706
|
return;
|
|
10572
10707
|
}
|
|
10573
10708
|
deny.splice(index3, 1);
|
|
10574
10709
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
10575
|
-
console.log(
|
|
10710
|
+
console.log(chalk105.green(`Removed deny rule: ${pattern2}`));
|
|
10576
10711
|
}
|
|
10577
10712
|
|
|
10578
10713
|
// src/commands/registerDeny.ts
|
|
@@ -10602,7 +10737,7 @@ function registerCliHook(program2) {
|
|
|
10602
10737
|
|
|
10603
10738
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
10604
10739
|
import { existsSync as existsSync30, readFileSync as readFileSync25, unlinkSync as unlinkSync8, writeFileSync as writeFileSync23 } from "fs";
|
|
10605
|
-
import
|
|
10740
|
+
import chalk106 from "chalk";
|
|
10606
10741
|
|
|
10607
10742
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
10608
10743
|
import { homedir as homedir14 } from "os";
|
|
@@ -10655,12 +10790,12 @@ function codeCommentConfirm(pin) {
|
|
|
10655
10790
|
sweepRestrictedDir();
|
|
10656
10791
|
const state = readPinState(pin);
|
|
10657
10792
|
if (!state) {
|
|
10658
|
-
console.error(
|
|
10793
|
+
console.error(chalk106.red(`No pending comment for pin: ${pin}`));
|
|
10659
10794
|
process.exitCode = 1;
|
|
10660
10795
|
return;
|
|
10661
10796
|
}
|
|
10662
10797
|
if (!existsSync30(state.file)) {
|
|
10663
|
-
console.error(
|
|
10798
|
+
console.error(chalk106.red(`Target file no longer exists: ${state.file}`));
|
|
10664
10799
|
process.exitCode = 1;
|
|
10665
10800
|
return;
|
|
10666
10801
|
}
|
|
@@ -10669,7 +10804,7 @@ function codeCommentConfirm(pin) {
|
|
|
10669
10804
|
const index3 = state.line - 1;
|
|
10670
10805
|
if (index3 > lines.length) {
|
|
10671
10806
|
console.error(
|
|
10672
|
-
|
|
10807
|
+
chalk106.red(
|
|
10673
10808
|
`Line ${state.line} is beyond the end of ${state.file} (${lines.length} lines).`
|
|
10674
10809
|
)
|
|
10675
10810
|
);
|
|
@@ -10683,14 +10818,14 @@ function codeCommentConfirm(pin) {
|
|
|
10683
10818
|
writeFileSync23(state.file, lines.join("\n"));
|
|
10684
10819
|
unlinkSync8(getPinStatePath(pin));
|
|
10685
10820
|
console.log(
|
|
10686
|
-
|
|
10821
|
+
chalk106.green(
|
|
10687
10822
|
`Inserted "${marker} ${state.text}" at ${state.file}:${state.line}`
|
|
10688
10823
|
)
|
|
10689
10824
|
);
|
|
10690
10825
|
}
|
|
10691
10826
|
|
|
10692
10827
|
// src/commands/codeComment/codeCommentSet.ts
|
|
10693
|
-
import
|
|
10828
|
+
import chalk107 from "chalk";
|
|
10694
10829
|
|
|
10695
10830
|
// src/commands/codeComment/validateCommentText.ts
|
|
10696
10831
|
var MAX_COMMENT_LENGTH = 50;
|
|
@@ -10741,27 +10876,27 @@ function generatePin() {
|
|
|
10741
10876
|
function codeCommentSet(file, line, text9) {
|
|
10742
10877
|
const lineNumber = Number.parseInt(line, 10);
|
|
10743
10878
|
if (!Number.isInteger(lineNumber) || lineNumber < 1) {
|
|
10744
|
-
console.error(
|
|
10879
|
+
console.error(chalk107.red(`Invalid line number: ${line}`));
|
|
10745
10880
|
process.exitCode = 1;
|
|
10746
10881
|
return;
|
|
10747
10882
|
}
|
|
10748
10883
|
const marker = isYamlFile(file) ? "#" : "//";
|
|
10749
10884
|
const validation = validateCommentText(text9, isYamlFile(file));
|
|
10750
10885
|
if (!validation.ok) {
|
|
10751
|
-
console.error(
|
|
10752
|
-
console.error(
|
|
10886
|
+
console.error(chalk107.red(`Refused: ${validation.reason}`));
|
|
10887
|
+
console.error(chalk107.red("No pin issued."));
|
|
10753
10888
|
process.exitCode = 1;
|
|
10754
10889
|
return;
|
|
10755
10890
|
}
|
|
10756
10891
|
console.error(
|
|
10757
|
-
|
|
10892
|
+
chalk107.yellow.bold(
|
|
10758
10893
|
"THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a comment. DO NOT WASTE THEIR TIME.\nYou had BETTER BE RIGHT that this comment is genuinely necessary.\n\nComments are a last resort, not a habit. Almost every comment you reach for is a sign\nthe code should be clearer instead. Before a human is pulled in, ask whether a better\nname, a smaller function, or a test would make the comment redundant. ONLY if you are\ncertain this one line earns its keep should you proceed to the confirm step below."
|
|
10759
10894
|
)
|
|
10760
10895
|
);
|
|
10761
10896
|
const delivered = issuePin(file, lineNumber, validation.text);
|
|
10762
10897
|
if (!delivered) {
|
|
10763
10898
|
console.error(
|
|
10764
|
-
|
|
10899
|
+
chalk107.red(
|
|
10765
10900
|
"Could not deliver the confirmation pin via notification.\nThe comment cannot be confirmed until the notification channel works."
|
|
10766
10901
|
)
|
|
10767
10902
|
);
|
|
@@ -10771,7 +10906,7 @@ function codeCommentSet(file, line, text9) {
|
|
|
10771
10906
|
console.log(
|
|
10772
10907
|
`A confirmation pin was sent to your desktop notifications.
|
|
10773
10908
|
To insert "${marker} ${validation.text}" at ${file}:${lineNumber}, run:
|
|
10774
|
-
${
|
|
10909
|
+
${chalk107.cyan(" assist code-comment confirm <PIN>")}
|
|
10775
10910
|
using the pin from that notification.`
|
|
10776
10911
|
);
|
|
10777
10912
|
}
|
|
@@ -10791,15 +10926,15 @@ function registerCodeComment(parent) {
|
|
|
10791
10926
|
}
|
|
10792
10927
|
|
|
10793
10928
|
// src/commands/complexity/analyze.ts
|
|
10794
|
-
import
|
|
10929
|
+
import chalk116 from "chalk";
|
|
10795
10930
|
|
|
10796
10931
|
// src/commands/complexity/cyclomatic.ts
|
|
10797
|
-
import
|
|
10932
|
+
import chalk109 from "chalk";
|
|
10798
10933
|
|
|
10799
10934
|
// src/commands/complexity/shared/index.ts
|
|
10800
10935
|
import fs17 from "fs";
|
|
10801
10936
|
import path21 from "path";
|
|
10802
|
-
import
|
|
10937
|
+
import chalk108 from "chalk";
|
|
10803
10938
|
import ts5 from "typescript";
|
|
10804
10939
|
|
|
10805
10940
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -11050,7 +11185,7 @@ function createSourceFromFile(filePath) {
|
|
|
11050
11185
|
function withSourceFiles(pattern2, callback, extraIgnore = []) {
|
|
11051
11186
|
const files = findSourceFiles2(pattern2, ".", extraIgnore);
|
|
11052
11187
|
if (files.length === 0) {
|
|
11053
|
-
console.log(
|
|
11188
|
+
console.log(chalk108.yellow("No files found matching pattern"));
|
|
11054
11189
|
return void 0;
|
|
11055
11190
|
}
|
|
11056
11191
|
return callback(files);
|
|
@@ -11083,11 +11218,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
11083
11218
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
11084
11219
|
for (const { file, name, complexity } of results) {
|
|
11085
11220
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
11086
|
-
const color = exceedsThreshold ?
|
|
11087
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
11221
|
+
const color = exceedsThreshold ? chalk109.red : chalk109.white;
|
|
11222
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk109.cyan(complexity)}`);
|
|
11088
11223
|
}
|
|
11089
11224
|
console.log(
|
|
11090
|
-
|
|
11225
|
+
chalk109.dim(
|
|
11091
11226
|
`
|
|
11092
11227
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
11093
11228
|
)
|
|
@@ -11099,7 +11234,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
11099
11234
|
}
|
|
11100
11235
|
|
|
11101
11236
|
// src/commands/complexity/halstead.ts
|
|
11102
|
-
import
|
|
11237
|
+
import chalk110 from "chalk";
|
|
11103
11238
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
11104
11239
|
withSourceFiles(pattern2, (files) => {
|
|
11105
11240
|
const results = [];
|
|
@@ -11114,13 +11249,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
11114
11249
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
11115
11250
|
for (const { file, name, metrics } of results) {
|
|
11116
11251
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
11117
|
-
const color = exceedsThreshold ?
|
|
11252
|
+
const color = exceedsThreshold ? chalk110.red : chalk110.white;
|
|
11118
11253
|
console.log(
|
|
11119
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
11254
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk110.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk110.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk110.magenta(metrics.effort.toFixed(1))}`
|
|
11120
11255
|
);
|
|
11121
11256
|
}
|
|
11122
11257
|
console.log(
|
|
11123
|
-
|
|
11258
|
+
chalk110.dim(
|
|
11124
11259
|
`
|
|
11125
11260
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
11126
11261
|
)
|
|
@@ -11132,27 +11267,27 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
11132
11267
|
}
|
|
11133
11268
|
|
|
11134
11269
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
11135
|
-
import
|
|
11270
|
+
import chalk113 from "chalk";
|
|
11136
11271
|
|
|
11137
11272
|
// src/commands/complexity/maintainability/formatResultLine.ts
|
|
11138
|
-
import
|
|
11273
|
+
import chalk111 from "chalk";
|
|
11139
11274
|
function formatResultLine(entry, failing) {
|
|
11140
11275
|
const { file, avgMaintainability, minMaintainability, override } = entry;
|
|
11141
|
-
const name = failing ?
|
|
11142
|
-
const suffix = override !== void 0 ?
|
|
11143
|
-
return `${name} \u2192 avg: ${
|
|
11276
|
+
const name = failing ? chalk111.red(file) : chalk111.white(file);
|
|
11277
|
+
const suffix = override !== void 0 ? chalk111.magenta(` (override: ${override})`) : "";
|
|
11278
|
+
return `${name} \u2192 avg: ${chalk111.cyan(avgMaintainability.toFixed(1))}, min: ${chalk111.yellow(minMaintainability.toFixed(1))}${suffix}`;
|
|
11144
11279
|
}
|
|
11145
11280
|
|
|
11146
11281
|
// src/commands/complexity/maintainability/printMaintainabilityFailure.ts
|
|
11147
|
-
import
|
|
11282
|
+
import chalk112 from "chalk";
|
|
11148
11283
|
function printMaintainabilityFailure(failingCount, threshold) {
|
|
11149
11284
|
const thresholdLabel = threshold !== void 0 ? ` ${threshold}` : "";
|
|
11150
11285
|
console.error(
|
|
11151
|
-
|
|
11286
|
+
chalk112.red(
|
|
11152
11287
|
`
|
|
11153
11288
|
Fail: ${failingCount} file(s) below threshold${thresholdLabel} (files marked "(override: N)" were judged against their own marker). Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
11154
11289
|
|
|
11155
|
-
\u26A0\uFE0F ${
|
|
11290
|
+
\u26A0\uFE0F ${chalk112.bold("Diagnose and fix one file at a time")} \u2014 do not investigate or fix multiple files in parallel.
|
|
11156
11291
|
|
|
11157
11292
|
The score is a property of the whole file, not your diff: any existing logic counts, so the fix is to shrink the file \u2014 not to revert or micro-optimize the lines you just changed. Identify the largest cohesive responsibility (often the biggest function, or a related group of functions) and move it to a new file with 'assist refactor extract'. Run 'assist complexity <file>' for per-function metrics only to locate that responsibility, not to tweak individual lines.`
|
|
11158
11293
|
)
|
|
@@ -11164,7 +11299,7 @@ function displayMaintainabilityResults(results, threshold) {
|
|
|
11164
11299
|
const gating = threshold !== void 0 || results.some((r) => r.override !== void 0);
|
|
11165
11300
|
if (!gating) {
|
|
11166
11301
|
for (const entry of results) console.log(formatResultLine(entry, false));
|
|
11167
|
-
console.log(
|
|
11302
|
+
console.log(chalk113.dim(`
|
|
11168
11303
|
Analyzed ${results.length} files`));
|
|
11169
11304
|
return;
|
|
11170
11305
|
}
|
|
@@ -11173,7 +11308,7 @@ Analyzed ${results.length} files`));
|
|
|
11173
11308
|
return limit !== void 0 && r.minMaintainability < limit;
|
|
11174
11309
|
});
|
|
11175
11310
|
if (failing.length === 0) {
|
|
11176
|
-
console.log(
|
|
11311
|
+
console.log(chalk113.green("All files pass maintainability threshold"));
|
|
11177
11312
|
} else {
|
|
11178
11313
|
for (const entry of failing) console.log(formatResultLine(entry, true));
|
|
11179
11314
|
}
|
|
@@ -11182,7 +11317,7 @@ Analyzed ${results.length} files`));
|
|
|
11182
11317
|
);
|
|
11183
11318
|
for (const entry of passingOverrides)
|
|
11184
11319
|
console.log(formatResultLine(entry, false));
|
|
11185
|
-
console.log(
|
|
11320
|
+
console.log(chalk113.dim(`
|
|
11186
11321
|
Analyzed ${results.length} files`));
|
|
11187
11322
|
if (failing.length > 0) {
|
|
11188
11323
|
printMaintainabilityFailure(failing.length, threshold);
|
|
@@ -11191,10 +11326,10 @@ Analyzed ${results.length} files`));
|
|
|
11191
11326
|
}
|
|
11192
11327
|
|
|
11193
11328
|
// src/commands/complexity/maintainability/printMaintainabilityFormula.ts
|
|
11194
|
-
import
|
|
11329
|
+
import chalk114 from "chalk";
|
|
11195
11330
|
var MI_FORMULA = "171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100";
|
|
11196
11331
|
function printMaintainabilityFormula() {
|
|
11197
|
-
console.log(
|
|
11332
|
+
console.log(chalk114.dim(MI_FORMULA));
|
|
11198
11333
|
}
|
|
11199
11334
|
|
|
11200
11335
|
// src/commands/complexity/maintainability/collectFileMetrics.ts
|
|
@@ -11270,7 +11405,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
11270
11405
|
|
|
11271
11406
|
// src/commands/complexity/sloc.ts
|
|
11272
11407
|
import fs19 from "fs";
|
|
11273
|
-
import
|
|
11408
|
+
import chalk115 from "chalk";
|
|
11274
11409
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
11275
11410
|
withSourceFiles(pattern2, (files) => {
|
|
11276
11411
|
const results = [];
|
|
@@ -11286,12 +11421,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
11286
11421
|
results.sort((a, b) => b.lines - a.lines);
|
|
11287
11422
|
for (const { file, lines } of results) {
|
|
11288
11423
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
11289
|
-
const color = exceedsThreshold ?
|
|
11290
|
-
console.log(`${color(file)} \u2192 ${
|
|
11424
|
+
const color = exceedsThreshold ? chalk115.red : chalk115.white;
|
|
11425
|
+
console.log(`${color(file)} \u2192 ${chalk115.cyan(lines)} lines`);
|
|
11291
11426
|
}
|
|
11292
11427
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
11293
11428
|
console.log(
|
|
11294
|
-
|
|
11429
|
+
chalk115.dim(`
|
|
11295
11430
|
Total: ${total} lines across ${files.length} files`)
|
|
11296
11431
|
);
|
|
11297
11432
|
if (hasViolation) {
|
|
@@ -11305,25 +11440,25 @@ async function analyze(pattern2) {
|
|
|
11305
11440
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
11306
11441
|
const files = findSourceFiles2(searchPattern);
|
|
11307
11442
|
if (files.length === 0) {
|
|
11308
|
-
console.log(
|
|
11443
|
+
console.log(chalk116.yellow("No files found matching pattern"));
|
|
11309
11444
|
return;
|
|
11310
11445
|
}
|
|
11311
11446
|
if (files.length === 1) {
|
|
11312
11447
|
const file = files[0];
|
|
11313
|
-
console.log(
|
|
11448
|
+
console.log(chalk116.bold.underline("SLOC"));
|
|
11314
11449
|
await sloc(file);
|
|
11315
11450
|
console.log();
|
|
11316
|
-
console.log(
|
|
11451
|
+
console.log(chalk116.bold.underline("Cyclomatic Complexity"));
|
|
11317
11452
|
await cyclomatic(file);
|
|
11318
11453
|
console.log();
|
|
11319
|
-
console.log(
|
|
11454
|
+
console.log(chalk116.bold.underline("Halstead Metrics"));
|
|
11320
11455
|
await halstead(file);
|
|
11321
11456
|
console.log();
|
|
11322
|
-
console.log(
|
|
11457
|
+
console.log(chalk116.bold.underline("Maintainability Index"));
|
|
11323
11458
|
await maintainability(file);
|
|
11324
11459
|
console.log();
|
|
11325
11460
|
console.log(
|
|
11326
|
-
|
|
11461
|
+
chalk116.dim(
|
|
11327
11462
|
"To improve the maintainability index, extract functions and logic out of this file into separate, smaller modules. Collapsing whitespace or removing comments is not the goal."
|
|
11328
11463
|
)
|
|
11329
11464
|
);
|
|
@@ -11357,7 +11492,7 @@ function registerComplexity(program2) {
|
|
|
11357
11492
|
}
|
|
11358
11493
|
|
|
11359
11494
|
// src/commands/config/index.ts
|
|
11360
|
-
import
|
|
11495
|
+
import chalk117 from "chalk";
|
|
11361
11496
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
11362
11497
|
|
|
11363
11498
|
// src/commands/config/setNestedValue.ts
|
|
@@ -11420,7 +11555,7 @@ function formatIssuePath(issue, key) {
|
|
|
11420
11555
|
function printValidationErrors(issues, key) {
|
|
11421
11556
|
for (const issue of issues) {
|
|
11422
11557
|
console.error(
|
|
11423
|
-
|
|
11558
|
+
chalk117.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
11424
11559
|
);
|
|
11425
11560
|
}
|
|
11426
11561
|
}
|
|
@@ -11437,7 +11572,7 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
11437
11572
|
function assertNotGlobalOnly(key, global) {
|
|
11438
11573
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
11439
11574
|
console.error(
|
|
11440
|
-
|
|
11575
|
+
chalk117.red(
|
|
11441
11576
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
11442
11577
|
)
|
|
11443
11578
|
);
|
|
@@ -11460,7 +11595,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
11460
11595
|
applyConfigSet(key, coerced, options2.global ?? false);
|
|
11461
11596
|
const target = options2.global ? "global" : "project";
|
|
11462
11597
|
console.log(
|
|
11463
|
-
|
|
11598
|
+
chalk117.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
11464
11599
|
);
|
|
11465
11600
|
}
|
|
11466
11601
|
function configList() {
|
|
@@ -11469,7 +11604,7 @@ function configList() {
|
|
|
11469
11604
|
}
|
|
11470
11605
|
|
|
11471
11606
|
// src/commands/config/configGet.ts
|
|
11472
|
-
import
|
|
11607
|
+
import chalk118 from "chalk";
|
|
11473
11608
|
|
|
11474
11609
|
// src/commands/config/getNestedValue.ts
|
|
11475
11610
|
function isTraversable(value) {
|
|
@@ -11501,7 +11636,7 @@ function requireNestedValue(config, key) {
|
|
|
11501
11636
|
return value;
|
|
11502
11637
|
}
|
|
11503
11638
|
function exitKeyNotSet(key) {
|
|
11504
|
-
console.error(
|
|
11639
|
+
console.error(chalk118.red(`Key "${key}" is not set`));
|
|
11505
11640
|
process.exit(1);
|
|
11506
11641
|
}
|
|
11507
11642
|
|
|
@@ -11515,7 +11650,7 @@ function registerConfig(program2) {
|
|
|
11515
11650
|
|
|
11516
11651
|
// src/commands/deploy/redirect.ts
|
|
11517
11652
|
import { existsSync as existsSync31, readFileSync as readFileSync26, writeFileSync as writeFileSync25 } from "fs";
|
|
11518
|
-
import
|
|
11653
|
+
import chalk119 from "chalk";
|
|
11519
11654
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
11520
11655
|
if (!window.location.pathname.endsWith('/')) {
|
|
11521
11656
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -11524,23 +11659,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
11524
11659
|
function redirect() {
|
|
11525
11660
|
const indexPath = "index.html";
|
|
11526
11661
|
if (!existsSync31(indexPath)) {
|
|
11527
|
-
console.log(
|
|
11662
|
+
console.log(chalk119.yellow("No index.html found"));
|
|
11528
11663
|
return;
|
|
11529
11664
|
}
|
|
11530
11665
|
const content = readFileSync26(indexPath, "utf8");
|
|
11531
11666
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
11532
|
-
console.log(
|
|
11667
|
+
console.log(chalk119.dim("Trailing slash script already present"));
|
|
11533
11668
|
return;
|
|
11534
11669
|
}
|
|
11535
11670
|
const headCloseIndex = content.indexOf("</head>");
|
|
11536
11671
|
if (headCloseIndex === -1) {
|
|
11537
|
-
console.log(
|
|
11672
|
+
console.log(chalk119.red("Could not find </head> tag in index.html"));
|
|
11538
11673
|
return;
|
|
11539
11674
|
}
|
|
11540
11675
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
11541
11676
|
${content.slice(headCloseIndex)}`;
|
|
11542
11677
|
writeFileSync25(indexPath, newContent);
|
|
11543
|
-
console.log(
|
|
11678
|
+
console.log(chalk119.green("Added trailing slash redirect to index.html"));
|
|
11544
11679
|
}
|
|
11545
11680
|
|
|
11546
11681
|
// src/commands/registerDeploy.ts
|
|
@@ -11567,7 +11702,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
11567
11702
|
|
|
11568
11703
|
// src/commands/devlog/shared.ts
|
|
11569
11704
|
import { execSync as execSync27 } from "child_process";
|
|
11570
|
-
import
|
|
11705
|
+
import chalk120 from "chalk";
|
|
11571
11706
|
|
|
11572
11707
|
// src/shared/getRepoName.ts
|
|
11573
11708
|
import { existsSync as existsSync32, readFileSync as readFileSync27 } from "fs";
|
|
@@ -11676,13 +11811,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
11676
11811
|
}
|
|
11677
11812
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
11678
11813
|
for (const commit2 of commits2) {
|
|
11679
|
-
console.log(` ${
|
|
11814
|
+
console.log(` ${chalk120.yellow(commit2.hash)} ${commit2.message}`);
|
|
11680
11815
|
if (verbose) {
|
|
11681
11816
|
const visibleFiles = commit2.files.filter(
|
|
11682
11817
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
11683
11818
|
);
|
|
11684
11819
|
for (const file of visibleFiles) {
|
|
11685
|
-
console.log(` ${
|
|
11820
|
+
console.log(` ${chalk120.dim(file)}`);
|
|
11686
11821
|
}
|
|
11687
11822
|
}
|
|
11688
11823
|
}
|
|
@@ -11707,15 +11842,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
11707
11842
|
}
|
|
11708
11843
|
|
|
11709
11844
|
// src/commands/devlog/list/printDateHeader.ts
|
|
11710
|
-
import
|
|
11845
|
+
import chalk121 from "chalk";
|
|
11711
11846
|
function printDateHeader(date, isSkipped, entries) {
|
|
11712
11847
|
if (isSkipped) {
|
|
11713
|
-
console.log(`${
|
|
11848
|
+
console.log(`${chalk121.bold.blue(date)} ${chalk121.dim("skipped")}`);
|
|
11714
11849
|
} else if (entries && entries.length > 0) {
|
|
11715
|
-
const entryInfo = entries.map((e) => `${
|
|
11716
|
-
console.log(`${
|
|
11850
|
+
const entryInfo = entries.map((e) => `${chalk121.green(e.version)} ${e.title}`).join(" | ");
|
|
11851
|
+
console.log(`${chalk121.bold.blue(date)} ${entryInfo}`);
|
|
11717
11852
|
} else {
|
|
11718
|
-
console.log(`${
|
|
11853
|
+
console.log(`${chalk121.bold.blue(date)} ${chalk121.red("\u26A0 devlog missing")}`);
|
|
11719
11854
|
}
|
|
11720
11855
|
}
|
|
11721
11856
|
|
|
@@ -11819,24 +11954,24 @@ function bumpVersion(version2, type) {
|
|
|
11819
11954
|
|
|
11820
11955
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
11821
11956
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
11822
|
-
import
|
|
11957
|
+
import chalk123 from "chalk";
|
|
11823
11958
|
|
|
11824
11959
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
11825
|
-
import
|
|
11960
|
+
import chalk122 from "chalk";
|
|
11826
11961
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
11827
11962
|
if (conventional && firstHash) {
|
|
11828
11963
|
const version2 = getVersionAtCommit(firstHash);
|
|
11829
11964
|
if (version2) {
|
|
11830
|
-
console.log(`${
|
|
11965
|
+
console.log(`${chalk122.bold("version:")} ${stripToMinor(version2)}`);
|
|
11831
11966
|
} else {
|
|
11832
|
-
console.log(`${
|
|
11967
|
+
console.log(`${chalk122.bold("version:")} ${chalk122.red("unknown")}`);
|
|
11833
11968
|
}
|
|
11834
11969
|
} else if (patchVersion && minorVersion) {
|
|
11835
11970
|
console.log(
|
|
11836
|
-
`${
|
|
11971
|
+
`${chalk122.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
11837
11972
|
);
|
|
11838
11973
|
} else {
|
|
11839
|
-
console.log(`${
|
|
11974
|
+
console.log(`${chalk122.bold("version:")} v0.1 (initial)`);
|
|
11840
11975
|
}
|
|
11841
11976
|
}
|
|
11842
11977
|
|
|
@@ -11884,16 +12019,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
11884
12019
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
11885
12020
|
}
|
|
11886
12021
|
function logName(repoName) {
|
|
11887
|
-
console.log(`${
|
|
12022
|
+
console.log(`${chalk123.bold("name:")} ${repoName}`);
|
|
11888
12023
|
}
|
|
11889
12024
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
11890
12025
|
logName(ctx.repoName);
|
|
11891
12026
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
11892
|
-
console.log(
|
|
12027
|
+
console.log(chalk123.bold.blue(targetDate));
|
|
11893
12028
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
11894
12029
|
}
|
|
11895
12030
|
function logNoCommits(lastInfo) {
|
|
11896
|
-
console.log(
|
|
12031
|
+
console.log(chalk123.dim(noCommitsMessage(!!lastInfo)));
|
|
11897
12032
|
}
|
|
11898
12033
|
|
|
11899
12034
|
// src/commands/devlog/next/index.ts
|
|
@@ -11934,11 +12069,11 @@ function next2(options2) {
|
|
|
11934
12069
|
import { execSync as execSync29 } from "child_process";
|
|
11935
12070
|
|
|
11936
12071
|
// src/commands/devlog/repos/printReposTable.ts
|
|
11937
|
-
import
|
|
12072
|
+
import chalk124 from "chalk";
|
|
11938
12073
|
function colorStatus(status2) {
|
|
11939
|
-
if (status2 === "missing") return
|
|
11940
|
-
if (status2 === "outdated") return
|
|
11941
|
-
return
|
|
12074
|
+
if (status2 === "missing") return chalk124.red(status2);
|
|
12075
|
+
if (status2 === "outdated") return chalk124.yellow(status2);
|
|
12076
|
+
return chalk124.green(status2);
|
|
11942
12077
|
}
|
|
11943
12078
|
function formatRow(row, nameWidth) {
|
|
11944
12079
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -11952,8 +12087,8 @@ function printReposTable(rows) {
|
|
|
11952
12087
|
"Last Devlog".padEnd(11),
|
|
11953
12088
|
"Status"
|
|
11954
12089
|
].join(" ");
|
|
11955
|
-
console.log(
|
|
11956
|
-
console.log(
|
|
12090
|
+
console.log(chalk124.dim(header));
|
|
12091
|
+
console.log(chalk124.dim("-".repeat(header.length)));
|
|
11957
12092
|
for (const row of rows) {
|
|
11958
12093
|
console.log(formatRow(row, nameWidth));
|
|
11959
12094
|
}
|
|
@@ -12011,14 +12146,14 @@ function repos(options2) {
|
|
|
12011
12146
|
// src/commands/devlog/skip.ts
|
|
12012
12147
|
import { writeFileSync as writeFileSync26 } from "fs";
|
|
12013
12148
|
import { join as join33 } from "path";
|
|
12014
|
-
import
|
|
12149
|
+
import chalk125 from "chalk";
|
|
12015
12150
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
12016
12151
|
function getBlogConfigPath() {
|
|
12017
12152
|
return join33(BLOG_REPO_ROOT, "assist.yml");
|
|
12018
12153
|
}
|
|
12019
12154
|
function skip(date) {
|
|
12020
12155
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
12021
|
-
console.log(
|
|
12156
|
+
console.log(chalk125.red("Invalid date format. Use YYYY-MM-DD"));
|
|
12022
12157
|
process.exit(1);
|
|
12023
12158
|
}
|
|
12024
12159
|
const repoName = getRepoName();
|
|
@@ -12029,7 +12164,7 @@ function skip(date) {
|
|
|
12029
12164
|
const skipDays = skip2[repoName] ?? [];
|
|
12030
12165
|
if (skipDays.includes(date)) {
|
|
12031
12166
|
console.log(
|
|
12032
|
-
|
|
12167
|
+
chalk125.yellow(`${date} is already in skip list for ${repoName}`)
|
|
12033
12168
|
);
|
|
12034
12169
|
return;
|
|
12035
12170
|
}
|
|
@@ -12039,20 +12174,20 @@ function skip(date) {
|
|
|
12039
12174
|
devlog.skip = skip2;
|
|
12040
12175
|
config.devlog = devlog;
|
|
12041
12176
|
writeFileSync26(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
12042
|
-
console.log(
|
|
12177
|
+
console.log(chalk125.green(`Added ${date} to skip list for ${repoName}`));
|
|
12043
12178
|
}
|
|
12044
12179
|
|
|
12045
12180
|
// src/commands/devlog/version.ts
|
|
12046
|
-
import
|
|
12181
|
+
import chalk126 from "chalk";
|
|
12047
12182
|
function version() {
|
|
12048
12183
|
const config = loadConfig();
|
|
12049
12184
|
const name = getRepoName();
|
|
12050
12185
|
const lastInfo = getLastVersionInfo(name, config);
|
|
12051
12186
|
const lastVersion = lastInfo?.version ?? null;
|
|
12052
12187
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
12053
|
-
console.log(`${
|
|
12054
|
-
console.log(`${
|
|
12055
|
-
console.log(`${
|
|
12188
|
+
console.log(`${chalk126.bold("name:")} ${name}`);
|
|
12189
|
+
console.log(`${chalk126.bold("last:")} ${lastVersion ?? chalk126.dim("none")}`);
|
|
12190
|
+
console.log(`${chalk126.bold("next:")} ${nextVersion ?? chalk126.dim("none")}`);
|
|
12056
12191
|
}
|
|
12057
12192
|
|
|
12058
12193
|
// src/commands/registerDevlog.ts
|
|
@@ -12076,7 +12211,7 @@ function registerDevlog(program2) {
|
|
|
12076
12211
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
12077
12212
|
import { closeSync as closeSync2, openSync as openSync2, readdirSync as readdirSync4 } from "fs";
|
|
12078
12213
|
import { join as join34 } from "path";
|
|
12079
|
-
import
|
|
12214
|
+
import chalk127 from "chalk";
|
|
12080
12215
|
|
|
12081
12216
|
// src/shared/findRepoRoot.ts
|
|
12082
12217
|
import { existsSync as existsSync33 } from "fs";
|
|
@@ -12139,14 +12274,14 @@ function checkBuildLocks(startDir) {
|
|
|
12139
12274
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
12140
12275
|
if (locked) {
|
|
12141
12276
|
console.error(
|
|
12142
|
-
|
|
12277
|
+
chalk127.red("Build output locked (is VS debugging?): ") + locked
|
|
12143
12278
|
);
|
|
12144
12279
|
process.exit(1);
|
|
12145
12280
|
}
|
|
12146
12281
|
}
|
|
12147
12282
|
async function checkBuildLocksCommand() {
|
|
12148
12283
|
checkBuildLocks();
|
|
12149
|
-
console.log(
|
|
12284
|
+
console.log(chalk127.green("No build locks detected"));
|
|
12150
12285
|
}
|
|
12151
12286
|
|
|
12152
12287
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -12245,30 +12380,30 @@ function escapeRegex(s) {
|
|
|
12245
12380
|
}
|
|
12246
12381
|
|
|
12247
12382
|
// src/commands/dotnet/printTree.ts
|
|
12248
|
-
import
|
|
12383
|
+
import chalk128 from "chalk";
|
|
12249
12384
|
function printNodes(nodes, prefix2) {
|
|
12250
12385
|
for (let i = 0; i < nodes.length; i++) {
|
|
12251
12386
|
const isLast = i === nodes.length - 1;
|
|
12252
12387
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
12253
12388
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
12254
12389
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
12255
|
-
const label2 = isMissing ?
|
|
12390
|
+
const label2 = isMissing ? chalk128.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
12256
12391
|
console.log(`${prefix2}${connector}${label2}`);
|
|
12257
12392
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
12258
12393
|
}
|
|
12259
12394
|
}
|
|
12260
12395
|
function printTree(tree, totalCount, solutions) {
|
|
12261
|
-
console.log(
|
|
12262
|
-
console.log(
|
|
12396
|
+
console.log(chalk128.bold("\nProject Dependency Tree"));
|
|
12397
|
+
console.log(chalk128.cyan(tree.relativePath));
|
|
12263
12398
|
printNodes(tree.children, "");
|
|
12264
|
-
console.log(
|
|
12399
|
+
console.log(chalk128.dim(`
|
|
12265
12400
|
${totalCount} projects total (including root)`));
|
|
12266
|
-
console.log(
|
|
12401
|
+
console.log(chalk128.bold("\nSolution Membership"));
|
|
12267
12402
|
if (solutions.length === 0) {
|
|
12268
|
-
console.log(
|
|
12403
|
+
console.log(chalk128.yellow(" Not found in any .sln"));
|
|
12269
12404
|
} else {
|
|
12270
12405
|
for (const sln of solutions) {
|
|
12271
|
-
console.log(` ${
|
|
12406
|
+
console.log(` ${chalk128.green(sln)}`);
|
|
12272
12407
|
}
|
|
12273
12408
|
}
|
|
12274
12409
|
console.log();
|
|
@@ -12297,16 +12432,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
12297
12432
|
// src/commands/dotnet/resolveCsproj.ts
|
|
12298
12433
|
import { existsSync as existsSync34 } from "fs";
|
|
12299
12434
|
import path25 from "path";
|
|
12300
|
-
import
|
|
12435
|
+
import chalk129 from "chalk";
|
|
12301
12436
|
function resolveCsproj(csprojPath) {
|
|
12302
12437
|
const resolved = path25.resolve(csprojPath);
|
|
12303
12438
|
if (!existsSync34(resolved)) {
|
|
12304
|
-
console.error(
|
|
12439
|
+
console.error(chalk129.red(`File not found: ${resolved}`));
|
|
12305
12440
|
process.exit(1);
|
|
12306
12441
|
}
|
|
12307
12442
|
const repoRoot = findRepoRoot(path25.dirname(resolved));
|
|
12308
12443
|
if (!repoRoot) {
|
|
12309
|
-
console.error(
|
|
12444
|
+
console.error(chalk129.red("Could not find git repository root"));
|
|
12310
12445
|
process.exit(1);
|
|
12311
12446
|
}
|
|
12312
12447
|
return { resolved, repoRoot };
|
|
@@ -12356,12 +12491,12 @@ function getChangedCsFiles(scope) {
|
|
|
12356
12491
|
}
|
|
12357
12492
|
|
|
12358
12493
|
// src/commands/dotnet/inSln.ts
|
|
12359
|
-
import
|
|
12494
|
+
import chalk130 from "chalk";
|
|
12360
12495
|
async function inSln(csprojPath) {
|
|
12361
12496
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
12362
12497
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
12363
12498
|
if (solutions.length === 0) {
|
|
12364
|
-
console.log(
|
|
12499
|
+
console.log(chalk130.yellow("Not found in any .sln file"));
|
|
12365
12500
|
process.exit(1);
|
|
12366
12501
|
}
|
|
12367
12502
|
for (const sln of solutions) {
|
|
@@ -12370,7 +12505,7 @@ async function inSln(csprojPath) {
|
|
|
12370
12505
|
}
|
|
12371
12506
|
|
|
12372
12507
|
// src/commands/dotnet/inspect.ts
|
|
12373
|
-
import
|
|
12508
|
+
import chalk136 from "chalk";
|
|
12374
12509
|
|
|
12375
12510
|
// src/shared/formatElapsed.ts
|
|
12376
12511
|
function formatElapsed(ms) {
|
|
@@ -12382,12 +12517,12 @@ function formatElapsed(ms) {
|
|
|
12382
12517
|
}
|
|
12383
12518
|
|
|
12384
12519
|
// src/commands/dotnet/displayIssues.ts
|
|
12385
|
-
import
|
|
12520
|
+
import chalk131 from "chalk";
|
|
12386
12521
|
var SEVERITY_COLOR = {
|
|
12387
|
-
ERROR:
|
|
12388
|
-
WARNING:
|
|
12389
|
-
SUGGESTION:
|
|
12390
|
-
HINT:
|
|
12522
|
+
ERROR: chalk131.red,
|
|
12523
|
+
WARNING: chalk131.yellow,
|
|
12524
|
+
SUGGESTION: chalk131.cyan,
|
|
12525
|
+
HINT: chalk131.dim
|
|
12391
12526
|
};
|
|
12392
12527
|
function groupByFile(issues) {
|
|
12393
12528
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -12403,15 +12538,15 @@ function groupByFile(issues) {
|
|
|
12403
12538
|
}
|
|
12404
12539
|
function displayIssues(issues) {
|
|
12405
12540
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
12406
|
-
console.log(
|
|
12541
|
+
console.log(chalk131.bold(file));
|
|
12407
12542
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
12408
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
12543
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk131.white;
|
|
12409
12544
|
console.log(
|
|
12410
|
-
` ${
|
|
12545
|
+
` ${chalk131.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
12411
12546
|
);
|
|
12412
12547
|
}
|
|
12413
12548
|
}
|
|
12414
|
-
console.log(
|
|
12549
|
+
console.log(chalk131.dim(`
|
|
12415
12550
|
${issues.length} issue(s) found`));
|
|
12416
12551
|
}
|
|
12417
12552
|
|
|
@@ -12470,12 +12605,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
12470
12605
|
// src/commands/dotnet/resolveSolution.ts
|
|
12471
12606
|
import { existsSync as existsSync35 } from "fs";
|
|
12472
12607
|
import path26 from "path";
|
|
12473
|
-
import
|
|
12608
|
+
import chalk133 from "chalk";
|
|
12474
12609
|
|
|
12475
12610
|
// src/commands/dotnet/findSolution.ts
|
|
12476
12611
|
import { readdirSync as readdirSync6 } from "fs";
|
|
12477
12612
|
import { dirname as dirname20, join as join35 } from "path";
|
|
12478
|
-
import
|
|
12613
|
+
import chalk132 from "chalk";
|
|
12479
12614
|
function findSlnInDir(dir) {
|
|
12480
12615
|
try {
|
|
12481
12616
|
return readdirSync6(dir).filter((f) => f.endsWith(".sln")).map((f) => join35(dir, f));
|
|
@@ -12491,17 +12626,17 @@ function findSolution() {
|
|
|
12491
12626
|
const slnFiles = findSlnInDir(current);
|
|
12492
12627
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
12493
12628
|
if (slnFiles.length > 1) {
|
|
12494
|
-
console.error(
|
|
12629
|
+
console.error(chalk132.red(`Multiple .sln files found in ${current}:`));
|
|
12495
12630
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
12496
12631
|
console.error(
|
|
12497
|
-
|
|
12632
|
+
chalk132.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
12498
12633
|
);
|
|
12499
12634
|
process.exit(1);
|
|
12500
12635
|
}
|
|
12501
12636
|
if (current === ceiling) break;
|
|
12502
12637
|
current = dirname20(current);
|
|
12503
12638
|
}
|
|
12504
|
-
console.error(
|
|
12639
|
+
console.error(chalk132.red("No .sln file found between cwd and repo root"));
|
|
12505
12640
|
process.exit(1);
|
|
12506
12641
|
}
|
|
12507
12642
|
|
|
@@ -12510,7 +12645,7 @@ function resolveSolution(sln) {
|
|
|
12510
12645
|
if (sln) {
|
|
12511
12646
|
const resolved = path26.resolve(sln);
|
|
12512
12647
|
if (!existsSync35(resolved)) {
|
|
12513
|
-
console.error(
|
|
12648
|
+
console.error(chalk133.red(`Solution file not found: ${resolved}`));
|
|
12514
12649
|
process.exit(1);
|
|
12515
12650
|
}
|
|
12516
12651
|
return resolved;
|
|
@@ -12552,14 +12687,14 @@ import { execSync as execSync31 } from "child_process";
|
|
|
12552
12687
|
import { existsSync as existsSync36, readFileSync as readFileSync31, unlinkSync as unlinkSync9 } from "fs";
|
|
12553
12688
|
import { tmpdir as tmpdir3 } from "os";
|
|
12554
12689
|
import path27 from "path";
|
|
12555
|
-
import
|
|
12690
|
+
import chalk134 from "chalk";
|
|
12556
12691
|
function assertJbInstalled() {
|
|
12557
12692
|
try {
|
|
12558
12693
|
execSync31("jb inspectcode --version", { stdio: "pipe" });
|
|
12559
12694
|
} catch {
|
|
12560
|
-
console.error(
|
|
12695
|
+
console.error(chalk134.red("jb is not installed. Install with:"));
|
|
12561
12696
|
console.error(
|
|
12562
|
-
|
|
12697
|
+
chalk134.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
12563
12698
|
);
|
|
12564
12699
|
process.exit(1);
|
|
12565
12700
|
}
|
|
@@ -12577,11 +12712,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
12577
12712
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
12578
12713
|
process.stderr.write(error.stderr);
|
|
12579
12714
|
}
|
|
12580
|
-
console.error(
|
|
12715
|
+
console.error(chalk134.red("jb inspectcode failed"));
|
|
12581
12716
|
process.exit(1);
|
|
12582
12717
|
}
|
|
12583
12718
|
if (!existsSync36(reportPath)) {
|
|
12584
|
-
console.error(
|
|
12719
|
+
console.error(chalk134.red("Report file not generated"));
|
|
12585
12720
|
process.exit(1);
|
|
12586
12721
|
}
|
|
12587
12722
|
const xml = readFileSync31(reportPath, "utf8");
|
|
@@ -12591,7 +12726,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
12591
12726
|
|
|
12592
12727
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
12593
12728
|
import { execSync as execSync32 } from "child_process";
|
|
12594
|
-
import
|
|
12729
|
+
import chalk135 from "chalk";
|
|
12595
12730
|
function resolveMsbuildPath() {
|
|
12596
12731
|
const { run: run4 } = loadConfig();
|
|
12597
12732
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -12603,9 +12738,9 @@ function assertMsbuildInstalled() {
|
|
|
12603
12738
|
try {
|
|
12604
12739
|
execSync32(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
12605
12740
|
} catch {
|
|
12606
|
-
console.error(
|
|
12741
|
+
console.error(chalk135.red(`msbuild not found at: ${msbuild}`));
|
|
12607
12742
|
console.error(
|
|
12608
|
-
|
|
12743
|
+
chalk135.yellow(
|
|
12609
12744
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
12610
12745
|
)
|
|
12611
12746
|
);
|
|
@@ -12652,17 +12787,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
12652
12787
|
// src/commands/dotnet/inspect.ts
|
|
12653
12788
|
function logScope(changedFiles) {
|
|
12654
12789
|
if (changedFiles === null) {
|
|
12655
|
-
console.log(
|
|
12790
|
+
console.log(chalk136.dim("Inspecting full solution..."));
|
|
12656
12791
|
} else {
|
|
12657
12792
|
console.log(
|
|
12658
|
-
|
|
12793
|
+
chalk136.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
12659
12794
|
);
|
|
12660
12795
|
}
|
|
12661
12796
|
}
|
|
12662
12797
|
function reportResults(issues, elapsed) {
|
|
12663
12798
|
if (issues.length > 0) displayIssues(issues);
|
|
12664
|
-
else console.log(
|
|
12665
|
-
console.log(
|
|
12799
|
+
else console.log(chalk136.green("No issues found"));
|
|
12800
|
+
console.log(chalk136.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
12666
12801
|
if (issues.length > 0) process.exit(1);
|
|
12667
12802
|
}
|
|
12668
12803
|
async function inspect(sln, options2) {
|
|
@@ -12673,7 +12808,7 @@ async function inspect(sln, options2) {
|
|
|
12673
12808
|
const scope = parseScope(options2.scope);
|
|
12674
12809
|
const changedFiles = getChangedCsFiles(scope);
|
|
12675
12810
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
12676
|
-
console.log(
|
|
12811
|
+
console.log(chalk136.green("No changed .cs files found"));
|
|
12677
12812
|
return;
|
|
12678
12813
|
}
|
|
12679
12814
|
logScope(changedFiles);
|
|
@@ -12998,25 +13133,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
12998
13133
|
}
|
|
12999
13134
|
|
|
13000
13135
|
// src/commands/github/printCountTable.ts
|
|
13001
|
-
import
|
|
13136
|
+
import chalk137 from "chalk";
|
|
13002
13137
|
function printCountTable(labelHeader, rows) {
|
|
13003
13138
|
const labelWidth = Math.max(
|
|
13004
13139
|
labelHeader.length,
|
|
13005
13140
|
...rows.map((row) => row.label.length)
|
|
13006
13141
|
);
|
|
13007
13142
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
13008
|
-
console.log(
|
|
13009
|
-
console.log(
|
|
13143
|
+
console.log(chalk137.dim(header));
|
|
13144
|
+
console.log(chalk137.dim("-".repeat(header.length)));
|
|
13010
13145
|
for (const row of rows) {
|
|
13011
13146
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
13012
13147
|
}
|
|
13013
13148
|
}
|
|
13014
13149
|
|
|
13015
13150
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
13016
|
-
import
|
|
13151
|
+
import chalk138 from "chalk";
|
|
13017
13152
|
function printRepoAuthorBreakdown(repos2) {
|
|
13018
13153
|
for (const repo of repos2) {
|
|
13019
|
-
console.log(
|
|
13154
|
+
console.log(chalk138.bold(repo.name));
|
|
13020
13155
|
const authorWidth = Math.max(
|
|
13021
13156
|
0,
|
|
13022
13157
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -13113,9 +13248,9 @@ function registerGithub(program2) {
|
|
|
13113
13248
|
}
|
|
13114
13249
|
|
|
13115
13250
|
// src/commands/handover/countPendingHandovers.ts
|
|
13116
|
-
import { and as
|
|
13251
|
+
import { and as and16, eq as eq35, isNull, sql as sql5 } from "drizzle-orm";
|
|
13117
13252
|
async function countPendingHandovers(orm, origin) {
|
|
13118
|
-
const [row] = await orm.select({ count: sql5`count(*)::int` }).from(handovers).where(
|
|
13253
|
+
const [row] = await orm.select({ count: sql5`count(*)::int` }).from(handovers).where(and16(eq35(handovers.origin, origin), isNull(handovers.recalledAt)));
|
|
13119
13254
|
return row?.count ?? 0;
|
|
13120
13255
|
}
|
|
13121
13256
|
|
|
@@ -13255,13 +13390,13 @@ async function load2(options2 = {}) {
|
|
|
13255
13390
|
}
|
|
13256
13391
|
|
|
13257
13392
|
// src/commands/handover/listPendingHandovers.ts
|
|
13258
|
-
import { and as
|
|
13393
|
+
import { and as and17, desc as desc4, eq as eq36, isNull as isNull2 } from "drizzle-orm";
|
|
13259
13394
|
async function listPendingHandovers(orm, origin) {
|
|
13260
13395
|
return orm.select({
|
|
13261
13396
|
id: handovers.id,
|
|
13262
13397
|
summary: handovers.summary,
|
|
13263
13398
|
createdAt: handovers.createdAt
|
|
13264
|
-
}).from(handovers).where(
|
|
13399
|
+
}).from(handovers).where(and17(eq36(handovers.origin, origin), isNull2(handovers.recalledAt))).orderBy(desc4(handovers.createdAt), desc4(handovers.id));
|
|
13265
13400
|
}
|
|
13266
13401
|
|
|
13267
13402
|
// src/commands/handover/printPendingHandovers.ts
|
|
@@ -13274,17 +13409,17 @@ async function printPendingHandovers() {
|
|
|
13274
13409
|
}
|
|
13275
13410
|
|
|
13276
13411
|
// src/commands/handover/recallHandover.ts
|
|
13277
|
-
import { and as
|
|
13412
|
+
import { and as and18, desc as desc5, eq as eq37, isNull as isNull3 } from "drizzle-orm";
|
|
13278
13413
|
async function recallHandover(orm, origin, id2) {
|
|
13279
13414
|
const [row] = await orm.select().from(handovers).where(
|
|
13280
|
-
|
|
13281
|
-
|
|
13415
|
+
and18(
|
|
13416
|
+
eq37(handovers.origin, origin),
|
|
13282
13417
|
isNull3(handovers.recalledAt),
|
|
13283
|
-
...id2 === void 0 ? [] : [
|
|
13418
|
+
...id2 === void 0 ? [] : [eq37(handovers.id, id2)]
|
|
13284
13419
|
)
|
|
13285
13420
|
).orderBy(desc5(handovers.createdAt), desc5(handovers.id)).limit(1);
|
|
13286
13421
|
if (!row) return void 0;
|
|
13287
|
-
await orm.update(handovers).set({ recalledAt: /* @__PURE__ */ new Date() }).where(
|
|
13422
|
+
await orm.update(handovers).set({ recalledAt: /* @__PURE__ */ new Date() }).where(eq37(handovers.id, row.id));
|
|
13288
13423
|
return row.content;
|
|
13289
13424
|
}
|
|
13290
13425
|
|
|
@@ -13334,7 +13469,7 @@ function registerHandover(program2) {
|
|
|
13334
13469
|
}
|
|
13335
13470
|
|
|
13336
13471
|
// src/commands/jira/acceptanceCriteria.ts
|
|
13337
|
-
import
|
|
13472
|
+
import chalk139 from "chalk";
|
|
13338
13473
|
|
|
13339
13474
|
// src/commands/jira/adfToText.ts
|
|
13340
13475
|
function renderInline(node) {
|
|
@@ -13401,7 +13536,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
13401
13536
|
const parsed = fetchIssue(issueKey, field);
|
|
13402
13537
|
const acValue = parsed?.fields?.[field];
|
|
13403
13538
|
if (!acValue) {
|
|
13404
|
-
console.log(
|
|
13539
|
+
console.log(chalk139.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
13405
13540
|
return;
|
|
13406
13541
|
}
|
|
13407
13542
|
if (typeof acValue === "string") {
|
|
@@ -13467,14 +13602,14 @@ async function jiraAuth() {
|
|
|
13467
13602
|
}
|
|
13468
13603
|
|
|
13469
13604
|
// src/commands/jira/viewIssue.ts
|
|
13470
|
-
import
|
|
13605
|
+
import chalk140 from "chalk";
|
|
13471
13606
|
function viewIssue(issueKey) {
|
|
13472
13607
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
13473
13608
|
const fields = parsed?.fields;
|
|
13474
13609
|
const summary = fields?.summary;
|
|
13475
13610
|
const description = fields?.description;
|
|
13476
13611
|
if (summary) {
|
|
13477
|
-
console.log(
|
|
13612
|
+
console.log(chalk140.bold(summary));
|
|
13478
13613
|
}
|
|
13479
13614
|
if (description) {
|
|
13480
13615
|
if (summary) console.log();
|
|
@@ -13488,7 +13623,7 @@ function viewIssue(issueKey) {
|
|
|
13488
13623
|
}
|
|
13489
13624
|
if (!summary && !description) {
|
|
13490
13625
|
console.log(
|
|
13491
|
-
|
|
13626
|
+
chalk140.yellow(`No summary or description found on ${issueKey}.`)
|
|
13492
13627
|
);
|
|
13493
13628
|
}
|
|
13494
13629
|
}
|
|
@@ -13504,13 +13639,13 @@ function registerJira(program2) {
|
|
|
13504
13639
|
// src/commands/reviewComments.ts
|
|
13505
13640
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
13506
13641
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
13507
|
-
import
|
|
13642
|
+
import chalk141 from "chalk";
|
|
13508
13643
|
async function reviewComments(number) {
|
|
13509
13644
|
if (number) {
|
|
13510
13645
|
try {
|
|
13511
13646
|
execFileSync5("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
13512
13647
|
} catch {
|
|
13513
|
-
console.error(
|
|
13648
|
+
console.error(chalk141.red(`gh pr checkout ${number} failed; aborting.`));
|
|
13514
13649
|
process.exit(1);
|
|
13515
13650
|
}
|
|
13516
13651
|
}
|
|
@@ -13584,15 +13719,15 @@ function registerList(program2) {
|
|
|
13584
13719
|
// src/commands/mermaid/index.ts
|
|
13585
13720
|
import { mkdirSync as mkdirSync14, readdirSync as readdirSync8 } from "fs";
|
|
13586
13721
|
import { resolve as resolve11 } from "path";
|
|
13587
|
-
import
|
|
13722
|
+
import chalk144 from "chalk";
|
|
13588
13723
|
|
|
13589
13724
|
// src/commands/mermaid/exportFile.ts
|
|
13590
13725
|
import { readFileSync as readFileSync33, writeFileSync as writeFileSync28 } from "fs";
|
|
13591
13726
|
import { basename as basename8, extname, resolve as resolve10 } from "path";
|
|
13592
|
-
import
|
|
13727
|
+
import chalk143 from "chalk";
|
|
13593
13728
|
|
|
13594
13729
|
// src/commands/mermaid/renderBlock.ts
|
|
13595
|
-
import
|
|
13730
|
+
import chalk142 from "chalk";
|
|
13596
13731
|
async function renderBlock(krokiUrl, source) {
|
|
13597
13732
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
13598
13733
|
method: "POST",
|
|
@@ -13601,7 +13736,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
13601
13736
|
});
|
|
13602
13737
|
if (!response.ok) {
|
|
13603
13738
|
console.error(
|
|
13604
|
-
|
|
13739
|
+
chalk142.red(
|
|
13605
13740
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
13606
13741
|
)
|
|
13607
13742
|
);
|
|
@@ -13619,19 +13754,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
13619
13754
|
if (onlyIndex !== void 0) {
|
|
13620
13755
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
13621
13756
|
console.error(
|
|
13622
|
-
|
|
13757
|
+
chalk143.red(
|
|
13623
13758
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
13624
13759
|
)
|
|
13625
13760
|
);
|
|
13626
13761
|
process.exit(1);
|
|
13627
13762
|
}
|
|
13628
13763
|
console.log(
|
|
13629
|
-
|
|
13764
|
+
chalk143.gray(
|
|
13630
13765
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
13631
13766
|
)
|
|
13632
13767
|
);
|
|
13633
13768
|
} else {
|
|
13634
|
-
console.log(
|
|
13769
|
+
console.log(chalk143.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
13635
13770
|
}
|
|
13636
13771
|
for (const [i, source] of blocks.entries()) {
|
|
13637
13772
|
const idx = i + 1;
|
|
@@ -13639,7 +13774,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
13639
13774
|
const outPath = resolve10(outDir, `${stem}-${idx}.svg`);
|
|
13640
13775
|
const svg = await renderBlock(krokiUrl, source);
|
|
13641
13776
|
writeFileSync28(outPath, svg, "utf8");
|
|
13642
|
-
console.log(
|
|
13777
|
+
console.log(chalk143.green(` \u2192 ${outPath}`));
|
|
13643
13778
|
}
|
|
13644
13779
|
}
|
|
13645
13780
|
function extractMermaidBlocks(markdown) {
|
|
@@ -13655,18 +13790,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
13655
13790
|
if (options2.index !== void 0) {
|
|
13656
13791
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
13657
13792
|
console.error(
|
|
13658
|
-
|
|
13793
|
+
chalk144.red(`--index must be a positive integer (got ${options2.index})`)
|
|
13659
13794
|
);
|
|
13660
13795
|
process.exit(1);
|
|
13661
13796
|
}
|
|
13662
13797
|
if (!file) {
|
|
13663
|
-
console.error(
|
|
13798
|
+
console.error(chalk144.red("--index requires a file argument"));
|
|
13664
13799
|
process.exit(1);
|
|
13665
13800
|
}
|
|
13666
13801
|
}
|
|
13667
13802
|
const files = file ? [file] : readdirSync8(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
13668
13803
|
if (files.length === 0) {
|
|
13669
|
-
console.log(
|
|
13804
|
+
console.log(chalk144.gray("No markdown files found in current directory."));
|
|
13670
13805
|
return;
|
|
13671
13806
|
}
|
|
13672
13807
|
for (const f of files) {
|
|
@@ -13692,7 +13827,7 @@ function registerMermaid(program2) {
|
|
|
13692
13827
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
13693
13828
|
import { createServer as createServer2 } from "http";
|
|
13694
13829
|
import { dirname as dirname22 } from "path";
|
|
13695
|
-
import
|
|
13830
|
+
import chalk146 from "chalk";
|
|
13696
13831
|
|
|
13697
13832
|
// src/commands/netcap/corsHeaders.ts
|
|
13698
13833
|
var corsHeaders = {
|
|
@@ -13771,7 +13906,7 @@ function createNetcapHandler(options2) {
|
|
|
13771
13906
|
import { cp, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
|
|
13772
13907
|
import { networkInterfaces } from "os";
|
|
13773
13908
|
import { join as join41 } from "path";
|
|
13774
|
-
import
|
|
13909
|
+
import chalk145 from "chalk";
|
|
13775
13910
|
|
|
13776
13911
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
13777
13912
|
import { dirname as dirname21, join as join40 } from "path";
|
|
@@ -13815,7 +13950,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
13815
13950
|
const host = lanIPv4();
|
|
13816
13951
|
if (!host) {
|
|
13817
13952
|
console.log(
|
|
13818
|
-
|
|
13953
|
+
chalk145.yellow("could not determine the WSL IP for the extension")
|
|
13819
13954
|
);
|
|
13820
13955
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
13821
13956
|
return source;
|
|
@@ -13826,7 +13961,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
13826
13961
|
return WSL_WINDOWS_PATH;
|
|
13827
13962
|
} catch {
|
|
13828
13963
|
console.log(
|
|
13829
|
-
|
|
13964
|
+
chalk145.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
13830
13965
|
);
|
|
13831
13966
|
return source;
|
|
13832
13967
|
}
|
|
@@ -13859,30 +13994,30 @@ async function netcap(options2) {
|
|
|
13859
13994
|
let count8 = 0;
|
|
13860
13995
|
const handler = createNetcapHandler({
|
|
13861
13996
|
outPath,
|
|
13862
|
-
onPing: () => console.log(
|
|
13997
|
+
onPing: () => console.log(chalk146.dim("ping from extension")),
|
|
13863
13998
|
onCapture: (entry) => {
|
|
13864
13999
|
count8 += 1;
|
|
13865
14000
|
console.log(
|
|
13866
|
-
|
|
13867
|
-
|
|
14001
|
+
chalk146.green(`captured #${count8}`),
|
|
14002
|
+
chalk146.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
13868
14003
|
);
|
|
13869
14004
|
}
|
|
13870
14005
|
});
|
|
13871
14006
|
const server = createServer2(handler);
|
|
13872
14007
|
server.listen(port, () => {
|
|
13873
14008
|
console.log(
|
|
13874
|
-
|
|
14009
|
+
chalk146.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
13875
14010
|
);
|
|
13876
|
-
console.log(
|
|
14011
|
+
console.log(chalk146.dim(`appending captures to ${outPath}`));
|
|
13877
14012
|
if (filter)
|
|
13878
|
-
console.log(
|
|
13879
|
-
console.log(
|
|
13880
|
-
console.log(
|
|
14013
|
+
console.log(chalk146.dim(`forwarding only URLs matching "${filter}"`));
|
|
14014
|
+
console.log(chalk146.dim(`load the unpacked extension from ${extensionPath}`));
|
|
14015
|
+
console.log(chalk146.dim("press Ctrl-C to stop"));
|
|
13881
14016
|
});
|
|
13882
14017
|
process.on("SIGINT", () => {
|
|
13883
14018
|
server.close();
|
|
13884
14019
|
console.log(
|
|
13885
|
-
|
|
14020
|
+
chalk146.bold(
|
|
13886
14021
|
`
|
|
13887
14022
|
netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
13888
14023
|
)
|
|
@@ -13894,7 +14029,7 @@ netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} t
|
|
|
13894
14029
|
// src/commands/netcap/netcapExtract.ts
|
|
13895
14030
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
13896
14031
|
import { join as join44 } from "path";
|
|
13897
|
-
import
|
|
14032
|
+
import chalk147 from "chalk";
|
|
13898
14033
|
|
|
13899
14034
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
13900
14035
|
import { readFileSync as readFileSync34 } from "fs";
|
|
@@ -14342,8 +14477,8 @@ function netcapExtract(file) {
|
|
|
14342
14477
|
writeFileSync29(outFile, `${JSON.stringify(posts, null, 2)}
|
|
14343
14478
|
`);
|
|
14344
14479
|
console.log(
|
|
14345
|
-
|
|
14346
|
-
|
|
14480
|
+
chalk147.green(`extracted ${posts.length} posts`),
|
|
14481
|
+
chalk147.dim(`-> ${outFile}`)
|
|
14347
14482
|
);
|
|
14348
14483
|
}
|
|
14349
14484
|
|
|
@@ -14364,7 +14499,7 @@ function registerNetcap(program2) {
|
|
|
14364
14499
|
}
|
|
14365
14500
|
|
|
14366
14501
|
// src/commands/news/add/index.ts
|
|
14367
|
-
import
|
|
14502
|
+
import chalk148 from "chalk";
|
|
14368
14503
|
import enquirer8 from "enquirer";
|
|
14369
14504
|
async function add2(url) {
|
|
14370
14505
|
if (!url) {
|
|
@@ -14386,10 +14521,10 @@ async function add2(url) {
|
|
|
14386
14521
|
const { orm } = await getReady();
|
|
14387
14522
|
const added = await addFeed(orm, url);
|
|
14388
14523
|
if (!added) {
|
|
14389
|
-
console.log(
|
|
14524
|
+
console.log(chalk148.yellow("Feed already exists"));
|
|
14390
14525
|
return;
|
|
14391
14526
|
}
|
|
14392
|
-
console.log(
|
|
14527
|
+
console.log(chalk148.green(`Added feed: ${url}`));
|
|
14393
14528
|
}
|
|
14394
14529
|
|
|
14395
14530
|
// src/commands/registerNews.ts
|
|
@@ -14399,7 +14534,7 @@ function registerNews(program2) {
|
|
|
14399
14534
|
}
|
|
14400
14535
|
|
|
14401
14536
|
// src/commands/prompts/printPromptsTable.ts
|
|
14402
|
-
import
|
|
14537
|
+
import chalk149 from "chalk";
|
|
14403
14538
|
function truncate(str, max) {
|
|
14404
14539
|
if (str.length <= max) return str;
|
|
14405
14540
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -14417,14 +14552,14 @@ function printPromptsTable(rows) {
|
|
|
14417
14552
|
"Command".padEnd(commandWidth),
|
|
14418
14553
|
"Repos"
|
|
14419
14554
|
].join(" ");
|
|
14420
|
-
console.log(
|
|
14421
|
-
console.log(
|
|
14555
|
+
console.log(chalk149.dim(header));
|
|
14556
|
+
console.log(chalk149.dim("-".repeat(header.length)));
|
|
14422
14557
|
for (const row of rows) {
|
|
14423
14558
|
const count8 = String(row.count).padStart(countWidth);
|
|
14424
14559
|
const tool = row.tool.padEnd(toolWidth);
|
|
14425
14560
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
14426
14561
|
console.log(
|
|
14427
|
-
`${
|
|
14562
|
+
`${chalk149.yellow(count8)} ${tool} ${command} ${chalk149.dim(row.repos)}`
|
|
14428
14563
|
);
|
|
14429
14564
|
}
|
|
14430
14565
|
}
|
|
@@ -14973,20 +15108,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
14973
15108
|
}
|
|
14974
15109
|
|
|
14975
15110
|
// src/commands/prs/listComments/printComments.ts
|
|
14976
|
-
import
|
|
15111
|
+
import chalk150 from "chalk";
|
|
14977
15112
|
function formatForHuman(comment3) {
|
|
14978
15113
|
if (comment3.type === "review") {
|
|
14979
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
15114
|
+
const stateColor = comment3.state === "APPROVED" ? chalk150.green : comment3.state === "CHANGES_REQUESTED" ? chalk150.red : chalk150.yellow;
|
|
14980
15115
|
return [
|
|
14981
|
-
`${
|
|
15116
|
+
`${chalk150.cyan("Review")} by ${chalk150.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
14982
15117
|
comment3.body,
|
|
14983
15118
|
""
|
|
14984
15119
|
].join("\n");
|
|
14985
15120
|
}
|
|
14986
15121
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
14987
15122
|
return [
|
|
14988
|
-
`${
|
|
14989
|
-
|
|
15123
|
+
`${chalk150.cyan("Line comment")} by ${chalk150.bold(comment3.user)} on ${chalk150.dim(`${comment3.path}${location}`)}`,
|
|
15124
|
+
chalk150.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
14990
15125
|
comment3.body,
|
|
14991
15126
|
""
|
|
14992
15127
|
].join("\n");
|
|
@@ -15076,13 +15211,13 @@ import { execSync as execSync41 } from "child_process";
|
|
|
15076
15211
|
import enquirer9 from "enquirer";
|
|
15077
15212
|
|
|
15078
15213
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
15079
|
-
import
|
|
15214
|
+
import chalk151 from "chalk";
|
|
15080
15215
|
var STATUS_MAP = {
|
|
15081
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
15082
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
15216
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk151.magenta("merged"), date: pr.mergedAt } : null,
|
|
15217
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk151.red("closed"), date: pr.closedAt } : null
|
|
15083
15218
|
};
|
|
15084
15219
|
function defaultStatus(pr) {
|
|
15085
|
-
return { label:
|
|
15220
|
+
return { label: chalk151.green("opened"), date: pr.createdAt };
|
|
15086
15221
|
}
|
|
15087
15222
|
function getStatus2(pr) {
|
|
15088
15223
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -15091,11 +15226,11 @@ function formatDate(dateStr) {
|
|
|
15091
15226
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
15092
15227
|
}
|
|
15093
15228
|
function formatPrHeader(pr, status2) {
|
|
15094
|
-
return `${
|
|
15229
|
+
return `${chalk151.cyan(`#${pr.number}`)} ${pr.title} ${chalk151.dim(`(${pr.author.login},`)} ${status2.label} ${chalk151.dim(`${formatDate(status2.date)})`)}`;
|
|
15095
15230
|
}
|
|
15096
15231
|
function logPrDetails(pr) {
|
|
15097
15232
|
console.log(
|
|
15098
|
-
|
|
15233
|
+
chalk151.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
15099
15234
|
);
|
|
15100
15235
|
console.log();
|
|
15101
15236
|
}
|
|
@@ -15434,10 +15569,10 @@ function registerPrs(program2) {
|
|
|
15434
15569
|
}
|
|
15435
15570
|
|
|
15436
15571
|
// src/commands/ravendb/ravendbAuth.ts
|
|
15437
|
-
import
|
|
15572
|
+
import chalk157 from "chalk";
|
|
15438
15573
|
|
|
15439
15574
|
// src/shared/createConnectionAuth.ts
|
|
15440
|
-
import
|
|
15575
|
+
import chalk152 from "chalk";
|
|
15441
15576
|
function listConnections(connections, format) {
|
|
15442
15577
|
if (connections.length === 0) {
|
|
15443
15578
|
console.log("No connections configured.");
|
|
@@ -15450,7 +15585,7 @@ function listConnections(connections, format) {
|
|
|
15450
15585
|
function removeConnection(connections, name, save) {
|
|
15451
15586
|
const filtered = connections.filter((c) => c.name !== name);
|
|
15452
15587
|
if (filtered.length === connections.length) {
|
|
15453
|
-
console.error(
|
|
15588
|
+
console.error(chalk152.red(`Connection "${name}" not found.`));
|
|
15454
15589
|
process.exit(1);
|
|
15455
15590
|
}
|
|
15456
15591
|
save(filtered);
|
|
@@ -15496,15 +15631,15 @@ function saveConnections(connections) {
|
|
|
15496
15631
|
}
|
|
15497
15632
|
|
|
15498
15633
|
// src/commands/ravendb/promptConnection.ts
|
|
15499
|
-
import
|
|
15634
|
+
import chalk155 from "chalk";
|
|
15500
15635
|
|
|
15501
15636
|
// src/commands/ravendb/selectOpSecret.ts
|
|
15502
|
-
import
|
|
15637
|
+
import chalk154 from "chalk";
|
|
15503
15638
|
import Enquirer2 from "enquirer";
|
|
15504
15639
|
|
|
15505
15640
|
// src/commands/ravendb/searchItems.ts
|
|
15506
15641
|
import { execSync as execSync45 } from "child_process";
|
|
15507
|
-
import
|
|
15642
|
+
import chalk153 from "chalk";
|
|
15508
15643
|
function opExec(args) {
|
|
15509
15644
|
return execSync45(`op ${args}`, {
|
|
15510
15645
|
encoding: "utf8",
|
|
@@ -15517,7 +15652,7 @@ function searchItems(search2) {
|
|
|
15517
15652
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
15518
15653
|
} catch {
|
|
15519
15654
|
console.error(
|
|
15520
|
-
|
|
15655
|
+
chalk153.red(
|
|
15521
15656
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
15522
15657
|
)
|
|
15523
15658
|
);
|
|
@@ -15531,7 +15666,7 @@ function getItemFields(itemId) {
|
|
|
15531
15666
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
15532
15667
|
return item.fields.filter((f) => f.reference && f.label);
|
|
15533
15668
|
} catch {
|
|
15534
|
-
console.error(
|
|
15669
|
+
console.error(chalk153.red("Failed to get item details from 1Password."));
|
|
15535
15670
|
process.exit(1);
|
|
15536
15671
|
}
|
|
15537
15672
|
}
|
|
@@ -15550,7 +15685,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
15550
15685
|
}).run();
|
|
15551
15686
|
const items2 = searchItems(search2);
|
|
15552
15687
|
if (items2.length === 0) {
|
|
15553
|
-
console.error(
|
|
15688
|
+
console.error(chalk154.red(`No items found matching "${search2}".`));
|
|
15554
15689
|
process.exit(1);
|
|
15555
15690
|
}
|
|
15556
15691
|
const itemId = await selectOne(
|
|
@@ -15559,7 +15694,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
15559
15694
|
);
|
|
15560
15695
|
const fields = getItemFields(itemId);
|
|
15561
15696
|
if (fields.length === 0) {
|
|
15562
|
-
console.error(
|
|
15697
|
+
console.error(chalk154.red("No fields with references found on this item."));
|
|
15563
15698
|
process.exit(1);
|
|
15564
15699
|
}
|
|
15565
15700
|
const ref = await selectOne(
|
|
@@ -15573,7 +15708,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
15573
15708
|
async function promptConnection(existingNames) {
|
|
15574
15709
|
const name = await promptInput("name", "Connection name:");
|
|
15575
15710
|
if (existingNames.includes(name)) {
|
|
15576
|
-
console.error(
|
|
15711
|
+
console.error(chalk155.red(`Connection "${name}" already exists.`));
|
|
15577
15712
|
process.exit(1);
|
|
15578
15713
|
}
|
|
15579
15714
|
const url = await promptInput(
|
|
@@ -15582,22 +15717,22 @@ async function promptConnection(existingNames) {
|
|
|
15582
15717
|
);
|
|
15583
15718
|
const database = await promptInput("database", "Database name:");
|
|
15584
15719
|
if (!name || !url || !database) {
|
|
15585
|
-
console.error(
|
|
15720
|
+
console.error(chalk155.red("All fields are required."));
|
|
15586
15721
|
process.exit(1);
|
|
15587
15722
|
}
|
|
15588
15723
|
const apiKeyRef = await selectOpSecret();
|
|
15589
|
-
console.log(
|
|
15724
|
+
console.log(chalk155.dim(`Using: ${apiKeyRef}`));
|
|
15590
15725
|
return { name, url, database, apiKeyRef };
|
|
15591
15726
|
}
|
|
15592
15727
|
|
|
15593
15728
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
15594
|
-
import
|
|
15729
|
+
import chalk156 from "chalk";
|
|
15595
15730
|
function ravendbSetConnection(name) {
|
|
15596
15731
|
const raw = loadGlobalConfigRaw();
|
|
15597
15732
|
const ravendb = raw.ravendb ?? {};
|
|
15598
15733
|
const connections = ravendb.connections ?? [];
|
|
15599
15734
|
if (!connections.some((c) => c.name === name)) {
|
|
15600
|
-
console.error(
|
|
15735
|
+
console.error(chalk156.red(`Connection "${name}" not found.`));
|
|
15601
15736
|
console.error(
|
|
15602
15737
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
15603
15738
|
);
|
|
@@ -15613,16 +15748,16 @@ function ravendbSetConnection(name) {
|
|
|
15613
15748
|
var ravendbAuth = createConnectionAuth({
|
|
15614
15749
|
load: loadConnections,
|
|
15615
15750
|
save: saveConnections,
|
|
15616
|
-
format: (c) => `${
|
|
15751
|
+
format: (c) => `${chalk157.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
15617
15752
|
promptNew: promptConnection,
|
|
15618
15753
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
15619
15754
|
});
|
|
15620
15755
|
|
|
15621
15756
|
// src/commands/ravendb/ravendbCollections.ts
|
|
15622
|
-
import
|
|
15757
|
+
import chalk161 from "chalk";
|
|
15623
15758
|
|
|
15624
15759
|
// src/commands/ravendb/ravenFetch.ts
|
|
15625
|
-
import
|
|
15760
|
+
import chalk159 from "chalk";
|
|
15626
15761
|
|
|
15627
15762
|
// src/commands/ravendb/getAccessToken.ts
|
|
15628
15763
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -15659,10 +15794,10 @@ ${errorText}`
|
|
|
15659
15794
|
|
|
15660
15795
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
15661
15796
|
import { execSync as execSync46 } from "child_process";
|
|
15662
|
-
import
|
|
15797
|
+
import chalk158 from "chalk";
|
|
15663
15798
|
function resolveOpSecret(reference) {
|
|
15664
15799
|
if (!reference.startsWith("op://")) {
|
|
15665
|
-
console.error(
|
|
15800
|
+
console.error(chalk158.red(`Invalid secret reference: must start with op://`));
|
|
15666
15801
|
process.exit(1);
|
|
15667
15802
|
}
|
|
15668
15803
|
try {
|
|
@@ -15672,7 +15807,7 @@ function resolveOpSecret(reference) {
|
|
|
15672
15807
|
}).trim();
|
|
15673
15808
|
} catch {
|
|
15674
15809
|
console.error(
|
|
15675
|
-
|
|
15810
|
+
chalk158.red(
|
|
15676
15811
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
15677
15812
|
)
|
|
15678
15813
|
);
|
|
@@ -15699,7 +15834,7 @@ async function ravenFetch(connection, path57) {
|
|
|
15699
15834
|
if (!response.ok) {
|
|
15700
15835
|
const body = await response.text();
|
|
15701
15836
|
console.error(
|
|
15702
|
-
|
|
15837
|
+
chalk159.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
15703
15838
|
);
|
|
15704
15839
|
console.error(body.substring(0, 500));
|
|
15705
15840
|
process.exit(1);
|
|
@@ -15708,7 +15843,7 @@ async function ravenFetch(connection, path57) {
|
|
|
15708
15843
|
}
|
|
15709
15844
|
|
|
15710
15845
|
// src/commands/ravendb/resolveConnection.ts
|
|
15711
|
-
import
|
|
15846
|
+
import chalk160 from "chalk";
|
|
15712
15847
|
function loadRavendb() {
|
|
15713
15848
|
const raw = loadGlobalConfigRaw();
|
|
15714
15849
|
const ravendb = raw.ravendb;
|
|
@@ -15722,7 +15857,7 @@ function resolveConnection(name) {
|
|
|
15722
15857
|
const connectionName = name ?? defaultConnection;
|
|
15723
15858
|
if (!connectionName) {
|
|
15724
15859
|
console.error(
|
|
15725
|
-
|
|
15860
|
+
chalk160.red(
|
|
15726
15861
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
15727
15862
|
)
|
|
15728
15863
|
);
|
|
@@ -15730,7 +15865,7 @@ function resolveConnection(name) {
|
|
|
15730
15865
|
}
|
|
15731
15866
|
const connection = connections.find((c) => c.name === connectionName);
|
|
15732
15867
|
if (!connection) {
|
|
15733
|
-
console.error(
|
|
15868
|
+
console.error(chalk160.red(`Connection "${connectionName}" not found.`));
|
|
15734
15869
|
console.error(
|
|
15735
15870
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
15736
15871
|
);
|
|
@@ -15761,15 +15896,15 @@ async function ravendbCollections(connectionName) {
|
|
|
15761
15896
|
return;
|
|
15762
15897
|
}
|
|
15763
15898
|
for (const c of collections) {
|
|
15764
|
-
console.log(`${
|
|
15899
|
+
console.log(`${chalk161.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
15765
15900
|
}
|
|
15766
15901
|
}
|
|
15767
15902
|
|
|
15768
15903
|
// src/commands/ravendb/ravendbQuery.ts
|
|
15769
|
-
import
|
|
15904
|
+
import chalk163 from "chalk";
|
|
15770
15905
|
|
|
15771
15906
|
// src/commands/ravendb/fetchAllPages.ts
|
|
15772
|
-
import
|
|
15907
|
+
import chalk162 from "chalk";
|
|
15773
15908
|
|
|
15774
15909
|
// src/commands/ravendb/buildQueryPath.ts
|
|
15775
15910
|
function buildQueryPath(opts) {
|
|
@@ -15807,7 +15942,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
15807
15942
|
allResults.push(...results);
|
|
15808
15943
|
start3 += results.length;
|
|
15809
15944
|
process.stderr.write(
|
|
15810
|
-
`\r${
|
|
15945
|
+
`\r${chalk162.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
15811
15946
|
);
|
|
15812
15947
|
if (start3 >= totalResults) break;
|
|
15813
15948
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -15822,7 +15957,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
15822
15957
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
15823
15958
|
const resolved = resolveArgs(connectionName, collection);
|
|
15824
15959
|
if (!resolved.collection && !options2.query) {
|
|
15825
|
-
console.error(
|
|
15960
|
+
console.error(chalk163.red("Provide a collection name or --query filter."));
|
|
15826
15961
|
process.exit(1);
|
|
15827
15962
|
}
|
|
15828
15963
|
const { collection: col } = resolved;
|
|
@@ -15860,7 +15995,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
15860
15995
|
import * as path28 from "path";
|
|
15861
15996
|
|
|
15862
15997
|
// src/commands/refactor/logViolations.ts
|
|
15863
|
-
import
|
|
15998
|
+
import chalk164 from "chalk";
|
|
15864
15999
|
var DEFAULT_MAX_LINES = 100;
|
|
15865
16000
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
15866
16001
|
if (violations.length === 0) {
|
|
@@ -15869,43 +16004,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
15869
16004
|
}
|
|
15870
16005
|
return;
|
|
15871
16006
|
}
|
|
15872
|
-
console.error(
|
|
16007
|
+
console.error(chalk164.red(`
|
|
15873
16008
|
Refactor check failed:
|
|
15874
16009
|
`));
|
|
15875
|
-
console.error(
|
|
16010
|
+
console.error(chalk164.red(` The following files exceed ${maxLines} lines:
|
|
15876
16011
|
`));
|
|
15877
16012
|
for (const violation of violations) {
|
|
15878
|
-
console.error(
|
|
16013
|
+
console.error(chalk164.red(` ${violation.file} (${violation.lines} lines)`));
|
|
15879
16014
|
}
|
|
15880
16015
|
console.error(
|
|
15881
|
-
|
|
16016
|
+
chalk164.yellow(
|
|
15882
16017
|
`
|
|
15883
16018
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
15884
16019
|
way to refactor it, ignore it with:
|
|
15885
16020
|
`
|
|
15886
16021
|
)
|
|
15887
16022
|
);
|
|
15888
|
-
console.error(
|
|
16023
|
+
console.error(chalk164.gray(` assist refactor ignore <file>
|
|
15889
16024
|
`));
|
|
15890
16025
|
if (process.env.CLAUDECODE) {
|
|
15891
|
-
console.error(
|
|
16026
|
+
console.error(chalk164.cyan(`
|
|
15892
16027
|
## Extracting Code to New Files
|
|
15893
16028
|
`));
|
|
15894
16029
|
console.error(
|
|
15895
|
-
|
|
16030
|
+
chalk164.cyan(
|
|
15896
16031
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
15897
16032
|
`
|
|
15898
16033
|
)
|
|
15899
16034
|
);
|
|
15900
16035
|
console.error(
|
|
15901
|
-
|
|
16036
|
+
chalk164.cyan(
|
|
15902
16037
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
15903
16038
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
15904
16039
|
`
|
|
15905
16040
|
)
|
|
15906
16041
|
);
|
|
15907
16042
|
console.error(
|
|
15908
|
-
|
|
16043
|
+
chalk164.cyan(
|
|
15909
16044
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
15910
16045
|
domains, move it to a common/shared folder.
|
|
15911
16046
|
`
|
|
@@ -16061,7 +16196,7 @@ async function check(pattern2, options2) {
|
|
|
16061
16196
|
|
|
16062
16197
|
// src/commands/refactor/extract/index.ts
|
|
16063
16198
|
import path35 from "path";
|
|
16064
|
-
import
|
|
16199
|
+
import chalk167 from "chalk";
|
|
16065
16200
|
|
|
16066
16201
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
16067
16202
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -16636,23 +16771,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
16636
16771
|
|
|
16637
16772
|
// src/commands/refactor/extract/displayPlan.ts
|
|
16638
16773
|
import path32 from "path";
|
|
16639
|
-
import
|
|
16774
|
+
import chalk165 from "chalk";
|
|
16640
16775
|
function section(title) {
|
|
16641
16776
|
return `
|
|
16642
|
-
${
|
|
16777
|
+
${chalk165.cyan(title)}`;
|
|
16643
16778
|
}
|
|
16644
16779
|
function displayImporters(plan2, cwd) {
|
|
16645
16780
|
if (plan2.importersToUpdate.length === 0) return;
|
|
16646
16781
|
console.log(section("Update importers:"));
|
|
16647
16782
|
for (const imp of plan2.importersToUpdate) {
|
|
16648
16783
|
const rel = path32.relative(cwd, imp.file.getFilePath());
|
|
16649
|
-
console.log(` ${
|
|
16784
|
+
console.log(` ${chalk165.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
16650
16785
|
}
|
|
16651
16786
|
}
|
|
16652
16787
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
16653
|
-
console.log(
|
|
16788
|
+
console.log(chalk165.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
16654
16789
|
`));
|
|
16655
|
-
console.log(` ${
|
|
16790
|
+
console.log(` ${chalk165.cyan("Functions to move:")}`);
|
|
16656
16791
|
for (const name of plan2.extractedNames) {
|
|
16657
16792
|
console.log(` ${name}`);
|
|
16658
16793
|
}
|
|
@@ -16686,7 +16821,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
16686
16821
|
|
|
16687
16822
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
16688
16823
|
import path34 from "path";
|
|
16689
|
-
import
|
|
16824
|
+
import chalk166 from "chalk";
|
|
16690
16825
|
import { Project as Project4 } from "ts-morph";
|
|
16691
16826
|
|
|
16692
16827
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -16746,7 +16881,7 @@ function loadProjectFile(file) {
|
|
|
16746
16881
|
});
|
|
16747
16882
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
16748
16883
|
if (!sourceFile) {
|
|
16749
|
-
console.log(
|
|
16884
|
+
console.log(chalk166.red(`File not found in project: ${file}`));
|
|
16750
16885
|
process.exit(1);
|
|
16751
16886
|
}
|
|
16752
16887
|
return { project, sourceFile };
|
|
@@ -16769,19 +16904,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
16769
16904
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
16770
16905
|
if (options2.apply) {
|
|
16771
16906
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
16772
|
-
console.log(
|
|
16907
|
+
console.log(chalk167.green("\nExtraction complete"));
|
|
16773
16908
|
} else {
|
|
16774
|
-
console.log(
|
|
16909
|
+
console.log(chalk167.dim("\nDry run. Use --apply to execute."));
|
|
16775
16910
|
}
|
|
16776
16911
|
}
|
|
16777
16912
|
|
|
16778
16913
|
// src/commands/refactor/ignore.ts
|
|
16779
16914
|
import fs24 from "fs";
|
|
16780
|
-
import
|
|
16915
|
+
import chalk168 from "chalk";
|
|
16781
16916
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
16782
16917
|
function ignore2(file) {
|
|
16783
16918
|
if (!fs24.existsSync(file)) {
|
|
16784
|
-
console.error(
|
|
16919
|
+
console.error(chalk168.red(`Error: File does not exist: ${file}`));
|
|
16785
16920
|
process.exit(1);
|
|
16786
16921
|
}
|
|
16787
16922
|
const content = fs24.readFileSync(file, "utf8");
|
|
@@ -16797,7 +16932,7 @@ function ignore2(file) {
|
|
|
16797
16932
|
fs24.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
16798
16933
|
}
|
|
16799
16934
|
console.log(
|
|
16800
|
-
|
|
16935
|
+
chalk168.green(
|
|
16801
16936
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
16802
16937
|
)
|
|
16803
16938
|
);
|
|
@@ -16806,12 +16941,12 @@ function ignore2(file) {
|
|
|
16806
16941
|
// src/commands/refactor/rename/index.ts
|
|
16807
16942
|
import fs27 from "fs";
|
|
16808
16943
|
import path40 from "path";
|
|
16809
|
-
import
|
|
16944
|
+
import chalk171 from "chalk";
|
|
16810
16945
|
|
|
16811
16946
|
// src/commands/refactor/rename/applyRename.ts
|
|
16812
16947
|
import fs26 from "fs";
|
|
16813
16948
|
import path37 from "path";
|
|
16814
|
-
import
|
|
16949
|
+
import chalk169 from "chalk";
|
|
16815
16950
|
|
|
16816
16951
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
16817
16952
|
import path36 from "path";
|
|
@@ -16916,13 +17051,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
16916
17051
|
const updatedContents = applyRewrites(rewrites);
|
|
16917
17052
|
for (const [file, content] of updatedContents) {
|
|
16918
17053
|
fs26.writeFileSync(file, content, "utf8");
|
|
16919
|
-
console.log(
|
|
17054
|
+
console.log(chalk169.cyan(` Updated imports in ${path37.relative(cwd, file)}`));
|
|
16920
17055
|
}
|
|
16921
17056
|
const destDir = path37.dirname(destPath);
|
|
16922
17057
|
if (!fs26.existsSync(destDir)) fs26.mkdirSync(destDir, { recursive: true });
|
|
16923
17058
|
fs26.renameSync(sourcePath, destPath);
|
|
16924
17059
|
console.log(
|
|
16925
|
-
|
|
17060
|
+
chalk169.white(
|
|
16926
17061
|
` Moved ${path37.relative(cwd, sourcePath)} \u2192 ${path37.relative(cwd, destPath)}`
|
|
16927
17062
|
)
|
|
16928
17063
|
);
|
|
@@ -17009,16 +17144,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
17009
17144
|
|
|
17010
17145
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
17011
17146
|
import path39 from "path";
|
|
17012
|
-
import
|
|
17147
|
+
import chalk170 from "chalk";
|
|
17013
17148
|
function printRenamePreview(rewrites, cwd) {
|
|
17014
17149
|
for (const rewrite of rewrites) {
|
|
17015
17150
|
console.log(
|
|
17016
|
-
|
|
17151
|
+
chalk170.dim(
|
|
17017
17152
|
` ${path39.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
17018
17153
|
)
|
|
17019
17154
|
);
|
|
17020
17155
|
}
|
|
17021
|
-
console.log(
|
|
17156
|
+
console.log(chalk170.dim("Dry run. Use --apply to execute."));
|
|
17022
17157
|
}
|
|
17023
17158
|
|
|
17024
17159
|
// src/commands/refactor/rename/index.ts
|
|
@@ -17029,20 +17164,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
17029
17164
|
const relSource = path40.relative(cwd, sourcePath);
|
|
17030
17165
|
const relDest = path40.relative(cwd, destPath);
|
|
17031
17166
|
if (!fs27.existsSync(sourcePath)) {
|
|
17032
|
-
console.log(
|
|
17167
|
+
console.log(chalk171.red(`File not found: ${source}`));
|
|
17033
17168
|
process.exit(1);
|
|
17034
17169
|
}
|
|
17035
17170
|
if (destPath !== sourcePath && fs27.existsSync(destPath)) {
|
|
17036
|
-
console.log(
|
|
17171
|
+
console.log(chalk171.red(`Destination already exists: ${destination}`));
|
|
17037
17172
|
process.exit(1);
|
|
17038
17173
|
}
|
|
17039
|
-
console.log(
|
|
17040
|
-
console.log(
|
|
17041
|
-
console.log(
|
|
17174
|
+
console.log(chalk171.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
17175
|
+
console.log(chalk171.dim("Loading project..."));
|
|
17176
|
+
console.log(chalk171.dim("Scanning imports across the project..."));
|
|
17042
17177
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
17043
17178
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
17044
17179
|
console.log(
|
|
17045
|
-
|
|
17180
|
+
chalk171.dim(
|
|
17046
17181
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
17047
17182
|
)
|
|
17048
17183
|
);
|
|
@@ -17051,11 +17186,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
17051
17186
|
return;
|
|
17052
17187
|
}
|
|
17053
17188
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
17054
|
-
console.log(
|
|
17189
|
+
console.log(chalk171.green("Done"));
|
|
17055
17190
|
}
|
|
17056
17191
|
|
|
17057
17192
|
// src/commands/refactor/renameSymbol/index.ts
|
|
17058
|
-
import
|
|
17193
|
+
import chalk172 from "chalk";
|
|
17059
17194
|
|
|
17060
17195
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
17061
17196
|
import { SyntaxKind as SyntaxKind14 } from "ts-morph";
|
|
@@ -17101,33 +17236,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
17101
17236
|
const { project, sourceFile } = loadProjectFile(file);
|
|
17102
17237
|
const symbol = findSymbol(sourceFile, oldName);
|
|
17103
17238
|
if (!symbol) {
|
|
17104
|
-
console.log(
|
|
17239
|
+
console.log(chalk172.red(`Symbol "${oldName}" not found in ${file}`));
|
|
17105
17240
|
process.exit(1);
|
|
17106
17241
|
}
|
|
17107
17242
|
const grouped = groupReferences(symbol, cwd);
|
|
17108
17243
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
17109
17244
|
console.log(
|
|
17110
|
-
|
|
17245
|
+
chalk172.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
17111
17246
|
`)
|
|
17112
17247
|
);
|
|
17113
17248
|
for (const [refFile, lines] of grouped) {
|
|
17114
17249
|
console.log(
|
|
17115
|
-
` ${
|
|
17250
|
+
` ${chalk172.dim(refFile)}: lines ${chalk172.cyan(lines.join(", "))}`
|
|
17116
17251
|
);
|
|
17117
17252
|
}
|
|
17118
17253
|
if (options2.apply) {
|
|
17119
17254
|
symbol.rename(newName);
|
|
17120
17255
|
await project.save();
|
|
17121
|
-
console.log(
|
|
17256
|
+
console.log(chalk172.green(`
|
|
17122
17257
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
17123
17258
|
} else {
|
|
17124
|
-
console.log(
|
|
17259
|
+
console.log(chalk172.dim("\nDry run. Use --apply to execute."));
|
|
17125
17260
|
}
|
|
17126
17261
|
}
|
|
17127
17262
|
|
|
17128
17263
|
// src/commands/refactor/restructure/index.ts
|
|
17129
17264
|
import path48 from "path";
|
|
17130
|
-
import
|
|
17265
|
+
import chalk175 from "chalk";
|
|
17131
17266
|
|
|
17132
17267
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
17133
17268
|
import path42 from "path";
|
|
@@ -17206,50 +17341,50 @@ function clusterFiles(graph) {
|
|
|
17206
17341
|
|
|
17207
17342
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
17208
17343
|
import path44 from "path";
|
|
17209
|
-
import
|
|
17344
|
+
import chalk173 from "chalk";
|
|
17210
17345
|
function relPath(filePath) {
|
|
17211
17346
|
return path44.relative(process.cwd(), filePath);
|
|
17212
17347
|
}
|
|
17213
17348
|
function displayMoves(plan2) {
|
|
17214
17349
|
if (plan2.moves.length === 0) return;
|
|
17215
|
-
console.log(
|
|
17350
|
+
console.log(chalk173.bold("\nFile moves:"));
|
|
17216
17351
|
for (const move2 of plan2.moves) {
|
|
17217
17352
|
console.log(
|
|
17218
|
-
` ${
|
|
17353
|
+
` ${chalk173.red(relPath(move2.from))} \u2192 ${chalk173.green(relPath(move2.to))}`
|
|
17219
17354
|
);
|
|
17220
|
-
console.log(
|
|
17355
|
+
console.log(chalk173.dim(` ${move2.reason}`));
|
|
17221
17356
|
}
|
|
17222
17357
|
}
|
|
17223
17358
|
function displayRewrites(rewrites) {
|
|
17224
17359
|
if (rewrites.length === 0) return;
|
|
17225
17360
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
17226
|
-
console.log(
|
|
17361
|
+
console.log(chalk173.bold(`
|
|
17227
17362
|
Import rewrites (${affectedFiles.size} files):`));
|
|
17228
17363
|
for (const file of affectedFiles) {
|
|
17229
|
-
console.log(` ${
|
|
17364
|
+
console.log(` ${chalk173.cyan(relPath(file))}:`);
|
|
17230
17365
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
17231
17366
|
(r) => r.file === file
|
|
17232
17367
|
)) {
|
|
17233
17368
|
console.log(
|
|
17234
|
-
` ${
|
|
17369
|
+
` ${chalk173.red(`"${oldSpecifier}"`)} \u2192 ${chalk173.green(`"${newSpecifier}"`)}`
|
|
17235
17370
|
);
|
|
17236
17371
|
}
|
|
17237
17372
|
}
|
|
17238
17373
|
}
|
|
17239
17374
|
function displayPlan2(plan2) {
|
|
17240
17375
|
if (plan2.warnings.length > 0) {
|
|
17241
|
-
console.log(
|
|
17242
|
-
for (const w of plan2.warnings) console.log(
|
|
17376
|
+
console.log(chalk173.yellow("\nWarnings:"));
|
|
17377
|
+
for (const w of plan2.warnings) console.log(chalk173.yellow(` ${w}`));
|
|
17243
17378
|
}
|
|
17244
17379
|
if (plan2.newDirectories.length > 0) {
|
|
17245
|
-
console.log(
|
|
17380
|
+
console.log(chalk173.bold("\nNew directories:"));
|
|
17246
17381
|
for (const dir of plan2.newDirectories)
|
|
17247
|
-
console.log(
|
|
17382
|
+
console.log(chalk173.green(` ${dir}/`));
|
|
17248
17383
|
}
|
|
17249
17384
|
displayMoves(plan2);
|
|
17250
17385
|
displayRewrites(plan2.rewrites);
|
|
17251
17386
|
console.log(
|
|
17252
|
-
|
|
17387
|
+
chalk173.dim(
|
|
17253
17388
|
`
|
|
17254
17389
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
17255
17390
|
)
|
|
@@ -17259,18 +17394,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
17259
17394
|
// src/commands/refactor/restructure/executePlan.ts
|
|
17260
17395
|
import fs28 from "fs";
|
|
17261
17396
|
import path45 from "path";
|
|
17262
|
-
import
|
|
17397
|
+
import chalk174 from "chalk";
|
|
17263
17398
|
function executePlan(plan2) {
|
|
17264
17399
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
17265
17400
|
for (const [file, content] of updatedContents) {
|
|
17266
17401
|
fs28.writeFileSync(file, content, "utf8");
|
|
17267
17402
|
console.log(
|
|
17268
|
-
|
|
17403
|
+
chalk174.cyan(` Rewrote imports in ${path45.relative(process.cwd(), file)}`)
|
|
17269
17404
|
);
|
|
17270
17405
|
}
|
|
17271
17406
|
for (const dir of plan2.newDirectories) {
|
|
17272
17407
|
fs28.mkdirSync(dir, { recursive: true });
|
|
17273
|
-
console.log(
|
|
17408
|
+
console.log(chalk174.green(` Created ${path45.relative(process.cwd(), dir)}/`));
|
|
17274
17409
|
}
|
|
17275
17410
|
for (const move2 of plan2.moves) {
|
|
17276
17411
|
const targetDir = path45.dirname(move2.to);
|
|
@@ -17279,7 +17414,7 @@ function executePlan(plan2) {
|
|
|
17279
17414
|
}
|
|
17280
17415
|
fs28.renameSync(move2.from, move2.to);
|
|
17281
17416
|
console.log(
|
|
17282
|
-
|
|
17417
|
+
chalk174.white(
|
|
17283
17418
|
` Moved ${path45.relative(process.cwd(), move2.from)} \u2192 ${path45.relative(process.cwd(), move2.to)}`
|
|
17284
17419
|
)
|
|
17285
17420
|
);
|
|
@@ -17294,7 +17429,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
17294
17429
|
if (entries.length === 0) {
|
|
17295
17430
|
fs28.rmdirSync(dir);
|
|
17296
17431
|
console.log(
|
|
17297
|
-
|
|
17432
|
+
chalk174.dim(
|
|
17298
17433
|
` Removed empty directory ${path45.relative(process.cwd(), dir)}`
|
|
17299
17434
|
)
|
|
17300
17435
|
);
|
|
@@ -17427,22 +17562,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
17427
17562
|
const targetPattern = pattern2 ?? "src";
|
|
17428
17563
|
const files = findSourceFiles2(targetPattern);
|
|
17429
17564
|
if (files.length === 0) {
|
|
17430
|
-
console.log(
|
|
17565
|
+
console.log(chalk175.yellow("No files found matching pattern"));
|
|
17431
17566
|
return;
|
|
17432
17567
|
}
|
|
17433
17568
|
const tsConfigPath = path48.resolve("tsconfig.json");
|
|
17434
17569
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
17435
17570
|
if (plan2.moves.length === 0) {
|
|
17436
|
-
console.log(
|
|
17571
|
+
console.log(chalk175.green("No restructuring needed"));
|
|
17437
17572
|
return;
|
|
17438
17573
|
}
|
|
17439
17574
|
displayPlan2(plan2);
|
|
17440
17575
|
if (options2.apply) {
|
|
17441
|
-
console.log(
|
|
17576
|
+
console.log(chalk175.bold("\nApplying changes..."));
|
|
17442
17577
|
executePlan(plan2);
|
|
17443
|
-
console.log(
|
|
17578
|
+
console.log(chalk175.green("\nRestructuring complete"));
|
|
17444
17579
|
} else {
|
|
17445
|
-
console.log(
|
|
17580
|
+
console.log(chalk175.dim("\nDry run. Use --apply to execute."));
|
|
17446
17581
|
}
|
|
17447
17582
|
}
|
|
17448
17583
|
|
|
@@ -18015,18 +18150,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
18015
18150
|
}
|
|
18016
18151
|
|
|
18017
18152
|
// src/commands/review/warnOutOfDiff.ts
|
|
18018
|
-
import
|
|
18153
|
+
import chalk176 from "chalk";
|
|
18019
18154
|
function warnOutOfDiff(outOfDiff) {
|
|
18020
18155
|
if (outOfDiff.length === 0) return;
|
|
18021
18156
|
console.warn(
|
|
18022
|
-
|
|
18157
|
+
chalk176.yellow(
|
|
18023
18158
|
`Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
|
|
18024
18159
|
)
|
|
18025
18160
|
);
|
|
18026
18161
|
for (const finding of outOfDiff) {
|
|
18027
18162
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
18028
18163
|
console.warn(
|
|
18029
|
-
` ${
|
|
18164
|
+
` ${chalk176.yellow("\xB7")} ${finding.title} ${chalk176.dim(
|
|
18030
18165
|
`(${finding.file}:${range})`
|
|
18031
18166
|
)}`
|
|
18032
18167
|
);
|
|
@@ -18045,18 +18180,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
18045
18180
|
}
|
|
18046
18181
|
|
|
18047
18182
|
// src/commands/review/warnUnlocated.ts
|
|
18048
|
-
import
|
|
18183
|
+
import chalk177 from "chalk";
|
|
18049
18184
|
function warnUnlocated(unlocated) {
|
|
18050
18185
|
if (unlocated.length === 0) return;
|
|
18051
18186
|
console.warn(
|
|
18052
|
-
|
|
18187
|
+
chalk177.yellow(
|
|
18053
18188
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
18054
18189
|
)
|
|
18055
18190
|
);
|
|
18056
18191
|
for (const finding of unlocated) {
|
|
18057
|
-
const where = finding.location ||
|
|
18192
|
+
const where = finding.location || chalk177.dim("missing");
|
|
18058
18193
|
console.warn(
|
|
18059
|
-
` ${
|
|
18194
|
+
` ${chalk177.yellow("\xB7")} ${finding.title} ${chalk177.dim(`(${where})`)}`
|
|
18060
18195
|
);
|
|
18061
18196
|
}
|
|
18062
18197
|
}
|
|
@@ -19228,7 +19363,7 @@ function registerReview(program2) {
|
|
|
19228
19363
|
}
|
|
19229
19364
|
|
|
19230
19365
|
// src/commands/seq/seqAuth.ts
|
|
19231
|
-
import
|
|
19366
|
+
import chalk179 from "chalk";
|
|
19232
19367
|
|
|
19233
19368
|
// src/commands/seq/loadConnections.ts
|
|
19234
19369
|
function loadConnections2() {
|
|
@@ -19257,10 +19392,10 @@ function setDefaultConnection(name) {
|
|
|
19257
19392
|
}
|
|
19258
19393
|
|
|
19259
19394
|
// src/shared/assertUniqueName.ts
|
|
19260
|
-
import
|
|
19395
|
+
import chalk178 from "chalk";
|
|
19261
19396
|
function assertUniqueName(existingNames, name) {
|
|
19262
19397
|
if (existingNames.includes(name)) {
|
|
19263
|
-
console.error(
|
|
19398
|
+
console.error(chalk178.red(`Connection "${name}" already exists.`));
|
|
19264
19399
|
process.exit(1);
|
|
19265
19400
|
}
|
|
19266
19401
|
}
|
|
@@ -19278,16 +19413,16 @@ async function promptConnection2(existingNames) {
|
|
|
19278
19413
|
var seqAuth = createConnectionAuth({
|
|
19279
19414
|
load: loadConnections2,
|
|
19280
19415
|
save: saveConnections2,
|
|
19281
|
-
format: (c) => `${
|
|
19416
|
+
format: (c) => `${chalk179.bold(c.name)} ${c.url}`,
|
|
19282
19417
|
promptNew: promptConnection2,
|
|
19283
19418
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
19284
19419
|
});
|
|
19285
19420
|
|
|
19286
19421
|
// src/commands/seq/seqQuery.ts
|
|
19287
|
-
import
|
|
19422
|
+
import chalk183 from "chalk";
|
|
19288
19423
|
|
|
19289
19424
|
// src/commands/seq/fetchSeq.ts
|
|
19290
|
-
import
|
|
19425
|
+
import chalk180 from "chalk";
|
|
19291
19426
|
async function fetchSeq(conn, path57, params) {
|
|
19292
19427
|
const url = `${conn.url}${path57}?${params}`;
|
|
19293
19428
|
const response = await fetch(url, {
|
|
@@ -19298,7 +19433,7 @@ async function fetchSeq(conn, path57, params) {
|
|
|
19298
19433
|
});
|
|
19299
19434
|
if (!response.ok) {
|
|
19300
19435
|
const body = await response.text();
|
|
19301
|
-
console.error(
|
|
19436
|
+
console.error(chalk180.red(`Seq returned ${response.status}: ${body}`));
|
|
19302
19437
|
process.exit(1);
|
|
19303
19438
|
}
|
|
19304
19439
|
return response;
|
|
@@ -19357,23 +19492,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
19357
19492
|
}
|
|
19358
19493
|
|
|
19359
19494
|
// src/commands/seq/formatEvent.ts
|
|
19360
|
-
import
|
|
19495
|
+
import chalk181 from "chalk";
|
|
19361
19496
|
function levelColor(level) {
|
|
19362
19497
|
switch (level) {
|
|
19363
19498
|
case "Fatal":
|
|
19364
|
-
return
|
|
19499
|
+
return chalk181.bgRed.white;
|
|
19365
19500
|
case "Error":
|
|
19366
|
-
return
|
|
19501
|
+
return chalk181.red;
|
|
19367
19502
|
case "Warning":
|
|
19368
|
-
return
|
|
19503
|
+
return chalk181.yellow;
|
|
19369
19504
|
case "Information":
|
|
19370
|
-
return
|
|
19505
|
+
return chalk181.cyan;
|
|
19371
19506
|
case "Debug":
|
|
19372
|
-
return
|
|
19507
|
+
return chalk181.gray;
|
|
19373
19508
|
case "Verbose":
|
|
19374
|
-
return
|
|
19509
|
+
return chalk181.dim;
|
|
19375
19510
|
default:
|
|
19376
|
-
return
|
|
19511
|
+
return chalk181.white;
|
|
19377
19512
|
}
|
|
19378
19513
|
}
|
|
19379
19514
|
function levelAbbrev(level) {
|
|
@@ -19414,12 +19549,12 @@ function formatTimestamp(iso) {
|
|
|
19414
19549
|
function formatEvent(event) {
|
|
19415
19550
|
const color = levelColor(event.Level);
|
|
19416
19551
|
const abbrev = levelAbbrev(event.Level);
|
|
19417
|
-
const ts8 =
|
|
19552
|
+
const ts8 = chalk181.dim(formatTimestamp(event.Timestamp));
|
|
19418
19553
|
const msg = renderMessage(event);
|
|
19419
19554
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
19420
19555
|
if (event.Exception) {
|
|
19421
19556
|
for (const line of event.Exception.split("\n")) {
|
|
19422
|
-
lines.push(
|
|
19557
|
+
lines.push(chalk181.red(` ${line}`));
|
|
19423
19558
|
}
|
|
19424
19559
|
}
|
|
19425
19560
|
return lines.join("\n");
|
|
@@ -19452,11 +19587,11 @@ function rejectTimestampFilter(filter) {
|
|
|
19452
19587
|
}
|
|
19453
19588
|
|
|
19454
19589
|
// src/shared/resolveNamedConnection.ts
|
|
19455
|
-
import
|
|
19590
|
+
import chalk182 from "chalk";
|
|
19456
19591
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
19457
19592
|
if (connections.length === 0) {
|
|
19458
19593
|
console.error(
|
|
19459
|
-
|
|
19594
|
+
chalk182.red(
|
|
19460
19595
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
19461
19596
|
)
|
|
19462
19597
|
);
|
|
@@ -19465,7 +19600,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
19465
19600
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
19466
19601
|
const connection = connections.find((c) => c.name === target);
|
|
19467
19602
|
if (!connection) {
|
|
19468
|
-
console.error(
|
|
19603
|
+
console.error(chalk182.red(`${kind} connection "${target}" not found.`));
|
|
19469
19604
|
process.exit(1);
|
|
19470
19605
|
}
|
|
19471
19606
|
return connection;
|
|
@@ -19494,7 +19629,7 @@ async function seqQuery(filter, options2) {
|
|
|
19494
19629
|
new URLSearchParams({ filter, count: String(count8) })
|
|
19495
19630
|
);
|
|
19496
19631
|
if (events.length === 0) {
|
|
19497
|
-
console.log(
|
|
19632
|
+
console.log(chalk183.yellow("No events found."));
|
|
19498
19633
|
return;
|
|
19499
19634
|
}
|
|
19500
19635
|
if (options2.json) {
|
|
@@ -19505,11 +19640,11 @@ async function seqQuery(filter, options2) {
|
|
|
19505
19640
|
for (const event of chronological) {
|
|
19506
19641
|
console.log(formatEvent(event));
|
|
19507
19642
|
}
|
|
19508
|
-
console.log(
|
|
19643
|
+
console.log(chalk183.dim(`
|
|
19509
19644
|
${events.length} events`));
|
|
19510
19645
|
if (events.length >= count8) {
|
|
19511
19646
|
console.log(
|
|
19512
|
-
|
|
19647
|
+
chalk183.yellow(
|
|
19513
19648
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
19514
19649
|
)
|
|
19515
19650
|
);
|
|
@@ -19517,10 +19652,10 @@ ${events.length} events`));
|
|
|
19517
19652
|
}
|
|
19518
19653
|
|
|
19519
19654
|
// src/shared/setNamedDefaultConnection.ts
|
|
19520
|
-
import
|
|
19655
|
+
import chalk184 from "chalk";
|
|
19521
19656
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
19522
19657
|
if (!connections.find((c) => c.name === name)) {
|
|
19523
|
-
console.error(
|
|
19658
|
+
console.error(chalk184.red(`Connection "${name}" not found.`));
|
|
19524
19659
|
process.exit(1);
|
|
19525
19660
|
}
|
|
19526
19661
|
setDefault(name);
|
|
@@ -19568,7 +19703,7 @@ function registerSignal(program2) {
|
|
|
19568
19703
|
}
|
|
19569
19704
|
|
|
19570
19705
|
// src/commands/sql/sqlAuth.ts
|
|
19571
|
-
import
|
|
19706
|
+
import chalk186 from "chalk";
|
|
19572
19707
|
|
|
19573
19708
|
// src/commands/sql/loadConnections.ts
|
|
19574
19709
|
function loadConnections3() {
|
|
@@ -19597,7 +19732,7 @@ function setDefaultConnection2(name) {
|
|
|
19597
19732
|
}
|
|
19598
19733
|
|
|
19599
19734
|
// src/commands/sql/promptConnection.ts
|
|
19600
|
-
import
|
|
19735
|
+
import chalk185 from "chalk";
|
|
19601
19736
|
async function promptConnection3(existingNames) {
|
|
19602
19737
|
const name = await promptInput("name", "Connection name:", "default");
|
|
19603
19738
|
assertUniqueName(existingNames, name);
|
|
@@ -19605,7 +19740,7 @@ async function promptConnection3(existingNames) {
|
|
|
19605
19740
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
19606
19741
|
const port = Number.parseInt(portStr, 10);
|
|
19607
19742
|
if (!Number.isFinite(port)) {
|
|
19608
|
-
console.error(
|
|
19743
|
+
console.error(chalk185.red(`Invalid port "${portStr}".`));
|
|
19609
19744
|
process.exit(1);
|
|
19610
19745
|
}
|
|
19611
19746
|
const user = await promptInput("user", "User:");
|
|
@@ -19618,13 +19753,13 @@ async function promptConnection3(existingNames) {
|
|
|
19618
19753
|
var sqlAuth = createConnectionAuth({
|
|
19619
19754
|
load: loadConnections3,
|
|
19620
19755
|
save: saveConnections3,
|
|
19621
|
-
format: (c) => `${
|
|
19756
|
+
format: (c) => `${chalk186.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
19622
19757
|
promptNew: promptConnection3,
|
|
19623
19758
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
19624
19759
|
});
|
|
19625
19760
|
|
|
19626
19761
|
// src/commands/sql/printTable.ts
|
|
19627
|
-
import
|
|
19762
|
+
import chalk187 from "chalk";
|
|
19628
19763
|
function formatCell(value) {
|
|
19629
19764
|
if (value === null || value === void 0) return "";
|
|
19630
19765
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -19633,7 +19768,7 @@ function formatCell(value) {
|
|
|
19633
19768
|
}
|
|
19634
19769
|
function printTable(rows) {
|
|
19635
19770
|
if (rows.length === 0) {
|
|
19636
|
-
console.log(
|
|
19771
|
+
console.log(chalk187.yellow("(no rows)"));
|
|
19637
19772
|
return;
|
|
19638
19773
|
}
|
|
19639
19774
|
const columns = Object.keys(rows[0]);
|
|
@@ -19641,13 +19776,13 @@ function printTable(rows) {
|
|
|
19641
19776
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
19642
19777
|
);
|
|
19643
19778
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
19644
|
-
console.log(
|
|
19645
|
-
console.log(
|
|
19779
|
+
console.log(chalk187.dim(header));
|
|
19780
|
+
console.log(chalk187.dim("-".repeat(header.length)));
|
|
19646
19781
|
for (const row of rows) {
|
|
19647
19782
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
19648
19783
|
console.log(line);
|
|
19649
19784
|
}
|
|
19650
|
-
console.log(
|
|
19785
|
+
console.log(chalk187.dim(`
|
|
19651
19786
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
19652
19787
|
}
|
|
19653
19788
|
|
|
@@ -19707,7 +19842,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
19707
19842
|
}
|
|
19708
19843
|
|
|
19709
19844
|
// src/commands/sql/sqlMutate.ts
|
|
19710
|
-
import
|
|
19845
|
+
import chalk188 from "chalk";
|
|
19711
19846
|
|
|
19712
19847
|
// src/commands/sql/isMutation.ts
|
|
19713
19848
|
var MUTATION_KEYWORDS = [
|
|
@@ -19741,7 +19876,7 @@ function isMutation(sql9) {
|
|
|
19741
19876
|
async function sqlMutate(query, connectionName) {
|
|
19742
19877
|
if (!isMutation(query)) {
|
|
19743
19878
|
console.error(
|
|
19744
|
-
|
|
19879
|
+
chalk188.red(
|
|
19745
19880
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
19746
19881
|
)
|
|
19747
19882
|
);
|
|
@@ -19751,18 +19886,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
19751
19886
|
const pool = await sqlConnect(conn);
|
|
19752
19887
|
try {
|
|
19753
19888
|
const result = await pool.request().query(query);
|
|
19754
|
-
console.log(
|
|
19889
|
+
console.log(chalk188.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
19755
19890
|
} finally {
|
|
19756
19891
|
await pool.close();
|
|
19757
19892
|
}
|
|
19758
19893
|
}
|
|
19759
19894
|
|
|
19760
19895
|
// src/commands/sql/sqlQuery.ts
|
|
19761
|
-
import
|
|
19896
|
+
import chalk189 from "chalk";
|
|
19762
19897
|
async function sqlQuery(query, connectionName) {
|
|
19763
19898
|
if (isMutation(query)) {
|
|
19764
19899
|
console.error(
|
|
19765
|
-
|
|
19900
|
+
chalk189.red(
|
|
19766
19901
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
19767
19902
|
)
|
|
19768
19903
|
);
|
|
@@ -19777,7 +19912,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
19777
19912
|
printTable(rows);
|
|
19778
19913
|
} else {
|
|
19779
19914
|
console.log(
|
|
19780
|
-
|
|
19915
|
+
chalk189.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
19781
19916
|
);
|
|
19782
19917
|
}
|
|
19783
19918
|
} finally {
|
|
@@ -20474,7 +20609,7 @@ function registerVoice(program2) {
|
|
|
20474
20609
|
|
|
20475
20610
|
// src/commands/roam/auth.ts
|
|
20476
20611
|
import { randomBytes } from "crypto";
|
|
20477
|
-
import
|
|
20612
|
+
import chalk190 from "chalk";
|
|
20478
20613
|
|
|
20479
20614
|
// src/commands/roam/waitForCallback.ts
|
|
20480
20615
|
import { createServer as createServer3 } from "http";
|
|
@@ -20605,13 +20740,13 @@ async function auth() {
|
|
|
20605
20740
|
saveGlobalConfig(config);
|
|
20606
20741
|
const state = randomBytes(16).toString("hex");
|
|
20607
20742
|
console.log(
|
|
20608
|
-
|
|
20743
|
+
chalk190.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
20609
20744
|
);
|
|
20610
|
-
console.log(
|
|
20611
|
-
console.log(
|
|
20612
|
-
console.log(
|
|
20745
|
+
console.log(chalk190.white("http://localhost:14523/callback\n"));
|
|
20746
|
+
console.log(chalk190.blue("Opening browser for authorization..."));
|
|
20747
|
+
console.log(chalk190.dim("Waiting for authorization callback..."));
|
|
20613
20748
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
20614
|
-
console.log(
|
|
20749
|
+
console.log(chalk190.dim("Exchanging code for tokens..."));
|
|
20615
20750
|
const tokens = await exchangeToken({
|
|
20616
20751
|
code,
|
|
20617
20752
|
clientId,
|
|
@@ -20627,7 +20762,7 @@ async function auth() {
|
|
|
20627
20762
|
};
|
|
20628
20763
|
saveGlobalConfig(config);
|
|
20629
20764
|
console.log(
|
|
20630
|
-
|
|
20765
|
+
chalk190.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
20631
20766
|
);
|
|
20632
20767
|
}
|
|
20633
20768
|
|
|
@@ -21079,7 +21214,7 @@ import { execSync as execSync54 } from "child_process";
|
|
|
21079
21214
|
import { existsSync as existsSync51, mkdirSync as mkdirSync22, unlinkSync as unlinkSync19, writeFileSync as writeFileSync39 } from "fs";
|
|
21080
21215
|
import { tmpdir as tmpdir7 } from "os";
|
|
21081
21216
|
import { join as join61, resolve as resolve15 } from "path";
|
|
21082
|
-
import
|
|
21217
|
+
import chalk191 from "chalk";
|
|
21083
21218
|
|
|
21084
21219
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
21085
21220
|
var captureWindowPs1 = `
|
|
@@ -21230,13 +21365,13 @@ function screenshot(processName) {
|
|
|
21230
21365
|
const config = loadConfig();
|
|
21231
21366
|
const outputDir = resolve15(config.screenshot.outputDir);
|
|
21232
21367
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
21233
|
-
console.log(
|
|
21368
|
+
console.log(chalk191.gray(`Capturing window for process "${processName}" ...`));
|
|
21234
21369
|
try {
|
|
21235
21370
|
runPowerShellScript(processName, outputPath);
|
|
21236
|
-
console.log(
|
|
21371
|
+
console.log(chalk191.green(`Screenshot saved: ${outputPath}`));
|
|
21237
21372
|
} catch (error) {
|
|
21238
21373
|
const msg = error instanceof Error ? error.message : String(error);
|
|
21239
|
-
console.error(
|
|
21374
|
+
console.error(chalk191.red(`Failed to capture screenshot: ${msg}`));
|
|
21240
21375
|
process.exit(1);
|
|
21241
21376
|
}
|
|
21242
21377
|
}
|
|
@@ -22045,10 +22180,10 @@ function applyReviewPause(session, activity2) {
|
|
|
22045
22180
|
}
|
|
22046
22181
|
|
|
22047
22182
|
// src/shared/db/getPhaseActiveMs.ts
|
|
22048
|
-
import { and as
|
|
22183
|
+
import { and as and19, eq as eq38 } from "drizzle-orm";
|
|
22049
22184
|
async function getPhaseActiveMs(db, itemId, phaseIdx) {
|
|
22050
22185
|
const [row] = await db.select({ activeMs: phaseUsage.activeMs }).from(phaseUsage).where(
|
|
22051
|
-
|
|
22186
|
+
and19(eq38(phaseUsage.itemId, itemId), eq38(phaseUsage.phaseIdx, phaseIdx))
|
|
22052
22187
|
);
|
|
22053
22188
|
return row?.activeMs ?? 0;
|
|
22054
22189
|
}
|
|
@@ -23897,7 +24032,7 @@ function registerDaemon(program2) {
|
|
|
23897
24032
|
|
|
23898
24033
|
// src/commands/sessions/summarise/index.ts
|
|
23899
24034
|
import * as fs36 from "fs";
|
|
23900
|
-
import
|
|
24035
|
+
import chalk192 from "chalk";
|
|
23901
24036
|
|
|
23902
24037
|
// src/commands/sessions/summarise/shared.ts
|
|
23903
24038
|
import * as fs34 from "fs";
|
|
@@ -24051,22 +24186,22 @@ ${firstMessage}`);
|
|
|
24051
24186
|
async function summarise2(options2) {
|
|
24052
24187
|
const files = await discoverSessionFiles();
|
|
24053
24188
|
if (files.length === 0) {
|
|
24054
|
-
console.log(
|
|
24189
|
+
console.log(chalk192.yellow("No sessions found."));
|
|
24055
24190
|
return;
|
|
24056
24191
|
}
|
|
24057
24192
|
const toProcess = selectCandidates(files, options2);
|
|
24058
24193
|
if (toProcess.length === 0) {
|
|
24059
|
-
console.log(
|
|
24194
|
+
console.log(chalk192.green("All sessions already summarised."));
|
|
24060
24195
|
return;
|
|
24061
24196
|
}
|
|
24062
24197
|
console.log(
|
|
24063
|
-
|
|
24198
|
+
chalk192.cyan(
|
|
24064
24199
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
24065
24200
|
)
|
|
24066
24201
|
);
|
|
24067
24202
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
24068
24203
|
console.log(
|
|
24069
|
-
|
|
24204
|
+
chalk192.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk192.yellow(`, ${failed2} skipped`) : "")
|
|
24070
24205
|
);
|
|
24071
24206
|
}
|
|
24072
24207
|
function selectCandidates(files, options2) {
|
|
@@ -24086,16 +24221,16 @@ function processSessions(files) {
|
|
|
24086
24221
|
let failed2 = 0;
|
|
24087
24222
|
for (let i = 0; i < files.length; i++) {
|
|
24088
24223
|
const file = files[i];
|
|
24089
|
-
process.stdout.write(
|
|
24224
|
+
process.stdout.write(chalk192.dim(` [${i + 1}/${files.length}] `));
|
|
24090
24225
|
const summary = summariseSession(file);
|
|
24091
24226
|
if (summary) {
|
|
24092
24227
|
writeSummary(file, summary);
|
|
24093
24228
|
succeeded++;
|
|
24094
|
-
process.stdout.write(`${
|
|
24229
|
+
process.stdout.write(`${chalk192.green("\u2713")} ${summary}
|
|
24095
24230
|
`);
|
|
24096
24231
|
} else {
|
|
24097
24232
|
failed2++;
|
|
24098
|
-
process.stdout.write(` ${
|
|
24233
|
+
process.stdout.write(` ${chalk192.yellow("skip")}
|
|
24099
24234
|
`);
|
|
24100
24235
|
}
|
|
24101
24236
|
}
|
|
@@ -24113,10 +24248,10 @@ function registerSessions(program2) {
|
|
|
24113
24248
|
}
|
|
24114
24249
|
|
|
24115
24250
|
// src/commands/statusLine.ts
|
|
24116
|
-
import
|
|
24251
|
+
import chalk194 from "chalk";
|
|
24117
24252
|
|
|
24118
24253
|
// src/commands/buildLimitsSegment.ts
|
|
24119
|
-
import
|
|
24254
|
+
import chalk193 from "chalk";
|
|
24120
24255
|
|
|
24121
24256
|
// src/shared/rateLimitLevel.ts
|
|
24122
24257
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -24147,9 +24282,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
24147
24282
|
|
|
24148
24283
|
// src/commands/buildLimitsSegment.ts
|
|
24149
24284
|
var LEVEL_COLOR = {
|
|
24150
|
-
ok:
|
|
24151
|
-
warn:
|
|
24152
|
-
over:
|
|
24285
|
+
ok: chalk193.green,
|
|
24286
|
+
warn: chalk193.yellow,
|
|
24287
|
+
over: chalk193.red
|
|
24153
24288
|
};
|
|
24154
24289
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
24155
24290
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -24240,14 +24375,14 @@ async function relayUsage(claudeSessionId, totalIn, totalOut) {
|
|
|
24240
24375
|
}
|
|
24241
24376
|
|
|
24242
24377
|
// src/commands/statusLine.ts
|
|
24243
|
-
|
|
24378
|
+
chalk194.level = 3;
|
|
24244
24379
|
function formatNumber(num) {
|
|
24245
24380
|
return num.toLocaleString("en-US");
|
|
24246
24381
|
}
|
|
24247
24382
|
function colorizePercent(pct) {
|
|
24248
24383
|
const label2 = `${Math.round(pct)}%`;
|
|
24249
|
-
if (pct > 80) return
|
|
24250
|
-
if (pct > 40) return
|
|
24384
|
+
if (pct > 80) return chalk194.red(label2);
|
|
24385
|
+
if (pct > 40) return chalk194.yellow(label2);
|
|
24251
24386
|
return label2;
|
|
24252
24387
|
}
|
|
24253
24388
|
async function statusLine() {
|
|
@@ -24258,7 +24393,7 @@ async function statusLine() {
|
|
|
24258
24393
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
24259
24394
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
24260
24395
|
const branch2 = dir ? readGitBranch(windowsCwdToWslPath(dir)) : null;
|
|
24261
|
-
const branchSegment = branch2 ? `\u{
|
|
24396
|
+
const branchSegment = branch2 ? `\u{1F33F} ${chalk194.cyan(branch2)} | ` : "";
|
|
24262
24397
|
console.log(
|
|
24263
24398
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalOut)} \u2191 : ${formatNumber(totalIn)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
24264
24399
|
);
|
|
@@ -24275,7 +24410,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
24275
24410
|
// src/commands/sync/syncClaudeMd.ts
|
|
24276
24411
|
import * as fs37 from "fs";
|
|
24277
24412
|
import * as path53 from "path";
|
|
24278
|
-
import
|
|
24413
|
+
import chalk195 from "chalk";
|
|
24279
24414
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
24280
24415
|
const source = path53.join(claudeDir, "CLAUDE.md");
|
|
24281
24416
|
const target = path53.join(targetBase, "CLAUDE.md");
|
|
@@ -24284,12 +24419,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
24284
24419
|
const targetContent = fs37.readFileSync(target, "utf8");
|
|
24285
24420
|
if (sourceContent !== targetContent) {
|
|
24286
24421
|
console.log(
|
|
24287
|
-
|
|
24422
|
+
chalk195.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
24288
24423
|
);
|
|
24289
24424
|
console.log();
|
|
24290
24425
|
printDiff(targetContent, sourceContent);
|
|
24291
24426
|
const confirm = options2?.yes || await promptConfirm(
|
|
24292
|
-
|
|
24427
|
+
chalk195.red("Overwrite existing CLAUDE.md?"),
|
|
24293
24428
|
false
|
|
24294
24429
|
);
|
|
24295
24430
|
if (!confirm) {
|
|
@@ -24305,7 +24440,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
24305
24440
|
// src/commands/sync/syncSettings.ts
|
|
24306
24441
|
import * as fs38 from "fs";
|
|
24307
24442
|
import * as path54 from "path";
|
|
24308
|
-
import
|
|
24443
|
+
import chalk196 from "chalk";
|
|
24309
24444
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
24310
24445
|
const source = path54.join(claudeDir, "settings.json");
|
|
24311
24446
|
const target = path54.join(targetBase, "settings.json");
|
|
@@ -24324,14 +24459,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
24324
24459
|
if (mergedContent !== normalizedTarget) {
|
|
24325
24460
|
if (!options2?.yes) {
|
|
24326
24461
|
console.log(
|
|
24327
|
-
|
|
24462
|
+
chalk196.yellow(
|
|
24328
24463
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
24329
24464
|
)
|
|
24330
24465
|
);
|
|
24331
24466
|
console.log();
|
|
24332
24467
|
printDiff(targetContent, mergedContent);
|
|
24333
24468
|
const confirm = await promptConfirm(
|
|
24334
|
-
|
|
24469
|
+
chalk196.red("Overwrite existing settings.json?"),
|
|
24335
24470
|
false
|
|
24336
24471
|
);
|
|
24337
24472
|
if (!confirm) {
|