@staff0rd/assist 0.722.1 → 0.722.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +419 -476
- 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.722.
|
|
9
|
+
version: "0.722.2",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -296,8 +296,8 @@ function getRemoteOriginUrl(cwd) {
|
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
// src/commands/backlog/getCurrentOrigin.ts
|
|
299
|
-
function stripLeadingSlashes(
|
|
300
|
-
return
|
|
299
|
+
function stripLeadingSlashes(path106) {
|
|
300
|
+
return path106.replace(/^\/+/, "");
|
|
301
301
|
}
|
|
302
302
|
function normalizeOrigin(raw) {
|
|
303
303
|
const trimmed = raw.trim().replace(/\.git$/i, "").replace(/\/+$/, "");
|
|
@@ -347,9 +347,9 @@ function findGitLink(dir) {
|
|
|
347
347
|
}
|
|
348
348
|
return null;
|
|
349
349
|
}
|
|
350
|
-
function isFile(
|
|
350
|
+
function isFile(path106) {
|
|
351
351
|
try {
|
|
352
|
-
return statSync(
|
|
352
|
+
return statSync(path106).isFile();
|
|
353
353
|
} catch {
|
|
354
354
|
return false;
|
|
355
355
|
}
|
|
@@ -368,9 +368,9 @@ function linkedGitDirParent(gitDir) {
|
|
|
368
368
|
const match = /^(.*)[/\\]worktrees[/\\][^/\\]+[/\\]?$/.exec(gitDir);
|
|
369
369
|
return match ? match[1] : null;
|
|
370
370
|
}
|
|
371
|
-
function readTrimmed(
|
|
371
|
+
function readTrimmed(path106) {
|
|
372
372
|
try {
|
|
373
|
-
const content = readFileSync2(
|
|
373
|
+
const content = readFileSync2(path106, "utf8").trim();
|
|
374
374
|
return content === "" ? null : content;
|
|
375
375
|
} catch {
|
|
376
376
|
return null;
|
|
@@ -383,10 +383,10 @@ function absolute(target, from) {
|
|
|
383
383
|
// src/shared/loadRawYaml.ts
|
|
384
384
|
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
|
|
385
385
|
import { parse as parseYaml } from "yaml";
|
|
386
|
-
function loadRawYaml(
|
|
387
|
-
if (!existsSync3(
|
|
386
|
+
function loadRawYaml(path106) {
|
|
387
|
+
if (!existsSync3(path106)) return {};
|
|
388
388
|
try {
|
|
389
|
-
const content = readFileSync3(
|
|
389
|
+
const content = readFileSync3(path106, "utf8");
|
|
390
390
|
return parseYaml(content) || {};
|
|
391
391
|
} catch {
|
|
392
392
|
return {};
|
|
@@ -458,8 +458,8 @@ function mergeRawConfigs(globalRaw, projectRaw) {
|
|
|
458
458
|
// src/commands/backlog/originDisplayName.ts
|
|
459
459
|
function originDisplayName(origin) {
|
|
460
460
|
if (origin.startsWith("local:")) {
|
|
461
|
-
const
|
|
462
|
-
const segments =
|
|
461
|
+
const path106 = origin.slice("local:".length).replace(/\/+$/, "");
|
|
462
|
+
const segments = path106.split("/").filter(Boolean);
|
|
463
463
|
return segments[segments.length - 1] ?? origin;
|
|
464
464
|
}
|
|
465
465
|
const firstSlash = origin.indexOf("/");
|
|
@@ -698,9 +698,7 @@ var assistConfigShape = {
|
|
|
698
698
|
restructure: z3.strictObject({
|
|
699
699
|
ignore: z3.array(z3.string()).default([]),
|
|
700
700
|
pin: z3.array(z3.string()).default([]),
|
|
701
|
-
maxDepth: z3.number().int().positive().default(10)
|
|
702
|
-
maxFolderPercent: z3.number().positive().max(100).default(15),
|
|
703
|
-
maxFolderFiles: z3.number().int().positive().default(150)
|
|
701
|
+
maxDepth: z3.number().int().positive().default(10)
|
|
704
702
|
}).optional(),
|
|
705
703
|
jira: z3.strictObject({
|
|
706
704
|
acField: z3.string().default("customfield_11937")
|
|
@@ -4322,8 +4320,8 @@ function getPreferredRemoteRepo(cwd) {
|
|
|
4322
4320
|
function gitRefUrl(kind, ref, cwd) {
|
|
4323
4321
|
const repo = getPreferredRemoteRepo(cwd);
|
|
4324
4322
|
if (!repo) return void 0;
|
|
4325
|
-
const
|
|
4326
|
-
return `https://github.com/${repo.org}/${repo.repo}/${
|
|
4323
|
+
const path106 = kind === "branch" ? "tree" : "commit";
|
|
4324
|
+
return `https://github.com/${repo.org}/${repo.repo}/${path106}/${ref}`;
|
|
4327
4325
|
}
|
|
4328
4326
|
|
|
4329
4327
|
// src/commands/sessions/shared/resolveSessionTranscript.ts
|
|
@@ -4484,9 +4482,9 @@ var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
|
|
|
4484
4482
|
function backupLocalBacklogFiles(dir) {
|
|
4485
4483
|
const moved = [];
|
|
4486
4484
|
for (const name of LOCAL_FILES) {
|
|
4487
|
-
const
|
|
4488
|
-
if (existsSync20(
|
|
4489
|
-
renameSync(
|
|
4485
|
+
const path106 = join19(dir, ".assist", name);
|
|
4486
|
+
if (existsSync20(path106)) {
|
|
4487
|
+
renameSync(path106, `${path106}.bak`);
|
|
4490
4488
|
moved.push(`${name} \u2192 ${name}.bak`);
|
|
4491
4489
|
}
|
|
4492
4490
|
}
|
|
@@ -4970,8 +4968,8 @@ var backlogItemSchema = z4.strictObject({
|
|
|
4970
4968
|
var backlogFileSchema = z4.array(backlogItemSchema);
|
|
4971
4969
|
|
|
4972
4970
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
4973
|
-
function parseBacklogJsonl(
|
|
4974
|
-
const content = readFileSync13(
|
|
4971
|
+
function parseBacklogJsonl(path106) {
|
|
4972
|
+
const content = readFileSync13(path106, "utf8").trim();
|
|
4975
4973
|
if (content.length === 0) return [];
|
|
4976
4974
|
return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
|
|
4977
4975
|
}
|
|
@@ -5517,9 +5515,9 @@ function originToSshUrl(origin) {
|
|
|
5517
5515
|
const firstSlash = origin.indexOf("/");
|
|
5518
5516
|
if (firstSlash <= 0) return null;
|
|
5519
5517
|
const host = origin.slice(0, firstSlash);
|
|
5520
|
-
const
|
|
5521
|
-
if (!
|
|
5522
|
-
return `git@${host}:${
|
|
5518
|
+
const path106 = origin.slice(firstSlash + 1);
|
|
5519
|
+
if (!path106) return null;
|
|
5520
|
+
return `git@${host}:${path106}.git`;
|
|
5523
5521
|
}
|
|
5524
5522
|
|
|
5525
5523
|
// src/commands/backlog/cloneRepo.ts
|
|
@@ -7157,10 +7155,10 @@ var hooksSettings = {
|
|
|
7157
7155
|
}
|
|
7158
7156
|
};
|
|
7159
7157
|
function ensureHooksSettings() {
|
|
7160
|
-
const
|
|
7161
|
-
mkdirSync5(dirname15(
|
|
7162
|
-
writeFileSync16(
|
|
7163
|
-
return
|
|
7158
|
+
const path106 = daemonPaths.hooksSettings;
|
|
7159
|
+
mkdirSync5(dirname15(path106), { recursive: true });
|
|
7160
|
+
writeFileSync16(path106, JSON.stringify(hooksSettings, null, 2));
|
|
7161
|
+
return path106;
|
|
7164
7162
|
}
|
|
7165
7163
|
|
|
7166
7164
|
// src/shared/spawnInherit.ts
|
|
@@ -7916,24 +7914,24 @@ function getOwnerPath(itemId2) {
|
|
|
7916
7914
|
function recordSignalOwner(itemId2) {
|
|
7917
7915
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
7918
7916
|
if (!sessionId) return;
|
|
7919
|
-
const
|
|
7920
|
-
mkdirSync7(dirname16(
|
|
7921
|
-
writeFileSync18(
|
|
7917
|
+
const path106 = getOwnerPath(itemId2);
|
|
7918
|
+
mkdirSync7(dirname16(path106), { recursive: true });
|
|
7919
|
+
writeFileSync18(path106, JSON.stringify({ sessionId }));
|
|
7922
7920
|
}
|
|
7923
7921
|
function readSignalOwner(itemId2) {
|
|
7924
|
-
const
|
|
7925
|
-
if (!existsSync26(
|
|
7922
|
+
const path106 = getOwnerPath(itemId2);
|
|
7923
|
+
if (!existsSync26(path106)) return void 0;
|
|
7926
7924
|
try {
|
|
7927
|
-
const parsed = JSON.parse(readFileSync17(
|
|
7925
|
+
const parsed = JSON.parse(readFileSync17(path106, "utf8"));
|
|
7928
7926
|
return parsed.sessionId;
|
|
7929
7927
|
} catch {
|
|
7930
7928
|
return void 0;
|
|
7931
7929
|
}
|
|
7932
7930
|
}
|
|
7933
7931
|
function clearSignalOwner(itemId2) {
|
|
7934
|
-
const
|
|
7932
|
+
const path106 = getOwnerPath(itemId2);
|
|
7935
7933
|
try {
|
|
7936
|
-
rmSync(
|
|
7934
|
+
rmSync(path106);
|
|
7937
7935
|
} catch {
|
|
7938
7936
|
}
|
|
7939
7937
|
}
|
|
@@ -7970,19 +7968,19 @@ function resolveSignalTarget(event, data) {
|
|
|
7970
7968
|
function writeSignal(event, data) {
|
|
7971
7969
|
const target = resolveSignalTarget(event, data);
|
|
7972
7970
|
if (!target) return;
|
|
7973
|
-
const
|
|
7974
|
-
if (!
|
|
7971
|
+
const path106 = getSignalPath(target);
|
|
7972
|
+
if (!path106) return;
|
|
7975
7973
|
const signal = { event, sessionId: target, ...data };
|
|
7976
|
-
mkdirSync8(dirname17(
|
|
7977
|
-
writeFileSync19(
|
|
7974
|
+
mkdirSync8(dirname17(path106), { recursive: true });
|
|
7975
|
+
writeFileSync19(path106, JSON.stringify(signal));
|
|
7978
7976
|
}
|
|
7979
7977
|
|
|
7980
7978
|
// src/commands/backlog/readSignal.ts
|
|
7981
7979
|
function readSignal() {
|
|
7982
|
-
const
|
|
7983
|
-
if (!
|
|
7980
|
+
const path106 = getSignalPath();
|
|
7981
|
+
if (!path106 || !existsSync27(path106)) return void 0;
|
|
7984
7982
|
try {
|
|
7985
|
-
return JSON.parse(readFileSync18(
|
|
7983
|
+
return JSON.parse(readFileSync18(path106, "utf8"));
|
|
7986
7984
|
} catch {
|
|
7987
7985
|
return void 0;
|
|
7988
7986
|
}
|
|
@@ -8180,13 +8178,13 @@ function activityPath(sessionId) {
|
|
|
8180
8178
|
function emitActivity(activity2) {
|
|
8181
8179
|
const sessionId = process.env.ASSIST_ACTIVITY_ID;
|
|
8182
8180
|
if (!sessionId) return;
|
|
8183
|
-
const
|
|
8184
|
-
mkdirSync9(dirname18(
|
|
8185
|
-
writeFileSync20(
|
|
8181
|
+
const path106 = activityPath(sessionId);
|
|
8182
|
+
mkdirSync9(dirname18(path106), { recursive: true });
|
|
8183
|
+
writeFileSync20(path106, JSON.stringify({ ...activity2, startedAt: Date.now() }));
|
|
8186
8184
|
}
|
|
8187
|
-
function readActivity(
|
|
8185
|
+
function readActivity(path106) {
|
|
8188
8186
|
try {
|
|
8189
|
-
return JSON.parse(readFileSync19(
|
|
8187
|
+
return JSON.parse(readFileSync19(path106, "utf8"));
|
|
8190
8188
|
} catch {
|
|
8191
8189
|
return void 0;
|
|
8192
8190
|
}
|
|
@@ -8196,9 +8194,9 @@ function reconcileActivity(sessionId, activity2) {
|
|
|
8196
8194
|
removeActivity(sessionId);
|
|
8197
8195
|
return;
|
|
8198
8196
|
}
|
|
8199
|
-
const
|
|
8200
|
-
mkdirSync9(dirname18(
|
|
8201
|
-
writeFileSync20(
|
|
8197
|
+
const path106 = activityPath(sessionId);
|
|
8198
|
+
mkdirSync9(dirname18(path106), { recursive: true });
|
|
8199
|
+
writeFileSync20(path106, JSON.stringify(activity2));
|
|
8202
8200
|
}
|
|
8203
8201
|
function removeActivity(sessionId) {
|
|
8204
8202
|
try {
|
|
@@ -10823,10 +10821,10 @@ function getStorePath(filename) {
|
|
|
10823
10821
|
return join34(getStoreDir(), filename);
|
|
10824
10822
|
}
|
|
10825
10823
|
function loadJson(filename) {
|
|
10826
|
-
const
|
|
10827
|
-
if (existsSync32(
|
|
10824
|
+
const path106 = getStorePath(filename);
|
|
10825
|
+
if (existsSync32(path106)) {
|
|
10828
10826
|
try {
|
|
10829
|
-
return JSON.parse(readFileSync20(
|
|
10827
|
+
return JSON.parse(readFileSync20(path106, "utf8"));
|
|
10830
10828
|
} catch {
|
|
10831
10829
|
return {};
|
|
10832
10830
|
}
|
|
@@ -10845,22 +10843,22 @@ function saveJson(filename, data) {
|
|
|
10845
10843
|
var REGISTRY_FILE = "worktrees.json";
|
|
10846
10844
|
function readWorktreeRegistry() {
|
|
10847
10845
|
const data = loadJson(REGISTRY_FILE);
|
|
10848
|
-
return Object.entries(data).filter(([, record]) => !record.reaped).map(([
|
|
10846
|
+
return Object.entries(data).filter(([, record]) => !record.reaped).map(([path106, record]) => ({ path: path106, ...record }));
|
|
10849
10847
|
}
|
|
10850
|
-
function worktreeAttributionIncludingReaped(
|
|
10851
|
-
const record = loadJson(REGISTRY_FILE)[
|
|
10848
|
+
function worktreeAttributionIncludingReaped(path106) {
|
|
10849
|
+
const record = loadJson(REGISTRY_FILE)[path106];
|
|
10852
10850
|
return record ? { clone: record.clone, origin: record.origin } : void 0;
|
|
10853
10851
|
}
|
|
10854
|
-
function recordWorktree(
|
|
10852
|
+
function recordWorktree(path106, clone, origin) {
|
|
10855
10853
|
const data = loadJson(REGISTRY_FILE);
|
|
10856
|
-
data[
|
|
10854
|
+
data[path106] = { clone, origin };
|
|
10857
10855
|
saveJson(REGISTRY_FILE, data);
|
|
10858
10856
|
}
|
|
10859
|
-
function forgetWorktree(
|
|
10857
|
+
function forgetWorktree(path106) {
|
|
10860
10858
|
const data = loadJson(REGISTRY_FILE);
|
|
10861
|
-
const record = data[
|
|
10859
|
+
const record = data[path106];
|
|
10862
10860
|
if (!record || record.reaped) return;
|
|
10863
|
-
data[
|
|
10861
|
+
data[path106] = { ...record, reaped: true };
|
|
10864
10862
|
saveJson(REGISTRY_FILE, data);
|
|
10865
10863
|
}
|
|
10866
10864
|
|
|
@@ -11470,10 +11468,10 @@ function completeLines(text18, windowIsPartial) {
|
|
|
11470
11468
|
if (windowIsPartial) all.shift();
|
|
11471
11469
|
return all;
|
|
11472
11470
|
}
|
|
11473
|
-
function readLogTail(
|
|
11471
|
+
function readLogTail(path106, lines2) {
|
|
11474
11472
|
let fd;
|
|
11475
11473
|
try {
|
|
11476
|
-
fd = openSync4(
|
|
11474
|
+
fd = openSync4(path106, "r");
|
|
11477
11475
|
} catch {
|
|
11478
11476
|
return [];
|
|
11479
11477
|
}
|
|
@@ -11738,8 +11736,8 @@ async function loadCommittedPaths(cwd, sessionId) {
|
|
|
11738
11736
|
for (const commit2 of commits2) {
|
|
11739
11737
|
const resolved = await resolveCommit(cwd, commit2.sha);
|
|
11740
11738
|
if (!resolved) continue;
|
|
11741
|
-
for (const
|
|
11742
|
-
if (!bases.has(
|
|
11739
|
+
for (const path106 of resolved.paths) {
|
|
11740
|
+
if (!bases.has(path106)) bases.set(path106, resolved.base);
|
|
11743
11741
|
}
|
|
11744
11742
|
}
|
|
11745
11743
|
return { commits: commits2, bases };
|
|
@@ -11757,16 +11755,16 @@ async function itemChangeSet(cwd, sessionId) {
|
|
|
11757
11755
|
}
|
|
11758
11756
|
function groupByBase(bases) {
|
|
11759
11757
|
const groups = /* @__PURE__ */ new Map();
|
|
11760
|
-
for (const [
|
|
11758
|
+
for (const [path106, base] of bases) {
|
|
11761
11759
|
const paths = groups.get(base);
|
|
11762
|
-
if (paths) paths.push(
|
|
11763
|
-
else groups.set(base, [
|
|
11760
|
+
if (paths) paths.push(path106);
|
|
11761
|
+
else groups.set(base, [path106]);
|
|
11764
11762
|
}
|
|
11765
11763
|
return [...groups].map(([base, paths]) => ({ base, paths: paths.sort() }));
|
|
11766
11764
|
}
|
|
11767
11765
|
async function dirtyPaths(cwd, bases) {
|
|
11768
11766
|
const output = await execGit(cwd, ["diff", "--name-only", "HEAD"]);
|
|
11769
|
-
return output.split("\n").filter((
|
|
11767
|
+
return output.split("\n").filter((path106) => path106 && !bases.has(path106)).sort();
|
|
11770
11768
|
}
|
|
11771
11769
|
|
|
11772
11770
|
// src/commands/sessions/web/scopedDiff.ts
|
|
@@ -11775,8 +11773,8 @@ async function scopedDiff(cwd, session, scope) {
|
|
|
11775
11773
|
if (scope.kind === "commit") return commitDiff(cwd, scope.sha);
|
|
11776
11774
|
return await trackedScopeDiff(cwd, session, scope) + await untrackedDiff(cwd);
|
|
11777
11775
|
}
|
|
11778
|
-
async function untrackedFileDiff(cwd,
|
|
11779
|
-
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null",
|
|
11776
|
+
async function untrackedFileDiff(cwd, path106) {
|
|
11777
|
+
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path106], {
|
|
11780
11778
|
maxBuffer: MAX_DIFF_BYTES,
|
|
11781
11779
|
allowFailure: true
|
|
11782
11780
|
});
|
|
@@ -11789,7 +11787,7 @@ async function untrackedDiff(cwd) {
|
|
|
11789
11787
|
]);
|
|
11790
11788
|
const paths = list5.split("\n").filter(Boolean);
|
|
11791
11789
|
const diffs = await Promise.all(
|
|
11792
|
-
paths.map((
|
|
11790
|
+
paths.map((path106) => untrackedFileDiff(cwd, path106))
|
|
11793
11791
|
);
|
|
11794
11792
|
return diffs.join("");
|
|
11795
11793
|
}
|
|
@@ -11882,9 +11880,9 @@ import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve10
|
|
|
11882
11880
|
function repoRoot(cwd) {
|
|
11883
11881
|
return resolve10(cwd);
|
|
11884
11882
|
}
|
|
11885
|
-
function resolveWithinCwd(cwd,
|
|
11883
|
+
function resolveWithinCwd(cwd, path106) {
|
|
11886
11884
|
const root2 = repoRoot(cwd);
|
|
11887
|
-
const target = resolve10(root2,
|
|
11885
|
+
const target = resolve10(root2, path106);
|
|
11888
11886
|
const rel = relative2(root2, target);
|
|
11889
11887
|
if (rel === "" || rel.startsWith("..") || isAbsolute2(rel)) return null;
|
|
11890
11888
|
return target;
|
|
@@ -11894,14 +11892,14 @@ function resolveWithinCwd(cwd, path107) {
|
|
|
11894
11892
|
function getFileTarget(req, res) {
|
|
11895
11893
|
const cwd = getCwdParam(req, res);
|
|
11896
11894
|
if (!cwd) return null;
|
|
11897
|
-
const
|
|
11895
|
+
const path106 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
|
|
11898
11896
|
"path"
|
|
11899
11897
|
);
|
|
11900
|
-
if (!
|
|
11898
|
+
if (!path106) {
|
|
11901
11899
|
respondJson(res, 400, { error: "Missing path" });
|
|
11902
11900
|
return null;
|
|
11903
11901
|
}
|
|
11904
|
-
const target = resolveWithinCwd(cwd,
|
|
11902
|
+
const target = resolveWithinCwd(cwd, path106);
|
|
11905
11903
|
if (!target) {
|
|
11906
11904
|
respondJson(res, 400, { error: "Path outside cwd" });
|
|
11907
11905
|
return null;
|
|
@@ -11960,9 +11958,9 @@ function segmentText(segment) {
|
|
|
11960
11958
|
if (segment.kind === "index") return `[${segment.index}]`;
|
|
11961
11959
|
return "[]";
|
|
11962
11960
|
}
|
|
11963
|
-
function formatConfigPath(
|
|
11961
|
+
function formatConfigPath(path106) {
|
|
11964
11962
|
let text18 = "";
|
|
11965
|
-
for (const segment of
|
|
11963
|
+
for (const segment of path106) {
|
|
11966
11964
|
const dotted = segment.kind === "key" || segment.kind === "entry";
|
|
11967
11965
|
const rendered = segmentText(segment);
|
|
11968
11966
|
text18 += dotted && text18 ? `.${rendered}` : rendered;
|
|
@@ -12123,11 +12121,11 @@ function enumValues(node) {
|
|
|
12123
12121
|
function opaqueConfigNode(inner, base) {
|
|
12124
12122
|
return { ...base, kind: "other", type: leafTypeOf(inner) };
|
|
12125
12123
|
}
|
|
12126
|
-
function build(node,
|
|
12124
|
+
function build(node, path106) {
|
|
12127
12125
|
const { inner, defaultValue, optional } = unwrapSchemaNode(node);
|
|
12128
12126
|
const secret = isSecretSchemaNode(node) || isSecretSchemaNode(inner);
|
|
12129
12127
|
const base = {
|
|
12130
|
-
path:
|
|
12128
|
+
path: path106,
|
|
12131
12129
|
...optional ? { optional: true } : {},
|
|
12132
12130
|
...defaultValue === void 0 ? {} : { defaultValue },
|
|
12133
12131
|
...secret ? { secret: true } : {}
|
|
@@ -12183,11 +12181,11 @@ function describeConfigLeaves(schema2) {
|
|
|
12183
12181
|
|
|
12184
12182
|
// src/commands/config/globalConfigFileLabel.ts
|
|
12185
12183
|
var WINDOWS_MOUNT_PREFIX = "/mnt/";
|
|
12186
|
-
function globalConfigFileLabel(
|
|
12187
|
-
if (
|
|
12188
|
-
if (
|
|
12189
|
-
return `${
|
|
12190
|
-
return
|
|
12184
|
+
function globalConfigFileLabel(path106) {
|
|
12185
|
+
if (path106 === getGlobalConfigPath()) return "~/.assist.yml";
|
|
12186
|
+
if (path106.startsWith(WINDOWS_MOUNT_PREFIX))
|
|
12187
|
+
return `${path106} on the Windows host`;
|
|
12188
|
+
return path106;
|
|
12191
12189
|
}
|
|
12192
12190
|
|
|
12193
12191
|
// src/commands/config/readRawConfigLayers.ts
|
|
@@ -12244,35 +12242,35 @@ function isPlainRecord(value) {
|
|
|
12244
12242
|
}
|
|
12245
12243
|
|
|
12246
12244
|
// src/shared/mapConfigSecrets.ts
|
|
12247
|
-
function mapChildren(value,
|
|
12245
|
+
function mapChildren(value, path106, childNode, map) {
|
|
12248
12246
|
if (!isPlainRecord(value)) return value;
|
|
12249
12247
|
return Object.fromEntries(
|
|
12250
12248
|
Object.entries(value).map(([name, child]) => [
|
|
12251
12249
|
name,
|
|
12252
|
-
walk(child, [...
|
|
12250
|
+
walk(child, [...path106, name], childNode(name), map)
|
|
12253
12251
|
])
|
|
12254
12252
|
);
|
|
12255
12253
|
}
|
|
12256
|
-
function mapItems(value,
|
|
12254
|
+
function mapItems(value, path106, item, map) {
|
|
12257
12255
|
if (!Array.isArray(value)) return value;
|
|
12258
|
-
return value.map((entry, index3) => walk(entry, [...
|
|
12256
|
+
return value.map((entry, index3) => walk(entry, [...path106, index3], item, map));
|
|
12259
12257
|
}
|
|
12260
|
-
function walk(value,
|
|
12258
|
+
function walk(value, path106, node, map) {
|
|
12261
12259
|
if (!node || value === void 0 || value === null) return value;
|
|
12262
|
-
if (node.secret) return map(value,
|
|
12260
|
+
if (node.secret) return map(value, path106);
|
|
12263
12261
|
switch (node.kind) {
|
|
12264
12262
|
case "object":
|
|
12265
12263
|
case "unionOfObjects":
|
|
12266
12264
|
return mapChildren(
|
|
12267
12265
|
value,
|
|
12268
|
-
|
|
12266
|
+
path106,
|
|
12269
12267
|
(name) => configNodeField(node, name),
|
|
12270
12268
|
map
|
|
12271
12269
|
);
|
|
12272
12270
|
case "objectList":
|
|
12273
|
-
return mapItems(value,
|
|
12271
|
+
return mapItems(value, path106, node.item, map);
|
|
12274
12272
|
case "record":
|
|
12275
|
-
return mapChildren(value,
|
|
12273
|
+
return mapChildren(value, path106, () => node.value, map);
|
|
12276
12274
|
default:
|
|
12277
12275
|
return value;
|
|
12278
12276
|
}
|
|
@@ -12297,9 +12295,9 @@ function isTraversable(value) {
|
|
|
12297
12295
|
function stepInto(current, key) {
|
|
12298
12296
|
return isTraversable(current) ? current[key] : void 0;
|
|
12299
12297
|
}
|
|
12300
|
-
function getNestedValue(obj,
|
|
12298
|
+
function getNestedValue(obj, path106) {
|
|
12301
12299
|
let current = obj;
|
|
12302
|
-
for (const key of
|
|
12300
|
+
for (const key of path106.split(".")) current = stepInto(current, key);
|
|
12303
12301
|
return current;
|
|
12304
12302
|
}
|
|
12305
12303
|
|
|
@@ -12349,9 +12347,9 @@ function step(node, segment) {
|
|
|
12349
12347
|
return void 0;
|
|
12350
12348
|
}
|
|
12351
12349
|
}
|
|
12352
|
-
function findConfigNode(root2,
|
|
12350
|
+
function findConfigNode(root2, path106) {
|
|
12353
12351
|
let current = root2;
|
|
12354
|
-
for (const segment of
|
|
12352
|
+
for (const segment of path106) {
|
|
12355
12353
|
if (!current) return void 0;
|
|
12356
12354
|
current = step(current, segment);
|
|
12357
12355
|
}
|
|
@@ -12368,34 +12366,34 @@ function nameSegment(name) {
|
|
|
12368
12366
|
return name === RECORD_ENTRY_TOKEN ? { kind: "entry" } : { kind: "key", name };
|
|
12369
12367
|
}
|
|
12370
12368
|
function parseConfigPath(text18) {
|
|
12371
|
-
const
|
|
12369
|
+
const path106 = [];
|
|
12372
12370
|
let at2 = 0;
|
|
12373
12371
|
while (at2 < text18.length) {
|
|
12374
12372
|
if (text18[at2] === "[") {
|
|
12375
12373
|
const close = text18.indexOf("]", at2);
|
|
12376
12374
|
const segment = close === -1 ? void 0 : bracketSegment(text18.slice(at2 + 1, close));
|
|
12377
12375
|
if (!segment) return void 0;
|
|
12378
|
-
|
|
12376
|
+
path106.push(segment);
|
|
12379
12377
|
at2 = close + 1;
|
|
12380
12378
|
continue;
|
|
12381
12379
|
}
|
|
12382
12380
|
if (text18[at2] === ".") {
|
|
12383
|
-
if (
|
|
12381
|
+
if (path106.length === 0) return void 0;
|
|
12384
12382
|
at2 += 1;
|
|
12385
12383
|
}
|
|
12386
12384
|
const start3 = at2;
|
|
12387
12385
|
while (at2 < text18.length && text18[at2] !== "." && text18[at2] !== "[") at2 += 1;
|
|
12388
12386
|
const name = text18.slice(start3, at2);
|
|
12389
12387
|
if (!name) return void 0;
|
|
12390
|
-
|
|
12388
|
+
path106.push(nameSegment(name));
|
|
12391
12389
|
}
|
|
12392
|
-
return
|
|
12390
|
+
return path106;
|
|
12393
12391
|
}
|
|
12394
12392
|
|
|
12395
12393
|
// src/commands/config/configEntryNode.ts
|
|
12396
12394
|
function configEntryNode(root2, key) {
|
|
12397
|
-
const
|
|
12398
|
-
return
|
|
12395
|
+
const path106 = parseConfigPath(key);
|
|
12396
|
+
return path106 ? findConfigNode(root2, path106) : void 0;
|
|
12399
12397
|
}
|
|
12400
12398
|
|
|
12401
12399
|
// src/commands/backlog/harnessConfigHelp.ts
|
|
@@ -12631,16 +12629,6 @@ var refactorConfigHelp = [
|
|
|
12631
12629
|
key: "restructure.maxDepth",
|
|
12632
12630
|
setter: "assist config set restructure.maxDepth 10",
|
|
12633
12631
|
note: "deepest folder level the plan may place a file at (default 10); deeper plans list their deep chains with pin guidance, and --check fails"
|
|
12634
|
-
},
|
|
12635
|
-
{
|
|
12636
|
-
key: "restructure.maxFolderPercent",
|
|
12637
|
-
setter: "assist config set restructure.maxFolderPercent 15",
|
|
12638
|
-
note: "most files any folder except the root may hold, as a percentage of all files under the root (default 15, never below 20, capped by restructure.maxFolderFiles); larger folders are listed with pin guidance, and --check fails"
|
|
12639
|
-
},
|
|
12640
|
-
{
|
|
12641
|
-
key: "restructure.maxFolderFiles",
|
|
12642
|
-
setter: "assist config set restructure.maxFolderFiles 150",
|
|
12643
|
-
note: "cap on the restructure.maxFolderPercent folder limit (default 150)"
|
|
12644
12632
|
}
|
|
12645
12633
|
];
|
|
12646
12634
|
|
|
@@ -13149,7 +13137,7 @@ function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
|
13149
13137
|
const parent = dirname22(branchKeyPath);
|
|
13150
13138
|
const branchPrefix = basename10(branchKeyPath);
|
|
13151
13139
|
if (!existsSync34(parent)) return null;
|
|
13152
|
-
const synthesisFiles = readdirSync4(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join36(parent, name, "synthesis.md")).filter((
|
|
13140
|
+
const synthesisFiles = readdirSync4(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join36(parent, name, "synthesis.md")).filter((path106) => existsSync34(path106)).map((path106) => ({ path: path106, mtime: statSync5(path106).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
13153
13141
|
return synthesisFiles[0]?.path ?? null;
|
|
13154
13142
|
}
|
|
13155
13143
|
|
|
@@ -13179,12 +13167,12 @@ async function getReviewSynthesis(req, res) {
|
|
|
13179
13167
|
const cwd = getCwdParam(req, res);
|
|
13180
13168
|
if (!cwd) return;
|
|
13181
13169
|
try {
|
|
13182
|
-
const
|
|
13183
|
-
if (!
|
|
13170
|
+
const path106 = await resolveSynthesisPath(cwd);
|
|
13171
|
+
if (!path106) {
|
|
13184
13172
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
13185
13173
|
return;
|
|
13186
13174
|
}
|
|
13187
|
-
respondJson(res, 200, { synthesis: readFileSync22(
|
|
13175
|
+
respondJson(res, 200, { synthesis: readFileSync22(path106, "utf8") });
|
|
13188
13176
|
} catch {
|
|
13189
13177
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
13190
13178
|
}
|
|
@@ -13267,8 +13255,8 @@ function parseDiffNameStatus(output) {
|
|
|
13267
13255
|
if (!status3 || fields.length < 2) continue;
|
|
13268
13256
|
const category = categorize(status3[0]);
|
|
13269
13257
|
if (!category) continue;
|
|
13270
|
-
const
|
|
13271
|
-
if (
|
|
13258
|
+
const path106 = fields[fields.length - 1];
|
|
13259
|
+
if (path106) result[category].push(path106);
|
|
13272
13260
|
}
|
|
13273
13261
|
return result;
|
|
13274
13262
|
}
|
|
@@ -13478,21 +13466,21 @@ function subsequenceScore(text18, query) {
|
|
|
13478
13466
|
}
|
|
13479
13467
|
return score - Math.min(text18.length, MAX_LENGTH_PENALTY);
|
|
13480
13468
|
}
|
|
13481
|
-
function scoreFilePath(
|
|
13469
|
+
function scoreFilePath(path106, query) {
|
|
13482
13470
|
const needle = query.trim().toLowerCase();
|
|
13483
13471
|
if (!needle) return 0;
|
|
13484
|
-
const basename31 =
|
|
13472
|
+
const basename31 = path106.slice(path106.lastIndexOf("/") + 1);
|
|
13485
13473
|
const inBasename = subsequenceScore(basename31, needle);
|
|
13486
13474
|
if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
|
|
13487
|
-
return subsequenceScore(
|
|
13475
|
+
return subsequenceScore(path106, needle);
|
|
13488
13476
|
}
|
|
13489
13477
|
|
|
13490
13478
|
// src/commands/sessions/web/rankFilePaths.ts
|
|
13491
13479
|
function rankFilePaths(paths, query, limit) {
|
|
13492
13480
|
const scored = [];
|
|
13493
|
-
for (const
|
|
13494
|
-
const score = scoreFilePath(
|
|
13495
|
-
if (score !== null) scored.push({ path:
|
|
13481
|
+
for (const path106 of paths) {
|
|
13482
|
+
const score = scoreFilePath(path106, query);
|
|
13483
|
+
if (score !== null) scored.push({ path: path106, score });
|
|
13496
13484
|
}
|
|
13497
13485
|
scored.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
|
|
13498
13486
|
return scored.slice(0, limit).map((entry) => entry.path);
|
|
@@ -14202,11 +14190,11 @@ function logLinkedRequest(req, res) {
|
|
|
14202
14190
|
const started = Date.now();
|
|
14203
14191
|
const from = req.headers[LINKED_FROM_HEADER2];
|
|
14204
14192
|
const trace = req.headers[TRACE_HEADER] ?? "none";
|
|
14205
|
-
const
|
|
14193
|
+
const path106 = new URL(req.url ?? "/", "http://localhost").pathname;
|
|
14206
14194
|
res.once("finish", () => {
|
|
14207
|
-
if (isQuietPoll(
|
|
14195
|
+
if (isQuietPoll(path106, res.statusCode)) return;
|
|
14208
14196
|
console.log(
|
|
14209
|
-
`link-from ${from} http: ${req.method} ${
|
|
14197
|
+
`link-from ${from} http: ${req.method} ${path106} trace=${trace} -> ${res.statusCode} (${Date.now() - started}ms)`
|
|
14210
14198
|
);
|
|
14211
14199
|
});
|
|
14212
14200
|
}
|
|
@@ -14594,8 +14582,8 @@ async function liveDeployments(cwd, repo, environments) {
|
|
|
14594
14582
|
|
|
14595
14583
|
// src/commands/sessions/web/releases/latestRun.ts
|
|
14596
14584
|
async function latestRun(cwd, repo, workflow) {
|
|
14597
|
-
const
|
|
14598
|
-
const response = await ghJson(cwd, ["api",
|
|
14585
|
+
const path106 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
|
|
14586
|
+
const response = await ghJson(cwd, ["api", path106]);
|
|
14599
14587
|
const run4 = response.workflow_runs?.[0];
|
|
14600
14588
|
if (!run4) return null;
|
|
14601
14589
|
return {
|
|
@@ -14876,38 +14864,38 @@ async function performRestart(target, deps2 = {}) {
|
|
|
14876
14864
|
import { relative as relative3 } from "path";
|
|
14877
14865
|
|
|
14878
14866
|
// src/commands/sessions/web/revertPathChanges.ts
|
|
14879
|
-
async function isTracked(cwd,
|
|
14867
|
+
async function isTracked(cwd, path106) {
|
|
14880
14868
|
try {
|
|
14881
|
-
await execGit(cwd, ["ls-files", "--error-unmatch", "--",
|
|
14869
|
+
await execGit(cwd, ["ls-files", "--error-unmatch", "--", path106]);
|
|
14882
14870
|
return true;
|
|
14883
14871
|
} catch {
|
|
14884
14872
|
return false;
|
|
14885
14873
|
}
|
|
14886
14874
|
}
|
|
14887
|
-
async function isInHead(cwd,
|
|
14888
|
-
const listing = await execGit(cwd, ["ls-tree", "HEAD", "--",
|
|
14875
|
+
async function isInHead(cwd, path106) {
|
|
14876
|
+
const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path106]);
|
|
14889
14877
|
return listing.trim().length > 0;
|
|
14890
14878
|
}
|
|
14891
|
-
async function revertPathChanges(cwd,
|
|
14892
|
-
if (!await isTracked(cwd,
|
|
14893
|
-
await execGit(cwd, ["clean", "-f", "--",
|
|
14879
|
+
async function revertPathChanges(cwd, path106) {
|
|
14880
|
+
if (!await isTracked(cwd, path106)) {
|
|
14881
|
+
await execGit(cwd, ["clean", "-f", "--", path106]);
|
|
14894
14882
|
return;
|
|
14895
14883
|
}
|
|
14896
|
-
if (await isInHead(cwd,
|
|
14897
|
-
await execGit(cwd, ["checkout", "HEAD", "--",
|
|
14884
|
+
if (await isInHead(cwd, path106)) {
|
|
14885
|
+
await execGit(cwd, ["checkout", "HEAD", "--", path106]);
|
|
14898
14886
|
return;
|
|
14899
14887
|
}
|
|
14900
|
-
await execGit(cwd, ["rm", "-f", "--",
|
|
14888
|
+
await execGit(cwd, ["rm", "-f", "--", path106]);
|
|
14901
14889
|
}
|
|
14902
14890
|
|
|
14903
14891
|
// src/commands/sessions/web/revertDiffFile.ts
|
|
14904
14892
|
async function revertDiffFile(req, res) {
|
|
14905
14893
|
const resolved = getFileTarget(req, res);
|
|
14906
14894
|
if (!resolved) return;
|
|
14907
|
-
const
|
|
14895
|
+
const path106 = relative3(repoRoot(resolved.cwd), resolved.target);
|
|
14908
14896
|
try {
|
|
14909
|
-
await revertPathChanges(resolved.cwd,
|
|
14910
|
-
respondJson(res, 200, { reverted:
|
|
14897
|
+
await revertPathChanges(resolved.cwd, path106);
|
|
14898
|
+
respondJson(res, 200, { reverted: path106 });
|
|
14911
14899
|
} catch (error) {
|
|
14912
14900
|
respondJson(res, 500, {
|
|
14913
14901
|
error: error instanceof Error ? error.message : "Failed to revert file"
|
|
@@ -15012,7 +15000,7 @@ async function readJsonBody(req) {
|
|
|
15012
15000
|
function requestedPaths(body) {
|
|
15013
15001
|
const paths = body.paths;
|
|
15014
15002
|
if (!Array.isArray(paths)) return null;
|
|
15015
|
-
if (paths.some((
|
|
15003
|
+
if (paths.some((path106) => typeof path106 !== "string")) return null;
|
|
15016
15004
|
return paths;
|
|
15017
15005
|
}
|
|
15018
15006
|
async function revertDiffPaths(req, res) {
|
|
@@ -15032,10 +15020,10 @@ async function revertDiffPaths(req, res) {
|
|
|
15032
15020
|
const root2 = repoRoot(cwd);
|
|
15033
15021
|
const reverted = [];
|
|
15034
15022
|
const failed3 = [];
|
|
15035
|
-
for (const
|
|
15036
|
-
const target = resolveWithinCwd(cwd,
|
|
15023
|
+
for (const path106 of paths) {
|
|
15024
|
+
const target = resolveWithinCwd(cwd, path106);
|
|
15037
15025
|
if (!target) {
|
|
15038
|
-
failed3.push({ path:
|
|
15026
|
+
failed3.push({ path: path106, error: "Path outside cwd" });
|
|
15039
15027
|
continue;
|
|
15040
15028
|
}
|
|
15041
15029
|
const relativePath = relative4(root2, target);
|
|
@@ -15134,11 +15122,11 @@ function coerceStructuredConfigValue(key, raw) {
|
|
|
15134
15122
|
};
|
|
15135
15123
|
}
|
|
15136
15124
|
function formatIssue(key, issue) {
|
|
15137
|
-
const
|
|
15125
|
+
const path106 = formatConfigPath([
|
|
15138
15126
|
{ kind: "key", name: key },
|
|
15139
15127
|
...issue.path.map(toSegment)
|
|
15140
15128
|
]);
|
|
15141
|
-
return `${
|
|
15129
|
+
return `${path106}: ${issue.message}`;
|
|
15142
15130
|
}
|
|
15143
15131
|
function toSegment(part) {
|
|
15144
15132
|
return typeof part === "number" ? { kind: "index", index: part } : { kind: "key", name: String(part) };
|
|
@@ -15233,9 +15221,9 @@ function coerceUnion(key, raw, types) {
|
|
|
15233
15221
|
}
|
|
15234
15222
|
|
|
15235
15223
|
// src/shared/valueAtConfigPath.ts
|
|
15236
|
-
function valueAtConfigPath(value,
|
|
15224
|
+
function valueAtConfigPath(value, path106) {
|
|
15237
15225
|
let current = value;
|
|
15238
|
-
for (const key of
|
|
15226
|
+
for (const key of path106) {
|
|
15239
15227
|
if (typeof key === "number") {
|
|
15240
15228
|
if (!Array.isArray(current)) return void 0;
|
|
15241
15229
|
current = current[key];
|
|
@@ -15252,7 +15240,7 @@ function restoreConfigSecrets(value, stored, node) {
|
|
|
15252
15240
|
return mapConfigSecrets(
|
|
15253
15241
|
value,
|
|
15254
15242
|
node,
|
|
15255
|
-
(secret,
|
|
15243
|
+
(secret, path106) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path106) : secret
|
|
15256
15244
|
);
|
|
15257
15245
|
}
|
|
15258
15246
|
|
|
@@ -15301,8 +15289,8 @@ function stepIntoNested(container, key, nextKey) {
|
|
|
15301
15289
|
}
|
|
15302
15290
|
return ensureObject(container, resolved);
|
|
15303
15291
|
}
|
|
15304
|
-
function setNestedValue(obj,
|
|
15305
|
-
const keys =
|
|
15292
|
+
function setNestedValue(obj, path106, value) {
|
|
15293
|
+
const keys = path106.split(".");
|
|
15306
15294
|
const result = { ...obj };
|
|
15307
15295
|
let current = result;
|
|
15308
15296
|
for (let i = 0; i < keys.length - 1; i++) {
|
|
@@ -15329,8 +15317,8 @@ function formatIssue2(issue, key) {
|
|
|
15329
15317
|
return issue.keys.map(
|
|
15330
15318
|
(unrecognized) => `${[...issue.path, unrecognized].join(".")}: Unrecognized key`
|
|
15331
15319
|
);
|
|
15332
|
-
const
|
|
15333
|
-
return [`${
|
|
15320
|
+
const path106 = issue.path.length > 0 ? issue.path.join(".") : key;
|
|
15321
|
+
return [`${path106}: ${issue.message}`];
|
|
15334
15322
|
}
|
|
15335
15323
|
|
|
15336
15324
|
// src/commands/config/applyConfigSet.ts
|
|
@@ -15572,8 +15560,8 @@ function removeAt(container, keys) {
|
|
|
15572
15560
|
}
|
|
15573
15561
|
return removeFromChild(container, key, rest);
|
|
15574
15562
|
}
|
|
15575
|
-
function unsetNestedValue(obj,
|
|
15576
|
-
const { container, removed } = removeAt(obj,
|
|
15563
|
+
function unsetNestedValue(obj, path106) {
|
|
15564
|
+
const { container, removed } = removeAt(obj, path106.split("."));
|
|
15577
15565
|
return { config: container, removed };
|
|
15578
15566
|
}
|
|
15579
15567
|
|
|
@@ -17062,13 +17050,13 @@ function findBuiltinDenyRaw(rawCommand) {
|
|
|
17062
17050
|
|
|
17063
17051
|
// src/commands/cliHook/findRestrictedPathDeny.ts
|
|
17064
17052
|
var RESTRICTED_PATHS = [".assist/restricted"];
|
|
17065
|
-
function restrictedPathRegex(
|
|
17066
|
-
const pattern2 =
|
|
17053
|
+
function restrictedPathRegex(path106) {
|
|
17054
|
+
const pattern2 = path106.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
|
|
17067
17055
|
return new RegExp(pattern2);
|
|
17068
17056
|
}
|
|
17069
|
-
var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((
|
|
17070
|
-
path:
|
|
17071
|
-
regex: restrictedPathRegex(
|
|
17057
|
+
var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path106) => ({
|
|
17058
|
+
path: path106,
|
|
17059
|
+
regex: restrictedPathRegex(path106)
|
|
17072
17060
|
}));
|
|
17073
17061
|
function findRestrictedPathDenyRaw(rawCommand) {
|
|
17074
17062
|
const rule = RESTRICTED_PATH_RULES.find(
|
|
@@ -17245,9 +17233,9 @@ var __dirname4 = dirname25(__filename3);
|
|
|
17245
17233
|
function packageRoot() {
|
|
17246
17234
|
return __dirname4;
|
|
17247
17235
|
}
|
|
17248
|
-
function readLines(
|
|
17249
|
-
if (!existsSync40(
|
|
17250
|
-
return readFileSync25(
|
|
17236
|
+
function readLines(path106) {
|
|
17237
|
+
if (!existsSync40(path106)) return [];
|
|
17238
|
+
return readFileSync25(path106, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
17251
17239
|
}
|
|
17252
17240
|
var cachedReads;
|
|
17253
17241
|
var cachedWrites;
|
|
@@ -17779,14 +17767,14 @@ function showProgress(p, label2) {
|
|
|
17779
17767
|
const pct = Math.round(p.done / p.total * 100);
|
|
17780
17768
|
process.stderr.write(`\r\x1B[K[${pct}%] Scanning ${label2}...`);
|
|
17781
17769
|
}
|
|
17782
|
-
async function resolveCommand2(cli,
|
|
17783
|
-
showProgress(p,
|
|
17784
|
-
const subHelp = await runHelp([cli, ...
|
|
17770
|
+
async function resolveCommand2(cli, path106, description, depth, p) {
|
|
17771
|
+
showProgress(p, path106.join(" "));
|
|
17772
|
+
const subHelp = await runHelp([cli, ...path106]);
|
|
17785
17773
|
if (!subHelp || !hasSubcommands(subHelp)) {
|
|
17786
|
-
return [{ path:
|
|
17774
|
+
return [{ path: path106, description }];
|
|
17787
17775
|
}
|
|
17788
|
-
const children = await discoverAt(cli,
|
|
17789
|
-
return children.length > 0 ? children : [{ path:
|
|
17776
|
+
const children = await discoverAt(cli, path106, depth + 1, p);
|
|
17777
|
+
return children.length > 0 ? children : [{ path: path106, description }];
|
|
17790
17778
|
}
|
|
17791
17779
|
async function discoverAt(cli, parentPath, depth, p) {
|
|
17792
17780
|
if (depth > SAFETY_DEPTH) return [];
|
|
@@ -17934,9 +17922,9 @@ function logPath(cli) {
|
|
|
17934
17922
|
return join43(homedir17(), ".assist", `cli-discover-${safeName}.log`);
|
|
17935
17923
|
}
|
|
17936
17924
|
function readCache(cli) {
|
|
17937
|
-
const
|
|
17938
|
-
if (!existsSync42(
|
|
17939
|
-
return readFileSync27(
|
|
17925
|
+
const path106 = logPath(cli);
|
|
17926
|
+
if (!existsSync42(path106)) return void 0;
|
|
17927
|
+
return readFileSync27(path106, "utf8");
|
|
17940
17928
|
}
|
|
17941
17929
|
function writeCache(cli, output) {
|
|
17942
17930
|
const dir = join43(homedir17(), ".assist");
|
|
@@ -18125,9 +18113,9 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
18125
18113
|
}
|
|
18126
18114
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
18127
18115
|
for (const entry of entries) {
|
|
18128
|
-
const
|
|
18116
|
+
const path106 = join45(dir, entry);
|
|
18129
18117
|
try {
|
|
18130
|
-
if (statSync7(
|
|
18118
|
+
if (statSync7(path106).mtimeMs < cutoff) unlinkSync7(path106);
|
|
18131
18119
|
} catch {
|
|
18132
18120
|
continue;
|
|
18133
18121
|
}
|
|
@@ -18137,10 +18125,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
18137
18125
|
// src/commands/codeComment/readPinState.ts
|
|
18138
18126
|
import { existsSync as existsSync43, readFileSync as readFileSync28 } from "fs";
|
|
18139
18127
|
function readPinState(pin2) {
|
|
18140
|
-
const
|
|
18141
|
-
if (!existsSync43(
|
|
18128
|
+
const path106 = getPinStatePath(pin2);
|
|
18129
|
+
if (!existsSync43(path106)) return void 0;
|
|
18142
18130
|
try {
|
|
18143
|
-
const state = JSON.parse(readFileSync28(
|
|
18131
|
+
const state = JSON.parse(readFileSync28(path106, "utf8"));
|
|
18144
18132
|
if (state.pin !== pin2) return void 0;
|
|
18145
18133
|
return state;
|
|
18146
18134
|
} catch {
|
|
@@ -18561,8 +18549,8 @@ function findUnmergedPaths() {
|
|
|
18561
18549
|
}
|
|
18562
18550
|
const found = /* @__PURE__ */ new Set();
|
|
18563
18551
|
for (const line of output.split("\n")) {
|
|
18564
|
-
const
|
|
18565
|
-
if (
|
|
18552
|
+
const path106 = line.split(" ")[1];
|
|
18553
|
+
if (path106) found.add(path106.trim());
|
|
18566
18554
|
}
|
|
18567
18555
|
return [...found];
|
|
18568
18556
|
}
|
|
@@ -19809,11 +19797,11 @@ async function loadPath(source) {
|
|
|
19809
19797
|
}
|
|
19810
19798
|
}
|
|
19811
19799
|
async function criteriaExtension() {
|
|
19812
|
-
const
|
|
19800
|
+
const path106 = await loadPath(criteriaExtensionDir());
|
|
19813
19801
|
console.log(
|
|
19814
19802
|
chalk137.bold("acceptance criteria outliner \u2014 GitHub browser extension")
|
|
19815
19803
|
);
|
|
19816
|
-
console.log(chalk137.dim(`load the unpacked extension from ${
|
|
19804
|
+
console.log(chalk137.dim(`load the unpacked extension from ${path106}`));
|
|
19817
19805
|
}
|
|
19818
19806
|
|
|
19819
19807
|
// src/commands/criteriaExtension/signCriteriaExtension.ts
|
|
@@ -19938,10 +19926,10 @@ async function signCriteriaExtension() {
|
|
|
19938
19926
|
process.exitCode = 1;
|
|
19939
19927
|
return;
|
|
19940
19928
|
}
|
|
19941
|
-
const
|
|
19929
|
+
const path106 = await signedAddonInstallPath(
|
|
19942
19930
|
await copySignedXpi(xpi, ARTIFACTS_DIR)
|
|
19943
19931
|
);
|
|
19944
|
-
console.log(chalk139.dim(`install the signed add-on from ${
|
|
19932
|
+
console.log(chalk139.dim(`install the signed add-on from ${path106}`));
|
|
19945
19933
|
}
|
|
19946
19934
|
|
|
19947
19935
|
// src/commands/registerCriteriaExtension.ts
|
|
@@ -20039,10 +20027,10 @@ function getMigrationApprovalPath(migrationId) {
|
|
|
20039
20027
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
20040
20028
|
import { existsSync as existsSync48, readFileSync as readFileSync30 } from "fs";
|
|
20041
20029
|
function readMigrationPinState(pin2) {
|
|
20042
|
-
const
|
|
20043
|
-
if (!existsSync48(
|
|
20030
|
+
const path106 = getMigrationPinPath(pin2);
|
|
20031
|
+
if (!existsSync48(path106)) return void 0;
|
|
20044
20032
|
try {
|
|
20045
|
-
const state = JSON.parse(readFileSync30(
|
|
20033
|
+
const state = JSON.parse(readFileSync30(path106, "utf8"));
|
|
20046
20034
|
if (state.pin !== pin2) return void 0;
|
|
20047
20035
|
if (!Number.isInteger(state.migrationId)) return void 0;
|
|
20048
20036
|
return state;
|
|
@@ -21952,10 +21940,10 @@ function decideCommentGuard(input, existingContent) {
|
|
|
21952
21940
|
import { existsSync as existsSync54, unlinkSync as unlinkSync11 } from "fs";
|
|
21953
21941
|
function consumeMigrationApproval(migrationId) {
|
|
21954
21942
|
sweepRestrictedDir();
|
|
21955
|
-
const
|
|
21956
|
-
if (!existsSync54(
|
|
21943
|
+
const path106 = getMigrationApprovalPath(migrationId);
|
|
21944
|
+
if (!existsSync54(path106)) return false;
|
|
21957
21945
|
try {
|
|
21958
|
-
unlinkSync11(
|
|
21946
|
+
unlinkSync11(path106);
|
|
21959
21947
|
return true;
|
|
21960
21948
|
} catch {
|
|
21961
21949
|
return false;
|
|
@@ -24359,11 +24347,11 @@ function recentDaemonLogLines(includeRelayed = true) {
|
|
|
24359
24347
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
24360
24348
|
import { realpathSync as realpathSync2 } from "fs";
|
|
24361
24349
|
import { resolve as resolve15 } from "path";
|
|
24362
|
-
function canonicalTreePath(
|
|
24350
|
+
function canonicalTreePath(path106) {
|
|
24363
24351
|
try {
|
|
24364
|
-
return realpathSync2(
|
|
24352
|
+
return realpathSync2(path106);
|
|
24365
24353
|
} catch {
|
|
24366
|
-
return resolve15(
|
|
24354
|
+
return resolve15(path106);
|
|
24367
24355
|
}
|
|
24368
24356
|
}
|
|
24369
24357
|
|
|
@@ -24416,22 +24404,22 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
24416
24404
|
const registered = new Set(listWorktreePaths(clone));
|
|
24417
24405
|
const branches = new Set(listLocalBranches(clone));
|
|
24418
24406
|
const isTaken = (candidate) => registered.has(candidate) || existsSync57(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename17(candidate));
|
|
24419
|
-
const
|
|
24407
|
+
const path106 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
24420
24408
|
const start3 = worktreeStartPoint(clone, strategy.trunk);
|
|
24421
24409
|
gitSync(clone, [
|
|
24422
24410
|
"worktree",
|
|
24423
24411
|
"add",
|
|
24424
24412
|
start3.track ? "--track" : "--no-track",
|
|
24425
24413
|
"-b",
|
|
24426
|
-
basename17(
|
|
24427
|
-
|
|
24414
|
+
basename17(path106),
|
|
24415
|
+
path106,
|
|
24428
24416
|
start3.ref
|
|
24429
24417
|
]);
|
|
24430
|
-
recordWorktree(
|
|
24418
|
+
recordWorktree(path106, clone, getCurrentOrigin(clone));
|
|
24431
24419
|
daemonLog(
|
|
24432
|
-
start3.track ? `worktree allocated ${
|
|
24420
|
+
start3.track ? `worktree allocated ${path106} (branch ${basename17(path106)} tracking ${start3.ref}) for clone ${clone}` : `worktree allocated ${path106} (branch ${basename17(path106)} off ${start3.ref}, no mainline tracking) for clone ${clone}`
|
|
24433
24421
|
);
|
|
24434
|
-
return
|
|
24422
|
+
return path106;
|
|
24435
24423
|
}
|
|
24436
24424
|
|
|
24437
24425
|
// src/commands/sessions/daemon/worktree/keptInTree.ts
|
|
@@ -24572,13 +24560,13 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
|
|
|
24572
24560
|
if (forcedSpill) daemonLog(forcedSpill);
|
|
24573
24561
|
else if (reusesClone(clone, boundTreeRoots2, reuse))
|
|
24574
24562
|
return { cwd: clone, kind: "primary", created: false, clone };
|
|
24575
|
-
const
|
|
24563
|
+
const path106 = createWorktree(
|
|
24576
24564
|
clone,
|
|
24577
24565
|
{ root: cfg.root, trunk: cfg.trunk },
|
|
24578
24566
|
boundTreeRoots2,
|
|
24579
24567
|
options2.replacesTree
|
|
24580
24568
|
);
|
|
24581
|
-
return { cwd:
|
|
24569
|
+
return { cwd: path106, kind: "worktree", created: true, clone };
|
|
24582
24570
|
}
|
|
24583
24571
|
|
|
24584
24572
|
// src/commands/sessions/daemon/describePersistedSession.ts
|
|
@@ -24928,13 +24916,13 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
24928
24916
|
const listing = gitSyncOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
24929
24917
|
if (!listing) return null;
|
|
24930
24918
|
const here = gitSyncOrNull(cwd, ["rev-parse", "--show-toplevel"]);
|
|
24931
|
-
let
|
|
24919
|
+
let path106 = null;
|
|
24932
24920
|
for (const line of listing.split("\n")) {
|
|
24933
24921
|
const trimmed = line.trim();
|
|
24934
24922
|
if (trimmed.startsWith("worktree "))
|
|
24935
|
-
|
|
24923
|
+
path106 = trimmed.slice("worktree ".length).trim();
|
|
24936
24924
|
else if (trimmed === `branch refs/heads/${branch2}`)
|
|
24937
|
-
return
|
|
24925
|
+
return path106 && path106 !== here ? path106 : null;
|
|
24938
24926
|
}
|
|
24939
24927
|
return null;
|
|
24940
24928
|
}
|
|
@@ -26038,9 +26026,9 @@ function parseRscRows(flight) {
|
|
|
26038
26026
|
}
|
|
26039
26027
|
function makeRscResolver(rows) {
|
|
26040
26028
|
return (ref) => {
|
|
26041
|
-
const [id, ...
|
|
26029
|
+
const [id, ...path106] = ref.slice(1).replace(/^[L@]/, "").split(":");
|
|
26042
26030
|
let v = rows[id];
|
|
26043
|
-
for (const key of
|
|
26031
|
+
for (const key of path106) {
|
|
26044
26032
|
if (v == null || typeof v !== "object") return void 0;
|
|
26045
26033
|
v = v[key];
|
|
26046
26034
|
}
|
|
@@ -26791,18 +26779,18 @@ function validateLine(line) {
|
|
|
26791
26779
|
process.exit(1);
|
|
26792
26780
|
}
|
|
26793
26781
|
}
|
|
26794
|
-
async function comment2(
|
|
26782
|
+
async function comment2(path106, line, body, options2 = {}) {
|
|
26795
26783
|
const { startLine, skipPreview } = options2;
|
|
26796
26784
|
validateBody(body);
|
|
26797
26785
|
validateLine(line);
|
|
26798
26786
|
if (startLine !== void 0) validateLine(startLine);
|
|
26799
26787
|
const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
|
|
26800
26788
|
if (!skipPreview)
|
|
26801
|
-
await reviewProposedPrComment(`Comment on ${
|
|
26789
|
+
await reviewProposedPrComment(`Comment on ${path106}:${range}`, body, null);
|
|
26802
26790
|
try {
|
|
26803
26791
|
const prId = getCurrentPrNodeId();
|
|
26804
|
-
postReviewComment({ prId, body, path:
|
|
26805
|
-
console.log(`Added review comment on ${
|
|
26792
|
+
postReviewComment({ prId, body, path: path106, line, startLine });
|
|
26793
|
+
console.log(`Added review comment on ${path106}:${range}`);
|
|
26806
26794
|
} catch (error) {
|
|
26807
26795
|
if (isGhNotInstalled(error)) {
|
|
26808
26796
|
console.error("Error: GitHub CLI (gh) is not installed.");
|
|
@@ -27371,9 +27359,9 @@ function registerPrsComments(prsCommand) {
|
|
|
27371
27359
|
});
|
|
27372
27360
|
prsCommand.command("comment <path> <line> <body>").description(
|
|
27373
27361
|
"Add a line comment to the pending review (body of - reads it from stdin)"
|
|
27374
|
-
).action(async (
|
|
27362
|
+
).action(async (path106, line, body) => {
|
|
27375
27363
|
await comment2(
|
|
27376
|
-
|
|
27364
|
+
path106,
|
|
27377
27365
|
Number.parseInt(line, 10),
|
|
27378
27366
|
await readBodyArgument(body)
|
|
27379
27367
|
);
|
|
@@ -28594,11 +28582,11 @@ async function loadBody(target) {
|
|
|
28594
28582
|
if (target.kind === "file") return readDraftFile(target.path);
|
|
28595
28583
|
return fetchPrBody(target.number, target.repo);
|
|
28596
28584
|
}
|
|
28597
|
-
function readDraftFile(
|
|
28585
|
+
function readDraftFile(path106) {
|
|
28598
28586
|
try {
|
|
28599
|
-
return readFileSync44(
|
|
28587
|
+
return readFileSync44(path106, "utf8");
|
|
28600
28588
|
} catch {
|
|
28601
|
-
console.error(`Error: Could not read \`${
|
|
28589
|
+
console.error(`Error: Could not read \`${path106}\`.`);
|
|
28602
28590
|
console.error(
|
|
28603
28591
|
"Pass a pull request number, a GitHub pull request URL, - for stdin, or a path to a file."
|
|
28604
28592
|
);
|
|
@@ -28878,10 +28866,10 @@ function resolveOpSecret(reference) {
|
|
|
28878
28866
|
}
|
|
28879
28867
|
|
|
28880
28868
|
// src/commands/ravendb/ravenFetch.ts
|
|
28881
|
-
async function ravenFetch(connection,
|
|
28869
|
+
async function ravenFetch(connection, path106) {
|
|
28882
28870
|
const apiKey = resolveOpSecret(connection.apiKeyRef);
|
|
28883
28871
|
let accessToken = await getAccessToken(apiKey);
|
|
28884
|
-
const url = `${connection.url}${
|
|
28872
|
+
const url = `${connection.url}${path106}`;
|
|
28885
28873
|
const headers = {
|
|
28886
28874
|
Authorization: `Bearer ${accessToken}`,
|
|
28887
28875
|
"Content-Type": "application/json"
|
|
@@ -28971,16 +28959,16 @@ import chalk195 from "chalk";
|
|
|
28971
28959
|
// src/commands/ravendb/buildQueryPath.ts
|
|
28972
28960
|
function buildQueryPath(opts) {
|
|
28973
28961
|
const db = encodeURIComponent(opts.db);
|
|
28974
|
-
let
|
|
28962
|
+
let path106;
|
|
28975
28963
|
if (opts.collection) {
|
|
28976
|
-
|
|
28964
|
+
path106 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
|
|
28977
28965
|
} else {
|
|
28978
|
-
|
|
28966
|
+
path106 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
|
|
28979
28967
|
}
|
|
28980
28968
|
if (opts.query) {
|
|
28981
|
-
|
|
28969
|
+
path106 += `&query=${encodeURIComponent(opts.query)}`;
|
|
28982
28970
|
}
|
|
28983
|
-
return
|
|
28971
|
+
return path106;
|
|
28984
28972
|
}
|
|
28985
28973
|
|
|
28986
28974
|
// src/commands/ravendb/fetchAllPages.ts
|
|
@@ -28989,7 +28977,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
28989
28977
|
let start3 = 0;
|
|
28990
28978
|
while (true) {
|
|
28991
28979
|
const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
|
|
28992
|
-
const
|
|
28980
|
+
const path106 = buildQueryPath({
|
|
28993
28981
|
db: connection.database,
|
|
28994
28982
|
collection: opts.collection,
|
|
28995
28983
|
start: start3,
|
|
@@ -28997,7 +28985,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
28997
28985
|
sort: opts.sort,
|
|
28998
28986
|
query: opts.query
|
|
28999
28987
|
});
|
|
29000
|
-
const data = await ravenFetch(connection,
|
|
28988
|
+
const data = await ravenFetch(connection, path106);
|
|
29001
28989
|
const results = data.Results ?? [];
|
|
29002
28990
|
const totalResults = data.TotalResults ?? 0;
|
|
29003
28991
|
if (results.length === 0) break;
|
|
@@ -31511,7 +31499,7 @@ Renamed ${oldName} \u2192 ${newName}`));
|
|
|
31511
31499
|
|
|
31512
31500
|
// src/commands/refactor/restructure.ts
|
|
31513
31501
|
import fs38 from "fs";
|
|
31514
|
-
import
|
|
31502
|
+
import path80 from "path";
|
|
31515
31503
|
import chalk223 from "chalk";
|
|
31516
31504
|
|
|
31517
31505
|
// src/commands/refactor/restructure/buildPlan.ts
|
|
@@ -31892,33 +31880,20 @@ Plan exceeds restructure.maxDepth ${maxDepth}: ${tooDeep} file(s) deeper.`
|
|
|
31892
31880
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
31893
31881
|
function pinSteps(apply) {
|
|
31894
31882
|
return [
|
|
31895
|
-
"
|
|
31896
|
-
"1.
|
|
31883
|
+
"Pin feature modules until this check passes:",
|
|
31884
|
+
"1. On each chain, pick the highest module that is a feature boundary: a route, view, page, panel, dialog or card. Never a hook, utility, style file or helper.",
|
|
31897
31885
|
"2. Add it to restructure.pin in assist.yml yourself (basename without extension). One pin at a time: one feature pin often fixes several chains.",
|
|
31898
|
-
"3.
|
|
31899
|
-
"4.
|
|
31900
|
-
"5. If a chain has no sensible feature boundary, or every pin that fixes the depth pushes a folder over the limit, stop and report it.",
|
|
31886
|
+
"3. Re-run this command. Repeat until the plan is within the limit.",
|
|
31887
|
+
"4. If a chain has no sensible feature boundary, stop and report that chain.",
|
|
31901
31888
|
`Then run \`${apply}\`.`
|
|
31902
31889
|
];
|
|
31903
31890
|
}
|
|
31904
|
-
function displayLargeFolders(folders, limit) {
|
|
31905
|
-
if (folders.length === 0) return;
|
|
31906
|
-
console.log(
|
|
31907
|
-
chalk217.red(
|
|
31908
|
-
`
|
|
31909
|
-
Plan puts more than ${limit} file(s) in ${folders.length} folder(s) (restructure.maxFolderPercent of all files, capped at restructure.maxFolderFiles):`
|
|
31910
|
-
)
|
|
31911
|
-
);
|
|
31912
|
-
for (const { folder, files } of folders)
|
|
31913
|
-
console.log(` ${folder}/ ${files} file(s)`);
|
|
31914
|
-
}
|
|
31915
31891
|
function exceedsLayoutLimits(limits) {
|
|
31916
|
-
return limits.chains.length > 0
|
|
31892
|
+
return limits.chains.length > 0;
|
|
31917
31893
|
}
|
|
31918
31894
|
function displayLayoutLimits(limits, apply) {
|
|
31919
31895
|
if (!exceedsLayoutLimits(limits)) return;
|
|
31920
31896
|
displayDeepChains(limits.chains, limits.maxDepth);
|
|
31921
|
-
displayLargeFolders(limits.largeFolders, limits.folderLimit);
|
|
31922
31897
|
console.log("");
|
|
31923
31898
|
for (const line of pinSteps(apply)) console.log(chalk217.yellow(line));
|
|
31924
31899
|
}
|
|
@@ -31980,43 +31955,20 @@ function findDeepChains(targets, scopeRoot, maxDepth) {
|
|
|
31980
31955
|
return [...chains.entries()].sort(([ka, a], [kb, b]) => b.tooDeep - a.tooDeep || ka.localeCompare(kb)).map(([, chain2]) => chain2);
|
|
31981
31956
|
}
|
|
31982
31957
|
|
|
31983
|
-
// src/commands/refactor/restructure/findLargeFolders.ts
|
|
31984
|
-
import path75 from "path";
|
|
31985
|
-
function findLargeFolders(targets, scopeRoot, limit) {
|
|
31986
|
-
const counts2 = /* @__PURE__ */ new Map();
|
|
31987
|
-
for (const target of targets) {
|
|
31988
|
-
const folder = path75.relative(scopeRoot, path75.dirname(target));
|
|
31989
|
-
if (folder !== "") counts2.set(folder, (counts2.get(folder) ?? 0) + 1);
|
|
31990
|
-
}
|
|
31991
|
-
return [...counts2].filter(([, files]) => files > limit).sort(([a, fa], [b, fb]) => fb - fa || a.localeCompare(b)).map(([folder, files]) => ({
|
|
31992
|
-
folder: folder.split(path75.sep).join("/"),
|
|
31993
|
-
files
|
|
31994
|
-
}));
|
|
31995
|
-
}
|
|
31996
|
-
|
|
31997
31958
|
// src/commands/refactor/restructure/checkLayoutLimits.ts
|
|
31998
|
-
|
|
31999
|
-
function checkLayoutLimits(plan2, settings) {
|
|
32000
|
-
const targets = [...plan2.targets.values()];
|
|
32001
|
-
const share = Math.ceil(targets.length * settings.maxFolderPercent / 100);
|
|
32002
|
-
const folderLimit = Math.min(
|
|
32003
|
-
Math.max(share, minFolderLimit),
|
|
32004
|
-
settings.maxFolderFiles
|
|
32005
|
-
);
|
|
31959
|
+
function checkLayoutLimits(plan2, maxDepth) {
|
|
32006
31960
|
return {
|
|
32007
|
-
maxDepth
|
|
32008
|
-
chains: findDeepChains(targets, plan2.scopeRoot,
|
|
32009
|
-
folderLimit,
|
|
32010
|
-
largeFolders: findLargeFolders(targets, plan2.scopeRoot, folderLimit)
|
|
31961
|
+
maxDepth,
|
|
31962
|
+
chains: findDeepChains(plan2.targets.values(), plan2.scopeRoot, maxDepth)
|
|
32011
31963
|
};
|
|
32012
31964
|
}
|
|
32013
31965
|
|
|
32014
31966
|
// src/commands/refactor/restructure/partitionIgnored.ts
|
|
32015
|
-
import
|
|
31967
|
+
import path75 from "path";
|
|
32016
31968
|
import { minimatch as minimatch4 } from "minimatch";
|
|
32017
31969
|
function partitionIgnored(files) {
|
|
32018
31970
|
const globs = loadConfig().restructure?.ignore ?? [];
|
|
32019
|
-
const isIgnored = (file) => globs.some((glob) => minimatch4(
|
|
31971
|
+
const isIgnored = (file) => globs.some((glob) => minimatch4(path75.relative(process.cwd(), file), glob));
|
|
32020
31972
|
return {
|
|
32021
31973
|
scoped: files.filter((f) => !isIgnored(f)),
|
|
32022
31974
|
ignored: files.filter(isIgnored)
|
|
@@ -32031,10 +31983,10 @@ import chalk220 from "chalk";
|
|
|
32031
31983
|
|
|
32032
31984
|
// src/commands/refactor/restructure/executePlan.ts
|
|
32033
31985
|
import fs37 from "fs";
|
|
32034
|
-
import
|
|
31986
|
+
import path76 from "path";
|
|
32035
31987
|
import chalk219 from "chalk";
|
|
32036
31988
|
function relPath(file) {
|
|
32037
|
-
return
|
|
31989
|
+
return path76.relative(process.cwd(), file);
|
|
32038
31990
|
}
|
|
32039
31991
|
function stagingPath(move2, index3) {
|
|
32040
31992
|
return `${move2.from}.restructure-${process.pid}-${index3}`;
|
|
@@ -32046,7 +31998,7 @@ function moveFiles(moves) {
|
|
|
32046
31998
|
return { move: move2, staging };
|
|
32047
31999
|
});
|
|
32048
32000
|
for (const { move: move2, staging } of staged) {
|
|
32049
|
-
fs37.mkdirSync(
|
|
32001
|
+
fs37.mkdirSync(path76.dirname(move2.to), { recursive: true });
|
|
32050
32002
|
fs37.renameSync(staging, move2.to);
|
|
32051
32003
|
console.log(
|
|
32052
32004
|
chalk219.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
|
|
@@ -32062,8 +32014,8 @@ function removeIfEmpty(dir) {
|
|
|
32062
32014
|
function removeEmptyDirectories(dirs, scopeRoot) {
|
|
32063
32015
|
const deepestFirst = [...new Set(dirs)].sort((a, b) => b.length - a.length);
|
|
32064
32016
|
for (let dir of deepestFirst) {
|
|
32065
|
-
while (dir.startsWith(`${scopeRoot}${
|
|
32066
|
-
dir =
|
|
32017
|
+
while (dir.startsWith(`${scopeRoot}${path76.sep}`) && removeIfEmpty(dir))
|
|
32018
|
+
dir = path76.dirname(dir);
|
|
32067
32019
|
}
|
|
32068
32020
|
}
|
|
32069
32021
|
function executePlan(plan2) {
|
|
@@ -32073,7 +32025,7 @@ function executePlan(plan2) {
|
|
|
32073
32025
|
}
|
|
32074
32026
|
moveFiles(plan2.moves);
|
|
32075
32027
|
removeEmptyDirectories(
|
|
32076
|
-
plan2.moves.map((m) =>
|
|
32028
|
+
plan2.moves.map((m) => path76.dirname(m.from)),
|
|
32077
32029
|
plan2.scopeRoot
|
|
32078
32030
|
);
|
|
32079
32031
|
}
|
|
@@ -32090,17 +32042,17 @@ function applyPlan(plan2) {
|
|
|
32090
32042
|
}
|
|
32091
32043
|
|
|
32092
32044
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
32093
|
-
import
|
|
32045
|
+
import path79 from "path";
|
|
32094
32046
|
import chalk221 from "chalk";
|
|
32095
32047
|
|
|
32096
32048
|
// src/commands/refactor/restructure/computeDepthStats.ts
|
|
32097
|
-
import
|
|
32049
|
+
import path77 from "path";
|
|
32098
32050
|
function computeDepthStats(targets, scopeRoot) {
|
|
32099
32051
|
const distribution = /* @__PURE__ */ new Map();
|
|
32100
32052
|
let max = 0;
|
|
32101
32053
|
for (const target of targets) {
|
|
32102
|
-
const dir =
|
|
32103
|
-
const depth = dir === "" ? 0 : dir.split(
|
|
32054
|
+
const dir = path77.relative(scopeRoot, path77.dirname(target));
|
|
32055
|
+
const depth = dir === "" ? 0 : dir.split(path77.sep).length;
|
|
32104
32056
|
distribution.set(depth, (distribution.get(depth) ?? 0) + 1);
|
|
32105
32057
|
max = Math.max(max, depth);
|
|
32106
32058
|
}
|
|
@@ -32108,7 +32060,7 @@ function computeDepthStats(targets, scopeRoot) {
|
|
|
32108
32060
|
}
|
|
32109
32061
|
|
|
32110
32062
|
// src/commands/refactor/restructure/formatTree.ts
|
|
32111
|
-
import
|
|
32063
|
+
import path78 from "path";
|
|
32112
32064
|
function insert(root2, parts) {
|
|
32113
32065
|
let node = root2;
|
|
32114
32066
|
for (const part of parts) {
|
|
@@ -32130,7 +32082,7 @@ function render(node, indent3, lines2) {
|
|
|
32130
32082
|
function formatTree(files, scopeRoot) {
|
|
32131
32083
|
const root2 = /* @__PURE__ */ new Map();
|
|
32132
32084
|
for (const file of files)
|
|
32133
|
-
insert(root2,
|
|
32085
|
+
insert(root2, path78.relative(scopeRoot, file).split(path78.sep));
|
|
32134
32086
|
const lines2 = [];
|
|
32135
32087
|
render(root2, "", lines2);
|
|
32136
32088
|
return lines2;
|
|
@@ -32138,7 +32090,7 @@ function formatTree(files, scopeRoot) {
|
|
|
32138
32090
|
|
|
32139
32091
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
32140
32092
|
function relPath2(filePath) {
|
|
32141
|
-
return
|
|
32093
|
+
return path79.relative(process.cwd(), filePath);
|
|
32142
32094
|
}
|
|
32143
32095
|
function displayMoves(plan2) {
|
|
32144
32096
|
if (plan2.moves.length === 0) return;
|
|
@@ -32204,7 +32156,7 @@ function runPlan(plan2, limits, apply) {
|
|
|
32204
32156
|
|
|
32205
32157
|
// src/commands/refactor/restructure.ts
|
|
32206
32158
|
async function restructure(root2, options2 = {}) {
|
|
32207
|
-
const scopeRoot =
|
|
32159
|
+
const scopeRoot = path80.resolve(root2 ?? "src");
|
|
32208
32160
|
if (!fs38.existsSync(scopeRoot) || !fs38.statSync(scopeRoot).isDirectory()) {
|
|
32209
32161
|
console.log(chalk223.red(`Not a directory: ${root2 ?? "src"}`));
|
|
32210
32162
|
process.exit(1);
|
|
@@ -32216,18 +32168,9 @@ async function restructure(root2, options2 = {}) {
|
|
|
32216
32168
|
console.log(chalk223.yellow("No files found under root"));
|
|
32217
32169
|
return;
|
|
32218
32170
|
}
|
|
32219
|
-
const {
|
|
32220
|
-
pin: pin2 = [],
|
|
32221
|
-
maxDepth = 10,
|
|
32222
|
-
maxFolderPercent = 15,
|
|
32223
|
-
maxFolderFiles = 150
|
|
32224
|
-
} = loadConfig().restructure ?? {};
|
|
32171
|
+
const { pin: pin2 = [], maxDepth = 10 } = loadConfig().restructure ?? {};
|
|
32225
32172
|
const plan2 = buildPlan3(scopeRoot, scoped, ignored, pin2);
|
|
32226
|
-
const limits = checkLayoutLimits(plan2,
|
|
32227
|
-
maxDepth,
|
|
32228
|
-
maxFolderPercent,
|
|
32229
|
-
maxFolderFiles
|
|
32230
|
-
});
|
|
32173
|
+
const limits = checkLayoutLimits(plan2, maxDepth);
|
|
32231
32174
|
if (options2.check) return checkPlan(plan2, limits);
|
|
32232
32175
|
runPlan(plan2, limits, options2.apply === true);
|
|
32233
32176
|
}
|
|
@@ -32604,8 +32547,8 @@ function groupFilesByDirectory(files) {
|
|
|
32604
32547
|
}
|
|
32605
32548
|
|
|
32606
32549
|
// src/commands/review/highLevel/buildHighLevelTree.ts
|
|
32607
|
-
function basename19(
|
|
32608
|
-
return
|
|
32550
|
+
function basename19(path106) {
|
|
32551
|
+
return path106.slice(path106.lastIndexOf("/") + 1);
|
|
32609
32552
|
}
|
|
32610
32553
|
function sum(nodes, key) {
|
|
32611
32554
|
return nodes.reduce((total, node) => total + node[key], 0);
|
|
@@ -32628,19 +32571,19 @@ function nodesOf(at2, prefix2) {
|
|
|
32628
32571
|
}
|
|
32629
32572
|
function collapsedDirNode(name, at2, prefix2) {
|
|
32630
32573
|
let label2 = name;
|
|
32631
|
-
let
|
|
32574
|
+
let path106 = prefix2 ? `${prefix2}/${name}` : name;
|
|
32632
32575
|
let node = at2;
|
|
32633
32576
|
while (node.files.length === 0 && node.dirs.size === 1) {
|
|
32634
32577
|
const [childName, child] = [...node.dirs][0];
|
|
32635
32578
|
label2 = `${label2}/${childName}`;
|
|
32636
|
-
|
|
32579
|
+
path106 = `${path106}/${childName}`;
|
|
32637
32580
|
node = child;
|
|
32638
32581
|
}
|
|
32639
|
-
const children = nodesOf(node,
|
|
32582
|
+
const children = nodesOf(node, path106);
|
|
32640
32583
|
return {
|
|
32641
32584
|
kind: "dir",
|
|
32642
32585
|
name: label2,
|
|
32643
|
-
path:
|
|
32586
|
+
path: path106,
|
|
32644
32587
|
additions: sum(children, "additions"),
|
|
32645
32588
|
deletions: sum(children, "deletions"),
|
|
32646
32589
|
children
|
|
@@ -32898,8 +32841,8 @@ function toStatus(status3) {
|
|
|
32898
32841
|
if (status3 === "removed") return "removed";
|
|
32899
32842
|
return "modified";
|
|
32900
32843
|
}
|
|
32901
|
-
function diffUrl(repo, prNumber,
|
|
32902
|
-
const anchor = createHash3("sha256").update(
|
|
32844
|
+
function diffUrl(repo, prNumber, path106) {
|
|
32845
|
+
const anchor = createHash3("sha256").update(path106).digest("hex");
|
|
32903
32846
|
return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
|
|
32904
32847
|
}
|
|
32905
32848
|
function fetchHighLevelFiles(prNumber, repo) {
|
|
@@ -32955,10 +32898,10 @@ function highLevelReviewPath(repo, headRef, headSha) {
|
|
|
32955
32898
|
|
|
32956
32899
|
// src/commands/review/highLevel/loadHighLevelReview.ts
|
|
32957
32900
|
function loadHighLevelReview(repo, headRef, headSha) {
|
|
32958
|
-
const
|
|
32959
|
-
if (!existsSync64(
|
|
32901
|
+
const path106 = highLevelReviewPath(repo, headRef, headSha);
|
|
32902
|
+
if (!existsSync64(path106)) return void 0;
|
|
32960
32903
|
try {
|
|
32961
|
-
return JSON.parse(readFileSync47(
|
|
32904
|
+
return JSON.parse(readFileSync47(path106, "utf8"));
|
|
32962
32905
|
} catch {
|
|
32963
32906
|
return void 0;
|
|
32964
32907
|
}
|
|
@@ -32969,8 +32912,8 @@ import { minimatch as minimatch7 } from "minimatch";
|
|
|
32969
32912
|
function selectCriticalDiffs(files, criticalPaths) {
|
|
32970
32913
|
if (criticalPaths.length === 0) return [];
|
|
32971
32914
|
return files.filter((file) => criticalPaths.some((glob) => minimatch7(file.path, glob))).map(
|
|
32972
|
-
({ path:
|
|
32973
|
-
path:
|
|
32915
|
+
({ path: path106, status: status3, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
|
|
32916
|
+
path: path106,
|
|
32974
32917
|
status: status3,
|
|
32975
32918
|
additions,
|
|
32976
32919
|
deletions,
|
|
@@ -33085,11 +33028,11 @@ function highLevelPreviewPayload(subject) {
|
|
|
33085
33028
|
import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync39 } from "fs";
|
|
33086
33029
|
import { dirname as dirname36 } from "path";
|
|
33087
33030
|
function saveHighLevelReview(record) {
|
|
33088
|
-
const
|
|
33089
|
-
mkdirSync22(dirname36(
|
|
33090
|
-
writeFileSync39(
|
|
33031
|
+
const path106 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
|
|
33032
|
+
mkdirSync22(dirname36(path106), { recursive: true });
|
|
33033
|
+
writeFileSync39(path106, `${JSON.stringify(record, null, 2)}
|
|
33091
33034
|
`);
|
|
33092
|
-
return
|
|
33035
|
+
return path106;
|
|
33093
33036
|
}
|
|
33094
33037
|
|
|
33095
33038
|
// src/commands/review/highLevel/openHighLevelOverlay.ts
|
|
@@ -33108,9 +33051,9 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
33108
33051
|
{ rejectIsOutcome: true }
|
|
33109
33052
|
);
|
|
33110
33053
|
const record = buildHighLevelRecord(subject, decision);
|
|
33111
|
-
const
|
|
33054
|
+
const path106 = saveHighLevelReview(record);
|
|
33112
33055
|
console.log(`Verdict: ${record.verdict}`);
|
|
33113
|
-
console.log(`Saved ${
|
|
33056
|
+
console.log(`Saved ${path106}`);
|
|
33114
33057
|
console.log("Nothing was posted to GitHub.");
|
|
33115
33058
|
return record;
|
|
33116
33059
|
}
|
|
@@ -34125,8 +34068,8 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
34125
34068
|
// src/commands/review/prepareReviewDir.ts
|
|
34126
34069
|
import { existsSync as existsSync65, mkdirSync as mkdirSync23, unlinkSync as unlinkSync18, writeFileSync as writeFileSync40 } from "fs";
|
|
34127
34070
|
function clearReviewFiles(paths) {
|
|
34128
|
-
for (const
|
|
34129
|
-
if (existsSync65(
|
|
34071
|
+
for (const path106 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
34072
|
+
if (existsSync65(path106)) unlinkSync18(path106);
|
|
34130
34073
|
}
|
|
34131
34074
|
}
|
|
34132
34075
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -35364,7 +35307,7 @@ function registerReview(program2) {
|
|
|
35364
35307
|
|
|
35365
35308
|
// src/commands/rules/addRule.ts
|
|
35366
35309
|
import { existsSync as existsSync70, readFileSync as readFileSync53, writeFileSync as writeFileSync43 } from "fs";
|
|
35367
|
-
import
|
|
35310
|
+
import path85 from "path";
|
|
35368
35311
|
import chalk235 from "chalk";
|
|
35369
35312
|
|
|
35370
35313
|
// src/commands/rules/insertRuleBullet.ts
|
|
@@ -35392,7 +35335,7 @@ import { readFileSync as readFileSync50 } from "fs";
|
|
|
35392
35335
|
|
|
35393
35336
|
// src/commands/rules/findClaudeFiles.ts
|
|
35394
35337
|
import { readdirSync as readdirSync13 } from "fs";
|
|
35395
|
-
import
|
|
35338
|
+
import path81 from "path";
|
|
35396
35339
|
var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
|
|
35397
35340
|
function findClaudeFiles(dir) {
|
|
35398
35341
|
const results = [];
|
|
@@ -35400,9 +35343,9 @@ function findClaudeFiles(dir) {
|
|
|
35400
35343
|
if (entry.isDirectory()) {
|
|
35401
35344
|
if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
|
|
35402
35345
|
continue;
|
|
35403
|
-
results.push(...findClaudeFiles(
|
|
35346
|
+
results.push(...findClaudeFiles(path81.join(dir, entry.name)));
|
|
35404
35347
|
} else if (entry.name === "CLAUDE.md") {
|
|
35405
|
-
results.push(
|
|
35348
|
+
results.push(path81.join(dir, entry.name));
|
|
35406
35349
|
}
|
|
35407
35350
|
}
|
|
35408
35351
|
return results;
|
|
@@ -35421,34 +35364,34 @@ function nextRuleCode(root2) {
|
|
|
35421
35364
|
|
|
35422
35365
|
// src/commands/rules/resolveRuleScope.ts
|
|
35423
35366
|
import { existsSync as existsSync68 } from "fs";
|
|
35424
|
-
import
|
|
35367
|
+
import path82 from "path";
|
|
35425
35368
|
function resolveRuleScope(target) {
|
|
35426
|
-
const resolved =
|
|
35427
|
-
if (
|
|
35369
|
+
const resolved = path82.resolve(target);
|
|
35370
|
+
if (path82.basename(resolved) === "CLAUDE.md") return resolved;
|
|
35428
35371
|
const startDir = scopeDirectory(resolved);
|
|
35429
35372
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
35430
35373
|
let current = startDir;
|
|
35431
35374
|
while (true) {
|
|
35432
|
-
const candidate =
|
|
35375
|
+
const candidate = path82.join(current, "CLAUDE.md");
|
|
35433
35376
|
if (existsSync68(candidate)) return candidate;
|
|
35434
|
-
if (current === root2 || current ===
|
|
35435
|
-
current =
|
|
35377
|
+
if (current === root2 || current === path82.dirname(current)) break;
|
|
35378
|
+
current = path82.dirname(current);
|
|
35436
35379
|
}
|
|
35437
|
-
return
|
|
35380
|
+
return path82.join(root2, "CLAUDE.md");
|
|
35438
35381
|
}
|
|
35439
35382
|
|
|
35440
35383
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
35441
35384
|
import { existsSync as existsSync69, readFileSync as readFileSync52, writeFileSync as writeFileSync42 } from "fs";
|
|
35442
|
-
import
|
|
35385
|
+
import path84 from "path";
|
|
35443
35386
|
|
|
35444
35387
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
35445
35388
|
import { readFileSync as readFileSync51 } from "fs";
|
|
35446
|
-
import
|
|
35389
|
+
import path83 from "path";
|
|
35447
35390
|
function scopedRuleDirectories(root2) {
|
|
35448
35391
|
return findClaudeFiles(root2).filter(
|
|
35449
|
-
(file) =>
|
|
35392
|
+
(file) => path83.dirname(file) !== root2 && parseRulesSection(readFileSync51(file, "utf8")).length > 0
|
|
35450
35393
|
).map(
|
|
35451
|
-
(file) => `${
|
|
35394
|
+
(file) => `${path83.relative(root2, path83.dirname(file)).split(path83.sep).join("/")}/`
|
|
35452
35395
|
).sort();
|
|
35453
35396
|
}
|
|
35454
35397
|
|
|
@@ -35487,7 +35430,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
35487
35430
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
35488
35431
|
function updateScopedRulesIndex(root2) {
|
|
35489
35432
|
const directories = scopedRuleDirectories(root2);
|
|
35490
|
-
const rootFile =
|
|
35433
|
+
const rootFile = path84.join(root2, "CLAUDE.md");
|
|
35491
35434
|
const before = existsSync69(rootFile) ? readFileSync52(rootFile, "utf8") : "";
|
|
35492
35435
|
const after = upsertScopedRulesPointer(before, directories);
|
|
35493
35436
|
if (after !== before) writeFileSync42(rootFile, after);
|
|
@@ -35506,7 +35449,7 @@ function addRule(text18, options2) {
|
|
|
35506
35449
|
return;
|
|
35507
35450
|
}
|
|
35508
35451
|
const target = resolveRuleScope(options2.scope ?? process.cwd());
|
|
35509
|
-
const targetDir =
|
|
35452
|
+
const targetDir = path85.dirname(target);
|
|
35510
35453
|
const root2 = findRepoRoot(targetDir) ?? targetDir;
|
|
35511
35454
|
const code = nextRuleCode(root2);
|
|
35512
35455
|
writeFileSync43(
|
|
@@ -35519,18 +35462,18 @@ function addRule(text18, options2) {
|
|
|
35519
35462
|
);
|
|
35520
35463
|
updateScopedRulesIndex(root2);
|
|
35521
35464
|
console.log(
|
|
35522
|
-
`Added ${chalk235.cyan(code)} to ${
|
|
35465
|
+
`Added ${chalk235.cyan(code)} to ${path85.relative(process.cwd(), target) || target}`
|
|
35523
35466
|
);
|
|
35524
35467
|
}
|
|
35525
35468
|
|
|
35526
35469
|
// src/commands/rules/indexRules.ts
|
|
35527
|
-
import
|
|
35470
|
+
import path86 from "path";
|
|
35528
35471
|
import chalk236 from "chalk";
|
|
35529
35472
|
function indexRules() {
|
|
35530
35473
|
const startDir = scopeDirectory(process.cwd());
|
|
35531
35474
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
35532
35475
|
const directories = updateScopedRulesIndex(root2);
|
|
35533
|
-
const rootFile =
|
|
35476
|
+
const rootFile = path86.relative(process.cwd(), path86.join(root2, "CLAUDE.md"));
|
|
35534
35477
|
if (directories.length === 0) {
|
|
35535
35478
|
console.log(
|
|
35536
35479
|
chalk236.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
@@ -35543,13 +35486,13 @@ function indexRules() {
|
|
|
35543
35486
|
}
|
|
35544
35487
|
|
|
35545
35488
|
// src/commands/rules/listRules.ts
|
|
35546
|
-
import
|
|
35489
|
+
import path87 from "path";
|
|
35547
35490
|
import chalk237 from "chalk";
|
|
35548
35491
|
function listRules(target, options2 = {}) {
|
|
35549
|
-
const resolved =
|
|
35492
|
+
const resolved = path87.resolve(target ?? process.cwd());
|
|
35550
35493
|
const rules3 = readScopedRules(resolved);
|
|
35551
35494
|
if (rules3.length === 0) {
|
|
35552
|
-
const label2 =
|
|
35495
|
+
const label2 = path87.relative(process.cwd(), resolved) || ".";
|
|
35553
35496
|
console.log(chalk237.gray(`No rules in scope for ${label2}`));
|
|
35554
35497
|
return;
|
|
35555
35498
|
}
|
|
@@ -35560,7 +35503,7 @@ function listRules(target, options2 = {}) {
|
|
|
35560
35503
|
if (rule.source !== shown) {
|
|
35561
35504
|
shown = rule.source;
|
|
35562
35505
|
console.log(
|
|
35563
|
-
chalk237.dim(base ?
|
|
35506
|
+
chalk237.dim(base ? path87.relative(base, rule.source) : rule.source)
|
|
35564
35507
|
);
|
|
35565
35508
|
}
|
|
35566
35509
|
console.log(
|
|
@@ -35656,8 +35599,8 @@ import chalk243 from "chalk";
|
|
|
35656
35599
|
|
|
35657
35600
|
// src/commands/seq/fetchSeq.ts
|
|
35658
35601
|
import chalk240 from "chalk";
|
|
35659
|
-
async function fetchSeq(conn,
|
|
35660
|
-
const url = `${conn.url}${
|
|
35602
|
+
async function fetchSeq(conn, path106, params) {
|
|
35603
|
+
const url = `${conn.url}${path106}?${params}`;
|
|
35661
35604
|
const response = await fetch(url, {
|
|
35662
35605
|
headers: {
|
|
35663
35606
|
Accept: "application/json",
|
|
@@ -36038,7 +35981,7 @@ async function previewSlackThreadParts({
|
|
|
36038
35981
|
`Approved for ${target}. The ${bodies.length} bodies to post, in thread order, are at:`
|
|
36039
35982
|
);
|
|
36040
35983
|
paths.forEach(
|
|
36041
|
-
(
|
|
35984
|
+
(path106, index3) => console.log(`${index3 + 1}/${paths.length} ${path106}`)
|
|
36042
35985
|
);
|
|
36043
35986
|
console.log(
|
|
36044
35987
|
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.`
|
|
@@ -36380,15 +36323,15 @@ function registerSql(program2) {
|
|
|
36380
36323
|
|
|
36381
36324
|
// src/commands/sync.ts
|
|
36382
36325
|
import * as os5 from "os";
|
|
36383
|
-
import * as
|
|
36326
|
+
import * as path99 from "path";
|
|
36384
36327
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
36385
36328
|
|
|
36386
36329
|
// src/commands/sync/pruneCommands.ts
|
|
36387
|
-
import * as
|
|
36330
|
+
import * as path89 from "path";
|
|
36388
36331
|
|
|
36389
36332
|
// src/commands/sync/pruneTarget.ts
|
|
36390
36333
|
import * as fs39 from "fs";
|
|
36391
|
-
import * as
|
|
36334
|
+
import * as path88 from "path";
|
|
36392
36335
|
function pruneTarget(targetDir, keepNames, shape, options2) {
|
|
36393
36336
|
const result = {
|
|
36394
36337
|
orphans: [],
|
|
@@ -36406,7 +36349,7 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
|
|
|
36406
36349
|
}
|
|
36407
36350
|
if (keep.has(name)) continue;
|
|
36408
36351
|
result.orphans.push(entry.name);
|
|
36409
|
-
const entryPath =
|
|
36352
|
+
const entryPath = path88.join(targetDir, entry.name);
|
|
36410
36353
|
const reason4 = shape.blockedBy?.(entryPath);
|
|
36411
36354
|
if (reason4) {
|
|
36412
36355
|
result.skipped.push({ name: entry.name, reason: reason4 });
|
|
@@ -36426,7 +36369,7 @@ function pruneCommands(targetDir, commandNames, options2) {
|
|
|
36426
36369
|
targetDir,
|
|
36427
36370
|
commandNames,
|
|
36428
36371
|
{
|
|
36429
|
-
nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ?
|
|
36372
|
+
nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path89.basename(entry.name, ".md") : void 0
|
|
36430
36373
|
},
|
|
36431
36374
|
options2
|
|
36432
36375
|
);
|
|
@@ -36461,16 +36404,16 @@ function reportPrune(label2, result, force) {
|
|
|
36461
36404
|
|
|
36462
36405
|
// src/commands/sync/syncClaudeCommands.ts
|
|
36463
36406
|
import * as fs43 from "fs";
|
|
36464
|
-
import * as
|
|
36407
|
+
import * as path93 from "path";
|
|
36465
36408
|
|
|
36466
36409
|
// src/commands/sync/syncCodex.ts
|
|
36467
|
-
import * as
|
|
36410
|
+
import * as path92 from "path";
|
|
36468
36411
|
|
|
36469
36412
|
// src/commands/sync/installHarnessCommands.ts
|
|
36470
36413
|
import * as fs40 from "fs";
|
|
36471
|
-
import * as
|
|
36414
|
+
import * as path90 from "path";
|
|
36472
36415
|
function installHarnessCommands(claudeDir, harness, transform) {
|
|
36473
|
-
const commandsSource =
|
|
36416
|
+
const commandsSource = path90.join(claudeDir, "commands");
|
|
36474
36417
|
const files = fs40.readdirSync(commandsSource);
|
|
36475
36418
|
const names = [];
|
|
36476
36419
|
let synced = 0;
|
|
@@ -36478,9 +36421,9 @@ function installHarnessCommands(claudeDir, harness, transform) {
|
|
|
36478
36421
|
if (!file.endsWith(".md")) continue;
|
|
36479
36422
|
const name = file.replace(/\.md$/, "");
|
|
36480
36423
|
names.push(name);
|
|
36481
|
-
const content = fs40.readFileSync(
|
|
36482
|
-
const target =
|
|
36483
|
-
fs40.mkdirSync(
|
|
36424
|
+
const content = fs40.readFileSync(path90.join(commandsSource, file), "utf8");
|
|
36425
|
+
const target = path90.join(harness.homeDir, harness.sync.commandDest(name));
|
|
36426
|
+
fs40.mkdirSync(path90.dirname(target), { recursive: true });
|
|
36484
36427
|
fs40.writeFileSync(target, transform(name, content));
|
|
36485
36428
|
synced++;
|
|
36486
36429
|
}
|
|
@@ -36509,7 +36452,7 @@ function unexpectedContent(skillDir) {
|
|
|
36509
36452
|
|
|
36510
36453
|
// src/commands/sync/syncCodexHooks.ts
|
|
36511
36454
|
import * as fs42 from "fs";
|
|
36512
|
-
import * as
|
|
36455
|
+
import * as path91 from "path";
|
|
36513
36456
|
var BEGIN = "# >>> assist codex hooks (managed) \u2014 do not edit >>>";
|
|
36514
36457
|
var END = "# <<< assist codex hooks (managed) <<<";
|
|
36515
36458
|
function upsertManagedBlock(existing, body) {
|
|
@@ -36540,9 +36483,9 @@ ${rest}
|
|
|
36540
36483
|
}
|
|
36541
36484
|
function syncCodexHooks(sourcePath) {
|
|
36542
36485
|
const body = fs42.readFileSync(sourcePath, "utf8");
|
|
36543
|
-
const configPath =
|
|
36486
|
+
const configPath = path91.join(harnesses.codex.homeDir, "config.toml");
|
|
36544
36487
|
const existing = fs42.existsSync(configPath) ? fs42.readFileSync(configPath, "utf8") : "";
|
|
36545
|
-
fs42.mkdirSync(
|
|
36488
|
+
fs42.mkdirSync(path91.dirname(configPath), { recursive: true });
|
|
36546
36489
|
fs42.writeFileSync(configPath, upsertManagedBlock(existing, body));
|
|
36547
36490
|
console.log(
|
|
36548
36491
|
"Registered assist codex-hook in ~/.codex/config.toml (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
|
|
@@ -36574,13 +36517,13 @@ function syncCodex(claudeDir, options2) {
|
|
|
36574
36517
|
harnesses.codex,
|
|
36575
36518
|
commandToSkill
|
|
36576
36519
|
);
|
|
36577
|
-
syncCodexHooks(
|
|
36520
|
+
syncCodexHooks(path92.join(claudeDir, "..", "codex", "config.toml"));
|
|
36578
36521
|
console.log(`Synced ${total} skill(s) to ~/.codex/skills`);
|
|
36579
36522
|
if (!options2?.prune) return;
|
|
36580
36523
|
const force = options2.force ?? false;
|
|
36581
36524
|
reportPrune(
|
|
36582
36525
|
"~/.codex/skills",
|
|
36583
|
-
pruneSkills(
|
|
36526
|
+
pruneSkills(path92.join(harnesses.codex.homeDir, "skills"), names, { force }),
|
|
36584
36527
|
force
|
|
36585
36528
|
);
|
|
36586
36529
|
}
|
|
@@ -36595,30 +36538,30 @@ function replaceFileWithoutFollowingSymlink(file, content) {
|
|
|
36595
36538
|
fs43.writeFileSync(file, content);
|
|
36596
36539
|
}
|
|
36597
36540
|
function writeSkill(targetBase, name, content) {
|
|
36598
|
-
const skillDir =
|
|
36541
|
+
const skillDir = path93.join(targetBase, "skills", name);
|
|
36599
36542
|
fs43.mkdirSync(skillDir, { recursive: true });
|
|
36600
36543
|
replaceFileWithoutFollowingSymlink(
|
|
36601
|
-
|
|
36544
|
+
path93.join(skillDir, "SKILL.md"),
|
|
36602
36545
|
commandToSkill(name, content)
|
|
36603
36546
|
);
|
|
36604
|
-
fs43.rmSync(
|
|
36547
|
+
fs43.rmSync(path93.join(targetBase, "commands", `${name}.md`), { force: true });
|
|
36605
36548
|
console.log(`Wrote ${name} as a skill to ${skillDir}`);
|
|
36606
36549
|
}
|
|
36607
36550
|
function syncClaudeCommands(claudeDir, targetBase) {
|
|
36608
|
-
const sourceDir =
|
|
36609
|
-
const targetDir =
|
|
36551
|
+
const sourceDir = path93.join(claudeDir, "commands");
|
|
36552
|
+
const targetDir = path93.join(targetBase, "commands");
|
|
36610
36553
|
fs43.mkdirSync(targetDir, { recursive: true });
|
|
36611
36554
|
const files = fs43.readdirSync(sourceDir);
|
|
36612
36555
|
for (const file of files) {
|
|
36613
|
-
const source =
|
|
36556
|
+
const source = path93.join(sourceDir, file);
|
|
36614
36557
|
if (file.endsWith(".md")) {
|
|
36615
36558
|
const content = fs43.readFileSync(source, "utf8");
|
|
36616
36559
|
if (isSkillFlagged(content)) {
|
|
36617
|
-
writeSkill(targetBase,
|
|
36560
|
+
writeSkill(targetBase, path93.basename(file, ".md"), content);
|
|
36618
36561
|
continue;
|
|
36619
36562
|
}
|
|
36620
36563
|
}
|
|
36621
|
-
fs43.copyFileSync(source,
|
|
36564
|
+
fs43.copyFileSync(source, path93.join(targetDir, file));
|
|
36622
36565
|
console.log(`Copied ${file} to ${targetDir}`);
|
|
36623
36566
|
}
|
|
36624
36567
|
console.log(`Synced ${files.length} command(s) to ~/.claude`);
|
|
@@ -36627,11 +36570,11 @@ function syncClaudeCommands(claudeDir, targetBase) {
|
|
|
36627
36570
|
|
|
36628
36571
|
// src/commands/sync/reportRetiredAgentsFiles.ts
|
|
36629
36572
|
import * as fs44 from "fs";
|
|
36630
|
-
import * as
|
|
36573
|
+
import * as path94 from "path";
|
|
36631
36574
|
var retired = [
|
|
36632
|
-
|
|
36633
|
-
|
|
36634
|
-
|
|
36575
|
+
path94.join(harnesses.claude.homeDir, "CLAUDE.md"),
|
|
36576
|
+
path94.join(harnesses.codex.homeDir, "AGENTS.md"),
|
|
36577
|
+
path94.join(harnesses.pi.homeDir, "AGENTS.md")
|
|
36635
36578
|
];
|
|
36636
36579
|
function reportRetiredAgentsFiles() {
|
|
36637
36580
|
const leftovers = retired.filter((file) => fs44.existsSync(file));
|
|
@@ -36647,35 +36590,35 @@ function reportRetiredAgentsFiles() {
|
|
|
36647
36590
|
|
|
36648
36591
|
// src/commands/sync/syncDesign.ts
|
|
36649
36592
|
import * as fs45 from "fs";
|
|
36650
|
-
import * as
|
|
36593
|
+
import * as path95 from "path";
|
|
36651
36594
|
function syncDesign(claudeDir, targetBase) {
|
|
36652
|
-
const systemPromptSource =
|
|
36653
|
-
const systemPromptTarget =
|
|
36595
|
+
const systemPromptSource = path95.join(claudeDir, "design-system-prompt.md");
|
|
36596
|
+
const systemPromptTarget = path95.join(targetBase, "design-system-prompt.md");
|
|
36654
36597
|
fs45.copyFileSync(systemPromptSource, systemPromptTarget);
|
|
36655
36598
|
console.log(
|
|
36656
36599
|
"Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
|
|
36657
36600
|
);
|
|
36658
|
-
const skillsSource =
|
|
36659
|
-
const skillsTarget =
|
|
36601
|
+
const skillsSource = path95.join(claudeDir, "skills");
|
|
36602
|
+
const skillsTarget = path95.join(targetBase, "skills");
|
|
36660
36603
|
fs45.mkdirSync(skillsTarget, { recursive: true });
|
|
36661
36604
|
const files = fs45.readdirSync(skillsSource);
|
|
36662
36605
|
for (const file of files) {
|
|
36663
36606
|
fs45.copyFileSync(
|
|
36664
|
-
|
|
36665
|
-
|
|
36607
|
+
path95.join(skillsSource, file),
|
|
36608
|
+
path95.join(skillsTarget, file)
|
|
36666
36609
|
);
|
|
36667
36610
|
}
|
|
36668
36611
|
console.log(`Synced ${files.length} design skill(s) to ~/.claude/skills`);
|
|
36669
36612
|
}
|
|
36670
36613
|
|
|
36671
36614
|
// src/commands/sync/syncPi.ts
|
|
36672
|
-
import * as
|
|
36615
|
+
import * as path97 from "path";
|
|
36673
36616
|
|
|
36674
36617
|
// src/commands/sync/syncPiHooks.ts
|
|
36675
36618
|
import * as fs46 from "fs";
|
|
36676
|
-
import * as
|
|
36619
|
+
import * as path96 from "path";
|
|
36677
36620
|
function piExtensionsDir() {
|
|
36678
|
-
return
|
|
36621
|
+
return path96.join(harnesses.pi.homeDir, "extensions");
|
|
36679
36622
|
}
|
|
36680
36623
|
function syncPiHooks(sourceDir) {
|
|
36681
36624
|
const target = piExtensionsDir();
|
|
@@ -36683,8 +36626,8 @@ function syncPiHooks(sourceDir) {
|
|
|
36683
36626
|
const files = fs46.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
|
|
36684
36627
|
for (const file of files) {
|
|
36685
36628
|
fs46.copyFileSync(
|
|
36686
|
-
|
|
36687
|
-
|
|
36629
|
+
path96.join(sourceDir, file),
|
|
36630
|
+
path96.join(target, `assist-${file}`)
|
|
36688
36631
|
);
|
|
36689
36632
|
}
|
|
36690
36633
|
console.log(
|
|
@@ -36721,24 +36664,24 @@ function syncPi(claudeDir, options2) {
|
|
|
36721
36664
|
harnesses.pi,
|
|
36722
36665
|
commandToPrompt
|
|
36723
36666
|
);
|
|
36724
|
-
syncPiHooks(
|
|
36667
|
+
syncPiHooks(path97.join(claudeDir, "..", "pi"));
|
|
36725
36668
|
console.log(`Synced ${synced} prompt(s) to ~/.pi/agent/prompts`);
|
|
36726
36669
|
if (!options2?.prune) return;
|
|
36727
36670
|
const force = options2.force ?? false;
|
|
36728
36671
|
reportPrune(
|
|
36729
36672
|
"~/.pi/agent/prompts",
|
|
36730
|
-
pruneCommands(
|
|
36673
|
+
pruneCommands(path97.join(harnesses.pi.homeDir, "prompts"), names, { force }),
|
|
36731
36674
|
force
|
|
36732
36675
|
);
|
|
36733
36676
|
}
|
|
36734
36677
|
|
|
36735
36678
|
// src/commands/sync/syncSettings.ts
|
|
36736
36679
|
import * as fs47 from "fs";
|
|
36737
|
-
import * as
|
|
36680
|
+
import * as path98 from "path";
|
|
36738
36681
|
import chalk250 from "chalk";
|
|
36739
36682
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
36740
|
-
const source =
|
|
36741
|
-
const target =
|
|
36683
|
+
const source = path98.join(claudeDir, "settings.json");
|
|
36684
|
+
const target = path98.join(targetBase, "settings.json");
|
|
36742
36685
|
const sourceContent = fs47.readFileSync(source, "utf8");
|
|
36743
36686
|
const sourceSettings = JSON.parse(sourceContent);
|
|
36744
36687
|
const targetExists = fs47.existsSync(target);
|
|
@@ -36778,13 +36721,13 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
36778
36721
|
|
|
36779
36722
|
// src/commands/sync.ts
|
|
36780
36723
|
var __filename4 = fileURLToPath8(import.meta.url);
|
|
36781
|
-
var __dirname5 =
|
|
36724
|
+
var __dirname5 = path99.dirname(__filename4);
|
|
36782
36725
|
async function sync(options2) {
|
|
36783
36726
|
const config = loadConfig();
|
|
36784
36727
|
const yes = options2?.yes ?? config.sync.autoConfirm;
|
|
36785
36728
|
const prune = { prune: options2?.prune, force: options2?.force };
|
|
36786
|
-
const claudeDir =
|
|
36787
|
-
const targetBase =
|
|
36729
|
+
const claudeDir = path99.join(__dirname5, "..", "claude");
|
|
36730
|
+
const targetBase = path99.join(os5.homedir(), ".claude");
|
|
36788
36731
|
const commandFiles = syncClaudeCommands(claudeDir, targetBase);
|
|
36789
36732
|
syncDesign(claudeDir, targetBase);
|
|
36790
36733
|
await syncSettings(claudeDir, targetBase, { yes });
|
|
@@ -36792,11 +36735,11 @@ async function sync(options2) {
|
|
|
36792
36735
|
syncPi(claudeDir, prune);
|
|
36793
36736
|
reportRetiredAgentsFiles();
|
|
36794
36737
|
if (!options2?.prune) return;
|
|
36795
|
-
const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) =>
|
|
36738
|
+
const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path99.basename(file, ".md"));
|
|
36796
36739
|
const force = options2.force ?? false;
|
|
36797
36740
|
reportPrune(
|
|
36798
36741
|
"~/.claude/commands",
|
|
36799
|
-
pruneCommands(
|
|
36742
|
+
pruneCommands(path99.join(targetBase, "commands"), commandNames, { force }),
|
|
36800
36743
|
force
|
|
36801
36744
|
);
|
|
36802
36745
|
}
|
|
@@ -37852,9 +37795,9 @@ import { existsSync as existsSync79, readFileSync as readFileSync60 } from "fs";
|
|
|
37852
37795
|
|
|
37853
37796
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
37854
37797
|
import { minimatch as minimatch9 } from "minimatch";
|
|
37855
|
-
function resolveStringsAtPath(data,
|
|
37798
|
+
function resolveStringsAtPath(data, path106) {
|
|
37856
37799
|
let current = data;
|
|
37857
|
-
for (const segment of
|
|
37800
|
+
for (const segment of path106.split(".")) {
|
|
37858
37801
|
if (current === null || typeof current !== "object") return [];
|
|
37859
37802
|
current = current[segment];
|
|
37860
37803
|
}
|
|
@@ -37867,10 +37810,10 @@ function resolveStringsAtPath(data, path107) {
|
|
|
37867
37810
|
}
|
|
37868
37811
|
function findRuleViolations(data, rule) {
|
|
37869
37812
|
const violations = [];
|
|
37870
|
-
for (const
|
|
37871
|
-
for (const value of resolveStringsAtPath(data,
|
|
37813
|
+
for (const path106 of rule.paths) {
|
|
37814
|
+
for (const value of resolveStringsAtPath(data, path106)) {
|
|
37872
37815
|
if (minimatch9(value, rule.disallowed))
|
|
37873
|
-
violations.push({ file: rule.file, path:
|
|
37816
|
+
violations.push({ file: rule.file, path: path106, value });
|
|
37874
37817
|
}
|
|
37875
37818
|
}
|
|
37876
37819
|
return violations;
|
|
@@ -37909,8 +37852,8 @@ function forbiddenStrings() {
|
|
|
37909
37852
|
process.exit(0);
|
|
37910
37853
|
}
|
|
37911
37854
|
console.log("Forbidden strings found:\n");
|
|
37912
|
-
for (const { file, path:
|
|
37913
|
-
console.log(` ${file} ${
|
|
37855
|
+
for (const { file, path: path106, value } of violations) {
|
|
37856
|
+
console.log(` ${file} ${path106}: ${value}`);
|
|
37914
37857
|
}
|
|
37915
37858
|
console.log(`
|
|
37916
37859
|
Total: ${violations.length} forbidden string(s).`);
|
|
@@ -37966,7 +37909,7 @@ Total: ${lines2.length} hardcoded color(s)`);
|
|
|
37966
37909
|
|
|
37967
37910
|
// src/commands/verify/migrations.ts
|
|
37968
37911
|
import { readFileSync as readFileSync61 } from "fs";
|
|
37969
|
-
import
|
|
37912
|
+
import path101 from "path";
|
|
37970
37913
|
|
|
37971
37914
|
// src/commands/verify/migrations/checkAppendOnly.ts
|
|
37972
37915
|
function checkAppendOnly(baseline, current) {
|
|
@@ -38058,15 +38001,15 @@ function readBaselineMigrations(repoRelativeDir, ref) {
|
|
|
38058
38001
|
} catch {
|
|
38059
38002
|
return baseline;
|
|
38060
38003
|
}
|
|
38061
|
-
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((
|
|
38062
|
-
for (const
|
|
38004
|
+
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path106) => MIGRATION_FILE3.test(basename26(path106)));
|
|
38005
|
+
for (const path106 of paths) {
|
|
38063
38006
|
try {
|
|
38064
|
-
const content = execSync63(`git show "${ref}:${
|
|
38007
|
+
const content = execSync63(`git show "${ref}:${path106}"`, {
|
|
38065
38008
|
encoding: "utf8",
|
|
38066
38009
|
maxBuffer: 16 * 1024 * 1024,
|
|
38067
38010
|
stdio: ["pipe", "pipe", "pipe"]
|
|
38068
38011
|
});
|
|
38069
|
-
baseline.set(basename26(
|
|
38012
|
+
baseline.set(basename26(path106), content);
|
|
38070
38013
|
} catch {
|
|
38071
38014
|
}
|
|
38072
38015
|
}
|
|
@@ -38105,11 +38048,11 @@ function resolveBaselineRef() {
|
|
|
38105
38048
|
}
|
|
38106
38049
|
|
|
38107
38050
|
// src/commands/verify/migrations/migrationsDir.ts
|
|
38108
|
-
import
|
|
38051
|
+
import path100 from "path";
|
|
38109
38052
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
38110
38053
|
function migrationsDir() {
|
|
38111
|
-
return
|
|
38112
|
-
|
|
38054
|
+
return path100.resolve(
|
|
38055
|
+
path100.dirname(fileURLToPath9(import.meta.url)),
|
|
38113
38056
|
"../../../shared/db/migrations"
|
|
38114
38057
|
);
|
|
38115
38058
|
}
|
|
@@ -38130,7 +38073,7 @@ function migrations2() {
|
|
|
38130
38073
|
if (ref) {
|
|
38131
38074
|
const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
|
|
38132
38075
|
const current = new Map(
|
|
38133
|
-
files.map((file) => [file, readFileSync61(
|
|
38076
|
+
files.map((file) => [file, readFileSync61(path101.join(dir, file), "utf8")])
|
|
38134
38077
|
);
|
|
38135
38078
|
for (const finding of checkAppendOnly(baseline, current)) {
|
|
38136
38079
|
problems.push(
|
|
@@ -38635,11 +38578,11 @@ var webUiPrefix = "src/commands/sessions/web/ui/";
|
|
|
38635
38578
|
var sessionsPrefix = "src/commands/sessions/";
|
|
38636
38579
|
var rules = [
|
|
38637
38580
|
{
|
|
38638
|
-
matches: (
|
|
38581
|
+
matches: (path106) => path106.startsWith(webUiPrefix),
|
|
38639
38582
|
advice: "restart the web server, then hard-reload the browser tab"
|
|
38640
38583
|
},
|
|
38641
38584
|
{
|
|
38642
|
-
matches: (
|
|
38585
|
+
matches: (path106) => path106.startsWith(sessionsPrefix) && !path106.startsWith(webUiPrefix),
|
|
38643
38586
|
advice: "restart the daemon"
|
|
38644
38587
|
}
|
|
38645
38588
|
];
|
|
@@ -38650,27 +38593,27 @@ function restartAdvice(paths) {
|
|
|
38650
38593
|
// src/commands/watch/syncAdvice.ts
|
|
38651
38594
|
var rules2 = [
|
|
38652
38595
|
{
|
|
38653
|
-
matches: (
|
|
38596
|
+
matches: (path106) => path106.startsWith("claude/commands/"),
|
|
38654
38597
|
reason: "claude/commands changed"
|
|
38655
38598
|
},
|
|
38656
38599
|
{
|
|
38657
|
-
matches: (
|
|
38600
|
+
matches: (path106) => path106.startsWith("claude/skills/"),
|
|
38658
38601
|
reason: "claude/skills changed"
|
|
38659
38602
|
},
|
|
38660
38603
|
{
|
|
38661
|
-
matches: (
|
|
38604
|
+
matches: (path106) => path106 === "claude/settings.json",
|
|
38662
38605
|
reason: "claude/settings.json changed"
|
|
38663
38606
|
},
|
|
38664
38607
|
{
|
|
38665
|
-
matches: (
|
|
38608
|
+
matches: (path106) => path106 === "claude/design-system-prompt.md",
|
|
38666
38609
|
reason: "claude/design-system-prompt.md changed"
|
|
38667
38610
|
},
|
|
38668
38611
|
{
|
|
38669
|
-
matches: (
|
|
38612
|
+
matches: (path106) => path106.startsWith("codex/"),
|
|
38670
38613
|
reason: "codex sources changed"
|
|
38671
38614
|
},
|
|
38672
38615
|
{
|
|
38673
|
-
matches: (
|
|
38616
|
+
matches: (path106) => path106.startsWith("pi/"),
|
|
38674
38617
|
reason: "pi sources changed"
|
|
38675
38618
|
}
|
|
38676
38619
|
];
|
|
@@ -39321,9 +39264,9 @@ function findPortFile(roamDir) {
|
|
|
39321
39264
|
return void 0;
|
|
39322
39265
|
}
|
|
39323
39266
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
39324
|
-
const
|
|
39267
|
+
const path106 = join101(roamDir, name);
|
|
39325
39268
|
try {
|
|
39326
|
-
return { path:
|
|
39269
|
+
return { path: path106, mtimeMs: statSync13(path106).mtimeMs };
|
|
39327
39270
|
} catch {
|
|
39328
39271
|
return void 0;
|
|
39329
39272
|
}
|
|
@@ -39567,11 +39510,11 @@ function findLinkIndex() {
|
|
|
39567
39510
|
function parseLinkArgs() {
|
|
39568
39511
|
const idx = findLinkIndex();
|
|
39569
39512
|
if (idx === -1) return null;
|
|
39570
|
-
const
|
|
39513
|
+
const path106 = process.argv[idx + 1];
|
|
39571
39514
|
const rest = process.argv.slice(idx + 2);
|
|
39572
39515
|
const { value: prefix2 } = extractOption(rest, "--prefix");
|
|
39573
39516
|
if (!prefix2) return null;
|
|
39574
|
-
return { path:
|
|
39517
|
+
return { path: path106, prefix: prefix2 };
|
|
39575
39518
|
}
|
|
39576
39519
|
function hasDuplicateLink(runList, linkPath) {
|
|
39577
39520
|
return runList.some(
|
|
@@ -40216,14 +40159,14 @@ import * as pty from "node-pty";
|
|
|
40216
40159
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
40217
40160
|
import { chmodSync, existsSync as existsSync87, statSync as statSync14 } from "fs";
|
|
40218
40161
|
import { createRequire as createRequire3 } from "module";
|
|
40219
|
-
import
|
|
40162
|
+
import path102 from "path";
|
|
40220
40163
|
var require4 = createRequire3(import.meta.url);
|
|
40221
40164
|
var ensured = false;
|
|
40222
40165
|
function ensureSpawnHelperExecutable() {
|
|
40223
40166
|
if (ensured || process.platform !== "darwin") return;
|
|
40224
40167
|
ensured = true;
|
|
40225
|
-
const ptyRoot =
|
|
40226
|
-
const helper =
|
|
40168
|
+
const ptyRoot = path102.join(path102.dirname(require4.resolve("node-pty")), "..");
|
|
40169
|
+
const helper = path102.join(
|
|
40227
40170
|
ptyRoot,
|
|
40228
40171
|
"prebuilds",
|
|
40229
40172
|
`${process.platform}-${process.arch}`,
|
|
@@ -40354,12 +40297,12 @@ function serverRunMeta(runName, cwd) {
|
|
|
40354
40297
|
|
|
40355
40298
|
// src/commands/sessions/daemon/readDesignSystemPrompt.ts
|
|
40356
40299
|
import * as fs50 from "fs";
|
|
40357
|
-
import * as
|
|
40300
|
+
import * as path103 from "path";
|
|
40358
40301
|
import { fileURLToPath as fileURLToPath11 } from "url";
|
|
40359
40302
|
var __filename5 = fileURLToPath11(import.meta.url);
|
|
40360
|
-
var __dirname7 =
|
|
40303
|
+
var __dirname7 = path103.dirname(__filename5);
|
|
40361
40304
|
function readDesignSystemPrompt() {
|
|
40362
|
-
const promptPath =
|
|
40305
|
+
const promptPath = path103.join(
|
|
40363
40306
|
__dirname7,
|
|
40364
40307
|
"..",
|
|
40365
40308
|
"claude",
|
|
@@ -41393,8 +41336,8 @@ async function seedRunningMsFromUsage(session, notify2) {
|
|
|
41393
41336
|
var DEBOUNCE_MS2 = 50;
|
|
41394
41337
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
41395
41338
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
41396
|
-
const
|
|
41397
|
-
const dir = dirname42(
|
|
41339
|
+
const path106 = activityPath(session.id);
|
|
41340
|
+
const dir = dirname42(path106);
|
|
41398
41341
|
try {
|
|
41399
41342
|
mkdirSync37(dir, { recursive: true });
|
|
41400
41343
|
} catch {
|
|
@@ -41404,7 +41347,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
41404
41347
|
let timer = null;
|
|
41405
41348
|
const read3 = () => {
|
|
41406
41349
|
timer = null;
|
|
41407
|
-
const activity2 = readActivity(
|
|
41350
|
+
const activity2 = readActivity(path106);
|
|
41408
41351
|
if (!activity2) return;
|
|
41409
41352
|
applyActivityToSession(session, activity2);
|
|
41410
41353
|
if (activity2.claudeSessionId) onClaudeSessionId?.(session);
|
|
@@ -41413,11 +41356,11 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
41413
41356
|
notify2();
|
|
41414
41357
|
};
|
|
41415
41358
|
session.activityWatcher = watch2(dir, (_event, filename) => {
|
|
41416
|
-
if (filename && !
|
|
41359
|
+
if (filename && !path106.endsWith(filename)) return;
|
|
41417
41360
|
if (timer) clearTimeout(timer);
|
|
41418
41361
|
timer = setTimeout(read3, DEBOUNCE_MS2);
|
|
41419
41362
|
});
|
|
41420
|
-
if (existsSync93(
|
|
41363
|
+
if (existsSync93(path106)) read3();
|
|
41421
41364
|
}
|
|
41422
41365
|
function refreshActivity(session) {
|
|
41423
41366
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -41560,12 +41503,12 @@ import { watch as watch3 } from "fs";
|
|
|
41560
41503
|
|
|
41561
41504
|
// src/commands/sessions/shared/findTranscriptPathSync.ts
|
|
41562
41505
|
import * as fs52 from "fs";
|
|
41563
|
-
import * as
|
|
41506
|
+
import * as path104 from "path";
|
|
41564
41507
|
function projectDirForCwd(cwd) {
|
|
41565
|
-
return
|
|
41508
|
+
return path104.join(claudeProjectsRoot(), projectSlug(cwd));
|
|
41566
41509
|
}
|
|
41567
41510
|
function transcriptPathFor(cwd, claudeSessionId) {
|
|
41568
|
-
return
|
|
41511
|
+
return path104.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
|
|
41569
41512
|
}
|
|
41570
41513
|
function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
41571
41514
|
const direct = transcriptPathFor(cwd, claudeSessionId);
|
|
@@ -41579,8 +41522,8 @@ function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
|
41579
41522
|
}
|
|
41580
41523
|
for (const file of files) {
|
|
41581
41524
|
if (!file.endsWith(".jsonl")) continue;
|
|
41582
|
-
if (headContainsSessionId(
|
|
41583
|
-
return
|
|
41525
|
+
if (headContainsSessionId(path104.join(dir, file), claudeSessionId))
|
|
41526
|
+
return path104.join(dir, file);
|
|
41584
41527
|
}
|
|
41585
41528
|
return null;
|
|
41586
41529
|
}
|
|
@@ -42780,9 +42723,9 @@ function tempRoots() {
|
|
|
42780
42723
|
}
|
|
42781
42724
|
return [...roots];
|
|
42782
42725
|
}
|
|
42783
|
-
function underTempRoot(
|
|
42726
|
+
function underTempRoot(path106) {
|
|
42784
42727
|
return tempRoots().some(
|
|
42785
|
-
(root2) =>
|
|
42728
|
+
(root2) => path106.startsWith(root2.endsWith(sep3) ? root2 : root2 + sep3)
|
|
42786
42729
|
);
|
|
42787
42730
|
}
|
|
42788
42731
|
|
|
@@ -43268,15 +43211,15 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
43268
43211
|
import { existsSync as existsSync95 } from "fs";
|
|
43269
43212
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
43270
43213
|
if (!existsSync95(clone)) {
|
|
43271
|
-
for (const { path:
|
|
43214
|
+
for (const { path: path106 } of paths) forgetWorktree(path106);
|
|
43272
43215
|
daemonLog(
|
|
43273
43216
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
43274
43217
|
);
|
|
43275
43218
|
return;
|
|
43276
43219
|
}
|
|
43277
43220
|
await pruneBookkeeping2(clone);
|
|
43278
|
-
for (const { path:
|
|
43279
|
-
if (await reclaimBranch(clone, branch2)) forgetWorktree(
|
|
43221
|
+
for (const { path: path106, branch: branch2 } of paths)
|
|
43222
|
+
if (await reclaimBranch(clone, branch2)) forgetWorktree(path106);
|
|
43280
43223
|
}
|
|
43281
43224
|
async function pruneBookkeeping2(clone) {
|
|
43282
43225
|
try {
|
|
@@ -43303,37 +43246,37 @@ async function reclaimBranch(clone, branch2) {
|
|
|
43303
43246
|
}
|
|
43304
43247
|
|
|
43305
43248
|
// src/commands/sessions/daemon/worktree/logVanishedTree.ts
|
|
43306
|
-
function logVanishedTree(sessions,
|
|
43249
|
+
function logVanishedTree(sessions, path106) {
|
|
43307
43250
|
const claimants = [...sessions.values()].filter(
|
|
43308
|
-
(s) => s.cwd ===
|
|
43251
|
+
(s) => s.cwd === path106 || s.worktree?.path === path106
|
|
43309
43252
|
);
|
|
43310
43253
|
if (claimants.length === 0) {
|
|
43311
|
-
daemonLog(`worktree ${
|
|
43254
|
+
daemonLog(`worktree ${path106} gone from disk and unclaimed; reclaiming it`);
|
|
43312
43255
|
return;
|
|
43313
43256
|
}
|
|
43314
43257
|
for (const s of claimants)
|
|
43315
43258
|
daemonLog(
|
|
43316
|
-
`session ${s.id} ("${s.name}") claims worktree ${
|
|
43259
|
+
`session ${s.id} ("${s.name}") claims worktree ${path106}, which is gone from disk; reclaiming it`
|
|
43317
43260
|
);
|
|
43318
43261
|
}
|
|
43319
43262
|
|
|
43320
43263
|
// src/commands/sessions/daemon/worktree/describeHeldWork.ts
|
|
43321
43264
|
var MAX_ITEMS = 20;
|
|
43322
|
-
async function describeHeldWork(
|
|
43323
|
-
if (reason4.startsWith("uncommitted")) return await changedFiles(
|
|
43324
|
-
if (reason4.startsWith("unpushed")) return await unpushedCommits(
|
|
43265
|
+
async function describeHeldWork(path106, reason4) {
|
|
43266
|
+
if (reason4.startsWith("uncommitted")) return await changedFiles(path106);
|
|
43267
|
+
if (reason4.startsWith("unpushed")) return await unpushedCommits(path106, reason4);
|
|
43325
43268
|
return { summary: reason4, items: [] };
|
|
43326
43269
|
}
|
|
43327
|
-
async function changedFiles(
|
|
43328
|
-
const status3 = await gitResult(
|
|
43270
|
+
async function changedFiles(path106) {
|
|
43271
|
+
const status3 = await gitResult(path106, ["status", "--porcelain"]);
|
|
43329
43272
|
const lines2 = status3.ok ? nonEmptyLines(status3.out) : [];
|
|
43330
43273
|
return {
|
|
43331
43274
|
summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
|
|
43332
43275
|
items: capped2(lines2)
|
|
43333
43276
|
};
|
|
43334
43277
|
}
|
|
43335
|
-
async function unpushedCommits(
|
|
43336
|
-
const log2 = await gitResult(
|
|
43278
|
+
async function unpushedCommits(path106, reason4) {
|
|
43279
|
+
const log2 = await gitResult(path106, ["log", "--oneline", "@{upstream}..HEAD"]);
|
|
43337
43280
|
if (!log2.ok) return { summary: reason4, items: [] };
|
|
43338
43281
|
const lines2 = nonEmptyLines(log2.out);
|
|
43339
43282
|
return {
|
|
@@ -43425,24 +43368,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
|
|
|
43425
43368
|
async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
43426
43369
|
const accounted = accountedTrees(sessions);
|
|
43427
43370
|
const vanished = /* @__PURE__ */ new Map();
|
|
43428
|
-
for (const { path:
|
|
43429
|
-
if (underTempRoot(
|
|
43430
|
-
forgetWorktree(
|
|
43371
|
+
for (const { path: path106, clone } of readWorktreeRegistry()) {
|
|
43372
|
+
if (underTempRoot(path106)) {
|
|
43373
|
+
forgetWorktree(path106);
|
|
43431
43374
|
daemonLog(
|
|
43432
|
-
`worktree ${
|
|
43375
|
+
`worktree ${path106} lies outside any project root; pruned from the registry rather than recovered`
|
|
43433
43376
|
);
|
|
43434
43377
|
continue;
|
|
43435
43378
|
}
|
|
43436
|
-
if (!existsSync96(
|
|
43437
|
-
logVanishedTree(sessions,
|
|
43379
|
+
if (!existsSync96(path106)) {
|
|
43380
|
+
logVanishedTree(sessions, path106);
|
|
43438
43381
|
vanished.set(clone, [
|
|
43439
43382
|
...vanished.get(clone) ?? [],
|
|
43440
|
-
{ path:
|
|
43383
|
+
{ path: path106, branch: basename29(path106) }
|
|
43441
43384
|
]);
|
|
43442
43385
|
continue;
|
|
43443
43386
|
}
|
|
43444
|
-
if (accounted.has(
|
|
43445
|
-
await recoverOrphan(sessions, spawnWith, { path:
|
|
43387
|
+
if (accounted.has(path106)) continue;
|
|
43388
|
+
await recoverOrphan(sessions, spawnWith, { path: path106, clone }, notify2);
|
|
43446
43389
|
}
|
|
43447
43390
|
for (const [clone, paths] of vanished)
|
|
43448
43391
|
await reclaimVanishedWorktrees(clone, paths);
|
|
@@ -45520,12 +45463,12 @@ function handleSetStatus(client, m, d) {
|
|
|
45520
45463
|
import * as fs56 from "fs";
|
|
45521
45464
|
|
|
45522
45465
|
// src/commands/sessions/shared/codex/findCodexRolloutPath.ts
|
|
45523
|
-
import * as
|
|
45466
|
+
import * as path105 from "path";
|
|
45524
45467
|
async function findCodexRolloutPath(sessionId) {
|
|
45525
45468
|
if (!sessionId) return null;
|
|
45526
45469
|
const paths = await discoverCodexRolloutPaths();
|
|
45527
45470
|
const suffix = `-${sessionId}.jsonl`;
|
|
45528
|
-
return paths.find((file) =>
|
|
45471
|
+
return paths.find((file) => path105.basename(file).endsWith(suffix)) ?? null;
|
|
45529
45472
|
}
|
|
45530
45473
|
|
|
45531
45474
|
// src/commands/sessions/shared/codex/codexToolTarget.ts
|
|
@@ -46108,13 +46051,13 @@ function describePeerError(error) {
|
|
|
46108
46051
|
const cause = error.cause;
|
|
46109
46052
|
return cause instanceof Error ? `${error.message}: ${describePeerError(cause)}` : error.message;
|
|
46110
46053
|
}
|
|
46111
|
-
async function fetchPeerJson(baseUrl,
|
|
46112
|
-
const res = await fetch(new URL(
|
|
46054
|
+
async function fetchPeerJson(baseUrl, path106, timeoutMs = PEER_TIMEOUT_MS) {
|
|
46055
|
+
const res = await fetch(new URL(path106, baseUrl), {
|
|
46113
46056
|
signal: AbortSignal.timeout(timeoutMs)
|
|
46114
46057
|
});
|
|
46115
46058
|
if (!res.ok)
|
|
46116
46059
|
throw Object.assign(
|
|
46117
|
-
new Error(`GET ${
|
|
46060
|
+
new Error(`GET ${path106} returned ${res.status} ${res.statusText}`),
|
|
46118
46061
|
{ status: res.status }
|
|
46119
46062
|
);
|
|
46120
46063
|
return await res.json();
|