@staff0rd/assist 0.439.2 → 0.440.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/allowed.cli-writes +1 -0
- package/claude/commands/bug.md +30 -5
- package/dist/allowed.cli-writes +1 -0
- package/dist/commands/sessions/web/bundle.js +266 -266
- package/dist/index.js +824 -706
- 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.440.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -10680,6 +10680,29 @@ async function insertSubtask(orm, itemId2, title, description) {
|
|
|
10680
10680
|
});
|
|
10681
10681
|
}
|
|
10682
10682
|
|
|
10683
|
+
// src/commands/backlog/createItemWithDefaults.ts
|
|
10684
|
+
async function createItemWithDefaults(fields) {
|
|
10685
|
+
const orm = await getDb();
|
|
10686
|
+
const id = await insertItem(
|
|
10687
|
+
orm,
|
|
10688
|
+
{
|
|
10689
|
+
type: fields.type,
|
|
10690
|
+
name: fields.name,
|
|
10691
|
+
description: fields.description || void 0,
|
|
10692
|
+
acceptanceCriteria: fields.acceptanceCriteria,
|
|
10693
|
+
status: "todo",
|
|
10694
|
+
starred: false
|
|
10695
|
+
},
|
|
10696
|
+
getOrigin()
|
|
10697
|
+
);
|
|
10698
|
+
if (fields.type === "bug")
|
|
10699
|
+
await insertPhaseAt(orm, id, 0, "Fix", ["Fix the bug"], null, void 0);
|
|
10700
|
+
for (const subtask of loadConfig().subtasks ?? []) {
|
|
10701
|
+
await insertSubtask(orm, id, subtask.title, subtask.description);
|
|
10702
|
+
}
|
|
10703
|
+
return id;
|
|
10704
|
+
}
|
|
10705
|
+
|
|
10683
10706
|
// src/commands/backlog/ensureRemoteOrigin.ts
|
|
10684
10707
|
import chalk73 from "chalk";
|
|
10685
10708
|
function ensureRemoteOrigin() {
|
|
@@ -10770,25 +10793,12 @@ async function add(options2) {
|
|
|
10770
10793
|
const name = options2.name ?? await promptName();
|
|
10771
10794
|
const description = options2.desc?.replaceAll(String.raw`\n`, "\n") ?? await promptDescription();
|
|
10772
10795
|
const acceptanceCriteria2 = options2.ac ?? await promptAcceptanceCriteria();
|
|
10773
|
-
const
|
|
10774
|
-
|
|
10775
|
-
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
description: description || void 0,
|
|
10780
|
-
acceptanceCriteria: acceptanceCriteria2,
|
|
10781
|
-
status: "todo",
|
|
10782
|
-
starred: false
|
|
10783
|
-
},
|
|
10784
|
-
getOrigin()
|
|
10785
|
-
);
|
|
10786
|
-
if (type === "bug") {
|
|
10787
|
-
await insertPhaseAt(orm, id, 0, "Fix", ["Fix the bug"], null, void 0);
|
|
10788
|
-
}
|
|
10789
|
-
for (const subtask of loadConfig().subtasks ?? []) {
|
|
10790
|
-
await insertSubtask(orm, id, subtask.title, subtask.description);
|
|
10791
|
-
}
|
|
10796
|
+
const id = await createItemWithDefaults({
|
|
10797
|
+
type,
|
|
10798
|
+
name,
|
|
10799
|
+
description,
|
|
10800
|
+
acceptanceCriteria: acceptanceCriteria2
|
|
10801
|
+
});
|
|
10792
10802
|
console.log(chalk74.green(`Added item ${formatItemId(id)}: ${name}`));
|
|
10793
10803
|
}
|
|
10794
10804
|
|
|
@@ -10887,6 +10897,187 @@ async function list2(options2) {
|
|
|
10887
10897
|
}
|
|
10888
10898
|
}
|
|
10889
10899
|
|
|
10900
|
+
// src/commands/backlog/propose/index.ts
|
|
10901
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
10902
|
+
import chalk79 from "chalk";
|
|
10903
|
+
|
|
10904
|
+
// src/commands/sessions/shared/reportPreviewRejection.ts
|
|
10905
|
+
function reportPreviewRejection(subject, decision) {
|
|
10906
|
+
console.error(
|
|
10907
|
+
`${subject} rejected${decision.reason ? `: ${decision.reason}` : "."}`
|
|
10908
|
+
);
|
|
10909
|
+
const comments3 = decision.comments ?? [];
|
|
10910
|
+
if (comments3.length > 0) {
|
|
10911
|
+
console.error(
|
|
10912
|
+
`
|
|
10913
|
+
The reviewer left ${comments3.length} comment${comments3.length === 1 ? "" : "s"} on the preview. Address each one, then re-run this command:
|
|
10914
|
+
`
|
|
10915
|
+
);
|
|
10916
|
+
for (const [i, c] of comments3.entries()) {
|
|
10917
|
+
const quoted = c.quote.split("\n").map((line) => ` > ${line}`).join("\n");
|
|
10918
|
+
console.error(`${i + 1}. On:
|
|
10919
|
+
${quoted}
|
|
10920
|
+
Comment: ${c.note}
|
|
10921
|
+
`);
|
|
10922
|
+
}
|
|
10923
|
+
}
|
|
10924
|
+
process.exit(1);
|
|
10925
|
+
}
|
|
10926
|
+
|
|
10927
|
+
// src/commands/sessions/shared/parsePreviewDecision.ts
|
|
10928
|
+
function parsePreviewDecision(line, requestId) {
|
|
10929
|
+
try {
|
|
10930
|
+
const msg = JSON.parse(line);
|
|
10931
|
+
if (msg.type === "error" && (msg.message ?? "").includes("pr-preview"))
|
|
10932
|
+
return { kind: "error", message: msg.message ?? "pr-preview failed" };
|
|
10933
|
+
if (msg.type !== "pr-decision" || msg.requestId !== requestId) return null;
|
|
10934
|
+
if (msg.decision !== "approve" && msg.decision !== "reject") return null;
|
|
10935
|
+
return {
|
|
10936
|
+
kind: "decision",
|
|
10937
|
+
decision: {
|
|
10938
|
+
decision: msg.decision,
|
|
10939
|
+
reason: msg.reason,
|
|
10940
|
+
comments: Array.isArray(msg.comments) ? msg.comments : void 0,
|
|
10941
|
+
screenshots: Array.isArray(msg.screenshots) ? msg.screenshots : void 0
|
|
10942
|
+
}
|
|
10943
|
+
};
|
|
10944
|
+
} catch {
|
|
10945
|
+
return null;
|
|
10946
|
+
}
|
|
10947
|
+
}
|
|
10948
|
+
|
|
10949
|
+
// src/commands/sessions/shared/requestPreviewDecision.ts
|
|
10950
|
+
function requestPreviewDecision(request) {
|
|
10951
|
+
return new Promise((resolve20, reject) => {
|
|
10952
|
+
connectToDaemon().then((socket) => {
|
|
10953
|
+
let settled = false;
|
|
10954
|
+
const finish = (error, decision) => {
|
|
10955
|
+
if (settled) return;
|
|
10956
|
+
settled = true;
|
|
10957
|
+
socket.destroy();
|
|
10958
|
+
if (error) reject(error);
|
|
10959
|
+
else resolve20(decision);
|
|
10960
|
+
};
|
|
10961
|
+
readSocketLines(socket, (line) => {
|
|
10962
|
+
const incoming = parsePreviewDecision(line, request.requestId);
|
|
10963
|
+
if (!incoming) return;
|
|
10964
|
+
if (incoming.kind === "error") finish(new Error(incoming.message));
|
|
10965
|
+
else finish(void 0, incoming.decision);
|
|
10966
|
+
});
|
|
10967
|
+
socket.on("error", (error) => finish(error));
|
|
10968
|
+
socket.on(
|
|
10969
|
+
"close",
|
|
10970
|
+
() => finish(new Error("daemon closed before a decision was made"))
|
|
10971
|
+
);
|
|
10972
|
+
socket.write(`${JSON.stringify({ type: "pr-preview", ...request })}
|
|
10973
|
+
`);
|
|
10974
|
+
}, reject);
|
|
10975
|
+
});
|
|
10976
|
+
}
|
|
10977
|
+
|
|
10978
|
+
// src/commands/sessions/shared/awaitPreviewApproval.ts
|
|
10979
|
+
async function awaitPreviewApproval(subject, request) {
|
|
10980
|
+
console.log("Awaiting your approval in the assist web UI preview pane\u2026");
|
|
10981
|
+
let decision;
|
|
10982
|
+
try {
|
|
10983
|
+
decision = await requestPreviewDecision(request);
|
|
10984
|
+
} catch (error) {
|
|
10985
|
+
console.error(
|
|
10986
|
+
`Error: ${error instanceof Error ? error.message : String(error)}`
|
|
10987
|
+
);
|
|
10988
|
+
process.exit(1);
|
|
10989
|
+
}
|
|
10990
|
+
if (decision.decision === "reject") reportPreviewRejection(subject, decision);
|
|
10991
|
+
return decision;
|
|
10992
|
+
}
|
|
10993
|
+
|
|
10994
|
+
// src/commands/backlog/propose/readProposedItem.ts
|
|
10995
|
+
import { readFileSync as readFileSync23 } from "fs";
|
|
10996
|
+
import chalk78 from "chalk";
|
|
10997
|
+
|
|
10998
|
+
// src/commands/backlog/propose/proposedItemSchema.ts
|
|
10999
|
+
import { z as z5 } from "zod";
|
|
11000
|
+
var proposedItemSchema = z5.strictObject({
|
|
11001
|
+
name: z5.string().trim().min(1, "name is required"),
|
|
11002
|
+
type: z5.enum(["story", "bug"]),
|
|
11003
|
+
description: z5.string().optional(),
|
|
11004
|
+
acceptanceCriteria: z5.array(z5.string().trim().min(1)).default([])
|
|
11005
|
+
});
|
|
11006
|
+
|
|
11007
|
+
// src/commands/backlog/propose/readProposedItem.ts
|
|
11008
|
+
function fail3(message2) {
|
|
11009
|
+
console.error(chalk78.red(message2));
|
|
11010
|
+
process.exit(1);
|
|
11011
|
+
}
|
|
11012
|
+
function describe(error) {
|
|
11013
|
+
return error instanceof Error ? error.message : String(error);
|
|
11014
|
+
}
|
|
11015
|
+
async function readSource(source) {
|
|
11016
|
+
try {
|
|
11017
|
+
if (source === "-") return (await readStdinBuffer()).toString("utf8");
|
|
11018
|
+
return readFileSync23(source, "utf8");
|
|
11019
|
+
} catch (error) {
|
|
11020
|
+
return fail3(
|
|
11021
|
+
`Cannot read the payload from ${source === "-" ? "stdin" : source}: ${describe(error)}`
|
|
11022
|
+
);
|
|
11023
|
+
}
|
|
11024
|
+
}
|
|
11025
|
+
async function readProposedItem(source) {
|
|
11026
|
+
const raw = await readSource(source);
|
|
11027
|
+
let json;
|
|
11028
|
+
try {
|
|
11029
|
+
json = JSON.parse(raw);
|
|
11030
|
+
} catch (error) {
|
|
11031
|
+
return fail3(`The payload is not valid JSON: ${describe(error)}`);
|
|
11032
|
+
}
|
|
11033
|
+
const parsed = proposedItemSchema.safeParse(json);
|
|
11034
|
+
if (!parsed.success) {
|
|
11035
|
+
const issues = parsed.error.issues.map((i) => ` ${i.path.join(".") || "(root)"}: ${i.message}`).join("\n");
|
|
11036
|
+
return fail3(`The payload is not a valid backlog item:
|
|
11037
|
+
${issues}`);
|
|
11038
|
+
}
|
|
11039
|
+
return parsed.data;
|
|
11040
|
+
}
|
|
11041
|
+
|
|
11042
|
+
// src/commands/backlog/propose/renderProposedItem.ts
|
|
11043
|
+
function renderProposedItem(item) {
|
|
11044
|
+
const sections = [`**Type:** ${item.type}`];
|
|
11045
|
+
if (item.description) sections.push("## Description", item.description);
|
|
11046
|
+
if (item.acceptanceCriteria.length > 0)
|
|
11047
|
+
sections.push(
|
|
11048
|
+
"## Acceptance Criteria",
|
|
11049
|
+
item.acceptanceCriteria.map((ac, i) => `${i + 1}. ${ac}`).join("\n")
|
|
11050
|
+
);
|
|
11051
|
+
return sections.join("\n\n");
|
|
11052
|
+
}
|
|
11053
|
+
|
|
11054
|
+
// src/commands/backlog/propose/index.ts
|
|
11055
|
+
async function reviewProposal(item) {
|
|
11056
|
+
const body = renderProposedItem(item);
|
|
11057
|
+
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
11058
|
+
if (process.env.ASSIST_SESSION === "1" && sessionId) {
|
|
11059
|
+
await awaitPreviewApproval("Backlog item preview", {
|
|
11060
|
+
sessionId,
|
|
11061
|
+
requestId: randomUUID2(),
|
|
11062
|
+
title: item.name,
|
|
11063
|
+
body,
|
|
11064
|
+
prNumber: null,
|
|
11065
|
+
kind: "backlog-item",
|
|
11066
|
+
itemType: item.type
|
|
11067
|
+
});
|
|
11068
|
+
return;
|
|
11069
|
+
}
|
|
11070
|
+
console.log(chalk79.bold(item.name));
|
|
11071
|
+
console.log(renderMarkdownTerminal(body));
|
|
11072
|
+
}
|
|
11073
|
+
async function propose(options2) {
|
|
11074
|
+
if (!ensureRemoteOrigin()) return;
|
|
11075
|
+
const item = await readProposedItem(options2.json);
|
|
11076
|
+
await reviewProposal(item);
|
|
11077
|
+
const id = await createItemWithDefaults(item);
|
|
11078
|
+
console.log(chalk79.green(`Added item ${formatItemId(id)}: ${item.name}`));
|
|
11079
|
+
}
|
|
11080
|
+
|
|
10890
11081
|
// src/commands/backlog/registerItemCommands.ts
|
|
10891
11082
|
function registerItemCommands(cmd) {
|
|
10892
11083
|
cmd.command("list").alias("ls").description("List all backlog items").option(
|
|
@@ -10897,6 +11088,12 @@ function registerItemCommands(cmd) {
|
|
|
10897
11088
|
"--desc <description>",
|
|
10898
11089
|
String.raw`Item description (Markdown supported; use \n for line breaks)`
|
|
10899
11090
|
).option("--ac <criterion...>", "Acceptance criteria (repeatable)").action(add);
|
|
11091
|
+
cmd.command("propose").description(
|
|
11092
|
+
"Preview a complete backlog item for approval, then create it on approval"
|
|
11093
|
+
).requiredOption(
|
|
11094
|
+
"--json <file|->",
|
|
11095
|
+
"Path to a JSON payload describing the item, or - to read it from stdin"
|
|
11096
|
+
).action(propose);
|
|
10900
11097
|
cmd.command("add-phase <id> <name>").description("Add a phase to an existing backlog item").option("--task <task...>", "Task description (repeatable)").option(
|
|
10901
11098
|
"--manual-check <check...>",
|
|
10902
11099
|
"Manual check description (repeatable)"
|
|
@@ -10907,7 +11104,7 @@ function registerItemCommands(cmd) {
|
|
|
10907
11104
|
}
|
|
10908
11105
|
|
|
10909
11106
|
// src/commands/backlog/link.ts
|
|
10910
|
-
import
|
|
11107
|
+
import chalk81 from "chalk";
|
|
10911
11108
|
|
|
10912
11109
|
// src/commands/backlog/hasCycle.ts
|
|
10913
11110
|
function hasCycle(adjacency, fromId, toId) {
|
|
@@ -10939,14 +11136,14 @@ async function loadDependencyGraph(orm) {
|
|
|
10939
11136
|
}
|
|
10940
11137
|
|
|
10941
11138
|
// src/commands/backlog/validateLinkTarget.ts
|
|
10942
|
-
import
|
|
11139
|
+
import chalk80 from "chalk";
|
|
10943
11140
|
function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
10944
11141
|
const duplicate = (fromItem.links ?? []).some(
|
|
10945
11142
|
(l) => l.targetId === toNum && l.type === linkType
|
|
10946
11143
|
);
|
|
10947
11144
|
if (duplicate) {
|
|
10948
11145
|
console.log(
|
|
10949
|
-
|
|
11146
|
+
chalk80.yellow(
|
|
10950
11147
|
`Link already exists: ${formatItemId(fromNum)} ${linkType} ${formatItemId(toNum)}`
|
|
10951
11148
|
)
|
|
10952
11149
|
);
|
|
@@ -10956,20 +11153,20 @@ function validateLinkTarget(fromItem, fromNum, toNum, linkType) {
|
|
|
10956
11153
|
}
|
|
10957
11154
|
|
|
10958
11155
|
// src/commands/backlog/link.ts
|
|
10959
|
-
function
|
|
10960
|
-
console.log(
|
|
11156
|
+
function fail4(message2) {
|
|
11157
|
+
console.log(chalk81.red(message2));
|
|
10961
11158
|
return void 0;
|
|
10962
11159
|
}
|
|
10963
11160
|
function parseLinkType(type) {
|
|
10964
11161
|
const linkType = type ?? "relates-to";
|
|
10965
11162
|
if (linkType === "relates-to" || linkType === "depends-on") return linkType;
|
|
10966
|
-
return
|
|
11163
|
+
return fail4(`Invalid link type: ${linkType}`);
|
|
10967
11164
|
}
|
|
10968
11165
|
async function createsCycle(orm, linkType, fromNum, toNum) {
|
|
10969
11166
|
if (linkType !== "depends-on") return false;
|
|
10970
11167
|
const graph = await loadDependencyGraph(orm);
|
|
10971
11168
|
if (!hasCycle(graph, fromNum, toNum)) return false;
|
|
10972
|
-
|
|
11169
|
+
fail4(
|
|
10973
11170
|
`Cannot add dependency: ${formatItemId(fromNum)} \u2192 ${formatItemId(toNum)} would create a cycle.`
|
|
10974
11171
|
);
|
|
10975
11172
|
return true;
|
|
@@ -10979,22 +11176,22 @@ async function link(fromId, toId, opts) {
|
|
|
10979
11176
|
if (!linkType) return;
|
|
10980
11177
|
const fromNum = parseItemId(fromId);
|
|
10981
11178
|
const toNum = parseItemId(toId);
|
|
10982
|
-
if (fromNum === toNum) return void
|
|
11179
|
+
if (fromNum === toNum) return void fail4("Cannot link an item to itself.");
|
|
10983
11180
|
const from = formatItemId(fromNum);
|
|
10984
11181
|
const to = formatItemId(toNum);
|
|
10985
11182
|
const { orm } = await getReady();
|
|
10986
11183
|
const fromItem = await loadItem(orm, fromNum);
|
|
10987
|
-
if (!fromItem) return void
|
|
11184
|
+
if (!fromItem) return void fail4(`Item ${from} not found.`);
|
|
10988
11185
|
const toItem = await loadItem(orm, toNum);
|
|
10989
|
-
if (!toItem) return void
|
|
11186
|
+
if (!toItem) return void fail4(`Item ${to} not found.`);
|
|
10990
11187
|
if (!validateLinkTarget(fromItem, fromNum, toNum, linkType)) return;
|
|
10991
11188
|
if (await createsCycle(orm, linkType, fromNum, toNum)) return;
|
|
10992
11189
|
await orm.insert(links).values({ itemId: fromNum, type: linkType, targetId: toNum });
|
|
10993
|
-
console.log(
|
|
11190
|
+
console.log(chalk81.green(`Linked ${from} ${linkType} ${to} (${toItem.name})`));
|
|
10994
11191
|
}
|
|
10995
11192
|
|
|
10996
11193
|
// src/commands/backlog/unlink.ts
|
|
10997
|
-
import
|
|
11194
|
+
import chalk82 from "chalk";
|
|
10998
11195
|
import { and as and9, eq as eq24 } from "drizzle-orm";
|
|
10999
11196
|
async function unlink(fromId, toId) {
|
|
11000
11197
|
const fromNum = parseItemId(fromId);
|
|
@@ -11002,18 +11199,18 @@ async function unlink(fromId, toId) {
|
|
|
11002
11199
|
const { orm } = await getReady();
|
|
11003
11200
|
const fromItem = await loadItem(orm, fromNum);
|
|
11004
11201
|
if (!fromItem) {
|
|
11005
|
-
console.log(
|
|
11202
|
+
console.log(chalk82.red(`Item ${formatItemId(fromNum)} not found.`));
|
|
11006
11203
|
return;
|
|
11007
11204
|
}
|
|
11008
11205
|
if (!fromItem.links || fromItem.links.length === 0) {
|
|
11009
11206
|
console.log(
|
|
11010
|
-
|
|
11207
|
+
chalk82.yellow(`No links found on item ${formatItemId(fromNum)}.`)
|
|
11011
11208
|
);
|
|
11012
11209
|
return;
|
|
11013
11210
|
}
|
|
11014
11211
|
if (!fromItem.links.some((l) => l.targetId === toNum)) {
|
|
11015
11212
|
console.log(
|
|
11016
|
-
|
|
11213
|
+
chalk82.yellow(
|
|
11017
11214
|
`No link from ${formatItemId(fromNum)} to ${formatItemId(toNum)} found.`
|
|
11018
11215
|
)
|
|
11019
11216
|
);
|
|
@@ -11021,7 +11218,7 @@ async function unlink(fromId, toId) {
|
|
|
11021
11218
|
}
|
|
11022
11219
|
await orm.delete(links).where(and9(eq24(links.itemId, fromNum), eq24(links.targetId, toNum)));
|
|
11023
11220
|
console.log(
|
|
11024
|
-
|
|
11221
|
+
chalk82.green(
|
|
11025
11222
|
`Removed link from ${formatItemId(fromNum)} to ${formatItemId(toNum)}.`
|
|
11026
11223
|
)
|
|
11027
11224
|
);
|
|
@@ -11038,17 +11235,17 @@ function registerLinkCommands(cmd) {
|
|
|
11038
11235
|
}
|
|
11039
11236
|
|
|
11040
11237
|
// src/commands/backlog/move-repo/index.ts
|
|
11041
|
-
import
|
|
11238
|
+
import chalk84 from "chalk";
|
|
11042
11239
|
import { eq as eq26 } from "drizzle-orm";
|
|
11043
11240
|
|
|
11044
11241
|
// src/commands/backlog/move-repo/confirmMove.ts
|
|
11045
|
-
import
|
|
11242
|
+
import chalk83 from "chalk";
|
|
11046
11243
|
function pluralItems(n) {
|
|
11047
11244
|
return `${n} item${n === 1 ? "" : "s"}`;
|
|
11048
11245
|
}
|
|
11049
11246
|
async function confirmMove(cnt, oldOrigin, newOrigin) {
|
|
11050
11247
|
console.log(
|
|
11051
|
-
`${pluralItems(cnt)}: ${
|
|
11248
|
+
`${pluralItems(cnt)}: ${chalk83.cyan(oldOrigin)} \u2192 ${chalk83.cyan(newOrigin)}`
|
|
11052
11249
|
);
|
|
11053
11250
|
return promptConfirm(`Retag ${pluralItems(cnt)}?`);
|
|
11054
11251
|
}
|
|
@@ -11079,29 +11276,29 @@ Pass the full origin.`
|
|
|
11079
11276
|
}
|
|
11080
11277
|
|
|
11081
11278
|
// src/commands/backlog/move-repo/index.ts
|
|
11082
|
-
function
|
|
11083
|
-
console.log(
|
|
11279
|
+
function fail5(message2) {
|
|
11280
|
+
console.log(chalk84.red(message2));
|
|
11084
11281
|
process.exitCode = 1;
|
|
11085
11282
|
}
|
|
11086
11283
|
async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
11087
11284
|
const newOrigin = newOriginRaw ? normalizeOrigin(newOriginRaw) : getOrigin();
|
|
11088
11285
|
const { orm } = await getReady();
|
|
11089
11286
|
const resolved = await resolveOldOrigin(orm, normalizeOrigin(oldOriginRaw));
|
|
11090
|
-
if ("error" in resolved) return
|
|
11287
|
+
if ("error" in resolved) return fail5(resolved.error);
|
|
11091
11288
|
const oldOrigin = resolved.origin;
|
|
11092
11289
|
if (oldOrigin === newOrigin) {
|
|
11093
|
-
return
|
|
11290
|
+
return fail5(
|
|
11094
11291
|
`Old and new origins both resolve to "${oldOrigin}"; nothing to move.`
|
|
11095
11292
|
);
|
|
11096
11293
|
}
|
|
11097
11294
|
const cnt = await countByOrigin(orm, oldOrigin);
|
|
11098
11295
|
if (!options2.yes && !await confirmMove(cnt, oldOrigin, newOrigin)) {
|
|
11099
|
-
console.log(
|
|
11296
|
+
console.log(chalk84.yellow("Move cancelled; no changes made."));
|
|
11100
11297
|
return;
|
|
11101
11298
|
}
|
|
11102
11299
|
await orm.update(items).set({ origin: newOrigin }).where(eq26(items.origin, oldOrigin));
|
|
11103
11300
|
console.log(
|
|
11104
|
-
|
|
11301
|
+
chalk84.green(
|
|
11105
11302
|
`Moved ${pluralItems(cnt)} from "${oldOrigin}" to "${newOrigin}".`
|
|
11106
11303
|
)
|
|
11107
11304
|
);
|
|
@@ -11130,11 +11327,11 @@ function registerPlanCommands(cmd) {
|
|
|
11130
11327
|
}
|
|
11131
11328
|
|
|
11132
11329
|
// src/commands/backlog/refine.ts
|
|
11133
|
-
import
|
|
11330
|
+
import chalk87 from "chalk";
|
|
11134
11331
|
import enquirer7 from "enquirer";
|
|
11135
11332
|
|
|
11136
11333
|
// src/commands/backlog/launchMode.ts
|
|
11137
|
-
import { randomUUID as
|
|
11334
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
11138
11335
|
|
|
11139
11336
|
// src/shared/spawnCodex.ts
|
|
11140
11337
|
function spawnCodex(prompt, options2 = {}) {
|
|
@@ -11164,7 +11361,7 @@ function spawnHarness(harness, prompt, options2 = {}) {
|
|
|
11164
11361
|
}
|
|
11165
11362
|
|
|
11166
11363
|
// src/commands/backlog/handleLaunchSignal.ts
|
|
11167
|
-
import
|
|
11364
|
+
import chalk86 from "chalk";
|
|
11168
11365
|
|
|
11169
11366
|
// src/commands/backlog/surfaceCreatedItem.ts
|
|
11170
11367
|
async function surfaceCreatedItem(slashCommand, id) {
|
|
@@ -11187,32 +11384,32 @@ async function surfaceCreatedItem(slashCommand, id) {
|
|
|
11187
11384
|
}
|
|
11188
11385
|
|
|
11189
11386
|
// src/commands/backlog/tryRunById.ts
|
|
11190
|
-
import
|
|
11387
|
+
import chalk85 from "chalk";
|
|
11191
11388
|
async function tryRunById(id, options2) {
|
|
11192
11389
|
const numericId = parseItemId(id);
|
|
11193
11390
|
const label2 = formatItemId(numericId);
|
|
11194
11391
|
const { orm } = await getReady();
|
|
11195
11392
|
const item = await loadItem(orm, numericId);
|
|
11196
11393
|
if (!item) {
|
|
11197
|
-
console.log(
|
|
11394
|
+
console.log(chalk85.red(`Item ${label2} not found.`));
|
|
11198
11395
|
return false;
|
|
11199
11396
|
}
|
|
11200
11397
|
if (item.status === "done") {
|
|
11201
|
-
console.log(
|
|
11398
|
+
console.log(chalk85.red(`Item ${label2} is already done.`));
|
|
11202
11399
|
return false;
|
|
11203
11400
|
}
|
|
11204
11401
|
if (item.status === "wontdo") {
|
|
11205
|
-
console.log(
|
|
11402
|
+
console.log(chalk85.red(`Item ${label2} is marked won't do.`));
|
|
11206
11403
|
return false;
|
|
11207
11404
|
}
|
|
11208
11405
|
const hasDeps = (item.links ?? []).some((l) => l.type === "depends-on");
|
|
11209
11406
|
if (hasDeps && isBlocked(item, await loadItemSummaries(orm, getOrigin()))) {
|
|
11210
11407
|
console.log(
|
|
11211
|
-
|
|
11408
|
+
chalk85.red(`Item ${label2} is blocked by unresolved dependencies.`)
|
|
11212
11409
|
);
|
|
11213
11410
|
return false;
|
|
11214
11411
|
}
|
|
11215
|
-
console.log(
|
|
11412
|
+
console.log(chalk85.bold(`
|
|
11216
11413
|
Running backlog item ${label2}...
|
|
11217
11414
|
`));
|
|
11218
11415
|
await run2(id, options2);
|
|
@@ -11231,13 +11428,13 @@ async function handleLaunchSignal(slashCommand, once) {
|
|
|
11231
11428
|
if (typeof signal.id === "string" && signal.id) {
|
|
11232
11429
|
if (await tryRunById(signal.id, { allowEdits: true })) return;
|
|
11233
11430
|
}
|
|
11234
|
-
console.log(
|
|
11431
|
+
console.log(chalk86.bold("\nChaining into assist next...\n"));
|
|
11235
11432
|
await next({ allowEdits: true, once });
|
|
11236
11433
|
}
|
|
11237
11434
|
} catch (error) {
|
|
11238
11435
|
const message2 = error instanceof Error ? error.message : String(error);
|
|
11239
11436
|
console.error(
|
|
11240
|
-
|
|
11437
|
+
chalk86.yellow(
|
|
11241
11438
|
`
|
|
11242
11439
|
Could not complete post-run step (${message2}).
|
|
11243
11440
|
This is usually a transient database/network blip \u2014 the work is saved and the session is safe to resume.`
|
|
@@ -11255,7 +11452,7 @@ async function launchMode(slashCommand, options2) {
|
|
|
11255
11452
|
const resumeSessionId = options2?.resumeSessionId;
|
|
11256
11453
|
if (!resumeSessionId) pullIfConfigured();
|
|
11257
11454
|
process.env.ASSIST_SESSION_ID ??= String(process.pid);
|
|
11258
|
-
const claudeSessionId = resumeSessionId ??
|
|
11455
|
+
const claudeSessionId = resumeSessionId ?? randomUUID3();
|
|
11259
11456
|
emitActivity({
|
|
11260
11457
|
kind: "command",
|
|
11261
11458
|
name: slashCommand,
|
|
@@ -11284,13 +11481,13 @@ async function pickItemForRefine() {
|
|
|
11284
11481
|
(i) => i.status === "todo" || i.status === "in-progress"
|
|
11285
11482
|
);
|
|
11286
11483
|
if (active.length === 0) {
|
|
11287
|
-
console.log(
|
|
11484
|
+
console.log(chalk87.yellow("No active backlog items to refine."));
|
|
11288
11485
|
return void 0;
|
|
11289
11486
|
}
|
|
11290
11487
|
if (active.length === 1) {
|
|
11291
11488
|
const item = active[0];
|
|
11292
11489
|
console.log(
|
|
11293
|
-
|
|
11490
|
+
chalk87.bold(`Auto-selecting item ${formatItemId(item.id)}: ${item.name}`)
|
|
11294
11491
|
);
|
|
11295
11492
|
return formatItemId(item.id);
|
|
11296
11493
|
}
|
|
@@ -11338,7 +11535,7 @@ function registerRefineCommand(cmd) {
|
|
|
11338
11535
|
}
|
|
11339
11536
|
|
|
11340
11537
|
// src/commands/backlog/rewindPhase.ts
|
|
11341
|
-
import
|
|
11538
|
+
import chalk88 from "chalk";
|
|
11342
11539
|
async function rewindPhase(id, phase, opts) {
|
|
11343
11540
|
const phaseNumber = Number.parseInt(phase, 10);
|
|
11344
11541
|
const found = await findOneItem(id);
|
|
@@ -11346,12 +11543,12 @@ async function rewindPhase(id, phase, opts) {
|
|
|
11346
11543
|
const { orm, item } = found;
|
|
11347
11544
|
const result = await rewindItemToPhase(orm, item, phaseNumber, opts.reason);
|
|
11348
11545
|
if (!result.ok) {
|
|
11349
|
-
console.log(
|
|
11546
|
+
console.log(chalk88.red(result.error));
|
|
11350
11547
|
process.exitCode = 1;
|
|
11351
11548
|
return;
|
|
11352
11549
|
}
|
|
11353
11550
|
console.log(
|
|
11354
|
-
|
|
11551
|
+
chalk88.green(
|
|
11355
11552
|
`Rewound item ${formatItemId(item.id)} to phase ${phaseNumber} (${result.phaseName}).`
|
|
11356
11553
|
)
|
|
11357
11554
|
);
|
|
@@ -11379,22 +11576,22 @@ function registerRunCommand(cmd) {
|
|
|
11379
11576
|
}
|
|
11380
11577
|
|
|
11381
11578
|
// src/commands/backlog/search/index.ts
|
|
11382
|
-
import
|
|
11579
|
+
import chalk89 from "chalk";
|
|
11383
11580
|
async function search(query) {
|
|
11384
11581
|
const items2 = await searchBacklog(query);
|
|
11385
11582
|
if (items2.length === 0) {
|
|
11386
|
-
console.log(
|
|
11583
|
+
console.log(chalk89.dim(`No items matching "${query}".`));
|
|
11387
11584
|
return;
|
|
11388
11585
|
}
|
|
11389
11586
|
console.log(
|
|
11390
|
-
|
|
11587
|
+
chalk89.dim(
|
|
11391
11588
|
`${items2.length} item${items2.length === 1 ? "" : "s"} matching "${query}":
|
|
11392
11589
|
`
|
|
11393
11590
|
)
|
|
11394
11591
|
);
|
|
11395
11592
|
for (const item of items2) {
|
|
11396
11593
|
console.log(
|
|
11397
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
11594
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk89.dim(formatItemId(item.id))} ${item.name}`
|
|
11398
11595
|
);
|
|
11399
11596
|
}
|
|
11400
11597
|
}
|
|
@@ -11405,18 +11602,18 @@ function registerSearchCommand(cmd) {
|
|
|
11405
11602
|
}
|
|
11406
11603
|
|
|
11407
11604
|
// src/commands/backlog/delete/index.ts
|
|
11408
|
-
import
|
|
11605
|
+
import chalk90 from "chalk";
|
|
11409
11606
|
async function del(id) {
|
|
11410
11607
|
const name = await removeItem(id);
|
|
11411
11608
|
if (name) {
|
|
11412
11609
|
console.log(
|
|
11413
|
-
|
|
11610
|
+
chalk90.green(`Deleted item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
11414
11611
|
);
|
|
11415
11612
|
}
|
|
11416
11613
|
}
|
|
11417
11614
|
|
|
11418
11615
|
// src/commands/backlog/done/index.ts
|
|
11419
|
-
import
|
|
11616
|
+
import chalk91 from "chalk";
|
|
11420
11617
|
async function done(id, summary) {
|
|
11421
11618
|
const found = await findOneItem(id);
|
|
11422
11619
|
if (!found) return;
|
|
@@ -11430,12 +11627,12 @@ async function done(id, summary) {
|
|
|
11430
11627
|
const pending = item.plan.slice(completedCount);
|
|
11431
11628
|
if (pending.length > 0) {
|
|
11432
11629
|
console.log(
|
|
11433
|
-
|
|
11630
|
+
chalk91.red(
|
|
11434
11631
|
`Cannot complete item ${formatItemId(item.id)}: ${pending.length} pending phase(s):`
|
|
11435
11632
|
)
|
|
11436
11633
|
);
|
|
11437
11634
|
for (const phase of pending) {
|
|
11438
|
-
console.log(
|
|
11635
|
+
console.log(chalk91.yellow(` - ${phase.name}`));
|
|
11439
11636
|
}
|
|
11440
11637
|
process.exitCode = 1;
|
|
11441
11638
|
return;
|
|
@@ -11447,12 +11644,12 @@ async function done(id, summary) {
|
|
|
11447
11644
|
await appendComment(orm, item.id, summary, { phase, type: "summary" });
|
|
11448
11645
|
}
|
|
11449
11646
|
console.log(
|
|
11450
|
-
|
|
11647
|
+
chalk91.green(`Completed item ${formatItemId(item.id)}: ${item.name}`)
|
|
11451
11648
|
);
|
|
11452
11649
|
}
|
|
11453
11650
|
|
|
11454
11651
|
// src/commands/backlog/set-status/index.ts
|
|
11455
|
-
import
|
|
11652
|
+
import chalk92 from "chalk";
|
|
11456
11653
|
var allowedStatuses = [
|
|
11457
11654
|
"todo",
|
|
11458
11655
|
"in-progress",
|
|
@@ -11462,7 +11659,7 @@ var allowedStatuses = [
|
|
|
11462
11659
|
async function setStatusCommand(id, status3) {
|
|
11463
11660
|
if (!allowedStatuses.includes(status3)) {
|
|
11464
11661
|
console.log(
|
|
11465
|
-
|
|
11662
|
+
chalk92.red(
|
|
11466
11663
|
`Invalid status "${status3}". Must be one of: ${allowedStatuses.join(", ")}.`
|
|
11467
11664
|
)
|
|
11468
11665
|
);
|
|
@@ -11472,7 +11669,7 @@ async function setStatusCommand(id, status3) {
|
|
|
11472
11669
|
const name = await setStatus(id, status3);
|
|
11473
11670
|
if (name) {
|
|
11474
11671
|
console.log(
|
|
11475
|
-
|
|
11672
|
+
chalk92.green(
|
|
11476
11673
|
`Set item ${formatItemId(parseItemId(id))} to ${status3}: ${name}`
|
|
11477
11674
|
)
|
|
11478
11675
|
);
|
|
@@ -11480,16 +11677,16 @@ async function setStatusCommand(id, status3) {
|
|
|
11480
11677
|
}
|
|
11481
11678
|
|
|
11482
11679
|
// src/commands/backlog/star/index.ts
|
|
11483
|
-
import
|
|
11680
|
+
import chalk94 from "chalk";
|
|
11484
11681
|
|
|
11485
11682
|
// src/commands/backlog/setStarred.ts
|
|
11486
|
-
import
|
|
11683
|
+
import chalk93 from "chalk";
|
|
11487
11684
|
async function setStarred(id, starred) {
|
|
11488
11685
|
const { orm } = await getReady();
|
|
11489
11686
|
const numId = parseItemId(id);
|
|
11490
11687
|
const name = await updateStarred(orm, numId, starred);
|
|
11491
11688
|
if (name === void 0)
|
|
11492
|
-
console.log(
|
|
11689
|
+
console.log(chalk93.red(`Item ${formatItemId(numId)} not found.`));
|
|
11493
11690
|
return name;
|
|
11494
11691
|
}
|
|
11495
11692
|
|
|
@@ -11498,52 +11695,52 @@ async function star(id) {
|
|
|
11498
11695
|
const name = await setStarred(id, true);
|
|
11499
11696
|
if (name) {
|
|
11500
11697
|
console.log(
|
|
11501
|
-
|
|
11698
|
+
chalk94.green(`Starred item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
11502
11699
|
);
|
|
11503
11700
|
}
|
|
11504
11701
|
}
|
|
11505
11702
|
|
|
11506
11703
|
// src/commands/backlog/start/index.ts
|
|
11507
|
-
import
|
|
11704
|
+
import chalk95 from "chalk";
|
|
11508
11705
|
async function start(id) {
|
|
11509
11706
|
const name = await setStatus(id, "in-progress");
|
|
11510
11707
|
if (name) {
|
|
11511
11708
|
console.log(
|
|
11512
|
-
|
|
11709
|
+
chalk95.green(`Started item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
11513
11710
|
);
|
|
11514
11711
|
}
|
|
11515
11712
|
}
|
|
11516
11713
|
|
|
11517
11714
|
// src/commands/backlog/stop/index.ts
|
|
11518
|
-
import
|
|
11715
|
+
import chalk96 from "chalk";
|
|
11519
11716
|
import { and as and10, eq as eq27 } from "drizzle-orm";
|
|
11520
11717
|
async function stop() {
|
|
11521
11718
|
const { orm } = await getReady();
|
|
11522
11719
|
const stopped = await orm.update(items).set({ status: "todo", currentPhase: 1 }).where(and10(eq27(items.status, "in-progress"), eq27(items.origin, getOrigin()))).returning({ id: items.id, name: items.name });
|
|
11523
11720
|
if (stopped.length === 0) {
|
|
11524
|
-
console.log(
|
|
11721
|
+
console.log(chalk96.yellow("No in-progress items to stop."));
|
|
11525
11722
|
return;
|
|
11526
11723
|
}
|
|
11527
11724
|
for (const item of stopped) {
|
|
11528
11725
|
console.log(
|
|
11529
|
-
|
|
11726
|
+
chalk96.yellow(`Stopped item ${formatItemId(item.id)}: ${item.name}`)
|
|
11530
11727
|
);
|
|
11531
11728
|
}
|
|
11532
11729
|
}
|
|
11533
11730
|
|
|
11534
11731
|
// src/commands/backlog/unstar/index.ts
|
|
11535
|
-
import
|
|
11732
|
+
import chalk97 from "chalk";
|
|
11536
11733
|
async function unstar(id) {
|
|
11537
11734
|
const name = await setStarred(id, false);
|
|
11538
11735
|
if (name) {
|
|
11539
11736
|
console.log(
|
|
11540
|
-
|
|
11737
|
+
chalk97.green(`Unstarred item ${formatItemId(parseItemId(id))}: ${name}`)
|
|
11541
11738
|
);
|
|
11542
11739
|
}
|
|
11543
11740
|
}
|
|
11544
11741
|
|
|
11545
11742
|
// src/commands/backlog/wontdo/index.ts
|
|
11546
|
-
import
|
|
11743
|
+
import chalk98 from "chalk";
|
|
11547
11744
|
async function wontdo(id, reason2) {
|
|
11548
11745
|
const found = await findOneItem(id);
|
|
11549
11746
|
if (!found) return;
|
|
@@ -11554,7 +11751,7 @@ async function wontdo(id, reason2) {
|
|
|
11554
11751
|
await appendComment(orm, item.id, reason2, { phase, type: "summary" });
|
|
11555
11752
|
}
|
|
11556
11753
|
console.log(
|
|
11557
|
-
|
|
11754
|
+
chalk98.red(`Won't do item ${formatItemId(item.id)}: ${item.name}`)
|
|
11558
11755
|
);
|
|
11559
11756
|
}
|
|
11560
11757
|
|
|
@@ -11573,17 +11770,17 @@ function registerStatusCommands(cmd) {
|
|
|
11573
11770
|
}
|
|
11574
11771
|
|
|
11575
11772
|
// src/commands/backlog/addSubtask.ts
|
|
11576
|
-
import
|
|
11773
|
+
import chalk99 from "chalk";
|
|
11577
11774
|
async function addSubtask(id, options2) {
|
|
11578
11775
|
const title = options2.title?.trim();
|
|
11579
11776
|
if (!title) {
|
|
11580
|
-
console.log(
|
|
11777
|
+
console.log(chalk99.red("A sub-task title is required (--title)."));
|
|
11581
11778
|
process.exitCode = 1;
|
|
11582
11779
|
return;
|
|
11583
11780
|
}
|
|
11584
11781
|
if (title.length > 50) {
|
|
11585
11782
|
console.log(
|
|
11586
|
-
|
|
11783
|
+
chalk99.red(
|
|
11587
11784
|
"A sub-task title must be 50 characters or fewer. Use --desc for longer detail."
|
|
11588
11785
|
)
|
|
11589
11786
|
);
|
|
@@ -11599,21 +11796,21 @@ async function addSubtask(id, options2) {
|
|
|
11599
11796
|
const description = options2.desc?.replaceAll(String.raw`\n`, "\n");
|
|
11600
11797
|
await insertSubtask(orm, item.id, title, description);
|
|
11601
11798
|
console.log(
|
|
11602
|
-
|
|
11799
|
+
chalk99.green(`Added sub-task to item ${formatItemId(item.id)}: ${title}`)
|
|
11603
11800
|
);
|
|
11604
11801
|
}
|
|
11605
11802
|
|
|
11606
11803
|
// src/commands/backlog/editSubtask.ts
|
|
11607
|
-
import
|
|
11804
|
+
import chalk101 from "chalk";
|
|
11608
11805
|
|
|
11609
11806
|
// src/commands/backlog/resolveSubtaskIndex.ts
|
|
11610
|
-
import
|
|
11807
|
+
import chalk100 from "chalk";
|
|
11611
11808
|
function resolveSubtaskIndex(index3, item) {
|
|
11612
11809
|
const position = Number.parseInt(index3, 10);
|
|
11613
11810
|
const subtasks = item.subtasks ?? [];
|
|
11614
11811
|
if (Number.isNaN(position) || position < 1 || position > subtasks.length) {
|
|
11615
11812
|
console.log(
|
|
11616
|
-
|
|
11813
|
+
chalk100.red(
|
|
11617
11814
|
`Item ${formatItemId(item.id)} has no sub-task ${index3}${subtasks.length > 0 ? ` (1-${subtasks.length})` : ""}.`
|
|
11618
11815
|
)
|
|
11619
11816
|
);
|
|
@@ -11680,21 +11877,21 @@ async function editSubtask(id, index3, options2) {
|
|
|
11680
11877
|
if (!found) return;
|
|
11681
11878
|
const fields = buildUpdate(options2);
|
|
11682
11879
|
if (typeof fields === "string") {
|
|
11683
|
-
console.log(
|
|
11880
|
+
console.log(chalk101.red(fields));
|
|
11684
11881
|
process.exitCode = 1;
|
|
11685
11882
|
return;
|
|
11686
11883
|
}
|
|
11687
11884
|
const { orm, item, idx } = found;
|
|
11688
11885
|
const title = await updateSubtask(orm, item.id, idx, fields);
|
|
11689
11886
|
console.log(
|
|
11690
|
-
|
|
11887
|
+
chalk101.green(
|
|
11691
11888
|
`Updated sub-task ${idx + 1} of item ${formatItemId(item.id)}: ${title}`
|
|
11692
11889
|
)
|
|
11693
11890
|
);
|
|
11694
11891
|
}
|
|
11695
11892
|
|
|
11696
11893
|
// src/commands/backlog/removeSubtask.ts
|
|
11697
|
-
import
|
|
11894
|
+
import chalk102 from "chalk";
|
|
11698
11895
|
|
|
11699
11896
|
// src/commands/backlog/deleteSubtask.ts
|
|
11700
11897
|
import { and as and12, asc as asc6, eq as eq29 } from "drizzle-orm";
|
|
@@ -11719,18 +11916,18 @@ async function removeSubtask(id, index3) {
|
|
|
11719
11916
|
const { orm, item, idx } = found;
|
|
11720
11917
|
const title = await deleteSubtask(orm, item.id, idx);
|
|
11721
11918
|
console.log(
|
|
11722
|
-
|
|
11919
|
+
chalk102.green(
|
|
11723
11920
|
`Removed sub-task ${idx + 1} of item ${formatItemId(item.id)}: ${title}`
|
|
11724
11921
|
)
|
|
11725
11922
|
);
|
|
11726
11923
|
}
|
|
11727
11924
|
|
|
11728
11925
|
// src/commands/backlog/subtaskStatus.ts
|
|
11729
|
-
import
|
|
11926
|
+
import chalk103 from "chalk";
|
|
11730
11927
|
async function subtaskStatus(id, index3, status3) {
|
|
11731
11928
|
if (!validSubtaskStatuses.includes(status3)) {
|
|
11732
11929
|
console.log(
|
|
11733
|
-
|
|
11930
|
+
chalk103.red(
|
|
11734
11931
|
`Invalid status "${status3}". Use one of: ${validSubtaskStatuses.join(", ")}.`
|
|
11735
11932
|
)
|
|
11736
11933
|
);
|
|
@@ -11747,7 +11944,7 @@ async function subtaskStatus(id, index3, status3) {
|
|
|
11747
11944
|
status3
|
|
11748
11945
|
);
|
|
11749
11946
|
console.log(
|
|
11750
|
-
|
|
11947
|
+
chalk103.green(
|
|
11751
11948
|
`Set sub-task ${idx + 1} of item ${formatItemId(item.id)} to ${status3}: ${title}`
|
|
11752
11949
|
)
|
|
11753
11950
|
);
|
|
@@ -11774,7 +11971,7 @@ function registerSubtaskCommands(cmd) {
|
|
|
11774
11971
|
}
|
|
11775
11972
|
|
|
11776
11973
|
// src/commands/backlog/movePhase.ts
|
|
11777
|
-
import
|
|
11974
|
+
import chalk104 from "chalk";
|
|
11778
11975
|
import { count as count5, eq as eq32 } from "drizzle-orm";
|
|
11779
11976
|
|
|
11780
11977
|
// src/commands/backlog/reorderPhaseRows.ts
|
|
@@ -11840,7 +12037,7 @@ function toIndex(value, phaseCount) {
|
|
|
11840
12037
|
const pos = Number.parseInt(value, 10);
|
|
11841
12038
|
if (Number.isNaN(pos) || pos < 1 || pos > phaseCount) {
|
|
11842
12039
|
console.log(
|
|
11843
|
-
|
|
12040
|
+
chalk104.red(
|
|
11844
12041
|
`Position "${value}" is out of range. Must be between 1 and ${phaseCount}.`
|
|
11845
12042
|
)
|
|
11846
12043
|
);
|
|
@@ -11863,11 +12060,11 @@ async function movePhase(id, from, to) {
|
|
|
11863
12060
|
if (fromIdx !== toIdx) {
|
|
11864
12061
|
await reorderPhaseRows(orm, itemId2, fromIdx, toIdx);
|
|
11865
12062
|
}
|
|
11866
|
-
console.log(
|
|
12063
|
+
console.log(chalk104.green(`Moved phase ${from} to position ${to}.`));
|
|
11867
12064
|
}
|
|
11868
12065
|
|
|
11869
12066
|
// src/commands/backlog/updatePhase.ts
|
|
11870
|
-
import
|
|
12067
|
+
import chalk106 from "chalk";
|
|
11871
12068
|
|
|
11872
12069
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
11873
12070
|
import { and as and15, eq as eq33 } from "drizzle-orm";
|
|
@@ -11902,7 +12099,7 @@ async function applyPhaseUpdate(orm, itemId2, phaseIdx, fields) {
|
|
|
11902
12099
|
}
|
|
11903
12100
|
|
|
11904
12101
|
// src/commands/backlog/findPhase.ts
|
|
11905
|
-
import
|
|
12102
|
+
import chalk105 from "chalk";
|
|
11906
12103
|
import { and as and16, count as count6, eq as eq34 } from "drizzle-orm";
|
|
11907
12104
|
async function findPhase(id, phase) {
|
|
11908
12105
|
const found = await findOneItem(id);
|
|
@@ -11913,7 +12110,7 @@ async function findPhase(id, phase) {
|
|
|
11913
12110
|
const [row] = await orm.select({ cnt: count6() }).from(planPhases).where(and16(eq34(planPhases.itemId, itemId2), eq34(planPhases.idx, phaseIdx)));
|
|
11914
12111
|
if (!row || row.cnt === 0) {
|
|
11915
12112
|
console.log(
|
|
11916
|
-
|
|
12113
|
+
chalk105.red(
|
|
11917
12114
|
`Phase ${phaseIdx + 1} not found on item ${formatItemId(itemId2)}.`
|
|
11918
12115
|
)
|
|
11919
12116
|
);
|
|
@@ -12047,7 +12244,7 @@ async function updatePhase(id, phase, options2) {
|
|
|
12047
12244
|
const { item, orm, itemId: itemId2, phaseIdx } = found;
|
|
12048
12245
|
const resolved = resolvePhaseFields(options2, item.plan?.[phaseIdx]);
|
|
12049
12246
|
if (!resolved.ok) {
|
|
12050
|
-
console.log(
|
|
12247
|
+
console.log(chalk106.red(resolved.error));
|
|
12051
12248
|
process.exitCode = 1;
|
|
12052
12249
|
return;
|
|
12053
12250
|
}
|
|
@@ -12059,7 +12256,7 @@ async function updatePhase(id, phase, options2) {
|
|
|
12059
12256
|
manualCheck && "manual checks"
|
|
12060
12257
|
].filter(Boolean).join(", ");
|
|
12061
12258
|
console.log(
|
|
12062
|
-
|
|
12259
|
+
chalk106.green(
|
|
12063
12260
|
`Updated ${fields} on phase ${phaseIdx + 1} of item ${formatItemId(itemId2)}.`
|
|
12064
12261
|
)
|
|
12065
12262
|
);
|
|
@@ -12082,7 +12279,7 @@ function registerUpdatePhaseCommand(cmd) {
|
|
|
12082
12279
|
}
|
|
12083
12280
|
|
|
12084
12281
|
// src/commands/backlog/removePhase.ts
|
|
12085
|
-
import
|
|
12282
|
+
import chalk107 from "chalk";
|
|
12086
12283
|
import { and as and17, eq as eq35 } from "drizzle-orm";
|
|
12087
12284
|
async function removePhase(id, phase) {
|
|
12088
12285
|
const found = await findPhase(id, phase);
|
|
@@ -12097,27 +12294,27 @@ async function removePhase(id, phase) {
|
|
|
12097
12294
|
await adjustCurrentPhase(tx, item, phaseIdx);
|
|
12098
12295
|
});
|
|
12099
12296
|
console.log(
|
|
12100
|
-
|
|
12297
|
+
chalk107.green(
|
|
12101
12298
|
`Removed phase ${phaseIdx + 1} from item ${formatItemId(itemId2)}.`
|
|
12102
12299
|
)
|
|
12103
12300
|
);
|
|
12104
12301
|
}
|
|
12105
12302
|
|
|
12106
12303
|
// src/commands/backlog/update/update.ts
|
|
12107
|
-
import
|
|
12304
|
+
import chalk111 from "chalk";
|
|
12108
12305
|
import { eq as eq36 } from "drizzle-orm";
|
|
12109
12306
|
|
|
12110
12307
|
// src/commands/backlog/update/buildUpdateValues.ts
|
|
12111
|
-
import
|
|
12308
|
+
import chalk108 from "chalk";
|
|
12112
12309
|
function buildUpdateValues(options2) {
|
|
12113
12310
|
const { name, desc: desc6, type, ac, origin } = options2;
|
|
12114
12311
|
if (!name && !desc6 && !type && !ac && !origin) {
|
|
12115
|
-
console.log(
|
|
12312
|
+
console.log(chalk108.red("Nothing to update. Provide at least one flag."));
|
|
12116
12313
|
process.exitCode = 1;
|
|
12117
12314
|
return void 0;
|
|
12118
12315
|
}
|
|
12119
12316
|
if (type && type !== "story" && type !== "bug") {
|
|
12120
|
-
console.log(
|
|
12317
|
+
console.log(chalk108.red('Invalid type. Must be "story" or "bug".'));
|
|
12121
12318
|
process.exitCode = 1;
|
|
12122
12319
|
return void 0;
|
|
12123
12320
|
}
|
|
@@ -12147,7 +12344,7 @@ function buildUpdateValues(options2) {
|
|
|
12147
12344
|
}
|
|
12148
12345
|
|
|
12149
12346
|
// src/commands/backlog/update/resolveAcUpdate.ts
|
|
12150
|
-
import
|
|
12347
|
+
import chalk109 from "chalk";
|
|
12151
12348
|
|
|
12152
12349
|
// src/commands/backlog/update/applyAcMutations.ts
|
|
12153
12350
|
function hasAcMutations(options2) {
|
|
@@ -12172,14 +12369,14 @@ function resolveAcUpdate(options2, currentCriteria) {
|
|
|
12172
12369
|
if (!hasAcMutations(options2)) return { ok: true, ac: options2.ac };
|
|
12173
12370
|
if (options2.ac) {
|
|
12174
12371
|
console.log(
|
|
12175
|
-
|
|
12372
|
+
chalk109.red("Cannot combine --ac with --add-ac/--edit-ac/--remove-ac.")
|
|
12176
12373
|
);
|
|
12177
12374
|
process.exitCode = 1;
|
|
12178
12375
|
return { ok: false };
|
|
12179
12376
|
}
|
|
12180
12377
|
const mutation = applyAcMutations(currentCriteria, options2);
|
|
12181
12378
|
if (!mutation.ok) {
|
|
12182
|
-
console.log(
|
|
12379
|
+
console.log(chalk109.red(mutation.error));
|
|
12183
12380
|
process.exitCode = 1;
|
|
12184
12381
|
return { ok: false };
|
|
12185
12382
|
}
|
|
@@ -12187,14 +12384,14 @@ function resolveAcUpdate(options2, currentCriteria) {
|
|
|
12187
12384
|
}
|
|
12188
12385
|
|
|
12189
12386
|
// src/commands/backlog/update/resolveOriginUpdate.ts
|
|
12190
|
-
import
|
|
12387
|
+
import chalk110 from "chalk";
|
|
12191
12388
|
function resolveOriginUpdate(optionOrigin, item) {
|
|
12192
12389
|
if (optionOrigin === void 0 || optionOrigin === false)
|
|
12193
12390
|
return { kind: "none" };
|
|
12194
12391
|
const origin = typeof optionOrigin === "string" ? normalizeOrigin(optionOrigin) : getOrigin();
|
|
12195
12392
|
if (origin === item.origin) {
|
|
12196
12393
|
console.log(
|
|
12197
|
-
|
|
12394
|
+
chalk110.yellow(
|
|
12198
12395
|
`Item ${formatItemId(item.id)} is already on origin "${origin}"; nothing to change.`
|
|
12199
12396
|
)
|
|
12200
12397
|
);
|
|
@@ -12218,7 +12415,7 @@ async function update(id, options2) {
|
|
|
12218
12415
|
const itemId2 = found.item.id;
|
|
12219
12416
|
await orm.update(items).set(built.set).where(eq36(items.id, itemId2));
|
|
12220
12417
|
console.log(
|
|
12221
|
-
|
|
12418
|
+
chalk111.green(`Updated ${built.fields} on item ${formatItemId(itemId2)}.`)
|
|
12222
12419
|
);
|
|
12223
12420
|
}
|
|
12224
12421
|
|
|
@@ -12632,7 +12829,7 @@ function extractGraphqlQuery(args) {
|
|
|
12632
12829
|
}
|
|
12633
12830
|
|
|
12634
12831
|
// src/shared/loadCliReads.ts
|
|
12635
|
-
import { existsSync as existsSync29, readFileSync as
|
|
12832
|
+
import { existsSync as existsSync29, readFileSync as readFileSync24, writeFileSync as writeFileSync22 } from "fs";
|
|
12636
12833
|
import { dirname as dirname21, resolve as resolve10 } from "path";
|
|
12637
12834
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
12638
12835
|
var __filename3 = fileURLToPath5(import.meta.url);
|
|
@@ -12642,7 +12839,7 @@ function packageRoot() {
|
|
|
12642
12839
|
}
|
|
12643
12840
|
function readLines(path71) {
|
|
12644
12841
|
if (!existsSync29(path71)) return [];
|
|
12645
|
-
return
|
|
12842
|
+
return readFileSync24(path71, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
12646
12843
|
}
|
|
12647
12844
|
var cachedReads;
|
|
12648
12845
|
var cachedWrites;
|
|
@@ -12688,7 +12885,7 @@ function findCliWrite(command) {
|
|
|
12688
12885
|
}
|
|
12689
12886
|
|
|
12690
12887
|
// src/shared/readSettingsPerms.ts
|
|
12691
|
-
import { existsSync as existsSync30, readFileSync as
|
|
12888
|
+
import { existsSync as existsSync30, readFileSync as readFileSync25 } from "fs";
|
|
12692
12889
|
import { homedir as homedir14 } from "os";
|
|
12693
12890
|
import { join as join30 } from "path";
|
|
12694
12891
|
function readSettingsPerms(key) {
|
|
@@ -12706,7 +12903,7 @@ function readSettingsPerms(key) {
|
|
|
12706
12903
|
function readPermissionArray(filePath, key) {
|
|
12707
12904
|
if (!existsSync30(filePath)) return [];
|
|
12708
12905
|
try {
|
|
12709
|
-
const data = JSON.parse(
|
|
12906
|
+
const data = JSON.parse(readFileSync25(filePath, "utf8"));
|
|
12710
12907
|
const arr = data?.permissions?.[key];
|
|
12711
12908
|
return Array.isArray(arr) ? arr.filter((e) => typeof e === "string") : [];
|
|
12712
12909
|
} catch {
|
|
@@ -13016,7 +13213,7 @@ ${reasons.join("\n")}`);
|
|
|
13016
13213
|
}
|
|
13017
13214
|
|
|
13018
13215
|
// src/commands/permitCliReads/index.ts
|
|
13019
|
-
import { existsSync as existsSync31, mkdirSync as mkdirSync13, readFileSync as
|
|
13216
|
+
import { existsSync as existsSync31, mkdirSync as mkdirSync13, readFileSync as readFileSync26, writeFileSync as writeFileSync23 } from "fs";
|
|
13020
13217
|
import { homedir as homedir16 } from "os";
|
|
13021
13218
|
import { join as join32 } from "path";
|
|
13022
13219
|
|
|
@@ -13028,11 +13225,11 @@ function assertCliExists(cli) {
|
|
|
13028
13225
|
}
|
|
13029
13226
|
|
|
13030
13227
|
// src/commands/permitCliReads/colorize.ts
|
|
13031
|
-
import
|
|
13228
|
+
import chalk112 from "chalk";
|
|
13032
13229
|
function colorize(plainOutput) {
|
|
13033
13230
|
return plainOutput.split("\n").map((line) => {
|
|
13034
|
-
if (line.startsWith(" R ")) return
|
|
13035
|
-
if (line.startsWith(" W ")) return
|
|
13231
|
+
if (line.startsWith(" R ")) return chalk112.green(line);
|
|
13232
|
+
if (line.startsWith(" W ")) return chalk112.red(line);
|
|
13036
13233
|
return line;
|
|
13037
13234
|
}).join("\n");
|
|
13038
13235
|
}
|
|
@@ -13291,7 +13488,7 @@ function logPath(cli) {
|
|
|
13291
13488
|
function readCache(cli) {
|
|
13292
13489
|
const path71 = logPath(cli);
|
|
13293
13490
|
if (!existsSync31(path71)) return void 0;
|
|
13294
|
-
return
|
|
13491
|
+
return readFileSync26(path71, "utf8");
|
|
13295
13492
|
}
|
|
13296
13493
|
function writeCache(cli, output) {
|
|
13297
13494
|
const dir = join32(homedir16(), ".assist");
|
|
@@ -13330,7 +13527,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
13330
13527
|
}
|
|
13331
13528
|
|
|
13332
13529
|
// src/commands/deny/denyAdd.ts
|
|
13333
|
-
import
|
|
13530
|
+
import chalk113 from "chalk";
|
|
13334
13531
|
|
|
13335
13532
|
// src/commands/deny/loadDenyConfig.ts
|
|
13336
13533
|
function loadDenyConfig(global) {
|
|
@@ -13350,16 +13547,16 @@ function loadDenyConfig(global) {
|
|
|
13350
13547
|
function denyAdd(pattern2, message2, options2) {
|
|
13351
13548
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
13352
13549
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
13353
|
-
console.log(
|
|
13550
|
+
console.log(chalk113.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
13354
13551
|
return;
|
|
13355
13552
|
}
|
|
13356
13553
|
deny.push({ pattern: pattern2, message: message2 });
|
|
13357
13554
|
saveDeny(deny);
|
|
13358
|
-
console.log(
|
|
13555
|
+
console.log(chalk113.green(`Added deny rule: ${pattern2} \u2192 ${message2}`));
|
|
13359
13556
|
}
|
|
13360
13557
|
|
|
13361
13558
|
// src/commands/deny/denyList.ts
|
|
13362
|
-
import
|
|
13559
|
+
import chalk114 from "chalk";
|
|
13363
13560
|
function denyList() {
|
|
13364
13561
|
const globalRaw = loadGlobalConfigRaw();
|
|
13365
13562
|
const projectRaw = loadProjectConfig();
|
|
@@ -13370,7 +13567,7 @@ function denyList() {
|
|
|
13370
13567
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
13371
13568
|
);
|
|
13372
13569
|
if (!merged || merged.length === 0) {
|
|
13373
|
-
console.log(
|
|
13570
|
+
console.log(chalk114.dim("No deny rules configured."));
|
|
13374
13571
|
return;
|
|
13375
13572
|
}
|
|
13376
13573
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -13378,23 +13575,23 @@ function denyList() {
|
|
|
13378
13575
|
for (const rule of merged) {
|
|
13379
13576
|
const inProject = projectPatterns.has(rule.pattern);
|
|
13380
13577
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
13381
|
-
const label2 = inProject && inGlobal ?
|
|
13382
|
-
console.log(`${
|
|
13578
|
+
const label2 = inProject && inGlobal ? chalk114.dim(" (project, overrides global)") : inGlobal ? chalk114.dim(" (global)") : "";
|
|
13579
|
+
console.log(`${chalk114.red(rule.pattern)} \u2192 ${rule.message}${label2}`);
|
|
13383
13580
|
}
|
|
13384
13581
|
}
|
|
13385
13582
|
|
|
13386
13583
|
// src/commands/deny/denyRemove.ts
|
|
13387
|
-
import
|
|
13584
|
+
import chalk115 from "chalk";
|
|
13388
13585
|
function denyRemove(pattern2, options2) {
|
|
13389
13586
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
13390
13587
|
const index3 = deny.findIndex((r) => r.pattern === pattern2);
|
|
13391
13588
|
if (index3 === -1) {
|
|
13392
|
-
console.log(
|
|
13589
|
+
console.log(chalk115.yellow(`No deny rule found for: ${pattern2}`));
|
|
13393
13590
|
return;
|
|
13394
13591
|
}
|
|
13395
13592
|
deny.splice(index3, 1);
|
|
13396
13593
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
13397
|
-
console.log(
|
|
13594
|
+
console.log(chalk115.green(`Removed deny rule: ${pattern2}`));
|
|
13398
13595
|
}
|
|
13399
13596
|
|
|
13400
13597
|
// src/commands/registerDeny.ts
|
|
@@ -13437,8 +13634,8 @@ function registerCliHook(program2) {
|
|
|
13437
13634
|
}
|
|
13438
13635
|
|
|
13439
13636
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
13440
|
-
import { existsSync as existsSync33, readFileSync as
|
|
13441
|
-
import
|
|
13637
|
+
import { existsSync as existsSync33, readFileSync as readFileSync28, unlinkSync as unlinkSync8, writeFileSync as writeFileSync24 } from "fs";
|
|
13638
|
+
import chalk116 from "chalk";
|
|
13442
13639
|
|
|
13443
13640
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
13444
13641
|
import { homedir as homedir17 } from "os";
|
|
@@ -13473,12 +13670,12 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
13473
13670
|
}
|
|
13474
13671
|
|
|
13475
13672
|
// src/commands/codeComment/readPinState.ts
|
|
13476
|
-
import { existsSync as existsSync32, readFileSync as
|
|
13673
|
+
import { existsSync as existsSync32, readFileSync as readFileSync27 } from "fs";
|
|
13477
13674
|
function readPinState(pin) {
|
|
13478
13675
|
const path71 = getPinStatePath(pin);
|
|
13479
13676
|
if (!existsSync32(path71)) return void 0;
|
|
13480
13677
|
try {
|
|
13481
|
-
const state = JSON.parse(
|
|
13678
|
+
const state = JSON.parse(readFileSync27(path71, "utf8"));
|
|
13482
13679
|
if (state.pin !== pin) return void 0;
|
|
13483
13680
|
return state;
|
|
13484
13681
|
} catch {
|
|
@@ -13491,21 +13688,21 @@ function codeCommentConfirm(pin) {
|
|
|
13491
13688
|
sweepRestrictedDir();
|
|
13492
13689
|
const state = readPinState(pin);
|
|
13493
13690
|
if (!state) {
|
|
13494
|
-
console.error(
|
|
13691
|
+
console.error(chalk116.red(`No pending comment for pin: ${pin}`));
|
|
13495
13692
|
process.exitCode = 1;
|
|
13496
13693
|
return;
|
|
13497
13694
|
}
|
|
13498
13695
|
if (!existsSync33(state.file)) {
|
|
13499
|
-
console.error(
|
|
13696
|
+
console.error(chalk116.red(`Target file no longer exists: ${state.file}`));
|
|
13500
13697
|
process.exitCode = 1;
|
|
13501
13698
|
return;
|
|
13502
13699
|
}
|
|
13503
|
-
const original =
|
|
13700
|
+
const original = readFileSync28(state.file, "utf8");
|
|
13504
13701
|
const lines = original.split("\n");
|
|
13505
13702
|
const index3 = state.line - 1;
|
|
13506
13703
|
if (index3 > lines.length) {
|
|
13507
13704
|
console.error(
|
|
13508
|
-
|
|
13705
|
+
chalk116.red(
|
|
13509
13706
|
`Line ${state.line} is beyond the end of ${state.file} (${lines.length} lines).`
|
|
13510
13707
|
)
|
|
13511
13708
|
);
|
|
@@ -13519,14 +13716,14 @@ function codeCommentConfirm(pin) {
|
|
|
13519
13716
|
writeFileSync24(state.file, lines.join("\n"));
|
|
13520
13717
|
unlinkSync8(getPinStatePath(pin));
|
|
13521
13718
|
console.log(
|
|
13522
|
-
|
|
13719
|
+
chalk116.green(
|
|
13523
13720
|
`Inserted "${marker} ${state.text}" at ${state.file}:${state.line}`
|
|
13524
13721
|
)
|
|
13525
13722
|
);
|
|
13526
13723
|
}
|
|
13527
13724
|
|
|
13528
13725
|
// src/commands/codeComment/codeCommentSet.ts
|
|
13529
|
-
import
|
|
13726
|
+
import chalk117 from "chalk";
|
|
13530
13727
|
|
|
13531
13728
|
// src/commands/codeComment/validateCommentText.ts
|
|
13532
13729
|
var MAX_COMMENT_LENGTH = 50;
|
|
@@ -13577,7 +13774,7 @@ function generatePin() {
|
|
|
13577
13774
|
function codeCommentSet(file, line, text17) {
|
|
13578
13775
|
const lineNumber = Number.parseInt(line, 10);
|
|
13579
13776
|
if (!Number.isInteger(lineNumber) || lineNumber < 1) {
|
|
13580
|
-
console.error(
|
|
13777
|
+
console.error(chalk117.red(`Invalid line number: ${line}`));
|
|
13581
13778
|
process.exitCode = 1;
|
|
13582
13779
|
return;
|
|
13583
13780
|
}
|
|
@@ -13585,20 +13782,20 @@ function codeCommentSet(file, line, text17) {
|
|
|
13585
13782
|
const marker = hash ? "#" : "//";
|
|
13586
13783
|
const validation = validateCommentText(text17, hash);
|
|
13587
13784
|
if (!validation.ok) {
|
|
13588
|
-
console.error(
|
|
13589
|
-
console.error(
|
|
13785
|
+
console.error(chalk117.red(`Refused: ${validation.reason}`));
|
|
13786
|
+
console.error(chalk117.red("No pin issued."));
|
|
13590
13787
|
process.exitCode = 1;
|
|
13591
13788
|
return;
|
|
13592
13789
|
}
|
|
13593
13790
|
console.error(
|
|
13594
|
-
|
|
13791
|
+
chalk117.yellow.bold(
|
|
13595
13792
|
"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."
|
|
13596
13793
|
)
|
|
13597
13794
|
);
|
|
13598
13795
|
const delivered = issuePin(file, lineNumber, validation.text);
|
|
13599
13796
|
if (!delivered) {
|
|
13600
13797
|
console.error(
|
|
13601
|
-
|
|
13798
|
+
chalk117.red(
|
|
13602
13799
|
"Could not deliver the confirmation pin via notification.\nThe comment cannot be confirmed until the notification channel works."
|
|
13603
13800
|
)
|
|
13604
13801
|
);
|
|
@@ -13608,7 +13805,7 @@ function codeCommentSet(file, line, text17) {
|
|
|
13608
13805
|
console.log(
|
|
13609
13806
|
`A confirmation pin was sent to your desktop notifications.
|
|
13610
13807
|
To insert "${marker} ${validation.text}" at ${file}:${lineNumber}, run:
|
|
13611
|
-
${
|
|
13808
|
+
${chalk117.cyan(" assist code-comment confirm <PIN>")}
|
|
13612
13809
|
using the pin from that notification.`
|
|
13613
13810
|
);
|
|
13614
13811
|
}
|
|
@@ -13687,15 +13884,15 @@ function registerCodexHook(program2) {
|
|
|
13687
13884
|
}
|
|
13688
13885
|
|
|
13689
13886
|
// src/commands/complexity/analyze.ts
|
|
13690
|
-
import
|
|
13887
|
+
import chalk126 from "chalk";
|
|
13691
13888
|
|
|
13692
13889
|
// src/commands/complexity/cyclomatic.ts
|
|
13693
|
-
import
|
|
13890
|
+
import chalk119 from "chalk";
|
|
13694
13891
|
|
|
13695
13892
|
// src/commands/complexity/shared/index.ts
|
|
13696
13893
|
import fs20 from "fs";
|
|
13697
13894
|
import path27 from "path";
|
|
13698
|
-
import
|
|
13895
|
+
import chalk118 from "chalk";
|
|
13699
13896
|
import ts5 from "typescript";
|
|
13700
13897
|
|
|
13701
13898
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -13946,7 +14143,7 @@ function createSourceFromFile(filePath) {
|
|
|
13946
14143
|
function withSourceFiles(pattern2, callback, extraIgnore = []) {
|
|
13947
14144
|
const files = findSourceFiles2(pattern2, ".", extraIgnore);
|
|
13948
14145
|
if (files.length === 0) {
|
|
13949
|
-
console.log(
|
|
14146
|
+
console.log(chalk118.yellow("No files found matching pattern"));
|
|
13950
14147
|
return void 0;
|
|
13951
14148
|
}
|
|
13952
14149
|
return callback(files);
|
|
@@ -13979,11 +14176,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
13979
14176
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
13980
14177
|
for (const { file, name, complexity } of results) {
|
|
13981
14178
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
13982
|
-
const color = exceedsThreshold ?
|
|
13983
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
14179
|
+
const color = exceedsThreshold ? chalk119.red : chalk119.white;
|
|
14180
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk119.cyan(complexity)}`);
|
|
13984
14181
|
}
|
|
13985
14182
|
console.log(
|
|
13986
|
-
|
|
14183
|
+
chalk119.dim(
|
|
13987
14184
|
`
|
|
13988
14185
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
13989
14186
|
)
|
|
@@ -13995,7 +14192,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
13995
14192
|
}
|
|
13996
14193
|
|
|
13997
14194
|
// src/commands/complexity/halstead.ts
|
|
13998
|
-
import
|
|
14195
|
+
import chalk120 from "chalk";
|
|
13999
14196
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
14000
14197
|
withSourceFiles(pattern2, (files) => {
|
|
14001
14198
|
const results = [];
|
|
@@ -14010,13 +14207,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
14010
14207
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
14011
14208
|
for (const { file, name, metrics } of results) {
|
|
14012
14209
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
14013
|
-
const color = exceedsThreshold ?
|
|
14210
|
+
const color = exceedsThreshold ? chalk120.red : chalk120.white;
|
|
14014
14211
|
console.log(
|
|
14015
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
14212
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk120.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk120.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk120.magenta(metrics.effort.toFixed(1))}`
|
|
14016
14213
|
);
|
|
14017
14214
|
}
|
|
14018
14215
|
console.log(
|
|
14019
|
-
|
|
14216
|
+
chalk120.dim(
|
|
14020
14217
|
`
|
|
14021
14218
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
14022
14219
|
)
|
|
@@ -14085,15 +14282,15 @@ function collectFileMetrics(files) {
|
|
|
14085
14282
|
}
|
|
14086
14283
|
|
|
14087
14284
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
14088
|
-
import
|
|
14285
|
+
import chalk124 from "chalk";
|
|
14089
14286
|
|
|
14090
14287
|
// src/commands/complexity/maintainability/formatResultLine.ts
|
|
14091
|
-
import
|
|
14288
|
+
import chalk121 from "chalk";
|
|
14092
14289
|
function formatResultLine(entry, failing) {
|
|
14093
14290
|
const { file, avgMaintainability, minMaintainability, override } = entry;
|
|
14094
|
-
const name = failing ?
|
|
14095
|
-
const suffix = override !== void 0 ?
|
|
14096
|
-
return `${name} \u2192 avg: ${
|
|
14291
|
+
const name = failing ? chalk121.red(file) : chalk121.white(file);
|
|
14292
|
+
const suffix = override !== void 0 ? chalk121.magenta(` (override: ${override})`) : "";
|
|
14293
|
+
return `${name} \u2192 avg: ${chalk121.cyan(avgMaintainability.toFixed(1))}, min: ${chalk121.yellow(minMaintainability.toFixed(1))}${suffix}`;
|
|
14097
14294
|
}
|
|
14098
14295
|
|
|
14099
14296
|
// src/commands/complexity/maintainability/getMaintainabilityGitState.ts
|
|
@@ -14144,38 +14341,38 @@ function getMaintainabilityGitState() {
|
|
|
14144
14341
|
|
|
14145
14342
|
// src/commands/complexity/maintainability/printMaintainabilityFailure.ts
|
|
14146
14343
|
import path29 from "path";
|
|
14147
|
-
import
|
|
14344
|
+
import chalk122 from "chalk";
|
|
14148
14345
|
var extractTemplate = "assist refactor extract <file> <functionName> <destination> --apply";
|
|
14149
14346
|
function remediationLine(entry) {
|
|
14150
|
-
return ` ${
|
|
14347
|
+
return ` ${chalk122.bold(entry.file)}
|
|
14151
14348
|
Pick a responsibility and extract it:
|
|
14152
|
-
${
|
|
14349
|
+
${chalk122.cyan(extractTemplate)}`;
|
|
14153
14350
|
}
|
|
14154
14351
|
function cheatLine(entry, gitState) {
|
|
14155
14352
|
const shrank = gitState.shrunkFiles.has(path29.resolve(entry.file));
|
|
14156
14353
|
if (!shrank || gitState.newFileCreated) return "";
|
|
14157
14354
|
return `
|
|
14158
|
-
${
|
|
14355
|
+
${chalk122.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.")}`;
|
|
14159
14356
|
}
|
|
14160
14357
|
function printMaintainabilityFailure(failing, gitState) {
|
|
14161
14358
|
const blocks = failing.map((entry) => `${remediationLine(entry)}${cheatLine(entry, gitState)}`).join("\n");
|
|
14162
14359
|
console.error(
|
|
14163
|
-
|
|
14360
|
+
chalk122.red(
|
|
14164
14361
|
`
|
|
14165
14362
|
Fail: ${failing.length} file(s) below threshold \u2192 extract a responsibility to a new file.
|
|
14166
14363
|
|
|
14167
14364
|
${blocks}
|
|
14168
14365
|
|
|
14169
|
-
${
|
|
14366
|
+
${chalk122.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.`
|
|
14170
14367
|
)
|
|
14171
14368
|
);
|
|
14172
14369
|
}
|
|
14173
14370
|
|
|
14174
14371
|
// src/commands/complexity/maintainability/printMaintainabilityFormula.ts
|
|
14175
|
-
import
|
|
14372
|
+
import chalk123 from "chalk";
|
|
14176
14373
|
var MI_FORMULA = "171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100";
|
|
14177
14374
|
function printMaintainabilityFormula() {
|
|
14178
|
-
console.log(
|
|
14375
|
+
console.log(chalk123.dim(MI_FORMULA));
|
|
14179
14376
|
}
|
|
14180
14377
|
|
|
14181
14378
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
@@ -14184,7 +14381,7 @@ function displayMaintainabilityResults(results, threshold, gitState = getMaintai
|
|
|
14184
14381
|
if (!gating) {
|
|
14185
14382
|
printMaintainabilityFormula();
|
|
14186
14383
|
for (const entry of results) console.log(formatResultLine(entry, false));
|
|
14187
|
-
console.log(
|
|
14384
|
+
console.log(chalk124.dim(`
|
|
14188
14385
|
Analyzed ${results.length} files`));
|
|
14189
14386
|
return;
|
|
14190
14387
|
}
|
|
@@ -14193,14 +14390,14 @@ Analyzed ${results.length} files`));
|
|
|
14193
14390
|
return limit !== void 0 && r.minMaintainability < limit;
|
|
14194
14391
|
});
|
|
14195
14392
|
if (failing.length === 0) {
|
|
14196
|
-
console.log(
|
|
14393
|
+
console.log(chalk124.green("All files pass maintainability threshold"));
|
|
14197
14394
|
}
|
|
14198
14395
|
const passingOverrides = results.filter(
|
|
14199
14396
|
(r) => r.override !== void 0 && !failing.includes(r)
|
|
14200
14397
|
);
|
|
14201
14398
|
for (const entry of passingOverrides)
|
|
14202
14399
|
console.log(formatResultLine(entry, false));
|
|
14203
|
-
console.log(
|
|
14400
|
+
console.log(chalk124.dim(`
|
|
14204
14401
|
Analyzed ${results.length} files`));
|
|
14205
14402
|
if (failing.length > 0) {
|
|
14206
14403
|
printMaintainabilityFailure(failing, gitState);
|
|
@@ -14223,7 +14420,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
14223
14420
|
|
|
14224
14421
|
// src/commands/complexity/sloc.ts
|
|
14225
14422
|
import fs22 from "fs";
|
|
14226
|
-
import
|
|
14423
|
+
import chalk125 from "chalk";
|
|
14227
14424
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
14228
14425
|
withSourceFiles(pattern2, (files) => {
|
|
14229
14426
|
const results = [];
|
|
@@ -14239,12 +14436,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
14239
14436
|
results.sort((a, b) => b.lines - a.lines);
|
|
14240
14437
|
for (const { file, lines } of results) {
|
|
14241
14438
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
14242
|
-
const color = exceedsThreshold ?
|
|
14243
|
-
console.log(`${color(file)} \u2192 ${
|
|
14439
|
+
const color = exceedsThreshold ? chalk125.red : chalk125.white;
|
|
14440
|
+
console.log(`${color(file)} \u2192 ${chalk125.cyan(lines)} lines`);
|
|
14244
14441
|
}
|
|
14245
14442
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
14246
14443
|
console.log(
|
|
14247
|
-
|
|
14444
|
+
chalk125.dim(`
|
|
14248
14445
|
Total: ${total} lines across ${files.length} files`)
|
|
14249
14446
|
);
|
|
14250
14447
|
if (hasViolation) {
|
|
@@ -14258,25 +14455,25 @@ async function analyze(pattern2) {
|
|
|
14258
14455
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
14259
14456
|
const files = findSourceFiles2(searchPattern);
|
|
14260
14457
|
if (files.length === 0) {
|
|
14261
|
-
console.log(
|
|
14458
|
+
console.log(chalk126.yellow("No files found matching pattern"));
|
|
14262
14459
|
return;
|
|
14263
14460
|
}
|
|
14264
14461
|
if (files.length === 1) {
|
|
14265
14462
|
const file = files[0];
|
|
14266
|
-
console.log(
|
|
14463
|
+
console.log(chalk126.bold.underline("SLOC"));
|
|
14267
14464
|
await sloc(file);
|
|
14268
14465
|
console.log();
|
|
14269
|
-
console.log(
|
|
14466
|
+
console.log(chalk126.bold.underline("Cyclomatic Complexity"));
|
|
14270
14467
|
await cyclomatic(file);
|
|
14271
14468
|
console.log();
|
|
14272
|
-
console.log(
|
|
14469
|
+
console.log(chalk126.bold.underline("Halstead Metrics"));
|
|
14273
14470
|
await halstead(file);
|
|
14274
14471
|
console.log();
|
|
14275
|
-
console.log(
|
|
14472
|
+
console.log(chalk126.bold.underline("Maintainability Index"));
|
|
14276
14473
|
await maintainability(file);
|
|
14277
14474
|
console.log();
|
|
14278
14475
|
console.log(
|
|
14279
|
-
|
|
14476
|
+
chalk126.dim(
|
|
14280
14477
|
"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."
|
|
14281
14478
|
)
|
|
14282
14479
|
);
|
|
@@ -14327,7 +14524,7 @@ function configList() {
|
|
|
14327
14524
|
}
|
|
14328
14525
|
|
|
14329
14526
|
// src/commands/config/configGet.ts
|
|
14330
|
-
import
|
|
14527
|
+
import chalk127 from "chalk";
|
|
14331
14528
|
|
|
14332
14529
|
// src/commands/config/getNestedValue.ts
|
|
14333
14530
|
function isTraversable(value) {
|
|
@@ -14359,15 +14556,15 @@ function requireNestedValue(config, key) {
|
|
|
14359
14556
|
return value;
|
|
14360
14557
|
}
|
|
14361
14558
|
function exitKeyNotSet(key) {
|
|
14362
|
-
console.error(
|
|
14559
|
+
console.error(chalk127.red(`Key "${key}" is not set`));
|
|
14363
14560
|
process.exit(1);
|
|
14364
14561
|
}
|
|
14365
14562
|
|
|
14366
14563
|
// src/commands/config/configSet.ts
|
|
14367
|
-
import
|
|
14564
|
+
import chalk130 from "chalk";
|
|
14368
14565
|
|
|
14369
14566
|
// src/commands/config/applyConfigSet.ts
|
|
14370
|
-
import
|
|
14567
|
+
import chalk129 from "chalk";
|
|
14371
14568
|
|
|
14372
14569
|
// src/commands/config/setNestedValue.ts
|
|
14373
14570
|
function isPlainObject(val) {
|
|
@@ -14418,7 +14615,7 @@ function setNestedValue(obj, path71, value) {
|
|
|
14418
14615
|
}
|
|
14419
14616
|
|
|
14420
14617
|
// src/commands/config/validateConfig.ts
|
|
14421
|
-
import
|
|
14618
|
+
import chalk128 from "chalk";
|
|
14422
14619
|
function validateConfig(updated, key) {
|
|
14423
14620
|
const result = assistConfigSchema.safeParse(updated);
|
|
14424
14621
|
if (!result.success) return exitValidationFailed(result.error.issues, key);
|
|
@@ -14431,7 +14628,7 @@ function exitValidationFailed(issues, key) {
|
|
|
14431
14628
|
function printValidationErrors(issues, key) {
|
|
14432
14629
|
for (const issue of issues) {
|
|
14433
14630
|
console.error(
|
|
14434
|
-
|
|
14631
|
+
chalk128.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
14435
14632
|
);
|
|
14436
14633
|
}
|
|
14437
14634
|
}
|
|
@@ -14456,7 +14653,7 @@ function applyConfigSet(key, coerced, global) {
|
|
|
14456
14653
|
function assertNotGlobalOnly(key, global) {
|
|
14457
14654
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
14458
14655
|
console.error(
|
|
14459
|
-
|
|
14656
|
+
chalk129.red(
|
|
14460
14657
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
14461
14658
|
)
|
|
14462
14659
|
);
|
|
@@ -14517,19 +14714,19 @@ function resolveRepoTarget(key, value, repo) {
|
|
|
14517
14714
|
function configSet(key, value, options2 = {}) {
|
|
14518
14715
|
if (options2.repo !== void 0 && !options2.global) {
|
|
14519
14716
|
console.error(
|
|
14520
|
-
|
|
14717
|
+
chalk130.red("--repo writes to the global config; add -g (e.g. -g --repo)")
|
|
14521
14718
|
);
|
|
14522
14719
|
process.exit(1);
|
|
14523
14720
|
}
|
|
14524
14721
|
const resolved = resolveRepoTarget(key, value, options2.repo);
|
|
14525
14722
|
if (resolved.value === void 0) {
|
|
14526
|
-
console.error(
|
|
14723
|
+
console.error(chalk130.red(`Missing required argument for '${resolved.key}'`));
|
|
14527
14724
|
process.exit(1);
|
|
14528
14725
|
}
|
|
14529
14726
|
const coerced = coerceValue(resolved.value);
|
|
14530
14727
|
const target = resolved.useRepo ? `repo: ${applyRepoConfigSet(resolved.key, coerced, resolved.repoName)}` : applyConfigSet(resolved.key, coerced, options2.global ?? false);
|
|
14531
14728
|
console.log(
|
|
14532
|
-
|
|
14729
|
+
chalk130.green(`Set ${resolved.key} = ${JSON.stringify(coerced)} (${target})`)
|
|
14533
14730
|
);
|
|
14534
14731
|
}
|
|
14535
14732
|
function coerceValue(value) {
|
|
@@ -14550,40 +14747,40 @@ function registerConfig(program2) {
|
|
|
14550
14747
|
}
|
|
14551
14748
|
|
|
14552
14749
|
// src/commands/db/reportMigrationStatus.ts
|
|
14553
|
-
import
|
|
14750
|
+
import chalk131 from "chalk";
|
|
14554
14751
|
function reportApplied(applied) {
|
|
14555
14752
|
if (applied.length === 0) {
|
|
14556
|
-
console.error(
|
|
14753
|
+
console.error(chalk131.green("Database is up to date; nothing to apply."));
|
|
14557
14754
|
return;
|
|
14558
14755
|
}
|
|
14559
14756
|
for (const migration of applied) {
|
|
14560
14757
|
console.error(
|
|
14561
|
-
|
|
14758
|
+
chalk131.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
14562
14759
|
);
|
|
14563
14760
|
}
|
|
14564
14761
|
}
|
|
14565
14762
|
function reportMigrationStatus(status3) {
|
|
14566
14763
|
if (status3.state === "in-sync") {
|
|
14567
14764
|
console.error(
|
|
14568
|
-
|
|
14765
|
+
chalk131.green(`In sync at migration ${status3.version} (latest).`)
|
|
14569
14766
|
);
|
|
14570
14767
|
return;
|
|
14571
14768
|
}
|
|
14572
14769
|
if (status3.state === "behind") {
|
|
14573
14770
|
console.error(
|
|
14574
|
-
|
|
14771
|
+
chalk131.yellow(
|
|
14575
14772
|
`Behind: applied ${status3.applied}, build expects ${status3.expected}.`
|
|
14576
14773
|
)
|
|
14577
14774
|
);
|
|
14578
14775
|
console.error(
|
|
14579
|
-
|
|
14776
|
+
chalk131.yellow(
|
|
14580
14777
|
`Pending: ${status3.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
14581
14778
|
)
|
|
14582
14779
|
);
|
|
14583
14780
|
return;
|
|
14584
14781
|
}
|
|
14585
14782
|
console.error(
|
|
14586
|
-
|
|
14783
|
+
chalk131.red(
|
|
14587
14784
|
`Ahead: applied ${status3.applied}, build knows ${status3.expected}. Update assist.`
|
|
14588
14785
|
)
|
|
14589
14786
|
);
|
|
@@ -14618,7 +14815,7 @@ function registerDb(program2) {
|
|
|
14618
14815
|
|
|
14619
14816
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
14620
14817
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync26 } from "fs";
|
|
14621
|
-
import
|
|
14818
|
+
import chalk132 from "chalk";
|
|
14622
14819
|
|
|
14623
14820
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
14624
14821
|
import { join as join35 } from "path";
|
|
@@ -14630,12 +14827,12 @@ function getMigrationApprovalPath(migrationId) {
|
|
|
14630
14827
|
}
|
|
14631
14828
|
|
|
14632
14829
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
14633
|
-
import { existsSync as existsSync34, readFileSync as
|
|
14830
|
+
import { existsSync as existsSync34, readFileSync as readFileSync29 } from "fs";
|
|
14634
14831
|
function readMigrationPinState(pin) {
|
|
14635
14832
|
const path71 = getMigrationPinPath(pin);
|
|
14636
14833
|
if (!existsSync34(path71)) return void 0;
|
|
14637
14834
|
try {
|
|
14638
|
-
const state = JSON.parse(
|
|
14835
|
+
const state = JSON.parse(readFileSync29(path71, "utf8"));
|
|
14639
14836
|
if (state.pin !== pin) return void 0;
|
|
14640
14837
|
if (!Number.isInteger(state.migrationId)) return void 0;
|
|
14641
14838
|
return state;
|
|
@@ -14649,7 +14846,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14649
14846
|
sweepRestrictedDir();
|
|
14650
14847
|
const state = readMigrationPinState(pin);
|
|
14651
14848
|
if (!state) {
|
|
14652
|
-
console.error(
|
|
14849
|
+
console.error(chalk132.red(`No pending migration unlock for pin: ${pin}`));
|
|
14653
14850
|
process.exitCode = 1;
|
|
14654
14851
|
return;
|
|
14655
14852
|
}
|
|
@@ -14659,7 +14856,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14659
14856
|
);
|
|
14660
14857
|
unlinkSync9(getMigrationPinPath(pin));
|
|
14661
14858
|
console.log(
|
|
14662
|
-
|
|
14859
|
+
chalk132.green(
|
|
14663
14860
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
14664
14861
|
)
|
|
14665
14862
|
);
|
|
@@ -14668,7 +14865,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14668
14865
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
14669
14866
|
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync27 } from "fs";
|
|
14670
14867
|
import { randomInt as randomInt2 } from "crypto";
|
|
14671
|
-
import
|
|
14868
|
+
import chalk133 from "chalk";
|
|
14672
14869
|
|
|
14673
14870
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
14674
14871
|
function nextMigrationId() {
|
|
@@ -14683,7 +14880,7 @@ function dbMigrationUnlock() {
|
|
|
14683
14880
|
sweepRestrictedDir();
|
|
14684
14881
|
writeFileSync27(getMigrationPinPath(pin), JSON.stringify({ pin, migrationId }));
|
|
14685
14882
|
console.error(
|
|
14686
|
-
|
|
14883
|
+
chalk133.yellow.bold(
|
|
14687
14884
|
"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."
|
|
14688
14885
|
)
|
|
14689
14886
|
);
|
|
@@ -14693,7 +14890,7 @@ function dbMigrationUnlock() {
|
|
|
14693
14890
|
});
|
|
14694
14891
|
if (!delivered) {
|
|
14695
14892
|
console.error(
|
|
14696
|
-
|
|
14893
|
+
chalk133.red(
|
|
14697
14894
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
14698
14895
|
)
|
|
14699
14896
|
);
|
|
@@ -14703,7 +14900,7 @@ function dbMigrationUnlock() {
|
|
|
14703
14900
|
console.log(
|
|
14704
14901
|
`A confirmation pin was sent to your desktop notifications.
|
|
14705
14902
|
To approve creating migration ${migrationId}, run:
|
|
14706
|
-
${
|
|
14903
|
+
${chalk133.cyan(" assist db-migration confirm <PIN>")}
|
|
14707
14904
|
using the pin from that notification.`
|
|
14708
14905
|
);
|
|
14709
14906
|
}
|
|
@@ -14722,8 +14919,8 @@ function registerDbMigration(parent) {
|
|
|
14722
14919
|
}
|
|
14723
14920
|
|
|
14724
14921
|
// src/commands/deploy/redirect.ts
|
|
14725
|
-
import { existsSync as existsSync35, readFileSync as
|
|
14726
|
-
import
|
|
14922
|
+
import { existsSync as existsSync35, readFileSync as readFileSync30, writeFileSync as writeFileSync28 } from "fs";
|
|
14923
|
+
import chalk134 from "chalk";
|
|
14727
14924
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
14728
14925
|
if (!window.location.pathname.endsWith('/')) {
|
|
14729
14926
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -14732,23 +14929,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
14732
14929
|
function redirect() {
|
|
14733
14930
|
const indexPath = "index.html";
|
|
14734
14931
|
if (!existsSync35(indexPath)) {
|
|
14735
|
-
console.log(
|
|
14932
|
+
console.log(chalk134.yellow("No index.html found"));
|
|
14736
14933
|
return;
|
|
14737
14934
|
}
|
|
14738
|
-
const content =
|
|
14935
|
+
const content = readFileSync30(indexPath, "utf8");
|
|
14739
14936
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
14740
|
-
console.log(
|
|
14937
|
+
console.log(chalk134.dim("Trailing slash script already present"));
|
|
14741
14938
|
return;
|
|
14742
14939
|
}
|
|
14743
14940
|
const headCloseIndex = content.indexOf("</head>");
|
|
14744
14941
|
if (headCloseIndex === -1) {
|
|
14745
|
-
console.log(
|
|
14942
|
+
console.log(chalk134.red("Could not find </head> tag in index.html"));
|
|
14746
14943
|
return;
|
|
14747
14944
|
}
|
|
14748
14945
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
14749
14946
|
${content.slice(headCloseIndex)}`;
|
|
14750
14947
|
writeFileSync28(indexPath, newContent);
|
|
14751
|
-
console.log(
|
|
14948
|
+
console.log(chalk134.green("Added trailing slash redirect to index.html"));
|
|
14752
14949
|
}
|
|
14753
14950
|
|
|
14754
14951
|
// src/commands/registerDeploy.ts
|
|
@@ -14775,10 +14972,10 @@ function loadBlogSkipDays(repoName) {
|
|
|
14775
14972
|
|
|
14776
14973
|
// src/commands/devlog/shared.ts
|
|
14777
14974
|
import { execSync as execSync33 } from "child_process";
|
|
14778
|
-
import
|
|
14975
|
+
import chalk135 from "chalk";
|
|
14779
14976
|
|
|
14780
14977
|
// src/shared/getRepoName.ts
|
|
14781
|
-
import { existsSync as existsSync36, readFileSync as
|
|
14978
|
+
import { existsSync as existsSync36, readFileSync as readFileSync31 } from "fs";
|
|
14782
14979
|
import { basename as basename8, join as join37 } from "path";
|
|
14783
14980
|
function getRepoName() {
|
|
14784
14981
|
const config = loadConfig();
|
|
@@ -14788,7 +14985,7 @@ function getRepoName() {
|
|
|
14788
14985
|
const packageJsonPath = join37(process.cwd(), "package.json");
|
|
14789
14986
|
if (existsSync36(packageJsonPath)) {
|
|
14790
14987
|
try {
|
|
14791
|
-
const content =
|
|
14988
|
+
const content = readFileSync31(packageJsonPath, "utf8");
|
|
14792
14989
|
const pkg = JSON.parse(content);
|
|
14793
14990
|
if (pkg.name) {
|
|
14794
14991
|
return pkg.name;
|
|
@@ -14800,7 +14997,7 @@ function getRepoName() {
|
|
|
14800
14997
|
}
|
|
14801
14998
|
|
|
14802
14999
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
14803
|
-
import { readdirSync as readdirSync4, readFileSync as
|
|
15000
|
+
import { readdirSync as readdirSync4, readFileSync as readFileSync32 } from "fs";
|
|
14804
15001
|
import { join as join38 } from "path";
|
|
14805
15002
|
var DEVLOG_DIR = join38(BLOG_REPO_ROOT, "src/content/devlog");
|
|
14806
15003
|
function extractFrontmatter(content) {
|
|
@@ -14830,7 +15027,7 @@ function readDevlogFiles(callback) {
|
|
|
14830
15027
|
try {
|
|
14831
15028
|
const files = readdirSync4(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
14832
15029
|
for (const file of files) {
|
|
14833
|
-
const content =
|
|
15030
|
+
const content = readFileSync32(join38(DEVLOG_DIR, file), "utf8");
|
|
14834
15031
|
const parsed = parseFrontmatter(content, file);
|
|
14835
15032
|
if (parsed) callback(parsed);
|
|
14836
15033
|
}
|
|
@@ -14884,13 +15081,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
14884
15081
|
}
|
|
14885
15082
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
14886
15083
|
for (const commit2 of commits2) {
|
|
14887
|
-
console.log(` ${
|
|
15084
|
+
console.log(` ${chalk135.yellow(commit2.hash)} ${commit2.message}`);
|
|
14888
15085
|
if (verbose) {
|
|
14889
15086
|
const visibleFiles = commit2.files.filter(
|
|
14890
15087
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
14891
15088
|
);
|
|
14892
15089
|
for (const file of visibleFiles) {
|
|
14893
|
-
console.log(` ${
|
|
15090
|
+
console.log(` ${chalk135.dim(file)}`);
|
|
14894
15091
|
}
|
|
14895
15092
|
}
|
|
14896
15093
|
}
|
|
@@ -14915,15 +15112,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
14915
15112
|
}
|
|
14916
15113
|
|
|
14917
15114
|
// src/commands/devlog/list/printDateHeader.ts
|
|
14918
|
-
import
|
|
15115
|
+
import chalk136 from "chalk";
|
|
14919
15116
|
function printDateHeader(date, isSkipped, entries) {
|
|
14920
15117
|
if (isSkipped) {
|
|
14921
|
-
console.log(`${
|
|
15118
|
+
console.log(`${chalk136.bold.blue(date)} ${chalk136.dim("skipped")}`);
|
|
14922
15119
|
} else if (entries && entries.length > 0) {
|
|
14923
|
-
const entryInfo = entries.map((e) => `${
|
|
14924
|
-
console.log(`${
|
|
15120
|
+
const entryInfo = entries.map((e) => `${chalk136.green(e.version)} ${e.title}`).join(" | ");
|
|
15121
|
+
console.log(`${chalk136.bold.blue(date)} ${entryInfo}`);
|
|
14925
15122
|
} else {
|
|
14926
|
-
console.log(`${
|
|
15123
|
+
console.log(`${chalk136.bold.blue(date)} ${chalk136.red("\u26A0 devlog missing")}`);
|
|
14927
15124
|
}
|
|
14928
15125
|
}
|
|
14929
15126
|
|
|
@@ -15027,24 +15224,24 @@ function bumpVersion(version2, type) {
|
|
|
15027
15224
|
|
|
15028
15225
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
15029
15226
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
15030
|
-
import
|
|
15227
|
+
import chalk138 from "chalk";
|
|
15031
15228
|
|
|
15032
15229
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
15033
|
-
import
|
|
15230
|
+
import chalk137 from "chalk";
|
|
15034
15231
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
15035
15232
|
if (conventional && firstHash) {
|
|
15036
15233
|
const version2 = getVersionAtCommit(firstHash);
|
|
15037
15234
|
if (version2) {
|
|
15038
|
-
console.log(`${
|
|
15235
|
+
console.log(`${chalk137.bold("version:")} ${stripToMinor(version2)}`);
|
|
15039
15236
|
} else {
|
|
15040
|
-
console.log(`${
|
|
15237
|
+
console.log(`${chalk137.bold("version:")} ${chalk137.red("unknown")}`);
|
|
15041
15238
|
}
|
|
15042
15239
|
} else if (patchVersion && minorVersion) {
|
|
15043
15240
|
console.log(
|
|
15044
|
-
`${
|
|
15241
|
+
`${chalk137.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
15045
15242
|
);
|
|
15046
15243
|
} else {
|
|
15047
|
-
console.log(`${
|
|
15244
|
+
console.log(`${chalk137.bold("version:")} v0.1 (initial)`);
|
|
15048
15245
|
}
|
|
15049
15246
|
}
|
|
15050
15247
|
|
|
@@ -15092,16 +15289,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
15092
15289
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
15093
15290
|
}
|
|
15094
15291
|
function logName(repoName) {
|
|
15095
|
-
console.log(`${
|
|
15292
|
+
console.log(`${chalk138.bold("name:")} ${repoName}`);
|
|
15096
15293
|
}
|
|
15097
15294
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
15098
15295
|
logName(ctx.repoName);
|
|
15099
15296
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
15100
|
-
console.log(
|
|
15297
|
+
console.log(chalk138.bold.blue(targetDate));
|
|
15101
15298
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
15102
15299
|
}
|
|
15103
15300
|
function logNoCommits(lastInfo) {
|
|
15104
|
-
console.log(
|
|
15301
|
+
console.log(chalk138.dim(noCommitsMessage(!!lastInfo)));
|
|
15105
15302
|
}
|
|
15106
15303
|
|
|
15107
15304
|
// src/commands/devlog/next/index.ts
|
|
@@ -15142,11 +15339,11 @@ function next2(options2) {
|
|
|
15142
15339
|
import { execSync as execSync35 } from "child_process";
|
|
15143
15340
|
|
|
15144
15341
|
// src/commands/devlog/repos/printReposTable.ts
|
|
15145
|
-
import
|
|
15342
|
+
import chalk139 from "chalk";
|
|
15146
15343
|
function colorStatus(status3) {
|
|
15147
|
-
if (status3 === "missing") return
|
|
15148
|
-
if (status3 === "outdated") return
|
|
15149
|
-
return
|
|
15344
|
+
if (status3 === "missing") return chalk139.red(status3);
|
|
15345
|
+
if (status3 === "outdated") return chalk139.yellow(status3);
|
|
15346
|
+
return chalk139.green(status3);
|
|
15150
15347
|
}
|
|
15151
15348
|
function formatRow(row, nameWidth) {
|
|
15152
15349
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -15160,8 +15357,8 @@ function printReposTable(rows) {
|
|
|
15160
15357
|
"Last Devlog".padEnd(11),
|
|
15161
15358
|
"Status"
|
|
15162
15359
|
].join(" ");
|
|
15163
|
-
console.log(
|
|
15164
|
-
console.log(
|
|
15360
|
+
console.log(chalk139.dim(header));
|
|
15361
|
+
console.log(chalk139.dim("-".repeat(header.length)));
|
|
15165
15362
|
for (const row of rows) {
|
|
15166
15363
|
console.log(formatRow(row, nameWidth));
|
|
15167
15364
|
}
|
|
@@ -15219,14 +15416,14 @@ function repos(options2) {
|
|
|
15219
15416
|
// src/commands/devlog/skip.ts
|
|
15220
15417
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
15221
15418
|
import { join as join39 } from "path";
|
|
15222
|
-
import
|
|
15419
|
+
import chalk140 from "chalk";
|
|
15223
15420
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
15224
15421
|
function getBlogConfigPath() {
|
|
15225
15422
|
return join39(BLOG_REPO_ROOT, "assist.yml");
|
|
15226
15423
|
}
|
|
15227
15424
|
function skip(date) {
|
|
15228
15425
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
15229
|
-
console.log(
|
|
15426
|
+
console.log(chalk140.red("Invalid date format. Use YYYY-MM-DD"));
|
|
15230
15427
|
process.exit(1);
|
|
15231
15428
|
}
|
|
15232
15429
|
const repoName = getRepoName();
|
|
@@ -15237,7 +15434,7 @@ function skip(date) {
|
|
|
15237
15434
|
const skipDays = skip2[repoName] ?? [];
|
|
15238
15435
|
if (skipDays.includes(date)) {
|
|
15239
15436
|
console.log(
|
|
15240
|
-
|
|
15437
|
+
chalk140.yellow(`${date} is already in skip list for ${repoName}`)
|
|
15241
15438
|
);
|
|
15242
15439
|
return;
|
|
15243
15440
|
}
|
|
@@ -15247,20 +15444,20 @@ function skip(date) {
|
|
|
15247
15444
|
devlog.skip = skip2;
|
|
15248
15445
|
config.devlog = devlog;
|
|
15249
15446
|
writeFileSync29(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
15250
|
-
console.log(
|
|
15447
|
+
console.log(chalk140.green(`Added ${date} to skip list for ${repoName}`));
|
|
15251
15448
|
}
|
|
15252
15449
|
|
|
15253
15450
|
// src/commands/devlog/version.ts
|
|
15254
|
-
import
|
|
15451
|
+
import chalk141 from "chalk";
|
|
15255
15452
|
function version() {
|
|
15256
15453
|
const config = loadConfig();
|
|
15257
15454
|
const name = getRepoName();
|
|
15258
15455
|
const lastInfo = getLastVersionInfo(name, config);
|
|
15259
15456
|
const lastVersion = lastInfo?.version ?? null;
|
|
15260
15457
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
15261
|
-
console.log(`${
|
|
15262
|
-
console.log(`${
|
|
15263
|
-
console.log(`${
|
|
15458
|
+
console.log(`${chalk141.bold("name:")} ${name}`);
|
|
15459
|
+
console.log(`${chalk141.bold("last:")} ${lastVersion ?? chalk141.dim("none")}`);
|
|
15460
|
+
console.log(`${chalk141.bold("next:")} ${nextVersion ?? chalk141.dim("none")}`);
|
|
15264
15461
|
}
|
|
15265
15462
|
|
|
15266
15463
|
// src/commands/devlog/devlogConfigHelp.ts
|
|
@@ -15304,7 +15501,7 @@ function registerDevlog(program2) {
|
|
|
15304
15501
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
15305
15502
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync5 } from "fs";
|
|
15306
15503
|
import { join as join40 } from "path";
|
|
15307
|
-
import
|
|
15504
|
+
import chalk142 from "chalk";
|
|
15308
15505
|
|
|
15309
15506
|
// src/shared/findRepoRoot.ts
|
|
15310
15507
|
import { existsSync as existsSync37 } from "fs";
|
|
@@ -15367,22 +15564,22 @@ function checkBuildLocks(startDir) {
|
|
|
15367
15564
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
15368
15565
|
if (locked) {
|
|
15369
15566
|
console.error(
|
|
15370
|
-
|
|
15567
|
+
chalk142.red("Build output locked (is VS debugging?): ") + locked
|
|
15371
15568
|
);
|
|
15372
15569
|
process.exit(1);
|
|
15373
15570
|
}
|
|
15374
15571
|
}
|
|
15375
15572
|
async function checkBuildLocksCommand() {
|
|
15376
15573
|
checkBuildLocks();
|
|
15377
|
-
console.log(
|
|
15574
|
+
console.log(chalk142.green("No build locks detected"));
|
|
15378
15575
|
}
|
|
15379
15576
|
|
|
15380
15577
|
// src/commands/dotnet/buildTree.ts
|
|
15381
|
-
import { readFileSync as
|
|
15578
|
+
import { readFileSync as readFileSync33 } from "fs";
|
|
15382
15579
|
import path31 from "path";
|
|
15383
15580
|
var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
15384
15581
|
function getProjectRefs(csprojPath) {
|
|
15385
|
-
const content =
|
|
15582
|
+
const content = readFileSync33(csprojPath, "utf8");
|
|
15386
15583
|
const refs = [];
|
|
15387
15584
|
for (const match of content.matchAll(PROJECT_REF_RE)) {
|
|
15388
15585
|
refs.push(match[1].replace(/\\/g, "/"));
|
|
@@ -15399,7 +15596,7 @@ function buildTree(csprojPath, repoRoot, visited = /* @__PURE__ */ new Set()) {
|
|
|
15399
15596
|
for (const ref of getProjectRefs(abs)) {
|
|
15400
15597
|
const childAbs = path31.resolve(dir, ref);
|
|
15401
15598
|
try {
|
|
15402
|
-
|
|
15599
|
+
readFileSync33(childAbs);
|
|
15403
15600
|
node.children.push(buildTree(childAbs, repoRoot, visited));
|
|
15404
15601
|
} catch {
|
|
15405
15602
|
node.children.push({
|
|
@@ -15424,7 +15621,7 @@ function collectAllDeps(node) {
|
|
|
15424
15621
|
}
|
|
15425
15622
|
|
|
15426
15623
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
15427
|
-
import { readdirSync as readdirSync6, readFileSync as
|
|
15624
|
+
import { readdirSync as readdirSync6, readFileSync as readFileSync34, statSync as statSync5 } from "fs";
|
|
15428
15625
|
import path32 from "path";
|
|
15429
15626
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
15430
15627
|
if (depth > maxDepth) return [];
|
|
@@ -15459,7 +15656,7 @@ function findContainingSolutions(csprojPath, repoRoot) {
|
|
|
15459
15656
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
15460
15657
|
for (const sln of slnFiles) {
|
|
15461
15658
|
try {
|
|
15462
|
-
const content =
|
|
15659
|
+
const content = readFileSync34(sln, "utf8");
|
|
15463
15660
|
if (pattern2.test(content)) {
|
|
15464
15661
|
matches.push(path32.relative(repoRoot, sln));
|
|
15465
15662
|
}
|
|
@@ -15473,30 +15670,30 @@ function escapeRegex(s) {
|
|
|
15473
15670
|
}
|
|
15474
15671
|
|
|
15475
15672
|
// src/commands/dotnet/printTree.ts
|
|
15476
|
-
import
|
|
15673
|
+
import chalk143 from "chalk";
|
|
15477
15674
|
function printNodes(nodes, prefix2) {
|
|
15478
15675
|
for (let i = 0; i < nodes.length; i++) {
|
|
15479
15676
|
const isLast = i === nodes.length - 1;
|
|
15480
15677
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
15481
15678
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
15482
15679
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
15483
|
-
const label2 = isMissing ?
|
|
15680
|
+
const label2 = isMissing ? chalk143.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
15484
15681
|
console.log(`${prefix2}${connector}${label2}`);
|
|
15485
15682
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
15486
15683
|
}
|
|
15487
15684
|
}
|
|
15488
15685
|
function printTree(tree, totalCount, solutions) {
|
|
15489
|
-
console.log(
|
|
15490
|
-
console.log(
|
|
15686
|
+
console.log(chalk143.bold("\nProject Dependency Tree"));
|
|
15687
|
+
console.log(chalk143.cyan(tree.relativePath));
|
|
15491
15688
|
printNodes(tree.children, "");
|
|
15492
|
-
console.log(
|
|
15689
|
+
console.log(chalk143.dim(`
|
|
15493
15690
|
${totalCount} projects total (including root)`));
|
|
15494
|
-
console.log(
|
|
15691
|
+
console.log(chalk143.bold("\nSolution Membership"));
|
|
15495
15692
|
if (solutions.length === 0) {
|
|
15496
|
-
console.log(
|
|
15693
|
+
console.log(chalk143.yellow(" Not found in any .sln"));
|
|
15497
15694
|
} else {
|
|
15498
15695
|
for (const sln of solutions) {
|
|
15499
|
-
console.log(` ${
|
|
15696
|
+
console.log(` ${chalk143.green(sln)}`);
|
|
15500
15697
|
}
|
|
15501
15698
|
}
|
|
15502
15699
|
console.log();
|
|
@@ -15525,16 +15722,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
15525
15722
|
// src/commands/dotnet/resolveCsproj.ts
|
|
15526
15723
|
import { existsSync as existsSync38 } from "fs";
|
|
15527
15724
|
import path33 from "path";
|
|
15528
|
-
import
|
|
15725
|
+
import chalk144 from "chalk";
|
|
15529
15726
|
function resolveCsproj(csprojPath) {
|
|
15530
15727
|
const resolved = path33.resolve(csprojPath);
|
|
15531
15728
|
if (!existsSync38(resolved)) {
|
|
15532
|
-
console.error(
|
|
15729
|
+
console.error(chalk144.red(`File not found: ${resolved}`));
|
|
15533
15730
|
process.exit(1);
|
|
15534
15731
|
}
|
|
15535
15732
|
const repoRoot = findRepoRoot(path33.dirname(resolved));
|
|
15536
15733
|
if (!repoRoot) {
|
|
15537
|
-
console.error(
|
|
15734
|
+
console.error(chalk144.red("Could not find git repository root"));
|
|
15538
15735
|
process.exit(1);
|
|
15539
15736
|
}
|
|
15540
15737
|
return { resolved, repoRoot };
|
|
@@ -15584,12 +15781,12 @@ function getChangedCsFiles(scope) {
|
|
|
15584
15781
|
}
|
|
15585
15782
|
|
|
15586
15783
|
// src/commands/dotnet/inSln.ts
|
|
15587
|
-
import
|
|
15784
|
+
import chalk145 from "chalk";
|
|
15588
15785
|
async function inSln(csprojPath) {
|
|
15589
15786
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
15590
15787
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
15591
15788
|
if (solutions.length === 0) {
|
|
15592
|
-
console.log(
|
|
15789
|
+
console.log(chalk145.yellow("Not found in any .sln file"));
|
|
15593
15790
|
process.exit(1);
|
|
15594
15791
|
}
|
|
15595
15792
|
for (const sln of solutions) {
|
|
@@ -15598,7 +15795,7 @@ async function inSln(csprojPath) {
|
|
|
15598
15795
|
}
|
|
15599
15796
|
|
|
15600
15797
|
// src/commands/dotnet/inspect.ts
|
|
15601
|
-
import
|
|
15798
|
+
import chalk151 from "chalk";
|
|
15602
15799
|
|
|
15603
15800
|
// src/shared/formatElapsed.ts
|
|
15604
15801
|
function formatElapsed(ms) {
|
|
@@ -15610,12 +15807,12 @@ function formatElapsed(ms) {
|
|
|
15610
15807
|
}
|
|
15611
15808
|
|
|
15612
15809
|
// src/commands/dotnet/displayIssues.ts
|
|
15613
|
-
import
|
|
15810
|
+
import chalk146 from "chalk";
|
|
15614
15811
|
var SEVERITY_COLOR = {
|
|
15615
|
-
ERROR:
|
|
15616
|
-
WARNING:
|
|
15617
|
-
SUGGESTION:
|
|
15618
|
-
HINT:
|
|
15812
|
+
ERROR: chalk146.red,
|
|
15813
|
+
WARNING: chalk146.yellow,
|
|
15814
|
+
SUGGESTION: chalk146.cyan,
|
|
15815
|
+
HINT: chalk146.dim
|
|
15619
15816
|
};
|
|
15620
15817
|
function groupByFile(issues) {
|
|
15621
15818
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -15631,15 +15828,15 @@ function groupByFile(issues) {
|
|
|
15631
15828
|
}
|
|
15632
15829
|
function displayIssues(issues) {
|
|
15633
15830
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
15634
|
-
console.log(
|
|
15831
|
+
console.log(chalk146.bold(file));
|
|
15635
15832
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
15636
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
15833
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk146.white;
|
|
15637
15834
|
console.log(
|
|
15638
|
-
` ${
|
|
15835
|
+
` ${chalk146.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
15639
15836
|
);
|
|
15640
15837
|
}
|
|
15641
15838
|
}
|
|
15642
|
-
console.log(
|
|
15839
|
+
console.log(chalk146.dim(`
|
|
15643
15840
|
${issues.length} issue(s) found`));
|
|
15644
15841
|
}
|
|
15645
15842
|
|
|
@@ -15698,12 +15895,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
15698
15895
|
// src/commands/dotnet/resolveSolution.ts
|
|
15699
15896
|
import { existsSync as existsSync39 } from "fs";
|
|
15700
15897
|
import path34 from "path";
|
|
15701
|
-
import
|
|
15898
|
+
import chalk148 from "chalk";
|
|
15702
15899
|
|
|
15703
15900
|
// src/commands/dotnet/findSolution.ts
|
|
15704
15901
|
import { readdirSync as readdirSync7 } from "fs";
|
|
15705
15902
|
import { dirname as dirname22, join as join41 } from "path";
|
|
15706
|
-
import
|
|
15903
|
+
import chalk147 from "chalk";
|
|
15707
15904
|
function findSlnInDir(dir) {
|
|
15708
15905
|
try {
|
|
15709
15906
|
return readdirSync7(dir).filter((f) => f.endsWith(".sln")).map((f) => join41(dir, f));
|
|
@@ -15719,17 +15916,17 @@ function findSolution() {
|
|
|
15719
15916
|
const slnFiles = findSlnInDir(current);
|
|
15720
15917
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
15721
15918
|
if (slnFiles.length > 1) {
|
|
15722
|
-
console.error(
|
|
15919
|
+
console.error(chalk147.red(`Multiple .sln files found in ${current}:`));
|
|
15723
15920
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
15724
15921
|
console.error(
|
|
15725
|
-
|
|
15922
|
+
chalk147.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
15726
15923
|
);
|
|
15727
15924
|
process.exit(1);
|
|
15728
15925
|
}
|
|
15729
15926
|
if (current === ceiling) break;
|
|
15730
15927
|
current = dirname22(current);
|
|
15731
15928
|
}
|
|
15732
|
-
console.error(
|
|
15929
|
+
console.error(chalk147.red("No .sln file found between cwd and repo root"));
|
|
15733
15930
|
process.exit(1);
|
|
15734
15931
|
}
|
|
15735
15932
|
|
|
@@ -15738,7 +15935,7 @@ function resolveSolution(sln) {
|
|
|
15738
15935
|
if (sln) {
|
|
15739
15936
|
const resolved = path34.resolve(sln);
|
|
15740
15937
|
if (!existsSync39(resolved)) {
|
|
15741
|
-
console.error(
|
|
15938
|
+
console.error(chalk148.red(`Solution file not found: ${resolved}`));
|
|
15742
15939
|
process.exit(1);
|
|
15743
15940
|
}
|
|
15744
15941
|
return resolved;
|
|
@@ -15777,17 +15974,17 @@ function parseInspectReport(json) {
|
|
|
15777
15974
|
|
|
15778
15975
|
// src/commands/dotnet/runInspectCode.ts
|
|
15779
15976
|
import { execSync as execSync37 } from "child_process";
|
|
15780
|
-
import { existsSync as existsSync40, readFileSync as
|
|
15977
|
+
import { existsSync as existsSync40, readFileSync as readFileSync35, unlinkSync as unlinkSync10 } from "fs";
|
|
15781
15978
|
import { tmpdir as tmpdir4 } from "os";
|
|
15782
15979
|
import path35 from "path";
|
|
15783
|
-
import
|
|
15980
|
+
import chalk149 from "chalk";
|
|
15784
15981
|
function assertJbInstalled() {
|
|
15785
15982
|
try {
|
|
15786
15983
|
execSync37("jb inspectcode --version", { stdio: "pipe" });
|
|
15787
15984
|
} catch {
|
|
15788
|
-
console.error(
|
|
15985
|
+
console.error(chalk149.red("jb is not installed. Install with:"));
|
|
15789
15986
|
console.error(
|
|
15790
|
-
|
|
15987
|
+
chalk149.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
15791
15988
|
);
|
|
15792
15989
|
process.exit(1);
|
|
15793
15990
|
}
|
|
@@ -15805,21 +16002,21 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
15805
16002
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
15806
16003
|
process.stderr.write(error.stderr);
|
|
15807
16004
|
}
|
|
15808
|
-
console.error(
|
|
16005
|
+
console.error(chalk149.red("jb inspectcode failed"));
|
|
15809
16006
|
process.exit(1);
|
|
15810
16007
|
}
|
|
15811
16008
|
if (!existsSync40(reportPath)) {
|
|
15812
|
-
console.error(
|
|
16009
|
+
console.error(chalk149.red("Report file not generated"));
|
|
15813
16010
|
process.exit(1);
|
|
15814
16011
|
}
|
|
15815
|
-
const xml =
|
|
16012
|
+
const xml = readFileSync35(reportPath, "utf8");
|
|
15816
16013
|
unlinkSync10(reportPath);
|
|
15817
16014
|
return xml;
|
|
15818
16015
|
}
|
|
15819
16016
|
|
|
15820
16017
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
15821
16018
|
import { execSync as execSync38 } from "child_process";
|
|
15822
|
-
import
|
|
16019
|
+
import chalk150 from "chalk";
|
|
15823
16020
|
function resolveMsbuildPath() {
|
|
15824
16021
|
const { run: run4 } = loadConfig();
|
|
15825
16022
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -15831,9 +16028,9 @@ function assertMsbuildInstalled() {
|
|
|
15831
16028
|
try {
|
|
15832
16029
|
execSync38(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
15833
16030
|
} catch {
|
|
15834
|
-
console.error(
|
|
16031
|
+
console.error(chalk150.red(`msbuild not found at: ${msbuild}`));
|
|
15835
16032
|
console.error(
|
|
15836
|
-
|
|
16033
|
+
chalk150.yellow(
|
|
15837
16034
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
15838
16035
|
)
|
|
15839
16036
|
);
|
|
@@ -15880,17 +16077,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
15880
16077
|
// src/commands/dotnet/inspect.ts
|
|
15881
16078
|
function logScope(changedFiles2) {
|
|
15882
16079
|
if (changedFiles2 === null) {
|
|
15883
|
-
console.log(
|
|
16080
|
+
console.log(chalk151.dim("Inspecting full solution..."));
|
|
15884
16081
|
} else {
|
|
15885
16082
|
console.log(
|
|
15886
|
-
|
|
16083
|
+
chalk151.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
15887
16084
|
);
|
|
15888
16085
|
}
|
|
15889
16086
|
}
|
|
15890
16087
|
function reportResults(issues, elapsed) {
|
|
15891
16088
|
if (issues.length > 0) displayIssues(issues);
|
|
15892
|
-
else console.log(
|
|
15893
|
-
console.log(
|
|
16089
|
+
else console.log(chalk151.green("No issues found"));
|
|
16090
|
+
console.log(chalk151.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
15894
16091
|
if (issues.length > 0) process.exit(1);
|
|
15895
16092
|
}
|
|
15896
16093
|
async function inspect(sln, options2) {
|
|
@@ -15901,7 +16098,7 @@ async function inspect(sln, options2) {
|
|
|
15901
16098
|
const scope = parseScope(options2.scope);
|
|
15902
16099
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
15903
16100
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
15904
|
-
console.log(
|
|
16101
|
+
console.log(chalk151.green("No changed .cs files found"));
|
|
15905
16102
|
return;
|
|
15906
16103
|
}
|
|
15907
16104
|
logScope(changedFiles2);
|
|
@@ -16284,25 +16481,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
16284
16481
|
}
|
|
16285
16482
|
|
|
16286
16483
|
// src/commands/github/printCountTable.ts
|
|
16287
|
-
import
|
|
16484
|
+
import chalk152 from "chalk";
|
|
16288
16485
|
function printCountTable(labelHeader, rows) {
|
|
16289
16486
|
const labelWidth = Math.max(
|
|
16290
16487
|
labelHeader.length,
|
|
16291
16488
|
...rows.map((row) => row.label.length)
|
|
16292
16489
|
);
|
|
16293
16490
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
16294
|
-
console.log(
|
|
16295
|
-
console.log(
|
|
16491
|
+
console.log(chalk152.dim(header));
|
|
16492
|
+
console.log(chalk152.dim("-".repeat(header.length)));
|
|
16296
16493
|
for (const row of rows) {
|
|
16297
16494
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
16298
16495
|
}
|
|
16299
16496
|
}
|
|
16300
16497
|
|
|
16301
16498
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
16302
|
-
import
|
|
16499
|
+
import chalk153 from "chalk";
|
|
16303
16500
|
function printRepoAuthorBreakdown(repos2) {
|
|
16304
16501
|
for (const repo of repos2) {
|
|
16305
|
-
console.log(
|
|
16502
|
+
console.log(chalk153.bold(repo.name));
|
|
16306
16503
|
const authorWidth = Math.max(
|
|
16307
16504
|
0,
|
|
16308
16505
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -16409,7 +16606,7 @@ async function countPendingHandovers(orm, origin) {
|
|
|
16409
16606
|
import {
|
|
16410
16607
|
existsSync as existsSync42,
|
|
16411
16608
|
readdirSync as readdirSync8,
|
|
16412
|
-
readFileSync as
|
|
16609
|
+
readFileSync as readFileSync36,
|
|
16413
16610
|
rmSync as rmSync3,
|
|
16414
16611
|
statSync as statSync6
|
|
16415
16612
|
} from "fs";
|
|
@@ -16472,7 +16669,7 @@ function collectMarkdown(dir) {
|
|
|
16472
16669
|
return out;
|
|
16473
16670
|
}
|
|
16474
16671
|
async function migrateFile(orm, origin, file, createdAt) {
|
|
16475
|
-
const content =
|
|
16672
|
+
const content = readFileSync36(file, "utf8");
|
|
16476
16673
|
await saveHandover(orm, {
|
|
16477
16674
|
origin,
|
|
16478
16675
|
summary: summariseHandoverContent(content),
|
|
@@ -16620,7 +16817,7 @@ function registerHandover(program2) {
|
|
|
16620
16817
|
}
|
|
16621
16818
|
|
|
16622
16819
|
// src/commands/jira/acceptanceCriteria.ts
|
|
16623
|
-
import
|
|
16820
|
+
import chalk154 from "chalk";
|
|
16624
16821
|
|
|
16625
16822
|
// src/commands/jira/adfToText.ts
|
|
16626
16823
|
function renderInline(node) {
|
|
@@ -16687,7 +16884,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
16687
16884
|
const parsed = fetchIssue(issueKey, field);
|
|
16688
16885
|
const acValue = parsed?.fields?.[field];
|
|
16689
16886
|
if (!acValue) {
|
|
16690
|
-
console.log(
|
|
16887
|
+
console.log(chalk154.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
16691
16888
|
return;
|
|
16692
16889
|
}
|
|
16693
16890
|
if (typeof acValue === "string") {
|
|
@@ -16753,14 +16950,14 @@ async function jiraAuth() {
|
|
|
16753
16950
|
}
|
|
16754
16951
|
|
|
16755
16952
|
// src/commands/jira/viewIssue.ts
|
|
16756
|
-
import
|
|
16953
|
+
import chalk155 from "chalk";
|
|
16757
16954
|
function viewIssue(issueKey) {
|
|
16758
16955
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
16759
16956
|
const fields = parsed?.fields;
|
|
16760
16957
|
const summary = fields?.summary;
|
|
16761
16958
|
const description = fields?.description;
|
|
16762
16959
|
if (summary) {
|
|
16763
|
-
console.log(
|
|
16960
|
+
console.log(chalk155.bold(summary));
|
|
16764
16961
|
}
|
|
16765
16962
|
if (description) {
|
|
16766
16963
|
if (summary) console.log();
|
|
@@ -16774,7 +16971,7 @@ function viewIssue(issueKey) {
|
|
|
16774
16971
|
}
|
|
16775
16972
|
if (!summary && !description) {
|
|
16776
16973
|
console.log(
|
|
16777
|
-
|
|
16974
|
+
chalk155.yellow(`No summary or description found on ${issueKey}.`)
|
|
16778
16975
|
);
|
|
16779
16976
|
}
|
|
16780
16977
|
}
|
|
@@ -16829,18 +17026,18 @@ function registerRefineLaunch(program2, resumeFlag) {
|
|
|
16829
17026
|
|
|
16830
17027
|
// src/commands/reviewPrComments.ts
|
|
16831
17028
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
16832
|
-
import { randomUUID as
|
|
16833
|
-
import
|
|
17029
|
+
import { randomUUID as randomUUID4 } from "crypto";
|
|
17030
|
+
import chalk156 from "chalk";
|
|
16834
17031
|
async function reviewPrComments(number) {
|
|
16835
17032
|
if (number) {
|
|
16836
17033
|
try {
|
|
16837
17034
|
execFileSync5("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
16838
17035
|
} catch {
|
|
16839
|
-
console.error(
|
|
17036
|
+
console.error(chalk156.red(`gh pr checkout ${number} failed; aborting.`));
|
|
16840
17037
|
process.exit(1);
|
|
16841
17038
|
}
|
|
16842
17039
|
}
|
|
16843
|
-
const claudeSessionId =
|
|
17040
|
+
const claudeSessionId = randomUUID4();
|
|
16844
17041
|
emitActivity({
|
|
16845
17042
|
kind: "command",
|
|
16846
17043
|
name: "review-pr-comments",
|
|
@@ -16909,15 +17106,15 @@ function registerList(program2) {
|
|
|
16909
17106
|
// src/commands/mermaid/index.ts
|
|
16910
17107
|
import { mkdirSync as mkdirSync16, readdirSync as readdirSync9 } from "fs";
|
|
16911
17108
|
import { resolve as resolve13 } from "path";
|
|
16912
|
-
import
|
|
17109
|
+
import chalk159 from "chalk";
|
|
16913
17110
|
|
|
16914
17111
|
// src/commands/mermaid/exportFile.ts
|
|
16915
|
-
import { readFileSync as
|
|
17112
|
+
import { readFileSync as readFileSync37, writeFileSync as writeFileSync31 } from "fs";
|
|
16916
17113
|
import { basename as basename11, extname as extname2, resolve as resolve12 } from "path";
|
|
16917
|
-
import
|
|
17114
|
+
import chalk158 from "chalk";
|
|
16918
17115
|
|
|
16919
17116
|
// src/commands/mermaid/renderBlock.ts
|
|
16920
|
-
import
|
|
17117
|
+
import chalk157 from "chalk";
|
|
16921
17118
|
async function renderBlock(krokiUrl, source) {
|
|
16922
17119
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
16923
17120
|
method: "POST",
|
|
@@ -16926,7 +17123,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
16926
17123
|
});
|
|
16927
17124
|
if (!response.ok) {
|
|
16928
17125
|
console.error(
|
|
16929
|
-
|
|
17126
|
+
chalk157.red(
|
|
16930
17127
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
16931
17128
|
)
|
|
16932
17129
|
);
|
|
@@ -16938,25 +17135,25 @@ async function renderBlock(krokiUrl, source) {
|
|
|
16938
17135
|
|
|
16939
17136
|
// src/commands/mermaid/exportFile.ts
|
|
16940
17137
|
async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
16941
|
-
const content =
|
|
17138
|
+
const content = readFileSync37(file, "utf8");
|
|
16942
17139
|
const blocks = extractMermaidBlocks(content);
|
|
16943
17140
|
const stem = basename11(file, extname2(file));
|
|
16944
17141
|
if (onlyIndex !== void 0) {
|
|
16945
17142
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
16946
17143
|
console.error(
|
|
16947
|
-
|
|
17144
|
+
chalk158.red(
|
|
16948
17145
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
16949
17146
|
)
|
|
16950
17147
|
);
|
|
16951
17148
|
process.exit(1);
|
|
16952
17149
|
}
|
|
16953
17150
|
console.log(
|
|
16954
|
-
|
|
17151
|
+
chalk158.gray(
|
|
16955
17152
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
16956
17153
|
)
|
|
16957
17154
|
);
|
|
16958
17155
|
} else {
|
|
16959
|
-
console.log(
|
|
17156
|
+
console.log(chalk158.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
16960
17157
|
}
|
|
16961
17158
|
for (const [i, source] of blocks.entries()) {
|
|
16962
17159
|
const idx = i + 1;
|
|
@@ -16964,7 +17161,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
16964
17161
|
const outPath = resolve12(outDir, `${stem}-${idx}.svg`);
|
|
16965
17162
|
const svg = await renderBlock(krokiUrl, source);
|
|
16966
17163
|
writeFileSync31(outPath, svg, "utf8");
|
|
16967
|
-
console.log(
|
|
17164
|
+
console.log(chalk158.green(` \u2192 ${outPath}`));
|
|
16968
17165
|
}
|
|
16969
17166
|
}
|
|
16970
17167
|
function extractMermaidBlocks(markdown) {
|
|
@@ -16980,18 +17177,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
16980
17177
|
if (options2.index !== void 0) {
|
|
16981
17178
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
16982
17179
|
console.error(
|
|
16983
|
-
|
|
17180
|
+
chalk159.red(`--index must be a positive integer (got ${options2.index})`)
|
|
16984
17181
|
);
|
|
16985
17182
|
process.exit(1);
|
|
16986
17183
|
}
|
|
16987
17184
|
if (!file) {
|
|
16988
|
-
console.error(
|
|
17185
|
+
console.error(chalk159.red("--index requires a file argument"));
|
|
16989
17186
|
process.exit(1);
|
|
16990
17187
|
}
|
|
16991
17188
|
}
|
|
16992
17189
|
const files = file ? [file] : readdirSync9(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
16993
17190
|
if (files.length === 0) {
|
|
16994
|
-
console.log(
|
|
17191
|
+
console.log(chalk159.gray("No markdown files found in current directory."));
|
|
16995
17192
|
return;
|
|
16996
17193
|
}
|
|
16997
17194
|
for (const f of files) {
|
|
@@ -17024,7 +17221,7 @@ function registerMermaid(program2) {
|
|
|
17024
17221
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
17025
17222
|
import { createServer as createServer2 } from "http";
|
|
17026
17223
|
import { dirname as dirname24 } from "path";
|
|
17027
|
-
import
|
|
17224
|
+
import chalk161 from "chalk";
|
|
17028
17225
|
|
|
17029
17226
|
// src/commands/netcap/corsHeaders.ts
|
|
17030
17227
|
var corsHeaders = {
|
|
@@ -17103,7 +17300,7 @@ function createNetcapHandler(options2) {
|
|
|
17103
17300
|
import { cp, readFile as readFile3, writeFile as writeFile3 } from "fs/promises";
|
|
17104
17301
|
import { networkInterfaces } from "os";
|
|
17105
17302
|
import { join as join47 } from "path";
|
|
17106
|
-
import
|
|
17303
|
+
import chalk160 from "chalk";
|
|
17107
17304
|
|
|
17108
17305
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
17109
17306
|
import { dirname as dirname23, join as join46 } from "path";
|
|
@@ -17147,7 +17344,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
17147
17344
|
const host = lanIPv4();
|
|
17148
17345
|
if (!host) {
|
|
17149
17346
|
console.log(
|
|
17150
|
-
|
|
17347
|
+
chalk160.yellow("could not determine the WSL IP for the extension")
|
|
17151
17348
|
);
|
|
17152
17349
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
17153
17350
|
return source;
|
|
@@ -17158,7 +17355,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
17158
17355
|
return WSL_WINDOWS_PATH;
|
|
17159
17356
|
} catch {
|
|
17160
17357
|
console.log(
|
|
17161
|
-
|
|
17358
|
+
chalk160.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
17162
17359
|
);
|
|
17163
17360
|
return source;
|
|
17164
17361
|
}
|
|
@@ -17191,30 +17388,30 @@ async function netcap(options2) {
|
|
|
17191
17388
|
let count7 = 0;
|
|
17192
17389
|
const handler = createNetcapHandler({
|
|
17193
17390
|
outPath,
|
|
17194
|
-
onPing: () => console.log(
|
|
17391
|
+
onPing: () => console.log(chalk161.dim("ping from extension")),
|
|
17195
17392
|
onCapture: (entry) => {
|
|
17196
17393
|
count7 += 1;
|
|
17197
17394
|
console.log(
|
|
17198
|
-
|
|
17199
|
-
|
|
17395
|
+
chalk161.green(`captured #${count7}`),
|
|
17396
|
+
chalk161.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
17200
17397
|
);
|
|
17201
17398
|
}
|
|
17202
17399
|
});
|
|
17203
17400
|
const server = createServer2(handler);
|
|
17204
17401
|
server.listen(port, () => {
|
|
17205
17402
|
console.log(
|
|
17206
|
-
|
|
17403
|
+
chalk161.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
17207
17404
|
);
|
|
17208
|
-
console.log(
|
|
17405
|
+
console.log(chalk161.dim(`appending captures to ${outPath}`));
|
|
17209
17406
|
if (filter)
|
|
17210
|
-
console.log(
|
|
17211
|
-
console.log(
|
|
17212
|
-
console.log(
|
|
17407
|
+
console.log(chalk161.dim(`forwarding only URLs matching "${filter}"`));
|
|
17408
|
+
console.log(chalk161.dim(`load the unpacked extension from ${extensionPath}`));
|
|
17409
|
+
console.log(chalk161.dim("press Ctrl-C to stop"));
|
|
17213
17410
|
});
|
|
17214
17411
|
process.on("SIGINT", () => {
|
|
17215
17412
|
server.close();
|
|
17216
17413
|
console.log(
|
|
17217
|
-
|
|
17414
|
+
chalk161.bold(
|
|
17218
17415
|
`
|
|
17219
17416
|
netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
17220
17417
|
)
|
|
@@ -17226,10 +17423,10 @@ netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} t
|
|
|
17226
17423
|
// src/commands/netcap/netcapExtract.ts
|
|
17227
17424
|
import { writeFileSync as writeFileSync32 } from "fs";
|
|
17228
17425
|
import { join as join50 } from "path";
|
|
17229
|
-
import
|
|
17426
|
+
import chalk162 from "chalk";
|
|
17230
17427
|
|
|
17231
17428
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
17232
|
-
import { readFileSync as
|
|
17429
|
+
import { readFileSync as readFileSync38 } from "fs";
|
|
17233
17430
|
|
|
17234
17431
|
// src/commands/netcap/parseRscRows.ts
|
|
17235
17432
|
var isRscRef = (v) => typeof v === "string" && /^\$[0-9a-fL@]/.test(v);
|
|
@@ -17625,7 +17822,7 @@ function extractVoyagerPosts(body) {
|
|
|
17625
17822
|
|
|
17626
17823
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
17627
17824
|
function captureEntries(captureFile) {
|
|
17628
|
-
const lines =
|
|
17825
|
+
const lines = readFileSync38(captureFile, "utf8").split("\n").filter(Boolean);
|
|
17629
17826
|
const entries = [];
|
|
17630
17827
|
for (const line of lines) {
|
|
17631
17828
|
let entry;
|
|
@@ -17674,8 +17871,8 @@ function netcapExtract(file) {
|
|
|
17674
17871
|
writeFileSync32(outFile, `${JSON.stringify(posts, null, 2)}
|
|
17675
17872
|
`);
|
|
17676
17873
|
console.log(
|
|
17677
|
-
|
|
17678
|
-
|
|
17874
|
+
chalk162.green(`extracted ${posts.length} posts`),
|
|
17875
|
+
chalk162.dim(`-> ${outFile}`)
|
|
17679
17876
|
);
|
|
17680
17877
|
}
|
|
17681
17878
|
|
|
@@ -17696,7 +17893,7 @@ function registerNetcap(program2) {
|
|
|
17696
17893
|
}
|
|
17697
17894
|
|
|
17698
17895
|
// src/commands/news/add/index.ts
|
|
17699
|
-
import
|
|
17896
|
+
import chalk163 from "chalk";
|
|
17700
17897
|
import enquirer8 from "enquirer";
|
|
17701
17898
|
async function add2(url) {
|
|
17702
17899
|
if (!url) {
|
|
@@ -17718,10 +17915,10 @@ async function add2(url) {
|
|
|
17718
17915
|
const { orm } = await getReady();
|
|
17719
17916
|
const added = await addFeed(orm, url);
|
|
17720
17917
|
if (!added) {
|
|
17721
|
-
console.log(
|
|
17918
|
+
console.log(chalk163.yellow("Feed already exists"));
|
|
17722
17919
|
return;
|
|
17723
17920
|
}
|
|
17724
|
-
console.log(
|
|
17921
|
+
console.log(chalk163.green(`Added feed: ${url}`));
|
|
17725
17922
|
}
|
|
17726
17923
|
|
|
17727
17924
|
// src/commands/registerNews.ts
|
|
@@ -17768,7 +17965,7 @@ function registerPiHook(program2) {
|
|
|
17768
17965
|
}
|
|
17769
17966
|
|
|
17770
17967
|
// src/commands/prompts/printPromptsTable.ts
|
|
17771
|
-
import
|
|
17968
|
+
import chalk164 from "chalk";
|
|
17772
17969
|
function truncate(str, max) {
|
|
17773
17970
|
if (str.length <= max) return str;
|
|
17774
17971
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -17786,14 +17983,14 @@ function printPromptsTable(rows) {
|
|
|
17786
17983
|
"Command".padEnd(commandWidth),
|
|
17787
17984
|
"Repos"
|
|
17788
17985
|
].join(" ");
|
|
17789
|
-
console.log(
|
|
17790
|
-
console.log(
|
|
17986
|
+
console.log(chalk164.dim(header));
|
|
17987
|
+
console.log(chalk164.dim("-".repeat(header.length)));
|
|
17791
17988
|
for (const row of rows) {
|
|
17792
17989
|
const count7 = String(row.count).padStart(countWidth);
|
|
17793
17990
|
const tool = row.tool.padEnd(toolWidth);
|
|
17794
17991
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
17795
17992
|
console.log(
|
|
17796
|
-
`${
|
|
17993
|
+
`${chalk164.yellow(count7)} ${tool} ${command} ${chalk164.dim(row.repos)}`
|
|
17797
17994
|
);
|
|
17798
17995
|
}
|
|
17799
17996
|
}
|
|
@@ -18164,7 +18361,7 @@ import { tmpdir as tmpdir6 } from "os";
|
|
|
18164
18361
|
import { join as join52 } from "path";
|
|
18165
18362
|
|
|
18166
18363
|
// src/commands/prs/loadCommentsCache.ts
|
|
18167
|
-
import { existsSync as existsSync43, readFileSync as
|
|
18364
|
+
import { existsSync as existsSync43, readFileSync as readFileSync39, unlinkSync as unlinkSync13 } from "fs";
|
|
18168
18365
|
import { join as join51 } from "path";
|
|
18169
18366
|
import { parse as parse2 } from "yaml";
|
|
18170
18367
|
function getCachePath(prNumber) {
|
|
@@ -18175,7 +18372,7 @@ function loadCommentsCache(prNumber) {
|
|
|
18175
18372
|
if (!existsSync43(cachePath)) {
|
|
18176
18373
|
return null;
|
|
18177
18374
|
}
|
|
18178
|
-
const content =
|
|
18375
|
+
const content = readFileSync39(cachePath, "utf8");
|
|
18179
18376
|
return parse2(content);
|
|
18180
18377
|
}
|
|
18181
18378
|
function deleteCommentsCache(prNumber) {
|
|
@@ -18360,20 +18557,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
18360
18557
|
}
|
|
18361
18558
|
|
|
18362
18559
|
// src/commands/prs/listComments/printComments.ts
|
|
18363
|
-
import
|
|
18560
|
+
import chalk165 from "chalk";
|
|
18364
18561
|
function formatForHuman(comment3) {
|
|
18365
18562
|
if (comment3.type === "review") {
|
|
18366
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
18563
|
+
const stateColor = comment3.state === "APPROVED" ? chalk165.green : comment3.state === "CHANGES_REQUESTED" ? chalk165.red : chalk165.yellow;
|
|
18367
18564
|
return [
|
|
18368
|
-
`${
|
|
18565
|
+
`${chalk165.cyan("Review")} by ${chalk165.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
18369
18566
|
comment3.body,
|
|
18370
18567
|
""
|
|
18371
18568
|
].join("\n");
|
|
18372
18569
|
}
|
|
18373
18570
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
18374
18571
|
return [
|
|
18375
|
-
`${
|
|
18376
|
-
|
|
18572
|
+
`${chalk165.cyan("Line comment")} by ${chalk165.bold(comment3.user)} on ${chalk165.dim(`${comment3.path}${location}`)}`,
|
|
18573
|
+
chalk165.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
18377
18574
|
comment3.body,
|
|
18378
18575
|
""
|
|
18379
18576
|
].join("\n");
|
|
@@ -18463,13 +18660,13 @@ import { execSync as execSync46 } from "child_process";
|
|
|
18463
18660
|
import enquirer9 from "enquirer";
|
|
18464
18661
|
|
|
18465
18662
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
18466
|
-
import
|
|
18663
|
+
import chalk166 from "chalk";
|
|
18467
18664
|
var STATUS_MAP = {
|
|
18468
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
18469
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
18665
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk166.magenta("merged"), date: pr.mergedAt } : null,
|
|
18666
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk166.red("closed"), date: pr.closedAt } : null
|
|
18470
18667
|
};
|
|
18471
18668
|
function defaultStatus(pr) {
|
|
18472
|
-
return { label:
|
|
18669
|
+
return { label: chalk166.green("opened"), date: pr.createdAt };
|
|
18473
18670
|
}
|
|
18474
18671
|
function getStatus2(pr) {
|
|
18475
18672
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -18478,11 +18675,11 @@ function formatDate(dateStr) {
|
|
|
18478
18675
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
18479
18676
|
}
|
|
18480
18677
|
function formatPrHeader(pr, status3) {
|
|
18481
|
-
return `${
|
|
18678
|
+
return `${chalk166.cyan(`#${pr.number}`)} ${pr.title} ${chalk166.dim(`(${pr.author.login},`)} ${status3.label} ${chalk166.dim(`${formatDate(status3.date)})`)}`;
|
|
18482
18679
|
}
|
|
18483
18680
|
function logPrDetails(pr) {
|
|
18484
18681
|
console.log(
|
|
18485
|
-
|
|
18682
|
+
chalk166.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
18486
18683
|
);
|
|
18487
18684
|
console.log();
|
|
18488
18685
|
}
|
|
@@ -18696,7 +18893,7 @@ async function placePr(prNumber, title, body, options2) {
|
|
|
18696
18893
|
}
|
|
18697
18894
|
|
|
18698
18895
|
// src/commands/prs/previewAndPlace.ts
|
|
18699
|
-
import { randomUUID as
|
|
18896
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
18700
18897
|
|
|
18701
18898
|
// src/commands/prs/appendScreenshots.ts
|
|
18702
18899
|
function appendScreenshots(body, screenshots) {
|
|
@@ -18708,99 +18905,15 @@ function appendScreenshots(body, screenshots) {
|
|
|
18708
18905
|
${screenshots.join("\n\n")}`;
|
|
18709
18906
|
}
|
|
18710
18907
|
|
|
18711
|
-
// src/commands/prs/reportPrRejection.ts
|
|
18712
|
-
function reportPrRejection(decision) {
|
|
18713
|
-
console.error(
|
|
18714
|
-
`PR preview rejected${decision.reason ? `: ${decision.reason}` : "."}`
|
|
18715
|
-
);
|
|
18716
|
-
const comments3 = decision.comments ?? [];
|
|
18717
|
-
if (comments3.length > 0) {
|
|
18718
|
-
console.error(
|
|
18719
|
-
`
|
|
18720
|
-
The reviewer left ${comments3.length} comment${comments3.length === 1 ? "" : "s"} on the preview. Address each one, then re-run this command:
|
|
18721
|
-
`
|
|
18722
|
-
);
|
|
18723
|
-
for (const [i, c] of comments3.entries()) {
|
|
18724
|
-
const quoted = c.quote.split("\n").map((line) => ` > ${line}`).join("\n");
|
|
18725
|
-
console.error(`${i + 1}. On:
|
|
18726
|
-
${quoted}
|
|
18727
|
-
Comment: ${c.note}
|
|
18728
|
-
`);
|
|
18729
|
-
}
|
|
18730
|
-
}
|
|
18731
|
-
process.exit(1);
|
|
18732
|
-
}
|
|
18733
|
-
|
|
18734
|
-
// src/commands/prs/parseIncoming.ts
|
|
18735
|
-
function parseIncoming(line, requestId) {
|
|
18736
|
-
try {
|
|
18737
|
-
const msg = JSON.parse(line);
|
|
18738
|
-
if (msg.type === "error" && (msg.message ?? "").includes("pr-preview"))
|
|
18739
|
-
return { kind: "error", message: msg.message ?? "pr-preview failed" };
|
|
18740
|
-
if (msg.type !== "pr-decision" || msg.requestId !== requestId) return null;
|
|
18741
|
-
if (msg.decision !== "approve" && msg.decision !== "reject") return null;
|
|
18742
|
-
return {
|
|
18743
|
-
kind: "decision",
|
|
18744
|
-
decision: {
|
|
18745
|
-
decision: msg.decision,
|
|
18746
|
-
reason: msg.reason,
|
|
18747
|
-
comments: Array.isArray(msg.comments) ? msg.comments : void 0,
|
|
18748
|
-
screenshots: Array.isArray(msg.screenshots) ? msg.screenshots : void 0
|
|
18749
|
-
}
|
|
18750
|
-
};
|
|
18751
|
-
} catch {
|
|
18752
|
-
return null;
|
|
18753
|
-
}
|
|
18754
|
-
}
|
|
18755
|
-
|
|
18756
|
-
// src/commands/prs/requestPrDecision.ts
|
|
18757
|
-
function requestPrDecision(request) {
|
|
18758
|
-
return new Promise((resolve20, reject) => {
|
|
18759
|
-
connectToDaemon().then((socket) => {
|
|
18760
|
-
let settled = false;
|
|
18761
|
-
const finish = (error, decision) => {
|
|
18762
|
-
if (settled) return;
|
|
18763
|
-
settled = true;
|
|
18764
|
-
socket.destroy();
|
|
18765
|
-
if (error) reject(error);
|
|
18766
|
-
else resolve20(decision);
|
|
18767
|
-
};
|
|
18768
|
-
readSocketLines(socket, (line) => {
|
|
18769
|
-
const incoming = parseIncoming(line, request.requestId);
|
|
18770
|
-
if (!incoming) return;
|
|
18771
|
-
if (incoming.kind === "error") finish(new Error(incoming.message));
|
|
18772
|
-
else finish(void 0, incoming.decision);
|
|
18773
|
-
});
|
|
18774
|
-
socket.on("error", (error) => finish(error));
|
|
18775
|
-
socket.on(
|
|
18776
|
-
"close",
|
|
18777
|
-
() => finish(new Error("daemon closed before a decision was made"))
|
|
18778
|
-
);
|
|
18779
|
-
socket.write(`${JSON.stringify({ type: "pr-preview", ...request })}
|
|
18780
|
-
`);
|
|
18781
|
-
}, reject);
|
|
18782
|
-
});
|
|
18783
|
-
}
|
|
18784
|
-
|
|
18785
18908
|
// src/commands/prs/previewAndPlace.ts
|
|
18786
18909
|
async function previewAndPlace(args) {
|
|
18787
|
-
|
|
18788
|
-
|
|
18789
|
-
|
|
18790
|
-
|
|
18791
|
-
|
|
18792
|
-
|
|
18793
|
-
|
|
18794
|
-
body: args.body,
|
|
18795
|
-
prNumber: args.prNumber
|
|
18796
|
-
});
|
|
18797
|
-
} catch (error) {
|
|
18798
|
-
console.error(
|
|
18799
|
-
`Error: ${error instanceof Error ? error.message : String(error)}`
|
|
18800
|
-
);
|
|
18801
|
-
process.exit(1);
|
|
18802
|
-
}
|
|
18803
|
-
if (decision.decision === "reject") reportPrRejection(decision);
|
|
18910
|
+
const decision = await awaitPreviewApproval("PR preview", {
|
|
18911
|
+
sessionId: args.sessionId,
|
|
18912
|
+
requestId: randomUUID5(),
|
|
18913
|
+
title: args.title,
|
|
18914
|
+
body: args.body,
|
|
18915
|
+
prNumber: args.prNumber
|
|
18916
|
+
});
|
|
18804
18917
|
const body = appendScreenshots(args.body, decision.screenshots ?? []);
|
|
18805
18918
|
await placePr(args.prNumber, args.title, body, args.options);
|
|
18806
18919
|
}
|
|
@@ -19081,10 +19194,10 @@ function registerPrs(program2) {
|
|
|
19081
19194
|
}
|
|
19082
19195
|
|
|
19083
19196
|
// src/commands/ravendb/ravendbAuth.ts
|
|
19084
|
-
import
|
|
19197
|
+
import chalk172 from "chalk";
|
|
19085
19198
|
|
|
19086
19199
|
// src/shared/createConnectionAuth.ts
|
|
19087
|
-
import
|
|
19200
|
+
import chalk167 from "chalk";
|
|
19088
19201
|
function listConnections(connections, format) {
|
|
19089
19202
|
if (connections.length === 0) {
|
|
19090
19203
|
console.log("No connections configured.");
|
|
@@ -19097,7 +19210,7 @@ function listConnections(connections, format) {
|
|
|
19097
19210
|
function removeConnection(connections, name, save) {
|
|
19098
19211
|
const filtered = connections.filter((c) => c.name !== name);
|
|
19099
19212
|
if (filtered.length === connections.length) {
|
|
19100
|
-
console.error(
|
|
19213
|
+
console.error(chalk167.red(`Connection "${name}" not found.`));
|
|
19101
19214
|
process.exit(1);
|
|
19102
19215
|
}
|
|
19103
19216
|
save(filtered);
|
|
@@ -19143,15 +19256,15 @@ function saveConnections(connections) {
|
|
|
19143
19256
|
}
|
|
19144
19257
|
|
|
19145
19258
|
// src/commands/ravendb/promptConnection.ts
|
|
19146
|
-
import
|
|
19259
|
+
import chalk170 from "chalk";
|
|
19147
19260
|
|
|
19148
19261
|
// src/commands/ravendb/selectOpSecret.ts
|
|
19149
|
-
import
|
|
19262
|
+
import chalk169 from "chalk";
|
|
19150
19263
|
import Enquirer2 from "enquirer";
|
|
19151
19264
|
|
|
19152
19265
|
// src/commands/ravendb/searchItems.ts
|
|
19153
19266
|
import { execSync as execSync49 } from "child_process";
|
|
19154
|
-
import
|
|
19267
|
+
import chalk168 from "chalk";
|
|
19155
19268
|
function opExec(args) {
|
|
19156
19269
|
return execSync49(`op ${args}`, {
|
|
19157
19270
|
encoding: "utf8",
|
|
@@ -19164,7 +19277,7 @@ function searchItems(search2) {
|
|
|
19164
19277
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
19165
19278
|
} catch {
|
|
19166
19279
|
console.error(
|
|
19167
|
-
|
|
19280
|
+
chalk168.red(
|
|
19168
19281
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
19169
19282
|
)
|
|
19170
19283
|
);
|
|
@@ -19178,7 +19291,7 @@ function getItemFields(itemId2) {
|
|
|
19178
19291
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
19179
19292
|
return item.fields.filter((f) => f.reference && f.label);
|
|
19180
19293
|
} catch {
|
|
19181
|
-
console.error(
|
|
19294
|
+
console.error(chalk168.red("Failed to get item details from 1Password."));
|
|
19182
19295
|
process.exit(1);
|
|
19183
19296
|
}
|
|
19184
19297
|
}
|
|
@@ -19197,7 +19310,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
19197
19310
|
}).run();
|
|
19198
19311
|
const items2 = searchItems(search2);
|
|
19199
19312
|
if (items2.length === 0) {
|
|
19200
|
-
console.error(
|
|
19313
|
+
console.error(chalk169.red(`No items found matching "${search2}".`));
|
|
19201
19314
|
process.exit(1);
|
|
19202
19315
|
}
|
|
19203
19316
|
const itemId2 = await selectOne(
|
|
@@ -19206,7 +19319,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
19206
19319
|
);
|
|
19207
19320
|
const fields = getItemFields(itemId2);
|
|
19208
19321
|
if (fields.length === 0) {
|
|
19209
|
-
console.error(
|
|
19322
|
+
console.error(chalk169.red("No fields with references found on this item."));
|
|
19210
19323
|
process.exit(1);
|
|
19211
19324
|
}
|
|
19212
19325
|
const ref = await selectOne(
|
|
@@ -19220,7 +19333,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
19220
19333
|
async function promptConnection(existingNames) {
|
|
19221
19334
|
const name = await promptInput("name", "Connection name:");
|
|
19222
19335
|
if (existingNames.includes(name)) {
|
|
19223
|
-
console.error(
|
|
19336
|
+
console.error(chalk170.red(`Connection "${name}" already exists.`));
|
|
19224
19337
|
process.exit(1);
|
|
19225
19338
|
}
|
|
19226
19339
|
const url = await promptInput(
|
|
@@ -19229,22 +19342,22 @@ async function promptConnection(existingNames) {
|
|
|
19229
19342
|
);
|
|
19230
19343
|
const database = await promptInput("database", "Database name:");
|
|
19231
19344
|
if (!name || !url || !database) {
|
|
19232
|
-
console.error(
|
|
19345
|
+
console.error(chalk170.red("All fields are required."));
|
|
19233
19346
|
process.exit(1);
|
|
19234
19347
|
}
|
|
19235
19348
|
const apiKeyRef = await selectOpSecret();
|
|
19236
|
-
console.log(
|
|
19349
|
+
console.log(chalk170.dim(`Using: ${apiKeyRef}`));
|
|
19237
19350
|
return { name, url, database, apiKeyRef };
|
|
19238
19351
|
}
|
|
19239
19352
|
|
|
19240
19353
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
19241
|
-
import
|
|
19354
|
+
import chalk171 from "chalk";
|
|
19242
19355
|
function ravendbSetConnection(name) {
|
|
19243
19356
|
const raw = loadGlobalConfigRaw();
|
|
19244
19357
|
const ravendb = raw.ravendb ?? {};
|
|
19245
19358
|
const connections = ravendb.connections ?? [];
|
|
19246
19359
|
if (!connections.some((c) => c.name === name)) {
|
|
19247
|
-
console.error(
|
|
19360
|
+
console.error(chalk171.red(`Connection "${name}" not found.`));
|
|
19248
19361
|
console.error(
|
|
19249
19362
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
19250
19363
|
);
|
|
@@ -19260,16 +19373,16 @@ function ravendbSetConnection(name) {
|
|
|
19260
19373
|
var ravendbAuth = createConnectionAuth({
|
|
19261
19374
|
load: loadConnections,
|
|
19262
19375
|
save: saveConnections,
|
|
19263
|
-
format: (c) => `${
|
|
19376
|
+
format: (c) => `${chalk172.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
19264
19377
|
promptNew: promptConnection,
|
|
19265
19378
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
19266
19379
|
});
|
|
19267
19380
|
|
|
19268
19381
|
// src/commands/ravendb/ravendbCollections.ts
|
|
19269
|
-
import
|
|
19382
|
+
import chalk176 from "chalk";
|
|
19270
19383
|
|
|
19271
19384
|
// src/commands/ravendb/ravenFetch.ts
|
|
19272
|
-
import
|
|
19385
|
+
import chalk174 from "chalk";
|
|
19273
19386
|
|
|
19274
19387
|
// src/commands/ravendb/getAccessToken.ts
|
|
19275
19388
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -19306,10 +19419,10 @@ ${errorText}`
|
|
|
19306
19419
|
|
|
19307
19420
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
19308
19421
|
import { execSync as execSync50 } from "child_process";
|
|
19309
|
-
import
|
|
19422
|
+
import chalk173 from "chalk";
|
|
19310
19423
|
function resolveOpSecret(reference) {
|
|
19311
19424
|
if (!reference.startsWith("op://")) {
|
|
19312
|
-
console.error(
|
|
19425
|
+
console.error(chalk173.red(`Invalid secret reference: must start with op://`));
|
|
19313
19426
|
process.exit(1);
|
|
19314
19427
|
}
|
|
19315
19428
|
try {
|
|
@@ -19319,7 +19432,7 @@ function resolveOpSecret(reference) {
|
|
|
19319
19432
|
}).trim();
|
|
19320
19433
|
} catch {
|
|
19321
19434
|
console.error(
|
|
19322
|
-
|
|
19435
|
+
chalk173.red(
|
|
19323
19436
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
19324
19437
|
)
|
|
19325
19438
|
);
|
|
@@ -19346,7 +19459,7 @@ async function ravenFetch(connection, path71) {
|
|
|
19346
19459
|
if (!response.ok) {
|
|
19347
19460
|
const body = await response.text();
|
|
19348
19461
|
console.error(
|
|
19349
|
-
|
|
19462
|
+
chalk174.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
19350
19463
|
);
|
|
19351
19464
|
console.error(body.substring(0, 500));
|
|
19352
19465
|
process.exit(1);
|
|
@@ -19355,7 +19468,7 @@ async function ravenFetch(connection, path71) {
|
|
|
19355
19468
|
}
|
|
19356
19469
|
|
|
19357
19470
|
// src/commands/ravendb/resolveConnection.ts
|
|
19358
|
-
import
|
|
19471
|
+
import chalk175 from "chalk";
|
|
19359
19472
|
function loadRavendb() {
|
|
19360
19473
|
const raw = loadGlobalConfigRaw();
|
|
19361
19474
|
const ravendb = raw.ravendb;
|
|
@@ -19369,7 +19482,7 @@ function resolveConnection(name) {
|
|
|
19369
19482
|
const connectionName = name ?? defaultConnection;
|
|
19370
19483
|
if (!connectionName) {
|
|
19371
19484
|
console.error(
|
|
19372
|
-
|
|
19485
|
+
chalk175.red(
|
|
19373
19486
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
19374
19487
|
)
|
|
19375
19488
|
);
|
|
@@ -19377,7 +19490,7 @@ function resolveConnection(name) {
|
|
|
19377
19490
|
}
|
|
19378
19491
|
const connection = connections.find((c) => c.name === connectionName);
|
|
19379
19492
|
if (!connection) {
|
|
19380
|
-
console.error(
|
|
19493
|
+
console.error(chalk175.red(`Connection "${connectionName}" not found.`));
|
|
19381
19494
|
console.error(
|
|
19382
19495
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
19383
19496
|
);
|
|
@@ -19408,7 +19521,7 @@ async function ravendbCollections(connectionName) {
|
|
|
19408
19521
|
return;
|
|
19409
19522
|
}
|
|
19410
19523
|
for (const c of collections) {
|
|
19411
|
-
console.log(`${
|
|
19524
|
+
console.log(`${chalk176.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
19412
19525
|
}
|
|
19413
19526
|
}
|
|
19414
19527
|
|
|
@@ -19427,10 +19540,10 @@ var ravendbConfigHelp = [
|
|
|
19427
19540
|
];
|
|
19428
19541
|
|
|
19429
19542
|
// src/commands/ravendb/ravendbQuery.ts
|
|
19430
|
-
import
|
|
19543
|
+
import chalk178 from "chalk";
|
|
19431
19544
|
|
|
19432
19545
|
// src/commands/ravendb/fetchAllPages.ts
|
|
19433
|
-
import
|
|
19546
|
+
import chalk177 from "chalk";
|
|
19434
19547
|
|
|
19435
19548
|
// src/commands/ravendb/buildQueryPath.ts
|
|
19436
19549
|
function buildQueryPath(opts) {
|
|
@@ -19468,7 +19581,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
19468
19581
|
allResults.push(...results);
|
|
19469
19582
|
start3 += results.length;
|
|
19470
19583
|
process.stderr.write(
|
|
19471
|
-
`\r${
|
|
19584
|
+
`\r${chalk177.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
19472
19585
|
);
|
|
19473
19586
|
if (start3 >= totalResults) break;
|
|
19474
19587
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -19483,7 +19596,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
19483
19596
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
19484
19597
|
const resolved = resolveArgs(connectionName, collection);
|
|
19485
19598
|
if (!resolved.collection && !options2.query) {
|
|
19486
|
-
console.error(
|
|
19599
|
+
console.error(chalk178.red("Provide a collection name or --query filter."));
|
|
19487
19600
|
process.exit(1);
|
|
19488
19601
|
}
|
|
19489
19602
|
const { collection: col } = resolved;
|
|
@@ -19522,7 +19635,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
19522
19635
|
import * as path36 from "path";
|
|
19523
19636
|
|
|
19524
19637
|
// src/commands/refactor/logViolations.ts
|
|
19525
|
-
import
|
|
19638
|
+
import chalk179 from "chalk";
|
|
19526
19639
|
var DEFAULT_MAX_LINES = 100;
|
|
19527
19640
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
19528
19641
|
if (violations.length === 0) {
|
|
@@ -19531,43 +19644,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
19531
19644
|
}
|
|
19532
19645
|
return;
|
|
19533
19646
|
}
|
|
19534
|
-
console.error(
|
|
19647
|
+
console.error(chalk179.red(`
|
|
19535
19648
|
Refactor check failed:
|
|
19536
19649
|
`));
|
|
19537
|
-
console.error(
|
|
19650
|
+
console.error(chalk179.red(` The following files exceed ${maxLines} lines:
|
|
19538
19651
|
`));
|
|
19539
19652
|
for (const violation of violations) {
|
|
19540
|
-
console.error(
|
|
19653
|
+
console.error(chalk179.red(` ${violation.file} (${violation.lines} lines)`));
|
|
19541
19654
|
}
|
|
19542
19655
|
console.error(
|
|
19543
|
-
|
|
19656
|
+
chalk179.yellow(
|
|
19544
19657
|
`
|
|
19545
19658
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
19546
19659
|
way to refactor it, ignore it with:
|
|
19547
19660
|
`
|
|
19548
19661
|
)
|
|
19549
19662
|
);
|
|
19550
|
-
console.error(
|
|
19663
|
+
console.error(chalk179.gray(` assist refactor ignore <file>
|
|
19551
19664
|
`));
|
|
19552
19665
|
if (process.env.CLAUDECODE) {
|
|
19553
|
-
console.error(
|
|
19666
|
+
console.error(chalk179.cyan(`
|
|
19554
19667
|
## Extracting Code to New Files
|
|
19555
19668
|
`));
|
|
19556
19669
|
console.error(
|
|
19557
|
-
|
|
19670
|
+
chalk179.cyan(
|
|
19558
19671
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
19559
19672
|
`
|
|
19560
19673
|
)
|
|
19561
19674
|
);
|
|
19562
19675
|
console.error(
|
|
19563
|
-
|
|
19676
|
+
chalk179.cyan(
|
|
19564
19677
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
19565
19678
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
19566
19679
|
`
|
|
19567
19680
|
)
|
|
19568
19681
|
);
|
|
19569
19682
|
console.error(
|
|
19570
|
-
|
|
19683
|
+
chalk179.cyan(
|
|
19571
19684
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
19572
19685
|
domains, move it to a common/shared folder.
|
|
19573
19686
|
`
|
|
@@ -19723,7 +19836,7 @@ async function check(pattern2, options2) {
|
|
|
19723
19836
|
|
|
19724
19837
|
// src/commands/refactor/extract/index.ts
|
|
19725
19838
|
import path44 from "path";
|
|
19726
|
-
import
|
|
19839
|
+
import chalk182 from "chalk";
|
|
19727
19840
|
|
|
19728
19841
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
19729
19842
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -20322,23 +20435,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
20322
20435
|
|
|
20323
20436
|
// src/commands/refactor/extract/displayPlan.ts
|
|
20324
20437
|
import path40 from "path";
|
|
20325
|
-
import
|
|
20438
|
+
import chalk180 from "chalk";
|
|
20326
20439
|
function section2(title) {
|
|
20327
20440
|
return `
|
|
20328
|
-
${
|
|
20441
|
+
${chalk180.cyan(title)}`;
|
|
20329
20442
|
}
|
|
20330
20443
|
function displayImporters(plan2, cwd) {
|
|
20331
20444
|
if (plan2.importersToUpdate.length === 0) return;
|
|
20332
20445
|
console.log(section2("Update importers:"));
|
|
20333
20446
|
for (const imp of plan2.importersToUpdate) {
|
|
20334
20447
|
const rel = path40.relative(cwd, imp.file.getFilePath());
|
|
20335
|
-
console.log(` ${
|
|
20448
|
+
console.log(` ${chalk180.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
20336
20449
|
}
|
|
20337
20450
|
}
|
|
20338
20451
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
20339
|
-
console.log(
|
|
20452
|
+
console.log(chalk180.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
20340
20453
|
`));
|
|
20341
|
-
console.log(` ${
|
|
20454
|
+
console.log(` ${chalk180.cyan("Functions to move:")}`);
|
|
20342
20455
|
for (const name of plan2.extractedNames) {
|
|
20343
20456
|
console.log(` ${name}`);
|
|
20344
20457
|
}
|
|
@@ -20372,7 +20485,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
20372
20485
|
|
|
20373
20486
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
20374
20487
|
import path43 from "path";
|
|
20375
|
-
import
|
|
20488
|
+
import chalk181 from "chalk";
|
|
20376
20489
|
import { Project as Project4 } from "ts-morph";
|
|
20377
20490
|
|
|
20378
20491
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -20464,7 +20577,7 @@ function loadProjectFile(file) {
|
|
|
20464
20577
|
});
|
|
20465
20578
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
20466
20579
|
if (!sourceFile) {
|
|
20467
|
-
console.log(
|
|
20580
|
+
console.log(chalk181.red(`File not found in project: ${file}`));
|
|
20468
20581
|
process.exit(1);
|
|
20469
20582
|
}
|
|
20470
20583
|
return { project, sourceFile };
|
|
@@ -20487,19 +20600,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
20487
20600
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
20488
20601
|
if (options2.apply) {
|
|
20489
20602
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
20490
|
-
console.log(
|
|
20603
|
+
console.log(chalk182.green("\nExtraction complete"));
|
|
20491
20604
|
} else {
|
|
20492
|
-
console.log(
|
|
20605
|
+
console.log(chalk182.dim("\nDry run. Use --apply to execute."));
|
|
20493
20606
|
}
|
|
20494
20607
|
}
|
|
20495
20608
|
|
|
20496
20609
|
// src/commands/refactor/ignore.ts
|
|
20497
20610
|
import fs28 from "fs";
|
|
20498
|
-
import
|
|
20611
|
+
import chalk183 from "chalk";
|
|
20499
20612
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
20500
20613
|
function ignore2(file) {
|
|
20501
20614
|
if (!fs28.existsSync(file)) {
|
|
20502
|
-
console.error(
|
|
20615
|
+
console.error(chalk183.red(`Error: File does not exist: ${file}`));
|
|
20503
20616
|
process.exit(1);
|
|
20504
20617
|
}
|
|
20505
20618
|
const content = fs28.readFileSync(file, "utf8");
|
|
@@ -20515,7 +20628,7 @@ function ignore2(file) {
|
|
|
20515
20628
|
fs28.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
20516
20629
|
}
|
|
20517
20630
|
console.log(
|
|
20518
|
-
|
|
20631
|
+
chalk183.green(
|
|
20519
20632
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
20520
20633
|
)
|
|
20521
20634
|
);
|
|
@@ -20524,12 +20637,12 @@ function ignore2(file) {
|
|
|
20524
20637
|
// src/commands/refactor/rename/index.ts
|
|
20525
20638
|
import fs31 from "fs";
|
|
20526
20639
|
import path49 from "path";
|
|
20527
|
-
import
|
|
20640
|
+
import chalk186 from "chalk";
|
|
20528
20641
|
|
|
20529
20642
|
// src/commands/refactor/rename/applyRename.ts
|
|
20530
20643
|
import fs30 from "fs";
|
|
20531
20644
|
import path46 from "path";
|
|
20532
|
-
import
|
|
20645
|
+
import chalk184 from "chalk";
|
|
20533
20646
|
|
|
20534
20647
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
20535
20648
|
import path45 from "path";
|
|
@@ -20634,13 +20747,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
20634
20747
|
const updatedContents = applyRewrites(rewrites);
|
|
20635
20748
|
for (const [file, content] of updatedContents) {
|
|
20636
20749
|
fs30.writeFileSync(file, content, "utf8");
|
|
20637
|
-
console.log(
|
|
20750
|
+
console.log(chalk184.cyan(` Updated imports in ${path46.relative(cwd, file)}`));
|
|
20638
20751
|
}
|
|
20639
20752
|
const destDir = path46.dirname(destPath);
|
|
20640
20753
|
if (!fs30.existsSync(destDir)) fs30.mkdirSync(destDir, { recursive: true });
|
|
20641
20754
|
fs30.renameSync(sourcePath, destPath);
|
|
20642
20755
|
console.log(
|
|
20643
|
-
|
|
20756
|
+
chalk184.white(
|
|
20644
20757
|
` Moved ${path46.relative(cwd, sourcePath)} \u2192 ${path46.relative(cwd, destPath)}`
|
|
20645
20758
|
)
|
|
20646
20759
|
);
|
|
@@ -20727,16 +20840,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
20727
20840
|
|
|
20728
20841
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
20729
20842
|
import path48 from "path";
|
|
20730
|
-
import
|
|
20843
|
+
import chalk185 from "chalk";
|
|
20731
20844
|
function printRenamePreview(rewrites, cwd) {
|
|
20732
20845
|
for (const rewrite of rewrites) {
|
|
20733
20846
|
console.log(
|
|
20734
|
-
|
|
20847
|
+
chalk185.dim(
|
|
20735
20848
|
` ${path48.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
20736
20849
|
)
|
|
20737
20850
|
);
|
|
20738
20851
|
}
|
|
20739
|
-
console.log(
|
|
20852
|
+
console.log(chalk185.dim("Dry run. Use --apply to execute."));
|
|
20740
20853
|
}
|
|
20741
20854
|
|
|
20742
20855
|
// src/commands/refactor/rename/index.ts
|
|
@@ -20747,20 +20860,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
20747
20860
|
const relSource = path49.relative(cwd, sourcePath);
|
|
20748
20861
|
const relDest = path49.relative(cwd, destPath);
|
|
20749
20862
|
if (!fs31.existsSync(sourcePath)) {
|
|
20750
|
-
console.log(
|
|
20863
|
+
console.log(chalk186.red(`File not found: ${source}`));
|
|
20751
20864
|
process.exit(1);
|
|
20752
20865
|
}
|
|
20753
20866
|
if (destPath !== sourcePath && fs31.existsSync(destPath)) {
|
|
20754
|
-
console.log(
|
|
20867
|
+
console.log(chalk186.red(`Destination already exists: ${destination}`));
|
|
20755
20868
|
process.exit(1);
|
|
20756
20869
|
}
|
|
20757
|
-
console.log(
|
|
20758
|
-
console.log(
|
|
20759
|
-
console.log(
|
|
20870
|
+
console.log(chalk186.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
20871
|
+
console.log(chalk186.dim("Loading project..."));
|
|
20872
|
+
console.log(chalk186.dim("Scanning imports across the project..."));
|
|
20760
20873
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
20761
20874
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
20762
20875
|
console.log(
|
|
20763
|
-
|
|
20876
|
+
chalk186.dim(
|
|
20764
20877
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
20765
20878
|
)
|
|
20766
20879
|
);
|
|
@@ -20769,11 +20882,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
20769
20882
|
return;
|
|
20770
20883
|
}
|
|
20771
20884
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
20772
|
-
console.log(
|
|
20885
|
+
console.log(chalk186.green("Done"));
|
|
20773
20886
|
}
|
|
20774
20887
|
|
|
20775
20888
|
// src/commands/refactor/renameSymbol/index.ts
|
|
20776
|
-
import
|
|
20889
|
+
import chalk187 from "chalk";
|
|
20777
20890
|
|
|
20778
20891
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
20779
20892
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -20819,33 +20932,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
20819
20932
|
const { project, sourceFile } = loadProjectFile(file);
|
|
20820
20933
|
const symbol = findSymbol(sourceFile, oldName);
|
|
20821
20934
|
if (!symbol) {
|
|
20822
|
-
console.log(
|
|
20935
|
+
console.log(chalk187.red(`Symbol "${oldName}" not found in ${file}`));
|
|
20823
20936
|
process.exit(1);
|
|
20824
20937
|
}
|
|
20825
20938
|
const grouped = groupReferences(symbol, cwd);
|
|
20826
20939
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
20827
20940
|
console.log(
|
|
20828
|
-
|
|
20941
|
+
chalk187.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
20829
20942
|
`)
|
|
20830
20943
|
);
|
|
20831
20944
|
for (const [refFile, lines] of grouped) {
|
|
20832
20945
|
console.log(
|
|
20833
|
-
` ${
|
|
20946
|
+
` ${chalk187.dim(refFile)}: lines ${chalk187.cyan(lines.join(", "))}`
|
|
20834
20947
|
);
|
|
20835
20948
|
}
|
|
20836
20949
|
if (options2.apply) {
|
|
20837
20950
|
symbol.rename(newName);
|
|
20838
20951
|
await project.save();
|
|
20839
|
-
console.log(
|
|
20952
|
+
console.log(chalk187.green(`
|
|
20840
20953
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
20841
20954
|
} else {
|
|
20842
|
-
console.log(
|
|
20955
|
+
console.log(chalk187.dim("\nDry run. Use --apply to execute."));
|
|
20843
20956
|
}
|
|
20844
20957
|
}
|
|
20845
20958
|
|
|
20846
20959
|
// src/commands/refactor/restructure/index.ts
|
|
20847
20960
|
import path57 from "path";
|
|
20848
|
-
import
|
|
20961
|
+
import chalk190 from "chalk";
|
|
20849
20962
|
|
|
20850
20963
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
20851
20964
|
import path51 from "path";
|
|
@@ -20924,50 +21037,50 @@ function clusterFiles(graph) {
|
|
|
20924
21037
|
|
|
20925
21038
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
20926
21039
|
import path53 from "path";
|
|
20927
|
-
import
|
|
21040
|
+
import chalk188 from "chalk";
|
|
20928
21041
|
function relPath(filePath) {
|
|
20929
21042
|
return path53.relative(process.cwd(), filePath);
|
|
20930
21043
|
}
|
|
20931
21044
|
function displayMoves(plan2) {
|
|
20932
21045
|
if (plan2.moves.length === 0) return;
|
|
20933
|
-
console.log(
|
|
21046
|
+
console.log(chalk188.bold("\nFile moves:"));
|
|
20934
21047
|
for (const move2 of plan2.moves) {
|
|
20935
21048
|
console.log(
|
|
20936
|
-
` ${
|
|
21049
|
+
` ${chalk188.red(relPath(move2.from))} \u2192 ${chalk188.green(relPath(move2.to))}`
|
|
20937
21050
|
);
|
|
20938
|
-
console.log(
|
|
21051
|
+
console.log(chalk188.dim(` ${move2.reason}`));
|
|
20939
21052
|
}
|
|
20940
21053
|
}
|
|
20941
21054
|
function displayRewrites(rewrites) {
|
|
20942
21055
|
if (rewrites.length === 0) return;
|
|
20943
21056
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
20944
|
-
console.log(
|
|
21057
|
+
console.log(chalk188.bold(`
|
|
20945
21058
|
Import rewrites (${affectedFiles.size} files):`));
|
|
20946
21059
|
for (const file of affectedFiles) {
|
|
20947
|
-
console.log(` ${
|
|
21060
|
+
console.log(` ${chalk188.cyan(relPath(file))}:`);
|
|
20948
21061
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
20949
21062
|
(r) => r.file === file
|
|
20950
21063
|
)) {
|
|
20951
21064
|
console.log(
|
|
20952
|
-
` ${
|
|
21065
|
+
` ${chalk188.red(`"${oldSpecifier}"`)} \u2192 ${chalk188.green(`"${newSpecifier}"`)}`
|
|
20953
21066
|
);
|
|
20954
21067
|
}
|
|
20955
21068
|
}
|
|
20956
21069
|
}
|
|
20957
21070
|
function displayPlan2(plan2) {
|
|
20958
21071
|
if (plan2.warnings.length > 0) {
|
|
20959
|
-
console.log(
|
|
20960
|
-
for (const w of plan2.warnings) console.log(
|
|
21072
|
+
console.log(chalk188.yellow("\nWarnings:"));
|
|
21073
|
+
for (const w of plan2.warnings) console.log(chalk188.yellow(` ${w}`));
|
|
20961
21074
|
}
|
|
20962
21075
|
if (plan2.newDirectories.length > 0) {
|
|
20963
|
-
console.log(
|
|
21076
|
+
console.log(chalk188.bold("\nNew directories:"));
|
|
20964
21077
|
for (const dir of plan2.newDirectories)
|
|
20965
|
-
console.log(
|
|
21078
|
+
console.log(chalk188.green(` ${dir}/`));
|
|
20966
21079
|
}
|
|
20967
21080
|
displayMoves(plan2);
|
|
20968
21081
|
displayRewrites(plan2.rewrites);
|
|
20969
21082
|
console.log(
|
|
20970
|
-
|
|
21083
|
+
chalk188.dim(
|
|
20971
21084
|
`
|
|
20972
21085
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
20973
21086
|
)
|
|
@@ -20977,18 +21090,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
20977
21090
|
// src/commands/refactor/restructure/executePlan.ts
|
|
20978
21091
|
import fs32 from "fs";
|
|
20979
21092
|
import path54 from "path";
|
|
20980
|
-
import
|
|
21093
|
+
import chalk189 from "chalk";
|
|
20981
21094
|
function executePlan(plan2) {
|
|
20982
21095
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
20983
21096
|
for (const [file, content] of updatedContents) {
|
|
20984
21097
|
fs32.writeFileSync(file, content, "utf8");
|
|
20985
21098
|
console.log(
|
|
20986
|
-
|
|
21099
|
+
chalk189.cyan(` Rewrote imports in ${path54.relative(process.cwd(), file)}`)
|
|
20987
21100
|
);
|
|
20988
21101
|
}
|
|
20989
21102
|
for (const dir of plan2.newDirectories) {
|
|
20990
21103
|
fs32.mkdirSync(dir, { recursive: true });
|
|
20991
|
-
console.log(
|
|
21104
|
+
console.log(chalk189.green(` Created ${path54.relative(process.cwd(), dir)}/`));
|
|
20992
21105
|
}
|
|
20993
21106
|
for (const move2 of plan2.moves) {
|
|
20994
21107
|
const targetDir = path54.dirname(move2.to);
|
|
@@ -20997,7 +21110,7 @@ function executePlan(plan2) {
|
|
|
20997
21110
|
}
|
|
20998
21111
|
fs32.renameSync(move2.from, move2.to);
|
|
20999
21112
|
console.log(
|
|
21000
|
-
|
|
21113
|
+
chalk189.white(
|
|
21001
21114
|
` Moved ${path54.relative(process.cwd(), move2.from)} \u2192 ${path54.relative(process.cwd(), move2.to)}`
|
|
21002
21115
|
)
|
|
21003
21116
|
);
|
|
@@ -21012,7 +21125,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
21012
21125
|
if (entries.length === 0) {
|
|
21013
21126
|
fs32.rmdirSync(dir);
|
|
21014
21127
|
console.log(
|
|
21015
|
-
|
|
21128
|
+
chalk189.dim(
|
|
21016
21129
|
` Removed empty directory ${path54.relative(process.cwd(), dir)}`
|
|
21017
21130
|
)
|
|
21018
21131
|
);
|
|
@@ -21145,22 +21258,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
21145
21258
|
const targetPattern = pattern2 ?? "src";
|
|
21146
21259
|
const files = findSourceFiles2(targetPattern);
|
|
21147
21260
|
if (files.length === 0) {
|
|
21148
|
-
console.log(
|
|
21261
|
+
console.log(chalk190.yellow("No files found matching pattern"));
|
|
21149
21262
|
return;
|
|
21150
21263
|
}
|
|
21151
21264
|
const tsConfigPath = findTsConfig(path57.resolve(files[0]));
|
|
21152
21265
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
21153
21266
|
if (plan2.moves.length === 0) {
|
|
21154
|
-
console.log(
|
|
21267
|
+
console.log(chalk190.green("No restructuring needed"));
|
|
21155
21268
|
return;
|
|
21156
21269
|
}
|
|
21157
21270
|
displayPlan2(plan2);
|
|
21158
21271
|
if (options2.apply) {
|
|
21159
|
-
console.log(
|
|
21272
|
+
console.log(chalk190.bold("\nApplying changes..."));
|
|
21160
21273
|
executePlan(plan2);
|
|
21161
|
-
console.log(
|
|
21274
|
+
console.log(chalk190.green("\nRestructuring complete"));
|
|
21162
21275
|
} else {
|
|
21163
|
-
console.log(
|
|
21276
|
+
console.log(chalk190.dim("\nDry run. Use --apply to execute."));
|
|
21164
21277
|
}
|
|
21165
21278
|
}
|
|
21166
21279
|
|
|
@@ -21482,7 +21595,7 @@ function gatherContext() {
|
|
|
21482
21595
|
}
|
|
21483
21596
|
|
|
21484
21597
|
// src/commands/review/postReviewToPr.ts
|
|
21485
|
-
import { readFileSync as
|
|
21598
|
+
import { readFileSync as readFileSync40 } from "fs";
|
|
21486
21599
|
|
|
21487
21600
|
// src/commands/review/parseFindings.ts
|
|
21488
21601
|
var SEVERITIES = ["blocker", "major", "minor", "nit"];
|
|
@@ -21743,18 +21856,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
21743
21856
|
}
|
|
21744
21857
|
|
|
21745
21858
|
// src/commands/review/warnOutOfDiff.ts
|
|
21746
|
-
import
|
|
21859
|
+
import chalk191 from "chalk";
|
|
21747
21860
|
function warnOutOfDiff(outOfDiff) {
|
|
21748
21861
|
if (outOfDiff.length === 0) return;
|
|
21749
21862
|
console.warn(
|
|
21750
|
-
|
|
21863
|
+
chalk191.yellow(
|
|
21751
21864
|
`Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
|
|
21752
21865
|
)
|
|
21753
21866
|
);
|
|
21754
21867
|
for (const finding of outOfDiff) {
|
|
21755
21868
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
21756
21869
|
console.warn(
|
|
21757
|
-
` ${
|
|
21870
|
+
` ${chalk191.yellow("\xB7")} ${finding.title} ${chalk191.dim(
|
|
21758
21871
|
`(${finding.file}:${range})`
|
|
21759
21872
|
)}`
|
|
21760
21873
|
);
|
|
@@ -21773,18 +21886,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
21773
21886
|
}
|
|
21774
21887
|
|
|
21775
21888
|
// src/commands/review/warnUnlocated.ts
|
|
21776
|
-
import
|
|
21889
|
+
import chalk192 from "chalk";
|
|
21777
21890
|
function warnUnlocated(unlocated) {
|
|
21778
21891
|
if (unlocated.length === 0) return;
|
|
21779
21892
|
console.warn(
|
|
21780
|
-
|
|
21893
|
+
chalk192.yellow(
|
|
21781
21894
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
21782
21895
|
)
|
|
21783
21896
|
);
|
|
21784
21897
|
for (const finding of unlocated) {
|
|
21785
|
-
const where = finding.location ||
|
|
21898
|
+
const where = finding.location || chalk192.dim("missing");
|
|
21786
21899
|
console.warn(
|
|
21787
|
-
` ${
|
|
21900
|
+
` ${chalk192.yellow("\xB7")} ${finding.title} ${chalk192.dim(`(${where})`)}`
|
|
21788
21901
|
);
|
|
21789
21902
|
}
|
|
21790
21903
|
}
|
|
@@ -21797,7 +21910,7 @@ async function confirmPost(prNumber, count7, options2) {
|
|
|
21797
21910
|
async function postReviewToPr(synthesisPath, options2) {
|
|
21798
21911
|
const prInfo = fetchPrDiffInfo();
|
|
21799
21912
|
const prNumber = prInfo.prNumber;
|
|
21800
|
-
const markdown =
|
|
21913
|
+
const markdown = readFileSync40(synthesisPath, "utf8");
|
|
21801
21914
|
const findings = parseFindings(markdown);
|
|
21802
21915
|
if (findings.length === 0) {
|
|
21803
21916
|
console.log("Synthesis contains no findings; nothing to post.");
|
|
@@ -22681,7 +22794,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
|
|
|
22681
22794
|
}
|
|
22682
22795
|
|
|
22683
22796
|
// src/commands/review/synthesise.ts
|
|
22684
|
-
import { readFileSync as
|
|
22797
|
+
import { readFileSync as readFileSync41 } from "fs";
|
|
22685
22798
|
|
|
22686
22799
|
// src/commands/review/buildSynthesisStdin.ts
|
|
22687
22800
|
var SYNTHESIS_PROMPT = `You are consolidating two independent code reviews of the same change. The original review request is in request.md. The two reviews are in claude.md and codex.md in the current working directory.
|
|
@@ -22737,7 +22850,7 @@ Files:
|
|
|
22737
22850
|
|
|
22738
22851
|
// src/commands/review/synthesise.ts
|
|
22739
22852
|
function printSummary2(synthesisPath) {
|
|
22740
|
-
const markdown =
|
|
22853
|
+
const markdown = readFileSync41(synthesisPath, "utf8");
|
|
22741
22854
|
console.log("");
|
|
22742
22855
|
console.log(buildReviewSummary(markdown));
|
|
22743
22856
|
console.log("");
|
|
@@ -22956,7 +23069,7 @@ function registerReview(program2) {
|
|
|
22956
23069
|
}
|
|
22957
23070
|
|
|
22958
23071
|
// src/commands/seq/seqAuth.ts
|
|
22959
|
-
import
|
|
23072
|
+
import chalk194 from "chalk";
|
|
22960
23073
|
|
|
22961
23074
|
// src/commands/seq/loadConnections.ts
|
|
22962
23075
|
function loadConnections2() {
|
|
@@ -22985,10 +23098,10 @@ function setDefaultConnection(name) {
|
|
|
22985
23098
|
}
|
|
22986
23099
|
|
|
22987
23100
|
// src/shared/assertUniqueName.ts
|
|
22988
|
-
import
|
|
23101
|
+
import chalk193 from "chalk";
|
|
22989
23102
|
function assertUniqueName(existingNames, name) {
|
|
22990
23103
|
if (existingNames.includes(name)) {
|
|
22991
|
-
console.error(
|
|
23104
|
+
console.error(chalk193.red(`Connection "${name}" already exists.`));
|
|
22992
23105
|
process.exit(1);
|
|
22993
23106
|
}
|
|
22994
23107
|
}
|
|
@@ -23006,7 +23119,7 @@ async function promptConnection2(existingNames) {
|
|
|
23006
23119
|
var seqAuth = createConnectionAuth({
|
|
23007
23120
|
load: loadConnections2,
|
|
23008
23121
|
save: saveConnections2,
|
|
23009
|
-
format: (c) => `${
|
|
23122
|
+
format: (c) => `${chalk194.bold(c.name)} ${c.url}`,
|
|
23010
23123
|
promptNew: promptConnection2,
|
|
23011
23124
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
23012
23125
|
});
|
|
@@ -23026,10 +23139,10 @@ var seqConfigHelp = [
|
|
|
23026
23139
|
];
|
|
23027
23140
|
|
|
23028
23141
|
// src/commands/seq/seqQuery.ts
|
|
23029
|
-
import
|
|
23142
|
+
import chalk198 from "chalk";
|
|
23030
23143
|
|
|
23031
23144
|
// src/commands/seq/fetchSeq.ts
|
|
23032
|
-
import
|
|
23145
|
+
import chalk195 from "chalk";
|
|
23033
23146
|
async function fetchSeq(conn, path71, params) {
|
|
23034
23147
|
const url = `${conn.url}${path71}?${params}`;
|
|
23035
23148
|
const response = await fetch(url, {
|
|
@@ -23040,7 +23153,7 @@ async function fetchSeq(conn, path71, params) {
|
|
|
23040
23153
|
});
|
|
23041
23154
|
if (!response.ok) {
|
|
23042
23155
|
const body = await response.text();
|
|
23043
|
-
console.error(
|
|
23156
|
+
console.error(chalk195.red(`Seq returned ${response.status}: ${body}`));
|
|
23044
23157
|
process.exit(1);
|
|
23045
23158
|
}
|
|
23046
23159
|
return response;
|
|
@@ -23099,23 +23212,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
23099
23212
|
}
|
|
23100
23213
|
|
|
23101
23214
|
// src/commands/seq/formatEvent.ts
|
|
23102
|
-
import
|
|
23215
|
+
import chalk196 from "chalk";
|
|
23103
23216
|
function levelColor(level) {
|
|
23104
23217
|
switch (level) {
|
|
23105
23218
|
case "Fatal":
|
|
23106
|
-
return
|
|
23219
|
+
return chalk196.bgRed.white;
|
|
23107
23220
|
case "Error":
|
|
23108
|
-
return
|
|
23221
|
+
return chalk196.red;
|
|
23109
23222
|
case "Warning":
|
|
23110
|
-
return
|
|
23223
|
+
return chalk196.yellow;
|
|
23111
23224
|
case "Information":
|
|
23112
|
-
return
|
|
23225
|
+
return chalk196.cyan;
|
|
23113
23226
|
case "Debug":
|
|
23114
|
-
return
|
|
23227
|
+
return chalk196.gray;
|
|
23115
23228
|
case "Verbose":
|
|
23116
|
-
return
|
|
23229
|
+
return chalk196.dim;
|
|
23117
23230
|
default:
|
|
23118
|
-
return
|
|
23231
|
+
return chalk196.white;
|
|
23119
23232
|
}
|
|
23120
23233
|
}
|
|
23121
23234
|
function levelAbbrev(level) {
|
|
@@ -23156,12 +23269,12 @@ function formatTimestamp(iso) {
|
|
|
23156
23269
|
function formatEvent(event) {
|
|
23157
23270
|
const color = levelColor(event.Level);
|
|
23158
23271
|
const abbrev = levelAbbrev(event.Level);
|
|
23159
|
-
const ts8 =
|
|
23272
|
+
const ts8 = chalk196.dim(formatTimestamp(event.Timestamp));
|
|
23160
23273
|
const msg = renderMessage(event);
|
|
23161
23274
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
23162
23275
|
if (event.Exception) {
|
|
23163
23276
|
for (const line of event.Exception.split("\n")) {
|
|
23164
|
-
lines.push(
|
|
23277
|
+
lines.push(chalk196.red(` ${line}`));
|
|
23165
23278
|
}
|
|
23166
23279
|
}
|
|
23167
23280
|
return lines.join("\n");
|
|
@@ -23194,11 +23307,11 @@ function rejectTimestampFilter(filter) {
|
|
|
23194
23307
|
}
|
|
23195
23308
|
|
|
23196
23309
|
// src/shared/resolveNamedConnection.ts
|
|
23197
|
-
import
|
|
23310
|
+
import chalk197 from "chalk";
|
|
23198
23311
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
23199
23312
|
if (connections.length === 0) {
|
|
23200
23313
|
console.error(
|
|
23201
|
-
|
|
23314
|
+
chalk197.red(
|
|
23202
23315
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
23203
23316
|
)
|
|
23204
23317
|
);
|
|
@@ -23207,7 +23320,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
23207
23320
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
23208
23321
|
const connection = connections.find((c) => c.name === target);
|
|
23209
23322
|
if (!connection) {
|
|
23210
|
-
console.error(
|
|
23323
|
+
console.error(chalk197.red(`${kind} connection "${target}" not found.`));
|
|
23211
23324
|
process.exit(1);
|
|
23212
23325
|
}
|
|
23213
23326
|
return connection;
|
|
@@ -23236,7 +23349,7 @@ async function seqQuery(filter, options2) {
|
|
|
23236
23349
|
new URLSearchParams({ filter, count: String(count7) })
|
|
23237
23350
|
);
|
|
23238
23351
|
if (events.length === 0) {
|
|
23239
|
-
console.log(
|
|
23352
|
+
console.log(chalk198.yellow("No events found."));
|
|
23240
23353
|
return;
|
|
23241
23354
|
}
|
|
23242
23355
|
if (options2.json) {
|
|
@@ -23247,11 +23360,11 @@ async function seqQuery(filter, options2) {
|
|
|
23247
23360
|
for (const event of chronological) {
|
|
23248
23361
|
console.log(formatEvent(event));
|
|
23249
23362
|
}
|
|
23250
|
-
console.log(
|
|
23363
|
+
console.log(chalk198.dim(`
|
|
23251
23364
|
${events.length} events`));
|
|
23252
23365
|
if (events.length >= count7) {
|
|
23253
23366
|
console.log(
|
|
23254
|
-
|
|
23367
|
+
chalk198.yellow(
|
|
23255
23368
|
`Results limited to ${count7}. Use --count to retrieve more.`
|
|
23256
23369
|
)
|
|
23257
23370
|
);
|
|
@@ -23259,10 +23372,10 @@ ${events.length} events`));
|
|
|
23259
23372
|
}
|
|
23260
23373
|
|
|
23261
23374
|
// src/shared/setNamedDefaultConnection.ts
|
|
23262
|
-
import
|
|
23375
|
+
import chalk199 from "chalk";
|
|
23263
23376
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
23264
23377
|
if (!connections.find((c) => c.name === name)) {
|
|
23265
|
-
console.error(
|
|
23378
|
+
console.error(chalk199.red(`Connection "${name}" not found.`));
|
|
23266
23379
|
process.exit(1);
|
|
23267
23380
|
}
|
|
23268
23381
|
setDefault(name);
|
|
@@ -23311,7 +23424,7 @@ function registerSignal(program2) {
|
|
|
23311
23424
|
}
|
|
23312
23425
|
|
|
23313
23426
|
// src/commands/sql/sqlAuth.ts
|
|
23314
|
-
import
|
|
23427
|
+
import chalk201 from "chalk";
|
|
23315
23428
|
|
|
23316
23429
|
// src/commands/sql/loadConnections.ts
|
|
23317
23430
|
function loadConnections3() {
|
|
@@ -23340,7 +23453,7 @@ function setDefaultConnection2(name) {
|
|
|
23340
23453
|
}
|
|
23341
23454
|
|
|
23342
23455
|
// src/commands/sql/promptConnection.ts
|
|
23343
|
-
import
|
|
23456
|
+
import chalk200 from "chalk";
|
|
23344
23457
|
async function promptConnection3(existingNames) {
|
|
23345
23458
|
const name = await promptInput("name", "Connection name:", "default");
|
|
23346
23459
|
assertUniqueName(existingNames, name);
|
|
@@ -23348,7 +23461,7 @@ async function promptConnection3(existingNames) {
|
|
|
23348
23461
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
23349
23462
|
const port = Number.parseInt(portStr, 10);
|
|
23350
23463
|
if (!Number.isFinite(port)) {
|
|
23351
|
-
console.error(
|
|
23464
|
+
console.error(chalk200.red(`Invalid port "${portStr}".`));
|
|
23352
23465
|
process.exit(1);
|
|
23353
23466
|
}
|
|
23354
23467
|
const user = await promptInput("user", "User:");
|
|
@@ -23361,13 +23474,13 @@ async function promptConnection3(existingNames) {
|
|
|
23361
23474
|
var sqlAuth = createConnectionAuth({
|
|
23362
23475
|
load: loadConnections3,
|
|
23363
23476
|
save: saveConnections3,
|
|
23364
|
-
format: (c) => `${
|
|
23477
|
+
format: (c) => `${chalk201.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
23365
23478
|
promptNew: promptConnection3,
|
|
23366
23479
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
23367
23480
|
});
|
|
23368
23481
|
|
|
23369
23482
|
// src/commands/sql/printTable.ts
|
|
23370
|
-
import
|
|
23483
|
+
import chalk202 from "chalk";
|
|
23371
23484
|
function formatCell(value) {
|
|
23372
23485
|
if (value === null || value === void 0) return "";
|
|
23373
23486
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -23376,7 +23489,7 @@ function formatCell(value) {
|
|
|
23376
23489
|
}
|
|
23377
23490
|
function printTable(rows) {
|
|
23378
23491
|
if (rows.length === 0) {
|
|
23379
|
-
console.log(
|
|
23492
|
+
console.log(chalk202.yellow("(no rows)"));
|
|
23380
23493
|
return;
|
|
23381
23494
|
}
|
|
23382
23495
|
const columns = Object.keys(rows[0]);
|
|
@@ -23384,13 +23497,13 @@ function printTable(rows) {
|
|
|
23384
23497
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
23385
23498
|
);
|
|
23386
23499
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
23387
|
-
console.log(
|
|
23388
|
-
console.log(
|
|
23500
|
+
console.log(chalk202.dim(header));
|
|
23501
|
+
console.log(chalk202.dim("-".repeat(header.length)));
|
|
23389
23502
|
for (const row of rows) {
|
|
23390
23503
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
23391
23504
|
console.log(line);
|
|
23392
23505
|
}
|
|
23393
|
-
console.log(
|
|
23506
|
+
console.log(chalk202.dim(`
|
|
23394
23507
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
23395
23508
|
}
|
|
23396
23509
|
|
|
@@ -23464,7 +23577,7 @@ var sqlConfigHelp = [
|
|
|
23464
23577
|
];
|
|
23465
23578
|
|
|
23466
23579
|
// src/commands/sql/sqlMutate.ts
|
|
23467
|
-
import
|
|
23580
|
+
import chalk203 from "chalk";
|
|
23468
23581
|
|
|
23469
23582
|
// src/commands/sql/isMutation.ts
|
|
23470
23583
|
var MUTATION_KEYWORDS = [
|
|
@@ -23498,7 +23611,7 @@ function isMutation(sql25) {
|
|
|
23498
23611
|
async function sqlMutate(query, connectionName) {
|
|
23499
23612
|
if (!isMutation(query)) {
|
|
23500
23613
|
console.error(
|
|
23501
|
-
|
|
23614
|
+
chalk203.red(
|
|
23502
23615
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
23503
23616
|
)
|
|
23504
23617
|
);
|
|
@@ -23508,18 +23621,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
23508
23621
|
const pool = await sqlConnect(conn);
|
|
23509
23622
|
try {
|
|
23510
23623
|
const result = await pool.request().query(query);
|
|
23511
|
-
console.log(
|
|
23624
|
+
console.log(chalk203.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
23512
23625
|
} finally {
|
|
23513
23626
|
await pool.close();
|
|
23514
23627
|
}
|
|
23515
23628
|
}
|
|
23516
23629
|
|
|
23517
23630
|
// src/commands/sql/sqlQuery.ts
|
|
23518
|
-
import
|
|
23631
|
+
import chalk204 from "chalk";
|
|
23519
23632
|
async function sqlQuery(query, connectionName) {
|
|
23520
23633
|
if (isMutation(query)) {
|
|
23521
23634
|
console.error(
|
|
23522
|
-
|
|
23635
|
+
chalk204.red(
|
|
23523
23636
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
23524
23637
|
)
|
|
23525
23638
|
);
|
|
@@ -23534,7 +23647,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
23534
23647
|
printTable(rows);
|
|
23535
23648
|
} else {
|
|
23536
23649
|
console.log(
|
|
23537
|
-
|
|
23650
|
+
chalk204.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
23538
23651
|
);
|
|
23539
23652
|
}
|
|
23540
23653
|
} finally {
|
|
@@ -23681,7 +23794,7 @@ function list4() {
|
|
|
23681
23794
|
import {
|
|
23682
23795
|
existsSync as existsSync49,
|
|
23683
23796
|
mkdirSync as mkdirSync19,
|
|
23684
|
-
readFileSync as
|
|
23797
|
+
readFileSync as readFileSync42,
|
|
23685
23798
|
renameSync as renameSync2,
|
|
23686
23799
|
writeFileSync as writeFileSync38
|
|
23687
23800
|
} from "fs";
|
|
@@ -23893,7 +24006,7 @@ function formatChatLog(messages) {
|
|
|
23893
24006
|
// src/commands/transcript/move.ts
|
|
23894
24007
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
23895
24008
|
function convertVttToMarkdown(inputPath) {
|
|
23896
|
-
const cues = parseVtt(
|
|
24009
|
+
const cues = parseVtt(readFileSync42(inputPath, "utf8"));
|
|
23897
24010
|
const messages = cuesToChatMessages(deduplicateCues(cues));
|
|
23898
24011
|
return formatChatLog(messages);
|
|
23899
24012
|
}
|
|
@@ -24078,14 +24191,14 @@ function devices() {
|
|
|
24078
24191
|
}
|
|
24079
24192
|
|
|
24080
24193
|
// src/commands/voice/logs.ts
|
|
24081
|
-
import { existsSync as existsSync50, readFileSync as
|
|
24194
|
+
import { existsSync as existsSync50, readFileSync as readFileSync43 } from "fs";
|
|
24082
24195
|
function logs(options2) {
|
|
24083
24196
|
if (!existsSync50(voicePaths.log)) {
|
|
24084
24197
|
console.log("No voice log file found");
|
|
24085
24198
|
return;
|
|
24086
24199
|
}
|
|
24087
24200
|
const count7 = Number.parseInt(options2.lines ?? "150", 10);
|
|
24088
|
-
const content =
|
|
24201
|
+
const content = readFileSync43(voicePaths.log, "utf8").trim();
|
|
24089
24202
|
if (!content) {
|
|
24090
24203
|
console.log("Voice log is empty");
|
|
24091
24204
|
return;
|
|
@@ -24112,7 +24225,7 @@ import { join as join61 } from "path";
|
|
|
24112
24225
|
|
|
24113
24226
|
// src/commands/voice/checkLockFile.ts
|
|
24114
24227
|
import { execSync as execSync56 } from "child_process";
|
|
24115
|
-
import { existsSync as existsSync51, mkdirSync as mkdirSync20, readFileSync as
|
|
24228
|
+
import { existsSync as existsSync51, mkdirSync as mkdirSync20, readFileSync as readFileSync44, writeFileSync as writeFileSync39 } from "fs";
|
|
24116
24229
|
import { join as join60 } from "path";
|
|
24117
24230
|
function isProcessAlive2(pid) {
|
|
24118
24231
|
try {
|
|
@@ -24126,7 +24239,7 @@ function checkLockFile() {
|
|
|
24126
24239
|
const lockFile = getLockFile();
|
|
24127
24240
|
if (!existsSync51(lockFile)) return;
|
|
24128
24241
|
try {
|
|
24129
|
-
const lock2 = JSON.parse(
|
|
24242
|
+
const lock2 = JSON.parse(readFileSync44(lockFile, "utf8"));
|
|
24130
24243
|
if (lock2.pid && isProcessAlive2(lock2.pid)) {
|
|
24131
24244
|
console.error(
|
|
24132
24245
|
`Voice daemon already running (PID ${lock2.pid}, env: ${lock2.env}). Stop it first with: assist voice stop`
|
|
@@ -24228,7 +24341,7 @@ function start2(options2) {
|
|
|
24228
24341
|
}
|
|
24229
24342
|
|
|
24230
24343
|
// src/commands/voice/status.ts
|
|
24231
|
-
import { existsSync as existsSync52, readFileSync as
|
|
24344
|
+
import { existsSync as existsSync52, readFileSync as readFileSync45 } from "fs";
|
|
24232
24345
|
function isProcessAlive3(pid) {
|
|
24233
24346
|
try {
|
|
24234
24347
|
process.kill(pid, 0);
|
|
@@ -24239,7 +24352,7 @@ function isProcessAlive3(pid) {
|
|
|
24239
24352
|
}
|
|
24240
24353
|
function readRecentLogs(count7) {
|
|
24241
24354
|
if (!existsSync52(voicePaths.log)) return [];
|
|
24242
|
-
const lines =
|
|
24355
|
+
const lines = readFileSync45(voicePaths.log, "utf8").trim().split("\n");
|
|
24243
24356
|
return lines.slice(-count7);
|
|
24244
24357
|
}
|
|
24245
24358
|
function status2() {
|
|
@@ -24247,7 +24360,7 @@ function status2() {
|
|
|
24247
24360
|
console.log("Voice daemon: not running (no PID file)");
|
|
24248
24361
|
return;
|
|
24249
24362
|
}
|
|
24250
|
-
const pid = Number.parseInt(
|
|
24363
|
+
const pid = Number.parseInt(readFileSync45(voicePaths.pid, "utf8").trim(), 10);
|
|
24251
24364
|
const alive = isProcessAlive3(pid);
|
|
24252
24365
|
console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
|
|
24253
24366
|
const recent = readRecentLogs(5);
|
|
@@ -24266,13 +24379,13 @@ function status2() {
|
|
|
24266
24379
|
}
|
|
24267
24380
|
|
|
24268
24381
|
// src/commands/voice/stop.ts
|
|
24269
|
-
import { existsSync as existsSync53, readFileSync as
|
|
24382
|
+
import { existsSync as existsSync53, readFileSync as readFileSync46, unlinkSync as unlinkSync19 } from "fs";
|
|
24270
24383
|
function stop2() {
|
|
24271
24384
|
if (!existsSync53(voicePaths.pid)) {
|
|
24272
24385
|
console.log("Voice daemon is not running (no PID file)");
|
|
24273
24386
|
return;
|
|
24274
24387
|
}
|
|
24275
|
-
const pid = Number.parseInt(
|
|
24388
|
+
const pid = Number.parseInt(readFileSync46(voicePaths.pid, "utf8").trim(), 10);
|
|
24276
24389
|
try {
|
|
24277
24390
|
process.kill(pid, "SIGTERM");
|
|
24278
24391
|
console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
|
|
@@ -24349,7 +24462,7 @@ function registerVoice(program2) {
|
|
|
24349
24462
|
|
|
24350
24463
|
// src/commands/roam/auth.ts
|
|
24351
24464
|
import { randomBytes } from "crypto";
|
|
24352
|
-
import
|
|
24465
|
+
import chalk205 from "chalk";
|
|
24353
24466
|
|
|
24354
24467
|
// src/commands/roam/waitForCallback.ts
|
|
24355
24468
|
import { createServer as createServer3 } from "http";
|
|
@@ -24480,13 +24593,13 @@ async function auth() {
|
|
|
24480
24593
|
saveGlobalConfig(config);
|
|
24481
24594
|
const state = randomBytes(16).toString("hex");
|
|
24482
24595
|
console.log(
|
|
24483
|
-
|
|
24596
|
+
chalk205.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
24484
24597
|
);
|
|
24485
|
-
console.log(
|
|
24486
|
-
console.log(
|
|
24487
|
-
console.log(
|
|
24598
|
+
console.log(chalk205.white("http://localhost:14523/callback\n"));
|
|
24599
|
+
console.log(chalk205.blue("Opening browser for authorization..."));
|
|
24600
|
+
console.log(chalk205.dim("Waiting for authorization callback..."));
|
|
24488
24601
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
24489
|
-
console.log(
|
|
24602
|
+
console.log(chalk205.dim("Exchanging code for tokens..."));
|
|
24490
24603
|
const tokens = await exchangeToken({
|
|
24491
24604
|
code,
|
|
24492
24605
|
clientId,
|
|
@@ -24502,13 +24615,13 @@ async function auth() {
|
|
|
24502
24615
|
};
|
|
24503
24616
|
saveGlobalConfig(config);
|
|
24504
24617
|
console.log(
|
|
24505
|
-
|
|
24618
|
+
chalk205.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
24506
24619
|
);
|
|
24507
24620
|
}
|
|
24508
24621
|
|
|
24509
24622
|
// src/commands/roam/postRoamActivity.ts
|
|
24510
24623
|
import { execFileSync as execFileSync9 } from "child_process";
|
|
24511
|
-
import { readdirSync as readdirSync11, readFileSync as
|
|
24624
|
+
import { readdirSync as readdirSync11, readFileSync as readFileSync47, statSync as statSync9 } from "fs";
|
|
24512
24625
|
import { join as join63 } from "path";
|
|
24513
24626
|
function findPortFile(roamDir) {
|
|
24514
24627
|
let entries;
|
|
@@ -24534,7 +24647,7 @@ function postRoamActivity(app, event) {
|
|
|
24534
24647
|
if (!portFile) return;
|
|
24535
24648
|
let port;
|
|
24536
24649
|
try {
|
|
24537
|
-
port =
|
|
24650
|
+
port = readFileSync47(portFile, "utf8").trim();
|
|
24538
24651
|
} catch {
|
|
24539
24652
|
return;
|
|
24540
24653
|
}
|
|
@@ -25045,7 +25158,7 @@ import { execSync as execSync58 } from "child_process";
|
|
|
25045
25158
|
import { existsSync as existsSync56, mkdirSync as mkdirSync24, unlinkSync as unlinkSync21, writeFileSync as writeFileSync42 } from "fs";
|
|
25046
25159
|
import { tmpdir as tmpdir8 } from "os";
|
|
25047
25160
|
import { join as join67, resolve as resolve17 } from "path";
|
|
25048
|
-
import
|
|
25161
|
+
import chalk206 from "chalk";
|
|
25049
25162
|
|
|
25050
25163
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
25051
25164
|
var captureWindowPs1 = `
|
|
@@ -25196,13 +25309,13 @@ function screenshot(processName) {
|
|
|
25196
25309
|
const config = loadConfig();
|
|
25197
25310
|
const outputDir = resolve17(config.screenshot.outputDir);
|
|
25198
25311
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
25199
|
-
console.log(
|
|
25312
|
+
console.log(chalk206.gray(`Capturing window for process "${processName}" ...`));
|
|
25200
25313
|
try {
|
|
25201
25314
|
runPowerShellScript(processName, outputPath);
|
|
25202
|
-
console.log(
|
|
25315
|
+
console.log(chalk206.green(`Screenshot saved: ${outputPath}`));
|
|
25203
25316
|
} catch (error) {
|
|
25204
25317
|
const msg = error instanceof Error ? error.message : String(error);
|
|
25205
|
-
console.error(
|
|
25318
|
+
console.error(chalk206.red(`Failed to capture screenshot: ${msg}`));
|
|
25206
25319
|
process.exit(1);
|
|
25207
25320
|
}
|
|
25208
25321
|
}
|
|
@@ -25258,7 +25371,7 @@ function applyLine(result, pending, line) {
|
|
|
25258
25371
|
}
|
|
25259
25372
|
|
|
25260
25373
|
// src/commands/sessions/daemon/reportStolenSocket.ts
|
|
25261
|
-
import { readFileSync as
|
|
25374
|
+
import { readFileSync as readFileSync48 } from "fs";
|
|
25262
25375
|
function reportStolenSocket(socketPid) {
|
|
25263
25376
|
if (!socketPid) return;
|
|
25264
25377
|
const filePid = readPidFile();
|
|
@@ -25270,7 +25383,7 @@ function reportStolenSocket(socketPid) {
|
|
|
25270
25383
|
function readPidFile() {
|
|
25271
25384
|
try {
|
|
25272
25385
|
const pid = Number.parseInt(
|
|
25273
|
-
|
|
25386
|
+
readFileSync48(daemonPaths.pid, "utf8").trim(),
|
|
25274
25387
|
10
|
|
25275
25388
|
);
|
|
25276
25389
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -25337,25 +25450,25 @@ function recentDaemonLogLines() {
|
|
|
25337
25450
|
}
|
|
25338
25451
|
|
|
25339
25452
|
// src/commands/sessions/daemon/persistedSessionSchema.ts
|
|
25340
|
-
import { z as
|
|
25341
|
-
var persistedSessionSchema =
|
|
25342
|
-
name:
|
|
25343
|
-
title:
|
|
25344
|
-
subtitle:
|
|
25345
|
-
commandType:
|
|
25346
|
-
harness:
|
|
25347
|
-
status:
|
|
25348
|
-
cwd:
|
|
25349
|
-
startedAt:
|
|
25350
|
-
runningMs:
|
|
25351
|
-
claudeSessionId:
|
|
25352
|
-
initialPrompt:
|
|
25353
|
-
runName:
|
|
25354
|
-
runArgs:
|
|
25355
|
-
assistArgs:
|
|
25453
|
+
import { z as z6 } from "zod";
|
|
25454
|
+
var persistedSessionSchema = z6.object({
|
|
25455
|
+
name: z6.string(),
|
|
25456
|
+
title: z6.string().optional(),
|
|
25457
|
+
subtitle: z6.string().optional(),
|
|
25458
|
+
commandType: z6.enum(["claude", "run", "assist"]),
|
|
25459
|
+
harness: z6.enum(["claude", "codex", "pi"]).optional(),
|
|
25460
|
+
status: z6.enum(["running", "waiting", "done", "error", "stopped"]).optional(),
|
|
25461
|
+
cwd: z6.string(),
|
|
25462
|
+
startedAt: z6.number(),
|
|
25463
|
+
runningMs: z6.number().optional(),
|
|
25464
|
+
claudeSessionId: z6.string().optional(),
|
|
25465
|
+
initialPrompt: z6.string().optional(),
|
|
25466
|
+
runName: z6.string().optional(),
|
|
25467
|
+
runArgs: z6.array(z6.string()).optional(),
|
|
25468
|
+
assistArgs: z6.array(z6.string()).optional(),
|
|
25356
25469
|
activity: activitySchema.optional(),
|
|
25357
|
-
starred:
|
|
25358
|
-
undurable:
|
|
25470
|
+
starred: z6.boolean().optional(),
|
|
25471
|
+
undurable: z6.object({ reason: z6.string(), removesTree: z6.boolean().optional() }).optional()
|
|
25359
25472
|
});
|
|
25360
25473
|
|
|
25361
25474
|
// src/commands/sessions/daemon/toPersistedSession.ts
|
|
@@ -25523,9 +25636,9 @@ function createAutoExit(exit, graceMs = DEFAULT_GRACE_MS) {
|
|
|
25523
25636
|
}
|
|
25524
25637
|
|
|
25525
25638
|
// src/commands/sessions/daemon/loadActiveSelection.ts
|
|
25526
|
-
import { z as
|
|
25639
|
+
import { z as z7 } from "zod";
|
|
25527
25640
|
var ACTIVE_FILE = "active.json";
|
|
25528
|
-
var activeSelectionSchema =
|
|
25641
|
+
var activeSelectionSchema = z7.record(z7.string(), z7.string());
|
|
25529
25642
|
function loadActiveSelection() {
|
|
25530
25643
|
const parsed = activeSelectionSchema.safeParse(
|
|
25531
25644
|
loadJson(ACTIVE_FILE)
|
|
@@ -25732,7 +25845,7 @@ var ClientHub = class extends Set {
|
|
|
25732
25845
|
};
|
|
25733
25846
|
|
|
25734
25847
|
// src/commands/sessions/daemon/createSession.ts
|
|
25735
|
-
import { randomUUID as
|
|
25848
|
+
import { randomUUID as randomUUID6 } from "crypto";
|
|
25736
25849
|
|
|
25737
25850
|
// src/commands/sessions/daemon/resolveRunConfig.ts
|
|
25738
25851
|
function resolveRunConfig(name, cwd) {
|
|
@@ -25871,7 +25984,7 @@ function sessionBase(id, status3) {
|
|
|
25871
25984
|
// src/commands/sessions/daemon/createSession.ts
|
|
25872
25985
|
function createSession(id, prompt, cwd, design, harness, holdPty) {
|
|
25873
25986
|
if (harness === "pi") return createPiSession(id, prompt, cwd, holdPty);
|
|
25874
|
-
const claudeSessionId =
|
|
25987
|
+
const claudeSessionId = randomUUID6();
|
|
25875
25988
|
return {
|
|
25876
25989
|
...sessionBase(id, prompt ? "running" : "waiting"),
|
|
25877
25990
|
name: prompt?.slice(0, 40) || `Session ${id}`,
|
|
@@ -26502,15 +26615,20 @@ function setPrPreview(sessions, waiters, notify2, client, d) {
|
|
|
26502
26615
|
return;
|
|
26503
26616
|
}
|
|
26504
26617
|
const prNumber = typeof d.prNumber === "number" ? d.prNumber : null;
|
|
26618
|
+
const kind = d.kind === "backlog-item" ? "backlog-item" : "pr";
|
|
26619
|
+
const itemType = d.itemType === "bug" ? "bug" : "story";
|
|
26505
26620
|
session.pendingPrPreview = {
|
|
26506
26621
|
requestId: d.requestId,
|
|
26507
26622
|
title: d.title,
|
|
26508
26623
|
body: d.body,
|
|
26509
|
-
prNumber
|
|
26624
|
+
prNumber,
|
|
26625
|
+
kind,
|
|
26626
|
+
itemType: kind === "backlog-item" ? itemType : void 0
|
|
26510
26627
|
};
|
|
26511
26628
|
waiters.set(id, client);
|
|
26629
|
+
const target = kind === "backlog-item" ? `backlog ${itemType}` : prNumber === null ? "create" : `edit #${prNumber}`;
|
|
26512
26630
|
daemonLog(
|
|
26513
|
-
`pr-preview set: id=${id} requestId=${d.requestId}
|
|
26631
|
+
`pr-preview set: id=${id} requestId=${d.requestId} kind=${kind} target=${target}`
|
|
26514
26632
|
);
|
|
26515
26633
|
notify2();
|
|
26516
26634
|
}
|
|
@@ -27036,7 +27154,7 @@ function respawnSession(session, respawn, status3, clients, onStatusChange) {
|
|
|
27036
27154
|
}
|
|
27037
27155
|
|
|
27038
27156
|
// src/commands/sessions/daemon/respawnPlan.ts
|
|
27039
|
-
import { randomUUID as
|
|
27157
|
+
import { randomUUID as randomUUID7 } from "crypto";
|
|
27040
27158
|
|
|
27041
27159
|
// src/commands/sessions/daemon/assistResumeArgs.ts
|
|
27042
27160
|
function assistResumeArgs(session) {
|
|
@@ -27077,7 +27195,7 @@ function respawnPlan(session) {
|
|
|
27077
27195
|
return null;
|
|
27078
27196
|
}
|
|
27079
27197
|
function freshClaudePlan(session, prompt, cwd) {
|
|
27080
|
-
const claudeSessionId =
|
|
27198
|
+
const claudeSessionId = randomUUID7();
|
|
27081
27199
|
return {
|
|
27082
27200
|
spawn: () => {
|
|
27083
27201
|
session.claudeSessionId = claudeSessionId;
|
|
@@ -28197,14 +28315,14 @@ async function defaultConnect() {
|
|
|
28197
28315
|
}
|
|
28198
28316
|
|
|
28199
28317
|
// src/commands/sessions/daemon/hasPersistedWindowsSessions.ts
|
|
28200
|
-
import { existsSync as existsSync69, readFileSync as
|
|
28318
|
+
import { existsSync as existsSync69, readFileSync as readFileSync50 } from "fs";
|
|
28201
28319
|
import { posix } from "path";
|
|
28202
28320
|
function hasPersistedWindowsSessions() {
|
|
28203
28321
|
const sessionsFile = windowsSessionsFileFromWsl();
|
|
28204
28322
|
if (!sessionsFile) return false;
|
|
28205
28323
|
try {
|
|
28206
28324
|
if (!existsSync69(sessionsFile)) return false;
|
|
28207
|
-
const data = JSON.parse(
|
|
28325
|
+
const data = JSON.parse(readFileSync50(sessionsFile, "utf8"));
|
|
28208
28326
|
return Array.isArray(data) && data.length > 0;
|
|
28209
28327
|
} catch (error) {
|
|
28210
28328
|
const message2 = error instanceof Error ? error.message : String(error);
|
|
@@ -29432,7 +29550,7 @@ function handleConnection(socket, manager) {
|
|
|
29432
29550
|
import { unlinkSync as unlinkSync22, writeFileSync as writeFileSync43 } from "fs";
|
|
29433
29551
|
|
|
29434
29552
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
29435
|
-
import { readFileSync as
|
|
29553
|
+
import { readFileSync as readFileSync51 } from "fs";
|
|
29436
29554
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
29437
29555
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
29438
29556
|
const timer = setInterval(() => {
|
|
@@ -29443,7 +29561,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
29443
29561
|
}
|
|
29444
29562
|
function ownsPidFile() {
|
|
29445
29563
|
try {
|
|
29446
|
-
return
|
|
29564
|
+
return readFileSync51(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
29447
29565
|
} catch {
|
|
29448
29566
|
return false;
|
|
29449
29567
|
}
|
|
@@ -29632,7 +29750,7 @@ var sessionsConfigHelp = [
|
|
|
29632
29750
|
|
|
29633
29751
|
// src/commands/sessions/summarise/index.ts
|
|
29634
29752
|
import * as fs41 from "fs";
|
|
29635
|
-
import
|
|
29753
|
+
import chalk207 from "chalk";
|
|
29636
29754
|
|
|
29637
29755
|
// src/commands/sessions/summarise/shared.ts
|
|
29638
29756
|
import * as fs40 from "fs";
|
|
@@ -29706,22 +29824,22 @@ ${firstMessage}`);
|
|
|
29706
29824
|
async function summarise2(options2) {
|
|
29707
29825
|
const files = await discoverSessionFiles();
|
|
29708
29826
|
if (files.length === 0) {
|
|
29709
|
-
console.log(
|
|
29827
|
+
console.log(chalk207.yellow("No sessions found."));
|
|
29710
29828
|
return;
|
|
29711
29829
|
}
|
|
29712
29830
|
const toProcess = selectCandidates(files, options2);
|
|
29713
29831
|
if (toProcess.length === 0) {
|
|
29714
|
-
console.log(
|
|
29832
|
+
console.log(chalk207.green("All sessions already summarised."));
|
|
29715
29833
|
return;
|
|
29716
29834
|
}
|
|
29717
29835
|
console.log(
|
|
29718
|
-
|
|
29836
|
+
chalk207.cyan(
|
|
29719
29837
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
29720
29838
|
)
|
|
29721
29839
|
);
|
|
29722
29840
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
29723
29841
|
console.log(
|
|
29724
|
-
|
|
29842
|
+
chalk207.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk207.yellow(`, ${failed2} skipped`) : "")
|
|
29725
29843
|
);
|
|
29726
29844
|
}
|
|
29727
29845
|
function selectCandidates(files, options2) {
|
|
@@ -29741,16 +29859,16 @@ function processSessions(files) {
|
|
|
29741
29859
|
let failed2 = 0;
|
|
29742
29860
|
for (let i = 0; i < files.length; i++) {
|
|
29743
29861
|
const file = files[i];
|
|
29744
|
-
process.stdout.write(
|
|
29862
|
+
process.stdout.write(chalk207.dim(` [${i + 1}/${files.length}] `));
|
|
29745
29863
|
const summary = summariseSession(file);
|
|
29746
29864
|
if (summary) {
|
|
29747
29865
|
writeSummary(file, summary);
|
|
29748
29866
|
succeeded++;
|
|
29749
|
-
process.stdout.write(`${
|
|
29867
|
+
process.stdout.write(`${chalk207.green("\u2713")} ${summary}
|
|
29750
29868
|
`);
|
|
29751
29869
|
} else {
|
|
29752
29870
|
failed2++;
|
|
29753
|
-
process.stdout.write(` ${
|
|
29871
|
+
process.stdout.write(` ${chalk207.yellow("skip")}
|
|
29754
29872
|
`);
|
|
29755
29873
|
}
|
|
29756
29874
|
}
|
|
@@ -29771,7 +29889,7 @@ function registerSessions(program2) {
|
|
|
29771
29889
|
}
|
|
29772
29890
|
|
|
29773
29891
|
// src/commands/statusLine.ts
|
|
29774
|
-
import
|
|
29892
|
+
import chalk209 from "chalk";
|
|
29775
29893
|
|
|
29776
29894
|
// src/shared/contextLevel.ts
|
|
29777
29895
|
function contextLevel(pct) {
|
|
@@ -29781,7 +29899,7 @@ function contextLevel(pct) {
|
|
|
29781
29899
|
}
|
|
29782
29900
|
|
|
29783
29901
|
// src/commands/buildLimitsSegment.ts
|
|
29784
|
-
import
|
|
29902
|
+
import chalk208 from "chalk";
|
|
29785
29903
|
|
|
29786
29904
|
// src/shared/rateLimitLevel.ts
|
|
29787
29905
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -29812,9 +29930,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
29812
29930
|
|
|
29813
29931
|
// src/commands/buildLimitsSegment.ts
|
|
29814
29932
|
var LEVEL_COLOR = {
|
|
29815
|
-
ok:
|
|
29816
|
-
warn:
|
|
29817
|
-
over:
|
|
29933
|
+
ok: chalk208.green,
|
|
29934
|
+
warn: chalk208.yellow,
|
|
29935
|
+
over: chalk208.red
|
|
29818
29936
|
};
|
|
29819
29937
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
29820
29938
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -29845,7 +29963,7 @@ function buildLimitsSegment(rateLimits) {
|
|
|
29845
29963
|
}
|
|
29846
29964
|
|
|
29847
29965
|
// src/commands/readGitBranch.ts
|
|
29848
|
-
import { readFileSync as
|
|
29966
|
+
import { readFileSync as readFileSync53, statSync as statSync12 } from "fs";
|
|
29849
29967
|
import { isAbsolute as isAbsolute3, join as join73, resolve as resolve18 } from "path";
|
|
29850
29968
|
function resolveGitDir(cwd) {
|
|
29851
29969
|
const dotGit = join73(cwd, ".git");
|
|
@@ -29860,7 +29978,7 @@ function resolveGitDir(cwd) {
|
|
|
29860
29978
|
}
|
|
29861
29979
|
let contents;
|
|
29862
29980
|
try {
|
|
29863
|
-
contents =
|
|
29981
|
+
contents = readFileSync53(dotGit, "utf8");
|
|
29864
29982
|
} catch {
|
|
29865
29983
|
return null;
|
|
29866
29984
|
}
|
|
@@ -29878,7 +29996,7 @@ function readGitBranch(cwd) {
|
|
|
29878
29996
|
}
|
|
29879
29997
|
let head;
|
|
29880
29998
|
try {
|
|
29881
|
-
head =
|
|
29999
|
+
head = readFileSync53(join73(gitDir, "HEAD"), "utf8");
|
|
29882
30000
|
} catch {
|
|
29883
30001
|
return null;
|
|
29884
30002
|
}
|
|
@@ -29910,7 +30028,7 @@ async function relayUsage(claudeSessionId, transcriptPath, usedPct) {
|
|
|
29910
30028
|
}
|
|
29911
30029
|
|
|
29912
30030
|
// src/commands/statusLine.ts
|
|
29913
|
-
|
|
30031
|
+
chalk209.level = 3;
|
|
29914
30032
|
function formatNumber(num) {
|
|
29915
30033
|
return num.toLocaleString("en-US");
|
|
29916
30034
|
}
|
|
@@ -29918,9 +30036,9 @@ function colorizePercent(pct) {
|
|
|
29918
30036
|
const label2 = `${Math.round(pct)}%`;
|
|
29919
30037
|
switch (contextLevel(pct)) {
|
|
29920
30038
|
case "red":
|
|
29921
|
-
return
|
|
30039
|
+
return chalk209.red(label2);
|
|
29922
30040
|
case "yellow":
|
|
29923
|
-
return
|
|
30041
|
+
return chalk209.yellow(label2);
|
|
29924
30042
|
default:
|
|
29925
30043
|
return label2;
|
|
29926
30044
|
}
|
|
@@ -29933,7 +30051,7 @@ async function statusLine() {
|
|
|
29933
30051
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
29934
30052
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
29935
30053
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
29936
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
30054
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk209.cyan(branch2)} | ` : "";
|
|
29937
30055
|
console.log(
|
|
29938
30056
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
29939
30057
|
);
|
|
@@ -29954,14 +30072,14 @@ import { fileURLToPath as fileURLToPath9 } from "url";
|
|
|
29954
30072
|
// src/commands/sync/syncClaudeMd.ts
|
|
29955
30073
|
import * as fs42 from "fs";
|
|
29956
30074
|
import * as path61 from "path";
|
|
29957
|
-
import
|
|
30075
|
+
import chalk211 from "chalk";
|
|
29958
30076
|
|
|
29959
30077
|
// src/commands/sync/printAutoConfirmHint.ts
|
|
29960
|
-
import
|
|
30078
|
+
import chalk210 from "chalk";
|
|
29961
30079
|
var autoConfirmHintCommand = "assist config set sync.autoConfirm true --global";
|
|
29962
30080
|
function printAutoConfirmHint() {
|
|
29963
30081
|
console.log(
|
|
29964
|
-
|
|
30082
|
+
chalk210.dim(
|
|
29965
30083
|
`Tip: run \`${autoConfirmHintCommand}\` to overwrite automatically next time`
|
|
29966
30084
|
)
|
|
29967
30085
|
);
|
|
@@ -29977,14 +30095,14 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
29977
30095
|
const targetContent = fs42.readFileSync(target, "utf8");
|
|
29978
30096
|
if (sourceContent !== targetContent) {
|
|
29979
30097
|
console.log(
|
|
29980
|
-
|
|
30098
|
+
chalk211.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
29981
30099
|
);
|
|
29982
30100
|
console.log();
|
|
29983
30101
|
printDiff(targetContent, sourceContent);
|
|
29984
30102
|
if (!options2?.yes) {
|
|
29985
30103
|
printAutoConfirmHint();
|
|
29986
30104
|
const confirm = await promptConfirm(
|
|
29987
|
-
|
|
30105
|
+
chalk211.red("Overwrite existing CLAUDE.md?"),
|
|
29988
30106
|
false
|
|
29989
30107
|
);
|
|
29990
30108
|
if (!confirm) {
|
|
@@ -30179,7 +30297,7 @@ function syncPi(claudeDir) {
|
|
|
30179
30297
|
// src/commands/sync/syncSettings.ts
|
|
30180
30298
|
import * as fs47 from "fs";
|
|
30181
30299
|
import * as path68 from "path";
|
|
30182
|
-
import
|
|
30300
|
+
import chalk212 from "chalk";
|
|
30183
30301
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
30184
30302
|
const source = path68.join(claudeDir, "settings.json");
|
|
30185
30303
|
const target = path68.join(targetBase, "settings.json");
|
|
@@ -30198,7 +30316,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
30198
30316
|
if (mergedContent !== normalizedTarget) {
|
|
30199
30317
|
if (!options2?.yes) {
|
|
30200
30318
|
console.log(
|
|
30201
|
-
|
|
30319
|
+
chalk212.yellow(
|
|
30202
30320
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
30203
30321
|
)
|
|
30204
30322
|
);
|
|
@@ -30206,7 +30324,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
30206
30324
|
printDiff(targetContent, mergedContent);
|
|
30207
30325
|
printAutoConfirmHint();
|
|
30208
30326
|
const confirm = await promptConfirm(
|
|
30209
|
-
|
|
30327
|
+
chalk212.red("Overwrite existing settings.json?"),
|
|
30210
30328
|
false
|
|
30211
30329
|
);
|
|
30212
30330
|
if (!confirm) {
|
|
@@ -30305,10 +30423,10 @@ async function update2() {
|
|
|
30305
30423
|
}
|
|
30306
30424
|
|
|
30307
30425
|
// src/reportCliError.ts
|
|
30308
|
-
import
|
|
30426
|
+
import chalk213 from "chalk";
|
|
30309
30427
|
function reportCliError(error) {
|
|
30310
30428
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError) {
|
|
30311
|
-
console.error(
|
|
30429
|
+
console.error(chalk213.red(error.message));
|
|
30312
30430
|
} else {
|
|
30313
30431
|
console.error(error);
|
|
30314
30432
|
}
|