@staff0rd/assist 0.694.4 → 0.695.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/claude/commands/restructure.md +3 -2
- package/dist/commands/sessions/web/bundle.js +412 -412
- package/dist/index.js +584 -553
- 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.695.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -296,8 +296,8 @@ function getRemoteOriginUrl(cwd) {
|
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
// src/commands/backlog/getCurrentOrigin.ts
|
|
299
|
-
function stripLeadingSlashes(
|
|
300
|
-
return
|
|
299
|
+
function stripLeadingSlashes(path103) {
|
|
300
|
+
return path103.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(path103) {
|
|
351
351
|
try {
|
|
352
|
-
return statSync(
|
|
352
|
+
return statSync(path103).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(path103) {
|
|
372
372
|
try {
|
|
373
|
-
const content = readFileSync2(
|
|
373
|
+
const content = readFileSync2(path103, "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(path103) {
|
|
387
|
+
if (!existsSync3(path103)) return {};
|
|
388
388
|
try {
|
|
389
|
-
const content = readFileSync3(
|
|
389
|
+
const content = readFileSync3(path103, "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 path103 = origin.slice("local:".length).replace(/\/+$/, "");
|
|
462
|
+
const segments = path103.split("/").filter(Boolean);
|
|
463
463
|
return segments[segments.length - 1] ?? origin;
|
|
464
464
|
}
|
|
465
465
|
const firstSlash = origin.indexOf("/");
|
|
@@ -681,7 +681,8 @@ var assistConfigShape = {
|
|
|
681
681
|
ignore: z3.array(z3.string()).default([])
|
|
682
682
|
}).optional(),
|
|
683
683
|
restructure: z3.strictObject({
|
|
684
|
-
ignore: z3.array(z3.string()).default([])
|
|
684
|
+
ignore: z3.array(z3.string()).default([]),
|
|
685
|
+
pin: z3.array(z3.string()).default([])
|
|
685
686
|
}).optional(),
|
|
686
687
|
jira: z3.strictObject({
|
|
687
688
|
acField: z3.string().default("customfield_11937")
|
|
@@ -3965,9 +3966,9 @@ function groupColumns(rows) {
|
|
|
3965
3966
|
}
|
|
3966
3967
|
|
|
3967
3968
|
// src/commands/backlog/dump/orderDumpTables.ts
|
|
3968
|
-
function buildGraph(
|
|
3969
|
-
const present = new Set(
|
|
3970
|
-
const indegree = new Map(
|
|
3969
|
+
function buildGraph(names, edges) {
|
|
3970
|
+
const present = new Set(names);
|
|
3971
|
+
const indegree = new Map(names.map((n) => [n, 0]));
|
|
3971
3972
|
const children = /* @__PURE__ */ new Map();
|
|
3972
3973
|
for (const { child, parent } of edges) {
|
|
3973
3974
|
if (!present.has(child) || !present.has(parent)) continue;
|
|
@@ -3976,17 +3977,17 @@ function buildGraph(names2, edges) {
|
|
|
3976
3977
|
}
|
|
3977
3978
|
return { indegree, children };
|
|
3978
3979
|
}
|
|
3979
|
-
function nextReady(
|
|
3980
|
-
return
|
|
3980
|
+
function nextReady(names, emitted, indegree) {
|
|
3981
|
+
return names.find((n) => !emitted.has(n) && (indegree.get(n) ?? 0) === 0);
|
|
3981
3982
|
}
|
|
3982
3983
|
function topoSort(entries, edges) {
|
|
3983
|
-
const
|
|
3984
|
-
const { indegree, children } = buildGraph(
|
|
3984
|
+
const names = entries.map((e) => e.raw);
|
|
3985
|
+
const { indegree, children } = buildGraph(names, edges);
|
|
3985
3986
|
const byRaw = new Map(entries.map((e) => [e.raw, e.table]));
|
|
3986
3987
|
const ordered = [];
|
|
3987
3988
|
const emitted = /* @__PURE__ */ new Set();
|
|
3988
3989
|
while (ordered.length < entries.length) {
|
|
3989
|
-
const next3 = nextReady(
|
|
3990
|
+
const next3 = nextReady(names, emitted, indegree);
|
|
3990
3991
|
if (!next3)
|
|
3991
3992
|
throw new Error("Cannot dump: foreign-key cycle between tables.");
|
|
3992
3993
|
emitted.add(next3);
|
|
@@ -4293,8 +4294,8 @@ function getPreferredRemoteRepo(cwd) {
|
|
|
4293
4294
|
function gitRefUrl(kind, ref, cwd) {
|
|
4294
4295
|
const repo = getPreferredRemoteRepo(cwd);
|
|
4295
4296
|
if (!repo) return void 0;
|
|
4296
|
-
const
|
|
4297
|
-
return `https://github.com/${repo.org}/${repo.repo}/${
|
|
4297
|
+
const path103 = kind === "branch" ? "tree" : "commit";
|
|
4298
|
+
return `https://github.com/${repo.org}/${repo.repo}/${path103}/${ref}`;
|
|
4298
4299
|
}
|
|
4299
4300
|
|
|
4300
4301
|
// src/commands/sessions/shared/resolveSessionTranscript.ts
|
|
@@ -4455,9 +4456,9 @@ var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
|
|
|
4455
4456
|
function backupLocalBacklogFiles(dir) {
|
|
4456
4457
|
const moved = [];
|
|
4457
4458
|
for (const name of LOCAL_FILES) {
|
|
4458
|
-
const
|
|
4459
|
-
if (existsSync20(
|
|
4460
|
-
renameSync(
|
|
4459
|
+
const path103 = join19(dir, ".assist", name);
|
|
4460
|
+
if (existsSync20(path103)) {
|
|
4461
|
+
renameSync(path103, `${path103}.bak`);
|
|
4461
4462
|
moved.push(`${name} \u2192 ${name}.bak`);
|
|
4462
4463
|
}
|
|
4463
4464
|
}
|
|
@@ -4941,8 +4942,8 @@ var backlogItemSchema = z4.strictObject({
|
|
|
4941
4942
|
var backlogFileSchema = z4.array(backlogItemSchema);
|
|
4942
4943
|
|
|
4943
4944
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
4944
|
-
function parseBacklogJsonl(
|
|
4945
|
-
const content = readFileSync13(
|
|
4945
|
+
function parseBacklogJsonl(path103) {
|
|
4946
|
+
const content = readFileSync13(path103, "utf8").trim();
|
|
4946
4947
|
if (content.length === 0) return [];
|
|
4947
4948
|
return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
|
|
4948
4949
|
}
|
|
@@ -5488,9 +5489,9 @@ function originToSshUrl(origin) {
|
|
|
5488
5489
|
const firstSlash = origin.indexOf("/");
|
|
5489
5490
|
if (firstSlash <= 0) return null;
|
|
5490
5491
|
const host = origin.slice(0, firstSlash);
|
|
5491
|
-
const
|
|
5492
|
-
if (!
|
|
5493
|
-
return `git@${host}:${
|
|
5492
|
+
const path103 = origin.slice(firstSlash + 1);
|
|
5493
|
+
if (!path103) return null;
|
|
5494
|
+
return `git@${host}:${path103}.git`;
|
|
5494
5495
|
}
|
|
5495
5496
|
|
|
5496
5497
|
// src/commands/backlog/cloneRepo.ts
|
|
@@ -7128,10 +7129,10 @@ var hooksSettings = {
|
|
|
7128
7129
|
}
|
|
7129
7130
|
};
|
|
7130
7131
|
function ensureHooksSettings() {
|
|
7131
|
-
const
|
|
7132
|
-
mkdirSync5(dirname15(
|
|
7133
|
-
writeFileSync16(
|
|
7134
|
-
return
|
|
7132
|
+
const path103 = daemonPaths.hooksSettings;
|
|
7133
|
+
mkdirSync5(dirname15(path103), { recursive: true });
|
|
7134
|
+
writeFileSync16(path103, JSON.stringify(hooksSettings, null, 2));
|
|
7135
|
+
return path103;
|
|
7135
7136
|
}
|
|
7136
7137
|
|
|
7137
7138
|
// src/shared/spawnInherit.ts
|
|
@@ -7887,24 +7888,24 @@ function getOwnerPath(itemId2) {
|
|
|
7887
7888
|
function recordSignalOwner(itemId2) {
|
|
7888
7889
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
7889
7890
|
if (!sessionId) return;
|
|
7890
|
-
const
|
|
7891
|
-
mkdirSync7(dirname16(
|
|
7892
|
-
writeFileSync18(
|
|
7891
|
+
const path103 = getOwnerPath(itemId2);
|
|
7892
|
+
mkdirSync7(dirname16(path103), { recursive: true });
|
|
7893
|
+
writeFileSync18(path103, JSON.stringify({ sessionId }));
|
|
7893
7894
|
}
|
|
7894
7895
|
function readSignalOwner(itemId2) {
|
|
7895
|
-
const
|
|
7896
|
-
if (!existsSync26(
|
|
7896
|
+
const path103 = getOwnerPath(itemId2);
|
|
7897
|
+
if (!existsSync26(path103)) return void 0;
|
|
7897
7898
|
try {
|
|
7898
|
-
const parsed = JSON.parse(readFileSync17(
|
|
7899
|
+
const parsed = JSON.parse(readFileSync17(path103, "utf8"));
|
|
7899
7900
|
return parsed.sessionId;
|
|
7900
7901
|
} catch {
|
|
7901
7902
|
return void 0;
|
|
7902
7903
|
}
|
|
7903
7904
|
}
|
|
7904
7905
|
function clearSignalOwner(itemId2) {
|
|
7905
|
-
const
|
|
7906
|
+
const path103 = getOwnerPath(itemId2);
|
|
7906
7907
|
try {
|
|
7907
|
-
rmSync(
|
|
7908
|
+
rmSync(path103);
|
|
7908
7909
|
} catch {
|
|
7909
7910
|
}
|
|
7910
7911
|
}
|
|
@@ -7941,19 +7942,19 @@ function resolveSignalTarget(event, data) {
|
|
|
7941
7942
|
function writeSignal(event, data) {
|
|
7942
7943
|
const target = resolveSignalTarget(event, data);
|
|
7943
7944
|
if (!target) return;
|
|
7944
|
-
const
|
|
7945
|
-
if (!
|
|
7945
|
+
const path103 = getSignalPath(target);
|
|
7946
|
+
if (!path103) return;
|
|
7946
7947
|
const signal = { event, sessionId: target, ...data };
|
|
7947
|
-
mkdirSync8(dirname17(
|
|
7948
|
-
writeFileSync19(
|
|
7948
|
+
mkdirSync8(dirname17(path103), { recursive: true });
|
|
7949
|
+
writeFileSync19(path103, JSON.stringify(signal));
|
|
7949
7950
|
}
|
|
7950
7951
|
|
|
7951
7952
|
// src/commands/backlog/readSignal.ts
|
|
7952
7953
|
function readSignal() {
|
|
7953
|
-
const
|
|
7954
|
-
if (!
|
|
7954
|
+
const path103 = getSignalPath();
|
|
7955
|
+
if (!path103 || !existsSync27(path103)) return void 0;
|
|
7955
7956
|
try {
|
|
7956
|
-
return JSON.parse(readFileSync18(
|
|
7957
|
+
return JSON.parse(readFileSync18(path103, "utf8"));
|
|
7957
7958
|
} catch {
|
|
7958
7959
|
return void 0;
|
|
7959
7960
|
}
|
|
@@ -8151,13 +8152,13 @@ function activityPath(sessionId) {
|
|
|
8151
8152
|
function emitActivity(activity2) {
|
|
8152
8153
|
const sessionId = process.env.ASSIST_ACTIVITY_ID;
|
|
8153
8154
|
if (!sessionId) return;
|
|
8154
|
-
const
|
|
8155
|
-
mkdirSync9(dirname18(
|
|
8156
|
-
writeFileSync20(
|
|
8155
|
+
const path103 = activityPath(sessionId);
|
|
8156
|
+
mkdirSync9(dirname18(path103), { recursive: true });
|
|
8157
|
+
writeFileSync20(path103, JSON.stringify({ ...activity2, startedAt: Date.now() }));
|
|
8157
8158
|
}
|
|
8158
|
-
function readActivity(
|
|
8159
|
+
function readActivity(path103) {
|
|
8159
8160
|
try {
|
|
8160
|
-
return JSON.parse(readFileSync19(
|
|
8161
|
+
return JSON.parse(readFileSync19(path103, "utf8"));
|
|
8161
8162
|
} catch {
|
|
8162
8163
|
return void 0;
|
|
8163
8164
|
}
|
|
@@ -8167,9 +8168,9 @@ function reconcileActivity(sessionId, activity2) {
|
|
|
8167
8168
|
removeActivity(sessionId);
|
|
8168
8169
|
return;
|
|
8169
8170
|
}
|
|
8170
|
-
const
|
|
8171
|
-
mkdirSync9(dirname18(
|
|
8172
|
-
writeFileSync20(
|
|
8171
|
+
const path103 = activityPath(sessionId);
|
|
8172
|
+
mkdirSync9(dirname18(path103), { recursive: true });
|
|
8173
|
+
writeFileSync20(path103, JSON.stringify(activity2));
|
|
8173
8174
|
}
|
|
8174
8175
|
function removeActivity(sessionId) {
|
|
8175
8176
|
try {
|
|
@@ -10822,10 +10823,10 @@ function getStorePath(filename) {
|
|
|
10822
10823
|
return join34(getStoreDir(), filename);
|
|
10823
10824
|
}
|
|
10824
10825
|
function loadJson(filename) {
|
|
10825
|
-
const
|
|
10826
|
-
if (existsSync32(
|
|
10826
|
+
const path103 = getStorePath(filename);
|
|
10827
|
+
if (existsSync32(path103)) {
|
|
10827
10828
|
try {
|
|
10828
|
-
return JSON.parse(readFileSync20(
|
|
10829
|
+
return JSON.parse(readFileSync20(path103, "utf8"));
|
|
10829
10830
|
} catch {
|
|
10830
10831
|
return {};
|
|
10831
10832
|
}
|
|
@@ -10844,22 +10845,22 @@ function saveJson(filename, data) {
|
|
|
10844
10845
|
var REGISTRY_FILE = "worktrees.json";
|
|
10845
10846
|
function readWorktreeRegistry() {
|
|
10846
10847
|
const data = loadJson(REGISTRY_FILE);
|
|
10847
|
-
return Object.entries(data).filter(([, record]) => !record.reaped).map(([
|
|
10848
|
+
return Object.entries(data).filter(([, record]) => !record.reaped).map(([path103, record]) => ({ path: path103, ...record }));
|
|
10848
10849
|
}
|
|
10849
|
-
function worktreeAttributionIncludingReaped(
|
|
10850
|
-
const record = loadJson(REGISTRY_FILE)[
|
|
10850
|
+
function worktreeAttributionIncludingReaped(path103) {
|
|
10851
|
+
const record = loadJson(REGISTRY_FILE)[path103];
|
|
10851
10852
|
return record ? { clone: record.clone, origin: record.origin } : void 0;
|
|
10852
10853
|
}
|
|
10853
|
-
function recordWorktree(
|
|
10854
|
+
function recordWorktree(path103, clone, origin) {
|
|
10854
10855
|
const data = loadJson(REGISTRY_FILE);
|
|
10855
|
-
data[
|
|
10856
|
+
data[path103] = { clone, origin };
|
|
10856
10857
|
saveJson(REGISTRY_FILE, data);
|
|
10857
10858
|
}
|
|
10858
|
-
function forgetWorktree(
|
|
10859
|
+
function forgetWorktree(path103) {
|
|
10859
10860
|
const data = loadJson(REGISTRY_FILE);
|
|
10860
|
-
const record = data[
|
|
10861
|
+
const record = data[path103];
|
|
10861
10862
|
if (!record || record.reaped) return;
|
|
10862
|
-
data[
|
|
10863
|
+
data[path103] = { ...record, reaped: true };
|
|
10863
10864
|
saveJson(REGISTRY_FILE, data);
|
|
10864
10865
|
}
|
|
10865
10866
|
|
|
@@ -11515,8 +11516,8 @@ async function loadCommittedPaths(cwd, sessionId) {
|
|
|
11515
11516
|
for (const commit2 of commits2) {
|
|
11516
11517
|
const resolved = await resolveCommit(cwd, commit2.sha);
|
|
11517
11518
|
if (!resolved) continue;
|
|
11518
|
-
for (const
|
|
11519
|
-
if (!bases.has(
|
|
11519
|
+
for (const path103 of resolved.paths) {
|
|
11520
|
+
if (!bases.has(path103)) bases.set(path103, resolved.base);
|
|
11520
11521
|
}
|
|
11521
11522
|
}
|
|
11522
11523
|
return { commits: commits2, bases };
|
|
@@ -11534,16 +11535,16 @@ async function itemChangeSet(cwd, sessionId) {
|
|
|
11534
11535
|
}
|
|
11535
11536
|
function groupByBase(bases) {
|
|
11536
11537
|
const groups = /* @__PURE__ */ new Map();
|
|
11537
|
-
for (const [
|
|
11538
|
+
for (const [path103, base] of bases) {
|
|
11538
11539
|
const paths = groups.get(base);
|
|
11539
|
-
if (paths) paths.push(
|
|
11540
|
-
else groups.set(base, [
|
|
11540
|
+
if (paths) paths.push(path103);
|
|
11541
|
+
else groups.set(base, [path103]);
|
|
11541
11542
|
}
|
|
11542
11543
|
return [...groups].map(([base, paths]) => ({ base, paths: paths.sort() }));
|
|
11543
11544
|
}
|
|
11544
11545
|
async function dirtyPaths(cwd, bases) {
|
|
11545
11546
|
const output = await execGit(cwd, ["diff", "--name-only", "HEAD"]);
|
|
11546
|
-
return output.split("\n").filter((
|
|
11547
|
+
return output.split("\n").filter((path103) => path103 && !bases.has(path103)).sort();
|
|
11547
11548
|
}
|
|
11548
11549
|
|
|
11549
11550
|
// src/commands/sessions/web/scopedDiff.ts
|
|
@@ -11552,8 +11553,8 @@ async function scopedDiff(cwd, session, scope) {
|
|
|
11552
11553
|
if (scope.kind === "commit") return commitDiff(cwd, scope.sha);
|
|
11553
11554
|
return await trackedScopeDiff(cwd, session, scope) + await untrackedDiff(cwd);
|
|
11554
11555
|
}
|
|
11555
|
-
async function untrackedFileDiff(cwd,
|
|
11556
|
-
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null",
|
|
11556
|
+
async function untrackedFileDiff(cwd, path103) {
|
|
11557
|
+
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path103], {
|
|
11557
11558
|
maxBuffer: MAX_DIFF_BYTES,
|
|
11558
11559
|
allowFailure: true
|
|
11559
11560
|
});
|
|
@@ -11566,7 +11567,7 @@ async function untrackedDiff(cwd) {
|
|
|
11566
11567
|
]);
|
|
11567
11568
|
const paths = list5.split("\n").filter(Boolean);
|
|
11568
11569
|
const diffs = await Promise.all(
|
|
11569
|
-
paths.map((
|
|
11570
|
+
paths.map((path103) => untrackedFileDiff(cwd, path103))
|
|
11570
11571
|
);
|
|
11571
11572
|
return diffs.join("");
|
|
11572
11573
|
}
|
|
@@ -11659,9 +11660,9 @@ import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve10
|
|
|
11659
11660
|
function repoRoot(cwd) {
|
|
11660
11661
|
return resolve10(toGitCwd(cwd));
|
|
11661
11662
|
}
|
|
11662
|
-
function resolveWithinCwd(cwd,
|
|
11663
|
+
function resolveWithinCwd(cwd, path103) {
|
|
11663
11664
|
const root2 = repoRoot(cwd);
|
|
11664
|
-
const target = resolve10(root2,
|
|
11665
|
+
const target = resolve10(root2, path103);
|
|
11665
11666
|
const rel = relative2(root2, target);
|
|
11666
11667
|
if (rel === "" || rel.startsWith("..") || isAbsolute2(rel)) return null;
|
|
11667
11668
|
return target;
|
|
@@ -11671,14 +11672,14 @@ function resolveWithinCwd(cwd, path101) {
|
|
|
11671
11672
|
function getFileTarget(req, res) {
|
|
11672
11673
|
const cwd = getCwdParam(req, res);
|
|
11673
11674
|
if (!cwd) return null;
|
|
11674
|
-
const
|
|
11675
|
+
const path103 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
|
|
11675
11676
|
"path"
|
|
11676
11677
|
);
|
|
11677
|
-
if (!
|
|
11678
|
+
if (!path103) {
|
|
11678
11679
|
respondJson(res, 400, { error: "Missing path" });
|
|
11679
11680
|
return null;
|
|
11680
11681
|
}
|
|
11681
|
-
const target = resolveWithinCwd(cwd,
|
|
11682
|
+
const target = resolveWithinCwd(cwd, path103);
|
|
11682
11683
|
if (!target) {
|
|
11683
11684
|
respondJson(res, 400, { error: "Path outside cwd" });
|
|
11684
11685
|
return null;
|
|
@@ -11767,9 +11768,9 @@ function segmentText(segment) {
|
|
|
11767
11768
|
if (segment.kind === "index") return `[${segment.index}]`;
|
|
11768
11769
|
return "[]";
|
|
11769
11770
|
}
|
|
11770
|
-
function formatConfigPath(
|
|
11771
|
+
function formatConfigPath(path103) {
|
|
11771
11772
|
let text18 = "";
|
|
11772
|
-
for (const segment of
|
|
11773
|
+
for (const segment of path103) {
|
|
11773
11774
|
const dotted = segment.kind === "key" || segment.kind === "entry";
|
|
11774
11775
|
const rendered = segmentText(segment);
|
|
11775
11776
|
text18 += dotted && text18 ? `.${rendered}` : rendered;
|
|
@@ -11930,11 +11931,11 @@ function enumValues(node) {
|
|
|
11930
11931
|
function opaqueConfigNode(inner, base) {
|
|
11931
11932
|
return { ...base, kind: "other", type: leafTypeOf(inner) };
|
|
11932
11933
|
}
|
|
11933
|
-
function build(node,
|
|
11934
|
+
function build(node, path103) {
|
|
11934
11935
|
const { inner, defaultValue, optional } = unwrapSchemaNode(node);
|
|
11935
11936
|
const secret = isSecretSchemaNode(node) || isSecretSchemaNode(inner);
|
|
11936
11937
|
const base = {
|
|
11937
|
-
path:
|
|
11938
|
+
path: path103,
|
|
11938
11939
|
...optional ? { optional: true } : {},
|
|
11939
11940
|
...defaultValue === void 0 ? {} : { defaultValue },
|
|
11940
11941
|
...secret ? { secret: true } : {}
|
|
@@ -11990,11 +11991,11 @@ function describeConfigLeaves(schema2) {
|
|
|
11990
11991
|
|
|
11991
11992
|
// src/commands/config/globalConfigFileLabel.ts
|
|
11992
11993
|
var WINDOWS_MOUNT_PREFIX = "/mnt/";
|
|
11993
|
-
function globalConfigFileLabel(
|
|
11994
|
-
if (
|
|
11995
|
-
if (
|
|
11996
|
-
return `${
|
|
11997
|
-
return
|
|
11994
|
+
function globalConfigFileLabel(path103) {
|
|
11995
|
+
if (path103 === getGlobalConfigPath()) return "~/.assist.yml";
|
|
11996
|
+
if (path103.startsWith(WINDOWS_MOUNT_PREFIX))
|
|
11997
|
+
return `${path103} on the Windows host`;
|
|
11998
|
+
return path103;
|
|
11998
11999
|
}
|
|
11999
12000
|
|
|
12000
12001
|
// src/commands/config/readRawConfigLayers.ts
|
|
@@ -12051,35 +12052,35 @@ function isPlainRecord(value) {
|
|
|
12051
12052
|
}
|
|
12052
12053
|
|
|
12053
12054
|
// src/shared/mapConfigSecrets.ts
|
|
12054
|
-
function mapChildren(value,
|
|
12055
|
+
function mapChildren(value, path103, childNode, map) {
|
|
12055
12056
|
if (!isPlainRecord(value)) return value;
|
|
12056
12057
|
return Object.fromEntries(
|
|
12057
12058
|
Object.entries(value).map(([name, child]) => [
|
|
12058
12059
|
name,
|
|
12059
|
-
walk(child, [...
|
|
12060
|
+
walk(child, [...path103, name], childNode(name), map)
|
|
12060
12061
|
])
|
|
12061
12062
|
);
|
|
12062
12063
|
}
|
|
12063
|
-
function mapItems(value,
|
|
12064
|
+
function mapItems(value, path103, item, map) {
|
|
12064
12065
|
if (!Array.isArray(value)) return value;
|
|
12065
|
-
return value.map((entry, index3) => walk(entry, [...
|
|
12066
|
+
return value.map((entry, index3) => walk(entry, [...path103, index3], item, map));
|
|
12066
12067
|
}
|
|
12067
|
-
function walk(value,
|
|
12068
|
+
function walk(value, path103, node, map) {
|
|
12068
12069
|
if (!node || value === void 0 || value === null) return value;
|
|
12069
|
-
if (node.secret) return map(value,
|
|
12070
|
+
if (node.secret) return map(value, path103);
|
|
12070
12071
|
switch (node.kind) {
|
|
12071
12072
|
case "object":
|
|
12072
12073
|
case "unionOfObjects":
|
|
12073
12074
|
return mapChildren(
|
|
12074
12075
|
value,
|
|
12075
|
-
|
|
12076
|
+
path103,
|
|
12076
12077
|
(name) => configNodeField(node, name),
|
|
12077
12078
|
map
|
|
12078
12079
|
);
|
|
12079
12080
|
case "objectList":
|
|
12080
|
-
return mapItems(value,
|
|
12081
|
+
return mapItems(value, path103, node.item, map);
|
|
12081
12082
|
case "record":
|
|
12082
|
-
return mapChildren(value,
|
|
12083
|
+
return mapChildren(value, path103, () => node.value, map);
|
|
12083
12084
|
default:
|
|
12084
12085
|
return value;
|
|
12085
12086
|
}
|
|
@@ -12104,9 +12105,9 @@ function isTraversable(value) {
|
|
|
12104
12105
|
function stepInto(current, key) {
|
|
12105
12106
|
return isTraversable(current) ? current[key] : void 0;
|
|
12106
12107
|
}
|
|
12107
|
-
function getNestedValue(obj,
|
|
12108
|
+
function getNestedValue(obj, path103) {
|
|
12108
12109
|
let current = obj;
|
|
12109
|
-
for (const key of
|
|
12110
|
+
for (const key of path103.split(".")) current = stepInto(current, key);
|
|
12110
12111
|
return current;
|
|
12111
12112
|
}
|
|
12112
12113
|
|
|
@@ -12156,9 +12157,9 @@ function step(node, segment) {
|
|
|
12156
12157
|
return void 0;
|
|
12157
12158
|
}
|
|
12158
12159
|
}
|
|
12159
|
-
function findConfigNode(root2,
|
|
12160
|
+
function findConfigNode(root2, path103) {
|
|
12160
12161
|
let current = root2;
|
|
12161
|
-
for (const segment of
|
|
12162
|
+
for (const segment of path103) {
|
|
12162
12163
|
if (!current) return void 0;
|
|
12163
12164
|
current = step(current, segment);
|
|
12164
12165
|
}
|
|
@@ -12175,34 +12176,34 @@ function nameSegment(name) {
|
|
|
12175
12176
|
return name === RECORD_ENTRY_TOKEN ? { kind: "entry" } : { kind: "key", name };
|
|
12176
12177
|
}
|
|
12177
12178
|
function parseConfigPath(text18) {
|
|
12178
|
-
const
|
|
12179
|
+
const path103 = [];
|
|
12179
12180
|
let at2 = 0;
|
|
12180
12181
|
while (at2 < text18.length) {
|
|
12181
12182
|
if (text18[at2] === "[") {
|
|
12182
12183
|
const close = text18.indexOf("]", at2);
|
|
12183
12184
|
const segment = close === -1 ? void 0 : bracketSegment(text18.slice(at2 + 1, close));
|
|
12184
12185
|
if (!segment) return void 0;
|
|
12185
|
-
|
|
12186
|
+
path103.push(segment);
|
|
12186
12187
|
at2 = close + 1;
|
|
12187
12188
|
continue;
|
|
12188
12189
|
}
|
|
12189
12190
|
if (text18[at2] === ".") {
|
|
12190
|
-
if (
|
|
12191
|
+
if (path103.length === 0) return void 0;
|
|
12191
12192
|
at2 += 1;
|
|
12192
12193
|
}
|
|
12193
12194
|
const start3 = at2;
|
|
12194
12195
|
while (at2 < text18.length && text18[at2] !== "." && text18[at2] !== "[") at2 += 1;
|
|
12195
12196
|
const name = text18.slice(start3, at2);
|
|
12196
12197
|
if (!name) return void 0;
|
|
12197
|
-
|
|
12198
|
+
path103.push(nameSegment(name));
|
|
12198
12199
|
}
|
|
12199
|
-
return
|
|
12200
|
+
return path103;
|
|
12200
12201
|
}
|
|
12201
12202
|
|
|
12202
12203
|
// src/commands/config/configEntryNode.ts
|
|
12203
12204
|
function configEntryNode(root2, key) {
|
|
12204
|
-
const
|
|
12205
|
-
return
|
|
12205
|
+
const path103 = parseConfigPath(key);
|
|
12206
|
+
return path103 ? findConfigNode(root2, path103) : void 0;
|
|
12206
12207
|
}
|
|
12207
12208
|
|
|
12208
12209
|
// src/commands/backlog/harnessConfigHelp.ts
|
|
@@ -12419,6 +12420,11 @@ var refactorConfigHelp = [
|
|
|
12419
12420
|
key: "restructure.ignore",
|
|
12420
12421
|
setter: 'assist config set restructure.ignore "src/generated/**"',
|
|
12421
12422
|
note: "globs (relative to cwd) of files restructure never moves; they are treated as outside the root"
|
|
12423
|
+
},
|
|
12424
|
+
{
|
|
12425
|
+
key: "restructure.pin",
|
|
12426
|
+
setter: 'assist config set restructure.pin "SessionCard"',
|
|
12427
|
+
note: "module names (basename without extension) restructure lifts out of deep import chains into the folder of the nearest root or pinned module above them, together with their subtrees"
|
|
12422
12428
|
}
|
|
12423
12429
|
];
|
|
12424
12430
|
|
|
@@ -12927,7 +12933,7 @@ function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
|
12927
12933
|
const parent = dirname22(branchKeyPath);
|
|
12928
12934
|
const branchPrefix = basename10(branchKeyPath);
|
|
12929
12935
|
if (!existsSync35(parent)) return null;
|
|
12930
|
-
const synthesisFiles = readdirSync4(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join36(parent, name, "synthesis.md")).filter((
|
|
12936
|
+
const synthesisFiles = readdirSync4(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join36(parent, name, "synthesis.md")).filter((path103) => existsSync35(path103)).map((path103) => ({ path: path103, mtime: statSync5(path103).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
12931
12937
|
return synthesisFiles[0]?.path ?? null;
|
|
12932
12938
|
}
|
|
12933
12939
|
|
|
@@ -12957,12 +12963,12 @@ async function getReviewSynthesis(req, res) {
|
|
|
12957
12963
|
const cwd = getCwdParam(req, res);
|
|
12958
12964
|
if (!cwd) return;
|
|
12959
12965
|
try {
|
|
12960
|
-
const
|
|
12961
|
-
if (!
|
|
12966
|
+
const path103 = await resolveSynthesisPath(cwd);
|
|
12967
|
+
if (!path103) {
|
|
12962
12968
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
12963
12969
|
return;
|
|
12964
12970
|
}
|
|
12965
|
-
respondJson(res, 200, { synthesis: readFileSync22(
|
|
12971
|
+
respondJson(res, 200, { synthesis: readFileSync22(path103, "utf8") });
|
|
12966
12972
|
} catch {
|
|
12967
12973
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
12968
12974
|
}
|
|
@@ -13045,8 +13051,8 @@ function parseDiffNameStatus(output) {
|
|
|
13045
13051
|
if (!status3 || fields.length < 2) continue;
|
|
13046
13052
|
const category = categorize(status3[0]);
|
|
13047
13053
|
if (!category) continue;
|
|
13048
|
-
const
|
|
13049
|
-
if (
|
|
13054
|
+
const path103 = fields[fields.length - 1];
|
|
13055
|
+
if (path103) result[category].push(path103);
|
|
13050
13056
|
}
|
|
13051
13057
|
return result;
|
|
13052
13058
|
}
|
|
@@ -13182,21 +13188,21 @@ function subsequenceScore(text18, query) {
|
|
|
13182
13188
|
}
|
|
13183
13189
|
return score - Math.min(text18.length, MAX_LENGTH_PENALTY);
|
|
13184
13190
|
}
|
|
13185
|
-
function scoreFilePath(
|
|
13191
|
+
function scoreFilePath(path103, query) {
|
|
13186
13192
|
const needle = query.trim().toLowerCase();
|
|
13187
13193
|
if (!needle) return 0;
|
|
13188
|
-
const basename30 =
|
|
13194
|
+
const basename30 = path103.slice(path103.lastIndexOf("/") + 1);
|
|
13189
13195
|
const inBasename = subsequenceScore(basename30, needle);
|
|
13190
13196
|
if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
|
|
13191
|
-
return subsequenceScore(
|
|
13197
|
+
return subsequenceScore(path103, needle);
|
|
13192
13198
|
}
|
|
13193
13199
|
|
|
13194
13200
|
// src/commands/sessions/web/rankFilePaths.ts
|
|
13195
13201
|
function rankFilePaths(paths, query, limit) {
|
|
13196
13202
|
const scored = [];
|
|
13197
|
-
for (const
|
|
13198
|
-
const score = scoreFilePath(
|
|
13199
|
-
if (score !== null) scored.push({ path:
|
|
13203
|
+
for (const path103 of paths) {
|
|
13204
|
+
const score = scoreFilePath(path103, query);
|
|
13205
|
+
if (score !== null) scored.push({ path: path103, score });
|
|
13200
13206
|
}
|
|
13201
13207
|
scored.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
|
|
13202
13208
|
return scored.slice(0, limit).map((entry) => entry.path);
|
|
@@ -14146,8 +14152,8 @@ async function liveDeployments(cwd, repo, environments) {
|
|
|
14146
14152
|
|
|
14147
14153
|
// src/commands/sessions/web/releases/latestRun.ts
|
|
14148
14154
|
async function latestRun(cwd, repo, workflow) {
|
|
14149
|
-
const
|
|
14150
|
-
const response = await ghJson(cwd, ["api",
|
|
14155
|
+
const path103 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
|
|
14156
|
+
const response = await ghJson(cwd, ["api", path103]);
|
|
14151
14157
|
const run4 = response.workflow_runs?.[0];
|
|
14152
14158
|
if (!run4) return null;
|
|
14153
14159
|
return {
|
|
@@ -14210,18 +14216,18 @@ function mostSpecificFirst(nodes) {
|
|
|
14210
14216
|
(a, b) => (b.tokens[0]?.length ?? 0) - (a.tokens[0]?.length ?? 0) || a.index - b.index
|
|
14211
14217
|
);
|
|
14212
14218
|
}
|
|
14213
|
-
function firstUnclaimed(
|
|
14219
|
+
function firstUnclaimed(names, claimed, tokens) {
|
|
14214
14220
|
for (const token of tokens)
|
|
14215
|
-
for (const [index3, name] of
|
|
14221
|
+
for (const [index3, name] of names.entries())
|
|
14216
14222
|
if (!claimed.has(index3) && name.includes(token)) return index3;
|
|
14217
14223
|
return void 0;
|
|
14218
14224
|
}
|
|
14219
14225
|
function matchRunJobs(nodes, jobs) {
|
|
14220
|
-
const
|
|
14226
|
+
const names = jobs.map((job) => normaliseJobName(job.name));
|
|
14221
14227
|
const claimed = /* @__PURE__ */ new Set();
|
|
14222
14228
|
const matched = /* @__PURE__ */ new Map();
|
|
14223
14229
|
for (const { node, tokens } of mostSpecificFirst(nodes)) {
|
|
14224
|
-
const hit = firstUnclaimed(
|
|
14230
|
+
const hit = firstUnclaimed(names, claimed, tokens);
|
|
14225
14231
|
const job = hit === void 0 ? void 0 : jobs[hit];
|
|
14226
14232
|
if (hit !== void 0) claimed.add(hit);
|
|
14227
14233
|
matched.set(node.id, job ? runJobState(job) : UNREACHED_BY_RUN);
|
|
@@ -14423,38 +14429,38 @@ async function restartWeb(req, res, deps2 = {}) {
|
|
|
14423
14429
|
import { relative as relative3 } from "path";
|
|
14424
14430
|
|
|
14425
14431
|
// src/commands/sessions/web/revertPathChanges.ts
|
|
14426
|
-
async function isTracked(cwd,
|
|
14432
|
+
async function isTracked(cwd, path103) {
|
|
14427
14433
|
try {
|
|
14428
|
-
await execGit(cwd, ["ls-files", "--error-unmatch", "--",
|
|
14434
|
+
await execGit(cwd, ["ls-files", "--error-unmatch", "--", path103]);
|
|
14429
14435
|
return true;
|
|
14430
14436
|
} catch {
|
|
14431
14437
|
return false;
|
|
14432
14438
|
}
|
|
14433
14439
|
}
|
|
14434
|
-
async function isInHead(cwd,
|
|
14435
|
-
const listing = await execGit(cwd, ["ls-tree", "HEAD", "--",
|
|
14440
|
+
async function isInHead(cwd, path103) {
|
|
14441
|
+
const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path103]);
|
|
14436
14442
|
return listing.trim().length > 0;
|
|
14437
14443
|
}
|
|
14438
|
-
async function revertPathChanges(cwd,
|
|
14439
|
-
if (!await isTracked(cwd,
|
|
14440
|
-
await execGit(cwd, ["clean", "-f", "--",
|
|
14444
|
+
async function revertPathChanges(cwd, path103) {
|
|
14445
|
+
if (!await isTracked(cwd, path103)) {
|
|
14446
|
+
await execGit(cwd, ["clean", "-f", "--", path103]);
|
|
14441
14447
|
return;
|
|
14442
14448
|
}
|
|
14443
|
-
if (await isInHead(cwd,
|
|
14444
|
-
await execGit(cwd, ["checkout", "HEAD", "--",
|
|
14449
|
+
if (await isInHead(cwd, path103)) {
|
|
14450
|
+
await execGit(cwd, ["checkout", "HEAD", "--", path103]);
|
|
14445
14451
|
return;
|
|
14446
14452
|
}
|
|
14447
|
-
await execGit(cwd, ["rm", "-f", "--",
|
|
14453
|
+
await execGit(cwd, ["rm", "-f", "--", path103]);
|
|
14448
14454
|
}
|
|
14449
14455
|
|
|
14450
14456
|
// src/commands/sessions/web/revertDiffFile.ts
|
|
14451
14457
|
async function revertDiffFile(req, res) {
|
|
14452
14458
|
const resolved = getFileTarget(req, res);
|
|
14453
14459
|
if (!resolved) return;
|
|
14454
|
-
const
|
|
14460
|
+
const path103 = relative3(repoRoot(resolved.cwd), resolved.target);
|
|
14455
14461
|
try {
|
|
14456
|
-
await revertPathChanges(resolved.cwd,
|
|
14457
|
-
respondJson(res, 200, { reverted:
|
|
14462
|
+
await revertPathChanges(resolved.cwd, path103);
|
|
14463
|
+
respondJson(res, 200, { reverted: path103 });
|
|
14458
14464
|
} catch (error) {
|
|
14459
14465
|
respondJson(res, 500, {
|
|
14460
14466
|
error: error instanceof Error ? error.message : "Failed to revert file"
|
|
@@ -14476,7 +14482,7 @@ async function readJsonBody(req) {
|
|
|
14476
14482
|
function requestedPaths(body) {
|
|
14477
14483
|
const paths = body.paths;
|
|
14478
14484
|
if (!Array.isArray(paths)) return null;
|
|
14479
|
-
if (paths.some((
|
|
14485
|
+
if (paths.some((path103) => typeof path103 !== "string")) return null;
|
|
14480
14486
|
return paths;
|
|
14481
14487
|
}
|
|
14482
14488
|
async function revertDiffPaths(req, res) {
|
|
@@ -14496,10 +14502,10 @@ async function revertDiffPaths(req, res) {
|
|
|
14496
14502
|
const root2 = repoRoot(cwd);
|
|
14497
14503
|
const reverted = [];
|
|
14498
14504
|
const failed2 = [];
|
|
14499
|
-
for (const
|
|
14500
|
-
const target = resolveWithinCwd(cwd,
|
|
14505
|
+
for (const path103 of paths) {
|
|
14506
|
+
const target = resolveWithinCwd(cwd, path103);
|
|
14501
14507
|
if (!target) {
|
|
14502
|
-
failed2.push({ path:
|
|
14508
|
+
failed2.push({ path: path103, error: "Path outside cwd" });
|
|
14503
14509
|
continue;
|
|
14504
14510
|
}
|
|
14505
14511
|
const relativePath = relative4(root2, target);
|
|
@@ -14589,11 +14595,11 @@ function coerceStructuredConfigValue(key, raw) {
|
|
|
14589
14595
|
};
|
|
14590
14596
|
}
|
|
14591
14597
|
function formatIssue(key, issue) {
|
|
14592
|
-
const
|
|
14598
|
+
const path103 = formatConfigPath([
|
|
14593
14599
|
{ kind: "key", name: key },
|
|
14594
14600
|
...issue.path.map(toSegment)
|
|
14595
14601
|
]);
|
|
14596
|
-
return `${
|
|
14602
|
+
return `${path103}: ${issue.message}`;
|
|
14597
14603
|
}
|
|
14598
14604
|
function toSegment(part) {
|
|
14599
14605
|
return typeof part === "number" ? { kind: "index", index: part } : { kind: "key", name: String(part) };
|
|
@@ -14688,9 +14694,9 @@ function coerceUnion(key, raw, types) {
|
|
|
14688
14694
|
}
|
|
14689
14695
|
|
|
14690
14696
|
// src/shared/valueAtConfigPath.ts
|
|
14691
|
-
function valueAtConfigPath(value,
|
|
14697
|
+
function valueAtConfigPath(value, path103) {
|
|
14692
14698
|
let current = value;
|
|
14693
|
-
for (const key of
|
|
14699
|
+
for (const key of path103) {
|
|
14694
14700
|
if (typeof key === "number") {
|
|
14695
14701
|
if (!Array.isArray(current)) return void 0;
|
|
14696
14702
|
current = current[key];
|
|
@@ -14707,7 +14713,7 @@ function restoreConfigSecrets(value, stored, node) {
|
|
|
14707
14713
|
return mapConfigSecrets(
|
|
14708
14714
|
value,
|
|
14709
14715
|
node,
|
|
14710
|
-
(secret,
|
|
14716
|
+
(secret, path103) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path103) : secret
|
|
14711
14717
|
);
|
|
14712
14718
|
}
|
|
14713
14719
|
|
|
@@ -14756,8 +14762,8 @@ function stepIntoNested(container, key, nextKey) {
|
|
|
14756
14762
|
}
|
|
14757
14763
|
return ensureObject(container, resolved);
|
|
14758
14764
|
}
|
|
14759
|
-
function setNestedValue(obj,
|
|
14760
|
-
const keys =
|
|
14765
|
+
function setNestedValue(obj, path103, value) {
|
|
14766
|
+
const keys = path103.split(".");
|
|
14761
14767
|
const result = { ...obj };
|
|
14762
14768
|
let current = result;
|
|
14763
14769
|
for (let i = 0; i < keys.length - 1; i++) {
|
|
@@ -14784,8 +14790,8 @@ function formatIssue2(issue, key) {
|
|
|
14784
14790
|
return issue.keys.map(
|
|
14785
14791
|
(unrecognized) => `${[...issue.path, unrecognized].join(".")}: Unrecognized key`
|
|
14786
14792
|
);
|
|
14787
|
-
const
|
|
14788
|
-
return [`${
|
|
14793
|
+
const path103 = issue.path.length > 0 ? issue.path.join(".") : key;
|
|
14794
|
+
return [`${path103}: ${issue.message}`];
|
|
14789
14795
|
}
|
|
14790
14796
|
|
|
14791
14797
|
// src/commands/config/applyConfigSet.ts
|
|
@@ -15047,8 +15053,8 @@ function removeAt(container, keys) {
|
|
|
15047
15053
|
}
|
|
15048
15054
|
return removeFromChild(container, key, rest);
|
|
15049
15055
|
}
|
|
15050
|
-
function unsetNestedValue(obj,
|
|
15051
|
-
const { container, removed } = removeAt(obj,
|
|
15056
|
+
function unsetNestedValue(obj, path103) {
|
|
15057
|
+
const { container, removed } = removeAt(obj, path103.split("."));
|
|
15052
15058
|
return { config: container, removed };
|
|
15053
15059
|
}
|
|
15054
15060
|
|
|
@@ -16615,13 +16621,13 @@ function findBuiltinDenyRaw(rawCommand) {
|
|
|
16615
16621
|
|
|
16616
16622
|
// src/commands/cliHook/findRestrictedPathDeny.ts
|
|
16617
16623
|
var RESTRICTED_PATHS = [".assist/restricted"];
|
|
16618
|
-
function restrictedPathRegex(
|
|
16619
|
-
const pattern2 =
|
|
16624
|
+
function restrictedPathRegex(path103) {
|
|
16625
|
+
const pattern2 = path103.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
|
|
16620
16626
|
return new RegExp(pattern2);
|
|
16621
16627
|
}
|
|
16622
|
-
var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((
|
|
16623
|
-
path:
|
|
16624
|
-
regex: restrictedPathRegex(
|
|
16628
|
+
var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path103) => ({
|
|
16629
|
+
path: path103,
|
|
16630
|
+
regex: restrictedPathRegex(path103)
|
|
16625
16631
|
}));
|
|
16626
16632
|
function findRestrictedPathDenyRaw(rawCommand) {
|
|
16627
16633
|
const rule = RESTRICTED_PATH_RULES.find(
|
|
@@ -16798,9 +16804,9 @@ var __dirname4 = dirname24(__filename3);
|
|
|
16798
16804
|
function packageRoot() {
|
|
16799
16805
|
return __dirname4;
|
|
16800
16806
|
}
|
|
16801
|
-
function readLines(
|
|
16802
|
-
if (!existsSync39(
|
|
16803
|
-
return readFileSync25(
|
|
16807
|
+
function readLines(path103) {
|
|
16808
|
+
if (!existsSync39(path103)) return [];
|
|
16809
|
+
return readFileSync25(path103, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
16804
16810
|
}
|
|
16805
16811
|
var cachedReads;
|
|
16806
16812
|
var cachedWrites;
|
|
@@ -17325,14 +17331,14 @@ function showProgress(p, label2) {
|
|
|
17325
17331
|
const pct = Math.round(p.done / p.total * 100);
|
|
17326
17332
|
process.stderr.write(`\r\x1B[K[${pct}%] Scanning ${label2}...`);
|
|
17327
17333
|
}
|
|
17328
|
-
async function resolveCommand(cli,
|
|
17329
|
-
showProgress(p,
|
|
17330
|
-
const subHelp = await runHelp([cli, ...
|
|
17334
|
+
async function resolveCommand(cli, path103, description, depth, p) {
|
|
17335
|
+
showProgress(p, path103.join(" "));
|
|
17336
|
+
const subHelp = await runHelp([cli, ...path103]);
|
|
17331
17337
|
if (!subHelp || !hasSubcommands(subHelp)) {
|
|
17332
|
-
return [{ path:
|
|
17338
|
+
return [{ path: path103, description }];
|
|
17333
17339
|
}
|
|
17334
|
-
const children = await discoverAt(cli,
|
|
17335
|
-
return children.length > 0 ? children : [{ path:
|
|
17340
|
+
const children = await discoverAt(cli, path103, depth + 1, p);
|
|
17341
|
+
return children.length > 0 ? children : [{ path: path103, description }];
|
|
17336
17342
|
}
|
|
17337
17343
|
async function discoverAt(cli, parentPath, depth, p) {
|
|
17338
17344
|
if (depth > SAFETY_DEPTH) return [];
|
|
@@ -17480,9 +17486,9 @@ function logPath(cli) {
|
|
|
17480
17486
|
return join42(homedir17(), ".assist", `cli-discover-${safeName}.log`);
|
|
17481
17487
|
}
|
|
17482
17488
|
function readCache(cli) {
|
|
17483
|
-
const
|
|
17484
|
-
if (!existsSync41(
|
|
17485
|
-
return readFileSync27(
|
|
17489
|
+
const path103 = logPath(cli);
|
|
17490
|
+
if (!existsSync41(path103)) return void 0;
|
|
17491
|
+
return readFileSync27(path103, "utf8");
|
|
17486
17492
|
}
|
|
17487
17493
|
function writeCache(cli, output) {
|
|
17488
17494
|
const dir = join42(homedir17(), ".assist");
|
|
@@ -17654,8 +17660,8 @@ import { join as join43 } from "path";
|
|
|
17654
17660
|
function getRestrictedDir() {
|
|
17655
17661
|
return join43(homedir18(), ".assist", "restricted");
|
|
17656
17662
|
}
|
|
17657
|
-
function getPinStatePath(
|
|
17658
|
-
return join43(getRestrictedDir(), `code-comment-${
|
|
17663
|
+
function getPinStatePath(pin2) {
|
|
17664
|
+
return join43(getRestrictedDir(), `code-comment-${pin2}.json`);
|
|
17659
17665
|
}
|
|
17660
17666
|
|
|
17661
17667
|
// src/commands/codeComment/sweepRestrictedDir.ts
|
|
@@ -17671,9 +17677,9 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
17671
17677
|
}
|
|
17672
17678
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
17673
17679
|
for (const entry of entries) {
|
|
17674
|
-
const
|
|
17680
|
+
const path103 = join44(dir, entry);
|
|
17675
17681
|
try {
|
|
17676
|
-
if (statSync7(
|
|
17682
|
+
if (statSync7(path103).mtimeMs < cutoff) unlinkSync7(path103);
|
|
17677
17683
|
} catch {
|
|
17678
17684
|
continue;
|
|
17679
17685
|
}
|
|
@@ -17682,12 +17688,12 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
17682
17688
|
|
|
17683
17689
|
// src/commands/codeComment/readPinState.ts
|
|
17684
17690
|
import { existsSync as existsSync42, readFileSync as readFileSync28 } from "fs";
|
|
17685
|
-
function readPinState(
|
|
17686
|
-
const
|
|
17687
|
-
if (!existsSync42(
|
|
17691
|
+
function readPinState(pin2) {
|
|
17692
|
+
const path103 = getPinStatePath(pin2);
|
|
17693
|
+
if (!existsSync42(path103)) return void 0;
|
|
17688
17694
|
try {
|
|
17689
|
-
const state = JSON.parse(readFileSync28(
|
|
17690
|
-
if (state.pin !==
|
|
17695
|
+
const state = JSON.parse(readFileSync28(path103, "utf8"));
|
|
17696
|
+
if (state.pin !== pin2) return void 0;
|
|
17691
17697
|
return state;
|
|
17692
17698
|
} catch {
|
|
17693
17699
|
return void 0;
|
|
@@ -17695,11 +17701,11 @@ function readPinState(pin) {
|
|
|
17695
17701
|
}
|
|
17696
17702
|
|
|
17697
17703
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
17698
|
-
function codeCommentConfirm(
|
|
17704
|
+
function codeCommentConfirm(pin2) {
|
|
17699
17705
|
sweepRestrictedDir();
|
|
17700
|
-
const state = readPinState(
|
|
17706
|
+
const state = readPinState(pin2);
|
|
17701
17707
|
if (!state) {
|
|
17702
|
-
console.error(chalk119.red(`No pending comment for pin: ${
|
|
17708
|
+
console.error(chalk119.red(`No pending comment for pin: ${pin2}`));
|
|
17703
17709
|
process.exitCode = 1;
|
|
17704
17710
|
return;
|
|
17705
17711
|
}
|
|
@@ -17725,7 +17731,7 @@ function codeCommentConfirm(pin) {
|
|
|
17725
17731
|
const indent3 = indentSource.match(/^\s*/)?.[0] ?? "";
|
|
17726
17732
|
lines2.splice(index3, 0, `${indent3}${marker2} ${state.text}`);
|
|
17727
17733
|
writeFileSync24(state.file, lines2.join("\n"));
|
|
17728
|
-
unlinkSync8(getPinStatePath(
|
|
17734
|
+
unlinkSync8(getPinStatePath(pin2));
|
|
17729
17735
|
console.log(
|
|
17730
17736
|
chalk119.green(
|
|
17731
17737
|
`Inserted "${marker2} ${state.text}" at ${state.file}:${state.line}`
|
|
@@ -17822,16 +17828,16 @@ function showNotification(options2) {
|
|
|
17822
17828
|
|
|
17823
17829
|
// src/commands/codeComment/issuePin.ts
|
|
17824
17830
|
function issuePin(file, lineNumber, text18) {
|
|
17825
|
-
const
|
|
17831
|
+
const pin2 = generatePin();
|
|
17826
17832
|
mkdirSync14(getRestrictedDir(), { recursive: true });
|
|
17827
17833
|
sweepRestrictedDir();
|
|
17828
17834
|
writeFileSync25(
|
|
17829
|
-
getPinStatePath(
|
|
17830
|
-
JSON.stringify({ pin, file, line: lineNumber, text: text18 })
|
|
17835
|
+
getPinStatePath(pin2),
|
|
17836
|
+
JSON.stringify({ pin: pin2, file, line: lineNumber, text: text18 })
|
|
17831
17837
|
);
|
|
17832
17838
|
return showNotification({
|
|
17833
17839
|
title: "assist code-comment pin",
|
|
17834
|
-
message: `Pin ${
|
|
17840
|
+
message: `Pin ${pin2} \u2014 run: assist code-comment confirm ${pin2}`
|
|
17835
17841
|
});
|
|
17836
17842
|
}
|
|
17837
17843
|
function generatePin() {
|
|
@@ -18107,8 +18113,8 @@ function findUnmergedPaths() {
|
|
|
18107
18113
|
}
|
|
18108
18114
|
const found = /* @__PURE__ */ new Set();
|
|
18109
18115
|
for (const line of output.split("\n")) {
|
|
18110
|
-
const
|
|
18111
|
-
if (
|
|
18116
|
+
const path103 = line.split(" ")[1];
|
|
18117
|
+
if (path103) found.add(path103.trim());
|
|
18112
18118
|
}
|
|
18113
18119
|
return [...found];
|
|
18114
18120
|
}
|
|
@@ -19355,11 +19361,11 @@ async function loadPath(source) {
|
|
|
19355
19361
|
}
|
|
19356
19362
|
}
|
|
19357
19363
|
async function criteriaExtension() {
|
|
19358
|
-
const
|
|
19364
|
+
const path103 = await loadPath(criteriaExtensionDir());
|
|
19359
19365
|
console.log(
|
|
19360
19366
|
chalk137.bold("acceptance criteria outliner \u2014 GitHub browser extension")
|
|
19361
19367
|
);
|
|
19362
|
-
console.log(chalk137.dim(`load the unpacked extension from ${
|
|
19368
|
+
console.log(chalk137.dim(`load the unpacked extension from ${path103}`));
|
|
19363
19369
|
}
|
|
19364
19370
|
|
|
19365
19371
|
// src/commands/criteriaExtension/signCriteriaExtension.ts
|
|
@@ -19484,10 +19490,10 @@ async function signCriteriaExtension() {
|
|
|
19484
19490
|
process.exitCode = 1;
|
|
19485
19491
|
return;
|
|
19486
19492
|
}
|
|
19487
|
-
const
|
|
19493
|
+
const path103 = await signedAddonInstallPath(
|
|
19488
19494
|
await copySignedXpi(xpi, ARTIFACTS_DIR)
|
|
19489
19495
|
);
|
|
19490
|
-
console.log(chalk139.dim(`install the signed add-on from ${
|
|
19496
|
+
console.log(chalk139.dim(`install the signed add-on from ${path103}`));
|
|
19491
19497
|
}
|
|
19492
19498
|
|
|
19493
19499
|
// src/commands/registerCriteriaExtension.ts
|
|
@@ -19575,8 +19581,8 @@ import chalk141 from "chalk";
|
|
|
19575
19581
|
|
|
19576
19582
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
19577
19583
|
import { join as join51 } from "path";
|
|
19578
|
-
function getMigrationPinPath(
|
|
19579
|
-
return join51(getRestrictedDir(), `db-migration-pin-${
|
|
19584
|
+
function getMigrationPinPath(pin2) {
|
|
19585
|
+
return join51(getRestrictedDir(), `db-migration-pin-${pin2}.json`);
|
|
19580
19586
|
}
|
|
19581
19587
|
function getMigrationApprovalPath(migrationId) {
|
|
19582
19588
|
return join51(getRestrictedDir(), `db-migration-approval-${migrationId}.json`);
|
|
@@ -19584,12 +19590,12 @@ function getMigrationApprovalPath(migrationId) {
|
|
|
19584
19590
|
|
|
19585
19591
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
19586
19592
|
import { existsSync as existsSync47, readFileSync as readFileSync30 } from "fs";
|
|
19587
|
-
function readMigrationPinState(
|
|
19588
|
-
const
|
|
19589
|
-
if (!existsSync47(
|
|
19593
|
+
function readMigrationPinState(pin2) {
|
|
19594
|
+
const path103 = getMigrationPinPath(pin2);
|
|
19595
|
+
if (!existsSync47(path103)) return void 0;
|
|
19590
19596
|
try {
|
|
19591
|
-
const state = JSON.parse(readFileSync30(
|
|
19592
|
-
if (state.pin !==
|
|
19597
|
+
const state = JSON.parse(readFileSync30(path103, "utf8"));
|
|
19598
|
+
if (state.pin !== pin2) return void 0;
|
|
19593
19599
|
if (!Number.isInteger(state.migrationId)) return void 0;
|
|
19594
19600
|
return state;
|
|
19595
19601
|
} catch {
|
|
@@ -19598,11 +19604,11 @@ function readMigrationPinState(pin) {
|
|
|
19598
19604
|
}
|
|
19599
19605
|
|
|
19600
19606
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
19601
|
-
function dbMigrationConfirm(
|
|
19607
|
+
function dbMigrationConfirm(pin2) {
|
|
19602
19608
|
sweepRestrictedDir();
|
|
19603
|
-
const state = readMigrationPinState(
|
|
19609
|
+
const state = readMigrationPinState(pin2);
|
|
19604
19610
|
if (!state) {
|
|
19605
|
-
console.error(chalk141.red(`No pending migration unlock for pin: ${
|
|
19611
|
+
console.error(chalk141.red(`No pending migration unlock for pin: ${pin2}`));
|
|
19606
19612
|
process.exitCode = 1;
|
|
19607
19613
|
return;
|
|
19608
19614
|
}
|
|
@@ -19610,7 +19616,7 @@ function dbMigrationConfirm(pin) {
|
|
|
19610
19616
|
getMigrationApprovalPath(state.migrationId),
|
|
19611
19617
|
JSON.stringify({ migrationId: state.migrationId })
|
|
19612
19618
|
);
|
|
19613
|
-
unlinkSync9(getMigrationPinPath(
|
|
19619
|
+
unlinkSync9(getMigrationPinPath(pin2));
|
|
19614
19620
|
console.log(
|
|
19615
19621
|
chalk141.green(
|
|
19616
19622
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
@@ -19631,10 +19637,10 @@ function nextMigrationId() {
|
|
|
19631
19637
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
19632
19638
|
function dbMigrationUnlock() {
|
|
19633
19639
|
const migrationId = nextMigrationId();
|
|
19634
|
-
const
|
|
19640
|
+
const pin2 = randomInt2(0, 1e3).toString().padStart(3, "0");
|
|
19635
19641
|
mkdirSync15(getRestrictedDir(), { recursive: true });
|
|
19636
19642
|
sweepRestrictedDir();
|
|
19637
|
-
writeFileSync27(getMigrationPinPath(
|
|
19643
|
+
writeFileSync27(getMigrationPinPath(pin2), JSON.stringify({ pin: pin2, migrationId }));
|
|
19638
19644
|
console.error(
|
|
19639
19645
|
chalk142.yellow.bold(
|
|
19640
19646
|
"THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a new database migration.\nA schema change is hard to reverse once shipped. You had BETTER have confirmed\nthe change with the user and be certain this migration is genuinely necessary."
|
|
@@ -19642,7 +19648,7 @@ function dbMigrationUnlock() {
|
|
|
19642
19648
|
);
|
|
19643
19649
|
const delivered = showNotification({
|
|
19644
19650
|
title: "assist db-migration pin",
|
|
19645
|
-
message: `Pin ${
|
|
19651
|
+
message: `Pin ${pin2} \u2014 run: assist db-migration confirm ${pin2}`
|
|
19646
19652
|
});
|
|
19647
19653
|
if (!delivered) {
|
|
19648
19654
|
console.error(
|
|
@@ -21397,10 +21403,10 @@ function decideCommentGuard(input, existingContent) {
|
|
|
21397
21403
|
import { existsSync as existsSync53, unlinkSync as unlinkSync11 } from "fs";
|
|
21398
21404
|
function consumeMigrationApproval(migrationId) {
|
|
21399
21405
|
sweepRestrictedDir();
|
|
21400
|
-
const
|
|
21401
|
-
if (!existsSync53(
|
|
21406
|
+
const path103 = getMigrationApprovalPath(migrationId);
|
|
21407
|
+
if (!existsSync53(path103)) return false;
|
|
21402
21408
|
try {
|
|
21403
|
-
unlinkSync11(
|
|
21409
|
+
unlinkSync11(path103);
|
|
21404
21410
|
return true;
|
|
21405
21411
|
} catch {
|
|
21406
21412
|
return false;
|
|
@@ -22541,7 +22547,7 @@ var QUERY5 = `query($owner: String!, $repo: String!, $after: String) {
|
|
|
22541
22547
|
}
|
|
22542
22548
|
}`;
|
|
22543
22549
|
function readRepoLabels(target) {
|
|
22544
|
-
const
|
|
22550
|
+
const names = [];
|
|
22545
22551
|
let after;
|
|
22546
22552
|
do {
|
|
22547
22553
|
const page = JSON.parse(
|
|
@@ -22552,22 +22558,22 @@ function readRepoLabels(target) {
|
|
|
22552
22558
|
`No labels could be read for ${target.owner}/${target.repo}`
|
|
22553
22559
|
);
|
|
22554
22560
|
}
|
|
22555
|
-
for (const node of page.nodes ?? []) if (node?.name)
|
|
22561
|
+
for (const node of page.nodes ?? []) if (node?.name) names.push(node.name);
|
|
22556
22562
|
after = page.pageInfo?.hasNextPage ? page.pageInfo.endCursor ?? void 0 : void 0;
|
|
22557
22563
|
} while (after);
|
|
22558
|
-
return
|
|
22564
|
+
return names;
|
|
22559
22565
|
}
|
|
22560
|
-
function matchLabel(
|
|
22566
|
+
function matchLabel(names, wanted) {
|
|
22561
22567
|
const normalised = normaliseTypeName(wanted);
|
|
22562
|
-
return
|
|
22568
|
+
return names.find((name) => name === wanted) ?? names.find((name) => name.toLowerCase() === wanted.toLowerCase()) ?? names.find((name) => normaliseTypeName(name) === normalised);
|
|
22563
22569
|
}
|
|
22564
22570
|
function resolveIssueLabels(target, wanted) {
|
|
22565
|
-
const
|
|
22571
|
+
const names = readRepoLabels(target);
|
|
22566
22572
|
return wanted.map((label2) => {
|
|
22567
|
-
const match = matchLabel(
|
|
22573
|
+
const match = matchLabel(names, label2);
|
|
22568
22574
|
if (!match) {
|
|
22569
22575
|
throw new Error(
|
|
22570
|
-
`${target.owner}/${target.repo} has no ${label2} label. It has ${
|
|
22576
|
+
`${target.owner}/${target.repo} has no ${label2} label. It has ${names.join(", ")}`
|
|
22571
22577
|
);
|
|
22572
22578
|
}
|
|
22573
22579
|
return match;
|
|
@@ -23280,9 +23286,9 @@ function moveItem(item) {
|
|
|
23280
23286
|
(candidate) => candidate.name.toLowerCase() === IN_PROGRESS
|
|
23281
23287
|
);
|
|
23282
23288
|
if (!option) {
|
|
23283
|
-
const
|
|
23289
|
+
const names = statusField.options.map((candidate) => candidate.name);
|
|
23284
23290
|
console.log(
|
|
23285
|
-
`The Status field on ${boardName(item)} has no In Progress option, so it was not moved. It offers ${
|
|
23291
|
+
`The Status field on ${boardName(item)} has no In Progress option, so it was not moved. It offers ${names.join(", ") || "no options"}`
|
|
23286
23292
|
);
|
|
23287
23293
|
return;
|
|
23288
23294
|
}
|
|
@@ -23804,11 +23810,11 @@ function recentDaemonLogLines() {
|
|
|
23804
23810
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
23805
23811
|
import { realpathSync as realpathSync2 } from "fs";
|
|
23806
23812
|
import { resolve as resolve14 } from "path";
|
|
23807
|
-
function canonicalTreePath(
|
|
23813
|
+
function canonicalTreePath(path103) {
|
|
23808
23814
|
try {
|
|
23809
|
-
return realpathSync2(
|
|
23815
|
+
return realpathSync2(path103);
|
|
23810
23816
|
} catch {
|
|
23811
|
-
return resolve14(
|
|
23817
|
+
return resolve14(path103);
|
|
23812
23818
|
}
|
|
23813
23819
|
}
|
|
23814
23820
|
|
|
@@ -23861,22 +23867,22 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
23861
23867
|
const registered = new Set(listWorktreePaths(clone));
|
|
23862
23868
|
const branches = new Set(listLocalBranches(clone));
|
|
23863
23869
|
const isTaken = (candidate) => registered.has(candidate) || existsSync56(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename17(candidate));
|
|
23864
|
-
const
|
|
23870
|
+
const path103 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
23865
23871
|
const start3 = worktreeStartPoint(clone, strategy.trunk);
|
|
23866
23872
|
gitSync(clone, [
|
|
23867
23873
|
"worktree",
|
|
23868
23874
|
"add",
|
|
23869
23875
|
start3.track ? "--track" : "--no-track",
|
|
23870
23876
|
"-b",
|
|
23871
|
-
basename17(
|
|
23872
|
-
|
|
23877
|
+
basename17(path103),
|
|
23878
|
+
path103,
|
|
23873
23879
|
start3.ref
|
|
23874
23880
|
]);
|
|
23875
|
-
recordWorktree(
|
|
23881
|
+
recordWorktree(path103, clone, getCurrentOrigin(clone));
|
|
23876
23882
|
daemonLog(
|
|
23877
|
-
start3.track ? `worktree allocated ${
|
|
23883
|
+
start3.track ? `worktree allocated ${path103} (branch ${basename17(path103)} tracking ${start3.ref}) for clone ${clone}` : `worktree allocated ${path103} (branch ${basename17(path103)} off ${start3.ref}, no mainline tracking) for clone ${clone}`
|
|
23878
23884
|
);
|
|
23879
|
-
return
|
|
23885
|
+
return path103;
|
|
23880
23886
|
}
|
|
23881
23887
|
|
|
23882
23888
|
// src/commands/sessions/daemon/worktree/keptInTree.ts
|
|
@@ -24017,13 +24023,13 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
|
|
|
24017
24023
|
if (forcedSpill) daemonLog(forcedSpill);
|
|
24018
24024
|
else if (reusesClone(clone, boundTreeRoots2, reuse))
|
|
24019
24025
|
return { cwd: clone, kind: "primary", created: false, clone };
|
|
24020
|
-
const
|
|
24026
|
+
const path103 = createWorktree(
|
|
24021
24027
|
clone,
|
|
24022
24028
|
{ root: cfg.root, trunk: cfg.trunk },
|
|
24023
24029
|
boundTreeRoots2,
|
|
24024
24030
|
options2.replacesTree
|
|
24025
24031
|
);
|
|
24026
|
-
return { cwd:
|
|
24032
|
+
return { cwd: path103, kind: "worktree", created: true, clone };
|
|
24027
24033
|
}
|
|
24028
24034
|
|
|
24029
24035
|
// src/commands/sessions/daemon/describePersistedSession.ts
|
|
@@ -24369,13 +24375,13 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
24369
24375
|
const listing = gitSyncOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
24370
24376
|
if (!listing) return null;
|
|
24371
24377
|
const here = gitSyncOrNull(cwd, ["rev-parse", "--show-toplevel"]);
|
|
24372
|
-
let
|
|
24378
|
+
let path103 = null;
|
|
24373
24379
|
for (const line of listing.split("\n")) {
|
|
24374
24380
|
const trimmed = line.trim();
|
|
24375
24381
|
if (trimmed.startsWith("worktree "))
|
|
24376
|
-
|
|
24382
|
+
path103 = trimmed.slice("worktree ".length).trim();
|
|
24377
24383
|
else if (trimmed === `branch refs/heads/${branch2}`)
|
|
24378
|
-
return
|
|
24384
|
+
return path103 && path103 !== here ? path103 : null;
|
|
24379
24385
|
}
|
|
24380
24386
|
return null;
|
|
24381
24387
|
}
|
|
@@ -25091,12 +25097,12 @@ function extractLayers(layers, cwd, globalConfigPath) {
|
|
|
25091
25097
|
];
|
|
25092
25098
|
}
|
|
25093
25099
|
function unknownExtract(name, layers) {
|
|
25094
|
-
const
|
|
25100
|
+
const names = [
|
|
25095
25101
|
...new Set(layers.flatMap((layer) => Object.keys(layer.extracts)))
|
|
25096
25102
|
].sort();
|
|
25097
|
-
if (
|
|
25103
|
+
if (names.length === 0)
|
|
25098
25104
|
return `No extract named "${name}" is configured. Pick a rectangle with no anchor flags, then save it as "${name}".`;
|
|
25099
|
-
return `No extract named "${name}" is configured. Configured extracts: ${
|
|
25105
|
+
return `No extract named "${name}" is configured. Configured extracts: ${names.join(", ")}.`;
|
|
25100
25106
|
}
|
|
25101
25107
|
|
|
25102
25108
|
// src/commands/miro/mergeExtractOptions.ts
|
|
@@ -25479,9 +25485,9 @@ function parseRscRows(flight) {
|
|
|
25479
25485
|
}
|
|
25480
25486
|
function makeRscResolver(rows) {
|
|
25481
25487
|
return (ref) => {
|
|
25482
|
-
const [id, ...
|
|
25488
|
+
const [id, ...path103] = ref.slice(1).replace(/^[L@]/, "").split(":");
|
|
25483
25489
|
let v = rows[id];
|
|
25484
|
-
for (const key of
|
|
25490
|
+
for (const key of path103) {
|
|
25485
25491
|
if (v == null || typeof v !== "object") return void 0;
|
|
25486
25492
|
v = v[key];
|
|
25487
25493
|
}
|
|
@@ -26231,18 +26237,18 @@ function validateLine(line) {
|
|
|
26231
26237
|
process.exit(1);
|
|
26232
26238
|
}
|
|
26233
26239
|
}
|
|
26234
|
-
async function comment2(
|
|
26240
|
+
async function comment2(path103, line, body, options2 = {}) {
|
|
26235
26241
|
const { startLine, skipPreview } = options2;
|
|
26236
26242
|
validateBody(body);
|
|
26237
26243
|
validateLine(line);
|
|
26238
26244
|
if (startLine !== void 0) validateLine(startLine);
|
|
26239
26245
|
const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
|
|
26240
26246
|
if (!skipPreview)
|
|
26241
|
-
await reviewProposedPrComment(`Comment on ${
|
|
26247
|
+
await reviewProposedPrComment(`Comment on ${path103}:${range}`, body, null);
|
|
26242
26248
|
try {
|
|
26243
26249
|
const prId = getCurrentPrNodeId();
|
|
26244
|
-
postReviewComment({ prId, body, path:
|
|
26245
|
-
console.log(`Added review comment on ${
|
|
26250
|
+
postReviewComment({ prId, body, path: path103, line, startLine });
|
|
26251
|
+
console.log(`Added review comment on ${path103}:${range}`);
|
|
26246
26252
|
} catch (error) {
|
|
26247
26253
|
if (isGhNotInstalled(error)) {
|
|
26248
26254
|
console.error("Error: GitHub CLI (gh) is not installed.");
|
|
@@ -26811,9 +26817,9 @@ function registerPrsComments(prsCommand) {
|
|
|
26811
26817
|
});
|
|
26812
26818
|
prsCommand.command("comment <path> <line> <body>").description(
|
|
26813
26819
|
"Add a line comment to the pending review (body of - reads it from stdin)"
|
|
26814
|
-
).action(async (
|
|
26820
|
+
).action(async (path103, line, body) => {
|
|
26815
26821
|
await comment2(
|
|
26816
|
-
|
|
26822
|
+
path103,
|
|
26817
26823
|
Number.parseInt(line, 10),
|
|
26818
26824
|
await readBodyArgument(body)
|
|
26819
26825
|
);
|
|
@@ -28034,11 +28040,11 @@ async function loadBody(target) {
|
|
|
28034
28040
|
if (target.kind === "file") return readDraftFile(target.path);
|
|
28035
28041
|
return fetchPrBody(target.number, target.repo);
|
|
28036
28042
|
}
|
|
28037
|
-
function readDraftFile(
|
|
28043
|
+
function readDraftFile(path103) {
|
|
28038
28044
|
try {
|
|
28039
|
-
return readFileSync44(
|
|
28045
|
+
return readFileSync44(path103, "utf8");
|
|
28040
28046
|
} catch {
|
|
28041
|
-
console.error(`Error: Could not read \`${
|
|
28047
|
+
console.error(`Error: Could not read \`${path103}\`.`);
|
|
28042
28048
|
console.error(
|
|
28043
28049
|
"Pass a pull request number, a GitHub pull request URL, - for stdin, or a path to a file."
|
|
28044
28050
|
);
|
|
@@ -28318,10 +28324,10 @@ function resolveOpSecret(reference) {
|
|
|
28318
28324
|
}
|
|
28319
28325
|
|
|
28320
28326
|
// src/commands/ravendb/ravenFetch.ts
|
|
28321
|
-
async function ravenFetch(connection,
|
|
28327
|
+
async function ravenFetch(connection, path103) {
|
|
28322
28328
|
const apiKey = resolveOpSecret(connection.apiKeyRef);
|
|
28323
28329
|
let accessToken = await getAccessToken(apiKey);
|
|
28324
|
-
const url = `${connection.url}${
|
|
28330
|
+
const url = `${connection.url}${path103}`;
|
|
28325
28331
|
const headers = {
|
|
28326
28332
|
Authorization: `Bearer ${accessToken}`,
|
|
28327
28333
|
"Content-Type": "application/json"
|
|
@@ -28411,16 +28417,16 @@ import chalk195 from "chalk";
|
|
|
28411
28417
|
// src/commands/ravendb/buildQueryPath.ts
|
|
28412
28418
|
function buildQueryPath(opts) {
|
|
28413
28419
|
const db = encodeURIComponent(opts.db);
|
|
28414
|
-
let
|
|
28420
|
+
let path103;
|
|
28415
28421
|
if (opts.collection) {
|
|
28416
|
-
|
|
28422
|
+
path103 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
|
|
28417
28423
|
} else {
|
|
28418
|
-
|
|
28424
|
+
path103 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
|
|
28419
28425
|
}
|
|
28420
28426
|
if (opts.query) {
|
|
28421
|
-
|
|
28427
|
+
path103 += `&query=${encodeURIComponent(opts.query)}`;
|
|
28422
28428
|
}
|
|
28423
|
-
return
|
|
28429
|
+
return path103;
|
|
28424
28430
|
}
|
|
28425
28431
|
|
|
28426
28432
|
// src/commands/ravendb/fetchAllPages.ts
|
|
@@ -28429,7 +28435,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
28429
28435
|
let start3 = 0;
|
|
28430
28436
|
while (true) {
|
|
28431
28437
|
const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
|
|
28432
|
-
const
|
|
28438
|
+
const path103 = buildQueryPath({
|
|
28433
28439
|
db: connection.database,
|
|
28434
28440
|
collection: opts.collection,
|
|
28435
28441
|
start: start3,
|
|
@@ -28437,7 +28443,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
28437
28443
|
sort: opts.sort,
|
|
28438
28444
|
query: opts.query
|
|
28439
28445
|
});
|
|
28440
|
-
const data = await ravenFetch(connection,
|
|
28446
|
+
const data = await ravenFetch(connection, path103);
|
|
28441
28447
|
const results = data.Results ?? [];
|
|
28442
28448
|
const totalResults = data.TotalResults ?? 0;
|
|
28443
28449
|
if (results.length === 0) break;
|
|
@@ -29792,12 +29798,12 @@ function addImportPreservingSuppressions(sourceFile, structure) {
|
|
|
29792
29798
|
// src/commands/refactor/extract/removeStaleImports.ts
|
|
29793
29799
|
import { SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
29794
29800
|
function collectReferencedNames(sourceFile) {
|
|
29795
|
-
const
|
|
29801
|
+
const names = /* @__PURE__ */ new Set();
|
|
29796
29802
|
for (const id of sourceFile.getDescendantsOfKind(SyntaxKind3.Identifier)) {
|
|
29797
29803
|
if (id.getFirstAncestorByKind(SyntaxKind3.ImportDeclaration)) continue;
|
|
29798
|
-
|
|
29804
|
+
names.add(id.getText());
|
|
29799
29805
|
}
|
|
29800
|
-
return
|
|
29806
|
+
return names;
|
|
29801
29807
|
}
|
|
29802
29808
|
function isImportEmpty(importDecl, usedNames) {
|
|
29803
29809
|
if (importDecl.getNamedImports().length > 0) return false;
|
|
@@ -29896,14 +29902,14 @@ function isPrivate(fn) {
|
|
|
29896
29902
|
return !fn.isExported() && !fn.isDefaultExport();
|
|
29897
29903
|
}
|
|
29898
29904
|
function getCalledFunctionNames(fn) {
|
|
29899
|
-
const
|
|
29905
|
+
const names = /* @__PURE__ */ new Set();
|
|
29900
29906
|
for (const call of fn.getDescendantsOfKind(SyntaxKind5.CallExpression)) {
|
|
29901
29907
|
const expr = call.getExpression();
|
|
29902
29908
|
if (expr.getKind() === SyntaxKind5.Identifier) {
|
|
29903
|
-
|
|
29909
|
+
names.add(expr.getText());
|
|
29904
29910
|
}
|
|
29905
29911
|
}
|
|
29906
|
-
return
|
|
29912
|
+
return names;
|
|
29907
29913
|
}
|
|
29908
29914
|
function collectPrivateFunctions(target, fnMap) {
|
|
29909
29915
|
const collected = /* @__PURE__ */ new Set();
|
|
@@ -29929,11 +29935,11 @@ function collectPrivateFunctions(target, fnMap) {
|
|
|
29929
29935
|
// src/commands/refactor/extract/collectPrivateStatements.ts
|
|
29930
29936
|
import { SyntaxKind as SyntaxKind6 } from "ts-morph";
|
|
29931
29937
|
function getReferencedIdentifiers(fn) {
|
|
29932
|
-
const
|
|
29938
|
+
const names = /* @__PURE__ */ new Set();
|
|
29933
29939
|
for (const id of fn.getDescendantsOfKind(SyntaxKind6.Identifier)) {
|
|
29934
|
-
|
|
29940
|
+
names.add(id.getText());
|
|
29935
29941
|
}
|
|
29936
|
-
return
|
|
29942
|
+
return names;
|
|
29937
29943
|
}
|
|
29938
29944
|
function collectPrivateStatements(functions, stmtMap) {
|
|
29939
29945
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -30127,31 +30133,31 @@ function matchImport(importDecl, neededNames) {
|
|
|
30127
30133
|
|
|
30128
30134
|
// src/commands/refactor/extract/resolveImports.ts
|
|
30129
30135
|
function getReferencedNames(nodes) {
|
|
30130
|
-
const
|
|
30136
|
+
const names = /* @__PURE__ */ new Set();
|
|
30131
30137
|
for (const node of nodes) {
|
|
30132
30138
|
for (const id of node.getDescendantsOfKind(SyntaxKind13.Identifier)) {
|
|
30133
|
-
|
|
30139
|
+
names.add(id.getText());
|
|
30134
30140
|
}
|
|
30135
30141
|
}
|
|
30136
|
-
return
|
|
30142
|
+
return names;
|
|
30137
30143
|
}
|
|
30138
30144
|
function getLocallyDeclaredNames(nodes) {
|
|
30139
|
-
const
|
|
30145
|
+
const names = /* @__PURE__ */ new Set();
|
|
30140
30146
|
for (const node of nodes) {
|
|
30141
30147
|
if (Node.isFunctionDeclaration(node)) {
|
|
30142
30148
|
const name = node.getName();
|
|
30143
|
-
if (name)
|
|
30149
|
+
if (name) names.add(name);
|
|
30144
30150
|
}
|
|
30145
30151
|
for (const param of node.getDescendantsOfKind(SyntaxKind13.Parameter)) {
|
|
30146
|
-
|
|
30152
|
+
names.add(param.getName());
|
|
30147
30153
|
}
|
|
30148
30154
|
for (const varDecl of node.getDescendantsOfKind(
|
|
30149
30155
|
SyntaxKind13.VariableDeclaration
|
|
30150
30156
|
)) {
|
|
30151
|
-
|
|
30157
|
+
names.add(varDecl.getName());
|
|
30152
30158
|
}
|
|
30153
30159
|
}
|
|
30154
|
-
return
|
|
30160
|
+
return names;
|
|
30155
30161
|
}
|
|
30156
30162
|
function resolveImports(target, dependencies, sourceFile, statements = []) {
|
|
30157
30163
|
const allFunctions = [target, ...dependencies];
|
|
@@ -30951,7 +30957,7 @@ Renamed ${oldName} \u2192 ${newName}`));
|
|
|
30951
30957
|
|
|
30952
30958
|
// src/commands/refactor/restructure.ts
|
|
30953
30959
|
import fs38 from "fs";
|
|
30954
|
-
import
|
|
30960
|
+
import path78 from "path";
|
|
30955
30961
|
import chalk220 from "chalk";
|
|
30956
30962
|
|
|
30957
30963
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
@@ -31018,43 +31024,48 @@ function applyPlan(plan2) {
|
|
|
31018
31024
|
}
|
|
31019
31025
|
|
|
31020
31026
|
// src/commands/refactor/restructure/buildPlan.ts
|
|
31021
|
-
import
|
|
31027
|
+
import path72 from "path";
|
|
31022
31028
|
|
|
31023
31029
|
// src/commands/refactor/restructure/planRestructure.ts
|
|
31024
|
-
import
|
|
31030
|
+
import path71 from "path";
|
|
31025
31031
|
|
|
31026
|
-
// src/commands/refactor/restructure/planRestructure/
|
|
31027
|
-
import
|
|
31032
|
+
// src/commands/refactor/restructure/planRestructure/anchored.ts
|
|
31033
|
+
import path63 from "path";
|
|
31034
|
+
function anchored(files, mode, reasonPrefix) {
|
|
31035
|
+
return {
|
|
31036
|
+
root: false,
|
|
31037
|
+
anchors: files.map((file) => ({ file, mode })),
|
|
31038
|
+
reason: `${reasonPrefix} ${files.map((f) => path63.basename(f)).join(", ")}`
|
|
31039
|
+
};
|
|
31040
|
+
}
|
|
31028
31041
|
|
|
31029
31042
|
// src/commands/refactor/restructure/planRestructure/isTestFile.ts
|
|
31030
|
-
import
|
|
31043
|
+
import path64 from "path";
|
|
31031
31044
|
var TEST_SUFFIX = /\.test\.tsx?$/;
|
|
31032
31045
|
function isTestFile(file) {
|
|
31033
31046
|
return TEST_SUFFIX.test(file);
|
|
31034
31047
|
}
|
|
31035
31048
|
function testStem(file) {
|
|
31036
|
-
return
|
|
31049
|
+
return path64.basename(file).replace(TEST_SUFFIX, "");
|
|
31037
31050
|
}
|
|
31038
31051
|
|
|
31039
31052
|
// src/commands/refactor/restructure/planRestructure/moduleStem.ts
|
|
31040
|
-
import
|
|
31053
|
+
import path65 from "path";
|
|
31041
31054
|
function moduleStem(file) {
|
|
31042
|
-
return
|
|
31055
|
+
return path65.basename(file).replace(/\.tsx?$/, "");
|
|
31043
31056
|
}
|
|
31044
31057
|
|
|
31045
31058
|
// src/commands/refactor/restructure/planRestructure/collectAnchors.ts
|
|
31046
31059
|
function sorted(set) {
|
|
31047
31060
|
return [...set ?? []].sort();
|
|
31048
31061
|
}
|
|
31049
|
-
function names(files) {
|
|
31050
|
-
return files.map((f) => path65.basename(f)).join(", ");
|
|
31051
|
-
}
|
|
31052
|
-
function anchorsOf(files, mode) {
|
|
31053
|
-
return files.map((file) => ({ file, mode }));
|
|
31054
|
-
}
|
|
31055
31062
|
function root(reason4) {
|
|
31056
31063
|
return { root: true, anchors: [], reason: reason4 };
|
|
31057
31064
|
}
|
|
31065
|
+
function pin(anchoring) {
|
|
31066
|
+
if (anchoring.root) return anchoring;
|
|
31067
|
+
return { ...anchoring, pinned: true, reason: `pinned; ${anchoring.reason}` };
|
|
31068
|
+
}
|
|
31058
31069
|
function anchorTest(file, index3) {
|
|
31059
31070
|
const imported = sorted(index3.imports.get(file));
|
|
31060
31071
|
if (imported.length === 0) return root("test with no subject in scope");
|
|
@@ -31062,39 +31073,32 @@ function anchorTest(file, index3) {
|
|
|
31062
31073
|
const subjects = imported.filter(
|
|
31063
31074
|
(f) => !isTestFile(f) && moduleStem(f) === stem
|
|
31064
31075
|
);
|
|
31065
|
-
|
|
31066
|
-
|
|
31067
|
-
|
|
31068
|
-
|
|
31069
|
-
|
|
31070
|
-
};
|
|
31076
|
+
return anchored(
|
|
31077
|
+
subjects.length > 0 ? subjects : imported,
|
|
31078
|
+
"sibling",
|
|
31079
|
+
"test of"
|
|
31080
|
+
);
|
|
31071
31081
|
}
|
|
31072
31082
|
function anchorModule(file, index3) {
|
|
31073
31083
|
if (index3.external.has(file)) return root("imported from outside scope");
|
|
31074
31084
|
const importers = sorted(index3.importers.get(file));
|
|
31075
31085
|
if (importers.length > 0)
|
|
31076
|
-
return
|
|
31077
|
-
|
|
31078
|
-
|
|
31079
|
-
|
|
31080
|
-
|
|
31086
|
+
return anchored(
|
|
31087
|
+
importers,
|
|
31088
|
+
"child",
|
|
31089
|
+
importers.length === 1 ? "imported only by" : "shared by"
|
|
31090
|
+
);
|
|
31081
31091
|
const tests = sorted(index3.testImporters.get(file));
|
|
31082
|
-
if (tests.length > 0)
|
|
31083
|
-
return {
|
|
31084
|
-
root: false,
|
|
31085
|
-
anchors: anchorsOf(tests, "sibling"),
|
|
31086
|
-
reason: `used only by tests ${names(tests)}`
|
|
31087
|
-
};
|
|
31092
|
+
if (tests.length > 0) return anchored(tests, "sibling", "used only by tests");
|
|
31088
31093
|
return root("no importers in scope");
|
|
31089
31094
|
}
|
|
31090
|
-
function
|
|
31091
|
-
|
|
31092
|
-
|
|
31093
|
-
|
|
31094
|
-
|
|
31095
|
-
|
|
31096
|
-
|
|
31097
|
-
return anchorings;
|
|
31095
|
+
function anchorFile(file, index3, pinned) {
|
|
31096
|
+
if (isTestFile(file)) return anchorTest(file, index3);
|
|
31097
|
+
const anchoring = anchorModule(file, index3);
|
|
31098
|
+
return pinned.has(moduleStem(file)) ? pin(anchoring) : anchoring;
|
|
31099
|
+
}
|
|
31100
|
+
function collectAnchors(files, index3, pinned) {
|
|
31101
|
+
return new Map(files.map((file) => [file, anchorFile(file, index3, pinned)]));
|
|
31098
31102
|
}
|
|
31099
31103
|
|
|
31100
31104
|
// src/commands/refactor/restructure/planRestructure/findCollisions.ts
|
|
@@ -31139,7 +31143,59 @@ function indexEdges(scope, edges) {
|
|
|
31139
31143
|
}
|
|
31140
31144
|
|
|
31141
31145
|
// src/commands/refactor/restructure/planRestructure/placeComponents.ts
|
|
31146
|
+
import path70 from "path";
|
|
31147
|
+
|
|
31148
|
+
// src/commands/refactor/restructure/planRestructure/componentDir.ts
|
|
31149
|
+
import path69 from "path";
|
|
31150
|
+
|
|
31151
|
+
// src/commands/refactor/restructure/planRestructure/liftToPinFolder.ts
|
|
31152
|
+
import path67 from "path";
|
|
31153
|
+
function liftToPinFolder(dir, pinFolders, scopeRoot) {
|
|
31154
|
+
let lifted = scopeRoot;
|
|
31155
|
+
for (const folder of pinFolders)
|
|
31156
|
+
if ((dir === folder || dir.startsWith(folder + path67.sep)) && folder.length > lifted.length)
|
|
31157
|
+
lifted = folder;
|
|
31158
|
+
return lifted;
|
|
31159
|
+
}
|
|
31160
|
+
|
|
31161
|
+
// src/commands/refactor/restructure/planRestructure/lowestCommonAncestor.ts
|
|
31142
31162
|
import path68 from "path";
|
|
31163
|
+
function lowestCommonAncestor(dirs) {
|
|
31164
|
+
const [first, ...rest] = dirs.map((d) => d.split(path68.sep));
|
|
31165
|
+
let common = first;
|
|
31166
|
+
for (const parts of rest) {
|
|
31167
|
+
let i = 0;
|
|
31168
|
+
while (i < common.length && i < parts.length && common[i] === parts[i]) i++;
|
|
31169
|
+
common = common.slice(0, i);
|
|
31170
|
+
}
|
|
31171
|
+
return common.join(path68.sep) || path68.sep;
|
|
31172
|
+
}
|
|
31173
|
+
|
|
31174
|
+
// src/commands/refactor/restructure/planRestructure/componentDir.ts
|
|
31175
|
+
function anchorFolder(anchor, dirs) {
|
|
31176
|
+
const dir = dirs.get(anchor.file);
|
|
31177
|
+
return anchor.mode === "child" ? path69.join(dir, moduleStem(anchor.file)) : dir;
|
|
31178
|
+
}
|
|
31179
|
+
function externalAnchors(component, anchorings) {
|
|
31180
|
+
const members = new Set(component);
|
|
31181
|
+
return component.flatMap(
|
|
31182
|
+
(file) => anchorings.get(file).anchors.filter(
|
|
31183
|
+
(a) => !members.has(a.file)
|
|
31184
|
+
)
|
|
31185
|
+
);
|
|
31186
|
+
}
|
|
31187
|
+
function plannedDir(component, anchorings, layout) {
|
|
31188
|
+
if (component.some((f) => anchorings.get(f).root))
|
|
31189
|
+
return layout.scopeRoot;
|
|
31190
|
+
const anchors = externalAnchors(component, anchorings);
|
|
31191
|
+
if (anchors.length === 0) return layout.scopeRoot;
|
|
31192
|
+
return lowestCommonAncestor(anchors.map((a) => anchorFolder(a, layout.dirs)));
|
|
31193
|
+
}
|
|
31194
|
+
function componentDir(component, anchorings, layout) {
|
|
31195
|
+
const planned = plannedDir(component, anchorings, layout);
|
|
31196
|
+
const pinned = component.some((f) => anchorings.get(f).pinned);
|
|
31197
|
+
return pinned ? liftToPinFolder(planned, layout.pinFolders, layout.scopeRoot) : planned;
|
|
31198
|
+
}
|
|
31143
31199
|
|
|
31144
31200
|
// src/commands/refactor/restructure/planRestructure/findStronglyConnectedComponents.ts
|
|
31145
31201
|
function push(state, frames, node) {
|
|
@@ -31194,56 +31250,29 @@ function findStronglyConnectedComponents(nodes, successors) {
|
|
|
31194
31250
|
return state.components;
|
|
31195
31251
|
}
|
|
31196
31252
|
|
|
31197
|
-
// src/commands/refactor/restructure/planRestructure/lowestCommonAncestor.ts
|
|
31198
|
-
import path67 from "path";
|
|
31199
|
-
function lowestCommonAncestor(dirs) {
|
|
31200
|
-
const [first, ...rest] = dirs.map((d) => d.split(path67.sep));
|
|
31201
|
-
let common = first;
|
|
31202
|
-
for (const parts of rest) {
|
|
31203
|
-
let i = 0;
|
|
31204
|
-
while (i < common.length && i < parts.length && common[i] === parts[i]) i++;
|
|
31205
|
-
common = common.slice(0, i);
|
|
31206
|
-
}
|
|
31207
|
-
return common.join(path67.sep) || path67.sep;
|
|
31208
|
-
}
|
|
31209
|
-
|
|
31210
31253
|
// src/commands/refactor/restructure/planRestructure/placeComponents.ts
|
|
31211
|
-
function
|
|
31212
|
-
|
|
31213
|
-
return anchor.mode === "child" ? path68.join(dir, moduleStem(anchor.file)) : dir;
|
|
31214
|
-
}
|
|
31215
|
-
function externalAnchors(component, anchorings) {
|
|
31216
|
-
const members = new Set(component);
|
|
31217
|
-
return component.flatMap(
|
|
31218
|
-
(file) => anchorings.get(file).anchors.filter(
|
|
31219
|
-
(a) => !members.has(a.file)
|
|
31220
|
-
)
|
|
31221
|
-
);
|
|
31222
|
-
}
|
|
31223
|
-
function componentDir(component, anchorings, dirs, scopeRoot) {
|
|
31224
|
-
if (component.some((f) => anchorings.get(f).root))
|
|
31225
|
-
return scopeRoot;
|
|
31226
|
-
const anchors = externalAnchors(component, anchorings);
|
|
31227
|
-
if (anchors.length === 0) return scopeRoot;
|
|
31228
|
-
return lowestCommonAncestor(anchors.map((a) => anchorFolder(a, dirs)));
|
|
31254
|
+
function isPinFolderOwner(anchoring) {
|
|
31255
|
+
return anchoring.root || anchoring.pinned === true;
|
|
31229
31256
|
}
|
|
31230
31257
|
function componentReason(file, component, base) {
|
|
31231
31258
|
if (component.length === 1) return base;
|
|
31232
|
-
const others = component.filter((f) => f !== file).map((f) =>
|
|
31259
|
+
const others = component.filter((f) => f !== file).map((f) => path70.basename(f));
|
|
31233
31260
|
return `${base}; cycle with ${others.join(", ")}`;
|
|
31234
31261
|
}
|
|
31235
31262
|
function placeComponents(files, anchorings, scopeRoot) {
|
|
31236
31263
|
const successors = (file) => anchorings.get(file).anchors.map((a) => a.file);
|
|
31237
|
-
const
|
|
31264
|
+
const layout = { scopeRoot, dirs: /* @__PURE__ */ new Map(), pinFolders: /* @__PURE__ */ new Set() };
|
|
31238
31265
|
const placements = /* @__PURE__ */ new Map();
|
|
31239
31266
|
for (const component of findStronglyConnectedComponents(files, successors)) {
|
|
31240
|
-
const dir = componentDir(component, anchorings,
|
|
31267
|
+
const dir = componentDir(component, anchorings, layout);
|
|
31241
31268
|
for (const file of component) {
|
|
31242
|
-
|
|
31243
|
-
|
|
31269
|
+
const anchoring = anchorings.get(file);
|
|
31270
|
+
layout.dirs.set(file, dir);
|
|
31271
|
+
if (isPinFolderOwner(anchoring))
|
|
31272
|
+
layout.pinFolders.add(path70.join(dir, moduleStem(file)));
|
|
31244
31273
|
placements.set(file, {
|
|
31245
31274
|
dir,
|
|
31246
|
-
reason: componentReason(file, component,
|
|
31275
|
+
reason: componentReason(file, component, anchoring.reason)
|
|
31247
31276
|
});
|
|
31248
31277
|
}
|
|
31249
31278
|
}
|
|
@@ -31252,16 +31281,16 @@ function placeComponents(files, anchorings, scopeRoot) {
|
|
|
31252
31281
|
|
|
31253
31282
|
// src/commands/refactor/restructure/planRestructure.ts
|
|
31254
31283
|
function planRestructure(input) {
|
|
31255
|
-
const scopeRoot =
|
|
31284
|
+
const scopeRoot = path71.resolve(input.scopeRoot);
|
|
31256
31285
|
const files = [...new Set(input.files)].sort();
|
|
31257
31286
|
const index3 = indexEdges(new Set(files), input.edges);
|
|
31258
|
-
const anchorings = collectAnchors(files, index3);
|
|
31287
|
+
const anchorings = collectAnchors(files, index3, new Set(input.pinnedModules));
|
|
31259
31288
|
const placements = placeComponents(files, anchorings, scopeRoot);
|
|
31260
31289
|
const targets = /* @__PURE__ */ new Map();
|
|
31261
31290
|
const moves = [];
|
|
31262
31291
|
for (const file of files) {
|
|
31263
31292
|
const { dir, reason: reason4 } = placements.get(file);
|
|
31264
|
-
const to =
|
|
31293
|
+
const to = path71.join(dir, path71.basename(file));
|
|
31265
31294
|
targets.set(file, to);
|
|
31266
31295
|
if (to !== file) moves.push({ from: file, to, reason: reason4 });
|
|
31267
31296
|
}
|
|
@@ -31270,27 +31299,28 @@ function planRestructure(input) {
|
|
|
31270
31299
|
|
|
31271
31300
|
// src/commands/refactor/restructure/buildPlan.ts
|
|
31272
31301
|
function moduleKey(file) {
|
|
31273
|
-
return
|
|
31302
|
+
return path72.join(path72.dirname(file), moduleStem(file));
|
|
31274
31303
|
}
|
|
31275
31304
|
function findIgnoredOccupants(moves, ignored, scopeRoot) {
|
|
31276
31305
|
const occupants = new Map(ignored.map((f) => [moduleKey(f), f]));
|
|
31277
31306
|
return moves.flatMap((move2) => {
|
|
31278
31307
|
const occupant = occupants.get(moduleKey(move2.to));
|
|
31279
31308
|
if (!occupant) return [];
|
|
31280
|
-
const rel = (f) =>
|
|
31309
|
+
const rel = (f) => path72.relative(scopeRoot, f);
|
|
31281
31310
|
return [
|
|
31282
31311
|
`Target of ${rel(move2.from)} is occupied by ignored file ${rel(occupant)}`
|
|
31283
31312
|
];
|
|
31284
31313
|
});
|
|
31285
31314
|
}
|
|
31286
|
-
function buildPlan3(scopeRoot, files, ignored = []) {
|
|
31315
|
+
function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
|
|
31287
31316
|
const graph = buildImportGraph(new Set(files), findTsConfig(files[0]), {
|
|
31288
31317
|
includeMocks: true
|
|
31289
31318
|
});
|
|
31290
31319
|
const { targets, moves, errors } = planRestructure({
|
|
31291
31320
|
scopeRoot,
|
|
31292
31321
|
files,
|
|
31293
|
-
edges: graph.edges.filter((e) => !e.mock)
|
|
31322
|
+
edges: graph.edges.filter((e) => !e.mock),
|
|
31323
|
+
pinnedModules
|
|
31294
31324
|
});
|
|
31295
31325
|
const allProjectFiles = /* @__PURE__ */ new Set([
|
|
31296
31326
|
...graph.importedBy.keys(),
|
|
@@ -31310,10 +31340,10 @@ function buildPlan3(scopeRoot, files, ignored = []) {
|
|
|
31310
31340
|
import chalk218 from "chalk";
|
|
31311
31341
|
|
|
31312
31342
|
// src/commands/refactor/restructure/displayDrift.ts
|
|
31313
|
-
import
|
|
31343
|
+
import path73 from "path";
|
|
31314
31344
|
import chalk217 from "chalk";
|
|
31315
31345
|
function displayDrift(plan2) {
|
|
31316
|
-
const rel = (file) =>
|
|
31346
|
+
const rel = (file) => path73.relative(process.cwd(), file);
|
|
31317
31347
|
if (plan2.moves.length > 0) {
|
|
31318
31348
|
console.log(chalk217.red(`${plan2.moves.length} file(s) drift from the plan:`));
|
|
31319
31349
|
for (const move2 of plan2.moves)
|
|
@@ -31330,17 +31360,17 @@ function checkPlan(plan2) {
|
|
|
31330
31360
|
}
|
|
31331
31361
|
|
|
31332
31362
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
31333
|
-
import
|
|
31363
|
+
import path76 from "path";
|
|
31334
31364
|
import chalk219 from "chalk";
|
|
31335
31365
|
|
|
31336
31366
|
// src/commands/refactor/restructure/computeDepthStats.ts
|
|
31337
|
-
import
|
|
31367
|
+
import path74 from "path";
|
|
31338
31368
|
function computeDepthStats(targets, scopeRoot) {
|
|
31339
31369
|
const distribution = /* @__PURE__ */ new Map();
|
|
31340
31370
|
let max = 0;
|
|
31341
31371
|
for (const target of targets) {
|
|
31342
|
-
const dir =
|
|
31343
|
-
const depth = dir === "" ? 0 : dir.split(
|
|
31372
|
+
const dir = path74.relative(scopeRoot, path74.dirname(target));
|
|
31373
|
+
const depth = dir === "" ? 0 : dir.split(path74.sep).length;
|
|
31344
31374
|
distribution.set(depth, (distribution.get(depth) ?? 0) + 1);
|
|
31345
31375
|
max = Math.max(max, depth);
|
|
31346
31376
|
}
|
|
@@ -31348,7 +31378,7 @@ function computeDepthStats(targets, scopeRoot) {
|
|
|
31348
31378
|
}
|
|
31349
31379
|
|
|
31350
31380
|
// src/commands/refactor/restructure/formatTree.ts
|
|
31351
|
-
import
|
|
31381
|
+
import path75 from "path";
|
|
31352
31382
|
function insert(root2, parts) {
|
|
31353
31383
|
let node = root2;
|
|
31354
31384
|
for (const part of parts) {
|
|
@@ -31370,7 +31400,7 @@ function render(node, indent3, lines2) {
|
|
|
31370
31400
|
function formatTree(files, scopeRoot) {
|
|
31371
31401
|
const root2 = /* @__PURE__ */ new Map();
|
|
31372
31402
|
for (const file of files)
|
|
31373
|
-
insert(root2,
|
|
31403
|
+
insert(root2, path75.relative(scopeRoot, file).split(path75.sep));
|
|
31374
31404
|
const lines2 = [];
|
|
31375
31405
|
render(root2, "", lines2);
|
|
31376
31406
|
return lines2;
|
|
@@ -31378,7 +31408,7 @@ function formatTree(files, scopeRoot) {
|
|
|
31378
31408
|
|
|
31379
31409
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
31380
31410
|
function relPath2(filePath) {
|
|
31381
|
-
return
|
|
31411
|
+
return path76.relative(process.cwd(), filePath);
|
|
31382
31412
|
}
|
|
31383
31413
|
function displayMoves(plan2) {
|
|
31384
31414
|
if (plan2.moves.length === 0) return;
|
|
@@ -31428,11 +31458,11 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
31428
31458
|
}
|
|
31429
31459
|
|
|
31430
31460
|
// src/commands/refactor/restructure/partitionIgnored.ts
|
|
31431
|
-
import
|
|
31461
|
+
import path77 from "path";
|
|
31432
31462
|
import { minimatch as minimatch4 } from "minimatch";
|
|
31433
31463
|
function partitionIgnored(files) {
|
|
31434
31464
|
const globs = loadConfig().restructure?.ignore ?? [];
|
|
31435
|
-
const isIgnored = (file) => globs.some((glob) => minimatch4(
|
|
31465
|
+
const isIgnored = (file) => globs.some((glob) => minimatch4(path77.relative(process.cwd(), file), glob));
|
|
31436
31466
|
return {
|
|
31437
31467
|
scoped: files.filter((f) => !isIgnored(f)),
|
|
31438
31468
|
ignored: files.filter(isIgnored)
|
|
@@ -31441,7 +31471,7 @@ function partitionIgnored(files) {
|
|
|
31441
31471
|
|
|
31442
31472
|
// src/commands/refactor/restructure.ts
|
|
31443
31473
|
async function restructure(root2, options2 = {}) {
|
|
31444
|
-
const scopeRoot =
|
|
31474
|
+
const scopeRoot = path78.resolve(root2 ?? "src");
|
|
31445
31475
|
if (!fs38.existsSync(scopeRoot) || !fs38.statSync(scopeRoot).isDirectory()) {
|
|
31446
31476
|
console.log(chalk220.red(`Not a directory: ${root2 ?? "src"}`));
|
|
31447
31477
|
process.exit(1);
|
|
@@ -31453,7 +31483,8 @@ async function restructure(root2, options2 = {}) {
|
|
|
31453
31483
|
console.log(chalk220.yellow("No files found under root"));
|
|
31454
31484
|
return;
|
|
31455
31485
|
}
|
|
31456
|
-
const
|
|
31486
|
+
const pinned = loadConfig().restructure?.pin ?? [];
|
|
31487
|
+
const plan2 = buildPlan3(scopeRoot, scoped, ignored, pinned);
|
|
31457
31488
|
if (options2.check) return checkPlan(plan2);
|
|
31458
31489
|
displayPlan2(plan2);
|
|
31459
31490
|
if (plan2.moves.length === 0 && plan2.errors.length === 0) {
|
|
@@ -31839,8 +31870,8 @@ function groupFilesByDirectory(files) {
|
|
|
31839
31870
|
}
|
|
31840
31871
|
|
|
31841
31872
|
// src/commands/review/highLevel/buildHighLevelTree.ts
|
|
31842
|
-
function basename19(
|
|
31843
|
-
return
|
|
31873
|
+
function basename19(path103) {
|
|
31874
|
+
return path103.slice(path103.lastIndexOf("/") + 1);
|
|
31844
31875
|
}
|
|
31845
31876
|
function sum(nodes, key) {
|
|
31846
31877
|
return nodes.reduce((total, node) => total + node[key], 0);
|
|
@@ -31863,19 +31894,19 @@ function nodesOf(at2, prefix2) {
|
|
|
31863
31894
|
}
|
|
31864
31895
|
function collapsedDirNode(name, at2, prefix2) {
|
|
31865
31896
|
let label2 = name;
|
|
31866
|
-
let
|
|
31897
|
+
let path103 = prefix2 ? `${prefix2}/${name}` : name;
|
|
31867
31898
|
let node = at2;
|
|
31868
31899
|
while (node.files.length === 0 && node.dirs.size === 1) {
|
|
31869
31900
|
const [childName, child] = [...node.dirs][0];
|
|
31870
31901
|
label2 = `${label2}/${childName}`;
|
|
31871
|
-
|
|
31902
|
+
path103 = `${path103}/${childName}`;
|
|
31872
31903
|
node = child;
|
|
31873
31904
|
}
|
|
31874
|
-
const children = nodesOf(node,
|
|
31905
|
+
const children = nodesOf(node, path103);
|
|
31875
31906
|
return {
|
|
31876
31907
|
kind: "dir",
|
|
31877
31908
|
name: label2,
|
|
31878
|
-
path:
|
|
31909
|
+
path: path103,
|
|
31879
31910
|
additions: sum(children, "additions"),
|
|
31880
31911
|
deletions: sum(children, "deletions"),
|
|
31881
31912
|
children
|
|
@@ -32133,8 +32164,8 @@ function toStatus(status3) {
|
|
|
32133
32164
|
if (status3 === "removed") return "removed";
|
|
32134
32165
|
return "modified";
|
|
32135
32166
|
}
|
|
32136
|
-
function diffUrl(repo, prNumber,
|
|
32137
|
-
const anchor = createHash3("sha256").update(
|
|
32167
|
+
function diffUrl(repo, prNumber, path103) {
|
|
32168
|
+
const anchor = createHash3("sha256").update(path103).digest("hex");
|
|
32138
32169
|
return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
|
|
32139
32170
|
}
|
|
32140
32171
|
function fetchHighLevelFiles(prNumber, repo) {
|
|
@@ -32190,10 +32221,10 @@ function highLevelReviewPath(repo, headRef, headSha) {
|
|
|
32190
32221
|
|
|
32191
32222
|
// src/commands/review/highLevel/loadHighLevelReview.ts
|
|
32192
32223
|
function loadHighLevelReview(repo, headRef, headSha) {
|
|
32193
|
-
const
|
|
32194
|
-
if (!existsSync63(
|
|
32224
|
+
const path103 = highLevelReviewPath(repo, headRef, headSha);
|
|
32225
|
+
if (!existsSync63(path103)) return void 0;
|
|
32195
32226
|
try {
|
|
32196
|
-
return JSON.parse(readFileSync47(
|
|
32227
|
+
return JSON.parse(readFileSync47(path103, "utf8"));
|
|
32197
32228
|
} catch {
|
|
32198
32229
|
return void 0;
|
|
32199
32230
|
}
|
|
@@ -32204,8 +32235,8 @@ import { minimatch as minimatch7 } from "minimatch";
|
|
|
32204
32235
|
function selectCriticalDiffs(files, criticalPaths) {
|
|
32205
32236
|
if (criticalPaths.length === 0) return [];
|
|
32206
32237
|
return files.filter((file) => criticalPaths.some((glob) => minimatch7(file.path, glob))).map(
|
|
32207
|
-
({ path:
|
|
32208
|
-
path:
|
|
32238
|
+
({ path: path103, status: status3, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
|
|
32239
|
+
path: path103,
|
|
32209
32240
|
status: status3,
|
|
32210
32241
|
additions,
|
|
32211
32242
|
deletions,
|
|
@@ -32320,11 +32351,11 @@ function highLevelPreviewPayload(subject) {
|
|
|
32320
32351
|
import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync39 } from "fs";
|
|
32321
32352
|
import { dirname as dirname35 } from "path";
|
|
32322
32353
|
function saveHighLevelReview(record) {
|
|
32323
|
-
const
|
|
32324
|
-
mkdirSync22(dirname35(
|
|
32325
|
-
writeFileSync39(
|
|
32354
|
+
const path103 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
|
|
32355
|
+
mkdirSync22(dirname35(path103), { recursive: true });
|
|
32356
|
+
writeFileSync39(path103, `${JSON.stringify(record, null, 2)}
|
|
32326
32357
|
`);
|
|
32327
|
-
return
|
|
32358
|
+
return path103;
|
|
32328
32359
|
}
|
|
32329
32360
|
|
|
32330
32361
|
// src/commands/review/highLevel/openHighLevelOverlay.ts
|
|
@@ -32343,9 +32374,9 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
32343
32374
|
{ rejectIsOutcome: true }
|
|
32344
32375
|
);
|
|
32345
32376
|
const record = buildHighLevelRecord(subject, decision);
|
|
32346
|
-
const
|
|
32377
|
+
const path103 = saveHighLevelReview(record);
|
|
32347
32378
|
console.log(`Verdict: ${record.verdict}`);
|
|
32348
|
-
console.log(`Saved ${
|
|
32379
|
+
console.log(`Saved ${path103}`);
|
|
32349
32380
|
console.log("Nothing was posted to GitHub.");
|
|
32350
32381
|
return record;
|
|
32351
32382
|
}
|
|
@@ -33360,8 +33391,8 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
33360
33391
|
// src/commands/review/prepareReviewDir.ts
|
|
33361
33392
|
import { existsSync as existsSync64, mkdirSync as mkdirSync23, unlinkSync as unlinkSync18, writeFileSync as writeFileSync40 } from "fs";
|
|
33362
33393
|
function clearReviewFiles(paths) {
|
|
33363
|
-
for (const
|
|
33364
|
-
if (existsSync64(
|
|
33394
|
+
for (const path103 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
33395
|
+
if (existsSync64(path103)) unlinkSync18(path103);
|
|
33365
33396
|
}
|
|
33366
33397
|
}
|
|
33367
33398
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -34599,7 +34630,7 @@ function registerReview(program2) {
|
|
|
34599
34630
|
|
|
34600
34631
|
// src/commands/rules/addRule.ts
|
|
34601
34632
|
import { existsSync as existsSync69, readFileSync as readFileSync53, writeFileSync as writeFileSync43 } from "fs";
|
|
34602
|
-
import
|
|
34633
|
+
import path83 from "path";
|
|
34603
34634
|
import chalk232 from "chalk";
|
|
34604
34635
|
|
|
34605
34636
|
// src/commands/rules/insertRuleBullet.ts
|
|
@@ -34627,7 +34658,7 @@ import { readFileSync as readFileSync50 } from "fs";
|
|
|
34627
34658
|
|
|
34628
34659
|
// src/commands/rules/findClaudeFiles.ts
|
|
34629
34660
|
import { readdirSync as readdirSync13 } from "fs";
|
|
34630
|
-
import
|
|
34661
|
+
import path79 from "path";
|
|
34631
34662
|
var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
|
|
34632
34663
|
function findClaudeFiles(dir) {
|
|
34633
34664
|
const results = [];
|
|
@@ -34635,9 +34666,9 @@ function findClaudeFiles(dir) {
|
|
|
34635
34666
|
if (entry.isDirectory()) {
|
|
34636
34667
|
if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
|
|
34637
34668
|
continue;
|
|
34638
|
-
results.push(...findClaudeFiles(
|
|
34669
|
+
results.push(...findClaudeFiles(path79.join(dir, entry.name)));
|
|
34639
34670
|
} else if (entry.name === "CLAUDE.md") {
|
|
34640
|
-
results.push(
|
|
34671
|
+
results.push(path79.join(dir, entry.name));
|
|
34641
34672
|
}
|
|
34642
34673
|
}
|
|
34643
34674
|
return results;
|
|
@@ -34656,34 +34687,34 @@ function nextRuleCode(root2) {
|
|
|
34656
34687
|
|
|
34657
34688
|
// src/commands/rules/resolveRuleScope.ts
|
|
34658
34689
|
import { existsSync as existsSync67 } from "fs";
|
|
34659
|
-
import
|
|
34690
|
+
import path80 from "path";
|
|
34660
34691
|
function resolveRuleScope(target) {
|
|
34661
|
-
const resolved =
|
|
34662
|
-
if (
|
|
34692
|
+
const resolved = path80.resolve(target);
|
|
34693
|
+
if (path80.basename(resolved) === "CLAUDE.md") return resolved;
|
|
34663
34694
|
const startDir = scopeDirectory(resolved);
|
|
34664
34695
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
34665
34696
|
let current = startDir;
|
|
34666
34697
|
while (true) {
|
|
34667
|
-
const candidate =
|
|
34698
|
+
const candidate = path80.join(current, "CLAUDE.md");
|
|
34668
34699
|
if (existsSync67(candidate)) return candidate;
|
|
34669
|
-
if (current === root2 || current ===
|
|
34670
|
-
current =
|
|
34700
|
+
if (current === root2 || current === path80.dirname(current)) break;
|
|
34701
|
+
current = path80.dirname(current);
|
|
34671
34702
|
}
|
|
34672
|
-
return
|
|
34703
|
+
return path80.join(root2, "CLAUDE.md");
|
|
34673
34704
|
}
|
|
34674
34705
|
|
|
34675
34706
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
34676
34707
|
import { existsSync as existsSync68, readFileSync as readFileSync52, writeFileSync as writeFileSync42 } from "fs";
|
|
34677
|
-
import
|
|
34708
|
+
import path82 from "path";
|
|
34678
34709
|
|
|
34679
34710
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
34680
34711
|
import { readFileSync as readFileSync51 } from "fs";
|
|
34681
|
-
import
|
|
34712
|
+
import path81 from "path";
|
|
34682
34713
|
function scopedRuleDirectories(root2) {
|
|
34683
34714
|
return findClaudeFiles(root2).filter(
|
|
34684
|
-
(file) =>
|
|
34715
|
+
(file) => path81.dirname(file) !== root2 && parseRulesSection(readFileSync51(file, "utf8")).length > 0
|
|
34685
34716
|
).map(
|
|
34686
|
-
(file) => `${
|
|
34717
|
+
(file) => `${path81.relative(root2, path81.dirname(file)).split(path81.sep).join("/")}/`
|
|
34687
34718
|
).sort();
|
|
34688
34719
|
}
|
|
34689
34720
|
|
|
@@ -34722,7 +34753,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
34722
34753
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
34723
34754
|
function updateScopedRulesIndex(root2) {
|
|
34724
34755
|
const directories = scopedRuleDirectories(root2);
|
|
34725
|
-
const rootFile =
|
|
34756
|
+
const rootFile = path82.join(root2, "CLAUDE.md");
|
|
34726
34757
|
const before = existsSync68(rootFile) ? readFileSync52(rootFile, "utf8") : "";
|
|
34727
34758
|
const after = upsertScopedRulesPointer(before, directories);
|
|
34728
34759
|
if (after !== before) writeFileSync42(rootFile, after);
|
|
@@ -34741,7 +34772,7 @@ function addRule(text18, options2) {
|
|
|
34741
34772
|
return;
|
|
34742
34773
|
}
|
|
34743
34774
|
const target = resolveRuleScope(options2.scope ?? process.cwd());
|
|
34744
|
-
const targetDir =
|
|
34775
|
+
const targetDir = path83.dirname(target);
|
|
34745
34776
|
const root2 = findRepoRoot(targetDir) ?? targetDir;
|
|
34746
34777
|
const code = nextRuleCode(root2);
|
|
34747
34778
|
writeFileSync43(
|
|
@@ -34754,18 +34785,18 @@ function addRule(text18, options2) {
|
|
|
34754
34785
|
);
|
|
34755
34786
|
updateScopedRulesIndex(root2);
|
|
34756
34787
|
console.log(
|
|
34757
|
-
`Added ${chalk232.cyan(code)} to ${
|
|
34788
|
+
`Added ${chalk232.cyan(code)} to ${path83.relative(process.cwd(), target) || target}`
|
|
34758
34789
|
);
|
|
34759
34790
|
}
|
|
34760
34791
|
|
|
34761
34792
|
// src/commands/rules/indexRules.ts
|
|
34762
|
-
import
|
|
34793
|
+
import path84 from "path";
|
|
34763
34794
|
import chalk233 from "chalk";
|
|
34764
34795
|
function indexRules() {
|
|
34765
34796
|
const startDir = scopeDirectory(process.cwd());
|
|
34766
34797
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
34767
34798
|
const directories = updateScopedRulesIndex(root2);
|
|
34768
|
-
const rootFile =
|
|
34799
|
+
const rootFile = path84.relative(process.cwd(), path84.join(root2, "CLAUDE.md"));
|
|
34769
34800
|
if (directories.length === 0) {
|
|
34770
34801
|
console.log(
|
|
34771
34802
|
chalk233.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
@@ -34778,13 +34809,13 @@ function indexRules() {
|
|
|
34778
34809
|
}
|
|
34779
34810
|
|
|
34780
34811
|
// src/commands/rules/listRules.ts
|
|
34781
|
-
import
|
|
34812
|
+
import path85 from "path";
|
|
34782
34813
|
import chalk234 from "chalk";
|
|
34783
34814
|
function listRules(target, options2 = {}) {
|
|
34784
|
-
const resolved =
|
|
34815
|
+
const resolved = path85.resolve(target ?? process.cwd());
|
|
34785
34816
|
const rules3 = readScopedRules(resolved);
|
|
34786
34817
|
if (rules3.length === 0) {
|
|
34787
|
-
const label2 =
|
|
34818
|
+
const label2 = path85.relative(process.cwd(), resolved) || ".";
|
|
34788
34819
|
console.log(chalk234.gray(`No rules in scope for ${label2}`));
|
|
34789
34820
|
return;
|
|
34790
34821
|
}
|
|
@@ -34795,7 +34826,7 @@ function listRules(target, options2 = {}) {
|
|
|
34795
34826
|
if (rule.source !== shown) {
|
|
34796
34827
|
shown = rule.source;
|
|
34797
34828
|
console.log(
|
|
34798
|
-
chalk234.dim(base ?
|
|
34829
|
+
chalk234.dim(base ? path85.relative(base, rule.source) : rule.source)
|
|
34799
34830
|
);
|
|
34800
34831
|
}
|
|
34801
34832
|
console.log(
|
|
@@ -34891,8 +34922,8 @@ import chalk240 from "chalk";
|
|
|
34891
34922
|
|
|
34892
34923
|
// src/commands/seq/fetchSeq.ts
|
|
34893
34924
|
import chalk237 from "chalk";
|
|
34894
|
-
async function fetchSeq(conn,
|
|
34895
|
-
const url = `${conn.url}${
|
|
34925
|
+
async function fetchSeq(conn, path103, params) {
|
|
34926
|
+
const url = `${conn.url}${path103}?${params}`;
|
|
34896
34927
|
const response = await fetch(url, {
|
|
34897
34928
|
headers: {
|
|
34898
34929
|
Accept: "application/json",
|
|
@@ -35273,7 +35304,7 @@ async function previewSlackThreadParts({
|
|
|
35273
35304
|
`Approved for ${target}. The ${bodies.length} bodies to post, in thread order, are at:`
|
|
35274
35305
|
);
|
|
35275
35306
|
paths.forEach(
|
|
35276
|
-
(
|
|
35307
|
+
(path103, index3) => console.log(`${index3 + 1}/${paths.length} ${path103}`)
|
|
35277
35308
|
);
|
|
35278
35309
|
console.log(
|
|
35279
35310
|
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.`
|
|
@@ -35616,15 +35647,15 @@ function registerSql(program2) {
|
|
|
35616
35647
|
// src/commands/sync.ts
|
|
35617
35648
|
import * as fs47 from "fs";
|
|
35618
35649
|
import * as os5 from "os";
|
|
35619
|
-
import * as
|
|
35650
|
+
import * as path96 from "path";
|
|
35620
35651
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
35621
35652
|
|
|
35622
35653
|
// src/commands/sync/pruneCommands.ts
|
|
35623
|
-
import * as
|
|
35654
|
+
import * as path87 from "path";
|
|
35624
35655
|
|
|
35625
35656
|
// src/commands/sync/pruneTarget.ts
|
|
35626
35657
|
import * as fs39 from "fs";
|
|
35627
|
-
import * as
|
|
35658
|
+
import * as path86 from "path";
|
|
35628
35659
|
function pruneTarget(targetDir, keepNames, shape, options2) {
|
|
35629
35660
|
const result = {
|
|
35630
35661
|
orphans: [],
|
|
@@ -35642,7 +35673,7 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
|
|
|
35642
35673
|
}
|
|
35643
35674
|
if (keep.has(name)) continue;
|
|
35644
35675
|
result.orphans.push(entry.name);
|
|
35645
|
-
const entryPath =
|
|
35676
|
+
const entryPath = path86.join(targetDir, entry.name);
|
|
35646
35677
|
const reason4 = shape.blockedBy?.(entryPath);
|
|
35647
35678
|
if (reason4) {
|
|
35648
35679
|
result.skipped.push({ name: entry.name, reason: reason4 });
|
|
@@ -35662,7 +35693,7 @@ function pruneCommands(targetDir, commandNames, options2) {
|
|
|
35662
35693
|
targetDir,
|
|
35663
35694
|
commandNames,
|
|
35664
35695
|
{
|
|
35665
|
-
nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ?
|
|
35696
|
+
nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path87.basename(entry.name, ".md") : void 0
|
|
35666
35697
|
},
|
|
35667
35698
|
options2
|
|
35668
35699
|
);
|
|
@@ -35697,11 +35728,11 @@ function reportPrune(label2, result, force) {
|
|
|
35697
35728
|
|
|
35698
35729
|
// src/commands/sync/reportRetiredAgentsFiles.ts
|
|
35699
35730
|
import * as fs40 from "fs";
|
|
35700
|
-
import * as
|
|
35731
|
+
import * as path88 from "path";
|
|
35701
35732
|
var retired = [
|
|
35702
|
-
|
|
35703
|
-
|
|
35704
|
-
|
|
35733
|
+
path88.join(harnesses.claude.homeDir, "CLAUDE.md"),
|
|
35734
|
+
path88.join(harnesses.codex.homeDir, "AGENTS.md"),
|
|
35735
|
+
path88.join(harnesses.pi.homeDir, "AGENTS.md")
|
|
35705
35736
|
];
|
|
35706
35737
|
function reportRetiredAgentsFiles() {
|
|
35707
35738
|
const leftovers = retired.filter((file) => fs40.existsSync(file));
|
|
@@ -35716,27 +35747,27 @@ function reportRetiredAgentsFiles() {
|
|
|
35716
35747
|
}
|
|
35717
35748
|
|
|
35718
35749
|
// src/commands/sync/syncCodex.ts
|
|
35719
|
-
import * as
|
|
35750
|
+
import * as path91 from "path";
|
|
35720
35751
|
|
|
35721
35752
|
// src/commands/sync/installHarnessCommands.ts
|
|
35722
35753
|
import * as fs41 from "fs";
|
|
35723
|
-
import * as
|
|
35754
|
+
import * as path89 from "path";
|
|
35724
35755
|
function installHarnessCommands(claudeDir, harness, transform) {
|
|
35725
|
-
const commandsSource =
|
|
35756
|
+
const commandsSource = path89.join(claudeDir, "commands");
|
|
35726
35757
|
const files = fs41.readdirSync(commandsSource);
|
|
35727
|
-
const
|
|
35758
|
+
const names = [];
|
|
35728
35759
|
let synced = 0;
|
|
35729
35760
|
for (const file of files) {
|
|
35730
35761
|
if (!file.endsWith(".md")) continue;
|
|
35731
35762
|
const name = file.replace(/\.md$/, "");
|
|
35732
|
-
|
|
35733
|
-
const content = fs41.readFileSync(
|
|
35734
|
-
const target =
|
|
35735
|
-
fs41.mkdirSync(
|
|
35763
|
+
names.push(name);
|
|
35764
|
+
const content = fs41.readFileSync(path89.join(commandsSource, file), "utf8");
|
|
35765
|
+
const target = path89.join(harness.homeDir, harness.sync.commandDest(name));
|
|
35766
|
+
fs41.mkdirSync(path89.dirname(target), { recursive: true });
|
|
35736
35767
|
fs41.writeFileSync(target, transform(name, content));
|
|
35737
35768
|
synced++;
|
|
35738
35769
|
}
|
|
35739
|
-
return { total: files.length, synced, names
|
|
35770
|
+
return { total: files.length, synced, names };
|
|
35740
35771
|
}
|
|
35741
35772
|
|
|
35742
35773
|
// src/commands/sync/pruneSkills.ts
|
|
@@ -35761,7 +35792,7 @@ function unexpectedContent(skillDir) {
|
|
|
35761
35792
|
|
|
35762
35793
|
// src/commands/sync/syncCodexHooks.ts
|
|
35763
35794
|
import * as fs43 from "fs";
|
|
35764
|
-
import * as
|
|
35795
|
+
import * as path90 from "path";
|
|
35765
35796
|
var BEGIN = "# >>> assist codex hooks (managed) \u2014 do not edit >>>";
|
|
35766
35797
|
var END = "# <<< assist codex hooks (managed) <<<";
|
|
35767
35798
|
function upsertManagedBlock(existing, body) {
|
|
@@ -35792,9 +35823,9 @@ ${rest}
|
|
|
35792
35823
|
}
|
|
35793
35824
|
function syncCodexHooks(sourcePath) {
|
|
35794
35825
|
const body = fs43.readFileSync(sourcePath, "utf8");
|
|
35795
|
-
const configPath =
|
|
35826
|
+
const configPath = path90.join(harnesses.codex.homeDir, "config.toml");
|
|
35796
35827
|
const existing = fs43.existsSync(configPath) ? fs43.readFileSync(configPath, "utf8") : "";
|
|
35797
|
-
fs43.mkdirSync(
|
|
35828
|
+
fs43.mkdirSync(path90.dirname(configPath), { recursive: true });
|
|
35798
35829
|
fs43.writeFileSync(configPath, upsertManagedBlock(existing, body));
|
|
35799
35830
|
console.log(
|
|
35800
35831
|
"Registered assist codex-hook in ~/.codex/config.toml (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
|
|
@@ -35821,53 +35852,53 @@ description: ${quoteYaml(description)}
|
|
|
35821
35852
|
}
|
|
35822
35853
|
function syncCodex(claudeDir, options2) {
|
|
35823
35854
|
if (!isHarnessAvailable("codex")) return;
|
|
35824
|
-
const { total, names
|
|
35855
|
+
const { total, names } = installHarnessCommands(
|
|
35825
35856
|
claudeDir,
|
|
35826
35857
|
harnesses.codex,
|
|
35827
35858
|
commandToSkill
|
|
35828
35859
|
);
|
|
35829
|
-
syncCodexHooks(
|
|
35860
|
+
syncCodexHooks(path91.join(claudeDir, "..", "codex", "config.toml"));
|
|
35830
35861
|
console.log(`Synced ${total} skill(s) to ~/.codex/skills`);
|
|
35831
35862
|
if (!options2?.prune) return;
|
|
35832
35863
|
const force = options2.force ?? false;
|
|
35833
35864
|
reportPrune(
|
|
35834
35865
|
"~/.codex/skills",
|
|
35835
|
-
pruneSkills(
|
|
35866
|
+
pruneSkills(path91.join(harnesses.codex.homeDir, "skills"), names, { force }),
|
|
35836
35867
|
force
|
|
35837
35868
|
);
|
|
35838
35869
|
}
|
|
35839
35870
|
|
|
35840
35871
|
// src/commands/sync/syncDesign.ts
|
|
35841
35872
|
import * as fs44 from "fs";
|
|
35842
|
-
import * as
|
|
35873
|
+
import * as path92 from "path";
|
|
35843
35874
|
function syncDesign(claudeDir, targetBase) {
|
|
35844
|
-
const systemPromptSource =
|
|
35845
|
-
const systemPromptTarget =
|
|
35875
|
+
const systemPromptSource = path92.join(claudeDir, "design-system-prompt.md");
|
|
35876
|
+
const systemPromptTarget = path92.join(targetBase, "design-system-prompt.md");
|
|
35846
35877
|
fs44.copyFileSync(systemPromptSource, systemPromptTarget);
|
|
35847
35878
|
console.log(
|
|
35848
35879
|
"Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
|
|
35849
35880
|
);
|
|
35850
|
-
const skillsSource =
|
|
35851
|
-
const skillsTarget =
|
|
35881
|
+
const skillsSource = path92.join(claudeDir, "skills");
|
|
35882
|
+
const skillsTarget = path92.join(targetBase, "skills");
|
|
35852
35883
|
fs44.mkdirSync(skillsTarget, { recursive: true });
|
|
35853
35884
|
const files = fs44.readdirSync(skillsSource);
|
|
35854
35885
|
for (const file of files) {
|
|
35855
35886
|
fs44.copyFileSync(
|
|
35856
|
-
|
|
35857
|
-
|
|
35887
|
+
path92.join(skillsSource, file),
|
|
35888
|
+
path92.join(skillsTarget, file)
|
|
35858
35889
|
);
|
|
35859
35890
|
}
|
|
35860
35891
|
console.log(`Synced ${files.length} design skill(s) to ~/.claude/skills`);
|
|
35861
35892
|
}
|
|
35862
35893
|
|
|
35863
35894
|
// src/commands/sync/syncPi.ts
|
|
35864
|
-
import * as
|
|
35895
|
+
import * as path94 from "path";
|
|
35865
35896
|
|
|
35866
35897
|
// src/commands/sync/syncPiHooks.ts
|
|
35867
35898
|
import * as fs45 from "fs";
|
|
35868
|
-
import * as
|
|
35899
|
+
import * as path93 from "path";
|
|
35869
35900
|
function piExtensionsDir() {
|
|
35870
|
-
return
|
|
35901
|
+
return path93.join(harnesses.pi.homeDir, "extensions");
|
|
35871
35902
|
}
|
|
35872
35903
|
function syncPiHooks(sourceDir) {
|
|
35873
35904
|
const target = piExtensionsDir();
|
|
@@ -35875,8 +35906,8 @@ function syncPiHooks(sourceDir) {
|
|
|
35875
35906
|
const files = fs45.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
|
|
35876
35907
|
for (const file of files) {
|
|
35877
35908
|
fs45.copyFileSync(
|
|
35878
|
-
|
|
35879
|
-
|
|
35909
|
+
path93.join(sourceDir, file),
|
|
35910
|
+
path93.join(target, `assist-${file}`)
|
|
35880
35911
|
);
|
|
35881
35912
|
}
|
|
35882
35913
|
console.log(
|
|
@@ -35908,29 +35939,29 @@ function commandToPrompt(name, content) {
|
|
|
35908
35939
|
}
|
|
35909
35940
|
function syncPi(claudeDir, options2) {
|
|
35910
35941
|
if (!isHarnessAvailable("pi")) return;
|
|
35911
|
-
const { synced, names
|
|
35942
|
+
const { synced, names } = installHarnessCommands(
|
|
35912
35943
|
claudeDir,
|
|
35913
35944
|
harnesses.pi,
|
|
35914
35945
|
commandToPrompt
|
|
35915
35946
|
);
|
|
35916
|
-
syncPiHooks(
|
|
35947
|
+
syncPiHooks(path94.join(claudeDir, "..", "pi"));
|
|
35917
35948
|
console.log(`Synced ${synced} prompt(s) to ~/.pi/agent/prompts`);
|
|
35918
35949
|
if (!options2?.prune) return;
|
|
35919
35950
|
const force = options2.force ?? false;
|
|
35920
35951
|
reportPrune(
|
|
35921
35952
|
"~/.pi/agent/prompts",
|
|
35922
|
-
pruneCommands(
|
|
35953
|
+
pruneCommands(path94.join(harnesses.pi.homeDir, "prompts"), names, { force }),
|
|
35923
35954
|
force
|
|
35924
35955
|
);
|
|
35925
35956
|
}
|
|
35926
35957
|
|
|
35927
35958
|
// src/commands/sync/syncSettings.ts
|
|
35928
35959
|
import * as fs46 from "fs";
|
|
35929
|
-
import * as
|
|
35960
|
+
import * as path95 from "path";
|
|
35930
35961
|
import chalk247 from "chalk";
|
|
35931
35962
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
35932
|
-
const source =
|
|
35933
|
-
const target =
|
|
35963
|
+
const source = path95.join(claudeDir, "settings.json");
|
|
35964
|
+
const target = path95.join(targetBase, "settings.json");
|
|
35934
35965
|
const sourceContent = fs46.readFileSync(source, "utf8");
|
|
35935
35966
|
const sourceSettings = JSON.parse(sourceContent);
|
|
35936
35967
|
const targetExists = fs46.existsSync(target);
|
|
@@ -35970,13 +36001,13 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
35970
36001
|
|
|
35971
36002
|
// src/commands/sync.ts
|
|
35972
36003
|
var __filename4 = fileURLToPath8(import.meta.url);
|
|
35973
|
-
var __dirname5 =
|
|
36004
|
+
var __dirname5 = path96.dirname(__filename4);
|
|
35974
36005
|
async function sync(options2) {
|
|
35975
36006
|
const config = loadConfig();
|
|
35976
36007
|
const yes = options2?.yes ?? config.sync.autoConfirm;
|
|
35977
36008
|
const prune = { prune: options2?.prune, force: options2?.force };
|
|
35978
|
-
const claudeDir =
|
|
35979
|
-
const targetBase =
|
|
36009
|
+
const claudeDir = path96.join(__dirname5, "..", "claude");
|
|
36010
|
+
const targetBase = path96.join(os5.homedir(), ".claude");
|
|
35980
36011
|
const commandFiles = syncCommands(claudeDir, targetBase);
|
|
35981
36012
|
syncDesign(claudeDir, targetBase);
|
|
35982
36013
|
await syncSettings(claudeDir, targetBase, { yes });
|
|
@@ -35984,21 +36015,21 @@ async function sync(options2) {
|
|
|
35984
36015
|
syncPi(claudeDir, prune);
|
|
35985
36016
|
reportRetiredAgentsFiles();
|
|
35986
36017
|
if (!options2?.prune) return;
|
|
35987
|
-
const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) =>
|
|
36018
|
+
const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path96.basename(file, ".md"));
|
|
35988
36019
|
const force = options2.force ?? false;
|
|
35989
36020
|
reportPrune(
|
|
35990
36021
|
"~/.claude/commands",
|
|
35991
|
-
pruneCommands(
|
|
36022
|
+
pruneCommands(path96.join(targetBase, "commands"), commandNames, { force }),
|
|
35992
36023
|
force
|
|
35993
36024
|
);
|
|
35994
36025
|
}
|
|
35995
36026
|
function syncCommands(claudeDir, targetBase) {
|
|
35996
|
-
const sourceDir =
|
|
35997
|
-
const targetDir =
|
|
36027
|
+
const sourceDir = path96.join(claudeDir, "commands");
|
|
36028
|
+
const targetDir = path96.join(targetBase, "commands");
|
|
35998
36029
|
fs47.mkdirSync(targetDir, { recursive: true });
|
|
35999
36030
|
const files = fs47.readdirSync(sourceDir);
|
|
36000
36031
|
for (const file of files) {
|
|
36001
|
-
fs47.copyFileSync(
|
|
36032
|
+
fs47.copyFileSync(path96.join(sourceDir, file), path96.join(targetDir, file));
|
|
36002
36033
|
console.log(`Copied ${file} to ${targetDir}`);
|
|
36003
36034
|
}
|
|
36004
36035
|
console.log(`Synced ${files.length} command(s) to ~/.claude/commands`);
|
|
@@ -37053,9 +37084,9 @@ import { existsSync as existsSync78, readFileSync as readFileSync59 } from "fs";
|
|
|
37053
37084
|
|
|
37054
37085
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
37055
37086
|
import { minimatch as minimatch9 } from "minimatch";
|
|
37056
|
-
function resolveStringsAtPath(data,
|
|
37087
|
+
function resolveStringsAtPath(data, path103) {
|
|
37057
37088
|
let current = data;
|
|
37058
|
-
for (const segment of
|
|
37089
|
+
for (const segment of path103.split(".")) {
|
|
37059
37090
|
if (current === null || typeof current !== "object") return [];
|
|
37060
37091
|
current = current[segment];
|
|
37061
37092
|
}
|
|
@@ -37068,10 +37099,10 @@ function resolveStringsAtPath(data, path101) {
|
|
|
37068
37099
|
}
|
|
37069
37100
|
function findRuleViolations(data, rule) {
|
|
37070
37101
|
const violations = [];
|
|
37071
|
-
for (const
|
|
37072
|
-
for (const value of resolveStringsAtPath(data,
|
|
37102
|
+
for (const path103 of rule.paths) {
|
|
37103
|
+
for (const value of resolveStringsAtPath(data, path103)) {
|
|
37073
37104
|
if (minimatch9(value, rule.disallowed))
|
|
37074
|
-
violations.push({ file: rule.file, path:
|
|
37105
|
+
violations.push({ file: rule.file, path: path103, value });
|
|
37075
37106
|
}
|
|
37076
37107
|
}
|
|
37077
37108
|
return violations;
|
|
@@ -37110,8 +37141,8 @@ function forbiddenStrings() {
|
|
|
37110
37141
|
process.exit(0);
|
|
37111
37142
|
}
|
|
37112
37143
|
console.log("Forbidden strings found:\n");
|
|
37113
|
-
for (const { file, path:
|
|
37114
|
-
console.log(` ${file} ${
|
|
37144
|
+
for (const { file, path: path103, value } of violations) {
|
|
37145
|
+
console.log(` ${file} ${path103}: ${value}`);
|
|
37115
37146
|
}
|
|
37116
37147
|
console.log(`
|
|
37117
37148
|
Total: ${violations.length} forbidden string(s).`);
|
|
@@ -37167,7 +37198,7 @@ Total: ${lines2.length} hardcoded color(s)`);
|
|
|
37167
37198
|
|
|
37168
37199
|
// src/commands/verify/migrations.ts
|
|
37169
37200
|
import { readFileSync as readFileSync60 } from "fs";
|
|
37170
|
-
import
|
|
37201
|
+
import path98 from "path";
|
|
37171
37202
|
|
|
37172
37203
|
// src/commands/verify/migrations/checkAppendOnly.ts
|
|
37173
37204
|
function checkAppendOnly(baseline, current) {
|
|
@@ -37259,15 +37290,15 @@ function readBaselineMigrations(repoRelativeDir, ref) {
|
|
|
37259
37290
|
} catch {
|
|
37260
37291
|
return baseline;
|
|
37261
37292
|
}
|
|
37262
|
-
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((
|
|
37263
|
-
for (const
|
|
37293
|
+
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path103) => MIGRATION_FILE3.test(basename25(path103)));
|
|
37294
|
+
for (const path103 of paths) {
|
|
37264
37295
|
try {
|
|
37265
|
-
const content = execSync63(`git show "${ref}:${
|
|
37296
|
+
const content = execSync63(`git show "${ref}:${path103}"`, {
|
|
37266
37297
|
encoding: "utf8",
|
|
37267
37298
|
maxBuffer: 16 * 1024 * 1024,
|
|
37268
37299
|
stdio: ["pipe", "pipe", "pipe"]
|
|
37269
37300
|
});
|
|
37270
|
-
baseline.set(basename25(
|
|
37301
|
+
baseline.set(basename25(path103), content);
|
|
37271
37302
|
} catch {
|
|
37272
37303
|
}
|
|
37273
37304
|
}
|
|
@@ -37306,11 +37337,11 @@ function resolveBaselineRef() {
|
|
|
37306
37337
|
}
|
|
37307
37338
|
|
|
37308
37339
|
// src/commands/verify/migrations/migrationsDir.ts
|
|
37309
|
-
import
|
|
37340
|
+
import path97 from "path";
|
|
37310
37341
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
37311
37342
|
function migrationsDir() {
|
|
37312
|
-
return
|
|
37313
|
-
|
|
37343
|
+
return path97.resolve(
|
|
37344
|
+
path97.dirname(fileURLToPath9(import.meta.url)),
|
|
37314
37345
|
"../../../shared/db/migrations"
|
|
37315
37346
|
);
|
|
37316
37347
|
}
|
|
@@ -37331,7 +37362,7 @@ function migrations2() {
|
|
|
37331
37362
|
if (ref) {
|
|
37332
37363
|
const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
|
|
37333
37364
|
const current = new Map(
|
|
37334
|
-
files.map((file) => [file, readFileSync60(
|
|
37365
|
+
files.map((file) => [file, readFileSync60(path98.join(dir, file), "utf8")])
|
|
37335
37366
|
);
|
|
37336
37367
|
for (const finding of checkAppendOnly(baseline, current)) {
|
|
37337
37368
|
problems.push(
|
|
@@ -37836,11 +37867,11 @@ var webUiPrefix = "src/commands/sessions/web/ui/";
|
|
|
37836
37867
|
var sessionsPrefix = "src/commands/sessions/";
|
|
37837
37868
|
var rules = [
|
|
37838
37869
|
{
|
|
37839
|
-
matches: (
|
|
37870
|
+
matches: (path103) => path103.startsWith(webUiPrefix),
|
|
37840
37871
|
advice: "restart the web server, then hard-reload the browser tab"
|
|
37841
37872
|
},
|
|
37842
37873
|
{
|
|
37843
|
-
matches: (
|
|
37874
|
+
matches: (path103) => path103.startsWith(sessionsPrefix) && !path103.startsWith(webUiPrefix),
|
|
37844
37875
|
advice: "restart the daemon"
|
|
37845
37876
|
}
|
|
37846
37877
|
];
|
|
@@ -37851,27 +37882,27 @@ function restartAdvice(paths) {
|
|
|
37851
37882
|
// src/commands/watch/syncAdvice.ts
|
|
37852
37883
|
var rules2 = [
|
|
37853
37884
|
{
|
|
37854
|
-
matches: (
|
|
37885
|
+
matches: (path103) => path103.startsWith("claude/commands/"),
|
|
37855
37886
|
reason: "claude/commands changed"
|
|
37856
37887
|
},
|
|
37857
37888
|
{
|
|
37858
|
-
matches: (
|
|
37889
|
+
matches: (path103) => path103.startsWith("claude/skills/"),
|
|
37859
37890
|
reason: "claude/skills changed"
|
|
37860
37891
|
},
|
|
37861
37892
|
{
|
|
37862
|
-
matches: (
|
|
37893
|
+
matches: (path103) => path103 === "claude/settings.json",
|
|
37863
37894
|
reason: "claude/settings.json changed"
|
|
37864
37895
|
},
|
|
37865
37896
|
{
|
|
37866
|
-
matches: (
|
|
37897
|
+
matches: (path103) => path103 === "claude/design-system-prompt.md",
|
|
37867
37898
|
reason: "claude/design-system-prompt.md changed"
|
|
37868
37899
|
},
|
|
37869
37900
|
{
|
|
37870
|
-
matches: (
|
|
37901
|
+
matches: (path103) => path103.startsWith("codex/"),
|
|
37871
37902
|
reason: "codex sources changed"
|
|
37872
37903
|
},
|
|
37873
37904
|
{
|
|
37874
|
-
matches: (
|
|
37905
|
+
matches: (path103) => path103.startsWith("pi/"),
|
|
37875
37906
|
reason: "pi sources changed"
|
|
37876
37907
|
}
|
|
37877
37908
|
];
|
|
@@ -38103,8 +38134,8 @@ function resolveParams(params, cliArgs) {
|
|
|
38103
38134
|
}
|
|
38104
38135
|
if (missing.length > 0) {
|
|
38105
38136
|
const s = missing.length > 1 ? "s" : "";
|
|
38106
|
-
const
|
|
38107
|
-
console.error(`Missing required param${s}: ${
|
|
38137
|
+
const names = missing.map((n) => `"${n}"`).join(", ");
|
|
38138
|
+
console.error(`Missing required param${s}: ${names}`);
|
|
38108
38139
|
process.exit(1);
|
|
38109
38140
|
}
|
|
38110
38141
|
resolved.push(...cliArgs.slice(params.length));
|
|
@@ -38579,9 +38610,9 @@ function findPortFile(roamDir) {
|
|
|
38579
38610
|
return void 0;
|
|
38580
38611
|
}
|
|
38581
38612
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
38582
|
-
const
|
|
38613
|
+
const path103 = join100(roamDir, name);
|
|
38583
38614
|
try {
|
|
38584
|
-
return { path:
|
|
38615
|
+
return { path: path103, mtimeMs: statSync13(path103).mtimeMs };
|
|
38585
38616
|
} catch {
|
|
38586
38617
|
return void 0;
|
|
38587
38618
|
}
|
|
@@ -38652,10 +38683,10 @@ function formatConfiguredCommands() {
|
|
|
38652
38683
|
const { run: entries } = loadConfig();
|
|
38653
38684
|
const configs = resolveRunConfigs(entries, runConfigBaseDir());
|
|
38654
38685
|
if (configs.length === 0) return "\nNo configured commands";
|
|
38655
|
-
const
|
|
38686
|
+
const names = configs.map((r) => ` ${r.name}`).join("\n");
|
|
38656
38687
|
return `
|
|
38657
38688
|
Configured commands:
|
|
38658
|
-
${
|
|
38689
|
+
${names}`;
|
|
38659
38690
|
}
|
|
38660
38691
|
|
|
38661
38692
|
// src/commands/run/spawnRunCommand.ts
|
|
@@ -38825,11 +38856,11 @@ function findLinkIndex() {
|
|
|
38825
38856
|
function parseLinkArgs() {
|
|
38826
38857
|
const idx = findLinkIndex();
|
|
38827
38858
|
if (idx === -1) return null;
|
|
38828
|
-
const
|
|
38859
|
+
const path103 = process.argv[idx + 1];
|
|
38829
38860
|
const rest = process.argv.slice(idx + 2);
|
|
38830
38861
|
const { value: prefix2 } = extractOption(rest, "--prefix");
|
|
38831
38862
|
if (!prefix2) return null;
|
|
38832
|
-
return { path:
|
|
38863
|
+
return { path: path103, prefix: prefix2 };
|
|
38833
38864
|
}
|
|
38834
38865
|
function hasDuplicateLink(runList, linkPath) {
|
|
38835
38866
|
return runList.some(
|
|
@@ -39431,14 +39462,14 @@ import * as pty from "node-pty";
|
|
|
39431
39462
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
39432
39463
|
import { chmodSync, existsSync as existsSync88, statSync as statSync14 } from "fs";
|
|
39433
39464
|
import { createRequire as createRequire3 } from "module";
|
|
39434
|
-
import
|
|
39465
|
+
import path99 from "path";
|
|
39435
39466
|
var require4 = createRequire3(import.meta.url);
|
|
39436
39467
|
var ensured = false;
|
|
39437
39468
|
function ensureSpawnHelperExecutable() {
|
|
39438
39469
|
if (ensured || process.platform !== "darwin") return;
|
|
39439
39470
|
ensured = true;
|
|
39440
|
-
const ptyRoot =
|
|
39441
|
-
const helper =
|
|
39471
|
+
const ptyRoot = path99.join(path99.dirname(require4.resolve("node-pty")), "..");
|
|
39472
|
+
const helper = path99.join(
|
|
39442
39473
|
ptyRoot,
|
|
39443
39474
|
"prebuilds",
|
|
39444
39475
|
`${process.platform}-${process.arch}`,
|
|
@@ -39569,12 +39600,12 @@ function serverRunMeta(runName, cwd) {
|
|
|
39569
39600
|
|
|
39570
39601
|
// src/commands/sessions/daemon/readDesignSystemPrompt.ts
|
|
39571
39602
|
import * as fs50 from "fs";
|
|
39572
|
-
import * as
|
|
39603
|
+
import * as path100 from "path";
|
|
39573
39604
|
import { fileURLToPath as fileURLToPath11 } from "url";
|
|
39574
39605
|
var __filename5 = fileURLToPath11(import.meta.url);
|
|
39575
|
-
var __dirname7 =
|
|
39606
|
+
var __dirname7 = path100.dirname(__filename5);
|
|
39576
39607
|
function readDesignSystemPrompt() {
|
|
39577
|
-
const promptPath =
|
|
39608
|
+
const promptPath = path100.join(
|
|
39578
39609
|
__dirname7,
|
|
39579
39610
|
"..",
|
|
39580
39611
|
"claude",
|
|
@@ -40605,8 +40636,8 @@ async function seedRunningMsFromUsage(session, notify2) {
|
|
|
40605
40636
|
var DEBOUNCE_MS2 = 50;
|
|
40606
40637
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
40607
40638
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
40608
|
-
const
|
|
40609
|
-
const dir = dirname42(
|
|
40639
|
+
const path103 = activityPath(session.id);
|
|
40640
|
+
const dir = dirname42(path103);
|
|
40610
40641
|
try {
|
|
40611
40642
|
mkdirSync37(dir, { recursive: true });
|
|
40612
40643
|
} catch {
|
|
@@ -40616,7 +40647,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
40616
40647
|
let timer = null;
|
|
40617
40648
|
const read3 = () => {
|
|
40618
40649
|
timer = null;
|
|
40619
|
-
const activity2 = readActivity(
|
|
40650
|
+
const activity2 = readActivity(path103);
|
|
40620
40651
|
if (!activity2) return;
|
|
40621
40652
|
applyActivityToSession(session, activity2);
|
|
40622
40653
|
if (activity2.claudeSessionId) onClaudeSessionId?.(session);
|
|
@@ -40625,11 +40656,11 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
40625
40656
|
notify2();
|
|
40626
40657
|
};
|
|
40627
40658
|
session.activityWatcher = watch2(dir, (_event, filename) => {
|
|
40628
|
-
if (filename && !
|
|
40659
|
+
if (filename && !path103.endsWith(filename)) return;
|
|
40629
40660
|
if (timer) clearTimeout(timer);
|
|
40630
40661
|
timer = setTimeout(read3, DEBOUNCE_MS2);
|
|
40631
40662
|
});
|
|
40632
|
-
if (existsSync94(
|
|
40663
|
+
if (existsSync94(path103)) read3();
|
|
40633
40664
|
}
|
|
40634
40665
|
function refreshActivity(session) {
|
|
40635
40666
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -40772,12 +40803,12 @@ import { watch as watch3 } from "fs";
|
|
|
40772
40803
|
|
|
40773
40804
|
// src/commands/sessions/shared/findTranscriptPathSync.ts
|
|
40774
40805
|
import * as fs52 from "fs";
|
|
40775
|
-
import * as
|
|
40806
|
+
import * as path101 from "path";
|
|
40776
40807
|
function projectDirForCwd(cwd) {
|
|
40777
|
-
return
|
|
40808
|
+
return path101.join(claudeProjectsRoot(), projectSlug(cwd));
|
|
40778
40809
|
}
|
|
40779
40810
|
function transcriptPathFor(cwd, claudeSessionId) {
|
|
40780
|
-
return
|
|
40811
|
+
return path101.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
|
|
40781
40812
|
}
|
|
40782
40813
|
function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
40783
40814
|
const direct = transcriptPathFor(cwd, claudeSessionId);
|
|
@@ -40791,8 +40822,8 @@ function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
|
40791
40822
|
}
|
|
40792
40823
|
for (const file of files) {
|
|
40793
40824
|
if (!file.endsWith(".jsonl")) continue;
|
|
40794
|
-
if (headContainsSessionId(
|
|
40795
|
-
return
|
|
40825
|
+
if (headContainsSessionId(path101.join(dir, file), claudeSessionId))
|
|
40826
|
+
return path101.join(dir, file);
|
|
40796
40827
|
}
|
|
40797
40828
|
return null;
|
|
40798
40829
|
}
|
|
@@ -41966,9 +41997,9 @@ function tempRoots() {
|
|
|
41966
41997
|
}
|
|
41967
41998
|
return [...roots];
|
|
41968
41999
|
}
|
|
41969
|
-
function underTempRoot(
|
|
42000
|
+
function underTempRoot(path103) {
|
|
41970
42001
|
return tempRoots().some(
|
|
41971
|
-
(root2) =>
|
|
42002
|
+
(root2) => path103.startsWith(root2.endsWith(sep3) ? root2 : root2 + sep3)
|
|
41972
42003
|
);
|
|
41973
42004
|
}
|
|
41974
42005
|
|
|
@@ -42313,7 +42344,7 @@ function restoreAll(spawner, sessions) {
|
|
|
42313
42344
|
const persisted = dropTempRootedSessions(loadPersistedSessions());
|
|
42314
42345
|
const cap2 = sessionLimits.maxRestore();
|
|
42315
42346
|
const restoredIds = /* @__PURE__ */ new Map();
|
|
42316
|
-
const
|
|
42347
|
+
const names = persisted.slice(0, cap2).map((entry) => {
|
|
42317
42348
|
const id = restoreOne(entry, spawner, sessions);
|
|
42318
42349
|
if (entry.id != null && id != null) restoredIds.set(entry.id, id);
|
|
42319
42350
|
return entry.name;
|
|
@@ -42321,7 +42352,7 @@ function restoreAll(spawner, sessions) {
|
|
|
42321
42352
|
for (const over of persisted.slice(cap2))
|
|
42322
42353
|
deferOne(over, spawner.recoveryCard, cap2);
|
|
42323
42354
|
remapLaunchedFrom(sessions, restoredIds);
|
|
42324
|
-
return
|
|
42355
|
+
return names;
|
|
42325
42356
|
}
|
|
42326
42357
|
function deferOne(persisted, spawnRecoveryCard, cap2) {
|
|
42327
42358
|
try {
|
|
@@ -42410,15 +42441,15 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
42410
42441
|
import { existsSync as existsSync96 } from "fs";
|
|
42411
42442
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
42412
42443
|
if (!existsSync96(clone)) {
|
|
42413
|
-
for (const { path:
|
|
42444
|
+
for (const { path: path103 } of paths) forgetWorktree(path103);
|
|
42414
42445
|
daemonLog(
|
|
42415
42446
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
42416
42447
|
);
|
|
42417
42448
|
return;
|
|
42418
42449
|
}
|
|
42419
42450
|
await pruneBookkeeping2(clone);
|
|
42420
|
-
for (const { path:
|
|
42421
|
-
if (await reclaimBranch(clone, branch2)) forgetWorktree(
|
|
42451
|
+
for (const { path: path103, branch: branch2 } of paths)
|
|
42452
|
+
if (await reclaimBranch(clone, branch2)) forgetWorktree(path103);
|
|
42422
42453
|
}
|
|
42423
42454
|
async function pruneBookkeeping2(clone) {
|
|
42424
42455
|
try {
|
|
@@ -42445,37 +42476,37 @@ async function reclaimBranch(clone, branch2) {
|
|
|
42445
42476
|
}
|
|
42446
42477
|
|
|
42447
42478
|
// src/commands/sessions/daemon/worktree/logVanishedTree.ts
|
|
42448
|
-
function logVanishedTree(sessions,
|
|
42479
|
+
function logVanishedTree(sessions, path103) {
|
|
42449
42480
|
const claimants = [...sessions.values()].filter(
|
|
42450
|
-
(s) => s.cwd ===
|
|
42481
|
+
(s) => s.cwd === path103 || s.worktree?.path === path103
|
|
42451
42482
|
);
|
|
42452
42483
|
if (claimants.length === 0) {
|
|
42453
|
-
daemonLog(`worktree ${
|
|
42484
|
+
daemonLog(`worktree ${path103} gone from disk and unclaimed; reclaiming it`);
|
|
42454
42485
|
return;
|
|
42455
42486
|
}
|
|
42456
42487
|
for (const s of claimants)
|
|
42457
42488
|
daemonLog(
|
|
42458
|
-
`session ${s.id} ("${s.name}") claims worktree ${
|
|
42489
|
+
`session ${s.id} ("${s.name}") claims worktree ${path103}, which is gone from disk; reclaiming it`
|
|
42459
42490
|
);
|
|
42460
42491
|
}
|
|
42461
42492
|
|
|
42462
42493
|
// src/commands/sessions/daemon/worktree/describeHeldWork.ts
|
|
42463
42494
|
var MAX_ITEMS = 20;
|
|
42464
|
-
async function describeHeldWork(
|
|
42465
|
-
if (reason4.startsWith("uncommitted")) return await changedFiles(
|
|
42466
|
-
if (reason4.startsWith("unpushed")) return await unpushedCommits(
|
|
42495
|
+
async function describeHeldWork(path103, reason4) {
|
|
42496
|
+
if (reason4.startsWith("uncommitted")) return await changedFiles(path103);
|
|
42497
|
+
if (reason4.startsWith("unpushed")) return await unpushedCommits(path103, reason4);
|
|
42467
42498
|
return { summary: reason4, items: [] };
|
|
42468
42499
|
}
|
|
42469
|
-
async function changedFiles(
|
|
42470
|
-
const status3 = await gitResult(
|
|
42500
|
+
async function changedFiles(path103) {
|
|
42501
|
+
const status3 = await gitResult(path103, ["status", "--porcelain"]);
|
|
42471
42502
|
const lines2 = status3.ok ? nonEmptyLines(status3.out) : [];
|
|
42472
42503
|
return {
|
|
42473
42504
|
summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
|
|
42474
42505
|
items: capped2(lines2)
|
|
42475
42506
|
};
|
|
42476
42507
|
}
|
|
42477
|
-
async function unpushedCommits(
|
|
42478
|
-
const log2 = await gitResult(
|
|
42508
|
+
async function unpushedCommits(path103, reason4) {
|
|
42509
|
+
const log2 = await gitResult(path103, ["log", "--oneline", "@{upstream}..HEAD"]);
|
|
42479
42510
|
if (!log2.ok) return { summary: reason4, items: [] };
|
|
42480
42511
|
const lines2 = nonEmptyLines(log2.out);
|
|
42481
42512
|
return {
|
|
@@ -42567,24 +42598,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
|
|
|
42567
42598
|
async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
42568
42599
|
const accounted = accountedTrees(sessions);
|
|
42569
42600
|
const vanished = /* @__PURE__ */ new Map();
|
|
42570
|
-
for (const { path:
|
|
42571
|
-
if (underTempRoot(
|
|
42572
|
-
forgetWorktree(
|
|
42601
|
+
for (const { path: path103, clone } of readWorktreeRegistry()) {
|
|
42602
|
+
if (underTempRoot(path103)) {
|
|
42603
|
+
forgetWorktree(path103);
|
|
42573
42604
|
daemonLog(
|
|
42574
|
-
`worktree ${
|
|
42605
|
+
`worktree ${path103} lies outside any project root; pruned from the registry rather than recovered`
|
|
42575
42606
|
);
|
|
42576
42607
|
continue;
|
|
42577
42608
|
}
|
|
42578
|
-
if (!existsSync97(
|
|
42579
|
-
logVanishedTree(sessions,
|
|
42609
|
+
if (!existsSync97(path103)) {
|
|
42610
|
+
logVanishedTree(sessions, path103);
|
|
42580
42611
|
vanished.set(clone, [
|
|
42581
42612
|
...vanished.get(clone) ?? [],
|
|
42582
|
-
{ path:
|
|
42613
|
+
{ path: path103, branch: basename28(path103) }
|
|
42583
42614
|
]);
|
|
42584
42615
|
continue;
|
|
42585
42616
|
}
|
|
42586
|
-
if (accounted.has(
|
|
42587
|
-
await recoverOrphan(sessions, spawnWith, { path:
|
|
42617
|
+
if (accounted.has(path103)) continue;
|
|
42618
|
+
await recoverOrphan(sessions, spawnWith, { path: path103, clone }, notify2);
|
|
42588
42619
|
}
|
|
42589
42620
|
for (const [clone, paths] of vanished)
|
|
42590
42621
|
await reclaimVanishedWorktrees(clone, paths);
|
|
@@ -42592,10 +42623,10 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
42592
42623
|
|
|
42593
42624
|
// src/commands/sessions/daemon/restoreAllSessions.ts
|
|
42594
42625
|
function restoreAllSessions(spawner, sessions, notify2) {
|
|
42595
|
-
const
|
|
42626
|
+
const names = restoreAll(spawner, sessions);
|
|
42596
42627
|
reconcileWorktreesOnRestore(sessions, spawner.recoveryCard, notify2);
|
|
42597
42628
|
rearmStoppedSessions(sessions, notify2);
|
|
42598
|
-
return
|
|
42629
|
+
return names;
|
|
42599
42630
|
}
|
|
42600
42631
|
|
|
42601
42632
|
// src/commands/sessions/daemon/retrySession.ts
|
|
@@ -44463,12 +44494,12 @@ function handleSetStatus(client, m, d) {
|
|
|
44463
44494
|
import * as fs56 from "fs";
|
|
44464
44495
|
|
|
44465
44496
|
// src/commands/sessions/shared/codex/findCodexRolloutPath.ts
|
|
44466
|
-
import * as
|
|
44497
|
+
import * as path102 from "path";
|
|
44467
44498
|
async function findCodexRolloutPath(sessionId) {
|
|
44468
44499
|
if (!sessionId) return null;
|
|
44469
44500
|
const paths = await discoverCodexRolloutPaths();
|
|
44470
44501
|
const suffix = `-${sessionId}.jsonl`;
|
|
44471
|
-
return paths.find((file) =>
|
|
44502
|
+
return paths.find((file) => path102.basename(file).endsWith(suffix)) ?? null;
|
|
44472
44503
|
}
|
|
44473
44504
|
|
|
44474
44505
|
// src/commands/sessions/shared/codex/codexToolTarget.ts
|