@staff0rd/assist 0.719.0 → 0.721.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/claude/commands/restructure.md +2 -3
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +681 -574
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.721.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -296,8 +296,8 @@ function getRemoteOriginUrl(cwd) {
|
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
// src/commands/backlog/getCurrentOrigin.ts
|
|
299
|
-
function stripLeadingSlashes(
|
|
300
|
-
return
|
|
299
|
+
function stripLeadingSlashes(path106) {
|
|
300
|
+
return path106.replace(/^\/+/, "");
|
|
301
301
|
}
|
|
302
302
|
function normalizeOrigin(raw) {
|
|
303
303
|
const trimmed = raw.trim().replace(/\.git$/i, "").replace(/\/+$/, "");
|
|
@@ -347,9 +347,9 @@ function findGitLink(dir) {
|
|
|
347
347
|
}
|
|
348
348
|
return null;
|
|
349
349
|
}
|
|
350
|
-
function isFile(
|
|
350
|
+
function isFile(path106) {
|
|
351
351
|
try {
|
|
352
|
-
return statSync(
|
|
352
|
+
return statSync(path106).isFile();
|
|
353
353
|
} catch {
|
|
354
354
|
return false;
|
|
355
355
|
}
|
|
@@ -368,9 +368,9 @@ function linkedGitDirParent(gitDir) {
|
|
|
368
368
|
const match = /^(.*)[/\\]worktrees[/\\][^/\\]+[/\\]?$/.exec(gitDir);
|
|
369
369
|
return match ? match[1] : null;
|
|
370
370
|
}
|
|
371
|
-
function readTrimmed(
|
|
371
|
+
function readTrimmed(path106) {
|
|
372
372
|
try {
|
|
373
|
-
const content = readFileSync2(
|
|
373
|
+
const content = readFileSync2(path106, "utf8").trim();
|
|
374
374
|
return content === "" ? null : content;
|
|
375
375
|
} catch {
|
|
376
376
|
return null;
|
|
@@ -383,10 +383,10 @@ function absolute(target, from) {
|
|
|
383
383
|
// src/shared/loadRawYaml.ts
|
|
384
384
|
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
|
|
385
385
|
import { parse as parseYaml } from "yaml";
|
|
386
|
-
function loadRawYaml(
|
|
387
|
-
if (!existsSync3(
|
|
386
|
+
function loadRawYaml(path106) {
|
|
387
|
+
if (!existsSync3(path106)) return {};
|
|
388
388
|
try {
|
|
389
|
-
const content = readFileSync3(
|
|
389
|
+
const content = readFileSync3(path106, "utf8");
|
|
390
390
|
return parseYaml(content) || {};
|
|
391
391
|
} catch {
|
|
392
392
|
return {};
|
|
@@ -458,8 +458,8 @@ function mergeRawConfigs(globalRaw, projectRaw) {
|
|
|
458
458
|
// src/commands/backlog/originDisplayName.ts
|
|
459
459
|
function originDisplayName(origin) {
|
|
460
460
|
if (origin.startsWith("local:")) {
|
|
461
|
-
const
|
|
462
|
-
const segments =
|
|
461
|
+
const path106 = origin.slice("local:".length).replace(/\/+$/, "");
|
|
462
|
+
const segments = path106.split("/").filter(Boolean);
|
|
463
463
|
return segments[segments.length - 1] ?? origin;
|
|
464
464
|
}
|
|
465
465
|
const firstSlash = origin.indexOf("/");
|
|
@@ -697,7 +697,8 @@ var assistConfigShape = {
|
|
|
697
697
|
}).optional(),
|
|
698
698
|
restructure: z3.strictObject({
|
|
699
699
|
ignore: z3.array(z3.string()).default([]),
|
|
700
|
-
pin: z3.array(z3.string()).default([])
|
|
700
|
+
pin: z3.array(z3.string()).default([]),
|
|
701
|
+
maxDepth: z3.number().int().positive().default(10)
|
|
701
702
|
}).optional(),
|
|
702
703
|
jira: z3.strictObject({
|
|
703
704
|
acField: z3.string().default("customfield_11937")
|
|
@@ -4319,8 +4320,8 @@ function getPreferredRemoteRepo(cwd) {
|
|
|
4319
4320
|
function gitRefUrl(kind, ref, cwd) {
|
|
4320
4321
|
const repo = getPreferredRemoteRepo(cwd);
|
|
4321
4322
|
if (!repo) return void 0;
|
|
4322
|
-
const
|
|
4323
|
-
return `https://github.com/${repo.org}/${repo.repo}/${
|
|
4323
|
+
const path106 = kind === "branch" ? "tree" : "commit";
|
|
4324
|
+
return `https://github.com/${repo.org}/${repo.repo}/${path106}/${ref}`;
|
|
4324
4325
|
}
|
|
4325
4326
|
|
|
4326
4327
|
// src/commands/sessions/shared/resolveSessionTranscript.ts
|
|
@@ -4481,9 +4482,9 @@ var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
|
|
|
4481
4482
|
function backupLocalBacklogFiles(dir) {
|
|
4482
4483
|
const moved = [];
|
|
4483
4484
|
for (const name of LOCAL_FILES) {
|
|
4484
|
-
const
|
|
4485
|
-
if (existsSync20(
|
|
4486
|
-
renameSync(
|
|
4485
|
+
const path106 = join19(dir, ".assist", name);
|
|
4486
|
+
if (existsSync20(path106)) {
|
|
4487
|
+
renameSync(path106, `${path106}.bak`);
|
|
4487
4488
|
moved.push(`${name} \u2192 ${name}.bak`);
|
|
4488
4489
|
}
|
|
4489
4490
|
}
|
|
@@ -4967,8 +4968,8 @@ var backlogItemSchema = z4.strictObject({
|
|
|
4967
4968
|
var backlogFileSchema = z4.array(backlogItemSchema);
|
|
4968
4969
|
|
|
4969
4970
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
4970
|
-
function parseBacklogJsonl(
|
|
4971
|
-
const content = readFileSync13(
|
|
4971
|
+
function parseBacklogJsonl(path106) {
|
|
4972
|
+
const content = readFileSync13(path106, "utf8").trim();
|
|
4972
4973
|
if (content.length === 0) return [];
|
|
4973
4974
|
return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
|
|
4974
4975
|
}
|
|
@@ -5514,9 +5515,9 @@ function originToSshUrl(origin) {
|
|
|
5514
5515
|
const firstSlash = origin.indexOf("/");
|
|
5515
5516
|
if (firstSlash <= 0) return null;
|
|
5516
5517
|
const host = origin.slice(0, firstSlash);
|
|
5517
|
-
const
|
|
5518
|
-
if (!
|
|
5519
|
-
return `git@${host}:${
|
|
5518
|
+
const path106 = origin.slice(firstSlash + 1);
|
|
5519
|
+
if (!path106) return null;
|
|
5520
|
+
return `git@${host}:${path106}.git`;
|
|
5520
5521
|
}
|
|
5521
5522
|
|
|
5522
5523
|
// src/commands/backlog/cloneRepo.ts
|
|
@@ -7154,10 +7155,10 @@ var hooksSettings = {
|
|
|
7154
7155
|
}
|
|
7155
7156
|
};
|
|
7156
7157
|
function ensureHooksSettings() {
|
|
7157
|
-
const
|
|
7158
|
-
mkdirSync5(dirname15(
|
|
7159
|
-
writeFileSync16(
|
|
7160
|
-
return
|
|
7158
|
+
const path106 = daemonPaths.hooksSettings;
|
|
7159
|
+
mkdirSync5(dirname15(path106), { recursive: true });
|
|
7160
|
+
writeFileSync16(path106, JSON.stringify(hooksSettings, null, 2));
|
|
7161
|
+
return path106;
|
|
7161
7162
|
}
|
|
7162
7163
|
|
|
7163
7164
|
// src/shared/spawnInherit.ts
|
|
@@ -7913,24 +7914,24 @@ function getOwnerPath(itemId2) {
|
|
|
7913
7914
|
function recordSignalOwner(itemId2) {
|
|
7914
7915
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
7915
7916
|
if (!sessionId) return;
|
|
7916
|
-
const
|
|
7917
|
-
mkdirSync7(dirname16(
|
|
7918
|
-
writeFileSync18(
|
|
7917
|
+
const path106 = getOwnerPath(itemId2);
|
|
7918
|
+
mkdirSync7(dirname16(path106), { recursive: true });
|
|
7919
|
+
writeFileSync18(path106, JSON.stringify({ sessionId }));
|
|
7919
7920
|
}
|
|
7920
7921
|
function readSignalOwner(itemId2) {
|
|
7921
|
-
const
|
|
7922
|
-
if (!existsSync26(
|
|
7922
|
+
const path106 = getOwnerPath(itemId2);
|
|
7923
|
+
if (!existsSync26(path106)) return void 0;
|
|
7923
7924
|
try {
|
|
7924
|
-
const parsed = JSON.parse(readFileSync17(
|
|
7925
|
+
const parsed = JSON.parse(readFileSync17(path106, "utf8"));
|
|
7925
7926
|
return parsed.sessionId;
|
|
7926
7927
|
} catch {
|
|
7927
7928
|
return void 0;
|
|
7928
7929
|
}
|
|
7929
7930
|
}
|
|
7930
7931
|
function clearSignalOwner(itemId2) {
|
|
7931
|
-
const
|
|
7932
|
+
const path106 = getOwnerPath(itemId2);
|
|
7932
7933
|
try {
|
|
7933
|
-
rmSync(
|
|
7934
|
+
rmSync(path106);
|
|
7934
7935
|
} catch {
|
|
7935
7936
|
}
|
|
7936
7937
|
}
|
|
@@ -7967,19 +7968,19 @@ function resolveSignalTarget(event, data) {
|
|
|
7967
7968
|
function writeSignal(event, data) {
|
|
7968
7969
|
const target = resolveSignalTarget(event, data);
|
|
7969
7970
|
if (!target) return;
|
|
7970
|
-
const
|
|
7971
|
-
if (!
|
|
7971
|
+
const path106 = getSignalPath(target);
|
|
7972
|
+
if (!path106) return;
|
|
7972
7973
|
const signal = { event, sessionId: target, ...data };
|
|
7973
|
-
mkdirSync8(dirname17(
|
|
7974
|
-
writeFileSync19(
|
|
7974
|
+
mkdirSync8(dirname17(path106), { recursive: true });
|
|
7975
|
+
writeFileSync19(path106, JSON.stringify(signal));
|
|
7975
7976
|
}
|
|
7976
7977
|
|
|
7977
7978
|
// src/commands/backlog/readSignal.ts
|
|
7978
7979
|
function readSignal() {
|
|
7979
|
-
const
|
|
7980
|
-
if (!
|
|
7980
|
+
const path106 = getSignalPath();
|
|
7981
|
+
if (!path106 || !existsSync27(path106)) return void 0;
|
|
7981
7982
|
try {
|
|
7982
|
-
return JSON.parse(readFileSync18(
|
|
7983
|
+
return JSON.parse(readFileSync18(path106, "utf8"));
|
|
7983
7984
|
} catch {
|
|
7984
7985
|
return void 0;
|
|
7985
7986
|
}
|
|
@@ -8177,13 +8178,13 @@ function activityPath(sessionId) {
|
|
|
8177
8178
|
function emitActivity(activity2) {
|
|
8178
8179
|
const sessionId = process.env.ASSIST_ACTIVITY_ID;
|
|
8179
8180
|
if (!sessionId) return;
|
|
8180
|
-
const
|
|
8181
|
-
mkdirSync9(dirname18(
|
|
8182
|
-
writeFileSync20(
|
|
8181
|
+
const path106 = activityPath(sessionId);
|
|
8182
|
+
mkdirSync9(dirname18(path106), { recursive: true });
|
|
8183
|
+
writeFileSync20(path106, JSON.stringify({ ...activity2, startedAt: Date.now() }));
|
|
8183
8184
|
}
|
|
8184
|
-
function readActivity(
|
|
8185
|
+
function readActivity(path106) {
|
|
8185
8186
|
try {
|
|
8186
|
-
return JSON.parse(readFileSync19(
|
|
8187
|
+
return JSON.parse(readFileSync19(path106, "utf8"));
|
|
8187
8188
|
} catch {
|
|
8188
8189
|
return void 0;
|
|
8189
8190
|
}
|
|
@@ -8193,9 +8194,9 @@ function reconcileActivity(sessionId, activity2) {
|
|
|
8193
8194
|
removeActivity(sessionId);
|
|
8194
8195
|
return;
|
|
8195
8196
|
}
|
|
8196
|
-
const
|
|
8197
|
-
mkdirSync9(dirname18(
|
|
8198
|
-
writeFileSync20(
|
|
8197
|
+
const path106 = activityPath(sessionId);
|
|
8198
|
+
mkdirSync9(dirname18(path106), { recursive: true });
|
|
8199
|
+
writeFileSync20(path106, JSON.stringify(activity2));
|
|
8199
8200
|
}
|
|
8200
8201
|
function removeActivity(sessionId) {
|
|
8201
8202
|
try {
|
|
@@ -10820,10 +10821,10 @@ function getStorePath(filename) {
|
|
|
10820
10821
|
return join34(getStoreDir(), filename);
|
|
10821
10822
|
}
|
|
10822
10823
|
function loadJson(filename) {
|
|
10823
|
-
const
|
|
10824
|
-
if (existsSync32(
|
|
10824
|
+
const path106 = getStorePath(filename);
|
|
10825
|
+
if (existsSync32(path106)) {
|
|
10825
10826
|
try {
|
|
10826
|
-
return JSON.parse(readFileSync20(
|
|
10827
|
+
return JSON.parse(readFileSync20(path106, "utf8"));
|
|
10827
10828
|
} catch {
|
|
10828
10829
|
return {};
|
|
10829
10830
|
}
|
|
@@ -10842,22 +10843,22 @@ function saveJson(filename, data) {
|
|
|
10842
10843
|
var REGISTRY_FILE = "worktrees.json";
|
|
10843
10844
|
function readWorktreeRegistry() {
|
|
10844
10845
|
const data = loadJson(REGISTRY_FILE);
|
|
10845
|
-
return Object.entries(data).filter(([, record]) => !record.reaped).map(([
|
|
10846
|
+
return Object.entries(data).filter(([, record]) => !record.reaped).map(([path106, record]) => ({ path: path106, ...record }));
|
|
10846
10847
|
}
|
|
10847
|
-
function worktreeAttributionIncludingReaped(
|
|
10848
|
-
const record = loadJson(REGISTRY_FILE)[
|
|
10848
|
+
function worktreeAttributionIncludingReaped(path106) {
|
|
10849
|
+
const record = loadJson(REGISTRY_FILE)[path106];
|
|
10849
10850
|
return record ? { clone: record.clone, origin: record.origin } : void 0;
|
|
10850
10851
|
}
|
|
10851
|
-
function recordWorktree(
|
|
10852
|
+
function recordWorktree(path106, clone, origin) {
|
|
10852
10853
|
const data = loadJson(REGISTRY_FILE);
|
|
10853
|
-
data[
|
|
10854
|
+
data[path106] = { clone, origin };
|
|
10854
10855
|
saveJson(REGISTRY_FILE, data);
|
|
10855
10856
|
}
|
|
10856
|
-
function forgetWorktree(
|
|
10857
|
+
function forgetWorktree(path106) {
|
|
10857
10858
|
const data = loadJson(REGISTRY_FILE);
|
|
10858
|
-
const record = data[
|
|
10859
|
+
const record = data[path106];
|
|
10859
10860
|
if (!record || record.reaped) return;
|
|
10860
|
-
data[
|
|
10861
|
+
data[path106] = { ...record, reaped: true };
|
|
10861
10862
|
saveJson(REGISTRY_FILE, data);
|
|
10862
10863
|
}
|
|
10863
10864
|
|
|
@@ -11467,10 +11468,10 @@ function completeLines(text18, windowIsPartial) {
|
|
|
11467
11468
|
if (windowIsPartial) all.shift();
|
|
11468
11469
|
return all;
|
|
11469
11470
|
}
|
|
11470
|
-
function readLogTail(
|
|
11471
|
+
function readLogTail(path106, lines2) {
|
|
11471
11472
|
let fd;
|
|
11472
11473
|
try {
|
|
11473
|
-
fd = openSync4(
|
|
11474
|
+
fd = openSync4(path106, "r");
|
|
11474
11475
|
} catch {
|
|
11475
11476
|
return [];
|
|
11476
11477
|
}
|
|
@@ -11735,8 +11736,8 @@ async function loadCommittedPaths(cwd, sessionId) {
|
|
|
11735
11736
|
for (const commit2 of commits2) {
|
|
11736
11737
|
const resolved = await resolveCommit(cwd, commit2.sha);
|
|
11737
11738
|
if (!resolved) continue;
|
|
11738
|
-
for (const
|
|
11739
|
-
if (!bases.has(
|
|
11739
|
+
for (const path106 of resolved.paths) {
|
|
11740
|
+
if (!bases.has(path106)) bases.set(path106, resolved.base);
|
|
11740
11741
|
}
|
|
11741
11742
|
}
|
|
11742
11743
|
return { commits: commits2, bases };
|
|
@@ -11754,16 +11755,16 @@ async function itemChangeSet(cwd, sessionId) {
|
|
|
11754
11755
|
}
|
|
11755
11756
|
function groupByBase(bases) {
|
|
11756
11757
|
const groups = /* @__PURE__ */ new Map();
|
|
11757
|
-
for (const [
|
|
11758
|
+
for (const [path106, base] of bases) {
|
|
11758
11759
|
const paths = groups.get(base);
|
|
11759
|
-
if (paths) paths.push(
|
|
11760
|
-
else groups.set(base, [
|
|
11760
|
+
if (paths) paths.push(path106);
|
|
11761
|
+
else groups.set(base, [path106]);
|
|
11761
11762
|
}
|
|
11762
11763
|
return [...groups].map(([base, paths]) => ({ base, paths: paths.sort() }));
|
|
11763
11764
|
}
|
|
11764
11765
|
async function dirtyPaths(cwd, bases) {
|
|
11765
11766
|
const output = await execGit(cwd, ["diff", "--name-only", "HEAD"]);
|
|
11766
|
-
return output.split("\n").filter((
|
|
11767
|
+
return output.split("\n").filter((path106) => path106 && !bases.has(path106)).sort();
|
|
11767
11768
|
}
|
|
11768
11769
|
|
|
11769
11770
|
// src/commands/sessions/web/scopedDiff.ts
|
|
@@ -11772,8 +11773,8 @@ async function scopedDiff(cwd, session, scope) {
|
|
|
11772
11773
|
if (scope.kind === "commit") return commitDiff(cwd, scope.sha);
|
|
11773
11774
|
return await trackedScopeDiff(cwd, session, scope) + await untrackedDiff(cwd);
|
|
11774
11775
|
}
|
|
11775
|
-
async function untrackedFileDiff(cwd,
|
|
11776
|
-
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null",
|
|
11776
|
+
async function untrackedFileDiff(cwd, path106) {
|
|
11777
|
+
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path106], {
|
|
11777
11778
|
maxBuffer: MAX_DIFF_BYTES,
|
|
11778
11779
|
allowFailure: true
|
|
11779
11780
|
});
|
|
@@ -11786,7 +11787,7 @@ async function untrackedDiff(cwd) {
|
|
|
11786
11787
|
]);
|
|
11787
11788
|
const paths = list5.split("\n").filter(Boolean);
|
|
11788
11789
|
const diffs = await Promise.all(
|
|
11789
|
-
paths.map((
|
|
11790
|
+
paths.map((path106) => untrackedFileDiff(cwd, path106))
|
|
11790
11791
|
);
|
|
11791
11792
|
return diffs.join("");
|
|
11792
11793
|
}
|
|
@@ -11879,9 +11880,9 @@ import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve10
|
|
|
11879
11880
|
function repoRoot(cwd) {
|
|
11880
11881
|
return resolve10(cwd);
|
|
11881
11882
|
}
|
|
11882
|
-
function resolveWithinCwd(cwd,
|
|
11883
|
+
function resolveWithinCwd(cwd, path106) {
|
|
11883
11884
|
const root2 = repoRoot(cwd);
|
|
11884
|
-
const target = resolve10(root2,
|
|
11885
|
+
const target = resolve10(root2, path106);
|
|
11885
11886
|
const rel = relative2(root2, target);
|
|
11886
11887
|
if (rel === "" || rel.startsWith("..") || isAbsolute2(rel)) return null;
|
|
11887
11888
|
return target;
|
|
@@ -11891,14 +11892,14 @@ function resolveWithinCwd(cwd, path104) {
|
|
|
11891
11892
|
function getFileTarget(req, res) {
|
|
11892
11893
|
const cwd = getCwdParam(req, res);
|
|
11893
11894
|
if (!cwd) return null;
|
|
11894
|
-
const
|
|
11895
|
+
const path106 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
|
|
11895
11896
|
"path"
|
|
11896
11897
|
);
|
|
11897
|
-
if (!
|
|
11898
|
+
if (!path106) {
|
|
11898
11899
|
respondJson(res, 400, { error: "Missing path" });
|
|
11899
11900
|
return null;
|
|
11900
11901
|
}
|
|
11901
|
-
const target = resolveWithinCwd(cwd,
|
|
11902
|
+
const target = resolveWithinCwd(cwd, path106);
|
|
11902
11903
|
if (!target) {
|
|
11903
11904
|
respondJson(res, 400, { error: "Path outside cwd" });
|
|
11904
11905
|
return null;
|
|
@@ -11957,9 +11958,9 @@ function segmentText(segment) {
|
|
|
11957
11958
|
if (segment.kind === "index") return `[${segment.index}]`;
|
|
11958
11959
|
return "[]";
|
|
11959
11960
|
}
|
|
11960
|
-
function formatConfigPath(
|
|
11961
|
+
function formatConfigPath(path106) {
|
|
11961
11962
|
let text18 = "";
|
|
11962
|
-
for (const segment of
|
|
11963
|
+
for (const segment of path106) {
|
|
11963
11964
|
const dotted = segment.kind === "key" || segment.kind === "entry";
|
|
11964
11965
|
const rendered = segmentText(segment);
|
|
11965
11966
|
text18 += dotted && text18 ? `.${rendered}` : rendered;
|
|
@@ -12120,11 +12121,11 @@ function enumValues(node) {
|
|
|
12120
12121
|
function opaqueConfigNode(inner, base) {
|
|
12121
12122
|
return { ...base, kind: "other", type: leafTypeOf(inner) };
|
|
12122
12123
|
}
|
|
12123
|
-
function build(node,
|
|
12124
|
+
function build(node, path106) {
|
|
12124
12125
|
const { inner, defaultValue, optional } = unwrapSchemaNode(node);
|
|
12125
12126
|
const secret = isSecretSchemaNode(node) || isSecretSchemaNode(inner);
|
|
12126
12127
|
const base = {
|
|
12127
|
-
path:
|
|
12128
|
+
path: path106,
|
|
12128
12129
|
...optional ? { optional: true } : {},
|
|
12129
12130
|
...defaultValue === void 0 ? {} : { defaultValue },
|
|
12130
12131
|
...secret ? { secret: true } : {}
|
|
@@ -12180,11 +12181,11 @@ function describeConfigLeaves(schema2) {
|
|
|
12180
12181
|
|
|
12181
12182
|
// src/commands/config/globalConfigFileLabel.ts
|
|
12182
12183
|
var WINDOWS_MOUNT_PREFIX = "/mnt/";
|
|
12183
|
-
function globalConfigFileLabel(
|
|
12184
|
-
if (
|
|
12185
|
-
if (
|
|
12186
|
-
return `${
|
|
12187
|
-
return
|
|
12184
|
+
function globalConfigFileLabel(path106) {
|
|
12185
|
+
if (path106 === getGlobalConfigPath()) return "~/.assist.yml";
|
|
12186
|
+
if (path106.startsWith(WINDOWS_MOUNT_PREFIX))
|
|
12187
|
+
return `${path106} on the Windows host`;
|
|
12188
|
+
return path106;
|
|
12188
12189
|
}
|
|
12189
12190
|
|
|
12190
12191
|
// src/commands/config/readRawConfigLayers.ts
|
|
@@ -12241,35 +12242,35 @@ function isPlainRecord(value) {
|
|
|
12241
12242
|
}
|
|
12242
12243
|
|
|
12243
12244
|
// src/shared/mapConfigSecrets.ts
|
|
12244
|
-
function mapChildren(value,
|
|
12245
|
+
function mapChildren(value, path106, childNode, map) {
|
|
12245
12246
|
if (!isPlainRecord(value)) return value;
|
|
12246
12247
|
return Object.fromEntries(
|
|
12247
12248
|
Object.entries(value).map(([name, child]) => [
|
|
12248
12249
|
name,
|
|
12249
|
-
walk(child, [...
|
|
12250
|
+
walk(child, [...path106, name], childNode(name), map)
|
|
12250
12251
|
])
|
|
12251
12252
|
);
|
|
12252
12253
|
}
|
|
12253
|
-
function mapItems(value,
|
|
12254
|
+
function mapItems(value, path106, item, map) {
|
|
12254
12255
|
if (!Array.isArray(value)) return value;
|
|
12255
|
-
return value.map((entry, index3) => walk(entry, [...
|
|
12256
|
+
return value.map((entry, index3) => walk(entry, [...path106, index3], item, map));
|
|
12256
12257
|
}
|
|
12257
|
-
function walk(value,
|
|
12258
|
+
function walk(value, path106, node, map) {
|
|
12258
12259
|
if (!node || value === void 0 || value === null) return value;
|
|
12259
|
-
if (node.secret) return map(value,
|
|
12260
|
+
if (node.secret) return map(value, path106);
|
|
12260
12261
|
switch (node.kind) {
|
|
12261
12262
|
case "object":
|
|
12262
12263
|
case "unionOfObjects":
|
|
12263
12264
|
return mapChildren(
|
|
12264
12265
|
value,
|
|
12265
|
-
|
|
12266
|
+
path106,
|
|
12266
12267
|
(name) => configNodeField(node, name),
|
|
12267
12268
|
map
|
|
12268
12269
|
);
|
|
12269
12270
|
case "objectList":
|
|
12270
|
-
return mapItems(value,
|
|
12271
|
+
return mapItems(value, path106, node.item, map);
|
|
12271
12272
|
case "record":
|
|
12272
|
-
return mapChildren(value,
|
|
12273
|
+
return mapChildren(value, path106, () => node.value, map);
|
|
12273
12274
|
default:
|
|
12274
12275
|
return value;
|
|
12275
12276
|
}
|
|
@@ -12294,9 +12295,9 @@ function isTraversable(value) {
|
|
|
12294
12295
|
function stepInto(current, key) {
|
|
12295
12296
|
return isTraversable(current) ? current[key] : void 0;
|
|
12296
12297
|
}
|
|
12297
|
-
function getNestedValue(obj,
|
|
12298
|
+
function getNestedValue(obj, path106) {
|
|
12298
12299
|
let current = obj;
|
|
12299
|
-
for (const key of
|
|
12300
|
+
for (const key of path106.split(".")) current = stepInto(current, key);
|
|
12300
12301
|
return current;
|
|
12301
12302
|
}
|
|
12302
12303
|
|
|
@@ -12346,9 +12347,9 @@ function step(node, segment) {
|
|
|
12346
12347
|
return void 0;
|
|
12347
12348
|
}
|
|
12348
12349
|
}
|
|
12349
|
-
function findConfigNode(root2,
|
|
12350
|
+
function findConfigNode(root2, path106) {
|
|
12350
12351
|
let current = root2;
|
|
12351
|
-
for (const segment of
|
|
12352
|
+
for (const segment of path106) {
|
|
12352
12353
|
if (!current) return void 0;
|
|
12353
12354
|
current = step(current, segment);
|
|
12354
12355
|
}
|
|
@@ -12365,34 +12366,34 @@ function nameSegment(name) {
|
|
|
12365
12366
|
return name === RECORD_ENTRY_TOKEN ? { kind: "entry" } : { kind: "key", name };
|
|
12366
12367
|
}
|
|
12367
12368
|
function parseConfigPath(text18) {
|
|
12368
|
-
const
|
|
12369
|
+
const path106 = [];
|
|
12369
12370
|
let at2 = 0;
|
|
12370
12371
|
while (at2 < text18.length) {
|
|
12371
12372
|
if (text18[at2] === "[") {
|
|
12372
12373
|
const close = text18.indexOf("]", at2);
|
|
12373
12374
|
const segment = close === -1 ? void 0 : bracketSegment(text18.slice(at2 + 1, close));
|
|
12374
12375
|
if (!segment) return void 0;
|
|
12375
|
-
|
|
12376
|
+
path106.push(segment);
|
|
12376
12377
|
at2 = close + 1;
|
|
12377
12378
|
continue;
|
|
12378
12379
|
}
|
|
12379
12380
|
if (text18[at2] === ".") {
|
|
12380
|
-
if (
|
|
12381
|
+
if (path106.length === 0) return void 0;
|
|
12381
12382
|
at2 += 1;
|
|
12382
12383
|
}
|
|
12383
12384
|
const start3 = at2;
|
|
12384
12385
|
while (at2 < text18.length && text18[at2] !== "." && text18[at2] !== "[") at2 += 1;
|
|
12385
12386
|
const name = text18.slice(start3, at2);
|
|
12386
12387
|
if (!name) return void 0;
|
|
12387
|
-
|
|
12388
|
+
path106.push(nameSegment(name));
|
|
12388
12389
|
}
|
|
12389
|
-
return
|
|
12390
|
+
return path106;
|
|
12390
12391
|
}
|
|
12391
12392
|
|
|
12392
12393
|
// src/commands/config/configEntryNode.ts
|
|
12393
12394
|
function configEntryNode(root2, key) {
|
|
12394
|
-
const
|
|
12395
|
-
return
|
|
12395
|
+
const path106 = parseConfigPath(key);
|
|
12396
|
+
return path106 ? findConfigNode(root2, path106) : void 0;
|
|
12396
12397
|
}
|
|
12397
12398
|
|
|
12398
12399
|
// src/commands/backlog/harnessConfigHelp.ts
|
|
@@ -12623,6 +12624,11 @@ var refactorConfigHelp = [
|
|
|
12623
12624
|
key: "restructure.pin",
|
|
12624
12625
|
setter: 'assist config set restructure.pin "SessionCard"',
|
|
12625
12626
|
note: "module names (basename without extension) restructure lifts out of deep import chains into the folder of the nearest root or pinned module above them, together with their subtrees"
|
|
12627
|
+
},
|
|
12628
|
+
{
|
|
12629
|
+
key: "restructure.maxDepth",
|
|
12630
|
+
setter: "assist config set restructure.maxDepth 10",
|
|
12631
|
+
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"
|
|
12626
12632
|
}
|
|
12627
12633
|
];
|
|
12628
12634
|
|
|
@@ -13131,7 +13137,7 @@ function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
|
13131
13137
|
const parent = dirname22(branchKeyPath);
|
|
13132
13138
|
const branchPrefix = basename10(branchKeyPath);
|
|
13133
13139
|
if (!existsSync34(parent)) return null;
|
|
13134
|
-
const synthesisFiles = readdirSync4(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join36(parent, name, "synthesis.md")).filter((
|
|
13140
|
+
const synthesisFiles = readdirSync4(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join36(parent, name, "synthesis.md")).filter((path106) => existsSync34(path106)).map((path106) => ({ path: path106, mtime: statSync5(path106).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
13135
13141
|
return synthesisFiles[0]?.path ?? null;
|
|
13136
13142
|
}
|
|
13137
13143
|
|
|
@@ -13161,12 +13167,12 @@ async function getReviewSynthesis(req, res) {
|
|
|
13161
13167
|
const cwd = getCwdParam(req, res);
|
|
13162
13168
|
if (!cwd) return;
|
|
13163
13169
|
try {
|
|
13164
|
-
const
|
|
13165
|
-
if (!
|
|
13170
|
+
const path106 = await resolveSynthesisPath(cwd);
|
|
13171
|
+
if (!path106) {
|
|
13166
13172
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
13167
13173
|
return;
|
|
13168
13174
|
}
|
|
13169
|
-
respondJson(res, 200, { synthesis: readFileSync22(
|
|
13175
|
+
respondJson(res, 200, { synthesis: readFileSync22(path106, "utf8") });
|
|
13170
13176
|
} catch {
|
|
13171
13177
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
13172
13178
|
}
|
|
@@ -13249,8 +13255,8 @@ function parseDiffNameStatus(output) {
|
|
|
13249
13255
|
if (!status3 || fields.length < 2) continue;
|
|
13250
13256
|
const category = categorize(status3[0]);
|
|
13251
13257
|
if (!category) continue;
|
|
13252
|
-
const
|
|
13253
|
-
if (
|
|
13258
|
+
const path106 = fields[fields.length - 1];
|
|
13259
|
+
if (path106) result[category].push(path106);
|
|
13254
13260
|
}
|
|
13255
13261
|
return result;
|
|
13256
13262
|
}
|
|
@@ -13460,21 +13466,21 @@ function subsequenceScore(text18, query) {
|
|
|
13460
13466
|
}
|
|
13461
13467
|
return score - Math.min(text18.length, MAX_LENGTH_PENALTY);
|
|
13462
13468
|
}
|
|
13463
|
-
function scoreFilePath(
|
|
13469
|
+
function scoreFilePath(path106, query) {
|
|
13464
13470
|
const needle = query.trim().toLowerCase();
|
|
13465
13471
|
if (!needle) return 0;
|
|
13466
|
-
const basename31 =
|
|
13472
|
+
const basename31 = path106.slice(path106.lastIndexOf("/") + 1);
|
|
13467
13473
|
const inBasename = subsequenceScore(basename31, needle);
|
|
13468
13474
|
if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
|
|
13469
|
-
return subsequenceScore(
|
|
13475
|
+
return subsequenceScore(path106, needle);
|
|
13470
13476
|
}
|
|
13471
13477
|
|
|
13472
13478
|
// src/commands/sessions/web/rankFilePaths.ts
|
|
13473
13479
|
function rankFilePaths(paths, query, limit) {
|
|
13474
13480
|
const scored = [];
|
|
13475
|
-
for (const
|
|
13476
|
-
const score = scoreFilePath(
|
|
13477
|
-
if (score !== null) scored.push({ path:
|
|
13481
|
+
for (const path106 of paths) {
|
|
13482
|
+
const score = scoreFilePath(path106, query);
|
|
13483
|
+
if (score !== null) scored.push({ path: path106, score });
|
|
13478
13484
|
}
|
|
13479
13485
|
scored.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
|
|
13480
13486
|
return scored.slice(0, limit).map((entry) => entry.path);
|
|
@@ -14184,11 +14190,11 @@ function logLinkedRequest(req, res) {
|
|
|
14184
14190
|
const started = Date.now();
|
|
14185
14191
|
const from = req.headers[LINKED_FROM_HEADER2];
|
|
14186
14192
|
const trace = req.headers[TRACE_HEADER] ?? "none";
|
|
14187
|
-
const
|
|
14193
|
+
const path106 = new URL(req.url ?? "/", "http://localhost").pathname;
|
|
14188
14194
|
res.once("finish", () => {
|
|
14189
|
-
if (isQuietPoll(
|
|
14195
|
+
if (isQuietPoll(path106, res.statusCode)) return;
|
|
14190
14196
|
console.log(
|
|
14191
|
-
`link-from ${from} http: ${req.method} ${
|
|
14197
|
+
`link-from ${from} http: ${req.method} ${path106} trace=${trace} -> ${res.statusCode} (${Date.now() - started}ms)`
|
|
14192
14198
|
);
|
|
14193
14199
|
});
|
|
14194
14200
|
}
|
|
@@ -14576,8 +14582,8 @@ async function liveDeployments(cwd, repo, environments) {
|
|
|
14576
14582
|
|
|
14577
14583
|
// src/commands/sessions/web/releases/latestRun.ts
|
|
14578
14584
|
async function latestRun(cwd, repo, workflow) {
|
|
14579
|
-
const
|
|
14580
|
-
const response = await ghJson(cwd, ["api",
|
|
14585
|
+
const path106 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
|
|
14586
|
+
const response = await ghJson(cwd, ["api", path106]);
|
|
14581
14587
|
const run4 = response.workflow_runs?.[0];
|
|
14582
14588
|
if (!run4) return null;
|
|
14583
14589
|
return {
|
|
@@ -14858,38 +14864,38 @@ async function performRestart(target, deps2 = {}) {
|
|
|
14858
14864
|
import { relative as relative3 } from "path";
|
|
14859
14865
|
|
|
14860
14866
|
// src/commands/sessions/web/revertPathChanges.ts
|
|
14861
|
-
async function isTracked(cwd,
|
|
14867
|
+
async function isTracked(cwd, path106) {
|
|
14862
14868
|
try {
|
|
14863
|
-
await execGit(cwd, ["ls-files", "--error-unmatch", "--",
|
|
14869
|
+
await execGit(cwd, ["ls-files", "--error-unmatch", "--", path106]);
|
|
14864
14870
|
return true;
|
|
14865
14871
|
} catch {
|
|
14866
14872
|
return false;
|
|
14867
14873
|
}
|
|
14868
14874
|
}
|
|
14869
|
-
async function isInHead(cwd,
|
|
14870
|
-
const listing = await execGit(cwd, ["ls-tree", "HEAD", "--",
|
|
14875
|
+
async function isInHead(cwd, path106) {
|
|
14876
|
+
const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path106]);
|
|
14871
14877
|
return listing.trim().length > 0;
|
|
14872
14878
|
}
|
|
14873
|
-
async function revertPathChanges(cwd,
|
|
14874
|
-
if (!await isTracked(cwd,
|
|
14875
|
-
await execGit(cwd, ["clean", "-f", "--",
|
|
14879
|
+
async function revertPathChanges(cwd, path106) {
|
|
14880
|
+
if (!await isTracked(cwd, path106)) {
|
|
14881
|
+
await execGit(cwd, ["clean", "-f", "--", path106]);
|
|
14876
14882
|
return;
|
|
14877
14883
|
}
|
|
14878
|
-
if (await isInHead(cwd,
|
|
14879
|
-
await execGit(cwd, ["checkout", "HEAD", "--",
|
|
14884
|
+
if (await isInHead(cwd, path106)) {
|
|
14885
|
+
await execGit(cwd, ["checkout", "HEAD", "--", path106]);
|
|
14880
14886
|
return;
|
|
14881
14887
|
}
|
|
14882
|
-
await execGit(cwd, ["rm", "-f", "--",
|
|
14888
|
+
await execGit(cwd, ["rm", "-f", "--", path106]);
|
|
14883
14889
|
}
|
|
14884
14890
|
|
|
14885
14891
|
// src/commands/sessions/web/revertDiffFile.ts
|
|
14886
14892
|
async function revertDiffFile(req, res) {
|
|
14887
14893
|
const resolved = getFileTarget(req, res);
|
|
14888
14894
|
if (!resolved) return;
|
|
14889
|
-
const
|
|
14895
|
+
const path106 = relative3(repoRoot(resolved.cwd), resolved.target);
|
|
14890
14896
|
try {
|
|
14891
|
-
await revertPathChanges(resolved.cwd,
|
|
14892
|
-
respondJson(res, 200, { reverted:
|
|
14897
|
+
await revertPathChanges(resolved.cwd, path106);
|
|
14898
|
+
respondJson(res, 200, { reverted: path106 });
|
|
14893
14899
|
} catch (error) {
|
|
14894
14900
|
respondJson(res, 500, {
|
|
14895
14901
|
error: error instanceof Error ? error.message : "Failed to revert file"
|
|
@@ -14994,7 +15000,7 @@ async function readJsonBody(req) {
|
|
|
14994
15000
|
function requestedPaths(body) {
|
|
14995
15001
|
const paths = body.paths;
|
|
14996
15002
|
if (!Array.isArray(paths)) return null;
|
|
14997
|
-
if (paths.some((
|
|
15003
|
+
if (paths.some((path106) => typeof path106 !== "string")) return null;
|
|
14998
15004
|
return paths;
|
|
14999
15005
|
}
|
|
15000
15006
|
async function revertDiffPaths(req, res) {
|
|
@@ -15014,10 +15020,10 @@ async function revertDiffPaths(req, res) {
|
|
|
15014
15020
|
const root2 = repoRoot(cwd);
|
|
15015
15021
|
const reverted = [];
|
|
15016
15022
|
const failed3 = [];
|
|
15017
|
-
for (const
|
|
15018
|
-
const target = resolveWithinCwd(cwd,
|
|
15023
|
+
for (const path106 of paths) {
|
|
15024
|
+
const target = resolveWithinCwd(cwd, path106);
|
|
15019
15025
|
if (!target) {
|
|
15020
|
-
failed3.push({ path:
|
|
15026
|
+
failed3.push({ path: path106, error: "Path outside cwd" });
|
|
15021
15027
|
continue;
|
|
15022
15028
|
}
|
|
15023
15029
|
const relativePath = relative4(root2, target);
|
|
@@ -15116,11 +15122,11 @@ function coerceStructuredConfigValue(key, raw) {
|
|
|
15116
15122
|
};
|
|
15117
15123
|
}
|
|
15118
15124
|
function formatIssue(key, issue) {
|
|
15119
|
-
const
|
|
15125
|
+
const path106 = formatConfigPath([
|
|
15120
15126
|
{ kind: "key", name: key },
|
|
15121
15127
|
...issue.path.map(toSegment)
|
|
15122
15128
|
]);
|
|
15123
|
-
return `${
|
|
15129
|
+
return `${path106}: ${issue.message}`;
|
|
15124
15130
|
}
|
|
15125
15131
|
function toSegment(part) {
|
|
15126
15132
|
return typeof part === "number" ? { kind: "index", index: part } : { kind: "key", name: String(part) };
|
|
@@ -15215,9 +15221,9 @@ function coerceUnion(key, raw, types) {
|
|
|
15215
15221
|
}
|
|
15216
15222
|
|
|
15217
15223
|
// src/shared/valueAtConfigPath.ts
|
|
15218
|
-
function valueAtConfigPath(value,
|
|
15224
|
+
function valueAtConfigPath(value, path106) {
|
|
15219
15225
|
let current = value;
|
|
15220
|
-
for (const key of
|
|
15226
|
+
for (const key of path106) {
|
|
15221
15227
|
if (typeof key === "number") {
|
|
15222
15228
|
if (!Array.isArray(current)) return void 0;
|
|
15223
15229
|
current = current[key];
|
|
@@ -15234,7 +15240,7 @@ function restoreConfigSecrets(value, stored, node) {
|
|
|
15234
15240
|
return mapConfigSecrets(
|
|
15235
15241
|
value,
|
|
15236
15242
|
node,
|
|
15237
|
-
(secret,
|
|
15243
|
+
(secret, path106) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path106) : secret
|
|
15238
15244
|
);
|
|
15239
15245
|
}
|
|
15240
15246
|
|
|
@@ -15283,8 +15289,8 @@ function stepIntoNested(container, key, nextKey) {
|
|
|
15283
15289
|
}
|
|
15284
15290
|
return ensureObject(container, resolved);
|
|
15285
15291
|
}
|
|
15286
|
-
function setNestedValue(obj,
|
|
15287
|
-
const keys =
|
|
15292
|
+
function setNestedValue(obj, path106, value) {
|
|
15293
|
+
const keys = path106.split(".");
|
|
15288
15294
|
const result = { ...obj };
|
|
15289
15295
|
let current = result;
|
|
15290
15296
|
for (let i = 0; i < keys.length - 1; i++) {
|
|
@@ -15311,8 +15317,8 @@ function formatIssue2(issue, key) {
|
|
|
15311
15317
|
return issue.keys.map(
|
|
15312
15318
|
(unrecognized) => `${[...issue.path, unrecognized].join(".")}: Unrecognized key`
|
|
15313
15319
|
);
|
|
15314
|
-
const
|
|
15315
|
-
return [`${
|
|
15320
|
+
const path106 = issue.path.length > 0 ? issue.path.join(".") : key;
|
|
15321
|
+
return [`${path106}: ${issue.message}`];
|
|
15316
15322
|
}
|
|
15317
15323
|
|
|
15318
15324
|
// src/commands/config/applyConfigSet.ts
|
|
@@ -15554,8 +15560,8 @@ function removeAt(container, keys) {
|
|
|
15554
15560
|
}
|
|
15555
15561
|
return removeFromChild(container, key, rest);
|
|
15556
15562
|
}
|
|
15557
|
-
function unsetNestedValue(obj,
|
|
15558
|
-
const { container, removed } = removeAt(obj,
|
|
15563
|
+
function unsetNestedValue(obj, path106) {
|
|
15564
|
+
const { container, removed } = removeAt(obj, path106.split("."));
|
|
15559
15565
|
return { config: container, removed };
|
|
15560
15566
|
}
|
|
15561
15567
|
|
|
@@ -17044,13 +17050,13 @@ function findBuiltinDenyRaw(rawCommand) {
|
|
|
17044
17050
|
|
|
17045
17051
|
// src/commands/cliHook/findRestrictedPathDeny.ts
|
|
17046
17052
|
var RESTRICTED_PATHS = [".assist/restricted"];
|
|
17047
|
-
function restrictedPathRegex(
|
|
17048
|
-
const pattern2 =
|
|
17053
|
+
function restrictedPathRegex(path106) {
|
|
17054
|
+
const pattern2 = path106.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
|
|
17049
17055
|
return new RegExp(pattern2);
|
|
17050
17056
|
}
|
|
17051
|
-
var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((
|
|
17052
|
-
path:
|
|
17053
|
-
regex: restrictedPathRegex(
|
|
17057
|
+
var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path106) => ({
|
|
17058
|
+
path: path106,
|
|
17059
|
+
regex: restrictedPathRegex(path106)
|
|
17054
17060
|
}));
|
|
17055
17061
|
function findRestrictedPathDenyRaw(rawCommand) {
|
|
17056
17062
|
const rule = RESTRICTED_PATH_RULES.find(
|
|
@@ -17227,9 +17233,9 @@ var __dirname4 = dirname25(__filename3);
|
|
|
17227
17233
|
function packageRoot() {
|
|
17228
17234
|
return __dirname4;
|
|
17229
17235
|
}
|
|
17230
|
-
function readLines(
|
|
17231
|
-
if (!existsSync40(
|
|
17232
|
-
return readFileSync25(
|
|
17236
|
+
function readLines(path106) {
|
|
17237
|
+
if (!existsSync40(path106)) return [];
|
|
17238
|
+
return readFileSync25(path106, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
17233
17239
|
}
|
|
17234
17240
|
var cachedReads;
|
|
17235
17241
|
var cachedWrites;
|
|
@@ -17761,14 +17767,14 @@ function showProgress(p, label2) {
|
|
|
17761
17767
|
const pct = Math.round(p.done / p.total * 100);
|
|
17762
17768
|
process.stderr.write(`\r\x1B[K[${pct}%] Scanning ${label2}...`);
|
|
17763
17769
|
}
|
|
17764
|
-
async function resolveCommand2(cli,
|
|
17765
|
-
showProgress(p,
|
|
17766
|
-
const subHelp = await runHelp([cli, ...
|
|
17770
|
+
async function resolveCommand2(cli, path106, description, depth, p) {
|
|
17771
|
+
showProgress(p, path106.join(" "));
|
|
17772
|
+
const subHelp = await runHelp([cli, ...path106]);
|
|
17767
17773
|
if (!subHelp || !hasSubcommands(subHelp)) {
|
|
17768
|
-
return [{ path:
|
|
17774
|
+
return [{ path: path106, description }];
|
|
17769
17775
|
}
|
|
17770
|
-
const children = await discoverAt(cli,
|
|
17771
|
-
return children.length > 0 ? children : [{ path:
|
|
17776
|
+
const children = await discoverAt(cli, path106, depth + 1, p);
|
|
17777
|
+
return children.length > 0 ? children : [{ path: path106, description }];
|
|
17772
17778
|
}
|
|
17773
17779
|
async function discoverAt(cli, parentPath, depth, p) {
|
|
17774
17780
|
if (depth > SAFETY_DEPTH) return [];
|
|
@@ -17916,9 +17922,9 @@ function logPath(cli) {
|
|
|
17916
17922
|
return join43(homedir17(), ".assist", `cli-discover-${safeName}.log`);
|
|
17917
17923
|
}
|
|
17918
17924
|
function readCache(cli) {
|
|
17919
|
-
const
|
|
17920
|
-
if (!existsSync42(
|
|
17921
|
-
return readFileSync27(
|
|
17925
|
+
const path106 = logPath(cli);
|
|
17926
|
+
if (!existsSync42(path106)) return void 0;
|
|
17927
|
+
return readFileSync27(path106, "utf8");
|
|
17922
17928
|
}
|
|
17923
17929
|
function writeCache(cli, output) {
|
|
17924
17930
|
const dir = join43(homedir17(), ".assist");
|
|
@@ -18107,9 +18113,9 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
18107
18113
|
}
|
|
18108
18114
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
18109
18115
|
for (const entry of entries) {
|
|
18110
|
-
const
|
|
18116
|
+
const path106 = join45(dir, entry);
|
|
18111
18117
|
try {
|
|
18112
|
-
if (statSync7(
|
|
18118
|
+
if (statSync7(path106).mtimeMs < cutoff) unlinkSync7(path106);
|
|
18113
18119
|
} catch {
|
|
18114
18120
|
continue;
|
|
18115
18121
|
}
|
|
@@ -18119,10 +18125,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
18119
18125
|
// src/commands/codeComment/readPinState.ts
|
|
18120
18126
|
import { existsSync as existsSync43, readFileSync as readFileSync28 } from "fs";
|
|
18121
18127
|
function readPinState(pin2) {
|
|
18122
|
-
const
|
|
18123
|
-
if (!existsSync43(
|
|
18128
|
+
const path106 = getPinStatePath(pin2);
|
|
18129
|
+
if (!existsSync43(path106)) return void 0;
|
|
18124
18130
|
try {
|
|
18125
|
-
const state = JSON.parse(readFileSync28(
|
|
18131
|
+
const state = JSON.parse(readFileSync28(path106, "utf8"));
|
|
18126
18132
|
if (state.pin !== pin2) return void 0;
|
|
18127
18133
|
return state;
|
|
18128
18134
|
} catch {
|
|
@@ -18543,8 +18549,8 @@ function findUnmergedPaths() {
|
|
|
18543
18549
|
}
|
|
18544
18550
|
const found = /* @__PURE__ */ new Set();
|
|
18545
18551
|
for (const line of output.split("\n")) {
|
|
18546
|
-
const
|
|
18547
|
-
if (
|
|
18552
|
+
const path106 = line.split(" ")[1];
|
|
18553
|
+
if (path106) found.add(path106.trim());
|
|
18548
18554
|
}
|
|
18549
18555
|
return [...found];
|
|
18550
18556
|
}
|
|
@@ -19791,11 +19797,11 @@ async function loadPath(source) {
|
|
|
19791
19797
|
}
|
|
19792
19798
|
}
|
|
19793
19799
|
async function criteriaExtension() {
|
|
19794
|
-
const
|
|
19800
|
+
const path106 = await loadPath(criteriaExtensionDir());
|
|
19795
19801
|
console.log(
|
|
19796
19802
|
chalk137.bold("acceptance criteria outliner \u2014 GitHub browser extension")
|
|
19797
19803
|
);
|
|
19798
|
-
console.log(chalk137.dim(`load the unpacked extension from ${
|
|
19804
|
+
console.log(chalk137.dim(`load the unpacked extension from ${path106}`));
|
|
19799
19805
|
}
|
|
19800
19806
|
|
|
19801
19807
|
// src/commands/criteriaExtension/signCriteriaExtension.ts
|
|
@@ -19920,10 +19926,10 @@ async function signCriteriaExtension() {
|
|
|
19920
19926
|
process.exitCode = 1;
|
|
19921
19927
|
return;
|
|
19922
19928
|
}
|
|
19923
|
-
const
|
|
19929
|
+
const path106 = await signedAddonInstallPath(
|
|
19924
19930
|
await copySignedXpi(xpi, ARTIFACTS_DIR)
|
|
19925
19931
|
);
|
|
19926
|
-
console.log(chalk139.dim(`install the signed add-on from ${
|
|
19932
|
+
console.log(chalk139.dim(`install the signed add-on from ${path106}`));
|
|
19927
19933
|
}
|
|
19928
19934
|
|
|
19929
19935
|
// src/commands/registerCriteriaExtension.ts
|
|
@@ -20021,10 +20027,10 @@ function getMigrationApprovalPath(migrationId) {
|
|
|
20021
20027
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
20022
20028
|
import { existsSync as existsSync48, readFileSync as readFileSync30 } from "fs";
|
|
20023
20029
|
function readMigrationPinState(pin2) {
|
|
20024
|
-
const
|
|
20025
|
-
if (!existsSync48(
|
|
20030
|
+
const path106 = getMigrationPinPath(pin2);
|
|
20031
|
+
if (!existsSync48(path106)) return void 0;
|
|
20026
20032
|
try {
|
|
20027
|
-
const state = JSON.parse(readFileSync30(
|
|
20033
|
+
const state = JSON.parse(readFileSync30(path106, "utf8"));
|
|
20028
20034
|
if (state.pin !== pin2) return void 0;
|
|
20029
20035
|
if (!Number.isInteger(state.migrationId)) return void 0;
|
|
20030
20036
|
return state;
|
|
@@ -21934,10 +21940,10 @@ function decideCommentGuard(input, existingContent) {
|
|
|
21934
21940
|
import { existsSync as existsSync54, unlinkSync as unlinkSync11 } from "fs";
|
|
21935
21941
|
function consumeMigrationApproval(migrationId) {
|
|
21936
21942
|
sweepRestrictedDir();
|
|
21937
|
-
const
|
|
21938
|
-
if (!existsSync54(
|
|
21943
|
+
const path106 = getMigrationApprovalPath(migrationId);
|
|
21944
|
+
if (!existsSync54(path106)) return false;
|
|
21939
21945
|
try {
|
|
21940
|
-
unlinkSync11(
|
|
21946
|
+
unlinkSync11(path106);
|
|
21941
21947
|
return true;
|
|
21942
21948
|
} catch {
|
|
21943
21949
|
return false;
|
|
@@ -24341,11 +24347,11 @@ function recentDaemonLogLines(includeRelayed = true) {
|
|
|
24341
24347
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
24342
24348
|
import { realpathSync as realpathSync2 } from "fs";
|
|
24343
24349
|
import { resolve as resolve15 } from "path";
|
|
24344
|
-
function canonicalTreePath(
|
|
24350
|
+
function canonicalTreePath(path106) {
|
|
24345
24351
|
try {
|
|
24346
|
-
return realpathSync2(
|
|
24352
|
+
return realpathSync2(path106);
|
|
24347
24353
|
} catch {
|
|
24348
|
-
return resolve15(
|
|
24354
|
+
return resolve15(path106);
|
|
24349
24355
|
}
|
|
24350
24356
|
}
|
|
24351
24357
|
|
|
@@ -24398,22 +24404,22 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
24398
24404
|
const registered = new Set(listWorktreePaths(clone));
|
|
24399
24405
|
const branches = new Set(listLocalBranches(clone));
|
|
24400
24406
|
const isTaken = (candidate) => registered.has(candidate) || existsSync57(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename17(candidate));
|
|
24401
|
-
const
|
|
24407
|
+
const path106 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
24402
24408
|
const start3 = worktreeStartPoint(clone, strategy.trunk);
|
|
24403
24409
|
gitSync(clone, [
|
|
24404
24410
|
"worktree",
|
|
24405
24411
|
"add",
|
|
24406
24412
|
start3.track ? "--track" : "--no-track",
|
|
24407
24413
|
"-b",
|
|
24408
|
-
basename17(
|
|
24409
|
-
|
|
24414
|
+
basename17(path106),
|
|
24415
|
+
path106,
|
|
24410
24416
|
start3.ref
|
|
24411
24417
|
]);
|
|
24412
|
-
recordWorktree(
|
|
24418
|
+
recordWorktree(path106, clone, getCurrentOrigin(clone));
|
|
24413
24419
|
daemonLog(
|
|
24414
|
-
start3.track ? `worktree allocated ${
|
|
24420
|
+
start3.track ? `worktree allocated ${path106} (branch ${basename17(path106)} tracking ${start3.ref}) for clone ${clone}` : `worktree allocated ${path106} (branch ${basename17(path106)} off ${start3.ref}, no mainline tracking) for clone ${clone}`
|
|
24415
24421
|
);
|
|
24416
|
-
return
|
|
24422
|
+
return path106;
|
|
24417
24423
|
}
|
|
24418
24424
|
|
|
24419
24425
|
// src/commands/sessions/daemon/worktree/keptInTree.ts
|
|
@@ -24554,13 +24560,13 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
|
|
|
24554
24560
|
if (forcedSpill) daemonLog(forcedSpill);
|
|
24555
24561
|
else if (reusesClone(clone, boundTreeRoots2, reuse))
|
|
24556
24562
|
return { cwd: clone, kind: "primary", created: false, clone };
|
|
24557
|
-
const
|
|
24563
|
+
const path106 = createWorktree(
|
|
24558
24564
|
clone,
|
|
24559
24565
|
{ root: cfg.root, trunk: cfg.trunk },
|
|
24560
24566
|
boundTreeRoots2,
|
|
24561
24567
|
options2.replacesTree
|
|
24562
24568
|
);
|
|
24563
|
-
return { cwd:
|
|
24569
|
+
return { cwd: path106, kind: "worktree", created: true, clone };
|
|
24564
24570
|
}
|
|
24565
24571
|
|
|
24566
24572
|
// src/commands/sessions/daemon/describePersistedSession.ts
|
|
@@ -24910,13 +24916,13 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
24910
24916
|
const listing = gitSyncOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
24911
24917
|
if (!listing) return null;
|
|
24912
24918
|
const here = gitSyncOrNull(cwd, ["rev-parse", "--show-toplevel"]);
|
|
24913
|
-
let
|
|
24919
|
+
let path106 = null;
|
|
24914
24920
|
for (const line of listing.split("\n")) {
|
|
24915
24921
|
const trimmed = line.trim();
|
|
24916
24922
|
if (trimmed.startsWith("worktree "))
|
|
24917
|
-
|
|
24923
|
+
path106 = trimmed.slice("worktree ".length).trim();
|
|
24918
24924
|
else if (trimmed === `branch refs/heads/${branch2}`)
|
|
24919
|
-
return
|
|
24925
|
+
return path106 && path106 !== here ? path106 : null;
|
|
24920
24926
|
}
|
|
24921
24927
|
return null;
|
|
24922
24928
|
}
|
|
@@ -26020,9 +26026,9 @@ function parseRscRows(flight) {
|
|
|
26020
26026
|
}
|
|
26021
26027
|
function makeRscResolver(rows) {
|
|
26022
26028
|
return (ref) => {
|
|
26023
|
-
const [id, ...
|
|
26029
|
+
const [id, ...path106] = ref.slice(1).replace(/^[L@]/, "").split(":");
|
|
26024
26030
|
let v = rows[id];
|
|
26025
|
-
for (const key of
|
|
26031
|
+
for (const key of path106) {
|
|
26026
26032
|
if (v == null || typeof v !== "object") return void 0;
|
|
26027
26033
|
v = v[key];
|
|
26028
26034
|
}
|
|
@@ -26773,18 +26779,18 @@ function validateLine(line) {
|
|
|
26773
26779
|
process.exit(1);
|
|
26774
26780
|
}
|
|
26775
26781
|
}
|
|
26776
|
-
async function comment2(
|
|
26782
|
+
async function comment2(path106, line, body, options2 = {}) {
|
|
26777
26783
|
const { startLine, skipPreview } = options2;
|
|
26778
26784
|
validateBody(body);
|
|
26779
26785
|
validateLine(line);
|
|
26780
26786
|
if (startLine !== void 0) validateLine(startLine);
|
|
26781
26787
|
const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
|
|
26782
26788
|
if (!skipPreview)
|
|
26783
|
-
await reviewProposedPrComment(`Comment on ${
|
|
26789
|
+
await reviewProposedPrComment(`Comment on ${path106}:${range}`, body, null);
|
|
26784
26790
|
try {
|
|
26785
26791
|
const prId = getCurrentPrNodeId();
|
|
26786
|
-
postReviewComment({ prId, body, path:
|
|
26787
|
-
console.log(`Added review comment on ${
|
|
26792
|
+
postReviewComment({ prId, body, path: path106, line, startLine });
|
|
26793
|
+
console.log(`Added review comment on ${path106}:${range}`);
|
|
26788
26794
|
} catch (error) {
|
|
26789
26795
|
if (isGhNotInstalled(error)) {
|
|
26790
26796
|
console.error("Error: GitHub CLI (gh) is not installed.");
|
|
@@ -27353,9 +27359,9 @@ function registerPrsComments(prsCommand) {
|
|
|
27353
27359
|
});
|
|
27354
27360
|
prsCommand.command("comment <path> <line> <body>").description(
|
|
27355
27361
|
"Add a line comment to the pending review (body of - reads it from stdin)"
|
|
27356
|
-
).action(async (
|
|
27362
|
+
).action(async (path106, line, body) => {
|
|
27357
27363
|
await comment2(
|
|
27358
|
-
|
|
27364
|
+
path106,
|
|
27359
27365
|
Number.parseInt(line, 10),
|
|
27360
27366
|
await readBodyArgument(body)
|
|
27361
27367
|
);
|
|
@@ -28576,11 +28582,11 @@ async function loadBody(target) {
|
|
|
28576
28582
|
if (target.kind === "file") return readDraftFile(target.path);
|
|
28577
28583
|
return fetchPrBody(target.number, target.repo);
|
|
28578
28584
|
}
|
|
28579
|
-
function readDraftFile(
|
|
28585
|
+
function readDraftFile(path106) {
|
|
28580
28586
|
try {
|
|
28581
|
-
return readFileSync44(
|
|
28587
|
+
return readFileSync44(path106, "utf8");
|
|
28582
28588
|
} catch {
|
|
28583
|
-
console.error(`Error: Could not read \`${
|
|
28589
|
+
console.error(`Error: Could not read \`${path106}\`.`);
|
|
28584
28590
|
console.error(
|
|
28585
28591
|
"Pass a pull request number, a GitHub pull request URL, - for stdin, or a path to a file."
|
|
28586
28592
|
);
|
|
@@ -28860,10 +28866,10 @@ function resolveOpSecret(reference) {
|
|
|
28860
28866
|
}
|
|
28861
28867
|
|
|
28862
28868
|
// src/commands/ravendb/ravenFetch.ts
|
|
28863
|
-
async function ravenFetch(connection,
|
|
28869
|
+
async function ravenFetch(connection, path106) {
|
|
28864
28870
|
const apiKey = resolveOpSecret(connection.apiKeyRef);
|
|
28865
28871
|
let accessToken = await getAccessToken(apiKey);
|
|
28866
|
-
const url = `${connection.url}${
|
|
28872
|
+
const url = `${connection.url}${path106}`;
|
|
28867
28873
|
const headers = {
|
|
28868
28874
|
Authorization: `Bearer ${accessToken}`,
|
|
28869
28875
|
"Content-Type": "application/json"
|
|
@@ -28953,16 +28959,16 @@ import chalk195 from "chalk";
|
|
|
28953
28959
|
// src/commands/ravendb/buildQueryPath.ts
|
|
28954
28960
|
function buildQueryPath(opts) {
|
|
28955
28961
|
const db = encodeURIComponent(opts.db);
|
|
28956
|
-
let
|
|
28962
|
+
let path106;
|
|
28957
28963
|
if (opts.collection) {
|
|
28958
|
-
|
|
28964
|
+
path106 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
|
|
28959
28965
|
} else {
|
|
28960
|
-
|
|
28966
|
+
path106 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
|
|
28961
28967
|
}
|
|
28962
28968
|
if (opts.query) {
|
|
28963
|
-
|
|
28969
|
+
path106 += `&query=${encodeURIComponent(opts.query)}`;
|
|
28964
28970
|
}
|
|
28965
|
-
return
|
|
28971
|
+
return path106;
|
|
28966
28972
|
}
|
|
28967
28973
|
|
|
28968
28974
|
// src/commands/ravendb/fetchAllPages.ts
|
|
@@ -28971,7 +28977,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
28971
28977
|
let start3 = 0;
|
|
28972
28978
|
while (true) {
|
|
28973
28979
|
const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
|
|
28974
|
-
const
|
|
28980
|
+
const path106 = buildQueryPath({
|
|
28975
28981
|
db: connection.database,
|
|
28976
28982
|
collection: opts.collection,
|
|
28977
28983
|
start: start3,
|
|
@@ -28979,7 +28985,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
28979
28985
|
sort: opts.sort,
|
|
28980
28986
|
query: opts.query
|
|
28981
28987
|
});
|
|
28982
|
-
const data = await ravenFetch(connection,
|
|
28988
|
+
const data = await ravenFetch(connection, path106);
|
|
28983
28989
|
const results = data.Results ?? [];
|
|
28984
28990
|
const totalResults = data.TotalResults ?? 0;
|
|
28985
28991
|
if (results.length === 0) break;
|
|
@@ -31493,8 +31499,8 @@ Renamed ${oldName} \u2192 ${newName}`));
|
|
|
31493
31499
|
|
|
31494
31500
|
// src/commands/refactor/restructure.ts
|
|
31495
31501
|
import fs38 from "fs";
|
|
31496
|
-
import
|
|
31497
|
-
import
|
|
31502
|
+
import path80 from "path";
|
|
31503
|
+
import chalk221 from "chalk";
|
|
31498
31504
|
|
|
31499
31505
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
31500
31506
|
import chalk216 from "chalk";
|
|
@@ -31873,40 +31879,101 @@ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
|
|
|
31873
31879
|
}
|
|
31874
31880
|
|
|
31875
31881
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
31876
|
-
import
|
|
31882
|
+
import path74 from "path";
|
|
31883
|
+
import chalk219 from "chalk";
|
|
31884
|
+
|
|
31885
|
+
// src/commands/refactor/restructure/displayDeepChains.ts
|
|
31886
|
+
import chalk217 from "chalk";
|
|
31887
|
+
var shownChains = 10;
|
|
31888
|
+
var pinGuidance = [
|
|
31889
|
+
"To bring the plan within the limit, add modules to restructure.pin in assist.yml (basename without extension). A pinned module moves up beside the nearest root or pinned module above it, taking its subtree with it.",
|
|
31890
|
+
"- On each chain, pin the highest module that is a feature boundary: a route, view, page, panel, dialog or card a user would recognise as one thing.",
|
|
31891
|
+
"- Never pin hooks, utilities, style files or helpers just because they head a big subtree; they move up with their feature.",
|
|
31892
|
+
"- Add one pin at a time and re-run the dry-run: one feature pin often fixes several chains.",
|
|
31893
|
+
"- After each pin, check the resulting tree for a folder that has grown large with files shared between pinned features; if one has, pin the feature those files belong to or undo the last pin.",
|
|
31894
|
+
"- If no module on a chain is a sensible feature boundary, leave it and report the chain instead of forcing a pin."
|
|
31895
|
+
];
|
|
31896
|
+
function formatChain(chain2) {
|
|
31897
|
+
const folders = chain2.folders.map((f) => `${f.name} (${f.files})`).join(" > ");
|
|
31898
|
+
return ` ${folders} > \u2026 [${chain2.tooDeep} file(s) too deep, down to depth ${chain2.deepest}]`;
|
|
31899
|
+
}
|
|
31900
|
+
function displayDeepChains(chains, maxDepth) {
|
|
31901
|
+
if (chains.length === 0) return;
|
|
31902
|
+
const tooDeep = chains.reduce((sum3, c) => sum3 + c.tooDeep, 0);
|
|
31903
|
+
console.log(
|
|
31904
|
+
chalk217.red(
|
|
31905
|
+
`
|
|
31906
|
+
Plan exceeds restructure.maxDepth ${maxDepth}: ${tooDeep} file(s) deeper.`
|
|
31907
|
+
)
|
|
31908
|
+
);
|
|
31909
|
+
console.log(
|
|
31910
|
+
chalk217.bold(
|
|
31911
|
+
"Deep chains, as folder (files beneath), most files too deep first:"
|
|
31912
|
+
)
|
|
31913
|
+
);
|
|
31914
|
+
for (const chain2 of chains.slice(0, shownChains))
|
|
31915
|
+
console.log(formatChain(chain2));
|
|
31916
|
+
if (chains.length > shownChains)
|
|
31917
|
+
console.log(chalk217.dim(` \u2026and ${chains.length - shownChains} more`));
|
|
31918
|
+
console.log("");
|
|
31919
|
+
for (const line of pinGuidance) console.log(chalk217.yellow(line));
|
|
31920
|
+
}
|
|
31877
31921
|
|
|
31878
31922
|
// src/commands/refactor/restructure/displayDrift.ts
|
|
31879
31923
|
import path73 from "path";
|
|
31880
|
-
import
|
|
31924
|
+
import chalk218 from "chalk";
|
|
31881
31925
|
function displayDrift(plan2) {
|
|
31882
31926
|
const rel = (file) => path73.relative(process.cwd(), file);
|
|
31883
31927
|
if (plan2.moves.length > 0) {
|
|
31884
|
-
console.log(
|
|
31928
|
+
console.log(chalk218.red(`${plan2.moves.length} file(s) drift from the plan:`));
|
|
31885
31929
|
for (const move2 of plan2.moves)
|
|
31886
31930
|
console.log(` ${rel(move2.from)} \u2192 ${rel(move2.to)}`);
|
|
31887
31931
|
}
|
|
31888
|
-
for (const error of plan2.errors) console.log(
|
|
31932
|
+
for (const error of plan2.errors) console.log(chalk218.red(error));
|
|
31889
31933
|
}
|
|
31890
31934
|
|
|
31891
31935
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
31892
|
-
function
|
|
31936
|
+
function applyCommand(plan2) {
|
|
31937
|
+
const root2 = path74.relative(process.cwd(), plan2.scopeRoot) || ".";
|
|
31938
|
+
return `assist refactor restructure ${root2} --apply`;
|
|
31939
|
+
}
|
|
31940
|
+
function checkPlan(plan2, chains, maxDepth) {
|
|
31893
31941
|
displayDrift(plan2);
|
|
31894
|
-
|
|
31895
|
-
|
|
31942
|
+
displayDeepChains(chains, maxDepth);
|
|
31943
|
+
if (chains.length > 0) {
|
|
31944
|
+
console.log(
|
|
31945
|
+
chalk219.yellow(
|
|
31946
|
+
`
|
|
31947
|
+
Once the plan is within the limit, run \`${applyCommand(plan2)}\` to move the files and rewrite their imports.`
|
|
31948
|
+
)
|
|
31949
|
+
);
|
|
31950
|
+
process.exit(1);
|
|
31951
|
+
}
|
|
31952
|
+
if (plan2.errors.length > 0) process.exit(1);
|
|
31953
|
+
if (plan2.moves.length > 0) {
|
|
31954
|
+
console.log(
|
|
31955
|
+
chalk219.yellow(
|
|
31956
|
+
`
|
|
31957
|
+
Run \`${applyCommand(plan2)}\` to move the files and rewrite their imports.`
|
|
31958
|
+
)
|
|
31959
|
+
);
|
|
31960
|
+
process.exit(1);
|
|
31961
|
+
}
|
|
31962
|
+
console.log(chalk219.green("Layout matches the restructure plan"));
|
|
31896
31963
|
}
|
|
31897
31964
|
|
|
31898
31965
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
31899
|
-
import
|
|
31900
|
-
import
|
|
31966
|
+
import path77 from "path";
|
|
31967
|
+
import chalk220 from "chalk";
|
|
31901
31968
|
|
|
31902
31969
|
// src/commands/refactor/restructure/computeDepthStats.ts
|
|
31903
|
-
import
|
|
31970
|
+
import path75 from "path";
|
|
31904
31971
|
function computeDepthStats(targets, scopeRoot) {
|
|
31905
31972
|
const distribution = /* @__PURE__ */ new Map();
|
|
31906
31973
|
let max = 0;
|
|
31907
31974
|
for (const target of targets) {
|
|
31908
|
-
const dir =
|
|
31909
|
-
const depth = dir === "" ? 0 : dir.split(
|
|
31975
|
+
const dir = path75.relative(scopeRoot, path75.dirname(target));
|
|
31976
|
+
const depth = dir === "" ? 0 : dir.split(path75.sep).length;
|
|
31910
31977
|
distribution.set(depth, (distribution.get(depth) ?? 0) + 1);
|
|
31911
31978
|
max = Math.max(max, depth);
|
|
31912
31979
|
}
|
|
@@ -31914,7 +31981,7 @@ function computeDepthStats(targets, scopeRoot) {
|
|
|
31914
31981
|
}
|
|
31915
31982
|
|
|
31916
31983
|
// src/commands/refactor/restructure/formatTree.ts
|
|
31917
|
-
import
|
|
31984
|
+
import path76 from "path";
|
|
31918
31985
|
function insert(root2, parts) {
|
|
31919
31986
|
let node = root2;
|
|
31920
31987
|
for (const part of parts) {
|
|
@@ -31936,7 +32003,7 @@ function render(node, indent3, lines2) {
|
|
|
31936
32003
|
function formatTree(files, scopeRoot) {
|
|
31937
32004
|
const root2 = /* @__PURE__ */ new Map();
|
|
31938
32005
|
for (const file of files)
|
|
31939
|
-
insert(root2,
|
|
32006
|
+
insert(root2, path76.relative(scopeRoot, file).split(path76.sep));
|
|
31940
32007
|
const lines2 = [];
|
|
31941
32008
|
render(root2, "", lines2);
|
|
31942
32009
|
return lines2;
|
|
@@ -31944,21 +32011,21 @@ function formatTree(files, scopeRoot) {
|
|
|
31944
32011
|
|
|
31945
32012
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
31946
32013
|
function relPath2(filePath) {
|
|
31947
|
-
return
|
|
32014
|
+
return path77.relative(process.cwd(), filePath);
|
|
31948
32015
|
}
|
|
31949
32016
|
function displayMoves(plan2) {
|
|
31950
32017
|
if (plan2.moves.length === 0) return;
|
|
31951
|
-
console.log(
|
|
32018
|
+
console.log(chalk220.bold("\nFile moves:"));
|
|
31952
32019
|
for (const move2 of plan2.moves) {
|
|
31953
32020
|
console.log(
|
|
31954
|
-
` ${
|
|
32021
|
+
` ${chalk220.red(relPath2(move2.from))} \u2192 ${chalk220.green(relPath2(move2.to))}`
|
|
31955
32022
|
);
|
|
31956
|
-
console.log(
|
|
32023
|
+
console.log(chalk220.dim(` ${move2.reason}`));
|
|
31957
32024
|
}
|
|
31958
32025
|
}
|
|
31959
32026
|
function displayTree(plan2) {
|
|
31960
32027
|
console.log(
|
|
31961
|
-
|
|
32028
|
+
chalk220.bold(`
|
|
31962
32029
|
Resulting tree (${relPath2(plan2.scopeRoot) || "."}/):`)
|
|
31963
32030
|
);
|
|
31964
32031
|
for (const line of formatTree(plan2.targets.values(), plan2.scopeRoot))
|
|
@@ -31969,15 +32036,15 @@ function displayDepthStats(plan2) {
|
|
|
31969
32036
|
plan2.targets.values(),
|
|
31970
32037
|
plan2.scopeRoot
|
|
31971
32038
|
);
|
|
31972
|
-
console.log(
|
|
32039
|
+
console.log(chalk220.bold(`
|
|
31973
32040
|
Depth (max ${max}):`));
|
|
31974
32041
|
for (const depth of [...distribution.keys()].sort((a, b) => a - b))
|
|
31975
32042
|
console.log(` ${depth}: ${distribution.get(depth)} file(s)`);
|
|
31976
32043
|
}
|
|
31977
32044
|
function displayErrors(errors) {
|
|
31978
32045
|
if (errors.length === 0) return;
|
|
31979
|
-
console.log(
|
|
31980
|
-
for (const error of errors) console.log(
|
|
32046
|
+
console.log(chalk220.red("\nErrors:"));
|
|
32047
|
+
for (const error of errors) console.log(chalk220.red(` ${error}`));
|
|
31981
32048
|
}
|
|
31982
32049
|
function displayPlan2(plan2) {
|
|
31983
32050
|
displayMoves(plan2);
|
|
@@ -31986,19 +32053,57 @@ function displayPlan2(plan2) {
|
|
|
31986
32053
|
displayErrors(plan2.errors);
|
|
31987
32054
|
const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
|
|
31988
32055
|
console.log(
|
|
31989
|
-
|
|
32056
|
+
chalk220.dim(
|
|
31990
32057
|
`
|
|
31991
32058
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
|
|
31992
32059
|
)
|
|
31993
32060
|
);
|
|
31994
32061
|
}
|
|
31995
32062
|
|
|
32063
|
+
// src/commands/refactor/restructure/findDeepChains.ts
|
|
32064
|
+
import path78 from "path";
|
|
32065
|
+
function dirSegments(target, scopeRoot) {
|
|
32066
|
+
const dir = path78.relative(scopeRoot, path78.dirname(target));
|
|
32067
|
+
return dir === "" ? [] : dir.split(path78.sep);
|
|
32068
|
+
}
|
|
32069
|
+
function countSubtrees(segmentLists) {
|
|
32070
|
+
const counts2 = /* @__PURE__ */ new Map();
|
|
32071
|
+
for (const segments of segmentLists)
|
|
32072
|
+
for (let i = 1; i <= segments.length; i++) {
|
|
32073
|
+
const key = segments.slice(0, i).join("/");
|
|
32074
|
+
counts2.set(key, (counts2.get(key) ?? 0) + 1);
|
|
32075
|
+
}
|
|
32076
|
+
return counts2;
|
|
32077
|
+
}
|
|
32078
|
+
function findDeepChains(targets, scopeRoot, maxDepth) {
|
|
32079
|
+
const segmentLists = [...targets].map((t) => dirSegments(t, scopeRoot));
|
|
32080
|
+
const subtreeFiles = countSubtrees(segmentLists);
|
|
32081
|
+
const chains = /* @__PURE__ */ new Map();
|
|
32082
|
+
for (const segments of segmentLists) {
|
|
32083
|
+
if (segments.length <= maxDepth) continue;
|
|
32084
|
+
const head = segments.slice(0, maxDepth + 1);
|
|
32085
|
+
const key = head.join("/");
|
|
32086
|
+
const chain2 = chains.get(key) ?? {
|
|
32087
|
+
folders: head.map((name, i) => ({
|
|
32088
|
+
name,
|
|
32089
|
+
files: subtreeFiles.get(head.slice(0, i + 1).join("/")) ?? 0
|
|
32090
|
+
})),
|
|
32091
|
+
tooDeep: 0,
|
|
32092
|
+
deepest: 0
|
|
32093
|
+
};
|
|
32094
|
+
chain2.tooDeep += 1;
|
|
32095
|
+
chain2.deepest = Math.max(chain2.deepest, segments.length);
|
|
32096
|
+
chains.set(key, chain2);
|
|
32097
|
+
}
|
|
32098
|
+
return [...chains.entries()].sort(([ka, a], [kb, b]) => b.tooDeep - a.tooDeep || ka.localeCompare(kb)).map(([, chain2]) => chain2);
|
|
32099
|
+
}
|
|
32100
|
+
|
|
31996
32101
|
// src/commands/refactor/restructure/partitionIgnored.ts
|
|
31997
|
-
import
|
|
32102
|
+
import path79 from "path";
|
|
31998
32103
|
import { minimatch as minimatch4 } from "minimatch";
|
|
31999
32104
|
function partitionIgnored(files) {
|
|
32000
32105
|
const globs = loadConfig().restructure?.ignore ?? [];
|
|
32001
|
-
const isIgnored = (file) => globs.some((glob) => minimatch4(
|
|
32106
|
+
const isIgnored = (file) => globs.some((glob) => minimatch4(path79.relative(process.cwd(), file), glob));
|
|
32002
32107
|
return {
|
|
32003
32108
|
scoped: files.filter((f) => !isIgnored(f)),
|
|
32004
32109
|
ignored: files.filter(isIgnored)
|
|
@@ -32007,28 +32112,30 @@ function partitionIgnored(files) {
|
|
|
32007
32112
|
|
|
32008
32113
|
// src/commands/refactor/restructure.ts
|
|
32009
32114
|
async function restructure(root2, options2 = {}) {
|
|
32010
|
-
const scopeRoot =
|
|
32115
|
+
const scopeRoot = path80.resolve(root2 ?? "src");
|
|
32011
32116
|
if (!fs38.existsSync(scopeRoot) || !fs38.statSync(scopeRoot).isDirectory()) {
|
|
32012
|
-
console.log(
|
|
32117
|
+
console.log(chalk221.red(`Not a directory: ${root2 ?? "src"}`));
|
|
32013
32118
|
process.exit(1);
|
|
32014
32119
|
}
|
|
32015
32120
|
const found = [];
|
|
32016
32121
|
walkSourceFiles(scopeRoot, found);
|
|
32017
32122
|
const { scoped, ignored } = partitionIgnored(found);
|
|
32018
32123
|
if (scoped.length === 0) {
|
|
32019
|
-
console.log(
|
|
32124
|
+
console.log(chalk221.yellow("No files found under root"));
|
|
32020
32125
|
return;
|
|
32021
32126
|
}
|
|
32022
|
-
const
|
|
32023
|
-
const plan2 = buildPlan3(scopeRoot, scoped, ignored,
|
|
32024
|
-
|
|
32127
|
+
const { pin: pin2 = [], maxDepth = 10 } = loadConfig().restructure ?? {};
|
|
32128
|
+
const plan2 = buildPlan3(scopeRoot, scoped, ignored, pin2);
|
|
32129
|
+
const chains = findDeepChains(plan2.targets.values(), scopeRoot, maxDepth);
|
|
32130
|
+
if (options2.check) return checkPlan(plan2, chains, maxDepth);
|
|
32025
32131
|
displayPlan2(plan2);
|
|
32132
|
+
displayDeepChains(chains, maxDepth);
|
|
32026
32133
|
if (plan2.moves.length === 0 && plan2.errors.length === 0) {
|
|
32027
|
-
console.log(
|
|
32134
|
+
console.log(chalk221.green("No restructuring needed"));
|
|
32028
32135
|
return;
|
|
32029
32136
|
}
|
|
32030
32137
|
if (!options2.apply) {
|
|
32031
|
-
console.log(
|
|
32138
|
+
console.log(chalk221.dim("\nDry run. Use --apply to execute."));
|
|
32032
32139
|
return;
|
|
32033
32140
|
}
|
|
32034
32141
|
applyPlan(plan2);
|
|
@@ -32086,7 +32193,7 @@ async function checkoutOnlySession(number) {
|
|
|
32086
32193
|
}
|
|
32087
32194
|
|
|
32088
32195
|
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
32089
|
-
import
|
|
32196
|
+
import chalk225 from "chalk";
|
|
32090
32197
|
|
|
32091
32198
|
// src/commands/config/promptConfigScope.ts
|
|
32092
32199
|
import Enquirer3 from "enquirer";
|
|
@@ -32112,7 +32219,7 @@ async function promptConfigScope() {
|
|
|
32112
32219
|
}
|
|
32113
32220
|
|
|
32114
32221
|
// src/commands/config/resolveConfigKeyAnswer.ts
|
|
32115
|
-
import
|
|
32222
|
+
import chalk222 from "chalk";
|
|
32116
32223
|
async function resolveConfigKeyAnswer(question, supplied) {
|
|
32117
32224
|
if (supplied !== void 0) return coerceSupplied(question.key, supplied);
|
|
32118
32225
|
for (; ; ) {
|
|
@@ -32120,7 +32227,7 @@ async function resolveConfigKeyAnswer(question, supplied) {
|
|
|
32120
32227
|
if (answer === "") return void 0;
|
|
32121
32228
|
const coercion = coerceCliConfigValue(question.key, answer);
|
|
32122
32229
|
if (coercion.ok) return coercion.value;
|
|
32123
|
-
console.error(
|
|
32230
|
+
console.error(chalk222.red(coercion.error));
|
|
32124
32231
|
}
|
|
32125
32232
|
}
|
|
32126
32233
|
function coerceSupplied(key, supplied) {
|
|
@@ -32181,7 +32288,7 @@ function suggestGlobs(current, proposed) {
|
|
|
32181
32288
|
}
|
|
32182
32289
|
|
|
32183
32290
|
// src/commands/review/highLevel/parseConfigureAnswers.ts
|
|
32184
|
-
import
|
|
32291
|
+
import chalk223 from "chalk";
|
|
32185
32292
|
function parseConfigureAnswers(answers) {
|
|
32186
32293
|
const known = Object.values(highLevelConfigKeys);
|
|
32187
32294
|
const parsed = {};
|
|
@@ -32199,13 +32306,13 @@ function answersCoverEveryKey(answers) {
|
|
|
32199
32306
|
return Object.values(highLevelConfigKeys).every((key) => key in answers);
|
|
32200
32307
|
}
|
|
32201
32308
|
function exitWith(message3) {
|
|
32202
|
-
console.error(
|
|
32309
|
+
console.error(chalk223.red(`Error: ${message3}.`));
|
|
32203
32310
|
process.exit(1);
|
|
32204
32311
|
}
|
|
32205
32312
|
|
|
32206
32313
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
32207
32314
|
import { execFileSync as execFileSync20 } from "child_process";
|
|
32208
|
-
import
|
|
32315
|
+
import chalk224 from "chalk";
|
|
32209
32316
|
|
|
32210
32317
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
32211
32318
|
function buildGlobProposalPrompt(tree) {
|
|
@@ -32298,12 +32405,12 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
32298
32405
|
const tree = summariseRepoTree(cwd);
|
|
32299
32406
|
if (tree === "") return NOTHING_PROPOSED;
|
|
32300
32407
|
console.log(
|
|
32301
|
-
|
|
32408
|
+
chalk224.dim("Asking Claude to propose globs from the repo's own tree...")
|
|
32302
32409
|
);
|
|
32303
32410
|
const output = askClaude(buildGlobProposalPrompt(tree), cwd);
|
|
32304
32411
|
if (output === void 0) {
|
|
32305
32412
|
console.log(
|
|
32306
|
-
|
|
32413
|
+
chalk224.yellow(
|
|
32307
32414
|
"Claude proposed nothing; answer each key from its current value."
|
|
32308
32415
|
)
|
|
32309
32416
|
);
|
|
@@ -32359,25 +32466,25 @@ function asConfigKeyScope(value) {
|
|
|
32359
32466
|
function reportConfigured(result) {
|
|
32360
32467
|
for (const write of result.written)
|
|
32361
32468
|
console.log(
|
|
32362
|
-
|
|
32469
|
+
chalk225.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
|
|
32363
32470
|
);
|
|
32364
|
-
for (const key of result.skipped) console.log(
|
|
32365
|
-
console.log(
|
|
32471
|
+
for (const key of result.skipped) console.log(chalk225.dim(`Left ${key} unset`));
|
|
32472
|
+
console.log(chalk225.dim(`Written to ${result.target}`));
|
|
32366
32473
|
}
|
|
32367
32474
|
|
|
32368
32475
|
// src/commands/review/highLevel/announceSavedReview.ts
|
|
32369
|
-
import
|
|
32476
|
+
import chalk226 from "chalk";
|
|
32370
32477
|
function announceSavedReview(subject, force) {
|
|
32371
32478
|
const head = subject.headSha.slice(0, 7);
|
|
32372
32479
|
if (subject.saved)
|
|
32373
32480
|
console.log(
|
|
32374
|
-
|
|
32481
|
+
chalk226.dim(
|
|
32375
32482
|
`Reopening the review saved for ${head} at ${subject.saved.reviewedAt} (${subject.saved.verdict}); pass --force to start fresh.`
|
|
32376
32483
|
)
|
|
32377
32484
|
);
|
|
32378
32485
|
else if (force)
|
|
32379
32486
|
console.log(
|
|
32380
|
-
|
|
32487
|
+
chalk226.dim(
|
|
32381
32488
|
`Discarding any review saved for ${head} and starting fresh (--force).`
|
|
32382
32489
|
)
|
|
32383
32490
|
);
|
|
@@ -32406,8 +32513,8 @@ function groupFilesByDirectory(files) {
|
|
|
32406
32513
|
}
|
|
32407
32514
|
|
|
32408
32515
|
// src/commands/review/highLevel/buildHighLevelTree.ts
|
|
32409
|
-
function basename19(
|
|
32410
|
-
return
|
|
32516
|
+
function basename19(path106) {
|
|
32517
|
+
return path106.slice(path106.lastIndexOf("/") + 1);
|
|
32411
32518
|
}
|
|
32412
32519
|
function sum(nodes, key) {
|
|
32413
32520
|
return nodes.reduce((total, node) => total + node[key], 0);
|
|
@@ -32430,19 +32537,19 @@ function nodesOf(at2, prefix2) {
|
|
|
32430
32537
|
}
|
|
32431
32538
|
function collapsedDirNode(name, at2, prefix2) {
|
|
32432
32539
|
let label2 = name;
|
|
32433
|
-
let
|
|
32540
|
+
let path106 = prefix2 ? `${prefix2}/${name}` : name;
|
|
32434
32541
|
let node = at2;
|
|
32435
32542
|
while (node.files.length === 0 && node.dirs.size === 1) {
|
|
32436
32543
|
const [childName, child] = [...node.dirs][0];
|
|
32437
32544
|
label2 = `${label2}/${childName}`;
|
|
32438
|
-
|
|
32545
|
+
path106 = `${path106}/${childName}`;
|
|
32439
32546
|
node = child;
|
|
32440
32547
|
}
|
|
32441
|
-
const children = nodesOf(node,
|
|
32548
|
+
const children = nodesOf(node, path106);
|
|
32442
32549
|
return {
|
|
32443
32550
|
kind: "dir",
|
|
32444
32551
|
name: label2,
|
|
32445
|
-
path:
|
|
32552
|
+
path: path106,
|
|
32446
32553
|
additions: sum(children, "additions"),
|
|
32447
32554
|
deletions: sum(children, "deletions"),
|
|
32448
32555
|
children
|
|
@@ -32700,8 +32807,8 @@ function toStatus(status3) {
|
|
|
32700
32807
|
if (status3 === "removed") return "removed";
|
|
32701
32808
|
return "modified";
|
|
32702
32809
|
}
|
|
32703
|
-
function diffUrl(repo, prNumber,
|
|
32704
|
-
const anchor = createHash3("sha256").update(
|
|
32810
|
+
function diffUrl(repo, prNumber, path106) {
|
|
32811
|
+
const anchor = createHash3("sha256").update(path106).digest("hex");
|
|
32705
32812
|
return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
|
|
32706
32813
|
}
|
|
32707
32814
|
function fetchHighLevelFiles(prNumber, repo) {
|
|
@@ -32757,10 +32864,10 @@ function highLevelReviewPath(repo, headRef, headSha) {
|
|
|
32757
32864
|
|
|
32758
32865
|
// src/commands/review/highLevel/loadHighLevelReview.ts
|
|
32759
32866
|
function loadHighLevelReview(repo, headRef, headSha) {
|
|
32760
|
-
const
|
|
32761
|
-
if (!existsSync64(
|
|
32867
|
+
const path106 = highLevelReviewPath(repo, headRef, headSha);
|
|
32868
|
+
if (!existsSync64(path106)) return void 0;
|
|
32762
32869
|
try {
|
|
32763
|
-
return JSON.parse(readFileSync47(
|
|
32870
|
+
return JSON.parse(readFileSync47(path106, "utf8"));
|
|
32764
32871
|
} catch {
|
|
32765
32872
|
return void 0;
|
|
32766
32873
|
}
|
|
@@ -32771,8 +32878,8 @@ import { minimatch as minimatch7 } from "minimatch";
|
|
|
32771
32878
|
function selectCriticalDiffs(files, criticalPaths) {
|
|
32772
32879
|
if (criticalPaths.length === 0) return [];
|
|
32773
32880
|
return files.filter((file) => criticalPaths.some((glob) => minimatch7(file.path, glob))).map(
|
|
32774
|
-
({ path:
|
|
32775
|
-
path:
|
|
32881
|
+
({ path: path106, status: status3, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
|
|
32882
|
+
path: path106,
|
|
32776
32883
|
status: status3,
|
|
32777
32884
|
additions,
|
|
32778
32885
|
deletions,
|
|
@@ -32887,11 +32994,11 @@ function highLevelPreviewPayload(subject) {
|
|
|
32887
32994
|
import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync39 } from "fs";
|
|
32888
32995
|
import { dirname as dirname36 } from "path";
|
|
32889
32996
|
function saveHighLevelReview(record) {
|
|
32890
|
-
const
|
|
32891
|
-
mkdirSync22(dirname36(
|
|
32892
|
-
writeFileSync39(
|
|
32997
|
+
const path106 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
|
|
32998
|
+
mkdirSync22(dirname36(path106), { recursive: true });
|
|
32999
|
+
writeFileSync39(path106, `${JSON.stringify(record, null, 2)}
|
|
32893
33000
|
`);
|
|
32894
|
-
return
|
|
33001
|
+
return path106;
|
|
32895
33002
|
}
|
|
32896
33003
|
|
|
32897
33004
|
// src/commands/review/highLevel/openHighLevelOverlay.ts
|
|
@@ -32910,63 +33017,63 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
32910
33017
|
{ rejectIsOutcome: true }
|
|
32911
33018
|
);
|
|
32912
33019
|
const record = buildHighLevelRecord(subject, decision);
|
|
32913
|
-
const
|
|
33020
|
+
const path106 = saveHighLevelReview(record);
|
|
32914
33021
|
console.log(`Verdict: ${record.verdict}`);
|
|
32915
|
-
console.log(`Saved ${
|
|
33022
|
+
console.log(`Saved ${path106}`);
|
|
32916
33023
|
console.log("Nothing was posted to GitHub.");
|
|
32917
33024
|
return record;
|
|
32918
33025
|
}
|
|
32919
33026
|
|
|
32920
33027
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
32921
|
-
import
|
|
33028
|
+
import chalk230 from "chalk";
|
|
32922
33029
|
|
|
32923
33030
|
// src/commands/review/highLevel/formatCriticalDiffs.ts
|
|
32924
|
-
import
|
|
33031
|
+
import chalk227 from "chalk";
|
|
32925
33032
|
var PATCH_LINE_COLOURS = {
|
|
32926
|
-
"+":
|
|
32927
|
-
"-":
|
|
32928
|
-
"@":
|
|
33033
|
+
"+": chalk227.green,
|
|
33034
|
+
"-": chalk227.red,
|
|
33035
|
+
"@": chalk227.cyan
|
|
32929
33036
|
};
|
|
32930
33037
|
function formatPatch(patch2) {
|
|
32931
33038
|
return patch2.split("\n").map(
|
|
32932
|
-
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ??
|
|
33039
|
+
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk227.dim)(line)}`
|
|
32933
33040
|
);
|
|
32934
33041
|
}
|
|
32935
33042
|
function formatDiff(diff3) {
|
|
32936
33043
|
return [
|
|
32937
33044
|
"",
|
|
32938
|
-
` ${
|
|
32939
|
-
...diff3.patch === null ? [` ${
|
|
33045
|
+
` ${chalk227.bold(diff3.path)} ${chalk227.dim(`(${diff3.status})`)} ${chalk227.green(`+${diff3.additions}`)} ${chalk227.red(`-${diff3.deletions}`)}`,
|
|
33046
|
+
...diff3.patch === null ? [` ${chalk227.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
|
|
32940
33047
|
];
|
|
32941
33048
|
}
|
|
32942
33049
|
function formatCriticalDiffs(diffs, criticalPaths) {
|
|
32943
33050
|
if (criticalPaths.length === 0)
|
|
32944
|
-
return `${
|
|
32945
|
-
${
|
|
33051
|
+
return `${chalk227.bold.underline("Critical diffs")}
|
|
33052
|
+
${chalk227.dim("review.highLevel.criticalPaths is unset, so no diffs are shown")}`;
|
|
32946
33053
|
if (diffs.length === 0)
|
|
32947
|
-
return `${
|
|
32948
|
-
${
|
|
33054
|
+
return `${chalk227.bold.underline("Critical diffs")}
|
|
33055
|
+
${chalk227.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
|
|
32949
33056
|
return [
|
|
32950
|
-
|
|
33057
|
+
chalk227.bold.underline("Critical diffs"),
|
|
32951
33058
|
...diffs.flatMap(formatDiff)
|
|
32952
33059
|
].join("\n");
|
|
32953
33060
|
}
|
|
32954
33061
|
|
|
32955
33062
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
32956
|
-
import
|
|
33063
|
+
import chalk228 from "chalk";
|
|
32957
33064
|
var MARKERS = {
|
|
32958
|
-
pass: () =>
|
|
32959
|
-
fail: () =>
|
|
32960
|
-
manual: () =>
|
|
33065
|
+
pass: () => chalk228.green("\u2714"),
|
|
33066
|
+
fail: () => chalk228.red("\u2718"),
|
|
33067
|
+
manual: () => chalk228.yellow("\u25A1")
|
|
32961
33068
|
};
|
|
32962
33069
|
function formatCheck(check2) {
|
|
32963
|
-
const title = check2.status === "fail" ?
|
|
33070
|
+
const title = check2.status === "fail" ? chalk228.red(check2.title) : chalk228.bold(check2.title);
|
|
32964
33071
|
return ` ${MARKERS[check2.status]()} ${title}
|
|
32965
|
-
${
|
|
33072
|
+
${chalk228.dim(check2.reason)}`;
|
|
32966
33073
|
}
|
|
32967
33074
|
function formatGroup(heading2, checks2) {
|
|
32968
33075
|
if (checks2.length === 0) return [];
|
|
32969
|
-
return ["",
|
|
33076
|
+
return ["", chalk228.bold.underline(heading2), ...checks2.map(formatCheck)];
|
|
32970
33077
|
}
|
|
32971
33078
|
function formatHighLevelChecklist(checks2) {
|
|
32972
33079
|
const deterministic = checks2.filter(
|
|
@@ -32975,7 +33082,7 @@ function formatHighLevelChecklist(checks2) {
|
|
|
32975
33082
|
const failed3 = deterministic.filter(
|
|
32976
33083
|
(check2) => check2.status === "fail"
|
|
32977
33084
|
).length;
|
|
32978
|
-
const summary = failed3 === 0 ?
|
|
33085
|
+
const summary = failed3 === 0 ? chalk228.green(`All ${deterministic.length} deterministic checks pass`) : chalk228.red(
|
|
32979
33086
|
`${failed3} of ${deterministic.length} deterministic checks fail`
|
|
32980
33087
|
);
|
|
32981
33088
|
return [
|
|
@@ -32990,30 +33097,30 @@ function formatHighLevelChecklist(checks2) {
|
|
|
32990
33097
|
}
|
|
32991
33098
|
|
|
32992
33099
|
// src/commands/review/highLevel/formatHighLevelStructure.ts
|
|
32993
|
-
import
|
|
33100
|
+
import chalk229 from "chalk";
|
|
32994
33101
|
var STATUS_MARKERS = {
|
|
32995
|
-
added: () =>
|
|
32996
|
-
removed: () =>
|
|
32997
|
-
modified: () =>
|
|
33102
|
+
added: () => chalk229.green("A"),
|
|
33103
|
+
removed: () => chalk229.red("D"),
|
|
33104
|
+
modified: () => chalk229.yellow("M")
|
|
32998
33105
|
};
|
|
32999
33106
|
function counts(additions, deletions) {
|
|
33000
|
-
return `${
|
|
33107
|
+
return `${chalk229.green(`+${additions}`)} ${chalk229.red(`-${deletions}`)}`;
|
|
33001
33108
|
}
|
|
33002
33109
|
function formatNode(node, indent3) {
|
|
33003
33110
|
if (node.kind === "file")
|
|
33004
33111
|
return [
|
|
33005
|
-
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${
|
|
33112
|
+
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk229.dim(counts(node.additions, node.deletions))}`
|
|
33006
33113
|
];
|
|
33007
33114
|
const dir = node;
|
|
33008
33115
|
return [
|
|
33009
|
-
`${indent3}${
|
|
33116
|
+
`${indent3}${chalk229.bold(`${dir.name}/`)} ${chalk229.dim(counts(dir.additions, dir.deletions))}`,
|
|
33010
33117
|
...dir.children.flatMap((child) => formatNode(child, `${indent3} `))
|
|
33011
33118
|
];
|
|
33012
33119
|
}
|
|
33013
33120
|
function formatHighLevelStructure(structure) {
|
|
33014
33121
|
const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
|
|
33015
33122
|
return [
|
|
33016
|
-
|
|
33123
|
+
chalk229.bold.underline("Structure"),
|
|
33017
33124
|
` ${summary}`,
|
|
33018
33125
|
...structure.tree.flatMap((node) => formatNode(node, " "))
|
|
33019
33126
|
].join("\n");
|
|
@@ -33022,10 +33129,10 @@ function formatHighLevelStructure(structure) {
|
|
|
33022
33129
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
33023
33130
|
function printHighLevelChecklist(subject) {
|
|
33024
33131
|
console.log(
|
|
33025
|
-
|
|
33132
|
+
chalk230.bold(
|
|
33026
33133
|
`High-level review of ${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`
|
|
33027
33134
|
),
|
|
33028
|
-
|
|
33135
|
+
chalk230.dim(
|
|
33029
33136
|
`\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
|
|
33030
33137
|
)
|
|
33031
33138
|
);
|
|
@@ -33037,12 +33144,12 @@ function printHighLevelChecklist(subject) {
|
|
|
33037
33144
|
formatCriticalDiffs(subject.criticalDiffs, subject.criticalPaths)
|
|
33038
33145
|
);
|
|
33039
33146
|
console.log(
|
|
33040
|
-
|
|
33147
|
+
chalk230.dim(
|
|
33041
33148
|
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
33042
33149
|
)
|
|
33043
33150
|
);
|
|
33044
33151
|
console.log(
|
|
33045
|
-
|
|
33152
|
+
chalk230.dim(
|
|
33046
33153
|
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
33047
33154
|
)
|
|
33048
33155
|
);
|
|
@@ -33676,18 +33783,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
33676
33783
|
}
|
|
33677
33784
|
|
|
33678
33785
|
// src/commands/review/warnOutOfDiff.ts
|
|
33679
|
-
import
|
|
33786
|
+
import chalk231 from "chalk";
|
|
33680
33787
|
function warnOutOfDiff(outOfDiff) {
|
|
33681
33788
|
if (outOfDiff.length === 0) return;
|
|
33682
33789
|
console.warn(
|
|
33683
|
-
|
|
33790
|
+
chalk231.yellow(
|
|
33684
33791
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
33685
33792
|
)
|
|
33686
33793
|
);
|
|
33687
33794
|
for (const finding of outOfDiff) {
|
|
33688
33795
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
33689
33796
|
console.warn(
|
|
33690
|
-
` ${
|
|
33797
|
+
` ${chalk231.yellow("\xB7")} ${finding.title} ${chalk231.dim(
|
|
33691
33798
|
`(${finding.file}:${range})`
|
|
33692
33799
|
)}`
|
|
33693
33800
|
);
|
|
@@ -33711,18 +33818,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
33711
33818
|
}
|
|
33712
33819
|
|
|
33713
33820
|
// src/commands/review/warnUnlocated.ts
|
|
33714
|
-
import
|
|
33821
|
+
import chalk232 from "chalk";
|
|
33715
33822
|
function warnUnlocated(unlocated) {
|
|
33716
33823
|
if (unlocated.length === 0) return;
|
|
33717
33824
|
console.warn(
|
|
33718
|
-
|
|
33825
|
+
chalk232.yellow(
|
|
33719
33826
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
33720
33827
|
)
|
|
33721
33828
|
);
|
|
33722
33829
|
for (const finding of unlocated) {
|
|
33723
|
-
const where = finding.location ||
|
|
33830
|
+
const where = finding.location || chalk232.dim("missing");
|
|
33724
33831
|
console.warn(
|
|
33725
|
-
` ${
|
|
33832
|
+
` ${chalk232.yellow("\xB7")} ${finding.title} ${chalk232.dim(`(${where})`)}`
|
|
33726
33833
|
);
|
|
33727
33834
|
}
|
|
33728
33835
|
}
|
|
@@ -33927,8 +34034,8 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
33927
34034
|
// src/commands/review/prepareReviewDir.ts
|
|
33928
34035
|
import { existsSync as existsSync65, mkdirSync as mkdirSync23, unlinkSync as unlinkSync18, writeFileSync as writeFileSync40 } from "fs";
|
|
33929
34036
|
function clearReviewFiles(paths) {
|
|
33930
|
-
for (const
|
|
33931
|
-
if (existsSync65(
|
|
34037
|
+
for (const path106 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
34038
|
+
if (existsSync65(path106)) unlinkSync18(path106);
|
|
33932
34039
|
}
|
|
33933
34040
|
}
|
|
33934
34041
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -35166,8 +35273,8 @@ function registerReview(program2) {
|
|
|
35166
35273
|
|
|
35167
35274
|
// src/commands/rules/addRule.ts
|
|
35168
35275
|
import { existsSync as existsSync70, readFileSync as readFileSync53, writeFileSync as writeFileSync43 } from "fs";
|
|
35169
|
-
import
|
|
35170
|
-
import
|
|
35276
|
+
import path85 from "path";
|
|
35277
|
+
import chalk233 from "chalk";
|
|
35171
35278
|
|
|
35172
35279
|
// src/commands/rules/insertRuleBullet.ts
|
|
35173
35280
|
function ruleBullet({ code, title, text: text18 }) {
|
|
@@ -35194,7 +35301,7 @@ import { readFileSync as readFileSync50 } from "fs";
|
|
|
35194
35301
|
|
|
35195
35302
|
// src/commands/rules/findClaudeFiles.ts
|
|
35196
35303
|
import { readdirSync as readdirSync13 } from "fs";
|
|
35197
|
-
import
|
|
35304
|
+
import path81 from "path";
|
|
35198
35305
|
var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
|
|
35199
35306
|
function findClaudeFiles(dir) {
|
|
35200
35307
|
const results = [];
|
|
@@ -35202,9 +35309,9 @@ function findClaudeFiles(dir) {
|
|
|
35202
35309
|
if (entry.isDirectory()) {
|
|
35203
35310
|
if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
|
|
35204
35311
|
continue;
|
|
35205
|
-
results.push(...findClaudeFiles(
|
|
35312
|
+
results.push(...findClaudeFiles(path81.join(dir, entry.name)));
|
|
35206
35313
|
} else if (entry.name === "CLAUDE.md") {
|
|
35207
|
-
results.push(
|
|
35314
|
+
results.push(path81.join(dir, entry.name));
|
|
35208
35315
|
}
|
|
35209
35316
|
}
|
|
35210
35317
|
return results;
|
|
@@ -35223,34 +35330,34 @@ function nextRuleCode(root2) {
|
|
|
35223
35330
|
|
|
35224
35331
|
// src/commands/rules/resolveRuleScope.ts
|
|
35225
35332
|
import { existsSync as existsSync68 } from "fs";
|
|
35226
|
-
import
|
|
35333
|
+
import path82 from "path";
|
|
35227
35334
|
function resolveRuleScope(target) {
|
|
35228
|
-
const resolved =
|
|
35229
|
-
if (
|
|
35335
|
+
const resolved = path82.resolve(target);
|
|
35336
|
+
if (path82.basename(resolved) === "CLAUDE.md") return resolved;
|
|
35230
35337
|
const startDir = scopeDirectory(resolved);
|
|
35231
35338
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
35232
35339
|
let current = startDir;
|
|
35233
35340
|
while (true) {
|
|
35234
|
-
const candidate =
|
|
35341
|
+
const candidate = path82.join(current, "CLAUDE.md");
|
|
35235
35342
|
if (existsSync68(candidate)) return candidate;
|
|
35236
|
-
if (current === root2 || current ===
|
|
35237
|
-
current =
|
|
35343
|
+
if (current === root2 || current === path82.dirname(current)) break;
|
|
35344
|
+
current = path82.dirname(current);
|
|
35238
35345
|
}
|
|
35239
|
-
return
|
|
35346
|
+
return path82.join(root2, "CLAUDE.md");
|
|
35240
35347
|
}
|
|
35241
35348
|
|
|
35242
35349
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
35243
35350
|
import { existsSync as existsSync69, readFileSync as readFileSync52, writeFileSync as writeFileSync42 } from "fs";
|
|
35244
|
-
import
|
|
35351
|
+
import path84 from "path";
|
|
35245
35352
|
|
|
35246
35353
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
35247
35354
|
import { readFileSync as readFileSync51 } from "fs";
|
|
35248
|
-
import
|
|
35355
|
+
import path83 from "path";
|
|
35249
35356
|
function scopedRuleDirectories(root2) {
|
|
35250
35357
|
return findClaudeFiles(root2).filter(
|
|
35251
|
-
(file) =>
|
|
35358
|
+
(file) => path83.dirname(file) !== root2 && parseRulesSection(readFileSync51(file, "utf8")).length > 0
|
|
35252
35359
|
).map(
|
|
35253
|
-
(file) => `${
|
|
35360
|
+
(file) => `${path83.relative(root2, path83.dirname(file)).split(path83.sep).join("/")}/`
|
|
35254
35361
|
).sort();
|
|
35255
35362
|
}
|
|
35256
35363
|
|
|
@@ -35289,7 +35396,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
35289
35396
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
35290
35397
|
function updateScopedRulesIndex(root2) {
|
|
35291
35398
|
const directories = scopedRuleDirectories(root2);
|
|
35292
|
-
const rootFile =
|
|
35399
|
+
const rootFile = path84.join(root2, "CLAUDE.md");
|
|
35293
35400
|
const before = existsSync69(rootFile) ? readFileSync52(rootFile, "utf8") : "";
|
|
35294
35401
|
const after = upsertScopedRulesPointer(before, directories);
|
|
35295
35402
|
if (after !== before) writeFileSync42(rootFile, after);
|
|
@@ -35303,12 +35410,12 @@ function read2(file) {
|
|
|
35303
35410
|
function addRule(text18, options2) {
|
|
35304
35411
|
const rule = text18.trim();
|
|
35305
35412
|
if (rule === "") {
|
|
35306
|
-
console.error(
|
|
35413
|
+
console.error(chalk233.red("Rule text is required"));
|
|
35307
35414
|
process.exitCode = 1;
|
|
35308
35415
|
return;
|
|
35309
35416
|
}
|
|
35310
35417
|
const target = resolveRuleScope(options2.scope ?? process.cwd());
|
|
35311
|
-
const targetDir =
|
|
35418
|
+
const targetDir = path85.dirname(target);
|
|
35312
35419
|
const root2 = findRepoRoot(targetDir) ?? targetDir;
|
|
35313
35420
|
const code = nextRuleCode(root2);
|
|
35314
35421
|
writeFileSync43(
|
|
@@ -35321,38 +35428,38 @@ function addRule(text18, options2) {
|
|
|
35321
35428
|
);
|
|
35322
35429
|
updateScopedRulesIndex(root2);
|
|
35323
35430
|
console.log(
|
|
35324
|
-
`Added ${
|
|
35431
|
+
`Added ${chalk233.cyan(code)} to ${path85.relative(process.cwd(), target) || target}`
|
|
35325
35432
|
);
|
|
35326
35433
|
}
|
|
35327
35434
|
|
|
35328
35435
|
// src/commands/rules/indexRules.ts
|
|
35329
|
-
import
|
|
35330
|
-
import
|
|
35436
|
+
import path86 from "path";
|
|
35437
|
+
import chalk234 from "chalk";
|
|
35331
35438
|
function indexRules() {
|
|
35332
35439
|
const startDir = scopeDirectory(process.cwd());
|
|
35333
35440
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
35334
35441
|
const directories = updateScopedRulesIndex(root2);
|
|
35335
|
-
const rootFile =
|
|
35442
|
+
const rootFile = path86.relative(process.cwd(), path86.join(root2, "CLAUDE.md"));
|
|
35336
35443
|
if (directories.length === 0) {
|
|
35337
35444
|
console.log(
|
|
35338
|
-
|
|
35445
|
+
chalk234.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
35339
35446
|
);
|
|
35340
35447
|
return;
|
|
35341
35448
|
}
|
|
35342
35449
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
35343
35450
|
for (const directory of directories)
|
|
35344
|
-
console.log(` ${
|
|
35451
|
+
console.log(` ${chalk234.cyan(directory)}`);
|
|
35345
35452
|
}
|
|
35346
35453
|
|
|
35347
35454
|
// src/commands/rules/listRules.ts
|
|
35348
|
-
import
|
|
35349
|
-
import
|
|
35455
|
+
import path87 from "path";
|
|
35456
|
+
import chalk235 from "chalk";
|
|
35350
35457
|
function listRules(target, options2 = {}) {
|
|
35351
|
-
const resolved =
|
|
35458
|
+
const resolved = path87.resolve(target ?? process.cwd());
|
|
35352
35459
|
const rules3 = readScopedRules(resolved);
|
|
35353
35460
|
if (rules3.length === 0) {
|
|
35354
|
-
const label2 =
|
|
35355
|
-
console.log(
|
|
35461
|
+
const label2 = path87.relative(process.cwd(), resolved) || ".";
|
|
35462
|
+
console.log(chalk235.gray(`No rules in scope for ${label2}`));
|
|
35356
35463
|
return;
|
|
35357
35464
|
}
|
|
35358
35465
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -35362,14 +35469,14 @@ function listRules(target, options2 = {}) {
|
|
|
35362
35469
|
if (rule.source !== shown) {
|
|
35363
35470
|
shown = rule.source;
|
|
35364
35471
|
console.log(
|
|
35365
|
-
|
|
35472
|
+
chalk235.dim(base ? path87.relative(base, rule.source) : rule.source)
|
|
35366
35473
|
);
|
|
35367
35474
|
}
|
|
35368
35475
|
console.log(
|
|
35369
|
-
` ${
|
|
35476
|
+
` ${chalk235.cyan(rule.code.padEnd(width))} ${rule.title ?? rule.text}`
|
|
35370
35477
|
);
|
|
35371
35478
|
if (options2.full && rule.title)
|
|
35372
|
-
console.log(` ${" ".repeat(width)} ${
|
|
35479
|
+
console.log(` ${" ".repeat(width)} ${chalk235.dim(rule.text)}`);
|
|
35373
35480
|
}
|
|
35374
35481
|
}
|
|
35375
35482
|
|
|
@@ -35398,7 +35505,7 @@ function registerRules(program2) {
|
|
|
35398
35505
|
}
|
|
35399
35506
|
|
|
35400
35507
|
// src/commands/seq/seqAuth.ts
|
|
35401
|
-
import
|
|
35508
|
+
import chalk237 from "chalk";
|
|
35402
35509
|
|
|
35403
35510
|
// src/commands/seq/loadConnections.ts
|
|
35404
35511
|
function loadConnections2() {
|
|
@@ -35427,10 +35534,10 @@ function setDefaultConnection(name) {
|
|
|
35427
35534
|
}
|
|
35428
35535
|
|
|
35429
35536
|
// src/shared/assertUniqueName.ts
|
|
35430
|
-
import
|
|
35537
|
+
import chalk236 from "chalk";
|
|
35431
35538
|
function assertUniqueName(existingNames, name) {
|
|
35432
35539
|
if (existingNames.includes(name)) {
|
|
35433
|
-
console.error(
|
|
35540
|
+
console.error(chalk236.red(`Connection "${name}" already exists.`));
|
|
35434
35541
|
process.exit(1);
|
|
35435
35542
|
}
|
|
35436
35543
|
}
|
|
@@ -35448,18 +35555,18 @@ async function promptConnection2(existingNames) {
|
|
|
35448
35555
|
var seqAuth = createConnectionAuth({
|
|
35449
35556
|
load: loadConnections2,
|
|
35450
35557
|
save: saveConnections2,
|
|
35451
|
-
format: (c) => `${
|
|
35558
|
+
format: (c) => `${chalk237.bold(c.name)} ${c.url}`,
|
|
35452
35559
|
promptNew: promptConnection2,
|
|
35453
35560
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
35454
35561
|
});
|
|
35455
35562
|
|
|
35456
35563
|
// src/commands/seq/seqQuery.ts
|
|
35457
|
-
import
|
|
35564
|
+
import chalk241 from "chalk";
|
|
35458
35565
|
|
|
35459
35566
|
// src/commands/seq/fetchSeq.ts
|
|
35460
|
-
import
|
|
35461
|
-
async function fetchSeq(conn,
|
|
35462
|
-
const url = `${conn.url}${
|
|
35567
|
+
import chalk238 from "chalk";
|
|
35568
|
+
async function fetchSeq(conn, path106, params) {
|
|
35569
|
+
const url = `${conn.url}${path106}?${params}`;
|
|
35463
35570
|
const response = await fetch(url, {
|
|
35464
35571
|
headers: {
|
|
35465
35572
|
Accept: "application/json",
|
|
@@ -35468,7 +35575,7 @@ async function fetchSeq(conn, path104, params) {
|
|
|
35468
35575
|
});
|
|
35469
35576
|
if (!response.ok) {
|
|
35470
35577
|
const body = await response.text();
|
|
35471
|
-
console.error(
|
|
35578
|
+
console.error(chalk238.red(`Seq returned ${response.status}: ${body}`));
|
|
35472
35579
|
process.exit(1);
|
|
35473
35580
|
}
|
|
35474
35581
|
return response;
|
|
@@ -35527,23 +35634,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
35527
35634
|
}
|
|
35528
35635
|
|
|
35529
35636
|
// src/commands/seq/formatEvent.ts
|
|
35530
|
-
import
|
|
35637
|
+
import chalk239 from "chalk";
|
|
35531
35638
|
function levelColor(level) {
|
|
35532
35639
|
switch (level) {
|
|
35533
35640
|
case "Fatal":
|
|
35534
|
-
return
|
|
35641
|
+
return chalk239.bgRed.white;
|
|
35535
35642
|
case "Error":
|
|
35536
|
-
return
|
|
35643
|
+
return chalk239.red;
|
|
35537
35644
|
case "Warning":
|
|
35538
|
-
return
|
|
35645
|
+
return chalk239.yellow;
|
|
35539
35646
|
case "Information":
|
|
35540
|
-
return
|
|
35647
|
+
return chalk239.cyan;
|
|
35541
35648
|
case "Debug":
|
|
35542
|
-
return
|
|
35649
|
+
return chalk239.gray;
|
|
35543
35650
|
case "Verbose":
|
|
35544
|
-
return
|
|
35651
|
+
return chalk239.dim;
|
|
35545
35652
|
default:
|
|
35546
|
-
return
|
|
35653
|
+
return chalk239.white;
|
|
35547
35654
|
}
|
|
35548
35655
|
}
|
|
35549
35656
|
function levelAbbrev(level) {
|
|
@@ -35584,12 +35691,12 @@ function formatTimestamp(iso) {
|
|
|
35584
35691
|
function formatEvent(event) {
|
|
35585
35692
|
const color = levelColor(event.Level);
|
|
35586
35693
|
const abbrev = levelAbbrev(event.Level);
|
|
35587
|
-
const ts10 =
|
|
35694
|
+
const ts10 = chalk239.dim(formatTimestamp(event.Timestamp));
|
|
35588
35695
|
const msg = renderMessage(event);
|
|
35589
35696
|
const lines2 = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
|
|
35590
35697
|
if (event.Exception) {
|
|
35591
35698
|
for (const line of event.Exception.split("\n")) {
|
|
35592
|
-
lines2.push(
|
|
35699
|
+
lines2.push(chalk239.red(` ${line}`));
|
|
35593
35700
|
}
|
|
35594
35701
|
}
|
|
35595
35702
|
return lines2.join("\n");
|
|
@@ -35622,11 +35729,11 @@ function rejectTimestampFilter(filter) {
|
|
|
35622
35729
|
}
|
|
35623
35730
|
|
|
35624
35731
|
// src/shared/resolveNamedConnection.ts
|
|
35625
|
-
import
|
|
35732
|
+
import chalk240 from "chalk";
|
|
35626
35733
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
35627
35734
|
if (connections.length === 0) {
|
|
35628
35735
|
console.error(
|
|
35629
|
-
|
|
35736
|
+
chalk240.red(
|
|
35630
35737
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
35631
35738
|
)
|
|
35632
35739
|
);
|
|
@@ -35635,7 +35742,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
35635
35742
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
35636
35743
|
const connection = connections.find((c) => c.name === target);
|
|
35637
35744
|
if (!connection) {
|
|
35638
|
-
console.error(
|
|
35745
|
+
console.error(chalk240.red(`${kind} connection "${target}" not found.`));
|
|
35639
35746
|
process.exit(1);
|
|
35640
35747
|
}
|
|
35641
35748
|
return connection;
|
|
@@ -35664,7 +35771,7 @@ async function seqQuery(filter, options2) {
|
|
|
35664
35771
|
new URLSearchParams({ filter, count: String(count8) })
|
|
35665
35772
|
);
|
|
35666
35773
|
if (events.length === 0) {
|
|
35667
|
-
console.log(
|
|
35774
|
+
console.log(chalk241.yellow("No events found."));
|
|
35668
35775
|
return;
|
|
35669
35776
|
}
|
|
35670
35777
|
if (options2.json) {
|
|
@@ -35675,11 +35782,11 @@ async function seqQuery(filter, options2) {
|
|
|
35675
35782
|
for (const event of chronological) {
|
|
35676
35783
|
console.log(formatEvent(event));
|
|
35677
35784
|
}
|
|
35678
|
-
console.log(
|
|
35785
|
+
console.log(chalk241.dim(`
|
|
35679
35786
|
${events.length} events`));
|
|
35680
35787
|
if (events.length >= count8) {
|
|
35681
35788
|
console.log(
|
|
35682
|
-
|
|
35789
|
+
chalk241.yellow(
|
|
35683
35790
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
35684
35791
|
)
|
|
35685
35792
|
);
|
|
@@ -35687,10 +35794,10 @@ ${events.length} events`));
|
|
|
35687
35794
|
}
|
|
35688
35795
|
|
|
35689
35796
|
// src/shared/setNamedDefaultConnection.ts
|
|
35690
|
-
import
|
|
35797
|
+
import chalk242 from "chalk";
|
|
35691
35798
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
35692
35799
|
if (!connections.find((c) => c.name === name)) {
|
|
35693
|
-
console.error(
|
|
35800
|
+
console.error(chalk242.red(`Connection "${name}" not found.`));
|
|
35694
35801
|
process.exit(1);
|
|
35695
35802
|
}
|
|
35696
35803
|
setDefault(name);
|
|
@@ -35840,7 +35947,7 @@ async function previewSlackThreadParts({
|
|
|
35840
35947
|
`Approved for ${target}. The ${bodies.length} bodies to post, in thread order, are at:`
|
|
35841
35948
|
);
|
|
35842
35949
|
paths.forEach(
|
|
35843
|
-
(
|
|
35950
|
+
(path106, index3) => console.log(`${index3 + 1}/${paths.length} ${path106}`)
|
|
35844
35951
|
);
|
|
35845
35952
|
console.log(
|
|
35846
35953
|
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.`
|
|
@@ -35911,7 +36018,7 @@ function registerSlack(program2) {
|
|
|
35911
36018
|
}
|
|
35912
36019
|
|
|
35913
36020
|
// src/commands/sql/sqlAuth.ts
|
|
35914
|
-
import
|
|
36021
|
+
import chalk244 from "chalk";
|
|
35915
36022
|
|
|
35916
36023
|
// src/commands/sql/loadConnections.ts
|
|
35917
36024
|
function loadConnections3() {
|
|
@@ -35940,7 +36047,7 @@ function setDefaultConnection2(name) {
|
|
|
35940
36047
|
}
|
|
35941
36048
|
|
|
35942
36049
|
// src/commands/sql/promptConnection.ts
|
|
35943
|
-
import
|
|
36050
|
+
import chalk243 from "chalk";
|
|
35944
36051
|
async function promptConnection3(existingNames) {
|
|
35945
36052
|
const name = await promptInput("name", "Connection name:", "default");
|
|
35946
36053
|
assertUniqueName(existingNames, name);
|
|
@@ -35948,7 +36055,7 @@ async function promptConnection3(existingNames) {
|
|
|
35948
36055
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
35949
36056
|
const port = Number.parseInt(portStr, 10);
|
|
35950
36057
|
if (!Number.isFinite(port)) {
|
|
35951
|
-
console.error(
|
|
36058
|
+
console.error(chalk243.red(`Invalid port "${portStr}".`));
|
|
35952
36059
|
process.exit(1);
|
|
35953
36060
|
}
|
|
35954
36061
|
const user = await promptInput("user", "User:");
|
|
@@ -35961,13 +36068,13 @@ async function promptConnection3(existingNames) {
|
|
|
35961
36068
|
var sqlAuth = createConnectionAuth({
|
|
35962
36069
|
load: loadConnections3,
|
|
35963
36070
|
save: saveConnections3,
|
|
35964
|
-
format: (c) => `${
|
|
36071
|
+
format: (c) => `${chalk244.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
35965
36072
|
promptNew: promptConnection3,
|
|
35966
36073
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
35967
36074
|
});
|
|
35968
36075
|
|
|
35969
36076
|
// src/commands/sql/printTable.ts
|
|
35970
|
-
import
|
|
36077
|
+
import chalk245 from "chalk";
|
|
35971
36078
|
function formatCell(value) {
|
|
35972
36079
|
if (value === null || value === void 0) return "";
|
|
35973
36080
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -35976,7 +36083,7 @@ function formatCell(value) {
|
|
|
35976
36083
|
}
|
|
35977
36084
|
function printTable(rows) {
|
|
35978
36085
|
if (rows.length === 0) {
|
|
35979
|
-
console.log(
|
|
36086
|
+
console.log(chalk245.yellow("(no rows)"));
|
|
35980
36087
|
return;
|
|
35981
36088
|
}
|
|
35982
36089
|
const columns = Object.keys(rows[0]);
|
|
@@ -35984,13 +36091,13 @@ function printTable(rows) {
|
|
|
35984
36091
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
35985
36092
|
);
|
|
35986
36093
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
35987
|
-
console.log(
|
|
35988
|
-
console.log(
|
|
36094
|
+
console.log(chalk245.dim(header));
|
|
36095
|
+
console.log(chalk245.dim("-".repeat(header.length)));
|
|
35989
36096
|
for (const row of rows) {
|
|
35990
36097
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
35991
36098
|
console.log(line);
|
|
35992
36099
|
}
|
|
35993
|
-
console.log(
|
|
36100
|
+
console.log(chalk245.dim(`
|
|
35994
36101
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
35995
36102
|
}
|
|
35996
36103
|
|
|
@@ -36050,7 +36157,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
36050
36157
|
}
|
|
36051
36158
|
|
|
36052
36159
|
// src/commands/sql/sqlMutate.ts
|
|
36053
|
-
import
|
|
36160
|
+
import chalk246 from "chalk";
|
|
36054
36161
|
|
|
36055
36162
|
// src/commands/sql/isMutation.ts
|
|
36056
36163
|
var MUTATION_KEYWORDS = [
|
|
@@ -36084,7 +36191,7 @@ function isMutation(sql29) {
|
|
|
36084
36191
|
async function sqlMutate(query, connectionName) {
|
|
36085
36192
|
if (!isMutation(query)) {
|
|
36086
36193
|
console.error(
|
|
36087
|
-
|
|
36194
|
+
chalk246.red(
|
|
36088
36195
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
36089
36196
|
)
|
|
36090
36197
|
);
|
|
@@ -36094,18 +36201,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
36094
36201
|
const pool = await sqlConnect(conn);
|
|
36095
36202
|
try {
|
|
36096
36203
|
const result = await pool.request().query(query);
|
|
36097
|
-
console.log(
|
|
36204
|
+
console.log(chalk246.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
36098
36205
|
} finally {
|
|
36099
36206
|
await pool.close();
|
|
36100
36207
|
}
|
|
36101
36208
|
}
|
|
36102
36209
|
|
|
36103
36210
|
// src/commands/sql/sqlQuery.ts
|
|
36104
|
-
import
|
|
36211
|
+
import chalk247 from "chalk";
|
|
36105
36212
|
async function sqlQuery(query, connectionName) {
|
|
36106
36213
|
if (isMutation(query)) {
|
|
36107
36214
|
console.error(
|
|
36108
|
-
|
|
36215
|
+
chalk247.red(
|
|
36109
36216
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
36110
36217
|
)
|
|
36111
36218
|
);
|
|
@@ -36120,7 +36227,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
36120
36227
|
printTable(rows);
|
|
36121
36228
|
} else {
|
|
36122
36229
|
console.log(
|
|
36123
|
-
|
|
36230
|
+
chalk247.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
36124
36231
|
);
|
|
36125
36232
|
}
|
|
36126
36233
|
} finally {
|
|
@@ -36182,15 +36289,15 @@ function registerSql(program2) {
|
|
|
36182
36289
|
|
|
36183
36290
|
// src/commands/sync.ts
|
|
36184
36291
|
import * as os5 from "os";
|
|
36185
|
-
import * as
|
|
36292
|
+
import * as path99 from "path";
|
|
36186
36293
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
36187
36294
|
|
|
36188
36295
|
// src/commands/sync/pruneCommands.ts
|
|
36189
|
-
import * as
|
|
36296
|
+
import * as path89 from "path";
|
|
36190
36297
|
|
|
36191
36298
|
// src/commands/sync/pruneTarget.ts
|
|
36192
36299
|
import * as fs39 from "fs";
|
|
36193
|
-
import * as
|
|
36300
|
+
import * as path88 from "path";
|
|
36194
36301
|
function pruneTarget(targetDir, keepNames, shape, options2) {
|
|
36195
36302
|
const result = {
|
|
36196
36303
|
orphans: [],
|
|
@@ -36208,7 +36315,7 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
|
|
|
36208
36315
|
}
|
|
36209
36316
|
if (keep.has(name)) continue;
|
|
36210
36317
|
result.orphans.push(entry.name);
|
|
36211
|
-
const entryPath =
|
|
36318
|
+
const entryPath = path88.join(targetDir, entry.name);
|
|
36212
36319
|
const reason4 = shape.blockedBy?.(entryPath);
|
|
36213
36320
|
if (reason4) {
|
|
36214
36321
|
result.skipped.push({ name: entry.name, reason: reason4 });
|
|
@@ -36228,7 +36335,7 @@ function pruneCommands(targetDir, commandNames, options2) {
|
|
|
36228
36335
|
targetDir,
|
|
36229
36336
|
commandNames,
|
|
36230
36337
|
{
|
|
36231
|
-
nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ?
|
|
36338
|
+
nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path89.basename(entry.name, ".md") : void 0
|
|
36232
36339
|
},
|
|
36233
36340
|
options2
|
|
36234
36341
|
);
|
|
@@ -36263,16 +36370,16 @@ function reportPrune(label2, result, force) {
|
|
|
36263
36370
|
|
|
36264
36371
|
// src/commands/sync/syncClaudeCommands.ts
|
|
36265
36372
|
import * as fs43 from "fs";
|
|
36266
|
-
import * as
|
|
36373
|
+
import * as path93 from "path";
|
|
36267
36374
|
|
|
36268
36375
|
// src/commands/sync/syncCodex.ts
|
|
36269
|
-
import * as
|
|
36376
|
+
import * as path92 from "path";
|
|
36270
36377
|
|
|
36271
36378
|
// src/commands/sync/installHarnessCommands.ts
|
|
36272
36379
|
import * as fs40 from "fs";
|
|
36273
|
-
import * as
|
|
36380
|
+
import * as path90 from "path";
|
|
36274
36381
|
function installHarnessCommands(claudeDir, harness, transform) {
|
|
36275
|
-
const commandsSource =
|
|
36382
|
+
const commandsSource = path90.join(claudeDir, "commands");
|
|
36276
36383
|
const files = fs40.readdirSync(commandsSource);
|
|
36277
36384
|
const names = [];
|
|
36278
36385
|
let synced = 0;
|
|
@@ -36280,9 +36387,9 @@ function installHarnessCommands(claudeDir, harness, transform) {
|
|
|
36280
36387
|
if (!file.endsWith(".md")) continue;
|
|
36281
36388
|
const name = file.replace(/\.md$/, "");
|
|
36282
36389
|
names.push(name);
|
|
36283
|
-
const content = fs40.readFileSync(
|
|
36284
|
-
const target =
|
|
36285
|
-
fs40.mkdirSync(
|
|
36390
|
+
const content = fs40.readFileSync(path90.join(commandsSource, file), "utf8");
|
|
36391
|
+
const target = path90.join(harness.homeDir, harness.sync.commandDest(name));
|
|
36392
|
+
fs40.mkdirSync(path90.dirname(target), { recursive: true });
|
|
36286
36393
|
fs40.writeFileSync(target, transform(name, content));
|
|
36287
36394
|
synced++;
|
|
36288
36395
|
}
|
|
@@ -36311,7 +36418,7 @@ function unexpectedContent(skillDir) {
|
|
|
36311
36418
|
|
|
36312
36419
|
// src/commands/sync/syncCodexHooks.ts
|
|
36313
36420
|
import * as fs42 from "fs";
|
|
36314
|
-
import * as
|
|
36421
|
+
import * as path91 from "path";
|
|
36315
36422
|
var BEGIN = "# >>> assist codex hooks (managed) \u2014 do not edit >>>";
|
|
36316
36423
|
var END = "# <<< assist codex hooks (managed) <<<";
|
|
36317
36424
|
function upsertManagedBlock(existing, body) {
|
|
@@ -36342,9 +36449,9 @@ ${rest}
|
|
|
36342
36449
|
}
|
|
36343
36450
|
function syncCodexHooks(sourcePath) {
|
|
36344
36451
|
const body = fs42.readFileSync(sourcePath, "utf8");
|
|
36345
|
-
const configPath =
|
|
36452
|
+
const configPath = path91.join(harnesses.codex.homeDir, "config.toml");
|
|
36346
36453
|
const existing = fs42.existsSync(configPath) ? fs42.readFileSync(configPath, "utf8") : "";
|
|
36347
|
-
fs42.mkdirSync(
|
|
36454
|
+
fs42.mkdirSync(path91.dirname(configPath), { recursive: true });
|
|
36348
36455
|
fs42.writeFileSync(configPath, upsertManagedBlock(existing, body));
|
|
36349
36456
|
console.log(
|
|
36350
36457
|
"Registered assist codex-hook in ~/.codex/config.toml (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
|
|
@@ -36376,13 +36483,13 @@ function syncCodex(claudeDir, options2) {
|
|
|
36376
36483
|
harnesses.codex,
|
|
36377
36484
|
commandToSkill
|
|
36378
36485
|
);
|
|
36379
|
-
syncCodexHooks(
|
|
36486
|
+
syncCodexHooks(path92.join(claudeDir, "..", "codex", "config.toml"));
|
|
36380
36487
|
console.log(`Synced ${total} skill(s) to ~/.codex/skills`);
|
|
36381
36488
|
if (!options2?.prune) return;
|
|
36382
36489
|
const force = options2.force ?? false;
|
|
36383
36490
|
reportPrune(
|
|
36384
36491
|
"~/.codex/skills",
|
|
36385
|
-
pruneSkills(
|
|
36492
|
+
pruneSkills(path92.join(harnesses.codex.homeDir, "skills"), names, { force }),
|
|
36386
36493
|
force
|
|
36387
36494
|
);
|
|
36388
36495
|
}
|
|
@@ -36397,30 +36504,30 @@ function replaceFileWithoutFollowingSymlink(file, content) {
|
|
|
36397
36504
|
fs43.writeFileSync(file, content);
|
|
36398
36505
|
}
|
|
36399
36506
|
function writeSkill(targetBase, name, content) {
|
|
36400
|
-
const skillDir =
|
|
36507
|
+
const skillDir = path93.join(targetBase, "skills", name);
|
|
36401
36508
|
fs43.mkdirSync(skillDir, { recursive: true });
|
|
36402
36509
|
replaceFileWithoutFollowingSymlink(
|
|
36403
|
-
|
|
36510
|
+
path93.join(skillDir, "SKILL.md"),
|
|
36404
36511
|
commandToSkill(name, content)
|
|
36405
36512
|
);
|
|
36406
|
-
fs43.rmSync(
|
|
36513
|
+
fs43.rmSync(path93.join(targetBase, "commands", `${name}.md`), { force: true });
|
|
36407
36514
|
console.log(`Wrote ${name} as a skill to ${skillDir}`);
|
|
36408
36515
|
}
|
|
36409
36516
|
function syncClaudeCommands(claudeDir, targetBase) {
|
|
36410
|
-
const sourceDir =
|
|
36411
|
-
const targetDir =
|
|
36517
|
+
const sourceDir = path93.join(claudeDir, "commands");
|
|
36518
|
+
const targetDir = path93.join(targetBase, "commands");
|
|
36412
36519
|
fs43.mkdirSync(targetDir, { recursive: true });
|
|
36413
36520
|
const files = fs43.readdirSync(sourceDir);
|
|
36414
36521
|
for (const file of files) {
|
|
36415
|
-
const source =
|
|
36522
|
+
const source = path93.join(sourceDir, file);
|
|
36416
36523
|
if (file.endsWith(".md")) {
|
|
36417
36524
|
const content = fs43.readFileSync(source, "utf8");
|
|
36418
36525
|
if (isSkillFlagged(content)) {
|
|
36419
|
-
writeSkill(targetBase,
|
|
36526
|
+
writeSkill(targetBase, path93.basename(file, ".md"), content);
|
|
36420
36527
|
continue;
|
|
36421
36528
|
}
|
|
36422
36529
|
}
|
|
36423
|
-
fs43.copyFileSync(source,
|
|
36530
|
+
fs43.copyFileSync(source, path93.join(targetDir, file));
|
|
36424
36531
|
console.log(`Copied ${file} to ${targetDir}`);
|
|
36425
36532
|
}
|
|
36426
36533
|
console.log(`Synced ${files.length} command(s) to ~/.claude`);
|
|
@@ -36429,11 +36536,11 @@ function syncClaudeCommands(claudeDir, targetBase) {
|
|
|
36429
36536
|
|
|
36430
36537
|
// src/commands/sync/reportRetiredAgentsFiles.ts
|
|
36431
36538
|
import * as fs44 from "fs";
|
|
36432
|
-
import * as
|
|
36539
|
+
import * as path94 from "path";
|
|
36433
36540
|
var retired = [
|
|
36434
|
-
|
|
36435
|
-
|
|
36436
|
-
|
|
36541
|
+
path94.join(harnesses.claude.homeDir, "CLAUDE.md"),
|
|
36542
|
+
path94.join(harnesses.codex.homeDir, "AGENTS.md"),
|
|
36543
|
+
path94.join(harnesses.pi.homeDir, "AGENTS.md")
|
|
36437
36544
|
];
|
|
36438
36545
|
function reportRetiredAgentsFiles() {
|
|
36439
36546
|
const leftovers = retired.filter((file) => fs44.existsSync(file));
|
|
@@ -36449,35 +36556,35 @@ function reportRetiredAgentsFiles() {
|
|
|
36449
36556
|
|
|
36450
36557
|
// src/commands/sync/syncDesign.ts
|
|
36451
36558
|
import * as fs45 from "fs";
|
|
36452
|
-
import * as
|
|
36559
|
+
import * as path95 from "path";
|
|
36453
36560
|
function syncDesign(claudeDir, targetBase) {
|
|
36454
|
-
const systemPromptSource =
|
|
36455
|
-
const systemPromptTarget =
|
|
36561
|
+
const systemPromptSource = path95.join(claudeDir, "design-system-prompt.md");
|
|
36562
|
+
const systemPromptTarget = path95.join(targetBase, "design-system-prompt.md");
|
|
36456
36563
|
fs45.copyFileSync(systemPromptSource, systemPromptTarget);
|
|
36457
36564
|
console.log(
|
|
36458
36565
|
"Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
|
|
36459
36566
|
);
|
|
36460
|
-
const skillsSource =
|
|
36461
|
-
const skillsTarget =
|
|
36567
|
+
const skillsSource = path95.join(claudeDir, "skills");
|
|
36568
|
+
const skillsTarget = path95.join(targetBase, "skills");
|
|
36462
36569
|
fs45.mkdirSync(skillsTarget, { recursive: true });
|
|
36463
36570
|
const files = fs45.readdirSync(skillsSource);
|
|
36464
36571
|
for (const file of files) {
|
|
36465
36572
|
fs45.copyFileSync(
|
|
36466
|
-
|
|
36467
|
-
|
|
36573
|
+
path95.join(skillsSource, file),
|
|
36574
|
+
path95.join(skillsTarget, file)
|
|
36468
36575
|
);
|
|
36469
36576
|
}
|
|
36470
36577
|
console.log(`Synced ${files.length} design skill(s) to ~/.claude/skills`);
|
|
36471
36578
|
}
|
|
36472
36579
|
|
|
36473
36580
|
// src/commands/sync/syncPi.ts
|
|
36474
|
-
import * as
|
|
36581
|
+
import * as path97 from "path";
|
|
36475
36582
|
|
|
36476
36583
|
// src/commands/sync/syncPiHooks.ts
|
|
36477
36584
|
import * as fs46 from "fs";
|
|
36478
|
-
import * as
|
|
36585
|
+
import * as path96 from "path";
|
|
36479
36586
|
function piExtensionsDir() {
|
|
36480
|
-
return
|
|
36587
|
+
return path96.join(harnesses.pi.homeDir, "extensions");
|
|
36481
36588
|
}
|
|
36482
36589
|
function syncPiHooks(sourceDir) {
|
|
36483
36590
|
const target = piExtensionsDir();
|
|
@@ -36485,8 +36592,8 @@ function syncPiHooks(sourceDir) {
|
|
|
36485
36592
|
const files = fs46.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
|
|
36486
36593
|
for (const file of files) {
|
|
36487
36594
|
fs46.copyFileSync(
|
|
36488
|
-
|
|
36489
|
-
|
|
36595
|
+
path96.join(sourceDir, file),
|
|
36596
|
+
path96.join(target, `assist-${file}`)
|
|
36490
36597
|
);
|
|
36491
36598
|
}
|
|
36492
36599
|
console.log(
|
|
@@ -36523,24 +36630,24 @@ function syncPi(claudeDir, options2) {
|
|
|
36523
36630
|
harnesses.pi,
|
|
36524
36631
|
commandToPrompt
|
|
36525
36632
|
);
|
|
36526
|
-
syncPiHooks(
|
|
36633
|
+
syncPiHooks(path97.join(claudeDir, "..", "pi"));
|
|
36527
36634
|
console.log(`Synced ${synced} prompt(s) to ~/.pi/agent/prompts`);
|
|
36528
36635
|
if (!options2?.prune) return;
|
|
36529
36636
|
const force = options2.force ?? false;
|
|
36530
36637
|
reportPrune(
|
|
36531
36638
|
"~/.pi/agent/prompts",
|
|
36532
|
-
pruneCommands(
|
|
36639
|
+
pruneCommands(path97.join(harnesses.pi.homeDir, "prompts"), names, { force }),
|
|
36533
36640
|
force
|
|
36534
36641
|
);
|
|
36535
36642
|
}
|
|
36536
36643
|
|
|
36537
36644
|
// src/commands/sync/syncSettings.ts
|
|
36538
36645
|
import * as fs47 from "fs";
|
|
36539
|
-
import * as
|
|
36540
|
-
import
|
|
36646
|
+
import * as path98 from "path";
|
|
36647
|
+
import chalk248 from "chalk";
|
|
36541
36648
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
36542
|
-
const source =
|
|
36543
|
-
const target =
|
|
36649
|
+
const source = path98.join(claudeDir, "settings.json");
|
|
36650
|
+
const target = path98.join(targetBase, "settings.json");
|
|
36544
36651
|
const sourceContent = fs47.readFileSync(source, "utf8");
|
|
36545
36652
|
const sourceSettings = JSON.parse(sourceContent);
|
|
36546
36653
|
const targetExists = fs47.existsSync(target);
|
|
@@ -36556,7 +36663,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
36556
36663
|
if (mergedContent !== normalizedTarget) {
|
|
36557
36664
|
if (!options2?.yes) {
|
|
36558
36665
|
console.log(
|
|
36559
|
-
|
|
36666
|
+
chalk248.yellow(
|
|
36560
36667
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
36561
36668
|
)
|
|
36562
36669
|
);
|
|
@@ -36564,7 +36671,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
36564
36671
|
printDiff(targetContent, mergedContent);
|
|
36565
36672
|
printAutoConfirmHint();
|
|
36566
36673
|
const confirm = await promptConfirm(
|
|
36567
|
-
|
|
36674
|
+
chalk248.red("Overwrite existing settings.json?"),
|
|
36568
36675
|
false
|
|
36569
36676
|
);
|
|
36570
36677
|
if (!confirm) {
|
|
@@ -36580,13 +36687,13 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
36580
36687
|
|
|
36581
36688
|
// src/commands/sync.ts
|
|
36582
36689
|
var __filename4 = fileURLToPath8(import.meta.url);
|
|
36583
|
-
var __dirname5 =
|
|
36690
|
+
var __dirname5 = path99.dirname(__filename4);
|
|
36584
36691
|
async function sync(options2) {
|
|
36585
36692
|
const config = loadConfig();
|
|
36586
36693
|
const yes = options2?.yes ?? config.sync.autoConfirm;
|
|
36587
36694
|
const prune = { prune: options2?.prune, force: options2?.force };
|
|
36588
|
-
const claudeDir =
|
|
36589
|
-
const targetBase =
|
|
36695
|
+
const claudeDir = path99.join(__dirname5, "..", "claude");
|
|
36696
|
+
const targetBase = path99.join(os5.homedir(), ".claude");
|
|
36590
36697
|
const commandFiles = syncClaudeCommands(claudeDir, targetBase);
|
|
36591
36698
|
syncDesign(claudeDir, targetBase);
|
|
36592
36699
|
await syncSettings(claudeDir, targetBase, { yes });
|
|
@@ -36594,11 +36701,11 @@ async function sync(options2) {
|
|
|
36594
36701
|
syncPi(claudeDir, prune);
|
|
36595
36702
|
reportRetiredAgentsFiles();
|
|
36596
36703
|
if (!options2?.prune) return;
|
|
36597
|
-
const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) =>
|
|
36704
|
+
const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path99.basename(file, ".md"));
|
|
36598
36705
|
const force = options2.force ?? false;
|
|
36599
36706
|
reportPrune(
|
|
36600
36707
|
"~/.claude/commands",
|
|
36601
|
-
pruneCommands(
|
|
36708
|
+
pruneCommands(path99.join(targetBase, "commands"), commandNames, { force }),
|
|
36602
36709
|
force
|
|
36603
36710
|
);
|
|
36604
36711
|
}
|
|
@@ -37654,9 +37761,9 @@ import { existsSync as existsSync79, readFileSync as readFileSync60 } from "fs";
|
|
|
37654
37761
|
|
|
37655
37762
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
37656
37763
|
import { minimatch as minimatch9 } from "minimatch";
|
|
37657
|
-
function resolveStringsAtPath(data,
|
|
37764
|
+
function resolveStringsAtPath(data, path106) {
|
|
37658
37765
|
let current = data;
|
|
37659
|
-
for (const segment of
|
|
37766
|
+
for (const segment of path106.split(".")) {
|
|
37660
37767
|
if (current === null || typeof current !== "object") return [];
|
|
37661
37768
|
current = current[segment];
|
|
37662
37769
|
}
|
|
@@ -37669,10 +37776,10 @@ function resolveStringsAtPath(data, path104) {
|
|
|
37669
37776
|
}
|
|
37670
37777
|
function findRuleViolations(data, rule) {
|
|
37671
37778
|
const violations = [];
|
|
37672
|
-
for (const
|
|
37673
|
-
for (const value of resolveStringsAtPath(data,
|
|
37779
|
+
for (const path106 of rule.paths) {
|
|
37780
|
+
for (const value of resolveStringsAtPath(data, path106)) {
|
|
37674
37781
|
if (minimatch9(value, rule.disallowed))
|
|
37675
|
-
violations.push({ file: rule.file, path:
|
|
37782
|
+
violations.push({ file: rule.file, path: path106, value });
|
|
37676
37783
|
}
|
|
37677
37784
|
}
|
|
37678
37785
|
return violations;
|
|
@@ -37711,8 +37818,8 @@ function forbiddenStrings() {
|
|
|
37711
37818
|
process.exit(0);
|
|
37712
37819
|
}
|
|
37713
37820
|
console.log("Forbidden strings found:\n");
|
|
37714
|
-
for (const { file, path:
|
|
37715
|
-
console.log(` ${file} ${
|
|
37821
|
+
for (const { file, path: path106, value } of violations) {
|
|
37822
|
+
console.log(` ${file} ${path106}: ${value}`);
|
|
37716
37823
|
}
|
|
37717
37824
|
console.log(`
|
|
37718
37825
|
Total: ${violations.length} forbidden string(s).`);
|
|
@@ -37768,7 +37875,7 @@ Total: ${lines2.length} hardcoded color(s)`);
|
|
|
37768
37875
|
|
|
37769
37876
|
// src/commands/verify/migrations.ts
|
|
37770
37877
|
import { readFileSync as readFileSync61 } from "fs";
|
|
37771
|
-
import
|
|
37878
|
+
import path101 from "path";
|
|
37772
37879
|
|
|
37773
37880
|
// src/commands/verify/migrations/checkAppendOnly.ts
|
|
37774
37881
|
function checkAppendOnly(baseline, current) {
|
|
@@ -37860,15 +37967,15 @@ function readBaselineMigrations(repoRelativeDir, ref) {
|
|
|
37860
37967
|
} catch {
|
|
37861
37968
|
return baseline;
|
|
37862
37969
|
}
|
|
37863
|
-
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((
|
|
37864
|
-
for (const
|
|
37970
|
+
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path106) => MIGRATION_FILE3.test(basename26(path106)));
|
|
37971
|
+
for (const path106 of paths) {
|
|
37865
37972
|
try {
|
|
37866
|
-
const content = execSync63(`git show "${ref}:${
|
|
37973
|
+
const content = execSync63(`git show "${ref}:${path106}"`, {
|
|
37867
37974
|
encoding: "utf8",
|
|
37868
37975
|
maxBuffer: 16 * 1024 * 1024,
|
|
37869
37976
|
stdio: ["pipe", "pipe", "pipe"]
|
|
37870
37977
|
});
|
|
37871
|
-
baseline.set(basename26(
|
|
37978
|
+
baseline.set(basename26(path106), content);
|
|
37872
37979
|
} catch {
|
|
37873
37980
|
}
|
|
37874
37981
|
}
|
|
@@ -37907,11 +38014,11 @@ function resolveBaselineRef() {
|
|
|
37907
38014
|
}
|
|
37908
38015
|
|
|
37909
38016
|
// src/commands/verify/migrations/migrationsDir.ts
|
|
37910
|
-
import
|
|
38017
|
+
import path100 from "path";
|
|
37911
38018
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
37912
38019
|
function migrationsDir() {
|
|
37913
|
-
return
|
|
37914
|
-
|
|
38020
|
+
return path100.resolve(
|
|
38021
|
+
path100.dirname(fileURLToPath9(import.meta.url)),
|
|
37915
38022
|
"../../../shared/db/migrations"
|
|
37916
38023
|
);
|
|
37917
38024
|
}
|
|
@@ -37932,7 +38039,7 @@ function migrations2() {
|
|
|
37932
38039
|
if (ref) {
|
|
37933
38040
|
const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
|
|
37934
38041
|
const current = new Map(
|
|
37935
|
-
files.map((file) => [file, readFileSync61(
|
|
38042
|
+
files.map((file) => [file, readFileSync61(path101.join(dir, file), "utf8")])
|
|
37936
38043
|
);
|
|
37937
38044
|
for (const finding of checkAppendOnly(baseline, current)) {
|
|
37938
38045
|
problems.push(
|
|
@@ -38437,11 +38544,11 @@ var webUiPrefix = "src/commands/sessions/web/ui/";
|
|
|
38437
38544
|
var sessionsPrefix = "src/commands/sessions/";
|
|
38438
38545
|
var rules = [
|
|
38439
38546
|
{
|
|
38440
|
-
matches: (
|
|
38547
|
+
matches: (path106) => path106.startsWith(webUiPrefix),
|
|
38441
38548
|
advice: "restart the web server, then hard-reload the browser tab"
|
|
38442
38549
|
},
|
|
38443
38550
|
{
|
|
38444
|
-
matches: (
|
|
38551
|
+
matches: (path106) => path106.startsWith(sessionsPrefix) && !path106.startsWith(webUiPrefix),
|
|
38445
38552
|
advice: "restart the daemon"
|
|
38446
38553
|
}
|
|
38447
38554
|
];
|
|
@@ -38452,27 +38559,27 @@ function restartAdvice(paths) {
|
|
|
38452
38559
|
// src/commands/watch/syncAdvice.ts
|
|
38453
38560
|
var rules2 = [
|
|
38454
38561
|
{
|
|
38455
|
-
matches: (
|
|
38562
|
+
matches: (path106) => path106.startsWith("claude/commands/"),
|
|
38456
38563
|
reason: "claude/commands changed"
|
|
38457
38564
|
},
|
|
38458
38565
|
{
|
|
38459
|
-
matches: (
|
|
38566
|
+
matches: (path106) => path106.startsWith("claude/skills/"),
|
|
38460
38567
|
reason: "claude/skills changed"
|
|
38461
38568
|
},
|
|
38462
38569
|
{
|
|
38463
|
-
matches: (
|
|
38570
|
+
matches: (path106) => path106 === "claude/settings.json",
|
|
38464
38571
|
reason: "claude/settings.json changed"
|
|
38465
38572
|
},
|
|
38466
38573
|
{
|
|
38467
|
-
matches: (
|
|
38574
|
+
matches: (path106) => path106 === "claude/design-system-prompt.md",
|
|
38468
38575
|
reason: "claude/design-system-prompt.md changed"
|
|
38469
38576
|
},
|
|
38470
38577
|
{
|
|
38471
|
-
matches: (
|
|
38578
|
+
matches: (path106) => path106.startsWith("codex/"),
|
|
38472
38579
|
reason: "codex sources changed"
|
|
38473
38580
|
},
|
|
38474
38581
|
{
|
|
38475
|
-
matches: (
|
|
38582
|
+
matches: (path106) => path106.startsWith("pi/"),
|
|
38476
38583
|
reason: "pi sources changed"
|
|
38477
38584
|
}
|
|
38478
38585
|
];
|
|
@@ -38954,7 +39061,7 @@ function registerWatch(program2) {
|
|
|
38954
39061
|
|
|
38955
39062
|
// src/commands/roam/auth.ts
|
|
38956
39063
|
import { randomBytes } from "crypto";
|
|
38957
|
-
import
|
|
39064
|
+
import chalk249 from "chalk";
|
|
38958
39065
|
|
|
38959
39066
|
// src/commands/roam/waitForCallback.ts
|
|
38960
39067
|
import { createServer as createServer3 } from "http";
|
|
@@ -39085,13 +39192,13 @@ async function auth() {
|
|
|
39085
39192
|
saveGlobalConfig(config);
|
|
39086
39193
|
const state = randomBytes(16).toString("hex");
|
|
39087
39194
|
console.log(
|
|
39088
|
-
|
|
39195
|
+
chalk249.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
39089
39196
|
);
|
|
39090
|
-
console.log(
|
|
39091
|
-
console.log(
|
|
39092
|
-
console.log(
|
|
39197
|
+
console.log(chalk249.white("http://localhost:14523/callback\n"));
|
|
39198
|
+
console.log(chalk249.blue("Opening browser for authorization..."));
|
|
39199
|
+
console.log(chalk249.dim("Waiting for authorization callback..."));
|
|
39093
39200
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
39094
|
-
console.log(
|
|
39201
|
+
console.log(chalk249.dim("Exchanging code for tokens..."));
|
|
39095
39202
|
const tokens = await exchangeToken({
|
|
39096
39203
|
code,
|
|
39097
39204
|
clientId,
|
|
@@ -39107,7 +39214,7 @@ async function auth() {
|
|
|
39107
39214
|
};
|
|
39108
39215
|
saveGlobalConfig(config);
|
|
39109
39216
|
console.log(
|
|
39110
|
-
|
|
39217
|
+
chalk249.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
39111
39218
|
);
|
|
39112
39219
|
}
|
|
39113
39220
|
|
|
@@ -39123,9 +39230,9 @@ function findPortFile(roamDir) {
|
|
|
39123
39230
|
return void 0;
|
|
39124
39231
|
}
|
|
39125
39232
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
39126
|
-
const
|
|
39233
|
+
const path106 = join101(roamDir, name);
|
|
39127
39234
|
try {
|
|
39128
|
-
return { path:
|
|
39235
|
+
return { path: path106, mtimeMs: statSync13(path106).mtimeMs };
|
|
39129
39236
|
} catch {
|
|
39130
39237
|
return void 0;
|
|
39131
39238
|
}
|
|
@@ -39369,11 +39476,11 @@ function findLinkIndex() {
|
|
|
39369
39476
|
function parseLinkArgs() {
|
|
39370
39477
|
const idx = findLinkIndex();
|
|
39371
39478
|
if (idx === -1) return null;
|
|
39372
|
-
const
|
|
39479
|
+
const path106 = process.argv[idx + 1];
|
|
39373
39480
|
const rest = process.argv.slice(idx + 2);
|
|
39374
39481
|
const { value: prefix2 } = extractOption(rest, "--prefix");
|
|
39375
39482
|
if (!prefix2) return null;
|
|
39376
|
-
return { path:
|
|
39483
|
+
return { path: path106, prefix: prefix2 };
|
|
39377
39484
|
}
|
|
39378
39485
|
function hasDuplicateLink(runList, linkPath) {
|
|
39379
39486
|
return runList.some(
|
|
@@ -39462,7 +39569,7 @@ function registerRun(program2) {
|
|
|
39462
39569
|
}
|
|
39463
39570
|
|
|
39464
39571
|
// src/commands/sessions/nodes/formatLink.ts
|
|
39465
|
-
import
|
|
39572
|
+
import chalk250 from "chalk";
|
|
39466
39573
|
|
|
39467
39574
|
// src/commands/sessions/daemon/links/describeTarget.ts
|
|
39468
39575
|
function describeTarget({ url, ssh }) {
|
|
@@ -39472,16 +39579,16 @@ function describeTarget({ url, ssh }) {
|
|
|
39472
39579
|
|
|
39473
39580
|
// src/commands/sessions/nodes/formatLink.ts
|
|
39474
39581
|
var STATE_COLOURS = {
|
|
39475
|
-
connected:
|
|
39476
|
-
connecting:
|
|
39477
|
-
disconnected:
|
|
39478
|
-
"version-blocked":
|
|
39582
|
+
connected: chalk250.green,
|
|
39583
|
+
connecting: chalk250.yellow,
|
|
39584
|
+
disconnected: chalk250.red,
|
|
39585
|
+
"version-blocked": chalk250.red
|
|
39479
39586
|
};
|
|
39480
39587
|
function formatLink(link3) {
|
|
39481
|
-
const colour = STATE_COLOURS[link3.state] ??
|
|
39588
|
+
const colour = STATE_COLOURS[link3.state] ?? chalk250.white;
|
|
39482
39589
|
const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
|
|
39483
39590
|
const error = link3.error ? `
|
|
39484
|
-
${
|
|
39591
|
+
${chalk250.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
|
|
39485
39592
|
return ` ${link3.name} ${colour(link3.state)} ${describeTarget(link3)}${peer}${error}`;
|
|
39486
39593
|
}
|
|
39487
39594
|
|
|
@@ -40018,14 +40125,14 @@ import * as pty from "node-pty";
|
|
|
40018
40125
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
40019
40126
|
import { chmodSync, existsSync as existsSync87, statSync as statSync14 } from "fs";
|
|
40020
40127
|
import { createRequire as createRequire3 } from "module";
|
|
40021
|
-
import
|
|
40128
|
+
import path102 from "path";
|
|
40022
40129
|
var require4 = createRequire3(import.meta.url);
|
|
40023
40130
|
var ensured = false;
|
|
40024
40131
|
function ensureSpawnHelperExecutable() {
|
|
40025
40132
|
if (ensured || process.platform !== "darwin") return;
|
|
40026
40133
|
ensured = true;
|
|
40027
|
-
const ptyRoot =
|
|
40028
|
-
const helper =
|
|
40134
|
+
const ptyRoot = path102.join(path102.dirname(require4.resolve("node-pty")), "..");
|
|
40135
|
+
const helper = path102.join(
|
|
40029
40136
|
ptyRoot,
|
|
40030
40137
|
"prebuilds",
|
|
40031
40138
|
`${process.platform}-${process.arch}`,
|
|
@@ -40156,12 +40263,12 @@ function serverRunMeta(runName, cwd) {
|
|
|
40156
40263
|
|
|
40157
40264
|
// src/commands/sessions/daemon/readDesignSystemPrompt.ts
|
|
40158
40265
|
import * as fs50 from "fs";
|
|
40159
|
-
import * as
|
|
40266
|
+
import * as path103 from "path";
|
|
40160
40267
|
import { fileURLToPath as fileURLToPath11 } from "url";
|
|
40161
40268
|
var __filename5 = fileURLToPath11(import.meta.url);
|
|
40162
|
-
var __dirname7 =
|
|
40269
|
+
var __dirname7 = path103.dirname(__filename5);
|
|
40163
40270
|
function readDesignSystemPrompt() {
|
|
40164
|
-
const promptPath =
|
|
40271
|
+
const promptPath = path103.join(
|
|
40165
40272
|
__dirname7,
|
|
40166
40273
|
"..",
|
|
40167
40274
|
"claude",
|
|
@@ -41195,8 +41302,8 @@ async function seedRunningMsFromUsage(session, notify2) {
|
|
|
41195
41302
|
var DEBOUNCE_MS2 = 50;
|
|
41196
41303
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
41197
41304
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
41198
|
-
const
|
|
41199
|
-
const dir = dirname42(
|
|
41305
|
+
const path106 = activityPath(session.id);
|
|
41306
|
+
const dir = dirname42(path106);
|
|
41200
41307
|
try {
|
|
41201
41308
|
mkdirSync37(dir, { recursive: true });
|
|
41202
41309
|
} catch {
|
|
@@ -41206,7 +41313,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
41206
41313
|
let timer = null;
|
|
41207
41314
|
const read3 = () => {
|
|
41208
41315
|
timer = null;
|
|
41209
|
-
const activity2 = readActivity(
|
|
41316
|
+
const activity2 = readActivity(path106);
|
|
41210
41317
|
if (!activity2) return;
|
|
41211
41318
|
applyActivityToSession(session, activity2);
|
|
41212
41319
|
if (activity2.claudeSessionId) onClaudeSessionId?.(session);
|
|
@@ -41215,11 +41322,11 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
41215
41322
|
notify2();
|
|
41216
41323
|
};
|
|
41217
41324
|
session.activityWatcher = watch2(dir, (_event, filename) => {
|
|
41218
|
-
if (filename && !
|
|
41325
|
+
if (filename && !path106.endsWith(filename)) return;
|
|
41219
41326
|
if (timer) clearTimeout(timer);
|
|
41220
41327
|
timer = setTimeout(read3, DEBOUNCE_MS2);
|
|
41221
41328
|
});
|
|
41222
|
-
if (existsSync93(
|
|
41329
|
+
if (existsSync93(path106)) read3();
|
|
41223
41330
|
}
|
|
41224
41331
|
function refreshActivity(session) {
|
|
41225
41332
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -41362,12 +41469,12 @@ import { watch as watch3 } from "fs";
|
|
|
41362
41469
|
|
|
41363
41470
|
// src/commands/sessions/shared/findTranscriptPathSync.ts
|
|
41364
41471
|
import * as fs52 from "fs";
|
|
41365
|
-
import * as
|
|
41472
|
+
import * as path104 from "path";
|
|
41366
41473
|
function projectDirForCwd(cwd) {
|
|
41367
|
-
return
|
|
41474
|
+
return path104.join(claudeProjectsRoot(), projectSlug(cwd));
|
|
41368
41475
|
}
|
|
41369
41476
|
function transcriptPathFor(cwd, claudeSessionId) {
|
|
41370
|
-
return
|
|
41477
|
+
return path104.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
|
|
41371
41478
|
}
|
|
41372
41479
|
function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
41373
41480
|
const direct = transcriptPathFor(cwd, claudeSessionId);
|
|
@@ -41381,8 +41488,8 @@ function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
|
41381
41488
|
}
|
|
41382
41489
|
for (const file of files) {
|
|
41383
41490
|
if (!file.endsWith(".jsonl")) continue;
|
|
41384
|
-
if (headContainsSessionId(
|
|
41385
|
-
return
|
|
41491
|
+
if (headContainsSessionId(path104.join(dir, file), claudeSessionId))
|
|
41492
|
+
return path104.join(dir, file);
|
|
41386
41493
|
}
|
|
41387
41494
|
return null;
|
|
41388
41495
|
}
|
|
@@ -42582,9 +42689,9 @@ function tempRoots() {
|
|
|
42582
42689
|
}
|
|
42583
42690
|
return [...roots];
|
|
42584
42691
|
}
|
|
42585
|
-
function underTempRoot(
|
|
42692
|
+
function underTempRoot(path106) {
|
|
42586
42693
|
return tempRoots().some(
|
|
42587
|
-
(root2) =>
|
|
42694
|
+
(root2) => path106.startsWith(root2.endsWith(sep3) ? root2 : root2 + sep3)
|
|
42588
42695
|
);
|
|
42589
42696
|
}
|
|
42590
42697
|
|
|
@@ -43070,15 +43177,15 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
43070
43177
|
import { existsSync as existsSync95 } from "fs";
|
|
43071
43178
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
43072
43179
|
if (!existsSync95(clone)) {
|
|
43073
|
-
for (const { path:
|
|
43180
|
+
for (const { path: path106 } of paths) forgetWorktree(path106);
|
|
43074
43181
|
daemonLog(
|
|
43075
43182
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
43076
43183
|
);
|
|
43077
43184
|
return;
|
|
43078
43185
|
}
|
|
43079
43186
|
await pruneBookkeeping2(clone);
|
|
43080
|
-
for (const { path:
|
|
43081
|
-
if (await reclaimBranch(clone, branch2)) forgetWorktree(
|
|
43187
|
+
for (const { path: path106, branch: branch2 } of paths)
|
|
43188
|
+
if (await reclaimBranch(clone, branch2)) forgetWorktree(path106);
|
|
43082
43189
|
}
|
|
43083
43190
|
async function pruneBookkeeping2(clone) {
|
|
43084
43191
|
try {
|
|
@@ -43105,37 +43212,37 @@ async function reclaimBranch(clone, branch2) {
|
|
|
43105
43212
|
}
|
|
43106
43213
|
|
|
43107
43214
|
// src/commands/sessions/daemon/worktree/logVanishedTree.ts
|
|
43108
|
-
function logVanishedTree(sessions,
|
|
43215
|
+
function logVanishedTree(sessions, path106) {
|
|
43109
43216
|
const claimants = [...sessions.values()].filter(
|
|
43110
|
-
(s) => s.cwd ===
|
|
43217
|
+
(s) => s.cwd === path106 || s.worktree?.path === path106
|
|
43111
43218
|
);
|
|
43112
43219
|
if (claimants.length === 0) {
|
|
43113
|
-
daemonLog(`worktree ${
|
|
43220
|
+
daemonLog(`worktree ${path106} gone from disk and unclaimed; reclaiming it`);
|
|
43114
43221
|
return;
|
|
43115
43222
|
}
|
|
43116
43223
|
for (const s of claimants)
|
|
43117
43224
|
daemonLog(
|
|
43118
|
-
`session ${s.id} ("${s.name}") claims worktree ${
|
|
43225
|
+
`session ${s.id} ("${s.name}") claims worktree ${path106}, which is gone from disk; reclaiming it`
|
|
43119
43226
|
);
|
|
43120
43227
|
}
|
|
43121
43228
|
|
|
43122
43229
|
// src/commands/sessions/daemon/worktree/describeHeldWork.ts
|
|
43123
43230
|
var MAX_ITEMS = 20;
|
|
43124
|
-
async function describeHeldWork(
|
|
43125
|
-
if (reason4.startsWith("uncommitted")) return await changedFiles(
|
|
43126
|
-
if (reason4.startsWith("unpushed")) return await unpushedCommits(
|
|
43231
|
+
async function describeHeldWork(path106, reason4) {
|
|
43232
|
+
if (reason4.startsWith("uncommitted")) return await changedFiles(path106);
|
|
43233
|
+
if (reason4.startsWith("unpushed")) return await unpushedCommits(path106, reason4);
|
|
43127
43234
|
return { summary: reason4, items: [] };
|
|
43128
43235
|
}
|
|
43129
|
-
async function changedFiles(
|
|
43130
|
-
const status3 = await gitResult(
|
|
43236
|
+
async function changedFiles(path106) {
|
|
43237
|
+
const status3 = await gitResult(path106, ["status", "--porcelain"]);
|
|
43131
43238
|
const lines2 = status3.ok ? nonEmptyLines(status3.out) : [];
|
|
43132
43239
|
return {
|
|
43133
43240
|
summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
|
|
43134
43241
|
items: capped2(lines2)
|
|
43135
43242
|
};
|
|
43136
43243
|
}
|
|
43137
|
-
async function unpushedCommits(
|
|
43138
|
-
const log2 = await gitResult(
|
|
43244
|
+
async function unpushedCommits(path106, reason4) {
|
|
43245
|
+
const log2 = await gitResult(path106, ["log", "--oneline", "@{upstream}..HEAD"]);
|
|
43139
43246
|
if (!log2.ok) return { summary: reason4, items: [] };
|
|
43140
43247
|
const lines2 = nonEmptyLines(log2.out);
|
|
43141
43248
|
return {
|
|
@@ -43227,24 +43334,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
|
|
|
43227
43334
|
async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
43228
43335
|
const accounted = accountedTrees(sessions);
|
|
43229
43336
|
const vanished = /* @__PURE__ */ new Map();
|
|
43230
|
-
for (const { path:
|
|
43231
|
-
if (underTempRoot(
|
|
43232
|
-
forgetWorktree(
|
|
43337
|
+
for (const { path: path106, clone } of readWorktreeRegistry()) {
|
|
43338
|
+
if (underTempRoot(path106)) {
|
|
43339
|
+
forgetWorktree(path106);
|
|
43233
43340
|
daemonLog(
|
|
43234
|
-
`worktree ${
|
|
43341
|
+
`worktree ${path106} lies outside any project root; pruned from the registry rather than recovered`
|
|
43235
43342
|
);
|
|
43236
43343
|
continue;
|
|
43237
43344
|
}
|
|
43238
|
-
if (!existsSync96(
|
|
43239
|
-
logVanishedTree(sessions,
|
|
43345
|
+
if (!existsSync96(path106)) {
|
|
43346
|
+
logVanishedTree(sessions, path106);
|
|
43240
43347
|
vanished.set(clone, [
|
|
43241
43348
|
...vanished.get(clone) ?? [],
|
|
43242
|
-
{ path:
|
|
43349
|
+
{ path: path106, branch: basename29(path106) }
|
|
43243
43350
|
]);
|
|
43244
43351
|
continue;
|
|
43245
43352
|
}
|
|
43246
|
-
if (accounted.has(
|
|
43247
|
-
await recoverOrphan(sessions, spawnWith, { path:
|
|
43353
|
+
if (accounted.has(path106)) continue;
|
|
43354
|
+
await recoverOrphan(sessions, spawnWith, { path: path106, clone }, notify2);
|
|
43248
43355
|
}
|
|
43249
43356
|
for (const [clone, paths] of vanished)
|
|
43250
43357
|
await reclaimVanishedWorktrees(clone, paths);
|
|
@@ -45322,12 +45429,12 @@ function handleSetStatus(client, m, d) {
|
|
|
45322
45429
|
import * as fs56 from "fs";
|
|
45323
45430
|
|
|
45324
45431
|
// src/commands/sessions/shared/codex/findCodexRolloutPath.ts
|
|
45325
|
-
import * as
|
|
45432
|
+
import * as path105 from "path";
|
|
45326
45433
|
async function findCodexRolloutPath(sessionId) {
|
|
45327
45434
|
if (!sessionId) return null;
|
|
45328
45435
|
const paths = await discoverCodexRolloutPaths();
|
|
45329
45436
|
const suffix = `-${sessionId}.jsonl`;
|
|
45330
|
-
return paths.find((file) =>
|
|
45437
|
+
return paths.find((file) => path105.basename(file).endsWith(suffix)) ?? null;
|
|
45331
45438
|
}
|
|
45332
45439
|
|
|
45333
45440
|
// src/commands/sessions/shared/codex/codexToolTarget.ts
|
|
@@ -45910,13 +46017,13 @@ function describePeerError(error) {
|
|
|
45910
46017
|
const cause = error.cause;
|
|
45911
46018
|
return cause instanceof Error ? `${error.message}: ${describePeerError(cause)}` : error.message;
|
|
45912
46019
|
}
|
|
45913
|
-
async function fetchPeerJson(baseUrl,
|
|
45914
|
-
const res = await fetch(new URL(
|
|
46020
|
+
async function fetchPeerJson(baseUrl, path106, timeoutMs = PEER_TIMEOUT_MS) {
|
|
46021
|
+
const res = await fetch(new URL(path106, baseUrl), {
|
|
45915
46022
|
signal: AbortSignal.timeout(timeoutMs)
|
|
45916
46023
|
});
|
|
45917
46024
|
if (!res.ok)
|
|
45918
46025
|
throw Object.assign(
|
|
45919
|
-
new Error(`GET ${
|
|
46026
|
+
new Error(`GET ${path106} returned ${res.status} ${res.statusText}`),
|
|
45920
46027
|
{ status: res.status }
|
|
45921
46028
|
);
|
|
45922
46029
|
return await res.json();
|
|
@@ -46229,7 +46336,7 @@ async function probeSshAgent(alias) {
|
|
|
46229
46336
|
}
|
|
46230
46337
|
|
|
46231
46338
|
// src/commands/sessions/nodes/printReport.ts
|
|
46232
|
-
import
|
|
46339
|
+
import chalk251 from "chalk";
|
|
46233
46340
|
function printReport(report2) {
|
|
46234
46341
|
if (report2.links.length === 0) {
|
|
46235
46342
|
console.log(`${report2.local} has no links`);
|
|
@@ -46243,11 +46350,11 @@ function printReport(report2) {
|
|
|
46243
46350
|
for (const diagnosis of report2.links) printDiagnosis(diagnosis);
|
|
46244
46351
|
}
|
|
46245
46352
|
function printDiagnosis(diagnosis) {
|
|
46246
|
-
console.log(`${
|
|
46353
|
+
console.log(`${chalk251.bold(diagnosis.name)} ${chalk251.dim(diagnosis.url)}`);
|
|
46247
46354
|
for (const hop of diagnosis.hops) {
|
|
46248
|
-
const mark = hop.ok ?
|
|
46355
|
+
const mark = hop.ok ? chalk251.green("\u2713") : chalk251.red("\u2717");
|
|
46249
46356
|
console.log(` ${mark} ${hop.hop.padEnd(6)} ${hop.detail ?? hop.error}`);
|
|
46250
|
-
if (hop.remediation) console.log(` ${
|
|
46357
|
+
if (hop.remediation) console.log(` ${chalk251.yellow(hop.remediation)}`);
|
|
46251
46358
|
}
|
|
46252
46359
|
}
|
|
46253
46360
|
|
|
@@ -46280,14 +46387,14 @@ async function doctorNodes(name, options2) {
|
|
|
46280
46387
|
}
|
|
46281
46388
|
|
|
46282
46389
|
// src/commands/sessions/nodes/linkNode.ts
|
|
46283
|
-
import
|
|
46390
|
+
import chalk253 from "chalk";
|
|
46284
46391
|
|
|
46285
46392
|
// src/commands/sessions/nodes/notifyDaemonLinks.ts
|
|
46286
|
-
import
|
|
46393
|
+
import chalk252 from "chalk";
|
|
46287
46394
|
async function notifyDaemonLinks() {
|
|
46288
46395
|
if (!await isDaemonRunning()) {
|
|
46289
46396
|
console.log(
|
|
46290
|
-
|
|
46397
|
+
chalk252.yellow(
|
|
46291
46398
|
"The sessions daemon is not running; it loads the links when it starts."
|
|
46292
46399
|
)
|
|
46293
46400
|
);
|
|
@@ -46295,11 +46402,11 @@ async function notifyDaemonLinks() {
|
|
|
46295
46402
|
}
|
|
46296
46403
|
try {
|
|
46297
46404
|
await sendToDaemonAwaitAck({ type: "reload-links" });
|
|
46298
|
-
console.log(
|
|
46405
|
+
console.log(chalk252.dim("The sessions daemon reloaded its links."));
|
|
46299
46406
|
} catch (error) {
|
|
46300
46407
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
46301
46408
|
console.log(
|
|
46302
|
-
|
|
46409
|
+
chalk252.yellow(
|
|
46303
46410
|
`Could not notify the sessions daemon (${message3}); run \`assist daemon restart\` to apply the change.`
|
|
46304
46411
|
)
|
|
46305
46412
|
);
|
|
@@ -46359,13 +46466,13 @@ async function linkNode(name, url, options2) {
|
|
|
46359
46466
|
const link3 = buildLink(name, url, options2, others);
|
|
46360
46467
|
await writeLinks([...others, link3]);
|
|
46361
46468
|
console.log(
|
|
46362
|
-
|
|
46469
|
+
chalk253.green(`Linked ${name} (${describeTarget(toLinkSpec(link3))})`)
|
|
46363
46470
|
);
|
|
46364
46471
|
await notifyDaemonLinks();
|
|
46365
46472
|
}
|
|
46366
46473
|
|
|
46367
46474
|
// src/commands/sessions/nodes/listNodes.ts
|
|
46368
|
-
import
|
|
46475
|
+
import chalk254 from "chalk";
|
|
46369
46476
|
async function nodesReport() {
|
|
46370
46477
|
const live = await queryNodes();
|
|
46371
46478
|
if (live)
|
|
@@ -46382,10 +46489,10 @@ async function listNodes(options2) {
|
|
|
46382
46489
|
console.log(JSON.stringify(report2, null, 2));
|
|
46383
46490
|
return;
|
|
46384
46491
|
}
|
|
46385
|
-
console.log(`${report2.local} ${
|
|
46492
|
+
console.log(`${report2.local} ${chalk254.dim("(this node)")}`);
|
|
46386
46493
|
if (!report2.daemonRunning)
|
|
46387
|
-
console.log(
|
|
46388
|
-
if (report2.links.length === 0) console.log(
|
|
46494
|
+
console.log(chalk254.dim(" daemon not running; showing configured links"));
|
|
46495
|
+
if (report2.links.length === 0) console.log(chalk254.dim(" no links"));
|
|
46389
46496
|
for (const link3 of report2.links) console.log(formatLink(link3));
|
|
46390
46497
|
}
|
|
46391
46498
|
|
|
@@ -46424,16 +46531,16 @@ async function nodeLogs(name, options2) {
|
|
|
46424
46531
|
}
|
|
46425
46532
|
|
|
46426
46533
|
// src/commands/sessions/nodes/unlinkNode.ts
|
|
46427
|
-
import
|
|
46534
|
+
import chalk255 from "chalk";
|
|
46428
46535
|
async function unlinkNode(name) {
|
|
46429
46536
|
const links2 = readLinks();
|
|
46430
46537
|
const remaining = links2.filter((link3) => link3.name !== name);
|
|
46431
46538
|
if (remaining.length === links2.length) {
|
|
46432
|
-
console.log(
|
|
46539
|
+
console.log(chalk255.yellow(`No link named ${name}`));
|
|
46433
46540
|
return;
|
|
46434
46541
|
}
|
|
46435
46542
|
await writeLinks(remaining);
|
|
46436
|
-
console.log(
|
|
46543
|
+
console.log(chalk255.green(`Unlinked ${name}`));
|
|
46437
46544
|
await notifyDaemonLinks();
|
|
46438
46545
|
}
|
|
46439
46546
|
|
|
@@ -46572,7 +46679,7 @@ async function renameSession(title) {
|
|
|
46572
46679
|
|
|
46573
46680
|
// src/commands/sessions/summarise.ts
|
|
46574
46681
|
import * as fs58 from "fs";
|
|
46575
|
-
import
|
|
46682
|
+
import chalk256 from "chalk";
|
|
46576
46683
|
|
|
46577
46684
|
// src/commands/sessions/summarise/shared.ts
|
|
46578
46685
|
import * as fs57 from "fs";
|
|
@@ -46631,22 +46738,22 @@ ${firstMessage}`);
|
|
|
46631
46738
|
async function summarise2(options2) {
|
|
46632
46739
|
const files = await discoverSessionFiles();
|
|
46633
46740
|
if (files.length === 0) {
|
|
46634
|
-
console.log(
|
|
46741
|
+
console.log(chalk256.yellow("No sessions found."));
|
|
46635
46742
|
return;
|
|
46636
46743
|
}
|
|
46637
46744
|
const toProcess = selectCandidates(files, options2);
|
|
46638
46745
|
if (toProcess.length === 0) {
|
|
46639
|
-
console.log(
|
|
46746
|
+
console.log(chalk256.green("All sessions already summarised."));
|
|
46640
46747
|
return;
|
|
46641
46748
|
}
|
|
46642
46749
|
console.log(
|
|
46643
|
-
|
|
46750
|
+
chalk256.cyan(
|
|
46644
46751
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
46645
46752
|
)
|
|
46646
46753
|
);
|
|
46647
46754
|
const { succeeded, failed: failed3 } = processSessions(toProcess);
|
|
46648
46755
|
console.log(
|
|
46649
|
-
|
|
46756
|
+
chalk256.green(`Done: ${succeeded} summarised`) + (failed3 > 0 ? chalk256.yellow(`, ${failed3} skipped`) : "")
|
|
46650
46757
|
);
|
|
46651
46758
|
}
|
|
46652
46759
|
function selectCandidates(files, options2) {
|
|
@@ -46666,16 +46773,16 @@ function processSessions(files) {
|
|
|
46666
46773
|
let failed3 = 0;
|
|
46667
46774
|
for (let i = 0; i < files.length; i++) {
|
|
46668
46775
|
const file = files[i];
|
|
46669
|
-
process.stdout.write(
|
|
46776
|
+
process.stdout.write(chalk256.dim(` [${i + 1}/${files.length}] `));
|
|
46670
46777
|
const summary = summariseSession(file);
|
|
46671
46778
|
if (summary) {
|
|
46672
46779
|
writeSummary(file, summary);
|
|
46673
46780
|
succeeded++;
|
|
46674
|
-
process.stdout.write(`${
|
|
46781
|
+
process.stdout.write(`${chalk256.green("\u2713")} ${summary}
|
|
46675
46782
|
`);
|
|
46676
46783
|
} else {
|
|
46677
46784
|
failed3++;
|
|
46678
|
-
process.stdout.write(` ${
|
|
46785
|
+
process.stdout.write(` ${chalk256.yellow("skip")}
|
|
46679
46786
|
`);
|
|
46680
46787
|
}
|
|
46681
46788
|
}
|
|
@@ -46704,10 +46811,10 @@ function registerSessions(program2) {
|
|
|
46704
46811
|
}
|
|
46705
46812
|
|
|
46706
46813
|
// src/reportCliError.ts
|
|
46707
|
-
import
|
|
46814
|
+
import chalk257 from "chalk";
|
|
46708
46815
|
function reportCliError(error) {
|
|
46709
46816
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
46710
|
-
console.error(
|
|
46817
|
+
console.error(chalk257.red(error.message));
|
|
46711
46818
|
} else {
|
|
46712
46819
|
console.error(error);
|
|
46713
46820
|
}
|