@staff0rd/assist 0.471.0 → 0.473.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/claude/commands/refine.md +17 -15
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +796 -525
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.473.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -12417,26 +12417,9 @@ async function list2(options2) {
|
|
|
12417
12417
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
12418
12418
|
import chalk79 from "chalk";
|
|
12419
12419
|
|
|
12420
|
-
// src/commands/backlog/
|
|
12420
|
+
// src/commands/backlog/readJsonPayload.ts
|
|
12421
12421
|
import { readFileSync as readFileSync23 } from "fs";
|
|
12422
12422
|
import chalk78 from "chalk";
|
|
12423
|
-
|
|
12424
|
-
// src/commands/backlog/propose/proposedItemSchema.ts
|
|
12425
|
-
import { z as z5 } from "zod";
|
|
12426
|
-
var proposedPhaseSchema = z5.strictObject({
|
|
12427
|
-
name: z5.string().trim().min(1, "phase name is required"),
|
|
12428
|
-
tasks: z5.array(z5.string().trim().min(1)).min(1, "a phase needs at least one task"),
|
|
12429
|
-
manualChecks: z5.array(z5.string().trim().min(1)).default([])
|
|
12430
|
-
});
|
|
12431
|
-
var proposedItemSchema = z5.strictObject({
|
|
12432
|
-
name: z5.string().trim().min(1, "name is required"),
|
|
12433
|
-
type: z5.enum(["story", "bug"]),
|
|
12434
|
-
description: z5.string().optional(),
|
|
12435
|
-
acceptanceCriteria: z5.array(z5.string().trim().min(1)).default([]),
|
|
12436
|
-
phases: z5.array(proposedPhaseSchema).default([])
|
|
12437
|
-
});
|
|
12438
|
-
|
|
12439
|
-
// src/commands/backlog/propose/readProposedItem.ts
|
|
12440
12423
|
function fail3(message2) {
|
|
12441
12424
|
console.error(chalk78.red(message2));
|
|
12442
12425
|
process.exit(1);
|
|
@@ -12454,7 +12437,7 @@ async function readSource(source) {
|
|
|
12454
12437
|
);
|
|
12455
12438
|
}
|
|
12456
12439
|
}
|
|
12457
|
-
async function
|
|
12440
|
+
async function readJsonPayload(source, schema2, subject) {
|
|
12458
12441
|
const raw = await readSource(source);
|
|
12459
12442
|
let json;
|
|
12460
12443
|
try {
|
|
@@ -12462,15 +12445,35 @@ async function readProposedItem(source) {
|
|
|
12462
12445
|
} catch (error) {
|
|
12463
12446
|
return fail3(`The payload is not valid JSON: ${describe(error)}`);
|
|
12464
12447
|
}
|
|
12465
|
-
const parsed =
|
|
12448
|
+
const parsed = schema2.safeParse(json);
|
|
12466
12449
|
if (!parsed.success) {
|
|
12467
12450
|
const issues = parsed.error.issues.map((i) => ` ${i.path.join(".") || "(root)"}: ${i.message}`).join("\n");
|
|
12468
|
-
return fail3(`The payload is not a valid
|
|
12451
|
+
return fail3(`The payload is not a valid ${subject}:
|
|
12469
12452
|
${issues}`);
|
|
12470
12453
|
}
|
|
12471
12454
|
return parsed.data;
|
|
12472
12455
|
}
|
|
12473
12456
|
|
|
12457
|
+
// src/commands/backlog/propose/proposedItemSchema.ts
|
|
12458
|
+
import { z as z5 } from "zod";
|
|
12459
|
+
var proposedPhaseSchema = z5.strictObject({
|
|
12460
|
+
name: z5.string().trim().min(1, "phase name is required"),
|
|
12461
|
+
tasks: z5.array(z5.string().trim().min(1)).min(1, "a phase needs at least one task"),
|
|
12462
|
+
manualChecks: z5.array(z5.string().trim().min(1)).default([])
|
|
12463
|
+
});
|
|
12464
|
+
var proposedItemSchema = z5.strictObject({
|
|
12465
|
+
name: z5.string().trim().min(1, "name is required"),
|
|
12466
|
+
type: z5.enum(["story", "bug"]),
|
|
12467
|
+
description: z5.string().optional(),
|
|
12468
|
+
acceptanceCriteria: z5.array(z5.string().trim().min(1)).default([]),
|
|
12469
|
+
phases: z5.array(proposedPhaseSchema).default([])
|
|
12470
|
+
});
|
|
12471
|
+
|
|
12472
|
+
// src/commands/backlog/propose/readProposedItem.ts
|
|
12473
|
+
function readProposedItem(source) {
|
|
12474
|
+
return readJsonPayload(source, proposedItemSchema, "backlog item");
|
|
12475
|
+
}
|
|
12476
|
+
|
|
12474
12477
|
// src/commands/backlog/propose/renderProposedItem.ts
|
|
12475
12478
|
function renderProposedItem(item) {
|
|
12476
12479
|
const sections = [`**Type:** ${item.type}`];
|
|
@@ -13853,6 +13856,241 @@ async function update(id, options2) {
|
|
|
13853
13856
|
);
|
|
13854
13857
|
}
|
|
13855
13858
|
|
|
13859
|
+
// src/commands/backlog/updatePlan/index.ts
|
|
13860
|
+
import chalk113 from "chalk";
|
|
13861
|
+
|
|
13862
|
+
// src/commands/backlog/updatePlan/planUpdateSchema.ts
|
|
13863
|
+
import { z as z6 } from "zod";
|
|
13864
|
+
var planUpdateSchema = z6.strictObject({
|
|
13865
|
+
phases: z6.array(proposedPhaseSchema).min(1, "a plan needs at least one phase")
|
|
13866
|
+
});
|
|
13867
|
+
|
|
13868
|
+
// src/commands/backlog/updatePlan/readPlanUpdate.ts
|
|
13869
|
+
function readPlanUpdate(source) {
|
|
13870
|
+
return readJsonPayload(source, planUpdateSchema, "plan");
|
|
13871
|
+
}
|
|
13872
|
+
|
|
13873
|
+
// src/commands/backlog/updatePlan/replacePlan.ts
|
|
13874
|
+
import { eq as eq41 } from "drizzle-orm";
|
|
13875
|
+
|
|
13876
|
+
// src/commands/backlog/updatePlan/clampCurrentPhase.ts
|
|
13877
|
+
function clampCurrentPhase(currentPhase, phaseCount) {
|
|
13878
|
+
if (phaseCount === 0) return null;
|
|
13879
|
+
return Math.min(currentPhase, phaseCount);
|
|
13880
|
+
}
|
|
13881
|
+
|
|
13882
|
+
// src/commands/backlog/updatePlan/replacePlan.ts
|
|
13883
|
+
async function replacePlan(orm, itemId2, phases, currentPhase) {
|
|
13884
|
+
await orm.transaction(async (tx) => {
|
|
13885
|
+
await tx.delete(planTasks).where(eq41(planTasks.itemId, itemId2));
|
|
13886
|
+
await tx.delete(planPhases).where(eq41(planPhases.itemId, itemId2));
|
|
13887
|
+
if (phases.length > 0) {
|
|
13888
|
+
await tx.insert(planPhases).values(
|
|
13889
|
+
phases.map((phase, idx) => ({
|
|
13890
|
+
itemId: itemId2,
|
|
13891
|
+
idx,
|
|
13892
|
+
name: phase.name,
|
|
13893
|
+
manualChecks: serializeManualChecks(phase.manualChecks)
|
|
13894
|
+
}))
|
|
13895
|
+
);
|
|
13896
|
+
}
|
|
13897
|
+
const tasks = phases.flatMap(
|
|
13898
|
+
(phase, phaseIdx) => phase.tasks.map((task, idx) => ({ itemId: itemId2, phaseIdx, idx, task }))
|
|
13899
|
+
);
|
|
13900
|
+
if (tasks.length > 0) await tx.insert(planTasks).values(tasks);
|
|
13901
|
+
if (currentPhase === void 0) return;
|
|
13902
|
+
const clamped = clampCurrentPhase(currentPhase, phases.length);
|
|
13903
|
+
if (clamped === currentPhase) return;
|
|
13904
|
+
await tx.update(items).set({ currentPhase: clamped }).where(eq41(items.id, itemId2));
|
|
13905
|
+
});
|
|
13906
|
+
}
|
|
13907
|
+
|
|
13908
|
+
// src/commands/backlog/updatePlan/reviewPlanUpdate.ts
|
|
13909
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
13910
|
+
import chalk112 from "chalk";
|
|
13911
|
+
|
|
13912
|
+
// src/commands/backlog/updatePlan/isCompleted.ts
|
|
13913
|
+
function isCompleted(previousPosition, currentPhase) {
|
|
13914
|
+
return currentPhase !== void 0 && previousPosition < currentPhase;
|
|
13915
|
+
}
|
|
13916
|
+
|
|
13917
|
+
// src/commands/backlog/updatePlan/matchStoredPhases.ts
|
|
13918
|
+
function sameList(a, b) {
|
|
13919
|
+
return a.length === b.length && a.every((value, idx) => value === b[idx]);
|
|
13920
|
+
}
|
|
13921
|
+
function isIdenticalPhase(a, b) {
|
|
13922
|
+
return a.name === b.name && sameList(a.tasks, b.tasks) && sameList(a.manualChecks, b.manualChecks);
|
|
13923
|
+
}
|
|
13924
|
+
function matchStoredPhases(payload, stored) {
|
|
13925
|
+
const taken = /* @__PURE__ */ new Set();
|
|
13926
|
+
const matches = payload.map(() => void 0);
|
|
13927
|
+
const claim = (payloadIdx, isCandidate) => {
|
|
13928
|
+
if (matches[payloadIdx] !== void 0) return;
|
|
13929
|
+
const storedIdx = stored.findIndex(
|
|
13930
|
+
(candidate, idx) => !taken.has(idx) && isCandidate(candidate)
|
|
13931
|
+
);
|
|
13932
|
+
if (storedIdx === -1) return;
|
|
13933
|
+
taken.add(storedIdx);
|
|
13934
|
+
matches[payloadIdx] = storedIdx;
|
|
13935
|
+
};
|
|
13936
|
+
payload.forEach(
|
|
13937
|
+
(phase, idx) => claim(idx, (candidate) => candidate.name === phase.name)
|
|
13938
|
+
);
|
|
13939
|
+
payload.forEach(
|
|
13940
|
+
(phase, idx) => claim(idx, (candidate) => sameList(candidate.tasks, phase.tasks))
|
|
13941
|
+
);
|
|
13942
|
+
return matches;
|
|
13943
|
+
}
|
|
13944
|
+
|
|
13945
|
+
// src/commands/backlog/updatePlan/classifyPhase.ts
|
|
13946
|
+
function classifyPhase(phase, payloadIdx, storedIdx, stored, currentPhase) {
|
|
13947
|
+
if (storedIdx === void 0)
|
|
13948
|
+
return { phase, change: "added", wasCompleted: false };
|
|
13949
|
+
const previous = stored[storedIdx];
|
|
13950
|
+
const previousPosition = storedIdx + 1;
|
|
13951
|
+
const wasCompleted = isCompleted(previousPosition, currentPhase);
|
|
13952
|
+
if (isIdenticalPhase(previous, phase))
|
|
13953
|
+
return {
|
|
13954
|
+
phase,
|
|
13955
|
+
change: storedIdx === payloadIdx ? "unchanged" : "moved",
|
|
13956
|
+
previousPosition,
|
|
13957
|
+
wasCompleted
|
|
13958
|
+
};
|
|
13959
|
+
return {
|
|
13960
|
+
phase,
|
|
13961
|
+
change: "edited",
|
|
13962
|
+
previousPosition,
|
|
13963
|
+
wasCompleted,
|
|
13964
|
+
...previous.name === phase.name ? {} : { previousName: previous.name },
|
|
13965
|
+
...sameList(previous.tasks, phase.tasks) ? {} : { previousTasks: previous.tasks }
|
|
13966
|
+
};
|
|
13967
|
+
}
|
|
13968
|
+
|
|
13969
|
+
// src/commands/backlog/updatePlan/diffPlan.ts
|
|
13970
|
+
function fromStored(phase) {
|
|
13971
|
+
return {
|
|
13972
|
+
name: phase.name,
|
|
13973
|
+
tasks: phase.tasks.map((t) => t.task),
|
|
13974
|
+
manualChecks: phase.manualChecks ?? []
|
|
13975
|
+
};
|
|
13976
|
+
}
|
|
13977
|
+
function diffPlan(storedPlan, payloadPhases, currentPhase) {
|
|
13978
|
+
const stored = (storedPlan ?? []).map(fromStored);
|
|
13979
|
+
const payload = payloadPhases.map((phase) => ({
|
|
13980
|
+
name: phase.name,
|
|
13981
|
+
tasks: phase.tasks,
|
|
13982
|
+
manualChecks: phase.manualChecks
|
|
13983
|
+
}));
|
|
13984
|
+
const matches = matchStoredPhases(payload, stored);
|
|
13985
|
+
const phases = payload.map(
|
|
13986
|
+
(phase, idx) => classifyPhase(phase, idx, matches[idx], stored, currentPhase)
|
|
13987
|
+
);
|
|
13988
|
+
const matched = new Set(matches.filter((idx) => idx !== void 0));
|
|
13989
|
+
const removed = stored.flatMap(
|
|
13990
|
+
(phase, idx) => matched.has(idx) ? [] : [
|
|
13991
|
+
{
|
|
13992
|
+
phase,
|
|
13993
|
+
previousPosition: idx + 1,
|
|
13994
|
+
wasCompleted: isCompleted(idx + 1, currentPhase)
|
|
13995
|
+
}
|
|
13996
|
+
]
|
|
13997
|
+
);
|
|
13998
|
+
return { phases, removed };
|
|
13999
|
+
}
|
|
14000
|
+
|
|
14001
|
+
// src/commands/backlog/updatePlan/renderPlanDiff.ts
|
|
14002
|
+
function phaseNotes(entry, position) {
|
|
14003
|
+
if (entry.change === "unchanged") return ["unchanged"];
|
|
14004
|
+
if (entry.change === "added") return ["added"];
|
|
14005
|
+
const notes = entry.change === "moved" ? [`moved from phase ${entry.previousPosition}`] : ["edited"];
|
|
14006
|
+
if (entry.change === "edited") {
|
|
14007
|
+
if (entry.previousName) notes.push(`renamed from "${entry.previousName}"`);
|
|
14008
|
+
if (entry.previousPosition !== position)
|
|
14009
|
+
notes.push(`moved from phase ${entry.previousPosition}`);
|
|
14010
|
+
}
|
|
14011
|
+
if (entry.wasCompleted) notes.push("already completed");
|
|
14012
|
+
return notes;
|
|
14013
|
+
}
|
|
14014
|
+
function renderDiffPhase(entry, idx) {
|
|
14015
|
+
const notes = phaseNotes(entry, idx + 1);
|
|
14016
|
+
const section3 = renderPhaseSection(
|
|
14017
|
+
{ ...entry.phase, name: `${entry.phase.name} (${notes.join(", ")})` },
|
|
14018
|
+
idx
|
|
14019
|
+
);
|
|
14020
|
+
if (!entry.previousTasks) return section3;
|
|
14021
|
+
return [
|
|
14022
|
+
section3,
|
|
14023
|
+
"**Previously:**",
|
|
14024
|
+
entry.previousTasks.map((task) => `- ${task}`).join("\n")
|
|
14025
|
+
].join("\n\n");
|
|
14026
|
+
}
|
|
14027
|
+
function renderRemovedPhase(entry) {
|
|
14028
|
+
const notes = entry.wasCompleted ? "removed, already completed" : "removed";
|
|
14029
|
+
return renderPhaseSection(
|
|
14030
|
+
{ ...entry.phase, name: `${entry.phase.name} (${notes})` },
|
|
14031
|
+
entry.previousPosition - 1
|
|
14032
|
+
);
|
|
14033
|
+
}
|
|
14034
|
+
function renderPlanDiff(diff3) {
|
|
14035
|
+
const sections = ["## Plan", ...diff3.phases.map(renderDiffPhase)];
|
|
14036
|
+
if (diff3.removed.length === 0) return sections;
|
|
14037
|
+
return [
|
|
14038
|
+
...sections,
|
|
14039
|
+
"## Removed phases",
|
|
14040
|
+
...diff3.removed.map(renderRemovedPhase)
|
|
14041
|
+
];
|
|
14042
|
+
}
|
|
14043
|
+
|
|
14044
|
+
// src/commands/backlog/updatePlan/renderPlanUpdate.ts
|
|
14045
|
+
function clampNote(item, phaseCount) {
|
|
14046
|
+
const currentPhase = item.currentPhase;
|
|
14047
|
+
if (currentPhase === void 0) return void 0;
|
|
14048
|
+
const clamped = clampCurrentPhase(currentPhase, phaseCount);
|
|
14049
|
+
if (clamped === currentPhase) return void 0;
|
|
14050
|
+
return `**Current phase:** ${currentPhase} \u2192 ${clamped ?? "none"} (clamped into the new plan of ${phaseCount} phase${phaseCount === 1 ? "" : "s"})`;
|
|
14051
|
+
}
|
|
14052
|
+
function renderPlanUpdate(item, phases) {
|
|
14053
|
+
const note = clampNote(item, phases.length);
|
|
14054
|
+
const diff3 = diffPlan(item.plan, phases, item.currentPhase);
|
|
14055
|
+
const sections = note ? [note] : [];
|
|
14056
|
+
return [...sections, ...renderPlanDiff(diff3)].join("\n\n");
|
|
14057
|
+
}
|
|
14058
|
+
|
|
14059
|
+
// src/commands/backlog/updatePlan/reviewPlanUpdate.ts
|
|
14060
|
+
async function reviewPlanUpdate(item, phases) {
|
|
14061
|
+
const body = renderPlanUpdate(item, phases);
|
|
14062
|
+
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
14063
|
+
if (process.env.ASSIST_SESSION === "1" && sessionId) {
|
|
14064
|
+
await awaitPreviewApproval("Plan update preview", {
|
|
14065
|
+
sessionId,
|
|
14066
|
+
requestId: randomUUID5(),
|
|
14067
|
+
title: `Update the plan for ${formatItemId(item.id)}: ${item.name}`,
|
|
14068
|
+
body,
|
|
14069
|
+
prNumber: null,
|
|
14070
|
+
kind: "backlog-item",
|
|
14071
|
+
itemType: item.type
|
|
14072
|
+
});
|
|
14073
|
+
return;
|
|
14074
|
+
}
|
|
14075
|
+
console.log(chalk112.bold(item.name));
|
|
14076
|
+
console.log(renderMarkdownTerminal(body));
|
|
14077
|
+
}
|
|
14078
|
+
|
|
14079
|
+
// src/commands/backlog/updatePlan/index.ts
|
|
14080
|
+
async function updatePlan(id, options2) {
|
|
14081
|
+
const { phases } = await readPlanUpdate(options2.json);
|
|
14082
|
+
const found = await findOneItem(id);
|
|
14083
|
+
if (!found) return;
|
|
14084
|
+
const { orm, item } = found;
|
|
14085
|
+
await reviewPlanUpdate(item, phases);
|
|
14086
|
+
await replacePlan(orm, item.id, phases, item.currentPhase);
|
|
14087
|
+
console.log(
|
|
14088
|
+
chalk113.green(
|
|
14089
|
+
`Replaced the plan on item ${formatItemId(item.id)} with ${phases.length} phase${phases.length === 1 ? "" : "s"}.`
|
|
14090
|
+
)
|
|
14091
|
+
);
|
|
14092
|
+
}
|
|
14093
|
+
|
|
13856
14094
|
// src/commands/backlog/registerUpdateCommands.ts
|
|
13857
14095
|
function collect2(value, previous) {
|
|
13858
14096
|
return [...previous, value];
|
|
@@ -13875,6 +14113,12 @@ function registerUpdateCommands(cmd) {
|
|
|
13875
14113
|
).action(update);
|
|
13876
14114
|
registerUpdatePhaseCommand(cmd);
|
|
13877
14115
|
cmd.command("remove-phase <id> <phase>").description("Remove a plan phase from a backlog item").action(removePhase);
|
|
14116
|
+
cmd.command("update-plan <id>").description(
|
|
14117
|
+
"Replace an item's whole plan from a JSON payload, previewed and applied in one approval"
|
|
14118
|
+
).requiredOption(
|
|
14119
|
+
"--json <file|->",
|
|
14120
|
+
"Path to a JSON payload of { phases: [{ name, tasks, manualChecks }] }, or - to read it from stdin"
|
|
14121
|
+
).action(updatePlan);
|
|
13878
14122
|
cmd.command("move-phase <id> <from> <to>").description(
|
|
13879
14123
|
"Reorder a plan phase from one 1-based position to another, moving its tasks with it"
|
|
13880
14124
|
).action(movePhase);
|
|
@@ -14659,11 +14903,11 @@ function assertCliExists(cli) {
|
|
|
14659
14903
|
}
|
|
14660
14904
|
|
|
14661
14905
|
// src/commands/permitCliReads/colorize.ts
|
|
14662
|
-
import
|
|
14906
|
+
import chalk114 from "chalk";
|
|
14663
14907
|
function colorize(plainOutput) {
|
|
14664
14908
|
return plainOutput.split("\n").map((line) => {
|
|
14665
|
-
if (line.startsWith(" R ")) return
|
|
14666
|
-
if (line.startsWith(" W ")) return
|
|
14909
|
+
if (line.startsWith(" R ")) return chalk114.green(line);
|
|
14910
|
+
if (line.startsWith(" W ")) return chalk114.red(line);
|
|
14667
14911
|
return line;
|
|
14668
14912
|
}).join("\n");
|
|
14669
14913
|
}
|
|
@@ -14956,7 +15200,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
14956
15200
|
}
|
|
14957
15201
|
|
|
14958
15202
|
// src/commands/deny/denyAdd.ts
|
|
14959
|
-
import
|
|
15203
|
+
import chalk115 from "chalk";
|
|
14960
15204
|
|
|
14961
15205
|
// src/commands/deny/loadDenyConfig.ts
|
|
14962
15206
|
function loadDenyConfig(global) {
|
|
@@ -14976,16 +15220,16 @@ function loadDenyConfig(global) {
|
|
|
14976
15220
|
function denyAdd(pattern2, message2, options2) {
|
|
14977
15221
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
14978
15222
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
14979
|
-
console.log(
|
|
15223
|
+
console.log(chalk115.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
14980
15224
|
return;
|
|
14981
15225
|
}
|
|
14982
15226
|
deny.push({ pattern: pattern2, message: message2 });
|
|
14983
15227
|
saveDeny(deny);
|
|
14984
|
-
console.log(
|
|
15228
|
+
console.log(chalk115.green(`Added deny rule: ${pattern2} \u2192 ${message2}`));
|
|
14985
15229
|
}
|
|
14986
15230
|
|
|
14987
15231
|
// src/commands/deny/denyList.ts
|
|
14988
|
-
import
|
|
15232
|
+
import chalk116 from "chalk";
|
|
14989
15233
|
function denyList() {
|
|
14990
15234
|
const globalRaw = loadGlobalConfigRaw();
|
|
14991
15235
|
const projectRaw = loadProjectConfig();
|
|
@@ -14996,7 +15240,7 @@ function denyList() {
|
|
|
14996
15240
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
14997
15241
|
);
|
|
14998
15242
|
if (!merged || merged.length === 0) {
|
|
14999
|
-
console.log(
|
|
15243
|
+
console.log(chalk116.dim("No deny rules configured."));
|
|
15000
15244
|
return;
|
|
15001
15245
|
}
|
|
15002
15246
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -15004,23 +15248,23 @@ function denyList() {
|
|
|
15004
15248
|
for (const rule of merged) {
|
|
15005
15249
|
const inProject = projectPatterns.has(rule.pattern);
|
|
15006
15250
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
15007
|
-
const label2 = inProject && inGlobal ?
|
|
15008
|
-
console.log(`${
|
|
15251
|
+
const label2 = inProject && inGlobal ? chalk116.dim(" (project, overrides global)") : inGlobal ? chalk116.dim(" (global)") : "";
|
|
15252
|
+
console.log(`${chalk116.red(rule.pattern)} \u2192 ${rule.message}${label2}`);
|
|
15009
15253
|
}
|
|
15010
15254
|
}
|
|
15011
15255
|
|
|
15012
15256
|
// src/commands/deny/denyRemove.ts
|
|
15013
|
-
import
|
|
15257
|
+
import chalk117 from "chalk";
|
|
15014
15258
|
function denyRemove(pattern2, options2) {
|
|
15015
15259
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
15016
15260
|
const index3 = deny.findIndex((r) => r.pattern === pattern2);
|
|
15017
15261
|
if (index3 === -1) {
|
|
15018
|
-
console.log(
|
|
15262
|
+
console.log(chalk117.yellow(`No deny rule found for: ${pattern2}`));
|
|
15019
15263
|
return;
|
|
15020
15264
|
}
|
|
15021
15265
|
deny.splice(index3, 1);
|
|
15022
15266
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
15023
|
-
console.log(
|
|
15267
|
+
console.log(chalk117.green(`Removed deny rule: ${pattern2}`));
|
|
15024
15268
|
}
|
|
15025
15269
|
|
|
15026
15270
|
// src/commands/registerDeny.ts
|
|
@@ -15064,7 +15308,7 @@ function registerCliHook(program2) {
|
|
|
15064
15308
|
|
|
15065
15309
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
15066
15310
|
import { existsSync as existsSync33, readFileSync as readFileSync28, unlinkSync as unlinkSync8, writeFileSync as writeFileSync24 } from "fs";
|
|
15067
|
-
import
|
|
15311
|
+
import chalk118 from "chalk";
|
|
15068
15312
|
|
|
15069
15313
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
15070
15314
|
import { homedir as homedir17 } from "os";
|
|
@@ -15117,12 +15361,12 @@ function codeCommentConfirm(pin) {
|
|
|
15117
15361
|
sweepRestrictedDir();
|
|
15118
15362
|
const state = readPinState(pin);
|
|
15119
15363
|
if (!state) {
|
|
15120
|
-
console.error(
|
|
15364
|
+
console.error(chalk118.red(`No pending comment for pin: ${pin}`));
|
|
15121
15365
|
process.exitCode = 1;
|
|
15122
15366
|
return;
|
|
15123
15367
|
}
|
|
15124
15368
|
if (!existsSync33(state.file)) {
|
|
15125
|
-
console.error(
|
|
15369
|
+
console.error(chalk118.red(`Target file no longer exists: ${state.file}`));
|
|
15126
15370
|
process.exitCode = 1;
|
|
15127
15371
|
return;
|
|
15128
15372
|
}
|
|
@@ -15131,7 +15375,7 @@ function codeCommentConfirm(pin) {
|
|
|
15131
15375
|
const index3 = state.line - 1;
|
|
15132
15376
|
if (index3 > lines.length) {
|
|
15133
15377
|
console.error(
|
|
15134
|
-
|
|
15378
|
+
chalk118.red(
|
|
15135
15379
|
`Line ${state.line} is beyond the end of ${state.file} (${lines.length} lines).`
|
|
15136
15380
|
)
|
|
15137
15381
|
);
|
|
@@ -15145,14 +15389,14 @@ function codeCommentConfirm(pin) {
|
|
|
15145
15389
|
writeFileSync24(state.file, lines.join("\n"));
|
|
15146
15390
|
unlinkSync8(getPinStatePath(pin));
|
|
15147
15391
|
console.log(
|
|
15148
|
-
|
|
15392
|
+
chalk118.green(
|
|
15149
15393
|
`Inserted "${marker} ${state.text}" at ${state.file}:${state.line}`
|
|
15150
15394
|
)
|
|
15151
15395
|
);
|
|
15152
15396
|
}
|
|
15153
15397
|
|
|
15154
15398
|
// src/commands/codeComment/codeCommentSet.ts
|
|
15155
|
-
import
|
|
15399
|
+
import chalk119 from "chalk";
|
|
15156
15400
|
|
|
15157
15401
|
// src/commands/codeComment/validateCommentText.ts
|
|
15158
15402
|
var MAX_COMMENT_LENGTH = 50;
|
|
@@ -15203,7 +15447,7 @@ function generatePin() {
|
|
|
15203
15447
|
function codeCommentSet(file, line, text17) {
|
|
15204
15448
|
const lineNumber = Number.parseInt(line, 10);
|
|
15205
15449
|
if (!Number.isInteger(lineNumber) || lineNumber < 1) {
|
|
15206
|
-
console.error(
|
|
15450
|
+
console.error(chalk119.red(`Invalid line number: ${line}`));
|
|
15207
15451
|
process.exitCode = 1;
|
|
15208
15452
|
return;
|
|
15209
15453
|
}
|
|
@@ -15211,20 +15455,20 @@ function codeCommentSet(file, line, text17) {
|
|
|
15211
15455
|
const marker = hash ? "#" : "//";
|
|
15212
15456
|
const validation = validateCommentText(text17, hash);
|
|
15213
15457
|
if (!validation.ok) {
|
|
15214
|
-
console.error(
|
|
15215
|
-
console.error(
|
|
15458
|
+
console.error(chalk119.red(`Refused: ${validation.reason}`));
|
|
15459
|
+
console.error(chalk119.red("No pin issued."));
|
|
15216
15460
|
process.exitCode = 1;
|
|
15217
15461
|
return;
|
|
15218
15462
|
}
|
|
15219
15463
|
console.error(
|
|
15220
|
-
|
|
15464
|
+
chalk119.yellow.bold(
|
|
15221
15465
|
"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."
|
|
15222
15466
|
)
|
|
15223
15467
|
);
|
|
15224
15468
|
const delivered = issuePin(file, lineNumber, validation.text);
|
|
15225
15469
|
if (!delivered) {
|
|
15226
15470
|
console.error(
|
|
15227
|
-
|
|
15471
|
+
chalk119.red(
|
|
15228
15472
|
"Could not deliver the confirmation pin via notification.\nThe comment cannot be confirmed until the notification channel works."
|
|
15229
15473
|
)
|
|
15230
15474
|
);
|
|
@@ -15234,7 +15478,7 @@ function codeCommentSet(file, line, text17) {
|
|
|
15234
15478
|
console.log(
|
|
15235
15479
|
`A confirmation pin was sent to your desktop notifications.
|
|
15236
15480
|
To insert "${marker} ${validation.text}" at ${file}:${lineNumber}, run:
|
|
15237
|
-
${
|
|
15481
|
+
${chalk119.cyan(" assist code-comment confirm <PIN>")}
|
|
15238
15482
|
using the pin from that notification.`
|
|
15239
15483
|
);
|
|
15240
15484
|
}
|
|
@@ -15313,15 +15557,15 @@ function registerCodexHook(program2) {
|
|
|
15313
15557
|
}
|
|
15314
15558
|
|
|
15315
15559
|
// src/commands/complexity/analyze.ts
|
|
15316
|
-
import
|
|
15560
|
+
import chalk128 from "chalk";
|
|
15317
15561
|
|
|
15318
15562
|
// src/commands/complexity/cyclomatic.ts
|
|
15319
|
-
import
|
|
15563
|
+
import chalk121 from "chalk";
|
|
15320
15564
|
|
|
15321
15565
|
// src/commands/complexity/shared/index.ts
|
|
15322
15566
|
import fs20 from "fs";
|
|
15323
15567
|
import path27 from "path";
|
|
15324
|
-
import
|
|
15568
|
+
import chalk120 from "chalk";
|
|
15325
15569
|
import ts5 from "typescript";
|
|
15326
15570
|
|
|
15327
15571
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -15572,7 +15816,7 @@ function createSourceFromFile(filePath) {
|
|
|
15572
15816
|
function withSourceFiles(pattern2, callback, extraIgnore = []) {
|
|
15573
15817
|
const files = findSourceFiles2(pattern2, ".", extraIgnore);
|
|
15574
15818
|
if (files.length === 0) {
|
|
15575
|
-
console.log(
|
|
15819
|
+
console.log(chalk120.yellow("No files found matching pattern"));
|
|
15576
15820
|
return void 0;
|
|
15577
15821
|
}
|
|
15578
15822
|
return callback(files);
|
|
@@ -15605,11 +15849,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
15605
15849
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
15606
15850
|
for (const { file, name, complexity } of results) {
|
|
15607
15851
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
15608
|
-
const color = exceedsThreshold ?
|
|
15609
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
15852
|
+
const color = exceedsThreshold ? chalk121.red : chalk121.white;
|
|
15853
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk121.cyan(complexity)}`);
|
|
15610
15854
|
}
|
|
15611
15855
|
console.log(
|
|
15612
|
-
|
|
15856
|
+
chalk121.dim(
|
|
15613
15857
|
`
|
|
15614
15858
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
15615
15859
|
)
|
|
@@ -15621,7 +15865,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
15621
15865
|
}
|
|
15622
15866
|
|
|
15623
15867
|
// src/commands/complexity/halstead.ts
|
|
15624
|
-
import
|
|
15868
|
+
import chalk122 from "chalk";
|
|
15625
15869
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
15626
15870
|
withSourceFiles(pattern2, (files) => {
|
|
15627
15871
|
const results = [];
|
|
@@ -15636,13 +15880,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
15636
15880
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
15637
15881
|
for (const { file, name, metrics } of results) {
|
|
15638
15882
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
15639
|
-
const color = exceedsThreshold ?
|
|
15883
|
+
const color = exceedsThreshold ? chalk122.red : chalk122.white;
|
|
15640
15884
|
console.log(
|
|
15641
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
15885
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk122.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk122.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk122.magenta(metrics.effort.toFixed(1))}`
|
|
15642
15886
|
);
|
|
15643
15887
|
}
|
|
15644
15888
|
console.log(
|
|
15645
|
-
|
|
15889
|
+
chalk122.dim(
|
|
15646
15890
|
`
|
|
15647
15891
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
15648
15892
|
)
|
|
@@ -15711,15 +15955,15 @@ function collectFileMetrics(files) {
|
|
|
15711
15955
|
}
|
|
15712
15956
|
|
|
15713
15957
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
15714
|
-
import
|
|
15958
|
+
import chalk126 from "chalk";
|
|
15715
15959
|
|
|
15716
15960
|
// src/commands/complexity/maintainability/formatResultLine.ts
|
|
15717
|
-
import
|
|
15961
|
+
import chalk123 from "chalk";
|
|
15718
15962
|
function formatResultLine(entry, failing) {
|
|
15719
15963
|
const { file, avgMaintainability, minMaintainability, override } = entry;
|
|
15720
|
-
const name = failing ?
|
|
15721
|
-
const suffix = override !== void 0 ?
|
|
15722
|
-
return `${name} \u2192 avg: ${
|
|
15964
|
+
const name = failing ? chalk123.red(file) : chalk123.white(file);
|
|
15965
|
+
const suffix = override !== void 0 ? chalk123.magenta(` (override: ${override})`) : "";
|
|
15966
|
+
return `${name} \u2192 avg: ${chalk123.cyan(avgMaintainability.toFixed(1))}, min: ${chalk123.yellow(minMaintainability.toFixed(1))}${suffix}`;
|
|
15723
15967
|
}
|
|
15724
15968
|
|
|
15725
15969
|
// src/commands/complexity/maintainability/getMaintainabilityGitState.ts
|
|
@@ -15770,38 +16014,38 @@ function getMaintainabilityGitState() {
|
|
|
15770
16014
|
|
|
15771
16015
|
// src/commands/complexity/maintainability/printMaintainabilityFailure.ts
|
|
15772
16016
|
import path29 from "path";
|
|
15773
|
-
import
|
|
16017
|
+
import chalk124 from "chalk";
|
|
15774
16018
|
var extractTemplate = "assist refactor extract <file> <functionName> <destination> --apply";
|
|
15775
16019
|
function remediationLine(entry) {
|
|
15776
|
-
return ` ${
|
|
16020
|
+
return ` ${chalk124.bold(entry.file)}
|
|
15777
16021
|
Pick a responsibility and extract it:
|
|
15778
|
-
${
|
|
16022
|
+
${chalk124.cyan(extractTemplate)}`;
|
|
15779
16023
|
}
|
|
15780
16024
|
function cheatLine(entry, gitState) {
|
|
15781
16025
|
const shrank = gitState.shrunkFiles.has(path29.resolve(entry.file));
|
|
15782
16026
|
if (!shrank || gitState.newFileCreated) return "";
|
|
15783
16027
|
return `
|
|
15784
|
-
${
|
|
16028
|
+
${chalk124.red("\u2717 You shrank existing lines in this file without creating a new file. That cannot clear the gate \u2014 extract a responsibility to a new file.")}`;
|
|
15785
16029
|
}
|
|
15786
16030
|
function printMaintainabilityFailure(failing, gitState) {
|
|
15787
16031
|
const blocks = failing.map((entry) => `${remediationLine(entry)}${cheatLine(entry, gitState)}`).join("\n");
|
|
15788
16032
|
console.error(
|
|
15789
|
-
|
|
16033
|
+
chalk124.red(
|
|
15790
16034
|
`
|
|
15791
16035
|
Fail: ${failing.length} file(s) below threshold \u2192 extract a responsibility to a new file.
|
|
15792
16036
|
|
|
15793
16037
|
${blocks}
|
|
15794
16038
|
|
|
15795
|
-
${
|
|
16039
|
+
${chalk124.bold("Diagnose and fix one file at a time.")} Only a new file (Write) or 'assist refactor extract' clears this gate \u2014 editing the existing lines does not.`
|
|
15796
16040
|
)
|
|
15797
16041
|
);
|
|
15798
16042
|
}
|
|
15799
16043
|
|
|
15800
16044
|
// src/commands/complexity/maintainability/printMaintainabilityFormula.ts
|
|
15801
|
-
import
|
|
16045
|
+
import chalk125 from "chalk";
|
|
15802
16046
|
var MI_FORMULA = "171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100";
|
|
15803
16047
|
function printMaintainabilityFormula() {
|
|
15804
|
-
console.log(
|
|
16048
|
+
console.log(chalk125.dim(MI_FORMULA));
|
|
15805
16049
|
}
|
|
15806
16050
|
|
|
15807
16051
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
@@ -15810,7 +16054,7 @@ function displayMaintainabilityResults(results, threshold, gitState = getMaintai
|
|
|
15810
16054
|
if (!gating) {
|
|
15811
16055
|
printMaintainabilityFormula();
|
|
15812
16056
|
for (const entry of results) console.log(formatResultLine(entry, false));
|
|
15813
|
-
console.log(
|
|
16057
|
+
console.log(chalk126.dim(`
|
|
15814
16058
|
Analyzed ${results.length} files`));
|
|
15815
16059
|
return;
|
|
15816
16060
|
}
|
|
@@ -15819,14 +16063,14 @@ Analyzed ${results.length} files`));
|
|
|
15819
16063
|
return limit !== void 0 && r.minMaintainability < limit;
|
|
15820
16064
|
});
|
|
15821
16065
|
if (failing.length === 0) {
|
|
15822
|
-
console.log(
|
|
16066
|
+
console.log(chalk126.green("All files pass maintainability threshold"));
|
|
15823
16067
|
}
|
|
15824
16068
|
const passingOverrides = results.filter(
|
|
15825
16069
|
(r) => r.override !== void 0 && !failing.includes(r)
|
|
15826
16070
|
);
|
|
15827
16071
|
for (const entry of passingOverrides)
|
|
15828
16072
|
console.log(formatResultLine(entry, false));
|
|
15829
|
-
console.log(
|
|
16073
|
+
console.log(chalk126.dim(`
|
|
15830
16074
|
Analyzed ${results.length} files`));
|
|
15831
16075
|
if (failing.length > 0) {
|
|
15832
16076
|
printMaintainabilityFailure(failing, gitState);
|
|
@@ -15849,7 +16093,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
15849
16093
|
|
|
15850
16094
|
// src/commands/complexity/sloc.ts
|
|
15851
16095
|
import fs22 from "fs";
|
|
15852
|
-
import
|
|
16096
|
+
import chalk127 from "chalk";
|
|
15853
16097
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
15854
16098
|
withSourceFiles(pattern2, (files) => {
|
|
15855
16099
|
const results = [];
|
|
@@ -15865,12 +16109,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
15865
16109
|
results.sort((a, b) => b.lines - a.lines);
|
|
15866
16110
|
for (const { file, lines } of results) {
|
|
15867
16111
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
15868
|
-
const color = exceedsThreshold ?
|
|
15869
|
-
console.log(`${color(file)} \u2192 ${
|
|
16112
|
+
const color = exceedsThreshold ? chalk127.red : chalk127.white;
|
|
16113
|
+
console.log(`${color(file)} \u2192 ${chalk127.cyan(lines)} lines`);
|
|
15870
16114
|
}
|
|
15871
16115
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
15872
16116
|
console.log(
|
|
15873
|
-
|
|
16117
|
+
chalk127.dim(`
|
|
15874
16118
|
Total: ${total} lines across ${files.length} files`)
|
|
15875
16119
|
);
|
|
15876
16120
|
if (hasViolation) {
|
|
@@ -15884,25 +16128,25 @@ async function analyze(pattern2) {
|
|
|
15884
16128
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
15885
16129
|
const files = findSourceFiles2(searchPattern);
|
|
15886
16130
|
if (files.length === 0) {
|
|
15887
|
-
console.log(
|
|
16131
|
+
console.log(chalk128.yellow("No files found matching pattern"));
|
|
15888
16132
|
return;
|
|
15889
16133
|
}
|
|
15890
16134
|
if (files.length === 1) {
|
|
15891
16135
|
const file = files[0];
|
|
15892
|
-
console.log(
|
|
16136
|
+
console.log(chalk128.bold.underline("SLOC"));
|
|
15893
16137
|
await sloc(file);
|
|
15894
16138
|
console.log();
|
|
15895
|
-
console.log(
|
|
16139
|
+
console.log(chalk128.bold.underline("Cyclomatic Complexity"));
|
|
15896
16140
|
await cyclomatic(file);
|
|
15897
16141
|
console.log();
|
|
15898
|
-
console.log(
|
|
16142
|
+
console.log(chalk128.bold.underline("Halstead Metrics"));
|
|
15899
16143
|
await halstead(file);
|
|
15900
16144
|
console.log();
|
|
15901
|
-
console.log(
|
|
16145
|
+
console.log(chalk128.bold.underline("Maintainability Index"));
|
|
15902
16146
|
await maintainability(file);
|
|
15903
16147
|
console.log();
|
|
15904
16148
|
console.log(
|
|
15905
|
-
|
|
16149
|
+
chalk128.dim(
|
|
15906
16150
|
"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."
|
|
15907
16151
|
)
|
|
15908
16152
|
);
|
|
@@ -15953,7 +16197,7 @@ function configList() {
|
|
|
15953
16197
|
}
|
|
15954
16198
|
|
|
15955
16199
|
// src/commands/config/configGet.ts
|
|
15956
|
-
import
|
|
16200
|
+
import chalk129 from "chalk";
|
|
15957
16201
|
function configGet(key) {
|
|
15958
16202
|
console.log(
|
|
15959
16203
|
formatOutput(
|
|
@@ -15970,12 +16214,12 @@ function requireNestedValue(config, key) {
|
|
|
15970
16214
|
return value;
|
|
15971
16215
|
}
|
|
15972
16216
|
function exitKeyNotSet(key) {
|
|
15973
|
-
console.error(
|
|
16217
|
+
console.error(chalk129.red(`Key "${key}" is not set`));
|
|
15974
16218
|
process.exit(1);
|
|
15975
16219
|
}
|
|
15976
16220
|
|
|
15977
16221
|
// src/commands/config/configSet.ts
|
|
15978
|
-
import
|
|
16222
|
+
import chalk131 from "chalk";
|
|
15979
16223
|
|
|
15980
16224
|
// src/shared/resolveNamedRepoWriteLabel.ts
|
|
15981
16225
|
var UnknownRepoConfigError = class extends Error {
|
|
@@ -16000,9 +16244,9 @@ function resolveNamedRepoWriteLabel(globalRaw, name) {
|
|
|
16000
16244
|
}
|
|
16001
16245
|
|
|
16002
16246
|
// src/commands/config/exitWithConfigErrors.ts
|
|
16003
|
-
import
|
|
16247
|
+
import chalk130 from "chalk";
|
|
16004
16248
|
function exitWithConfigErrors(errors) {
|
|
16005
|
-
for (const error of errors) console.error(
|
|
16249
|
+
for (const error of errors) console.error(chalk130.red(error));
|
|
16006
16250
|
process.exit(1);
|
|
16007
16251
|
}
|
|
16008
16252
|
|
|
@@ -16038,19 +16282,19 @@ function resolveRepoTarget(key, value, repo) {
|
|
|
16038
16282
|
function configSet(key, value, options2 = {}) {
|
|
16039
16283
|
if (options2.repo !== void 0 && !options2.global) {
|
|
16040
16284
|
console.error(
|
|
16041
|
-
|
|
16285
|
+
chalk131.red("--repo writes to the global config; add -g (e.g. -g --repo)")
|
|
16042
16286
|
);
|
|
16043
16287
|
process.exit(1);
|
|
16044
16288
|
}
|
|
16045
16289
|
const resolved = resolveRepoTarget(key, value, options2.repo);
|
|
16046
16290
|
if (resolved.value === void 0) {
|
|
16047
|
-
console.error(
|
|
16291
|
+
console.error(chalk131.red(`Missing required argument for '${resolved.key}'`));
|
|
16048
16292
|
process.exit(1);
|
|
16049
16293
|
}
|
|
16050
16294
|
const coerced = coerceValue(resolved.value);
|
|
16051
16295
|
const target = resolved.useRepo ? `repo: ${applyRepoConfigSet(resolved.key, coerced, resolved.repoName)}` : applyOrExit(resolved.key, coerced, options2.global ?? false);
|
|
16052
16296
|
console.log(
|
|
16053
|
-
|
|
16297
|
+
chalk131.green(`Set ${resolved.key} = ${JSON.stringify(coerced)} (${target})`)
|
|
16054
16298
|
);
|
|
16055
16299
|
}
|
|
16056
16300
|
function applyOrExit(key, coerced, global) {
|
|
@@ -16065,17 +16309,17 @@ function coerceValue(value) {
|
|
|
16065
16309
|
}
|
|
16066
16310
|
|
|
16067
16311
|
// src/commands/config/configUnset.ts
|
|
16068
|
-
import
|
|
16312
|
+
import chalk132 from "chalk";
|
|
16069
16313
|
function configUnset(key, options2 = {}) {
|
|
16070
16314
|
const result = applyConfigUnset(key, options2.global ?? false);
|
|
16071
16315
|
if (!result.ok) exitWithConfigErrors(result.errors);
|
|
16072
16316
|
if (!result.removed) {
|
|
16073
16317
|
console.log(
|
|
16074
|
-
|
|
16318
|
+
chalk132.yellow(`${key} is not set in the ${result.target} config`)
|
|
16075
16319
|
);
|
|
16076
16320
|
return;
|
|
16077
16321
|
}
|
|
16078
|
-
console.log(
|
|
16322
|
+
console.log(chalk132.green(`Unset ${key} (${result.target})`));
|
|
16079
16323
|
}
|
|
16080
16324
|
|
|
16081
16325
|
// src/commands/registerConfig.ts
|
|
@@ -16091,40 +16335,40 @@ function registerConfig(program2) {
|
|
|
16091
16335
|
}
|
|
16092
16336
|
|
|
16093
16337
|
// src/commands/db/reportMigrationStatus.ts
|
|
16094
|
-
import
|
|
16338
|
+
import chalk133 from "chalk";
|
|
16095
16339
|
function reportApplied(applied) {
|
|
16096
16340
|
if (applied.length === 0) {
|
|
16097
|
-
console.error(
|
|
16341
|
+
console.error(chalk133.green("Database is up to date; nothing to apply."));
|
|
16098
16342
|
return;
|
|
16099
16343
|
}
|
|
16100
16344
|
for (const migration of applied) {
|
|
16101
16345
|
console.error(
|
|
16102
|
-
|
|
16346
|
+
chalk133.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
16103
16347
|
);
|
|
16104
16348
|
}
|
|
16105
16349
|
}
|
|
16106
16350
|
function reportMigrationStatus(status3) {
|
|
16107
16351
|
if (status3.state === "in-sync") {
|
|
16108
16352
|
console.error(
|
|
16109
|
-
|
|
16353
|
+
chalk133.green(`In sync at migration ${status3.version} (latest).`)
|
|
16110
16354
|
);
|
|
16111
16355
|
return;
|
|
16112
16356
|
}
|
|
16113
16357
|
if (status3.state === "behind") {
|
|
16114
16358
|
console.error(
|
|
16115
|
-
|
|
16359
|
+
chalk133.yellow(
|
|
16116
16360
|
`Behind: applied ${status3.applied}, build expects ${status3.expected}.`
|
|
16117
16361
|
)
|
|
16118
16362
|
);
|
|
16119
16363
|
console.error(
|
|
16120
|
-
|
|
16364
|
+
chalk133.yellow(
|
|
16121
16365
|
`Pending: ${status3.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
16122
16366
|
)
|
|
16123
16367
|
);
|
|
16124
16368
|
return;
|
|
16125
16369
|
}
|
|
16126
16370
|
console.error(
|
|
16127
|
-
|
|
16371
|
+
chalk133.red(
|
|
16128
16372
|
`Ahead: applied ${status3.applied}, build knows ${status3.expected}. Update assist.`
|
|
16129
16373
|
)
|
|
16130
16374
|
);
|
|
@@ -16159,7 +16403,7 @@ function registerDb(program2) {
|
|
|
16159
16403
|
|
|
16160
16404
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
16161
16405
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync26 } from "fs";
|
|
16162
|
-
import
|
|
16406
|
+
import chalk134 from "chalk";
|
|
16163
16407
|
|
|
16164
16408
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
16165
16409
|
import { join as join35 } from "path";
|
|
@@ -16190,7 +16434,7 @@ function dbMigrationConfirm(pin) {
|
|
|
16190
16434
|
sweepRestrictedDir();
|
|
16191
16435
|
const state = readMigrationPinState(pin);
|
|
16192
16436
|
if (!state) {
|
|
16193
|
-
console.error(
|
|
16437
|
+
console.error(chalk134.red(`No pending migration unlock for pin: ${pin}`));
|
|
16194
16438
|
process.exitCode = 1;
|
|
16195
16439
|
return;
|
|
16196
16440
|
}
|
|
@@ -16200,7 +16444,7 @@ function dbMigrationConfirm(pin) {
|
|
|
16200
16444
|
);
|
|
16201
16445
|
unlinkSync9(getMigrationPinPath(pin));
|
|
16202
16446
|
console.log(
|
|
16203
|
-
|
|
16447
|
+
chalk134.green(
|
|
16204
16448
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
16205
16449
|
)
|
|
16206
16450
|
);
|
|
@@ -16209,7 +16453,7 @@ function dbMigrationConfirm(pin) {
|
|
|
16209
16453
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
16210
16454
|
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync27 } from "fs";
|
|
16211
16455
|
import { randomInt as randomInt2 } from "crypto";
|
|
16212
|
-
import
|
|
16456
|
+
import chalk135 from "chalk";
|
|
16213
16457
|
|
|
16214
16458
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
16215
16459
|
function nextMigrationId() {
|
|
@@ -16224,7 +16468,7 @@ function dbMigrationUnlock() {
|
|
|
16224
16468
|
sweepRestrictedDir();
|
|
16225
16469
|
writeFileSync27(getMigrationPinPath(pin), JSON.stringify({ pin, migrationId }));
|
|
16226
16470
|
console.error(
|
|
16227
|
-
|
|
16471
|
+
chalk135.yellow.bold(
|
|
16228
16472
|
"THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a new database migration.\nA schema change is hard to reverse once shipped. You had BETTER have confirmed\nthe change with the user and be certain this migration is genuinely necessary."
|
|
16229
16473
|
)
|
|
16230
16474
|
);
|
|
@@ -16234,7 +16478,7 @@ function dbMigrationUnlock() {
|
|
|
16234
16478
|
});
|
|
16235
16479
|
if (!delivered) {
|
|
16236
16480
|
console.error(
|
|
16237
|
-
|
|
16481
|
+
chalk135.red(
|
|
16238
16482
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
16239
16483
|
)
|
|
16240
16484
|
);
|
|
@@ -16244,7 +16488,7 @@ function dbMigrationUnlock() {
|
|
|
16244
16488
|
console.log(
|
|
16245
16489
|
`A confirmation pin was sent to your desktop notifications.
|
|
16246
16490
|
To approve creating migration ${migrationId}, run:
|
|
16247
|
-
${
|
|
16491
|
+
${chalk135.cyan(" assist db-migration confirm <PIN>")}
|
|
16248
16492
|
using the pin from that notification.`
|
|
16249
16493
|
);
|
|
16250
16494
|
}
|
|
@@ -16264,7 +16508,7 @@ function registerDbMigration(parent) {
|
|
|
16264
16508
|
|
|
16265
16509
|
// src/commands/deploy/redirect.ts
|
|
16266
16510
|
import { existsSync as existsSync35, readFileSync as readFileSync30, writeFileSync as writeFileSync28 } from "fs";
|
|
16267
|
-
import
|
|
16511
|
+
import chalk136 from "chalk";
|
|
16268
16512
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
16269
16513
|
if (!window.location.pathname.endsWith('/')) {
|
|
16270
16514
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -16273,23 +16517,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
16273
16517
|
function redirect() {
|
|
16274
16518
|
const indexPath = "index.html";
|
|
16275
16519
|
if (!existsSync35(indexPath)) {
|
|
16276
|
-
console.log(
|
|
16520
|
+
console.log(chalk136.yellow("No index.html found"));
|
|
16277
16521
|
return;
|
|
16278
16522
|
}
|
|
16279
16523
|
const content = readFileSync30(indexPath, "utf8");
|
|
16280
16524
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
16281
|
-
console.log(
|
|
16525
|
+
console.log(chalk136.dim("Trailing slash script already present"));
|
|
16282
16526
|
return;
|
|
16283
16527
|
}
|
|
16284
16528
|
const headCloseIndex = content.indexOf("</head>");
|
|
16285
16529
|
if (headCloseIndex === -1) {
|
|
16286
|
-
console.log(
|
|
16530
|
+
console.log(chalk136.red("Could not find </head> tag in index.html"));
|
|
16287
16531
|
return;
|
|
16288
16532
|
}
|
|
16289
16533
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
16290
16534
|
${content.slice(headCloseIndex)}`;
|
|
16291
16535
|
writeFileSync28(indexPath, newContent);
|
|
16292
|
-
console.log(
|
|
16536
|
+
console.log(chalk136.green("Added trailing slash redirect to index.html"));
|
|
16293
16537
|
}
|
|
16294
16538
|
|
|
16295
16539
|
// src/commands/registerDeploy.ts
|
|
@@ -16316,7 +16560,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
16316
16560
|
|
|
16317
16561
|
// src/commands/devlog/shared.ts
|
|
16318
16562
|
import { execSync as execSync35 } from "child_process";
|
|
16319
|
-
import
|
|
16563
|
+
import chalk137 from "chalk";
|
|
16320
16564
|
|
|
16321
16565
|
// src/shared/getRepoName.ts
|
|
16322
16566
|
import { existsSync as existsSync36, readFileSync as readFileSync31 } from "fs";
|
|
@@ -16425,13 +16669,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
16425
16669
|
}
|
|
16426
16670
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
16427
16671
|
for (const commit2 of commits2) {
|
|
16428
|
-
console.log(` ${
|
|
16672
|
+
console.log(` ${chalk137.yellow(commit2.hash)} ${commit2.message}`);
|
|
16429
16673
|
if (verbose) {
|
|
16430
16674
|
const visibleFiles = commit2.files.filter(
|
|
16431
16675
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
16432
16676
|
);
|
|
16433
16677
|
for (const file of visibleFiles) {
|
|
16434
|
-
console.log(` ${
|
|
16678
|
+
console.log(` ${chalk137.dim(file)}`);
|
|
16435
16679
|
}
|
|
16436
16680
|
}
|
|
16437
16681
|
}
|
|
@@ -16456,15 +16700,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
16456
16700
|
}
|
|
16457
16701
|
|
|
16458
16702
|
// src/commands/devlog/list/printDateHeader.ts
|
|
16459
|
-
import
|
|
16703
|
+
import chalk138 from "chalk";
|
|
16460
16704
|
function printDateHeader(date, isSkipped, entries) {
|
|
16461
16705
|
if (isSkipped) {
|
|
16462
|
-
console.log(`${
|
|
16706
|
+
console.log(`${chalk138.bold.blue(date)} ${chalk138.dim("skipped")}`);
|
|
16463
16707
|
} else if (entries && entries.length > 0) {
|
|
16464
|
-
const entryInfo = entries.map((e) => `${
|
|
16465
|
-
console.log(`${
|
|
16708
|
+
const entryInfo = entries.map((e) => `${chalk138.green(e.version)} ${e.title}`).join(" | ");
|
|
16709
|
+
console.log(`${chalk138.bold.blue(date)} ${entryInfo}`);
|
|
16466
16710
|
} else {
|
|
16467
|
-
console.log(`${
|
|
16711
|
+
console.log(`${chalk138.bold.blue(date)} ${chalk138.red("\u26A0 devlog missing")}`);
|
|
16468
16712
|
}
|
|
16469
16713
|
}
|
|
16470
16714
|
|
|
@@ -16568,24 +16812,24 @@ function bumpVersion(version2, type) {
|
|
|
16568
16812
|
|
|
16569
16813
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
16570
16814
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
16571
|
-
import
|
|
16815
|
+
import chalk140 from "chalk";
|
|
16572
16816
|
|
|
16573
16817
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
16574
|
-
import
|
|
16818
|
+
import chalk139 from "chalk";
|
|
16575
16819
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
16576
16820
|
if (conventional && firstHash) {
|
|
16577
16821
|
const version2 = getVersionAtCommit(firstHash);
|
|
16578
16822
|
if (version2) {
|
|
16579
|
-
console.log(`${
|
|
16823
|
+
console.log(`${chalk139.bold("version:")} ${stripToMinor(version2)}`);
|
|
16580
16824
|
} else {
|
|
16581
|
-
console.log(`${
|
|
16825
|
+
console.log(`${chalk139.bold("version:")} ${chalk139.red("unknown")}`);
|
|
16582
16826
|
}
|
|
16583
16827
|
} else if (patchVersion && minorVersion) {
|
|
16584
16828
|
console.log(
|
|
16585
|
-
`${
|
|
16829
|
+
`${chalk139.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
16586
16830
|
);
|
|
16587
16831
|
} else {
|
|
16588
|
-
console.log(`${
|
|
16832
|
+
console.log(`${chalk139.bold("version:")} v0.1 (initial)`);
|
|
16589
16833
|
}
|
|
16590
16834
|
}
|
|
16591
16835
|
|
|
@@ -16633,16 +16877,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
16633
16877
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
16634
16878
|
}
|
|
16635
16879
|
function logName(repoName) {
|
|
16636
|
-
console.log(`${
|
|
16880
|
+
console.log(`${chalk140.bold("name:")} ${repoName}`);
|
|
16637
16881
|
}
|
|
16638
16882
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
16639
16883
|
logName(ctx.repoName);
|
|
16640
16884
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
16641
|
-
console.log(
|
|
16885
|
+
console.log(chalk140.bold.blue(targetDate));
|
|
16642
16886
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
16643
16887
|
}
|
|
16644
16888
|
function logNoCommits(lastInfo) {
|
|
16645
|
-
console.log(
|
|
16889
|
+
console.log(chalk140.dim(noCommitsMessage(!!lastInfo)));
|
|
16646
16890
|
}
|
|
16647
16891
|
|
|
16648
16892
|
// src/commands/devlog/next/index.ts
|
|
@@ -16683,11 +16927,11 @@ function next2(options2) {
|
|
|
16683
16927
|
import { execSync as execSync37 } from "child_process";
|
|
16684
16928
|
|
|
16685
16929
|
// src/commands/devlog/repos/printReposTable.ts
|
|
16686
|
-
import
|
|
16930
|
+
import chalk141 from "chalk";
|
|
16687
16931
|
function colorStatus(status3) {
|
|
16688
|
-
if (status3 === "missing") return
|
|
16689
|
-
if (status3 === "outdated") return
|
|
16690
|
-
return
|
|
16932
|
+
if (status3 === "missing") return chalk141.red(status3);
|
|
16933
|
+
if (status3 === "outdated") return chalk141.yellow(status3);
|
|
16934
|
+
return chalk141.green(status3);
|
|
16691
16935
|
}
|
|
16692
16936
|
function formatRow(row, nameWidth) {
|
|
16693
16937
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -16701,8 +16945,8 @@ function printReposTable(rows) {
|
|
|
16701
16945
|
"Last Devlog".padEnd(11),
|
|
16702
16946
|
"Status"
|
|
16703
16947
|
].join(" ");
|
|
16704
|
-
console.log(
|
|
16705
|
-
console.log(
|
|
16948
|
+
console.log(chalk141.dim(header));
|
|
16949
|
+
console.log(chalk141.dim("-".repeat(header.length)));
|
|
16706
16950
|
for (const row of rows) {
|
|
16707
16951
|
console.log(formatRow(row, nameWidth));
|
|
16708
16952
|
}
|
|
@@ -16760,14 +17004,14 @@ function repos(options2) {
|
|
|
16760
17004
|
// src/commands/devlog/skip.ts
|
|
16761
17005
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
16762
17006
|
import { join as join39 } from "path";
|
|
16763
|
-
import
|
|
17007
|
+
import chalk142 from "chalk";
|
|
16764
17008
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
16765
17009
|
function getBlogConfigPath() {
|
|
16766
17010
|
return join39(BLOG_REPO_ROOT, "assist.yml");
|
|
16767
17011
|
}
|
|
16768
17012
|
function skip(date) {
|
|
16769
17013
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
16770
|
-
console.log(
|
|
17014
|
+
console.log(chalk142.red("Invalid date format. Use YYYY-MM-DD"));
|
|
16771
17015
|
process.exit(1);
|
|
16772
17016
|
}
|
|
16773
17017
|
const repoName = getRepoName();
|
|
@@ -16778,7 +17022,7 @@ function skip(date) {
|
|
|
16778
17022
|
const skipDays = skip2[repoName] ?? [];
|
|
16779
17023
|
if (skipDays.includes(date)) {
|
|
16780
17024
|
console.log(
|
|
16781
|
-
|
|
17025
|
+
chalk142.yellow(`${date} is already in skip list for ${repoName}`)
|
|
16782
17026
|
);
|
|
16783
17027
|
return;
|
|
16784
17028
|
}
|
|
@@ -16788,20 +17032,20 @@ function skip(date) {
|
|
|
16788
17032
|
devlog.skip = skip2;
|
|
16789
17033
|
config.devlog = devlog;
|
|
16790
17034
|
writeFileSync29(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
16791
|
-
console.log(
|
|
17035
|
+
console.log(chalk142.green(`Added ${date} to skip list for ${repoName}`));
|
|
16792
17036
|
}
|
|
16793
17037
|
|
|
16794
17038
|
// src/commands/devlog/version.ts
|
|
16795
|
-
import
|
|
17039
|
+
import chalk143 from "chalk";
|
|
16796
17040
|
function version() {
|
|
16797
17041
|
const config = loadConfig();
|
|
16798
17042
|
const name = getRepoName();
|
|
16799
17043
|
const lastInfo = getLastVersionInfo(name, config);
|
|
16800
17044
|
const lastVersion = lastInfo?.version ?? null;
|
|
16801
17045
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
16802
|
-
console.log(`${
|
|
16803
|
-
console.log(`${
|
|
16804
|
-
console.log(`${
|
|
17046
|
+
console.log(`${chalk143.bold("name:")} ${name}`);
|
|
17047
|
+
console.log(`${chalk143.bold("last:")} ${lastVersion ?? chalk143.dim("none")}`);
|
|
17048
|
+
console.log(`${chalk143.bold("next:")} ${nextVersion ?? chalk143.dim("none")}`);
|
|
16805
17049
|
}
|
|
16806
17050
|
|
|
16807
17051
|
// src/commands/devlog/devlogConfigHelp.ts
|
|
@@ -16845,7 +17089,7 @@ function registerDevlog(program2) {
|
|
|
16845
17089
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
16846
17090
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync5 } from "fs";
|
|
16847
17091
|
import { join as join40 } from "path";
|
|
16848
|
-
import
|
|
17092
|
+
import chalk144 from "chalk";
|
|
16849
17093
|
|
|
16850
17094
|
// src/shared/findRepoRoot.ts
|
|
16851
17095
|
import { existsSync as existsSync37 } from "fs";
|
|
@@ -16908,14 +17152,14 @@ function checkBuildLocks(startDir) {
|
|
|
16908
17152
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
16909
17153
|
if (locked) {
|
|
16910
17154
|
console.error(
|
|
16911
|
-
|
|
17155
|
+
chalk144.red("Build output locked (is VS debugging?): ") + locked
|
|
16912
17156
|
);
|
|
16913
17157
|
process.exit(1);
|
|
16914
17158
|
}
|
|
16915
17159
|
}
|
|
16916
17160
|
async function checkBuildLocksCommand() {
|
|
16917
17161
|
checkBuildLocks();
|
|
16918
|
-
console.log(
|
|
17162
|
+
console.log(chalk144.green("No build locks detected"));
|
|
16919
17163
|
}
|
|
16920
17164
|
|
|
16921
17165
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -17014,30 +17258,30 @@ function escapeRegex(s) {
|
|
|
17014
17258
|
}
|
|
17015
17259
|
|
|
17016
17260
|
// src/commands/dotnet/printTree.ts
|
|
17017
|
-
import
|
|
17261
|
+
import chalk145 from "chalk";
|
|
17018
17262
|
function printNodes(nodes, prefix2) {
|
|
17019
17263
|
for (let i = 0; i < nodes.length; i++) {
|
|
17020
17264
|
const isLast = i === nodes.length - 1;
|
|
17021
17265
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
17022
17266
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
17023
17267
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
17024
|
-
const label2 = isMissing ?
|
|
17268
|
+
const label2 = isMissing ? chalk145.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
17025
17269
|
console.log(`${prefix2}${connector}${label2}`);
|
|
17026
17270
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
17027
17271
|
}
|
|
17028
17272
|
}
|
|
17029
17273
|
function printTree(tree, totalCount, solutions) {
|
|
17030
|
-
console.log(
|
|
17031
|
-
console.log(
|
|
17274
|
+
console.log(chalk145.bold("\nProject Dependency Tree"));
|
|
17275
|
+
console.log(chalk145.cyan(tree.relativePath));
|
|
17032
17276
|
printNodes(tree.children, "");
|
|
17033
|
-
console.log(
|
|
17277
|
+
console.log(chalk145.dim(`
|
|
17034
17278
|
${totalCount} projects total (including root)`));
|
|
17035
|
-
console.log(
|
|
17279
|
+
console.log(chalk145.bold("\nSolution Membership"));
|
|
17036
17280
|
if (solutions.length === 0) {
|
|
17037
|
-
console.log(
|
|
17281
|
+
console.log(chalk145.yellow(" Not found in any .sln"));
|
|
17038
17282
|
} else {
|
|
17039
17283
|
for (const sln of solutions) {
|
|
17040
|
-
console.log(` ${
|
|
17284
|
+
console.log(` ${chalk145.green(sln)}`);
|
|
17041
17285
|
}
|
|
17042
17286
|
}
|
|
17043
17287
|
console.log();
|
|
@@ -17066,16 +17310,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
17066
17310
|
// src/commands/dotnet/resolveCsproj.ts
|
|
17067
17311
|
import { existsSync as existsSync38 } from "fs";
|
|
17068
17312
|
import path33 from "path";
|
|
17069
|
-
import
|
|
17313
|
+
import chalk146 from "chalk";
|
|
17070
17314
|
function resolveCsproj(csprojPath) {
|
|
17071
17315
|
const resolved = path33.resolve(csprojPath);
|
|
17072
17316
|
if (!existsSync38(resolved)) {
|
|
17073
|
-
console.error(
|
|
17317
|
+
console.error(chalk146.red(`File not found: ${resolved}`));
|
|
17074
17318
|
process.exit(1);
|
|
17075
17319
|
}
|
|
17076
17320
|
const repoRoot = findRepoRoot(path33.dirname(resolved));
|
|
17077
17321
|
if (!repoRoot) {
|
|
17078
|
-
console.error(
|
|
17322
|
+
console.error(chalk146.red("Could not find git repository root"));
|
|
17079
17323
|
process.exit(1);
|
|
17080
17324
|
}
|
|
17081
17325
|
return { resolved, repoRoot };
|
|
@@ -17125,12 +17369,12 @@ function getChangedCsFiles(scope) {
|
|
|
17125
17369
|
}
|
|
17126
17370
|
|
|
17127
17371
|
// src/commands/dotnet/inSln.ts
|
|
17128
|
-
import
|
|
17372
|
+
import chalk147 from "chalk";
|
|
17129
17373
|
async function inSln(csprojPath) {
|
|
17130
17374
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
17131
17375
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
17132
17376
|
if (solutions.length === 0) {
|
|
17133
|
-
console.log(
|
|
17377
|
+
console.log(chalk147.yellow("Not found in any .sln file"));
|
|
17134
17378
|
process.exit(1);
|
|
17135
17379
|
}
|
|
17136
17380
|
for (const sln of solutions) {
|
|
@@ -17139,7 +17383,7 @@ async function inSln(csprojPath) {
|
|
|
17139
17383
|
}
|
|
17140
17384
|
|
|
17141
17385
|
// src/commands/dotnet/inspect.ts
|
|
17142
|
-
import
|
|
17386
|
+
import chalk153 from "chalk";
|
|
17143
17387
|
|
|
17144
17388
|
// src/shared/formatElapsed.ts
|
|
17145
17389
|
function formatElapsed(ms) {
|
|
@@ -17151,12 +17395,12 @@ function formatElapsed(ms) {
|
|
|
17151
17395
|
}
|
|
17152
17396
|
|
|
17153
17397
|
// src/commands/dotnet/displayIssues.ts
|
|
17154
|
-
import
|
|
17398
|
+
import chalk148 from "chalk";
|
|
17155
17399
|
var SEVERITY_COLOR = {
|
|
17156
|
-
ERROR:
|
|
17157
|
-
WARNING:
|
|
17158
|
-
SUGGESTION:
|
|
17159
|
-
HINT:
|
|
17400
|
+
ERROR: chalk148.red,
|
|
17401
|
+
WARNING: chalk148.yellow,
|
|
17402
|
+
SUGGESTION: chalk148.cyan,
|
|
17403
|
+
HINT: chalk148.dim
|
|
17160
17404
|
};
|
|
17161
17405
|
function groupByFile(issues) {
|
|
17162
17406
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -17172,15 +17416,15 @@ function groupByFile(issues) {
|
|
|
17172
17416
|
}
|
|
17173
17417
|
function displayIssues(issues) {
|
|
17174
17418
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
17175
|
-
console.log(
|
|
17419
|
+
console.log(chalk148.bold(file));
|
|
17176
17420
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
17177
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
17421
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk148.white;
|
|
17178
17422
|
console.log(
|
|
17179
|
-
` ${
|
|
17423
|
+
` ${chalk148.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
17180
17424
|
);
|
|
17181
17425
|
}
|
|
17182
17426
|
}
|
|
17183
|
-
console.log(
|
|
17427
|
+
console.log(chalk148.dim(`
|
|
17184
17428
|
${issues.length} issue(s) found`));
|
|
17185
17429
|
}
|
|
17186
17430
|
|
|
@@ -17239,12 +17483,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
17239
17483
|
// src/commands/dotnet/resolveSolution.ts
|
|
17240
17484
|
import { existsSync as existsSync39 } from "fs";
|
|
17241
17485
|
import path34 from "path";
|
|
17242
|
-
import
|
|
17486
|
+
import chalk150 from "chalk";
|
|
17243
17487
|
|
|
17244
17488
|
// src/commands/dotnet/findSolution.ts
|
|
17245
17489
|
import { readdirSync as readdirSync7 } from "fs";
|
|
17246
17490
|
import { dirname as dirname22, join as join41 } from "path";
|
|
17247
|
-
import
|
|
17491
|
+
import chalk149 from "chalk";
|
|
17248
17492
|
function findSlnInDir(dir) {
|
|
17249
17493
|
try {
|
|
17250
17494
|
return readdirSync7(dir).filter((f) => f.endsWith(".sln")).map((f) => join41(dir, f));
|
|
@@ -17260,17 +17504,17 @@ function findSolution() {
|
|
|
17260
17504
|
const slnFiles = findSlnInDir(current);
|
|
17261
17505
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
17262
17506
|
if (slnFiles.length > 1) {
|
|
17263
|
-
console.error(
|
|
17507
|
+
console.error(chalk149.red(`Multiple .sln files found in ${current}:`));
|
|
17264
17508
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
17265
17509
|
console.error(
|
|
17266
|
-
|
|
17510
|
+
chalk149.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
17267
17511
|
);
|
|
17268
17512
|
process.exit(1);
|
|
17269
17513
|
}
|
|
17270
17514
|
if (current === ceiling) break;
|
|
17271
17515
|
current = dirname22(current);
|
|
17272
17516
|
}
|
|
17273
|
-
console.error(
|
|
17517
|
+
console.error(chalk149.red("No .sln file found between cwd and repo root"));
|
|
17274
17518
|
process.exit(1);
|
|
17275
17519
|
}
|
|
17276
17520
|
|
|
@@ -17279,7 +17523,7 @@ function resolveSolution(sln) {
|
|
|
17279
17523
|
if (sln) {
|
|
17280
17524
|
const resolved = path34.resolve(sln);
|
|
17281
17525
|
if (!existsSync39(resolved)) {
|
|
17282
|
-
console.error(
|
|
17526
|
+
console.error(chalk150.red(`Solution file not found: ${resolved}`));
|
|
17283
17527
|
process.exit(1);
|
|
17284
17528
|
}
|
|
17285
17529
|
return resolved;
|
|
@@ -17321,14 +17565,14 @@ import { execSync as execSync39 } from "child_process";
|
|
|
17321
17565
|
import { existsSync as existsSync40, readFileSync as readFileSync35, unlinkSync as unlinkSync10 } from "fs";
|
|
17322
17566
|
import { tmpdir as tmpdir4 } from "os";
|
|
17323
17567
|
import path35 from "path";
|
|
17324
|
-
import
|
|
17568
|
+
import chalk151 from "chalk";
|
|
17325
17569
|
function assertJbInstalled() {
|
|
17326
17570
|
try {
|
|
17327
17571
|
execSync39("jb inspectcode --version", { stdio: "pipe" });
|
|
17328
17572
|
} catch {
|
|
17329
|
-
console.error(
|
|
17573
|
+
console.error(chalk151.red("jb is not installed. Install with:"));
|
|
17330
17574
|
console.error(
|
|
17331
|
-
|
|
17575
|
+
chalk151.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
17332
17576
|
);
|
|
17333
17577
|
process.exit(1);
|
|
17334
17578
|
}
|
|
@@ -17346,11 +17590,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
17346
17590
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
17347
17591
|
process.stderr.write(error.stderr);
|
|
17348
17592
|
}
|
|
17349
|
-
console.error(
|
|
17593
|
+
console.error(chalk151.red("jb inspectcode failed"));
|
|
17350
17594
|
process.exit(1);
|
|
17351
17595
|
}
|
|
17352
17596
|
if (!existsSync40(reportPath)) {
|
|
17353
|
-
console.error(
|
|
17597
|
+
console.error(chalk151.red("Report file not generated"));
|
|
17354
17598
|
process.exit(1);
|
|
17355
17599
|
}
|
|
17356
17600
|
const xml = readFileSync35(reportPath, "utf8");
|
|
@@ -17360,7 +17604,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
17360
17604
|
|
|
17361
17605
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
17362
17606
|
import { execSync as execSync40 } from "child_process";
|
|
17363
|
-
import
|
|
17607
|
+
import chalk152 from "chalk";
|
|
17364
17608
|
function resolveMsbuildPath() {
|
|
17365
17609
|
const { run: run4 } = loadConfig();
|
|
17366
17610
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -17372,9 +17616,9 @@ function assertMsbuildInstalled() {
|
|
|
17372
17616
|
try {
|
|
17373
17617
|
execSync40(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
17374
17618
|
} catch {
|
|
17375
|
-
console.error(
|
|
17619
|
+
console.error(chalk152.red(`msbuild not found at: ${msbuild}`));
|
|
17376
17620
|
console.error(
|
|
17377
|
-
|
|
17621
|
+
chalk152.yellow(
|
|
17378
17622
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
17379
17623
|
)
|
|
17380
17624
|
);
|
|
@@ -17421,17 +17665,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
17421
17665
|
// src/commands/dotnet/inspect.ts
|
|
17422
17666
|
function logScope(changedFiles2) {
|
|
17423
17667
|
if (changedFiles2 === null) {
|
|
17424
|
-
console.log(
|
|
17668
|
+
console.log(chalk153.dim("Inspecting full solution..."));
|
|
17425
17669
|
} else {
|
|
17426
17670
|
console.log(
|
|
17427
|
-
|
|
17671
|
+
chalk153.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
17428
17672
|
);
|
|
17429
17673
|
}
|
|
17430
17674
|
}
|
|
17431
17675
|
function reportResults(issues, elapsed) {
|
|
17432
17676
|
if (issues.length > 0) displayIssues(issues);
|
|
17433
|
-
else console.log(
|
|
17434
|
-
console.log(
|
|
17677
|
+
else console.log(chalk153.green("No issues found"));
|
|
17678
|
+
console.log(chalk153.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
17435
17679
|
if (issues.length > 0) process.exit(1);
|
|
17436
17680
|
}
|
|
17437
17681
|
async function inspect(sln, options2) {
|
|
@@ -17442,7 +17686,7 @@ async function inspect(sln, options2) {
|
|
|
17442
17686
|
const scope = parseScope(options2.scope);
|
|
17443
17687
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
17444
17688
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
17445
|
-
console.log(
|
|
17689
|
+
console.log(chalk153.green("No changed .cs files found"));
|
|
17446
17690
|
return;
|
|
17447
17691
|
}
|
|
17448
17692
|
logScope(changedFiles2);
|
|
@@ -17825,25 +18069,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
17825
18069
|
}
|
|
17826
18070
|
|
|
17827
18071
|
// src/commands/github/printCountTable.ts
|
|
17828
|
-
import
|
|
18072
|
+
import chalk154 from "chalk";
|
|
17829
18073
|
function printCountTable(labelHeader, rows) {
|
|
17830
18074
|
const labelWidth = Math.max(
|
|
17831
18075
|
labelHeader.length,
|
|
17832
18076
|
...rows.map((row) => row.label.length)
|
|
17833
18077
|
);
|
|
17834
18078
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
17835
|
-
console.log(
|
|
17836
|
-
console.log(
|
|
18079
|
+
console.log(chalk154.dim(header));
|
|
18080
|
+
console.log(chalk154.dim("-".repeat(header.length)));
|
|
17837
18081
|
for (const row of rows) {
|
|
17838
18082
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
17839
18083
|
}
|
|
17840
18084
|
}
|
|
17841
18085
|
|
|
17842
18086
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
17843
|
-
import
|
|
18087
|
+
import chalk155 from "chalk";
|
|
17844
18088
|
function printRepoAuthorBreakdown(repos2) {
|
|
17845
18089
|
for (const repo of repos2) {
|
|
17846
|
-
console.log(
|
|
18090
|
+
console.log(chalk155.bold(repo.name));
|
|
17847
18091
|
const authorWidth = Math.max(
|
|
17848
18092
|
0,
|
|
17849
18093
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -17940,9 +18184,9 @@ function registerGithub(program2) {
|
|
|
17940
18184
|
}
|
|
17941
18185
|
|
|
17942
18186
|
// src/commands/handover/countPendingHandovers.ts
|
|
17943
|
-
import { and as and20, eq as
|
|
18187
|
+
import { and as and20, eq as eq42, isNull, sql as sql18 } from "drizzle-orm";
|
|
17944
18188
|
async function countPendingHandovers(orm, origin) {
|
|
17945
|
-
const [row] = await orm.select({ count: sql18`count(*)::int` }).from(handovers).where(and20(
|
|
18189
|
+
const [row] = await orm.select({ count: sql18`count(*)::int` }).from(handovers).where(and20(eq42(handovers.origin, origin), isNull(handovers.recalledAt)));
|
|
17946
18190
|
return row?.count ?? 0;
|
|
17947
18191
|
}
|
|
17948
18192
|
|
|
@@ -18082,13 +18326,13 @@ async function load2(options2 = {}) {
|
|
|
18082
18326
|
}
|
|
18083
18327
|
|
|
18084
18328
|
// src/commands/handover/listPendingHandovers.ts
|
|
18085
|
-
import { and as and21, desc as desc4, eq as
|
|
18329
|
+
import { and as and21, desc as desc4, eq as eq43, isNull as isNull2 } from "drizzle-orm";
|
|
18086
18330
|
async function listPendingHandovers(orm, origin) {
|
|
18087
18331
|
return orm.select({
|
|
18088
18332
|
id: handovers.id,
|
|
18089
18333
|
summary: handovers.summary,
|
|
18090
18334
|
createdAt: handovers.createdAt
|
|
18091
|
-
}).from(handovers).where(and21(
|
|
18335
|
+
}).from(handovers).where(and21(eq43(handovers.origin, origin), isNull2(handovers.recalledAt))).orderBy(desc4(handovers.createdAt), desc4(handovers.id));
|
|
18092
18336
|
}
|
|
18093
18337
|
|
|
18094
18338
|
// src/commands/handover/printPendingHandovers.ts
|
|
@@ -18101,17 +18345,17 @@ async function printPendingHandovers() {
|
|
|
18101
18345
|
}
|
|
18102
18346
|
|
|
18103
18347
|
// src/commands/handover/recallHandover.ts
|
|
18104
|
-
import { and as and22, desc as desc5, eq as
|
|
18348
|
+
import { and as and22, desc as desc5, eq as eq44, isNull as isNull3 } from "drizzle-orm";
|
|
18105
18349
|
async function recallHandover(orm, origin, id) {
|
|
18106
18350
|
const [row] = await orm.select().from(handovers).where(
|
|
18107
18351
|
and22(
|
|
18108
|
-
|
|
18352
|
+
eq44(handovers.origin, origin),
|
|
18109
18353
|
isNull3(handovers.recalledAt),
|
|
18110
|
-
...id === void 0 ? [] : [
|
|
18354
|
+
...id === void 0 ? [] : [eq44(handovers.id, id)]
|
|
18111
18355
|
)
|
|
18112
18356
|
).orderBy(desc5(handovers.createdAt), desc5(handovers.id)).limit(1);
|
|
18113
18357
|
if (!row) return void 0;
|
|
18114
|
-
await orm.update(handovers).set({ recalledAt: /* @__PURE__ */ new Date() }).where(
|
|
18358
|
+
await orm.update(handovers).set({ recalledAt: /* @__PURE__ */ new Date() }).where(eq44(handovers.id, row.id));
|
|
18115
18359
|
return row.content;
|
|
18116
18360
|
}
|
|
18117
18361
|
|
|
@@ -18161,7 +18405,7 @@ function registerHandover(program2) {
|
|
|
18161
18405
|
}
|
|
18162
18406
|
|
|
18163
18407
|
// src/commands/jira/acceptanceCriteria.ts
|
|
18164
|
-
import
|
|
18408
|
+
import chalk156 from "chalk";
|
|
18165
18409
|
|
|
18166
18410
|
// src/commands/jira/adfToText.ts
|
|
18167
18411
|
function renderInline(node) {
|
|
@@ -18228,7 +18472,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
18228
18472
|
const parsed = fetchIssue(issueKey, field);
|
|
18229
18473
|
const acValue = parsed?.fields?.[field];
|
|
18230
18474
|
if (!acValue) {
|
|
18231
|
-
console.log(
|
|
18475
|
+
console.log(chalk156.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
18232
18476
|
return;
|
|
18233
18477
|
}
|
|
18234
18478
|
if (typeof acValue === "string") {
|
|
@@ -18294,14 +18538,14 @@ async function jiraAuth() {
|
|
|
18294
18538
|
}
|
|
18295
18539
|
|
|
18296
18540
|
// src/commands/jira/viewIssue.ts
|
|
18297
|
-
import
|
|
18541
|
+
import chalk157 from "chalk";
|
|
18298
18542
|
function viewIssue(issueKey) {
|
|
18299
18543
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
18300
18544
|
const fields = parsed?.fields;
|
|
18301
18545
|
const summary = fields?.summary;
|
|
18302
18546
|
const description = fields?.description;
|
|
18303
18547
|
if (summary) {
|
|
18304
|
-
console.log(
|
|
18548
|
+
console.log(chalk157.bold(summary));
|
|
18305
18549
|
}
|
|
18306
18550
|
if (description) {
|
|
18307
18551
|
if (summary) console.log();
|
|
@@ -18315,7 +18559,7 @@ function viewIssue(issueKey) {
|
|
|
18315
18559
|
}
|
|
18316
18560
|
if (!summary && !description) {
|
|
18317
18561
|
console.log(
|
|
18318
|
-
|
|
18562
|
+
chalk157.yellow(`No summary or description found on ${issueKey}.`)
|
|
18319
18563
|
);
|
|
18320
18564
|
}
|
|
18321
18565
|
}
|
|
@@ -18369,11 +18613,11 @@ function registerRefineLaunch(program2, resumeFlag) {
|
|
|
18369
18613
|
}
|
|
18370
18614
|
|
|
18371
18615
|
// src/commands/reviewPrComments.ts
|
|
18372
|
-
import { randomUUID as
|
|
18616
|
+
import { randomUUID as randomUUID6 } from "crypto";
|
|
18373
18617
|
|
|
18374
18618
|
// src/commands/review/checkoutPr.ts
|
|
18375
18619
|
import { execFileSync as execFileSync6 } from "child_process";
|
|
18376
|
-
import
|
|
18620
|
+
import chalk158 from "chalk";
|
|
18377
18621
|
|
|
18378
18622
|
// src/commands/sessions/daemon/daemonLog.ts
|
|
18379
18623
|
var RING_CAPACITY = 1e3;
|
|
@@ -18563,26 +18807,26 @@ function wouldDisturbWorkInProgress(clone, forCheckout) {
|
|
|
18563
18807
|
}
|
|
18564
18808
|
|
|
18565
18809
|
// src/commands/sessions/daemon/persistedSessionSchema.ts
|
|
18566
|
-
import { z as
|
|
18567
|
-
var persistedSessionSchema =
|
|
18568
|
-
name:
|
|
18569
|
-
title:
|
|
18570
|
-
generatedTitle:
|
|
18571
|
-
subtitle:
|
|
18572
|
-
commandType:
|
|
18573
|
-
harness:
|
|
18574
|
-
status:
|
|
18575
|
-
cwd:
|
|
18576
|
-
startedAt:
|
|
18577
|
-
runningMs:
|
|
18578
|
-
claudeSessionId:
|
|
18579
|
-
initialPrompt:
|
|
18580
|
-
runName:
|
|
18581
|
-
runArgs:
|
|
18582
|
-
assistArgs:
|
|
18810
|
+
import { z as z7 } from "zod";
|
|
18811
|
+
var persistedSessionSchema = z7.object({
|
|
18812
|
+
name: z7.string(),
|
|
18813
|
+
title: z7.string().optional(),
|
|
18814
|
+
generatedTitle: z7.string().optional(),
|
|
18815
|
+
subtitle: z7.string().optional(),
|
|
18816
|
+
commandType: z7.enum(["claude", "run", "assist"]),
|
|
18817
|
+
harness: z7.enum(["claude", "codex", "pi"]).optional(),
|
|
18818
|
+
status: z7.enum(["running", "waiting", "done", "error", "stopped"]).optional(),
|
|
18819
|
+
cwd: z7.string(),
|
|
18820
|
+
startedAt: z7.number(),
|
|
18821
|
+
runningMs: z7.number().optional(),
|
|
18822
|
+
claudeSessionId: z7.string().optional(),
|
|
18823
|
+
initialPrompt: z7.string().optional(),
|
|
18824
|
+
runName: z7.string().optional(),
|
|
18825
|
+
runArgs: z7.array(z7.string()).optional(),
|
|
18826
|
+
assistArgs: z7.array(z7.string()).optional(),
|
|
18583
18827
|
activity: activitySchema.optional(),
|
|
18584
|
-
starred:
|
|
18585
|
-
undurable:
|
|
18828
|
+
starred: z7.boolean().optional(),
|
|
18829
|
+
undurable: z7.object({ reason: z7.string(), removesTree: z7.boolean().optional() }).optional()
|
|
18586
18830
|
});
|
|
18587
18831
|
|
|
18588
18832
|
// src/commands/sessions/daemon/toPersistedSession.ts
|
|
@@ -18751,7 +18995,7 @@ async function checkoutPr(number) {
|
|
|
18751
18995
|
try {
|
|
18752
18996
|
execFileSync6("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
18753
18997
|
} catch {
|
|
18754
|
-
console.error(
|
|
18998
|
+
console.error(chalk158.red(`gh pr checkout ${number} failed; aborting.`));
|
|
18755
18999
|
process.exit(1);
|
|
18756
19000
|
}
|
|
18757
19001
|
}
|
|
@@ -18759,7 +19003,7 @@ async function checkoutPr(number) {
|
|
|
18759
19003
|
// src/commands/reviewPrComments.ts
|
|
18760
19004
|
async function reviewPrComments(number) {
|
|
18761
19005
|
if (number) await checkoutPr(number);
|
|
18762
|
-
const claudeSessionId =
|
|
19006
|
+
const claudeSessionId = randomUUID6();
|
|
18763
19007
|
emitActivity({
|
|
18764
19008
|
kind: "command",
|
|
18765
19009
|
name: "review-pr-comments",
|
|
@@ -18828,15 +19072,15 @@ function registerList(program2) {
|
|
|
18828
19072
|
// src/commands/mermaid/index.ts
|
|
18829
19073
|
import { mkdirSync as mkdirSync17, readdirSync as readdirSync9 } from "fs";
|
|
18830
19074
|
import { resolve as resolve13 } from "path";
|
|
18831
|
-
import
|
|
19075
|
+
import chalk161 from "chalk";
|
|
18832
19076
|
|
|
18833
19077
|
// src/commands/mermaid/exportFile.ts
|
|
18834
19078
|
import { readFileSync as readFileSync37, writeFileSync as writeFileSync31 } from "fs";
|
|
18835
19079
|
import { basename as basename13, extname as extname2, resolve as resolve12 } from "path";
|
|
18836
|
-
import
|
|
19080
|
+
import chalk160 from "chalk";
|
|
18837
19081
|
|
|
18838
19082
|
// src/commands/mermaid/renderBlock.ts
|
|
18839
|
-
import
|
|
19083
|
+
import chalk159 from "chalk";
|
|
18840
19084
|
async function renderBlock(krokiUrl, source) {
|
|
18841
19085
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
18842
19086
|
method: "POST",
|
|
@@ -18845,7 +19089,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
18845
19089
|
});
|
|
18846
19090
|
if (!response.ok) {
|
|
18847
19091
|
console.error(
|
|
18848
|
-
|
|
19092
|
+
chalk159.red(
|
|
18849
19093
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
18850
19094
|
)
|
|
18851
19095
|
);
|
|
@@ -18863,19 +19107,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
18863
19107
|
if (onlyIndex !== void 0) {
|
|
18864
19108
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
18865
19109
|
console.error(
|
|
18866
|
-
|
|
19110
|
+
chalk160.red(
|
|
18867
19111
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
18868
19112
|
)
|
|
18869
19113
|
);
|
|
18870
19114
|
process.exit(1);
|
|
18871
19115
|
}
|
|
18872
19116
|
console.log(
|
|
18873
|
-
|
|
19117
|
+
chalk160.gray(
|
|
18874
19118
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
18875
19119
|
)
|
|
18876
19120
|
);
|
|
18877
19121
|
} else {
|
|
18878
|
-
console.log(
|
|
19122
|
+
console.log(chalk160.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
18879
19123
|
}
|
|
18880
19124
|
for (const [i, source] of blocks.entries()) {
|
|
18881
19125
|
const idx = i + 1;
|
|
@@ -18883,7 +19127,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
18883
19127
|
const outPath = resolve12(outDir, `${stem}-${idx}.svg`);
|
|
18884
19128
|
const svg = await renderBlock(krokiUrl, source);
|
|
18885
19129
|
writeFileSync31(outPath, svg, "utf8");
|
|
18886
|
-
console.log(
|
|
19130
|
+
console.log(chalk160.green(` \u2192 ${outPath}`));
|
|
18887
19131
|
}
|
|
18888
19132
|
}
|
|
18889
19133
|
function extractMermaidBlocks(markdown) {
|
|
@@ -18899,18 +19143,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
18899
19143
|
if (options2.index !== void 0) {
|
|
18900
19144
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
18901
19145
|
console.error(
|
|
18902
|
-
|
|
19146
|
+
chalk161.red(`--index must be a positive integer (got ${options2.index})`)
|
|
18903
19147
|
);
|
|
18904
19148
|
process.exit(1);
|
|
18905
19149
|
}
|
|
18906
19150
|
if (!file) {
|
|
18907
|
-
console.error(
|
|
19151
|
+
console.error(chalk161.red("--index requires a file argument"));
|
|
18908
19152
|
process.exit(1);
|
|
18909
19153
|
}
|
|
18910
19154
|
}
|
|
18911
19155
|
const files = file ? [file] : readdirSync9(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
18912
19156
|
if (files.length === 0) {
|
|
18913
|
-
console.log(
|
|
19157
|
+
console.log(chalk161.gray("No markdown files found in current directory."));
|
|
18914
19158
|
return;
|
|
18915
19159
|
}
|
|
18916
19160
|
for (const f of files) {
|
|
@@ -18943,7 +19187,7 @@ function registerMermaid(program2) {
|
|
|
18943
19187
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
18944
19188
|
import { createServer as createServer2 } from "http";
|
|
18945
19189
|
import { dirname as dirname26 } from "path";
|
|
18946
|
-
import
|
|
19190
|
+
import chalk163 from "chalk";
|
|
18947
19191
|
|
|
18948
19192
|
// src/commands/netcap/corsHeaders.ts
|
|
18949
19193
|
var corsHeaders = {
|
|
@@ -19022,7 +19266,7 @@ function createNetcapHandler(options2) {
|
|
|
19022
19266
|
import { cp, readFile as readFile3, writeFile as writeFile3 } from "fs/promises";
|
|
19023
19267
|
import { networkInterfaces } from "os";
|
|
19024
19268
|
import { join as join50 } from "path";
|
|
19025
|
-
import
|
|
19269
|
+
import chalk162 from "chalk";
|
|
19026
19270
|
|
|
19027
19271
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
19028
19272
|
import { dirname as dirname25, join as join49 } from "path";
|
|
@@ -19066,7 +19310,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
19066
19310
|
const host = lanIPv4();
|
|
19067
19311
|
if (!host) {
|
|
19068
19312
|
console.log(
|
|
19069
|
-
|
|
19313
|
+
chalk162.yellow("could not determine the WSL IP for the extension")
|
|
19070
19314
|
);
|
|
19071
19315
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
19072
19316
|
return source;
|
|
@@ -19077,7 +19321,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
19077
19321
|
return WSL_WINDOWS_PATH;
|
|
19078
19322
|
} catch {
|
|
19079
19323
|
console.log(
|
|
19080
|
-
|
|
19324
|
+
chalk162.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
19081
19325
|
);
|
|
19082
19326
|
return source;
|
|
19083
19327
|
}
|
|
@@ -19110,30 +19354,30 @@ async function netcap(options2) {
|
|
|
19110
19354
|
let count8 = 0;
|
|
19111
19355
|
const handler = createNetcapHandler({
|
|
19112
19356
|
outPath,
|
|
19113
|
-
onPing: () => console.log(
|
|
19357
|
+
onPing: () => console.log(chalk163.dim("ping from extension")),
|
|
19114
19358
|
onCapture: (entry) => {
|
|
19115
19359
|
count8 += 1;
|
|
19116
19360
|
console.log(
|
|
19117
|
-
|
|
19118
|
-
|
|
19361
|
+
chalk163.green(`captured #${count8}`),
|
|
19362
|
+
chalk163.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
19119
19363
|
);
|
|
19120
19364
|
}
|
|
19121
19365
|
});
|
|
19122
19366
|
const server = createServer2(handler);
|
|
19123
19367
|
server.listen(port, () => {
|
|
19124
19368
|
console.log(
|
|
19125
|
-
|
|
19369
|
+
chalk163.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
19126
19370
|
);
|
|
19127
|
-
console.log(
|
|
19371
|
+
console.log(chalk163.dim(`appending captures to ${outPath}`));
|
|
19128
19372
|
if (filter)
|
|
19129
|
-
console.log(
|
|
19130
|
-
console.log(
|
|
19131
|
-
console.log(
|
|
19373
|
+
console.log(chalk163.dim(`forwarding only URLs matching "${filter}"`));
|
|
19374
|
+
console.log(chalk163.dim(`load the unpacked extension from ${extensionPath}`));
|
|
19375
|
+
console.log(chalk163.dim("press Ctrl-C to stop"));
|
|
19132
19376
|
});
|
|
19133
19377
|
process.on("SIGINT", () => {
|
|
19134
19378
|
server.close();
|
|
19135
19379
|
console.log(
|
|
19136
|
-
|
|
19380
|
+
chalk163.bold(
|
|
19137
19381
|
`
|
|
19138
19382
|
netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
19139
19383
|
)
|
|
@@ -19145,7 +19389,7 @@ netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} t
|
|
|
19145
19389
|
// src/commands/netcap/netcapExtract.ts
|
|
19146
19390
|
import { writeFileSync as writeFileSync32 } from "fs";
|
|
19147
19391
|
import { join as join53 } from "path";
|
|
19148
|
-
import
|
|
19392
|
+
import chalk164 from "chalk";
|
|
19149
19393
|
|
|
19150
19394
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
19151
19395
|
import { readFileSync as readFileSync38 } from "fs";
|
|
@@ -19593,8 +19837,8 @@ function netcapExtract(file) {
|
|
|
19593
19837
|
writeFileSync32(outFile, `${JSON.stringify(posts, null, 2)}
|
|
19594
19838
|
`);
|
|
19595
19839
|
console.log(
|
|
19596
|
-
|
|
19597
|
-
|
|
19840
|
+
chalk164.green(`extracted ${posts.length} posts`),
|
|
19841
|
+
chalk164.dim(`-> ${outFile}`)
|
|
19598
19842
|
);
|
|
19599
19843
|
}
|
|
19600
19844
|
|
|
@@ -19615,7 +19859,7 @@ function registerNetcap(program2) {
|
|
|
19615
19859
|
}
|
|
19616
19860
|
|
|
19617
19861
|
// src/commands/news/add/index.ts
|
|
19618
|
-
import
|
|
19862
|
+
import chalk165 from "chalk";
|
|
19619
19863
|
import enquirer8 from "enquirer";
|
|
19620
19864
|
async function add2(url) {
|
|
19621
19865
|
if (!url) {
|
|
@@ -19637,10 +19881,10 @@ async function add2(url) {
|
|
|
19637
19881
|
const { orm } = await getReady();
|
|
19638
19882
|
const added = await addFeed(orm, url);
|
|
19639
19883
|
if (!added) {
|
|
19640
|
-
console.log(
|
|
19884
|
+
console.log(chalk165.yellow("Feed already exists"));
|
|
19641
19885
|
return;
|
|
19642
19886
|
}
|
|
19643
|
-
console.log(
|
|
19887
|
+
console.log(chalk165.green(`Added feed: ${url}`));
|
|
19644
19888
|
}
|
|
19645
19889
|
|
|
19646
19890
|
// src/commands/registerNews.ts
|
|
@@ -19687,7 +19931,7 @@ function registerPiHook(program2) {
|
|
|
19687
19931
|
}
|
|
19688
19932
|
|
|
19689
19933
|
// src/commands/prompts/printPromptsTable.ts
|
|
19690
|
-
import
|
|
19934
|
+
import chalk166 from "chalk";
|
|
19691
19935
|
function truncate(str, max) {
|
|
19692
19936
|
if (str.length <= max) return str;
|
|
19693
19937
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -19705,14 +19949,14 @@ function printPromptsTable(rows) {
|
|
|
19705
19949
|
"Command".padEnd(commandWidth),
|
|
19706
19950
|
"Repos"
|
|
19707
19951
|
].join(" ");
|
|
19708
|
-
console.log(
|
|
19709
|
-
console.log(
|
|
19952
|
+
console.log(chalk166.dim(header));
|
|
19953
|
+
console.log(chalk166.dim("-".repeat(header.length)));
|
|
19710
19954
|
for (const row of rows) {
|
|
19711
19955
|
const count8 = String(row.count).padStart(countWidth);
|
|
19712
19956
|
const tool = row.tool.padEnd(toolWidth);
|
|
19713
19957
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
19714
19958
|
console.log(
|
|
19715
|
-
`${
|
|
19959
|
+
`${chalk166.yellow(count8)} ${tool} ${command} ${chalk166.dim(row.repos)}`
|
|
19716
19960
|
);
|
|
19717
19961
|
}
|
|
19718
19962
|
}
|
|
@@ -20279,20 +20523,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
20279
20523
|
}
|
|
20280
20524
|
|
|
20281
20525
|
// src/commands/prs/listComments/printComments.ts
|
|
20282
|
-
import
|
|
20526
|
+
import chalk167 from "chalk";
|
|
20283
20527
|
function formatForHuman(comment3) {
|
|
20284
20528
|
if (comment3.type === "review") {
|
|
20285
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
20529
|
+
const stateColor = comment3.state === "APPROVED" ? chalk167.green : comment3.state === "CHANGES_REQUESTED" ? chalk167.red : chalk167.yellow;
|
|
20286
20530
|
return [
|
|
20287
|
-
`${
|
|
20531
|
+
`${chalk167.cyan("Review")} by ${chalk167.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
20288
20532
|
comment3.body,
|
|
20289
20533
|
""
|
|
20290
20534
|
].join("\n");
|
|
20291
20535
|
}
|
|
20292
20536
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
20293
20537
|
return [
|
|
20294
|
-
`${
|
|
20295
|
-
|
|
20538
|
+
`${chalk167.cyan("Line comment")} by ${chalk167.bold(comment3.user)} on ${chalk167.dim(`${comment3.path}${location}`)}`,
|
|
20539
|
+
chalk167.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
20296
20540
|
comment3.body,
|
|
20297
20541
|
""
|
|
20298
20542
|
].join("\n");
|
|
@@ -20382,13 +20626,13 @@ import { execSync as execSync48 } from "child_process";
|
|
|
20382
20626
|
import enquirer9 from "enquirer";
|
|
20383
20627
|
|
|
20384
20628
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
20385
|
-
import
|
|
20629
|
+
import chalk168 from "chalk";
|
|
20386
20630
|
var STATUS_MAP = {
|
|
20387
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
20388
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
20631
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk168.magenta("merged"), date: pr.mergedAt } : null,
|
|
20632
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk168.red("closed"), date: pr.closedAt } : null
|
|
20389
20633
|
};
|
|
20390
20634
|
function defaultStatus(pr) {
|
|
20391
|
-
return { label:
|
|
20635
|
+
return { label: chalk168.green("opened"), date: pr.createdAt };
|
|
20392
20636
|
}
|
|
20393
20637
|
function getStatus2(pr) {
|
|
20394
20638
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -20397,11 +20641,11 @@ function formatDate(dateStr) {
|
|
|
20397
20641
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
20398
20642
|
}
|
|
20399
20643
|
function formatPrHeader(pr, status3) {
|
|
20400
|
-
return `${
|
|
20644
|
+
return `${chalk168.cyan(`#${pr.number}`)} ${pr.title} ${chalk168.dim(`(${pr.author.login},`)} ${status3.label} ${chalk168.dim(`${formatDate(status3.date)})`)}`;
|
|
20401
20645
|
}
|
|
20402
20646
|
function logPrDetails(pr) {
|
|
20403
20647
|
console.log(
|
|
20404
|
-
|
|
20648
|
+
chalk168.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
20405
20649
|
);
|
|
20406
20650
|
console.log();
|
|
20407
20651
|
}
|
|
@@ -20615,7 +20859,7 @@ async function placePr(prNumber, title, body, options2) {
|
|
|
20615
20859
|
}
|
|
20616
20860
|
|
|
20617
20861
|
// src/commands/prs/previewAndPlace.ts
|
|
20618
|
-
import { randomUUID as
|
|
20862
|
+
import { randomUUID as randomUUID7 } from "crypto";
|
|
20619
20863
|
|
|
20620
20864
|
// src/commands/prs/appendScreenshots.ts
|
|
20621
20865
|
function appendScreenshots(body, screenshots) {
|
|
@@ -20631,7 +20875,7 @@ ${screenshots.join("\n\n")}`;
|
|
|
20631
20875
|
async function previewAndPlace(args) {
|
|
20632
20876
|
const decision = await awaitPreviewApproval("PR preview", {
|
|
20633
20877
|
sessionId: args.sessionId,
|
|
20634
|
-
requestId:
|
|
20878
|
+
requestId: randomUUID7(),
|
|
20635
20879
|
title: args.title,
|
|
20636
20880
|
body: args.body,
|
|
20637
20881
|
prNumber: args.prNumber
|
|
@@ -20916,10 +21160,10 @@ function registerPrs(program2) {
|
|
|
20916
21160
|
}
|
|
20917
21161
|
|
|
20918
21162
|
// src/commands/ravendb/ravendbAuth.ts
|
|
20919
|
-
import
|
|
21163
|
+
import chalk174 from "chalk";
|
|
20920
21164
|
|
|
20921
21165
|
// src/shared/createConnectionAuth.ts
|
|
20922
|
-
import
|
|
21166
|
+
import chalk169 from "chalk";
|
|
20923
21167
|
function listConnections(connections, format) {
|
|
20924
21168
|
if (connections.length === 0) {
|
|
20925
21169
|
console.log("No connections configured.");
|
|
@@ -20932,7 +21176,7 @@ function listConnections(connections, format) {
|
|
|
20932
21176
|
function removeConnection(connections, name, save) {
|
|
20933
21177
|
const filtered = connections.filter((c) => c.name !== name);
|
|
20934
21178
|
if (filtered.length === connections.length) {
|
|
20935
|
-
console.error(
|
|
21179
|
+
console.error(chalk169.red(`Connection "${name}" not found.`));
|
|
20936
21180
|
process.exit(1);
|
|
20937
21181
|
}
|
|
20938
21182
|
save(filtered);
|
|
@@ -20978,15 +21222,15 @@ function saveConnections(connections) {
|
|
|
20978
21222
|
}
|
|
20979
21223
|
|
|
20980
21224
|
// src/commands/ravendb/promptConnection.ts
|
|
20981
|
-
import
|
|
21225
|
+
import chalk172 from "chalk";
|
|
20982
21226
|
|
|
20983
21227
|
// src/commands/ravendb/selectOpSecret.ts
|
|
20984
|
-
import
|
|
21228
|
+
import chalk171 from "chalk";
|
|
20985
21229
|
import Enquirer2 from "enquirer";
|
|
20986
21230
|
|
|
20987
21231
|
// src/commands/ravendb/searchItems.ts
|
|
20988
21232
|
import { execSync as execSync51 } from "child_process";
|
|
20989
|
-
import
|
|
21233
|
+
import chalk170 from "chalk";
|
|
20990
21234
|
function opExec(args) {
|
|
20991
21235
|
return execSync51(`op ${args}`, {
|
|
20992
21236
|
encoding: "utf8",
|
|
@@ -20999,7 +21243,7 @@ function searchItems(search2) {
|
|
|
20999
21243
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
21000
21244
|
} catch {
|
|
21001
21245
|
console.error(
|
|
21002
|
-
|
|
21246
|
+
chalk170.red(
|
|
21003
21247
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
21004
21248
|
)
|
|
21005
21249
|
);
|
|
@@ -21013,7 +21257,7 @@ function getItemFields(itemId2) {
|
|
|
21013
21257
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
21014
21258
|
return item.fields.filter((f) => f.reference && f.label);
|
|
21015
21259
|
} catch {
|
|
21016
|
-
console.error(
|
|
21260
|
+
console.error(chalk170.red("Failed to get item details from 1Password."));
|
|
21017
21261
|
process.exit(1);
|
|
21018
21262
|
}
|
|
21019
21263
|
}
|
|
@@ -21032,7 +21276,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
21032
21276
|
}).run();
|
|
21033
21277
|
const items2 = searchItems(search2);
|
|
21034
21278
|
if (items2.length === 0) {
|
|
21035
|
-
console.error(
|
|
21279
|
+
console.error(chalk171.red(`No items found matching "${search2}".`));
|
|
21036
21280
|
process.exit(1);
|
|
21037
21281
|
}
|
|
21038
21282
|
const itemId2 = await selectOne(
|
|
@@ -21041,7 +21285,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
21041
21285
|
);
|
|
21042
21286
|
const fields = getItemFields(itemId2);
|
|
21043
21287
|
if (fields.length === 0) {
|
|
21044
|
-
console.error(
|
|
21288
|
+
console.error(chalk171.red("No fields with references found on this item."));
|
|
21045
21289
|
process.exit(1);
|
|
21046
21290
|
}
|
|
21047
21291
|
const ref = await selectOne(
|
|
@@ -21055,7 +21299,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
21055
21299
|
async function promptConnection(existingNames) {
|
|
21056
21300
|
const name = await promptInput("name", "Connection name:");
|
|
21057
21301
|
if (existingNames.includes(name)) {
|
|
21058
|
-
console.error(
|
|
21302
|
+
console.error(chalk172.red(`Connection "${name}" already exists.`));
|
|
21059
21303
|
process.exit(1);
|
|
21060
21304
|
}
|
|
21061
21305
|
const url = await promptInput(
|
|
@@ -21064,22 +21308,22 @@ async function promptConnection(existingNames) {
|
|
|
21064
21308
|
);
|
|
21065
21309
|
const database = await promptInput("database", "Database name:");
|
|
21066
21310
|
if (!name || !url || !database) {
|
|
21067
|
-
console.error(
|
|
21311
|
+
console.error(chalk172.red("All fields are required."));
|
|
21068
21312
|
process.exit(1);
|
|
21069
21313
|
}
|
|
21070
21314
|
const apiKeyRef = await selectOpSecret();
|
|
21071
|
-
console.log(
|
|
21315
|
+
console.log(chalk172.dim(`Using: ${apiKeyRef}`));
|
|
21072
21316
|
return { name, url, database, apiKeyRef };
|
|
21073
21317
|
}
|
|
21074
21318
|
|
|
21075
21319
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
21076
|
-
import
|
|
21320
|
+
import chalk173 from "chalk";
|
|
21077
21321
|
function ravendbSetConnection(name) {
|
|
21078
21322
|
const raw = loadGlobalConfigRaw();
|
|
21079
21323
|
const ravendb = raw.ravendb ?? {};
|
|
21080
21324
|
const connections = ravendb.connections ?? [];
|
|
21081
21325
|
if (!connections.some((c) => c.name === name)) {
|
|
21082
|
-
console.error(
|
|
21326
|
+
console.error(chalk173.red(`Connection "${name}" not found.`));
|
|
21083
21327
|
console.error(
|
|
21084
21328
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
21085
21329
|
);
|
|
@@ -21095,16 +21339,16 @@ function ravendbSetConnection(name) {
|
|
|
21095
21339
|
var ravendbAuth = createConnectionAuth({
|
|
21096
21340
|
load: loadConnections,
|
|
21097
21341
|
save: saveConnections,
|
|
21098
|
-
format: (c) => `${
|
|
21342
|
+
format: (c) => `${chalk174.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
21099
21343
|
promptNew: promptConnection,
|
|
21100
21344
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
21101
21345
|
});
|
|
21102
21346
|
|
|
21103
21347
|
// src/commands/ravendb/ravendbCollections.ts
|
|
21104
|
-
import
|
|
21348
|
+
import chalk178 from "chalk";
|
|
21105
21349
|
|
|
21106
21350
|
// src/commands/ravendb/ravenFetch.ts
|
|
21107
|
-
import
|
|
21351
|
+
import chalk176 from "chalk";
|
|
21108
21352
|
|
|
21109
21353
|
// src/commands/ravendb/getAccessToken.ts
|
|
21110
21354
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -21141,10 +21385,10 @@ ${errorText}`
|
|
|
21141
21385
|
|
|
21142
21386
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
21143
21387
|
import { execSync as execSync52 } from "child_process";
|
|
21144
|
-
import
|
|
21388
|
+
import chalk175 from "chalk";
|
|
21145
21389
|
function resolveOpSecret(reference) {
|
|
21146
21390
|
if (!reference.startsWith("op://")) {
|
|
21147
|
-
console.error(
|
|
21391
|
+
console.error(chalk175.red(`Invalid secret reference: must start with op://`));
|
|
21148
21392
|
process.exit(1);
|
|
21149
21393
|
}
|
|
21150
21394
|
try {
|
|
@@ -21154,7 +21398,7 @@ function resolveOpSecret(reference) {
|
|
|
21154
21398
|
}).trim();
|
|
21155
21399
|
} catch {
|
|
21156
21400
|
console.error(
|
|
21157
|
-
|
|
21401
|
+
chalk175.red(
|
|
21158
21402
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
21159
21403
|
)
|
|
21160
21404
|
);
|
|
@@ -21181,7 +21425,7 @@ async function ravenFetch(connection, path71) {
|
|
|
21181
21425
|
if (!response.ok) {
|
|
21182
21426
|
const body = await response.text();
|
|
21183
21427
|
console.error(
|
|
21184
|
-
|
|
21428
|
+
chalk176.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
21185
21429
|
);
|
|
21186
21430
|
console.error(body.substring(0, 500));
|
|
21187
21431
|
process.exit(1);
|
|
@@ -21190,7 +21434,7 @@ async function ravenFetch(connection, path71) {
|
|
|
21190
21434
|
}
|
|
21191
21435
|
|
|
21192
21436
|
// src/commands/ravendb/resolveConnection.ts
|
|
21193
|
-
import
|
|
21437
|
+
import chalk177 from "chalk";
|
|
21194
21438
|
function loadRavendb() {
|
|
21195
21439
|
const raw = loadGlobalConfigRaw();
|
|
21196
21440
|
const ravendb = raw.ravendb;
|
|
@@ -21204,7 +21448,7 @@ function resolveConnection(name) {
|
|
|
21204
21448
|
const connectionName = name ?? defaultConnection;
|
|
21205
21449
|
if (!connectionName) {
|
|
21206
21450
|
console.error(
|
|
21207
|
-
|
|
21451
|
+
chalk177.red(
|
|
21208
21452
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
21209
21453
|
)
|
|
21210
21454
|
);
|
|
@@ -21212,7 +21456,7 @@ function resolveConnection(name) {
|
|
|
21212
21456
|
}
|
|
21213
21457
|
const connection = connections.find((c) => c.name === connectionName);
|
|
21214
21458
|
if (!connection) {
|
|
21215
|
-
console.error(
|
|
21459
|
+
console.error(chalk177.red(`Connection "${connectionName}" not found.`));
|
|
21216
21460
|
console.error(
|
|
21217
21461
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
21218
21462
|
);
|
|
@@ -21243,7 +21487,7 @@ async function ravendbCollections(connectionName) {
|
|
|
21243
21487
|
return;
|
|
21244
21488
|
}
|
|
21245
21489
|
for (const c of collections) {
|
|
21246
|
-
console.log(`${
|
|
21490
|
+
console.log(`${chalk178.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
21247
21491
|
}
|
|
21248
21492
|
}
|
|
21249
21493
|
|
|
@@ -21262,10 +21506,10 @@ var ravendbConfigHelp = [
|
|
|
21262
21506
|
];
|
|
21263
21507
|
|
|
21264
21508
|
// src/commands/ravendb/ravendbQuery.ts
|
|
21265
|
-
import
|
|
21509
|
+
import chalk180 from "chalk";
|
|
21266
21510
|
|
|
21267
21511
|
// src/commands/ravendb/fetchAllPages.ts
|
|
21268
|
-
import
|
|
21512
|
+
import chalk179 from "chalk";
|
|
21269
21513
|
|
|
21270
21514
|
// src/commands/ravendb/buildQueryPath.ts
|
|
21271
21515
|
function buildQueryPath(opts) {
|
|
@@ -21303,7 +21547,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
21303
21547
|
allResults.push(...results);
|
|
21304
21548
|
start3 += results.length;
|
|
21305
21549
|
process.stderr.write(
|
|
21306
|
-
`\r${
|
|
21550
|
+
`\r${chalk179.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
21307
21551
|
);
|
|
21308
21552
|
if (start3 >= totalResults) break;
|
|
21309
21553
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -21318,7 +21562,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
21318
21562
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
21319
21563
|
const resolved = resolveArgs(connectionName, collection);
|
|
21320
21564
|
if (!resolved.collection && !options2.query) {
|
|
21321
|
-
console.error(
|
|
21565
|
+
console.error(chalk180.red("Provide a collection name or --query filter."));
|
|
21322
21566
|
process.exit(1);
|
|
21323
21567
|
}
|
|
21324
21568
|
const { collection: col } = resolved;
|
|
@@ -21357,7 +21601,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
21357
21601
|
import * as path36 from "path";
|
|
21358
21602
|
|
|
21359
21603
|
// src/commands/refactor/logViolations.ts
|
|
21360
|
-
import
|
|
21604
|
+
import chalk181 from "chalk";
|
|
21361
21605
|
var DEFAULT_MAX_LINES = 100;
|
|
21362
21606
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
21363
21607
|
if (violations.length === 0) {
|
|
@@ -21366,43 +21610,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
21366
21610
|
}
|
|
21367
21611
|
return;
|
|
21368
21612
|
}
|
|
21369
|
-
console.error(
|
|
21613
|
+
console.error(chalk181.red(`
|
|
21370
21614
|
Refactor check failed:
|
|
21371
21615
|
`));
|
|
21372
|
-
console.error(
|
|
21616
|
+
console.error(chalk181.red(` The following files exceed ${maxLines} lines:
|
|
21373
21617
|
`));
|
|
21374
21618
|
for (const violation of violations) {
|
|
21375
|
-
console.error(
|
|
21619
|
+
console.error(chalk181.red(` ${violation.file} (${violation.lines} lines)`));
|
|
21376
21620
|
}
|
|
21377
21621
|
console.error(
|
|
21378
|
-
|
|
21622
|
+
chalk181.yellow(
|
|
21379
21623
|
`
|
|
21380
21624
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
21381
21625
|
way to refactor it, ignore it with:
|
|
21382
21626
|
`
|
|
21383
21627
|
)
|
|
21384
21628
|
);
|
|
21385
|
-
console.error(
|
|
21629
|
+
console.error(chalk181.gray(` assist refactor ignore <file>
|
|
21386
21630
|
`));
|
|
21387
21631
|
if (process.env.CLAUDECODE) {
|
|
21388
|
-
console.error(
|
|
21632
|
+
console.error(chalk181.cyan(`
|
|
21389
21633
|
## Extracting Code to New Files
|
|
21390
21634
|
`));
|
|
21391
21635
|
console.error(
|
|
21392
|
-
|
|
21636
|
+
chalk181.cyan(
|
|
21393
21637
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
21394
21638
|
`
|
|
21395
21639
|
)
|
|
21396
21640
|
);
|
|
21397
21641
|
console.error(
|
|
21398
|
-
|
|
21642
|
+
chalk181.cyan(
|
|
21399
21643
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
21400
21644
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
21401
21645
|
`
|
|
21402
21646
|
)
|
|
21403
21647
|
);
|
|
21404
21648
|
console.error(
|
|
21405
|
-
|
|
21649
|
+
chalk181.cyan(
|
|
21406
21650
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
21407
21651
|
domains, move it to a common/shared folder.
|
|
21408
21652
|
`
|
|
@@ -21558,7 +21802,7 @@ async function check(pattern2, options2) {
|
|
|
21558
21802
|
|
|
21559
21803
|
// src/commands/refactor/extract/index.ts
|
|
21560
21804
|
import path44 from "path";
|
|
21561
|
-
import
|
|
21805
|
+
import chalk184 from "chalk";
|
|
21562
21806
|
|
|
21563
21807
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
21564
21808
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -22157,23 +22401,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
22157
22401
|
|
|
22158
22402
|
// src/commands/refactor/extract/displayPlan.ts
|
|
22159
22403
|
import path40 from "path";
|
|
22160
|
-
import
|
|
22404
|
+
import chalk182 from "chalk";
|
|
22161
22405
|
function section2(title) {
|
|
22162
22406
|
return `
|
|
22163
|
-
${
|
|
22407
|
+
${chalk182.cyan(title)}`;
|
|
22164
22408
|
}
|
|
22165
22409
|
function displayImporters(plan2, cwd) {
|
|
22166
22410
|
if (plan2.importersToUpdate.length === 0) return;
|
|
22167
22411
|
console.log(section2("Update importers:"));
|
|
22168
22412
|
for (const imp of plan2.importersToUpdate) {
|
|
22169
22413
|
const rel = path40.relative(cwd, imp.file.getFilePath());
|
|
22170
|
-
console.log(` ${
|
|
22414
|
+
console.log(` ${chalk182.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
22171
22415
|
}
|
|
22172
22416
|
}
|
|
22173
22417
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
22174
|
-
console.log(
|
|
22418
|
+
console.log(chalk182.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
22175
22419
|
`));
|
|
22176
|
-
console.log(` ${
|
|
22420
|
+
console.log(` ${chalk182.cyan("Functions to move:")}`);
|
|
22177
22421
|
for (const name of plan2.extractedNames) {
|
|
22178
22422
|
console.log(` ${name}`);
|
|
22179
22423
|
}
|
|
@@ -22207,7 +22451,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
22207
22451
|
|
|
22208
22452
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
22209
22453
|
import path43 from "path";
|
|
22210
|
-
import
|
|
22454
|
+
import chalk183 from "chalk";
|
|
22211
22455
|
import { Project as Project4 } from "ts-morph";
|
|
22212
22456
|
|
|
22213
22457
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -22299,7 +22543,7 @@ function loadProjectFile(file) {
|
|
|
22299
22543
|
});
|
|
22300
22544
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
22301
22545
|
if (!sourceFile) {
|
|
22302
|
-
console.log(
|
|
22546
|
+
console.log(chalk183.red(`File not found in project: ${file}`));
|
|
22303
22547
|
process.exit(1);
|
|
22304
22548
|
}
|
|
22305
22549
|
return { project, sourceFile };
|
|
@@ -22322,19 +22566,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
22322
22566
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
22323
22567
|
if (options2.apply) {
|
|
22324
22568
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
22325
|
-
console.log(
|
|
22569
|
+
console.log(chalk184.green("\nExtraction complete"));
|
|
22326
22570
|
} else {
|
|
22327
|
-
console.log(
|
|
22571
|
+
console.log(chalk184.dim("\nDry run. Use --apply to execute."));
|
|
22328
22572
|
}
|
|
22329
22573
|
}
|
|
22330
22574
|
|
|
22331
22575
|
// src/commands/refactor/ignore.ts
|
|
22332
22576
|
import fs28 from "fs";
|
|
22333
|
-
import
|
|
22577
|
+
import chalk185 from "chalk";
|
|
22334
22578
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
22335
22579
|
function ignore2(file) {
|
|
22336
22580
|
if (!fs28.existsSync(file)) {
|
|
22337
|
-
console.error(
|
|
22581
|
+
console.error(chalk185.red(`Error: File does not exist: ${file}`));
|
|
22338
22582
|
process.exit(1);
|
|
22339
22583
|
}
|
|
22340
22584
|
const content = fs28.readFileSync(file, "utf8");
|
|
@@ -22350,7 +22594,7 @@ function ignore2(file) {
|
|
|
22350
22594
|
fs28.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
22351
22595
|
}
|
|
22352
22596
|
console.log(
|
|
22353
|
-
|
|
22597
|
+
chalk185.green(
|
|
22354
22598
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
22355
22599
|
)
|
|
22356
22600
|
);
|
|
@@ -22359,12 +22603,12 @@ function ignore2(file) {
|
|
|
22359
22603
|
// src/commands/refactor/rename/index.ts
|
|
22360
22604
|
import fs31 from "fs";
|
|
22361
22605
|
import path49 from "path";
|
|
22362
|
-
import
|
|
22606
|
+
import chalk188 from "chalk";
|
|
22363
22607
|
|
|
22364
22608
|
// src/commands/refactor/rename/applyRename.ts
|
|
22365
22609
|
import fs30 from "fs";
|
|
22366
22610
|
import path46 from "path";
|
|
22367
|
-
import
|
|
22611
|
+
import chalk186 from "chalk";
|
|
22368
22612
|
|
|
22369
22613
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
22370
22614
|
import path45 from "path";
|
|
@@ -22469,13 +22713,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
22469
22713
|
const updatedContents = applyRewrites(rewrites);
|
|
22470
22714
|
for (const [file, content] of updatedContents) {
|
|
22471
22715
|
fs30.writeFileSync(file, content, "utf8");
|
|
22472
|
-
console.log(
|
|
22716
|
+
console.log(chalk186.cyan(` Updated imports in ${path46.relative(cwd, file)}`));
|
|
22473
22717
|
}
|
|
22474
22718
|
const destDir = path46.dirname(destPath);
|
|
22475
22719
|
if (!fs30.existsSync(destDir)) fs30.mkdirSync(destDir, { recursive: true });
|
|
22476
22720
|
fs30.renameSync(sourcePath, destPath);
|
|
22477
22721
|
console.log(
|
|
22478
|
-
|
|
22722
|
+
chalk186.white(
|
|
22479
22723
|
` Moved ${path46.relative(cwd, sourcePath)} \u2192 ${path46.relative(cwd, destPath)}`
|
|
22480
22724
|
)
|
|
22481
22725
|
);
|
|
@@ -22562,16 +22806,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
22562
22806
|
|
|
22563
22807
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
22564
22808
|
import path48 from "path";
|
|
22565
|
-
import
|
|
22809
|
+
import chalk187 from "chalk";
|
|
22566
22810
|
function printRenamePreview(rewrites, cwd) {
|
|
22567
22811
|
for (const rewrite of rewrites) {
|
|
22568
22812
|
console.log(
|
|
22569
|
-
|
|
22813
|
+
chalk187.dim(
|
|
22570
22814
|
` ${path48.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
22571
22815
|
)
|
|
22572
22816
|
);
|
|
22573
22817
|
}
|
|
22574
|
-
console.log(
|
|
22818
|
+
console.log(chalk187.dim("Dry run. Use --apply to execute."));
|
|
22575
22819
|
}
|
|
22576
22820
|
|
|
22577
22821
|
// src/commands/refactor/rename/index.ts
|
|
@@ -22582,20 +22826,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
22582
22826
|
const relSource = path49.relative(cwd, sourcePath);
|
|
22583
22827
|
const relDest = path49.relative(cwd, destPath);
|
|
22584
22828
|
if (!fs31.existsSync(sourcePath)) {
|
|
22585
|
-
console.log(
|
|
22829
|
+
console.log(chalk188.red(`File not found: ${source}`));
|
|
22586
22830
|
process.exit(1);
|
|
22587
22831
|
}
|
|
22588
22832
|
if (destPath !== sourcePath && fs31.existsSync(destPath)) {
|
|
22589
|
-
console.log(
|
|
22833
|
+
console.log(chalk188.red(`Destination already exists: ${destination}`));
|
|
22590
22834
|
process.exit(1);
|
|
22591
22835
|
}
|
|
22592
|
-
console.log(
|
|
22593
|
-
console.log(
|
|
22594
|
-
console.log(
|
|
22836
|
+
console.log(chalk188.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
22837
|
+
console.log(chalk188.dim("Loading project..."));
|
|
22838
|
+
console.log(chalk188.dim("Scanning imports across the project..."));
|
|
22595
22839
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
22596
22840
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
22597
22841
|
console.log(
|
|
22598
|
-
|
|
22842
|
+
chalk188.dim(
|
|
22599
22843
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
22600
22844
|
)
|
|
22601
22845
|
);
|
|
@@ -22604,11 +22848,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
22604
22848
|
return;
|
|
22605
22849
|
}
|
|
22606
22850
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
22607
|
-
console.log(
|
|
22851
|
+
console.log(chalk188.green("Done"));
|
|
22608
22852
|
}
|
|
22609
22853
|
|
|
22610
22854
|
// src/commands/refactor/renameSymbol/index.ts
|
|
22611
|
-
import
|
|
22855
|
+
import chalk189 from "chalk";
|
|
22612
22856
|
|
|
22613
22857
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
22614
22858
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -22654,33 +22898,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
22654
22898
|
const { project, sourceFile } = loadProjectFile(file);
|
|
22655
22899
|
const symbol = findSymbol(sourceFile, oldName);
|
|
22656
22900
|
if (!symbol) {
|
|
22657
|
-
console.log(
|
|
22901
|
+
console.log(chalk189.red(`Symbol "${oldName}" not found in ${file}`));
|
|
22658
22902
|
process.exit(1);
|
|
22659
22903
|
}
|
|
22660
22904
|
const grouped = groupReferences(symbol, cwd);
|
|
22661
22905
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
22662
22906
|
console.log(
|
|
22663
|
-
|
|
22907
|
+
chalk189.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
22664
22908
|
`)
|
|
22665
22909
|
);
|
|
22666
22910
|
for (const [refFile, lines] of grouped) {
|
|
22667
22911
|
console.log(
|
|
22668
|
-
` ${
|
|
22912
|
+
` ${chalk189.dim(refFile)}: lines ${chalk189.cyan(lines.join(", "))}`
|
|
22669
22913
|
);
|
|
22670
22914
|
}
|
|
22671
22915
|
if (options2.apply) {
|
|
22672
22916
|
symbol.rename(newName);
|
|
22673
22917
|
await project.save();
|
|
22674
|
-
console.log(
|
|
22918
|
+
console.log(chalk189.green(`
|
|
22675
22919
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
22676
22920
|
} else {
|
|
22677
|
-
console.log(
|
|
22921
|
+
console.log(chalk189.dim("\nDry run. Use --apply to execute."));
|
|
22678
22922
|
}
|
|
22679
22923
|
}
|
|
22680
22924
|
|
|
22681
22925
|
// src/commands/refactor/restructure/index.ts
|
|
22682
22926
|
import path57 from "path";
|
|
22683
|
-
import
|
|
22927
|
+
import chalk192 from "chalk";
|
|
22684
22928
|
|
|
22685
22929
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
22686
22930
|
import path51 from "path";
|
|
@@ -22759,50 +23003,50 @@ function clusterFiles(graph) {
|
|
|
22759
23003
|
|
|
22760
23004
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
22761
23005
|
import path53 from "path";
|
|
22762
|
-
import
|
|
23006
|
+
import chalk190 from "chalk";
|
|
22763
23007
|
function relPath(filePath) {
|
|
22764
23008
|
return path53.relative(process.cwd(), filePath);
|
|
22765
23009
|
}
|
|
22766
23010
|
function displayMoves(plan2) {
|
|
22767
23011
|
if (plan2.moves.length === 0) return;
|
|
22768
|
-
console.log(
|
|
23012
|
+
console.log(chalk190.bold("\nFile moves:"));
|
|
22769
23013
|
for (const move2 of plan2.moves) {
|
|
22770
23014
|
console.log(
|
|
22771
|
-
` ${
|
|
23015
|
+
` ${chalk190.red(relPath(move2.from))} \u2192 ${chalk190.green(relPath(move2.to))}`
|
|
22772
23016
|
);
|
|
22773
|
-
console.log(
|
|
23017
|
+
console.log(chalk190.dim(` ${move2.reason}`));
|
|
22774
23018
|
}
|
|
22775
23019
|
}
|
|
22776
23020
|
function displayRewrites(rewrites) {
|
|
22777
23021
|
if (rewrites.length === 0) return;
|
|
22778
23022
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
22779
|
-
console.log(
|
|
23023
|
+
console.log(chalk190.bold(`
|
|
22780
23024
|
Import rewrites (${affectedFiles.size} files):`));
|
|
22781
23025
|
for (const file of affectedFiles) {
|
|
22782
|
-
console.log(` ${
|
|
23026
|
+
console.log(` ${chalk190.cyan(relPath(file))}:`);
|
|
22783
23027
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
22784
23028
|
(r) => r.file === file
|
|
22785
23029
|
)) {
|
|
22786
23030
|
console.log(
|
|
22787
|
-
` ${
|
|
23031
|
+
` ${chalk190.red(`"${oldSpecifier}"`)} \u2192 ${chalk190.green(`"${newSpecifier}"`)}`
|
|
22788
23032
|
);
|
|
22789
23033
|
}
|
|
22790
23034
|
}
|
|
22791
23035
|
}
|
|
22792
23036
|
function displayPlan2(plan2) {
|
|
22793
23037
|
if (plan2.warnings.length > 0) {
|
|
22794
|
-
console.log(
|
|
22795
|
-
for (const w of plan2.warnings) console.log(
|
|
23038
|
+
console.log(chalk190.yellow("\nWarnings:"));
|
|
23039
|
+
for (const w of plan2.warnings) console.log(chalk190.yellow(` ${w}`));
|
|
22796
23040
|
}
|
|
22797
23041
|
if (plan2.newDirectories.length > 0) {
|
|
22798
|
-
console.log(
|
|
23042
|
+
console.log(chalk190.bold("\nNew directories:"));
|
|
22799
23043
|
for (const dir of plan2.newDirectories)
|
|
22800
|
-
console.log(
|
|
23044
|
+
console.log(chalk190.green(` ${dir}/`));
|
|
22801
23045
|
}
|
|
22802
23046
|
displayMoves(plan2);
|
|
22803
23047
|
displayRewrites(plan2.rewrites);
|
|
22804
23048
|
console.log(
|
|
22805
|
-
|
|
23049
|
+
chalk190.dim(
|
|
22806
23050
|
`
|
|
22807
23051
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
22808
23052
|
)
|
|
@@ -22812,18 +23056,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
22812
23056
|
// src/commands/refactor/restructure/executePlan.ts
|
|
22813
23057
|
import fs32 from "fs";
|
|
22814
23058
|
import path54 from "path";
|
|
22815
|
-
import
|
|
23059
|
+
import chalk191 from "chalk";
|
|
22816
23060
|
function executePlan(plan2) {
|
|
22817
23061
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
22818
23062
|
for (const [file, content] of updatedContents) {
|
|
22819
23063
|
fs32.writeFileSync(file, content, "utf8");
|
|
22820
23064
|
console.log(
|
|
22821
|
-
|
|
23065
|
+
chalk191.cyan(` Rewrote imports in ${path54.relative(process.cwd(), file)}`)
|
|
22822
23066
|
);
|
|
22823
23067
|
}
|
|
22824
23068
|
for (const dir of plan2.newDirectories) {
|
|
22825
23069
|
fs32.mkdirSync(dir, { recursive: true });
|
|
22826
|
-
console.log(
|
|
23070
|
+
console.log(chalk191.green(` Created ${path54.relative(process.cwd(), dir)}/`));
|
|
22827
23071
|
}
|
|
22828
23072
|
for (const move2 of plan2.moves) {
|
|
22829
23073
|
const targetDir = path54.dirname(move2.to);
|
|
@@ -22832,7 +23076,7 @@ function executePlan(plan2) {
|
|
|
22832
23076
|
}
|
|
22833
23077
|
fs32.renameSync(move2.from, move2.to);
|
|
22834
23078
|
console.log(
|
|
22835
|
-
|
|
23079
|
+
chalk191.white(
|
|
22836
23080
|
` Moved ${path54.relative(process.cwd(), move2.from)} \u2192 ${path54.relative(process.cwd(), move2.to)}`
|
|
22837
23081
|
)
|
|
22838
23082
|
);
|
|
@@ -22847,7 +23091,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
22847
23091
|
if (entries.length === 0) {
|
|
22848
23092
|
fs32.rmdirSync(dir);
|
|
22849
23093
|
console.log(
|
|
22850
|
-
|
|
23094
|
+
chalk191.dim(
|
|
22851
23095
|
` Removed empty directory ${path54.relative(process.cwd(), dir)}`
|
|
22852
23096
|
)
|
|
22853
23097
|
);
|
|
@@ -22980,22 +23224,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
22980
23224
|
const targetPattern = pattern2 ?? "src";
|
|
22981
23225
|
const files = findSourceFiles2(targetPattern);
|
|
22982
23226
|
if (files.length === 0) {
|
|
22983
|
-
console.log(
|
|
23227
|
+
console.log(chalk192.yellow("No files found matching pattern"));
|
|
22984
23228
|
return;
|
|
22985
23229
|
}
|
|
22986
23230
|
const tsConfigPath = findTsConfig(path57.resolve(files[0]));
|
|
22987
23231
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
22988
23232
|
if (plan2.moves.length === 0) {
|
|
22989
|
-
console.log(
|
|
23233
|
+
console.log(chalk192.green("No restructuring needed"));
|
|
22990
23234
|
return;
|
|
22991
23235
|
}
|
|
22992
23236
|
displayPlan2(plan2);
|
|
22993
23237
|
if (options2.apply) {
|
|
22994
|
-
console.log(
|
|
23238
|
+
console.log(chalk192.bold("\nApplying changes..."));
|
|
22995
23239
|
executePlan(plan2);
|
|
22996
|
-
console.log(
|
|
23240
|
+
console.log(chalk192.green("\nRestructuring complete"));
|
|
22997
23241
|
} else {
|
|
22998
|
-
console.log(
|
|
23242
|
+
console.log(chalk192.dim("\nDry run. Use --apply to execute."));
|
|
22999
23243
|
}
|
|
23000
23244
|
}
|
|
23001
23245
|
|
|
@@ -23575,18 +23819,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
23575
23819
|
}
|
|
23576
23820
|
|
|
23577
23821
|
// src/commands/review/warnOutOfDiff.ts
|
|
23578
|
-
import
|
|
23822
|
+
import chalk193 from "chalk";
|
|
23579
23823
|
function warnOutOfDiff(outOfDiff) {
|
|
23580
23824
|
if (outOfDiff.length === 0) return;
|
|
23581
23825
|
console.warn(
|
|
23582
|
-
|
|
23826
|
+
chalk193.yellow(
|
|
23583
23827
|
`Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
|
|
23584
23828
|
)
|
|
23585
23829
|
);
|
|
23586
23830
|
for (const finding of outOfDiff) {
|
|
23587
23831
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
23588
23832
|
console.warn(
|
|
23589
|
-
` ${
|
|
23833
|
+
` ${chalk193.yellow("\xB7")} ${finding.title} ${chalk193.dim(
|
|
23590
23834
|
`(${finding.file}:${range})`
|
|
23591
23835
|
)}`
|
|
23592
23836
|
);
|
|
@@ -23605,18 +23849,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
23605
23849
|
}
|
|
23606
23850
|
|
|
23607
23851
|
// src/commands/review/warnUnlocated.ts
|
|
23608
|
-
import
|
|
23852
|
+
import chalk194 from "chalk";
|
|
23609
23853
|
function warnUnlocated(unlocated) {
|
|
23610
23854
|
if (unlocated.length === 0) return;
|
|
23611
23855
|
console.warn(
|
|
23612
|
-
|
|
23856
|
+
chalk194.yellow(
|
|
23613
23857
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
23614
23858
|
)
|
|
23615
23859
|
);
|
|
23616
23860
|
for (const finding of unlocated) {
|
|
23617
|
-
const where = finding.location ||
|
|
23861
|
+
const where = finding.location || chalk194.dim("missing");
|
|
23618
23862
|
console.warn(
|
|
23619
|
-
` ${
|
|
23863
|
+
` ${chalk194.yellow("\xB7")} ${finding.title} ${chalk194.dim(`(${where})`)}`
|
|
23620
23864
|
);
|
|
23621
23865
|
}
|
|
23622
23866
|
}
|
|
@@ -23767,7 +24011,7 @@ Read ${synthesisPath}. It contains a list of findings under the \`## Findings\`
|
|
|
23767
24011
|
File ONE bug backlog item covering the review findings:
|
|
23768
24012
|
- Include EVERY finding in the file as a phase on that single item \u2014 including findings whose Source is \`already-raised\`.
|
|
23769
24013
|
- Each phase should be named after its finding's title and its tasks should capture the finding's Location, Impact, and Recommendation.
|
|
23770
|
-
-
|
|
24014
|
+
- File the item with \`assist backlog propose\`, then apply the whole plan with a single \`assist backlog update-plan <id> --json -\` call whose payload lists every finding as a phase. Do not run \`assist backlog add-phase\` per finding \u2014 the plan lands in one preview, or not at all.
|
|
23771
24015
|
|
|
23772
24016
|
Important constraints:
|
|
23773
24017
|
- Do not edit ${synthesisPath} \u2014 leave it untouched.
|
|
@@ -24781,7 +25025,7 @@ function registerReview(program2) {
|
|
|
24781
25025
|
}
|
|
24782
25026
|
|
|
24783
25027
|
// src/commands/seq/seqAuth.ts
|
|
24784
|
-
import
|
|
25028
|
+
import chalk196 from "chalk";
|
|
24785
25029
|
|
|
24786
25030
|
// src/commands/seq/loadConnections.ts
|
|
24787
25031
|
function loadConnections2() {
|
|
@@ -24810,10 +25054,10 @@ function setDefaultConnection(name) {
|
|
|
24810
25054
|
}
|
|
24811
25055
|
|
|
24812
25056
|
// src/shared/assertUniqueName.ts
|
|
24813
|
-
import
|
|
25057
|
+
import chalk195 from "chalk";
|
|
24814
25058
|
function assertUniqueName(existingNames, name) {
|
|
24815
25059
|
if (existingNames.includes(name)) {
|
|
24816
|
-
console.error(
|
|
25060
|
+
console.error(chalk195.red(`Connection "${name}" already exists.`));
|
|
24817
25061
|
process.exit(1);
|
|
24818
25062
|
}
|
|
24819
25063
|
}
|
|
@@ -24831,7 +25075,7 @@ async function promptConnection2(existingNames) {
|
|
|
24831
25075
|
var seqAuth = createConnectionAuth({
|
|
24832
25076
|
load: loadConnections2,
|
|
24833
25077
|
save: saveConnections2,
|
|
24834
|
-
format: (c) => `${
|
|
25078
|
+
format: (c) => `${chalk196.bold(c.name)} ${c.url}`,
|
|
24835
25079
|
promptNew: promptConnection2,
|
|
24836
25080
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
24837
25081
|
});
|
|
@@ -24851,10 +25095,10 @@ var seqConfigHelp = [
|
|
|
24851
25095
|
];
|
|
24852
25096
|
|
|
24853
25097
|
// src/commands/seq/seqQuery.ts
|
|
24854
|
-
import
|
|
25098
|
+
import chalk200 from "chalk";
|
|
24855
25099
|
|
|
24856
25100
|
// src/commands/seq/fetchSeq.ts
|
|
24857
|
-
import
|
|
25101
|
+
import chalk197 from "chalk";
|
|
24858
25102
|
async function fetchSeq(conn, path71, params) {
|
|
24859
25103
|
const url = `${conn.url}${path71}?${params}`;
|
|
24860
25104
|
const response = await fetch(url, {
|
|
@@ -24865,7 +25109,7 @@ async function fetchSeq(conn, path71, params) {
|
|
|
24865
25109
|
});
|
|
24866
25110
|
if (!response.ok) {
|
|
24867
25111
|
const body = await response.text();
|
|
24868
|
-
console.error(
|
|
25112
|
+
console.error(chalk197.red(`Seq returned ${response.status}: ${body}`));
|
|
24869
25113
|
process.exit(1);
|
|
24870
25114
|
}
|
|
24871
25115
|
return response;
|
|
@@ -24924,23 +25168,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
24924
25168
|
}
|
|
24925
25169
|
|
|
24926
25170
|
// src/commands/seq/formatEvent.ts
|
|
24927
|
-
import
|
|
25171
|
+
import chalk198 from "chalk";
|
|
24928
25172
|
function levelColor(level) {
|
|
24929
25173
|
switch (level) {
|
|
24930
25174
|
case "Fatal":
|
|
24931
|
-
return
|
|
25175
|
+
return chalk198.bgRed.white;
|
|
24932
25176
|
case "Error":
|
|
24933
|
-
return
|
|
25177
|
+
return chalk198.red;
|
|
24934
25178
|
case "Warning":
|
|
24935
|
-
return
|
|
25179
|
+
return chalk198.yellow;
|
|
24936
25180
|
case "Information":
|
|
24937
|
-
return
|
|
25181
|
+
return chalk198.cyan;
|
|
24938
25182
|
case "Debug":
|
|
24939
|
-
return
|
|
25183
|
+
return chalk198.gray;
|
|
24940
25184
|
case "Verbose":
|
|
24941
|
-
return
|
|
25185
|
+
return chalk198.dim;
|
|
24942
25186
|
default:
|
|
24943
|
-
return
|
|
25187
|
+
return chalk198.white;
|
|
24944
25188
|
}
|
|
24945
25189
|
}
|
|
24946
25190
|
function levelAbbrev(level) {
|
|
@@ -24981,12 +25225,12 @@ function formatTimestamp(iso) {
|
|
|
24981
25225
|
function formatEvent(event) {
|
|
24982
25226
|
const color = levelColor(event.Level);
|
|
24983
25227
|
const abbrev = levelAbbrev(event.Level);
|
|
24984
|
-
const ts8 =
|
|
25228
|
+
const ts8 = chalk198.dim(formatTimestamp(event.Timestamp));
|
|
24985
25229
|
const msg = renderMessage(event);
|
|
24986
25230
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
24987
25231
|
if (event.Exception) {
|
|
24988
25232
|
for (const line of event.Exception.split("\n")) {
|
|
24989
|
-
lines.push(
|
|
25233
|
+
lines.push(chalk198.red(` ${line}`));
|
|
24990
25234
|
}
|
|
24991
25235
|
}
|
|
24992
25236
|
return lines.join("\n");
|
|
@@ -25019,11 +25263,11 @@ function rejectTimestampFilter(filter) {
|
|
|
25019
25263
|
}
|
|
25020
25264
|
|
|
25021
25265
|
// src/shared/resolveNamedConnection.ts
|
|
25022
|
-
import
|
|
25266
|
+
import chalk199 from "chalk";
|
|
25023
25267
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
25024
25268
|
if (connections.length === 0) {
|
|
25025
25269
|
console.error(
|
|
25026
|
-
|
|
25270
|
+
chalk199.red(
|
|
25027
25271
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
25028
25272
|
)
|
|
25029
25273
|
);
|
|
@@ -25032,7 +25276,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
25032
25276
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
25033
25277
|
const connection = connections.find((c) => c.name === target);
|
|
25034
25278
|
if (!connection) {
|
|
25035
|
-
console.error(
|
|
25279
|
+
console.error(chalk199.red(`${kind} connection "${target}" not found.`));
|
|
25036
25280
|
process.exit(1);
|
|
25037
25281
|
}
|
|
25038
25282
|
return connection;
|
|
@@ -25061,7 +25305,7 @@ async function seqQuery(filter, options2) {
|
|
|
25061
25305
|
new URLSearchParams({ filter, count: String(count8) })
|
|
25062
25306
|
);
|
|
25063
25307
|
if (events.length === 0) {
|
|
25064
|
-
console.log(
|
|
25308
|
+
console.log(chalk200.yellow("No events found."));
|
|
25065
25309
|
return;
|
|
25066
25310
|
}
|
|
25067
25311
|
if (options2.json) {
|
|
@@ -25072,11 +25316,11 @@ async function seqQuery(filter, options2) {
|
|
|
25072
25316
|
for (const event of chronological) {
|
|
25073
25317
|
console.log(formatEvent(event));
|
|
25074
25318
|
}
|
|
25075
|
-
console.log(
|
|
25319
|
+
console.log(chalk200.dim(`
|
|
25076
25320
|
${events.length} events`));
|
|
25077
25321
|
if (events.length >= count8) {
|
|
25078
25322
|
console.log(
|
|
25079
|
-
|
|
25323
|
+
chalk200.yellow(
|
|
25080
25324
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
25081
25325
|
)
|
|
25082
25326
|
);
|
|
@@ -25084,10 +25328,10 @@ ${events.length} events`));
|
|
|
25084
25328
|
}
|
|
25085
25329
|
|
|
25086
25330
|
// src/shared/setNamedDefaultConnection.ts
|
|
25087
|
-
import
|
|
25331
|
+
import chalk201 from "chalk";
|
|
25088
25332
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
25089
25333
|
if (!connections.find((c) => c.name === name)) {
|
|
25090
|
-
console.error(
|
|
25334
|
+
console.error(chalk201.red(`Connection "${name}" not found.`));
|
|
25091
25335
|
process.exit(1);
|
|
25092
25336
|
}
|
|
25093
25337
|
setDefault(name);
|
|
@@ -25136,7 +25380,7 @@ function registerSignal(program2) {
|
|
|
25136
25380
|
}
|
|
25137
25381
|
|
|
25138
25382
|
// src/commands/sql/sqlAuth.ts
|
|
25139
|
-
import
|
|
25383
|
+
import chalk203 from "chalk";
|
|
25140
25384
|
|
|
25141
25385
|
// src/commands/sql/loadConnections.ts
|
|
25142
25386
|
function loadConnections3() {
|
|
@@ -25165,7 +25409,7 @@ function setDefaultConnection2(name) {
|
|
|
25165
25409
|
}
|
|
25166
25410
|
|
|
25167
25411
|
// src/commands/sql/promptConnection.ts
|
|
25168
|
-
import
|
|
25412
|
+
import chalk202 from "chalk";
|
|
25169
25413
|
async function promptConnection3(existingNames) {
|
|
25170
25414
|
const name = await promptInput("name", "Connection name:", "default");
|
|
25171
25415
|
assertUniqueName(existingNames, name);
|
|
@@ -25173,7 +25417,7 @@ async function promptConnection3(existingNames) {
|
|
|
25173
25417
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
25174
25418
|
const port = Number.parseInt(portStr, 10);
|
|
25175
25419
|
if (!Number.isFinite(port)) {
|
|
25176
|
-
console.error(
|
|
25420
|
+
console.error(chalk202.red(`Invalid port "${portStr}".`));
|
|
25177
25421
|
process.exit(1);
|
|
25178
25422
|
}
|
|
25179
25423
|
const user = await promptInput("user", "User:");
|
|
@@ -25186,13 +25430,13 @@ async function promptConnection3(existingNames) {
|
|
|
25186
25430
|
var sqlAuth = createConnectionAuth({
|
|
25187
25431
|
load: loadConnections3,
|
|
25188
25432
|
save: saveConnections3,
|
|
25189
|
-
format: (c) => `${
|
|
25433
|
+
format: (c) => `${chalk203.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
25190
25434
|
promptNew: promptConnection3,
|
|
25191
25435
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
25192
25436
|
});
|
|
25193
25437
|
|
|
25194
25438
|
// src/commands/sql/printTable.ts
|
|
25195
|
-
import
|
|
25439
|
+
import chalk204 from "chalk";
|
|
25196
25440
|
function formatCell(value) {
|
|
25197
25441
|
if (value === null || value === void 0) return "";
|
|
25198
25442
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -25201,7 +25445,7 @@ function formatCell(value) {
|
|
|
25201
25445
|
}
|
|
25202
25446
|
function printTable(rows) {
|
|
25203
25447
|
if (rows.length === 0) {
|
|
25204
|
-
console.log(
|
|
25448
|
+
console.log(chalk204.yellow("(no rows)"));
|
|
25205
25449
|
return;
|
|
25206
25450
|
}
|
|
25207
25451
|
const columns = Object.keys(rows[0]);
|
|
@@ -25209,13 +25453,13 @@ function printTable(rows) {
|
|
|
25209
25453
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
25210
25454
|
);
|
|
25211
25455
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
25212
|
-
console.log(
|
|
25213
|
-
console.log(
|
|
25456
|
+
console.log(chalk204.dim(header));
|
|
25457
|
+
console.log(chalk204.dim("-".repeat(header.length)));
|
|
25214
25458
|
for (const row of rows) {
|
|
25215
25459
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
25216
25460
|
console.log(line);
|
|
25217
25461
|
}
|
|
25218
|
-
console.log(
|
|
25462
|
+
console.log(chalk204.dim(`
|
|
25219
25463
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
25220
25464
|
}
|
|
25221
25465
|
|
|
@@ -25289,7 +25533,7 @@ var sqlConfigHelp = [
|
|
|
25289
25533
|
];
|
|
25290
25534
|
|
|
25291
25535
|
// src/commands/sql/sqlMutate.ts
|
|
25292
|
-
import
|
|
25536
|
+
import chalk205 from "chalk";
|
|
25293
25537
|
|
|
25294
25538
|
// src/commands/sql/isMutation.ts
|
|
25295
25539
|
var MUTATION_KEYWORDS = [
|
|
@@ -25323,7 +25567,7 @@ function isMutation(sql25) {
|
|
|
25323
25567
|
async function sqlMutate(query, connectionName) {
|
|
25324
25568
|
if (!isMutation(query)) {
|
|
25325
25569
|
console.error(
|
|
25326
|
-
|
|
25570
|
+
chalk205.red(
|
|
25327
25571
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
25328
25572
|
)
|
|
25329
25573
|
);
|
|
@@ -25333,18 +25577,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
25333
25577
|
const pool = await sqlConnect(conn);
|
|
25334
25578
|
try {
|
|
25335
25579
|
const result = await pool.request().query(query);
|
|
25336
|
-
console.log(
|
|
25580
|
+
console.log(chalk205.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
25337
25581
|
} finally {
|
|
25338
25582
|
await pool.close();
|
|
25339
25583
|
}
|
|
25340
25584
|
}
|
|
25341
25585
|
|
|
25342
25586
|
// src/commands/sql/sqlQuery.ts
|
|
25343
|
-
import
|
|
25587
|
+
import chalk206 from "chalk";
|
|
25344
25588
|
async function sqlQuery(query, connectionName) {
|
|
25345
25589
|
if (isMutation(query)) {
|
|
25346
25590
|
console.error(
|
|
25347
|
-
|
|
25591
|
+
chalk206.red(
|
|
25348
25592
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
25349
25593
|
)
|
|
25350
25594
|
);
|
|
@@ -25359,7 +25603,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
25359
25603
|
printTable(rows);
|
|
25360
25604
|
} else {
|
|
25361
25605
|
console.log(
|
|
25362
|
-
|
|
25606
|
+
chalk206.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
25363
25607
|
);
|
|
25364
25608
|
}
|
|
25365
25609
|
} finally {
|
|
@@ -26411,7 +26655,7 @@ function registerWatch(program2) {
|
|
|
26411
26655
|
|
|
26412
26656
|
// src/commands/roam/auth.ts
|
|
26413
26657
|
import { randomBytes } from "crypto";
|
|
26414
|
-
import
|
|
26658
|
+
import chalk207 from "chalk";
|
|
26415
26659
|
|
|
26416
26660
|
// src/commands/roam/waitForCallback.ts
|
|
26417
26661
|
import { createServer as createServer3 } from "http";
|
|
@@ -26542,13 +26786,13 @@ async function auth() {
|
|
|
26542
26786
|
saveGlobalConfig(config);
|
|
26543
26787
|
const state = randomBytes(16).toString("hex");
|
|
26544
26788
|
console.log(
|
|
26545
|
-
|
|
26789
|
+
chalk207.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
26546
26790
|
);
|
|
26547
|
-
console.log(
|
|
26548
|
-
console.log(
|
|
26549
|
-
console.log(
|
|
26791
|
+
console.log(chalk207.white("http://localhost:14523/callback\n"));
|
|
26792
|
+
console.log(chalk207.blue("Opening browser for authorization..."));
|
|
26793
|
+
console.log(chalk207.dim("Waiting for authorization callback..."));
|
|
26550
26794
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
26551
|
-
console.log(
|
|
26795
|
+
console.log(chalk207.dim("Exchanging code for tokens..."));
|
|
26552
26796
|
const tokens = await exchangeToken({
|
|
26553
26797
|
code,
|
|
26554
26798
|
clientId,
|
|
@@ -26564,7 +26808,7 @@ async function auth() {
|
|
|
26564
26808
|
};
|
|
26565
26809
|
saveGlobalConfig(config);
|
|
26566
26810
|
console.log(
|
|
26567
|
-
|
|
26811
|
+
chalk207.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
26568
26812
|
);
|
|
26569
26813
|
}
|
|
26570
26814
|
|
|
@@ -26667,11 +26911,11 @@ function registerRoam(program2) {
|
|
|
26667
26911
|
}
|
|
26668
26912
|
|
|
26669
26913
|
// src/commands/sync/printAutoConfirmHint.ts
|
|
26670
|
-
import
|
|
26914
|
+
import chalk208 from "chalk";
|
|
26671
26915
|
var autoConfirmHintCommand = "assist config set sync.autoConfirm true --global";
|
|
26672
26916
|
function printAutoConfirmHint() {
|
|
26673
26917
|
console.log(
|
|
26674
|
-
|
|
26918
|
+
chalk208.dim(
|
|
26675
26919
|
`Tip: run \`${autoConfirmHintCommand}\` to overwrite automatically next time`
|
|
26676
26920
|
)
|
|
26677
26921
|
);
|
|
@@ -27119,7 +27363,7 @@ import { execSync as execSync60 } from "child_process";
|
|
|
27119
27363
|
import { existsSync as existsSync60, mkdirSync as mkdirSync25, unlinkSync as unlinkSync21, writeFileSync as writeFileSync42 } from "fs";
|
|
27120
27364
|
import { tmpdir as tmpdir8 } from "os";
|
|
27121
27365
|
import { join as join70, resolve as resolve17 } from "path";
|
|
27122
|
-
import
|
|
27366
|
+
import chalk209 from "chalk";
|
|
27123
27367
|
|
|
27124
27368
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
27125
27369
|
var captureWindowPs1 = `
|
|
@@ -27270,13 +27514,13 @@ function screenshot(processName) {
|
|
|
27270
27514
|
const config = loadConfig();
|
|
27271
27515
|
const outputDir = resolve17(config.screenshot.outputDir);
|
|
27272
27516
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
27273
|
-
console.log(
|
|
27517
|
+
console.log(chalk209.gray(`Capturing window for process "${processName}" ...`));
|
|
27274
27518
|
try {
|
|
27275
27519
|
runPowerShellScript(processName, outputPath);
|
|
27276
|
-
console.log(
|
|
27520
|
+
console.log(chalk209.green(`Screenshot saved: ${outputPath}`));
|
|
27277
27521
|
} catch (error) {
|
|
27278
27522
|
const msg = error instanceof Error ? error.message : String(error);
|
|
27279
|
-
console.error(
|
|
27523
|
+
console.error(chalk209.red(`Failed to capture screenshot: ${msg}`));
|
|
27280
27524
|
process.exit(1);
|
|
27281
27525
|
}
|
|
27282
27526
|
}
|
|
@@ -27496,9 +27740,9 @@ function createAutoExit(exit, graceMs = DEFAULT_GRACE_MS) {
|
|
|
27496
27740
|
}
|
|
27497
27741
|
|
|
27498
27742
|
// src/commands/sessions/daemon/loadActiveSelection.ts
|
|
27499
|
-
import { z as
|
|
27743
|
+
import { z as z8 } from "zod";
|
|
27500
27744
|
var ACTIVE_FILE = "active.json";
|
|
27501
|
-
var activeSelectionSchema =
|
|
27745
|
+
var activeSelectionSchema = z8.record(z8.string(), z8.string());
|
|
27502
27746
|
function loadActiveSelection() {
|
|
27503
27747
|
const parsed = activeSelectionSchema.safeParse(
|
|
27504
27748
|
loadJson(ACTIVE_FILE)
|
|
@@ -27701,7 +27945,7 @@ var ClientHub = class extends Set {
|
|
|
27701
27945
|
};
|
|
27702
27946
|
|
|
27703
27947
|
// src/commands/sessions/daemon/createSession.ts
|
|
27704
|
-
import { randomUUID as
|
|
27948
|
+
import { randomUUID as randomUUID8 } from "crypto";
|
|
27705
27949
|
|
|
27706
27950
|
// src/commands/sessions/daemon/resolveRunConfig.ts
|
|
27707
27951
|
function resolveRunConfig(name, cwd) {
|
|
@@ -27841,7 +28085,7 @@ function sessionBase(id, status3) {
|
|
|
27841
28085
|
// src/commands/sessions/daemon/createSession.ts
|
|
27842
28086
|
function createSession(id, prompt, cwd, design, harness, holdPty) {
|
|
27843
28087
|
if (harness === "pi") return createPiSession(id, prompt, cwd, holdPty);
|
|
27844
|
-
const claudeSessionId =
|
|
28088
|
+
const claudeSessionId = randomUUID8();
|
|
27845
28089
|
return {
|
|
27846
28090
|
...sessionBase(id, prompt ? "running" : "waiting"),
|
|
27847
28091
|
name: `Session ${id}`,
|
|
@@ -28363,6 +28607,24 @@ function logSpawnedSession(session) {
|
|
|
28363
28607
|
);
|
|
28364
28608
|
}
|
|
28365
28609
|
|
|
28610
|
+
// src/commands/sessions/shared/sessionTitlePrompt.ts
|
|
28611
|
+
function sessionTitlePrompt(session) {
|
|
28612
|
+
if (session.commandType === "claude")
|
|
28613
|
+
return session.initialPrompt?.trim() || void 0;
|
|
28614
|
+
if (session.commandType !== "assist") return void 0;
|
|
28615
|
+
if (!isDraftCommand(session.assistArgs?.[0])) return void 0;
|
|
28616
|
+
return assistPromptArg(session.assistArgs);
|
|
28617
|
+
}
|
|
28618
|
+
function assistPromptArg(args) {
|
|
28619
|
+
const rest = args?.slice(1).filter((a) => !a.startsWith("--"));
|
|
28620
|
+
const text17 = rest?.[rest.length - 1]?.trim();
|
|
28621
|
+
if (!text17 || isBacklogItemId(text17)) return void 0;
|
|
28622
|
+
return text17;
|
|
28623
|
+
}
|
|
28624
|
+
function isBacklogItemId(text17) {
|
|
28625
|
+
return /^\d+$/.test(text17);
|
|
28626
|
+
}
|
|
28627
|
+
|
|
28366
28628
|
// src/commands/sessions/daemon/generateSessionTitle.ts
|
|
28367
28629
|
import { execFile as execFile9 } from "child_process";
|
|
28368
28630
|
import { promisify as promisify8 } from "util";
|
|
@@ -28396,29 +28658,10 @@ function buildPrompt3(prompt) {
|
|
|
28396
28658
|
].join("\n");
|
|
28397
28659
|
}
|
|
28398
28660
|
|
|
28399
|
-
// src/commands/sessions/
|
|
28400
|
-
function
|
|
28401
|
-
if (session.
|
|
28402
|
-
|
|
28403
|
-
if (session.commandType !== "assist") return void 0;
|
|
28404
|
-
if (!isDraftCommand(session.assistArgs?.[0])) return void 0;
|
|
28405
|
-
return assistPromptArg(session.assistArgs);
|
|
28406
|
-
}
|
|
28407
|
-
function assistPromptArg(args) {
|
|
28408
|
-
const rest = args?.slice(1).filter((a) => !a.startsWith("--"));
|
|
28409
|
-
const text17 = rest?.[rest.length - 1]?.trim();
|
|
28410
|
-
if (!text17 || isBacklogItemId(text17)) return void 0;
|
|
28411
|
-
return text17;
|
|
28412
|
-
}
|
|
28413
|
-
function isBacklogItemId(text17) {
|
|
28414
|
-
return /^\d+$/.test(text17);
|
|
28415
|
-
}
|
|
28416
|
-
|
|
28417
|
-
// src/commands/sessions/daemon/startSessionTitleGeneration.ts
|
|
28418
|
-
function startSessionTitleGeneration(session, notify2) {
|
|
28419
|
-
if (!session || session.generatedTitle) return;
|
|
28420
|
-
const prompt = sessionTitlePrompt(session);
|
|
28421
|
-
if (!prompt) return;
|
|
28661
|
+
// src/commands/sessions/daemon/runSessionTitleGeneration.ts
|
|
28662
|
+
function runSessionTitleGeneration(session, prompt, notify2) {
|
|
28663
|
+
if (session.generatedTitle || session.titleGenerationStarted) return;
|
|
28664
|
+
session.titleGenerationStarted = true;
|
|
28422
28665
|
void generateSessionTitle(prompt).then((generated) => {
|
|
28423
28666
|
session.generatedTitle = generated ?? singleLine(prompt);
|
|
28424
28667
|
daemonLog(
|
|
@@ -28433,6 +28676,15 @@ function singleLine(prompt) {
|
|
|
28433
28676
|
return prompt.replace(/\s+/g, " ").trim().slice(0, SESSION_TITLE_MAX_LENGTH);
|
|
28434
28677
|
}
|
|
28435
28678
|
|
|
28679
|
+
// src/commands/sessions/daemon/startSessionTitleGeneration.ts
|
|
28680
|
+
function startSessionTitleGeneration(session, notify2) {
|
|
28681
|
+
if (!session || session.generatedTitle || session.titleGenerationStarted)
|
|
28682
|
+
return;
|
|
28683
|
+
const prompt = sessionTitlePrompt(session);
|
|
28684
|
+
if (!prompt) return;
|
|
28685
|
+
runSessionTitleGeneration(session, prompt, notify2);
|
|
28686
|
+
}
|
|
28687
|
+
|
|
28436
28688
|
// src/commands/sessions/daemon/emitSessionOutput.ts
|
|
28437
28689
|
var MAX_SCROLLBACK = 256 * 1024;
|
|
28438
28690
|
function emitSessionOutput(session, clients, data) {
|
|
@@ -28480,10 +28732,10 @@ function applyReviewPause(session, activity2) {
|
|
|
28480
28732
|
}
|
|
28481
28733
|
|
|
28482
28734
|
// src/shared/db/getPhaseActiveMs.ts
|
|
28483
|
-
import { and as and23, eq as
|
|
28735
|
+
import { and as and23, eq as eq45 } from "drizzle-orm";
|
|
28484
28736
|
async function getPhaseActiveMs(db, itemId2, phaseIdx) {
|
|
28485
28737
|
const [row] = await db.select({ activeMs: phaseUsage.activeMs }).from(phaseUsage).where(
|
|
28486
|
-
and23(
|
|
28738
|
+
and23(eq45(phaseUsage.itemId, itemId2), eq45(phaseUsage.phaseIdx, phaseIdx))
|
|
28487
28739
|
);
|
|
28488
28740
|
return row?.activeMs ?? 0;
|
|
28489
28741
|
}
|
|
@@ -28864,9 +29116,42 @@ async function reconcileTranscriptStatus(session, onStatusChange) {
|
|
|
28864
29116
|
onStatusChange(session, derived);
|
|
28865
29117
|
}
|
|
28866
29118
|
|
|
29119
|
+
// src/commands/sessions/summarise/extractFirstUserMessage.ts
|
|
29120
|
+
function extractFirstUserMessage(filePath) {
|
|
29121
|
+
for (const text17 of iterateUserMessages(filePath)) {
|
|
29122
|
+
return truncate3(text17);
|
|
29123
|
+
}
|
|
29124
|
+
return void 0;
|
|
29125
|
+
}
|
|
29126
|
+
function truncate3(text17, maxChars = 500) {
|
|
29127
|
+
const trimmed = text17.trim();
|
|
29128
|
+
if (trimmed.length <= maxChars) return trimmed;
|
|
29129
|
+
return `${trimmed.slice(0, maxChars)}\u2026`;
|
|
29130
|
+
}
|
|
29131
|
+
|
|
29132
|
+
// src/commands/sessions/daemon/startTranscriptTitleGeneration.ts
|
|
29133
|
+
function startTranscriptTitleGeneration(session, notify2) {
|
|
29134
|
+
if (session.commandType !== "claude") return;
|
|
29135
|
+
if (session.generatedTitle || session.titleGenerationStarted) return;
|
|
29136
|
+
if (session.initialPrompt?.trim()) return;
|
|
29137
|
+
const filePath = transcriptPath(session);
|
|
29138
|
+
if (!filePath) return;
|
|
29139
|
+
const firstMessage = extractFirstUserMessage(filePath);
|
|
29140
|
+
if (!firstMessage) return;
|
|
29141
|
+
daemonLog(
|
|
29142
|
+
`session ${session.id} deriving title from first transcript message`
|
|
29143
|
+
);
|
|
29144
|
+
runSessionTitleGeneration(session, firstMessage, notify2);
|
|
29145
|
+
}
|
|
29146
|
+
function transcriptPath(session) {
|
|
29147
|
+
if (session.transcriptPath) return session.transcriptPath;
|
|
29148
|
+
if (!session.cwd || !session.claudeSessionId) return void 0;
|
|
29149
|
+
return findTranscriptPathSync(session.cwd, session.claudeSessionId) ?? void 0;
|
|
29150
|
+
}
|
|
29151
|
+
|
|
28867
29152
|
// src/commands/sessions/daemon/watchTranscript.ts
|
|
28868
29153
|
var DEBOUNCE_MS3 = 100;
|
|
28869
|
-
function watchTranscript(session, onStatusChange) {
|
|
29154
|
+
function watchTranscript(session, notify2, onStatusChange) {
|
|
28870
29155
|
if (!session.cwd || !session.claudeSessionId) return;
|
|
28871
29156
|
if (session.watchedTranscriptId === session.claudeSessionId) return;
|
|
28872
29157
|
const dir = projectDirForCwd(session.cwd);
|
|
@@ -28881,6 +29166,7 @@ function watchTranscript(session, onStatusChange) {
|
|
|
28881
29166
|
const run4 = () => {
|
|
28882
29167
|
timer = null;
|
|
28883
29168
|
void reconcileTranscriptStatus(session, onStatusChange);
|
|
29169
|
+
startTranscriptTitleGeneration(session, notify2);
|
|
28884
29170
|
};
|
|
28885
29171
|
try {
|
|
28886
29172
|
session.transcriptWatcher = watch3(dir, (_event, changed) => {
|
|
@@ -28901,7 +29187,7 @@ function watchTranscript(session, onStatusChange) {
|
|
|
28901
29187
|
|
|
28902
29188
|
// src/commands/sessions/daemon/wireSessionWatchers.ts
|
|
28903
29189
|
function wireSessionWatchers(session, notify2, onStatusChange) {
|
|
28904
|
-
const wireTranscript = (s) => watchTranscript(s, onStatusChange);
|
|
29190
|
+
const wireTranscript = (s) => watchTranscript(s, notify2, onStatusChange);
|
|
28905
29191
|
watchActivity(session, notify2, wireTranscript);
|
|
28906
29192
|
wireTranscript(session);
|
|
28907
29193
|
}
|
|
@@ -28995,7 +29281,7 @@ async function recordPhaseTranscriptUsage(db, itemId2, phaseIdx, responses) {
|
|
|
28995
29281
|
}
|
|
28996
29282
|
|
|
28997
29283
|
// src/shared/db/recordWindowTokens.ts
|
|
28998
|
-
import { and as and24, eq as
|
|
29284
|
+
import { and as and24, eq as eq46, sql as sql24 } from "drizzle-orm";
|
|
28999
29285
|
async function recordWindowTokens(db, window, resetsAt, tokensUp, tokensDown) {
|
|
29000
29286
|
if (tokensUp <= 0 && tokensDown <= 0) return;
|
|
29001
29287
|
await db.update(usagePeaks).set({
|
|
@@ -29003,9 +29289,9 @@ async function recordWindowTokens(db, window, resetsAt, tokensUp, tokensDown) {
|
|
|
29003
29289
|
tokensDown: sql24`${usagePeaks.tokensDown} + ${tokensDown}`
|
|
29004
29290
|
}).where(
|
|
29005
29291
|
and24(
|
|
29006
|
-
|
|
29007
|
-
|
|
29008
|
-
|
|
29292
|
+
eq46(usagePeaks.window, window),
|
|
29293
|
+
eq46(usagePeaks.resetsAt, resetsAt),
|
|
29294
|
+
eq46(usagePeaks.segment, 0)
|
|
29009
29295
|
)
|
|
29010
29296
|
);
|
|
29011
29297
|
}
|
|
@@ -29034,13 +29320,13 @@ function transcriptUsage(lines) {
|
|
|
29034
29320
|
}
|
|
29035
29321
|
return [...byId.values()];
|
|
29036
29322
|
}
|
|
29037
|
-
async function readTranscriptUsage(
|
|
29038
|
-
const content = await fs38.promises.readFile(
|
|
29323
|
+
async function readTranscriptUsage(transcriptPath2) {
|
|
29324
|
+
const content = await fs38.promises.readFile(transcriptPath2, "utf8");
|
|
29039
29325
|
return transcriptUsage(content.split("\n"));
|
|
29040
29326
|
}
|
|
29041
29327
|
|
|
29042
29328
|
// src/commands/sessions/daemon/persistPhaseTokens.ts
|
|
29043
|
-
async function persistPhaseTokens(itemId2, phaseIdx,
|
|
29329
|
+
async function persistPhaseTokens(itemId2, phaseIdx, transcriptPath2, usedPct, windows) {
|
|
29044
29330
|
try {
|
|
29045
29331
|
if (!process.env.ASSIST_DATABASE_URL && !loadConfig().database.url) return;
|
|
29046
29332
|
const db = await getDb();
|
|
@@ -29057,7 +29343,7 @@ async function persistPhaseTokens(itemId2, phaseIdx, transcriptPath, usedPct, wi
|
|
|
29057
29343
|
);
|
|
29058
29344
|
}
|
|
29059
29345
|
}
|
|
29060
|
-
const responses = await readTranscriptUsage(
|
|
29346
|
+
const responses = await readTranscriptUsage(transcriptPath2);
|
|
29061
29347
|
if (responses.length === 0) return;
|
|
29062
29348
|
const { tokensUp, tokensDown } = await recordPhaseTranscriptUsage(
|
|
29063
29349
|
db,
|
|
@@ -29074,16 +29360,16 @@ async function persistPhaseTokens(itemId2, phaseIdx, transcriptPath, usedPct, wi
|
|
|
29074
29360
|
}
|
|
29075
29361
|
|
|
29076
29362
|
// src/commands/sessions/daemon/recordSessionUsage.ts
|
|
29077
|
-
function recordSessionUsage(sessions, claudeSessionId,
|
|
29363
|
+
function recordSessionUsage(sessions, claudeSessionId, transcriptPath2, usedPct, windows) {
|
|
29078
29364
|
for (const session of sessions) {
|
|
29079
29365
|
if (session.claudeSessionId !== claudeSessionId) continue;
|
|
29080
29366
|
session.usedPct = usedPct;
|
|
29081
29367
|
const phase = sessionBacklogPhase(session);
|
|
29082
|
-
if (phase &&
|
|
29368
|
+
if (phase && transcriptPath2)
|
|
29083
29369
|
void persistPhaseTokens(
|
|
29084
29370
|
phase.itemId,
|
|
29085
29371
|
phase.phaseIdx,
|
|
29086
|
-
|
|
29372
|
+
transcriptPath2,
|
|
29087
29373
|
usedPct,
|
|
29088
29374
|
windows
|
|
29089
29375
|
);
|
|
@@ -29094,11 +29380,11 @@ function recordSessionUsage(sessions, claudeSessionId, transcriptPath, usedPct,
|
|
|
29094
29380
|
}
|
|
29095
29381
|
|
|
29096
29382
|
// src/commands/sessions/daemon/applyUsageRecord.ts
|
|
29097
|
-
function applyUsageRecord(sessions, windows, notify2, claudeSessionId,
|
|
29383
|
+
function applyUsageRecord(sessions, windows, notify2, claudeSessionId, transcriptPath2, usedPct) {
|
|
29098
29384
|
if (recordSessionUsage(
|
|
29099
29385
|
sessions,
|
|
29100
29386
|
claudeSessionId,
|
|
29101
|
-
|
|
29387
|
+
transcriptPath2,
|
|
29102
29388
|
usedPct,
|
|
29103
29389
|
windows
|
|
29104
29390
|
))
|
|
@@ -29234,7 +29520,7 @@ function respawnSession(session, respawn, status3, clients, onStatusChange) {
|
|
|
29234
29520
|
}
|
|
29235
29521
|
|
|
29236
29522
|
// src/commands/sessions/daemon/respawnPlan.ts
|
|
29237
|
-
import { randomUUID as
|
|
29523
|
+
import { randomUUID as randomUUID9 } from "crypto";
|
|
29238
29524
|
|
|
29239
29525
|
// src/commands/sessions/daemon/assistResumeArgs.ts
|
|
29240
29526
|
function assistResumeArgs(session) {
|
|
@@ -29275,7 +29561,7 @@ function respawnPlan(session) {
|
|
|
29275
29561
|
return null;
|
|
29276
29562
|
}
|
|
29277
29563
|
function freshClaudePlan(session, prompt, cwd) {
|
|
29278
|
-
const claudeSessionId =
|
|
29564
|
+
const claudeSessionId = randomUUID9();
|
|
29279
29565
|
return {
|
|
29280
29566
|
spawn: () => {
|
|
29281
29567
|
session.claudeSessionId = claudeSessionId;
|
|
@@ -31001,13 +31287,13 @@ var SessionManager = class {
|
|
|
31001
31287
|
}
|
|
31002
31288
|
/* why: the status line relays token totals keyed by Claude's session id; join
|
|
31003
31289
|
* it to the running backlog phase so the spend accumulates against that row. */
|
|
31004
|
-
recordUsage(claudeSessionId,
|
|
31290
|
+
recordUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
31005
31291
|
applyUsageRecord(
|
|
31006
31292
|
this.sessions.values(),
|
|
31007
31293
|
this.clients.currentWindows(),
|
|
31008
31294
|
this.notify,
|
|
31009
31295
|
claudeSessionId,
|
|
31010
|
-
|
|
31296
|
+
transcriptPath2,
|
|
31011
31297
|
usedPct
|
|
31012
31298
|
);
|
|
31013
31299
|
}
|
|
@@ -31566,7 +31852,7 @@ var sessionsConfigHelp = [
|
|
|
31566
31852
|
|
|
31567
31853
|
// src/commands/sessions/summarise/index.ts
|
|
31568
31854
|
import * as fs41 from "fs";
|
|
31569
|
-
import
|
|
31855
|
+
import chalk210 from "chalk";
|
|
31570
31856
|
|
|
31571
31857
|
// src/commands/sessions/summarise/shared.ts
|
|
31572
31858
|
import * as fs40 from "fs";
|
|
@@ -31583,21 +31869,6 @@ function summaryPathFor(jsonlPath2) {
|
|
|
31583
31869
|
|
|
31584
31870
|
// src/commands/sessions/summarise/summariseSession.ts
|
|
31585
31871
|
import { execFileSync as execFileSync14 } from "child_process";
|
|
31586
|
-
|
|
31587
|
-
// src/commands/sessions/summarise/extractFirstUserMessage.ts
|
|
31588
|
-
function extractFirstUserMessage(filePath) {
|
|
31589
|
-
for (const text17 of iterateUserMessages(filePath)) {
|
|
31590
|
-
return truncate3(text17);
|
|
31591
|
-
}
|
|
31592
|
-
return void 0;
|
|
31593
|
-
}
|
|
31594
|
-
function truncate3(text17, maxChars = 500) {
|
|
31595
|
-
const trimmed = text17.trim();
|
|
31596
|
-
if (trimmed.length <= maxChars) return trimmed;
|
|
31597
|
-
return `${trimmed.slice(0, maxChars)}\u2026`;
|
|
31598
|
-
}
|
|
31599
|
-
|
|
31600
|
-
// src/commands/sessions/summarise/summariseSession.ts
|
|
31601
31872
|
function summariseSession(jsonlPath2) {
|
|
31602
31873
|
const firstMessage = extractFirstUserMessage(jsonlPath2);
|
|
31603
31874
|
const backlogIds = scanSessionBacklogRefs(jsonlPath2);
|
|
@@ -31640,22 +31911,22 @@ ${firstMessage}`);
|
|
|
31640
31911
|
async function summarise2(options2) {
|
|
31641
31912
|
const files = await discoverSessionFiles();
|
|
31642
31913
|
if (files.length === 0) {
|
|
31643
|
-
console.log(
|
|
31914
|
+
console.log(chalk210.yellow("No sessions found."));
|
|
31644
31915
|
return;
|
|
31645
31916
|
}
|
|
31646
31917
|
const toProcess = selectCandidates(files, options2);
|
|
31647
31918
|
if (toProcess.length === 0) {
|
|
31648
|
-
console.log(
|
|
31919
|
+
console.log(chalk210.green("All sessions already summarised."));
|
|
31649
31920
|
return;
|
|
31650
31921
|
}
|
|
31651
31922
|
console.log(
|
|
31652
|
-
|
|
31923
|
+
chalk210.cyan(
|
|
31653
31924
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
31654
31925
|
)
|
|
31655
31926
|
);
|
|
31656
31927
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
31657
31928
|
console.log(
|
|
31658
|
-
|
|
31929
|
+
chalk210.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk210.yellow(`, ${failed2} skipped`) : "")
|
|
31659
31930
|
);
|
|
31660
31931
|
}
|
|
31661
31932
|
function selectCandidates(files, options2) {
|
|
@@ -31675,16 +31946,16 @@ function processSessions(files) {
|
|
|
31675
31946
|
let failed2 = 0;
|
|
31676
31947
|
for (let i = 0; i < files.length; i++) {
|
|
31677
31948
|
const file = files[i];
|
|
31678
|
-
process.stdout.write(
|
|
31949
|
+
process.stdout.write(chalk210.dim(` [${i + 1}/${files.length}] `));
|
|
31679
31950
|
const summary = summariseSession(file);
|
|
31680
31951
|
if (summary) {
|
|
31681
31952
|
writeSummary(file, summary);
|
|
31682
31953
|
succeeded++;
|
|
31683
|
-
process.stdout.write(`${
|
|
31954
|
+
process.stdout.write(`${chalk210.green("\u2713")} ${summary}
|
|
31684
31955
|
`);
|
|
31685
31956
|
} else {
|
|
31686
31957
|
failed2++;
|
|
31687
|
-
process.stdout.write(` ${
|
|
31958
|
+
process.stdout.write(` ${chalk210.yellow("skip")}
|
|
31688
31959
|
`);
|
|
31689
31960
|
}
|
|
31690
31961
|
}
|
|
@@ -31705,7 +31976,7 @@ function registerSessions(program2) {
|
|
|
31705
31976
|
}
|
|
31706
31977
|
|
|
31707
31978
|
// src/commands/statusLine.ts
|
|
31708
|
-
import
|
|
31979
|
+
import chalk212 from "chalk";
|
|
31709
31980
|
|
|
31710
31981
|
// src/shared/contextLevel.ts
|
|
31711
31982
|
function contextLevel(pct) {
|
|
@@ -31715,7 +31986,7 @@ function contextLevel(pct) {
|
|
|
31715
31986
|
}
|
|
31716
31987
|
|
|
31717
31988
|
// src/commands/buildLimitsSegment.ts
|
|
31718
|
-
import
|
|
31989
|
+
import chalk211 from "chalk";
|
|
31719
31990
|
|
|
31720
31991
|
// src/shared/rateLimitLevel.ts
|
|
31721
31992
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -31746,9 +32017,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
31746
32017
|
|
|
31747
32018
|
// src/commands/buildLimitsSegment.ts
|
|
31748
32019
|
var LEVEL_COLOR = {
|
|
31749
|
-
ok:
|
|
31750
|
-
warn:
|
|
31751
|
-
over:
|
|
32020
|
+
ok: chalk211.green,
|
|
32021
|
+
warn: chalk211.yellow,
|
|
32022
|
+
over: chalk211.red
|
|
31752
32023
|
};
|
|
31753
32024
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
31754
32025
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -31830,13 +32101,13 @@ async function relayRateLimits(rateLimits) {
|
|
|
31830
32101
|
}
|
|
31831
32102
|
|
|
31832
32103
|
// src/commands/relayUsage.ts
|
|
31833
|
-
async function relayUsage(claudeSessionId,
|
|
32104
|
+
async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
31834
32105
|
if (!claudeSessionId) return;
|
|
31835
32106
|
try {
|
|
31836
32107
|
await sendToDaemon({
|
|
31837
32108
|
type: "usage",
|
|
31838
32109
|
claudeSessionId,
|
|
31839
|
-
transcriptPath,
|
|
32110
|
+
transcriptPath: transcriptPath2,
|
|
31840
32111
|
usedPct
|
|
31841
32112
|
});
|
|
31842
32113
|
} catch {
|
|
@@ -31844,7 +32115,7 @@ async function relayUsage(claudeSessionId, transcriptPath, usedPct) {
|
|
|
31844
32115
|
}
|
|
31845
32116
|
|
|
31846
32117
|
// src/commands/statusLine.ts
|
|
31847
|
-
|
|
32118
|
+
chalk212.level = 3;
|
|
31848
32119
|
function formatNumber(num) {
|
|
31849
32120
|
return num.toLocaleString("en-US");
|
|
31850
32121
|
}
|
|
@@ -31852,9 +32123,9 @@ function colorizePercent(pct) {
|
|
|
31852
32123
|
const label2 = `${Math.round(pct)}%`;
|
|
31853
32124
|
switch (contextLevel(pct)) {
|
|
31854
32125
|
case "red":
|
|
31855
|
-
return
|
|
32126
|
+
return chalk212.red(label2);
|
|
31856
32127
|
case "yellow":
|
|
31857
|
-
return
|
|
32128
|
+
return chalk212.yellow(label2);
|
|
31858
32129
|
default:
|
|
31859
32130
|
return label2;
|
|
31860
32131
|
}
|
|
@@ -31867,7 +32138,7 @@ async function statusLine() {
|
|
|
31867
32138
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
31868
32139
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
31869
32140
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
31870
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
32141
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk212.cyan(branch2)} | ` : "";
|
|
31871
32142
|
console.log(
|
|
31872
32143
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
31873
32144
|
);
|
|
@@ -31888,7 +32159,7 @@ import { fileURLToPath as fileURLToPath9 } from "url";
|
|
|
31888
32159
|
// src/commands/sync/syncClaudeMd.ts
|
|
31889
32160
|
import * as fs42 from "fs";
|
|
31890
32161
|
import * as path61 from "path";
|
|
31891
|
-
import
|
|
32162
|
+
import chalk213 from "chalk";
|
|
31892
32163
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
31893
32164
|
const source = path61.join(claudeDir, "CLAUDE.md");
|
|
31894
32165
|
const target = path61.join(targetBase, "CLAUDE.md");
|
|
@@ -31897,14 +32168,14 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
31897
32168
|
const targetContent = fs42.readFileSync(target, "utf8");
|
|
31898
32169
|
if (sourceContent !== targetContent) {
|
|
31899
32170
|
console.log(
|
|
31900
|
-
|
|
32171
|
+
chalk213.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
31901
32172
|
);
|
|
31902
32173
|
console.log();
|
|
31903
32174
|
printDiff(targetContent, sourceContent);
|
|
31904
32175
|
if (!options2?.yes) {
|
|
31905
32176
|
printAutoConfirmHint();
|
|
31906
32177
|
const confirm = await promptConfirm(
|
|
31907
|
-
|
|
32178
|
+
chalk213.red("Overwrite existing CLAUDE.md?"),
|
|
31908
32179
|
false
|
|
31909
32180
|
);
|
|
31910
32181
|
if (!confirm) {
|
|
@@ -32099,7 +32370,7 @@ function syncPi(claudeDir) {
|
|
|
32099
32370
|
// src/commands/sync/syncSettings.ts
|
|
32100
32371
|
import * as fs47 from "fs";
|
|
32101
32372
|
import * as path68 from "path";
|
|
32102
|
-
import
|
|
32373
|
+
import chalk214 from "chalk";
|
|
32103
32374
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
32104
32375
|
const source = path68.join(claudeDir, "settings.json");
|
|
32105
32376
|
const target = path68.join(targetBase, "settings.json");
|
|
@@ -32118,7 +32389,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
32118
32389
|
if (mergedContent !== normalizedTarget) {
|
|
32119
32390
|
if (!options2?.yes) {
|
|
32120
32391
|
console.log(
|
|
32121
|
-
|
|
32392
|
+
chalk214.yellow(
|
|
32122
32393
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
32123
32394
|
)
|
|
32124
32395
|
);
|
|
@@ -32126,7 +32397,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
32126
32397
|
printDiff(targetContent, mergedContent);
|
|
32127
32398
|
printAutoConfirmHint();
|
|
32128
32399
|
const confirm = await promptConfirm(
|
|
32129
|
-
|
|
32400
|
+
chalk214.red("Overwrite existing settings.json?"),
|
|
32130
32401
|
false
|
|
32131
32402
|
);
|
|
32132
32403
|
if (!confirm) {
|
|
@@ -32225,10 +32496,10 @@ async function update2() {
|
|
|
32225
32496
|
}
|
|
32226
32497
|
|
|
32227
32498
|
// src/reportCliError.ts
|
|
32228
|
-
import
|
|
32499
|
+
import chalk215 from "chalk";
|
|
32229
32500
|
function reportCliError(error) {
|
|
32230
32501
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError) {
|
|
32231
|
-
console.error(
|
|
32502
|
+
console.error(chalk215.red(error.message));
|
|
32232
32503
|
} else {
|
|
32233
32504
|
console.error(error);
|
|
32234
32505
|
}
|