@staff0rd/assist 0.720.0 → 0.721.1
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 +442 -411
- 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.1",
|
|
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
|
|
@@ -31921,37 +31922,67 @@ Plan exceeds restructure.maxDepth ${maxDepth}: ${tooDeep} file(s) deeper.`
|
|
|
31921
31922
|
// src/commands/refactor/restructure/displayDrift.ts
|
|
31922
31923
|
import path73 from "path";
|
|
31923
31924
|
import chalk218 from "chalk";
|
|
31924
|
-
|
|
31925
|
+
var shownMoves = 20;
|
|
31926
|
+
function displayDrift(plan2, listMoves) {
|
|
31925
31927
|
const rel = (file) => path73.relative(process.cwd(), file);
|
|
31926
31928
|
if (plan2.moves.length > 0) {
|
|
31927
|
-
console.log(
|
|
31928
|
-
|
|
31929
|
-
|
|
31929
|
+
console.log(
|
|
31930
|
+
chalk218.red(
|
|
31931
|
+
`${plan2.moves.length} file(s) drift from the plan${listMoves ? ":" : "."}`
|
|
31932
|
+
)
|
|
31933
|
+
);
|
|
31934
|
+
if (listMoves) {
|
|
31935
|
+
for (const move2 of plan2.moves.slice(0, shownMoves))
|
|
31936
|
+
console.log(` ${rel(move2.from)} \u2192 ${rel(move2.to)}`);
|
|
31937
|
+
if (plan2.moves.length > shownMoves)
|
|
31938
|
+
console.log(chalk218.dim(` \u2026and ${plan2.moves.length - shownMoves} more`));
|
|
31939
|
+
}
|
|
31930
31940
|
}
|
|
31931
31941
|
for (const error of plan2.errors) console.log(chalk218.red(error));
|
|
31932
31942
|
}
|
|
31933
31943
|
|
|
31934
31944
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
31945
|
+
function applyCommand(plan2) {
|
|
31946
|
+
const root2 = path74.relative(process.cwd(), plan2.scopeRoot) || ".";
|
|
31947
|
+
return `assist refactor restructure ${root2} --apply`;
|
|
31948
|
+
}
|
|
31935
31949
|
function checkPlan(plan2, chains, maxDepth) {
|
|
31936
|
-
displayDrift(plan2);
|
|
31950
|
+
displayDrift(plan2, chains.length === 0);
|
|
31937
31951
|
displayDeepChains(chains, maxDepth);
|
|
31938
|
-
if (
|
|
31952
|
+
if (chains.length > 0) {
|
|
31953
|
+
console.log(
|
|
31954
|
+
chalk219.yellow(
|
|
31955
|
+
`
|
|
31956
|
+
Once the plan is within the limit, run \`${applyCommand(plan2)}\` to move the files and rewrite their imports.`
|
|
31957
|
+
)
|
|
31958
|
+
);
|
|
31959
|
+
process.exit(1);
|
|
31960
|
+
}
|
|
31961
|
+
if (plan2.errors.length > 0) process.exit(1);
|
|
31962
|
+
if (plan2.moves.length > 0) {
|
|
31963
|
+
console.log(
|
|
31964
|
+
chalk219.yellow(
|
|
31965
|
+
`
|
|
31966
|
+
Run \`${applyCommand(plan2)}\` to move the files and rewrite their imports.`
|
|
31967
|
+
)
|
|
31968
|
+
);
|
|
31939
31969
|
process.exit(1);
|
|
31970
|
+
}
|
|
31940
31971
|
console.log(chalk219.green("Layout matches the restructure plan"));
|
|
31941
31972
|
}
|
|
31942
31973
|
|
|
31943
31974
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
31944
|
-
import
|
|
31975
|
+
import path77 from "path";
|
|
31945
31976
|
import chalk220 from "chalk";
|
|
31946
31977
|
|
|
31947
31978
|
// src/commands/refactor/restructure/computeDepthStats.ts
|
|
31948
|
-
import
|
|
31979
|
+
import path75 from "path";
|
|
31949
31980
|
function computeDepthStats(targets, scopeRoot) {
|
|
31950
31981
|
const distribution = /* @__PURE__ */ new Map();
|
|
31951
31982
|
let max = 0;
|
|
31952
31983
|
for (const target of targets) {
|
|
31953
|
-
const dir =
|
|
31954
|
-
const depth = dir === "" ? 0 : dir.split(
|
|
31984
|
+
const dir = path75.relative(scopeRoot, path75.dirname(target));
|
|
31985
|
+
const depth = dir === "" ? 0 : dir.split(path75.sep).length;
|
|
31955
31986
|
distribution.set(depth, (distribution.get(depth) ?? 0) + 1);
|
|
31956
31987
|
max = Math.max(max, depth);
|
|
31957
31988
|
}
|
|
@@ -31959,7 +31990,7 @@ function computeDepthStats(targets, scopeRoot) {
|
|
|
31959
31990
|
}
|
|
31960
31991
|
|
|
31961
31992
|
// src/commands/refactor/restructure/formatTree.ts
|
|
31962
|
-
import
|
|
31993
|
+
import path76 from "path";
|
|
31963
31994
|
function insert(root2, parts) {
|
|
31964
31995
|
let node = root2;
|
|
31965
31996
|
for (const part of parts) {
|
|
@@ -31981,7 +32012,7 @@ function render(node, indent3, lines2) {
|
|
|
31981
32012
|
function formatTree(files, scopeRoot) {
|
|
31982
32013
|
const root2 = /* @__PURE__ */ new Map();
|
|
31983
32014
|
for (const file of files)
|
|
31984
|
-
insert(root2,
|
|
32015
|
+
insert(root2, path76.relative(scopeRoot, file).split(path76.sep));
|
|
31985
32016
|
const lines2 = [];
|
|
31986
32017
|
render(root2, "", lines2);
|
|
31987
32018
|
return lines2;
|
|
@@ -31989,7 +32020,7 @@ function formatTree(files, scopeRoot) {
|
|
|
31989
32020
|
|
|
31990
32021
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
31991
32022
|
function relPath2(filePath) {
|
|
31992
|
-
return
|
|
32023
|
+
return path77.relative(process.cwd(), filePath);
|
|
31993
32024
|
}
|
|
31994
32025
|
function displayMoves(plan2) {
|
|
31995
32026
|
if (plan2.moves.length === 0) return;
|
|
@@ -32039,10 +32070,10 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
32039
32070
|
}
|
|
32040
32071
|
|
|
32041
32072
|
// src/commands/refactor/restructure/findDeepChains.ts
|
|
32042
|
-
import
|
|
32073
|
+
import path78 from "path";
|
|
32043
32074
|
function dirSegments(target, scopeRoot) {
|
|
32044
|
-
const dir =
|
|
32045
|
-
return dir === "" ? [] : dir.split(
|
|
32075
|
+
const dir = path78.relative(scopeRoot, path78.dirname(target));
|
|
32076
|
+
return dir === "" ? [] : dir.split(path78.sep);
|
|
32046
32077
|
}
|
|
32047
32078
|
function countSubtrees(segmentLists) {
|
|
32048
32079
|
const counts2 = /* @__PURE__ */ new Map();
|
|
@@ -32077,11 +32108,11 @@ function findDeepChains(targets, scopeRoot, maxDepth) {
|
|
|
32077
32108
|
}
|
|
32078
32109
|
|
|
32079
32110
|
// src/commands/refactor/restructure/partitionIgnored.ts
|
|
32080
|
-
import
|
|
32111
|
+
import path79 from "path";
|
|
32081
32112
|
import { minimatch as minimatch4 } from "minimatch";
|
|
32082
32113
|
function partitionIgnored(files) {
|
|
32083
32114
|
const globs = loadConfig().restructure?.ignore ?? [];
|
|
32084
|
-
const isIgnored = (file) => globs.some((glob) => minimatch4(
|
|
32115
|
+
const isIgnored = (file) => globs.some((glob) => minimatch4(path79.relative(process.cwd(), file), glob));
|
|
32085
32116
|
return {
|
|
32086
32117
|
scoped: files.filter((f) => !isIgnored(f)),
|
|
32087
32118
|
ignored: files.filter(isIgnored)
|
|
@@ -32090,7 +32121,7 @@ function partitionIgnored(files) {
|
|
|
32090
32121
|
|
|
32091
32122
|
// src/commands/refactor/restructure.ts
|
|
32092
32123
|
async function restructure(root2, options2 = {}) {
|
|
32093
|
-
const scopeRoot =
|
|
32124
|
+
const scopeRoot = path80.resolve(root2 ?? "src");
|
|
32094
32125
|
if (!fs38.existsSync(scopeRoot) || !fs38.statSync(scopeRoot).isDirectory()) {
|
|
32095
32126
|
console.log(chalk221.red(`Not a directory: ${root2 ?? "src"}`));
|
|
32096
32127
|
process.exit(1);
|
|
@@ -32491,8 +32522,8 @@ function groupFilesByDirectory(files) {
|
|
|
32491
32522
|
}
|
|
32492
32523
|
|
|
32493
32524
|
// src/commands/review/highLevel/buildHighLevelTree.ts
|
|
32494
|
-
function basename19(
|
|
32495
|
-
return
|
|
32525
|
+
function basename19(path106) {
|
|
32526
|
+
return path106.slice(path106.lastIndexOf("/") + 1);
|
|
32496
32527
|
}
|
|
32497
32528
|
function sum(nodes, key) {
|
|
32498
32529
|
return nodes.reduce((total, node) => total + node[key], 0);
|
|
@@ -32515,19 +32546,19 @@ function nodesOf(at2, prefix2) {
|
|
|
32515
32546
|
}
|
|
32516
32547
|
function collapsedDirNode(name, at2, prefix2) {
|
|
32517
32548
|
let label2 = name;
|
|
32518
|
-
let
|
|
32549
|
+
let path106 = prefix2 ? `${prefix2}/${name}` : name;
|
|
32519
32550
|
let node = at2;
|
|
32520
32551
|
while (node.files.length === 0 && node.dirs.size === 1) {
|
|
32521
32552
|
const [childName, child] = [...node.dirs][0];
|
|
32522
32553
|
label2 = `${label2}/${childName}`;
|
|
32523
|
-
|
|
32554
|
+
path106 = `${path106}/${childName}`;
|
|
32524
32555
|
node = child;
|
|
32525
32556
|
}
|
|
32526
|
-
const children = nodesOf(node,
|
|
32557
|
+
const children = nodesOf(node, path106);
|
|
32527
32558
|
return {
|
|
32528
32559
|
kind: "dir",
|
|
32529
32560
|
name: label2,
|
|
32530
|
-
path:
|
|
32561
|
+
path: path106,
|
|
32531
32562
|
additions: sum(children, "additions"),
|
|
32532
32563
|
deletions: sum(children, "deletions"),
|
|
32533
32564
|
children
|
|
@@ -32785,8 +32816,8 @@ function toStatus(status3) {
|
|
|
32785
32816
|
if (status3 === "removed") return "removed";
|
|
32786
32817
|
return "modified";
|
|
32787
32818
|
}
|
|
32788
|
-
function diffUrl(repo, prNumber,
|
|
32789
|
-
const anchor = createHash3("sha256").update(
|
|
32819
|
+
function diffUrl(repo, prNumber, path106) {
|
|
32820
|
+
const anchor = createHash3("sha256").update(path106).digest("hex");
|
|
32790
32821
|
return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
|
|
32791
32822
|
}
|
|
32792
32823
|
function fetchHighLevelFiles(prNumber, repo) {
|
|
@@ -32842,10 +32873,10 @@ function highLevelReviewPath(repo, headRef, headSha) {
|
|
|
32842
32873
|
|
|
32843
32874
|
// src/commands/review/highLevel/loadHighLevelReview.ts
|
|
32844
32875
|
function loadHighLevelReview(repo, headRef, headSha) {
|
|
32845
|
-
const
|
|
32846
|
-
if (!existsSync64(
|
|
32876
|
+
const path106 = highLevelReviewPath(repo, headRef, headSha);
|
|
32877
|
+
if (!existsSync64(path106)) return void 0;
|
|
32847
32878
|
try {
|
|
32848
|
-
return JSON.parse(readFileSync47(
|
|
32879
|
+
return JSON.parse(readFileSync47(path106, "utf8"));
|
|
32849
32880
|
} catch {
|
|
32850
32881
|
return void 0;
|
|
32851
32882
|
}
|
|
@@ -32856,8 +32887,8 @@ import { minimatch as minimatch7 } from "minimatch";
|
|
|
32856
32887
|
function selectCriticalDiffs(files, criticalPaths) {
|
|
32857
32888
|
if (criticalPaths.length === 0) return [];
|
|
32858
32889
|
return files.filter((file) => criticalPaths.some((glob) => minimatch7(file.path, glob))).map(
|
|
32859
|
-
({ path:
|
|
32860
|
-
path:
|
|
32890
|
+
({ path: path106, status: status3, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
|
|
32891
|
+
path: path106,
|
|
32861
32892
|
status: status3,
|
|
32862
32893
|
additions,
|
|
32863
32894
|
deletions,
|
|
@@ -32972,11 +33003,11 @@ function highLevelPreviewPayload(subject) {
|
|
|
32972
33003
|
import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync39 } from "fs";
|
|
32973
33004
|
import { dirname as dirname36 } from "path";
|
|
32974
33005
|
function saveHighLevelReview(record) {
|
|
32975
|
-
const
|
|
32976
|
-
mkdirSync22(dirname36(
|
|
32977
|
-
writeFileSync39(
|
|
33006
|
+
const path106 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
|
|
33007
|
+
mkdirSync22(dirname36(path106), { recursive: true });
|
|
33008
|
+
writeFileSync39(path106, `${JSON.stringify(record, null, 2)}
|
|
32978
33009
|
`);
|
|
32979
|
-
return
|
|
33010
|
+
return path106;
|
|
32980
33011
|
}
|
|
32981
33012
|
|
|
32982
33013
|
// src/commands/review/highLevel/openHighLevelOverlay.ts
|
|
@@ -32995,9 +33026,9 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
32995
33026
|
{ rejectIsOutcome: true }
|
|
32996
33027
|
);
|
|
32997
33028
|
const record = buildHighLevelRecord(subject, decision);
|
|
32998
|
-
const
|
|
33029
|
+
const path106 = saveHighLevelReview(record);
|
|
32999
33030
|
console.log(`Verdict: ${record.verdict}`);
|
|
33000
|
-
console.log(`Saved ${
|
|
33031
|
+
console.log(`Saved ${path106}`);
|
|
33001
33032
|
console.log("Nothing was posted to GitHub.");
|
|
33002
33033
|
return record;
|
|
33003
33034
|
}
|
|
@@ -34012,8 +34043,8 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
34012
34043
|
// src/commands/review/prepareReviewDir.ts
|
|
34013
34044
|
import { existsSync as existsSync65, mkdirSync as mkdirSync23, unlinkSync as unlinkSync18, writeFileSync as writeFileSync40 } from "fs";
|
|
34014
34045
|
function clearReviewFiles(paths) {
|
|
34015
|
-
for (const
|
|
34016
|
-
if (existsSync65(
|
|
34046
|
+
for (const path106 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
34047
|
+
if (existsSync65(path106)) unlinkSync18(path106);
|
|
34017
34048
|
}
|
|
34018
34049
|
}
|
|
34019
34050
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -35251,7 +35282,7 @@ function registerReview(program2) {
|
|
|
35251
35282
|
|
|
35252
35283
|
// src/commands/rules/addRule.ts
|
|
35253
35284
|
import { existsSync as existsSync70, readFileSync as readFileSync53, writeFileSync as writeFileSync43 } from "fs";
|
|
35254
|
-
import
|
|
35285
|
+
import path85 from "path";
|
|
35255
35286
|
import chalk233 from "chalk";
|
|
35256
35287
|
|
|
35257
35288
|
// src/commands/rules/insertRuleBullet.ts
|
|
@@ -35279,7 +35310,7 @@ import { readFileSync as readFileSync50 } from "fs";
|
|
|
35279
35310
|
|
|
35280
35311
|
// src/commands/rules/findClaudeFiles.ts
|
|
35281
35312
|
import { readdirSync as readdirSync13 } from "fs";
|
|
35282
|
-
import
|
|
35313
|
+
import path81 from "path";
|
|
35283
35314
|
var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
|
|
35284
35315
|
function findClaudeFiles(dir) {
|
|
35285
35316
|
const results = [];
|
|
@@ -35287,9 +35318,9 @@ function findClaudeFiles(dir) {
|
|
|
35287
35318
|
if (entry.isDirectory()) {
|
|
35288
35319
|
if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
|
|
35289
35320
|
continue;
|
|
35290
|
-
results.push(...findClaudeFiles(
|
|
35321
|
+
results.push(...findClaudeFiles(path81.join(dir, entry.name)));
|
|
35291
35322
|
} else if (entry.name === "CLAUDE.md") {
|
|
35292
|
-
results.push(
|
|
35323
|
+
results.push(path81.join(dir, entry.name));
|
|
35293
35324
|
}
|
|
35294
35325
|
}
|
|
35295
35326
|
return results;
|
|
@@ -35308,34 +35339,34 @@ function nextRuleCode(root2) {
|
|
|
35308
35339
|
|
|
35309
35340
|
// src/commands/rules/resolveRuleScope.ts
|
|
35310
35341
|
import { existsSync as existsSync68 } from "fs";
|
|
35311
|
-
import
|
|
35342
|
+
import path82 from "path";
|
|
35312
35343
|
function resolveRuleScope(target) {
|
|
35313
|
-
const resolved =
|
|
35314
|
-
if (
|
|
35344
|
+
const resolved = path82.resolve(target);
|
|
35345
|
+
if (path82.basename(resolved) === "CLAUDE.md") return resolved;
|
|
35315
35346
|
const startDir = scopeDirectory(resolved);
|
|
35316
35347
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
35317
35348
|
let current = startDir;
|
|
35318
35349
|
while (true) {
|
|
35319
|
-
const candidate =
|
|
35350
|
+
const candidate = path82.join(current, "CLAUDE.md");
|
|
35320
35351
|
if (existsSync68(candidate)) return candidate;
|
|
35321
|
-
if (current === root2 || current ===
|
|
35322
|
-
current =
|
|
35352
|
+
if (current === root2 || current === path82.dirname(current)) break;
|
|
35353
|
+
current = path82.dirname(current);
|
|
35323
35354
|
}
|
|
35324
|
-
return
|
|
35355
|
+
return path82.join(root2, "CLAUDE.md");
|
|
35325
35356
|
}
|
|
35326
35357
|
|
|
35327
35358
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
35328
35359
|
import { existsSync as existsSync69, readFileSync as readFileSync52, writeFileSync as writeFileSync42 } from "fs";
|
|
35329
|
-
import
|
|
35360
|
+
import path84 from "path";
|
|
35330
35361
|
|
|
35331
35362
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
35332
35363
|
import { readFileSync as readFileSync51 } from "fs";
|
|
35333
|
-
import
|
|
35364
|
+
import path83 from "path";
|
|
35334
35365
|
function scopedRuleDirectories(root2) {
|
|
35335
35366
|
return findClaudeFiles(root2).filter(
|
|
35336
|
-
(file) =>
|
|
35367
|
+
(file) => path83.dirname(file) !== root2 && parseRulesSection(readFileSync51(file, "utf8")).length > 0
|
|
35337
35368
|
).map(
|
|
35338
|
-
(file) => `${
|
|
35369
|
+
(file) => `${path83.relative(root2, path83.dirname(file)).split(path83.sep).join("/")}/`
|
|
35339
35370
|
).sort();
|
|
35340
35371
|
}
|
|
35341
35372
|
|
|
@@ -35374,7 +35405,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
35374
35405
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
35375
35406
|
function updateScopedRulesIndex(root2) {
|
|
35376
35407
|
const directories = scopedRuleDirectories(root2);
|
|
35377
|
-
const rootFile =
|
|
35408
|
+
const rootFile = path84.join(root2, "CLAUDE.md");
|
|
35378
35409
|
const before = existsSync69(rootFile) ? readFileSync52(rootFile, "utf8") : "";
|
|
35379
35410
|
const after = upsertScopedRulesPointer(before, directories);
|
|
35380
35411
|
if (after !== before) writeFileSync42(rootFile, after);
|
|
@@ -35393,7 +35424,7 @@ function addRule(text18, options2) {
|
|
|
35393
35424
|
return;
|
|
35394
35425
|
}
|
|
35395
35426
|
const target = resolveRuleScope(options2.scope ?? process.cwd());
|
|
35396
|
-
const targetDir =
|
|
35427
|
+
const targetDir = path85.dirname(target);
|
|
35397
35428
|
const root2 = findRepoRoot(targetDir) ?? targetDir;
|
|
35398
35429
|
const code = nextRuleCode(root2);
|
|
35399
35430
|
writeFileSync43(
|
|
@@ -35406,18 +35437,18 @@ function addRule(text18, options2) {
|
|
|
35406
35437
|
);
|
|
35407
35438
|
updateScopedRulesIndex(root2);
|
|
35408
35439
|
console.log(
|
|
35409
|
-
`Added ${chalk233.cyan(code)} to ${
|
|
35440
|
+
`Added ${chalk233.cyan(code)} to ${path85.relative(process.cwd(), target) || target}`
|
|
35410
35441
|
);
|
|
35411
35442
|
}
|
|
35412
35443
|
|
|
35413
35444
|
// src/commands/rules/indexRules.ts
|
|
35414
|
-
import
|
|
35445
|
+
import path86 from "path";
|
|
35415
35446
|
import chalk234 from "chalk";
|
|
35416
35447
|
function indexRules() {
|
|
35417
35448
|
const startDir = scopeDirectory(process.cwd());
|
|
35418
35449
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
35419
35450
|
const directories = updateScopedRulesIndex(root2);
|
|
35420
|
-
const rootFile =
|
|
35451
|
+
const rootFile = path86.relative(process.cwd(), path86.join(root2, "CLAUDE.md"));
|
|
35421
35452
|
if (directories.length === 0) {
|
|
35422
35453
|
console.log(
|
|
35423
35454
|
chalk234.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
@@ -35430,13 +35461,13 @@ function indexRules() {
|
|
|
35430
35461
|
}
|
|
35431
35462
|
|
|
35432
35463
|
// src/commands/rules/listRules.ts
|
|
35433
|
-
import
|
|
35464
|
+
import path87 from "path";
|
|
35434
35465
|
import chalk235 from "chalk";
|
|
35435
35466
|
function listRules(target, options2 = {}) {
|
|
35436
|
-
const resolved =
|
|
35467
|
+
const resolved = path87.resolve(target ?? process.cwd());
|
|
35437
35468
|
const rules3 = readScopedRules(resolved);
|
|
35438
35469
|
if (rules3.length === 0) {
|
|
35439
|
-
const label2 =
|
|
35470
|
+
const label2 = path87.relative(process.cwd(), resolved) || ".";
|
|
35440
35471
|
console.log(chalk235.gray(`No rules in scope for ${label2}`));
|
|
35441
35472
|
return;
|
|
35442
35473
|
}
|
|
@@ -35447,7 +35478,7 @@ function listRules(target, options2 = {}) {
|
|
|
35447
35478
|
if (rule.source !== shown) {
|
|
35448
35479
|
shown = rule.source;
|
|
35449
35480
|
console.log(
|
|
35450
|
-
chalk235.dim(base ?
|
|
35481
|
+
chalk235.dim(base ? path87.relative(base, rule.source) : rule.source)
|
|
35451
35482
|
);
|
|
35452
35483
|
}
|
|
35453
35484
|
console.log(
|
|
@@ -35543,8 +35574,8 @@ import chalk241 from "chalk";
|
|
|
35543
35574
|
|
|
35544
35575
|
// src/commands/seq/fetchSeq.ts
|
|
35545
35576
|
import chalk238 from "chalk";
|
|
35546
|
-
async function fetchSeq(conn,
|
|
35547
|
-
const url = `${conn.url}${
|
|
35577
|
+
async function fetchSeq(conn, path106, params) {
|
|
35578
|
+
const url = `${conn.url}${path106}?${params}`;
|
|
35548
35579
|
const response = await fetch(url, {
|
|
35549
35580
|
headers: {
|
|
35550
35581
|
Accept: "application/json",
|
|
@@ -35925,7 +35956,7 @@ async function previewSlackThreadParts({
|
|
|
35925
35956
|
`Approved for ${target}. The ${bodies.length} bodies to post, in thread order, are at:`
|
|
35926
35957
|
);
|
|
35927
35958
|
paths.forEach(
|
|
35928
|
-
(
|
|
35959
|
+
(path106, index3) => console.log(`${index3 + 1}/${paths.length} ${path106}`)
|
|
35929
35960
|
);
|
|
35930
35961
|
console.log(
|
|
35931
35962
|
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 +36298,15 @@ function registerSql(program2) {
|
|
|
36267
36298
|
|
|
36268
36299
|
// src/commands/sync.ts
|
|
36269
36300
|
import * as os5 from "os";
|
|
36270
|
-
import * as
|
|
36301
|
+
import * as path99 from "path";
|
|
36271
36302
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
36272
36303
|
|
|
36273
36304
|
// src/commands/sync/pruneCommands.ts
|
|
36274
|
-
import * as
|
|
36305
|
+
import * as path89 from "path";
|
|
36275
36306
|
|
|
36276
36307
|
// src/commands/sync/pruneTarget.ts
|
|
36277
36308
|
import * as fs39 from "fs";
|
|
36278
|
-
import * as
|
|
36309
|
+
import * as path88 from "path";
|
|
36279
36310
|
function pruneTarget(targetDir, keepNames, shape, options2) {
|
|
36280
36311
|
const result = {
|
|
36281
36312
|
orphans: [],
|
|
@@ -36293,7 +36324,7 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
|
|
|
36293
36324
|
}
|
|
36294
36325
|
if (keep.has(name)) continue;
|
|
36295
36326
|
result.orphans.push(entry.name);
|
|
36296
|
-
const entryPath =
|
|
36327
|
+
const entryPath = path88.join(targetDir, entry.name);
|
|
36297
36328
|
const reason4 = shape.blockedBy?.(entryPath);
|
|
36298
36329
|
if (reason4) {
|
|
36299
36330
|
result.skipped.push({ name: entry.name, reason: reason4 });
|
|
@@ -36313,7 +36344,7 @@ function pruneCommands(targetDir, commandNames, options2) {
|
|
|
36313
36344
|
targetDir,
|
|
36314
36345
|
commandNames,
|
|
36315
36346
|
{
|
|
36316
|
-
nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ?
|
|
36347
|
+
nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path89.basename(entry.name, ".md") : void 0
|
|
36317
36348
|
},
|
|
36318
36349
|
options2
|
|
36319
36350
|
);
|
|
@@ -36348,16 +36379,16 @@ function reportPrune(label2, result, force) {
|
|
|
36348
36379
|
|
|
36349
36380
|
// src/commands/sync/syncClaudeCommands.ts
|
|
36350
36381
|
import * as fs43 from "fs";
|
|
36351
|
-
import * as
|
|
36382
|
+
import * as path93 from "path";
|
|
36352
36383
|
|
|
36353
36384
|
// src/commands/sync/syncCodex.ts
|
|
36354
|
-
import * as
|
|
36385
|
+
import * as path92 from "path";
|
|
36355
36386
|
|
|
36356
36387
|
// src/commands/sync/installHarnessCommands.ts
|
|
36357
36388
|
import * as fs40 from "fs";
|
|
36358
|
-
import * as
|
|
36389
|
+
import * as path90 from "path";
|
|
36359
36390
|
function installHarnessCommands(claudeDir, harness, transform) {
|
|
36360
|
-
const commandsSource =
|
|
36391
|
+
const commandsSource = path90.join(claudeDir, "commands");
|
|
36361
36392
|
const files = fs40.readdirSync(commandsSource);
|
|
36362
36393
|
const names = [];
|
|
36363
36394
|
let synced = 0;
|
|
@@ -36365,9 +36396,9 @@ function installHarnessCommands(claudeDir, harness, transform) {
|
|
|
36365
36396
|
if (!file.endsWith(".md")) continue;
|
|
36366
36397
|
const name = file.replace(/\.md$/, "");
|
|
36367
36398
|
names.push(name);
|
|
36368
|
-
const content = fs40.readFileSync(
|
|
36369
|
-
const target =
|
|
36370
|
-
fs40.mkdirSync(
|
|
36399
|
+
const content = fs40.readFileSync(path90.join(commandsSource, file), "utf8");
|
|
36400
|
+
const target = path90.join(harness.homeDir, harness.sync.commandDest(name));
|
|
36401
|
+
fs40.mkdirSync(path90.dirname(target), { recursive: true });
|
|
36371
36402
|
fs40.writeFileSync(target, transform(name, content));
|
|
36372
36403
|
synced++;
|
|
36373
36404
|
}
|
|
@@ -36396,7 +36427,7 @@ function unexpectedContent(skillDir) {
|
|
|
36396
36427
|
|
|
36397
36428
|
// src/commands/sync/syncCodexHooks.ts
|
|
36398
36429
|
import * as fs42 from "fs";
|
|
36399
|
-
import * as
|
|
36430
|
+
import * as path91 from "path";
|
|
36400
36431
|
var BEGIN = "# >>> assist codex hooks (managed) \u2014 do not edit >>>";
|
|
36401
36432
|
var END = "# <<< assist codex hooks (managed) <<<";
|
|
36402
36433
|
function upsertManagedBlock(existing, body) {
|
|
@@ -36427,9 +36458,9 @@ ${rest}
|
|
|
36427
36458
|
}
|
|
36428
36459
|
function syncCodexHooks(sourcePath) {
|
|
36429
36460
|
const body = fs42.readFileSync(sourcePath, "utf8");
|
|
36430
|
-
const configPath =
|
|
36461
|
+
const configPath = path91.join(harnesses.codex.homeDir, "config.toml");
|
|
36431
36462
|
const existing = fs42.existsSync(configPath) ? fs42.readFileSync(configPath, "utf8") : "";
|
|
36432
|
-
fs42.mkdirSync(
|
|
36463
|
+
fs42.mkdirSync(path91.dirname(configPath), { recursive: true });
|
|
36433
36464
|
fs42.writeFileSync(configPath, upsertManagedBlock(existing, body));
|
|
36434
36465
|
console.log(
|
|
36435
36466
|
"Registered assist codex-hook in ~/.codex/config.toml (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
|
|
@@ -36461,13 +36492,13 @@ function syncCodex(claudeDir, options2) {
|
|
|
36461
36492
|
harnesses.codex,
|
|
36462
36493
|
commandToSkill
|
|
36463
36494
|
);
|
|
36464
|
-
syncCodexHooks(
|
|
36495
|
+
syncCodexHooks(path92.join(claudeDir, "..", "codex", "config.toml"));
|
|
36465
36496
|
console.log(`Synced ${total} skill(s) to ~/.codex/skills`);
|
|
36466
36497
|
if (!options2?.prune) return;
|
|
36467
36498
|
const force = options2.force ?? false;
|
|
36468
36499
|
reportPrune(
|
|
36469
36500
|
"~/.codex/skills",
|
|
36470
|
-
pruneSkills(
|
|
36501
|
+
pruneSkills(path92.join(harnesses.codex.homeDir, "skills"), names, { force }),
|
|
36471
36502
|
force
|
|
36472
36503
|
);
|
|
36473
36504
|
}
|
|
@@ -36482,30 +36513,30 @@ function replaceFileWithoutFollowingSymlink(file, content) {
|
|
|
36482
36513
|
fs43.writeFileSync(file, content);
|
|
36483
36514
|
}
|
|
36484
36515
|
function writeSkill(targetBase, name, content) {
|
|
36485
|
-
const skillDir =
|
|
36516
|
+
const skillDir = path93.join(targetBase, "skills", name);
|
|
36486
36517
|
fs43.mkdirSync(skillDir, { recursive: true });
|
|
36487
36518
|
replaceFileWithoutFollowingSymlink(
|
|
36488
|
-
|
|
36519
|
+
path93.join(skillDir, "SKILL.md"),
|
|
36489
36520
|
commandToSkill(name, content)
|
|
36490
36521
|
);
|
|
36491
|
-
fs43.rmSync(
|
|
36522
|
+
fs43.rmSync(path93.join(targetBase, "commands", `${name}.md`), { force: true });
|
|
36492
36523
|
console.log(`Wrote ${name} as a skill to ${skillDir}`);
|
|
36493
36524
|
}
|
|
36494
36525
|
function syncClaudeCommands(claudeDir, targetBase) {
|
|
36495
|
-
const sourceDir =
|
|
36496
|
-
const targetDir =
|
|
36526
|
+
const sourceDir = path93.join(claudeDir, "commands");
|
|
36527
|
+
const targetDir = path93.join(targetBase, "commands");
|
|
36497
36528
|
fs43.mkdirSync(targetDir, { recursive: true });
|
|
36498
36529
|
const files = fs43.readdirSync(sourceDir);
|
|
36499
36530
|
for (const file of files) {
|
|
36500
|
-
const source =
|
|
36531
|
+
const source = path93.join(sourceDir, file);
|
|
36501
36532
|
if (file.endsWith(".md")) {
|
|
36502
36533
|
const content = fs43.readFileSync(source, "utf8");
|
|
36503
36534
|
if (isSkillFlagged(content)) {
|
|
36504
|
-
writeSkill(targetBase,
|
|
36535
|
+
writeSkill(targetBase, path93.basename(file, ".md"), content);
|
|
36505
36536
|
continue;
|
|
36506
36537
|
}
|
|
36507
36538
|
}
|
|
36508
|
-
fs43.copyFileSync(source,
|
|
36539
|
+
fs43.copyFileSync(source, path93.join(targetDir, file));
|
|
36509
36540
|
console.log(`Copied ${file} to ${targetDir}`);
|
|
36510
36541
|
}
|
|
36511
36542
|
console.log(`Synced ${files.length} command(s) to ~/.claude`);
|
|
@@ -36514,11 +36545,11 @@ function syncClaudeCommands(claudeDir, targetBase) {
|
|
|
36514
36545
|
|
|
36515
36546
|
// src/commands/sync/reportRetiredAgentsFiles.ts
|
|
36516
36547
|
import * as fs44 from "fs";
|
|
36517
|
-
import * as
|
|
36548
|
+
import * as path94 from "path";
|
|
36518
36549
|
var retired = [
|
|
36519
|
-
|
|
36520
|
-
|
|
36521
|
-
|
|
36550
|
+
path94.join(harnesses.claude.homeDir, "CLAUDE.md"),
|
|
36551
|
+
path94.join(harnesses.codex.homeDir, "AGENTS.md"),
|
|
36552
|
+
path94.join(harnesses.pi.homeDir, "AGENTS.md")
|
|
36522
36553
|
];
|
|
36523
36554
|
function reportRetiredAgentsFiles() {
|
|
36524
36555
|
const leftovers = retired.filter((file) => fs44.existsSync(file));
|
|
@@ -36534,35 +36565,35 @@ function reportRetiredAgentsFiles() {
|
|
|
36534
36565
|
|
|
36535
36566
|
// src/commands/sync/syncDesign.ts
|
|
36536
36567
|
import * as fs45 from "fs";
|
|
36537
|
-
import * as
|
|
36568
|
+
import * as path95 from "path";
|
|
36538
36569
|
function syncDesign(claudeDir, targetBase) {
|
|
36539
|
-
const systemPromptSource =
|
|
36540
|
-
const systemPromptTarget =
|
|
36570
|
+
const systemPromptSource = path95.join(claudeDir, "design-system-prompt.md");
|
|
36571
|
+
const systemPromptTarget = path95.join(targetBase, "design-system-prompt.md");
|
|
36541
36572
|
fs45.copyFileSync(systemPromptSource, systemPromptTarget);
|
|
36542
36573
|
console.log(
|
|
36543
36574
|
"Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
|
|
36544
36575
|
);
|
|
36545
|
-
const skillsSource =
|
|
36546
|
-
const skillsTarget =
|
|
36576
|
+
const skillsSource = path95.join(claudeDir, "skills");
|
|
36577
|
+
const skillsTarget = path95.join(targetBase, "skills");
|
|
36547
36578
|
fs45.mkdirSync(skillsTarget, { recursive: true });
|
|
36548
36579
|
const files = fs45.readdirSync(skillsSource);
|
|
36549
36580
|
for (const file of files) {
|
|
36550
36581
|
fs45.copyFileSync(
|
|
36551
|
-
|
|
36552
|
-
|
|
36582
|
+
path95.join(skillsSource, file),
|
|
36583
|
+
path95.join(skillsTarget, file)
|
|
36553
36584
|
);
|
|
36554
36585
|
}
|
|
36555
36586
|
console.log(`Synced ${files.length} design skill(s) to ~/.claude/skills`);
|
|
36556
36587
|
}
|
|
36557
36588
|
|
|
36558
36589
|
// src/commands/sync/syncPi.ts
|
|
36559
|
-
import * as
|
|
36590
|
+
import * as path97 from "path";
|
|
36560
36591
|
|
|
36561
36592
|
// src/commands/sync/syncPiHooks.ts
|
|
36562
36593
|
import * as fs46 from "fs";
|
|
36563
|
-
import * as
|
|
36594
|
+
import * as path96 from "path";
|
|
36564
36595
|
function piExtensionsDir() {
|
|
36565
|
-
return
|
|
36596
|
+
return path96.join(harnesses.pi.homeDir, "extensions");
|
|
36566
36597
|
}
|
|
36567
36598
|
function syncPiHooks(sourceDir) {
|
|
36568
36599
|
const target = piExtensionsDir();
|
|
@@ -36570,8 +36601,8 @@ function syncPiHooks(sourceDir) {
|
|
|
36570
36601
|
const files = fs46.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
|
|
36571
36602
|
for (const file of files) {
|
|
36572
36603
|
fs46.copyFileSync(
|
|
36573
|
-
|
|
36574
|
-
|
|
36604
|
+
path96.join(sourceDir, file),
|
|
36605
|
+
path96.join(target, `assist-${file}`)
|
|
36575
36606
|
);
|
|
36576
36607
|
}
|
|
36577
36608
|
console.log(
|
|
@@ -36608,24 +36639,24 @@ function syncPi(claudeDir, options2) {
|
|
|
36608
36639
|
harnesses.pi,
|
|
36609
36640
|
commandToPrompt
|
|
36610
36641
|
);
|
|
36611
|
-
syncPiHooks(
|
|
36642
|
+
syncPiHooks(path97.join(claudeDir, "..", "pi"));
|
|
36612
36643
|
console.log(`Synced ${synced} prompt(s) to ~/.pi/agent/prompts`);
|
|
36613
36644
|
if (!options2?.prune) return;
|
|
36614
36645
|
const force = options2.force ?? false;
|
|
36615
36646
|
reportPrune(
|
|
36616
36647
|
"~/.pi/agent/prompts",
|
|
36617
|
-
pruneCommands(
|
|
36648
|
+
pruneCommands(path97.join(harnesses.pi.homeDir, "prompts"), names, { force }),
|
|
36618
36649
|
force
|
|
36619
36650
|
);
|
|
36620
36651
|
}
|
|
36621
36652
|
|
|
36622
36653
|
// src/commands/sync/syncSettings.ts
|
|
36623
36654
|
import * as fs47 from "fs";
|
|
36624
|
-
import * as
|
|
36655
|
+
import * as path98 from "path";
|
|
36625
36656
|
import chalk248 from "chalk";
|
|
36626
36657
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
36627
|
-
const source =
|
|
36628
|
-
const target =
|
|
36658
|
+
const source = path98.join(claudeDir, "settings.json");
|
|
36659
|
+
const target = path98.join(targetBase, "settings.json");
|
|
36629
36660
|
const sourceContent = fs47.readFileSync(source, "utf8");
|
|
36630
36661
|
const sourceSettings = JSON.parse(sourceContent);
|
|
36631
36662
|
const targetExists = fs47.existsSync(target);
|
|
@@ -36665,13 +36696,13 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
36665
36696
|
|
|
36666
36697
|
// src/commands/sync.ts
|
|
36667
36698
|
var __filename4 = fileURLToPath8(import.meta.url);
|
|
36668
|
-
var __dirname5 =
|
|
36699
|
+
var __dirname5 = path99.dirname(__filename4);
|
|
36669
36700
|
async function sync(options2) {
|
|
36670
36701
|
const config = loadConfig();
|
|
36671
36702
|
const yes = options2?.yes ?? config.sync.autoConfirm;
|
|
36672
36703
|
const prune = { prune: options2?.prune, force: options2?.force };
|
|
36673
|
-
const claudeDir =
|
|
36674
|
-
const targetBase =
|
|
36704
|
+
const claudeDir = path99.join(__dirname5, "..", "claude");
|
|
36705
|
+
const targetBase = path99.join(os5.homedir(), ".claude");
|
|
36675
36706
|
const commandFiles = syncClaudeCommands(claudeDir, targetBase);
|
|
36676
36707
|
syncDesign(claudeDir, targetBase);
|
|
36677
36708
|
await syncSettings(claudeDir, targetBase, { yes });
|
|
@@ -36679,11 +36710,11 @@ async function sync(options2) {
|
|
|
36679
36710
|
syncPi(claudeDir, prune);
|
|
36680
36711
|
reportRetiredAgentsFiles();
|
|
36681
36712
|
if (!options2?.prune) return;
|
|
36682
|
-
const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) =>
|
|
36713
|
+
const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path99.basename(file, ".md"));
|
|
36683
36714
|
const force = options2.force ?? false;
|
|
36684
36715
|
reportPrune(
|
|
36685
36716
|
"~/.claude/commands",
|
|
36686
|
-
pruneCommands(
|
|
36717
|
+
pruneCommands(path99.join(targetBase, "commands"), commandNames, { force }),
|
|
36687
36718
|
force
|
|
36688
36719
|
);
|
|
36689
36720
|
}
|
|
@@ -37739,9 +37770,9 @@ import { existsSync as existsSync79, readFileSync as readFileSync60 } from "fs";
|
|
|
37739
37770
|
|
|
37740
37771
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
37741
37772
|
import { minimatch as minimatch9 } from "minimatch";
|
|
37742
|
-
function resolveStringsAtPath(data,
|
|
37773
|
+
function resolveStringsAtPath(data, path106) {
|
|
37743
37774
|
let current = data;
|
|
37744
|
-
for (const segment of
|
|
37775
|
+
for (const segment of path106.split(".")) {
|
|
37745
37776
|
if (current === null || typeof current !== "object") return [];
|
|
37746
37777
|
current = current[segment];
|
|
37747
37778
|
}
|
|
@@ -37754,10 +37785,10 @@ function resolveStringsAtPath(data, path105) {
|
|
|
37754
37785
|
}
|
|
37755
37786
|
function findRuleViolations(data, rule) {
|
|
37756
37787
|
const violations = [];
|
|
37757
|
-
for (const
|
|
37758
|
-
for (const value of resolveStringsAtPath(data,
|
|
37788
|
+
for (const path106 of rule.paths) {
|
|
37789
|
+
for (const value of resolveStringsAtPath(data, path106)) {
|
|
37759
37790
|
if (minimatch9(value, rule.disallowed))
|
|
37760
|
-
violations.push({ file: rule.file, path:
|
|
37791
|
+
violations.push({ file: rule.file, path: path106, value });
|
|
37761
37792
|
}
|
|
37762
37793
|
}
|
|
37763
37794
|
return violations;
|
|
@@ -37796,8 +37827,8 @@ function forbiddenStrings() {
|
|
|
37796
37827
|
process.exit(0);
|
|
37797
37828
|
}
|
|
37798
37829
|
console.log("Forbidden strings found:\n");
|
|
37799
|
-
for (const { file, path:
|
|
37800
|
-
console.log(` ${file} ${
|
|
37830
|
+
for (const { file, path: path106, value } of violations) {
|
|
37831
|
+
console.log(` ${file} ${path106}: ${value}`);
|
|
37801
37832
|
}
|
|
37802
37833
|
console.log(`
|
|
37803
37834
|
Total: ${violations.length} forbidden string(s).`);
|
|
@@ -37853,7 +37884,7 @@ Total: ${lines2.length} hardcoded color(s)`);
|
|
|
37853
37884
|
|
|
37854
37885
|
// src/commands/verify/migrations.ts
|
|
37855
37886
|
import { readFileSync as readFileSync61 } from "fs";
|
|
37856
|
-
import
|
|
37887
|
+
import path101 from "path";
|
|
37857
37888
|
|
|
37858
37889
|
// src/commands/verify/migrations/checkAppendOnly.ts
|
|
37859
37890
|
function checkAppendOnly(baseline, current) {
|
|
@@ -37945,15 +37976,15 @@ function readBaselineMigrations(repoRelativeDir, ref) {
|
|
|
37945
37976
|
} catch {
|
|
37946
37977
|
return baseline;
|
|
37947
37978
|
}
|
|
37948
|
-
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((
|
|
37949
|
-
for (const
|
|
37979
|
+
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path106) => MIGRATION_FILE3.test(basename26(path106)));
|
|
37980
|
+
for (const path106 of paths) {
|
|
37950
37981
|
try {
|
|
37951
|
-
const content = execSync63(`git show "${ref}:${
|
|
37982
|
+
const content = execSync63(`git show "${ref}:${path106}"`, {
|
|
37952
37983
|
encoding: "utf8",
|
|
37953
37984
|
maxBuffer: 16 * 1024 * 1024,
|
|
37954
37985
|
stdio: ["pipe", "pipe", "pipe"]
|
|
37955
37986
|
});
|
|
37956
|
-
baseline.set(basename26(
|
|
37987
|
+
baseline.set(basename26(path106), content);
|
|
37957
37988
|
} catch {
|
|
37958
37989
|
}
|
|
37959
37990
|
}
|
|
@@ -37992,11 +38023,11 @@ function resolveBaselineRef() {
|
|
|
37992
38023
|
}
|
|
37993
38024
|
|
|
37994
38025
|
// src/commands/verify/migrations/migrationsDir.ts
|
|
37995
|
-
import
|
|
38026
|
+
import path100 from "path";
|
|
37996
38027
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
37997
38028
|
function migrationsDir() {
|
|
37998
|
-
return
|
|
37999
|
-
|
|
38029
|
+
return path100.resolve(
|
|
38030
|
+
path100.dirname(fileURLToPath9(import.meta.url)),
|
|
38000
38031
|
"../../../shared/db/migrations"
|
|
38001
38032
|
);
|
|
38002
38033
|
}
|
|
@@ -38017,7 +38048,7 @@ function migrations2() {
|
|
|
38017
38048
|
if (ref) {
|
|
38018
38049
|
const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
|
|
38019
38050
|
const current = new Map(
|
|
38020
|
-
files.map((file) => [file, readFileSync61(
|
|
38051
|
+
files.map((file) => [file, readFileSync61(path101.join(dir, file), "utf8")])
|
|
38021
38052
|
);
|
|
38022
38053
|
for (const finding of checkAppendOnly(baseline, current)) {
|
|
38023
38054
|
problems.push(
|
|
@@ -38522,11 +38553,11 @@ var webUiPrefix = "src/commands/sessions/web/ui/";
|
|
|
38522
38553
|
var sessionsPrefix = "src/commands/sessions/";
|
|
38523
38554
|
var rules = [
|
|
38524
38555
|
{
|
|
38525
|
-
matches: (
|
|
38556
|
+
matches: (path106) => path106.startsWith(webUiPrefix),
|
|
38526
38557
|
advice: "restart the web server, then hard-reload the browser tab"
|
|
38527
38558
|
},
|
|
38528
38559
|
{
|
|
38529
|
-
matches: (
|
|
38560
|
+
matches: (path106) => path106.startsWith(sessionsPrefix) && !path106.startsWith(webUiPrefix),
|
|
38530
38561
|
advice: "restart the daemon"
|
|
38531
38562
|
}
|
|
38532
38563
|
];
|
|
@@ -38537,27 +38568,27 @@ function restartAdvice(paths) {
|
|
|
38537
38568
|
// src/commands/watch/syncAdvice.ts
|
|
38538
38569
|
var rules2 = [
|
|
38539
38570
|
{
|
|
38540
|
-
matches: (
|
|
38571
|
+
matches: (path106) => path106.startsWith("claude/commands/"),
|
|
38541
38572
|
reason: "claude/commands changed"
|
|
38542
38573
|
},
|
|
38543
38574
|
{
|
|
38544
|
-
matches: (
|
|
38575
|
+
matches: (path106) => path106.startsWith("claude/skills/"),
|
|
38545
38576
|
reason: "claude/skills changed"
|
|
38546
38577
|
},
|
|
38547
38578
|
{
|
|
38548
|
-
matches: (
|
|
38579
|
+
matches: (path106) => path106 === "claude/settings.json",
|
|
38549
38580
|
reason: "claude/settings.json changed"
|
|
38550
38581
|
},
|
|
38551
38582
|
{
|
|
38552
|
-
matches: (
|
|
38583
|
+
matches: (path106) => path106 === "claude/design-system-prompt.md",
|
|
38553
38584
|
reason: "claude/design-system-prompt.md changed"
|
|
38554
38585
|
},
|
|
38555
38586
|
{
|
|
38556
|
-
matches: (
|
|
38587
|
+
matches: (path106) => path106.startsWith("codex/"),
|
|
38557
38588
|
reason: "codex sources changed"
|
|
38558
38589
|
},
|
|
38559
38590
|
{
|
|
38560
|
-
matches: (
|
|
38591
|
+
matches: (path106) => path106.startsWith("pi/"),
|
|
38561
38592
|
reason: "pi sources changed"
|
|
38562
38593
|
}
|
|
38563
38594
|
];
|
|
@@ -39208,9 +39239,9 @@ function findPortFile(roamDir) {
|
|
|
39208
39239
|
return void 0;
|
|
39209
39240
|
}
|
|
39210
39241
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
39211
|
-
const
|
|
39242
|
+
const path106 = join101(roamDir, name);
|
|
39212
39243
|
try {
|
|
39213
|
-
return { path:
|
|
39244
|
+
return { path: path106, mtimeMs: statSync13(path106).mtimeMs };
|
|
39214
39245
|
} catch {
|
|
39215
39246
|
return void 0;
|
|
39216
39247
|
}
|
|
@@ -39454,11 +39485,11 @@ function findLinkIndex() {
|
|
|
39454
39485
|
function parseLinkArgs() {
|
|
39455
39486
|
const idx = findLinkIndex();
|
|
39456
39487
|
if (idx === -1) return null;
|
|
39457
|
-
const
|
|
39488
|
+
const path106 = process.argv[idx + 1];
|
|
39458
39489
|
const rest = process.argv.slice(idx + 2);
|
|
39459
39490
|
const { value: prefix2 } = extractOption(rest, "--prefix");
|
|
39460
39491
|
if (!prefix2) return null;
|
|
39461
|
-
return { path:
|
|
39492
|
+
return { path: path106, prefix: prefix2 };
|
|
39462
39493
|
}
|
|
39463
39494
|
function hasDuplicateLink(runList, linkPath) {
|
|
39464
39495
|
return runList.some(
|
|
@@ -40103,14 +40134,14 @@ import * as pty from "node-pty";
|
|
|
40103
40134
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
40104
40135
|
import { chmodSync, existsSync as existsSync87, statSync as statSync14 } from "fs";
|
|
40105
40136
|
import { createRequire as createRequire3 } from "module";
|
|
40106
|
-
import
|
|
40137
|
+
import path102 from "path";
|
|
40107
40138
|
var require4 = createRequire3(import.meta.url);
|
|
40108
40139
|
var ensured = false;
|
|
40109
40140
|
function ensureSpawnHelperExecutable() {
|
|
40110
40141
|
if (ensured || process.platform !== "darwin") return;
|
|
40111
40142
|
ensured = true;
|
|
40112
|
-
const ptyRoot =
|
|
40113
|
-
const helper =
|
|
40143
|
+
const ptyRoot = path102.join(path102.dirname(require4.resolve("node-pty")), "..");
|
|
40144
|
+
const helper = path102.join(
|
|
40114
40145
|
ptyRoot,
|
|
40115
40146
|
"prebuilds",
|
|
40116
40147
|
`${process.platform}-${process.arch}`,
|
|
@@ -40241,12 +40272,12 @@ function serverRunMeta(runName, cwd) {
|
|
|
40241
40272
|
|
|
40242
40273
|
// src/commands/sessions/daemon/readDesignSystemPrompt.ts
|
|
40243
40274
|
import * as fs50 from "fs";
|
|
40244
|
-
import * as
|
|
40275
|
+
import * as path103 from "path";
|
|
40245
40276
|
import { fileURLToPath as fileURLToPath11 } from "url";
|
|
40246
40277
|
var __filename5 = fileURLToPath11(import.meta.url);
|
|
40247
|
-
var __dirname7 =
|
|
40278
|
+
var __dirname7 = path103.dirname(__filename5);
|
|
40248
40279
|
function readDesignSystemPrompt() {
|
|
40249
|
-
const promptPath =
|
|
40280
|
+
const promptPath = path103.join(
|
|
40250
40281
|
__dirname7,
|
|
40251
40282
|
"..",
|
|
40252
40283
|
"claude",
|
|
@@ -41280,8 +41311,8 @@ async function seedRunningMsFromUsage(session, notify2) {
|
|
|
41280
41311
|
var DEBOUNCE_MS2 = 50;
|
|
41281
41312
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
41282
41313
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
41283
|
-
const
|
|
41284
|
-
const dir = dirname42(
|
|
41314
|
+
const path106 = activityPath(session.id);
|
|
41315
|
+
const dir = dirname42(path106);
|
|
41285
41316
|
try {
|
|
41286
41317
|
mkdirSync37(dir, { recursive: true });
|
|
41287
41318
|
} catch {
|
|
@@ -41291,7 +41322,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
41291
41322
|
let timer = null;
|
|
41292
41323
|
const read3 = () => {
|
|
41293
41324
|
timer = null;
|
|
41294
|
-
const activity2 = readActivity(
|
|
41325
|
+
const activity2 = readActivity(path106);
|
|
41295
41326
|
if (!activity2) return;
|
|
41296
41327
|
applyActivityToSession(session, activity2);
|
|
41297
41328
|
if (activity2.claudeSessionId) onClaudeSessionId?.(session);
|
|
@@ -41300,11 +41331,11 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
41300
41331
|
notify2();
|
|
41301
41332
|
};
|
|
41302
41333
|
session.activityWatcher = watch2(dir, (_event, filename) => {
|
|
41303
|
-
if (filename && !
|
|
41334
|
+
if (filename && !path106.endsWith(filename)) return;
|
|
41304
41335
|
if (timer) clearTimeout(timer);
|
|
41305
41336
|
timer = setTimeout(read3, DEBOUNCE_MS2);
|
|
41306
41337
|
});
|
|
41307
|
-
if (existsSync93(
|
|
41338
|
+
if (existsSync93(path106)) read3();
|
|
41308
41339
|
}
|
|
41309
41340
|
function refreshActivity(session) {
|
|
41310
41341
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -41447,12 +41478,12 @@ import { watch as watch3 } from "fs";
|
|
|
41447
41478
|
|
|
41448
41479
|
// src/commands/sessions/shared/findTranscriptPathSync.ts
|
|
41449
41480
|
import * as fs52 from "fs";
|
|
41450
|
-
import * as
|
|
41481
|
+
import * as path104 from "path";
|
|
41451
41482
|
function projectDirForCwd(cwd) {
|
|
41452
|
-
return
|
|
41483
|
+
return path104.join(claudeProjectsRoot(), projectSlug(cwd));
|
|
41453
41484
|
}
|
|
41454
41485
|
function transcriptPathFor(cwd, claudeSessionId) {
|
|
41455
|
-
return
|
|
41486
|
+
return path104.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
|
|
41456
41487
|
}
|
|
41457
41488
|
function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
41458
41489
|
const direct = transcriptPathFor(cwd, claudeSessionId);
|
|
@@ -41466,8 +41497,8 @@ function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
|
41466
41497
|
}
|
|
41467
41498
|
for (const file of files) {
|
|
41468
41499
|
if (!file.endsWith(".jsonl")) continue;
|
|
41469
|
-
if (headContainsSessionId(
|
|
41470
|
-
return
|
|
41500
|
+
if (headContainsSessionId(path104.join(dir, file), claudeSessionId))
|
|
41501
|
+
return path104.join(dir, file);
|
|
41471
41502
|
}
|
|
41472
41503
|
return null;
|
|
41473
41504
|
}
|
|
@@ -42667,9 +42698,9 @@ function tempRoots() {
|
|
|
42667
42698
|
}
|
|
42668
42699
|
return [...roots];
|
|
42669
42700
|
}
|
|
42670
|
-
function underTempRoot(
|
|
42701
|
+
function underTempRoot(path106) {
|
|
42671
42702
|
return tempRoots().some(
|
|
42672
|
-
(root2) =>
|
|
42703
|
+
(root2) => path106.startsWith(root2.endsWith(sep3) ? root2 : root2 + sep3)
|
|
42673
42704
|
);
|
|
42674
42705
|
}
|
|
42675
42706
|
|
|
@@ -43155,15 +43186,15 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
43155
43186
|
import { existsSync as existsSync95 } from "fs";
|
|
43156
43187
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
43157
43188
|
if (!existsSync95(clone)) {
|
|
43158
|
-
for (const { path:
|
|
43189
|
+
for (const { path: path106 } of paths) forgetWorktree(path106);
|
|
43159
43190
|
daemonLog(
|
|
43160
43191
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
43161
43192
|
);
|
|
43162
43193
|
return;
|
|
43163
43194
|
}
|
|
43164
43195
|
await pruneBookkeeping2(clone);
|
|
43165
|
-
for (const { path:
|
|
43166
|
-
if (await reclaimBranch(clone, branch2)) forgetWorktree(
|
|
43196
|
+
for (const { path: path106, branch: branch2 } of paths)
|
|
43197
|
+
if (await reclaimBranch(clone, branch2)) forgetWorktree(path106);
|
|
43167
43198
|
}
|
|
43168
43199
|
async function pruneBookkeeping2(clone) {
|
|
43169
43200
|
try {
|
|
@@ -43190,37 +43221,37 @@ async function reclaimBranch(clone, branch2) {
|
|
|
43190
43221
|
}
|
|
43191
43222
|
|
|
43192
43223
|
// src/commands/sessions/daemon/worktree/logVanishedTree.ts
|
|
43193
|
-
function logVanishedTree(sessions,
|
|
43224
|
+
function logVanishedTree(sessions, path106) {
|
|
43194
43225
|
const claimants = [...sessions.values()].filter(
|
|
43195
|
-
(s) => s.cwd ===
|
|
43226
|
+
(s) => s.cwd === path106 || s.worktree?.path === path106
|
|
43196
43227
|
);
|
|
43197
43228
|
if (claimants.length === 0) {
|
|
43198
|
-
daemonLog(`worktree ${
|
|
43229
|
+
daemonLog(`worktree ${path106} gone from disk and unclaimed; reclaiming it`);
|
|
43199
43230
|
return;
|
|
43200
43231
|
}
|
|
43201
43232
|
for (const s of claimants)
|
|
43202
43233
|
daemonLog(
|
|
43203
|
-
`session ${s.id} ("${s.name}") claims worktree ${
|
|
43234
|
+
`session ${s.id} ("${s.name}") claims worktree ${path106}, which is gone from disk; reclaiming it`
|
|
43204
43235
|
);
|
|
43205
43236
|
}
|
|
43206
43237
|
|
|
43207
43238
|
// src/commands/sessions/daemon/worktree/describeHeldWork.ts
|
|
43208
43239
|
var MAX_ITEMS = 20;
|
|
43209
|
-
async function describeHeldWork(
|
|
43210
|
-
if (reason4.startsWith("uncommitted")) return await changedFiles(
|
|
43211
|
-
if (reason4.startsWith("unpushed")) return await unpushedCommits(
|
|
43240
|
+
async function describeHeldWork(path106, reason4) {
|
|
43241
|
+
if (reason4.startsWith("uncommitted")) return await changedFiles(path106);
|
|
43242
|
+
if (reason4.startsWith("unpushed")) return await unpushedCommits(path106, reason4);
|
|
43212
43243
|
return { summary: reason4, items: [] };
|
|
43213
43244
|
}
|
|
43214
|
-
async function changedFiles(
|
|
43215
|
-
const status3 = await gitResult(
|
|
43245
|
+
async function changedFiles(path106) {
|
|
43246
|
+
const status3 = await gitResult(path106, ["status", "--porcelain"]);
|
|
43216
43247
|
const lines2 = status3.ok ? nonEmptyLines(status3.out) : [];
|
|
43217
43248
|
return {
|
|
43218
43249
|
summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
|
|
43219
43250
|
items: capped2(lines2)
|
|
43220
43251
|
};
|
|
43221
43252
|
}
|
|
43222
|
-
async function unpushedCommits(
|
|
43223
|
-
const log2 = await gitResult(
|
|
43253
|
+
async function unpushedCommits(path106, reason4) {
|
|
43254
|
+
const log2 = await gitResult(path106, ["log", "--oneline", "@{upstream}..HEAD"]);
|
|
43224
43255
|
if (!log2.ok) return { summary: reason4, items: [] };
|
|
43225
43256
|
const lines2 = nonEmptyLines(log2.out);
|
|
43226
43257
|
return {
|
|
@@ -43312,24 +43343,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
|
|
|
43312
43343
|
async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
43313
43344
|
const accounted = accountedTrees(sessions);
|
|
43314
43345
|
const vanished = /* @__PURE__ */ new Map();
|
|
43315
|
-
for (const { path:
|
|
43316
|
-
if (underTempRoot(
|
|
43317
|
-
forgetWorktree(
|
|
43346
|
+
for (const { path: path106, clone } of readWorktreeRegistry()) {
|
|
43347
|
+
if (underTempRoot(path106)) {
|
|
43348
|
+
forgetWorktree(path106);
|
|
43318
43349
|
daemonLog(
|
|
43319
|
-
`worktree ${
|
|
43350
|
+
`worktree ${path106} lies outside any project root; pruned from the registry rather than recovered`
|
|
43320
43351
|
);
|
|
43321
43352
|
continue;
|
|
43322
43353
|
}
|
|
43323
|
-
if (!existsSync96(
|
|
43324
|
-
logVanishedTree(sessions,
|
|
43354
|
+
if (!existsSync96(path106)) {
|
|
43355
|
+
logVanishedTree(sessions, path106);
|
|
43325
43356
|
vanished.set(clone, [
|
|
43326
43357
|
...vanished.get(clone) ?? [],
|
|
43327
|
-
{ path:
|
|
43358
|
+
{ path: path106, branch: basename29(path106) }
|
|
43328
43359
|
]);
|
|
43329
43360
|
continue;
|
|
43330
43361
|
}
|
|
43331
|
-
if (accounted.has(
|
|
43332
|
-
await recoverOrphan(sessions, spawnWith, { path:
|
|
43362
|
+
if (accounted.has(path106)) continue;
|
|
43363
|
+
await recoverOrphan(sessions, spawnWith, { path: path106, clone }, notify2);
|
|
43333
43364
|
}
|
|
43334
43365
|
for (const [clone, paths] of vanished)
|
|
43335
43366
|
await reclaimVanishedWorktrees(clone, paths);
|
|
@@ -45407,12 +45438,12 @@ function handleSetStatus(client, m, d) {
|
|
|
45407
45438
|
import * as fs56 from "fs";
|
|
45408
45439
|
|
|
45409
45440
|
// src/commands/sessions/shared/codex/findCodexRolloutPath.ts
|
|
45410
|
-
import * as
|
|
45441
|
+
import * as path105 from "path";
|
|
45411
45442
|
async function findCodexRolloutPath(sessionId) {
|
|
45412
45443
|
if (!sessionId) return null;
|
|
45413
45444
|
const paths = await discoverCodexRolloutPaths();
|
|
45414
45445
|
const suffix = `-${sessionId}.jsonl`;
|
|
45415
|
-
return paths.find((file) =>
|
|
45446
|
+
return paths.find((file) => path105.basename(file).endsWith(suffix)) ?? null;
|
|
45416
45447
|
}
|
|
45417
45448
|
|
|
45418
45449
|
// src/commands/sessions/shared/codex/codexToolTarget.ts
|
|
@@ -45995,13 +46026,13 @@ function describePeerError(error) {
|
|
|
45995
46026
|
const cause = error.cause;
|
|
45996
46027
|
return cause instanceof Error ? `${error.message}: ${describePeerError(cause)}` : error.message;
|
|
45997
46028
|
}
|
|
45998
|
-
async function fetchPeerJson(baseUrl,
|
|
45999
|
-
const res = await fetch(new URL(
|
|
46029
|
+
async function fetchPeerJson(baseUrl, path106, timeoutMs = PEER_TIMEOUT_MS) {
|
|
46030
|
+
const res = await fetch(new URL(path106, baseUrl), {
|
|
46000
46031
|
signal: AbortSignal.timeout(timeoutMs)
|
|
46001
46032
|
});
|
|
46002
46033
|
if (!res.ok)
|
|
46003
46034
|
throw Object.assign(
|
|
46004
|
-
new Error(`GET ${
|
|
46035
|
+
new Error(`GET ${path106} returned ${res.status} ${res.statusText}`),
|
|
46005
46036
|
{ status: res.status }
|
|
46006
46037
|
);
|
|
46007
46038
|
return await res.json();
|