@staff0rd/assist 0.720.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/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +428 -406
- 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("/");
|
|
@@ -4320,8 +4320,8 @@ function getPreferredRemoteRepo(cwd) {
|
|
|
4320
4320
|
function gitRefUrl(kind, ref, cwd) {
|
|
4321
4321
|
const repo = getPreferredRemoteRepo(cwd);
|
|
4322
4322
|
if (!repo) return void 0;
|
|
4323
|
-
const
|
|
4324
|
-
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}`;
|
|
4325
4325
|
}
|
|
4326
4326
|
|
|
4327
4327
|
// src/commands/sessions/shared/resolveSessionTranscript.ts
|
|
@@ -4482,9 +4482,9 @@ var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
|
|
|
4482
4482
|
function backupLocalBacklogFiles(dir) {
|
|
4483
4483
|
const moved = [];
|
|
4484
4484
|
for (const name of LOCAL_FILES) {
|
|
4485
|
-
const
|
|
4486
|
-
if (existsSync20(
|
|
4487
|
-
renameSync(
|
|
4485
|
+
const path106 = join19(dir, ".assist", name);
|
|
4486
|
+
if (existsSync20(path106)) {
|
|
4487
|
+
renameSync(path106, `${path106}.bak`);
|
|
4488
4488
|
moved.push(`${name} \u2192 ${name}.bak`);
|
|
4489
4489
|
}
|
|
4490
4490
|
}
|
|
@@ -4968,8 +4968,8 @@ var backlogItemSchema = z4.strictObject({
|
|
|
4968
4968
|
var backlogFileSchema = z4.array(backlogItemSchema);
|
|
4969
4969
|
|
|
4970
4970
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
4971
|
-
function parseBacklogJsonl(
|
|
4972
|
-
const content = readFileSync13(
|
|
4971
|
+
function parseBacklogJsonl(path106) {
|
|
4972
|
+
const content = readFileSync13(path106, "utf8").trim();
|
|
4973
4973
|
if (content.length === 0) return [];
|
|
4974
4974
|
return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
|
|
4975
4975
|
}
|
|
@@ -5515,9 +5515,9 @@ function originToSshUrl(origin) {
|
|
|
5515
5515
|
const firstSlash = origin.indexOf("/");
|
|
5516
5516
|
if (firstSlash <= 0) return null;
|
|
5517
5517
|
const host = origin.slice(0, firstSlash);
|
|
5518
|
-
const
|
|
5519
|
-
if (!
|
|
5520
|
-
return `git@${host}:${
|
|
5518
|
+
const path106 = origin.slice(firstSlash + 1);
|
|
5519
|
+
if (!path106) return null;
|
|
5520
|
+
return `git@${host}:${path106}.git`;
|
|
5521
5521
|
}
|
|
5522
5522
|
|
|
5523
5523
|
// src/commands/backlog/cloneRepo.ts
|
|
@@ -7155,10 +7155,10 @@ var hooksSettings = {
|
|
|
7155
7155
|
}
|
|
7156
7156
|
};
|
|
7157
7157
|
function ensureHooksSettings() {
|
|
7158
|
-
const
|
|
7159
|
-
mkdirSync5(dirname15(
|
|
7160
|
-
writeFileSync16(
|
|
7161
|
-
return
|
|
7158
|
+
const path106 = daemonPaths.hooksSettings;
|
|
7159
|
+
mkdirSync5(dirname15(path106), { recursive: true });
|
|
7160
|
+
writeFileSync16(path106, JSON.stringify(hooksSettings, null, 2));
|
|
7161
|
+
return path106;
|
|
7162
7162
|
}
|
|
7163
7163
|
|
|
7164
7164
|
// src/shared/spawnInherit.ts
|
|
@@ -7914,24 +7914,24 @@ function getOwnerPath(itemId2) {
|
|
|
7914
7914
|
function recordSignalOwner(itemId2) {
|
|
7915
7915
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
7916
7916
|
if (!sessionId) return;
|
|
7917
|
-
const
|
|
7918
|
-
mkdirSync7(dirname16(
|
|
7919
|
-
writeFileSync18(
|
|
7917
|
+
const path106 = getOwnerPath(itemId2);
|
|
7918
|
+
mkdirSync7(dirname16(path106), { recursive: true });
|
|
7919
|
+
writeFileSync18(path106, JSON.stringify({ sessionId }));
|
|
7920
7920
|
}
|
|
7921
7921
|
function readSignalOwner(itemId2) {
|
|
7922
|
-
const
|
|
7923
|
-
if (!existsSync26(
|
|
7922
|
+
const path106 = getOwnerPath(itemId2);
|
|
7923
|
+
if (!existsSync26(path106)) return void 0;
|
|
7924
7924
|
try {
|
|
7925
|
-
const parsed = JSON.parse(readFileSync17(
|
|
7925
|
+
const parsed = JSON.parse(readFileSync17(path106, "utf8"));
|
|
7926
7926
|
return parsed.sessionId;
|
|
7927
7927
|
} catch {
|
|
7928
7928
|
return void 0;
|
|
7929
7929
|
}
|
|
7930
7930
|
}
|
|
7931
7931
|
function clearSignalOwner(itemId2) {
|
|
7932
|
-
const
|
|
7932
|
+
const path106 = getOwnerPath(itemId2);
|
|
7933
7933
|
try {
|
|
7934
|
-
rmSync(
|
|
7934
|
+
rmSync(path106);
|
|
7935
7935
|
} catch {
|
|
7936
7936
|
}
|
|
7937
7937
|
}
|
|
@@ -7968,19 +7968,19 @@ function resolveSignalTarget(event, data) {
|
|
|
7968
7968
|
function writeSignal(event, data) {
|
|
7969
7969
|
const target = resolveSignalTarget(event, data);
|
|
7970
7970
|
if (!target) return;
|
|
7971
|
-
const
|
|
7972
|
-
if (!
|
|
7971
|
+
const path106 = getSignalPath(target);
|
|
7972
|
+
if (!path106) return;
|
|
7973
7973
|
const signal = { event, sessionId: target, ...data };
|
|
7974
|
-
mkdirSync8(dirname17(
|
|
7975
|
-
writeFileSync19(
|
|
7974
|
+
mkdirSync8(dirname17(path106), { recursive: true });
|
|
7975
|
+
writeFileSync19(path106, JSON.stringify(signal));
|
|
7976
7976
|
}
|
|
7977
7977
|
|
|
7978
7978
|
// src/commands/backlog/readSignal.ts
|
|
7979
7979
|
function readSignal() {
|
|
7980
|
-
const
|
|
7981
|
-
if (!
|
|
7980
|
+
const path106 = getSignalPath();
|
|
7981
|
+
if (!path106 || !existsSync27(path106)) return void 0;
|
|
7982
7982
|
try {
|
|
7983
|
-
return JSON.parse(readFileSync18(
|
|
7983
|
+
return JSON.parse(readFileSync18(path106, "utf8"));
|
|
7984
7984
|
} catch {
|
|
7985
7985
|
return void 0;
|
|
7986
7986
|
}
|
|
@@ -8178,13 +8178,13 @@ function activityPath(sessionId) {
|
|
|
8178
8178
|
function emitActivity(activity2) {
|
|
8179
8179
|
const sessionId = process.env.ASSIST_ACTIVITY_ID;
|
|
8180
8180
|
if (!sessionId) return;
|
|
8181
|
-
const
|
|
8182
|
-
mkdirSync9(dirname18(
|
|
8183
|
-
writeFileSync20(
|
|
8181
|
+
const path106 = activityPath(sessionId);
|
|
8182
|
+
mkdirSync9(dirname18(path106), { recursive: true });
|
|
8183
|
+
writeFileSync20(path106, JSON.stringify({ ...activity2, startedAt: Date.now() }));
|
|
8184
8184
|
}
|
|
8185
|
-
function readActivity(
|
|
8185
|
+
function readActivity(path106) {
|
|
8186
8186
|
try {
|
|
8187
|
-
return JSON.parse(readFileSync19(
|
|
8187
|
+
return JSON.parse(readFileSync19(path106, "utf8"));
|
|
8188
8188
|
} catch {
|
|
8189
8189
|
return void 0;
|
|
8190
8190
|
}
|
|
@@ -8194,9 +8194,9 @@ function reconcileActivity(sessionId, activity2) {
|
|
|
8194
8194
|
removeActivity(sessionId);
|
|
8195
8195
|
return;
|
|
8196
8196
|
}
|
|
8197
|
-
const
|
|
8198
|
-
mkdirSync9(dirname18(
|
|
8199
|
-
writeFileSync20(
|
|
8197
|
+
const path106 = activityPath(sessionId);
|
|
8198
|
+
mkdirSync9(dirname18(path106), { recursive: true });
|
|
8199
|
+
writeFileSync20(path106, JSON.stringify(activity2));
|
|
8200
8200
|
}
|
|
8201
8201
|
function removeActivity(sessionId) {
|
|
8202
8202
|
try {
|
|
@@ -10821,10 +10821,10 @@ function getStorePath(filename) {
|
|
|
10821
10821
|
return join34(getStoreDir(), filename);
|
|
10822
10822
|
}
|
|
10823
10823
|
function loadJson(filename) {
|
|
10824
|
-
const
|
|
10825
|
-
if (existsSync32(
|
|
10824
|
+
const path106 = getStorePath(filename);
|
|
10825
|
+
if (existsSync32(path106)) {
|
|
10826
10826
|
try {
|
|
10827
|
-
return JSON.parse(readFileSync20(
|
|
10827
|
+
return JSON.parse(readFileSync20(path106, "utf8"));
|
|
10828
10828
|
} catch {
|
|
10829
10829
|
return {};
|
|
10830
10830
|
}
|
|
@@ -10843,22 +10843,22 @@ function saveJson(filename, data) {
|
|
|
10843
10843
|
var REGISTRY_FILE = "worktrees.json";
|
|
10844
10844
|
function readWorktreeRegistry() {
|
|
10845
10845
|
const data = loadJson(REGISTRY_FILE);
|
|
10846
|
-
return Object.entries(data).filter(([, record]) => !record.reaped).map(([
|
|
10846
|
+
return Object.entries(data).filter(([, record]) => !record.reaped).map(([path106, record]) => ({ path: path106, ...record }));
|
|
10847
10847
|
}
|
|
10848
|
-
function worktreeAttributionIncludingReaped(
|
|
10849
|
-
const record = loadJson(REGISTRY_FILE)[
|
|
10848
|
+
function worktreeAttributionIncludingReaped(path106) {
|
|
10849
|
+
const record = loadJson(REGISTRY_FILE)[path106];
|
|
10850
10850
|
return record ? { clone: record.clone, origin: record.origin } : void 0;
|
|
10851
10851
|
}
|
|
10852
|
-
function recordWorktree(
|
|
10852
|
+
function recordWorktree(path106, clone, origin) {
|
|
10853
10853
|
const data = loadJson(REGISTRY_FILE);
|
|
10854
|
-
data[
|
|
10854
|
+
data[path106] = { clone, origin };
|
|
10855
10855
|
saveJson(REGISTRY_FILE, data);
|
|
10856
10856
|
}
|
|
10857
|
-
function forgetWorktree(
|
|
10857
|
+
function forgetWorktree(path106) {
|
|
10858
10858
|
const data = loadJson(REGISTRY_FILE);
|
|
10859
|
-
const record = data[
|
|
10859
|
+
const record = data[path106];
|
|
10860
10860
|
if (!record || record.reaped) return;
|
|
10861
|
-
data[
|
|
10861
|
+
data[path106] = { ...record, reaped: true };
|
|
10862
10862
|
saveJson(REGISTRY_FILE, data);
|
|
10863
10863
|
}
|
|
10864
10864
|
|
|
@@ -11468,10 +11468,10 @@ function completeLines(text18, windowIsPartial) {
|
|
|
11468
11468
|
if (windowIsPartial) all.shift();
|
|
11469
11469
|
return all;
|
|
11470
11470
|
}
|
|
11471
|
-
function readLogTail(
|
|
11471
|
+
function readLogTail(path106, lines2) {
|
|
11472
11472
|
let fd;
|
|
11473
11473
|
try {
|
|
11474
|
-
fd = openSync4(
|
|
11474
|
+
fd = openSync4(path106, "r");
|
|
11475
11475
|
} catch {
|
|
11476
11476
|
return [];
|
|
11477
11477
|
}
|
|
@@ -11736,8 +11736,8 @@ async function loadCommittedPaths(cwd, sessionId) {
|
|
|
11736
11736
|
for (const commit2 of commits2) {
|
|
11737
11737
|
const resolved = await resolveCommit(cwd, commit2.sha);
|
|
11738
11738
|
if (!resolved) continue;
|
|
11739
|
-
for (const
|
|
11740
|
-
if (!bases.has(
|
|
11739
|
+
for (const path106 of resolved.paths) {
|
|
11740
|
+
if (!bases.has(path106)) bases.set(path106, resolved.base);
|
|
11741
11741
|
}
|
|
11742
11742
|
}
|
|
11743
11743
|
return { commits: commits2, bases };
|
|
@@ -11755,16 +11755,16 @@ async function itemChangeSet(cwd, sessionId) {
|
|
|
11755
11755
|
}
|
|
11756
11756
|
function groupByBase(bases) {
|
|
11757
11757
|
const groups = /* @__PURE__ */ new Map();
|
|
11758
|
-
for (const [
|
|
11758
|
+
for (const [path106, base] of bases) {
|
|
11759
11759
|
const paths = groups.get(base);
|
|
11760
|
-
if (paths) paths.push(
|
|
11761
|
-
else groups.set(base, [
|
|
11760
|
+
if (paths) paths.push(path106);
|
|
11761
|
+
else groups.set(base, [path106]);
|
|
11762
11762
|
}
|
|
11763
11763
|
return [...groups].map(([base, paths]) => ({ base, paths: paths.sort() }));
|
|
11764
11764
|
}
|
|
11765
11765
|
async function dirtyPaths(cwd, bases) {
|
|
11766
11766
|
const output = await execGit(cwd, ["diff", "--name-only", "HEAD"]);
|
|
11767
|
-
return output.split("\n").filter((
|
|
11767
|
+
return output.split("\n").filter((path106) => path106 && !bases.has(path106)).sort();
|
|
11768
11768
|
}
|
|
11769
11769
|
|
|
11770
11770
|
// src/commands/sessions/web/scopedDiff.ts
|
|
@@ -11773,8 +11773,8 @@ async function scopedDiff(cwd, session, scope) {
|
|
|
11773
11773
|
if (scope.kind === "commit") return commitDiff(cwd, scope.sha);
|
|
11774
11774
|
return await trackedScopeDiff(cwd, session, scope) + await untrackedDiff(cwd);
|
|
11775
11775
|
}
|
|
11776
|
-
async function untrackedFileDiff(cwd,
|
|
11777
|
-
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null",
|
|
11776
|
+
async function untrackedFileDiff(cwd, path106) {
|
|
11777
|
+
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path106], {
|
|
11778
11778
|
maxBuffer: MAX_DIFF_BYTES,
|
|
11779
11779
|
allowFailure: true
|
|
11780
11780
|
});
|
|
@@ -11787,7 +11787,7 @@ async function untrackedDiff(cwd) {
|
|
|
11787
11787
|
]);
|
|
11788
11788
|
const paths = list5.split("\n").filter(Boolean);
|
|
11789
11789
|
const diffs = await Promise.all(
|
|
11790
|
-
paths.map((
|
|
11790
|
+
paths.map((path106) => untrackedFileDiff(cwd, path106))
|
|
11791
11791
|
);
|
|
11792
11792
|
return diffs.join("");
|
|
11793
11793
|
}
|
|
@@ -11880,9 +11880,9 @@ import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve10
|
|
|
11880
11880
|
function repoRoot(cwd) {
|
|
11881
11881
|
return resolve10(cwd);
|
|
11882
11882
|
}
|
|
11883
|
-
function resolveWithinCwd(cwd,
|
|
11883
|
+
function resolveWithinCwd(cwd, path106) {
|
|
11884
11884
|
const root2 = repoRoot(cwd);
|
|
11885
|
-
const target = resolve10(root2,
|
|
11885
|
+
const target = resolve10(root2, path106);
|
|
11886
11886
|
const rel = relative2(root2, target);
|
|
11887
11887
|
if (rel === "" || rel.startsWith("..") || isAbsolute2(rel)) return null;
|
|
11888
11888
|
return target;
|
|
@@ -11892,14 +11892,14 @@ function resolveWithinCwd(cwd, path105) {
|
|
|
11892
11892
|
function getFileTarget(req, res) {
|
|
11893
11893
|
const cwd = getCwdParam(req, res);
|
|
11894
11894
|
if (!cwd) return null;
|
|
11895
|
-
const
|
|
11895
|
+
const path106 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
|
|
11896
11896
|
"path"
|
|
11897
11897
|
);
|
|
11898
|
-
if (!
|
|
11898
|
+
if (!path106) {
|
|
11899
11899
|
respondJson(res, 400, { error: "Missing path" });
|
|
11900
11900
|
return null;
|
|
11901
11901
|
}
|
|
11902
|
-
const target = resolveWithinCwd(cwd,
|
|
11902
|
+
const target = resolveWithinCwd(cwd, path106);
|
|
11903
11903
|
if (!target) {
|
|
11904
11904
|
respondJson(res, 400, { error: "Path outside cwd" });
|
|
11905
11905
|
return null;
|
|
@@ -11958,9 +11958,9 @@ function segmentText(segment) {
|
|
|
11958
11958
|
if (segment.kind === "index") return `[${segment.index}]`;
|
|
11959
11959
|
return "[]";
|
|
11960
11960
|
}
|
|
11961
|
-
function formatConfigPath(
|
|
11961
|
+
function formatConfigPath(path106) {
|
|
11962
11962
|
let text18 = "";
|
|
11963
|
-
for (const segment of
|
|
11963
|
+
for (const segment of path106) {
|
|
11964
11964
|
const dotted = segment.kind === "key" || segment.kind === "entry";
|
|
11965
11965
|
const rendered = segmentText(segment);
|
|
11966
11966
|
text18 += dotted && text18 ? `.${rendered}` : rendered;
|
|
@@ -12121,11 +12121,11 @@ function enumValues(node) {
|
|
|
12121
12121
|
function opaqueConfigNode(inner, base) {
|
|
12122
12122
|
return { ...base, kind: "other", type: leafTypeOf(inner) };
|
|
12123
12123
|
}
|
|
12124
|
-
function build(node,
|
|
12124
|
+
function build(node, path106) {
|
|
12125
12125
|
const { inner, defaultValue, optional } = unwrapSchemaNode(node);
|
|
12126
12126
|
const secret = isSecretSchemaNode(node) || isSecretSchemaNode(inner);
|
|
12127
12127
|
const base = {
|
|
12128
|
-
path:
|
|
12128
|
+
path: path106,
|
|
12129
12129
|
...optional ? { optional: true } : {},
|
|
12130
12130
|
...defaultValue === void 0 ? {} : { defaultValue },
|
|
12131
12131
|
...secret ? { secret: true } : {}
|
|
@@ -12181,11 +12181,11 @@ function describeConfigLeaves(schema2) {
|
|
|
12181
12181
|
|
|
12182
12182
|
// src/commands/config/globalConfigFileLabel.ts
|
|
12183
12183
|
var WINDOWS_MOUNT_PREFIX = "/mnt/";
|
|
12184
|
-
function globalConfigFileLabel(
|
|
12185
|
-
if (
|
|
12186
|
-
if (
|
|
12187
|
-
return `${
|
|
12188
|
-
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;
|
|
12189
12189
|
}
|
|
12190
12190
|
|
|
12191
12191
|
// src/commands/config/readRawConfigLayers.ts
|
|
@@ -12242,35 +12242,35 @@ function isPlainRecord(value) {
|
|
|
12242
12242
|
}
|
|
12243
12243
|
|
|
12244
12244
|
// src/shared/mapConfigSecrets.ts
|
|
12245
|
-
function mapChildren(value,
|
|
12245
|
+
function mapChildren(value, path106, childNode, map) {
|
|
12246
12246
|
if (!isPlainRecord(value)) return value;
|
|
12247
12247
|
return Object.fromEntries(
|
|
12248
12248
|
Object.entries(value).map(([name, child]) => [
|
|
12249
12249
|
name,
|
|
12250
|
-
walk(child, [...
|
|
12250
|
+
walk(child, [...path106, name], childNode(name), map)
|
|
12251
12251
|
])
|
|
12252
12252
|
);
|
|
12253
12253
|
}
|
|
12254
|
-
function mapItems(value,
|
|
12254
|
+
function mapItems(value, path106, item, map) {
|
|
12255
12255
|
if (!Array.isArray(value)) return value;
|
|
12256
|
-
return value.map((entry, index3) => walk(entry, [...
|
|
12256
|
+
return value.map((entry, index3) => walk(entry, [...path106, index3], item, map));
|
|
12257
12257
|
}
|
|
12258
|
-
function walk(value,
|
|
12258
|
+
function walk(value, path106, node, map) {
|
|
12259
12259
|
if (!node || value === void 0 || value === null) return value;
|
|
12260
|
-
if (node.secret) return map(value,
|
|
12260
|
+
if (node.secret) return map(value, path106);
|
|
12261
12261
|
switch (node.kind) {
|
|
12262
12262
|
case "object":
|
|
12263
12263
|
case "unionOfObjects":
|
|
12264
12264
|
return mapChildren(
|
|
12265
12265
|
value,
|
|
12266
|
-
|
|
12266
|
+
path106,
|
|
12267
12267
|
(name) => configNodeField(node, name),
|
|
12268
12268
|
map
|
|
12269
12269
|
);
|
|
12270
12270
|
case "objectList":
|
|
12271
|
-
return mapItems(value,
|
|
12271
|
+
return mapItems(value, path106, node.item, map);
|
|
12272
12272
|
case "record":
|
|
12273
|
-
return mapChildren(value,
|
|
12273
|
+
return mapChildren(value, path106, () => node.value, map);
|
|
12274
12274
|
default:
|
|
12275
12275
|
return value;
|
|
12276
12276
|
}
|
|
@@ -12295,9 +12295,9 @@ function isTraversable(value) {
|
|
|
12295
12295
|
function stepInto(current, key) {
|
|
12296
12296
|
return isTraversable(current) ? current[key] : void 0;
|
|
12297
12297
|
}
|
|
12298
|
-
function getNestedValue(obj,
|
|
12298
|
+
function getNestedValue(obj, path106) {
|
|
12299
12299
|
let current = obj;
|
|
12300
|
-
for (const key of
|
|
12300
|
+
for (const key of path106.split(".")) current = stepInto(current, key);
|
|
12301
12301
|
return current;
|
|
12302
12302
|
}
|
|
12303
12303
|
|
|
@@ -12347,9 +12347,9 @@ function step(node, segment) {
|
|
|
12347
12347
|
return void 0;
|
|
12348
12348
|
}
|
|
12349
12349
|
}
|
|
12350
|
-
function findConfigNode(root2,
|
|
12350
|
+
function findConfigNode(root2, path106) {
|
|
12351
12351
|
let current = root2;
|
|
12352
|
-
for (const segment of
|
|
12352
|
+
for (const segment of path106) {
|
|
12353
12353
|
if (!current) return void 0;
|
|
12354
12354
|
current = step(current, segment);
|
|
12355
12355
|
}
|
|
@@ -12366,34 +12366,34 @@ function nameSegment(name) {
|
|
|
12366
12366
|
return name === RECORD_ENTRY_TOKEN ? { kind: "entry" } : { kind: "key", name };
|
|
12367
12367
|
}
|
|
12368
12368
|
function parseConfigPath(text18) {
|
|
12369
|
-
const
|
|
12369
|
+
const path106 = [];
|
|
12370
12370
|
let at2 = 0;
|
|
12371
12371
|
while (at2 < text18.length) {
|
|
12372
12372
|
if (text18[at2] === "[") {
|
|
12373
12373
|
const close = text18.indexOf("]", at2);
|
|
12374
12374
|
const segment = close === -1 ? void 0 : bracketSegment(text18.slice(at2 + 1, close));
|
|
12375
12375
|
if (!segment) return void 0;
|
|
12376
|
-
|
|
12376
|
+
path106.push(segment);
|
|
12377
12377
|
at2 = close + 1;
|
|
12378
12378
|
continue;
|
|
12379
12379
|
}
|
|
12380
12380
|
if (text18[at2] === ".") {
|
|
12381
|
-
if (
|
|
12381
|
+
if (path106.length === 0) return void 0;
|
|
12382
12382
|
at2 += 1;
|
|
12383
12383
|
}
|
|
12384
12384
|
const start3 = at2;
|
|
12385
12385
|
while (at2 < text18.length && text18[at2] !== "." && text18[at2] !== "[") at2 += 1;
|
|
12386
12386
|
const name = text18.slice(start3, at2);
|
|
12387
12387
|
if (!name) return void 0;
|
|
12388
|
-
|
|
12388
|
+
path106.push(nameSegment(name));
|
|
12389
12389
|
}
|
|
12390
|
-
return
|
|
12390
|
+
return path106;
|
|
12391
12391
|
}
|
|
12392
12392
|
|
|
12393
12393
|
// src/commands/config/configEntryNode.ts
|
|
12394
12394
|
function configEntryNode(root2, key) {
|
|
12395
|
-
const
|
|
12396
|
-
return
|
|
12395
|
+
const path106 = parseConfigPath(key);
|
|
12396
|
+
return path106 ? findConfigNode(root2, path106) : void 0;
|
|
12397
12397
|
}
|
|
12398
12398
|
|
|
12399
12399
|
// src/commands/backlog/harnessConfigHelp.ts
|
|
@@ -13137,7 +13137,7 @@ function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
|
13137
13137
|
const parent = dirname22(branchKeyPath);
|
|
13138
13138
|
const branchPrefix = basename10(branchKeyPath);
|
|
13139
13139
|
if (!existsSync34(parent)) return null;
|
|
13140
|
-
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);
|
|
13141
13141
|
return synthesisFiles[0]?.path ?? null;
|
|
13142
13142
|
}
|
|
13143
13143
|
|
|
@@ -13167,12 +13167,12 @@ async function getReviewSynthesis(req, res) {
|
|
|
13167
13167
|
const cwd = getCwdParam(req, res);
|
|
13168
13168
|
if (!cwd) return;
|
|
13169
13169
|
try {
|
|
13170
|
-
const
|
|
13171
|
-
if (!
|
|
13170
|
+
const path106 = await resolveSynthesisPath(cwd);
|
|
13171
|
+
if (!path106) {
|
|
13172
13172
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
13173
13173
|
return;
|
|
13174
13174
|
}
|
|
13175
|
-
respondJson(res, 200, { synthesis: readFileSync22(
|
|
13175
|
+
respondJson(res, 200, { synthesis: readFileSync22(path106, "utf8") });
|
|
13176
13176
|
} catch {
|
|
13177
13177
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
13178
13178
|
}
|
|
@@ -13255,8 +13255,8 @@ function parseDiffNameStatus(output) {
|
|
|
13255
13255
|
if (!status3 || fields.length < 2) continue;
|
|
13256
13256
|
const category = categorize(status3[0]);
|
|
13257
13257
|
if (!category) continue;
|
|
13258
|
-
const
|
|
13259
|
-
if (
|
|
13258
|
+
const path106 = fields[fields.length - 1];
|
|
13259
|
+
if (path106) result[category].push(path106);
|
|
13260
13260
|
}
|
|
13261
13261
|
return result;
|
|
13262
13262
|
}
|
|
@@ -13466,21 +13466,21 @@ function subsequenceScore(text18, query) {
|
|
|
13466
13466
|
}
|
|
13467
13467
|
return score - Math.min(text18.length, MAX_LENGTH_PENALTY);
|
|
13468
13468
|
}
|
|
13469
|
-
function scoreFilePath(
|
|
13469
|
+
function scoreFilePath(path106, query) {
|
|
13470
13470
|
const needle = query.trim().toLowerCase();
|
|
13471
13471
|
if (!needle) return 0;
|
|
13472
|
-
const basename31 =
|
|
13472
|
+
const basename31 = path106.slice(path106.lastIndexOf("/") + 1);
|
|
13473
13473
|
const inBasename = subsequenceScore(basename31, needle);
|
|
13474
13474
|
if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
|
|
13475
|
-
return subsequenceScore(
|
|
13475
|
+
return subsequenceScore(path106, needle);
|
|
13476
13476
|
}
|
|
13477
13477
|
|
|
13478
13478
|
// src/commands/sessions/web/rankFilePaths.ts
|
|
13479
13479
|
function rankFilePaths(paths, query, limit) {
|
|
13480
13480
|
const scored = [];
|
|
13481
|
-
for (const
|
|
13482
|
-
const score = scoreFilePath(
|
|
13483
|
-
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 });
|
|
13484
13484
|
}
|
|
13485
13485
|
scored.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
|
|
13486
13486
|
return scored.slice(0, limit).map((entry) => entry.path);
|
|
@@ -14190,11 +14190,11 @@ function logLinkedRequest(req, res) {
|
|
|
14190
14190
|
const started = Date.now();
|
|
14191
14191
|
const from = req.headers[LINKED_FROM_HEADER2];
|
|
14192
14192
|
const trace = req.headers[TRACE_HEADER] ?? "none";
|
|
14193
|
-
const
|
|
14193
|
+
const path106 = new URL(req.url ?? "/", "http://localhost").pathname;
|
|
14194
14194
|
res.once("finish", () => {
|
|
14195
|
-
if (isQuietPoll(
|
|
14195
|
+
if (isQuietPoll(path106, res.statusCode)) return;
|
|
14196
14196
|
console.log(
|
|
14197
|
-
`link-from ${from} http: ${req.method} ${
|
|
14197
|
+
`link-from ${from} http: ${req.method} ${path106} trace=${trace} -> ${res.statusCode} (${Date.now() - started}ms)`
|
|
14198
14198
|
);
|
|
14199
14199
|
});
|
|
14200
14200
|
}
|
|
@@ -14582,8 +14582,8 @@ async function liveDeployments(cwd, repo, environments) {
|
|
|
14582
14582
|
|
|
14583
14583
|
// src/commands/sessions/web/releases/latestRun.ts
|
|
14584
14584
|
async function latestRun(cwd, repo, workflow) {
|
|
14585
|
-
const
|
|
14586
|
-
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]);
|
|
14587
14587
|
const run4 = response.workflow_runs?.[0];
|
|
14588
14588
|
if (!run4) return null;
|
|
14589
14589
|
return {
|
|
@@ -14864,38 +14864,38 @@ async function performRestart(target, deps2 = {}) {
|
|
|
14864
14864
|
import { relative as relative3 } from "path";
|
|
14865
14865
|
|
|
14866
14866
|
// src/commands/sessions/web/revertPathChanges.ts
|
|
14867
|
-
async function isTracked(cwd,
|
|
14867
|
+
async function isTracked(cwd, path106) {
|
|
14868
14868
|
try {
|
|
14869
|
-
await execGit(cwd, ["ls-files", "--error-unmatch", "--",
|
|
14869
|
+
await execGit(cwd, ["ls-files", "--error-unmatch", "--", path106]);
|
|
14870
14870
|
return true;
|
|
14871
14871
|
} catch {
|
|
14872
14872
|
return false;
|
|
14873
14873
|
}
|
|
14874
14874
|
}
|
|
14875
|
-
async function isInHead(cwd,
|
|
14876
|
-
const listing = await execGit(cwd, ["ls-tree", "HEAD", "--",
|
|
14875
|
+
async function isInHead(cwd, path106) {
|
|
14876
|
+
const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path106]);
|
|
14877
14877
|
return listing.trim().length > 0;
|
|
14878
14878
|
}
|
|
14879
|
-
async function revertPathChanges(cwd,
|
|
14880
|
-
if (!await isTracked(cwd,
|
|
14881
|
-
await execGit(cwd, ["clean", "-f", "--",
|
|
14879
|
+
async function revertPathChanges(cwd, path106) {
|
|
14880
|
+
if (!await isTracked(cwd, path106)) {
|
|
14881
|
+
await execGit(cwd, ["clean", "-f", "--", path106]);
|
|
14882
14882
|
return;
|
|
14883
14883
|
}
|
|
14884
|
-
if (await isInHead(cwd,
|
|
14885
|
-
await execGit(cwd, ["checkout", "HEAD", "--",
|
|
14884
|
+
if (await isInHead(cwd, path106)) {
|
|
14885
|
+
await execGit(cwd, ["checkout", "HEAD", "--", path106]);
|
|
14886
14886
|
return;
|
|
14887
14887
|
}
|
|
14888
|
-
await execGit(cwd, ["rm", "-f", "--",
|
|
14888
|
+
await execGit(cwd, ["rm", "-f", "--", path106]);
|
|
14889
14889
|
}
|
|
14890
14890
|
|
|
14891
14891
|
// src/commands/sessions/web/revertDiffFile.ts
|
|
14892
14892
|
async function revertDiffFile(req, res) {
|
|
14893
14893
|
const resolved = getFileTarget(req, res);
|
|
14894
14894
|
if (!resolved) return;
|
|
14895
|
-
const
|
|
14895
|
+
const path106 = relative3(repoRoot(resolved.cwd), resolved.target);
|
|
14896
14896
|
try {
|
|
14897
|
-
await revertPathChanges(resolved.cwd,
|
|
14898
|
-
respondJson(res, 200, { reverted:
|
|
14897
|
+
await revertPathChanges(resolved.cwd, path106);
|
|
14898
|
+
respondJson(res, 200, { reverted: path106 });
|
|
14899
14899
|
} catch (error) {
|
|
14900
14900
|
respondJson(res, 500, {
|
|
14901
14901
|
error: error instanceof Error ? error.message : "Failed to revert file"
|
|
@@ -15000,7 +15000,7 @@ async function readJsonBody(req) {
|
|
|
15000
15000
|
function requestedPaths(body) {
|
|
15001
15001
|
const paths = body.paths;
|
|
15002
15002
|
if (!Array.isArray(paths)) return null;
|
|
15003
|
-
if (paths.some((
|
|
15003
|
+
if (paths.some((path106) => typeof path106 !== "string")) return null;
|
|
15004
15004
|
return paths;
|
|
15005
15005
|
}
|
|
15006
15006
|
async function revertDiffPaths(req, res) {
|
|
@@ -15020,10 +15020,10 @@ async function revertDiffPaths(req, res) {
|
|
|
15020
15020
|
const root2 = repoRoot(cwd);
|
|
15021
15021
|
const reverted = [];
|
|
15022
15022
|
const failed3 = [];
|
|
15023
|
-
for (const
|
|
15024
|
-
const target = resolveWithinCwd(cwd,
|
|
15023
|
+
for (const path106 of paths) {
|
|
15024
|
+
const target = resolveWithinCwd(cwd, path106);
|
|
15025
15025
|
if (!target) {
|
|
15026
|
-
failed3.push({ path:
|
|
15026
|
+
failed3.push({ path: path106, error: "Path outside cwd" });
|
|
15027
15027
|
continue;
|
|
15028
15028
|
}
|
|
15029
15029
|
const relativePath = relative4(root2, target);
|
|
@@ -15122,11 +15122,11 @@ function coerceStructuredConfigValue(key, raw) {
|
|
|
15122
15122
|
};
|
|
15123
15123
|
}
|
|
15124
15124
|
function formatIssue(key, issue) {
|
|
15125
|
-
const
|
|
15125
|
+
const path106 = formatConfigPath([
|
|
15126
15126
|
{ kind: "key", name: key },
|
|
15127
15127
|
...issue.path.map(toSegment)
|
|
15128
15128
|
]);
|
|
15129
|
-
return `${
|
|
15129
|
+
return `${path106}: ${issue.message}`;
|
|
15130
15130
|
}
|
|
15131
15131
|
function toSegment(part) {
|
|
15132
15132
|
return typeof part === "number" ? { kind: "index", index: part } : { kind: "key", name: String(part) };
|
|
@@ -15221,9 +15221,9 @@ function coerceUnion(key, raw, types) {
|
|
|
15221
15221
|
}
|
|
15222
15222
|
|
|
15223
15223
|
// src/shared/valueAtConfigPath.ts
|
|
15224
|
-
function valueAtConfigPath(value,
|
|
15224
|
+
function valueAtConfigPath(value, path106) {
|
|
15225
15225
|
let current = value;
|
|
15226
|
-
for (const key of
|
|
15226
|
+
for (const key of path106) {
|
|
15227
15227
|
if (typeof key === "number") {
|
|
15228
15228
|
if (!Array.isArray(current)) return void 0;
|
|
15229
15229
|
current = current[key];
|
|
@@ -15240,7 +15240,7 @@ function restoreConfigSecrets(value, stored, node) {
|
|
|
15240
15240
|
return mapConfigSecrets(
|
|
15241
15241
|
value,
|
|
15242
15242
|
node,
|
|
15243
|
-
(secret,
|
|
15243
|
+
(secret, path106) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path106) : secret
|
|
15244
15244
|
);
|
|
15245
15245
|
}
|
|
15246
15246
|
|
|
@@ -15289,8 +15289,8 @@ function stepIntoNested(container, key, nextKey) {
|
|
|
15289
15289
|
}
|
|
15290
15290
|
return ensureObject(container, resolved);
|
|
15291
15291
|
}
|
|
15292
|
-
function setNestedValue(obj,
|
|
15293
|
-
const keys =
|
|
15292
|
+
function setNestedValue(obj, path106, value) {
|
|
15293
|
+
const keys = path106.split(".");
|
|
15294
15294
|
const result = { ...obj };
|
|
15295
15295
|
let current = result;
|
|
15296
15296
|
for (let i = 0; i < keys.length - 1; i++) {
|
|
@@ -15317,8 +15317,8 @@ function formatIssue2(issue, key) {
|
|
|
15317
15317
|
return issue.keys.map(
|
|
15318
15318
|
(unrecognized) => `${[...issue.path, unrecognized].join(".")}: Unrecognized key`
|
|
15319
15319
|
);
|
|
15320
|
-
const
|
|
15321
|
-
return [`${
|
|
15320
|
+
const path106 = issue.path.length > 0 ? issue.path.join(".") : key;
|
|
15321
|
+
return [`${path106}: ${issue.message}`];
|
|
15322
15322
|
}
|
|
15323
15323
|
|
|
15324
15324
|
// src/commands/config/applyConfigSet.ts
|
|
@@ -15560,8 +15560,8 @@ function removeAt(container, keys) {
|
|
|
15560
15560
|
}
|
|
15561
15561
|
return removeFromChild(container, key, rest);
|
|
15562
15562
|
}
|
|
15563
|
-
function unsetNestedValue(obj,
|
|
15564
|
-
const { container, removed } = removeAt(obj,
|
|
15563
|
+
function unsetNestedValue(obj, path106) {
|
|
15564
|
+
const { container, removed } = removeAt(obj, path106.split("."));
|
|
15565
15565
|
return { config: container, removed };
|
|
15566
15566
|
}
|
|
15567
15567
|
|
|
@@ -17050,13 +17050,13 @@ function findBuiltinDenyRaw(rawCommand) {
|
|
|
17050
17050
|
|
|
17051
17051
|
// src/commands/cliHook/findRestrictedPathDeny.ts
|
|
17052
17052
|
var RESTRICTED_PATHS = [".assist/restricted"];
|
|
17053
|
-
function restrictedPathRegex(
|
|
17054
|
-
const pattern2 =
|
|
17053
|
+
function restrictedPathRegex(path106) {
|
|
17054
|
+
const pattern2 = path106.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
|
|
17055
17055
|
return new RegExp(pattern2);
|
|
17056
17056
|
}
|
|
17057
|
-
var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((
|
|
17058
|
-
path:
|
|
17059
|
-
regex: restrictedPathRegex(
|
|
17057
|
+
var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path106) => ({
|
|
17058
|
+
path: path106,
|
|
17059
|
+
regex: restrictedPathRegex(path106)
|
|
17060
17060
|
}));
|
|
17061
17061
|
function findRestrictedPathDenyRaw(rawCommand) {
|
|
17062
17062
|
const rule = RESTRICTED_PATH_RULES.find(
|
|
@@ -17233,9 +17233,9 @@ var __dirname4 = dirname25(__filename3);
|
|
|
17233
17233
|
function packageRoot() {
|
|
17234
17234
|
return __dirname4;
|
|
17235
17235
|
}
|
|
17236
|
-
function readLines(
|
|
17237
|
-
if (!existsSync40(
|
|
17238
|
-
return readFileSync25(
|
|
17236
|
+
function readLines(path106) {
|
|
17237
|
+
if (!existsSync40(path106)) return [];
|
|
17238
|
+
return readFileSync25(path106, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
17239
17239
|
}
|
|
17240
17240
|
var cachedReads;
|
|
17241
17241
|
var cachedWrites;
|
|
@@ -17767,14 +17767,14 @@ function showProgress(p, label2) {
|
|
|
17767
17767
|
const pct = Math.round(p.done / p.total * 100);
|
|
17768
17768
|
process.stderr.write(`\r\x1B[K[${pct}%] Scanning ${label2}...`);
|
|
17769
17769
|
}
|
|
17770
|
-
async function resolveCommand2(cli,
|
|
17771
|
-
showProgress(p,
|
|
17772
|
-
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]);
|
|
17773
17773
|
if (!subHelp || !hasSubcommands(subHelp)) {
|
|
17774
|
-
return [{ path:
|
|
17774
|
+
return [{ path: path106, description }];
|
|
17775
17775
|
}
|
|
17776
|
-
const children = await discoverAt(cli,
|
|
17777
|
-
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 }];
|
|
17778
17778
|
}
|
|
17779
17779
|
async function discoverAt(cli, parentPath, depth, p) {
|
|
17780
17780
|
if (depth > SAFETY_DEPTH) return [];
|
|
@@ -17922,9 +17922,9 @@ function logPath(cli) {
|
|
|
17922
17922
|
return join43(homedir17(), ".assist", `cli-discover-${safeName}.log`);
|
|
17923
17923
|
}
|
|
17924
17924
|
function readCache(cli) {
|
|
17925
|
-
const
|
|
17926
|
-
if (!existsSync42(
|
|
17927
|
-
return readFileSync27(
|
|
17925
|
+
const path106 = logPath(cli);
|
|
17926
|
+
if (!existsSync42(path106)) return void 0;
|
|
17927
|
+
return readFileSync27(path106, "utf8");
|
|
17928
17928
|
}
|
|
17929
17929
|
function writeCache(cli, output) {
|
|
17930
17930
|
const dir = join43(homedir17(), ".assist");
|
|
@@ -18113,9 +18113,9 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
18113
18113
|
}
|
|
18114
18114
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
18115
18115
|
for (const entry of entries) {
|
|
18116
|
-
const
|
|
18116
|
+
const path106 = join45(dir, entry);
|
|
18117
18117
|
try {
|
|
18118
|
-
if (statSync7(
|
|
18118
|
+
if (statSync7(path106).mtimeMs < cutoff) unlinkSync7(path106);
|
|
18119
18119
|
} catch {
|
|
18120
18120
|
continue;
|
|
18121
18121
|
}
|
|
@@ -18125,10 +18125,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
18125
18125
|
// src/commands/codeComment/readPinState.ts
|
|
18126
18126
|
import { existsSync as existsSync43, readFileSync as readFileSync28 } from "fs";
|
|
18127
18127
|
function readPinState(pin2) {
|
|
18128
|
-
const
|
|
18129
|
-
if (!existsSync43(
|
|
18128
|
+
const path106 = getPinStatePath(pin2);
|
|
18129
|
+
if (!existsSync43(path106)) return void 0;
|
|
18130
18130
|
try {
|
|
18131
|
-
const state = JSON.parse(readFileSync28(
|
|
18131
|
+
const state = JSON.parse(readFileSync28(path106, "utf8"));
|
|
18132
18132
|
if (state.pin !== pin2) return void 0;
|
|
18133
18133
|
return state;
|
|
18134
18134
|
} catch {
|
|
@@ -18549,8 +18549,8 @@ function findUnmergedPaths() {
|
|
|
18549
18549
|
}
|
|
18550
18550
|
const found = /* @__PURE__ */ new Set();
|
|
18551
18551
|
for (const line of output.split("\n")) {
|
|
18552
|
-
const
|
|
18553
|
-
if (
|
|
18552
|
+
const path106 = line.split(" ")[1];
|
|
18553
|
+
if (path106) found.add(path106.trim());
|
|
18554
18554
|
}
|
|
18555
18555
|
return [...found];
|
|
18556
18556
|
}
|
|
@@ -19797,11 +19797,11 @@ async function loadPath(source) {
|
|
|
19797
19797
|
}
|
|
19798
19798
|
}
|
|
19799
19799
|
async function criteriaExtension() {
|
|
19800
|
-
const
|
|
19800
|
+
const path106 = await loadPath(criteriaExtensionDir());
|
|
19801
19801
|
console.log(
|
|
19802
19802
|
chalk137.bold("acceptance criteria outliner \u2014 GitHub browser extension")
|
|
19803
19803
|
);
|
|
19804
|
-
console.log(chalk137.dim(`load the unpacked extension from ${
|
|
19804
|
+
console.log(chalk137.dim(`load the unpacked extension from ${path106}`));
|
|
19805
19805
|
}
|
|
19806
19806
|
|
|
19807
19807
|
// src/commands/criteriaExtension/signCriteriaExtension.ts
|
|
@@ -19926,10 +19926,10 @@ async function signCriteriaExtension() {
|
|
|
19926
19926
|
process.exitCode = 1;
|
|
19927
19927
|
return;
|
|
19928
19928
|
}
|
|
19929
|
-
const
|
|
19929
|
+
const path106 = await signedAddonInstallPath(
|
|
19930
19930
|
await copySignedXpi(xpi, ARTIFACTS_DIR)
|
|
19931
19931
|
);
|
|
19932
|
-
console.log(chalk139.dim(`install the signed add-on from ${
|
|
19932
|
+
console.log(chalk139.dim(`install the signed add-on from ${path106}`));
|
|
19933
19933
|
}
|
|
19934
19934
|
|
|
19935
19935
|
// src/commands/registerCriteriaExtension.ts
|
|
@@ -20027,10 +20027,10 @@ function getMigrationApprovalPath(migrationId) {
|
|
|
20027
20027
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
20028
20028
|
import { existsSync as existsSync48, readFileSync as readFileSync30 } from "fs";
|
|
20029
20029
|
function readMigrationPinState(pin2) {
|
|
20030
|
-
const
|
|
20031
|
-
if (!existsSync48(
|
|
20030
|
+
const path106 = getMigrationPinPath(pin2);
|
|
20031
|
+
if (!existsSync48(path106)) return void 0;
|
|
20032
20032
|
try {
|
|
20033
|
-
const state = JSON.parse(readFileSync30(
|
|
20033
|
+
const state = JSON.parse(readFileSync30(path106, "utf8"));
|
|
20034
20034
|
if (state.pin !== pin2) return void 0;
|
|
20035
20035
|
if (!Number.isInteger(state.migrationId)) return void 0;
|
|
20036
20036
|
return state;
|
|
@@ -21940,10 +21940,10 @@ function decideCommentGuard(input, existingContent) {
|
|
|
21940
21940
|
import { existsSync as existsSync54, unlinkSync as unlinkSync11 } from "fs";
|
|
21941
21941
|
function consumeMigrationApproval(migrationId) {
|
|
21942
21942
|
sweepRestrictedDir();
|
|
21943
|
-
const
|
|
21944
|
-
if (!existsSync54(
|
|
21943
|
+
const path106 = getMigrationApprovalPath(migrationId);
|
|
21944
|
+
if (!existsSync54(path106)) return false;
|
|
21945
21945
|
try {
|
|
21946
|
-
unlinkSync11(
|
|
21946
|
+
unlinkSync11(path106);
|
|
21947
21947
|
return true;
|
|
21948
21948
|
} catch {
|
|
21949
21949
|
return false;
|
|
@@ -24347,11 +24347,11 @@ function recentDaemonLogLines(includeRelayed = true) {
|
|
|
24347
24347
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
24348
24348
|
import { realpathSync as realpathSync2 } from "fs";
|
|
24349
24349
|
import { resolve as resolve15 } from "path";
|
|
24350
|
-
function canonicalTreePath(
|
|
24350
|
+
function canonicalTreePath(path106) {
|
|
24351
24351
|
try {
|
|
24352
|
-
return realpathSync2(
|
|
24352
|
+
return realpathSync2(path106);
|
|
24353
24353
|
} catch {
|
|
24354
|
-
return resolve15(
|
|
24354
|
+
return resolve15(path106);
|
|
24355
24355
|
}
|
|
24356
24356
|
}
|
|
24357
24357
|
|
|
@@ -24404,22 +24404,22 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
24404
24404
|
const registered = new Set(listWorktreePaths(clone));
|
|
24405
24405
|
const branches = new Set(listLocalBranches(clone));
|
|
24406
24406
|
const isTaken = (candidate) => registered.has(candidate) || existsSync57(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename17(candidate));
|
|
24407
|
-
const
|
|
24407
|
+
const path106 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
24408
24408
|
const start3 = worktreeStartPoint(clone, strategy.trunk);
|
|
24409
24409
|
gitSync(clone, [
|
|
24410
24410
|
"worktree",
|
|
24411
24411
|
"add",
|
|
24412
24412
|
start3.track ? "--track" : "--no-track",
|
|
24413
24413
|
"-b",
|
|
24414
|
-
basename17(
|
|
24415
|
-
|
|
24414
|
+
basename17(path106),
|
|
24415
|
+
path106,
|
|
24416
24416
|
start3.ref
|
|
24417
24417
|
]);
|
|
24418
|
-
recordWorktree(
|
|
24418
|
+
recordWorktree(path106, clone, getCurrentOrigin(clone));
|
|
24419
24419
|
daemonLog(
|
|
24420
|
-
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}`
|
|
24421
24421
|
);
|
|
24422
|
-
return
|
|
24422
|
+
return path106;
|
|
24423
24423
|
}
|
|
24424
24424
|
|
|
24425
24425
|
// src/commands/sessions/daemon/worktree/keptInTree.ts
|
|
@@ -24560,13 +24560,13 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
|
|
|
24560
24560
|
if (forcedSpill) daemonLog(forcedSpill);
|
|
24561
24561
|
else if (reusesClone(clone, boundTreeRoots2, reuse))
|
|
24562
24562
|
return { cwd: clone, kind: "primary", created: false, clone };
|
|
24563
|
-
const
|
|
24563
|
+
const path106 = createWorktree(
|
|
24564
24564
|
clone,
|
|
24565
24565
|
{ root: cfg.root, trunk: cfg.trunk },
|
|
24566
24566
|
boundTreeRoots2,
|
|
24567
24567
|
options2.replacesTree
|
|
24568
24568
|
);
|
|
24569
|
-
return { cwd:
|
|
24569
|
+
return { cwd: path106, kind: "worktree", created: true, clone };
|
|
24570
24570
|
}
|
|
24571
24571
|
|
|
24572
24572
|
// src/commands/sessions/daemon/describePersistedSession.ts
|
|
@@ -24916,13 +24916,13 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
24916
24916
|
const listing = gitSyncOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
24917
24917
|
if (!listing) return null;
|
|
24918
24918
|
const here = gitSyncOrNull(cwd, ["rev-parse", "--show-toplevel"]);
|
|
24919
|
-
let
|
|
24919
|
+
let path106 = null;
|
|
24920
24920
|
for (const line of listing.split("\n")) {
|
|
24921
24921
|
const trimmed = line.trim();
|
|
24922
24922
|
if (trimmed.startsWith("worktree "))
|
|
24923
|
-
|
|
24923
|
+
path106 = trimmed.slice("worktree ".length).trim();
|
|
24924
24924
|
else if (trimmed === `branch refs/heads/${branch2}`)
|
|
24925
|
-
return
|
|
24925
|
+
return path106 && path106 !== here ? path106 : null;
|
|
24926
24926
|
}
|
|
24927
24927
|
return null;
|
|
24928
24928
|
}
|
|
@@ -26026,9 +26026,9 @@ function parseRscRows(flight) {
|
|
|
26026
26026
|
}
|
|
26027
26027
|
function makeRscResolver(rows) {
|
|
26028
26028
|
return (ref) => {
|
|
26029
|
-
const [id, ...
|
|
26029
|
+
const [id, ...path106] = ref.slice(1).replace(/^[L@]/, "").split(":");
|
|
26030
26030
|
let v = rows[id];
|
|
26031
|
-
for (const key of
|
|
26031
|
+
for (const key of path106) {
|
|
26032
26032
|
if (v == null || typeof v !== "object") return void 0;
|
|
26033
26033
|
v = v[key];
|
|
26034
26034
|
}
|
|
@@ -26779,18 +26779,18 @@ function validateLine(line) {
|
|
|
26779
26779
|
process.exit(1);
|
|
26780
26780
|
}
|
|
26781
26781
|
}
|
|
26782
|
-
async function comment2(
|
|
26782
|
+
async function comment2(path106, line, body, options2 = {}) {
|
|
26783
26783
|
const { startLine, skipPreview } = options2;
|
|
26784
26784
|
validateBody(body);
|
|
26785
26785
|
validateLine(line);
|
|
26786
26786
|
if (startLine !== void 0) validateLine(startLine);
|
|
26787
26787
|
const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
|
|
26788
26788
|
if (!skipPreview)
|
|
26789
|
-
await reviewProposedPrComment(`Comment on ${
|
|
26789
|
+
await reviewProposedPrComment(`Comment on ${path106}:${range}`, body, null);
|
|
26790
26790
|
try {
|
|
26791
26791
|
const prId = getCurrentPrNodeId();
|
|
26792
|
-
postReviewComment({ prId, body, path:
|
|
26793
|
-
console.log(`Added review comment on ${
|
|
26792
|
+
postReviewComment({ prId, body, path: path106, line, startLine });
|
|
26793
|
+
console.log(`Added review comment on ${path106}:${range}`);
|
|
26794
26794
|
} catch (error) {
|
|
26795
26795
|
if (isGhNotInstalled(error)) {
|
|
26796
26796
|
console.error("Error: GitHub CLI (gh) is not installed.");
|
|
@@ -27359,9 +27359,9 @@ function registerPrsComments(prsCommand) {
|
|
|
27359
27359
|
});
|
|
27360
27360
|
prsCommand.command("comment <path> <line> <body>").description(
|
|
27361
27361
|
"Add a line comment to the pending review (body of - reads it from stdin)"
|
|
27362
|
-
).action(async (
|
|
27362
|
+
).action(async (path106, line, body) => {
|
|
27363
27363
|
await comment2(
|
|
27364
|
-
|
|
27364
|
+
path106,
|
|
27365
27365
|
Number.parseInt(line, 10),
|
|
27366
27366
|
await readBodyArgument(body)
|
|
27367
27367
|
);
|
|
@@ -28582,11 +28582,11 @@ async function loadBody(target) {
|
|
|
28582
28582
|
if (target.kind === "file") return readDraftFile(target.path);
|
|
28583
28583
|
return fetchPrBody(target.number, target.repo);
|
|
28584
28584
|
}
|
|
28585
|
-
function readDraftFile(
|
|
28585
|
+
function readDraftFile(path106) {
|
|
28586
28586
|
try {
|
|
28587
|
-
return readFileSync44(
|
|
28587
|
+
return readFileSync44(path106, "utf8");
|
|
28588
28588
|
} catch {
|
|
28589
|
-
console.error(`Error: Could not read \`${
|
|
28589
|
+
console.error(`Error: Could not read \`${path106}\`.`);
|
|
28590
28590
|
console.error(
|
|
28591
28591
|
"Pass a pull request number, a GitHub pull request URL, - for stdin, or a path to a file."
|
|
28592
28592
|
);
|
|
@@ -28866,10 +28866,10 @@ function resolveOpSecret(reference) {
|
|
|
28866
28866
|
}
|
|
28867
28867
|
|
|
28868
28868
|
// src/commands/ravendb/ravenFetch.ts
|
|
28869
|
-
async function ravenFetch(connection,
|
|
28869
|
+
async function ravenFetch(connection, path106) {
|
|
28870
28870
|
const apiKey = resolveOpSecret(connection.apiKeyRef);
|
|
28871
28871
|
let accessToken = await getAccessToken(apiKey);
|
|
28872
|
-
const url = `${connection.url}${
|
|
28872
|
+
const url = `${connection.url}${path106}`;
|
|
28873
28873
|
const headers = {
|
|
28874
28874
|
Authorization: `Bearer ${accessToken}`,
|
|
28875
28875
|
"Content-Type": "application/json"
|
|
@@ -28959,16 +28959,16 @@ import chalk195 from "chalk";
|
|
|
28959
28959
|
// src/commands/ravendb/buildQueryPath.ts
|
|
28960
28960
|
function buildQueryPath(opts) {
|
|
28961
28961
|
const db = encodeURIComponent(opts.db);
|
|
28962
|
-
let
|
|
28962
|
+
let path106;
|
|
28963
28963
|
if (opts.collection) {
|
|
28964
|
-
|
|
28964
|
+
path106 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
|
|
28965
28965
|
} else {
|
|
28966
|
-
|
|
28966
|
+
path106 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
|
|
28967
28967
|
}
|
|
28968
28968
|
if (opts.query) {
|
|
28969
|
-
|
|
28969
|
+
path106 += `&query=${encodeURIComponent(opts.query)}`;
|
|
28970
28970
|
}
|
|
28971
|
-
return
|
|
28971
|
+
return path106;
|
|
28972
28972
|
}
|
|
28973
28973
|
|
|
28974
28974
|
// src/commands/ravendb/fetchAllPages.ts
|
|
@@ -28977,7 +28977,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
28977
28977
|
let start3 = 0;
|
|
28978
28978
|
while (true) {
|
|
28979
28979
|
const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
|
|
28980
|
-
const
|
|
28980
|
+
const path106 = buildQueryPath({
|
|
28981
28981
|
db: connection.database,
|
|
28982
28982
|
collection: opts.collection,
|
|
28983
28983
|
start: start3,
|
|
@@ -28985,7 +28985,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
28985
28985
|
sort: opts.sort,
|
|
28986
28986
|
query: opts.query
|
|
28987
28987
|
});
|
|
28988
|
-
const data = await ravenFetch(connection,
|
|
28988
|
+
const data = await ravenFetch(connection, path106);
|
|
28989
28989
|
const results = data.Results ?? [];
|
|
28990
28990
|
const totalResults = data.TotalResults ?? 0;
|
|
28991
28991
|
if (results.length === 0) break;
|
|
@@ -31499,7 +31499,7 @@ Renamed ${oldName} \u2192 ${newName}`));
|
|
|
31499
31499
|
|
|
31500
31500
|
// src/commands/refactor/restructure.ts
|
|
31501
31501
|
import fs38 from "fs";
|
|
31502
|
-
import
|
|
31502
|
+
import path80 from "path";
|
|
31503
31503
|
import chalk221 from "chalk";
|
|
31504
31504
|
|
|
31505
31505
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
@@ -31879,6 +31879,7 @@ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
|
|
|
31879
31879
|
}
|
|
31880
31880
|
|
|
31881
31881
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
31882
|
+
import path74 from "path";
|
|
31882
31883
|
import chalk219 from "chalk";
|
|
31883
31884
|
|
|
31884
31885
|
// src/commands/refactor/restructure/displayDeepChains.ts
|
|
@@ -31932,26 +31933,47 @@ function displayDrift(plan2) {
|
|
|
31932
31933
|
}
|
|
31933
31934
|
|
|
31934
31935
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
31936
|
+
function applyCommand(plan2) {
|
|
31937
|
+
const root2 = path74.relative(process.cwd(), plan2.scopeRoot) || ".";
|
|
31938
|
+
return `assist refactor restructure ${root2} --apply`;
|
|
31939
|
+
}
|
|
31935
31940
|
function checkPlan(plan2, chains, maxDepth) {
|
|
31936
31941
|
displayDrift(plan2);
|
|
31937
31942
|
displayDeepChains(chains, maxDepth);
|
|
31938
|
-
if (
|
|
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
|
+
);
|
|
31939
31960
|
process.exit(1);
|
|
31961
|
+
}
|
|
31940
31962
|
console.log(chalk219.green("Layout matches the restructure plan"));
|
|
31941
31963
|
}
|
|
31942
31964
|
|
|
31943
31965
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
31944
|
-
import
|
|
31966
|
+
import path77 from "path";
|
|
31945
31967
|
import chalk220 from "chalk";
|
|
31946
31968
|
|
|
31947
31969
|
// src/commands/refactor/restructure/computeDepthStats.ts
|
|
31948
|
-
import
|
|
31970
|
+
import path75 from "path";
|
|
31949
31971
|
function computeDepthStats(targets, scopeRoot) {
|
|
31950
31972
|
const distribution = /* @__PURE__ */ new Map();
|
|
31951
31973
|
let max = 0;
|
|
31952
31974
|
for (const target of targets) {
|
|
31953
|
-
const dir =
|
|
31954
|
-
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;
|
|
31955
31977
|
distribution.set(depth, (distribution.get(depth) ?? 0) + 1);
|
|
31956
31978
|
max = Math.max(max, depth);
|
|
31957
31979
|
}
|
|
@@ -31959,7 +31981,7 @@ function computeDepthStats(targets, scopeRoot) {
|
|
|
31959
31981
|
}
|
|
31960
31982
|
|
|
31961
31983
|
// src/commands/refactor/restructure/formatTree.ts
|
|
31962
|
-
import
|
|
31984
|
+
import path76 from "path";
|
|
31963
31985
|
function insert(root2, parts) {
|
|
31964
31986
|
let node = root2;
|
|
31965
31987
|
for (const part of parts) {
|
|
@@ -31981,7 +32003,7 @@ function render(node, indent3, lines2) {
|
|
|
31981
32003
|
function formatTree(files, scopeRoot) {
|
|
31982
32004
|
const root2 = /* @__PURE__ */ new Map();
|
|
31983
32005
|
for (const file of files)
|
|
31984
|
-
insert(root2,
|
|
32006
|
+
insert(root2, path76.relative(scopeRoot, file).split(path76.sep));
|
|
31985
32007
|
const lines2 = [];
|
|
31986
32008
|
render(root2, "", lines2);
|
|
31987
32009
|
return lines2;
|
|
@@ -31989,7 +32011,7 @@ function formatTree(files, scopeRoot) {
|
|
|
31989
32011
|
|
|
31990
32012
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
31991
32013
|
function relPath2(filePath) {
|
|
31992
|
-
return
|
|
32014
|
+
return path77.relative(process.cwd(), filePath);
|
|
31993
32015
|
}
|
|
31994
32016
|
function displayMoves(plan2) {
|
|
31995
32017
|
if (plan2.moves.length === 0) return;
|
|
@@ -32039,10 +32061,10 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
32039
32061
|
}
|
|
32040
32062
|
|
|
32041
32063
|
// src/commands/refactor/restructure/findDeepChains.ts
|
|
32042
|
-
import
|
|
32064
|
+
import path78 from "path";
|
|
32043
32065
|
function dirSegments(target, scopeRoot) {
|
|
32044
|
-
const dir =
|
|
32045
|
-
return dir === "" ? [] : dir.split(
|
|
32066
|
+
const dir = path78.relative(scopeRoot, path78.dirname(target));
|
|
32067
|
+
return dir === "" ? [] : dir.split(path78.sep);
|
|
32046
32068
|
}
|
|
32047
32069
|
function countSubtrees(segmentLists) {
|
|
32048
32070
|
const counts2 = /* @__PURE__ */ new Map();
|
|
@@ -32077,11 +32099,11 @@ function findDeepChains(targets, scopeRoot, maxDepth) {
|
|
|
32077
32099
|
}
|
|
32078
32100
|
|
|
32079
32101
|
// src/commands/refactor/restructure/partitionIgnored.ts
|
|
32080
|
-
import
|
|
32102
|
+
import path79 from "path";
|
|
32081
32103
|
import { minimatch as minimatch4 } from "minimatch";
|
|
32082
32104
|
function partitionIgnored(files) {
|
|
32083
32105
|
const globs = loadConfig().restructure?.ignore ?? [];
|
|
32084
|
-
const isIgnored = (file) => globs.some((glob) => minimatch4(
|
|
32106
|
+
const isIgnored = (file) => globs.some((glob) => minimatch4(path79.relative(process.cwd(), file), glob));
|
|
32085
32107
|
return {
|
|
32086
32108
|
scoped: files.filter((f) => !isIgnored(f)),
|
|
32087
32109
|
ignored: files.filter(isIgnored)
|
|
@@ -32090,7 +32112,7 @@ function partitionIgnored(files) {
|
|
|
32090
32112
|
|
|
32091
32113
|
// src/commands/refactor/restructure.ts
|
|
32092
32114
|
async function restructure(root2, options2 = {}) {
|
|
32093
|
-
const scopeRoot =
|
|
32115
|
+
const scopeRoot = path80.resolve(root2 ?? "src");
|
|
32094
32116
|
if (!fs38.existsSync(scopeRoot) || !fs38.statSync(scopeRoot).isDirectory()) {
|
|
32095
32117
|
console.log(chalk221.red(`Not a directory: ${root2 ?? "src"}`));
|
|
32096
32118
|
process.exit(1);
|
|
@@ -32491,8 +32513,8 @@ function groupFilesByDirectory(files) {
|
|
|
32491
32513
|
}
|
|
32492
32514
|
|
|
32493
32515
|
// src/commands/review/highLevel/buildHighLevelTree.ts
|
|
32494
|
-
function basename19(
|
|
32495
|
-
return
|
|
32516
|
+
function basename19(path106) {
|
|
32517
|
+
return path106.slice(path106.lastIndexOf("/") + 1);
|
|
32496
32518
|
}
|
|
32497
32519
|
function sum(nodes, key) {
|
|
32498
32520
|
return nodes.reduce((total, node) => total + node[key], 0);
|
|
@@ -32515,19 +32537,19 @@ function nodesOf(at2, prefix2) {
|
|
|
32515
32537
|
}
|
|
32516
32538
|
function collapsedDirNode(name, at2, prefix2) {
|
|
32517
32539
|
let label2 = name;
|
|
32518
|
-
let
|
|
32540
|
+
let path106 = prefix2 ? `${prefix2}/${name}` : name;
|
|
32519
32541
|
let node = at2;
|
|
32520
32542
|
while (node.files.length === 0 && node.dirs.size === 1) {
|
|
32521
32543
|
const [childName, child] = [...node.dirs][0];
|
|
32522
32544
|
label2 = `${label2}/${childName}`;
|
|
32523
|
-
|
|
32545
|
+
path106 = `${path106}/${childName}`;
|
|
32524
32546
|
node = child;
|
|
32525
32547
|
}
|
|
32526
|
-
const children = nodesOf(node,
|
|
32548
|
+
const children = nodesOf(node, path106);
|
|
32527
32549
|
return {
|
|
32528
32550
|
kind: "dir",
|
|
32529
32551
|
name: label2,
|
|
32530
|
-
path:
|
|
32552
|
+
path: path106,
|
|
32531
32553
|
additions: sum(children, "additions"),
|
|
32532
32554
|
deletions: sum(children, "deletions"),
|
|
32533
32555
|
children
|
|
@@ -32785,8 +32807,8 @@ function toStatus(status3) {
|
|
|
32785
32807
|
if (status3 === "removed") return "removed";
|
|
32786
32808
|
return "modified";
|
|
32787
32809
|
}
|
|
32788
|
-
function diffUrl(repo, prNumber,
|
|
32789
|
-
const anchor = createHash3("sha256").update(
|
|
32810
|
+
function diffUrl(repo, prNumber, path106) {
|
|
32811
|
+
const anchor = createHash3("sha256").update(path106).digest("hex");
|
|
32790
32812
|
return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
|
|
32791
32813
|
}
|
|
32792
32814
|
function fetchHighLevelFiles(prNumber, repo) {
|
|
@@ -32842,10 +32864,10 @@ function highLevelReviewPath(repo, headRef, headSha) {
|
|
|
32842
32864
|
|
|
32843
32865
|
// src/commands/review/highLevel/loadHighLevelReview.ts
|
|
32844
32866
|
function loadHighLevelReview(repo, headRef, headSha) {
|
|
32845
|
-
const
|
|
32846
|
-
if (!existsSync64(
|
|
32867
|
+
const path106 = highLevelReviewPath(repo, headRef, headSha);
|
|
32868
|
+
if (!existsSync64(path106)) return void 0;
|
|
32847
32869
|
try {
|
|
32848
|
-
return JSON.parse(readFileSync47(
|
|
32870
|
+
return JSON.parse(readFileSync47(path106, "utf8"));
|
|
32849
32871
|
} catch {
|
|
32850
32872
|
return void 0;
|
|
32851
32873
|
}
|
|
@@ -32856,8 +32878,8 @@ import { minimatch as minimatch7 } from "minimatch";
|
|
|
32856
32878
|
function selectCriticalDiffs(files, criticalPaths) {
|
|
32857
32879
|
if (criticalPaths.length === 0) return [];
|
|
32858
32880
|
return files.filter((file) => criticalPaths.some((glob) => minimatch7(file.path, glob))).map(
|
|
32859
|
-
({ path:
|
|
32860
|
-
path:
|
|
32881
|
+
({ path: path106, status: status3, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
|
|
32882
|
+
path: path106,
|
|
32861
32883
|
status: status3,
|
|
32862
32884
|
additions,
|
|
32863
32885
|
deletions,
|
|
@@ -32972,11 +32994,11 @@ function highLevelPreviewPayload(subject) {
|
|
|
32972
32994
|
import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync39 } from "fs";
|
|
32973
32995
|
import { dirname as dirname36 } from "path";
|
|
32974
32996
|
function saveHighLevelReview(record) {
|
|
32975
|
-
const
|
|
32976
|
-
mkdirSync22(dirname36(
|
|
32977
|
-
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)}
|
|
32978
33000
|
`);
|
|
32979
|
-
return
|
|
33001
|
+
return path106;
|
|
32980
33002
|
}
|
|
32981
33003
|
|
|
32982
33004
|
// src/commands/review/highLevel/openHighLevelOverlay.ts
|
|
@@ -32995,9 +33017,9 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
32995
33017
|
{ rejectIsOutcome: true }
|
|
32996
33018
|
);
|
|
32997
33019
|
const record = buildHighLevelRecord(subject, decision);
|
|
32998
|
-
const
|
|
33020
|
+
const path106 = saveHighLevelReview(record);
|
|
32999
33021
|
console.log(`Verdict: ${record.verdict}`);
|
|
33000
|
-
console.log(`Saved ${
|
|
33022
|
+
console.log(`Saved ${path106}`);
|
|
33001
33023
|
console.log("Nothing was posted to GitHub.");
|
|
33002
33024
|
return record;
|
|
33003
33025
|
}
|
|
@@ -34012,8 +34034,8 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
34012
34034
|
// src/commands/review/prepareReviewDir.ts
|
|
34013
34035
|
import { existsSync as existsSync65, mkdirSync as mkdirSync23, unlinkSync as unlinkSync18, writeFileSync as writeFileSync40 } from "fs";
|
|
34014
34036
|
function clearReviewFiles(paths) {
|
|
34015
|
-
for (const
|
|
34016
|
-
if (existsSync65(
|
|
34037
|
+
for (const path106 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
34038
|
+
if (existsSync65(path106)) unlinkSync18(path106);
|
|
34017
34039
|
}
|
|
34018
34040
|
}
|
|
34019
34041
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -35251,7 +35273,7 @@ function registerReview(program2) {
|
|
|
35251
35273
|
|
|
35252
35274
|
// src/commands/rules/addRule.ts
|
|
35253
35275
|
import { existsSync as existsSync70, readFileSync as readFileSync53, writeFileSync as writeFileSync43 } from "fs";
|
|
35254
|
-
import
|
|
35276
|
+
import path85 from "path";
|
|
35255
35277
|
import chalk233 from "chalk";
|
|
35256
35278
|
|
|
35257
35279
|
// src/commands/rules/insertRuleBullet.ts
|
|
@@ -35279,7 +35301,7 @@ import { readFileSync as readFileSync50 } from "fs";
|
|
|
35279
35301
|
|
|
35280
35302
|
// src/commands/rules/findClaudeFiles.ts
|
|
35281
35303
|
import { readdirSync as readdirSync13 } from "fs";
|
|
35282
|
-
import
|
|
35304
|
+
import path81 from "path";
|
|
35283
35305
|
var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
|
|
35284
35306
|
function findClaudeFiles(dir) {
|
|
35285
35307
|
const results = [];
|
|
@@ -35287,9 +35309,9 @@ function findClaudeFiles(dir) {
|
|
|
35287
35309
|
if (entry.isDirectory()) {
|
|
35288
35310
|
if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
|
|
35289
35311
|
continue;
|
|
35290
|
-
results.push(...findClaudeFiles(
|
|
35312
|
+
results.push(...findClaudeFiles(path81.join(dir, entry.name)));
|
|
35291
35313
|
} else if (entry.name === "CLAUDE.md") {
|
|
35292
|
-
results.push(
|
|
35314
|
+
results.push(path81.join(dir, entry.name));
|
|
35293
35315
|
}
|
|
35294
35316
|
}
|
|
35295
35317
|
return results;
|
|
@@ -35308,34 +35330,34 @@ function nextRuleCode(root2) {
|
|
|
35308
35330
|
|
|
35309
35331
|
// src/commands/rules/resolveRuleScope.ts
|
|
35310
35332
|
import { existsSync as existsSync68 } from "fs";
|
|
35311
|
-
import
|
|
35333
|
+
import path82 from "path";
|
|
35312
35334
|
function resolveRuleScope(target) {
|
|
35313
|
-
const resolved =
|
|
35314
|
-
if (
|
|
35335
|
+
const resolved = path82.resolve(target);
|
|
35336
|
+
if (path82.basename(resolved) === "CLAUDE.md") return resolved;
|
|
35315
35337
|
const startDir = scopeDirectory(resolved);
|
|
35316
35338
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
35317
35339
|
let current = startDir;
|
|
35318
35340
|
while (true) {
|
|
35319
|
-
const candidate =
|
|
35341
|
+
const candidate = path82.join(current, "CLAUDE.md");
|
|
35320
35342
|
if (existsSync68(candidate)) return candidate;
|
|
35321
|
-
if (current === root2 || current ===
|
|
35322
|
-
current =
|
|
35343
|
+
if (current === root2 || current === path82.dirname(current)) break;
|
|
35344
|
+
current = path82.dirname(current);
|
|
35323
35345
|
}
|
|
35324
|
-
return
|
|
35346
|
+
return path82.join(root2, "CLAUDE.md");
|
|
35325
35347
|
}
|
|
35326
35348
|
|
|
35327
35349
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
35328
35350
|
import { existsSync as existsSync69, readFileSync as readFileSync52, writeFileSync as writeFileSync42 } from "fs";
|
|
35329
|
-
import
|
|
35351
|
+
import path84 from "path";
|
|
35330
35352
|
|
|
35331
35353
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
35332
35354
|
import { readFileSync as readFileSync51 } from "fs";
|
|
35333
|
-
import
|
|
35355
|
+
import path83 from "path";
|
|
35334
35356
|
function scopedRuleDirectories(root2) {
|
|
35335
35357
|
return findClaudeFiles(root2).filter(
|
|
35336
|
-
(file) =>
|
|
35358
|
+
(file) => path83.dirname(file) !== root2 && parseRulesSection(readFileSync51(file, "utf8")).length > 0
|
|
35337
35359
|
).map(
|
|
35338
|
-
(file) => `${
|
|
35360
|
+
(file) => `${path83.relative(root2, path83.dirname(file)).split(path83.sep).join("/")}/`
|
|
35339
35361
|
).sort();
|
|
35340
35362
|
}
|
|
35341
35363
|
|
|
@@ -35374,7 +35396,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
35374
35396
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
35375
35397
|
function updateScopedRulesIndex(root2) {
|
|
35376
35398
|
const directories = scopedRuleDirectories(root2);
|
|
35377
|
-
const rootFile =
|
|
35399
|
+
const rootFile = path84.join(root2, "CLAUDE.md");
|
|
35378
35400
|
const before = existsSync69(rootFile) ? readFileSync52(rootFile, "utf8") : "";
|
|
35379
35401
|
const after = upsertScopedRulesPointer(before, directories);
|
|
35380
35402
|
if (after !== before) writeFileSync42(rootFile, after);
|
|
@@ -35393,7 +35415,7 @@ function addRule(text18, options2) {
|
|
|
35393
35415
|
return;
|
|
35394
35416
|
}
|
|
35395
35417
|
const target = resolveRuleScope(options2.scope ?? process.cwd());
|
|
35396
|
-
const targetDir =
|
|
35418
|
+
const targetDir = path85.dirname(target);
|
|
35397
35419
|
const root2 = findRepoRoot(targetDir) ?? targetDir;
|
|
35398
35420
|
const code = nextRuleCode(root2);
|
|
35399
35421
|
writeFileSync43(
|
|
@@ -35406,18 +35428,18 @@ function addRule(text18, options2) {
|
|
|
35406
35428
|
);
|
|
35407
35429
|
updateScopedRulesIndex(root2);
|
|
35408
35430
|
console.log(
|
|
35409
|
-
`Added ${chalk233.cyan(code)} to ${
|
|
35431
|
+
`Added ${chalk233.cyan(code)} to ${path85.relative(process.cwd(), target) || target}`
|
|
35410
35432
|
);
|
|
35411
35433
|
}
|
|
35412
35434
|
|
|
35413
35435
|
// src/commands/rules/indexRules.ts
|
|
35414
|
-
import
|
|
35436
|
+
import path86 from "path";
|
|
35415
35437
|
import chalk234 from "chalk";
|
|
35416
35438
|
function indexRules() {
|
|
35417
35439
|
const startDir = scopeDirectory(process.cwd());
|
|
35418
35440
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
35419
35441
|
const directories = updateScopedRulesIndex(root2);
|
|
35420
|
-
const rootFile =
|
|
35442
|
+
const rootFile = path86.relative(process.cwd(), path86.join(root2, "CLAUDE.md"));
|
|
35421
35443
|
if (directories.length === 0) {
|
|
35422
35444
|
console.log(
|
|
35423
35445
|
chalk234.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
@@ -35430,13 +35452,13 @@ function indexRules() {
|
|
|
35430
35452
|
}
|
|
35431
35453
|
|
|
35432
35454
|
// src/commands/rules/listRules.ts
|
|
35433
|
-
import
|
|
35455
|
+
import path87 from "path";
|
|
35434
35456
|
import chalk235 from "chalk";
|
|
35435
35457
|
function listRules(target, options2 = {}) {
|
|
35436
|
-
const resolved =
|
|
35458
|
+
const resolved = path87.resolve(target ?? process.cwd());
|
|
35437
35459
|
const rules3 = readScopedRules(resolved);
|
|
35438
35460
|
if (rules3.length === 0) {
|
|
35439
|
-
const label2 =
|
|
35461
|
+
const label2 = path87.relative(process.cwd(), resolved) || ".";
|
|
35440
35462
|
console.log(chalk235.gray(`No rules in scope for ${label2}`));
|
|
35441
35463
|
return;
|
|
35442
35464
|
}
|
|
@@ -35447,7 +35469,7 @@ function listRules(target, options2 = {}) {
|
|
|
35447
35469
|
if (rule.source !== shown) {
|
|
35448
35470
|
shown = rule.source;
|
|
35449
35471
|
console.log(
|
|
35450
|
-
chalk235.dim(base ?
|
|
35472
|
+
chalk235.dim(base ? path87.relative(base, rule.source) : rule.source)
|
|
35451
35473
|
);
|
|
35452
35474
|
}
|
|
35453
35475
|
console.log(
|
|
@@ -35543,8 +35565,8 @@ import chalk241 from "chalk";
|
|
|
35543
35565
|
|
|
35544
35566
|
// src/commands/seq/fetchSeq.ts
|
|
35545
35567
|
import chalk238 from "chalk";
|
|
35546
|
-
async function fetchSeq(conn,
|
|
35547
|
-
const url = `${conn.url}${
|
|
35568
|
+
async function fetchSeq(conn, path106, params) {
|
|
35569
|
+
const url = `${conn.url}${path106}?${params}`;
|
|
35548
35570
|
const response = await fetch(url, {
|
|
35549
35571
|
headers: {
|
|
35550
35572
|
Accept: "application/json",
|
|
@@ -35925,7 +35947,7 @@ async function previewSlackThreadParts({
|
|
|
35925
35947
|
`Approved for ${target}. The ${bodies.length} bodies to post, in thread order, are at:`
|
|
35926
35948
|
);
|
|
35927
35949
|
paths.forEach(
|
|
35928
|
-
(
|
|
35950
|
+
(path106, index3) => console.log(`${index3 + 1}/${paths.length} ${path106}`)
|
|
35929
35951
|
);
|
|
35930
35952
|
console.log(
|
|
35931
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.`
|
|
@@ -36267,15 +36289,15 @@ function registerSql(program2) {
|
|
|
36267
36289
|
|
|
36268
36290
|
// src/commands/sync.ts
|
|
36269
36291
|
import * as os5 from "os";
|
|
36270
|
-
import * as
|
|
36292
|
+
import * as path99 from "path";
|
|
36271
36293
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
36272
36294
|
|
|
36273
36295
|
// src/commands/sync/pruneCommands.ts
|
|
36274
|
-
import * as
|
|
36296
|
+
import * as path89 from "path";
|
|
36275
36297
|
|
|
36276
36298
|
// src/commands/sync/pruneTarget.ts
|
|
36277
36299
|
import * as fs39 from "fs";
|
|
36278
|
-
import * as
|
|
36300
|
+
import * as path88 from "path";
|
|
36279
36301
|
function pruneTarget(targetDir, keepNames, shape, options2) {
|
|
36280
36302
|
const result = {
|
|
36281
36303
|
orphans: [],
|
|
@@ -36293,7 +36315,7 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
|
|
|
36293
36315
|
}
|
|
36294
36316
|
if (keep.has(name)) continue;
|
|
36295
36317
|
result.orphans.push(entry.name);
|
|
36296
|
-
const entryPath =
|
|
36318
|
+
const entryPath = path88.join(targetDir, entry.name);
|
|
36297
36319
|
const reason4 = shape.blockedBy?.(entryPath);
|
|
36298
36320
|
if (reason4) {
|
|
36299
36321
|
result.skipped.push({ name: entry.name, reason: reason4 });
|
|
@@ -36313,7 +36335,7 @@ function pruneCommands(targetDir, commandNames, options2) {
|
|
|
36313
36335
|
targetDir,
|
|
36314
36336
|
commandNames,
|
|
36315
36337
|
{
|
|
36316
|
-
nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ?
|
|
36338
|
+
nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path89.basename(entry.name, ".md") : void 0
|
|
36317
36339
|
},
|
|
36318
36340
|
options2
|
|
36319
36341
|
);
|
|
@@ -36348,16 +36370,16 @@ function reportPrune(label2, result, force) {
|
|
|
36348
36370
|
|
|
36349
36371
|
// src/commands/sync/syncClaudeCommands.ts
|
|
36350
36372
|
import * as fs43 from "fs";
|
|
36351
|
-
import * as
|
|
36373
|
+
import * as path93 from "path";
|
|
36352
36374
|
|
|
36353
36375
|
// src/commands/sync/syncCodex.ts
|
|
36354
|
-
import * as
|
|
36376
|
+
import * as path92 from "path";
|
|
36355
36377
|
|
|
36356
36378
|
// src/commands/sync/installHarnessCommands.ts
|
|
36357
36379
|
import * as fs40 from "fs";
|
|
36358
|
-
import * as
|
|
36380
|
+
import * as path90 from "path";
|
|
36359
36381
|
function installHarnessCommands(claudeDir, harness, transform) {
|
|
36360
|
-
const commandsSource =
|
|
36382
|
+
const commandsSource = path90.join(claudeDir, "commands");
|
|
36361
36383
|
const files = fs40.readdirSync(commandsSource);
|
|
36362
36384
|
const names = [];
|
|
36363
36385
|
let synced = 0;
|
|
@@ -36365,9 +36387,9 @@ function installHarnessCommands(claudeDir, harness, transform) {
|
|
|
36365
36387
|
if (!file.endsWith(".md")) continue;
|
|
36366
36388
|
const name = file.replace(/\.md$/, "");
|
|
36367
36389
|
names.push(name);
|
|
36368
|
-
const content = fs40.readFileSync(
|
|
36369
|
-
const target =
|
|
36370
|
-
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 });
|
|
36371
36393
|
fs40.writeFileSync(target, transform(name, content));
|
|
36372
36394
|
synced++;
|
|
36373
36395
|
}
|
|
@@ -36396,7 +36418,7 @@ function unexpectedContent(skillDir) {
|
|
|
36396
36418
|
|
|
36397
36419
|
// src/commands/sync/syncCodexHooks.ts
|
|
36398
36420
|
import * as fs42 from "fs";
|
|
36399
|
-
import * as
|
|
36421
|
+
import * as path91 from "path";
|
|
36400
36422
|
var BEGIN = "# >>> assist codex hooks (managed) \u2014 do not edit >>>";
|
|
36401
36423
|
var END = "# <<< assist codex hooks (managed) <<<";
|
|
36402
36424
|
function upsertManagedBlock(existing, body) {
|
|
@@ -36427,9 +36449,9 @@ ${rest}
|
|
|
36427
36449
|
}
|
|
36428
36450
|
function syncCodexHooks(sourcePath) {
|
|
36429
36451
|
const body = fs42.readFileSync(sourcePath, "utf8");
|
|
36430
|
-
const configPath =
|
|
36452
|
+
const configPath = path91.join(harnesses.codex.homeDir, "config.toml");
|
|
36431
36453
|
const existing = fs42.existsSync(configPath) ? fs42.readFileSync(configPath, "utf8") : "";
|
|
36432
|
-
fs42.mkdirSync(
|
|
36454
|
+
fs42.mkdirSync(path91.dirname(configPath), { recursive: true });
|
|
36433
36455
|
fs42.writeFileSync(configPath, upsertManagedBlock(existing, body));
|
|
36434
36456
|
console.log(
|
|
36435
36457
|
"Registered assist codex-hook in ~/.codex/config.toml (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
|
|
@@ -36461,13 +36483,13 @@ function syncCodex(claudeDir, options2) {
|
|
|
36461
36483
|
harnesses.codex,
|
|
36462
36484
|
commandToSkill
|
|
36463
36485
|
);
|
|
36464
|
-
syncCodexHooks(
|
|
36486
|
+
syncCodexHooks(path92.join(claudeDir, "..", "codex", "config.toml"));
|
|
36465
36487
|
console.log(`Synced ${total} skill(s) to ~/.codex/skills`);
|
|
36466
36488
|
if (!options2?.prune) return;
|
|
36467
36489
|
const force = options2.force ?? false;
|
|
36468
36490
|
reportPrune(
|
|
36469
36491
|
"~/.codex/skills",
|
|
36470
|
-
pruneSkills(
|
|
36492
|
+
pruneSkills(path92.join(harnesses.codex.homeDir, "skills"), names, { force }),
|
|
36471
36493
|
force
|
|
36472
36494
|
);
|
|
36473
36495
|
}
|
|
@@ -36482,30 +36504,30 @@ function replaceFileWithoutFollowingSymlink(file, content) {
|
|
|
36482
36504
|
fs43.writeFileSync(file, content);
|
|
36483
36505
|
}
|
|
36484
36506
|
function writeSkill(targetBase, name, content) {
|
|
36485
|
-
const skillDir =
|
|
36507
|
+
const skillDir = path93.join(targetBase, "skills", name);
|
|
36486
36508
|
fs43.mkdirSync(skillDir, { recursive: true });
|
|
36487
36509
|
replaceFileWithoutFollowingSymlink(
|
|
36488
|
-
|
|
36510
|
+
path93.join(skillDir, "SKILL.md"),
|
|
36489
36511
|
commandToSkill(name, content)
|
|
36490
36512
|
);
|
|
36491
|
-
fs43.rmSync(
|
|
36513
|
+
fs43.rmSync(path93.join(targetBase, "commands", `${name}.md`), { force: true });
|
|
36492
36514
|
console.log(`Wrote ${name} as a skill to ${skillDir}`);
|
|
36493
36515
|
}
|
|
36494
36516
|
function syncClaudeCommands(claudeDir, targetBase) {
|
|
36495
|
-
const sourceDir =
|
|
36496
|
-
const targetDir =
|
|
36517
|
+
const sourceDir = path93.join(claudeDir, "commands");
|
|
36518
|
+
const targetDir = path93.join(targetBase, "commands");
|
|
36497
36519
|
fs43.mkdirSync(targetDir, { recursive: true });
|
|
36498
36520
|
const files = fs43.readdirSync(sourceDir);
|
|
36499
36521
|
for (const file of files) {
|
|
36500
|
-
const source =
|
|
36522
|
+
const source = path93.join(sourceDir, file);
|
|
36501
36523
|
if (file.endsWith(".md")) {
|
|
36502
36524
|
const content = fs43.readFileSync(source, "utf8");
|
|
36503
36525
|
if (isSkillFlagged(content)) {
|
|
36504
|
-
writeSkill(targetBase,
|
|
36526
|
+
writeSkill(targetBase, path93.basename(file, ".md"), content);
|
|
36505
36527
|
continue;
|
|
36506
36528
|
}
|
|
36507
36529
|
}
|
|
36508
|
-
fs43.copyFileSync(source,
|
|
36530
|
+
fs43.copyFileSync(source, path93.join(targetDir, file));
|
|
36509
36531
|
console.log(`Copied ${file} to ${targetDir}`);
|
|
36510
36532
|
}
|
|
36511
36533
|
console.log(`Synced ${files.length} command(s) to ~/.claude`);
|
|
@@ -36514,11 +36536,11 @@ function syncClaudeCommands(claudeDir, targetBase) {
|
|
|
36514
36536
|
|
|
36515
36537
|
// src/commands/sync/reportRetiredAgentsFiles.ts
|
|
36516
36538
|
import * as fs44 from "fs";
|
|
36517
|
-
import * as
|
|
36539
|
+
import * as path94 from "path";
|
|
36518
36540
|
var retired = [
|
|
36519
|
-
|
|
36520
|
-
|
|
36521
|
-
|
|
36541
|
+
path94.join(harnesses.claude.homeDir, "CLAUDE.md"),
|
|
36542
|
+
path94.join(harnesses.codex.homeDir, "AGENTS.md"),
|
|
36543
|
+
path94.join(harnesses.pi.homeDir, "AGENTS.md")
|
|
36522
36544
|
];
|
|
36523
36545
|
function reportRetiredAgentsFiles() {
|
|
36524
36546
|
const leftovers = retired.filter((file) => fs44.existsSync(file));
|
|
@@ -36534,35 +36556,35 @@ function reportRetiredAgentsFiles() {
|
|
|
36534
36556
|
|
|
36535
36557
|
// src/commands/sync/syncDesign.ts
|
|
36536
36558
|
import * as fs45 from "fs";
|
|
36537
|
-
import * as
|
|
36559
|
+
import * as path95 from "path";
|
|
36538
36560
|
function syncDesign(claudeDir, targetBase) {
|
|
36539
|
-
const systemPromptSource =
|
|
36540
|
-
const systemPromptTarget =
|
|
36561
|
+
const systemPromptSource = path95.join(claudeDir, "design-system-prompt.md");
|
|
36562
|
+
const systemPromptTarget = path95.join(targetBase, "design-system-prompt.md");
|
|
36541
36563
|
fs45.copyFileSync(systemPromptSource, systemPromptTarget);
|
|
36542
36564
|
console.log(
|
|
36543
36565
|
"Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
|
|
36544
36566
|
);
|
|
36545
|
-
const skillsSource =
|
|
36546
|
-
const skillsTarget =
|
|
36567
|
+
const skillsSource = path95.join(claudeDir, "skills");
|
|
36568
|
+
const skillsTarget = path95.join(targetBase, "skills");
|
|
36547
36569
|
fs45.mkdirSync(skillsTarget, { recursive: true });
|
|
36548
36570
|
const files = fs45.readdirSync(skillsSource);
|
|
36549
36571
|
for (const file of files) {
|
|
36550
36572
|
fs45.copyFileSync(
|
|
36551
|
-
|
|
36552
|
-
|
|
36573
|
+
path95.join(skillsSource, file),
|
|
36574
|
+
path95.join(skillsTarget, file)
|
|
36553
36575
|
);
|
|
36554
36576
|
}
|
|
36555
36577
|
console.log(`Synced ${files.length} design skill(s) to ~/.claude/skills`);
|
|
36556
36578
|
}
|
|
36557
36579
|
|
|
36558
36580
|
// src/commands/sync/syncPi.ts
|
|
36559
|
-
import * as
|
|
36581
|
+
import * as path97 from "path";
|
|
36560
36582
|
|
|
36561
36583
|
// src/commands/sync/syncPiHooks.ts
|
|
36562
36584
|
import * as fs46 from "fs";
|
|
36563
|
-
import * as
|
|
36585
|
+
import * as path96 from "path";
|
|
36564
36586
|
function piExtensionsDir() {
|
|
36565
|
-
return
|
|
36587
|
+
return path96.join(harnesses.pi.homeDir, "extensions");
|
|
36566
36588
|
}
|
|
36567
36589
|
function syncPiHooks(sourceDir) {
|
|
36568
36590
|
const target = piExtensionsDir();
|
|
@@ -36570,8 +36592,8 @@ function syncPiHooks(sourceDir) {
|
|
|
36570
36592
|
const files = fs46.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
|
|
36571
36593
|
for (const file of files) {
|
|
36572
36594
|
fs46.copyFileSync(
|
|
36573
|
-
|
|
36574
|
-
|
|
36595
|
+
path96.join(sourceDir, file),
|
|
36596
|
+
path96.join(target, `assist-${file}`)
|
|
36575
36597
|
);
|
|
36576
36598
|
}
|
|
36577
36599
|
console.log(
|
|
@@ -36608,24 +36630,24 @@ function syncPi(claudeDir, options2) {
|
|
|
36608
36630
|
harnesses.pi,
|
|
36609
36631
|
commandToPrompt
|
|
36610
36632
|
);
|
|
36611
|
-
syncPiHooks(
|
|
36633
|
+
syncPiHooks(path97.join(claudeDir, "..", "pi"));
|
|
36612
36634
|
console.log(`Synced ${synced} prompt(s) to ~/.pi/agent/prompts`);
|
|
36613
36635
|
if (!options2?.prune) return;
|
|
36614
36636
|
const force = options2.force ?? false;
|
|
36615
36637
|
reportPrune(
|
|
36616
36638
|
"~/.pi/agent/prompts",
|
|
36617
|
-
pruneCommands(
|
|
36639
|
+
pruneCommands(path97.join(harnesses.pi.homeDir, "prompts"), names, { force }),
|
|
36618
36640
|
force
|
|
36619
36641
|
);
|
|
36620
36642
|
}
|
|
36621
36643
|
|
|
36622
36644
|
// src/commands/sync/syncSettings.ts
|
|
36623
36645
|
import * as fs47 from "fs";
|
|
36624
|
-
import * as
|
|
36646
|
+
import * as path98 from "path";
|
|
36625
36647
|
import chalk248 from "chalk";
|
|
36626
36648
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
36627
|
-
const source =
|
|
36628
|
-
const target =
|
|
36649
|
+
const source = path98.join(claudeDir, "settings.json");
|
|
36650
|
+
const target = path98.join(targetBase, "settings.json");
|
|
36629
36651
|
const sourceContent = fs47.readFileSync(source, "utf8");
|
|
36630
36652
|
const sourceSettings = JSON.parse(sourceContent);
|
|
36631
36653
|
const targetExists = fs47.existsSync(target);
|
|
@@ -36665,13 +36687,13 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
36665
36687
|
|
|
36666
36688
|
// src/commands/sync.ts
|
|
36667
36689
|
var __filename4 = fileURLToPath8(import.meta.url);
|
|
36668
|
-
var __dirname5 =
|
|
36690
|
+
var __dirname5 = path99.dirname(__filename4);
|
|
36669
36691
|
async function sync(options2) {
|
|
36670
36692
|
const config = loadConfig();
|
|
36671
36693
|
const yes = options2?.yes ?? config.sync.autoConfirm;
|
|
36672
36694
|
const prune = { prune: options2?.prune, force: options2?.force };
|
|
36673
|
-
const claudeDir =
|
|
36674
|
-
const targetBase =
|
|
36695
|
+
const claudeDir = path99.join(__dirname5, "..", "claude");
|
|
36696
|
+
const targetBase = path99.join(os5.homedir(), ".claude");
|
|
36675
36697
|
const commandFiles = syncClaudeCommands(claudeDir, targetBase);
|
|
36676
36698
|
syncDesign(claudeDir, targetBase);
|
|
36677
36699
|
await syncSettings(claudeDir, targetBase, { yes });
|
|
@@ -36679,11 +36701,11 @@ async function sync(options2) {
|
|
|
36679
36701
|
syncPi(claudeDir, prune);
|
|
36680
36702
|
reportRetiredAgentsFiles();
|
|
36681
36703
|
if (!options2?.prune) return;
|
|
36682
|
-
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"));
|
|
36683
36705
|
const force = options2.force ?? false;
|
|
36684
36706
|
reportPrune(
|
|
36685
36707
|
"~/.claude/commands",
|
|
36686
|
-
pruneCommands(
|
|
36708
|
+
pruneCommands(path99.join(targetBase, "commands"), commandNames, { force }),
|
|
36687
36709
|
force
|
|
36688
36710
|
);
|
|
36689
36711
|
}
|
|
@@ -37739,9 +37761,9 @@ import { existsSync as existsSync79, readFileSync as readFileSync60 } from "fs";
|
|
|
37739
37761
|
|
|
37740
37762
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
37741
37763
|
import { minimatch as minimatch9 } from "minimatch";
|
|
37742
|
-
function resolveStringsAtPath(data,
|
|
37764
|
+
function resolveStringsAtPath(data, path106) {
|
|
37743
37765
|
let current = data;
|
|
37744
|
-
for (const segment of
|
|
37766
|
+
for (const segment of path106.split(".")) {
|
|
37745
37767
|
if (current === null || typeof current !== "object") return [];
|
|
37746
37768
|
current = current[segment];
|
|
37747
37769
|
}
|
|
@@ -37754,10 +37776,10 @@ function resolveStringsAtPath(data, path105) {
|
|
|
37754
37776
|
}
|
|
37755
37777
|
function findRuleViolations(data, rule) {
|
|
37756
37778
|
const violations = [];
|
|
37757
|
-
for (const
|
|
37758
|
-
for (const value of resolveStringsAtPath(data,
|
|
37779
|
+
for (const path106 of rule.paths) {
|
|
37780
|
+
for (const value of resolveStringsAtPath(data, path106)) {
|
|
37759
37781
|
if (minimatch9(value, rule.disallowed))
|
|
37760
|
-
violations.push({ file: rule.file, path:
|
|
37782
|
+
violations.push({ file: rule.file, path: path106, value });
|
|
37761
37783
|
}
|
|
37762
37784
|
}
|
|
37763
37785
|
return violations;
|
|
@@ -37796,8 +37818,8 @@ function forbiddenStrings() {
|
|
|
37796
37818
|
process.exit(0);
|
|
37797
37819
|
}
|
|
37798
37820
|
console.log("Forbidden strings found:\n");
|
|
37799
|
-
for (const { file, path:
|
|
37800
|
-
console.log(` ${file} ${
|
|
37821
|
+
for (const { file, path: path106, value } of violations) {
|
|
37822
|
+
console.log(` ${file} ${path106}: ${value}`);
|
|
37801
37823
|
}
|
|
37802
37824
|
console.log(`
|
|
37803
37825
|
Total: ${violations.length} forbidden string(s).`);
|
|
@@ -37853,7 +37875,7 @@ Total: ${lines2.length} hardcoded color(s)`);
|
|
|
37853
37875
|
|
|
37854
37876
|
// src/commands/verify/migrations.ts
|
|
37855
37877
|
import { readFileSync as readFileSync61 } from "fs";
|
|
37856
|
-
import
|
|
37878
|
+
import path101 from "path";
|
|
37857
37879
|
|
|
37858
37880
|
// src/commands/verify/migrations/checkAppendOnly.ts
|
|
37859
37881
|
function checkAppendOnly(baseline, current) {
|
|
@@ -37945,15 +37967,15 @@ function readBaselineMigrations(repoRelativeDir, ref) {
|
|
|
37945
37967
|
} catch {
|
|
37946
37968
|
return baseline;
|
|
37947
37969
|
}
|
|
37948
|
-
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((
|
|
37949
|
-
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) {
|
|
37950
37972
|
try {
|
|
37951
|
-
const content = execSync63(`git show "${ref}:${
|
|
37973
|
+
const content = execSync63(`git show "${ref}:${path106}"`, {
|
|
37952
37974
|
encoding: "utf8",
|
|
37953
37975
|
maxBuffer: 16 * 1024 * 1024,
|
|
37954
37976
|
stdio: ["pipe", "pipe", "pipe"]
|
|
37955
37977
|
});
|
|
37956
|
-
baseline.set(basename26(
|
|
37978
|
+
baseline.set(basename26(path106), content);
|
|
37957
37979
|
} catch {
|
|
37958
37980
|
}
|
|
37959
37981
|
}
|
|
@@ -37992,11 +38014,11 @@ function resolveBaselineRef() {
|
|
|
37992
38014
|
}
|
|
37993
38015
|
|
|
37994
38016
|
// src/commands/verify/migrations/migrationsDir.ts
|
|
37995
|
-
import
|
|
38017
|
+
import path100 from "path";
|
|
37996
38018
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
37997
38019
|
function migrationsDir() {
|
|
37998
|
-
return
|
|
37999
|
-
|
|
38020
|
+
return path100.resolve(
|
|
38021
|
+
path100.dirname(fileURLToPath9(import.meta.url)),
|
|
38000
38022
|
"../../../shared/db/migrations"
|
|
38001
38023
|
);
|
|
38002
38024
|
}
|
|
@@ -38017,7 +38039,7 @@ function migrations2() {
|
|
|
38017
38039
|
if (ref) {
|
|
38018
38040
|
const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
|
|
38019
38041
|
const current = new Map(
|
|
38020
|
-
files.map((file) => [file, readFileSync61(
|
|
38042
|
+
files.map((file) => [file, readFileSync61(path101.join(dir, file), "utf8")])
|
|
38021
38043
|
);
|
|
38022
38044
|
for (const finding of checkAppendOnly(baseline, current)) {
|
|
38023
38045
|
problems.push(
|
|
@@ -38522,11 +38544,11 @@ var webUiPrefix = "src/commands/sessions/web/ui/";
|
|
|
38522
38544
|
var sessionsPrefix = "src/commands/sessions/";
|
|
38523
38545
|
var rules = [
|
|
38524
38546
|
{
|
|
38525
|
-
matches: (
|
|
38547
|
+
matches: (path106) => path106.startsWith(webUiPrefix),
|
|
38526
38548
|
advice: "restart the web server, then hard-reload the browser tab"
|
|
38527
38549
|
},
|
|
38528
38550
|
{
|
|
38529
|
-
matches: (
|
|
38551
|
+
matches: (path106) => path106.startsWith(sessionsPrefix) && !path106.startsWith(webUiPrefix),
|
|
38530
38552
|
advice: "restart the daemon"
|
|
38531
38553
|
}
|
|
38532
38554
|
];
|
|
@@ -38537,27 +38559,27 @@ function restartAdvice(paths) {
|
|
|
38537
38559
|
// src/commands/watch/syncAdvice.ts
|
|
38538
38560
|
var rules2 = [
|
|
38539
38561
|
{
|
|
38540
|
-
matches: (
|
|
38562
|
+
matches: (path106) => path106.startsWith("claude/commands/"),
|
|
38541
38563
|
reason: "claude/commands changed"
|
|
38542
38564
|
},
|
|
38543
38565
|
{
|
|
38544
|
-
matches: (
|
|
38566
|
+
matches: (path106) => path106.startsWith("claude/skills/"),
|
|
38545
38567
|
reason: "claude/skills changed"
|
|
38546
38568
|
},
|
|
38547
38569
|
{
|
|
38548
|
-
matches: (
|
|
38570
|
+
matches: (path106) => path106 === "claude/settings.json",
|
|
38549
38571
|
reason: "claude/settings.json changed"
|
|
38550
38572
|
},
|
|
38551
38573
|
{
|
|
38552
|
-
matches: (
|
|
38574
|
+
matches: (path106) => path106 === "claude/design-system-prompt.md",
|
|
38553
38575
|
reason: "claude/design-system-prompt.md changed"
|
|
38554
38576
|
},
|
|
38555
38577
|
{
|
|
38556
|
-
matches: (
|
|
38578
|
+
matches: (path106) => path106.startsWith("codex/"),
|
|
38557
38579
|
reason: "codex sources changed"
|
|
38558
38580
|
},
|
|
38559
38581
|
{
|
|
38560
|
-
matches: (
|
|
38582
|
+
matches: (path106) => path106.startsWith("pi/"),
|
|
38561
38583
|
reason: "pi sources changed"
|
|
38562
38584
|
}
|
|
38563
38585
|
];
|
|
@@ -39208,9 +39230,9 @@ function findPortFile(roamDir) {
|
|
|
39208
39230
|
return void 0;
|
|
39209
39231
|
}
|
|
39210
39232
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
39211
|
-
const
|
|
39233
|
+
const path106 = join101(roamDir, name);
|
|
39212
39234
|
try {
|
|
39213
|
-
return { path:
|
|
39235
|
+
return { path: path106, mtimeMs: statSync13(path106).mtimeMs };
|
|
39214
39236
|
} catch {
|
|
39215
39237
|
return void 0;
|
|
39216
39238
|
}
|
|
@@ -39454,11 +39476,11 @@ function findLinkIndex() {
|
|
|
39454
39476
|
function parseLinkArgs() {
|
|
39455
39477
|
const idx = findLinkIndex();
|
|
39456
39478
|
if (idx === -1) return null;
|
|
39457
|
-
const
|
|
39479
|
+
const path106 = process.argv[idx + 1];
|
|
39458
39480
|
const rest = process.argv.slice(idx + 2);
|
|
39459
39481
|
const { value: prefix2 } = extractOption(rest, "--prefix");
|
|
39460
39482
|
if (!prefix2) return null;
|
|
39461
|
-
return { path:
|
|
39483
|
+
return { path: path106, prefix: prefix2 };
|
|
39462
39484
|
}
|
|
39463
39485
|
function hasDuplicateLink(runList, linkPath) {
|
|
39464
39486
|
return runList.some(
|
|
@@ -40103,14 +40125,14 @@ import * as pty from "node-pty";
|
|
|
40103
40125
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
40104
40126
|
import { chmodSync, existsSync as existsSync87, statSync as statSync14 } from "fs";
|
|
40105
40127
|
import { createRequire as createRequire3 } from "module";
|
|
40106
|
-
import
|
|
40128
|
+
import path102 from "path";
|
|
40107
40129
|
var require4 = createRequire3(import.meta.url);
|
|
40108
40130
|
var ensured = false;
|
|
40109
40131
|
function ensureSpawnHelperExecutable() {
|
|
40110
40132
|
if (ensured || process.platform !== "darwin") return;
|
|
40111
40133
|
ensured = true;
|
|
40112
|
-
const ptyRoot =
|
|
40113
|
-
const helper =
|
|
40134
|
+
const ptyRoot = path102.join(path102.dirname(require4.resolve("node-pty")), "..");
|
|
40135
|
+
const helper = path102.join(
|
|
40114
40136
|
ptyRoot,
|
|
40115
40137
|
"prebuilds",
|
|
40116
40138
|
`${process.platform}-${process.arch}`,
|
|
@@ -40241,12 +40263,12 @@ function serverRunMeta(runName, cwd) {
|
|
|
40241
40263
|
|
|
40242
40264
|
// src/commands/sessions/daemon/readDesignSystemPrompt.ts
|
|
40243
40265
|
import * as fs50 from "fs";
|
|
40244
|
-
import * as
|
|
40266
|
+
import * as path103 from "path";
|
|
40245
40267
|
import { fileURLToPath as fileURLToPath11 } from "url";
|
|
40246
40268
|
var __filename5 = fileURLToPath11(import.meta.url);
|
|
40247
|
-
var __dirname7 =
|
|
40269
|
+
var __dirname7 = path103.dirname(__filename5);
|
|
40248
40270
|
function readDesignSystemPrompt() {
|
|
40249
|
-
const promptPath =
|
|
40271
|
+
const promptPath = path103.join(
|
|
40250
40272
|
__dirname7,
|
|
40251
40273
|
"..",
|
|
40252
40274
|
"claude",
|
|
@@ -41280,8 +41302,8 @@ async function seedRunningMsFromUsage(session, notify2) {
|
|
|
41280
41302
|
var DEBOUNCE_MS2 = 50;
|
|
41281
41303
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
41282
41304
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
41283
|
-
const
|
|
41284
|
-
const dir = dirname42(
|
|
41305
|
+
const path106 = activityPath(session.id);
|
|
41306
|
+
const dir = dirname42(path106);
|
|
41285
41307
|
try {
|
|
41286
41308
|
mkdirSync37(dir, { recursive: true });
|
|
41287
41309
|
} catch {
|
|
@@ -41291,7 +41313,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
41291
41313
|
let timer = null;
|
|
41292
41314
|
const read3 = () => {
|
|
41293
41315
|
timer = null;
|
|
41294
|
-
const activity2 = readActivity(
|
|
41316
|
+
const activity2 = readActivity(path106);
|
|
41295
41317
|
if (!activity2) return;
|
|
41296
41318
|
applyActivityToSession(session, activity2);
|
|
41297
41319
|
if (activity2.claudeSessionId) onClaudeSessionId?.(session);
|
|
@@ -41300,11 +41322,11 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
41300
41322
|
notify2();
|
|
41301
41323
|
};
|
|
41302
41324
|
session.activityWatcher = watch2(dir, (_event, filename) => {
|
|
41303
|
-
if (filename && !
|
|
41325
|
+
if (filename && !path106.endsWith(filename)) return;
|
|
41304
41326
|
if (timer) clearTimeout(timer);
|
|
41305
41327
|
timer = setTimeout(read3, DEBOUNCE_MS2);
|
|
41306
41328
|
});
|
|
41307
|
-
if (existsSync93(
|
|
41329
|
+
if (existsSync93(path106)) read3();
|
|
41308
41330
|
}
|
|
41309
41331
|
function refreshActivity(session) {
|
|
41310
41332
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -41447,12 +41469,12 @@ import { watch as watch3 } from "fs";
|
|
|
41447
41469
|
|
|
41448
41470
|
// src/commands/sessions/shared/findTranscriptPathSync.ts
|
|
41449
41471
|
import * as fs52 from "fs";
|
|
41450
|
-
import * as
|
|
41472
|
+
import * as path104 from "path";
|
|
41451
41473
|
function projectDirForCwd(cwd) {
|
|
41452
|
-
return
|
|
41474
|
+
return path104.join(claudeProjectsRoot(), projectSlug(cwd));
|
|
41453
41475
|
}
|
|
41454
41476
|
function transcriptPathFor(cwd, claudeSessionId) {
|
|
41455
|
-
return
|
|
41477
|
+
return path104.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
|
|
41456
41478
|
}
|
|
41457
41479
|
function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
41458
41480
|
const direct = transcriptPathFor(cwd, claudeSessionId);
|
|
@@ -41466,8 +41488,8 @@ function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
|
41466
41488
|
}
|
|
41467
41489
|
for (const file of files) {
|
|
41468
41490
|
if (!file.endsWith(".jsonl")) continue;
|
|
41469
|
-
if (headContainsSessionId(
|
|
41470
|
-
return
|
|
41491
|
+
if (headContainsSessionId(path104.join(dir, file), claudeSessionId))
|
|
41492
|
+
return path104.join(dir, file);
|
|
41471
41493
|
}
|
|
41472
41494
|
return null;
|
|
41473
41495
|
}
|
|
@@ -42667,9 +42689,9 @@ function tempRoots() {
|
|
|
42667
42689
|
}
|
|
42668
42690
|
return [...roots];
|
|
42669
42691
|
}
|
|
42670
|
-
function underTempRoot(
|
|
42692
|
+
function underTempRoot(path106) {
|
|
42671
42693
|
return tempRoots().some(
|
|
42672
|
-
(root2) =>
|
|
42694
|
+
(root2) => path106.startsWith(root2.endsWith(sep3) ? root2 : root2 + sep3)
|
|
42673
42695
|
);
|
|
42674
42696
|
}
|
|
42675
42697
|
|
|
@@ -43155,15 +43177,15 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
43155
43177
|
import { existsSync as existsSync95 } from "fs";
|
|
43156
43178
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
43157
43179
|
if (!existsSync95(clone)) {
|
|
43158
|
-
for (const { path:
|
|
43180
|
+
for (const { path: path106 } of paths) forgetWorktree(path106);
|
|
43159
43181
|
daemonLog(
|
|
43160
43182
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
43161
43183
|
);
|
|
43162
43184
|
return;
|
|
43163
43185
|
}
|
|
43164
43186
|
await pruneBookkeeping2(clone);
|
|
43165
|
-
for (const { path:
|
|
43166
|
-
if (await reclaimBranch(clone, branch2)) forgetWorktree(
|
|
43187
|
+
for (const { path: path106, branch: branch2 } of paths)
|
|
43188
|
+
if (await reclaimBranch(clone, branch2)) forgetWorktree(path106);
|
|
43167
43189
|
}
|
|
43168
43190
|
async function pruneBookkeeping2(clone) {
|
|
43169
43191
|
try {
|
|
@@ -43190,37 +43212,37 @@ async function reclaimBranch(clone, branch2) {
|
|
|
43190
43212
|
}
|
|
43191
43213
|
|
|
43192
43214
|
// src/commands/sessions/daemon/worktree/logVanishedTree.ts
|
|
43193
|
-
function logVanishedTree(sessions,
|
|
43215
|
+
function logVanishedTree(sessions, path106) {
|
|
43194
43216
|
const claimants = [...sessions.values()].filter(
|
|
43195
|
-
(s) => s.cwd ===
|
|
43217
|
+
(s) => s.cwd === path106 || s.worktree?.path === path106
|
|
43196
43218
|
);
|
|
43197
43219
|
if (claimants.length === 0) {
|
|
43198
|
-
daemonLog(`worktree ${
|
|
43220
|
+
daemonLog(`worktree ${path106} gone from disk and unclaimed; reclaiming it`);
|
|
43199
43221
|
return;
|
|
43200
43222
|
}
|
|
43201
43223
|
for (const s of claimants)
|
|
43202
43224
|
daemonLog(
|
|
43203
|
-
`session ${s.id} ("${s.name}") claims worktree ${
|
|
43225
|
+
`session ${s.id} ("${s.name}") claims worktree ${path106}, which is gone from disk; reclaiming it`
|
|
43204
43226
|
);
|
|
43205
43227
|
}
|
|
43206
43228
|
|
|
43207
43229
|
// src/commands/sessions/daemon/worktree/describeHeldWork.ts
|
|
43208
43230
|
var MAX_ITEMS = 20;
|
|
43209
|
-
async function describeHeldWork(
|
|
43210
|
-
if (reason4.startsWith("uncommitted")) return await changedFiles(
|
|
43211
|
-
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);
|
|
43212
43234
|
return { summary: reason4, items: [] };
|
|
43213
43235
|
}
|
|
43214
|
-
async function changedFiles(
|
|
43215
|
-
const status3 = await gitResult(
|
|
43236
|
+
async function changedFiles(path106) {
|
|
43237
|
+
const status3 = await gitResult(path106, ["status", "--porcelain"]);
|
|
43216
43238
|
const lines2 = status3.ok ? nonEmptyLines(status3.out) : [];
|
|
43217
43239
|
return {
|
|
43218
43240
|
summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
|
|
43219
43241
|
items: capped2(lines2)
|
|
43220
43242
|
};
|
|
43221
43243
|
}
|
|
43222
|
-
async function unpushedCommits(
|
|
43223
|
-
const log2 = await gitResult(
|
|
43244
|
+
async function unpushedCommits(path106, reason4) {
|
|
43245
|
+
const log2 = await gitResult(path106, ["log", "--oneline", "@{upstream}..HEAD"]);
|
|
43224
43246
|
if (!log2.ok) return { summary: reason4, items: [] };
|
|
43225
43247
|
const lines2 = nonEmptyLines(log2.out);
|
|
43226
43248
|
return {
|
|
@@ -43312,24 +43334,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
|
|
|
43312
43334
|
async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
43313
43335
|
const accounted = accountedTrees(sessions);
|
|
43314
43336
|
const vanished = /* @__PURE__ */ new Map();
|
|
43315
|
-
for (const { path:
|
|
43316
|
-
if (underTempRoot(
|
|
43317
|
-
forgetWorktree(
|
|
43337
|
+
for (const { path: path106, clone } of readWorktreeRegistry()) {
|
|
43338
|
+
if (underTempRoot(path106)) {
|
|
43339
|
+
forgetWorktree(path106);
|
|
43318
43340
|
daemonLog(
|
|
43319
|
-
`worktree ${
|
|
43341
|
+
`worktree ${path106} lies outside any project root; pruned from the registry rather than recovered`
|
|
43320
43342
|
);
|
|
43321
43343
|
continue;
|
|
43322
43344
|
}
|
|
43323
|
-
if (!existsSync96(
|
|
43324
|
-
logVanishedTree(sessions,
|
|
43345
|
+
if (!existsSync96(path106)) {
|
|
43346
|
+
logVanishedTree(sessions, path106);
|
|
43325
43347
|
vanished.set(clone, [
|
|
43326
43348
|
...vanished.get(clone) ?? [],
|
|
43327
|
-
{ path:
|
|
43349
|
+
{ path: path106, branch: basename29(path106) }
|
|
43328
43350
|
]);
|
|
43329
43351
|
continue;
|
|
43330
43352
|
}
|
|
43331
|
-
if (accounted.has(
|
|
43332
|
-
await recoverOrphan(sessions, spawnWith, { path:
|
|
43353
|
+
if (accounted.has(path106)) continue;
|
|
43354
|
+
await recoverOrphan(sessions, spawnWith, { path: path106, clone }, notify2);
|
|
43333
43355
|
}
|
|
43334
43356
|
for (const [clone, paths] of vanished)
|
|
43335
43357
|
await reclaimVanishedWorktrees(clone, paths);
|
|
@@ -45407,12 +45429,12 @@ function handleSetStatus(client, m, d) {
|
|
|
45407
45429
|
import * as fs56 from "fs";
|
|
45408
45430
|
|
|
45409
45431
|
// src/commands/sessions/shared/codex/findCodexRolloutPath.ts
|
|
45410
|
-
import * as
|
|
45432
|
+
import * as path105 from "path";
|
|
45411
45433
|
async function findCodexRolloutPath(sessionId) {
|
|
45412
45434
|
if (!sessionId) return null;
|
|
45413
45435
|
const paths = await discoverCodexRolloutPaths();
|
|
45414
45436
|
const suffix = `-${sessionId}.jsonl`;
|
|
45415
|
-
return paths.find((file) =>
|
|
45437
|
+
return paths.find((file) => path105.basename(file).endsWith(suffix)) ?? null;
|
|
45416
45438
|
}
|
|
45417
45439
|
|
|
45418
45440
|
// src/commands/sessions/shared/codex/codexToolTarget.ts
|
|
@@ -45995,13 +46017,13 @@ function describePeerError(error) {
|
|
|
45995
46017
|
const cause = error.cause;
|
|
45996
46018
|
return cause instanceof Error ? `${error.message}: ${describePeerError(cause)}` : error.message;
|
|
45997
46019
|
}
|
|
45998
|
-
async function fetchPeerJson(baseUrl,
|
|
45999
|
-
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), {
|
|
46000
46022
|
signal: AbortSignal.timeout(timeoutMs)
|
|
46001
46023
|
});
|
|
46002
46024
|
if (!res.ok)
|
|
46003
46025
|
throw Object.assign(
|
|
46004
|
-
new Error(`GET ${
|
|
46026
|
+
new Error(`GET ${path106} returned ${res.status} ${res.statusText}`),
|
|
46005
46027
|
{ status: res.status }
|
|
46006
46028
|
);
|
|
46007
46029
|
return await res.json();
|