@staff0rd/assist 0.827.1 → 0.827.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/claude/skills/review-ci/scripts/review.mjs +1 -1
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +704 -666
- 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.827.
|
|
9
|
+
version: "0.827.2",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -280,9 +280,9 @@ function findGitLink(dir) {
|
|
|
280
280
|
}
|
|
281
281
|
return null;
|
|
282
282
|
}
|
|
283
|
-
function isFile(
|
|
283
|
+
function isFile(path109) {
|
|
284
284
|
try {
|
|
285
|
-
return statSync(
|
|
285
|
+
return statSync(path109).isFile();
|
|
286
286
|
} catch {
|
|
287
287
|
return false;
|
|
288
288
|
}
|
|
@@ -301,9 +301,9 @@ function linkedGitDirParent(gitDir) {
|
|
|
301
301
|
const match = /^(.*)[/\\]worktrees[/\\][^/\\]+[/\\]?$/.exec(gitDir);
|
|
302
302
|
return match ? match[1] : null;
|
|
303
303
|
}
|
|
304
|
-
function readTrimmed(
|
|
304
|
+
function readTrimmed(path109) {
|
|
305
305
|
try {
|
|
306
|
-
const content = readFileSync2(
|
|
306
|
+
const content = readFileSync2(path109, "utf8").trim();
|
|
307
307
|
return content === "" ? null : content;
|
|
308
308
|
} catch {
|
|
309
309
|
return null;
|
|
@@ -316,10 +316,10 @@ function absolute(target, from) {
|
|
|
316
316
|
// src/shared/loadRawYaml.ts
|
|
317
317
|
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
|
|
318
318
|
import { parse as parseYaml } from "yaml";
|
|
319
|
-
function loadRawYaml(
|
|
320
|
-
if (!existsSync3(
|
|
319
|
+
function loadRawYaml(path109) {
|
|
320
|
+
if (!existsSync3(path109)) return {};
|
|
321
321
|
try {
|
|
322
|
-
const content = readFileSync3(
|
|
322
|
+
const content = readFileSync3(path109, "utf8");
|
|
323
323
|
return parseYaml(content) || {};
|
|
324
324
|
} catch {
|
|
325
325
|
return {};
|
|
@@ -430,8 +430,8 @@ function getRemoteOriginUrl(cwd) {
|
|
|
430
430
|
}
|
|
431
431
|
|
|
432
432
|
// src/commands/backlog/getCurrentOrigin.ts
|
|
433
|
-
function stripLeadingSlashes(
|
|
434
|
-
return
|
|
433
|
+
function stripLeadingSlashes(path109) {
|
|
434
|
+
return path109.replace(/^\/+/, "");
|
|
435
435
|
}
|
|
436
436
|
function normalizeOrigin(raw) {
|
|
437
437
|
const trimmed = raw.trim().replace(/\.git$/i, "").replace(/\/+$/, "");
|
|
@@ -474,10 +474,10 @@ function getStorePath(filename) {
|
|
|
474
474
|
return join3(getStoreDir(), filename);
|
|
475
475
|
}
|
|
476
476
|
function loadJson(filename) {
|
|
477
|
-
const
|
|
478
|
-
if (existsSync4(
|
|
477
|
+
const path109 = getStorePath(filename);
|
|
478
|
+
if (existsSync4(path109)) {
|
|
479
479
|
try {
|
|
480
|
-
return JSON.parse(readFileSync4(
|
|
480
|
+
return JSON.parse(readFileSync4(path109, "utf8"));
|
|
481
481
|
} catch {
|
|
482
482
|
return {};
|
|
483
483
|
}
|
|
@@ -497,10 +497,10 @@ function repoConfigCachePath() {
|
|
|
497
497
|
return join4(getStoreDir(), "repo-config-cache.json");
|
|
498
498
|
}
|
|
499
499
|
function readRepoConfigCache() {
|
|
500
|
-
const
|
|
501
|
-
if (!existsSync5(
|
|
500
|
+
const path109 = repoConfigCachePath();
|
|
501
|
+
if (!existsSync5(path109)) return {};
|
|
502
502
|
try {
|
|
503
|
-
const parsed = JSON.parse(readFileSync5(
|
|
503
|
+
const parsed = JSON.parse(readFileSync5(path109, "utf8"));
|
|
504
504
|
return parsed?.repos ?? {};
|
|
505
505
|
} catch {
|
|
506
506
|
return {};
|
|
@@ -510,8 +510,8 @@ function readRepoConfigCache() {
|
|
|
510
510
|
// src/commands/backlog/originDisplayName.ts
|
|
511
511
|
function originDisplayName(origin) {
|
|
512
512
|
if (origin.startsWith("local:")) {
|
|
513
|
-
const
|
|
514
|
-
const segments =
|
|
513
|
+
const path109 = origin.slice("local:".length).replace(/\/+$/, "");
|
|
514
|
+
const segments = path109.split("/").filter(Boolean);
|
|
515
515
|
return segments[segments.length - 1] ?? origin;
|
|
516
516
|
}
|
|
517
517
|
const firstSlash = origin.indexOf("/");
|
|
@@ -911,7 +911,8 @@ var assistConfigShape = {
|
|
|
911
911
|
restructure: z5.strictObject({
|
|
912
912
|
ignore: z5.array(z5.string()).default([]),
|
|
913
913
|
pin: z5.array(z5.string()).default([]),
|
|
914
|
-
maxDepth: z5.number().int().positive().default(10)
|
|
914
|
+
maxDepth: z5.number().int().positive().default(10),
|
|
915
|
+
maxPathLength: z5.number().int().positive().default(200)
|
|
915
916
|
}).optional(),
|
|
916
917
|
jira: z5.strictObject({
|
|
917
918
|
acField: z5.string().default("customfield_11937")
|
|
@@ -3260,9 +3261,9 @@ function readSocketLines(socket, onLine) {
|
|
|
3260
3261
|
function toAttachments(value) {
|
|
3261
3262
|
if (!Array.isArray(value)) return void 0;
|
|
3262
3263
|
return value.flatMap((entry) => {
|
|
3263
|
-
const { path:
|
|
3264
|
-
if (typeof
|
|
3265
|
-
const attachment = { path:
|
|
3264
|
+
const { path: path109, alt, group } = entry ?? {};
|
|
3265
|
+
if (typeof path109 !== "string" || path109 === "") return [];
|
|
3266
|
+
const attachment = { path: path109, alt: typeof alt === "string" ? alt : "" };
|
|
3266
3267
|
return [
|
|
3267
3268
|
typeof group === "string" && group !== "" ? { ...attachment, group } : attachment
|
|
3268
3269
|
];
|
|
@@ -4906,8 +4907,8 @@ function getPreferredRemoteRepo(cwd) {
|
|
|
4906
4907
|
function gitRefUrl(kind, ref, cwd) {
|
|
4907
4908
|
const repo = getPreferredRemoteRepo(cwd);
|
|
4908
4909
|
if (!repo) return void 0;
|
|
4909
|
-
const
|
|
4910
|
-
return `https://github.com/${repo.org}/${repo.repo}/${
|
|
4910
|
+
const path109 = kind === "branch" ? "tree" : "commit";
|
|
4911
|
+
return `https://github.com/${repo.org}/${repo.repo}/${path109}/${ref}`;
|
|
4911
4912
|
}
|
|
4912
4913
|
|
|
4913
4914
|
// src/commands/sessions/shared/resolveSessionTranscript.ts
|
|
@@ -5068,9 +5069,9 @@ var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
|
|
|
5068
5069
|
function backupLocalBacklogFiles(dir) {
|
|
5069
5070
|
const moved = [];
|
|
5070
5071
|
for (const name of LOCAL_FILES) {
|
|
5071
|
-
const
|
|
5072
|
-
if (existsSync22(
|
|
5073
|
-
renameSync(
|
|
5072
|
+
const path109 = join23(dir, ".assist", name);
|
|
5073
|
+
if (existsSync22(path109)) {
|
|
5074
|
+
renameSync(path109, `${path109}.bak`);
|
|
5074
5075
|
moved.push(`${name} \u2192 ${name}.bak`);
|
|
5075
5076
|
}
|
|
5076
5077
|
}
|
|
@@ -5554,8 +5555,8 @@ var backlogItemSchema = z6.strictObject({
|
|
|
5554
5555
|
var backlogFileSchema = z6.array(backlogItemSchema);
|
|
5555
5556
|
|
|
5556
5557
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
5557
|
-
function parseBacklogJsonl(
|
|
5558
|
-
const content = readFileSync15(
|
|
5558
|
+
function parseBacklogJsonl(path109) {
|
|
5559
|
+
const content = readFileSync15(path109, "utf8").trim();
|
|
5559
5560
|
if (content.length === 0) return [];
|
|
5560
5561
|
return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
|
|
5561
5562
|
}
|
|
@@ -6101,9 +6102,9 @@ function originToSshUrl(origin) {
|
|
|
6101
6102
|
const firstSlash = origin.indexOf("/");
|
|
6102
6103
|
if (firstSlash <= 0) return null;
|
|
6103
6104
|
const host = origin.slice(0, firstSlash);
|
|
6104
|
-
const
|
|
6105
|
-
if (!
|
|
6106
|
-
return `git@${host}:${
|
|
6105
|
+
const path109 = origin.slice(firstSlash + 1);
|
|
6106
|
+
if (!path109) return null;
|
|
6107
|
+
return `git@${host}:${path109}.git`;
|
|
6107
6108
|
}
|
|
6108
6109
|
|
|
6109
6110
|
// src/commands/backlog/cloneRepo.ts
|
|
@@ -7860,10 +7861,10 @@ var hooksSettings = {
|
|
|
7860
7861
|
}
|
|
7861
7862
|
};
|
|
7862
7863
|
function ensureHooksSettings() {
|
|
7863
|
-
const
|
|
7864
|
-
mkdirSync6(dirname15(
|
|
7865
|
-
writeFileSync17(
|
|
7866
|
-
return
|
|
7864
|
+
const path109 = daemonPaths.hooksSettings;
|
|
7865
|
+
mkdirSync6(dirname15(path109), { recursive: true });
|
|
7866
|
+
writeFileSync17(path109, JSON.stringify(hooksSettings, null, 2));
|
|
7867
|
+
return path109;
|
|
7867
7868
|
}
|
|
7868
7869
|
|
|
7869
7870
|
// src/shared/spawnInherit.ts
|
|
@@ -8630,24 +8631,24 @@ function getOwnerPath(itemId2) {
|
|
|
8630
8631
|
function recordSignalOwner(itemId2) {
|
|
8631
8632
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
8632
8633
|
if (!sessionId) return;
|
|
8633
|
-
const
|
|
8634
|
-
mkdirSync8(dirname16(
|
|
8635
|
-
writeFileSync19(
|
|
8634
|
+
const path109 = getOwnerPath(itemId2);
|
|
8635
|
+
mkdirSync8(dirname16(path109), { recursive: true });
|
|
8636
|
+
writeFileSync19(path109, JSON.stringify({ sessionId }));
|
|
8636
8637
|
}
|
|
8637
8638
|
function readSignalOwner(itemId2) {
|
|
8638
|
-
const
|
|
8639
|
-
if (!existsSync28(
|
|
8639
|
+
const path109 = getOwnerPath(itemId2);
|
|
8640
|
+
if (!existsSync28(path109)) return void 0;
|
|
8640
8641
|
try {
|
|
8641
|
-
const parsed = JSON.parse(readFileSync20(
|
|
8642
|
+
const parsed = JSON.parse(readFileSync20(path109, "utf8"));
|
|
8642
8643
|
return parsed.sessionId;
|
|
8643
8644
|
} catch {
|
|
8644
8645
|
return void 0;
|
|
8645
8646
|
}
|
|
8646
8647
|
}
|
|
8647
8648
|
function clearSignalOwner(itemId2) {
|
|
8648
|
-
const
|
|
8649
|
+
const path109 = getOwnerPath(itemId2);
|
|
8649
8650
|
try {
|
|
8650
|
-
rmSync(
|
|
8651
|
+
rmSync(path109);
|
|
8651
8652
|
} catch {
|
|
8652
8653
|
}
|
|
8653
8654
|
}
|
|
@@ -8684,19 +8685,19 @@ function resolveSignalTarget(event, data) {
|
|
|
8684
8685
|
function writeSignal(event, data) {
|
|
8685
8686
|
const target = resolveSignalTarget(event, data);
|
|
8686
8687
|
if (!target) return;
|
|
8687
|
-
const
|
|
8688
|
-
if (!
|
|
8688
|
+
const path109 = getSignalPath(target);
|
|
8689
|
+
if (!path109) return;
|
|
8689
8690
|
const signal = { event, sessionId: target, ...data };
|
|
8690
|
-
mkdirSync9(dirname17(
|
|
8691
|
-
writeFileSync20(
|
|
8691
|
+
mkdirSync9(dirname17(path109), { recursive: true });
|
|
8692
|
+
writeFileSync20(path109, JSON.stringify(signal));
|
|
8692
8693
|
}
|
|
8693
8694
|
|
|
8694
8695
|
// src/commands/backlog/readSignal.ts
|
|
8695
8696
|
function readSignal() {
|
|
8696
|
-
const
|
|
8697
|
-
if (!
|
|
8697
|
+
const path109 = getSignalPath();
|
|
8698
|
+
if (!path109 || !existsSync29(path109)) return void 0;
|
|
8698
8699
|
try {
|
|
8699
|
-
return JSON.parse(readFileSync21(
|
|
8700
|
+
return JSON.parse(readFileSync21(path109, "utf8"));
|
|
8700
8701
|
} catch {
|
|
8701
8702
|
return void 0;
|
|
8702
8703
|
}
|
|
@@ -8895,13 +8896,13 @@ function activityPath(sessionId) {
|
|
|
8895
8896
|
function emitActivity(activity2) {
|
|
8896
8897
|
const sessionId = process.env.ASSIST_ACTIVITY_ID;
|
|
8897
8898
|
if (!sessionId) return;
|
|
8898
|
-
const
|
|
8899
|
-
mkdirSync10(dirname18(
|
|
8900
|
-
writeFileSync21(
|
|
8899
|
+
const path109 = activityPath(sessionId);
|
|
8900
|
+
mkdirSync10(dirname18(path109), { recursive: true });
|
|
8901
|
+
writeFileSync21(path109, JSON.stringify({ ...activity2, startedAt: Date.now() }));
|
|
8901
8902
|
}
|
|
8902
|
-
function readActivity(
|
|
8903
|
+
function readActivity(path109) {
|
|
8903
8904
|
try {
|
|
8904
|
-
return JSON.parse(readFileSync22(
|
|
8905
|
+
return JSON.parse(readFileSync22(path109, "utf8"));
|
|
8905
8906
|
} catch {
|
|
8906
8907
|
return void 0;
|
|
8907
8908
|
}
|
|
@@ -8911,9 +8912,9 @@ function reconcileActivity(sessionId, activity2) {
|
|
|
8911
8912
|
removeActivity(sessionId);
|
|
8912
8913
|
return;
|
|
8913
8914
|
}
|
|
8914
|
-
const
|
|
8915
|
-
mkdirSync10(dirname18(
|
|
8916
|
-
writeFileSync21(
|
|
8915
|
+
const path109 = activityPath(sessionId);
|
|
8916
|
+
mkdirSync10(dirname18(path109), { recursive: true });
|
|
8917
|
+
writeFileSync21(path109, JSON.stringify(activity2));
|
|
8917
8918
|
}
|
|
8918
8919
|
function removeActivity(sessionId) {
|
|
8919
8920
|
try {
|
|
@@ -11213,10 +11214,10 @@ function sweepStagedAttachments(dir = stagedAttachmentsDir, now = Date.now()) {
|
|
|
11213
11214
|
}
|
|
11214
11215
|
for (const name of entries) {
|
|
11215
11216
|
if (!name.startsWith("upload-")) continue;
|
|
11216
|
-
const
|
|
11217
|
+
const path109 = join39(dir, name);
|
|
11217
11218
|
try {
|
|
11218
|
-
if (now - statSync3(
|
|
11219
|
-
rmSync3(
|
|
11219
|
+
if (now - statSync3(path109).mtimeMs > PANE_PERSIST_TTL_MS)
|
|
11220
|
+
rmSync3(path109, { recursive: true, force: true });
|
|
11220
11221
|
} catch {
|
|
11221
11222
|
}
|
|
11222
11223
|
}
|
|
@@ -12143,10 +12144,10 @@ function completeLines(text18, windowIsPartial) {
|
|
|
12143
12144
|
if (windowIsPartial) all.shift();
|
|
12144
12145
|
return all;
|
|
12145
12146
|
}
|
|
12146
|
-
function readLogTail(
|
|
12147
|
+
function readLogTail(path109, lines2) {
|
|
12147
12148
|
let fd;
|
|
12148
12149
|
try {
|
|
12149
|
-
fd = openSync4(
|
|
12150
|
+
fd = openSync4(path109, "r");
|
|
12150
12151
|
} catch {
|
|
12151
12152
|
return [];
|
|
12152
12153
|
}
|
|
@@ -12411,8 +12412,8 @@ async function loadCommittedPaths(cwd, sessionId) {
|
|
|
12411
12412
|
for (const commit2 of commits2) {
|
|
12412
12413
|
const resolved = await resolveCommit(cwd, commit2.sha);
|
|
12413
12414
|
if (!resolved) continue;
|
|
12414
|
-
for (const
|
|
12415
|
-
if (!bases.has(
|
|
12415
|
+
for (const path109 of resolved.paths) {
|
|
12416
|
+
if (!bases.has(path109)) bases.set(path109, resolved.base);
|
|
12416
12417
|
}
|
|
12417
12418
|
}
|
|
12418
12419
|
return { commits: commits2, bases };
|
|
@@ -12430,16 +12431,16 @@ async function itemChangeSet(cwd, sessionId) {
|
|
|
12430
12431
|
}
|
|
12431
12432
|
function groupByBase(bases) {
|
|
12432
12433
|
const groups = /* @__PURE__ */ new Map();
|
|
12433
|
-
for (const [
|
|
12434
|
+
for (const [path109, base] of bases) {
|
|
12434
12435
|
const paths = groups.get(base);
|
|
12435
|
-
if (paths) paths.push(
|
|
12436
|
-
else groups.set(base, [
|
|
12436
|
+
if (paths) paths.push(path109);
|
|
12437
|
+
else groups.set(base, [path109]);
|
|
12437
12438
|
}
|
|
12438
12439
|
return [...groups].map(([base, paths]) => ({ base, paths: paths.sort() }));
|
|
12439
12440
|
}
|
|
12440
12441
|
async function dirtyPaths(cwd, bases) {
|
|
12441
12442
|
const output = await execGit(cwd, ["diff", "--name-only", "HEAD"]);
|
|
12442
|
-
return output.split("\n").filter((
|
|
12443
|
+
return output.split("\n").filter((path109) => path109 && !bases.has(path109)).sort();
|
|
12443
12444
|
}
|
|
12444
12445
|
|
|
12445
12446
|
// src/commands/sessions/web/scopedDiff.ts
|
|
@@ -12448,8 +12449,8 @@ async function scopedDiff(cwd, session, scope) {
|
|
|
12448
12449
|
if (scope.kind === "commit") return commitDiff(cwd, scope.sha);
|
|
12449
12450
|
return await trackedScopeDiff(cwd, session, scope) + await untrackedDiff(cwd);
|
|
12450
12451
|
}
|
|
12451
|
-
async function untrackedFileDiff(cwd,
|
|
12452
|
-
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null",
|
|
12452
|
+
async function untrackedFileDiff(cwd, path109) {
|
|
12453
|
+
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path109], {
|
|
12453
12454
|
maxBuffer: MAX_DIFF_BYTES,
|
|
12454
12455
|
allowFailure: true
|
|
12455
12456
|
});
|
|
@@ -12462,7 +12463,7 @@ async function untrackedDiff(cwd) {
|
|
|
12462
12463
|
]);
|
|
12463
12464
|
const paths = list5.split("\n").filter(Boolean);
|
|
12464
12465
|
const diffs = await Promise.all(
|
|
12465
|
-
paths.map((
|
|
12466
|
+
paths.map((path109) => untrackedFileDiff(cwd, path109))
|
|
12466
12467
|
);
|
|
12467
12468
|
return diffs.join("");
|
|
12468
12469
|
}
|
|
@@ -12555,9 +12556,9 @@ import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve11
|
|
|
12555
12556
|
function repoRoot(cwd) {
|
|
12556
12557
|
return resolve11(cwd);
|
|
12557
12558
|
}
|
|
12558
|
-
function resolveWithinCwd(cwd,
|
|
12559
|
+
function resolveWithinCwd(cwd, path109) {
|
|
12559
12560
|
const root2 = repoRoot(cwd);
|
|
12560
|
-
const target = resolve11(root2,
|
|
12561
|
+
const target = resolve11(root2, path109);
|
|
12561
12562
|
const rel = relative2(root2, target);
|
|
12562
12563
|
if (rel === "" || rel.startsWith("..") || isAbsolute2(rel)) return null;
|
|
12563
12564
|
return target;
|
|
@@ -12567,14 +12568,14 @@ function resolveWithinCwd(cwd, path108) {
|
|
|
12567
12568
|
function getFileTarget(req, res) {
|
|
12568
12569
|
const cwd = getCwdParam(req, res);
|
|
12569
12570
|
if (!cwd) return null;
|
|
12570
|
-
const
|
|
12571
|
+
const path109 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
|
|
12571
12572
|
"path"
|
|
12572
12573
|
);
|
|
12573
|
-
if (!
|
|
12574
|
+
if (!path109) {
|
|
12574
12575
|
respondJson(res, 400, { error: "Missing path" });
|
|
12575
12576
|
return null;
|
|
12576
12577
|
}
|
|
12577
|
-
const target = resolveWithinCwd(cwd,
|
|
12578
|
+
const target = resolveWithinCwd(cwd, path109);
|
|
12578
12579
|
if (!target) {
|
|
12579
12580
|
respondJson(res, 400, { error: "Path outside cwd" });
|
|
12580
12581
|
return null;
|
|
@@ -12633,9 +12634,9 @@ function segmentText(segment) {
|
|
|
12633
12634
|
if (segment.kind === "index") return `[${segment.index}]`;
|
|
12634
12635
|
return "[]";
|
|
12635
12636
|
}
|
|
12636
|
-
function formatConfigPath(
|
|
12637
|
+
function formatConfigPath(path109) {
|
|
12637
12638
|
let text18 = "";
|
|
12638
|
-
for (const segment of
|
|
12639
|
+
for (const segment of path109) {
|
|
12639
12640
|
const dotted = segment.kind === "key" || segment.kind === "entry";
|
|
12640
12641
|
const rendered = segmentText(segment);
|
|
12641
12642
|
text18 += dotted && text18 ? `.${rendered}` : rendered;
|
|
@@ -12796,11 +12797,11 @@ function enumValues(node) {
|
|
|
12796
12797
|
function opaqueConfigNode(inner, base) {
|
|
12797
12798
|
return { ...base, kind: "other", type: leafTypeOf(inner) };
|
|
12798
12799
|
}
|
|
12799
|
-
function build(node,
|
|
12800
|
+
function build(node, path109) {
|
|
12800
12801
|
const { inner, defaultValue, optional } = unwrapSchemaNode(node);
|
|
12801
12802
|
const secret = isSecretSchemaNode(node) || isSecretSchemaNode(inner);
|
|
12802
12803
|
const base = {
|
|
12803
|
-
path:
|
|
12804
|
+
path: path109,
|
|
12804
12805
|
...optional ? { optional: true } : {},
|
|
12805
12806
|
...defaultValue === void 0 ? {} : { defaultValue },
|
|
12806
12807
|
...secret ? { secret: true } : {}
|
|
@@ -12856,11 +12857,11 @@ function describeConfigLeaves(schema2) {
|
|
|
12856
12857
|
|
|
12857
12858
|
// src/commands/config/globalConfigFileLabel.ts
|
|
12858
12859
|
var WINDOWS_MOUNT_PREFIX = "/mnt/";
|
|
12859
|
-
function globalConfigFileLabel(
|
|
12860
|
-
if (
|
|
12861
|
-
if (
|
|
12862
|
-
return `${
|
|
12863
|
-
return
|
|
12860
|
+
function globalConfigFileLabel(path109) {
|
|
12861
|
+
if (path109 === getGlobalConfigPath()) return "~/.assist.yml";
|
|
12862
|
+
if (path109.startsWith(WINDOWS_MOUNT_PREFIX))
|
|
12863
|
+
return `${path109} on the Windows host`;
|
|
12864
|
+
return path109;
|
|
12864
12865
|
}
|
|
12865
12866
|
|
|
12866
12867
|
// src/commands/config/readRawConfigLayers.ts
|
|
@@ -12912,35 +12913,35 @@ function isPlainRecord(value) {
|
|
|
12912
12913
|
}
|
|
12913
12914
|
|
|
12914
12915
|
// src/shared/mapConfigSecrets.ts
|
|
12915
|
-
function mapChildren(value,
|
|
12916
|
+
function mapChildren(value, path109, childNode, map) {
|
|
12916
12917
|
if (!isPlainRecord(value)) return value;
|
|
12917
12918
|
return Object.fromEntries(
|
|
12918
12919
|
Object.entries(value).map(([name, child]) => [
|
|
12919
12920
|
name,
|
|
12920
|
-
walk(child, [...
|
|
12921
|
+
walk(child, [...path109, name], childNode(name), map)
|
|
12921
12922
|
])
|
|
12922
12923
|
);
|
|
12923
12924
|
}
|
|
12924
|
-
function mapItems(value,
|
|
12925
|
+
function mapItems(value, path109, item, map) {
|
|
12925
12926
|
if (!Array.isArray(value)) return value;
|
|
12926
|
-
return value.map((entry, index2) => walk(entry, [...
|
|
12927
|
+
return value.map((entry, index2) => walk(entry, [...path109, index2], item, map));
|
|
12927
12928
|
}
|
|
12928
|
-
function walk(value,
|
|
12929
|
+
function walk(value, path109, node, map) {
|
|
12929
12930
|
if (!node || value === void 0 || value === null) return value;
|
|
12930
|
-
if (node.secret) return map(value,
|
|
12931
|
+
if (node.secret) return map(value, path109);
|
|
12931
12932
|
switch (node.kind) {
|
|
12932
12933
|
case "object":
|
|
12933
12934
|
case "unionOfObjects":
|
|
12934
12935
|
return mapChildren(
|
|
12935
12936
|
value,
|
|
12936
|
-
|
|
12937
|
+
path109,
|
|
12937
12938
|
(name) => configNodeField(node, name),
|
|
12938
12939
|
map
|
|
12939
12940
|
);
|
|
12940
12941
|
case "objectList":
|
|
12941
|
-
return mapItems(value,
|
|
12942
|
+
return mapItems(value, path109, node.item, map);
|
|
12942
12943
|
case "record":
|
|
12943
|
-
return mapChildren(value,
|
|
12944
|
+
return mapChildren(value, path109, () => node.value, map);
|
|
12944
12945
|
default:
|
|
12945
12946
|
return value;
|
|
12946
12947
|
}
|
|
@@ -12965,9 +12966,9 @@ function isTraversable(value) {
|
|
|
12965
12966
|
function stepInto(current, key) {
|
|
12966
12967
|
return isTraversable(current) ? current[key] : void 0;
|
|
12967
12968
|
}
|
|
12968
|
-
function getNestedValue(obj,
|
|
12969
|
+
function getNestedValue(obj, path109) {
|
|
12969
12970
|
let current = obj;
|
|
12970
|
-
for (const key of
|
|
12971
|
+
for (const key of path109.split(".")) current = stepInto(current, key);
|
|
12971
12972
|
return current;
|
|
12972
12973
|
}
|
|
12973
12974
|
|
|
@@ -13017,9 +13018,9 @@ function step(node, segment) {
|
|
|
13017
13018
|
return void 0;
|
|
13018
13019
|
}
|
|
13019
13020
|
}
|
|
13020
|
-
function findConfigNode(root2,
|
|
13021
|
+
function findConfigNode(root2, path109) {
|
|
13021
13022
|
let current = root2;
|
|
13022
|
-
for (const segment of
|
|
13023
|
+
for (const segment of path109) {
|
|
13023
13024
|
if (!current) return void 0;
|
|
13024
13025
|
current = step(current, segment);
|
|
13025
13026
|
}
|
|
@@ -13036,34 +13037,34 @@ function nameSegment(name) {
|
|
|
13036
13037
|
return name === RECORD_ENTRY_TOKEN ? { kind: "entry" } : { kind: "key", name };
|
|
13037
13038
|
}
|
|
13038
13039
|
function parseConfigPath(text18) {
|
|
13039
|
-
const
|
|
13040
|
+
const path109 = [];
|
|
13040
13041
|
let at2 = 0;
|
|
13041
13042
|
while (at2 < text18.length) {
|
|
13042
13043
|
if (text18[at2] === "[") {
|
|
13043
13044
|
const close = text18.indexOf("]", at2);
|
|
13044
13045
|
const segment = close === -1 ? void 0 : bracketSegment(text18.slice(at2 + 1, close));
|
|
13045
13046
|
if (!segment) return void 0;
|
|
13046
|
-
|
|
13047
|
+
path109.push(segment);
|
|
13047
13048
|
at2 = close + 1;
|
|
13048
13049
|
continue;
|
|
13049
13050
|
}
|
|
13050
13051
|
if (text18[at2] === ".") {
|
|
13051
|
-
if (
|
|
13052
|
+
if (path109.length === 0) return void 0;
|
|
13052
13053
|
at2 += 1;
|
|
13053
13054
|
}
|
|
13054
13055
|
const start2 = at2;
|
|
13055
13056
|
while (at2 < text18.length && text18[at2] !== "." && text18[at2] !== "[") at2 += 1;
|
|
13056
13057
|
const name = text18.slice(start2, at2);
|
|
13057
13058
|
if (!name) return void 0;
|
|
13058
|
-
|
|
13059
|
+
path109.push(nameSegment(name));
|
|
13059
13060
|
}
|
|
13060
|
-
return
|
|
13061
|
+
return path109;
|
|
13061
13062
|
}
|
|
13062
13063
|
|
|
13063
13064
|
// src/commands/config/configEntryNode.ts
|
|
13064
13065
|
function configEntryNode(root2, key) {
|
|
13065
|
-
const
|
|
13066
|
-
return
|
|
13066
|
+
const path109 = parseConfigPath(key);
|
|
13067
|
+
return path109 ? findConfigNode(root2, path109) : void 0;
|
|
13067
13068
|
}
|
|
13068
13069
|
|
|
13069
13070
|
// src/commands/backlog/harnessConfigHelp.ts
|
|
@@ -13342,6 +13343,11 @@ var refactorConfigHelp = [
|
|
|
13342
13343
|
key: "restructure.maxDepth",
|
|
13343
13344
|
setter: "assist config set restructure.maxDepth 10",
|
|
13344
13345
|
note: "deepest folder level the plan may place a file at (default 10); deeper plans list their deep chains with pin guidance, and --check fails"
|
|
13346
|
+
},
|
|
13347
|
+
{
|
|
13348
|
+
key: "restructure.maxPathLength",
|
|
13349
|
+
setter: "assist config set restructure.maxPathLength 200",
|
|
13350
|
+
note: "longest repo-relative path the plan may place a file at (default 200), leaving room for a Windows checkout root under MAX_PATH; longer plans list the paths with pin guidance, and --check fails"
|
|
13345
13351
|
}
|
|
13346
13352
|
];
|
|
13347
13353
|
|
|
@@ -13873,7 +13879,7 @@ function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
|
13873
13879
|
const parent = dirname22(branchKeyPath);
|
|
13874
13880
|
const branchPrefix = basename11(branchKeyPath);
|
|
13875
13881
|
if (!existsSync35(parent)) return null;
|
|
13876
|
-
const synthesisFiles = readdirSync5(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join41(parent, name, "synthesis.md")).filter((
|
|
13882
|
+
const synthesisFiles = readdirSync5(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join41(parent, name, "synthesis.md")).filter((path109) => existsSync35(path109)).map((path109) => ({ path: path109, mtime: statSync6(path109).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
13877
13883
|
return synthesisFiles[0]?.path ?? null;
|
|
13878
13884
|
}
|
|
13879
13885
|
|
|
@@ -13903,12 +13909,12 @@ async function getReviewSynthesis(req, res) {
|
|
|
13903
13909
|
const cwd = getCwdParam(req, res);
|
|
13904
13910
|
if (!cwd) return;
|
|
13905
13911
|
try {
|
|
13906
|
-
const
|
|
13907
|
-
if (!
|
|
13912
|
+
const path109 = await resolveSynthesisPath(cwd);
|
|
13913
|
+
if (!path109) {
|
|
13908
13914
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
13909
13915
|
return;
|
|
13910
13916
|
}
|
|
13911
|
-
respondJson(res, 200, { synthesis: readFileSync24(
|
|
13917
|
+
respondJson(res, 200, { synthesis: readFileSync24(path109, "utf8") });
|
|
13912
13918
|
} catch {
|
|
13913
13919
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
13914
13920
|
}
|
|
@@ -13991,8 +13997,8 @@ function parseDiffNameStatus(output) {
|
|
|
13991
13997
|
if (!status2 || fields.length < 2) continue;
|
|
13992
13998
|
const category = categorize(status2[0]);
|
|
13993
13999
|
if (!category) continue;
|
|
13994
|
-
const
|
|
13995
|
-
if (
|
|
14000
|
+
const path109 = fields[fields.length - 1];
|
|
14001
|
+
if (path109) result[category].push(path109);
|
|
13996
14002
|
}
|
|
13997
14003
|
return result;
|
|
13998
14004
|
}
|
|
@@ -14235,21 +14241,21 @@ function subsequenceScore(text18, query) {
|
|
|
14235
14241
|
}
|
|
14236
14242
|
return score - Math.min(text18.length, MAX_LENGTH_PENALTY);
|
|
14237
14243
|
}
|
|
14238
|
-
function scoreFilePath(
|
|
14244
|
+
function scoreFilePath(path109, query) {
|
|
14239
14245
|
const needle = query.trim().toLowerCase();
|
|
14240
14246
|
if (!needle) return 0;
|
|
14241
|
-
const basename36 =
|
|
14247
|
+
const basename36 = path109.slice(path109.lastIndexOf("/") + 1);
|
|
14242
14248
|
const inBasename = subsequenceScore(basename36, needle);
|
|
14243
14249
|
if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
|
|
14244
|
-
return subsequenceScore(
|
|
14250
|
+
return subsequenceScore(path109, needle);
|
|
14245
14251
|
}
|
|
14246
14252
|
|
|
14247
14253
|
// src/commands/sessions/web/rankFilePaths.ts
|
|
14248
14254
|
function rankFilePaths(paths, query, limit) {
|
|
14249
14255
|
const scored = [];
|
|
14250
|
-
for (const
|
|
14251
|
-
const score = scoreFilePath(
|
|
14252
|
-
if (score !== null) scored.push({ path:
|
|
14256
|
+
for (const path109 of paths) {
|
|
14257
|
+
const score = scoreFilePath(path109, query);
|
|
14258
|
+
if (score !== null) scored.push({ path: path109, score });
|
|
14253
14259
|
}
|
|
14254
14260
|
scored.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
|
|
14255
14261
|
return scored.slice(0, limit).map((entry) => entry.path);
|
|
@@ -15746,11 +15752,11 @@ function logLinkedRequest(req, res) {
|
|
|
15746
15752
|
const started = Date.now();
|
|
15747
15753
|
const from = req.headers[LINKED_FROM_HEADER2];
|
|
15748
15754
|
const trace = req.headers[TRACE_HEADER] ?? "none";
|
|
15749
|
-
const
|
|
15755
|
+
const path109 = new URL(req.url ?? "/", "http://localhost").pathname;
|
|
15750
15756
|
res.once("finish", () => {
|
|
15751
|
-
if (isQuietPoll(
|
|
15757
|
+
if (isQuietPoll(path109, res.statusCode)) return;
|
|
15752
15758
|
console.log(
|
|
15753
|
-
`link-from ${from} http: ${req.method} ${
|
|
15759
|
+
`link-from ${from} http: ${req.method} ${path109} trace=${trace} -> ${res.statusCode} (${Date.now() - started}ms)`
|
|
15754
15760
|
);
|
|
15755
15761
|
});
|
|
15756
15762
|
}
|
|
@@ -15775,8 +15781,8 @@ import { stat as stat3 } from "fs/promises";
|
|
|
15775
15781
|
|
|
15776
15782
|
// src/shared/isStagedAttachmentPath.ts
|
|
15777
15783
|
import { isAbsolute as isAbsolute3, relative as relative3, resolve as resolve13, sep } from "path";
|
|
15778
|
-
function isStagedAttachmentPath(
|
|
15779
|
-
const rel = relative3(stagedAttachmentsDir, resolve13(
|
|
15784
|
+
function isStagedAttachmentPath(path109) {
|
|
15785
|
+
const rel = relative3(stagedAttachmentsDir, resolve13(path109));
|
|
15780
15786
|
return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute3(rel);
|
|
15781
15787
|
}
|
|
15782
15788
|
|
|
@@ -15796,8 +15802,8 @@ var attachmentMimeTypes = {
|
|
|
15796
15802
|
};
|
|
15797
15803
|
|
|
15798
15804
|
// src/commands/sessions/web/attachmentContentType.ts
|
|
15799
|
-
function attachmentContentType(
|
|
15800
|
-
const ext = extname(
|
|
15805
|
+
function attachmentContentType(path109) {
|
|
15806
|
+
const ext = extname(path109).replace(/^\./, "").toLowerCase();
|
|
15801
15807
|
const match = Object.entries(attachmentMimeTypes).find(([, e]) => e === ext);
|
|
15802
15808
|
return match?.[0] ?? "application/octet-stream";
|
|
15803
15809
|
}
|
|
@@ -15805,22 +15811,22 @@ function attachmentContentType(path108) {
|
|
|
15805
15811
|
// src/commands/sessions/web/previewImage.ts
|
|
15806
15812
|
async function previewImage(req, res) {
|
|
15807
15813
|
const url = new URL(req.url ?? "/", "http://localhost");
|
|
15808
|
-
const
|
|
15809
|
-
if (!isStagedAttachmentPath(
|
|
15814
|
+
const path109 = url.searchParams.get("path") ?? "";
|
|
15815
|
+
if (!isStagedAttachmentPath(path109)) {
|
|
15810
15816
|
respondJson(res, 400, { error: "Not a staged attachment." });
|
|
15811
15817
|
return;
|
|
15812
15818
|
}
|
|
15813
|
-
const info = await stat3(
|
|
15819
|
+
const info = await stat3(path109).catch(() => null);
|
|
15814
15820
|
if (!info?.isFile()) {
|
|
15815
15821
|
respondJson(res, 404, { error: "Attachment is no longer staged." });
|
|
15816
15822
|
return;
|
|
15817
15823
|
}
|
|
15818
15824
|
res.writeHead(200, {
|
|
15819
|
-
"Content-Type": attachmentContentType(
|
|
15825
|
+
"Content-Type": attachmentContentType(path109),
|
|
15820
15826
|
"Content-Length": info.size,
|
|
15821
15827
|
"Cache-Control": "no-store"
|
|
15822
15828
|
});
|
|
15823
|
-
createReadStream2(
|
|
15829
|
+
createReadStream2(path109).pipe(res);
|
|
15824
15830
|
}
|
|
15825
15831
|
|
|
15826
15832
|
// src/commands/sessions/web/getCurrentBranch.ts
|
|
@@ -16257,8 +16263,8 @@ async function liveDeployments(cwd, repo, environments) {
|
|
|
16257
16263
|
|
|
16258
16264
|
// src/commands/sessions/web/releases/latestRun.ts
|
|
16259
16265
|
async function latestRun(cwd, repo, workflow) {
|
|
16260
|
-
const
|
|
16261
|
-
const response = await ghJson(cwd, ["api",
|
|
16266
|
+
const path109 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
|
|
16267
|
+
const response = await ghJson(cwd, ["api", path109]);
|
|
16262
16268
|
const run4 = response.workflow_runs?.[0];
|
|
16263
16269
|
if (!run4) return null;
|
|
16264
16270
|
return {
|
|
@@ -16555,38 +16561,38 @@ async function performRestart(target, deps2 = {}) {
|
|
|
16555
16561
|
import { relative as relative4 } from "path";
|
|
16556
16562
|
|
|
16557
16563
|
// src/commands/sessions/web/revertPathChanges.ts
|
|
16558
|
-
async function isTracked(cwd,
|
|
16564
|
+
async function isTracked(cwd, path109) {
|
|
16559
16565
|
try {
|
|
16560
|
-
await execGit(cwd, ["ls-files", "--error-unmatch", "--",
|
|
16566
|
+
await execGit(cwd, ["ls-files", "--error-unmatch", "--", path109]);
|
|
16561
16567
|
return true;
|
|
16562
16568
|
} catch {
|
|
16563
16569
|
return false;
|
|
16564
16570
|
}
|
|
16565
16571
|
}
|
|
16566
|
-
async function isInHead(cwd,
|
|
16567
|
-
const listing = await execGit(cwd, ["ls-tree", "HEAD", "--",
|
|
16572
|
+
async function isInHead(cwd, path109) {
|
|
16573
|
+
const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path109]);
|
|
16568
16574
|
return listing.trim().length > 0;
|
|
16569
16575
|
}
|
|
16570
|
-
async function revertPathChanges(cwd,
|
|
16571
|
-
if (!await isTracked(cwd,
|
|
16572
|
-
await execGit(cwd, ["clean", "-f", "--",
|
|
16576
|
+
async function revertPathChanges(cwd, path109) {
|
|
16577
|
+
if (!await isTracked(cwd, path109)) {
|
|
16578
|
+
await execGit(cwd, ["clean", "-f", "--", path109]);
|
|
16573
16579
|
return;
|
|
16574
16580
|
}
|
|
16575
|
-
if (await isInHead(cwd,
|
|
16576
|
-
await execGit(cwd, ["checkout", "HEAD", "--",
|
|
16581
|
+
if (await isInHead(cwd, path109)) {
|
|
16582
|
+
await execGit(cwd, ["checkout", "HEAD", "--", path109]);
|
|
16577
16583
|
return;
|
|
16578
16584
|
}
|
|
16579
|
-
await execGit(cwd, ["rm", "-f", "--",
|
|
16585
|
+
await execGit(cwd, ["rm", "-f", "--", path109]);
|
|
16580
16586
|
}
|
|
16581
16587
|
|
|
16582
16588
|
// src/commands/sessions/web/revertDiffFile.ts
|
|
16583
16589
|
async function revertDiffFile(req, res) {
|
|
16584
16590
|
const resolved = getFileTarget(req, res);
|
|
16585
16591
|
if (!resolved) return;
|
|
16586
|
-
const
|
|
16592
|
+
const path109 = relative4(repoRoot(resolved.cwd), resolved.target);
|
|
16587
16593
|
try {
|
|
16588
|
-
await revertPathChanges(resolved.cwd,
|
|
16589
|
-
respondJson(res, 200, { reverted:
|
|
16594
|
+
await revertPathChanges(resolved.cwd, path109);
|
|
16595
|
+
respondJson(res, 200, { reverted: path109 });
|
|
16590
16596
|
} catch (error) {
|
|
16591
16597
|
respondJson(res, 500, {
|
|
16592
16598
|
error: error instanceof Error ? error.message : "Failed to revert file"
|
|
@@ -16687,7 +16693,7 @@ import { relative as relative5 } from "path";
|
|
|
16687
16693
|
function requestedPaths(body) {
|
|
16688
16694
|
const paths = body.paths;
|
|
16689
16695
|
if (!Array.isArray(paths)) return null;
|
|
16690
|
-
if (paths.some((
|
|
16696
|
+
if (paths.some((path109) => typeof path109 !== "string")) return null;
|
|
16691
16697
|
return paths;
|
|
16692
16698
|
}
|
|
16693
16699
|
async function revertDiffPaths(req, res) {
|
|
@@ -16707,10 +16713,10 @@ async function revertDiffPaths(req, res) {
|
|
|
16707
16713
|
const root2 = repoRoot(cwd);
|
|
16708
16714
|
const reverted = [];
|
|
16709
16715
|
const failed3 = [];
|
|
16710
|
-
for (const
|
|
16711
|
-
const target = resolveWithinCwd(cwd,
|
|
16716
|
+
for (const path109 of paths) {
|
|
16717
|
+
const target = resolveWithinCwd(cwd, path109);
|
|
16712
16718
|
if (!target) {
|
|
16713
|
-
failed3.push({ path:
|
|
16719
|
+
failed3.push({ path: path109, error: "Path outside cwd" });
|
|
16714
16720
|
continue;
|
|
16715
16721
|
}
|
|
16716
16722
|
const relativePath = relative5(root2, target);
|
|
@@ -16756,13 +16762,13 @@ function describePeerError(error) {
|
|
|
16756
16762
|
const cause = error.cause;
|
|
16757
16763
|
return cause instanceof Error ? `${error.message}: ${describePeerError(cause)}` : error.message;
|
|
16758
16764
|
}
|
|
16759
|
-
async function fetchPeerJson(baseUrl,
|
|
16760
|
-
const res = await fetch(new URL(
|
|
16765
|
+
async function fetchPeerJson(baseUrl, path109, timeoutMs = PEER_TIMEOUT_MS) {
|
|
16766
|
+
const res = await fetch(new URL(path109, baseUrl), {
|
|
16761
16767
|
signal: AbortSignal.timeout(timeoutMs)
|
|
16762
16768
|
});
|
|
16763
16769
|
if (!res.ok)
|
|
16764
16770
|
throw Object.assign(
|
|
16765
|
-
new Error(`GET ${
|
|
16771
|
+
new Error(`GET ${path109} returned ${res.status} ${res.statusText}`),
|
|
16766
16772
|
{ status: res.status }
|
|
16767
16773
|
);
|
|
16768
16774
|
return await res.json();
|
|
@@ -17182,11 +17188,11 @@ function parseJson(raw) {
|
|
|
17182
17188
|
}
|
|
17183
17189
|
}
|
|
17184
17190
|
function formatIssue(key, issue) {
|
|
17185
|
-
const
|
|
17191
|
+
const path109 = formatConfigPath([
|
|
17186
17192
|
{ kind: "key", name: key },
|
|
17187
17193
|
...issue.path.map(toSegment)
|
|
17188
17194
|
]);
|
|
17189
|
-
return `${
|
|
17195
|
+
return `${path109}: ${issue.message}`;
|
|
17190
17196
|
}
|
|
17191
17197
|
function toSegment(part) {
|
|
17192
17198
|
return typeof part === "number" ? { kind: "index", index: part } : { kind: "key", name: String(part) };
|
|
@@ -17281,9 +17287,9 @@ function coerceUnion(key, raw, types) {
|
|
|
17281
17287
|
}
|
|
17282
17288
|
|
|
17283
17289
|
// src/shared/valueAtConfigPath.ts
|
|
17284
|
-
function valueAtConfigPath(value,
|
|
17290
|
+
function valueAtConfigPath(value, path109) {
|
|
17285
17291
|
let current = value;
|
|
17286
|
-
for (const key of
|
|
17292
|
+
for (const key of path109) {
|
|
17287
17293
|
if (typeof key === "number") {
|
|
17288
17294
|
if (!Array.isArray(current)) return void 0;
|
|
17289
17295
|
current = current[key];
|
|
@@ -17300,7 +17306,7 @@ function restoreConfigSecrets(value, stored, node) {
|
|
|
17300
17306
|
return mapConfigSecrets(
|
|
17301
17307
|
value,
|
|
17302
17308
|
node,
|
|
17303
|
-
(secret,
|
|
17309
|
+
(secret, path109) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path109) : secret
|
|
17304
17310
|
);
|
|
17305
17311
|
}
|
|
17306
17312
|
|
|
@@ -17349,8 +17355,8 @@ function stepIntoNested(container, key, nextKey) {
|
|
|
17349
17355
|
}
|
|
17350
17356
|
return ensureObject(container, resolved);
|
|
17351
17357
|
}
|
|
17352
|
-
function setNestedValue(obj,
|
|
17353
|
-
const keys =
|
|
17358
|
+
function setNestedValue(obj, path109, value) {
|
|
17359
|
+
const keys = path109.split(".");
|
|
17354
17360
|
const result = { ...obj };
|
|
17355
17361
|
let current = result;
|
|
17356
17362
|
for (let i = 0; i < keys.length - 1; i++) {
|
|
@@ -17377,8 +17383,8 @@ function formatIssue2(issue, key) {
|
|
|
17377
17383
|
return issue.keys.map(
|
|
17378
17384
|
(unrecognized) => `${[...issue.path, unrecognized].join(".")}: Unrecognized key`
|
|
17379
17385
|
);
|
|
17380
|
-
const
|
|
17381
|
-
return [`${
|
|
17386
|
+
const path109 = issue.path.length > 0 ? issue.path.join(".") : key;
|
|
17387
|
+
return [`${path109}: ${issue.message}`];
|
|
17382
17388
|
}
|
|
17383
17389
|
|
|
17384
17390
|
// src/commands/config/applyConfigSet.ts
|
|
@@ -17469,15 +17475,15 @@ async function saveRepoConfig(orm, repoKey, config) {
|
|
|
17469
17475
|
import { mkdirSync as mkdirSync12, renameSync as renameSync2, writeFileSync as writeFileSync22 } from "fs";
|
|
17470
17476
|
import { dirname as dirname24 } from "path";
|
|
17471
17477
|
function writeRepoConfigCache(repos2) {
|
|
17472
|
-
const
|
|
17473
|
-
mkdirSync12(dirname24(
|
|
17478
|
+
const path109 = repoConfigCachePath();
|
|
17479
|
+
mkdirSync12(dirname24(path109), { recursive: true });
|
|
17474
17480
|
const cache6 = {
|
|
17475
17481
|
refreshedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
17476
17482
|
repos: repos2
|
|
17477
17483
|
};
|
|
17478
|
-
const tmp = `${
|
|
17484
|
+
const tmp = `${path109}.${process.pid}.tmp`;
|
|
17479
17485
|
writeFileSync22(tmp, JSON.stringify(cache6, null, 2));
|
|
17480
|
-
renameSync2(tmp,
|
|
17486
|
+
renameSync2(tmp, path109);
|
|
17481
17487
|
}
|
|
17482
17488
|
|
|
17483
17489
|
// src/shared/refreshRepoConfigCache.ts
|
|
@@ -17660,8 +17666,8 @@ function removeAt(container, keys) {
|
|
|
17660
17666
|
}
|
|
17661
17667
|
return removeFromChild(container, key, rest);
|
|
17662
17668
|
}
|
|
17663
|
-
function unsetNestedValue(obj,
|
|
17664
|
-
const { container, removed } = removeAt(obj,
|
|
17669
|
+
function unsetNestedValue(obj, path109) {
|
|
17670
|
+
const { container, removed } = removeAt(obj, path109.split("."));
|
|
17665
17671
|
return { config: container, removed };
|
|
17666
17672
|
}
|
|
17667
17673
|
|
|
@@ -17801,12 +17807,12 @@ var sessionsPrefix = "src/commands/sessions/";
|
|
|
17801
17807
|
var restartRules = [
|
|
17802
17808
|
{
|
|
17803
17809
|
target: "webserver",
|
|
17804
|
-
matches: (
|
|
17810
|
+
matches: (path109) => path109.startsWith(webUiPrefix),
|
|
17805
17811
|
advice: "restart the web server, then hard-reload the browser tab"
|
|
17806
17812
|
},
|
|
17807
17813
|
{
|
|
17808
17814
|
target: "daemon",
|
|
17809
|
-
matches: (
|
|
17815
|
+
matches: (path109) => path109.startsWith(sessionsPrefix) && !path109.startsWith(webUiPrefix),
|
|
17810
17816
|
advice: "restart the daemon"
|
|
17811
17817
|
}
|
|
17812
17818
|
];
|
|
@@ -17847,11 +17853,11 @@ import { basename as basename13, join as join45 } from "path";
|
|
|
17847
17853
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
17848
17854
|
import { realpathSync as realpathSync2 } from "fs";
|
|
17849
17855
|
import { resolve as resolve15 } from "path";
|
|
17850
|
-
function canonicalTreePath(
|
|
17856
|
+
function canonicalTreePath(path109) {
|
|
17851
17857
|
try {
|
|
17852
|
-
return realpathSync2(
|
|
17858
|
+
return realpathSync2(path109);
|
|
17853
17859
|
} catch {
|
|
17854
|
-
return resolve15(
|
|
17860
|
+
return resolve15(path109);
|
|
17855
17861
|
}
|
|
17856
17862
|
}
|
|
17857
17863
|
|
|
@@ -18551,22 +18557,22 @@ function gitCommonDir(cwd) {
|
|
|
18551
18557
|
var REGISTRY_FILE = "worktrees.json";
|
|
18552
18558
|
function readWorktreeRegistry() {
|
|
18553
18559
|
const data = loadJson(REGISTRY_FILE);
|
|
18554
|
-
return Object.entries(data).filter(([, record]) => !record.reaped).map(([
|
|
18560
|
+
return Object.entries(data).filter(([, record]) => !record.reaped).map(([path109, record]) => ({ path: path109, ...record }));
|
|
18555
18561
|
}
|
|
18556
|
-
function worktreeAttributionIncludingReaped(
|
|
18557
|
-
const record = loadJson(REGISTRY_FILE)[
|
|
18562
|
+
function worktreeAttributionIncludingReaped(path109) {
|
|
18563
|
+
const record = loadJson(REGISTRY_FILE)[path109];
|
|
18558
18564
|
return record ? { clone: record.clone, origin: record.origin } : void 0;
|
|
18559
18565
|
}
|
|
18560
|
-
function recordWorktree(
|
|
18566
|
+
function recordWorktree(path109, clone, origin) {
|
|
18561
18567
|
const data = loadJson(REGISTRY_FILE);
|
|
18562
|
-
data[
|
|
18568
|
+
data[path109] = { clone, origin };
|
|
18563
18569
|
saveJson(REGISTRY_FILE, data);
|
|
18564
18570
|
}
|
|
18565
|
-
function forgetWorktree(
|
|
18571
|
+
function forgetWorktree(path109) {
|
|
18566
18572
|
const data = loadJson(REGISTRY_FILE);
|
|
18567
|
-
const record = data[
|
|
18573
|
+
const record = data[path109];
|
|
18568
18574
|
if (!record || record.reaped) return;
|
|
18569
|
-
data[
|
|
18575
|
+
data[path109] = { ...record, reaped: true };
|
|
18570
18576
|
saveJson(REGISTRY_FILE, data);
|
|
18571
18577
|
}
|
|
18572
18578
|
|
|
@@ -19329,10 +19335,10 @@ function flagValue(args, i) {
|
|
|
19329
19335
|
}
|
|
19330
19336
|
function readSourceOrCommandText(source, command) {
|
|
19331
19337
|
if (!source.startsWith("@")) return source;
|
|
19332
|
-
const
|
|
19333
|
-
if (
|
|
19338
|
+
const path109 = source.slice(1);
|
|
19339
|
+
if (path109 === "-") return command;
|
|
19334
19340
|
try {
|
|
19335
|
-
return readFileSync27(
|
|
19341
|
+
return readFileSync27(path109, "utf8");
|
|
19336
19342
|
} catch {
|
|
19337
19343
|
return command;
|
|
19338
19344
|
}
|
|
@@ -19527,13 +19533,13 @@ function findBuiltinDenyRaw(rawCommand) {
|
|
|
19527
19533
|
|
|
19528
19534
|
// src/commands/cliHook/findRestrictedPathDeny.ts
|
|
19529
19535
|
var RESTRICTED_PATHS = [".assist/restricted"];
|
|
19530
|
-
function restrictedPathRegex(
|
|
19531
|
-
const pattern2 =
|
|
19536
|
+
function restrictedPathRegex(path109) {
|
|
19537
|
+
const pattern2 = path109.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
|
|
19532
19538
|
return new RegExp(pattern2);
|
|
19533
19539
|
}
|
|
19534
|
-
var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((
|
|
19535
|
-
path:
|
|
19536
|
-
regex: restrictedPathRegex(
|
|
19540
|
+
var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path109) => ({
|
|
19541
|
+
path: path109,
|
|
19542
|
+
regex: restrictedPathRegex(path109)
|
|
19537
19543
|
}));
|
|
19538
19544
|
function findRestrictedPathDenyRaw(rawCommand) {
|
|
19539
19545
|
const rule = RESTRICTED_PATH_RULES.find(
|
|
@@ -19710,9 +19716,9 @@ var __dirname4 = dirname26(__filename3);
|
|
|
19710
19716
|
function packageRoot() {
|
|
19711
19717
|
return __dirname4;
|
|
19712
19718
|
}
|
|
19713
|
-
function readLines(
|
|
19714
|
-
if (!existsSync42(
|
|
19715
|
-
return readFileSync28(
|
|
19719
|
+
function readLines(path109) {
|
|
19720
|
+
if (!existsSync42(path109)) return [];
|
|
19721
|
+
return readFileSync28(path109, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
19716
19722
|
}
|
|
19717
19723
|
var cachedReads;
|
|
19718
19724
|
var cachedWrites;
|
|
@@ -20244,14 +20250,14 @@ function showProgress(p, label2) {
|
|
|
20244
20250
|
const pct = Math.round(p.done / p.total * 100);
|
|
20245
20251
|
process.stderr.write(`\r\x1B[K[${pct}%] Scanning ${label2}...`);
|
|
20246
20252
|
}
|
|
20247
|
-
async function resolveCommand2(cli,
|
|
20248
|
-
showProgress(p,
|
|
20249
|
-
const subHelp = await runHelp([cli, ...
|
|
20253
|
+
async function resolveCommand2(cli, path109, description, depth, p) {
|
|
20254
|
+
showProgress(p, path109.join(" "));
|
|
20255
|
+
const subHelp = await runHelp([cli, ...path109]);
|
|
20250
20256
|
if (!subHelp || !hasSubcommands(subHelp)) {
|
|
20251
|
-
return [{ path:
|
|
20257
|
+
return [{ path: path109, description }];
|
|
20252
20258
|
}
|
|
20253
|
-
const children = await discoverAt(cli,
|
|
20254
|
-
return children.length > 0 ? children : [{ path:
|
|
20259
|
+
const children = await discoverAt(cli, path109, depth + 1, p);
|
|
20260
|
+
return children.length > 0 ? children : [{ path: path109, description }];
|
|
20255
20261
|
}
|
|
20256
20262
|
async function discoverAt(cli, parentPath, depth, p) {
|
|
20257
20263
|
if (depth > SAFETY_DEPTH) return [];
|
|
@@ -20399,9 +20405,9 @@ function logPath(cli) {
|
|
|
20399
20405
|
return join50(homedir19(), ".assist", `cli-discover-${safeName}.log`);
|
|
20400
20406
|
}
|
|
20401
20407
|
function readCache(cli) {
|
|
20402
|
-
const
|
|
20403
|
-
if (!existsSync44(
|
|
20404
|
-
return readFileSync30(
|
|
20408
|
+
const path109 = logPath(cli);
|
|
20409
|
+
if (!existsSync44(path109)) return void 0;
|
|
20410
|
+
return readFileSync30(path109, "utf8");
|
|
20405
20411
|
}
|
|
20406
20412
|
function writeCache(cli, output) {
|
|
20407
20413
|
const dir = join50(homedir19(), ".assist");
|
|
@@ -20590,9 +20596,9 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
20590
20596
|
}
|
|
20591
20597
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
20592
20598
|
for (const entry of entries) {
|
|
20593
|
-
const
|
|
20599
|
+
const path109 = join52(dir, entry);
|
|
20594
20600
|
try {
|
|
20595
|
-
if (statSync8(
|
|
20601
|
+
if (statSync8(path109).mtimeMs < cutoff) unlinkSync7(path109);
|
|
20596
20602
|
} catch {
|
|
20597
20603
|
continue;
|
|
20598
20604
|
}
|
|
@@ -20602,10 +20608,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
20602
20608
|
// src/commands/codeComment/readPinState.ts
|
|
20603
20609
|
import { existsSync as existsSync45, readFileSync as readFileSync31 } from "fs";
|
|
20604
20610
|
function readPinState(pin2) {
|
|
20605
|
-
const
|
|
20606
|
-
if (!existsSync45(
|
|
20611
|
+
const path109 = getPinStatePath(pin2);
|
|
20612
|
+
if (!existsSync45(path109)) return void 0;
|
|
20607
20613
|
try {
|
|
20608
|
-
const state = JSON.parse(readFileSync31(
|
|
20614
|
+
const state = JSON.parse(readFileSync31(path109, "utf8"));
|
|
20609
20615
|
if (state.pin !== pin2) return void 0;
|
|
20610
20616
|
return state;
|
|
20611
20617
|
} catch {
|
|
@@ -21026,8 +21032,8 @@ function findUnmergedPaths() {
|
|
|
21026
21032
|
}
|
|
21027
21033
|
const found = /* @__PURE__ */ new Set();
|
|
21028
21034
|
for (const line of output.split("\n")) {
|
|
21029
|
-
const
|
|
21030
|
-
if (
|
|
21035
|
+
const path109 = line.split(" ")[1];
|
|
21036
|
+
if (path109) found.add(path109.trim());
|
|
21031
21037
|
}
|
|
21032
21038
|
return [...found];
|
|
21033
21039
|
}
|
|
@@ -22066,8 +22072,8 @@ function diffRepoConfigLeaves(current, incoming) {
|
|
|
22066
22072
|
}
|
|
22067
22073
|
function leaves(node, prefix2 = "") {
|
|
22068
22074
|
return Object.entries(node).flatMap(([key, value]) => {
|
|
22069
|
-
const
|
|
22070
|
-
return isPlainObject4(value) && Object.keys(value).length > 0 ? leaves(value,
|
|
22075
|
+
const path109 = prefix2 ? `${prefix2}.${key}` : key;
|
|
22076
|
+
return isPlainObject4(value) && Object.keys(value).length > 0 ? leaves(value, path109) : [[path109, value]];
|
|
22071
22077
|
});
|
|
22072
22078
|
}
|
|
22073
22079
|
function isPlainObject4(value) {
|
|
@@ -22378,11 +22384,11 @@ async function loadPath(source) {
|
|
|
22378
22384
|
}
|
|
22379
22385
|
}
|
|
22380
22386
|
async function criteriaExtension() {
|
|
22381
|
-
const
|
|
22387
|
+
const path109 = await loadPath(criteriaExtensionDir());
|
|
22382
22388
|
console.log(
|
|
22383
22389
|
chalk141.bold("acceptance criteria outliner \u2014 GitHub browser extension")
|
|
22384
22390
|
);
|
|
22385
|
-
console.log(chalk141.dim(`load the unpacked extension from ${
|
|
22391
|
+
console.log(chalk141.dim(`load the unpacked extension from ${path109}`));
|
|
22386
22392
|
}
|
|
22387
22393
|
|
|
22388
22394
|
// src/commands/criteriaExtension/printCriteriaExtensionUrl.ts
|
|
@@ -22498,7 +22504,7 @@ async function stageCriteriaExtension(source, staging, version2) {
|
|
|
22498
22504
|
await mkdir5(staging, { recursive: true });
|
|
22499
22505
|
await cp3(source, staging, {
|
|
22500
22506
|
recursive: true,
|
|
22501
|
-
filter: (
|
|
22507
|
+
filter: (path109) => basename15(path109) !== "updates.json"
|
|
22502
22508
|
});
|
|
22503
22509
|
const manifest = join58(staging, "manifest.json");
|
|
22504
22510
|
const stamped = stampManifestVersion(
|
|
@@ -22579,10 +22585,10 @@ async function signCriteriaExtension() {
|
|
|
22579
22585
|
return;
|
|
22580
22586
|
}
|
|
22581
22587
|
await writeUpdateManifest(source, ARTIFACTS_DIR, version2);
|
|
22582
|
-
const
|
|
22588
|
+
const path109 = await signedAddonInstallPath(
|
|
22583
22589
|
await copySignedXpi(xpi, ARTIFACTS_DIR)
|
|
22584
22590
|
);
|
|
22585
|
-
console.log(chalk144.dim(`install the signed add-on from ${
|
|
22591
|
+
console.log(chalk144.dim(`install the signed add-on from ${path109}`));
|
|
22586
22592
|
}
|
|
22587
22593
|
|
|
22588
22594
|
// src/commands/registerCriteriaExtension.ts
|
|
@@ -22744,10 +22750,10 @@ function getMigrationApprovalPath(migrationId) {
|
|
|
22744
22750
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
22745
22751
|
import { existsSync as existsSync50, readFileSync as readFileSync33 } from "fs";
|
|
22746
22752
|
function readMigrationPinState(pin2) {
|
|
22747
|
-
const
|
|
22748
|
-
if (!existsSync50(
|
|
22753
|
+
const path109 = getMigrationPinPath(pin2);
|
|
22754
|
+
if (!existsSync50(path109)) return void 0;
|
|
22749
22755
|
try {
|
|
22750
|
-
const state = JSON.parse(readFileSync33(
|
|
22756
|
+
const state = JSON.parse(readFileSync33(path109, "utf8"));
|
|
22751
22757
|
if (state.pin !== pin2) return void 0;
|
|
22752
22758
|
if (!Number.isInteger(state.migrationId)) return void 0;
|
|
22753
22759
|
return state;
|
|
@@ -24657,10 +24663,10 @@ function decideCommentGuard(input, existingContent) {
|
|
|
24657
24663
|
import { existsSync as existsSync56, unlinkSync as unlinkSync11 } from "fs";
|
|
24658
24664
|
function consumeMigrationApproval(migrationId) {
|
|
24659
24665
|
sweepRestrictedDir();
|
|
24660
|
-
const
|
|
24661
|
-
if (!existsSync56(
|
|
24666
|
+
const path109 = getMigrationApprovalPath(migrationId);
|
|
24667
|
+
if (!existsSync56(path109)) return false;
|
|
24662
24668
|
try {
|
|
24663
|
-
unlinkSync11(
|
|
24669
|
+
unlinkSync11(path109);
|
|
24664
24670
|
return true;
|
|
24665
24671
|
} catch {
|
|
24666
24672
|
return false;
|
|
@@ -25600,8 +25606,8 @@ function collectLabels(value, previous) {
|
|
|
25600
25606
|
import { extname as extname3 } from "path";
|
|
25601
25607
|
|
|
25602
25608
|
// src/commands/prs/screenshotReference.ts
|
|
25603
|
-
function screenshotReference({ path:
|
|
25604
|
-
const target = /\s/.test(
|
|
25609
|
+
function screenshotReference({ path: path109, alt }) {
|
|
25610
|
+
const target = /\s/.test(path109) ? `<${path109}>` : path109;
|
|
25605
25611
|
return ``;
|
|
25606
25612
|
}
|
|
25607
25613
|
|
|
@@ -26024,7 +26030,7 @@ async function reviewProposedIssue(title, body, metadata2 = []) {
|
|
|
26024
26030
|
|
|
26025
26031
|
// src/commands/prs/attachArgs.ts
|
|
26026
26032
|
function attachArgs(attachments) {
|
|
26027
|
-
return attachments.flatMap(({ path:
|
|
26033
|
+
return attachments.flatMap(({ path: path109 }) => ["--attach", path109]);
|
|
26028
26034
|
}
|
|
26029
26035
|
|
|
26030
26036
|
// src/commands/prs/runGhWithAttachments.ts
|
|
@@ -26035,8 +26041,8 @@ import { basename as basename18 } from "path";
|
|
|
26035
26041
|
import { rmSync as rmSync4 } from "fs";
|
|
26036
26042
|
import { dirname as dirname29 } from "path";
|
|
26037
26043
|
function removeStagedAttachments(attachments) {
|
|
26038
|
-
for (const { path:
|
|
26039
|
-
const dir = dirname29(
|
|
26044
|
+
for (const { path: path109 } of attachments) {
|
|
26045
|
+
const dir = dirname29(path109);
|
|
26040
26046
|
if (!isStagedAttachmentPath(dir)) continue;
|
|
26041
26047
|
rmSync4(dir, { recursive: true, force: true });
|
|
26042
26048
|
}
|
|
@@ -26046,7 +26052,7 @@ function removeStagedAttachments(attachments) {
|
|
|
26046
26052
|
var PLACED_URL = /https:\/\/\S+\/(pull|issues)\/\d+/;
|
|
26047
26053
|
function reportPartialFailure(attachments, stderr) {
|
|
26048
26054
|
const failed3 = attachments.filter(
|
|
26049
|
-
({ path:
|
|
26055
|
+
({ path: path109 }) => stderr.includes(path109) || stderr.includes(basename18(path109))
|
|
26050
26056
|
);
|
|
26051
26057
|
const named = failed3.length > 0 ? failed3 : attachments;
|
|
26052
26058
|
console.error(
|
|
@@ -26947,7 +26953,7 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
26947
26953
|
const registered = new Set(listWorktreePaths(clone));
|
|
26948
26954
|
const branches = new Set(listLocalBranches(clone));
|
|
26949
26955
|
const isTaken = (candidate) => registered.has(candidate) || existsSync58(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename20(candidate));
|
|
26950
|
-
const
|
|
26956
|
+
const path109 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
26951
26957
|
const fetchError = fetchQuietly(clone, 0);
|
|
26952
26958
|
if (fetchError)
|
|
26953
26959
|
daemonLog(
|
|
@@ -26959,15 +26965,15 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
26959
26965
|
"add",
|
|
26960
26966
|
start2.track ? "--track" : "--no-track",
|
|
26961
26967
|
"-b",
|
|
26962
|
-
basename20(
|
|
26963
|
-
|
|
26968
|
+
basename20(path109),
|
|
26969
|
+
path109,
|
|
26964
26970
|
start2.ref
|
|
26965
26971
|
]);
|
|
26966
|
-
recordWorktree(
|
|
26972
|
+
recordWorktree(path109, clone, getCurrentOrigin(clone));
|
|
26967
26973
|
daemonLog(
|
|
26968
|
-
start2.track ? `worktree allocated ${
|
|
26974
|
+
start2.track ? `worktree allocated ${path109} (branch ${basename20(path109)} tracking ${start2.ref}) for clone ${clone}` : `worktree allocated ${path109} (branch ${basename20(path109)} off ${start2.ref}, no mainline tracking) for clone ${clone}`
|
|
26969
26975
|
);
|
|
26970
|
-
return
|
|
26976
|
+
return path109;
|
|
26971
26977
|
}
|
|
26972
26978
|
|
|
26973
26979
|
// src/commands/sessions/daemon/worktree/keptInTree.ts
|
|
@@ -27103,13 +27109,13 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
|
|
|
27103
27109
|
if (forcedSpill) daemonLog(forcedSpill);
|
|
27104
27110
|
else if (reusesClone(clone, boundTreeRoots2, options2))
|
|
27105
27111
|
return { cwd: clone, kind: "primary", created: false, clone };
|
|
27106
|
-
const
|
|
27112
|
+
const path109 = createWorktree(
|
|
27107
27113
|
clone,
|
|
27108
27114
|
{ root: cfg.root, trunk: cfg.trunk },
|
|
27109
27115
|
boundTreeRoots2,
|
|
27110
27116
|
options2.replacesTree
|
|
27111
27117
|
);
|
|
27112
|
-
return { cwd:
|
|
27118
|
+
return { cwd: path109, kind: "worktree", created: true, clone };
|
|
27113
27119
|
}
|
|
27114
27120
|
|
|
27115
27121
|
// src/commands/sessions/daemon/describePersistedSession.ts
|
|
@@ -27508,13 +27514,13 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
27508
27514
|
const listing = gitSyncOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
27509
27515
|
if (!listing) return null;
|
|
27510
27516
|
const here = gitSyncOrNull(cwd, ["rev-parse", "--show-toplevel"]);
|
|
27511
|
-
let
|
|
27517
|
+
let path109 = null;
|
|
27512
27518
|
for (const line of listing.split("\n")) {
|
|
27513
27519
|
const trimmed = line.trim();
|
|
27514
27520
|
if (trimmed.startsWith("worktree "))
|
|
27515
|
-
|
|
27521
|
+
path109 = trimmed.slice("worktree ".length).trim();
|
|
27516
27522
|
else if (trimmed === `branch refs/heads/${branch2}`)
|
|
27517
|
-
return
|
|
27523
|
+
return path109 && path109 !== here ? path109 : null;
|
|
27518
27524
|
}
|
|
27519
27525
|
return null;
|
|
27520
27526
|
}
|
|
@@ -28630,9 +28636,9 @@ function parseRscRows(flight) {
|
|
|
28630
28636
|
}
|
|
28631
28637
|
function makeRscResolver(rows) {
|
|
28632
28638
|
return (ref) => {
|
|
28633
|
-
const [id, ...
|
|
28639
|
+
const [id, ...path109] = ref.slice(1).replace(/^[L@]/, "").split(":");
|
|
28634
28640
|
let v = rows[id];
|
|
28635
|
-
for (const key of
|
|
28641
|
+
for (const key of path109) {
|
|
28636
28642
|
if (v == null || typeof v !== "object") return void 0;
|
|
28637
28643
|
v = v[key];
|
|
28638
28644
|
}
|
|
@@ -29383,18 +29389,18 @@ function validateLine(line) {
|
|
|
29383
29389
|
process.exit(1);
|
|
29384
29390
|
}
|
|
29385
29391
|
}
|
|
29386
|
-
async function comment2(
|
|
29392
|
+
async function comment2(path109, line, body, options2 = {}) {
|
|
29387
29393
|
const { startLine, skipPreview } = options2;
|
|
29388
29394
|
validateBody(body);
|
|
29389
29395
|
validateLine(line);
|
|
29390
29396
|
if (startLine !== void 0) validateLine(startLine);
|
|
29391
29397
|
const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
|
|
29392
29398
|
if (!skipPreview)
|
|
29393
|
-
await reviewProposedPrComment(`Comment on ${
|
|
29399
|
+
await reviewProposedPrComment(`Comment on ${path109}:${range}`, body, null);
|
|
29394
29400
|
try {
|
|
29395
29401
|
const prId = getCurrentPrNodeId();
|
|
29396
|
-
postReviewComment({ prId, body, path:
|
|
29397
|
-
console.log(`Added review comment on ${
|
|
29402
|
+
postReviewComment({ prId, body, path: path109, line, startLine });
|
|
29403
|
+
console.log(`Added review comment on ${path109}:${range}`);
|
|
29398
29404
|
} catch (error) {
|
|
29399
29405
|
if (isGhNotInstalled(error)) {
|
|
29400
29406
|
console.error("Error: GitHub CLI (gh) is not installed.");
|
|
@@ -29971,9 +29977,9 @@ function registerPrsComments(prsCommand) {
|
|
|
29971
29977
|
});
|
|
29972
29978
|
prsCommand.command("comment <path> <line> <body>").description(
|
|
29973
29979
|
"Add a line comment to the pending review (body of - reads it from stdin)"
|
|
29974
|
-
).action(async (
|
|
29980
|
+
).action(async (path109, line, body) => {
|
|
29975
29981
|
await comment2(
|
|
29976
|
-
|
|
29982
|
+
path109,
|
|
29977
29983
|
Number.parseInt(line, 10),
|
|
29978
29984
|
await readBodyArgument(body)
|
|
29979
29985
|
);
|
|
@@ -30099,9 +30105,9 @@ function splitOnce(value, separator) {
|
|
|
30099
30105
|
if (index2 === -1) return null;
|
|
30100
30106
|
return [value.slice(0, index2), value.slice(index2 + separator.length)];
|
|
30101
30107
|
}
|
|
30102
|
-
function isFile2(
|
|
30108
|
+
function isFile2(path109) {
|
|
30103
30109
|
try {
|
|
30104
|
-
return statSync10(
|
|
30110
|
+
return statSync10(path109).isFile();
|
|
30105
30111
|
} catch {
|
|
30106
30112
|
return false;
|
|
30107
30113
|
}
|
|
@@ -30109,16 +30115,16 @@ function isFile2(path108) {
|
|
|
30109
30115
|
function parseScreenshotSpec(spec) {
|
|
30110
30116
|
const [label2, rawPath] = splitOnce(spec, "=") ?? ["", spec];
|
|
30111
30117
|
const [group, caption] = splitOnce(label2, "/") ?? ["", label2];
|
|
30112
|
-
const
|
|
30113
|
-
const ext = extname5(
|
|
30114
|
-
if (!isFile2(
|
|
30115
|
-
throw new Error(`--screenshot '${spec}': file not found: ${
|
|
30118
|
+
const path109 = resolve23(rawPath.trim());
|
|
30119
|
+
const ext = extname5(path109).replace(/^\./, "").toLowerCase();
|
|
30120
|
+
if (!isFile2(path109))
|
|
30121
|
+
throw new Error(`--screenshot '${spec}': file not found: ${path109}`);
|
|
30116
30122
|
if (!ghAttachableExtensions.has(ext))
|
|
30117
30123
|
throw new Error(
|
|
30118
30124
|
`--screenshot '${spec}': gh cannot attach .${ext || "(none)"} files (supported: ${[...ghAttachableExtensions].join(", ")}).`
|
|
30119
30125
|
);
|
|
30120
|
-
const alt = caption.trim() || basename22(
|
|
30121
|
-
return group.trim() ? { path:
|
|
30126
|
+
const alt = caption.trim() || basename22(path109, extname5(path109));
|
|
30127
|
+
return group.trim() ? { path: path109, alt, group: group.trim() } : { path: path109, alt };
|
|
30122
30128
|
}
|
|
30123
30129
|
|
|
30124
30130
|
// src/commands/prs/parseScreenshotSpecs.ts
|
|
@@ -31255,11 +31261,11 @@ async function loadBody(target) {
|
|
|
31255
31261
|
if (target.kind === "file") return readDraftFile(target.path);
|
|
31256
31262
|
return fetchPrBody(target.number, target.repo);
|
|
31257
31263
|
}
|
|
31258
|
-
function readDraftFile(
|
|
31264
|
+
function readDraftFile(path109) {
|
|
31259
31265
|
try {
|
|
31260
|
-
return readFileSync46(
|
|
31266
|
+
return readFileSync46(path109, "utf8");
|
|
31261
31267
|
} catch {
|
|
31262
|
-
console.error(`Error: Could not read \`${
|
|
31268
|
+
console.error(`Error: Could not read \`${path109}\`.`);
|
|
31263
31269
|
console.error(
|
|
31264
31270
|
"Pass a pull request number, a GitHub pull request URL, - for stdin, or a path to a file."
|
|
31265
31271
|
);
|
|
@@ -31539,10 +31545,10 @@ function resolveOpSecret(reference) {
|
|
|
31539
31545
|
}
|
|
31540
31546
|
|
|
31541
31547
|
// src/commands/ravendb/ravenFetch.ts
|
|
31542
|
-
async function ravenFetch(connection,
|
|
31548
|
+
async function ravenFetch(connection, path109) {
|
|
31543
31549
|
const apiKey = resolveOpSecret(connection.apiKeyRef);
|
|
31544
31550
|
let accessToken = await getAccessToken(apiKey);
|
|
31545
|
-
const url = `${connection.url}${
|
|
31551
|
+
const url = `${connection.url}${path109}`;
|
|
31546
31552
|
const headers = {
|
|
31547
31553
|
Authorization: `Bearer ${accessToken}`,
|
|
31548
31554
|
"Content-Type": "application/json"
|
|
@@ -31632,16 +31638,16 @@ import chalk201 from "chalk";
|
|
|
31632
31638
|
// src/commands/ravendb/buildQueryPath.ts
|
|
31633
31639
|
function buildQueryPath(opts) {
|
|
31634
31640
|
const db = encodeURIComponent(opts.db);
|
|
31635
|
-
let
|
|
31641
|
+
let path109;
|
|
31636
31642
|
if (opts.collection) {
|
|
31637
|
-
|
|
31643
|
+
path109 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
|
|
31638
31644
|
} else {
|
|
31639
|
-
|
|
31645
|
+
path109 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
|
|
31640
31646
|
}
|
|
31641
31647
|
if (opts.query) {
|
|
31642
|
-
|
|
31648
|
+
path109 += `&query=${encodeURIComponent(opts.query)}`;
|
|
31643
31649
|
}
|
|
31644
|
-
return
|
|
31650
|
+
return path109;
|
|
31645
31651
|
}
|
|
31646
31652
|
|
|
31647
31653
|
// src/commands/ravendb/fetchAllPages.ts
|
|
@@ -31650,7 +31656,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
31650
31656
|
let start2 = 0;
|
|
31651
31657
|
while (true) {
|
|
31652
31658
|
const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
|
|
31653
|
-
const
|
|
31659
|
+
const path109 = buildQueryPath({
|
|
31654
31660
|
db: connection.database,
|
|
31655
31661
|
collection: opts.collection,
|
|
31656
31662
|
start: start2,
|
|
@@ -31658,7 +31664,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
31658
31664
|
sort: opts.sort,
|
|
31659
31665
|
query: opts.query
|
|
31660
31666
|
});
|
|
31661
|
-
const data = await ravenFetch(connection,
|
|
31667
|
+
const data = await ravenFetch(connection, path109);
|
|
31662
31668
|
const results = data.Results ?? [];
|
|
31663
31669
|
const totalResults = data.TotalResults ?? 0;
|
|
31664
31670
|
if (results.length === 0) break;
|
|
@@ -34168,8 +34174,8 @@ Renamed ${oldName} \u2192 ${newName}`));
|
|
|
34168
34174
|
|
|
34169
34175
|
// src/commands/refactor/restructure.ts
|
|
34170
34176
|
import fs38 from "fs";
|
|
34171
|
-
import
|
|
34172
|
-
import
|
|
34177
|
+
import path83 from "path";
|
|
34178
|
+
import chalk230 from "chalk";
|
|
34173
34179
|
|
|
34174
34180
|
// src/commands/refactor/restructure/buildPlan.ts
|
|
34175
34181
|
import path73 from "path";
|
|
@@ -34506,7 +34512,7 @@ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
|
|
|
34506
34512
|
}
|
|
34507
34513
|
|
|
34508
34514
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
34509
|
-
import
|
|
34515
|
+
import chalk225 from "chalk";
|
|
34510
34516
|
|
|
34511
34517
|
// src/commands/refactor/restructure/applyCommand.ts
|
|
34512
34518
|
import path74 from "path";
|
|
@@ -34538,7 +34544,7 @@ function displayDrift(plan2, listMoves) {
|
|
|
34538
34544
|
}
|
|
34539
34545
|
|
|
34540
34546
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
34541
|
-
import
|
|
34547
|
+
import chalk224 from "chalk";
|
|
34542
34548
|
|
|
34543
34549
|
// src/commands/refactor/restructure/displayDeepChains.ts
|
|
34544
34550
|
import chalk222 from "chalk";
|
|
@@ -34567,25 +34573,40 @@ Plan exceeds restructure.maxDepth ${maxDepth}: ${tooDeep} file(s) deeper.`
|
|
|
34567
34573
|
console.log(chalk222.dim(` \u2026and ${chains.length - shownChains} more`));
|
|
34568
34574
|
}
|
|
34569
34575
|
|
|
34576
|
+
// src/commands/refactor/restructure/displayLongPaths.ts
|
|
34577
|
+
import chalk223 from "chalk";
|
|
34578
|
+
function displayLongPaths(longPaths, maxPathLength) {
|
|
34579
|
+
if (longPaths.length === 0) return;
|
|
34580
|
+
console.log(
|
|
34581
|
+
chalk223.red(
|
|
34582
|
+
`
|
|
34583
|
+
Plan exceeds restructure.maxPathLength ${maxPathLength}: ${longPaths.length} repo-relative path(s) longer.`
|
|
34584
|
+
)
|
|
34585
|
+
);
|
|
34586
|
+
for (const { path: path109, length } of longPaths)
|
|
34587
|
+
console.log(` ${path109} [${length}]`);
|
|
34588
|
+
}
|
|
34589
|
+
|
|
34570
34590
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
34571
34591
|
function pinSteps(apply) {
|
|
34572
34592
|
return [
|
|
34573
34593
|
"Pin feature modules until this check passes:",
|
|
34574
|
-
"1. On each chain, pick the highest module that is a feature boundary: a route, view, page, panel, dialog or card. Never a hook, utility, style file or helper.",
|
|
34575
|
-
"2. Add it to restructure.pin in assist.yml yourself (basename without extension). One pin at a time: one feature pin often fixes several chains.",
|
|
34576
|
-
"3. Re-run this command. Repeat until the plan is within the
|
|
34577
|
-
"4. If a chain has no sensible feature boundary, stop and report
|
|
34594
|
+
"1. On each deep chain or long path, pick the highest module that is a feature boundary: a route, view, page, panel, dialog or card. Never a hook, utility, style file or helper.",
|
|
34595
|
+
"2. Add it to restructure.pin in assist.yml yourself (basename without extension). One pin at a time: one feature pin often fixes several chains or paths.",
|
|
34596
|
+
"3. Re-run this command. Repeat until the plan is within the limits.",
|
|
34597
|
+
"4. If a chain or path has no sensible feature boundary, stop and report it.",
|
|
34578
34598
|
`Then run \`${apply}\`.`
|
|
34579
34599
|
];
|
|
34580
34600
|
}
|
|
34581
34601
|
function exceedsLayoutLimits(limits) {
|
|
34582
|
-
return limits.chains.length > 0;
|
|
34602
|
+
return limits.chains.length > 0 || limits.longPaths.length > 0;
|
|
34583
34603
|
}
|
|
34584
34604
|
function displayLayoutLimits(limits, apply) {
|
|
34585
34605
|
if (!exceedsLayoutLimits(limits)) return;
|
|
34586
34606
|
displayDeepChains(limits.chains, limits.maxDepth);
|
|
34607
|
+
displayLongPaths(limits.longPaths, limits.maxPathLength);
|
|
34587
34608
|
console.log("");
|
|
34588
|
-
for (const line of pinSteps(apply)) console.log(
|
|
34609
|
+
for (const line of pinSteps(apply)) console.log(chalk224.yellow(line));
|
|
34589
34610
|
}
|
|
34590
34611
|
|
|
34591
34612
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
@@ -34597,14 +34618,14 @@ function checkPlan(plan2, limits) {
|
|
|
34597
34618
|
if (exceeds || plan2.errors.length > 0) process.exit(1);
|
|
34598
34619
|
if (plan2.moves.length > 0) {
|
|
34599
34620
|
console.log(
|
|
34600
|
-
|
|
34621
|
+
chalk225.yellow(
|
|
34601
34622
|
`
|
|
34602
34623
|
Run \`${apply}\` to move the files and rewrite their imports.`
|
|
34603
34624
|
)
|
|
34604
34625
|
);
|
|
34605
34626
|
process.exit(1);
|
|
34606
34627
|
}
|
|
34607
|
-
console.log(
|
|
34628
|
+
console.log(chalk225.green("Layout matches the restructure plan"));
|
|
34608
34629
|
}
|
|
34609
34630
|
|
|
34610
34631
|
// src/commands/refactor/restructure/findDeepChains.ts
|
|
@@ -34645,20 +34666,28 @@ function findDeepChains(targets, scopeRoot, maxDepth) {
|
|
|
34645
34666
|
return [...chains.entries()].sort(([ka, a], [kb, b]) => b.tooDeep - a.tooDeep || ka.localeCompare(kb)).map(([, chain2]) => chain2);
|
|
34646
34667
|
}
|
|
34647
34668
|
|
|
34669
|
+
// src/commands/refactor/restructure/findLongPaths.ts
|
|
34670
|
+
import path77 from "path";
|
|
34671
|
+
function findLongPaths(targets, repoRoot2, maxPathLength) {
|
|
34672
|
+
return [...targets].map((t) => path77.relative(repoRoot2, t).split(path77.sep).join("/")).filter((p) => p.length > maxPathLength).map((p) => ({ path: p, length: p.length })).sort((a, b) => b.length - a.length || a.path.localeCompare(b.path));
|
|
34673
|
+
}
|
|
34674
|
+
|
|
34648
34675
|
// src/commands/refactor/restructure/checkLayoutLimits.ts
|
|
34649
|
-
function checkLayoutLimits(plan2, maxDepth) {
|
|
34676
|
+
function checkLayoutLimits(plan2, { maxDepth, maxPathLength, repoRoot: repoRoot2 }) {
|
|
34650
34677
|
return {
|
|
34651
34678
|
maxDepth,
|
|
34652
|
-
chains: findDeepChains(plan2.targets.values(), plan2.scopeRoot, maxDepth)
|
|
34679
|
+
chains: findDeepChains(plan2.targets.values(), plan2.scopeRoot, maxDepth),
|
|
34680
|
+
maxPathLength,
|
|
34681
|
+
longPaths: findLongPaths(plan2.targets.values(), repoRoot2, maxPathLength)
|
|
34653
34682
|
};
|
|
34654
34683
|
}
|
|
34655
34684
|
|
|
34656
34685
|
// src/commands/refactor/restructure/partitionIgnored.ts
|
|
34657
|
-
import
|
|
34686
|
+
import path78 from "path";
|
|
34658
34687
|
import { minimatch as minimatch4 } from "minimatch";
|
|
34659
34688
|
function partitionIgnored(files) {
|
|
34660
34689
|
const globs = loadConfig().restructure?.ignore ?? [];
|
|
34661
|
-
const isIgnored = (file) => globs.some((glob) => minimatch4(
|
|
34690
|
+
const isIgnored = (file) => globs.some((glob) => minimatch4(path78.relative(process.cwd(), file), glob));
|
|
34662
34691
|
return {
|
|
34663
34692
|
scoped: files.filter((f) => !isIgnored(f)),
|
|
34664
34693
|
ignored: files.filter(isIgnored)
|
|
@@ -34666,17 +34695,17 @@ function partitionIgnored(files) {
|
|
|
34666
34695
|
}
|
|
34667
34696
|
|
|
34668
34697
|
// src/commands/refactor/restructure/runPlan.ts
|
|
34669
|
-
import
|
|
34698
|
+
import chalk229 from "chalk";
|
|
34670
34699
|
|
|
34671
34700
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
34672
|
-
import
|
|
34701
|
+
import chalk227 from "chalk";
|
|
34673
34702
|
|
|
34674
34703
|
// src/commands/refactor/restructure/executePlan.ts
|
|
34675
34704
|
import fs37 from "fs";
|
|
34676
|
-
import
|
|
34677
|
-
import
|
|
34705
|
+
import path79 from "path";
|
|
34706
|
+
import chalk226 from "chalk";
|
|
34678
34707
|
function relPath(file) {
|
|
34679
|
-
return
|
|
34708
|
+
return path79.relative(process.cwd(), file);
|
|
34680
34709
|
}
|
|
34681
34710
|
function stagingPath(move2, index2) {
|
|
34682
34711
|
return `${move2.from}.restructure-${process.pid}-${index2}`;
|
|
@@ -34688,34 +34717,34 @@ function moveFiles(moves) {
|
|
|
34688
34717
|
return { move: move2, staging };
|
|
34689
34718
|
});
|
|
34690
34719
|
for (const { move: move2, staging } of staged) {
|
|
34691
|
-
fs37.mkdirSync(
|
|
34720
|
+
fs37.mkdirSync(path79.dirname(move2.to), { recursive: true });
|
|
34692
34721
|
fs37.renameSync(staging, move2.to);
|
|
34693
34722
|
console.log(
|
|
34694
|
-
|
|
34723
|
+
chalk226.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
|
|
34695
34724
|
);
|
|
34696
34725
|
}
|
|
34697
34726
|
}
|
|
34698
34727
|
function removeIfEmpty(dir) {
|
|
34699
34728
|
if (!fs37.existsSync(dir) || fs37.readdirSync(dir).length > 0) return false;
|
|
34700
34729
|
fs37.rmdirSync(dir);
|
|
34701
|
-
console.log(
|
|
34730
|
+
console.log(chalk226.dim(` Removed empty directory ${relPath(dir)}`));
|
|
34702
34731
|
return true;
|
|
34703
34732
|
}
|
|
34704
34733
|
function removeEmptyDirectories(dirs, scopeRoot) {
|
|
34705
34734
|
const deepestFirst = [...new Set(dirs)].sort((a, b) => b.length - a.length);
|
|
34706
34735
|
for (let dir of deepestFirst) {
|
|
34707
|
-
while (dir.startsWith(`${scopeRoot}${
|
|
34708
|
-
dir =
|
|
34736
|
+
while (dir.startsWith(`${scopeRoot}${path79.sep}`) && removeIfEmpty(dir))
|
|
34737
|
+
dir = path79.dirname(dir);
|
|
34709
34738
|
}
|
|
34710
34739
|
}
|
|
34711
34740
|
function executePlan(plan2) {
|
|
34712
34741
|
for (const [file, content] of applyRewrites(plan2.rewrites)) {
|
|
34713
34742
|
fs37.writeFileSync(file, content, "utf8");
|
|
34714
|
-
console.log(
|
|
34743
|
+
console.log(chalk226.cyan(` Rewrote imports in ${relPath(file)}`));
|
|
34715
34744
|
}
|
|
34716
34745
|
moveFiles(plan2.moves);
|
|
34717
34746
|
removeEmptyDirectories(
|
|
34718
|
-
plan2.moves.map((m) =>
|
|
34747
|
+
plan2.moves.map((m) => path79.dirname(m.from)),
|
|
34719
34748
|
plan2.scopeRoot
|
|
34720
34749
|
);
|
|
34721
34750
|
}
|
|
@@ -34723,26 +34752,26 @@ function executePlan(plan2) {
|
|
|
34723
34752
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
34724
34753
|
function applyPlan(plan2) {
|
|
34725
34754
|
if (plan2.errors.length > 0) {
|
|
34726
|
-
console.log(
|
|
34755
|
+
console.log(chalk227.red("\nResolve the errors above before applying."));
|
|
34727
34756
|
process.exit(1);
|
|
34728
34757
|
}
|
|
34729
|
-
console.log(
|
|
34758
|
+
console.log(chalk227.bold("\nApplying changes..."));
|
|
34730
34759
|
executePlan(plan2);
|
|
34731
|
-
console.log(
|
|
34760
|
+
console.log(chalk227.green("\nRestructuring complete"));
|
|
34732
34761
|
}
|
|
34733
34762
|
|
|
34734
34763
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
34735
|
-
import
|
|
34736
|
-
import
|
|
34764
|
+
import path82 from "path";
|
|
34765
|
+
import chalk228 from "chalk";
|
|
34737
34766
|
|
|
34738
34767
|
// src/commands/refactor/restructure/computeDepthStats.ts
|
|
34739
|
-
import
|
|
34768
|
+
import path80 from "path";
|
|
34740
34769
|
function computeDepthStats(targets, scopeRoot) {
|
|
34741
34770
|
const distribution = /* @__PURE__ */ new Map();
|
|
34742
34771
|
let max = 0;
|
|
34743
34772
|
for (const target of targets) {
|
|
34744
|
-
const dir =
|
|
34745
|
-
const depth = dir === "" ? 0 : dir.split(
|
|
34773
|
+
const dir = path80.relative(scopeRoot, path80.dirname(target));
|
|
34774
|
+
const depth = dir === "" ? 0 : dir.split(path80.sep).length;
|
|
34746
34775
|
distribution.set(depth, (distribution.get(depth) ?? 0) + 1);
|
|
34747
34776
|
max = Math.max(max, depth);
|
|
34748
34777
|
}
|
|
@@ -34750,7 +34779,7 @@ function computeDepthStats(targets, scopeRoot) {
|
|
|
34750
34779
|
}
|
|
34751
34780
|
|
|
34752
34781
|
// src/commands/refactor/restructure/formatTree.ts
|
|
34753
|
-
import
|
|
34782
|
+
import path81 from "path";
|
|
34754
34783
|
function insert(root2, parts) {
|
|
34755
34784
|
let node = root2;
|
|
34756
34785
|
for (const part of parts) {
|
|
@@ -34772,7 +34801,7 @@ function render(node, indent3, lines2) {
|
|
|
34772
34801
|
function formatTree(files, scopeRoot) {
|
|
34773
34802
|
const root2 = /* @__PURE__ */ new Map();
|
|
34774
34803
|
for (const file of files)
|
|
34775
|
-
insert(root2,
|
|
34804
|
+
insert(root2, path81.relative(scopeRoot, file).split(path81.sep));
|
|
34776
34805
|
const lines2 = [];
|
|
34777
34806
|
render(root2, "", lines2);
|
|
34778
34807
|
return lines2;
|
|
@@ -34780,21 +34809,21 @@ function formatTree(files, scopeRoot) {
|
|
|
34780
34809
|
|
|
34781
34810
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
34782
34811
|
function relPath2(filePath) {
|
|
34783
|
-
return
|
|
34812
|
+
return path82.relative(process.cwd(), filePath);
|
|
34784
34813
|
}
|
|
34785
34814
|
function displayMoves(plan2) {
|
|
34786
34815
|
if (plan2.moves.length === 0) return;
|
|
34787
|
-
console.log(
|
|
34816
|
+
console.log(chalk228.bold("\nFile moves:"));
|
|
34788
34817
|
for (const move2 of plan2.moves) {
|
|
34789
34818
|
console.log(
|
|
34790
|
-
` ${
|
|
34819
|
+
` ${chalk228.red(relPath2(move2.from))} \u2192 ${chalk228.green(relPath2(move2.to))}`
|
|
34791
34820
|
);
|
|
34792
|
-
console.log(
|
|
34821
|
+
console.log(chalk228.dim(` ${move2.reason}`));
|
|
34793
34822
|
}
|
|
34794
34823
|
}
|
|
34795
34824
|
function displayTree(plan2) {
|
|
34796
34825
|
console.log(
|
|
34797
|
-
|
|
34826
|
+
chalk228.bold(`
|
|
34798
34827
|
Resulting tree (${relPath2(plan2.scopeRoot) || "."}/):`)
|
|
34799
34828
|
);
|
|
34800
34829
|
for (const line of formatTree(plan2.targets.values(), plan2.scopeRoot))
|
|
@@ -34805,15 +34834,15 @@ function displayDepthStats(plan2) {
|
|
|
34805
34834
|
plan2.targets.values(),
|
|
34806
34835
|
plan2.scopeRoot
|
|
34807
34836
|
);
|
|
34808
|
-
console.log(
|
|
34837
|
+
console.log(chalk228.bold(`
|
|
34809
34838
|
Depth (max ${max}):`));
|
|
34810
34839
|
for (const depth of [...distribution.keys()].sort((a, b) => a - b))
|
|
34811
34840
|
console.log(` ${depth}: ${distribution.get(depth)} file(s)`);
|
|
34812
34841
|
}
|
|
34813
34842
|
function displayErrors(errors) {
|
|
34814
34843
|
if (errors.length === 0) return;
|
|
34815
|
-
console.log(
|
|
34816
|
-
for (const error of errors) console.log(
|
|
34844
|
+
console.log(chalk228.red("\nErrors:"));
|
|
34845
|
+
for (const error of errors) console.log(chalk228.red(` ${error}`));
|
|
34817
34846
|
}
|
|
34818
34847
|
function displayPlan2(plan2) {
|
|
34819
34848
|
displayMoves(plan2);
|
|
@@ -34822,7 +34851,7 @@ function displayPlan2(plan2) {
|
|
|
34822
34851
|
displayErrors(plan2.errors);
|
|
34823
34852
|
const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
|
|
34824
34853
|
console.log(
|
|
34825
|
-
|
|
34854
|
+
chalk228.dim(
|
|
34826
34855
|
`
|
|
34827
34856
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
|
|
34828
34857
|
)
|
|
@@ -34834,11 +34863,11 @@ function runPlan(plan2, limits, apply) {
|
|
|
34834
34863
|
displayPlan2(plan2);
|
|
34835
34864
|
displayLayoutLimits(limits, applyCommand(plan2.scopeRoot));
|
|
34836
34865
|
if (plan2.moves.length === 0 && plan2.errors.length === 0) {
|
|
34837
|
-
console.log(
|
|
34866
|
+
console.log(chalk229.green("No restructuring needed"));
|
|
34838
34867
|
return;
|
|
34839
34868
|
}
|
|
34840
34869
|
if (!apply) {
|
|
34841
|
-
console.log(
|
|
34870
|
+
console.log(chalk229.dim("\nDry run. Use --apply to execute."));
|
|
34842
34871
|
return;
|
|
34843
34872
|
}
|
|
34844
34873
|
applyPlan(plan2);
|
|
@@ -34846,21 +34875,30 @@ function runPlan(plan2, limits, apply) {
|
|
|
34846
34875
|
|
|
34847
34876
|
// src/commands/refactor/restructure.ts
|
|
34848
34877
|
async function restructure(root2, options2 = {}) {
|
|
34849
|
-
const scopeRoot =
|
|
34878
|
+
const scopeRoot = path83.resolve(root2 ?? "src");
|
|
34850
34879
|
if (!fs38.existsSync(scopeRoot) || !fs38.statSync(scopeRoot).isDirectory()) {
|
|
34851
|
-
console.log(
|
|
34880
|
+
console.log(chalk230.red(`Not a directory: ${root2 ?? "src"}`));
|
|
34852
34881
|
process.exit(1);
|
|
34853
34882
|
}
|
|
34854
34883
|
const found = [];
|
|
34855
34884
|
walkSourceFiles(scopeRoot, found);
|
|
34856
34885
|
const { scoped, ignored } = partitionIgnored(found);
|
|
34857
34886
|
if (scoped.length === 0) {
|
|
34858
|
-
console.log(
|
|
34887
|
+
console.log(chalk230.yellow("No files found under root"));
|
|
34859
34888
|
return;
|
|
34860
34889
|
}
|
|
34861
|
-
const {
|
|
34890
|
+
const {
|
|
34891
|
+
pin: pin2 = [],
|
|
34892
|
+
maxDepth = 10,
|
|
34893
|
+
maxPathLength = 200
|
|
34894
|
+
} = loadConfig().restructure ?? {};
|
|
34862
34895
|
const plan2 = buildPlan3(scopeRoot, scoped, ignored, pin2);
|
|
34863
|
-
const
|
|
34896
|
+
const repoRoot2 = tryGit2(`-C "${scopeRoot}" rev-parse --show-toplevel`) ?? process.cwd();
|
|
34897
|
+
const limits = checkLayoutLimits(plan2, {
|
|
34898
|
+
maxDepth,
|
|
34899
|
+
maxPathLength,
|
|
34900
|
+
repoRoot: repoRoot2
|
|
34901
|
+
});
|
|
34864
34902
|
if (options2.check) return checkPlan(plan2, limits);
|
|
34865
34903
|
runPlan(plan2, limits, options2.apply === true);
|
|
34866
34904
|
}
|
|
@@ -34917,7 +34955,7 @@ async function checkoutPrSession(number, prompt = "", permissionMode = "acceptEd
|
|
|
34917
34955
|
}
|
|
34918
34956
|
|
|
34919
34957
|
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
34920
|
-
import
|
|
34958
|
+
import chalk234 from "chalk";
|
|
34921
34959
|
|
|
34922
34960
|
// src/commands/config/promptConfigScope.ts
|
|
34923
34961
|
import Enquirer3 from "enquirer";
|
|
@@ -34943,7 +34981,7 @@ async function promptConfigScope() {
|
|
|
34943
34981
|
}
|
|
34944
34982
|
|
|
34945
34983
|
// src/commands/config/resolveConfigKeyAnswer.ts
|
|
34946
|
-
import
|
|
34984
|
+
import chalk231 from "chalk";
|
|
34947
34985
|
async function resolveConfigKeyAnswer(question, supplied) {
|
|
34948
34986
|
if (supplied !== void 0) return coerceSupplied(question.key, supplied);
|
|
34949
34987
|
for (; ; ) {
|
|
@@ -34951,7 +34989,7 @@ async function resolveConfigKeyAnswer(question, supplied) {
|
|
|
34951
34989
|
if (answer === "") return void 0;
|
|
34952
34990
|
const coercion = coerceCliConfigValue(question.key, answer);
|
|
34953
34991
|
if (coercion.ok) return coercion.value;
|
|
34954
|
-
console.error(
|
|
34992
|
+
console.error(chalk231.red(coercion.error));
|
|
34955
34993
|
}
|
|
34956
34994
|
}
|
|
34957
34995
|
function coerceSupplied(key, supplied) {
|
|
@@ -35018,7 +35056,7 @@ function suggestGlobs(current, proposed) {
|
|
|
35018
35056
|
}
|
|
35019
35057
|
|
|
35020
35058
|
// src/commands/review/highLevel/parseConfigureAnswers.ts
|
|
35021
|
-
import
|
|
35059
|
+
import chalk232 from "chalk";
|
|
35022
35060
|
function parseConfigureAnswers(answers) {
|
|
35023
35061
|
const known = Object.values(highLevelConfigKeys);
|
|
35024
35062
|
const parsed = {};
|
|
@@ -35036,13 +35074,13 @@ function answersCoverEveryKey(answers) {
|
|
|
35036
35074
|
return Object.values(highLevelConfigKeys).every((key) => key in answers);
|
|
35037
35075
|
}
|
|
35038
35076
|
function exitWith(message3) {
|
|
35039
|
-
console.error(
|
|
35077
|
+
console.error(chalk232.red(`Error: ${message3}.`));
|
|
35040
35078
|
process.exit(1);
|
|
35041
35079
|
}
|
|
35042
35080
|
|
|
35043
35081
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
35044
35082
|
import { execFileSync as execFileSync21 } from "child_process";
|
|
35045
|
-
import
|
|
35083
|
+
import chalk233 from "chalk";
|
|
35046
35084
|
|
|
35047
35085
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
35048
35086
|
function buildGlobProposalPrompt(tree) {
|
|
@@ -35135,12 +35173,12 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
35135
35173
|
const tree = summariseRepoTree(cwd);
|
|
35136
35174
|
if (tree === "") return NOTHING_PROPOSED;
|
|
35137
35175
|
console.log(
|
|
35138
|
-
|
|
35176
|
+
chalk233.dim("Asking Claude to propose globs from the repo's own tree...")
|
|
35139
35177
|
);
|
|
35140
35178
|
const output = askClaude(buildGlobProposalPrompt(tree), cwd);
|
|
35141
35179
|
if (output === void 0) {
|
|
35142
35180
|
console.log(
|
|
35143
|
-
|
|
35181
|
+
chalk233.yellow(
|
|
35144
35182
|
"Claude proposed nothing; answer each key from its current value."
|
|
35145
35183
|
)
|
|
35146
35184
|
);
|
|
@@ -35200,25 +35238,25 @@ function asConfigKeyScope(value) {
|
|
|
35200
35238
|
function reportConfigured(result) {
|
|
35201
35239
|
for (const write of result.written)
|
|
35202
35240
|
console.log(
|
|
35203
|
-
|
|
35241
|
+
chalk234.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
|
|
35204
35242
|
);
|
|
35205
|
-
for (const key of result.skipped) console.log(
|
|
35206
|
-
console.log(
|
|
35243
|
+
for (const key of result.skipped) console.log(chalk234.dim(`Left ${key} unset`));
|
|
35244
|
+
console.log(chalk234.dim(`Written to ${result.target}`));
|
|
35207
35245
|
}
|
|
35208
35246
|
|
|
35209
35247
|
// src/commands/review/highLevel/announceSavedReview.ts
|
|
35210
|
-
import
|
|
35248
|
+
import chalk235 from "chalk";
|
|
35211
35249
|
function announceSavedReview(subject, force) {
|
|
35212
35250
|
const head = subject.headSha.slice(0, 7);
|
|
35213
35251
|
if (subject.saved)
|
|
35214
35252
|
console.log(
|
|
35215
|
-
|
|
35253
|
+
chalk235.dim(
|
|
35216
35254
|
`Reopening the review saved for ${head} at ${subject.saved.reviewedAt} (${subject.saved.verdict}); pass --force to start fresh.`
|
|
35217
35255
|
)
|
|
35218
35256
|
);
|
|
35219
35257
|
else if (force)
|
|
35220
35258
|
console.log(
|
|
35221
|
-
|
|
35259
|
+
chalk235.dim(
|
|
35222
35260
|
`Discarding any review saved for ${head} and starting fresh (--force).`
|
|
35223
35261
|
)
|
|
35224
35262
|
);
|
|
@@ -35247,8 +35285,8 @@ function groupFilesByDirectory(files) {
|
|
|
35247
35285
|
}
|
|
35248
35286
|
|
|
35249
35287
|
// src/commands/review/highLevel/buildHighLevelTree.ts
|
|
35250
|
-
function basename24(
|
|
35251
|
-
return
|
|
35288
|
+
function basename24(path109) {
|
|
35289
|
+
return path109.slice(path109.lastIndexOf("/") + 1);
|
|
35252
35290
|
}
|
|
35253
35291
|
function sum(nodes, key) {
|
|
35254
35292
|
return nodes.reduce((total, node) => total + node[key], 0);
|
|
@@ -35271,19 +35309,19 @@ function nodesOf(at2, prefix2) {
|
|
|
35271
35309
|
}
|
|
35272
35310
|
function collapsedDirNode(name, at2, prefix2) {
|
|
35273
35311
|
let label2 = name;
|
|
35274
|
-
let
|
|
35312
|
+
let path109 = prefix2 ? `${prefix2}/${name}` : name;
|
|
35275
35313
|
let node = at2;
|
|
35276
35314
|
while (node.files.length === 0 && node.dirs.size === 1) {
|
|
35277
35315
|
const [childName, child] = [...node.dirs][0];
|
|
35278
35316
|
label2 = `${label2}/${childName}`;
|
|
35279
|
-
|
|
35317
|
+
path109 = `${path109}/${childName}`;
|
|
35280
35318
|
node = child;
|
|
35281
35319
|
}
|
|
35282
|
-
const children = nodesOf(node,
|
|
35320
|
+
const children = nodesOf(node, path109);
|
|
35283
35321
|
return {
|
|
35284
35322
|
kind: "dir",
|
|
35285
35323
|
name: label2,
|
|
35286
|
-
path:
|
|
35324
|
+
path: path109,
|
|
35287
35325
|
additions: sum(children, "additions"),
|
|
35288
35326
|
deletions: sum(children, "deletions"),
|
|
35289
35327
|
children
|
|
@@ -35490,13 +35528,13 @@ function visit(node, context) {
|
|
|
35490
35528
|
}
|
|
35491
35529
|
];
|
|
35492
35530
|
}
|
|
35493
|
-
function extractTestHierarchy(
|
|
35531
|
+
function extractTestHierarchy(path109, text18, changed) {
|
|
35494
35532
|
const project = new Project4({
|
|
35495
35533
|
useInMemoryFileSystem: true,
|
|
35496
35534
|
compilerOptions: { allowJs: true }
|
|
35497
35535
|
});
|
|
35498
|
-
const source = project.createSourceFile(`/${
|
|
35499
|
-
return collect7(source, { path:
|
|
35536
|
+
const source = project.createSourceFile(`/${path109}`, text18);
|
|
35537
|
+
return collect7(source, { path: path109, ...changed ? { changed } : {} });
|
|
35500
35538
|
}
|
|
35501
35539
|
|
|
35502
35540
|
// src/commands/review/highLevel/patchAddedLines.ts
|
|
@@ -35524,8 +35562,8 @@ function testFile(file, repoRoot2) {
|
|
|
35524
35562
|
changed
|
|
35525
35563
|
);
|
|
35526
35564
|
if (tests.length === 0) return [];
|
|
35527
|
-
const { path:
|
|
35528
|
-
return [{ path:
|
|
35565
|
+
const { path: path109, status: status2, additions, deletions, diffUrl: diffUrl2 } = file;
|
|
35566
|
+
return [{ path: path109, status: status2, additions, deletions, diffUrl: diffUrl2, tests }];
|
|
35529
35567
|
}
|
|
35530
35568
|
function collectHighLevelTests(files, testPaths, repoRoot2) {
|
|
35531
35569
|
return files.filter(
|
|
@@ -35714,8 +35752,8 @@ function toStatus(status2) {
|
|
|
35714
35752
|
if (status2 === "removed") return "removed";
|
|
35715
35753
|
return "modified";
|
|
35716
35754
|
}
|
|
35717
|
-
function diffUrl(repo, prNumber,
|
|
35718
|
-
const anchor = createHash4("sha256").update(
|
|
35755
|
+
function diffUrl(repo, prNumber, path109) {
|
|
35756
|
+
const anchor = createHash4("sha256").update(path109).digest("hex");
|
|
35719
35757
|
return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
|
|
35720
35758
|
}
|
|
35721
35759
|
function fetchHighLevelFiles(prNumber, repo) {
|
|
@@ -35774,10 +35812,10 @@ function highLevelReviewPath(repo, headRef, headSha) {
|
|
|
35774
35812
|
|
|
35775
35813
|
// src/commands/review/highLevel/loadHighLevelReview.ts
|
|
35776
35814
|
function loadHighLevelReview(repo, headRef, headSha) {
|
|
35777
|
-
const
|
|
35778
|
-
if (!existsSync66(
|
|
35815
|
+
const path109 = highLevelReviewPath(repo, headRef, headSha);
|
|
35816
|
+
if (!existsSync66(path109)) return void 0;
|
|
35779
35817
|
try {
|
|
35780
|
-
return JSON.parse(readFileSync50(
|
|
35818
|
+
return JSON.parse(readFileSync50(path109, "utf8"));
|
|
35781
35819
|
} catch {
|
|
35782
35820
|
return void 0;
|
|
35783
35821
|
}
|
|
@@ -35788,8 +35826,8 @@ import { minimatch as minimatch8 } from "minimatch";
|
|
|
35788
35826
|
function selectCriticalDiffs(files, criticalPaths) {
|
|
35789
35827
|
if (criticalPaths.length === 0) return [];
|
|
35790
35828
|
return files.filter((file) => criticalPaths.some((glob) => minimatch8(file.path, glob))).map(
|
|
35791
|
-
({ path:
|
|
35792
|
-
path:
|
|
35829
|
+
({ path: path109, status: status2, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
|
|
35830
|
+
path: path109,
|
|
35793
35831
|
status: status2,
|
|
35794
35832
|
additions,
|
|
35795
35833
|
deletions,
|
|
@@ -35843,11 +35881,11 @@ import { randomUUID as randomUUID19 } from "crypto";
|
|
|
35843
35881
|
// src/commands/review/highLevel/indexHighLevelTests.ts
|
|
35844
35882
|
function indexHighLevelTests(files) {
|
|
35845
35883
|
const index2 = /* @__PURE__ */ new Map();
|
|
35846
|
-
const walk2 = (
|
|
35884
|
+
const walk2 = (path109, node, parents) => {
|
|
35847
35885
|
const title = [...parents, node.name];
|
|
35848
35886
|
if (node.kind === "it")
|
|
35849
|
-
index2.set(node.id, { path:
|
|
35850
|
-
else for (const child of node.children) walk2(
|
|
35887
|
+
index2.set(node.id, { path: path109, line: node.line, title });
|
|
35888
|
+
else for (const child of node.children) walk2(path109, child, title);
|
|
35851
35889
|
};
|
|
35852
35890
|
for (const file of files)
|
|
35853
35891
|
for (const node of file.tests) walk2(file.path, node, []);
|
|
@@ -35957,11 +35995,11 @@ function highLevelPreviewPayload(subject) {
|
|
|
35957
35995
|
import { mkdirSync as mkdirSync23, writeFileSync as writeFileSync40 } from "fs";
|
|
35958
35996
|
import { dirname as dirname38 } from "path";
|
|
35959
35997
|
function saveHighLevelReview(record) {
|
|
35960
|
-
const
|
|
35961
|
-
mkdirSync23(dirname38(
|
|
35962
|
-
writeFileSync40(
|
|
35998
|
+
const path109 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
|
|
35999
|
+
mkdirSync23(dirname38(path109), { recursive: true });
|
|
36000
|
+
writeFileSync40(path109, `${JSON.stringify(record, null, 2)}
|
|
35963
36001
|
`);
|
|
35964
|
-
return
|
|
36002
|
+
return path109;
|
|
35965
36003
|
}
|
|
35966
36004
|
|
|
35967
36005
|
// src/commands/review/highLevel/openHighLevelOverlay.ts
|
|
@@ -35980,63 +36018,63 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
35980
36018
|
{ rejectIsOutcome: true }
|
|
35981
36019
|
);
|
|
35982
36020
|
const record = buildHighLevelRecord(subject, decision);
|
|
35983
|
-
const
|
|
36021
|
+
const path109 = saveHighLevelReview(record);
|
|
35984
36022
|
console.log(`Verdict: ${record.verdict}`);
|
|
35985
|
-
console.log(`Saved ${
|
|
36023
|
+
console.log(`Saved ${path109}`);
|
|
35986
36024
|
console.log("Nothing was posted to GitHub.");
|
|
35987
36025
|
return record;
|
|
35988
36026
|
}
|
|
35989
36027
|
|
|
35990
36028
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
35991
|
-
import
|
|
36029
|
+
import chalk240 from "chalk";
|
|
35992
36030
|
|
|
35993
36031
|
// src/commands/review/highLevel/formatCriticalDiffs.ts
|
|
35994
|
-
import
|
|
36032
|
+
import chalk236 from "chalk";
|
|
35995
36033
|
var PATCH_LINE_COLOURS = {
|
|
35996
|
-
"+":
|
|
35997
|
-
"-":
|
|
35998
|
-
"@":
|
|
36034
|
+
"+": chalk236.green,
|
|
36035
|
+
"-": chalk236.red,
|
|
36036
|
+
"@": chalk236.cyan
|
|
35999
36037
|
};
|
|
36000
36038
|
function formatPatch(patch2) {
|
|
36001
36039
|
return patch2.split("\n").map(
|
|
36002
|
-
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ??
|
|
36040
|
+
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk236.dim)(line)}`
|
|
36003
36041
|
);
|
|
36004
36042
|
}
|
|
36005
36043
|
function formatDiff(diff3) {
|
|
36006
36044
|
return [
|
|
36007
36045
|
"",
|
|
36008
|
-
` ${
|
|
36009
|
-
...diff3.patch === null ? [` ${
|
|
36046
|
+
` ${chalk236.bold(diff3.path)} ${chalk236.dim(`(${diff3.status})`)} ${chalk236.green(`+${diff3.additions}`)} ${chalk236.red(`-${diff3.deletions}`)}`,
|
|
36047
|
+
...diff3.patch === null ? [` ${chalk236.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
|
|
36010
36048
|
];
|
|
36011
36049
|
}
|
|
36012
36050
|
function formatCriticalDiffs(diffs, criticalPaths) {
|
|
36013
36051
|
if (criticalPaths.length === 0)
|
|
36014
|
-
return `${
|
|
36015
|
-
${
|
|
36052
|
+
return `${chalk236.bold.underline("Critical diffs")}
|
|
36053
|
+
${chalk236.dim("review.highLevel.criticalPaths is unset, so no diffs are shown")}`;
|
|
36016
36054
|
if (diffs.length === 0)
|
|
36017
|
-
return `${
|
|
36018
|
-
${
|
|
36055
|
+
return `${chalk236.bold.underline("Critical diffs")}
|
|
36056
|
+
${chalk236.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
|
|
36019
36057
|
return [
|
|
36020
|
-
|
|
36058
|
+
chalk236.bold.underline("Critical diffs"),
|
|
36021
36059
|
...diffs.flatMap(formatDiff)
|
|
36022
36060
|
].join("\n");
|
|
36023
36061
|
}
|
|
36024
36062
|
|
|
36025
36063
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
36026
|
-
import
|
|
36064
|
+
import chalk237 from "chalk";
|
|
36027
36065
|
var MARKERS = {
|
|
36028
|
-
pass: () =>
|
|
36029
|
-
fail: () =>
|
|
36030
|
-
manual: () =>
|
|
36066
|
+
pass: () => chalk237.green("\u2714"),
|
|
36067
|
+
fail: () => chalk237.red("\u2718"),
|
|
36068
|
+
manual: () => chalk237.yellow("\u25A1")
|
|
36031
36069
|
};
|
|
36032
36070
|
function formatCheck(check2) {
|
|
36033
|
-
const title = check2.status === "fail" ?
|
|
36071
|
+
const title = check2.status === "fail" ? chalk237.red(check2.title) : chalk237.bold(check2.title);
|
|
36034
36072
|
return ` ${MARKERS[check2.status]()} ${title}
|
|
36035
|
-
${
|
|
36073
|
+
${chalk237.dim(check2.reason)}`;
|
|
36036
36074
|
}
|
|
36037
36075
|
function formatGroup(heading2, checks2) {
|
|
36038
36076
|
if (checks2.length === 0) return [];
|
|
36039
|
-
return ["",
|
|
36077
|
+
return ["", chalk237.bold.underline(heading2), ...checks2.map(formatCheck)];
|
|
36040
36078
|
}
|
|
36041
36079
|
function formatHighLevelChecklist(checks2) {
|
|
36042
36080
|
const deterministic = checks2.filter(
|
|
@@ -36045,7 +36083,7 @@ function formatHighLevelChecklist(checks2) {
|
|
|
36045
36083
|
const failed3 = deterministic.filter(
|
|
36046
36084
|
(check2) => check2.status === "fail"
|
|
36047
36085
|
).length;
|
|
36048
|
-
const summary = failed3 === 0 ?
|
|
36086
|
+
const summary = failed3 === 0 ? chalk237.green(`All ${deterministic.length} deterministic checks pass`) : chalk237.red(
|
|
36049
36087
|
`${failed3} of ${deterministic.length} deterministic checks fail`
|
|
36050
36088
|
);
|
|
36051
36089
|
return [
|
|
@@ -36060,37 +36098,37 @@ function formatHighLevelChecklist(checks2) {
|
|
|
36060
36098
|
}
|
|
36061
36099
|
|
|
36062
36100
|
// src/commands/review/highLevel/formatHighLevelStructure.ts
|
|
36063
|
-
import
|
|
36101
|
+
import chalk238 from "chalk";
|
|
36064
36102
|
var STATUS_MARKERS = {
|
|
36065
|
-
added: () =>
|
|
36066
|
-
removed: () =>
|
|
36067
|
-
modified: () =>
|
|
36103
|
+
added: () => chalk238.green("A"),
|
|
36104
|
+
removed: () => chalk238.red("D"),
|
|
36105
|
+
modified: () => chalk238.yellow("M")
|
|
36068
36106
|
};
|
|
36069
36107
|
function counts(additions, deletions) {
|
|
36070
|
-
return `${
|
|
36108
|
+
return `${chalk238.green(`+${additions}`)} ${chalk238.red(`-${deletions}`)}`;
|
|
36071
36109
|
}
|
|
36072
36110
|
function formatNode(node, indent3) {
|
|
36073
36111
|
if (node.kind === "file")
|
|
36074
36112
|
return [
|
|
36075
|
-
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${
|
|
36113
|
+
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk238.dim(counts(node.additions, node.deletions))}`
|
|
36076
36114
|
];
|
|
36077
36115
|
const dir = node;
|
|
36078
36116
|
return [
|
|
36079
|
-
`${indent3}${
|
|
36117
|
+
`${indent3}${chalk238.bold(`${dir.name}/`)} ${chalk238.dim(counts(dir.additions, dir.deletions))}`,
|
|
36080
36118
|
...dir.children.flatMap((child) => formatNode(child, `${indent3} `))
|
|
36081
36119
|
];
|
|
36082
36120
|
}
|
|
36083
36121
|
function formatHighLevelStructure(structure) {
|
|
36084
36122
|
const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
|
|
36085
36123
|
return [
|
|
36086
|
-
|
|
36124
|
+
chalk238.bold.underline("Structure"),
|
|
36087
36125
|
` ${summary}`,
|
|
36088
36126
|
...structure.tree.flatMap((node) => formatNode(node, " "))
|
|
36089
36127
|
].join("\n");
|
|
36090
36128
|
}
|
|
36091
36129
|
|
|
36092
36130
|
// src/commands/review/highLevel/formatHighLevelTests.ts
|
|
36093
|
-
import
|
|
36131
|
+
import chalk239 from "chalk";
|
|
36094
36132
|
function changeMarker(change) {
|
|
36095
36133
|
if (change === "added") return "A";
|
|
36096
36134
|
if (change === "modified") return "M";
|
|
@@ -36099,22 +36137,22 @@ function changeMarker(change) {
|
|
|
36099
36137
|
function formatNode2(node, depth) {
|
|
36100
36138
|
const indent3 = " ".repeat(depth + 2);
|
|
36101
36139
|
if (node.kind === "it")
|
|
36102
|
-
return [`${indent3}${
|
|
36140
|
+
return [`${indent3}${chalk239.dim(changeMarker(node.change))} ${node.name}`];
|
|
36103
36141
|
return [
|
|
36104
|
-
`${indent3}${
|
|
36142
|
+
`${indent3}${chalk239.bold(node.name)}`,
|
|
36105
36143
|
...node.children.flatMap((child) => formatNode2(child, depth + 1))
|
|
36106
36144
|
];
|
|
36107
36145
|
}
|
|
36108
36146
|
function formatHighLevelTests(files, testPaths) {
|
|
36109
|
-
const heading2 =
|
|
36147
|
+
const heading2 = chalk239.bold.underline("Changed tests");
|
|
36110
36148
|
if (files.length === 0)
|
|
36111
36149
|
return `${heading2}
|
|
36112
|
-
${
|
|
36150
|
+
${chalk239.dim(`no changed test in files matching ${testPaths.join(", ")}`)}`;
|
|
36113
36151
|
return [
|
|
36114
36152
|
heading2,
|
|
36115
36153
|
...files.flatMap((file) => [
|
|
36116
36154
|
"",
|
|
36117
|
-
` ${
|
|
36155
|
+
` ${chalk239.bold(file.path)} ${chalk239.dim(`(${file.status})`)}`,
|
|
36118
36156
|
...file.tests.flatMap((node) => formatNode2(node, 0))
|
|
36119
36157
|
])
|
|
36120
36158
|
].join("\n");
|
|
@@ -36123,10 +36161,10 @@ function formatHighLevelTests(files, testPaths) {
|
|
|
36123
36161
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
36124
36162
|
function printHighLevelChecklist(subject) {
|
|
36125
36163
|
console.log(
|
|
36126
|
-
|
|
36164
|
+
chalk240.bold(
|
|
36127
36165
|
`High-level review of ${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`
|
|
36128
36166
|
),
|
|
36129
|
-
|
|
36167
|
+
chalk240.dim(
|
|
36130
36168
|
`\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
|
|
36131
36169
|
)
|
|
36132
36170
|
);
|
|
@@ -36140,12 +36178,12 @@ function printHighLevelChecklist(subject) {
|
|
|
36140
36178
|
console.log("");
|
|
36141
36179
|
console.log(formatHighLevelTests(subject.tests, subject.testPaths));
|
|
36142
36180
|
console.log(
|
|
36143
|
-
|
|
36181
|
+
chalk240.dim(
|
|
36144
36182
|
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
36145
36183
|
)
|
|
36146
36184
|
);
|
|
36147
36185
|
console.log(
|
|
36148
|
-
|
|
36186
|
+
chalk240.dim(
|
|
36149
36187
|
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
36150
36188
|
)
|
|
36151
36189
|
);
|
|
@@ -36420,18 +36458,18 @@ function partitionFindingsByDiff(findings, index2) {
|
|
|
36420
36458
|
}
|
|
36421
36459
|
|
|
36422
36460
|
// src/commands/review/warnOutOfDiff.ts
|
|
36423
|
-
import
|
|
36461
|
+
import chalk241 from "chalk";
|
|
36424
36462
|
function warnOutOfDiff(outOfDiff) {
|
|
36425
36463
|
if (outOfDiff.length === 0) return;
|
|
36426
36464
|
console.warn(
|
|
36427
|
-
|
|
36465
|
+
chalk241.yellow(
|
|
36428
36466
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
36429
36467
|
)
|
|
36430
36468
|
);
|
|
36431
36469
|
for (const finding of outOfDiff) {
|
|
36432
36470
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
36433
36471
|
console.warn(
|
|
36434
|
-
` ${
|
|
36472
|
+
` ${chalk241.yellow("\xB7")} ${finding.title} ${chalk241.dim(
|
|
36435
36473
|
`(${finding.file}:${range})`
|
|
36436
36474
|
)}`
|
|
36437
36475
|
);
|
|
@@ -36455,18 +36493,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
36455
36493
|
}
|
|
36456
36494
|
|
|
36457
36495
|
// src/commands/review/warnUnlocated.ts
|
|
36458
|
-
import
|
|
36496
|
+
import chalk242 from "chalk";
|
|
36459
36497
|
function warnUnlocated(unlocated) {
|
|
36460
36498
|
if (unlocated.length === 0) return;
|
|
36461
36499
|
console.warn(
|
|
36462
|
-
|
|
36500
|
+
chalk242.yellow(
|
|
36463
36501
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
36464
36502
|
)
|
|
36465
36503
|
);
|
|
36466
36504
|
for (const finding of unlocated) {
|
|
36467
|
-
const where = finding.location ||
|
|
36505
|
+
const where = finding.location || chalk242.dim("missing");
|
|
36468
36506
|
console.warn(
|
|
36469
|
-
` ${
|
|
36507
|
+
` ${chalk242.yellow("\xB7")} ${finding.title} ${chalk242.dim(`(${where})`)}`
|
|
36470
36508
|
);
|
|
36471
36509
|
}
|
|
36472
36510
|
}
|
|
@@ -38044,8 +38082,8 @@ function fetchExistingComments() {
|
|
|
38044
38082
|
// src/commands/review/prepareReviewDir.ts
|
|
38045
38083
|
import { existsSync as existsSync69, mkdirSync as mkdirSync25, unlinkSync as unlinkSync20, writeFileSync as writeFileSync42 } from "fs";
|
|
38046
38084
|
function clearReviewFiles(paths) {
|
|
38047
|
-
for (const
|
|
38048
|
-
if (existsSync69(
|
|
38085
|
+
for (const path109 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
38086
|
+
if (existsSync69(path109)) unlinkSync20(path109);
|
|
38049
38087
|
}
|
|
38050
38088
|
}
|
|
38051
38089
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -38371,8 +38409,8 @@ function registerReview(program2) {
|
|
|
38371
38409
|
|
|
38372
38410
|
// src/commands/rules/addRule.ts
|
|
38373
38411
|
import { existsSync as existsSync72, readFileSync as readFileSync57, writeFileSync as writeFileSync44 } from "fs";
|
|
38374
|
-
import
|
|
38375
|
-
import
|
|
38412
|
+
import path88 from "path";
|
|
38413
|
+
import chalk243 from "chalk";
|
|
38376
38414
|
|
|
38377
38415
|
// src/commands/rules/insertRuleBullet.ts
|
|
38378
38416
|
function ruleBullet({ code, title, text: text18 }) {
|
|
@@ -38399,7 +38437,7 @@ import { readFileSync as readFileSync54 } from "fs";
|
|
|
38399
38437
|
|
|
38400
38438
|
// src/commands/rules/findClaudeFiles.ts
|
|
38401
38439
|
import { readdirSync as readdirSync13 } from "fs";
|
|
38402
|
-
import
|
|
38440
|
+
import path84 from "path";
|
|
38403
38441
|
var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
|
|
38404
38442
|
function findClaudeFiles(dir) {
|
|
38405
38443
|
const results = [];
|
|
@@ -38407,9 +38445,9 @@ function findClaudeFiles(dir) {
|
|
|
38407
38445
|
if (entry.isDirectory()) {
|
|
38408
38446
|
if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
|
|
38409
38447
|
continue;
|
|
38410
|
-
results.push(...findClaudeFiles(
|
|
38448
|
+
results.push(...findClaudeFiles(path84.join(dir, entry.name)));
|
|
38411
38449
|
} else if (entry.name === "CLAUDE.md") {
|
|
38412
|
-
results.push(
|
|
38450
|
+
results.push(path84.join(dir, entry.name));
|
|
38413
38451
|
}
|
|
38414
38452
|
}
|
|
38415
38453
|
return results;
|
|
@@ -38428,34 +38466,34 @@ function nextRuleCode(root2) {
|
|
|
38428
38466
|
|
|
38429
38467
|
// src/commands/rules/resolveRuleScope.ts
|
|
38430
38468
|
import { existsSync as existsSync70 } from "fs";
|
|
38431
|
-
import
|
|
38469
|
+
import path85 from "path";
|
|
38432
38470
|
function resolveRuleScope(target) {
|
|
38433
|
-
const resolved =
|
|
38434
|
-
if (
|
|
38471
|
+
const resolved = path85.resolve(target);
|
|
38472
|
+
if (path85.basename(resolved) === "CLAUDE.md") return resolved;
|
|
38435
38473
|
const startDir = scopeDirectory(resolved);
|
|
38436
38474
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
38437
38475
|
let current = startDir;
|
|
38438
38476
|
while (true) {
|
|
38439
|
-
const candidate =
|
|
38477
|
+
const candidate = path85.join(current, "CLAUDE.md");
|
|
38440
38478
|
if (existsSync70(candidate)) return candidate;
|
|
38441
|
-
if (current === root2 || current ===
|
|
38442
|
-
current =
|
|
38479
|
+
if (current === root2 || current === path85.dirname(current)) break;
|
|
38480
|
+
current = path85.dirname(current);
|
|
38443
38481
|
}
|
|
38444
|
-
return
|
|
38482
|
+
return path85.join(root2, "CLAUDE.md");
|
|
38445
38483
|
}
|
|
38446
38484
|
|
|
38447
38485
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
38448
38486
|
import { existsSync as existsSync71, readFileSync as readFileSync56, writeFileSync as writeFileSync43 } from "fs";
|
|
38449
|
-
import
|
|
38487
|
+
import path87 from "path";
|
|
38450
38488
|
|
|
38451
38489
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
38452
38490
|
import { readFileSync as readFileSync55 } from "fs";
|
|
38453
|
-
import
|
|
38491
|
+
import path86 from "path";
|
|
38454
38492
|
function scopedRuleDirectories(root2) {
|
|
38455
38493
|
return findClaudeFiles(root2).filter(
|
|
38456
|
-
(file) =>
|
|
38494
|
+
(file) => path86.dirname(file) !== root2 && parseRulesSection(readFileSync55(file, "utf8")).length > 0
|
|
38457
38495
|
).map(
|
|
38458
|
-
(file) => `${
|
|
38496
|
+
(file) => `${path86.relative(root2, path86.dirname(file)).split(path86.sep).join("/")}/`
|
|
38459
38497
|
).sort();
|
|
38460
38498
|
}
|
|
38461
38499
|
|
|
@@ -38494,7 +38532,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
38494
38532
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
38495
38533
|
function updateScopedRulesIndex(root2) {
|
|
38496
38534
|
const directories = scopedRuleDirectories(root2);
|
|
38497
|
-
const rootFile =
|
|
38535
|
+
const rootFile = path87.join(root2, "CLAUDE.md");
|
|
38498
38536
|
const before = existsSync71(rootFile) ? readFileSync56(rootFile, "utf8") : "";
|
|
38499
38537
|
const after = upsertScopedRulesPointer(before, directories);
|
|
38500
38538
|
if (after !== before) writeFileSync43(rootFile, after);
|
|
@@ -38508,12 +38546,12 @@ function read2(file) {
|
|
|
38508
38546
|
function addRule(text18, options2) {
|
|
38509
38547
|
const rule = text18.trim();
|
|
38510
38548
|
if (rule === "") {
|
|
38511
|
-
console.error(
|
|
38549
|
+
console.error(chalk243.red("Rule text is required"));
|
|
38512
38550
|
process.exitCode = 1;
|
|
38513
38551
|
return;
|
|
38514
38552
|
}
|
|
38515
38553
|
const target = resolveRuleScope(options2.scope ?? process.cwd());
|
|
38516
|
-
const targetDir =
|
|
38554
|
+
const targetDir = path88.dirname(target);
|
|
38517
38555
|
const root2 = findRepoRoot(targetDir) ?? targetDir;
|
|
38518
38556
|
const code = nextRuleCode(root2);
|
|
38519
38557
|
writeFileSync44(
|
|
@@ -38526,38 +38564,38 @@ function addRule(text18, options2) {
|
|
|
38526
38564
|
);
|
|
38527
38565
|
updateScopedRulesIndex(root2);
|
|
38528
38566
|
console.log(
|
|
38529
|
-
`Added ${
|
|
38567
|
+
`Added ${chalk243.cyan(code)} to ${path88.relative(process.cwd(), target) || target}`
|
|
38530
38568
|
);
|
|
38531
38569
|
}
|
|
38532
38570
|
|
|
38533
38571
|
// src/commands/rules/indexRules.ts
|
|
38534
|
-
import
|
|
38535
|
-
import
|
|
38572
|
+
import path89 from "path";
|
|
38573
|
+
import chalk244 from "chalk";
|
|
38536
38574
|
function indexRules() {
|
|
38537
38575
|
const startDir = scopeDirectory(process.cwd());
|
|
38538
38576
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
38539
38577
|
const directories = updateScopedRulesIndex(root2);
|
|
38540
|
-
const rootFile =
|
|
38578
|
+
const rootFile = path89.relative(process.cwd(), path89.join(root2, "CLAUDE.md"));
|
|
38541
38579
|
if (directories.length === 0) {
|
|
38542
38580
|
console.log(
|
|
38543
|
-
|
|
38581
|
+
chalk244.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
38544
38582
|
);
|
|
38545
38583
|
return;
|
|
38546
38584
|
}
|
|
38547
38585
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
38548
38586
|
for (const directory of directories)
|
|
38549
|
-
console.log(` ${
|
|
38587
|
+
console.log(` ${chalk244.cyan(directory)}`);
|
|
38550
38588
|
}
|
|
38551
38589
|
|
|
38552
38590
|
// src/commands/rules/listRules.ts
|
|
38553
|
-
import
|
|
38554
|
-
import
|
|
38591
|
+
import path90 from "path";
|
|
38592
|
+
import chalk245 from "chalk";
|
|
38555
38593
|
function listRules(target, options2 = {}) {
|
|
38556
|
-
const resolved =
|
|
38594
|
+
const resolved = path90.resolve(target ?? process.cwd());
|
|
38557
38595
|
const rules2 = readScopedRules(resolved);
|
|
38558
38596
|
if (rules2.length === 0) {
|
|
38559
|
-
const label2 =
|
|
38560
|
-
console.log(
|
|
38597
|
+
const label2 = path90.relative(process.cwd(), resolved) || ".";
|
|
38598
|
+
console.log(chalk245.gray(`No rules in scope for ${label2}`));
|
|
38561
38599
|
return;
|
|
38562
38600
|
}
|
|
38563
38601
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -38567,14 +38605,14 @@ function listRules(target, options2 = {}) {
|
|
|
38567
38605
|
if (rule.source !== shown) {
|
|
38568
38606
|
shown = rule.source;
|
|
38569
38607
|
console.log(
|
|
38570
|
-
|
|
38608
|
+
chalk245.dim(base ? path90.relative(base, rule.source) : rule.source)
|
|
38571
38609
|
);
|
|
38572
38610
|
}
|
|
38573
38611
|
console.log(
|
|
38574
|
-
` ${
|
|
38612
|
+
` ${chalk245.cyan(rule.code.padEnd(width))} ${rule.title ?? rule.text}`
|
|
38575
38613
|
);
|
|
38576
38614
|
if (options2.full && rule.title)
|
|
38577
|
-
console.log(` ${" ".repeat(width)} ${
|
|
38615
|
+
console.log(` ${" ".repeat(width)} ${chalk245.dim(rule.text)}`);
|
|
38578
38616
|
}
|
|
38579
38617
|
}
|
|
38580
38618
|
|
|
@@ -38603,7 +38641,7 @@ function registerRules(program2) {
|
|
|
38603
38641
|
}
|
|
38604
38642
|
|
|
38605
38643
|
// src/commands/seq/seqAuth.ts
|
|
38606
|
-
import
|
|
38644
|
+
import chalk247 from "chalk";
|
|
38607
38645
|
|
|
38608
38646
|
// src/commands/seq/loadConnections.ts
|
|
38609
38647
|
function loadConnections2() {
|
|
@@ -38632,10 +38670,10 @@ function setDefaultConnection(name) {
|
|
|
38632
38670
|
}
|
|
38633
38671
|
|
|
38634
38672
|
// src/shared/assertUniqueName.ts
|
|
38635
|
-
import
|
|
38673
|
+
import chalk246 from "chalk";
|
|
38636
38674
|
function assertUniqueName(existingNames, name) {
|
|
38637
38675
|
if (existingNames.includes(name)) {
|
|
38638
|
-
console.error(
|
|
38676
|
+
console.error(chalk246.red(`Connection "${name}" already exists.`));
|
|
38639
38677
|
process.exit(1);
|
|
38640
38678
|
}
|
|
38641
38679
|
}
|
|
@@ -38653,18 +38691,18 @@ async function promptConnection2(existingNames) {
|
|
|
38653
38691
|
var seqAuth = createConnectionAuth({
|
|
38654
38692
|
load: loadConnections2,
|
|
38655
38693
|
save: saveConnections2,
|
|
38656
|
-
format: (c) => `${
|
|
38694
|
+
format: (c) => `${chalk247.bold(c.name)} ${c.url}`,
|
|
38657
38695
|
promptNew: promptConnection2,
|
|
38658
38696
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
38659
38697
|
});
|
|
38660
38698
|
|
|
38661
38699
|
// src/commands/seq/seqQuery.ts
|
|
38662
|
-
import
|
|
38700
|
+
import chalk251 from "chalk";
|
|
38663
38701
|
|
|
38664
38702
|
// src/commands/seq/fetchSeq.ts
|
|
38665
|
-
import
|
|
38666
|
-
async function fetchSeq(conn,
|
|
38667
|
-
const url = `${conn.url}${
|
|
38703
|
+
import chalk248 from "chalk";
|
|
38704
|
+
async function fetchSeq(conn, path109, params) {
|
|
38705
|
+
const url = `${conn.url}${path109}?${params}`;
|
|
38668
38706
|
const response = await fetch(url, {
|
|
38669
38707
|
headers: {
|
|
38670
38708
|
Accept: "application/json",
|
|
@@ -38673,7 +38711,7 @@ async function fetchSeq(conn, path108, params) {
|
|
|
38673
38711
|
});
|
|
38674
38712
|
if (!response.ok) {
|
|
38675
38713
|
const body = await response.text();
|
|
38676
|
-
console.error(
|
|
38714
|
+
console.error(chalk248.red(`Seq returned ${response.status}: ${body}`));
|
|
38677
38715
|
process.exit(1);
|
|
38678
38716
|
}
|
|
38679
38717
|
return response;
|
|
@@ -38732,23 +38770,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
38732
38770
|
}
|
|
38733
38771
|
|
|
38734
38772
|
// src/commands/seq/formatEvent.ts
|
|
38735
|
-
import
|
|
38773
|
+
import chalk249 from "chalk";
|
|
38736
38774
|
function levelColor(level) {
|
|
38737
38775
|
switch (level) {
|
|
38738
38776
|
case "Fatal":
|
|
38739
|
-
return
|
|
38777
|
+
return chalk249.bgRed.white;
|
|
38740
38778
|
case "Error":
|
|
38741
|
-
return
|
|
38779
|
+
return chalk249.red;
|
|
38742
38780
|
case "Warning":
|
|
38743
|
-
return
|
|
38781
|
+
return chalk249.yellow;
|
|
38744
38782
|
case "Information":
|
|
38745
|
-
return
|
|
38783
|
+
return chalk249.cyan;
|
|
38746
38784
|
case "Debug":
|
|
38747
|
-
return
|
|
38785
|
+
return chalk249.gray;
|
|
38748
38786
|
case "Verbose":
|
|
38749
|
-
return
|
|
38787
|
+
return chalk249.dim;
|
|
38750
38788
|
default:
|
|
38751
|
-
return
|
|
38789
|
+
return chalk249.white;
|
|
38752
38790
|
}
|
|
38753
38791
|
}
|
|
38754
38792
|
function levelAbbrev(level) {
|
|
@@ -38789,12 +38827,12 @@ function formatTimestamp(iso) {
|
|
|
38789
38827
|
function formatEvent(event) {
|
|
38790
38828
|
const color = levelColor(event.Level);
|
|
38791
38829
|
const abbrev = levelAbbrev(event.Level);
|
|
38792
|
-
const ts10 =
|
|
38830
|
+
const ts10 = chalk249.dim(formatTimestamp(event.Timestamp));
|
|
38793
38831
|
const msg = renderMessage(event);
|
|
38794
38832
|
const lines2 = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
|
|
38795
38833
|
if (event.Exception) {
|
|
38796
38834
|
for (const line of event.Exception.split("\n")) {
|
|
38797
|
-
lines2.push(
|
|
38835
|
+
lines2.push(chalk249.red(` ${line}`));
|
|
38798
38836
|
}
|
|
38799
38837
|
}
|
|
38800
38838
|
return lines2.join("\n");
|
|
@@ -38827,11 +38865,11 @@ function rejectTimestampFilter(filter) {
|
|
|
38827
38865
|
}
|
|
38828
38866
|
|
|
38829
38867
|
// src/shared/resolveNamedConnection.ts
|
|
38830
|
-
import
|
|
38868
|
+
import chalk250 from "chalk";
|
|
38831
38869
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
38832
38870
|
if (connections.length === 0) {
|
|
38833
38871
|
console.error(
|
|
38834
|
-
|
|
38872
|
+
chalk250.red(
|
|
38835
38873
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
38836
38874
|
)
|
|
38837
38875
|
);
|
|
@@ -38840,7 +38878,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
38840
38878
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
38841
38879
|
const connection = connections.find((c) => c.name === target);
|
|
38842
38880
|
if (!connection) {
|
|
38843
|
-
console.error(
|
|
38881
|
+
console.error(chalk250.red(`${kind} connection "${target}" not found.`));
|
|
38844
38882
|
process.exit(1);
|
|
38845
38883
|
}
|
|
38846
38884
|
return connection;
|
|
@@ -38869,7 +38907,7 @@ async function seqQuery(filter, options2) {
|
|
|
38869
38907
|
new URLSearchParams({ filter, count: String(count8) })
|
|
38870
38908
|
);
|
|
38871
38909
|
if (events.length === 0) {
|
|
38872
|
-
console.log(
|
|
38910
|
+
console.log(chalk251.yellow("No events found."));
|
|
38873
38911
|
return;
|
|
38874
38912
|
}
|
|
38875
38913
|
if (options2.json) {
|
|
@@ -38880,11 +38918,11 @@ async function seqQuery(filter, options2) {
|
|
|
38880
38918
|
for (const event of chronological) {
|
|
38881
38919
|
console.log(formatEvent(event));
|
|
38882
38920
|
}
|
|
38883
|
-
console.log(
|
|
38921
|
+
console.log(chalk251.dim(`
|
|
38884
38922
|
${events.length} events`));
|
|
38885
38923
|
if (events.length >= count8) {
|
|
38886
38924
|
console.log(
|
|
38887
|
-
|
|
38925
|
+
chalk251.yellow(
|
|
38888
38926
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
38889
38927
|
)
|
|
38890
38928
|
);
|
|
@@ -38892,10 +38930,10 @@ ${events.length} events`));
|
|
|
38892
38930
|
}
|
|
38893
38931
|
|
|
38894
38932
|
// src/shared/setNamedDefaultConnection.ts
|
|
38895
|
-
import
|
|
38933
|
+
import chalk252 from "chalk";
|
|
38896
38934
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
38897
38935
|
if (!connections.find((c) => c.name === name)) {
|
|
38898
|
-
console.error(
|
|
38936
|
+
console.error(chalk252.red(`Connection "${name}" not found.`));
|
|
38899
38937
|
process.exit(1);
|
|
38900
38938
|
}
|
|
38901
38939
|
setDefault(name);
|
|
@@ -39116,7 +39154,7 @@ async function previewSlackThreadParts({
|
|
|
39116
39154
|
`Approved for ${target}. The ${bodies.length} bodies to post, in thread order, are at:`
|
|
39117
39155
|
);
|
|
39118
39156
|
paths.forEach(
|
|
39119
|
-
(
|
|
39157
|
+
(path109, index2) => console.log(`${index2 + 1}/${paths.length} ${path109}`)
|
|
39120
39158
|
);
|
|
39121
39159
|
console.log(
|
|
39122
39160
|
threadTs ? `Post every part as a reply with thread_ts ${threadTs}.` : `Post 1/${paths.length} to ${channel}, then the rest with the thread_ts it returns.`
|
|
@@ -39187,7 +39225,7 @@ function registerSlack(program2) {
|
|
|
39187
39225
|
}
|
|
39188
39226
|
|
|
39189
39227
|
// src/commands/sql/sqlAuth.ts
|
|
39190
|
-
import
|
|
39228
|
+
import chalk254 from "chalk";
|
|
39191
39229
|
|
|
39192
39230
|
// src/commands/sql/loadConnections.ts
|
|
39193
39231
|
function loadConnections3() {
|
|
@@ -39216,7 +39254,7 @@ function setDefaultConnection2(name) {
|
|
|
39216
39254
|
}
|
|
39217
39255
|
|
|
39218
39256
|
// src/commands/sql/promptConnection.ts
|
|
39219
|
-
import
|
|
39257
|
+
import chalk253 from "chalk";
|
|
39220
39258
|
async function promptConnection3(existingNames) {
|
|
39221
39259
|
const name = await promptInput("name", "Connection name:", "default");
|
|
39222
39260
|
assertUniqueName(existingNames, name);
|
|
@@ -39224,7 +39262,7 @@ async function promptConnection3(existingNames) {
|
|
|
39224
39262
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
39225
39263
|
const port = Number.parseInt(portStr, 10);
|
|
39226
39264
|
if (!Number.isFinite(port)) {
|
|
39227
|
-
console.error(
|
|
39265
|
+
console.error(chalk253.red(`Invalid port "${portStr}".`));
|
|
39228
39266
|
process.exit(1);
|
|
39229
39267
|
}
|
|
39230
39268
|
const user = await promptInput("user", "User:");
|
|
@@ -39237,13 +39275,13 @@ async function promptConnection3(existingNames) {
|
|
|
39237
39275
|
var sqlAuth = createConnectionAuth({
|
|
39238
39276
|
load: loadConnections3,
|
|
39239
39277
|
save: saveConnections3,
|
|
39240
|
-
format: (c) => `${
|
|
39278
|
+
format: (c) => `${chalk254.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
39241
39279
|
promptNew: promptConnection3,
|
|
39242
39280
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
39243
39281
|
});
|
|
39244
39282
|
|
|
39245
39283
|
// src/commands/sql/printTable.ts
|
|
39246
|
-
import
|
|
39284
|
+
import chalk255 from "chalk";
|
|
39247
39285
|
function formatCell(value) {
|
|
39248
39286
|
if (value === null || value === void 0) return "";
|
|
39249
39287
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -39252,7 +39290,7 @@ function formatCell(value) {
|
|
|
39252
39290
|
}
|
|
39253
39291
|
function printTable(rows) {
|
|
39254
39292
|
if (rows.length === 0) {
|
|
39255
|
-
console.log(
|
|
39293
|
+
console.log(chalk255.yellow("(no rows)"));
|
|
39256
39294
|
return;
|
|
39257
39295
|
}
|
|
39258
39296
|
const columns = Object.keys(rows[0]);
|
|
@@ -39260,13 +39298,13 @@ function printTable(rows) {
|
|
|
39260
39298
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
39261
39299
|
);
|
|
39262
39300
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
39263
|
-
console.log(
|
|
39264
|
-
console.log(
|
|
39301
|
+
console.log(chalk255.dim(header));
|
|
39302
|
+
console.log(chalk255.dim("-".repeat(header.length)));
|
|
39265
39303
|
for (const row2 of rows) {
|
|
39266
39304
|
const line = columns.map((c, i) => formatCell(row2[c]).padEnd(widths[i])).join(" ");
|
|
39267
39305
|
console.log(line);
|
|
39268
39306
|
}
|
|
39269
|
-
console.log(
|
|
39307
|
+
console.log(chalk255.dim(`
|
|
39270
39308
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
39271
39309
|
}
|
|
39272
39310
|
|
|
@@ -39326,7 +39364,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
39326
39364
|
}
|
|
39327
39365
|
|
|
39328
39366
|
// src/commands/sql/sqlMutate.ts
|
|
39329
|
-
import
|
|
39367
|
+
import chalk256 from "chalk";
|
|
39330
39368
|
|
|
39331
39369
|
// src/commands/sql/isMutation.ts
|
|
39332
39370
|
var MUTATION_KEYWORDS = [
|
|
@@ -39360,7 +39398,7 @@ function isMutation(sql29) {
|
|
|
39360
39398
|
async function sqlMutate(query, connectionName) {
|
|
39361
39399
|
if (!isMutation(query)) {
|
|
39362
39400
|
console.error(
|
|
39363
|
-
|
|
39401
|
+
chalk256.red(
|
|
39364
39402
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
39365
39403
|
)
|
|
39366
39404
|
);
|
|
@@ -39370,18 +39408,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
39370
39408
|
const pool = await sqlConnect(conn);
|
|
39371
39409
|
try {
|
|
39372
39410
|
const result = await pool.request().query(query);
|
|
39373
|
-
console.log(
|
|
39411
|
+
console.log(chalk256.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
39374
39412
|
} finally {
|
|
39375
39413
|
await pool.close();
|
|
39376
39414
|
}
|
|
39377
39415
|
}
|
|
39378
39416
|
|
|
39379
39417
|
// src/commands/sql/sqlQuery.ts
|
|
39380
|
-
import
|
|
39418
|
+
import chalk257 from "chalk";
|
|
39381
39419
|
async function sqlQuery(query, connectionName) {
|
|
39382
39420
|
if (isMutation(query)) {
|
|
39383
39421
|
console.error(
|
|
39384
|
-
|
|
39422
|
+
chalk257.red(
|
|
39385
39423
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
39386
39424
|
)
|
|
39387
39425
|
);
|
|
@@ -39396,7 +39434,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
39396
39434
|
printTable(rows);
|
|
39397
39435
|
} else {
|
|
39398
39436
|
console.log(
|
|
39399
|
-
|
|
39437
|
+
chalk257.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
39400
39438
|
);
|
|
39401
39439
|
}
|
|
39402
39440
|
} finally {
|
|
@@ -39458,15 +39496,15 @@ function registerSql(program2) {
|
|
|
39458
39496
|
|
|
39459
39497
|
// src/commands/sync.ts
|
|
39460
39498
|
import * as os5 from "os";
|
|
39461
|
-
import * as
|
|
39499
|
+
import * as path102 from "path";
|
|
39462
39500
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
39463
39501
|
|
|
39464
39502
|
// src/commands/sync/pruneCommands.ts
|
|
39465
|
-
import * as
|
|
39503
|
+
import * as path92 from "path";
|
|
39466
39504
|
|
|
39467
39505
|
// src/commands/sync/pruneTarget.ts
|
|
39468
39506
|
import * as fs39 from "fs";
|
|
39469
|
-
import * as
|
|
39507
|
+
import * as path91 from "path";
|
|
39470
39508
|
function pruneTarget(targetDir, keepNames, shape, options2) {
|
|
39471
39509
|
const result = {
|
|
39472
39510
|
orphans: [],
|
|
@@ -39484,7 +39522,7 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
|
|
|
39484
39522
|
}
|
|
39485
39523
|
if (keep.has(name)) continue;
|
|
39486
39524
|
result.orphans.push(entry.name);
|
|
39487
|
-
const entryPath =
|
|
39525
|
+
const entryPath = path91.join(targetDir, entry.name);
|
|
39488
39526
|
const reason4 = shape.blockedBy?.(entryPath);
|
|
39489
39527
|
if (reason4) {
|
|
39490
39528
|
result.skipped.push({ name: entry.name, reason: reason4 });
|
|
@@ -39504,7 +39542,7 @@ function pruneCommands(targetDir, commandNames, options2) {
|
|
|
39504
39542
|
targetDir,
|
|
39505
39543
|
commandNames,
|
|
39506
39544
|
{
|
|
39507
|
-
nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ?
|
|
39545
|
+
nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path92.basename(entry.name, ".md") : void 0
|
|
39508
39546
|
},
|
|
39509
39547
|
options2
|
|
39510
39548
|
);
|
|
@@ -39539,16 +39577,16 @@ function reportPrune(label2, result, force) {
|
|
|
39539
39577
|
|
|
39540
39578
|
// src/commands/sync/syncClaudeCommands.ts
|
|
39541
39579
|
import * as fs43 from "fs";
|
|
39542
|
-
import * as
|
|
39580
|
+
import * as path96 from "path";
|
|
39543
39581
|
|
|
39544
39582
|
// src/commands/sync/syncCodex.ts
|
|
39545
|
-
import * as
|
|
39583
|
+
import * as path95 from "path";
|
|
39546
39584
|
|
|
39547
39585
|
// src/commands/sync/installHarnessCommands.ts
|
|
39548
39586
|
import * as fs40 from "fs";
|
|
39549
|
-
import * as
|
|
39587
|
+
import * as path93 from "path";
|
|
39550
39588
|
function installHarnessCommands(claudeDir, harness, transform) {
|
|
39551
|
-
const commandsSource =
|
|
39589
|
+
const commandsSource = path93.join(claudeDir, "commands");
|
|
39552
39590
|
const files = fs40.readdirSync(commandsSource);
|
|
39553
39591
|
const names = [];
|
|
39554
39592
|
let synced = 0;
|
|
@@ -39556,9 +39594,9 @@ function installHarnessCommands(claudeDir, harness, transform) {
|
|
|
39556
39594
|
if (!file.endsWith(".md")) continue;
|
|
39557
39595
|
const name = file.replace(/\.md$/, "");
|
|
39558
39596
|
names.push(name);
|
|
39559
|
-
const content = fs40.readFileSync(
|
|
39560
|
-
const target =
|
|
39561
|
-
fs40.mkdirSync(
|
|
39597
|
+
const content = fs40.readFileSync(path93.join(commandsSource, file), "utf8");
|
|
39598
|
+
const target = path93.join(harness.homeDir, harness.sync.commandDest(name));
|
|
39599
|
+
fs40.mkdirSync(path93.dirname(target), { recursive: true });
|
|
39562
39600
|
fs40.writeFileSync(target, transform(name, content));
|
|
39563
39601
|
synced++;
|
|
39564
39602
|
}
|
|
@@ -39587,7 +39625,7 @@ function unexpectedContent(skillDir) {
|
|
|
39587
39625
|
|
|
39588
39626
|
// src/commands/sync/syncCodexHooks.ts
|
|
39589
39627
|
import * as fs42 from "fs";
|
|
39590
|
-
import * as
|
|
39628
|
+
import * as path94 from "path";
|
|
39591
39629
|
var BEGIN = "# >>> assist codex hooks (managed) \u2014 do not edit >>>";
|
|
39592
39630
|
var END = "# <<< assist codex hooks (managed) <<<";
|
|
39593
39631
|
function upsertManagedBlock(existing, body) {
|
|
@@ -39618,9 +39656,9 @@ ${rest}
|
|
|
39618
39656
|
}
|
|
39619
39657
|
function syncCodexHooks(sourcePath) {
|
|
39620
39658
|
const body = fs42.readFileSync(sourcePath, "utf8");
|
|
39621
|
-
const configPath =
|
|
39659
|
+
const configPath = path94.join(harnesses.codex.homeDir, "config.toml");
|
|
39622
39660
|
const existing = fs42.existsSync(configPath) ? fs42.readFileSync(configPath, "utf8") : "";
|
|
39623
|
-
fs42.mkdirSync(
|
|
39661
|
+
fs42.mkdirSync(path94.dirname(configPath), { recursive: true });
|
|
39624
39662
|
fs42.writeFileSync(configPath, upsertManagedBlock(existing, body));
|
|
39625
39663
|
console.log(
|
|
39626
39664
|
"Registered assist codex-hook in ~/.codex/config.toml (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
|
|
@@ -39652,13 +39690,13 @@ function syncCodex(claudeDir, options2) {
|
|
|
39652
39690
|
harnesses.codex,
|
|
39653
39691
|
commandToSkill
|
|
39654
39692
|
);
|
|
39655
|
-
syncCodexHooks(
|
|
39693
|
+
syncCodexHooks(path95.join(claudeDir, "..", "codex", "config.toml"));
|
|
39656
39694
|
console.log(`Synced ${total} skill(s) to ~/.codex/skills`);
|
|
39657
39695
|
if (!options2?.prune) return;
|
|
39658
39696
|
const force = options2.force ?? false;
|
|
39659
39697
|
reportPrune(
|
|
39660
39698
|
"~/.codex/skills",
|
|
39661
|
-
pruneSkills(
|
|
39699
|
+
pruneSkills(path95.join(harnesses.codex.homeDir, "skills"), names, { force }),
|
|
39662
39700
|
force
|
|
39663
39701
|
);
|
|
39664
39702
|
}
|
|
@@ -39673,30 +39711,30 @@ function replaceFileWithoutFollowingSymlink(file, content) {
|
|
|
39673
39711
|
fs43.writeFileSync(file, content);
|
|
39674
39712
|
}
|
|
39675
39713
|
function writeSkill(targetBase, name, content) {
|
|
39676
|
-
const skillDir =
|
|
39714
|
+
const skillDir = path96.join(targetBase, "skills", name);
|
|
39677
39715
|
fs43.mkdirSync(skillDir, { recursive: true });
|
|
39678
39716
|
replaceFileWithoutFollowingSymlink(
|
|
39679
|
-
|
|
39717
|
+
path96.join(skillDir, "SKILL.md"),
|
|
39680
39718
|
commandToSkill(name, content)
|
|
39681
39719
|
);
|
|
39682
|
-
fs43.rmSync(
|
|
39720
|
+
fs43.rmSync(path96.join(targetBase, "commands", `${name}.md`), { force: true });
|
|
39683
39721
|
console.log(`Wrote ${name} as a skill to ${skillDir}`);
|
|
39684
39722
|
}
|
|
39685
39723
|
function syncClaudeCommands(claudeDir, targetBase) {
|
|
39686
|
-
const sourceDir =
|
|
39687
|
-
const targetDir =
|
|
39724
|
+
const sourceDir = path96.join(claudeDir, "commands");
|
|
39725
|
+
const targetDir = path96.join(targetBase, "commands");
|
|
39688
39726
|
fs43.mkdirSync(targetDir, { recursive: true });
|
|
39689
39727
|
const files = fs43.readdirSync(sourceDir);
|
|
39690
39728
|
for (const file of files) {
|
|
39691
|
-
const source =
|
|
39729
|
+
const source = path96.join(sourceDir, file);
|
|
39692
39730
|
if (file.endsWith(".md")) {
|
|
39693
39731
|
const content = fs43.readFileSync(source, "utf8");
|
|
39694
39732
|
if (isSkillFlagged(content)) {
|
|
39695
|
-
writeSkill(targetBase,
|
|
39733
|
+
writeSkill(targetBase, path96.basename(file, ".md"), content);
|
|
39696
39734
|
continue;
|
|
39697
39735
|
}
|
|
39698
39736
|
}
|
|
39699
|
-
fs43.copyFileSync(source,
|
|
39737
|
+
fs43.copyFileSync(source, path96.join(targetDir, file));
|
|
39700
39738
|
console.log(`Copied ${file} to ${targetDir}`);
|
|
39701
39739
|
}
|
|
39702
39740
|
console.log(`Synced ${files.length} command(s) to ~/.claude`);
|
|
@@ -39705,11 +39743,11 @@ function syncClaudeCommands(claudeDir, targetBase) {
|
|
|
39705
39743
|
|
|
39706
39744
|
// src/commands/sync/reportRetiredAgentsFiles.ts
|
|
39707
39745
|
import * as fs44 from "fs";
|
|
39708
|
-
import * as
|
|
39746
|
+
import * as path97 from "path";
|
|
39709
39747
|
var retired = [
|
|
39710
|
-
|
|
39711
|
-
|
|
39712
|
-
|
|
39748
|
+
path97.join(harnesses.claude.homeDir, "CLAUDE.md"),
|
|
39749
|
+
path97.join(harnesses.codex.homeDir, "AGENTS.md"),
|
|
39750
|
+
path97.join(harnesses.pi.homeDir, "AGENTS.md")
|
|
39713
39751
|
];
|
|
39714
39752
|
function reportRetiredAgentsFiles() {
|
|
39715
39753
|
const leftovers = retired.filter((file) => fs44.existsSync(file));
|
|
@@ -39725,21 +39763,21 @@ function reportRetiredAgentsFiles() {
|
|
|
39725
39763
|
|
|
39726
39764
|
// src/commands/sync/syncDesign.ts
|
|
39727
39765
|
import * as fs45 from "fs";
|
|
39728
|
-
import * as
|
|
39766
|
+
import * as path98 from "path";
|
|
39729
39767
|
function syncDesign(claudeDir, targetBase) {
|
|
39730
|
-
const systemPromptSource =
|
|
39731
|
-
const systemPromptTarget =
|
|
39768
|
+
const systemPromptSource = path98.join(claudeDir, "design-system-prompt.md");
|
|
39769
|
+
const systemPromptTarget = path98.join(targetBase, "design-system-prompt.md");
|
|
39732
39770
|
fs45.copyFileSync(systemPromptSource, systemPromptTarget);
|
|
39733
39771
|
console.log(
|
|
39734
39772
|
"Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
|
|
39735
39773
|
);
|
|
39736
|
-
const skillsSource =
|
|
39737
|
-
const skillsTarget =
|
|
39774
|
+
const skillsSource = path98.join(claudeDir, "skills");
|
|
39775
|
+
const skillsTarget = path98.join(targetBase, "skills");
|
|
39738
39776
|
fs45.mkdirSync(skillsTarget, { recursive: true });
|
|
39739
39777
|
const entries = fs45.readdirSync(skillsSource, { withFileTypes: true });
|
|
39740
39778
|
for (const entry of entries) {
|
|
39741
|
-
const source =
|
|
39742
|
-
const target =
|
|
39779
|
+
const source = path98.join(skillsSource, entry.name);
|
|
39780
|
+
const target = path98.join(skillsTarget, entry.name);
|
|
39743
39781
|
if (entry.isDirectory()) {
|
|
39744
39782
|
fs45.rmSync(target, { recursive: true, force: true });
|
|
39745
39783
|
fs45.cpSync(source, target, { recursive: true });
|
|
@@ -39751,13 +39789,13 @@ function syncDesign(claudeDir, targetBase) {
|
|
|
39751
39789
|
}
|
|
39752
39790
|
|
|
39753
39791
|
// src/commands/sync/syncPi.ts
|
|
39754
|
-
import * as
|
|
39792
|
+
import * as path100 from "path";
|
|
39755
39793
|
|
|
39756
39794
|
// src/commands/sync/syncPiHooks.ts
|
|
39757
39795
|
import * as fs46 from "fs";
|
|
39758
|
-
import * as
|
|
39796
|
+
import * as path99 from "path";
|
|
39759
39797
|
function piExtensionsDir() {
|
|
39760
|
-
return
|
|
39798
|
+
return path99.join(harnesses.pi.homeDir, "extensions");
|
|
39761
39799
|
}
|
|
39762
39800
|
function syncPiHooks(sourceDir) {
|
|
39763
39801
|
const target = piExtensionsDir();
|
|
@@ -39765,8 +39803,8 @@ function syncPiHooks(sourceDir) {
|
|
|
39765
39803
|
const files = fs46.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
|
|
39766
39804
|
for (const file of files) {
|
|
39767
39805
|
fs46.copyFileSync(
|
|
39768
|
-
|
|
39769
|
-
|
|
39806
|
+
path99.join(sourceDir, file),
|
|
39807
|
+
path99.join(target, `assist-${file}`)
|
|
39770
39808
|
);
|
|
39771
39809
|
}
|
|
39772
39810
|
console.log(
|
|
@@ -39803,24 +39841,24 @@ function syncPi(claudeDir, options2) {
|
|
|
39803
39841
|
harnesses.pi,
|
|
39804
39842
|
commandToPrompt
|
|
39805
39843
|
);
|
|
39806
|
-
syncPiHooks(
|
|
39844
|
+
syncPiHooks(path100.join(claudeDir, "..", "pi"));
|
|
39807
39845
|
console.log(`Synced ${synced} prompt(s) to ~/.pi/agent/prompts`);
|
|
39808
39846
|
if (!options2?.prune) return;
|
|
39809
39847
|
const force = options2.force ?? false;
|
|
39810
39848
|
reportPrune(
|
|
39811
39849
|
"~/.pi/agent/prompts",
|
|
39812
|
-
pruneCommands(
|
|
39850
|
+
pruneCommands(path100.join(harnesses.pi.homeDir, "prompts"), names, { force }),
|
|
39813
39851
|
force
|
|
39814
39852
|
);
|
|
39815
39853
|
}
|
|
39816
39854
|
|
|
39817
39855
|
// src/commands/sync/syncSettings.ts
|
|
39818
39856
|
import * as fs47 from "fs";
|
|
39819
|
-
import * as
|
|
39820
|
-
import
|
|
39857
|
+
import * as path101 from "path";
|
|
39858
|
+
import chalk258 from "chalk";
|
|
39821
39859
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
39822
|
-
const source =
|
|
39823
|
-
const target =
|
|
39860
|
+
const source = path101.join(claudeDir, "settings.json");
|
|
39861
|
+
const target = path101.join(targetBase, "settings.json");
|
|
39824
39862
|
const sourceContent = fs47.readFileSync(source, "utf8");
|
|
39825
39863
|
const sourceSettings = JSON.parse(sourceContent);
|
|
39826
39864
|
const targetExists = fs47.existsSync(target);
|
|
@@ -39836,7 +39874,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
39836
39874
|
if (mergedContent !== normalizedTarget) {
|
|
39837
39875
|
if (!options2?.yes) {
|
|
39838
39876
|
console.log(
|
|
39839
|
-
|
|
39877
|
+
chalk258.yellow(
|
|
39840
39878
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
39841
39879
|
)
|
|
39842
39880
|
);
|
|
@@ -39844,7 +39882,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
39844
39882
|
printDiff(targetContent, mergedContent);
|
|
39845
39883
|
printAutoConfirmHint();
|
|
39846
39884
|
const confirm = await promptConfirm(
|
|
39847
|
-
|
|
39885
|
+
chalk258.red("Overwrite existing settings.json?"),
|
|
39848
39886
|
false
|
|
39849
39887
|
);
|
|
39850
39888
|
if (!confirm) {
|
|
@@ -39860,13 +39898,13 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
39860
39898
|
|
|
39861
39899
|
// src/commands/sync.ts
|
|
39862
39900
|
var __filename4 = fileURLToPath8(import.meta.url);
|
|
39863
|
-
var __dirname5 =
|
|
39901
|
+
var __dirname5 = path102.dirname(__filename4);
|
|
39864
39902
|
async function sync(options2) {
|
|
39865
39903
|
const config = loadConfig();
|
|
39866
39904
|
const yes = options2?.yes ?? config.sync.autoConfirm;
|
|
39867
39905
|
const prune = { prune: options2?.prune, force: options2?.force };
|
|
39868
|
-
const claudeDir =
|
|
39869
|
-
const targetBase =
|
|
39906
|
+
const claudeDir = path102.join(__dirname5, "..", "claude");
|
|
39907
|
+
const targetBase = path102.join(os5.homedir(), ".claude");
|
|
39870
39908
|
const commandFiles = syncClaudeCommands(claudeDir, targetBase);
|
|
39871
39909
|
syncDesign(claudeDir, targetBase);
|
|
39872
39910
|
await syncSettings(claudeDir, targetBase, { yes });
|
|
@@ -39874,11 +39912,11 @@ async function sync(options2) {
|
|
|
39874
39912
|
syncPi(claudeDir, prune);
|
|
39875
39913
|
reportRetiredAgentsFiles();
|
|
39876
39914
|
if (!options2?.prune) return;
|
|
39877
|
-
const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) =>
|
|
39915
|
+
const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path102.basename(file, ".md"));
|
|
39878
39916
|
const force = options2.force ?? false;
|
|
39879
39917
|
reportPrune(
|
|
39880
39918
|
"~/.claude/commands",
|
|
39881
|
-
pruneCommands(
|
|
39919
|
+
pruneCommands(path102.join(targetBase, "commands"), commandNames, { force }),
|
|
39882
39920
|
force
|
|
39883
39921
|
);
|
|
39884
39922
|
}
|
|
@@ -40934,9 +40972,9 @@ import { existsSync as existsSync81, readFileSync as readFileSync64 } from "fs";
|
|
|
40934
40972
|
|
|
40935
40973
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
40936
40974
|
import { minimatch as minimatch10 } from "minimatch";
|
|
40937
|
-
function resolveStringsAtPath(data,
|
|
40975
|
+
function resolveStringsAtPath(data, path109) {
|
|
40938
40976
|
let current = data;
|
|
40939
|
-
for (const segment of
|
|
40977
|
+
for (const segment of path109.split(".")) {
|
|
40940
40978
|
if (current === null || typeof current !== "object") return [];
|
|
40941
40979
|
current = current[segment];
|
|
40942
40980
|
}
|
|
@@ -40949,10 +40987,10 @@ function resolveStringsAtPath(data, path108) {
|
|
|
40949
40987
|
}
|
|
40950
40988
|
function findRuleViolations(data, rule) {
|
|
40951
40989
|
const violations = [];
|
|
40952
|
-
for (const
|
|
40953
|
-
for (const value of resolveStringsAtPath(data,
|
|
40990
|
+
for (const path109 of rule.paths) {
|
|
40991
|
+
for (const value of resolveStringsAtPath(data, path109)) {
|
|
40954
40992
|
if (minimatch10(value, rule.disallowed))
|
|
40955
|
-
violations.push({ file: rule.file, path:
|
|
40993
|
+
violations.push({ file: rule.file, path: path109, value });
|
|
40956
40994
|
}
|
|
40957
40995
|
}
|
|
40958
40996
|
return violations;
|
|
@@ -40991,8 +41029,8 @@ function forbiddenStrings() {
|
|
|
40991
41029
|
process.exit(0);
|
|
40992
41030
|
}
|
|
40993
41031
|
console.log("Forbidden strings found:\n");
|
|
40994
|
-
for (const { file, path:
|
|
40995
|
-
console.log(` ${file} ${
|
|
41032
|
+
for (const { file, path: path109, value } of violations) {
|
|
41033
|
+
console.log(` ${file} ${path109}: ${value}`);
|
|
40996
41034
|
}
|
|
40997
41035
|
console.log(`
|
|
40998
41036
|
Total: ${violations.length} forbidden string(s).`);
|
|
@@ -41048,7 +41086,7 @@ Total: ${lines2.length} hardcoded color(s)`);
|
|
|
41048
41086
|
|
|
41049
41087
|
// src/commands/verify/migrations.ts
|
|
41050
41088
|
import { readFileSync as readFileSync65 } from "fs";
|
|
41051
|
-
import
|
|
41089
|
+
import path104 from "path";
|
|
41052
41090
|
|
|
41053
41091
|
// src/commands/verify/migrations/checkAppendOnly.ts
|
|
41054
41092
|
function checkAppendOnly(baseline, current) {
|
|
@@ -41140,15 +41178,15 @@ function readBaselineMigrations(repoRelativeDir, ref) {
|
|
|
41140
41178
|
} catch {
|
|
41141
41179
|
return baseline;
|
|
41142
41180
|
}
|
|
41143
|
-
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((
|
|
41144
|
-
for (const
|
|
41181
|
+
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path109) => MIGRATION_FILE3.test(basename31(path109)));
|
|
41182
|
+
for (const path109 of paths) {
|
|
41145
41183
|
try {
|
|
41146
|
-
const content = execSync64(`git show "${ref}:${
|
|
41184
|
+
const content = execSync64(`git show "${ref}:${path109}"`, {
|
|
41147
41185
|
encoding: "utf8",
|
|
41148
41186
|
maxBuffer: 16 * 1024 * 1024,
|
|
41149
41187
|
stdio: ["pipe", "pipe", "pipe"]
|
|
41150
41188
|
});
|
|
41151
|
-
baseline.set(basename31(
|
|
41189
|
+
baseline.set(basename31(path109), content);
|
|
41152
41190
|
} catch {
|
|
41153
41191
|
}
|
|
41154
41192
|
}
|
|
@@ -41187,11 +41225,11 @@ function resolveBaselineRef() {
|
|
|
41187
41225
|
}
|
|
41188
41226
|
|
|
41189
41227
|
// src/commands/verify/migrations/migrationsDir.ts
|
|
41190
|
-
import
|
|
41228
|
+
import path103 from "path";
|
|
41191
41229
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
41192
41230
|
function migrationsDir() {
|
|
41193
|
-
return
|
|
41194
|
-
|
|
41231
|
+
return path103.resolve(
|
|
41232
|
+
path103.dirname(fileURLToPath9(import.meta.url)),
|
|
41195
41233
|
"../../../shared/db/migrations"
|
|
41196
41234
|
);
|
|
41197
41235
|
}
|
|
@@ -41212,7 +41250,7 @@ function migrations2() {
|
|
|
41212
41250
|
if (ref) {
|
|
41213
41251
|
const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
|
|
41214
41252
|
const current = new Map(
|
|
41215
|
-
files.map((file) => [file, readFileSync65(
|
|
41253
|
+
files.map((file) => [file, readFileSync65(path104.join(dir, file), "utf8")])
|
|
41216
41254
|
);
|
|
41217
41255
|
for (const finding of checkAppendOnly(baseline, current)) {
|
|
41218
41256
|
problems.push(
|
|
@@ -41491,27 +41529,27 @@ function restartAdvice(paths) {
|
|
|
41491
41529
|
// src/commands/watch/syncAdvice.ts
|
|
41492
41530
|
var rules = [
|
|
41493
41531
|
{
|
|
41494
|
-
matches: (
|
|
41532
|
+
matches: (path109) => path109.startsWith("claude/commands/"),
|
|
41495
41533
|
reason: "claude/commands changed"
|
|
41496
41534
|
},
|
|
41497
41535
|
{
|
|
41498
|
-
matches: (
|
|
41536
|
+
matches: (path109) => path109.startsWith("claude/skills/"),
|
|
41499
41537
|
reason: "claude/skills changed"
|
|
41500
41538
|
},
|
|
41501
41539
|
{
|
|
41502
|
-
matches: (
|
|
41540
|
+
matches: (path109) => path109 === "claude/settings.json",
|
|
41503
41541
|
reason: "claude/settings.json changed"
|
|
41504
41542
|
},
|
|
41505
41543
|
{
|
|
41506
|
-
matches: (
|
|
41544
|
+
matches: (path109) => path109 === "claude/design-system-prompt.md",
|
|
41507
41545
|
reason: "claude/design-system-prompt.md changed"
|
|
41508
41546
|
},
|
|
41509
41547
|
{
|
|
41510
|
-
matches: (
|
|
41548
|
+
matches: (path109) => path109.startsWith("codex/"),
|
|
41511
41549
|
reason: "codex sources changed"
|
|
41512
41550
|
},
|
|
41513
41551
|
{
|
|
41514
|
-
matches: (
|
|
41552
|
+
matches: (path109) => path109.startsWith("pi/"),
|
|
41515
41553
|
reason: "pi sources changed"
|
|
41516
41554
|
}
|
|
41517
41555
|
];
|
|
@@ -41888,10 +41926,10 @@ ${buildWatchReport(from)}`);
|
|
|
41888
41926
|
|
|
41889
41927
|
// src/commands/watch/consumeMarker.ts
|
|
41890
41928
|
import { existsSync as existsSync83, rmSync as rmSync8 } from "fs";
|
|
41891
|
-
function consumeMarker(
|
|
41929
|
+
function consumeMarker(path109) {
|
|
41892
41930
|
try {
|
|
41893
|
-
if (!existsSync83(
|
|
41894
|
-
rmSync8(
|
|
41931
|
+
if (!existsSync83(path109)) return false;
|
|
41932
|
+
rmSync8(path109);
|
|
41895
41933
|
return true;
|
|
41896
41934
|
} catch {
|
|
41897
41935
|
return false;
|
|
@@ -42065,7 +42103,7 @@ function registerWatch(program2) {
|
|
|
42065
42103
|
|
|
42066
42104
|
// src/commands/roam/auth.ts
|
|
42067
42105
|
import { randomBytes } from "crypto";
|
|
42068
|
-
import
|
|
42106
|
+
import chalk259 from "chalk";
|
|
42069
42107
|
|
|
42070
42108
|
// src/commands/roam/waitForCallback.ts
|
|
42071
42109
|
import { createServer as createServer3 } from "http";
|
|
@@ -42196,13 +42234,13 @@ async function auth() {
|
|
|
42196
42234
|
saveGlobalConfig(config);
|
|
42197
42235
|
const state = randomBytes(16).toString("hex");
|
|
42198
42236
|
console.log(
|
|
42199
|
-
|
|
42237
|
+
chalk259.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
42200
42238
|
);
|
|
42201
|
-
console.log(
|
|
42202
|
-
console.log(
|
|
42203
|
-
console.log(
|
|
42239
|
+
console.log(chalk259.white("http://localhost:14523/callback\n"));
|
|
42240
|
+
console.log(chalk259.blue("Opening browser for authorization..."));
|
|
42241
|
+
console.log(chalk259.dim("Waiting for authorization callback..."));
|
|
42204
42242
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
42205
|
-
console.log(
|
|
42243
|
+
console.log(chalk259.dim("Exchanging code for tokens..."));
|
|
42206
42244
|
const tokens = await exchangeToken({
|
|
42207
42245
|
code,
|
|
42208
42246
|
clientId,
|
|
@@ -42218,7 +42256,7 @@ async function auth() {
|
|
|
42218
42256
|
};
|
|
42219
42257
|
saveGlobalConfig(config);
|
|
42220
42258
|
console.log(
|
|
42221
|
-
|
|
42259
|
+
chalk259.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
42222
42260
|
);
|
|
42223
42261
|
}
|
|
42224
42262
|
|
|
@@ -42234,9 +42272,9 @@ function findPortFile(roamDir) {
|
|
|
42234
42272
|
return void 0;
|
|
42235
42273
|
}
|
|
42236
42274
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
42237
|
-
const
|
|
42275
|
+
const path109 = join102(roamDir, name);
|
|
42238
42276
|
try {
|
|
42239
|
-
return { path:
|
|
42277
|
+
return { path: path109, mtimeMs: statSync14(path109).mtimeMs };
|
|
42240
42278
|
} catch {
|
|
42241
42279
|
return void 0;
|
|
42242
42280
|
}
|
|
@@ -42539,11 +42577,11 @@ function findLinkIndex() {
|
|
|
42539
42577
|
function parseLinkArgs() {
|
|
42540
42578
|
const idx = findLinkIndex();
|
|
42541
42579
|
if (idx === -1) return null;
|
|
42542
|
-
const
|
|
42580
|
+
const path109 = process.argv[idx + 1];
|
|
42543
42581
|
const rest = process.argv.slice(idx + 2);
|
|
42544
42582
|
const { value: prefix2 } = extractOption(rest, "--prefix");
|
|
42545
42583
|
if (!prefix2) return null;
|
|
42546
|
-
return { path:
|
|
42584
|
+
return { path: path109, prefix: prefix2 };
|
|
42547
42585
|
}
|
|
42548
42586
|
function hasDuplicateLink(runList, linkPath) {
|
|
42549
42587
|
return runList.some(
|
|
@@ -42658,18 +42696,18 @@ function registerRun(program2) {
|
|
|
42658
42696
|
}
|
|
42659
42697
|
|
|
42660
42698
|
// src/commands/sessions/nodes/formatLink.ts
|
|
42661
|
-
import
|
|
42699
|
+
import chalk260 from "chalk";
|
|
42662
42700
|
var STATE_COLOURS = {
|
|
42663
|
-
connected:
|
|
42664
|
-
connecting:
|
|
42665
|
-
disconnected:
|
|
42666
|
-
"version-blocked":
|
|
42701
|
+
connected: chalk260.green,
|
|
42702
|
+
connecting: chalk260.yellow,
|
|
42703
|
+
disconnected: chalk260.red,
|
|
42704
|
+
"version-blocked": chalk260.red
|
|
42667
42705
|
};
|
|
42668
42706
|
function formatLink(link3) {
|
|
42669
|
-
const colour = STATE_COLOURS[link3.state] ??
|
|
42707
|
+
const colour = STATE_COLOURS[link3.state] ?? chalk260.white;
|
|
42670
42708
|
const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
|
|
42671
42709
|
const error = link3.error ? `
|
|
42672
|
-
${
|
|
42710
|
+
${chalk260.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
|
|
42673
42711
|
return ` ${link3.name} ${colour(link3.state)} ${link3.url}${peer}${error}`;
|
|
42674
42712
|
}
|
|
42675
42713
|
|
|
@@ -43510,14 +43548,14 @@ import * as pty from "node-pty";
|
|
|
43510
43548
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
43511
43549
|
import { chmodSync, existsSync as existsSync86, statSync as statSync15 } from "fs";
|
|
43512
43550
|
import { createRequire as createRequire3 } from "module";
|
|
43513
|
-
import
|
|
43551
|
+
import path105 from "path";
|
|
43514
43552
|
var require4 = createRequire3(import.meta.url);
|
|
43515
43553
|
var ensured = false;
|
|
43516
43554
|
function ensureSpawnHelperExecutable() {
|
|
43517
43555
|
if (ensured || process.platform !== "darwin") return;
|
|
43518
43556
|
ensured = true;
|
|
43519
|
-
const ptyRoot =
|
|
43520
|
-
const helper =
|
|
43557
|
+
const ptyRoot = path105.join(path105.dirname(require4.resolve("node-pty")), "..");
|
|
43558
|
+
const helper = path105.join(
|
|
43521
43559
|
ptyRoot,
|
|
43522
43560
|
"prebuilds",
|
|
43523
43561
|
`${process.platform}-${process.arch}`,
|
|
@@ -43665,12 +43703,12 @@ function serverRunMeta(runName, cwd) {
|
|
|
43665
43703
|
|
|
43666
43704
|
// src/commands/sessions/daemon/readDesignSystemPrompt.ts
|
|
43667
43705
|
import * as fs50 from "fs";
|
|
43668
|
-
import * as
|
|
43706
|
+
import * as path106 from "path";
|
|
43669
43707
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
43670
43708
|
var __filename5 = fileURLToPath10(import.meta.url);
|
|
43671
|
-
var __dirname6 =
|
|
43709
|
+
var __dirname6 = path106.dirname(__filename5);
|
|
43672
43710
|
function readDesignSystemPrompt() {
|
|
43673
|
-
const promptPath =
|
|
43711
|
+
const promptPath = path106.join(
|
|
43674
43712
|
__dirname6,
|
|
43675
43713
|
"..",
|
|
43676
43714
|
"claude",
|
|
@@ -43883,16 +43921,16 @@ import { readFileSync as readFileSync70, writeFileSync as writeFileSync57 } from
|
|
|
43883
43921
|
var KEEP_TAIL = 256 * 1024;
|
|
43884
43922
|
var MAX_LOG_SIZE = 4 * 1024 * 1024;
|
|
43885
43923
|
function trimWatcherLog(cwd) {
|
|
43886
|
-
const
|
|
43924
|
+
const path109 = watcherLogPath(cwd);
|
|
43887
43925
|
let log2;
|
|
43888
43926
|
try {
|
|
43889
|
-
log2 = readFileSync70(
|
|
43927
|
+
log2 = readFileSync70(path109, "utf8");
|
|
43890
43928
|
} catch {
|
|
43891
43929
|
return;
|
|
43892
43930
|
}
|
|
43893
43931
|
if (log2.length <= MAX_LOG_SIZE) return;
|
|
43894
|
-
writeFileSync57(
|
|
43895
|
-
daemonLog(`auto-update: log ${
|
|
43932
|
+
writeFileSync57(path109, log2.slice(-KEEP_TAIL));
|
|
43933
|
+
daemonLog(`auto-update: log ${path109} trimmed to its last ${KEEP_TAIL} chars`);
|
|
43896
43934
|
}
|
|
43897
43935
|
|
|
43898
43936
|
// src/commands/sessions/daemon/worktree/appendWatcherLog.ts
|
|
@@ -43900,9 +43938,9 @@ import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync35 } from "fs"
|
|
|
43900
43938
|
import { dirname as dirname43 } from "path";
|
|
43901
43939
|
function appendWatcherLog(cwd, data) {
|
|
43902
43940
|
try {
|
|
43903
|
-
const
|
|
43904
|
-
mkdirSync35(dirname43(
|
|
43905
|
-
appendFileSync4(
|
|
43941
|
+
const path109 = watcherLogPath(cwd);
|
|
43942
|
+
mkdirSync35(dirname43(path109), { recursive: true });
|
|
43943
|
+
appendFileSync4(path109, data);
|
|
43906
43944
|
} catch {
|
|
43907
43945
|
}
|
|
43908
43946
|
}
|
|
@@ -44083,8 +44121,8 @@ import { rmSync as rmSync10 } from "fs";
|
|
|
44083
44121
|
function clearLapSignals(cwd) {
|
|
44084
44122
|
const control = watchControlPaths(cwd);
|
|
44085
44123
|
if (!control) return;
|
|
44086
|
-
for (const
|
|
44087
|
-
rmSync10(
|
|
44124
|
+
for (const path109 of [control.check, control.stop])
|
|
44125
|
+
rmSync10(path109, { force: true });
|
|
44088
44126
|
}
|
|
44089
44127
|
function runUpdateLap(cwd, onOutput) {
|
|
44090
44128
|
clearLapSignals(cwd);
|
|
@@ -45256,8 +45294,8 @@ async function seedRunningMsFromUsage(session, notify2) {
|
|
|
45256
45294
|
var DEBOUNCE_MS2 = 50;
|
|
45257
45295
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
45258
45296
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
45259
|
-
const
|
|
45260
|
-
const dir = dirname44(
|
|
45297
|
+
const path109 = activityPath(session.id);
|
|
45298
|
+
const dir = dirname44(path109);
|
|
45261
45299
|
try {
|
|
45262
45300
|
mkdirSync36(dir, { recursive: true });
|
|
45263
45301
|
} catch {
|
|
@@ -45267,7 +45305,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
45267
45305
|
let timer = null;
|
|
45268
45306
|
const read3 = () => {
|
|
45269
45307
|
timer = null;
|
|
45270
|
-
const activity2 = readActivity(
|
|
45308
|
+
const activity2 = readActivity(path109);
|
|
45271
45309
|
if (!activity2) return;
|
|
45272
45310
|
applyActivityToSession(session, activity2);
|
|
45273
45311
|
if (activity2.claudeSessionId) onClaudeSessionId?.(session);
|
|
@@ -45276,11 +45314,11 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
45276
45314
|
notify2();
|
|
45277
45315
|
};
|
|
45278
45316
|
session.activityWatcher = watch2(dir, (_event, filename) => {
|
|
45279
|
-
if (filename && !
|
|
45317
|
+
if (filename && !path109.endsWith(filename)) return;
|
|
45280
45318
|
if (timer) clearTimeout(timer);
|
|
45281
45319
|
timer = setTimeout(read3, DEBOUNCE_MS2);
|
|
45282
45320
|
});
|
|
45283
|
-
if (existsSync93(
|
|
45321
|
+
if (existsSync93(path109)) read3();
|
|
45284
45322
|
}
|
|
45285
45323
|
function refreshActivity(session) {
|
|
45286
45324
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -45424,12 +45462,12 @@ import { watch as watch3 } from "fs";
|
|
|
45424
45462
|
|
|
45425
45463
|
// src/commands/sessions/shared/findTranscriptPathSync.ts
|
|
45426
45464
|
import * as fs52 from "fs";
|
|
45427
|
-
import * as
|
|
45465
|
+
import * as path107 from "path";
|
|
45428
45466
|
function projectDirForCwd(cwd) {
|
|
45429
|
-
return
|
|
45467
|
+
return path107.join(claudeProjectsRoot(), projectSlug(cwd));
|
|
45430
45468
|
}
|
|
45431
45469
|
function transcriptPathFor(cwd, claudeSessionId) {
|
|
45432
|
-
return
|
|
45470
|
+
return path107.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
|
|
45433
45471
|
}
|
|
45434
45472
|
function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
45435
45473
|
const direct = transcriptPathFor(cwd, claudeSessionId);
|
|
@@ -45443,8 +45481,8 @@ function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
|
45443
45481
|
}
|
|
45444
45482
|
for (const file of files) {
|
|
45445
45483
|
if (!file.endsWith(".jsonl")) continue;
|
|
45446
|
-
if (headContainsSessionId(
|
|
45447
|
-
return
|
|
45484
|
+
if (headContainsSessionId(path107.join(dir, file), claudeSessionId))
|
|
45485
|
+
return path107.join(dir, file);
|
|
45448
45486
|
}
|
|
45449
45487
|
return null;
|
|
45450
45488
|
}
|
|
@@ -46747,9 +46785,9 @@ function tempRoots() {
|
|
|
46747
46785
|
}
|
|
46748
46786
|
return [...roots];
|
|
46749
46787
|
}
|
|
46750
|
-
function underTempRoot(
|
|
46788
|
+
function underTempRoot(path109) {
|
|
46751
46789
|
return tempRoots().some(
|
|
46752
|
-
(root2) =>
|
|
46790
|
+
(root2) => path109.startsWith(root2.endsWith(sep5) ? root2 : root2 + sep5)
|
|
46753
46791
|
);
|
|
46754
46792
|
}
|
|
46755
46793
|
|
|
@@ -47260,15 +47298,15 @@ function accountedTrees(sessions) {
|
|
|
47260
47298
|
import { existsSync as existsSync95 } from "fs";
|
|
47261
47299
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
47262
47300
|
if (!existsSync95(clone)) {
|
|
47263
|
-
for (const { path:
|
|
47301
|
+
for (const { path: path109 } of paths) forgetWorktree(path109);
|
|
47264
47302
|
daemonLog(
|
|
47265
47303
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
47266
47304
|
);
|
|
47267
47305
|
return;
|
|
47268
47306
|
}
|
|
47269
47307
|
await pruneBookkeeping2(clone);
|
|
47270
|
-
for (const { path:
|
|
47271
|
-
if (await reclaimBranch(clone, branch2)) forgetWorktree(
|
|
47308
|
+
for (const { path: path109, branch: branch2 } of paths)
|
|
47309
|
+
if (await reclaimBranch(clone, branch2)) forgetWorktree(path109);
|
|
47272
47310
|
}
|
|
47273
47311
|
async function pruneBookkeeping2(clone) {
|
|
47274
47312
|
try {
|
|
@@ -47295,37 +47333,37 @@ async function reclaimBranch(clone, branch2) {
|
|
|
47295
47333
|
}
|
|
47296
47334
|
|
|
47297
47335
|
// src/commands/sessions/daemon/worktree/logVanishedTree.ts
|
|
47298
|
-
function logVanishedTree(sessions,
|
|
47336
|
+
function logVanishedTree(sessions, path109) {
|
|
47299
47337
|
const claimants = [...sessions.values()].filter(
|
|
47300
|
-
(s) => s.cwd ===
|
|
47338
|
+
(s) => s.cwd === path109 || s.worktree?.path === path109
|
|
47301
47339
|
);
|
|
47302
47340
|
if (claimants.length === 0) {
|
|
47303
|
-
daemonLog(`worktree ${
|
|
47341
|
+
daemonLog(`worktree ${path109} gone from disk and unclaimed; reclaiming it`);
|
|
47304
47342
|
return;
|
|
47305
47343
|
}
|
|
47306
47344
|
for (const s of claimants)
|
|
47307
47345
|
daemonLog(
|
|
47308
|
-
`session ${s.id} ("${s.name}") claims worktree ${
|
|
47346
|
+
`session ${s.id} ("${s.name}") claims worktree ${path109}, which is gone from disk; reclaiming it`
|
|
47309
47347
|
);
|
|
47310
47348
|
}
|
|
47311
47349
|
|
|
47312
47350
|
// src/commands/sessions/daemon/worktree/describeHeldWork.ts
|
|
47313
47351
|
var MAX_ITEMS = 20;
|
|
47314
|
-
async function describeHeldWork(
|
|
47315
|
-
if (reason4.startsWith("uncommitted")) return await changedFiles(
|
|
47316
|
-
if (reason4.startsWith("unpushed")) return await unpushedCommits(
|
|
47352
|
+
async function describeHeldWork(path109, reason4) {
|
|
47353
|
+
if (reason4.startsWith("uncommitted")) return await changedFiles(path109);
|
|
47354
|
+
if (reason4.startsWith("unpushed")) return await unpushedCommits(path109, reason4);
|
|
47317
47355
|
return { summary: reason4, items: [] };
|
|
47318
47356
|
}
|
|
47319
|
-
async function changedFiles(
|
|
47320
|
-
const status2 = await gitResult(
|
|
47357
|
+
async function changedFiles(path109) {
|
|
47358
|
+
const status2 = await gitResult(path109, ["status", "--porcelain"]);
|
|
47321
47359
|
const lines2 = status2.ok ? nonEmptyLines(status2.out) : [];
|
|
47322
47360
|
return {
|
|
47323
47361
|
summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
|
|
47324
47362
|
items: capped2(lines2)
|
|
47325
47363
|
};
|
|
47326
47364
|
}
|
|
47327
|
-
async function unpushedCommits(
|
|
47328
|
-
const log2 = await gitResult(
|
|
47365
|
+
async function unpushedCommits(path109, reason4) {
|
|
47366
|
+
const log2 = await gitResult(path109, ["log", "--oneline", "@{upstream}..HEAD"]);
|
|
47329
47367
|
if (!log2.ok) return { summary: reason4, items: [] };
|
|
47330
47368
|
const lines2 = nonEmptyLines(log2.out);
|
|
47331
47369
|
return {
|
|
@@ -47417,24 +47455,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
|
|
|
47417
47455
|
async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
47418
47456
|
const accounted = accountedTrees(sessions);
|
|
47419
47457
|
const vanished = /* @__PURE__ */ new Map();
|
|
47420
|
-
for (const { path:
|
|
47421
|
-
if (underTempRoot(
|
|
47422
|
-
forgetWorktree(
|
|
47458
|
+
for (const { path: path109, clone } of readWorktreeRegistry()) {
|
|
47459
|
+
if (underTempRoot(path109)) {
|
|
47460
|
+
forgetWorktree(path109);
|
|
47423
47461
|
daemonLog(
|
|
47424
|
-
`worktree ${
|
|
47462
|
+
`worktree ${path109} lies outside any project root; pruned from the registry rather than recovered`
|
|
47425
47463
|
);
|
|
47426
47464
|
continue;
|
|
47427
47465
|
}
|
|
47428
|
-
if (!existsSync96(
|
|
47429
|
-
logVanishedTree(sessions,
|
|
47466
|
+
if (!existsSync96(path109)) {
|
|
47467
|
+
logVanishedTree(sessions, path109);
|
|
47430
47468
|
vanished.set(clone, [
|
|
47431
47469
|
...vanished.get(clone) ?? [],
|
|
47432
|
-
{ path:
|
|
47470
|
+
{ path: path109, branch: basename34(path109) }
|
|
47433
47471
|
]);
|
|
47434
47472
|
continue;
|
|
47435
47473
|
}
|
|
47436
|
-
if (accounted.has(
|
|
47437
|
-
await recoverOrphan(sessions, spawnWith, { path:
|
|
47474
|
+
if (accounted.has(path109)) continue;
|
|
47475
|
+
await recoverOrphan(sessions, spawnWith, { path: path109, clone }, notify2);
|
|
47438
47476
|
}
|
|
47439
47477
|
for (const [clone, paths] of vanished)
|
|
47440
47478
|
await reclaimVanishedWorktrees(clone, paths);
|
|
@@ -49039,12 +49077,12 @@ function handleSetStatus(client, m, d) {
|
|
|
49039
49077
|
import * as fs56 from "fs";
|
|
49040
49078
|
|
|
49041
49079
|
// src/commands/sessions/shared/codex/findCodexRolloutPath.ts
|
|
49042
|
-
import * as
|
|
49080
|
+
import * as path108 from "path";
|
|
49043
49081
|
async function findCodexRolloutPath(sessionId) {
|
|
49044
49082
|
if (!sessionId) return null;
|
|
49045
49083
|
const paths = await discoverCodexRolloutPaths();
|
|
49046
49084
|
const suffix = `-${sessionId}.jsonl`;
|
|
49047
|
-
return paths.find((file) =>
|
|
49085
|
+
return paths.find((file) => path108.basename(file).endsWith(suffix)) ?? null;
|
|
49048
49086
|
}
|
|
49049
49087
|
|
|
49050
49088
|
// src/commands/sessions/shared/codex/codexToolTarget.ts
|
|
@@ -49647,7 +49685,7 @@ async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
|
49647
49685
|
}
|
|
49648
49686
|
|
|
49649
49687
|
// src/commands/sessions/nodes/printReport.ts
|
|
49650
|
-
import
|
|
49688
|
+
import chalk261 from "chalk";
|
|
49651
49689
|
function printReport(report) {
|
|
49652
49690
|
if (report.links.length === 0) {
|
|
49653
49691
|
console.log(`${report.local} has no links`);
|
|
@@ -49661,11 +49699,11 @@ function printReport(report) {
|
|
|
49661
49699
|
for (const diagnosis of report.links) printDiagnosis(diagnosis);
|
|
49662
49700
|
}
|
|
49663
49701
|
function printDiagnosis(diagnosis) {
|
|
49664
|
-
console.log(`${
|
|
49702
|
+
console.log(`${chalk261.bold(diagnosis.name)} ${chalk261.dim(diagnosis.url)}`);
|
|
49665
49703
|
for (const hop of diagnosis.hops) {
|
|
49666
|
-
const mark = hop.ok ?
|
|
49704
|
+
const mark = hop.ok ? chalk261.green("\u2713") : chalk261.red("\u2717");
|
|
49667
49705
|
console.log(` ${mark} ${hop.hop.padEnd(9)} ${hop.detail ?? hop.error}`);
|
|
49668
|
-
if (hop.remediation) console.log(` ${
|
|
49706
|
+
if (hop.remediation) console.log(` ${chalk261.yellow(hop.remediation)}`);
|
|
49669
49707
|
}
|
|
49670
49708
|
}
|
|
49671
49709
|
|
|
@@ -49685,7 +49723,7 @@ async function doctorNodes(name, options2) {
|
|
|
49685
49723
|
}
|
|
49686
49724
|
|
|
49687
49725
|
// src/commands/sessions/nodes/listNodes.ts
|
|
49688
|
-
import
|
|
49726
|
+
import chalk262 from "chalk";
|
|
49689
49727
|
async function nodesReport() {
|
|
49690
49728
|
const live = await queryNodes();
|
|
49691
49729
|
if (live)
|
|
@@ -49702,10 +49740,10 @@ async function listNodes(options2) {
|
|
|
49702
49740
|
console.log(JSON.stringify(report, null, 2));
|
|
49703
49741
|
return;
|
|
49704
49742
|
}
|
|
49705
|
-
console.log(`${report.local} ${
|
|
49743
|
+
console.log(`${report.local} ${chalk262.dim("(this node)")}`);
|
|
49706
49744
|
if (!report.daemonRunning)
|
|
49707
|
-
console.log(
|
|
49708
|
-
if (report.links.length === 0) console.log(
|
|
49745
|
+
console.log(chalk262.dim(" daemon not running; showing configured links"));
|
|
49746
|
+
if (report.links.length === 0) console.log(chalk262.dim(" no links"));
|
|
49709
49747
|
for (const link3 of report.links) console.log(formatLink(link3));
|
|
49710
49748
|
}
|
|
49711
49749
|
|
|
@@ -49744,14 +49782,14 @@ async function nodeLogs(name, options2) {
|
|
|
49744
49782
|
}
|
|
49745
49783
|
|
|
49746
49784
|
// src/commands/sessions/nodes/linkNode.ts
|
|
49747
|
-
import
|
|
49785
|
+
import chalk265 from "chalk";
|
|
49748
49786
|
|
|
49749
49787
|
// src/commands/sessions/nodes/notifyDaemonLinks.ts
|
|
49750
|
-
import
|
|
49788
|
+
import chalk263 from "chalk";
|
|
49751
49789
|
async function notifyDaemonLinks() {
|
|
49752
49790
|
if (!await isDaemonRunning()) {
|
|
49753
49791
|
console.log(
|
|
49754
|
-
|
|
49792
|
+
chalk263.yellow(
|
|
49755
49793
|
"The sessions daemon is not running; it loads the links when it starts."
|
|
49756
49794
|
)
|
|
49757
49795
|
);
|
|
@@ -49759,11 +49797,11 @@ async function notifyDaemonLinks() {
|
|
|
49759
49797
|
}
|
|
49760
49798
|
try {
|
|
49761
49799
|
await sendToDaemonAwaitAck({ type: "reload-links" });
|
|
49762
|
-
console.log(
|
|
49800
|
+
console.log(chalk263.dim("The sessions daemon reloaded its links."));
|
|
49763
49801
|
} catch (error) {
|
|
49764
49802
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
49765
49803
|
console.log(
|
|
49766
|
-
|
|
49804
|
+
chalk263.yellow(
|
|
49767
49805
|
`Could not notify the sessions daemon (${message3}); run \`assist daemon restart\` to apply the change.`
|
|
49768
49806
|
)
|
|
49769
49807
|
);
|
|
@@ -49771,7 +49809,7 @@ async function notifyDaemonLinks() {
|
|
|
49771
49809
|
}
|
|
49772
49810
|
|
|
49773
49811
|
// src/commands/sessions/nodes/readLinks.ts
|
|
49774
|
-
import
|
|
49812
|
+
import chalk264 from "chalk";
|
|
49775
49813
|
|
|
49776
49814
|
// src/commands/sessions/nodes/writeLinks.ts
|
|
49777
49815
|
async function writeLinks(links2) {
|
|
@@ -49794,7 +49832,7 @@ async function readLinks() {
|
|
|
49794
49832
|
await writeLinks(links2);
|
|
49795
49833
|
const dropped = stored.filter((link3) => !link3.url).map((link3) => link3.name);
|
|
49796
49834
|
console.log(
|
|
49797
|
-
|
|
49835
|
+
chalk264.yellow(`Removed ${dropped.join(", ")}: ${SSH_LINK_RETIRED}`)
|
|
49798
49836
|
);
|
|
49799
49837
|
return links2;
|
|
49800
49838
|
}
|
|
@@ -49850,7 +49888,7 @@ async function linkNode(name, url, options2) {
|
|
|
49850
49888
|
throw new Error(`${name} is this node; link to a different node`);
|
|
49851
49889
|
const link3 = await buildLink(name, url, options2);
|
|
49852
49890
|
await writeLinks([...others, link3]);
|
|
49853
|
-
console.log(
|
|
49891
|
+
console.log(chalk265.green(`Linked ${name} (${link3.url})`));
|
|
49854
49892
|
await notifyDaemonLinks();
|
|
49855
49893
|
}
|
|
49856
49894
|
|
|
@@ -49884,8 +49922,8 @@ async function awaitLinkReturn(name, options2, deps2 = {}) {
|
|
|
49884
49922
|
}
|
|
49885
49923
|
|
|
49886
49924
|
// src/commands/sessions/nodes/postToPeer.ts
|
|
49887
|
-
async function postToPeer(baseUrl,
|
|
49888
|
-
const res = await fetch(new URL(
|
|
49925
|
+
async function postToPeer(baseUrl, path109, traceId, timeoutMs) {
|
|
49926
|
+
const res = await fetch(new URL(path109, baseUrl), {
|
|
49889
49927
|
method: "POST",
|
|
49890
49928
|
headers: {
|
|
49891
49929
|
"x-assist-linked-from": resolveNodeName(),
|
|
@@ -49895,7 +49933,7 @@ async function postToPeer(baseUrl, path108, traceId, timeoutMs) {
|
|
|
49895
49933
|
});
|
|
49896
49934
|
if (res.ok) return;
|
|
49897
49935
|
const body = await res.json().catch(() => ({}));
|
|
49898
|
-
throw new Error(body.error ?? `POST ${
|
|
49936
|
+
throw new Error(body.error ?? `POST ${path109} returned ${res.status}`);
|
|
49899
49937
|
}
|
|
49900
49938
|
|
|
49901
49939
|
// src/commands/sessions/nodes/startPeerAction.ts
|
|
@@ -49955,16 +49993,16 @@ async function restartNode(name, options2) {
|
|
|
49955
49993
|
}
|
|
49956
49994
|
|
|
49957
49995
|
// src/commands/sessions/nodes/unlinkNode.ts
|
|
49958
|
-
import
|
|
49996
|
+
import chalk266 from "chalk";
|
|
49959
49997
|
async function unlinkNode(name) {
|
|
49960
49998
|
const links2 = await readLinks();
|
|
49961
49999
|
const remaining = links2.filter((link3) => link3.name !== name);
|
|
49962
50000
|
if (remaining.length === links2.length) {
|
|
49963
|
-
console.log(
|
|
50001
|
+
console.log(chalk266.yellow(`No link named ${name}`));
|
|
49964
50002
|
return;
|
|
49965
50003
|
}
|
|
49966
50004
|
await writeLinks(remaining);
|
|
49967
|
-
console.log(
|
|
50005
|
+
console.log(chalk266.green(`Unlinked ${name}`));
|
|
49968
50006
|
await notifyDaemonLinks();
|
|
49969
50007
|
}
|
|
49970
50008
|
|
|
@@ -50163,7 +50201,7 @@ async function renameSession(title) {
|
|
|
50163
50201
|
|
|
50164
50202
|
// src/commands/sessions/summarise.ts
|
|
50165
50203
|
import * as fs58 from "fs";
|
|
50166
|
-
import
|
|
50204
|
+
import chalk267 from "chalk";
|
|
50167
50205
|
|
|
50168
50206
|
// src/commands/sessions/summarise/shared.ts
|
|
50169
50207
|
import * as fs57 from "fs";
|
|
@@ -50222,22 +50260,22 @@ ${firstMessage}`);
|
|
|
50222
50260
|
async function summarise2(options2) {
|
|
50223
50261
|
const files = await discoverSessionFiles();
|
|
50224
50262
|
if (files.length === 0) {
|
|
50225
|
-
console.log(
|
|
50263
|
+
console.log(chalk267.yellow("No sessions found."));
|
|
50226
50264
|
return;
|
|
50227
50265
|
}
|
|
50228
50266
|
const toProcess = selectCandidates(files, options2);
|
|
50229
50267
|
if (toProcess.length === 0) {
|
|
50230
|
-
console.log(
|
|
50268
|
+
console.log(chalk267.green("All sessions already summarised."));
|
|
50231
50269
|
return;
|
|
50232
50270
|
}
|
|
50233
50271
|
console.log(
|
|
50234
|
-
|
|
50272
|
+
chalk267.cyan(
|
|
50235
50273
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
50236
50274
|
)
|
|
50237
50275
|
);
|
|
50238
50276
|
const { succeeded, failed: failed3 } = processSessions(toProcess);
|
|
50239
50277
|
console.log(
|
|
50240
|
-
|
|
50278
|
+
chalk267.green(`Done: ${succeeded} summarised`) + (failed3 > 0 ? chalk267.yellow(`, ${failed3} skipped`) : "")
|
|
50241
50279
|
);
|
|
50242
50280
|
}
|
|
50243
50281
|
function selectCandidates(files, options2) {
|
|
@@ -50257,16 +50295,16 @@ function processSessions(files) {
|
|
|
50257
50295
|
let failed3 = 0;
|
|
50258
50296
|
for (let i = 0; i < files.length; i++) {
|
|
50259
50297
|
const file = files[i];
|
|
50260
|
-
process.stdout.write(
|
|
50298
|
+
process.stdout.write(chalk267.dim(` [${i + 1}/${files.length}] `));
|
|
50261
50299
|
const summary = summariseSession(file);
|
|
50262
50300
|
if (summary) {
|
|
50263
50301
|
writeSummary(file, summary);
|
|
50264
50302
|
succeeded++;
|
|
50265
|
-
process.stdout.write(`${
|
|
50303
|
+
process.stdout.write(`${chalk267.green("\u2713")} ${summary}
|
|
50266
50304
|
`);
|
|
50267
50305
|
} else {
|
|
50268
50306
|
failed3++;
|
|
50269
|
-
process.stdout.write(` ${
|
|
50307
|
+
process.stdout.write(` ${chalk267.yellow("skip")}
|
|
50270
50308
|
`);
|
|
50271
50309
|
}
|
|
50272
50310
|
}
|
|
@@ -50300,10 +50338,10 @@ function registerSessions(program2) {
|
|
|
50300
50338
|
}
|
|
50301
50339
|
|
|
50302
50340
|
// src/reportCliError.ts
|
|
50303
|
-
import
|
|
50341
|
+
import chalk268 from "chalk";
|
|
50304
50342
|
function reportCliError(error) {
|
|
50305
50343
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
50306
|
-
console.error(
|
|
50344
|
+
console.error(chalk268.red(error.message));
|
|
50307
50345
|
} else {
|
|
50308
50346
|
console.error(error);
|
|
50309
50347
|
}
|